/*
* XmlDigitalTeaching v0.0.1
* Copyright ©Thu Jul 24 2025 15:16:57 GMT+0800 (中国标准时间) smile
* Released under the ISC License.
*/
import crypto from 'crypto';
import Vue from 'vue';
import lodash from 'lodash';

let componentNamespace = 'xml';
// 组件前缀命名只能更新一次，防止重复执行修改组件注册出错
let isUpdated = false;
// scss 命名不能通过 js 更改，在 SCSS 编译已经打包好了
const cssNamespace = 'xml';
const statePrefix = 'is-';
function createNamespace$1(name, {
  prefix,
  isUnPrefix
}) {
  let useNamespace;
  if (!isUpdated) {
    isUpdated = true;
    useNamespace = prefix || componentNamespace; // 更改前缀
  }
  if (prefix) {
    if (name.indexOf(componentNamespace) === 0) {
      return name.replace(componentNamespace, prefix);
    }
    return useNamespace.charAt(0).toUpperCase() + useNamespace.substr(1) + name;
  }
  if (name.indexOf(componentNamespace) === 0 || name.indexOf(componentNamespace.charAt(0).toUpperCase()) === 0) {
    return name.charAt(0).toUpperCase() + name.substr(1);
  }
  return isUnPrefix ? name.charAt(0).toLowerCase() + name.substr(1) : componentNamespace + name.charAt(0).toUpperCase() + name.substr(1);
}

/**
 * 生成 bem
 * @param {} namespace 命名空间
 * @param {*} block 块
 * @param {*} blockSuffix 块多个单词
 * @param {*} element 元素
 * @param {*} modifier 修饰符
 * @returns
 */
const _bem = (namespace, block, blockSuffix, element, modifier) => {
  let cls = `${namespace}-${block}`;
  if (blockSuffix) {
    cls += `-${blockSuffix}`;
  }
  if (element) {
    cls += `__${element}`;
  }
  if (modifier) {
    cls += `--${modifier}`;
  }
  return cls;
};
const useNamespace = (block, namespace = cssNamespace) => {
  const b = (blockSuffix = '') => _bem(namespace, block, blockSuffix, '', '');
  const e = element => element ? _bem(namespace, block, '', element, '') : '';
  const m = modifier => modifier ? _bem(namespace, block, '', '', modifier) : '';
  const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace, block, blockSuffix, element, '') : '';
  const em = (element, modifier) => element && modifier ? _bem(namespace, block, '', element, modifier) : '';
  const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace, block, blockSuffix, '', modifier) : '';
  const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace, block, blockSuffix, element, modifier) : '';
  const is = (name, ...args) => {
    const state = args.length >= 1 ? args[0] : true;
    return name && state ? `${statePrefix}${name}` : '';
  };

  // for css var
  // --el-xxx: value;
  const cssVar = object => {
    const styles = {};
    for (const key in object) {
      styles[`--${namespace}-${key}`] = object[key];
    }
    return styles;
  };

  // with block
  const cssVarBlock = object => {
    const styles = {};
    for (const key in object) {
      styles[`--${namespace}-${block}-${key}`] = object[key];
    }
    return styles;
  };
  const cssVarName = name => `--${namespace}-${name}`;
  const cssVarBlockName = name => `--${namespace}-${block}-${name}`;
  return {
    cssNamespace,
    componentNamespace,
    b,
    e,
    m,
    be,
    em,
    bm,
    bem,
    is,
    // css
    cssVar,
    cssVarName,
    cssVarBlock,
    cssVarBlockName
  };
};

// 样式资源包
let chalk = '';
// 默认主题
let defaultTheme = '#409EFF';
const tintColor = (color, tint) => {
  color = color.replace('#', '');
  let red = parseInt(color.slice(0, 2), 16);
  let green = parseInt(color.slice(2, 4), 16);
  let blue = parseInt(color.slice(4, 6), 16);
  if (tint === 0) {
    // when primary color is in its rgb space
    return [red, green, blue].join(',');
  } else {
    red += Math.round(tint * (255 - red));
    green += Math.round(tint * (255 - green));
    blue += Math.round(tint * (255 - blue));
    red = red.toString(16);
    green = green.toString(16);
    blue = blue.toString(16);
    console.log('tintColor return', color, tint, `#${red}${green}${blue}`);
    return `#${red}${green}${blue}`;
  }
};
const shadeColor = (color, shade) => {
  let red = parseInt(color.slice(0, 2), 16);
  let green = parseInt(color.slice(2, 4), 16);
  let blue = parseInt(color.slice(4, 6), 16);
  red = Math.round((1 - shade) * red);
  green = Math.round((1 - shade) * green);
  blue = Math.round((1 - shade) * blue);
  red = red.toString(16);
  green = green.toString(16);
  blue = blue.toString(16);
  console.log('shadeColor return', color, shade, `#${red}${green}${blue}`);
  return `#${red}${green}${blue}`;
};
const getThemeCluster = function (theme) {
  const clusters = [theme];
  for (let i = 0; i <= 9; i++) {
    clusters.push(tintColor(theme, Number((i / 10).toFixed(2))));
  }
  clusters.push(shadeColor(theme, 0.1));
  console.log('getThemeCluster return', theme, clusters);
  return clusters;
};
const getCSSString = function (url) {
  return new Promise(resolve => {
    const xhr = new XMLHttpRequest();
    xhr.onreadystatechange = () => {
      if (xhr.readyState === 4 && xhr.status === 200) {
        chalk = xhr.responseText.replace(/@font-face{[^}]+}/, '');
        console.log('getCSSString: chalk', chalk);
        resolve();
      }
    };
    xhr.onerror = err => {
      console.error('样式下载失败', err);
    };
    xhr.open('GET', url);
    xhr.send();
  });
};
const updateStyle$1 = function (style, oldCluster, newCluster) {
  let newStyle = style;
  oldCluster.forEach((color, index) => {
    newStyle = newStyle.replace(new RegExp(color, 'ig'), newCluster[index]);
  });
  console.log('updateStyle: newStyle', newStyle);
  return newStyle;
};
const updateElementTheme = async function (options = {}) {
  const {
    version = '2.15.8',
    oldTheme,
    primaryColor,
    appendDom,
    insertBefore,
    cssUrl,
    chalkStyle = 'chalk-style'
  } = options;
  if (typeof primaryColor !== 'string') return;
  const themeCluster = getThemeCluster(primaryColor.replace('#', ''));
  const originalCluster = getThemeCluster((oldTheme || defaultTheme).replace('#', ''));
  const chalkHandler = id => {
    const newStyle = updateStyle$1(chalk, originalCluster, themeCluster);
    // 覆盖原来的样式
    chalk = newStyle;
    let styleTag = document.querySelector(id);
    if (!styleTag) {
      styleTag = document.createElement('style');
      styleTag.setAttribute('id', id);
      if (appendDom) {
        if (insertBefore) {
          appendDom.parentNode.insertBefore(styleTag, appendDom.nextSibling);
        } else {
          appendDom.appendChild(styleTag);
        }
      } else {
        document.head.appendChild(styleTag);
      }
    }
    styleTag.innerText = newStyle;
  };
  if (!chalk) {
    const url = cssUrl || `https://unpkg.com/element-ui@${version}/lib/theme-chalk/index.css`;
    await getCSSString(url);
  }
  chalkHandler(chalkStyle);
  defaultTheme = primaryColor;
};

const updateUITheme = async function (options) {
  const {
    oldTheme = '#409EFF',
    primaryColor,
    primarySecondColor,
    opacity = 0.7,
    elementUI,
    button = {
      disabledFontColorPrimary: '#fff',
      disabledBgColorPrimary: '#ccc',
      disabledFontColorPlain: '#999',
      disabledBgColorPlain: '#f5f5f5',
      disabledFontColorGhost: '#999',
      disabledBorderColorGhost: '#ccc'
    }
  } = options;
  if (!primaryColor) return;
  if (elementUI) {
    try {
      await updateElementTheme({
        oldTheme,
        primaryColor: primaryColor
      });
    } catch (err) {
      console.error(err);
    }
  }

  // const primaryOpc = colorPalette(primary, opacity)
  // 第二种主题透明

  const primarySecOpc = primarySecondColor ? tintColor(primarySecondColor, Number((1 - opacity).toFixed(2))) : '';
  // const primaryDis = colorPalette(primary, disOpacity)
  // const primarySecDis = colorPalette(primarySecondColor, disOpacity)
  const primaryLightColors = [];
  const el = document.documentElement;
  el.style.setProperty(`--${cssNamespace}-color-primary`, primaryColor);
  for (let i = 1; i <= 9; i++) {
    const color = tintColor(primaryColor, Number((0.1 * i).toFixed(2)));
    primaryLightColors.push(color);
    el.style.setProperty(`--${cssNamespace}-color-primary-light-${i}`, color);
  }

  // disabled primary
  el.style.setProperty(`--${cssNamespace}-button-disabled-font-color-primary`, button.disabledFontColorPrimary);
  el.style.setProperty(`--${cssNamespace}-button-disabled-bg-color-primary`, button.disabledBgColorPrimary);
  el.style.setProperty(`--${cssNamespace}-button-disabled-border-color-primary`, button.disabledBgColorPrimary);
  // plain
  el.style.setProperty(`--${cssNamespace}-button-disabled-font-color-primary-plain`, button.disabledFontColorPlain);
  el.style.setProperty(`--${cssNamespace}-button-disabled-bg-color-primary-plain`, button.disabledBgColorPlain);
  // ghost
  el.style.setProperty(`--${cssNamespace}-button-disabled-font-color-primary-ghost`, button.disabledFontColorGhost);
  el.style.setProperty(`--${cssNamespace}-button-disabled-border-color-primary-ghost`, button.disabledBorderColorGhost);
  const buttonTheme = {
    primary: {
      'button-font-color': primarySecondColor ? primaryColor : '#fff',
      'button-bg-color': primarySecondColor ? primarySecondColor : primaryColor,
      'button-hover-font-color': primarySecondColor ? primaryColor : '#fff',
      'button-hover-bg-color': primarySecondColor ? primarySecOpc : primaryLightColors[1],
      'button-active-font-color': primarySecondColor ? primaryColor : '#fff',
      'button-active-bg-color': primarySecondColor ? primarySecondColor : primaryColor
    },
    plain: {
      'button-font-color-primary': primarySecondColor ? primarySecondColor : primaryColor,
      'button-bg-color-primary': primarySecondColor ? primaryLightColors[3] : primaryLightColors[7],
      'button-hover-font-color-primary': primarySecondColor ? primarySecondColor : primaryColor,
      'button-hover-bg-color-primary': primarySecondColor ? primaryLightColors[4] : primaryLightColors[7],
      'button-active-font-color-primary': primarySecondColor ? primarySecondColor : primaryColor,
      'button-active-bg-color-primary': primarySecondColor ? primaryLightColors[3] : primaryLightColors[7]
    }
  };
  Object.keys(buttonTheme).forEach(type => {
    const item = buttonTheme[type];
    Object.keys(item).forEach(property => {
      el.style.setProperty(`--${cssNamespace}-${property}-${type}`, item[property]);
    });
  });
};

const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate

let poolPtr = rnds8Pool.length;
function rng() {
  if (poolPtr > rnds8Pool.length - 16) {
    crypto.randomFillSync(rnds8Pool);
    poolPtr = 0;
  }
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
}

var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;

function validate(uuid) {
  return typeof uuid === 'string' && REGEX.test(uuid);
}

/**
 * Convert array of 16 byte values to UUID string format of the form:
 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
 */

const byteToHex = [];
for (let i = 0; i < 256; ++i) {
  byteToHex.push((i + 0x100).toString(16).substr(1));
}
function stringify$2(arr, offset = 0) {
  // Note: Be careful editing this code!  It's been tuned for performance
  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
  const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID.  If this throws, it's likely due to one
  // of the following:
  // - One or more input array values don't map to a hex octet (leading to
  // "undefined" in the uuid)
  // - Invalid input values for the RFC `version` or `variant` fields

  if (!validate(uuid)) {
    throw TypeError('Stringified UUID is invalid');
  }
  return uuid;
}

function v4(options, buf, offset) {
  options = options || {};
  const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`

  rnds[6] = rnds[6] & 0x0f | 0x40;
  rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided

  if (buf) {
    offset = offset || 0;
    for (let i = 0; i < 16; ++i) {
      buf[offset + i] = rnds[i];
    }
    return buf;
  }
  return stringify$2(rnds);
}

function findNodeTree(node, storeKeyPrefix) {
  let nodeModels = localStorage.getItem(storeKeyPrefix + 'g-nodes') ? JSON.parse(localStorage.getItem(storeKeyPrefix + 'g-nodes')) : [];
  let relations = localStorage.getItem(storeKeyPrefix + 'g-relations') ? JSON.parse(localStorage.getItem(storeKeyPrefix + 'g-relations')) : [];
  let nodeEndRelations = [];
  let nodeStartRelations = [];
  let nodeExtraRelations = [];
  let nodeIds = [];
  let subNodeIds = [];
  let nodeId = String(node.id);
  nodeIds.push(nodeId);
  function nodeDeepFind(n, originId, level) {
    let result = relations.filter(item => item.start + '' === n.end + '');
    if (result.length) {
      result.forEach(item => {
        if (item.end + '' !== originId) {
          nodeIds.push(item.end + '');
          if (!nodeExtraRelations.find(n => n.id === item.id)) {
            // nodeExtraRelations.push({ ...item, renderType: 'leaf' })
            nodeExtraRelations.push({
              ...item
            });
          }
          if (item.end + '' !== n.start + '' && (level === 0 || level > 0 && nodeExtraRelations.find(r => r.start + '' === item.start + '' && r.end + '' === item.end + '' && r.type === item.type) === undefined)) {
            level += 1;
            nodeDeepFind(item, originId, level);
          }
        }
      });
    }
  }
  for (let i = 0, len = relations.length; i < len; i++) {
    let r = relations[i];
    if (r.end + '' === nodeId) {
      nodeEndRelations.push(r);
      nodeIds.push(r.start + '');
      subNodeIds.push(r.start + '');
    } else if (r.start + '' === nodeId) {
      nodeIds.push(r.end + '');
      subNodeIds.push(r.end + '');
      nodeStartRelations.push(r);
      nodeDeepFind(r, nodeId, 0);
    }
  }
  nodeIds = [...new Set(nodeIds)];
  let nodes = nodeModels.filter(item => nodeIds.includes(item.id + ''));
  let links = [...nodeStartRelations, ...nodeEndRelations, ...nodeExtraRelations];
  return {
    ...node,
    nodes,
    links,
    subNodeIds
  };
}
function genBookGraphModel(textBookName, storeKeyPrefix, level = 2) {
  let nodeModels = localStorage.getItem(storeKeyPrefix + 'g-nodes') ? JSON.parse(localStorage.getItem(storeKeyPrefix + 'g-nodes')) : [];
  let relations = localStorage.getItem(storeKeyPrefix + 'g-relations') ? JSON.parse(localStorage.getItem(storeKeyPrefix + 'g-relations')) : [];
  let subNodeIds = [];
  let mainNode;
  const nodeChain = ['major', 'course', 'chapter', 'section', 'subsection', 'knowledge', 'catalog'];
  for (let i = 0, len = nodeChain.length; i < len; i++) {
    let type = nodeChain[i];
    let result = nodeModels.filter(item => item.nodeType[0].indexOf(type) !== -1);
    if (result.length) {
      if (result.length === 1) {
        mainNode = result[0];
        break;
      } else {
        subNodeIds = result.map(item => item.id);
        break;
      }
    }
  }
  function filterWithLevel(main, nodes, links, maxlevel) {
    let usedIds = [],
      usedLinkIds = [],
      mainSubIds = [];
    let cLevel = 0;
    function deepFind(subIds) {
      let nextSubIds = [];
      for (let i = 0, len = subIds.length; i < len; i++) {
        let subId = subIds[i];
        for (let i = 0, len = links.length; i < len; i++) {
          let r = links[i];
          if (r.end === subId) {
            nextSubIds.push(r.start);
            usedIds.push(r.start);
            if (!usedLinkIds.includes(r.id)) {
              usedLinkIds.push(r.id);
            }
          } else if (r.start === subId) {
            nextSubIds.push(r.end);
            usedIds.push(r.end);
            if (!usedLinkIds.includes(r.id)) {
              usedLinkIds.push(r.id);
            }
          }
        }
      }
      nextSubIds = [...new Set(nextSubIds)];
      if (cLevel === 0) {
        mainSubIds = nextSubIds;
      }
      if (cLevel < maxlevel - 1 && nextSubIds.length) {
        cLevel += 1;
        deepFind(nextSubIds);
      }
    }
    deepFind([main.id]);
    usedIds = [...new Set(usedIds)];
    return {
      nodes: nodes.filter(item => usedIds.includes(item.id)),
      links: links.filter(item => usedLinkIds.includes(item.id)),
      mainSubIds
    };
  }
  if (mainNode) {
    subNodeIds = [];
    Number(mainNode.id);
    // for (let i = 0, len = relations.length; i < len; i++) {
    //   let r = relations[i]
    //   if (r.end === nodeId) {
    //     subNodeIds.push(r.start)
    //   } else if (r.start === nodeId) {
    //     subNodeIds.push(r.end)
    //   }
    // }
    let {
      nodes,
      links,
      mainSubIds
    } = filterWithLevel(mainNode, nodeModels, relations, level);
    let model = {
      ...mainNode,
      subNodeIds: mainSubIds,
      // nodes: nodeModels,
      // links: relations,
      nodes,
      links
    };
    return model;
  } else if (subNodeIds.length) {
    let fakeMainNodeId = 'node-textbook';
    let extralinks = [];
    subNodeIds.forEach(end => {
      extralinks.push({
        start: 'textbook',
        end
      });
    });
    let fakeMainNode = {
      id: fakeMainNodeId,
      name: textBookName
    };
    let {
      nodes,
      links,
      mainSubIds
    } = filterWithLevel(fakeMainNode, [...nodeModels, fakeMainNode], [...relations, ...extralinks], level);
    let model = {
      ...fakeMainNode,
      subNodeIds: mainSubIds,
      // nodes: nodeModels,
      // links: [...relations, ...extralinks],
      nodes,
      links
    };
    return model;
  }
  return {};
}
function queryGraphIndexs(id, storeKeyPrefix) {
  let all = localStorage.getItem(storeKeyPrefix + 'g-indexs') ? JSON.parse(localStorage.getItem(storeKeyPrefix + 'g-indexs')) : [];
  let result = all.filter(item => item.nodesId + '' === id + '');
  result.forEach(item => {
    item.contentWithHighlight = item.html.replace(item.nodesName, `<span style="color: #009DFF">${item.nodesName}</span>`);
  });
  return result;
}
function getTextNodeList(dom) {
  const nodeList = [...dom.childNodes];
  const textNodes = [];
  while (nodeList.length) {
    const node = nodeList.shift();
    if (node.nodeType === node.TEXT_NODE) {
      node.wholeText && textNodes.push(node);
    } else {
      nodeList.unshift(...node.childNodes);
    }
  }
  return textNodes;
}
function getTextInfoList(textNodes) {
  let length = 0;
  const textList = textNodes.map(node => {
    let startIdx = length,
      endIdx = length + node.wholeText.length;
    length = endIdx;
    return {
      text: node.wholeText,
      startIdx,
      endIdx
    };
  });
  return textList;
}
function getMatchList(content, keyword) {
  const characters = [...'\\[](){}?.+*^$:|'].reduce((r, c) => (r[c] = true, r), {});
  keyword = keyword.split('').map(s => characters[s] ? `\\${s}` : s).join('[\\s\\n]*');
  const reg = new RegExp(keyword, 'gmi');
  const matchList = [];
  let match = reg.exec(content);
  while (match) {
    matchList.push(match);
    match = reg.exec(content);
  }
  return matchList;
}
function replaceMatchResult(textNodes, textList, matchList, options) {
  let {
    flag,
    datasets,
    g
  } = options;
  // 对于每一个匹配结果，可能分散在多个标签中，找出这些标签，截取匹配片段并用font标签替换出
  if (!g) {
    matchList = [matchList[0]];
  }
  for (let i = matchList.length - 1; i >= 0; i--) {
    const match = matchList[i];
    const matchStart = match.index,
      matchEnd = matchStart + match[0].length; // 匹配结果在拼接字符串中的起止索引
    // 遍历文本信息列表，查找匹配的文本节点
    let groupStart = true;
    for (let textIdx = 0; textIdx < textList.length; textIdx++) {
      const {
        text,
        startIdx,
        endIdx
      } = textList[textIdx]; // 文本内容、文本在拼接串中开始、结束索引
      if (endIdx < matchStart) continue; // 匹配的文本节点还在后面
      if (startIdx >= matchEnd) break; // 匹配文本节点已经处理完了
      let textNode = textNodes[textIdx]; // 这个节点中的部分或全部内容匹配到了关键词，将匹配部分截取出来进行替换
      const nodeMatchStartIdx = Math.max(0, matchStart - startIdx); // 匹配内容在文本节点内容中的开始索引
      const nodeMatchLength = Math.min(endIdx, matchEnd) - startIdx - nodeMatchStartIdx; // 文本节点内容匹配关键词的长度
      if (nodeMatchStartIdx > 0) textNode = textNode.splitText(nodeMatchStartIdx); // textNode取后半部分
      if (nodeMatchLength < textNode.wholeText.length) textNode.splitText(nodeMatchLength);
      const font = document.createElement('font');
      font.setAttribute(flag, i + 1);
      groupStart ? font.classList.add(flag) : font.classList.add(flag + '-rest');
      if (datasets.length && Array.isArray(datasets)) {
        datasets.forEach(({
          key,
          value
        }) => {
          font.dataset[key] = value;
        });
      }
      font.innerText = text.substr(nodeMatchStartIdx, nodeMatchLength);
      textNode.parentNode.replaceChild(font, textNode);
      groupStart = false;
    }
  }
}
const defaultOptions$2 = {
  flag: 'xml-graph-link',
  datasets: [],
  g: false
};
function replaceKeywordsInHTML(html, keyword, options = defaultOptions$2) {
  options = {
    ...defaultOptions$2,
    ...options
  };
  let matchCount = 0,
    replacedHtml = '';
  if (!html || !keyword) {
    replacedHtml = html;
    return [replacedHtml, matchCount];
  }
  const div = document.createElement('div');
  div.innerHTML = html;
  const textNodes = getTextNodeList(div);
  const textList = getTextInfoList(textNodes);
  const content = textList.map(({
    text
  }) => text).join('');
  const matchList = getMatchList(content, keyword);
  matchCount = matchList.length;
  replaceMatchResult(textNodes, textList, matchList, options);
  replacedHtml = div.innerHTML;
  return [replacedHtml, matchCount];
}
const isBody = node => {
  return node && node.nodeType === 1 && node.tagName.toLowerCase() === "body";
};
function findParent(node, filterFn, includeSelf = false) {
  if (node && !isBody(node)) {
    node = includeSelf ? node : node.parentNode;
    while (node) {
      if (!filterFn || filterFn(node) || isBody(node)) {
        return filterFn && !filterFn(node) && isBody(node) ? null : node;
      }
      node = node.parentNode;
    }
  }
  return null;
}

/**
 * Custom positioning reference element.
 * @see https://floating-ui.com/docs/virtual-elements
 */

const sides = ['top', 'right', 'bottom', 'left'];
const alignments = ['start', 'end'];
const placements$2 = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
const min$6 = Math.min;
const max$7 = Math.max;
const round$8 = Math.round;
const createCoords = v => ({
  x: v,
  y: v
});
const oppositeSideMap = {
  left: 'right',
  right: 'left',
  bottom: 'top',
  top: 'bottom'
};
const oppositeAlignmentMap = {
  start: 'end',
  end: 'start'
};
function clamp$4(start, value, end) {
  return max$7(start, min$6(value, end));
}
function evaluate(value, param) {
  return typeof value === 'function' ? value(param) : value;
}
function getSide(placement) {
  return placement.split('-')[0];
}
function getAlignment(placement) {
  return placement.split('-')[1];
}
function getOppositeAxis(axis) {
  return axis === 'x' ? 'y' : 'x';
}
function getAxisLength(axis) {
  return axis === 'y' ? 'height' : 'width';
}
function getSideAxis(placement) {
  return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
}
function getAlignmentAxis(placement) {
  return getOppositeAxis(getSideAxis(placement));
}
function getAlignmentSides(placement, rects, rtl) {
  if (rtl === void 0) {
    rtl = false;
  }
  const alignment = getAlignment(placement);
  const alignmentAxis = getAlignmentAxis(placement);
  const length = getAxisLength(alignmentAxis);
  let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  if (rects.reference[length] > rects.floating[length]) {
    mainAlignmentSide = getOppositePlacement$1(mainAlignmentSide);
  }
  return [mainAlignmentSide, getOppositePlacement$1(mainAlignmentSide)];
}
function getExpandedPlacements(placement) {
  const oppositePlacement = getOppositePlacement$1(placement);
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
}
function getOppositeAlignmentPlacement(placement) {
  return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
}
function getSideList(side, isStart, rtl) {
  const lr = ['left', 'right'];
  const rl = ['right', 'left'];
  const tb = ['top', 'bottom'];
  const bt = ['bottom', 'top'];
  switch (side) {
    case 'top':
    case 'bottom':
      if (rtl) return isStart ? rl : lr;
      return isStart ? lr : rl;
    case 'left':
    case 'right':
      return isStart ? tb : bt;
    default:
      return [];
  }
}
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
  const alignment = getAlignment(placement);
  let list = getSideList(getSide(placement), direction === 'start', rtl);
  if (alignment) {
    list = list.map(side => side + "-" + alignment);
    if (flipAlignment) {
      list = list.concat(list.map(getOppositeAlignmentPlacement));
    }
  }
  return list;
}
function getOppositePlacement$1(placement) {
  return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
}
function expandPaddingObject(padding) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...padding
  };
}
function getPaddingObject(padding) {
  return typeof padding !== 'number' ? expandPaddingObject(padding) : {
    top: padding,
    right: padding,
    bottom: padding,
    left: padding
  };
}
function rectToClientRect$1(rect) {
  const {
    x,
    y,
    width,
    height
  } = rect;
  return {
    width,
    height,
    top: y,
    left: x,
    right: x + width,
    bottom: y + height,
    x,
    y
  };
}

function computeCoordsFromPlacement(_ref, placement, rtl) {
  let {
    reference,
    floating
  } = _ref;
  const sideAxis = getSideAxis(placement);
  const alignmentAxis = getAlignmentAxis(placement);
  const alignLength = getAxisLength(alignmentAxis);
  const side = getSide(placement);
  const isVertical = sideAxis === 'y';
  const commonX = reference.x + reference.width / 2 - floating.width / 2;
  const commonY = reference.y + reference.height / 2 - floating.height / 2;
  const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
  let coords;
  switch (side) {
    case 'top':
      coords = {
        x: commonX,
        y: reference.y - floating.height
      };
      break;
    case 'bottom':
      coords = {
        x: commonX,
        y: reference.y + reference.height
      };
      break;
    case 'right':
      coords = {
        x: reference.x + reference.width,
        y: commonY
      };
      break;
    case 'left':
      coords = {
        x: reference.x - floating.width,
        y: commonY
      };
      break;
    default:
      coords = {
        x: reference.x,
        y: reference.y
      };
  }
  switch (getAlignment(placement)) {
    case 'start':
      coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
      break;
    case 'end':
      coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
      break;
  }
  return coords;
}

/**
 * Computes the `x` and `y` coordinates that will place the floating element
 * next to a given reference element.
 *
 * This export does not have any `platform` interface logic. You will need to
 * write one for the platform you are using Floating UI with.
 */
const computePosition$1 = async (reference, floating, config) => {
  const {
    placement = 'bottom',
    strategy = 'absolute',
    middleware = [],
    platform
  } = config;
  const validMiddleware = middleware.filter(Boolean);
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  let rects = await platform.getElementRects({
    reference,
    floating,
    strategy
  });
  let {
    x,
    y
  } = computeCoordsFromPlacement(rects, placement, rtl);
  let statefulPlacement = placement;
  let middlewareData = {};
  let resetCount = 0;
  for (let i = 0; i < validMiddleware.length; i++) {
    const {
      name,
      fn
    } = validMiddleware[i];
    const {
      x: nextX,
      y: nextY,
      data,
      reset
    } = await fn({
      x,
      y,
      initialPlacement: placement,
      placement: statefulPlacement,
      strategy,
      middlewareData,
      rects,
      platform,
      elements: {
        reference,
        floating
      }
    });
    x = nextX != null ? nextX : x;
    y = nextY != null ? nextY : y;
    middlewareData = {
      ...middlewareData,
      [name]: {
        ...middlewareData[name],
        ...data
      }
    };
    if (reset && resetCount <= 50) {
      resetCount++;
      if (typeof reset === 'object') {
        if (reset.placement) {
          statefulPlacement = reset.placement;
        }
        if (reset.rects) {
          rects = reset.rects === true ? await platform.getElementRects({
            reference,
            floating,
            strategy
          }) : reset.rects;
        }
        ({
          x,
          y
        } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
      }
      i = -1;
    }
  }
  return {
    x,
    y,
    placement: statefulPlacement,
    strategy,
    middlewareData
  };
};

/**
 * Resolves with an object of overflow side offsets that determine how much the
 * element is overflowing a given clipping boundary on each side.
 * - positive = overflowing the boundary by that number of pixels
 * - negative = how many pixels left before it will overflow
 * - 0 = lies flush with the boundary
 * @see https://floating-ui.com/docs/detectOverflow
 */
async function detectOverflow$1(state, options) {
  var _await$platform$isEle;
  if (options === void 0) {
    options = {};
  }
  const {
    x,
    y,
    platform,
    rects,
    elements,
    strategy
  } = state;
  const {
    boundary = 'clippingAncestors',
    rootBoundary = 'viewport',
    elementContext = 'floating',
    altBoundary = false,
    padding = 0
  } = evaluate(options, state);
  const paddingObject = getPaddingObject(padding);
  const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  const element = elements[altBoundary ? altContext : elementContext];
  const clippingClientRect = rectToClientRect$1(await platform.getClippingRect({
    element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
    boundary,
    rootBoundary,
    strategy
  }));
  const rect = elementContext === 'floating' ? {
    x,
    y,
    width: rects.floating.width,
    height: rects.floating.height
  } : rects.reference;
  const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
  const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
    x: 1,
    y: 1
  } : {
    x: 1,
    y: 1
  };
  const elementClientRect = rectToClientRect$1(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
    elements,
    rect,
    offsetParent,
    strategy
  }) : rect);
  return {
    top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
    bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
    left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
    right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
  };
}

/**
 * Provides data to position an inner element of the floating element so that it
 * appears centered to the reference element.
 * @see https://floating-ui.com/docs/arrow
 */
const arrow$3 = options => ({
  name: 'arrow',
  options,
  async fn(state) {
    const {
      x,
      y,
      placement,
      rects,
      platform,
      elements,
      middlewareData
    } = state;
    // Since `element` is required, we don't Partial<> the type.
    const {
      element,
      padding = 0
    } = evaluate(options, state) || {};
    if (element == null) {
      return {};
    }
    const paddingObject = getPaddingObject(padding);
    const coords = {
      x,
      y
    };
    const axis = getAlignmentAxis(placement);
    const length = getAxisLength(axis);
    const arrowDimensions = await platform.getDimensions(element);
    const isYAxis = axis === 'y';
    const minProp = isYAxis ? 'top' : 'left';
    const maxProp = isYAxis ? 'bottom' : 'right';
    const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
    const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
    const startDiff = coords[axis] - rects.reference[axis];
    const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
    let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;

    // DOM platform can return `window` as the `offsetParent`.
    if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
      clientSize = elements.floating[clientProp] || rects.floating[length];
    }
    const centerToReference = endDiff / 2 - startDiff / 2;

    // If the padding is large enough that it causes the arrow to no longer be
    // centered, modify the padding so that it is centered.
    const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
    const minPadding = min$6(paddingObject[minProp], largestPossiblePadding);
    const maxPadding = min$6(paddingObject[maxProp], largestPossiblePadding);

    // Make sure the arrow doesn't overflow the floating element if the center
    // point is outside the floating element's bounds.
    const min$1 = minPadding;
    const max = clientSize - arrowDimensions[length] - maxPadding;
    const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
    const offset = clamp$4(min$1, center, max);

    // If the reference is small enough that the arrow's padding causes it to
    // to point to nothing for an aligned placement, adjust the offset of the
    // floating element itself. To ensure `shift()` continues to take action,
    // a single reset is performed when this is true.
    const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
    const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
    return {
      [axis]: coords[axis] + alignmentOffset,
      data: {
        [axis]: offset,
        centerOffset: center - offset - alignmentOffset,
        ...(shouldAddOffset && {
          alignmentOffset
        })
      },
      reset: shouldAddOffset
    };
  }
});
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
  const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
  return allowedPlacementsSortedByAlignment.filter(placement => {
    if (alignment) {
      return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
    }
    return true;
  });
}
/**
 * Optimizes the visibility of the floating element by choosing the placement
 * that has the most space available automatically, without needing to specify a
 * preferred placement. Alternative to `flip`.
 * @see https://floating-ui.com/docs/autoPlacement
 */
const autoPlacement$1 = function (options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: 'autoPlacement',
    options,
    async fn(state) {
      var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
      const {
        rects,
        middlewareData,
        placement,
        platform,
        elements
      } = state;
      const {
        crossAxis = false,
        alignment,
        allowedPlacements = placements$2,
        autoAlignment = true,
        ...detectOverflowOptions
      } = evaluate(options, state);
      const placements$1 = alignment !== undefined || allowedPlacements === placements$2 ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
      const overflow = await detectOverflow$1(state, detectOverflowOptions);
      const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
      const currentPlacement = placements$1[currentIndex];
      if (currentPlacement == null) {
        return {};
      }
      const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));

      // Make `computeCoords` start from the right place.
      if (placement !== currentPlacement) {
        return {
          reset: {
            placement: placements$1[0]
          }
        };
      }
      const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
      const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
        placement: currentPlacement,
        overflows: currentOverflows
      }];
      const nextPlacement = placements$1[currentIndex + 1];

      // There are more placements to check.
      if (nextPlacement) {
        return {
          data: {
            index: currentIndex + 1,
            overflows: allOverflows
          },
          reset: {
            placement: nextPlacement
          }
        };
      }
      const placementsSortedByMostSpace = allOverflows.map(d => {
        const alignment = getAlignment(d.placement);
        return [d.placement, alignment && crossAxis ?
        // Check along the mainAxis and main crossAxis side.
        d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
        // Check only the mainAxis.
        d.overflows[0], d.overflows];
      }).sort((a, b) => a[1] - b[1]);
      const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
      // Aligned placements should not check their opposite crossAxis
      // side.
      getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
      const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
      if (resetPlacement !== placement) {
        return {
          data: {
            index: currentIndex + 1,
            overflows: allOverflows
          },
          reset: {
            placement: resetPlacement
          }
        };
      }
      return {};
    }
  };
};

/**
 * Optimizes the visibility of the floating element by flipping the `placement`
 * in order to keep it in view when the preferred placement(s) will overflow the
 * clipping boundary. Alternative to `autoPlacement`.
 * @see https://floating-ui.com/docs/flip
 */
const flip$3 = function (options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: 'flip',
    options,
    async fn(state) {
      var _middlewareData$arrow, _middlewareData$flip;
      const {
        placement,
        middlewareData,
        rects,
        initialPlacement,
        platform,
        elements
      } = state;
      const {
        mainAxis: checkMainAxis = true,
        crossAxis: checkCrossAxis = true,
        fallbackPlacements: specifiedFallbackPlacements,
        fallbackStrategy = 'bestFit',
        fallbackAxisSideDirection = 'none',
        flipAlignment = true,
        ...detectOverflowOptions
      } = evaluate(options, state);

      // If a reset by the arrow was caused due to an alignment offset being
      // added, we should skip any logic now since `flip()` has already done its
      // work.
      // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
      if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
        return {};
      }
      const side = getSide(placement);
      const initialSideAxis = getSideAxis(initialPlacement);
      const isBasePlacement = getSide(initialPlacement) === initialPlacement;
      const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
      const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement$1(initialPlacement)] : getExpandedPlacements(initialPlacement));
      const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
      if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
        fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
      }
      const placements = [initialPlacement, ...fallbackPlacements];
      const overflow = await detectOverflow$1(state, detectOverflowOptions);
      const overflows = [];
      let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
      if (checkMainAxis) {
        overflows.push(overflow[side]);
      }
      if (checkCrossAxis) {
        const sides = getAlignmentSides(placement, rects, rtl);
        overflows.push(overflow[sides[0]], overflow[sides[1]]);
      }
      overflowsData = [...overflowsData, {
        placement,
        overflows
      }];

      // One or more sides is overflowing.
      if (!overflows.every(side => side <= 0)) {
        var _middlewareData$flip2, _overflowsData$filter;
        const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
        const nextPlacement = placements[nextIndex];
        if (nextPlacement) {
          const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
          if (!ignoreCrossAxisOverflow ||
          // We leave the current main axis only if every placement on that axis
          // overflows the main axis.
          overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
            // Try next placement and re-run the lifecycle.
            return {
              data: {
                index: nextIndex,
                overflows: overflowsData
              },
              reset: {
                placement: nextPlacement
              }
            };
          }
        }

        // First, find the candidates that fit on the mainAxis side of overflow,
        // then find the placement that fits the best on the main crossAxis side.
        let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;

        // Otherwise fallback.
        if (!resetPlacement) {
          switch (fallbackStrategy) {
            case 'bestFit':
              {
                var _overflowsData$filter2;
                const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
                  if (hasFallbackAxisSideDirection) {
                    const currentSideAxis = getSideAxis(d.placement);
                    return currentSideAxis === initialSideAxis ||
                    // Create a bias to the `y` side axis due to horizontal
                    // reading directions favoring greater width.
                    currentSideAxis === 'y';
                  }
                  return true;
                }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
                if (placement) {
                  resetPlacement = placement;
                }
                break;
              }
            case 'initialPlacement':
              resetPlacement = initialPlacement;
              break;
          }
        }
        if (placement !== resetPlacement) {
          return {
            reset: {
              placement: resetPlacement
            }
          };
        }
      }
      return {};
    }
  };
};
function getSideOffsets$1(overflow, rect) {
  return {
    top: overflow.top - rect.height,
    right: overflow.right - rect.width,
    bottom: overflow.bottom - rect.height,
    left: overflow.left - rect.width
  };
}
function isAnySideFullyClipped$1(overflow) {
  return sides.some(side => overflow[side] >= 0);
}
/**
 * Provides data to hide the floating element in applicable situations, such as
 * when it is not in the same clipping context as the reference element.
 * @see https://floating-ui.com/docs/hide
 */
const hide$2 = function (options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: 'hide',
    options,
    async fn(state) {
      const {
        rects
      } = state;
      const {
        strategy = 'referenceHidden',
        ...detectOverflowOptions
      } = evaluate(options, state);
      switch (strategy) {
        case 'referenceHidden':
          {
            const overflow = await detectOverflow$1(state, {
              ...detectOverflowOptions,
              elementContext: 'reference'
            });
            const offsets = getSideOffsets$1(overflow, rects.reference);
            return {
              data: {
                referenceHiddenOffsets: offsets,
                referenceHidden: isAnySideFullyClipped$1(offsets)
              }
            };
          }
        case 'escaped':
          {
            const overflow = await detectOverflow$1(state, {
              ...detectOverflowOptions,
              altBoundary: true
            });
            const offsets = getSideOffsets$1(overflow, rects.floating);
            return {
              data: {
                escapedOffsets: offsets,
                escaped: isAnySideFullyClipped$1(offsets)
              }
            };
          }
        default:
          {
            return {};
          }
      }
    }
  };
};
function getBoundingRect$1(rects) {
  const minX = min$6(...rects.map(rect => rect.left));
  const minY = min$6(...rects.map(rect => rect.top));
  const maxX = max$7(...rects.map(rect => rect.right));
  const maxY = max$7(...rects.map(rect => rect.bottom));
  return {
    x: minX,
    y: minY,
    width: maxX - minX,
    height: maxY - minY
  };
}
function getRectsByLine(rects) {
  const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
  const groups = [];
  let prevRect = null;
  for (let i = 0; i < sortedRects.length; i++) {
    const rect = sortedRects[i];
    if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
      groups.push([rect]);
    } else {
      groups[groups.length - 1].push(rect);
    }
    prevRect = rect;
  }
  return groups.map(rect => rectToClientRect$1(getBoundingRect$1(rect)));
}
/**
 * Provides improved positioning for inline reference elements that can span
 * over multiple lines, such as hyperlinks or range selections.
 * @see https://floating-ui.com/docs/inline
 */
const inline = function (options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: 'inline',
    options,
    async fn(state) {
      const {
        placement,
        elements,
        rects,
        platform,
        strategy
      } = state;
      // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
      // ClientRect's bounds, despite the event listener being triggered. A
      // padding of 2 seems to handle this issue.
      const {
        padding = 2,
        x,
        y
      } = evaluate(options, state);
      const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
      const clientRects = getRectsByLine(nativeClientRects);
      const fallback = rectToClientRect$1(getBoundingRect$1(nativeClientRects));
      const paddingObject = getPaddingObject(padding);
      function getBoundingClientRect() {
        // There are two rects and they are disjoined.
        if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
          // Find the first rect in which the point is fully inside.
          return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
        }

        // There are 2 or more connected rects.
        if (clientRects.length >= 2) {
          if (getSideAxis(placement) === 'y') {
            const firstRect = clientRects[0];
            const lastRect = clientRects[clientRects.length - 1];
            const isTop = getSide(placement) === 'top';
            const top = firstRect.top;
            const bottom = lastRect.bottom;
            const left = isTop ? firstRect.left : lastRect.left;
            const right = isTop ? firstRect.right : lastRect.right;
            const width = right - left;
            const height = bottom - top;
            return {
              top,
              bottom,
              left,
              right,
              width,
              height,
              x: left,
              y: top
            };
          }
          const isLeftSide = getSide(placement) === 'left';
          const maxRight = max$7(...clientRects.map(rect => rect.right));
          const minLeft = min$6(...clientRects.map(rect => rect.left));
          const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
          const top = measureRects[0].top;
          const bottom = measureRects[measureRects.length - 1].bottom;
          const left = minLeft;
          const right = maxRight;
          const width = right - left;
          const height = bottom - top;
          return {
            top,
            bottom,
            left,
            right,
            width,
            height,
            x: left,
            y: top
          };
        }
        return fallback;
      }
      const resetRects = await platform.getElementRects({
        reference: {
          getBoundingClientRect
        },
        floating: elements.floating,
        strategy
      });
      if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
        return {
          reset: {
            rects: resetRects
          }
        };
      }
      return {};
    }
  };
};

// For type backwards-compatibility, the `OffsetOptions` type was also
// Derivable.

async function convertValueToCoords(state, options) {
  const {
    placement,
    platform,
    elements
  } = state;
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  const side = getSide(placement);
  const alignment = getAlignment(placement);
  const isVertical = getSideAxis(placement) === 'y';
  const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
  const rawValue = evaluate(options, state);

  // eslint-disable-next-line prefer-const
  let {
    mainAxis,
    crossAxis,
    alignmentAxis
  } = typeof rawValue === 'number' ? {
    mainAxis: rawValue,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: rawValue.mainAxis || 0,
    crossAxis: rawValue.crossAxis || 0,
    alignmentAxis: rawValue.alignmentAxis
  };
  if (alignment && typeof alignmentAxis === 'number') {
    crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  }
  return isVertical ? {
    x: crossAxis * crossAxisMulti,
    y: mainAxis * mainAxisMulti
  } : {
    x: mainAxis * mainAxisMulti,
    y: crossAxis * crossAxisMulti
  };
}

/**
 * Modifies the placement by translating the floating element along the
 * specified axes.
 * A number (shorthand for `mainAxis` or distance), or an axes configuration
 * object may be passed.
 * @see https://floating-ui.com/docs/offset
 */
const offset$4 = function (options) {
  if (options === void 0) {
    options = 0;
  }
  return {
    name: 'offset',
    options,
    async fn(state) {
      var _middlewareData$offse, _middlewareData$arrow;
      const {
        x,
        y,
        placement,
        middlewareData
      } = state;
      const diffCoords = await convertValueToCoords(state, options);

      // If the placement is the same and the arrow caused an alignment offset
      // then we don't need to change the positioning coordinates.
      if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
        return {};
      }
      return {
        x: x + diffCoords.x,
        y: y + diffCoords.y,
        data: {
          ...diffCoords,
          placement
        }
      };
    }
  };
};

/**
 * Optimizes the visibility of the floating element by shifting it in order to
 * keep it in view when it will overflow the clipping boundary.
 * @see https://floating-ui.com/docs/shift
 */
const shift$1 = function (options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: 'shift',
    options,
    async fn(state) {
      const {
        x,
        y,
        placement
      } = state;
      const {
        mainAxis: checkMainAxis = true,
        crossAxis: checkCrossAxis = false,
        limiter = {
          fn: _ref => {
            let {
              x,
              y
            } = _ref;
            return {
              x,
              y
            };
          }
        },
        ...detectOverflowOptions
      } = evaluate(options, state);
      const coords = {
        x,
        y
      };
      const overflow = await detectOverflow$1(state, detectOverflowOptions);
      const crossAxis = getSideAxis(getSide(placement));
      const mainAxis = getOppositeAxis(crossAxis);
      let mainAxisCoord = coords[mainAxis];
      let crossAxisCoord = coords[crossAxis];
      if (checkMainAxis) {
        const minSide = mainAxis === 'y' ? 'top' : 'left';
        const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
        const min = mainAxisCoord + overflow[minSide];
        const max = mainAxisCoord - overflow[maxSide];
        mainAxisCoord = clamp$4(min, mainAxisCoord, max);
      }
      if (checkCrossAxis) {
        const minSide = crossAxis === 'y' ? 'top' : 'left';
        const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
        const min = crossAxisCoord + overflow[minSide];
        const max = crossAxisCoord - overflow[maxSide];
        crossAxisCoord = clamp$4(min, crossAxisCoord, max);
      }
      const limitedCoords = limiter.fn({
        ...state,
        [mainAxis]: mainAxisCoord,
        [crossAxis]: crossAxisCoord
      });
      return {
        ...limitedCoords,
        data: {
          x: limitedCoords.x - x,
          y: limitedCoords.y - y,
          enabled: {
            [mainAxis]: checkMainAxis,
            [crossAxis]: checkCrossAxis
          }
        }
      };
    }
  };
};
/**
 * Built-in `limiter` that will stop `shift()` at a certain point.
 */
const limitShift = function (options) {
  if (options === void 0) {
    options = {};
  }
  return {
    options,
    fn(state) {
      const {
        x,
        y,
        placement,
        rects,
        middlewareData
      } = state;
      const {
        offset = 0,
        mainAxis: checkMainAxis = true,
        crossAxis: checkCrossAxis = true
      } = evaluate(options, state);
      const coords = {
        x,
        y
      };
      const crossAxis = getSideAxis(placement);
      const mainAxis = getOppositeAxis(crossAxis);
      let mainAxisCoord = coords[mainAxis];
      let crossAxisCoord = coords[crossAxis];
      const rawOffset = evaluate(offset, state);
      const computedOffset = typeof rawOffset === 'number' ? {
        mainAxis: rawOffset,
        crossAxis: 0
      } : {
        mainAxis: 0,
        crossAxis: 0,
        ...rawOffset
      };
      if (checkMainAxis) {
        const len = mainAxis === 'y' ? 'height' : 'width';
        const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
        const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
        if (mainAxisCoord < limitMin) {
          mainAxisCoord = limitMin;
        } else if (mainAxisCoord > limitMax) {
          mainAxisCoord = limitMax;
        }
      }
      if (checkCrossAxis) {
        var _middlewareData$offse, _middlewareData$offse2;
        const len = mainAxis === 'y' ? 'width' : 'height';
        const isOriginSide = ['top', 'left'].includes(getSide(placement));
        const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
        const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
        if (crossAxisCoord < limitMin) {
          crossAxisCoord = limitMin;
        } else if (crossAxisCoord > limitMax) {
          crossAxisCoord = limitMax;
        }
      }
      return {
        [mainAxis]: mainAxisCoord,
        [crossAxis]: crossAxisCoord
      };
    }
  };
};

/**
 * Provides data that allows you to change the size of the floating element —
 * for instance, prevent it from overflowing the clipping boundary or match the
 * width of the reference element.
 * @see https://floating-ui.com/docs/size
 */
const size = function (options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: 'size',
    options,
    async fn(state) {
      var _state$middlewareData, _state$middlewareData2;
      const {
        placement,
        rects,
        platform,
        elements
      } = state;
      const {
        apply = () => {},
        ...detectOverflowOptions
      } = evaluate(options, state);
      const overflow = await detectOverflow$1(state, detectOverflowOptions);
      const side = getSide(placement);
      const alignment = getAlignment(placement);
      const isYAxis = getSideAxis(placement) === 'y';
      const {
        width,
        height
      } = rects.floating;
      let heightSide;
      let widthSide;
      if (side === 'top' || side === 'bottom') {
        heightSide = side;
        widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
      } else {
        widthSide = side;
        heightSide = alignment === 'end' ? 'top' : 'bottom';
      }
      const maximumClippingHeight = height - overflow.top - overflow.bottom;
      const maximumClippingWidth = width - overflow.left - overflow.right;
      const overflowAvailableHeight = min$6(height - overflow[heightSide], maximumClippingHeight);
      const overflowAvailableWidth = min$6(width - overflow[widthSide], maximumClippingWidth);
      const noShift = !state.middlewareData.shift;
      let availableHeight = overflowAvailableHeight;
      let availableWidth = overflowAvailableWidth;
      if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
        availableWidth = maximumClippingWidth;
      }
      if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
        availableHeight = maximumClippingHeight;
      }
      if (noShift && !alignment) {
        const xMin = max$7(overflow.left, 0);
        const xMax = max$7(overflow.right, 0);
        const yMin = max$7(overflow.top, 0);
        const yMax = max$7(overflow.bottom, 0);
        if (isYAxis) {
          availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$7(overflow.left, overflow.right));
        } else {
          availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$7(overflow.top, overflow.bottom));
        }
      }
      await apply({
        ...state,
        availableWidth,
        availableHeight
      });
      const nextDimensions = await platform.getDimensions(elements.floating);
      if (width !== nextDimensions.width || height !== nextDimensions.height) {
        return {
          reset: {
            rects: true
          }
        };
      }
      return {};
    }
  };
};

function hasWindow() {
  return typeof window !== 'undefined';
}
function getNodeName$2(node) {
  if (isNode(node)) {
    return (node.nodeName || '').toLowerCase();
  }
  // Mocked nodes in testing environments may not be instances of Node. By
  // returning `#document` an infinite loop won't occur.
  // https://github.com/floating-ui/floating-ui/issues/2317
  return '#document';
}
function getWindow$2(node) {
  var _node$ownerDocument;
  return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
}
function getDocumentElement$2(node) {
  var _ref;
  return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
}
function isNode(value) {
  if (!hasWindow()) {
    return false;
  }
  return value instanceof Node || value instanceof getWindow$2(value).Node;
}
function isElement$4(value) {
  if (!hasWindow()) {
    return false;
  }
  return value instanceof Element || value instanceof getWindow$2(value).Element;
}
function isHTMLElement$3(value) {
  if (!hasWindow()) {
    return false;
  }
  return value instanceof HTMLElement || value instanceof getWindow$2(value).HTMLElement;
}
function isShadowRoot$2(value) {
  if (!hasWindow() || typeof ShadowRoot === 'undefined') {
    return false;
  }
  return value instanceof ShadowRoot || value instanceof getWindow$2(value).ShadowRoot;
}
function isOverflowElement(element) {
  const {
    overflow,
    overflowX,
    overflowY,
    display
  } = getComputedStyle$4(element);
  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
}
function isTableElement$2(element) {
  return ['table', 'td', 'th'].includes(getNodeName$2(element));
}
function isTopLayer(element) {
  return [':popover-open', ':modal'].some(selector => {
    try {
      return element.matches(selector);
    } catch (e) {
      return false;
    }
  });
}
function isContainingBlock(elementOrCss) {
  const webkit = isWebKit();
  const css = isElement$4(elementOrCss) ? getComputedStyle$4(elementOrCss) : elementOrCss;

  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
  return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
}
function getContainingBlock$2(element) {
  let currentNode = getParentNode$2(element);
  while (isHTMLElement$3(currentNode) && !isLastTraversableNode(currentNode)) {
    if (isContainingBlock(currentNode)) {
      return currentNode;
    } else if (isTopLayer(currentNode)) {
      return null;
    }
    currentNode = getParentNode$2(currentNode);
  }
  return null;
}
function isWebKit() {
  if (typeof CSS === 'undefined' || !CSS.supports) return false;
  return CSS.supports('-webkit-backdrop-filter', 'none');
}
function isLastTraversableNode(node) {
  return ['html', 'body', '#document'].includes(getNodeName$2(node));
}
function getComputedStyle$4(element) {
  return getWindow$2(element).getComputedStyle(element);
}
function getNodeScroll$2(element) {
  if (isElement$4(element)) {
    return {
      scrollLeft: element.scrollLeft,
      scrollTop: element.scrollTop
    };
  }
  return {
    scrollLeft: element.scrollX,
    scrollTop: element.scrollY
  };
}
function getParentNode$2(node) {
  if (getNodeName$2(node) === 'html') {
    return node;
  }
  const result =
  // Step into the shadow DOM of the parent of a slotted node.
  node.assignedSlot ||
  // DOM Element detected.
  node.parentNode ||
  // ShadowRoot detected.
  isShadowRoot$2(node) && node.host ||
  // Fallback.
  getDocumentElement$2(node);
  return isShadowRoot$2(result) ? result.host : result;
}
function getNearestOverflowAncestor(node) {
  const parentNode = getParentNode$2(node);
  if (isLastTraversableNode(parentNode)) {
    return node.ownerDocument ? node.ownerDocument.body : node.body;
  }
  if (isHTMLElement$3(parentNode) && isOverflowElement(parentNode)) {
    return parentNode;
  }
  return getNearestOverflowAncestor(parentNode);
}
function getOverflowAncestors(node, list, traverseIframes) {
  var _node$ownerDocument2;
  if (list === void 0) {
    list = [];
  }
  if (traverseIframes === void 0) {
    traverseIframes = true;
  }
  const scrollableAncestor = getNearestOverflowAncestor(node);
  const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
  const win = getWindow$2(scrollableAncestor);
  if (isBody) {
    const frameElement = getFrameElement(win);
    return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
  }
  return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
}
function getFrameElement(win) {
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
}

function getCssDimensions(element) {
  const css = getComputedStyle$4(element);
  // In testing environments, the `width` and `height` properties are empty
  // strings for SVG elements, returning NaN. Fallback to `0` in this case.
  let width = parseFloat(css.width) || 0;
  let height = parseFloat(css.height) || 0;
  const hasOffset = isHTMLElement$3(element);
  const offsetWidth = hasOffset ? element.offsetWidth : width;
  const offsetHeight = hasOffset ? element.offsetHeight : height;
  const shouldFallback = round$8(width) !== offsetWidth || round$8(height) !== offsetHeight;
  if (shouldFallback) {
    width = offsetWidth;
    height = offsetHeight;
  }
  return {
    width,
    height,
    $: shouldFallback
  };
}
function unwrapElement(element) {
  return !isElement$4(element) ? element.contextElement : element;
}
function getScale(element) {
  const domElement = unwrapElement(element);
  if (!isHTMLElement$3(domElement)) {
    return createCoords(1);
  }
  const rect = domElement.getBoundingClientRect();
  const {
    width,
    height,
    $
  } = getCssDimensions(domElement);
  let x = ($ ? round$8(rect.width) : rect.width) / width;
  let y = ($ ? round$8(rect.height) : rect.height) / height;

  // 0, NaN, or Infinity should always fallback to 1.

  if (!x || !Number.isFinite(x)) {
    x = 1;
  }
  if (!y || !Number.isFinite(y)) {
    y = 1;
  }
  return {
    x,
    y
  };
}
const noOffsets = /*#__PURE__*/createCoords(0);
function getVisualOffsets(element) {
  const win = getWindow$2(element);
  if (!isWebKit() || !win.visualViewport) {
    return noOffsets;
  }
  return {
    x: win.visualViewport.offsetLeft,
    y: win.visualViewport.offsetTop
  };
}
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
  if (isFixed === void 0) {
    isFixed = false;
  }
  if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow$2(element)) {
    return false;
  }
  return isFixed;
}
function getBoundingClientRect$3(element, includeScale, isFixedStrategy, offsetParent) {
  if (includeScale === void 0) {
    includeScale = false;
  }
  if (isFixedStrategy === void 0) {
    isFixedStrategy = false;
  }
  const clientRect = element.getBoundingClientRect();
  const domElement = unwrapElement(element);
  let scale = createCoords(1);
  if (includeScale) {
    if (offsetParent) {
      if (isElement$4(offsetParent)) {
        scale = getScale(offsetParent);
      }
    } else {
      scale = getScale(element);
    }
  }
  const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
  let x = (clientRect.left + visualOffsets.x) / scale.x;
  let y = (clientRect.top + visualOffsets.y) / scale.y;
  let width = clientRect.width / scale.x;
  let height = clientRect.height / scale.y;
  if (domElement) {
    const win = getWindow$2(domElement);
    const offsetWin = offsetParent && isElement$4(offsetParent) ? getWindow$2(offsetParent) : offsetParent;
    let currentWin = win;
    let currentIFrame = getFrameElement(currentWin);
    while (currentIFrame && offsetParent && offsetWin !== currentWin) {
      const iframeScale = getScale(currentIFrame);
      const iframeRect = currentIFrame.getBoundingClientRect();
      const css = getComputedStyle$4(currentIFrame);
      const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
      const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
      x *= iframeScale.x;
      y *= iframeScale.y;
      width *= iframeScale.x;
      height *= iframeScale.y;
      x += left;
      y += top;
      currentWin = getWindow$2(currentIFrame);
      currentIFrame = getFrameElement(currentWin);
    }
  }
  return rectToClientRect$1({
    width,
    height,
    x,
    y
  });
}

// If <html> has a CSS width greater than the viewport, then this will be
// incorrect for RTL.
function getWindowScrollBarX$2(element, rect) {
  const leftScroll = getNodeScroll$2(element).scrollLeft;
  if (!rect) {
    return getBoundingClientRect$3(getDocumentElement$2(element)).left + leftScroll;
  }
  return rect.left + leftScroll;
}
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
  if (ignoreScrollbarX === void 0) {
    ignoreScrollbarX = false;
  }
  const htmlRect = documentElement.getBoundingClientRect();
  const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
  // RTL <body> scrollbar.
  getWindowScrollBarX$2(documentElement, htmlRect));
  const y = htmlRect.top + scroll.scrollTop;
  return {
    x,
    y
  };
}
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  let {
    elements,
    rect,
    offsetParent,
    strategy
  } = _ref;
  const isFixed = strategy === 'fixed';
  const documentElement = getDocumentElement$2(offsetParent);
  const topLayer = elements ? isTopLayer(elements.floating) : false;
  if (offsetParent === documentElement || topLayer && isFixed) {
    return rect;
  }
  let scroll = {
    scrollLeft: 0,
    scrollTop: 0
  };
  let scale = createCoords(1);
  const offsets = createCoords(0);
  const isOffsetParentAnElement = isHTMLElement$3(offsetParent);
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
    if (getNodeName$2(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
      scroll = getNodeScroll$2(offsetParent);
    }
    if (isHTMLElement$3(offsetParent)) {
      const offsetRect = getBoundingClientRect$3(offsetParent);
      scale = getScale(offsetParent);
      offsets.x = offsetRect.x + offsetParent.clientLeft;
      offsets.y = offsetRect.y + offsetParent.clientTop;
    }
  }
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
  return {
    width: rect.width * scale.x,
    height: rect.height * scale.y,
    x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
    y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
  };
}
function getClientRects(element) {
  return Array.from(element.getClientRects());
}

// Gets the entire size of the scrollable document area, even extending outside
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
function getDocumentRect$1(element) {
  const html = getDocumentElement$2(element);
  const scroll = getNodeScroll$2(element);
  const body = element.ownerDocument.body;
  const width = max$7(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
  const height = max$7(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
  let x = -scroll.scrollLeft + getWindowScrollBarX$2(element);
  const y = -scroll.scrollTop;
  if (getComputedStyle$4(body).direction === 'rtl') {
    x += max$7(html.clientWidth, body.clientWidth) - width;
  }
  return {
    width,
    height,
    x,
    y
  };
}
function getViewportRect$1(element, strategy) {
  const win = getWindow$2(element);
  const html = getDocumentElement$2(element);
  const visualViewport = win.visualViewport;
  let width = html.clientWidth;
  let height = html.clientHeight;
  let x = 0;
  let y = 0;
  if (visualViewport) {
    width = visualViewport.width;
    height = visualViewport.height;
    const visualViewportBased = isWebKit();
    if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
      x = visualViewport.offsetLeft;
      y = visualViewport.offsetTop;
    }
  }
  return {
    width,
    height,
    x,
    y
  };
}

// Returns the inner client rect, subtracting scrollbars if present.
function getInnerBoundingClientRect$1(element, strategy) {
  const clientRect = getBoundingClientRect$3(element, true, strategy === 'fixed');
  const top = clientRect.top + element.clientTop;
  const left = clientRect.left + element.clientLeft;
  const scale = isHTMLElement$3(element) ? getScale(element) : createCoords(1);
  const width = element.clientWidth * scale.x;
  const height = element.clientHeight * scale.y;
  const x = left * scale.x;
  const y = top * scale.y;
  return {
    width,
    height,
    x,
    y
  };
}
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
  let rect;
  if (clippingAncestor === 'viewport') {
    rect = getViewportRect$1(element, strategy);
  } else if (clippingAncestor === 'document') {
    rect = getDocumentRect$1(getDocumentElement$2(element));
  } else if (isElement$4(clippingAncestor)) {
    rect = getInnerBoundingClientRect$1(clippingAncestor, strategy);
  } else {
    const visualOffsets = getVisualOffsets(element);
    rect = {
      x: clippingAncestor.x - visualOffsets.x,
      y: clippingAncestor.y - visualOffsets.y,
      width: clippingAncestor.width,
      height: clippingAncestor.height
    };
  }
  return rectToClientRect$1(rect);
}
function hasFixedPositionAncestor(element, stopNode) {
  const parentNode = getParentNode$2(element);
  if (parentNode === stopNode || !isElement$4(parentNode) || isLastTraversableNode(parentNode)) {
    return false;
  }
  return getComputedStyle$4(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
}

// A "clipping ancestor" is an `overflow` element with the characteristic of
// clipping (or hiding) child elements. This returns all clipping ancestors
// of the given element up the tree.
function getClippingElementAncestors(element, cache) {
  const cachedResult = cache.get(element);
  if (cachedResult) {
    return cachedResult;
  }
  let result = getOverflowAncestors(element, [], false).filter(el => isElement$4(el) && getNodeName$2(el) !== 'body');
  let currentContainingBlockComputedStyle = null;
  const elementIsFixed = getComputedStyle$4(element).position === 'fixed';
  let currentNode = elementIsFixed ? getParentNode$2(element) : element;

  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  while (isElement$4(currentNode) && !isLastTraversableNode(currentNode)) {
    const computedStyle = getComputedStyle$4(currentNode);
    const currentNodeIsContaining = isContainingBlock(currentNode);
    if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
      currentContainingBlockComputedStyle = null;
    }
    const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
    if (shouldDropCurrentNode) {
      // Drop non-containing blocks.
      result = result.filter(ancestor => ancestor !== currentNode);
    } else {
      // Record last containing block for next iteration.
      currentContainingBlockComputedStyle = computedStyle;
    }
    currentNode = getParentNode$2(currentNode);
  }
  cache.set(element, result);
  return result;
}

// Gets the maximum area that the element is visible in due to any number of
// clipping ancestors.
function getClippingRect$1(_ref) {
  let {
    element,
    boundary,
    rootBoundary,
    strategy
  } = _ref;
  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
  const firstClippingAncestor = clippingAncestors[0];
  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
    const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
    accRect.top = max$7(rect.top, accRect.top);
    accRect.right = min$6(rect.right, accRect.right);
    accRect.bottom = min$6(rect.bottom, accRect.bottom);
    accRect.left = max$7(rect.left, accRect.left);
    return accRect;
  }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  return {
    width: clippingRect.right - clippingRect.left,
    height: clippingRect.bottom - clippingRect.top,
    x: clippingRect.left,
    y: clippingRect.top
  };
}
function getDimensions(element) {
  const {
    width,
    height
  } = getCssDimensions(element);
  return {
    width,
    height
  };
}
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  const isOffsetParentAnElement = isHTMLElement$3(offsetParent);
  const documentElement = getDocumentElement$2(offsetParent);
  const isFixed = strategy === 'fixed';
  const rect = getBoundingClientRect$3(element, true, isFixed, offsetParent);
  let scroll = {
    scrollLeft: 0,
    scrollTop: 0
  };
  const offsets = createCoords(0);

  // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
  // Firefox with layout.scrollbar.side = 3 in about:config to test this.
  function setLeftRTLScrollbarOffset() {
    offsets.x = getWindowScrollBarX$2(documentElement);
  }
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
    if (getNodeName$2(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
      scroll = getNodeScroll$2(offsetParent);
    }
    if (isOffsetParentAnElement) {
      const offsetRect = getBoundingClientRect$3(offsetParent, true, isFixed, offsetParent);
      offsets.x = offsetRect.x + offsetParent.clientLeft;
      offsets.y = offsetRect.y + offsetParent.clientTop;
    } else if (documentElement) {
      setLeftRTLScrollbarOffset();
    }
  }
  if (isFixed && !isOffsetParentAnElement && documentElement) {
    setLeftRTLScrollbarOffset();
  }
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
  const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
  const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
  return {
    x,
    y,
    width: rect.width,
    height: rect.height
  };
}
function isStaticPositioned(element) {
  return getComputedStyle$4(element).position === 'static';
}
function getTrueOffsetParent$2(element, polyfill) {
  if (!isHTMLElement$3(element) || getComputedStyle$4(element).position === 'fixed') {
    return null;
  }
  if (polyfill) {
    return polyfill(element);
  }
  let rawOffsetParent = element.offsetParent;

  // Firefox returns the <html> element as the offsetParent if it's non-static,
  // while Chrome and Safari return the <body> element. The <body> element must
  // be used to perform the correct calculations even if the <html> element is
  // non-static.
  if (getDocumentElement$2(element) === rawOffsetParent) {
    rawOffsetParent = rawOffsetParent.ownerDocument.body;
  }
  return rawOffsetParent;
}

// Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
function getOffsetParent$2(element, polyfill) {
  const win = getWindow$2(element);
  if (isTopLayer(element)) {
    return win;
  }
  if (!isHTMLElement$3(element)) {
    let svgOffsetParent = getParentNode$2(element);
    while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
      if (isElement$4(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
        return svgOffsetParent;
      }
      svgOffsetParent = getParentNode$2(svgOffsetParent);
    }
    return win;
  }
  let offsetParent = getTrueOffsetParent$2(element, polyfill);
  while (offsetParent && isTableElement$2(offsetParent) && isStaticPositioned(offsetParent)) {
    offsetParent = getTrueOffsetParent$2(offsetParent, polyfill);
  }
  if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
    return win;
  }
  return offsetParent || getContainingBlock$2(element) || win;
}
const getElementRects = async function (data) {
  const getOffsetParentFn = this.getOffsetParent || getOffsetParent$2;
  const getDimensionsFn = this.getDimensions;
  const floatingDimensions = await getDimensionsFn(data.floating);
  return {
    reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
    floating: {
      x: 0,
      y: 0,
      width: floatingDimensions.width,
      height: floatingDimensions.height
    }
  };
};
function isRTL(element) {
  return getComputedStyle$4(element).direction === 'rtl';
}
const platform$1 = {
  convertOffsetParentRelativeRectToViewportRelativeRect,
  getDocumentElement: getDocumentElement$2,
  getClippingRect: getClippingRect$1,
  getOffsetParent: getOffsetParent$2,
  getElementRects,
  getClientRects,
  getDimensions,
  getScale,
  isElement: isElement$4,
  isRTL
};

/**
 * Modifies the placement by translating the floating element along the
 * specified axes.
 * A number (shorthand for `mainAxis` or distance), or an axes configuration
 * object may be passed.
 * @see https://floating-ui.com/docs/offset
 */
const offset$3 = offset$4;

/**
 * Optimizes the visibility of the floating element by choosing the placement
 * that has the most space available automatically, without needing to specify a
 * preferred placement. Alternative to `flip`.
 * @see https://floating-ui.com/docs/autoPlacement
 */
const autoPlacement = autoPlacement$1;

/**
 * Optimizes the visibility of the floating element by shifting it in order to
 * keep it in view when it will overflow the clipping boundary.
 * @see https://floating-ui.com/docs/shift
 */
const shift = shift$1;

/**
 * Optimizes the visibility of the floating element by flipping the `placement`
 * in order to keep it in view when the preferred placement(s) will overflow the
 * clipping boundary. Alternative to `autoPlacement`.
 * @see https://floating-ui.com/docs/flip
 */
flip$3;

/**
 * Provides data that allows you to change the size of the floating element —
 * for instance, prevent it from overflowing the clipping boundary or match the
 * width of the reference element.
 * @see https://floating-ui.com/docs/size
 */
size;

/**
 * Provides data to hide the floating element in applicable situations, such as
 * when it is not in the same clipping context as the reference element.
 * @see https://floating-ui.com/docs/hide
 */
hide$2;

/**
 * Provides data to position an inner element of the floating element so that it
 * appears centered to the reference element.
 * @see https://floating-ui.com/docs/arrow
 */
const arrow$2 = arrow$3;

/**
 * Provides improved positioning for inline reference elements that can span
 * over multiple lines, such as hyperlinks or range selections.
 * @see https://floating-ui.com/docs/inline
 */
inline;

/**
 * Built-in `limiter` that will stop `shift()` at a certain point.
 */
limitShift;

/**
 * Computes the `x` and `y` coordinates that will place the floating element
 * next to a given reference element.
 */
const computePosition = (reference, floating, options) => {
  // This caches the expensive `getClippingElementAncestors` function so that
  // multiple lifecycle resets re-use the same result. It only lives for a
  // single call. If other functions become expensive, we can add them as well.
  const cache = new Map();
  const mergedOptions = {
    platform: platform$1,
    ...options
  };
  const platformWithCache = {
    ...mergedOptions.platform,
    _c: cache
  };
  return computePosition$1(reference, floating, {
    ...mergedOptions,
    platform: platformWithCache
  });
};

class MagicLinkPopover {
  /**
   * @param {Object} options - 配置选项
   * @param {HTMLElement} options.parent - 父元素
   * @param {string} options.selector - 子元素选择器
   * @param {string} [options.titleAttr='popoverTitle'] - 标题对应的 dataset 属性名
   * @param {string} [options.contentAttr='popoverContent'] - 内容对应的 dataset 属性名
   * @param {string} [options.placement='top'] - 弹出位置
   * @param {number} [options.offsetDistance=8] - 偏移距离
   * @param {number} [options.showDelay=200] - 显示延迟时间(ms)
   * @param {number} [options.hideDelay=200] - 隐藏延迟时间(ms)
   * @param {string} [options.theme='light'] - 主题
   */
  constructor(options) {
    this.parent = options.parent;
    this.selector = options.selector;
    this.titleAttr = options.titleAttr || 'title';
    this.contentAttr = options.contentAttr || 'content';
    this.placement = options.placement || 'top';
    this.offsetDistance = options.offsetDistance || 8;
    this.showDelay = options.showDelay || 100;
    this.hideDelay = options.hideDelay || 200;
    this.theme = options.theme || 'light';
    this.previewFn = options.preview || null;
    this.popoverElement = null;
    this.arrowElement = null;
    this.showTimeout = null;
    this.hideTimeout = null;
    this.currentTarget = null;

    // 绑定方法的 this 上下文
    this.handleMouseOver = this.handleMouseOver.bind(this);
    this.handleMouseOut = this.handleMouseOut.bind(this);
    this.handlePopoverMouseOver = this.handlePopoverMouseOver.bind(this);
    this.handlePopoverMouseOut = this.handlePopoverMouseOut.bind(this);
    this.handlePopoverClick = this.handlePopoverClick.bind(this);
    this.init();
  }

  /**
   * 初始化 Popover
   */
  init() {
    this.createPopoverElement();
    this.bindEvents();
  }

  /**
   * 创建 Popover 元素
   */
  createPopoverElement() {
    // 创建 popover 容器
    this.popoverElement = document.createElement('div');
    this.popoverElement.className = `floating-popover floating-popover--${this.theme}`;
    this.popoverElement.style.cssText = `
      position: absolute;
      top: 0;
      left: 0;
      z-index: 9999;
      visibility: hidden;
      opacity: 0;
      background: ${this.theme === 'dark' ? '#333' : '#fff'};
      color: ${this.theme === 'dark' ? '#fff' : '#333'};
      border-radius: 4px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
      padding: 0;
      transition: opacity 0.3s, visibility 0.3s;
      max-width: 600px;
      font-size: 14px;
    `;
    const styleElement = document.createElement('style');
    styleElement.innerHTML = `
      .floating-popover .floating-popover__content table td {
        border: 1px solid #cacaca;
        padding: 3px 5px;
      }
      .floating-popover .floating-popover__content table tr.firstRow td {
        background-color: #464646;
      }
    `;

    // 创建标题区域
    const titleElement = document.createElement('div');
    titleElement.className = 'floating-popover__title';
    titleElement.style.cssText = `
      padding: 8px 12px;
      font-weight: bold;
      border-bottom: 1px solid ${this.theme === 'dark' ? '#444' : '#eee'};
    `;

    // 创建内容区域
    const contentElement = document.createElement('div');
    contentElement.className = 'floating-popover__content';
    contentElement.style.cssText = `
      padding: 12px;
    `;

    // 创建箭头元素
    this.arrowElement = document.createElement('div');
    this.arrowElement.className = 'floating-popover__arrow';
    this.arrowElement.style.cssText = `
      position: absolute;
      width: 8px;
      height: 8px;
      background: inherit;
      transform: rotate(45deg);
    `;

    // 组装 popover
    this.popoverElement.appendChild(styleElement);
    this.popoverElement.appendChild(titleElement);
    this.popoverElement.appendChild(contentElement);
    this.popoverElement.appendChild(this.arrowElement);

    // 添加到 body
    document.body.appendChild(this.popoverElement);
  }

  /**
   * 绑定事件
   */
  bindEvents() {
    // 使用事件代理监听鼠标移入事件
    this.parent.addEventListener('mouseover', this.handleMouseOver);
    this.parent.addEventListener('mouseout', this.handleMouseOut);

    // 监听 popover 自身的鼠标事件
    if (this.popoverElement) {
      this.popoverElement.addEventListener('mouseover', this.handlePopoverMouseOver);
      this.popoverElement.addEventListener('mouseout', this.handlePopoverMouseOut);
      this.popoverElement.addEventListener('click', this.handlePopoverClick);
    }
  }

  /**
   * 处理鼠标移入事件
   * @param {MouseEvent} event - 鼠标事件对象
   */
  handleMouseOver(event) {
    const target = event.target;
    const matchedElement = this.findMatchedElement(target);
    if (matchedElement) {
      this.currentTarget = matchedElement;
      this.scheduleShow();
    }
  }

  /**
   * 处理鼠标移出事件
   * @param {MouseEvent} event - 鼠标事件对象
   */
  handleMouseOut(event) {
    const relatedTarget = event.relatedTarget;
    const isToPopover = this.popoverElement?.contains(relatedTarget);
    if (!isToPopover) {
      this.scheduleHide();
    }
  }

  /**
   * 处理 Popover 鼠标移入事件
   */
  handlePopoverMouseOver() {
    if (this.hideTimeout) {
      window.clearTimeout(this.hideTimeout);
      this.hideTimeout = null;
    }
  }
  handlePopoverClick(event) {
    document.createElement('div');
    if (event.target?.nodeName === 'IMG') {
      let src = event.target.src;
      let notAllow = event.target.getAttribute('notallowgallery');
      if (notAllow !== '1' && this.previewFn) {
        this.previewFn({
          multiple: true,
          nowImgIndex: 0,
          imgList: [{
            url: src,
            title: '',
            description: ''
          }]
        });
      }
    }
  }

  /**
   * 处理 Popover 鼠标移出事件
   * @param {MouseEvent} event - 鼠标事件对象
   */
  handlePopoverMouseOut(event) {
    const relatedTarget = event.relatedTarget;
    const isBackToTarget = this.currentTarget?.contains(relatedTarget);
    if (!isBackToTarget) {
      this.scheduleHide();
    }
  }

  /**
   * 查找匹配选择器的元素
   * @param {HTMLElement} element - 起始元素
   * @returns {HTMLElement|null} 匹配的元素或 null
   */
  findMatchedElement(element) {
    let current = element;

    // 向上查找匹配选择器的元素，直到父元素
    while (current && current !== this.parent) {
      if (current.matches(this.selector)) {
        return current;
      }
      current = current.parentElement;
    }
    return null;
  }

  /**
   * 显示 Popover
   */
  scheduleShow() {
    if (this.hideTimeout) {
      window.clearTimeout(this.hideTimeout);
      this.hideTimeout = null;
    }
    if (!this.showTimeout) {
      this.showTimeout = window.setTimeout(() => {
        this.show();
        this.showTimeout = null;
      }, this.showDelay);
    }
  }

  /**
   * 隐藏 Popover
   */
  scheduleHide() {
    if (this.showTimeout) {
      window.clearTimeout(this.showTimeout);
      this.showTimeout = null;
    }
    if (!this.hideTimeout) {
      this.hideTimeout = window.setTimeout(() => {
        this.hide();
        this.hideTimeout = null;
      }, this.hideDelay);
    }
  }

  /**
   * 显示 Popover
   */
  async show() {
    if (!this.popoverElement || !this.currentTarget) return;

    // 获取标题和内容
    const title = this.currentTarget.dataset[this.titleAttr] || '';
    const content = this.currentTarget.dataset[this.contentAttr] || '';

    // 更新 popover 内容
    const titleElement = this.popoverElement.querySelector('.floating-popover__title');
    const contentElement = this.popoverElement.querySelector('.floating-popover__content');
    if (title) {
      titleElement.innerHTML = title;
      titleElement.style.display = 'block';
    } else {
      titleElement.style.display = 'none';
    }
    contentElement.innerHTML = content;

    // 计算位置
    if (this.arrowElement) {
      const {
        x,
        y,
        placement,
        middlewareData
      } = await computePosition(this.currentTarget, this.popoverElement, {
        placement: this.placement,
        middleware: [offset$3(this.offsetDistance), autoPlacement({
          allowedPlacements: ['top', 'bottom', 'left', 'right']
        }), shift({
          padding: 8
        }), arrow$2({
          element: this.arrowElement,
          padding: 4
        })]
      });

      // 设置 popover 位置
      Object.assign(this.popoverElement.style, {
        left: `${x}px`,
        top: `${y}px`,
        visibility: 'visible',
        opacity: '1'
      });

      // 设置箭头位置
      const {
        x: arrowX,
        y: arrowY
      } = middlewareData.arrow || {
        x: 0,
        y: 0
      };
      const staticSide = {
        top: 'bottom',
        right: 'left',
        bottom: 'top',
        left: 'right'
      }[placement.split('-')[0]] || 'bottom';
      Object.assign(this.arrowElement.style, {
        left: arrowX != null ? `${arrowX}px` : '',
        top: arrowY != null ? `${arrowY}px` : '',
        [staticSide]: '-4px'
      });
    }
  }

  /**
   * 隐藏 Popover
   */
  hide() {
    if (this.popoverElement) {
      this.popoverElement.style.visibility = 'hidden';
      this.popoverElement.style.opacity = '0';
    }
    this.currentTarget = null;
  }

  /**
   * 销毁 Popover 实例
   */
  destroy() {
    // 移除事件监听
    this.parent.removeEventListener('mouseover', this.handleMouseOver);
    this.parent.removeEventListener('mouseout', this.handleMouseOut);
    if (this.popoverElement) {
      this.popoverElement.removeEventListener('mouseover', this.handlePopoverMouseOver);
      this.popoverElement.removeEventListener('mouseout', this.handlePopoverMouseOut);
      this.popoverElement.removeEventListener('mouseout', this.handlePopoverClick(event));

      // 移除 DOM 元素
      document.body.removeChild(this.popoverElement);
      this.popoverElement = null;
      this.arrowElement = null;
    }

    // 清除定时器
    if (this.showTimeout) {
      window.clearTimeout(this.showTimeout);
      this.showTimeout = null;
    }
    if (this.hideTimeout) {
      window.clearTimeout(this.hideTimeout);
      this.hideTimeout = null;
    }
  }
}

let _that = {};
/**
 *
 * @param {
 * textBookData:"教材信息",
 * catalogList:"目录信息",
 * looseLeafData:"所有活页内容",
 * isTrial:"是否试读",
 * textBookMergeLevel:"教材合并到目录的层级",
 * trialChapterList:"试读章节列表"
 * }
 *
 * @returns
 */
const formatTextBook = data => {
  // _that = { ..._that, ...data }
  _that = {
    contentList: [],
    componentIndex: 0,
    componentTotal: 0,
    chapterIndex: 0,
    componentList: [],
    isTrial: false,
    isTrialIndex: 10,
    textBookMergeLevel: 1,
    trialChapterList: [],
    firstLevelLabel: '',
    firstLevelChapterId: '',
    locationChapterId: '',
    locationLabel: '',
    readableChapters: [],
    chapterData: {},
    componentData: {},
    textBookResource: {
      imageList: [],
      audioList: [],
      videoList: [],
      animationList: [],
      curriculumList: [],
      resourceList: [],
      formulaList: [],
      interactionList: [],
      questionList: [],
      testPaperList: [],
      graphList: [],
      tableList: [],
      imageTotal: 0,
      audioTotal: 0,
      videoTotal: 0,
      animationTotal: 0,
      curriculumTotal: 0,
      resourceTotal: 0,
      formulaTotal: 0,
      interactionTotal: 0,
      questionTotal: 0,
      testPaperTotal: 0,
      graphTotal: 0,
      tableTotal: 0,
      teachingResourceTotal: 0,
      imageCurrent: 0,
      audioCurrent: 0,
      videoCurrent: 0,
      animationCurrent: 0,
      curriculumCurrent: 0,
      resourceCurrent: 0,
      formulaCurrent: 0,
      interactionCurrent: 0,
      questionCurrent: 0,
      tableCurrent: 0,
      graphCurrent: 0
    },
    ...data
  };
  return new Promise(resolve => {
    const getItemByChild = (list, level, orderNum) => {
      for (let i = 0; i < list.length; i++) {
        let it = list[i];
        if (_that.looseLeafData[it.id] && _that.looseLeafData[it.id].looseLeafInfo) {
          if (JSON.parse(_that.looseLeafData[it.id].looseLeafInfo).length > 0) {
            // 更新组件总数
            _that.componentTotal += JSON.parse(_that.looseLeafData[it.id].looseLeafInfo).length;
            it.xmlCompRef = JSON.parse(_that.looseLeafData[it.id].looseLeafInfo)[0].xmlCompRef;
            _that.looseLeafData[it.id].label = it.label;
          } else {
            _that.componentTotal += 1;
            it.xmlCompRef = v4();
          }
        } else {
          _that.componentTotal += 1;
          it.xmlCompRef = v4();
        }
        it.chapterOrderNum = orderNum ? orderNum : i;
        it.catalogLevel = level;
        _that.contentList.push(it);
        if (it.children) {
          getItemByChild(it.children, level + 1, orderNum ? orderNum : i);
        }
      }
    };
    getItemByChild(_that.catalogList, 1, '');
    // 处理数据格式
    _that.chapterIndex = 0;
    formattedData(_that.contentList[0].id, resolve); //@format
  });
};

// 处理活页json数据信息 传入id获取数据解析为list
function formattedData(chapterId, resolve) {
  let list = [];
  if (_that.looseLeafData[chapterId] && _that.looseLeafData[chapterId].looseLeafInfo) {
    if (JSON.parse(_that.looseLeafData[chapterId].looseLeafInfo).length > 0) {
      list = JSON.parse(_that.looseLeafData[chapterId].looseLeafInfo);
    } else {
      list = [{
        componentsName: 'xml-single-placeholder-group',
        xmlCompRef: _that.contentList[_that.chapterIndex].xmlCompRef,
        data: {}
      }];
    }
  } else {
    list = [{
      componentsName: 'xml-single-placeholder-group',
      xmlCompRef: _that.contentList[_that.chapterIndex].xmlCompRef,
      data: {}
    }];
  }
  let source = {
    imageList: [],
    //图片列表
    audioList: [],
    //音频列表
    videoList: [],
    //视频列表
    animationList: [],
    //动画列表
    curriculumList: [],
    //微课列表
    formulaList: [],
    //公式列表
    interactionList: [],
    //互动列表
    resourceList: [],
    //资源列表
    questionList: [],
    //试题列表
    testPaperList: [],
    //试卷列表
    graphList: [],
    //图谱列表
    tableList: [] //表格列表
  };
  if (_that.contentList[_that.chapterIndex].catalogLevel == 1) {
    _that.firstLevelLabel = _that.contentList[_that.chapterIndex].label;
    _that.firstLevelChapterId = chapterId;
    _that.chapterData[_that.firstLevelChapterId] = {};
    _that.chapterData[_that.firstLevelChapterId].startIndex = _that.componentIndex;
    _that.chapterData[_that.firstLevelChapterId].endIndex = _that.componentIndex;
  }
  // 设置当前位置的章节ID和名称。 若当前目录层级小于等于教材合并到目录的层级
  if (_that.contentList[_that.chapterIndex].catalogLevel <= _that.textBookMergeLevel) {
    _that.locationChapterId = chapterId;
    _that.locationLabel = _that.contentList[_that.chapterIndex].label;
  }
  let readIndex = Number(_that.componentTotal * (_that.isTrialIndex / 100)).toFixed(0); //可以试读到的组件index
  let startIndex = _that.componentIndex;
  let chapterData = _that.catalogList.find(item => item.id == _that.firstLevelChapterId);
  list.map((element, index) => {
    let isTrialExternal = _that.isTrial ? _that.componentIndex < readIndex || _that.trialChapterList.includes(chapterId) ? false : true : false;
    // 向数据里添加位置信息，第一位：章节Id 、第二位：模块Id
    let location = `xml-digital-teaching/${chapterId}/${element.xmlCompRef}`;
    element.location = location;
    element.chapterId = chapterId;
    element.componentIndex = _that.componentIndex;
    element.label = _that.contentList[_that.chapterIndex].label; //章节名字
    element.firstLevelId = _that.firstLevelChapterId; //章节所在一级标题的Id
    element.firstLevelLabel = _that.firstLevelLabel; //章节所在一级标题的名称
    element.locationChapterId = _that.locationChapterId; //当前内容阅读所在目录id
    element.locationLabel = _that.locationLabel; //当前内容阅读所在目录名称
    element.chapterOrderNum = _that.contentList[_that.chapterIndex].chapterOrderNum; //当前内容阅读所在目录顺序
    element.startIndex = startIndex; //章节开始位置
    element.endIndex = startIndex + list.length; //章节结束位置
    element.endLevelId = chapterData; //章节结束id

    _that.componentIndex++;
    _that.chapterData[_that.firstLevelChapterId].endIndex = _that.componentIndex;

    // 处理文本图片
    const processTextImages = e => {
      e?.html?.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, p1) => {
        let keyValue = match.split(' ');
        let obj = {};
        for (let i = 0; i < keyValue.length; i++) {
          if (keyValue[i].indexOf('=') !== -1) {
            let item = keyValue[i].split('=');
            obj[item[0]] = item[1].replace(/\"/g, '').replace(/\/>/g, '');
          }
        }
        if (obj['data-img-type'] == '1') {
          source.imageList.push({
            chapterId: chapterId,
            label: _that.looseLeafData[chapterId].label,
            firstLevelId: _that.firstLevelChapterId,
            firstLevelLabel: _that.firstLevelLabel,
            locationChapterId: _that.locationChapterId,
            locationLabel: _that.locationLabel,
            isTrialExternal: isTrialExternal,
            location: location,
            title: obj.alt || '图片',
            uploadFileUrl: obj.src,
            id: obj.id
          });
        }
      });
      // 匹配magic-link标签中所有的值
      processTextMagicLink(e?.html || '');
    };
    const processTextMagicLink = htmlContent => {
      const regex = /<magic-link\b[^>]*>/gi;
      let match;
      while ((match = regex.exec(htmlContent)) !== null) {
        const tag = match[0];
        const item = {};
        const attrRegex = /(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([\w\-\.\/:]+)))?/g;
        let attrMatch;
        while ((attrMatch = attrRegex.exec(tag)) !== null) {
          const key = attrMatch[1];
          const value = attrMatch[2] || attrMatch[3] || attrMatch[4] || true;
          item[key] = value;
        }

        // results.push(attributes);
        if (item.type == 'audio') {
          source.audioList.push({
            chapterId: chapterId,
            label: _that.looseLeafData[chapterId].label,
            firstLevelId: _that.firstLevelChapterId,
            firstLevelLabel: _that.firstLevelLabel,
            locationChapterId: _that.locationChapterId,
            locationLabel: _that.locationLabel,
            isTrialExternal: isTrialExternal,
            location: location,
            title: item.plaintext || '音频',
            uploadFileUrl: item.content,
            id: item.id
          });
        } else if (item.type == 'video') {
          source.videoList.push({
            chapterId: chapterId,
            label: _that.looseLeafData[chapterId].label,
            firstLevelId: _that.firstLevelChapterId,
            firstLevelLabel: _that.firstLevelLabel,
            locationChapterId: _that.locationChapterId,
            locationLabel: _that.locationLabel,
            isTrialExternal: isTrialExternal,
            location: location,
            title: item.plaintext || '视频',
            uploadFileUrl: item.content,
            id: item.id
          });
        }
      }
    };
    // 根据不同的组件类型进行处理
    if (element.componentsName == 'xml-single-text-group') {
      // 文本
      element.Text = element.data.pGroupData.textData?.html; //文本内容

      processTextImages({
        html: element.data.pGroupData.textData?.html
      });
      if (element.data?.graphLinks?.length) {
        let linkWithLocationList = [];
        element.data?.graphLinks.forEach((item, index) => {
          item.targets.forEach(target => {
            let graphData = findNodeTree({
              ...item,
              location,
              titleClass: 'xml-graph-link',
              index,
              chapterId,
              graphTargetP: target
            }, _that.graphStoreKeyPrefix);
            if (graphData && graphData.links.length > 0) {
              linkWithLocationList.push(graphData);
            }
          });
        });
        source.graphList = [...source.graphList, ...linkWithLocationList];
      }
    } else if (element.componentsName == 'xml-single-image-group') {
      // 图片
      let textList = [];
      element.data.pGroupData.imageData.imageList.map((item, index) => {
        item.chapterId = chapterId;
        item.label = _that.looseLeafData[chapterId].label;
        item.firstLevelId = _that.firstLevelChapterId;
        item.firstLevelLabel = _that.firstLevelLabel;
        item.locationChapterId = _that.locationChapterId;
        item.locationLabel = _that.locationLabel;
        item.isTrialExternal = isTrialExternal;
        item.location = location;
        item.titleClass = 'xml-image-title';
        item.index = index;
        item.imageToatl = source.imageList.length;
        item.xmlCompRef = element.xmlCompRef + `_${index}`;
        textList.push({
          title: item.title,
          titleClass: 'xml-image-title',
          index: index
        });
      });
      if (element.data.pGroupData.imageData.imgType != '0') {
        source.imageList = source.imageList.concat(element.data.pGroupData.imageData.imageList);
      }
      element.textList = textList;
    } else if (element.componentsName == 'xml-single-music-group') {
      // 音频
      let textList = [];
      element.data.pGroupData.musicData.musicSetList.map((item, index) => {
        item.chapterId = chapterId;
        item.label = _that.looseLeafData[chapterId].label;
        item.firstLevelId = _that.firstLevelChapterId;
        item.firstLevelLabel = _that.firstLevelLabel;
        item.locationChapterId = _that.locationChapterId;
        item.locationLabel = _that.locationLabel;
        item.isTrialExternal = isTrialExternal;
        item.location = location;
        item.titleClass = 'xml-audio-title';
        item.index = index;
        item.xmlCompRef = element.xmlCompRef + `_${index}`;
        textList.push({
          title: item.title,
          titleClass: 'xml-audio-title',
          index: index
        });
      });
      source.audioList = source.audioList.concat(element.data.pGroupData.musicData.musicSetList);
      element.textList = textList;
    } else if (element.componentsName == 'xml-single-video-group') {
      // 视频
      let textList = [];
      element.data.pGroupData.videoData.videoSetList.map((item, index) => {
        item.chapterId = chapterId;
        item.label = _that.looseLeafData[chapterId].label;
        item.firstLevelId = _that.firstLevelChapterId;
        item.firstLevelLabel = _that.firstLevelLabel;
        item.locationChapterId = _that.locationChapterId;
        item.locationLabel = _that.locationLabel;
        item.isTrialExternal = isTrialExternal;
        item.location = location;
        item.titleClass = 'xml-video-title';
        item.index = index;
        item.xmlCompRef = element.xmlCompRef + `_${index}`;
        textList.push({
          title: item.title,
          titleClass: 'xml-video-title',
          index: index
        });
      });
      if (element.data.pGroupData.videoData.videoType == '1') {
        source.curriculumList = source.curriculumList.concat(element.data.pGroupData.videoData.videoSetList);
      } else if (element.data.pGroupData.videoData.videoType == '2') {
        source.animationList = source.animationList.concat(element.data.pGroupData.videoData.videoSetList);
      } else {
        source.videoList = source.videoList.concat(element.data.pGroupData.videoData.videoSetList);
      }
      element.textList = textList;
    } else if (element.componentsName == 'xml-single-resource-group') {
      // 资源

      let textList = [];
      element.data.pGroupData.resourceData.resourceSetList.map((item, index) => {
        item.chapterId = chapterId;
        item.label = _that.looseLeafData[chapterId].label;
        item.firstLevelId = _that.firstLevelChapterId;
        item.firstLevelLabel = _that.firstLevelLabel;
        item.locationChapterId = _that.locationChapterId;
        item.locationLabel = _that.locationLabel;
        item.isTrialExternal = isTrialExternal;
        item.location = location;
        item.titleClass = 'xml-resource-title';
        item.index = index;
        item.ilk = 'resource';
        item.xmlCompRef = element.xmlCompRef + `_${index}`;
        let title = item.title || item.fileFormat;
        textList.push({
          title: title,
          titleClass: 'xml-resource-title',
          index: index
        });
      });
      source.resourceList = source.resourceList.concat(element.data.pGroupData.resourceData.resourceSetList);
      element.textList = textList;
    } else if (element.componentsName == 'xml-single-book-group') {
      // 电子书
      let textList = [];
      element.data.pGroupData.ebookData.ebookSetList.map((item, index) => {
        item.chapterId = chapterId;
        item.label = _that.looseLeafData[chapterId].label;
        item.firstLevelId = _that.firstLevelChapterId;
        item.firstLevelLabel = _that.firstLevelLabel;
        item.locationChapterId = _that.locationChapterId;
        item.locationLabel = _that.locationLabel;
        item.isTrialExternal = isTrialExternal;
        item.location = location;
        item.titleClass = 'xml-ebook-title';
        item.index = index;
        item.ilk = 'ebook';
        item.xmlCompRef = element.xmlCompRef + `_${index}`;
        let title = item.title || item.name;
        textList.push({
          title: title,
          titleClass: 'xml-ebook-title',
          index: index
        });
      });
      source.resourceList = source.resourceList.concat(element.data.pGroupData.ebookData.ebookSetList);
      element.textList = textList;
    } else if (element.componentsName == 'xml-single-table-group') {
      // 表格
      element.chapterId = chapterId;
      element.label = _that.looseLeafData[chapterId].label;
      element.firstLevelId = _that.firstLevelChapterId;
      element.firstLevelLabel = _that.firstLevelLabel;
      element.locationChapterId = _that.locationChapterId;
      element.locationLabel = _that.locationLabel;
      element.data.pGroupData.tableData.isTrialExternal = isTrialExternal;
      element.data.pGroupData.tableData.location = location;
      source.tableList.push(element.data.pGroupData.tableData);
    } else if (element.componentsName == 'xml-single-question-group') {
      // 试题

      let textList = [];
      element.data.pGroupData.questionData.questionSetList.map((item, index) => {
        item.chapterId = chapterId;
        item.label = _that.looseLeafData[chapterId].label;
        item.firstLevelId = _that.firstLevelChapterId;
        item.firstLevelLabel = _that.firstLevelLabel;
        item.locationChapterId = _that.locationChapterId;
        item.locationLabel = _that.locationLabel;
        item.isTrialExternal = isTrialExternal;
        item.location = location;
        item.titleClass = 'xml-question-title';
        item.index = index;
        item.xmlCompRef = element.xmlCompRef + `_${index}`;
        textList.push({
          title: item.stem.content,
          titleClass: 'xml-question-title',
          index: index
        });
      });
      source.questionList = source.questionList.concat(element.data.pGroupData.questionData.questionSetList);
      element.textList = textList;
    } else if (element.componentsName == 'xml-single-test-paper-group') {
      // 试卷
      let textList = [];
      element.data.pGroupData.testPaperData.testPaperSetList.map((item, index) => {
        item.chapterId = chapterId;
        item.label = _that.looseLeafData[chapterId].label;
        item.firstLevelId = _that.firstLevelChapterId;
        item.firstLevelLabel = _that.firstLevelLabel;
        item.locationChapterId = _that.locationChapterId;
        item.locationLabel = _that.locationLabel;
        item.isTrialExternal = isTrialExternal;
        item.location = location;
        item.titleClass = 'xml-paper-title';
        item.index = index;
        item.xmlCompRef = element.xmlCompRef + `_${index}`;
        textList.push({
          title: item.paperName,
          titleClass: 'xml-paper-title',
          index: index
        });
      });
      source.testPaperList = source.testPaperList.concat(element.data.pGroupData.testPaperData.testPaperSetList);
      element.textList = textList;
    } else if (element.componentsName == 'xml-single-hotzone-group') {
      //热区
      let textList = [];
      element.data.pGroupData.xmlBlockData.imageList.map((item, index) => {
        textList.push({
          title: item.title,
          titleClass: 'xml-hot-zone-title',
          index: index
        });
      });
      element.textList = textList;
    } else if (element.componentsName == 'xml-single-html-group') {
      // element={
      //   ...element,
      //   data: {
      //     ...element.data,
      //     pGroupData: {
      //       ...element.data.pGroupData,
      //       htmlData: {
      //         ...element.data.pGroupData.htmlData,
      //         code: element.data.pGroupData.htmlData.code.replace(/<script>/g, '&lt;script&gt;').replace(/<\/script>/g, '&lt;/script&gt;')
      //       }
      //     }
      //   }
      // }
      element.chapterId = chapterId;
      element.label = _that.looseLeafData[chapterId].label;
      element.firstLevelId = _that.firstLevelChapterId;
      element.firstLevelLabel = _that.firstLevelLabel;
      element.locationChapterId = _that.locationChapterId;
      element.locationLabel = _that.locationLabel;
      element.data.pGroupData.htmlData.isTrialExternal = isTrialExternal;
      element.data.pGroupData.htmlData.location = location;
      element.data.pGroupData.htmlData.titleClass = 'xml-html-title';
      element.data.pGroupData.htmlData.index = 0;
      // if (element.data.pGroupData.htmlData.code) {
      //   //代码块
      //   textList.push({ title: element.data.pGroupData.htmlData.code, titleClass: '', index: 0 })
      //   _that.$set(element, 'textList', textList) //文本内容
      // }
      if (element.data.pGroupData.htmlData.htmlFileType == 'formula' || element.data.pGroupData.htmlData.htmlFileType == '1') {
        //公式
        source.formulaList.push(element.data.pGroupData.htmlData);
      } else if (element.data.pGroupData.htmlData.htmlFileType == 'pattern' || element.data.pGroupData.htmlData.htmlFileType == '0') {
        //虚拟仿真模型
        source.interactionList.push(element.data.pGroupData.htmlData);
      }
    } else if (element.componentsName.indexOf('title') !== -1) {
      //标题
      for (let item in element.data.pGroupData) {
        if (element.data.pGroupData[item]?.html) {
          element.Text += element.data.pGroupData[item]?.html; //文本内容
          processTextImages({
            html: element.data.pGroupData[item]?.html
          });
        }
      }
    } else if (element.componentsName.indexOf('paragraph') !== -1) {
      //段落
      element.Text = ''; //文本内容
      for (let item in element.data.pGroupData) {
        if (Array.isArray(element.data.pGroupData[item])) {
          for (let index in element.data.pGroupData[item]) {
            if (element.data.pGroupData[item][index].html) {
              element.Text += element.data.pGroupData[item][index].html;
              processTextImages({
                html: element.data.pGroupData[item][index].html
              });
            }
          }
        } else if (element.data.pGroupData[item].html) {
          element.Text += element.data.pGroupData[item].html;
          processTextImages({
            html: element.data.pGroupData[item].html
          });
        }
      }
    } else if (element.componentsName.indexOf('imageText') !== -1) {
      //图文
      element.Text = ''; //文本内容
      for (let item in element.data.pGroupData) {
        if (element.data.pGroupData[item].html) {
          element.Text += element.data.pGroupData[item].html;
          processTextImages({
            html: element.data.pGroupData[item].html
          });
        }
      }
    }
  });
  if (!_that.isTrial || (_that.componentList.length < readIndex || _that.trialChapterList.includes(chapterId)) && _that.isTrial) {
    _that.readableChapters.push(chapterId);
    //判断是否非试读模式或当前内容在可试读内
    // 组件数据添加到componentList
    let compList = [];
    if (_that.componentList.length + list.length > readIndex && _that.isTrial && _that.trialChapterList.length == 0) {
      //如果当前章节内容累加进去之后会超出试读区域就截取试读区域内的内容
      let i = readIndex - _that.componentList.length;
      compList = list.slice(0, i);
    } else {
      compList = list;
    }
    _that.componentList = _that.componentList.concat(compList);
  }

  //
  formattedResourceList(source, _that.firstLevelChapterId, _that.firstLevelLabel);

  // 循环判断是否还有下一章
  if (_that.contentList.length - 1 > _that.chapterIndex) {
    _that.chapterIndex++;
    formattedData(_that.contentList[_that.chapterIndex].id, resolve);
  } else {
    // 循环结束
    const getItemByChild = list => {
      for (let i = 0; i < list.length; i++) {
        let isTrial = _that.componentList.findIndex(item => item.chapterId == list[i].id) == -1;
        if (isTrial) {
          list[i] = {
            ...list[i],
            notUsable: true
          };
        }
        if (list[i].children) {
          getItemByChild(list[i].children);
        }
      }
    };
    getItemByChild(_that.catalogList);
    resolve({
      contentList: _that.contentList,
      catalogList: _that.catalogList,
      componentList: _that.componentList,
      textBookResource: _that.textBookResource,
      readableChapters: _that.readableChapters,
      componentTotal: _that.componentTotal,
      chapterData: _that.chapterData
    });
  }
}

// 初始化资源列表
function formattedResourceList(source, chapterId, label) {
  for (let key in source) {
    if (source[key].length > 0 && JSON.stringify(_that.textBookResource[key]).indexOf(chapterId) == -1) {
      let data = {
        chapterId: chapterId,
        label: label,
        state: _that.textBookResource[key].length == 0 ? true : false
      };
      data[key] = source[key];
      _that.textBookResource[key].push(data);
    } else if (source[key].length > 0) {
      let i = _that.textBookResource[key].length - 1;
      _that.textBookResource[key][i][key] = _that.textBookResource[key][i][key].concat(source[key]);
    }
    let i = key.split('List')[0];
    _that.textBookResource[i + 'Total'] += source[key].length;
  }
}

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

function commonjsRequire () {
	throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
}

function unwrapExports (x) {
	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}

function createCommonjsModule(fn, module) {
	return module = { exports: {} }, fn(module, module.exports), module.exports;
}

var vhCheck = createCommonjsModule(function (module, exports) {
(function (global, factory) {
  module.exports = factory() ;
})(commonjsGlobal, function () {

  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
    See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  var __assign = function () {
    __assign = Object.assign || function __assign(t) {
      for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
      return t;
    };
    return __assign.apply(this, arguments);
  };

  // don't know a better way to get the size of a CSS 100vh…
  function createTestElement() {
    var testElement = document.createElement('div');
    testElement.style.cssText = 'position: fixed; top: 0; height: 100vh; pointer-events: none;';
    document.documentElement.insertBefore(testElement, document.documentElement.firstChild);
    return testElement;
  }
  function removeTestElement(element) {
    document.documentElement.removeChild(element);
  }
  //  in some browsers this will be bigger than window.innerHeight
  function checkSizes() {
    var vhTest = createTestElement();
    var windowHeight = window.innerHeight;
    var vh = vhTest.offsetHeight;
    var offset = vh - windowHeight;
    removeTestElement(vhTest);
    return {
      vh: vh,
      windowHeight: windowHeight,
      offset: offset,
      isNeeded: offset !== 0,
      value: 0
    };
  }
  // export
  function noop() {}
  function computeDifference() {
    var sizes = checkSizes();
    sizes.value = sizes.offset;
    return sizes;
  }
  function redefineVhUnit() {
    var sizes = checkSizes();
    sizes.value = sizes.windowHeight * 0.01;
    return sizes;
  }
  var methods = /*#__PURE__*/Object.freeze({
    noop: noop,
    computeDifference: computeDifference,
    redefineVhUnit: redefineVhUnit
  });
  function isString(text) {
    return typeof text === "string" && text.length > 0;
  }
  function isFunction(f) {
    return typeof f === "function";
  }
  var defaultOptions = Object.freeze({
    cssVarName: 'vh-offset',
    redefineVh: false,
    method: computeDifference,
    force: false,
    bind: true,
    updateOnTouch: false,
    onUpdate: noop
  });
  function getOptions(options) {
    // old options handling: only redefine the CSS var name
    if (isString(options)) {
      return __assign({}, defaultOptions, {
        cssVarName: options
      });
    }
    // be sure to have a configuration object
    if (typeof options !== 'object') return defaultOptions;
    // make sure we have the right options to start with
    var finalOptions = {
      force: options.force === true,
      bind: options.bind !== false,
      updateOnTouch: options.updateOnTouch === true,
      onUpdate: isFunction(options.onUpdate) ? options.onUpdate : noop
    };
    // method change
    var redefineVh = options.redefineVh === true;
    finalOptions.method = methods[redefineVh ? 'redefineVhUnit' : 'computeDifference'];
    finalOptions.cssVarName = isString(options.cssVarName) ? options.cssVarName : redefineVh ?
    /*
    when redefining vh unit we follow this article name convention
    https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
    */
    'vh' : defaultOptions.cssVarName;
    return finalOptions;
  }

  // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
  var passiveSupported = false;
  var eventListeners = [];
  /* istanbul ignore next */
  try {
    var options = Object.defineProperty({}, "passive", {
      get: function () {
        passiveSupported = true;
      }
    });
    window.addEventListener("test", options, options);
    window.removeEventListener("test", options, options);
  } catch (err) {
    passiveSupported = false;
  }
  function addListener(eventName, callback) {
    eventListeners.push({
      eventName: eventName,
      callback: callback
    });
    window.addEventListener(eventName, callback, /* istanbul ignore next */
    passiveSupported ? {
      passive: true
    } : false);
  }
  function removeAll() {
    eventListeners.forEach(function (config) {
      window.removeEventListener(config.eventName, config.callback);
    });
    eventListeners = [];
  }
  function updateCssVar(cssVarName, result) {
    document.documentElement.style.setProperty("--" + cssVarName, result.value + "px");
  }
  function formatResult(sizes, options) {
    return __assign({}, sizes, {
      unbind: removeAll,
      recompute: options.method
    });
  }
  function vhCheck(options) {
    var config = Object.freeze(getOptions(options));
    var result = formatResult(config.method(), config);
    // usefulness check
    if (!result.isNeeded && !config.force) {
      return result;
    }
    updateCssVar(config.cssVarName, result);
    config.onUpdate(result);
    // enabled by default
    if (!config.bind) return result;
    function onWindowChange() {
      window.requestAnimationFrame(function () {
        var sizes = config.method();
        updateCssVar(config.cssVarName, sizes);
        config.onUpdate(formatResult(sizes, config));
      });
    }
    // be sure we don't duplicates events listeners
    result.unbind();
    // listen for orientation change
    // - this can't be configured
    // - because it's convenient and not a real performance bottleneck
    addListener('orientationchange', onWindowChange);
    // listen to touch move for scrolling
    // – disabled by default
    // - listening to scrolling can be expansive…
    if (config.updateOnTouch) {
      addListener('touchmove', onWindowChange);
    }
    return result;
  }
  return vhCheck;
});
});

function _extends$1() {
  return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
    for (var e = 1; e < arguments.length; e++) {
      var t = arguments[e];
      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
    }
    return n;
  }, _extends$1.apply(null, arguments);
}

function _extends() {
  return _extends = Object.assign ? Object.assign.bind() : function (a) {
    for (var b, c = 1; c < arguments.length; c++) for (var d in b = arguments[c], b) Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d]);
    return a;
  }, _extends.apply(this, arguments);
}
var normalMerge = ["attrs", "props", "domProps"],
  toArrayMerge = ["class", "style", "directives"],
  functionalMerge = ["on", "nativeOn"],
  mergeJsxProps = function (a) {
    return a.reduce(function (c, a) {
      for (var b in a) if (!c[b]) c[b] = a[b];else if (-1 !== normalMerge.indexOf(b)) c[b] = _extends({}, c[b], a[b]);else if (-1 !== toArrayMerge.indexOf(b)) {
        var d = c[b] instanceof Array ? c[b] : [c[b]],
          e = a[b] instanceof Array ? a[b] : [a[b]];
        c[b] = [].concat(d, e);
      } else if (-1 !== functionalMerge.indexOf(b)) {
        for (var f in a[b]) if (c[b][f]) {
          var g = c[b][f] instanceof Array ? c[b][f] : [c[b][f]],
            h = a[b][f] instanceof Array ? a[b][f] : [a[b][f]];
          c[b][f] = [].concat(g, h);
        } else c[b][f] = a[b][f];
      } else if ("hook" === b) for (var i in a[b]) c[b][i] = c[b][i] ? mergeFn(c[b][i], a[b][i]) : a[b][i];else c[b] = a[b];
      return c;
    }, {});
  },
  mergeFn = function (a, b) {
    return function () {
      a && a.apply(this, arguments), b && b.apply(this, arguments);
    };
  };
var helper = mergeJsxProps;

var _mergeJSXProps = helper;

/**
 * bem helper
 * b() // 'button'
 * b('text') // 'button__text'
 * b({ disabled }) // 'button button--disabled'
 * b('text', { disabled }) // 'button__text button__text--disabled'
 * b(['disabled', 'primary']) // 'button button--disabled button--primary'
 */
function gen(name, mods) {
  if (!mods) {
    return '';
  }
  if (typeof mods === 'string') {
    return " " + name + "--" + mods;
  }
  if (Array.isArray(mods)) {
    return mods.reduce(function (ret, item) {
      return ret + gen(name, item);
    }, '');
  }
  return Object.keys(mods).reduce(function (ret, key) {
    return ret + (mods[key] ? gen(name, key) : '');
  }, '');
}
function createBEM(name) {
  return function (el, mods) {
    if (el && typeof el !== 'string') {
      mods = el;
      el = '';
    }
    el = el ? name + "__" + el : name;
    return "" + el + gen(el, mods);
  };
}

var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
function assignKey(to, from, key) {
  var val = from[key];
  if (!isDef$1(val)) {
    return;
  }
  if (!hasOwnProperty$3.call(to, key) || !isObject$6(val)) {
    to[key] = val;
  } else {
    // eslint-disable-next-line @typescript-eslint/no-use-before-define
    to[key] = deepAssign(Object(to[key]), from[key]);
  }
}
function deepAssign(to, from) {
  Object.keys(from).forEach(function (key) {
    assignKey(to, from, key);
  });
  return to;
}

var defaultMessages = {
  name: '姓名',
  tel: '电话',
  save: '保存',
  confirm: '确认',
  cancel: '取消',
  delete: '删除',
  complete: '完成',
  loading: '加载中...',
  telEmpty: '请填写电话',
  nameEmpty: '请填写姓名',
  nameInvalid: '请输入正确的姓名',
  confirmDelete: '确定要删除吗',
  telInvalid: '请输入正确的手机号',
  vanCalendar: {
    end: '结束',
    start: '开始',
    title: '日期选择',
    confirm: '确定',
    startEnd: '开始/结束',
    weekdays: ['日', '一', '二', '三', '四', '五', '六'],
    monthTitle: function monthTitle(year, month) {
      return year + "\u5E74" + month + "\u6708";
    },
    rangePrompt: function rangePrompt(maxRange) {
      return "\u9009\u62E9\u5929\u6570\u4E0D\u80FD\u8D85\u8FC7 " + maxRange + " \u5929";
    }
  },
  vanCascader: {
    select: '请选择'
  },
  vanContactCard: {
    addText: '添加联系人'
  },
  vanContactList: {
    addText: '新建联系人'
  },
  vanPagination: {
    prev: '上一页',
    next: '下一页'
  },
  vanPullRefresh: {
    pulling: '下拉即可刷新...',
    loosing: '释放即可刷新...'
  },
  vanSubmitBar: {
    label: '合计：'
  },
  vanCoupon: {
    unlimited: '无使用门槛',
    discount: function discount(_discount) {
      return _discount + "\u6298";
    },
    condition: function condition(_condition) {
      return "\u6EE1" + _condition + "\u5143\u53EF\u7528";
    }
  },
  vanCouponCell: {
    title: '优惠券',
    tips: '暂无可用',
    count: function count(_count) {
      return _count + "\u5F20\u53EF\u7528";
    }
  },
  vanCouponList: {
    empty: '暂无优惠券',
    exchange: '兑换',
    close: '不使用优惠券',
    enable: '可用',
    disabled: '不可用',
    placeholder: '请输入优惠码'
  },
  vanAddressEdit: {
    area: '地区',
    postal: '邮政编码',
    areaEmpty: '请选择地区',
    addressEmpty: '请填写详细地址',
    postalEmpty: '邮政编码格式不正确',
    defaultAddress: '设为默认收货地址',
    telPlaceholder: '收货人手机号',
    namePlaceholder: '收货人姓名',
    areaPlaceholder: '选择省 / 市 / 区'
  },
  vanAddressEditDetail: {
    label: '详细地址',
    placeholder: '街道门牌、楼层房间号等信息'
  },
  vanAddressList: {
    add: '新增地址'
  }
};

var proto$2 = Vue.prototype;
var defineReactive = Vue.util.defineReactive;
defineReactive(proto$2, '$vantLang', 'zh-CN');
defineReactive(proto$2, '$vantMessages', {
  'zh-CN': defaultMessages
});
var Locale$1 = {
  messages: function messages() {
    return proto$2.$vantMessages[proto$2.$vantLang];
  },
  use: function use(lang, messages) {
    var _this$add;
    proto$2.$vantLang = lang;
    this.add((_this$add = {}, _this$add[lang] = messages, _this$add));
  },
  add: function add(messages) {
    if (messages === void 0) {
      messages = {};
    }
    deepAssign(proto$2.$vantMessages, messages);
  }
};

var camelizeRE = /-(\w)/g;
function camelize(str) {
  return str.replace(camelizeRE, function (_, c) {
    return c.toUpperCase();
  });
}
function padZero(num, targetLength) {
  if (targetLength === void 0) {
    targetLength = 2;
  }
  var str = num + '';
  while (str.length < targetLength) {
    str = '0' + str;
  }
  return str;
}

/**
 * Use scopedSlots in Vue 2.6+
 * downgrade to slots in lower version
 */
var SlotsMixin = {
  methods: {
    slots: function slots(name, props) {
      if (name === void 0) {
        name = 'default';
      }
      var $slots = this.$slots,
        $scopedSlots = this.$scopedSlots;
      var scopedSlot = $scopedSlots[name];
      if (scopedSlot) {
        return scopedSlot(props);
      }
      return $slots[name];
    }
  }
};

/**
 * Create a basic component with common options
 */
function install$W(Vue) {
  var name = this.name;
  Vue.component(name, this);
  Vue.component(camelize("-" + name), this);
} // unify slots & scopedSlots

function unifySlots(context) {
  // use data.scopedSlots in lower Vue version
  var scopedSlots = context.scopedSlots || context.data.scopedSlots || {};
  var slots = context.slots();
  Object.keys(slots).forEach(function (key) {
    if (!scopedSlots[key]) {
      scopedSlots[key] = function () {
        return slots[key];
      };
    }
  });
  return scopedSlots;
} // should be removed after Vue 3

function transformFunctionComponent(pure) {
  return {
    functional: true,
    props: pure.props,
    model: pure.model,
    render: function render(h, context) {
      return pure(h, context.props, unifySlots(context), context);
    }
  };
}
function createComponent$1H(name) {
  return function (sfc) {
    if (isFunction$3(sfc)) {
      sfc = transformFunctionComponent(sfc);
    }
    if (!sfc.functional) {
      sfc.mixins = sfc.mixins || [];
      sfc.mixins.push(SlotsMixin);
    }
    sfc.name = name;
    sfc.install = install$W;
    return sfc;
  };
}

function createI18N(name) {
  var prefix = camelize(name) + '.';
  return function (path) {
    var messages = Locale$1.messages();
    var message = get$3(messages, prefix + path) || get$3(messages, path);
    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      args[_key - 1] = arguments[_key];
    }
    return isFunction$3(message) ? message.apply(void 0, args) : message;
  };
}

function createNamespace(name) {
  name = 'van-' + name;
  return [createComponent$1H(name), createBEM(name), createI18N(name)];
}

function isNumeric$1(val) {
  return /^\d+(\.\d+)?$/.test(val);
}
function isNaN$1(val) {
  if (Number.isNaN) {
    return Number.isNaN(val);
  } // eslint-disable-next-line no-self-compare

  return val !== val;
}

function addUnit(value) {
  if (!isDef$1(value)) {
    return undefined;
  }
  value = String(value);
  return isNumeric$1(value) ? value + "px" : value;
} // cache

var rootFontSize;
function getRootFontSize() {
  if (!rootFontSize) {
    var doc = document.documentElement;
    var fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
    rootFontSize = parseFloat(fontSize);
  }
  return rootFontSize;
}
function convertRem(value) {
  value = value.replace(/rem/g, '');
  return +value * getRootFontSize();
}
function convertVw(value) {
  value = value.replace(/vw/g, '');
  return +value * window.innerWidth / 100;
}
function convertVh(value) {
  value = value.replace(/vh/g, '');
  return +value * window.innerHeight / 100;
}
function unitToPx(value) {
  if (typeof value === 'number') {
    return value;
  }
  if (inBrowser$1) {
    if (value.indexOf('rem') !== -1) {
      return convertRem(value);
    }
    if (value.indexOf('vw') !== -1) {
      return convertVw(value);
    }
    if (value.indexOf('vh') !== -1) {
      return convertVh(value);
    }
  }
  return parseFloat(value);
}

var inBrowser$1 = typeof window !== 'undefined';
var isServer$1 = Vue.prototype.$isServer; // eslint-disable-next-line @typescript-eslint/no-empty-function

function noop$3() {}
function isDef$1(val) {
  return val !== undefined && val !== null;
}
function isFunction$3(val) {
  return typeof val === 'function';
}
function isObject$6(val) {
  return val !== null && typeof val === 'object';
}
function isPromise$1(val) {
  return isObject$6(val) && isFunction$3(val.then) && isFunction$3(val.catch);
}
function get$3(object, path) {
  var keys = path.split('.');
  var result = object;
  keys.forEach(function (key) {
    var _result$key;
    result = isObject$6(result) ? (_result$key = result[key]) != null ? _result$key : '' : '';
  });
  return result;
}
/**
 * Checks if `value` is an empty object, collection, map, or set.
 *
 * Objects are considered empty if they have no own enumerable string keyed
 * properties.
 *
 * Array-like values such as `arguments` objects, arrays, buffers, strings, or
 * jQuery-like collections are considered empty if they have a `length` of `0`.
 * Similarly, maps and sets are considered empty if they have a `size` of `0`.
 *
 * @function isEmpty
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
 * @example
 *
 * _.isEmpty(null);
 * // => true
 *
 * _.isEmpty(true);
 * // => true
 *
 * _.isEmpty(1);
 * // => true
 *
 * _.isEmpty([1, 2, 3]);
 * // => false
 *
 * _.isEmpty({ 'a': 1 });
 * // => false
 */

function isEmpty$2(value) {
  if (value == null) {
    return true;
  }
  if (typeof value !== 'object') {
    return true;
  }
  return Object.keys(value).length === 0;
}

var inheritKey = ['ref', 'key', 'style', 'class', 'attrs', 'refInFor', 'nativeOn', 'directives', 'staticClass', 'staticStyle'];
var mapInheritKey = {
  nativeOn: 'on'
}; // inherit partial context, map nativeOn to on

function inherit(context, inheritListeners) {
  var result = inheritKey.reduce(function (obj, key) {
    if (context.data[key]) {
      obj[mapInheritKey[key] || key] = context.data[key];
    }
    return obj;
  }, {});
  if (inheritListeners) {
    result.on = result.on || {};
    _extends$1(result.on, context.data.on);
  }
  return result;
} // emit event

function emit(context, eventName) {
  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
    args[_key - 2] = arguments[_key];
  }
  var listeners = context.listeners[eventName];
  if (listeners) {
    if (Array.isArray(listeners)) {
      listeners.forEach(function (listener) {
        listener.apply(void 0, args);
      });
    } else {
      listeners.apply(void 0, args);
    }
  }
} // mount functional component

function mount(Component, data) {
  var instance = new Vue({
    el: document.createElement('div'),
    props: Component.props,
    render: function render(h) {
      return h(Component, _extends$1({
        props: this.$props
      }, data));
    }
  });
  document.body.appendChild(instance.$el);
  return instance;
}

var context$1 = {
  zIndex: 2000,
  lockCount: 0,
  stack: [],
  find: function find(vm) {
    return this.stack.filter(function (item) {
      return item.vm === vm;
    })[0];
  },
  remove: function remove(vm) {
    var item = this.find(vm);
    if (!item) return;
    item.vm = null;
    item.overlay = null;
    var index = this.stack.indexOf(item);
    this.stack.splice(index, 1);
  }
};

// eslint-disable-next-line import/no-mutable-exports
var supportsPassive = false;
if (!isServer$1) {
  try {
    var opts = {};
    Object.defineProperty(opts, 'passive', {
      // eslint-disable-next-line getter-return
      get: function get() {
        /* istanbul ignore next */
        supportsPassive = true;
      }
    });
    window.addEventListener('test-passive', null, opts); // eslint-disable-next-line no-empty
  } catch (e) {}
}
function on$2(target, event, handler, passive) {
  if (passive === void 0) {
    passive = false;
  }
  if (!isServer$1) {
    target.addEventListener(event, handler, supportsPassive ? {
      capture: false,
      passive: passive
    } : false);
  }
}
function off$2(target, event, handler) {
  if (!isServer$1) {
    target.removeEventListener(event, handler);
  }
}
function stopPropagation(event) {
  event.stopPropagation();
}
function preventDefault$1(event, isStopPropagation) {
  /* istanbul ignore else */
  if (typeof event.cancelable !== 'boolean' || event.cancelable) {
    event.preventDefault();
  }
  if (isStopPropagation) {
    stopPropagation(event);
  }
}

var _createNamespace$1C = createNamespace('overlay'),
  createComponent$1G = _createNamespace$1C[0],
  bem$1x = _createNamespace$1C[1];
function preventTouchMove(event) {
  preventDefault$1(event, true);
}
function Overlay(h, props, slots, ctx) {
  var style = _extends$1({
    zIndex: props.zIndex
  }, props.customStyle);
  if (isDef$1(props.duration)) {
    style.animationDuration = props.duration + "s";
  }
  return h("transition", {
    "attrs": {
      "name": "van-fade"
    }
  }, [h("div", _mergeJSXProps([{
    "directives": [{
      name: "show",
      value: props.show
    }],
    "style": style,
    "class": [bem$1x(), props.className],
    "on": {
      "touchmove": props.lockScroll ? preventTouchMove : noop$3
    }
  }, inherit(ctx, true)]), [slots.default == null ? void 0 : slots.default()])]);
}
Overlay.props = {
  show: Boolean,
  zIndex: [Number, String],
  duration: [Number, String],
  className: null,
  customStyle: Object,
  lockScroll: {
    type: Boolean,
    default: true
  }
};
var Overlay$1 = createComponent$1G(Overlay);

function removeNode$2(el) {
  var parent = el.parentNode;
  if (parent) {
    parent.removeChild(el);
  }
}

var defaultConfig$1 = {
  className: '',
  customStyle: {}
};
function mountOverlay(vm) {
  return mount(Overlay$1, {
    on: {
      // close popup when overlay clicked & closeOnClickOverlay is true
      click: function click() {
        vm.$emit('click-overlay');
        if (vm.closeOnClickOverlay) {
          if (vm.onClickOverlay) {
            vm.onClickOverlay();
          } else {
            vm.close();
          }
        }
      }
    }
  });
}
function updateOverlay(vm) {
  var item = context$1.find(vm);
  if (item) {
    var el = vm.$el;
    var config = item.config,
      overlay = item.overlay;
    if (el && el.parentNode) {
      el.parentNode.insertBefore(overlay.$el, el);
    }
    _extends$1(overlay, defaultConfig$1, config, {
      show: true
    });
  }
}
function openOverlay(vm, config) {
  var item = context$1.find(vm);
  if (item) {
    item.config = config;
  } else {
    var overlay = mountOverlay(vm);
    context$1.stack.push({
      vm: vm,
      config: config,
      overlay: overlay
    });
  }
  updateOverlay(vm);
}
function closeOverlay(vm) {
  var item = context$1.find(vm);
  if (item) {
    item.overlay.show = false;
  }
}
function removeOverlay(vm) {
  var item = context$1.find(vm);
  if (item) {
    removeNode$2(item.overlay.$el);
    context$1.remove(vm);
  }
}

function isWindow$1(val) {
  return val === window;
} // get nearest scroll element
// https://github.com/vant-ui/vant/issues/3823

var overflowScrollReg = /scroll|auto|overlay/i;
function getScroller(el, root) {
  if (root === void 0) {
    root = window;
  }
  var node = el;
  while (node && node.tagName !== 'HTML' && node.tagName !== 'BODY' && node.nodeType === 1 && node !== root) {
    var _window$getComputedSt = window.getComputedStyle(node),
      overflowY = _window$getComputedSt.overflowY;
    if (overflowScrollReg.test(overflowY)) {
      return node;
    }
    node = node.parentNode;
  }
  return root;
}
function getScrollTop(el) {
  var top = 'scrollTop' in el ? el.scrollTop : el.pageYOffset; // iOS scroll bounce cause minus scrollTop

  return Math.max(top, 0);
}
function setScrollTop(el, value) {
  if ('scrollTop' in el) {
    el.scrollTop = value;
  } else {
    el.scrollTo(el.scrollX, value);
  }
}
function getRootScrollTop() {
  return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
}
function setRootScrollTop(value) {
  setScrollTop(window, value);
  setScrollTop(document.body, value);
} // get distance from element top to page top or scroller top

function getElementTop(el, scroller) {
  if (isWindow$1(el)) {
    return 0;
  }
  var scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
  return el.getBoundingClientRect().top + scrollTop;
}
function getVisibleHeight(el) {
  if (isWindow$1(el)) {
    return el.innerHeight;
  }
  return el.getBoundingClientRect().height;
}
function getVisibleTop(el) {
  if (isWindow$1(el)) {
    return 0;
  }
  return el.getBoundingClientRect().top;
}

function getDirection(x, y) {
  if (x > y) {
    return 'horizontal';
  }
  if (y > x) {
    return 'vertical';
  }
  return '';
}
var TouchMixin = {
  data: function data() {
    return {
      direction: ''
    };
  },
  methods: {
    touchStart: function touchStart(event) {
      this.resetTouchStatus();
      this.startX = event.touches[0].clientX;
      this.startY = event.touches[0].clientY;
    },
    touchMove: function touchMove(event) {
      var touch = event.touches[0]; // safari back will set clientX to negative number

      this.deltaX = touch.clientX < 0 ? 0 : touch.clientX - this.startX;
      this.deltaY = touch.clientY - this.startY;
      this.offsetX = Math.abs(this.deltaX);
      this.offsetY = Math.abs(this.deltaY); // lock direction when distance is greater than a certain value

      var LOCK_DIRECTION_DISTANCE = 10;
      if (!this.direction || this.offsetX < LOCK_DIRECTION_DISTANCE && this.offsetY < LOCK_DIRECTION_DISTANCE) {
        this.direction = getDirection(this.offsetX, this.offsetY);
      }
    },
    resetTouchStatus: function resetTouchStatus() {
      this.direction = '';
      this.deltaX = 0;
      this.deltaY = 0;
      this.offsetX = 0;
      this.offsetY = 0;
    },
    // avoid Vue 2.6 event bubble issues by manually binding events
    // https://github.com/vant-ui/vant/issues/3015
    bindTouchEvent: function bindTouchEvent(el) {
      var onTouchStart = this.onTouchStart,
        onTouchMove = this.onTouchMove,
        onTouchEnd = this.onTouchEnd;
      on$2(el, 'touchstart', onTouchStart);
      on$2(el, 'touchmove', onTouchMove);
      if (onTouchEnd) {
        on$2(el, 'touchend', onTouchEnd);
        on$2(el, 'touchcancel', onTouchEnd);
      }
    }
  }
};

function getElement(selector) {
  if (typeof selector === 'string') {
    return document.querySelector(selector);
  }
  return selector();
}
function PortalMixin(_temp) {
  var _ref = _temp === void 0 ? {} : _temp,
    ref = _ref.ref,
    afterPortal = _ref.afterPortal;
  return {
    props: {
      getContainer: [String, Function]
    },
    watch: {
      getContainer: 'portal'
    },
    mounted: function mounted() {
      if (this.getContainer) {
        this.portal();
      }
    },
    methods: {
      portal: function portal() {
        var getContainer = this.getContainer;
        var el = ref ? this.$refs[ref] : this.$el;
        var container;
        if (getContainer) {
          container = getElement(getContainer);
        } else if (this.$parent) {
          container = this.$parent.$el;
        }
        if (container && container !== el.parentNode) {
          container.appendChild(el);
        }
        if (afterPortal) {
          afterPortal.call(this);
        }
      }
    }
  };
}

/**
 * Bind event when mounted or activated
 */
var uid$1 = 0;
function BindEventMixin(handler) {
  var key = "binded_" + uid$1++;
  function bind() {
    if (!this[key]) {
      handler.call(this, on$2, true);
      this[key] = true;
    }
  }
  function unbind() {
    if (this[key]) {
      handler.call(this, off$2, false);
      this[key] = false;
    }
  }
  return {
    mounted: bind,
    activated: bind,
    deactivated: unbind,
    beforeDestroy: unbind
  };
}

var CloseOnPopstateMixin = {
  mixins: [BindEventMixin(function (bind, isBind) {
    this.handlePopstate(isBind && this.closeOnPopstate);
  })],
  props: {
    closeOnPopstate: Boolean
  },
  data: function data() {
    return {
      bindStatus: false
    };
  },
  watch: {
    closeOnPopstate: function closeOnPopstate(val) {
      this.handlePopstate(val);
    }
  },
  methods: {
    onPopstate: function onPopstate() {
      this.close();
      this.shouldReopen = false;
    },
    handlePopstate: function handlePopstate(bind) {
      /* istanbul ignore if */
      if (this.$isServer) {
        return;
      }
      if (this.bindStatus !== bind) {
        this.bindStatus = bind;
        var action = bind ? on$2 : off$2;
        action(window, 'popstate', this.onPopstate);
      }
    }
  }
};

// Context
var popupMixinProps = {
  // Initial rendering animation
  transitionAppear: Boolean,
  // whether to show popup
  value: Boolean,
  // whether to show overlay
  overlay: Boolean,
  // overlay custom style
  overlayStyle: Object,
  // overlay custom class name
  overlayClass: String,
  // whether to close popup when overlay is clicked
  closeOnClickOverlay: Boolean,
  // z-index
  zIndex: [Number, String],
  // prevent body scroll
  lockScroll: {
    type: Boolean,
    default: true
  },
  // whether to lazy render
  lazyRender: {
    type: Boolean,
    default: true
  }
};
function PopupMixin(options) {
  if (options === void 0) {
    options = {};
  }
  return {
    mixins: [TouchMixin, CloseOnPopstateMixin, PortalMixin({
      afterPortal: function afterPortal() {
        if (this.overlay) {
          updateOverlay();
        }
      }
    })],
    provide: function provide() {
      return {
        vanPopup: this
      };
    },
    props: popupMixinProps,
    data: function data() {
      this.onReopenCallback = [];
      return {
        inited: this.value
      };
    },
    computed: {
      shouldRender: function shouldRender() {
        return this.inited || !this.lazyRender;
      }
    },
    watch: {
      value: function value(val) {
        var type = val ? 'open' : 'close';
        this.inited = this.inited || this.value;
        this[type]();
        if (!options.skipToggleEvent) {
          this.$emit(type);
        }
      },
      overlay: 'renderOverlay'
    },
    mounted: function mounted() {
      if (this.value) {
        this.open();
      }
    },
    /* istanbul ignore next */
    activated: function activated() {
      if (this.shouldReopen) {
        this.$emit('input', true);
        this.shouldReopen = false;
      }
    },
    beforeDestroy: function beforeDestroy() {
      removeOverlay(this);
      if (this.opened) {
        this.removeLock();
      }
      if (this.getContainer) {
        removeNode$2(this.$el);
      }
    },
    /* istanbul ignore next */
    deactivated: function deactivated() {
      if (this.value) {
        this.close();
        this.shouldReopen = true;
      }
    },
    methods: {
      open: function open() {
        /* istanbul ignore next */
        if (this.$isServer || this.opened) {
          return;
        } // cover default zIndex

        if (this.zIndex !== undefined) {
          context$1.zIndex = this.zIndex;
        }
        this.opened = true;
        this.renderOverlay();
        this.addLock();
        this.onReopenCallback.forEach(function (callback) {
          callback();
        });
      },
      addLock: function addLock() {
        if (this.lockScroll) {
          on$2(document, 'touchstart', this.touchStart);
          on$2(document, 'touchmove', this.onTouchMove);
          if (!context$1.lockCount) {
            document.body.classList.add('van-overflow-hidden');
          }
          context$1.lockCount++;
        }
      },
      removeLock: function removeLock() {
        if (this.lockScroll && context$1.lockCount) {
          context$1.lockCount--;
          off$2(document, 'touchstart', this.touchStart);
          off$2(document, 'touchmove', this.onTouchMove);
          if (!context$1.lockCount) {
            document.body.classList.remove('van-overflow-hidden');
          }
        }
      },
      close: function close() {
        if (!this.opened) {
          return;
        }
        closeOverlay(this);
        this.opened = false;
        this.removeLock();
        this.$emit('input', false);
      },
      onTouchMove: function onTouchMove(event) {
        this.touchMove(event);
        var direction = this.deltaY > 0 ? '10' : '01';
        var el = getScroller(event.target, this.$el);
        var scrollHeight = el.scrollHeight,
          offsetHeight = el.offsetHeight,
          scrollTop = el.scrollTop;
        var status = '11';
        /* istanbul ignore next */

        if (scrollTop === 0) {
          status = offsetHeight >= scrollHeight ? '00' : '01';
        } else if (scrollTop + offsetHeight >= scrollHeight) {
          status = '10';
        }
        /* istanbul ignore next */

        if (status !== '11' && this.direction === 'vertical' && !(parseInt(status, 2) & parseInt(direction, 2))) {
          preventDefault$1(event, true);
        }
      },
      renderOverlay: function renderOverlay() {
        var _this = this;
        if (this.$isServer || !this.value) {
          return;
        }
        this.$nextTick(function () {
          _this.updateZIndex(_this.overlay ? 1 : 0);
          if (_this.overlay) {
            openOverlay(_this, {
              zIndex: context$1.zIndex++,
              duration: _this.duration,
              className: _this.overlayClass,
              customStyle: _this.overlayStyle
            });
          } else {
            closeOverlay(_this);
          }
        });
      },
      updateZIndex: function updateZIndex(value) {
        if (value === void 0) {
          value = 0;
        }
        this.$el.style.zIndex = ++context$1.zIndex + value;
      },
      onReopen: function onReopen(callback) {
        this.onReopenCallback.push(callback);
      }
    }
  };
}

var _createNamespace$1B = createNamespace('info'),
  createComponent$1F = _createNamespace$1B[0],
  bem$1w = _createNamespace$1B[1];
function Info(h, props, slots, ctx) {
  var dot = props.dot,
    info = props.info;
  var showInfo = isDef$1(info) && info !== '';
  if (!dot && !showInfo) {
    return;
  }
  return h("div", _mergeJSXProps([{
    "class": bem$1w({
      dot: dot
    })
  }, inherit(ctx, true)]), [dot ? '' : props.info]);
}
Info.props = {
  dot: Boolean,
  info: [Number, String]
};
var Info$1 = createComponent$1F(Info);

var _createNamespace$1A = createNamespace('icon'),
  createComponent$1E = _createNamespace$1A[0],
  bem$1v = _createNamespace$1A[1];
function isImage(name) {
  return name ? name.indexOf('/') !== -1 : false;
} // compatible with legacy usage, should be removed in next major version

var LEGACY_MAP = {
  medel: 'medal',
  'medel-o': 'medal-o',
  'calender-o': 'calendar-o'
};
function correctName(name) {
  return name && LEGACY_MAP[name] || name;
}
function Icon$2(h, props, slots, ctx) {
  var _props$badge;
  var name = correctName(props.name);
  var imageIcon = isImage(name);
  return h(props.tag, _mergeJSXProps([{
    "class": [props.classPrefix, imageIcon ? '' : props.classPrefix + "-" + name],
    "style": {
      color: props.color,
      fontSize: addUnit(props.size)
    }
  }, inherit(ctx, true)]), [slots.default && slots.default(), imageIcon && h("img", {
    "class": bem$1v('image'),
    "attrs": {
      "src": name
    }
  }), h(Info$1, {
    "attrs": {
      "dot": props.dot,
      "info": (_props$badge = props.badge) != null ? _props$badge : props.info
    }
  })]);
}
Icon$2.props = {
  dot: Boolean,
  name: String,
  size: [Number, String],
  // @deprecated
  // should be removed in next major version
  info: [Number, String],
  badge: [Number, String],
  color: String,
  tag: {
    type: String,
    default: 'i'
  },
  classPrefix: {
    type: String,
    default: bem$1v()
  }
};
var Icon$3 = createComponent$1E(Icon$2);

var _createNamespace$1z = createNamespace('popup'),
  createComponent$1D = _createNamespace$1z[0],
  bem$1u = _createNamespace$1z[1];
var Popup = createComponent$1D({
  mixins: [PopupMixin()],
  props: {
    round: Boolean,
    duration: [Number, String],
    closeable: Boolean,
    transition: String,
    safeAreaInsetBottom: Boolean,
    closeIcon: {
      type: String,
      default: 'cross'
    },
    closeIconPosition: {
      type: String,
      default: 'top-right'
    },
    position: {
      type: String,
      default: 'center'
    },
    overlay: {
      type: Boolean,
      default: true
    },
    closeOnClickOverlay: {
      type: Boolean,
      default: true
    }
  },
  beforeCreate: function beforeCreate() {
    var _this = this;
    var createEmitter = function createEmitter(eventName) {
      return function (event) {
        return _this.$emit(eventName, event);
      };
    };
    this.onClick = createEmitter('click');
    this.onOpened = createEmitter('opened');
    this.onClosed = createEmitter('closed');
  },
  methods: {
    onClickCloseIcon: function onClickCloseIcon(event) {
      this.$emit('click-close-icon', event);
      this.close();
    }
  },
  render: function render() {
    var _bem;
    var h = arguments[0];
    if (!this.shouldRender) {
      return;
    }
    var round = this.round,
      position = this.position,
      duration = this.duration;
    var isCenter = position === 'center';
    var transitionName = this.transition || (isCenter ? 'van-fade' : "van-popup-slide-" + position);
    var style = {};
    if (isDef$1(duration)) {
      var key = isCenter ? 'animationDuration' : 'transitionDuration';
      style[key] = duration + "s";
    }
    return h("transition", {
      "attrs": {
        "appear": this.transitionAppear,
        "name": transitionName
      },
      "on": {
        "afterEnter": this.onOpened,
        "afterLeave": this.onClosed
      }
    }, [h("div", {
      "directives": [{
        name: "show",
        value: this.value
      }],
      "style": style,
      "class": bem$1u((_bem = {
        round: round
      }, _bem[position] = position, _bem['safe-area-inset-bottom'] = this.safeAreaInsetBottom, _bem)),
      "on": {
        "click": this.onClick
      }
    }, [this.slots(), this.closeable && h(Icon$3, {
      "attrs": {
        "role": "button",
        "tabindex": "0",
        "name": this.closeIcon
      },
      "class": bem$1u('close-icon', this.closeIconPosition),
      "on": {
        "click": this.onClickCloseIcon
      }
    })])]);
  }
});

var _createNamespace$1y = createNamespace('loading'),
  createComponent$1C = _createNamespace$1y[0],
  bem$1t = _createNamespace$1y[1];
function LoadingIcon(h, props) {
  if (props.type === 'spinner') {
    var Spin = [];
    for (var i = 0; i < 12; i++) {
      Spin.push(h("i"));
    }
    return Spin;
  }
  return h("svg", {
    "class": bem$1t('circular'),
    "attrs": {
      "viewBox": "25 25 50 50"
    }
  }, [h("circle", {
    "attrs": {
      "cx": "50",
      "cy": "50",
      "r": "20",
      "fill": "none"
    }
  })]);
}
function LoadingText(h, props, slots) {
  if (slots.default) {
    var _props$textColor;
    var style = {
      fontSize: addUnit(props.textSize),
      color: (_props$textColor = props.textColor) != null ? _props$textColor : props.color
    };
    return h("span", {
      "class": bem$1t('text'),
      "style": style
    }, [slots.default()]);
  }
}
function Loading(h, props, slots, ctx) {
  var color = props.color,
    size = props.size,
    type = props.type;
  var style = {
    color: color
  };
  if (size) {
    var iconSize = addUnit(size);
    style.width = iconSize;
    style.height = iconSize;
  }
  return h("div", _mergeJSXProps([{
    "class": bem$1t([type, {
      vertical: props.vertical
    }])
  }, inherit(ctx, true)]), [h("span", {
    "class": bem$1t('spinner', type),
    "style": style
  }, [LoadingIcon(h, props)]), LoadingText(h, props, slots)]);
}
Loading.props = {
  color: String,
  size: [Number, String],
  vertical: Boolean,
  textSize: [Number, String],
  textColor: String,
  type: {
    type: String,
    default: 'circular'
  }
};
var Loading$1 = createComponent$1C(Loading);

var _createNamespace$1x = createNamespace('action-sheet'),
  createComponent$1B = _createNamespace$1x[0],
  bem$1s = _createNamespace$1x[1];
function ActionSheet(h, props, slots, ctx) {
  var title = props.title,
    cancelText = props.cancelText,
    closeable = props.closeable;
  function onCancel() {
    emit(ctx, 'input', false);
    emit(ctx, 'cancel');
  }
  function Header() {
    if (title) {
      return h("div", {
        "class": bem$1s('header')
      }, [title, closeable && h(Icon$3, {
        "attrs": {
          "name": props.closeIcon
        },
        "class": bem$1s('close'),
        "on": {
          "click": onCancel
        }
      })]);
    }
  }
  function Option(item, index) {
    var disabled = item.disabled,
      loading = item.loading,
      callback = item.callback;
    function onClickOption(event) {
      event.stopPropagation();
      if (disabled || loading) {
        return;
      }
      if (callback) {
        callback(item);
      }
      if (props.closeOnClickAction) {
        emit(ctx, 'input', false);
      }
      Vue.nextTick(function () {
        emit(ctx, 'select', item, index);
      });
    }
    function OptionContent() {
      if (loading) {
        return h(Loading$1, {
          "class": bem$1s('loading-icon')
        });
      }
      return [h("span", {
        "class": bem$1s('name')
      }, [item.name]), item.subname && h("div", {
        "class": bem$1s('subname')
      }, [item.subname])];
    }
    return h("button", {
      "attrs": {
        "type": "button"
      },
      "class": [bem$1s('item', {
        disabled: disabled,
        loading: loading
      }), item.className],
      "style": {
        color: item.color
      },
      "on": {
        "click": onClickOption
      }
    }, [OptionContent()]);
  }
  function CancelText() {
    if (cancelText) {
      return [h("div", {
        "class": bem$1s('gap')
      }), h("button", {
        "attrs": {
          "type": "button"
        },
        "class": bem$1s('cancel'),
        "on": {
          "click": onCancel
        }
      }, [cancelText])];
    }
  }
  function Description() {
    var description = (slots.description == null ? void 0 : slots.description()) || props.description;
    if (description) {
      return h("div", {
        "class": bem$1s('description')
      }, [description]);
    }
  }
  return h(Popup, _mergeJSXProps([{
    "class": bem$1s(),
    "attrs": {
      "position": "bottom",
      "round": props.round,
      "value": props.value,
      "overlay": props.overlay,
      "duration": props.duration,
      "lazyRender": props.lazyRender,
      "lockScroll": props.lockScroll,
      "getContainer": props.getContainer,
      "closeOnPopstate": props.closeOnPopstate,
      "closeOnClickOverlay": props.closeOnClickOverlay,
      "safeAreaInsetBottom": props.safeAreaInsetBottom
    }
  }, inherit(ctx, true)]), [Header(), Description(), h("div", {
    "class": bem$1s('content')
  }, [props.actions && props.actions.map(Option), slots.default == null ? void 0 : slots.default()]), CancelText()]);
}
ActionSheet.props = _extends$1({}, popupMixinProps, {
  title: String,
  actions: Array,
  duration: [Number, String],
  cancelText: String,
  description: String,
  getContainer: [String, Function],
  closeOnPopstate: Boolean,
  closeOnClickAction: Boolean,
  round: {
    type: Boolean,
    default: true
  },
  closeable: {
    type: Boolean,
    default: true
  },
  closeIcon: {
    type: String,
    default: 'cross'
  },
  safeAreaInsetBottom: {
    type: Boolean,
    default: true
  },
  overlay: {
    type: Boolean,
    default: true
  },
  closeOnClickOverlay: {
    type: Boolean,
    default: true
  }
});
var ActionSheet$1 = createComponent$1B(ActionSheet);

function isMobile(value) {
  value = value.replace(/[^-|\d]/g, '');
  return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
}

var DEFAULT_ITEM_HEIGHT = 44;
var pickerProps = {
  title: String,
  loading: Boolean,
  readonly: Boolean,
  itemHeight: [Number, String],
  showToolbar: Boolean,
  cancelButtonText: String,
  confirmButtonText: String,
  allowHtml: {
    type: Boolean,
    default: true
  },
  visibleItemCount: {
    type: [Number, String],
    default: 6
  },
  swipeDuration: {
    type: [Number, String],
    default: 1000
  }
};

// color
var RED = '#ee0a24'; // border

var BORDER = 'van-hairline';
var BORDER_TOP = BORDER + "--top";
var BORDER_LEFT = BORDER + "--left";
var BORDER_BOTTOM = BORDER + "--bottom";
var BORDER_SURROUND = BORDER + "--surround";
var BORDER_TOP_BOTTOM = BORDER + "--top-bottom";
var BORDER_UNSET_TOP_BOTTOM = BORDER + "-unset--top-bottom";

function deepClone(obj) {
  if (!isDef$1(obj)) {
    return obj;
  }
  if (Array.isArray(obj)) {
    return obj.map(function (item) {
      return deepClone(item);
    });
  }
  if (typeof obj === 'object') {
    var to = {};
    Object.keys(obj).forEach(function (key) {
      to[key] = deepClone(obj[key]);
    });
    return to;
  }
  return obj;
}

function range$1(num, min, max) {
  return Math.min(Math.max(num, min), max);
}
function trimExtraChar(value, _char, regExp) {
  var index = value.indexOf(_char);
  var prefix = '';
  if (index === -1) {
    return value;
  }
  if (_char === '-' && index !== 0) {
    return value.slice(0, index);
  }
  if (_char === '.' && value.match(/^(\.|-\.)/)) {
    prefix = index ? '-0' : '0';
  }
  return prefix + value.slice(0, index + 1) + value.slice(index).replace(regExp, '');
}
function formatNumber(value, allowDot, allowMinus) {
  if (allowDot === void 0) {
    allowDot = true;
  }
  if (allowMinus === void 0) {
    allowMinus = true;
  }
  if (allowDot) {
    value = trimExtraChar(value, '.', /\./g);
  } else {
    value = value.split('.')[0];
  }
  if (allowMinus) {
    value = trimExtraChar(value, '-', /-/g);
  } else {
    value = value.replace(/-/, '');
  }
  var regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
  return value.replace(regExp, '');
} // add num and avoid float number

function addNumber(num1, num2) {
  var cardinal = Math.pow(10, 10);
  return Math.round((num1 + num2) * cardinal) / cardinal;
}

var DEFAULT_DURATION = 200; // 惯性滑动思路:
// 在手指离开屏幕时，如果和上一次 move 时的间隔小于 `MOMENTUM_LIMIT_TIME` 且 move
// 距离大于 `MOMENTUM_LIMIT_DISTANCE` 时，执行惯性滑动

var MOMENTUM_LIMIT_TIME = 300;
var MOMENTUM_LIMIT_DISTANCE = 15;
var _createNamespace$1w = createNamespace('picker-column'),
  createComponent$1A = _createNamespace$1w[0],
  bem$1r = _createNamespace$1w[1];
function getElementTranslateY(element) {
  var style = window.getComputedStyle(element);
  var transform = style.transform || style.webkitTransform;
  var translateY = transform.slice(7, transform.length - 1).split(', ')[5];
  return Number(translateY);
}
function isOptionDisabled(option) {
  return isObject$6(option) && option.disabled;
} // use standard WheelEvent:
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent

var supportMousewheel = inBrowser$1 && 'onwheel' in window;
var mousewheelTimer = null;
var PickerColumn = createComponent$1A({
  mixins: [TouchMixin],
  props: {
    valueKey: String,
    readonly: Boolean,
    allowHtml: Boolean,
    className: String,
    itemHeight: Number,
    defaultIndex: Number,
    swipeDuration: [Number, String],
    visibleItemCount: [Number, String],
    initialOptions: {
      type: Array,
      default: function _default() {
        return [];
      }
    }
  },
  data: function data() {
    return {
      offset: 0,
      duration: 0,
      options: deepClone(this.initialOptions),
      currentIndex: this.defaultIndex
    };
  },
  created: function created() {
    if (this.$parent.children) {
      this.$parent.children.push(this);
    }
    this.setIndex(this.currentIndex);
  },
  mounted: function mounted() {
    this.bindTouchEvent(this.$el);
    if (supportMousewheel) {
      on$2(this.$el, 'wheel', this.onMouseWheel, false);
    }
  },
  destroyed: function destroyed() {
    var children = this.$parent.children;
    if (children) {
      children.splice(children.indexOf(this), 1);
    }
    if (supportMousewheel) {
      off$2(this.$el, 'wheel');
    }
  },
  watch: {
    initialOptions: 'setOptions',
    defaultIndex: function defaultIndex(val) {
      this.setIndex(val);
    }
  },
  computed: {
    count: function count() {
      return this.options.length;
    },
    baseOffset: function baseOffset() {
      return this.itemHeight * (this.visibleItemCount - 1) / 2;
    }
  },
  methods: {
    setOptions: function setOptions(options) {
      if (JSON.stringify(options) !== JSON.stringify(this.options)) {
        this.options = deepClone(options);
        this.setIndex(this.defaultIndex);
      }
    },
    onTouchStart: function onTouchStart(event) {
      if (this.readonly) {
        return;
      }
      this.touchStart(event);
      if (this.moving) {
        var translateY = getElementTranslateY(this.$refs.wrapper);
        this.offset = Math.min(0, translateY - this.baseOffset);
        this.startOffset = this.offset;
      } else {
        this.startOffset = this.offset;
      }
      this.duration = 0;
      this.transitionEndTrigger = null;
      this.touchStartTime = Date.now();
      this.momentumOffset = this.startOffset;
    },
    onTouchMove: function onTouchMove(event) {
      if (this.readonly) {
        return;
      }
      this.touchMove(event);
      if (this.direction === 'vertical') {
        this.moving = true;
        preventDefault$1(event, true);
      }
      this.offset = range$1(this.startOffset + this.deltaY, -(this.count * this.itemHeight), this.itemHeight);
      var now = Date.now();
      if (now - this.touchStartTime > MOMENTUM_LIMIT_TIME) {
        this.touchStartTime = now;
        this.momentumOffset = this.offset;
      }
    },
    onTouchEnd: function onTouchEnd() {
      var _this = this;
      if (this.readonly) {
        return;
      }
      var distance = this.offset - this.momentumOffset;
      var duration = Date.now() - this.touchStartTime;
      var allowMomentum = duration < MOMENTUM_LIMIT_TIME && Math.abs(distance) > MOMENTUM_LIMIT_DISTANCE;
      if (allowMomentum) {
        this.momentum(distance, duration);
        return;
      }
      var index = this.getIndexByOffset(this.offset);
      this.duration = DEFAULT_DURATION;
      this.setIndex(index, true); // compatible with desktop scenario
      // use setTimeout to skip the click event Emitted after touchstart

      setTimeout(function () {
        _this.moving = false;
      }, 0);
    },
    onMouseWheel: function onMouseWheel(event) {
      var _this2 = this;
      if (this.readonly) {
        return;
      }
      preventDefault$1(event, true); // simply combine touchstart and touchmove

      var translateY = getElementTranslateY(this.$refs.wrapper);
      this.startOffset = Math.min(0, translateY - this.baseOffset);
      this.momentumOffset = this.startOffset;
      this.transitionEndTrigger = null; // directly use deltaY, see https://caniuse.com/?search=deltaY
      // use deltaY to detect direction for not special setting device
      // https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event

      var deltaY = event.deltaY;
      if (this.startOffset === 0 && deltaY < 0) {
        return;
      } // Calculate the offset based on itemHeight

      var itemOffset = this.itemHeight * (deltaY > 0 ? -1 : 1);
      this.offset = range$1(this.startOffset + itemOffset, -(this.count * this.itemHeight), this.itemHeight);
      if (mousewheelTimer) {
        clearTimeout(mousewheelTimer);
      }
      mousewheelTimer = setTimeout(function () {
        _this2.onTouchEnd();
        _this2.touchStartTime = 0;
      }, MOMENTUM_LIMIT_TIME);
    },
    onTransitionEnd: function onTransitionEnd() {
      this.stopMomentum();
    },
    onClickItem: function onClickItem(index) {
      if (this.moving || this.readonly) {
        return;
      }
      this.transitionEndTrigger = null;
      this.duration = DEFAULT_DURATION;
      this.setIndex(index, true);
    },
    adjustIndex: function adjustIndex(index) {
      index = range$1(index, 0, this.count);
      for (var i = index; i < this.count; i++) {
        if (!isOptionDisabled(this.options[i])) return i;
      }
      for (var _i = index - 1; _i >= 0; _i--) {
        if (!isOptionDisabled(this.options[_i])) return _i;
      }
    },
    getOptionText: function getOptionText(option) {
      if (isObject$6(option) && this.valueKey in option) {
        return option[this.valueKey];
      }
      return option;
    },
    setIndex: function setIndex(index, emitChange) {
      var _this3 = this;
      index = this.adjustIndex(index) || 0;
      var offset = -index * this.itemHeight;
      var trigger = function trigger() {
        if (index !== _this3.currentIndex) {
          _this3.currentIndex = index;
          if (emitChange) {
            _this3.$emit('change', index);
          }
        }
      }; // trigger the change event after transitionend when moving

      if (this.moving && offset !== this.offset) {
        this.transitionEndTrigger = trigger;
      } else {
        trigger();
      }
      this.offset = offset;
    },
    setValue: function setValue(value) {
      var options = this.options;
      for (var i = 0; i < options.length; i++) {
        if (this.getOptionText(options[i]) === value) {
          return this.setIndex(i);
        }
      }
    },
    getValue: function getValue() {
      return this.options[this.currentIndex];
    },
    getIndexByOffset: function getIndexByOffset(offset) {
      return range$1(Math.round(-offset / this.itemHeight), 0, this.count - 1);
    },
    momentum: function momentum(distance, duration) {
      var speed = Math.abs(distance / duration);
      distance = this.offset + speed / 0.003 * (distance < 0 ? -1 : 1);
      var index = this.getIndexByOffset(distance);
      this.duration = +this.swipeDuration;
      this.setIndex(index, true);
    },
    stopMomentum: function stopMomentum() {
      this.moving = false;
      this.duration = 0;
      if (this.transitionEndTrigger) {
        this.transitionEndTrigger();
        this.transitionEndTrigger = null;
      }
    },
    genOptions: function genOptions() {
      var _this4 = this;
      var h = this.$createElement;
      var optionStyle = {
        height: this.itemHeight + "px"
      };
      return this.options.map(function (option, index) {
        var _domProps;
        var text = _this4.getOptionText(option);
        var disabled = isOptionDisabled(option);
        var data = {
          style: optionStyle,
          attrs: {
            role: 'button',
            tabindex: disabled ? -1 : 0
          },
          class: [bem$1r('item', {
            disabled: disabled,
            selected: index === _this4.currentIndex
          })],
          on: {
            click: function click() {
              _this4.onClickItem(index);
            }
          }
        };
        var childData = {
          class: 'van-ellipsis',
          domProps: (_domProps = {}, _domProps[_this4.allowHtml ? 'innerHTML' : 'textContent'] = text, _domProps)
        };
        return h("li", _mergeJSXProps([{}, data]), [_this4.slots('option', option) || h("div", _mergeJSXProps([{}, childData]))]);
      });
    }
  },
  render: function render() {
    var h = arguments[0];
    var wrapperStyle = {
      transform: "translate3d(0, " + (this.offset + this.baseOffset) + "px, 0)",
      transitionDuration: this.duration + "ms",
      transitionProperty: this.duration ? 'all' : 'none'
    };
    return h("div", {
      "class": [bem$1r(), this.className]
    }, [h("ul", {
      "ref": "wrapper",
      "style": wrapperStyle,
      "class": bem$1r('wrapper'),
      "on": {
        "transitionend": this.onTransitionEnd
      }
    }, [this.genOptions()])]);
  }
});

var _createNamespace$1v = createNamespace('picker'),
  createComponent$1z = _createNamespace$1v[0],
  bem$1q = _createNamespace$1v[1],
  t$r = _createNamespace$1v[2];
var Picker = createComponent$1z({
  props: _extends$1({}, pickerProps, {
    defaultIndex: {
      type: [Number, String],
      default: 0
    },
    columns: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    toolbarPosition: {
      type: String,
      default: 'top'
    },
    valueKey: {
      type: String,
      default: 'text'
    }
  }),
  data: function data() {
    return {
      children: [],
      formattedColumns: []
    };
  },
  computed: {
    itemPxHeight: function itemPxHeight() {
      return this.itemHeight ? unitToPx(this.itemHeight) : DEFAULT_ITEM_HEIGHT;
    },
    dataType: function dataType() {
      var columns = this.columns;
      var firstColumn = columns[0] || {};
      if (firstColumn.children) {
        return 'cascade';
      }
      if (firstColumn.values) {
        return 'object';
      }
      return 'text';
    }
  },
  watch: {
    columns: {
      handler: 'format',
      immediate: true
    }
  },
  methods: {
    format: function format() {
      var columns = this.columns,
        dataType = this.dataType;
      if (dataType === 'text') {
        this.formattedColumns = [{
          values: columns
        }];
      } else if (dataType === 'cascade') {
        this.formatCascade();
      } else {
        this.formattedColumns = columns;
      }
    },
    formatCascade: function formatCascade() {
      var formatted = [];
      var cursor = {
        children: this.columns
      };
      while (cursor && cursor.children) {
        var _cursor$defaultIndex;
        var _cursor = cursor,
          children = _cursor.children;
        var defaultIndex = (_cursor$defaultIndex = cursor.defaultIndex) != null ? _cursor$defaultIndex : +this.defaultIndex;
        while (children[defaultIndex] && children[defaultIndex].disabled) {
          if (defaultIndex < children.length - 1) {
            defaultIndex++;
          } else {
            defaultIndex = 0;
            break;
          }
        }
        formatted.push({
          values: cursor.children,
          className: cursor.className,
          defaultIndex: defaultIndex
        });
        cursor = children[defaultIndex];
      }
      this.formattedColumns = formatted;
    },
    emit: function emit(event) {
      var _this = this;
      if (this.dataType === 'text') {
        this.$emit(event, this.getColumnValue(0), this.getColumnIndex(0));
      } else {
        var values = this.getValues(); // compatible with old version of wrong parameters
        // should be removed in next major version
        // see: https://github.com/vant-ui/vant/issues/5905

        if (this.dataType === 'cascade') {
          values = values.map(function (item) {
            return item[_this.valueKey];
          });
        }
        this.$emit(event, values, this.getIndexes());
      }
    },
    onCascadeChange: function onCascadeChange(columnIndex) {
      var cursor = {
        children: this.columns
      };
      var indexes = this.getIndexes();
      for (var i = 0; i <= columnIndex; i++) {
        cursor = cursor.children[indexes[i]];
      }
      while (cursor && cursor.children) {
        columnIndex++;
        this.setColumnValues(columnIndex, cursor.children);
        cursor = cursor.children[cursor.defaultIndex || 0];
      }
    },
    onChange: function onChange(columnIndex) {
      var _this2 = this;
      if (this.dataType === 'cascade') {
        this.onCascadeChange(columnIndex);
      }
      if (this.dataType === 'text') {
        this.$emit('change', this, this.getColumnValue(0), this.getColumnIndex(0));
      } else {
        var values = this.getValues(); // compatible with old version of wrong parameters
        // should be removed in next major version
        // see: https://github.com/vant-ui/vant/issues/5905

        if (this.dataType === 'cascade') {
          values = values.map(function (item) {
            return item[_this2.valueKey];
          });
        }
        this.$emit('change', this, values, columnIndex);
      }
    },
    // get column instance by index
    getColumn: function getColumn(index) {
      return this.children[index];
    },
    // @exposed-api
    // get column value by index
    getColumnValue: function getColumnValue(index) {
      var column = this.getColumn(index);
      return column && column.getValue();
    },
    // @exposed-api
    // set column value by index
    setColumnValue: function setColumnValue(index, value) {
      var column = this.getColumn(index);
      if (column) {
        column.setValue(value);
        if (this.dataType === 'cascade') {
          this.onCascadeChange(index);
        }
      }
    },
    // @exposed-api
    // get column option index by column index
    getColumnIndex: function getColumnIndex(columnIndex) {
      return (this.getColumn(columnIndex) || {}).currentIndex;
    },
    // @exposed-api
    // set column option index by column index
    setColumnIndex: function setColumnIndex(columnIndex, optionIndex) {
      var column = this.getColumn(columnIndex);
      if (column) {
        column.setIndex(optionIndex);
        if (this.dataType === 'cascade') {
          this.onCascadeChange(columnIndex);
        }
      }
    },
    // @exposed-api
    // get options of column by index
    getColumnValues: function getColumnValues(index) {
      return (this.children[index] || {}).options;
    },
    // @exposed-api
    // set options of column by index
    setColumnValues: function setColumnValues(index, options) {
      var column = this.children[index];
      if (column) {
        column.setOptions(options);
      }
    },
    // @exposed-api
    // get values of all columns
    getValues: function getValues() {
      return this.children.map(function (child) {
        return child.getValue();
      });
    },
    // @exposed-api
    // set values of all columns
    setValues: function setValues(values) {
      var _this3 = this;
      values.forEach(function (value, index) {
        _this3.setColumnValue(index, value);
      });
    },
    // @exposed-api
    // get indexes of all columns
    getIndexes: function getIndexes() {
      return this.children.map(function (child) {
        return child.currentIndex;
      });
    },
    // @exposed-api
    // set indexes of all columns
    setIndexes: function setIndexes(indexes) {
      var _this4 = this;
      indexes.forEach(function (optionIndex, columnIndex) {
        _this4.setColumnIndex(columnIndex, optionIndex);
      });
    },
    // @exposed-api
    confirm: function confirm() {
      this.children.forEach(function (child) {
        return child.stopMomentum();
      });
      this.emit('confirm');
    },
    cancel: function cancel() {
      this.emit('cancel');
    },
    genTitle: function genTitle() {
      var h = this.$createElement;
      var titleSlot = this.slots('title');
      if (titleSlot) {
        return titleSlot;
      }
      if (this.title) {
        return h("div", {
          "class": ['van-ellipsis', bem$1q('title')]
        }, [this.title]);
      }
    },
    genCancel: function genCancel() {
      var h = this.$createElement;
      return h("button", {
        "attrs": {
          "type": "button"
        },
        "class": bem$1q('cancel'),
        "on": {
          "click": this.cancel
        }
      }, [this.slots('cancel') || this.cancelButtonText || t$r('cancel')]);
    },
    genConfirm: function genConfirm() {
      var h = this.$createElement;
      return h("button", {
        "attrs": {
          "type": "button"
        },
        "class": bem$1q('confirm'),
        "on": {
          "click": this.confirm
        }
      }, [this.slots('confirm') || this.confirmButtonText || t$r('confirm')]);
    },
    genToolbar: function genToolbar() {
      var h = this.$createElement;
      if (this.showToolbar) {
        return h("div", {
          "class": bem$1q('toolbar')
        }, [this.slots() || [this.genCancel(), this.genTitle(), this.genConfirm()]]);
      }
    },
    genColumns: function genColumns() {
      var h = this.$createElement;
      var itemPxHeight = this.itemPxHeight;
      var wrapHeight = itemPxHeight * this.visibleItemCount;
      var frameStyle = {
        height: itemPxHeight + "px"
      };
      var columnsStyle = {
        height: wrapHeight + "px"
      };
      var maskStyle = {
        backgroundSize: "100% " + (wrapHeight - itemPxHeight) / 2 + "px"
      };
      return h("div", {
        "class": bem$1q('columns'),
        "style": columnsStyle,
        "on": {
          "touchmove": preventDefault$1
        }
      }, [this.genColumnItems(), h("div", {
        "class": bem$1q('mask'),
        "style": maskStyle
      }), h("div", {
        "class": [BORDER_UNSET_TOP_BOTTOM, bem$1q('frame')],
        "style": frameStyle
      })]);
    },
    genColumnItems: function genColumnItems() {
      var _this5 = this;
      var h = this.$createElement;
      return this.formattedColumns.map(function (item, columnIndex) {
        var _item$defaultIndex;
        return h(PickerColumn, {
          "attrs": {
            "readonly": _this5.readonly,
            "valueKey": _this5.valueKey,
            "allowHtml": _this5.allowHtml,
            "className": item.className,
            "itemHeight": _this5.itemPxHeight,
            "defaultIndex": (_item$defaultIndex = item.defaultIndex) != null ? _item$defaultIndex : +_this5.defaultIndex,
            "swipeDuration": _this5.swipeDuration,
            "visibleItemCount": _this5.visibleItemCount,
            "initialOptions": item.values
          },
          "scopedSlots": {
            option: _this5.$scopedSlots.option
          },
          "on": {
            "change": function change() {
              _this5.onChange(columnIndex);
            }
          }
        });
      });
    }
  },
  render: function render(h) {
    return h("div", {
      "class": bem$1q()
    }, [this.toolbarPosition === 'top' ? this.genToolbar() : h(), this.loading ? h(Loading$1, {
      "class": bem$1q('loading')
    }) : h(), this.slots('columns-top'), this.genColumns(), this.slots('columns-bottom'), this.toolbarPosition === 'bottom' ? this.genToolbar() : h()]);
  }
});

var _createNamespace$1u = createNamespace('area'),
  createComponent$1y = _createNamespace$1u[0],
  bem$1p = _createNamespace$1u[1];
var PLACEHOLDER_CODE = '000000';
function isOverseaCode(code) {
  return code[0] === '9';
}
function pickSlots(instance, keys) {
  var $slots = instance.$slots,
    $scopedSlots = instance.$scopedSlots;
  var scopedSlots = {};
  keys.forEach(function (key) {
    if ($scopedSlots[key]) {
      scopedSlots[key] = $scopedSlots[key];
    } else if ($slots[key]) {
      scopedSlots[key] = function () {
        return $slots[key];
      };
    }
  });
  return scopedSlots;
}
var Area = createComponent$1y({
  props: _extends$1({}, pickerProps, {
    value: String,
    areaList: {
      type: Object,
      default: function _default() {
        return {};
      }
    },
    columnsNum: {
      type: [Number, String],
      default: 3
    },
    isOverseaCode: {
      type: Function,
      default: isOverseaCode
    },
    columnsPlaceholder: {
      type: Array,
      default: function _default() {
        return [];
      }
    }
  }),
  data: function data() {
    return {
      code: this.value,
      columns: [{
        values: []
      }, {
        values: []
      }, {
        values: []
      }]
    };
  },
  computed: {
    province: function province() {
      return this.areaList.province_list || {};
    },
    city: function city() {
      return this.areaList.city_list || {};
    },
    county: function county() {
      return this.areaList.county_list || {};
    },
    displayColumns: function displayColumns() {
      return this.columns.slice(0, +this.columnsNum);
    },
    placeholderMap: function placeholderMap() {
      return {
        province: this.columnsPlaceholder[0] || '',
        city: this.columnsPlaceholder[1] || '',
        county: this.columnsPlaceholder[2] || ''
      };
    }
  },
  watch: {
    value: function value(val) {
      this.code = val;
      this.setValues();
    },
    areaList: {
      deep: true,
      handler: 'setValues'
    },
    columnsNum: function columnsNum() {
      var _this = this;
      this.$nextTick(function () {
        _this.setValues();
      });
    }
  },
  mounted: function mounted() {
    this.setValues();
  },
  methods: {
    // get list by code
    getList: function getList(type, code) {
      var result = [];
      if (type !== 'province' && !code) {
        return result;
      }
      var list = this[type];
      result = Object.keys(list).map(function (listCode) {
        return {
          code: listCode,
          name: list[listCode]
        };
      });
      if (code) {
        // oversea code
        if (this.isOverseaCode(code) && type === 'city') {
          code = '9';
        }
        result = result.filter(function (item) {
          return item.code.indexOf(code) === 0;
        });
      }
      if (this.placeholderMap[type] && result.length) {
        // set columns placeholder
        var codeFill = '';
        if (type === 'city') {
          codeFill = PLACEHOLDER_CODE.slice(2, 4);
        } else if (type === 'county') {
          codeFill = PLACEHOLDER_CODE.slice(4, 6);
        }
        result.unshift({
          code: "" + code + codeFill,
          name: this.placeholderMap[type]
        });
      }
      return result;
    },
    // get index by code
    getIndex: function getIndex(type, code) {
      var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
      var list = this.getList(type, code.slice(0, compareNum - 2)); // oversea code

      if (this.isOverseaCode(code) && type === 'province') {
        compareNum = 1;
      }
      code = code.slice(0, compareNum);
      for (var i = 0; i < list.length; i++) {
        if (list[i].code.slice(0, compareNum) === code) {
          return i;
        }
      }
      return 0;
    },
    // parse output columns data
    parseOutputValues: function parseOutputValues(values) {
      var _this2 = this;
      return values.map(function (value, index) {
        // save undefined value
        if (!value) return value;
        value = JSON.parse(JSON.stringify(value));
        if (!value.code || value.name === _this2.columnsPlaceholder[index]) {
          value.code = '';
          value.name = '';
        }
        return value;
      });
    },
    onChange: function onChange(picker, values, index) {
      this.code = values[index].code;
      this.setValues();
      var parsedValues = this.parseOutputValues(picker.getValues());
      this.$emit('change', picker, parsedValues, index);
    },
    onConfirm: function onConfirm(values, index) {
      values = this.parseOutputValues(values);
      this.setValues();
      this.$emit('confirm', values, index);
    },
    getDefaultCode: function getDefaultCode() {
      if (this.columnsPlaceholder.length) {
        return PLACEHOLDER_CODE;
      }
      var countyCodes = Object.keys(this.county);
      if (countyCodes[0]) {
        return countyCodes[0];
      }
      var cityCodes = Object.keys(this.city);
      if (cityCodes[0]) {
        return cityCodes[0];
      }
      return '';
    },
    setValues: function setValues() {
      var code = this.code;
      if (!code) {
        code = this.getDefaultCode();
      }
      var picker = this.$refs.picker;
      var province = this.getList('province');
      var city = this.getList('city', code.slice(0, 2));
      if (!picker) {
        return;
      }
      picker.setColumnValues(0, province);
      picker.setColumnValues(1, city);
      if (city.length && code.slice(2, 4) === '00' && !this.isOverseaCode(code)) {
        code = city[0].code;
      }
      picker.setColumnValues(2, this.getList('county', code.slice(0, 4)));
      picker.setIndexes([this.getIndex('province', code), this.getIndex('city', code), this.getIndex('county', code)]);
    },
    getValues: function getValues() {
      var picker = this.$refs.picker;
      var getValues = picker ? picker.getValues().filter(function (value) {
        return !!value;
      }) : [];
      getValues = this.parseOutputValues(getValues);
      return getValues;
    },
    getArea: function getArea() {
      var values = this.getValues();
      var area = {
        code: '',
        country: '',
        province: '',
        city: '',
        county: ''
      };
      if (!values.length) {
        return area;
      }
      var names = values.map(function (item) {
        return item.name;
      });
      var validValues = values.filter(function (value) {
        return !!value.code;
      });
      area.code = validValues.length ? validValues[validValues.length - 1].code : '';
      if (this.isOverseaCode(area.code)) {
        area.country = names[1] || '';
        area.province = names[2] || '';
      } else {
        area.province = names[0] || '';
        area.city = names[1] || '';
        area.county = names[2] || '';
      }
      return area;
    },
    // @exposed-api
    reset: function reset(code) {
      this.code = code || '';
      this.setValues();
    }
  },
  render: function render() {
    var h = arguments[0];
    var on = _extends$1({}, this.$listeners, {
      change: this.onChange,
      confirm: this.onConfirm
    });
    return h(Picker, {
      "ref": "picker",
      "class": bem$1p(),
      "attrs": {
        "showToolbar": true,
        "valueKey": "name",
        "title": this.title,
        "columns": this.displayColumns,
        "loading": this.loading,
        "readonly": this.readonly,
        "itemHeight": this.itemHeight,
        "swipeDuration": this.swipeDuration,
        "visibleItemCount": this.visibleItemCount,
        "cancelButtonText": this.cancelButtonText,
        "confirmButtonText": this.confirmButtonText
      },
      "scopedSlots": pickSlots(this, ['title', 'columns-top', 'columns-bottom']),
      "on": _extends$1({}, on)
    });
  }
});

/**
 * Vue Router support
 */
function isRedundantNavigation(err) {
  return err.name === 'NavigationDuplicated' ||
  // compatible with vue-router@3.3
  err.message && err.message.indexOf('redundant navigation') !== -1;
}
function route(router, config) {
  var to = config.to,
    url = config.url,
    replace = config.replace;
  if (to && router) {
    var promise = router[replace ? 'replace' : 'push'](to);
    /* istanbul ignore else */

    if (promise && promise.catch) {
      promise.catch(function (err) {
        if (err && !isRedundantNavigation(err)) {
          throw err;
        }
      });
    }
  } else if (url) {
    replace ? location.replace(url) : location.href = url;
  }
}
function functionalRoute(context) {
  route(context.parent && context.parent.$router, context.props);
}
var routeProps = {
  url: String,
  replace: Boolean,
  to: [String, Object]
};

var cellProps = {
  icon: String,
  size: String,
  center: Boolean,
  isLink: Boolean,
  required: Boolean,
  iconPrefix: String,
  titleStyle: null,
  titleClass: null,
  valueClass: null,
  labelClass: null,
  title: [Number, String],
  value: [Number, String],
  label: [Number, String],
  arrowDirection: String,
  border: {
    type: Boolean,
    default: true
  },
  clickable: {
    type: Boolean,
    default: null
  }
};

var _createNamespace$1t = createNamespace('cell'),
  createComponent$1x = _createNamespace$1t[0],
  bem$1o = _createNamespace$1t[1];
function Cell(h, props, slots, ctx) {
  var _props$clickable;
  var icon = props.icon,
    size = props.size,
    title = props.title,
    label = props.label,
    value = props.value,
    isLink = props.isLink;
  var showTitle = slots.title || isDef$1(title);
  function Label() {
    var showLabel = slots.label || isDef$1(label);
    if (showLabel) {
      return h("div", {
        "class": [bem$1o('label'), props.labelClass]
      }, [slots.label ? slots.label() : label]);
    }
  }
  function Title() {
    if (showTitle) {
      return h("div", {
        "class": [bem$1o('title'), props.titleClass],
        "style": props.titleStyle
      }, [slots.title ? slots.title() : h("span", [title]), Label()]);
    }
  }
  function Value() {
    var showValue = slots.default || isDef$1(value);
    if (showValue) {
      return h("div", {
        "class": [bem$1o('value', {
          alone: !showTitle
        }), props.valueClass]
      }, [slots.default ? slots.default() : h("span", [value])]);
    }
  }
  function LeftIcon() {
    if (slots.icon) {
      return slots.icon();
    }
    if (icon) {
      return h(Icon$3, {
        "class": bem$1o('left-icon'),
        "attrs": {
          "name": icon,
          "classPrefix": props.iconPrefix
        }
      });
    }
  }
  function RightIcon() {
    var rightIconSlot = slots['right-icon'];
    if (rightIconSlot) {
      return rightIconSlot();
    }
    if (isLink) {
      var arrowDirection = props.arrowDirection;
      return h(Icon$3, {
        "class": bem$1o('right-icon'),
        "attrs": {
          "name": arrowDirection ? "arrow-" + arrowDirection : 'arrow'
        }
      });
    }
  }
  function onClick(event) {
    emit(ctx, 'click', event);
    functionalRoute(ctx);
  }
  var clickable = (_props$clickable = props.clickable) != null ? _props$clickable : isLink;
  var classes = {
    clickable: clickable,
    center: props.center,
    required: props.required,
    borderless: !props.border
  };
  if (size) {
    classes[size] = size;
  }
  return h("div", _mergeJSXProps([{
    "class": bem$1o(classes),
    "attrs": {
      "role": clickable ? 'button' : null,
      "tabindex": clickable ? 0 : null
    },
    "on": {
      "click": onClick
    }
  }, inherit(ctx)]), [LeftIcon(), Title(), Value(), RightIcon(), slots.extra == null ? void 0 : slots.extra()]);
}
Cell.props = _extends$1({}, cellProps, routeProps);
var Cell$1 = createComponent$1x(Cell);

function isAndroid() {
  /* istanbul ignore next */
  return isServer$1 ? false : /android/.test(navigator.userAgent.toLowerCase());
}
function isIOS$1() {
  /* istanbul ignore next */
  return isServer$1 ? false : /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase());
}

/**
 * Hack for iOS12 page scroll
 * https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
 */
var isIOS = isIOS$1();
/* istanbul ignore next */

function resetScroll() {
  if (isIOS) {
    setRootScrollTop(getRootScrollTop());
  }
}

var _createNamespace$1s = createNamespace('field'),
  createComponent$1w = _createNamespace$1s[0],
  bem$1n = _createNamespace$1s[1];
var Field = createComponent$1w({
  inheritAttrs: false,
  provide: function provide() {
    return {
      vanField: this
    };
  },
  inject: {
    vanForm: {
      default: null
    }
  },
  props: _extends$1({}, cellProps, {
    name: String,
    rules: Array,
    disabled: {
      type: Boolean,
      default: null
    },
    readonly: {
      type: Boolean,
      default: null
    },
    autosize: [Boolean, Object],
    leftIcon: String,
    rightIcon: String,
    clearable: Boolean,
    formatter: Function,
    maxlength: [Number, String],
    labelWidth: [Number, String],
    labelClass: null,
    labelAlign: String,
    inputAlign: String,
    placeholder: String,
    errorMessage: String,
    errorMessageAlign: String,
    showWordLimit: Boolean,
    value: {
      type: [Number, String],
      default: ''
    },
    type: {
      type: String,
      default: 'text'
    },
    error: {
      type: Boolean,
      default: null
    },
    colon: {
      type: Boolean,
      default: null
    },
    clearTrigger: {
      type: String,
      default: 'focus'
    },
    formatTrigger: {
      type: String,
      default: 'onChange'
    }
  }),
  data: function data() {
    return {
      focused: false,
      validateFailed: false,
      validateMessage: ''
    };
  },
  watch: {
    value: function value() {
      this.updateValue(this.value);
      this.resetValidation();
      this.validateWithTrigger('onChange');
      this.$nextTick(this.adjustSize);
    }
  },
  mounted: function mounted() {
    this.updateValue(this.value, this.formatTrigger);
    this.$nextTick(this.adjustSize);
    if (this.vanForm) {
      this.vanForm.addField(this);
    }
  },
  beforeDestroy: function beforeDestroy() {
    if (this.vanForm) {
      this.vanForm.removeField(this);
    }
  },
  computed: {
    showClear: function showClear() {
      var readonly = this.getProp('readonly');
      if (this.clearable && !readonly) {
        var hasValue = isDef$1(this.value) && this.value !== '';
        var trigger = this.clearTrigger === 'always' || this.clearTrigger === 'focus' && this.focused;
        return hasValue && trigger;
      }
    },
    showError: function showError() {
      if (this.error !== null) {
        return this.error;
      }
      if (this.vanForm && this.vanForm.showError && this.validateFailed) {
        return true;
      }
    },
    listeners: function listeners() {
      return _extends$1({}, this.$listeners, {
        blur: this.onBlur,
        focus: this.onFocus,
        input: this.onInput,
        click: this.onClickInput,
        keypress: this.onKeypress
      });
    },
    labelStyle: function labelStyle() {
      var labelWidth = this.getProp('labelWidth');
      if (labelWidth) {
        return {
          width: addUnit(labelWidth)
        };
      }
    },
    formValue: function formValue() {
      if (this.children && (this.$scopedSlots.input || this.$slots.input)) {
        return this.children.value;
      }
      return this.value;
    }
  },
  methods: {
    // @exposed-api
    focus: function focus() {
      if (this.$refs.input) {
        this.$refs.input.focus();
      }
    },
    // @exposed-api
    blur: function blur() {
      if (this.$refs.input) {
        this.$refs.input.blur();
      }
    },
    runValidator: function runValidator(value, rule) {
      return new Promise(function (resolve) {
        var returnVal = rule.validator(value, rule);
        if (isPromise$1(returnVal)) {
          return returnVal.then(resolve);
        }
        resolve(returnVal);
      });
    },
    isEmptyValue: function isEmptyValue(value) {
      if (Array.isArray(value)) {
        return !value.length;
      }
      if (value === 0) {
        return false;
      }
      return !value;
    },
    runSyncRule: function runSyncRule(value, rule) {
      if (rule.required && this.isEmptyValue(value)) {
        return false;
      }
      if (rule.pattern && !rule.pattern.test(value)) {
        return false;
      }
      return true;
    },
    getRuleMessage: function getRuleMessage(value, rule) {
      var message = rule.message;
      if (isFunction$3(message)) {
        return message(value, rule);
      }
      return message;
    },
    runRules: function runRules(rules) {
      var _this = this;
      return rules.reduce(function (promise, rule) {
        return promise.then(function () {
          if (_this.validateFailed) {
            return;
          }
          var value = _this.formValue;
          if (rule.formatter) {
            value = rule.formatter(value, rule);
          }
          if (!_this.runSyncRule(value, rule)) {
            _this.validateFailed = true;
            _this.validateMessage = _this.getRuleMessage(value, rule);
            return;
          }
          if (rule.validator) {
            return _this.runValidator(value, rule).then(function (result) {
              if (result === false) {
                _this.validateFailed = true;
                _this.validateMessage = _this.getRuleMessage(value, rule);
              }
            });
          }
        });
      }, Promise.resolve());
    },
    validate: function validate(rules) {
      var _this2 = this;
      if (rules === void 0) {
        rules = this.rules;
      }
      return new Promise(function (resolve) {
        if (!rules) {
          resolve();
        }
        _this2.resetValidation();
        _this2.runRules(rules).then(function () {
          if (_this2.validateFailed) {
            resolve({
              name: _this2.name,
              message: _this2.validateMessage
            });
          } else {
            resolve();
          }
        });
      });
    },
    validateWithTrigger: function validateWithTrigger(trigger) {
      if (this.vanForm && this.rules) {
        var defaultTrigger = this.vanForm.validateTrigger === trigger;
        var rules = this.rules.filter(function (rule) {
          if (rule.trigger) {
            return rule.trigger === trigger;
          }
          return defaultTrigger;
        });
        if (rules.length) {
          this.validate(rules);
        }
      }
    },
    resetValidation: function resetValidation() {
      if (this.validateFailed) {
        this.validateFailed = false;
        this.validateMessage = '';
      }
    },
    updateValue: function updateValue(value, trigger) {
      if (trigger === void 0) {
        trigger = 'onChange';
      }
      value = isDef$1(value) ? String(value) : ''; // native maxlength have incorrect line-break counting
      // see: https://github.com/vant-ui/vant/issues/5033

      var maxlength = this.maxlength;
      if (isDef$1(maxlength) && value.length > maxlength) {
        if (this.value && this.value.length === +maxlength) {
          value = this.value;
        } else {
          value = value.slice(0, maxlength);
        }
      }
      if (this.type === 'number' || this.type === 'digit') {
        var isNumber = this.type === 'number';
        value = formatNumber(value, isNumber, isNumber);
      }
      if (this.formatter && trigger === this.formatTrigger) {
        value = this.formatter(value);
      }
      var input = this.$refs.input;
      if (input && value !== input.value) {
        input.value = value;
      }
      if (value !== this.value) {
        this.$emit('input', value);
      }
    },
    onInput: function onInput(event) {
      // not update v-model when composing
      if (event.target.composing) {
        return;
      }
      this.updateValue(event.target.value);
    },
    onFocus: function onFocus(event) {
      this.focused = true;
      this.$emit('focus', event); // https://github.com/vant-ui/vant/issues/9715

      this.$nextTick(this.adjustSize); // readonly not work in legacy mobile safari

      /* istanbul ignore if */

      if (this.getProp('readonly')) {
        this.blur();
      }
    },
    onBlur: function onBlur(event) {
      if (this.getProp('readonly')) {
        return;
      }
      this.focused = false;
      this.updateValue(this.value, 'onBlur');
      this.$emit('blur', event);
      this.validateWithTrigger('onBlur');
      this.$nextTick(this.adjustSize);
      resetScroll();
    },
    onClick: function onClick(event) {
      this.$emit('click', event);
    },
    onClickInput: function onClickInput(event) {
      this.$emit('click-input', event);
    },
    onClickLeftIcon: function onClickLeftIcon(event) {
      this.$emit('click-left-icon', event);
    },
    onClickRightIcon: function onClickRightIcon(event) {
      this.$emit('click-right-icon', event);
    },
    onClear: function onClear(event) {
      preventDefault$1(event);
      this.$emit('input', '');
      this.$emit('clear', event);
    },
    onKeypress: function onKeypress(event) {
      var ENTER_CODE = 13;
      if (event.keyCode === ENTER_CODE) {
        var submitOnEnter = this.getProp('submitOnEnter');
        if (!submitOnEnter && this.type !== 'textarea') {
          preventDefault$1(event);
        } // trigger blur after click keyboard search button

        if (this.type === 'search') {
          this.blur();
        }
      }
      this.$emit('keypress', event);
    },
    adjustSize: function adjustSize() {
      var input = this.$refs.input;
      if (!(this.type === 'textarea' && this.autosize) || !input) {
        return;
      }
      var scrollTop = getRootScrollTop();
      input.style.height = 'auto';
      var height = input.scrollHeight;
      if (isObject$6(this.autosize)) {
        var _this$autosize = this.autosize,
          maxHeight = _this$autosize.maxHeight,
          minHeight = _this$autosize.minHeight;
        if (maxHeight) {
          height = Math.min(height, maxHeight);
        }
        if (minHeight) {
          height = Math.max(height, minHeight);
        }
      }
      if (height) {
        input.style.height = height + 'px'; // https://github.com/vant-ui/vant/issues/9178

        setRootScrollTop(scrollTop);
      }
    },
    genInput: function genInput() {
      var h = this.$createElement;
      var type = this.type;
      var disabled = this.getProp('disabled');
      var readonly = this.getProp('readonly');
      var inputSlot = this.slots('input');
      var inputAlign = this.getProp('inputAlign');
      if (inputSlot) {
        return h("div", {
          "class": bem$1n('control', [inputAlign, 'custom']),
          "on": {
            "click": this.onClickInput
          }
        }, [inputSlot]);
      }
      var inputProps = {
        ref: 'input',
        class: bem$1n('control', inputAlign),
        domProps: {
          value: this.value
        },
        attrs: _extends$1({}, this.$attrs, {
          name: this.name,
          disabled: disabled,
          readonly: readonly,
          placeholder: this.placeholder
        }),
        on: this.listeners,
        // add model directive to skip IME composition
        directives: [{
          name: 'model',
          value: this.value
        }]
      };
      if (type === 'textarea') {
        return h("textarea", _mergeJSXProps([{}, inputProps]));
      }
      var inputType = type;
      var inputMode; // type="number" is weird in iOS, and can't prevent dot in Android
      // so use inputmode to set keyboard in modern browsers

      if (type === 'number') {
        inputType = 'text';
        inputMode = 'decimal';
      }
      if (type === 'digit') {
        inputType = 'tel';
        inputMode = 'numeric';
      }
      return h("input", _mergeJSXProps([{
        "attrs": {
          "type": inputType,
          "inputmode": inputMode
        }
      }, inputProps]));
    },
    genLeftIcon: function genLeftIcon() {
      var h = this.$createElement;
      var showLeftIcon = this.slots('left-icon') || this.leftIcon;
      if (showLeftIcon) {
        return h("div", {
          "class": bem$1n('left-icon'),
          "on": {
            "click": this.onClickLeftIcon
          }
        }, [this.slots('left-icon') || h(Icon$3, {
          "attrs": {
            "name": this.leftIcon,
            "classPrefix": this.iconPrefix
          }
        })]);
      }
    },
    genRightIcon: function genRightIcon() {
      var h = this.$createElement;
      var slots = this.slots;
      var showRightIcon = slots('right-icon') || this.rightIcon;
      if (showRightIcon) {
        return h("div", {
          "class": bem$1n('right-icon'),
          "on": {
            "click": this.onClickRightIcon
          }
        }, [slots('right-icon') || h(Icon$3, {
          "attrs": {
            "name": this.rightIcon,
            "classPrefix": this.iconPrefix
          }
        })]);
      }
    },
    genWordLimit: function genWordLimit() {
      var h = this.$createElement;
      if (this.showWordLimit && this.maxlength) {
        var count = (this.value || '').length;
        return h("div", {
          "class": bem$1n('word-limit')
        }, [h("span", {
          "class": bem$1n('word-num')
        }, [count]), "/", this.maxlength]);
      }
    },
    genMessage: function genMessage() {
      var h = this.$createElement;
      if (this.vanForm && this.vanForm.showErrorMessage === false) {
        return;
      }
      var message = this.errorMessage || this.validateMessage;
      if (message) {
        var errorMessageAlign = this.getProp('errorMessageAlign');
        return h("div", {
          "class": bem$1n('error-message', errorMessageAlign)
        }, [message]);
      }
    },
    getProp: function getProp(key) {
      if (isDef$1(this[key])) {
        return this[key];
      }
      if (this.vanForm && isDef$1(this.vanForm[key])) {
        return this.vanForm[key];
      }
    },
    genLabel: function genLabel() {
      var h = this.$createElement;
      var colon = this.getProp('colon') ? ':' : '';
      if (this.slots('label')) {
        return [this.slots('label'), colon];
      }
      if (this.label) {
        return h("span", [this.label + colon]);
      }
    }
  },
  render: function render() {
    var _bem;
    var h = arguments[0];
    var slots = this.slots;
    var disabled = this.getProp('disabled');
    var labelAlign = this.getProp('labelAlign');
    var scopedSlots = {
      icon: this.genLeftIcon
    };
    var Label = this.genLabel();
    if (Label) {
      scopedSlots.title = function () {
        return Label;
      };
    }
    var extra = this.slots('extra');
    if (extra) {
      scopedSlots.extra = function () {
        return extra;
      };
    }
    return h(Cell$1, {
      "attrs": {
        "icon": this.leftIcon,
        "size": this.size,
        "center": this.center,
        "border": this.border,
        "isLink": this.isLink,
        "required": this.required,
        "clickable": this.clickable,
        "titleStyle": this.labelStyle,
        "valueClass": bem$1n('value'),
        "titleClass": [bem$1n('label', labelAlign), this.labelClass],
        "arrowDirection": this.arrowDirection
      },
      "scopedSlots": scopedSlots,
      "class": bem$1n((_bem = {
        error: this.showError,
        disabled: disabled
      }, _bem["label-" + labelAlign] = labelAlign, _bem['min-height'] = this.type === 'textarea' && !this.autosize, _bem)),
      "on": {
        "click": this.onClick
      }
    }, [h("div", {
      "class": bem$1n('body')
    }, [this.genInput(), this.showClear && h(Icon$3, {
      "attrs": {
        "name": "clear"
      },
      "class": bem$1n('clear'),
      "on": {
        "touchstart": this.onClear
      }
    }), this.genRightIcon(), slots('button') && h("div", {
      "class": bem$1n('button')
    }, [slots('button')])]), this.genWordLimit(), this.genMessage()]);
  }
});

var lockCount = 0;
function lockClick(lock) {
  if (lock) {
    if (!lockCount) {
      document.body.classList.add('van-toast--unclickable');
    }
    lockCount++;
  } else {
    lockCount--;
    if (!lockCount) {
      document.body.classList.remove('van-toast--unclickable');
    }
  }
}

// Utils
var _createNamespace$1r = createNamespace('toast'),
  createComponent$1v = _createNamespace$1r[0],
  bem$1m = _createNamespace$1r[1];
var VueToast = createComponent$1v({
  mixins: [PopupMixin()],
  props: {
    icon: String,
    className: null,
    iconPrefix: String,
    loadingType: String,
    forbidClick: Boolean,
    closeOnClick: Boolean,
    message: [Number, String],
    type: {
      type: String,
      default: 'text'
    },
    position: {
      type: String,
      default: 'middle'
    },
    transition: {
      type: String,
      default: 'van-fade'
    },
    lockScroll: {
      type: Boolean,
      default: false
    }
  },
  data: function data() {
    return {
      clickable: false
    };
  },
  mounted: function mounted() {
    this.toggleClickable();
  },
  destroyed: function destroyed() {
    this.toggleClickable();
  },
  watch: {
    value: 'toggleClickable',
    forbidClick: 'toggleClickable'
  },
  methods: {
    onClick: function onClick() {
      if (this.closeOnClick) {
        this.close();
      }
    },
    toggleClickable: function toggleClickable() {
      var clickable = this.value && this.forbidClick;
      if (this.clickable !== clickable) {
        this.clickable = clickable;
        lockClick(clickable);
      }
    },
    /* istanbul ignore next */
    onAfterEnter: function onAfterEnter() {
      this.$emit('opened');
      if (this.onOpened) {
        this.onOpened();
      }
    },
    onAfterLeave: function onAfterLeave() {
      this.$emit('closed');
    },
    genIcon: function genIcon() {
      var h = this.$createElement;
      var icon = this.icon,
        type = this.type,
        iconPrefix = this.iconPrefix,
        loadingType = this.loadingType;
      var hasIcon = icon || type === 'success' || type === 'fail';
      if (hasIcon) {
        return h(Icon$3, {
          "class": bem$1m('icon'),
          "attrs": {
            "classPrefix": iconPrefix,
            "name": icon || type
          }
        });
      }
      if (type === 'loading') {
        return h(Loading$1, {
          "class": bem$1m('loading'),
          "attrs": {
            "type": loadingType
          }
        });
      }
    },
    genMessage: function genMessage() {
      var h = this.$createElement;
      var type = this.type,
        message = this.message;
      if (!isDef$1(message) || message === '') {
        return;
      }
      if (type === 'html') {
        return h("div", {
          "class": bem$1m('text'),
          "domProps": {
            "innerHTML": message
          }
        });
      }
      return h("div", {
        "class": bem$1m('text')
      }, [message]);
    }
  },
  render: function render() {
    var _ref;
    var h = arguments[0];
    return h("transition", {
      "attrs": {
        "name": this.transition
      },
      "on": {
        "afterEnter": this.onAfterEnter,
        "afterLeave": this.onAfterLeave
      }
    }, [h("div", {
      "directives": [{
        name: "show",
        value: this.value
      }],
      "class": [bem$1m([this.position, (_ref = {}, _ref[this.type] = !this.icon, _ref)]), this.className],
      "on": {
        "click": this.onClick
      }
    }, [this.genIcon(), this.genMessage()])]);
  }
});

var defaultOptions$1 = {
  icon: '',
  type: 'text',
  // @deprecated
  mask: false,
  value: true,
  message: '',
  className: '',
  overlay: false,
  onClose: null,
  onOpened: null,
  duration: 2000,
  iconPrefix: undefined,
  position: 'middle',
  transition: 'van-fade',
  forbidClick: false,
  loadingType: undefined,
  getContainer: 'body',
  overlayStyle: null,
  closeOnClick: false,
  closeOnClickOverlay: false
}; // default options of specific type

var defaultOptionsMap = {};
var queue = [];
var multiple = false;
var currentOptions = _extends$1({}, defaultOptions$1);
function parseOptions$2(message) {
  if (isObject$6(message)) {
    return message;
  }
  return {
    message: message
  };
}
function isInDocument$1(element) {
  return document.body.contains(element);
}
function createInstance() {
  /* istanbul ignore if */
  if (isServer$1) {
    return {};
  }
  queue = queue.filter(function (item) {
    return !item.$el.parentNode || isInDocument$1(item.$el);
  });
  if (!queue.length || multiple) {
    var toast = new (Vue.extend(VueToast))({
      el: document.createElement('div')
    });
    toast.$on('input', function (value) {
      toast.value = value;
    });
    queue.push(toast);
  }
  return queue[queue.length - 1];
} // transform toast options to popup props

function transformOptions(options) {
  return _extends$1({}, options, {
    overlay: options.mask || options.overlay,
    mask: undefined,
    duration: undefined
  });
}
function Toast(options) {
  if (options === void 0) {
    options = {};
  }
  var toast = createInstance(); // should add z-index if previous toast has not disappeared

  if (toast.value) {
    toast.updateZIndex();
  }
  options = parseOptions$2(options);
  options = _extends$1({}, currentOptions, defaultOptionsMap[options.type || currentOptions.type], options);
  options.clear = function () {
    toast.value = false;
    if (options.onClose) {
      options.onClose();
      options.onClose = null;
    }
    if (multiple && !isServer$1) {
      toast.$on('closed', function () {
        clearTimeout(toast.timer);
        queue = queue.filter(function (item) {
          return item !== toast;
        });
        removeNode$2(toast.$el);
        toast.$destroy();
      });
    }
  };
  _extends$1(toast, transformOptions(options));
  clearTimeout(toast.timer);
  if (options.duration > 0) {
    toast.timer = setTimeout(function () {
      toast.clear();
    }, options.duration);
  }
  return toast;
}
var createMethod = function createMethod(type) {
  return function (options) {
    return Toast(_extends$1({
      type: type
    }, parseOptions$2(options)));
  };
};
['loading', 'success', 'fail'].forEach(function (method) {
  Toast[method] = createMethod(method);
});
Toast.clear = function (all) {
  if (queue.length) {
    if (all) {
      queue.forEach(function (toast) {
        toast.clear();
      });
      queue = [];
    } else if (!multiple) {
      queue[0].clear();
    } else {
      queue.shift().clear();
    }
  }
};
Toast.setDefaultOptions = function (type, options) {
  if (typeof type === 'string') {
    defaultOptionsMap[type] = options;
  } else {
    _extends$1(currentOptions, type);
  }
};
Toast.resetDefaultOptions = function (type) {
  if (typeof type === 'string') {
    defaultOptionsMap[type] = null;
  } else {
    currentOptions = _extends$1({}, defaultOptions$1);
    defaultOptionsMap = {};
  }
};
Toast.allowMultiple = function (value) {
  if (value === void 0) {
    value = true;
  }
  multiple = value;
};
Toast.install = function () {
  Vue.use(VueToast);
};
Vue.prototype.$toast = Toast;

var _createNamespace$1q = createNamespace('button'),
  createComponent$1u = _createNamespace$1q[0],
  bem$1l = _createNamespace$1q[1];
function Button$1(h, props, slots, ctx) {
  var _ref;
  var tag = props.tag,
    icon = props.icon,
    type = props.type,
    color = props.color,
    plain = props.plain,
    disabled = props.disabled,
    loading = props.loading,
    hairline = props.hairline,
    loadingText = props.loadingText,
    iconPosition = props.iconPosition;
  var style = {};
  if (color) {
    style.color = plain ? color : 'white';
    if (!plain) {
      // Use background instead of backgroundColor to make linear-gradient work
      style.background = color;
    } // hide border when color is linear-gradient

    if (color.indexOf('gradient') !== -1) {
      style.border = 0;
    } else {
      style.borderColor = color;
    }
  }
  function onClick(event) {
    if (props.loading) {
      event.preventDefault();
    }
    if (!loading && !disabled) {
      emit(ctx, 'click', event);
      functionalRoute(ctx);
    }
  }
  function onTouchstart(event) {
    emit(ctx, 'touchstart', event);
  }
  var classes = [bem$1l([type, props.size, {
    plain: plain,
    loading: loading,
    disabled: disabled,
    hairline: hairline,
    block: props.block,
    round: props.round,
    square: props.square
  }]), (_ref = {}, _ref[BORDER_SURROUND] = hairline, _ref)];
  function renderIcon() {
    if (loading) {
      return slots.loading ? slots.loading() : h(Loading$1, {
        "class": bem$1l('loading'),
        "attrs": {
          "size": props.loadingSize,
          "type": props.loadingType,
          "color": "currentColor"
        }
      });
    }
    if (slots.icon) {
      return h("div", {
        "class": bem$1l('icon')
      }, [slots.icon()]);
    }
    if (icon) {
      return h(Icon$3, {
        "attrs": {
          "name": icon,
          "classPrefix": props.iconPrefix
        },
        "class": bem$1l('icon')
      });
    }
  }
  function renderContent() {
    var content = [];
    if (iconPosition === 'left') {
      content.push(renderIcon());
    }
    var text;
    if (loading) {
      text = loadingText;
    } else {
      text = slots.default ? slots.default() : props.text;
    }
    if (text) {
      content.push(h("span", {
        "class": bem$1l('text')
      }, [text]));
    }
    if (iconPosition === 'right') {
      content.push(renderIcon());
    }
    return content;
  }
  return h(tag, _mergeJSXProps([{
    "style": style,
    "class": classes,
    "attrs": {
      "type": props.nativeType,
      "disabled": disabled
    },
    "on": {
      "click": onClick,
      "touchstart": onTouchstart
    }
  }, inherit(ctx)]), [h("div", {
    "class": bem$1l('content')
  }, [renderContent()])]);
}
Button$1.props = _extends$1({}, routeProps, {
  text: String,
  icon: String,
  color: String,
  block: Boolean,
  plain: Boolean,
  round: Boolean,
  square: Boolean,
  loading: Boolean,
  hairline: Boolean,
  disabled: Boolean,
  iconPrefix: String,
  nativeType: String,
  loadingText: String,
  loadingType: String,
  tag: {
    type: String,
    default: 'button'
  },
  type: {
    type: String,
    default: 'default'
  },
  size: {
    type: String,
    default: 'normal'
  },
  loadingSize: {
    type: String,
    default: '20px'
  },
  iconPosition: {
    type: String,
    default: 'left'
  }
});
var Button$2 = createComponent$1u(Button$1);

function flattenVNodes(vnodes) {
  var result = [];
  function traverse(vnodes) {
    vnodes.forEach(function (vnode) {
      result.push(vnode);
      if (vnode.componentInstance) {
        traverse(vnode.componentInstance.$children.map(function (item) {
          return item.$vnode;
        }));
      }
      if (vnode.children) {
        traverse(vnode.children);
      }
    });
  }
  traverse(vnodes);
  return result;
} // sort children instances by vnodes order

function sortChildren(children, parent) {
  var componentOptions = parent.$vnode.componentOptions;
  if (!componentOptions || !componentOptions.children) {
    return;
  }
  var vnodes = flattenVNodes(componentOptions.children);
  children.sort(function (a, b) {
    return vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode);
  });
}

function ChildrenMixin(_parent, options) {
  var _inject, _computed;
  if (options === void 0) {
    options = {};
  }
  var indexKey = options.indexKey || 'index';
  return {
    inject: (_inject = {}, _inject[_parent] = {
      default: null
    }, _inject),
    computed: (_computed = {
      parent: function parent() {
        if (this.disableBindRelation) {
          return null;
        }
        return this[_parent];
      }
    }, _computed[indexKey] = function () {
      this.bindRelation();
      if (this.parent) {
        return this.parent.children.indexOf(this);
      }
      return null;
    }, _computed),
    watch: {
      disableBindRelation: function disableBindRelation(val) {
        if (!val) {
          this.bindRelation();
        }
      }
    },
    mounted: function mounted() {
      this.bindRelation();
    },
    beforeDestroy: function beforeDestroy() {
      var _this = this;
      if (this.parent) {
        this.parent.children = this.parent.children.filter(function (item) {
          return item !== _this;
        });
      }
    },
    methods: {
      bindRelation: function bindRelation() {
        if (!this.parent || this.parent.children.indexOf(this) !== -1) {
          return;
        }
        var children = [].concat(this.parent.children, [this]);
        sortChildren(children, this.parent);
        this.parent.children = children;
      }
    }
  };
}
function ParentMixin(parent) {
  return {
    provide: function provide() {
      var _ref;
      return _ref = {}, _ref[parent] = this, _ref;
    },
    data: function data() {
      return {
        children: []
      };
    }
  };
}

var _createNamespace$1p = createNamespace('goods-action'),
  createComponent$1t = _createNamespace$1p[0],
  bem$1k = _createNamespace$1p[1];
var GoodsAction = createComponent$1t({
  mixins: [ParentMixin('vanGoodsAction')],
  props: {
    safeAreaInsetBottom: {
      type: Boolean,
      default: true
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$1k({
        unfit: !this.safeAreaInsetBottom
      })
    }, [this.slots()]);
  }
});

var _createNamespace$1o = createNamespace('goods-action-button'),
  createComponent$1s = _createNamespace$1o[0],
  bem$1j = _createNamespace$1o[1];
var GoodsActionButton = createComponent$1s({
  mixins: [ChildrenMixin('vanGoodsAction')],
  props: _extends$1({}, routeProps, {
    type: String,
    text: String,
    icon: String,
    color: String,
    loading: Boolean,
    disabled: Boolean
  }),
  computed: {
    isFirst: function isFirst() {
      var prev = this.parent && this.parent.children[this.index - 1];
      return !prev || prev.$options.name !== this.$options.name;
    },
    isLast: function isLast() {
      var next = this.parent && this.parent.children[this.index + 1];
      return !next || next.$options.name !== this.$options.name;
    }
  },
  methods: {
    onClick: function onClick(event) {
      this.$emit('click', event);
      route(this.$router, this);
    }
  },
  render: function render() {
    var h = arguments[0];
    return h(Button$2, {
      "class": bem$1j([{
        first: this.isFirst,
        last: this.isLast
      }, this.type]),
      "attrs": {
        "size": "large",
        "type": this.type,
        "icon": this.icon,
        "color": this.color,
        "loading": this.loading,
        "disabled": this.disabled
      },
      "on": {
        "click": this.onClick
      }
    }, [this.slots() || this.text]);
  }
});

var _createNamespace$1n = createNamespace('dialog'),
  createComponent$1r = _createNamespace$1n[0],
  bem$1i = _createNamespace$1n[1],
  t$q = _createNamespace$1n[2];
var VanDialog = createComponent$1r({
  mixins: [PopupMixin()],
  props: {
    title: String,
    theme: String,
    width: [Number, String],
    message: String,
    className: null,
    callback: Function,
    beforeClose: Function,
    messageAlign: String,
    cancelButtonText: String,
    cancelButtonColor: String,
    confirmButtonText: String,
    confirmButtonColor: String,
    showCancelButton: Boolean,
    overlay: {
      type: Boolean,
      default: true
    },
    allowHtml: {
      type: Boolean,
      default: true
    },
    transition: {
      type: String,
      default: 'van-dialog-bounce'
    },
    showConfirmButton: {
      type: Boolean,
      default: true
    },
    closeOnPopstate: {
      type: Boolean,
      default: true
    },
    closeOnClickOverlay: {
      type: Boolean,
      default: false
    }
  },
  data: function data() {
    return {
      loading: {
        confirm: false,
        cancel: false
      }
    };
  },
  methods: {
    onClickOverlay: function onClickOverlay() {
      this.handleAction('overlay');
    },
    handleAction: function handleAction(action) {
      var _this = this;
      this.$emit(action); // show not trigger close event when hidden

      if (!this.value) {
        return;
      }
      if (this.beforeClose) {
        this.loading[action] = true;
        this.beforeClose(action, function (state) {
          if (state !== false && _this.loading[action]) {
            _this.onClose(action);
          }
          _this.loading.confirm = false;
          _this.loading.cancel = false;
        });
      } else {
        this.onClose(action);
      }
    },
    onClose: function onClose(action) {
      this.close();
      if (this.callback) {
        this.callback(action);
      }
    },
    onOpened: function onOpened() {
      var _this2 = this;
      this.$emit('opened');
      this.$nextTick(function () {
        var _this2$$refs$dialog;
        (_this2$$refs$dialog = _this2.$refs.dialog) == null ? void 0 : _this2$$refs$dialog.focus();
      });
    },
    onClosed: function onClosed() {
      this.$emit('closed');
    },
    onKeydown: function onKeydown(event) {
      var _this3 = this;
      if (event.key === 'Escape' || event.key === 'Enter') {
        // skip keyboard events of child elements
        if (event.target !== this.$refs.dialog) {
          return;
        }
        var onEventType = {
          Enter: this.showConfirmButton ? function () {
            return _this3.handleAction('confirm');
          } : noop$3,
          Escape: this.showCancelButton ? function () {
            return _this3.handleAction('cancel');
          } : noop$3
        };
        onEventType[event.key]();
        this.$emit('keydown', event);
      }
    },
    genRoundButtons: function genRoundButtons() {
      var _this4 = this;
      var h = this.$createElement;
      return h(GoodsAction, {
        "class": bem$1i('footer')
      }, [this.showCancelButton && h(GoodsActionButton, {
        "attrs": {
          "size": "large",
          "type": "warning",
          "text": this.cancelButtonText || t$q('cancel'),
          "color": this.cancelButtonColor,
          "loading": this.loading.cancel
        },
        "class": bem$1i('cancel'),
        "on": {
          "click": function click() {
            _this4.handleAction('cancel');
          }
        }
      }), this.showConfirmButton && h(GoodsActionButton, {
        "attrs": {
          "size": "large",
          "type": "danger",
          "text": this.confirmButtonText || t$q('confirm'),
          "color": this.confirmButtonColor,
          "loading": this.loading.confirm
        },
        "class": bem$1i('confirm'),
        "on": {
          "click": function click() {
            _this4.handleAction('confirm');
          }
        }
      })]);
    },
    genButtons: function genButtons() {
      var _this5 = this,
        _ref;
      var h = this.$createElement;
      var multiple = this.showCancelButton && this.showConfirmButton;
      return h("div", {
        "class": [BORDER_TOP, bem$1i('footer')]
      }, [this.showCancelButton && h(Button$2, {
        "attrs": {
          "size": "large",
          "loading": this.loading.cancel,
          "text": this.cancelButtonText || t$q('cancel'),
          "nativeType": "button"
        },
        "class": bem$1i('cancel'),
        "style": {
          color: this.cancelButtonColor
        },
        "on": {
          "click": function click() {
            _this5.handleAction('cancel');
          }
        }
      }), this.showConfirmButton && h(Button$2, {
        "attrs": {
          "size": "large",
          "loading": this.loading.confirm,
          "text": this.confirmButtonText || t$q('confirm'),
          "nativeType": "button"
        },
        "class": [bem$1i('confirm'), (_ref = {}, _ref[BORDER_LEFT] = multiple, _ref)],
        "style": {
          color: this.confirmButtonColor
        },
        "on": {
          "click": function click() {
            _this5.handleAction('confirm');
          }
        }
      })]);
    },
    genContent: function genContent(hasTitle, messageSlot) {
      var h = this.$createElement;
      if (messageSlot) {
        return h("div", {
          "class": bem$1i('content')
        }, [messageSlot]);
      }
      var message = this.message,
        messageAlign = this.messageAlign;
      if (message) {
        var _bem, _domProps;
        var data = {
          class: bem$1i('message', (_bem = {
            'has-title': hasTitle
          }, _bem[messageAlign] = messageAlign, _bem)),
          domProps: (_domProps = {}, _domProps[this.allowHtml ? 'innerHTML' : 'textContent'] = message, _domProps)
        };
        return h("div", {
          "class": bem$1i('content', {
            isolated: !hasTitle
          })
        }, [h("div", _mergeJSXProps([{}, data]))]);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    if (!this.shouldRender) {
      return;
    }
    var message = this.message;
    var messageSlot = this.slots();
    var title = this.slots('title') || this.title;
    var Title = title && h("div", {
      "class": bem$1i('header', {
        isolated: !message && !messageSlot
      })
    }, [title]);
    return h("transition", {
      "attrs": {
        "name": this.transition
      },
      "on": {
        "afterEnter": this.onOpened,
        "afterLeave": this.onClosed
      }
    }, [h("div", {
      "directives": [{
        name: "show",
        value: this.value
      }],
      "attrs": {
        "role": "dialog",
        "aria-labelledby": this.title || message,
        "tabIndex": 0
      },
      "class": [bem$1i([this.theme]), this.className],
      "style": {
        width: addUnit(this.width)
      },
      "ref": "dialog",
      "on": {
        "keydown": this.onKeydown
      }
    }, [Title, this.genContent(title, messageSlot), this.theme === 'round-button' ? this.genRoundButtons() : this.genButtons()])]);
  }
});

var instance$4;
function isInDocument(element) {
  return document.body.contains(element);
}
function initInstance$1() {
  if (instance$4) {
    instance$4.$destroy();
  }
  instance$4 = new (Vue.extend(VanDialog))({
    el: document.createElement('div'),
    // avoid missing animation when first rendered
    propsData: {
      lazyRender: false
    }
  });
  instance$4.$on('input', function (value) {
    instance$4.value = value;
  });
}
function Dialog(options) {
  /* istanbul ignore if */
  if (isServer$1) {
    return Promise.resolve();
  }
  return new Promise(function (resolve, reject) {
    if (!instance$4 || !isInDocument(instance$4.$el)) {
      initInstance$1();
    }
    _extends$1(instance$4, Dialog.currentOptions, options, {
      resolve: resolve,
      reject: reject
    });
  });
}
Dialog.defaultOptions = {
  value: true,
  title: '',
  width: '',
  theme: null,
  message: '',
  overlay: true,
  className: '',
  allowHtml: true,
  lockScroll: true,
  transition: 'van-dialog-bounce',
  beforeClose: null,
  overlayClass: '',
  overlayStyle: null,
  messageAlign: '',
  getContainer: 'body',
  cancelButtonText: '',
  cancelButtonColor: null,
  confirmButtonText: '',
  confirmButtonColor: null,
  showConfirmButton: true,
  showCancelButton: false,
  closeOnPopstate: true,
  closeOnClickOverlay: false,
  callback: function callback(action) {
    instance$4[action === 'confirm' ? 'resolve' : 'reject'](action);
  }
};
Dialog.alert = Dialog;
Dialog.confirm = function (options) {
  return Dialog(_extends$1({
    showCancelButton: true
  }, options));
};
Dialog.close = function () {
  if (instance$4) {
    instance$4.value = false;
  }
};
Dialog.setDefaultOptions = function (options) {
  _extends$1(Dialog.currentOptions, options);
};
Dialog.resetDefaultOptions = function () {
  Dialog.currentOptions = _extends$1({}, Dialog.defaultOptions);
};
Dialog.resetDefaultOptions();
Dialog.install = function () {
  Vue.use(VanDialog);
};
Dialog.Component = VanDialog;
Vue.prototype.$dialog = Dialog;

var _createNamespace$1m = createNamespace('address-edit-detail'),
  createComponent$1q = _createNamespace$1m[0],
  bem$1h = _createNamespace$1m[1],
  t$p = _createNamespace$1m[2];
var android = isAndroid();
var Detail = createComponent$1q({
  props: {
    value: String,
    errorMessage: String,
    focused: Boolean,
    detailRows: [Number, String],
    searchResult: Array,
    detailMaxlength: [Number, String],
    showSearchResult: Boolean
  },
  computed: {
    shouldShowSearchResult: function shouldShowSearchResult() {
      return this.focused && this.searchResult && this.showSearchResult;
    }
  },
  methods: {
    onSelect: function onSelect(express) {
      this.$emit('select-search', express);
      this.$emit('input', ((express.address || '') + " " + (express.name || '')).trim());
    },
    onFinish: function onFinish() {
      this.$refs.field.blur();
    },
    genFinish: function genFinish() {
      var h = this.$createElement;
      var show = this.value && this.focused && android;
      if (show) {
        return h("div", {
          "class": bem$1h('finish'),
          "on": {
            "click": this.onFinish
          }
        }, [t$p('complete')]);
      }
    },
    genSearchResult: function genSearchResult() {
      var _this = this;
      var h = this.$createElement;
      var value = this.value,
        shouldShowSearchResult = this.shouldShowSearchResult,
        searchResult = this.searchResult;
      if (shouldShowSearchResult) {
        return searchResult.map(function (express) {
          return h(Cell$1, {
            "key": express.name + express.address,
            "attrs": {
              "clickable": true,
              "border": false,
              "icon": "location-o",
              "label": express.address
            },
            "class": bem$1h('search-item'),
            "on": {
              "click": function click() {
                _this.onSelect(express);
              }
            },
            "scopedSlots": {
              title: function title() {
                if (express.name) {
                  var text = express.name.replace(value, "<span class=" + bem$1h('keyword') + ">" + value + "</span>");
                  return h("div", {
                    "domProps": {
                      "innerHTML": text
                    }
                  });
                }
              }
            }
          });
        });
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    return h(Cell$1, {
      "class": bem$1h()
    }, [h(Field, {
      "attrs": {
        "autosize": true,
        "rows": this.detailRows,
        "clearable": !android,
        "type": "textarea",
        "value": this.value,
        "errorMessage": this.errorMessage,
        "border": !this.shouldShowSearchResult,
        "label": t$p('label'),
        "maxlength": this.detailMaxlength,
        "placeholder": t$p('placeholder')
      },
      "ref": "field",
      "scopedSlots": {
        icon: this.genFinish
      },
      "on": _extends$1({}, this.$listeners)
    }), this.genSearchResult()]);
  }
});

/**
 * Common Switch Props
 */
var switchProps = {
  size: [Number, String],
  value: null,
  loading: Boolean,
  disabled: Boolean,
  activeColor: String,
  inactiveColor: String,
  activeValue: {
    type: null,
    default: true
  },
  inactiveValue: {
    type: null,
    default: false
  }
};

var FieldMixin = {
  inject: {
    vanField: {
      default: null
    }
  },
  watch: {
    value: function value() {
      var field = this.vanField;
      if (field) {
        field.resetValidation();
        field.validateWithTrigger('onChange');
      }
    }
  },
  created: function created() {
    var field = this.vanField;
    if (field && !field.children) {
      field.children = this;
    }
  }
};

// Utils
var _createNamespace$1l = createNamespace('switch'),
  createComponent$1p = _createNamespace$1l[0],
  bem$1g = _createNamespace$1l[1];
var Switch = createComponent$1p({
  mixins: [FieldMixin],
  props: switchProps,
  computed: {
    checked: function checked() {
      return this.value === this.activeValue;
    },
    style: function style() {
      return {
        fontSize: addUnit(this.size),
        backgroundColor: this.checked ? this.activeColor : this.inactiveColor
      };
    }
  },
  methods: {
    onClick: function onClick(event) {
      this.$emit('click', event);
      if (!this.disabled && !this.loading) {
        var newValue = this.checked ? this.inactiveValue : this.activeValue;
        this.$emit('input', newValue);
        this.$emit('change', newValue);
      }
    },
    genLoading: function genLoading() {
      var h = this.$createElement;
      if (this.loading) {
        var color = this.checked ? this.activeColor : this.inactiveColor;
        return h(Loading$1, {
          "class": bem$1g('loading'),
          "attrs": {
            "color": color
          }
        });
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    var checked = this.checked,
      loading = this.loading,
      disabled = this.disabled;
    return h("div", {
      "class": bem$1g({
        on: checked,
        loading: loading,
        disabled: disabled
      }),
      "attrs": {
        "role": "switch",
        "aria-checked": String(checked)
      },
      "style": this.style,
      "on": {
        "click": this.onClick
      }
    }, [h("div", {
      "class": bem$1g('node')
    }, [this.genLoading()])]);
  }
});

var _createNamespace$1k = createNamespace('address-edit'),
  createComponent$1o = _createNamespace$1k[0],
  bem$1f = _createNamespace$1k[1],
  t$o = _createNamespace$1k[2];
var defaultData = {
  name: '',
  tel: '',
  country: '',
  province: '',
  city: '',
  county: '',
  areaCode: '',
  postalCode: '',
  addressDetail: '',
  isDefault: false
};
function isPostal(value) {
  return /^\d{6}$/.test(value);
}
var AddressEdit = createComponent$1o({
  props: {
    areaList: Object,
    isSaving: Boolean,
    isDeleting: Boolean,
    validator: Function,
    showDelete: Boolean,
    showPostal: Boolean,
    searchResult: Array,
    telMaxlength: [Number, String],
    showSetDefault: Boolean,
    saveButtonText: String,
    areaPlaceholder: String,
    deleteButtonText: String,
    showSearchResult: Boolean,
    showArea: {
      type: Boolean,
      default: true
    },
    showDetail: {
      type: Boolean,
      default: true
    },
    disableArea: Boolean,
    detailRows: {
      type: [Number, String],
      default: 1
    },
    detailMaxlength: {
      type: [Number, String],
      default: 200
    },
    addressInfo: {
      type: Object,
      default: function _default() {
        return _extends$1({}, defaultData);
      }
    },
    telValidator: {
      type: Function,
      default: isMobile
    },
    postalValidator: {
      type: Function,
      default: isPostal
    },
    areaColumnsPlaceholder: {
      type: Array,
      default: function _default() {
        return [];
      }
    }
  },
  data: function data() {
    return {
      data: {},
      showAreaPopup: false,
      detailFocused: false,
      errorInfo: {
        tel: '',
        name: '',
        areaCode: '',
        postalCode: '',
        addressDetail: ''
      }
    };
  },
  computed: {
    areaListLoaded: function areaListLoaded() {
      return isObject$6(this.areaList) && Object.keys(this.areaList).length;
    },
    areaText: function areaText() {
      var _this$data = this.data,
        country = _this$data.country,
        province = _this$data.province,
        city = _this$data.city,
        county = _this$data.county,
        areaCode = _this$data.areaCode;
      if (areaCode) {
        var arr = [country, province, city, county];
        if (province && province === city) {
          arr.splice(1, 1);
        }
        return arr.filter(function (text) {
          return text;
        }).join('/');
      }
      return '';
    },
    // hide bottom field when use search && detail get focused
    hideBottomFields: function hideBottomFields() {
      var searchResult = this.searchResult;
      return searchResult && searchResult.length && this.detailFocused;
    }
  },
  watch: {
    addressInfo: {
      handler: function handler(val) {
        this.data = _extends$1({}, defaultData, val);
        this.setAreaCode(val.areaCode);
      },
      deep: true,
      immediate: true
    },
    areaList: function areaList() {
      this.setAreaCode(this.data.areaCode);
    }
  },
  methods: {
    onFocus: function onFocus(key) {
      this.errorInfo[key] = '';
      this.detailFocused = key === 'addressDetail';
      this.$emit('focus', key);
    },
    onChangeDetail: function onChangeDetail(val) {
      this.data.addressDetail = val;
      this.$emit('change-detail', val);
    },
    onAreaConfirm: function onAreaConfirm(values) {
      values = values.filter(function (value) {
        return !!value;
      });
      if (values.some(function (value) {
        return !value.code;
      })) {
        Toast(t$o('areaEmpty'));
        return;
      }
      this.showAreaPopup = false;
      this.assignAreaValues();
      this.$emit('change-area', values);
    },
    assignAreaValues: function assignAreaValues() {
      var area = this.$refs.area;
      if (area) {
        var detail = area.getArea();
        detail.areaCode = detail.code;
        delete detail.code;
        _extends$1(this.data, detail);
      }
    },
    onSave: function onSave() {
      var _this = this;
      var items = ['name', 'tel'];
      if (this.showArea) {
        items.push('areaCode');
      }
      if (this.showDetail) {
        items.push('addressDetail');
      }
      if (this.showPostal) {
        items.push('postalCode');
      }
      var isValid = items.every(function (item) {
        var msg = _this.getErrorMessage(item);
        if (msg) {
          _this.errorInfo[item] = msg;
        }
        return !msg;
      });
      if (isValid && !this.isSaving) {
        this.$emit('save', this.data);
      }
    },
    getErrorMessage: function getErrorMessage(key) {
      var value = String(this.data[key] || '').trim();
      if (this.validator) {
        var message = this.validator(key, value);
        if (message) {
          return message;
        }
      }
      switch (key) {
        case 'name':
          return value ? '' : t$o('nameEmpty');
        case 'tel':
          return this.telValidator(value) ? '' : t$o('telInvalid');
        case 'areaCode':
          return value ? '' : t$o('areaEmpty');
        case 'addressDetail':
          return value ? '' : t$o('addressEmpty');
        case 'postalCode':
          return value && !this.postalValidator(value) ? t$o('postalEmpty') : '';
      }
    },
    onDelete: function onDelete() {
      var _this2 = this;
      Dialog.confirm({
        title: t$o('confirmDelete')
      }).then(function () {
        _this2.$emit('delete', _this2.data);
      }).catch(function () {
        _this2.$emit('cancel-delete', _this2.data);
      });
    },
    // get values of area component
    getArea: function getArea() {
      return this.$refs.area ? this.$refs.area.getValues() : [];
    },
    // set area code to area component
    setAreaCode: function setAreaCode(code) {
      this.data.areaCode = code || '';
      if (code) {
        this.$nextTick(this.assignAreaValues);
      }
    },
    // @exposed-api
    setAddressDetail: function setAddressDetail(value) {
      this.data.addressDetail = value;
    },
    onDetailBlur: function onDetailBlur() {
      var _this3 = this;

      // await for click search event
      setTimeout(function () {
        _this3.detailFocused = false;
      });
    },
    genSetDefaultCell: function genSetDefaultCell(h) {
      var _this4 = this;
      if (this.showSetDefault) {
        var slots = {
          'right-icon': function rightIcon() {
            return h(Switch, {
              "attrs": {
                "size": "24"
              },
              "on": {
                "change": function change(event) {
                  _this4.$emit('change-default', event);
                }
              },
              "model": {
                value: _this4.data.isDefault,
                callback: function callback($$v) {
                  _this4.$set(_this4.data, "isDefault", $$v);
                }
              }
            });
          }
        };
        return h(Cell$1, {
          "directives": [{
            name: "show",
            value: !this.hideBottomFields
          }],
          "attrs": {
            "center": true,
            "title": t$o('defaultAddress')
          },
          "class": bem$1f('default'),
          "scopedSlots": slots
        });
      }
      return h();
    }
  },
  render: function render(h) {
    var _this5 = this;
    var data = this.data,
      errorInfo = this.errorInfo,
      disableArea = this.disableArea,
      hideBottomFields = this.hideBottomFields;
    var onFocus = function onFocus(name) {
      return function () {
        return _this5.onFocus(name);
      };
    };
    return h("div", {
      "class": bem$1f()
    }, [h("div", {
      "class": bem$1f('fields')
    }, [h(Field, {
      "attrs": {
        "clearable": true,
        "label": t$o('name'),
        "placeholder": t$o('namePlaceholder'),
        "errorMessage": errorInfo.name
      },
      "on": {
        "focus": onFocus('name')
      },
      "model": {
        value: data.name,
        callback: function callback($$v) {
          _this5.$set(data, "name", $$v);
        }
      }
    }), h(Field, {
      "attrs": {
        "clearable": true,
        "type": "tel",
        "label": t$o('tel'),
        "maxlength": this.telMaxlength,
        "placeholder": t$o('telPlaceholder'),
        "errorMessage": errorInfo.tel
      },
      "on": {
        "focus": onFocus('tel')
      },
      "model": {
        value: data.tel,
        callback: function callback($$v) {
          _this5.$set(data, "tel", $$v);
        }
      }
    }), h(Field, {
      "directives": [{
        name: "show",
        value: this.showArea
      }],
      "attrs": {
        "readonly": true,
        "clickable": !disableArea,
        "label": t$o('area'),
        "placeholder": this.areaPlaceholder || t$o('areaPlaceholder'),
        "errorMessage": errorInfo.areaCode,
        "rightIcon": !disableArea ? 'arrow' : null,
        "value": this.areaText
      },
      "on": {
        "focus": onFocus('areaCode'),
        "click": function click() {
          _this5.$emit('click-area');
          _this5.showAreaPopup = !disableArea;
        }
      }
    }), h(Detail, {
      "directives": [{
        name: "show",
        value: this.showDetail
      }],
      "attrs": {
        "focused": this.detailFocused,
        "value": data.addressDetail,
        "errorMessage": errorInfo.addressDetail,
        "detailRows": this.detailRows,
        "detailMaxlength": this.detailMaxlength,
        "searchResult": this.searchResult,
        "showSearchResult": this.showSearchResult
      },
      "on": {
        "focus": onFocus('addressDetail'),
        "blur": this.onDetailBlur,
        "input": this.onChangeDetail,
        "select-search": function selectSearch(event) {
          _this5.$emit('select-search', event);
        }
      }
    }), this.showPostal && h(Field, {
      "directives": [{
        name: "show",
        value: !hideBottomFields
      }],
      "attrs": {
        "type": "tel",
        "maxlength": "6",
        "label": t$o('postal'),
        "placeholder": t$o('postal'),
        "errorMessage": errorInfo.postalCode
      },
      "on": {
        "focus": onFocus('postalCode')
      },
      "model": {
        value: data.postalCode,
        callback: function callback($$v) {
          _this5.$set(data, "postalCode", $$v);
        }
      }
    }), this.slots()]), this.genSetDefaultCell(h), h("div", {
      "directives": [{
        name: "show",
        value: !hideBottomFields
      }],
      "class": bem$1f('buttons')
    }, [h(Button$2, {
      "attrs": {
        "block": true,
        "round": true,
        "loading": this.isSaving,
        "type": "danger",
        "text": this.saveButtonText || t$o('save')
      },
      "on": {
        "click": this.onSave
      }
    }), this.showDelete && h(Button$2, {
      "attrs": {
        "block": true,
        "round": true,
        "loading": this.isDeleting,
        "text": this.deleteButtonText || t$o('delete')
      },
      "on": {
        "click": this.onDelete
      }
    })]), h(Popup, {
      "attrs": {
        "round": true,
        "position": "bottom",
        "lazyRender": false,
        "getContainer": "body"
      },
      "model": {
        value: _this5.showAreaPopup,
        callback: function callback($$v) {
          _this5.showAreaPopup = $$v;
        }
      }
    }, [h(Area, {
      "ref": "area",
      "attrs": {
        "value": data.areaCode,
        "loading": !this.areaListLoaded,
        "areaList": this.areaList,
        "columnsPlaceholder": this.areaColumnsPlaceholder
      },
      "on": {
        "confirm": this.onAreaConfirm,
        "cancel": function cancel() {
          _this5.showAreaPopup = false;
        }
      }
    })])]);
  }
});

var _createNamespace$1j = createNamespace('radio-group'),
  createComponent$1n = _createNamespace$1j[0],
  bem$1e = _createNamespace$1j[1];
var RadioGroup = createComponent$1n({
  mixins: [ParentMixin('vanRadio'), FieldMixin],
  props: {
    value: null,
    disabled: Boolean,
    direction: String,
    checkedColor: String,
    iconSize: [Number, String]
  },
  watch: {
    value: function value(_value) {
      this.$emit('change', _value);
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$1e([this.direction]),
      "attrs": {
        "role": "radiogroup"
      }
    }, [this.slots()]);
  }
});

var _createNamespace$1i = createNamespace('tag'),
  createComponent$1m = _createNamespace$1i[0],
  bem$1d = _createNamespace$1i[1];
function Tag(h, props, slots, ctx) {
  var _style;
  var type = props.type,
    mark = props.mark,
    plain = props.plain,
    color = props.color,
    round = props.round,
    size = props.size,
    textColor = props.textColor;
  var key = plain ? 'color' : 'backgroundColor';
  var style = (_style = {}, _style[key] = color, _style);
  if (plain) {
    style.color = textColor || color;
    style.borderColor = color;
  } else {
    style.color = textColor;
    style.background = color;
  }
  var classes = {
    mark: mark,
    plain: plain,
    round: round
  };
  if (size) {
    classes[size] = size;
  }
  var CloseIcon = props.closeable && h(Icon$3, {
    "attrs": {
      "name": "cross"
    },
    "class": bem$1d('close'),
    "on": {
      "click": function click(event) {
        event.stopPropagation();
        emit(ctx, 'close');
      }
    }
  });
  return h("transition", {
    "attrs": {
      "name": props.closeable ? 'van-fade' : null
    }
  }, [h("span", _mergeJSXProps([{
    "key": "content",
    "style": style,
    "class": bem$1d([classes, type])
  }, inherit(ctx, true)]), [slots.default == null ? void 0 : slots.default(), CloseIcon])]);
}
Tag.props = {
  size: String,
  mark: Boolean,
  color: String,
  plain: Boolean,
  round: Boolean,
  textColor: String,
  closeable: Boolean,
  type: {
    type: String,
    default: 'default'
  }
};
var Tag$1 = createComponent$1m(Tag);

/**
 * Common part of Checkbox & Radio
 */
var CheckboxMixin = function CheckboxMixin(_ref) {
  var parent = _ref.parent,
    bem = _ref.bem,
    role = _ref.role;
  return {
    mixins: [ChildrenMixin(parent), FieldMixin],
    props: {
      name: null,
      value: null,
      disabled: Boolean,
      iconSize: [Number, String],
      checkedColor: String,
      labelPosition: String,
      labelDisabled: Boolean,
      shape: {
        type: String,
        default: 'round'
      },
      bindGroup: {
        type: Boolean,
        default: true
      }
    },
    computed: {
      disableBindRelation: function disableBindRelation() {
        return !this.bindGroup;
      },
      isDisabled: function isDisabled() {
        return this.parent && this.parent.disabled || this.disabled;
      },
      direction: function direction() {
        return this.parent && this.parent.direction || null;
      },
      iconStyle: function iconStyle() {
        var checkedColor = this.checkedColor || this.parent && this.parent.checkedColor;
        if (checkedColor && this.checked && !this.isDisabled) {
          return {
            borderColor: checkedColor,
            backgroundColor: checkedColor
          };
        }
      },
      tabindex: function tabindex() {
        if (this.isDisabled || role === 'radio' && !this.checked) {
          return -1;
        }
        return 0;
      }
    },
    methods: {
      onClick: function onClick(event) {
        var _this = this;
        var target = event.target;
        var icon = this.$refs.icon;
        var iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));
        if (!this.isDisabled && (iconClicked || !this.labelDisabled)) {
          this.toggle(); // wait for toggle method to complete
          // so we can get the changed value in the click event listener

          setTimeout(function () {
            _this.$emit('click', event);
          });
        } else {
          this.$emit('click', event);
        }
      },
      genIcon: function genIcon() {
        var h = this.$createElement;
        var checked = this.checked;
        var iconSize = this.iconSize || this.parent && this.parent.iconSize;
        return h("div", {
          "ref": "icon",
          "class": bem('icon', [this.shape, {
            disabled: this.isDisabled,
            checked: checked
          }]),
          "style": {
            fontSize: addUnit(iconSize)
          }
        }, [this.slots('icon', {
          checked: checked
        }) || h(Icon$3, {
          "attrs": {
            "name": "success"
          },
          "style": this.iconStyle
        })]);
      },
      genLabel: function genLabel() {
        var h = this.$createElement;
        var slot = this.slots();
        if (slot) {
          return h("span", {
            "class": bem('label', [this.labelPosition, {
              disabled: this.isDisabled
            }])
          }, [slot]);
        }
      }
    },
    render: function render() {
      var h = arguments[0];
      var Children = [this.genIcon()];
      if (this.labelPosition === 'left') {
        Children.unshift(this.genLabel());
      } else {
        Children.push(this.genLabel());
      }
      return h("div", {
        "attrs": {
          "role": role,
          "tabindex": this.tabindex,
          "aria-checked": String(this.checked)
        },
        "class": bem([{
          disabled: this.isDisabled,
          'label-disabled': this.labelDisabled
        }, this.direction]),
        "on": {
          "click": this.onClick
        }
      }, [Children]);
    }
  };
};

var _createNamespace$1h = createNamespace('radio'),
  createComponent$1l = _createNamespace$1h[0],
  bem$1c = _createNamespace$1h[1];
var Radio = createComponent$1l({
  mixins: [CheckboxMixin({
    bem: bem$1c,
    role: 'radio',
    parent: 'vanRadio'
  })],
  computed: {
    currentValue: {
      get: function get() {
        return this.parent ? this.parent.value : this.value;
      },
      set: function set(val) {
        (this.parent || this).$emit('input', val);
      }
    },
    checked: function checked() {
      return this.currentValue === this.name;
    }
  },
  methods: {
    toggle: function toggle() {
      this.currentValue = this.name;
    }
  }
});

var _createNamespace$1g = createNamespace('address-item'),
  createComponent$1k = _createNamespace$1g[0],
  bem$1b = _createNamespace$1g[1];
function AddressItem(h, props, slots, ctx) {
  var disabled = props.disabled,
    switchable = props.switchable;
  function onClick() {
    if (switchable) {
      emit(ctx, 'select');
    }
    emit(ctx, 'click');
  }
  var genRightIcon = function genRightIcon() {
    return h(Icon$3, {
      "attrs": {
        "name": "edit"
      },
      "class": bem$1b('edit'),
      "on": {
        "click": function click(event) {
          event.stopPropagation();
          emit(ctx, 'edit');
          emit(ctx, 'click');
        }
      }
    });
  };
  function genTag() {
    if (slots.tag) {
      return slots.tag(_extends$1({}, props.data));
    }
    if (props.data.isDefault && props.defaultTagText) {
      return h(Tag$1, {
        "attrs": {
          "type": "danger",
          "round": true
        },
        "class": bem$1b('tag')
      }, [props.defaultTagText]);
    }
  }
  function genContent() {
    var data = props.data;
    var Info = [h("div", {
      "class": bem$1b('name')
    }, [data.name + " " + data.tel, genTag()]), h("div", {
      "class": bem$1b('address')
    }, [data.address])];
    if (switchable && !disabled) {
      return h(Radio, {
        "attrs": {
          "name": data.id,
          "iconSize": 18
        }
      }, [Info]);
    }
    return Info;
  }
  return h("div", {
    "class": bem$1b({
      disabled: disabled
    }),
    "on": {
      "click": onClick
    }
  }, [h(Cell$1, _mergeJSXProps([{
    "attrs": {
      "border": false,
      "valueClass": bem$1b('value')
    },
    "scopedSlots": {
      default: genContent,
      'right-icon': genRightIcon
    }
  }, inherit(ctx)])), slots.bottom == null ? void 0 : slots.bottom(_extends$1({}, props.data, {
    disabled: disabled
  }))]);
}
AddressItem.props = {
  data: Object,
  disabled: Boolean,
  switchable: Boolean,
  defaultTagText: String
};
var AddressItem$1 = createComponent$1k(AddressItem);

var _createNamespace$1f = createNamespace('address-list'),
  createComponent$1j = _createNamespace$1f[0],
  bem$1a = _createNamespace$1f[1],
  t$n = _createNamespace$1f[2];
function AddressList(h, props, slots, ctx) {
  function genList(list, disabled) {
    if (!list) {
      return;
    }
    return list.map(function (item, index) {
      return h(AddressItem$1, {
        "attrs": {
          "data": item,
          "disabled": disabled,
          "switchable": props.switchable,
          "defaultTagText": props.defaultTagText
        },
        "key": item.id,
        "scopedSlots": {
          bottom: slots['item-bottom'],
          tag: slots.tag
        },
        "on": {
          "select": function select() {
            emit(ctx, disabled ? 'select-disabled' : 'select', item, index);
            if (!disabled) {
              emit(ctx, 'input', item.id);
            }
          },
          "edit": function edit() {
            emit(ctx, disabled ? 'edit-disabled' : 'edit', item, index);
          },
          "click": function click() {
            emit(ctx, 'click-item', item, index);
          }
        }
      });
    });
  }
  var List = genList(props.list);
  var DisabledList = genList(props.disabledList, true);
  return h("div", _mergeJSXProps([{
    "class": bem$1a()
  }, inherit(ctx)]), [slots.top == null ? void 0 : slots.top(), h(RadioGroup, {
    "attrs": {
      "value": props.value
    }
  }, [List]), props.disabledText && h("div", {
    "class": bem$1a('disabled-text')
  }, [props.disabledText]), DisabledList, slots.default == null ? void 0 : slots.default(), h("div", {
    "class": bem$1a('bottom')
  }, [h(Button$2, {
    "attrs": {
      "round": true,
      "block": true,
      "type": "danger",
      "text": props.addButtonText || t$n('add')
    },
    "class": bem$1a('add'),
    "on": {
      "click": function click() {
        emit(ctx, 'add');
      }
    }
  })])]);
}
AddressList.props = {
  list: Array,
  value: [Number, String],
  disabledList: Array,
  disabledText: String,
  addButtonText: String,
  defaultTagText: String,
  switchable: {
    type: Boolean,
    default: true
  }
};
var AddressList$1 = createComponent$1j(AddressList);

var _createNamespace$1e = createNamespace('badge'),
  createComponent$1i = _createNamespace$1e[0],
  bem$19 = _createNamespace$1e[1];
var Badge = createComponent$1i({
  props: {
    dot: Boolean,
    max: [Number, String],
    color: String,
    content: [Number, String],
    tag: {
      type: String,
      default: 'div'
    }
  },
  methods: {
    hasContent: function hasContent() {
      return !!(this.$scopedSlots.content || isDef$1(this.content) && this.content !== '');
    },
    renderContent: function renderContent() {
      var dot = this.dot,
        max = this.max,
        content = this.content;
      if (!dot && this.hasContent()) {
        if (this.$scopedSlots.content) {
          return this.$scopedSlots.content();
        }
        if (isDef$1(max) && isNumeric$1(content) && +content > max) {
          return max + "+";
        }
        return content;
      }
    },
    renderBadge: function renderBadge() {
      var h = this.$createElement;
      if (this.hasContent() || this.dot) {
        return h("div", {
          "class": bem$19({
            dot: this.dot,
            fixed: !!this.$scopedSlots.default
          }),
          "style": {
            background: this.color
          }
        }, [this.renderContent()]);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    if (this.$scopedSlots.default) {
      var tag = this.tag;
      return h(tag, {
        "class": bem$19('wrapper')
      }, [this.$scopedSlots.default(), this.renderBadge()]);
    }
    return this.renderBadge();
  }
});

/**
 * requestAnimationFrame polyfill
 */
var prev = Date.now();
/* istanbul ignore next */

function fallback(fn) {
  var curr = Date.now();
  var ms = Math.max(0, 16 - (curr - prev));
  var id = setTimeout(fn, ms);
  prev = curr + ms;
  return id;
}
/* istanbul ignore next */

var root = isServer$1 ? global : window;
/* istanbul ignore next */

var iRaf = root.requestAnimationFrame || fallback;
/* istanbul ignore next */

var iCancel = root.cancelAnimationFrame || root.clearTimeout;
function raf(fn) {
  return iRaf.call(root, fn);
} // double raf for animation

function doubleRaf(fn) {
  raf(function () {
    raf(fn);
  });
}
function cancelRaf(id) {
  iCancel.call(root, id);
}

function isDate$1(val) {
  return Object.prototype.toString.call(val) === '[object Date]' && !isNaN$1(val.getTime());
}

var _createNamespace$1d = createNamespace('calendar'),
  createComponent$1h = _createNamespace$1d[0],
  bem$18 = _createNamespace$1d[1],
  t$m = _createNamespace$1d[2];
function formatMonthTitle(date) {
  return t$m('monthTitle', date.getFullYear(), date.getMonth() + 1);
}
function compareMonth(date1, date2) {
  var year1 = date1.getFullYear();
  var year2 = date2.getFullYear();
  var month1 = date1.getMonth();
  var month2 = date2.getMonth();
  if (year1 === year2) {
    return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
  }
  return year1 > year2 ? 1 : -1;
}
function compareDay(day1, day2) {
  var compareMonthResult = compareMonth(day1, day2);
  if (compareMonthResult === 0) {
    var date1 = day1.getDate();
    var date2 = day2.getDate();
    return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
  }
  return compareMonthResult;
}
function getDayByOffset(date, offset) {
  date = new Date(date);
  date.setDate(date.getDate() + offset);
  return date;
}
function getPrevDay(date) {
  return getDayByOffset(date, -1);
}
function getNextDay(date) {
  return getDayByOffset(date, 1);
}
function calcDateNum(date) {
  var day1 = date[0].getTime();
  var day2 = date[1].getTime();
  return (day2 - day1) / (1000 * 60 * 60 * 24) + 1;
}
function copyDate(dates) {
  return new Date(dates);
}
function copyDates(dates) {
  if (Array.isArray(dates)) {
    return dates.map(function (date) {
      if (date === null) {
        return date;
      }
      return copyDate(date);
    });
  }
  return copyDate(dates);
}

function times(n, iteratee) {
  if (n < 0) {
    return [];
  }
  var index = -1;
  var result = Array(n);
  while (++index < n) {
    result[index] = iteratee(index);
  }
  return result;
}
function getTrueValue(value) {
  if (!value) {
    return 0;
  }
  while (isNaN$1(parseInt(value, 10))) {
    if (value.length > 1) {
      value = value.slice(1);
    } else {
      return 0;
    }
  }
  return parseInt(value, 10);
}
function getMonthEndDay(year, month) {
  return 32 - new Date(year, month - 1, 32).getDate();
}

var _createNamespace$1c = createNamespace('calendar-month'),
  createComponent$1g = _createNamespace$1c[0];
var Month = createComponent$1g({
  props: {
    date: Date,
    type: String,
    color: String,
    minDate: Date,
    maxDate: Date,
    showMark: Boolean,
    rowHeight: [Number, String],
    formatter: Function,
    lazyRender: Boolean,
    currentDate: [Date, Array],
    allowSameDay: Boolean,
    showSubtitle: Boolean,
    showMonthTitle: Boolean,
    firstDayOfWeek: Number
  },
  data: function data() {
    return {
      visible: false
    };
  },
  computed: {
    title: function title() {
      return formatMonthTitle(this.date);
    },
    rowHeightWithUnit: function rowHeightWithUnit() {
      return addUnit(this.rowHeight);
    },
    offset: function offset() {
      var firstDayOfWeek = this.firstDayOfWeek;
      var realDay = this.date.getDay();
      if (!firstDayOfWeek) {
        return realDay;
      }
      return (realDay + 7 - this.firstDayOfWeek) % 7;
    },
    totalDay: function totalDay() {
      return getMonthEndDay(this.date.getFullYear(), this.date.getMonth() + 1);
    },
    shouldRender: function shouldRender() {
      return this.visible || !this.lazyRender;
    },
    placeholders: function placeholders() {
      var rows = [];
      var count = Math.ceil((this.totalDay + this.offset) / 7);
      for (var day = 1; day <= count; day++) {
        rows.push({
          type: 'placeholder'
        });
      }
      return rows;
    },
    days: function days() {
      var days = [];
      var year = this.date.getFullYear();
      var month = this.date.getMonth();
      for (var day = 1; day <= this.totalDay; day++) {
        var date = new Date(year, month, day);
        var type = this.getDayType(date);
        var config = {
          date: date,
          type: type,
          text: day,
          bottomInfo: this.getBottomInfo(type)
        };
        if (this.formatter) {
          config = this.formatter(config);
        }
        days.push(config);
      }
      return days;
    }
  },
  methods: {
    getHeight: function getHeight() {
      var _this$$el;
      return ((_this$$el = this.$el) == null ? void 0 : _this$$el.getBoundingClientRect().height) || 0;
    },
    scrollIntoView: function scrollIntoView(body) {
      var _this$$refs = this.$refs,
        days = _this$$refs.days,
        month = _this$$refs.month;
      var el = this.showSubtitle ? days : month;
      var scrollTop = el.getBoundingClientRect().top - body.getBoundingClientRect().top + body.scrollTop;
      setScrollTop(body, scrollTop);
    },
    getMultipleDayType: function getMultipleDayType(day) {
      var _this = this;
      var isSelected = function isSelected(date) {
        return _this.currentDate.some(function (item) {
          return compareDay(item, date) === 0;
        });
      };
      if (isSelected(day)) {
        var prevDay = getPrevDay(day);
        var nextDay = getNextDay(day);
        var prevSelected = isSelected(prevDay);
        var nextSelected = isSelected(nextDay);
        if (prevSelected && nextSelected) {
          return 'multiple-middle';
        }
        if (prevSelected) {
          return 'end';
        }
        return nextSelected ? 'start' : 'multiple-selected';
      }
      return '';
    },
    getRangeDayType: function getRangeDayType(day) {
      var _this$currentDate = this.currentDate,
        startDay = _this$currentDate[0],
        endDay = _this$currentDate[1];
      if (!startDay) {
        return '';
      }
      var compareToStart = compareDay(day, startDay);
      if (!endDay) {
        return compareToStart === 0 ? 'start' : '';
      }
      var compareToEnd = compareDay(day, endDay);
      if (compareToStart === 0 && compareToEnd === 0 && this.allowSameDay) {
        return 'start-end';
      }
      if (compareToStart === 0) {
        return 'start';
      }
      if (compareToEnd === 0) {
        return 'end';
      }
      if (compareToStart > 0 && compareToEnd < 0) {
        return 'middle';
      }
    },
    getDayType: function getDayType(day) {
      var type = this.type,
        minDate = this.minDate,
        maxDate = this.maxDate,
        currentDate = this.currentDate;
      if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
        return 'disabled';
      }
      if (currentDate === null) {
        return;
      }
      if (type === 'single') {
        return compareDay(day, currentDate) === 0 ? 'selected' : '';
      }
      if (type === 'multiple') {
        return this.getMultipleDayType(day);
      }
      /* istanbul ignore else */

      if (type === 'range') {
        return this.getRangeDayType(day);
      }
    },
    getBottomInfo: function getBottomInfo(type) {
      if (this.type === 'range') {
        if (type === 'start' || type === 'end') {
          return t$m(type);
        }
        if (type === 'start-end') {
          return t$m('startEnd');
        }
      }
    },
    getDayStyle: function getDayStyle(type, index) {
      var style = {
        height: this.rowHeightWithUnit
      };
      if (type === 'placeholder') {
        style.width = '100%';
        return style;
      }
      if (index === 0) {
        style.marginLeft = 100 * this.offset / 7 + "%";
      }
      if (this.color) {
        if (type === 'start' || type === 'end' || type === 'start-end' || type === 'multiple-selected' || type === 'multiple-middle') {
          style.background = this.color;
        } else if (type === 'middle') {
          style.color = this.color;
        }
      }
      return style;
    },
    genTitle: function genTitle() {
      var h = this.$createElement;
      if (this.showMonthTitle) {
        return h("div", {
          "class": bem$18('month-title')
        }, [this.title]);
      }
    },
    genMark: function genMark() {
      var h = this.$createElement;
      if (this.showMark && this.shouldRender) {
        return h("div", {
          "class": bem$18('month-mark')
        }, [this.date.getMonth() + 1]);
      }
    },
    genDays: function genDays() {
      var h = this.$createElement;
      var days = this.shouldRender ? this.days : this.placeholders;
      return h("div", {
        "ref": "days",
        "attrs": {
          "role": "grid"
        },
        "class": bem$18('days')
      }, [this.genMark(), days.map(this.genDay)]);
    },
    genTopInfo: function genTopInfo(item) {
      var h = this.$createElement;
      var slot = this.$scopedSlots['top-info'];
      if (item.topInfo || slot) {
        return h("div", {
          "class": bem$18('top-info')
        }, [slot ? slot(item) : item.topInfo]);
      }
    },
    genBottomInfo: function genBottomInfo(item) {
      var h = this.$createElement;
      var slot = this.$scopedSlots['bottom-info'];
      if (item.bottomInfo || slot) {
        return h("div", {
          "class": bem$18('bottom-info')
        }, [slot ? slot(item) : item.bottomInfo]);
      }
    },
    genDay: function genDay(item, index) {
      var _this2 = this;
      var h = this.$createElement;
      var type = item.type;
      var style = this.getDayStyle(type, index);
      var disabled = type === 'disabled';
      var onClick = function onClick() {
        if (!disabled) {
          _this2.$emit('click', item);
        }
      };
      if (type === 'selected') {
        return h("div", {
          "attrs": {
            "role": "gridcell",
            "tabindex": -1
          },
          "style": style,
          "class": [bem$18('day'), item.className],
          "on": {
            "click": onClick
          }
        }, [h("div", {
          "class": bem$18('selected-day'),
          "style": {
            width: this.rowHeightWithUnit,
            height: this.rowHeightWithUnit,
            background: this.color
          }
        }, [this.genTopInfo(item), item.text, this.genBottomInfo(item)])]);
      }
      return h("div", {
        "attrs": {
          "role": "gridcell",
          "tabindex": disabled ? null : -1
        },
        "style": style,
        "class": [bem$18('day', type), item.className],
        "on": {
          "click": onClick
        }
      }, [this.genTopInfo(item), item.text, this.genBottomInfo(item)]);
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$18('month'),
      "ref": "month"
    }, [this.genTitle(), this.genDays()]);
  }
});

var _createNamespace$1b = createNamespace('calendar-header'),
  createComponent$1f = _createNamespace$1b[0];
var Header = createComponent$1f({
  props: {
    title: String,
    subtitle: String,
    showTitle: Boolean,
    showSubtitle: Boolean,
    firstDayOfWeek: Number
  },
  methods: {
    genTitle: function genTitle() {
      var h = this.$createElement;
      if (this.showTitle) {
        var title = this.slots('title') || this.title || t$m('title');
        return h("div", {
          "class": bem$18('header-title')
        }, [title]);
      }
    },
    genSubtitle: function genSubtitle() {
      var h = this.$createElement;
      if (this.showSubtitle) {
        return h("div", {
          "class": bem$18('header-subtitle')
        }, [this.subtitle]);
      }
    },
    genWeekDays: function genWeekDays() {
      var h = this.$createElement;
      var weekdays = t$m('weekdays');
      var firstDayOfWeek = this.firstDayOfWeek;
      var renderWeekDays = [].concat(weekdays.slice(firstDayOfWeek, 7), weekdays.slice(0, firstDayOfWeek));
      return h("div", {
        "class": bem$18('weekdays')
      }, [renderWeekDays.map(function (item) {
        return h("span", {
          "class": bem$18('weekday')
        }, [item]);
      })]);
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$18('header')
    }, [this.genTitle(), this.genSubtitle(), this.genWeekDays()]);
  }
});

// Utils
var Calendar$2 = createComponent$1h({
  props: {
    title: String,
    color: String,
    value: Boolean,
    readonly: Boolean,
    formatter: Function,
    rowHeight: [Number, String],
    confirmText: String,
    rangePrompt: String,
    defaultDate: [Date, Array],
    getContainer: [String, Function],
    allowSameDay: Boolean,
    confirmDisabledText: String,
    type: {
      type: String,
      default: 'single'
    },
    round: {
      type: Boolean,
      default: true
    },
    position: {
      type: String,
      default: 'bottom'
    },
    poppable: {
      type: Boolean,
      default: true
    },
    maxRange: {
      type: [Number, String],
      default: null
    },
    lazyRender: {
      type: Boolean,
      default: true
    },
    showMark: {
      type: Boolean,
      default: true
    },
    showTitle: {
      type: Boolean,
      default: true
    },
    showConfirm: {
      type: Boolean,
      default: true
    },
    showSubtitle: {
      type: Boolean,
      default: true
    },
    closeOnPopstate: {
      type: Boolean,
      default: true
    },
    closeOnClickOverlay: {
      type: Boolean,
      default: true
    },
    safeAreaInsetBottom: {
      type: Boolean,
      default: true
    },
    minDate: {
      type: Date,
      validator: isDate$1,
      default: function _default() {
        return new Date();
      }
    },
    maxDate: {
      type: Date,
      validator: isDate$1,
      default: function _default() {
        var now = new Date();
        return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
      }
    },
    firstDayOfWeek: {
      type: [Number, String],
      default: 0,
      validator: function validator(val) {
        return val >= 0 && val <= 6;
      }
    }
  },
  inject: {
    vanPopup: {
      default: null
    }
  },
  data: function data() {
    return {
      subtitle: '',
      currentDate: this.getInitialDate()
    };
  },
  computed: {
    months: function months() {
      var months = [];
      var cursor = new Date(this.minDate);
      cursor.setDate(1);
      do {
        months.push(new Date(cursor));
        cursor.setMonth(cursor.getMonth() + 1);
      } while (compareMonth(cursor, this.maxDate) !== 1);
      return months;
    },
    buttonDisabled: function buttonDisabled() {
      var type = this.type,
        currentDate = this.currentDate;
      if (currentDate) {
        if (type === 'range') {
          return !currentDate[0] || !currentDate[1];
        }
        if (type === 'multiple') {
          return !currentDate.length;
        }
      }
      return !currentDate;
    },
    dayOffset: function dayOffset() {
      return this.firstDayOfWeek ? this.firstDayOfWeek % 7 : 0;
    }
  },
  watch: {
    value: 'init',
    type: function type() {
      this.reset();
    },
    defaultDate: function defaultDate(val) {
      this.currentDate = val;
      this.scrollIntoView();
    }
  },
  mounted: function mounted() {
    this.init(); // https://github.com/vant-ui/vant/issues/9845

    if (!this.poppable) {
      var _this$vanPopup;
      (_this$vanPopup = this.vanPopup) == null ? void 0 : _this$vanPopup.$on('opened', this.onScroll);
    }
  },
  /* istanbul ignore next */
  activated: function activated() {
    this.init();
  },
  methods: {
    // @exposed-api
    reset: function reset(date) {
      if (date === void 0) {
        date = this.getInitialDate();
      }
      this.currentDate = date;
      this.scrollIntoView();
    },
    init: function init() {
      var _this = this;
      if (this.poppable && !this.value) {
        return;
      }
      this.$nextTick(function () {
        // add Math.floor to avoid decimal height issues
        // https://github.com/vant-ui/vant/issues/5640
        _this.bodyHeight = Math.floor(_this.$refs.body.getBoundingClientRect().height);
        _this.onScroll();
        _this.scrollIntoView();
      });
    },
    // @exposed-api
    scrollToDate: function scrollToDate(targetDate) {
      var _this2 = this;
      raf(function () {
        var displayed = _this2.value || !_this2.poppable;
        /* istanbul ignore if */

        if (!targetDate || !displayed) {
          return;
        }
        _this2.months.some(function (month, index) {
          if (compareMonth(month, targetDate) === 0) {
            var _this2$$refs = _this2.$refs,
              body = _this2$$refs.body,
              months = _this2$$refs.months;
            months[index].scrollIntoView(body);
            return true;
          }
          return false;
        });
        _this2.onScroll();
      });
    },
    // scroll to current month
    scrollIntoView: function scrollIntoView() {
      var currentDate = this.currentDate;
      if (currentDate) {
        var targetDate = this.type === 'single' ? currentDate : currentDate[0];
        this.scrollToDate(targetDate);
      }
    },
    getInitialDate: function getInitialDate() {
      var type = this.type,
        minDate = this.minDate,
        maxDate = this.maxDate,
        defaultDate = this.defaultDate;
      if (defaultDate === null) {
        return defaultDate;
      }
      var defaultVal = new Date();
      if (compareDay(defaultVal, minDate) === -1) {
        defaultVal = minDate;
      } else if (compareDay(defaultVal, maxDate) === 1) {
        defaultVal = maxDate;
      }
      if (type === 'range') {
        var _ref = defaultDate || [],
          startDay = _ref[0],
          endDay = _ref[1];
        return [startDay || defaultVal, endDay || getNextDay(defaultVal)];
      }
      if (type === 'multiple') {
        return defaultDate || [defaultVal];
      }
      return defaultDate || defaultVal;
    },
    // calculate the position of the elements
    // and find the elements that needs to be rendered
    onScroll: function onScroll() {
      var _this$$refs = this.$refs,
        body = _this$$refs.body,
        months = _this$$refs.months;
      var top = getScrollTop(body);
      var bottom = top + this.bodyHeight;
      var heights = months.map(function (item) {
        return item.getHeight();
      });
      var heightSum = heights.reduce(function (a, b) {
        return a + b;
      }, 0); // iOS scroll bounce may exceed the range

      if (bottom > heightSum && top > 0) {
        return;
      }
      var height = 0;
      var currentMonth;
      var visibleRange = [-1, -1];
      for (var i = 0; i < months.length; i++) {
        var visible = height <= bottom && height + heights[i] >= top;
        if (visible) {
          visibleRange[1] = i;
          if (!currentMonth) {
            currentMonth = months[i];
            visibleRange[0] = i;
          }
          if (!months[i].showed) {
            months[i].showed = true;
            this.$emit('month-show', {
              date: months[i].date,
              title: months[i].title
            });
          }
        }
        height += heights[i];
      }
      months.forEach(function (month, index) {
        month.visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
      });
      /* istanbul ignore else */

      if (currentMonth) {
        this.subtitle = currentMonth.title;
      }
    },
    onClickDay: function onClickDay(item) {
      if (this.readonly) {
        return;
      }
      var date = item.date;
      var type = this.type,
        currentDate = this.currentDate;
      if (type === 'range') {
        if (!currentDate) {
          this.select([date, null]);
          return;
        }
        var startDay = currentDate[0],
          endDay = currentDate[1];
        if (startDay && !endDay) {
          var compareToStart = compareDay(date, startDay);
          if (compareToStart === 1) {
            this.select([startDay, date], true);
          } else if (compareToStart === -1) {
            this.select([date, null]);
          } else if (this.allowSameDay) {
            this.select([date, date], true);
          }
        } else {
          this.select([date, null]);
        }
      } else if (type === 'multiple') {
        if (!currentDate) {
          this.select([date]);
          return;
        }
        var selectedIndex;
        var selected = this.currentDate.some(function (dateItem, index) {
          var equal = compareDay(dateItem, date) === 0;
          if (equal) {
            selectedIndex = index;
          }
          return equal;
        });
        if (selected) {
          var _currentDate$splice = currentDate.splice(selectedIndex, 1),
            unselectedDate = _currentDate$splice[0];
          this.$emit('unselect', copyDate(unselectedDate));
        } else if (this.maxRange && currentDate.length >= this.maxRange) {
          Toast(this.rangePrompt || t$m('rangePrompt', this.maxRange));
        } else {
          this.select([].concat(currentDate, [date]));
        }
      } else {
        this.select(date, true);
      }
    },
    togglePopup: function togglePopup(val) {
      this.$emit('input', val);
    },
    select: function select(date, complete) {
      var _this3 = this;
      var emit = function emit(date) {
        _this3.currentDate = date;
        _this3.$emit('select', copyDates(_this3.currentDate));
      };
      if (complete && this.type === 'range') {
        var valid = this.checkRange(date);
        if (!valid) {
          // auto selected to max range if showConfirm
          if (this.showConfirm) {
            emit([date[0], getDayByOffset(date[0], this.maxRange - 1)]);
          } else {
            emit(date);
          }
          return;
        }
      }
      emit(date);
      if (complete && !this.showConfirm) {
        this.onConfirm();
      }
    },
    checkRange: function checkRange(date) {
      var maxRange = this.maxRange,
        rangePrompt = this.rangePrompt;
      if (maxRange && calcDateNum(date) > maxRange) {
        Toast(rangePrompt || t$m('rangePrompt', maxRange));
        return false;
      }
      return true;
    },
    onConfirm: function onConfirm() {
      this.$emit('confirm', copyDates(this.currentDate));
    },
    genMonth: function genMonth(date, index) {
      var h = this.$createElement;
      var showMonthTitle = index !== 0 || !this.showSubtitle;
      return h(Month, {
        "ref": "months",
        "refInFor": true,
        "attrs": {
          "date": date,
          "type": this.type,
          "color": this.color,
          "minDate": this.minDate,
          "maxDate": this.maxDate,
          "showMark": this.showMark,
          "formatter": this.formatter,
          "rowHeight": this.rowHeight,
          "lazyRender": this.lazyRender,
          "currentDate": this.currentDate,
          "showSubtitle": this.showSubtitle,
          "allowSameDay": this.allowSameDay,
          "showMonthTitle": showMonthTitle,
          "firstDayOfWeek": this.dayOffset
        },
        "scopedSlots": {
          'top-info': this.$scopedSlots['top-info'],
          'bottom-info': this.$scopedSlots['bottom-info']
        },
        "on": {
          "click": this.onClickDay
        }
      });
    },
    genFooterContent: function genFooterContent() {
      var h = this.$createElement;
      var slot = this.slots('footer');
      if (slot) {
        return slot;
      }
      if (this.showConfirm) {
        var text = this.buttonDisabled ? this.confirmDisabledText : this.confirmText;
        return h(Button$2, {
          "attrs": {
            "round": true,
            "block": true,
            "type": "danger",
            "color": this.color,
            "disabled": this.buttonDisabled,
            "nativeType": "button"
          },
          "class": bem$18('confirm'),
          "on": {
            "click": this.onConfirm
          }
        }, [text || t$m('confirm')]);
      }
    },
    genFooter: function genFooter() {
      var h = this.$createElement;
      return h("div", {
        "class": bem$18('footer', {
          unfit: !this.safeAreaInsetBottom
        })
      }, [this.genFooterContent()]);
    },
    genCalendar: function genCalendar() {
      var _this4 = this;
      var h = this.$createElement;
      return h("div", {
        "class": bem$18()
      }, [h(Header, {
        "attrs": {
          "title": this.title,
          "showTitle": this.showTitle,
          "subtitle": this.subtitle,
          "showSubtitle": this.showSubtitle,
          "firstDayOfWeek": this.dayOffset
        },
        "scopedSlots": {
          title: function title() {
            return _this4.slots('title');
          }
        }
      }), h("div", {
        "ref": "body",
        "class": bem$18('body'),
        "on": {
          "scroll": this.onScroll
        }
      }, [this.months.map(this.genMonth)]), this.genFooter()]);
    }
  },
  render: function render() {
    var _this5 = this;
    var h = arguments[0];
    if (this.poppable) {
      var _attrs;
      var createListener = function createListener(name) {
        return function () {
          return _this5.$emit(name);
        };
      };
      return h(Popup, {
        "attrs": (_attrs = {
          "round": true,
          "value": this.value
        }, _attrs["round"] = this.round, _attrs["position"] = this.position, _attrs["closeable"] = this.showTitle || this.showSubtitle, _attrs["getContainer"] = this.getContainer, _attrs["closeOnPopstate"] = this.closeOnPopstate, _attrs["closeOnClickOverlay"] = this.closeOnClickOverlay, _attrs),
        "class": bem$18('popup'),
        "on": {
          "input": this.togglePopup,
          "open": createListener('open'),
          "opened": createListener('opened'),
          "close": createListener('close'),
          "closed": createListener('closed')
        }
      }, [this.genCalendar()]);
    }
    return this.genCalendar();
  }
});

var _createNamespace$1a = createNamespace('image'),
  createComponent$1e = _createNamespace$1a[0],
  bem$17 = _createNamespace$1a[1];
var Image$1 = createComponent$1e({
  props: {
    src: String,
    fit: String,
    alt: String,
    round: Boolean,
    width: [Number, String],
    height: [Number, String],
    radius: [Number, String],
    lazyLoad: Boolean,
    iconPrefix: String,
    showError: {
      type: Boolean,
      default: true
    },
    showLoading: {
      type: Boolean,
      default: true
    },
    errorIcon: {
      type: String,
      default: 'photo-fail'
    },
    loadingIcon: {
      type: String,
      default: 'photo'
    }
  },
  data: function data() {
    return {
      loading: true,
      error: false
    };
  },
  watch: {
    src: function src() {
      this.loading = true;
      this.error = false;
    }
  },
  computed: {
    style: function style() {
      var style = {};
      if (isDef$1(this.width)) {
        style.width = addUnit(this.width);
      }
      if (isDef$1(this.height)) {
        style.height = addUnit(this.height);
      }
      if (isDef$1(this.radius)) {
        style.overflow = 'hidden';
        style.borderRadius = addUnit(this.radius);
      }
      return style;
    }
  },
  created: function created() {
    var $Lazyload = this.$Lazyload;
    if ($Lazyload && inBrowser$1) {
      $Lazyload.$on('loaded', this.onLazyLoaded);
      $Lazyload.$on('error', this.onLazyLoadError);
    }
  },
  beforeDestroy: function beforeDestroy() {
    var $Lazyload = this.$Lazyload;
    if ($Lazyload) {
      $Lazyload.$off('loaded', this.onLazyLoaded);
      $Lazyload.$off('error', this.onLazyLoadError);
    }
  },
  methods: {
    onLoad: function onLoad(event) {
      this.loading = false;
      this.$emit('load', event);
    },
    onLazyLoaded: function onLazyLoaded(_ref) {
      var el = _ref.el;
      if (el === this.$refs.image && this.loading) {
        this.onLoad();
      }
    },
    onLazyLoadError: function onLazyLoadError(_ref2) {
      var el = _ref2.el;
      if (el === this.$refs.image && !this.error) {
        this.onError();
      }
    },
    onError: function onError(event) {
      this.error = true;
      this.loading = false;
      this.$emit('error', event);
    },
    onClick: function onClick(event) {
      this.$emit('click', event);
    },
    genPlaceholder: function genPlaceholder() {
      var h = this.$createElement;
      if (this.loading && this.showLoading) {
        return h("div", {
          "class": bem$17('loading')
        }, [this.slots('loading') || h(Icon$3, {
          "attrs": {
            "name": this.loadingIcon,
            "classPrefix": this.iconPrefix
          },
          "class": bem$17('loading-icon')
        })]);
      }
      if (this.error && this.showError) {
        return h("div", {
          "class": bem$17('error')
        }, [this.slots('error') || h(Icon$3, {
          "attrs": {
            "name": this.errorIcon,
            "classPrefix": this.iconPrefix
          },
          "class": bem$17('error-icon')
        })]);
      }
    },
    genImage: function genImage() {
      var h = this.$createElement;
      var imgData = {
        class: bem$17('img'),
        attrs: {
          alt: this.alt
        },
        style: {
          objectFit: this.fit
        }
      };
      if (this.error) {
        return;
      }
      if (this.lazyLoad) {
        return h("img", _mergeJSXProps([{
          "ref": "image",
          "directives": [{
            name: "lazy",
            value: this.src
          }]
        }, imgData]));
      }
      return h("img", _mergeJSXProps([{
        "attrs": {
          "src": this.src
        },
        "on": {
          "load": this.onLoad,
          "error": this.onError
        }
      }, imgData]));
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$17({
        round: this.round
      }),
      "style": this.style,
      "on": {
        "click": this.onClick
      }
    }, [this.genImage(), this.genPlaceholder(), this.slots()]);
  }
});

var _createNamespace$19 = createNamespace('card'),
  createComponent$1d = _createNamespace$19[0],
  bem$16 = _createNamespace$19[1];
function Card(h, props, slots, ctx) {
  var _slots$priceTop;
  var thumb = props.thumb;
  var showNum = slots.num || isDef$1(props.num);
  var showPrice = slots.price || isDef$1(props.price);
  var showOriginPrice = slots['origin-price'] || isDef$1(props.originPrice);
  var showBottom = showNum || showPrice || showOriginPrice || slots.bottom;
  function onThumbClick(event) {
    emit(ctx, 'click-thumb', event);
  }
  function ThumbTag() {
    if (slots.tag || props.tag) {
      return h("div", {
        "class": bem$16('tag')
      }, [slots.tag ? slots.tag() : h(Tag$1, {
        "attrs": {
          "mark": true,
          "type": "danger"
        }
      }, [props.tag])]);
    }
  }
  function Thumb() {
    if (slots.thumb || thumb) {
      return h("a", {
        "attrs": {
          "href": props.thumbLink
        },
        "class": bem$16('thumb'),
        "on": {
          "click": onThumbClick
        }
      }, [slots.thumb ? slots.thumb() : h(Image$1, {
        "attrs": {
          "src": thumb,
          "width": "100%",
          "height": "100%",
          "fit": "cover",
          "lazy-load": props.lazyLoad
        }
      }), ThumbTag()]);
    }
  }
  function Title() {
    if (slots.title) {
      return slots.title();
    }
    if (props.title) {
      return h("div", {
        "class": [bem$16('title'), 'van-multi-ellipsis--l2']
      }, [props.title]);
    }
  }
  function Desc() {
    if (slots.desc) {
      return slots.desc();
    }
    if (props.desc) {
      return h("div", {
        "class": [bem$16('desc'), 'van-ellipsis']
      }, [props.desc]);
    }
  }
  function PriceContent() {
    var priceArr = props.price.toString().split('.');
    return h("div", [h("span", {
      "class": bem$16('price-currency')
    }, [props.currency]), h("span", {
      "class": bem$16('price-integer')
    }, [priceArr[0]]), ".", h("span", {
      "class": bem$16('price-decimal')
    }, [priceArr[1]])]);
  }
  function Price() {
    if (showPrice) {
      return h("div", {
        "class": bem$16('price')
      }, [slots.price ? slots.price() : PriceContent()]);
    }
  }
  function OriginPrice() {
    if (showOriginPrice) {
      var slot = slots['origin-price'];
      return h("div", {
        "class": bem$16('origin-price')
      }, [slot ? slot() : props.currency + " " + props.originPrice]);
    }
  }
  function Num() {
    if (showNum) {
      return h("div", {
        "class": bem$16('num')
      }, [slots.num ? slots.num() : "x" + props.num]);
    }
  }
  function Footer() {
    if (slots.footer) {
      return h("div", {
        "class": bem$16('footer')
      }, [slots.footer()]);
    }
  }
  return h("div", _mergeJSXProps([{
    "class": bem$16()
  }, inherit(ctx, true)]), [h("div", {
    "class": bem$16('header')
  }, [Thumb(), h("div", {
    "class": bem$16('content', {
      centered: props.centered
    })
  }, [h("div", [Title(), Desc(), slots.tags == null ? void 0 : slots.tags()]), showBottom && h("div", {
    "class": "van-card__bottom"
  }, [(_slots$priceTop = slots['price-top']) == null ? void 0 : _slots$priceTop.call(slots), Price(), OriginPrice(), Num(), slots.bottom == null ? void 0 : slots.bottom()])])]), Footer()]);
}
Card.props = {
  tag: String,
  desc: String,
  thumb: String,
  title: String,
  centered: Boolean,
  lazyLoad: Boolean,
  thumbLink: String,
  num: [Number, String],
  price: [Number, String],
  originPrice: [Number, String],
  currency: {
    type: String,
    default: '¥'
  }
};
var Card$1 = createComponent$1d(Card);

var _createNamespace$18 = createNamespace('tab'),
  createComponent$1c = _createNamespace$18[0],
  bem$15 = _createNamespace$18[1];
var Tab = createComponent$1c({
  mixins: [ChildrenMixin('vanTabs')],
  props: _extends$1({}, routeProps, {
    dot: Boolean,
    name: [Number, String],
    // @deprecated
    info: [Number, String],
    badge: [Number, String],
    title: String,
    titleStyle: null,
    titleClass: null,
    disabled: Boolean
  }),
  data: function data() {
    return {
      inited: false
    };
  },
  computed: {
    computedName: function computedName() {
      var _this$name;
      return (_this$name = this.name) != null ? _this$name : this.index;
    },
    isActive: function isActive() {
      var active = this.computedName === this.parent.currentName;
      if (active) {
        this.inited = true;
      }
      return active;
    }
  },
  watch: {
    title: function title() {
      this.parent.setLine();
      this.parent.scrollIntoView();
    },
    inited: function inited(val) {
      var _this = this;
      if (this.parent.lazyRender && val) {
        this.$nextTick(function () {
          _this.parent.$emit('rendered', _this.computedName, _this.title);
        });
      }
    }
  },
  render: function render(h) {
    var slots = this.slots,
      parent = this.parent,
      isActive = this.isActive;
    var slotContent = slots();
    if (!slotContent && !parent.animated) {
      return;
    }
    var show = parent.scrollspy || isActive;
    var shouldRender = this.inited || parent.scrollspy || !parent.lazyRender;
    var Content = shouldRender ? slotContent : h();
    if (parent.animated) {
      return h("div", {
        "attrs": {
          "role": "tabpanel",
          "aria-hidden": !isActive
        },
        "class": bem$15('pane-wrapper', {
          inactive: !isActive
        })
      }, [h("div", {
        "class": bem$15('pane')
      }, [Content])]);
    }
    return h("div", {
      "directives": [{
        name: "show",
        value: show
      }],
      "attrs": {
        "role": "tabpanel"
      },
      "class": bem$15('pane')
    }, [Content]);
  }
});

function scrollLeftTo(scroller, to, duration) {
  var count = 0;
  var from = scroller.scrollLeft;
  var frames = duration === 0 ? 1 : Math.round(duration * 1000 / 16);
  function animate() {
    scroller.scrollLeft += (to - from) / frames;
    if (++count < frames) {
      raf(animate);
    }
  }
  animate();
}
function scrollTopTo(scroller, to, duration, callback) {
  var current = getScrollTop(scroller);
  var isDown = current < to;
  var frames = duration === 0 ? 1 : Math.round(duration * 1000 / 16);
  var step = (to - current) / frames;
  function animate() {
    current += step;
    if (isDown && current > to || !isDown && current < to) {
      current = to;
    }
    setScrollTop(scroller, current);
    if (isDown && current < to || !isDown && current > to) {
      raf(animate);
    } else if (callback) {
      raf(callback);
    }
  }
  animate();
}

function isHidden(el) {
  var style = window.getComputedStyle(el);
  var hidden = style.display === 'none'; // offsetParent returns null in the following situations:
  // 1. The element or its parent element has the display property set to none.
  // 2. The element has the position property set to fixed

  var parentHidden = el.offsetParent === null && style.position !== 'fixed';
  return hidden || parentHidden;
}

function callInterceptor(options) {
  var interceptor = options.interceptor,
    args = options.args,
    done = options.done;
  if (interceptor) {
    var returnVal = interceptor.apply(void 0, args);
    if (isPromise$1(returnVal)) {
      returnVal.then(function (value) {
        if (value) {
          done();
        }
      }).catch(noop$3);
    } else if (returnVal) {
      done();
    }
  } else {
    done();
  }
}

var _createNamespace$17 = createNamespace('tab'),
  createComponent$1b = _createNamespace$17[0],
  bem$14 = _createNamespace$17[1];
var Title = createComponent$1b({
  props: {
    dot: Boolean,
    type: String,
    info: [Number, String],
    color: String,
    title: String,
    isActive: Boolean,
    disabled: Boolean,
    scrollable: Boolean,
    activeColor: String,
    inactiveColor: String
  },
  computed: {
    style: function style() {
      var style = {};
      var color = this.color,
        isActive = this.isActive;
      var isCard = this.type === 'card'; // card theme color

      if (color && isCard) {
        style.borderColor = color;
        if (!this.disabled) {
          if (isActive) {
            style.backgroundColor = color;
          } else {
            style.color = color;
          }
        }
      }
      var titleColor = isActive ? this.activeColor : this.inactiveColor;
      if (titleColor) {
        style.color = titleColor;
      }
      return style;
    }
  },
  methods: {
    onClick: function onClick() {
      this.$emit('click');
    },
    genText: function genText() {
      var h = this.$createElement;
      var Text = h("span", {
        "class": bem$14('text', {
          ellipsis: !this.scrollable
        })
      }, [this.slots() || this.title]);
      if (this.dot || isDef$1(this.info) && this.info !== '') {
        return h("span", {
          "class": bem$14('text-wrapper')
        }, [Text, h(Info$1, {
          "attrs": {
            "dot": this.dot,
            "info": this.info
          }
        })]);
      }
      return Text;
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "attrs": {
        "role": "tab",
        "aria-selected": this.isActive
      },
      "class": [bem$14({
        active: this.isActive,
        disabled: this.disabled
      })],
      "style": this.style,
      "on": {
        "click": this.onClick
      }
    }, [this.genText()]);
  }
});

var _createNamespace$16 = createNamespace('sticky'),
  createComponent$1a = _createNamespace$16[0],
  bem$13 = _createNamespace$16[1];
var Sticky = createComponent$1a({
  mixins: [BindEventMixin(function (bind, isBind) {
    if (!this.scroller) {
      this.scroller = getScroller(this.$el);
    }
    if (this.observer) {
      var method = isBind ? 'observe' : 'unobserve';
      this.observer[method](this.$el);
    }
    bind(this.scroller, 'scroll', this.onScroll, true);
    this.onScroll();
  })],
  props: {
    zIndex: [Number, String],
    container: null,
    offsetTop: {
      type: [Number, String],
      default: 0
    }
  },
  data: function data() {
    return {
      fixed: false,
      height: 0,
      transform: 0
    };
  },
  computed: {
    offsetTopPx: function offsetTopPx() {
      return unitToPx(this.offsetTop);
    },
    style: function style() {
      if (!this.fixed) {
        return;
      }
      var style = {};
      if (isDef$1(this.zIndex)) {
        style.zIndex = this.zIndex;
      }
      if (this.offsetTopPx && this.fixed) {
        style.top = this.offsetTopPx + "px";
      }
      if (this.transform) {
        style.transform = "translate3d(0, " + this.transform + "px, 0)";
      }
      return style;
    }
  },
  watch: {
    fixed: function fixed(isFixed) {
      this.$emit('change', isFixed);
    }
  },
  created: function created() {
    var _this = this;

    // compatibility: https://caniuse.com/#feat=intersectionobserver
    if (!isServer$1 && window.IntersectionObserver) {
      this.observer = new IntersectionObserver(function (entries) {
        // trigger scroll when visibility changed
        if (entries[0].intersectionRatio > 0) {
          _this.onScroll();
        }
      }, {
        root: document.body
      });
    }
  },
  methods: {
    onScroll: function onScroll() {
      var _this2 = this;
      if (isHidden(this.$el)) {
        return;
      }
      this.height = this.$el.offsetHeight;
      var container = this.container,
        offsetTopPx = this.offsetTopPx;
      var scrollTop = getScrollTop(window);
      var topToPageTop = getElementTop(this.$el);
      var emitScrollEvent = function emitScrollEvent() {
        _this2.$emit('scroll', {
          scrollTop: scrollTop,
          isFixed: _this2.fixed
        });
      }; // The sticky component should be kept inside the container element

      if (container) {
        var bottomToPageTop = topToPageTop + container.offsetHeight;
        if (scrollTop + offsetTopPx + this.height > bottomToPageTop) {
          var distanceToBottom = this.height + scrollTop - bottomToPageTop;
          if (distanceToBottom < this.height) {
            this.fixed = true;
            this.transform = -(distanceToBottom + offsetTopPx);
          } else {
            this.fixed = false;
          }
          emitScrollEvent();
          return;
        }
      }
      if (scrollTop + offsetTopPx > topToPageTop) {
        this.fixed = true;
        this.transform = 0;
      } else {
        this.fixed = false;
      }
      emitScrollEvent();
    }
  },
  render: function render() {
    var h = arguments[0];
    var fixed = this.fixed;
    var style = {
      height: fixed ? this.height + "px" : null
    };
    return h("div", {
      "style": style
    }, [h("div", {
      "class": bem$13({
        fixed: fixed
      }),
      "style": this.style
    }, [this.slots()])]);
  }
});

var _createNamespace$15 = createNamespace('tabs'),
  createComponent$19 = _createNamespace$15[0],
  bem$12 = _createNamespace$15[1];
var MIN_SWIPE_DISTANCE = 50;
var Content = createComponent$19({
  mixins: [TouchMixin],
  props: {
    count: Number,
    duration: [Number, String],
    animated: Boolean,
    swipeable: Boolean,
    currentIndex: Number
  },
  computed: {
    style: function style() {
      if (this.animated) {
        return {
          transform: "translate3d(" + -1 * this.currentIndex * 100 + "%, 0, 0)",
          transitionDuration: this.duration + "s"
        };
      }
    },
    listeners: function listeners() {
      if (this.swipeable) {
        return {
          touchstart: this.touchStart,
          touchmove: this.touchMove,
          touchend: this.onTouchEnd,
          touchcancel: this.onTouchEnd
        };
      }
    }
  },
  methods: {
    // watch swipe touch end
    onTouchEnd: function onTouchEnd() {
      var direction = this.direction,
        deltaX = this.deltaX,
        currentIndex = this.currentIndex;
      /* istanbul ignore else */

      if (direction === 'horizontal' && this.offsetX >= MIN_SWIPE_DISTANCE) {
        /* istanbul ignore else */
        if (deltaX > 0 && currentIndex !== 0) {
          this.$emit('change', currentIndex - 1);
        } else if (deltaX < 0 && currentIndex !== this.count - 1) {
          this.$emit('change', currentIndex + 1);
        }
      }
    },
    genChildren: function genChildren() {
      var h = this.$createElement;
      if (this.animated) {
        return h("div", {
          "class": bem$12('track'),
          "style": this.style
        }, [this.slots()]);
      }
      return this.slots();
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$12('content', {
        animated: this.animated
      }),
      "on": _extends$1({}, this.listeners)
    }, [this.genChildren()]);
  }
});

// Utils
var _createNamespace$14 = createNamespace('tabs'),
  createComponent$18 = _createNamespace$14[0],
  bem$11 = _createNamespace$14[1];
var Tabs = createComponent$18({
  mixins: [ParentMixin('vanTabs'), BindEventMixin(function (bind) {
    if (!this.scroller) {
      this.scroller = getScroller(this.$el);
    }
    bind(window, 'resize', this.resize, true);
    if (this.scrollspy) {
      bind(this.scroller, 'scroll', this.onScroll, true);
    }
  })],
  inject: {
    vanPopup: {
      default: null
    }
  },
  model: {
    prop: 'active'
  },
  props: {
    color: String,
    border: Boolean,
    sticky: Boolean,
    animated: Boolean,
    swipeable: Boolean,
    scrollspy: Boolean,
    background: String,
    lineWidth: [Number, String],
    lineHeight: [Number, String],
    beforeChange: Function,
    titleActiveColor: String,
    titleInactiveColor: String,
    type: {
      type: String,
      default: 'line'
    },
    active: {
      type: [Number, String],
      default: 0
    },
    ellipsis: {
      type: Boolean,
      default: true
    },
    duration: {
      type: [Number, String],
      default: 0.3
    },
    offsetTop: {
      type: [Number, String],
      default: 0
    },
    lazyRender: {
      type: Boolean,
      default: true
    },
    swipeThreshold: {
      type: [Number, String],
      default: 5
    }
  },
  data: function data() {
    return {
      position: '',
      currentIndex: null,
      lineStyle: {
        backgroundColor: this.color
      }
    };
  },
  computed: {
    // whether the nav is scrollable
    scrollable: function scrollable() {
      return this.children.length > this.swipeThreshold || !this.ellipsis;
    },
    navStyle: function navStyle() {
      return {
        borderColor: this.color,
        background: this.background
      };
    },
    currentName: function currentName() {
      var activeTab = this.children[this.currentIndex];
      if (activeTab) {
        return activeTab.computedName;
      }
    },
    offsetTopPx: function offsetTopPx() {
      return unitToPx(this.offsetTop);
    },
    scrollOffset: function scrollOffset() {
      if (this.sticky) {
        return this.offsetTopPx + this.tabHeight;
      }
      return 0;
    }
  },
  watch: {
    color: 'setLine',
    active: function active(name) {
      if (name !== this.currentName) {
        this.setCurrentIndexByName(name);
      }
    },
    children: function children() {
      var _this = this;
      this.setCurrentIndexByName(this.active);
      this.setLine();
      this.$nextTick(function () {
        _this.scrollIntoView(true);
      });
    },
    currentIndex: function currentIndex() {
      this.scrollIntoView();
      this.setLine(); // scroll to correct position

      if (this.stickyFixed && !this.scrollspy) {
        setRootScrollTop(Math.ceil(getElementTop(this.$el) - this.offsetTopPx));
      }
    },
    scrollspy: function scrollspy(val) {
      if (val) {
        on$2(this.scroller, 'scroll', this.onScroll, true);
      } else {
        off$2(this.scroller, 'scroll', this.onScroll);
      }
    }
  },
  mounted: function mounted() {
    var _this2 = this;
    this.init(); // https://github.com/vant-ui/vant/issues/7959

    if (this.vanPopup) {
      this.vanPopup.onReopen(function () {
        _this2.setLine();
      });
    }
  },
  activated: function activated() {
    this.init();
    this.setLine();
  },
  methods: {
    // @exposed-api
    resize: function resize() {
      this.setLine();
    },
    init: function init() {
      var _this3 = this;
      this.$nextTick(function () {
        _this3.inited = true;
        _this3.tabHeight = getVisibleHeight(_this3.$refs.wrap);
        _this3.scrollIntoView(true);
      });
    },
    // update nav bar style
    setLine: function setLine() {
      var _this4 = this;
      var shouldAnimate = this.inited;
      this.$nextTick(function () {
        var titles = _this4.$refs.titles;
        if (!titles || !titles[_this4.currentIndex] || _this4.type !== 'line' || isHidden(_this4.$el)) {
          return;
        }
        var title = titles[_this4.currentIndex].$el;
        var lineWidth = _this4.lineWidth,
          lineHeight = _this4.lineHeight;
        var left = title.offsetLeft + title.offsetWidth / 2;
        var lineStyle = {
          width: addUnit(lineWidth),
          backgroundColor: _this4.color,
          transform: "translateX(" + left + "px) translateX(-50%)"
        };
        if (shouldAnimate) {
          lineStyle.transitionDuration = _this4.duration + "s";
        }
        if (isDef$1(lineHeight)) {
          var height = addUnit(lineHeight);
          lineStyle.height = height;
          lineStyle.borderRadius = height;
        }
        _this4.lineStyle = lineStyle;
      });
    },
    // correct the index of active tab
    setCurrentIndexByName: function setCurrentIndexByName(name) {
      var matched = this.children.filter(function (tab) {
        return tab.computedName === name;
      });
      var defaultIndex = (this.children[0] || {}).index || 0;
      this.setCurrentIndex(matched.length ? matched[0].index : defaultIndex);
    },
    setCurrentIndex: function setCurrentIndex(currentIndex) {
      var newIndex = this.findAvailableTab(currentIndex);
      if (!isDef$1(newIndex)) {
        return;
      }
      var newTab = this.children[newIndex];
      var newName = newTab.computedName;
      var shouldEmitChange = this.currentIndex !== null;
      this.currentIndex = newIndex;
      if (newName !== this.active) {
        this.$emit('input', newName);
        if (shouldEmitChange) {
          this.$emit('change', newName, newTab.title);
        }
      }
    },
    findAvailableTab: function findAvailableTab(index) {
      var diff = index < this.currentIndex ? -1 : 1;
      while (index >= 0 && index < this.children.length) {
        if (!this.children[index].disabled) {
          return index;
        }
        index += diff;
      }
    },
    // emit event when clicked
    onClick: function onClick(item, index) {
      var _this5 = this;
      var _this$children$index = this.children[index],
        title = _this$children$index.title,
        disabled = _this$children$index.disabled,
        computedName = _this$children$index.computedName;
      if (disabled) {
        this.$emit('disabled', computedName, title);
      } else {
        callInterceptor({
          interceptor: this.beforeChange,
          args: [computedName],
          done: function done() {
            _this5.setCurrentIndex(index);
            _this5.scrollToCurrentContent();
          }
        });
        this.$emit('click', computedName, title);
        route(item.$router, item);
      }
    },
    // scroll active tab into view
    scrollIntoView: function scrollIntoView(immediate) {
      var titles = this.$refs.titles;
      if (!this.scrollable || !titles || !titles[this.currentIndex]) {
        return;
      }
      var nav = this.$refs.nav;
      var title = titles[this.currentIndex].$el;
      var to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
      scrollLeftTo(nav, to, immediate ? 0 : +this.duration);
    },
    onSticktScroll: function onSticktScroll(params) {
      this.stickyFixed = params.isFixed;
      this.$emit('scroll', params);
    },
    // @exposed-api
    scrollTo: function scrollTo(name) {
      var _this6 = this;
      this.$nextTick(function () {
        _this6.setCurrentIndexByName(name);
        _this6.scrollToCurrentContent(true);
      });
    },
    scrollToCurrentContent: function scrollToCurrentContent(immediate) {
      var _this7 = this;
      if (immediate === void 0) {
        immediate = false;
      }
      if (this.scrollspy) {
        var target = this.children[this.currentIndex];
        var el = target == null ? void 0 : target.$el;
        if (el) {
          var to = getElementTop(el, this.scroller) - this.scrollOffset;
          this.lockScroll = true;
          scrollTopTo(this.scroller, to, immediate ? 0 : +this.duration, function () {
            _this7.lockScroll = false;
          });
        }
      }
    },
    onScroll: function onScroll() {
      if (this.scrollspy && !this.lockScroll) {
        var index = this.getCurrentIndexOnScroll();
        this.setCurrentIndex(index);
      }
    },
    getCurrentIndexOnScroll: function getCurrentIndexOnScroll() {
      var children = this.children;
      for (var index = 0; index < children.length; index++) {
        var top = getVisibleTop(children[index].$el);
        if (top > this.scrollOffset) {
          return index === 0 ? 0 : index - 1;
        }
      }
      return children.length - 1;
    }
  },
  render: function render() {
    var _this8 = this,
      _ref;
    var h = arguments[0];
    var type = this.type,
      animated = this.animated,
      scrollable = this.scrollable;
    var Nav = this.children.map(function (item, index) {
      var _item$badge;
      return h(Title, {
        "ref": "titles",
        "refInFor": true,
        "attrs": {
          "type": type,
          "dot": item.dot,
          "info": (_item$badge = item.badge) != null ? _item$badge : item.info,
          "title": item.title,
          "color": _this8.color,
          "isActive": index === _this8.currentIndex,
          "disabled": item.disabled,
          "scrollable": scrollable,
          "activeColor": _this8.titleActiveColor,
          "inactiveColor": _this8.titleInactiveColor
        },
        "style": item.titleStyle,
        "class": item.titleClass,
        "scopedSlots": {
          default: function _default() {
            return item.slots('title');
          }
        },
        "on": {
          "click": function click() {
            _this8.onClick(item, index);
          }
        }
      });
    });
    var Wrap = h("div", {
      "ref": "wrap",
      "class": [bem$11('wrap', {
        scrollable: scrollable
      }), (_ref = {}, _ref[BORDER_TOP_BOTTOM] = type === 'line' && this.border, _ref)]
    }, [h("div", {
      "ref": "nav",
      "attrs": {
        "role": "tablist"
      },
      "class": bem$11('nav', [type, {
        complete: this.scrollable
      }]),
      "style": this.navStyle
    }, [this.slots('nav-left'), Nav, type === 'line' && h("div", {
      "class": bem$11('line'),
      "style": this.lineStyle
    }), this.slots('nav-right')])]);
    return h("div", {
      "class": bem$11([type])
    }, [this.sticky ? h(Sticky, {
      "attrs": {
        "container": this.$el,
        "offsetTop": this.offsetTop
      },
      "on": {
        "scroll": this.onSticktScroll
      }
    }, [Wrap]) : Wrap, h(Content, {
      "attrs": {
        "count": this.children.length,
        "animated": animated,
        "duration": this.duration,
        "swipeable": this.swipeable,
        "currentIndex": this.currentIndex
      },
      "on": {
        "change": this.setCurrentIndex
      }
    }, [this.slots()])]);
  }
});

var _createNamespace$13 = createNamespace('cascader'),
  createComponent$17 = _createNamespace$13[0],
  bem$10 = _createNamespace$13[1],
  t$l = _createNamespace$13[2];
var Cascader = createComponent$17({
  props: {
    title: String,
    value: [Number, String],
    fieldNames: Object,
    placeholder: String,
    activeColor: String,
    options: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    closeable: {
      type: Boolean,
      default: true
    },
    showHeader: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    return {
      tabs: [],
      activeTab: 0
    };
  },
  computed: {
    textKey: function textKey() {
      var _this$fieldNames;
      return ((_this$fieldNames = this.fieldNames) == null ? void 0 : _this$fieldNames.text) || 'text';
    },
    valueKey: function valueKey() {
      var _this$fieldNames2;
      return ((_this$fieldNames2 = this.fieldNames) == null ? void 0 : _this$fieldNames2.value) || 'value';
    },
    childrenKey: function childrenKey() {
      var _this$fieldNames3;
      return ((_this$fieldNames3 = this.fieldNames) == null ? void 0 : _this$fieldNames3.children) || 'children';
    }
  },
  watch: {
    options: {
      deep: true,
      handler: 'updateTabs'
    },
    value: function value(_value) {
      var _this = this;
      if (_value || _value === 0) {
        var values = this.tabs.map(function (tab) {
          var _tab$selectedOption;
          return (_tab$selectedOption = tab.selectedOption) == null ? void 0 : _tab$selectedOption[_this.valueKey];
        });
        if (values.indexOf(_value) !== -1) {
          return;
        }
      }
      this.updateTabs();
    }
  },
  created: function created() {
    this.updateTabs();
  },
  methods: {
    getSelectedOptionsByValue: function getSelectedOptionsByValue(options, value) {
      for (var i = 0; i < options.length; i++) {
        var option = options[i];
        if (option[this.valueKey] === value) {
          return [option];
        }
        if (option[this.childrenKey]) {
          var selectedOptions = this.getSelectedOptionsByValue(option[this.childrenKey], value);
          if (selectedOptions) {
            return [option].concat(selectedOptions);
          }
        }
      }
    },
    updateTabs: function updateTabs() {
      var _this2 = this;
      if (this.value || this.value === 0) {
        var selectedOptions = this.getSelectedOptionsByValue(this.options, this.value);
        if (selectedOptions) {
          var optionsCursor = this.options;
          this.tabs = selectedOptions.map(function (option) {
            var tab = {
              options: optionsCursor,
              selectedOption: option
            };
            var next = optionsCursor.filter(function (item) {
              return item[_this2.valueKey] === option[_this2.valueKey];
            });
            if (next.length) {
              optionsCursor = next[0][_this2.childrenKey];
            }
            return tab;
          });
          if (optionsCursor) {
            this.tabs.push({
              options: optionsCursor,
              selectedOption: null
            });
          }
          this.$nextTick(function () {
            _this2.activeTab = _this2.tabs.length - 1;
          });
          return;
        }
      }
      this.tabs = [{
        options: this.options,
        selectedOption: null
      }];
    },
    onSelect: function onSelect(option, tabIndex) {
      var _this3 = this;
      this.tabs[tabIndex].selectedOption = option;
      if (this.tabs.length > tabIndex + 1) {
        this.tabs = this.tabs.slice(0, tabIndex + 1);
      }
      if (option[this.childrenKey]) {
        var nextTab = {
          options: option[this.childrenKey],
          selectedOption: null
        };
        if (this.tabs[tabIndex + 1]) {
          this.$set(this.tabs, tabIndex + 1, nextTab);
        } else {
          this.tabs.push(nextTab);
        }
        this.$nextTick(function () {
          _this3.activeTab++;
        });
      }
      var selectedOptions = this.tabs.map(function (tab) {
        return tab.selectedOption;
      }).filter(function (item) {
        return !!item;
      });
      var eventParams = {
        value: option[this.valueKey],
        tabIndex: tabIndex,
        selectedOptions: selectedOptions
      };
      this.$emit('input', option[this.valueKey]);
      this.$emit('change', eventParams);
      if (!option[this.childrenKey]) {
        this.$emit('finish', eventParams);
      }
    },
    onClose: function onClose() {
      this.$emit('close');
    },
    renderHeader: function renderHeader() {
      var h = this.$createElement;
      if (this.showHeader) {
        return h("div", {
          "class": bem$10('header')
        }, [h("h2", {
          "class": bem$10('title')
        }, [this.slots('title') || this.title]), this.closeable ? h(Icon$3, {
          "attrs": {
            "name": "cross"
          },
          "class": bem$10('close-icon'),
          "on": {
            "click": this.onClose
          }
        }) : null]);
      }
    },
    renderOptions: function renderOptions(options, selectedOption, tabIndex) {
      var _this4 = this;
      var h = this.$createElement;
      var renderOption = function renderOption(option) {
        var isSelected = selectedOption && option[_this4.valueKey] === selectedOption[_this4.valueKey];
        var Text = _this4.slots('option', {
          option: option,
          selected: isSelected
        }) || h("span", [option[_this4.textKey]]);
        return h("li", {
          "class": bem$10('option', {
            selected: isSelected
          }),
          "style": {
            color: isSelected ? _this4.activeColor : null
          },
          "on": {
            "click": function click() {
              _this4.onSelect(option, tabIndex);
            }
          }
        }, [Text, isSelected ? h(Icon$3, {
          "attrs": {
            "name": "success"
          },
          "class": bem$10('selected-icon')
        }) : null]);
      };
      return h("ul", {
        "class": bem$10('options')
      }, [options.map(renderOption)]);
    },
    renderTab: function renderTab(item, tabIndex) {
      var h = this.$createElement;
      var options = item.options,
        selectedOption = item.selectedOption;
      var title = selectedOption ? selectedOption[this.textKey] : this.placeholder || t$l('select');
      return h(Tab, {
        "attrs": {
          "title": title,
          "titleClass": bem$10('tab', {
            unselected: !selectedOption
          })
        }
      }, [this.renderOptions(options, selectedOption, tabIndex)]);
    },
    renderTabs: function renderTabs() {
      var _this5 = this;
      var h = this.$createElement;
      return h(Tabs, {
        "attrs": {
          "animated": true,
          "swipeable": true,
          "swipeThreshold": 0,
          "color": this.activeColor
        },
        "class": bem$10('tabs'),
        "model": {
          value: _this5.activeTab,
          callback: function callback($$v) {
            _this5.activeTab = $$v;
          }
        }
      }, [this.tabs.map(this.renderTab)]);
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$10()
    }, [this.renderHeader(), this.renderTabs()]);
  }
});

var _createNamespace$12 = createNamespace('cell-group'),
  createComponent$16 = _createNamespace$12[0],
  bem$$ = _createNamespace$12[1];
function CellGroup(h, props, slots, ctx) {
  var _ref;
  var Group = h("div", _mergeJSXProps([{
    "class": [bem$$({
      inset: props.inset
    }), (_ref = {}, _ref[BORDER_TOP_BOTTOM] = props.border, _ref)]
  }, inherit(ctx, true)]), [slots.default == null ? void 0 : slots.default()]);
  if (props.title || slots.title) {
    return h("div", {
      "key": ctx.data.key
    }, [h("div", {
      "class": bem$$('title', {
        inset: props.inset
      })
    }, [slots.title ? slots.title() : props.title]), Group]);
  }
  return Group;
}
CellGroup.props = {
  title: String,
  inset: Boolean,
  border: {
    type: Boolean,
    default: true
  }
};
var CellGroup$1 = createComponent$16(CellGroup);

var _createNamespace$11 = createNamespace('checkbox'),
  createComponent$15 = _createNamespace$11[0],
  bem$_ = _createNamespace$11[1];
var Checkbox = createComponent$15({
  mixins: [CheckboxMixin({
    bem: bem$_,
    role: 'checkbox',
    parent: 'vanCheckbox'
  })],
  computed: {
    checked: {
      get: function get() {
        if (this.parent) {
          return this.parent.value.indexOf(this.name) !== -1;
        }
        return this.value;
      },
      set: function set(val) {
        if (this.parent) {
          this.setParentValue(val);
        } else {
          this.$emit('input', val);
        }
      }
    }
  },
  watch: {
    value: function value(val) {
      this.$emit('change', val);
    }
  },
  methods: {
    // @exposed-api
    toggle: function toggle(checked) {
      var _this = this;
      if (checked === void 0) {
        checked = !this.checked;
      }

      // When toggle method is called multiple times at the same time,
      // only the last call is valid.
      // This is a hack for usage inside Cell.
      clearTimeout(this.toggleTask);
      this.toggleTask = setTimeout(function () {
        _this.checked = checked;
      });
    },
    setParentValue: function setParentValue(val) {
      var parent = this.parent;
      var value = parent.value.slice();
      if (val) {
        if (parent.max && value.length >= parent.max) {
          return;
        }
        /* istanbul ignore else */

        if (value.indexOf(this.name) === -1) {
          value.push(this.name);
          parent.$emit('input', value);
        }
      } else {
        var index = value.indexOf(this.name);
        /* istanbul ignore else */

        if (index !== -1) {
          value.splice(index, 1);
          parent.$emit('input', value);
        }
      }
    }
  }
});

var _createNamespace$10 = createNamespace('checkbox-group'),
  createComponent$14 = _createNamespace$10[0],
  bem$Z = _createNamespace$10[1];
var CheckboxGroup = createComponent$14({
  mixins: [ParentMixin('vanCheckbox'), FieldMixin],
  props: {
    max: [Number, String],
    disabled: Boolean,
    direction: String,
    iconSize: [Number, String],
    checkedColor: String,
    value: {
      type: Array,
      default: function _default() {
        return [];
      }
    }
  },
  watch: {
    value: function value(val) {
      this.$emit('change', val);
    }
  },
  methods: {
    // @exposed-api
    toggleAll: function toggleAll(options) {
      if (options === void 0) {
        options = {};
      }
      if (typeof options === 'boolean') {
        options = {
          checked: options
        };
      }
      var _options = options,
        checked = _options.checked,
        skipDisabled = _options.skipDisabled;
      var children = this.children.filter(function (item) {
        if (item.disabled && skipDisabled) {
          return item.checked;
        }
        return checked != null ? checked : !item.checked;
      });
      var names = children.map(function (item) {
        return item.name;
      });
      this.$emit('input', names);
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$Z([this.direction])
    }, [this.slots()]);
  }
});

var _createNamespace$$ = createNamespace('circle'),
  createComponent$13 = _createNamespace$$[0],
  bem$Y = _createNamespace$$[1];
var PERIMETER = 3140;
var uid = 0;
function format$3(rate) {
  return Math.min(Math.max(rate, 0), 100);
}
function getPath(clockwise, viewBoxSize) {
  var sweepFlag = clockwise ? 1 : 0;
  return "M " + viewBoxSize / 2 + " " + viewBoxSize / 2 + " m 0, -500 a 500, 500 0 1, " + sweepFlag + " 0, 1000 a 500, 500 0 1, " + sweepFlag + " 0, -1000";
}
var Circle$2 = createComponent$13({
  props: {
    text: String,
    size: [Number, String],
    color: [String, Object],
    layerColor: String,
    strokeLinecap: String,
    value: {
      type: Number,
      default: 0
    },
    speed: {
      type: [Number, String],
      default: 0
    },
    fill: {
      type: String,
      default: 'none'
    },
    rate: {
      type: [Number, String],
      default: 100
    },
    strokeWidth: {
      type: [Number, String],
      default: 40
    },
    clockwise: {
      type: Boolean,
      default: true
    }
  },
  beforeCreate: function beforeCreate() {
    this.uid = "van-circle-gradient-" + uid++;
  },
  computed: {
    style: function style() {
      var size = addUnit(this.size);
      return {
        width: size,
        height: size
      };
    },
    path: function path() {
      return getPath(this.clockwise, this.viewBoxSize);
    },
    viewBoxSize: function viewBoxSize() {
      return +this.strokeWidth + 1000;
    },
    layerStyle: function layerStyle() {
      return {
        fill: "" + this.fill,
        stroke: "" + this.layerColor,
        strokeWidth: this.strokeWidth + "px"
      };
    },
    hoverStyle: function hoverStyle() {
      var offset = PERIMETER * this.value / 100;
      return {
        stroke: "" + (this.gradient ? "url(#" + this.uid + ")" : this.color),
        strokeWidth: +this.strokeWidth + 1 + "px",
        strokeLinecap: this.strokeLinecap,
        strokeDasharray: offset + "px " + PERIMETER + "px"
      };
    },
    gradient: function gradient() {
      return isObject$6(this.color);
    },
    LinearGradient: function LinearGradient() {
      var _this = this;
      var h = this.$createElement;
      if (!this.gradient) {
        return;
      }
      var Stops = Object.keys(this.color).sort(function (a, b) {
        return parseFloat(a) - parseFloat(b);
      }).map(function (key, index) {
        return h("stop", {
          "key": index,
          "attrs": {
            "offset": key,
            "stop-color": _this.color[key]
          }
        });
      });
      return h("defs", [h("linearGradient", {
        "attrs": {
          "id": this.uid,
          "x1": "100%",
          "y1": "0%",
          "x2": "0%",
          "y2": "0%"
        }
      }, [Stops])]);
    }
  },
  watch: {
    rate: {
      handler: function handler(rate) {
        this.startTime = Date.now();
        this.startRate = this.value;
        this.endRate = format$3(rate);
        this.increase = this.endRate > this.startRate;
        this.duration = Math.abs((this.startRate - this.endRate) * 1000 / this.speed);
        if (this.speed) {
          cancelRaf(this.rafId);
          this.rafId = raf(this.animate);
        } else {
          this.$emit('input', this.endRate);
        }
      },
      immediate: true
    }
  },
  methods: {
    animate: function animate() {
      var now = Date.now();
      var progress = Math.min((now - this.startTime) / this.duration, 1);
      var rate = progress * (this.endRate - this.startRate) + this.startRate;
      this.$emit('input', format$3(parseFloat(rate.toFixed(1))));
      if (this.increase ? rate < this.endRate : rate > this.endRate) {
        this.rafId = raf(this.animate);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$Y(),
      "style": this.style
    }, [h("svg", {
      "attrs": {
        "viewBox": "0 0 " + this.viewBoxSize + " " + this.viewBoxSize
      }
    }, [this.LinearGradient, h("path", {
      "class": bem$Y('layer'),
      "style": this.layerStyle,
      "attrs": {
        "d": this.path
      }
    }), h("path", {
      "attrs": {
        "d": this.path
      },
      "class": bem$Y('hover'),
      "style": this.hoverStyle
    })]), this.slots() || this.text && h("div", {
      "class": bem$Y('text')
    }, [this.text])]);
  }
});

var _createNamespace$_ = createNamespace('col'),
  createComponent$12 = _createNamespace$_[0],
  bem$X = _createNamespace$_[1];
var Col = createComponent$12({
  mixins: [ChildrenMixin('vanRow')],
  props: {
    span: [Number, String],
    offset: [Number, String],
    tag: {
      type: String,
      default: 'div'
    }
  },
  computed: {
    style: function style() {
      var index = this.index;
      var _ref = this.parent || {},
        spaces = _ref.spaces;
      if (spaces && spaces[index]) {
        var _spaces$index = spaces[index],
          left = _spaces$index.left,
          right = _spaces$index.right;
        return {
          paddingLeft: left ? left + "px" : null,
          paddingRight: right ? right + "px" : null
        };
      }
    }
  },
  methods: {
    onClick: function onClick(event) {
      this.$emit('click', event);
    }
  },
  render: function render() {
    var _bem;
    var h = arguments[0];
    var span = this.span,
      offset = this.offset;
    return h(this.tag, {
      "style": this.style,
      "class": bem$X((_bem = {}, _bem[span] = span, _bem["offset-" + offset] = offset, _bem)),
      "on": {
        "click": this.onClick
      }
    }, [this.slots()]);
  }
});

var _createNamespace$Z = createNamespace('collapse'),
  createComponent$11 = _createNamespace$Z[0],
  bem$W = _createNamespace$Z[1];
var Collapse = createComponent$11({
  mixins: [ParentMixin('vanCollapse')],
  props: {
    accordion: Boolean,
    value: [String, Number, Array],
    border: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    switch: function _switch(name, expanded) {
      if (!this.accordion) {
        name = expanded ? this.value.concat(name) : this.value.filter(function (activeName) {
          return activeName !== name;
        });
      }
      this.$emit('change', name);
      this.$emit('input', name);
    }
  },
  render: function render() {
    var _ref;
    var h = arguments[0];
    return h("div", {
      "class": [bem$W(), (_ref = {}, _ref[BORDER_TOP_BOTTOM] = this.border, _ref)]
    }, [this.slots()]);
  }
});

var _createNamespace$Y = createNamespace('collapse-item'),
  createComponent$10 = _createNamespace$Y[0],
  bem$V = _createNamespace$Y[1];
var CELL_SLOTS = ['title', 'icon', 'right-icon'];
var CollapseItem = createComponent$10({
  mixins: [ChildrenMixin('vanCollapse')],
  props: _extends$1({}, cellProps, {
    name: [Number, String],
    disabled: Boolean,
    lazyRender: {
      type: Boolean,
      default: true
    },
    isLink: {
      type: Boolean,
      default: true
    }
  }),
  data: function data() {
    return {
      show: null,
      inited: null
    };
  },
  computed: {
    currentName: function currentName() {
      var _this$name;
      return (_this$name = this.name) != null ? _this$name : this.index;
    },
    expanded: function expanded() {
      var _this = this;
      if (!this.parent) {
        return null;
      }
      var _this$parent = this.parent,
        value = _this$parent.value,
        accordion = _this$parent.accordion;
      return accordion ? value === this.currentName : value.some(function (name) {
        return name === _this.currentName;
      });
    }
  },
  created: function created() {
    this.show = this.expanded;
    this.inited = this.expanded;
  },
  watch: {
    expanded: function expanded(_expanded, prev) {
      var _this2 = this;
      if (prev === null) {
        return;
      }
      if (_expanded) {
        this.show = true;
        this.inited = true;
      } // Use raf: flick when opened in safari
      // Use nextTick: closing animation failed when set `user-select: none`

      var nextTick = _expanded ? this.$nextTick : raf;
      nextTick(function () {
        var _this2$$refs = _this2.$refs,
          content = _this2$$refs.content,
          wrapper = _this2$$refs.wrapper;
        if (!content || !wrapper) {
          return;
        }
        var offsetHeight = content.offsetHeight;
        if (offsetHeight) {
          var contentHeight = offsetHeight + "px";
          wrapper.style.height = _expanded ? 0 : contentHeight; // use double raf to ensure animation can start

          doubleRaf(function () {
            wrapper.style.height = _expanded ? contentHeight : 0;
          });
        } else {
          _this2.onTransitionEnd();
        }
      });
    }
  },
  methods: {
    onClick: function onClick() {
      if (!this.disabled) {
        this.toggle();
      }
    },
    // @exposed-api
    toggle: function toggle(expanded) {
      if (expanded === void 0) {
        expanded = !this.expanded;
      }
      var parent = this.parent,
        currentName = this.currentName;
      var close = parent.accordion && currentName === parent.value;
      var name = close ? '' : currentName;
      this.parent.switch(name, expanded);
    },
    onTransitionEnd: function onTransitionEnd() {
      if (!this.expanded) {
        this.show = false;
      } else {
        this.$refs.wrapper.style.height = '';
      }
    },
    genTitle: function genTitle() {
      var _this3 = this;
      var h = this.$createElement;
      var border = this.border,
        disabled = this.disabled,
        expanded = this.expanded;
      var titleSlots = CELL_SLOTS.reduce(function (slots, name) {
        if (_this3.slots(name)) {
          slots[name] = function () {
            return _this3.slots(name);
          };
        }
        return slots;
      }, {});
      if (this.slots('value')) {
        titleSlots.default = function () {
          return _this3.slots('value');
        };
      }
      return h(Cell$1, {
        "attrs": {
          "role": "button",
          "tabindex": disabled ? -1 : 0,
          "aria-expanded": String(expanded)
        },
        "class": bem$V('title', {
          disabled: disabled,
          expanded: expanded,
          borderless: !border
        }),
        "on": {
          "click": this.onClick
        },
        "scopedSlots": titleSlots,
        "props": _extends$1({}, this.$props)
      });
    },
    genContent: function genContent() {
      var h = this.$createElement;
      if (this.inited || !this.lazyRender) {
        return h("div", {
          "directives": [{
            name: "show",
            value: this.show
          }],
          "ref": "wrapper",
          "class": bem$V('wrapper'),
          "on": {
            "transitionend": this.onTransitionEnd
          }
        }, [h("div", {
          "ref": "content",
          "class": bem$V('content')
        }, [this.slots()])]);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": [bem$V({
        border: this.index && this.border
      })]
    }, [this.genTitle(), this.genContent()]);
  }
});

var _createNamespace$X = createNamespace('contact-card'),
  createComponent$$ = _createNamespace$X[0],
  bem$U = _createNamespace$X[1],
  t$k = _createNamespace$X[2];
function ContactCard(h, props, slots, ctx) {
  var type = props.type,
    editable = props.editable;
  function onClick(event) {
    if (editable) {
      emit(ctx, 'click', event);
    }
  }
  function Content() {
    if (type === 'add') {
      return props.addText || t$k('addText');
    }
    return [h("div", [t$k('name') + "\uFF1A" + props.name]), h("div", [t$k('tel') + "\uFF1A" + props.tel])];
  }
  return h(Cell$1, _mergeJSXProps([{
    "attrs": {
      "center": true,
      "border": false,
      "isLink": editable,
      "valueClass": bem$U('value'),
      "icon": type === 'edit' ? 'contact' : 'add-square'
    },
    "class": bem$U([type]),
    "on": {
      "click": onClick
    }
  }, inherit(ctx)]), [Content()]);
}
ContactCard.props = {
  tel: String,
  name: String,
  addText: String,
  editable: {
    type: Boolean,
    default: true
  },
  type: {
    type: String,
    default: 'add'
  }
};
var ContactCard$1 = createComponent$$(ContactCard);

var _createNamespace$W = createNamespace('contact-edit'),
  createComponent$_ = _createNamespace$W[0],
  bem$T = _createNamespace$W[1],
  t$j = _createNamespace$W[2];
var defaultContact = {
  tel: '',
  name: ''
};
var ContactEdit = createComponent$_({
  props: {
    isEdit: Boolean,
    isSaving: Boolean,
    isDeleting: Boolean,
    showSetDefault: Boolean,
    setDefaultLabel: String,
    contactInfo: {
      type: Object,
      default: function _default() {
        return _extends$1({}, defaultContact);
      }
    },
    telValidator: {
      type: Function,
      default: isMobile
    }
  },
  data: function data() {
    return {
      data: _extends$1({}, defaultContact, this.contactInfo),
      errorInfo: {
        name: '',
        tel: ''
      }
    };
  },
  watch: {
    contactInfo: function contactInfo(val) {
      this.data = _extends$1({}, defaultContact, val);
    }
  },
  methods: {
    onFocus: function onFocus(key) {
      this.errorInfo[key] = '';
    },
    getErrorMessageByKey: function getErrorMessageByKey(key) {
      var value = this.data[key].trim();
      switch (key) {
        case 'name':
          return value ? '' : t$j('nameInvalid');
        case 'tel':
          return this.telValidator(value) ? '' : t$j('telInvalid');
      }
    },
    onSave: function onSave() {
      var _this = this;
      var isValid = ['name', 'tel'].every(function (item) {
        var msg = _this.getErrorMessageByKey(item);
        if (msg) {
          _this.errorInfo[item] = msg;
        }
        return !msg;
      });
      if (isValid && !this.isSaving) {
        this.$emit('save', this.data);
      }
    },
    onDelete: function onDelete() {
      var _this2 = this;
      Dialog.confirm({
        title: t$j('confirmDelete')
      }).then(function () {
        _this2.$emit('delete', _this2.data);
      });
    }
  },
  render: function render() {
    var _this3 = this;
    var h = arguments[0];
    var data = this.data,
      errorInfo = this.errorInfo;
    var onFocus = function onFocus(name) {
      return function () {
        return _this3.onFocus(name);
      };
    };
    return h("div", {
      "class": bem$T()
    }, [h("div", {
      "class": bem$T('fields')
    }, [h(Field, {
      "attrs": {
        "clearable": true,
        "maxlength": "30",
        "label": t$j('name'),
        "placeholder": t$j('nameEmpty'),
        "errorMessage": errorInfo.name
      },
      "on": {
        "focus": onFocus('name')
      },
      "model": {
        value: data.name,
        callback: function callback($$v) {
          _this3.$set(data, "name", $$v);
        }
      }
    }), h(Field, {
      "attrs": {
        "clearable": true,
        "type": "tel",
        "label": t$j('tel'),
        "placeholder": t$j('telEmpty'),
        "errorMessage": errorInfo.tel
      },
      "on": {
        "focus": onFocus('tel')
      },
      "model": {
        value: data.tel,
        callback: function callback($$v) {
          _this3.$set(data, "tel", $$v);
        }
      }
    })]), this.showSetDefault && h(Cell$1, {
      "attrs": {
        "title": this.setDefaultLabel,
        "border": false
      },
      "class": bem$T('switch-cell')
    }, [h(Switch, {
      "attrs": {
        "size": 24
      },
      "slot": "right-icon",
      "on": {
        "change": function change(event) {
          _this3.$emit('change-default', event);
        }
      },
      "model": {
        value: data.isDefault,
        callback: function callback($$v) {
          _this3.$set(data, "isDefault", $$v);
        }
      }
    })]), h("div", {
      "class": bem$T('buttons')
    }, [h(Button$2, {
      "attrs": {
        "block": true,
        "round": true,
        "type": "danger",
        "text": t$j('save'),
        "loading": this.isSaving
      },
      "on": {
        "click": this.onSave
      }
    }), this.isEdit && h(Button$2, {
      "attrs": {
        "block": true,
        "round": true,
        "text": t$j('delete'),
        "loading": this.isDeleting
      },
      "on": {
        "click": this.onDelete
      }
    })])]);
  }
});

var _createNamespace$V = createNamespace('contact-list'),
  createComponent$Z = _createNamespace$V[0],
  bem$S = _createNamespace$V[1],
  t$i = _createNamespace$V[2];
function ContactList(h, props, slots, ctx) {
  var List = props.list && props.list.map(function (item, index) {
    function onClick() {
      emit(ctx, 'input', item.id);
      emit(ctx, 'select', item, index);
    }
    function RightIcon() {
      return h(Radio, {
        "attrs": {
          "name": item.id,
          "iconSize": 16,
          "checkedColor": RED
        },
        "on": {
          "click": onClick
        }
      });
    }
    function LeftIcon() {
      return h(Icon$3, {
        "attrs": {
          "name": "edit"
        },
        "class": bem$S('edit'),
        "on": {
          "click": function click(event) {
            event.stopPropagation();
            emit(ctx, 'edit', item, index);
          }
        }
      });
    }
    function Content() {
      var nodes = [item.name + "\uFF0C" + item.tel];
      if (item.isDefault && props.defaultTagText) {
        nodes.push(h(Tag$1, {
          "attrs": {
            "type": "danger",
            "round": true
          },
          "class": bem$S('item-tag')
        }, [props.defaultTagText]));
      }
      return nodes;
    }
    return h(Cell$1, {
      "key": item.id,
      "attrs": {
        "isLink": true,
        "center": true,
        "valueClass": bem$S('item-value')
      },
      "class": bem$S('item'),
      "scopedSlots": {
        icon: LeftIcon,
        default: Content,
        'right-icon': RightIcon
      },
      "on": {
        "click": onClick
      }
    });
  });
  return h("div", _mergeJSXProps([{
    "class": bem$S()
  }, inherit(ctx)]), [h(RadioGroup, {
    "attrs": {
      "value": props.value
    },
    "class": bem$S('group')
  }, [List]), h("div", {
    "class": bem$S('bottom')
  }, [h(Button$2, {
    "attrs": {
      "round": true,
      "block": true,
      "type": "danger",
      "text": props.addText || t$i('addText')
    },
    "class": bem$S('add'),
    "on": {
      "click": function click() {
        emit(ctx, 'add');
      }
    }
  })])]);
}
ContactList.props = {
  value: null,
  list: Array,
  addText: String,
  defaultTagText: String
};
var ContactList$1 = createComponent$Z(ContactList);

var SECOND = 1000;
var MINUTE = 60 * SECOND;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
function parseTimeData(time) {
  var days = Math.floor(time / DAY);
  var hours = Math.floor(time % DAY / HOUR);
  var minutes = Math.floor(time % HOUR / MINUTE);
  var seconds = Math.floor(time % MINUTE / SECOND);
  var milliseconds = Math.floor(time % SECOND);
  return {
    days: days,
    hours: hours,
    minutes: minutes,
    seconds: seconds,
    milliseconds: milliseconds
  };
}
function parseFormat(format, timeData) {
  var days = timeData.days;
  var hours = timeData.hours,
    minutes = timeData.minutes,
    seconds = timeData.seconds,
    milliseconds = timeData.milliseconds;
  if (format.indexOf('DD') === -1) {
    hours += days * 24;
  } else {
    format = format.replace('DD', padZero(days));
  }
  if (format.indexOf('HH') === -1) {
    minutes += hours * 60;
  } else {
    format = format.replace('HH', padZero(hours));
  }
  if (format.indexOf('mm') === -1) {
    seconds += minutes * 60;
  } else {
    format = format.replace('mm', padZero(minutes));
  }
  if (format.indexOf('ss') === -1) {
    milliseconds += seconds * 1000;
  } else {
    format = format.replace('ss', padZero(seconds));
  }
  if (format.indexOf('S') !== -1) {
    var ms = padZero(milliseconds, 3);
    if (format.indexOf('SSS') !== -1) {
      format = format.replace('SSS', ms);
    } else if (format.indexOf('SS') !== -1) {
      format = format.replace('SS', ms.slice(0, 2));
    } else {
      format = format.replace('S', ms.charAt(0));
    }
  }
  return format;
}
function isSameSecond(time1, time2) {
  return Math.floor(time1 / 1000) === Math.floor(time2 / 1000);
}

var _createNamespace$U = createNamespace('count-down'),
  createComponent$Y = _createNamespace$U[0],
  bem$R = _createNamespace$U[1];
var CountDown = createComponent$Y({
  props: {
    millisecond: Boolean,
    time: {
      type: [Number, String],
      default: 0
    },
    format: {
      type: String,
      default: 'HH:mm:ss'
    },
    autoStart: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    return {
      remain: 0
    };
  },
  computed: {
    timeData: function timeData() {
      return parseTimeData(this.remain);
    },
    formattedTime: function formattedTime() {
      return parseFormat(this.format, this.timeData);
    }
  },
  watch: {
    time: {
      immediate: true,
      handler: 'reset'
    }
  },
  activated: function activated() {
    if (this.keepAlivePaused) {
      this.counting = true;
      this.keepAlivePaused = false;
      this.tick();
    }
  },
  deactivated: function deactivated() {
    if (this.counting) {
      this.pause();
      this.keepAlivePaused = true;
    }
  },
  beforeDestroy: function beforeDestroy() {
    this.pause();
  },
  methods: {
    // @exposed-api
    start: function start() {
      if (this.counting) {
        return;
      }
      this.counting = true;
      this.endTime = Date.now() + this.remain;
      this.tick();
    },
    // @exposed-api
    pause: function pause() {
      this.counting = false;
      cancelRaf(this.rafId);
    },
    // @exposed-api
    reset: function reset() {
      this.pause();
      this.remain = +this.time;
      if (this.autoStart) {
        this.start();
      }
    },
    tick: function tick() {
      // should not start counting in server
      // see: https://github.com/vant-ui/vant/issues/7807
      if (!inBrowser$1) {
        return;
      }
      if (this.millisecond) {
        this.microTick();
      } else {
        this.macroTick();
      }
    },
    microTick: function microTick() {
      var _this = this;
      this.rafId = raf(function () {
        /* istanbul ignore if */
        // in case of call reset immediately after finish
        if (!_this.counting) {
          return;
        }
        _this.setRemain(_this.getRemain());
        if (_this.remain > 0) {
          _this.microTick();
        }
      });
    },
    macroTick: function macroTick() {
      var _this2 = this;
      this.rafId = raf(function () {
        /* istanbul ignore if */
        // in case of call reset immediately after finish
        if (!_this2.counting) {
          return;
        }
        var remain = _this2.getRemain();
        if (!isSameSecond(remain, _this2.remain) || remain === 0) {
          _this2.setRemain(remain);
        }
        if (_this2.remain > 0) {
          _this2.macroTick();
        }
      });
    },
    getRemain: function getRemain() {
      return Math.max(this.endTime - Date.now(), 0);
    },
    setRemain: function setRemain(remain) {
      this.remain = remain;
      this.$emit('change', this.timeData);
      if (remain === 0) {
        this.pause();
        this.$emit('finish');
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$R()
    }, [this.slots('default', this.timeData) || this.formattedTime]);
  }
});

var _createNamespace$T = createNamespace('coupon'),
  createComponent$X = _createNamespace$T[0],
  bem$Q = _createNamespace$T[1],
  t$h = _createNamespace$T[2];
function formatTimeStamp(timeStamp) {
  // compatible when the timestamp is seconds
  if (timeStamp < Math.pow(10, 12)) {
    return timeStamp * 1000;
  }
  return +timeStamp;
}
function getDate(timeStamp) {
  var date = new Date(formatTimeStamp(timeStamp));
  return date.getFullYear() + "." + padZero(date.getMonth() + 1) + "." + padZero(date.getDate());
}
function formatDiscount(discount) {
  return (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
}
function formatAmount(amount) {
  return (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
}
var Coupon = createComponent$X({
  props: {
    coupon: Object,
    chosen: Boolean,
    disabled: Boolean,
    currency: {
      type: String,
      default: '¥'
    }
  },
  computed: {
    validPeriod: function validPeriod() {
      var _this$coupon = this.coupon,
        startAt = _this$coupon.startAt,
        endAt = _this$coupon.endAt,
        customValidPeriod = _this$coupon.customValidPeriod;
      return customValidPeriod || getDate(startAt) + " - " + getDate(endAt);
    },
    faceAmount: function faceAmount() {
      var coupon = this.coupon;
      if (coupon.valueDesc) {
        return coupon.valueDesc + "<span>" + (coupon.unitDesc || '') + "</span>";
      }
      if (coupon.denominations) {
        var denominations = formatAmount(coupon.denominations);
        return "<span>" + this.currency + "</span> " + denominations;
      }
      if (coupon.discount) {
        return t$h('discount', formatDiscount(coupon.discount));
      }
      return '';
    },
    conditionMessage: function conditionMessage() {
      var condition = formatAmount(this.coupon.originCondition);
      return condition === '0' ? t$h('unlimited') : t$h('condition', condition);
    }
  },
  render: function render() {
    var h = arguments[0];
    var coupon = this.coupon,
      disabled = this.disabled;
    var description = disabled && coupon.reason || coupon.description;
    return h("div", {
      "class": bem$Q({
        disabled: disabled
      })
    }, [h("div", {
      "class": bem$Q('content')
    }, [h("div", {
      "class": bem$Q('head')
    }, [h("h2", {
      "class": bem$Q('amount'),
      "domProps": {
        "innerHTML": this.faceAmount
      }
    }), h("p", {
      "class": bem$Q('condition')
    }, [this.coupon.condition || this.conditionMessage])]), h("div", {
      "class": bem$Q('body')
    }, [h("p", {
      "class": bem$Q('name')
    }, [coupon.name]), h("p", {
      "class": bem$Q('valid')
    }, [this.validPeriod]), !this.disabled && h(Checkbox, {
      "attrs": {
        "size": 18,
        "value": this.chosen,
        "checkedColor": RED
      },
      "class": bem$Q('corner')
    })])]), description && h("p", {
      "class": bem$Q('description')
    }, [description])]);
  }
});

var _createNamespace$S = createNamespace('coupon-cell'),
  createComponent$W = _createNamespace$S[0],
  bem$P = _createNamespace$S[1],
  t$g = _createNamespace$S[2];
function formatValue(props) {
  var coupons = props.coupons,
    chosenCoupon = props.chosenCoupon,
    currency = props.currency;
  var coupon = coupons[+chosenCoupon];
  if (coupon) {
    var value = 0;
    if (isDef$1(coupon.value)) {
      value = coupon.value;
    } else if (isDef$1(coupon.denominations)) {
      value = coupon.denominations;
    }
    return "-" + currency + " " + (value / 100).toFixed(2);
  }
  return coupons.length === 0 ? t$g('tips') : t$g('count', coupons.length);
}
function CouponCell(h, props, slots, ctx) {
  var selected = props.coupons[+props.chosenCoupon];
  var value = formatValue(props);
  return h(Cell$1, _mergeJSXProps([{
    "class": bem$P(),
    "attrs": {
      "value": value,
      "title": props.title || t$g('title'),
      "border": props.border,
      "isLink": props.editable,
      "valueClass": bem$P('value', {
        selected: selected
      })
    }
  }, inherit(ctx, true)]));
}
CouponCell.model = {
  prop: 'chosenCoupon'
};
CouponCell.props = {
  title: String,
  coupons: {
    type: Array,
    default: function _default() {
      return [];
    }
  },
  currency: {
    type: String,
    default: '¥'
  },
  border: {
    type: Boolean,
    default: true
  },
  editable: {
    type: Boolean,
    default: true
  },
  chosenCoupon: {
    type: [Number, String],
    default: -1
  }
};
var CouponCell$1 = createComponent$W(CouponCell);

// Utils
var _createNamespace$R = createNamespace('coupon-list'),
  createComponent$V = _createNamespace$R[0],
  bem$O = _createNamespace$R[1],
  t$f = _createNamespace$R[2];
var EMPTY_IMAGE = 'https://img01.yzcdn.cn/vant/coupon-empty.png';
var CouponList = createComponent$V({
  model: {
    prop: 'code'
  },
  props: {
    code: String,
    closeButtonText: String,
    inputPlaceholder: String,
    enabledTitle: String,
    disabledTitle: String,
    exchangeButtonText: String,
    exchangeButtonLoading: Boolean,
    exchangeButtonDisabled: Boolean,
    exchangeMinLength: {
      type: Number,
      default: 1
    },
    chosenCoupon: {
      type: Number,
      default: -1
    },
    coupons: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    disabledCoupons: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    displayedCouponIndex: {
      type: Number,
      default: -1
    },
    showExchangeBar: {
      type: Boolean,
      default: true
    },
    showCloseButton: {
      type: Boolean,
      default: true
    },
    showCount: {
      type: Boolean,
      default: true
    },
    currency: {
      type: String,
      default: '¥'
    },
    emptyImage: {
      type: String,
      default: EMPTY_IMAGE
    }
  },
  data: function data() {
    return {
      tab: 0,
      winHeight: window.innerHeight,
      currentCode: this.code || ''
    };
  },
  computed: {
    buttonDisabled: function buttonDisabled() {
      return !this.exchangeButtonLoading && (this.exchangeButtonDisabled || !this.currentCode || this.currentCode.length < this.exchangeMinLength);
    },
    listStyle: function listStyle() {
      return {
        height: this.winHeight - (this.showExchangeBar ? 140 : 94) + 'px'
      };
    }
  },
  watch: {
    code: function code(_code) {
      this.currentCode = _code;
    },
    currentCode: function currentCode(code) {
      this.$emit('input', code);
    },
    displayedCouponIndex: 'scrollToShowCoupon'
  },
  mounted: function mounted() {
    this.scrollToShowCoupon(this.displayedCouponIndex);
  },
  methods: {
    onClickExchangeButton: function onClickExchangeButton() {
      this.$emit('exchange', this.currentCode); // auto clear currentCode when not use vModel

      if (!this.code) {
        this.currentCode = '';
      }
    },
    // scroll to show specific coupon
    scrollToShowCoupon: function scrollToShowCoupon(index) {
      var _this = this;
      if (index === -1) {
        return;
      }
      this.$nextTick(function () {
        var _this$$refs = _this.$refs,
          card = _this$$refs.card,
          list = _this$$refs.list;
        /* istanbul ignore next */

        if (list && card && card[index]) {
          list.scrollTop = card[index].$el.offsetTop - 100;
        }
      });
    },
    genEmpty: function genEmpty() {
      var h = this.$createElement;
      return h("div", {
        "class": bem$O('empty')
      }, [h("img", {
        "attrs": {
          "src": this.emptyImage
        }
      }), h("p", [t$f('empty')])]);
    },
    genExchangeButton: function genExchangeButton() {
      var h = this.$createElement;
      return h(Button$2, {
        "attrs": {
          "plain": true,
          "type": "danger",
          "text": this.exchangeButtonText || t$f('exchange'),
          "loading": this.exchangeButtonLoading,
          "disabled": this.buttonDisabled
        },
        "class": bem$O('exchange'),
        "on": {
          "click": this.onClickExchangeButton
        }
      });
    }
  },
  render: function render() {
    var _this2 = this;
    var h = arguments[0];
    var coupons = this.coupons,
      disabledCoupons = this.disabledCoupons;
    var count = this.showCount ? " (" + coupons.length + ")" : '';
    var title = (this.enabledTitle || t$f('enable')) + count;
    var disabledCount = this.showCount ? " (" + disabledCoupons.length + ")" : '';
    var disabledTitle = (this.disabledTitle || t$f('disabled')) + disabledCount;
    var ExchangeBar = this.showExchangeBar && h("div", {
      "class": bem$O('exchange-bar')
    }, [h(Field, {
      "attrs": {
        "clearable": true,
        "border": false,
        "placeholder": this.inputPlaceholder || t$f('placeholder'),
        "maxlength": "20"
      },
      "class": bem$O('field'),
      "model": {
        value: _this2.currentCode,
        callback: function callback($$v) {
          _this2.currentCode = $$v;
        }
      }
    }), this.genExchangeButton()]);
    var onChange = function onChange(index) {
      return function () {
        return _this2.$emit('change', index);
      };
    };
    var CouponTab = h(Tab, {
      "attrs": {
        "title": title
      }
    }, [h("div", {
      "class": bem$O('list', {
        'with-bottom': this.showCloseButton
      }),
      "style": this.listStyle
    }, [coupons.map(function (coupon, index) {
      return h(Coupon, {
        "ref": "card",
        "key": coupon.id,
        "attrs": {
          "coupon": coupon,
          "currency": _this2.currency,
          "chosen": index === _this2.chosenCoupon
        },
        "nativeOn": {
          "click": onChange(index)
        }
      });
    }), !coupons.length && this.genEmpty(), this.slots('list-footer')])]);
    var DisabledCouponTab = h(Tab, {
      "attrs": {
        "title": disabledTitle
      }
    }, [h("div", {
      "class": bem$O('list', {
        'with-bottom': this.showCloseButton
      }),
      "style": this.listStyle
    }, [disabledCoupons.map(function (coupon) {
      return h(Coupon, {
        "attrs": {
          "disabled": true,
          "coupon": coupon,
          "currency": _this2.currency
        },
        "key": coupon.id
      });
    }), !disabledCoupons.length && this.genEmpty(), this.slots('disabled-list-footer')])]);
    return h("div", {
      "class": bem$O()
    }, [ExchangeBar, h(Tabs, {
      "class": bem$O('tab'),
      "attrs": {
        "border": false
      },
      "model": {
        value: _this2.tab,
        callback: function callback($$v) {
          _this2.tab = $$v;
        }
      }
    }, [CouponTab, DisabledCouponTab]), h("div", {
      "class": bem$O('bottom')
    }, [h(Button$2, {
      "directives": [{
        name: "show",
        value: this.showCloseButton
      }],
      "attrs": {
        "round": true,
        "type": "danger",
        "block": true,
        "text": this.closeButtonText || t$f('close')
      },
      "class": bem$O('close'),
      "on": {
        "click": onChange(-1)
      }
    })])]);
  }
});

var sharedProps = _extends$1({}, pickerProps, {
  value: null,
  filter: Function,
  columnsOrder: Array,
  showToolbar: {
    type: Boolean,
    default: true
  },
  formatter: {
    type: Function,
    default: function _default(type, value) {
      return value;
    }
  }
});
var TimePickerMixin = {
  data: function data() {
    return {
      innerValue: this.formatValue(this.value)
    };
  },
  computed: {
    originColumns: function originColumns() {
      var _this = this;
      return this.ranges.map(function (_ref) {
        var type = _ref.type,
          rangeArr = _ref.range;
        var values = times(rangeArr[1] - rangeArr[0] + 1, function (index) {
          var value = padZero(rangeArr[0] + index);
          return value;
        });
        if (_this.filter) {
          values = _this.filter(type, values);
        }
        return {
          type: type,
          values: values
        };
      });
    },
    columns: function columns() {
      var _this2 = this;
      return this.originColumns.map(function (column) {
        return {
          values: column.values.map(function (value) {
            return _this2.formatter(column.type, value);
          })
        };
      });
    }
  },
  watch: {
    columns: 'updateColumnValue',
    innerValue: function innerValue(val, oldVal) {
      if (!oldVal) {
        this.$emit('input', null);
      } else {
        this.$emit('input', val);
      }
    }
  },
  mounted: function mounted() {
    var _this3 = this;
    this.updateColumnValue();
    this.$nextTick(function () {
      _this3.updateInnerValue();
    });
  },
  methods: {
    getPicker: function getPicker() {
      return this.$refs.picker;
    },
    // https://github.com/vant-ui/vant/issues/10013
    getProxiedPicker: function getProxiedPicker() {
      var _this4 = this;
      var picker = this.$refs.picker;
      if (picker) {
        var proxy = function proxy(fn) {
          return function () {
            picker[fn].apply(picker, arguments);
            _this4.updateInnerValue();
          };
        };
        return _extends$1({}, picker, {
          setValues: proxy('setValues'),
          setIndexes: proxy('setIndexes'),
          setColumnIndex: proxy('setColumnIndex'),
          setColumnValue: proxy('setColumnValue')
        });
      }
    },
    onConfirm: function onConfirm() {
      this.$emit('input', this.innerValue);
      this.$emit('confirm', this.innerValue);
    },
    onCancel: function onCancel() {
      this.$emit('cancel');
    }
  },
  render: function render() {
    var _this5 = this;
    var h = arguments[0];
    var props = {};
    Object.keys(pickerProps).forEach(function (key) {
      props[key] = _this5[key];
    });
    return h(Picker, {
      "ref": "picker",
      "attrs": {
        "columns": this.columns,
        "readonly": this.readonly
      },
      "scopedSlots": this.$scopedSlots,
      "on": {
        "change": this.onChange,
        "confirm": this.onConfirm,
        "cancel": this.onCancel
      },
      "props": _extends$1({}, props)
    });
  }
};

var _createNamespace$Q = createNamespace('time-picker'),
  createComponent$U = _createNamespace$Q[0];
var TimePicker = createComponent$U({
  mixins: [TimePickerMixin],
  props: _extends$1({}, sharedProps, {
    minHour: {
      type: [Number, String],
      default: 0
    },
    maxHour: {
      type: [Number, String],
      default: 23
    },
    minMinute: {
      type: [Number, String],
      default: 0
    },
    maxMinute: {
      type: [Number, String],
      default: 59
    }
  }),
  computed: {
    ranges: function ranges() {
      return [{
        type: 'hour',
        range: [+this.minHour, +this.maxHour]
      }, {
        type: 'minute',
        range: [+this.minMinute, +this.maxMinute]
      }];
    }
  },
  watch: {
    filter: 'updateInnerValue',
    minHour: function minHour() {
      var _this = this;
      this.$nextTick(function () {
        _this.updateInnerValue();
      });
    },
    maxHour: function maxHour(value) {
      var _this$innerValue$spli = this.innerValue.split(':'),
        hour = _this$innerValue$spli[0],
        minute = _this$innerValue$spli[1];
      if (hour >= value) {
        this.innerValue = this.formatValue(value + ":" + minute);
        this.updateColumnValue();
      } else {
        this.updateInnerValue();
      }
    },
    minMinute: 'updateInnerValue',
    maxMinute: function maxMinute(value) {
      var _this$innerValue$spli2 = this.innerValue.split(':'),
        hour = _this$innerValue$spli2[0],
        minute = _this$innerValue$spli2[1];
      if (minute >= value) {
        this.innerValue = this.formatValue(hour + ":" + value);
        this.updateColumnValue();
      } else {
        this.updateInnerValue();
      }
    },
    value: function value(val) {
      val = this.formatValue(val);
      if (val !== this.innerValue) {
        this.innerValue = val;
        this.updateColumnValue();
      }
    }
  },
  methods: {
    formatValue: function formatValue(value) {
      if (!value) {
        value = padZero(this.minHour) + ":" + padZero(this.minMinute);
      }
      var _value$split = value.split(':'),
        hour = _value$split[0],
        minute = _value$split[1];
      hour = padZero(range$1(hour, this.minHour, this.maxHour));
      minute = padZero(range$1(minute, this.minMinute, this.maxMinute));
      return hour + ":" + minute;
    },
    updateInnerValue: function updateInnerValue() {
      var _this$getPicker$getIn = this.getPicker().getIndexes(),
        hourIndex = _this$getPicker$getIn[0],
        minuteIndex = _this$getPicker$getIn[1];
      var _this$originColumns = this.originColumns,
        hourColumn = _this$originColumns[0],
        minuteColumn = _this$originColumns[1];
      var hour = hourColumn.values[hourIndex] || hourColumn.values[0];
      var minute = minuteColumn.values[minuteIndex] || minuteColumn.values[0];
      this.innerValue = this.formatValue(hour + ":" + minute);
      this.updateColumnValue();
    },
    onChange: function onChange(picker) {
      var _this2 = this;
      this.updateInnerValue();
      this.$nextTick(function () {
        _this2.$nextTick(function () {
          // https://github.com/vant-ui/vant/issues/9775
          _this2.updateInnerValue();
          _this2.$emit('change', picker);
        });
      });
    },
    updateColumnValue: function updateColumnValue() {
      var _this3 = this;
      var formatter = this.formatter;
      var pair = this.innerValue.split(':');
      var values = [formatter('hour', pair[0]), formatter('minute', pair[1])];
      this.$nextTick(function () {
        _this3.getPicker().setValues(values);
      });
    }
  }
});

function _isNativeReflectConstruct() {
  try {
    var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  } catch (t) {}
  return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
    return !!t;
  })();
}

function _setPrototypeOf(t, e) {
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
    return t.__proto__ = e, t;
  }, _setPrototypeOf(t, e);
}

function _construct(t, e, r) {
  if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
  var o = [null];
  o.push.apply(o, e);
  var p = new (t.bind.apply(t, o))();
  return r && _setPrototypeOf(p, r.prototype), p;
}

var currentYear = new Date().getFullYear();
var _createNamespace$P = createNamespace('date-picker'),
  createComponent$T = _createNamespace$P[0];
var DatePicker = createComponent$T({
  mixins: [TimePickerMixin],
  props: _extends$1({}, sharedProps, {
    type: {
      type: String,
      default: 'datetime'
    },
    minDate: {
      type: Date,
      default: function _default() {
        return new Date(currentYear - 10, 0, 1);
      },
      validator: isDate$1
    },
    maxDate: {
      type: Date,
      default: function _default() {
        return new Date(currentYear + 10, 11, 31);
      },
      validator: isDate$1
    }
  }),
  watch: {
    filter: 'updateInnerValue',
    minDate: function minDate() {
      var _this = this;
      this.$nextTick(function () {
        _this.updateInnerValue();
      });
    },
    maxDate: function maxDate(value) {
      if (this.innerValue.valueOf() >= value.valueOf()) {
        this.innerValue = value;
      } else {
        this.updateInnerValue();
      }
    },
    value: function value(val) {
      val = this.formatValue(val);
      if (val && val.valueOf() !== this.innerValue.valueOf()) {
        this.innerValue = val;
      }
    }
  },
  computed: {
    ranges: function ranges() {
      var _this$getBoundary = this.getBoundary('max', this.innerValue ? this.innerValue : this.minDate),
        maxYear = _this$getBoundary.maxYear,
        maxDate = _this$getBoundary.maxDate,
        maxMonth = _this$getBoundary.maxMonth,
        maxHour = _this$getBoundary.maxHour,
        maxMinute = _this$getBoundary.maxMinute;
      var _this$getBoundary2 = this.getBoundary('min', this.innerValue ? this.innerValue : this.minDate),
        minYear = _this$getBoundary2.minYear,
        minDate = _this$getBoundary2.minDate,
        minMonth = _this$getBoundary2.minMonth,
        minHour = _this$getBoundary2.minHour,
        minMinute = _this$getBoundary2.minMinute;
      var result = [{
        type: 'year',
        range: [minYear, maxYear]
      }, {
        type: 'month',
        range: [minMonth, maxMonth]
      }, {
        type: 'day',
        range: [minDate, maxDate]
      }, {
        type: 'hour',
        range: [minHour, maxHour]
      }, {
        type: 'minute',
        range: [minMinute, maxMinute]
      }];
      switch (this.type) {
        case 'date':
          result = result.slice(0, 3);
          break;
        case 'year-month':
          result = result.slice(0, 2);
          break;
        case 'month-day':
          result = result.slice(1, 3);
          break;
        case 'datehour':
          result = result.slice(0, 4);
          break;
      }
      if (this.columnsOrder) {
        var columnsOrder = this.columnsOrder.concat(result.map(function (column) {
          return column.type;
        }));
        result.sort(function (a, b) {
          return columnsOrder.indexOf(a.type) - columnsOrder.indexOf(b.type);
        });
      }
      return result;
    }
  },
  methods: {
    formatValue: function formatValue(value) {
      var _this2 = this;
      if (!isDate$1(value)) {
        return null;
      }
      var minDate = new Date(this.minDate);
      var maxDate = new Date(this.maxDate);
      var dateMethods = {
        year: 'getFullYear',
        month: 'getMonth',
        day: 'getDate',
        hour: 'getHours',
        minute: 'getMinutes'
      };
      if (this.originColumns) {
        var dateColumns = this.originColumns.map(function (_ref, index) {
          var type = _ref.type,
            values = _ref.values;
          var range = _this2.ranges[index].range;
          var minDateVal = minDate[dateMethods[type]]();
          var maxDateVal = maxDate[dateMethods[type]]();
          var min = type === 'month' ? +values[0] - 1 : +values[0];
          var max = type === 'month' ? +values[values.length - 1] - 1 : +values[values.length - 1];
          return {
            type: type,
            values: [minDateVal < range[0] ? Math.max(minDateVal, min) : min || minDateVal, maxDateVal > range[1] ? Math.min(maxDateVal, max) : max || maxDateVal]
          };
        });
        if (this.type === 'month-day') {
          var year = (this.innerValue || this.minDate).getFullYear();
          dateColumns.unshift({
            type: 'year',
            values: [year, year]
          });
        }
        var dates = Object.keys(dateMethods).map(function (type) {
          var _dateColumns$filter$;
          return (_dateColumns$filter$ = dateColumns.filter(function (item) {
            return item.type === type;
          })[0]) == null ? void 0 : _dateColumns$filter$.values;
        }).filter(function (item) {
          return item;
        });
        minDate = _construct(Date, dates.map(function (val) {
          return getTrueValue(val[0]);
        }));
        maxDate = _construct(Date, dates.map(function (val) {
          return getTrueValue(val[1]);
        }));
      }
      value = Math.max(value, minDate.getTime());
      value = Math.min(value, maxDate.getTime());
      return new Date(value);
    },
    getBoundary: function getBoundary(type, value) {
      var _ref2;
      var boundary = this[type + "Date"];
      var year = boundary.getFullYear();
      var month = 1;
      var date = 1;
      var hour = 0;
      var minute = 0;
      if (type === 'max') {
        month = 12;
        date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
        hour = 23;
        minute = 59;
      }
      if (value.getFullYear() === year) {
        month = boundary.getMonth() + 1;
        if (value.getMonth() + 1 === month) {
          date = boundary.getDate();
          if (value.getDate() === date) {
            hour = boundary.getHours();
            if (value.getHours() === hour) {
              minute = boundary.getMinutes();
            }
          }
        }
      }
      return _ref2 = {}, _ref2[type + "Year"] = year, _ref2[type + "Month"] = month, _ref2[type + "Date"] = date, _ref2[type + "Hour"] = hour, _ref2[type + "Minute"] = minute, _ref2;
    },
    updateInnerValue: function updateInnerValue() {
      var _this3 = this;
      var type = this.type;
      var indexes = this.getPicker().getIndexes();
      var getValue = function getValue(type) {
        var index = 0;
        _this3.originColumns.forEach(function (column, columnIndex) {
          if (type === column.type) {
            index = columnIndex;
          }
        });
        var values = _this3.originColumns[index].values;
        return getTrueValue(values[indexes[index]]);
      };
      var year;
      var month;
      var day;
      if (type === 'month-day') {
        year = (this.innerValue || this.minDate).getFullYear();
        month = getValue('month');
        day = getValue('day');
      } else {
        year = getValue('year');
        month = getValue('month');
        day = type === 'year-month' ? 1 : getValue('day');
      }
      var maxDay = getMonthEndDay(year, month);
      day = day > maxDay ? maxDay : day;
      var hour = 0;
      var minute = 0;
      if (type === 'datehour') {
        hour = getValue('hour');
      }
      if (type === 'datetime') {
        hour = getValue('hour');
        minute = getValue('minute');
      }
      var value = new Date(year, month - 1, day, hour, minute);
      this.innerValue = this.formatValue(value);
    },
    onChange: function onChange(picker) {
      var _this4 = this;
      this.updateInnerValue();
      this.$nextTick(function () {
        _this4.$nextTick(function () {
          // https://github.com/vant-ui/vant/issues/9775
          _this4.updateInnerValue();
          _this4.$emit('change', picker);
        });
      });
    },
    updateColumnValue: function updateColumnValue() {
      var _this5 = this;
      var value = this.innerValue ? this.innerValue : this.minDate;
      var formatter = this.formatter;
      var values = this.originColumns.map(function (column) {
        switch (column.type) {
          case 'year':
            return formatter('year', "" + value.getFullYear());
          case 'month':
            return formatter('month', padZero(value.getMonth() + 1));
          case 'day':
            return formatter('day', padZero(value.getDate()));
          case 'hour':
            return formatter('hour', padZero(value.getHours()));
          case 'minute':
            return formatter('minute', padZero(value.getMinutes()));
          default:
            // no default
            return null;
        }
      });
      this.$nextTick(function () {
        _this5.getPicker().setValues(values);
      });
    }
  }
});

var _createNamespace$O = createNamespace('datetime-picker'),
  createComponent$S = _createNamespace$O[0],
  bem$N = _createNamespace$O[1];
var DatetimePicker = createComponent$S({
  props: _extends$1({}, TimePicker.props, DatePicker.props),
  methods: {
    // @exposed-api
    getPicker: function getPicker() {
      return this.$refs.root.getProxiedPicker();
    }
  },
  render: function render() {
    var h = arguments[0];
    var Component = this.type === 'time' ? TimePicker : DatePicker;
    return h(Component, {
      "ref": "root",
      "class": bem$N(),
      "scopedSlots": this.$scopedSlots,
      "props": _extends$1({}, this.$props),
      "on": _extends$1({}, this.$listeners)
    });
  }
});

var _createNamespace$N = createNamespace('divider'),
  createComponent$R = _createNamespace$N[0],
  bem$M = _createNamespace$N[1];
function Divider(h, props, slots, ctx) {
  var _bem;
  return h("div", _mergeJSXProps([{
    "attrs": {
      "role": "separator"
    },
    "style": {
      borderColor: props.borderColor
    },
    "class": bem$M((_bem = {
      dashed: props.dashed,
      hairline: props.hairline
    }, _bem["content-" + props.contentPosition] = slots.default, _bem))
  }, inherit(ctx, true)]), [slots.default && slots.default()]);
}
Divider.props = {
  dashed: Boolean,
  hairline: {
    type: Boolean,
    default: true
  },
  contentPosition: {
    type: String,
    default: 'center'
  }
};
var Divider$1 = createComponent$R(Divider);

// Utils
var _createNamespace$M = createNamespace('dropdown-item'),
  createComponent$Q = _createNamespace$M[0],
  bem$L = _createNamespace$M[1];
var DropdownItem = createComponent$Q({
  mixins: [PortalMixin({
    ref: 'wrapper'
  }), ChildrenMixin('vanDropdownMenu')],
  props: {
    value: null,
    title: String,
    disabled: Boolean,
    titleClass: String,
    options: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    lazyRender: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    return {
      transition: true,
      showPopup: false,
      showWrapper: false
    };
  },
  computed: {
    displayTitle: function displayTitle() {
      var _this = this;
      if (this.title) {
        return this.title;
      }
      var match = this.options.filter(function (option) {
        return option.value === _this.value;
      });
      return match.length ? match[0].text : '';
    }
  },
  watch: {
    showPopup: function showPopup(val) {
      this.bindScroll(val);
    }
  },
  beforeCreate: function beforeCreate() {
    var _this2 = this;
    var createEmitter = function createEmitter(eventName) {
      return function () {
        return _this2.$emit(eventName);
      };
    };
    this.onOpen = createEmitter('open');
    this.onClose = createEmitter('close');
    this.onOpened = createEmitter('opened');
  },
  methods: {
    // @exposed-api
    toggle: function toggle(show, options) {
      if (show === void 0) {
        show = !this.showPopup;
      }
      if (options === void 0) {
        options = {};
      }
      if (show === this.showPopup) {
        return;
      }
      this.transition = !options.immediate;
      this.showPopup = show;
      if (show) {
        this.parent.updateOffset();
        this.showWrapper = true;
      }
    },
    bindScroll: function bindScroll(bind) {
      var scroller = this.parent.scroller;
      var action = bind ? on$2 : off$2;
      action(scroller, 'scroll', this.onScroll, true);
    },
    onScroll: function onScroll() {
      this.parent.updateOffset();
    },
    onClickWrapper: function onClickWrapper(event) {
      // prevent being identified as clicking outside and closed when use get-contaienr
      if (this.getContainer) {
        event.stopPropagation();
      }
    }
  },
  render: function render() {
    var _this3 = this;
    var h = arguments[0];
    var _this$parent = this.parent,
      zIndex = _this$parent.zIndex,
      offset = _this$parent.offset,
      overlay = _this$parent.overlay,
      duration = _this$parent.duration,
      direction = _this$parent.direction,
      activeColor = _this$parent.activeColor,
      closeOnClickOverlay = _this$parent.closeOnClickOverlay;
    var Options = this.options.map(function (option) {
      var active = option.value === _this3.value;
      return h(Cell$1, {
        "attrs": {
          "clickable": true,
          "icon": option.icon,
          "title": option.text
        },
        "key": option.value,
        "class": bem$L('option', {
          active: active
        }),
        "style": {
          color: active ? activeColor : ''
        },
        "on": {
          "click": function click() {
            _this3.showPopup = false;
            if (option.value !== _this3.value) {
              _this3.$emit('input', option.value);
              _this3.$emit('change', option.value);
            }
          }
        }
      }, [active && h(Icon$3, {
        "class": bem$L('icon'),
        "attrs": {
          "color": activeColor,
          "name": "success"
        }
      })]);
    });
    var style = {
      zIndex: zIndex
    };
    if (direction === 'down') {
      style.top = offset + "px";
    } else {
      style.bottom = offset + "px";
    }
    return h("div", [h("div", {
      "directives": [{
        name: "show",
        value: this.showWrapper
      }],
      "ref": "wrapper",
      "style": style,
      "class": bem$L([direction]),
      "on": {
        "click": this.onClickWrapper
      }
    }, [h(Popup, {
      "attrs": {
        "overlay": overlay,
        "position": direction === 'down' ? 'top' : 'bottom',
        "duration": this.transition ? duration : 0,
        "lazyRender": this.lazyRender,
        "overlayStyle": {
          position: 'absolute'
        },
        "closeOnClickOverlay": closeOnClickOverlay
      },
      "class": bem$L('content'),
      "on": {
        "open": this.onOpen,
        "close": this.onClose,
        "opened": this.onOpened,
        "closed": function closed() {
          _this3.showWrapper = false;
          _this3.$emit('closed');
        }
      },
      "model": {
        value: _this3.showPopup,
        callback: function callback($$v) {
          _this3.showPopup = $$v;
        }
      }
    }, [Options, this.slots('default')])])]);
  }
});

/**
 * Listen to click outside event
 */
var ClickOutsideMixin = function ClickOutsideMixin(config) {
  return {
    props: {
      closeOnClickOutside: {
        type: Boolean,
        default: true
      }
    },
    data: function data() {
      var _this = this;
      var clickOutsideHandler = function clickOutsideHandler(event) {
        if (_this.closeOnClickOutside && !_this.$el.contains(event.target)) {
          _this[config.method]();
        }
      };
      return {
        clickOutsideHandler: clickOutsideHandler
      };
    },
    mounted: function mounted() {
      on$2(document, config.event, this.clickOutsideHandler);
    },
    beforeDestroy: function beforeDestroy() {
      off$2(document, config.event, this.clickOutsideHandler);
    }
  };
};

// Utils
var _createNamespace$L = createNamespace('dropdown-menu'),
  createComponent$P = _createNamespace$L[0],
  bem$K = _createNamespace$L[1];
var DropdownMenu = createComponent$P({
  mixins: [ParentMixin('vanDropdownMenu'), ClickOutsideMixin({
    event: 'click',
    method: 'onClickOutside'
  })],
  props: {
    zIndex: [Number, String],
    activeColor: String,
    overlay: {
      type: Boolean,
      default: true
    },
    duration: {
      type: [Number, String],
      default: 0.2
    },
    direction: {
      type: String,
      default: 'down'
    },
    closeOnClickOverlay: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    return {
      offset: 0
    };
  },
  computed: {
    scroller: function scroller() {
      return getScroller(this.$el);
    },
    opened: function opened() {
      return this.children.some(function (item) {
        return item.showWrapper;
      });
    },
    barStyle: function barStyle() {
      if (this.opened && isDef$1(this.zIndex)) {
        return {
          zIndex: 1 + this.zIndex
        };
      }
    }
  },
  methods: {
    updateOffset: function updateOffset() {
      if (!this.$refs.bar) {
        return;
      }
      var rect = this.$refs.bar.getBoundingClientRect();
      if (this.direction === 'down') {
        this.offset = rect.bottom;
      } else {
        this.offset = window.innerHeight - rect.top;
      }
    },
    toggleItem: function toggleItem(active) {
      this.children.forEach(function (item, index) {
        if (index === active) {
          item.toggle();
        } else if (item.showPopup) {
          item.toggle(false, {
            immediate: true
          });
        }
      });
    },
    onClickOutside: function onClickOutside() {
      this.children.forEach(function (item) {
        item.toggle(false);
      });
    }
  },
  render: function render() {
    var _this = this;
    var h = arguments[0];
    var Titles = this.children.map(function (item, index) {
      return h("div", {
        "attrs": {
          "role": "button",
          "tabindex": item.disabled ? -1 : 0
        },
        "class": bem$K('item', {
          disabled: item.disabled
        }),
        "on": {
          "click": function click() {
            if (!item.disabled) {
              _this.toggleItem(index);
            }
          }
        }
      }, [h("span", {
        "class": [bem$K('title', {
          active: item.showPopup,
          down: item.showPopup === (_this.direction === 'down')
        }), item.titleClass],
        "style": {
          color: item.showPopup ? _this.activeColor : ''
        }
      }, [h("div", {
        "class": "van-ellipsis"
      }, [item.slots('title') || item.displayTitle])])]);
    });
    return h("div", {
      "class": bem$K()
    }, [h("div", {
      "ref": "bar",
      "style": this.barStyle,
      "class": bem$K('bar', {
        opened: this.opened
      })
    }, [Titles]), this.slots('default')]);
  }
});

var prefix = 'van-empty-network-';
var Network = {
  render: function render() {
    var h = arguments[0];
    var genStop = function genStop(color, offset, opacity) {
      return h("stop", {
        "attrs": {
          "stop-color": color,
          "offset": offset + "%",
          "stop-opacity": opacity
        }
      });
    };
    return h("svg", {
      "attrs": {
        "viewBox": "0 0 160 160",
        "xmlns": "http://www.w3.org/2000/svg"
      }
    }, [h("defs", [h("linearGradient", {
      "attrs": {
        "id": prefix + "1",
        "x1": "64.022%",
        "y1": "100%",
        "x2": "64.022%",
        "y2": "0%"
      }
    }, [genStop('#FFF', 0, 0.5), genStop('#F2F3F5', 100)]), h("linearGradient", {
      "attrs": {
        "id": prefix + "2",
        "x1": "50%",
        "y1": "0%",
        "x2": "50%",
        "y2": "84.459%"
      }
    }, [genStop('#EBEDF0', 0), genStop('#DCDEE0', 100, 0)]), h("linearGradient", {
      "attrs": {
        "id": prefix + "3",
        "x1": "100%",
        "y1": "0%",
        "x2": "100%",
        "y2": "100%"
      }
    }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("linearGradient", {
      "attrs": {
        "id": prefix + "4",
        "x1": "100%",
        "y1": "100%",
        "x2": "100%",
        "y2": "0%"
      }
    }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("linearGradient", {
      "attrs": {
        "id": prefix + "5",
        "x1": "0%",
        "y1": "43.982%",
        "x2": "100%",
        "y2": "54.703%"
      }
    }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("linearGradient", {
      "attrs": {
        "id": prefix + "6",
        "x1": "94.535%",
        "y1": "43.837%",
        "x2": "5.465%",
        "y2": "54.948%"
      }
    }, [genStop('#EAEDF0', 0), genStop('#DCDEE0', 100)]), h("radialGradient", {
      "attrs": {
        "id": prefix + "7",
        "cx": "50%",
        "cy": "0%",
        "fx": "50%",
        "fy": "0%",
        "r": "100%",
        "gradientTransform": "matrix(0 1 -.54835 0 .5 -.5)"
      }
    }, [genStop('#EBEDF0', 0), genStop('#FFF', 100, 0)])]), h("g", {
      "attrs": {
        "fill": "none",
        "fill-rule": "evenodd"
      }
    }, [h("g", {
      "attrs": {
        "opacity": ".8"
      }
    }, [h("path", {
      "attrs": {
        "d": "M0 124V46h20v20h14v58H0z",
        "fill": "url(#" + prefix + "1)",
        "transform": "matrix(-1 0 0 1 36 7)"
      }
    }), h("path", {
      "attrs": {
        "d": "M121 8h22.231v14H152v77.37h-31V8z",
        "fill": "url(#" + prefix + "1)",
        "transform": "translate(2 7)"
      }
    })]), h("path", {
      "attrs": {
        "fill": "url(#" + prefix + "7)",
        "d": "M0 139h160v21H0z"
      }
    }), h("path", {
      "attrs": {
        "d": "M37 18a7 7 0 013 13.326v26.742c0 1.23-.997 2.227-2.227 2.227h-1.546A2.227 2.227 0 0134 58.068V31.326A7 7 0 0137 18z",
        "fill": "url(#" + prefix + "2)",
        "fill-rule": "nonzero",
        "transform": "translate(43 36)"
      }
    }), h("g", {
      "attrs": {
        "opacity": ".6",
        "stroke-linecap": "round",
        "stroke-width": "7"
      }
    }, [h("path", {
      "attrs": {
        "d": "M20.875 11.136a18.868 18.868 0 00-5.284 13.121c0 5.094 2.012 9.718 5.284 13.12",
        "stroke": "url(#" + prefix + "3)",
        "transform": "translate(43 36)"
      }
    }), h("path", {
      "attrs": {
        "d": "M9.849 0C3.756 6.225 0 14.747 0 24.146c0 9.398 3.756 17.92 9.849 24.145",
        "stroke": "url(#" + prefix + "3)",
        "transform": "translate(43 36)"
      }
    }), h("path", {
      "attrs": {
        "d": "M57.625 11.136a18.868 18.868 0 00-5.284 13.121c0 5.094 2.012 9.718 5.284 13.12",
        "stroke": "url(#" + prefix + "4)",
        "transform": "rotate(-180 76.483 42.257)"
      }
    }), h("path", {
      "attrs": {
        "d": "M73.216 0c-6.093 6.225-9.849 14.747-9.849 24.146 0 9.398 3.756 17.92 9.849 24.145",
        "stroke": "url(#" + prefix + "4)",
        "transform": "rotate(-180 89.791 42.146)"
      }
    })]), h("g", {
      "attrs": {
        "transform": "translate(31 105)",
        "fill-rule": "nonzero"
      }
    }, [h("rect", {
      "attrs": {
        "fill": "url(#" + prefix + "5)",
        "width": "98",
        "height": "34",
        "rx": "2"
      }
    }), h("rect", {
      "attrs": {
        "fill": "#FFF",
        "x": "9",
        "y": "8",
        "width": "80",
        "height": "18",
        "rx": "1.114"
      }
    }), h("rect", {
      "attrs": {
        "fill": "url(#" + prefix + "6)",
        "x": "15",
        "y": "12",
        "width": "18",
        "height": "6",
        "rx": "1.114"
      }
    })])])]);
  }
};

var _createNamespace$K = createNamespace('empty'),
  createComponent$O = _createNamespace$K[0],
  bem$J = _createNamespace$K[1];
var PRESETS = ['error', 'search', 'default'];
var Empty = createComponent$O({
  props: {
    imageSize: [Number, String],
    description: String,
    image: {
      type: String,
      default: 'default'
    }
  },
  methods: {
    genImageContent: function genImageContent() {
      var h = this.$createElement;
      var slots = this.slots('image');
      if (slots) {
        return slots;
      }
      if (this.image === 'network') {
        return h(Network);
      }
      var image = this.image;
      if (PRESETS.indexOf(image) !== -1) {
        image = "https://img01.yzcdn.cn/vant/empty-image-" + image + ".png";
      }
      return h("img", {
        "attrs": {
          "src": image
        }
      });
    },
    genImage: function genImage() {
      var h = this.$createElement;
      var imageStyle = {
        width: addUnit(this.imageSize),
        height: addUnit(this.imageSize)
      };
      return h("div", {
        "class": bem$J('image'),
        "style": imageStyle
      }, [this.genImageContent()]);
    },
    genDescription: function genDescription() {
      var h = this.$createElement;
      var description = this.slots('description') || this.description;
      if (description) {
        return h("p", {
          "class": bem$J('description')
        }, [description]);
      }
    },
    genBottom: function genBottom() {
      var h = this.$createElement;
      var slot = this.slots();
      if (slot) {
        return h("div", {
          "class": bem$J('bottom')
        }, [slot]);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$J()
    }, [this.genImage(), this.genDescription(), this.genBottom()]);
  }
});

var _createNamespace$J = createNamespace('form'),
  createComponent$N = _createNamespace$J[0],
  bem$I = _createNamespace$J[1];
var Form = createComponent$N({
  props: {
    colon: Boolean,
    disabled: Boolean,
    readonly: Boolean,
    labelWidth: [Number, String],
    labelAlign: String,
    inputAlign: String,
    scrollToError: Boolean,
    validateFirst: Boolean,
    errorMessageAlign: String,
    submitOnEnter: {
      type: Boolean,
      default: true
    },
    validateTrigger: {
      type: String,
      default: 'onBlur'
    },
    showError: {
      type: Boolean,
      default: true
    },
    showErrorMessage: {
      type: Boolean,
      default: true
    }
  },
  provide: function provide() {
    return {
      vanForm: this
    };
  },
  data: function data() {
    return {
      fields: []
    };
  },
  methods: {
    getFieldsByNames: function getFieldsByNames(names) {
      if (names) {
        return this.fields.filter(function (field) {
          return names.indexOf(field.name) !== -1;
        });
      }
      return this.fields;
    },
    validateSeq: function validateSeq(names) {
      var _this = this;
      return new Promise(function (resolve, reject) {
        var errors = [];
        var fields = _this.getFieldsByNames(names);
        fields.reduce(function (promise, field) {
          return promise.then(function () {
            if (!errors.length) {
              return field.validate().then(function (error) {
                if (error) {
                  errors.push(error);
                }
              });
            }
          });
        }, Promise.resolve()).then(function () {
          if (errors.length) {
            reject(errors);
          } else {
            resolve();
          }
        });
      });
    },
    validateFields: function validateFields(names) {
      var _this2 = this;
      return new Promise(function (resolve, reject) {
        var fields = _this2.getFieldsByNames(names);
        Promise.all(fields.map(function (item) {
          return item.validate();
        })).then(function (errors) {
          errors = errors.filter(function (item) {
            return item;
          });
          if (errors.length) {
            reject(errors);
          } else {
            resolve();
          }
        });
      });
    },
    // @exposed-api
    validate: function validate(name) {
      if (name && !Array.isArray(name)) {
        return this.validateField(name);
      }
      return this.validateFirst ? this.validateSeq(name) : this.validateFields(name);
    },
    validateField: function validateField(name) {
      var matched = this.fields.filter(function (item) {
        return item.name === name;
      });
      if (matched.length) {
        return new Promise(function (resolve, reject) {
          matched[0].validate().then(function (error) {
            if (error) {
              reject(error);
            } else {
              resolve();
            }
          });
        });
      }
      return Promise.reject();
    },
    // @exposed-api
    resetValidation: function resetValidation(name) {
      if (name && !Array.isArray(name)) {
        name = [name];
      }
      var fields = this.getFieldsByNames(name);
      fields.forEach(function (item) {
        item.resetValidation();
      });
    },
    // @exposed-api
    scrollToField: function scrollToField(name, options) {
      this.fields.some(function (item) {
        if (item.name === name) {
          item.$el.scrollIntoView(options);
          return true;
        }
        return false;
      });
    },
    addField: function addField(field) {
      this.fields.push(field);
      sortChildren(this.fields, this);
    },
    removeField: function removeField(field) {
      this.fields = this.fields.filter(function (item) {
        return item !== field;
      });
    },
    getValues: function getValues() {
      return this.fields.reduce(function (form, field) {
        form[field.name] = field.formValue;
        return form;
      }, {});
    },
    onSubmit: function onSubmit(event) {
      event.preventDefault();
      this.submit();
    },
    // @exposed-api
    submit: function submit() {
      var _this3 = this;
      var values = this.getValues();
      this.validate().then(function () {
        _this3.$emit('submit', values);
      }).catch(function (errors) {
        _this3.$emit('failed', {
          values: values,
          errors: errors
        });
        if (_this3.scrollToError) {
          _this3.scrollToField(errors[0].name);
        }
      });
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("form", {
      "class": bem$I(),
      "on": {
        "submit": this.onSubmit
      }
    }, [this.slots()]);
  }
});

var _createNamespace$I = createNamespace('goods-action-icon'),
  createComponent$M = _createNamespace$I[0],
  bem$H = _createNamespace$I[1];
var GoodsActionIcon = createComponent$M({
  mixins: [ChildrenMixin('vanGoodsAction')],
  props: _extends$1({}, routeProps, {
    dot: Boolean,
    text: String,
    icon: String,
    color: String,
    // @deprecated
    info: [Number, String],
    badge: [Number, String],
    iconClass: null
  }),
  methods: {
    onClick: function onClick(event) {
      this.$emit('click', event);
      route(this.$router, this);
    },
    genIcon: function genIcon() {
      var _this$badge;
      var h = this.$createElement;
      var slot = this.slots('icon');
      var info = (_this$badge = this.badge) != null ? _this$badge : this.info;
      if (slot) {
        return h("div", {
          "class": bem$H('icon')
        }, [slot, h(Info$1, {
          "attrs": {
            "dot": this.dot,
            "info": info
          }
        })]);
      }
      return h(Icon$3, {
        "class": [bem$H('icon'), this.iconClass],
        "attrs": {
          "tag": "div",
          "dot": this.dot,
          "name": this.icon,
          "badge": info,
          "color": this.color
        }
      });
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "attrs": {
        "role": "button",
        "tabindex": "0"
      },
      "class": bem$H(),
      "on": {
        "click": this.onClick
      }
    }, [this.genIcon(), this.slots() || this.text]);
  }
});

var _createNamespace$H = createNamespace('grid'),
  createComponent$L = _createNamespace$H[0],
  bem$G = _createNamespace$H[1];
var Grid$2 = createComponent$L({
  mixins: [ParentMixin('vanGrid')],
  props: {
    square: Boolean,
    gutter: [Number, String],
    iconSize: [Number, String],
    direction: String,
    clickable: Boolean,
    columnNum: {
      type: [Number, String],
      default: 4
    },
    center: {
      type: Boolean,
      default: true
    },
    border: {
      type: Boolean,
      default: true
    }
  },
  computed: {
    style: function style() {
      var gutter = this.gutter;
      if (gutter) {
        return {
          paddingLeft: addUnit(gutter)
        };
      }
    }
  },
  render: function render() {
    var _ref;
    var h = arguments[0];
    return h("div", {
      "style": this.style,
      "class": [bem$G(), (_ref = {}, _ref[BORDER_TOP] = this.border && !this.gutter, _ref)]
    }, [this.slots()]);
  }
});

var _createNamespace$G = createNamespace('grid-item'),
  createComponent$K = _createNamespace$G[0],
  bem$F = _createNamespace$G[1];
var GridItem = createComponent$K({
  mixins: [ChildrenMixin('vanGrid')],
  props: _extends$1({}, routeProps, {
    dot: Boolean,
    text: String,
    icon: String,
    iconPrefix: String,
    // @deprecated
    info: [Number, String],
    badge: [Number, String]
  }),
  computed: {
    style: function style() {
      var _this$parent = this.parent,
        square = _this$parent.square,
        gutter = _this$parent.gutter,
        columnNum = _this$parent.columnNum;
      var percent = 100 / columnNum + "%";
      var style = {
        flexBasis: percent
      };
      if (square) {
        style.paddingTop = percent;
      } else if (gutter) {
        var gutterValue = addUnit(gutter);
        style.paddingRight = gutterValue;
        if (this.index >= columnNum) {
          style.marginTop = gutterValue;
        }
      }
      return style;
    },
    contentStyle: function contentStyle() {
      var _this$parent2 = this.parent,
        square = _this$parent2.square,
        gutter = _this$parent2.gutter;
      if (square && gutter) {
        var gutterValue = addUnit(gutter);
        return {
          right: gutterValue,
          bottom: gutterValue,
          height: 'auto'
        };
      }
    }
  },
  methods: {
    onClick: function onClick(event) {
      this.$emit('click', event);
      route(this.$router, this);
    },
    genIcon: function genIcon() {
      var _this$badge;
      var h = this.$createElement;
      var iconSlot = this.slots('icon');
      var info = (_this$badge = this.badge) != null ? _this$badge : this.info;
      if (iconSlot) {
        return h("div", {
          "class": bem$F('icon-wrapper')
        }, [iconSlot, h(Info$1, {
          "attrs": {
            "dot": this.dot,
            "info": info
          }
        })]);
      }
      if (this.icon) {
        return h(Icon$3, {
          "attrs": {
            "name": this.icon,
            "dot": this.dot,
            "badge": info,
            "size": this.parent.iconSize,
            "classPrefix": this.iconPrefix
          },
          "class": bem$F('icon')
        });
      }
    },
    getText: function getText() {
      var h = this.$createElement;
      var textSlot = this.slots('text');
      if (textSlot) {
        return textSlot;
      }
      if (this.text) {
        return h("span", {
          "class": bem$F('text')
        }, [this.text]);
      }
    },
    genContent: function genContent() {
      var slot = this.slots();
      if (slot) {
        return slot;
      }
      return [this.genIcon(), this.getText()];
    }
  },
  render: function render() {
    var _ref;
    var h = arguments[0];
    var _this$parent3 = this.parent,
      center = _this$parent3.center,
      border = _this$parent3.border,
      square = _this$parent3.square,
      gutter = _this$parent3.gutter,
      direction = _this$parent3.direction,
      clickable = _this$parent3.clickable;
    return h("div", {
      "class": [bem$F({
        square: square
      })],
      "style": this.style
    }, [h("div", {
      "style": this.contentStyle,
      "attrs": {
        "role": clickable ? 'button' : null,
        "tabindex": clickable ? 0 : null
      },
      "class": [bem$F('content', [direction, {
        center: center,
        square: square,
        clickable: clickable,
        surround: border && gutter
      }]), (_ref = {}, _ref[BORDER] = border, _ref)],
      "on": {
        "click": this.onClick
      }
    }, [this.genContent()])]);
  }
});

var _createNamespace$F = createNamespace('image-preview'),
  createComponent$J = _createNamespace$F[0],
  bem$E = _createNamespace$F[1];

// Utils
var _createNamespace$E = createNamespace('swipe'),
  createComponent$I = _createNamespace$E[0],
  bem$D = _createNamespace$E[1];
var Swipe = createComponent$I({
  mixins: [TouchMixin, ParentMixin('vanSwipe'), BindEventMixin(function (bind, isBind) {
    bind(window, 'resize', this.resize, true);
    bind(window, 'orientationchange', this.resize, true);
    bind(window, 'visibilitychange', this.onVisibilityChange);
    if (isBind) {
      this.initialize();
    } else {
      this.clear();
    }
  })],
  props: {
    width: [Number, String],
    height: [Number, String],
    autoplay: [Number, String],
    vertical: Boolean,
    lazyRender: Boolean,
    indicatorColor: String,
    loop: {
      type: Boolean,
      default: true
    },
    duration: {
      type: [Number, String],
      default: 500
    },
    touchable: {
      type: Boolean,
      default: true
    },
    initialSwipe: {
      type: [Number, String],
      default: 0
    },
    showIndicators: {
      type: Boolean,
      default: true
    },
    stopPropagation: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    return {
      rect: null,
      offset: 0,
      active: 0,
      deltaX: 0,
      deltaY: 0,
      swiping: false,
      computedWidth: 0,
      computedHeight: 0
    };
  },
  watch: {
    children: function children() {
      this.initialize();
    },
    initialSwipe: function initialSwipe() {
      this.initialize();
    },
    autoplay: function autoplay(_autoplay) {
      if (_autoplay > 0) {
        this.autoPlay();
      } else {
        this.clear();
      }
    }
  },
  computed: {
    count: function count() {
      return this.children.length;
    },
    maxCount: function maxCount() {
      return Math.ceil(Math.abs(this.minOffset) / this.size);
    },
    delta: function delta() {
      return this.vertical ? this.deltaY : this.deltaX;
    },
    size: function size() {
      return this[this.vertical ? 'computedHeight' : 'computedWidth'];
    },
    trackSize: function trackSize() {
      return this.count * this.size;
    },
    activeIndicator: function activeIndicator() {
      return (this.active + this.count) % this.count;
    },
    isCorrectDirection: function isCorrectDirection() {
      var expect = this.vertical ? 'vertical' : 'horizontal';
      return this.direction === expect;
    },
    trackStyle: function trackStyle() {
      var style = {
        transitionDuration: (this.swiping ? 0 : this.duration) + "ms",
        transform: "translate" + (this.vertical ? 'Y' : 'X') + "(" + this.offset + "px)"
      };
      if (this.size) {
        var mainAxis = this.vertical ? 'height' : 'width';
        var crossAxis = this.vertical ? 'width' : 'height';
        style[mainAxis] = this.trackSize + "px";
        style[crossAxis] = this[crossAxis] ? this[crossAxis] + "px" : '';
      }
      return style;
    },
    indicatorStyle: function indicatorStyle() {
      return {
        backgroundColor: this.indicatorColor
      };
    },
    minOffset: function minOffset() {
      return (this.vertical ? this.rect.height : this.rect.width) - this.size * this.count;
    }
  },
  mounted: function mounted() {
    this.bindTouchEvent(this.$refs.track);
  },
  methods: {
    // initialize swipe position
    initialize: function initialize(active) {
      if (active === void 0) {
        active = +this.initialSwipe;
      }
      if (!this.$el || isHidden(this.$el)) {
        return;
      }
      clearTimeout(this.timer);
      var rect = {
        width: this.$el.offsetWidth,
        height: this.$el.offsetHeight
      };
      this.rect = rect;
      this.swiping = true;
      this.active = active;
      this.computedWidth = +this.width || rect.width;
      this.computedHeight = +this.height || rect.height;
      this.offset = this.getTargetOffset(active);
      this.children.forEach(function (swipe) {
        swipe.offset = 0;
      });
      this.autoPlay();
    },
    // @exposed-api
    resize: function resize() {
      this.initialize(this.activeIndicator);
    },
    onVisibilityChange: function onVisibilityChange() {
      if (document.hidden) {
        this.clear();
      } else {
        this.autoPlay();
      }
    },
    onTouchStart: function onTouchStart(event) {
      if (!this.touchable) return;
      this.clear();
      this.touchStartTime = Date.now();
      this.touchStart(event);
      this.correctPosition();
    },
    onTouchMove: function onTouchMove(event) {
      if (!this.touchable || !this.swiping) return;
      this.touchMove(event);
      if (this.isCorrectDirection) {
        preventDefault$1(event, this.stopPropagation);
        this.move({
          offset: this.delta
        });
      }
    },
    onTouchEnd: function onTouchEnd() {
      if (!this.touchable || !this.swiping) return;
      var size = this.size,
        delta = this.delta;
      var duration = Date.now() - this.touchStartTime;
      var speed = delta / duration;
      var shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta) > size / 2;
      if (shouldSwipe && this.isCorrectDirection) {
        var offset = this.vertical ? this.offsetY : this.offsetX;
        var pace = 0;
        if (this.loop) {
          pace = offset > 0 ? delta > 0 ? -1 : 1 : 0;
        } else {
          pace = -Math[delta > 0 ? 'ceil' : 'floor'](delta / size);
        }
        this.move({
          pace: pace,
          emitChange: true
        });
      } else if (delta) {
        this.move({
          pace: 0
        });
      }
      this.swiping = false;
      this.autoPlay();
    },
    getTargetActive: function getTargetActive(pace) {
      var active = this.active,
        count = this.count,
        maxCount = this.maxCount;
      if (pace) {
        if (this.loop) {
          return range$1(active + pace, -1, count);
        }
        return range$1(active + pace, 0, maxCount);
      }
      return active;
    },
    getTargetOffset: function getTargetOffset(targetActive, offset) {
      if (offset === void 0) {
        offset = 0;
      }
      var currentPosition = targetActive * this.size;
      if (!this.loop) {
        currentPosition = Math.min(currentPosition, -this.minOffset);
      }
      var targetOffset = offset - currentPosition;
      if (!this.loop) {
        targetOffset = range$1(targetOffset, this.minOffset, 0);
      }
      return targetOffset;
    },
    move: function move(_ref) {
      var _ref$pace = _ref.pace,
        pace = _ref$pace === void 0 ? 0 : _ref$pace,
        _ref$offset = _ref.offset,
        offset = _ref$offset === void 0 ? 0 : _ref$offset,
        emitChange = _ref.emitChange;
      var loop = this.loop,
        count = this.count,
        active = this.active,
        children = this.children,
        trackSize = this.trackSize,
        minOffset = this.minOffset;
      if (count <= 1) {
        return;
      }
      var targetActive = this.getTargetActive(pace);
      var targetOffset = this.getTargetOffset(targetActive, offset); // auto move first and last swipe in loop mode

      if (loop) {
        if (children[0] && targetOffset !== minOffset) {
          var outRightBound = targetOffset < minOffset;
          children[0].offset = outRightBound ? trackSize : 0;
        }
        if (children[count - 1] && targetOffset !== 0) {
          var outLeftBound = targetOffset > 0;
          children[count - 1].offset = outLeftBound ? -trackSize : 0;
        }
      }
      this.active = targetActive;
      this.offset = targetOffset;
      if (emitChange && targetActive !== active) {
        this.$emit('change', this.activeIndicator);
      }
    },
    // @exposed-api
    prev: function prev() {
      var _this = this;
      this.correctPosition();
      this.resetTouchStatus();
      doubleRaf(function () {
        _this.swiping = false;
        _this.move({
          pace: -1,
          emitChange: true
        });
      });
    },
    // @exposed-api
    next: function next() {
      var _this2 = this;
      this.correctPosition();
      this.resetTouchStatus();
      doubleRaf(function () {
        _this2.swiping = false;
        _this2.move({
          pace: 1,
          emitChange: true
        });
      });
    },
    // @exposed-api
    swipeTo: function swipeTo(index, options) {
      var _this3 = this;
      if (options === void 0) {
        options = {};
      }
      this.correctPosition();
      this.resetTouchStatus();
      doubleRaf(function () {
        var targetIndex;
        if (_this3.loop && index === _this3.count) {
          targetIndex = _this3.active === 0 ? 0 : index;
        } else {
          targetIndex = index % _this3.count;
        }
        if (options.immediate) {
          doubleRaf(function () {
            _this3.swiping = false;
          });
        } else {
          _this3.swiping = false;
        }
        _this3.move({
          pace: targetIndex - _this3.active,
          emitChange: true
        });
      });
    },
    correctPosition: function correctPosition() {
      this.swiping = true;
      if (this.active <= -1) {
        this.move({
          pace: this.count
        });
      }
      if (this.active >= this.count) {
        this.move({
          pace: -this.count
        });
      }
    },
    clear: function clear() {
      clearTimeout(this.timer);
    },
    autoPlay: function autoPlay() {
      var _this4 = this;
      var autoplay = this.autoplay;
      if (autoplay > 0 && this.count > 1) {
        this.clear();
        this.timer = setTimeout(function () {
          _this4.next();
          _this4.autoPlay();
        }, autoplay);
      }
    },
    genIndicator: function genIndicator() {
      var _this5 = this;
      var h = this.$createElement;
      var count = this.count,
        activeIndicator = this.activeIndicator;
      var slot = this.slots('indicator');
      if (slot) {
        return slot;
      }
      if (this.showIndicators && count > 1) {
        return h("div", {
          "class": bem$D('indicators', {
            vertical: this.vertical
          })
        }, [Array.apply(void 0, Array(count)).map(function (empty, index) {
          return h("i", {
            "class": bem$D('indicator', {
              active: index === activeIndicator
            }),
            "style": index === activeIndicator ? _this5.indicatorStyle : null
          });
        })]);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$D()
    }, [h("div", {
      "ref": "track",
      "style": this.trackStyle,
      "class": bem$D('track', {
        vertical: this.vertical
      })
    }, [this.slots()]), this.genIndicator()]);
  }
});

var _createNamespace$D = createNamespace('swipe-item'),
  createComponent$H = _createNamespace$D[0],
  bem$C = _createNamespace$D[1];
var SwipeItem = createComponent$H({
  mixins: [ChildrenMixin('vanSwipe')],
  data: function data() {
    return {
      offset: 0,
      inited: false,
      mounted: false
    };
  },
  mounted: function mounted() {
    var _this = this;
    this.$nextTick(function () {
      _this.mounted = true;
    });
  },
  computed: {
    style: function style() {
      var style = {};
      var _this$parent = this.parent,
        size = _this$parent.size,
        vertical = _this$parent.vertical;
      if (size) {
        style[vertical ? 'height' : 'width'] = size + "px";
      }
      if (this.offset) {
        style.transform = "translate" + (vertical ? 'Y' : 'X') + "(" + this.offset + "px)";
      }
      return style;
    },
    shouldRender: function shouldRender() {
      var index = this.index,
        inited = this.inited,
        parent = this.parent,
        mounted = this.mounted;
      if (!parent.lazyRender || inited) {
        return true;
      } // wait for all item to mount, so we can get the exact count

      if (!mounted) {
        return false;
      }
      var active = parent.activeIndicator;
      var maxActive = parent.count - 1;
      var prevActive = active === 0 && parent.loop ? maxActive : active - 1;
      var nextActive = active === maxActive && parent.loop ? 0 : active + 1;
      var shouldRender = index === active || index === prevActive || index === nextActive;
      if (shouldRender) {
        this.inited = true;
      }
      return shouldRender;
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$C(),
      "style": this.style,
      "on": _extends$1({}, this.$listeners)
    }, [this.shouldRender && this.slots()]);
  }
});

// Utils
function getDistance(touches) {
  return Math.sqrt(Math.pow(touches[0].clientX - touches[1].clientX, 2) + Math.pow(touches[0].clientY - touches[1].clientY, 2));
}
var ImagePreviewItem = {
  mixins: [TouchMixin],
  props: {
    src: String,
    show: Boolean,
    active: Number,
    minZoom: [Number, String],
    maxZoom: [Number, String],
    rootWidth: Number,
    rootHeight: Number
  },
  data: function data() {
    return {
      scale: 1,
      moveX: 0,
      moveY: 0,
      moving: false,
      zooming: false,
      imageRatio: 0,
      displayWidth: 0,
      displayHeight: 0
    };
  },
  computed: {
    vertical: function vertical() {
      var rootWidth = this.rootWidth,
        rootHeight = this.rootHeight;
      var rootRatio = rootHeight / rootWidth;
      return this.imageRatio > rootRatio;
    },
    imageStyle: function imageStyle() {
      var scale = this.scale;
      var style = {
        transitionDuration: this.zooming || this.moving ? '0s' : '.3s'
      };
      if (scale !== 1) {
        var offsetX = this.moveX / scale;
        var offsetY = this.moveY / scale;
        style.transform = "scale(" + scale + ", " + scale + ") translate(" + offsetX + "px, " + offsetY + "px)";
      }
      return style;
    },
    maxMoveX: function maxMoveX() {
      if (this.imageRatio) {
        var displayWidth = this.vertical ? this.rootHeight / this.imageRatio : this.rootWidth;
        return Math.max(0, (this.scale * displayWidth - this.rootWidth) / 2);
      }
      return 0;
    },
    maxMoveY: function maxMoveY() {
      if (this.imageRatio) {
        var displayHeight = this.vertical ? this.rootHeight : this.rootWidth * this.imageRatio;
        return Math.max(0, (this.scale * displayHeight - this.rootHeight) / 2);
      }
      return 0;
    }
  },
  watch: {
    active: 'resetScale',
    show: function show(val) {
      if (!val) {
        this.resetScale();
      }
    }
  },
  mounted: function mounted() {
    this.bindTouchEvent(this.$el);
  },
  methods: {
    resetScale: function resetScale() {
      this.setScale(1);
      this.moveX = 0;
      this.moveY = 0;
    },
    setScale: function setScale(scale) {
      scale = range$1(scale, +this.minZoom, +this.maxZoom);
      if (scale !== this.scale) {
        this.scale = scale;
        this.$emit('scale', {
          scale: this.scale,
          index: this.active
        });
      }
    },
    toggleScale: function toggleScale() {
      var scale = this.scale > 1 ? 1 : 2;
      this.setScale(scale);
      this.moveX = 0;
      this.moveY = 0;
    },
    onTouchStart: function onTouchStart(event) {
      var touches = event.touches;
      var _this$offsetX = this.offsetX,
        offsetX = _this$offsetX === void 0 ? 0 : _this$offsetX;
      this.touchStart(event);
      this.touchStartTime = new Date();
      this.fingerNum = touches.length;
      this.startMoveX = this.moveX;
      this.startMoveY = this.moveY;
      this.moving = this.fingerNum === 1 && this.scale !== 1;
      this.zooming = this.fingerNum === 2 && !offsetX;
      if (this.zooming) {
        this.startScale = this.scale;
        this.startDistance = getDistance(event.touches);
      }
    },
    onTouchMove: function onTouchMove(event) {
      var touches = event.touches;
      this.touchMove(event);
      if (this.moving || this.zooming) {
        preventDefault$1(event, true);
      }
      if (this.moving) {
        var moveX = this.deltaX + this.startMoveX;
        var moveY = this.deltaY + this.startMoveY;
        this.moveX = range$1(moveX, -this.maxMoveX, this.maxMoveX);
        this.moveY = range$1(moveY, -this.maxMoveY, this.maxMoveY);
      }
      if (this.zooming && touches.length === 2) {
        var distance = getDistance(touches);
        var scale = this.startScale * distance / this.startDistance;
        this.setScale(scale);
      }
    },
    onTouchEnd: function onTouchEnd(event) {
      var stopPropagation = false;
      /* istanbul ignore else */

      if (this.moving || this.zooming) {
        stopPropagation = true;
        if (this.moving && this.startMoveX === this.moveX && this.startMoveY === this.moveY) {
          stopPropagation = false;
        }
        if (!event.touches.length) {
          if (this.zooming) {
            this.moveX = range$1(this.moveX, -this.maxMoveX, this.maxMoveX);
            this.moveY = range$1(this.moveY, -this.maxMoveY, this.maxMoveY);
            this.zooming = false;
          }
          this.moving = false;
          this.startMoveX = 0;
          this.startMoveY = 0;
          this.startScale = 1;
          if (this.scale < 1) {
            this.resetScale();
          }
        }
      } // eliminate tap delay on safari

      preventDefault$1(event, stopPropagation);
      this.checkTap();
      this.resetTouchStatus();
    },
    checkTap: function checkTap() {
      var _this = this;
      if (this.fingerNum > 1) {
        return;
      }
      var _this$offsetX2 = this.offsetX,
        offsetX = _this$offsetX2 === void 0 ? 0 : _this$offsetX2,
        _this$offsetY = this.offsetY,
        offsetY = _this$offsetY === void 0 ? 0 : _this$offsetY;
      var deltaTime = new Date() - this.touchStartTime;
      var TAP_TIME = 250;
      var TAP_OFFSET = 5;
      if (offsetX < TAP_OFFSET && offsetY < TAP_OFFSET && deltaTime < TAP_TIME) {
        if (this.doubleTapTimer) {
          clearTimeout(this.doubleTapTimer);
          this.doubleTapTimer = null;
          this.toggleScale();
        } else {
          this.doubleTapTimer = setTimeout(function () {
            _this.$emit('close');
            _this.doubleTapTimer = null;
          }, TAP_TIME);
        }
      }
    },
    onLoad: function onLoad(event) {
      var _event$target = event.target,
        naturalWidth = _event$target.naturalWidth,
        naturalHeight = _event$target.naturalHeight;
      this.imageRatio = naturalHeight / naturalWidth;
    }
  },
  render: function render() {
    var h = arguments[0];
    var imageSlots = {
      loading: function loading() {
        return h(Loading$1, {
          "attrs": {
            "type": "spinner"
          }
        });
      }
    };
    return h(SwipeItem, {
      "class": bem$E('swipe-item')
    }, [h(Image$1, {
      "attrs": {
        "src": this.src,
        "fit": "contain"
      },
      "class": bem$E('image', {
        vertical: this.vertical
      }),
      "style": this.imageStyle,
      "scopedSlots": imageSlots,
      "on": {
        "load": this.onLoad
      }
    })]);
  }
};

// Utils
var VueImagePreview = createComponent$J({
  mixins: [TouchMixin, PopupMixin({
    skipToggleEvent: true
  }), BindEventMixin(function (bind) {
    bind(window, 'resize', this.resize, true);
    bind(window, 'orientationchange', this.resize, true);
  })],
  props: {
    className: null,
    closeable: Boolean,
    asyncClose: Boolean,
    overlayStyle: Object,
    showIndicators: Boolean,
    images: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    loop: {
      type: Boolean,
      default: true
    },
    overlay: {
      type: Boolean,
      default: true
    },
    minZoom: {
      type: [Number, String],
      default: 1 / 3
    },
    maxZoom: {
      type: [Number, String],
      default: 3
    },
    transition: {
      type: String,
      default: 'van-fade'
    },
    showIndex: {
      type: Boolean,
      default: true
    },
    swipeDuration: {
      type: [Number, String],
      default: 300
    },
    startPosition: {
      type: [Number, String],
      default: 0
    },
    overlayClass: {
      type: String,
      default: bem$E('overlay')
    },
    closeIcon: {
      type: String,
      default: 'clear'
    },
    closeOnPopstate: {
      type: Boolean,
      default: true
    },
    closeIconPosition: {
      type: String,
      default: 'top-right'
    }
  },
  data: function data() {
    return {
      active: 0,
      rootWidth: 0,
      rootHeight: 0,
      doubleClickTimer: null
    };
  },
  mounted: function mounted() {
    this.resize();
  },
  watch: {
    startPosition: 'setActive',
    value: function value(val) {
      var _this = this;
      if (val) {
        this.setActive(+this.startPosition);
        this.$nextTick(function () {
          _this.resize();
          _this.$refs.swipe.swipeTo(+_this.startPosition, {
            immediate: true
          });
        });
      } else {
        this.$emit('close', {
          index: this.active,
          url: this.images[this.active]
        });
      }
    }
  },
  methods: {
    resize: function resize() {
      if (this.$el && this.$el.getBoundingClientRect) {
        var rect = this.$el.getBoundingClientRect();
        this.rootWidth = rect.width;
        this.rootHeight = rect.height;
      }
    },
    emitClose: function emitClose() {
      if (!this.asyncClose) {
        this.$emit('input', false);
      }
    },
    emitScale: function emitScale(args) {
      this.$emit('scale', args);
    },
    setActive: function setActive(active) {
      if (active !== this.active) {
        this.active = active;
        this.$emit('change', active);
      }
    },
    genIndex: function genIndex() {
      var h = this.$createElement;
      if (this.showIndex) {
        return h("div", {
          "class": bem$E('index')
        }, [this.slots('index', {
          index: this.active
        }) || this.active + 1 + " / " + this.images.length]);
      }
    },
    genCover: function genCover() {
      var h = this.$createElement;
      var cover = this.slots('cover');
      if (cover) {
        return h("div", {
          "class": bem$E('cover')
        }, [cover]);
      }
    },
    genImages: function genImages() {
      var _this2 = this;
      var h = this.$createElement;
      return h(Swipe, {
        "ref": "swipe",
        "attrs": {
          "lazyRender": true,
          "loop": this.loop,
          "duration": this.swipeDuration,
          "initialSwipe": this.startPosition,
          "showIndicators": this.showIndicators,
          "indicatorColor": "white"
        },
        "class": bem$E('swipe'),
        "on": {
          "change": this.setActive
        }
      }, [this.images.map(function (image) {
        return h(ImagePreviewItem, {
          "attrs": {
            "src": image,
            "show": _this2.value,
            "active": _this2.active,
            "maxZoom": _this2.maxZoom,
            "minZoom": _this2.minZoom,
            "rootWidth": _this2.rootWidth,
            "rootHeight": _this2.rootHeight
          },
          "on": {
            "scale": _this2.emitScale,
            "close": _this2.emitClose
          }
        });
      })]);
    },
    genClose: function genClose() {
      var h = this.$createElement;
      if (this.closeable) {
        return h(Icon$3, {
          "attrs": {
            "role": "button",
            "name": this.closeIcon
          },
          "class": bem$E('close-icon', this.closeIconPosition),
          "on": {
            "click": this.emitClose
          }
        });
      }
    },
    onClosed: function onClosed() {
      this.$emit('closed');
    },
    // @exposed-api
    swipeTo: function swipeTo(index, options) {
      if (this.$refs.swipe) {
        this.$refs.swipe.swipeTo(index, options);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("transition", {
      "attrs": {
        "name": this.transition
      },
      "on": {
        "afterLeave": this.onClosed
      }
    }, [this.shouldRender ? h("div", {
      "directives": [{
        name: "show",
        value: this.value
      }],
      "class": [bem$E(), this.className]
    }, [this.genClose(), this.genImages(), this.genIndex(), this.genCover()]) : null]);
  }
});

var instance$3;
var defaultConfig = {
  loop: true,
  value: true,
  images: [],
  maxZoom: 3,
  minZoom: 1 / 3,
  onClose: null,
  onChange: null,
  className: '',
  showIndex: true,
  closeable: false,
  closeIcon: 'clear',
  asyncClose: false,
  transition: 'van-fade',
  getContainer: 'body',
  overlayStyle: null,
  startPosition: 0,
  swipeDuration: 300,
  showIndicators: false,
  closeOnPopstate: true,
  closeIconPosition: 'top-right'
};
var initInstance = function initInstance() {
  instance$3 = new (Vue.extend(VueImagePreview))({
    el: document.createElement('div')
  });
  document.body.appendChild(instance$3.$el);
  instance$3.$on('change', function (index) {
    if (instance$3.onChange) {
      instance$3.onChange(index);
    }
  });
  instance$3.$on('scale', function (data) {
    if (instance$3.onScale) {
      instance$3.onScale(data);
    }
  });
};
var ImagePreview = function ImagePreview(images, startPosition) {
  if (startPosition === void 0) {
    startPosition = 0;
  }

  /* istanbul ignore if */
  if (isServer$1) {
    return;
  }
  if (!instance$3) {
    initInstance();
  }
  var options = Array.isArray(images) ? {
    images: images,
    startPosition: startPosition
  } : images;
  _extends$1(instance$3, defaultConfig, options);
  instance$3.$once('input', function (show) {
    instance$3.value = show;
  });
  instance$3.$once('closed', function () {
    instance$3.images = [];
  });
  if (options.onClose) {
    instance$3.$off('close');
    instance$3.$once('close', options.onClose);
  }
  return instance$3;
};
ImagePreview.Component = VueImagePreview;
ImagePreview.install = function () {
  Vue.use(VueImagePreview);
};
var ImagePreview$1 = ImagePreview;

var _createNamespace$C = createNamespace('index-anchor'),
  createComponent$G = _createNamespace$C[0],
  bem$B = _createNamespace$C[1];
var IndexAnchor = createComponent$G({
  mixins: [ChildrenMixin('vanIndexBar', {
    indexKey: 'childrenIndex'
  })],
  props: {
    index: [Number, String]
  },
  data: function data() {
    return {
      top: 0,
      left: null,
      rect: {
        top: 0,
        height: 0
      },
      width: null,
      active: false
    };
  },
  computed: {
    sticky: function sticky() {
      return this.active && this.parent.sticky;
    },
    anchorStyle: function anchorStyle() {
      if (this.sticky) {
        return {
          zIndex: "" + this.parent.zIndex,
          left: this.left ? this.left + "px" : null,
          width: this.width ? this.width + "px" : null,
          transform: "translate3d(0, " + this.top + "px, 0)",
          color: this.parent.highlightColor
        };
      }
    }
  },
  mounted: function mounted() {
    var rect = this.$el.getBoundingClientRect();
    this.rect.height = rect.height;
  },
  methods: {
    scrollIntoView: function scrollIntoView() {
      this.$el.scrollIntoView();
    },
    getRect: function getRect(scroller, scrollerRect) {
      var el = this.$el;
      var elRect = el.getBoundingClientRect();
      this.rect.height = elRect.height;
      if (scroller === window || scroller === document.body) {
        this.rect.top = elRect.top + getRootScrollTop();
      } else {
        this.rect.top = elRect.top + getScrollTop(scroller) - scrollerRect.top;
      }
      return this.rect;
    }
  },
  render: function render() {
    var _ref;
    var h = arguments[0];
    var sticky = this.sticky;
    return h("div", {
      "style": {
        height: sticky ? this.rect.height + "px" : null
      }
    }, [h("div", {
      "style": this.anchorStyle,
      "class": [bem$B({
        sticky: sticky
      }), (_ref = {}, _ref[BORDER_BOTTOM] = sticky, _ref)]
    }, [this.slots('default') || this.index])]);
  }
});

// Utils
function genAlphabet() {
  var indexList = [];
  var charCodeOfA = 'A'.charCodeAt(0);
  for (var i = 0; i < 26; i++) {
    indexList.push(String.fromCharCode(charCodeOfA + i));
  }
  return indexList;
}
var _createNamespace$B = createNamespace('index-bar'),
  createComponent$F = _createNamespace$B[0],
  bem$A = _createNamespace$B[1];
var IndexBar = createComponent$F({
  mixins: [TouchMixin, ParentMixin('vanIndexBar'), BindEventMixin(function (bind) {
    if (!this.scroller) {
      this.scroller = getScroller(this.$el);
    }
    bind(this.scroller, 'scroll', this.onScroll);
  })],
  props: {
    zIndex: [Number, String],
    highlightColor: String,
    sticky: {
      type: Boolean,
      default: true
    },
    stickyOffsetTop: {
      type: Number,
      default: 0
    },
    indexList: {
      type: Array,
      default: genAlphabet
    }
  },
  data: function data() {
    return {
      activeAnchorIndex: null
    };
  },
  computed: {
    sidebarStyle: function sidebarStyle() {
      if (isDef$1(this.zIndex)) {
        return {
          zIndex: this.zIndex + 1
        };
      }
    },
    highlightStyle: function highlightStyle() {
      var highlightColor = this.highlightColor;
      if (highlightColor) {
        return {
          color: highlightColor
        };
      }
    }
  },
  watch: {
    indexList: function indexList() {
      this.$nextTick(this.onScroll);
    },
    activeAnchorIndex: function activeAnchorIndex(value) {
      if (value) {
        this.$emit('change', value);
      }
    }
  },
  methods: {
    onScroll: function onScroll() {
      var _this = this;
      if (isHidden(this.$el)) {
        return;
      }
      var scrollTop = getScrollTop(this.scroller);
      var scrollerRect = this.getScrollerRect();
      var rects = this.children.map(function (item) {
        return item.getRect(_this.scroller, scrollerRect);
      });
      var active = this.getActiveAnchorIndex(scrollTop, rects);
      this.activeAnchorIndex = this.indexList[active];
      if (this.sticky) {
        this.children.forEach(function (item, index) {
          if (index === active || index === active - 1) {
            var rect = item.$el.getBoundingClientRect();
            item.left = rect.left;
            item.width = rect.width;
          } else {
            item.left = null;
            item.width = null;
          }
          if (index === active) {
            item.active = true;
            item.top = Math.max(_this.stickyOffsetTop, rects[index].top - scrollTop) + scrollerRect.top;
          } else if (index === active - 1) {
            var activeItemTop = rects[active].top - scrollTop;
            item.active = activeItemTop > 0;
            item.top = activeItemTop + scrollerRect.top - rects[index].height;
          } else {
            item.active = false;
          }
        });
      }
    },
    getScrollerRect: function getScrollerRect() {
      if (this.scroller.getBoundingClientRect) {
        return this.scroller.getBoundingClientRect();
      }
      return {
        top: 0,
        left: 0
      };
    },
    getActiveAnchorIndex: function getActiveAnchorIndex(scrollTop, rects) {
      for (var i = this.children.length - 1; i >= 0; i--) {
        var prevHeight = i > 0 ? rects[i - 1].height : 0;
        var reachTop = this.sticky ? prevHeight + this.stickyOffsetTop : 0;
        if (scrollTop + reachTop >= rects[i].top) {
          return i;
        }
      }
      return -1;
    },
    onClick: function onClick(event) {
      this.scrollToElement(event.target);
    },
    onTouchMove: function onTouchMove(event) {
      this.touchMove(event);
      if (this.direction === 'vertical') {
        preventDefault$1(event);
        var _event$touches$ = event.touches[0],
          clientX = _event$touches$.clientX,
          clientY = _event$touches$.clientY;
        var target = document.elementFromPoint(clientX, clientY);
        if (target) {
          var index = target.dataset.index;
          /* istanbul ignore else */

          if (this.touchActiveIndex !== index) {
            this.touchActiveIndex = index;
            this.scrollToElement(target);
          }
        }
      }
    },
    scrollTo: function scrollTo(index) {
      var match = this.children.filter(function (item) {
        return String(item.index) === index;
      });
      if (match[0]) {
        match[0].scrollIntoView();
        if (this.sticky && this.stickyOffsetTop) {
          setRootScrollTop(getRootScrollTop() - this.stickyOffsetTop);
        }
        this.$emit('select', match[0].index);
      }
    },
    scrollToElement: function scrollToElement(element) {
      var index = element.dataset.index;
      this.scrollTo(index);
    },
    onTouchEnd: function onTouchEnd() {
      this.active = null;
    }
  },
  render: function render() {
    var _this2 = this;
    var h = arguments[0];
    var Indexes = this.indexList.map(function (index) {
      var active = index === _this2.activeAnchorIndex;
      return h("span", {
        "class": bem$A('index', {
          active: active
        }),
        "style": active ? _this2.highlightStyle : null,
        "attrs": {
          "data-index": index
        }
      }, [index]);
    });
    return h("div", {
      "class": bem$A()
    }, [h("div", {
      "class": bem$A('sidebar'),
      "style": this.sidebarStyle,
      "on": {
        "click": this.onClick,
        "touchstart": this.touchStart,
        "touchmove": this.onTouchMove,
        "touchend": this.onTouchEnd,
        "touchcancel": this.onTouchEnd
      }
    }, [Indexes]), this.slots('default')]);
  }
});

// Utils
var _createNamespace$A = createNamespace('list'),
  createComponent$E = _createNamespace$A[0],
  bem$z = _createNamespace$A[1],
  t$e = _createNamespace$A[2];
var List = createComponent$E({
  mixins: [BindEventMixin(function (bind) {
    if (!this.scroller) {
      this.scroller = getScroller(this.$el);
    }
    bind(this.scroller, 'scroll', this.check);
  })],
  model: {
    prop: 'loading'
  },
  props: {
    error: Boolean,
    loading: Boolean,
    finished: Boolean,
    errorText: String,
    loadingText: String,
    finishedText: String,
    immediateCheck: {
      type: Boolean,
      default: true
    },
    offset: {
      type: [Number, String],
      default: 300
    },
    direction: {
      type: String,
      default: 'down'
    }
  },
  data: function data() {
    return {
      // use sync innerLoading state to avoid repeated loading in some edge cases
      innerLoading: this.loading
    };
  },
  updated: function updated() {
    this.innerLoading = this.loading;
  },
  mounted: function mounted() {
    if (this.immediateCheck) {
      this.check();
    }
  },
  watch: {
    loading: 'check',
    finished: 'check'
  },
  methods: {
    // @exposed-api
    check: function check() {
      var _this = this;
      this.$nextTick(function () {
        if (_this.innerLoading || _this.finished || _this.error) {
          return;
        }
        var el = _this.$el,
          scroller = _this.scroller,
          offset = _this.offset,
          direction = _this.direction;
        var scrollerRect;
        if (scroller.getBoundingClientRect) {
          scrollerRect = scroller.getBoundingClientRect();
        } else {
          scrollerRect = {
            top: 0,
            bottom: scroller.innerHeight
          };
        }
        var scrollerHeight = scrollerRect.bottom - scrollerRect.top;
        /* istanbul ignore next */

        if (!scrollerHeight || isHidden(el)) {
          return false;
        }
        var isReachEdge = false;
        var placeholderRect = _this.$refs.placeholder.getBoundingClientRect();
        if (direction === 'up') {
          isReachEdge = scrollerRect.top - placeholderRect.top <= offset;
        } else {
          isReachEdge = placeholderRect.bottom - scrollerRect.bottom <= offset;
        }
        if (isReachEdge) {
          _this.innerLoading = true;
          _this.$emit('input', true);
          _this.$emit('load');
        }
      });
    },
    clickErrorText: function clickErrorText() {
      this.$emit('update:error', false);
      this.check();
    },
    genLoading: function genLoading() {
      var h = this.$createElement;
      if (this.innerLoading && !this.finished) {
        return h("div", {
          "key": "loading",
          "class": bem$z('loading')
        }, [this.slots('loading') || h(Loading$1, {
          "attrs": {
            "size": "16"
          }
        }, [this.loadingText || t$e('loading')])]);
      }
    },
    genFinishedText: function genFinishedText() {
      var h = this.$createElement;
      if (this.finished) {
        var text = this.slots('finished') || this.finishedText;
        if (text) {
          return h("div", {
            "class": bem$z('finished-text')
          }, [text]);
        }
      }
    },
    genErrorText: function genErrorText() {
      var h = this.$createElement;
      if (this.error) {
        var text = this.slots('error') || this.errorText;
        if (text) {
          return h("div", {
            "on": {
              "click": this.clickErrorText
            },
            "class": bem$z('error-text')
          }, [text]);
        }
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    var Placeholder = h("div", {
      "ref": "placeholder",
      "key": "placeholder",
      "class": bem$z('placeholder')
    });
    return h("div", {
      "class": bem$z(),
      "attrs": {
        "role": "feed",
        "aria-busy": this.innerLoading
      }
    }, [this.direction === 'down' ? this.slots() : Placeholder, this.genLoading(), this.genFinishedText(), this.genErrorText(), this.direction === 'up' ? this.slots() : Placeholder]);
  }
});

// Utils
var _createNamespace$z = createNamespace('nav-bar'),
  createComponent$D = _createNamespace$z[0],
  bem$y = _createNamespace$z[1];
var NavBar = createComponent$D({
  props: {
    title: String,
    fixed: Boolean,
    zIndex: [Number, String],
    leftText: String,
    rightText: String,
    leftArrow: Boolean,
    placeholder: Boolean,
    safeAreaInsetTop: Boolean,
    border: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    return {
      height: null
    };
  },
  mounted: function mounted() {
    var _this = this;
    if (this.placeholder && this.fixed) {
      var setHeight = function setHeight() {
        _this.height = _this.$refs.navBar.getBoundingClientRect().height;
      };
      setHeight(); // https://github.com/vant-ui/vant/issues/10131

      setTimeout(setHeight, 100);
    }
  },
  methods: {
    genLeft: function genLeft() {
      var h = this.$createElement;
      var leftSlot = this.slots('left');
      if (leftSlot) {
        return leftSlot;
      }
      return [this.leftArrow && h(Icon$3, {
        "class": bem$y('arrow'),
        "attrs": {
          "name": "arrow-left"
        }
      }), this.leftText && h("span", {
        "class": bem$y('text')
      }, [this.leftText])];
    },
    genRight: function genRight() {
      var h = this.$createElement;
      var rightSlot = this.slots('right');
      if (rightSlot) {
        return rightSlot;
      }
      if (this.rightText) {
        return h("span", {
          "class": bem$y('text')
        }, [this.rightText]);
      }
    },
    genNavBar: function genNavBar() {
      var _ref;
      var h = this.$createElement;
      return h("div", {
        "ref": "navBar",
        "style": {
          zIndex: this.zIndex
        },
        "class": [bem$y({
          fixed: this.fixed,
          'safe-area-inset-top': this.safeAreaInsetTop
        }), (_ref = {}, _ref[BORDER_BOTTOM] = this.border, _ref)]
      }, [h("div", {
        "class": bem$y('content')
      }, [this.hasLeft() && h("div", {
        "class": bem$y('left'),
        "on": {
          "click": this.onClickLeft
        }
      }, [this.genLeft()]), h("div", {
        "class": [bem$y('title'), 'van-ellipsis']
      }, [this.slots('title') || this.title]), this.hasRight() && h("div", {
        "class": bem$y('right'),
        "on": {
          "click": this.onClickRight
        }
      }, [this.genRight()])])]);
    },
    hasLeft: function hasLeft() {
      return this.leftArrow || this.leftText || this.slots('left');
    },
    hasRight: function hasRight() {
      return this.rightText || this.slots('right');
    },
    onClickLeft: function onClickLeft(event) {
      this.$emit('click-left', event);
    },
    onClickRight: function onClickRight(event) {
      this.$emit('click-right', event);
    }
  },
  render: function render() {
    var h = arguments[0];
    if (this.placeholder && this.fixed) {
      return h("div", {
        "class": bem$y('placeholder'),
        "style": {
          height: this.height + "px"
        }
      }, [this.genNavBar()]);
    }
    return this.genNavBar();
  }
});

var _createNamespace$y = createNamespace('notice-bar'),
  createComponent$C = _createNamespace$y[0],
  bem$x = _createNamespace$y[1];
var NoticeBar = createComponent$C({
  mixins: [BindEventMixin(function (bind) {
    // fix cache issues with forwards and back history in safari
    // see: https://guwii.com/cache-issues-with-forwards-and-back-history-in-safari/
    bind(window, 'pageshow', this.reset);
  })],
  inject: {
    vanPopup: {
      default: null
    }
  },
  props: {
    text: String,
    mode: String,
    color: String,
    leftIcon: String,
    wrapable: Boolean,
    background: String,
    scrollable: {
      type: Boolean,
      default: null
    },
    delay: {
      type: [Number, String],
      default: 1
    },
    speed: {
      type: [Number, String],
      default: 60
    }
  },
  data: function data() {
    return {
      show: true,
      offset: 0,
      duration: 0,
      wrapWidth: 0,
      contentWidth: 0
    };
  },
  watch: {
    scrollable: 'reset',
    text: {
      handler: 'reset',
      immediate: true
    }
  },
  created: function created() {
    // https://github.com/vant-ui/vant/issues/8634
    if (this.vanPopup) {
      this.vanPopup.onReopen(this.reset);
    }
  },
  activated: function activated() {
    this.reset();
  },
  methods: {
    onClickIcon: function onClickIcon(event) {
      if (this.mode === 'closeable') {
        this.show = false;
        this.$emit('close', event);
      }
    },
    onTransitionEnd: function onTransitionEnd() {
      var _this = this;
      this.offset = this.wrapWidth;
      this.duration = 0; // wait for Vue to render offset
      // using nextTick won't work in iOS14

      raf(function () {
        // use double raf to ensure animation can start
        doubleRaf(function () {
          _this.offset = -_this.contentWidth;
          _this.duration = (_this.contentWidth + _this.wrapWidth) / _this.speed;
          _this.$emit('replay');
        });
      });
    },
    // not an exposed-api, but may used by some users
    start: function start() {
      this.reset();
    },
    // @exposed-api
    reset: function reset() {
      var _this2 = this;
      var delay = isDef$1(this.delay) ? this.delay * 1000 : 0;
      this.offset = 0;
      this.duration = 0;
      this.wrapWidth = 0;
      this.contentWidth = 0;
      clearTimeout(this.startTimer);
      this.startTimer = setTimeout(function () {
        var _this2$$refs = _this2.$refs,
          wrap = _this2$$refs.wrap,
          content = _this2$$refs.content;
        if (!wrap || !content || _this2.scrollable === false) {
          return;
        }
        var wrapWidth = wrap.getBoundingClientRect().width;
        var contentWidth = content.getBoundingClientRect().width;
        if (_this2.scrollable || contentWidth > wrapWidth) {
          doubleRaf(function () {
            _this2.offset = -contentWidth;
            _this2.duration = contentWidth / _this2.speed;
            _this2.wrapWidth = wrapWidth;
            _this2.contentWidth = contentWidth;
          });
        }
      }, delay);
    }
  },
  render: function render() {
    var _this3 = this;
    var h = arguments[0];
    var slots = this.slots,
      mode = this.mode,
      leftIcon = this.leftIcon,
      onClickIcon = this.onClickIcon;
    var barStyle = {
      color: this.color,
      background: this.background
    };
    var contentStyle = {
      transform: this.offset ? "translateX(" + this.offset + "px)" : '',
      transitionDuration: this.duration + 's'
    };
    function LeftIcon() {
      var slot = slots('left-icon');
      if (slot) {
        return slot;
      }
      if (leftIcon) {
        return h(Icon$3, {
          "class": bem$x('left-icon'),
          "attrs": {
            "name": leftIcon
          }
        });
      }
    }
    function RightIcon() {
      var slot = slots('right-icon');
      if (slot) {
        return slot;
      }
      var iconName;
      if (mode === 'closeable') {
        iconName = 'cross';
      } else if (mode === 'link') {
        iconName = 'arrow';
      }
      if (iconName) {
        return h(Icon$3, {
          "class": bem$x('right-icon'),
          "attrs": {
            "name": iconName
          },
          "on": {
            "click": onClickIcon
          }
        });
      }
    }
    return h("div", {
      "attrs": {
        "role": "alert"
      },
      "directives": [{
        name: "show",
        value: this.show
      }],
      "class": bem$x({
        wrapable: this.wrapable
      }),
      "style": barStyle,
      "on": {
        "click": function click(event) {
          _this3.$emit('click', event);
        }
      }
    }, [LeftIcon(), h("div", {
      "ref": "wrap",
      "class": bem$x('wrap'),
      "attrs": {
        "role": "marquee"
      }
    }, [h("div", {
      "ref": "content",
      "class": [bem$x('content'), {
        'van-ellipsis': this.scrollable === false && !this.wrapable
      }],
      "style": contentStyle,
      "on": {
        "transitionend": this.onTransitionEnd
      }
    }, [this.slots() || this.text])]), RightIcon()]);
  }
});

var _createNamespace$x = createNamespace('notify'),
  createComponent$B = _createNamespace$x[0],
  bem$w = _createNamespace$x[1];
function Notify$1(h, props, slots, ctx) {
  var style = {
    color: props.color,
    background: props.background
  };
  return h(Popup, _mergeJSXProps([{
    "attrs": {
      "value": props.value,
      "position": "top",
      "overlay": false,
      "duration": 0.2,
      "lockScroll": false
    },
    "style": style,
    "class": [bem$w([props.type]), props.className]
  }, inherit(ctx, true)]), [(slots.default == null ? void 0 : slots.default()) || props.message]);
}
Notify$1.props = _extends$1({}, popupMixinProps, {
  color: String,
  message: [Number, String],
  duration: [Number, String],
  className: null,
  background: String,
  getContainer: [String, Function],
  type: {
    type: String,
    default: 'danger'
  }
});
var VanNotify = createComponent$B(Notify$1);

var timer;
var instance$2;
function parseOptions$1(message) {
  return isObject$6(message) ? message : {
    message: message
  };
}
function Notify(options) {
  /* istanbul ignore if */
  if (isServer$1) {
    return;
  }
  if (!instance$2) {
    instance$2 = mount(VanNotify, {
      on: {
        click: function click(event) {
          if (instance$2.onClick) {
            instance$2.onClick(event);
          }
        },
        close: function close() {
          if (instance$2.onClose) {
            instance$2.onClose();
          }
        },
        opened: function opened() {
          if (instance$2.onOpened) {
            instance$2.onOpened();
          }
        }
      }
    });
  }
  options = _extends$1({}, Notify.currentOptions, parseOptions$1(options));
  _extends$1(instance$2, options);
  clearTimeout(timer);
  if (options.duration && options.duration > 0) {
    timer = setTimeout(Notify.clear, options.duration);
  }
  return instance$2;
}
function defaultOptions() {
  return {
    type: 'danger',
    value: true,
    message: '',
    color: undefined,
    background: undefined,
    duration: 3000,
    className: '',
    onClose: null,
    onClick: null,
    onOpened: null
  };
}
Notify.clear = function () {
  if (instance$2) {
    instance$2.value = false;
  }
};
Notify.currentOptions = defaultOptions();
Notify.setDefaultOptions = function (options) {
  _extends$1(Notify.currentOptions, options);
};
Notify.resetDefaultOptions = function () {
  Notify.currentOptions = defaultOptions();
};
Notify.install = function () {
  Vue.use(VanNotify);
};
Notify.Component = VanNotify;
Vue.prototype.$notify = Notify;

var DeleteIcon = {
  render: function render() {
    var h = arguments[0];
    return h("svg", {
      "attrs": {
        "viewBox": "0 0 32 22",
        "xmlns": "http://www.w3.org/2000/svg"
      }
    }, [h("path", {
      "attrs": {
        "d": "M28.016 0A3.991 3.991 0 0132 3.987v14.026c0 2.2-1.787 3.987-3.98 3.987H10.382c-.509 0-.996-.206-1.374-.585L.89 13.09C.33 12.62 0 11.84 0 11.006c0-.86.325-1.62.887-2.08L9.01.585A1.936 1.936 0 0110.383 0zm0 1.947H10.368L2.24 10.28c-.224.226-.312.432-.312.73 0 .287.094.51.312.729l8.128 8.333h17.648a2.041 2.041 0 002.037-2.04V3.987c0-1.127-.915-2.04-2.037-2.04zM23.028 6a.96.96 0 01.678.292.95.95 0 01-.003 1.377l-3.342 3.348 3.326 3.333c.189.188.292.43.292.679 0 .248-.103.49-.292.679a.96.96 0 01-.678.292.959.959 0 01-.677-.292L18.99 12.36l-3.343 3.345a.96.96 0 01-.677.292.96.96 0 01-.678-.292.962.962 0 01-.292-.68c0-.248.104-.49.292-.679l3.342-3.348-3.342-3.348A.963.963 0 0114 6.971c0-.248.104-.49.292-.679A.96.96 0 0114.97 6a.96.96 0 01.677.292l3.358 3.348 3.345-3.348A.96.96 0 0123.028 6z",
        "fill": "currentColor"
      }
    })]);
  }
};

var CollapseIcon = {
  render: function render() {
    var h = arguments[0];
    return h("svg", {
      "attrs": {
        "viewBox": "0 0 30 24",
        "xmlns": "http://www.w3.org/2000/svg"
      }
    }, [h("path", {
      "attrs": {
        "d": "M25.877 12.843h-1.502c-.188 0-.188 0-.188.19v1.512c0 .188 0 .188.188.188h1.5c.187 0 .187 0 .187-.188v-1.511c0-.19 0-.191-.185-.191zM17.999 10.2c0 .188 0 .188.188.188h1.687c.188 0 .188 0 .188-.188V8.688c0-.187.004-.187-.186-.19h-1.69c-.187 0-.187 0-.187.19V10.2zm2.25-3.967h1.5c.188 0 .188 0 .188-.188v-1.7c0-.19 0-.19-.188-.19h-1.5c-.189 0-.189 0-.189.19v1.7c0 .188 0 .188.19.188zm2.063 4.157h3.563c.187 0 .187 0 .187-.189V4.346c0-.19.004-.19-.185-.19h-1.69c-.187 0-.187 0-.187.188v4.155h-1.688c-.187 0-.187 0-.187.189v1.514c0 .19 0 .19.187.19zM14.812 24l2.812-3.4H12l2.813 3.4zm-9-11.157H4.31c-.188 0-.188 0-.188.19v1.512c0 .188 0 .188.188.188h1.502c.187 0 .187 0 .187-.188v-1.511c0-.19.01-.191-.189-.191zm15.937 0H8.25c-.188 0-.188 0-.188.19v1.512c0 .188 0 .188.188.188h13.5c.188 0 .188 0 .188-.188v-1.511c0-.19 0-.191-.188-.191zm-11.438-2.454h1.5c.188 0 .188 0 .188-.188V8.688c0-.187 0-.187-.188-.189h-1.5c-.187 0-.187 0-.187.189V10.2c0 .188 0 .188.187.188zM27.94 0c.563 0 .917.21 1.313.567.518.466.748.757.748 1.51v14.92c0 .567-.188 1.134-.562 1.512-.376.378-.938.566-1.313.566H2.063c-.563 0-.938-.188-1.313-.566-.562-.378-.75-.945-.75-1.511V2.078C0 1.51.188.944.562.567.938.189 1.5 0 1.875 0zm-.062 2H2v14.92h25.877V2zM5.81 4.157c.19 0 .19 0 .19.189v1.762c-.003.126-.024.126-.188.126H4.249c-.126-.003-.126-.023-.126-.188v-1.7c-.187-.19 0-.19.188-.19zm10.5 2.077h1.503c.187 0 .187 0 .187-.188v-1.7c0-.19 0-.19-.187-.19h-1.502c-.188 0-.188.001-.188.19v1.7c0 .188 0 .188.188.188zM7.875 8.5c.187 0 .187.002.187.189V10.2c0 .188 0 .188-.187.188H4.249c-.126-.002-.126-.023-.126-.188V8.625c.003-.126.024-.126.188-.126zm7.875 0c.19.002.19.002.19.189v1.575c-.003.126-.024.126-.19.126h-1.563c-.126-.002-.126-.023-.126-.188V8.625c.002-.126.023-.126.189-.126zm-6-4.342c.187 0 .187 0 .187.189v1.7c0 .188 0 .188-.187.188H8.187c-.126-.003-.126-.023-.126-.188V4.283c.003-.126.024-.126.188-.126zm3.94 0c.185 0 .372 0 .372.189v1.762c-.002.126-.023.126-.187.126h-1.75C12 6.231 12 6.211 12 6.046v-1.7c0-.19.187-.19.187-.19z",
        "fill": "currentColor"
      }
    })]);
  }
};

var _createNamespace$w = createNamespace('key'),
  createComponent$A = _createNamespace$w[0],
  bem$v = _createNamespace$w[1];
var Key = createComponent$A({
  mixins: [TouchMixin],
  props: {
    type: String,
    text: [Number, String],
    color: String,
    wider: Boolean,
    large: Boolean,
    loading: Boolean
  },
  data: function data() {
    return {
      active: false
    };
  },
  mounted: function mounted() {
    this.bindTouchEvent(this.$el);
  },
  methods: {
    onTouchStart: function onTouchStart(event) {
      // compatible with Vue 2.6 event bubble bug
      event.stopPropagation();
      this.touchStart(event);
      this.active = true;
    },
    onTouchMove: function onTouchMove(event) {
      this.touchMove(event);
      if (this.direction) {
        this.active = false;
      }
    },
    onTouchEnd: function onTouchEnd(event) {
      if (this.active) {
        // eliminate tap delay on safari
        // see: https://github.com/vant-ui/vant/issues/6836
        if (!this.slots('default')) {
          event.preventDefault();
        }
        this.active = false;
        this.$emit('press', this.text, this.type);
      }
    },
    genContent: function genContent() {
      var h = this.$createElement;
      var isExtra = this.type === 'extra';
      var isDelete = this.type === 'delete';
      var text = this.slots('default') || this.text;
      if (this.loading) {
        return h(Loading$1, {
          "class": bem$v('loading-icon')
        });
      }
      if (isDelete) {
        return text || h(DeleteIcon, {
          "class": bem$v('delete-icon')
        });
      }
      if (isExtra) {
        return text || h(CollapseIcon, {
          "class": bem$v('collapse-icon')
        });
      }
      return text;
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$v('wrapper', {
        wider: this.wider
      })
    }, [h("div", {
      "attrs": {
        "role": "button",
        "tabindex": "0"
      },
      "class": bem$v([this.color, {
        large: this.large,
        active: this.active,
        delete: this.type === 'delete'
      }])
    }, [this.genContent()])]);
  }
});

var _createNamespace$v = createNamespace('number-keyboard'),
  createComponent$z = _createNamespace$v[0],
  bem$u = _createNamespace$v[1];
var NumberKeyboard = createComponent$z({
  mixins: [PortalMixin(), BindEventMixin(function (bind) {
    if (this.hideOnClickOutside) {
      bind(document.body, 'touchstart', this.onBlur);
    }
  })],
  model: {
    event: 'update:value'
  },
  props: {
    show: Boolean,
    title: String,
    zIndex: [Number, String],
    randomKeyOrder: Boolean,
    closeButtonText: String,
    deleteButtonText: String,
    closeButtonLoading: Boolean,
    theme: {
      type: String,
      default: 'default'
    },
    value: {
      type: String,
      default: ''
    },
    extraKey: {
      type: [String, Array],
      default: ''
    },
    maxlength: {
      type: [Number, String],
      default: Number.MAX_VALUE
    },
    transition: {
      type: Boolean,
      default: true
    },
    showDeleteKey: {
      type: Boolean,
      default: true
    },
    hideOnClickOutside: {
      type: Boolean,
      default: true
    },
    safeAreaInsetBottom: {
      type: Boolean,
      default: true
    }
  },
  watch: {
    show: function show(val) {
      if (!this.transition) {
        this.$emit(val ? 'show' : 'hide');
      }
    }
  },
  computed: {
    keys: function keys() {
      if (this.theme === 'custom') {
        return this.genCustomKeys();
      }
      return this.genDefaultKeys();
    }
  },
  methods: {
    genBasicKeys: function genBasicKeys() {
      var keys = [];
      for (var i = 1; i <= 9; i++) {
        keys.push({
          text: i
        });
      }
      if (this.randomKeyOrder) {
        keys.sort(function () {
          return Math.random() > 0.5 ? 1 : -1;
        });
      }
      return keys;
    },
    genDefaultKeys: function genDefaultKeys() {
      return [].concat(this.genBasicKeys(), [{
        text: this.extraKey,
        type: 'extra'
      }, {
        text: 0
      }, {
        text: this.showDeleteKey ? this.deleteButtonText : '',
        type: this.showDeleteKey ? 'delete' : ''
      }]);
    },
    genCustomKeys: function genCustomKeys() {
      var keys = this.genBasicKeys();
      var extraKey = this.extraKey;
      var extraKeys = Array.isArray(extraKey) ? extraKey : [extraKey];
      if (extraKeys.length === 1) {
        keys.push({
          text: 0,
          wider: true
        }, {
          text: extraKeys[0],
          type: 'extra'
        });
      } else if (extraKeys.length === 2) {
        keys.push({
          text: extraKeys[0],
          type: 'extra'
        }, {
          text: 0
        }, {
          text: extraKeys[1],
          type: 'extra'
        });
      }
      return keys;
    },
    onBlur: function onBlur() {
      this.show && this.$emit('blur');
    },
    onClose: function onClose() {
      this.$emit('close');
      this.onBlur();
    },
    onAnimationEnd: function onAnimationEnd() {
      this.$emit(this.show ? 'show' : 'hide');
    },
    onPress: function onPress(text, type) {
      if (text === '') {
        if (type === 'extra') {
          this.onBlur();
        }
        return;
      }
      var value = this.value;
      if (type === 'delete') {
        this.$emit('delete');
        this.$emit('update:value', value.slice(0, value.length - 1));
      } else if (type === 'close') {
        this.onClose();
      } else if (value.length < this.maxlength) {
        this.$emit('input', text);
        this.$emit('update:value', value + text);
      }
    },
    genTitle: function genTitle() {
      var h = this.$createElement;
      var title = this.title,
        theme = this.theme,
        closeButtonText = this.closeButtonText;
      var titleLeft = this.slots('title-left');
      var showClose = closeButtonText && theme === 'default';
      var showTitle = title || showClose || titleLeft;
      if (!showTitle) {
        return;
      }
      return h("div", {
        "class": bem$u('header')
      }, [titleLeft && h("span", {
        "class": bem$u('title-left')
      }, [titleLeft]), title && h("h2", {
        "class": bem$u('title')
      }, [title]), showClose && h("button", {
        "attrs": {
          "type": "button"
        },
        "class": bem$u('close'),
        "on": {
          "click": this.onClose
        }
      }, [closeButtonText])]);
    },
    genKeys: function genKeys() {
      var _this = this;
      var h = this.$createElement;
      return this.keys.map(function (key) {
        return h(Key, {
          "key": key.text,
          "attrs": {
            "text": key.text,
            "type": key.type,
            "wider": key.wider,
            "color": key.color
          },
          "on": {
            "press": _this.onPress
          }
        }, [key.type === 'delete' && _this.slots('delete'), key.type === 'extra' && _this.slots('extra-key')]);
      });
    },
    genSidebar: function genSidebar() {
      var h = this.$createElement;
      if (this.theme === 'custom') {
        return h("div", {
          "class": bem$u('sidebar')
        }, [this.showDeleteKey && h(Key, {
          "attrs": {
            "large": true,
            "text": this.deleteButtonText,
            "type": "delete"
          },
          "on": {
            "press": this.onPress
          }
        }, [this.slots('delete')]), h(Key, {
          "attrs": {
            "large": true,
            "text": this.closeButtonText,
            "type": "close",
            "color": "blue",
            "loading": this.closeButtonLoading
          },
          "on": {
            "press": this.onPress
          }
        })]);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    var Title = this.genTitle();
    return h("transition", {
      "attrs": {
        "name": this.transition ? 'van-slide-up' : ''
      }
    }, [h("div", {
      "directives": [{
        name: "show",
        value: this.show
      }],
      "style": {
        zIndex: this.zIndex
      },
      "class": bem$u({
        unfit: !this.safeAreaInsetBottom,
        'with-title': Title
      }),
      "on": {
        "touchstart": stopPropagation,
        "animationend": this.onAnimationEnd,
        "webkitAnimationEnd": this.onAnimationEnd
      }
    }, [Title, h("div", {
      "class": bem$u('body')
    }, [h("div", {
      "class": bem$u('keys')
    }, [this.genKeys()]), this.genSidebar()])])]);
  }
});

var _createNamespace$u = createNamespace('pagination'),
  createComponent$y = _createNamespace$u[0],
  bem$t = _createNamespace$u[1],
  t$d = _createNamespace$u[2];
function makePage(number, text, active) {
  return {
    number: number,
    text: text,
    active: active
  };
}
var Pagination = createComponent$y({
  props: {
    prevText: String,
    nextText: String,
    forceEllipses: Boolean,
    mode: {
      type: String,
      default: 'multi'
    },
    value: {
      type: Number,
      default: 0
    },
    pageCount: {
      type: [Number, String],
      default: 0
    },
    totalItems: {
      type: [Number, String],
      default: 0
    },
    itemsPerPage: {
      type: [Number, String],
      default: 10
    },
    showPageSize: {
      type: [Number, String],
      default: 5
    }
  },
  computed: {
    count: function count() {
      var count = this.pageCount || Math.ceil(this.totalItems / this.itemsPerPage);
      return Math.max(1, count);
    },
    pages: function pages() {
      var pages = [];
      var pageCount = this.count;
      var showPageSize = +this.showPageSize;
      if (this.mode !== 'multi') {
        return pages;
      } // Default page limits

      var startPage = 1;
      var endPage = pageCount;
      var isMaxSized = showPageSize < pageCount; // recompute if showPageSize

      if (isMaxSized) {
        // Current page is displayed in the middle of the visible ones
        startPage = Math.max(this.value - Math.floor(showPageSize / 2), 1);
        endPage = startPage + showPageSize - 1; // Adjust if limit is exceeded

        if (endPage > pageCount) {
          endPage = pageCount;
          startPage = endPage - showPageSize + 1;
        }
      } // Add page number links

      for (var number = startPage; number <= endPage; number++) {
        var page = makePage(number, number, number === this.value);
        pages.push(page);
      } // Add links to move between page sets

      if (isMaxSized && showPageSize > 0 && this.forceEllipses) {
        if (startPage > 1) {
          var previousPageSet = makePage(startPage - 1, '...', false);
          pages.unshift(previousPageSet);
        }
        if (endPage < pageCount) {
          var nextPageSet = makePage(endPage + 1, '...', false);
          pages.push(nextPageSet);
        }
      }
      return pages;
    }
  },
  watch: {
    value: {
      handler: function handler(page) {
        this.select(page || this.value);
      },
      immediate: true
    }
  },
  methods: {
    select: function select(page, emitChange) {
      page = Math.min(this.count, Math.max(1, page));
      if (this.value !== page) {
        this.$emit('input', page);
        if (emitChange) {
          this.$emit('change', page);
        }
      }
    }
  },
  render: function render() {
    var _this = this,
      _this$slots,
      _this$slots3;
    var h = arguments[0];
    var value = this.value;
    var simple = this.mode !== 'multi';
    var onSelect = function onSelect(value) {
      return function () {
        _this.select(value, true);
      };
    };
    return h("ul", {
      "class": bem$t({
        simple: simple
      })
    }, [h("li", {
      "class": [bem$t('item', {
        disabled: value === 1
      }), bem$t('prev'), BORDER],
      "on": {
        "click": onSelect(value - 1)
      }
    }, [((_this$slots = this.slots('prev-text')) != null ? _this$slots : this.prevText) || t$d('prev')]), this.pages.map(function (page) {
      var _this$slots2;
      return h("li", {
        "class": [bem$t('item', {
          active: page.active
        }), bem$t('page'), BORDER],
        "on": {
          "click": onSelect(page.number)
        }
      }, [(_this$slots2 = _this.slots('page', page)) != null ? _this$slots2 : page.text]);
    }), simple && h("li", {
      "class": bem$t('page-desc')
    }, [this.slots('pageDesc') || value + "/" + this.count]), h("li", {
      "class": [bem$t('item', {
        disabled: value === this.count
      }), bem$t('next'), BORDER],
      "on": {
        "click": onSelect(value + 1)
      }
    }, [((_this$slots3 = this.slots('next-text')) != null ? _this$slots3 : this.nextText) || t$d('next')])]);
  }
});

var _createNamespace$t = createNamespace('panel'),
  createComponent$x = _createNamespace$t[0],
  bem$s = _createNamespace$t[1];
function Panel(h, props, slots, ctx) {
  var Content = function Content() {
    return [slots.header ? slots.header() : h(Cell$1, {
      "attrs": {
        "icon": props.icon,
        "label": props.desc,
        "title": props.title,
        "value": props.status,
        "valueClass": bem$s('header-value')
      },
      "class": bem$s('header')
    }), h("div", {
      "class": bem$s('content')
    }, [slots.default && slots.default()]), slots.footer && h("div", {
      "class": [bem$s('footer'), BORDER_TOP]
    }, [slots.footer()])];
  };
  return h(CellGroup$1, _mergeJSXProps([{
    "class": bem$s(),
    "scopedSlots": {
      default: Content
    }
  }, inherit(ctx, true)]));
}
Panel.props = {
  icon: String,
  desc: String,
  title: String,
  status: String
};
var Panel$1 = createComponent$x(Panel);

var _createNamespace$s = createNamespace('password-input'),
  createComponent$w = _createNamespace$s[0],
  bem$r = _createNamespace$s[1];
function PasswordInput(h, props, slots, ctx) {
  var _ref2;
  var mask = props.mask,
    value = props.value,
    length = props.length,
    gutter = props.gutter,
    focused = props.focused,
    errorInfo = props.errorInfo;
  var info = errorInfo || props.info;
  var Points = [];
  for (var i = 0; i < length; i++) {
    var _ref;
    var _char = value[i];
    var showBorder = i !== 0 && !gutter;
    var showCursor = focused && i === value.length;
    var style = void 0;
    if (i !== 0 && gutter) {
      style = {
        marginLeft: addUnit(gutter)
      };
    }
    Points.push(h("li", {
      "class": [(_ref = {}, _ref[BORDER_LEFT] = showBorder, _ref), bem$r('item', {
        focus: showCursor
      })],
      "style": style
    }, [mask ? h("i", {
      "style": {
        visibility: _char ? 'visible' : 'hidden'
      }
    }) : _char, showCursor && h("div", {
      "class": bem$r('cursor')
    })]));
  }
  return h("div", {
    "class": bem$r()
  }, [h("ul", _mergeJSXProps([{
    "class": [bem$r('security'), (_ref2 = {}, _ref2[BORDER_SURROUND] = !gutter, _ref2)],
    "on": {
      "touchstart": function touchstart(event) {
        event.stopPropagation();
        emit(ctx, 'focus', event);
      }
    }
  }, inherit(ctx, true)]), [Points]), info && h("div", {
    "class": bem$r(errorInfo ? 'error-info' : 'info')
  }, [info])]);
}
PasswordInput.props = {
  info: String,
  gutter: [Number, String],
  focused: Boolean,
  errorInfo: String,
  mask: {
    type: Boolean,
    default: true
  },
  value: {
    type: String,
    default: ''
  },
  length: {
    type: [Number, String],
    default: 6
  }
};
var PasswordInput$1 = createComponent$w(PasswordInput);

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getWindow.js
function getWindow$1(node) {
  if (node == null) {
    return window;
  }
  if (node.toString() !== "[object Window]") {
    var ownerDocument = node.ownerDocument;
    return ownerDocument ? ownerDocument.defaultView || window : window;
  }
  return node;
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js
function isElement$3(node) {
  var OwnElement = getWindow$1(node).Element;
  return node instanceof OwnElement || node instanceof Element;
}
function isHTMLElement$2(node) {
  var OwnElement = getWindow$1(node).HTMLElement;
  return node instanceof OwnElement || node instanceof HTMLElement;
}
function isShadowRoot$1(node) {
  if (typeof ShadowRoot === "undefined") {
    return false;
  }
  var OwnElement = getWindow$1(node).ShadowRoot;
  return node instanceof OwnElement || node instanceof ShadowRoot;
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/math.js
var round$7 = Math.round;

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/userAgent.js
function getUAString$1() {
  var uaData = navigator.userAgentData;
  if (uaData != null && uaData.brands) {
    return uaData.brands.map(function (item) {
      return item.brand + "/" + item.version;
    }).join(" ");
  }
  return navigator.userAgent;
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js
function isLayoutViewport$1() {
  return !/^((?!chrome|android).)*safari/i.test(getUAString$1());
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
function getBoundingClientRect$2(element, includeScale, isFixedStrategy) {
  if (includeScale === void 0) {
    includeScale = false;
  }
  if (isFixedStrategy === void 0) {
    isFixedStrategy = false;
  }
  var clientRect = element.getBoundingClientRect();
  var scaleX = 1;
  var scaleY = 1;
  if (includeScale && isHTMLElement$2(element)) {
    scaleX = element.offsetWidth > 0 ? round$7(clientRect.width) / element.offsetWidth || 1 : 1;
    scaleY = element.offsetHeight > 0 ? round$7(clientRect.height) / element.offsetHeight || 1 : 1;
  }
  var _ref = isElement$3(element) ? getWindow$1(element) : window,
    visualViewport = _ref.visualViewport;
  var addVisualOffsets = !isLayoutViewport$1() && isFixedStrategy;
  var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  var width = clientRect.width / scaleX;
  var height = clientRect.height / scaleY;
  return {
    width,
    height,
    top: y,
    right: x + width,
    bottom: y + height,
    left: x,
    x,
    y
  };
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js
function getWindowScroll$1(node) {
  var win = getWindow$1(node);
  var scrollLeft = win.pageXOffset;
  var scrollTop = win.pageYOffset;
  return {
    scrollLeft,
    scrollTop
  };
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
function getHTMLElementScroll$1(element) {
  return {
    scrollLeft: element.scrollLeft,
    scrollTop: element.scrollTop
  };
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
function getNodeScroll$1(node) {
  if (node === getWindow$1(node) || !isHTMLElement$2(node)) {
    return getWindowScroll$1(node);
  } else {
    return getHTMLElementScroll$1(node);
  }
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
function getNodeName$1(element) {
  return element ? (element.nodeName || "").toLowerCase() : null;
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
function getDocumentElement$1(element) {
  return ((isElement$3(element) ? element.ownerDocument : element.document) || window.document).documentElement;
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js
function getWindowScrollBarX$1(element) {
  return getBoundingClientRect$2(getDocumentElement$1(element)).left + getWindowScroll$1(element).scrollLeft;
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
function getComputedStyle$3(element) {
  return getWindow$1(element).getComputedStyle(element);
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js
function isScrollParent$1(element) {
  var _getComputedStyle = getComputedStyle$3(element),
    overflow = _getComputedStyle.overflow,
    overflowX = _getComputedStyle.overflowX,
    overflowY = _getComputedStyle.overflowY;
  return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
function isElementScaled$1(element) {
  var rect = element.getBoundingClientRect();
  var scaleX = round$7(rect.width) / element.offsetWidth || 1;
  var scaleY = round$7(rect.height) / element.offsetHeight || 1;
  return scaleX !== 1 || scaleY !== 1;
}
function getCompositeRect$1(elementOrVirtualElement, offsetParent, isFixed) {
  if (isFixed === void 0) {
    isFixed = false;
  }
  var isOffsetParentAnElement = isHTMLElement$2(offsetParent);
  var offsetParentIsScaled = isHTMLElement$2(offsetParent) && isElementScaled$1(offsetParent);
  var documentElement = getDocumentElement$1(offsetParent);
  var rect = getBoundingClientRect$2(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  var scroll = {
    scrollLeft: 0,
    scrollTop: 0
  };
  var offsets = {
    x: 0,
    y: 0
  };
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
    if (getNodeName$1(offsetParent) !== "body" || isScrollParent$1(documentElement)) {
      scroll = getNodeScroll$1(offsetParent);
    }
    if (isHTMLElement$2(offsetParent)) {
      offsets = getBoundingClientRect$2(offsetParent, true);
      offsets.x += offsetParent.clientLeft;
      offsets.y += offsetParent.clientTop;
    } else if (documentElement) {
      offsets.x = getWindowScrollBarX$1(documentElement);
    }
  }
  return {
    x: rect.left + scroll.scrollLeft - offsets.x,
    y: rect.top + scroll.scrollTop - offsets.y,
    width: rect.width,
    height: rect.height
  };
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
function getLayoutRect$2(element) {
  var clientRect = getBoundingClientRect$2(element);
  var width = element.offsetWidth;
  var height = element.offsetHeight;
  if (Math.abs(clientRect.width - width) <= 1) {
    width = clientRect.width;
  }
  if (Math.abs(clientRect.height - height) <= 1) {
    height = clientRect.height;
  }
  return {
    x: element.offsetLeft,
    y: element.offsetTop,
    width,
    height
  };
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
function getParentNode$1(element) {
  if (getNodeName$1(element) === "html") {
    return element;
  }
  return element.assignedSlot || element.parentNode || (isShadowRoot$1(element) ? element.host : null) || getDocumentElement$1(element);
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js
function getScrollParent$1(node) {
  if (["html", "body", "#document"].indexOf(getNodeName$1(node)) >= 0) {
    return node.ownerDocument.body;
  }
  if (isHTMLElement$2(node) && isScrollParent$1(node)) {
    return node;
  }
  return getScrollParent$1(getParentNode$1(node));
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js
function listScrollParents$1(element, list) {
  var _element$ownerDocumen;
  if (list === void 0) {
    list = [];
  }
  var scrollParent = getScrollParent$1(element);
  var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  var win = getWindow$1(scrollParent);
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent$1(scrollParent) ? scrollParent : []) : scrollParent;
  var updatedList = list.concat(target);
  return isBody ? updatedList : updatedList.concat(listScrollParents$1(getParentNode$1(target)));
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js
function isTableElement$1(element) {
  return ["table", "td", "th"].indexOf(getNodeName$1(element)) >= 0;
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
function getTrueOffsetParent$1(element) {
  if (!isHTMLElement$2(element) || getComputedStyle$3(element).position === "fixed") {
    return null;
  }
  return element.offsetParent;
}
function getContainingBlock$1(element) {
  var isFirefox = /firefox/i.test(getUAString$1());
  var isIE = /Trident/i.test(getUAString$1());
  if (isIE && isHTMLElement$2(element)) {
    var elementCss = getComputedStyle$3(element);
    if (elementCss.position === "fixed") {
      return null;
    }
  }
  var currentNode = getParentNode$1(element);
  if (isShadowRoot$1(currentNode)) {
    currentNode = currentNode.host;
  }
  while (isHTMLElement$2(currentNode) && ["html", "body"].indexOf(getNodeName$1(currentNode)) < 0) {
    var css = getComputedStyle$3(currentNode);
    if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
      return currentNode;
    } else {
      currentNode = currentNode.parentNode;
    }
  }
  return null;
}
function getOffsetParent$1(element) {
  var window2 = getWindow$1(element);
  var offsetParent = getTrueOffsetParent$1(element);
  while (offsetParent && isTableElement$1(offsetParent) && getComputedStyle$3(offsetParent).position === "static") {
    offsetParent = getTrueOffsetParent$1(offsetParent);
  }
  if (offsetParent && (getNodeName$1(offsetParent) === "html" || getNodeName$1(offsetParent) === "body" && getComputedStyle$3(offsetParent).position === "static")) {
    return window2;
  }
  return offsetParent || getContainingBlock$1(element) || window2;
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/enums.js
var top$1 = "top";
var bottom$1 = "bottom";
var right$1 = "right";
var left$1 = "left";
var auto$1 = "auto";
var basePlacements$1 = [top$1, bottom$1, right$1, left$1];
var start$2 = "start";
var end$2 = "end";
var placements$1 = /* @__PURE__ */[].concat(basePlacements$1, [auto$1]).reduce(function (acc, placement) {
  return acc.concat([placement, placement + "-" + start$2, placement + "-" + end$2]);
}, []);
var beforeRead$1 = "beforeRead";
var read$1 = "read";
var afterRead$1 = "afterRead";
var beforeMain$1 = "beforeMain";
var main$2 = "main";
var afterMain$1 = "afterMain";
var beforeWrite$1 = "beforeWrite";
var write$1 = "write";
var afterWrite$1 = "afterWrite";
var modifierPhases$1 = [beforeRead$1, read$1, afterRead$1, beforeMain$1, main$2, afterMain$1, beforeWrite$1, write$1, afterWrite$1];

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/orderModifiers.js
function order$1(modifiers) {
  var map = /* @__PURE__ */new Map();
  var visited = /* @__PURE__ */new Set();
  var result = [];
  modifiers.forEach(function (modifier) {
    map.set(modifier.name, modifier);
  });
  function sort(modifier) {
    visited.add(modifier.name);
    var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
    requires.forEach(function (dep) {
      if (!visited.has(dep)) {
        var depModifier = map.get(dep);
        if (depModifier) {
          sort(depModifier);
        }
      }
    });
    result.push(modifier);
  }
  modifiers.forEach(function (modifier) {
    if (!visited.has(modifier.name)) {
      sort(modifier);
    }
  });
  return result;
}
function orderModifiers$1(modifiers) {
  var orderedModifiers = order$1(modifiers);
  return modifierPhases$1.reduce(function (acc, phase) {
    return acc.concat(orderedModifiers.filter(function (modifier) {
      return modifier.phase === phase;
    }));
  }, []);
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/debounce.js
function debounce$4(fn2) {
  var pending;
  return function () {
    if (!pending) {
      pending = new Promise(function (resolve) {
        Promise.resolve().then(function () {
          pending = void 0;
          resolve(fn2());
        });
      });
    }
    return pending;
  };
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/format.js
function format$2(str) {
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    args[_key - 1] = arguments[_key];
  }
  return [].concat(args).reduce(function (p, c) {
    return p.replace(/%s/, c);
  }, str);
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/validateModifiers.js
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
function validateModifiers(modifiers) {
  modifiers.forEach(function (modifier) {
    [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function (value, index, self) {
      return self.indexOf(value) === index;
    }).forEach(function (key) {
      switch (key) {
        case "name":
          if (typeof modifier.name !== "string") {
            console.error(format$2(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
          }
          break;
        case "enabled":
          if (typeof modifier.enabled !== "boolean") {
            console.error(format$2(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
          }
          break;
        case "phase":
          if (modifierPhases$1.indexOf(modifier.phase) < 0) {
            console.error(format$2(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases$1.join(", "), '"' + String(modifier.phase) + '"'));
          }
          break;
        case "fn":
          if (typeof modifier.fn !== "function") {
            console.error(format$2(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
          }
          break;
        case "effect":
          if (modifier.effect != null && typeof modifier.effect !== "function") {
            console.error(format$2(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
          }
          break;
        case "requires":
          if (modifier.requires != null && !Array.isArray(modifier.requires)) {
            console.error(format$2(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
          }
          break;
        case "requiresIfExists":
          if (!Array.isArray(modifier.requiresIfExists)) {
            console.error(format$2(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
          }
          break;
        case "options":
        case "data":
          break;
        default:
          console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function (s) {
            return '"' + s + '"';
          }).join(", ") + '; but "' + key + '" was provided.');
      }
      modifier.requires && modifier.requires.forEach(function (requirement) {
        if (modifiers.find(function (mod) {
          return mod.name === requirement;
        }) == null) {
          console.error(format$2(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
        }
      });
    });
  });
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/uniqueBy.js
function uniqueBy(arr, fn2) {
  var identifiers = /* @__PURE__ */new Set();
  return arr.filter(function (item) {
    var identifier = fn2(item);
    if (!identifiers.has(identifier)) {
      identifiers.add(identifier);
      return true;
    }
  });
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/getBasePlacement.js
function getBasePlacement$2(placement) {
  return placement.split("-")[0];
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/mergeByName.js
function mergeByName$1(modifiers) {
  var merged = modifiers.reduce(function (merged2, current) {
    var existing = merged2[current.name];
    merged2[current.name] = existing ? Object.assign({}, existing, current, {
      options: Object.assign({}, existing.options, current.options),
      data: Object.assign({}, existing.data, current.data)
    }) : current;
    return merged2;
  }, {});
  return Object.keys(merged).map(function (key) {
    return merged[key];
  });
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/getVariation.js
function getVariation$1(placement) {
  return placement.split("-")[1];
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js
function getMainAxisFromPlacement$1(placement) {
  return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/utils/computeOffsets.js
function computeOffsets$1(_ref) {
  var reference = _ref.reference,
    element = _ref.element,
    placement = _ref.placement;
  var basePlacement = placement ? getBasePlacement$2(placement) : null;
  var variation = placement ? getVariation$1(placement) : null;
  var commonX = reference.x + reference.width / 2 - element.width / 2;
  var commonY = reference.y + reference.height / 2 - element.height / 2;
  var offsets;
  switch (basePlacement) {
    case top$1:
      offsets = {
        x: commonX,
        y: reference.y - element.height
      };
      break;
    case bottom$1:
      offsets = {
        x: commonX,
        y: reference.y + reference.height
      };
      break;
    case right$1:
      offsets = {
        x: reference.x + reference.width,
        y: commonY
      };
      break;
    case left$1:
      offsets = {
        x: reference.x - element.width,
        y: commonY
      };
      break;
    default:
      offsets = {
        x: reference.x,
        y: reference.y
      };
  }
  var mainAxis = basePlacement ? getMainAxisFromPlacement$1(basePlacement) : null;
  if (mainAxis != null) {
    var len = mainAxis === "y" ? "height" : "width";
    switch (variation) {
      case start$2:
        offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
        break;
      case end$2:
        offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
        break;
    }
  }
  return offsets;
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/createPopper.js
var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
var DEFAULT_OPTIONS$1 = {
  placement: "bottom",
  modifiers: [],
  strategy: "absolute"
};
function areValidElements$1() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }
  return !args.some(function (element) {
    return !(element && typeof element.getBoundingClientRect === "function");
  });
}
function popperGenerator$1(generatorOptions) {
  if (generatorOptions === void 0) {
    generatorOptions = {};
  }
  var _generatorOptions = generatorOptions,
    _generatorOptions$def = _generatorOptions.defaultModifiers,
    defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
    _generatorOptions$def2 = _generatorOptions.defaultOptions,
    defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS$1 : _generatorOptions$def2;
  return function createPopper2(reference, popper, options) {
    if (options === void 0) {
      options = defaultOptions;
    }
    var state = {
      placement: "bottom",
      orderedModifiers: [],
      options: Object.assign({}, DEFAULT_OPTIONS$1, defaultOptions),
      modifiersData: {},
      elements: {
        reference,
        popper
      },
      attributes: {},
      styles: {}
    };
    var effectCleanupFns = [];
    var isDestroyed = false;
    var instance = {
      state,
      setOptions: function setOptions(setOptionsAction) {
        var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
        cleanupModifierEffects();
        state.options = Object.assign({}, defaultOptions, state.options, options2);
        state.scrollParents = {
          reference: isElement$3(reference) ? listScrollParents$1(reference) : reference.contextElement ? listScrollParents$1(reference.contextElement) : [],
          popper: listScrollParents$1(popper)
        };
        var orderedModifiers = orderModifiers$1(mergeByName$1([].concat(defaultModifiers2, state.options.modifiers)));
        state.orderedModifiers = orderedModifiers.filter(function (m) {
          return m.enabled;
        });
        {
          var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
            var name = _ref.name;
            return name;
          });
          validateModifiers(modifiers);
          if (getBasePlacement$2(state.options.placement) === auto$1) {
            var flipModifier = state.orderedModifiers.find(function (_ref2) {
              var name = _ref2.name;
              return name === "flip";
            });
            if (!flipModifier) {
              console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
            }
          }
          var _getComputedStyle = getComputedStyle$3(popper),
            marginTop = _getComputedStyle.marginTop,
            marginRight = _getComputedStyle.marginRight,
            marginBottom = _getComputedStyle.marginBottom,
            marginLeft = _getComputedStyle.marginLeft;
          if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
            return parseFloat(margin);
          })) {
            console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
          }
        }
        runModifierEffects();
        return instance.update();
      },
      forceUpdate: function forceUpdate() {
        if (isDestroyed) {
          return;
        }
        var _state$elements = state.elements,
          reference2 = _state$elements.reference,
          popper2 = _state$elements.popper;
        if (!areValidElements$1(reference2, popper2)) {
          {
            console.error(INVALID_ELEMENT_ERROR);
          }
          return;
        }
        state.rects = {
          reference: getCompositeRect$1(reference2, getOffsetParent$1(popper2), state.options.strategy === "fixed"),
          popper: getLayoutRect$2(popper2)
        };
        state.reset = false;
        state.placement = state.options.placement;
        state.orderedModifiers.forEach(function (modifier) {
          return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
        });
        var __debug_loops__ = 0;
        for (var index = 0; index < state.orderedModifiers.length; index++) {
          {
            __debug_loops__ += 1;
            if (__debug_loops__ > 100) {
              console.error(INFINITE_LOOP_ERROR);
              break;
            }
          }
          if (state.reset === true) {
            state.reset = false;
            index = -1;
            continue;
          }
          var _state$orderedModifie = state.orderedModifiers[index],
            fn2 = _state$orderedModifie.fn,
            _state$orderedModifie2 = _state$orderedModifie.options,
            _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
            name = _state$orderedModifie.name;
          if (typeof fn2 === "function") {
            state = fn2({
              state,
              options: _options,
              name,
              instance
            }) || state;
          }
        }
      },
      update: debounce$4(function () {
        return new Promise(function (resolve) {
          instance.forceUpdate();
          resolve(state);
        });
      }),
      destroy: function destroy() {
        cleanupModifierEffects();
        isDestroyed = true;
      }
    };
    if (!areValidElements$1(reference, popper)) {
      {
        console.error(INVALID_ELEMENT_ERROR);
      }
      return instance;
    }
    instance.setOptions(options).then(function (state2) {
      if (!isDestroyed && options.onFirstUpdate) {
        options.onFirstUpdate(state2);
      }
    });
    function runModifierEffects() {
      state.orderedModifiers.forEach(function (_ref3) {
        var name = _ref3.name,
          _ref3$options = _ref3.options,
          options2 = _ref3$options === void 0 ? {} : _ref3$options,
          effect3 = _ref3.effect;
        if (typeof effect3 === "function") {
          var cleanupFn = effect3({
            state,
            name,
            instance,
            options: options2
          });
          var noopFn = function noopFn2() {};
          effectCleanupFns.push(cleanupFn || noopFn);
        }
      });
    }
    function cleanupModifierEffects() {
      effectCleanupFns.forEach(function (fn2) {
        return fn2();
      });
      effectCleanupFns = [];
    }
    return instance;
  };
}

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/modifiers/eventListeners.js
var passive$1 = {
  passive: true
};
function effect$3(_ref) {
  var state = _ref.state,
    instance = _ref.instance,
    options = _ref.options;
  var _options$scroll = options.scroll,
    scroll = _options$scroll === void 0 ? true : _options$scroll,
    _options$resize = options.resize,
    resize = _options$resize === void 0 ? true : _options$resize;
  var window2 = getWindow$1(state.elements.popper);
  var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  if (scroll) {
    scrollParents.forEach(function (scrollParent) {
      scrollParent.addEventListener("scroll", instance.update, passive$1);
    });
  }
  if (resize) {
    window2.addEventListener("resize", instance.update, passive$1);
  }
  return function () {
    if (scroll) {
      scrollParents.forEach(function (scrollParent) {
        scrollParent.removeEventListener("scroll", instance.update, passive$1);
      });
    }
    if (resize) {
      window2.removeEventListener("resize", instance.update, passive$1);
    }
  };
}
var eventListeners_default = {
  name: "eventListeners",
  enabled: true,
  phase: "write",
  fn: function fn() {},
  effect: effect$3,
  data: {}
};

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js
function popperOffsets$2(_ref) {
  var state = _ref.state,
    name = _ref.name;
  state.modifiersData[name] = computeOffsets$1({
    reference: state.rects.reference,
    element: state.rects.popper,
    strategy: "absolute",
    placement: state.placement
  });
}
var popperOffsets_default = {
  name: "popperOffsets",
  enabled: true,
  phase: "read",
  fn: popperOffsets$2,
  data: {}
};

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/modifiers/computeStyles.js
var unsetSides$1 = {
  top: "auto",
  right: "auto",
  bottom: "auto",
  left: "auto"
};
function roundOffsetsByDPR$1(_ref) {
  var x = _ref.x,
    y = _ref.y;
  var win = window;
  var dpr = win.devicePixelRatio || 1;
  return {
    x: round$7(x * dpr) / dpr || 0,
    y: round$7(y * dpr) / dpr || 0
  };
}
function mapToStyles$1(_ref2) {
  var _Object$assign2;
  var popper = _ref2.popper,
    popperRect = _ref2.popperRect,
    placement = _ref2.placement,
    variation = _ref2.variation,
    offsets = _ref2.offsets,
    position = _ref2.position,
    gpuAcceleration = _ref2.gpuAcceleration,
    adaptive = _ref2.adaptive,
    roundOffsets = _ref2.roundOffsets,
    isFixed = _ref2.isFixed;
  var _offsets$x = offsets.x,
    x = _offsets$x === void 0 ? 0 : _offsets$x,
    _offsets$y = offsets.y,
    y = _offsets$y === void 0 ? 0 : _offsets$y;
  var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
    x,
    y
  }) : {
    x,
    y
  };
  x = _ref3.x;
  y = _ref3.y;
  var hasX = offsets.hasOwnProperty("x");
  var hasY = offsets.hasOwnProperty("y");
  var sideX = left$1;
  var sideY = top$1;
  var win = window;
  if (adaptive) {
    var offsetParent = getOffsetParent$1(popper);
    var heightProp = "clientHeight";
    var widthProp = "clientWidth";
    if (offsetParent === getWindow$1(popper)) {
      offsetParent = getDocumentElement$1(popper);
      if (getComputedStyle$3(offsetParent).position !== "static" && position === "absolute") {
        heightProp = "scrollHeight";
        widthProp = "scrollWidth";
      }
    }
    offsetParent = offsetParent;
    if (placement === top$1 || (placement === left$1 || placement === right$1) && variation === end$2) {
      sideY = bottom$1;
      var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
      y -= offsetY - popperRect.height;
      y *= gpuAcceleration ? 1 : -1;
    }
    if (placement === left$1 || (placement === top$1 || placement === bottom$1) && variation === end$2) {
      sideX = right$1;
      var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
      x -= offsetX - popperRect.width;
      x *= gpuAcceleration ? 1 : -1;
    }
  }
  var commonStyles = Object.assign({
    position
  }, adaptive && unsetSides$1);
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR$1({
    x,
    y
  }) : {
    x,
    y
  };
  x = _ref4.x;
  y = _ref4.y;
  if (gpuAcceleration) {
    var _Object$assign;
    return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  }
  return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
}
function computeStyles$2(_ref5) {
  var state = _ref5.state,
    options = _ref5.options;
  var _options$gpuAccelerat = options.gpuAcceleration,
    gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
    _options$adaptive = options.adaptive,
    adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
    _options$roundOffsets = options.roundOffsets,
    roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  {
    var transitionProperty = getComputedStyle$3(state.elements.popper).transitionProperty || "";
    if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function (property) {
      return transitionProperty.indexOf(property) >= 0;
    })) {
      console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
    }
  }
  var commonStyles = {
    placement: getBasePlacement$2(state.placement),
    variation: getVariation$1(state.placement),
    popper: state.elements.popper,
    popperRect: state.rects.popper,
    gpuAcceleration,
    isFixed: state.options.strategy === "fixed"
  };
  if (state.modifiersData.popperOffsets != null) {
    state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles$1(Object.assign({}, commonStyles, {
      offsets: state.modifiersData.popperOffsets,
      position: state.options.strategy,
      adaptive,
      roundOffsets
    })));
  }
  if (state.modifiersData.arrow != null) {
    state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles$1(Object.assign({}, commonStyles, {
      offsets: state.modifiersData.arrow,
      position: "absolute",
      adaptive: false,
      roundOffsets
    })));
  }
  state.attributes.popper = Object.assign({}, state.attributes.popper, {
    "data-popper-placement": state.placement
  });
}
var computeStyles_default = {
  name: "computeStyles",
  enabled: true,
  phase: "beforeWrite",
  fn: computeStyles$2,
  data: {}
};

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/modifiers/applyStyles.js
function applyStyles$2(_ref) {
  var state = _ref.state;
  Object.keys(state.elements).forEach(function (name) {
    var style = state.styles[name] || {};
    var attributes = state.attributes[name] || {};
    var element = state.elements[name];
    if (!isHTMLElement$2(element) || !getNodeName$1(element)) {
      return;
    }
    Object.assign(element.style, style);
    Object.keys(attributes).forEach(function (name2) {
      var value = attributes[name2];
      if (value === false) {
        element.removeAttribute(name2);
      } else {
        element.setAttribute(name2, value === true ? "" : value);
      }
    });
  });
}
function effect2(_ref2) {
  var state = _ref2.state;
  var initialStyles = {
    popper: {
      position: state.options.strategy,
      left: "0",
      top: "0",
      margin: "0"
    },
    arrow: {
      position: "absolute"
    },
    reference: {}
  };
  Object.assign(state.elements.popper.style, initialStyles.popper);
  state.styles = initialStyles;
  if (state.elements.arrow) {
    Object.assign(state.elements.arrow.style, initialStyles.arrow);
  }
  return function () {
    Object.keys(state.elements).forEach(function (name) {
      var element = state.elements[name];
      var attributes = state.attributes[name] || {};
      var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
      var style = styleProperties.reduce(function (style2, property) {
        style2[property] = "";
        return style2;
      }, {});
      if (!isHTMLElement$2(element) || !getNodeName$1(element)) {
        return;
      }
      Object.assign(element.style, style);
      Object.keys(attributes).forEach(function (attribute) {
        element.removeAttribute(attribute);
      });
    });
  };
}
var applyStyles_default = {
  name: "applyStyles",
  enabled: true,
  phase: "write",
  fn: applyStyles$2,
  effect: effect2,
  requires: ["computeStyles"]
};

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/popper-lite.js
var defaultModifiers$1 = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default];
var createPopper$1 = /* @__PURE__ */popperGenerator$1({
  defaultModifiers: defaultModifiers$1
});

// ../../node_modules/.pnpm/@popperjs+core@2.11.6/node_modules/@popperjs/core/lib/modifiers/offset.js
function distanceAndSkiddingToXY$1(placement, rects, offset2) {
  var basePlacement = getBasePlacement$2(placement);
  var invertDistance = [left$1, top$1].indexOf(basePlacement) >= 0 ? -1 : 1;
  var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
      placement
    })) : offset2,
    skidding = _ref[0],
    distance = _ref[1];
  skidding = skidding || 0;
  distance = (distance || 0) * invertDistance;
  return [left$1, right$1].indexOf(basePlacement) >= 0 ? {
    x: distance,
    y: skidding
  } : {
    x: skidding,
    y: distance
  };
}
function offset$2(_ref2) {
  var state = _ref2.state,
    options = _ref2.options,
    name = _ref2.name;
  var _options$offset = options.offset,
    offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  var data = placements$1.reduce(function (acc, placement) {
    acc[placement] = distanceAndSkiddingToXY$1(placement, state.rects, offset2);
    return acc;
  }, {});
  var _data$state$placement = data[state.placement],
    x = _data$state$placement.x,
    y = _data$state$placement.y;
  if (state.modifiersData.popperOffsets != null) {
    state.modifiersData.popperOffsets.x += x;
    state.modifiersData.popperOffsets.y += y;
  }
  state.modifiersData[name] = data;
}
var offset_default = {
  name: "offset",
  enabled: true,
  phase: "main",
  requires: ["popperOffsets"],
  fn: offset$2
};

var _createNamespace$r = createNamespace('popover'),
  createComponent$v = _createNamespace$r[0],
  bem$q = _createNamespace$r[1];
var Popover = createComponent$v({
  mixins: [ClickOutsideMixin({
    event: 'touchstart',
    method: 'onClickOutside'
  })],
  props: {
    value: Boolean,
    trigger: String,
    overlay: Boolean,
    offset: {
      type: Array,
      default: function _default() {
        return [0, 8];
      }
    },
    theme: {
      type: String,
      default: 'light'
    },
    actions: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    placement: {
      type: String,
      default: 'bottom'
    },
    getContainer: {
      type: [String, Function],
      default: 'body'
    },
    closeOnClickAction: {
      type: Boolean,
      default: true
    }
  },
  watch: {
    value: 'updateLocation',
    placement: 'updateLocation'
  },
  mounted: function mounted() {
    this.updateLocation();
  },
  beforeDestroy: function beforeDestroy() {
    if (this.popper) {
      if (!isServer$1) {
        window.removeEventListener('animationend', this.updateLocation);
        window.removeEventListener('transitionend', this.updateLocation);
      }
      this.popper.destroy();
      this.popper = null;
    }
  },
  methods: {
    createPopper: function createPopper() {
      var popper = createPopper$1(this.$refs.wrapper, this.$refs.popover.$el, {
        placement: this.placement,
        modifiers: [{
          name: 'computeStyles',
          options: {
            adaptive: false,
            gpuAcceleration: false
          }
        }, _extends$1({}, offset_default, {
          options: {
            offset: this.offset
          }
        })]
      });
      if (!isServer$1) {
        window.addEventListener('animationend', this.updateLocation);
        window.addEventListener('transitionend', this.updateLocation);
      }
      return popper;
    },
    updateLocation: function updateLocation() {
      var _this = this;
      this.$nextTick(function () {
        if (!_this.value) {
          return;
        }
        if (!_this.popper) {
          _this.popper = _this.createPopper();
        } else {
          _this.popper.setOptions({
            placement: _this.placement
          });
        }
      });
    },
    renderAction: function renderAction(action, index) {
      var _this2 = this;
      var h = this.$createElement;
      var icon = action.icon,
        text = action.text,
        disabled = action.disabled,
        className = action.className;
      return h("div", {
        "attrs": {
          "role": "menuitem"
        },
        "class": [bem$q('action', {
          disabled: disabled,
          'with-icon': icon
        }), className],
        "on": {
          "click": function click() {
            return _this2.onClickAction(action, index);
          }
        }
      }, [icon && h(Icon$3, {
        "attrs": {
          "name": icon
        },
        "class": bem$q('action-icon')
      }), h("div", {
        "class": [bem$q('action-text'), BORDER_BOTTOM]
      }, [text])]);
    },
    onToggle: function onToggle(value) {
      this.$emit('input', value);
    },
    onClickWrapper: function onClickWrapper() {
      if (this.trigger === 'click') {
        this.onToggle(!this.value);
      }
    },
    onTouchstart: function onTouchstart(event) {
      event.stopPropagation();
      this.$emit('touchstart', event);
    },
    onClickAction: function onClickAction(action, index) {
      if (action.disabled) {
        return;
      }
      this.$emit('select', action, index);
      if (this.closeOnClickAction) {
        this.$emit('input', false);
      }
    },
    onClickOutside: function onClickOutside() {
      this.$emit('input', false);
    },
    onOpen: function onOpen() {
      this.$emit('open');
    },
    /* istanbul ignore next */
    onOpened: function onOpened() {
      this.$emit('opened');
    },
    onClose: function onClose() {
      this.$emit('close');
    },
    /* istanbul ignore next */
    onClosed: function onClosed() {
      this.$emit('closed');
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("span", {
      "ref": "wrapper",
      "class": bem$q('wrapper'),
      "on": {
        "click": this.onClickWrapper
      }
    }, [h(Popup, {
      "ref": "popover",
      "attrs": {
        "value": this.value,
        "overlay": this.overlay,
        "position": null,
        "transition": "van-popover-zoom",
        "lockScroll": false,
        "getContainer": this.getContainer
      },
      "class": bem$q([this.theme]),
      "on": {
        "open": this.onOpen,
        "close": this.onClose,
        "input": this.onToggle,
        "opened": this.onOpened,
        "closed": this.onClosed
      },
      "nativeOn": {
        "touchstart": this.onTouchstart
      }
    }, [h("div", {
      "class": bem$q('arrow')
    }), h("div", {
      "class": bem$q('content'),
      "attrs": {
        "role": "menu"
      }
    }, [this.slots('default') || this.actions.map(this.renderAction)])]), this.slots('reference')]);
  }
});

var _createNamespace$q = createNamespace('progress'),
  createComponent$u = _createNamespace$q[0],
  bem$p = _createNamespace$q[1];
var Progress = createComponent$u({
  mixins: [BindEventMixin(function (bind) {
    bind(window, 'resize', this.resize, true);
    bind(window, 'orientationchange', this.resize, true);
  })],
  props: {
    color: String,
    inactive: Boolean,
    pivotText: String,
    textColor: String,
    pivotColor: String,
    trackColor: String,
    strokeWidth: [Number, String],
    percentage: {
      type: [Number, String],
      required: true,
      validator: function validator(value) {
        return value >= 0 && value <= 100;
      }
    },
    showPivot: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    return {
      pivotWidth: 0,
      progressWidth: 0
    };
  },
  mounted: function mounted() {
    this.resize();
  },
  watch: {
    showPivot: 'resize',
    pivotText: 'resize'
  },
  methods: {
    // @exposed-api
    resize: function resize() {
      var _this = this;
      this.$nextTick(function () {
        _this.progressWidth = _this.$el.offsetWidth;
        _this.pivotWidth = _this.$refs.pivot ? _this.$refs.pivot.offsetWidth : 0;
      });
    }
  },
  render: function render() {
    var h = arguments[0];
    var pivotText = this.pivotText,
      percentage = this.percentage;
    var text = pivotText != null ? pivotText : percentage + '%';
    var showPivot = this.showPivot && text;
    var background = this.inactive ? '#cacaca' : this.color;
    var pivotStyle = {
      color: this.textColor,
      left: (this.progressWidth - this.pivotWidth) * percentage / 100 + "px",
      background: this.pivotColor || background
    };
    var portionStyle = {
      background: background,
      width: this.progressWidth * percentage / 100 + 'px'
    };
    var wrapperStyle = {
      background: this.trackColor,
      height: addUnit(this.strokeWidth)
    };
    return h("div", {
      "class": bem$p(),
      "style": wrapperStyle
    }, [h("span", {
      "class": bem$p('portion'),
      "style": portionStyle
    }, [showPivot && h("span", {
      "ref": "pivot",
      "style": pivotStyle,
      "class": bem$p('pivot')
    }, [text])])]);
  }
});

// Utils
var _createNamespace$p = createNamespace('pull-refresh'),
  createComponent$t = _createNamespace$p[0],
  bem$o = _createNamespace$p[1],
  t$c = _createNamespace$p[2];
var DEFAULT_HEAD_HEIGHT = 50;
var TEXT_STATUS = ['pulling', 'loosing', 'success'];
var PullRefresh = createComponent$t({
  mixins: [TouchMixin],
  props: {
    disabled: Boolean,
    successText: String,
    pullingText: String,
    loosingText: String,
    loadingText: String,
    pullDistance: [Number, String],
    value: {
      type: Boolean,
      required: true
    },
    successDuration: {
      type: [Number, String],
      default: 500
    },
    animationDuration: {
      type: [Number, String],
      default: 300
    },
    headHeight: {
      type: [Number, String],
      default: DEFAULT_HEAD_HEIGHT
    }
  },
  data: function data() {
    return {
      status: 'normal',
      distance: 0,
      duration: 0
    };
  },
  computed: {
    touchable: function touchable() {
      return this.status !== 'loading' && this.status !== 'success' && !this.disabled;
    },
    headStyle: function headStyle() {
      if (this.headHeight !== DEFAULT_HEAD_HEIGHT) {
        return {
          height: this.headHeight + "px"
        };
      }
    }
  },
  watch: {
    value: function value(loading) {
      this.duration = this.animationDuration;
      if (loading) {
        this.setStatus(+this.headHeight, true);
      } else if (this.slots('success') || this.successText) {
        this.showSuccessTip();
      } else {
        this.setStatus(0, false);
      }
    }
  },
  mounted: function mounted() {
    this.bindTouchEvent(this.$refs.track);
    this.scrollEl = getScroller(this.$el);
  },
  methods: {
    checkPullStart: function checkPullStart(event) {
      this.ceiling = getScrollTop(this.scrollEl) === 0;
      if (this.ceiling) {
        this.duration = 0;
        this.touchStart(event);
      }
    },
    onTouchStart: function onTouchStart(event) {
      if (this.touchable) {
        this.checkPullStart(event);
      }
    },
    onTouchMove: function onTouchMove(event) {
      if (!this.touchable) {
        return;
      }
      if (!this.ceiling) {
        this.checkPullStart(event);
      }
      this.touchMove(event);
      if (this.ceiling && this.deltaY >= 0 && this.direction === 'vertical') {
        preventDefault$1(event);
        this.setStatus(this.ease(this.deltaY));
      }
    },
    onTouchEnd: function onTouchEnd() {
      var _this = this;
      if (this.touchable && this.ceiling && this.deltaY) {
        this.duration = this.animationDuration;
        if (this.status === 'loosing') {
          this.setStatus(+this.headHeight, true);
          this.$emit('input', true); // ensure value change can be watched

          this.$nextTick(function () {
            _this.$emit('refresh');
          });
        } else {
          this.setStatus(0);
        }
      }
    },
    ease: function ease(distance) {
      var pullDistance = +(this.pullDistance || this.headHeight);
      if (distance > pullDistance) {
        if (distance < pullDistance * 2) {
          distance = pullDistance + (distance - pullDistance) / 2;
        } else {
          distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
        }
      }
      return Math.round(distance);
    },
    setStatus: function setStatus(distance, isLoading) {
      var status;
      if (isLoading) {
        status = 'loading';
      } else if (distance === 0) {
        status = 'normal';
      } else {
        status = distance < (this.pullDistance || this.headHeight) ? 'pulling' : 'loosing';
      }
      this.distance = distance;
      if (status !== this.status) {
        this.status = status;
      }
    },
    genStatus: function genStatus() {
      var h = this.$createElement;
      var status = this.status,
        distance = this.distance;
      var slot = this.slots(status, {
        distance: distance
      });
      if (slot) {
        return slot;
      }
      var nodes = [];
      var text = this[status + "Text"] || t$c(status);
      if (TEXT_STATUS.indexOf(status) !== -1) {
        nodes.push(h("div", {
          "class": bem$o('text')
        }, [text]));
      }
      if (status === 'loading') {
        nodes.push(h(Loading$1, {
          "attrs": {
            "size": "16"
          }
        }, [text]));
      }
      return nodes;
    },
    showSuccessTip: function showSuccessTip() {
      var _this2 = this;
      this.status = 'success';
      setTimeout(function () {
        _this2.setStatus(0);
      }, this.successDuration);
    }
  },
  render: function render() {
    var h = arguments[0];
    var trackStyle = {
      transitionDuration: this.duration + "ms",
      transform: this.distance ? "translate3d(0," + this.distance + "px, 0)" : ''
    };
    return h("div", {
      "class": bem$o()
    }, [h("div", {
      "ref": "track",
      "class": bem$o('track'),
      "style": trackStyle
    }, [h("div", {
      "class": bem$o('head'),
      "style": this.headStyle
    }, [this.genStatus()]), this.slots()])]);
  }
});

// Utils
var _createNamespace$o = createNamespace('rate'),
  createComponent$s = _createNamespace$o[0],
  bem$n = _createNamespace$o[1];
function getRateStatus(value, index, allowHalf) {
  if (value >= index) {
    return 'full';
  }
  if (value + 0.5 >= index && allowHalf) {
    return 'half';
  }
  return 'void';
}
var Rate = createComponent$s({
  mixins: [TouchMixin, FieldMixin],
  props: {
    size: [Number, String],
    color: String,
    gutter: [Number, String],
    readonly: Boolean,
    disabled: Boolean,
    allowHalf: Boolean,
    voidColor: String,
    iconPrefix: String,
    disabledColor: String,
    value: {
      type: Number,
      default: 0
    },
    icon: {
      type: String,
      default: 'star'
    },
    voidIcon: {
      type: String,
      default: 'star-o'
    },
    count: {
      type: [Number, String],
      default: 5
    },
    touchable: {
      type: Boolean,
      default: true
    }
  },
  computed: {
    list: function list() {
      var list = [];
      for (var i = 1; i <= this.count; i++) {
        list.push(getRateStatus(this.value, i, this.allowHalf));
      }
      return list;
    },
    sizeWithUnit: function sizeWithUnit() {
      return addUnit(this.size);
    },
    gutterWithUnit: function gutterWithUnit() {
      return addUnit(this.gutter);
    }
  },
  mounted: function mounted() {
    this.bindTouchEvent(this.$el);
  },
  methods: {
    select: function select(index) {
      if (!this.disabled && !this.readonly && index !== this.value) {
        this.$emit('input', index);
        this.$emit('change', index);
      }
    },
    onTouchStart: function onTouchStart(event) {
      var _this = this;
      if (this.readonly || this.disabled || !this.touchable) {
        return;
      }
      this.touchStart(event);
      var rects = this.$refs.items.map(function (item) {
        return item.getBoundingClientRect();
      });
      var ranges = [];
      rects.forEach(function (rect, index) {
        if (_this.allowHalf) {
          ranges.push({
            score: index + 0.5,
            left: rect.left
          }, {
            score: index + 1,
            left: rect.left + rect.width / 2
          });
        } else {
          ranges.push({
            score: index + 1,
            left: rect.left
          });
        }
      });
      this.ranges = ranges;
    },
    onTouchMove: function onTouchMove(event) {
      if (this.readonly || this.disabled || !this.touchable) {
        return;
      }
      this.touchMove(event);
      if (this.direction === 'horizontal') {
        preventDefault$1(event);
        var clientX = event.touches[0].clientX;
        this.select(this.getScoreByPosition(clientX));
      }
    },
    getScoreByPosition: function getScoreByPosition(x) {
      for (var i = this.ranges.length - 1; i > 0; i--) {
        if (x > this.ranges[i].left) {
          return this.ranges[i].score;
        }
      }
      return this.allowHalf ? 0.5 : 1;
    },
    genStar: function genStar(status, index) {
      var _this2 = this;
      var h = this.$createElement;
      var icon = this.icon,
        color = this.color,
        count = this.count,
        voidIcon = this.voidIcon,
        disabled = this.disabled,
        voidColor = this.voidColor,
        disabledColor = this.disabledColor;
      var score = index + 1;
      var isFull = status === 'full';
      var isVoid = status === 'void';
      var style;
      if (this.gutterWithUnit && score !== +count) {
        style = {
          paddingRight: this.gutterWithUnit
        };
      }
      return h("div", {
        "ref": "items",
        "refInFor": true,
        "key": index,
        "attrs": {
          "role": "radio",
          "tabindex": "0",
          "aria-setsize": count,
          "aria-posinset": score,
          "aria-checked": String(!isVoid)
        },
        "style": style,
        "class": bem$n('item')
      }, [h(Icon$3, {
        "attrs": {
          "size": this.sizeWithUnit,
          "name": isFull ? icon : voidIcon,
          "color": disabled ? disabledColor : isFull ? color : voidColor,
          "classPrefix": this.iconPrefix,
          "data-score": score
        },
        "class": bem$n('icon', {
          disabled: disabled,
          full: isFull
        }),
        "on": {
          "click": function click() {
            _this2.select(score);
          }
        }
      }), this.allowHalf && h(Icon$3, {
        "attrs": {
          "size": this.sizeWithUnit,
          "name": isVoid ? voidIcon : icon,
          "color": disabled ? disabledColor : isVoid ? voidColor : color,
          "classPrefix": this.iconPrefix,
          "data-score": score - 0.5
        },
        "class": bem$n('icon', ['half', {
          disabled: disabled,
          full: !isVoid
        }]),
        "on": {
          "click": function click() {
            _this2.select(score - 0.5);
          }
        }
      })]);
    }
  },
  render: function render() {
    var _this3 = this;
    var h = arguments[0];
    return h("div", {
      "class": bem$n({
        readonly: this.readonly,
        disabled: this.disabled
      }),
      "attrs": {
        "tabindex": "0",
        "role": "radiogroup"
      }
    }, [this.list.map(function (status, index) {
      return _this3.genStar(status, index);
    })]);
  }
});

var _createNamespace$n = createNamespace('row'),
  createComponent$r = _createNamespace$n[0],
  bem$m = _createNamespace$n[1];
var Row = createComponent$r({
  mixins: [ParentMixin('vanRow')],
  props: {
    type: String,
    align: String,
    justify: String,
    tag: {
      type: String,
      default: 'div'
    },
    gutter: {
      type: [Number, String],
      default: 0
    }
  },
  computed: {
    spaces: function spaces() {
      var gutter = Number(this.gutter);
      if (!gutter) {
        return;
      }
      var spaces = [];
      var groups = [[]];
      var totalSpan = 0;
      this.children.forEach(function (item, index) {
        totalSpan += Number(item.span);
        if (totalSpan > 24) {
          groups.push([index]);
          totalSpan -= 24;
        } else {
          groups[groups.length - 1].push(index);
        }
      });
      groups.forEach(function (group) {
        var averagePadding = gutter * (group.length - 1) / group.length;
        group.forEach(function (item, index) {
          if (index === 0) {
            spaces.push({
              right: averagePadding
            });
          } else {
            var left = gutter - spaces[item - 1].right;
            var right = averagePadding - left;
            spaces.push({
              left: left,
              right: right
            });
          }
        });
      });
      return spaces;
    }
  },
  methods: {
    onClick: function onClick(event) {
      this.$emit('click', event);
    }
  },
  render: function render() {
    var _bem;
    var h = arguments[0];
    var align = this.align,
      justify = this.justify;
    var flex = this.type === 'flex';
    return h(this.tag, {
      "class": bem$m((_bem = {
        flex: flex
      }, _bem["align-" + align] = flex && align, _bem["justify-" + justify] = flex && justify, _bem)),
      "on": {
        "click": this.onClick
      }
    }, [this.slots()]);
  }
});

var _createNamespace$m = createNamespace('search'),
  createComponent$q = _createNamespace$m[0],
  bem$l = _createNamespace$m[1],
  t$b = _createNamespace$m[2];
function Search(h, props, slots, ctx) {
  function Label() {
    if (slots.label || props.label) {
      return h("div", {
        "class": bem$l('label')
      }, [slots.label ? slots.label() : props.label]);
    }
  }
  function Action() {
    if (!props.showAction) {
      return;
    }
    function onCancel() {
      if (slots.action) {
        return;
      }
      emit(ctx, 'input', '');
      emit(ctx, 'cancel');
    }
    return h("div", {
      "class": bem$l('action'),
      "attrs": {
        "role": "button",
        "tabindex": "0"
      },
      "on": {
        "click": onCancel
      }
    }, [slots.action ? slots.action() : props.actionText || t$b('cancel')]);
  }
  var fieldData = {
    attrs: ctx.data.attrs,
    on: _extends$1({}, ctx.listeners, {
      keypress: function keypress(event) {
        // press enter
        if (event.keyCode === 13) {
          preventDefault$1(event);
          emit(ctx, 'search', props.value);
        }
        emit(ctx, 'keypress', event);
      }
    })
  };
  var inheritData = inherit(ctx);
  inheritData.attrs = undefined;
  return h("div", _mergeJSXProps([{
    "class": bem$l({
      'show-action': props.showAction
    }),
    "style": {
      background: props.background
    }
  }, inheritData]), [slots.left == null ? void 0 : slots.left(), h("div", {
    "class": bem$l('content', props.shape)
  }, [Label(), h(Field, _mergeJSXProps([{
    "attrs": {
      "type": "search",
      "border": false,
      "value": props.value,
      "leftIcon": props.leftIcon,
      "rightIcon": props.rightIcon,
      "clearable": props.clearable,
      "clearTrigger": props.clearTrigger
    },
    "scopedSlots": {
      'left-icon': slots['left-icon'],
      'right-icon': slots['right-icon']
    }
  }, fieldData]))]), Action()]);
}
Search.props = {
  value: String,
  label: String,
  rightIcon: String,
  actionText: String,
  background: String,
  showAction: Boolean,
  clearTrigger: String,
  shape: {
    type: String,
    default: 'square'
  },
  clearable: {
    type: Boolean,
    default: true
  },
  leftIcon: {
    type: String,
    default: 'search'
  }
};
var Search$1 = createComponent$q(Search);

var PRESET_ICONS = ['qq', 'link', 'weibo', 'wechat', 'poster', 'qrcode', 'weapp-qrcode', 'wechat-moments'];
var _createNamespace$l = createNamespace('share-sheet'),
  createComponent$p = _createNamespace$l[0],
  bem$k = _createNamespace$l[1],
  t$a = _createNamespace$l[2];
var ShareSheet = createComponent$p({
  props: _extends$1({}, popupMixinProps, {
    title: String,
    duration: String,
    cancelText: String,
    description: String,
    getContainer: [String, Function],
    options: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    overlay: {
      type: Boolean,
      default: true
    },
    closeOnPopstate: {
      type: Boolean,
      default: true
    },
    safeAreaInsetBottom: {
      type: Boolean,
      default: true
    },
    closeOnClickOverlay: {
      type: Boolean,
      default: true
    }
  }),
  methods: {
    onCancel: function onCancel() {
      this.toggle(false);
      this.$emit('cancel');
    },
    onSelect: function onSelect(option, index) {
      this.$emit('select', option, index);
    },
    toggle: function toggle(val) {
      this.$emit('input', val);
    },
    getIconURL: function getIconURL(icon) {
      if (PRESET_ICONS.indexOf(icon) !== -1) {
        return "https://img01.yzcdn.cn/vant/share-sheet-" + icon + ".png";
      }
      return icon;
    },
    genHeader: function genHeader() {
      var h = this.$createElement;
      var title = this.slots('title') || this.title;
      var description = this.slots('description') || this.description;
      if (!title && !description) {
        return;
      }
      return h("div", {
        "class": bem$k('header')
      }, [title && h("h2", {
        "class": bem$k('title')
      }, [title]), description && h("span", {
        "class": bem$k('description')
      }, [description])]);
    },
    genOptions: function genOptions(options, showBorder) {
      var _this = this;
      var h = this.$createElement;
      return h("div", {
        "class": bem$k('options', {
          border: showBorder
        })
      }, [options.map(function (option, index) {
        return h("div", {
          "attrs": {
            "role": "button",
            "tabindex": "0"
          },
          "class": [bem$k('option'), option.className],
          "on": {
            "click": function click() {
              _this.onSelect(option, index);
            }
          }
        }, [h("img", {
          "attrs": {
            "src": _this.getIconURL(option.icon)
          },
          "class": bem$k('icon')
        }), option.name && h("span", {
          "class": bem$k('name')
        }, [option.name]), option.description && h("span", {
          "class": bem$k('option-description')
        }, [option.description])]);
      })]);
    },
    genRows: function genRows() {
      var _this2 = this;
      var options = this.options;
      if (Array.isArray(options[0])) {
        return options.map(function (item, index) {
          return _this2.genOptions(item, index !== 0);
        });
      }
      return this.genOptions(options);
    },
    genCancelText: function genCancelText() {
      var _this$cancelText;
      var h = this.$createElement;
      var cancelText = (_this$cancelText = this.cancelText) != null ? _this$cancelText : t$a('cancel');
      if (cancelText) {
        return h("button", {
          "attrs": {
            "type": "button"
          },
          "class": bem$k('cancel'),
          "on": {
            "click": this.onCancel
          }
        }, [cancelText]);
      }
    },
    onClickOverlay: function onClickOverlay() {
      this.$emit('click-overlay');
    }
  },
  render: function render() {
    var h = arguments[0];
    return h(Popup, {
      "attrs": {
        "round": true,
        "value": this.value,
        "position": "bottom",
        "overlay": this.overlay,
        "duration": this.duration,
        "lazyRender": this.lazyRender,
        "lockScroll": this.lockScroll,
        "getContainer": this.getContainer,
        "closeOnPopstate": this.closeOnPopstate,
        "closeOnClickOverlay": this.closeOnClickOverlay,
        "safeAreaInsetBottom": this.safeAreaInsetBottom
      },
      "class": bem$k(),
      "on": {
        "input": this.toggle,
        "click-overlay": this.onClickOverlay
      }
    }, [this.genHeader(), this.genRows(), this.genCancelText()]);
  }
});

var _createNamespace$k = createNamespace('sidebar'),
  createComponent$o = _createNamespace$k[0],
  bem$j = _createNamespace$k[1];
var Sidebar = createComponent$o({
  mixins: [ParentMixin('vanSidebar')],
  model: {
    prop: 'activeKey'
  },
  props: {
    activeKey: {
      type: [Number, String],
      default: 0
    }
  },
  data: function data() {
    return {
      index: +this.activeKey
    };
  },
  watch: {
    activeKey: function activeKey() {
      this.setIndex(+this.activeKey);
    }
  },
  methods: {
    setIndex: function setIndex(index) {
      if (index !== this.index) {
        this.index = index;
        this.$emit('change', index);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$j()
    }, [this.slots()]);
  }
});

var _createNamespace$j = createNamespace('sidebar-item'),
  createComponent$n = _createNamespace$j[0],
  bem$i = _createNamespace$j[1];
var SidebarItem = createComponent$n({
  mixins: [ChildrenMixin('vanSidebar')],
  props: _extends$1({}, routeProps, {
    dot: Boolean,
    // @deprecated
    info: [Number, String],
    badge: [Number, String],
    title: String,
    disabled: Boolean
  }),
  computed: {
    select: function select() {
      return this.index === +this.parent.activeKey;
    }
  },
  methods: {
    onClick: function onClick() {
      if (this.disabled) {
        return;
      }
      this.$emit('click', this.index);
      this.parent.$emit('input', this.index);
      this.parent.setIndex(this.index);
      route(this.$router, this);
    }
  },
  render: function render() {
    var _this$slots, _this$badge;
    var h = arguments[0];
    return h("a", {
      "class": bem$i({
        select: this.select,
        disabled: this.disabled
      }),
      "on": {
        "click": this.onClick
      }
    }, [h("div", {
      "class": bem$i('text')
    }, [(_this$slots = this.slots('title')) != null ? _this$slots : this.title, h(Info$1, {
      "attrs": {
        "dot": this.dot,
        "info": (_this$badge = this.badge) != null ? _this$badge : this.info
      },
      "class": bem$i('info')
    })])]);
  }
});

var _createNamespace$i = createNamespace('skeleton'),
  createComponent$m = _createNamespace$i[0],
  bem$h = _createNamespace$i[1];
var DEFAULT_ROW_WIDTH = '100%';
var DEFAULT_LAST_ROW_WIDTH = '60%';
function Skeleton$1(h, props, slots, ctx) {
  if (!props.loading) {
    return slots.default && slots.default();
  }
  function Title() {
    if (props.title) {
      return h("h3", {
        "class": bem$h('title'),
        "style": {
          width: addUnit(props.titleWidth)
        }
      });
    }
  }
  function Rows() {
    var Rows = [];
    var rowWidth = props.rowWidth;
    function getRowWidth(index) {
      if (rowWidth === DEFAULT_ROW_WIDTH && index === +props.row - 1) {
        return DEFAULT_LAST_ROW_WIDTH;
      }
      if (Array.isArray(rowWidth)) {
        return rowWidth[index];
      }
      return rowWidth;
    }
    for (var i = 0; i < props.row; i++) {
      Rows.push(h("div", {
        "class": bem$h('row'),
        "style": {
          width: addUnit(getRowWidth(i))
        }
      }));
    }
    return Rows;
  }
  function Avatar() {
    if (props.avatar) {
      var size = addUnit(props.avatarSize);
      return h("div", {
        "class": bem$h('avatar', props.avatarShape),
        "style": {
          width: size,
          height: size
        }
      });
    }
  }
  return h("div", _mergeJSXProps([{
    "class": bem$h({
      animate: props.animate,
      round: props.round
    })
  }, inherit(ctx)]), [Avatar(), h("div", {
    "class": bem$h('content')
  }, [Title(), Rows()])]);
}
Skeleton$1.props = {
  title: Boolean,
  round: Boolean,
  avatar: Boolean,
  titleWidth: [Number, String],
  avatarSize: [Number, String],
  row: {
    type: [Number, String],
    default: 0
  },
  loading: {
    type: Boolean,
    default: true
  },
  animate: {
    type: Boolean,
    default: true
  },
  avatarShape: {
    type: String,
    default: 'round'
  },
  rowWidth: {
    type: [Number, String, Array],
    default: DEFAULT_ROW_WIDTH
  }
};
var Skeleton$2 = createComponent$m(Skeleton$1);

/**
 * Sku only provide zh-CN lang by default
 */
var lang$1 = {
  'zh-CN': {
    vanSku: {
      select: '请选择',
      selected: '已选',
      selectSku: '请先选择商品规格',
      soldout: '库存不足',
      originPrice: '原价',
      minusTip: '至少选择一件',
      minusStartTip: function minusStartTip(start) {
        return start + "\u4EF6\u8D77\u552E";
      },
      unavailable: '商品已经无法购买啦',
      stock: '剩余',
      stockUnit: '件',
      quotaTip: function quotaTip(quota) {
        return "\u6BCF\u4EBA\u9650\u8D2D" + quota + "\u4EF6";
      },
      quotaUsedTip: function quotaUsedTip(quota, count) {
        return "\u6BCF\u4EBA\u9650\u8D2D" + quota + "\u4EF6\uFF0C\u4F60\u5DF2\u8D2D\u4E70" + count + "\u4EF6";
      }
    },
    vanSkuActions: {
      buy: '立即购买',
      addCart: '加入购物车'
    },
    vanSkuImgUploader: {
      oversize: function oversize(maxSize) {
        return "\u6700\u5927\u53EF\u4E0A\u4F20\u56FE\u7247\u4E3A" + maxSize + "MB\uFF0C\u8BF7\u5C1D\u8BD5\u538B\u7F29\u56FE\u7247\u5C3A\u5BF8";
      },
      fail: '上传失败',
      uploading: '上传中...'
    },
    vanSkuStepper: {
      quotaLimit: function quotaLimit(quota) {
        return "\u9650\u8D2D" + quota + "\u4EF6";
      },
      quotaStart: function quotaStart(start) {
        return start + "\u4EF6\u8D77\u552E";
      },
      comma: '，',
      num: '购买数量'
    },
    vanSkuMessages: {
      fill: '请填写',
      upload: '请上传',
      imageLabel: '仅限一张',
      invalid: {
        tel: '请填写正确的数字格式留言',
        mobile: '手机号长度为6-20位数字',
        email: '请填写正确的邮箱',
        id_no: '请填写正确的身份证号码'
      },
      placeholder: {
        id_no: '请填写身份证号',
        text: '请填写留言',
        tel: '请填写数字',
        email: '请填写邮箱',
        date: '请选择日期',
        time: '请选择时间',
        textarea: '请填写留言',
        mobile: '请填写手机号'
      }
    },
    vanSkuRow: {
      multiple: '可多选'
    },
    vanSkuDatetimeField: {
      title: {
        date: '选择年月日',
        time: '选择时间',
        datetime: '选择日期时间'
      },
      format: {
        year: '年',
        month: '月',
        day: '日',
        hour: '时',
        minute: '分'
      }
    }
  }
};

var LIMIT_TYPE = {
  QUOTA_LIMIT: 0,
  STOCK_LIMIT: 1
};
var UNSELECTED_SKU_VALUE_ID = '';
var constants = {
  LIMIT_TYPE: LIMIT_TYPE,
  UNSELECTED_SKU_VALUE_ID: UNSELECTED_SKU_VALUE_ID
};

/*
  normalize sku tree

  [
    {
      count: 2,
      k: "品种", // 规格名称 skuKeyName
      k_id: "1200", // skuKeyId
      k_s: "s1" // skuKeyStr
      v: [ // skuValues
        { // skuValue
          id: "1201", // skuValueId
          name: "萌" // 具体的规格值 skuValueName
        }, {
          id: "973",
          name: "帅"
        }
      ]
    },
    ...
  ]
                |
                v
  {
    s1: [{
      id: "1201",
      name: "萌"
    }, {
      id: "973",
      name: "帅"
    }],
    ...
  }
 */

var normalizeSkuTree = function normalizeSkuTree(skuTree) {
  var normalizedTree = {};
  skuTree.forEach(function (treeItem) {
    normalizedTree[treeItem.k_s] = treeItem.v;
  });
  return normalizedTree;
};
var normalizePropList = function normalizePropList(propList) {
  var normalizedProp = {};
  propList.forEach(function (item) {
    var itemObj = {};
    item.v.forEach(function (it) {
      itemObj[it.id] = it;
    });
    normalizedProp[item.k_id] = itemObj;
  });
  return normalizedProp;
}; // 判断是否所有的sku都已经选中

var isAllSelected = function isAllSelected(skuTree, selectedSku) {
  // 筛选selectedSku对象中key值不为空的值
  var selected = Object.keys(selectedSku).filter(function (skuKeyStr) {
    return selectedSku[skuKeyStr] !== UNSELECTED_SKU_VALUE_ID;
  });
  return skuTree.length === selected.length;
}; // 根据已选择的 sku 获取 skuComb

var getSkuComb = function getSkuComb(skuList, selectedSku) {
  var skuComb = skuList.filter(function (item) {
    return Object.keys(selectedSku).every(function (skuKeyStr) {
      return String(item[skuKeyStr]) === String(selectedSku[skuKeyStr]);
    });
  });
  return skuComb[0];
}; // 获取已选择的sku名称

var getSelectedSkuValues = function getSelectedSkuValues(skuTree, selectedSku) {
  var normalizedTree = normalizeSkuTree(skuTree);
  return Object.keys(selectedSku).reduce(function (selectedValues, skuKeyStr) {
    var skuValues = normalizedTree[skuKeyStr] || [];
    var skuValueId = selectedSku[skuKeyStr];
    if (skuValueId !== UNSELECTED_SKU_VALUE_ID && skuValues.length > 0) {
      var skuValue = skuValues.filter(function (value) {
        return value.id === skuValueId;
      })[0];
      skuValue && selectedValues.push(skuValue);
    }
    return selectedValues;
  }, []);
}; // 判断sku是否可选

var isSkuChoosable = function isSkuChoosable(skuList, selectedSku, skuToChoose) {
  var _extends2;
  var key = skuToChoose.key,
    valueId = skuToChoose.valueId; // 先假设sku已选中，拼入已选中sku对象中

  var matchedSku = _extends$1({}, selectedSku, (_extends2 = {}, _extends2[key] = valueId, _extends2)); // 再判断剩余sku是否全部不可选，若不可选则当前sku不可选中

  var skusToCheck = Object.keys(matchedSku).filter(function (skuKey) {
    return matchedSku[skuKey] !== UNSELECTED_SKU_VALUE_ID;
  });
  var filteredSku = skuList.filter(function (sku) {
    return skusToCheck.every(function (skuKey) {
      return String(matchedSku[skuKey]) === String(sku[skuKey]);
    });
  });
  var stock = filteredSku.reduce(function (total, sku) {
    total += sku.stock_num;
    return total;
  }, 0);
  return stock > 0;
};
var getSelectedPropValues = function getSelectedPropValues(propList, selectedProp) {
  var normalizeProp = normalizePropList(propList);
  return Object.keys(selectedProp).reduce(function (acc, cur) {
    selectedProp[cur].forEach(function (it) {
      acc.push(_extends$1({}, normalizeProp[cur][it]));
    });
    return acc;
  }, []);
};
var getSelectedProperties = function getSelectedProperties(propList, selectedProp) {
  var list = [];
  (propList || []).forEach(function (prop) {
    if (selectedProp[prop.k_id] && selectedProp[prop.k_id].length > 0) {
      var v = [];
      prop.v.forEach(function (it) {
        if (selectedProp[prop.k_id].indexOf(it.id) > -1) {
          v.push(_extends$1({}, it));
        }
      });
      list.push(_extends$1({}, prop, {
        v: v
      }));
    }
  });
  return list;
};
var skuHelper = {
  normalizeSkuTree: normalizeSkuTree,
  getSkuComb: getSkuComb,
  getSelectedSkuValues: getSelectedSkuValues,
  isAllSelected: isAllSelected,
  isSkuChoosable: isSkuChoosable,
  getSelectedPropValues: getSelectedPropValues,
  getSelectedProperties: getSelectedProperties
};

var _createNamespace$h = createNamespace('sku-header'),
  createComponent$l = _createNamespace$h[0],
  bem$g = _createNamespace$h[1];
function getSkuImgValue(sku, selectedSku) {
  var imgValue;
  sku.tree.some(function (item) {
    var id = selectedSku[item.k_s];
    if (id && item.v) {
      var matchedSku = item.v.filter(function (skuValue) {
        return skuValue.id === id;
      })[0] || {};
      var img = matchedSku.previewImgUrl || matchedSku.imgUrl || matchedSku.img_url;
      if (img) {
        imgValue = _extends$1({}, matchedSku, {
          ks: item.k_s,
          imgUrl: img
        });
        return true;
      }
    }
    return false;
  });
  return imgValue;
}
function SkuHeader$1(h, props, slots, ctx) {
  var _slots$skuHeaderIma;
  var sku = props.sku,
    goods = props.goods,
    skuEventBus = props.skuEventBus,
    selectedSku = props.selectedSku,
    _props$showHeaderImag = props.showHeaderImage,
    showHeaderImage = _props$showHeaderImag === void 0 ? true : _props$showHeaderImag;
  var selectedValue = getSkuImgValue(sku, selectedSku);
  var imgUrl = selectedValue ? selectedValue.imgUrl : goods.picture;
  var previewImage = function previewImage() {
    skuEventBus.$emit('sku:previewImage', selectedValue);
  };
  return h("div", _mergeJSXProps([{
    "class": [bem$g(), BORDER_BOTTOM]
  }, inherit(ctx)]), [showHeaderImage && h(Image$1, {
    "attrs": {
      "fit": "cover",
      "src": imgUrl
    },
    "class": bem$g('img-wrap'),
    "on": {
      "click": previewImage
    }
  }, [(_slots$skuHeaderIma = slots['sku-header-image-extra']) == null ? void 0 : _slots$skuHeaderIma.call(slots)]), h("div", {
    "class": bem$g('goods-info')
  }, [slots.default == null ? void 0 : slots.default()])]);
}
SkuHeader$1.props = {
  sku: Object,
  goods: Object,
  skuEventBus: Object,
  selectedSku: Object,
  showHeaderImage: Boolean
};
var SkuHeader$2 = createComponent$l(SkuHeader$1);

var _createNamespace$g = createNamespace('sku-header-item'),
  createComponent$k = _createNamespace$g[0],
  bem$f = _createNamespace$g[1];
function SkuHeader(h, props, slots, ctx) {
  return h("div", _mergeJSXProps([{
    "class": bem$f()
  }, inherit(ctx)]), [slots.default && slots.default()]);
}
var SkuHeaderItem = createComponent$k(SkuHeader);

// Utils
var _createNamespace$f = createNamespace('sku-row'),
  createComponent$j = _createNamespace$f[0],
  bem$e = _createNamespace$f[1],
  t$9 = _createNamespace$f[2];
var SkuRow = createComponent$j({
  mixins: [ParentMixin('vanSkuRows'), BindEventMixin(function (bind) {
    if (this.scrollable && this.$refs.scroller) {
      bind(this.$refs.scroller, 'scroll', this.onScroll);
    }
  })],
  props: {
    skuRow: Object
  },
  data: function data() {
    return {
      progress: 0
    };
  },
  computed: {
    scrollable: function scrollable() {
      return this.skuRow.largeImageMode && this.skuRow.v.length > 6;
    }
  },
  methods: {
    onScroll: function onScroll() {
      var _this$$refs = this.$refs,
        scroller = _this$$refs.scroller,
        row = _this$$refs.row;
      var distance = row.offsetWidth - scroller.offsetWidth;
      this.progress = scroller.scrollLeft / distance;
    },
    genTitle: function genTitle() {
      var h = this.$createElement;
      return h("div", {
        "class": bem$e('title')
      }, [this.skuRow.k, this.skuRow.is_multiple && h("span", {
        "class": bem$e('title-multiple')
      }, ["\uFF08", t$9('multiple'), "\uFF09"])]);
    },
    genIndicator: function genIndicator() {
      var h = this.$createElement;
      if (this.scrollable) {
        var style = {
          transform: "translate3d(" + this.progress * 20 + "px, 0, 0)"
        };
        return h("div", {
          "class": bem$e('indicator-wrapper')
        }, [h("div", {
          "class": bem$e('indicator')
        }, [h("div", {
          "class": bem$e('indicator-slider'),
          "style": style
        })])]);
      }
    },
    genContent: function genContent() {
      var h = this.$createElement;
      var nodes = this.slots();
      if (this.skuRow.largeImageMode) {
        var top = [];
        var bottom = [];
        nodes.forEach(function (node, index) {
          var group = Math.floor(index / 3) % 2 === 0 ? top : bottom;
          group.push(node);
        });
        return h("div", {
          "class": bem$e('scroller'),
          "ref": "scroller"
        }, [h("div", {
          "class": bem$e('row'),
          "ref": "row"
        }, [top]), bottom.length ? h("div", {
          "class": bem$e('row')
        }, [bottom]) : null]);
      }
      return nodes;
    },
    centerItem: function centerItem(selectSkuId) {
      if (!this.skuRow.largeImageMode || !selectSkuId) {
        return;
      }
      var _this$children = this.children,
        children = _this$children === void 0 ? [] : _this$children;
      var _this$$refs2 = this.$refs,
        scroller = _this$$refs2.scroller,
        row = _this$$refs2.row;
      var child = children.find(function (it) {
        return +it.skuValue.id === +selectSkuId;
      });
      if (scroller && row && child && child.$el) {
        var target = child.$el;
        var to = target.offsetLeft - (scroller.offsetWidth - target.offsetWidth) / 2;
        scroller.scrollLeft = to;
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": [bem$e(), BORDER_BOTTOM]
    }, [this.genTitle(), this.genContent(), this.genIndicator()]);
  }
});

var _createNamespace$e = createNamespace('sku-row-item'),
  createComponent$i = _createNamespace$e[0];
var SkuRowItem = createComponent$i({
  mixins: [ChildrenMixin('vanSkuRows')],
  props: {
    lazyLoad: Boolean,
    skuValue: Object,
    skuKeyStr: String,
    skuEventBus: Object,
    selectedSku: Object,
    largeImageMode: Boolean,
    disableSoldoutSku: Boolean,
    skuList: {
      type: Array,
      default: function _default() {
        return [];
      }
    }
  },
  computed: {
    imgUrl: function imgUrl() {
      var url = this.skuValue.imgUrl || this.skuValue.img_url;
      return this.largeImageMode ? url || 'https://img01.yzcdn.cn/upload_files/2020/06/24/FmKWDg0bN9rMcTp9ne8MXiQWGtLn.png' : url;
    },
    choosable: function choosable() {
      if (!this.disableSoldoutSku) {
        return true;
      }
      return isSkuChoosable(this.skuList, this.selectedSku, {
        key: this.skuKeyStr,
        valueId: this.skuValue.id
      });
    }
  },
  methods: {
    onSelect: function onSelect() {
      if (this.choosable) {
        this.skuEventBus.$emit('sku:select', _extends$1({}, this.skuValue, {
          skuKeyStr: this.skuKeyStr
        }));
      }
    },
    onPreviewImg: function onPreviewImg(event) {
      event.stopPropagation();
      var skuValue = this.skuValue,
        skuKeyStr = this.skuKeyStr;
      this.skuEventBus.$emit('sku:previewImage', _extends$1({}, skuValue, {
        ks: skuKeyStr,
        imgUrl: skuValue.imgUrl || skuValue.img_url
      }));
    },
    genImage: function genImage(classPrefix) {
      var h = this.$createElement;
      if (this.imgUrl) {
        return h(Image$1, {
          "attrs": {
            "fit": "cover",
            "src": this.imgUrl,
            "lazyLoad": this.lazyLoad
          },
          "class": classPrefix + "-img"
        });
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    var choosed = this.skuValue.id === this.selectedSku[this.skuKeyStr];
    var classPrefix = this.largeImageMode ? bem$e('image-item') : bem$e('item');
    return h("span", {
      "class": [classPrefix, choosed ? classPrefix + "--active" : '', !this.choosable ? classPrefix + "--disabled" : ''],
      "on": {
        "click": this.onSelect
      }
    }, [this.genImage(classPrefix), h("div", {
      "class": classPrefix + "-name"
    }, [this.largeImageMode ? h("span", {
      "class": {
        'van-multi-ellipsis--l2': this.largeImageMode
      }
    }, [this.skuValue.name]) : this.skuValue.name]), this.largeImageMode && h(Icon$3, {
      "attrs": {
        "name": "enlarge"
      },
      "class": classPrefix + "-img-icon",
      "on": {
        "click": this.onPreviewImg
      }
    })]);
  }
});

var _createNamespace$d = createNamespace('sku-row-prop-item'),
  createComponent$h = _createNamespace$d[0];
var SkuRowPropItem = createComponent$h({
  props: {
    skuValue: Object,
    skuKeyStr: String,
    skuEventBus: Object,
    selectedProp: Object,
    multiple: Boolean,
    disabled: Boolean
  },
  computed: {
    choosed: function choosed() {
      var selectedProp = this.selectedProp,
        skuKeyStr = this.skuKeyStr,
        skuValue = this.skuValue;
      if (selectedProp && selectedProp[skuKeyStr]) {
        return selectedProp[skuKeyStr].indexOf(skuValue.id) > -1;
      }
      return false;
    }
  },
  methods: {
    onSelect: function onSelect() {
      if (this.disabled) return;
      this.skuEventBus.$emit('sku:propSelect', _extends$1({}, this.skuValue, {
        skuKeyStr: this.skuKeyStr,
        multiple: this.multiple
      }));
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("span", {
      "class": ['van-sku-row__item', {
        'van-sku-row__item--active': this.choosed
      }, {
        'van-sku-row__item--disabled': this.disabled
      }],
      "on": {
        "click": this.onSelect
      }
    }, [h("span", {
      "class": "van-sku-row__item-name"
    }, [this.skuValue.name])]);
  }
});

var _createNamespace$c = createNamespace('stepper'),
  createComponent$g = _createNamespace$c[0],
  bem$d = _createNamespace$c[1];
var LONG_PRESS_START_TIME = 600;
var LONG_PRESS_INTERVAL = 200;
function equal$1(value1, value2) {
  return String(value1) === String(value2);
}
var Stepper = createComponent$g({
  mixins: [FieldMixin],
  props: {
    value: null,
    theme: String,
    integer: Boolean,
    disabled: Boolean,
    allowEmpty: Boolean,
    inputWidth: [Number, String],
    buttonSize: [Number, String],
    asyncChange: Boolean,
    placeholder: String,
    disablePlus: Boolean,
    disableMinus: Boolean,
    disableInput: Boolean,
    decimalLength: [Number, String],
    name: {
      type: [Number, String],
      default: ''
    },
    min: {
      type: [Number, String],
      default: 1
    },
    max: {
      type: [Number, String],
      default: Infinity
    },
    step: {
      type: [Number, String],
      default: 1
    },
    defaultValue: {
      type: [Number, String],
      default: 1
    },
    showPlus: {
      type: Boolean,
      default: true
    },
    showMinus: {
      type: Boolean,
      default: true
    },
    showInput: {
      type: Boolean,
      default: true
    },
    longPress: {
      type: Boolean,
      default: true
    }
  },
  data: function data() {
    var _this$value;
    var defaultValue = (_this$value = this.value) != null ? _this$value : this.defaultValue;
    var value = this.format(defaultValue);
    if (!equal$1(value, this.value)) {
      this.$emit('input', value);
    }
    return {
      currentValue: value
    };
  },
  computed: {
    minusDisabled: function minusDisabled() {
      return this.disabled || this.disableMinus || this.currentValue <= +this.min;
    },
    plusDisabled: function plusDisabled() {
      return this.disabled || this.disablePlus || this.currentValue >= +this.max;
    },
    inputStyle: function inputStyle() {
      var style = {};
      if (this.inputWidth) {
        style.width = addUnit(this.inputWidth);
      }
      if (this.buttonSize) {
        style.height = addUnit(this.buttonSize);
      }
      return style;
    },
    buttonStyle: function buttonStyle() {
      if (this.buttonSize) {
        var size = addUnit(this.buttonSize);
        return {
          width: size,
          height: size
        };
      }
    }
  },
  watch: {
    max: 'check',
    min: 'check',
    integer: 'check',
    decimalLength: 'check',
    value: function value(val) {
      if (!equal$1(val, this.currentValue)) {
        this.currentValue = this.format(val);
      }
    },
    currentValue: function currentValue(val) {
      this.$emit('input', val);
      this.$emit('change', val, {
        name: this.name
      });
    }
  },
  methods: {
    check: function check() {
      var val = this.format(this.currentValue);
      if (!equal$1(val, this.currentValue)) {
        this.currentValue = val;
      }
    },
    // formatNumber illegal characters
    formatNumber: function formatNumber$1(value) {
      return formatNumber(String(value), !this.integer);
    },
    format: function format(value) {
      if (this.allowEmpty && value === '') {
        return value;
      }
      value = this.formatNumber(value); // format range

      value = value === '' ? 0 : +value;
      value = isNaN$1(value) ? this.min : value;
      value = Math.max(Math.min(this.max, value), this.min); // format decimal

      if (isDef$1(this.decimalLength)) {
        value = value.toFixed(this.decimalLength);
      }
      return value;
    },
    onInput: function onInput(event) {
      var value = event.target.value;
      var formatted = this.formatNumber(value); // limit max decimal length

      if (isDef$1(this.decimalLength) && formatted.indexOf('.') !== -1) {
        var pair = formatted.split('.');
        formatted = pair[0] + "." + pair[1].slice(0, this.decimalLength);
      }
      if (!equal$1(value, formatted)) {
        event.target.value = formatted;
      } // prefer number type

      if (formatted === String(+formatted)) {
        formatted = +formatted;
      }
      this.emitChange(formatted);
    },
    emitChange: function emitChange(value) {
      if (this.asyncChange) {
        this.$emit('input', value);
        this.$emit('change', value, {
          name: this.name
        });
      } else {
        this.currentValue = value;
      }
    },
    onChange: function onChange() {
      var type = this.type;
      if (this[type + "Disabled"]) {
        this.$emit('overlimit', type);
        return;
      }
      var diff = type === 'minus' ? -this.step : +this.step;
      var value = this.format(addNumber(+this.currentValue, diff));
      this.emitChange(value);
      this.$emit(type);
    },
    onFocus: function onFocus(event) {
      // readonly not work in legacy mobile safari
      if (this.disableInput && this.$refs.input) {
        this.$refs.input.blur();
      } else {
        this.$emit('focus', event);
      }
    },
    onBlur: function onBlur(event) {
      var value = this.format(event.target.value);
      event.target.value = value;
      this.emitChange(value);
      this.$emit('blur', event);
      resetScroll();
    },
    longPressStep: function longPressStep() {
      var _this = this;
      this.longPressTimer = setTimeout(function () {
        _this.onChange();
        _this.longPressStep(_this.type);
      }, LONG_PRESS_INTERVAL);
    },
    onTouchStart: function onTouchStart() {
      var _this2 = this;
      if (!this.longPress) {
        return;
      }
      clearTimeout(this.longPressTimer);
      this.isLongPress = false;
      this.longPressTimer = setTimeout(function () {
        _this2.isLongPress = true;
        _this2.onChange();
        _this2.longPressStep();
      }, LONG_PRESS_START_TIME);
    },
    onTouchEnd: function onTouchEnd(event) {
      if (!this.longPress) {
        return;
      }
      clearTimeout(this.longPressTimer);
      if (this.isLongPress) {
        preventDefault$1(event);
      }
    },
    onMousedown: function onMousedown(event) {
      // fix mobile safari page scroll down issue
      // see: https://github.com/vant-ui/vant/issues/7690
      if (this.disableInput) {
        event.preventDefault();
      }
    }
  },
  render: function render() {
    var _this3 = this;
    var h = arguments[0];
    var createListeners = function createListeners(type) {
      return {
        on: {
          click: function click(e) {
            // disable double tap scrolling on mobile safari
            e.preventDefault();
            _this3.type = type;
            _this3.onChange();
          },
          touchstart: function touchstart() {
            _this3.type = type;
            _this3.onTouchStart();
          },
          touchend: _this3.onTouchEnd,
          touchcancel: _this3.onTouchEnd
        }
      };
    };
    return h("div", {
      "class": bem$d([this.theme])
    }, [h("button", _mergeJSXProps([{
      "directives": [{
        name: "show",
        value: this.showMinus
      }],
      "attrs": {
        "type": "button"
      },
      "style": this.buttonStyle,
      "class": bem$d('minus', {
        disabled: this.minusDisabled
      })
    }, createListeners('minus')])), h("input", {
      "directives": [{
        name: "show",
        value: this.showInput
      }],
      "ref": "input",
      "attrs": {
        "type": this.integer ? 'tel' : 'text',
        "role": "spinbutton",
        "disabled": this.disabled,
        "readonly": this.disableInput,
        "inputmode": this.integer ? 'numeric' : 'decimal',
        "placeholder": this.placeholder,
        "aria-valuemax": this.max,
        "aria-valuemin": this.min,
        "aria-valuenow": this.currentValue
      },
      "class": bem$d('input'),
      "domProps": {
        "value": this.currentValue
      },
      "style": this.inputStyle,
      "on": {
        "input": this.onInput,
        "focus": this.onFocus,
        "blur": this.onBlur,
        "mousedown": this.onMousedown
      }
    }), h("button", _mergeJSXProps([{
      "directives": [{
        name: "show",
        value: this.showPlus
      }],
      "attrs": {
        "type": "button"
      },
      "style": this.buttonStyle,
      "class": bem$d('plus', {
        disabled: this.plusDisabled
      })
    }, createListeners('plus')]))]);
  }
});

var namespace$3 = createNamespace('sku-stepper');
var createComponent$f = namespace$3[0];
var t$8 = namespace$3[2];
var QUOTA_LIMIT$1 = LIMIT_TYPE.QUOTA_LIMIT,
  STOCK_LIMIT = LIMIT_TYPE.STOCK_LIMIT;
var SkuStepper = createComponent$f({
  props: {
    stock: Number,
    skuEventBus: Object,
    skuStockNum: Number,
    selectedNum: Number,
    stepperTitle: String,
    disableStepperInput: Boolean,
    customStepperConfig: Object,
    hideQuotaText: Boolean,
    quota: {
      type: Number,
      default: 0
    },
    quotaUsed: {
      type: Number,
      default: 0
    },
    startSaleNum: {
      type: Number,
      default: 1
    }
  },
  data: function data() {
    return {
      currentNum: this.selectedNum,
      // 购买限制类型: 限购/库存
      limitType: STOCK_LIMIT
    };
  },
  watch: {
    currentNum: function currentNum(num) {
      var intValue = parseInt(num, 10);
      if (intValue >= this.stepperMinLimit && intValue <= this.stepperLimit) {
        this.skuEventBus.$emit('sku:numChange', intValue);
      }
    },
    stepperLimit: function stepperLimit(limit) {
      if (limit < this.currentNum && this.stepperMinLimit <= limit) {
        this.currentNum = limit;
      }
      this.checkState(this.stepperMinLimit, limit);
    },
    stepperMinLimit: function stepperMinLimit(start) {
      if (start > this.currentNum || start > this.stepperLimit) {
        this.currentNum = start;
      }
      this.checkState(start, this.stepperLimit);
    }
  },
  computed: {
    stepperLimit: function stepperLimit() {
      var quotaLimit = this.quota - this.quotaUsed;
      var limit; // 无限购时直接取库存，有限购时取限购数和库存数中小的那个

      if (this.quota > 0 && quotaLimit <= this.stock) {
        // 修正负的limit
        limit = quotaLimit < 0 ? 0 : quotaLimit;
        this.limitType = QUOTA_LIMIT$1;
      } else {
        limit = this.stock;
        this.limitType = STOCK_LIMIT;
      }
      return limit;
    },
    stepperMinLimit: function stepperMinLimit() {
      return this.startSaleNum < 1 ? 1 : this.startSaleNum;
    },
    quotaText: function quotaText() {
      var _this$customStepperCo = this.customStepperConfig,
        quotaText = _this$customStepperCo.quotaText,
        hideQuotaText = _this$customStepperCo.hideQuotaText;
      if (hideQuotaText) return '';
      var text = '';
      if (quotaText) {
        text = quotaText;
      } else {
        var textArr = [];
        if (this.startSaleNum > 1) {
          textArr.push(t$8('quotaStart', this.startSaleNum));
        }
        if (this.quota > 0) {
          textArr.push(t$8('quotaLimit', this.quota));
        }
        text = textArr.join(t$8('comma'));
      }
      return text;
    }
  },
  created: function created() {
    this.checkState(this.stepperMinLimit, this.stepperLimit);
  },
  methods: {
    setCurrentNum: function setCurrentNum(num) {
      this.currentNum = num;
      this.checkState(this.stepperMinLimit, this.stepperLimit);
    },
    onOverLimit: function onOverLimit(action) {
      this.skuEventBus.$emit('sku:overLimit', {
        action: action,
        limitType: this.limitType,
        quota: this.quota,
        quotaUsed: this.quotaUsed,
        startSaleNum: this.startSaleNum
      });
    },
    onChange: function onChange(currentValue) {
      var intValue = parseInt(currentValue, 10);
      var handleStepperChange = this.customStepperConfig.handleStepperChange;
      handleStepperChange && handleStepperChange(intValue);
      this.$emit('change', intValue);
    },
    checkState: function checkState(min, max) {
      // 如果选择小于起售，则强制变为起售
      if (this.currentNum < min || min > max) {
        this.currentNum = min;
      } else if (this.currentNum > max) {
        // 当前选择数量大于最大可选时，需要重置已选数量
        this.currentNum = max;
      }
      this.skuEventBus.$emit('sku:stepperState', {
        valid: min <= max,
        min: min,
        max: max,
        limitType: this.limitType,
        quota: this.quota,
        quotaUsed: this.quotaUsed,
        startSaleNum: this.startSaleNum
      });
    }
  },
  render: function render() {
    var _this = this;
    var h = arguments[0];
    return h("div", {
      "class": "van-sku-stepper-stock"
    }, [h("div", {
      "class": "van-sku__stepper-title"
    }, [this.stepperTitle || t$8('num')]), h(Stepper, {
      "attrs": {
        "integer": true,
        "min": this.stepperMinLimit,
        "max": this.stepperLimit,
        "disableInput": this.disableStepperInput
      },
      "class": "van-sku__stepper",
      "on": {
        "overlimit": this.onOverLimit,
        "change": this.onChange
      },
      "model": {
        value: _this.currentNum,
        callback: function callback($$v) {
          _this.currentNum = $$v;
        }
      }
    }), !this.hideQuotaText && this.quotaText && h("span", {
      "class": "van-sku__stepper-quota"
    }, ["(", this.quotaText, ")"])]);
  }
});

/* eslint-disable */
function isEmail(value) {
  var reg = /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/;
  return reg.test(value.trim());
}

function toArray$1(item) {
  if (Array.isArray(item)) {
    return item;
  }
  return [item];
}
function readFile(file, resultType) {
  return new Promise(function (resolve) {
    if (resultType === 'file') {
      resolve(null);
      return;
    }
    var reader = new FileReader();
    reader.onload = function (event) {
      resolve(event.target.result);
    };
    if (resultType === 'dataUrl') {
      reader.readAsDataURL(file);
    } else if (resultType === 'text') {
      reader.readAsText(file);
    }
  });
}
function isOversize(files, maxSize) {
  return toArray$1(files).some(function (file) {
    if (file) {
      if (isFunction$3(maxSize)) {
        return maxSize(file);
      }
      return file.size > maxSize;
    }
    return false;
  });
}
var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
function isImageUrl(url) {
  return IMAGE_REGEXP.test(url);
}
function isImageFile(item) {
  // some special urls cannot be recognized
  // user can add `isImage` flag to mark it as an image url
  if (item.isImage) {
    return true;
  }
  if (item.file && item.file.type) {
    return item.file.type.indexOf('image') === 0;
  }
  if (item.url) {
    return isImageUrl(item.url);
  }
  if (item.content) {
    return item.content.indexOf('data:image') === 0;
  }
  return false;
}

var _createNamespace$b = createNamespace('uploader'),
  createComponent$e = _createNamespace$b[0],
  bem$c = _createNamespace$b[1];
var Uploader = createComponent$e({
  inheritAttrs: false,
  mixins: [FieldMixin],
  model: {
    prop: 'fileList'
  },
  props: {
    disabled: Boolean,
    readonly: Boolean,
    lazyLoad: Boolean,
    uploadText: String,
    afterRead: Function,
    beforeRead: Function,
    beforeDelete: Function,
    previewSize: [Number, String],
    previewOptions: Object,
    name: {
      type: [Number, String],
      default: ''
    },
    accept: {
      type: String,
      default: 'image/*'
    },
    fileList: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    maxSize: {
      type: [Number, String, Function],
      default: Number.MAX_VALUE
    },
    maxCount: {
      type: [Number, String],
      default: Number.MAX_VALUE
    },
    deletable: {
      type: Boolean,
      default: true
    },
    showUpload: {
      type: Boolean,
      default: true
    },
    previewImage: {
      type: Boolean,
      default: true
    },
    previewFullImage: {
      type: Boolean,
      default: true
    },
    imageFit: {
      type: String,
      default: 'cover'
    },
    resultType: {
      type: String,
      default: 'dataUrl'
    },
    uploadIcon: {
      type: String,
      default: 'photograph'
    }
  },
  computed: {
    previewSizeWithUnit: function previewSizeWithUnit() {
      return addUnit(this.previewSize);
    },
    // for form
    value: function value() {
      return this.fileList;
    }
  },
  created: function created() {
    this.urls = [];
  },
  beforeDestroy: function beforeDestroy() {
    this.urls.forEach(function (url) {
      return URL.revokeObjectURL(url);
    });
  },
  methods: {
    getDetail: function getDetail(index) {
      if (index === void 0) {
        index = this.fileList.length;
      }
      return {
        name: this.name,
        index: index
      };
    },
    onChange: function onChange(event) {
      var _this = this;
      var files = event.target.files;
      if (this.disabled || !files.length) {
        return;
      }
      files = files.length === 1 ? files[0] : [].slice.call(files);
      if (this.beforeRead) {
        var response = this.beforeRead(files, this.getDetail());
        if (!response) {
          this.resetInput();
          return;
        }
        if (isPromise$1(response)) {
          response.then(function (data) {
            if (data) {
              _this.readFile(data);
            } else {
              _this.readFile(files);
            }
          }).catch(this.resetInput);
          return;
        }
      }
      this.readFile(files);
    },
    readFile: function readFile$1(files) {
      var _this2 = this;
      var oversize = isOversize(files, this.maxSize);
      if (Array.isArray(files)) {
        var maxCount = this.maxCount - this.fileList.length;
        if (files.length > maxCount) {
          files = files.slice(0, maxCount);
        }
        Promise.all(files.map(function (file) {
          return readFile(file, _this2.resultType);
        })).then(function (contents) {
          var fileList = files.map(function (file, index) {
            var result = {
              file: file,
              status: '',
              message: ''
            };
            if (contents[index]) {
              result.content = contents[index];
            }
            return result;
          });
          _this2.onAfterRead(fileList, oversize);
        });
      } else {
        readFile(files, this.resultType).then(function (content) {
          var result = {
            file: files,
            status: '',
            message: ''
          };
          if (content) {
            result.content = content;
          }
          _this2.onAfterRead(result, oversize);
        });
      }
    },
    onAfterRead: function onAfterRead(files, oversize) {
      var _this3 = this;
      this.resetInput();
      var validFiles = files;
      if (oversize) {
        var oversizeFiles = files;
        if (Array.isArray(files)) {
          oversizeFiles = [];
          validFiles = [];
          files.forEach(function (item) {
            if (item.file) {
              if (isOversize(item.file, _this3.maxSize)) {
                oversizeFiles.push(item);
              } else {
                validFiles.push(item);
              }
            }
          });
        } else {
          validFiles = null;
        }
        this.$emit('oversize', oversizeFiles, this.getDetail());
      }
      var isValidFiles = Array.isArray(validFiles) ? Boolean(validFiles.length) : Boolean(validFiles);
      if (isValidFiles) {
        this.$emit('input', [].concat(this.fileList, toArray$1(validFiles)));
        if (this.afterRead) {
          this.afterRead(validFiles, this.getDetail());
        }
      }
    },
    onDelete: function onDelete(file, index) {
      var _file$beforeDelete,
        _this4 = this;
      var beforeDelete = (_file$beforeDelete = file.beforeDelete) != null ? _file$beforeDelete : this.beforeDelete;
      if (beforeDelete) {
        var response = beforeDelete(file, this.getDetail(index));
        if (!response) {
          return;
        }
        if (isPromise$1(response)) {
          response.then(function () {
            _this4.deleteFile(file, index);
          }).catch(noop$3);
          return;
        }
      }
      this.deleteFile(file, index);
    },
    deleteFile: function deleteFile(file, index) {
      var fileList = this.fileList.slice(0);
      fileList.splice(index, 1);
      this.$emit('input', fileList);
      this.$emit('delete', file, this.getDetail(index));
    },
    resetInput: function resetInput() {
      /* istanbul ignore else */
      if (this.$refs.input) {
        this.$refs.input.value = '';
      }
    },
    onClickUpload: function onClickUpload(event) {
      this.$emit('click-upload', event);
    },
    onPreviewImage: function onPreviewImage(item) {
      var _this5 = this;
      if (!this.previewFullImage) {
        return;
      }
      var imageFiles = this.fileList.filter(function (item) {
        return isImageFile(item);
      });
      var imageContents = imageFiles.map(function (item) {
        if (item.file && !item.url && item.status !== 'failed') {
          item.url = URL.createObjectURL(item.file);
          _this5.urls.push(item.url);
        }
        return item.url;
      });
      this.imagePreview = ImagePreview$1(_extends$1({
        images: imageContents,
        startPosition: imageFiles.indexOf(item),
        onClose: function onClose() {
          _this5.$emit('close-preview');
        }
      }, this.previewOptions));
    },
    // @exposed-api
    closeImagePreview: function closeImagePreview() {
      if (this.imagePreview) {
        this.imagePreview.close();
      }
    },
    // @exposed-api
    chooseFile: function chooseFile() {
      if (this.disabled) {
        return;
      }
      /* istanbul ignore else */

      if (this.$refs.input) {
        this.$refs.input.click();
      }
    },
    genPreviewMask: function genPreviewMask(item) {
      var h = this.$createElement;
      var status = item.status,
        message = item.message;
      if (status === 'uploading' || status === 'failed') {
        var MaskIcon = status === 'failed' ? h(Icon$3, {
          "attrs": {
            "name": "close"
          },
          "class": bem$c('mask-icon')
        }) : h(Loading$1, {
          "class": bem$c('loading')
        });
        var showMessage = isDef$1(message) && message !== '';
        return h("div", {
          "class": bem$c('mask')
        }, [MaskIcon, showMessage && h("div", {
          "class": bem$c('mask-message')
        }, [message])]);
      }
    },
    genPreviewItem: function genPreviewItem(item, index) {
      var _item$deletable,
        _this6 = this,
        _item$previewSize,
        _item$imageFit;
      var h = this.$createElement;
      var deleteAble = (_item$deletable = item.deletable) != null ? _item$deletable : this.deletable;
      var showDelete = item.status !== 'uploading' && deleteAble;
      var DeleteIcon = showDelete && h("div", {
        "class": bem$c('preview-delete'),
        "on": {
          "click": function click(event) {
            event.stopPropagation();
            _this6.onDelete(item, index);
          }
        }
      }, [h(Icon$3, {
        "attrs": {
          "name": "cross"
        },
        "class": bem$c('preview-delete-icon')
      })]);
      var PreviewCoverContent = this.slots('preview-cover', _extends$1({
        index: index
      }, item));
      var PreviewCover = PreviewCoverContent && h("div", {
        "class": bem$c('preview-cover')
      }, [PreviewCoverContent]);
      var previewSize = (_item$previewSize = item.previewSize) != null ? _item$previewSize : this.previewSize;
      var imageFit = (_item$imageFit = item.imageFit) != null ? _item$imageFit : this.imageFit;
      var Preview = isImageFile(item) ? h(Image$1, {
        "attrs": {
          "fit": imageFit,
          "src": item.content || item.url,
          "width": previewSize,
          "height": previewSize,
          "lazyLoad": this.lazyLoad
        },
        "class": bem$c('preview-image'),
        "on": {
          "click": function click() {
            _this6.onPreviewImage(item);
          }
        }
      }, [PreviewCover]) : h("div", {
        "class": bem$c('file'),
        "style": {
          width: this.previewSizeWithUnit,
          height: this.previewSizeWithUnit
        }
      }, [h(Icon$3, {
        "class": bem$c('file-icon'),
        "attrs": {
          "name": "description"
        }
      }), h("div", {
        "class": [bem$c('file-name'), 'van-ellipsis']
      }, [item.file ? item.file.name : item.url]), PreviewCover]);
      return h("div", {
        "class": bem$c('preview'),
        "on": {
          "click": function click() {
            _this6.$emit('click-preview', item, _this6.getDetail(index));
          }
        }
      }, [Preview, this.genPreviewMask(item), DeleteIcon]);
    },
    genPreviewList: function genPreviewList() {
      if (this.previewImage) {
        return this.fileList.map(this.genPreviewItem);
      }
    },
    genUpload: function genUpload() {
      var h = this.$createElement;
      if (this.fileList.length >= this.maxCount) {
        return;
      }
      var slot = this.slots();
      var Input = this.readonly ? null : h("input", {
        "attrs": _extends$1({}, this.$attrs, {
          "type": "file",
          "accept": this.accept,
          "disabled": this.disabled
        }),
        "ref": "input",
        "class": bem$c('input'),
        "on": {
          "change": this.onChange
        }
      });
      if (slot) {
        return h("div", {
          "class": bem$c('input-wrapper'),
          "key": "input-wrapper",
          "on": {
            "click": this.onClickUpload
          }
        }, [slot, Input]);
      }
      var style;
      if (this.previewSize) {
        var size = this.previewSizeWithUnit;
        style = {
          width: size,
          height: size
        };
      }
      return h("div", {
        "directives": [{
          name: "show",
          value: this.showUpload
        }],
        "class": bem$c('upload', {
          readonly: this.readonly
        }),
        "style": style,
        "on": {
          "click": this.onClickUpload
        }
      }, [h(Icon$3, {
        "attrs": {
          "name": this.uploadIcon
        },
        "class": bem$c('upload-icon')
      }), this.uploadText && h("span", {
        "class": bem$c('upload-text')
      }, [this.uploadText]), Input]);
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$c()
    }, [h("div", {
      "class": bem$c('wrapper', {
        disabled: this.disabled
      })
    }, [this.genPreviewList(), this.genUpload()])]);
  }
});

// Utils
var namespace$2 = createNamespace('sku-img-uploader');
var createComponent$d = namespace$2[0];
var t$7 = namespace$2[2];
var SkuImgUploader = createComponent$d({
  props: {
    value: String,
    uploadImg: Function,
    customUpload: Function,
    maxSize: {
      type: Number,
      default: 6
    }
  },
  data: function data() {
    return {
      fileList: []
    };
  },
  watch: {
    value: function value(val) {
      if (val) {
        this.fileList = [{
          url: val,
          isImage: true
        }];
      } else {
        this.fileList = [];
      }
    }
  },
  methods: {
    afterReadFile: function afterReadFile(file) {
      var _this = this;
      file.status = 'uploading';
      file.message = t$7('uploading');
      this.uploadImg(file.file, file.content).then(function (img) {
        file.status = 'done';
        _this.$emit('input', img);
      }).catch(function () {
        file.status = 'failed';
        file.message = t$7('fail');
      });
    },
    onOversize: function onOversize() {
      this.$toast(t$7('oversize', this.maxSize));
    },
    onDelete: function onDelete() {
      this.$emit('input', '');
    },
    onClickUpload: function onClickUpload() {
      var _this2 = this;
      if (this.customUpload) {
        this.customUpload().then(function (url) {
          _this2.fileList.push({
            url: url
          });
          _this2.$emit('input', url);
        });
      }
    }
  },
  render: function render() {
    var _this3 = this;
    var h = arguments[0];
    return h(Uploader, {
      "attrs": {
        "maxCount": 1,
        "readonly": !!this.customUpload,
        "maxSize": this.maxSize * 1024 * 1024,
        "afterRead": this.afterReadFile
      },
      "on": {
        "oversize": this.onOversize,
        "delete": this.onDelete,
        "click-upload": this.onClickUpload
      },
      "model": {
        value: _this3.fileList,
        callback: function callback($$v) {
          _this3.fileList = $$v;
        }
      }
    });
  }
});

// 只处理 YYYY-MM-DD 或者 YYYY-MM-DD HH:MM 格式

function stringToDate(timeString) {
  if (!timeString) {
    return null;
  }
  return new Date(timeString.replace(/-/g, '/'));
} // Date 转字符串
// type: date or datetime

function dateToString(date, type) {
  if (type === void 0) {
    type = 'date';
  }
  if (!date) {
    return '';
  }
  var year = date.getFullYear();
  var month = date.getMonth() + 1;
  var day = date.getDate();
  var timeString = year + "-" + padZero(month) + "-" + padZero(day);
  if (type === 'datetime') {
    var hours = date.getHours();
    var minute = date.getMinutes();
    timeString += " " + padZero(hours) + ":" + padZero(minute);
  }
  return timeString;
}

// Utils
var namespace$1 = createNamespace('sku-datetime-field');
var createComponent$c = namespace$1[0];
var t$6 = namespace$1[2];
var SkuDateTimeField = createComponent$c({
  props: {
    value: String,
    label: String,
    required: Boolean,
    placeholder: String,
    type: {
      type: String,
      default: 'date'
    }
  },
  data: function data() {
    return {
      showDatePicker: false,
      currentDate: this.type === 'time' ? '' : new Date(),
      minDate: new Date(new Date().getFullYear() - 60, 0, 1)
    };
  },
  watch: {
    value: function value(val) {
      switch (this.type) {
        case 'time':
          this.currentDate = val;
          break;
        case 'date':
        case 'datetime':
          this.currentDate = stringToDate(val) || new Date();
          break;
      }
    }
  },
  computed: {
    title: function title() {
      return t$6("title." + this.type);
    }
  },
  methods: {
    onClick: function onClick() {
      this.showDatePicker = true;
    },
    onConfirm: function onConfirm(val) {
      var data = val;
      if (this.type !== 'time') {
        data = dateToString(val, this.type);
      }
      this.$emit('input', data);
      this.showDatePicker = false;
    },
    onCancel: function onCancel() {
      this.showDatePicker = false;
    },
    formatter: function formatter(type, val) {
      var word = t$6("format." + type);
      return "" + val + word;
    }
  },
  render: function render() {
    var _this = this;
    var h = arguments[0];
    return h(Field, {
      "attrs": {
        "readonly": true,
        "is-link": true,
        "center": true,
        "value": this.value,
        "label": this.label,
        "required": this.required,
        "placeholder": this.placeholder
      },
      "on": {
        "click": this.onClick
      }
    }, [h(Popup, {
      "attrs": {
        "round": true,
        "position": "bottom",
        "getContainer": "body"
      },
      "slot": "extra",
      "model": {
        value: _this.showDatePicker,
        callback: function callback($$v) {
          _this.showDatePicker = $$v;
        }
      }
    }, [h(DatetimePicker, {
      "attrs": {
        "type": this.type,
        "title": this.title,
        "value": this.currentDate,
        "minDate": this.minDate,
        "formatter": this.formatter
      },
      "on": {
        "cancel": this.onCancel,
        "confirm": this.onConfirm
      }
    })])]);
  }
});

// Utils
var _createNamespace$a = createNamespace('sku-messages'),
  createComponent$b = _createNamespace$a[0],
  bem$b = _createNamespace$a[1],
  t$5 = _createNamespace$a[2];
var SkuMessages = createComponent$b({
  props: {
    messageConfig: Object,
    goodsId: [Number, String],
    messages: {
      type: Array,
      default: function _default() {
        return [];
      }
    }
  },
  data: function data() {
    return {
      messageValues: this.resetMessageValues(this.messages)
    };
  },
  watch: {
    messages: function messages(val) {
      this.messageValues = this.resetMessageValues(val);
    }
  },
  methods: {
    resetMessageValues: function resetMessageValues(messages) {
      var messageConfig = this.messageConfig;
      var _messageConfig$initia = messageConfig.initialMessages,
        initialMessages = _messageConfig$initia === void 0 ? {} : _messageConfig$initia;
      return (messages || []).map(function (message) {
        return {
          value: initialMessages[message.name] || ''
        };
      });
    },
    getType: function getType(message) {
      if (+message.multiple === 1) {
        return 'textarea';
      }
      if (message.type === 'id_no') {
        return 'text';
      }
      return message.datetime > 0 ? 'datetime' : message.type;
    },
    getMessages: function getMessages() {
      var messages = {};
      this.messageValues.forEach(function (item, index) {
        messages["message_" + index] = item.value;
      });
      return messages;
    },
    getCartMessages: function getCartMessages() {
      var _this = this;
      var messages = {};
      this.messageValues.forEach(function (item, index) {
        var message = _this.messages[index];
        messages[message.name] = item.value;
      });
      return messages;
    },
    getPlaceholder: function getPlaceholder(message) {
      var type = +message.multiple === 1 ? 'textarea' : message.type;
      var map = this.messageConfig.placeholderMap || {};
      return message.placeholder || map[type] || t$5("placeholder." + type);
    },
    validateMessages: function validateMessages() {
      var values = this.messageValues;
      for (var i = 0; i < values.length; i++) {
        var value = values[i].value;
        var message = this.messages[i];
        if (value === '') {
          // 必填字段的校验
          if (String(message.required) === '1') {
            var textType = t$5(message.type === 'image' ? 'upload' : 'fill');
            return textType + message.name;
          }
        } else {
          if (message.type === 'tel' && !isNumeric$1(value)) {
            return t$5('invalid.tel');
          }
          if (message.type === 'mobile' && !/^\d{6,20}$/.test(value)) {
            return t$5('invalid.mobile');
          }
          if (message.type === 'email' && !isEmail(value)) {
            return t$5('invalid.email');
          }
          if (message.type === 'id_no' && (value.length < 15 || value.length > 18)) {
            return t$5('invalid.id_no');
          }
        }
      }
    },
    /**
     * The phone number copied from IOS mobile phone address book
     * will add spaces and invisible Unicode characters
     * which cannot pass the /^\d+$/ verification
     * so keep numbers and dots
     */
    getFormatter: function getFormatter(message) {
      return function formatter(value) {
        if (message.type === 'mobile' || message.type === 'tel') {
          return value.replace(/[^\d.]/g, '');
        }
        return value;
      };
    },
    getExtraDesc: function getExtraDesc(message) {
      var h = this.$createElement;
      var extraDesc = message.extraDesc;
      if (extraDesc) {
        return h("div", {
          "class": bem$b('extra-message')
        }, [extraDesc]);
      }
    },
    genMessage: function genMessage(message, index) {
      var _this2 = this;
      var h = this.$createElement;
      if (message.type === 'image') {
        return h(Cell$1, {
          "key": this.goodsId + "-" + index,
          "attrs": {
            "title": message.name,
            "required": String(message.required) === '1',
            "valueClass": bem$b('image-cell-value')
          },
          "class": bem$b('image-cell')
        }, [h(SkuImgUploader, {
          "attrs": {
            "maxSize": this.messageConfig.uploadMaxSize,
            "uploadImg": this.messageConfig.uploadImg,
            "customUpload": this.messageConfig.customUpload
          },
          "model": {
            value: _this2.messageValues[index].value,
            callback: function callback($$v) {
              _this2.$set(_this2.messageValues[index], "value", $$v);
            }
          }
        }), h("div", {
          "class": bem$b('image-cell-label')
        }, [t$5('imageLabel')])]);
      } // 时间和日期使用的vant选择器

      var isDateOrTime = ['date', 'time'].indexOf(message.type) > -1;
      if (isDateOrTime) {
        return h(SkuDateTimeField, {
          "attrs": {
            "label": message.name,
            "required": String(message.required) === '1',
            "placeholder": this.getPlaceholder(message),
            "type": this.getType(message)
          },
          "key": this.goodsId + "-" + index,
          "model": {
            value: _this2.messageValues[index].value,
            callback: function callback($$v) {
              _this2.$set(_this2.messageValues[index], "value", $$v);
            }
          }
        });
      }
      return h("div", {
        "class": bem$b('cell-block')
      }, [h(Field, {
        "attrs": {
          "maxlength": "200",
          "center": !message.multiple,
          "label": message.name,
          "required": String(message.required) === '1',
          "placeholder": this.getPlaceholder(message),
          "type": this.getType(message),
          "formatter": this.getFormatter(message),
          "border": false
        },
        "key": this.goodsId + "-" + index,
        "model": {
          value: _this2.messageValues[index].value,
          callback: function callback($$v) {
            _this2.$set(_this2.messageValues[index], "value", $$v);
          }
        }
      }), this.getExtraDesc(message)]);
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$b()
    }, [this.messages.map(this.genMessage)]);
  }
});

var _createNamespace$9 = createNamespace('sku-actions'),
  createComponent$a = _createNamespace$9[0],
  bem$a = _createNamespace$9[1],
  t$4 = _createNamespace$9[2];
function SkuActions(h, props, slots, ctx) {
  var createEmitter = function createEmitter(name) {
    return function () {
      props.skuEventBus.$emit(name);
    };
  };
  return h("div", _mergeJSXProps([{
    "class": bem$a()
  }, inherit(ctx)]), [props.showAddCartBtn && h(Button$2, {
    "attrs": {
      "size": "large",
      "type": "warning",
      "text": props.addCartText || t$4('addCart')
    },
    "on": {
      "click": createEmitter('sku:addCart')
    }
  }), h(Button$2, {
    "attrs": {
      "size": "large",
      "type": "danger",
      "text": props.buyText || t$4('buy')
    },
    "on": {
      "click": createEmitter('sku:buy')
    }
  })]);
}
SkuActions.props = {
  buyText: String,
  addCartText: String,
  skuEventBus: Object,
  showAddCartBtn: Boolean
};
var SkuActions$1 = createComponent$a(SkuActions);

var namespace = createNamespace('sku');
var createComponent$9 = namespace[0],
  bem$9 = namespace[1],
  t$3 = namespace[2];
var QUOTA_LIMIT = LIMIT_TYPE.QUOTA_LIMIT;
var Sku = createComponent$9({
  props: {
    sku: Object,
    goods: Object,
    value: Boolean,
    buyText: String,
    goodsId: [Number, String],
    priceTag: String,
    lazyLoad: Boolean,
    hideStock: Boolean,
    properties: Array,
    skuProperties: Array,
    addCartText: String,
    stepperTitle: String,
    getContainer: [String, Function],
    hideQuotaText: Boolean,
    hideSelectedText: Boolean,
    resetStepperOnHide: Boolean,
    customSkuValidator: Function,
    disableStepperInput: Boolean,
    resetSelectedSkuOnHide: Boolean,
    quota: {
      type: Number,
      default: 0
    },
    quotaUsed: {
      type: Number,
      default: 0
    },
    startSaleNum: {
      type: Number,
      default: 1
    },
    initialSku: {
      type: Object,
      default: function _default() {
        return {};
      }
    },
    stockThreshold: {
      type: Number,
      default: 50
    },
    showSoldoutSku: {
      type: Boolean,
      default: true
    },
    showAddCartBtn: {
      type: Boolean,
      default: true
    },
    disableSoldoutSku: {
      type: Boolean,
      default: true
    },
    customStepperConfig: {
      type: Object,
      default: function _default() {
        return {};
      }
    },
    showHeaderImage: {
      type: Boolean,
      default: true
    },
    previewOnClickImage: {
      type: Boolean,
      default: true
    },
    safeAreaInsetBottom: {
      type: Boolean,
      default: true
    },
    closeOnClickOverlay: {
      type: Boolean,
      default: true
    },
    bodyOffsetTop: {
      type: Number,
      default: 200
    },
    messageConfig: {
      type: Object,
      default: function _default() {
        return {
          initialMessages: {},
          placeholderMap: {},
          uploadImg: function uploadImg() {
            return Promise.resolve();
          },
          uploadMaxSize: 5
        };
      }
    }
  },
  data: function data() {
    return {
      selectedSku: {},
      selectedProp: {},
      selectedNum: 1,
      show: this.value,
      currentSkuProperties: []
    };
  },
  watch: {
    show: function show(val) {
      this.$emit('input', val);
      if (!val) {
        this.$emit('sku-close', {
          selectedSkuValues: this.selectedSkuValues,
          selectedNum: this.selectedNum,
          selectedSkuComb: this.selectedSkuComb
        });
        if (this.resetStepperOnHide) {
          this.resetStepper();
        }
        if (this.resetSelectedSkuOnHide) {
          this.resetSelectedSku();
        }
      }
    },
    value: function value(val) {
      this.show = val;
    },
    skuTree: 'resetSelectedSku',
    initialSku: function initialSku() {
      this.resetStepper();
      this.resetSelectedSku();
    }
  },
  computed: {
    isSkuProperties: function isSkuProperties() {
      return this.skuProperties && this.skuProperties.length;
    },
    skuGroupClass: function skuGroupClass() {
      return ['van-sku-group-container', {
        'van-sku-group-container--hide-soldout': !this.showSoldoutSku
      }];
    },
    bodyStyle: function bodyStyle() {
      if (this.$isServer) {
        return;
      }
      var maxHeight = window.innerHeight - this.bodyOffsetTop;
      return {
        maxHeight: maxHeight + 'px'
      };
    },
    isSkuCombSelected: function isSkuCombSelected() {
      var _this = this;

      // SKU 未选完
      if (this.hasSku && !isAllSelected(this.skuTree, this.selectedSku)) {
        return false;
      } // 属性未全选

      return !this.propList.filter(function (i) {
        return i.is_necessary !== false;
      }).some(function (i) {
        return (_this.selectedProp[i.k_id] || []).length === 0;
      });
    },
    isSkuEmpty: function isSkuEmpty() {
      return Object.keys(this.sku).length === 0;
    },
    hasSku: function hasSku() {
      return !this.sku.none_sku;
    },
    hasSkuOrAttr: function hasSkuOrAttr() {
      return this.hasSku || this.propList.length > 0;
    },
    selectedSkuComb: function selectedSkuComb() {
      var skuComb = null;
      if (this.isSkuCombSelected || this.isSkuProperties) {
        if (this.hasSku) {
          skuComb = getSkuComb(this.skuList, this.selectedSku);
        } else {
          skuComb = {
            id: this.sku.collection_id,
            price: Math.round(this.sku.price * 100),
            stock_num: this.sku.stock_num
          };
        } // 更新当前规格属性数据

        this.setCurrentSkuProperties(skuComb ? skuComb.id : null);
        if (skuComb) {
          skuComb.properties = getSelectedProperties(this.propList, this.selectedProp);
          skuComb.property_price = this.selectedPropValues.reduce(function (acc, cur) {
            return acc + (cur.price || 0);
          }, 0);
        }
      }
      return skuComb;
    },
    selectedSkuValues: function selectedSkuValues() {
      return getSelectedSkuValues(this.skuTree, this.selectedSku);
    },
    selectedPropValues: function selectedPropValues() {
      return getSelectedPropValues(this.propList, this.selectedProp);
    },
    price: function price() {
      if (this.selectedSkuComb) {
        return ((this.selectedSkuComb.price + this.selectedSkuComb.property_price) / 100).toFixed(2);
      } // sku.price是一个格式化好的价格区间

      return this.sku.price;
    },
    originPrice: function originPrice() {
      if (this.selectedSkuComb && this.selectedSkuComb.origin_price) {
        return ((this.selectedSkuComb.origin_price + this.selectedSkuComb.property_price) / 100).toFixed(2);
      }
      return this.sku.origin_price;
    },
    skuTree: function skuTree() {
      return this.sku.tree || [];
    },
    skuList: function skuList() {
      return this.sku.list || [];
    },
    propList: function propList() {
      return this.isSkuProperties ? this.currentSkuProperties : this.properties || [];
    },
    imageList: function imageList() {
      var imageList = [this.goods.picture];
      if (this.skuTree.length > 0) {
        this.skuTree.forEach(function (treeItem) {
          if (!treeItem.v) {
            return;
          }
          treeItem.v.forEach(function (vItem) {
            var imgUrl = vItem.previewImgUrl || vItem.imgUrl || vItem.img_url;
            if (imgUrl && imageList.indexOf(imgUrl) === -1) {
              imageList.push(imgUrl);
            }
          });
        });
      }
      return imageList;
    },
    stock: function stock() {
      var stockNum = this.customStepperConfig.stockNum;
      if (stockNum !== undefined) {
        return stockNum;
      }
      if (this.selectedSkuComb) {
        return this.selectedSkuComb.stock_num;
      }
      return this.sku.stock_num;
    },
    stockText: function stockText() {
      var h = this.$createElement;
      var stockFormatter = this.customStepperConfig.stockFormatter;
      if (stockFormatter) {
        return stockFormatter(this.stock);
      }
      return [t$3('stock') + " ", h("span", {
        "class": bem$9('stock-num', {
          highlight: this.stock < this.stockThreshold
        })
      }, [this.stock]), " " + t$3('stockUnit')];
    },
    selectedText: function selectedText() {
      var _this2 = this;
      if (this.selectedSkuComb) {
        var values = this.selectedSkuValues.concat(this.selectedPropValues);
        return t$3('selected') + " " + values.map(function (item) {
          return item.name;
        }).join(' ');
      }
      var unselectedSku = this.skuTree.filter(function (item) {
        return _this2.selectedSku[item.k_s] === UNSELECTED_SKU_VALUE_ID;
      }).map(function (item) {
        return item.k;
      });
      var unselectedProp = this.propList.filter(function (item) {
        return (_this2.selectedProp[item.k_id] || []).length < 1;
      }).map(function (item) {
        return item.k;
      });
      return t$3('select') + " " + unselectedSku.concat(unselectedProp).join(' ');
    }
  },
  created: function created() {
    var skuEventBus = new Vue();
    this.skuEventBus = skuEventBus;
    skuEventBus.$on('sku:select', this.onSelect);
    skuEventBus.$on('sku:propSelect', this.onPropSelect);
    skuEventBus.$on('sku:numChange', this.onNumChange);
    skuEventBus.$on('sku:previewImage', this.onPreviewImage);
    skuEventBus.$on('sku:overLimit', this.onOverLimit);
    skuEventBus.$on('sku:stepperState', this.onStepperState);
    skuEventBus.$on('sku:addCart', this.onAddCart);
    skuEventBus.$on('sku:buy', this.onBuy);
    this.resetStepper();
    this.resetSelectedSku(); // 组件初始化后的钩子，抛出skuEventBus

    this.$emit('after-sku-create', skuEventBus);
  },
  methods: {
    setCurrentSkuProperties: function setCurrentSkuProperties(id) {
      var _this$skuProperties;
      var target = ((_this$skuProperties = this.skuProperties) == null ? void 0 : _this$skuProperties.find(function (item) {
        return item.sku_id === id;
      })) || {};
      this.currentSkuProperties = target.properties || [];
    },
    resetStepper: function resetStepper() {
      var skuStepper = this.$refs.skuStepper;
      var selectedNum = this.initialSku.selectedNum;
      var num = selectedNum != null ? selectedNum : this.startSaleNum; // 用来缓存不合法的情况

      this.stepperError = null;
      if (skuStepper) {
        skuStepper.setCurrentNum(num);
      } else {
        // 当首次加载（skuStepper 为空）时，传入数量如果不合法，可能会存在问题
        this.selectedNum = num;
      }
    },
    // @exposed-api
    resetSelectedSku: function resetSelectedSku() {
      var _this3 = this;
      this.selectedSku = {}; // 重置 selectedSku

      this.skuTree.forEach(function (item) {
        _this3.selectedSku[item.k_s] = UNSELECTED_SKU_VALUE_ID;
      });
      this.skuTree.forEach(function (item) {
        var key = item.k_s; // 规格值只有1个时，优先判断

        var valueId = item.v.length === 1 ? item.v[0].id : _this3.initialSku[key];
        if (valueId && isSkuChoosable(_this3.skuList, _this3.selectedSku, {
          key: key,
          valueId: valueId
        })) {
          _this3.selectedSku[key] = valueId;
        }
      });
      var skuValues = this.selectedSkuValues;
      if (skuValues.length > 0) {
        this.$nextTick(function () {
          _this3.$emit('sku-selected', {
            skuValue: skuValues[skuValues.length - 1],
            selectedSku: _this3.selectedSku,
            selectedSkuComb: _this3.selectedSkuComb
          });
        });
      } // 重置商品属性

      this.selectedProp = {};
      var _this$initialSku$sele = this.initialSku.selectedProp,
        selectedProp = _this$initialSku$sele === void 0 ? {} : _this$initialSku$sele; // 选中外部传入信息

      this.propList.forEach(function (item) {
        if (selectedProp[item.k_id]) {
          _this3.selectedProp[item.k_id] = selectedProp[item.k_id];
        }
      });
      if (isEmpty$2(this.selectedProp)) {
        this.propList.forEach(function (item) {
          var _item$v;

          // 没有加价的属性，默认选中第一个
          if ((item == null ? void 0 : (_item$v = item.v) == null ? void 0 : _item$v.length) > 0) {
            var v = item.v,
              k_id = item.k_id;
            var isHasConfigPrice = v.some(function (i) {
              return +i.price !== 0;
            }); // 没有加价属性

            if (!isHasConfigPrice) {
              // 找到第一个不被禁用的属性
              // 历史如果没有 text_status 字段的，就相当于沿用直接原来的逻辑取第一个属性
              var firstEnableProp = v.find(function (prop) {
                return prop.text_status !== 0;
              });
              if (firstEnableProp) {
                _this3.selectedProp[k_id] = [firstEnableProp.id];
              }
            }
          }
        });
      }
      var propValues = this.selectedPropValues;
      if (propValues.length > 0) {
        this.$emit('sku-prop-selected', {
          propValue: propValues[propValues.length - 1],
          selectedProp: this.selectedProp,
          selectedSkuComb: this.selectedSkuComb
        });
      } // 抛出重置事件

      this.$emit('sku-reset', {
        selectedSku: this.selectedSku,
        selectedProp: this.selectedProp,
        selectedSkuComb: this.selectedSkuComb
      });
      this.centerInitialSku();
    },
    getSkuMessages: function getSkuMessages() {
      return this.$refs.skuMessages ? this.$refs.skuMessages.getMessages() : {};
    },
    getSkuCartMessages: function getSkuCartMessages() {
      return this.$refs.skuMessages ? this.$refs.skuMessages.getCartMessages() : {};
    },
    validateSkuMessages: function validateSkuMessages() {
      return this.$refs.skuMessages ? this.$refs.skuMessages.validateMessages() : '';
    },
    validateSku: function validateSku() {
      if (this.selectedNum === 0) {
        return t$3('unavailable');
      }
      if (this.isSkuCombSelected) {
        return this.validateSkuMessages();
      } // 自定义sku校验

      if (this.customSkuValidator) {
        var err = this.customSkuValidator(this);
        if (err) return err;
      }
      return t$3('selectSku');
    },
    onSelect: function onSelect(skuValue) {
      var _extends2, _extends3;

      // 点击已选中的sku时则取消选中
      this.selectedSku = this.selectedSku[skuValue.skuKeyStr] === skuValue.id ? _extends$1({}, this.selectedSku, (_extends2 = {}, _extends2[skuValue.skuKeyStr] = UNSELECTED_SKU_VALUE_ID, _extends2)) : _extends$1({}, this.selectedSku, (_extends3 = {}, _extends3[skuValue.skuKeyStr] = skuValue.id, _extends3)); // 切换sku清空当前选择属性数据，触发prop-clear

      if (this.isSkuProperties) {
        this.selectedProp = {};
        this.onPropClear();
      }
      this.$emit('sku-selected', {
        skuValue: skuValue,
        selectedSku: this.selectedSku,
        selectedSkuComb: this.selectedSkuComb
      });
    },
    onPropClear: function onPropClear() {
      this.$emit('sku-prop-clear');
    },
    onPropSelect: function onPropSelect(propValue) {
      var _extends4;
      var arr = this.selectedProp[propValue.skuKeyStr] || [];
      var pos = arr.indexOf(propValue.id);
      if (pos > -1) {
        arr.splice(pos, 1);
      } else if (propValue.multiple) {
        arr.push(propValue.id);
      } else {
        arr.splice(0, 1, propValue.id);
      }
      this.selectedProp = _extends$1({}, this.selectedProp, (_extends4 = {}, _extends4[propValue.skuKeyStr] = arr, _extends4));
      this.$emit('sku-prop-selected', {
        propValue: propValue,
        selectedProp: this.selectedProp,
        selectedSkuComb: this.selectedSkuComb
      });
    },
    onNumChange: function onNumChange(num) {
      this.selectedNum = num;
    },
    onPreviewImage: function onPreviewImage(selectedValue) {
      var _this4 = this;
      var imageList = this.imageList;
      var index = 0;
      var indexImage = imageList[0];
      if (selectedValue && selectedValue.imgUrl) {
        this.imageList.some(function (image, pos) {
          if (image === selectedValue.imgUrl) {
            index = pos;
            return true;
          }
          return false;
        });
        indexImage = selectedValue.imgUrl;
      }
      var params = _extends$1({}, selectedValue, {
        index: index,
        imageList: this.imageList,
        indexImage: indexImage
      });
      this.$emit('open-preview', params);
      if (!this.previewOnClickImage) {
        return;
      }
      ImagePreview$1({
        images: this.imageList,
        startPosition: index,
        onClose: function onClose() {
          _this4.$emit('close-preview', params);
        }
      });
    },
    onOverLimit: function onOverLimit(data) {
      var action = data.action,
        limitType = data.limitType,
        quota = data.quota,
        quotaUsed = data.quotaUsed;
      var handleOverLimit = this.customStepperConfig.handleOverLimit;
      if (handleOverLimit) {
        handleOverLimit(data);
        return;
      }
      if (action === 'minus') {
        if (this.startSaleNum > 1) {
          Toast(t$3('minusStartTip', this.startSaleNum));
        } else {
          Toast(t$3('minusTip'));
        }
      } else if (action === 'plus') {
        if (limitType === QUOTA_LIMIT) {
          if (quotaUsed > 0) {
            Toast(t$3('quotaUsedTip', quota, quotaUsed));
          } else {
            Toast(t$3('quotaTip', quota));
          }
        } else {
          Toast(t$3('soldout'));
        }
      }
    },
    onStepperState: function onStepperState(data) {
      this.stepperError = data.valid ? null : _extends$1({}, data, {
        action: 'plus'
      });
    },
    onAddCart: function onAddCart() {
      this.onBuyOrAddCart('add-cart');
    },
    onBuy: function onBuy() {
      this.onBuyOrAddCart('buy-clicked');
    },
    onBuyOrAddCart: function onBuyOrAddCart(type) {
      // sku 不符合购买条件
      if (this.stepperError) {
        return this.onOverLimit(this.stepperError);
      }
      var error = this.validateSku();
      if (error) {
        Toast(error);
      } else {
        this.$emit(type, this.getSkuData());
      }
    },
    // @exposed-api
    getSkuData: function getSkuData() {
      return {
        goodsId: this.goodsId,
        messages: this.getSkuMessages(),
        selectedNum: this.selectedNum,
        cartMessages: this.getSkuCartMessages(),
        selectedSkuComb: this.selectedSkuComb
      };
    },
    // 当 popup 完全打开后执行
    onOpened: function onOpened() {
      this.centerInitialSku();
    },
    centerInitialSku: function centerInitialSku() {
      var _this5 = this;
      (this.$refs.skuRows || []).forEach(function (it) {
        var _ref = it.skuRow || {},
          k_s = _ref.k_s;
        it.centerItem(_this5.initialSku[k_s]);
      });
    }
  },
  render: function render() {
    var _this6 = this;
    var h = arguments[0];
    if (this.isSkuEmpty) {
      return;
    }
    var sku = this.sku,
      skuList = this.skuList,
      goods = this.goods,
      price = this.price,
      lazyLoad = this.lazyLoad,
      originPrice = this.originPrice,
      skuEventBus = this.skuEventBus,
      selectedSku = this.selectedSku,
      selectedProp = this.selectedProp,
      selectedNum = this.selectedNum,
      stepperTitle = this.stepperTitle,
      selectedSkuComb = this.selectedSkuComb,
      showHeaderImage = this.showHeaderImage,
      disableSoldoutSku = this.disableSoldoutSku;
    var slotsProps = {
      price: price,
      originPrice: originPrice,
      selectedNum: selectedNum,
      skuEventBus: skuEventBus,
      selectedSku: selectedSku,
      selectedSkuComb: selectedSkuComb
    };
    var slots = function slots(name) {
      return _this6.slots(name, slotsProps);
    };
    var Header = slots('sku-header') || h(SkuHeader$2, {
      "attrs": {
        "sku": sku,
        "goods": goods,
        "skuEventBus": skuEventBus,
        "selectedSku": selectedSku,
        "showHeaderImage": showHeaderImage
      }
    }, [h("template", {
      "slot": "sku-header-image-extra"
    }, [slots('sku-header-image-extra')]), slots('sku-header-price') || h("div", {
      "class": "van-sku__goods-price"
    }, [h("span", {
      "class": "van-sku__price-symbol"
    }, ["\uFFE5"]), h("span", {
      "class": "van-sku__price-num"
    }, [price]), this.priceTag && h("span", {
      "class": "van-sku__price-tag"
    }, [this.priceTag])]), slots('sku-header-origin-price') || originPrice && h(SkuHeaderItem, [t$3('originPrice'), " \uFFE5", originPrice]), !this.hideStock && h(SkuHeaderItem, [h("span", {
      "class": "van-sku__stock"
    }, [this.stockText])]), this.hasSkuOrAttr && !this.hideSelectedText && h(SkuHeaderItem, [this.selectedText]), slots('sku-header-extra')]);
    var Group = slots('sku-group') || this.hasSkuOrAttr && h("div", {
      "class": this.skuGroupClass
    }, [this.skuTree.map(function (skuTreeItem) {
      return h(SkuRow, {
        "attrs": {
          "skuRow": skuTreeItem
        },
        "ref": "skuRows",
        "refInFor": true
      }, [skuTreeItem.v.map(function (skuValue) {
        return h(SkuRowItem, {
          "attrs": {
            "skuList": skuList,
            "lazyLoad": lazyLoad,
            "skuValue": skuValue,
            "skuKeyStr": skuTreeItem.k_s,
            "selectedSku": selectedSku,
            "skuEventBus": skuEventBus,
            "disableSoldoutSku": disableSoldoutSku,
            "largeImageMode": skuTreeItem.largeImageMode
          }
        });
      })]);
    }), this.propList.map(function (skuTreeItem) {
      return h(SkuRow, {
        "attrs": {
          "skuRow": skuTreeItem
        }
      }, [skuTreeItem.v.map(function (skuValue) {
        return h(SkuRowPropItem, {
          "attrs": {
            "skuValue": skuValue,
            "skuKeyStr": skuTreeItem.k_id + '',
            "selectedProp": selectedProp,
            "skuEventBus": skuEventBus,
            "multiple": skuTreeItem.is_multiple,
            "disabled": skuValue.text_status === 0
          }
        });
      })]);
    })]);
    var Stepper = slots('sku-stepper') || h(SkuStepper, {
      "ref": "skuStepper",
      "attrs": {
        "stock": this.stock,
        "quota": this.quota,
        "quotaUsed": this.quotaUsed,
        "startSaleNum": this.startSaleNum,
        "skuEventBus": skuEventBus,
        "selectedNum": selectedNum,
        "stepperTitle": stepperTitle,
        "skuStockNum": sku.stock_num,
        "disableStepperInput": this.disableStepperInput,
        "customStepperConfig": this.customStepperConfig,
        "hideQuotaText": this.hideQuotaText
      },
      "on": {
        "change": function change(event) {
          _this6.$emit('stepper-change', event);
        }
      }
    });
    var Messages = slots('sku-messages') || h(SkuMessages, {
      "ref": "skuMessages",
      "attrs": {
        "goodsId": this.goodsId,
        "messageConfig": this.messageConfig,
        "messages": sku.messages
      }
    });
    var Actions = slots('sku-actions') || h(SkuActions$1, {
      "attrs": {
        "buyText": this.buyText,
        "skuEventBus": skuEventBus,
        "addCartText": this.addCartText,
        "showAddCartBtn": this.showAddCartBtn
      }
    });
    return h(Popup, {
      "attrs": {
        "round": true,
        "closeable": true,
        "position": "bottom",
        "getContainer": this.getContainer,
        "closeOnClickOverlay": this.closeOnClickOverlay,
        "safeAreaInsetBottom": this.safeAreaInsetBottom
      },
      "class": "van-sku-container",
      "on": {
        "opened": this.onOpened
      },
      "model": {
        value: _this6.show,
        callback: function callback($$v) {
          _this6.show = $$v;
        }
      }
    }, [Header, h("div", {
      "class": "van-sku-body",
      "style": this.bodyStyle
    }, [slots('sku-body-top'), Group, slots('extra-sku-group'), Stepper, slots('before-sku-messages'), Messages, slots('after-sku-messages')]), slots('sku-actions-top'), Actions]);
  }
});

// Utils
Locale$1.add(lang$1);
Sku.SkuActions = SkuActions$1;
Sku.SkuHeader = SkuHeader$2;
Sku.SkuHeaderItem = SkuHeaderItem;
Sku.SkuMessages = SkuMessages;
Sku.SkuStepper = SkuStepper;
Sku.SkuRow = SkuRow;
Sku.SkuRowItem = SkuRowItem;
Sku.SkuRowPropItem = SkuRowPropItem;
Sku.skuHelper = skuHelper;
Sku.skuConstants = constants;

var _createNamespace$8 = createNamespace('slider'),
  createComponent$8 = _createNamespace$8[0],
  bem$8 = _createNamespace$8[1];
var isSameValue = function isSameValue(newValue, oldValue) {
  return JSON.stringify(newValue) === JSON.stringify(oldValue);
};
var Slider$1 = createComponent$8({
  mixins: [TouchMixin, FieldMixin],
  props: {
    disabled: Boolean,
    vertical: Boolean,
    range: Boolean,
    barHeight: [Number, String],
    buttonSize: [Number, String],
    activeColor: String,
    inactiveColor: String,
    min: {
      type: [Number, String],
      default: 0
    },
    max: {
      type: [Number, String],
      default: 100
    },
    step: {
      type: [Number, String],
      default: 1
    },
    value: {
      type: [Number, Array],
      default: 0
    }
  },
  data: function data() {
    return {
      dragStatus: ''
    };
  },
  computed: {
    scope: function scope() {
      return this.max - this.min;
    },
    buttonStyle: function buttonStyle() {
      if (this.buttonSize) {
        var size = addUnit(this.buttonSize);
        return {
          width: size,
          height: size
        };
      }
    }
  },
  created: function created() {
    // format initial value
    this.updateValue(this.value);
  },
  mounted: function mounted() {
    if (this.range) {
      this.bindTouchEvent(this.$refs.wrapper0);
      this.bindTouchEvent(this.$refs.wrapper1);
    } else {
      this.bindTouchEvent(this.$refs.wrapper);
    }
  },
  methods: {
    onTouchStart: function onTouchStart(event) {
      if (this.disabled) {
        return;
      }
      this.touchStart(event);
      this.currentValue = this.value;
      if (this.range) {
        this.startValue = this.value.map(this.format);
      } else {
        this.startValue = this.format(this.value);
      }
      this.dragStatus = 'start';
    },
    onTouchMove: function onTouchMove(event) {
      if (this.disabled) {
        return;
      }
      if (this.dragStatus === 'start') {
        this.$emit('drag-start');
      }
      preventDefault$1(event, true);
      this.touchMove(event);
      this.dragStatus = 'draging';
      var rect = this.$el.getBoundingClientRect();
      var delta = this.vertical ? this.deltaY : this.deltaX;
      var total = this.vertical ? rect.height : rect.width;
      var diff = delta / total * this.scope;
      if (this.range) {
        this.currentValue[this.index] = this.startValue[this.index] + diff;
      } else {
        this.currentValue = this.startValue + diff;
      }
      this.updateValue(this.currentValue);
    },
    onTouchEnd: function onTouchEnd() {
      if (this.disabled) {
        return;
      }
      if (this.dragStatus === 'draging') {
        this.updateValue(this.currentValue, true);
        this.$emit('drag-end');
      }
      this.dragStatus = '';
    },
    onClick: function onClick(event) {
      event.stopPropagation();
      if (this.disabled) return;
      var rect = this.$el.getBoundingClientRect();
      var delta = this.vertical ? event.clientY - rect.top : event.clientX - rect.left;
      var total = this.vertical ? rect.height : rect.width;
      var value = +this.min + delta / total * this.scope;
      if (this.range) {
        var _this$value = this.value,
          left = _this$value[0],
          right = _this$value[1];
        var middle = (left + right) / 2;
        if (value <= middle) {
          left = value;
        } else {
          right = value;
        }
        value = [left, right];
      }
      this.startValue = this.value;
      this.updateValue(value, true);
    },
    // 处理两个滑块重叠之后的情况
    handleOverlap: function handleOverlap(value) {
      if (value[0] > value[1]) {
        value = deepClone(value);
        return value.reverse();
      }
      return value;
    },
    updateValue: function updateValue(value, end) {
      if (this.range) {
        value = this.handleOverlap(value).map(this.format);
      } else {
        value = this.format(value);
      }
      if (!isSameValue(value, this.value)) {
        this.$emit('input', value);
      }
      if (end && !isSameValue(value, this.startValue)) {
        this.$emit('change', value);
      }
    },
    format: function format(value) {
      var min = +this.min;
      var max = +this.max;
      var step = +this.step;
      value = range$1(value, min, max);
      var diff = Math.round((value - min) / step) * step;
      return addNumber(min, diff);
    }
  },
  render: function render() {
    var _wrapperStyle,
      _this = this,
      _barStyle;
    var h = arguments[0];
    var vertical = this.vertical;
    var mainAxis = vertical ? 'height' : 'width';
    var crossAxis = vertical ? 'width' : 'height';
    var wrapperStyle = (_wrapperStyle = {
      background: this.inactiveColor
    }, _wrapperStyle[crossAxis] = addUnit(this.barHeight), _wrapperStyle); // 计算选中条的长度百分比

    var calcMainAxis = function calcMainAxis() {
      var value = _this.value,
        min = _this.min,
        range = _this.range,
        scope = _this.scope;
      if (range) {
        return (value[1] - value[0]) * 100 / scope + "%";
      }
      return (value - min) * 100 / scope + "%";
    }; // 计算选中条的开始位置的偏移量

    var calcOffset = function calcOffset() {
      var value = _this.value,
        min = _this.min,
        range = _this.range,
        scope = _this.scope;
      if (range) {
        return (value[0] - min) * 100 / scope + "%";
      }
      return null;
    };
    var barStyle = (_barStyle = {}, _barStyle[mainAxis] = calcMainAxis(), _barStyle.left = this.vertical ? null : calcOffset(), _barStyle.top = this.vertical ? calcOffset() : null, _barStyle.background = this.activeColor, _barStyle);
    if (this.dragStatus) {
      barStyle.transition = 'none';
    }
    var renderButton = function renderButton(i) {
      var map = ['left', 'right'];
      var isNumber = typeof i === 'number';
      var current = isNumber ? _this.value[i] : _this.value;
      var getClassName = function getClassName() {
        if (isNumber) {
          return "button-wrapper-" + map[i];
        }
        return "button-wrapper";
      };
      var getRefName = function getRefName() {
        if (isNumber) {
          return "wrapper" + i;
        }
        return "wrapper";
      };
      var renderButtonContent = function renderButtonContent() {
        if (isNumber) {
          var slot = _this.slots(i === 0 ? 'left-button' : 'right-button', {
            value: current
          });
          if (slot) {
            return slot;
          }
        }
        if (_this.slots('button')) {
          return _this.slots('button');
        }
        return h("div", {
          "class": bem$8('button'),
          "style": _this.buttonStyle
        });
      };
      return h("div", {
        "ref": getRefName(),
        "attrs": {
          "role": "slider",
          "tabindex": _this.disabled ? -1 : 0,
          "aria-valuemin": _this.min,
          "aria-valuenow": _this.value,
          "aria-valuemax": _this.max,
          "aria-orientation": _this.vertical ? 'vertical' : 'horizontal'
        },
        "class": bem$8(getClassName()),
        "on": {
          "touchstart": function touchstart() {
            if (isNumber) {
              // 保存当前按钮的索引
              _this.index = i;
            }
          },
          "click": function click(e) {
            return e.stopPropagation();
          }
        }
      }, [renderButtonContent()]);
    };
    return h("div", {
      "style": wrapperStyle,
      "class": bem$8({
        disabled: this.disabled,
        vertical: vertical
      }),
      "on": {
        "click": this.onClick
      }
    }, [h("div", {
      "class": bem$8('bar'),
      "style": barStyle
    }, [this.range ? [renderButton(0), renderButton(1)] : renderButton()])]);
  }
});

var _createNamespace$7 = createNamespace('step'),
  createComponent$7 = _createNamespace$7[0],
  bem$7 = _createNamespace$7[1];
var Step = createComponent$7({
  mixins: [ChildrenMixin('vanSteps')],
  computed: {
    status: function status() {
      if (this.index < this.parent.active) {
        return 'finish';
      }
      if (this.index === +this.parent.active) {
        return 'process';
      }
    },
    active: function active() {
      return this.status === 'process';
    },
    lineStyle: function lineStyle() {
      var _this$parent = this.parent,
        activeColor = _this$parent.activeColor,
        inactiveColor = _this$parent.inactiveColor,
        center = _this$parent.center,
        direction = _this$parent.direction;
      var style = {
        background: this.status === 'finish' ? activeColor : inactiveColor
      };
      if (center && direction === 'vertical') {
        style.top = '50%';
      }
      return style;
    },
    circleContainerStyle: function circleContainerStyle() {
      if (this.parent.center && this.parent.direction === 'vertical') {
        return {
          top: '50%'
        };
      }
    },
    titleStyle: function titleStyle() {
      if (this.active) {
        return {
          color: this.parent.activeColor
        };
      }
      if (!this.status) {
        return {
          color: this.parent.inactiveColor
        };
      }
    }
  },
  methods: {
    genCircle: function genCircle() {
      var h = this.$createElement;
      var _this$parent2 = this.parent,
        activeIcon = _this$parent2.activeIcon,
        iconPrefix = _this$parent2.iconPrefix,
        activeColor = _this$parent2.activeColor,
        finishIcon = _this$parent2.finishIcon,
        inactiveIcon = _this$parent2.inactiveIcon;
      if (this.active) {
        return this.slots('active-icon') || h(Icon$3, {
          "class": bem$7('icon', 'active'),
          "attrs": {
            "name": activeIcon,
            "color": activeColor,
            "classPrefix": iconPrefix
          }
        });
      }
      var finishIconSlot = this.slots('finish-icon');
      if (this.status === 'finish' && (finishIcon || finishIconSlot)) {
        return finishIconSlot || h(Icon$3, {
          "class": bem$7('icon', 'finish'),
          "attrs": {
            "name": finishIcon,
            "color": activeColor,
            "classPrefix": iconPrefix
          }
        });
      }
      var inactiveIconSlot = this.slots('inactive-icon');
      if (inactiveIcon || inactiveIconSlot) {
        return inactiveIconSlot || h(Icon$3, {
          "class": bem$7('icon'),
          "attrs": {
            "name": inactiveIcon,
            "classPrefix": iconPrefix
          }
        });
      }
      return h("i", {
        "class": bem$7('circle'),
        "style": this.lineStyle
      });
    },
    onClickStep: function onClickStep() {
      this.parent.$emit('click-step', this.index);
    }
  },
  render: function render() {
    var _ref;
    var h = arguments[0];
    var status = this.status,
      active = this.active;
    var direction = this.parent.direction;
    return h("div", {
      "class": [BORDER, bem$7([direction, (_ref = {}, _ref[status] = status, _ref)])]
    }, [h("div", {
      "class": bem$7('title', {
        active: active
      }),
      "style": this.titleStyle,
      "on": {
        "click": this.onClickStep
      }
    }, [this.slots()]), h("div", {
      "class": bem$7('circle-container'),
      "on": {
        "click": this.onClickStep
      },
      "style": this.circleContainerStyle
    }, [this.genCircle()]), h("div", {
      "class": bem$7('line'),
      "style": this.lineStyle
    })]);
  }
});

var _createNamespace$6 = createNamespace('steps'),
  createComponent$6 = _createNamespace$6[0],
  bem$6 = _createNamespace$6[1];
var Steps = createComponent$6({
  mixins: [ParentMixin('vanSteps')],
  props: {
    center: Boolean,
    iconPrefix: String,
    finishIcon: String,
    activeColor: String,
    inactiveIcon: String,
    inactiveColor: String,
    active: {
      type: [Number, String],
      default: 0
    },
    direction: {
      type: String,
      default: 'horizontal'
    },
    activeIcon: {
      type: String,
      default: 'checked'
    }
  },
  render: function render() {
    var h = arguments[0];
    return h("div", {
      "class": bem$6([this.direction])
    }, [h("div", {
      "class": bem$6('items')
    }, [this.slots()])]);
  }
});

var _createNamespace$5 = createNamespace('submit-bar'),
  createComponent$5 = _createNamespace$5[0],
  bem$5 = _createNamespace$5[1],
  t$2 = _createNamespace$5[2];
function SubmitBar(h, props, slots, ctx) {
  var tip = props.tip,
    price = props.price,
    tipIcon = props.tipIcon;
  function Text() {
    if (typeof price === 'number') {
      var priceArr = (price / 100).toFixed(props.decimalLength).split('.');
      var decimalStr = props.decimalLength ? "." + priceArr[1] : '';
      return h("div", {
        "style": {
          textAlign: props.textAlign ? props.textAlign : ''
        },
        "class": bem$5('text')
      }, [h("span", [props.label || t$2('label')]), h("span", {
        "class": bem$5('price')
      }, [props.currency, h("span", {
        "class": bem$5('price', 'integer')
      }, [priceArr[0]]), decimalStr]), props.suffixLabel && h("span", {
        "class": bem$5('suffix-label')
      }, [props.suffixLabel])]);
    }
  }
  function Tip() {
    if (slots.tip || tip) {
      return h("div", {
        "class": bem$5('tip')
      }, [tipIcon && h(Icon$3, {
        "class": bem$5('tip-icon'),
        "attrs": {
          "name": tipIcon
        }
      }), tip && h("span", {
        "class": bem$5('tip-text')
      }, [tip]), slots.tip && slots.tip()]);
    }
  }
  return h("div", _mergeJSXProps([{
    "class": bem$5({
      unfit: !props.safeAreaInsetBottom
    })
  }, inherit(ctx)]), [slots.top && slots.top(), Tip(), h("div", {
    "class": bem$5('bar')
  }, [slots.default && slots.default(), Text(), slots.button ? slots.button() : h(Button$2, {
    "attrs": {
      "round": true,
      "type": props.buttonType,
      "text": props.loading ? '' : props.buttonText,
      "color": props.buttonColor,
      "loading": props.loading,
      "disabled": props.disabled
    },
    "class": bem$5('button', props.buttonType),
    "on": {
      "click": function click() {
        emit(ctx, 'submit');
      }
    }
  })])]);
}
SubmitBar.props = {
  tip: String,
  label: String,
  price: Number,
  tipIcon: String,
  loading: Boolean,
  disabled: Boolean,
  textAlign: String,
  buttonText: String,
  buttonColor: String,
  suffixLabel: String,
  safeAreaInsetBottom: {
    type: Boolean,
    default: true
  },
  decimalLength: {
    type: [Number, String],
    default: 2
  },
  currency: {
    type: String,
    default: '¥'
  },
  buttonType: {
    type: String,
    default: 'danger'
  }
};
var SubmitBar$1 = createComponent$5(SubmitBar);

// Utils
var _createNamespace$4 = createNamespace('swipe-cell'),
  createComponent$4 = _createNamespace$4[0],
  bem$4 = _createNamespace$4[1];
var THRESHOLD = 0.15;
var SwipeCell = createComponent$4({
  mixins: [TouchMixin, ClickOutsideMixin({
    event: 'touchstart',
    method: 'onClick'
  })],
  props: {
    // @deprecated
    // should be removed in next major version, use beforeClose instead
    onClose: Function,
    disabled: Boolean,
    leftWidth: [Number, String],
    rightWidth: [Number, String],
    beforeClose: Function,
    stopPropagation: Boolean,
    name: {
      type: [Number, String],
      default: ''
    }
  },
  data: function data() {
    return {
      offset: 0,
      dragging: false
    };
  },
  computed: {
    computedLeftWidth: function computedLeftWidth() {
      return +this.leftWidth || this.getWidthByRef('left');
    },
    computedRightWidth: function computedRightWidth() {
      return +this.rightWidth || this.getWidthByRef('right');
    }
  },
  mounted: function mounted() {
    this.bindTouchEvent(this.$el);
  },
  methods: {
    getWidthByRef: function getWidthByRef(ref) {
      if (this.$refs[ref]) {
        var rect = this.$refs[ref].getBoundingClientRect();
        return rect.width;
      }
      return 0;
    },
    // @exposed-api
    open: function open(position) {
      var offset = position === 'left' ? this.computedLeftWidth : -this.computedRightWidth;
      this.opened = true;
      this.offset = offset;
      this.$emit('open', {
        position: position,
        name: this.name,
        // @deprecated
        // should be removed in next major version
        detail: this.name
      });
    },
    // @exposed-api
    close: function close(position) {
      this.offset = 0;
      if (this.opened) {
        this.opened = false;
        this.$emit('close', {
          position: position,
          name: this.name
        });
      }
    },
    onTouchStart: function onTouchStart(event) {
      if (this.disabled) {
        return;
      }
      this.startOffset = this.offset;
      this.touchStart(event);
    },
    onTouchMove: function onTouchMove(event) {
      if (this.disabled) {
        return;
      }
      this.touchMove(event);
      if (this.direction === 'horizontal') {
        this.dragging = true;
        this.lockClick = true;
        var isPrevent = !this.opened || this.deltaX * this.startOffset < 0;
        if (isPrevent) {
          preventDefault$1(event, this.stopPropagation);
        }
        this.offset = range$1(this.deltaX + this.startOffset, -this.computedRightWidth, this.computedLeftWidth);
      }
    },
    onTouchEnd: function onTouchEnd() {
      var _this = this;
      if (this.disabled) {
        return;
      }
      if (this.dragging) {
        this.toggle(this.offset > 0 ? 'left' : 'right');
        this.dragging = false; // compatible with desktop scenario

        setTimeout(function () {
          _this.lockClick = false;
        }, 0);
      }
    },
    toggle: function toggle(direction) {
      var offset = Math.abs(this.offset);
      var threshold = this.opened ? 1 - THRESHOLD : THRESHOLD;
      var computedLeftWidth = this.computedLeftWidth,
        computedRightWidth = this.computedRightWidth;
      if (computedRightWidth && direction === 'right' && offset > computedRightWidth * threshold) {
        this.open('right');
      } else if (computedLeftWidth && direction === 'left' && offset > computedLeftWidth * threshold) {
        this.open('left');
      } else {
        this.close();
      }
    },
    onClick: function onClick(position) {
      if (position === void 0) {
        position = 'outside';
      }
      this.$emit('click', position);
      if (this.opened && !this.lockClick) {
        if (this.beforeClose) {
          this.beforeClose({
            position: position,
            name: this.name,
            instance: this
          });
        } else if (this.onClose) {
          this.onClose(position, this, {
            name: this.name
          });
        } else {
          this.close(position);
        }
      }
    },
    getClickHandler: function getClickHandler(position, stop) {
      var _this2 = this;
      return function (event) {
        if (stop) {
          event.stopPropagation();
        }
        _this2.onClick(position);
      };
    },
    genLeftPart: function genLeftPart() {
      var h = this.$createElement;
      var content = this.slots('left');
      if (content) {
        return h("div", {
          "ref": "left",
          "class": bem$4('left'),
          "on": {
            "click": this.getClickHandler('left', true)
          }
        }, [content]);
      }
    },
    genRightPart: function genRightPart() {
      var h = this.$createElement;
      var content = this.slots('right');
      if (content) {
        return h("div", {
          "ref": "right",
          "class": bem$4('right'),
          "on": {
            "click": this.getClickHandler('right', true)
          }
        }, [content]);
      }
    }
  },
  render: function render() {
    var h = arguments[0];
    var wrapperStyle = {
      transform: "translate3d(" + this.offset + "px, 0, 0)",
      transitionDuration: this.dragging ? '0s' : '.6s'
    };
    return h("div", {
      "class": bem$4(),
      "on": {
        "click": this.getClickHandler('cell')
      }
    }, [h("div", {
      "class": bem$4('wrapper'),
      "style": wrapperStyle
    }, [this.genLeftPart(), this.slots(), this.genRightPart()])]);
  }
});

var _createNamespace$3 = createNamespace('switch-cell'),
  createComponent$3 = _createNamespace$3[0],
  bem$3 = _createNamespace$3[1];
function SwitchCell(h, props, slots, ctx) {
  return h(Cell$1, _mergeJSXProps([{
    "attrs": {
      "center": true,
      "size": props.cellSize,
      "title": props.title,
      "border": props.border
    },
    "class": bem$3([props.cellSize])
  }, inherit(ctx)]), [h(Switch, {
    "props": _extends$1({}, props),
    "on": _extends$1({}, ctx.listeners)
  })]);
}
SwitchCell.props = _extends$1({}, switchProps, {
  title: String,
  cellSize: String,
  border: {
    type: Boolean,
    default: true
  },
  size: {
    type: String,
    default: '24px'
  }
});
var SwitchCell$1 = createComponent$3(SwitchCell);

var _createNamespace$2 = createNamespace('tabbar'),
  createComponent$2 = _createNamespace$2[0],
  bem$2 = _createNamespace$2[1];
var Tabbar = createComponent$2({
  mixins: [ParentMixin('vanTabbar')],
  props: {
    route: Boolean,
    zIndex: [Number, String],
    placeholder: Boolean,
    activeColor: String,
    beforeChange: Function,
    inactiveColor: String,
    value: {
      type: [Number, String],
      default: 0
    },
    border: {
      type: Boolean,
      default: true
    },
    fixed: {
      type: Boolean,
      default: true
    },
    safeAreaInsetBottom: {
      type: Boolean,
      default: null
    }
  },
  data: function data() {
    return {
      height: null
    };
  },
  computed: {
    fit: function fit() {
      if (this.safeAreaInsetBottom !== null) {
        return this.safeAreaInsetBottom;
      } // enable safe-area-inset-bottom by default when fixed

      return this.fixed;
    }
  },
  watch: {
    value: 'setActiveItem',
    children: 'setActiveItem'
  },
  mounted: function mounted() {
    var _this = this;
    if (this.placeholder && this.fixed) {
      var setHeight = function setHeight() {
        _this.height = _this.$refs.tabbar.getBoundingClientRect().height;
      };
      setHeight(); // https://github.com/vant-ui/vant/issues/10131

      setTimeout(setHeight, 100);
    }
  },
  methods: {
    setActiveItem: function setActiveItem() {
      var _this2 = this;
      this.children.forEach(function (item, index) {
        item.nameMatched = item.name === _this2.value || index === _this2.value;
      });
    },
    triggerChange: function triggerChange(active, afterChange) {
      var _this3 = this;
      callInterceptor({
        interceptor: this.beforeChange,
        args: [active],
        done: function done() {
          _this3.$emit('input', active);
          _this3.$emit('change', active);
          afterChange();
        }
      });
    },
    genTabbar: function genTabbar() {
      var _ref;
      var h = this.$createElement;
      return h("div", {
        "ref": "tabbar",
        "style": {
          zIndex: this.zIndex
        },
        "class": [(_ref = {}, _ref[BORDER_TOP_BOTTOM] = this.border, _ref), bem$2({
          unfit: !this.fit,
          fixed: this.fixed
        })]
      }, [this.slots()]);
    }
  },
  render: function render() {
    var h = arguments[0];
    if (this.placeholder && this.fixed) {
      return h("div", {
        "class": bem$2('placeholder'),
        "style": {
          height: this.height + "px"
        }
      }, [this.genTabbar()]);
    }
    return this.genTabbar();
  }
});

var _createNamespace$1 = createNamespace('tabbar-item'),
  createComponent$1 = _createNamespace$1[0],
  bem$1 = _createNamespace$1[1];
var TabbarItem = createComponent$1({
  mixins: [ChildrenMixin('vanTabbar')],
  props: _extends$1({}, routeProps, {
    dot: Boolean,
    icon: String,
    name: [Number, String],
    // @deprecated
    info: [Number, String],
    badge: [Number, String],
    iconPrefix: String
  }),
  data: function data() {
    return {
      nameMatched: false
    };
  },
  computed: {
    active: function active() {
      var routeMode = this.parent.route;
      if (routeMode && '$route' in this) {
        var to = this.to,
          $route = this.$route;
        var config = isObject$6(to) ? to : {
          path: to
        };
        return !!$route.matched.find(function (r) {
          // vue-router 3.x $route.matched[0].path is empty in / and its children paths
          var path = r.path === '' ? '/' : r.path;
          var pathMatched = config.path === path;
          var nameMatched = isDef$1(config.name) && config.name === r.name;
          return pathMatched || nameMatched;
        });
      }
      return this.nameMatched;
    }
  },
  methods: {
    onClick: function onClick(event) {
      var _this = this;
      if (!this.active) {
        this.parent.triggerChange(this.name || this.index, function () {
          route(_this.$router, _this);
        });
      }
      this.$emit('click', event);
    },
    genIcon: function genIcon() {
      var h = this.$createElement;
      var slot = this.slots('icon', {
        active: this.active
      });
      if (slot) {
        return slot;
      }
      if (this.icon) {
        return h(Icon$3, {
          "attrs": {
            "name": this.icon,
            "classPrefix": this.iconPrefix
          }
        });
      }
    }
  },
  render: function render() {
    var _this$badge;
    var h = arguments[0];
    var active = this.active;
    var color = this.parent[active ? 'activeColor' : 'inactiveColor'];
    return h("div", {
      "class": bem$1({
        active: active
      }),
      "style": {
        color: color
      },
      "on": {
        "click": this.onClick
      }
    }, [h("div", {
      "class": bem$1('icon')
    }, [this.genIcon(), h(Info$1, {
      "attrs": {
        "dot": this.dot,
        "info": (_this$badge = this.badge) != null ? _this$badge : this.info
      }
    })]), h("div", {
      "class": bem$1('text')
    }, [this.slots('default', {
      active: active
    })])]);
  }
});

var _createNamespace = createNamespace('tree-select'),
  createComponent = _createNamespace[0],
  bem = _createNamespace[1];
function TreeSelect(h, props, slots, ctx) {
  var items = props.items,
    height = props.height,
    activeId = props.activeId,
    selectedIcon = props.selectedIcon,
    mainActiveIndex = props.mainActiveIndex;
  var selectedItem = items[+mainActiveIndex] || {};
  var subItems = selectedItem.children || [];
  var isMultiple = Array.isArray(activeId);
  function isActiveItem(id) {
    return isMultiple ? activeId.indexOf(id) !== -1 : activeId === id;
  }
  var Navs = items.map(function (item) {
    var _item$badge;
    return h(SidebarItem, {
      "attrs": {
        "dot": item.dot,
        "info": (_item$badge = item.badge) != null ? _item$badge : item.info,
        "title": item.text,
        "disabled": item.disabled
      },
      "class": [bem('nav-item'), item.className]
    });
  });
  function Content() {
    if (slots.content) {
      return slots.content();
    }
    return subItems.map(function (item) {
      return h("div", {
        "key": item.id,
        "class": ['van-ellipsis', bem('item', {
          active: isActiveItem(item.id),
          disabled: item.disabled
        })],
        "on": {
          "click": function click() {
            if (!item.disabled) {
              var newActiveId = item.id;
              if (isMultiple) {
                newActiveId = activeId.slice();
                var index = newActiveId.indexOf(item.id);
                if (index !== -1) {
                  newActiveId.splice(index, 1);
                } else if (newActiveId.length < props.max) {
                  newActiveId.push(item.id);
                }
              }
              emit(ctx, 'update:active-id', newActiveId);
              emit(ctx, 'click-item', item); // compatible with legacy usage, should be removed in next major version

              emit(ctx, 'itemclick', item);
            }
          }
        }
      }, [item.text, isActiveItem(item.id) && h(Icon$3, {
        "attrs": {
          "name": selectedIcon
        },
        "class": bem('selected')
      })]);
    });
  }
  return h("div", _mergeJSXProps([{
    "class": bem(),
    "style": {
      height: addUnit(height)
    }
  }, inherit(ctx)]), [h(Sidebar, {
    "class": bem('nav'),
    "attrs": {
      "activeKey": mainActiveIndex
    },
    "on": {
      "change": function change(index) {
        emit(ctx, 'update:main-active-index', index);
        emit(ctx, 'click-nav', index); // compatible with legacy usage, should be removed in next major version

        emit(ctx, 'navclick', index);
      }
    }
  }, [Navs]), h("div", {
    "class": bem('content')
  }, [Content()])]);
}
TreeSelect.props = {
  max: {
    type: [Number, String],
    default: Infinity
  },
  items: {
    type: Array,
    default: function _default() {
      return [];
    }
  },
  height: {
    type: [Number, String],
    default: 300
  },
  activeId: {
    type: [Number, String, Array],
    default: 0
  },
  selectedIcon: {
    type: String,
    default: 'success'
  },
  mainActiveIndex: {
    type: [Number, String],
    default: 0
  }
};
var TreeSelect$1 = createComponent(TreeSelect);

function install$V(Vue) {
  var components = [ActionSheet$1, AddressEdit, AddressList$1, Area, Badge, Button$2, Calendar$2, Card$1, Cascader, Cell$1, CellGroup$1, Checkbox, CheckboxGroup, Circle$2, Col, Collapse, CollapseItem, ContactCard$1, ContactEdit, ContactList$1, CountDown, Coupon, CouponCell$1, CouponList, DatetimePicker, Dialog, Divider$1, DropdownItem, DropdownMenu, Empty, Field, Form, GoodsAction, GoodsActionButton, GoodsActionIcon, Grid$2, GridItem, Icon$3, Image$1, ImagePreview$1, IndexAnchor, IndexBar, Info$1, List, Loading$1, Locale$1, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay$1, Pagination, Panel$1, PasswordInput$1, Picker, Popover, Popup, Progress, PullRefresh, Radio, RadioGroup, Rate, Row, Search$1, ShareSheet, Sidebar, SidebarItem, Skeleton$2, Sku, Slider$1, Step, Stepper, Steps, Sticky, SubmitBar$1, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell$1, Tab, Tabbar, TabbarItem, Tabs, Tag$1, Toast, TreeSelect$1, Uploader];
  components.forEach(function (item) {
    if (item.install) {
      Vue.use(item);
    } else if (item.name) {
      Vue.component(item.name, item);
    }
  });
}
if (typeof window !== 'undefined' && window.Vue) {
  install$V(window.Vue);
}

var enUS = createCommonjsModule(function (module, exports) {
(function (global, factory) {
  {
    factory(exports);
  }
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : commonjsGlobal, function (_exports) {

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.default = void 0;
  var _default = {
    pagination: {
      goto: "Go to",
      page: "",
      itemsPerPage: " / page",
      total: function total(_total) {
        return "Total " + _total;
      },
      prev5: "Previous 5 Pages",
      next5: "Next 5 Pages"
    },
    table: {
      confirmFilter: "Confirm",
      resetFilter: "Reset",
      cut: "Cut",
      copy: "Copy",
      insertRowAbove: "Insert row above",
      insertRowBelow: "Insert row below",
      removeRow: "Remove $1 row",
      emptyRow: "Empty $1 row",
      emptyColumn: "Empty $1 column",
      emptyCell: "Empty cell",
      leftFixedColumnTo: "Left fixed column to",
      cancelLeftFixedColumnTo: "Cancel left fixed column to",
      rightFixedColumnTo: "Right fixed column to",
      cancelRightFixedColumnTo: "Cancel right fixed column to"
    }
  };
  _exports.default = _default;
});
});

unwrapExports(enUS);

var veLocale = createCommonjsModule(function (module) {
module.exports = function (e) {
  var t = {};
  function n(r) {
    if (t[r]) return t[r].exports;
    var o = t[r] = {
      i: r,
      l: !1,
      exports: {}
    };
    return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports;
  }
  return n.m = e, n.c = t, n.d = function (e, t, r) {
    n.o(e, t) || Object.defineProperty(e, t, {
      enumerable: !0,
      get: r
    });
  }, n.r = function (e) {
    "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
      value: "Module"
    }), Object.defineProperty(e, "__esModule", {
      value: !0
    });
  }, n.t = function (e, t) {
    if (1 & t && (e = n(e)), 8 & t) return e;
    if (4 & t && "object" == typeof e && e && e.__esModule) return e;
    var r = Object.create(null);
    if (n.r(r), Object.defineProperty(r, "default", {
      enumerable: !0,
      value: e
    }), 2 & t && "string" != typeof e) for (var o in e) n.d(r, o, function (t) {
      return e[t];
    }.bind(null, o));
    return r;
  }, n.n = function (e) {
    var t = e && e.__esModule ? function () {
      return e.default;
    } : function () {
      return e;
    };
    return n.d(t, "a", t), t;
  }, n.o = function (e, t) {
    return Object.prototype.hasOwnProperty.call(e, t);
  }, n.p = "", n(n.s = 161);
}({
  121: function (e, t) {
    e.exports = Vue;
  },
  156: function (e, t) {
    e.exports = enUS;
  },
  161: function (e, t, n) {

    n.r(t);
    var r = n(121),
      o = n.n(r),
      u = n(69),
      a = n(156),
      l = n.n(a),
      i = o.a.util.defineReactive,
      s = o.a.prototype;
    s.$veTableMessages = s.$veTableMessages || {}, i(s, "$veTableMessages", Object(u.cloneDeep)({
      lang: l.a
    })), t.default = {
      getMessage: function () {
        return s.$veTableMessages.lang;
      },
      use: function (e) {
        this.update(e);
      },
      update: function () {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
        Object(u.merge)(s.$veTableMessages.lang, e);
      }
    };
  },
  69: function (e, t) {
    e.exports = lodash;
  }
});
});

unwrapExports(veLocale);

var veIcon = createCommonjsModule(function (module) {
module.exports = function (t) {
  var r = {};
  function n(e) {
    if (r[e]) return r[e].exports;
    var o = r[e] = {
      i: e,
      l: !1,
      exports: {}
    };
    return t[e].call(o.exports, o, o.exports, n), o.l = !0, o.exports;
  }
  return n.m = t, n.c = r, n.d = function (t, r, e) {
    n.o(t, r) || Object.defineProperty(t, r, {
      enumerable: !0,
      get: e
    });
  }, n.r = function (t) {
    "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
      value: "Module"
    }), Object.defineProperty(t, "__esModule", {
      value: !0
    });
  }, n.t = function (t, r) {
    if (1 & r && (t = n(t)), 8 & r) return t;
    if (4 & r && "object" == typeof t && t && t.__esModule) return t;
    var e = Object.create(null);
    if (n.r(e), Object.defineProperty(e, "default", {
      enumerable: !0,
      value: t
    }), 2 & r && "string" != typeof t) for (var o in t) n.d(e, o, function (r) {
      return t[r];
    }.bind(null, o));
    return e;
  }, n.n = function (t) {
    var r = t && t.__esModule ? function () {
      return t.default;
    } : function () {
      return t;
    };
    return n.d(r, "a", r), r;
  }, n.o = function (t, r) {
    return Object.prototype.hasOwnProperty.call(t, r);
  }, n.p = "", n(n.s = 192);
}([function (t, r, n) {

  n.d(r, "a", function () {
    return i;
  }), n.d(r, "g", function () {
    return u;
  }), n.d(r, "h", function () {
    return c;
  }), n.d(r, "f", function () {
    return f;
  }), n.d(r, "i", function () {
    return a;
  }), n.d(r, "e", function () {
    return s;
  }), n.d(r, "j", function () {
    return l;
  }), n.d(r, "d", function () {
    return p;
  }), n.d(r, "c", function () {
    return v;
  }), n.d(r, "b", function () {
    return y;
  }), n.d(r, "k", function () {
    return d;
  });
  n(41), n(54), n(76), n(93), n(64), n(95), n(57), n(88), n(90), n(84);
  var e = n(79),
    o = n.n(e);
  function i(t) {
    return function (t) {
      return function (r) {
        var n = "",
          e = o.a.getMessage();
        if (e[t]) {
          for (var i = e[t][r], u = arguments.length, c = new Array(u > 1 ? u - 1 : 0), f = 1; f < u; f++) c[f - 1] = arguments[f];
          n = a(i) ? i.apply(void 0, c) : i;
        } else console.error("can't find ".concat(t, " in ").concat(JSON.stringify(e)));
        return n;
      };
    }(t);
  }
  function u(t) {
    return !(Array.isArray(t) && t.length > 0);
  }
  function c(t) {
    return !("" !== t && null != t);
  }
  function f(t) {
    return null != t;
  }
  function a(t) {
    return "function" == typeof t;
  }
  function s(t) {
    return "boolean" == typeof t;
  }
  function l(t) {
    return "number" == typeof t;
  }
  function p(t) {
    return "number" == typeof t ? t + "px" : t;
  }
  function v(t, r) {
    for (var n = t.$parent; n;) {
      if (n.$options.name === r) return n;
      n = n.$parent;
    }
    return null;
  }
  function y(t, r) {
    for (var n = [], e = t.$children; e && e.length > 0;) e.forEach(function (t) {
      e = t.$children ? t.$children : null, t.$options.name === r && n.push(t);
    });
    return n;
  }
  function d(t, r) {
    if (a(t.scrollTo)) t.scrollTo(r);else {
      var n = r.top,
        e = r.left;
      t.scrollTop = n, t.scrollLeft = e;
    }
  }
}, function (t, r, n) {
  (function (r) {
    var n = function (t) {
      return t && t.Math == Math && t;
    };
    t.exports = n("object" == typeof globalThis && globalThis) || n("object" == typeof window && window) || n("object" == typeof self && self) || n("object" == typeof r && r) || function () {
      return this;
    }() || Function("return this")();
  }).call(this, n(73));
}, function (t, r) {
  t.exports = function (t) {
    try {
      return !!t();
    } catch (t) {
      return !0;
    }
  };
}, function (t, r, n) {
  var e = n(1),
    o = n(29),
    i = n(4),
    u = n(33),
    c = n(40),
    f = n(56),
    a = o("wks"),
    s = e.Symbol,
    l = f ? s : s && s.withoutSetter || u;
  t.exports = function (t) {
    return i(a, t) && (c || "string" == typeof a[t]) || (c && i(s, t) ? a[t] = s[t] : a[t] = l("Symbol." + t)), a[t];
  };
}, function (t, r, n) {
  var e = n(12),
    o = {}.hasOwnProperty;
  t.exports = function (t, r) {
    return o.call(e(t), r);
  };
}, function (t, r) {
  t.exports = function (t) {
    return "object" == typeof t ? null !== t : "function" == typeof t;
  };
}, function (t, r, n) {
  var e = n(7),
    o = n(47),
    i = n(9),
    u = n(17),
    c = Object.defineProperty;
  r.f = e ? c : function (t, r, n) {
    if (i(t), r = u(r, !0), i(n), o) try {
      return c(t, r, n);
    } catch (t) {}
    if ("get" in n || "set" in n) throw TypeError("Accessors not supported");
    return "value" in n && (t[r] = n.value), t;
  };
}, function (t, r, n) {
  var e = n(2);
  t.exports = !e(function () {
    return 7 != Object.defineProperty({}, 1, {
      get: function () {
        return 7;
      }
    })[1];
  });
}, function (t, r, n) {
  var e = n(1),
    o = n(19).f,
    i = n(10),
    u = n(14),
    c = n(32),
    f = n(61),
    a = n(51);
  t.exports = function (t, r) {
    var n,
      s,
      l,
      p,
      v,
      y = t.target,
      d = t.global,
      h = t.stat;
    if (n = d ? e : h ? e[y] || c(y, {}) : (e[y] || {}).prototype) for (s in r) {
      if (p = r[s], l = t.noTargetGet ? (v = o(n, s)) && v.value : n[s], !a(d ? s : y + (h ? "." : "#") + s, t.forced) && void 0 !== l) {
        if (typeof p == typeof l) continue;
        f(p, l);
      }
      (t.sham || l && l.sham) && i(p, "sham", !0), u(n, s, p, t);
    }
  };
}, function (t, r, n) {
  var e = n(5);
  t.exports = function (t) {
    if (!e(t)) throw TypeError(String(t) + " is not an object");
    return t;
  };
}, function (t, r, n) {
  var e = n(7),
    o = n(6),
    i = n(18);
  t.exports = e ? function (t, r, n) {
    return o.f(t, r, i(1, n));
  } : function (t, r, n) {
    return t[r] = n, t;
  };
}, function (t, r, n) {
  var e = n(35),
    o = n(13);
  t.exports = function (t) {
    return e(o(t));
  };
}, function (t, r, n) {
  var e = n(13);
  t.exports = function (t) {
    return Object(e(t));
  };
}, function (t, r) {
  t.exports = function (t) {
    if (null == t) throw TypeError("Can't call method on " + t);
    return t;
  };
}, function (t, r, n) {
  var e = n(1),
    o = n(10),
    i = n(4),
    u = n(32),
    c = n(46),
    f = n(26),
    a = f.get,
    s = f.enforce,
    l = String(String).split("String");
  (t.exports = function (t, r, n, c) {
    var f,
      a = !!c && !!c.unsafe,
      p = !!c && !!c.enumerable,
      v = !!c && !!c.noTargetGet;
    "function" == typeof n && ("string" != typeof r || i(n, "name") || o(n, "name", r), (f = s(n)).source || (f.source = l.join("string" == typeof r ? r : ""))), t !== e ? (a ? !v && t[r] && (p = !0) : delete t[r], p ? t[r] = n : o(t, r, n)) : p ? t[r] = n : u(r, n);
  })(Function.prototype, "toString", function () {
    return "function" == typeof this && a(this).source || c(this);
  });
}, function (t, r) {
  var n = {}.toString;
  t.exports = function (t) {
    return n.call(t).slice(8, -1);
  };
}, function (t, r, n) {
  var e = n(25),
    o = Math.min;
  t.exports = function (t) {
    return t > 0 ? o(e(t), 9007199254740991) : 0;
  };
}, function (t, r, n) {
  var e = n(5);
  t.exports = function (t, r) {
    if (!e(t)) return t;
    var n, o;
    if (r && "function" == typeof (n = t.toString) && !e(o = n.call(t))) return o;
    if ("function" == typeof (n = t.valueOf) && !e(o = n.call(t))) return o;
    if (!r && "function" == typeof (n = t.toString) && !e(o = n.call(t))) return o;
    throw TypeError("Can't convert object to primitive value");
  };
}, function (t, r) {
  t.exports = function (t, r) {
    return {
      enumerable: !(1 & t),
      configurable: !(2 & t),
      writable: !(4 & t),
      value: r
    };
  };
}, function (t, r, n) {
  var e = n(7),
    o = n(42),
    i = n(18),
    u = n(11),
    c = n(17),
    f = n(4),
    a = n(47),
    s = Object.getOwnPropertyDescriptor;
  r.f = e ? s : function (t, r) {
    if (t = u(t), r = c(r, !0), a) try {
      return s(t, r);
    } catch (t) {}
    if (f(t, r)) return i(!o.f.call(t, r), t[r]);
  };
}, function (t, r, n) {

  n.d(r, "b", function () {
    return e;
  }), n.d(r, "a", function () {
    return o;
  }), n.d(r, "c", function () {
    return i;
  });
  var e = {
      BACK_SPACE: 8,
      TAB: 9,
      ENTER: 13,
      SHIFT: 16,
      SPACE: 32,
      ARROW_LEFT: 37,
      ARROW_UP: 38,
      ARROW_RIGHT: 39,
      ARROW_DOWN: 40,
      DELETE: 46,
      F2: 113
    },
    o = {
      FILTER: "filter",
      DOUBLE_RIGHT_ARROW: "double-right-arrow",
      DOUBLE_LEFT_ARROW: "double-left-arrow",
      TOP_ARROW: "top-arrow",
      RIGHT_ARROW: "right-arrow",
      BOTTOM_ARROW: "bottom-arrow",
      LEFT_ARROW: "left-arrow",
      SORT_TOP_ARROW: "sort-top-arrow",
      SORT_BOTTOM_ARROW: "sort-bottom-arrow",
      SEARCH: "search"
    },
    i = {
      LEFT_MOUSE: 1,
      MIDDLE_MOUSE: 2,
      RIGHT_MOUSE: 2
    };
}, function (t, r) {
  t.exports = {};
}, function (t, r, n) {
  var e = n(53),
    o = n(1),
    i = function (t) {
      return "function" == typeof t ? t : void 0;
    };
  t.exports = function (t, r) {
    return arguments.length < 2 ? i(e[t]) || i(o[t]) : e[t] && e[t][r] || o[t] && o[t][r];
  };
}, function (t, r, n) {
  var e = n(29),
    o = n(33),
    i = e("keys");
  t.exports = function (t) {
    return i[t] || (i[t] = o(t));
  };
}, function (t, r) {
  t.exports = !1;
}, function (t, r) {
  var n = Math.ceil,
    e = Math.floor;
  t.exports = function (t) {
    return isNaN(t = +t) ? 0 : (t > 0 ? e : n)(t);
  };
}, function (t, r, n) {
  var e,
    o,
    i,
    u = n(80),
    c = n(1),
    f = n(5),
    a = n(10),
    s = n(4),
    l = n(30),
    p = n(23),
    v = n(21),
    y = c.WeakMap;
  if (u || l.state) {
    var d = l.state || (l.state = new y()),
      h = d.get,
      g = d.has,
      b = d.set;
    e = function (t, r) {
      if (g.call(d, t)) throw new TypeError("Object already initialized");
      return r.facade = t, b.call(d, t, r), r;
    }, o = function (t) {
      return h.call(d, t) || {};
    }, i = function (t) {
      return g.call(d, t);
    };
  } else {
    var m = p("state");
    v[m] = !0, e = function (t, r) {
      if (s(t, m)) throw new TypeError("Object already initialized");
      return r.facade = t, a(t, m, r), r;
    }, o = function (t) {
      return s(t, m) ? t[m] : {};
    }, i = function (t) {
      return s(t, m);
    };
  }
  t.exports = {
    set: e,
    get: o,
    has: i,
    enforce: function (t) {
      return i(t) ? o(t) : e(t, {});
    },
    getterFor: function (t) {
      return function (r) {
        var n;
        if (!f(r) || (n = o(r)).type !== t) throw TypeError("Incompatible receiver, " + t + " required");
        return n;
      };
    }
  };
}, function (t, r, n) {
  var e = n(48),
    o = n(31).concat("length", "prototype");
  r.f = Object.getOwnPropertyNames || function (t) {
    return e(t, o);
  };
}, function (t, r, n) {
  var e,
    o = n(9),
    i = n(81),
    u = n(31),
    c = n(21),
    f = n(74),
    a = n(45),
    s = n(23),
    l = s("IE_PROTO"),
    p = function () {},
    v = function (t) {
      return "<script>" + t + "<\/script>";
    },
    y = function () {
      try {
        e = document.domain && new ActiveXObject("htmlfile");
      } catch (t) {}
      var t, r;
      y = e ? function (t) {
        t.write(v("")), t.close();
        var r = t.parentWindow.Object;
        return t = null, r;
      }(e) : ((r = a("iframe")).style.display = "none", f.appendChild(r), r.src = String("javascript:"), (t = r.contentWindow.document).open(), t.write(v("document.F=Object")), t.close(), t.F);
      for (var n = u.length; n--;) delete y.prototype[u[n]];
      return y();
    };
  c[l] = !0, t.exports = Object.create || function (t, r) {
    var n;
    return null !== t ? (p.prototype = o(t), n = new p(), p.prototype = null, n[l] = t) : n = y(), void 0 === r ? n : i(n, r);
  };
}, function (t, r, n) {
  var e = n(24),
    o = n(30);
  (t.exports = function (t, r) {
    return o[t] || (o[t] = void 0 !== r ? r : {});
  })("versions", []).push({
    version: "3.13.0",
    mode: e ? "pure" : "global",
    copyright: "© 2021 Denis Pushkarev (zloirock.ru)"
  });
}, function (t, r, n) {
  var e = n(1),
    o = n(32),
    i = e["__core-js_shared__"] || o("__core-js_shared__", {});
  t.exports = i;
}, function (t, r) {
  t.exports = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
}, function (t, r, n) {
  var e = n(1),
    o = n(10);
  t.exports = function (t, r) {
    try {
      o(e, t, r);
    } catch (n) {
      e[t] = r;
    }
    return r;
  };
}, function (t, r) {
  var n = 0,
    e = Math.random();
  t.exports = function (t) {
    return "Symbol(" + String(void 0 === t ? "" : t) + ")_" + (++n + e).toString(36);
  };
}, function (t, r, n) {
  var e = n(70),
    o = n(35),
    i = n(12),
    u = n(16),
    c = n(55),
    f = [].push,
    a = function (t) {
      var r = 1 == t,
        n = 2 == t,
        a = 3 == t,
        s = 4 == t,
        l = 6 == t,
        p = 7 == t,
        v = 5 == t || l;
      return function (y, d, h, g) {
        for (var b, m, S = i(y), O = o(S), x = e(d, h, 3), w = u(O.length), T = 0, E = g || c, j = r ? E(y, w) : n || p ? E(y, 0) : void 0; w > T; T++) if ((v || T in O) && (m = x(b = O[T], T, S), t)) if (r) j[T] = m;else if (m) switch (t) {
          case 3:
            return !0;
          case 5:
            return b;
          case 6:
            return T;
          case 2:
            f.call(j, b);
        } else switch (t) {
          case 4:
            return !1;
          case 7:
            f.call(j, b);
        }
        return l ? -1 : a || s ? s : j;
      };
    };
  t.exports = {
    forEach: a(0),
    map: a(1),
    filter: a(2),
    some: a(3),
    every: a(4),
    find: a(5),
    findIndex: a(6),
    filterOut: a(7)
  };
}, function (t, r, n) {
  var e = n(2),
    o = n(15),
    i = "".split;
  t.exports = e(function () {
    return !Object("z").propertyIsEnumerable(0);
  }) ? function (t) {
    return "String" == o(t) ? i.call(t, "") : Object(t);
  } : Object;
}, function (t, r, n) {
  var e = n(48),
    o = n(31);
  t.exports = Object.keys || function (t) {
    return e(t, o);
  };
}, function (t, r, n) {
  var e,
    o,
    i = n(1),
    u = n(82),
    c = i.process,
    f = c && c.versions,
    a = f && f.v8;
  a ? o = (e = a.split("."))[0] < 4 ? 1 : e[0] + e[1] : u && (!(e = u.match(/Edge\/(\d+)/)) || e[1] >= 74) && (e = u.match(/Chrome\/(\d+)/)) && (o = e[1]), t.exports = o && +o;
}, function (t, r, n) {

  var e = n(7),
    o = n(1),
    i = n(51),
    u = n(14),
    c = n(4),
    f = n(15),
    a = n(92),
    s = n(17),
    l = n(2),
    p = n(28),
    v = n(27).f,
    y = n(19).f,
    d = n(6).f,
    h = n(96).trim,
    g = o.Number,
    b = g.prototype,
    m = "Number" == f(p(b)),
    S = function (t) {
      var r,
        n,
        e,
        o,
        i,
        u,
        c,
        f,
        a = s(t, !1);
      if ("string" == typeof a && a.length > 2) if (43 === (r = (a = h(a)).charCodeAt(0)) || 45 === r) {
        if (88 === (n = a.charCodeAt(2)) || 120 === n) return NaN;
      } else if (48 === r) {
        switch (a.charCodeAt(1)) {
          case 66:
          case 98:
            e = 2, o = 49;
            break;
          case 79:
          case 111:
            e = 8, o = 55;
            break;
          default:
            return +a;
        }
        for (u = (i = a.slice(2)).length, c = 0; c < u; c++) if ((f = i.charCodeAt(c)) < 48 || f > o) return NaN;
        return parseInt(i, e);
      }
      return +a;
    };
  if (i("Number", !g(" 0o1") || !g("0b1") || g("+0x1"))) {
    for (var O, x = function (t) {
        var r = arguments.length < 1 ? 0 : t,
          n = this;
        return n instanceof x && (m ? l(function () {
          b.valueOf.call(n);
        }) : "Number" != f(n)) ? a(new g(S(r)), n, x) : S(r);
      }, w = e ? v(g) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","), T = 0; w.length > T; T++) c(g, O = w[T]) && !c(x, O) && d(x, O, y(g, O));
    x.prototype = b, b.constructor = x, u(o, "Number", x);
  }
}, function (t, r, n) {
  var e = n(15);
  t.exports = Array.isArray || function (t) {
    return "Array" == e(t);
  };
}, function (t, r, n) {
  var e = n(37),
    o = n(2);
  t.exports = !!Object.getOwnPropertySymbols && !o(function () {
    return !String(Symbol()) || !Symbol.sham && e && e < 41;
  });
}, function (t, r, n) {
  var e = n(7),
    o = n(6).f,
    i = Function.prototype,
    u = i.toString,
    c = /^\s*function ([^ (]*)/;
  e && !("name" in i) && o(i, "name", {
    configurable: !0,
    get: function () {
      try {
        return u.call(this).match(c)[1];
      } catch (t) {
        return "";
      }
    }
  });
}, function (t, r, n) {

  var e = {}.propertyIsEnumerable,
    o = Object.getOwnPropertyDescriptor,
    i = o && !e.call({
      1: 2
    }, 1);
  r.f = i ? function (t) {
    var r = o(this, t);
    return !!r && r.enumerable;
  } : e;
}, function (t, r, n) {
  var e = n(6).f,
    o = n(4),
    i = n(3)("toStringTag");
  t.exports = function (t, r, n) {
    t && !o(t = n ? t : t.prototype, i) && e(t, i, {
      configurable: !0,
      value: r
    });
  };
}, function (t, r, n) {
  var e = {};
  e[n(3)("toStringTag")] = "z", t.exports = "[object z]" === String(e);
}, function (t, r, n) {
  var e = n(1),
    o = n(5),
    i = e.document,
    u = o(i) && o(i.createElement);
  t.exports = function (t) {
    return u ? i.createElement(t) : {};
  };
}, function (t, r, n) {
  var e = n(30),
    o = Function.toString;
  "function" != typeof e.inspectSource && (e.inspectSource = function (t) {
    return o.call(t);
  }), t.exports = e.inspectSource;
}, function (t, r, n) {
  var e = n(7),
    o = n(2),
    i = n(45);
  t.exports = !e && !o(function () {
    return 7 != Object.defineProperty(i("div"), "a", {
      get: function () {
        return 7;
      }
    }).a;
  });
}, function (t, r, n) {
  var e = n(4),
    o = n(11),
    i = n(62).indexOf,
    u = n(21);
  t.exports = function (t, r) {
    var n,
      c = o(t),
      f = 0,
      a = [];
    for (n in c) !e(u, n) && e(c, n) && a.push(n);
    for (; r.length > f;) e(c, n = r[f++]) && (~i(a, n) || a.push(n));
    return a;
  };
}, function (t, r) {
  r.f = Object.getOwnPropertySymbols;
}, function (t, r) {
  t.exports = {};
}, function (t, r, n) {
  var e = n(2),
    o = /#|\.prototype\./,
    i = function (t, r) {
      var n = c[u(t)];
      return n == a || n != f && ("function" == typeof r ? e(r) : !!r);
    },
    u = i.normalize = function (t) {
      return String(t).replace(o, ".").toLowerCase();
    },
    c = i.data = {},
    f = i.NATIVE = "N",
    a = i.POLYFILL = "P";
  t.exports = i;
}, function (t, r, n) {
  var e = n(2),
    o = n(3),
    i = n(37),
    u = o("species");
  t.exports = function (t) {
    return i >= 51 || !e(function () {
      var r = [];
      return (r.constructor = {})[u] = function () {
        return {
          foo: 1
        };
      }, 1 !== r[t](Boolean).foo;
    });
  };
}, function (t, r, n) {
  var e = n(1);
  t.exports = e;
}, function (t, r, n) {
  var e = n(1),
    o = n(66),
    i = n(98),
    u = n(10);
  for (var c in o) {
    var f = e[c],
      a = f && f.prototype;
    if (a && a.forEach !== i) try {
      u(a, "forEach", i);
    } catch (t) {
      a.forEach = i;
    }
  }
}, function (t, r, n) {
  var e = n(5),
    o = n(39),
    i = n(3)("species");
  t.exports = function (t, r) {
    var n;
    return o(t) && ("function" != typeof (n = t.constructor) || n !== Array && !o(n.prototype) ? e(n) && null === (n = n[i]) && (n = void 0) : n = void 0), new (void 0 === n ? Array : n)(0 === r ? 0 : r);
  };
}, function (t, r, n) {
  var e = n(40);
  t.exports = e && !Symbol.sham && "symbol" == typeof Symbol.iterator;
}, function (t, r, n) {

  var e = n(11),
    o = n(65),
    i = n(50),
    u = n(26),
    c = n(71),
    f = u.set,
    a = u.getterFor("Array Iterator");
  t.exports = c(Array, "Array", function (t, r) {
    f(this, {
      type: "Array Iterator",
      target: e(t),
      index: 0,
      kind: r
    });
  }, function () {
    var t = a(this),
      r = t.target,
      n = t.kind,
      e = t.index++;
    return !r || e >= r.length ? (t.target = void 0, {
      value: void 0,
      done: !0
    }) : "keys" == n ? {
      value: e,
      done: !1
    } : "values" == n ? {
      value: r[e],
      done: !1
    } : {
      value: [e, r[e]],
      done: !1
    };
  }, "values"), i.Arguments = i.Array, o("keys"), o("values"), o("entries");
}, function (t, r, n) {
  var e = n(9),
    o = n(91);
  t.exports = Object.setPrototypeOf || ("__proto__" in {} ? function () {
    var t,
      r = !1,
      n = {};
    try {
      (t = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set).call(n, []), r = n instanceof Array;
    } catch (t) {}
    return function (n, i) {
      return e(n), o(i), r ? t.call(n, i) : n.__proto__ = i, n;
    };
  }() : void 0);
}, function (t, r, n) {
  var e = n(25),
    o = Math.max,
    i = Math.min;
  t.exports = function (t, r) {
    var n = e(t);
    return n < 0 ? o(n + r, 0) : i(n, r);
  };
}, function (t, r) {
  t.exports = function (t) {
    if ("function" != typeof t) throw TypeError(String(t) + " is not a function");
    return t;
  };
}, function (t, r, n) {
  var e = n(4),
    o = n(83),
    i = n(19),
    u = n(6);
  t.exports = function (t, r) {
    for (var n = o(r), c = u.f, f = i.f, a = 0; a < n.length; a++) {
      var s = n[a];
      e(t, s) || c(t, s, f(r, s));
    }
  };
}, function (t, r, n) {
  var e = n(11),
    o = n(16),
    i = n(59),
    u = function (t) {
      return function (r, n, u) {
        var c,
          f = e(r),
          a = o(f.length),
          s = i(u, a);
        if (t && n != n) {
          for (; a > s;) if ((c = f[s++]) != c) return !0;
        } else for (; a > s; s++) if ((t || s in f) && f[s] === n) return t || s || 0;
        return !t && -1;
      };
    };
  t.exports = {
    includes: u(!0),
    indexOf: u(!1)
  };
}, function (t, r, n) {
  var e = n(3);
  r.f = e;
}, function (t, r, n) {
  var e = n(44),
    o = n(14),
    i = n(100);
  e || o(Object.prototype, "toString", i, {
    unsafe: !0
  });
}, function (t, r, n) {
  var e = n(3),
    o = n(28),
    i = n(6),
    u = e("unscopables"),
    c = Array.prototype;
  null == c[u] && i.f(c, u, {
    configurable: !0,
    value: o(null)
  }), t.exports = function (t) {
    c[u][t] = !0;
  };
}, function (t, r) {
  t.exports = {
    CSSRuleList: 0,
    CSSStyleDeclaration: 0,
    CSSValueList: 0,
    ClientRectList: 0,
    DOMRectList: 0,
    DOMStringList: 0,
    DOMTokenList: 1,
    DataTransferItemList: 0,
    FileList: 0,
    HTMLAllCollection: 0,
    HTMLCollection: 0,
    HTMLFormElement: 0,
    HTMLSelectElement: 0,
    MediaList: 0,
    MimeTypeArray: 0,
    NamedNodeMap: 0,
    NodeList: 1,
    PaintRequestList: 0,
    Plugin: 0,
    PluginArray: 0,
    SVGLengthList: 0,
    SVGNumberList: 0,
    SVGPathSegList: 0,
    SVGPointList: 0,
    SVGStringList: 0,
    SVGTransformList: 0,
    SourceBufferList: 0,
    StyleSheetList: 0,
    TextTrackCueList: 0,
    TextTrackList: 0,
    TouchList: 0
  };
}, function (t, r, n) {
  var e = n(53),
    o = n(4),
    i = n(63),
    u = n(6).f;
  t.exports = function (t) {
    var r = e.Symbol || (e.Symbol = {});
    o(r, t) || u(r, t, {
      value: i.f(t)
    });
  };
},,, function (t, r, n) {
  var e = n(60);
  t.exports = function (t, r, n) {
    if (e(t), void 0 === r) return t;
    switch (n) {
      case 0:
        return function () {
          return t.call(r);
        };
      case 1:
        return function (n) {
          return t.call(r, n);
        };
      case 2:
        return function (n, e) {
          return t.call(r, n, e);
        };
      case 3:
        return function (n, e, o) {
          return t.call(r, n, e, o);
        };
    }
    return function () {
      return t.apply(r, arguments);
    };
  };
}, function (t, r, n) {

  var e = n(8),
    o = n(102),
    i = n(78),
    u = n(58),
    c = n(43),
    f = n(10),
    a = n(14),
    s = n(3),
    l = n(24),
    p = n(50),
    v = n(77),
    y = v.IteratorPrototype,
    d = v.BUGGY_SAFARI_ITERATORS,
    h = s("iterator"),
    g = function () {
      return this;
    };
  t.exports = function (t, r, n, s, v, b, m) {
    o(n, r, s);
    var S,
      O,
      x,
      w = function (t) {
        if (t === v && _) return _;
        if (!d && t in j) return j[t];
        switch (t) {
          case "keys":
          case "values":
          case "entries":
            return function () {
              return new n(this, t);
            };
        }
        return function () {
          return new n(this);
        };
      },
      T = r + " Iterator",
      E = !1,
      j = t.prototype,
      A = j[h] || j["@@iterator"] || v && j[v],
      _ = !d && A || w(v),
      I = "Array" == r && j.entries || A;
    if (I && (S = i(I.call(new t())), y !== Object.prototype && S.next && (l || i(S) === y || (u ? u(S, y) : "function" != typeof S[h] && f(S, h, g)), c(S, T, !0, !0), l && (p[T] = g))), "values" == v && A && "values" !== A.name && (E = !0, _ = function () {
      return A.call(this);
    }), l && !m || j[h] === _ || f(j, h, _), p[r] = _, v) if (O = {
      values: w("values"),
      keys: b ? _ : w("keys"),
      entries: w("entries")
    }, m) for (x in O) (d || E || !(x in j)) && a(j, x, O[x]);else e({
      target: r,
      proto: !0,
      forced: d || E
    }, O);
    return O;
  };
}, function (t, r, n) {

  var e = n(17),
    o = n(6),
    i = n(18);
  t.exports = function (t, r, n) {
    var u = e(r);
    u in t ? o.f(t, u, i(0, n)) : t[u] = n;
  };
}, function (t, r) {
  var n;
  n = function () {
    return this;
  }();
  try {
    n = n || new Function("return this")();
  } catch (t) {
    "object" == typeof window && (n = window);
  }
  t.exports = n;
}, function (t, r, n) {
  var e = n(22);
  t.exports = e("document", "documentElement");
}, function (t, r, n) {

  var e = n(2);
  t.exports = function (t, r) {
    var n = [][t];
    return !!n && e(function () {
      n.call(null, r || function () {
        throw 1;
      }, 1);
    });
  };
}, function (t, r, n) {

  var e = n(8),
    o = n(1),
    i = n(22),
    u = n(24),
    c = n(7),
    f = n(40),
    a = n(56),
    s = n(2),
    l = n(4),
    p = n(39),
    v = n(5),
    y = n(9),
    d = n(12),
    h = n(11),
    g = n(17),
    b = n(18),
    m = n(28),
    S = n(36),
    O = n(27),
    x = n(99),
    w = n(49),
    T = n(19),
    E = n(6),
    j = n(42),
    A = n(10),
    _ = n(14),
    I = n(29),
    R = n(23),
    P = n(21),
    L = n(33),
    N = n(3),
    M = n(63),
    F = n(67),
    C = n(43),
    k = n(26),
    G = n(34).forEach,
    W = R("hidden"),
    D = N("toPrimitive"),
    V = k.set,
    U = k.getterFor("Symbol"),
    z = Object.prototype,
    B = o.Symbol,
    H = i("JSON", "stringify"),
    $ = T.f,
    Y = E.f,
    q = x.f,
    J = j.f,
    X = I("symbols"),
    K = I("op-symbols"),
    Q = I("string-to-symbol-registry"),
    Z = I("symbol-to-string-registry"),
    tt = I("wks"),
    rt = o.QObject,
    nt = !rt || !rt.prototype || !rt.prototype.findChild,
    et = c && s(function () {
      return 7 != m(Y({}, "a", {
        get: function () {
          return Y(this, "a", {
            value: 7
          }).a;
        }
      })).a;
    }) ? function (t, r, n) {
      var e = $(z, r);
      e && delete z[r], Y(t, r, n), e && t !== z && Y(z, r, e);
    } : Y,
    ot = function (t, r) {
      var n = X[t] = m(B.prototype);
      return V(n, {
        type: "Symbol",
        tag: t,
        description: r
      }), c || (n.description = r), n;
    },
    it = a ? function (t) {
      return "symbol" == typeof t;
    } : function (t) {
      return Object(t) instanceof B;
    },
    ut = function (t, r, n) {
      t === z && ut(K, r, n), y(t);
      var e = g(r, !0);
      return y(n), l(X, e) ? (n.enumerable ? (l(t, W) && t[W][e] && (t[W][e] = !1), n = m(n, {
        enumerable: b(0, !1)
      })) : (l(t, W) || Y(t, W, b(1, {})), t[W][e] = !0), et(t, e, n)) : Y(t, e, n);
    },
    ct = function (t, r) {
      y(t);
      var n = h(r),
        e = S(n).concat(lt(n));
      return G(e, function (r) {
        c && !ft.call(n, r) || ut(t, r, n[r]);
      }), t;
    },
    ft = function (t) {
      var r = g(t, !0),
        n = J.call(this, r);
      return !(this === z && l(X, r) && !l(K, r)) && (!(n || !l(this, r) || !l(X, r) || l(this, W) && this[W][r]) || n);
    },
    at = function (t, r) {
      var n = h(t),
        e = g(r, !0);
      if (n !== z || !l(X, e) || l(K, e)) {
        var o = $(n, e);
        return !o || !l(X, e) || l(n, W) && n[W][e] || (o.enumerable = !0), o;
      }
    },
    st = function (t) {
      var r = q(h(t)),
        n = [];
      return G(r, function (t) {
        l(X, t) || l(P, t) || n.push(t);
      }), n;
    },
    lt = function (t) {
      var r = t === z,
        n = q(r ? K : h(t)),
        e = [];
      return G(n, function (t) {
        !l(X, t) || r && !l(z, t) || e.push(X[t]);
      }), e;
    };
  (f || (_((B = function () {
    if (this instanceof B) throw TypeError("Symbol is not a constructor");
    var t = arguments.length && void 0 !== arguments[0] ? String(arguments[0]) : void 0,
      r = L(t),
      n = function (t) {
        this === z && n.call(K, t), l(this, W) && l(this[W], r) && (this[W][r] = !1), et(this, r, b(1, t));
      };
    return c && nt && et(z, r, {
      configurable: !0,
      set: n
    }), ot(r, t);
  }).prototype, "toString", function () {
    return U(this).tag;
  }), _(B, "withoutSetter", function (t) {
    return ot(L(t), t);
  }), j.f = ft, E.f = ut, T.f = at, O.f = x.f = st, w.f = lt, M.f = function (t) {
    return ot(N(t), t);
  }, c && (Y(B.prototype, "description", {
    configurable: !0,
    get: function () {
      return U(this).description;
    }
  }), u || _(z, "propertyIsEnumerable", ft, {
    unsafe: !0
  }))), e({
    global: !0,
    wrap: !0,
    forced: !f,
    sham: !f
  }, {
    Symbol: B
  }), G(S(tt), function (t) {
    F(t);
  }), e({
    target: "Symbol",
    stat: !0,
    forced: !f
  }, {
    for: function (t) {
      var r = String(t);
      if (l(Q, r)) return Q[r];
      var n = B(r);
      return Q[r] = n, Z[n] = r, n;
    },
    keyFor: function (t) {
      if (!it(t)) throw TypeError(t + " is not a symbol");
      if (l(Z, t)) return Z[t];
    },
    useSetter: function () {
      nt = !0;
    },
    useSimple: function () {
      nt = !1;
    }
  }), e({
    target: "Object",
    stat: !0,
    forced: !f,
    sham: !c
  }, {
    create: function (t, r) {
      return void 0 === r ? m(t) : ct(m(t), r);
    },
    defineProperty: ut,
    defineProperties: ct,
    getOwnPropertyDescriptor: at
  }), e({
    target: "Object",
    stat: !0,
    forced: !f
  }, {
    getOwnPropertyNames: st,
    getOwnPropertySymbols: lt
  }), e({
    target: "Object",
    stat: !0,
    forced: s(function () {
      w.f(1);
    })
  }, {
    getOwnPropertySymbols: function (t) {
      return w.f(d(t));
    }
  }), H) && e({
    target: "JSON",
    stat: !0,
    forced: !f || s(function () {
      var t = B();
      return "[null]" != H([t]) || "{}" != H({
        a: t
      }) || "{}" != H(Object(t));
    })
  }, {
    stringify: function (t, r, n) {
      for (var e, o = [t], i = 1; arguments.length > i;) o.push(arguments[i++]);
      if (e = r, (v(r) || void 0 !== t) && !it(t)) return p(r) || (r = function (t, r) {
        if ("function" == typeof e && (r = e.call(this, t, r)), !it(r)) return r;
      }), o[1] = r, H.apply(null, o);
    }
  });
  B.prototype[D] || A(B.prototype, D, B.prototype.valueOf), C(B, "Symbol"), P[W] = !0;
}, function (t, r, n) {

  var e,
    o,
    i,
    u = n(2),
    c = n(78),
    f = n(10),
    a = n(4),
    s = n(3),
    l = n(24),
    p = s("iterator"),
    v = !1;
  [].keys && ("next" in (i = [].keys()) ? (o = c(c(i))) !== Object.prototype && (e = o) : v = !0);
  var y = null == e || u(function () {
    var t = {};
    return e[p].call(t) !== t;
  });
  y && (e = {}), l && !y || a(e, p) || f(e, p, function () {
    return this;
  }), t.exports = {
    IteratorPrototype: e,
    BUGGY_SAFARI_ITERATORS: v
  };
}, function (t, r, n) {
  var e = n(4),
    o = n(12),
    i = n(23),
    u = n(103),
    c = i("IE_PROTO"),
    f = Object.prototype;
  t.exports = u ? Object.getPrototypeOf : function (t) {
    return t = o(t), e(t, c) ? t[c] : "function" == typeof t.constructor && t instanceof t.constructor ? t.constructor.prototype : t instanceof Object ? f : null;
  };
}, function (t, r) {
  t.exports = veLocale;
}, function (t, r, n) {
  var e = n(1),
    o = n(46),
    i = e.WeakMap;
  t.exports = "function" == typeof i && /native code/.test(o(i));
}, function (t, r, n) {
  var e = n(7),
    o = n(6),
    i = n(9),
    u = n(36);
  t.exports = e ? Object.defineProperties : function (t, r) {
    i(t);
    for (var n, e = u(r), c = e.length, f = 0; c > f;) o.f(t, n = e[f++], r[n]);
    return t;
  };
}, function (t, r, n) {
  var e = n(22);
  t.exports = e("navigator", "userAgent") || "";
}, function (t, r, n) {
  var e = n(22),
    o = n(27),
    i = n(49),
    u = n(9);
  t.exports = e("Reflect", "ownKeys") || function (t) {
    var r = o.f(u(t)),
      n = i.f;
    return n ? r.concat(n(t)) : r;
  };
}, function (t, r, n) {

  var e = n(8),
    o = n(2),
    i = n(39),
    u = n(5),
    c = n(12),
    f = n(16),
    a = n(72),
    s = n(55),
    l = n(52),
    p = n(3),
    v = n(37),
    y = p("isConcatSpreadable"),
    d = v >= 51 || !o(function () {
      var t = [];
      return t[y] = !1, t.concat()[0] !== t;
    }),
    h = l("concat"),
    g = function (t) {
      if (!u(t)) return !1;
      var r = t[y];
      return void 0 !== r ? !!r : i(t);
    };
  e({
    target: "Array",
    proto: !0,
    forced: !d || !h
  }, {
    concat: function (t) {
      var r,
        n,
        e,
        o,
        i,
        u = c(this),
        l = s(u, 0),
        p = 0;
      for (r = -1, e = arguments.length; r < e; r++) if (g(i = -1 === r ? u : arguments[r])) {
        if (p + (o = f(i.length)) > 9007199254740991) throw TypeError("Maximum allowed index exceeded");
        for (n = 0; n < o; n++, p++) n in i && a(l, p, i[n]);
      } else {
        if (p >= 9007199254740991) throw TypeError("Maximum allowed index exceeded");
        a(l, p++, i);
      }
      return l.length = p, l;
    }
  });
},,,, function (t, r, n) {

  var e = n(89).charAt,
    o = n(26),
    i = n(71),
    u = o.set,
    c = o.getterFor("String Iterator");
  i(String, "String", function (t) {
    u(this, {
      type: "String Iterator",
      string: String(t),
      index: 0
    });
  }, function () {
    var t,
      r = c(this),
      n = r.string,
      o = r.index;
    return o >= n.length ? {
      value: void 0,
      done: !0
    } : (t = e(n, o), r.index += t.length, {
      value: t,
      done: !1
    });
  });
}, function (t, r, n) {
  var e = n(25),
    o = n(13),
    i = function (t) {
      return function (r, n) {
        var i,
          u,
          c = String(o(r)),
          f = e(n),
          a = c.length;
        return f < 0 || f >= a ? t ? "" : void 0 : (i = c.charCodeAt(f)) < 55296 || i > 56319 || f + 1 === a || (u = c.charCodeAt(f + 1)) < 56320 || u > 57343 ? t ? c.charAt(f) : i : t ? c.slice(f, f + 2) : u - 56320 + (i - 55296 << 10) + 65536;
      };
    };
  t.exports = {
    codeAt: i(!1),
    charAt: i(!0)
  };
}, function (t, r, n) {
  var e = n(1),
    o = n(66),
    i = n(57),
    u = n(10),
    c = n(3),
    f = c("iterator"),
    a = c("toStringTag"),
    s = i.values;
  for (var l in o) {
    var p = e[l],
      v = p && p.prototype;
    if (v) {
      if (v[f] !== s) try {
        u(v, f, s);
      } catch (t) {
        v[f] = s;
      }
      if (v[a] || u(v, a, l), o[l]) for (var y in i) if (v[y] !== i[y]) try {
        u(v, y, i[y]);
      } catch (t) {
        v[y] = i[y];
      }
    }
  }
}, function (t, r, n) {
  var e = n(5);
  t.exports = function (t) {
    if (!e(t) && null !== t) throw TypeError("Can't set " + String(t) + " as a prototype");
    return t;
  };
}, function (t, r, n) {
  var e = n(5),
    o = n(58);
  t.exports = function (t, r, n) {
    var i, u;
    return o && "function" == typeof (i = r.constructor) && i !== n && e(u = i.prototype) && u !== n.prototype && o(t, u), t;
  };
}, function (t, r, n) {

  var e = n(8),
    o = n(7),
    i = n(1),
    u = n(4),
    c = n(5),
    f = n(6).f,
    a = n(61),
    s = i.Symbol;
  if (o && "function" == typeof s && (!("description" in s.prototype) || void 0 !== s().description)) {
    var l = {},
      p = function () {
        var t = arguments.length < 1 || void 0 === arguments[0] ? void 0 : String(arguments[0]),
          r = this instanceof p ? new s(t) : void 0 === t ? s() : s(t);
        return "" === t && (l[r] = !0), r;
      };
    a(p, s);
    var v = p.prototype = s.prototype;
    v.constructor = p;
    var y = v.toString,
      d = "Symbol(test)" == String(s("test")),
      h = /^Symbol\((.*)\)[^)]+$/;
    f(v, "description", {
      configurable: !0,
      get: function () {
        var t = c(this) ? this.valueOf() : this,
          r = y.call(t);
        if (u(l, t)) return "";
        var n = d ? r.slice(7, -1) : r.replace(h, "$1");
        return "" === n ? void 0 : n;
      }
    }), e({
      global: !0,
      forced: !0
    }, {
      Symbol: p
    });
  }
}, function (t, r, n) {
  var e = n(44),
    o = n(15),
    i = n(3)("toStringTag"),
    u = "Arguments" == o(function () {
      return arguments;
    }());
  t.exports = e ? o : function (t) {
    var r, n, e;
    return void 0 === t ? "Undefined" : null === t ? "Null" : "string" == typeof (n = function (t, r) {
      try {
        return t[r];
      } catch (t) {}
    }(r = Object(t), i)) ? n : u ? o(r) : "Object" == (e = o(r)) && "function" == typeof r.callee ? "Arguments" : e;
  };
}, function (t, r, n) {
  n(67)("iterator");
}, function (t, r, n) {
  var e = n(13),
    o = "[" + n(97) + "]",
    i = RegExp("^" + o + o + "*"),
    u = RegExp(o + o + "*$"),
    c = function (t) {
      return function (r) {
        var n = String(e(r));
        return 1 & t && (n = n.replace(i, "")), 2 & t && (n = n.replace(u, "")), n;
      };
    };
  t.exports = {
    start: c(1),
    end: c(2),
    trim: c(3)
  };
}, function (t, r) {
  t.exports = "\t\n\v\f\r                　\u2028\u2029\ufeff";
}, function (t, r, n) {

  var e = n(34).forEach,
    o = n(75)("forEach");
  t.exports = o ? [].forEach : function (t) {
    return e(this, t, arguments.length > 1 ? arguments[1] : void 0);
  };
}, function (t, r, n) {
  var e = n(11),
    o = n(27).f,
    i = {}.toString,
    u = "object" == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  t.exports.f = function (t) {
    return u && "[object Window]" == i.call(t) ? function (t) {
      try {
        return o(t);
      } catch (t) {
        return u.slice();
      }
    }(t) : o(e(t));
  };
}, function (t, r, n) {

  var e = n(44),
    o = n(94);
  t.exports = e ? {}.toString : function () {
    return "[object " + o(this) + "]";
  };
},, function (t, r, n) {

  var e = n(77).IteratorPrototype,
    o = n(28),
    i = n(18),
    u = n(43),
    c = n(50),
    f = function () {
      return this;
    };
  t.exports = function (t, r, n) {
    var a = r + " Iterator";
    return t.prototype = o(e, {
      next: i(1, n)
    }), u(t, a, !1, !0), c[a] = f, t;
  };
}, function (t, r, n) {
  var e = n(2);
  t.exports = !e(function () {
    function t() {}
    return t.prototype.constructor = null, Object.getPrototypeOf(new t()) !== t.prototype;
  });
},, function (t, r, n) {

  var e = n(8),
    o = n(62).includes,
    i = n(65);
  e({
    target: "Array",
    proto: !0
  }, {
    includes: function (t) {
      return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
    }
  }), i("includes");
}, function (t, r, n) {

  var e = n(8),
    o = n(115),
    i = n(13);
  e({
    target: "String",
    proto: !0,
    forced: !n(116)("includes")
  }, {
    includes: function (t) {
      return !!~String(i(this)).indexOf(o(t), arguments.length > 1 ? arguments[1] : void 0);
    }
  });
}, function (t, r, n) {
  var e = n(5),
    o = n(15),
    i = n(3)("match");
  t.exports = function (t) {
    var r;
    return e(t) && (void 0 !== (r = t[i]) ? !!r : "RegExp" == o(t));
  };
},,,,,,,, function (t, r, n) {
  var e = n(107);
  t.exports = function (t) {
    if (e(t)) throw TypeError("The method doesn't accept regular expressions");
    return t;
  };
}, function (t, r, n) {
  var e = n(3)("match");
  t.exports = function (t) {
    var r = /./;
    try {
      "/./"[t](r);
    } catch (n) {
      try {
        return r[e] = !1, "/./"[t](r);
      } catch (t) {}
    }
    return !1;
  };
},,,,,,,,,,,,,,,,,,,,,,, function (t, r, n) {
  var e = n(8),
    o = n(140).values;
  e({
    target: "Object",
    stat: !0
  }, {
    values: function (t) {
      return o(t);
    }
  });
}, function (t, r, n) {
  var e = n(7),
    o = n(36),
    i = n(11),
    u = n(42).f,
    c = function (t) {
      return function (r) {
        for (var n, c = i(r), f = o(c), a = f.length, s = 0, l = []; a > s;) n = f[s++], e && !u.call(c, n) || l.push(t ? [n, c[n]] : c[n]);
        return l;
      };
    };
  t.exports = {
    entries: c(!0),
    values: c(!1)
  };
},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, function (t, r, n) {

  n.r(r);
  n(41), n(38), n(105), n(106), n(139), n(84);
  var e = n(20),
    o = "VeIcon",
    i = n(0),
    u = {
      name: o,
      props: {
        name: {
          type: String,
          required: !0
        },
        color: {
          type: String,
          default: null
        },
        size: {
          type: [Number, String],
          default: ""
        }
      },
      computed: {
        iconStyle: function () {
          var t = this.color,
            r = this.size;
          return {
            color: t,
            "font-size": Object(i.d)(r)
          };
        },
        iconClass: function () {
          var t = this.name;
          return Object.values(e.a).includes(t) || console.error("".concat(t, " is not found in ").concat(o, ".")), "iconfont-vet icon-vet-".concat(t);
        }
      },
      render: function () {
        var t = arguments[0],
          r = this.iconStyle,
          n = this.iconClass;
        return t("i", {
          style: r,
          class: ["ve-icon", n]
        });
      },
      install: function (t) {
        t.component(u.name, u);
      }
    };
  r.default = u;
}]);
});

unwrapExports(veIcon);

var veCheckbox = createCommonjsModule(function (module) {
module.exports = function (t) {
  var n = {};
  function r(e) {
    if (n[e]) return n[e].exports;
    var o = n[e] = {
      i: e,
      l: !1,
      exports: {}
    };
    return t[e].call(o.exports, o, o.exports, r), o.l = !0, o.exports;
  }
  return r.m = t, r.c = n, r.d = function (t, n, e) {
    r.o(t, n) || Object.defineProperty(t, n, {
      enumerable: !0,
      get: e
    });
  }, r.r = function (t) {
    "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
      value: "Module"
    }), Object.defineProperty(t, "__esModule", {
      value: !0
    });
  }, r.t = function (t, n) {
    if (1 & n && (t = r(t)), 8 & n) return t;
    if (4 & n && "object" == typeof t && t && t.__esModule) return t;
    var e = Object.create(null);
    if (r.r(e), Object.defineProperty(e, "default", {
      enumerable: !0,
      value: t
    }), 2 & n && "string" != typeof t) for (var o in t) r.d(e, o, function (n) {
      return t[n];
    }.bind(null, o));
    return e;
  }, r.n = function (t) {
    var n = t && t.__esModule ? function () {
      return t.default;
    } : function () {
      return t;
    };
    return r.d(n, "a", n), n;
  }, r.o = function (t, n) {
    return Object.prototype.hasOwnProperty.call(t, n);
  }, r.p = "", r(r.s = 187);
}([function (t, n, r) {

  r.d(n, "a", function () {
    return i;
  }), r.d(n, "g", function () {
    return u;
  }), r.d(n, "h", function () {
    return c;
  }), r.d(n, "f", function () {
    return a;
  }), r.d(n, "i", function () {
    return f;
  }), r.d(n, "e", function () {
    return s;
  }), r.d(n, "j", function () {
    return l;
  }), r.d(n, "d", function () {
    return p;
  }), r.d(n, "c", function () {
    return v;
  }), r.d(n, "b", function () {
    return h;
  }), r.d(n, "k", function () {
    return y;
  });
  r(41), r(54), r(76), r(93), r(64), r(95), r(57), r(88), r(90), r(84);
  var e = r(79),
    o = r.n(e);
  function i(t) {
    return function (t) {
      return function (n) {
        var r = "",
          e = o.a.getMessage();
        if (e[t]) {
          for (var i = e[t][n], u = arguments.length, c = new Array(u > 1 ? u - 1 : 0), a = 1; a < u; a++) c[a - 1] = arguments[a];
          r = f(i) ? i.apply(void 0, c) : i;
        } else console.error("can't find ".concat(t, " in ").concat(JSON.stringify(e)));
        return r;
      };
    }(t);
  }
  function u(t) {
    return !(Array.isArray(t) && t.length > 0);
  }
  function c(t) {
    return !("" !== t && null != t);
  }
  function a(t) {
    return null != t;
  }
  function f(t) {
    return "function" == typeof t;
  }
  function s(t) {
    return "boolean" == typeof t;
  }
  function l(t) {
    return "number" == typeof t;
  }
  function p(t) {
    return "number" == typeof t ? t + "px" : t;
  }
  function v(t, n) {
    for (var r = t.$parent; r;) {
      if (r.$options.name === n) return r;
      r = r.$parent;
    }
    return null;
  }
  function h(t, n) {
    for (var r = [], e = t.$children; e && e.length > 0;) e.forEach(function (t) {
      e = t.$children ? t.$children : null, t.$options.name === n && r.push(t);
    });
    return r;
  }
  function y(t, n) {
    if (f(t.scrollTo)) t.scrollTo(n);else {
      var r = n.top,
        e = n.left;
      t.scrollTop = r, t.scrollLeft = e;
    }
  }
}, function (t, n, r) {
  (function (n) {
    var r = function (t) {
      return t && t.Math == Math && t;
    };
    t.exports = r("object" == typeof globalThis && globalThis) || r("object" == typeof window && window) || r("object" == typeof self && self) || r("object" == typeof n && n) || function () {
      return this;
    }() || Function("return this")();
  }).call(this, r(73));
}, function (t, n) {
  t.exports = function (t) {
    try {
      return !!t();
    } catch (t) {
      return !0;
    }
  };
}, function (t, n, r) {
  var e = r(1),
    o = r(29),
    i = r(4),
    u = r(33),
    c = r(40),
    a = r(56),
    f = o("wks"),
    s = e.Symbol,
    l = a ? s : s && s.withoutSetter || u;
  t.exports = function (t) {
    return i(f, t) && (c || "string" == typeof f[t]) || (c && i(s, t) ? f[t] = s[t] : f[t] = l("Symbol." + t)), f[t];
  };
}, function (t, n, r) {
  var e = r(12),
    o = {}.hasOwnProperty;
  t.exports = function (t, n) {
    return o.call(e(t), n);
  };
}, function (t, n) {
  t.exports = function (t) {
    return "object" == typeof t ? null !== t : "function" == typeof t;
  };
}, function (t, n, r) {
  var e = r(7),
    o = r(47),
    i = r(9),
    u = r(17),
    c = Object.defineProperty;
  n.f = e ? c : function (t, n, r) {
    if (i(t), n = u(n, !0), i(r), o) try {
      return c(t, n, r);
    } catch (t) {}
    if ("get" in r || "set" in r) throw TypeError("Accessors not supported");
    return "value" in r && (t[n] = r.value), t;
  };
}, function (t, n, r) {
  var e = r(2);
  t.exports = !e(function () {
    return 7 != Object.defineProperty({}, 1, {
      get: function () {
        return 7;
      }
    })[1];
  });
}, function (t, n, r) {
  var e = r(1),
    o = r(19).f,
    i = r(10),
    u = r(14),
    c = r(32),
    a = r(61),
    f = r(51);
  t.exports = function (t, n) {
    var r,
      s,
      l,
      p,
      v,
      h = t.target,
      y = t.global,
      d = t.stat;
    if (r = y ? e : d ? e[h] || c(h, {}) : (e[h] || {}).prototype) for (s in n) {
      if (p = n[s], l = t.noTargetGet ? (v = o(r, s)) && v.value : r[s], !f(y ? s : h + (d ? "." : "#") + s, t.forced) && void 0 !== l) {
        if (typeof p == typeof l) continue;
        a(p, l);
      }
      (t.sham || l && l.sham) && i(p, "sham", !0), u(r, s, p, t);
    }
  };
}, function (t, n, r) {
  var e = r(5);
  t.exports = function (t) {
    if (!e(t)) throw TypeError(String(t) + " is not an object");
    return t;
  };
}, function (t, n, r) {
  var e = r(7),
    o = r(6),
    i = r(18);
  t.exports = e ? function (t, n, r) {
    return o.f(t, n, i(1, r));
  } : function (t, n, r) {
    return t[n] = r, t;
  };
}, function (t, n, r) {
  var e = r(35),
    o = r(13);
  t.exports = function (t) {
    return e(o(t));
  };
}, function (t, n, r) {
  var e = r(13);
  t.exports = function (t) {
    return Object(e(t));
  };
}, function (t, n) {
  t.exports = function (t) {
    if (null == t) throw TypeError("Can't call method on " + t);
    return t;
  };
}, function (t, n, r) {
  var e = r(1),
    o = r(10),
    i = r(4),
    u = r(32),
    c = r(46),
    a = r(26),
    f = a.get,
    s = a.enforce,
    l = String(String).split("String");
  (t.exports = function (t, n, r, c) {
    var a,
      f = !!c && !!c.unsafe,
      p = !!c && !!c.enumerable,
      v = !!c && !!c.noTargetGet;
    "function" == typeof r && ("string" != typeof n || i(r, "name") || o(r, "name", n), (a = s(r)).source || (a.source = l.join("string" == typeof n ? n : ""))), t !== e ? (f ? !v && t[n] && (p = !0) : delete t[n], p ? t[n] = r : o(t, n, r)) : p ? t[n] = r : u(n, r);
  })(Function.prototype, "toString", function () {
    return "function" == typeof this && f(this).source || c(this);
  });
}, function (t, n) {
  var r = {}.toString;
  t.exports = function (t) {
    return r.call(t).slice(8, -1);
  };
}, function (t, n, r) {
  var e = r(25),
    o = Math.min;
  t.exports = function (t) {
    return t > 0 ? o(e(t), 9007199254740991) : 0;
  };
}, function (t, n, r) {
  var e = r(5);
  t.exports = function (t, n) {
    if (!e(t)) return t;
    var r, o;
    if (n && "function" == typeof (r = t.toString) && !e(o = r.call(t))) return o;
    if ("function" == typeof (r = t.valueOf) && !e(o = r.call(t))) return o;
    if (!n && "function" == typeof (r = t.toString) && !e(o = r.call(t))) return o;
    throw TypeError("Can't convert object to primitive value");
  };
}, function (t, n) {
  t.exports = function (t, n) {
    return {
      enumerable: !(1 & t),
      configurable: !(2 & t),
      writable: !(4 & t),
      value: n
    };
  };
}, function (t, n, r) {
  var e = r(7),
    o = r(42),
    i = r(18),
    u = r(11),
    c = r(17),
    a = r(4),
    f = r(47),
    s = Object.getOwnPropertyDescriptor;
  n.f = e ? s : function (t, n) {
    if (t = u(t), n = c(n, !0), f) try {
      return s(t, n);
    } catch (t) {}
    if (a(t, n)) return i(!o.f.call(t, n), t[n]);
  };
},, function (t, n) {
  t.exports = {};
}, function (t, n, r) {
  var e = r(53),
    o = r(1),
    i = function (t) {
      return "function" == typeof t ? t : void 0;
    };
  t.exports = function (t, n) {
    return arguments.length < 2 ? i(e[t]) || i(o[t]) : e[t] && e[t][n] || o[t] && o[t][n];
  };
}, function (t, n, r) {
  var e = r(29),
    o = r(33),
    i = e("keys");
  t.exports = function (t) {
    return i[t] || (i[t] = o(t));
  };
}, function (t, n) {
  t.exports = !1;
}, function (t, n) {
  var r = Math.ceil,
    e = Math.floor;
  t.exports = function (t) {
    return isNaN(t = +t) ? 0 : (t > 0 ? e : r)(t);
  };
}, function (t, n, r) {
  var e,
    o,
    i,
    u = r(80),
    c = r(1),
    a = r(5),
    f = r(10),
    s = r(4),
    l = r(30),
    p = r(23),
    v = r(21),
    h = c.WeakMap;
  if (u || l.state) {
    var y = l.state || (l.state = new h()),
      d = y.get,
      g = y.has,
      b = y.set;
    e = function (t, n) {
      if (g.call(y, t)) throw new TypeError("Object already initialized");
      return n.facade = t, b.call(y, t, n), n;
    }, o = function (t) {
      return d.call(y, t) || {};
    }, i = function (t) {
      return g.call(y, t);
    };
  } else {
    var m = p("state");
    v[m] = !0, e = function (t, n) {
      if (s(t, m)) throw new TypeError("Object already initialized");
      return n.facade = t, f(t, m, n), n;
    }, o = function (t) {
      return s(t, m) ? t[m] : {};
    }, i = function (t) {
      return s(t, m);
    };
  }
  t.exports = {
    set: e,
    get: o,
    has: i,
    enforce: function (t) {
      return i(t) ? o(t) : e(t, {});
    },
    getterFor: function (t) {
      return function (n) {
        var r;
        if (!a(n) || (r = o(n)).type !== t) throw TypeError("Incompatible receiver, " + t + " required");
        return r;
      };
    }
  };
}, function (t, n, r) {
  var e = r(48),
    o = r(31).concat("length", "prototype");
  n.f = Object.getOwnPropertyNames || function (t) {
    return e(t, o);
  };
}, function (t, n, r) {
  var e,
    o = r(9),
    i = r(81),
    u = r(31),
    c = r(21),
    a = r(74),
    f = r(45),
    s = r(23),
    l = s("IE_PROTO"),
    p = function () {},
    v = function (t) {
      return "<script>" + t + "<\/script>";
    },
    h = function () {
      try {
        e = document.domain && new ActiveXObject("htmlfile");
      } catch (t) {}
      var t, n;
      h = e ? function (t) {
        t.write(v("")), t.close();
        var n = t.parentWindow.Object;
        return t = null, n;
      }(e) : ((n = f("iframe")).style.display = "none", a.appendChild(n), n.src = String("javascript:"), (t = n.contentWindow.document).open(), t.write(v("document.F=Object")), t.close(), t.F);
      for (var r = u.length; r--;) delete h.prototype[u[r]];
      return h();
    };
  c[l] = !0, t.exports = Object.create || function (t, n) {
    var r;
    return null !== t ? (p.prototype = o(t), r = new p(), p.prototype = null, r[l] = t) : r = h(), void 0 === n ? r : i(r, n);
  };
}, function (t, n, r) {
  var e = r(24),
    o = r(30);
  (t.exports = function (t, n) {
    return o[t] || (o[t] = void 0 !== n ? n : {});
  })("versions", []).push({
    version: "3.13.0",
    mode: e ? "pure" : "global",
    copyright: "© 2021 Denis Pushkarev (zloirock.ru)"
  });
}, function (t, n, r) {
  var e = r(1),
    o = r(32),
    i = e["__core-js_shared__"] || o("__core-js_shared__", {});
  t.exports = i;
}, function (t, n) {
  t.exports = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
}, function (t, n, r) {
  var e = r(1),
    o = r(10);
  t.exports = function (t, n) {
    try {
      o(e, t, n);
    } catch (r) {
      e[t] = n;
    }
    return n;
  };
}, function (t, n) {
  var r = 0,
    e = Math.random();
  t.exports = function (t) {
    return "Symbol(" + String(void 0 === t ? "" : t) + ")_" + (++r + e).toString(36);
  };
}, function (t, n, r) {
  var e = r(70),
    o = r(35),
    i = r(12),
    u = r(16),
    c = r(55),
    a = [].push,
    f = function (t) {
      var n = 1 == t,
        r = 2 == t,
        f = 3 == t,
        s = 4 == t,
        l = 6 == t,
        p = 7 == t,
        v = 5 == t || l;
      return function (h, y, d, g) {
        for (var b, m, x = i(h), S = o(x), O = e(y, d, 3), w = u(S.length), j = 0, A = g || c, T = n ? A(h, w) : r || p ? A(h, 0) : void 0; w > j; j++) if ((v || j in S) && (m = O(b = S[j], j, x), t)) if (n) T[j] = m;else if (m) switch (t) {
          case 3:
            return !0;
          case 5:
            return b;
          case 6:
            return j;
          case 2:
            a.call(T, b);
        } else switch (t) {
          case 4:
            return !1;
          case 7:
            a.call(T, b);
        }
        return l ? -1 : f || s ? s : T;
      };
    };
  t.exports = {
    forEach: f(0),
    map: f(1),
    filter: f(2),
    some: f(3),
    every: f(4),
    find: f(5),
    findIndex: f(6),
    filterOut: f(7)
  };
}, function (t, n, r) {
  var e = r(2),
    o = r(15),
    i = "".split;
  t.exports = e(function () {
    return !Object("z").propertyIsEnumerable(0);
  }) ? function (t) {
    return "String" == o(t) ? i.call(t, "") : Object(t);
  } : Object;
}, function (t, n, r) {
  var e = r(48),
    o = r(31);
  t.exports = Object.keys || function (t) {
    return e(t, o);
  };
}, function (t, n, r) {
  var e,
    o,
    i = r(1),
    u = r(82),
    c = i.process,
    a = c && c.versions,
    f = a && a.v8;
  f ? o = (e = f.split("."))[0] < 4 ? 1 : e[0] + e[1] : u && (!(e = u.match(/Edge\/(\d+)/)) || e[1] >= 74) && (e = u.match(/Chrome\/(\d+)/)) && (o = e[1]), t.exports = o && +o;
}, function (t, n, r) {

  var e = r(7),
    o = r(1),
    i = r(51),
    u = r(14),
    c = r(4),
    a = r(15),
    f = r(92),
    s = r(17),
    l = r(2),
    p = r(28),
    v = r(27).f,
    h = r(19).f,
    y = r(6).f,
    d = r(96).trim,
    g = o.Number,
    b = g.prototype,
    m = "Number" == a(p(b)),
    x = function (t) {
      var n,
        r,
        e,
        o,
        i,
        u,
        c,
        a,
        f = s(t, !1);
      if ("string" == typeof f && f.length > 2) if (43 === (n = (f = d(f)).charCodeAt(0)) || 45 === n) {
        if (88 === (r = f.charCodeAt(2)) || 120 === r) return NaN;
      } else if (48 === n) {
        switch (f.charCodeAt(1)) {
          case 66:
          case 98:
            e = 2, o = 49;
            break;
          case 79:
          case 111:
            e = 8, o = 55;
            break;
          default:
            return +f;
        }
        for (u = (i = f.slice(2)).length, c = 0; c < u; c++) if ((a = i.charCodeAt(c)) < 48 || a > o) return NaN;
        return parseInt(i, e);
      }
      return +f;
    };
  if (i("Number", !g(" 0o1") || !g("0b1") || g("+0x1"))) {
    for (var S, O = function (t) {
        var n = arguments.length < 1 ? 0 : t,
          r = this;
        return r instanceof O && (m ? l(function () {
          b.valueOf.call(r);
        }) : "Number" != a(r)) ? f(new g(x(n)), r, O) : x(n);
      }, w = e ? v(g) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","), j = 0; w.length > j; j++) c(g, S = w[j]) && !c(O, S) && y(O, S, h(g, S));
    O.prototype = b, b.constructor = O, u(o, "Number", O);
  }
}, function (t, n, r) {
  var e = r(15);
  t.exports = Array.isArray || function (t) {
    return "Array" == e(t);
  };
}, function (t, n, r) {
  var e = r(37),
    o = r(2);
  t.exports = !!Object.getOwnPropertySymbols && !o(function () {
    return !String(Symbol()) || !Symbol.sham && e && e < 41;
  });
}, function (t, n, r) {
  var e = r(7),
    o = r(6).f,
    i = Function.prototype,
    u = i.toString,
    c = /^\s*function ([^ (]*)/;
  e && !("name" in i) && o(i, "name", {
    configurable: !0,
    get: function () {
      try {
        return u.call(this).match(c)[1];
      } catch (t) {
        return "";
      }
    }
  });
}, function (t, n, r) {

  var e = {}.propertyIsEnumerable,
    o = Object.getOwnPropertyDescriptor,
    i = o && !e.call({
      1: 2
    }, 1);
  n.f = i ? function (t) {
    var n = o(this, t);
    return !!n && n.enumerable;
  } : e;
}, function (t, n, r) {
  var e = r(6).f,
    o = r(4),
    i = r(3)("toStringTag");
  t.exports = function (t, n, r) {
    t && !o(t = r ? t : t.prototype, i) && e(t, i, {
      configurable: !0,
      value: n
    });
  };
}, function (t, n, r) {
  var e = {};
  e[r(3)("toStringTag")] = "z", t.exports = "[object z]" === String(e);
}, function (t, n, r) {
  var e = r(1),
    o = r(5),
    i = e.document,
    u = o(i) && o(i.createElement);
  t.exports = function (t) {
    return u ? i.createElement(t) : {};
  };
}, function (t, n, r) {
  var e = r(30),
    o = Function.toString;
  "function" != typeof e.inspectSource && (e.inspectSource = function (t) {
    return o.call(t);
  }), t.exports = e.inspectSource;
}, function (t, n, r) {
  var e = r(7),
    o = r(2),
    i = r(45);
  t.exports = !e && !o(function () {
    return 7 != Object.defineProperty(i("div"), "a", {
      get: function () {
        return 7;
      }
    }).a;
  });
}, function (t, n, r) {
  var e = r(4),
    o = r(11),
    i = r(62).indexOf,
    u = r(21);
  t.exports = function (t, n) {
    var r,
      c = o(t),
      a = 0,
      f = [];
    for (r in c) !e(u, r) && e(c, r) && f.push(r);
    for (; n.length > a;) e(c, r = n[a++]) && (~i(f, r) || f.push(r));
    return f;
  };
}, function (t, n) {
  n.f = Object.getOwnPropertySymbols;
}, function (t, n) {
  t.exports = {};
}, function (t, n, r) {
  var e = r(2),
    o = /#|\.prototype\./,
    i = function (t, n) {
      var r = c[u(t)];
      return r == f || r != a && ("function" == typeof n ? e(n) : !!n);
    },
    u = i.normalize = function (t) {
      return String(t).replace(o, ".").toLowerCase();
    },
    c = i.data = {},
    a = i.NATIVE = "N",
    f = i.POLYFILL = "P";
  t.exports = i;
}, function (t, n, r) {
  var e = r(2),
    o = r(3),
    i = r(37),
    u = o("species");
  t.exports = function (t) {
    return i >= 51 || !e(function () {
      var n = [];
      return (n.constructor = {})[u] = function () {
        return {
          foo: 1
        };
      }, 1 !== n[t](Boolean).foo;
    });
  };
}, function (t, n, r) {
  var e = r(1);
  t.exports = e;
}, function (t, n, r) {
  var e = r(1),
    o = r(66),
    i = r(98),
    u = r(10);
  for (var c in o) {
    var a = e[c],
      f = a && a.prototype;
    if (f && f.forEach !== i) try {
      u(f, "forEach", i);
    } catch (t) {
      f.forEach = i;
    }
  }
}, function (t, n, r) {
  var e = r(5),
    o = r(39),
    i = r(3)("species");
  t.exports = function (t, n) {
    var r;
    return o(t) && ("function" != typeof (r = t.constructor) || r !== Array && !o(r.prototype) ? e(r) && null === (r = r[i]) && (r = void 0) : r = void 0), new (void 0 === r ? Array : r)(0 === n ? 0 : n);
  };
}, function (t, n, r) {
  var e = r(40);
  t.exports = e && !Symbol.sham && "symbol" == typeof Symbol.iterator;
}, function (t, n, r) {

  var e = r(11),
    o = r(65),
    i = r(50),
    u = r(26),
    c = r(71),
    a = u.set,
    f = u.getterFor("Array Iterator");
  t.exports = c(Array, "Array", function (t, n) {
    a(this, {
      type: "Array Iterator",
      target: e(t),
      index: 0,
      kind: n
    });
  }, function () {
    var t = f(this),
      n = t.target,
      r = t.kind,
      e = t.index++;
    return !n || e >= n.length ? (t.target = void 0, {
      value: void 0,
      done: !0
    }) : "keys" == r ? {
      value: e,
      done: !1
    } : "values" == r ? {
      value: n[e],
      done: !1
    } : {
      value: [e, n[e]],
      done: !1
    };
  }, "values"), i.Arguments = i.Array, o("keys"), o("values"), o("entries");
}, function (t, n, r) {
  var e = r(9),
    o = r(91);
  t.exports = Object.setPrototypeOf || ("__proto__" in {} ? function () {
    var t,
      n = !1,
      r = {};
    try {
      (t = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set).call(r, []), n = r instanceof Array;
    } catch (t) {}
    return function (r, i) {
      return e(r), o(i), n ? t.call(r, i) : r.__proto__ = i, r;
    };
  }() : void 0);
}, function (t, n, r) {
  var e = r(25),
    o = Math.max,
    i = Math.min;
  t.exports = function (t, n) {
    var r = e(t);
    return r < 0 ? o(r + n, 0) : i(r, n);
  };
}, function (t, n) {
  t.exports = function (t) {
    if ("function" != typeof t) throw TypeError(String(t) + " is not a function");
    return t;
  };
}, function (t, n, r) {
  var e = r(4),
    o = r(83),
    i = r(19),
    u = r(6);
  t.exports = function (t, n) {
    for (var r = o(n), c = u.f, a = i.f, f = 0; f < r.length; f++) {
      var s = r[f];
      e(t, s) || c(t, s, a(n, s));
    }
  };
}, function (t, n, r) {
  var e = r(11),
    o = r(16),
    i = r(59),
    u = function (t) {
      return function (n, r, u) {
        var c,
          a = e(n),
          f = o(a.length),
          s = i(u, f);
        if (t && r != r) {
          for (; f > s;) if ((c = a[s++]) != c) return !0;
        } else for (; f > s; s++) if ((t || s in a) && a[s] === r) return t || s || 0;
        return !t && -1;
      };
    };
  t.exports = {
    includes: u(!0),
    indexOf: u(!1)
  };
}, function (t, n, r) {
  var e = r(3);
  n.f = e;
}, function (t, n, r) {
  var e = r(44),
    o = r(14),
    i = r(100);
  e || o(Object.prototype, "toString", i, {
    unsafe: !0
  });
}, function (t, n, r) {
  var e = r(3),
    o = r(28),
    i = r(6),
    u = e("unscopables"),
    c = Array.prototype;
  null == c[u] && i.f(c, u, {
    configurable: !0,
    value: o(null)
  }), t.exports = function (t) {
    c[u][t] = !0;
  };
}, function (t, n) {
  t.exports = {
    CSSRuleList: 0,
    CSSStyleDeclaration: 0,
    CSSValueList: 0,
    ClientRectList: 0,
    DOMRectList: 0,
    DOMStringList: 0,
    DOMTokenList: 1,
    DataTransferItemList: 0,
    FileList: 0,
    HTMLAllCollection: 0,
    HTMLCollection: 0,
    HTMLFormElement: 0,
    HTMLSelectElement: 0,
    MediaList: 0,
    MimeTypeArray: 0,
    NamedNodeMap: 0,
    NodeList: 1,
    PaintRequestList: 0,
    Plugin: 0,
    PluginArray: 0,
    SVGLengthList: 0,
    SVGNumberList: 0,
    SVGPathSegList: 0,
    SVGPointList: 0,
    SVGStringList: 0,
    SVGTransformList: 0,
    SourceBufferList: 0,
    StyleSheetList: 0,
    TextTrackCueList: 0,
    TextTrackList: 0,
    TouchList: 0
  };
}, function (t, n, r) {
  var e = r(53),
    o = r(4),
    i = r(63),
    u = r(6).f;
  t.exports = function (t) {
    var n = e.Symbol || (e.Symbol = {});
    o(n, t) || u(n, t, {
      value: i.f(t)
    });
  };
},,, function (t, n, r) {
  var e = r(60);
  t.exports = function (t, n, r) {
    if (e(t), void 0 === n) return t;
    switch (r) {
      case 0:
        return function () {
          return t.call(n);
        };
      case 1:
        return function (r) {
          return t.call(n, r);
        };
      case 2:
        return function (r, e) {
          return t.call(n, r, e);
        };
      case 3:
        return function (r, e, o) {
          return t.call(n, r, e, o);
        };
    }
    return function () {
      return t.apply(n, arguments);
    };
  };
}, function (t, n, r) {

  var e = r(8),
    o = r(102),
    i = r(78),
    u = r(58),
    c = r(43),
    a = r(10),
    f = r(14),
    s = r(3),
    l = r(24),
    p = r(50),
    v = r(77),
    h = v.IteratorPrototype,
    y = v.BUGGY_SAFARI_ITERATORS,
    d = s("iterator"),
    g = function () {
      return this;
    };
  t.exports = function (t, n, r, s, v, b, m) {
    o(r, n, s);
    var x,
      S,
      O,
      w = function (t) {
        if (t === v && E) return E;
        if (!y && t in T) return T[t];
        switch (t) {
          case "keys":
          case "values":
          case "entries":
            return function () {
              return new r(this, t);
            };
        }
        return function () {
          return new r(this);
        };
      },
      j = n + " Iterator",
      A = !1,
      T = t.prototype,
      k = T[d] || T["@@iterator"] || v && T[v],
      E = !y && k || w(v),
      P = "Array" == n && T.entries || k;
    if (P && (x = i(P.call(new t())), h !== Object.prototype && x.next && (l || i(x) === h || (u ? u(x, h) : "function" != typeof x[d] && a(x, d, g)), c(x, j, !0, !0), l && (p[j] = g))), "values" == v && k && "values" !== k.name && (A = !0, E = function () {
      return k.call(this);
    }), l && !m || T[d] === E || a(T, d, E), p[n] = E, v) if (S = {
      values: w("values"),
      keys: b ? E : w("keys"),
      entries: w("entries")
    }, m) for (O in S) (y || A || !(O in T)) && f(T, O, S[O]);else e({
      target: n,
      proto: !0,
      forced: y || A
    }, S);
    return S;
  };
}, function (t, n, r) {

  var e = r(17),
    o = r(6),
    i = r(18);
  t.exports = function (t, n, r) {
    var u = e(n);
    u in t ? o.f(t, u, i(0, r)) : t[u] = r;
  };
}, function (t, n) {
  var r;
  r = function () {
    return this;
  }();
  try {
    r = r || new Function("return this")();
  } catch (t) {
    "object" == typeof window && (r = window);
  }
  t.exports = r;
}, function (t, n, r) {
  var e = r(22);
  t.exports = e("document", "documentElement");
}, function (t, n, r) {

  var e = r(2);
  t.exports = function (t, n) {
    var r = [][t];
    return !!r && e(function () {
      r.call(null, n || function () {
        throw 1;
      }, 1);
    });
  };
}, function (t, n, r) {

  var e = r(8),
    o = r(1),
    i = r(22),
    u = r(24),
    c = r(7),
    a = r(40),
    f = r(56),
    s = r(2),
    l = r(4),
    p = r(39),
    v = r(5),
    h = r(9),
    y = r(12),
    d = r(11),
    g = r(17),
    b = r(18),
    m = r(28),
    x = r(36),
    S = r(27),
    O = r(99),
    w = r(49),
    j = r(19),
    A = r(6),
    T = r(42),
    k = r(10),
    E = r(14),
    P = r(29),
    I = r(23),
    _ = r(21),
    N = r(33),
    L = r(3),
    M = r(63),
    C = r(67),
    G = r(43),
    F = r(26),
    R = r(34).forEach,
    B = I("hidden"),
    V = L("toPrimitive"),
    $ = F.set,
    D = F.getterFor("Symbol"),
    z = Object.prototype,
    U = o.Symbol,
    W = i("JSON", "stringify"),
    Y = j.f,
    H = A.f,
    q = O.f,
    J = T.f,
    X = P("symbols"),
    K = P("op-symbols"),
    Q = P("string-to-symbol-registry"),
    Z = P("symbol-to-string-registry"),
    tt = P("wks"),
    nt = o.QObject,
    rt = !nt || !nt.prototype || !nt.prototype.findChild,
    et = c && s(function () {
      return 7 != m(H({}, "a", {
        get: function () {
          return H(this, "a", {
            value: 7
          }).a;
        }
      })).a;
    }) ? function (t, n, r) {
      var e = Y(z, n);
      e && delete z[n], H(t, n, r), e && t !== z && H(z, n, e);
    } : H,
    ot = function (t, n) {
      var r = X[t] = m(U.prototype);
      return $(r, {
        type: "Symbol",
        tag: t,
        description: n
      }), c || (r.description = n), r;
    },
    it = f ? function (t) {
      return "symbol" == typeof t;
    } : function (t) {
      return Object(t) instanceof U;
    },
    ut = function (t, n, r) {
      t === z && ut(K, n, r), h(t);
      var e = g(n, !0);
      return h(r), l(X, e) ? (r.enumerable ? (l(t, B) && t[B][e] && (t[B][e] = !1), r = m(r, {
        enumerable: b(0, !1)
      })) : (l(t, B) || H(t, B, b(1, {})), t[B][e] = !0), et(t, e, r)) : H(t, e, r);
    },
    ct = function (t, n) {
      h(t);
      var r = d(n),
        e = x(r).concat(lt(r));
      return R(e, function (n) {
        c && !at.call(r, n) || ut(t, n, r[n]);
      }), t;
    },
    at = function (t) {
      var n = g(t, !0),
        r = J.call(this, n);
      return !(this === z && l(X, n) && !l(K, n)) && (!(r || !l(this, n) || !l(X, n) || l(this, B) && this[B][n]) || r);
    },
    ft = function (t, n) {
      var r = d(t),
        e = g(n, !0);
      if (r !== z || !l(X, e) || l(K, e)) {
        var o = Y(r, e);
        return !o || !l(X, e) || l(r, B) && r[B][e] || (o.enumerable = !0), o;
      }
    },
    st = function (t) {
      var n = q(d(t)),
        r = [];
      return R(n, function (t) {
        l(X, t) || l(_, t) || r.push(t);
      }), r;
    },
    lt = function (t) {
      var n = t === z,
        r = q(n ? K : d(t)),
        e = [];
      return R(r, function (t) {
        !l(X, t) || n && !l(z, t) || e.push(X[t]);
      }), e;
    };
  (a || (E((U = function () {
    if (this instanceof U) throw TypeError("Symbol is not a constructor");
    var t = arguments.length && void 0 !== arguments[0] ? String(arguments[0]) : void 0,
      n = N(t),
      r = function (t) {
        this === z && r.call(K, t), l(this, B) && l(this[B], n) && (this[B][n] = !1), et(this, n, b(1, t));
      };
    return c && rt && et(z, n, {
      configurable: !0,
      set: r
    }), ot(n, t);
  }).prototype, "toString", function () {
    return D(this).tag;
  }), E(U, "withoutSetter", function (t) {
    return ot(N(t), t);
  }), T.f = at, A.f = ut, j.f = ft, S.f = O.f = st, w.f = lt, M.f = function (t) {
    return ot(L(t), t);
  }, c && (H(U.prototype, "description", {
    configurable: !0,
    get: function () {
      return D(this).description;
    }
  }), u || E(z, "propertyIsEnumerable", at, {
    unsafe: !0
  }))), e({
    global: !0,
    wrap: !0,
    forced: !a,
    sham: !a
  }, {
    Symbol: U
  }), R(x(tt), function (t) {
    C(t);
  }), e({
    target: "Symbol",
    stat: !0,
    forced: !a
  }, {
    for: function (t) {
      var n = String(t);
      if (l(Q, n)) return Q[n];
      var r = U(n);
      return Q[n] = r, Z[r] = n, r;
    },
    keyFor: function (t) {
      if (!it(t)) throw TypeError(t + " is not a symbol");
      if (l(Z, t)) return Z[t];
    },
    useSetter: function () {
      rt = !0;
    },
    useSimple: function () {
      rt = !1;
    }
  }), e({
    target: "Object",
    stat: !0,
    forced: !a,
    sham: !c
  }, {
    create: function (t, n) {
      return void 0 === n ? m(t) : ct(m(t), n);
    },
    defineProperty: ut,
    defineProperties: ct,
    getOwnPropertyDescriptor: ft
  }), e({
    target: "Object",
    stat: !0,
    forced: !a
  }, {
    getOwnPropertyNames: st,
    getOwnPropertySymbols: lt
  }), e({
    target: "Object",
    stat: !0,
    forced: s(function () {
      w.f(1);
    })
  }, {
    getOwnPropertySymbols: function (t) {
      return w.f(y(t));
    }
  }), W) && e({
    target: "JSON",
    stat: !0,
    forced: !a || s(function () {
      var t = U();
      return "[null]" != W([t]) || "{}" != W({
        a: t
      }) || "{}" != W(Object(t));
    })
  }, {
    stringify: function (t, n, r) {
      for (var e, o = [t], i = 1; arguments.length > i;) o.push(arguments[i++]);
      if (e = n, (v(n) || void 0 !== t) && !it(t)) return p(n) || (n = function (t, n) {
        if ("function" == typeof e && (n = e.call(this, t, n)), !it(n)) return n;
      }), o[1] = n, W.apply(null, o);
    }
  });
  U.prototype[V] || k(U.prototype, V, U.prototype.valueOf), G(U, "Symbol"), _[B] = !0;
}, function (t, n, r) {

  var e,
    o,
    i,
    u = r(2),
    c = r(78),
    a = r(10),
    f = r(4),
    s = r(3),
    l = r(24),
    p = s("iterator"),
    v = !1;
  [].keys && ("next" in (i = [].keys()) ? (o = c(c(i))) !== Object.prototype && (e = o) : v = !0);
  var h = null == e || u(function () {
    var t = {};
    return e[p].call(t) !== t;
  });
  h && (e = {}), l && !h || f(e, p) || a(e, p, function () {
    return this;
  }), t.exports = {
    IteratorPrototype: e,
    BUGGY_SAFARI_ITERATORS: v
  };
}, function (t, n, r) {
  var e = r(4),
    o = r(12),
    i = r(23),
    u = r(103),
    c = i("IE_PROTO"),
    a = Object.prototype;
  t.exports = u ? Object.getPrototypeOf : function (t) {
    return t = o(t), e(t, c) ? t[c] : "function" == typeof t.constructor && t instanceof t.constructor ? t.constructor.prototype : t instanceof Object ? a : null;
  };
}, function (t, n) {
  t.exports = veLocale;
}, function (t, n, r) {
  var e = r(1),
    o = r(46),
    i = e.WeakMap;
  t.exports = "function" == typeof i && /native code/.test(o(i));
}, function (t, n, r) {
  var e = r(7),
    o = r(6),
    i = r(9),
    u = r(36);
  t.exports = e ? Object.defineProperties : function (t, n) {
    i(t);
    for (var r, e = u(n), c = e.length, a = 0; c > a;) o.f(t, r = e[a++], n[r]);
    return t;
  };
}, function (t, n, r) {
  var e = r(22);
  t.exports = e("navigator", "userAgent") || "";
}, function (t, n, r) {
  var e = r(22),
    o = r(27),
    i = r(49),
    u = r(9);
  t.exports = e("Reflect", "ownKeys") || function (t) {
    var n = o.f(u(t)),
      r = i.f;
    return r ? n.concat(r(t)) : n;
  };
}, function (t, n, r) {

  var e = r(8),
    o = r(2),
    i = r(39),
    u = r(5),
    c = r(12),
    a = r(16),
    f = r(72),
    s = r(55),
    l = r(52),
    p = r(3),
    v = r(37),
    h = p("isConcatSpreadable"),
    y = v >= 51 || !o(function () {
      var t = [];
      return t[h] = !1, t.concat()[0] !== t;
    }),
    d = l("concat"),
    g = function (t) {
      if (!u(t)) return !1;
      var n = t[h];
      return void 0 !== n ? !!n : i(t);
    };
  e({
    target: "Array",
    proto: !0,
    forced: !y || !d
  }, {
    concat: function (t) {
      var n,
        r,
        e,
        o,
        i,
        u = c(this),
        l = s(u, 0),
        p = 0;
      for (n = -1, e = arguments.length; n < e; n++) if (g(i = -1 === n ? u : arguments[n])) {
        if (p + (o = a(i.length)) > 9007199254740991) throw TypeError("Maximum allowed index exceeded");
        for (r = 0; r < o; r++, p++) r in i && f(l, p, i[r]);
      } else {
        if (p >= 9007199254740991) throw TypeError("Maximum allowed index exceeded");
        f(l, p++, i);
      }
      return l.length = p, l;
    }
  });
},,,, function (t, n, r) {

  var e = r(89).charAt,
    o = r(26),
    i = r(71),
    u = o.set,
    c = o.getterFor("String Iterator");
  i(String, "String", function (t) {
    u(this, {
      type: "String Iterator",
      string: String(t),
      index: 0
    });
  }, function () {
    var t,
      n = c(this),
      r = n.string,
      o = n.index;
    return o >= r.length ? {
      value: void 0,
      done: !0
    } : (t = e(r, o), n.index += t.length, {
      value: t,
      done: !1
    });
  });
}, function (t, n, r) {
  var e = r(25),
    o = r(13),
    i = function (t) {
      return function (n, r) {
        var i,
          u,
          c = String(o(n)),
          a = e(r),
          f = c.length;
        return a < 0 || a >= f ? t ? "" : void 0 : (i = c.charCodeAt(a)) < 55296 || i > 56319 || a + 1 === f || (u = c.charCodeAt(a + 1)) < 56320 || u > 57343 ? t ? c.charAt(a) : i : t ? c.slice(a, a + 2) : u - 56320 + (i - 55296 << 10) + 65536;
      };
    };
  t.exports = {
    codeAt: i(!1),
    charAt: i(!0)
  };
}, function (t, n, r) {
  var e = r(1),
    o = r(66),
    i = r(57),
    u = r(10),
    c = r(3),
    a = c("iterator"),
    f = c("toStringTag"),
    s = i.values;
  for (var l in o) {
    var p = e[l],
      v = p && p.prototype;
    if (v) {
      if (v[a] !== s) try {
        u(v, a, s);
      } catch (t) {
        v[a] = s;
      }
      if (v[f] || u(v, f, l), o[l]) for (var h in i) if (v[h] !== i[h]) try {
        u(v, h, i[h]);
      } catch (t) {
        v[h] = i[h];
      }
    }
  }
}, function (t, n, r) {
  var e = r(5);
  t.exports = function (t) {
    if (!e(t) && null !== t) throw TypeError("Can't set " + String(t) + " as a prototype");
    return t;
  };
}, function (t, n, r) {
  var e = r(5),
    o = r(58);
  t.exports = function (t, n, r) {
    var i, u;
    return o && "function" == typeof (i = n.constructor) && i !== r && e(u = i.prototype) && u !== r.prototype && o(t, u), t;
  };
}, function (t, n, r) {

  var e = r(8),
    o = r(7),
    i = r(1),
    u = r(4),
    c = r(5),
    a = r(6).f,
    f = r(61),
    s = i.Symbol;
  if (o && "function" == typeof s && (!("description" in s.prototype) || void 0 !== s().description)) {
    var l = {},
      p = function () {
        var t = arguments.length < 1 || void 0 === arguments[0] ? void 0 : String(arguments[0]),
          n = this instanceof p ? new s(t) : void 0 === t ? s() : s(t);
        return "" === t && (l[n] = !0), n;
      };
    f(p, s);
    var v = p.prototype = s.prototype;
    v.constructor = p;
    var h = v.toString,
      y = "Symbol(test)" == String(s("test")),
      d = /^Symbol\((.*)\)[^)]+$/;
    a(v, "description", {
      configurable: !0,
      get: function () {
        var t = c(this) ? this.valueOf() : this,
          n = h.call(t);
        if (u(l, t)) return "";
        var r = y ? n.slice(7, -1) : n.replace(d, "$1");
        return "" === r ? void 0 : r;
      }
    }), e({
      global: !0,
      forced: !0
    }, {
      Symbol: p
    });
  }
}, function (t, n, r) {
  var e = r(44),
    o = r(15),
    i = r(3)("toStringTag"),
    u = "Arguments" == o(function () {
      return arguments;
    }());
  t.exports = e ? o : function (t) {
    var n, r, e;
    return void 0 === t ? "Undefined" : null === t ? "Null" : "string" == typeof (r = function (t, n) {
      try {
        return t[n];
      } catch (t) {}
    }(n = Object(t), i)) ? r : u ? o(n) : "Object" == (e = o(n)) && "function" == typeof n.callee ? "Arguments" : e;
  };
}, function (t, n, r) {
  r(67)("iterator");
}, function (t, n, r) {
  var e = r(13),
    o = "[" + r(97) + "]",
    i = RegExp("^" + o + o + "*"),
    u = RegExp(o + o + "*$"),
    c = function (t) {
      return function (n) {
        var r = String(e(n));
        return 1 & t && (r = r.replace(i, "")), 2 & t && (r = r.replace(u, "")), r;
      };
    };
  t.exports = {
    start: c(1),
    end: c(2),
    trim: c(3)
  };
}, function (t, n) {
  t.exports = "\t\n\v\f\r                　\u2028\u2029\ufeff";
}, function (t, n, r) {

  var e = r(34).forEach,
    o = r(75)("forEach");
  t.exports = o ? [].forEach : function (t) {
    return e(this, t, arguments.length > 1 ? arguments[1] : void 0);
  };
}, function (t, n, r) {
  var e = r(11),
    o = r(27).f,
    i = {}.toString,
    u = "object" == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  t.exports.f = function (t) {
    return u && "[object Window]" == i.call(t) ? function (t) {
      try {
        return o(t);
      } catch (t) {
        return u.slice();
      }
    }(t) : o(e(t));
  };
}, function (t, n, r) {

  var e = r(44),
    o = r(94);
  t.exports = e ? {}.toString : function () {
    return "[object " + o(this) + "]";
  };
},, function (t, n, r) {

  var e = r(77).IteratorPrototype,
    o = r(28),
    i = r(18),
    u = r(43),
    c = r(50),
    a = function () {
      return this;
    };
  t.exports = function (t, n, r) {
    var f = n + " Iterator";
    return t.prototype = o(e, {
      next: i(1, r)
    }), u(t, f, !1, !0), c[f] = a, t;
  };
}, function (t, n, r) {
  var e = r(2);
  t.exports = !e(function () {
    function t() {}
    return t.prototype.constructor = null, Object.getPrototypeOf(new t()) !== t.prototype;
  });
},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, function (t, n, r) {

  r.r(n);
  r(41), r(38);
  var e = r(0),
    o = "on-checked-change",
    i = "VeCheckboxGroup";
  function u(t) {
    return "ve-checkbox-" + t;
  }
  function c(t, n, r) {
    return n in t ? Object.defineProperty(t, n, {
      value: r,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : t[n] = r, t;
  }
  var a = {
    name: "VeCheckbox",
    props: {
      value: {
        type: [String, Number, Boolean],
        default: null
      },
      label: {
        type: [String],
        default: null
      },
      disabled: Boolean,
      indeterminate: Boolean,
      isControlled: {
        type: Boolean,
        default: !1
      },
      isSelected: {
        type: Boolean,
        default: !1
      }
    },
    data: function () {
      return {
        model: this.value,
        checkboxGroup: {}
      };
    },
    computed: {
      checkboxClass: function () {
        var t;
        return [u("content"), (t = {}, c(t, u("checked"), this.internalIsSelected), c(t, u("disabled"), this.disabled), c(t, u("indeterminate"), this.indeterminate), t)];
      },
      checkboxStyle: function () {
        return {
          display: this.checkboxGroup && this.checkboxGroup.isVerticalShow ? "block" : "inline-block"
        };
      },
      internalIsSelected: function () {
        return this.isControlled ? this.isSelected : this.model;
      }
    },
    watch: {
      value: function () {
        this.updateModelBySingle();
      }
    },
    methods: {
      checkboxChange: function (t) {
        if (this.disabled) return !1;
        var n = t.target.checked;
        this.isControlled || this.$emit("input", n), this.$emit(o, n), this.isCheckBoxGroup() && this.checkboxGroup.updateModel(this.label, n);
      },
      isCheckBoxGroup: function () {
        return this.checkboxGroup = Object(e.c)(this, i), !!this.checkboxGroup;
      },
      getLabelContent: function () {
        var t = this.label,
          n = this.$slots;
        return t || n.default;
      },
      initModel: function () {
        if (this.isCheckBoxGroup()) {
          var t = this.checkboxGroup;
          Array.isArray(t.value) && t.value.length > 0 && t.value.indexOf(this.label) > -1 && (this.model = !0);
        } else this.model = this.value;
      },
      updateModelBySingle: function () {
        this.disabled || (this.model = this.value);
      },
      updateModelByGroup: function (t) {
        t.indexOf(this.label) > -1 ? this.disabled || (this.model = !0) : this.disabled || (this.model = !1);
      }
    },
    created: function () {
      this.initModel();
    },
    render: function () {
      var t = arguments[0],
        n = this.checkboxStyle,
        r = this.label,
        e = this.checkboxClass,
        o = this.checkboxChange,
        i = this.getLabelContent,
        c = this.internalIsSelected;
      return t("label", {
        class: "ve-checkbox",
        style: n
      }, [t("span", {
        class: e
      }, [t("input", {
        domProps: {
          checked: c,
          value: r
        },
        class: u("input"),
        attrs: {
          type: "checkbox"
        },
        on: {
          change: o
        }
      }), t("span", {
        class: u("inner")
      })]), t("span", {
        class: u("label")
      }, [i()])]);
    },
    install: function (t) {
      t.component(a.name, a);
    }
  };
  n.default = a;
}]);
});

unwrapExports(veCheckbox);

var veRadio = createCommonjsModule(function (module) {
module.exports = function (t) {
  var n = {};
  function e(r) {
    if (n[r]) return n[r].exports;
    var o = n[r] = {
      i: r,
      l: !1,
      exports: {}
    };
    return t[r].call(o.exports, o, o.exports, e), o.l = !0, o.exports;
  }
  return e.m = t, e.c = n, e.d = function (t, n, r) {
    e.o(t, n) || Object.defineProperty(t, n, {
      enumerable: !0,
      get: r
    });
  }, e.r = function (t) {
    "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
      value: "Module"
    }), Object.defineProperty(t, "__esModule", {
      value: !0
    });
  }, e.t = function (t, n) {
    if (1 & n && (t = e(t)), 8 & n) return t;
    if (4 & n && "object" == typeof t && t && t.__esModule) return t;
    var r = Object.create(null);
    if (e.r(r), Object.defineProperty(r, "default", {
      enumerable: !0,
      value: t
    }), 2 & n && "string" != typeof t) for (var o in t) e.d(r, o, function (n) {
      return t[n];
    }.bind(null, o));
    return r;
  }, e.n = function (t) {
    var n = t && t.__esModule ? function () {
      return t.default;
    } : function () {
      return t;
    };
    return e.d(n, "a", n), n;
  }, e.o = function (t, n) {
    return Object.prototype.hasOwnProperty.call(t, n);
  }, e.p = "", e(e.s = 189);
}([, function (t, n, e) {
  (function (n) {
    var e = function (t) {
      return t && t.Math == Math && t;
    };
    t.exports = e("object" == typeof globalThis && globalThis) || e("object" == typeof window && window) || e("object" == typeof self && self) || e("object" == typeof n && n) || function () {
      return this;
    }() || Function("return this")();
  }).call(this, e(73));
}, function (t, n) {
  t.exports = function (t) {
    try {
      return !!t();
    } catch (t) {
      return !0;
    }
  };
},, function (t, n, e) {
  var r = e(12),
    o = {}.hasOwnProperty;
  t.exports = function (t, n) {
    return o.call(r(t), n);
  };
}, function (t, n) {
  t.exports = function (t) {
    return "object" == typeof t ? null !== t : "function" == typeof t;
  };
}, function (t, n, e) {
  var r = e(7),
    o = e(47),
    i = e(9),
    u = e(17),
    c = Object.defineProperty;
  n.f = r ? c : function (t, n, e) {
    if (i(t), n = u(n, !0), i(e), o) try {
      return c(t, n, e);
    } catch (t) {}
    if ("get" in e || "set" in e) throw TypeError("Accessors not supported");
    return "value" in e && (t[n] = e.value), t;
  };
}, function (t, n, e) {
  var r = e(2);
  t.exports = !r(function () {
    return 7 != Object.defineProperty({}, 1, {
      get: function () {
        return 7;
      }
    })[1];
  });
},, function (t, n, e) {
  var r = e(5);
  t.exports = function (t) {
    if (!r(t)) throw TypeError(String(t) + " is not an object");
    return t;
  };
}, function (t, n, e) {
  var r = e(7),
    o = e(6),
    i = e(18);
  t.exports = r ? function (t, n, e) {
    return o.f(t, n, i(1, e));
  } : function (t, n, e) {
    return t[n] = e, t;
  };
}, function (t, n, e) {
  var r = e(35),
    o = e(13);
  t.exports = function (t) {
    return r(o(t));
  };
}, function (t, n, e) {
  var r = e(13);
  t.exports = function (t) {
    return Object(r(t));
  };
}, function (t, n) {
  t.exports = function (t) {
    if (null == t) throw TypeError("Can't call method on " + t);
    return t;
  };
}, function (t, n, e) {
  var r = e(1),
    o = e(10),
    i = e(4),
    u = e(32),
    c = e(46),
    a = e(26),
    f = a.get,
    s = a.enforce,
    l = String(String).split("String");
  (t.exports = function (t, n, e, c) {
    var a,
      f = !!c && !!c.unsafe,
      p = !!c && !!c.enumerable,
      d = !!c && !!c.noTargetGet;
    "function" == typeof e && ("string" != typeof n || i(e, "name") || o(e, "name", n), (a = s(e)).source || (a.source = l.join("string" == typeof n ? n : ""))), t !== r ? (f ? !d && t[n] && (p = !0) : delete t[n], p ? t[n] = e : o(t, n, e)) : p ? t[n] = e : u(n, e);
  })(Function.prototype, "toString", function () {
    return "function" == typeof this && f(this).source || c(this);
  });
}, function (t, n) {
  var e = {}.toString;
  t.exports = function (t) {
    return e.call(t).slice(8, -1);
  };
}, function (t, n, e) {
  var r = e(25),
    o = Math.min;
  t.exports = function (t) {
    return t > 0 ? o(r(t), 9007199254740991) : 0;
  };
}, function (t, n, e) {
  var r = e(5);
  t.exports = function (t, n) {
    if (!r(t)) return t;
    var e, o;
    if (n && "function" == typeof (e = t.toString) && !r(o = e.call(t))) return o;
    if ("function" == typeof (e = t.valueOf) && !r(o = e.call(t))) return o;
    if (!n && "function" == typeof (e = t.toString) && !r(o = e.call(t))) return o;
    throw TypeError("Can't convert object to primitive value");
  };
}, function (t, n) {
  t.exports = function (t, n) {
    return {
      enumerable: !(1 & t),
      configurable: !(2 & t),
      writable: !(4 & t),
      value: n
    };
  };
}, function (t, n, e) {
  var r = e(7),
    o = e(42),
    i = e(18),
    u = e(11),
    c = e(17),
    a = e(4),
    f = e(47),
    s = Object.getOwnPropertyDescriptor;
  n.f = r ? s : function (t, n) {
    if (t = u(t), n = c(n, !0), f) try {
      return s(t, n);
    } catch (t) {}
    if (a(t, n)) return i(!o.f.call(t, n), t[n]);
  };
},, function (t, n) {
  t.exports = {};
}, function (t, n, e) {
  var r = e(53),
    o = e(1),
    i = function (t) {
      return "function" == typeof t ? t : void 0;
    };
  t.exports = function (t, n) {
    return arguments.length < 2 ? i(r[t]) || i(o[t]) : r[t] && r[t][n] || o[t] && o[t][n];
  };
}, function (t, n, e) {
  var r = e(29),
    o = e(33),
    i = r("keys");
  t.exports = function (t) {
    return i[t] || (i[t] = o(t));
  };
}, function (t, n) {
  t.exports = !1;
}, function (t, n) {
  var e = Math.ceil,
    r = Math.floor;
  t.exports = function (t) {
    return isNaN(t = +t) ? 0 : (t > 0 ? r : e)(t);
  };
}, function (t, n, e) {
  var r,
    o,
    i,
    u = e(80),
    c = e(1),
    a = e(5),
    f = e(10),
    s = e(4),
    l = e(30),
    p = e(23),
    d = e(21),
    v = c.WeakMap;
  if (u || l.state) {
    var h = l.state || (l.state = new v()),
      y = h.get,
      b = h.has,
      g = h.set;
    r = function (t, n) {
      if (b.call(h, t)) throw new TypeError("Object already initialized");
      return n.facade = t, g.call(h, t, n), n;
    }, o = function (t) {
      return y.call(h, t) || {};
    }, i = function (t) {
      return b.call(h, t);
    };
  } else {
    var m = p("state");
    d[m] = !0, r = function (t, n) {
      if (s(t, m)) throw new TypeError("Object already initialized");
      return n.facade = t, f(t, m, n), n;
    }, o = function (t) {
      return s(t, m) ? t[m] : {};
    }, i = function (t) {
      return s(t, m);
    };
  }
  t.exports = {
    set: r,
    get: o,
    has: i,
    enforce: function (t) {
      return i(t) ? o(t) : r(t, {});
    },
    getterFor: function (t) {
      return function (n) {
        var e;
        if (!a(n) || (e = o(n)).type !== t) throw TypeError("Incompatible receiver, " + t + " required");
        return e;
      };
    }
  };
}, function (t, n, e) {
  var r = e(48),
    o = e(31).concat("length", "prototype");
  n.f = Object.getOwnPropertyNames || function (t) {
    return r(t, o);
  };
}, function (t, n, e) {
  var r,
    o = e(9),
    i = e(81),
    u = e(31),
    c = e(21),
    a = e(74),
    f = e(45),
    s = e(23),
    l = s("IE_PROTO"),
    p = function () {},
    d = function (t) {
      return "<script>" + t + "<\/script>";
    },
    v = function () {
      try {
        r = document.domain && new ActiveXObject("htmlfile");
      } catch (t) {}
      var t, n;
      v = r ? function (t) {
        t.write(d("")), t.close();
        var n = t.parentWindow.Object;
        return t = null, n;
      }(r) : ((n = f("iframe")).style.display = "none", a.appendChild(n), n.src = String("javascript:"), (t = n.contentWindow.document).open(), t.write(d("document.F=Object")), t.close(), t.F);
      for (var e = u.length; e--;) delete v.prototype[u[e]];
      return v();
    };
  c[l] = !0, t.exports = Object.create || function (t, n) {
    var e;
    return null !== t ? (p.prototype = o(t), e = new p(), p.prototype = null, e[l] = t) : e = v(), void 0 === n ? e : i(e, n);
  };
}, function (t, n, e) {
  var r = e(24),
    o = e(30);
  (t.exports = function (t, n) {
    return o[t] || (o[t] = void 0 !== n ? n : {});
  })("versions", []).push({
    version: "3.13.0",
    mode: r ? "pure" : "global",
    copyright: "© 2021 Denis Pushkarev (zloirock.ru)"
  });
}, function (t, n, e) {
  var r = e(1),
    o = e(32),
    i = r["__core-js_shared__"] || o("__core-js_shared__", {});
  t.exports = i;
}, function (t, n) {
  t.exports = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
}, function (t, n, e) {
  var r = e(1),
    o = e(10);
  t.exports = function (t, n) {
    try {
      o(r, t, n);
    } catch (e) {
      r[t] = n;
    }
    return n;
  };
}, function (t, n) {
  var e = 0,
    r = Math.random();
  t.exports = function (t) {
    return "Symbol(" + String(void 0 === t ? "" : t) + ")_" + (++e + r).toString(36);
  };
},, function (t, n, e) {
  var r = e(2),
    o = e(15),
    i = "".split;
  t.exports = r(function () {
    return !Object("z").propertyIsEnumerable(0);
  }) ? function (t) {
    return "String" == o(t) ? i.call(t, "") : Object(t);
  } : Object;
}, function (t, n, e) {
  var r = e(48),
    o = e(31);
  t.exports = Object.keys || function (t) {
    return r(t, o);
  };
},, function (t, n, e) {

  var r = e(7),
    o = e(1),
    i = e(51),
    u = e(14),
    c = e(4),
    a = e(15),
    f = e(92),
    s = e(17),
    l = e(2),
    p = e(28),
    d = e(27).f,
    v = e(19).f,
    h = e(6).f,
    y = e(96).trim,
    b = o.Number,
    g = b.prototype,
    m = "Number" == a(p(g)),
    x = function (t) {
      var n,
        e,
        r,
        o,
        i,
        u,
        c,
        a,
        f = s(t, !1);
      if ("string" == typeof f && f.length > 2) if (43 === (n = (f = y(f)).charCodeAt(0)) || 45 === n) {
        if (88 === (e = f.charCodeAt(2)) || 120 === e) return NaN;
      } else if (48 === n) {
        switch (f.charCodeAt(1)) {
          case 66:
          case 98:
            r = 2, o = 49;
            break;
          case 79:
          case 111:
            r = 8, o = 55;
            break;
          default:
            return +f;
        }
        for (u = (i = f.slice(2)).length, c = 0; c < u; c++) if ((a = i.charCodeAt(c)) < 48 || a > o) return NaN;
        return parseInt(i, r);
      }
      return +f;
    };
  if (i("Number", !b(" 0o1") || !b("0b1") || b("+0x1"))) {
    for (var O, S = function (t) {
        var n = arguments.length < 1 ? 0 : t,
          e = this;
        return e instanceof S && (m ? l(function () {
          g.valueOf.call(e);
        }) : "Number" != a(e)) ? f(new b(x(n)), e, S) : x(n);
      }, j = r ? d(b) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","), w = 0; j.length > w; w++) c(b, O = j[w]) && !c(S, O) && h(S, O, v(b, O));
    S.prototype = g, g.constructor = S, u(o, "Number", S);
  }
},,, function (t, n, e) {
  var r = e(7),
    o = e(6).f,
    i = Function.prototype,
    u = i.toString,
    c = /^\s*function ([^ (]*)/;
  r && !("name" in i) && o(i, "name", {
    configurable: !0,
    get: function () {
      try {
        return u.call(this).match(c)[1];
      } catch (t) {
        return "";
      }
    }
  });
}, function (t, n, e) {

  var r = {}.propertyIsEnumerable,
    o = Object.getOwnPropertyDescriptor,
    i = o && !r.call({
      1: 2
    }, 1);
  n.f = i ? function (t) {
    var n = o(this, t);
    return !!n && n.enumerable;
  } : r;
},,, function (t, n, e) {
  var r = e(1),
    o = e(5),
    i = r.document,
    u = o(i) && o(i.createElement);
  t.exports = function (t) {
    return u ? i.createElement(t) : {};
  };
}, function (t, n, e) {
  var r = e(30),
    o = Function.toString;
  "function" != typeof r.inspectSource && (r.inspectSource = function (t) {
    return o.call(t);
  }), t.exports = r.inspectSource;
}, function (t, n, e) {
  var r = e(7),
    o = e(2),
    i = e(45);
  t.exports = !r && !o(function () {
    return 7 != Object.defineProperty(i("div"), "a", {
      get: function () {
        return 7;
      }
    }).a;
  });
}, function (t, n, e) {
  var r = e(4),
    o = e(11),
    i = e(62).indexOf,
    u = e(21);
  t.exports = function (t, n) {
    var e,
      c = o(t),
      a = 0,
      f = [];
    for (e in c) !r(u, e) && r(c, e) && f.push(e);
    for (; n.length > a;) r(c, e = n[a++]) && (~i(f, e) || f.push(e));
    return f;
  };
},,, function (t, n, e) {
  var r = e(2),
    o = /#|\.prototype\./,
    i = function (t, n) {
      var e = c[u(t)];
      return e == f || e != a && ("function" == typeof n ? r(n) : !!n);
    },
    u = i.normalize = function (t) {
      return String(t).replace(o, ".").toLowerCase();
    },
    c = i.data = {},
    a = i.NATIVE = "N",
    f = i.POLYFILL = "P";
  t.exports = i;
},, function (t, n, e) {
  var r = e(1);
  t.exports = r;
},,,,, function (t, n, e) {
  var r = e(9),
    o = e(91);
  t.exports = Object.setPrototypeOf || ("__proto__" in {} ? function () {
    var t,
      n = !1,
      e = {};
    try {
      (t = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set).call(e, []), n = e instanceof Array;
    } catch (t) {}
    return function (e, i) {
      return r(e), o(i), n ? t.call(e, i) : e.__proto__ = i, e;
    };
  }() : void 0);
}, function (t, n, e) {
  var r = e(25),
    o = Math.max,
    i = Math.min;
  t.exports = function (t, n) {
    var e = r(t);
    return e < 0 ? o(e + n, 0) : i(e, n);
  };
},,, function (t, n, e) {
  var r = e(11),
    o = e(16),
    i = e(59),
    u = function (t) {
      return function (n, e, u) {
        var c,
          a = r(n),
          f = o(a.length),
          s = i(u, f);
        if (t && e != e) {
          for (; f > s;) if ((c = a[s++]) != c) return !0;
        } else for (; f > s; s++) if ((t || s in a) && a[s] === e) return t || s || 0;
        return !t && -1;
      };
    };
  t.exports = {
    includes: u(!0),
    indexOf: u(!1)
  };
},,,,,,,,,,, function (t, n) {
  var e;
  e = function () {
    return this;
  }();
  try {
    e = e || new Function("return this")();
  } catch (t) {
    "object" == typeof window && (e = window);
  }
  t.exports = e;
}, function (t, n, e) {
  var r = e(22);
  t.exports = r("document", "documentElement");
},,,,,, function (t, n, e) {
  var r = e(1),
    o = e(46),
    i = r.WeakMap;
  t.exports = "function" == typeof i && /native code/.test(o(i));
}, function (t, n, e) {
  var r = e(7),
    o = e(6),
    i = e(9),
    u = e(36);
  t.exports = r ? Object.defineProperties : function (t, n) {
    i(t);
    for (var e, r = u(n), c = r.length, a = 0; c > a;) o.f(t, e = r[a++], n[e]);
    return t;
  };
},,,,,,,,,, function (t, n, e) {
  var r = e(5);
  t.exports = function (t) {
    if (!r(t) && null !== t) throw TypeError("Can't set " + String(t) + " as a prototype");
    return t;
  };
}, function (t, n, e) {
  var r = e(5),
    o = e(58);
  t.exports = function (t, n, e) {
    var i, u;
    return o && "function" == typeof (i = n.constructor) && i !== e && r(u = i.prototype) && u !== e.prototype && o(t, u), t;
  };
},,,, function (t, n, e) {
  var r = e(13),
    o = "[" + e(97) + "]",
    i = RegExp("^" + o + o + "*"),
    u = RegExp(o + o + "*$"),
    c = function (t) {
      return function (n) {
        var e = String(r(n));
        return 1 & t && (e = e.replace(i, "")), 2 & t && (e = e.replace(u, "")), e;
      };
    };
  t.exports = {
    start: c(1),
    end: c(2),
    trim: c(3)
  };
}, function (t, n) {
  t.exports = "\t\n\v\f\r                　\u2028\u2029\ufeff";
},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, function (t, n, e) {

  e.r(n);
  e(41), e(38);
  var r = "on-radio-change";
  function o(t) {
    return "ve-radio-" + t;
  }
  function i(t, n, e) {
    return n in t ? Object.defineProperty(t, n, {
      value: e,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : t[n] = e, t;
  }
  var u = {
    name: "VeRadio",
    props: {
      value: {
        type: [String, Number, Boolean],
        default: null
      },
      label: {
        type: String,
        default: null
      },
      disabled: Boolean,
      isControlled: {
        type: Boolean,
        default: !1
      },
      isSelected: {
        type: Boolean,
        default: !1
      }
    },
    data: function () {
      return {
        model: this.value
      };
    },
    computed: {
      radioClass: function () {
        var t;
        return [o("container"), (t = {}, i(t, o("checked"), this.internalIsSelected), i(t, o("disabled"), this.disabled), t)];
      },
      internalIsSelected: function () {
        return this.isControlled ? this.isSelected : this.model;
      }
    },
    watch: {
      value: function () {
        this.updateModelBySingle();
      }
    },
    methods: {
      checkedChange: function (t) {
        if (this.disabled) return !1;
        var n = t.target.checked;
        this.isControlled || this.$emit("input", n), this.$emit(r, n);
      },
      getLabelContent: function () {
        var t = this.label,
          n = this.$slots;
        return t || n.default;
      },
      initModel: function () {
        this.model = this.value;
      },
      updateModelBySingle: function () {
        this.disabled || (this.model = this.value);
      }
    },
    created: function () {
      this.initModel();
    },
    render: function () {
      var t = arguments[0],
        n = this.label,
        e = this.radioClass,
        r = this.checkedChange,
        i = this.getLabelContent,
        u = this.internalIsSelected;
      return t("label", {
        class: "ve-radio"
      }, [t("span", {
        class: e
      }, [t("input", {
        domProps: {
          checked: u,
          value: n
        },
        class: o("input"),
        attrs: {
          type: "radio"
        },
        on: {
          change: r
        }
      }), t("span", {
        class: o("inner")
      })]), t("span", {
        class: o("label")
      }, [i()])]);
    },
    install: function (t) {
      t.component(u.name, u);
    }
  };
  n.default = u;
}]);
});

unwrapExports(veRadio);

var veDropdown = createCommonjsModule(function (module) {
module.exports = function (t) {
  var e = {};
  function n(r) {
    if (e[r]) return e[r].exports;
    var o = e[r] = {
      i: r,
      l: !1,
      exports: {}
    };
    return t[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports;
  }
  return n.m = t, n.c = e, n.d = function (t, e, r) {
    n.o(t, e) || Object.defineProperty(t, e, {
      enumerable: !0,
      get: r
    });
  }, n.r = function (t) {
    "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
      value: "Module"
    }), Object.defineProperty(t, "__esModule", {
      value: !0
    });
  }, n.t = function (t, e) {
    if (1 & e && (t = n(t)), 8 & e) return t;
    if (4 & e && "object" == typeof t && t && t.__esModule) return t;
    var r = Object.create(null);
    if (n.r(r), Object.defineProperty(r, "default", {
      enumerable: !0,
      value: t
    }), 2 & e && "string" != typeof t) for (var o in t) n.d(r, o, function (e) {
      return t[e];
    }.bind(null, o));
    return r;
  }, n.n = function (t) {
    var e = t && t.__esModule ? function () {
      return t.default;
    } : function () {
      return t;
    };
    return n.d(e, "a", e), e;
  }, n.o = function (t, e) {
    return Object.prototype.hasOwnProperty.call(t, e);
  }, n.p = "", n(n.s = 188);
}([function (t, e, n) {

  n.d(e, "a", function () {
    return i;
  }), n.d(e, "g", function () {
    return c;
  }), n.d(e, "h", function () {
    return u;
  }), n.d(e, "f", function () {
    return a;
  }), n.d(e, "i", function () {
    return s;
  }), n.d(e, "e", function () {
    return l;
  }), n.d(e, "j", function () {
    return f;
  }), n.d(e, "d", function () {
    return p;
  }), n.d(e, "c", function () {
    return d;
  }), n.d(e, "b", function () {
    return h;
  }), n.d(e, "k", function () {
    return v;
  });
  n(41), n(54), n(76), n(93), n(64), n(95), n(57), n(88), n(90), n(84);
  var r = n(79),
    o = n.n(r);
  function i(t) {
    return function (t) {
      return function (e) {
        var n = "",
          r = o.a.getMessage();
        if (r[t]) {
          for (var i = r[t][e], c = arguments.length, u = new Array(c > 1 ? c - 1 : 0), a = 1; a < c; a++) u[a - 1] = arguments[a];
          n = s(i) ? i.apply(void 0, u) : i;
        } else console.error("can't find ".concat(t, " in ").concat(JSON.stringify(r)));
        return n;
      };
    }(t);
  }
  function c(t) {
    return !(Array.isArray(t) && t.length > 0);
  }
  function u(t) {
    return !("" !== t && null != t);
  }
  function a(t) {
    return null != t;
  }
  function s(t) {
    return "function" == typeof t;
  }
  function l(t) {
    return "boolean" == typeof t;
  }
  function f(t) {
    return "number" == typeof t;
  }
  function p(t) {
    return "number" == typeof t ? t + "px" : t;
  }
  function d(t, e) {
    for (var n = t.$parent; n;) {
      if (n.$options.name === e) return n;
      n = n.$parent;
    }
    return null;
  }
  function h(t, e) {
    for (var n = [], r = t.$children; r && r.length > 0;) r.forEach(function (t) {
      r = t.$children ? t.$children : null, t.$options.name === e && n.push(t);
    });
    return n;
  }
  function v(t, e) {
    if (s(t.scrollTo)) t.scrollTo(e);else {
      var n = e.top,
        r = e.left;
      t.scrollTop = n, t.scrollLeft = r;
    }
  }
}, function (t, e, n) {
  (function (e) {
    var n = function (t) {
      return t && t.Math == Math && t;
    };
    t.exports = n("object" == typeof globalThis && globalThis) || n("object" == typeof window && window) || n("object" == typeof self && self) || n("object" == typeof e && e) || function () {
      return this;
    }() || Function("return this")();
  }).call(this, n(73));
}, function (t, e) {
  t.exports = function (t) {
    try {
      return !!t();
    } catch (t) {
      return !0;
    }
  };
}, function (t, e, n) {
  var r = n(1),
    o = n(29),
    i = n(4),
    c = n(33),
    u = n(40),
    a = n(56),
    s = o("wks"),
    l = r.Symbol,
    f = a ? l : l && l.withoutSetter || c;
  t.exports = function (t) {
    return i(s, t) && (u || "string" == typeof s[t]) || (u && i(l, t) ? s[t] = l[t] : s[t] = f("Symbol." + t)), s[t];
  };
}, function (t, e, n) {
  var r = n(12),
    o = {}.hasOwnProperty;
  t.exports = function (t, e) {
    return o.call(r(t), e);
  };
}, function (t, e) {
  t.exports = function (t) {
    return "object" == typeof t ? null !== t : "function" == typeof t;
  };
}, function (t, e, n) {
  var r = n(7),
    o = n(47),
    i = n(9),
    c = n(17),
    u = Object.defineProperty;
  e.f = r ? u : function (t, e, n) {
    if (i(t), e = c(e, !0), i(n), o) try {
      return u(t, e, n);
    } catch (t) {}
    if ("get" in n || "set" in n) throw TypeError("Accessors not supported");
    return "value" in n && (t[e] = n.value), t;
  };
}, function (t, e, n) {
  var r = n(2);
  t.exports = !r(function () {
    return 7 != Object.defineProperty({}, 1, {
      get: function () {
        return 7;
      }
    })[1];
  });
}, function (t, e, n) {
  var r = n(1),
    o = n(19).f,
    i = n(10),
    c = n(14),
    u = n(32),
    a = n(61),
    s = n(51);
  t.exports = function (t, e) {
    var n,
      l,
      f,
      p,
      d,
      h = t.target,
      v = t.global,
      g = t.stat;
    if (n = v ? r : g ? r[h] || u(h, {}) : (r[h] || {}).prototype) for (l in e) {
      if (p = e[l], f = t.noTargetGet ? (d = o(n, l)) && d.value : n[l], !s(v ? l : h + (g ? "." : "#") + l, t.forced) && void 0 !== f) {
        if (typeof p == typeof f) continue;
        a(p, f);
      }
      (t.sham || f && f.sham) && i(p, "sham", !0), c(n, l, p, t);
    }
  };
}, function (t, e, n) {
  var r = n(5);
  t.exports = function (t) {
    if (!r(t)) throw TypeError(String(t) + " is not an object");
    return t;
  };
}, function (t, e, n) {
  var r = n(7),
    o = n(6),
    i = n(18);
  t.exports = r ? function (t, e, n) {
    return o.f(t, e, i(1, n));
  } : function (t, e, n) {
    return t[e] = n, t;
  };
}, function (t, e, n) {
  var r = n(35),
    o = n(13);
  t.exports = function (t) {
    return r(o(t));
  };
}, function (t, e, n) {
  var r = n(13);
  t.exports = function (t) {
    return Object(r(t));
  };
}, function (t, e) {
  t.exports = function (t) {
    if (null == t) throw TypeError("Can't call method on " + t);
    return t;
  };
}, function (t, e, n) {
  var r = n(1),
    o = n(10),
    i = n(4),
    c = n(32),
    u = n(46),
    a = n(26),
    s = a.get,
    l = a.enforce,
    f = String(String).split("String");
  (t.exports = function (t, e, n, u) {
    var a,
      s = !!u && !!u.unsafe,
      p = !!u && !!u.enumerable,
      d = !!u && !!u.noTargetGet;
    "function" == typeof n && ("string" != typeof e || i(n, "name") || o(n, "name", e), (a = l(n)).source || (a.source = f.join("string" == typeof e ? e : ""))), t !== r ? (s ? !d && t[e] && (p = !0) : delete t[e], p ? t[e] = n : o(t, e, n)) : p ? t[e] = n : c(e, n);
  })(Function.prototype, "toString", function () {
    return "function" == typeof this && s(this).source || u(this);
  });
}, function (t, e) {
  var n = {}.toString;
  t.exports = function (t) {
    return n.call(t).slice(8, -1);
  };
}, function (t, e, n) {
  var r = n(25),
    o = Math.min;
  t.exports = function (t) {
    return t > 0 ? o(r(t), 9007199254740991) : 0;
  };
}, function (t, e, n) {
  var r = n(5);
  t.exports = function (t, e) {
    if (!r(t)) return t;
    var n, o;
    if (e && "function" == typeof (n = t.toString) && !r(o = n.call(t))) return o;
    if ("function" == typeof (n = t.valueOf) && !r(o = n.call(t))) return o;
    if (!e && "function" == typeof (n = t.toString) && !r(o = n.call(t))) return o;
    throw TypeError("Can't convert object to primitive value");
  };
}, function (t, e) {
  t.exports = function (t, e) {
    return {
      enumerable: !(1 & t),
      configurable: !(2 & t),
      writable: !(4 & t),
      value: e
    };
  };
}, function (t, e, n) {
  var r = n(7),
    o = n(42),
    i = n(18),
    c = n(11),
    u = n(17),
    a = n(4),
    s = n(47),
    l = Object.getOwnPropertyDescriptor;
  e.f = r ? l : function (t, e) {
    if (t = c(t), e = u(e, !0), s) try {
      return l(t, e);
    } catch (t) {}
    if (a(t, e)) return i(!o.f.call(t, e), t[e]);
  };
},, function (t, e) {
  t.exports = {};
}, function (t, e, n) {
  var r = n(53),
    o = n(1),
    i = function (t) {
      return "function" == typeof t ? t : void 0;
    };
  t.exports = function (t, e) {
    return arguments.length < 2 ? i(r[t]) || i(o[t]) : r[t] && r[t][e] || o[t] && o[t][e];
  };
}, function (t, e, n) {
  var r = n(29),
    o = n(33),
    i = r("keys");
  t.exports = function (t) {
    return i[t] || (i[t] = o(t));
  };
}, function (t, e) {
  t.exports = !1;
}, function (t, e) {
  var n = Math.ceil,
    r = Math.floor;
  t.exports = function (t) {
    return isNaN(t = +t) ? 0 : (t > 0 ? r : n)(t);
  };
}, function (t, e, n) {
  var r,
    o,
    i,
    c = n(80),
    u = n(1),
    a = n(5),
    s = n(10),
    l = n(4),
    f = n(30),
    p = n(23),
    d = n(21),
    h = u.WeakMap;
  if (c || f.state) {
    var v = f.state || (f.state = new h()),
      g = v.get,
      y = v.has,
      m = v.set;
    r = function (t, e) {
      if (y.call(v, t)) throw new TypeError("Object already initialized");
      return e.facade = t, m.call(v, t, e), e;
    }, o = function (t) {
      return g.call(v, t) || {};
    }, i = function (t) {
      return y.call(v, t);
    };
  } else {
    var b = p("state");
    d[b] = !0, r = function (t, e) {
      if (l(t, b)) throw new TypeError("Object already initialized");
      return e.facade = t, s(t, b, e), e;
    }, o = function (t) {
      return l(t, b) ? t[b] : {};
    }, i = function (t) {
      return l(t, b);
    };
  }
  t.exports = {
    set: r,
    get: o,
    has: i,
    enforce: function (t) {
      return i(t) ? o(t) : r(t, {});
    },
    getterFor: function (t) {
      return function (e) {
        var n;
        if (!a(e) || (n = o(e)).type !== t) throw TypeError("Incompatible receiver, " + t + " required");
        return n;
      };
    }
  };
}, function (t, e, n) {
  var r = n(48),
    o = n(31).concat("length", "prototype");
  e.f = Object.getOwnPropertyNames || function (t) {
    return r(t, o);
  };
}, function (t, e, n) {
  var r,
    o = n(9),
    i = n(81),
    c = n(31),
    u = n(21),
    a = n(74),
    s = n(45),
    l = n(23),
    f = l("IE_PROTO"),
    p = function () {},
    d = function (t) {
      return "<script>" + t + "<\/script>";
    },
    h = function () {
      try {
        r = document.domain && new ActiveXObject("htmlfile");
      } catch (t) {}
      var t, e;
      h = r ? function (t) {
        t.write(d("")), t.close();
        var e = t.parentWindow.Object;
        return t = null, e;
      }(r) : ((e = s("iframe")).style.display = "none", a.appendChild(e), e.src = String("javascript:"), (t = e.contentWindow.document).open(), t.write(d("document.F=Object")), t.close(), t.F);
      for (var n = c.length; n--;) delete h.prototype[c[n]];
      return h();
    };
  u[f] = !0, t.exports = Object.create || function (t, e) {
    var n;
    return null !== t ? (p.prototype = o(t), n = new p(), p.prototype = null, n[f] = t) : n = h(), void 0 === e ? n : i(n, e);
  };
}, function (t, e, n) {
  var r = n(24),
    o = n(30);
  (t.exports = function (t, e) {
    return o[t] || (o[t] = void 0 !== e ? e : {});
  })("versions", []).push({
    version: "3.13.0",
    mode: r ? "pure" : "global",
    copyright: "© 2021 Denis Pushkarev (zloirock.ru)"
  });
}, function (t, e, n) {
  var r = n(1),
    o = n(32),
    i = r["__core-js_shared__"] || o("__core-js_shared__", {});
  t.exports = i;
}, function (t, e) {
  t.exports = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
}, function (t, e, n) {
  var r = n(1),
    o = n(10);
  t.exports = function (t, e) {
    try {
      o(r, t, e);
    } catch (n) {
      r[t] = e;
    }
    return e;
  };
}, function (t, e) {
  var n = 0,
    r = Math.random();
  t.exports = function (t) {
    return "Symbol(" + String(void 0 === t ? "" : t) + ")_" + (++n + r).toString(36);
  };
}, function (t, e, n) {
  var r = n(70),
    o = n(35),
    i = n(12),
    c = n(16),
    u = n(55),
    a = [].push,
    s = function (t) {
      var e = 1 == t,
        n = 2 == t,
        s = 3 == t,
        l = 4 == t,
        f = 6 == t,
        p = 7 == t,
        d = 5 == t || f;
      return function (h, v, g, y) {
        for (var m, b, x = i(h), w = o(x), S = r(v, g, 3), O = c(w.length), E = 0, T = y || u, I = e ? T(h, O) : n || p ? T(h, 0) : void 0; O > E; E++) if ((d || E in w) && (b = S(m = w[E], E, x), t)) if (e) I[E] = b;else if (b) switch (t) {
          case 3:
            return !0;
          case 5:
            return m;
          case 6:
            return E;
          case 2:
            a.call(I, m);
        } else switch (t) {
          case 4:
            return !1;
          case 7:
            a.call(I, m);
        }
        return f ? -1 : s || l ? l : I;
      };
    };
  t.exports = {
    forEach: s(0),
    map: s(1),
    filter: s(2),
    some: s(3),
    every: s(4),
    find: s(5),
    findIndex: s(6),
    filterOut: s(7)
  };
}, function (t, e, n) {
  var r = n(2),
    o = n(15),
    i = "".split;
  t.exports = r(function () {
    return !Object("z").propertyIsEnumerable(0);
  }) ? function (t) {
    return "String" == o(t) ? i.call(t, "") : Object(t);
  } : Object;
}, function (t, e, n) {
  var r = n(48),
    o = n(31);
  t.exports = Object.keys || function (t) {
    return r(t, o);
  };
}, function (t, e, n) {
  var r,
    o,
    i = n(1),
    c = n(82),
    u = i.process,
    a = u && u.versions,
    s = a && a.v8;
  s ? o = (r = s.split("."))[0] < 4 ? 1 : r[0] + r[1] : c && (!(r = c.match(/Edge\/(\d+)/)) || r[1] >= 74) && (r = c.match(/Chrome\/(\d+)/)) && (o = r[1]), t.exports = o && +o;
}, function (t, e, n) {

  var r = n(7),
    o = n(1),
    i = n(51),
    c = n(14),
    u = n(4),
    a = n(15),
    s = n(92),
    l = n(17),
    f = n(2),
    p = n(28),
    d = n(27).f,
    h = n(19).f,
    v = n(6).f,
    g = n(96).trim,
    y = o.Number,
    m = y.prototype,
    b = "Number" == a(p(m)),
    x = function (t) {
      var e,
        n,
        r,
        o,
        i,
        c,
        u,
        a,
        s = l(t, !1);
      if ("string" == typeof s && s.length > 2) if (43 === (e = (s = g(s)).charCodeAt(0)) || 45 === e) {
        if (88 === (n = s.charCodeAt(2)) || 120 === n) return NaN;
      } else if (48 === e) {
        switch (s.charCodeAt(1)) {
          case 66:
          case 98:
            r = 2, o = 49;
            break;
          case 79:
          case 111:
            r = 8, o = 55;
            break;
          default:
            return +s;
        }
        for (c = (i = s.slice(2)).length, u = 0; u < c; u++) if ((a = i.charCodeAt(u)) < 48 || a > o) return NaN;
        return parseInt(i, r);
      }
      return +s;
    };
  if (i("Number", !y(" 0o1") || !y("0b1") || y("+0x1"))) {
    for (var w, S = function (t) {
        var e = arguments.length < 1 ? 0 : t,
          n = this;
        return n instanceof S && (b ? f(function () {
          m.valueOf.call(n);
        }) : "Number" != a(n)) ? s(new y(x(e)), n, S) : x(e);
      }, O = r ? d(y) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","), E = 0; O.length > E; E++) u(y, w = O[E]) && !u(S, w) && v(S, w, h(y, w));
    S.prototype = m, m.constructor = S, c(o, "Number", S);
  }
}, function (t, e, n) {
  var r = n(15);
  t.exports = Array.isArray || function (t) {
    return "Array" == r(t);
  };
}, function (t, e, n) {
  var r = n(37),
    o = n(2);
  t.exports = !!Object.getOwnPropertySymbols && !o(function () {
    return !String(Symbol()) || !Symbol.sham && r && r < 41;
  });
}, function (t, e, n) {
  var r = n(7),
    o = n(6).f,
    i = Function.prototype,
    c = i.toString,
    u = /^\s*function ([^ (]*)/;
  r && !("name" in i) && o(i, "name", {
    configurable: !0,
    get: function () {
      try {
        return c.call(this).match(u)[1];
      } catch (t) {
        return "";
      }
    }
  });
}, function (t, e, n) {

  var r = {}.propertyIsEnumerable,
    o = Object.getOwnPropertyDescriptor,
    i = o && !r.call({
      1: 2
    }, 1);
  e.f = i ? function (t) {
    var e = o(this, t);
    return !!e && e.enumerable;
  } : r;
}, function (t, e, n) {
  var r = n(6).f,
    o = n(4),
    i = n(3)("toStringTag");
  t.exports = function (t, e, n) {
    t && !o(t = n ? t : t.prototype, i) && r(t, i, {
      configurable: !0,
      value: e
    });
  };
}, function (t, e, n) {
  var r = {};
  r[n(3)("toStringTag")] = "z", t.exports = "[object z]" === String(r);
}, function (t, e, n) {
  var r = n(1),
    o = n(5),
    i = r.document,
    c = o(i) && o(i.createElement);
  t.exports = function (t) {
    return c ? i.createElement(t) : {};
  };
}, function (t, e, n) {
  var r = n(30),
    o = Function.toString;
  "function" != typeof r.inspectSource && (r.inspectSource = function (t) {
    return o.call(t);
  }), t.exports = r.inspectSource;
}, function (t, e, n) {
  var r = n(7),
    o = n(2),
    i = n(45);
  t.exports = !r && !o(function () {
    return 7 != Object.defineProperty(i("div"), "a", {
      get: function () {
        return 7;
      }
    }).a;
  });
}, function (t, e, n) {
  var r = n(4),
    o = n(11),
    i = n(62).indexOf,
    c = n(21);
  t.exports = function (t, e) {
    var n,
      u = o(t),
      a = 0,
      s = [];
    for (n in u) !r(c, n) && r(u, n) && s.push(n);
    for (; e.length > a;) r(u, n = e[a++]) && (~i(s, n) || s.push(n));
    return s;
  };
}, function (t, e) {
  e.f = Object.getOwnPropertySymbols;
}, function (t, e) {
  t.exports = {};
}, function (t, e, n) {
  var r = n(2),
    o = /#|\.prototype\./,
    i = function (t, e) {
      var n = u[c(t)];
      return n == s || n != a && ("function" == typeof e ? r(e) : !!e);
    },
    c = i.normalize = function (t) {
      return String(t).replace(o, ".").toLowerCase();
    },
    u = i.data = {},
    a = i.NATIVE = "N",
    s = i.POLYFILL = "P";
  t.exports = i;
}, function (t, e, n) {
  var r = n(2),
    o = n(3),
    i = n(37),
    c = o("species");
  t.exports = function (t) {
    return i >= 51 || !r(function () {
      var e = [];
      return (e.constructor = {})[c] = function () {
        return {
          foo: 1
        };
      }, 1 !== e[t](Boolean).foo;
    });
  };
}, function (t, e, n) {
  var r = n(1);
  t.exports = r;
}, function (t, e, n) {
  var r = n(1),
    o = n(66),
    i = n(98),
    c = n(10);
  for (var u in o) {
    var a = r[u],
      s = a && a.prototype;
    if (s && s.forEach !== i) try {
      c(s, "forEach", i);
    } catch (t) {
      s.forEach = i;
    }
  }
}, function (t, e, n) {
  var r = n(5),
    o = n(39),
    i = n(3)("species");
  t.exports = function (t, e) {
    var n;
    return o(t) && ("function" != typeof (n = t.constructor) || n !== Array && !o(n.prototype) ? r(n) && null === (n = n[i]) && (n = void 0) : n = void 0), new (void 0 === n ? Array : n)(0 === e ? 0 : e);
  };
}, function (t, e, n) {
  var r = n(40);
  t.exports = r && !Symbol.sham && "symbol" == typeof Symbol.iterator;
}, function (t, e, n) {

  var r = n(11),
    o = n(65),
    i = n(50),
    c = n(26),
    u = n(71),
    a = c.set,
    s = c.getterFor("Array Iterator");
  t.exports = u(Array, "Array", function (t, e) {
    a(this, {
      type: "Array Iterator",
      target: r(t),
      index: 0,
      kind: e
    });
  }, function () {
    var t = s(this),
      e = t.target,
      n = t.kind,
      r = t.index++;
    return !e || r >= e.length ? (t.target = void 0, {
      value: void 0,
      done: !0
    }) : "keys" == n ? {
      value: r,
      done: !1
    } : "values" == n ? {
      value: e[r],
      done: !1
    } : {
      value: [r, e[r]],
      done: !1
    };
  }, "values"), i.Arguments = i.Array, o("keys"), o("values"), o("entries");
}, function (t, e, n) {
  var r = n(9),
    o = n(91);
  t.exports = Object.setPrototypeOf || ("__proto__" in {} ? function () {
    var t,
      e = !1,
      n = {};
    try {
      (t = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set).call(n, []), e = n instanceof Array;
    } catch (t) {}
    return function (n, i) {
      return r(n), o(i), e ? t.call(n, i) : n.__proto__ = i, n;
    };
  }() : void 0);
}, function (t, e, n) {
  var r = n(25),
    o = Math.max,
    i = Math.min;
  t.exports = function (t, e) {
    var n = r(t);
    return n < 0 ? o(n + e, 0) : i(n, e);
  };
}, function (t, e) {
  t.exports = function (t) {
    if ("function" != typeof t) throw TypeError(String(t) + " is not a function");
    return t;
  };
}, function (t, e, n) {
  var r = n(4),
    o = n(83),
    i = n(19),
    c = n(6);
  t.exports = function (t, e) {
    for (var n = o(e), u = c.f, a = i.f, s = 0; s < n.length; s++) {
      var l = n[s];
      r(t, l) || u(t, l, a(e, l));
    }
  };
}, function (t, e, n) {
  var r = n(11),
    o = n(16),
    i = n(59),
    c = function (t) {
      return function (e, n, c) {
        var u,
          a = r(e),
          s = o(a.length),
          l = i(c, s);
        if (t && n != n) {
          for (; s > l;) if ((u = a[l++]) != u) return !0;
        } else for (; s > l; l++) if ((t || l in a) && a[l] === n) return t || l || 0;
        return !t && -1;
      };
    };
  t.exports = {
    includes: c(!0),
    indexOf: c(!1)
  };
}, function (t, e, n) {
  var r = n(3);
  e.f = r;
}, function (t, e, n) {
  var r = n(44),
    o = n(14),
    i = n(100);
  r || o(Object.prototype, "toString", i, {
    unsafe: !0
  });
}, function (t, e, n) {
  var r = n(3),
    o = n(28),
    i = n(6),
    c = r("unscopables"),
    u = Array.prototype;
  null == u[c] && i.f(u, c, {
    configurable: !0,
    value: o(null)
  }), t.exports = function (t) {
    u[c][t] = !0;
  };
}, function (t, e) {
  t.exports = {
    CSSRuleList: 0,
    CSSStyleDeclaration: 0,
    CSSValueList: 0,
    ClientRectList: 0,
    DOMRectList: 0,
    DOMStringList: 0,
    DOMTokenList: 1,
    DataTransferItemList: 0,
    FileList: 0,
    HTMLAllCollection: 0,
    HTMLCollection: 0,
    HTMLFormElement: 0,
    HTMLSelectElement: 0,
    MediaList: 0,
    MimeTypeArray: 0,
    NamedNodeMap: 0,
    NodeList: 1,
    PaintRequestList: 0,
    Plugin: 0,
    PluginArray: 0,
    SVGLengthList: 0,
    SVGNumberList: 0,
    SVGPathSegList: 0,
    SVGPointList: 0,
    SVGStringList: 0,
    SVGTransformList: 0,
    SourceBufferList: 0,
    StyleSheetList: 0,
    TextTrackCueList: 0,
    TextTrackList: 0,
    TouchList: 0
  };
}, function (t, e, n) {
  var r = n(53),
    o = n(4),
    i = n(63),
    c = n(6).f;
  t.exports = function (t) {
    var e = r.Symbol || (r.Symbol = {});
    o(e, t) || c(e, t, {
      value: i.f(t)
    });
  };
},,, function (t, e, n) {
  var r = n(60);
  t.exports = function (t, e, n) {
    if (r(t), void 0 === e) return t;
    switch (n) {
      case 0:
        return function () {
          return t.call(e);
        };
      case 1:
        return function (n) {
          return t.call(e, n);
        };
      case 2:
        return function (n, r) {
          return t.call(e, n, r);
        };
      case 3:
        return function (n, r, o) {
          return t.call(e, n, r, o);
        };
    }
    return function () {
      return t.apply(e, arguments);
    };
  };
}, function (t, e, n) {

  var r = n(8),
    o = n(102),
    i = n(78),
    c = n(58),
    u = n(43),
    a = n(10),
    s = n(14),
    l = n(3),
    f = n(24),
    p = n(50),
    d = n(77),
    h = d.IteratorPrototype,
    v = d.BUGGY_SAFARI_ITERATORS,
    g = l("iterator"),
    y = function () {
      return this;
    };
  t.exports = function (t, e, n, l, d, m, b) {
    o(n, e, l);
    var x,
      w,
      S,
      O = function (t) {
        if (t === d && P) return P;
        if (!v && t in I) return I[t];
        switch (t) {
          case "keys":
          case "values":
          case "entries":
            return function () {
              return new n(this, t);
            };
        }
        return function () {
          return new n(this);
        };
      },
      E = e + " Iterator",
      T = !1,
      I = t.prototype,
      j = I[g] || I["@@iterator"] || d && I[d],
      P = !v && j || O(d),
      A = "Array" == e && I.entries || j;
    if (A && (x = i(A.call(new t())), h !== Object.prototype && x.next && (f || i(x) === h || (c ? c(x, h) : "function" != typeof x[g] && a(x, g, y)), u(x, E, !0, !0), f && (p[E] = y))), "values" == d && j && "values" !== j.name && (T = !0, P = function () {
      return j.call(this);
    }), f && !b || I[g] === P || a(I, g, P), p[e] = P, d) if (w = {
      values: O("values"),
      keys: m ? P : O("keys"),
      entries: O("entries")
    }, b) for (S in w) (v || T || !(S in I)) && s(I, S, w[S]);else r({
      target: e,
      proto: !0,
      forced: v || T
    }, w);
    return w;
  };
}, function (t, e, n) {

  var r = n(17),
    o = n(6),
    i = n(18);
  t.exports = function (t, e, n) {
    var c = r(e);
    c in t ? o.f(t, c, i(0, n)) : t[c] = n;
  };
}, function (t, e) {
  var n;
  n = function () {
    return this;
  }();
  try {
    n = n || new Function("return this")();
  } catch (t) {
    "object" == typeof window && (n = window);
  }
  t.exports = n;
}, function (t, e, n) {
  var r = n(22);
  t.exports = r("document", "documentElement");
}, function (t, e, n) {

  var r = n(2);
  t.exports = function (t, e) {
    var n = [][t];
    return !!n && r(function () {
      n.call(null, e || function () {
        throw 1;
      }, 1);
    });
  };
}, function (t, e, n) {

  var r = n(8),
    o = n(1),
    i = n(22),
    c = n(24),
    u = n(7),
    a = n(40),
    s = n(56),
    l = n(2),
    f = n(4),
    p = n(39),
    d = n(5),
    h = n(9),
    v = n(12),
    g = n(11),
    y = n(17),
    m = n(18),
    b = n(28),
    x = n(36),
    w = n(27),
    S = n(99),
    O = n(49),
    E = n(19),
    T = n(6),
    I = n(42),
    j = n(10),
    P = n(14),
    A = n(29),
    C = n(23),
    L = n(21),
    k = n(33),
    _ = n(3),
    R = n(63),
    N = n(67),
    D = n(43),
    M = n(26),
    $ = n(34).forEach,
    F = C("hidden"),
    V = _("toPrimitive"),
    B = M.set,
    U = M.getterFor("Symbol"),
    G = Object.prototype,
    Y = o.Symbol,
    W = i("JSON", "stringify"),
    q = E.f,
    H = T.f,
    X = S.f,
    z = I.f,
    K = A("symbols"),
    J = A("op-symbols"),
    Q = A("string-to-symbol-registry"),
    Z = A("symbol-to-string-registry"),
    tt = A("wks"),
    et = o.QObject,
    nt = !et || !et.prototype || !et.prototype.findChild,
    rt = u && l(function () {
      return 7 != b(H({}, "a", {
        get: function () {
          return H(this, "a", {
            value: 7
          }).a;
        }
      })).a;
    }) ? function (t, e, n) {
      var r = q(G, e);
      r && delete G[e], H(t, e, n), r && t !== G && H(G, e, r);
    } : H,
    ot = function (t, e) {
      var n = K[t] = b(Y.prototype);
      return B(n, {
        type: "Symbol",
        tag: t,
        description: e
      }), u || (n.description = e), n;
    },
    it = s ? function (t) {
      return "symbol" == typeof t;
    } : function (t) {
      return Object(t) instanceof Y;
    },
    ct = function (t, e, n) {
      t === G && ct(J, e, n), h(t);
      var r = y(e, !0);
      return h(n), f(K, r) ? (n.enumerable ? (f(t, F) && t[F][r] && (t[F][r] = !1), n = b(n, {
        enumerable: m(0, !1)
      })) : (f(t, F) || H(t, F, m(1, {})), t[F][r] = !0), rt(t, r, n)) : H(t, r, n);
    },
    ut = function (t, e) {
      h(t);
      var n = g(e),
        r = x(n).concat(ft(n));
      return $(r, function (e) {
        u && !at.call(n, e) || ct(t, e, n[e]);
      }), t;
    },
    at = function (t) {
      var e = y(t, !0),
        n = z.call(this, e);
      return !(this === G && f(K, e) && !f(J, e)) && (!(n || !f(this, e) || !f(K, e) || f(this, F) && this[F][e]) || n);
    },
    st = function (t, e) {
      var n = g(t),
        r = y(e, !0);
      if (n !== G || !f(K, r) || f(J, r)) {
        var o = q(n, r);
        return !o || !f(K, r) || f(n, F) && n[F][r] || (o.enumerable = !0), o;
      }
    },
    lt = function (t) {
      var e = X(g(t)),
        n = [];
      return $(e, function (t) {
        f(K, t) || f(L, t) || n.push(t);
      }), n;
    },
    ft = function (t) {
      var e = t === G,
        n = X(e ? J : g(t)),
        r = [];
      return $(n, function (t) {
        !f(K, t) || e && !f(G, t) || r.push(K[t]);
      }), r;
    };
  (a || (P((Y = function () {
    if (this instanceof Y) throw TypeError("Symbol is not a constructor");
    var t = arguments.length && void 0 !== arguments[0] ? String(arguments[0]) : void 0,
      e = k(t),
      n = function (t) {
        this === G && n.call(J, t), f(this, F) && f(this[F], e) && (this[F][e] = !1), rt(this, e, m(1, t));
      };
    return u && nt && rt(G, e, {
      configurable: !0,
      set: n
    }), ot(e, t);
  }).prototype, "toString", function () {
    return U(this).tag;
  }), P(Y, "withoutSetter", function (t) {
    return ot(k(t), t);
  }), I.f = at, T.f = ct, E.f = st, w.f = S.f = lt, O.f = ft, R.f = function (t) {
    return ot(_(t), t);
  }, u && (H(Y.prototype, "description", {
    configurable: !0,
    get: function () {
      return U(this).description;
    }
  }), c || P(G, "propertyIsEnumerable", at, {
    unsafe: !0
  }))), r({
    global: !0,
    wrap: !0,
    forced: !a,
    sham: !a
  }, {
    Symbol: Y
  }), $(x(tt), function (t) {
    N(t);
  }), r({
    target: "Symbol",
    stat: !0,
    forced: !a
  }, {
    for: function (t) {
      var e = String(t);
      if (f(Q, e)) return Q[e];
      var n = Y(e);
      return Q[e] = n, Z[n] = e, n;
    },
    keyFor: function (t) {
      if (!it(t)) throw TypeError(t + " is not a symbol");
      if (f(Z, t)) return Z[t];
    },
    useSetter: function () {
      nt = !0;
    },
    useSimple: function () {
      nt = !1;
    }
  }), r({
    target: "Object",
    stat: !0,
    forced: !a,
    sham: !u
  }, {
    create: function (t, e) {
      return void 0 === e ? b(t) : ut(b(t), e);
    },
    defineProperty: ct,
    defineProperties: ut,
    getOwnPropertyDescriptor: st
  }), r({
    target: "Object",
    stat: !0,
    forced: !a
  }, {
    getOwnPropertyNames: lt,
    getOwnPropertySymbols: ft
  }), r({
    target: "Object",
    stat: !0,
    forced: l(function () {
      O.f(1);
    })
  }, {
    getOwnPropertySymbols: function (t) {
      return O.f(v(t));
    }
  }), W) && r({
    target: "JSON",
    stat: !0,
    forced: !a || l(function () {
      var t = Y();
      return "[null]" != W([t]) || "{}" != W({
        a: t
      }) || "{}" != W(Object(t));
    })
  }, {
    stringify: function (t, e, n) {
      for (var r, o = [t], i = 1; arguments.length > i;) o.push(arguments[i++]);
      if (r = e, (d(e) || void 0 !== t) && !it(t)) return p(e) || (e = function (t, e) {
        if ("function" == typeof r && (e = r.call(this, t, e)), !it(e)) return e;
      }), o[1] = e, W.apply(null, o);
    }
  });
  Y.prototype[V] || j(Y.prototype, V, Y.prototype.valueOf), D(Y, "Symbol"), L[F] = !0;
}, function (t, e, n) {

  var r,
    o,
    i,
    c = n(2),
    u = n(78),
    a = n(10),
    s = n(4),
    l = n(3),
    f = n(24),
    p = l("iterator"),
    d = !1;
  [].keys && ("next" in (i = [].keys()) ? (o = u(u(i))) !== Object.prototype && (r = o) : d = !0);
  var h = null == r || c(function () {
    var t = {};
    return r[p].call(t) !== t;
  });
  h && (r = {}), f && !h || s(r, p) || a(r, p, function () {
    return this;
  }), t.exports = {
    IteratorPrototype: r,
    BUGGY_SAFARI_ITERATORS: d
  };
}, function (t, e, n) {
  var r = n(4),
    o = n(12),
    i = n(23),
    c = n(103),
    u = i("IE_PROTO"),
    a = Object.prototype;
  t.exports = c ? Object.getPrototypeOf : function (t) {
    return t = o(t), r(t, u) ? t[u] : "function" == typeof t.constructor && t instanceof t.constructor ? t.constructor.prototype : t instanceof Object ? a : null;
  };
}, function (t, e) {
  t.exports = veLocale;
}, function (t, e, n) {
  var r = n(1),
    o = n(46),
    i = r.WeakMap;
  t.exports = "function" == typeof i && /native code/.test(o(i));
}, function (t, e, n) {
  var r = n(7),
    o = n(6),
    i = n(9),
    c = n(36);
  t.exports = r ? Object.defineProperties : function (t, e) {
    i(t);
    for (var n, r = c(e), u = r.length, a = 0; u > a;) o.f(t, n = r[a++], e[n]);
    return t;
  };
}, function (t, e, n) {
  var r = n(22);
  t.exports = r("navigator", "userAgent") || "";
}, function (t, e, n) {
  var r = n(22),
    o = n(27),
    i = n(49),
    c = n(9);
  t.exports = r("Reflect", "ownKeys") || function (t) {
    var e = o.f(c(t)),
      n = i.f;
    return n ? e.concat(n(t)) : e;
  };
}, function (t, e, n) {

  var r = n(8),
    o = n(2),
    i = n(39),
    c = n(5),
    u = n(12),
    a = n(16),
    s = n(72),
    l = n(55),
    f = n(52),
    p = n(3),
    d = n(37),
    h = p("isConcatSpreadable"),
    v = d >= 51 || !o(function () {
      var t = [];
      return t[h] = !1, t.concat()[0] !== t;
    }),
    g = f("concat"),
    y = function (t) {
      if (!c(t)) return !1;
      var e = t[h];
      return void 0 !== e ? !!e : i(t);
    };
  r({
    target: "Array",
    proto: !0,
    forced: !v || !g
  }, {
    concat: function (t) {
      var e,
        n,
        r,
        o,
        i,
        c = u(this),
        f = l(c, 0),
        p = 0;
      for (e = -1, r = arguments.length; e < r; e++) if (y(i = -1 === e ? c : arguments[e])) {
        if (p + (o = a(i.length)) > 9007199254740991) throw TypeError("Maximum allowed index exceeded");
        for (n = 0; n < o; n++, p++) n in i && s(f, p, i[n]);
      } else {
        if (p >= 9007199254740991) throw TypeError("Maximum allowed index exceeded");
        s(f, p++, i);
      }
      return f.length = p, f;
    }
  });
}, function (t, e, n) {

  var r = n(8),
    o = n(34).map;
  r({
    target: "Array",
    proto: !0,
    forced: !n(52)("map")
  }, {
    map: function (t) {
      return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
    }
  });
}, function (t, e, n) {

  var r,
    o,
    i = n(113),
    c = n(112),
    u = n(29),
    a = RegExp.prototype.exec,
    s = u("native-string-replace", String.prototype.replace),
    l = a,
    f = (r = /a/, o = /b*/g, a.call(r, "a"), a.call(o, "a"), 0 !== r.lastIndex || 0 !== o.lastIndex),
    p = c.UNSUPPORTED_Y || c.BROKEN_CARET,
    d = void 0 !== /()??/.exec("")[1];
  (f || d || p) && (l = function (t) {
    var e,
      n,
      r,
      o,
      c = this,
      u = p && c.sticky,
      l = i.call(c),
      h = c.source,
      v = 0,
      g = t;
    return u && (-1 === (l = l.replace("y", "")).indexOf("g") && (l += "g"), g = String(t).slice(c.lastIndex), c.lastIndex > 0 && (!c.multiline || c.multiline && "\n" !== t[c.lastIndex - 1]) && (h = "(?: " + h + ")", g = " " + g, v++), n = new RegExp("^(?:" + h + ")", l)), d && (n = new RegExp("^" + h + "$(?!\\s)", l)), f && (e = c.lastIndex), r = a.call(u ? n : c, g), u ? r ? (r.input = r.input.slice(v), r[0] = r[0].slice(v), r.index = c.lastIndex, c.lastIndex += r[0].length) : c.lastIndex = 0 : f && r && (c.lastIndex = c.global ? r.index + r[0].length : e), d && r && r.length > 1 && s.call(r[0], n, function () {
      for (o = 1; o < arguments.length - 2; o++) void 0 === arguments[o] && (r[o] = void 0);
    }), r;
  }), t.exports = l;
}, function (t, e, n) {

  n.d(e, "a", function () {
    return r;
  }), n.d(e, "f", function () {
    return o;
  }), n.d(e, "d", function () {
    return c;
  }), n.d(e, "e", function () {
    return u;
  }), n.d(e, "c", function () {
    return a;
  }), n.d(e, "b", function () {
    return s;
  }), n.d(e, "g", function () {
    return l;
  });
  n(101), n(117), n(118);
  function r(t, e) {
    if (t) {
      for (var n = t.className, r = (e || "").split(" "), o = 0, c = r.length; o < c; o++) {
        var u = r[o];
        u && (t.classList ? t.classList.add(u) : i(t, u) || (n += " " + u));
      }
      t.classList || (t.className = n);
    }
  }
  function o(t, e) {
    if (t && e) {
      for (var n = e.split(" "), r = " " + t.className + " ", o = 0, c = n.length; o < c; o++) {
        var u = n[o];
        u && (t.classList ? t.classList.remove(u) : i(t, u) && (r = r.replace(" " + u + " ", " ")));
      }
      t.classList || (t.className = (r || "").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ""));
    }
  }
  function i(t, e) {
    if (!t || !e) return !1;
    if (-1 !== e.indexOf(" ")) throw new Error("className should not contain space.");
    return t.classList ? t.classList.contains(e) : (" " + t.className + " ").indexOf(" " + e + " ") > -1;
  }
  function c(t) {
    var e = document.documentElement,
      n = void 0 !== t.getBoundingClientRect ? t.getBoundingClientRect() : 0,
      r = (window.pageXOffset || e.scrollLeft) - (e.clientLeft || 0),
      o = (window.pageYOffset || e.scrollTop) - (e.clientTop || 0),
      i = n.left + window.pageXOffset,
      c = n.top + window.pageYOffset,
      u = i - r,
      a = c - o;
    return {
      offsetTop: c,
      offsetLeft: i,
      left: u,
      top: a,
      right: window.document.documentElement.clientWidth - n.width - u,
      bottom: window.document.documentElement.clientHeight - n.height - a,
      right2: window.document.documentElement.clientWidth - u,
      bottom2: window.document.documentElement.clientHeight - a
    };
  }
  function u(t, e) {
    var n = c(t),
      r = n.offsetTop,
      o = n.offsetLeft,
      i = n.left,
      u = n.top,
      a = n.right,
      s = n.bottom,
      l = n.right2,
      f = n.bottom2,
      p = c(e);
    return {
      offsetTop: r - p.offsetTop,
      offsetLeft: o - p.offsetLeft,
      left: i - p.left,
      top: u - p.top,
      right: a - p.right,
      bottom: s - p.bottom,
      right2: l - p.right2,
      bottom2: f - p.bottom2
    };
  }
  function a(t) {
    var e = 0,
      n = 0,
      r = document.documentElement,
      o = document.body;
    return t || (t = window.event), window.pageYoffset ? (e = window.pageXOffset, n = window.pageYOffset) : (e = (r && r.scrollLeft || o && o.scrollLeft || 0) - (r && r.clientLeft || o && o.clientLeft || 0), n = (r && r.scrollTop || o && o.scrollTop || 0) - (r && r.clientTop || o && o.clientTop || 0)), {
      left: e += t.clientX,
      top: n += t.clientY,
      right: r.clientWidth - t.clientX,
      bottom: r.clientHeight - t.clientY
    };
  }
  function s(t) {
    var e = document;
    if (t.selectionStart) return t.selectionStart;
    if (e.selection) {
      t.focus();
      var n = e.selection.createRange();
      if (null === n) return 0;
      var r = t.createTextRange(),
        o = r.duplicate();
      return r.moveToBookmark(n.getBookmark()), o.setEndPoint("EndToStart", r), o.text.length;
    }
    return 0;
  }
  function l(t, e, n) {
    if (void 0 === n && (n = e), t.setSelectionRange) {
      t.focus();
      try {
        t.setSelectionRange(e, n);
      } catch (i) {
        var r = t.parentNode,
          o = r.style.display;
        r.style.display = "block", t.setSelectionRange(e, n), r.style.display = o;
      }
    }
  }
}, function (t, e, n) {

  var r = n(89).charAt,
    o = n(26),
    i = n(71),
    c = o.set,
    u = o.getterFor("String Iterator");
  i(String, "String", function (t) {
    c(this, {
      type: "String Iterator",
      string: String(t),
      index: 0
    });
  }, function () {
    var t,
      e = u(this),
      n = e.string,
      o = e.index;
    return o >= n.length ? {
      value: void 0,
      done: !0
    } : (t = r(n, o), e.index += t.length, {
      value: t,
      done: !1
    });
  });
}, function (t, e, n) {
  var r = n(25),
    o = n(13),
    i = function (t) {
      return function (e, n) {
        var i,
          c,
          u = String(o(e)),
          a = r(n),
          s = u.length;
        return a < 0 || a >= s ? t ? "" : void 0 : (i = u.charCodeAt(a)) < 55296 || i > 56319 || a + 1 === s || (c = u.charCodeAt(a + 1)) < 56320 || c > 57343 ? t ? u.charAt(a) : i : t ? u.slice(a, a + 2) : c - 56320 + (i - 55296 << 10) + 65536;
      };
    };
  t.exports = {
    codeAt: i(!1),
    charAt: i(!0)
  };
}, function (t, e, n) {
  var r = n(1),
    o = n(66),
    i = n(57),
    c = n(10),
    u = n(3),
    a = u("iterator"),
    s = u("toStringTag"),
    l = i.values;
  for (var f in o) {
    var p = r[f],
      d = p && p.prototype;
    if (d) {
      if (d[a] !== l) try {
        c(d, a, l);
      } catch (t) {
        d[a] = l;
      }
      if (d[s] || c(d, s, f), o[f]) for (var h in i) if (d[h] !== i[h]) try {
        c(d, h, i[h]);
      } catch (t) {
        d[h] = i[h];
      }
    }
  }
}, function (t, e, n) {
  var r = n(5);
  t.exports = function (t) {
    if (!r(t) && null !== t) throw TypeError("Can't set " + String(t) + " as a prototype");
    return t;
  };
}, function (t, e, n) {
  var r = n(5),
    o = n(58);
  t.exports = function (t, e, n) {
    var i, c;
    return o && "function" == typeof (i = e.constructor) && i !== n && r(c = i.prototype) && c !== n.prototype && o(t, c), t;
  };
}, function (t, e, n) {

  var r = n(8),
    o = n(7),
    i = n(1),
    c = n(4),
    u = n(5),
    a = n(6).f,
    s = n(61),
    l = i.Symbol;
  if (o && "function" == typeof l && (!("description" in l.prototype) || void 0 !== l().description)) {
    var f = {},
      p = function () {
        var t = arguments.length < 1 || void 0 === arguments[0] ? void 0 : String(arguments[0]),
          e = this instanceof p ? new l(t) : void 0 === t ? l() : l(t);
        return "" === t && (f[e] = !0), e;
      };
    s(p, l);
    var d = p.prototype = l.prototype;
    d.constructor = p;
    var h = d.toString,
      v = "Symbol(test)" == String(l("test")),
      g = /^Symbol\((.*)\)[^)]+$/;
    a(d, "description", {
      configurable: !0,
      get: function () {
        var t = u(this) ? this.valueOf() : this,
          e = h.call(t);
        if (c(f, t)) return "";
        var n = v ? e.slice(7, -1) : e.replace(g, "$1");
        return "" === n ? void 0 : n;
      }
    }), r({
      global: !0,
      forced: !0
    }, {
      Symbol: p
    });
  }
}, function (t, e, n) {
  var r = n(44),
    o = n(15),
    i = n(3)("toStringTag"),
    c = "Arguments" == o(function () {
      return arguments;
    }());
  t.exports = r ? o : function (t) {
    var e, n, r;
    return void 0 === t ? "Undefined" : null === t ? "Null" : "string" == typeof (n = function (t, e) {
      try {
        return t[e];
      } catch (t) {}
    }(e = Object(t), i)) ? n : c ? o(e) : "Object" == (r = o(e)) && "function" == typeof e.callee ? "Arguments" : r;
  };
}, function (t, e, n) {
  n(67)("iterator");
}, function (t, e, n) {
  var r = n(13),
    o = "[" + n(97) + "]",
    i = RegExp("^" + o + o + "*"),
    c = RegExp(o + o + "*$"),
    u = function (t) {
      return function (e) {
        var n = String(r(e));
        return 1 & t && (n = n.replace(i, "")), 2 & t && (n = n.replace(c, "")), n;
      };
    };
  t.exports = {
    start: u(1),
    end: u(2),
    trim: u(3)
  };
}, function (t, e) {
  t.exports = "\t\n\v\f\r                　\u2028\u2029\ufeff";
}, function (t, e, n) {

  var r = n(34).forEach,
    o = n(75)("forEach");
  t.exports = o ? [].forEach : function (t) {
    return r(this, t, arguments.length > 1 ? arguments[1] : void 0);
  };
}, function (t, e, n) {
  var r = n(11),
    o = n(27).f,
    i = {}.toString,
    c = "object" == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  t.exports.f = function (t) {
    return c && "[object Window]" == i.call(t) ? function (t) {
      try {
        return o(t);
      } catch (t) {
        return c.slice();
      }
    }(t) : o(r(t));
  };
}, function (t, e, n) {

  var r = n(44),
    o = n(94);
  t.exports = r ? {}.toString : function () {
    return "[object " + o(this) + "]";
  };
}, function (t, e, n) {

  var r = n(8),
    o = n(86);
  r({
    target: "RegExp",
    proto: !0,
    forced: /./.exec !== o
  }, {
    exec: o
  });
}, function (t, e, n) {

  var r = n(77).IteratorPrototype,
    o = n(28),
    i = n(18),
    c = n(43),
    u = n(50),
    a = function () {
      return this;
    };
  t.exports = function (t, e, n) {
    var s = e + " Iterator";
    return t.prototype = o(r, {
      next: i(1, n)
    }), c(t, s, !1, !0), u[s] = a, t;
  };
}, function (t, e, n) {
  var r = n(2);
  t.exports = !r(function () {
    function t() {}
    return t.prototype.constructor = null, Object.getPrototypeOf(new t()) !== t.prototype;
  });
}, function (t, e, n) {

  var r = n(8),
    o = n(34).filter;
  r({
    target: "Array",
    proto: !0,
    forced: !n(52)("filter")
  }, {
    filter: function (t) {
      return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
    }
  });
},,, function (t, e, n) {
  var r = n(5),
    o = n(15),
    i = n(3)("match");
  t.exports = function (t) {
    var e;
    return r(t) && (void 0 !== (e = t[i]) ? !!e : "RegExp" == o(t));
  };
}, function (t, e, n) {

  n(101);
  var r = n(14),
    o = n(86),
    i = n(2),
    c = n(3),
    u = n(10),
    a = c("species"),
    s = RegExp.prototype,
    l = !i(function () {
      var t = /./;
      return t.exec = function () {
        var t = [];
        return t.groups = {
          a: "7"
        }, t;
      }, "7" !== "".replace(t, "$<a>");
    }),
    f = "$0" === "a".replace(/./, "$0"),
    p = c("replace"),
    d = !!/./[p] && "" === /./[p]("a", "$0"),
    h = !i(function () {
      var t = /(?:)/,
        e = t.exec;
      t.exec = function () {
        return e.apply(this, arguments);
      };
      var n = "ab".split(t);
      return 2 !== n.length || "a" !== n[0] || "b" !== n[1];
    });
  t.exports = function (t, e, n, p) {
    var v = c(t),
      g = !i(function () {
        var e = {};
        return e[v] = function () {
          return 7;
        }, 7 != ""[t](e);
      }),
      y = g && !i(function () {
        var e = !1,
          n = /a/;
        return "split" === t && ((n = {}).constructor = {}, n.constructor[a] = function () {
          return n;
        }, n.flags = "", n[v] = /./[v]), n.exec = function () {
          return e = !0, null;
        }, n[v](""), !e;
      });
    if (!g || !y || "replace" === t && (!l || !f || d) || "split" === t && !h) {
      var m = /./[v],
        b = n(v, ""[t], function (t, e, n, r, i) {
          var c = e.exec;
          return c === o || c === s.exec ? g && !i ? {
            done: !0,
            value: m.call(e, n, r)
          } : {
            done: !0,
            value: t.call(n, e, r)
          } : {
            done: !1
          };
        }, {
          REPLACE_KEEPS_$0: f,
          REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: d
        }),
        x = b[0],
        w = b[1];
      r(String.prototype, t, x), r(s, v, 2 == e ? function (t, e) {
        return w.call(t, this, e);
      } : function (t) {
        return w.call(t, this);
      });
    }
    p && u(s[v], "sham", !0);
  };
}, function (t, e, n) {

  var r = n(89).charAt;
  t.exports = function (t, e, n) {
    return e + (n ? r(t, e).length : 1);
  };
}, function (t, e, n) {
  var r = n(15),
    o = n(86);
  t.exports = function (t, e) {
    var n = t.exec;
    if ("function" == typeof n) {
      var i = n.call(t, e);
      if ("object" != typeof i) throw TypeError("RegExp exec method returned something other than an Object or null");
      return i;
    }
    if ("RegExp" !== r(t)) throw TypeError("RegExp#exec called on incompatible receiver");
    return o.call(t, e);
  };
}, function (t, e, n) {
  var r = n(8),
    o = n(127);
  r({
    target: "Object",
    stat: !0,
    forced: Object.assign !== o
  }, {
    assign: o
  });
}, function (t, e, n) {

  var r = n(2);
  function o(t, e) {
    return RegExp(t, e);
  }
  e.UNSUPPORTED_Y = r(function () {
    var t = o("a", "y");
    return t.lastIndex = 2, null != t.exec("abcd");
  }), e.BROKEN_CARET = r(function () {
    var t = o("^r", "gy");
    return t.lastIndex = 2, null != t.exec("str");
  });
}, function (t, e, n) {

  var r = n(9);
  t.exports = function () {
    var t = r(this),
      e = "";
    return t.global && (e += "g"), t.ignoreCase && (e += "i"), t.multiline && (e += "m"), t.dotAll && (e += "s"), t.unicode && (e += "u"), t.sticky && (e += "y"), e;
  };
},,,, function (t, e, n) {

  var r = n(108),
    o = n(9),
    i = n(16),
    c = n(25),
    u = n(13),
    a = n(109),
    s = n(126),
    l = n(110),
    f = Math.max,
    p = Math.min;
  r("replace", 2, function (t, e, n, r) {
    var d = r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,
      h = r.REPLACE_KEEPS_$0,
      v = d ? "$" : "$0";
    return [function (n, r) {
      var o = u(this),
        i = null == n ? void 0 : n[t];
      return void 0 !== i ? i.call(n, o, r) : e.call(String(o), n, r);
    }, function (t, r) {
      if (!d && h || "string" == typeof r && -1 === r.indexOf(v)) {
        var u = n(e, t, this, r);
        if (u.done) return u.value;
      }
      var g = o(t),
        y = String(this),
        m = "function" == typeof r;
      m || (r = String(r));
      var b = g.global;
      if (b) {
        var x = g.unicode;
        g.lastIndex = 0;
      }
      for (var w = [];;) {
        var S = l(g, y);
        if (null === S) break;
        if (w.push(S), !b) break;
        "" === String(S[0]) && (g.lastIndex = a(y, i(g.lastIndex), x));
      }
      for (var O, E = "", T = 0, I = 0; I < w.length; I++) {
        S = w[I];
        for (var j = String(S[0]), P = f(p(c(S.index), y.length), 0), A = [], C = 1; C < S.length; C++) A.push(void 0 === (O = S[C]) ? O : String(O));
        var L = S.groups;
        if (m) {
          var k = [j].concat(A, P, y);
          void 0 !== L && k.push(L);
          var _ = String(r.apply(void 0, k));
        } else _ = s(j, y, P, A, L, r);
        P >= T && (E += y.slice(T, P) + _, T = P + j.length);
      }
      return E + y.slice(T);
    }];
  });
}, function (t, e, n) {

  var r = n(108),
    o = n(107),
    i = n(9),
    c = n(13),
    u = n(122),
    a = n(109),
    s = n(16),
    l = n(110),
    f = n(86),
    p = n(112).UNSUPPORTED_Y,
    d = [].push,
    h = Math.min;
  r("split", 2, function (t, e, n) {
    var r;
    return r = "c" == "abbc".split(/(b)*/)[1] || 4 != "test".split(/(?:)/, -1).length || 2 != "ab".split(/(?:ab)*/).length || 4 != ".".split(/(.?)(.?)/).length || ".".split(/()()/).length > 1 || "".split(/.?/).length ? function (t, n) {
      var r = String(c(this)),
        i = void 0 === n ? 4294967295 : n >>> 0;
      if (0 === i) return [];
      if (void 0 === t) return [r];
      if (!o(t)) return e.call(r, t, i);
      for (var u, a, s, l = [], p = (t.ignoreCase ? "i" : "") + (t.multiline ? "m" : "") + (t.unicode ? "u" : "") + (t.sticky ? "y" : ""), h = 0, v = new RegExp(t.source, p + "g"); (u = f.call(v, r)) && !((a = v.lastIndex) > h && (l.push(r.slice(h, u.index)), u.length > 1 && u.index < r.length && d.apply(l, u.slice(1)), s = u[0].length, h = a, l.length >= i));) v.lastIndex === u.index && v.lastIndex++;
      return h === r.length ? !s && v.test("") || l.push("") : l.push(r.slice(h)), l.length > i ? l.slice(0, i) : l;
    } : "0".split(void 0, 0).length ? function (t, n) {
      return void 0 === t && 0 === n ? [] : e.call(this, t, n);
    } : e, [function (e, n) {
      var o = c(this),
        i = null == e ? void 0 : e[t];
      return void 0 !== i ? i.call(e, o, n) : r.call(String(o), e, n);
    }, function (t, o) {
      var c = n(r, t, this, o, r !== e);
      if (c.done) return c.value;
      var f = i(t),
        d = String(this),
        v = u(f, RegExp),
        g = f.unicode,
        y = (f.ignoreCase ? "i" : "") + (f.multiline ? "m" : "") + (f.unicode ? "u" : "") + (p ? "g" : "y"),
        m = new v(p ? "^(?:" + f.source + ")" : f, y),
        b = void 0 === o ? 4294967295 : o >>> 0;
      if (0 === b) return [];
      if (0 === d.length) return null === l(m, d) ? [d] : [];
      for (var x = 0, w = 0, S = []; w < d.length;) {
        m.lastIndex = p ? 0 : w;
        var O,
          E = l(m, p ? d.slice(w) : d);
        if (null === E || (O = h(s(m.lastIndex + (p ? w : 0)), d.length)) === x) w = a(d, w, g);else {
          if (S.push(d.slice(x, w)), S.length === b) return S;
          for (var T = 1; T <= E.length - 1; T++) if (S.push(E[T]), S.length === b) return S;
          w = x = O;
        }
      }
      return S.push(d.slice(x)), S;
    }];
  }, p);
},,,, function (t, e, n) {
  var r = n(9),
    o = n(60),
    i = n(3)("species");
  t.exports = function (t, e) {
    var n,
      c = r(t).constructor;
    return void 0 === c || null == (n = r(c)[i]) ? e : o(n);
  };
}, function (t, e, n) {

  n.d(e, "a", function () {
    return r;
  });
  n(64), n(131);
  function r() {
    return Date.now().toString(36) + Math.random().toString(36).substr(2);
  }
},,, function (t, e, n) {
  var r = n(12),
    o = Math.floor,
    i = "".replace,
    c = /\$([$&'`]|\d{1,2}|<[^>]*>)/g,
    u = /\$([$&'`]|\d{1,2})/g;
  t.exports = function (t, e, n, a, s, l) {
    var f = n + t.length,
      p = a.length,
      d = u;
    return void 0 !== s && (s = r(s), d = c), i.call(l, d, function (r, i) {
      var c;
      switch (i.charAt(0)) {
        case "$":
          return "$";
        case "&":
          return t;
        case "`":
          return e.slice(0, n);
        case "'":
          return e.slice(f);
        case "<":
          c = s[i.slice(1, -1)];
          break;
        default:
          var u = +i;
          if (0 === u) return r;
          if (u > p) {
            var l = o(u / 10);
            return 0 === l ? r : l <= p ? void 0 === a[l - 1] ? i.charAt(1) : a[l - 1] + i.charAt(1) : r;
          }
          c = a[u - 1];
      }
      return void 0 === c ? "" : c;
    });
  };
}, function (t, e, n) {

  var r = n(7),
    o = n(2),
    i = n(36),
    c = n(49),
    u = n(42),
    a = n(12),
    s = n(35),
    l = Object.assign,
    f = Object.defineProperty;
  t.exports = !l || o(function () {
    if (r && 1 !== l({
      b: 1
    }, l(f({}, "a", {
      enumerable: !0,
      get: function () {
        f(this, "b", {
          value: 3,
          enumerable: !1
        });
      }
    }), {
      b: 2
    })).b) return !0;
    var t = {},
      e = {},
      n = Symbol();
    return t[n] = 7, "abcdefghijklmnopqrst".split("").forEach(function (t) {
      e[t] = t;
    }), 7 != l({}, t)[n] || "abcdefghijklmnopqrst" != i(l({}, e)).join("");
  }) ? function (t, e) {
    for (var n = a(t), o = arguments.length, l = 1, f = c.f, p = u.f; o > l;) for (var d, h = s(arguments[l++]), v = f ? i(h).concat(f(h)) : i(h), g = v.length, y = 0; g > y;) d = v[y++], r && !p.call(h, d) || (n[d] = h[d]);
    return n;
  } : l;
},, function (t, e) {
  t.exports = veCheckbox;
},, function (t, e, n) {

  var r = n(14),
    o = n(9),
    i = n(2),
    c = n(113),
    u = RegExp.prototype,
    a = u.toString,
    s = i(function () {
      return "/a/b" != a.call({
        source: "a",
        flags: "b"
      });
    }),
    l = "toString" != a.name;
  (s || l) && r(RegExp.prototype, "toString", function () {
    var t = o(this),
      e = String(t.source),
      n = t.flags;
    return "/" + e + "/" + String(void 0 === n && t instanceof RegExp && !("flags" in u) ? c.call(t) : n);
  }, {
    unsafe: !0
  });
}, function (t, e, n) {

  var r = n(8),
    o = n(35),
    i = n(11),
    c = n(75),
    u = [].join,
    a = o != Object,
    s = c("join", ",");
  r({
    target: "Array",
    proto: !0,
    forced: a || !s
  }, {
    join: function (t) {
      return u.call(i(this), void 0 === t ? "," : t);
    }
  });
}, function (t, e, n) {

  n(41);
  e.a = {
    bind: function (t, e, n) {
      if ("function" != typeof e.value) {
        var r = "in [clickoutside] directives, provided expression '".concat(e.expression, "' is not a function "),
          o = n.context.name;
        o && (r += "in ".concat(o)), console.error(r);
      }
      var i = function (n) {
        if (t.contains(n.target) || t === n.target) return !1;
        e.value(n);
      };
      t.__clickOutSide__ = i, document.addEventListener("click", i, !0);
    },
    unbind: function (t) {
      document.removeEventListener("click", t.__clickOutSide__, !0), t.__clickOutSide__ = null;
    }
  };
}, function (t, e) {
  t.exports = veRadio;
},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, function (t, e, n) {

  n.r(e);
  n(41), n(38), n(85), n(104), n(111), n(132);
  var r = n(133),
    o = n(129),
    i = n.n(o),
    c = n(134),
    u = n.n(c),
    a = "on-filter-reset",
    s = "on-filter-confirm",
    l = "on-dropdown-visible-change",
    f = "on-item-select-change";
  function p(t) {
    return "ve-dropdown-" + t;
  }
  var d = n(0),
    h = n(123),
    v = n(87);
  function g(t, e, n) {
    return e in t ? Object.defineProperty(t, e, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : t[e] = n, t;
  }
  var y = {
    name: "VeDropdown",
    directives: {
      "click-outside": r.a
    },
    props: {
      isSelect: {
        type: Boolean,
        default: !1
      },
      showOperation: {
        type: Boolean,
        default: !1
      },
      width: {
        type: Number,
        default: 90
      },
      maxWidth: {
        type: Number,
        default: 0
      },
      maxHeight: {
        type: Number,
        default: 1e3
      },
      isMultiple: {
        type: Boolean,
        default: !1
      },
      value: {
        type: [Array],
        default: null
      },
      textAlign: {
        type: String,
        default: "left"
      },
      isInput: {
        type: Boolean,
        default: !1
      },
      confirmFilterText: {
        type: String,
        default: ""
      },
      resetFilterText: {
        type: String,
        default: ""
      },
      hideByItemClick: {
        type: Boolean,
        default: !1
      },
      showRadio: {
        type: Boolean,
        default: !1
      },
      visible: {
        type: Boolean,
        default: !1
      },
      isControlled: {
        type: Boolean,
        default: !1
      },
      isCustomContent: {
        type: Boolean,
        default: !1
      },
      defaultInstance: {
        type: Number,
        default: 5
      },
      popperAppendTo: {
        type: [String, HTMLElement],
        default: function () {
          return document.body;
        }
      },
      beforeVisibleChange: {
        type: Function,
        default: null
      }
    },
    data: function () {
      return {
        internalVisible: !1,
        internalOptions: [],
        inputValue: "",
        isDropdownShowTriggerClicked: !1,
        rootId: "",
        dropdownItemsPanelId: "",
        popperAppendToEl: null,
        appendToElTagName: null
      };
    },
    computed: {
      isDropdownVisible: function () {
        return this.isControlled ? this.visible : this.internalVisible;
      },
      getMaxWidth: function () {
        var t = 1 / 0,
          e = this.maxWidth,
          n = this.width;
        return e && e > 0 && e > n && (t = e), t;
      },
      selectedLabels: function () {
        return this.internalOptions.filter(function (t) {
          return t.selected;
        }).map(function (t) {
          if (t.selected) return t.label;
        });
      },
      operationFilterClass: function () {
        return g({}, p("filter-disable"), 0 === this.selectedLabels.length);
      },
      dropdownItemsClass: function () {
        var t;
        return g(t = {}, p("dd"), !0), g(t, p("dd-show"), this.isDropdownVisible), t;
      }
    },
    watch: {
      value: function () {
        this.init();
      },
      visible: {
        handler: function (t) {
          var e = this.isControlled,
            n = this.showDropDown,
            r = this.hideDropDown;
          setTimeout(function () {
            e && (t ? n() : r());
          });
        },
        immediate: !0
      }
    },
    methods: {
      init: function () {
        this.internalOptions = Object.assign([], this.value), this.isInput && this.setInputValue();
      },
      confirm: function () {
        this.$emit("input", this.internalOptions), this.$emit(s, this.internalOptions), this.hideDropDown();
      },
      reset: function () {
        this.internalOptions.some(function (t) {
          return t.selected;
        }) && (this.internalOptions.map(function (t) {
          return t.selected && (t.selected = !1), t;
        }), this.$emit("input", this.internalOptions), this.$emit(a, this.internalOptions)), this.hideDropDown();
      },
      showDropDown: function () {
        var t = this.rootId,
          e = this.dropdownItemsPanelId,
          n = this.beforeVisibleChangeCallback(!0);
        if (Object(d.e)(n) && !n) return !1;
        var r = document.querySelector("#".concat(t));
        r && (r.innerHTML = "", r.appendChild(this.$refs[e]), r.style.position = "absolute", r.classList.add(p("popper")), this.changDropdownPanelPosition()), this.internalVisible = !0, this.$emit(l, !0);
      },
      hideDropDown: function () {
        var t = this,
          e = this.beforeVisibleChangeCallback(!1);
        if (Object(d.e)(e) && !e) return !1;
        this.$emit(l, !1), setTimeout(function () {
          t.internalVisible = !1, t.removeOrEmptyRootPanel();
        }, 150);
      },
      beforeVisibleChangeCallback: function (t) {
        var e = this.beforeVisibleChange;
        if (t !== this.isDropdownVisible && Object(d.i)(e)) return e({
          nextVisible: t
        });
      },
      removeOrEmptyRootPanel: function () {
        var t = this.rootId,
          e = document.querySelector("#".concat(t));
        e && (e.innerHTML = "");
      },
      changDropdownPanelPosition: function () {
        var t = this.defaultInstance,
          e = this.rootId,
          n = this.popperAppendToEl,
          r = this.appendToElTagName,
          o = document.querySelector("#".concat(e));
        if (o) {
          var i = o.getBoundingClientRect(),
            c = i.width,
            u = i.height,
            a = this.$el.querySelector(".ve-dropdown-dt"),
            s = a.getBoundingClientRect().height;
          if (!n) return !1;
          var l = "BODY" === r,
            f = l ? Object(v.d)(a) : Object(v.e)(a, n),
            p = f.offsetLeft,
            d = f.offsetTop,
            h = f.right,
            g = f.bottom,
            y = 0,
            m = 0,
            b = 0,
            x = 0;
          l || (b = n.scrollLeft, x = n.scrollTop), y = h >= c ? p + b : p - c + b, m = g >= u ? d + s + t + x : d - u - t + x, o.style.left = y + "px", o.style.top = m + "px";
        }
      },
      setInputValue: function () {
        var t, e;
        e = this.selectedLabels, Array.isArray(e) && e.length > 0 && (t = e.join()), this.inputValue = t;
      },
      dropdownPanelClick: function () {
        this.isDropdownShowTriggerClicked = !0, this.dropdownShowToggle();
      },
      dropdownShowToggle: function () {
        this.isDropdownVisible ? this.hideDropDown() : this.showDropDown();
      },
      singleSelectOptionClick: function (t, e) {
        this.internalOptions = this.internalOptions.map(function (t) {
          return e.label === t.label ? t.selected = !0 : t.selected = !1, t;
        }), this.hideByItemClick && this.hideDropDown(), this.isInput && this.setInputValue(), this.$emit("input", this.internalOptions), this.$emit(f, this.internalOptions);
      },
      getTextAlignClass: function () {
        return p("items-li-a-".concat(this.textAlign));
      },
      dropdownClickOutside: function () {
        var t = this;
        setTimeout(function () {
          t.isDropdownShowTriggerClicked ? t.isDropdownShowTriggerClicked = !1 : t.hideDropDown();
        });
      },
      checkedChangeControl: function (t, e) {
        this.internalOptions = this.internalOptions.map(function (n) {
          return n.label === t.label && (n.selected = e), n;
        }), this.$emit(f, this.internalOptions);
      },
      getRandomIdWithPrefix: function () {
        return p(Object(h.a)());
      },
      addRootElementToElement: function () {
        var t = this,
          e = this.popperAppendTo;
        if (this.rootId = this.getRandomIdWithPrefix(), this.dropdownItemsPanelId = this.getRandomIdWithPrefix(), document.querySelector("#".concat(this.rootId))) return !1;
        this.$nextTick(function () {
          var n = document.createElement("div");
          n.setAttribute("id", t.rootId), "string" == typeof e && e.length > 0 ? t.popperAppendToEl = document.querySelector(e) : t.popperAppendToEl = e, t.appendToElTagName = t.popperAppendToEl.tagName, t.popperAppendToEl.appendChild(n);
        });
      }
    },
    created: function () {
      this.init();
    },
    mounted: function () {
      var t = this;
      this.addRootElementToElement(), this.$nextTick(function () {
        ("BODY" === t.appendToElTagName ? document : t.popperAppendToEl).addEventListener("scroll", t.changDropdownPanelPosition);
      }), window.addEventListener("resize", this.changDropdownPanelPosition);
    },
    destroyed: function () {
      var t = this;
      this.removeOrEmptyRootPanel(), this.$nextTick(function () {
        ("BODY" === t.appendToElTagName ? document : t.popperAppendToEl).removeEventListener("scroll", t.changDropdownPanelPosition);
      }), window.removeEventListener("resize", this.changDropdownPanelPosition);
    },
    render: function () {
      var t = this,
        e = arguments[0],
        n = this.isMultiple,
        r = this.getTextAlignClass,
        o = this.internalOptions,
        c = this.isSelect,
        a = this.width,
        s = this.maxHeight,
        l = this.dropdownPanelClick,
        f = this.getMaxWidth,
        d = this.reset,
        h = this.singleSelectOptionClick,
        v = this.showOperation,
        g = this.isCustomContent,
        y = this.dropdownItemsClass,
        m = this.dropdownItemsPanelId,
        b = "";
      b = n ? o.map(function (n, o) {
        var c = {
          key: n.label,
          props: {
            isControlled: !0,
            label: n.label,
            showLine: n.showLine,
            isSelected: n.selected
          },
          on: {
            "on-checked-change": function (e) {
              return t.checkedChangeControl(n, e);
            }
          }
        };
        return e("li", {
          key: o,
          class: [p("items-multiple"), p("items-li"), r()]
        }, [e(i.a, c)]);
      }) : o.map(function (n, o) {
        var i = {
          props: {
            isControlled: !0,
            isSelected: n.selected
          },
          on: {
            "on-radio-change": function () {}
          }
        };
        return e("li", {
          key: o,
          class: [p("items-li"), n.selected ? "active" : ""],
          on: {
            click: function (t) {
              return h(t, n);
            }
          }
        }, [e("a", {
          class: [p("items-li-a"), r()],
          attrs: {
            href: "javascript:void(0);"
          }
        }, [t.showRadio ? e(u.a, i, [n.label]) : n.label])]);
      });
      var x = {
          class: ["ve-dropdown"]
        },
        w = {
          ref: m,
          class: y,
          directives: [{
            name: "click-outside",
            value: this.dropdownClickOutside
          }]
        };
      return e("dl", x, [e("dt", {
        class: "ve-dropdown-dt",
        on: {
          click: l
        }
      }, [e("a", {
        class: [c ? p("dt-selected") : ""],
        style: {
          width: a + "px"
        }
      }, [this.$slots.default])]), e("div", {
        style: {
          display: "none"
        }
      }, [e("dd", w, [e("ul", {
        class: p("items"),
        style: {
          "min-width": a + "px",
          "max-width": f + "px"
        }
      }, [g && this.$slots["custom-content"], !g && e("div", [e("div", {
        style: {
          "max-height": s + "px"
        },
        class: p("items-warpper")
      }, [b]), v && e("li", {
        class: p("operation")
      }, [e("a", {
        class: [p("operation-item"), this.operationFilterClass],
        attrs: {
          href: "javascript:void(0)"
        },
        on: {
          click: d
        }
      }, [this.resetFilterText]), e("a", {
        class: p("operation-item"),
        attrs: {
          href: "javascript:void(0)"
        },
        on: {
          click: this.confirm
        }
      }, [this.confirmFilterText])])])])])])]);
    },
    install: function (t) {
      t.component(y.name, y);
    }
  };
  e.default = y;
}]);
});

unwrapExports(veDropdown);

var veSelect = createCommonjsModule(function (module) {
module.exports = function (t) {
  var n = {};
  function r(e) {
    if (n[e]) return n[e].exports;
    var o = n[e] = {
      i: e,
      l: !1,
      exports: {}
    };
    return t[e].call(o.exports, o, o.exports, r), o.l = !0, o.exports;
  }
  return r.m = t, r.c = n, r.d = function (t, n, e) {
    r.o(t, n) || Object.defineProperty(t, n, {
      enumerable: !0,
      get: e
    });
  }, r.r = function (t) {
    "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
      value: "Module"
    }), Object.defineProperty(t, "__esModule", {
      value: !0
    });
  }, r.t = function (t, n) {
    if (1 & n && (t = r(t)), 8 & n) return t;
    if (4 & n && "object" == typeof t && t && t.__esModule) return t;
    var e = Object.create(null);
    if (r.r(e), Object.defineProperty(e, "default", {
      enumerable: !0,
      value: t
    }), 2 & n && "string" != typeof t) for (var o in t) r.d(e, o, function (n) {
      return t[n];
    }.bind(null, o));
    return e;
  }, r.n = function (t) {
    var n = t && t.__esModule ? function () {
      return t.default;
    } : function () {
      return t;
    };
    return r.d(n, "a", n), n;
  }, r.o = function (t, n) {
    return Object.prototype.hasOwnProperty.call(t, n);
  }, r.p = "", r(r.s = 190);
}([, function (t, n, r) {
  (function (n) {
    var r = function (t) {
      return t && t.Math == Math && t;
    };
    t.exports = r("object" == typeof globalThis && globalThis) || r("object" == typeof window && window) || r("object" == typeof self && self) || r("object" == typeof n && n) || function () {
      return this;
    }() || Function("return this")();
  }).call(this, r(73));
}, function (t, n) {
  t.exports = function (t) {
    try {
      return !!t();
    } catch (t) {
      return !0;
    }
  };
}, function (t, n, r) {
  var e = r(1),
    o = r(29),
    i = r(4),
    u = r(33),
    c = r(40),
    a = r(56),
    f = o("wks"),
    s = e.Symbol,
    l = a ? s : s && s.withoutSetter || u;
  t.exports = function (t) {
    return i(f, t) && (c || "string" == typeof f[t]) || (c && i(s, t) ? f[t] = s[t] : f[t] = l("Symbol." + t)), f[t];
  };
}, function (t, n, r) {
  var e = r(12),
    o = {}.hasOwnProperty;
  t.exports = function (t, n) {
    return o.call(e(t), n);
  };
}, function (t, n) {
  t.exports = function (t) {
    return "object" == typeof t ? null !== t : "function" == typeof t;
  };
}, function (t, n, r) {
  var e = r(7),
    o = r(47),
    i = r(9),
    u = r(17),
    c = Object.defineProperty;
  n.f = e ? c : function (t, n, r) {
    if (i(t), n = u(n, !0), i(r), o) try {
      return c(t, n, r);
    } catch (t) {}
    if ("get" in r || "set" in r) throw TypeError("Accessors not supported");
    return "value" in r && (t[n] = r.value), t;
  };
}, function (t, n, r) {
  var e = r(2);
  t.exports = !e(function () {
    return 7 != Object.defineProperty({}, 1, {
      get: function () {
        return 7;
      }
    })[1];
  });
}, function (t, n, r) {
  var e = r(1),
    o = r(19).f,
    i = r(10),
    u = r(14),
    c = r(32),
    a = r(61),
    f = r(51);
  t.exports = function (t, n) {
    var r,
      s,
      l,
      p,
      v,
      d = t.target,
      h = t.global,
      y = t.stat;
    if (r = h ? e : y ? e[d] || c(d, {}) : (e[d] || {}).prototype) for (s in n) {
      if (p = n[s], l = t.noTargetGet ? (v = o(r, s)) && v.value : r[s], !f(h ? s : d + (y ? "." : "#") + s, t.forced) && void 0 !== l) {
        if (typeof p == typeof l) continue;
        a(p, l);
      }
      (t.sham || l && l.sham) && i(p, "sham", !0), u(r, s, p, t);
    }
  };
}, function (t, n, r) {
  var e = r(5);
  t.exports = function (t) {
    if (!e(t)) throw TypeError(String(t) + " is not an object");
    return t;
  };
}, function (t, n, r) {
  var e = r(7),
    o = r(6),
    i = r(18);
  t.exports = e ? function (t, n, r) {
    return o.f(t, n, i(1, r));
  } : function (t, n, r) {
    return t[n] = r, t;
  };
}, function (t, n, r) {
  var e = r(35),
    o = r(13);
  t.exports = function (t) {
    return e(o(t));
  };
}, function (t, n, r) {
  var e = r(13);
  t.exports = function (t) {
    return Object(e(t));
  };
}, function (t, n) {
  t.exports = function (t) {
    if (null == t) throw TypeError("Can't call method on " + t);
    return t;
  };
}, function (t, n, r) {
  var e = r(1),
    o = r(10),
    i = r(4),
    u = r(32),
    c = r(46),
    a = r(26),
    f = a.get,
    s = a.enforce,
    l = String(String).split("String");
  (t.exports = function (t, n, r, c) {
    var a,
      f = !!c && !!c.unsafe,
      p = !!c && !!c.enumerable,
      v = !!c && !!c.noTargetGet;
    "function" == typeof r && ("string" != typeof n || i(r, "name") || o(r, "name", n), (a = s(r)).source || (a.source = l.join("string" == typeof n ? n : ""))), t !== e ? (f ? !v && t[n] && (p = !0) : delete t[n], p ? t[n] = r : o(t, n, r)) : p ? t[n] = r : u(n, r);
  })(Function.prototype, "toString", function () {
    return "function" == typeof this && f(this).source || c(this);
  });
}, function (t, n) {
  var r = {}.toString;
  t.exports = function (t) {
    return r.call(t).slice(8, -1);
  };
}, function (t, n, r) {
  var e = r(25),
    o = Math.min;
  t.exports = function (t) {
    return t > 0 ? o(e(t), 9007199254740991) : 0;
  };
}, function (t, n, r) {
  var e = r(5);
  t.exports = function (t, n) {
    if (!e(t)) return t;
    var r, o;
    if (n && "function" == typeof (r = t.toString) && !e(o = r.call(t))) return o;
    if ("function" == typeof (r = t.valueOf) && !e(o = r.call(t))) return o;
    if (!n && "function" == typeof (r = t.toString) && !e(o = r.call(t))) return o;
    throw TypeError("Can't convert object to primitive value");
  };
}, function (t, n) {
  t.exports = function (t, n) {
    return {
      enumerable: !(1 & t),
      configurable: !(2 & t),
      writable: !(4 & t),
      value: n
    };
  };
}, function (t, n, r) {
  var e = r(7),
    o = r(42),
    i = r(18),
    u = r(11),
    c = r(17),
    a = r(4),
    f = r(47),
    s = Object.getOwnPropertyDescriptor;
  n.f = e ? s : function (t, n) {
    if (t = u(t), n = c(n, !0), f) try {
      return s(t, n);
    } catch (t) {}
    if (a(t, n)) return i(!o.f.call(t, n), t[n]);
  };
}, function (t, n, r) {

  r.d(n, "b", function () {
    return e;
  }), r.d(n, "a", function () {
    return o;
  }), r.d(n, "c", function () {
    return i;
  });
  var e = {
      BACK_SPACE: 8,
      TAB: 9,
      ENTER: 13,
      SHIFT: 16,
      SPACE: 32,
      ARROW_LEFT: 37,
      ARROW_UP: 38,
      ARROW_RIGHT: 39,
      ARROW_DOWN: 40,
      DELETE: 46,
      F2: 113
    },
    o = {
      FILTER: "filter",
      DOUBLE_RIGHT_ARROW: "double-right-arrow",
      DOUBLE_LEFT_ARROW: "double-left-arrow",
      TOP_ARROW: "top-arrow",
      RIGHT_ARROW: "right-arrow",
      BOTTOM_ARROW: "bottom-arrow",
      LEFT_ARROW: "left-arrow",
      SORT_TOP_ARROW: "sort-top-arrow",
      SORT_BOTTOM_ARROW: "sort-bottom-arrow",
      SEARCH: "search"
    },
    i = {
      LEFT_MOUSE: 1,
      MIDDLE_MOUSE: 2,
      RIGHT_MOUSE: 2
    };
}, function (t, n) {
  t.exports = {};
}, function (t, n, r) {
  var e = r(53),
    o = r(1),
    i = function (t) {
      return "function" == typeof t ? t : void 0;
    };
  t.exports = function (t, n) {
    return arguments.length < 2 ? i(e[t]) || i(o[t]) : e[t] && e[t][n] || o[t] && o[t][n];
  };
}, function (t, n, r) {
  var e = r(29),
    o = r(33),
    i = e("keys");
  t.exports = function (t) {
    return i[t] || (i[t] = o(t));
  };
}, function (t, n) {
  t.exports = !1;
}, function (t, n) {
  var r = Math.ceil,
    e = Math.floor;
  t.exports = function (t) {
    return isNaN(t = +t) ? 0 : (t > 0 ? e : r)(t);
  };
}, function (t, n, r) {
  var e,
    o,
    i,
    u = r(80),
    c = r(1),
    a = r(5),
    f = r(10),
    s = r(4),
    l = r(30),
    p = r(23),
    v = r(21),
    d = c.WeakMap;
  if (u || l.state) {
    var h = l.state || (l.state = new d()),
      y = h.get,
      b = h.has,
      g = h.set;
    e = function (t, n) {
      if (b.call(h, t)) throw new TypeError("Object already initialized");
      return n.facade = t, g.call(h, t, n), n;
    }, o = function (t) {
      return y.call(h, t) || {};
    }, i = function (t) {
      return b.call(h, t);
    };
  } else {
    var m = p("state");
    v[m] = !0, e = function (t, n) {
      if (s(t, m)) throw new TypeError("Object already initialized");
      return n.facade = t, f(t, m, n), n;
    }, o = function (t) {
      return s(t, m) ? t[m] : {};
    }, i = function (t) {
      return s(t, m);
    };
  }
  t.exports = {
    set: e,
    get: o,
    has: i,
    enforce: function (t) {
      return i(t) ? o(t) : e(t, {});
    },
    getterFor: function (t) {
      return function (n) {
        var r;
        if (!a(n) || (r = o(n)).type !== t) throw TypeError("Incompatible receiver, " + t + " required");
        return r;
      };
    }
  };
}, function (t, n, r) {
  var e = r(48),
    o = r(31).concat("length", "prototype");
  n.f = Object.getOwnPropertyNames || function (t) {
    return e(t, o);
  };
}, function (t, n, r) {
  var e,
    o = r(9),
    i = r(81),
    u = r(31),
    c = r(21),
    a = r(74),
    f = r(45),
    s = r(23),
    l = s("IE_PROTO"),
    p = function () {},
    v = function (t) {
      return "<script>" + t + "<\/script>";
    },
    d = function () {
      try {
        e = document.domain && new ActiveXObject("htmlfile");
      } catch (t) {}
      var t, n;
      d = e ? function (t) {
        t.write(v("")), t.close();
        var n = t.parentWindow.Object;
        return t = null, n;
      }(e) : ((n = f("iframe")).style.display = "none", a.appendChild(n), n.src = String("javascript:"), (t = n.contentWindow.document).open(), t.write(v("document.F=Object")), t.close(), t.F);
      for (var r = u.length; r--;) delete d.prototype[u[r]];
      return d();
    };
  c[l] = !0, t.exports = Object.create || function (t, n) {
    var r;
    return null !== t ? (p.prototype = o(t), r = new p(), p.prototype = null, r[l] = t) : r = d(), void 0 === n ? r : i(r, n);
  };
}, function (t, n, r) {
  var e = r(24),
    o = r(30);
  (t.exports = function (t, n) {
    return o[t] || (o[t] = void 0 !== n ? n : {});
  })("versions", []).push({
    version: "3.13.0",
    mode: e ? "pure" : "global",
    copyright: "© 2021 Denis Pushkarev (zloirock.ru)"
  });
}, function (t, n, r) {
  var e = r(1),
    o = r(32),
    i = e["__core-js_shared__"] || o("__core-js_shared__", {});
  t.exports = i;
}, function (t, n) {
  t.exports = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
}, function (t, n, r) {
  var e = r(1),
    o = r(10);
  t.exports = function (t, n) {
    try {
      o(e, t, n);
    } catch (r) {
      e[t] = n;
    }
    return n;
  };
}, function (t, n) {
  var r = 0,
    e = Math.random();
  t.exports = function (t) {
    return "Symbol(" + String(void 0 === t ? "" : t) + ")_" + (++r + e).toString(36);
  };
}, function (t, n, r) {
  var e = r(70),
    o = r(35),
    i = r(12),
    u = r(16),
    c = r(55),
    a = [].push,
    f = function (t) {
      var n = 1 == t,
        r = 2 == t,
        f = 3 == t,
        s = 4 == t,
        l = 6 == t,
        p = 7 == t,
        v = 5 == t || l;
      return function (d, h, y, b) {
        for (var g, m, O = i(d), x = o(O), w = e(h, y, 3), S = u(x.length), _ = 0, j = b || c, E = n ? j(d, S) : r || p ? j(d, 0) : void 0; S > _; _++) if ((v || _ in x) && (m = w(g = x[_], _, O), t)) if (n) E[_] = m;else if (m) switch (t) {
          case 3:
            return !0;
          case 5:
            return g;
          case 6:
            return _;
          case 2:
            a.call(E, g);
        } else switch (t) {
          case 4:
            return !1;
          case 7:
            a.call(E, g);
        }
        return l ? -1 : f || s ? s : E;
      };
    };
  t.exports = {
    forEach: f(0),
    map: f(1),
    filter: f(2),
    some: f(3),
    every: f(4),
    find: f(5),
    findIndex: f(6),
    filterOut: f(7)
  };
}, function (t, n, r) {
  var e = r(2),
    o = r(15),
    i = "".split;
  t.exports = e(function () {
    return !Object("z").propertyIsEnumerable(0);
  }) ? function (t) {
    return "String" == o(t) ? i.call(t, "") : Object(t);
  } : Object;
}, function (t, n, r) {
  var e = r(48),
    o = r(31);
  t.exports = Object.keys || function (t) {
    return e(t, o);
  };
}, function (t, n, r) {
  var e,
    o,
    i = r(1),
    u = r(82),
    c = i.process,
    a = c && c.versions,
    f = a && a.v8;
  f ? o = (e = f.split("."))[0] < 4 ? 1 : e[0] + e[1] : u && (!(e = u.match(/Edge\/(\d+)/)) || e[1] >= 74) && (e = u.match(/Chrome\/(\d+)/)) && (o = e[1]), t.exports = o && +o;
}, function (t, n, r) {

  var e = r(7),
    o = r(1),
    i = r(51),
    u = r(14),
    c = r(4),
    a = r(15),
    f = r(92),
    s = r(17),
    l = r(2),
    p = r(28),
    v = r(27).f,
    d = r(19).f,
    h = r(6).f,
    y = r(96).trim,
    b = o.Number,
    g = b.prototype,
    m = "Number" == a(p(g)),
    O = function (t) {
      var n,
        r,
        e,
        o,
        i,
        u,
        c,
        a,
        f = s(t, !1);
      if ("string" == typeof f && f.length > 2) if (43 === (n = (f = y(f)).charCodeAt(0)) || 45 === n) {
        if (88 === (r = f.charCodeAt(2)) || 120 === r) return NaN;
      } else if (48 === n) {
        switch (f.charCodeAt(1)) {
          case 66:
          case 98:
            e = 2, o = 49;
            break;
          case 79:
          case 111:
            e = 8, o = 55;
            break;
          default:
            return +f;
        }
        for (u = (i = f.slice(2)).length, c = 0; c < u; c++) if ((a = i.charCodeAt(c)) < 48 || a > o) return NaN;
        return parseInt(i, e);
      }
      return +f;
    };
  if (i("Number", !b(" 0o1") || !b("0b1") || b("+0x1"))) {
    for (var x, w = function (t) {
        var n = arguments.length < 1 ? 0 : t,
          r = this;
        return r instanceof w && (m ? l(function () {
          g.valueOf.call(r);
        }) : "Number" != a(r)) ? f(new b(O(n)), r, w) : O(n);
      }, S = e ? v(b) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","), _ = 0; S.length > _; _++) c(b, x = S[_]) && !c(w, x) && h(w, x, d(b, x));
    w.prototype = g, g.constructor = w, u(o, "Number", w);
  }
}, function (t, n, r) {
  var e = r(15);
  t.exports = Array.isArray || function (t) {
    return "Array" == e(t);
  };
}, function (t, n, r) {
  var e = r(37),
    o = r(2);
  t.exports = !!Object.getOwnPropertySymbols && !o(function () {
    return !String(Symbol()) || !Symbol.sham && e && e < 41;
  });
}, function (t, n, r) {
  var e = r(7),
    o = r(6).f,
    i = Function.prototype,
    u = i.toString,
    c = /^\s*function ([^ (]*)/;
  e && !("name" in i) && o(i, "name", {
    configurable: !0,
    get: function () {
      try {
        return u.call(this).match(c)[1];
      } catch (t) {
        return "";
      }
    }
  });
}, function (t, n, r) {

  var e = {}.propertyIsEnumerable,
    o = Object.getOwnPropertyDescriptor,
    i = o && !e.call({
      1: 2
    }, 1);
  n.f = i ? function (t) {
    var n = o(this, t);
    return !!n && n.enumerable;
  } : e;
},,, function (t, n, r) {
  var e = r(1),
    o = r(5),
    i = e.document,
    u = o(i) && o(i.createElement);
  t.exports = function (t) {
    return u ? i.createElement(t) : {};
  };
}, function (t, n, r) {
  var e = r(30),
    o = Function.toString;
  "function" != typeof e.inspectSource && (e.inspectSource = function (t) {
    return o.call(t);
  }), t.exports = e.inspectSource;
}, function (t, n, r) {
  var e = r(7),
    o = r(2),
    i = r(45);
  t.exports = !e && !o(function () {
    return 7 != Object.defineProperty(i("div"), "a", {
      get: function () {
        return 7;
      }
    }).a;
  });
}, function (t, n, r) {
  var e = r(4),
    o = r(11),
    i = r(62).indexOf,
    u = r(21);
  t.exports = function (t, n) {
    var r,
      c = o(t),
      a = 0,
      f = [];
    for (r in c) !e(u, r) && e(c, r) && f.push(r);
    for (; n.length > a;) e(c, r = n[a++]) && (~i(f, r) || f.push(r));
    return f;
  };
}, function (t, n) {
  n.f = Object.getOwnPropertySymbols;
},, function (t, n, r) {
  var e = r(2),
    o = /#|\.prototype\./,
    i = function (t, n) {
      var r = c[u(t)];
      return r == f || r != a && ("function" == typeof n ? e(n) : !!n);
    },
    u = i.normalize = function (t) {
      return String(t).replace(o, ".").toLowerCase();
    },
    c = i.data = {},
    a = i.NATIVE = "N",
    f = i.POLYFILL = "P";
  t.exports = i;
}, function (t, n, r) {
  var e = r(2),
    o = r(3),
    i = r(37),
    u = o("species");
  t.exports = function (t) {
    return i >= 51 || !e(function () {
      var n = [];
      return (n.constructor = {})[u] = function () {
        return {
          foo: 1
        };
      }, 1 !== n[t](Boolean).foo;
    });
  };
}, function (t, n, r) {
  var e = r(1);
  t.exports = e;
},, function (t, n, r) {
  var e = r(5),
    o = r(39),
    i = r(3)("species");
  t.exports = function (t, n) {
    var r;
    return o(t) && ("function" != typeof (r = t.constructor) || r !== Array && !o(r.prototype) ? e(r) && null === (r = r[i]) && (r = void 0) : r = void 0), new (void 0 === r ? Array : r)(0 === n ? 0 : n);
  };
}, function (t, n, r) {
  var e = r(40);
  t.exports = e && !Symbol.sham && "symbol" == typeof Symbol.iterator;
},, function (t, n, r) {
  var e = r(9),
    o = r(91);
  t.exports = Object.setPrototypeOf || ("__proto__" in {} ? function () {
    var t,
      n = !1,
      r = {};
    try {
      (t = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set).call(r, []), n = r instanceof Array;
    } catch (t) {}
    return function (r, i) {
      return e(r), o(i), n ? t.call(r, i) : r.__proto__ = i, r;
    };
  }() : void 0);
}, function (t, n, r) {
  var e = r(25),
    o = Math.max,
    i = Math.min;
  t.exports = function (t, n) {
    var r = e(t);
    return r < 0 ? o(r + n, 0) : i(r, n);
  };
}, function (t, n) {
  t.exports = function (t) {
    if ("function" != typeof t) throw TypeError(String(t) + " is not a function");
    return t;
  };
}, function (t, n, r) {
  var e = r(4),
    o = r(83),
    i = r(19),
    u = r(6);
  t.exports = function (t, n) {
    for (var r = o(n), c = u.f, a = i.f, f = 0; f < r.length; f++) {
      var s = r[f];
      e(t, s) || c(t, s, a(n, s));
    }
  };
}, function (t, n, r) {
  var e = r(11),
    o = r(16),
    i = r(59),
    u = function (t) {
      return function (n, r, u) {
        var c,
          a = e(n),
          f = o(a.length),
          s = i(u, f);
        if (t && r != r) {
          for (; f > s;) if ((c = a[s++]) != c) return !0;
        } else for (; f > s; s++) if ((t || s in a) && a[s] === r) return t || s || 0;
        return !t && -1;
      };
    };
  t.exports = {
    includes: u(!0),
    indexOf: u(!1)
  };
},,,,,, function (t, n) {
  t.exports = veIcon;
},, function (t, n, r) {
  var e = r(60);
  t.exports = function (t, n, r) {
    if (e(t), void 0 === n) return t;
    switch (r) {
      case 0:
        return function () {
          return t.call(n);
        };
      case 1:
        return function (r) {
          return t.call(n, r);
        };
      case 2:
        return function (r, e) {
          return t.call(n, r, e);
        };
      case 3:
        return function (r, e, o) {
          return t.call(n, r, e, o);
        };
    }
    return function () {
      return t.apply(n, arguments);
    };
  };
},,, function (t, n) {
  var r;
  r = function () {
    return this;
  }();
  try {
    r = r || new Function("return this")();
  } catch (t) {
    "object" == typeof window && (r = window);
  }
  t.exports = r;
}, function (t, n, r) {
  var e = r(22);
  t.exports = e("document", "documentElement");
}, function (t, n, r) {

  var e = r(2);
  t.exports = function (t, n) {
    var r = [][t];
    return !!r && e(function () {
      r.call(null, n || function () {
        throw 1;
      }, 1);
    });
  };
},,,,, function (t, n, r) {
  var e = r(1),
    o = r(46),
    i = e.WeakMap;
  t.exports = "function" == typeof i && /native code/.test(o(i));
}, function (t, n, r) {
  var e = r(7),
    o = r(6),
    i = r(9),
    u = r(36);
  t.exports = e ? Object.defineProperties : function (t, n) {
    i(t);
    for (var r, e = u(n), c = e.length, a = 0; c > a;) o.f(t, r = e[a++], n[r]);
    return t;
  };
}, function (t, n, r) {
  var e = r(22);
  t.exports = e("navigator", "userAgent") || "";
}, function (t, n, r) {
  var e = r(22),
    o = r(27),
    i = r(49),
    u = r(9);
  t.exports = e("Reflect", "ownKeys") || function (t) {
    var n = o.f(u(t)),
      r = i.f;
    return r ? n.concat(r(t)) : n;
  };
},, function (t, n, r) {

  var e = r(8),
    o = r(34).map;
  e({
    target: "Array",
    proto: !0,
    forced: !r(52)("map")
  }, {
    map: function (t) {
      return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
    }
  });
},,,,,, function (t, n, r) {
  var e = r(5);
  t.exports = function (t) {
    if (!e(t) && null !== t) throw TypeError("Can't set " + String(t) + " as a prototype");
    return t;
  };
}, function (t, n, r) {
  var e = r(5),
    o = r(58);
  t.exports = function (t, n, r) {
    var i, u;
    return o && "function" == typeof (i = n.constructor) && i !== r && e(u = i.prototype) && u !== r.prototype && o(t, u), t;
  };
},,,, function (t, n, r) {
  var e = r(13),
    o = "[" + r(97) + "]",
    i = RegExp("^" + o + o + "*"),
    u = RegExp(o + o + "*$"),
    c = function (t) {
      return function (n) {
        var r = String(e(n));
        return 1 & t && (r = r.replace(i, "")), 2 & t && (r = r.replace(u, "")), r;
      };
    };
  t.exports = {
    start: c(1),
    end: c(2),
    trim: c(3)
  };
}, function (t, n) {
  t.exports = "\t\n\v\f\r                　\u2028\u2029\ufeff";
},,,,,,, function (t, n, r) {

  var e = r(8),
    o = r(34).filter;
  e({
    target: "Array",
    proto: !0,
    forced: !r(52)("filter")
  }, {
    filter: function (t) {
      return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
    }
  });
},,,,,,, function (t, n, r) {
  var e = r(8),
    o = r(127);
  e({
    target: "Object",
    stat: !0,
    forced: Object.assign !== o
  }, {
    assign: o
  });
},,,,,,,,,,,,,,,, function (t, n, r) {

  var e = r(7),
    o = r(2),
    i = r(36),
    u = r(49),
    c = r(42),
    a = r(12),
    f = r(35),
    s = Object.assign,
    l = Object.defineProperty;
  t.exports = !s || o(function () {
    if (e && 1 !== s({
      b: 1
    }, s(l({}, "a", {
      enumerable: !0,
      get: function () {
        l(this, "b", {
          value: 3,
          enumerable: !1
        });
      }
    }), {
      b: 2
    })).b) return !0;
    var t = {},
      n = {},
      r = Symbol();
    return t[r] = 7, "abcdefghijklmnopqrst".split("").forEach(function (t) {
      n[t] = t;
    }), 7 != s({}, t)[r] || "abcdefghijklmnopqrst" != i(s({}, n)).join("");
  }) ? function (t, n) {
    for (var r = a(t), o = arguments.length, s = 1, l = u.f, p = c.f; o > s;) for (var v, d = f(arguments[s++]), h = l ? i(d).concat(l(d)) : i(d), y = h.length, b = 0; y > b;) v = h[b++], e && !p.call(d, v) || (r[v] = d[v]);
    return r;
  } : s;
},,, function (t, n) {
  t.exports = veDropdown;
},, function (t, n, r) {

  var e = r(8),
    o = r(35),
    i = r(11),
    u = r(75),
    c = [].join,
    a = o != Object,
    f = u("join", ",");
  e({
    target: "Array",
    proto: !0,
    forced: a || !f
  }, {
    join: function (t) {
      return c.call(i(this), void 0 === t ? "," : t);
    }
  });
},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, function (t, n, r) {

  r.r(n);
  r(41), r(38), r(111), r(132), r(85), r(104);
  var e = r(130),
    o = r.n(e),
    i = "on-select-change";
  function u(t) {
    return "ve-select-" + t;
  }
  var c = r(68),
    a = r.n(c),
    f = r(20);
  function s(t, n, r) {
    return n in t ? Object.defineProperty(t, n, {
      value: r,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : t[n] = r, t;
  }
  var l = {
    name: "VeSelect",
    props: {
      width: {
        type: Number,
        default: 90
      },
      maxWidth: {
        type: Number,
        default: 0
      },
      isMultiple: {
        type: Boolean,
        default: !1
      },
      value: {
        type: Array,
        default: null
      },
      placeholder: {
        type: String,
        default: "请选择",
        validator: function (t) {
          return t.length > 0;
        }
      },
      textAlign: {
        type: String,
        default: "left"
      },
      isInput: {
        type: Boolean,
        default: !1
      },
      popperAppendTo: {
        type: [String, HTMLElement],
        default: function () {
          return document.body;
        }
      }
    },
    data: function () {
      return {
        visible: !1,
        internalOptions: [],
        inputValue: "",
        dropdownVisible: !1
      };
    },
    computed: {
      iconClass: function () {
        var t;
        return s(t = {}, u("show"), this.dropdownVisible), s(t, u("toggle-icon"), !0), t;
      }
    },
    watch: {
      value: function () {
        this.init();
      }
    },
    methods: {
      init: function () {
        this.internalOptions = Object.assign([], this.value);
      },
      showSelectInfo: function () {
        var t;
        return t = this.selectedLabels(), Array.isArray(t) && t.length > 0 ? t.join() : this.placeholder;
      },
      selectedLabels: function () {
        return this.internalOptions.filter(function (t) {
          return t.selected;
        }).map(function (t) {
          if (t.selected) return t.label;
        });
      },
      dropdownChange: function () {
        this.$emit("input", this.internalOptions), this.$emit(i, this.internalOptions);
      }
    },
    created: function () {
      this.init();
    },
    render: function () {
      var t = this,
        n = arguments[0],
        r = this.isInput,
        e = {
          class: "ve-select",
          props: {
            isSelect: !0,
            width: this.width,
            maxWidth: this.maxWidth,
            isMultiple: this.isMultiple,
            textAlign: this.textAlign,
            isInput: this.isInput,
            value: this.internalOptions,
            hideByItemClick: !0,
            popperAppendTo: this.popperAppendTo
          },
          style: {
            width: this.width
          },
          on: {
            input: function (n) {
              t.internalOptions = n, t.dropdownChange();
            },
            "dropdown-visible-change": function (n) {
              t.dropdownVisible = n;
            }
          }
        },
        i = "";
      return i = r ? n("input", {
        class: u("input"),
        attrs: {
          placeholder: this.placeholder,
          type: "text"
        },
        directives: [{
          name: "model",
          value: this.inputValue
        }]
      }) : n("span", {
        class: u("selected-span")
      }, [this.showSelectInfo()]), n(o.a, e, [n("span", [i, n(a.a, {
        attrs: {
          name: f.a.BOTTOM_ARROW
        },
        class: this.iconClass
      })])]);
    },
    install: function (t) {
      t.component(l.name, l);
    }
  };
  n.default = l;
}]);
});

unwrapExports(veSelect);

var veContextmenu = createCommonjsModule(function (module) {
module.exports = function (t) {
  var e = {};
  function n(r) {
    if (e[r]) return e[r].exports;
    var o = e[r] = {
      i: r,
      l: !1,
      exports: {}
    };
    return t[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports;
  }
  return n.m = t, n.c = e, n.d = function (t, e, r) {
    n.o(t, e) || Object.defineProperty(t, e, {
      enumerable: !0,
      get: r
    });
  }, n.r = function (t) {
    "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
      value: "Module"
    }), Object.defineProperty(t, "__esModule", {
      value: !0
    });
  }, n.t = function (t, e) {
    if (1 & e && (t = n(t)), 8 & e) return t;
    if (4 & e && "object" == typeof t && t && t.__esModule) return t;
    var r = Object.create(null);
    if (n.r(r), Object.defineProperty(r, "default", {
      enumerable: !0,
      value: t
    }), 2 & e && "string" != typeof t) for (var o in t) n.d(r, o, function (e) {
      return t[e];
    }.bind(null, o));
    return r;
  }, n.n = function (t) {
    var e = t && t.__esModule ? function () {
      return t.default;
    } : function () {
      return t;
    };
    return n.d(e, "a", e), e;
  }, n.o = function (t, e) {
    return Object.prototype.hasOwnProperty.call(t, e);
  }, n.p = "", n(n.s = 185);
}([, function (t, e, n) {
  (function (e) {
    var n = function (t) {
      return t && t.Math == Math && t;
    };
    t.exports = n("object" == typeof globalThis && globalThis) || n("object" == typeof window && window) || n("object" == typeof self && self) || n("object" == typeof e && e) || function () {
      return this;
    }() || Function("return this")();
  }).call(this, n(73));
}, function (t, e) {
  t.exports = function (t) {
    try {
      return !!t();
    } catch (t) {
      return !0;
    }
  };
}, function (t, e, n) {
  var r = n(1),
    o = n(29),
    i = n(4),
    c = n(33),
    u = n(40),
    a = n(56),
    s = o("wks"),
    f = r.Symbol,
    l = a ? f : f && f.withoutSetter || c;
  t.exports = function (t) {
    return i(s, t) && (u || "string" == typeof s[t]) || (u && i(f, t) ? s[t] = f[t] : s[t] = l("Symbol." + t)), s[t];
  };
}, function (t, e, n) {
  var r = n(12),
    o = {}.hasOwnProperty;
  t.exports = function (t, e) {
    return o.call(r(t), e);
  };
}, function (t, e) {
  t.exports = function (t) {
    return "object" == typeof t ? null !== t : "function" == typeof t;
  };
}, function (t, e, n) {
  var r = n(7),
    o = n(47),
    i = n(9),
    c = n(17),
    u = Object.defineProperty;
  e.f = r ? u : function (t, e, n) {
    if (i(t), e = c(e, !0), i(n), o) try {
      return u(t, e, n);
    } catch (t) {}
    if ("get" in n || "set" in n) throw TypeError("Accessors not supported");
    return "value" in n && (t[e] = n.value), t;
  };
}, function (t, e, n) {
  var r = n(2);
  t.exports = !r(function () {
    return 7 != Object.defineProperty({}, 1, {
      get: function () {
        return 7;
      }
    })[1];
  });
}, function (t, e, n) {
  var r = n(1),
    o = n(19).f,
    i = n(10),
    c = n(14),
    u = n(32),
    a = n(61),
    s = n(51);
  t.exports = function (t, e) {
    var n,
      f,
      l,
      p,
      d,
      v = t.target,
      h = t.global,
      g = t.stat;
    if (n = h ? r : g ? r[v] || u(v, {}) : (r[v] || {}).prototype) for (f in e) {
      if (p = e[f], l = t.noTargetGet ? (d = o(n, f)) && d.value : n[f], !s(h ? f : v + (g ? "." : "#") + f, t.forced) && void 0 !== l) {
        if (typeof p == typeof l) continue;
        a(p, l);
      }
      (t.sham || l && l.sham) && i(p, "sham", !0), c(n, f, p, t);
    }
  };
}, function (t, e, n) {
  var r = n(5);
  t.exports = function (t) {
    if (!r(t)) throw TypeError(String(t) + " is not an object");
    return t;
  };
}, function (t, e, n) {
  var r = n(7),
    o = n(6),
    i = n(18);
  t.exports = r ? function (t, e, n) {
    return o.f(t, e, i(1, n));
  } : function (t, e, n) {
    return t[e] = n, t;
  };
}, function (t, e, n) {
  var r = n(35),
    o = n(13);
  t.exports = function (t) {
    return r(o(t));
  };
}, function (t, e, n) {
  var r = n(13);
  t.exports = function (t) {
    return Object(r(t));
  };
}, function (t, e) {
  t.exports = function (t) {
    if (null == t) throw TypeError("Can't call method on " + t);
    return t;
  };
}, function (t, e, n) {
  var r = n(1),
    o = n(10),
    i = n(4),
    c = n(32),
    u = n(46),
    a = n(26),
    s = a.get,
    f = a.enforce,
    l = String(String).split("String");
  (t.exports = function (t, e, n, u) {
    var a,
      s = !!u && !!u.unsafe,
      p = !!u && !!u.enumerable,
      d = !!u && !!u.noTargetGet;
    "function" == typeof n && ("string" != typeof e || i(n, "name") || o(n, "name", e), (a = f(n)).source || (a.source = l.join("string" == typeof e ? e : ""))), t !== r ? (s ? !d && t[e] && (p = !0) : delete t[e], p ? t[e] = n : o(t, e, n)) : p ? t[e] = n : c(e, n);
  })(Function.prototype, "toString", function () {
    return "function" == typeof this && s(this).source || u(this);
  });
}, function (t, e) {
  var n = {}.toString;
  t.exports = function (t) {
    return n.call(t).slice(8, -1);
  };
}, function (t, e, n) {
  var r = n(25),
    o = Math.min;
  t.exports = function (t) {
    return t > 0 ? o(r(t), 9007199254740991) : 0;
  };
}, function (t, e, n) {
  var r = n(5);
  t.exports = function (t, e) {
    if (!r(t)) return t;
    var n, o;
    if (e && "function" == typeof (n = t.toString) && !r(o = n.call(t))) return o;
    if ("function" == typeof (n = t.valueOf) && !r(o = n.call(t))) return o;
    if (!e && "function" == typeof (n = t.toString) && !r(o = n.call(t))) return o;
    throw TypeError("Can't convert object to primitive value");
  };
}, function (t, e) {
  t.exports = function (t, e) {
    return {
      enumerable: !(1 & t),
      configurable: !(2 & t),
      writable: !(4 & t),
      value: e
    };
  };
}, function (t, e, n) {
  var r = n(7),
    o = n(42),
    i = n(18),
    c = n(11),
    u = n(17),
    a = n(4),
    s = n(47),
    f = Object.getOwnPropertyDescriptor;
  e.f = r ? f : function (t, e) {
    if (t = c(t), e = u(e, !0), s) try {
      return f(t, e);
    } catch (t) {}
    if (a(t, e)) return i(!o.f.call(t, e), t[e]);
  };
}, function (t, e, n) {

  n.d(e, "b", function () {
    return r;
  }), n.d(e, "a", function () {
    return o;
  }), n.d(e, "c", function () {
    return i;
  });
  var r = {
      BACK_SPACE: 8,
      TAB: 9,
      ENTER: 13,
      SHIFT: 16,
      SPACE: 32,
      ARROW_LEFT: 37,
      ARROW_UP: 38,
      ARROW_RIGHT: 39,
      ARROW_DOWN: 40,
      DELETE: 46,
      F2: 113
    },
    o = {
      FILTER: "filter",
      DOUBLE_RIGHT_ARROW: "double-right-arrow",
      DOUBLE_LEFT_ARROW: "double-left-arrow",
      TOP_ARROW: "top-arrow",
      RIGHT_ARROW: "right-arrow",
      BOTTOM_ARROW: "bottom-arrow",
      LEFT_ARROW: "left-arrow",
      SORT_TOP_ARROW: "sort-top-arrow",
      SORT_BOTTOM_ARROW: "sort-bottom-arrow",
      SEARCH: "search"
    },
    i = {
      LEFT_MOUSE: 1,
      MIDDLE_MOUSE: 2,
      RIGHT_MOUSE: 2
    };
}, function (t, e) {
  t.exports = {};
}, function (t, e, n) {
  var r = n(53),
    o = n(1),
    i = function (t) {
      return "function" == typeof t ? t : void 0;
    };
  t.exports = function (t, e) {
    return arguments.length < 2 ? i(r[t]) || i(o[t]) : r[t] && r[t][e] || o[t] && o[t][e];
  };
}, function (t, e, n) {
  var r = n(29),
    o = n(33),
    i = r("keys");
  t.exports = function (t) {
    return i[t] || (i[t] = o(t));
  };
}, function (t, e) {
  t.exports = !1;
}, function (t, e) {
  var n = Math.ceil,
    r = Math.floor;
  t.exports = function (t) {
    return isNaN(t = +t) ? 0 : (t > 0 ? r : n)(t);
  };
}, function (t, e, n) {
  var r,
    o,
    i,
    c = n(80),
    u = n(1),
    a = n(5),
    s = n(10),
    f = n(4),
    l = n(30),
    p = n(23),
    d = n(21),
    v = u.WeakMap;
  if (c || l.state) {
    var h = l.state || (l.state = new v()),
      g = h.get,
      m = h.has,
      y = h.set;
    r = function (t, e) {
      if (m.call(h, t)) throw new TypeError("Object already initialized");
      return e.facade = t, y.call(h, t, e), e;
    }, o = function (t) {
      return g.call(h, t) || {};
    }, i = function (t) {
      return m.call(h, t);
    };
  } else {
    var x = p("state");
    d[x] = !0, r = function (t, e) {
      if (f(t, x)) throw new TypeError("Object already initialized");
      return e.facade = t, s(t, x, e), e;
    }, o = function (t) {
      return f(t, x) ? t[x] : {};
    }, i = function (t) {
      return f(t, x);
    };
  }
  t.exports = {
    set: r,
    get: o,
    has: i,
    enforce: function (t) {
      return i(t) ? o(t) : r(t, {});
    },
    getterFor: function (t) {
      return function (e) {
        var n;
        if (!a(e) || (n = o(e)).type !== t) throw TypeError("Incompatible receiver, " + t + " required");
        return n;
      };
    }
  };
}, function (t, e, n) {
  var r = n(48),
    o = n(31).concat("length", "prototype");
  e.f = Object.getOwnPropertyNames || function (t) {
    return r(t, o);
  };
}, function (t, e, n) {
  var r,
    o = n(9),
    i = n(81),
    c = n(31),
    u = n(21),
    a = n(74),
    s = n(45),
    f = n(23),
    l = f("IE_PROTO"),
    p = function () {},
    d = function (t) {
      return "<script>" + t + "<\/script>";
    },
    v = function () {
      try {
        r = document.domain && new ActiveXObject("htmlfile");
      } catch (t) {}
      var t, e;
      v = r ? function (t) {
        t.write(d("")), t.close();
        var e = t.parentWindow.Object;
        return t = null, e;
      }(r) : ((e = s("iframe")).style.display = "none", a.appendChild(e), e.src = String("javascript:"), (t = e.contentWindow.document).open(), t.write(d("document.F=Object")), t.close(), t.F);
      for (var n = c.length; n--;) delete v.prototype[c[n]];
      return v();
    };
  u[l] = !0, t.exports = Object.create || function (t, e) {
    var n;
    return null !== t ? (p.prototype = o(t), n = new p(), p.prototype = null, n[l] = t) : n = v(), void 0 === e ? n : i(n, e);
  };
}, function (t, e, n) {
  var r = n(24),
    o = n(30);
  (t.exports = function (t, e) {
    return o[t] || (o[t] = void 0 !== e ? e : {});
  })("versions", []).push({
    version: "3.13.0",
    mode: r ? "pure" : "global",
    copyright: "© 2021 Denis Pushkarev (zloirock.ru)"
  });
}, function (t, e, n) {
  var r = n(1),
    o = n(32),
    i = r["__core-js_shared__"] || o("__core-js_shared__", {});
  t.exports = i;
}, function (t, e) {
  t.exports = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
}, function (t, e, n) {
  var r = n(1),
    o = n(10);
  t.exports = function (t, e) {
    try {
      o(r, t, e);
    } catch (n) {
      r[t] = e;
    }
    return e;
  };
}, function (t, e) {
  var n = 0,
    r = Math.random();
  t.exports = function (t) {
    return "Symbol(" + String(void 0 === t ? "" : t) + ")_" + (++n + r).toString(36);
  };
}, function (t, e, n) {
  var r = n(70),
    o = n(35),
    i = n(12),
    c = n(16),
    u = n(55),
    a = [].push,
    s = function (t) {
      var e = 1 == t,
        n = 2 == t,
        s = 3 == t,
        f = 4 == t,
        l = 6 == t,
        p = 7 == t,
        d = 5 == t || l;
      return function (v, h, g, m) {
        for (var y, x, b = i(v), O = o(b), E = r(h, g, 3), S = c(O.length), w = 0, P = m || u, T = e ? P(v, S) : n || p ? P(v, 0) : void 0; S > w; w++) if ((d || w in O) && (x = E(y = O[w], w, b), t)) if (e) T[w] = x;else if (x) switch (t) {
          case 3:
            return !0;
          case 5:
            return y;
          case 6:
            return w;
          case 2:
            a.call(T, y);
        } else switch (t) {
          case 4:
            return !1;
          case 7:
            a.call(T, y);
        }
        return l ? -1 : s || f ? f : T;
      };
    };
  t.exports = {
    forEach: s(0),
    map: s(1),
    filter: s(2),
    some: s(3),
    every: s(4),
    find: s(5),
    findIndex: s(6),
    filterOut: s(7)
  };
}, function (t, e, n) {
  var r = n(2),
    o = n(15),
    i = "".split;
  t.exports = r(function () {
    return !Object("z").propertyIsEnumerable(0);
  }) ? function (t) {
    return "String" == o(t) ? i.call(t, "") : Object(t);
  } : Object;
}, function (t, e, n) {
  var r = n(48),
    o = n(31);
  t.exports = Object.keys || function (t) {
    return r(t, o);
  };
}, function (t, e, n) {
  var r,
    o,
    i = n(1),
    c = n(82),
    u = i.process,
    a = u && u.versions,
    s = a && a.v8;
  s ? o = (r = s.split("."))[0] < 4 ? 1 : r[0] + r[1] : c && (!(r = c.match(/Edge\/(\d+)/)) || r[1] >= 74) && (r = c.match(/Chrome\/(\d+)/)) && (o = r[1]), t.exports = o && +o;
},, function (t, e, n) {
  var r = n(15);
  t.exports = Array.isArray || function (t) {
    return "Array" == r(t);
  };
}, function (t, e, n) {
  var r = n(37),
    o = n(2);
  t.exports = !!Object.getOwnPropertySymbols && !o(function () {
    return !String(Symbol()) || !Symbol.sham && r && r < 41;
  });
}, function (t, e, n) {
  var r = n(7),
    o = n(6).f,
    i = Function.prototype,
    c = i.toString,
    u = /^\s*function ([^ (]*)/;
  r && !("name" in i) && o(i, "name", {
    configurable: !0,
    get: function () {
      try {
        return c.call(this).match(u)[1];
      } catch (t) {
        return "";
      }
    }
  });
}, function (t, e, n) {

  var r = {}.propertyIsEnumerable,
    o = Object.getOwnPropertyDescriptor,
    i = o && !r.call({
      1: 2
    }, 1);
  e.f = i ? function (t) {
    var e = o(this, t);
    return !!e && e.enumerable;
  } : r;
}, function (t, e, n) {
  var r = n(6).f,
    o = n(4),
    i = n(3)("toStringTag");
  t.exports = function (t, e, n) {
    t && !o(t = n ? t : t.prototype, i) && r(t, i, {
      configurable: !0,
      value: e
    });
  };
}, function (t, e, n) {
  var r = {};
  r[n(3)("toStringTag")] = "z", t.exports = "[object z]" === String(r);
}, function (t, e, n) {
  var r = n(1),
    o = n(5),
    i = r.document,
    c = o(i) && o(i.createElement);
  t.exports = function (t) {
    return c ? i.createElement(t) : {};
  };
}, function (t, e, n) {
  var r = n(30),
    o = Function.toString;
  "function" != typeof r.inspectSource && (r.inspectSource = function (t) {
    return o.call(t);
  }), t.exports = r.inspectSource;
}, function (t, e, n) {
  var r = n(7),
    o = n(2),
    i = n(45);
  t.exports = !r && !o(function () {
    return 7 != Object.defineProperty(i("div"), "a", {
      get: function () {
        return 7;
      }
    }).a;
  });
}, function (t, e, n) {
  var r = n(4),
    o = n(11),
    i = n(62).indexOf,
    c = n(21);
  t.exports = function (t, e) {
    var n,
      u = o(t),
      a = 0,
      s = [];
    for (n in u) !r(c, n) && r(u, n) && s.push(n);
    for (; e.length > a;) r(u, n = e[a++]) && (~i(s, n) || s.push(n));
    return s;
  };
}, function (t, e) {
  e.f = Object.getOwnPropertySymbols;
},, function (t, e, n) {
  var r = n(2),
    o = /#|\.prototype\./,
    i = function (t, e) {
      var n = u[c(t)];
      return n == s || n != a && ("function" == typeof e ? r(e) : !!e);
    },
    c = i.normalize = function (t) {
      return String(t).replace(o, ".").toLowerCase();
    },
    u = i.data = {},
    a = i.NATIVE = "N",
    s = i.POLYFILL = "P";
  t.exports = i;
}, function (t, e, n) {
  var r = n(2),
    o = n(3),
    i = n(37),
    c = o("species");
  t.exports = function (t) {
    return i >= 51 || !r(function () {
      var e = [];
      return (e.constructor = {})[c] = function () {
        return {
          foo: 1
        };
      }, 1 !== e[t](Boolean).foo;
    });
  };
}, function (t, e, n) {
  var r = n(1);
  t.exports = r;
}, function (t, e, n) {
  var r = n(1),
    o = n(66),
    i = n(98),
    c = n(10);
  for (var u in o) {
    var a = r[u],
      s = a && a.prototype;
    if (s && s.forEach !== i) try {
      c(s, "forEach", i);
    } catch (t) {
      s.forEach = i;
    }
  }
}, function (t, e, n) {
  var r = n(5),
    o = n(39),
    i = n(3)("species");
  t.exports = function (t, e) {
    var n;
    return o(t) && ("function" != typeof (n = t.constructor) || n !== Array && !o(n.prototype) ? r(n) && null === (n = n[i]) && (n = void 0) : n = void 0), new (void 0 === n ? Array : n)(0 === e ? 0 : e);
  };
}, function (t, e, n) {
  var r = n(40);
  t.exports = r && !Symbol.sham && "symbol" == typeof Symbol.iterator;
},,, function (t, e, n) {
  var r = n(25),
    o = Math.max,
    i = Math.min;
  t.exports = function (t, e) {
    var n = r(t);
    return n < 0 ? o(n + e, 0) : i(n, e);
  };
}, function (t, e) {
  t.exports = function (t) {
    if ("function" != typeof t) throw TypeError(String(t) + " is not a function");
    return t;
  };
}, function (t, e, n) {
  var r = n(4),
    o = n(83),
    i = n(19),
    c = n(6);
  t.exports = function (t, e) {
    for (var n = o(e), u = c.f, a = i.f, s = 0; s < n.length; s++) {
      var f = n[s];
      r(t, f) || u(t, f, a(e, f));
    }
  };
}, function (t, e, n) {
  var r = n(11),
    o = n(16),
    i = n(59),
    c = function (t) {
      return function (e, n, c) {
        var u,
          a = r(e),
          s = o(a.length),
          f = i(c, s);
        if (t && n != n) {
          for (; s > f;) if ((u = a[f++]) != u) return !0;
        } else for (; s > f; f++) if ((t || f in a) && a[f] === n) return t || f || 0;
        return !t && -1;
      };
    };
  t.exports = {
    includes: c(!0),
    indexOf: c(!1)
  };
}, function (t, e, n) {
  var r = n(3);
  e.f = r;
}, function (t, e, n) {
  var r = n(44),
    o = n(14),
    i = n(100);
  r || o(Object.prototype, "toString", i, {
    unsafe: !0
  });
}, function (t, e, n) {
  var r = n(3),
    o = n(28),
    i = n(6),
    c = r("unscopables"),
    u = Array.prototype;
  null == u[c] && i.f(u, c, {
    configurable: !0,
    value: o(null)
  }), t.exports = function (t) {
    u[c][t] = !0;
  };
}, function (t, e) {
  t.exports = {
    CSSRuleList: 0,
    CSSStyleDeclaration: 0,
    CSSValueList: 0,
    ClientRectList: 0,
    DOMRectList: 0,
    DOMStringList: 0,
    DOMTokenList: 1,
    DataTransferItemList: 0,
    FileList: 0,
    HTMLAllCollection: 0,
    HTMLCollection: 0,
    HTMLFormElement: 0,
    HTMLSelectElement: 0,
    MediaList: 0,
    MimeTypeArray: 0,
    NamedNodeMap: 0,
    NodeList: 1,
    PaintRequestList: 0,
    Plugin: 0,
    PluginArray: 0,
    SVGLengthList: 0,
    SVGNumberList: 0,
    SVGPathSegList: 0,
    SVGPointList: 0,
    SVGStringList: 0,
    SVGTransformList: 0,
    SourceBufferList: 0,
    StyleSheetList: 0,
    TextTrackCueList: 0,
    TextTrackList: 0,
    TouchList: 0
  };
}, function (t, e, n) {
  var r = n(53),
    o = n(4),
    i = n(63),
    c = n(6).f;
  t.exports = function (t) {
    var e = r.Symbol || (r.Symbol = {});
    o(e, t) || c(e, t, {
      value: i.f(t)
    });
  };
}, function (t, e) {
  t.exports = veIcon;
}, function (t, e) {
  t.exports = lodash;
}, function (t, e, n) {
  var r = n(60);
  t.exports = function (t, e, n) {
    if (r(t), void 0 === e) return t;
    switch (n) {
      case 0:
        return function () {
          return t.call(e);
        };
      case 1:
        return function (n) {
          return t.call(e, n);
        };
      case 2:
        return function (n, r) {
          return t.call(e, n, r);
        };
      case 3:
        return function (n, r, o) {
          return t.call(e, n, r, o);
        };
    }
    return function () {
      return t.apply(e, arguments);
    };
  };
},, function (t, e, n) {

  var r = n(17),
    o = n(6),
    i = n(18);
  t.exports = function (t, e, n) {
    var c = r(e);
    c in t ? o.f(t, c, i(0, n)) : t[c] = n;
  };
}, function (t, e) {
  var n;
  n = function () {
    return this;
  }();
  try {
    n = n || new Function("return this")();
  } catch (t) {
    "object" == typeof window && (n = window);
  }
  t.exports = n;
}, function (t, e, n) {
  var r = n(22);
  t.exports = r("document", "documentElement");
}, function (t, e, n) {

  var r = n(2);
  t.exports = function (t, e) {
    var n = [][t];
    return !!n && r(function () {
      n.call(null, e || function () {
        throw 1;
      }, 1);
    });
  };
}, function (t, e, n) {

  var r = n(8),
    o = n(1),
    i = n(22),
    c = n(24),
    u = n(7),
    a = n(40),
    s = n(56),
    f = n(2),
    l = n(4),
    p = n(39),
    d = n(5),
    v = n(9),
    h = n(12),
    g = n(11),
    m = n(17),
    y = n(18),
    x = n(28),
    b = n(36),
    O = n(27),
    E = n(99),
    S = n(49),
    w = n(19),
    P = n(6),
    T = n(42),
    R = n(10),
    C = n(14),
    I = n(29),
    j = n(23),
    A = n(21),
    L = n(33),
    _ = n(3),
    M = n(63),
    D = n(67),
    k = n(43),
    N = n(26),
    B = n(34).forEach,
    F = j("hidden"),
    W = _("toPrimitive"),
    H = N.set,
    U = N.getterFor("Symbol"),
    $ = Object.prototype,
    G = o.Symbol,
    q = i("JSON", "stringify"),
    Y = w.f,
    V = P.f,
    X = E.f,
    z = T.f,
    K = I("symbols"),
    J = I("op-symbols"),
    Q = I("string-to-symbol-registry"),
    Z = I("symbol-to-string-registry"),
    tt = I("wks"),
    et = o.QObject,
    nt = !et || !et.prototype || !et.prototype.findChild,
    rt = u && f(function () {
      return 7 != x(V({}, "a", {
        get: function () {
          return V(this, "a", {
            value: 7
          }).a;
        }
      })).a;
    }) ? function (t, e, n) {
      var r = Y($, e);
      r && delete $[e], V(t, e, n), r && t !== $ && V($, e, r);
    } : V,
    ot = function (t, e) {
      var n = K[t] = x(G.prototype);
      return H(n, {
        type: "Symbol",
        tag: t,
        description: e
      }), u || (n.description = e), n;
    },
    it = s ? function (t) {
      return "symbol" == typeof t;
    } : function (t) {
      return Object(t) instanceof G;
    },
    ct = function (t, e, n) {
      t === $ && ct(J, e, n), v(t);
      var r = m(e, !0);
      return v(n), l(K, r) ? (n.enumerable ? (l(t, F) && t[F][r] && (t[F][r] = !1), n = x(n, {
        enumerable: y(0, !1)
      })) : (l(t, F) || V(t, F, y(1, {})), t[F][r] = !0), rt(t, r, n)) : V(t, r, n);
    },
    ut = function (t, e) {
      v(t);
      var n = g(e),
        r = b(n).concat(lt(n));
      return B(r, function (e) {
        u && !at.call(n, e) || ct(t, e, n[e]);
      }), t;
    },
    at = function (t) {
      var e = m(t, !0),
        n = z.call(this, e);
      return !(this === $ && l(K, e) && !l(J, e)) && (!(n || !l(this, e) || !l(K, e) || l(this, F) && this[F][e]) || n);
    },
    st = function (t, e) {
      var n = g(t),
        r = m(e, !0);
      if (n !== $ || !l(K, r) || l(J, r)) {
        var o = Y(n, r);
        return !o || !l(K, r) || l(n, F) && n[F][r] || (o.enumerable = !0), o;
      }
    },
    ft = function (t) {
      var e = X(g(t)),
        n = [];
      return B(e, function (t) {
        l(K, t) || l(A, t) || n.push(t);
      }), n;
    },
    lt = function (t) {
      var e = t === $,
        n = X(e ? J : g(t)),
        r = [];
      return B(n, function (t) {
        !l(K, t) || e && !l($, t) || r.push(K[t]);
      }), r;
    };
  (a || (C((G = function () {
    if (this instanceof G) throw TypeError("Symbol is not a constructor");
    var t = arguments.length && void 0 !== arguments[0] ? String(arguments[0]) : void 0,
      e = L(t),
      n = function (t) {
        this === $ && n.call(J, t), l(this, F) && l(this[F], e) && (this[F][e] = !1), rt(this, e, y(1, t));
      };
    return u && nt && rt($, e, {
      configurable: !0,
      set: n
    }), ot(e, t);
  }).prototype, "toString", function () {
    return U(this).tag;
  }), C(G, "withoutSetter", function (t) {
    return ot(L(t), t);
  }), T.f = at, P.f = ct, w.f = st, O.f = E.f = ft, S.f = lt, M.f = function (t) {
    return ot(_(t), t);
  }, u && (V(G.prototype, "description", {
    configurable: !0,
    get: function () {
      return U(this).description;
    }
  }), c || C($, "propertyIsEnumerable", at, {
    unsafe: !0
  }))), r({
    global: !0,
    wrap: !0,
    forced: !a,
    sham: !a
  }, {
    Symbol: G
  }), B(b(tt), function (t) {
    D(t);
  }), r({
    target: "Symbol",
    stat: !0,
    forced: !a
  }, {
    for: function (t) {
      var e = String(t);
      if (l(Q, e)) return Q[e];
      var n = G(e);
      return Q[e] = n, Z[n] = e, n;
    },
    keyFor: function (t) {
      if (!it(t)) throw TypeError(t + " is not a symbol");
      if (l(Z, t)) return Z[t];
    },
    useSetter: function () {
      nt = !0;
    },
    useSimple: function () {
      nt = !1;
    }
  }), r({
    target: "Object",
    stat: !0,
    forced: !a,
    sham: !u
  }, {
    create: function (t, e) {
      return void 0 === e ? x(t) : ut(x(t), e);
    },
    defineProperty: ct,
    defineProperties: ut,
    getOwnPropertyDescriptor: st
  }), r({
    target: "Object",
    stat: !0,
    forced: !a
  }, {
    getOwnPropertyNames: ft,
    getOwnPropertySymbols: lt
  }), r({
    target: "Object",
    stat: !0,
    forced: f(function () {
      S.f(1);
    })
  }, {
    getOwnPropertySymbols: function (t) {
      return S.f(h(t));
    }
  }), q) && r({
    target: "JSON",
    stat: !0,
    forced: !a || f(function () {
      var t = G();
      return "[null]" != q([t]) || "{}" != q({
        a: t
      }) || "{}" != q(Object(t));
    })
  }, {
    stringify: function (t, e, n) {
      for (var r, o = [t], i = 1; arguments.length > i;) o.push(arguments[i++]);
      if (r = e, (d(e) || void 0 !== t) && !it(t)) return p(e) || (e = function (t, e) {
        if ("function" == typeof r && (e = r.call(this, t, e)), !it(e)) return e;
      }), o[1] = e, q.apply(null, o);
    }
  });
  G.prototype[W] || R(G.prototype, W, G.prototype.valueOf), k(G, "Symbol"), A[F] = !0;
},,,, function (t, e, n) {
  var r = n(1),
    o = n(46),
    i = r.WeakMap;
  t.exports = "function" == typeof i && /native code/.test(o(i));
}, function (t, e, n) {
  var r = n(7),
    o = n(6),
    i = n(9),
    c = n(36);
  t.exports = r ? Object.defineProperties : function (t, e) {
    i(t);
    for (var n, r = c(e), u = r.length, a = 0; u > a;) o.f(t, n = r[a++], e[n]);
    return t;
  };
}, function (t, e, n) {
  var r = n(22);
  t.exports = r("navigator", "userAgent") || "";
}, function (t, e, n) {
  var r = n(22),
    o = n(27),
    i = n(49),
    c = n(9);
  t.exports = r("Reflect", "ownKeys") || function (t) {
    var e = o.f(c(t)),
      n = i.f;
    return n ? e.concat(n(t)) : e;
  };
},, function (t, e, n) {

  var r = n(8),
    o = n(34).map;
  r({
    target: "Array",
    proto: !0,
    forced: !n(52)("map")
  }, {
    map: function (t) {
      return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
    }
  });
}, function (t, e, n) {

  var r,
    o,
    i = n(113),
    c = n(112),
    u = n(29),
    a = RegExp.prototype.exec,
    s = u("native-string-replace", String.prototype.replace),
    f = a,
    l = (r = /a/, o = /b*/g, a.call(r, "a"), a.call(o, "a"), 0 !== r.lastIndex || 0 !== o.lastIndex),
    p = c.UNSUPPORTED_Y || c.BROKEN_CARET,
    d = void 0 !== /()??/.exec("")[1];
  (l || d || p) && (f = function (t) {
    var e,
      n,
      r,
      o,
      c = this,
      u = p && c.sticky,
      f = i.call(c),
      v = c.source,
      h = 0,
      g = t;
    return u && (-1 === (f = f.replace("y", "")).indexOf("g") && (f += "g"), g = String(t).slice(c.lastIndex), c.lastIndex > 0 && (!c.multiline || c.multiline && "\n" !== t[c.lastIndex - 1]) && (v = "(?: " + v + ")", g = " " + g, h++), n = new RegExp("^(?:" + v + ")", f)), d && (n = new RegExp("^" + v + "$(?!\\s)", f)), l && (e = c.lastIndex), r = a.call(u ? n : c, g), u ? r ? (r.input = r.input.slice(h), r[0] = r[0].slice(h), r.index = c.lastIndex, c.lastIndex += r[0].length) : c.lastIndex = 0 : l && r && (c.lastIndex = c.global ? r.index + r[0].length : e), d && r && r.length > 1 && s.call(r[0], n, function () {
      for (o = 1; o < arguments.length - 2; o++) void 0 === arguments[o] && (r[o] = void 0);
    }), r;
  }), t.exports = f;
}, function (t, e, n) {

  n.d(e, "a", function () {
    return r;
  }), n.d(e, "f", function () {
    return o;
  }), n.d(e, "d", function () {
    return c;
  }), n.d(e, "e", function () {
    return u;
  }), n.d(e, "c", function () {
    return a;
  }), n.d(e, "b", function () {
    return s;
  }), n.d(e, "g", function () {
    return f;
  });
  n(101), n(117), n(118);
  function r(t, e) {
    if (t) {
      for (var n = t.className, r = (e || "").split(" "), o = 0, c = r.length; o < c; o++) {
        var u = r[o];
        u && (t.classList ? t.classList.add(u) : i(t, u) || (n += " " + u));
      }
      t.classList || (t.className = n);
    }
  }
  function o(t, e) {
    if (t && e) {
      for (var n = e.split(" "), r = " " + t.className + " ", o = 0, c = n.length; o < c; o++) {
        var u = n[o];
        u && (t.classList ? t.classList.remove(u) : i(t, u) && (r = r.replace(" " + u + " ", " ")));
      }
      t.classList || (t.className = (r || "").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ""));
    }
  }
  function i(t, e) {
    if (!t || !e) return !1;
    if (-1 !== e.indexOf(" ")) throw new Error("className should not contain space.");
    return t.classList ? t.classList.contains(e) : (" " + t.className + " ").indexOf(" " + e + " ") > -1;
  }
  function c(t) {
    var e = document.documentElement,
      n = void 0 !== t.getBoundingClientRect ? t.getBoundingClientRect() : 0,
      r = (window.pageXOffset || e.scrollLeft) - (e.clientLeft || 0),
      o = (window.pageYOffset || e.scrollTop) - (e.clientTop || 0),
      i = n.left + window.pageXOffset,
      c = n.top + window.pageYOffset,
      u = i - r,
      a = c - o;
    return {
      offsetTop: c,
      offsetLeft: i,
      left: u,
      top: a,
      right: window.document.documentElement.clientWidth - n.width - u,
      bottom: window.document.documentElement.clientHeight - n.height - a,
      right2: window.document.documentElement.clientWidth - u,
      bottom2: window.document.documentElement.clientHeight - a
    };
  }
  function u(t, e) {
    var n = c(t),
      r = n.offsetTop,
      o = n.offsetLeft,
      i = n.left,
      u = n.top,
      a = n.right,
      s = n.bottom,
      f = n.right2,
      l = n.bottom2,
      p = c(e);
    return {
      offsetTop: r - p.offsetTop,
      offsetLeft: o - p.offsetLeft,
      left: i - p.left,
      top: u - p.top,
      right: a - p.right,
      bottom: s - p.bottom,
      right2: f - p.right2,
      bottom2: l - p.bottom2
    };
  }
  function a(t) {
    var e = 0,
      n = 0,
      r = document.documentElement,
      o = document.body;
    return t || (t = window.event), window.pageYoffset ? (e = window.pageXOffset, n = window.pageYOffset) : (e = (r && r.scrollLeft || o && o.scrollLeft || 0) - (r && r.clientLeft || o && o.clientLeft || 0), n = (r && r.scrollTop || o && o.scrollTop || 0) - (r && r.clientTop || o && o.clientTop || 0)), {
      left: e += t.clientX,
      top: n += t.clientY,
      right: r.clientWidth - t.clientX,
      bottom: r.clientHeight - t.clientY
    };
  }
  function s(t) {
    var e = document;
    if (t.selectionStart) return t.selectionStart;
    if (e.selection) {
      t.focus();
      var n = e.selection.createRange();
      if (null === n) return 0;
      var r = t.createTextRange(),
        o = r.duplicate();
      return r.moveToBookmark(n.getBookmark()), o.setEndPoint("EndToStart", r), o.text.length;
    }
    return 0;
  }
  function f(t, e, n) {
    if (void 0 === n && (n = e), t.setSelectionRange) {
      t.focus();
      try {
        t.setSelectionRange(e, n);
      } catch (i) {
        var r = t.parentNode,
          o = r.style.display;
        r.style.display = "block", t.setSelectionRange(e, n), r.style.display = o;
      }
    }
  }
},, function (t, e, n) {
  var r = n(25),
    o = n(13),
    i = function (t) {
      return function (e, n) {
        var i,
          c,
          u = String(o(e)),
          a = r(n),
          s = u.length;
        return a < 0 || a >= s ? t ? "" : void 0 : (i = u.charCodeAt(a)) < 55296 || i > 56319 || a + 1 === s || (c = u.charCodeAt(a + 1)) < 56320 || c > 57343 ? t ? u.charAt(a) : i : t ? u.slice(a, a + 2) : c - 56320 + (i - 55296 << 10) + 65536;
      };
    };
  t.exports = {
    codeAt: i(!1),
    charAt: i(!0)
  };
},,,,, function (t, e, n) {
  var r = n(44),
    o = n(15),
    i = n(3)("toStringTag"),
    c = "Arguments" == o(function () {
      return arguments;
    }());
  t.exports = r ? o : function (t) {
    var e, n, r;
    return void 0 === t ? "Undefined" : null === t ? "Null" : "string" == typeof (n = function (t, e) {
      try {
        return t[e];
      } catch (t) {}
    }(e = Object(t), i)) ? n : c ? o(e) : "Object" == (r = o(e)) && "function" == typeof e.callee ? "Arguments" : r;
  };
},,,, function (t, e, n) {

  var r = n(34).forEach,
    o = n(75)("forEach");
  t.exports = o ? [].forEach : function (t) {
    return r(this, t, arguments.length > 1 ? arguments[1] : void 0);
  };
}, function (t, e, n) {
  var r = n(11),
    o = n(27).f,
    i = {}.toString,
    c = "object" == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  t.exports.f = function (t) {
    return c && "[object Window]" == i.call(t) ? function (t) {
      try {
        return o(t);
      } catch (t) {
        return c.slice();
      }
    }(t) : o(r(t));
  };
}, function (t, e, n) {

  var r = n(44),
    o = n(94);
  t.exports = r ? {}.toString : function () {
    return "[object " + o(this) + "]";
  };
}, function (t, e, n) {

  var r = n(8),
    o = n(86);
  r({
    target: "RegExp",
    proto: !0,
    forced: /./.exec !== o
  }, {
    exec: o
  });
},,, function (t, e, n) {

  var r = n(8),
    o = n(34).filter;
  r({
    target: "Array",
    proto: !0,
    forced: !n(52)("filter")
  }, {
    filter: function (t) {
      return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
    }
  });
}, function (t, e, n) {

  var r = n(8),
    o = n(62).includes,
    i = n(65);
  r({
    target: "Array",
    proto: !0
  }, {
    includes: function (t) {
      return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
    }
  }), i("includes");
}, function (t, e, n) {

  var r = n(8),
    o = n(115),
    i = n(13);
  r({
    target: "String",
    proto: !0,
    forced: !n(116)("includes")
  }, {
    includes: function (t) {
      return !!~String(i(this)).indexOf(o(t), arguments.length > 1 ? arguments[1] : void 0);
    }
  });
}, function (t, e, n) {
  var r = n(5),
    o = n(15),
    i = n(3)("match");
  t.exports = function (t) {
    var e;
    return r(t) && (void 0 !== (e = t[i]) ? !!e : "RegExp" == o(t));
  };
}, function (t, e, n) {

  n(101);
  var r = n(14),
    o = n(86),
    i = n(2),
    c = n(3),
    u = n(10),
    a = c("species"),
    s = RegExp.prototype,
    f = !i(function () {
      var t = /./;
      return t.exec = function () {
        var t = [];
        return t.groups = {
          a: "7"
        }, t;
      }, "7" !== "".replace(t, "$<a>");
    }),
    l = "$0" === "a".replace(/./, "$0"),
    p = c("replace"),
    d = !!/./[p] && "" === /./[p]("a", "$0"),
    v = !i(function () {
      var t = /(?:)/,
        e = t.exec;
      t.exec = function () {
        return e.apply(this, arguments);
      };
      var n = "ab".split(t);
      return 2 !== n.length || "a" !== n[0] || "b" !== n[1];
    });
  t.exports = function (t, e, n, p) {
    var h = c(t),
      g = !i(function () {
        var e = {};
        return e[h] = function () {
          return 7;
        }, 7 != ""[t](e);
      }),
      m = g && !i(function () {
        var e = !1,
          n = /a/;
        return "split" === t && ((n = {}).constructor = {}, n.constructor[a] = function () {
          return n;
        }, n.flags = "", n[h] = /./[h]), n.exec = function () {
          return e = !0, null;
        }, n[h](""), !e;
      });
    if (!g || !m || "replace" === t && (!f || !l || d) || "split" === t && !v) {
      var y = /./[h],
        x = n(h, ""[t], function (t, e, n, r, i) {
          var c = e.exec;
          return c === o || c === s.exec ? g && !i ? {
            done: !0,
            value: y.call(e, n, r)
          } : {
            done: !0,
            value: t.call(n, e, r)
          } : {
            done: !1
          };
        }, {
          REPLACE_KEEPS_$0: l,
          REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: d
        }),
        b = x[0],
        O = x[1];
      r(String.prototype, t, b), r(s, h, 2 == e ? function (t, e) {
        return O.call(t, this, e);
      } : function (t) {
        return O.call(t, this);
      });
    }
    p && u(s[h], "sham", !0);
  };
}, function (t, e, n) {

  var r = n(89).charAt;
  t.exports = function (t, e, n) {
    return e + (n ? r(t, e).length : 1);
  };
}, function (t, e, n) {
  var r = n(15),
    o = n(86);
  t.exports = function (t, e) {
    var n = t.exec;
    if ("function" == typeof n) {
      var i = n.call(t, e);
      if ("object" != typeof i) throw TypeError("RegExp exec method returned something other than an Object or null");
      return i;
    }
    if ("RegExp" !== r(t)) throw TypeError("RegExp#exec called on incompatible receiver");
    return o.call(t, e);
  };
},, function (t, e, n) {

  var r = n(2);
  function o(t, e) {
    return RegExp(t, e);
  }
  e.UNSUPPORTED_Y = r(function () {
    var t = o("a", "y");
    return t.lastIndex = 2, null != t.exec("abcd");
  }), e.BROKEN_CARET = r(function () {
    var t = o("^r", "gy");
    return t.lastIndex = 2, null != t.exec("str");
  });
}, function (t, e, n) {

  var r = n(9);
  t.exports = function () {
    var t = r(this),
      e = "";
    return t.global && (e += "g"), t.ignoreCase && (e += "i"), t.multiline && (e += "m"), t.dotAll && (e += "s"), t.unicode && (e += "u"), t.sticky && (e += "y"), e;
  };
}, function (t, e, n) {

  var r = n(8),
    o = n(34).findIndex,
    i = n(65),
    c = !0;
  "findIndex" in [] && Array(1).findIndex(function () {
    c = !1;
  }), r({
    target: "Array",
    proto: !0,
    forced: c
  }, {
    findIndex: function (t) {
      return o(this, t, arguments.length > 1 ? arguments[1] : void 0);
    }
  }), i("findIndex");
}, function (t, e, n) {
  var r = n(107);
  t.exports = function (t) {
    if (r(t)) throw TypeError("The method doesn't accept regular expressions");
    return t;
  };
}, function (t, e, n) {
  var r = n(3)("match");
  t.exports = function (t) {
    var e = /./;
    try {
      "/./"[t](e);
    } catch (n) {
      try {
        return e[r] = !1, "/./"[t](e);
      } catch (t) {}
    }
    return !1;
  };
}, function (t, e, n) {

  var r = n(108),
    o = n(9),
    i = n(16),
    c = n(25),
    u = n(13),
    a = n(109),
    s = n(126),
    f = n(110),
    l = Math.max,
    p = Math.min;
  r("replace", 2, function (t, e, n, r) {
    var d = r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,
      v = r.REPLACE_KEEPS_$0,
      h = d ? "$" : "$0";
    return [function (n, r) {
      var o = u(this),
        i = null == n ? void 0 : n[t];
      return void 0 !== i ? i.call(n, o, r) : e.call(String(o), n, r);
    }, function (t, r) {
      if (!d && v || "string" == typeof r && -1 === r.indexOf(h)) {
        var u = n(e, t, this, r);
        if (u.done) return u.value;
      }
      var g = o(t),
        m = String(this),
        y = "function" == typeof r;
      y || (r = String(r));
      var x = g.global;
      if (x) {
        var b = g.unicode;
        g.lastIndex = 0;
      }
      for (var O = [];;) {
        var E = f(g, m);
        if (null === E) break;
        if (O.push(E), !x) break;
        "" === String(E[0]) && (g.lastIndex = a(m, i(g.lastIndex), b));
      }
      for (var S, w = "", P = 0, T = 0; T < O.length; T++) {
        E = O[T];
        for (var R = String(E[0]), C = l(p(c(E.index), m.length), 0), I = [], j = 1; j < E.length; j++) I.push(void 0 === (S = E[j]) ? S : String(S));
        var A = E.groups;
        if (y) {
          var L = [R].concat(I, C, m);
          void 0 !== A && L.push(A);
          var _ = String(r.apply(void 0, L));
        } else _ = s(R, m, C, I, A, r);
        C >= P && (w += m.slice(P, C) + _, P = C + R.length);
      }
      return w + m.slice(P);
    }];
  });
}, function (t, e, n) {

  var r = n(108),
    o = n(107),
    i = n(9),
    c = n(13),
    u = n(122),
    a = n(109),
    s = n(16),
    f = n(110),
    l = n(86),
    p = n(112).UNSUPPORTED_Y,
    d = [].push,
    v = Math.min;
  r("split", 2, function (t, e, n) {
    var r;
    return r = "c" == "abbc".split(/(b)*/)[1] || 4 != "test".split(/(?:)/, -1).length || 2 != "ab".split(/(?:ab)*/).length || 4 != ".".split(/(.?)(.?)/).length || ".".split(/()()/).length > 1 || "".split(/.?/).length ? function (t, n) {
      var r = String(c(this)),
        i = void 0 === n ? 4294967295 : n >>> 0;
      if (0 === i) return [];
      if (void 0 === t) return [r];
      if (!o(t)) return e.call(r, t, i);
      for (var u, a, s, f = [], p = (t.ignoreCase ? "i" : "") + (t.multiline ? "m" : "") + (t.unicode ? "u" : "") + (t.sticky ? "y" : ""), v = 0, h = new RegExp(t.source, p + "g"); (u = l.call(h, r)) && !((a = h.lastIndex) > v && (f.push(r.slice(v, u.index)), u.length > 1 && u.index < r.length && d.apply(f, u.slice(1)), s = u[0].length, v = a, f.length >= i));) h.lastIndex === u.index && h.lastIndex++;
      return v === r.length ? !s && h.test("") || f.push("") : f.push(r.slice(v)), f.length > i ? f.slice(0, i) : f;
    } : "0".split(void 0, 0).length ? function (t, n) {
      return void 0 === t && 0 === n ? [] : e.call(this, t, n);
    } : e, [function (e, n) {
      var o = c(this),
        i = null == e ? void 0 : e[t];
      return void 0 !== i ? i.call(e, o, n) : r.call(String(o), e, n);
    }, function (t, o) {
      var c = n(r, t, this, o, r !== e);
      if (c.done) return c.value;
      var l = i(t),
        d = String(this),
        h = u(l, RegExp),
        g = l.unicode,
        m = (l.ignoreCase ? "i" : "") + (l.multiline ? "m" : "") + (l.unicode ? "u" : "") + (p ? "g" : "y"),
        y = new h(p ? "^(?:" + l.source + ")" : l, m),
        x = void 0 === o ? 4294967295 : o >>> 0;
      if (0 === x) return [];
      if (0 === d.length) return null === f(y, d) ? [d] : [];
      for (var b = 0, O = 0, E = []; O < d.length;) {
        y.lastIndex = p ? 0 : O;
        var S,
          w = f(y, p ? d.slice(O) : d);
        if (null === w || (S = v(s(y.lastIndex + (p ? O : 0)), d.length)) === b) O = a(d, O, g);else {
          if (E.push(d.slice(b, O)), E.length === x) return E;
          for (var P = 1; P <= w.length - 1; P++) if (E.push(w[P]), E.length === x) return E;
          O = b = S;
        }
      }
      return E.push(d.slice(b)), E;
    }];
  }, p);
},,,, function (t, e, n) {
  var r = n(9),
    o = n(60),
    i = n(3)("species");
  t.exports = function (t, e) {
    var n,
      c = r(t).constructor;
    return void 0 === c || null == (n = r(c)[i]) ? e : o(n);
  };
}, function (t, e, n) {

  n.d(e, "a", function () {
    return r;
  });
  n(64), n(131);
  function r() {
    return Date.now().toString(36) + Math.random().toString(36).substr(2);
  }
}, function (t, e, n) {

  var r = n(8),
    o = n(59),
    i = n(25),
    c = n(16),
    u = n(12),
    a = n(55),
    s = n(72),
    f = n(52)("splice"),
    l = Math.max,
    p = Math.min;
  r({
    target: "Array",
    proto: !0,
    forced: !f
  }, {
    splice: function (t, e) {
      var n,
        r,
        f,
        d,
        v,
        h,
        g = u(this),
        m = c(g.length),
        y = o(t, m),
        x = arguments.length;
      if (0 === x ? n = r = 0 : 1 === x ? (n = 0, r = m - y) : (n = x - 2, r = p(l(i(e), 0), m - y)), m + n - r > 9007199254740991) throw TypeError("Maximum allowed length exceeded");
      for (f = a(g, r), d = 0; d < r; d++) (v = y + d) in g && s(f, d, g[v]);
      if (f.length = r, n < r) {
        for (d = y; d < m - r; d++) h = d + n, (v = d + r) in g ? g[h] = g[v] : delete g[h];
        for (d = m; d > m - r + n; d--) delete g[d - 1];
      } else if (n > r) for (d = m - r; d > y; d--) h = d + n - 1, (v = d + r - 1) in g ? g[h] = g[v] : delete g[h];
      for (d = 0; d < n; d++) g[d + y] = arguments[d + 2];
      return g.length = m - r + n, f;
    }
  });
}, function (t, e, n) {
  var r = n(8),
    o = n(12),
    i = n(36);
  r({
    target: "Object",
    stat: !0,
    forced: n(2)(function () {
      i(1);
    })
  }, {
    keys: function (t) {
      return i(o(t));
    }
  });
}, function (t, e, n) {
  var r = n(12),
    o = Math.floor,
    i = "".replace,
    c = /\$([$&'`]|\d{1,2}|<[^>]*>)/g,
    u = /\$([$&'`]|\d{1,2})/g;
  t.exports = function (t, e, n, a, s, f) {
    var l = n + t.length,
      p = a.length,
      d = u;
    return void 0 !== s && (s = r(s), d = c), i.call(f, d, function (r, i) {
      var c;
      switch (i.charAt(0)) {
        case "$":
          return "$";
        case "&":
          return t;
        case "`":
          return e.slice(0, n);
        case "'":
          return e.slice(l);
        case "<":
          c = s[i.slice(1, -1)];
          break;
        default:
          var u = +i;
          if (0 === u) return r;
          if (u > p) {
            var f = o(u / 10);
            return 0 === f ? r : f <= p ? void 0 === a[f - 1] ? i.charAt(1) : a[f - 1] + i.charAt(1) : r;
          }
          c = a[u - 1];
      }
      return void 0 === c ? "" : c;
    });
  };
},,,,, function (t, e, n) {

  var r = n(14),
    o = n(9),
    i = n(2),
    c = n(113),
    u = RegExp.prototype,
    a = u.toString,
    s = i(function () {
      return "/a/b" != a.call({
        source: "a",
        flags: "b"
      });
    }),
    f = "toString" != a.name;
  (s || f) && r(RegExp.prototype, "toString", function () {
    var t = o(this),
      e = String(t.source),
      n = t.flags;
    return "/" + e + "/" + String(void 0 === n && t instanceof RegExp && !("flags" in u) ? c.call(t) : n);
  }, {
    unsafe: !0
  });
},,,, function (t, e, n) {
  var r = n(8),
    o = n(2),
    i = n(11),
    c = n(19).f,
    u = n(7),
    a = o(function () {
      c(1);
    });
  r({
    target: "Object",
    stat: !0,
    forced: !u || a,
    sham: !u
  }, {
    getOwnPropertyDescriptor: function (t, e) {
      return c(i(t), e);
    }
  });
}, function (t, e, n) {
  var r = n(8),
    o = n(7),
    i = n(83),
    c = n(11),
    u = n(19),
    a = n(72);
  r({
    target: "Object",
    stat: !0,
    sham: !o
  }, {
    getOwnPropertyDescriptors: function (t) {
      for (var e, n, r = c(t), o = u.f, s = i(r), f = {}, l = 0; s.length > l;) void 0 !== (n = o(r, e = s[l++])) && a(f, e, n);
      return f;
    }
  });
},,,,,,,,,,,,,,,,,,,,,,,, function (t, e, n) {

  var r = n(8),
    o = n(39),
    i = [].reverse,
    c = [1, 2];
  r({
    target: "Array",
    proto: !0,
    forced: String(c) === String(c.reverse())
  }, {
    reverse: function () {
      return o(this) && (this.length = this.length), i.call(this);
    }
  });
},,,,,,,,,,,,,,,,,,,,,,,,, function (t, e, n) {

  n.r(e);
  n(41), n(85), n(114), n(160), n(104), n(124), n(54), n(105), n(106), n(125), n(76), n(135), n(136);
  var r = "on-node-click",
    o = -1,
    i = "SEPARATOR";
  function c(t) {
    return "ve-contextmenu-" + t;
  }
  var u = n(68),
    a = n.n(u),
    s = n(20),
    f = n(87),
    l = n(123),
    p = n(69);
  function d(t, e) {
    var n = Object.keys(t);
    if (Object.getOwnPropertySymbols) {
      var r = Object.getOwnPropertySymbols(t);
      e && (r = r.filter(function (e) {
        return Object.getOwnPropertyDescriptor(t, e).enumerable;
      })), n.push.apply(n, r);
    }
    return n;
  }
  function v(t, e, n) {
    return e in t ? Object.defineProperty(t, e, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : t[e] = n, t;
  }
  var h = {
    name: "VeContextmenu",
    directives: {
      "events-outside": {
        bind: function (t, e, n) {
          var r = e.value,
            o = r.events,
            i = r.callback;
          if (Array.isArray(o) && o.length && "function" == typeof i) {
            var c = function (e) {
              if (t.contains(e.target) || t === e.target) return !1;
              i(e);
            };
            t.__eventsOutside__ = c, o.forEach(function (t) {
              document.addEventListener(t, c, !0);
            });
          } else {
            var u = n.context.name;
            console.error("[events-outside] Please provided 'events' and 'callback' in ".concat(u));
          }
        },
        unbind: function (t, e, n) {
          e.value.events.forEach(function (e) {
            document.removeEventListener(e, t.__eventsOutside__, !0);
          }), t.__eventsOutside__ = null;
        }
      }
    },
    props: {
      options: {
        type: Array,
        required: !0
      },
      eventTarget: {
        type: [String, HTMLElement],
        required: !0
      }
    },
    data: function () {
      return {
        internalOptions: [],
        panelOptions: [],
        eventTargetEl: "",
        rootContextmenuId: "",
        isChildrenPanelsClicked: !1,
        isPanelRightDirection: !0,
        isPanelsEmptyed: !0
      };
    },
    computed: {
      activeMenuIds: function () {
        return this.panelOptions.map(function (t) {
          return t.parentId;
        });
      }
    },
    watch: {
      options: {
        handler: function (t) {
          Array.isArray(t) && t.length > 0 && (this.removeOrEmptyPanels(!0), this.rootContextmenuId = this.getRandomIdWithPrefix(), this.createInternalOptions(), this.createPanelOptions({
            options: this.internalOptions
          }), this.resetContextmenu(), this.addRootContextmenuPanelToBody());
        },
        immediate: !0
      },
      eventTarget: {
        handler: function (t) {
          t && this.registerContextmenuEvent();
        },
        immediate: !0
      }
    },
    methods: v({
      getRandomIdWithPrefix: function () {
        return c(Object(l.a)());
      },
      hasChildren: function (t) {
        return Array.isArray(t.children) && t.children.length;
      },
      getPanelOptionByMenuId: function (t, e) {
        for (var n = 0; n < t.length; n++) {
          if (t[n].id === e) return t[n].children;
          if (t[n].children) {
            var r = this.getPanelOptionByMenuId(t[n].children, e);
            if (r) return r;
          }
        }
      },
      getParentContextmenuPanelEl: function (t) {
        var e,
          n = this.panelOptions,
          r = n.findIndex(function (e) {
            return e.parentId === t;
          });
        if (r > 0) {
          var o = n[r - 1].parentId;
          e = document.querySelector("#".concat(o));
        }
        return e;
      },
      createPanelByHover: function (t) {
        var e = this,
          n = t.event,
          r = t.menu,
          o = this.internalOptions,
          i = this.panelOptions;
        if (this.isPanelsEmptyed) return !1;
        if (i.findIndex(function (t) {
          return t.parentId === r.id;
        }) > -1) return !1;
        var c = i.filter(function (t) {
          return t.parentDeep >= r.deep;
        }).map(function (t) {
          return t.parentDeep;
        }).reverse();
        if (c.length) for (var u = function (t) {
            var n = i.findIndex(function (e) {
              return e.parentDeep === c[t];
            });
            n > -1 && e.panelOptions.splice(n, 1);
          }, a = c.length - 1; a >= 0; a--) u(a);
        var s = this.getPanelOptionByMenuId(o, r.id);
        s && (this.createPanelOptions({
          options: s,
          currentMenu: r
        }), this.$nextTick(function () {
          e.addContextmenuPanelToBody({
            contextmenuId: r.id
          }), e.showContextmenuPanel({
            event: n,
            contextmenuId: r.id
          });
        }));
      },
      createPanelOptions: function (t) {
        var e = t.options,
          n = t.currentMenu,
          r = this.hasChildren,
          i = this.rootContextmenuId;
        if (Array.isArray(e)) {
          var c = e.map(function (t) {
            return function (t) {
              for (var e = 1; e < arguments.length; e++) {
                var n = null != arguments[e] ? arguments[e] : {};
                e % 2 ? d(Object(n), !0).forEach(function (e) {
                  v(t, e, n[e]);
                }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : d(Object(n)).forEach(function (e) {
                  Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e));
                });
              }
              return t;
            }({
              hasChildren: r(t)
            }, t);
          });
          this.panelOptions.push({
            parentId: n ? n.id : i,
            parentDeep: n ? n.deep : o,
            menus: c
          });
        }
      },
      createInternalOptionsRecursion: function (t) {
        var e = this,
          n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
        return t.id = this.getRandomIdWithPrefix(), t.deep = n, n++, Array.isArray(t.children) && t.children.map(function (t) {
          return e.createInternalOptionsRecursion(t, n);
        }), t;
      },
      createInternalOptions: function () {
        var t = this;
        this.internalOptions = Object(p.cloneDeep)(this.options).map(function (e) {
          return t.createInternalOptionsRecursion(e);
        });
      },
      showRootContextmenuPanel: function (t) {
        t.preventDefault();
        var e = this.rootContextmenuId;
        e && (this.resetContextmenu(), this.showContextmenuPanel({
          event: t,
          contextmenuId: e,
          isRootContextmenu: !0
        }), this.isPanelsEmptyed = !1);
      },
      showContextmenuPanel: function (t) {
        var e = t.event,
          n = t.contextmenuId,
          r = t.isRootContextmenu,
          o = this.getParentContextmenuPanelEl,
          i = document.querySelector("#".concat(n));
        if (i) {
          i.innerHTML = "", i.appendChild(this.$refs[n]), i.style.position = "absolute", i.classList.add(c("popper"));
          var u = i.getBoundingClientRect(),
            a = u.width,
            s = u.height;
          if (r) {
            var l = Object(f.c)(e),
              p = l.left,
              d = l.top,
              v = l.right,
              h = l.bottom,
              g = 0,
              m = 0;
            v >= a ? (g = p, this.isPanelRightDirection = !0) : (g = p - a, this.isPanelRightDirection = !1), m = h >= s ? d : d - s, i.style.left = g + "px", i.style.top = m + "px";
          } else {
            var y = o(n);
            if (y) {
              var x = Object(f.d)(y),
                b = x.left,
                O = x.right,
                E = Object(f.c)(e),
                S = E.top,
                w = E.bottom,
                P = y.getBoundingClientRect().width,
                T = 0,
                R = 0;
              T = this.isPanelRightDirection ? O >= a ? b + P : b - P : b >= a ? b - P : b + P, R = w >= s ? S : S - s, i.style.left = T + "px", i.style.top = R + "px";
            }
          }
        }
      },
      emptyContextmenuPanels: function () {
        var t = this;
        setTimeout(function () {
          t.isChildrenPanelsClicked ? t.isChildrenPanelsClicked = !1 : (t.removeOrEmptyPanels(), t.isPanelsEmptyed = !0);
        });
      },
      removeOrEmptyPanels: function (t) {
        this.panelOptions.forEach(function (e) {
          var n = document.querySelector("#".concat(e.parentId));
          n && (t ? n.remove() : n.innerHTML = "");
        });
      },
      resetContextmenu: function () {
        this.panelOptions = [], this.createPanelOptions({
          options: this.internalOptions
        });
      },
      addContextmenuPanelToBody: function (t) {
        var e = t.contextmenuId;
        if (document.querySelector("#".concat(e))) return !1;
        var n = document.createElement("div");
        n.setAttribute("id", e), document.body.appendChild(n);
      },
      addRootContextmenuPanelToBody: function () {
        this.rootContextmenuId && this.addContextmenuPanelToBody({
          contextmenuId: this.rootContextmenuId
        });
      },
      registerContextmenuEvent: function () {
        var t = this.eventTarget;
        "string" == typeof t && t.length > 0 ? this.eventTargetEl = document.querySelector(t) : this.eventTargetEl = t, this.eventTargetEl && this.eventTargetEl.addEventListener("contextmenu", this.showRootContextmenuPanel);
      },
      removeContextmenuEvent: function () {
        this.eventTargetEl && this.eventTargetEl.removeEventListener("contextmenu", this.showRootContextmenuPanel);
      }
    }, "hideContextmenu", function () {
      this.emptyContextmenuPanels();
    }),
    created: function () {
      this.debounceCreatePanelByHover = Object(p.debounce)(this.createPanelByHover, 300);
    },
    mounted: function () {
      this.addRootContextmenuPanelToBody();
    },
    destroyed: function () {
      this.removeContextmenuEvent(), this.removeOrEmptyPanels(!0);
    },
    render: function () {
      var t = this,
        e = arguments[0],
        n = this.panelOptions,
        o = this.activeMenuIds,
        u = this.hasChildren,
        f = this.emptyContextmenuPanels,
        l = this.debounceCreatePanelByHover,
        p = {
          class: ["ve-contextmenu"],
          style: {
            display: "none"
          }
        };
      return e("div", p, [n.map(function (n, p) {
        var d = {
          ref: n.parentId,
          class: v({}, c("panel"), !0),
          directives: [{
            name: "events-outside",
            value: {
              events: ["click"],
              callback: function (t) {
                0 === p && f();
              }
            }
          }],
          on: {
            click: function () {
              0 !== p && (t.isChildrenPanelsClicked = !0);
            },
            contextmenu: function (t) {
              t.preventDefault();
            }
          }
        };
        return e("div", d, [e("ul", {
          class: c("list")
        }, [n.menus.map(function (n) {
          var p, d;
          n.type !== i ? p = {
            class: (d = {}, v(d, c("node"), !0), v(d, c("node-active"), o.includes(n.id)), v(d, c("node-disabled"), n.disabled), d),
            on: {
              mouseover: function (t) {
                n.disabled || l({
                  event: t,
                  menu: n
                });
              },
              click: function () {
                n.disabled || u(n) || (t.$emit(r, n.type), setTimeout(function () {
                  f();
                }, 50));
              }
            }
          } : p = {
            class: v({}, c("node-separator"), !0)
          };
          return n.type !== i ? e("li", p, [e("span", {
            class: c("node-label")
          }, [n.label]), n.hasChildren && e(a.a, {
            class: c("node-icon-postfix"),
            attrs: {
              name: s.a.RIGHT_ARROW
            }
          })]) : e("li", p);
        })])]);
      })]);
    },
    install: function (t) {
      t.component(h.name, h);
    }
  };
  e.default = h;
}]);
});

unwrapExports(veContextmenu);

var main$1 = createCommonjsModule(function (module) {
module.exports = function (e) {
  var t = {};
  function n(o) {
    if (t[o]) return t[o].exports;
    var i = t[o] = {
      i: o,
      l: !1,
      exports: {}
    };
    return e[o].call(i.exports, i, i.exports, n), i.l = !0, i.exports;
  }
  return n.m = e, n.c = t, n.d = function (e, t, o) {
    n.o(e, t) || Object.defineProperty(e, t, {
      enumerable: !0,
      get: o
    });
  }, n.r = function (e) {
    "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
      value: "Module"
    }), Object.defineProperty(e, "__esModule", {
      value: !0
    });
  }, n.t = function (e, t) {
    if (1 & t && (e = n(e)), 8 & t) return e;
    if (4 & t && "object" == typeof e && e && e.__esModule) return e;
    var o = Object.create(null);
    if (n.r(o), Object.defineProperty(o, "default", {
      enumerable: !0,
      value: e
    }), 2 & t && "string" != typeof e) for (var i in e) n.d(o, i, function (t) {
      return e[t];
    }.bind(null, i));
    return o;
  }, n.n = function (e) {
    var t = e && e.__esModule ? function () {
      return e.default;
    } : function () {
      return e;
    };
    return n.d(t, "a", t), t;
  }, n.o = function (e, t) {
    return Object.prototype.hasOwnProperty.call(e, t);
  }, n.p = "", n(n.s = 141);
}([function (e, t, n) {
  var o = n(2),
    i = n(22).f,
    r = n(19),
    l = n(20),
    a = n(78),
    s = n(111),
    c = n(65);
  e.exports = function (e, t) {
    var n,
      u,
      d,
      h,
      f,
      p = e.target,
      y = e.global,
      v = e.stat;
    if (n = y ? o : v ? o[p] || a(p, {}) : (o[p] || {}).prototype) for (u in t) {
      if (h = t[u], d = e.noTargetGet ? (f = i(n, u)) && f.value : n[u], !c(y ? u : p + (v ? "." : "#") + u, e.forced) && void 0 !== d) {
        if (typeof h == typeof d) continue;
        s(h, d);
      }
      (e.sham || d && d.sham) && r(h, "sham", !0), l(n, u, h, e);
    }
  };
}, function (e, t, n) {

  var o = n(11),
    i = n(2),
    r = n(65),
    l = n(20),
    a = n(15),
    s = n(31),
    c = n(107),
    u = n(50),
    d = n(3),
    h = n(54),
    f = n(68).f,
    p = n(22).f,
    y = n(14).f,
    v = n(146).trim,
    g = i.Number,
    m = g.prototype,
    w = "Number" == s(h(m)),
    C = function (e) {
      var t,
        n,
        o,
        i,
        r,
        l,
        a,
        s,
        c = u(e, !1);
      if ("string" == typeof c && c.length > 2) if (43 === (t = (c = v(c)).charCodeAt(0)) || 45 === t) {
        if (88 === (n = c.charCodeAt(2)) || 120 === n) return NaN;
      } else if (48 === t) {
        switch (c.charCodeAt(1)) {
          case 66:
          case 98:
            o = 2, i = 49;
            break;
          case 79:
          case 111:
            o = 8, i = 55;
            break;
          default:
            return +c;
        }
        for (l = (r = c.slice(2)).length, a = 0; a < l; a++) if ((s = r.charCodeAt(a)) < 48 || s > i) return NaN;
        return parseInt(r, o);
      }
      return +c;
    };
  if (r("Number", !g(" 0o1") || !g("0b1") || g("+0x1"))) {
    for (var b, x = function (e) {
        var t = arguments.length < 1 ? 0 : e,
          n = this;
        return n instanceof x && (w ? d(function () {
          m.valueOf.call(n);
        }) : "Number" != s(n)) ? c(new g(C(t)), n, x) : C(t);
      }, R = o ? f(g) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","), S = 0; R.length > S; S++) a(g, b = R[S]) && !a(x, b) && y(x, b, p(g, b));
    x.prototype = m, m.constructor = x, l(i, "Number", x);
  }
}, function (e, t, n) {
  (function (t) {
    var n = function (e) {
      return e && e.Math == Math && e;
    };
    e.exports = n("object" == typeof globalThis && globalThis) || n("object" == typeof window && window) || n("object" == typeof self && self) || n("object" == typeof t && t) || function () {
      return this;
    }() || Function("return this")();
  }).call(this, n(102));
}, function (e, t) {
  e.exports = function (e) {
    try {
      return !!e();
    } catch (e) {
      return !0;
    }
  };
}, function (e, t, n) {
  var o = n(2),
    i = n(63),
    r = n(15),
    l = n(64),
    a = n(80),
    s = n(106),
    c = i("wks"),
    u = o.Symbol,
    d = s ? u : u && u.withoutSetter || l;
  e.exports = function (e) {
    return r(c, e) && (a || "string" == typeof c[e]) || (a && r(u, e) ? c[e] = u[e] : c[e] = d("Symbol." + e)), c[e];
  };
}, function (e, t) {
  e.exports = lodash;
}, function (e, t) {
  e.exports = veIcon;
}, function (e, t, n) {
  var o = n(11),
    i = n(14).f,
    r = Function.prototype,
    l = r.toString,
    a = /^\s*function ([^ (]*)/;
  o && !("name" in r) && i(r, "name", {
    configurable: !0,
    get: function () {
      try {
        return l.call(this).match(a)[1];
      } catch (e) {
        return "";
      }
    }
  });
}, function (e, t) {
  e.exports = function (e) {
    return "object" == typeof e ? null !== e : "function" == typeof e;
  };
}, function (e, t, n) {
  var o = n(8);
  e.exports = function (e) {
    if (!o(e)) throw TypeError(String(e) + " is not an object");
    return e;
  };
}, function (e, t, n) {
  var o = n(2),
    i = n(103),
    r = n(142),
    l = n(19);
  for (var a in i) {
    var s = o[a],
      c = s && s.prototype;
    if (c && c.forEach !== r) try {
      l(c, "forEach", r);
    } catch (e) {
      c.forEach = r;
    }
  }
}, function (e, t, n) {
  var o = n(3);
  e.exports = !o(function () {
    return 7 != Object.defineProperty({}, 1, {
      get: function () {
        return 7;
      }
    })[1];
  });
}, function (e, t, n) {

  var o = n(0),
    i = n(37).map;
  o({
    target: "Array",
    proto: !0,
    forced: !n(60)("map")
  }, {
    map: function (e) {
      return i(this, e, arguments.length > 1 ? arguments[1] : void 0);
    }
  });
}, function (e, t, n) {
  var o = n(48),
    i = Math.min;
  e.exports = function (e) {
    return e > 0 ? i(o(e), 9007199254740991) : 0;
  };
}, function (e, t, n) {
  var o = n(11),
    i = n(104),
    r = n(9),
    l = n(50),
    a = Object.defineProperty;
  t.f = o ? a : function (e, t, n) {
    if (r(e), t = l(t, !0), r(n), i) try {
      return a(e, t, n);
    } catch (e) {}
    if ("get" in n || "set" in n) throw TypeError("Accessors not supported");
    return "value" in n && (e[t] = n.value), e;
  };
}, function (e, t, n) {
  var o = n(16),
    i = {}.hasOwnProperty;
  e.exports = function (e, t) {
    return i.call(o(e), t);
  };
}, function (e, t, n) {
  var o = n(17);
  e.exports = function (e) {
    return Object(o(e));
  };
}, function (e, t) {
  e.exports = function (e) {
    if (null == e) throw TypeError("Can't call method on " + e);
    return e;
  };
}, function (e, t, n) {
  var o = n(47),
    i = n(17);
  e.exports = function (e) {
    return o(i(e));
  };
}, function (e, t, n) {
  var o = n(11),
    i = n(14),
    r = n(51);
  e.exports = o ? function (e, t, n) {
    return i.f(e, t, r(1, n));
  } : function (e, t, n) {
    return e[t] = n, e;
  };
}, function (e, t, n) {
  var o = n(2),
    i = n(19),
    r = n(15),
    l = n(78),
    a = n(83),
    s = n(39),
    c = s.get,
    u = s.enforce,
    d = String(String).split("String");
  (e.exports = function (e, t, n, a) {
    var s,
      c = !!a && !!a.unsafe,
      h = !!a && !!a.enumerable,
      f = !!a && !!a.noTargetGet;
    "function" == typeof n && ("string" != typeof t || r(n, "name") || i(n, "name", t), (s = u(n)).source || (s.source = d.join("string" == typeof t ? t : ""))), e !== o ? (c ? !f && e[t] && (h = !0) : delete e[t], h ? e[t] = n : i(e, t, n)) : h ? e[t] = n : l(t, n);
  })(Function.prototype, "toString", function () {
    return "function" == typeof this && c(this).source || a(this);
  });
}, function (e, t, n) {

  var o = n(0),
    i = n(37).filter;
  o({
    target: "Array",
    proto: !0,
    forced: !n(60)("filter")
  }, {
    filter: function (e) {
      return i(this, e, arguments.length > 1 ? arguments[1] : void 0);
    }
  });
}, function (e, t, n) {
  var o = n(11),
    i = n(69),
    r = n(51),
    l = n(18),
    a = n(50),
    s = n(15),
    c = n(104),
    u = Object.getOwnPropertyDescriptor;
  t.f = o ? u : function (e, t) {
    if (e = l(e), t = a(t, !0), c) try {
      return u(e, t);
    } catch (e) {}
    if (s(e, t)) return r(!i.f.call(e, t), e[t]);
  };
}, function (e, t, n) {

  var o = n(0),
    i = n(109).includes,
    r = n(57);
  o({
    target: "Array",
    proto: !0
  }, {
    includes: function (e) {
      return i(this, e, arguments.length > 1 ? arguments[1] : void 0);
    }
  }), r("includes");
}, function (e, t, n) {

  var o = n(0),
    i = n(89),
    r = n(17);
  o({
    target: "String",
    proto: !0,
    forced: !n(90)("includes")
  }, {
    includes: function (e) {
      return !!~String(r(this)).indexOf(i(e), arguments.length > 1 ? arguments[1] : void 0);
    }
  });
}, function (e, t, n) {
  var o = n(0),
    i = n(155);
  o({
    target: "Object",
    stat: !0,
    forced: Object.assign !== i
  }, {
    assign: i
  });
}, function (e, t, n) {

  var o = n(0),
    i = n(157);
  o({
    target: "String",
    proto: !0,
    forced: n(158)("fixed")
  }, {
    fixed: function () {
      return i(this, "tt", "", "");
    }
  });
}, function (e, t, n) {
  var o = n(87),
    i = n(20),
    r = n(149);
  o || i(Object.prototype, "toString", r, {
    unsafe: !0
  });
}, function (e, t, n) {

  var o = n(0),
    i = n(37).findIndex,
    r = n(57),
    l = !0;
  "findIndex" in [] && Array(1).findIndex(function () {
    l = !1;
  }), o({
    target: "Array",
    proto: !0,
    forced: l
  }, {
    findIndex: function (e) {
      return i(this, e, arguments.length > 1 ? arguments[1] : void 0);
    }
  }), r("findIndex");
}, function (e, t, n) {

  var o = n(0),
    i = n(37).find,
    r = n(57),
    l = !0;
  "find" in [] && Array(1).find(function () {
    l = !1;
  }), o({
    target: "Array",
    proto: !0,
    forced: l
  }, {
    find: function (e) {
      return i(this, e, arguments.length > 1 ? arguments[1] : void 0);
    }
  }), r("find");
}, function (e, t) {
  e.exports = Vue;
}, function (e, t) {
  var n = {}.toString;
  e.exports = function (e) {
    return n.call(e).slice(8, -1);
  };
}, function (e, t) {
  e.exports = !1;
}, function (e, t, n) {

  var o = n(0),
    i = n(2),
    r = n(38),
    l = n(32),
    a = n(11),
    s = n(80),
    c = n(106),
    u = n(3),
    d = n(15),
    h = n(49),
    f = n(8),
    p = n(9),
    y = n(16),
    v = n(18),
    g = n(50),
    m = n(51),
    w = n(54),
    C = n(55),
    b = n(68),
    x = n(148),
    R = n(86),
    S = n(22),
    O = n(14),
    K = n(69),
    I = n(19),
    E = n(20),
    k = n(63),
    T = n(66),
    D = n(53),
    _ = n(64),
    A = n(4),
    P = n(113),
    B = n(114),
    j = n(56),
    M = n(39),
    V = n(37).forEach,
    N = T("hidden"),
    F = A("toPrimitive"),
    L = M.set,
    H = M.getterFor("Symbol"),
    W = Object.prototype,
    z = i.Symbol,
    $ = r("JSON", "stringify"),
    q = S.f,
    G = O.f,
    U = x.f,
    X = K.f,
    Y = k("symbols"),
    J = k("op-symbols"),
    Q = k("string-to-symbol-registry"),
    Z = k("symbol-to-string-registry"),
    ee = k("wks"),
    te = i.QObject,
    ne = !te || !te.prototype || !te.prototype.findChild,
    oe = a && u(function () {
      return 7 != w(G({}, "a", {
        get: function () {
          return G(this, "a", {
            value: 7
          }).a;
        }
      })).a;
    }) ? function (e, t, n) {
      var o = q(W, t);
      o && delete W[t], G(e, t, n), o && e !== W && G(W, t, o);
    } : G,
    ie = function (e, t) {
      var n = Y[e] = w(z.prototype);
      return L(n, {
        type: "Symbol",
        tag: e,
        description: t
      }), a || (n.description = t), n;
    },
    re = c ? function (e) {
      return "symbol" == typeof e;
    } : function (e) {
      return Object(e) instanceof z;
    },
    le = function (e, t, n) {
      e === W && le(J, t, n), p(e);
      var o = g(t, !0);
      return p(n), d(Y, o) ? (n.enumerable ? (d(e, N) && e[N][o] && (e[N][o] = !1), n = w(n, {
        enumerable: m(0, !1)
      })) : (d(e, N) || G(e, N, m(1, {})), e[N][o] = !0), oe(e, o, n)) : G(e, o, n);
    },
    ae = function (e, t) {
      p(e);
      var n = v(t),
        o = C(n).concat(de(n));
      return V(o, function (t) {
        a && !se.call(n, t) || le(e, t, n[t]);
      }), e;
    },
    se = function (e) {
      var t = g(e, !0),
        n = X.call(this, t);
      return !(this === W && d(Y, t) && !d(J, t)) && (!(n || !d(this, t) || !d(Y, t) || d(this, N) && this[N][t]) || n);
    },
    ce = function (e, t) {
      var n = v(e),
        o = g(t, !0);
      if (n !== W || !d(Y, o) || d(J, o)) {
        var i = q(n, o);
        return !i || !d(Y, o) || d(n, N) && n[N][o] || (i.enumerable = !0), i;
      }
    },
    ue = function (e) {
      var t = U(v(e)),
        n = [];
      return V(t, function (e) {
        d(Y, e) || d(D, e) || n.push(e);
      }), n;
    },
    de = function (e) {
      var t = e === W,
        n = U(t ? J : v(e)),
        o = [];
      return V(n, function (e) {
        !d(Y, e) || t && !d(W, e) || o.push(Y[e]);
      }), o;
    };
  (s || (E((z = function () {
    if (this instanceof z) throw TypeError("Symbol is not a constructor");
    var e = arguments.length && void 0 !== arguments[0] ? String(arguments[0]) : void 0,
      t = _(e),
      n = function (e) {
        this === W && n.call(J, e), d(this, N) && d(this[N], t) && (this[N][t] = !1), oe(this, t, m(1, e));
      };
    return a && ne && oe(W, t, {
      configurable: !0,
      set: n
    }), ie(t, e);
  }).prototype, "toString", function () {
    return H(this).tag;
  }), E(z, "withoutSetter", function (e) {
    return ie(_(e), e);
  }), K.f = se, O.f = le, S.f = ce, b.f = x.f = ue, R.f = de, P.f = function (e) {
    return ie(A(e), e);
  }, a && (G(z.prototype, "description", {
    configurable: !0,
    get: function () {
      return H(this).description;
    }
  }), l || E(W, "propertyIsEnumerable", se, {
    unsafe: !0
  }))), o({
    global: !0,
    wrap: !0,
    forced: !s,
    sham: !s
  }, {
    Symbol: z
  }), V(C(ee), function (e) {
    B(e);
  }), o({
    target: "Symbol",
    stat: !0,
    forced: !s
  }, {
    for: function (e) {
      var t = String(e);
      if (d(Q, t)) return Q[t];
      var n = z(t);
      return Q[t] = n, Z[n] = t, n;
    },
    keyFor: function (e) {
      if (!re(e)) throw TypeError(e + " is not a symbol");
      if (d(Z, e)) return Z[e];
    },
    useSetter: function () {
      ne = !0;
    },
    useSimple: function () {
      ne = !1;
    }
  }), o({
    target: "Object",
    stat: !0,
    forced: !s,
    sham: !a
  }, {
    create: function (e, t) {
      return void 0 === t ? w(e) : ae(w(e), t);
    },
    defineProperty: le,
    defineProperties: ae,
    getOwnPropertyDescriptor: ce
  }), o({
    target: "Object",
    stat: !0,
    forced: !s
  }, {
    getOwnPropertyNames: ue,
    getOwnPropertySymbols: de
  }), o({
    target: "Object",
    stat: !0,
    forced: u(function () {
      R.f(1);
    })
  }, {
    getOwnPropertySymbols: function (e) {
      return R.f(y(e));
    }
  }), $) && o({
    target: "JSON",
    stat: !0,
    forced: !s || u(function () {
      var e = z();
      return "[null]" != $([e]) || "{}" != $({
        a: e
      }) || "{}" != $(Object(e));
    })
  }, {
    stringify: function (e, t, n) {
      for (var o, i = [e], r = 1; arguments.length > r;) i.push(arguments[r++]);
      if (o = t, (f(t) || void 0 !== e) && !re(e)) return h(t) || (t = function (e, t) {
        if ("function" == typeof o && (t = o.call(this, e, t)), !re(t)) return t;
      }), i[1] = t, $.apply(null, i);
    }
  });
  z.prototype[F] || I(z.prototype, F, z.prototype.valueOf), j(z, "Symbol"), D[N] = !0;
}, function (e, t, n) {

  var o = n(18),
    i = n(57),
    r = n(58),
    l = n(39),
    a = n(88),
    s = l.set,
    c = l.getterFor("Array Iterator");
  e.exports = a(Array, "Array", function (e, t) {
    s(this, {
      type: "Array Iterator",
      target: o(e),
      index: 0,
      kind: t
    });
  }, function () {
    var e = c(this),
      t = e.target,
      n = e.kind,
      o = e.index++;
    return !t || o >= t.length ? (e.target = void 0, {
      value: void 0,
      done: !0
    }) : "keys" == n ? {
      value: o,
      done: !1
    } : "values" == n ? {
      value: t[o],
      done: !1
    } : {
      value: [o, t[o]],
      done: !1
    };
  }, "values"), r.Arguments = r.Array, i("keys"), i("values"), i("entries");
}, function (e, t, n) {

  var o = n(0),
    i = n(3),
    r = n(49),
    l = n(8),
    a = n(16),
    s = n(13),
    c = n(59),
    u = n(76),
    d = n(60),
    h = n(4),
    f = n(52),
    p = h("isConcatSpreadable"),
    y = f >= 51 || !i(function () {
      var e = [];
      return e[p] = !1, e.concat()[0] !== e;
    }),
    v = d("concat"),
    g = function (e) {
      if (!l(e)) return !1;
      var t = e[p];
      return void 0 !== t ? !!t : r(e);
    };
  o({
    target: "Array",
    proto: !0,
    forced: !y || !v
  }, {
    concat: function (e) {
      var t,
        n,
        o,
        i,
        r,
        l = a(this),
        d = u(l, 0),
        h = 0;
      for (t = -1, o = arguments.length; t < o; t++) if (g(r = -1 === t ? l : arguments[t])) {
        if (h + (i = s(r.length)) > 9007199254740991) throw TypeError("Maximum allowed index exceeded");
        for (n = 0; n < i; n++, h++) n in r && c(d, h, r[n]);
      } else {
        if (h >= 9007199254740991) throw TypeError("Maximum allowed index exceeded");
        c(d, h++, r);
      }
      return d.length = h, d;
    }
  });
}, function (e, t, n) {

  var o = n(0),
    i = n(8),
    r = n(49),
    l = n(67),
    a = n(13),
    s = n(18),
    c = n(59),
    u = n(4),
    d = n(60)("slice"),
    h = u("species"),
    f = [].slice,
    p = Math.max;
  o({
    target: "Array",
    proto: !0,
    forced: !d
  }, {
    slice: function (e, t) {
      var n,
        o,
        u,
        d = s(this),
        y = a(d.length),
        v = l(e, y),
        g = l(void 0 === t ? y : t, y);
      if (r(d) && ("function" != typeof (n = d.constructor) || n !== Array && !r(n.prototype) ? i(n) && null === (n = n[h]) && (n = void 0) : n = void 0, n === Array || void 0 === n)) return f.call(d, v, g);
      for (o = new (void 0 === n ? Array : n)(p(g - v, 0)), u = 0; v < g; v++, u++) v in d && c(o, u, d[v]);
      return o.length = u, o;
    }
  });
}, function (e, t, n) {
  var o = n(45),
    i = n(47),
    r = n(16),
    l = n(13),
    a = n(76),
    s = [].push,
    c = function (e) {
      var t = 1 == e,
        n = 2 == e,
        c = 3 == e,
        u = 4 == e,
        d = 6 == e,
        h = 7 == e,
        f = 5 == e || d;
      return function (p, y, v, g) {
        for (var m, w, C = r(p), b = i(C), x = o(y, v, 3), R = l(b.length), S = 0, O = g || a, K = t ? O(p, R) : n || h ? O(p, 0) : void 0; R > S; S++) if ((f || S in b) && (w = x(m = b[S], S, C), e)) if (t) K[S] = w;else if (w) switch (e) {
          case 3:
            return !0;
          case 5:
            return m;
          case 6:
            return S;
          case 2:
            s.call(K, m);
        } else switch (e) {
          case 4:
            return !1;
          case 7:
            s.call(K, m);
        }
        return d ? -1 : c || u ? u : K;
      };
    };
  e.exports = {
    forEach: c(0),
    map: c(1),
    filter: c(2),
    some: c(3),
    every: c(4),
    find: c(5),
    findIndex: c(6),
    filterOut: c(7)
  };
}, function (e, t, n) {
  var o = n(105),
    i = n(2),
    r = function (e) {
      return "function" == typeof e ? e : void 0;
    };
  e.exports = function (e, t) {
    return arguments.length < 2 ? r(o[e]) || r(i[e]) : o[e] && o[e][t] || i[e] && i[e][t];
  };
}, function (e, t, n) {
  var o,
    i,
    r,
    l = n(143),
    a = n(2),
    s = n(8),
    c = n(19),
    u = n(15),
    d = n(77),
    h = n(66),
    f = n(53),
    p = a.WeakMap;
  if (l || d.state) {
    var y = d.state || (d.state = new p()),
      v = y.get,
      g = y.has,
      m = y.set;
    o = function (e, t) {
      if (g.call(y, e)) throw new TypeError("Object already initialized");
      return t.facade = e, m.call(y, e, t), t;
    }, i = function (e) {
      return v.call(y, e) || {};
    }, r = function (e) {
      return g.call(y, e);
    };
  } else {
    var w = h("state");
    f[w] = !0, o = function (e, t) {
      if (u(e, w)) throw new TypeError("Object already initialized");
      return t.facade = e, c(e, w, t), t;
    }, i = function (e) {
      return u(e, w) ? e[w] : {};
    }, r = function (e) {
      return u(e, w);
    };
  }
  e.exports = {
    set: o,
    get: i,
    has: r,
    enforce: function (e) {
      return r(e) ? i(e) : o(e, {});
    },
    getterFor: function (e) {
      return function (t) {
        var n;
        if (!s(t) || (n = i(t)).type !== e) throw TypeError("Incompatible receiver, " + e + " required");
        return n;
      };
    }
  };
}, function (e, t, n) {

  var o = n(118).charAt,
    i = n(39),
    r = n(88),
    l = i.set,
    a = i.getterFor("String Iterator");
  r(String, "String", function (e) {
    l(this, {
      type: "String Iterator",
      string: String(e),
      index: 0
    });
  }, function () {
    var e,
      t = a(this),
      n = t.string,
      i = t.index;
    return i >= n.length ? {
      value: void 0,
      done: !0
    } : (e = o(n, i), t.index += e.length, {
      value: e,
      done: !1
    });
  });
}, function (e, t, n) {
  var o = n(2),
    i = n(103),
    r = n(34),
    l = n(19),
    a = n(4),
    s = a("iterator"),
    c = a("toStringTag"),
    u = r.values;
  for (var d in i) {
    var h = o[d],
      f = h && h.prototype;
    if (f) {
      if (f[s] !== u) try {
        l(f, s, u);
      } catch (e) {
        f[s] = u;
      }
      if (f[c] || l(f, c, d), i[d]) for (var p in r) if (f[p] !== r[p]) try {
        l(f, p, r[p]);
      } catch (e) {
        f[p] = r[p];
      }
    }
  }
}, function (e, t, n) {
  var o = n(0),
    i = n(16),
    r = n(55);
  o({
    target: "Object",
    stat: !0,
    forced: n(3)(function () {
      r(1);
    })
  }, {
    keys: function (e) {
      return r(i(e));
    }
  });
}, function (e, t) {
  e.exports = veCheckbox;
}, function (e, t) {
  e.exports = veDropdown;
}, function (e, t, n) {
  var o = n(46);
  e.exports = function (e, t, n) {
    if (o(e), void 0 === t) return e;
    switch (n) {
      case 0:
        return function () {
          return e.call(t);
        };
      case 1:
        return function (n) {
          return e.call(t, n);
        };
      case 2:
        return function (n, o) {
          return e.call(t, n, o);
        };
      case 3:
        return function (n, o, i) {
          return e.call(t, n, o, i);
        };
    }
    return function () {
      return e.apply(t, arguments);
    };
  };
}, function (e, t) {
  e.exports = function (e) {
    if ("function" != typeof e) throw TypeError(String(e) + " is not a function");
    return e;
  };
}, function (e, t, n) {
  var o = n(3),
    i = n(31),
    r = "".split;
  e.exports = o(function () {
    return !Object("z").propertyIsEnumerable(0);
  }) ? function (e) {
    return "String" == i(e) ? r.call(e, "") : Object(e);
  } : Object;
}, function (e, t) {
  var n = Math.ceil,
    o = Math.floor;
  e.exports = function (e) {
    return isNaN(e = +e) ? 0 : (e > 0 ? o : n)(e);
  };
}, function (e, t, n) {
  var o = n(31);
  e.exports = Array.isArray || function (e) {
    return "Array" == o(e);
  };
}, function (e, t, n) {
  var o = n(8);
  e.exports = function (e, t) {
    if (!o(e)) return e;
    var n, i;
    if (t && "function" == typeof (n = e.toString) && !o(i = n.call(e))) return i;
    if ("function" == typeof (n = e.valueOf) && !o(i = n.call(e))) return i;
    if (!t && "function" == typeof (n = e.toString) && !o(i = n.call(e))) return i;
    throw TypeError("Can't convert object to primitive value");
  };
}, function (e, t) {
  e.exports = function (e, t) {
    return {
      enumerable: !(1 & e),
      configurable: !(2 & e),
      writable: !(4 & e),
      value: t
    };
  };
}, function (e, t, n) {
  var o,
    i,
    r = n(2),
    l = n(81),
    a = r.process,
    s = a && a.versions,
    c = s && s.v8;
  c ? i = (o = c.split("."))[0] < 4 ? 1 : o[0] + o[1] : l && (!(o = l.match(/Edge\/(\d+)/)) || o[1] >= 74) && (o = l.match(/Chrome\/(\d+)/)) && (i = o[1]), e.exports = i && +i;
}, function (e, t) {
  e.exports = {};
}, function (e, t, n) {
  var o,
    i = n(9),
    r = n(145),
    l = n(85),
    a = n(53),
    s = n(110),
    c = n(79),
    u = n(66),
    d = u("IE_PROTO"),
    h = function () {},
    f = function (e) {
      return "<script>" + e + "<\/script>";
    },
    p = function () {
      try {
        o = document.domain && new ActiveXObject("htmlfile");
      } catch (e) {}
      var e, t;
      p = o ? function (e) {
        e.write(f("")), e.close();
        var t = e.parentWindow.Object;
        return e = null, t;
      }(o) : ((t = c("iframe")).style.display = "none", s.appendChild(t), t.src = String("javascript:"), (e = t.contentWindow.document).open(), e.write(f("document.F=Object")), e.close(), e.F);
      for (var n = l.length; n--;) delete p.prototype[l[n]];
      return p();
    };
  a[d] = !0, e.exports = Object.create || function (e, t) {
    var n;
    return null !== e ? (h.prototype = i(e), n = new h(), h.prototype = null, n[d] = e) : n = p(), void 0 === t ? n : r(n, t);
  };
}, function (e, t, n) {
  var o = n(108),
    i = n(85);
  e.exports = Object.keys || function (e) {
    return o(e, i);
  };
}, function (e, t, n) {
  var o = n(14).f,
    i = n(15),
    r = n(4)("toStringTag");
  e.exports = function (e, t, n) {
    e && !i(e = n ? e : e.prototype, r) && o(e, r, {
      configurable: !0,
      value: t
    });
  };
}, function (e, t, n) {
  var o = n(4),
    i = n(54),
    r = n(14),
    l = o("unscopables"),
    a = Array.prototype;
  null == a[l] && r.f(a, l, {
    configurable: !0,
    value: i(null)
  }), e.exports = function (e) {
    a[l][e] = !0;
  };
}, function (e, t) {
  e.exports = {};
}, function (e, t, n) {

  var o = n(50),
    i = n(14),
    r = n(51);
  e.exports = function (e, t, n) {
    var l = o(t);
    l in e ? i.f(e, l, r(0, n)) : e[l] = n;
  };
}, function (e, t, n) {
  var o = n(3),
    i = n(4),
    r = n(52),
    l = i("species");
  e.exports = function (e) {
    return r >= 51 || !o(function () {
      var t = [];
      return (t.constructor = {})[l] = function () {
        return {
          foo: 1
        };
      }, 1 !== t[e](Boolean).foo;
    });
  };
}, function (e, t, n) {

  var o = n(0),
    i = n(67),
    r = n(48),
    l = n(13),
    a = n(16),
    s = n(76),
    c = n(59),
    u = n(60)("splice"),
    d = Math.max,
    h = Math.min;
  o({
    target: "Array",
    proto: !0,
    forced: !u
  }, {
    splice: function (e, t) {
      var n,
        o,
        u,
        f,
        p,
        y,
        v = a(this),
        g = l(v.length),
        m = i(e, g),
        w = arguments.length;
      if (0 === w ? n = o = 0 : 1 === w ? (n = 0, o = g - m) : (n = w - 2, o = h(d(r(t), 0), g - m)), g + n - o > 9007199254740991) throw TypeError("Maximum allowed length exceeded");
      for (u = s(v, o), f = 0; f < o; f++) (p = m + f) in v && c(u, f, v[p]);
      if (u.length = o, n < o) {
        for (f = m; f < g - o; f++) y = f + n, (p = f + o) in v ? v[y] = v[p] : delete v[y];
        for (f = g; f > g - o + n; f--) delete v[f - 1];
      } else if (n > o) for (f = g - o; f > m; f--) y = f + n - 1, (p = f + o - 1) in v ? v[y] = v[p] : delete v[y];
      for (f = 0; f < n; f++) v[f + m] = arguments[f + 2];
      return v.length = g - o + n, u;
    }
  });
}, function (e, t, n) {

  var o = n(0),
    i = n(72);
  o({
    target: "RegExp",
    proto: !0,
    forced: /./.exec !== i
  }, {
    exec: i
  });
}, function (e, t, n) {
  var o = n(32),
    i = n(77);
  (e.exports = function (e, t) {
    return i[e] || (i[e] = void 0 !== t ? t : {});
  })("versions", []).push({
    version: "3.13.0",
    mode: o ? "pure" : "global",
    copyright: "© 2021 Denis Pushkarev (zloirock.ru)"
  });
}, function (e, t) {
  var n = 0,
    o = Math.random();
  e.exports = function (e) {
    return "Symbol(" + String(void 0 === e ? "" : e) + ")_" + (++n + o).toString(36);
  };
}, function (e, t, n) {
  var o = n(3),
    i = /#|\.prototype\./,
    r = function (e, t) {
      var n = a[l(e)];
      return n == c || n != s && ("function" == typeof t ? o(t) : !!t);
    },
    l = r.normalize = function (e) {
      return String(e).replace(i, ".").toLowerCase();
    },
    a = r.data = {},
    s = r.NATIVE = "N",
    c = r.POLYFILL = "P";
  e.exports = r;
}, function (e, t, n) {
  var o = n(63),
    i = n(64),
    r = o("keys");
  e.exports = function (e) {
    return r[e] || (r[e] = i(e));
  };
}, function (e, t, n) {
  var o = n(48),
    i = Math.max,
    r = Math.min;
  e.exports = function (e, t) {
    var n = o(e);
    return n < 0 ? i(n + t, 0) : r(n, t);
  };
}, function (e, t, n) {
  var o = n(108),
    i = n(85).concat("length", "prototype");
  t.f = Object.getOwnPropertyNames || function (e) {
    return o(e, i);
  };
}, function (e, t, n) {

  var o = {}.propertyIsEnumerable,
    i = Object.getOwnPropertyDescriptor,
    r = i && !o.call({
      1: 2
    }, 1);
  t.f = r ? function (e) {
    var t = i(this, e);
    return !!t && t.enumerable;
  } : o;
}, function (e, t, n) {

  var o = n(0),
    i = n(11),
    r = n(2),
    l = n(15),
    a = n(8),
    s = n(14).f,
    c = n(111),
    u = r.Symbol;
  if (i && "function" == typeof u && (!("description" in u.prototype) || void 0 !== u().description)) {
    var d = {},
      h = function () {
        var e = arguments.length < 1 || void 0 === arguments[0] ? void 0 : String(arguments[0]),
          t = this instanceof h ? new u(e) : void 0 === e ? u() : u(e);
        return "" === e && (d[t] = !0), t;
      };
    c(h, u);
    var f = h.prototype = u.prototype;
    f.constructor = h;
    var p = f.toString,
      y = "Symbol(test)" == String(u("test")),
      v = /^Symbol\((.*)\)[^)]+$/;
    s(f, "description", {
      configurable: !0,
      get: function () {
        var e = a(this) ? this.valueOf() : this,
          t = p.call(e);
        if (l(d, e)) return "";
        var n = y ? t.slice(7, -1) : t.replace(v, "$1");
        return "" === n ? void 0 : n;
      }
    }), o({
      global: !0,
      forced: !0
    }, {
      Symbol: h
    });
  }
}, function (e, t, n) {
  n(114)("iterator");
}, function (e, t, n) {

  var o,
    i,
    r = n(120),
    l = n(121),
    a = n(63),
    s = RegExp.prototype.exec,
    c = a("native-string-replace", String.prototype.replace),
    u = s,
    d = (o = /a/, i = /b*/g, s.call(o, "a"), s.call(i, "a"), 0 !== o.lastIndex || 0 !== i.lastIndex),
    h = l.UNSUPPORTED_Y || l.BROKEN_CARET,
    f = void 0 !== /()??/.exec("")[1];
  (d || f || h) && (u = function (e) {
    var t,
      n,
      o,
      i,
      l = this,
      a = h && l.sticky,
      u = r.call(l),
      p = l.source,
      y = 0,
      v = e;
    return a && (-1 === (u = u.replace("y", "")).indexOf("g") && (u += "g"), v = String(e).slice(l.lastIndex), l.lastIndex > 0 && (!l.multiline || l.multiline && "\n" !== e[l.lastIndex - 1]) && (p = "(?: " + p + ")", v = " " + v, y++), n = new RegExp("^(?:" + p + ")", u)), f && (n = new RegExp("^" + p + "$(?!\\s)", u)), d && (t = l.lastIndex), o = s.call(a ? n : l, v), a ? o ? (o.input = o.input.slice(y), o[0] = o[0].slice(y), o.index = l.lastIndex, l.lastIndex += o[0].length) : l.lastIndex = 0 : d && o && (l.lastIndex = l.global ? o.index + o[0].length : t), f && o && o.length > 1 && c.call(o[0], n, function () {
      for (i = 1; i < arguments.length - 2; i++) void 0 === arguments[i] && (o[i] = void 0);
    }), o;
  }), e.exports = u;
}, function (e, t, n) {

  var o = n(0),
    i = n(159).left,
    r = n(82),
    l = n(52),
    a = n(74);
  o({
    target: "Array",
    proto: !0,
    forced: !r("reduce") || !a && l > 79 && l < 83
  }, {
    reduce: function (e) {
      return i(this, e, arguments.length, arguments.length > 1 ? arguments[1] : void 0);
    }
  });
}, function (e, t, n) {
  var o = n(31),
    i = n(2);
  e.exports = "process" == o(i.process);
}, function (e, t) {
  e.exports = veRadio;
}, function (e, t, n) {
  var o = n(8),
    i = n(49),
    r = n(4)("species");
  e.exports = function (e, t) {
    var n;
    return i(e) && ("function" != typeof (n = e.constructor) || n !== Array && !i(n.prototype) ? o(n) && null === (n = n[r]) && (n = void 0) : n = void 0), new (void 0 === n ? Array : n)(0 === t ? 0 : t);
  };
}, function (e, t, n) {
  var o = n(2),
    i = n(78),
    r = o["__core-js_shared__"] || i("__core-js_shared__", {});
  e.exports = r;
}, function (e, t, n) {
  var o = n(2),
    i = n(19);
  e.exports = function (e, t) {
    try {
      i(o, e, t);
    } catch (n) {
      o[e] = t;
    }
    return t;
  };
}, function (e, t, n) {
  var o = n(2),
    i = n(8),
    r = o.document,
    l = i(r) && i(r.createElement);
  e.exports = function (e) {
    return l ? r.createElement(e) : {};
  };
}, function (e, t, n) {
  var o = n(52),
    i = n(3);
  e.exports = !!Object.getOwnPropertySymbols && !i(function () {
    return !String(Symbol()) || !Symbol.sham && o && o < 41;
  });
}, function (e, t, n) {
  var o = n(38);
  e.exports = o("navigator", "userAgent") || "";
}, function (e, t, n) {

  var o = n(3);
  e.exports = function (e, t) {
    var n = [][e];
    return !!n && o(function () {
      n.call(null, t || function () {
        throw 1;
      }, 1);
    });
  };
}, function (e, t, n) {
  var o = n(77),
    i = Function.toString;
  "function" != typeof o.inspectSource && (o.inspectSource = function (e) {
    return i.call(e);
  }), e.exports = o.inspectSource;
}, function (e, t, n) {
  var o = n(9),
    i = n(144);
  e.exports = Object.setPrototypeOf || ("__proto__" in {} ? function () {
    var e,
      t = !1,
      n = {};
    try {
      (e = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set).call(n, []), t = n instanceof Array;
    } catch (e) {}
    return function (n, r) {
      return o(n), i(r), t ? e.call(n, r) : n.__proto__ = r, n;
    };
  }() : void 0);
}, function (e, t) {
  e.exports = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
}, function (e, t) {
  t.f = Object.getOwnPropertySymbols;
}, function (e, t, n) {
  var o = {};
  o[n(4)("toStringTag")] = "z", e.exports = "[object z]" === String(o);
}, function (e, t, n) {

  var o = n(0),
    i = n(150),
    r = n(117),
    l = n(84),
    a = n(56),
    s = n(19),
    c = n(20),
    u = n(4),
    d = n(32),
    h = n(58),
    f = n(116),
    p = f.IteratorPrototype,
    y = f.BUGGY_SAFARI_ITERATORS,
    v = u("iterator"),
    g = function () {
      return this;
    };
  e.exports = function (e, t, n, u, f, m, w) {
    i(n, t, u);
    var C,
      b,
      x,
      R = function (e) {
        if (e === f && E) return E;
        if (!y && e in K) return K[e];
        switch (e) {
          case "keys":
          case "values":
          case "entries":
            return function () {
              return new n(this, e);
            };
        }
        return function () {
          return new n(this);
        };
      },
      S = t + " Iterator",
      O = !1,
      K = e.prototype,
      I = K[v] || K["@@iterator"] || f && K[f],
      E = !y && I || R(f),
      k = "Array" == t && K.entries || I;
    if (k && (C = r(k.call(new e())), p !== Object.prototype && C.next && (d || r(C) === p || (l ? l(C, p) : "function" != typeof C[v] && s(C, v, g)), a(C, S, !0, !0), d && (h[S] = g))), "values" == f && I && "values" !== I.name && (O = !0, E = function () {
      return I.call(this);
    }), d && !w || K[v] === E || s(K, v, E), h[t] = E, f) if (b = {
      values: R("values"),
      keys: m ? E : R("keys"),
      entries: R("entries")
    }, w) for (x in b) (y || O || !(x in K)) && c(K, x, b[x]);else o({
      target: t,
      proto: !0,
      forced: y || O
    }, b);
    return b;
  };
}, function (e, t, n) {
  var o = n(119);
  e.exports = function (e) {
    if (o(e)) throw TypeError("The method doesn't accept regular expressions");
    return e;
  };
}, function (e, t, n) {
  var o = n(4)("match");
  e.exports = function (e) {
    var t = /./;
    try {
      "/./"[e](t);
    } catch (n) {
      try {
        return t[o] = !1, "/./"[e](t);
      } catch (e) {}
    }
    return !1;
  };
}, function (e, t, n) {
  var o = n(0),
    i = n(3),
    r = n(18),
    l = n(22).f,
    a = n(11),
    s = i(function () {
      l(1);
    });
  o({
    target: "Object",
    stat: !0,
    forced: !a || s,
    sham: !a
  }, {
    getOwnPropertyDescriptor: function (e, t) {
      return l(r(e), t);
    }
  });
}, function (e, t, n) {
  var o = n(0),
    i = n(11),
    r = n(112),
    l = n(18),
    a = n(22),
    s = n(59);
  o({
    target: "Object",
    stat: !0,
    sham: !i
  }, {
    getOwnPropertyDescriptors: function (e) {
      for (var t, n, o = l(e), i = a.f, c = r(o), u = {}, d = 0; c.length > d;) void 0 !== (n = i(o, t = c[d++])) && s(u, t, n);
      return u;
    }
  });
}, function (e, t, n) {

  var o = n(94),
    i = n(9),
    r = n(13),
    l = n(48),
    a = n(17),
    s = n(95),
    c = n(153),
    u = n(96),
    d = Math.max,
    h = Math.min;
  o("replace", 2, function (e, t, n, o) {
    var f = o.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,
      p = o.REPLACE_KEEPS_$0,
      y = f ? "$" : "$0";
    return [function (n, o) {
      var i = a(this),
        r = null == n ? void 0 : n[e];
      return void 0 !== r ? r.call(n, i, o) : t.call(String(i), n, o);
    }, function (e, o) {
      if (!f && p || "string" == typeof o && -1 === o.indexOf(y)) {
        var a = n(t, e, this, o);
        if (a.done) return a.value;
      }
      var v = i(e),
        g = String(this),
        m = "function" == typeof o;
      m || (o = String(o));
      var w = v.global;
      if (w) {
        var C = v.unicode;
        v.lastIndex = 0;
      }
      for (var b = [];;) {
        var x = u(v, g);
        if (null === x) break;
        if (b.push(x), !w) break;
        "" === String(x[0]) && (v.lastIndex = s(g, r(v.lastIndex), C));
      }
      for (var R, S = "", O = 0, K = 0; K < b.length; K++) {
        x = b[K];
        for (var I = String(x[0]), E = d(h(l(x.index), g.length), 0), k = [], T = 1; T < x.length; T++) k.push(void 0 === (R = x[T]) ? R : String(R));
        var D = x.groups;
        if (m) {
          var _ = [I].concat(k, E, g);
          void 0 !== D && _.push(D);
          var A = String(o.apply(void 0, _));
        } else A = c(I, g, E, k, D, o);
        E >= O && (S += g.slice(O, E) + A, O = E + I.length);
      }
      return S + g.slice(O);
    }];
  });
}, function (e, t, n) {

  n(62);
  var o = n(20),
    i = n(72),
    r = n(3),
    l = n(4),
    a = n(19),
    s = l("species"),
    c = RegExp.prototype,
    u = !r(function () {
      var e = /./;
      return e.exec = function () {
        var e = [];
        return e.groups = {
          a: "7"
        }, e;
      }, "7" !== "".replace(e, "$<a>");
    }),
    d = "$0" === "a".replace(/./, "$0"),
    h = l("replace"),
    f = !!/./[h] && "" === /./[h]("a", "$0"),
    p = !r(function () {
      var e = /(?:)/,
        t = e.exec;
      e.exec = function () {
        return t.apply(this, arguments);
      };
      var n = "ab".split(e);
      return 2 !== n.length || "a" !== n[0] || "b" !== n[1];
    });
  e.exports = function (e, t, n, h) {
    var y = l(e),
      v = !r(function () {
        var t = {};
        return t[y] = function () {
          return 7;
        }, 7 != ""[e](t);
      }),
      g = v && !r(function () {
        var t = !1,
          n = /a/;
        return "split" === e && ((n = {}).constructor = {}, n.constructor[s] = function () {
          return n;
        }, n.flags = "", n[y] = /./[y]), n.exec = function () {
          return t = !0, null;
        }, n[y](""), !t;
      });
    if (!v || !g || "replace" === e && (!u || !d || f) || "split" === e && !p) {
      var m = /./[y],
        w = n(y, ""[e], function (e, t, n, o, r) {
          var l = t.exec;
          return l === i || l === c.exec ? v && !r ? {
            done: !0,
            value: m.call(t, n, o)
          } : {
            done: !0,
            value: e.call(n, t, o)
          } : {
            done: !1
          };
        }, {
          REPLACE_KEEPS_$0: d,
          REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: f
        }),
        C = w[0],
        b = w[1];
      o(String.prototype, e, C), o(c, y, 2 == t ? function (e, t) {
        return b.call(e, this, t);
      } : function (e) {
        return b.call(e, this);
      });
    }
    h && a(c[y], "sham", !0);
  };
}, function (e, t, n) {

  var o = n(118).charAt;
  e.exports = function (e, t, n) {
    return t + (n ? o(e, t).length : 1);
  };
}, function (e, t, n) {
  var o = n(31),
    i = n(72);
  e.exports = function (e, t) {
    var n = e.exec;
    if ("function" == typeof n) {
      var r = n.call(e, t);
      if ("object" != typeof r) throw TypeError("RegExp exec method returned something other than an Object or null");
      return r;
    }
    if ("RegExp" !== o(e)) throw TypeError("RegExp#exec called on incompatible receiver");
    return i.call(e, t);
  };
}, function (e, t, n) {

  var o = n(94),
    i = n(119),
    r = n(9),
    l = n(17),
    a = n(122),
    s = n(95),
    c = n(13),
    u = n(96),
    d = n(72),
    h = n(121).UNSUPPORTED_Y,
    f = [].push,
    p = Math.min;
  o("split", 2, function (e, t, n) {
    var o;
    return o = "c" == "abbc".split(/(b)*/)[1] || 4 != "test".split(/(?:)/, -1).length || 2 != "ab".split(/(?:ab)*/).length || 4 != ".".split(/(.?)(.?)/).length || ".".split(/()()/).length > 1 || "".split(/.?/).length ? function (e, n) {
      var o = String(l(this)),
        r = void 0 === n ? 4294967295 : n >>> 0;
      if (0 === r) return [];
      if (void 0 === e) return [o];
      if (!i(e)) return t.call(o, e, r);
      for (var a, s, c, u = [], h = (e.ignoreCase ? "i" : "") + (e.multiline ? "m" : "") + (e.unicode ? "u" : "") + (e.sticky ? "y" : ""), p = 0, y = new RegExp(e.source, h + "g"); (a = d.call(y, o)) && !((s = y.lastIndex) > p && (u.push(o.slice(p, a.index)), a.length > 1 && a.index < o.length && f.apply(u, a.slice(1)), c = a[0].length, p = s, u.length >= r));) y.lastIndex === a.index && y.lastIndex++;
      return p === o.length ? !c && y.test("") || u.push("") : u.push(o.slice(p)), u.length > r ? u.slice(0, r) : u;
    } : "0".split(void 0, 0).length ? function (e, n) {
      return void 0 === e && 0 === n ? [] : t.call(this, e, n);
    } : t, [function (t, n) {
      var i = l(this),
        r = null == t ? void 0 : t[e];
      return void 0 !== r ? r.call(t, i, n) : o.call(String(i), t, n);
    }, function (e, i) {
      var l = n(o, e, this, i, o !== t);
      if (l.done) return l.value;
      var d = r(e),
        f = String(this),
        y = a(d, RegExp),
        v = d.unicode,
        g = (d.ignoreCase ? "i" : "") + (d.multiline ? "m" : "") + (d.unicode ? "u" : "") + (h ? "g" : "y"),
        m = new y(h ? "^(?:" + d.source + ")" : d, g),
        w = void 0 === i ? 4294967295 : i >>> 0;
      if (0 === w) return [];
      if (0 === f.length) return null === u(m, f) ? [f] : [];
      for (var C = 0, b = 0, x = []; b < f.length;) {
        m.lastIndex = h ? 0 : b;
        var R,
          S = u(m, h ? f.slice(b) : f);
        if (null === S || (R = p(c(m.lastIndex + (h ? b : 0)), f.length)) === C) b = s(f, b, v);else {
          if (x.push(f.slice(C, b)), x.length === w) return x;
          for (var O = 1; O <= S.length - 1; O++) if (x.push(S[O]), x.length === w) return x;
          b = C = R;
        }
      }
      return x.push(f.slice(C)), x;
    }];
  }, h);
}, function (e, t, n) {

  var o = n(0),
    i = n(47),
    r = n(18),
    l = n(82),
    a = [].join,
    s = i != Object,
    c = l("join", ",");
  o({
    target: "Array",
    proto: !0,
    forced: s || !c
  }, {
    join: function (e) {
      return a.call(r(this), void 0 === e ? "," : e);
    }
  });
}, function (e, t, n) {
  var o = n(4)("iterator"),
    i = !1;
  try {
    var r = 0,
      l = {
        next: function () {
          return {
            done: !!r++
          };
        },
        return: function () {
          i = !0;
        }
      };
    l[o] = function () {
      return this;
    }, Array.from(l, function () {
      throw 2;
    });
  } catch (e) {}
  e.exports = function (e, t) {
    if (!t && !i) return !1;
    var n = !1;
    try {
      var r = {};
      r[o] = function () {
        return {
          next: function () {
            return {
              done: n = !0
            };
          }
        };
      }, e(r);
    } catch (e) {}
    return n;
  };
}, function (e, t, n) {
  var o = n(9),
    i = n(126),
    r = n(13),
    l = n(45),
    a = n(127),
    s = n(125),
    c = function (e, t) {
      this.stopped = e, this.result = t;
    };
  e.exports = function (e, t, n) {
    var u,
      d,
      h,
      f,
      p,
      y,
      v,
      g = n && n.that,
      m = !(!n || !n.AS_ENTRIES),
      w = !(!n || !n.IS_ITERATOR),
      C = !(!n || !n.INTERRUPTED),
      b = l(t, g, 1 + m + C),
      x = function (e) {
        return u && s(u), new c(!0, e);
      },
      R = function (e) {
        return m ? (o(e), C ? b(e[0], e[1], x) : b(e[0], e[1])) : C ? b(e, x) : b(e);
      };
    if (w) u = e;else {
      if ("function" != typeof (d = a(e))) throw TypeError("Target is not iterable");
      if (i(d)) {
        for (h = 0, f = r(e.length); f > h; h++) if ((p = R(e[h])) && p instanceof c) return p;
        return new c(!1);
      }
      u = d.call(e);
    }
    for (y = u.next; !(v = y.call(u)).done;) {
      try {
        p = R(v.value);
      } catch (e) {
        throw s(u), e;
      }
      if ("object" == typeof p && p && p instanceof c) return p;
    }
    return new c(!1);
  };
}, function (e, t) {
  e.exports = function (e, t, n) {
    if (!(e instanceof t)) throw TypeError("Incorrect " + (n ? n + " " : "") + "invocation");
    return e;
  };
}, function (e, t) {
  var n;
  n = function () {
    return this;
  }();
  try {
    n = n || new Function("return this")();
  } catch (e) {
    "object" == typeof window && (n = window);
  }
  e.exports = n;
}, function (e, t) {
  e.exports = {
    CSSRuleList: 0,
    CSSStyleDeclaration: 0,
    CSSValueList: 0,
    ClientRectList: 0,
    DOMRectList: 0,
    DOMStringList: 0,
    DOMTokenList: 1,
    DataTransferItemList: 0,
    FileList: 0,
    HTMLAllCollection: 0,
    HTMLCollection: 0,
    HTMLFormElement: 0,
    HTMLSelectElement: 0,
    MediaList: 0,
    MimeTypeArray: 0,
    NamedNodeMap: 0,
    NodeList: 1,
    PaintRequestList: 0,
    Plugin: 0,
    PluginArray: 0,
    SVGLengthList: 0,
    SVGNumberList: 0,
    SVGPathSegList: 0,
    SVGPointList: 0,
    SVGStringList: 0,
    SVGTransformList: 0,
    SourceBufferList: 0,
    StyleSheetList: 0,
    TextTrackCueList: 0,
    TextTrackList: 0,
    TouchList: 0
  };
}, function (e, t, n) {
  var o = n(11),
    i = n(3),
    r = n(79);
  e.exports = !o && !i(function () {
    return 7 != Object.defineProperty(r("div"), "a", {
      get: function () {
        return 7;
      }
    }).a;
  });
}, function (e, t, n) {
  var o = n(2);
  e.exports = o;
}, function (e, t, n) {
  var o = n(80);
  e.exports = o && !Symbol.sham && "symbol" == typeof Symbol.iterator;
}, function (e, t, n) {
  var o = n(8),
    i = n(84);
  e.exports = function (e, t, n) {
    var r, l;
    return i && "function" == typeof (r = t.constructor) && r !== n && o(l = r.prototype) && l !== n.prototype && i(e, l), e;
  };
}, function (e, t, n) {
  var o = n(15),
    i = n(18),
    r = n(109).indexOf,
    l = n(53);
  e.exports = function (e, t) {
    var n,
      a = i(e),
      s = 0,
      c = [];
    for (n in a) !o(l, n) && o(a, n) && c.push(n);
    for (; t.length > s;) o(a, n = t[s++]) && (~r(c, n) || c.push(n));
    return c;
  };
}, function (e, t, n) {
  var o = n(18),
    i = n(13),
    r = n(67),
    l = function (e) {
      return function (t, n, l) {
        var a,
          s = o(t),
          c = i(s.length),
          u = r(l, c);
        if (e && n != n) {
          for (; c > u;) if ((a = s[u++]) != a) return !0;
        } else for (; c > u; u++) if ((e || u in s) && s[u] === n) return e || u || 0;
        return !e && -1;
      };
    };
  e.exports = {
    includes: l(!0),
    indexOf: l(!1)
  };
}, function (e, t, n) {
  var o = n(38);
  e.exports = o("document", "documentElement");
}, function (e, t, n) {
  var o = n(15),
    i = n(112),
    r = n(22),
    l = n(14);
  e.exports = function (e, t) {
    for (var n = i(t), a = l.f, s = r.f, c = 0; c < n.length; c++) {
      var u = n[c];
      o(e, u) || a(e, u, s(t, u));
    }
  };
}, function (e, t, n) {
  var o = n(38),
    i = n(68),
    r = n(86),
    l = n(9);
  e.exports = o("Reflect", "ownKeys") || function (e) {
    var t = i.f(l(e)),
      n = r.f;
    return n ? t.concat(n(e)) : t;
  };
}, function (e, t, n) {
  var o = n(4);
  t.f = o;
}, function (e, t, n) {
  var o = n(105),
    i = n(15),
    r = n(113),
    l = n(14).f;
  e.exports = function (e) {
    var t = o.Symbol || (o.Symbol = {});
    i(t, e) || l(t, e, {
      value: r.f(e)
    });
  };
}, function (e, t, n) {
  var o = n(87),
    i = n(31),
    r = n(4)("toStringTag"),
    l = "Arguments" == i(function () {
      return arguments;
    }());
  e.exports = o ? i : function (e) {
    var t, n, o;
    return void 0 === e ? "Undefined" : null === e ? "Null" : "string" == typeof (n = function (e, t) {
      try {
        return e[t];
      } catch (e) {}
    }(t = Object(e), r)) ? n : l ? i(t) : "Object" == (o = i(t)) && "function" == typeof t.callee ? "Arguments" : o;
  };
}, function (e, t, n) {

  var o,
    i,
    r,
    l = n(3),
    a = n(117),
    s = n(19),
    c = n(15),
    u = n(4),
    d = n(32),
    h = u("iterator"),
    f = !1;
  [].keys && ("next" in (r = [].keys()) ? (i = a(a(r))) !== Object.prototype && (o = i) : f = !0);
  var p = null == o || l(function () {
    var e = {};
    return o[h].call(e) !== e;
  });
  p && (o = {}), d && !p || c(o, h) || s(o, h, function () {
    return this;
  }), e.exports = {
    IteratorPrototype: o,
    BUGGY_SAFARI_ITERATORS: f
  };
}, function (e, t, n) {
  var o = n(15),
    i = n(16),
    r = n(66),
    l = n(151),
    a = r("IE_PROTO"),
    s = Object.prototype;
  e.exports = l ? Object.getPrototypeOf : function (e) {
    return e = i(e), o(e, a) ? e[a] : "function" == typeof e.constructor && e instanceof e.constructor ? e.constructor.prototype : e instanceof Object ? s : null;
  };
}, function (e, t, n) {
  var o = n(48),
    i = n(17),
    r = function (e) {
      return function (t, n) {
        var r,
          l,
          a = String(i(t)),
          s = o(n),
          c = a.length;
        return s < 0 || s >= c ? e ? "" : void 0 : (r = a.charCodeAt(s)) < 55296 || r > 56319 || s + 1 === c || (l = a.charCodeAt(s + 1)) < 56320 || l > 57343 ? e ? a.charAt(s) : r : e ? a.slice(s, s + 2) : l - 56320 + (r - 55296 << 10) + 65536;
      };
    };
  e.exports = {
    codeAt: r(!1),
    charAt: r(!0)
  };
}, function (e, t, n) {
  var o = n(8),
    i = n(31),
    r = n(4)("match");
  e.exports = function (e) {
    var t;
    return o(e) && (void 0 !== (t = e[r]) ? !!t : "RegExp" == i(e));
  };
}, function (e, t, n) {

  var o = n(9);
  e.exports = function () {
    var e = o(this),
      t = "";
    return e.global && (t += "g"), e.ignoreCase && (t += "i"), e.multiline && (t += "m"), e.dotAll && (t += "s"), e.unicode && (t += "u"), e.sticky && (t += "y"), t;
  };
}, function (e, t, n) {

  var o = n(3);
  function i(e, t) {
    return RegExp(e, t);
  }
  t.UNSUPPORTED_Y = o(function () {
    var e = i("a", "y");
    return e.lastIndex = 2, null != e.exec("abcd");
  }), t.BROKEN_CARET = o(function () {
    var e = i("^r", "gy");
    return e.lastIndex = 2, null != e.exec("str");
  });
}, function (e, t, n) {
  var o = n(9),
    i = n(46),
    r = n(4)("species");
  e.exports = function (e, t) {
    var n,
      l = o(e).constructor;
    return void 0 === l || null == (n = o(l)[r]) ? t : i(n);
  };
}, function (e, t, n) {
  var o = n(0),
    i = n(156).values;
  o({
    target: "Object",
    stat: !0
  }, {
    values: function (e) {
      return i(e);
    }
  });
}, function (e, t, n) {
  var o = n(0),
    i = n(160);
  o({
    target: "Array",
    stat: !0,
    forced: !n(99)(function (e) {
      Array.from(e);
    })
  }, {
    from: i
  });
}, function (e, t, n) {
  var o = n(9);
  e.exports = function (e) {
    var t = e.return;
    if (void 0 !== t) return o(t.call(e)).value;
  };
}, function (e, t, n) {
  var o = n(4),
    i = n(58),
    r = o("iterator"),
    l = Array.prototype;
  e.exports = function (e) {
    return void 0 !== e && (i.Array === e || l[r] === e);
  };
}, function (e, t, n) {
  var o = n(115),
    i = n(58),
    r = n(4)("iterator");
  e.exports = function (e) {
    if (null != e) return e[r] || e["@@iterator"] || i[o(e)];
  };
}, function (e, t, n) {

  var o = n(0),
    i = n(2),
    r = n(65),
    l = n(20),
    a = n(129),
    s = n(100),
    c = n(101),
    u = n(8),
    d = n(3),
    h = n(99),
    f = n(56),
    p = n(107);
  e.exports = function (e, t, n) {
    var y = -1 !== e.indexOf("Map"),
      v = -1 !== e.indexOf("Weak"),
      g = y ? "set" : "add",
      m = i[e],
      w = m && m.prototype,
      C = m,
      b = {},
      x = function (e) {
        var t = w[e];
        l(w, e, "add" == e ? function (e) {
          return t.call(this, 0 === e ? 0 : e), this;
        } : "delete" == e ? function (e) {
          return !(v && !u(e)) && t.call(this, 0 === e ? 0 : e);
        } : "get" == e ? function (e) {
          return v && !u(e) ? void 0 : t.call(this, 0 === e ? 0 : e);
        } : "has" == e ? function (e) {
          return !(v && !u(e)) && t.call(this, 0 === e ? 0 : e);
        } : function (e, n) {
          return t.call(this, 0 === e ? 0 : e, n), this;
        });
      };
    if (r(e, "function" != typeof m || !(v || w.forEach && !d(function () {
      new m().entries().next();
    })))) C = n.getConstructor(t, e, y, g), a.REQUIRED = !0;else if (r(e, !0)) {
      var R = new C(),
        S = R[g](v ? {} : -0, 1) != R,
        O = d(function () {
          R.has(1);
        }),
        K = h(function (e) {
          new m(e);
        }),
        I = !v && d(function () {
          for (var e = new m(), t = 5; t--;) e[g](t, t);
          return !e.has(-0);
        });
      K || ((C = t(function (t, n) {
        c(t, C, e);
        var o = p(new m(), t, C);
        return null != n && s(n, o[g], {
          that: o,
          AS_ENTRIES: y
        }), o;
      })).prototype = w, w.constructor = C), (O || I) && (x("delete"), x("has"), y && x("get")), (I || S) && x(g), v && w.clear && delete w.clear;
    }
    return b[e] = C, o({
      global: !0,
      forced: C != m
    }, b), f(C, e), v || n.setStrong(C, e, y), C;
  };
}, function (e, t, n) {
  var o = n(53),
    i = n(8),
    r = n(15),
    l = n(14).f,
    a = n(64),
    s = n(163),
    c = a("meta"),
    u = 0,
    d = Object.isExtensible || function () {
      return !0;
    },
    h = function (e) {
      l(e, c, {
        value: {
          objectID: "O" + ++u,
          weakData: {}
        }
      });
    },
    f = e.exports = {
      REQUIRED: !1,
      fastKey: function (e, t) {
        if (!i(e)) return "symbol" == typeof e ? e : ("string" == typeof e ? "S" : "P") + e;
        if (!r(e, c)) {
          if (!d(e)) return "F";
          if (!t) return "E";
          h(e);
        }
        return e[c].objectID;
      },
      getWeakData: function (e, t) {
        if (!r(e, c)) {
          if (!d(e)) return !0;
          if (!t) return !1;
          h(e);
        }
        return e[c].weakData;
      },
      onFreeze: function (e) {
        return s && f.REQUIRED && d(e) && !r(e, c) && h(e), e;
      }
    };
  o[c] = !0;
}, function (e, t, n) {

  var o = n(14).f,
    i = n(54),
    r = n(131),
    l = n(45),
    a = n(101),
    s = n(100),
    c = n(88),
    u = n(132),
    d = n(11),
    h = n(129).fastKey,
    f = n(39),
    p = f.set,
    y = f.getterFor;
  e.exports = {
    getConstructor: function (e, t, n, c) {
      var u = e(function (e, o) {
          a(e, u, t), p(e, {
            type: t,
            index: i(null),
            first: void 0,
            last: void 0,
            size: 0
          }), d || (e.size = 0), null != o && s(o, e[c], {
            that: e,
            AS_ENTRIES: n
          });
        }),
        f = y(t),
        v = function (e, t, n) {
          var o,
            i,
            r = f(e),
            l = g(e, t);
          return l ? l.value = n : (r.last = l = {
            index: i = h(t, !0),
            key: t,
            value: n,
            previous: o = r.last,
            next: void 0,
            removed: !1
          }, r.first || (r.first = l), o && (o.next = l), d ? r.size++ : e.size++, "F" !== i && (r.index[i] = l)), e;
        },
        g = function (e, t) {
          var n,
            o = f(e),
            i = h(t);
          if ("F" !== i) return o.index[i];
          for (n = o.first; n; n = n.next) if (n.key == t) return n;
        };
      return r(u.prototype, {
        clear: function () {
          for (var e = f(this), t = e.index, n = e.first; n;) n.removed = !0, n.previous && (n.previous = n.previous.next = void 0), delete t[n.index], n = n.next;
          e.first = e.last = void 0, d ? e.size = 0 : this.size = 0;
        },
        delete: function (e) {
          var t = f(this),
            n = g(this, e);
          if (n) {
            var o = n.next,
              i = n.previous;
            delete t.index[n.index], n.removed = !0, i && (i.next = o), o && (o.previous = i), t.first == n && (t.first = o), t.last == n && (t.last = i), d ? t.size-- : this.size--;
          }
          return !!n;
        },
        forEach: function (e) {
          for (var t, n = f(this), o = l(e, arguments.length > 1 ? arguments[1] : void 0, 3); t = t ? t.next : n.first;) for (o(t.value, t.key, this); t && t.removed;) t = t.previous;
        },
        has: function (e) {
          return !!g(this, e);
        }
      }), r(u.prototype, n ? {
        get: function (e) {
          var t = g(this, e);
          return t && t.value;
        },
        set: function (e, t) {
          return v(this, 0 === e ? 0 : e, t);
        }
      } : {
        add: function (e) {
          return v(this, e = 0 === e ? 0 : e, e);
        }
      }), d && o(u.prototype, "size", {
        get: function () {
          return f(this).size;
        }
      }), u;
    },
    setStrong: function (e, t, n) {
      var o = t + " Iterator",
        i = y(t),
        r = y(o);
      c(e, t, function (e, t) {
        p(this, {
          type: o,
          target: e,
          state: i(e),
          kind: t,
          last: void 0
        });
      }, function () {
        for (var e = r(this), t = e.kind, n = e.last; n && n.removed;) n = n.previous;
        return e.target && (e.last = n = n ? n.next : e.state.first) ? "keys" == t ? {
          value: n.key,
          done: !1
        } : "values" == t ? {
          value: n.value,
          done: !1
        } : {
          value: [n.key, n.value],
          done: !1
        } : (e.target = void 0, {
          value: void 0,
          done: !0
        });
      }, n ? "entries" : "values", !n, !0), u(t);
    }
  };
}, function (e, t, n) {
  var o = n(20);
  e.exports = function (e, t, n) {
    for (var i in t) o(e, i, t[i], n);
    return e;
  };
}, function (e, t, n) {

  var o = n(38),
    i = n(14),
    r = n(4),
    l = n(11),
    a = r("species");
  e.exports = function (e) {
    var t = o(e),
      n = i.f;
    l && t && !t[a] && n(t, a, {
      configurable: !0,
      get: function () {
        return this;
      }
    });
  };
}, function (e, t, n) {
  var o,
    i,
    r,
    l = n(2),
    a = n(3),
    s = n(45),
    c = n(110),
    u = n(79),
    d = n(134),
    h = n(74),
    f = l.location,
    p = l.setImmediate,
    y = l.clearImmediate,
    v = l.process,
    g = l.MessageChannel,
    m = l.Dispatch,
    w = 0,
    C = {},
    b = function (e) {
      if (C.hasOwnProperty(e)) {
        var t = C[e];
        delete C[e], t();
      }
    },
    x = function (e) {
      return function () {
        b(e);
      };
    },
    R = function (e) {
      b(e.data);
    },
    S = function (e) {
      l.postMessage(e + "", f.protocol + "//" + f.host);
    };
  p && y || (p = function (e) {
    for (var t = [], n = 1; arguments.length > n;) t.push(arguments[n++]);
    return C[++w] = function () {
      ("function" == typeof e ? e : Function(e)).apply(void 0, t);
    }, o(w), w;
  }, y = function (e) {
    delete C[e];
  }, h ? o = function (e) {
    v.nextTick(x(e));
  } : m && m.now ? o = function (e) {
    m.now(x(e));
  } : g && !d ? (r = (i = new g()).port2, i.port1.onmessage = R, o = s(r.postMessage, r, 1)) : l.addEventListener && "function" == typeof postMessage && !l.importScripts && f && "file:" !== f.protocol && !a(S) ? (o = S, l.addEventListener("message", R, !1)) : o = "onreadystatechange" in u("script") ? function (e) {
    c.appendChild(u("script")).onreadystatechange = function () {
      c.removeChild(this), b(e);
    };
  } : function (e) {
    setTimeout(x(e), 0);
  }), e.exports = {
    set: p,
    clear: y
  };
}, function (e, t, n) {
  var o = n(81);
  e.exports = /(?:iphone|ipod|ipad).*applewebkit/i.test(o);
}, function (e, t, n) {

  var o = n(46),
    i = function (e) {
      var t, n;
      this.promise = new e(function (e, o) {
        if (void 0 !== t || void 0 !== n) throw TypeError("Bad Promise constructor");
        t = e, n = o;
      }), this.resolve = o(t), this.reject = o(n);
    };
  e.exports.f = function (e) {
    return new i(e);
  };
}, function (e, t) {
  e.exports = veLocale;
}, function (e, t) {
  e.exports = enUS;
}, function (e, t) {
  e.exports = veSelect;
}, function (e, t, n) {

  (function (e) {
    var n = function () {
        if ("undefined" != typeof Map) return Map;
        function e(e, t) {
          var n = -1;
          return e.some(function (e, o) {
            return e[0] === t && (n = o, !0);
          }), n;
        }
        return function () {
          function t() {
            this.__entries__ = [];
          }
          return Object.defineProperty(t.prototype, "size", {
            get: function () {
              return this.__entries__.length;
            },
            enumerable: !0,
            configurable: !0
          }), t.prototype.get = function (t) {
            var n = e(this.__entries__, t),
              o = this.__entries__[n];
            return o && o[1];
          }, t.prototype.set = function (t, n) {
            var o = e(this.__entries__, t);
            ~o ? this.__entries__[o][1] = n : this.__entries__.push([t, n]);
          }, t.prototype.delete = function (t) {
            var n = this.__entries__,
              o = e(n, t);
            ~o && n.splice(o, 1);
          }, t.prototype.has = function (t) {
            return !!~e(this.__entries__, t);
          }, t.prototype.clear = function () {
            this.__entries__.splice(0);
          }, t.prototype.forEach = function (e, t) {
            void 0 === t && (t = null);
            for (var n = 0, o = this.__entries__; n < o.length; n++) {
              var i = o[n];
              e.call(t, i[1], i[0]);
            }
          }, t;
        }();
      }(),
      o = "undefined" != typeof window && "undefined" != typeof document && window.document === document,
      i = void 0 !== e && e.Math === Math ? e : "undefined" != typeof self && self.Math === Math ? self : "undefined" != typeof window && window.Math === Math ? window : Function("return this")(),
      r = "function" == typeof requestAnimationFrame ? requestAnimationFrame.bind(i) : function (e) {
        return setTimeout(function () {
          return e(Date.now());
        }, 1e3 / 60);
      };
    var l = ["top", "right", "bottom", "left", "width", "height", "size", "weight"],
      a = "undefined" != typeof MutationObserver,
      s = function () {
        function e() {
          this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = function (e, t) {
            var n = !1,
              o = !1,
              i = 0;
            function l() {
              n && (n = !1, e()), o && s();
            }
            function a() {
              r(l);
            }
            function s() {
              var e = Date.now();
              if (n) {
                if (e - i < 2) return;
                o = !0;
              } else n = !0, o = !1, setTimeout(a, t);
              i = e;
            }
            return s;
          }(this.refresh.bind(this), 20);
        }
        return e.prototype.addObserver = function (e) {
          ~this.observers_.indexOf(e) || this.observers_.push(e), this.connected_ || this.connect_();
        }, e.prototype.removeObserver = function (e) {
          var t = this.observers_,
            n = t.indexOf(e);
          ~n && t.splice(n, 1), !t.length && this.connected_ && this.disconnect_();
        }, e.prototype.refresh = function () {
          this.updateObservers_() && this.refresh();
        }, e.prototype.updateObservers_ = function () {
          var e = this.observers_.filter(function (e) {
            return e.gatherActive(), e.hasActive();
          });
          return e.forEach(function (e) {
            return e.broadcastActive();
          }), e.length > 0;
        }, e.prototype.connect_ = function () {
          o && !this.connected_ && (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), a ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
            attributes: !0,
            childList: !0,
            characterData: !0,
            subtree: !0
          })) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
        }, e.prototype.disconnect_ = function () {
          o && this.connected_ && (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
        }, e.prototype.onTransitionEnd_ = function (e) {
          var t = e.propertyName,
            n = void 0 === t ? "" : t;
          l.some(function (e) {
            return !!~n.indexOf(e);
          }) && this.refresh();
        }, e.getInstance = function () {
          return this.instance_ || (this.instance_ = new e()), this.instance_;
        }, e.instance_ = null, e;
      }(),
      c = function (e, t) {
        for (var n = 0, o = Object.keys(t); n < o.length; n++) {
          var i = o[n];
          Object.defineProperty(e, i, {
            value: t[i],
            enumerable: !1,
            writable: !1,
            configurable: !0
          });
        }
        return e;
      },
      u = function (e) {
        return e && e.ownerDocument && e.ownerDocument.defaultView || i;
      },
      d = g(0, 0, 0, 0);
    function h(e) {
      return parseFloat(e) || 0;
    }
    function f(e) {
      for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
      return t.reduce(function (t, n) {
        return t + h(e["border-" + n + "-width"]);
      }, 0);
    }
    function p(e) {
      var t = e.clientWidth,
        n = e.clientHeight;
      if (!t && !n) return d;
      var o = u(e).getComputedStyle(e),
        i = function (e) {
          for (var t = {}, n = 0, o = ["top", "right", "bottom", "left"]; n < o.length; n++) {
            var i = o[n],
              r = e["padding-" + i];
            t[i] = h(r);
          }
          return t;
        }(o),
        r = i.left + i.right,
        l = i.top + i.bottom,
        a = h(o.width),
        s = h(o.height);
      if ("border-box" === o.boxSizing && (Math.round(a + r) !== t && (a -= f(o, "left", "right") + r), Math.round(s + l) !== n && (s -= f(o, "top", "bottom") + l)), !function (e) {
        return e === u(e).document.documentElement;
      }(e)) {
        var c = Math.round(a + r) - t,
          p = Math.round(s + l) - n;
        1 !== Math.abs(c) && (a -= c), 1 !== Math.abs(p) && (s -= p);
      }
      return g(i.left, i.top, a, s);
    }
    var y = "undefined" != typeof SVGGraphicsElement ? function (e) {
      return e instanceof u(e).SVGGraphicsElement;
    } : function (e) {
      return e instanceof u(e).SVGElement && "function" == typeof e.getBBox;
    };
    function v(e) {
      return o ? y(e) ? function (e) {
        var t = e.getBBox();
        return g(0, 0, t.width, t.height);
      }(e) : p(e) : d;
    }
    function g(e, t, n, o) {
      return {
        x: e,
        y: t,
        width: n,
        height: o
      };
    }
    var m = function () {
        function e(e) {
          this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = g(0, 0, 0, 0), this.target = e;
        }
        return e.prototype.isActive = function () {
          var e = v(this.target);
          return this.contentRect_ = e, e.width !== this.broadcastWidth || e.height !== this.broadcastHeight;
        }, e.prototype.broadcastRect = function () {
          var e = this.contentRect_;
          return this.broadcastWidth = e.width, this.broadcastHeight = e.height, e;
        }, e;
      }(),
      w = function (e, t) {
        var n,
          o,
          i,
          r,
          l,
          a,
          s,
          u = (o = (n = t).x, i = n.y, r = n.width, l = n.height, a = "undefined" != typeof DOMRectReadOnly ? DOMRectReadOnly : Object, s = Object.create(a.prototype), c(s, {
            x: o,
            y: i,
            width: r,
            height: l,
            top: i,
            right: o + r,
            bottom: l + i,
            left: o
          }), s);
        c(this, {
          target: e,
          contentRect: u
        });
      },
      C = function () {
        function e(e, t, o) {
          if (this.activeObservations_ = [], this.observations_ = new n(), "function" != typeof e) throw new TypeError("The callback provided as parameter 1 is not a function.");
          this.callback_ = e, this.controller_ = t, this.callbackCtx_ = o;
        }
        return e.prototype.observe = function (e) {
          if (!arguments.length) throw new TypeError("1 argument required, but only 0 present.");
          if ("undefined" != typeof Element && Element instanceof Object) {
            if (!(e instanceof u(e).Element)) throw new TypeError('parameter 1 is not of type "Element".');
            var t = this.observations_;
            t.has(e) || (t.set(e, new m(e)), this.controller_.addObserver(this), this.controller_.refresh());
          }
        }, e.prototype.unobserve = function (e) {
          if (!arguments.length) throw new TypeError("1 argument required, but only 0 present.");
          if ("undefined" != typeof Element && Element instanceof Object) {
            if (!(e instanceof u(e).Element)) throw new TypeError('parameter 1 is not of type "Element".');
            var t = this.observations_;
            t.has(e) && (t.delete(e), t.size || this.controller_.removeObserver(this));
          }
        }, e.prototype.disconnect = function () {
          this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
        }, e.prototype.gatherActive = function () {
          var e = this;
          this.clearActive(), this.observations_.forEach(function (t) {
            t.isActive() && e.activeObservations_.push(t);
          });
        }, e.prototype.broadcastActive = function () {
          if (this.hasActive()) {
            var e = this.callbackCtx_,
              t = this.activeObservations_.map(function (e) {
                return new w(e.target, e.broadcastRect());
              });
            this.callback_.call(e, t, e), this.clearActive();
          }
        }, e.prototype.clearActive = function () {
          this.activeObservations_.splice(0);
        }, e.prototype.hasActive = function () {
          return this.activeObservations_.length > 0;
        }, e;
      }(),
      b = "undefined" != typeof WeakMap ? new WeakMap() : new n(),
      x = function e(t) {
        if (!(this instanceof e)) throw new TypeError("Cannot call a class as a function.");
        if (!arguments.length) throw new TypeError("1 argument required, but only 0 present.");
        var n = s.getInstance(),
          o = new C(t, n, this);
        b.set(this, o);
      };
    ["observe", "unobserve", "disconnect"].forEach(function (e) {
      x.prototype[e] = function () {
        var t;
        return (t = b.get(this))[e].apply(t, arguments);
      };
    });
    var R = void 0 !== i.ResizeObserver ? i.ResizeObserver : x;
    t.a = R;
  }).call(this, n(102));
}, function (e, t) {
  e.exports = veContextmenu;
}, function (e, t, n) {
  e.exports = n(178);
}, function (e, t, n) {

  var o = n(37).forEach,
    i = n(82)("forEach");
  e.exports = i ? [].forEach : function (e) {
    return o(this, e, arguments.length > 1 ? arguments[1] : void 0);
  };
}, function (e, t, n) {
  var o = n(2),
    i = n(83),
    r = o.WeakMap;
  e.exports = "function" == typeof r && /native code/.test(i(r));
}, function (e, t, n) {
  var o = n(8);
  e.exports = function (e) {
    if (!o(e) && null !== e) throw TypeError("Can't set " + String(e) + " as a prototype");
    return e;
  };
}, function (e, t, n) {
  var o = n(11),
    i = n(14),
    r = n(9),
    l = n(55);
  e.exports = o ? Object.defineProperties : function (e, t) {
    r(e);
    for (var n, o = l(t), a = o.length, s = 0; a > s;) i.f(e, n = o[s++], t[n]);
    return e;
  };
}, function (e, t, n) {
  var o = n(17),
    i = "[" + n(147) + "]",
    r = RegExp("^" + i + i + "*"),
    l = RegExp(i + i + "*$"),
    a = function (e) {
      return function (t) {
        var n = String(o(t));
        return 1 & e && (n = n.replace(r, "")), 2 & e && (n = n.replace(l, "")), n;
      };
    };
  e.exports = {
    start: a(1),
    end: a(2),
    trim: a(3)
  };
}, function (e, t) {
  e.exports = "\t\n\v\f\r                　\u2028\u2029\ufeff";
}, function (e, t, n) {
  var o = n(18),
    i = n(68).f,
    r = {}.toString,
    l = "object" == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  e.exports.f = function (e) {
    return l && "[object Window]" == r.call(e) ? function (e) {
      try {
        return i(e);
      } catch (e) {
        return l.slice();
      }
    }(e) : i(o(e));
  };
}, function (e, t, n) {

  var o = n(87),
    i = n(115);
  e.exports = o ? {}.toString : function () {
    return "[object " + i(this) + "]";
  };
}, function (e, t, n) {

  var o = n(116).IteratorPrototype,
    i = n(54),
    r = n(51),
    l = n(56),
    a = n(58),
    s = function () {
      return this;
    };
  e.exports = function (e, t, n) {
    var c = t + " Iterator";
    return e.prototype = i(o, {
      next: r(1, n)
    }), l(e, c, !1, !0), a[c] = s, e;
  };
}, function (e, t, n) {
  var o = n(3);
  e.exports = !o(function () {
    function e() {}
    return e.prototype.constructor = null, Object.getPrototypeOf(new e()) !== e.prototype;
  });
}, function (e, t, n) {

  var o = n(0),
    i = n(49),
    r = [].reverse,
    l = [1, 2];
  o({
    target: "Array",
    proto: !0,
    forced: String(l) === String(l.reverse())
  }, {
    reverse: function () {
      return i(this) && (this.length = this.length), r.call(this);
    }
  });
}, function (e, t, n) {
  var o = n(16),
    i = Math.floor,
    r = "".replace,
    l = /\$([$&'`]|\d{1,2}|<[^>]*>)/g,
    a = /\$([$&'`]|\d{1,2})/g;
  e.exports = function (e, t, n, s, c, u) {
    var d = n + e.length,
      h = s.length,
      f = a;
    return void 0 !== c && (c = o(c), f = l), r.call(u, f, function (o, r) {
      var l;
      switch (r.charAt(0)) {
        case "$":
          return "$";
        case "&":
          return e;
        case "`":
          return t.slice(0, n);
        case "'":
          return t.slice(d);
        case "<":
          l = c[r.slice(1, -1)];
          break;
        default:
          var a = +r;
          if (0 === a) return o;
          if (a > h) {
            var u = i(a / 10);
            return 0 === u ? o : u <= h ? void 0 === s[u - 1] ? r.charAt(1) : s[u - 1] + r.charAt(1) : o;
          }
          l = s[a - 1];
      }
      return void 0 === l ? "" : l;
    });
  };
}, function (e, t, n) {

  var o = n(20),
    i = n(9),
    r = n(3),
    l = n(120),
    a = RegExp.prototype,
    s = a.toString,
    c = r(function () {
      return "/a/b" != s.call({
        source: "a",
        flags: "b"
      });
    }),
    u = "toString" != s.name;
  (c || u) && o(RegExp.prototype, "toString", function () {
    var e = i(this),
      t = String(e.source),
      n = e.flags;
    return "/" + t + "/" + String(void 0 === n && e instanceof RegExp && !("flags" in a) ? l.call(e) : n);
  }, {
    unsafe: !0
  });
}, function (e, t, n) {

  var o = n(11),
    i = n(3),
    r = n(55),
    l = n(86),
    a = n(69),
    s = n(16),
    c = n(47),
    u = Object.assign,
    d = Object.defineProperty;
  e.exports = !u || i(function () {
    if (o && 1 !== u({
      b: 1
    }, u(d({}, "a", {
      enumerable: !0,
      get: function () {
        d(this, "b", {
          value: 3,
          enumerable: !1
        });
      }
    }), {
      b: 2
    })).b) return !0;
    var e = {},
      t = {},
      n = Symbol();
    return e[n] = 7, "abcdefghijklmnopqrst".split("").forEach(function (e) {
      t[e] = e;
    }), 7 != u({}, e)[n] || "abcdefghijklmnopqrst" != r(u({}, t)).join("");
  }) ? function (e, t) {
    for (var n = s(e), i = arguments.length, u = 1, d = l.f, h = a.f; i > u;) for (var f, p = c(arguments[u++]), y = d ? r(p).concat(d(p)) : r(p), v = y.length, g = 0; v > g;) f = y[g++], o && !h.call(p, f) || (n[f] = p[f]);
    return n;
  } : u;
}, function (e, t, n) {
  var o = n(11),
    i = n(55),
    r = n(18),
    l = n(69).f,
    a = function (e) {
      return function (t) {
        for (var n, a = r(t), s = i(a), c = s.length, u = 0, d = []; c > u;) n = s[u++], o && !l.call(a, n) || d.push(e ? [n, a[n]] : a[n]);
        return d;
      };
    };
  e.exports = {
    entries: a(!0),
    values: a(!1)
  };
}, function (e, t, n) {
  var o = n(17),
    i = /"/g;
  e.exports = function (e, t, n, r) {
    var l = String(o(e)),
      a = "<" + t;
    return "" !== n && (a += " " + n + '="' + String(r).replace(i, "&quot;") + '"'), a + ">" + l + "</" + t + ">";
  };
}, function (e, t, n) {
  var o = n(3);
  e.exports = function (e) {
    return o(function () {
      var t = ""[e]('"');
      return t !== t.toLowerCase() || t.split('"').length > 3;
    });
  };
}, function (e, t, n) {
  var o = n(46),
    i = n(16),
    r = n(47),
    l = n(13),
    a = function (e) {
      return function (t, n, a, s) {
        o(n);
        var c = i(t),
          u = r(c),
          d = l(c.length),
          h = e ? d - 1 : 0,
          f = e ? -1 : 1;
        if (a < 2) for (;;) {
          if (h in u) {
            s = u[h], h += f;
            break;
          }
          if (h += f, e ? h < 0 : d <= h) throw TypeError("Reduce of empty array with no initial value");
        }
        for (; e ? h >= 0 : d > h; h += f) h in u && (s = n(s, u[h], h, c));
        return s;
      };
    };
  e.exports = {
    left: a(!1),
    right: a(!0)
  };
}, function (e, t, n) {

  var o = n(45),
    i = n(16),
    r = n(161),
    l = n(126),
    a = n(13),
    s = n(59),
    c = n(127);
  e.exports = function (e) {
    var t,
      n,
      u,
      d,
      h,
      f,
      p = i(e),
      y = "function" == typeof this ? this : Array,
      v = arguments.length,
      g = v > 1 ? arguments[1] : void 0,
      m = void 0 !== g,
      w = c(p),
      C = 0;
    if (m && (g = o(g, v > 2 ? arguments[2] : void 0, 2)), null == w || y == Array && l(w)) for (n = new y(t = a(p.length)); t > C; C++) f = m ? g(p[C], C) : p[C], s(n, C, f);else for (h = (d = w.call(p)).next, n = new y(); !(u = h.call(d)).done; C++) f = m ? r(d, g, [u.value, C], !0) : u.value, s(n, C, f);
    return n.length = C, n;
  };
}, function (e, t, n) {
  var o = n(9),
    i = n(125);
  e.exports = function (e, t, n, r) {
    try {
      return r ? t(o(n)[0], n[1]) : t(n);
    } catch (t) {
      throw i(e), t;
    }
  };
}, function (e, t, n) {

  var o = n(128),
    i = n(130);
  e.exports = o("Set", function (e) {
    return function () {
      return e(this, arguments.length ? arguments[0] : void 0);
    };
  }, i);
}, function (e, t, n) {
  var o = n(3);
  e.exports = !o(function () {
    return Object.isExtensible(Object.preventExtensions({}));
  });
}, function (e, t, n) {

  var o,
    i = n(0),
    r = n(22).f,
    l = n(13),
    a = n(89),
    s = n(17),
    c = n(90),
    u = n(32),
    d = "".endsWith,
    h = Math.min,
    f = c("endsWith");
  i({
    target: "String",
    proto: !0,
    forced: !!(u || f || (o = r(String.prototype, "endsWith"), !o || o.writable)) && !f
  }, {
    endsWith: function (e) {
      var t = String(s(this));
      a(e);
      var n = arguments.length > 1 ? arguments[1] : void 0,
        o = l(t.length),
        i = void 0 === n ? o : h(l(n), o),
        r = String(e);
      return d ? d.call(t, r, i) : t.slice(i - r.length, i) === r;
    }
  });
}, function (e, t, n) {

  var o = n(94),
    i = n(9),
    r = n(13),
    l = n(17),
    a = n(95),
    s = n(96);
  o("match", 1, function (e, t, n) {
    return [function (t) {
      var n = l(this),
        o = null == t ? void 0 : t[e];
      return void 0 !== o ? o.call(t, n) : new RegExp(t)[e](String(n));
    }, function (e) {
      var o = n(t, e, this);
      if (o.done) return o.value;
      var l = i(e),
        c = String(this);
      if (!l.global) return s(l, c);
      var u = l.unicode;
      l.lastIndex = 0;
      for (var d, h = [], f = 0; null !== (d = s(l, c));) {
        var p = String(d[0]);
        h[f] = p, "" === p && (l.lastIndex = a(c, r(l.lastIndex), u)), f++;
      }
      return 0 === f ? null : h;
    }];
  });
}, function (e, t, n) {

  var o,
    i = n(0),
    r = n(22).f,
    l = n(13),
    a = n(89),
    s = n(17),
    c = n(90),
    u = n(32),
    d = "".startsWith,
    h = Math.min,
    f = c("startsWith");
  i({
    target: "String",
    proto: !0,
    forced: !!(u || f || (o = r(String.prototype, "startsWith"), !o || o.writable)) && !f
  }, {
    startsWith: function (e) {
      var t = String(s(this));
      a(e);
      var n = l(h(arguments.length > 1 ? arguments[1] : void 0, t.length)),
        o = String(e);
      return d ? d.call(t, o, n) : t.slice(n, n + o.length) === o;
    }
  });
}, function (e, t, n) {
  var o = n(0),
    i = n(168),
    r = n(57);
  o({
    target: "Array",
    proto: !0
  }, {
    fill: i
  }), r("fill");
}, function (e, t, n) {

  var o = n(16),
    i = n(67),
    r = n(13);
  e.exports = function (e) {
    for (var t = o(this), n = r(t.length), l = arguments.length, a = i(l > 1 ? arguments[1] : void 0, n), s = l > 2 ? arguments[2] : void 0, c = void 0 === s ? n : i(s, n); c > a;) t[a++] = e;
    return t;
  };
}, function (e, t, n) {

  var o,
    i,
    r,
    l,
    a = n(0),
    s = n(32),
    c = n(2),
    u = n(38),
    d = n(170),
    h = n(20),
    f = n(131),
    p = n(84),
    y = n(56),
    v = n(132),
    g = n(8),
    m = n(46),
    w = n(101),
    C = n(83),
    b = n(100),
    x = n(99),
    R = n(122),
    S = n(133).set,
    O = n(171),
    K = n(173),
    I = n(174),
    E = n(135),
    k = n(175),
    T = n(39),
    D = n(65),
    _ = n(4),
    A = n(176),
    P = n(74),
    B = n(52),
    j = _("species"),
    M = "Promise",
    V = T.get,
    N = T.set,
    F = T.getterFor(M),
    L = d && d.prototype,
    H = d,
    W = L,
    z = c.TypeError,
    $ = c.document,
    q = c.process,
    G = E.f,
    U = G,
    X = !!($ && $.createEvent && c.dispatchEvent),
    Y = "function" == typeof PromiseRejectionEvent,
    J = !1,
    Q = D(M, function () {
      var e = C(H) !== String(H);
      if (!e && 66 === B) return !0;
      if (s && !W.finally) return !0;
      if (B >= 51 && /native code/.test(H)) return !1;
      var t = new H(function (e) {
          e(1);
        }),
        n = function (e) {
          e(function () {}, function () {});
        };
      return (t.constructor = {})[j] = n, !(J = t.then(function () {}) instanceof n) || !e && A && !Y;
    }),
    Z = Q || !x(function (e) {
      H.all(e).catch(function () {});
    }),
    ee = function (e) {
      var t;
      return !(!g(e) || "function" != typeof (t = e.then)) && t;
    },
    te = function (e, t) {
      if (!e.notified) {
        e.notified = !0;
        var n = e.reactions;
        O(function () {
          for (var o = e.value, i = 1 == e.state, r = 0; n.length > r;) {
            var l,
              a,
              s,
              c = n[r++],
              u = i ? c.ok : c.fail,
              d = c.resolve,
              h = c.reject,
              f = c.domain;
            try {
              u ? (i || (2 === e.rejection && re(e), e.rejection = 1), !0 === u ? l = o : (f && f.enter(), l = u(o), f && (f.exit(), s = !0)), l === c.promise ? h(z("Promise-chain cycle")) : (a = ee(l)) ? a.call(l, d, h) : d(l)) : h(o);
            } catch (e) {
              f && !s && f.exit(), h(e);
            }
          }
          e.reactions = [], e.notified = !1, t && !e.rejection && oe(e);
        });
      }
    },
    ne = function (e, t, n) {
      var o, i;
      X ? ((o = $.createEvent("Event")).promise = t, o.reason = n, o.initEvent(e, !1, !0), c.dispatchEvent(o)) : o = {
        promise: t,
        reason: n
      }, !Y && (i = c["on" + e]) ? i(o) : "unhandledrejection" === e && I("Unhandled promise rejection", n);
    },
    oe = function (e) {
      S.call(c, function () {
        var t,
          n = e.facade,
          o = e.value;
        if (ie(e) && (t = k(function () {
          P ? q.emit("unhandledRejection", o, n) : ne("unhandledrejection", n, o);
        }), e.rejection = P || ie(e) ? 2 : 1, t.error)) throw t.value;
      });
    },
    ie = function (e) {
      return 1 !== e.rejection && !e.parent;
    },
    re = function (e) {
      S.call(c, function () {
        var t = e.facade;
        P ? q.emit("rejectionHandled", t) : ne("rejectionhandled", t, e.value);
      });
    },
    le = function (e, t, n) {
      return function (o) {
        e(t, o, n);
      };
    },
    ae = function (e, t, n) {
      e.done || (e.done = !0, n && (e = n), e.value = t, e.state = 2, te(e, !0));
    },
    se = function (e, t, n) {
      if (!e.done) {
        e.done = !0, n && (e = n);
        try {
          if (e.facade === t) throw z("Promise can't be resolved itself");
          var o = ee(t);
          o ? O(function () {
            var n = {
              done: !1
            };
            try {
              o.call(t, le(se, n, e), le(ae, n, e));
            } catch (t) {
              ae(n, t, e);
            }
          }) : (e.value = t, e.state = 1, te(e, !1));
        } catch (t) {
          ae({
            done: !1
          }, t, e);
        }
      }
    };
  if (Q && (W = (H = function (e) {
    w(this, H, M), m(e), o.call(this);
    var t = V(this);
    try {
      e(le(se, t), le(ae, t));
    } catch (e) {
      ae(t, e);
    }
  }).prototype, (o = function (e) {
    N(this, {
      type: M,
      done: !1,
      notified: !1,
      parent: !1,
      reactions: [],
      rejection: !1,
      state: 0,
      value: void 0
    });
  }).prototype = f(W, {
    then: function (e, t) {
      var n = F(this),
        o = G(R(this, H));
      return o.ok = "function" != typeof e || e, o.fail = "function" == typeof t && t, o.domain = P ? q.domain : void 0, n.parent = !0, n.reactions.push(o), 0 != n.state && te(n, !1), o.promise;
    },
    catch: function (e) {
      return this.then(void 0, e);
    }
  }), i = function () {
    var e = new o(),
      t = V(e);
    this.promise = e, this.resolve = le(se, t), this.reject = le(ae, t);
  }, E.f = G = function (e) {
    return e === H || e === r ? new i(e) : U(e);
  }, !s && "function" == typeof d && L !== Object.prototype)) {
    l = L.then, J || (h(L, "then", function (e, t) {
      var n = this;
      return new H(function (e, t) {
        l.call(n, e, t);
      }).then(e, t);
    }, {
      unsafe: !0
    }), h(L, "catch", W.catch, {
      unsafe: !0
    }));
    try {
      delete L.constructor;
    } catch (e) {}
    p && p(L, W);
  }
  a({
    global: !0,
    wrap: !0,
    forced: Q
  }, {
    Promise: H
  }), y(H, M, !1, !0), v(M), r = u(M), a({
    target: M,
    stat: !0,
    forced: Q
  }, {
    reject: function (e) {
      var t = G(this);
      return t.reject.call(void 0, e), t.promise;
    }
  }), a({
    target: M,
    stat: !0,
    forced: s || Q
  }, {
    resolve: function (e) {
      return K(s && this === r ? H : this, e);
    }
  }), a({
    target: M,
    stat: !0,
    forced: Z
  }, {
    all: function (e) {
      var t = this,
        n = G(t),
        o = n.resolve,
        i = n.reject,
        r = k(function () {
          var n = m(t.resolve),
            r = [],
            l = 0,
            a = 1;
          b(e, function (e) {
            var s = l++,
              c = !1;
            r.push(void 0), a++, n.call(t, e).then(function (e) {
              c || (c = !0, r[s] = e, --a || o(r));
            }, i);
          }), --a || o(r);
        });
      return r.error && i(r.value), n.promise;
    },
    race: function (e) {
      var t = this,
        n = G(t),
        o = n.reject,
        i = k(function () {
          var i = m(t.resolve);
          b(e, function (e) {
            i.call(t, e).then(n.resolve, o);
          });
        });
      return i.error && o(i.value), n.promise;
    }
  });
}, function (e, t, n) {
  var o = n(2);
  e.exports = o.Promise;
}, function (e, t, n) {
  var o,
    i,
    r,
    l,
    a,
    s,
    c,
    u,
    d = n(2),
    h = n(22).f,
    f = n(133).set,
    p = n(134),
    y = n(172),
    v = n(74),
    g = d.MutationObserver || d.WebKitMutationObserver,
    m = d.document,
    w = d.process,
    C = d.Promise,
    b = h(d, "queueMicrotask"),
    x = b && b.value;
  x || (o = function () {
    var e, t;
    for (v && (e = w.domain) && e.exit(); i;) {
      t = i.fn, i = i.next;
      try {
        t();
      } catch (e) {
        throw i ? l() : r = void 0, e;
      }
    }
    r = void 0, e && e.enter();
  }, p || v || y || !g || !m ? C && C.resolve ? ((c = C.resolve(void 0)).constructor = C, u = c.then, l = function () {
    u.call(c, o);
  }) : l = v ? function () {
    w.nextTick(o);
  } : function () {
    f.call(d, o);
  } : (a = !0, s = m.createTextNode(""), new g(o).observe(s, {
    characterData: !0
  }), l = function () {
    s.data = a = !a;
  })), e.exports = x || function (e) {
    var t = {
      fn: e,
      next: void 0
    };
    r && (r.next = t), i || (i = t, l()), r = t;
  };
}, function (e, t, n) {
  var o = n(81);
  e.exports = /web0s(?!.*chrome)/i.test(o);
}, function (e, t, n) {
  var o = n(9),
    i = n(8),
    r = n(135);
  e.exports = function (e, t) {
    if (o(e), i(t) && t.constructor === e) return t;
    var n = r.f(e);
    return (0, n.resolve)(t), n.promise;
  };
}, function (e, t, n) {
  var o = n(2);
  e.exports = function (e, t) {
    var n = o.console;
    n && n.error && (1 === arguments.length ? n.error(e) : n.error(e, t));
  };
}, function (e, t) {
  e.exports = function (e) {
    try {
      return {
        error: !1,
        value: e()
      };
    } catch (e) {
      return {
        error: !0,
        value: e
      };
    }
  };
}, function (e, t) {
  e.exports = "object" == typeof window;
}, function (e, t, n) {

  var o = n(128),
    i = n(130);
  e.exports = o("Map", function (e) {
    return function () {
      return e(this, arguments.length ? arguments[0] : void 0);
    };
  }, i);
}, function (e, t, n) {

  n.r(t), n.d(t, "install", function () {
    return qi;
  }), n.d(t, "version", function () {
    return zi;
  }), n.d(t, "VeCheckbox", function () {
    return w;
  }), n.d(t, "VeCheckboxGroup", function () {
    return R;
  }), n.d(t, "VeContextmenu", function () {
    return ee;
  }), n.d(t, "VeDropdown", function () {
    return fe;
  }), n.d(t, "VeIcon", function () {
    return ve;
  }), n.d(t, "VeLoading", function () {
    return De;
  }), n.d(t, "VeLocale", function () {
    return je;
  }), n.d(t, "VePagination", function () {
    return qe;
  }), n.d(t, "VeRadio", function () {
    return Je;
  }), n.d(t, "VeSelect", function () {
    return it;
  }), n.d(t, "VeTable", function () {
    return Wi;
  });
  n(10), n(7), n(1), n(33), n(70), n(27), n(71), n(34), n(40), n(41), n(35);
  var o = n(136),
    i = n.n(o);
  function r(e) {
    return function (e) {
      return function (t) {
        var n = "",
          o = i.a.getMessage();
        if (o[e]) {
          for (var r = o[e][t], l = arguments.length, a = new Array(l > 1 ? l - 1 : 0), s = 1; s < l; s++) a[s - 1] = arguments[s];
          n = c(r) ? r.apply(void 0, a) : r;
        } else console.error("can't find ".concat(e, " in ").concat(JSON.stringify(o)));
        return n;
      };
    }(e);
  }
  function l(e) {
    return !(Array.isArray(e) && e.length > 0);
  }
  function a(e) {
    return !("" !== e && null != e);
  }
  function s(e) {
    return null != e;
  }
  function c(e) {
    return "function" == typeof e;
  }
  function u(e) {
    return "boolean" == typeof e;
  }
  function d(e) {
    return "number" == typeof e;
  }
  function h(e) {
    return "number" == typeof e ? e + "px" : e;
  }
  function f(e, t) {
    if (c(e.scrollTo)) e.scrollTo(t);else {
      var n = t.top,
        o = t.left;
      e.scrollTop = n, e.scrollLeft = o;
    }
  }
  var p = "on-checked-change",
    y = "VeCheckboxGroup";
  function v(e) {
    return "ve-checkbox-" + e;
  }
  function g(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var m = {
      name: "VeCheckbox",
      props: {
        value: {
          type: [String, Number, Boolean],
          default: null
        },
        label: {
          type: [String],
          default: null
        },
        disabled: Boolean,
        indeterminate: Boolean,
        isControlled: {
          type: Boolean,
          default: !1
        },
        isSelected: {
          type: Boolean,
          default: !1
        }
      },
      data: function () {
        return {
          model: this.value,
          checkboxGroup: {}
        };
      },
      computed: {
        checkboxClass: function () {
          var e;
          return [v("content"), (e = {}, g(e, v("checked"), this.internalIsSelected), g(e, v("disabled"), this.disabled), g(e, v("indeterminate"), this.indeterminate), e)];
        },
        checkboxStyle: function () {
          return {
            display: this.checkboxGroup && this.checkboxGroup.isVerticalShow ? "block" : "inline-block"
          };
        },
        internalIsSelected: function () {
          return this.isControlled ? this.isSelected : this.model;
        }
      },
      watch: {
        value: function () {
          this.updateModelBySingle();
        }
      },
      methods: {
        checkboxChange: function (e) {
          if (this.disabled) return !1;
          var t = e.target.checked;
          this.isControlled || this.$emit("input", t), this.$emit(p, t), this.isCheckBoxGroup() && this.checkboxGroup.updateModel(this.label, t);
        },
        isCheckBoxGroup: function () {
          return this.checkboxGroup = function (e, t) {
            for (var n = e.$parent; n;) {
              if (n.$options.name === t) return n;
              n = n.$parent;
            }
            return null;
          }(this, y), !!this.checkboxGroup;
        },
        getLabelContent: function () {
          var e = this.label,
            t = this.$slots;
          return e || t.default;
        },
        initModel: function () {
          if (this.isCheckBoxGroup()) {
            var e = this.checkboxGroup;
            Array.isArray(e.value) && e.value.length > 0 && e.value.indexOf(this.label) > -1 && (this.model = !0);
          } else this.model = this.value;
        },
        updateModelBySingle: function () {
          this.disabled || (this.model = this.value);
        },
        updateModelByGroup: function (e) {
          e.indexOf(this.label) > -1 ? this.disabled || (this.model = !0) : this.disabled || (this.model = !1);
        }
      },
      created: function () {
        this.initModel();
      },
      render: function () {
        var e = arguments[0],
          t = this.checkboxStyle,
          n = this.label,
          o = this.checkboxClass,
          i = this.checkboxChange,
          r = this.getLabelContent,
          l = this.internalIsSelected;
        return e("label", {
          class: "ve-checkbox",
          style: t
        }, [e("span", {
          class: o
        }, [e("input", {
          domProps: {
            checked: l,
            value: n
          },
          class: v("input"),
          attrs: {
            type: "checkbox"
          },
          on: {
            change: i
          }
        }), e("span", {
          class: v("inner")
        })]), e("span", {
          class: v("label")
        }, [r()])]);
      },
      install: function (e) {
        e.component(m.name, m);
      }
    },
    w = m,
    C = (n(61), "on-checked-change"),
    b = "VeCheckbox",
    x = {
      name: "VeCheckboxGroup",
      props: {
        value: {
          type: Array,
          default: function () {
            return [];
          }
        },
        isVerticalShow: {
          type: Boolean,
          default: !1
        }
      },
      watch: {
        value: function (e) {
          var t = function (e, t) {
            for (var n = [], o = e.$children; o && o.length > 0;) o.forEach(function (e) {
              o = e.$children ? e.$children : null, e.$options.name === t && n.push(e);
            });
            return n;
          }(this, b);
          t.length > 0 && t.forEach(function (t) {
            t.updateModelByGroup(e);
          });
        }
      },
      methods: {
        updateModel: function (e, t) {
          var n = this.value.indexOf(e);
          n > -1 ? t || this.value.splice(n, 1) : t && this.value.push(e), this.$emit("input", this.value), this.$emit(C, this.value);
        }
      },
      render: function () {
        var e = arguments[0];
        return e("div", {
          class: "ve-checkbox-group"
        }, [this.$slots.default]);
      },
      install: function (e) {
        e.component(x.name, x);
      }
    },
    R = x,
    S = (n(12), n(28), n(152), n(21), n(23), n(24), n(42), n(91), n(92), "on-node-click"),
    O = -1,
    K = "SEPARATOR";
  function I(e) {
    return "ve-contextmenu-" + e;
  }
  var E = n(6),
    k = n.n(E),
    T = 8,
    D = 9,
    _ = 13,
    A = 32,
    P = 37,
    B = 38,
    j = 39,
    M = 40,
    V = 46,
    N = 113,
    F = {
      FILTER: "filter",
      DOUBLE_RIGHT_ARROW: "double-right-arrow",
      DOUBLE_LEFT_ARROW: "double-left-arrow",
      TOP_ARROW: "top-arrow",
      RIGHT_ARROW: "right-arrow",
      BOTTOM_ARROW: "bottom-arrow",
      LEFT_ARROW: "left-arrow",
      SORT_TOP_ARROW: "sort-top-arrow",
      SORT_BOTTOM_ARROW: "sort-bottom-arrow",
      SEARCH: "search"
    },
    L = 1,
    H = 2,
    W = 2;
  n(62), n(93), n(97);
  function z(e, t) {
    if (e) {
      for (var n = e.className, o = (t || "").split(" "), i = 0, r = o.length; i < r; i++) {
        var l = o[i];
        l && (e.classList ? e.classList.add(l) : q(e, l) || (n += " " + l));
      }
      e.classList || (e.className = n);
    }
  }
  function $(e, t) {
    if (e && t) {
      for (var n = t.split(" "), o = " " + e.className + " ", i = 0, r = n.length; i < r; i++) {
        var l = n[i];
        l && (e.classList ? e.classList.remove(l) : q(e, l) && (o = o.replace(" " + l + " ", " ")));
      }
      e.classList || (e.className = (o || "").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, ""));
    }
  }
  function q(e, t) {
    if (!e || !t) return !1;
    if (-1 !== t.indexOf(" ")) throw new Error("className should not contain space.");
    return e.classList ? e.classList.contains(t) : (" " + e.className + " ").indexOf(" " + t + " ") > -1;
  }
  function G(e) {
    var t = document.documentElement,
      n = void 0 !== e.getBoundingClientRect ? e.getBoundingClientRect() : 0,
      o = (window.pageXOffset || t.scrollLeft) - (t.clientLeft || 0),
      i = (window.pageYOffset || t.scrollTop) - (t.clientTop || 0),
      r = n.left + window.pageXOffset,
      l = n.top + window.pageYOffset,
      a = r - o,
      s = l - i;
    return {
      offsetTop: l,
      offsetLeft: r,
      left: a,
      top: s,
      right: window.document.documentElement.clientWidth - n.width - a,
      bottom: window.document.documentElement.clientHeight - n.height - s,
      right2: window.document.documentElement.clientWidth - a,
      bottom2: window.document.documentElement.clientHeight - s
    };
  }
  function U(e) {
    var t = 0,
      n = 0,
      o = document.documentElement,
      i = document.body;
    return e || (e = window.event), window.pageYoffset ? (t = window.pageXOffset, n = window.pageYOffset) : (t = (o && o.scrollLeft || i && i.scrollLeft || 0) - (o && o.clientLeft || i && i.clientLeft || 0), n = (o && o.scrollTop || i && i.scrollTop || 0) - (o && o.clientTop || i && i.clientTop || 0)), {
      left: t += e.clientX,
      top: n += e.clientY,
      right: o.clientWidth - e.clientX,
      bottom: o.clientHeight - e.clientY
    };
  }
  n(154);
  function X() {
    return Date.now().toString(36) + Math.random().toString(36).substr(2);
  }
  var Y = n(5);
  function J(e, t) {
    var n = Object.keys(e);
    if (Object.getOwnPropertySymbols) {
      var o = Object.getOwnPropertySymbols(e);
      t && (o = o.filter(function (t) {
        return Object.getOwnPropertyDescriptor(e, t).enumerable;
      })), n.push.apply(n, o);
    }
    return n;
  }
  function Q(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var Z = {
      name: "VeContextmenu",
      directives: {
        "events-outside": {
          bind: function (e, t, n) {
            var o = t.value,
              i = o.events,
              r = o.callback;
            if (Array.isArray(i) && i.length && "function" == typeof r) {
              var l = function (t) {
                if (e.contains(t.target) || e === t.target) return !1;
                r(t);
              };
              e.__eventsOutside__ = l, i.forEach(function (e) {
                document.addEventListener(e, l, !0);
              });
            } else {
              var a = n.context.name;
              console.error("[events-outside] Please provided 'events' and 'callback' in ".concat(a));
            }
          },
          unbind: function (e, t, n) {
            t.value.events.forEach(function (t) {
              document.removeEventListener(t, e.__eventsOutside__, !0);
            }), e.__eventsOutside__ = null;
          }
        }
      },
      props: {
        options: {
          type: Array,
          required: !0
        },
        eventTarget: {
          type: [String, HTMLElement],
          required: !0
        }
      },
      data: function () {
        return {
          internalOptions: [],
          panelOptions: [],
          eventTargetEl: "",
          rootContextmenuId: "",
          isChildrenPanelsClicked: !1,
          isPanelRightDirection: !0,
          isPanelsEmptyed: !0
        };
      },
      computed: {
        activeMenuIds: function () {
          return this.panelOptions.map(function (e) {
            return e.parentId;
          });
        }
      },
      watch: {
        options: {
          handler: function (e) {
            Array.isArray(e) && e.length > 0 && (this.removeOrEmptyPanels(!0), this.rootContextmenuId = this.getRandomIdWithPrefix(), this.createInternalOptions(), this.createPanelOptions({
              options: this.internalOptions
            }), this.resetContextmenu(), this.addRootContextmenuPanelToBody());
          },
          immediate: !0
        },
        eventTarget: {
          handler: function (e) {
            e && this.registerContextmenuEvent();
          },
          immediate: !0
        }
      },
      methods: Q({
        getRandomIdWithPrefix: function () {
          return I(X());
        },
        hasChildren: function (e) {
          return Array.isArray(e.children) && e.children.length;
        },
        getPanelOptionByMenuId: function (e, t) {
          for (var n = 0; n < e.length; n++) {
            if (e[n].id === t) return e[n].children;
            if (e[n].children) {
              var o = this.getPanelOptionByMenuId(e[n].children, t);
              if (o) return o;
            }
          }
        },
        getParentContextmenuPanelEl: function (e) {
          var t,
            n = this.panelOptions,
            o = n.findIndex(function (t) {
              return t.parentId === e;
            });
          if (o > 0) {
            var i = n[o - 1].parentId;
            t = document.querySelector("#".concat(i));
          }
          return t;
        },
        createPanelByHover: function (e) {
          var t = this,
            n = e.event,
            o = e.menu,
            i = this.internalOptions,
            r = this.panelOptions;
          if (this.isPanelsEmptyed) return !1;
          if (r.findIndex(function (e) {
            return e.parentId === o.id;
          }) > -1) return !1;
          var l = r.filter(function (e) {
            return e.parentDeep >= o.deep;
          }).map(function (e) {
            return e.parentDeep;
          }).reverse();
          if (l.length) for (var a = function (e) {
              var n = r.findIndex(function (t) {
                return t.parentDeep === l[e];
              });
              n > -1 && t.panelOptions.splice(n, 1);
            }, s = l.length - 1; s >= 0; s--) a(s);
          var c = this.getPanelOptionByMenuId(i, o.id);
          c && (this.createPanelOptions({
            options: c,
            currentMenu: o
          }), this.$nextTick(function () {
            t.addContextmenuPanelToBody({
              contextmenuId: o.id
            }), t.showContextmenuPanel({
              event: n,
              contextmenuId: o.id
            });
          }));
        },
        createPanelOptions: function (e) {
          var t = e.options,
            n = e.currentMenu,
            o = this.hasChildren,
            i = this.rootContextmenuId;
          if (Array.isArray(t)) {
            var r = t.map(function (e) {
              return function (e) {
                for (var t = 1; t < arguments.length; t++) {
                  var n = null != arguments[t] ? arguments[t] : {};
                  t % 2 ? J(Object(n), !0).forEach(function (t) {
                    Q(e, t, n[t]);
                  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : J(Object(n)).forEach(function (t) {
                    Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
                  });
                }
                return e;
              }({
                hasChildren: o(e)
              }, e);
            });
            this.panelOptions.push({
              parentId: n ? n.id : i,
              parentDeep: n ? n.deep : O,
              menus: r
            });
          }
        },
        createInternalOptionsRecursion: function (e) {
          var t = this,
            n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
          return e.id = this.getRandomIdWithPrefix(), e.deep = n, n++, Array.isArray(e.children) && e.children.map(function (e) {
            return t.createInternalOptionsRecursion(e, n);
          }), e;
        },
        createInternalOptions: function () {
          var e = this;
          this.internalOptions = Object(Y.cloneDeep)(this.options).map(function (t) {
            return e.createInternalOptionsRecursion(t);
          });
        },
        showRootContextmenuPanel: function (e) {
          e.preventDefault();
          var t = this.rootContextmenuId;
          t && (this.resetContextmenu(), this.showContextmenuPanel({
            event: e,
            contextmenuId: t,
            isRootContextmenu: !0
          }), this.isPanelsEmptyed = !1);
        },
        showContextmenuPanel: function (e) {
          var t = e.event,
            n = e.contextmenuId,
            o = e.isRootContextmenu,
            i = this.getParentContextmenuPanelEl,
            r = document.querySelector("#".concat(n));
          if (r) {
            r.innerHTML = "", r.appendChild(this.$refs[n]), r.style.position = "absolute", r.classList.add(I("popper"));
            var l = r.getBoundingClientRect(),
              a = l.width,
              s = l.height;
            if (o) {
              var c = U(t),
                u = c.left,
                d = c.top,
                h = c.right,
                f = c.bottom,
                p = 0,
                y = 0;
              h >= a ? (p = u, this.isPanelRightDirection = !0) : (p = u - a, this.isPanelRightDirection = !1), y = f >= s ? d : d - s, r.style.left = p + "px", r.style.top = y + "px";
            } else {
              var v = i(n);
              if (v) {
                var g = G(v),
                  m = g.left,
                  w = g.right,
                  C = U(t),
                  b = C.top,
                  x = C.bottom,
                  R = v.getBoundingClientRect().width,
                  S = 0,
                  O = 0;
                S = this.isPanelRightDirection ? w >= a ? m + R : m - R : m >= a ? m - R : m + R, O = x >= s ? b : b - s, r.style.left = S + "px", r.style.top = O + "px";
              }
            }
          }
        },
        emptyContextmenuPanels: function () {
          var e = this;
          setTimeout(function () {
            e.isChildrenPanelsClicked ? e.isChildrenPanelsClicked = !1 : (e.removeOrEmptyPanels(), e.isPanelsEmptyed = !0);
          });
        },
        removeOrEmptyPanels: function (e) {
          this.panelOptions.forEach(function (t) {
            var n = document.querySelector("#".concat(t.parentId));
            n && (e ? n.remove() : n.innerHTML = "");
          });
        },
        resetContextmenu: function () {
          this.panelOptions = [], this.createPanelOptions({
            options: this.internalOptions
          });
        },
        addContextmenuPanelToBody: function (e) {
          var t = e.contextmenuId;
          if (document.querySelector("#".concat(t))) return !1;
          var n = document.createElement("div");
          n.setAttribute("id", t), document.body.appendChild(n);
        },
        addRootContextmenuPanelToBody: function () {
          this.rootContextmenuId && this.addContextmenuPanelToBody({
            contextmenuId: this.rootContextmenuId
          });
        },
        registerContextmenuEvent: function () {
          var e = this.eventTarget;
          "string" == typeof e && e.length > 0 ? this.eventTargetEl = document.querySelector(e) : this.eventTargetEl = e, this.eventTargetEl && this.eventTargetEl.addEventListener("contextmenu", this.showRootContextmenuPanel);
        },
        removeContextmenuEvent: function () {
          this.eventTargetEl && this.eventTargetEl.removeEventListener("contextmenu", this.showRootContextmenuPanel);
        }
      }, "hideContextmenu", function () {
        this.emptyContextmenuPanels();
      }),
      created: function () {
        this.debounceCreatePanelByHover = Object(Y.debounce)(this.createPanelByHover, 300);
      },
      mounted: function () {
        this.addRootContextmenuPanelToBody();
      },
      destroyed: function () {
        this.removeContextmenuEvent(), this.removeOrEmptyPanels(!0);
      },
      render: function () {
        var e = this,
          t = arguments[0],
          n = this.panelOptions,
          o = this.activeMenuIds,
          i = this.hasChildren,
          r = this.emptyContextmenuPanels,
          l = this.debounceCreatePanelByHover,
          a = {
            class: ["ve-contextmenu"],
            style: {
              display: "none"
            }
          };
        return t("div", a, [n.map(function (n, a) {
          var s = {
            ref: n.parentId,
            class: Q({}, I("panel"), !0),
            directives: [{
              name: "events-outside",
              value: {
                events: ["click"],
                callback: function (e) {
                  0 === a && r();
                }
              }
            }],
            on: {
              click: function () {
                0 !== a && (e.isChildrenPanelsClicked = !0);
              },
              contextmenu: function (e) {
                e.preventDefault();
              }
            }
          };
          return t("div", s, [t("ul", {
            class: I("list")
          }, [n.menus.map(function (n) {
            var a, s;
            n.type !== K ? a = {
              class: (s = {}, Q(s, I("node"), !0), Q(s, I("node-active"), o.includes(n.id)), Q(s, I("node-disabled"), n.disabled), s),
              on: {
                mouseover: function (e) {
                  n.disabled || l({
                    event: e,
                    menu: n
                  });
                },
                click: function () {
                  n.disabled || i(n) || (e.$emit(S, n.type), setTimeout(function () {
                    r();
                  }, 50));
                }
              }
            } : a = {
              class: Q({}, I("node-separator"), !0)
            };
            return n.type !== K ? t("li", a, [t("span", {
              class: I("node-label")
            }, [n.label]), n.hasChildren && t(k.a, {
              class: I("node-icon-postfix"),
              attrs: {
                name: F.RIGHT_ARROW
              }
            })]) : t("li", a);
          })])]);
        })]);
      },
      install: function (e) {
        e.component(Z.name, Z);
      }
    },
    ee = Z,
    te = (n(25), n(98), {
      bind: function (e, t, n) {
        if ("function" != typeof t.value) {
          var o = "in [clickoutside] directives, provided expression '".concat(t.expression, "' is not a function "),
            i = n.context.name;
          i && (o += "in ".concat(i)), console.error(o);
        }
        var r = function (n) {
          if (e.contains(n.target) || e === n.target) return !1;
          t.value(n);
        };
        e.__clickOutSide__ = r, document.addEventListener("click", r, !0);
      },
      unbind: function (e) {
        document.removeEventListener("click", e.__clickOutSide__, !0), e.__clickOutSide__ = null;
      }
    }),
    ne = n(43),
    oe = n.n(ne),
    ie = n(75),
    re = n.n(ie),
    le = "on-filter-reset",
    ae = "on-filter-confirm",
    se = "on-dropdown-visible-change",
    ce = "on-item-select-change";
  function ue(e) {
    return "ve-dropdown-" + e;
  }
  function de(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var he = {
      name: "VeDropdown",
      directives: {
        "click-outside": te
      },
      props: {
        isSelect: {
          type: Boolean,
          default: !1
        },
        showOperation: {
          type: Boolean,
          default: !1
        },
        width: {
          type: Number,
          default: 90
        },
        maxWidth: {
          type: Number,
          default: 0
        },
        maxHeight: {
          type: Number,
          default: 1e3
        },
        isMultiple: {
          type: Boolean,
          default: !1
        },
        value: {
          type: [Array],
          default: null
        },
        textAlign: {
          type: String,
          default: "left"
        },
        isInput: {
          type: Boolean,
          default: !1
        },
        confirmFilterText: {
          type: String,
          default: ""
        },
        resetFilterText: {
          type: String,
          default: ""
        },
        hideByItemClick: {
          type: Boolean,
          default: !1
        },
        showRadio: {
          type: Boolean,
          default: !1
        },
        visible: {
          type: Boolean,
          default: !1
        },
        isControlled: {
          type: Boolean,
          default: !1
        },
        isCustomContent: {
          type: Boolean,
          default: !1
        },
        defaultInstance: {
          type: Number,
          default: 5
        },
        popperAppendTo: {
          type: [String, HTMLElement],
          default: function () {
            return document.body;
          }
        },
        beforeVisibleChange: {
          type: Function,
          default: null
        }
      },
      data: function () {
        return {
          internalVisible: !1,
          internalOptions: [],
          inputValue: "",
          isDropdownShowTriggerClicked: !1,
          rootId: "",
          dropdownItemsPanelId: "",
          popperAppendToEl: null,
          appendToElTagName: null
        };
      },
      computed: {
        isDropdownVisible: function () {
          return this.isControlled ? this.visible : this.internalVisible;
        },
        getMaxWidth: function () {
          var e = 1 / 0,
            t = this.maxWidth,
            n = this.width;
          return t && t > 0 && t > n && (e = t), e;
        },
        selectedLabels: function () {
          return this.internalOptions.filter(function (e) {
            return e.selected;
          }).map(function (e) {
            if (e.selected) return e.label;
          });
        },
        operationFilterClass: function () {
          return de({}, ue("filter-disable"), 0 === this.selectedLabels.length);
        },
        dropdownItemsClass: function () {
          var e;
          return de(e = {}, ue("dd"), !0), de(e, ue("dd-show"), this.isDropdownVisible), e;
        }
      },
      watch: {
        value: function () {
          this.init();
        },
        visible: {
          handler: function (e) {
            var t = this.isControlled,
              n = this.showDropDown,
              o = this.hideDropDown;
            setTimeout(function () {
              t && (e ? n() : o());
            });
          },
          immediate: !0
        }
      },
      methods: {
        init: function () {
          this.internalOptions = Object.assign([], this.value), this.isInput && this.setInputValue();
        },
        confirm: function () {
          this.$emit("input", this.internalOptions), this.$emit(ae, this.internalOptions), this.hideDropDown();
        },
        reset: function () {
          this.internalOptions.some(function (e) {
            return e.selected;
          }) && (this.internalOptions.map(function (e) {
            return e.selected && (e.selected = !1), e;
          }), this.$emit("input", this.internalOptions), this.$emit(le, this.internalOptions)), this.hideDropDown();
        },
        showDropDown: function () {
          var e = this.rootId,
            t = this.dropdownItemsPanelId,
            n = this.beforeVisibleChangeCallback(!0);
          if (u(n) && !n) return !1;
          var o = document.querySelector("#".concat(e));
          o && (o.innerHTML = "", o.appendChild(this.$refs[t]), o.style.position = "absolute", o.classList.add(ue("popper")), this.changDropdownPanelPosition()), this.internalVisible = !0, this.$emit(se, !0);
        },
        hideDropDown: function () {
          var e = this,
            t = this.beforeVisibleChangeCallback(!1);
          if (u(t) && !t) return !1;
          this.$emit(se, !1), setTimeout(function () {
            e.internalVisible = !1, e.removeOrEmptyRootPanel();
          }, 150);
        },
        beforeVisibleChangeCallback: function (e) {
          var t = this.beforeVisibleChange;
          if (e !== this.isDropdownVisible && c(t)) return t({
            nextVisible: e
          });
        },
        removeOrEmptyRootPanel: function () {
          var e = this.rootId,
            t = document.querySelector("#".concat(e));
          t && (t.innerHTML = "");
        },
        changDropdownPanelPosition: function () {
          var e = this.defaultInstance,
            t = this.rootId,
            n = this.popperAppendToEl,
            o = this.appendToElTagName,
            i = document.querySelector("#".concat(t));
          if (i) {
            var r = i.getBoundingClientRect(),
              l = r.width,
              a = r.height,
              s = this.$el.querySelector(".ve-dropdown-dt"),
              c = s.getBoundingClientRect().height;
            if (!n) return !1;
            var u = "BODY" === o,
              d = u ? G(s) : function (e, t) {
                var n = G(e),
                  o = n.offsetTop,
                  i = n.offsetLeft,
                  r = n.left,
                  l = n.top,
                  a = n.right,
                  s = n.bottom,
                  c = n.right2,
                  u = n.bottom2,
                  d = G(t);
                return {
                  offsetTop: o - d.offsetTop,
                  offsetLeft: i - d.offsetLeft,
                  left: r - d.left,
                  top: l - d.top,
                  right: a - d.right,
                  bottom: s - d.bottom,
                  right2: c - d.right2,
                  bottom2: u - d.bottom2
                };
              }(s, n),
              h = d.offsetLeft,
              f = d.offsetTop,
              p = d.right,
              y = d.bottom,
              v = 0,
              g = 0,
              m = 0,
              w = 0;
            u || (m = n.scrollLeft, w = n.scrollTop), v = p >= l ? h + m : h - l + m, g = y >= a ? f + c + e + w : f - a - e + w, i.style.left = v + "px", i.style.top = g + "px";
          }
        },
        setInputValue: function () {
          var e, t;
          t = this.selectedLabels, Array.isArray(t) && t.length > 0 && (e = t.join()), this.inputValue = e;
        },
        dropdownPanelClick: function () {
          this.isDropdownShowTriggerClicked = !0, this.dropdownShowToggle();
        },
        dropdownShowToggle: function () {
          this.isDropdownVisible ? this.hideDropDown() : this.showDropDown();
        },
        singleSelectOptionClick: function (e, t) {
          this.internalOptions = this.internalOptions.map(function (e) {
            return t.label === e.label ? e.selected = !0 : e.selected = !1, e;
          }), this.hideByItemClick && this.hideDropDown(), this.isInput && this.setInputValue(), this.$emit("input", this.internalOptions), this.$emit(ce, this.internalOptions);
        },
        getTextAlignClass: function () {
          return ue("items-li-a-".concat(this.textAlign));
        },
        dropdownClickOutside: function () {
          var e = this;
          setTimeout(function () {
            e.isDropdownShowTriggerClicked ? e.isDropdownShowTriggerClicked = !1 : e.hideDropDown();
          });
        },
        checkedChangeControl: function (e, t) {
          this.internalOptions = this.internalOptions.map(function (n) {
            return n.label === e.label && (n.selected = t), n;
          }), this.$emit(ce, this.internalOptions);
        },
        getRandomIdWithPrefix: function () {
          return ue(X());
        },
        addRootElementToElement: function () {
          var e = this,
            t = this.popperAppendTo;
          if (this.rootId = this.getRandomIdWithPrefix(), this.dropdownItemsPanelId = this.getRandomIdWithPrefix(), document.querySelector("#".concat(this.rootId))) return !1;
          this.$nextTick(function () {
            var n = document.createElement("div");
            n.setAttribute("id", e.rootId), "string" == typeof t && t.length > 0 ? e.popperAppendToEl = document.querySelector(t) : e.popperAppendToEl = t, e.appendToElTagName = e.popperAppendToEl.tagName, e.popperAppendToEl.appendChild(n);
          });
        }
      },
      created: function () {
        this.init();
      },
      mounted: function () {
        var e = this;
        this.addRootElementToElement(), this.$nextTick(function () {
          ("BODY" === e.appendToElTagName ? document : e.popperAppendToEl).addEventListener("scroll", e.changDropdownPanelPosition);
        }), window.addEventListener("resize", this.changDropdownPanelPosition);
      },
      destroyed: function () {
        var e = this;
        this.removeOrEmptyRootPanel(), this.$nextTick(function () {
          ("BODY" === e.appendToElTagName ? document : e.popperAppendToEl).removeEventListener("scroll", e.changDropdownPanelPosition);
        }), window.removeEventListener("resize", this.changDropdownPanelPosition);
      },
      render: function () {
        var e = this,
          t = arguments[0],
          n = this.isMultiple,
          o = this.getTextAlignClass,
          i = this.internalOptions,
          r = this.isSelect,
          l = this.width,
          a = this.maxHeight,
          s = this.dropdownPanelClick,
          c = this.getMaxWidth,
          u = this.reset,
          d = this.singleSelectOptionClick,
          h = this.showOperation,
          f = this.isCustomContent,
          p = this.dropdownItemsClass,
          y = this.dropdownItemsPanelId,
          v = "";
        v = n ? i.map(function (n, i) {
          var r = {
            key: n.label,
            props: {
              isControlled: !0,
              label: n.label,
              showLine: n.showLine,
              isSelected: n.selected
            },
            on: {
              "on-checked-change": function (t) {
                return e.checkedChangeControl(n, t);
              }
            }
          };
          return t("li", {
            key: i,
            class: [ue("items-multiple"), ue("items-li"), o()]
          }, [t(oe.a, r)]);
        }) : i.map(function (n, i) {
          var r = {
            props: {
              isControlled: !0,
              isSelected: n.selected
            },
            on: {
              "on-radio-change": function () {}
            }
          };
          return t("li", {
            key: i,
            class: [ue("items-li"), n.selected ? "active" : ""],
            on: {
              click: function (e) {
                return d(e, n);
              }
            }
          }, [t("a", {
            class: [ue("items-li-a"), o()],
            attrs: {
              href: "javascript:void(0);"
            }
          }, [e.showRadio ? t(re.a, r, [n.label]) : n.label])]);
        });
        var g = {
            class: ["ve-dropdown"]
          },
          m = {
            ref: y,
            class: p,
            directives: [{
              name: "click-outside",
              value: this.dropdownClickOutside
            }]
          };
        return t("dl", g, [t("dt", {
          class: "ve-dropdown-dt",
          on: {
            click: s
          }
        }, [t("a", {
          class: [r ? ue("dt-selected") : ""],
          style: {
            width: l + "px"
          }
        }, [this.$slots.default])]), t("div", {
          style: {
            display: "none"
          }
        }, [t("dd", m, [t("ul", {
          class: ue("items"),
          style: {
            "min-width": l + "px",
            "max-width": c + "px"
          }
        }, [f && this.$slots["custom-content"], !f && t("div", [t("div", {
          style: {
            "max-height": a + "px"
          },
          class: ue("items-warpper")
        }, [v]), h && t("li", {
          class: ue("operation")
        }, [t("a", {
          class: [ue("operation-item"), this.operationFilterClass],
          attrs: {
            href: "javascript:void(0)"
          },
          on: {
            click: u
          }
        }, [this.resetFilterText]), t("a", {
          class: ue("operation-item"),
          attrs: {
            href: "javascript:void(0)"
          },
          on: {
            click: this.confirm
          }
        }, [this.confirmFilterText])])])])])])]);
      },
      install: function (e) {
        e.component(he.name, he);
      }
    },
    fe = he,
    pe = (n(123), "VeIcon"),
    ye = {
      name: pe,
      props: {
        name: {
          type: String,
          required: !0
        },
        color: {
          type: String,
          default: null
        },
        size: {
          type: [Number, String],
          default: ""
        }
      },
      computed: {
        iconStyle: function () {
          return {
            color: this.color,
            "font-size": h(this.size)
          };
        },
        iconClass: function () {
          var e = this.name;
          return Object.values(F).includes(e) || console.error("".concat(e, " is not found in ").concat(pe, ".")), "iconfont-vet icon-vet-".concat(e);
        }
      },
      render: function () {
        var e = arguments[0],
          t = this.iconStyle,
          n = this.iconClass;
        return e("i", {
          style: t,
          class: ["ve-icon", n]
        });
      },
      install: function (e) {
        e.component(ye.name, ye);
      }
    },
    ve = ye,
    ge = n(30),
    me = n.n(ge),
    we = "VeLoading",
    Ce = {
      PLANE: "plane",
      GRID: "grid",
      WAVE: "wave",
      FLOW: "flow",
      BOUNCE: "bounce",
      PULSE: "pulse"
    };
  function be(e) {
    return "ve-loading-" + e;
  }
  function xe(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var Re = {
      name: we,
      components: {
        Plane: {
          name: "VeLoadingPlane",
          props: {
            color: {
              type: String,
              required: !0
            },
            width: {
              type: [Number, String],
              required: !0
            },
            height: {
              type: [Number, String],
              required: !0
            }
          },
          computed: {
            spinStyle: function () {
              var e = this.color,
                t = this.width,
                n = this.height;
              return {
                width: h(t),
                height: h(n),
                "background-color": e
              };
            }
          },
          render: function () {
            var e = arguments[0];
            return e("div", {
              style: this.spinStyle,
              class: be("plane")
            });
          }
        },
        Bounce: {
          name: "VeLoadingBounce",
          props: {
            color: {
              type: String,
              required: !0
            },
            width: {
              type: [Number, String],
              required: !0
            },
            height: {
              type: [Number, String],
              required: !0
            }
          },
          computed: {
            spinStyle: function () {
              var e = this.width,
                t = this.height;
              return {
                width: h(e),
                height: h(t)
              };
            },
            itemStyle: function () {
              return {
                "background-color": this.color
              };
            }
          },
          render: function () {
            var e = arguments[0],
              t = this.spinStyle,
              n = this.itemStyle;
            return e("div", {
              style: t,
              class: be("bounce")
            }, [e("div", {
              style: n,
              class: be("bounce-dot")
            }), e("div", {
              style: n,
              class: be("bounce-dot")
            })]);
          }
        },
        Wave: {
          name: "VeLoadingWave",
          props: {
            color: {
              type: String,
              required: !0
            },
            width: {
              type: [Number, String],
              required: !0
            },
            height: {
              type: [Number, String],
              required: !0
            }
          },
          computed: {
            spinStyle: function () {
              var e = this.width,
                t = this.height;
              return {
                width: h(e),
                height: h(t)
              };
            },
            itemStyle: function () {
              return {
                "background-color": this.color
              };
            }
          },
          render: function () {
            var e = arguments[0],
              t = this.spinStyle,
              n = this.itemStyle;
            return e("div", {
              style: t,
              class: be("wave")
            }, [e("div", {
              style: n,
              class: be("wave-rect")
            }), e("div", {
              style: n,
              class: be("wave-rect")
            }), e("div", {
              style: n,
              class: be("wave-rect")
            }), e("div", {
              style: n,
              class: be("wave-rect")
            }), e("div", {
              style: n,
              class: be("wave-rect")
            })]);
          }
        },
        Pulse: {
          name: "VeLoadingPulse",
          props: {
            color: {
              type: String,
              required: !0
            },
            width: {
              type: [Number, String],
              required: !0
            },
            height: {
              type: [Number, String],
              required: !0
            }
          },
          computed: {
            spinStyle: function () {
              var e = this.color,
                t = this.width,
                n = this.height;
              return {
                width: h(t),
                height: h(n),
                "background-color": e
              };
            }
          },
          render: function () {
            var e = arguments[0];
            return e("div", {
              style: this.spinStyle,
              class: be("pulse")
            });
          }
        },
        Flow: {
          name: "VeLoadingFlow",
          props: {
            color: {
              type: String,
              required: !0
            },
            width: {
              type: [Number, String],
              required: !0
            },
            height: {
              type: [Number, String],
              required: !0
            }
          },
          computed: {
            spinStyle: function () {
              var e = this.width,
                t = this.height;
              return {
                width: h(e),
                height: h(t)
              };
            },
            itemStyle: function () {
              return {
                "background-color": this.color
              };
            }
          },
          render: function () {
            var e = arguments[0],
              t = this.spinStyle,
              n = this.itemStyle;
            return e("div", {
              style: t,
              class: be("flow")
            }, [e("div", {
              style: n,
              class: be("flow-dot")
            }), e("div", {
              style: n,
              class: be("flow-dot")
            }), e("div", {
              style: n,
              class: be("flow-dot")
            })]);
          }
        },
        Grid: {
          name: "VeLoadingGrid",
          props: {
            color: {
              type: String,
              required: !0
            },
            width: {
              type: [Number, String],
              required: !0
            },
            height: {
              type: [Number, String],
              required: !0
            }
          },
          computed: {
            spinStyle: function () {
              var e = this.width,
                t = this.height;
              return {
                width: h(e),
                height: h(t)
              };
            },
            itemStyle: function () {
              return {
                "background-color": this.color
              };
            }
          },
          render: function () {
            var e = arguments[0],
              t = this.spinStyle,
              n = this.itemStyle;
            return e("div", {
              style: t,
              class: be("grid")
            }, [e("div", {
              style: n,
              class: be("grid-cube")
            }), e("div", {
              style: n,
              class: be("grid-cube")
            }), e("div", {
              style: n,
              class: be("grid-cube")
            }), e("div", {
              style: n,
              class: be("grid-cube")
            }), e("div", {
              style: n,
              class: be("grid-cube")
            }), e("div", {
              style: n,
              class: be("grid-cube")
            }), e("div", {
              style: n,
              class: be("grid-cube")
            }), e("div", {
              style: n,
              class: be("grid-cube")
            }), e("div", {
              style: n,
              class: be("grid-cube")
            })]);
          }
        }
      },
      computed: {
        loadingClass: function () {
          var e,
            t = this.visible,
            n = this.fullscreen;
          return xe(e = {}, be("overlay"), !0), xe(e, be("fixed"), n), xe(e, be("hide"), !t), e;
        },
        loadingStyle: function () {
          return {
            "background-color": this.overlayBackgroundColor
          };
        }
      },
      render: function () {
        var e = arguments[0],
          t = this.width,
          n = this.height,
          o = this.color,
          i = {
            props: {
              width: t,
              height: n,
              color: o
            }
          };
        return e("div", {
          style: this.loadingStyle,
          class: ["ve-loading", this.loadingClass]
        }, [e("div", {
          class: be("spin-container")
        }, [e("div", {
          class: be("spin")
        }, [e(this.name, i)]), e("div", {
          style: {
            color: o
          },
          class: be("spin-tip")
        }, [this.tip])])]);
      }
    },
    Se = {
      name: "plane",
      visible: !1,
      color: "#1890ff",
      overlayBackgroundColor: "rgba(255, 255, 255, 0.5)",
      width: 40,
      height: 40,
      tip: "",
      fullscreen: !1,
      target: "",
      lock: !1,
      parent__: null
    },
    Oe = be("parent-relative"),
    Ke = be("parent-lock"),
    Ie = me.a.extend(Re);
  function Ee() {
    var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
    return new Ie({
      el: document.createElement("div"),
      data: e
    });
  }
  function ke(e) {
    Object.values(Ce).includes(e) || console.error("".concat(e, " is not found in ").concat(we, "."));
  }
  Ie.prototype.show = function () {
    var e = this;
    me.a.nextTick(function () {
      e.lock && z(e.parent__, Ke), e.visible = !0;
    });
  }, Ie.prototype.close = function () {
    var e = this;
    me.a.nextTick(function () {
      e.lock && $(e.parent__, Ke), e.visible = !1;
    });
  }, Ie.prototype.destroy = function () {
    $(this.parent__, Oe), $(this.parent__, Ke), this.$el && this.$el.parentNode && this.$el.parentNode.removeChild(this.$el), this.$destroy(), this.visible = !1;
  };
  var Te = function () {
    var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
    "string" == typeof (e = Object.assign({}, Se, e)).target && e.target.length > 0 && (e.target = document.querySelector(e.target)), e.target = e.target || document.body, ke(e.name), e.target !== document.body ? e.fullscreen = !1 : e.fullscreen = !0;
    var t = Ee(e);
    return e.parent__ = e.fullscreen ? document.body : e.target, z(e.parent__, Oe), e.parent__.appendChild(t.$el), t;
  };
  Te.install = function (e) {
    e.prototype.$veLoading = Te;
  };
  var De = Te,
    _e = n(137),
    Ae = n.n(_e),
    Pe = me.a.util.defineReactive,
    Be = me.a.prototype;
  Be.$veTableMessages = Be.$veTableMessages || {}, Pe(Be, "$veTableMessages", Object(Y.cloneDeep)({
    lang: Ae.a
  }));
  var je = {
      getMessage: function () {
        return Be.$veTableMessages.lang;
      },
      use: function (e) {
        this.update(e);
      },
      update: function () {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
        Object(Y.merge)(Be.$veTableMessages.lang, e);
      }
    },
    Me = (n(29), "on-page-number-change"),
    Ve = "on-page-size-change";
  function Ne(e) {
    return "ve-pagination-" + e;
  }
  var Fe = r("pagination"),
    Le = {
      props: {
        pageCount: {
          type: Number,
          required: !0
        },
        pageIndex: {
          type: Number,
          required: !0
        },
        pagingCount: {
          type: Number,
          required: !0
        }
      },
      computed: {
        numOffset: function () {
          return Math.floor((this.pagingCount + 2) / 2) - 1;
        },
        showJumpPrev: function () {
          return this.pageCount > this.pagingCount + 2 && this.pageIndex > this.pagingCount;
        },
        showJumpNext: function () {
          return this.pageCount > this.pagingCount + 2 && this.pageIndex <= this.pageCount - this.pagingCount;
        },
        pagingCounts: function () {
          var e = [],
            t = this.showJumpPrev,
            n = this.showJumpNext;
          if (t && !n) for (var o = this.pageCount - this.pagingCount; o < this.pageCount; o++) e.push(o);else if (!t && n) for (var i = 2; i < this.pagingCount + 2; i++) e.push(i);else if (t && n) for (var r = this.pageIndex - this.numOffset; r <= this.pageIndex + this.numOffset; r++) e.push(r);else for (var l = 2; l < this.pageCount; l++) e.push(l);
          return e;
        }
      },
      methods: {
        jumpPage: function (e) {
          this.$emit("jumpPageHandler", e);
        }
      },
      render: function () {
        var e = arguments[0],
          t = this.pageIndex,
          n = this.jumpPage,
          o = this.showJumpPrev,
          i = this.pagingCount,
          r = this.pagingCounts,
          l = this.showJumpNext,
          a = this.pageCount;
        return e("span", {
          class: Ne("pager")
        }, [e("li", {
          class: [1 === t ? Ne("li-active") : "", Ne("li")],
          on: {
            click: function () {
              return n(1);
            }
          }
        }, [e("a", ["1"])]), o && e("li", {
          class: [1 === t ? "disabled" : "", Ne("li"), Ne("jump-prev")],
          attrs: {
            title: Fe("prev5", i)
          },
          on: {
            click: function () {
              return n(t - i);
            }
          }
        }, [e("a", [e(k.a, {
          attrs: {
            name: F.DOUBLE_LEFT_ARROW
          }
        })])]), r.map(function (o, i) {
          return e("li", {
            key: i,
            class: [o === t ? Ne("li-active") : "", Ne("li")],
            on: {
              click: function () {
                return n(o);
              }
            }
          }, [e("a", [o])]);
        }), l && e("li", {
          class: [Ne("li"), Ne("jump-next")],
          attrs: {
            title: Fe("next5", i)
          },
          on: {
            click: function () {
              return n(t + i);
            }
          }
        }, [e("a", [e(k.a, {
          attrs: {
            name: F.DOUBLE_RIGHT_ARROW
          }
        })])]), a > 1 && e("li", {
          class: [t === a ? Ne("li-active") : "", Ne("li")],
          on: {
            click: function () {
              return n(a);
            }
          }
        }, [e("a", [a])])]);
      }
    },
    He = n(138),
    We = n.n(He),
    ze = r("pagination"),
    $e = {
      name: "VePagination",
      components: {
        Total: {
          render: function () {
            var e = arguments[0];
            return e("span", {
              class: Ne("total")
            }, [ze("total", this.$parent.total)]);
          }
        },
        Prev: {
          render: function () {
            var e = arguments[0];
            return e("li", {
              on: {
                click: this.$parent.prevPage
              },
              class: [1 === this.$parent.newPageIndex ? Ne("disabled") : "", Ne("li"), Ne("prev")]
            }, [e("a", [e(k.a, {
              attrs: {
                name: F.LEFT_ARROW
              }
            })])]);
          }
        },
        Pager: Le,
        Next: {
          render: function () {
            var e = arguments[0];
            return e("li", {
              on: {
                click: this.$parent.nextPage
              },
              class: [this.$parent.newPageIndex === this.$parent.pageCount ? Ne("disabled") : "", Ne("li"), Ne("next")]
            }, [e("a", [e(k.a, {
              attrs: {
                name: F.RIGHT_ARROW
              }
            })])]);
          }
        },
        Sizer: {
          render: function () {
            var e = arguments[0];
            return e(We.a, {
              class: Ne("select"),
              attrs: {
                value: this.$parent.newPageSizeOption,
                popperAppendTo: this.$parent.popperAppendTo
              },
              on: {
                input: this.handleChange
              }
            });
          },
          methods: {
            handleChange: function (e) {
              if (Array.isArray(e) && e.length > 0) {
                var t = e.find(function (e) {
                  return e.selected;
                });
                t && this.$parent.pageSizeChangeHandler(t.value);
              }
            }
          }
        },
        Jumper: {
          methods: {
            jumperEnter: function (e) {
              if (13 === e.keyCode) {
                var t = this.$parent.getValidNum(e.target.value);
                e.target.value = t, this.$parent.jumpPageHandler(t);
              }
            }
          },
          render: function () {
            var e = arguments[0];
            return e("span", {
              class: Ne("goto")
            }, [" ", ze("goto"), " ", e("input", {
              class: Ne("goto-input"),
              domProps: {
                value: this.$parent.newPageIndex
              },
              on: {
                keyup: this.jumperEnter
              },
              attrs: {
                type: "input"
              }
            }), " ", ze("page"), " "]);
          }
        }
      },
      props: {
        layout: {
          type: Array,
          default: function () {
            return ["total", "prev", "pager", "next", "sizer", "jumper"];
          }
        },
        total: {
          type: Number,
          required: !0
        },
        pageIndex: {
          type: Number,
          default: 1
        },
        pagingCount: {
          type: Number,
          default: 5
        },
        pageSize: {
          type: Number,
          default: 10
        },
        pageSizeOption: {
          type: Array,
          default: function () {
            return [10, 20, 30];
          }
        },
        popperAppendTo: {
          type: [String, HTMLElement],
          default: function () {
            return document.body;
          }
        }
      },
      data: function () {
        return {
          newPageIndex: this.pageIndex && this.pageIndex > 0 ? parseInt(this.pageIndex) : 1,
          newPageSize: this.pageSize
        };
      },
      computed: {
        pageCount: function () {
          return Math.ceil(this.total / this.newPageSize);
        },
        newPageSizeOption: function () {
          var e = this;
          return this.pageSizeOption.map(function (t) {
            var n = {};
            return n.value = t, n.label = t + ze("itemsPerPage"), e.newPageSize == t && (n.selected = !0), n;
          });
        }
      },
      watch: {
        pageIndex: function (e) {
          this.newPageIndex = e;
        },
        pageSize: function (e) {
          this.newPageSize = e;
        }
      },
      methods: {
        getValidNum: function (e) {
          return e = parseInt(e, 10), isNaN(e) || e < 1 || e < 1 ? 1 : e > this.pageCount ? this.pageCount : e;
        },
        jumpPageHandler: function (e) {
          this.newPageIndex = e, this.$emit(Me, this.newPageIndex);
        },
        prevPage: function () {
          this.newPageIndex > 1 && (this.newPageIndex = this.newPageIndex - 1, this.$emit(Me, this.newPageIndex));
        },
        nextPage: function () {
          this.newPageIndex < this.pageCount && (this.newPageIndex = this.newPageIndex + 1, this.$emit(Me, this.newPageIndex));
        },
        pageSizeChangeHandler: function () {
          var e = this.newPageSizeOption.find(function (e) {
            return e.selected;
          });
          e && (this.newPageSize = e.value, this.newPageIndex = 1, this.$emit(Ve, this.newPageSize));
        },
        goBackPageIndex: function () {
          this.newPageIndex = this.pageIndex && this.pageIndex > 0 ? parseInt(this.pageIndex) : 1;
        },
        goBackPageSize: function () {
          this.pageSize > 0 && (this.newPageSize = this.pageSize);
        }
      },
      render: function () {
        var e = arguments[0],
          t = e("ul", {
            class: "ve-pagination"
          }),
          n = {
            total: e("total"),
            prev: e("prev"),
            pager: e("pager", {
              attrs: {
                pageCount: this.pageCount,
                pageIndex: this.newPageIndex,
                pagingCount: this.pagingCount
              },
              on: {
                jumpPageHandler: this.jumpPageHandler
              }
            }),
            next: e("next"),
            sizer: e("sizer"),
            jumper: e("jumper", {
              on: {
                jumpPageHandler: this.jumpPageHandler
              }
            })
          };
        return t.children = t.children || [], this.layout.forEach(function (e) {
          t.children.push(n[e]);
        }), t;
      },
      install: function (e) {
        e.component($e.name, $e);
      }
    },
    qe = $e,
    Ge = "on-radio-change";
  function Ue(e) {
    return "ve-radio-" + e;
  }
  function Xe(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var Ye = {
      name: "VeRadio",
      props: {
        value: {
          type: [String, Number, Boolean],
          default: null
        },
        label: {
          type: String,
          default: null
        },
        disabled: Boolean,
        isControlled: {
          type: Boolean,
          default: !1
        },
        isSelected: {
          type: Boolean,
          default: !1
        }
      },
      data: function () {
        return {
          model: this.value
        };
      },
      computed: {
        radioClass: function () {
          var e;
          return [Ue("container"), (e = {}, Xe(e, Ue("checked"), this.internalIsSelected), Xe(e, Ue("disabled"), this.disabled), e)];
        },
        internalIsSelected: function () {
          return this.isControlled ? this.isSelected : this.model;
        }
      },
      watch: {
        value: function () {
          this.updateModelBySingle();
        }
      },
      methods: {
        checkedChange: function (e) {
          if (this.disabled) return !1;
          var t = e.target.checked;
          this.isControlled || this.$emit("input", t), this.$emit(Ge, t);
        },
        getLabelContent: function () {
          var e = this.label,
            t = this.$slots;
          return e || t.default;
        },
        initModel: function () {
          this.model = this.value;
        },
        updateModelBySingle: function () {
          this.disabled || (this.model = this.value);
        }
      },
      created: function () {
        this.initModel();
      },
      render: function () {
        var e = arguments[0],
          t = this.label,
          n = this.radioClass,
          o = this.checkedChange,
          i = this.getLabelContent,
          r = this.internalIsSelected;
        return e("label", {
          class: "ve-radio"
        }, [e("span", {
          class: n
        }, [e("input", {
          domProps: {
            checked: r,
            value: t
          },
          class: Ue("input"),
          attrs: {
            type: "radio"
          },
          on: {
            change: o
          }
        }), e("span", {
          class: Ue("inner")
        })]), e("span", {
          class: Ue("label")
        }, [i()])]);
      },
      install: function (e) {
        e.component(Ye.name, Ye);
      }
    },
    Je = Ye,
    Qe = n(44),
    Ze = n.n(Qe),
    et = "on-select-change";
  function tt(e) {
    return "ve-select-" + e;
  }
  function nt(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var ot = {
      name: "VeSelect",
      props: {
        width: {
          type: Number,
          default: 90
        },
        maxWidth: {
          type: Number,
          default: 0
        },
        isMultiple: {
          type: Boolean,
          default: !1
        },
        value: {
          type: Array,
          default: null
        },
        placeholder: {
          type: String,
          default: "请选择",
          validator: function (e) {
            return e.length > 0;
          }
        },
        textAlign: {
          type: String,
          default: "left"
        },
        isInput: {
          type: Boolean,
          default: !1
        },
        popperAppendTo: {
          type: [String, HTMLElement],
          default: function () {
            return document.body;
          }
        }
      },
      data: function () {
        return {
          visible: !1,
          internalOptions: [],
          inputValue: "",
          dropdownVisible: !1
        };
      },
      computed: {
        iconClass: function () {
          var e;
          return nt(e = {}, tt("show"), this.dropdownVisible), nt(e, tt("toggle-icon"), !0), e;
        }
      },
      watch: {
        value: function () {
          this.init();
        }
      },
      methods: {
        init: function () {
          this.internalOptions = Object.assign([], this.value);
        },
        showSelectInfo: function () {
          var e;
          return e = this.selectedLabels(), Array.isArray(e) && e.length > 0 ? e.join() : this.placeholder;
        },
        selectedLabels: function () {
          return this.internalOptions.filter(function (e) {
            return e.selected;
          }).map(function (e) {
            if (e.selected) return e.label;
          });
        },
        dropdownChange: function () {
          this.$emit("input", this.internalOptions), this.$emit(et, this.internalOptions);
        }
      },
      created: function () {
        this.init();
      },
      render: function () {
        var e = this,
          t = arguments[0],
          n = this.isInput,
          o = {
            class: "ve-select",
            props: {
              isSelect: !0,
              width: this.width,
              maxWidth: this.maxWidth,
              isMultiple: this.isMultiple,
              textAlign: this.textAlign,
              isInput: this.isInput,
              value: this.internalOptions,
              hideByItemClick: !0,
              popperAppendTo: this.popperAppendTo
            },
            style: {
              width: this.width
            },
            on: {
              input: function (t) {
                e.internalOptions = t, e.dropdownChange();
              },
              "dropdown-visible-change": function (t) {
                e.dropdownVisible = t;
              }
            }
          },
          i = "";
        return i = n ? t("input", {
          class: tt("input"),
          attrs: {
            placeholder: this.placeholder,
            type: "text"
          },
          directives: [{
            name: "model",
            value: this.inputValue
          }]
        }) : t("span", {
          class: tt("selected-span")
        }, [this.showSelectInfo()]), t(Ze.a, o, [t("span", [i, t(k.a, {
          attrs: {
            name: F.BOTTOM_ARROW
          },
          class: this.iconClass
        })])]);
      },
      install: function (e) {
        e.component(ot.name, ot);
      }
    },
    it = ot,
    rt = (n(26), n(73), n(36), n(124), n(162), n(164), "expand"),
    lt = "checkbox",
    at = "radio",
    st = "left",
    ct = "right",
    ut = "icon",
    dt = "cell",
    ht = "row",
    ft = "up",
    pt = "right",
    yt = "down",
    vt = "left",
    gt = "up",
    mt = "right",
    wt = "down",
    Ct = "left",
    bt = "single",
    xt = "range",
    Rt = "on-body-cell-width-change",
    St = "on-header-row-height-change",
    Ot = "on-footer-row-height-change",
    Kt = "on-body-row-height-change",
    It = "on-body-row-click",
    Et = "on-body-cell-click",
    kt = "on-body-cell-mouseover",
    Tt = "on-body-cell-mousedown",
    Dt = "on-body-cell-mousemove",
    _t = "on-body-cell-mouseup",
    At = "on-body-cell-double-click",
    Pt = "on-body-cell-contextmenu",
    Bt = "on-expand-row-change",
    jt = "on-checkbox-selected-row-change",
    Mt = "on-checkbox-selected-all-change",
    Vt = "on-checkbox-selected-all-info",
    Nt = "on-radio-selected-row-change",
    Ft = "on-sort-change",
    Lt = "on-cell-selection-range-data-change",
    Ht = "on-filter-confirm",
    Wt = "on-filter-reset",
    zt = "on-header-cell-click",
    $t = "on-header-cell-contextmenu",
    qt = "on-header-cell-mousedown",
    Gt = "on-header-cell-mouseover",
    Ut = "on-header-cell-mousemove",
    Xt = "on-header-cell-mouseleave",
    Yt = "on-highlight-row-change",
    Jt = "on-edit-input-click",
    Qt = "on-edit-input-value-change",
    Zt = "on-edit-input-copy",
    en = "on-edit-input-paste",
    tn = "on-edit-input-cut",
    nn = "selection-corner-mousedown",
    on = "selection-corner-mouseup",
    rn = "autofilling-direction-change",
    ln = "table-container-scroll",
    an = "table-size-change",
    sn = "table-cell-width-change",
    cn = "clipboard-cell-value-change",
    un = "header-cell-mousemove",
    dn = "body-cell-mousemove",
    hn = "VeTable",
    fn = "VeTableHeader",
    pn = "VeTableHeaderTr",
    yn = "VeTableHeaderTh",
    vn = "VeTableHeaderCheckboxContent",
    gn = "VeTableHeaderFilterContent",
    mn = "VeTableHeaderFilterCustomContent",
    wn = "VeTableBody",
    Cn = "VeTableBodyTr",
    bn = "VeTableBodyTrScrolling",
    xn = "VeTableBodyCheckboxContent",
    Rn = "VeTableBodyRadioContent",
    Sn = "VeTableBodyTd",
    On = "VeTableColgroup",
    Kn = "VeTableFooter",
    In = "VeTableExpandTr",
    En = "VeTableExpandTrIcon",
    kn = "VeTableEditInput",
    Tn = "VeTableSelection",
    Dn = "VeTableColumnResizer",
    _n = "row-key",
    An = "col-key",
    Pn = "scrollTo",
    Bn = "scrollToRowKey",
    jn = "scrollToColKey",
    Mn = "startEditingCell",
    Vn = "stopEditingCell",
    Nn = "setHighlightRow",
    Fn = "setCellSelection",
    Ln = "setRangeCellSelection",
    Hn = "getRangeCellSelection",
    Wn = "setAllCellSelection",
    zn = "hideColumnsByKeys",
    $n = "showColumnsByKeys",
    qn = "headerContextmenu",
    Gn = "bodyContextmenu",
    Un = {
      SEPARATOR: "SEPARATOR",
      CUT: "CUT",
      COPY: "COPY",
      INSERT_ROW_ABOVE: "INSERT_ROW_ABOVE",
      INSERT_ROW_BELOW: "INSERT_ROW_BELOW",
      REMOVE_ROW: "REMOVE_ROW",
      EMPTY_ROW: "EMPTY_ROW",
      EMPTY_COLUMN: "EMPTY_COLUMN",
      EMPTY_CELL: "EMPTY_CELL",
      LEFT_FIXED_COLUMN_TO: "LEFT_FIXED_COLUMN_TO",
      CANCEL_LEFT_FIXED_COLUMN_TO: "CANCEL_LEFT_FIXED_COLUMN_TO",
      RIGHT_FIXED_COLUMN_TO: "RIGHT_FIXED_COLUMN_TO",
      CANCEL_RIGHT_FIXED_COLUMN_TO: "CANCEL_RIGHT_FIXED_COLUMN_TO"
    };
  function Xn(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  function Yn(e) {
    return "ve-table-" + e;
  }
  function Jn(e, t) {
    var n = null;
    return e && t && (n = e[t]), n;
  }
  function Qn(e, t) {
    return e ? t.find(function (t) {
      return t.key === e;
    }) : null;
  }
  function Zn(e, t) {
    if (!a(e) && !l(t)) {
      var n = t[0];
      if (n.key === e && n.operationColumn) return !0;
    }
    return !1;
  }
  function eo(e, t) {
    var n = e;
    return (n || 0 == n) && (n = e + "@" + t), n;
  }
  function to(e) {
    var t = e.colgroups,
      n = e.colKey,
      o = e.fixed,
      i = t.findIndex(function (e) {
        return e.key === n;
      }),
      r = 0;
    return o === st ? r = t.reduce(function (e, t, n) {
      return n < i && t.fixed == st ? t._realTimeWidth + e : e;
    }, 0) : o === ct && (r = t.reduce(function (e, t, n) {
      return n > i && t.fixed == ct ? t._realTimeWidth + e : e;
    }, 0)), r;
  }
  function no(e) {
    var t = e.colgroups,
      n = e.colKey,
      o = e.fixed,
      i = t.findIndex(function (e) {
        return e.key === n;
      }),
      r = 0;
    return o === st ? r = t.reduce(function (e, t, n) {
      return n < i && !t.fixed ? t._realTimeWidth + e : e;
    }, 0) : o === ct && (r = t.reduce(function (e, t, n) {
      return n > i && !t.fixed ? t._realTimeWidth + e : e;
    }, 0)), r;
  }
  function oo(e) {
    var t = e.colKeys;
    return e.colgroups.reduce(function (e, n, o) {
      return t.indexOf(n.key) > -1 ? n._realTimeWidth + e : e;
    }, 0);
  }
  function io(e) {
    var t = [],
      n = [],
      o = 1;
    e.forEach(function (e) {
      e._level = 1, function e(t, n) {
        n && (t._level = n._level + 1, o < t._level && (o = t._level)), t.children && t.children.forEach(function (n) {
          n.fixed = t.fixed, e(n, t);
        });
      }(e);
    });
    e.forEach(function (e) {
      !function e(t) {
        if (t.children) {
          var n = "",
            i = 0;
          t.children.forEach(function (t) {
            e(t), i += t._colspan, n += t._keys.endsWith("|") ? t._keys : t._keys + "|";
          }), t._keys = n, t._colspan = i, t._rowspan = 1;
        } else t._keys = t.key, t._colspan = 1, t._rowspan = o - t._level + 1;
      }(e);
    });
    for (var i = 0; i < o; i++) n.push([]);
    return e.forEach(function (e) {
      !function e(o) {
        if (!l(o.children) || !a(o.key)) {
          var i = Object.assign({}, o);
          if (n[o._level - 1].push(i), o.children) o.children.forEach(function (t) {
            e(t);
          });else {
            var r = Object.assign({}, o);
            r._realTimeWidth = r.width, t.push(r);
          }
        }
      }(e);
    }), {
      isGroupHeader: o > 1,
      colgroups: t,
      groupColumns: n
    };
  }
  function ro(e) {
    var t = e.column,
      n = e.contextmenuHeaderOption,
      o = e.cellSelectionRangeData,
      i = e.colgroups,
      r = e.allRowKeys,
      l = e.headerIndicatorColKeys,
      s = e.enableHeaderContextmenu,
      u = e.t,
      d = [];
    if (s) {
      var h = yo({
          cellSelectionRangeData: o
        }),
        f = vo({
          cellSelectionRangeData: o,
          colgroups: i,
          allRowKeys: r
        }),
        p = Zn(t.key, i),
        y = f.endColIndex - f.startColIndex + 1,
        v = n.contextmenus,
        g = n.beforeShow,
        m = !a(l.startColKey),
        w = ho({
          fixedType: st,
          colgroups: i,
          isExcludeOperationColumn: !0
        }),
        C = ho({
          fixedType: ct,
          colgroups: i,
          isExcludeOperationColumn: !0
        });
      c(g) && g({
        isWholeColSelection: m,
        selectionRangeKeys: h,
        selectionRangeIndexes: f
      });
      var b = function (e) {
        return [{
          type: Un.SEPARATOR
        }, {
          label: e("cut"),
          type: Un.CUT
        }, {
          label: e("copy"),
          type: Un.COPY
        }, {
          label: e("removeColumn"),
          type: Un.REMOVE_COLUMN
        }, {
          label: e("emptyColumn"),
          type: Un.EMPTY_COLUMN
        }, {
          label: e("hideColumn"),
          type: Un.HIDE_COLUMN
        }, {
          label: e("leftFixedColumnTo"),
          type: Un.LEFT_FIXED_COLUMN_TO
        }, {
          label: e("cancelLeftFixedColumnTo"),
          type: Un.CANCEL_LEFT_FIXED_COLUMN_TO
        }, {
          label: e("rightFixedColumnTo"),
          type: Un.RIGHT_FIXED_COLUMN_TO
        }, {
          label: e("cancelRightFixedColumnTo"),
          type: Un.CANCEL_RIGHT_FIXED_COLUMN_TO
        }];
      }(u);
      v.forEach(function (e) {
        var t = b.find(function (t) {
          return t.type === e.type;
        });
        if (t) {
          var n = !0;
          t.type === Un.EMPTY_COLUMN ? m ? t.label = t.label.replace("$1", y) : n = !1 : t.type === Un.LEFT_FIXED_COLUMN_TO ? p && (t.disabled = !0) : t.type === Un.CANCEL_LEFT_FIXED_COLUMN_TO ? w.length < 1 && (t.disabled = !0) : t.type === Un.RIGHT_FIXED_COLUMN_TO ? p && (t.disabled = !0) : t.type === Un.CANCEL_RIGHT_FIXED_COLUMN_TO && C.length < 1 && (t.disabled = !0), n && d.push(t);
        } else d.push(e);
      });
    }
    return d;
  }
  function lo(e) {
    var t = e.enableBodyContextmenu,
      n = e.contextmenuBodyOption,
      o = e.cellSelectionRangeData,
      i = e.colgroups,
      r = e.allRowKeys,
      l = e.bodyIndicatorRowKeys,
      s = e.t,
      u = [];
    if (t) {
      var d = yo({
          cellSelectionRangeData: o
        }),
        h = vo({
          cellSelectionRangeData: o,
          colgroups: i,
          allRowKeys: r
        }),
        f = h.endRowIndex - h.startRowIndex + 1,
        p = h.endColIndex - h.startColIndex + 1,
        y = n.contextmenus,
        v = n.beforeShow,
        g = !a(l.startRowKey);
      c(v) && v({
        isWholeRowSelection: g,
        selectionRangeKeys: d,
        selectionRangeIndexes: h
      });
      var m = function (e) {
        return [{
          type: Un.SEPARATOR
        }, {
          label: e("cut"),
          type: Un.CUT
        }, {
          label: e("copy"),
          type: Un.COPY
        }, {
          label: e("insertRowAbove"),
          type: Un.INSERT_ROW_ABOVE
        }, {
          label: e("insertRowBelow"),
          type: Un.INSERT_ROW_BELOW
        }, {
          label: e("removeRow"),
          type: Un.REMOVE_ROW
        }, {
          label: e("emptyRow"),
          type: Un.EMPTY_ROW
        }, {
          label: e("removeColumn"),
          type: Un.REMOVE_COLUMN
        }, {
          label: e("emptyCell"),
          type: Un.EMPTY_CELL
        }];
      }(s);
      y.forEach(function (e) {
        var t = m.find(function (t) {
          return t.type === e.type;
        });
        if (t) {
          var n = !0;
          t.type === Un.REMOVE_ROW ? t.label = t.label.replace("$1", f) : t.type === Un.EMPTY_ROW ? g ? t.label = t.label.replace("$1", f) : n = !1 : t.type === Un.EMPTY_CELL ? n = !g : t.type === Un.REMOVE_COLUMN && (g ? n = !1 : t.label = t.label.replace("$1", p)), n && u.push(t);
        } else u.push(e);
      });
    }
    return u;
  }
  function ao(e) {
    var t = e.colgroups,
      n = Xn({}, e.rowKeyFieldName, X());
    return t.forEach(function (e) {
      e.field && (n[e.field] = "");
    }), n;
  }
  function so(e) {
    var t = null;
    return (t = e.headerColumnItem._keys.split("|")).length > 1 && (t = t.slice(0, t.length - 1)), t;
  }
  function co(e) {
    var t = e.colKey1,
      n = e.colKey2,
      o = e.colgroups,
      i = null,
      r = o.findIndex(function (e) {
        return e.key === t;
      }),
      l = o.findIndex(function (e) {
        return e.key === n;
      });
    if (-1 !== r && -1 !== r) {
      var a = r < l ? r : l,
        s = r < l ? l : r;
      i = o.slice(a, s + 1).map(function (e) {
        return e.key;
      });
    }
    return i;
  }
  function uo(e) {
    var t = e.colKeys,
      n = e.fixedType,
      o = e.colgroups,
      i = null;
    return Array.isArray(t) && (i = o.filter(function (e) {
      return t.indexOf(e.key) > -1 && e.fixed === n;
    }).map(function (e) {
      return e.key;
    })), i;
  }
  function ho(e) {
    var t = e.fixedType,
      n = e.colgroups,
      o = e.isExcludeOperationColumn;
    return n.filter(function (e) {
      var n = e.fixed === t;
      return o ? n && !e.operationColumn : n;
    }).map(function (e) {
      return e.key;
    });
  }
  function fo(e) {
    var t = e.topRowKey,
      n = e.bottomRowKey,
      o = e.allRowKeys,
      i = null,
      r = o.findIndex(function (e) {
        return e === t;
      }),
      l = o.findIndex(function (e) {
        return e === n;
      });
    return -1 !== r && -1 !== l && (i = o.slice(r, l + 1)), i;
  }
  function po(e) {
    var t = e.cellData,
      n = e.cellSelectionRangeData,
      o = e.colgroups,
      i = e.allRowKeys,
      r = n.leftColKey,
      l = n.rightColKey,
      a = n.topRowKey,
      s = n.bottomRowKey,
      c = co({
        colKey1: r,
        colKey2: l,
        colgroups: o
      }),
      u = fo({
        topRowKey: a,
        bottomRowKey: s,
        allRowKeys: i
      });
    return c.indexOf(t.colKey) > -1 && u.indexOf(t.rowKey) > -1;
  }
  function yo(e) {
    var t = e.cellSelectionRangeData;
    return {
      startColKey: t.leftColKey,
      endColKey: t.rightColKey,
      startRowKey: t.topRowKey,
      endRowKey: t.bottomRowKey
    };
  }
  function vo(e) {
    var t = e.cellSelectionRangeData,
      n = e.colgroups,
      o = e.allRowKeys,
      i = t.leftColKey,
      r = t.rightColKey,
      l = t.topRowKey,
      a = t.bottomRowKey;
    return {
      startColIndex: n.findIndex(function (e) {
        return e.key === i;
      }),
      endColIndex: n.findIndex(function (e) {
        return e.key === r;
      }),
      startRowIndex: o.indexOf(l),
      endRowIndex: o.indexOf(a)
    };
  }
  function go(e) {
    var t = e.cellSelectionRangeData,
      n = e.resultType,
      o = void 0 === n ? "normal" : n,
      i = e.tableData,
      r = e.colgroups,
      l = e.allRowKeys,
      a = t.leftColKey,
      s = t.rightColKey,
      c = t.topRowKey,
      u = t.bottomRowKey,
      d = r.findIndex(function (e) {
        return e.key === a;
      }),
      h = r.findIndex(function (e) {
        return e.key === s;
      }),
      f = l.indexOf(c),
      p = l.indexOf(u),
      y = r.slice(d, h + 1).map(function (e) {
        return e.field;
      });
    return "normal" === o ? i.slice(f, p + 1).map(function (e) {
      var t = {};
      return y.forEach(function (n) {
        var o;
        t[n] = null !== (o = e[n]) && void 0 !== o ? o : "";
      }), t;
    }) : i.slice(f, p + 1).map(function (e) {
      var t = [];
      return y.forEach(function (n) {
        var o;
        t.push(null !== (o = e[n]) && void 0 !== o ? o : "");
      }), t;
    });
  }
  function mo(e) {
    var t = e.fixedType,
      n = e.colKeys,
      o = e.colgroups,
      i = !1;
    return Array.isArray(n) && (i = o.some(function (e) {
      return n.indexOf(e.key) > -1 && e.fixed === t;
    })), i;
  }
  function wo(e) {
    var t = e.colKeys,
      n = e.colgroups,
      o = !1;
    return Array.isArray(t) && (o = n.filter(function (e) {
      return !e.fixed && t.indexOf(e.key) > -1;
    }).length), o;
  }
  function Co(e) {
    var t = e.type,
      n = e.colgroups,
      o = e.colKeys,
      i = null;
    if (Array.isArray(o) && o.length) {
      var r = {
        colKey: null,
        colIndex: null
      };
      o.forEach(function (e) {
        var o = n.findIndex(function (t) {
          return t.key === e;
        });
        if (-1 === o) return console.warn("getLeftmostOrRightmostColKey error:: can't find colKey:".concat(e)), !1;
        a(r.colKey) ? r = {
          colKey: e,
          colIndex: o
        } : "leftmost" === t ? o < r.colIndex && (r = {
          colKey: e,
          colIndex: o
        }) : "rightmost" === t && o > r.colIndex && (r = {
          colKey: e,
          colIndex: o
        });
      }), i = r.colKey;
    }
    return i;
  }
  function bo(e) {
    return Co({
      type: "leftmost",
      colgroups: e.colgroups,
      colKeys: e.colKeys
    });
  }
  function xo(e) {
    var t,
      n = e.isReplaceData,
      o = e.tableData,
      i = e.allRowKeys,
      r = e.colgroups,
      l = e.direction,
      a = e.rowKeyFieldName,
      s = e.cellSelectionRangeData,
      c = e.nextCurrentCell,
      u = e.nextNormalEndCell,
      d = s.leftColKey,
      h = s.rightColKey,
      f = s.topRowKey,
      p = s.bottomRowKey,
      y = {
        startRowIndex: -1,
        endRowIndex: -1,
        startColIndex: -1,
        endColIndex: -1
      },
      v = {
        startRowIndex: -1,
        endRowIndex: -1,
        startColIndex: -1,
        endColIndex: -1
      };
    if (y.startRowIndex = i.indexOf(f), y.endRowIndex = i.indexOf(p), y.startColIndex = r.findIndex(function (e) {
      return e.key === d;
    }), y.endColIndex = r.findIndex(function (e) {
      return e.key === h;
    }), t = o.slice(y.startRowIndex, y.endRowIndex + 1), l === gt) {
      if (v.startRowIndex = i.indexOf(c.rowKey), v.endRowIndex = y.startRowIndex - 1, v.startColIndex = y.startColIndex, v.endColIndex = y.endColIndex, n) for (var g = t.length - 1, m = v.endRowIndex; m >= v.startRowIndex; m--) {
        for (var w = v.startColIndex; w <= v.endColIndex; w++) {
          var C = r[w].field;
          g < 0 && (g = t.length - 1), o[m][C] = t[g][C];
        }
        --g;
      }
    } else if (l === wt) {
      if (v.startRowIndex = y.endRowIndex + 1, v.endRowIndex = i.indexOf(u.rowKey), v.startColIndex = y.startColIndex, v.endColIndex = y.endColIndex, n) for (var b = 0, x = v.startRowIndex; x <= v.endRowIndex; x++) {
        for (var R = v.startColIndex; R <= v.endColIndex; R++) {
          var S = r[R].field;
          b > t.length - 1 && (b = 0), o[x][S] = t[b][S];
        }
        ++b;
      }
    } else if (l === Ct) {
      if (v.startRowIndex = y.startRowIndex, v.endRowIndex = y.endRowIndex, v.startColIndex = r.findIndex(function (e) {
        return e.key === c.colKey;
      }), v.endColIndex = y.startColIndex - 1, n) for (var O = 0, K = v.startRowIndex; K <= v.endRowIndex; K++) {
        for (var I = y.endColIndex, E = v.endColIndex; E >= v.startColIndex; E--) {
          var k = r[E].field;
          I < y.startColIndex && (I = y.endColIndex), o[K][k] = t[O][r[I].field], --I;
        }
        ++O;
      }
    } else if (l === mt && (v.startRowIndex = y.startRowIndex, v.endRowIndex = y.endRowIndex, v.startColIndex = y.endColIndex + 1, v.endColIndex = r.findIndex(function (e) {
      return e.key === u.colKey;
    }), n)) for (var T = 0, D = v.startRowIndex; D <= v.endRowIndex; D++) {
      for (var _ = y.startColIndex, A = v.startColIndex; A <= v.endColIndex; A++) {
        var P = r[A].field;
        _ > y.startColIndex + (y.endColIndex - y.startColIndex) && (_ = y.startColIndex), o[D][P] = t[T][r[_].field], ++_;
      }
      ++T;
    }
    var B = {
        direction: l,
        sourceSelectionRangeIndexes: y,
        targetSelectionRangeIndexes: v,
        sourceSelectionData: [],
        targetSelectionData: []
      },
      j = r.slice(y.startColIndex, y.endColIndex + 1).map(function (e) {
        return e.field;
      });
    B.sourceSelectionData = o.slice(y.startRowIndex, y.endRowIndex + 1).map(function (e) {
      var t = Xn({}, a, e[a]);
      return j.forEach(function (n) {
        t[n] = e[n];
      }), t;
    });
    var M = r.slice(v.startColIndex, v.endColIndex + 1).map(function (e) {
      return e.field;
    });
    return B.targetSelectionData = o.slice(v.startRowIndex, v.endRowIndex + 1).map(function (e) {
      var t = Xn({}, a, e[a]);
      return M.forEach(function (n) {
        t[n] = e[n];
      }), t;
    }), B;
  }
  function Ro(e) {
    var t,
      n = e.cloneColumns,
      o = e.cellSelectionRangeData,
      i = e.fixedType,
      r = e.colgroups,
      l = e.enableColumnResize,
      s = n,
      c = o.leftColKey,
      u = o.rightColKey;
    st === i ? t = u : ct === i && (t = c);
    var d = n.findIndex(function (e) {
      return 1 === e._level && e.key === t || so({
        headerColumnItem: e
      }).indexOf(t) > -1 || void 0;
    });
    if (d > -1) {
      var h = n[d].fixed;
      if (!a(h) && h !== i) return !1;
      s = n.map(function (e, t) {
        if (e.fixed === i && (e.fixed = ""), l && (!Array.isArray(e.children) || !e.children.length)) {
          var o = r.find(function (t) {
            return t.key === e.key && !a(t.key);
          });
          o && (e.width = o._columnResizeWidth);
        }
        return st === i ? t <= d && t < n.length && (e.fixed = i) : t >= d && t > 0 && (e.fixed = i), e;
      });
    }
    return s;
  }
  function So(e) {
    var t = e.cloneColumns,
      n = e.colgroups,
      o = e.fixedType,
      i = e.enableColumnResize;
    return t.map(function (e) {
      if (i && (!Array.isArray(e.children) || !e.children.length)) {
        var t = n.find(function (t) {
          return t.key === e.key && !a(t.key);
        });
        t && (e.width = t._columnResizeWidth);
      }
      return st === o ? e.fixed !== o || Zn(e.key, n) || (e.fixed = "") : e.fixed === o && (e.fixed = ""), e;
    });
  }
  n(165), n(166), n(167);
  var Oo = /^(\r\n|\n\r|\r|\n)/,
    Ko = /^[^\t\r\n]+/,
    Io = /^\t/;
  function Eo(e) {
    var t,
      n,
      o,
      i,
      r,
      l = "";
    for (t = 0, n = e.length; t < n; t += 1) {
      for (i = e[t].length, o = 0; o < i; o += 1) o > 0 && (l += "\t"), "string" == typeof (r = e[t][o]) ? r.indexOf("\n") > -1 ? l += '"'.concat(r.replace(/"/g, '""'), '"') : l += r : l += null == r ? "" : r;
      t !== n - 1 && (l += "\n");
    }
    return l;
  }
  function ko(e) {
    var t,
      n = e.event,
      o = e.cellSelectionRangeData,
      i = e.colgroups,
      r = e.allRowKeys;
    if (n.clipboardData ? t = n.clipboardData.getData("text/plain") : window.clipboardData && (t = window.clipboardData.getData("Text")), "string" != typeof t) return null;
    var l = function (e) {
        var t = [[""]];
        if (0 === e.length) return t;
        for (var n, o = 0, i = 0; e.length > 0 && n !== e.length;) if (n = e.length, e.match(Io)) e = e.replace(Io, ""), o += 1, t[i][o] = "";else if (e.match(Oo)) e = e.replace(Oo, ""), o = 0, t[i += 1] = [""];else {
          var r = "";
          if (e.startsWith('"')) {
            for (var l = 0, a = !0; a;) {
              var s = e.slice(0, 1);
              '"' === s && (l += 1), r += s, (0 === (e = e.slice(1)).length || e.match(/^[\t\r\n]/) && l % 2 == 0) && (a = !1);
            }
            r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, function (e) {
              return new Array(Math.floor(e.length / 2)).fill('"').join("");
            });
          } else {
            var c = e.match(Ko);
            r = c ? c[0] : "", e = e.slice(r.length);
          }
          t[i][o] = r;
        }
        return Array.isArray(t) && t.length > 1 && 1 === t[t.length - 1].length && "" === t[t.length - 1][0] && (t = t.slice(0, t.length - 1)), t;
      }(t),
      a = i.findIndex(function (e) {
        return e.key === o.leftColKey;
      }),
      s = Math.min(a + l[0].length - 1, i.length - 1),
      c = r.indexOf(o.topRowKey),
      u = Math.min(c + l.length - 1, r.length - 1),
      d = {
        selectionRangeIndexes: {
          startColIndex: a,
          endColIndex: s,
          startRowIndex: c,
          endRowIndex: u
        },
        selectionRangeKeys: {
          startColKey: i[a].key,
          endColKey: i[s].key,
          startRowKey: r[c],
          endRowKey: r[u]
        },
        data: []
      },
      h = i.slice(a, s + 1).map(function (e) {
        return e.field;
      });
    return d.data = l.slice(0, u - c + 1).map(function (e) {
      var t = {};
      return e.forEach(function (e, n) {
        n <= s - a && (t[h[n]] = e);
      }), t;
    }), d;
  }
  n(169);
  var To,
    Do = (To = "undefined" != typeof window ? window : "undefined" != typeof self ? self : {}).requestAnimationFrame || To.webkitRequestAnimationFrame || To.mozRequestAnimationFrame || To.oRequestAnimationFrame || To.msRequestAnimationFrame || function (e) {
      return To.setTimeout(e, 1e3 / 60);
    },
    _o = To.cancelAnimationFrame || To.webkitCancelAnimationFrame || To.mozCancelAnimationFrame || To.oCancelAnimationFrame || To.msCancelAnimationFrame || function (e) {
      To.clearTimeout(e);
    },
    Ao = Do,
    Po = _o;
  function Bo(e, t) {
    for (var n = 0; n < t.length; n++) {
      var o = t[n];
      o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o);
    }
  }
  var jo = function () {
    function e() {
      !function (e, t) {
        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
      }(this, e), this.hooks = {};
    }
    var t, n;
    return t = e, (n = [{
      key: "addHook",
      value: function (e, t) {
        var n;
        this.hooks[e] || (this.hooks[e] = []), n = this.hooks[e];
        for (var o = !1, i = 0; i < n.length; i++) if (n[i] === t) {
          o = !0;
          break;
        }
        o ? console.warn("Repeat hook name:".concat(e)) : n.push(t);
      }
    }, {
      key: "triggerHook",
      value: function (e) {
        var t = this.hooks[e];
        if (t && t.length) {
          var n = Array.prototype.slice.call(arguments);
          t.forEach(function (e) {
            e.apply(null, n.slice(1));
          });
        }
      }
    }]) && Bo(t.prototype, n), e;
  }();
  function Mo(e) {
    var t = null;
    if (!e) return t;
    var n = void 0 !== e.which ? e.which : e.button;
    return 1 == n ? t = L : 2 == n ? t = H : 3 == n && (t = W), t;
  }
  function Vo(e, t, n) {
    this.$children.forEach(function (o) {
      o.$options.name === e ? o.$emit.apply(o, [t].concat(n)) : Vo.apply(o, [e, t].concat([n]));
    });
  }
  var No = {
      methods: {
        dispatch: function (e, t, n) {
          for (var o = this.$parent || this.$root, i = o.$options.name; o && (!i || i !== e);) (o = o.$parent) && (i = o.$options.name);
          o ? o.$emit.apply(o, [t].concat(n)) : console.error("".concat(e, " was not found."));
        },
        broadcast: function (e, t, n) {
          Vo.call(this, e, t, n);
        }
      }
    },
    Fo = {
      name: On,
      props: {
        colgroups: {
          type: Array,
          required: !0
        },
        enableColumnResize: {
          type: Boolean,
          required: !0
        }
      },
      methods: {
        getValByUnit: function (e) {
          return h(this.enableColumnResize && e._columnResizeWidth ? e._columnResizeWidth : e.width);
        }
      },
      render: function () {
        var e = this,
          t = arguments[0];
        return t("colgroup", [this.colgroups.map(function (n) {
          return t("col", {
            key: n.key,
            style: {
              width: e.getValByUnit(n)
            }
          });
        })]);
      }
    },
    Lo = {
      name: vn,
      mixins: [No],
      props: {
        checkboxOption: {
          type: Object,
          default: function () {
            return null;
          }
        }
      },
      data: function () {
        return {
          isSelected: !1,
          isIndeterminate: !1
        };
      },
      methods: {
        selectedChange: function (e) {
          this.isSelected = e, this.dispatch(hn, Mt, {
            isSelected: e
          });
        },
        setSelectedAllInfo: function (e) {
          var t = e.isSelected,
            n = e.isIndeterminate;
          this.isSelected = t, this.isIndeterminate = n;
        }
      },
      mounted: function () {
        var e = this;
        this.$on(Vt, function (t) {
          e.setSelectedAllInfo(t);
        });
      },
      render: function () {
        var e = arguments[0],
          t = this.isSelected,
          n = this.isIndeterminate,
          o = this.selectedChange,
          i = {
            class: Yn("checkbox-wrapper"),
            props: {
              isControlled: !0,
              isSelected: t,
              indeterminate: n
            },
            on: {
              "on-checked-change": function (e) {
                return o(e);
              }
            }
          };
        return e(oe.a, i);
      }
    };
  function Ho(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var Wo = r("table"),
    zo = {
      name: gn,
      props: {
        column: {
          type: Object,
          required: !0
        }
      },
      data: function () {
        return {
          filterList: []
        };
      },
      watch: {
        column: {
          handler: function (e) {
            e.filter && Array.isArray(e.filter.filterList) && (this.filterList = e.filter.filterList);
          },
          immediate: !0,
          deep: !0
        }
      },
      methods: {
        filterConfirm: function () {
          var e = this.column.filter.filterConfirm;
          e && e(this.filterList);
        },
        filterReset: function () {
          var e = this.column.filter.filterReset;
          e && e(this.filterList);
        },
        getIcon: function (e) {
          var t = this.column.filter.filterIcon;
          return c(t) ? t(e) : e(k.a, {
            attrs: {
              name: F.FILTER
            }
          });
        }
      },
      render: function (e) {
        var t,
          n = this,
          o = this.column.filter,
          i = o.filterList,
          r = o.isMultiple,
          l = o.maxHeight,
          a = o.beforeVisibleChange,
          s = {
            props: {
              value: i,
              showOperation: !0,
              isMultiple: r,
              showRadio: !0,
              confirmFilterText: Wo("confirmFilter"),
              resetFilterText: Wo("resetFilter"),
              beforeVisibleChange: a
            },
            on: (t = {}, Ho(t, Ht, this.filterConfirm), Ho(t, Wt, this.filterReset), Ho(t, "input", function (e) {
              n.filterList = e;
            }), t)
          };
        return "number" == typeof l && (s.props.maxHeight = l), e(Ze.a, s, [e("span", {
          class: Yn("filter")
        }, [e("span", {
          class: Yn("filter-icon")
        }, [this.getIcon(e)])])]);
      }
    },
    $o = {
      name: mn,
      props: {
        column: {
          type: Object,
          required: !0
        }
      },
      data: function () {
        return {
          internalVisible: !1
        };
      },
      watch: {
        column: {
          handler: function (e) {
            e.filterCustom && u(e.filterCustom.defaultVisible) && (this.internalVisible = e.filterCustom.defaultVisible);
          },
          immediate: !0,
          deep: !0
        }
      },
      methods: {
        visibleChange: function (e) {
          this.internalVisible = e;
        },
        getCustomContent: function (e) {
          var t = null,
            n = this.column.filterCustom.render;
          if (c(n)) {
            t = e("div", {
              slot: "custom-content"
            }, [n({
              showFn: this.show,
              closeFn: this.close
            }, e)]);
          }
          return t;
        },
        getIcon: function (e) {
          var t = this.column.filterCustom.filterIcon;
          return c(t) ? t(e) : e(k.a, {
            attrs: {
              name: F.FILTER
            }
          });
        },
        close: function () {
          this.internalVisible = !1;
        },
        show: function () {
          this.internalVisible = !0;
        }
      },
      render: function (e) {
        var t = {
          props: {
            isCustomContent: !0,
            isControlled: !0,
            visible: this.internalVisible,
            beforeVisibleChange: this.column.filterCustom.beforeVisibleChange
          },
          on: {
            "on-dropdown-visible-change": this.visibleChange
          }
        };
        return e(Ze.a, t, [e("span", {
          class: Yn("filter")
        }, [e("span", {
          class: Yn("filter-icon")
        }, [this.getIcon(e)])]), this.getCustomContent(e)]);
      }
    };
  function qo(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var Go = {
      name: yn,
      mixins: [No],
      props: {
        groupColumn: {
          type: Array,
          required: !0
        },
        groupColumnItem: {
          type: Object,
          required: !0
        },
        colgroups: {
          type: Array,
          required: !0
        },
        headerRows: {
          type: Array,
          default: function () {
            return [];
          }
        },
        fixedHeader: {
          type: Boolean
        },
        isGroupHeader: {
          type: Boolean,
          required: !0
        },
        rowIndex: {
          type: Number,
          required: !0
        },
        cellSelectionData: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellSelectionRangeData: {
          type: Object,
          default: function () {
            return null;
          }
        },
        headerIndicatorColKeys: {
          type: Object,
          default: function () {
            return null;
          }
        },
        checkboxOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        sortOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        sortColumns: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellStyleOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        eventCustomOption: {
          type: Object,
          default: function () {
            return null;
          }
        }
      },
      computed: {
        isLastLeftFixedColumn: function () {
          var e = !1,
            t = this.groupColumn,
            n = this.groupColumnItem,
            o = n.fixed,
            i = n._keys;
          if ("left" === o) {
            var r = t.filter(function (e) {
              return "left" === e.fixed;
            });
            r.findIndex(function (e) {
              return e._keys === i;
            }) === r.length - 1 && (e = !0);
          }
          return e;
        },
        isfirstRightFixedColumn: function () {
          var e = !1,
            t = this.groupColumn,
            n = this.groupColumnItem,
            o = n.fixed,
            i = n._keys;
          "right" === o && t.filter(function (e) {
            return "right" === e.fixed;
          })[0]._keys === i && (e = !0);
          return e;
        },
        isLastCloumn: function () {
          var e = !1,
            t = this.colgroups,
            n = this.groupColumnItem,
            o = t[t.length - 1].key,
            i = n._keys.split("|");
          return i.length && (1 === i.length ? i[0] === o && (e = !0) : i[i.length - 2] === o && (e = !0)), e;
        },
        isSortableCloumn: function () {
          var e = !1,
            t = this.sortColumns,
            n = this.groupColumnItem.field;
          return Object.keys(t).includes(n) && (e = !0), e;
        }
      },
      methods: {
        getTheadThClass: function (e) {
          var t,
            n = e.fixed,
            o = (qo(t = {}, Yn("header-th"), !0), qo(t, Yn("fixed-left"), "left" === n), qo(t, Yn("fixed-right"), "right" === n), qo(t, Yn("last-left-fixed-column"), this.isLastLeftFixedColumn), qo(t, Yn("first-right-fixed-column"), this.isfirstRightFixedColumn), qo(t, Yn("last-column"), this.isLastCloumn), qo(t, Yn("sortable-column"), this.isSortableCloumn), t),
            i = this.cellStyleOption,
            r = this.rowIndex,
            l = this.groupColumnItem,
            s = this.cellSelectionRangeData,
            c = this.colgroups,
            u = this.isGroupHeader,
            d = this.headerIndicatorColKeys;
          if (s) {
            var h = s.leftColKey,
              f = s.rightColKey,
              p = d.startColKeyIndex > -1;
            if (!a(h)) {
              var y,
                v = [];
              if (h === f) v = [h];else v = null !== (y = co({
                colKey1: h,
                colKey2: f,
                colgroups: c
              })) && void 0 !== y ? y : [];
              var g = !1;
              if (u) g = so({
                headerColumnItem: l
              }).every(function (e) {
                return v.indexOf(e) > -1;
              });else v.indexOf(l.key) > -1 && (g = !0);
              g && (p ? o[Yn("cell-indicator-active")] = !0 : o[Yn("cell-indicator")] = !0);
            }
          }
          if (i && "function" == typeof i.headerCellClass) {
            var m = i.headerCellClass({
              column: l,
              rowIndex: r
            });
            m && (o[m] = !0);
          }
          return o;
        },
        getTheadThStyle: function (e, t) {
          var n = e._keys,
            o = e.align,
            i = e.fixed,
            r = {},
            l = this.colgroups,
            a = this.headerRows;
          if (r["text-align"] = o || "center", i) {
            var s = "",
              c = 0,
              u = n.split("|");
            if ("left" === i ? s = u[0] : "right" === i && (s = 1 === u.length ? u[0] : u[u.length - 2]), s) {
              var d = l.findIndex(function (e) {
                return e.key === s;
              });
              ("left" === i && d > 0 || "right" === i && d < l.length - 1) && (c = h(c = to({
                colgroups: l,
                colKey: s,
                fixed: i
              })));
            }
            r.left = "left" === i ? c : "", r.right = "right" === i ? c : "";
          }
          if (this.fixedHeader) {
            var f = 0;
            t > 0 && (f = a.reduce(function (e, n, o) {
              return o < t ? n.rowHeight + e : e;
            }, 0)), f = h(f), r.top = f;
          }
          return r;
        },
        getCheckboxContent: function () {
          var e = this.$createElement,
            t = null,
            n = this.checkboxOption;
          if (this.groupColumnItem.type === lt && !n.hideSelectAll) {
            var o = {
              props: {
                column: this.groupColumnItem,
                checkboxOption: this.checkboxOption
              }
            };
            t = e(Lo, o);
          }
          return t;
        },
        sortChange: function () {
          var e = "",
            t = this.sortColumns,
            n = this.groupColumnItem,
            o = this.sortOption.sortAlways,
            i = n.field,
            r = t[i];
          e = o ? "asc" === r ? "desc" : "asc" : "asc" === r ? "desc" : "desc" === r ? "" : "asc", this.dispatch(fn, Ft, {
            currentField: i,
            sortResult: e
          });
        },
        getSortContent: function () {
          var e = this.$createElement,
            t = null,
            n = this.sortColumns,
            o = this.groupColumnItem.field;
          if (Object.keys(n).includes(o)) {
            var i = n[o];
            t = e("span", {
              class: Yn("sort")
            }, [e(k.a, {
              class: [Yn("sort-icon"), Yn("sort-icon-top"), "asc" === i ? "active" : ""],
              attrs: {
                name: F.SORT_TOP_ARROW
              }
            }), e(k.a, {
              class: [Yn("sort-icon"), Yn("sort-icon-bottom"), "desc" === i ? "active" : ""],
              attrs: {
                name: F.SORT_BOTTOM_ARROW
              }
            })]);
          }
          return t;
        },
        getFilterContent: function () {
          var e = this.$createElement,
            t = null;
          if (this.groupColumnItem.filter) {
            var n = {
              props: {
                column: this.groupColumnItem
              }
            };
            t = e(zo, n);
          }
          return t;
        },
        getFilterCustomContent: function () {
          var e = this.$createElement,
            t = null;
          if (this.groupColumnItem.filterCustom) {
            var n = {
              props: {
                column: this.groupColumnItem
              }
            };
            t = e($o, n);
          }
          return t;
        },
        cellClick: function (e, t) {
          t && t(e);
          var n = this.groupColumnItem;
          this.dispatch(hn, zt, {
            event: e,
            column: n
          });
        },
        cellDblclick: function (e, t) {
          t && t(e);
        },
        cellContextmenu: function (e, t) {
          t && t(e);
          var n = this.groupColumnItem;
          this.dispatch(hn, $t, {
            event: e,
            column: n
          });
        },
        cellMouseenter: function (e, t) {
          t && t(e);
        },
        cellMouseleave: function (e, t) {
          t && t(e);
          var n = this.groupColumnItem;
          this.dispatch(hn, Xt, {
            event: e,
            column: n
          });
        },
        cellMousemove: function (e, t) {
          t && t(e);
          var n = this.groupColumnItem;
          this.dispatch(hn, Ut, {
            event: e,
            column: n
          });
        },
        cellMouseover: function (e, t) {
          t && t(e);
          var n = this.groupColumnItem;
          this.dispatch(hn, Gt, {
            event: e,
            column: n
          });
        },
        cellMousedown: function (e, t) {
          t && t(e);
          var n = this.groupColumnItem;
          this.dispatch(hn, qt, {
            event: e,
            column: n
          });
        },
        cellMouseup: function (e, t) {
          t && t(e);
        }
      },
      render: function (e) {
        var t,
          n = this,
          o = this.groupColumnItem,
          i = this.getTheadThClass,
          r = this.getTheadThStyle,
          l = this.rowIndex,
          a = this.eventCustomOption;
        if ("function" == typeof o.renderHeaderCell) {
          var s = Object.assign({}, o);
          t = o.renderHeaderCell({
            column: s
          }, e);
        } else t = o.title;
        var c = {};
        if (a) {
          var u = a.headerCellEvents;
          c = u ? u({
            column: o,
            rowIndex: l
          }) : {};
        }
        var d = c,
          h = d.click,
          f = d.dblclick,
          p = d.contextmenu,
          y = d.mouseenter,
          v = d.mouseleave,
          g = d.mousemove,
          m = d.mouseover,
          w = d.mousedown,
          C = d.mouseup,
          b = {
            click: function (e) {
              n.cellClick(e, h), n.isSortableCloumn && e.target instanceof HTMLTableCellElement && n.sortChange();
            },
            dblclick: function (e) {
              n.cellDblclick(e, f);
            },
            contextmenu: function (e) {
              n.cellContextmenu(e, p);
            },
            mouseenter: function (e) {
              n.cellMouseenter(e, y);
            },
            mouseleave: function (e) {
              n.cellMouseleave(e, v);
            },
            mousemove: function (e) {
              n.cellMousemove(e, g);
            },
            mouseover: function (e) {
              n.cellMouseover(e, m);
            },
            mousedown: function (e) {
              n.cellMousedown(e, w);
            },
            mouseup: function (e) {
              n.cellMouseup(e, C);
            }
          };
        return e("th", {
          style: r(o, l),
          class: i(o),
          attrs: {
            rowspan: o._rowspan,
            colspan: o._colspan
          },
          on: b
        }, [this.getCheckboxContent(), t, this.getSortContent(), this.getFilterContent(), this.getFilterCustomContent()]);
      }
    },
    Uo = n(139);
  function Xo(e, t) {
    var n = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
    if (!n) {
      if (Array.isArray(e) || (n = function (e, t) {
        if (!e) return;
        if ("string" == typeof e) return Yo(e, t);
        var n = Object.prototype.toString.call(e).slice(8, -1);
        "Object" === n && e.constructor && (n = e.constructor.name);
        if ("Map" === n || "Set" === n) return Array.from(e);
        if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Yo(e, t);
      }(e)) || t && e && "number" == typeof e.length) {
        n && (e = n);
        var o = 0,
          i = function () {};
        return {
          s: i,
          n: function () {
            return o >= e.length ? {
              done: !0
            } : {
              done: !1,
              value: e[o++]
            };
          },
          e: function (e) {
            throw e;
          },
          f: i
        };
      }
      throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }
    var r,
      l = !0,
      a = !1;
    return {
      s: function () {
        n = n.call(e);
      },
      n: function () {
        var e = n.next();
        return l = e.done, e;
      },
      e: function (e) {
        a = !0, r = e;
      },
      f: function () {
        try {
          l || null == n.return || n.return();
        } finally {
          if (a) throw r;
        }
      }
    };
  }
  function Yo(e, t) {
    (null == t || t > e.length) && (t = e.length);
    for (var n = 0, o = new Array(t); n < t; n++) o[n] = e[n];
    return o;
  }
  var Jo = function (e) {
      var t,
        n = Xo(e);
      try {
        var o = function () {
          var e = t.value,
            n = e.target.__resizeListeners__ || [];
          n.length && n.forEach(function (t) {
            t(e.contentRect);
          });
        };
        for (n.s(); !(t = n.n()).done;) o();
      } catch (e) {
        n.e(e);
      } finally {
        n.f();
      }
    },
    Qo = {
      name: "vue-dom-resize-observer",
      props: {
        tagName: {
          type: String,
          required: !0
        },
        id: {
          type: [String, Number],
          default: null
        }
      },
      methods: {
        resizeListener: function (e) {
          var t = e.left,
            n = e.top,
            o = e.width,
            i = e.height;
          this.$emit("on-dom-resize-change", {
            key: this.id,
            left: t,
            top: n,
            width: o,
            height: i
          });
        }
      },
      mounted: function () {
        var e, t;
        e = this.$el, t = this.resizeListener, e.__resizeListeners__ || (e.__resizeListeners__ = [], e.__ro__ = new Uo.a(Jo), e.__ro__.observe(e)), e.__resizeListeners__.push(t);
      },
      destroyed: function () {
        var e, t;
        e = this.$el, t = this.resizeListener, e && e.__resizeListeners__ && (e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t), 1), e.__resizeListeners__.length || e.__ro__.disconnect());
      },
      render: function () {
        var e = arguments[0];
        return e(this.tagName, [this.$slots.default]);
      }
    },
    Zo = {
      name: pn,
      mixins: [No],
      props: {
        columnsOptionResetTime: {
          type: Number,
          default: 0
        },
        groupColumn: {
          type: Array,
          required: !0
        },
        headerRows: {
          type: Array,
          default: function () {
            return [];
          }
        },
        colgroups: {
          type: Array,
          required: !0
        },
        fixedHeader: {
          type: Boolean,
          required: !0
        },
        isGroupHeader: {
          type: Boolean,
          required: !0
        },
        rowIndex: {
          type: Number,
          required: !0
        },
        cellSelectionData: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellSelectionRangeData: {
          type: Object,
          default: function () {
            return null;
          }
        },
        headerIndicatorColKeys: {
          type: Object,
          default: function () {
            return null;
          }
        },
        checkboxOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        sortOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        sortColumns: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellStyleOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        eventCustomOption: {
          type: Object,
          default: function () {
            return null;
          }
        }
      },
      methods: {
        trHeightChange: function (e) {
          var t = e.height;
          this.dispatch(hn, St, {
            rowIndex: this.rowIndex,
            height: t
          });
        },
        rowClick: function (e, t) {
          t && t(e);
        },
        rowDblclick: function (e, t) {
          t && t(e);
        },
        rowContextmenu: function (e, t) {
          t && t(e);
        },
        rowMouseenter: function (e, t) {
          t && t(e);
        },
        rowMouseleave: function (e, t) {
          t && t(e);
        },
        rowMousemove: function (e, t) {
          t && t(e);
        },
        rowMouseover: function (e, t) {
          t && t(e);
        },
        rowMousedown: function (e, t) {
          t && t(e);
        },
        rowMouseup: function (e, t) {
          t && t(e);
        }
      },
      render: function () {
        var e = this,
          t = arguments[0],
          n = this.groupColumn,
          o = this.colgroups,
          i = this.headerRows,
          r = this.fixedHeader,
          l = this.rowIndex,
          a = this.trHeightChange,
          s = this.checkboxOption,
          c = this.sortOption,
          u = this.sortColumns,
          d = this.cellStyleOption,
          h = this.eventCustomOption,
          f = this.cellSelectionData,
          p = {};
        if (h) {
          var y = h.headerRowEvents;
          p = y ? y({
            rowIndex: l
          }) : {};
        }
        var v = p,
          g = v.click,
          m = v.dblclick,
          w = v.contextmenu,
          C = v.mouseenter,
          b = v.mouseleave,
          x = v.mousemove,
          R = v.mouseover,
          S = v.mousedown,
          O = v.mouseup,
          K = {
            click: function (t) {
              e.rowClick(t, g);
            },
            dblclick: function (t) {
              e.rowDblclick(t, m);
            },
            contextmenu: function (t) {
              e.rowContextmenu(t, w);
            },
            mouseenter: function (t) {
              e.rowMouseenter(t, C);
            },
            mouseleave: function (t) {
              e.rowMouseleave(t, b);
            },
            mousemove: function (t) {
              e.rowMousemove(t, x);
            },
            mouseover: function (t) {
              e.rowMouseover(t, R);
            },
            mousedown: function (t) {
              e.rowMousedown(t, S);
            },
            mouseup: function (t) {
              e.rowMouseup(t, O);
            }
          },
          I = {
            key: eo(l, this.columnsOptionResetTime),
            class: Yn("header-tr"),
            props: {
              tagName: "tr"
            },
            on: {
              "on-dom-resize-change": a
            },
            nativeOn: K
          };
        return t(Qo, I, [n.map(function (a) {
          var h = {
            key: a.key,
            props: {
              groupColumn: n,
              groupColumnItem: a,
              colgroups: o,
              headerRows: i,
              fixedHeader: r,
              isGroupHeader: e.isGroupHeader,
              rowIndex: l,
              checkboxOption: s,
              sortOption: c,
              sortColumns: u,
              cellStyleOption: d,
              eventCustomOption: e.eventCustomOption,
              cellSelectionData: f,
              cellSelectionRangeData: e.cellSelectionRangeData,
              headerIndicatorColKeys: e.headerIndicatorColKeys
            }
          };
          return t(Go, h);
        })]);
      }
    };
  var ei = {
      name: fn,
      mixins: [No],
      props: {
        columnsOptionResetTime: {
          type: Number,
          default: 0
        },
        groupColumns: {
          type: Array,
          required: !0
        },
        colgroups: {
          type: Array,
          required: !0
        },
        fixedHeader: {
          type: Boolean,
          required: !0
        },
        isGroupHeader: {
          type: Boolean,
          required: !0
        },
        cellSelectionData: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellSelectionRangeData: {
          type: Object,
          default: function () {
            return null;
          }
        },
        headerIndicatorColKeys: {
          type: Object,
          default: function () {
            return null;
          }
        },
        headerRows: {
          type: Array,
          default: function () {
            return [];
          }
        },
        checkboxOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        sortOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellStyleOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        eventCustomOption: {
          type: Object,
          default: function () {
            return null;
          }
        }
      },
      data: function () {
        return {
          sortColumns: {}
        };
      },
      computed: {
        headerClass: function () {
          return e = {}, t = Yn("fixed-header"), n = this.fixedHeader, t in e ? Object.defineProperty(e, t, {
            value: n,
            enumerable: !0,
            configurable: !0,
            writable: !0
          }) : e[t] = n, e;
          var e, t, n;
        }
      },
      watch: {
        colgroups: {
          handler: function () {
            this.initSortColumns();
          },
          immediate: !0
        }
      },
      methods: {
        sortChange: function (e) {
          var t = e.currentField,
            n = e.sortResult,
            o = this.sortColumns,
            i = this.sortOption,
            r = i.multipleSort,
            l = i.sortChange;
          if (this.sortColumns[t] = n, !r) for (var a in o) a !== t && (o[a] = "");
          this.dispatch(hn, Ft, o), l(o);
        },
        initSortColumns: function () {
          var e = this.colgroups,
            t = {};
          e.forEach(function (e) {
            "string" == typeof e.sortBy && (t[e.field] = e.sortBy);
          }), this.sortColumns = t;
        }
      },
      mounted: function () {
        var e = this;
        this.$on(Ft, function (t) {
          e.sortChange(t);
        });
      },
      render: function () {
        var e = this,
          t = arguments[0],
          n = this.headerClass,
          o = this.groupColumns,
          i = this.colgroups,
          r = this.fixedHeader,
          l = this.headerRows,
          a = this.checkboxOption,
          s = this.sortOption,
          c = this.sortColumns,
          u = this.cellStyleOption,
          d = this.cellSelectionData;
        return t("thead", {
          class: n
        }, [o.map(function (n, o) {
          var h = {
            key: o,
            props: {
              columnsOptionResetTime: e.columnsOptionResetTime,
              groupColumn: n,
              headerRows: l,
              colgroups: i,
              fixedHeader: r,
              isGroupHeader: e.isGroupHeader,
              rowIndex: o,
              checkboxOption: a,
              sortOption: s,
              sortColumns: c,
              cellStyleOption: u,
              eventCustomOption: e.eventCustomOption,
              cellSelectionData: d,
              cellSelectionRangeData: e.cellSelectionRangeData,
              headerIndicatorColKeys: e.headerIndicatorColKeys
            }
          };
          return t(Zo, h);
        })]);
      }
    },
    ti = (n(177), {
      name: xn,
      mixins: [No],
      props: {
        checkboxOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        rowKey: {
          type: [String, Number],
          required: !0
        },
        internalCheckboxSelectedRowKeys: {
          type: Array,
          default: function () {
            return null;
          }
        }
      },
      data: function () {
        return {
          isSelected: !1
        };
      },
      computed: {
        disabled: function () {
          var e = !1,
            t = this.checkboxOption,
            n = this.rowKey;
          if (t) {
            var o = t.disableSelectedRowKeys;
            return Array.isArray(o) && o.includes(n) && (e = !0), e;
          }
        },
        isControlledProp: function () {
          var e = this.checkboxOption;
          return e && Array.isArray(e.selectedRowKeys);
        }
      },
      watch: {
        internalCheckboxSelectedRowKeys: {
          handler: function () {
            this.initSelected();
          },
          immediate: !0
        }
      },
      methods: {
        initSelected: function () {
          var e = !1,
            t = this.rowKey,
            n = this.internalCheckboxSelectedRowKeys;
          Array.isArray(n) && n.includes(t) && (e = !0), this.isSelected = e;
        },
        selectedChange: function (e) {
          this.isControlledProp || (this.isSelected = e), this.dispatch(wn, jt, {
            rowKey: this.rowKey,
            isSelected: e
          });
        }
      },
      render: function () {
        var e = arguments[0],
          t = this.isSelected,
          n = this.selectedChange,
          o = this.disabled,
          i = {
            class: Yn("checkbox-wrapper"),
            props: {
              isControlled: !0,
              isSelected: t,
              disabled: o
            },
            on: {
              "on-checked-change": function (e) {
                return n(e);
              }
            }
          };
        return e(oe.a, i);
      }
    }),
    ni = {
      name: Rn,
      mixins: [No],
      props: {
        radioOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        rowKey: {
          type: [String, Number],
          required: !0
        },
        internalRadioSelectedRowKey: {
          type: [String, Number],
          default: null
        }
      },
      data: function () {
        return {
          isSelected: !1
        };
      },
      computed: {
        disabled: function () {
          var e = !1,
            t = this.radioOption,
            n = this.rowKey;
          if (t) {
            var o = t.disableSelectedRowKeys;
            return Array.isArray(o) && o.includes(n) && (e = !0), e;
          }
        },
        isControlledProp: function () {
          var e = this.radioOption;
          return e && Object.keys(e).includes("selectedRowKey");
        }
      },
      watch: {
        internalRadioSelectedRowKey: {
          handler: function () {
            this.initSelected();
          },
          immediate: !0
        }
      },
      methods: {
        initSelected: function () {
          this.isSelected = this.internalRadioSelectedRowKey === this.rowKey;
        },
        selectedChange: function () {
          this.isControlledProp || (this.isSelected = !0), this.dispatch(wn, Nt, {
            rowKey: this.rowKey
          });
        }
      },
      render: function () {
        var e = arguments[0],
          t = this.isSelected,
          n = this.selectedChange,
          o = this.disabled,
          i = {
            class: Yn("radio-wrapper"),
            props: {
              isControlled: !0,
              isSelected: t,
              disabled: o
            },
            on: {
              "on-radio-change": function () {
                return n();
              }
            }
          };
        return e(re.a, i);
      }
    };
  function oi(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var ii = {
    name: En,
    props: {
      column: {
        type: Object,
        required: !0
      },
      expandOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      rowData: {
        type: Object,
        required: !0
      },
      expandedRowkeys: {
        type: Array,
        default: function () {
          return [];
        }
      },
      rowKeyFieldName: {
        type: String,
        default: null
      },
      cellClick: {
        type: Function,
        default: null
      }
    },
    computed: {
      isExpanded: function () {
        var e = !1,
          t = this.column,
          n = this.rowData,
          o = this.expandedRowkeys,
          i = this.rowKeyFieldName;
        if (t.type === rt) {
          var r = n[i];
          e = o.includes(r);
        }
        return e;
      },
      expandRowIconContainerClass: function () {
        var e;
        return oi(e = {}, Yn("row-expand-icon"), !0), oi(e, Yn("expand-icon-collapsed"), this.isExpanded), e;
      }
    },
    render: function () {
      var e = arguments[0],
        t = null,
        n = this.cellClick,
        o = this.column,
        i = this.expandRowIconContainerClass;
      return o.type === rt && (t = e("span", {
        on: {
          click: function (e) {
            return n(e);
          }
        },
        class: i
      }, [e(k.a, {
        attrs: {
          name: F.RIGHT_ARROW
        }
      })])), t;
    }
  };
  function ri(e) {
    return (ri = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
      return typeof e;
    } : function (e) {
      return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
    })(e);
  }
  function li(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var ai = {
    name: Sn,
    mixins: [No],
    props: {
      rowData: {
        type: Object,
        required: !0
      },
      column: {
        type: Object,
        required: !0
      },
      columnCollection: {
        type: Array,
        required: !0
      },
      rowIndex: {
        type: Number,
        required: !0
      },
      colgroups: {
        type: Array,
        required: !0
      },
      rowKeyFieldName: {
        type: String,
        default: null
      },
      allRowKeys: {
        type: Array,
        required: !0
      },
      expandOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      isExpandRow: {
        type: Boolean,
        required: !0
      },
      expandedRowkeys: {
        type: Array,
        default: function () {
          return [];
        }
      },
      checkboxOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      internalCheckboxSelectedRowKeys: {
        type: Array,
        default: function () {
          return null;
        }
      },
      radioOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      internalRadioSelectedRowKey: {
        type: [String, Number],
        default: null
      },
      cellStyleOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      eventCustomOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSelectionData: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSelectionRangeData: {
        type: Object,
        default: function () {
          return null;
        }
      },
      bodyIndicatorRowKeys: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSpanOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      editOption: {
        type: Object,
        default: function () {
          return null;
        }
      }
    },
    data: function () {
      return {
        rawCellValue: ""
      };
    },
    computed: {
      currentColumnCollectionItem: function () {
        var e = this.columnCollection,
          t = this.column;
        return e.find(function (e) {
          return e.colKey === t.key;
        });
      },
      currentRowKey: function () {
        return this.rowData[this.rowKeyFieldName];
      }
    },
    watch: {
      rowData: {
        handler: function (e) {
          var t = this.column;
          t && (this.rawCellValue = e[t.field]);
        },
        deep: !0,
        immediate: !0
      }
    },
    methods: {
      bodyTdStyle: function () {
        var e = this.currentColumnCollectionItem,
          t = {};
        return e && (t = Object.assign(t, e.style)), t;
      },
      bodyTdClass: function () {
        var e = this.currentColumnCollectionItem,
          t = this.column,
          n = t.fixed,
          o = t.operationColumn,
          i = li({}, Yn("body-td"), !0),
          r = this.cellStyleOption,
          l = this.rowData,
          s = this.column,
          c = this.rowIndex,
          u = this.allRowKeys,
          d = this.cellSelectionData,
          h = this.cellSelectionRangeData,
          f = this.bodyIndicatorRowKeys,
          p = this.currentRowKey;
        if (n && (i[Yn("fixed-left")] = "left" === n, i[Yn("fixed-right")] = "right" === n), o && (i[Yn("operation-col")] = !0), r && "function" == typeof r.bodyCellClass) {
          var y = r.bodyCellClass({
            row: l,
            column: s,
            rowIndex: c
          });
          y && (i[y] = !0);
        }
        if (d) {
          var v = d.currentCell,
            g = v.rowKey,
            m = v.colKey;
          if (!a(g) && !a(m) && (p === g && s.key === m && (i[Yn("cell-selection")] = !0), o)) {
            var w = h.topRowKey,
              C = h.bottomRowKey,
              b = f.startRowKeyIndex > -1;
            (w === C ? [w] : fo({
              topRowKey: w,
              bottomRowKey: C,
              allRowKeys: u
            })).indexOf(p) > -1 && (b ? i[Yn("cell-indicator-active")] = !0 : i[Yn("cell-indicator")] = !0);
          }
        }
        return e && (i = Object.assign(i, e.class)), i;
      },
      getEllipsisContentStyle: function () {
        var e = {},
          t = this.column.ellipsis;
        if (t) {
          var n = t.lineClamp,
            o = d(n) ? n : 1;
          e["-webkit-line-clamp"] = o;
        }
        return e;
      },
      getRenderContent: function (e) {
        var t = null,
          n = this.column,
          o = this.rowData,
          i = this.rowIndex,
          r = this.rawCellValue;
        "function" == typeof n.renderBodyCell ? t = n.renderBodyCell({
          row: o,
          column: n,
          rowIndex: i
        }, e) : t = r;
        if (n.ellipsis) {
          var l = n.ellipsis.showTitle;
          t = e("span", {
            attrs: {
              title: !u(l) || l ? t : ""
            },
            style: this.getEllipsisContentStyle(),
            class: Yn("body-td-span-ellipsis")
          }, [t]);
        }
        return t;
      },
      getCheckboxContent: function () {
        var e = this.$createElement;
        if (this.column.type === lt) {
          var t = {
            props: {
              column: this.column,
              checkboxOption: this.checkboxOption,
              rowKey: this.rowData[this.rowKeyFieldName],
              internalCheckboxSelectedRowKeys: this.internalCheckboxSelectedRowKeys
            }
          };
          return e(ti, t);
        }
        return null;
      },
      getRadioContent: function () {
        var e = this.$createElement;
        if (this.column.type === at) {
          var t = {
            props: {
              column: this.column,
              radioOption: this.radioOption,
              rowKey: this.rowData[this.rowKeyFieldName],
              internalRadioSelectedRowKey: this.internalRadioSelectedRowKey
            }
          };
          return e(ni, t);
        }
        return null;
      },
      getCellSpan: function () {
        var e = this.cellSpanOption,
          t = this.rowData,
          n = this.column,
          o = this.rowIndex,
          i = 1,
          r = 1;
        if (e) {
          var l = e.bodyCellSpan;
          if ("function" == typeof l) {
            var a = l({
              row: t,
              column: n,
              rowIndex: o
            });
            "object" === ri(a) && (i = a.rowspan, r = a.colspan);
          }
        }
        return {
          rowspan: i,
          colspan: r
        };
      },
      cellClick: function (e, t) {
        t && t(e);
        var n = this.column,
          o = this.expandOption,
          i = this.rowData;
        if (this.dispatch(hn, Et, {
          event: e,
          rowData: i,
          column: n
        }), n.type !== rt) return !1;
        if (o) {
          var r = e.target.nodeName,
            l = o.trigger;
          l && l !== ut ? l === dt && (e.stopPropagation(), this.$emit(Bt)) : "TD" !== r && (e.stopPropagation(), this.$emit(Bt));
        }
      },
      cellDblclick: function (e, t) {
        t && t(e);
        var n = this.column,
          o = this.rowData;
        this.dispatch(hn, At, {
          event: e,
          rowData: o,
          column: n
        });
      },
      cellContextmenu: function (e, t) {
        t && t(e);
        var n = this.column,
          o = this.rowData;
        this.dispatch(hn, Pt, {
          event: e,
          rowData: o,
          column: n
        });
      },
      cellMouseenter: function (e, t) {
        t && t(e);
      },
      cellMouseleave: function (e, t) {
        t && t(e);
      },
      cellMousemove: function (e, t) {
        t && t(e);
        var n = this.column,
          o = this.rowData;
        this.dispatch(hn, Dt, {
          event: e,
          rowData: o,
          column: n
        });
      },
      cellMouseover: function (e, t) {
        t && t(e);
        var n = this.column,
          o = this.rowData;
        this.dispatch(hn, kt, {
          event: e,
          rowData: o,
          column: n
        });
      },
      cellMousedown: function (e, t) {
        t && t(e);
        var n = this.column,
          o = this.rowData;
        this.dispatch(hn, Tt, {
          event: e,
          rowData: o,
          column: n
        });
      },
      cellMouseup: function (e, t) {
        t && t(e);
        var n = this.column,
          o = this.rowData;
        this.dispatch(hn, _t, {
          event: e,
          rowData: o,
          column: n
        });
      }
    },
    render: function (e) {
      var t = this,
        n = this.column,
        o = this.cellClick,
        i = this.rowData,
        r = this.isExpandRow,
        l = this.expandOption,
        a = this.expandedRowkeys,
        s = this.rowKeyFieldName,
        c = this.eventCustomOption,
        u = this.rowIndex,
        d = {
          props: {
            rowData: i,
            column: n,
            expandOption: l,
            expandedRowkeys: a,
            rowKeyFieldName: s,
            cellClick: o
          }
        },
        h = this.getCellSpan(),
        f = h.rowspan,
        p = h.colspan;
      if (!f || !p) return null;
      var y = {};
      if (c) {
        var v = c.bodyCellEvents;
        y = v ? v({
          row: i,
          column: n,
          rowIndex: u
        }) : {};
      }
      var g = y,
        m = g.click,
        w = g.dblclick,
        C = g.contextmenu,
        b = g.mouseenter,
        x = g.mouseleave,
        R = g.mousemove,
        S = g.mouseover,
        O = g.mousedown,
        K = g.mouseup,
        I = {
          click: function (e) {
            t.cellClick(e, m);
          },
          dblclick: function (e) {
            t.cellDblclick(e, w);
          },
          contextmenu: function (e) {
            t.cellContextmenu(e, C);
          },
          mouseenter: function (e) {
            t.cellMouseenter(e, b);
          },
          mouseleave: function (e) {
            t.cellMouseleave(e, x);
          },
          mousemove: function (e) {
            t.cellMousemove(e, R);
          },
          mouseover: function (e) {
            t.cellMouseover(e, S);
          },
          mousedown: function (e) {
            t.cellMousedown(e, O);
          },
          mouseup: function (e) {
            t.cellMouseup(e, K);
          }
        };
      return e("td", {
        class: this.bodyTdClass(),
        style: this.bodyTdStyle(),
        attrs: li({
          rowspan: f,
          colspan: p
        }, An, n.key),
        on: I
      }, [r && e(ii, d), this.getCheckboxContent(), this.getRadioContent(), this.getRenderContent(e)]);
    }
  };
  function si(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var ci = {
    name: Cn,
    mixins: [No],
    props: {
      rowData: {
        type: Object,
        required: !0
      },
      rowIndex: {
        type: Number,
        required: !0
      },
      colgroups: {
        type: Array,
        required: !0
      },
      columnCollection: {
        type: Array,
        required: !0
      },
      rowKeyFieldName: {
        type: String,
        default: null
      },
      allRowKeys: {
        type: Array,
        required: !0
      },
      expandOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      isExpandRow: {
        type: Boolean,
        required: !0
      },
      expandedRowkeys: {
        type: Array,
        default: function () {
          return [];
        }
      },
      expandRowChange: {
        type: Function,
        default: null
      },
      checkboxOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      internalCheckboxSelectedRowKeys: {
        type: Array,
        default: function () {
          return null;
        }
      },
      radioOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      internalRadioSelectedRowKey: {
        type: [String, Number],
        default: null
      },
      isVirtualScroll: {
        type: Boolean,
        default: !1
      },
      cellStyleOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      highlightRowKey: {
        type: [String, Number],
        default: null
      },
      eventCustomOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSelectionData: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSelectionRangeData: {
        type: Object,
        default: function () {
          return null;
        }
      },
      bodyIndicatorRowKeys: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSpanOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      editOption: {
        type: Object,
        default: function () {
          return null;
        }
      }
    },
    computed: {
      currentRowKey: function () {
        var e = this.rowKeyFieldName;
        return e ? this.rowData[e] : null;
      },
      trClass: function () {
        var e,
          t = this.highlightRowKey,
          n = this.currentRowKey,
          o = !1;
        return a(t) || t === n && (o = !0), si(e = {}, Yn("body-tr"), !0), si(e, Yn("tr-highlight"), o), e;
      }
    },
    methods: {
      rowClick: function (e, t) {
        t && t(e);
        var n = this.rowData,
          o = this.rowIndex;
        this.dispatch(wn, It, {
          rowData: n,
          rowIndex: o
        });
      },
      rowDblclick: function (e, t) {
        t && t(e);
      },
      rowContextmenu: function (e, t) {
        t && t(e);
      },
      rowMouseenter: function (e, t) {
        t && t(e);
      },
      rowMouseleave: function (e, t) {
        t && t(e);
      },
      rowMousemove: function (e, t) {
        t && t(e);
      },
      rowMouseover: function (e, t) {
        t && t(e);
      },
      rowMousedown: function (e, t) {
        t && t(e);
      },
      rowMouseup: function (e, t) {
        t && t(e);
      }
    },
    render: function () {
      var e = this,
        t = arguments[0],
        n = this.colgroups,
        o = this.expandOption,
        i = this.expandRowChange,
        r = this.isExpandRow,
        l = this.expandedRowkeys,
        a = this.checkboxOption,
        s = this.rowKeyFieldName,
        c = this.rowIndex,
        u = this.rowData,
        d = this.internalCheckboxSelectedRowKeys,
        h = this.internalRadioSelectedRowKey,
        f = this.radioOption,
        p = this.cellStyleOption,
        y = this.eventCustomOption,
        v = function () {
          return n.map(function (v) {
            var g = {
              key: v.key,
              props: {
                rowIndex: c,
                rowData: u,
                column: v,
                columnCollection: e.columnCollection,
                colgroups: n,
                expandOption: o,
                expandedRowkeys: l,
                checkboxOption: a,
                rowKeyFieldName: s,
                allRowKeys: e.allRowKeys,
                isExpandRow: r,
                internalCheckboxSelectedRowKeys: d,
                internalRadioSelectedRowKey: h,
                radioOption: f,
                cellStyleOption: p,
                cellSpanOption: e.cellSpanOption,
                eventCustomOption: y,
                cellSelectionData: e.cellSelectionData,
                cellSelectionRangeData: e.cellSelectionRangeData,
                bodyIndicatorRowKeys: e.bodyIndicatorRowKeys,
                editOption: e.editOption
              },
              on: si({}, Bt, function () {
                return i(u, c);
              })
            };
            return t(ai, g);
          });
        },
        g = null,
        m = {};
      if (y) {
        var w = y.bodyRowEvents;
        m = w ? w({
          row: u,
          rowIndex: c
        }) : {};
      }
      var C = m,
        b = C.click,
        x = C.dblclick,
        R = C.contextmenu,
        S = C.mouseenter,
        O = C.mouseleave,
        K = C.mousemove,
        I = C.mouseover,
        E = C.mousedown,
        k = C.mouseup,
        T = {
          click: function (t) {
            e.rowClick(t, b);
          },
          dblclick: function (t) {
            e.rowDblclick(t, x);
          },
          contextmenu: function (t) {
            e.rowContextmenu(t, R);
          },
          mouseenter: function (t) {
            e.rowMouseenter(t, S);
          },
          mouseleave: function (t) {
            e.rowMouseleave(t, O);
          },
          mousemove: function (t) {
            e.rowMousemove(t, K);
          },
          mouseover: function (t) {
            e.rowMouseover(t, I);
          },
          mousedown: function (t) {
            e.rowMousedown(t, E);
          },
          mouseup: function (t) {
            e.rowMouseup(t, k);
          }
        };
      if (this.isVirtualScroll) {
        var D = {
          class: this.trClass,
          props: {
            tagName: "tr",
            id: this.currentRowKey
          },
          attrs: si({}, _n, this.currentRowKey),
          on: {
            "on-dom-resize-change": function (t) {
              var n = t.key,
                o = t.height;
              e.dispatch(hn, Kt, {
                rowKey: n,
                height: o
              });
            }
          },
          nativeOn: T
        };
        g = t(Qo, D, [v()]);
      } else {
        var _ = {
          class: this.trClass,
          attrs: si({}, _n, this.currentRowKey),
          on: T
        };
        g = t("tr", _, [v()]);
      }
      return g;
    }
  };
  function ui(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var di = {
    name: bn,
    props: {
      colgroups: {
        type: Array,
        required: !0
      }
    },
    computed: {
      trClass: function () {
        var e;
        return ui(e = {}, Yn("body-tr"), !0), ui(e, Yn("body-row-scrolling"), !0), e;
      }
    },
    render: function () {
      var e = arguments[0],
        t = this.colgroups,
        n = {
          class: this.trClass
        };
      return e("tr", n, [e("td", {
        attrs: {
          colSpan: t.length
        }
      })]);
    }
  };
  var hi = {
    name: In,
    mixins: [No],
    props: {
      tableViewportWidth: {
        type: Number,
        default: 0
      },
      expandColumn: {
        type: Object,
        default: function () {
          return null;
        }
      },
      colgroups: {
        type: Array,
        required: !0
      },
      expandOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      expandedRowkeys: {
        type: Array,
        default: function () {
          return [];
        }
      },
      rowData: {
        type: Object,
        required: !0
      },
      rowIndex: {
        type: Number,
        required: !0
      },
      rowKeyFieldName: {
        type: String,
        default: null
      }
    },
    computed: {
      columnCount: function () {
        return this.colgroups.length;
      },
      currentRowKey: function () {
        return this.rowData[this.rowKeyFieldName];
      },
      isRowExpanded: function () {
        var e = !1,
          t = this.expandOption,
          n = this.expandedRowkeys,
          o = this.currentRowKey;
        return (t.defaultExpandAllRows || n.includes(o)) && (e = !0), e;
      },
      expanRowClass: function () {
        var e, t, n;
        return e = {}, t = Yn("expand-tr"), n = !0, t in e ? Object.defineProperty(e, t, {
          value: n,
          enumerable: !0,
          configurable: !0,
          writable: !0
        }) : e[t] = n, e;
      },
      hasLeftFixedColumn: function () {
        return this.colgroups.some(function (e) {
          return "left" === e.fixed;
        });
      },
      expandTdContentStyle: function () {
        var e = {},
          t = this.hasLeftFixedColumn,
          n = this.tableViewportWidth;
        return t && n && (e.width = n + "px"), e;
      }
    },
    methods: {
      getExpandRowContent: function (e) {
        var t = this.expandOption;
        return t.render && t.render({
          row: this.rowData,
          column: this.expandColumn,
          rowIndex: this.rowIndex
        }, e);
      }
    },
    render: function (e) {
      var t = this.isRowExpanded,
        n = this.columnCount,
        o = this.getExpandRowContent,
        i = null;
      if (t) {
        var r = o(e);
        i = e("tr", {
          class: this.expanRowClass
        }, [e("td", {
          class: Yn("expand-td"),
          attrs: {
            colSpan: n
          }
        }, [e("div", {
          class: Yn("expand-td-content"),
          style: this.expandTdContentStyle
        }, [r])])]);
      }
      return i;
    }
  };
  function fi(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var pi = {
    name: wn,
    mixins: [No],
    props: {
      tableViewportWidth: {
        type: Number,
        default: 0
      },
      columnsOptionResetTime: {
        type: Number,
        default: 0
      },
      colgroups: {
        type: Array,
        required: !0
      },
      actualRenderTableData: {
        type: Array,
        required: !0
      },
      hasFixedColumn: {
        type: Boolean,
        default: !1
      },
      allRowKeys: {
        type: Array,
        required: !0
      },
      expandOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      checkboxOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      radioOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      virtualScrollOption: {
        type: Object,
        default: null
      },
      isVirtualScroll: {
        type: Boolean,
        default: !1
      },
      showVirtualScrollingPlaceholder: {
        type: Boolean,
        default: !1
      },
      rowKeyFieldName: {
        type: String,
        default: null
      },
      cellStyleOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSpanOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      highlightRowKey: {
        type: [String, Number],
        default: null
      },
      eventCustomOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSelectionOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSelectionData: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSelectionRangeData: {
        type: Object,
        default: function () {
          return null;
        }
      },
      bodyIndicatorRowKeys: {
        type: Object,
        default: function () {
          return null;
        }
      },
      editOption: {
        type: Object,
        default: function () {
          return null;
        }
      }
    },
    data: function () {
      return {
        colsWidths: new Map(),
        internalExpandRowkeys: [],
        internalCheckboxSelectedRowKeys: [],
        internalRadioSelectedRowKey: null,
        virtualScrollPreviewRenderedRowKeys: [],
        virtualScrollRepeatRenderedRowKeys: []
      };
    },
    computed: {
      columnCollection: function () {
        var e = this,
          t = [],
          n = this.colgroups;
        return n.forEach(function (o) {
          var i,
            r = o.key,
            l = {
              colKey: r,
              class: (i = {}, fi(i, Yn("last-left-fixed-column"), e.isLastLeftFixedColumn(o)), fi(i, Yn("first-right-fixed-column"), e.isfirstRightFixedColumn(o)), i),
              style: {}
            },
            a = o.fixed,
            s = o.align;
          if (l.style["text-align"] = s || "center", a) {
            var c = 0,
              u = n.findIndex(function (e) {
                return e.key === r;
              });
            ("left" === a && u > 0 || "right" === a && u < n.length - 1) && (c = h(c = to({
              colgroups: n,
              colKey: r,
              fixed: a
            }))), l.style.left = "left" === a ? c : "", l.style.right = "right" === a ? c : "";
          }
          t.push(l);
        }), t;
      },
      expandColumn: function () {
        return this.colgroups.find(function (e) {
          return e.type === rt;
        });
      },
      isControlledExpand: function () {
        return this.expandOption && Array.isArray(this.expandOption.expandedRowKeys);
      },
      expandedRowkeys: function () {
        return this.isControlledExpand ? this.expandOption.expandedRowKeys : this.internalExpandRowkeys;
      },
      disableCheckboxSelectedRowKeys: function () {
        var e = [],
          t = this.checkboxOption,
          n = this.internalCheckboxSelectedRowKeys;
        if (!t) return e;
        var o = t.disableSelectedRowKeys;
        return n.length > 0 && Array.isArray(o) && o.length > 0 && o.forEach(function (t) {
          n.includes(t) && e.push(t);
        }), e;
      },
      disableCheckboxUnselectedRowKeys: function () {
        var e = [],
          t = this.checkboxOption,
          n = this.internalCheckboxSelectedRowKeys;
        if (!t) return e;
        var o = t.disableSelectedRowKeys;
        return Array.isArray(o) && o.length > 0 && o.forEach(function (t) {
          n.includes(t) || e.push(t);
        }), e;
      },
      isCheckboxSelectedAll: function () {
        return this.allRowKeys.length > 0 && this.internalCheckboxSelectedRowKeys.length + this.disableCheckboxUnselectedRowKeys.length === this.allRowKeys.length;
      },
      isCheckboxIndeterminate: function () {
        var e = this.internalCheckboxSelectedRowKeys,
          t = this.allRowKeys;
        return e.length > 0 && e.length < t.length;
      },
      isControlledRadio: function () {
        var e = this.radioOption;
        return e && Object.keys(e).includes("selectedRowKey");
      }
    },
    watch: {
      expandOption: {
        handler: function () {
          this.initInternalExpandRowKeys();
        },
        immediate: !0
      },
      "expandOption.expandedRowKeys": {
        handler: function () {
          this.initInternalExpandRowKeys();
        }
      },
      checkboxOption: {
        handler: function () {
          this.initInternalCheckboxSelectedRowKeys();
        },
        immediate: !0
      },
      "checkboxOption.selectedRowKeys": {
        handler: function () {
          this.resetInternalCheckboxSelectedRowKeys();
        }
      },
      internalCheckboxSelectedRowKeys: {
        handler: function () {
          this.sendToCheckboxAll();
        }
      },
      radioOption: {
        handler: function () {
          this.initInternalRadioSelectedRowKey();
        },
        immediate: !0
      },
      "radioOption.selectedRowKey": {
        handler: function () {
          this.initInternalRadioSelectedRowKey();
        }
      }
    },
    methods: {
      isLastLeftFixedColumn: function (e) {
        var t = !1,
          n = this.colgroups;
        if ("left" === e.fixed) {
          var o = e.field,
            i = n.filter(function (e) {
              return "left" === e.fixed;
            });
          i.findIndex(function (e) {
            return e.field === o;
          }) === i.length - 1 && (t = !0);
        }
        return t;
      },
      isfirstRightFixedColumn: function (e) {
        var t = !1,
          n = this.colgroups;
        if ("right" === e.fixed) {
          var o = e.field;
          n.filter(function (e) {
            return "right" === e.fixed;
          })[0].field === o && (t = !0);
        }
        return t;
      },
      expandRowChange: function (e, t) {
        var n = this.expandOption,
          o = this.internalExpandRowkeys,
          i = this.expandedRowkeys,
          r = this.rowKeyFieldName;
        if ("function" == typeof n.beforeExpandRowChange && !1 === n.beforeExpandRowChange({
          beforeExpandedRowKeys: i,
          row: e,
          rowIndex: t
        })) return !1;
        var l = e[r],
          a = o.indexOf(l);
        a > -1 ? o.splice(a, 1) : o.push(l), "function" == typeof n.afterExpandRowChange && n.afterExpandRowChange({
          afterExpandedRowKeys: o,
          row: e,
          rowIndex: t
        });
      },
      rowClick: function (e) {
        var t = e.rowData,
          n = e.rowIndex,
          o = this.expandOption,
          i = this.isExpandRow,
          r = this.expandRowChange,
          l = this.rowKeyFieldName;
        if (l) {
          var a = t[l];
          this.$emit(Yt, {
            rowKey: a
          });
        }
        if (!i({
          rowData: t,
          rowIndex: n
        })) return !1;
        o.trigger === ht && r(t, n);
      },
      isExpandRow: function (e) {
        var t = e.rowData,
          n = e.rowIndex,
          o = !1,
          i = this.expandColumn,
          r = this.expandOption;
        if (i && r) {
          var l = !0;
          "function" == typeof r.expandable && (l = r.expandable({
            row: t,
            column: i,
            rowIndex: n
          })), !1 !== l && (o = !0);
        }
        return o;
      },
      tdSizeChange: function (e) {
        var t = e.key,
          n = e.width,
          o = this.colsWidths;
        o.set(t, n), this.$emit(Rt, o);
      },
      initInternalExpandRowKeys: function () {
        var e = this.expandOption,
          t = this.isControlledExpand,
          n = this.allRowKeys;
        if (!e) return !1;
        t ? this.internalExpandRowkeys = e.expandedRowKeys.slice(0) : e.defaultExpandAllRows ? this.internalExpandRowkeys = n : e.defaultExpandedRowKeys && (this.internalExpandRowkeys = e.defaultExpandedRowKeys.slice(0));
      },
      getExpandRowComp: function (e) {
        var t = e.rowData,
          n = e.rowIndex,
          o = this.$createElement;
        if (this.isExpandRow({
          rowData: t,
          rowIndex: n
        })) {
          var i = {
            props: {
              tableViewportWidth: this.tableViewportWidth,
              colgroups: this.colgroups,
              expandOption: this.expandOption,
              expandedRowkeys: this.expandedRowkeys,
              expandColumn: this.expandColumn,
              rowKeyFieldName: this.rowKeyFieldName,
              rowData: t,
              rowIndex: n
            }
          };
          return o(hi, i);
        }
        return null;
      },
      sendToCheckboxAll: function () {
        var e = this.isCheckboxSelectedAll,
          t = this.isCheckboxIndeterminate;
        this.dispatch(hn, Vt, {
          isIndeterminate: t,
          isSelected: e
        });
      },
      initInternalRadioSelectedRowKey: function () {
        var e = this.radioOption,
          t = this.isControlledRadio;
        if (!e) return !1;
        var n = e.selectedRowKey,
          o = e.defaultSelectedRowKey;
        this.internalRadioSelectedRowKey = t ? n : o;
      },
      initInternalCheckboxSelectedRowKeys: function () {
        var e = [],
          t = this.checkboxOption,
          n = this.allRowKeys;
        if (!t) return !1;
        var o = t.selectedRowKeys,
          i = t.defaultSelectedAllRows,
          r = t.defaultSelectedRowKeys;
        Array.isArray(o) ? e = o : i ? e = n : Array.isArray(r) && (e = r), this.internalCheckboxSelectedRowKeys = e;
      },
      resetInternalCheckboxSelectedRowKeys: function () {
        this.internalCheckboxSelectedRowKeys = this.checkboxOption.selectedRowKeys.slice(0);
      },
      checkboxSelectedRowChange: function (e) {
        var t = e.rowKey,
          n = e.isSelected,
          o = this.checkboxOption,
          i = this.internalCheckboxSelectedRowKeys,
          r = this.rowKeyFieldName,
          l = o.selectedRowChange,
          a = o.selectedRowKeys,
          s = i.slice(0),
          c = s.indexOf(t);
        n ? -1 === c && s.push(t) : c > -1 && s.splice(c, 1), Array.isArray(a) || (this.internalCheckboxSelectedRowKeys = s), l({
          row: this.actualRenderTableData.find(function (e) {
            return e[r] === t;
          }),
          isSelected: n,
          selectedRowKeys: s
        });
      },
      checkboxSelectedAllChange: function (e) {
        var t = e.isSelected,
          n = this.checkboxOption,
          o = this.internalCheckboxSelectedRowKeys,
          i = this.allRowKeys,
          r = this.disableCheckboxSelectedRowKeys,
          l = this.disableCheckboxUnselectedRowKeys,
          a = n.selectedAllChange,
          s = n.selectedRowKeys,
          c = o.slice(0);
        if (t) {
          var u = i.slice(0);
          l.length > 0 && l.forEach(function (e) {
            var t = u.indexOf(e);
            t > -1 && u.splice(t, 1);
          }), c = u;
        } else c = r;
        Array.isArray(s) || (this.internalCheckboxSelectedRowKeys = c), a && a({
          isSelected: t,
          selectedRowKeys: c
        });
      },
      radioSelectedRowChange: function (e) {
        var t = e.rowKey,
          n = this.radioOption,
          o = this.rowKeyFieldName,
          i = this.isControlledRadio,
          r = n.selectedRowChange;
        i || (this.internalRadioSelectedRowKey = t), r({
          row: this.actualRenderTableData.find(function (e) {
            return e[o] === t;
          })
        });
      },
      getTrKey: function (e) {
        var t = e.rowData,
          n = e.rowIndex,
          o = this.rowKeyFieldName;
        return o && (n = t[o]), n;
      },
      renderingRowKeys: function (e) {
        var t = this.virtualScrollPreviewRenderedRowKeys;
        this.virtualScrollRepeatRenderedRowKeys = e.filter(function (e) {
          return -1 != t.indexOf(e);
        }), this.virtualScrollPreviewRenderedRowKeys = e;
      }
    },
    mounted: function () {
      var e = this;
      this.$on(jt, function (t) {
        e.checkboxSelectedRowChange(t);
      }), this.$on(Mt, function (t) {
        e.checkboxSelectedAllChange(t);
      }), this.$on(Nt, function (t) {
        e.radioSelectedRowChange(t);
      }), this.$on(It, function (t) {
        e.rowClick(t);
      }), this.checkboxOption && this.$nextTick(function () {
        e.sendToCheckboxAll();
      });
    },
    render: function () {
      var e = this,
        t = arguments[0],
        n = this.colgroups,
        o = this.actualRenderTableData,
        i = this.expandOption,
        r = this.expandRowChange,
        l = this.isExpandRow,
        a = this.getExpandRowComp,
        s = this.expandedRowkeys,
        c = this.checkboxOption,
        u = this.radioOption,
        d = this.rowKeyFieldName,
        h = this.tdSizeChange,
        f = this.internalCheckboxSelectedRowKeys,
        p = this.internalRadioSelectedRowKey,
        y = this.isVirtualScroll,
        v = this.cellStyleOption,
        g = this.showVirtualScrollingPlaceholder,
        m = this.virtualScrollRepeatRenderedRowKeys;
      return t("tbody", [t("tr", {
        style: "height:0;"
      }, [n.map(function (n) {
        var o = {
          key: eo(n.key, e.columnsOptionResetTime),
          props: {
            tagName: "td",
            id: n.key
          },
          on: {
            "on-dom-resize-change": h
          },
          style: {
            padding: 0,
            border: 0,
            height: 0
          }
        };
        return t(Qo, o);
      })]), o.map(function (o, h) {
        var w = {
          key: e.getTrKey({
            rowData: o,
            rowIndex: h
          }),
          props: {
            rowIndex: h,
            rowData: o,
            colgroups: n,
            expandOption: i,
            expandedRowkeys: s,
            checkboxOption: c,
            radioOption: u,
            rowKeyFieldName: d,
            allRowKeys: e.allRowKeys,
            expandRowChange: r,
            internalCheckboxSelectedRowKeys: f,
            internalRadioSelectedRowKey: p,
            isVirtualScroll: y,
            isExpandRow: l({
              rowData: o,
              rowIndex: h
            }),
            cellStyleOption: v,
            cellSpanOption: e.cellSpanOption,
            highlightRowKey: e.highlightRowKey,
            eventCustomOption: e.eventCustomOption,
            cellSelectionData: e.cellSelectionData,
            editOption: e.editOption,
            columnCollection: e.columnCollection,
            cellSelectionRangeData: e.cellSelectionRangeData,
            bodyIndicatorRowKeys: e.bodyIndicatorRowKeys
          }
        };
        if (g) {
          var C = {
            key: e.getTrKey({
              rowData: o,
              rowIndex: h
            }),
            props: {
              colgroups: n
            }
          };
          return -1 != m.indexOf(o[e.rowKeyFieldName]) ? [t(ci, w)] : t(di, C);
        }
        return [t(ci, w), a({
          rowData: o,
          rowIndex: h
        })];
      })]);
    }
  };
  function yi(e) {
    return (yi = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
      return typeof e;
    } : function (e) {
      return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
    })(e);
  }
  var vi = {
    name: Sn,
    mixins: [No],
    props: {
      rowData: {
        type: Object,
        required: !0
      },
      column: {
        type: Object,
        required: !0
      },
      rowIndex: {
        type: Number,
        required: !0
      },
      colgroups: {
        type: Array,
        required: !0
      },
      rowKeyFieldName: {
        type: String,
        default: null
      },
      cellSpanOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellStyleOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      eventCustomOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSelectionData: {
        type: Object,
        default: function () {
          return null;
        }
      },
      footerRows: {
        type: Array,
        default: function () {
          return [];
        }
      },
      fixedFooter: {
        type: Boolean,
        default: !0
      }
    },
    computed: {
      isLastLeftFixedColumn: function () {
        var e = !1,
          t = this.colgroups,
          n = this.column;
        if ("left" === n.fixed) {
          var o = n.field,
            i = t.filter(function (e) {
              return "left" === e.fixed;
            });
          i.findIndex(function (e) {
            return e.field === o;
          }) === i.length - 1 && (e = !0);
        }
        return e;
      },
      isfirstRightFixedColumn: function () {
        var e = !1,
          t = this.colgroups,
          n = this.column;
        if ("right" === n.fixed) {
          var o = n.field;
          t.filter(function (e) {
            return "right" === e.fixed;
          })[0].field === o && (e = !0);
        }
        return e;
      }
    },
    methods: {
      getBodyTdClass: function (e) {
        var t,
          n,
          o,
          i = e.fixed,
          r = (t = {}, n = Yn("footer-td"), o = !0, n in t ? Object.defineProperty(t, n, {
            value: o,
            enumerable: !0,
            configurable: !0,
            writable: !0
          }) : t[n] = o, t),
          l = this.cellStyleOption,
          a = this.rowData,
          s = this.column,
          c = this.rowIndex,
          u = this.cellSelectionData,
          d = this.rowKeyFieldName;
        if (i && (r[Yn("fixed-left")] = "left" === i, r[Yn("fixed-right")] = "right" === i, r[Yn("last-left-fixed-column")] = this.isLastLeftFixedColumn, r[Yn("first-right-fixed-column")] = this.isfirstRightFixedColumn), l && "function" == typeof l.footerCellClass) {
          var h = l.footerCellClass({
            row: a,
            column: s,
            rowIndex: c
          });
          h && (r[h] = !0);
        }
        if (u) {
          var f = u.currentCell,
            p = f.rowKey,
            y = f.colKey;
          a[d] === p && s.key === y && (r[Yn("cell-selection")] = !0);
        }
        return r;
      },
      getBodyTdStyle: function (e) {
        var t = e.key,
          n = e.align,
          o = e.fixed,
          i = {},
          r = this.colgroups,
          l = this.rowIndex,
          a = this.footerRows;
        if (i["text-align"] = n || "center", o) {
          var s = 0,
            c = r.findIndex(function (e) {
              return e.key === t;
            });
          ("left" === o && c > 0 || "right" === o && c < r.length - 1) && (s = h(s = to({
            colgroups: r,
            colKey: t,
            fixed: o
          }))), i.left = "left" === o ? s : "", i.right = "right" === o ? s : "";
        }
        if (this.fixedFooter) {
          var u = 0;
          l !== a.length - 1 && (u = a.reduce(function (e, t, n) {
            return n > l ? t.rowHeight + e : e;
          }, 0)), u = h(u), i.bottom = u;
        }
        return i;
      },
      getRenderContent: function (e) {
        var t = null,
          n = this.column,
          o = this.rowData,
          i = this.rowIndex;
        "function" == typeof n.renderFooterCell ? t = n.renderFooterCell({
          row: o,
          column: n,
          rowIndex: i
        }, e) : t = o[n.field];
        return t;
      },
      getCellSpan: function () {
        var e = this.cellSpanOption,
          t = this.rowData,
          n = this.column,
          o = this.rowIndex,
          i = 1,
          r = 1;
        if (e) {
          var l = e.footerCellSpan;
          if ("function" == typeof l) {
            var a = l({
              row: t,
              column: n,
              rowIndex: o
            });
            "object" === yi(a) && (i = a.rowspan, r = a.colspan);
          }
        }
        return {
          rowspan: i,
          colspan: r
        };
      },
      cellClick: function (e, t) {
        t && t(e);
      },
      cellDblclick: function (e, t) {
        t && t(e);
      },
      cellContextmenu: function (e, t) {
        t && t(e);
      },
      cellMouseenter: function (e, t) {
        t && t(e);
      },
      cellMouseleave: function (e, t) {
        t && t(e);
      },
      cellMousemove: function (e, t) {
        t && t(e);
      },
      cellMouseover: function (e, t) {
        t && t(e);
      },
      cellMousedown: function (e, t) {
        t && t(e);
      },
      cellMouseup: function (e, t) {
        t && t(e);
      }
    },
    render: function (e) {
      var t = this,
        n = this.column,
        o = this.rowData,
        i = this.rowIndex,
        r = this.eventCustomOption,
        l = this.getCellSpan(),
        a = l.rowspan,
        s = l.colspan;
      if (!a || !s) return null;
      var c = {};
      if (r) {
        var u = r.footerCellEvents;
        c = u ? u({
          row: o,
          column: n,
          rowIndex: i
        }) : {};
      }
      var d = c,
        h = d.click,
        f = d.dblclick,
        p = d.contextmenu,
        y = d.mouseenter,
        v = d.mouseleave,
        g = d.mousemove,
        m = d.mouseover,
        w = d.mousedown,
        C = d.mouseup,
        b = {
          click: function (e) {
            t.cellClick(e, h);
          },
          dblclick: function (e) {
            t.cellDblclick(e, f);
          },
          contextmenu: function (e) {
            t.cellContextmenu(e, p);
          },
          mouseenter: function (e) {
            t.cellMouseenter(e, y);
          },
          mouseleave: function (e) {
            t.cellMouseleave(e, v);
          },
          mousemove: function (e) {
            t.cellMousemove(e, g);
          },
          mouseover: function (e) {
            t.cellMouseover(e, m);
          },
          mousedown: function (e) {
            t.cellMousedown(e, w);
          },
          mouseup: function (e) {
            t.cellMouseup(e, C);
          }
        };
      return e("td", {
        class: this.getBodyTdClass(n),
        style: this.getBodyTdStyle(n),
        attrs: {
          rowspan: a,
          colspan: s
        },
        on: b
      }, [this.getRenderContent(e)]);
    }
  };
  function gi(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var mi = {
    name: Cn,
    mixins: [No],
    props: {
      rowData: {
        type: Object,
        required: !0
      },
      rowIndex: {
        type: Number,
        required: !0
      },
      colgroups: {
        type: Array,
        required: !0
      },
      rowKeyFieldName: {
        type: String,
        default: null
      },
      cellStyleOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSpanOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      eventCustomOption: {
        type: Object,
        default: function () {
          return null;
        }
      },
      cellSelectionData: {
        type: Object,
        default: function () {
          return null;
        }
      },
      footerRows: {
        type: Array,
        default: function () {
          return [];
        }
      },
      fixedFooter: {
        type: Boolean,
        default: !0
      }
    },
    computed: {
      currentRowKey: function () {
        var e = this.rowKeyFieldName;
        return e ? this.rowData[e] : null;
      },
      trClass: function () {
        return gi({}, Yn("footer-tr"), !0);
      }
    },
    methods: {
      trHeightChange: function (e) {
        var t = e.height;
        this.dispatch(hn, Ot, {
          rowIndex: this.rowIndex,
          height: t
        });
      },
      rowClick: function (e, t) {
        t && t(e);
      },
      rowDblclick: function (e, t) {
        t && t(e);
      },
      rowContextmenu: function (e, t) {
        t && t(e);
      },
      rowMouseenter: function (e, t) {
        t && t(e);
      },
      rowMouseleave: function (e, t) {
        t && t(e);
      },
      rowMousemove: function (e, t) {
        t && t(e);
      },
      rowMouseover: function (e, t) {
        t && t(e);
      },
      rowMousedown: function (e, t) {
        t && t(e);
      },
      rowMouseup: function (e, t) {
        t && t(e);
      }
    },
    render: function () {
      var e = this,
        t = arguments[0],
        n = this.colgroups,
        o = this.rowKeyFieldName,
        i = this.rowIndex,
        r = this.rowData,
        l = this.cellStyleOption,
        a = this.eventCustomOption,
        s = function () {
          return n.map(function (a) {
            var s = {
              key: a.key,
              props: {
                rowIndex: i,
                rowData: r,
                column: a,
                colgroups: n,
                rowKeyFieldName: o,
                cellStyleOption: l,
                cellSelectionData: e.cellSelectionData,
                footerRows: e.footerRows,
                fixedFooter: e.fixedFooter,
                cellSpanOption: e.cellSpanOption,
                eventCustomOption: e.eventCustomOption
              }
            };
            return t(vi, s);
          });
        },
        c = {};
      if (a) {
        var u = a.footerRowEvents;
        c = u ? u({
          row: r,
          rowIndex: i
        }) : {};
      }
      var d = c,
        h = d.click,
        f = d.dblclick,
        p = d.contextmenu,
        y = d.mouseenter,
        v = d.mouseleave,
        g = d.mousemove,
        m = d.mouseover,
        w = d.mousedown,
        C = d.mouseup,
        b = {
          click: function (t) {
            e.rowClick(t, h);
          },
          dblclick: function (t) {
            e.rowDblclick(t, f);
          },
          contextmenu: function (t) {
            e.rowContextmenu(t, p);
          },
          mouseenter: function (t) {
            e.rowMouseenter(t, y);
          },
          mouseleave: function (t) {
            e.rowMouseleave(t, v);
          },
          mousemove: function (t) {
            e.rowMousemove(t, g);
          },
          mouseover: function (t) {
            e.rowMouseover(t, m);
          },
          mousedown: function (t) {
            e.rowMousedown(t, w);
          },
          mouseup: function (t) {
            e.rowMouseup(t, C);
          }
        },
        x = {
          class: this.trClass,
          props: {
            tagName: "tr"
          },
          attrs: gi({}, _n, this.currentRowKey),
          nativeOn: b,
          on: {
            "on-dom-resize-change": this.trHeightChange
          }
        };
      return t(Qo, x, [s()]);
    }
  };
  var wi,
    Ci = {
      name: Kn,
      props: {
        colgroups: {
          type: Array,
          required: !0
        },
        footerData: {
          type: Array,
          required: !0
        },
        hasFixedColumn: {
          type: Boolean,
          default: !1
        },
        allRowKeys: {
          type: Array,
          required: !0
        },
        rowKeyFieldName: {
          type: String,
          default: null
        },
        cellStyleOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        eventCustomOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        footerRows: {
          type: Array,
          default: function () {
            return [];
          }
        },
        fixedFooter: {
          type: Boolean,
          default: !0
        },
        cellSpanOption: {
          type: Object,
          default: function () {
            return null;
          }
        }
      },
      computed: {
        footerClass: function () {
          return e = {}, t = Yn("fixed-footer"), n = this.fixedFooter, t in e ? Object.defineProperty(e, t, {
            value: n,
            enumerable: !0,
            configurable: !0,
            writable: !0
          }) : e[t] = n, e;
          var e, t, n;
        }
      },
      methods: {
        getTrKey: function (e) {
          var t = e.rowData,
            n = e.rowIndex,
            o = this.rowKeyFieldName;
          return o && (n = t[o]), n;
        }
      },
      render: function () {
        var e = this,
          t = arguments[0],
          n = this.colgroups,
          o = this.rowKeyFieldName,
          i = this.cellStyleOption;
        return t("tfoot", {
          class: this.footerClass
        }, [this.footerData.map(function (r, l) {
          var a = {
            key: e.getTrKey({
              rowData: r,
              rowIndex: l
            }),
            props: {
              rowIndex: l,
              rowData: r,
              colgroups: n,
              rowKeyFieldName: o,
              cellStyleOption: i,
              footerRows: e.footerRows,
              fixedFooter: e.fixedFooter,
              cellSpanOption: e.cellSpanOption,
              eventCustomOption: e.eventCustomOption
            }
          };
          return t(mi, a);
        })]);
      }
    },
    bi = "textareaAddNewLine",
    xi = "textareaSelect";
  function Ri() {
    var e,
      t = {
        minHeight: 200,
        maxHeight: 300,
        minWidth: 100,
        maxWidth: 300,
        paddingWidth: 16
      },
      n = document.body,
      o = document.createTextNode(""),
      i = document.createElement("SPAN"),
      r = function (e, t, n) {
        e.addEventListener(t, n, !1);
      },
      l = function (e, t, n) {
        e.removeEventListener(t, n, !1);
      },
      a = function (r) {
        var l, a;
        r ? /^[a-zA-Z \.,\\\/\|0-9]$/.test(r) || (r = ".") : r = "", void 0 !== o.textContent ? o.textContent = e.value + r : o.data = e.value + r, i.style.fontSize = u(e).fontSize, i.style.fontFamily = u(e).fontFamily, i.style.whiteSpace = "pre", n.appendChild(i), l = i.clientWidth + t.paddingWidth, n.removeChild(i), e.style.height = t.minHeight + "px", t.minWidth > l ? e.style.width = t.minWidth + "px" : l > t.maxWidth ? e.style.width = t.maxWidth + "px" : e.style.width = l + "px", a = e.scrollHeight ? e.scrollHeight - 1 : 0, t.minHeight > a ? e.style.height = t.minHeight + "px" : t.maxHeight < a ? (e.style.height = t.maxHeight + "px", e.style.overflowY = "visible") : e.style.height = a + "px";
      },
      s = function () {
        window.setTimeout(a, 0);
      },
      c = function (n, l, c) {
        e = n, function (n) {
          if (n && n.minHeight) if ("inherit" == n.minHeight) t.minHeight = e.clientHeight;else {
            var r = parseInt(n.minHeight);
            isNaN(r) || (t.minHeight = r);
          }
          if (n && n.maxHeight) if ("inherit" == n.maxHeight) t.maxHeight = e.clientHeight;else {
            var l = parseInt(n.maxHeight);
            isNaN(l) || (t.maxHeight = l);
          }
          if (n && n.minWidth) if ("inherit" == n.minWidth) t.minWidth = e.clientWidth;else {
            var a = parseInt(n.minWidth);
            isNaN(a) || (t.minWidth = a);
          }
          if (n && n.maxWidth) if ("inherit" == n.maxWidth) t.maxWidth = e.clientWidth;else {
            var s = parseInt(n.maxWidth);
            isNaN(s) || (t.maxWidth = s);
          }
          i.firstChild || (i.className = "autoResize", i.style.display = "inline-block", i.appendChild(o));
        }(l), "TEXTAREA" == e.nodeName && (e.style.resize = "none", e.style.overflowY = "", e.style.height = t.minHeight + "px", e.style.minWidth = t.minWidth + "px", e.style.maxWidth = t.maxWidth + "px", e.style.overflowY = "hidden"), c && (r(e, "change", a), r(e, "cut", s), r(e, "paste", s), r(e, "drop", s), r(e, "keydown", s), r(e, "focus", a), r(e, "compositionstart", s), r(e, "compositionupdate", s), r(e, "compositionend", s)), a();
      };
    function u(e) {
      return e.currentStyle || document.defaultView.getComputedStyle(e);
    }
    return {
      init: function (e, t, n) {
        c(e, t, n);
      },
      unObserve: function () {
        if (!e) return !1;
        l(e, "change", a), l(e, "cut", s), l(e, "paste", s), l(e, "drop", s), l(e, "keydown", s), l(e, "focus", a), l(e, "compositionstart", s), l(e, "compositionupdate", s), l(e, "compositionend", s);
      },
      resize: a
    };
  }
  function Si(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var Oi,
    Ki = {
      name: kn,
      directives: {
        focus: {
          bind: function (e, t, n) {
            var o = t.value;
            if (o) {
              var i = o.focus,
                r = o.select;
              n.context.$nextTick(function () {
                i && e.focus(), r && e.select();
              });
            }
          },
          update: function (e, t) {
            var n = t.value;
            n && n.focus && e.focus();
          }
        }
      },
      mixins: [No],
      props: {
        parentRendered: {
          type: Boolean,
          required: !0
        },
        hooks: {
          type: Object,
          required: !0
        },
        inputStartValue: {
          type: [String, Number],
          required: !0
        },
        rowKeyFieldName: {
          type: String,
          default: null
        },
        tableData: {
          type: Array,
          required: !0
        },
        colgroups: {
          type: Array,
          required: !0
        },
        cellSelectionData: {
          type: Object,
          required: !0
        },
        editingCell: {
          type: Object,
          required: !0
        },
        isCellEditing: {
          type: Boolean,
          required: !0
        },
        hasXScrollBar: {
          type: Boolean,
          required: !0
        },
        hasYScrollBar: {
          type: Boolean,
          required: !0
        },
        hasRightFixedColumn: {
          type: Boolean,
          required: !0
        },
        scrollBarWidth: {
          type: Number,
          required: !0
        }
      },
      data: function () {
        return {
          textareaInputRef: "textareaInputRef",
          rawCellValue: "",
          displayTextarea: !1,
          overflowViewport: !1,
          textareaRect: {
            left: 0,
            top: 0
          },
          tableEl: null,
          cellEl: null,
          autoResize: null,
          isEditCellFocus: !1
        };
      },
      computed: {
        currentColumn: function () {
          var e = null,
            t = this.colgroups,
            n = this.cellSelectionData.currentCell;
          return a(n.rowKey) || a(n.colKey) || (e = t.find(function (e) {
            return e.key === n.colKey;
          })), e;
        },
        containerClass: function () {
          var e,
            t = this.displayTextarea,
            n = this.overflowViewport;
          return Si(e = {}, Yn("edit-input-container"), !0), Si(e, Yn("edit-input-container-show"), t && !n), e;
        },
        containerStyle: function () {
          var e = this.displayTextarea,
            t = this.overflowViewport,
            n = this.textareaRect,
            o = this.currentColumn,
            i = n.top,
            r = n.left;
          return e && !t ? {
            top: i + "px",
            left: r + "px",
            height: null,
            "z-index": o.fixed ? 10 : 0,
            opacity: 1
          } : {
            top: i + "px",
            left: r + "px",
            height: "1px",
            "z-index": -1,
            opacity: 0
          };
        },
        textareaClass: function () {
          return Si({}, Yn("edit-input"), !0);
        }
      },
      watch: {
        parentRendered: {
          handler: function (e) {
            var t = this;
            e && (this.setTableEl(), this.hooks.addHook(ln, function () {
              t.displayTextarea && (t.cellEl || t.setCellEl()), t.debounceSetCellEl(), t.setTextareaPosition(), t.debounceSetTextareaPosition();
            }), this.hooks.addHook(an, function () {
              t.setTextareaPosition();
            }));
          },
          immediate: !0
        },
        "cellSelectionData.currentCell": {
          handler: function (e) {
            var t = this;
            this.isEditCellFocus = !1;
            var n = e.rowKey,
              o = e.colKey;
            a(n) || a(o) || (this.setCellEl(), this.$nextTick(function () {
              t.setTextareaPosition(), setTimeout(function () {
                t.isEditCellFocus = !0;
              });
            }));
          },
          deep: !0,
          immediate: !0
        },
        "cellSelectionData.normalEndCell": {
          handler: function (e) {
            a(e.colKey) || this[xi]();
          },
          deep: !0,
          immediate: !0
        },
        isCellEditing: {
          handler: function (e) {
            e ? this.showTextarea() : this.hideTextarea();
          },
          deep: !0,
          immediate: !0
        },
        inputStartValue: {
          handler: function () {
            this.setRawCellValue();
          },
          immediate: !0
        }
      },
      methods: (wi = {
        setTableEl: function () {
          var e = this;
          this.$nextTick(function () {
            var t = e.$el.previousElementSibling;
            e.tableEl = t;
          });
        },
        setCellEl: function () {
          var e = this.cellSelectionData,
            t = this.tableEl,
            n = e.currentCell,
            o = n.rowKey,
            i = n.colKey;
          if (t) {
            var r = t.querySelector('tbody.ve-table-body tr[row-key="'.concat(o, '"] td[col-key="').concat(i, '"]'));
            r && (this.cellEl = r, this.overflowViewport = !1);
          }
        },
        setTextareaPosition: function () {
          var e = this.hasXScrollBar,
            t = this.hasYScrollBar,
            n = this.scrollBarWidth,
            o = this.colgroups,
            i = this.hasRightFixedColumn,
            r = this.currentColumn,
            l = this.cellEl,
            a = this.tableEl;
          if (l && a) {
            var s = a.getBoundingClientRect(),
              c = s.left,
              u = s.top,
              d = s.right,
              h = s.bottom,
              f = l.getBoundingClientRect(),
              p = f.left,
              y = f.top,
              v = f.height,
              g = f.width,
              m = f.right,
              w = f.bottom;
            if (v && g) {
              var C = v + h - w,
                b = g + d - m;
              if (e && (C -= n), t && (b -= n), i && r && !r.fixed) {
                var x = to({
                  colgroups: o,
                  colKey: r.key,
                  fixed: "right"
                });
                x && (b -= x);
              }
              this.autoResize.init(this.$refs[this.textareaInputRef], {
                minHeight: Math.min(v, C),
                maxHeight: C,
                minWidth: Math.min(g, b),
                maxWidth: b
              }, !0), this.textareaRect = {
                left: p - c,
                top: y - u
              };
            } else this.textareaRect = {
              left: 0,
              top: 0
            }, this.cellEl = null, this.overflowViewport = !0;
          }
        },
        showTextarea: function () {
          this.setRawCellValue(), this.displayTextarea = !0;
        },
        hideTextarea: function () {
          this.displayTextarea = !1, this.textareaUnObserve();
        },
        textareaUnObserve: function () {
          this.autoResize && this.autoResize.unObserve();
        },
        setRawCellValue: function () {
          this.rawCellValue = this.inputStartValue;
        },
        textareaValueChange: function (e) {
          this.$emit(Qt, e);
        }
      }, Si(wi, xi, function () {
        var e = this.$refs[this.textareaInputRef];
        e && e.select();
      }), Si(wi, bi, function () {
        var e = this.isCellEditing,
          t = this.editingCell;
        if (e) {
          var n = this.$refs[this.textareaInputRef],
            o = function (e) {
              var t = document;
              if (e.selectionStart) return e.selectionStart;
              if (t.selection) {
                e.focus();
                var n = t.selection.createRange();
                if (null === n) return 0;
                var o = e.createTextRange(),
                  i = o.duplicate();
                return o.moveToBookmark(n.getBookmark()), i.setEndPoint("EndToStart", o), i.text.length;
              }
              return 0;
            }(n),
            i = t.row[t.colKey],
            r = "".concat((i += "").slice(0, o), "\n").concat(i.slice(o));
          n.value = r, this.textareaValueChange(r), function (e, t, n) {
            if (void 0 === n && (n = t), e.setSelectionRange) {
              e.focus();
              try {
                e.setSelectionRange(t, n);
              } catch (r) {
                var o = e.parentNode,
                  i = o.style.display;
                o.style.display = "block", e.setSelectionRange(t, n), o.style.display = i;
              }
            }
          }(n, o + 1);
        }
      }), wi),
      created: function () {
        var e = this;
        this.debounceSetTextareaPosition = Object(Y.debounce)(this.setTextareaPosition, 210), this.debounceSetCellEl = Object(Y.debounce)(function () {
          e.displayTextarea && (e.cellEl || e.setCellEl());
        }, 200);
      },
      mounted: function () {
        this.autoResize = Ri();
      },
      destroyed: function () {
        this.textareaUnObserve();
      },
      render: function () {
        var e = this,
          t = arguments[0],
          n = this.containerClass,
          o = this.containerStyle,
          i = this.textareaClass,
          r = this.rawCellValue,
          l = this.isCellEditing,
          a = this.isEditCellFocus,
          s = {
            style: o,
            class: n
          },
          c = {
            ref: this.textareaInputRef,
            class: i,
            directives: [{
              name: "focus",
              value: {
                focus: a
              }
            }],
            domProps: {
              value: r
            },
            attrs: {
              tabindex: -1
            },
            on: {
              input: function (t) {
                l && (e.textareaValueChange(t.target.value), e.rawCellValue = t.target.value);
              },
              click: function () {
                e.$emit(Jt);
              },
              copy: function (t) {
                e.$emit(Zt, t);
              },
              paste: function (t) {
                e.$emit(en, t);
              },
              cut: function (t) {
                e.$emit(tn, t);
              }
            }
          };
        return t("div", s, [t("textarea", c)]);
      }
    },
    Ii = "clearCurrentCellRect",
    Ei = "clearNormalEndCellRect";
  function ki(e, t) {
    var n = Object.keys(e);
    if (Object.getOwnPropertySymbols) {
      var o = Object.getOwnPropertySymbols(e);
      t && (o = o.filter(function (t) {
        return Object.getOwnPropertyDescriptor(e, t).enumerable;
      })), n.push.apply(n, o);
    }
    return n;
  }
  function Ti(e) {
    for (var t = 1; t < arguments.length; t++) {
      var n = null != arguments[t] ? arguments[t] : {};
      t % 2 ? ki(Object(n), !0).forEach(function (t) {
        Di(e, t, n[t]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ki(Object(n)).forEach(function (t) {
        Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
      });
    }
    return e;
  }
  function Di(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var _i = {
      name: Tn,
      mixins: [No],
      props: {
        tableEl: {
          type: HTMLTableElement,
          default: null
        },
        allRowKeys: {
          type: Array,
          required: !0
        },
        colgroups: {
          type: Array,
          required: !0
        },
        parentRendered: {
          type: Boolean,
          required: !0
        },
        hooks: {
          type: Object,
          required: !0
        },
        cellAutofillOption: {
          type: [Object, Boolean],
          default: function () {
            return null;
          }
        },
        cellSelectionData: {
          type: Object,
          required: !0
        },
        cellSelectionRangeData: {
          type: Object,
          required: !0
        },
        isAutofillStarting: {
          type: Boolean,
          required: !0
        },
        currentCellSelectionType: {
          type: String,
          default: ""
        },
        showVirtualScrollingPlaceholder: {
          type: Boolean,
          default: !1
        },
        isVirtualScroll: {
          type: Boolean,
          default: !1
        },
        virtualScrollVisibleIndexs: {
          type: Object,
          required: !0
        },
        isCellEditing: {
          type: Boolean,
          default: !1
        }
      },
      data: function () {
        return {
          currentCellEl: null,
          normalEndCellEl: null,
          autoFillEndCellEl: null,
          cellSelectionRect: {
            currentCellRect: {
              left: 0,
              top: 0,
              width: 0,
              height: 0
            },
            normalEndCellRect: {
              left: 0,
              top: 0,
              width: 0,
              height: 0
            },
            autoFillEndCellRect: {
              left: 0,
              top: 0,
              width: 0,
              height: 0
            }
          }
        };
      },
      computed: {
        selectionBordersVisibility: function () {
          var e = !0;
          if (this.isVirtualScroll) {
            var t = this.showVirtualScrollingPlaceholder,
              n = this.cellSelectionData,
              o = this.virtualScrollVisibleIndexs,
              i = this.currentCellSelectionType;
            if (t) e = !1;else {
              var r = n.currentCell,
                l = n.normalEndCell;
              i === bt && (r.rowIndex < o.start || r.rowIndex > o.end) && (e = !1), i === xt && (r.rowIndex < o.start && l.rowIndex < o.start || r.rowIndex > o.end && l.rowIndex > o.end) && (e = !1);
            }
          }
          return e;
        },
        showCorner: function () {
          var e = !0;
          if (this.cellAutofillOption) {
            var t = this.cellAutofillOption,
              n = t.directionX,
              o = t.directionY;
            u(o) && !o && u(n) && !n && (e = !1);
          } else e = !1;
          return e;
        },
        cornerCellInfo: function () {
          var e = this.allRowKeys,
            t = this.colgroups,
            n = this.cellSelectionRangeData,
            o = n.rightColKey,
            i = n.bottomRowKey,
            r = !1;
          if (function (e, t) {
            return !a(e) && !l(t) && t[t.length - 1].key === e;
          }(o, t)) r = !0;else {
            var s = t.findIndex(function (e) {
              return e.key === o;
            });
            t[s + 1].fixed === ct && t[s].fixed !== ct && (r = !0);
          }
          var c = !1;
          return function (e, t) {
            return !a(e) && !l(t) && t[t.length - 1] === e;
          }(i, e) && (c = !0), {
            isLastColumn: r,
            isLastRow: c
          };
        },
        isFirstSelectionRow: function () {
          var e = this.allRowKeys,
            t = this.cellSelectionRangeData;
          return e[0] === t.topRowKey;
        },
        isFirstSelectionCol: function () {
          var e = this.colgroups,
            t = this.cellSelectionRangeData;
          return e[0].key === t.leftColKey;
        },
        isFirstNotFixedSelectionCol: function () {
          var e = !1,
            t = this.colgroups,
            n = this.cellSelectionRangeData;
          if (t.find(function (e) {
            return "left" === e.fixed;
          })) {
            var o = t.find(function (e) {
              return !e.fixed;
            });
            o && o.field === n.leftColKey && (e = !0);
          }
          return e;
        }
      },
      watch: {
        parentRendered: {
          handler: function (e) {
            var t = this;
            e && (this.hooks.addHook(ln, function () {
              t.setCellEls(), t.debounceSetCellEls(), t.resetCellPositions(), t.debounceResetCellPositions();
            }), this.hooks.addHook(an, function () {
              t.debounceResetCellPositions();
            }), this.hooks.addHook(sn, function () {
              t.$nextTick(function () {
                t.resetCellPositions();
              });
            }), this.hooks.addHook(cn, function () {
              t.$nextTick(function () {
                t.resetCellPositions();
              });
            }));
          },
          immediate: !0
        },
        "cellSelectionData.currentCell": {
          handler: function (e) {
            var t = e.rowKey,
              n = e.colKey;
            a(t) || a(n) ? this[Ii]() : (this.setCurrentCellEl(), this.setSelectionPositions({
              type: "currentCell"
            })), this.setCellSelectionRangeData();
          },
          deep: !0,
          immediate: !0
        },
        "cellSelectionData.normalEndCell": {
          handler: function (e) {
            var t = e.rowKey,
              n = e.colKey;
            a(t) || a(n) ? this[Ei]() : (this.setNormalEndCellEl(), this.setSelectionPositions({
              type: "normalEndCell"
            })), this.setCellSelectionRangeData();
          },
          deep: !0,
          immediate: !0
        },
        "cellSelectionData.autoFillEndCell": {
          handler: function (e) {
            var t = e.rowKey,
              n = e.colKey;
            a(t) || a(n) ? this.clearAutofillEndCellRect() : (this.setAutofillEndCellEl(), this.setSelectionPositions({
              type: "autoFillEndCell"
            }));
          },
          deep: !0,
          immediate: !0
        }
      },
      methods: (Oi = {
        resetCellPositions: function () {
          var e = this.cellSelectionData,
            t = e.currentCell,
            n = e.normalEndCell;
          a(t.rowKey) || a(t.colKey) || this.setSelectionPositions({
            type: "currentCell"
          }), a(n.rowKey) || a(n.colKey) || this.setSelectionPositions({
            type: "normalEndCell"
          });
        },
        setCellEls: function () {
          this.isVirtualScroll && this.selectionBordersVisibility && (this.setCurrentCellEl(), this.setNormalEndCellEl());
        },
        setCellSelectionRangeData: function () {
          var e = this.currentCellSelectionType,
            t = this.cellSelectionData,
            n = t.currentCell,
            o = t.normalEndCell,
            i = {};
          if (e === bt) i = {
            leftColKey: n.colKey,
            rightColKey: n.colKey,
            topRowKey: n.rowKey,
            bottomRowKey: n.rowKey
          };else if (e === xt) {
            bo({
              colgroups: this.colgroups,
              colKeys: [n.colKey, o.colKey]
            }) === n.colKey ? (i.leftColKey = n.colKey, i.rightColKey = o.colKey) : (i.leftColKey = o.colKey, i.rightColKey = n.colKey), n.rowIndex < o.rowIndex ? (i.topRowKey = n.rowKey, i.bottomRowKey = o.rowKey) : (i.topRowKey = o.rowKey, i.bottomRowKey = n.rowKey);
          } else i = {
            leftColKey: "",
            rightColKey: "",
            topRowKey: "",
            bottomRowKey: ""
          };
          this.$emit(Lt, i);
        },
        getCellPosition: function (e) {
          var t = e.cellEl,
            n = e.tableLeft,
            o = e.tableTop;
          if (!this.selectionBordersVisibility) return !1;
          var i = t.getBoundingClientRect(),
            r = i.left,
            l = i.top,
            a = i.height,
            s = i.width;
          return a && s ? {
            left: r - n,
            top: l - o,
            width: s,
            height: a
          } : void 0;
        },
        getCellPositionByColKey: function (e) {
          var t,
            n = e.tableLeft,
            o = e.tableTop,
            i = e.colKey,
            r = e.isFirstRow,
            l = e.isLastRow;
          if (!this.selectionBordersVisibility) return !1;
          if (r ? t = this.getTableFirstRowCellByColKey(i) : l && (t = this.getTableLastRowCellByColKey(i)), t) {
            var a = t.getBoundingClientRect(),
              s = a.left,
              c = a.top,
              u = a.width;
            return u ? {
              left: s - n,
              top: c - o,
              width: u
            } : void 0;
          }
        },
        setSelectionPositions: function (e) {
          var t = e.type,
            n = this.allRowKeys,
            o = this.tableEl,
            i = this.currentCellEl,
            r = this.normalEndCellEl,
            l = this.autoFillEndCellEl,
            a = this.cellSelectionData,
            s = this.virtualScrollVisibleIndexs;
          if (0 === n.length) return !1;
          if (!o) return !1;
          var c = o.getBoundingClientRect(),
            u = c.left,
            d = c.top,
            h = !1,
            f = !1;
          if ("currentCell" === t && (h = !0, i)) {
            var p = this.getCellPosition({
              cellEl: i,
              tableLeft: u,
              tableTop: d
            });
            p && (h = !1, this.cellSelectionRect.currentCellRect = p);
          }
          if ("normalEndCell" === t && (f = !0, r)) {
            var y = this.getCellPosition({
              cellEl: r,
              tableLeft: u,
              tableTop: d
            });
            y && (f = !1, this.cellSelectionRect.normalEndCellRect = y);
          }
          if ((h || f) && this.isVirtualScroll) {
            var v,
              g,
              m,
              w = a.currentCell,
              C = a.normalEndCell;
            if (h ? (v = w.colKey, g = w.rowIndex) : (v = C.colKey, g = C.rowIndex), h && !this.cellSelectionRect.currentCellRect.height || f && !this.cellSelectionRect.normalEndCellRect.height) {
              var b = {
                tableLeft: u,
                tableTop: d,
                colKey: v
              };
              g < s.start ? m = this.getCellPositionByColKey(Ti(Ti({}, b), {}, {
                isFirstRow: !0
              })) : g > s.end && (m = this.getCellPositionByColKey(Ti(Ti({}, b), {}, {
                isLastRow: !0
              })));
            } else g < s.start ? m = {
              top: 0
            } : g > s.end && (m = {
              top: o.clientHeight
            });
            h ? Object.assign(this.cellSelectionRect.currentCellRect, m) : Object.assign(this.cellSelectionRect.normalEndCellRect, m);
          }
          if (l && "autoFillEndCell" === t) {
            var x = this.getCellPosition({
              cellEl: l,
              tableLeft: u,
              tableTop: d
            });
            x && (this.cellSelectionRect.autoFillEndCellRect = x);
          }
        },
        getSelectionCurrent: function (e) {
          var t = e.fixedType,
            n = {
              selectionCurrent: null,
              autoFillArea: null
            },
            o = this.cellSelectionRect,
            i = this.colgroups,
            r = this.cellSelectionData,
            l = o.currentCellRect,
            a = o.normalEndCellRect;
          if (!l.width) return n;
          var s = {
            borderWidth: l.width + 1,
            borderHeight: l.height,
            topBorder: {
              show: !0,
              width: 0,
              height: 2,
              top: l.top - 1,
              left: l.left - 1
            },
            rightBorder: {
              show: !0,
              width: 2,
              height: 0,
              top: l.top,
              left: l.left + l.width - 2
            },
            bottomBorder: {
              show: !0,
              width: 0,
              height: 2,
              top: l.top + l.height - 2,
              left: l.left - 1
            },
            leftBorder: {
              show: !0,
              width: 2,
              height: 0,
              top: l.top,
              left: l.left - 1
            },
            corner: {
              show: !a.width,
              top: 0,
              left: 0
            }
          };
          s.corner.top = s.bottomBorder.top - 3, s.corner.left = s.rightBorder.left - 3, a.width || (n.autoFillArea = this.getSelectionAutofillArea({
            areaPostions: s,
            fixedType: t
          }));
          var c = [r.currentCell.colKey],
            u = uo({
              colKeys: c,
              fixedType: t,
              colgroups: i
            });
          return n.selectionCurrent = this.getBorders(Ti(Ti({}, s), {}, {
            showCorner: !a.width,
            className: "selection-current",
            fixedType: t,
            totalColKeys: c,
            fixedColKeys: u
          })), n;
        },
        getSelectionAreas: function (e) {
          var t = e.fixedType,
            n = {
              normalArea: null,
              autoFillArea: null
            },
            o = this.cellSelectionData,
            i = o.currentCell,
            r = o.normalEndCell,
            l = this.cellSelectionRect,
            a = this.cellSelectionRangeData,
            s = this.colgroups,
            c = l.currentCellRect,
            u = l.normalEndCellRect;
          if (!c.width || !u.width) return n;
          var d = {
              borderWidth: 0,
              borderHeight: 0,
              topBorder: {
                show: !0,
                width: 0,
                height: 1,
                top: 0,
                left: 0
              },
              rightBorder: {
                show: !0,
                width: 1,
                height: 0,
                top: 0,
                left: 0
              },
              bottomBorder: {
                show: !0,
                width: 0,
                height: 1,
                top: 0,
                left: 0
              },
              leftBorder: {
                show: !0,
                width: 1,
                height: 0,
                top: 0,
                left: 0
              },
              corner: {
                show: !0,
                top: 0,
                left: 0
              }
            },
            h = bo({
              colgroups: this.colgroups,
              colKeys: [i.colKey, r.colKey]
            });
          h === i.colKey ? (d.borderWidth = u.left - c.left + u.width + 1, d.topBorder.left = c.left - 1, d.bottomBorder.left = c.left - 1, d.leftBorder.left = c.left - 1, d.rightBorder.left = u.left + u.width - 1) : h === r.colKey && (d.borderWidth = c.left - u.left + c.width + 1, d.topBorder.left = u.left - 1, d.rightBorder.left = c.left + c.width - 1, d.bottomBorder.left = u.left - 1, d.leftBorder.left = u.left - 1), u.top > c.top ? (d.borderHeight = u.top - c.top + u.height, d.topBorder.top = c.top - 1, d.rightBorder.top = c.top, d.bottomBorder.top = u.top + u.height - 1, d.leftBorder.top = c.top) : u.top <= c.top && (d.borderHeight = c.top - u.top + c.height, d.topBorder.top = u.top - 1, d.rightBorder.top = u.top, d.bottomBorder.top = c.top + c.height - 1, d.leftBorder.top = u.top), d.corner.top = d.bottomBorder.top - 4, d.corner.left = d.rightBorder.left - 4, u.width && (n.autoFillArea = this.getSelectionAutofillArea({
            areaPostions: d,
            fixedType: t
          }));
          var f = co({
              colKey1: a.leftColKey,
              colKey2: a.rightColKey,
              colgroups: s
            }),
            p = uo({
              colKeys: f,
              fixedType: t,
              colgroups: s
            });
          return n.normalArea = this.getBorders(Ti(Ti({}, d), {}, {
            className: "selection-normal-area",
            fixedType: t,
            totalColKeys: f,
            fixedColKeys: p
          })), n.normalAreaLayer = this.getAreaLayer(Ti(Ti({}, d), {}, {
            className: "selection-normal-area-layer",
            fixedType: t,
            totalColKeys: f,
            fixedColKeys: p
          })), n;
        },
        getSelectionAutofillArea: function (e) {
          var t = e.areaPostions,
            n = e.fixedType,
            o = null,
            i = this.cellAutofillOption,
            r = this.cellSelectionRangeData,
            l = this.cellSelectionRect,
            s = this.cellSelectionData,
            c = this.isAutofillStarting,
            d = this.currentCellSelectionType,
            h = this.colgroups;
          if (!c) return o;
          var f = l.currentCellRect,
            p = l.autoFillEndCellRect;
          if (!f.width || !p.width) return o;
          if (!t) return o;
          var y,
            v,
            g,
            m,
            w,
            C,
            b = {
              borderWidth: 0,
              borderHeight: 0,
              topBorder: {
                show: !0,
                width: 0,
                height: 1,
                top: 0,
                left: 0
              },
              rightBorder: {
                show: !0,
                width: 1,
                height: 0,
                top: 0,
                left: 0
              },
              bottomBorder: {
                show: !0,
                width: 0,
                height: 1,
                top: 0,
                left: 0
              },
              leftBorder: {
                show: !0,
                width: 1,
                height: 0,
                top: 0,
                left: 0
              },
              corner: {
                show: !1,
                top: 0,
                left: 0
              }
            },
            x = s.currentCell,
            R = s.autoFillEndCell,
            S = r.leftColKey,
            O = r.rightColKey;
          if (d === bt && (S = x.colKey, O = x.colKey), S !== R.colKey && (y = bo({
            colgroups: h,
            colKeys: [S, R.colKey]
          })), O !== R.colKey && (v = Co({
            type: "rightmost",
            colgroups: (g = {
              colgroups: h,
              colKeys: [O, R.colKey]
            }).colgroups,
            colKeys: g.colKeys
          })), p.top > t.bottomBorder.top) m = wt, w = S, C = O, b.topBorder.show = !1, b.borderWidth = t.borderWidth, b.borderHeight = p.top - t.bottomBorder.top + p.height, b.rightBorder.top = t.bottomBorder.top, b.rightBorder.left = t.rightBorder.left, d === bt && b.rightBorder.left++, b.leftBorder.top = t.bottomBorder.top, b.leftBorder.left = t.leftBorder.left, b.bottomBorder.top = p.top + p.height - 1, b.bottomBorder.left = t.bottomBorder.left;else if (p.top < t.topBorder.top) m = gt, w = S, C = O, b.bottomBorder.show = !1, b.borderWidth = t.borderWidth, b.borderHeight = t.topBorder.top - p.top, b.topBorder.top = p.top - 1, b.topBorder.left = t.topBorder.left, b.rightBorder.top = p.top, b.rightBorder.left = t.rightBorder.left, d === bt && b.rightBorder.left++, b.leftBorder.top = p.top, b.leftBorder.left = t.leftBorder.left;else if (v !== R.colKey || a(v)) {
            if (y !== R.colKey || a(y)) return o;
            m = Ct, w = function (e) {
              var t = e.colgroups,
                n = e.currentColKey,
                o = null;
              if (!a(n)) {
                var i = t.findIndex(function (e) {
                  return e.key === n;
                });
                0 === i ? o = n : i > 0 && (o = t[i - 1].key);
              }
              return o;
            }({
              colgroups: h,
              currentColKey: S
            }), C = R.colKey, b.rightBorder.show = !1, b.borderWidth = t.leftBorder.left - p.left + 1, b.borderHeight = t.borderHeight, b.topBorder.top = t.topBorder.top, b.topBorder.left = p.left, b.rightBorder.left = t.topBorder.left, b.bottomBorder.top = t.bottomBorder.top, b.bottomBorder.left = p.left, b.leftBorder.top = t.topBorder.top, b.leftBorder.left = p.left;
          } else m = mt, w = function (e) {
            var t = e.colgroups,
              n = e.currentColKey,
              o = null;
            if (!a(n)) {
              var i = t.findIndex(function (e) {
                return e.key === n;
              });
              i === t.length - 1 ? o = n : i < t.length - 1 && (o = t[i + 1].key);
            }
            return o;
          }({
            colgroups: h,
            currentColKey: O
          }), C = R.colKey, b.leftBorder.show = !1, b.borderWidth = p.left - t.rightBorder.left + p.width + 1, b.borderHeight = t.borderHeight, b.topBorder.top = t.topBorder.top, b.topBorder.left = t.rightBorder.left - 1, b.rightBorder.top = t.topBorder.top, b.rightBorder.left = p.left + p.width - 1, b.bottomBorder.top = t.bottomBorder.top, b.bottomBorder.left = t.rightBorder.left - 1;
          var K = i.directionX,
            I = i.directionY;
          if (u(K) && !K && (m === Ct || m === mt)) return !1;
          if (u(I) && !I && (m === gt || m === wt)) return !1;
          var E = co({
              colKey1: w,
              colKey2: C,
              colgroups: h
            }),
            k = uo({
              colKeys: E,
              fixedType: n,
              colgroups: h
            });
          return (o = this.getBorders(Ti(Ti({
            className: "selection-autofill-area"
          }, b), {}, {
            fixedType: n,
            totalColKeys: E,
            fixedColKeys: k
          }))) && this.dispatch(hn, rn, m), o;
        },
        getBorders: function (e) {
          var t = this,
            n = e.borderWidth,
            o = e.borderHeight,
            i = e.topBorder,
            r = e.rightBorder,
            l = e.bottomBorder,
            a = e.leftBorder,
            s = e.corner,
            c = e.className,
            u = e.fixedType,
            d = e.totalColKeys,
            h = e.fixedColKeys,
            f = this.$createElement,
            p = this.cornerCellInfo,
            y = this.colgroups,
            v = this.isFirstSelectionRow,
            g = this.isFirstSelectionCol,
            m = this.isFirstNotFixedSelectionCol,
            w = this.showCorner;
          if (!(u ? mo({
            fixedType: u,
            colKeys: d,
            colgroups: y
          }) : wo({
            colKeys: d,
            colgroups: y
          }))) return null;
          var C = 0;
          h.length && (C = oo({
            colKeys: h,
            colgroups: y
          })), u && (n = C, u === st && (n += 1)), u === st && d.length !== h.length && (r.show = !1, s.show = !1), u === ct && (d.length !== h.length && (a.show = !1), i.left = r.left - n + 1, l.left = r.left - n + 1), v && (i.top += 1), g && (a.left += 1), m && (a.left += 1);
          var b = s.top,
            x = s.left,
            R = "1px",
            S = "1px";
          p.isLastRow && (b -= 3, S = "0px"), p.isLastColumn && (x -= 3, R = "0px"), w || (s.show = !1);
          var O = {
            class: Yn("selection-corner"),
            style: {
              display: s.show ? "block" : "none",
              top: b + "px",
              left: x + "px",
              borderWidth: "1px ".concat(R, " ").concat(S, " 1px")
            },
            on: {
              mousedown: function (e) {
                t.dispatch(hn, nn, {
                  event: e
                });
              },
              mouseup: function (e) {
                t.dispatch(hn, on, {
                  event: e
                });
              }
            }
          };
          return f("div", {
            class: Yn(c)
          }, [f("div", {
            style: {
              display: i.show ? "block" : "none",
              width: n + "px",
              height: i.height + "px",
              top: i.top + "px",
              left: i.left + "px"
            },
            class: Yn("selection-border")
          }), f("div", {
            style: {
              display: r.show ? "block" : "none",
              width: r.width + "px",
              height: o + "px",
              top: r.top + "px",
              left: r.left + "px"
            },
            class: Yn("selection-border")
          }), f("div", {
            style: {
              display: l.show ? "block" : "none",
              width: n + "px",
              height: l.height + "px",
              top: l.top + "px",
              left: l.left + "px"
            },
            class: Yn("selection-border")
          }), f("div", {
            style: {
              display: a.show ? "block" : "none",
              width: a.width + "px",
              height: o + "px",
              top: a.top + "px",
              left: a.left + "px"
            },
            class: Yn("selection-border")
          }), f("div", O)]);
        },
        getAreaLayer: function (e) {
          var t = e.borderWidth,
            n = e.borderHeight,
            o = e.topBorder,
            i = e.className,
            r = e.fixedType,
            l = e.totalColKeys,
            a = e.fixedColKeys,
            s = this.$createElement,
            c = this.colgroups;
          if (!(r ? mo({
            fixedType: r,
            colKeys: l,
            colgroups: c
          }) : wo({
            colKeys: l,
            colgroups: c
          }))) return null;
          var u = 0;
          return a.length && (u = oo({
            colKeys: a,
            colgroups: c
          })), r && (t = u, r === st && (t += 1)), s("div", {
            class: Yn(i),
            style: {
              top: o.top + "px",
              left: o.left + "px",
              width: t + "px",
              height: n + "px"
            }
          });
        },
        getTableFirstRowCellByColKey: function (e) {
          var t = null,
            n = this.tableEl;
          return n && (t = n.querySelector('tbody.ve-table-body tr td[col-key="'.concat(e, '"]'))), t;
        },
        getTableLastRowCellByColKey: function (e) {
          var t = null,
            n = this.tableEl;
          return n && (t = n.querySelector('tbody.ve-table-body tr:last-child td[col-key="'.concat(e, '"]'))), t;
        },
        getTableCellEl: function (e) {
          var t = e.rowKey,
            n = e.colKey,
            o = null,
            i = this.tableEl;
          return i && (o = i.querySelector('tbody.ve-table-body tr[row-key="'.concat(t, '"] td[col-key="').concat(n, '"]'))), o;
        },
        setCurrentCellEl: function () {
          var e = this.cellSelectionData.currentCell,
            t = e.rowKey,
            n = e.colKey;
          if (!a(t) && !a(n)) {
            var o = this.getTableCellEl({
              rowKey: t,
              colKey: n
            });
            o && (this.currentCellEl = o);
          }
        },
        setNormalEndCellEl: function () {
          var e = this.cellSelectionData.normalEndCell,
            t = e.rowKey,
            n = e.colKey;
          if (!a(t) && !a(n)) {
            var o = this.getTableCellEl({
              rowKey: t,
              colKey: n
            });
            o && (this.normalEndCellEl = o);
          }
        },
        setAutofillEndCellEl: function () {
          var e = this.cellSelectionData,
            t = this.tableEl,
            n = e.autoFillEndCell,
            o = n.rowKey,
            i = n.colKey;
          if (t) {
            var r = t.querySelector('tbody.ve-table-body tr[row-key="'.concat(o, '"] td[col-key="').concat(i, '"]'));
            r && (this.autoFillEndCellEl = r);
          }
        },
        clearAutofillEndCellRect: function () {
          this.autoFillEndCellEl = null, this.cellSelectionRect.autoFillEndCellRect = {
            left: 0,
            top: 0,
            width: 0,
            height: 0
          };
        }
      }, Di(Oi, Ii, function () {
        this.currentCellEl = null, this.cellSelectionRect.currentCellRect = {
          left: 0,
          top: 0,
          width: 0,
          height: 0
        };
      }), Di(Oi, Ei, function () {
        this.normalEndCellEl = null, this.cellSelectionRect.normalEndCellRect = {
          left: 0,
          top: 0,
          width: 0,
          height: 0
        };
      }), Oi),
      created: function () {
        this.debounceResetCellPositions = Object(Y.debounce)(this.resetCellPositions, 210), this.debounceSetCellEls = Object(Y.debounce)(this.setCellEls, 200);
      },
      render: function () {
        var e = arguments[0];
        if (!this.selectionBordersVisibility) return null;
        var t = this.getSelectionCurrent({
            fixedType: st
          }),
          n = this.getSelectionAreas({
            fixedType: st
          }),
          o = t.autoFillArea || n.autoFillArea,
          i = this.getSelectionCurrent({
            fixedType: ""
          }),
          r = this.getSelectionAreas({
            fixedType: ""
          }),
          l = i.autoFillArea || r.autoFillArea,
          a = this.getSelectionCurrent({
            fixedType: ct
          }),
          s = this.getSelectionAreas({
            fixedType: ct
          }),
          c = a.autoFillArea || s.autoFillArea;
        return e("div", {
          class: Yn("selection-wrapper"),
          style: {
            visibility: this.isCellEditing ? "hidden" : ""
          }
        }, [e("div", {
          class: Yn("selection-fixed-left")
        }, [t.selectionCurrent, n.normalArea, o, n.normalAreaLayer]), e("div", {
          class: Yn("selection-middle")
        }, [i.selectionCurrent, r.normalArea, l, r.normalAreaLayer]), e("div", {
          class: Yn("selection-fixed-right")
        }, [a.selectionCurrent, s.normalArea, c, s.normalAreaLayer])]);
      }
    },
    Ai = n(140),
    Pi = n.n(Ai);
  function Bi(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var ji,
    Mi = {
      name: Dn,
      props: {
        parentRendered: {
          type: Boolean,
          required: !0
        },
        tableContainerEl: {
          type: HTMLDivElement,
          default: null
        },
        hooks: {
          type: Object,
          required: !0
        },
        colgroups: {
          type: Array,
          required: !0
        },
        isColumnResizerHover: {
          type: Boolean,
          required: !0
        },
        isColumnResizing: {
          type: Boolean,
          required: !0
        },
        setIsColumnResizerHover: {
          type: Function,
          required: !0
        },
        setIsColumnResizing: {
          type: Function,
          required: !0
        },
        setColumnWidth: {
          type: Function,
          required: !0
        },
        columnWidthResizeOption: {
          type: Object,
          default: function () {
            return null;
          }
        }
      },
      data: function () {
        return {
          columnResizerStartX: 0,
          currentResizingColumn: null,
          columnResizerHandlerWidth: 5,
          columnResizerRect: {
            top: 0,
            left: 0,
            height: 0
          }
        };
      },
      computed: {
        columnMinWidth: function () {
          var e = 30,
            t = this.columnWidthResizeOption;
          if (t) {
            var n = t.minWidth;
            d(n) && n > 0 && (e = n);
          }
          return e;
        }
      },
      watch: {
        parentRendered: {
          handler: function (e) {
            var t = this;
            e && this.hooks.addHook(un, function (e) {
              var n = e.event,
                o = e.column;
              o.disableResizing || t.initColumnResizerPosition({
                event: n,
                column: o
              });
            });
          },
          immediate: !0
        }
      },
      methods: {
        initColumnResizerPosition: function (e) {
          var t = e.event,
            n = e.column,
            o = this.tableContainerEl,
            i = this.isColumnResizing;
          if (o && !i) {
            var r = o.getBoundingClientRect(),
              l = r.left,
              a = r.top,
              s = this.colgroups.find(function (e) {
                return e.key === n.key;
              });
            if (!s) return !1;
            if (s._realTimeWidth) {
              var c = t.target.getBoundingClientRect(),
                u = c.height,
                d = c.left,
                h = c.top;
              this.columnResizerRect.left = d + s._realTimeWidth - l, this.columnResizerRect.top = h - a, this.columnResizerRect.height = u, this.currentResizingColumn = s, this.columnResizerStartX = d + s._realTimeWidth;
            } else console.warn("Resizer column needs set column width");
          }
        },
        setColumnResizerPositionByDrag: function (e) {
          var t = this.tableContainerEl,
            n = this.isColumnResizing,
            o = this.currentResizingColumn;
          if (t && n) {
            var i = t.getBoundingClientRect().left;
            if (n && o) {
              var r = this.columnResizerStartX,
                l = this.columnMinWidth;
              o._realTimeWidth + (e.clientX - r) > l && (this.columnResizerRect.left = e.clientX - i);
            }
          }
        },
        columnResizerHandlerMousedown: function (e) {
          e.event;
          this.isColumnResizerHover && (this.setIsColumnResizing(!0), document.addEventListener("mousemove", this.setColumnResizerPositionByDrag), document.addEventListener("mouseup", this.columnResizerMouseup), document.onselectstart = function () {
            return !1;
          }, document.ondragstart = function () {
            return !1;
          });
        },
        columnResizerMouseup: function (e) {
          var t,
            n = this.isColumnResizing,
            o = this.currentResizingColumn,
            i = this.columnResizerStartX,
            r = this.setColumnWidth,
            l = this.columnWidthResizeOption,
            a = this.columnMinWidth;
          if (!n || !o) return !1;
          if (t = o._realTimeWidth + (e.clientX - i) < a ? a - o._realTimeWidth : e.clientX - i, t = Math.floor(t), Math.abs(t) > 1) {
            var s = o._realTimeWidth;
            if (s += t, r({
              colKey: o.key,
              width: s
            }), l) {
              var c = l.sizeChange;
              c && c({
                column: o,
                differWidth: t,
                columnWidth: s
              });
            }
          }
          this.clearColumnResizerStatus(), document.removeEventListener("mousemove", this.setColumnResizerPositionByDrag), document.removeEventListener("mouseup", this.columnResizerMouseup);
        },
        clearColumnResizerStatus: function () {
          this.currentResizingColumn = null, this.columnResizerStartX = 0, this.setIsColumnResizerHover(!1), this.setIsColumnResizing(!1), document.onselectstart = function () {
            return !0;
          }, document.ondragstart = function () {
            return !0;
          };
        }
      },
      render: function () {
        var e,
          t = this,
          n = arguments[0],
          o = this.isColumnResizerHover,
          i = this.isColumnResizing,
          r = this.columnResizerRect,
          l = this.columnResizerHandlerWidth,
          a = r.left,
          s = r.top,
          c = r.height,
          u = {
            class: (e = {}, Bi(e, Yn("column-resizer-handler"), !0), Bi(e, "active", o || i), e),
            style: {
              left: a - l + "px",
              top: s + "px",
              height: c + "px"
            },
            on: {
              click: function () {},
              mousedown: function (e) {
                t.columnResizerHandlerMousedown({
                  event: e
                });
              },
              mouseenter: function () {
                t.setIsColumnResizerHover(!0);
              },
              mouseleave: function () {
                t.setIsColumnResizerHover(!1);
              },
              mouseup: function (e) {
                t.columnResizerMouseup(e);
              }
            }
          },
          d = {
            class: [Yn("column-resizer-line")],
            style: {
              display: i ? "block" : "none",
              left: a + "px"
            }
          };
        return n("div", {
          class: Yn("column-resizer")
        }, [n("div", u), n("div", d)]);
      }
    };
  function Vi(e, t) {
    var n = Object.keys(e);
    if (Object.getOwnPropertySymbols) {
      var o = Object.getOwnPropertySymbols(e);
      t && (o = o.filter(function (t) {
        return Object.getOwnPropertyDescriptor(e, t).enumerable;
      })), n.push.apply(n, o);
    }
    return n;
  }
  function Ni(e) {
    for (var t = 1; t < arguments.length; t++) {
      var n = null != arguments[t] ? arguments[t] : {};
      t % 2 ? Vi(Object(n), !0).forEach(function (t) {
        Fi(e, t, n[t]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Vi(Object(n)).forEach(function (t) {
        Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
      });
    }
    return e;
  }
  function Fi(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e;
  }
  var Li = r("table"),
    Hi = {
      name: hn,
      directives: {
        "click-outside": te
      },
      mixins: [No],
      props: {
        tableData: {
          required: !0,
          type: Array
        },
        footerData: {
          type: Array,
          default: function () {
            return [];
          }
        },
        showHeader: {
          type: Boolean,
          default: !0
        },
        columns: {
          type: Array,
          required: !0
        },
        rowKeyFieldName: {
          type: String,
          default: null
        },
        scrollWidth: {
          type: [Number, String],
          default: null
        },
        maxHeight: {
          type: [Number, String],
          default: null
        },
        fixedHeader: {
          type: Boolean,
          default: !0
        },
        fixedFooter: {
          type: Boolean,
          default: !0
        },
        borderAround: {
          type: Boolean,
          default: !0
        },
        borderX: {
          type: Boolean,
          default: !0
        },
        borderY: {
          type: Boolean,
          default: !1
        },
        eventCustomOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellStyleOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellSpanOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        rowStyleOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        virtualScrollOption: {
          type: Object,
          default: null
        },
        sortOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        expandOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        checkboxOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        radioOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellSelectionOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        cellAutofillOption: {
          type: [Object, Boolean],
          default: function () {
            return null;
          }
        },
        editOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        columnHiddenOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        contextmenuHeaderOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        contextmenuBodyOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        clipboardOption: {
          type: Object,
          default: function () {
            return null;
          }
        },
        columnWidthResizeOption: {
          type: Object,
          default: function () {
            return null;
          }
        }
      },
      data: function () {
        return {
          hooks: {},
          parentRendered: !1,
          tableViewportWidth: 0,
          columnsOptionResetTime: 0,
          tableRootRef: "tableRootRef",
          tableContainerWrapperRef: "tableContainerWrapperRef",
          tableContainerRef: "tableContainerRef",
          tableRef: "tableRef",
          tableBodyRef: "tableBodyRef",
          tableContentWrapperRef: "tableContentWrapperRef",
          virtualPhantomRef: "virtualPhantomRef",
          editInputRef: "editInputRef",
          cellSelectionRef: "cellSelectionRef",
          contextmenuRef: "contextmenuRef",
          cloneColumns: [],
          isGroupHeader: !1,
          headerRows: [],
          footerRows: [],
          colgroups: [],
          groupColumns: [],
          hiddenColumns: [],
          virtualScrollVisibleData: [],
          virtualScrollVisibleIndexs: {
            start: -1,
            end: -1
          },
          defaultVirtualScrollBufferScale: 1,
          defaultVirtualScrollMinRowHeight: 40,
          defaultPlaceholderPerScrollingRowCount: 8,
          virtualScrollStartIndex: 0,
          previewVirtualScrollStartIndex: 0,
          virtualScrollEndIndex: 0,
          showVirtualScrollingPlaceholder: !1,
          disablePointerEventsTimeoutId: null,
          isLeftScrolling: !1,
          isRightScrolling: !1,
          isVerticalScrolling: !1,
          hasXScrollBar: !1,
          hasYScrollBar: !1,
          scrollBarWidth: 0,
          previewTableContainerScrollLeft: null,
          headerIndicatorColKeys: {
            startColKey: "",
            startColKeyIndex: -1,
            endColKey: "",
            endColKeyIndex: -1
          },
          bodyIndicatorRowKeys: {
            startRowKey: "",
            startRowKeyIndex: -1,
            endRowKey: "",
            endRowKeyIndex: -1
          },
          cellSelectionData: {
            currentCell: {
              rowKey: "",
              colKey: "",
              rowIndex: -1
            },
            normalEndCell: {
              rowKey: "",
              colKey: "",
              rowIndex: -1
            },
            autoFillEndCell: {
              rowKey: "",
              colKey: ""
            }
          },
          cellSelectionRangeData: {
            leftColKey: "",
            rightColKey: "",
            topRowKey: "",
            bottomRowKey: ""
          },
          isHeaderCellMousedown: !1,
          isBodyCellMousedown: !1,
          isBodyOperationColumnMousedown: !1,
          isAutofillStarting: !1,
          autofillingDirection: null,
          currentCellSelectionType: "",
          tableOffestHeight: 0,
          tableHeight: 0,
          highlightRowKey: "",
          editingCell: {
            rowKey: "",
            colKey: "",
            row: null,
            column: null
          },
          editorInputStartValue: "",
          enableStopEditing: !0,
          contextmenuEventTarget: "",
          contextmenuOptions: [],
          isColumnResizerHover: !1,
          isColumnResizing: !1
        };
      },
      computed: {
        actualRenderTableData: function () {
          return this.isVirtualScroll ? this.virtualScrollVisibleData : this.tableData;
        },
        allRowKeys: function () {
          var e = [],
            t = this.tableData,
            n = this.rowKeyFieldName;
          return n && (e = t.map(function (e) {
            return e[n];
          })), e;
        },
        virtualScrollBufferCount: function () {
          var e = 0,
            t = this.virtualScrollOption,
            n = this.defaultVirtualScrollBufferScale,
            o = this.virtualScrollVisibleCount;
          if (t) {
            var i = t.bufferScale;
            e = (d(i) && i > 0 ? i : n) * o;
          }
          return e;
        },
        virtualScrollVisibleCount: function () {
          var e = 0,
            t = this.isVirtualScroll,
            n = this.virtualScrollOption,
            o = this.defaultVirtualScrollMinRowHeight,
            i = this.maxHeight,
            r = this.tableOffestHeight;
          if (t && i) {
            var l = d(n.minRowHeight) ? n.minRowHeight : o;
            d(i) ? e = Math.ceil(i / l) : r && (e = Math.ceil(r / l));
          }
          return e;
        },
        tableContainerWrapperStyle: function () {
          return {
            width: "100%"
          };
        },
        tableContainerStyle: function () {
          var e = h(this.maxHeight),
            t = null;
          this.isVirtualScroll ? e ? t = e : console.error("maxHeight prop is required when 'virtualScrollOption.enable = true'") : (t = this.tableHeight, this.hasXScrollBar && (t += this.getScrollBarWidth()), t = h(t));
          return {
            "max-height": e,
            height: t
          };
        },
        tableStyle: function () {
          return {
            width: h(this.scrollWidth)
          };
        },
        tableClass: function () {
          var e;
          return Fi(e = {}, Yn("border-x"), this.borderX), Fi(e, Yn("border-y"), this.borderY), e;
        },
        tableContainerClass: function () {
          var e,
            t = this.isVirtualScroll,
            n = this.isLeftScrolling,
            o = this.isRightScrolling,
            i = this.isVerticalScrolling,
            r = this.isCellEditing,
            l = this.isAutofillStarting,
            a = this.enableCellSelection;
          return Fi(e = {}, Yn("container"), !0), Fi(e, Yn("virtual-scroll"), t), Fi(e, Yn("container-left-scrolling"), n), Fi(e, Yn("container-right-scrolling"), o), Fi(e, Yn("container-vertical-scrolling"), i), Fi(e, Yn("is-cell-editing"), r), Fi(e, Yn("autofilling"), l), Fi(e, Yn("enable-cell-selection"), a), e;
        },
        tableBodyClass: function () {
          var e,
            t = this.rowStyleOption,
            n = !0,
            o = !0,
            i = !1;
          return t && (n = t.hoverHighlight, o = t.clickHighlight, i = t.stripe), Fi(e = {}, Yn("stripe"), !0 === i), Fi(e, Yn("row-hover"), !1 !== n), Fi(e, Yn("row-highlight"), !1 !== o), e;
        },
        isVirtualScroll: function () {
          var e = this.virtualScrollOption;
          return e && e.enable;
        },
        hasFixedColumn: function () {
          return this.colgroups.some(function (e) {
            return e.fixed === st || e.fixed === ct;
          });
        },
        hasLeftFixedColumn: function () {
          return this.colgroups.some(function (e) {
            return e.fixed === st;
          });
        },
        hasRightFixedColumn: function () {
          return this.colgroups.some(function (e) {
            return e.fixed === ct;
          });
        },
        isCellEditing: function () {
          var e = this.editingCell;
          return !a(e.rowKey) && !a(e.colKey);
        },
        hasEditColumn: function () {
          return this.colgroups.some(function (e) {
            return e.edit;
          });
        },
        enableHeaderContextmenu: function () {
          var e = !1,
            t = this.contextmenuHeaderOption;
          if (t) {
            var n = t.contextmenus;
            Array.isArray(n) && n.length && (e = !0);
          }
          return e;
        },
        enableBodyContextmenu: function () {
          var e = !1,
            t = this.contextmenuBodyOption;
          if (t) {
            var n = t.contextmenus;
            Array.isArray(n) && n.length && (e = !0);
          }
          return e;
        },
        contextMenuType: function () {
          return this.headerIndicatorColKeys.startColKeyIndex > -1 ? qn : Gn;
        },
        enableCellSelection: function () {
          var e = !0,
            t = this.cellSelectionOption;
          return (a(this.rowKeyFieldName) || t && u(t.enable) && !1 === t.enable) && (e = !1), e;
        },
        enableClipboard: function () {
          return this.rowKeyFieldName;
        },
        enableColumnResize: function () {
          var e = !1,
            t = this.columnWidthResizeOption;
          if (t) {
            var n = t.enable;
            u(n) && (e = n);
          }
          return e;
        },
        headerTotalHeight: function () {
          var e = 0;
          return this.showHeader && (e = this.headerRows.reduce(function (e, t) {
            return t.rowHeight + e;
          }, 0)), e;
        },
        footerTotalHeight: function () {
          return this.footerRows.reduce(function (e, t) {
            return t.rowHeight + e;
          }, 0);
        }
      },
      watch: {
        tableData: {
          handler: function (e, t) {
            this.initVirtualScrollPositions(), t && this.initVirtualScroll();
          },
          immediate: !0
        },
        allRowKeys: {
          handler: function (e) {
            if (Array.isArray(e)) {
              var t = this.cellSelectionData.currentCell;
              t.rowIndex > -1 && -1 === e.indexOf(t.rowKey) && this.clearCellSelectionCurrentCell();
            }
          },
          immediate: !1
        },
        columns: {
          handler: function (e, t) {
            this.initColumns(), this.initGroupColumns(), this.initColumnWidthByColumnResize(), e != t && t && (this.columnsOptionResetTime++, this.initScrolling());
          },
          immediate: !0
        },
        cloneColumns: {
          handler: function () {
            this.initGroupColumns(), this.initColumnWidthByColumnResize(), this.columnsOptionResetTime++, this.initScrolling();
          },
          immediate: !1
        },
        groupColumns: {
          handler: function (e) {
            l(e) || this.initHeaderRows();
          },
          immediate: !0
        },
        footerData: {
          handler: function (e) {
            l(e) || this.initFooterRows();
          },
          immediate: !0
        },
        "virtualScrollOption.enable": {
          handler: function (e) {
            e ? (this.initVirtualScrollPositions(), this.initVirtualScroll()) : this.setTableContentTopValue({
              top: 0
            });
          },
          immediate: !1
        },
        isAutofillStarting: {
          handler: function (e) {
            e || (this.setCellSelectionByAutofill(), this.clearCellSelectionAutofillEndCell());
          }
        },
        "cellSelectionData.currentCell": {
          handler: function () {
            this.setCurrentCellSelectionType();
          },
          deep: !0,
          immediate: !0
        },
        "cellSelectionData.normalEndCell": {
          handler: function () {
            this.setCurrentCellSelectionType();
          },
          deep: !0,
          immediate: !0
        },
        headerIndicatorColKeys: {
          handler: function () {
            this.setRangeCellSelectionByHeaderIndicator();
          },
          deep: !0
        },
        bodyIndicatorRowKeys: {
          handler: function () {
            this.setRangeCellSelectionByBodyIndicator();
          },
          deep: !0
        }
      },
      methods: (ji = {
        initHeaderRows: function () {
          var e = this.groupColumns;
          Array.isArray(e) && (this.headerRows = e.map(function () {
            return {
              rowHeight: 0
            };
          }));
        },
        initFooterRows: function () {
          var e = this.footerData;
          Array.isArray(e) && (this.footerRows = e.map(function () {
            return {
              rowHeight: 0
            };
          }));
        },
        headerRowHeightChange: function (e) {
          var t = e.rowIndex,
            n = e.height;
          this.headerRows.splice(t, 1, {
            rowHeight: n
          });
        },
        footRowHeightChange: function (e) {
          var t = e.rowIndex,
            n = e.height;
          this.footerRows.splice(t, 1, {
            rowHeight: n
          });
        },
        bodyCellWidthChange: function (e) {
          this.colgroups = this.colgroups.map(function (t) {
            return t._realTimeWidth = e.get(t.key), t;
          }), this.hooks.triggerHook(sn);
        },
        setColumnWidth: function (e) {
          var t = this,
            n = e.colKey,
            o = e.width;
          this.colgroups = this.colgroups.map(function (e) {
            return e.key === n && (e._columnResizeWidth = o), e;
          }), this.$nextTick(function () {
            t.setScrollBarStatus();
          }), this.hooks.triggerHook(sn);
        },
        updateColgroupsBySortChange: function (e) {
          this.colgroups = this.colgroups.map(function (t) {
            return Object.keys(e).indexOf(t.field) > -1 && (t.sortBy = e[t.field]), t;
          });
        },
        initColumnWidthByColumnResize: function () {
          var e = this.enableColumnResize;
          e && (this.colgroups = this.colgroups.map(function (e) {
            var t = 50;
            return d(e.width) && (t = e.width), e._columnResizeWidth = t, e;
          }));
        },
        initColumns: function () {
          var e = this.columnHiddenOption;
          if (e) {
            var t = e.defaultHiddenColumnKeys;
            l(t) || (this.hiddenColumns = t);
          }
          this.showOrHideColumns();
        },
        showOrHideColumns: function () {
          var e = Object(Y.cloneDeep)(this.columns);
          e = e.map(function (e) {
            return e.operationColumn && (e.fixed = st), e;
          });
          var t = this.hiddenColumns;
          l(t) || t.forEach(function (t) {
            e = function e(t, n) {
              return t.filter(function (t) {
                return "children" in t && (t.children = e(t.children, n)), t.key !== n;
              });
            }(e, t);
          }), this.cloneColumns = e;
        },
        initGroupColumns: function () {
          var e = io(this.cloneColumns);
          this.isGroupHeader = e.isGroupHeader, this.colgroups = e.colgroups, this.groupColumns = e.groupColumns;
        },
        getScrollBarWidth: function () {
          var e = 0,
            t = this.scrollBarWidth;
          return t ? e = t : (e = function () {
            var e = document.createElement("div");
            e.className = "ve-scrollbar-wrap", e.style.visibility = "hidden", e.style.width = "100px", e.style.position = "absolute", e.style.top = "-9999px", document.body.appendChild(e);
            var t = e.offsetWidth;
            e.style.overflow = "scroll";
            var n = document.createElement("div");
            n.style.width = "100%", e.appendChild(n);
            var o = n.offsetWidth;
            return e.parentNode.removeChild(e), t - o;
          }(), this.scrollBarWidth = e), e;
        },
        selectedAllChange: function (e) {
          var t = e.isSelected;
          this.broadcast(wn, Mt, {
            isSelected: t
          });
        },
        setSelectedAllInfo: function (e) {
          var t = e.isSelected,
            n = e.isIndeterminate;
          this.broadcast(vn, Vt, {
            isSelected: t,
            isIndeterminate: n
          });
        },
        cellSelectionCurrentCellChange: function (e) {
          var t = e.rowKey,
            n = e.colKey;
          this.cellSelectionData.currentCell.colKey = n, this.cellSelectionData.currentCell.rowKey = t, this.cellSelectionData.currentCell.rowIndex = this.allRowKeys.indexOf(t);
        },
        cellSelectionNormalEndCellChange: function (e) {
          var t = e.rowKey,
            n = e.colKey;
          this.cellSelectionData.normalEndCell.colKey = n, this.cellSelectionData.normalEndCell.rowKey = t, this.cellSelectionData.normalEndCell.rowIndex = this.allRowKeys.indexOf(t);
        },
        cellSelectionAutofillCellChange: function (e) {
          var t = e.rowKey,
            n = e.colKey;
          this.cellSelectionData.autoFillEndCell.colKey = n, this.cellSelectionData.autoFillEndCell.rowKey = t;
        },
        clearCellSelectionCurrentCell: function () {
          this.cellSelectionCurrentCellChange({
            rowKey: "",
            colKey: "",
            rowIndex: -1
          });
        },
        clearCellSelectionNormalEndCell: function () {
          this.cellSelectionNormalEndCellChange({
            rowKey: "",
            colKey: "",
            rowIndex: -1
          });
        },
        clearCellSelectionAutofillEndCell: function () {
          this.cellSelectionAutofillCellChange({
            rowKey: "",
            colKey: ""
          });
        },
        headerIndicatorColKeysChange: function (e) {
          var t = e.startColKey,
            n = e.endColKey,
            o = this.colgroups;
          this.headerIndicatorColKeys.startColKey = t, this.headerIndicatorColKeys.startColKeyIndex = o.findIndex(function (e) {
            return e.key === t;
          }), this.headerIndicatorColKeys.endColKey = n, this.headerIndicatorColKeys.endColKeyIndex = o.findIndex(function (e) {
            return e.key === n;
          });
        },
        clearHeaderIndicatorColKeys: function () {
          this.headerIndicatorColKeys.startColKey = "", this.headerIndicatorColKeys.startColKeyIndex = -1, this.headerIndicatorColKeys.endColKey = "", this.headerIndicatorColKeys.endColKeyIndex = -1;
        },
        bodyIndicatorRowKeysChange: function (e) {
          var t = e.startRowKey,
            n = e.endRowKey,
            o = this.allRowKeys;
          this.bodyIndicatorRowKeys.startRowKey = t, this.bodyIndicatorRowKeys.startRowKeyIndex = o.indexOf(t), this.bodyIndicatorRowKeys.endRowKey = n, this.bodyIndicatorRowKeys.endRowKeyIndex = o.indexOf(n);
        },
        clearBodyIndicatorRowKeys: function () {
          this.bodyIndicatorRowKeys.startRowKey = "", this.bodyIndicatorRowKeys.startRowKeyIndex = -1, this.bodyIndicatorRowKeys.endRowKey = "", this.bodyIndicatorRowKeys.endRowKeyIndex = -1;
        },
        setCellSelectionByAutofill: function () {
          var e = this.cellAutofillOption,
            t = this.cellSelectionRangeData,
            n = this.colgroups,
            o = this.allRowKeys,
            i = this.autofillingDirection,
            r = this.currentCellSelectionType,
            l = this.cellSelectionData,
            s = l.autoFillEndCell,
            d = l.currentCell,
            h = s.rowKey,
            f = s.colKey;
          if (a(h) || a(f)) return !1;
          var p = {},
            y = {},
            v = t.leftColKey,
            g = t.rightColKey,
            m = t.topRowKey,
            w = t.bottomRowKey;
          if (r === xt) {
            if (po({
              cellData: s,
              cellSelectionRangeData: t,
              colgroups: n,
              allRowKeys: o
            })) return !1;
            i === mt ? (p = {
              rowKey: m,
              colKey: v
            }, y = {
              rowKey: w,
              colKey: f
            }) : i === wt ? (p = {
              rowKey: m,
              colKey: v
            }, y = {
              rowKey: h,
              colKey: g
            }) : i === gt ? (p = {
              rowKey: h,
              colKey: v
            }, y = {
              rowKey: w,
              colKey: g
            }) : i === Ct && (p = {
              rowKey: m,
              colKey: f
            }, y = {
              rowKey: w,
              colKey: g
            });
          } else if (r === bt) {
            if (d.rowKey === h && d.colKey === f) return !1;
            i === mt ? (p = {
              rowKey: h,
              colKey: v
            }, y = {
              rowKey: h,
              colKey: f
            }) : i === wt ? (p = {
              rowKey: m,
              colKey: v
            }, y = {
              rowKey: h,
              colKey: v
            }) : i === gt ? (p = {
              rowKey: h,
              colKey: v
            }, y = {
              rowKey: w,
              colKey: v
            }) : i === Ct && (p = {
              rowKey: h,
              colKey: f
            }, y = {
              rowKey: h,
              colKey: g
            });
          }
          var C = {
            tableData: this.tableData,
            allRowKeys: this.allRowKeys,
            colgroups: this.colgroups,
            rowKeyFieldName: this.rowKeyFieldName,
            direction: i,
            currentCellSelectionType: r,
            cellSelectionRangeData: t,
            nextCurrentCell: p,
            nextNormalEndCell: y
          };
          if (e) {
            var b = e.beforeAutofill,
              x = e.afterAutofill;
            if (c(b)) {
              var R = b(xo(Ni({
                isReplaceData: !1
              }, C)));
              if (u(R) && !R) return !1;
            }
            var S = xo(Ni({
              isReplaceData: !0
            }, C));
            c(x) && x(S);
          }
          a(p.rowKey) || this.cellSelectionCurrentCellChange({
            rowKey: p.rowKey,
            colKey: p.colKey
          }), a(y.rowKey) || this.cellSelectionNormalEndCellChange({
            rowKey: y.rowKey,
            colKey: y.colKey
          });
        },
        cellSelectionRangeDataChange: function (e) {
          this.cellSelectionRangeData = Object.assign(this.cellSelectionRangeData, e);
        },
        autofillingDirectionChange: function (e) {
          this.autofillingDirection = e;
        },
        setCurrentCellSelectionType: function () {
          var e,
            t = this.cellSelectionData,
            n = t.currentCell,
            o = t.normalEndCell;
          e = a(n.rowKey) || a(n.colKey) ? "" : a(o.rowKey) || a(o.colKey) ? bt : xt, this.currentCellSelectionType = e;
        },
        dealKeydownEvent: function (e) {
          var t = this.colgroups,
            n = this.cellSelectionData,
            o = this.enableStopEditing,
            i = this.isCellEditing,
            r = e.keyCode,
            l = e.ctrlKey,
            s = e.shiftKey,
            c = e.altKey,
            u = n.currentCell,
            d = u.rowKey,
            h = u.colKey,
            f = t.find(function (e) {
              return e.key === h;
            });
          if (!a(d) && !a(h)) switch (r) {
            case D:
              var p;
              p = s ? vt : pt, this.selectCellByDirection({
                direction: p
              }), this.clearCellSelectionNormalEndCell(), this[Vn](), e.preventDefault();
              break;
            case P:
              var y = vt;
              o && (this.selectCellByDirection({
                direction: y
              }), this.clearCellSelectionNormalEndCell(), this[Vn](), e.preventDefault());
              break;
            case j:
              var v = pt;
              o && (this.selectCellByDirection({
                direction: v
              }), this.clearCellSelectionNormalEndCell(), this[Vn](), e.preventDefault());
              break;
            case B:
              var g = ft;
              o && (this.selectCellByDirection({
                direction: g
              }), this.clearCellSelectionNormalEndCell(), this[Vn](), e.preventDefault());
              break;
            case M:
              var m = yt;
              o && (this.selectCellByDirection({
                direction: m
              }), this.clearCellSelectionNormalEndCell(), this[Vn](), e.preventDefault());
              break;
            case _:
              var w;
              if (c) this.$refs[this.editInputRef].textareaAddNewLine();else s ? (w = ft, this[Vn]()) : (l || (w = yt), this[Vn]());
              w && (this.clearCellSelectionNormalEndCell(), this.selectCellByDirection({
                direction: w
              })), e.preventDefault();
              break;
            case A:
              i || (this[Mn]({
                rowKey: d,
                colKey: h,
                defaultValue: " "
              }), e.preventDefault());
              break;
            case T:
              i || (this[Mn]({
                rowKey: d,
                colKey: h,
                defaultValue: ""
              }), e.preventDefault());
              break;
            case V:
              i || (this.deleteCellSelectionRangeValue(), e.preventDefault());
              break;
            case N:
              i || (f.edit && (this.enableStopEditing = !1, this[Mn]({
                rowKey: d,
                colKey: h
              })), e.preventDefault());
              break;
            default:
              (function (e) {
                var t = !1,
                  n = e.keyCode,
                  o = e.altKey,
                  i = e.ctrlKey,
                  r = e.shiftKey,
                  l = e.metaKey;
                return o || i || r || l || (n >= 48 && n <= 57 || n >= 96 && n <= 105 || n >= 65 && n <= 90 || [186, 187, 188, 189, 190, 191, 192, 219, 220, 221, 222].indexOf(n) > -1 || 229 == n) && (t = !0), t;
              })(e) && this[Mn]({
                rowKey: d,
                colKey: h,
                defaultValue: ""
              });
          }
        },
        selectCellByDirection: function (e) {
          var t = e.direction,
            n = this.colgroups,
            o = this.allRowKeys,
            i = this.cellSelectionData.currentCell,
            r = i.rowKey,
            l = i.colKey,
            a = n.findIndex(function (e) {
              return e.key === l;
            }),
            s = o.indexOf(r);
          if (t === vt) {
            if (a > 0) {
              var c = n[a - 1];
              this.cellSelectionData.currentCell.colKey = c.key, this.columnToVisible(c);
            }
          } else if (t === pt) {
            if (a < n.length - 1) {
              var u = n[a + 1];
              this.cellSelectionData.currentCell.colKey = u.key, this.columnToVisible(u);
            }
          } else if (t === ft) {
            if (s > 0) {
              var d = o[s - 1];
              this.rowToVisible(B, d);
            }
          } else if (t === yt && s < o.length - 1) {
            var h = o[s + 1];
            this.rowToVisible(M, h);
          }
        },
        columnToVisible: function (e) {
          var t = this.hasXScrollBar,
            n = this.colgroups;
          if (!t) return !1;
          var o = this.$refs[this.tableContainerRef],
            i = o.scrollWidth,
            r = o.clientWidth,
            l = o.scrollLeft;
          if (!e.fixed) {
            var a = no({
                colgroups: n,
                colKey: e.key,
                fixed: st
              }),
              s = no({
                colgroups: n,
                colKey: e.key,
                fixed: ct
              });
            if (l) {
              var c = l - a;
              c > 0 && (o.scrollLeft = l - c);
            }
            var u = i - r - l;
            if (u) {
              var d = u - s;
              d > 0 && (o.scrollLeft = l + d);
            }
          }
        },
        rowToVisible: function (e, t) {
          var n = this.$refs[this.tableContainerRef],
            o = this.$refs[this.tableContentWrapperRef].$el,
            i = this.isVirtualScroll,
            r = this.headerTotalHeight,
            l = this.footerTotalHeight,
            a = n.clientHeight,
            s = n.scrollTop,
            c = this.$el.querySelector("tbody tr[".concat(_n, '="').concat(t, '"]'));
          if (c) {
            var u = c.offsetTop,
              d = c.clientHeight,
              h = o.offsetTop;
            if (e === B) {
              var f = 0;
              (f = i ? r - (u - (s - h)) : s + r - u) > 0 && (n.scrollTop = s - f);
            } else if (e === M) {
              var p = 0;
              (p = i ? u - (s - h) + d + l - a : u + d + l - (a + s)) >= 0 && (n.scrollTop = s + p);
            }
            var y = this.cellSelectionData.currentCell;
            this.cellSelectionCurrentCellChange({
              rowKey: t,
              colKey: y.colKey
            });
          }
        },
        setVirtualScrollVisibleData: function () {
          var e = this.tableData,
            t = this.virtualScrollStartIndex,
            n = this.virtualScrollEndIndex,
            o = t - this.getVirtualScrollAboveCount(),
            i = n + this.getVirtualScrollBelowCount();
          this.virtualScrollVisibleIndexs.start = o, this.virtualScrollVisibleIndexs.end = i - 1, this.virtualScrollVisibleData = e.slice(o, i);
        },
        getVirtualScrollAboveCount: function () {
          var e = 0,
            t = this.isVirtualScroll,
            n = this.virtualScrollBufferCount,
            o = this.virtualScrollStartIndex;
          return t && (e = Math.min(o, n)), e;
        },
        getVirtualScrollBelowCount: function () {
          var e = 0,
            t = this.isVirtualScroll,
            n = this.tableData,
            o = this.virtualScrollBufferCount,
            i = this.virtualScrollEndIndex;
          return t && (e = Math.min(n.length - i, o)), e;
        },
        getVirtualViewPhantom: function () {
          var e = this,
            t = this.$createElement,
            n = null,
            o = this.isVirtualScroll,
            i = this.hasLeftFixedColumn,
            r = this.expandOption;
          if (o || i && r) {
            var l = {
              props: {
                tagName: "div"
              },
              style: {
                width: "100%"
              },
              on: {
                "on-dom-resize-change": function (t) {
                  var n = t.width;
                  e.tableViewportWidth = n;
                }
              }
            };
            n = t("div", {
              ref: this.virtualPhantomRef,
              class: [Yn("virtual-phantom"), o ? Yn("virtual-scroll") : ""]
            }, [t(Qo, l)]);
          }
          return n;
        },
        initVirtualScrollPositions: function () {
          if (this.isVirtualScroll) {
            var e = this.virtualScrollOption,
              t = this.rowKeyFieldName,
              n = this.tableData,
              o = this.defaultVirtualScrollMinRowHeight,
              i = d(e.minRowHeight) ? e.minRowHeight : o;
            this.virtualScrollPositions = n.map(function (e, n) {
              return {
                rowKey: e[t],
                height: i,
                top: n * i,
                bottom: (n + 1) * i
              };
            });
          }
        },
        bodyRowHeightChange: function (e) {
          var t = e.rowKey,
            n = e.height,
            o = this.virtualScrollPositions.findIndex(function (e) {
              return e.rowKey === t;
            }),
            i = this.virtualScrollPositions[o].height - n;
          if (i) {
            this.virtualScrollPositions[o].bottom = this.virtualScrollPositions[o].bottom - i, this.virtualScrollPositions[o].height = n;
            for (var r = o + 1; r < this.virtualScrollPositions.length; r++) this.virtualScrollPositions[r].top = this.virtualScrollPositions[r - 1].bottom, this.virtualScrollPositions[r].bottom = this.virtualScrollPositions[r].bottom - i;
            this.setVirtualPhantomHeight(), this.setVirtualScrollStartOffset();
          }
        },
        setVirtualPhantomHeight: function () {
          var e = 0;
          this.virtualScrollPositions.length && (e = this.virtualScrollPositions[this.virtualScrollPositions.length - 1].bottom), this.$refs[this.virtualPhantomRef].style.height = e + "px";
        },
        setVirtualScrollStartOffset: function () {
          var e = this.virtualScrollStartIndex,
            t = this.getVirtualScrollAboveCount(),
            n = 0;
          if (e >= 1) {
            var o = this.virtualScrollPositions[e].top - (this.virtualScrollPositions[e - t] ? this.virtualScrollPositions[e - t].top : 0);
            n = this.virtualScrollPositions[e - 1].bottom - o;
          }
          this.setTableContentTopValue({
            top: n
          });
        },
        setTableContentTopValue: function (e) {
          var t = this,
            n = e.top;
          window.requestAnimationFrame(function () {
            var e = t.$refs[t.tableContentWrapperRef];
            e && (e.$el.style.top = "".concat(n, "px"));
          });
        },
        getVirtualScrollStartIndex: function () {
          var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
          return this.virtualScrollBinarySearch(this.virtualScrollPositions, e);
        },
        virtualScrollBinarySearch: function (e, t) {
          for (var n = 0, o = e.length - 1, i = null; n <= o;) {
            var r = parseInt((n + o) / 2),
              l = e[r].bottom;
            if (l === t) return r + 1;
            l < t ? n = r + 1 : l > t && ((null === i || i > r) && (i = r), o -= 1);
          }
          return i;
        },
        tableContainerVirtualScrollHandler: function (e) {
          var t = this.virtualScrollVisibleCount,
            n = this.virtualScrollOption,
            o = e.scrollTop,
            i = this.getVirtualScrollStartIndex(o);
          this.virtualScrollStartIndex = i;
          var r = i + t;
          this.virtualScrollEndIndex = r;
          var l = this.getVirtualScrollAboveCount(),
            a = this.getVirtualScrollBelowCount();
          if (this.setVirtualScrollStartOffset(), !this.showVirtualScrollingPlaceholder) {
            var s = this.$refs[this.tableBodyRef];
            s && s.renderingRowKeys(this.allRowKeys.slice(i - l, r + a));
          }
          var u = n.scrolling;
          if (c(u)) {
            var d = this.getVirtualScrollAboveCount(),
              h = i - d;
            u({
              startRowIndex: h > 0 ? h : 0,
              visibleStartIndex: i,
              visibleEndIndex: r,
              visibleAboveCount: d,
              visibleBelowCount: this.getVirtualScrollBelowCount()
            });
          }
          this.setVirtualScrollVisibleData();
        },
        debounceScrollEnded: function () {
          var e = this.disablePointerEventsTimeoutId;
          e && Po(e.id), this.disablePointerEventsTimeoutId = function (e, t) {
            var n;
            Promise.resolve().then(function () {
              n = Date.now();
            });
            var o = {
              id: Ao(function i() {
                Date.now() - n >= t ? e.call() : o.id = Ao(i);
              })
            };
            return o;
          }(this.debounceScrollEndedCallback, 150);
        },
        debounceScrollEndedCallback: function () {
          this.disablePointerEventsTimeoutId = null, this.showVirtualScrollingPlaceholder = !1;
        },
        initVirtualScroll: function () {
          var e = this;
          if (this.isVirtualScroll) {
            this.virtualScrollStartIndex = 0, this.virtualScrollEndIndex = 0 + this.virtualScrollVisibleCount, this.$nextTick(function () {
              var t = e.$refs[e.tableContainerRef];
              e.tableContainerVirtualScrollHandler(t), e.setVirtualPhantomHeight();
            });
          }
        },
        setScrolling: function (e) {
          if (this.hasFixedColumn) {
            var t = e.scrollWidth,
              n = e.clientWidth,
              o = e.scrollLeft,
              i = this.previewTableContainerScrollLeft;
            0 !== i && i === o || (this.previewTableContainerScrollLeft = o, this.isLeftScrolling = o > 0, this.isRightScrolling = t - n > o), this.isLeftScrolling = o > 0, this.isRightScrolling = t - n > o;
          }
          if (this.fixedHeader) {
            var r = e.scrollTop;
            this.isVerticalScrolling = r > 0;
          }
        },
        setScrollBarStatus: function () {
          var e = this.$refs[this.tableContainerRef];
          if (e) {
            var t = e.scrollWidth,
              n = e.clientWidth,
              o = e.scrollHeight,
              i = e.clientHeight;
            t && n && (this.hasXScrollBar = !!(t - n)), o && i && (this.hasYScrollBar = !!(o - i));
          }
        },
        initScrolling: function () {
          this.setScrolling(this.$refs[this.tableContainerRef]);
        },
        tableClickOutside: function (e) {
          if (t = e, n = !1, o = document.querySelectorAll(".ve-contextmenu-popper"), [].forEach.call(o, function (e) {
            e.contains(t.target) && (n = !0);
          }), n) return !1;
          var t, n, o;
          this.isHeaderCellMousedown = !1, this.isBodyCellMousedown = !1, this.isBodyOperationColumnMousedown = !1, this.isAutofillStarting = !1, this.setIsColumnResizing(!1), this.clearCellSelectionCurrentCell(), this.clearCellSelectionNormalEndCell(), this.clearHeaderIndicatorColKeys(), this.clearBodyIndicatorRowKeys(), this[Vn]();
        },
        saveCellWhenStopEditing: function () {
          var e = this.colgroups,
            t = this.rowKeyFieldName,
            n = this.editOption,
            o = this.editingCell,
            i = this.isCellEditing,
            r = n.cellValueChange,
            l = n.beforeCellValueChange,
            a = n.afterCellValueChange;
          if (i) {
            var s = o.rowKey,
              d = o.colKey,
              h = this.tableData.find(function (e) {
                return e[t] === s;
              });
            if (h) {
              var f = e.find(function (e) {
                  return e.key === d;
                }),
                p = o.row[f.field];
              if (c(l)) {
                var y = l({
                  row: Object(Y.cloneDeep)(h),
                  column: f,
                  changeValue: p
                });
                if (u(y) && !y) return this.clearEditingCell(), !1;
              }
              h[f.field] = p, r && r({
                row: h,
                column: f,
                changeValue: p
              }), a && a({
                row: h,
                column: f,
                changeValue: p
              }), this.clearEditingCell();
            }
            this.enableStopEditing = !0;
          }
        },
        cellSelectionByClick: function (e) {
          var t = e.rowData,
            n = e.column,
            o = Jn(t, this.rowKeyFieldName);
          this[Fn]({
            rowKey: o,
            colKey: n.key,
            isScrollToRow: !1
          }), this.rowToVisible(B, o), this.rowToVisible(M, o);
        },
        bodyCellContextmenu: function (e) {
          e.event;
          var t = e.rowData,
            n = e.column,
            o = this.editOption,
            i = this.rowKeyFieldName;
          if (o) {
            var r = Jn(t, i);
            this.editCellByClick({
              isDblclick: !1,
              rowKey: r,
              colKey: n.key
            });
          }
          this.setContextmenuOptions(n);
        },
        bodyCellDoubleClick: function (e) {
          e.event;
          var t = e.rowData,
            n = e.column,
            o = this.editOption,
            i = this.rowKeyFieldName,
            r = this.colgroups;
          if (Zn(n.key, r)) return this.clearCellSelectionCurrentCell(), this.clearCellSelectionNormalEndCell(), this[Vn](), !1;
          if (o) {
            var l = Jn(t, i);
            this.editCellByClick({
              isDblclick: !0,
              rowKey: l,
              colKey: n.key
            });
          }
        },
        bodyCellClick: function (e) {
          e.event, e.rowData, e.column;
        },
        bodyCellMousedown: function (e) {
          var t = e.event,
            n = e.rowData,
            o = e.column;
          if (!this.enableCellSelection) return !1;
          var i = t.shiftKey,
            r = this.editOption,
            l = this.rowKeyFieldName,
            s = this.colgroups,
            c = this.cellSelectionData,
            u = this.cellSelectionRangeData,
            d = this.allRowKeys,
            h = Jn(n, l),
            f = o.key,
            p = c.currentCell,
            y = Mo(t);
          if (Zn(f, s)) {
            this.clearHeaderIndicatorColKeys();
            var v = this.bodyIndicatorRowKeys;
            this.isBodyOperationColumnMousedown = !0;
            var g = v.startRowKey,
              m = v.endRowKey,
              w = v.startRowKeyIndex,
              C = v.endRowKeyIndex,
              b = g,
              x = m;
            if (i && (w > -1 || p.rowIndex > -1)) b = a(p.rowKey) ? g : p.rowKey, x = h;else {
              var R = d.indexOf(h);
              (y === L || R < w || R > C) && (b = h, x = h);
            }
            this.bodyIndicatorRowKeysChange({
              startRowKey: b,
              endRowKey: x
            });
          } else {
            this.isBodyCellMousedown = !0, function (e) {
              var t = e.mouseEventClickType,
                n = e.cellData,
                o = e.cellSelectionData,
                i = e.cellSelectionRangeData,
                r = e.colgroups,
                l = e.allRowKeys,
                a = !0;
              return t === W && o.normalEndCell.rowIndex > -1 && (a = !po({
                cellData: n,
                cellSelectionRangeData: i,
                colgroups: r,
                allRowKeys: l
              })), a;
            }({
              mouseEventClickType: y,
              cellData: {
                rowKey: h,
                colKey: f
              },
              cellSelectionData: c,
              cellSelectionRangeData: u,
              colgroups: s,
              allRowKeys: d
            }) && (this.clearHeaderIndicatorColKeys(), this.clearBodyIndicatorRowKeys(), i && p.rowIndex > -1 ? this.cellSelectionNormalEndCellChange({
              rowKey: h,
              colKey: f
            }) : (this.cellSelectionByClick({
              rowData: n,
              column: o
            }), this.clearCellSelectionNormalEndCell()));
          }
          r && this.editCellByClick({
            isDblclick: !1,
            rowKey: h,
            colKey: f
          });
        },
        bodyCellMouseover: function (e) {
          e.event;
          var t = e.rowData,
            n = e.column,
            o = this.rowKeyFieldName,
            i = this.isBodyCellMousedown,
            r = this.isAutofillStarting,
            l = this.isHeaderCellMousedown,
            a = this.isBodyOperationColumnMousedown,
            s = Jn(t, o),
            c = n.key;
          if (i) {
            if (Zn(c, this.colgroups)) return !1;
            this.cellSelectionNormalEndCellChange({
              rowKey: s,
              colKey: c
            });
          }
          if (a && this.bodyIndicatorRowKeysChange({
            startRowKey: this.bodyIndicatorRowKeys.startRowKey,
            endRowKey: s
          }), l && this.headerIndicatorColKeysChange({
            startColKey: this.headerIndicatorColKeys.startColKey,
            endColKey: c
          }), r) {
            if (Zn(c, this.colgroups)) return !1;
            this.cellSelectionAutofillCellChange({
              rowKey: s,
              colKey: c
            });
          }
        },
        bodyCellMousemove: function (e) {
          var t = e.event,
            n = (e.rowData, e.column);
          this.hooks.triggerHook(dn, {
            event: t,
            column: n
          });
        },
        bodyCellMouseup: function (e) {
          e.event, e.rowData, e.column;
        },
        headerCellClick: function (e) {
          e.event, e.column;
        },
        headerCellContextmenu: function (e) {
          e.event;
          var t = e.column;
          this.setContextmenuOptions(t);
        },
        setContextmenuOptions: function (e) {
          var t = this.contextMenuType;
          this.contextmenuOptions = t === qn ? ro({
            column: e,
            contextmenuHeaderOption: this.contextmenuHeaderOption,
            cellSelectionRangeData: this.cellSelectionRangeData,
            colgroups: this.colgroups,
            allRowKeys: this.allRowKeys,
            headerIndicatorColKeys: this.headerIndicatorColKeys,
            enableHeaderContextmenu: this.enableHeaderContextmenu,
            t: Li
          }) : lo({
            enableBodyContextmenu: this.enableBodyContextmenu,
            contextmenuBodyOption: this.contextmenuBodyOption,
            cellSelectionRangeData: this.cellSelectionRangeData,
            colgroups: this.colgroups,
            allRowKeys: this.allRowKeys,
            bodyIndicatorRowKeys: this.bodyIndicatorRowKeys,
            t: Li
          });
        },
        headerCellMousedown: function (e) {
          var t = this,
            n = e.event,
            o = e.column;
          if (!this.enableCellSelection) return !1;
          this.isHeaderCellMousedown = !0;
          var i,
            r = n.shiftKey,
            l = this.isGroupHeader,
            s = this.colgroups,
            c = this.headerIndicatorColKeys,
            u = this.cellSelectionData;
          this.clearBodyIndicatorRowKeys();
          var d = (i = l ? so({
              headerColumnItem: o
            }) : [o.key])[0],
            h = i[i.length - 1],
            f = u.currentCell;
          if (Zn(o.key, s)) return this.clearCellSelectionCurrentCell(), this.clearCellSelectionNormalEndCell(), this.$nextTick(function () {
            t[Wn]();
          }), !1;
          a(c.startColKey) && (JSON.stringify(i) != JSON.stringify([f.colKey]) && this.$refs[this.cellSelectionRef].clearCurrentCellRect(), this.$refs[this.cellSelectionRef].clearNormalEndCellRect());
          var p = c.startColKey,
            y = c.endColKey,
            v = c.startColKeyIndex,
            g = c.endColKeyIndex,
            m = p,
            w = y;
          if (r) {
            if (a(p)) {
              if (a(f.colKey)) m = d, w = h;else {
                var C = bo({
                  colgroups: s,
                  colKeys: i.concat([f.colKey])
                });
                m = f.colKey, w = C === f.colKey ? h : d;
              }
            } else m = p, w = bo({
              colgroups: s,
              colKeys: i.concat([p])
            }) === p ? h : d;
          } else {
            var b = Mo(n),
              x = s.findIndex(function (e) {
                return e.key === h;
              }),
              R = s.findIndex(function (e) {
                return e.key === d;
              });
            (b === L || x < v || R < v || x > g || R > g) && (m = d, w = h);
          }
          this.headerIndicatorColKeysChange({
            startColKey: m,
            endColKey: w
          });
        },
        headerCellMouseover: function (e) {
          e.event;
          var t,
            n,
            o = e.column,
            i = this.colgroups,
            r = this.isGroupHeader,
            l = this.isHeaderCellMousedown,
            a = this.headerIndicatorColKeys;
          l && !Zn(o.key, i) && (n = bo({
            colgroups: i,
            colKeys: (t = r ? so({
              headerColumnItem: o
            }) : [o.key]).concat([a.startColKey])
          }) === a.startColKey ? t[t.length - 1] : t[0], this.headerIndicatorColKeysChange({
            startColKey: this.headerIndicatorColKeys.startColKey,
            endColKey: n
          }));
        },
        headerCellMousemove: function (e) {
          var t = e.event,
            n = e.column;
          this.hooks.triggerHook(un, {
            event: t,
            column: n
          });
        },
        headerCellMouseleave: function (e) {
          e.event, e.column;
        },
        headerMouseleave: function (e) {
          this.setIsColumnResizerHover(!1);
        },
        tableContainerMouseup: function () {
          this.isHeaderCellMousedown = !1, this.isBodyCellMousedown = !1, this.isBodyOperationColumnMousedown = !1, this.isAutofillStarting = !1;
        },
        cellSelectionCornerMousedown: function (e) {
          e.event;
          this.isAutofillStarting = !0;
        },
        cellSelectionCornerMouseup: function (e) {
          e.event;
          this.isAutofillStarting = !1;
        },
        isEditColumn: function (e) {
          return this.colgroups.some(function (t) {
            return t.key === e && t.edit;
          });
        },
        editCellByClick: function (e) {
          var t = e.isDblclick,
            n = e.rowKey,
            o = e.colKey,
            i = this.editOption,
            r = this.isCellEditing,
            l = this.hasEditColumn,
            s = this.editingCell,
            c = this.isEditColumn;
          return !!i && !!l && !a(n) && !a(o) && (!s || s.rowKey != n || s.colKey != o) && (r && this[Vn](), void (t && c(o) ? (this.enableStopEditing = !1, this[Mn]({
            rowKey: n,
            colKey: o
          })) : this.enableStopEditing = !0));
        },
        setEditingCell: function (e) {
          var t = e.rowKey,
            n = e.colKey,
            o = e.column,
            i = e.row;
          this.editingCell = {
            rowKey: t,
            row: Object(Y.cloneDeep)(i),
            colKey: n,
            column: o
          };
        },
        updateEditingCellValue: function (e) {
          var t = this.editingCell,
            n = t.row;
          n[t.column.field] = e, this.editingCell.row = n;
        },
        clearEditingCell: function () {
          this.editingCell = {
            rowKey: "",
            colKey: "",
            row: null,
            column: null
          };
        },
        contextmenuItemClick: function (e) {
          this.contextMenuType === qn ? this.headerContextmenuItemClick(e) : this.bodyContextmenuItemClick(e);
        },
        headerContextmenuItemClick: function (e) {
          var t = this.contextmenuHeaderOption,
            n = this.cellSelectionData,
            o = this.cellSelectionRangeData,
            i = this.allRowKeys,
            r = this.colgroups,
            l = this.enableColumnResize,
            s = n.currentCell,
            d = s.rowKey,
            h = s.colKey,
            f = t.afterMenuClick;
          if (!a(d) && !a(h)) {
            var p = yo({
                cellSelectionRangeData: o
              }),
              y = vo({
                cellSelectionRangeData: o,
                colgroups: r,
                allRowKeys: i
              });
            if (c(f)) {
              var v = f({
                type: e,
                selectionRangeKeys: p,
                selectionRangeIndexes: y
              });
              if (u(v) && !v) return !1;
            }
            var g = this.$refs[this.editInputRef];
            Un.CUT === e ? (g.textareaSelect(), document.execCommand("cut")) : Un.COPY === e ? (g.textareaSelect(), document.execCommand("copy")) : Un.EMPTY_COLUMN === e ? this.deleteCellSelectionRangeValue() : Un.LEFT_FIXED_COLUMN_TO === e ? this.cloneColumns = Ro({
              cloneColumns: this.cloneColumns,
              cellSelectionRangeData: o,
              fixedType: st,
              colgroups: r,
              enableColumnResize: l
            }) : Un.CANCEL_LEFT_FIXED_COLUMN_TO === e ? this.cloneColumns = So({
              cloneColumns: this.cloneColumns,
              colgroups: r,
              fixedType: st,
              enableColumnResize: l
            }) : Un.RIGHT_FIXED_COLUMN_TO === e ? this.cloneColumns = Ro({
              cloneColumns: this.cloneColumns,
              cellSelectionRangeData: o,
              fixedType: ct,
              colgroups: r,
              enableColumnResize: l
            }) : Un.CANCEL_RIGHT_FIXED_COLUMN_TO === e && (this.cloneColumns = So({
              cloneColumns: this.cloneColumns,
              colgroups: r,
              fixedType: ct,
              enableColumnResize: l
            }));
          }
        },
        bodyContextmenuItemClick: function (e) {
          var t = this.contextmenuBodyOption,
            n = this.cellSelectionData,
            o = this.cellSelectionRangeData,
            i = this.tableData,
            r = this.allRowKeys,
            l = this.colgroups,
            s = this.rowKeyFieldName,
            d = n.currentCell,
            h = d.rowKey,
            f = d.colKey,
            p = t.afterMenuClick;
          if (!a(h) && !a(f)) {
            var y = yo({
                cellSelectionRangeData: o
              }),
              v = vo({
                cellSelectionRangeData: o,
                colgroups: l,
                allRowKeys: r
              });
            if (c(p)) {
              var g = p({
                type: e,
                selectionRangeKeys: y,
                selectionRangeIndexes: v
              });
              if (u(g) && !g) return !1;
            }
            var m = v.startRowIndex,
              w = v.endRowIndex,
              C = r.findIndex(function (e) {
                return e === h;
              }),
              b = this.$refs[this.editInputRef];
            Un.CUT === e ? (b.textareaSelect(), document.execCommand("cut")) : Un.COPY === e ? (b.textareaSelect(), document.execCommand("copy")) : Un.REMOVE_ROW === e ? i.splice(m, w - m + 1) : Un.EMPTY_ROW === e || Un.EMPTY_CELL === e ? this.deleteCellSelectionRangeValue() : Un.INSERT_ROW_ABOVE === e ? i.splice(C, 0, ao({
              colgroups: l,
              rowKeyFieldName: s
            })) : Un.INSERT_ROW_BELOW === e && i.splice(C + 1, 0, ao({
              colgroups: l,
              rowKeyFieldName: s
            }));
          }
        },
        editorCopy: function (e) {
          var t = this.isCellEditing,
            n = this.enableClipboard,
            o = this.clipboardOption,
            i = this.cellSelectionRangeData,
            r = this.tableData,
            l = this.colgroups,
            a = this.allRowKeys;
          if (!n) return !1;
          if (t) return !1;
          var s = o || {},
            d = s.copy,
            h = s.beforeCopy,
            f = s.afterCopy;
          if (u(d) && !d) return !1;
          e.preventDefault();
          var p = go({
              cellSelectionRangeData: i,
              resultType: "flat",
              tableData: r,
              colgroups: l,
              allRowKeys: a
            }),
            y = function (e) {
              var t = e.cellSelectionRangeData,
                n = e.selectionRangeData,
                o = e.colgroups,
                i = e.allRowKeys,
                r = t.leftColKey,
                l = t.rightColKey,
                a = t.topRowKey,
                s = t.bottomRowKey;
              return {
                selectionRangeIndexes: {
                  startColIndex: o.findIndex(function (e) {
                    return e.key === r;
                  }),
                  endColIndex: o.findIndex(function (e) {
                    return e.key === l;
                  }),
                  startRowIndex: i.indexOf(a),
                  endRowIndex: i.indexOf(s)
                },
                selectionRangeKeys: {
                  startColKey: r,
                  endColKey: l,
                  startRowKey: a,
                  endRowKey: s
                },
                data: n
              };
            }({
              cellSelectionRangeData: i,
              selectionRangeData: p,
              colgroups: l,
              allRowKeys: a
            });
          if (c(h)) {
            var v = h(y);
            if (u(v) && !v) return !1;
          }
          !function (e) {
            var t = e.event,
              n = Eo(e.selectionRangeData);
            t.clipboardData ? t.clipboardData.setData("text/plain", n) : window.clipboardData && window.clipboardData.setData("Text", n);
          }({
            event: e,
            selectionRangeData: p
          }), c(f) && f(y);
        },
        editorPaste: function (e) {
          var t = this.isCellEditing,
            n = this.enableClipboard,
            o = this.clipboardOption;
          if (!n) return !1;
          if (t) return !1;
          var i = o || {},
            r = i.paste,
            l = i.beforePaste,
            a = i.afterPaste;
          if (u(r) && !r) return !1;
          e.preventDefault();
          var s,
            d,
            h,
            f,
            p,
            y = ko({
              event: e,
              cellSelectionRangeData: this.cellSelectionRangeData,
              colgroups: this.colgroups,
              allRowKeys: this.allRowKeys,
              rowKeyFieldName: this.rowKeyFieldName
            });
          if (y && Array.isArray(y.data) && y.data.length) {
            if (c(l)) {
              var v = l(y);
              if (u(v) && !v) return !1;
            }
            s = {
              tableData: this.tableData,
              beforePasteResponse: y
            }, d = s.tableData, h = s.beforePasteResponse, f = h.data, p = h.selectionRangeIndexes, f.forEach(function (e, t) {
              Object.assign(d[p.startRowIndex + t], e);
            }), c(a) && a(y);
            var g = y.selectionRangeKeys,
              m = g.startColKey,
              w = g.endColKey,
              C = g.startRowKey,
              b = g.endRowKey;
            this.cellSelectionCurrentCellChange({
              rowKey: C,
              colKey: m
            }), this.cellSelectionNormalEndCellChange({
              rowKey: b,
              colKey: w
            }), this.hooks.triggerHook(cn);
          }
        },
        editorCut: function (e) {
          var t = this.isCellEditing,
            n = this.enableClipboard,
            o = this.clipboardOption,
            i = this.cellSelectionRangeData,
            r = this.tableData,
            l = this.colgroups,
            a = this.allRowKeys;
          if (!n) return !1;
          if (t) return !1;
          var s = o || {},
            d = s.cut,
            h = s.beforeCut,
            f = s.afterCut;
          if (u(d) && !d) return !1;
          e.preventDefault();
          var p = go({
              cellSelectionRangeData: i,
              resultType: "flat",
              tableData: r,
              colgroups: l,
              allRowKeys: a
            }),
            y = function (e) {
              var t = e.cellSelectionRangeData,
                n = e.selectionRangeData,
                o = e.colgroups,
                i = e.allRowKeys,
                r = t.leftColKey,
                l = t.rightColKey,
                a = t.topRowKey,
                s = t.bottomRowKey;
              return {
                selectionRangeIndexes: {
                  startColIndex: o.findIndex(function (e) {
                    return e.key === r;
                  }),
                  endColIndex: o.findIndex(function (e) {
                    return e.key === l;
                  }),
                  startRowIndex: i.indexOf(a),
                  endRowIndex: i.indexOf(s)
                },
                selectionRangeKeys: {
                  startColKey: r,
                  endColKey: l,
                  startRowKey: a,
                  endRowKey: s
                },
                data: n
              };
            }({
              cellSelectionRangeData: i,
              selectionRangeData: p,
              colgroups: l,
              allRowKeys: a
            });
          if (c(h)) {
            var v = h(y);
            if (u(v) && !v) return !1;
          }
          !function (e) {
            var t = e.event,
              n = e.tableData,
              o = e.colgroups,
              i = e.selectionRangeData,
              r = e.selectionRangeIndexes,
              l = Eo(i),
              a = r.endColIndex,
              s = r.endRowIndex,
              c = r.startColIndex,
              u = r.startRowIndex,
              d = o.slice(c, a + 1).map(function (e) {
                return e.field;
              });
            n.forEach(function (e, t) {
              t >= u && t <= s && d.forEach(function (t) {
                e[t] = "";
              });
            }), t.clipboardData ? t.clipboardData.setData("text/plain", l) : window.clipboardData && window.clipboardData.setData("Text", l);
          }({
            event: e,
            tableData: r,
            colgroups: l,
            selectionRangeData: p,
            selectionRangeIndexes: y.selectionRangeIndexes
          }), c(f) && f(y);
        },
        deleteCellSelectionRangeValue: function () {
          var e = this.isCellEditing,
            t = this.enableClipboard,
            n = this.clipboardOption,
            o = this.cellSelectionRangeData,
            i = this.tableData,
            r = this.colgroups,
            l = this.allRowKeys;
          if (!t) return !1;
          if (e) return !1;
          var a = n || {},
            s = a.delete,
            d = a.beforeDelete,
            h = a.afterDelete;
          if (u(s) && !s) return !1;
          var f = function (e) {
            var t = e.cellSelectionRangeData,
              n = e.selectionRangeData,
              o = e.colgroups,
              i = e.allRowKeys,
              r = t.leftColKey,
              l = t.rightColKey,
              a = t.topRowKey,
              s = t.bottomRowKey;
            return {
              selectionRangeIndexes: {
                startColIndex: o.findIndex(function (e) {
                  return e.key === r;
                }),
                endColIndex: o.findIndex(function (e) {
                  return e.key === l;
                }),
                startRowIndex: i.indexOf(a),
                endRowIndex: i.indexOf(s)
              },
              selectionRangeKeys: {
                startColKey: r,
                endColKey: l,
                startRowKey: a,
                endRowKey: s
              },
              data: n
            };
          }({
            cellSelectionRangeData: o,
            selectionRangeData: go({
              cellSelectionRangeData: o,
              resultType: "flat",
              tableData: i,
              colgroups: r,
              allRowKeys: l
            }),
            colgroups: r,
            allRowKeys: l
          });
          if (c(d)) {
            var p = d(f);
            if (u(p) && !p) return !1;
          }
          !function (e) {
            var t = e.tableData,
              n = e.colgroups,
              o = e.selectionRangeIndexes,
              i = o.endColIndex,
              r = o.endRowIndex,
              l = o.startColIndex,
              a = o.startRowIndex,
              s = n.slice(l, i + 1).map(function (e) {
                return e.field;
              });
            t.forEach(function (e, t) {
              t >= a && t <= r && s.forEach(function (t) {
                e[t] = "";
              });
            });
          }({
            tableData: i,
            colgroups: r,
            selectionRangeIndexes: f.selectionRangeIndexes
          }), c(h) && h(f);
        },
        setRangeCellSelectionByHeaderIndicator: function () {
          var e = this.headerIndicatorColKeys,
            t = this.allRowKeys,
            n = e.startColKey,
            o = e.endColKey;
          if (a(n) || a(o)) return !1;
          this.cellSelectionCurrentCellChange({
            rowKey: t[0],
            colKey: n
          }), this.cellSelectionNormalEndCellChange({
            rowKey: t[t.length - 1],
            colKey: o
          });
        },
        setRangeCellSelectionByBodyIndicator: function () {
          var e = this.bodyIndicatorRowKeys,
            t = this.colgroups,
            n = e.startRowKey,
            o = e.endRowKey;
          if (a(n) || a(o)) return !1;
          t.length > 1 && (this.cellSelectionCurrentCellChange({
            rowKey: n,
            colKey: t[1].key
          }), this.cellSelectionNormalEndCellChange({
            rowKey: o,
            colKey: t[t.length - 1].key
          }));
        },
        setIsColumnResizerHover: function (e) {
          this.isColumnResizerHover = e;
        },
        setIsColumnResizing: function (e) {
          this.isColumnResizing = e;
        }
      }, Fi(ji, Fn, function (e) {
        var t = e.rowKey,
          n = e.colKey,
          o = e.isScrollToRow,
          i = void 0 === o || o;
        if (!this.enableCellSelection) return !1;
        if (!a(t) && !a(n)) {
          this.cellSelectionCurrentCellChange({
            rowKey: t,
            colKey: n
          });
          var r = Qn(n, this.colgroups);
          this.columnToVisible(r), i && this[Bn]({
            rowKey: t
          });
        }
      }), Fi(ji, Ln, function (e) {
        var t = e.startRowKey,
          n = e.startColKey,
          o = e.endRowKey,
          i = e.endColKey,
          r = e.isScrollToStartCell,
          l = void 0 !== r && r;
        if (!this.enableCellSelection) return !1;
        if (a(t) || a(n) || a(o) || a(i)) return !1;
        if (this.cellSelectionCurrentCellChange({
          rowKey: t,
          colKey: n
        }), this.cellSelectionNormalEndCellChange({
          rowKey: o,
          colKey: i
        }), l) {
          var s = Qn(n, this.colgroups);
          this.columnToVisible(s), this[Bn]({
            rowKey: t
          });
        }
      }), Fi(ji, Hn, function () {
        var e = this.cellSelectionData,
          t = this.cellSelectionRangeData,
          n = this.allRowKeys,
          o = this.colgroups,
          i = e.currentCell,
          r = i.rowKey,
          l = i.colKey;
        if (!a(r) && !a(l)) return {
          selectionRangeKeys: yo({
            cellSelectionRangeData: t
          }),
          selectionRangeIndexes: vo({
            cellSelectionRangeData: t,
            colgroups: o,
            allRowKeys: n
          })
        };
      }), Fi(ji, Wn, function () {
        if (!this.enableCellSelection) return !1;
        var e = this.colgroups,
          t = this.allRowKeys;
        if (e.length) {
          var n = e.filter(function (e) {
            return !e.operationColumn;
          }).map(function (e) {
            return e.key;
          });
          n.length && this.headerIndicatorColKeysChange({
            startColKey: n[0],
            endColKey: n[n.length - 1]
          });
        }
        t.length && this.bodyIndicatorRowKeysChange({
          startRowKey: t[0],
          endRowKey: t[t.length - 1]
        });
      }), Fi(ji, zn, function (e) {
        l(e) || (this.hiddenColumns = Array.from(new Set(this.hiddenColumns.concat(e))), this.showOrHideColumns());
      }), Fi(ji, $n, function (e) {
        if (!l(e)) {
          for (var t = e.length - 1; t >= 0; t--) {
            var n = this.hiddenColumns.indexOf(e[t]);
            n > -1 && this.hiddenColumns.splice(n, 1);
          }
          this.showOrHideColumns();
        }
      }), Fi(ji, Pn, function (e) {
        f(this.$refs[this.tableContainerRef], e);
      }), Fi(ji, Bn, function (e) {
        var t = e.rowKey;
        if (a(t)) return console.warn("Row key can't be empty!"), !1;
        var n = 0,
          o = this.isVirtualScroll,
          i = this.headerTotalHeight,
          r = this.$refs[this.tableContainerRef];
        if (o) {
          var l = this.virtualScrollPositions.find(function (e) {
            return e.rowKey === t;
          });
          l && (n = l.top), setTimeout(function () {
            f(r, {
              top: n,
              behavior: "auto"
            });
          }, 200);
        } else {
          var s = this.$el.querySelector("tbody tr[".concat(_n, '="').concat(t, '"]'));
          n = s.offsetTop - i;
        }
        f(r, {
          top: n,
          behavior: o ? "auto" : "smooth"
        });
      }), Fi(ji, jn, function (e) {
        var t = Qn(e.colKey, this.colgroups);
        t && this.columnToVisible(t);
      }), Fi(ji, Mn, function (e) {
        var t = e.rowKey,
          n = e.colKey,
          o = e.defaultValue,
          i = this.editOption,
          r = this.colgroups,
          l = this.rowKeyFieldName,
          a = this.editingCell,
          d = this.cellSelectionData;
        if (!i) return !1;
        var h = this.tableData.find(function (e) {
          return e[l] === t;
        });
        if (h = Object(Y.cloneDeep)(h), a.rowKey === t && a.colKey === n) return !1;
        var f = r.find(function (e) {
          return e.key === n;
        });
        if (!f.edit) return !1;
        var p = i.beforeStartCellEditing;
        if (c(p)) {
          var y = p({
            row: Object(Y.cloneDeep)(h),
            column: f,
            cellValue: s(o) ? o : h[f.field]
          });
          if (u(y) && !y) return !1;
        }
        s(o) ? (this.editorInputStartValue = o, h[f.field] = o) : this.editorInputStartValue = h[f.field], d.currentCell.colKey === n && d.currentCell.rowKey === t || this.cellSelectionCurrentCellChange({
          rowKey: t,
          colKey: n
        }), this.setEditingCell({
          rowKey: t,
          colKey: n,
          column: f,
          row: Object(Y.cloneDeep)(h)
        });
      }), Fi(ji, Vn, function () {
        var e = this.editOption,
          t = this.isCellEditing;
        if (!e) return !1;
        this.editorInputStartValue = "", t && this.saveCellWhenStopEditing();
      }), Fi(ji, Nn, function (e) {
        var t = e.rowKey;
        this.highlightRowKey = t;
      }), ji),
      created: function () {
        this.debouncedBodyCellWidthChange = Object(Y.debounce)(this.bodyCellWidthChange, 0);
      },
      mounted: function () {
        var e = this;
        this.parentRendered = !0, this.contextmenuEventTarget = this.$el.querySelector(".".concat(Yn("content"))), this.hooks = new jo(), this.$on(Ft, function (t) {
          e.updateColgroupsBySortChange(t);
        }), this.$on(Mt, function (t) {
          e.selectedAllChange(t);
        }), this.$on(Vt, function (t) {
          e.setSelectedAllInfo(t);
        }), this.$on(St, function (t) {
          var n = t.rowIndex,
            o = t.height;
          e.headerRowHeightChange({
            rowIndex: n,
            height: o
          });
        }), this.$on(Kt, function (t) {
          var n = t.rowKey,
            o = t.height;
          e.bodyRowHeightChange({
            rowKey: n,
            height: o
          });
        }), this.$on(Ot, function (t) {
          var n = t.rowIndex,
            o = t.height;
          e.footRowHeightChange({
            rowIndex: n,
            height: o
          });
        }), this.$on(Et, function (t) {
          e.bodyCellClick(t);
        }), this.$on(kt, function (t) {
          e.bodyCellMouseover(t);
        }), this.$on(Tt, function (t) {
          e.bodyCellMousedown(t);
        }), this.$on(Dt, function (t) {
          e.bodyCellMousemove(t);
        }), this.$on(_t, function (t) {
          e.bodyCellMouseup(t);
        }), this.$on(nn, function (t) {
          e.cellSelectionCornerMousedown(t);
        }), this.$on(on, function (t) {
          e.cellSelectionCornerMouseup(t);
        }), this.$on(rn, function (t) {
          e.autofillingDirectionChange(t);
        }), this.$on(Pt, function (t) {
          e.bodyCellContextmenu(t);
        }), this.$on(At, function (t) {
          e.bodyCellDoubleClick(t);
        }), this.$on(zt, function (t) {
          e.headerCellClick(t);
        }), this.$on($t, function (t) {
          e.headerCellContextmenu(t);
        }), this.$on(qt, function (t) {
          e.headerCellMousedown(t);
        }), this.$on(Gt, function (t) {
          e.headerCellMouseover(t);
        }), this.$on(Ut, function (t) {
          e.headerCellMousemove(t);
        }), this.$on(Xt, function (t) {
          e.headerCellMouseleave(t);
        }), document.addEventListener("keydown", this.dealKeydownEvent), this.initScrolling();
      },
      destroyed: function () {
        document.removeEventListener("keydown", this.dealKeydownEvent);
      },
      render: function () {
        var e,
          t,
          n = this,
          o = arguments[0],
          i = this.showHeader,
          r = this.tableViewportWidth,
          l = this.tableContainerStyle,
          a = this.tableStyle,
          s = this.tableClass,
          c = this.colgroups,
          u = this.groupColumns,
          d = this.fixedHeader,
          h = this.fixedFooter,
          f = this.actualRenderTableData,
          p = this.debouncedBodyCellWidthChange,
          y = this.expandOption,
          v = this.checkboxOption,
          g = this.radioOption,
          m = this.rowKeyFieldName,
          w = this.virtualScrollOption,
          C = this.isVirtualScroll,
          b = this.sortOption,
          x = this.cellStyleOption,
          R = this.showVirtualScrollingPlaceholder,
          S = this.cellSelectionData,
          O = this.editOption,
          K = this.contextmenuOptions,
          I = this.allRowKeys,
          E = this.enableCellSelection,
          k = this.enableColumnResize,
          T = this.cellSelectionRangeData,
          D = this.headerIndicatorColKeys,
          _ = this.bodyIndicatorRowKeys,
          A = {
            class: Yn("header"),
            style: {
              cursor: this.isColumnResizerHover || this.isColumnResizing ? "col-resize" : ""
            },
            props: {
              columnsOptionResetTime: this.columnsOptionResetTime,
              tableViewportWidth: r,
              groupColumns: u,
              colgroups: c,
              isGroupHeader: this.isGroupHeader,
              fixedHeader: d,
              checkboxOption: v,
              sortOption: b,
              cellStyleOption: x,
              eventCustomOption: this.eventCustomOption,
              headerRows: this.headerRows,
              cellSelectionData: S,
              cellSelectionRangeData: T,
              headerIndicatorColKeys: D
            },
            nativeOn: {
              click: function () {
                n[Vn]();
              },
              mouseleave: function (e) {
                n.headerMouseleave(e);
              }
            }
          },
          P = {
            ref: this.tableBodyRef,
            class: [Yn("body"), this.tableBodyClass],
            props: {
              tableViewportWidth: r,
              columnsOptionResetTime: this.columnsOptionResetTime,
              colgroups: c,
              expandOption: y,
              checkboxOption: v,
              actualRenderTableData: f,
              rowKeyFieldName: m,
              radioOption: g,
              virtualScrollOption: w,
              isVirtualScroll: C,
              cellStyleOption: x,
              cellSpanOption: this.cellSpanOption,
              eventCustomOption: this.eventCustomOption,
              cellSelectionOption: this.cellSelectionOption,
              hasFixedColumn: this.hasFixedColumn,
              cellSelectionData: S,
              cellSelectionRangeData: T,
              allRowKeys: I,
              editOption: O,
              highlightRowKey: this.highlightRowKey,
              showVirtualScrollingPlaceholder: R,
              bodyIndicatorRowKeys: _
            },
            on: (e = {}, Fi(e, Rt, p), Fi(e, Yt, this[Nn]), e)
          },
          B = {
            class: [Yn("footer")],
            props: {
              colgroups: c,
              footerData: this.footerData,
              rowKeyFieldName: m,
              cellStyleOption: x,
              fixedFooter: h,
              cellSpanOption: this.cellSpanOption,
              eventCustomOption: this.eventCustomOption,
              hasFixedColumn: this.hasFixedColumn,
              allRowKeys: I,
              footerRows: this.footerRows
            },
            nativeOn: {
              click: function () {
                n[Vn]();
              }
            }
          },
          j = {
            ref: this.tableRootRef,
            class: {
              "vue-table-root": !0
            }
          },
          M = {
            ref: this.tableContainerWrapperRef,
            style: this.tableContainerWrapperStyle,
            class: Fi({
              "ve-table": !0
            }, Yn("border-around"), this.borderAround),
            props: {
              tagName: "div"
            },
            on: {
              "on-dom-resize-change": function (e) {
                var t = e.height;
                n.tableOffestHeight = t, n.initVirtualScroll(), n.initScrolling(), n.setScrollBarStatus(), n.hooks.triggerHook(an);
              }
            },
            directives: [{
              name: "click-outside",
              value: function (e) {
                n.tableClickOutside(e);
              }
            }]
          },
          V = {
            ref: this.tableContainerRef,
            class: this.tableContainerClass,
            style: l,
            on: {
              scroll: function () {
                var e = n.$refs[n.tableContainerRef];
                if (n.hooks.triggerHook(ln, e), n.setScrolling(e), C) {
                  n.tableContainerVirtualScrollHandler(e);
                  var t = n.virtualScrollStartIndex,
                    o = n.previewVirtualScrollStartIndex,
                    i = Math.abs(t - o);
                  n.previewVirtualScrollStartIndex = t, i > n.defaultPlaceholderPerScrollingRowCount ? n.showVirtualScrollingPlaceholder = !0 : n.showVirtualScrollingPlaceholder = !1, n.debounceScrollEnded();
                }
              },
              mouseup: function () {
                n.tableContainerMouseup();
              },
              mousemove: function (e) {}
            }
          },
          N = {
            ref: this.tableContentWrapperRef,
            class: [Yn("content-wrapper")],
            props: {
              tagName: "div"
            },
            on: {
              "on-dom-resize-change": function (e) {
                var t = e.height;
                n.tableHeight = t;
              }
            }
          },
          F = {
            ref: this.tableRef,
            class: [Yn("content"), s],
            style: a
          },
          L = {
            ref: this.cellSelectionRef,
            props: {
              tableEl: this.$refs[this.tableRef],
              allRowKeys: I,
              colgroups: c,
              parentRendered: this.parentRendered,
              hooks: this.hooks,
              cellSelectionData: S,
              isAutofillStarting: this.isAutofillStarting,
              cellSelectionRangeData: T,
              currentCellSelectionType: this.currentCellSelectionType,
              showVirtualScrollingPlaceholder: R,
              isVirtualScroll: C,
              virtualScrollVisibleIndexs: this.virtualScrollVisibleIndexs,
              isCellEditing: this.isCellEditing,
              cellAutofillOption: this.cellAutofillOption
            },
            on: Fi({}, Lt, function (e) {
              n.cellSelectionRangeDataChange(e);
            })
          },
          H = {
            ref: this.editInputRef,
            props: {
              hooks: this.hooks,
              parentRendered: this.parentRendered,
              inputStartValue: this.editorInputStartValue,
              rowKeyFieldName: m,
              tableData: this.tableData,
              cellSelectionData: S,
              colgroups: c,
              editingCell: this.editingCell,
              isCellEditing: this.isCellEditing,
              allRowKeys: I,
              hasXScrollBar: this.hasXScrollBar,
              hasYScrollBar: this.hasYScrollBar,
              hasRightFixedColumn: this.hasRightFixedColumn,
              scrollBarWidth: this.getScrollBarWidth()
            },
            on: (t = {}, Fi(t, Jt, function () {
              n.enableStopEditing = !1;
            }), Fi(t, Qt, function (e) {
              n.updateEditingCellValue(e);
            }), Fi(t, Zt, function (e) {
              n.editorCopy(e);
            }), Fi(t, en, function (e) {
              n.editorPaste(e);
            }), Fi(t, tn, function (e) {
              n.editorCut(e);
            }), t)
          },
          W = {
            ref: this.contextmenuRef,
            props: {
              eventTarget: this.contextmenuEventTarget,
              options: K
            },
            on: {
              "on-node-click": function (e) {
                n.contextmenuItemClick(e);
              }
            }
          },
          z = {
            props: {
              parentRendered: this.parentRendered,
              tableContainerEl: this.$refs[this.tableContainerRef],
              hooks: this.hooks,
              colgroups: c,
              isColumnResizerHover: this.isColumnResizerHover,
              isColumnResizing: this.isColumnResizing,
              setIsColumnResizerHover: this.setIsColumnResizerHover,
              setIsColumnResizing: this.setIsColumnResizing,
              setColumnWidth: this.setColumnWidth,
              columnWidthResizeOption: this.columnWidthResizeOption
            }
          };
        return o("div", j, [o(Qo, M, [o("div", V, [this.getVirtualViewPhantom(), o(Qo, N, [o("table", F, [o(Fo, {
          attrs: {
            colgroups: c,
            enableColumnResize: k
          }
        }), i && o(ei, A), o(pi, P), o(Ci, B)]), E && o(_i, L)])]), E && o(Ki, H), (this.enableHeaderContextmenu || this.enableBodyContextmenu) && o(Pi.a, W), k && o(Mi, z)])]);
      },
      install: function (e) {
        e.component(Hi.name, Hi);
      }
    },
    Wi = Hi,
    zi = "2.27.1",
    $i = [w, R, ee, fe, ve, De, je, qe, Je, it, Wi],
    qi = function (e) {
      $i.forEach(function (t) {
        e.use(t);
      }), e.prototype.$veLoading = De, e.prototype.$veLocale = je;
    };
  "undefined" != typeof window && window.Vue && qi(window.Vue);
  t.default = {
    install: qi,
    version: zi,
    VeCheckbox: w,
    VeCheckboxGroup: R,
    VeContextmenu: ee,
    VeDropdown: fe,
    VeIcon: ve,
    VeLoading: De,
    VeLocale: je,
    VePagination: qe,
    VeRadio: Je,
    VeSelect: it,
    VeTable: Wi
  };
}]).default;
});

var VeTable = unwrapExports(main$1);

var jquery = createCommonjsModule(function (module) {
/*!
 * jQuery JavaScript Library v3.7.1
 * https://jquery.com/
 *
 * Copyright OpenJS Foundation and other contributors
 * Released under the MIT license
 * https://jquery.org/license
 *
 * Date: 2023-08-28T13:37Z
 */
(function (global, factory) {

  {
    // For CommonJS and CommonJS-like environments where a proper `window`
    // is present, execute the factory and get jQuery.
    // For environments that do not have a `window` with a `document`
    // (such as Node.js), expose a factory as module.exports.
    // This accentuates the need for the creation of a real `window`.
    // e.g. var jQuery = require("jquery")(window);
    // See ticket trac-14549 for more info.
    module.exports = global.document ? factory(global, true) : function (w) {
      if (!w.document) {
        throw new Error("jQuery requires a window with a document");
      }
      return factory(w);
    };
  }

  // Pass this if window is not defined yet
})(typeof window !== "undefined" ? window : commonjsGlobal, function (window, noGlobal) {

  var arr = [];
  var getProto = Object.getPrototypeOf;
  var slice = arr.slice;
  var flat = arr.flat ? function (array) {
    return arr.flat.call(array);
  } : function (array) {
    return arr.concat.apply([], array);
  };
  var push = arr.push;
  var indexOf = arr.indexOf;
  var class2type = {};
  var toString = class2type.toString;
  var hasOwn = class2type.hasOwnProperty;
  var fnToString = hasOwn.toString;
  var ObjectFunctionString = fnToString.call(Object);
  var support = {};
  var isFunction = function isFunction(obj) {
    // Support: Chrome <=57, Firefox <=52
    // In some browsers, typeof returns "function" for HTML <object> elements
    // (i.e., `typeof document.createElement( "object" ) === "function"`).
    // We don't want to classify *any* DOM node as a function.
    // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
    // Plus for old WebKit, typeof returns "function" for HTML collections
    // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
    return typeof obj === "function" && typeof obj.nodeType !== "number" && typeof obj.item !== "function";
  };
  var isWindow = function isWindow(obj) {
    return obj != null && obj === obj.window;
  };
  var document = window.document;
  var preservedScriptAttributes = {
    type: true,
    src: true,
    nonce: true,
    noModule: true
  };
  function DOMEval(code, node, doc) {
    doc = doc || document;
    var i,
      val,
      script = doc.createElement("script");
    script.text = code;
    if (node) {
      for (i in preservedScriptAttributes) {
        // Support: Firefox 64+, Edge 18+
        // Some browsers don't support the "nonce" property on scripts.
        // On the other hand, just using `getAttribute` is not enough as
        // the `nonce` attribute is reset to an empty string whenever it
        // becomes browsing-context connected.
        // See https://github.com/whatwg/html/issues/2369
        // See https://html.spec.whatwg.org/#nonce-attributes
        // The `node.getAttribute` check was added for the sake of
        // `jQuery.globalEval` so that it can fake a nonce-containing node
        // via an object.
        val = node[i] || node.getAttribute && node.getAttribute(i);
        if (val) {
          script.setAttribute(i, val);
        }
      }
    }
    doc.head.appendChild(script).parentNode.removeChild(script);
  }
  function toType(obj) {
    if (obj == null) {
      return obj + "";
    }

    // Support: Android <=2.3 only (functionish RegExp)
    return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj;
  }
  /* global Symbol */
  // Defining this global in .eslintrc.json would create a danger of using the global
  // unguarded in another place, it seems safer to define global only for this module

  var version = "3.7.1",
    rhtmlSuffix = /HTML$/i,
    // Define a local copy of jQuery
    jQuery = function (selector, context) {
      // The jQuery object is actually just the init constructor 'enhanced'
      // Need init if jQuery is called (just allow error to be thrown if not included)
      return new jQuery.fn.init(selector, context);
    };
  jQuery.fn = jQuery.prototype = {
    // The current version of jQuery being used
    jquery: version,
    constructor: jQuery,
    // The default length of a jQuery object is 0
    length: 0,
    toArray: function () {
      return slice.call(this);
    },
    // Get the Nth element in the matched element set OR
    // Get the whole matched element set as a clean array
    get: function (num) {
      // Return all the elements in a clean array
      if (num == null) {
        return slice.call(this);
      }

      // Return just the one element from the set
      return num < 0 ? this[num + this.length] : this[num];
    },
    // Take an array of elements and push it onto the stack
    // (returning the new matched element set)
    pushStack: function (elems) {
      // Build a new jQuery matched element set
      var ret = jQuery.merge(this.constructor(), elems);

      // Add the old object onto the stack (as a reference)
      ret.prevObject = this;

      // Return the newly-formed element set
      return ret;
    },
    // Execute a callback for every element in the matched set.
    each: function (callback) {
      return jQuery.each(this, callback);
    },
    map: function (callback) {
      return this.pushStack(jQuery.map(this, function (elem, i) {
        return callback.call(elem, i, elem);
      }));
    },
    slice: function () {
      return this.pushStack(slice.apply(this, arguments));
    },
    first: function () {
      return this.eq(0);
    },
    last: function () {
      return this.eq(-1);
    },
    even: function () {
      return this.pushStack(jQuery.grep(this, function (_elem, i) {
        return (i + 1) % 2;
      }));
    },
    odd: function () {
      return this.pushStack(jQuery.grep(this, function (_elem, i) {
        return i % 2;
      }));
    },
    eq: function (i) {
      var len = this.length,
        j = +i + (i < 0 ? len : 0);
      return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
    },
    end: function () {
      return this.prevObject || this.constructor();
    },
    // For internal use only.
    // Behaves like an Array's method, not like a jQuery method.
    push: push,
    sort: arr.sort,
    splice: arr.splice
  };
  jQuery.extend = jQuery.fn.extend = function () {
    var options,
      name,
      src,
      copy,
      copyIsArray,
      clone,
      target = arguments[0] || {},
      i = 1,
      length = arguments.length,
      deep = false;

    // Handle a deep copy situation
    if (typeof target === "boolean") {
      deep = target;

      // Skip the boolean and the target
      target = arguments[i] || {};
      i++;
    }

    // Handle case when target is a string or something (possible in deep copy)
    if (typeof target !== "object" && !isFunction(target)) {
      target = {};
    }

    // Extend jQuery itself if only one argument is passed
    if (i === length) {
      target = this;
      i--;
    }
    for (; i < length; i++) {
      // Only deal with non-null/undefined values
      if ((options = arguments[i]) != null) {
        // Extend the base object
        for (name in options) {
          copy = options[name];

          // Prevent Object.prototype pollution
          // Prevent never-ending loop
          if (name === "__proto__" || target === copy) {
            continue;
          }

          // Recurse if we're merging plain objects or arrays
          if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
            src = target[name];

            // Ensure proper type for the source value
            if (copyIsArray && !Array.isArray(src)) {
              clone = [];
            } else if (!copyIsArray && !jQuery.isPlainObject(src)) {
              clone = {};
            } else {
              clone = src;
            }
            copyIsArray = false;

            // Never move original objects, clone them
            target[name] = jQuery.extend(deep, clone, copy);

            // Don't bring in undefined values
          } else if (copy !== undefined) {
            target[name] = copy;
          }
        }
      }
    }

    // Return the modified object
    return target;
  };
  jQuery.extend({
    // Unique for each copy of jQuery on the page
    expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
    // Assume jQuery is ready without the ready module
    isReady: true,
    error: function (msg) {
      throw new Error(msg);
    },
    noop: function () {},
    isPlainObject: function (obj) {
      var proto, Ctor;

      // Detect obvious negatives
      // Use toString instead of jQuery.type to catch host objects
      if (!obj || toString.call(obj) !== "[object Object]") {
        return false;
      }
      proto = getProto(obj);

      // Objects with no prototype (e.g., `Object.create( null )`) are plain
      if (!proto) {
        return true;
      }

      // Objects with prototype are plain iff they were constructed by a global Object function
      Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
      return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
    },
    isEmptyObject: function (obj) {
      var name;
      for (name in obj) {
        return false;
      }
      return true;
    },
    // Evaluates a script in a provided context; falls back to the global one
    // if not specified.
    globalEval: function (code, options, doc) {
      DOMEval(code, {
        nonce: options && options.nonce
      }, doc);
    },
    each: function (obj, callback) {
      var length,
        i = 0;
      if (isArrayLike(obj)) {
        length = obj.length;
        for (; i < length; i++) {
          if (callback.call(obj[i], i, obj[i]) === false) {
            break;
          }
        }
      } else {
        for (i in obj) {
          if (callback.call(obj[i], i, obj[i]) === false) {
            break;
          }
        }
      }
      return obj;
    },
    // Retrieve the text value of an array of DOM nodes
    text: function (elem) {
      var node,
        ret = "",
        i = 0,
        nodeType = elem.nodeType;
      if (!nodeType) {
        // If no nodeType, this is expected to be an array
        while (node = elem[i++]) {
          // Do not traverse comment nodes
          ret += jQuery.text(node);
        }
      }
      if (nodeType === 1 || nodeType === 11) {
        return elem.textContent;
      }
      if (nodeType === 9) {
        return elem.documentElement.textContent;
      }
      if (nodeType === 3 || nodeType === 4) {
        return elem.nodeValue;
      }

      // Do not include comment or processing instruction nodes

      return ret;
    },
    // results is for internal usage only
    makeArray: function (arr, results) {
      var ret = results || [];
      if (arr != null) {
        if (isArrayLike(Object(arr))) {
          jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
        } else {
          push.call(ret, arr);
        }
      }
      return ret;
    },
    inArray: function (elem, arr, i) {
      return arr == null ? -1 : indexOf.call(arr, elem, i);
    },
    isXMLDoc: function (elem) {
      var namespace = elem && elem.namespaceURI,
        docElem = elem && (elem.ownerDocument || elem).documentElement;

      // Assume HTML when documentElement doesn't yet exist, such as inside
      // document fragments.
      return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML");
    },
    // Support: Android <=4.0 only, PhantomJS 1 only
    // push.apply(_, arraylike) throws on ancient WebKit
    merge: function (first, second) {
      var len = +second.length,
        j = 0,
        i = first.length;
      for (; j < len; j++) {
        first[i++] = second[j];
      }
      first.length = i;
      return first;
    },
    grep: function (elems, callback, invert) {
      var callbackInverse,
        matches = [],
        i = 0,
        length = elems.length,
        callbackExpect = !invert;

      // Go through the array, only saving the items
      // that pass the validator function
      for (; i < length; i++) {
        callbackInverse = !callback(elems[i], i);
        if (callbackInverse !== callbackExpect) {
          matches.push(elems[i]);
        }
      }
      return matches;
    },
    // arg is for internal usage only
    map: function (elems, callback, arg) {
      var length,
        value,
        i = 0,
        ret = [];

      // Go through the array, translating each of the items to their new values
      if (isArrayLike(elems)) {
        length = elems.length;
        for (; i < length; i++) {
          value = callback(elems[i], i, arg);
          if (value != null) {
            ret.push(value);
          }
        }

        // Go through every key on the object,
      } else {
        for (i in elems) {
          value = callback(elems[i], i, arg);
          if (value != null) {
            ret.push(value);
          }
        }
      }

      // Flatten any nested arrays
      return flat(ret);
    },
    // A global GUID counter for objects
    guid: 1,
    // jQuery.support is not used in Core but other projects attach their
    // properties to it so it needs to exist.
    support: support
  });
  if (typeof Symbol === "function") {
    jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  }

  // Populate the class2type map
  jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (_i, name) {
    class2type["[object " + name + "]"] = name.toLowerCase();
  });
  function isArrayLike(obj) {
    // Support: real iOS 8.2 only (not reproducible in simulator)
    // `in` check used to prevent JIT error (gh-2145)
    // hasOwn isn't used here due to false negatives
    // regarding Nodelist length in IE
    var length = !!obj && "length" in obj && obj.length,
      type = toType(obj);
    if (isFunction(obj) || isWindow(obj)) {
      return false;
    }
    return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  }
  function nodeName(elem, name) {
    return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  }
  var pop = arr.pop;
  var sort = arr.sort;
  var splice = arr.splice;
  var whitespace = "[\\x20\\t\\r\\n\\f]";
  var rtrimCSS = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g");

  // Note: an element does not contain itself
  jQuery.contains = function (a, b) {
    var bup = b && b.parentNode;
    return a === bup || !!(bup && bup.nodeType === 1 && (
    // Support: IE 9 - 11+
    // IE doesn't have `contains` on SVG.
    a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  };

  // CSS string/identifier serialization
  // https://drafts.csswg.org/cssom/#common-serializing-idioms
  var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  function fcssescape(ch, asCodePoint) {
    if (asCodePoint) {
      // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
      if (ch === "\0") {
        return "\uFFFD";
      }

      // Control characters and (dependent upon position) numbers get escaped as code points
      return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
    }

    // Other potentially-special ASCII characters get backslash-escaped
    return "\\" + ch;
  }
  jQuery.escapeSelector = function (sel) {
    return (sel + "").replace(rcssescape, fcssescape);
  };
  var preferredDoc = document,
    pushNative = push;
  (function () {
    var i,
      Expr,
      outermostContext,
      sortInput,
      hasDuplicate,
      push = pushNative,
      // Local document vars
      document,
      documentElement,
      documentIsHTML,
      rbuggyQSA,
      matches,
      // Instance-specific data
      expando = jQuery.expando,
      dirruns = 0,
      done = 0,
      classCache = createCache(),
      tokenCache = createCache(),
      compilerCache = createCache(),
      nonnativeSelectorCache = createCache(),
      sortOrder = function (a, b) {
        if (a === b) {
          hasDuplicate = true;
        }
        return 0;
      },
      booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + "loop|multiple|open|readonly|required|scoped",
      // Regular expressions

      // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
      identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
      // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
      attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
      // Operator (capture 2)
      "*([*^$|!~]?=)" + whitespace +
      // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
      "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
      pseudos = ":(" + identifier + ")(?:\\((" +
      // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
      // 1. quoted (capture 3; capture 4 or capture 5)
      "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
      // 2. simple (capture 6)
      "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
      // 3. anything else (capture 2)
      ".*" + ")\\)|)",
      // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
      rwhitespace = new RegExp(whitespace + "+", "g"),
      rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
      rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
      rdescend = new RegExp(whitespace + "|>"),
      rpseudo = new RegExp(pseudos),
      ridentifier = new RegExp("^" + identifier + "$"),
      matchExpr = {
        ID: new RegExp("^#(" + identifier + ")"),
        CLASS: new RegExp("^\\.(" + identifier + ")"),
        TAG: new RegExp("^(" + identifier + "|[*])"),
        ATTR: new RegExp("^" + attributes),
        PSEUDO: new RegExp("^" + pseudos),
        CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
        bool: new RegExp("^(?:" + booleans + ")$", "i"),
        // For use in libraries implementing .is()
        // We use this for POS matching in `select`
        needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
      },
      rinputs = /^(?:input|select|textarea|button)$/i,
      rheader = /^h\d$/i,
      // Easily-parseable/retrievable ID or TAG or CLASS selectors
      rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
      rsibling = /[+~]/,
      // CSS escapes
      // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
      runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"),
      funescape = function (escape, nonHex) {
        var high = "0x" + escape.slice(1) - 0x10000;
        if (nonHex) {
          // Strip the backslash prefix from a non-hex escape sequence
          return nonHex;
        }

        // Replace a hexadecimal escape sequence with the encoded Unicode code point
        // Support: IE <=11+
        // For values outside the Basic Multilingual Plane (BMP), manually construct a
        // surrogate pair
        return high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
      },
      // Used for iframes; see `setDocument`.
      // Support: IE 9 - 11+, Edge 12 - 18+
      // Removing the function wrapper causes a "Permission Denied"
      // error in IE/Edge.
      unloadHandler = function () {
        setDocument();
      },
      inDisabledFieldset = addCombinator(function (elem) {
        return elem.disabled === true && nodeName(elem, "fieldset");
      }, {
        dir: "parentNode",
        next: "legend"
      });

    // Support: IE <=9 only
    // Accessing document.activeElement can throw unexpectedly
    // https://bugs.jquery.com/ticket/13393
    function safeActiveElement() {
      try {
        return document.activeElement;
      } catch (err) {}
    }

    // Optimize for push.apply( _, NodeList )
    try {
      push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);

      // Support: Android <=4.0
      // Detect silently failing push.apply
      // eslint-disable-next-line no-unused-expressions
      arr[preferredDoc.childNodes.length].nodeType;
    } catch (e) {
      push = {
        apply: function (target, els) {
          pushNative.apply(target, slice.call(els));
        },
        call: function (target) {
          pushNative.apply(target, slice.call(arguments, 1));
        }
      };
    }
    function find(selector, context, results, seed) {
      var m,
        i,
        elem,
        nid,
        match,
        groups,
        newSelector,
        newContext = context && context.ownerDocument,
        // nodeType defaults to 9, since context defaults to document
        nodeType = context ? context.nodeType : 9;
      results = results || [];

      // Return early from calls with invalid selector or context
      if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
        return results;
      }

      // Try to shortcut find operations (as opposed to filters) in HTML documents
      if (!seed) {
        setDocument(context);
        context = context || document;
        if (documentIsHTML) {
          // If the selector is sufficiently simple, try using a "get*By*" DOM method
          // (excepting DocumentFragment context, where the methods don't exist)
          if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
            // ID selector
            if (m = match[1]) {
              // Document context
              if (nodeType === 9) {
                if (elem = context.getElementById(m)) {
                  // Support: IE 9 only
                  // getElementById can match elements by name instead of ID
                  if (elem.id === m) {
                    push.call(results, elem);
                    return results;
                  }
                } else {
                  return results;
                }

                // Element context
              } else {
                // Support: IE 9 only
                // getElementById can match elements by name instead of ID
                if (newContext && (elem = newContext.getElementById(m)) && find.contains(context, elem) && elem.id === m) {
                  push.call(results, elem);
                  return results;
                }
              }

              // Type selector
            } else if (match[2]) {
              push.apply(results, context.getElementsByTagName(selector));
              return results;

              // Class selector
            } else if ((m = match[3]) && context.getElementsByClassName) {
              push.apply(results, context.getElementsByClassName(m));
              return results;
            }
          }

          // Take advantage of querySelectorAll
          if (!nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
            newSelector = selector;
            newContext = context;

            // qSA considers elements outside a scoping root when evaluating child or
            // descendant combinators, which is not what we want.
            // In such cases, we work around the behavior by prefixing every selector in the
            // list with an ID selector referencing the scope context.
            // The technique has to be used as well when a leading combinator is used
            // as such selectors are not recognized by querySelectorAll.
            // Thanks to Andrew Dupont for this technique.
            if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) {
              // Expand context for sibling selectors
              newContext = rsibling.test(selector) && testContext(context.parentNode) || context;

              // We can use :scope instead of the ID hack if the browser
              // supports it & if we're not changing the context.
              // Support: IE 11+, Edge 17 - 18+
              // IE/Edge sometimes throw a "Permission denied" error when
              // strict-comparing two documents; shallow comparisons work.
              // eslint-disable-next-line eqeqeq
              if (newContext != context || !support.scope) {
                // Capture the context ID, setting it first if necessary
                if (nid = context.getAttribute("id")) {
                  nid = jQuery.escapeSelector(nid);
                } else {
                  context.setAttribute("id", nid = expando);
                }
              }

              // Prefix every selector in the list
              groups = tokenize(selector);
              i = groups.length;
              while (i--) {
                groups[i] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i]);
              }
              newSelector = groups.join(",");
            }
            try {
              push.apply(results, newContext.querySelectorAll(newSelector));
              return results;
            } catch (qsaError) {
              nonnativeSelectorCache(selector, true);
            } finally {
              if (nid === expando) {
                context.removeAttribute("id");
              }
            }
          }
        }
      }

      // All others
      return select(selector.replace(rtrimCSS, "$1"), context, results, seed);
    }

    /**
     * Create key-value caches of limited size
     * @returns {function(string, object)} Returns the Object data after storing it on itself with
     *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
     *	deleting the oldest entry
     */
    function createCache() {
      var keys = [];
      function cache(key, value) {
        // Use (key + " ") to avoid collision with native prototype properties
        // (see https://github.com/jquery/sizzle/issues/157)
        if (keys.push(key + " ") > Expr.cacheLength) {
          // Only keep the most recent entries
          delete cache[keys.shift()];
        }
        return cache[key + " "] = value;
      }
      return cache;
    }

    /**
     * Mark a function for special use by jQuery selector module
     * @param {Function} fn The function to mark
     */
    function markFunction(fn) {
      fn[expando] = true;
      return fn;
    }

    /**
     * Support testing using an element
     * @param {Function} fn Passed the created element and returns a boolean result
     */
    function assert(fn) {
      var el = document.createElement("fieldset");
      try {
        return !!fn(el);
      } catch (e) {
        return false;
      } finally {
        // Remove from its parent by default
        if (el.parentNode) {
          el.parentNode.removeChild(el);
        }

        // release memory in IE
        el = null;
      }
    }

    /**
     * Returns a function to use in pseudos for input types
     * @param {String} type
     */
    function createInputPseudo(type) {
      return function (elem) {
        return nodeName(elem, "input") && elem.type === type;
      };
    }

    /**
     * Returns a function to use in pseudos for buttons
     * @param {String} type
     */
    function createButtonPseudo(type) {
      return function (elem) {
        return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type;
      };
    }

    /**
     * Returns a function to use in pseudos for :enabled/:disabled
     * @param {Boolean} disabled true for :disabled; false for :enabled
     */
    function createDisabledPseudo(disabled) {
      // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
      return function (elem) {
        // Only certain elements can match :enabled or :disabled
        // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
        // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
        if ("form" in elem) {
          // Check for inherited disabledness on relevant non-disabled elements:
          // * listed form-associated elements in a disabled fieldset
          //   https://html.spec.whatwg.org/multipage/forms.html#category-listed
          //   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
          // * option elements in a disabled optgroup
          //   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
          // All such elements have a "form" property.
          if (elem.parentNode && elem.disabled === false) {
            // Option elements defer to a parent optgroup if present
            if ("label" in elem) {
              if ("label" in elem.parentNode) {
                return elem.parentNode.disabled === disabled;
              } else {
                return elem.disabled === disabled;
              }
            }

            // Support: IE 6 - 11+
            // Use the isDisabled shortcut property to check for disabled fieldset ancestors
            return elem.isDisabled === disabled ||
            // Where there is no isDisabled, check manually
            elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;
          }
          return elem.disabled === disabled;

          // Try to winnow out elements that can't be disabled before trusting the disabled property.
          // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
          // even exist on them, let alone have a boolean value.
        } else if ("label" in elem) {
          return elem.disabled === disabled;
        }

        // Remaining elements are neither :enabled nor :disabled
        return false;
      };
    }

    /**
     * Returns a function to use in pseudos for positionals
     * @param {Function} fn
     */
    function createPositionalPseudo(fn) {
      return markFunction(function (argument) {
        argument = +argument;
        return markFunction(function (seed, matches) {
          var j,
            matchIndexes = fn([], seed.length, argument),
            i = matchIndexes.length;

          // Match elements found at the specified indexes
          while (i--) {
            if (seed[j = matchIndexes[i]]) {
              seed[j] = !(matches[j] = seed[j]);
            }
          }
        });
      });
    }

    /**
     * Checks a node for validity as a jQuery selector context
     * @param {Element|Object=} context
     * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
     */
    function testContext(context) {
      return context && typeof context.getElementsByTagName !== "undefined" && context;
    }

    /**
     * Sets document-related variables once based on the current document
     * @param {Element|Object} [node] An element or document object to use to set the document
     * @returns {Object} Returns the current document
     */
    function setDocument(node) {
      var subWindow,
        doc = node ? node.ownerDocument || node : preferredDoc;

      // Return early if doc is invalid or already selected
      // Support: IE 11+, Edge 17 - 18+
      // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
      // two documents; shallow comparisons work.
      // eslint-disable-next-line eqeqeq
      if (doc == document || doc.nodeType !== 9 || !doc.documentElement) {
        return document;
      }

      // Update global variables
      document = doc;
      documentElement = document.documentElement;
      documentIsHTML = !jQuery.isXMLDoc(document);

      // Support: iOS 7 only, IE 9 - 11+
      // Older browsers didn't support unprefixed `matches`.
      matches = documentElement.matches || documentElement.webkitMatchesSelector || documentElement.msMatchesSelector;

      // Support: IE 9 - 11+, Edge 12 - 18+
      // Accessing iframe documents after unload throws "permission denied" errors
      // (see trac-13936).
      // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`,
      // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well.
      if (documentElement.msMatchesSelector &&
      // Support: IE 11+, Edge 17 - 18+
      // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
      // two documents; shallow comparisons work.
      // eslint-disable-next-line eqeqeq
      preferredDoc != document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
        // Support: IE 9 - 11+, Edge 12 - 18+
        subWindow.addEventListener("unload", unloadHandler);
      }

      // Support: IE <10
      // Check if getElementById returns elements by name
      // The broken getElementById methods don't pick up programmatically-set names,
      // so use a roundabout getElementsByName test
      support.getById = assert(function (el) {
        documentElement.appendChild(el).id = jQuery.expando;
        return !document.getElementsByName || !document.getElementsByName(jQuery.expando).length;
      });

      // Support: IE 9 only
      // Check to see if it's possible to do matchesSelector
      // on a disconnected node.
      support.disconnectedMatch = assert(function (el) {
        return matches.call(el, "*");
      });

      // Support: IE 9 - 11+, Edge 12 - 18+
      // IE/Edge don't support the :scope pseudo-class.
      support.scope = assert(function () {
        return document.querySelectorAll(":scope");
      });

      // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
      // Make sure the `:has()` argument is parsed unforgivingly.
      // We include `*` in the test to detect buggy implementations that are
      // _selectively_ forgiving (specifically when the list includes at least
      // one valid selector).
      // Note that we treat complete lack of support for `:has()` as if it were
      // spec-compliant support, which is fine because use of `:has()` in such
      // environments will fail in the qSA path and fall back to jQuery traversal
      // anyway.
      support.cssHas = assert(function () {
        try {
          document.querySelector(":has(*,:jqfake)");
          return false;
        } catch (e) {
          return true;
        }
      });

      // ID filter and find
      if (support.getById) {
        Expr.filter.ID = function (id) {
          var attrId = id.replace(runescape, funescape);
          return function (elem) {
            return elem.getAttribute("id") === attrId;
          };
        };
        Expr.find.ID = function (id, context) {
          if (typeof context.getElementById !== "undefined" && documentIsHTML) {
            var elem = context.getElementById(id);
            return elem ? [elem] : [];
          }
        };
      } else {
        Expr.filter.ID = function (id) {
          var attrId = id.replace(runescape, funescape);
          return function (elem) {
            var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
            return node && node.value === attrId;
          };
        };

        // Support: IE 6 - 7 only
        // getElementById is not reliable as a find shortcut
        Expr.find.ID = function (id, context) {
          if (typeof context.getElementById !== "undefined" && documentIsHTML) {
            var node,
              i,
              elems,
              elem = context.getElementById(id);
            if (elem) {
              // Verify the id attribute
              node = elem.getAttributeNode("id");
              if (node && node.value === id) {
                return [elem];
              }

              // Fall back on getElementsByName
              elems = context.getElementsByName(id);
              i = 0;
              while (elem = elems[i++]) {
                node = elem.getAttributeNode("id");
                if (node && node.value === id) {
                  return [elem];
                }
              }
            }
            return [];
          }
        };
      }

      // Tag
      Expr.find.TAG = function (tag, context) {
        if (typeof context.getElementsByTagName !== "undefined") {
          return context.getElementsByTagName(tag);

          // DocumentFragment nodes don't have gEBTN
        } else {
          return context.querySelectorAll(tag);
        }
      };

      // Class
      Expr.find.CLASS = function (className, context) {
        if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
          return context.getElementsByClassName(className);
        }
      };

      /* QSA/matchesSelector
      ---------------------------------------------------------------------- */

      // QSA and matchesSelector support

      rbuggyQSA = [];

      // Build QSA regex
      // Regex strategy adopted from Diego Perini
      assert(function (el) {
        var input;
        documentElement.appendChild(el).innerHTML = "<a id='" + expando + "' href='' disabled='disabled'></a>" + "<select id='" + expando + "-\r\\' disabled='disabled'>" + "<option selected=''></option></select>";

        // Support: iOS <=7 - 8 only
        // Boolean attributes and "value" are not treated correctly in some XML documents
        if (!el.querySelectorAll("[selected]").length) {
          rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
        }

        // Support: iOS <=7 - 8 only
        if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
          rbuggyQSA.push("~=");
        }

        // Support: iOS 8 only
        // https://bugs.webkit.org/show_bug.cgi?id=136851
        // In-page `selector#id sibling-combinator selector` fails
        if (!el.querySelectorAll("a#" + expando + "+*").length) {
          rbuggyQSA.push(".#.+[+~]");
        }

        // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
        // In some of the document kinds, these selectors wouldn't work natively.
        // This is probably OK but for backwards compatibility we want to maintain
        // handling them through jQuery traversal in jQuery 3.x.
        if (!el.querySelectorAll(":checked").length) {
          rbuggyQSA.push(":checked");
        }

        // Support: Windows 8 Native Apps
        // The type and name attributes are restricted during .innerHTML assignment
        input = document.createElement("input");
        input.setAttribute("type", "hidden");
        el.appendChild(input).setAttribute("name", "D");

        // Support: IE 9 - 11+
        // IE's :disabled selector does not pick up the children of disabled fieldsets
        // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
        // In some of the document kinds, these selectors wouldn't work natively.
        // This is probably OK but for backwards compatibility we want to maintain
        // handling them through jQuery traversal in jQuery 3.x.
        documentElement.appendChild(el).disabled = true;
        if (el.querySelectorAll(":disabled").length !== 2) {
          rbuggyQSA.push(":enabled", ":disabled");
        }

        // Support: IE 11+, Edge 15 - 18+
        // IE 11/Edge don't find elements on a `[name='']` query in some cases.
        // Adding a temporary attribute to the document before the selection works
        // around the issue.
        // Interestingly, IE 10 & older don't seem to have the issue.
        input = document.createElement("input");
        input.setAttribute("name", "");
        el.appendChild(input);
        if (!el.querySelectorAll("[name='']").length) {
          rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + "*(?:''|\"\")");
        }
      });
      if (!support.cssHas) {
        // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
        // Our regular `try-catch` mechanism fails to detect natively-unsupported
        // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
        // in browsers that parse the `:has()` argument as a forgiving selector list.
        // https://drafts.csswg.org/selectors/#relational now requires the argument
        // to be parsed unforgivingly, but browsers have not yet fully adjusted.
        rbuggyQSA.push(":has");
      }
      rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));

      /* Sorting
      ---------------------------------------------------------------------- */

      // Document order sorting
      sortOrder = function (a, b) {
        // Flag for duplicate removal
        if (a === b) {
          hasDuplicate = true;
          return 0;
        }

        // Sort on method existence if only one input has compareDocumentPosition
        var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
        if (compare) {
          return compare;
        }

        // Calculate position if both inputs belong to the same document
        // Support: IE 11+, Edge 17 - 18+
        // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
        // two documents; shallow comparisons work.
        // eslint-disable-next-line eqeqeq
        compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
        // Otherwise we know they are disconnected
        1;

        // Disconnected nodes
        if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
          // Choose the first element that is related to our preferred document
          // Support: IE 11+, Edge 17 - 18+
          // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
          // two documents; shallow comparisons work.
          // eslint-disable-next-line eqeqeq
          if (a === document || a.ownerDocument == preferredDoc && find.contains(preferredDoc, a)) {
            return -1;
          }

          // Support: IE 11+, Edge 17 - 18+
          // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
          // two documents; shallow comparisons work.
          // eslint-disable-next-line eqeqeq
          if (b === document || b.ownerDocument == preferredDoc && find.contains(preferredDoc, b)) {
            return 1;
          }

          // Maintain original order
          return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0;
        }
        return compare & 4 ? -1 : 1;
      };
      return document;
    }
    find.matches = function (expr, elements) {
      return find(expr, null, null, elements);
    };
    find.matchesSelector = function (elem, expr) {
      setDocument(elem);
      if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
        try {
          var ret = matches.call(elem, expr);

          // IE 9's matchesSelector returns false on disconnected nodes
          if (ret || support.disconnectedMatch ||
          // As well, disconnected nodes are said to be in a document
          // fragment in IE 9
          elem.document && elem.document.nodeType !== 11) {
            return ret;
          }
        } catch (e) {
          nonnativeSelectorCache(expr, true);
        }
      }
      return find(expr, document, null, [elem]).length > 0;
    };
    find.contains = function (context, elem) {
      // Set document vars if needed
      // Support: IE 11+, Edge 17 - 18+
      // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
      // two documents; shallow comparisons work.
      // eslint-disable-next-line eqeqeq
      if ((context.ownerDocument || context) != document) {
        setDocument(context);
      }
      return jQuery.contains(context, elem);
    };
    find.attr = function (elem, name) {
      // Set document vars if needed
      // Support: IE 11+, Edge 17 - 18+
      // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
      // two documents; shallow comparisons work.
      // eslint-disable-next-line eqeqeq
      if ((elem.ownerDocument || elem) != document) {
        setDocument(elem);
      }
      var fn = Expr.attrHandle[name.toLowerCase()],
        // Don't get fooled by Object.prototype properties (see trac-13807)
        val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
      if (val !== undefined) {
        return val;
      }
      return elem.getAttribute(name);
    };
    find.error = function (msg) {
      throw new Error("Syntax error, unrecognized expression: " + msg);
    };

    /**
     * Document sorting and removing duplicates
     * @param {ArrayLike} results
     */
    jQuery.uniqueSort = function (results) {
      var elem,
        duplicates = [],
        j = 0,
        i = 0;

      // Unless we *know* we can detect duplicates, assume their presence
      //
      // Support: Android <=4.0+
      // Testing for detecting duplicates is unpredictable so instead assume we can't
      // depend on duplicate detection in all browsers without a stable sort.
      hasDuplicate = !support.sortStable;
      sortInput = !support.sortStable && slice.call(results, 0);
      sort.call(results, sortOrder);
      if (hasDuplicate) {
        while (elem = results[i++]) {
          if (elem === results[i]) {
            j = duplicates.push(i);
          }
        }
        while (j--) {
          splice.call(results, duplicates[j], 1);
        }
      }

      // Clear input after sorting to release objects
      // See https://github.com/jquery/sizzle/pull/225
      sortInput = null;
      return results;
    };
    jQuery.fn.uniqueSort = function () {
      return this.pushStack(jQuery.uniqueSort(slice.apply(this)));
    };
    Expr = jQuery.expr = {
      // Can be adjusted by the user
      cacheLength: 50,
      createPseudo: markFunction,
      match: matchExpr,
      attrHandle: {},
      find: {},
      relative: {
        ">": {
          dir: "parentNode",
          first: true
        },
        " ": {
          dir: "parentNode"
        },
        "+": {
          dir: "previousSibling",
          first: true
        },
        "~": {
          dir: "previousSibling"
        }
      },
      preFilter: {
        ATTR: function (match) {
          match[1] = match[1].replace(runescape, funescape);

          // Move the given value to match[3] whether quoted or unquoted
          match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
          if (match[2] === "~=") {
            match[3] = " " + match[3] + " ";
          }
          return match.slice(0, 4);
        },
        CHILD: function (match) {
          /* matches from matchExpr["CHILD"]
          	1 type (only|nth|...)
          	2 what (child|of-type)
          	3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
          	4 xn-component of xn+y argument ([+-]?\d*n|)
          	5 sign of xn-component
          	6 x of xn-component
          	7 sign of y-component
          	8 y of y-component
          */
          match[1] = match[1].toLowerCase();
          if (match[1].slice(0, 3) === "nth") {
            // nth-* requires argument
            if (!match[3]) {
              find.error(match[0]);
            }

            // numeric x and y parameters for Expr.filter.CHILD
            // remember that false/true cast respectively to 0/1
            match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
            match[5] = +(match[7] + match[8] || match[3] === "odd");

            // other types prohibit arguments
          } else if (match[3]) {
            find.error(match[0]);
          }
          return match;
        },
        PSEUDO: function (match) {
          var excess,
            unquoted = !match[6] && match[2];
          if (matchExpr.CHILD.test(match[0])) {
            return null;
          }

          // Accept quoted arguments as-is
          if (match[3]) {
            match[2] = match[4] || match[5] || "";

            // Strip excess characters from unquoted arguments
          } else if (unquoted && rpseudo.test(unquoted) && (
          // Get excess from tokenize (recursively)
          excess = tokenize(unquoted, true)) && (
          // advance to the next closing parenthesis
          excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
            // excess is a negative index
            match[0] = match[0].slice(0, excess);
            match[2] = unquoted.slice(0, excess);
          }

          // Return only captures needed by the pseudo filter method (type and argument)
          return match.slice(0, 3);
        }
      },
      filter: {
        TAG: function (nodeNameSelector) {
          var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
          return nodeNameSelector === "*" ? function () {
            return true;
          } : function (elem) {
            return nodeName(elem, expectedNodeName);
          };
        },
        CLASS: function (className) {
          var pattern = classCache[className + " "];
          return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
            return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
          });
        },
        ATTR: function (name, operator, check) {
          return function (elem) {
            var result = find.attr(elem, name);
            if (result == null) {
              return operator === "!=";
            }
            if (!operator) {
              return true;
            }
            result += "";
            if (operator === "=") {
              return result === check;
            }
            if (operator === "!=") {
              return result !== check;
            }
            if (operator === "^=") {
              return check && result.indexOf(check) === 0;
            }
            if (operator === "*=") {
              return check && result.indexOf(check) > -1;
            }
            if (operator === "$=") {
              return check && result.slice(-check.length) === check;
            }
            if (operator === "~=") {
              return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1;
            }
            if (operator === "|=") {
              return result === check || result.slice(0, check.length + 1) === check + "-";
            }
            return false;
          };
        },
        CHILD: function (type, what, _argument, first, last) {
          var simple = type.slice(0, 3) !== "nth",
            forward = type.slice(-4) !== "last",
            ofType = what === "of-type";
          return first === 1 && last === 0 ?
          // Shortcut for :nth-*(n)
          function (elem) {
            return !!elem.parentNode;
          } : function (elem, _context, xml) {
            var cache,
              outerCache,
              node,
              nodeIndex,
              start,
              dir = simple !== forward ? "nextSibling" : "previousSibling",
              parent = elem.parentNode,
              name = ofType && elem.nodeName.toLowerCase(),
              useCache = !xml && !ofType,
              diff = false;
            if (parent) {
              // :(first|last|only)-(child|of-type)
              if (simple) {
                while (dir) {
                  node = elem;
                  while (node = node[dir]) {
                    if (ofType ? nodeName(node, name) : node.nodeType === 1) {
                      return false;
                    }
                  }

                  // Reverse direction for :only-* (if we haven't yet done so)
                  start = dir = type === "only" && !start && "nextSibling";
                }
                return true;
              }
              start = [forward ? parent.firstChild : parent.lastChild];

              // non-xml :nth-child(...) stores cache data on `parent`
              if (forward && useCache) {
                // Seek `elem` from a previously-cached index
                outerCache = parent[expando] || (parent[expando] = {});
                cache = outerCache[type] || [];
                nodeIndex = cache[0] === dirruns && cache[1];
                diff = nodeIndex && cache[2];
                node = nodeIndex && parent.childNodes[nodeIndex];
                while (node = ++nodeIndex && node && node[dir] || (
                // Fallback to seeking `elem` from the start
                diff = nodeIndex = 0) || start.pop()) {
                  // When found, cache indexes on `parent` and break
                  if (node.nodeType === 1 && ++diff && node === elem) {
                    outerCache[type] = [dirruns, nodeIndex, diff];
                    break;
                  }
                }
              } else {
                // Use previously-cached element index if available
                if (useCache) {
                  outerCache = elem[expando] || (elem[expando] = {});
                  cache = outerCache[type] || [];
                  nodeIndex = cache[0] === dirruns && cache[1];
                  diff = nodeIndex;
                }

                // xml :nth-child(...)
                // or :nth-last-child(...) or :nth(-last)?-of-type(...)
                if (diff === false) {
                  // Use the same loop as above to seek `elem` from the start
                  while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
                    if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) {
                      // Cache the index of each encountered element
                      if (useCache) {
                        outerCache = node[expando] || (node[expando] = {});
                        outerCache[type] = [dirruns, diff];
                      }
                      if (node === elem) {
                        break;
                      }
                    }
                  }
                }
              }

              // Incorporate the offset, then check against cycle size
              diff -= last;
              return diff === first || diff % first === 0 && diff / first >= 0;
            }
          };
        },
        PSEUDO: function (pseudo, argument) {
          // pseudo-class names are case-insensitive
          // https://www.w3.org/TR/selectors/#pseudo-classes
          // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
          // Remember that setFilters inherits from pseudos
          var args,
            fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find.error("unsupported pseudo: " + pseudo);

          // The user may use createPseudo to indicate that
          // arguments are needed to create the filter function
          // just as jQuery does
          if (fn[expando]) {
            return fn(argument);
          }

          // But maintain support for old signatures
          if (fn.length > 1) {
            args = [pseudo, pseudo, "", argument];
            return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
              var idx,
                matched = fn(seed, argument),
                i = matched.length;
              while (i--) {
                idx = indexOf.call(seed, matched[i]);
                seed[idx] = !(matches[idx] = matched[i]);
              }
            }) : function (elem) {
              return fn(elem, 0, args);
            };
          }
          return fn;
        }
      },
      pseudos: {
        // Potentially complex pseudos
        not: markFunction(function (selector) {
          // Trim the selector passed to compile
          // to avoid treating leading and trailing
          // spaces as combinators
          var input = [],
            results = [],
            matcher = compile(selector.replace(rtrimCSS, "$1"));
          return matcher[expando] ? markFunction(function (seed, matches, _context, xml) {
            var elem,
              unmatched = matcher(seed, null, xml, []),
              i = seed.length;

            // Match elements unmatched by `matcher`
            while (i--) {
              if (elem = unmatched[i]) {
                seed[i] = !(matches[i] = elem);
              }
            }
          }) : function (elem, _context, xml) {
            input[0] = elem;
            matcher(input, null, xml, results);

            // Don't keep the element
            // (see https://github.com/jquery/sizzle/issues/299)
            input[0] = null;
            return !results.pop();
          };
        }),
        has: markFunction(function (selector) {
          return function (elem) {
            return find(selector, elem).length > 0;
          };
        }),
        contains: markFunction(function (text) {
          text = text.replace(runescape, funescape);
          return function (elem) {
            return (elem.textContent || jQuery.text(elem)).indexOf(text) > -1;
          };
        }),
        // "Whether an element is represented by a :lang() selector
        // is based solely on the element's language value
        // being equal to the identifier C,
        // or beginning with the identifier C immediately followed by "-".
        // The matching of C against the element's language value is performed case-insensitively.
        // The identifier C does not have to be a valid language name."
        // https://www.w3.org/TR/selectors/#lang-pseudo
        lang: markFunction(function (lang) {
          // lang value must be a valid identifier
          if (!ridentifier.test(lang || "")) {
            find.error("unsupported lang: " + lang);
          }
          lang = lang.replace(runescape, funescape).toLowerCase();
          return function (elem) {
            var elemLang;
            do {
              if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
                elemLang = elemLang.toLowerCase();
                return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
              }
            } while ((elem = elem.parentNode) && elem.nodeType === 1);
            return false;
          };
        }),
        // Miscellaneous
        target: function (elem) {
          var hash = window.location && window.location.hash;
          return hash && hash.slice(1) === elem.id;
        },
        root: function (elem) {
          return elem === documentElement;
        },
        focus: function (elem) {
          return elem === safeActiveElement() && document.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex);
        },
        // Boolean properties
        enabled: createDisabledPseudo(false),
        disabled: createDisabledPseudo(true),
        checked: function (elem) {
          // In CSS3, :checked should return both checked and selected elements
          // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
          return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected;
        },
        selected: function (elem) {
          // Support: IE <=11+
          // Accessing the selectedIndex property
          // forces the browser to treat the default option as
          // selected when in an optgroup.
          if (elem.parentNode) {
            // eslint-disable-next-line no-unused-expressions
            elem.parentNode.selectedIndex;
          }
          return elem.selected === true;
        },
        // Contents
        empty: function (elem) {
          // https://www.w3.org/TR/selectors/#empty-pseudo
          // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
          //   but not by others (comment: 8; processing instruction: 7; etc.)
          // nodeType < 6 works because attributes (2) do not appear as children
          for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
            if (elem.nodeType < 6) {
              return false;
            }
          }
          return true;
        },
        parent: function (elem) {
          return !Expr.pseudos.empty(elem);
        },
        // Element/input types
        header: function (elem) {
          return rheader.test(elem.nodeName);
        },
        input: function (elem) {
          return rinputs.test(elem.nodeName);
        },
        button: function (elem) {
          return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button");
        },
        text: function (elem) {
          var attr;
          return nodeName(elem, "input") && elem.type === "text" && (
          // Support: IE <10 only
          // New HTML5 attribute values (e.g., "search") appear
          // with elem.type === "text"
          (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
        },
        // Position-in-collection
        first: createPositionalPseudo(function () {
          return [0];
        }),
        last: createPositionalPseudo(function (_matchIndexes, length) {
          return [length - 1];
        }),
        eq: createPositionalPseudo(function (_matchIndexes, length, argument) {
          return [argument < 0 ? argument + length : argument];
        }),
        even: createPositionalPseudo(function (matchIndexes, length) {
          var i = 0;
          for (; i < length; i += 2) {
            matchIndexes.push(i);
          }
          return matchIndexes;
        }),
        odd: createPositionalPseudo(function (matchIndexes, length) {
          var i = 1;
          for (; i < length; i += 2) {
            matchIndexes.push(i);
          }
          return matchIndexes;
        }),
        lt: createPositionalPseudo(function (matchIndexes, length, argument) {
          var i;
          if (argument < 0) {
            i = argument + length;
          } else if (argument > length) {
            i = length;
          } else {
            i = argument;
          }
          for (; --i >= 0;) {
            matchIndexes.push(i);
          }
          return matchIndexes;
        }),
        gt: createPositionalPseudo(function (matchIndexes, length, argument) {
          var i = argument < 0 ? argument + length : argument;
          for (; ++i < length;) {
            matchIndexes.push(i);
          }
          return matchIndexes;
        })
      }
    };
    Expr.pseudos.nth = Expr.pseudos.eq;

    // Add button/input type pseudos
    for (i in {
      radio: true,
      checkbox: true,
      file: true,
      password: true,
      image: true
    }) {
      Expr.pseudos[i] = createInputPseudo(i);
    }
    for (i in {
      submit: true,
      reset: true
    }) {
      Expr.pseudos[i] = createButtonPseudo(i);
    }

    // Easy API for creating new setFilters
    function setFilters() {}
    setFilters.prototype = Expr.filters = Expr.pseudos;
    Expr.setFilters = new setFilters();
    function tokenize(selector, parseOnly) {
      var matched,
        match,
        tokens,
        type,
        soFar,
        groups,
        preFilters,
        cached = tokenCache[selector + " "];
      if (cached) {
        return parseOnly ? 0 : cached.slice(0);
      }
      soFar = selector;
      groups = [];
      preFilters = Expr.preFilter;
      while (soFar) {
        // Comma and first run
        if (!matched || (match = rcomma.exec(soFar))) {
          if (match) {
            // Don't consume trailing commas as valid
            soFar = soFar.slice(match[0].length) || soFar;
          }
          groups.push(tokens = []);
        }
        matched = false;

        // Combinators
        if (match = rleadingCombinator.exec(soFar)) {
          matched = match.shift();
          tokens.push({
            value: matched,
            // Cast descendant combinators to space
            type: match[0].replace(rtrimCSS, " ")
          });
          soFar = soFar.slice(matched.length);
        }

        // Filters
        for (type in Expr.filter) {
          if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
            matched = match.shift();
            tokens.push({
              value: matched,
              type: type,
              matches: match
            });
            soFar = soFar.slice(matched.length);
          }
        }
        if (!matched) {
          break;
        }
      }

      // Return the length of the invalid excess
      // if we're just parsing
      // Otherwise, throw an error or return tokens
      if (parseOnly) {
        return soFar.length;
      }
      return soFar ? find.error(selector) :
      // Cache the tokens
      tokenCache(selector, groups).slice(0);
    }
    function toSelector(tokens) {
      var i = 0,
        len = tokens.length,
        selector = "";
      for (; i < len; i++) {
        selector += tokens[i].value;
      }
      return selector;
    }
    function addCombinator(matcher, combinator, base) {
      var dir = combinator.dir,
        skip = combinator.next,
        key = skip || dir,
        checkNonElements = base && key === "parentNode",
        doneName = done++;
      return combinator.first ?
      // Check against closest ancestor/preceding element
      function (elem, context, xml) {
        while (elem = elem[dir]) {
          if (elem.nodeType === 1 || checkNonElements) {
            return matcher(elem, context, xml);
          }
        }
        return false;
      } :
      // Check against all ancestor/preceding elements
      function (elem, context, xml) {
        var oldCache,
          outerCache,
          newCache = [dirruns, doneName];

        // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
        if (xml) {
          while (elem = elem[dir]) {
            if (elem.nodeType === 1 || checkNonElements) {
              if (matcher(elem, context, xml)) {
                return true;
              }
            }
          }
        } else {
          while (elem = elem[dir]) {
            if (elem.nodeType === 1 || checkNonElements) {
              outerCache = elem[expando] || (elem[expando] = {});
              if (skip && nodeName(elem, skip)) {
                elem = elem[dir] || elem;
              } else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
                // Assign to newCache so results back-propagate to previous elements
                return newCache[2] = oldCache[2];
              } else {
                // Reuse newcache so results back-propagate to previous elements
                outerCache[key] = newCache;

                // A match means we're done; a fail means we have to keep checking
                if (newCache[2] = matcher(elem, context, xml)) {
                  return true;
                }
              }
            }
          }
        }
        return false;
      };
    }
    function elementMatcher(matchers) {
      return matchers.length > 1 ? function (elem, context, xml) {
        var i = matchers.length;
        while (i--) {
          if (!matchers[i](elem, context, xml)) {
            return false;
          }
        }
        return true;
      } : matchers[0];
    }
    function multipleContexts(selector, contexts, results) {
      var i = 0,
        len = contexts.length;
      for (; i < len; i++) {
        find(selector, contexts[i], results);
      }
      return results;
    }
    function condense(unmatched, map, filter, context, xml) {
      var elem,
        newUnmatched = [],
        i = 0,
        len = unmatched.length,
        mapped = map != null;
      for (; i < len; i++) {
        if (elem = unmatched[i]) {
          if (!filter || filter(elem, context, xml)) {
            newUnmatched.push(elem);
            if (mapped) {
              map.push(i);
            }
          }
        }
      }
      return newUnmatched;
    }
    function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
      if (postFilter && !postFilter[expando]) {
        postFilter = setMatcher(postFilter);
      }
      if (postFinder && !postFinder[expando]) {
        postFinder = setMatcher(postFinder, postSelector);
      }
      return markFunction(function (seed, results, context, xml) {
        var temp,
          i,
          elem,
          matcherOut,
          preMap = [],
          postMap = [],
          preexisting = results.length,
          // Get initial elements from seed or context
          elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
          // Prefilter to get matcher input, preserving a map for seed-results synchronization
          matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems;
        if (matcher) {
          // If we have a postFinder, or filtered seed, or non-seed postFilter
          // or preexisting results,
          matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ?
          // ...intermediate processing is necessary
          [] :
          // ...otherwise use results directly
          results;

          // Find primary matches
          matcher(matcherIn, matcherOut, context, xml);
        } else {
          matcherOut = matcherIn;
        }

        // Apply postFilter
        if (postFilter) {
          temp = condense(matcherOut, postMap);
          postFilter(temp, [], context, xml);

          // Un-match failing elements by moving them back to matcherIn
          i = temp.length;
          while (i--) {
            if (elem = temp[i]) {
              matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
            }
          }
        }
        if (seed) {
          if (postFinder || preFilter) {
            if (postFinder) {
              // Get the final matcherOut by condensing this intermediate into postFinder contexts
              temp = [];
              i = matcherOut.length;
              while (i--) {
                if (elem = matcherOut[i]) {
                  // Restore matcherIn since elem is not yet a final match
                  temp.push(matcherIn[i] = elem);
                }
              }
              postFinder(null, matcherOut = [], temp, xml);
            }

            // Move matched elements from seed to results to keep them synchronized
            i = matcherOut.length;
            while (i--) {
              if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) {
                seed[temp] = !(results[temp] = elem);
              }
            }
          }

          // Add elements to results, through postFinder if defined
        } else {
          matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
          if (postFinder) {
            postFinder(null, results, matcherOut, xml);
          } else {
            push.apply(results, matcherOut);
          }
        }
      });
    }
    function matcherFromTokens(tokens) {
      var checkContext,
        matcher,
        j,
        len = tokens.length,
        leadingRelative = Expr.relative[tokens[0].type],
        implicitRelative = leadingRelative || Expr.relative[" "],
        i = leadingRelative ? 1 : 0,
        // The foundational matcher ensures that elements are reachable from top-level context(s)
        matchContext = addCombinator(function (elem) {
          return elem === checkContext;
        }, implicitRelative, true),
        matchAnyContext = addCombinator(function (elem) {
          return indexOf.call(checkContext, elem) > -1;
        }, implicitRelative, true),
        matchers = [function (elem, context, xml) {
          // Support: IE 11+, Edge 17 - 18+
          // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
          // two documents; shallow comparisons work.
          // eslint-disable-next-line eqeqeq
          var ret = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));

          // Avoid hanging onto element
          // (see https://github.com/jquery/sizzle/issues/299)
          checkContext = null;
          return ret;
        }];
      for (; i < len; i++) {
        if (matcher = Expr.relative[tokens[i].type]) {
          matchers = [addCombinator(elementMatcher(matchers), matcher)];
        } else {
          matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);

          // Return special upon seeing a positional matcher
          if (matcher[expando]) {
            // Find the next relative operator (if any) for proper handling
            j = ++i;
            for (; j < len; j++) {
              if (Expr.relative[tokens[j].type]) {
                break;
              }
            }
            return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
            // If the preceding token was a descendant combinator, insert an implicit any-element `*`
            tokens.slice(0, i - 1).concat({
              value: tokens[i - 2].type === " " ? "*" : ""
            })).replace(rtrimCSS, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
          }
          matchers.push(matcher);
        }
      }
      return elementMatcher(matchers);
    }
    function matcherFromGroupMatchers(elementMatchers, setMatchers) {
      var bySet = setMatchers.length > 0,
        byElement = elementMatchers.length > 0,
        superMatcher = function (seed, context, xml, results, outermost) {
          var elem,
            j,
            matcher,
            matchedCount = 0,
            i = "0",
            unmatched = seed && [],
            setMatched = [],
            contextBackup = outermostContext,
            // We must always have either seed elements or outermost context
            elems = seed || byElement && Expr.find.TAG("*", outermost),
            // Use integer dirruns iff this is the outermost matcher
            dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
            len = elems.length;
          if (outermost) {
            // Support: IE 11+, Edge 17 - 18+
            // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
            // two documents; shallow comparisons work.
            // eslint-disable-next-line eqeqeq
            outermostContext = context == document || context || outermost;
          }

          // Add elements passing elementMatchers directly to results
          // Support: iOS <=7 - 9 only
          // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching
          // elements by id. (see trac-14142)
          for (; i !== len && (elem = elems[i]) != null; i++) {
            if (byElement && elem) {
              j = 0;

              // Support: IE 11+, Edge 17 - 18+
              // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
              // two documents; shallow comparisons work.
              // eslint-disable-next-line eqeqeq
              if (!context && elem.ownerDocument != document) {
                setDocument(elem);
                xml = !documentIsHTML;
              }
              while (matcher = elementMatchers[j++]) {
                if (matcher(elem, context || document, xml)) {
                  push.call(results, elem);
                  break;
                }
              }
              if (outermost) {
                dirruns = dirrunsUnique;
              }
            }

            // Track unmatched elements for set filters
            if (bySet) {
              // They will have gone through all possible matchers
              if (elem = !matcher && elem) {
                matchedCount--;
              }

              // Lengthen the array for every element, matched or not
              if (seed) {
                unmatched.push(elem);
              }
            }
          }

          // `i` is now the count of elements visited above, and adding it to `matchedCount`
          // makes the latter nonnegative.
          matchedCount += i;

          // Apply set filters to unmatched elements
          // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
          // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
          // no element matchers and no seed.
          // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
          // case, which will result in a "00" `matchedCount` that differs from `i` but is also
          // numerically zero.
          if (bySet && i !== matchedCount) {
            j = 0;
            while (matcher = setMatchers[j++]) {
              matcher(unmatched, setMatched, context, xml);
            }
            if (seed) {
              // Reintegrate element matches to eliminate the need for sorting
              if (matchedCount > 0) {
                while (i--) {
                  if (!(unmatched[i] || setMatched[i])) {
                    setMatched[i] = pop.call(results);
                  }
                }
              }

              // Discard index placeholder values to get only actual matches
              setMatched = condense(setMatched);
            }

            // Add matches to results
            push.apply(results, setMatched);

            // Seedless set matches succeeding multiple successful matchers stipulate sorting
            if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
              jQuery.uniqueSort(results);
            }
          }

          // Override manipulation of globals by nested matchers
          if (outermost) {
            dirruns = dirrunsUnique;
            outermostContext = contextBackup;
          }
          return unmatched;
        };
      return bySet ? markFunction(superMatcher) : superMatcher;
    }
    function compile(selector, match /* Internal Use Only */) {
      var i,
        setMatchers = [],
        elementMatchers = [],
        cached = compilerCache[selector + " "];
      if (!cached) {
        // Generate a function of recursive functions that can be used to check each element
        if (!match) {
          match = tokenize(selector);
        }
        i = match.length;
        while (i--) {
          cached = matcherFromTokens(match[i]);
          if (cached[expando]) {
            setMatchers.push(cached);
          } else {
            elementMatchers.push(cached);
          }
        }

        // Cache the compiled function
        cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));

        // Save selector and tokenization
        cached.selector = selector;
      }
      return cached;
    }

    /**
     * A low-level selection function that works with jQuery's compiled
     *  selector functions
     * @param {String|Function} selector A selector or a pre-compiled
     *  selector function built with jQuery selector compile
     * @param {Element} context
     * @param {Array} [results]
     * @param {Array} [seed] A set of elements to match against
     */
    function select(selector, context, results, seed) {
      var i,
        tokens,
        token,
        type,
        find,
        compiled = typeof selector === "function" && selector,
        match = !seed && tokenize(selector = compiled.selector || selector);
      results = results || [];

      // Try to minimize operations if there is only one selector in the list and no seed
      // (the latter of which guarantees us context)
      if (match.length === 1) {
        // Reduce context if the leading compound selector is an ID
        tokens = match[0] = match[0].slice(0);
        if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
          context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0];
          if (!context) {
            return results;

            // Precompiled matchers will still verify ancestry, so step up a level
          } else if (compiled) {
            context = context.parentNode;
          }
          selector = selector.slice(tokens.shift().value.length);
        }

        // Fetch a seed set for right-to-left matching
        i = matchExpr.needsContext.test(selector) ? 0 : tokens.length;
        while (i--) {
          token = tokens[i];

          // Abort if we hit a combinator
          if (Expr.relative[type = token.type]) {
            break;
          }
          if (find = Expr.find[type]) {
            // Search, expanding context for leading sibling combinators
            if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
              // If seed is empty or no tokens remain, we can return early
              tokens.splice(i, 1);
              selector = seed.length && toSelector(tokens);
              if (!selector) {
                push.apply(results, seed);
                return results;
              }
              break;
            }
          }
        }
      }

      // Compile and execute a filtering function if one is not provided
      // Provide `match` to avoid retokenization if we modified the selector above
      (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
      return results;
    }

    // One-time assignments

    // Support: Android <=4.0 - 4.1+
    // Sort stability
    support.sortStable = expando.split("").sort(sortOrder).join("") === expando;

    // Initialize against the default document
    setDocument();

    // Support: Android <=4.0 - 4.1+
    // Detached nodes confoundingly follow *each other*
    support.sortDetached = assert(function (el) {
      // Should return 1, but returns 4 (following)
      return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
    });
    jQuery.find = find;

    // Deprecated
    jQuery.expr[":"] = jQuery.expr.pseudos;
    jQuery.unique = jQuery.uniqueSort;

    // These have always been private, but they used to be documented as part of
    // Sizzle so let's maintain them for now for backwards compatibility purposes.
    find.compile = compile;
    find.select = select;
    find.setDocument = setDocument;
    find.tokenize = tokenize;
    find.escape = jQuery.escapeSelector;
    find.getText = jQuery.text;
    find.isXML = jQuery.isXMLDoc;
    find.selectors = jQuery.expr;
    find.support = jQuery.support;
    find.uniqueSort = jQuery.uniqueSort;

    /* eslint-enable */
  })();
  var dir = function (elem, dir, until) {
    var matched = [],
      truncate = until !== undefined;
    while ((elem = elem[dir]) && elem.nodeType !== 9) {
      if (elem.nodeType === 1) {
        if (truncate && jQuery(elem).is(until)) {
          break;
        }
        matched.push(elem);
      }
    }
    return matched;
  };
  var siblings = function (n, elem) {
    var matched = [];
    for (; n; n = n.nextSibling) {
      if (n.nodeType === 1 && n !== elem) {
        matched.push(n);
      }
    }
    return matched;
  };
  var rneedsContext = jQuery.expr.match.needsContext;
  var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;

  // Implement the identical functionality for filter and not
  function winnow(elements, qualifier, not) {
    if (isFunction(qualifier)) {
      return jQuery.grep(elements, function (elem, i) {
        return !!qualifier.call(elem, i, elem) !== not;
      });
    }

    // Single element
    if (qualifier.nodeType) {
      return jQuery.grep(elements, function (elem) {
        return elem === qualifier !== not;
      });
    }

    // Arraylike of elements (jQuery, arguments, Array)
    if (typeof qualifier !== "string") {
      return jQuery.grep(elements, function (elem) {
        return indexOf.call(qualifier, elem) > -1 !== not;
      });
    }

    // Filtered directly for both simple and complex selectors
    return jQuery.filter(qualifier, elements, not);
  }
  jQuery.filter = function (expr, elems, not) {
    var elem = elems[0];
    if (not) {
      expr = ":not(" + expr + ")";
    }
    if (elems.length === 1 && elem.nodeType === 1) {
      return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
    }
    return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
      return elem.nodeType === 1;
    }));
  };
  jQuery.fn.extend({
    find: function (selector) {
      var i,
        ret,
        len = this.length,
        self = this;
      if (typeof selector !== "string") {
        return this.pushStack(jQuery(selector).filter(function () {
          for (i = 0; i < len; i++) {
            if (jQuery.contains(self[i], this)) {
              return true;
            }
          }
        }));
      }
      ret = this.pushStack([]);
      for (i = 0; i < len; i++) {
        jQuery.find(selector, self[i], ret);
      }
      return len > 1 ? jQuery.uniqueSort(ret) : ret;
    },
    filter: function (selector) {
      return this.pushStack(winnow(this, selector || [], false));
    },
    not: function (selector) {
      return this.pushStack(winnow(this, selector || [], true));
    },
    is: function (selector) {
      return !!winnow(this,
      // If this is a positional/relative selector, check membership in the returned set
      // so $("p:first").is("p:last") won't return true for a doc with two "p".
      typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
    }
  });

  // Initialize a jQuery object

  // A central reference to the root jQuery(document)
  var rootjQuery,
    // A simple way to check for HTML strings
    // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521)
    // Strict HTML recognition (trac-11290: must start with <)
    // Shortcut simple #id case for speed
    rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
    init = jQuery.fn.init = function (selector, context, root) {
      var match, elem;

      // HANDLE: $(""), $(null), $(undefined), $(false)
      if (!selector) {
        return this;
      }

      // Method init() accepts an alternate rootjQuery
      // so migrate can support jQuery.sub (gh-2101)
      root = root || rootjQuery;

      // Handle HTML strings
      if (typeof selector === "string") {
        if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
          // Assume that strings that start and end with <> are HTML and skip the regex check
          match = [null, selector, null];
        } else {
          match = rquickExpr.exec(selector);
        }

        // Match html or make sure no context is specified for #id
        if (match && (match[1] || !context)) {
          // HANDLE: $(html) -> $(array)
          if (match[1]) {
            context = context instanceof jQuery ? context[0] : context;

            // Option to run scripts is true for back-compat
            // Intentionally let the error be thrown if parseHTML is not present
            jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));

            // HANDLE: $(html, props)
            if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
              for (match in context) {
                // Properties of context are called as methods if possible
                if (isFunction(this[match])) {
                  this[match](context[match]);

                  // ...and otherwise set as attributes
                } else {
                  this.attr(match, context[match]);
                }
              }
            }
            return this;

            // HANDLE: $(#id)
          } else {
            elem = document.getElementById(match[2]);
            if (elem) {
              // Inject the element directly into the jQuery object
              this[0] = elem;
              this.length = 1;
            }
            return this;
          }

          // HANDLE: $(expr, $(...))
        } else if (!context || context.jquery) {
          return (context || root).find(selector);

          // HANDLE: $(expr, context)
          // (which is just equivalent to: $(context).find(expr)
        } else {
          return this.constructor(context).find(selector);
        }

        // HANDLE: $(DOMElement)
      } else if (selector.nodeType) {
        this[0] = selector;
        this.length = 1;
        return this;

        // HANDLE: $(function)
        // Shortcut for document ready
      } else if (isFunction(selector)) {
        return root.ready !== undefined ? root.ready(selector) :
        // Execute immediately if ready is not present
        selector(jQuery);
      }
      return jQuery.makeArray(selector, this);
    };

  // Give the init function the jQuery prototype for later instantiation
  init.prototype = jQuery.fn;

  // Initialize central reference
  rootjQuery = jQuery(document);
  var rparentsprev = /^(?:parents|prev(?:Until|All))/,
    // Methods guaranteed to produce a unique set when starting from a unique set
    guaranteedUnique = {
      children: true,
      contents: true,
      next: true,
      prev: true
    };
  jQuery.fn.extend({
    has: function (target) {
      var targets = jQuery(target, this),
        l = targets.length;
      return this.filter(function () {
        var i = 0;
        for (; i < l; i++) {
          if (jQuery.contains(this, targets[i])) {
            return true;
          }
        }
      });
    },
    closest: function (selectors, context) {
      var cur,
        i = 0,
        l = this.length,
        matched = [],
        targets = typeof selectors !== "string" && jQuery(selectors);

      // Positional selectors never match, since there's no _selection_ context
      if (!rneedsContext.test(selectors)) {
        for (; i < l; i++) {
          for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
            // Always skip document fragments
            if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
            // Don't pass non-elements to jQuery#find
            cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
              matched.push(cur);
              break;
            }
          }
        }
      }
      return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
    },
    // Determine the position of an element within the set
    index: function (elem) {
      // No argument, return index in parent
      if (!elem) {
        return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
      }

      // Index in selector
      if (typeof elem === "string") {
        return indexOf.call(jQuery(elem), this[0]);
      }

      // Locate the position of the desired element
      return indexOf.call(this,
      // If it receives a jQuery object, the first element is used
      elem.jquery ? elem[0] : elem);
    },
    add: function (selector, context) {
      return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
    },
    addBack: function (selector) {
      return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
    }
  });
  function sibling(cur, dir) {
    while ((cur = cur[dir]) && cur.nodeType !== 1) {}
    return cur;
  }
  jQuery.each({
    parent: function (elem) {
      var parent = elem.parentNode;
      return parent && parent.nodeType !== 11 ? parent : null;
    },
    parents: function (elem) {
      return dir(elem, "parentNode");
    },
    parentsUntil: function (elem, _i, until) {
      return dir(elem, "parentNode", until);
    },
    next: function (elem) {
      return sibling(elem, "nextSibling");
    },
    prev: function (elem) {
      return sibling(elem, "previousSibling");
    },
    nextAll: function (elem) {
      return dir(elem, "nextSibling");
    },
    prevAll: function (elem) {
      return dir(elem, "previousSibling");
    },
    nextUntil: function (elem, _i, until) {
      return dir(elem, "nextSibling", until);
    },
    prevUntil: function (elem, _i, until) {
      return dir(elem, "previousSibling", until);
    },
    siblings: function (elem) {
      return siblings((elem.parentNode || {}).firstChild, elem);
    },
    children: function (elem) {
      return siblings(elem.firstChild);
    },
    contents: function (elem) {
      if (elem.contentDocument != null &&
      // Support: IE 11+
      // <object> elements with no `data` attribute has an object
      // `contentDocument` with a `null` prototype.
      getProto(elem.contentDocument)) {
        return elem.contentDocument;
      }

      // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
      // Treat the template element as a regular one in browsers that
      // don't support it.
      if (nodeName(elem, "template")) {
        elem = elem.content || elem;
      }
      return jQuery.merge([], elem.childNodes);
    }
  }, function (name, fn) {
    jQuery.fn[name] = function (until, selector) {
      var matched = jQuery.map(this, fn, until);
      if (name.slice(-5) !== "Until") {
        selector = until;
      }
      if (selector && typeof selector === "string") {
        matched = jQuery.filter(selector, matched);
      }
      if (this.length > 1) {
        // Remove duplicates
        if (!guaranteedUnique[name]) {
          jQuery.uniqueSort(matched);
        }

        // Reverse order for parents* and prev-derivatives
        if (rparentsprev.test(name)) {
          matched.reverse();
        }
      }
      return this.pushStack(matched);
    };
  });
  var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;

  // Convert String-formatted options into Object-formatted ones
  function createOptions(options) {
    var object = {};
    jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
      object[flag] = true;
    });
    return object;
  }

  /*
   * Create a callback list using the following parameters:
   *
   *	options: an optional list of space-separated options that will change how
   *			the callback list behaves or a more traditional option object
   *
   * By default a callback list will act like an event callback list and can be
   * "fired" multiple times.
   *
   * Possible options:
   *
   *	once:			will ensure the callback list can only be fired once (like a Deferred)
   *
   *	memory:			will keep track of previous values and will call any callback added
   *					after the list has been fired right away with the latest "memorized"
   *					values (like a Deferred)
   *
   *	unique:			will ensure a callback can only be added once (no duplicate in the list)
   *
   *	stopOnFalse:	interrupt callings when a callback returns false
   *
   */
  jQuery.Callbacks = function (options) {
    // Convert options from String-formatted to Object-formatted if needed
    // (we check in cache first)
    options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
    var
      // Flag to know if list is currently firing
      firing,
      // Last fire value for non-forgettable lists
      memory,
      // Flag to know if list was already fired
      fired,
      // Flag to prevent firing
      locked,
      // Actual callback list
      list = [],
      // Queue of execution data for repeatable lists
      queue = [],
      // Index of currently firing callback (modified by add/remove as needed)
      firingIndex = -1,
      // Fire callbacks
      fire = function () {
        // Enforce single-firing
        locked = locked || options.once;

        // Execute callbacks for all pending executions,
        // respecting firingIndex overrides and runtime changes
        fired = firing = true;
        for (; queue.length; firingIndex = -1) {
          memory = queue.shift();
          while (++firingIndex < list.length) {
            // Run callback and check for early termination
            if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
              // Jump to end and forget the data so .add doesn't re-fire
              firingIndex = list.length;
              memory = false;
            }
          }
        }

        // Forget the data if we're done with it
        if (!options.memory) {
          memory = false;
        }
        firing = false;

        // Clean up if we're done firing for good
        if (locked) {
          // Keep an empty list if we have data for future add calls
          if (memory) {
            list = [];

            // Otherwise, this object is spent
          } else {
            list = "";
          }
        }
      },
      // Actual Callbacks object
      self = {
        // Add a callback or a collection of callbacks to the list
        add: function () {
          if (list) {
            // If we have memory from a past run, we should fire after adding
            if (memory && !firing) {
              firingIndex = list.length - 1;
              queue.push(memory);
            }
            (function add(args) {
              jQuery.each(args, function (_, arg) {
                if (isFunction(arg)) {
                  if (!options.unique || !self.has(arg)) {
                    list.push(arg);
                  }
                } else if (arg && arg.length && toType(arg) !== "string") {
                  // Inspect recursively
                  add(arg);
                }
              });
            })(arguments);
            if (memory && !firing) {
              fire();
            }
          }
          return this;
        },
        // Remove a callback from the list
        remove: function () {
          jQuery.each(arguments, function (_, arg) {
            var index;
            while ((index = jQuery.inArray(arg, list, index)) > -1) {
              list.splice(index, 1);

              // Handle firing indexes
              if (index <= firingIndex) {
                firingIndex--;
              }
            }
          });
          return this;
        },
        // Check if a given callback is in the list.
        // If no argument is given, return whether or not list has callbacks attached.
        has: function (fn) {
          return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
        },
        // Remove all callbacks from the list
        empty: function () {
          if (list) {
            list = [];
          }
          return this;
        },
        // Disable .fire and .add
        // Abort any current/pending executions
        // Clear all callbacks and values
        disable: function () {
          locked = queue = [];
          list = memory = "";
          return this;
        },
        disabled: function () {
          return !list;
        },
        // Disable .fire
        // Also disable .add unless we have memory (since it would have no effect)
        // Abort any pending executions
        lock: function () {
          locked = queue = [];
          if (!memory && !firing) {
            list = memory = "";
          }
          return this;
        },
        locked: function () {
          return !!locked;
        },
        // Call all callbacks with the given context and arguments
        fireWith: function (context, args) {
          if (!locked) {
            args = args || [];
            args = [context, args.slice ? args.slice() : args];
            queue.push(args);
            if (!firing) {
              fire();
            }
          }
          return this;
        },
        // Call all the callbacks with the given arguments
        fire: function () {
          self.fireWith(this, arguments);
          return this;
        },
        // To know if the callbacks have already been called at least once
        fired: function () {
          return !!fired;
        }
      };
    return self;
  };
  function Identity(v) {
    return v;
  }
  function Thrower(ex) {
    throw ex;
  }
  function adoptValue(value, resolve, reject, noValue) {
    var method;
    try {
      // Check for promise aspect first to privilege synchronous behavior
      if (value && isFunction(method = value.promise)) {
        method.call(value).done(resolve).fail(reject);

        // Other thenables
      } else if (value && isFunction(method = value.then)) {
        method.call(value, resolve, reject);

        // Other non-thenables
      } else {
        // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
        // * false: [ value ].slice( 0 ) => resolve( value )
        // * true: [ value ].slice( 1 ) => resolve()
        resolve.apply(undefined, [value].slice(noValue));
      }

      // For Promises/A+, convert exceptions into rejections
      // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
      // Deferred#then to conditionally suppress rejection.
    } catch (value) {
      // Support: Android 4.0 only
      // Strict mode functions invoked without .call/.apply get global-object context
      reject.apply(undefined, [value]);
    }
  }
  jQuery.extend({
    Deferred: function (func) {
      var tuples = [
        // action, add listener, callbacks,
        // ... .then handlers, argument index, [final state]
        ["notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2], ["resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected"]],
        state = "pending",
        promise = {
          state: function () {
            return state;
          },
          always: function () {
            deferred.done(arguments).fail(arguments);
            return this;
          },
          "catch": function (fn) {
            return promise.then(null, fn);
          },
          // Keep pipe for back-compat
          pipe: function /* fnDone, fnFail, fnProgress */
          () {
            var fns = arguments;
            return jQuery.Deferred(function (newDefer) {
              jQuery.each(tuples, function (_i, tuple) {
                // Map tuples (progress, done, fail) to arguments (done, fail, progress)
                var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];

                // deferred.progress(function() { bind to newDefer or newDefer.notify })
                // deferred.done(function() { bind to newDefer or newDefer.resolve })
                // deferred.fail(function() { bind to newDefer or newDefer.reject })
                deferred[tuple[1]](function () {
                  var returned = fn && fn.apply(this, arguments);
                  if (returned && isFunction(returned.promise)) {
                    returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
                  } else {
                    newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
                  }
                });
              });
              fns = null;
            }).promise();
          },
          then: function (onFulfilled, onRejected, onProgress) {
            var maxDepth = 0;
            function resolve(depth, deferred, handler, special) {
              return function () {
                var that = this,
                  args = arguments,
                  mightThrow = function () {
                    var returned, then;

                    // Support: Promises/A+ section 2.3.3.3.3
                    // https://promisesaplus.com/#point-59
                    // Ignore double-resolution attempts
                    if (depth < maxDepth) {
                      return;
                    }
                    returned = handler.apply(that, args);

                    // Support: Promises/A+ section 2.3.1
                    // https://promisesaplus.com/#point-48
                    if (returned === deferred.promise()) {
                      throw new TypeError("Thenable self-resolution");
                    }

                    // Support: Promises/A+ sections 2.3.3.1, 3.5
                    // https://promisesaplus.com/#point-54
                    // https://promisesaplus.com/#point-75
                    // Retrieve `then` only once
                    then = returned && (
                    // Support: Promises/A+ section 2.3.4
                    // https://promisesaplus.com/#point-64
                    // Only check objects and functions for thenability
                    typeof returned === "object" || typeof returned === "function") && returned.then;

                    // Handle a returned thenable
                    if (isFunction(then)) {
                      // Special processors (notify) just wait for resolution
                      if (special) {
                        then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));

                        // Normal processors (resolve) also hook into progress
                      } else {
                        // ...and disregard older resolution values
                        maxDepth++;
                        then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
                      }

                      // Handle all other returned values
                    } else {
                      // Only substitute handlers pass on context
                      // and multiple values (non-spec behavior)
                      if (handler !== Identity) {
                        that = undefined;
                        args = [returned];
                      }

                      // Process the value(s)
                      // Default process is resolve
                      (special || deferred.resolveWith)(that, args);
                    }
                  },
                  // Only normal processors (resolve) catch and reject exceptions
                  process = special ? mightThrow : function () {
                    try {
                      mightThrow();
                    } catch (e) {
                      if (jQuery.Deferred.exceptionHook) {
                        jQuery.Deferred.exceptionHook(e, process.error);
                      }

                      // Support: Promises/A+ section 2.3.3.3.4.1
                      // https://promisesaplus.com/#point-61
                      // Ignore post-resolution exceptions
                      if (depth + 1 >= maxDepth) {
                        // Only substitute handlers pass on context
                        // and multiple values (non-spec behavior)
                        if (handler !== Thrower) {
                          that = undefined;
                          args = [e];
                        }
                        deferred.rejectWith(that, args);
                      }
                    }
                  };

                // Support: Promises/A+ section 2.3.3.3.1
                // https://promisesaplus.com/#point-57
                // Re-resolve promises immediately to dodge false rejection from
                // subsequent errors
                if (depth) {
                  process();
                } else {
                  // Call an optional hook to record the error, in case of exception
                  // since it's otherwise lost when execution goes async
                  if (jQuery.Deferred.getErrorHook) {
                    process.error = jQuery.Deferred.getErrorHook();

                    // The deprecated alias of the above. While the name suggests
                    // returning the stack, not an error instance, jQuery just passes
                    // it directly to `console.warn` so both will work; an instance
                    // just better cooperates with source maps.
                  } else if (jQuery.Deferred.getStackHook) {
                    process.error = jQuery.Deferred.getStackHook();
                  }
                  window.setTimeout(process);
                }
              };
            }
            return jQuery.Deferred(function (newDefer) {
              // progress_handlers.add( ... )
              tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));

              // fulfilled_handlers.add( ... )
              tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));

              // rejected_handlers.add( ... )
              tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
            }).promise();
          },
          // Get a promise for this deferred
          // If obj is provided, the promise aspect is added to the object
          promise: function (obj) {
            return obj != null ? jQuery.extend(obj, promise) : promise;
          }
        },
        deferred = {};

      // Add list-specific methods
      jQuery.each(tuples, function (i, tuple) {
        var list = tuple[2],
          stateString = tuple[5];

        // promise.progress = list.add
        // promise.done = list.add
        // promise.fail = list.add
        promise[tuple[1]] = list.add;

        // Handle state
        if (stateString) {
          list.add(function () {
            // state = "resolved" (i.e., fulfilled)
            // state = "rejected"
            state = stateString;
          },
          // rejected_callbacks.disable
          // fulfilled_callbacks.disable
          tuples[3 - i][2].disable,
          // rejected_handlers.disable
          // fulfilled_handlers.disable
          tuples[3 - i][3].disable,
          // progress_callbacks.lock
          tuples[0][2].lock,
          // progress_handlers.lock
          tuples[0][3].lock);
        }

        // progress_handlers.fire
        // fulfilled_handlers.fire
        // rejected_handlers.fire
        list.add(tuple[3].fire);

        // deferred.notify = function() { deferred.notifyWith(...) }
        // deferred.resolve = function() { deferred.resolveWith(...) }
        // deferred.reject = function() { deferred.rejectWith(...) }
        deferred[tuple[0]] = function () {
          deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
          return this;
        };

        // deferred.notifyWith = list.fireWith
        // deferred.resolveWith = list.fireWith
        // deferred.rejectWith = list.fireWith
        deferred[tuple[0] + "With"] = list.fireWith;
      });

      // Make the deferred a promise
      promise.promise(deferred);

      // Call given func if any
      if (func) {
        func.call(deferred, deferred);
      }

      // All done!
      return deferred;
    },
    // Deferred helper
    when: function (singleValue) {
      var
        // count of uncompleted subordinates
        remaining = arguments.length,
        // count of unprocessed arguments
        i = remaining,
        // subordinate fulfillment data
        resolveContexts = Array(i),
        resolveValues = slice.call(arguments),
        // the primary Deferred
        primary = jQuery.Deferred(),
        // subordinate callback factory
        updateFunc = function (i) {
          return function (value) {
            resolveContexts[i] = this;
            resolveValues[i] = arguments.length > 1 ? slice.call(arguments) : value;
            if (! --remaining) {
              primary.resolveWith(resolveContexts, resolveValues);
            }
          };
        };

      // Single- and empty arguments are adopted like Promise.resolve
      if (remaining <= 1) {
        adoptValue(singleValue, primary.done(updateFunc(i)).resolve, primary.reject, !remaining);

        // Use .then() to unwrap secondary thenables (cf. gh-3000)
        if (primary.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
          return primary.then();
        }
      }

      // Multiple arguments are aggregated like Promise.all array elements
      while (i--) {
        adoptValue(resolveValues[i], updateFunc(i), primary.reject);
      }
      return primary.promise();
    }
  });

  // These usually indicate a programmer mistake during development,
  // warn about them ASAP rather than swallowing them by default.
  var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;

  // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
  // captured before the async barrier to get the original error cause
  // which may otherwise be hidden.
  jQuery.Deferred.exceptionHook = function (error, asyncError) {
    // Support: IE 8 - 9 only
    // Console exists when dev tools are open, which can happen at any time
    if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
      window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, asyncError);
    }
  };
  jQuery.readyException = function (error) {
    window.setTimeout(function () {
      throw error;
    });
  };

  // The deferred used on DOM ready
  var readyList = jQuery.Deferred();
  jQuery.fn.ready = function (fn) {
    readyList.then(fn)

    // Wrap jQuery.readyException in a function so that the lookup
    // happens at the time of error handling instead of callback
    // registration.
    .catch(function (error) {
      jQuery.readyException(error);
    });
    return this;
  };
  jQuery.extend({
    // Is the DOM ready to be used? Set to true once it occurs.
    isReady: false,
    // A counter to track how many items to wait for before
    // the ready event fires. See trac-6781
    readyWait: 1,
    // Handle when the DOM is ready
    ready: function (wait) {
      // Abort if there are pending holds or we're already ready
      if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
        return;
      }

      // Remember that the DOM is ready
      jQuery.isReady = true;

      // If a normal DOM Ready event fired, decrement, and wait if need be
      if (wait !== true && --jQuery.readyWait > 0) {
        return;
      }

      // If there are functions bound, to execute
      readyList.resolveWith(document, [jQuery]);
    }
  });
  jQuery.ready.then = readyList.then;

  // The ready event handler and self cleanup method
  function completed() {
    document.removeEventListener("DOMContentLoaded", completed);
    window.removeEventListener("load", completed);
    jQuery.ready();
  }

  // Catch cases where $(document).ready() is called
  // after the browser event has already occurred.
  // Support: IE <=9 - 10 only
  // Older IE sometimes signals "interactive" too soon
  if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
    // Handle it asynchronously to allow scripts the opportunity to delay ready
    window.setTimeout(jQuery.ready);
  } else {
    // Use the handy event callback
    document.addEventListener("DOMContentLoaded", completed);

    // A fallback to window.onload, that will always work
    window.addEventListener("load", completed);
  }

  // Multifunctional method to get and set values of a collection
  // The value/s can optionally be executed if it's a function
  var access = function (elems, fn, key, value, chainable, emptyGet, raw) {
    var i = 0,
      len = elems.length,
      bulk = key == null;

    // Sets many values
    if (toType(key) === "object") {
      chainable = true;
      for (i in key) {
        access(elems, fn, i, key[i], true, emptyGet, raw);
      }

      // Sets one value
    } else if (value !== undefined) {
      chainable = true;
      if (!isFunction(value)) {
        raw = true;
      }
      if (bulk) {
        // Bulk operations run against the entire set
        if (raw) {
          fn.call(elems, value);
          fn = null;

          // ...except when executing function values
        } else {
          bulk = fn;
          fn = function (elem, _key, value) {
            return bulk.call(jQuery(elem), value);
          };
        }
      }
      if (fn) {
        for (; i < len; i++) {
          fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
        }
      }
    }
    if (chainable) {
      return elems;
    }

    // Gets
    if (bulk) {
      return fn.call(elems);
    }
    return len ? fn(elems[0], key) : emptyGet;
  };

  // Matches dashed string for camelizing
  var rmsPrefix = /^-ms-/,
    rdashAlpha = /-([a-z])/g;

  // Used by camelCase as callback to replace()
  function fcamelCase(_all, letter) {
    return letter.toUpperCase();
  }

  // Convert dashed to camelCase; used by the css and data modules
  // Support: IE <=9 - 11, Edge 12 - 15
  // Microsoft forgot to hump their vendor prefix (trac-9572)
  function camelCase(string) {
    return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  }
  var acceptData = function (owner) {
    // Accepts only:
    //  - Node
    //    - Node.ELEMENT_NODE
    //    - Node.DOCUMENT_NODE
    //  - Object
    //    - Any
    return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  };
  function Data() {
    this.expando = jQuery.expando + Data.uid++;
  }
  Data.uid = 1;
  Data.prototype = {
    cache: function (owner) {
      // Check if the owner object already has a cache
      var value = owner[this.expando];

      // If not, create one
      if (!value) {
        value = {};

        // We can accept data for non-element nodes in modern browsers,
        // but we should not, see trac-8335.
        // Always return an empty object.
        if (acceptData(owner)) {
          // If it is a node unlikely to be stringify-ed or looped over
          // use plain assignment
          if (owner.nodeType) {
            owner[this.expando] = value;

            // Otherwise secure it in a non-enumerable property
            // configurable must be true to allow the property to be
            // deleted when data is removed
          } else {
            Object.defineProperty(owner, this.expando, {
              value: value,
              configurable: true
            });
          }
        }
      }
      return value;
    },
    set: function (owner, data, value) {
      var prop,
        cache = this.cache(owner);

      // Handle: [ owner, key, value ] args
      // Always use camelCase key (gh-2257)
      if (typeof data === "string") {
        cache[camelCase(data)] = value;

        // Handle: [ owner, { properties } ] args
      } else {
        // Copy the properties one-by-one to the cache object
        for (prop in data) {
          cache[camelCase(prop)] = data[prop];
        }
      }
      return cache;
    },
    get: function (owner, key) {
      return key === undefined ? this.cache(owner) :
      // Always use camelCase key (gh-2257)
      owner[this.expando] && owner[this.expando][camelCase(key)];
    },
    access: function (owner, key, value) {
      // In cases where either:
      //
      //   1. No key was specified
      //   2. A string key was specified, but no value provided
      //
      // Take the "read" path and allow the get method to determine
      // which value to return, respectively either:
      //
      //   1. The entire cache object
      //   2. The data stored at the key
      //
      if (key === undefined || key && typeof key === "string" && value === undefined) {
        return this.get(owner, key);
      }

      // When the key is not a string, or both a key and value
      // are specified, set or extend (existing objects) with either:
      //
      //   1. An object of properties
      //   2. A key and value
      //
      this.set(owner, key, value);

      // Since the "set" path can have two possible entry points
      // return the expected data based on which path was taken[*]
      return value !== undefined ? value : key;
    },
    remove: function (owner, key) {
      var i,
        cache = owner[this.expando];
      if (cache === undefined) {
        return;
      }
      if (key !== undefined) {
        // Support array or space separated string of keys
        if (Array.isArray(key)) {
          // If key is an array of keys...
          // We always set camelCase keys, so remove that.
          key = key.map(camelCase);
        } else {
          key = camelCase(key);

          // If a key with the spaces exists, use it.
          // Otherwise, create an array by matching non-whitespace
          key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
        }
        i = key.length;
        while (i--) {
          delete cache[key[i]];
        }
      }

      // Remove the expando if there's no more data
      if (key === undefined || jQuery.isEmptyObject(cache)) {
        // Support: Chrome <=35 - 45
        // Webkit & Blink performance suffers when deleting properties
        // from DOM nodes, so set to undefined instead
        // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
        if (owner.nodeType) {
          owner[this.expando] = undefined;
        } else {
          delete owner[this.expando];
        }
      }
    },
    hasData: function (owner) {
      var cache = owner[this.expando];
      return cache !== undefined && !jQuery.isEmptyObject(cache);
    }
  };
  var dataPriv = new Data();
  var dataUser = new Data();

  //	Implementation Summary
  //
  //	1. Enforce API surface and semantic compatibility with 1.9.x branch
  //	2. Improve the module's maintainability by reducing the storage
  //		paths to a single mechanism.
  //	3. Use the same single mechanism to support "private" and "user" data.
  //	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  //	5. Avoid exposing implementation details on user objects (eg. expando properties)
  //	6. Provide a clear path for implementation upgrade to WeakMap in 2014

  var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
    rmultiDash = /[A-Z]/g;
  function getData(data) {
    if (data === "true") {
      return true;
    }
    if (data === "false") {
      return false;
    }
    if (data === "null") {
      return null;
    }

    // Only convert to a number if it doesn't change the string
    if (data === +data + "") {
      return +data;
    }
    if (rbrace.test(data)) {
      return JSON.parse(data);
    }
    return data;
  }
  function dataAttr(elem, key, data) {
    var name;

    // If nothing was found internally, try to fetch any
    // data from the HTML5 data-* attribute
    if (data === undefined && elem.nodeType === 1) {
      name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
      data = elem.getAttribute(name);
      if (typeof data === "string") {
        try {
          data = getData(data);
        } catch (e) {}

        // Make sure we set the data so it isn't changed later
        dataUser.set(elem, key, data);
      } else {
        data = undefined;
      }
    }
    return data;
  }
  jQuery.extend({
    hasData: function (elem) {
      return dataUser.hasData(elem) || dataPriv.hasData(elem);
    },
    data: function (elem, name, data) {
      return dataUser.access(elem, name, data);
    },
    removeData: function (elem, name) {
      dataUser.remove(elem, name);
    },
    // TODO: Now that all calls to _data and _removeData have been replaced
    // with direct calls to dataPriv methods, these can be deprecated.
    _data: function (elem, name, data) {
      return dataPriv.access(elem, name, data);
    },
    _removeData: function (elem, name) {
      dataPriv.remove(elem, name);
    }
  });
  jQuery.fn.extend({
    data: function (key, value) {
      var i,
        name,
        data,
        elem = this[0],
        attrs = elem && elem.attributes;

      // Gets all values
      if (key === undefined) {
        if (this.length) {
          data = dataUser.get(elem);
          if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
            i = attrs.length;
            while (i--) {
              // Support: IE 11 only
              // The attrs elements can be null (trac-14894)
              if (attrs[i]) {
                name = attrs[i].name;
                if (name.indexOf("data-") === 0) {
                  name = camelCase(name.slice(5));
                  dataAttr(elem, name, data[name]);
                }
              }
            }
            dataPriv.set(elem, "hasDataAttrs", true);
          }
        }
        return data;
      }

      // Sets multiple values
      if (typeof key === "object") {
        return this.each(function () {
          dataUser.set(this, key);
        });
      }
      return access(this, function (value) {
        var data;

        // The calling jQuery object (element matches) is not empty
        // (and therefore has an element appears at this[ 0 ]) and the
        // `value` parameter was not undefined. An empty jQuery object
        // will result in `undefined` for elem = this[ 0 ] which will
        // throw an exception if an attempt to read a data cache is made.
        if (elem && value === undefined) {
          // Attempt to get data from the cache
          // The key will always be camelCased in Data
          data = dataUser.get(elem, key);
          if (data !== undefined) {
            return data;
          }

          // Attempt to "discover" the data in
          // HTML5 custom data-* attrs
          data = dataAttr(elem, key);
          if (data !== undefined) {
            return data;
          }

          // We tried really hard, but the data doesn't exist.
          return;
        }

        // Set the data...
        this.each(function () {
          // We always store the camelCased key
          dataUser.set(this, key, value);
        });
      }, null, value, arguments.length > 1, null, true);
    },
    removeData: function (key) {
      return this.each(function () {
        dataUser.remove(this, key);
      });
    }
  });
  jQuery.extend({
    queue: function (elem, type, data) {
      var queue;
      if (elem) {
        type = (type || "fx") + "queue";
        queue = dataPriv.get(elem, type);

        // Speed up dequeue by getting out quickly if this is just a lookup
        if (data) {
          if (!queue || Array.isArray(data)) {
            queue = dataPriv.access(elem, type, jQuery.makeArray(data));
          } else {
            queue.push(data);
          }
        }
        return queue || [];
      }
    },
    dequeue: function (elem, type) {
      type = type || "fx";
      var queue = jQuery.queue(elem, type),
        startLength = queue.length,
        fn = queue.shift(),
        hooks = jQuery._queueHooks(elem, type),
        next = function () {
          jQuery.dequeue(elem, type);
        };

      // If the fx queue is dequeued, always remove the progress sentinel
      if (fn === "inprogress") {
        fn = queue.shift();
        startLength--;
      }
      if (fn) {
        // Add a progress sentinel to prevent the fx queue from being
        // automatically dequeued
        if (type === "fx") {
          queue.unshift("inprogress");
        }

        // Clear up the last queue stop function
        delete hooks.stop;
        fn.call(elem, next, hooks);
      }
      if (!startLength && hooks) {
        hooks.empty.fire();
      }
    },
    // Not public - generate a queueHooks object, or return the current one
    _queueHooks: function (elem, type) {
      var key = type + "queueHooks";
      return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
        empty: jQuery.Callbacks("once memory").add(function () {
          dataPriv.remove(elem, [type + "queue", key]);
        })
      });
    }
  });
  jQuery.fn.extend({
    queue: function (type, data) {
      var setter = 2;
      if (typeof type !== "string") {
        data = type;
        type = "fx";
        setter--;
      }
      if (arguments.length < setter) {
        return jQuery.queue(this[0], type);
      }
      return data === undefined ? this : this.each(function () {
        var queue = jQuery.queue(this, type, data);

        // Ensure a hooks for this queue
        jQuery._queueHooks(this, type);
        if (type === "fx" && queue[0] !== "inprogress") {
          jQuery.dequeue(this, type);
        }
      });
    },
    dequeue: function (type) {
      return this.each(function () {
        jQuery.dequeue(this, type);
      });
    },
    clearQueue: function (type) {
      return this.queue(type || "fx", []);
    },
    // Get a promise resolved when queues of a certain type
    // are emptied (fx is the type by default)
    promise: function (type, obj) {
      var tmp,
        count = 1,
        defer = jQuery.Deferred(),
        elements = this,
        i = this.length,
        resolve = function () {
          if (! --count) {
            defer.resolveWith(elements, [elements]);
          }
        };
      if (typeof type !== "string") {
        obj = type;
        type = undefined;
      }
      type = type || "fx";
      while (i--) {
        tmp = dataPriv.get(elements[i], type + "queueHooks");
        if (tmp && tmp.empty) {
          count++;
          tmp.empty.add(resolve);
        }
      }
      resolve();
      return defer.promise(obj);
    }
  });
  var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  var cssExpand = ["Top", "Right", "Bottom", "Left"];
  var documentElement = document.documentElement;
  var isAttached = function (elem) {
      return jQuery.contains(elem.ownerDocument, elem);
    },
    composed = {
      composed: true
    };

  // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  // Check attachment across shadow DOM boundaries when possible (gh-3504)
  // Support: iOS 10.0-10.2 only
  // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  // leading to errors. We need to check for `getRootNode`.
  if (documentElement.getRootNode) {
    isAttached = function (elem) {
      return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument;
    };
  }
  var isHiddenWithinTree = function (elem, el) {
    // isHiddenWithinTree might be called from jQuery#filter function;
    // in that case, element will be second argument
    elem = el || elem;

    // Inline style trumps all
    return elem.style.display === "none" || elem.style.display === "" &&
    // Otherwise, check computed style
    // Support: Firefox <=43 - 45
    // Disconnected elements can have computed display: none, so first confirm that elem is
    // in the document.
    isAttached(elem) && jQuery.css(elem, "display") === "none";
  };
  function adjustCSS(elem, prop, valueParts, tween) {
    var adjusted,
      scale,
      maxIterations = 20,
      currentValue = tween ? function () {
        return tween.cur();
      } : function () {
        return jQuery.css(elem, prop, "");
      },
      initial = currentValue(),
      unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
      // Starting value computation is required for potential unit mismatches
      initialInUnit = elem.nodeType && (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
    if (initialInUnit && initialInUnit[3] !== unit) {
      // Support: Firefox <=54
      // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
      initial = initial / 2;

      // Trust units reported by jQuery.css
      unit = unit || initialInUnit[3];

      // Iteratively approximate from a nonzero starting point
      initialInUnit = +initial || 1;
      while (maxIterations--) {
        // Evaluate and update our best guess (doubling guesses that zero out).
        // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
        jQuery.style(elem, prop, initialInUnit + unit);
        if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
          maxIterations = 0;
        }
        initialInUnit = initialInUnit / scale;
      }
      initialInUnit = initialInUnit * 2;
      jQuery.style(elem, prop, initialInUnit + unit);

      // Make sure we update the tween properties later on
      valueParts = valueParts || [];
    }
    if (valueParts) {
      initialInUnit = +initialInUnit || +initial || 0;

      // Apply relative offset (+=/-=) if specified
      adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
      if (tween) {
        tween.unit = unit;
        tween.start = initialInUnit;
        tween.end = adjusted;
      }
    }
    return adjusted;
  }
  var defaultDisplayMap = {};
  function getDefaultDisplay(elem) {
    var temp,
      doc = elem.ownerDocument,
      nodeName = elem.nodeName,
      display = defaultDisplayMap[nodeName];
    if (display) {
      return display;
    }
    temp = doc.body.appendChild(doc.createElement(nodeName));
    display = jQuery.css(temp, "display");
    temp.parentNode.removeChild(temp);
    if (display === "none") {
      display = "block";
    }
    defaultDisplayMap[nodeName] = display;
    return display;
  }
  function showHide(elements, show) {
    var display,
      elem,
      values = [],
      index = 0,
      length = elements.length;

    // Determine new display value for elements that need to change
    for (; index < length; index++) {
      elem = elements[index];
      if (!elem.style) {
        continue;
      }
      display = elem.style.display;
      if (show) {
        // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
        // check is required in this first loop unless we have a nonempty display value (either
        // inline or about-to-be-restored)
        if (display === "none") {
          values[index] = dataPriv.get(elem, "display") || null;
          if (!values[index]) {
            elem.style.display = "";
          }
        }
        if (elem.style.display === "" && isHiddenWithinTree(elem)) {
          values[index] = getDefaultDisplay(elem);
        }
      } else {
        if (display !== "none") {
          values[index] = "none";

          // Remember what we're overwriting
          dataPriv.set(elem, "display", display);
        }
      }
    }

    // Set the display of the elements in a second loop to avoid constant reflow
    for (index = 0; index < length; index++) {
      if (values[index] != null) {
        elements[index].style.display = values[index];
      }
    }
    return elements;
  }
  jQuery.fn.extend({
    show: function () {
      return showHide(this, true);
    },
    hide: function () {
      return showHide(this);
    },
    toggle: function (state) {
      if (typeof state === "boolean") {
        return state ? this.show() : this.hide();
      }
      return this.each(function () {
        if (isHiddenWithinTree(this)) {
          jQuery(this).show();
        } else {
          jQuery(this).hide();
        }
      });
    }
  });
  var rcheckableType = /^(?:checkbox|radio)$/i;
  var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i;
  var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  (function () {
    var fragment = document.createDocumentFragment(),
      div = fragment.appendChild(document.createElement("div")),
      input = document.createElement("input");

    // Support: Android 4.0 - 4.3 only
    // Check state lost if the name is set (trac-11217)
    // Support: Windows Web Apps (WWA)
    // `name` and `type` must use .setAttribute for WWA (trac-14901)
    input.setAttribute("type", "radio");
    input.setAttribute("checked", "checked");
    input.setAttribute("name", "t");
    div.appendChild(input);

    // Support: Android <=4.1 only
    // Older WebKit doesn't clone checked state correctly in fragments
    support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;

    // Support: IE <=11 only
    // Make sure textarea (and checkbox) defaultValue is properly cloned
    div.innerHTML = "<textarea>x</textarea>";
    support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;

    // Support: IE <=9 only
    // IE <=9 replaces <option> tags with their contents when inserted outside of
    // the select element.
    div.innerHTML = "<option></option>";
    support.option = !!div.lastChild;
  })();

  // We have to close these tags to support XHTML (trac-13200)
  var wrapMap = {
    // XHTML parsers do not magically insert elements in the
    // same way that tag soup parsers do. So we cannot shorten
    // this by omitting <tbody> or other required elements.
    thead: [1, "<table>", "</table>"],
    col: [2, "<table><colgroup>", "</colgroup></table>"],
    tr: [2, "<table><tbody>", "</tbody></table>"],
    td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
    _default: [0, "", ""]
  };
  wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  wrapMap.th = wrapMap.td;

  // Support: IE <=9 only
  if (!support.option) {
    wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"];
  }
  function getAll(context, tag) {
    // Support: IE <=9 - 11 only
    // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
    var ret;
    if (typeof context.getElementsByTagName !== "undefined") {
      ret = context.getElementsByTagName(tag || "*");
    } else if (typeof context.querySelectorAll !== "undefined") {
      ret = context.querySelectorAll(tag || "*");
    } else {
      ret = [];
    }
    if (tag === undefined || tag && nodeName(context, tag)) {
      return jQuery.merge([context], ret);
    }
    return ret;
  }

  // Mark scripts as having already been evaluated
  function setGlobalEval(elems, refElements) {
    var i = 0,
      l = elems.length;
    for (; i < l; i++) {
      dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
    }
  }
  var rhtml = /<|&#?\w+;/;
  function buildFragment(elems, context, scripts, selection, ignored) {
    var elem,
      tmp,
      tag,
      wrap,
      attached,
      j,
      fragment = context.createDocumentFragment(),
      nodes = [],
      i = 0,
      l = elems.length;
    for (; i < l; i++) {
      elem = elems[i];
      if (elem || elem === 0) {
        // Add nodes directly
        if (toType(elem) === "object") {
          // Support: Android <=4.0 only, PhantomJS 1 only
          // push.apply(_, arraylike) throws on ancient WebKit
          jQuery.merge(nodes, elem.nodeType ? [elem] : elem);

          // Convert non-html into a text node
        } else if (!rhtml.test(elem)) {
          nodes.push(context.createTextNode(elem));

          // Convert html into DOM nodes
        } else {
          tmp = tmp || fragment.appendChild(context.createElement("div"));

          // Deserialize a standard representation
          tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
          wrap = wrapMap[tag] || wrapMap._default;
          tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];

          // Descend through wrappers to the right content
          j = wrap[0];
          while (j--) {
            tmp = tmp.lastChild;
          }

          // Support: Android <=4.0 only, PhantomJS 1 only
          // push.apply(_, arraylike) throws on ancient WebKit
          jQuery.merge(nodes, tmp.childNodes);

          // Remember the top-level container
          tmp = fragment.firstChild;

          // Ensure the created nodes are orphaned (trac-12392)
          tmp.textContent = "";
        }
      }
    }

    // Remove wrapper from fragment
    fragment.textContent = "";
    i = 0;
    while (elem = nodes[i++]) {
      // Skip elements already in the context collection (trac-4087)
      if (selection && jQuery.inArray(elem, selection) > -1) {
        if (ignored) {
          ignored.push(elem);
        }
        continue;
      }
      attached = isAttached(elem);

      // Append to fragment
      tmp = getAll(fragment.appendChild(elem), "script");

      // Preserve script evaluation history
      if (attached) {
        setGlobalEval(tmp);
      }

      // Capture executables
      if (scripts) {
        j = 0;
        while (elem = tmp[j++]) {
          if (rscriptType.test(elem.type || "")) {
            scripts.push(elem);
          }
        }
      }
    }
    return fragment;
  }
  var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  function returnTrue() {
    return true;
  }
  function returnFalse() {
    return false;
  }
  function on(elem, types, selector, data, fn, one) {
    var origFn, type;

    // Types can be a map of types/handlers
    if (typeof types === "object") {
      // ( types-Object, selector, data )
      if (typeof selector !== "string") {
        // ( types-Object, data )
        data = data || selector;
        selector = undefined;
      }
      for (type in types) {
        on(elem, type, selector, data, types[type], one);
      }
      return elem;
    }
    if (data == null && fn == null) {
      // ( types, fn )
      fn = selector;
      data = selector = undefined;
    } else if (fn == null) {
      if (typeof selector === "string") {
        // ( types, selector, fn )
        fn = data;
        data = undefined;
      } else {
        // ( types, data, fn )
        fn = data;
        data = selector;
        selector = undefined;
      }
    }
    if (fn === false) {
      fn = returnFalse;
    } else if (!fn) {
      return elem;
    }
    if (one === 1) {
      origFn = fn;
      fn = function (event) {
        // Can use an empty set, since event contains the info
        jQuery().off(event);
        return origFn.apply(this, arguments);
      };

      // Use same guid so caller can remove using origFn
      fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
    }
    return elem.each(function () {
      jQuery.event.add(this, types, fn, data, selector);
    });
  }

  /*
   * Helper functions for managing events -- not part of the public interface.
   * Props to Dean Edwards' addEvent library for many of the ideas.
   */
  jQuery.event = {
    global: {},
    add: function (elem, types, handler, data, selector) {
      var handleObjIn,
        eventHandle,
        tmp,
        events,
        t,
        handleObj,
        special,
        handlers,
        type,
        namespaces,
        origType,
        elemData = dataPriv.get(elem);

      // Only attach events to objects that accept data
      if (!acceptData(elem)) {
        return;
      }

      // Caller can pass in an object of custom data in lieu of the handler
      if (handler.handler) {
        handleObjIn = handler;
        handler = handleObjIn.handler;
        selector = handleObjIn.selector;
      }

      // Ensure that invalid selectors throw exceptions at attach time
      // Evaluate against documentElement in case elem is a non-element node (e.g., document)
      if (selector) {
        jQuery.find.matchesSelector(documentElement, selector);
      }

      // Make sure that the handler has a unique ID, used to find/remove it later
      if (!handler.guid) {
        handler.guid = jQuery.guid++;
      }

      // Init the element's event structure and main handler, if this is the first
      if (!(events = elemData.events)) {
        events = elemData.events = Object.create(null);
      }
      if (!(eventHandle = elemData.handle)) {
        eventHandle = elemData.handle = function (e) {
          // Discard the second event of a jQuery.event.trigger() and
          // when an event is called after a page has unloaded
          return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
        };
      }

      // Handle multiple events separated by a space
      types = (types || "").match(rnothtmlwhite) || [""];
      t = types.length;
      while (t--) {
        tmp = rtypenamespace.exec(types[t]) || [];
        type = origType = tmp[1];
        namespaces = (tmp[2] || "").split(".").sort();

        // There *must* be a type, no attaching namespace-only handlers
        if (!type) {
          continue;
        }

        // If event changes its type, use the special event handlers for the changed type
        special = jQuery.event.special[type] || {};

        // If selector defined, determine special event api type, otherwise given type
        type = (selector ? special.delegateType : special.bindType) || type;

        // Update special based on newly reset type
        special = jQuery.event.special[type] || {};

        // handleObj is passed to all event handlers
        handleObj = jQuery.extend({
          type: type,
          origType: origType,
          data: data,
          handler: handler,
          guid: handler.guid,
          selector: selector,
          needsContext: selector && jQuery.expr.match.needsContext.test(selector),
          namespace: namespaces.join(".")
        }, handleObjIn);

        // Init the event handler queue if we're the first
        if (!(handlers = events[type])) {
          handlers = events[type] = [];
          handlers.delegateCount = 0;

          // Only use addEventListener if the special events handler returns false
          if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
            if (elem.addEventListener) {
              elem.addEventListener(type, eventHandle);
            }
          }
        }
        if (special.add) {
          special.add.call(elem, handleObj);
          if (!handleObj.handler.guid) {
            handleObj.handler.guid = handler.guid;
          }
        }

        // Add to the element's handler list, delegates in front
        if (selector) {
          handlers.splice(handlers.delegateCount++, 0, handleObj);
        } else {
          handlers.push(handleObj);
        }

        // Keep track of which events have ever been used, for event optimization
        jQuery.event.global[type] = true;
      }
    },
    // Detach an event or set of events from an element
    remove: function (elem, types, handler, selector, mappedTypes) {
      var j,
        origCount,
        tmp,
        events,
        t,
        handleObj,
        special,
        handlers,
        type,
        namespaces,
        origType,
        elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
      if (!elemData || !(events = elemData.events)) {
        return;
      }

      // Once for each type.namespace in types; type may be omitted
      types = (types || "").match(rnothtmlwhite) || [""];
      t = types.length;
      while (t--) {
        tmp = rtypenamespace.exec(types[t]) || [];
        type = origType = tmp[1];
        namespaces = (tmp[2] || "").split(".").sort();

        // Unbind all events (on this namespace, if provided) for the element
        if (!type) {
          for (type in events) {
            jQuery.event.remove(elem, type + types[t], handler, selector, true);
          }
          continue;
        }
        special = jQuery.event.special[type] || {};
        type = (selector ? special.delegateType : special.bindType) || type;
        handlers = events[type] || [];
        tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");

        // Remove matching events
        origCount = j = handlers.length;
        while (j--) {
          handleObj = handlers[j];
          if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
            handlers.splice(j, 1);
            if (handleObj.selector) {
              handlers.delegateCount--;
            }
            if (special.remove) {
              special.remove.call(elem, handleObj);
            }
          }
        }

        // Remove generic event handler if we removed something and no more handlers exist
        // (avoids potential for endless recursion during removal of special event handlers)
        if (origCount && !handlers.length) {
          if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
            jQuery.removeEvent(elem, type, elemData.handle);
          }
          delete events[type];
        }
      }

      // Remove data and the expando if it's no longer used
      if (jQuery.isEmptyObject(events)) {
        dataPriv.remove(elem, "handle events");
      }
    },
    dispatch: function (nativeEvent) {
      var i,
        j,
        ret,
        matched,
        handleObj,
        handlerQueue,
        args = new Array(arguments.length),
        // Make a writable jQuery.Event from the native event object
        event = jQuery.event.fix(nativeEvent),
        handlers = (dataPriv.get(this, "events") || Object.create(null))[event.type] || [],
        special = jQuery.event.special[event.type] || {};

      // Use the fix-ed jQuery.Event rather than the (read-only) native event
      args[0] = event;
      for (i = 1; i < arguments.length; i++) {
        args[i] = arguments[i];
      }
      event.delegateTarget = this;

      // Call the preDispatch hook for the mapped type, and let it bail if desired
      if (special.preDispatch && special.preDispatch.call(this, event) === false) {
        return;
      }

      // Determine handlers
      handlerQueue = jQuery.event.handlers.call(this, event, handlers);

      // Run delegates first; they may want to stop propagation beneath us
      i = 0;
      while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
        event.currentTarget = matched.elem;
        j = 0;
        while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
          // If the event is namespaced, then each handler is only invoked if it is
          // specially universal or its namespaces are a superset of the event's.
          if (!event.rnamespace || handleObj.namespace === false || event.rnamespace.test(handleObj.namespace)) {
            event.handleObj = handleObj;
            event.data = handleObj.data;
            ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
            if (ret !== undefined) {
              if ((event.result = ret) === false) {
                event.preventDefault();
                event.stopPropagation();
              }
            }
          }
        }
      }

      // Call the postDispatch hook for the mapped type
      if (special.postDispatch) {
        special.postDispatch.call(this, event);
      }
      return event.result;
    },
    handlers: function (event, handlers) {
      var i,
        handleObj,
        sel,
        matchedHandlers,
        matchedSelectors,
        handlerQueue = [],
        delegateCount = handlers.delegateCount,
        cur = event.target;

      // Find delegate handlers
      if (delegateCount &&
      // Support: IE <=9
      // Black-hole SVG <use> instance trees (trac-13180)
      cur.nodeType &&
      // Support: Firefox <=42
      // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
      // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
      // Support: IE 11 only
      // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
      !(event.type === "click" && event.button >= 1)) {
        for (; cur !== this; cur = cur.parentNode || this) {
          // Don't check non-elements (trac-13208)
          // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)
          if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
            matchedHandlers = [];
            matchedSelectors = {};
            for (i = 0; i < delegateCount; i++) {
              handleObj = handlers[i];

              // Don't conflict with Object.prototype properties (trac-13203)
              sel = handleObj.selector + " ";
              if (matchedSelectors[sel] === undefined) {
                matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
              }
              if (matchedSelectors[sel]) {
                matchedHandlers.push(handleObj);
              }
            }
            if (matchedHandlers.length) {
              handlerQueue.push({
                elem: cur,
                handlers: matchedHandlers
              });
            }
          }
        }
      }

      // Add the remaining (directly-bound) handlers
      cur = this;
      if (delegateCount < handlers.length) {
        handlerQueue.push({
          elem: cur,
          handlers: handlers.slice(delegateCount)
        });
      }
      return handlerQueue;
    },
    addProp: function (name, hook) {
      Object.defineProperty(jQuery.Event.prototype, name, {
        enumerable: true,
        configurable: true,
        get: isFunction(hook) ? function () {
          if (this.originalEvent) {
            return hook(this.originalEvent);
          }
        } : function () {
          if (this.originalEvent) {
            return this.originalEvent[name];
          }
        },
        set: function (value) {
          Object.defineProperty(this, name, {
            enumerable: true,
            configurable: true,
            writable: true,
            value: value
          });
        }
      });
    },
    fix: function (originalEvent) {
      return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
    },
    special: {
      load: {
        // Prevent triggered image.load events from bubbling to window.load
        noBubble: true
      },
      click: {
        // Utilize native event to ensure correct state for checkable inputs
        setup: function (data) {
          // For mutual compressibility with _default, replace `this` access with a local var.
          // `|| data` is dead code meant only to preserve the variable through minification.
          var el = this || data;

          // Claim the first handler
          if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
            // dataPriv.set( el, "click", ... )
            leverageNative(el, "click", true);
          }

          // Return false to allow normal processing in the caller
          return false;
        },
        trigger: function (data) {
          // For mutual compressibility with _default, replace `this` access with a local var.
          // `|| data` is dead code meant only to preserve the variable through minification.
          var el = this || data;

          // Force setup before triggering a click
          if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
            leverageNative(el, "click");
          }

          // Return non-false to allow normal event-path propagation
          return true;
        },
        // For cross-browser consistency, suppress native .click() on links
        // Also prevent it if we're currently inside a leveraged native-event stack
        _default: function (event) {
          var target = event.target;
          return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a");
        }
      },
      beforeunload: {
        postDispatch: function (event) {
          // Support: Firefox 20+
          // Firefox doesn't alert if the returnValue field is not set.
          if (event.result !== undefined && event.originalEvent) {
            event.originalEvent.returnValue = event.result;
          }
        }
      }
    }
  };

  // Ensure the presence of an event listener that handles manually-triggered
  // synthetic events by interrupting progress until reinvoked in response to
  // *native* events that it fires directly, ensuring that state changes have
  // already occurred before other listeners are invoked.
  function leverageNative(el, type, isSetup) {
    // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
    if (!isSetup) {
      if (dataPriv.get(el, type) === undefined) {
        jQuery.event.add(el, type, returnTrue);
      }
      return;
    }

    // Register the controller as a special universal handler for all event namespaces
    dataPriv.set(el, type, false);
    jQuery.event.add(el, type, {
      namespace: false,
      handler: function (event) {
        var result,
          saved = dataPriv.get(this, type);
        if (event.isTrigger & 1 && this[type]) {
          // Interrupt processing of the outer synthetic .trigger()ed event
          if (!saved) {
            // Store arguments for use when handling the inner native event
            // There will always be at least one argument (an event object), so this array
            // will not be confused with a leftover capture object.
            saved = slice.call(arguments);
            dataPriv.set(this, type, saved);

            // Trigger the native event and capture its result
            this[type]();
            result = dataPriv.get(this, type);
            dataPriv.set(this, type, false);
            if (saved !== result) {
              // Cancel the outer synthetic event
              event.stopImmediatePropagation();
              event.preventDefault();
              return result;
            }

            // If this is an inner synthetic event for an event with a bubbling surrogate
            // (focus or blur), assume that the surrogate already propagated from triggering
            // the native event and prevent that from happening again here.
            // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
            // bubbling surrogate propagates *after* the non-bubbling base), but that seems
            // less bad than duplication.
          } else if ((jQuery.event.special[type] || {}).delegateType) {
            event.stopPropagation();
          }

          // If this is a native event triggered above, everything is now in order
          // Fire an inner synthetic event with the original arguments
        } else if (saved) {
          // ...and capture the result
          dataPriv.set(this, type, jQuery.event.trigger(saved[0], saved.slice(1), this));

          // Abort handling of the native event by all jQuery handlers while allowing
          // native handlers on the same element to run. On target, this is achieved
          // by stopping immediate propagation just on the jQuery event. However,
          // the native event is re-wrapped by a jQuery one on each level of the
          // propagation so the only way to stop it for jQuery is to stop it for
          // everyone via native `stopPropagation()`. This is not a problem for
          // focus/blur which don't bubble, but it does also stop click on checkboxes
          // and radios. We accept this limitation.
          event.stopPropagation();
          event.isImmediatePropagationStopped = returnTrue;
        }
      }
    });
  }
  jQuery.removeEvent = function (elem, type, handle) {
    // This "if" is needed for plain objects
    if (elem.removeEventListener) {
      elem.removeEventListener(type, handle);
    }
  };
  jQuery.Event = function (src, props) {
    // Allow instantiation without the 'new' keyword
    if (!(this instanceof jQuery.Event)) {
      return new jQuery.Event(src, props);
    }

    // Event object
    if (src && src.type) {
      this.originalEvent = src;
      this.type = src.type;

      // Events bubbling up the document may have been marked as prevented
      // by a handler lower down the tree; reflect the correct value.
      this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
      // Support: Android <=2.3 only
      src.returnValue === false ? returnTrue : returnFalse;

      // Create target properties
      // Support: Safari <=6 - 7 only
      // Target should not be a text node (trac-504, trac-13143)
      this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
      this.currentTarget = src.currentTarget;
      this.relatedTarget = src.relatedTarget;

      // Event type
    } else {
      this.type = src;
    }

    // Put explicitly provided properties onto the event object
    if (props) {
      jQuery.extend(this, props);
    }

    // Create a timestamp if incoming event doesn't have one
    this.timeStamp = src && src.timeStamp || Date.now();

    // Mark it as fixed
    this[jQuery.expando] = true;
  };

  // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  jQuery.Event.prototype = {
    constructor: jQuery.Event,
    isDefaultPrevented: returnFalse,
    isPropagationStopped: returnFalse,
    isImmediatePropagationStopped: returnFalse,
    isSimulated: false,
    preventDefault: function () {
      var e = this.originalEvent;
      this.isDefaultPrevented = returnTrue;
      if (e && !this.isSimulated) {
        e.preventDefault();
      }
    },
    stopPropagation: function () {
      var e = this.originalEvent;
      this.isPropagationStopped = returnTrue;
      if (e && !this.isSimulated) {
        e.stopPropagation();
      }
    },
    stopImmediatePropagation: function () {
      var e = this.originalEvent;
      this.isImmediatePropagationStopped = returnTrue;
      if (e && !this.isSimulated) {
        e.stopImmediatePropagation();
      }
      this.stopPropagation();
    }
  };

  // Includes all common event props including KeyEvent and MouseEvent specific props
  jQuery.each({
    altKey: true,
    bubbles: true,
    cancelable: true,
    changedTouches: true,
    ctrlKey: true,
    detail: true,
    eventPhase: true,
    metaKey: true,
    pageX: true,
    pageY: true,
    shiftKey: true,
    view: true,
    "char": true,
    code: true,
    charCode: true,
    key: true,
    keyCode: true,
    button: true,
    buttons: true,
    clientX: true,
    clientY: true,
    offsetX: true,
    offsetY: true,
    pointerId: true,
    pointerType: true,
    screenX: true,
    screenY: true,
    targetTouches: true,
    toElement: true,
    touches: true,
    which: true
  }, jQuery.event.addProp);
  jQuery.each({
    focus: "focusin",
    blur: "focusout"
  }, function (type, delegateType) {
    function focusMappedHandler(nativeEvent) {
      if (document.documentMode) {
        // Support: IE 11+
        // Attach a single focusin/focusout handler on the document while someone wants
        // focus/blur. This is because the former are synchronous in IE while the latter
        // are async. In other browsers, all those handlers are invoked synchronously.

        // `handle` from private data would already wrap the event, but we need
        // to change the `type` here.
        var handle = dataPriv.get(this, "handle"),
          event = jQuery.event.fix(nativeEvent);
        event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
        event.isSimulated = true;

        // First, handle focusin/focusout
        handle(nativeEvent);

        // ...then, handle focus/blur
        //
        // focus/blur don't bubble while focusin/focusout do; simulate the former by only
        // invoking the handler at the lower level.
        if (event.target === event.currentTarget) {
          // The setup part calls `leverageNative`, which, in turn, calls
          // `jQuery.event.add`, so event handle will already have been set
          // by this point.
          handle(event);
        }
      } else {
        // For non-IE browsers, attach a single capturing handler on the document
        // while someone wants focusin/focusout.
        jQuery.event.simulate(delegateType, nativeEvent.target, jQuery.event.fix(nativeEvent));
      }
    }
    jQuery.event.special[type] = {
      // Utilize native event if possible so blur/focus sequence is correct
      setup: function () {
        var attaches;

        // Claim the first handler
        // dataPriv.set( this, "focus", ... )
        // dataPriv.set( this, "blur", ... )
        leverageNative(this, type, true);
        if (document.documentMode) {
          // Support: IE 9 - 11+
          // We use the same native handler for focusin & focus (and focusout & blur)
          // so we need to coordinate setup & teardown parts between those events.
          // Use `delegateType` as the key as `type` is already used by `leverageNative`.
          attaches = dataPriv.get(this, delegateType);
          if (!attaches) {
            this.addEventListener(delegateType, focusMappedHandler);
          }
          dataPriv.set(this, delegateType, (attaches || 0) + 1);
        } else {
          // Return false to allow normal processing in the caller
          return false;
        }
      },
      trigger: function () {
        // Force setup before trigger
        leverageNative(this, type);

        // Return non-false to allow normal event-path propagation
        return true;
      },
      teardown: function () {
        var attaches;
        if (document.documentMode) {
          attaches = dataPriv.get(this, delegateType) - 1;
          if (!attaches) {
            this.removeEventListener(delegateType, focusMappedHandler);
            dataPriv.remove(this, delegateType);
          } else {
            dataPriv.set(this, delegateType, attaches);
          }
        } else {
          // Return false to indicate standard teardown should be applied
          return false;
        }
      },
      // Suppress native focus or blur if we're currently inside
      // a leveraged native-event stack
      _default: function (event) {
        return dataPriv.get(event.target, type);
      },
      delegateType: delegateType
    };

    // Support: Firefox <=44
    // Firefox doesn't have focus(in | out) events
    // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
    //
    // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
    // focus(in | out) events fire after focus & blur events,
    // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
    // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
    //
    // Support: IE 9 - 11+
    // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
    // attach a single handler for both events in IE.
    jQuery.event.special[delegateType] = {
      setup: function () {
        // Handle: regular nodes (via `this.ownerDocument`), window
        // (via `this.document`) & document (via `this`).
        var doc = this.ownerDocument || this.document || this,
          dataHolder = document.documentMode ? this : doc,
          attaches = dataPriv.get(dataHolder, delegateType);

        // Support: IE 9 - 11+
        // We use the same native handler for focusin & focus (and focusout & blur)
        // so we need to coordinate setup & teardown parts between those events.
        // Use `delegateType` as the key as `type` is already used by `leverageNative`.
        if (!attaches) {
          if (document.documentMode) {
            this.addEventListener(delegateType, focusMappedHandler);
          } else {
            doc.addEventListener(type, focusMappedHandler, true);
          }
        }
        dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1);
      },
      teardown: function () {
        var doc = this.ownerDocument || this.document || this,
          dataHolder = document.documentMode ? this : doc,
          attaches = dataPriv.get(dataHolder, delegateType) - 1;
        if (!attaches) {
          if (document.documentMode) {
            this.removeEventListener(delegateType, focusMappedHandler);
          } else {
            doc.removeEventListener(type, focusMappedHandler, true);
          }
          dataPriv.remove(dataHolder, delegateType);
        } else {
          dataPriv.set(dataHolder, delegateType, attaches);
        }
      }
    };
  });

  // Create mouseenter/leave events using mouseover/out and event-time checks
  // so that event delegation works in jQuery.
  // Do the same for pointerenter/pointerleave and pointerover/pointerout
  //
  // Support: Safari 7 only
  // Safari sends mouseenter too often; see:
  // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  // for the description of the bug (it existed in older Chrome versions as well).
  jQuery.each({
    mouseenter: "mouseover",
    mouseleave: "mouseout",
    pointerenter: "pointerover",
    pointerleave: "pointerout"
  }, function (orig, fix) {
    jQuery.event.special[orig] = {
      delegateType: fix,
      bindType: fix,
      handle: function (event) {
        var ret,
          target = this,
          related = event.relatedTarget,
          handleObj = event.handleObj;

        // For mouseenter/leave call the handler if related is outside the target.
        // NB: No relatedTarget if the mouse left/entered the browser window
        if (!related || related !== target && !jQuery.contains(target, related)) {
          event.type = handleObj.origType;
          ret = handleObj.handler.apply(this, arguments);
          event.type = fix;
        }
        return ret;
      }
    };
  });
  jQuery.fn.extend({
    on: function (types, selector, data, fn) {
      return on(this, types, selector, data, fn);
    },
    one: function (types, selector, data, fn) {
      return on(this, types, selector, data, fn, 1);
    },
    off: function (types, selector, fn) {
      var handleObj, type;
      if (types && types.preventDefault && types.handleObj) {
        // ( event )  dispatched jQuery.Event
        handleObj = types.handleObj;
        jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
        return this;
      }
      if (typeof types === "object") {
        // ( types-object [, selector] )
        for (type in types) {
          this.off(type, selector, types[type]);
        }
        return this;
      }
      if (selector === false || typeof selector === "function") {
        // ( types [, fn] )
        fn = selector;
        selector = undefined;
      }
      if (fn === false) {
        fn = returnFalse;
      }
      return this.each(function () {
        jQuery.event.remove(this, types, fn, selector);
      });
    }
  });
  var
    // Support: IE <=10 - 11, Edge 12 - 13 only
    // In IE/Edge using regex groups here causes severe slowdowns.
    // See https://connect.microsoft.com/IE/feedback/details/1736512/
    rnoInnerhtml = /<script|<style|<link/i,
    // checked="checked" or checked
    rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
    rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;

  // Prefer a tbody over its parent table for containing new rows
  function manipulationTarget(elem, content) {
    if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
      return jQuery(elem).children("tbody")[0] || elem;
    }
    return elem;
  }

  // Replace/restore the type attribute of script elements for safe DOM manipulation
  function disableScript(elem) {
    elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
    return elem;
  }
  function restoreScript(elem) {
    if ((elem.type || "").slice(0, 5) === "true/") {
      elem.type = elem.type.slice(5);
    } else {
      elem.removeAttribute("type");
    }
    return elem;
  }
  function cloneCopyEvent(src, dest) {
    var i, l, type, pdataOld, udataOld, udataCur, events;
    if (dest.nodeType !== 1) {
      return;
    }

    // 1. Copy private data: events, handlers, etc.
    if (dataPriv.hasData(src)) {
      pdataOld = dataPriv.get(src);
      events = pdataOld.events;
      if (events) {
        dataPriv.remove(dest, "handle events");
        for (type in events) {
          for (i = 0, l = events[type].length; i < l; i++) {
            jQuery.event.add(dest, type, events[type][i]);
          }
        }
      }
    }

    // 2. Copy user data
    if (dataUser.hasData(src)) {
      udataOld = dataUser.access(src);
      udataCur = jQuery.extend({}, udataOld);
      dataUser.set(dest, udataCur);
    }
  }

  // Fix IE bugs, see support tests
  function fixInput(src, dest) {
    var nodeName = dest.nodeName.toLowerCase();

    // Fails to persist the checked state of a cloned checkbox or radio button.
    if (nodeName === "input" && rcheckableType.test(src.type)) {
      dest.checked = src.checked;

      // Fails to return the selected option to the default selected state when cloning options
    } else if (nodeName === "input" || nodeName === "textarea") {
      dest.defaultValue = src.defaultValue;
    }
  }
  function domManip(collection, args, callback, ignored) {
    // Flatten any nested arrays
    args = flat(args);
    var fragment,
      first,
      scripts,
      hasScripts,
      node,
      doc,
      i = 0,
      l = collection.length,
      iNoClone = l - 1,
      value = args[0],
      valueIsFunction = isFunction(value);

    // We can't cloneNode fragments that contain checked, in WebKit
    if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
      return collection.each(function (index) {
        var self = collection.eq(index);
        if (valueIsFunction) {
          args[0] = value.call(this, index, self.html());
        }
        domManip(self, args, callback, ignored);
      });
    }
    if (l) {
      fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
      first = fragment.firstChild;
      if (fragment.childNodes.length === 1) {
        fragment = first;
      }

      // Require either new content or an interest in ignored elements to invoke the callback
      if (first || ignored) {
        scripts = jQuery.map(getAll(fragment, "script"), disableScript);
        hasScripts = scripts.length;

        // Use the original fragment for the last item
        // instead of the first because it can end up
        // being emptied incorrectly in certain situations (trac-8070).
        for (; i < l; i++) {
          node = fragment;
          if (i !== iNoClone) {
            node = jQuery.clone(node, true, true);

            // Keep references to cloned scripts for later restoration
            if (hasScripts) {
              // Support: Android <=4.0 only, PhantomJS 1 only
              // push.apply(_, arraylike) throws on ancient WebKit
              jQuery.merge(scripts, getAll(node, "script"));
            }
          }
          callback.call(collection[i], node, i);
        }
        if (hasScripts) {
          doc = scripts[scripts.length - 1].ownerDocument;

          // Re-enable scripts
          jQuery.map(scripts, restoreScript);

          // Evaluate executable scripts on first document insertion
          for (i = 0; i < hasScripts; i++) {
            node = scripts[i];
            if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
              if (node.src && (node.type || "").toLowerCase() !== "module") {
                // Optional AJAX dependency, but won't run scripts if not present
                if (jQuery._evalUrl && !node.noModule) {
                  jQuery._evalUrl(node.src, {
                    nonce: node.nonce || node.getAttribute("nonce")
                  }, doc);
                }
              } else {
                // Unwrap a CDATA section containing script contents. This shouldn't be
                // needed as in XML documents they're already not visible when
                // inspecting element contents and in HTML documents they have no
                // meaning but we're preserving that logic for backwards compatibility.
                // This will be removed completely in 4.0. See gh-4904.
                DOMEval(node.textContent.replace(rcleanScript, ""), node, doc);
              }
            }
          }
        }
      }
    }
    return collection;
  }
  function remove(elem, selector, keepData) {
    var node,
      nodes = selector ? jQuery.filter(selector, elem) : elem,
      i = 0;
    for (; (node = nodes[i]) != null; i++) {
      if (!keepData && node.nodeType === 1) {
        jQuery.cleanData(getAll(node));
      }
      if (node.parentNode) {
        if (keepData && isAttached(node)) {
          setGlobalEval(getAll(node, "script"));
        }
        node.parentNode.removeChild(node);
      }
    }
    return elem;
  }
  jQuery.extend({
    htmlPrefilter: function (html) {
      return html;
    },
    clone: function (elem, dataAndEvents, deepDataAndEvents) {
      var i,
        l,
        srcElements,
        destElements,
        clone = elem.cloneNode(true),
        inPage = isAttached(elem);

      // Fix IE cloning issues
      if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
        // We eschew jQuery#find here for performance reasons:
        // https://jsperf.com/getall-vs-sizzle/2
        destElements = getAll(clone);
        srcElements = getAll(elem);
        for (i = 0, l = srcElements.length; i < l; i++) {
          fixInput(srcElements[i], destElements[i]);
        }
      }

      // Copy the events from the original to the clone
      if (dataAndEvents) {
        if (deepDataAndEvents) {
          srcElements = srcElements || getAll(elem);
          destElements = destElements || getAll(clone);
          for (i = 0, l = srcElements.length; i < l; i++) {
            cloneCopyEvent(srcElements[i], destElements[i]);
          }
        } else {
          cloneCopyEvent(elem, clone);
        }
      }

      // Preserve script evaluation history
      destElements = getAll(clone, "script");
      if (destElements.length > 0) {
        setGlobalEval(destElements, !inPage && getAll(elem, "script"));
      }

      // Return the cloned set
      return clone;
    },
    cleanData: function (elems) {
      var data,
        elem,
        type,
        special = jQuery.event.special,
        i = 0;
      for (; (elem = elems[i]) !== undefined; i++) {
        if (acceptData(elem)) {
          if (data = elem[dataPriv.expando]) {
            if (data.events) {
              for (type in data.events) {
                if (special[type]) {
                  jQuery.event.remove(elem, type);

                  // This is a shortcut to avoid jQuery.event.remove's overhead
                } else {
                  jQuery.removeEvent(elem, type, data.handle);
                }
              }
            }

            // Support: Chrome <=35 - 45+
            // Assign undefined instead of using delete, see Data#remove
            elem[dataPriv.expando] = undefined;
          }
          if (elem[dataUser.expando]) {
            // Support: Chrome <=35 - 45+
            // Assign undefined instead of using delete, see Data#remove
            elem[dataUser.expando] = undefined;
          }
        }
      }
    }
  });
  jQuery.fn.extend({
    detach: function (selector) {
      return remove(this, selector, true);
    },
    remove: function (selector) {
      return remove(this, selector);
    },
    text: function (value) {
      return access(this, function (value) {
        return value === undefined ? jQuery.text(this) : this.empty().each(function () {
          if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
            this.textContent = value;
          }
        });
      }, null, value, arguments.length);
    },
    append: function () {
      return domManip(this, arguments, function (elem) {
        if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
          var target = manipulationTarget(this, elem);
          target.appendChild(elem);
        }
      });
    },
    prepend: function () {
      return domManip(this, arguments, function (elem) {
        if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
          var target = manipulationTarget(this, elem);
          target.insertBefore(elem, target.firstChild);
        }
      });
    },
    before: function () {
      return domManip(this, arguments, function (elem) {
        if (this.parentNode) {
          this.parentNode.insertBefore(elem, this);
        }
      });
    },
    after: function () {
      return domManip(this, arguments, function (elem) {
        if (this.parentNode) {
          this.parentNode.insertBefore(elem, this.nextSibling);
        }
      });
    },
    empty: function () {
      var elem,
        i = 0;
      for (; (elem = this[i]) != null; i++) {
        if (elem.nodeType === 1) {
          // Prevent memory leaks
          jQuery.cleanData(getAll(elem, false));

          // Remove any remaining nodes
          elem.textContent = "";
        }
      }
      return this;
    },
    clone: function (dataAndEvents, deepDataAndEvents) {
      dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
      deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
      return this.map(function () {
        return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
      });
    },
    html: function (value) {
      return access(this, function (value) {
        var elem = this[0] || {},
          i = 0,
          l = this.length;
        if (value === undefined && elem.nodeType === 1) {
          return elem.innerHTML;
        }

        // See if we can take a shortcut and just use innerHTML
        if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
          value = jQuery.htmlPrefilter(value);
          try {
            for (; i < l; i++) {
              elem = this[i] || {};

              // Remove element nodes and prevent memory leaks
              if (elem.nodeType === 1) {
                jQuery.cleanData(getAll(elem, false));
                elem.innerHTML = value;
              }
            }
            elem = 0;

            // If using innerHTML throws an exception, use the fallback method
          } catch (e) {}
        }
        if (elem) {
          this.empty().append(value);
        }
      }, null, value, arguments.length);
    },
    replaceWith: function () {
      var ignored = [];

      // Make the changes, replacing each non-ignored context element with the new content
      return domManip(this, arguments, function (elem) {
        var parent = this.parentNode;
        if (jQuery.inArray(this, ignored) < 0) {
          jQuery.cleanData(getAll(this));
          if (parent) {
            parent.replaceChild(elem, this);
          }
        }

        // Force callback invocation
      }, ignored);
    }
  });
  jQuery.each({
    appendTo: "append",
    prependTo: "prepend",
    insertBefore: "before",
    insertAfter: "after",
    replaceAll: "replaceWith"
  }, function (name, original) {
    jQuery.fn[name] = function (selector) {
      var elems,
        ret = [],
        insert = jQuery(selector),
        last = insert.length - 1,
        i = 0;
      for (; i <= last; i++) {
        elems = i === last ? this : this.clone(true);
        jQuery(insert[i])[original](elems);

        // Support: Android <=4.0 only, PhantomJS 1 only
        // .get() because push.apply(_, arraylike) throws on ancient WebKit
        push.apply(ret, elems.get());
      }
      return this.pushStack(ret);
    };
  });
  var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  var rcustomProp = /^--/;
  var getStyles = function (elem) {
    // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)
    // IE throws on elements created in popups
    // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
    var view = elem.ownerDocument.defaultView;
    if (!view || !view.opener) {
      view = window;
    }
    return view.getComputedStyle(elem);
  };
  var swap = function (elem, options, callback) {
    var ret,
      name,
      old = {};

    // Remember the old values, and insert the new ones
    for (name in options) {
      old[name] = elem.style[name];
      elem.style[name] = options[name];
    }
    ret = callback.call(elem);

    // Revert the old values
    for (name in options) {
      elem.style[name] = old[name];
    }
    return ret;
  };
  var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  (function () {
    // Executing both pixelPosition & boxSizingReliable tests require only one layout
    // so they're executed at the same time to save the second computation.
    function computeStyleTests() {
      // This is a singleton, we need to execute it only once
      if (!div) {
        return;
      }
      container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
      div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
      documentElement.appendChild(container).appendChild(div);
      var divStyle = window.getComputedStyle(div);
      pixelPositionVal = divStyle.top !== "1%";

      // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
      reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;

      // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
      // Some styles come back with percentage values, even though they shouldn't
      div.style.right = "60%";
      pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;

      // Support: IE 9 - 11 only
      // Detect misreporting of content dimensions for box-sizing:border-box elements
      boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;

      // Support: IE 9 only
      // Detect overflow:scroll screwiness (gh-3699)
      // Support: Chrome <=64
      // Don't get tricked when zoom affects offsetWidth (gh-4029)
      div.style.position = "absolute";
      scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;
      documentElement.removeChild(container);

      // Nullify the div so it wouldn't be stored in the memory and
      // it will also be a sign that checks already performed
      div = null;
    }
    function roundPixelMeasures(measure) {
      return Math.round(parseFloat(measure));
    }
    var pixelPositionVal,
      boxSizingReliableVal,
      scrollboxSizeVal,
      pixelBoxStylesVal,
      reliableTrDimensionsVal,
      reliableMarginLeftVal,
      container = document.createElement("div"),
      div = document.createElement("div");

    // Finish early in limited (non-browser) environments
    if (!div.style) {
      return;
    }

    // Support: IE <=9 - 11 only
    // Style of cloned element affects source element cloned (trac-8908)
    div.style.backgroundClip = "content-box";
    div.cloneNode(true).style.backgroundClip = "";
    support.clearCloneStyle = div.style.backgroundClip === "content-box";
    jQuery.extend(support, {
      boxSizingReliable: function () {
        computeStyleTests();
        return boxSizingReliableVal;
      },
      pixelBoxStyles: function () {
        computeStyleTests();
        return pixelBoxStylesVal;
      },
      pixelPosition: function () {
        computeStyleTests();
        return pixelPositionVal;
      },
      reliableMarginLeft: function () {
        computeStyleTests();
        return reliableMarginLeftVal;
      },
      scrollboxSize: function () {
        computeStyleTests();
        return scrollboxSizeVal;
      },
      // Support: IE 9 - 11+, Edge 15 - 18+
      // IE/Edge misreport `getComputedStyle` of table rows with width/height
      // set in CSS while `offset*` properties report correct values.
      // Behavior in IE 9 is more subtle than in newer versions & it passes
      // some versions of this test; make sure not to make it pass there!
      //
      // Support: Firefox 70+
      // Only Firefox includes border widths
      // in computed dimensions. (gh-4529)
      reliableTrDimensions: function () {
        var table, tr, trChild, trStyle;
        if (reliableTrDimensionsVal == null) {
          table = document.createElement("table");
          tr = document.createElement("tr");
          trChild = document.createElement("div");
          table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
          tr.style.cssText = "box-sizing:content-box;border:1px solid";

          // Support: Chrome 86+
          // Height set through cssText does not get applied.
          // Computed height then comes back as 0.
          tr.style.height = "1px";
          trChild.style.height = "9px";

          // Support: Android 8 Chrome 86+
          // In our bodyBackground.html iframe,
          // display for all div elements is set to "inline",
          // which causes a problem only in Android 8 Chrome 86.
          // Ensuring the div is `display: block`
          // gets around this issue.
          trChild.style.display = "block";
          documentElement.appendChild(table).appendChild(tr).appendChild(trChild);
          trStyle = window.getComputedStyle(tr);
          reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight;
          documentElement.removeChild(table);
        }
        return reliableTrDimensionsVal;
      }
    });
  })();
  function curCSS(elem, name, computed) {
    var width,
      minWidth,
      maxWidth,
      ret,
      isCustomProp = rcustomProp.test(name),
      // Support: Firefox 51+
      // Retrieving style before computed somehow
      // fixes an issue with getting wrong values
      // on detached elements
      style = elem.style;
    computed = computed || getStyles(elem);

    // getPropertyValue is needed for:
    //   .css('filter') (IE 9 only, trac-12537)
    //   .css('--customProperty) (gh-3144)
    if (computed) {
      // Support: IE <=9 - 11+
      // IE only supports `"float"` in `getPropertyValue`; in computed styles
      // it's only available as `"cssFloat"`. We no longer modify properties
      // sent to `.css()` apart from camelCasing, so we need to check both.
      // Normally, this would create difference in behavior: if
      // `getPropertyValue` returns an empty string, the value returned
      // by `.css()` would be `undefined`. This is usually the case for
      // disconnected elements. However, in IE even disconnected elements
      // with no styles return `"none"` for `getPropertyValue( "float" )`
      ret = computed.getPropertyValue(name) || computed[name];
      if (isCustomProp && ret) {
        // Support: Firefox 105+, Chrome <=105+
        // Spec requires trimming whitespace for custom properties (gh-4926).
        // Firefox only trims leading whitespace. Chrome just collapses
        // both leading & trailing whitespace to a single space.
        //
        // Fall back to `undefined` if empty string returned.
        // This collapses a missing definition with property defined
        // and set to an empty string but there's no standard API
        // allowing us to differentiate them without a performance penalty
        // and returning `undefined` aligns with older jQuery.
        //
        // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
        // as whitespace while CSS does not, but this is not a problem
        // because CSS preprocessing replaces them with U+000A LINE FEED
        // (which *is* CSS whitespace)
        // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
        ret = ret.replace(rtrimCSS, "$1") || undefined;
      }
      if (ret === "" && !isAttached(elem)) {
        ret = jQuery.style(elem, name);
      }

      // A tribute to the "awesome hack by Dean Edwards"
      // Android Browser returns percentage for some values,
      // but width seems to be reliably pixels.
      // This is against the CSSOM draft spec:
      // https://drafts.csswg.org/cssom/#resolved-values
      if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
        // Remember the original values
        width = style.width;
        minWidth = style.minWidth;
        maxWidth = style.maxWidth;

        // Put in the new values to get a computed value out
        style.minWidth = style.maxWidth = style.width = ret;
        ret = computed.width;

        // Revert the changed values
        style.width = width;
        style.minWidth = minWidth;
        style.maxWidth = maxWidth;
      }
    }
    return ret !== undefined ?
    // Support: IE <=9 - 11 only
    // IE returns zIndex value as an integer.
    ret + "" : ret;
  }
  function addGetHookIf(conditionFn, hookFn) {
    // Define the hook, we'll check on the first run if it's really needed.
    return {
      get: function () {
        if (conditionFn()) {
          // Hook not needed (or it's not possible to use it due
          // to missing dependency), remove it.
          delete this.get;
          return;
        }

        // Hook needed; redefine it so that the support test is not executed again.
        return (this.get = hookFn).apply(this, arguments);
      }
    };
  }
  var cssPrefixes = ["Webkit", "Moz", "ms"],
    emptyStyle = document.createElement("div").style,
    vendorProps = {};

  // Return a vendor-prefixed property or undefined
  function vendorPropName(name) {
    // Check for vendor prefixed names
    var capName = name[0].toUpperCase() + name.slice(1),
      i = cssPrefixes.length;
    while (i--) {
      name = cssPrefixes[i] + capName;
      if (name in emptyStyle) {
        return name;
      }
    }
  }

  // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  function finalPropName(name) {
    var final = jQuery.cssProps[name] || vendorProps[name];
    if (final) {
      return final;
    }
    if (name in emptyStyle) {
      return name;
    }
    return vendorProps[name] = vendorPropName(name) || name;
  }
  var
    // Swappable if display is none or starts with table
    // except "table", "table-cell", or "table-caption"
    // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
    rdisplayswap = /^(none|table(?!-c[ea]).+)/,
    cssShow = {
      position: "absolute",
      visibility: "hidden",
      display: "block"
    },
    cssNormalTransform = {
      letterSpacing: "0",
      fontWeight: "400"
    };
  function setPositiveNumber(_elem, value, subtract) {
    // Any relative (+/-) values have already been
    // normalized at this point
    var matches = rcssNum.exec(value);
    return matches ?
    // Guard against undefined "subtract", e.g., when used as in cssHooks
    Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  }
  function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
    var i = dimension === "width" ? 1 : 0,
      extra = 0,
      delta = 0,
      marginDelta = 0;

    // Adjustment may not be necessary
    if (box === (isBorderBox ? "border" : "content")) {
      return 0;
    }
    for (; i < 4; i += 2) {
      // Both box models exclude margin
      // Count margin delta separately to only add it after scroll gutter adjustment.
      // This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
      if (box === "margin") {
        marginDelta += jQuery.css(elem, box + cssExpand[i], true, styles);
      }

      // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
      if (!isBorderBox) {
        // Add padding
        delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);

        // For "border" or "margin", add border
        if (box !== "padding") {
          delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);

          // But still keep track of it otherwise
        } else {
          extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
        }

        // If we get here with a border-box (content + padding + border), we're seeking "content" or
        // "padding" or "margin"
      } else {
        // For "content", subtract padding
        if (box === "content") {
          delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
        }

        // For "content" or "padding", subtract border
        if (box !== "margin") {
          delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
        }
      }
    }

    // Account for positive content-box scroll gutter when requested by providing computedVal
    if (!isBorderBox && computedVal >= 0) {
      // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
      // Assuming integer scroll gutter, subtract the rest and round down
      delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5

      // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
      // Use an explicit zero to avoid NaN (gh-3964)
      )) || 0;
    }
    return delta + marginDelta;
  }
  function getWidthOrHeight(elem, dimension, extra) {
    // Start with computed style
    var styles = getStyles(elem),
      // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
      // Fake content-box until we know it's needed to know the true value.
      boxSizingNeeded = !support.boxSizingReliable() || extra,
      isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box",
      valueIsBorderBox = isBorderBox,
      val = curCSS(elem, dimension, styles),
      offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1);

    // Support: Firefox <=54
    // Return a confounding non-pixel value or feign ignorance, as appropriate.
    if (rnumnonpx.test(val)) {
      if (!extra) {
        return val;
      }
      val = "auto";
    }

    // Support: IE 9 - 11 only
    // Use offsetWidth/offsetHeight for when box sizing is unreliable.
    // In those cases, the computed value can be trusted to be border-box.
    if ((!support.boxSizingReliable() && isBorderBox ||
    // Support: IE 10 - 11+, Edge 15 - 18+
    // IE/Edge misreport `getComputedStyle` of table rows with width/height
    // set in CSS while `offset*` properties report correct values.
    // Interestingly, in some cases IE 9 doesn't suffer from this issue.
    !support.reliableTrDimensions() && nodeName(elem, "tr") ||
    // Fall back to offsetWidth/offsetHeight when value is "auto"
    // This happens for inline elements with no explicit setting (gh-3571)
    val === "auto" ||
    // Support: Android <=4.1 - 4.3 only
    // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
    !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") &&
    // Make sure the element is visible & connected
    elem.getClientRects().length) {
      isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box";

      // Where available, offsetWidth/offsetHeight approximate border box dimensions.
      // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
      // retrieved value as a content box dimension.
      valueIsBorderBox = offsetProp in elem;
      if (valueIsBorderBox) {
        val = elem[offsetProp];
      }
    }

    // Normalize "" and auto
    val = parseFloat(val) || 0;

    // Adjust for the element's box model
    return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
    // Provide the current computed size to request scroll gutter calculation (gh-3589)
    val) + "px";
  }
  jQuery.extend({
    // Add in style property hooks for overriding the default
    // behavior of getting and setting a style property
    cssHooks: {
      opacity: {
        get: function (elem, computed) {
          if (computed) {
            // We should always get a number back from opacity
            var ret = curCSS(elem, "opacity");
            return ret === "" ? "1" : ret;
          }
        }
      }
    },
    // Don't automatically add "px" to these possibly-unitless properties
    cssNumber: {
      animationIterationCount: true,
      aspectRatio: true,
      borderImageSlice: true,
      columnCount: true,
      flexGrow: true,
      flexShrink: true,
      fontWeight: true,
      gridArea: true,
      gridColumn: true,
      gridColumnEnd: true,
      gridColumnStart: true,
      gridRow: true,
      gridRowEnd: true,
      gridRowStart: true,
      lineHeight: true,
      opacity: true,
      order: true,
      orphans: true,
      scale: true,
      widows: true,
      zIndex: true,
      zoom: true,
      // SVG-related
      fillOpacity: true,
      floodOpacity: true,
      stopOpacity: true,
      strokeMiterlimit: true,
      strokeOpacity: true
    },
    // Add in properties whose names you wish to fix before
    // setting or getting the value
    cssProps: {},
    // Get and set the style property on a DOM Node
    style: function (elem, name, value, extra) {
      // Don't set styles on text and comment nodes
      if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
        return;
      }

      // Make sure that we're working with the right name
      var ret,
        type,
        hooks,
        origName = camelCase(name),
        isCustomProp = rcustomProp.test(name),
        style = elem.style;

      // Make sure that we're working with the right name. We don't
      // want to query the value if it is a CSS custom property
      // since they are user-defined.
      if (!isCustomProp) {
        name = finalPropName(origName);
      }

      // Gets hook for the prefixed version, then unprefixed version
      hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];

      // Check if we're setting a value
      if (value !== undefined) {
        type = typeof value;

        // Convert "+=" or "-=" to relative numbers (trac-7345)
        if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
          value = adjustCSS(elem, name, ret);

          // Fixes bug trac-9237
          type = "number";
        }

        // Make sure that null and NaN values aren't set (trac-7116)
        if (value == null || value !== value) {
          return;
        }

        // If a number was passed in, add the unit (except for certain CSS properties)
        // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
        // "px" to a few hardcoded values.
        if (type === "number" && !isCustomProp) {
          value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
        }

        // background-* props affect original clone's values
        if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
          style[name] = "inherit";
        }

        // If a hook was provided, use that value, otherwise just set the specified value
        if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
          if (isCustomProp) {
            style.setProperty(name, value);
          } else {
            style[name] = value;
          }
        }
      } else {
        // If a hook was provided get the non-computed value from there
        if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
          return ret;
        }

        // Otherwise just get the value from the style object
        return style[name];
      }
    },
    css: function (elem, name, extra, styles) {
      var val,
        num,
        hooks,
        origName = camelCase(name),
        isCustomProp = rcustomProp.test(name);

      // Make sure that we're working with the right name. We don't
      // want to modify the value if it is a CSS custom property
      // since they are user-defined.
      if (!isCustomProp) {
        name = finalPropName(origName);
      }

      // Try prefixed name followed by the unprefixed name
      hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];

      // If a hook was provided get the computed value from there
      if (hooks && "get" in hooks) {
        val = hooks.get(elem, true, extra);
      }

      // Otherwise, if a way to get the computed value exists, use that
      if (val === undefined) {
        val = curCSS(elem, name, styles);
      }

      // Convert "normal" to computed value
      if (val === "normal" && name in cssNormalTransform) {
        val = cssNormalTransform[name];
      }

      // Make numeric if forced or a qualifier was provided and val looks numeric
      if (extra === "" || extra) {
        num = parseFloat(val);
        return extra === true || isFinite(num) ? num || 0 : val;
      }
      return val;
    }
  });
  jQuery.each(["height", "width"], function (_i, dimension) {
    jQuery.cssHooks[dimension] = {
      get: function (elem, computed, extra) {
        if (computed) {
          // Certain elements can have dimension info if we invisibly show them
          // but it must have a current display style that would benefit
          return rdisplayswap.test(jQuery.css(elem, "display")) && (
          // Support: Safari 8+
          // Table columns in Safari have non-zero offsetWidth & zero
          // getBoundingClientRect().width unless display is changed.
          // Support: IE <=11 only
          // Running getBoundingClientRect on a disconnected node
          // in IE throws an error.
          !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
            return getWidthOrHeight(elem, dimension, extra);
          }) : getWidthOrHeight(elem, dimension, extra);
        }
      },
      set: function (elem, value, extra) {
        var matches,
          styles = getStyles(elem),
          // Only read styles.position if the test has a chance to fail
          // to avoid forcing a reflow.
          scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === "absolute",
          // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
          boxSizingNeeded = scrollboxSizeBuggy || extra,
          isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box",
          subtract = extra ? boxModelAdjustment(elem, dimension, extra, isBorderBox, styles) : 0;

        // Account for unreliable border-box dimensions by comparing offset* to computed and
        // faking a content-box to get border and padding (gh-3699)
        if (isBorderBox && scrollboxSizeBuggy) {
          subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
        }

        // Convert to pixels if value adjustment is needed
        if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
          elem.style[dimension] = value;
          value = jQuery.css(elem, dimension);
        }
        return setPositiveNumber(elem, value, subtract);
      }
    };
  });
  jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
    if (computed) {
      return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, {
        marginLeft: 0
      }, function () {
        return elem.getBoundingClientRect().left;
      })) + "px";
    }
  });

  // These hooks are used by animate to expand properties
  jQuery.each({
    margin: "",
    padding: "",
    border: "Width"
  }, function (prefix, suffix) {
    jQuery.cssHooks[prefix + suffix] = {
      expand: function (value) {
        var i = 0,
          expanded = {},
          // Assumes a single number if not a string
          parts = typeof value === "string" ? value.split(" ") : [value];
        for (; i < 4; i++) {
          expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
        }
        return expanded;
      }
    };
    if (prefix !== "margin") {
      jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
    }
  });
  jQuery.fn.extend({
    css: function (name, value) {
      return access(this, function (elem, name, value) {
        var styles,
          len,
          map = {},
          i = 0;
        if (Array.isArray(name)) {
          styles = getStyles(elem);
          len = name.length;
          for (; i < len; i++) {
            map[name[i]] = jQuery.css(elem, name[i], false, styles);
          }
          return map;
        }
        return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
      }, name, value, arguments.length > 1);
    }
  });
  function Tween(elem, options, prop, end, easing) {
    return new Tween.prototype.init(elem, options, prop, end, easing);
  }
  jQuery.Tween = Tween;
  Tween.prototype = {
    constructor: Tween,
    init: function (elem, options, prop, end, easing, unit) {
      this.elem = elem;
      this.prop = prop;
      this.easing = easing || jQuery.easing._default;
      this.options = options;
      this.start = this.now = this.cur();
      this.end = end;
      this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
    },
    cur: function () {
      var hooks = Tween.propHooks[this.prop];
      return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
    },
    run: function (percent) {
      var eased,
        hooks = Tween.propHooks[this.prop];
      if (this.options.duration) {
        this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
      } else {
        this.pos = eased = percent;
      }
      this.now = (this.end - this.start) * eased + this.start;
      if (this.options.step) {
        this.options.step.call(this.elem, this.now, this);
      }
      if (hooks && hooks.set) {
        hooks.set(this);
      } else {
        Tween.propHooks._default.set(this);
      }
      return this;
    }
  };
  Tween.prototype.init.prototype = Tween.prototype;
  Tween.propHooks = {
    _default: {
      get: function (tween) {
        var result;

        // Use a property on the element directly when it is not a DOM element,
        // or when there is no matching style property that exists.
        if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
          return tween.elem[tween.prop];
        }

        // Passing an empty string as a 3rd parameter to .css will automatically
        // attempt a parseFloat and fallback to a string if the parse fails.
        // Simple values such as "10px" are parsed to Float;
        // complex values such as "rotate(1rad)" are returned as-is.
        result = jQuery.css(tween.elem, tween.prop, "");

        // Empty strings, null, undefined and "auto" are converted to 0.
        return !result || result === "auto" ? 0 : result;
      },
      set: function (tween) {
        // Use step hook for back compat.
        // Use cssHook if its there.
        // Use .style if available and use plain properties where available.
        if (jQuery.fx.step[tween.prop]) {
          jQuery.fx.step[tween.prop](tween);
        } else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) {
          jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
        } else {
          tween.elem[tween.prop] = tween.now;
        }
      }
    }
  };

  // Support: IE <=9 only
  // Panic based approach to setting things on disconnected nodes
  Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
    set: function (tween) {
      if (tween.elem.nodeType && tween.elem.parentNode) {
        tween.elem[tween.prop] = tween.now;
      }
    }
  };
  jQuery.easing = {
    linear: function (p) {
      return p;
    },
    swing: function (p) {
      return 0.5 - Math.cos(p * Math.PI) / 2;
    },
    _default: "swing"
  };
  jQuery.fx = Tween.prototype.init;

  // Back compat <1.8 extension point
  jQuery.fx.step = {};
  var fxNow,
    inProgress,
    rfxtypes = /^(?:toggle|show|hide)$/,
    rrun = /queueHooks$/;
  function schedule() {
    if (inProgress) {
      if (document.hidden === false && window.requestAnimationFrame) {
        window.requestAnimationFrame(schedule);
      } else {
        window.setTimeout(schedule, jQuery.fx.interval);
      }
      jQuery.fx.tick();
    }
  }

  // Animations created synchronously will run synchronously
  function createFxNow() {
    window.setTimeout(function () {
      fxNow = undefined;
    });
    return fxNow = Date.now();
  }

  // Generate parameters to create a standard animation
  function genFx(type, includeWidth) {
    var which,
      i = 0,
      attrs = {
        height: type
      };

    // If we include width, step value is 1 to do all cssExpand values,
    // otherwise step value is 2 to skip over Left and Right
    includeWidth = includeWidth ? 1 : 0;
    for (; i < 4; i += 2 - includeWidth) {
      which = cssExpand[i];
      attrs["margin" + which] = attrs["padding" + which] = type;
    }
    if (includeWidth) {
      attrs.opacity = attrs.width = type;
    }
    return attrs;
  }
  function createTween(value, prop, animation) {
    var tween,
      collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
      index = 0,
      length = collection.length;
    for (; index < length; index++) {
      if (tween = collection[index].call(animation, prop, value)) {
        // We're done with this property
        return tween;
      }
    }
  }
  function defaultPrefilter(elem, props, opts) {
    var prop,
      value,
      toggle,
      hooks,
      oldfire,
      propTween,
      restoreDisplay,
      display,
      isBox = "width" in props || "height" in props,
      anim = this,
      orig = {},
      style = elem.style,
      hidden = elem.nodeType && isHiddenWithinTree(elem),
      dataShow = dataPriv.get(elem, "fxshow");

    // Queue-skipping animations hijack the fx hooks
    if (!opts.queue) {
      hooks = jQuery._queueHooks(elem, "fx");
      if (hooks.unqueued == null) {
        hooks.unqueued = 0;
        oldfire = hooks.empty.fire;
        hooks.empty.fire = function () {
          if (!hooks.unqueued) {
            oldfire();
          }
        };
      }
      hooks.unqueued++;
      anim.always(function () {
        // Ensure the complete handler is called before this completes
        anim.always(function () {
          hooks.unqueued--;
          if (!jQuery.queue(elem, "fx").length) {
            hooks.empty.fire();
          }
        });
      });
    }

    // Detect show/hide animations
    for (prop in props) {
      value = props[prop];
      if (rfxtypes.test(value)) {
        delete props[prop];
        toggle = toggle || value === "toggle";
        if (value === (hidden ? "hide" : "show")) {
          // Pretend to be hidden if this is a "show" and
          // there is still data from a stopped show/hide
          if (value === "show" && dataShow && dataShow[prop] !== undefined) {
            hidden = true;

            // Ignore all other no-op show/hide data
          } else {
            continue;
          }
        }
        orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
      }
    }

    // Bail out if this is a no-op like .hide().hide()
    propTween = !jQuery.isEmptyObject(props);
    if (!propTween && jQuery.isEmptyObject(orig)) {
      return;
    }

    // Restrict "overflow" and "display" styles during box animations
    if (isBox && elem.nodeType === 1) {
      // Support: IE <=9 - 11, Edge 12 - 15
      // Record all 3 overflow attributes because IE does not infer the shorthand
      // from identically-valued overflowX and overflowY and Edge just mirrors
      // the overflowX value there.
      opts.overflow = [style.overflow, style.overflowX, style.overflowY];

      // Identify a display type, preferring old show/hide data over the CSS cascade
      restoreDisplay = dataShow && dataShow.display;
      if (restoreDisplay == null) {
        restoreDisplay = dataPriv.get(elem, "display");
      }
      display = jQuery.css(elem, "display");
      if (display === "none") {
        if (restoreDisplay) {
          display = restoreDisplay;
        } else {
          // Get nonempty value(s) by temporarily forcing visibility
          showHide([elem], true);
          restoreDisplay = elem.style.display || restoreDisplay;
          display = jQuery.css(elem, "display");
          showHide([elem]);
        }
      }

      // Animate inline elements as inline-block
      if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
        if (jQuery.css(elem, "float") === "none") {
          // Restore the original display value at the end of pure show/hide animations
          if (!propTween) {
            anim.done(function () {
              style.display = restoreDisplay;
            });
            if (restoreDisplay == null) {
              display = style.display;
              restoreDisplay = display === "none" ? "" : display;
            }
          }
          style.display = "inline-block";
        }
      }
    }
    if (opts.overflow) {
      style.overflow = "hidden";
      anim.always(function () {
        style.overflow = opts.overflow[0];
        style.overflowX = opts.overflow[1];
        style.overflowY = opts.overflow[2];
      });
    }

    // Implement show/hide animations
    propTween = false;
    for (prop in orig) {
      // General show/hide setup for this element animation
      if (!propTween) {
        if (dataShow) {
          if ("hidden" in dataShow) {
            hidden = dataShow.hidden;
          }
        } else {
          dataShow = dataPriv.access(elem, "fxshow", {
            display: restoreDisplay
          });
        }

        // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
        if (toggle) {
          dataShow.hidden = !hidden;
        }

        // Show elements before animating them
        if (hidden) {
          showHide([elem], true);
        }

        /* eslint-disable no-loop-func */

        anim.done(function () {
          /* eslint-enable no-loop-func */

          // The final step of a "hide" animation is actually hiding the element
          if (!hidden) {
            showHide([elem]);
          }
          dataPriv.remove(elem, "fxshow");
          for (prop in orig) {
            jQuery.style(elem, prop, orig[prop]);
          }
        });
      }

      // Per-property setup
      propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
      if (!(prop in dataShow)) {
        dataShow[prop] = propTween.start;
        if (hidden) {
          propTween.end = propTween.start;
          propTween.start = 0;
        }
      }
    }
  }
  function propFilter(props, specialEasing) {
    var index, name, easing, value, hooks;

    // camelCase, specialEasing and expand cssHook pass
    for (index in props) {
      name = camelCase(index);
      easing = specialEasing[name];
      value = props[index];
      if (Array.isArray(value)) {
        easing = value[1];
        value = props[index] = value[0];
      }
      if (index !== name) {
        props[name] = value;
        delete props[index];
      }
      hooks = jQuery.cssHooks[name];
      if (hooks && "expand" in hooks) {
        value = hooks.expand(value);
        delete props[name];

        // Not quite $.extend, this won't overwrite existing keys.
        // Reusing 'index' because we have the correct "name"
        for (index in value) {
          if (!(index in props)) {
            props[index] = value[index];
            specialEasing[index] = easing;
          }
        }
      } else {
        specialEasing[name] = easing;
      }
    }
  }
  function Animation(elem, properties, options) {
    var result,
      stopped,
      index = 0,
      length = Animation.prefilters.length,
      deferred = jQuery.Deferred().always(function () {
        // Don't match elem in the :animated selector
        delete tick.elem;
      }),
      tick = function () {
        if (stopped) {
          return false;
        }
        var currentTime = fxNow || createFxNow(),
          remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
          // Support: Android 2.3 only
          // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497)
          temp = remaining / animation.duration || 0,
          percent = 1 - temp,
          index = 0,
          length = animation.tweens.length;
        for (; index < length; index++) {
          animation.tweens[index].run(percent);
        }
        deferred.notifyWith(elem, [animation, percent, remaining]);

        // If there's more to do, yield
        if (percent < 1 && length) {
          return remaining;
        }

        // If this was an empty animation, synthesize a final progress notification
        if (!length) {
          deferred.notifyWith(elem, [animation, 1, 0]);
        }

        // Resolve the animation and report its conclusion
        deferred.resolveWith(elem, [animation]);
        return false;
      },
      animation = deferred.promise({
        elem: elem,
        props: jQuery.extend({}, properties),
        opts: jQuery.extend(true, {
          specialEasing: {},
          easing: jQuery.easing._default
        }, options),
        originalProperties: properties,
        originalOptions: options,
        startTime: fxNow || createFxNow(),
        duration: options.duration,
        tweens: [],
        createTween: function (prop, end) {
          var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
          animation.tweens.push(tween);
          return tween;
        },
        stop: function (gotoEnd) {
          var index = 0,
            // If we are going to the end, we want to run all the tweens
            // otherwise we skip this part
            length = gotoEnd ? animation.tweens.length : 0;
          if (stopped) {
            return this;
          }
          stopped = true;
          for (; index < length; index++) {
            animation.tweens[index].run(1);
          }

          // Resolve when we played the last frame; otherwise, reject
          if (gotoEnd) {
            deferred.notifyWith(elem, [animation, 1, 0]);
            deferred.resolveWith(elem, [animation, gotoEnd]);
          } else {
            deferred.rejectWith(elem, [animation, gotoEnd]);
          }
          return this;
        }
      }),
      props = animation.props;
    propFilter(props, animation.opts.specialEasing);
    for (; index < length; index++) {
      result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
      if (result) {
        if (isFunction(result.stop)) {
          jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
        }
        return result;
      }
    }
    jQuery.map(props, createTween, animation);
    if (isFunction(animation.opts.start)) {
      animation.opts.start.call(elem, animation);
    }

    // Attach callbacks from options
    animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
    jQuery.fx.timer(jQuery.extend(tick, {
      elem: elem,
      anim: animation,
      queue: animation.opts.queue
    }));
    return animation;
  }
  jQuery.Animation = jQuery.extend(Animation, {
    tweeners: {
      "*": [function (prop, value) {
        var tween = this.createTween(prop, value);
        adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
        return tween;
      }]
    },
    tweener: function (props, callback) {
      if (isFunction(props)) {
        callback = props;
        props = ["*"];
      } else {
        props = props.match(rnothtmlwhite);
      }
      var prop,
        index = 0,
        length = props.length;
      for (; index < length; index++) {
        prop = props[index];
        Animation.tweeners[prop] = Animation.tweeners[prop] || [];
        Animation.tweeners[prop].unshift(callback);
      }
    },
    prefilters: [defaultPrefilter],
    prefilter: function (callback, prepend) {
      if (prepend) {
        Animation.prefilters.unshift(callback);
      } else {
        Animation.prefilters.push(callback);
      }
    }
  });
  jQuery.speed = function (speed, easing, fn) {
    var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
      complete: fn || !fn && easing || isFunction(speed) && speed,
      duration: speed,
      easing: fn && easing || easing && !isFunction(easing) && easing
    };

    // Go to the end state if fx are off
    if (jQuery.fx.off) {
      opt.duration = 0;
    } else {
      if (typeof opt.duration !== "number") {
        if (opt.duration in jQuery.fx.speeds) {
          opt.duration = jQuery.fx.speeds[opt.duration];
        } else {
          opt.duration = jQuery.fx.speeds._default;
        }
      }
    }

    // Normalize opt.queue - true/undefined/null -> "fx"
    if (opt.queue == null || opt.queue === true) {
      opt.queue = "fx";
    }

    // Queueing
    opt.old = opt.complete;
    opt.complete = function () {
      if (isFunction(opt.old)) {
        opt.old.call(this);
      }
      if (opt.queue) {
        jQuery.dequeue(this, opt.queue);
      }
    };
    return opt;
  };
  jQuery.fn.extend({
    fadeTo: function (speed, to, easing, callback) {
      // Show any hidden elements after setting opacity to 0
      return this.filter(isHiddenWithinTree).css("opacity", 0).show()

      // Animate to the value specified
      .end().animate({
        opacity: to
      }, speed, easing, callback);
    },
    animate: function (prop, speed, easing, callback) {
      var empty = jQuery.isEmptyObject(prop),
        optall = jQuery.speed(speed, easing, callback),
        doAnimation = function () {
          // Operate on a copy of prop so per-property easing won't be lost
          var anim = Animation(this, jQuery.extend({}, prop), optall);

          // Empty animations, or finishing resolves immediately
          if (empty || dataPriv.get(this, "finish")) {
            anim.stop(true);
          }
        };
      doAnimation.finish = doAnimation;
      return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
    },
    stop: function (type, clearQueue, gotoEnd) {
      var stopQueue = function (hooks) {
        var stop = hooks.stop;
        delete hooks.stop;
        stop(gotoEnd);
      };
      if (typeof type !== "string") {
        gotoEnd = clearQueue;
        clearQueue = type;
        type = undefined;
      }
      if (clearQueue) {
        this.queue(type || "fx", []);
      }
      return this.each(function () {
        var dequeue = true,
          index = type != null && type + "queueHooks",
          timers = jQuery.timers,
          data = dataPriv.get(this);
        if (index) {
          if (data[index] && data[index].stop) {
            stopQueue(data[index]);
          }
        } else {
          for (index in data) {
            if (data[index] && data[index].stop && rrun.test(index)) {
              stopQueue(data[index]);
            }
          }
        }
        for (index = timers.length; index--;) {
          if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
            timers[index].anim.stop(gotoEnd);
            dequeue = false;
            timers.splice(index, 1);
          }
        }

        // Start the next in the queue if the last step wasn't forced.
        // Timers currently will call their complete callbacks, which
        // will dequeue but only if they were gotoEnd.
        if (dequeue || !gotoEnd) {
          jQuery.dequeue(this, type);
        }
      });
    },
    finish: function (type) {
      if (type !== false) {
        type = type || "fx";
      }
      return this.each(function () {
        var index,
          data = dataPriv.get(this),
          queue = data[type + "queue"],
          hooks = data[type + "queueHooks"],
          timers = jQuery.timers,
          length = queue ? queue.length : 0;

        // Enable finishing flag on private data
        data.finish = true;

        // Empty the queue first
        jQuery.queue(this, type, []);
        if (hooks && hooks.stop) {
          hooks.stop.call(this, true);
        }

        // Look for any active animations, and finish them
        for (index = timers.length; index--;) {
          if (timers[index].elem === this && timers[index].queue === type) {
            timers[index].anim.stop(true);
            timers.splice(index, 1);
          }
        }

        // Look for any animations in the old queue and finish them
        for (index = 0; index < length; index++) {
          if (queue[index] && queue[index].finish) {
            queue[index].finish.call(this);
          }
        }

        // Turn off finishing flag
        delete data.finish;
      });
    }
  });
  jQuery.each(["toggle", "show", "hide"], function (_i, name) {
    var cssFn = jQuery.fn[name];
    jQuery.fn[name] = function (speed, easing, callback) {
      return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
    };
  });

  // Generate shortcuts for custom animations
  jQuery.each({
    slideDown: genFx("show"),
    slideUp: genFx("hide"),
    slideToggle: genFx("toggle"),
    fadeIn: {
      opacity: "show"
    },
    fadeOut: {
      opacity: "hide"
    },
    fadeToggle: {
      opacity: "toggle"
    }
  }, function (name, props) {
    jQuery.fn[name] = function (speed, easing, callback) {
      return this.animate(props, speed, easing, callback);
    };
  });
  jQuery.timers = [];
  jQuery.fx.tick = function () {
    var timer,
      i = 0,
      timers = jQuery.timers;
    fxNow = Date.now();
    for (; i < timers.length; i++) {
      timer = timers[i];

      // Run the timer and safely remove it when done (allowing for external removal)
      if (!timer() && timers[i] === timer) {
        timers.splice(i--, 1);
      }
    }
    if (!timers.length) {
      jQuery.fx.stop();
    }
    fxNow = undefined;
  };
  jQuery.fx.timer = function (timer) {
    jQuery.timers.push(timer);
    jQuery.fx.start();
  };
  jQuery.fx.interval = 13;
  jQuery.fx.start = function () {
    if (inProgress) {
      return;
    }
    inProgress = true;
    schedule();
  };
  jQuery.fx.stop = function () {
    inProgress = null;
  };
  jQuery.fx.speeds = {
    slow: 600,
    fast: 200,
    // Default speed
    _default: 400
  };

  // Based off of the plugin by Clint Helfers, with permission.
  jQuery.fn.delay = function (time, type) {
    time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
    type = type || "fx";
    return this.queue(type, function (next, hooks) {
      var timeout = window.setTimeout(next, time);
      hooks.stop = function () {
        window.clearTimeout(timeout);
      };
    });
  };
  (function () {
    var input = document.createElement("input"),
      select = document.createElement("select"),
      opt = select.appendChild(document.createElement("option"));
    input.type = "checkbox";

    // Support: Android <=4.3 only
    // Default value for a checkbox should be "on"
    support.checkOn = input.value !== "";

    // Support: IE <=11 only
    // Must access selectedIndex to make default options select
    support.optSelected = opt.selected;

    // Support: IE <=11 only
    // An input loses its value after becoming a radio
    input = document.createElement("input");
    input.value = "t";
    input.type = "radio";
    support.radioValue = input.value === "t";
  })();
  var boolHook,
    attrHandle = jQuery.expr.attrHandle;
  jQuery.fn.extend({
    attr: function (name, value) {
      return access(this, jQuery.attr, name, value, arguments.length > 1);
    },
    removeAttr: function (name) {
      return this.each(function () {
        jQuery.removeAttr(this, name);
      });
    }
  });
  jQuery.extend({
    attr: function (elem, name, value) {
      var ret,
        hooks,
        nType = elem.nodeType;

      // Don't get/set attributes on text, comment and attribute nodes
      if (nType === 3 || nType === 8 || nType === 2) {
        return;
      }

      // Fallback to prop when attributes are not supported
      if (typeof elem.getAttribute === "undefined") {
        return jQuery.prop(elem, name, value);
      }

      // Attribute hooks are determined by the lowercase version
      // Grab necessary hook if one is defined
      if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
        hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
      }
      if (value !== undefined) {
        if (value === null) {
          jQuery.removeAttr(elem, name);
          return;
        }
        if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
          return ret;
        }
        elem.setAttribute(name, value + "");
        return value;
      }
      if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
        return ret;
      }
      ret = jQuery.find.attr(elem, name);

      // Non-existent attributes return null, we normalize to undefined
      return ret == null ? undefined : ret;
    },
    attrHooks: {
      type: {
        set: function (elem, value) {
          if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
            var val = elem.value;
            elem.setAttribute("type", value);
            if (val) {
              elem.value = val;
            }
            return value;
          }
        }
      }
    },
    removeAttr: function (elem, value) {
      var name,
        i = 0,
        // Attribute names can contain non-HTML whitespace characters
        // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
        attrNames = value && value.match(rnothtmlwhite);
      if (attrNames && elem.nodeType === 1) {
        while (name = attrNames[i++]) {
          elem.removeAttribute(name);
        }
      }
    }
  });

  // Hooks for boolean attributes
  boolHook = {
    set: function (elem, value, name) {
      if (value === false) {
        // Remove boolean attributes when set to false
        jQuery.removeAttr(elem, name);
      } else {
        elem.setAttribute(name, name);
      }
      return name;
    }
  };
  jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (_i, name) {
    var getter = attrHandle[name] || jQuery.find.attr;
    attrHandle[name] = function (elem, name, isXML) {
      var ret,
        handle,
        lowercaseName = name.toLowerCase();
      if (!isXML) {
        // Avoid an infinite loop by temporarily removing this function from the getter
        handle = attrHandle[lowercaseName];
        attrHandle[lowercaseName] = ret;
        ret = getter(elem, name, isXML) != null ? lowercaseName : null;
        attrHandle[lowercaseName] = handle;
      }
      return ret;
    };
  });
  var rfocusable = /^(?:input|select|textarea|button)$/i,
    rclickable = /^(?:a|area)$/i;
  jQuery.fn.extend({
    prop: function (name, value) {
      return access(this, jQuery.prop, name, value, arguments.length > 1);
    },
    removeProp: function (name) {
      return this.each(function () {
        delete this[jQuery.propFix[name] || name];
      });
    }
  });
  jQuery.extend({
    prop: function (elem, name, value) {
      var ret,
        hooks,
        nType = elem.nodeType;

      // Don't get/set properties on text, comment and attribute nodes
      if (nType === 3 || nType === 8 || nType === 2) {
        return;
      }
      if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
        // Fix name and attach hooks
        name = jQuery.propFix[name] || name;
        hooks = jQuery.propHooks[name];
      }
      if (value !== undefined) {
        if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
          return ret;
        }
        return elem[name] = value;
      }
      if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
        return ret;
      }
      return elem[name];
    },
    propHooks: {
      tabIndex: {
        get: function (elem) {
          // Support: IE <=9 - 11 only
          // elem.tabIndex doesn't always return the
          // correct value when it hasn't been explicitly set
          // Use proper attribute retrieval (trac-12072)
          var tabindex = jQuery.find.attr(elem, "tabindex");
          if (tabindex) {
            return parseInt(tabindex, 10);
          }
          if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
            return 0;
          }
          return -1;
        }
      }
    },
    propFix: {
      "for": "htmlFor",
      "class": "className"
    }
  });

  // Support: IE <=11 only
  // Accessing the selectedIndex property
  // forces the browser to respect setting selected
  // on the option
  // The getter ensures a default option is selected
  // when in an optgroup
  // eslint rule "no-unused-expressions" is disabled for this code
  // since it considers such accessions noop
  if (!support.optSelected) {
    jQuery.propHooks.selected = {
      get: function (elem) {
        /* eslint no-unused-expressions: "off" */

        var parent = elem.parentNode;
        if (parent && parent.parentNode) {
          parent.parentNode.selectedIndex;
        }
        return null;
      },
      set: function (elem) {
        /* eslint no-unused-expressions: "off" */

        var parent = elem.parentNode;
        if (parent) {
          parent.selectedIndex;
          if (parent.parentNode) {
            parent.parentNode.selectedIndex;
          }
        }
      }
    };
  }
  jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
    jQuery.propFix[this.toLowerCase()] = this;
  });

  // Strip and collapse whitespace according to HTML spec
  // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  function stripAndCollapse(value) {
    var tokens = value.match(rnothtmlwhite) || [];
    return tokens.join(" ");
  }
  function getClass(elem) {
    return elem.getAttribute && elem.getAttribute("class") || "";
  }
  function classesToArray(value) {
    if (Array.isArray(value)) {
      return value;
    }
    if (typeof value === "string") {
      return value.match(rnothtmlwhite) || [];
    }
    return [];
  }
  jQuery.fn.extend({
    addClass: function (value) {
      var classNames, cur, curValue, className, i, finalValue;
      if (isFunction(value)) {
        return this.each(function (j) {
          jQuery(this).addClass(value.call(this, j, getClass(this)));
        });
      }
      classNames = classesToArray(value);
      if (classNames.length) {
        return this.each(function () {
          curValue = getClass(this);
          cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
          if (cur) {
            for (i = 0; i < classNames.length; i++) {
              className = classNames[i];
              if (cur.indexOf(" " + className + " ") < 0) {
                cur += className + " ";
              }
            }

            // Only assign if different to avoid unneeded rendering.
            finalValue = stripAndCollapse(cur);
            if (curValue !== finalValue) {
              this.setAttribute("class", finalValue);
            }
          }
        });
      }
      return this;
    },
    removeClass: function (value) {
      var classNames, cur, curValue, className, i, finalValue;
      if (isFunction(value)) {
        return this.each(function (j) {
          jQuery(this).removeClass(value.call(this, j, getClass(this)));
        });
      }
      if (!arguments.length) {
        return this.attr("class", "");
      }
      classNames = classesToArray(value);
      if (classNames.length) {
        return this.each(function () {
          curValue = getClass(this);

          // This expression is here for better compressibility (see addClass)
          cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
          if (cur) {
            for (i = 0; i < classNames.length; i++) {
              className = classNames[i];

              // Remove *all* instances
              while (cur.indexOf(" " + className + " ") > -1) {
                cur = cur.replace(" " + className + " ", " ");
              }
            }

            // Only assign if different to avoid unneeded rendering.
            finalValue = stripAndCollapse(cur);
            if (curValue !== finalValue) {
              this.setAttribute("class", finalValue);
            }
          }
        });
      }
      return this;
    },
    toggleClass: function (value, stateVal) {
      var classNames,
        className,
        i,
        self,
        type = typeof value,
        isValidValue = type === "string" || Array.isArray(value);
      if (isFunction(value)) {
        return this.each(function (i) {
          jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
        });
      }
      if (typeof stateVal === "boolean" && isValidValue) {
        return stateVal ? this.addClass(value) : this.removeClass(value);
      }
      classNames = classesToArray(value);
      return this.each(function () {
        if (isValidValue) {
          // Toggle individual class names
          self = jQuery(this);
          for (i = 0; i < classNames.length; i++) {
            className = classNames[i];

            // Check each className given, space separated list
            if (self.hasClass(className)) {
              self.removeClass(className);
            } else {
              self.addClass(className);
            }
          }

          // Toggle whole class name
        } else if (value === undefined || type === "boolean") {
          className = getClass(this);
          if (className) {
            // Store className if set
            dataPriv.set(this, "__className__", className);
          }

          // If the element has a class name or if we're passed `false`,
          // then remove the whole classname (if there was one, the above saved it).
          // Otherwise bring back whatever was previously saved (if anything),
          // falling back to the empty string if nothing was stored.
          if (this.setAttribute) {
            this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
          }
        }
      });
    },
    hasClass: function (selector) {
      var className,
        elem,
        i = 0;
      className = " " + selector + " ";
      while (elem = this[i++]) {
        if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
          return true;
        }
      }
      return false;
    }
  });
  var rreturn = /\r/g;
  jQuery.fn.extend({
    val: function (value) {
      var hooks,
        ret,
        valueIsFunction,
        elem = this[0];
      if (!arguments.length) {
        if (elem) {
          hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
          if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
            return ret;
          }
          ret = elem.value;

          // Handle most common string cases
          if (typeof ret === "string") {
            return ret.replace(rreturn, "");
          }

          // Handle cases where value is null/undef or number
          return ret == null ? "" : ret;
        }
        return;
      }
      valueIsFunction = isFunction(value);
      return this.each(function (i) {
        var val;
        if (this.nodeType !== 1) {
          return;
        }
        if (valueIsFunction) {
          val = value.call(this, i, jQuery(this).val());
        } else {
          val = value;
        }

        // Treat null/undefined as ""; convert numbers to string
        if (val == null) {
          val = "";
        } else if (typeof val === "number") {
          val += "";
        } else if (Array.isArray(val)) {
          val = jQuery.map(val, function (value) {
            return value == null ? "" : value + "";
          });
        }
        hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];

        // If set returns undefined, fall back to normal setting
        if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
          this.value = val;
        }
      });
    }
  });
  jQuery.extend({
    valHooks: {
      option: {
        get: function (elem) {
          var val = jQuery.find.attr(elem, "value");
          return val != null ? val :
          // Support: IE <=10 - 11 only
          // option.text throws exceptions (trac-14686, trac-14858)
          // Strip and collapse whitespace
          // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
          stripAndCollapse(jQuery.text(elem));
        }
      },
      select: {
        get: function (elem) {
          var value,
            option,
            i,
            options = elem.options,
            index = elem.selectedIndex,
            one = elem.type === "select-one",
            values = one ? null : [],
            max = one ? index + 1 : options.length;
          if (index < 0) {
            i = max;
          } else {
            i = one ? index : 0;
          }

          // Loop through all the selected options
          for (; i < max; i++) {
            option = options[i];

            // Support: IE <=9 only
            // IE8-9 doesn't update selected after form reset (trac-2551)
            if ((option.selected || i === index) &&
            // Don't return options that are disabled or in a disabled optgroup
            !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
              // Get the specific value for the option
              value = jQuery(option).val();

              // We don't need an array for one selects
              if (one) {
                return value;
              }

              // Multi-Selects return an array
              values.push(value);
            }
          }
          return values;
        },
        set: function (elem, value) {
          var optionSet,
            option,
            options = elem.options,
            values = jQuery.makeArray(value),
            i = options.length;
          while (i--) {
            option = options[i];

            /* eslint-disable no-cond-assign */

            if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
              optionSet = true;
            }

            /* eslint-enable no-cond-assign */
          }

          // Force browsers to behave consistently when non-matching value is set
          if (!optionSet) {
            elem.selectedIndex = -1;
          }
          return values;
        }
      }
    }
  });

  // Radios and checkboxes getter/setter
  jQuery.each(["radio", "checkbox"], function () {
    jQuery.valHooks[this] = {
      set: function (elem, value) {
        if (Array.isArray(value)) {
          return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
        }
      }
    };
    if (!support.checkOn) {
      jQuery.valHooks[this].get = function (elem) {
        return elem.getAttribute("value") === null ? "on" : elem.value;
      };
    }
  });

  // Return jQuery for attributes-only inclusion
  var location = window.location;
  var nonce = {
    guid: Date.now()
  };
  var rquery = /\?/;

  // Cross-browser xml parsing
  jQuery.parseXML = function (data) {
    var xml, parserErrorElem;
    if (!data || typeof data !== "string") {
      return null;
    }

    // Support: IE 9 - 11 only
    // IE throws on parseFromString with invalid input.
    try {
      xml = new window.DOMParser().parseFromString(data, "text/xml");
    } catch (e) {}
    parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0];
    if (!xml || parserErrorElem) {
      jQuery.error("Invalid XML: " + (parserErrorElem ? jQuery.map(parserErrorElem.childNodes, function (el) {
        return el.textContent;
      }).join("\n") : data));
    }
    return xml;
  };
  var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
    stopPropagationCallback = function (e) {
      e.stopPropagation();
    };
  jQuery.extend(jQuery.event, {
    trigger: function (event, data, elem, onlyHandlers) {
      var i,
        cur,
        tmp,
        bubbleType,
        ontype,
        handle,
        special,
        lastElement,
        eventPath = [elem || document],
        type = hasOwn.call(event, "type") ? event.type : event,
        namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
      cur = lastElement = tmp = elem = elem || document;

      // Don't do events on text and comment nodes
      if (elem.nodeType === 3 || elem.nodeType === 8) {
        return;
      }

      // focus/blur morphs to focusin/out; ensure we're not firing them right now
      if (rfocusMorph.test(type + jQuery.event.triggered)) {
        return;
      }
      if (type.indexOf(".") > -1) {
        // Namespaced trigger; create a regexp to match event type in handle()
        namespaces = type.split(".");
        type = namespaces.shift();
        namespaces.sort();
      }
      ontype = type.indexOf(":") < 0 && "on" + type;

      // Caller can pass in a jQuery.Event object, Object, or just an event type string
      event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event);

      // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
      event.isTrigger = onlyHandlers ? 2 : 3;
      event.namespace = namespaces.join(".");
      event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;

      // Clean up the event in case it is being reused
      event.result = undefined;
      if (!event.target) {
        event.target = elem;
      }

      // Clone any incoming data and prepend the event, creating the handler arg list
      data = data == null ? [event] : jQuery.makeArray(data, [event]);

      // Allow special events to draw outside the lines
      special = jQuery.event.special[type] || {};
      if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
        return;
      }

      // Determine event propagation path in advance, per W3C events spec (trac-9951)
      // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)
      if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
        bubbleType = special.delegateType || type;
        if (!rfocusMorph.test(bubbleType + type)) {
          cur = cur.parentNode;
        }
        for (; cur; cur = cur.parentNode) {
          eventPath.push(cur);
          tmp = cur;
        }

        // Only add window if we got to document (e.g., not plain obj or detached DOM)
        if (tmp === (elem.ownerDocument || document)) {
          eventPath.push(tmp.defaultView || tmp.parentWindow || window);
        }
      }

      // Fire handlers on the event path
      i = 0;
      while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
        lastElement = cur;
        event.type = i > 1 ? bubbleType : special.bindType || type;

        // jQuery handler
        handle = (dataPriv.get(cur, "events") || Object.create(null))[event.type] && dataPriv.get(cur, "handle");
        if (handle) {
          handle.apply(cur, data);
        }

        // Native handler
        handle = ontype && cur[ontype];
        if (handle && handle.apply && acceptData(cur)) {
          event.result = handle.apply(cur, data);
          if (event.result === false) {
            event.preventDefault();
          }
        }
      }
      event.type = type;

      // If nobody prevented the default action, do it now
      if (!onlyHandlers && !event.isDefaultPrevented()) {
        if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
          // Call a native DOM method on the target with the same name as the event.
          // Don't do default actions on window, that's where global variables be (trac-6170)
          if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
            // Don't re-trigger an onFOO event when we call its FOO() method
            tmp = elem[ontype];
            if (tmp) {
              elem[ontype] = null;
            }

            // Prevent re-triggering of the same event, since we already bubbled it above
            jQuery.event.triggered = type;
            if (event.isPropagationStopped()) {
              lastElement.addEventListener(type, stopPropagationCallback);
            }
            elem[type]();
            if (event.isPropagationStopped()) {
              lastElement.removeEventListener(type, stopPropagationCallback);
            }
            jQuery.event.triggered = undefined;
            if (tmp) {
              elem[ontype] = tmp;
            }
          }
        }
      }
      return event.result;
    },
    // Piggyback on a donor event to simulate a different one
    // Used only for `focus(in | out)` events
    simulate: function (type, elem, event) {
      var e = jQuery.extend(new jQuery.Event(), event, {
        type: type,
        isSimulated: true
      });
      jQuery.event.trigger(e, null, elem);
    }
  });
  jQuery.fn.extend({
    trigger: function (type, data) {
      return this.each(function () {
        jQuery.event.trigger(type, data, this);
      });
    },
    triggerHandler: function (type, data) {
      var elem = this[0];
      if (elem) {
        return jQuery.event.trigger(type, data, elem, true);
      }
    }
  });
  var rbracket = /\[\]$/,
    rCRLF = /\r?\n/g,
    rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
    rsubmittable = /^(?:input|select|textarea|keygen)/i;
  function buildParams(prefix, obj, traditional, add) {
    var name;
    if (Array.isArray(obj)) {
      // Serialize array item.
      jQuery.each(obj, function (i, v) {
        if (traditional || rbracket.test(prefix)) {
          // Treat each array item as a scalar.
          add(prefix, v);
        } else {
          // Item is non-scalar (array or object), encode its numeric index.
          buildParams(prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]", v, traditional, add);
        }
      });
    } else if (!traditional && toType(obj) === "object") {
      // Serialize object item.
      for (name in obj) {
        buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
      }
    } else {
      // Serialize scalar item.
      add(prefix, obj);
    }
  }

  // Serialize an array of form elements or a set of
  // key/values into a query string
  jQuery.param = function (a, traditional) {
    var prefix,
      s = [],
      add = function (key, valueOrFunction) {
        // If value is a function, invoke it and use its return value
        var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
        s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
      };
    if (a == null) {
      return "";
    }

    // If an array was passed in, assume that it is an array of form elements.
    if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
      // Serialize the form elements
      jQuery.each(a, function () {
        add(this.name, this.value);
      });
    } else {
      // If traditional, encode the "old" way (the way 1.3.2 or older
      // did it), otherwise encode params recursively.
      for (prefix in a) {
        buildParams(prefix, a[prefix], traditional, add);
      }
    }

    // Return the resulting serialization
    return s.join("&");
  };
  jQuery.fn.extend({
    serialize: function () {
      return jQuery.param(this.serializeArray());
    },
    serializeArray: function () {
      return this.map(function () {
        // Can add propHook for "elements" to filter or add form elements
        var elements = jQuery.prop(this, "elements");
        return elements ? jQuery.makeArray(elements) : this;
      }).filter(function () {
        var type = this.type;

        // Use .is( ":disabled" ) so that fieldset[disabled] works
        return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
      }).map(function (_i, elem) {
        var val = jQuery(this).val();
        if (val == null) {
          return null;
        }
        if (Array.isArray(val)) {
          return jQuery.map(val, function (val) {
            return {
              name: elem.name,
              value: val.replace(rCRLF, "\r\n")
            };
          });
        }
        return {
          name: elem.name,
          value: val.replace(rCRLF, "\r\n")
        };
      }).get();
    }
  });
  var r20 = /%20/g,
    rhash = /#.*$/,
    rantiCache = /([?&])_=[^&]*/,
    rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
    // trac-7653, trac-8125, trac-8152: local protocol detection
    rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
    rnoContent = /^(?:GET|HEAD)$/,
    rprotocol = /^\/\//,
    /* Prefilters
     * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
     * 2) These are called:
     *    - BEFORE asking for a transport
     *    - AFTER param serialization (s.data is a string if s.processData is true)
     * 3) key is the dataType
     * 4) the catchall symbol "*" can be used
     * 5) execution will start with transport dataType and THEN continue down to "*" if needed
     */
    prefilters = {},
    /* Transports bindings
     * 1) key is the dataType
     * 2) the catchall symbol "*" can be used
     * 3) selection will start with transport dataType and THEN go to "*" if needed
     */
    transports = {},
    // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression
    allTypes = "*/".concat("*"),
    // Anchor tag for parsing the document origin
    originAnchor = document.createElement("a");
  originAnchor.href = location.href;

  // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  function addToPrefiltersOrTransports(structure) {
    // dataTypeExpression is optional and defaults to "*"
    return function (dataTypeExpression, func) {
      if (typeof dataTypeExpression !== "string") {
        func = dataTypeExpression;
        dataTypeExpression = "*";
      }
      var dataType,
        i = 0,
        dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
      if (isFunction(func)) {
        // For each dataType in the dataTypeExpression
        while (dataType = dataTypes[i++]) {
          // Prepend if requested
          if (dataType[0] === "+") {
            dataType = dataType.slice(1) || "*";
            (structure[dataType] = structure[dataType] || []).unshift(func);

            // Otherwise append
          } else {
            (structure[dataType] = structure[dataType] || []).push(func);
          }
        }
      }
    };
  }

  // Base inspection function for prefilters and transports
  function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
    var inspected = {},
      seekingTransport = structure === transports;
    function inspect(dataType) {
      var selected;
      inspected[dataType] = true;
      jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
        var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
        if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
          options.dataTypes.unshift(dataTypeOrTransport);
          inspect(dataTypeOrTransport);
          return false;
        } else if (seekingTransport) {
          return !(selected = dataTypeOrTransport);
        }
      });
      return selected;
    }
    return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  }

  // A special extend for ajax options
  // that takes "flat" options (not to be deep extended)
  // Fixes trac-9887
  function ajaxExtend(target, src) {
    var key,
      deep,
      flatOptions = jQuery.ajaxSettings.flatOptions || {};
    for (key in src) {
      if (src[key] !== undefined) {
        (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
      }
    }
    if (deep) {
      jQuery.extend(true, target, deep);
    }
    return target;
  }

  /* Handles responses to an ajax request:
   * - finds the right dataType (mediates between content-type and expected dataType)
   * - returns the corresponding response
   */
  function ajaxHandleResponses(s, jqXHR, responses) {
    var ct,
      type,
      finalDataType,
      firstDataType,
      contents = s.contents,
      dataTypes = s.dataTypes;

    // Remove auto dataType and get content-type in the process
    while (dataTypes[0] === "*") {
      dataTypes.shift();
      if (ct === undefined) {
        ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
      }
    }

    // Check if we're dealing with a known content-type
    if (ct) {
      for (type in contents) {
        if (contents[type] && contents[type].test(ct)) {
          dataTypes.unshift(type);
          break;
        }
      }
    }

    // Check to see if we have a response for the expected dataType
    if (dataTypes[0] in responses) {
      finalDataType = dataTypes[0];
    } else {
      // Try convertible dataTypes
      for (type in responses) {
        if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
          finalDataType = type;
          break;
        }
        if (!firstDataType) {
          firstDataType = type;
        }
      }

      // Or just use first one
      finalDataType = finalDataType || firstDataType;
    }

    // If we found a dataType
    // We add the dataType to the list if needed
    // and return the corresponding response
    if (finalDataType) {
      if (finalDataType !== dataTypes[0]) {
        dataTypes.unshift(finalDataType);
      }
      return responses[finalDataType];
    }
  }

  /* Chain conversions given the request and the original response
   * Also sets the responseXXX fields on the jqXHR instance
   */
  function ajaxConvert(s, response, jqXHR, isSuccess) {
    var conv2,
      current,
      conv,
      tmp,
      prev,
      converters = {},
      // Work with a copy of dataTypes in case we need to modify it for conversion
      dataTypes = s.dataTypes.slice();

    // Create converters map with lowercased keys
    if (dataTypes[1]) {
      for (conv in s.converters) {
        converters[conv.toLowerCase()] = s.converters[conv];
      }
    }
    current = dataTypes.shift();

    // Convert to each sequential dataType
    while (current) {
      if (s.responseFields[current]) {
        jqXHR[s.responseFields[current]] = response;
      }

      // Apply the dataFilter if provided
      if (!prev && isSuccess && s.dataFilter) {
        response = s.dataFilter(response, s.dataType);
      }
      prev = current;
      current = dataTypes.shift();
      if (current) {
        // There's only work to do if current dataType is non-auto
        if (current === "*") {
          current = prev;

          // Convert response if prev dataType is non-auto and differs from current
        } else if (prev !== "*" && prev !== current) {
          // Seek a direct converter
          conv = converters[prev + " " + current] || converters["* " + current];

          // If none found, seek a pair
          if (!conv) {
            for (conv2 in converters) {
              // If conv2 outputs current
              tmp = conv2.split(" ");
              if (tmp[1] === current) {
                // If prev can be converted to accepted input
                conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
                if (conv) {
                  // Condense equivalence converters
                  if (conv === true) {
                    conv = converters[conv2];

                    // Otherwise, insert the intermediate dataType
                  } else if (converters[conv2] !== true) {
                    current = tmp[0];
                    dataTypes.unshift(tmp[1]);
                  }
                  break;
                }
              }
            }
          }

          // Apply converter (if not an equivalence)
          if (conv !== true) {
            // Unless errors are allowed to bubble, catch and return them
            if (conv && s.throws) {
              response = conv(response);
            } else {
              try {
                response = conv(response);
              } catch (e) {
                return {
                  state: "parsererror",
                  error: conv ? e : "No conversion from " + prev + " to " + current
                };
              }
            }
          }
        }
      }
    }
    return {
      state: "success",
      data: response
    };
  }
  jQuery.extend({
    // Counter for holding the number of active queries
    active: 0,
    // Last-Modified header cache for next request
    lastModified: {},
    etag: {},
    ajaxSettings: {
      url: location.href,
      type: "GET",
      isLocal: rlocalProtocol.test(location.protocol),
      global: true,
      processData: true,
      async: true,
      contentType: "application/x-www-form-urlencoded; charset=UTF-8",
      /*
      timeout: 0,
      data: null,
      dataType: null,
      username: null,
      password: null,
      cache: null,
      throws: false,
      traditional: false,
      headers: {},
      */

      accepts: {
        "*": allTypes,
        text: "text/plain",
        html: "text/html",
        xml: "application/xml, text/xml",
        json: "application/json, text/javascript"
      },
      contents: {
        xml: /\bxml\b/,
        html: /\bhtml/,
        json: /\bjson\b/
      },
      responseFields: {
        xml: "responseXML",
        text: "responseText",
        json: "responseJSON"
      },
      // Data converters
      // Keys separate source (or catchall "*") and destination types with a single space
      converters: {
        // Convert anything to text
        "* text": String,
        // Text to html (true = no transformation)
        "text html": true,
        // Evaluate text as a json expression
        "text json": JSON.parse,
        // Parse text as xml
        "text xml": jQuery.parseXML
      },
      // For options that shouldn't be deep extended:
      // you can add your own custom options here if
      // and when you create one that shouldn't be
      // deep extended (see ajaxExtend)
      flatOptions: {
        url: true,
        context: true
      }
    },
    // Creates a full fledged settings object into target
    // with both ajaxSettings and settings fields.
    // If target is omitted, writes into ajaxSettings.
    ajaxSetup: function (target, settings) {
      return settings ?
      // Building a settings object
      ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
      // Extending ajaxSettings
      ajaxExtend(jQuery.ajaxSettings, target);
    },
    ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
    ajaxTransport: addToPrefiltersOrTransports(transports),
    // Main method
    ajax: function (url, options) {
      // If url is an object, simulate pre-1.5 signature
      if (typeof url === "object") {
        options = url;
        url = undefined;
      }

      // Force options to be an object
      options = options || {};
      var transport,
        // URL without anti-cache param
        cacheURL,
        // Response headers
        responseHeadersString,
        responseHeaders,
        // timeout handle
        timeoutTimer,
        // Url cleanup var
        urlAnchor,
        // Request state (becomes false upon send and true upon completion)
        completed,
        // To know if global events are to be dispatched
        fireGlobals,
        // Loop variable
        i,
        // uncached part of the url
        uncached,
        // Create the final options object
        s = jQuery.ajaxSetup({}, options),
        // Callbacks context
        callbackContext = s.context || s,
        // Context for global events is callbackContext if it is a DOM node or jQuery collection
        globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
        // Deferreds
        deferred = jQuery.Deferred(),
        completeDeferred = jQuery.Callbacks("once memory"),
        // Status-dependent callbacks
        statusCode = s.statusCode || {},
        // Headers (they are sent all at once)
        requestHeaders = {},
        requestHeadersNames = {},
        // Default abort message
        strAbort = "canceled",
        // Fake xhr
        jqXHR = {
          readyState: 0,
          // Builds headers hashtable if needed
          getResponseHeader: function (key) {
            var match;
            if (completed) {
              if (!responseHeaders) {
                responseHeaders = {};
                while (match = rheaders.exec(responseHeadersString)) {
                  responseHeaders[match[1].toLowerCase() + " "] = (responseHeaders[match[1].toLowerCase() + " "] || []).concat(match[2]);
                }
              }
              match = responseHeaders[key.toLowerCase() + " "];
            }
            return match == null ? null : match.join(", ");
          },
          // Raw string
          getAllResponseHeaders: function () {
            return completed ? responseHeadersString : null;
          },
          // Caches the header
          setRequestHeader: function (name, value) {
            if (completed == null) {
              name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
              requestHeaders[name] = value;
            }
            return this;
          },
          // Overrides response content-type header
          overrideMimeType: function (type) {
            if (completed == null) {
              s.mimeType = type;
            }
            return this;
          },
          // Status-dependent callbacks
          statusCode: function (map) {
            var code;
            if (map) {
              if (completed) {
                // Execute the appropriate callbacks
                jqXHR.always(map[jqXHR.status]);
              } else {
                // Lazy-add the new callbacks in a way that preserves old ones
                for (code in map) {
                  statusCode[code] = [statusCode[code], map[code]];
                }
              }
            }
            return this;
          },
          // Cancel the request
          abort: function (statusText) {
            var finalText = statusText || strAbort;
            if (transport) {
              transport.abort(finalText);
            }
            done(0, finalText);
            return this;
          }
        };

      // Attach deferreds
      deferred.promise(jqXHR);

      // Add protocol if not provided (prefilters might expect it)
      // Handle falsy url in the settings object (trac-10093: consistency with old signature)
      // We also use the url parameter if available
      s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");

      // Alias method option to type as per ticket trac-12004
      s.type = options.method || options.type || s.method || s.type;

      // Extract dataTypes list
      s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];

      // A cross-domain request is in order when the origin doesn't match the current origin.
      if (s.crossDomain == null) {
        urlAnchor = document.createElement("a");

        // Support: IE <=8 - 11, Edge 12 - 15
        // IE throws exception on accessing the href property if url is malformed,
        // e.g. http://example.com:80x/
        try {
          urlAnchor.href = s.url;

          // Support: IE <=8 - 11 only
          // Anchor's host property isn't correctly set when s.url is relative
          urlAnchor.href = urlAnchor.href;
          s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
        } catch (e) {
          // If there is an error parsing the URL, assume it is crossDomain,
          // it can be rejected by the transport if it is invalid
          s.crossDomain = true;
        }
      }

      // Convert data if not already a string
      if (s.data && s.processData && typeof s.data !== "string") {
        s.data = jQuery.param(s.data, s.traditional);
      }

      // Apply prefilters
      inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);

      // If request was aborted inside a prefilter, stop there
      if (completed) {
        return jqXHR;
      }

      // We can fire global events as of now if asked to
      // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118)
      fireGlobals = jQuery.event && s.global;

      // Watch for a new set of requests
      if (fireGlobals && jQuery.active++ === 0) {
        jQuery.event.trigger("ajaxStart");
      }

      // Uppercase the type
      s.type = s.type.toUpperCase();

      // Determine if request has content
      s.hasContent = !rnoContent.test(s.type);

      // Save the URL in case we're toying with the If-Modified-Since
      // and/or If-None-Match header later on
      // Remove hash to simplify url manipulation
      cacheURL = s.url.replace(rhash, "");

      // More options handling for requests with no content
      if (!s.hasContent) {
        // Remember the hash so we can put it back
        uncached = s.url.slice(cacheURL.length);

        // If data is available and should be processed, append data to url
        if (s.data && (s.processData || typeof s.data === "string")) {
          cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;

          // trac-9682: remove data so that it's not used in an eventual retry
          delete s.data;
        }

        // Add or update anti-cache param if needed
        if (s.cache === false) {
          cacheURL = cacheURL.replace(rantiCache, "$1");
          uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce.guid++ + uncached;
        }

        // Put hash and anti-cache on the URL that will be requested (gh-1732)
        s.url = cacheURL + uncached;

        // Change '%20' to '+' if this is encoded form body content (gh-2658)
      } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
        s.data = s.data.replace(r20, "+");
      }

      // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
      if (s.ifModified) {
        if (jQuery.lastModified[cacheURL]) {
          jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
        }
        if (jQuery.etag[cacheURL]) {
          jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
        }
      }

      // Set the correct header, if data is being sent
      if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
        jqXHR.setRequestHeader("Content-Type", s.contentType);
      }

      // Set the Accepts header for the server, depending on the dataType
      jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);

      // Check for headers option
      for (i in s.headers) {
        jqXHR.setRequestHeader(i, s.headers[i]);
      }

      // Allow custom headers/mimetypes and early abort
      if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
        // Abort if not done already and return
        return jqXHR.abort();
      }

      // Aborting is no longer a cancellation
      strAbort = "abort";

      // Install callbacks on deferreds
      completeDeferred.add(s.complete);
      jqXHR.done(s.success);
      jqXHR.fail(s.error);

      // Get transport
      transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);

      // If no transport, we auto-abort
      if (!transport) {
        done(-1, "No Transport");
      } else {
        jqXHR.readyState = 1;

        // Send global event
        if (fireGlobals) {
          globalEventContext.trigger("ajaxSend", [jqXHR, s]);
        }

        // If request was aborted inside ajaxSend, stop there
        if (completed) {
          return jqXHR;
        }

        // Timeout
        if (s.async && s.timeout > 0) {
          timeoutTimer = window.setTimeout(function () {
            jqXHR.abort("timeout");
          }, s.timeout);
        }
        try {
          completed = false;
          transport.send(requestHeaders, done);
        } catch (e) {
          // Rethrow post-completion exceptions
          if (completed) {
            throw e;
          }

          // Propagate others as results
          done(-1, e);
        }
      }

      // Callback for when everything is done
      function done(status, nativeStatusText, responses, headers) {
        var isSuccess,
          success,
          error,
          response,
          modified,
          statusText = nativeStatusText;

        // Ignore repeat invocations
        if (completed) {
          return;
        }
        completed = true;

        // Clear timeout if it exists
        if (timeoutTimer) {
          window.clearTimeout(timeoutTimer);
        }

        // Dereference transport for early garbage collection
        // (no matter how long the jqXHR object will be used)
        transport = undefined;

        // Cache response headers
        responseHeadersString = headers || "";

        // Set readyState
        jqXHR.readyState = status > 0 ? 4 : 0;

        // Determine if successful
        isSuccess = status >= 200 && status < 300 || status === 304;

        // Get response data
        if (responses) {
          response = ajaxHandleResponses(s, jqXHR, responses);
        }

        // Use a noop converter for missing script but not if jsonp
        if (!isSuccess && jQuery.inArray("script", s.dataTypes) > -1 && jQuery.inArray("json", s.dataTypes) < 0) {
          s.converters["text script"] = function () {};
        }

        // Convert no matter what (that way responseXXX fields are always set)
        response = ajaxConvert(s, response, jqXHR, isSuccess);

        // If successful, handle type chaining
        if (isSuccess) {
          // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
          if (s.ifModified) {
            modified = jqXHR.getResponseHeader("Last-Modified");
            if (modified) {
              jQuery.lastModified[cacheURL] = modified;
            }
            modified = jqXHR.getResponseHeader("etag");
            if (modified) {
              jQuery.etag[cacheURL] = modified;
            }
          }

          // if no content
          if (status === 204 || s.type === "HEAD") {
            statusText = "nocontent";

            // if not modified
          } else if (status === 304) {
            statusText = "notmodified";

            // If we have data, let's convert it
          } else {
            statusText = response.state;
            success = response.data;
            error = response.error;
            isSuccess = !error;
          }
        } else {
          // Extract error from statusText and normalize for non-aborts
          error = statusText;
          if (status || !statusText) {
            statusText = "error";
            if (status < 0) {
              status = 0;
            }
          }
        }

        // Set data for the fake xhr object
        jqXHR.status = status;
        jqXHR.statusText = (nativeStatusText || statusText) + "";

        // Success/Error
        if (isSuccess) {
          deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
        } else {
          deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
        }

        // Status-dependent callbacks
        jqXHR.statusCode(statusCode);
        statusCode = undefined;
        if (fireGlobals) {
          globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
        }

        // Complete
        completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
        if (fireGlobals) {
          globalEventContext.trigger("ajaxComplete", [jqXHR, s]);

          // Handle the global AJAX counter
          if (! --jQuery.active) {
            jQuery.event.trigger("ajaxStop");
          }
        }
      }
      return jqXHR;
    },
    getJSON: function (url, data, callback) {
      return jQuery.get(url, data, callback, "json");
    },
    getScript: function (url, callback) {
      return jQuery.get(url, undefined, callback, "script");
    }
  });
  jQuery.each(["get", "post"], function (_i, method) {
    jQuery[method] = function (url, data, callback, type) {
      // Shift arguments if data argument was omitted
      if (isFunction(data)) {
        type = type || callback;
        callback = data;
        data = undefined;
      }

      // The url can be an options object (which then must have .url)
      return jQuery.ajax(jQuery.extend({
        url: url,
        type: method,
        dataType: type,
        data: data,
        success: callback
      }, jQuery.isPlainObject(url) && url));
    };
  });
  jQuery.ajaxPrefilter(function (s) {
    var i;
    for (i in s.headers) {
      if (i.toLowerCase() === "content-type") {
        s.contentType = s.headers[i] || "";
      }
    }
  });
  jQuery._evalUrl = function (url, options, doc) {
    return jQuery.ajax({
      url: url,
      // Make this explicit, since user can override this through ajaxSetup (trac-11264)
      type: "GET",
      dataType: "script",
      cache: true,
      async: false,
      global: false,
      // Only evaluate the response if it is successful (gh-4126)
      // dataFilter is not invoked for failure responses, so using it instead
      // of the default converter is kludgy but it works.
      converters: {
        "text script": function () {}
      },
      dataFilter: function (response) {
        jQuery.globalEval(response, options, doc);
      }
    });
  };
  jQuery.fn.extend({
    wrapAll: function (html) {
      var wrap;
      if (this[0]) {
        if (isFunction(html)) {
          html = html.call(this[0]);
        }

        // The elements to wrap the target around
        wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
        if (this[0].parentNode) {
          wrap.insertBefore(this[0]);
        }
        wrap.map(function () {
          var elem = this;
          while (elem.firstElementChild) {
            elem = elem.firstElementChild;
          }
          return elem;
        }).append(this);
      }
      return this;
    },
    wrapInner: function (html) {
      if (isFunction(html)) {
        return this.each(function (i) {
          jQuery(this).wrapInner(html.call(this, i));
        });
      }
      return this.each(function () {
        var self = jQuery(this),
          contents = self.contents();
        if (contents.length) {
          contents.wrapAll(html);
        } else {
          self.append(html);
        }
      });
    },
    wrap: function (html) {
      var htmlIsFunction = isFunction(html);
      return this.each(function (i) {
        jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
      });
    },
    unwrap: function (selector) {
      this.parent(selector).not("body").each(function () {
        jQuery(this).replaceWith(this.childNodes);
      });
      return this;
    }
  });
  jQuery.expr.pseudos.hidden = function (elem) {
    return !jQuery.expr.pseudos.visible(elem);
  };
  jQuery.expr.pseudos.visible = function (elem) {
    return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  };
  jQuery.ajaxSettings.xhr = function () {
    try {
      return new window.XMLHttpRequest();
    } catch (e) {}
  };
  var xhrSuccessStatus = {
      // File protocol always yields status code 0, assume 200
      0: 200,
      // Support: IE <=9 only
      // trac-1450: sometimes IE returns 1223 when it should be 204
      1223: 204
    },
    xhrSupported = jQuery.ajaxSettings.xhr();
  support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  support.ajax = xhrSupported = !!xhrSupported;
  jQuery.ajaxTransport(function (options) {
    var callback, errorCallback;

    // Cross domain only allowed if supported through XMLHttpRequest
    if (support.cors || xhrSupported && !options.crossDomain) {
      return {
        send: function (headers, complete) {
          var i,
            xhr = options.xhr();
          xhr.open(options.type, options.url, options.async, options.username, options.password);

          // Apply custom fields if provided
          if (options.xhrFields) {
            for (i in options.xhrFields) {
              xhr[i] = options.xhrFields[i];
            }
          }

          // Override mime type if needed
          if (options.mimeType && xhr.overrideMimeType) {
            xhr.overrideMimeType(options.mimeType);
          }

          // X-Requested-With header
          // For cross-domain requests, seeing as conditions for a preflight are
          // akin to a jigsaw puzzle, we simply never set it to be sure.
          // (it can always be set on a per-request basis or even using ajaxSetup)
          // For same-domain requests, won't change header if already provided.
          if (!options.crossDomain && !headers["X-Requested-With"]) {
            headers["X-Requested-With"] = "XMLHttpRequest";
          }

          // Set headers
          for (i in headers) {
            xhr.setRequestHeader(i, headers[i]);
          }

          // Callback
          callback = function (type) {
            return function () {
              if (callback) {
                callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
                if (type === "abort") {
                  xhr.abort();
                } else if (type === "error") {
                  // Support: IE <=9 only
                  // On a manual native abort, IE9 throws
                  // errors on any property access that is not readyState
                  if (typeof xhr.status !== "number") {
                    complete(0, "error");
                  } else {
                    complete(
                    // File: protocol always yields status 0; see trac-8605, trac-14207
                    xhr.status, xhr.statusText);
                  }
                } else {
                  complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
                  // Support: IE <=9 only
                  // IE9 has no XHR2 but throws on binary (trac-11426)
                  // For XHR2 non-text, let the caller handle it (gh-2498)
                  (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? {
                    binary: xhr.response
                  } : {
                    text: xhr.responseText
                  }, xhr.getAllResponseHeaders());
                }
              }
            };
          };

          // Listen to events
          xhr.onload = callback();
          errorCallback = xhr.onerror = xhr.ontimeout = callback("error");

          // Support: IE 9 only
          // Use onreadystatechange to replace onabort
          // to handle uncaught aborts
          if (xhr.onabort !== undefined) {
            xhr.onabort = errorCallback;
          } else {
            xhr.onreadystatechange = function () {
              // Check readyState before timeout as it changes
              if (xhr.readyState === 4) {
                // Allow onerror to be called first,
                // but that will not handle a native abort
                // Also, save errorCallback to a variable
                // as xhr.onerror cannot be accessed
                window.setTimeout(function () {
                  if (callback) {
                    errorCallback();
                  }
                });
              }
            };
          }

          // Create the abort callback
          callback = callback("abort");
          try {
            // Do send the request (this may raise an exception)
            xhr.send(options.hasContent && options.data || null);
          } catch (e) {
            // trac-14683: Only rethrow if this hasn't been notified as an error yet
            if (callback) {
              throw e;
            }
          }
        },
        abort: function () {
          if (callback) {
            callback();
          }
        }
      };
    }
  });

  // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  jQuery.ajaxPrefilter(function (s) {
    if (s.crossDomain) {
      s.contents.script = false;
    }
  });

  // Install script dataType
  jQuery.ajaxSetup({
    accepts: {
      script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
    },
    contents: {
      script: /\b(?:java|ecma)script\b/
    },
    converters: {
      "text script": function (text) {
        jQuery.globalEval(text);
        return text;
      }
    }
  });

  // Handle cache's special case and crossDomain
  jQuery.ajaxPrefilter("script", function (s) {
    if (s.cache === undefined) {
      s.cache = false;
    }
    if (s.crossDomain) {
      s.type = "GET";
    }
  });

  // Bind script tag hack transport
  jQuery.ajaxTransport("script", function (s) {
    // This transport only deals with cross domain or forced-by-attrs requests
    if (s.crossDomain || s.scriptAttrs) {
      var script, callback;
      return {
        send: function (_, complete) {
          script = jQuery("<script>").attr(s.scriptAttrs || {}).prop({
            charset: s.scriptCharset,
            src: s.url
          }).on("load error", callback = function (evt) {
            script.remove();
            callback = null;
            if (evt) {
              complete(evt.type === "error" ? 404 : 200, evt.type);
            }
          });

          // Use native DOM manipulation to avoid our domManip AJAX trickery
          document.head.appendChild(script[0]);
        },
        abort: function () {
          if (callback) {
            callback();
          }
        }
      };
    }
  });
  var oldCallbacks = [],
    rjsonp = /(=)\?(?=&|$)|\?\?/;

  // Default jsonp settings
  jQuery.ajaxSetup({
    jsonp: "callback",
    jsonpCallback: function () {
      var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce.guid++;
      this[callback] = true;
      return callback;
    }
  });

  // Detect, normalize options and install callbacks for jsonp requests
  jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
    var callbackName,
      overwritten,
      responseContainer,
      jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");

    // Handle iff the expected data type is "jsonp" or we have a parameter to set
    if (jsonProp || s.dataTypes[0] === "jsonp") {
      // Get callback name, remembering preexisting value associated with it
      callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;

      // Insert callback into url or form data
      if (jsonProp) {
        s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
      } else if (s.jsonp !== false) {
        s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
      }

      // Use data converter to retrieve json after script execution
      s.converters["script json"] = function () {
        if (!responseContainer) {
          jQuery.error(callbackName + " was not called");
        }
        return responseContainer[0];
      };

      // Force json dataType
      s.dataTypes[0] = "json";

      // Install callback
      overwritten = window[callbackName];
      window[callbackName] = function () {
        responseContainer = arguments;
      };

      // Clean-up function (fires after converters)
      jqXHR.always(function () {
        // If previous value didn't exist - remove it
        if (overwritten === undefined) {
          jQuery(window).removeProp(callbackName);

          // Otherwise restore preexisting value
        } else {
          window[callbackName] = overwritten;
        }

        // Save back as free
        if (s[callbackName]) {
          // Make sure that re-using the options doesn't screw things around
          s.jsonpCallback = originalSettings.jsonpCallback;

          // Save the callback name for future use
          oldCallbacks.push(callbackName);
        }

        // Call if it was a function and we have a response
        if (responseContainer && isFunction(overwritten)) {
          overwritten(responseContainer[0]);
        }
        responseContainer = overwritten = undefined;
      });

      // Delegate to script
      return "script";
    }
  });

  // Support: Safari 8 only
  // In Safari 8 documents created via document.implementation.createHTMLDocument
  // collapse sibling forms: the second one becomes a child of the first one.
  // Because of that, this security measure has to be disabled in Safari 8.
  // https://bugs.webkit.org/show_bug.cgi?id=137337
  support.createHTMLDocument = function () {
    var body = document.implementation.createHTMLDocument("").body;
    body.innerHTML = "<form></form><form></form>";
    return body.childNodes.length === 2;
  }();

  // Argument "data" should be string of html
  // context (optional): If specified, the fragment will be created in this context,
  // defaults to document
  // keepScripts (optional): If true, will include scripts passed in the html string
  jQuery.parseHTML = function (data, context, keepScripts) {
    if (typeof data !== "string") {
      return [];
    }
    if (typeof context === "boolean") {
      keepScripts = context;
      context = false;
    }
    var base, parsed, scripts;
    if (!context) {
      // Stop scripts or inline event handlers from being executed immediately
      // by using document.implementation
      if (support.createHTMLDocument) {
        context = document.implementation.createHTMLDocument("");

        // Set the base href for the created document
        // so any parsed elements with URLs
        // are based on the document's URL (gh-2965)
        base = context.createElement("base");
        base.href = document.location.href;
        context.head.appendChild(base);
      } else {
        context = document;
      }
    }
    parsed = rsingleTag.exec(data);
    scripts = !keepScripts && [];

    // Single tag
    if (parsed) {
      return [context.createElement(parsed[1])];
    }
    parsed = buildFragment([data], context, scripts);
    if (scripts && scripts.length) {
      jQuery(scripts).remove();
    }
    return jQuery.merge([], parsed.childNodes);
  };

  /**
   * Load a url into a page
   */
  jQuery.fn.load = function (url, params, callback) {
    var selector,
      type,
      response,
      self = this,
      off = url.indexOf(" ");
    if (off > -1) {
      selector = stripAndCollapse(url.slice(off));
      url = url.slice(0, off);
    }

    // If it's a function
    if (isFunction(params)) {
      // We assume that it's the callback
      callback = params;
      params = undefined;

      // Otherwise, build a param string
    } else if (params && typeof params === "object") {
      type = "POST";
    }

    // If we have elements to modify, make the request
    if (self.length > 0) {
      jQuery.ajax({
        url: url,
        // If "type" variable is undefined, then "GET" method will be used.
        // Make value of this field explicit since
        // user can override it through ajaxSetup method
        type: type || "GET",
        dataType: "html",
        data: params
      }).done(function (responseText) {
        // Save response for use in complete callback
        response = arguments;
        self.html(selector ?
        // If a selector was specified, locate the right elements in a dummy div
        // Exclude scripts to avoid IE 'Permission Denied' errors
        jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
        // Otherwise use the full result
        responseText);

        // If the request succeeds, this function gets "data", "status", "jqXHR"
        // but they are ignored because response was set above.
        // If it fails, this function gets "jqXHR", "status", "error"
      }).always(callback && function (jqXHR, status) {
        self.each(function () {
          callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
        });
      });
    }
    return this;
  };
  jQuery.expr.pseudos.animated = function (elem) {
    return jQuery.grep(jQuery.timers, function (fn) {
      return elem === fn.elem;
    }).length;
  };
  jQuery.offset = {
    setOffset: function (elem, options, i) {
      var curPosition,
        curLeft,
        curCSSTop,
        curTop,
        curOffset,
        curCSSLeft,
        calculatePosition,
        position = jQuery.css(elem, "position"),
        curElem = jQuery(elem),
        props = {};

      // Set position first, in-case top/left are set even on static elem
      if (position === "static") {
        elem.style.position = "relative";
      }
      curOffset = curElem.offset();
      curCSSTop = jQuery.css(elem, "top");
      curCSSLeft = jQuery.css(elem, "left");
      calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;

      // Need to be able to calculate position if either
      // top or left is auto and position is either absolute or fixed
      if (calculatePosition) {
        curPosition = curElem.position();
        curTop = curPosition.top;
        curLeft = curPosition.left;
      } else {
        curTop = parseFloat(curCSSTop) || 0;
        curLeft = parseFloat(curCSSLeft) || 0;
      }
      if (isFunction(options)) {
        // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
        options = options.call(elem, i, jQuery.extend({}, curOffset));
      }
      if (options.top != null) {
        props.top = options.top - curOffset.top + curTop;
      }
      if (options.left != null) {
        props.left = options.left - curOffset.left + curLeft;
      }
      if ("using" in options) {
        options.using.call(elem, props);
      } else {
        curElem.css(props);
      }
    }
  };
  jQuery.fn.extend({
    // offset() relates an element's border box to the document origin
    offset: function (options) {
      // Preserve chaining for setter
      if (arguments.length) {
        return options === undefined ? this : this.each(function (i) {
          jQuery.offset.setOffset(this, options, i);
        });
      }
      var rect,
        win,
        elem = this[0];
      if (!elem) {
        return;
      }

      // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
      // Support: IE <=11 only
      // Running getBoundingClientRect on a
      // disconnected node in IE throws an error
      if (!elem.getClientRects().length) {
        return {
          top: 0,
          left: 0
        };
      }

      // Get document-relative position by adding viewport scroll to viewport-relative gBCR
      rect = elem.getBoundingClientRect();
      win = elem.ownerDocument.defaultView;
      return {
        top: rect.top + win.pageYOffset,
        left: rect.left + win.pageXOffset
      };
    },
    // position() relates an element's margin box to its offset parent's padding box
    // This corresponds to the behavior of CSS absolute positioning
    position: function () {
      if (!this[0]) {
        return;
      }
      var offsetParent,
        offset,
        doc,
        elem = this[0],
        parentOffset = {
          top: 0,
          left: 0
        };

      // position:fixed elements are offset from the viewport, which itself always has zero offset
      if (jQuery.css(elem, "position") === "fixed") {
        // Assume position:fixed implies availability of getBoundingClientRect
        offset = elem.getBoundingClientRect();
      } else {
        offset = this.offset();

        // Account for the *real* offset parent, which can be the document or its root element
        // when a statically positioned element is identified
        doc = elem.ownerDocument;
        offsetParent = elem.offsetParent || doc.documentElement;
        while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
          offsetParent = offsetParent.parentNode;
        }
        if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
          // Incorporate borders into its offset, since they are outside its content origin
          parentOffset = jQuery(offsetParent).offset();
          parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
          parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
        }
      }

      // Subtract parent offsets and element margins
      return {
        top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
        left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
      };
    },
    // This method will return documentElement in the following cases:
    // 1) For the element inside the iframe without offsetParent, this method will return
    //    documentElement of the parent window
    // 2) For the hidden or detached element
    // 3) For body or html element, i.e. in case of the html node - it will return itself
    //
    // but those exceptions were never presented as a real life use-cases
    // and might be considered as more preferable results.
    //
    // This logic, however, is not guaranteed and can change at any point in the future
    offsetParent: function () {
      return this.map(function () {
        var offsetParent = this.offsetParent;
        while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
          offsetParent = offsetParent.offsetParent;
        }
        return offsetParent || documentElement;
      });
    }
  });

  // Create scrollLeft and scrollTop methods
  jQuery.each({
    scrollLeft: "pageXOffset",
    scrollTop: "pageYOffset"
  }, function (method, prop) {
    var top = "pageYOffset" === prop;
    jQuery.fn[method] = function (val) {
      return access(this, function (elem, method, val) {
        // Coalesce documents and windows
        var win;
        if (isWindow(elem)) {
          win = elem;
        } else if (elem.nodeType === 9) {
          win = elem.defaultView;
        }
        if (val === undefined) {
          return win ? win[prop] : elem[method];
        }
        if (win) {
          win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
        } else {
          elem[method] = val;
        }
      }, method, val, arguments.length);
    };
  });

  // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  // Add the top/left cssHooks using jQuery.fn.position
  // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  // getComputedStyle returns percent when specified for top/left/bottom/right;
  // rather than make the css module depend on the offset module, just check for it here
  jQuery.each(["top", "left"], function (_i, prop) {
    jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
      if (computed) {
        computed = curCSS(elem, prop);

        // If curCSS returns percentage, fallback to offset
        return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
      }
    });
  });

  // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  jQuery.each({
    Height: "height",
    Width: "width"
  }, function (name, type) {
    jQuery.each({
      padding: "inner" + name,
      content: type,
      "": "outer" + name
    }, function (defaultExtra, funcName) {
      // Margin is only for outerHeight, outerWidth
      jQuery.fn[funcName] = function (margin, value) {
        var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
          extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
        return access(this, function (elem, type, value) {
          var doc;
          if (isWindow(elem)) {
            // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
            return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
          }

          // Get document width or height
          if (elem.nodeType === 9) {
            doc = elem.documentElement;

            // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
            // whichever is greatest
            return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
          }
          return value === undefined ?
          // Get width or height on the element, requesting but not forcing parseFloat
          jQuery.css(elem, type, extra) :
          // Set width or height on the element
          jQuery.style(elem, type, value, extra);
        }, type, chainable ? margin : undefined, chainable);
      };
    });
  });
  jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (_i, type) {
    jQuery.fn[type] = function (fn) {
      return this.on(type, fn);
    };
  });
  jQuery.fn.extend({
    bind: function (types, data, fn) {
      return this.on(types, null, data, fn);
    },
    unbind: function (types, fn) {
      return this.off(types, null, fn);
    },
    delegate: function (selector, types, data, fn) {
      return this.on(types, selector, data, fn);
    },
    undelegate: function (selector, types, fn) {
      // ( namespace ) or ( selector, types [, fn] )
      return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
    },
    hover: function (fnOver, fnOut) {
      return this.on("mouseenter", fnOver).on("mouseleave", fnOut || fnOver);
    }
  });
  jQuery.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function (_i, name) {
    // Handle event binding
    jQuery.fn[name] = function (data, fn) {
      return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
    };
  });

  // Support: Android <=4.0 only
  // Make sure we trim BOM and NBSP
  // Require that the "whitespace run" starts from a non-whitespace
  // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
  var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;

  // Bind a function to a context, optionally partially applying any
  // arguments.
  // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  // However, it is not slated for removal any time soon
  jQuery.proxy = function (fn, context) {
    var tmp, args, proxy;
    if (typeof context === "string") {
      tmp = fn[context];
      context = fn;
      fn = tmp;
    }

    // Quick check to determine if target is callable, in the spec
    // this throws a TypeError, but we will just return undefined.
    if (!isFunction(fn)) {
      return undefined;
    }

    // Simulated bind
    args = slice.call(arguments, 2);
    proxy = function () {
      return fn.apply(context || this, args.concat(slice.call(arguments)));
    };

    // Set the guid of unique handler to the same of original handler, so it can be removed
    proxy.guid = fn.guid = fn.guid || jQuery.guid++;
    return proxy;
  };
  jQuery.holdReady = function (hold) {
    if (hold) {
      jQuery.readyWait++;
    } else {
      jQuery.ready(true);
    }
  };
  jQuery.isArray = Array.isArray;
  jQuery.parseJSON = JSON.parse;
  jQuery.nodeName = nodeName;
  jQuery.isFunction = isFunction;
  jQuery.isWindow = isWindow;
  jQuery.camelCase = camelCase;
  jQuery.type = toType;
  jQuery.now = Date.now;
  jQuery.isNumeric = function (obj) {
    // As of jQuery 3.0, isNumeric is limited to
    // strings and numbers (primitives or objects)
    // that can be coerced to finite numbers (gh-2662)
    var type = jQuery.type(obj);
    return (type === "number" || type === "string") &&
    // parseFloat NaNs numeric-cast false positives ("")
    // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
    // subtraction forces infinities to NaN
    !isNaN(obj - parseFloat(obj));
  };
  jQuery.trim = function (text) {
    return text == null ? "" : (text + "").replace(rtrim, "$1");
  };
  var
    // Map over jQuery in case of overwrite
    _jQuery = window.jQuery,
    // Map over the $ in case of overwrite
    _$ = window.$;
  jQuery.noConflict = function (deep) {
    if (window.$ === jQuery) {
      window.$ = _$;
    }
    if (deep && window.jQuery === jQuery) {
      window.jQuery = _jQuery;
    }
    return jQuery;
  };

  // Expose jQuery and $ identifiers, even in AMD
  // (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)
  // and CommonJS for browser emulators (trac-13566)
  if (typeof noGlobal === "undefined") {
    window.jQuery = window.$ = jQuery;
  }
  return jQuery;
});
});

//
var script$69 = {
  name: 'XmlTextDialogRender',
  props: {
    content: {
      type: String,
      default: ''
    },
    textstyle: {
      type: String,
      default: 'A'
    },
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    projectId: {
      type: String,
      default: ''
    }
  },
  watch: {
    content() {
      this.show = false;
      this.$nextTick(() => {
        this.show = true;
      });
    }
  },
  data() {
    return {
      show: true,
      source: '',
      blockId: `blockId${v4()}`
    };
  },
  created() {
    this.source = this.$route.query.pageType;
  },
  mounted() {
    let _this = this;
    this.$nextTick(() => {
      let containerSelector = `#${this.blockId}`;
      jquery(containerSelector).on('click', 'img', function (e) {
        let target = jquery(e.target);
        console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', '事件对象', e, target, target.index('img[preview]'));
        let title = target.attr('alt');
        let src = target.attr('src');
        let notallowgallery = target.attr('notallowgallery');
        if (notallowgallery) {
          return;
        }
        _this.$hevueImgPreview({
          multiple: true,
          nowImgIndex: 0,
          imgList: [{
            url: src,
            title: title
          }]
        });
      });
    });
  },
  methods: {
    formatImg(str) {
      if (str) {
        let data = str.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, p1) => {
          if (match.indexOf('style') !== -1) {
            let src = this.resourceBasisPath + p1.split('./')[1];
            let image = match.indexOf('http') !== -1 ? match : match.replace(p1, src);
            return image.split('style="')[0] + 'style="max-width:100% !important;' + image.split('style="')[1];
          } else {
            return `<img src='${p1.indexOf('http') > -1 ? p1 : this.resourceBasisPath + p1.split('./')[1]}' style="max-width:100%;" />`;
          }
        });
        return data;
      }
    }
  }
};

var __$_require_static_images_leaflet_icons_scroll_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAAPCAYAAAChtYCSAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QjkxMUYzODUxMkZFMTFFRThGNzY5QzE0NjRGQzZERjciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QjkxMUYzODYxMkZFMTFFRThGNzY5QzE0NjRGQzZERjciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpCOTExRjM4MzEyRkUxMUVFOEY3NjlDMTQ2NEZDNkRGNyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpCOTExRjM4NDEyRkUxMUVFOEY3NjlDMTQ2NEZDNkRGNyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgx/R5cAAAJ7SURBVHja7JpPaNNQHMe/L03TbuqUiehlKv456EE8KV5Ehn/Ag3/w4k1PXibuIljcwIKCiiAoO+lFRRARke2qKCh69KLzNIYbKG6Msbaza9o0z99LGywleYngpenvA1/ya36/95L8ml9e8hJz7Gw/dBzJvfTNa6QcKQuG6VwqpNuk/OtbZyKDTdIQaZh0ivStPSCVtnxzhJTm/DIdjrrAX1UFoonZT3pGuiNoBCmSsYZUJ82EtThx4+02zi2TFCZGB6dDXCnSlqZdNJvF4TtCiyCTXcVZZZJEnAt+nxm3N6tnNaeU6TpiF0gmywXCdGGBbNp5AFIKzE19AoQBq3cdhBAkdcclyecCroRl/Z28ki0diIBOZYtPhsRE9SVDfreujxsDTRtothlnvS4PUQT1234MQccYN7e6PsNyjojcIaCt1OxPnP//f+Quat/b2/b0bWzYdReuW/XOd8NMo2aX4dgl9A/sgZASojA/KyulRbwYGcSx4cfYvu84yoV5SNelxg7qTpVUw/rNu/hywiSGpZ9TSJkWYKS8AUEVR+/aDViYmcTz3EEcHXqIgb2HYH4eH4PZnMqdfPMEP75+gF0pwa051JaqykjTKCJx+OI9ziqTGD4+vU7ntuEViEGieyVvuVJY8PyzX95jefEX1DRvYzQStJDhg92FR985q0xieHB+6z8+pEv9naBdLnBWme57SI8baFeKnC2mKwtkmeTP4c6RfgcFOnaZ36QzSWJa41Nv0tU07pJ6BrlExmXSOdK79siT+Ve+WQV/i8UkgxrJGs+fDvPvJk2Q7qoR5H5TgTi1Fd+8SbpCynB+mQ7GRuNrXh3qo90dyvgjwAA2ZLfYDdkYOgAAAABJRU5ErkJggg==";

function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
  if (typeof shadowMode !== 'boolean') {
    createInjectorSSR = createInjector;
    createInjector = shadowMode;
    shadowMode = false;
  }
  // Vue.extend constructor export interop.
  const options = typeof script === 'function' ? script.options : script;
  // render functions
  if (template && template.render) {
    options.render = template.render;
    options.staticRenderFns = template.staticRenderFns;
    options._compiled = true;
    // functional template
    if (isFunctionalTemplate) {
      options.functional = true;
    }
  }
  // scopedId
  if (scopeId) {
    options._scopeId = scopeId;
  }
  let hook;
  if (moduleIdentifier) {
    // server build
    hook = function (context) {
      // 2.3 injection
      context = context ||
      // cached call
      this.$vnode && this.$vnode.ssrContext ||
      // stateful
      this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__;
      }
      // inject component styles
      if (style) {
        style.call(this, createInjectorSSR(context));
      }
      // register component module identifier for async chunk inference
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier);
      }
    };
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook;
  } else if (style) {
    hook = shadowMode ? function (context) {
      style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
    } : function (context) {
      style.call(this, createInjector(context));
    };
  }
  if (hook) {
    if (options.functional) {
      // register for functional component in vue file
      const originalRender = options.render;
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context);
        return originalRender(h, context);
      };
    } else {
      // inject component registration as beforeCreate hook
      const existing = options.beforeCreate;
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
    }
  }
  return script;
}

/* script */
const __vue_script__$69 = script$69;
var __vue_render__$68 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { attrs: { id: _vm.blockId } }, [
    _vm.textstyle == "D"
      ? _c("div", [
          _c("div", { staticClass: "style-body-boxA" }, [
            _c("div", { staticClass: "style-wrapper" }, [
              _c("div", { staticClass: "top-line" }),
              _vm._v(" "),
              _c("div", {
                staticClass: "native-html-wrapper",
                domProps: { innerHTML: _vm._s(_vm.formatImg(_vm.content)) },
              }),
              _vm._v(" "),
              _c("div", { staticClass: "bottom-margin" }),
              _vm._v(" "),
              _c("div", { staticClass: "bottom-triangle" }),
            ]),
          ]),
        ])
      : _vm._e(),
    _vm._v(" "),
    _vm.textstyle == "A"
      ? _c("div", [
          _c("div", { staticClass: "style-body-boxA" }, [
            _c("div", { staticClass: "top-bg" }),
            _vm._v(" "),
            _c("div", {
              staticClass: "style-content-box",
              domProps: { innerHTML: _vm._s(_vm.formatImg(_vm.content)) },
            }),
            _vm._v(" "),
            _c("div", { staticClass: "paper-clip-icon" }),
            _vm._v(" "),
            _c("div", { staticClass: "style-content-bg" }),
          ]),
        ])
      : _vm._e(),
    _vm._v(" "),
    _vm.textstyle == "B"
      ? _c("div", [
          _c("div", { staticClass: "style-body-boxB" }, [
            _c("div", { staticClass: "top-bg" }),
            _vm._v(" "),
            _c("div", {
              staticClass: "style-content-box",
              domProps: { innerHTML: _vm._s(_vm.formatImg(_vm.content)) },
            }),
            _vm._v(" "),
            _c("div", { staticClass: "style-content-bg" }),
            _vm._v(" "),
            _vm._m(0),
          ]),
        ])
      : _vm._e(),
    _vm._v(" "),
    _vm.textstyle == "C"
      ? _c("div", [
          _c("div", { staticClass: "style-body-boxC" }, [
            _c("div", { staticClass: "top-bg" }),
            _vm._v(" "),
            _c("div", {
              staticClass: "style-content-box",
              domProps: { innerHTML: _vm._s(_vm.formatImg(_vm.content)) },
            }),
            _vm._v(" "),
            _c("div", { staticClass: "style-content-bg" }),
            _vm._v(" "),
            _vm._m(1),
          ]),
        ])
      : _vm._e(),
    _vm._v(" "),
    _vm.textstyle == "E"
      ? _c("div", [
          _c("div", { staticClass: "style-body-boxE" }, [
            _c("div", { staticClass: "scroll-top" }, [
              _c("img", {
                style: _vm.pageType == "pc" ? "height:20px" : "",
                attrs: {
                  src: __$_require_static_images_leaflet_icons_scroll_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", {
              staticClass: "style-content-box",
              domProps: { innerHTML: _vm._s(_vm.formatImg(_vm.content)) },
            }),
            _vm._v(" "),
            _c("div", { staticClass: "scroll-bottom" }, [
              _c("img", {
                style: _vm.pageType == "pc" ? "height:20px" : "",
                attrs: {
                  src: __$_require_static_images_leaflet_icons_scroll_png__,
                  alt: "",
                },
              }),
            ]),
          ]),
        ])
      : _vm._e(),
  ])
};
var __vue_staticRenderFns__$68 = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "top-style-box" }, [
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
    ])
  },
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "top-style-box" }, [
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
      _vm._v(" "),
      _c("div"),
    ])
  },
];
__vue_render__$68._withStripped = true;

  /* style */
  const __vue_inject_styles__$69 = undefined;
  /* scoped */
  const __vue_scope_id__$69 = "data-v-387c0e8e";
  /* module identifier */
  const __vue_module_identifier__$69 = undefined;
  /* functional template */
  const __vue_is_functional_template__$69 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$69 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$68, staticRenderFns: __vue_staticRenderFns__$68 },
    __vue_inject_styles__$69,
    __vue_script__$69,
    __vue_scope_id__$69,
    __vue_is_functional_template__$69,
    __vue_module_identifier__$69,
    false,
    undefined,
    undefined,
    undefined
  );

const reHtml = str => {
  return str ? str.replace(/&((g|l|quo|ldquo|rdquo)t|amp|#39|nbsp);/g, function (m) {
    return {
      '&lt;': '<',
      '&amp;': '&',
      '&quot;': '"',
      '&ldquo;': '“',
      '&rdquo;': '”',
      '&gt;': '>',
      '&#39;': "'",
      '&nbsp;': ' '
    }[m];
  }) : '';
};
class MagicLink extends HTMLElement {
  static get observedAttributes() {
    return ['data-plaintext', 'data-type', 'data-title', 'data-content', 'data-isplaying'];
  }
  constructor() {
    super();
    this.createShadow();
    setTimeout(() => {
      this.insertContent();
    });
  }
  createShadow() {
    this.shadow = this.attachShadow({
      mode: 'closed'
    });
  }
  insertContent() {
    const type = this.getAttribute('data-type');
    const title = this.getAttribute('data-title');
    const wrapper = document.createElement('span');
    wrapper.setAttribute('class', `magic-link magic-link--${type}`);
    wrapper.setAttribute('contenteditable', 'false');
    wrapper.innerHTML = reHtml(title);
    const style = document.createElement('style');
    // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'WCE内部样式连接',style.isConnected)

    style.textContent = `
      p {
        margin: 0;
      }
      .magic-link {
        display: inline;
        // font-size:16px;
        font-weight: normal;
        font-style: normal;
        text-align: left;
        text-indent: initial;
        // color: #6883FA;
        color: #00F;
        transition: all 240ms ease-in-out;
        cursor: pointer;
      }
      .magic-link span:hover {
        text-decoration: underline;
      }
      .wifi-symbol {
        display: inline-block;
        width: 21px;
        height: 21px;
        box-sizing: border-box;
        overflow: hidden;
        vertical-align: text-bottom;
        white-space: initial;
      }
      .wifi-symbol svg {
        display:block;
      }
      .wifi-symbol.playing .play-path {
        animation: fade-in 900ms cubic-bezier(0.43, 0.2, 0.56, 0.94) infinite;
      }
      @keyframes fadeInOut {
        0% {
          opacity: 0;
        }
        100% {
          opacity: 1;
        }
      }
    `;
    this.shadow.appendChild(style);
    this.shadow.appendChild(wrapper);
    if (type === 'audio') {
      let audioExtra = document.createElement('div');
      audioExtra.setAttribute('class', 'wifi-symbol');
      audioExtra.innerHTML = `
      <svg width="21" height="21" viewBox="-3 -5 50 64">
        <defs>
          <style>
            .play-path {fill:#3fa9f5;}
            @keyframes fade-in{
              to {opacity: 0;}
            }
            .play-path:nth-of-type(2){
              animation-delay: 0.25s !important;
            }
            .play-path:nth-of-type(3){
              animation-delay: 0.5s !important;
            }
          </style>
        </defs>
        <path class="play-path" d="M12.69,39.57a12,12,0,0,0-1.3-21.73L1.18,28.06Z" />
        <path class="play-path" d="M24,29a17,17,0,0,1-7.67,14.2l3.59,3.6A22,22,0,0,0,18.8,10.44l-3.65,3.64A17,17,0,0,1,24,29Z" />
        <path class="play-path" d="M26.4,2.56,22.83,6.13a27,27,0,0,1,.2,43.6l3.56,3.56A32,32,0,0,0,26.4,2.56Z" />
      </svg>
      `;
      this.shadow.appendChild(audioExtra);
    }
  }
  updateContent({
    key,
    oldValue,
    newValue
  }) {
    let _this = this;
    // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'wce更新逻辑',[this],this.shadow)
    const type = this.getAttribute('data-type');
    this.getAttribute('data-title');
    const content = this.getAttribute('data-content');
    if (oldValue === null && newValue) {
      // 首次加载
      if (type === 'leaflet' && key === 'data-title') {
        setTimeout(() => {
          const links = this.shadow.querySelectorAll('.magic-link a');
          this.shadow.querySelector('.magic-link.magic-link--leaflet');
          // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'wcce leflet', links, this.shadow)
          links.forEach((elem, index) => {
            elem.addEventListener('click', e => {
              // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'link内点击',e,elem)
              _this.shadow.dispatchEvent(new CustomEvent('openTarget', {
                detail: {
                  aid: elem.id,
                  aindex: index,
                  elem,
                  targets: content
                }
              }));
            });
          });
        }, 50);
      }
    }
    if (oldValue !== null && newValue) {
      // 后续更新
      if (type === 'audio') {
        if (key === 'data-isplaying') {
          let target = this.shadow.querySelector('.wifi-symbol');
          let classNames = newValue === 'true' ? 'wifi-symbol playing' : 'wifi-symbol';
          target.setAttribute('class', classNames);
          // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF", 'target', [target])
        }
      }
    }
  }

  //生命周期 - 首次被插入文档 DOM 时
  connectedCallback() {
    // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'WCE嵌入',)
    // updateContent(this);
  }

  //生命周期 - 从文档 DOM 中删除时
  disconnectedCallback() {
    // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'WCE销毁',)
  }

  //生命周期 - 被移动到新的文档时
  adoptedCallback() {
    // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'WCE迁移',)
  }

  //生命周期 - 增加、删除、修改自身属性时
  attributeChangedCallback(key, oldValue, newValue) {
    // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'WCE更新',{key, oldValue, newValue})
    this.updateContent({
      key,
      oldValue,
      newValue
    });
  }
}

/* istanbul ignore next */
const isServer = Vue.prototype.$isServer;
const SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
const MOZ_HACK_REGEXP = /^moz([A-Z])/;
const ieVersion = isServer ? 0 : Number(document.documentMode);

/* istanbul ignore next */
const trim$4 = function (string) {
  return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
};
/* istanbul ignore next */
const camelCase$1 = function (name) {
  return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
    return offset ? letter.toUpperCase() : letter;
  }).replace(MOZ_HACK_REGEXP, 'Moz$1');
};

/* istanbul ignore next */
const on$1 = function () {
  if (!isServer && document.addEventListener) {
    return function (element, event, handler) {
      if (element && event && handler) {
        element.addEventListener(event, handler, false);
      }
    };
  } else {
    return function (element, event, handler) {
      if (element && event && handler) {
        element.attachEvent('on' + event, handler);
      }
    };
  }
}();

/* istanbul ignore next */
const off$1 = function () {
  if (!isServer && document.removeEventListener) {
    return function (element, event, handler) {
      if (element && event) {
        element.removeEventListener(event, handler, false);
      }
    };
  } else {
    return function (element, event, handler) {
      if (element && event) {
        element.detachEvent('on' + event, handler);
      }
    };
  }
}();

/* istanbul ignore next */
function hasClass$1(el, cls) {
  if (!el || !cls) return false;
  if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
  if (el.classList) {
    return el.classList.contains(cls);
  } else {
    return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
  }
}

/* istanbul ignore next */
function addClass$1(el, cls) {
  if (!el) return;
  var curClass = el.className;
  var classes = (cls || '').split(' ');
  for (var i = 0, j = classes.length; i < j; i++) {
    var clsName = classes[i];
    if (!clsName) continue;
    if (el.classList) {
      el.classList.add(clsName);
    } else if (!hasClass$1(el, clsName)) {
      curClass += ' ' + clsName;
    }
  }
  if (!el.classList) {
    el.setAttribute('class', curClass);
  }
}

/* istanbul ignore next */
function removeClass$1(el, cls) {
  if (!el || !cls) return;
  var classes = cls.split(' ');
  var curClass = ' ' + el.className + ' ';
  for (var i = 0, j = classes.length; i < j; i++) {
    var clsName = classes[i];
    if (!clsName) continue;
    if (el.classList) {
      el.classList.remove(clsName);
    } else if (hasClass$1(el, clsName)) {
      curClass = curClass.replace(' ' + clsName + ' ', ' ');
    }
  }
  if (!el.classList) {
    el.setAttribute('class', trim$4(curClass));
  }
}

/* istanbul ignore next */
const getStyle$1 = ieVersion < 9 ? function (element, styleName) {
  if (isServer) return;
  if (!element || !styleName) return null;
  styleName = camelCase$1(styleName);
  if (styleName === 'float') {
    styleName = 'styleFloat';
  }
  try {
    switch (styleName) {
      case 'opacity':
        try {
          return element.filters.item('alpha').opacity / 100;
        } catch (e) {
          return 1.0;
        }
      default:
        return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
    }
  } catch (e) {
    return element.style[styleName];
  }
} : function (element, styleName) {
  if (isServer) return;
  if (!element || !styleName) return null;
  styleName = camelCase$1(styleName);
  if (styleName === 'float') {
    styleName = 'cssFloat';
  }
  try {
    var computed = document.defaultView.getComputedStyle(element, '');
    return element.style[styleName] || computed ? computed[styleName] : null;
  } catch (e) {
    return element.style[styleName];
  }
};
const isScroll = (el, vertical) => {
  if (isServer) return;
  const determinedDirection = vertical !== null && vertical !== undefined;
  const overflow = determinedDirection ? vertical ? getStyle$1(el, 'overflow-y') : getStyle$1(el, 'overflow-x') : getStyle$1(el, 'overflow');
  return overflow.match(/(scroll|auto|overlay)/);
};
const getScrollContainer = (el, vertical) => {
  if (isServer) return;
  let parent = el;
  while (parent) {
    if ([window, document, document.documentElement].includes(parent)) {
      return window;
    }
    if (isScroll(parent, vertical)) {
      return parent;
    }
    parent = parent.parentNode;
  }
  return parent;
};
const isInContainer = (el, container) => {
  if (isServer || !el || !container) return false;
  const elRect = el.getBoundingClientRect();
  let containerRect;
  if ([window, document, document.documentElement, null, undefined].includes(container)) {
    containerRect = {
      top: 0,
      right: window.innerWidth,
      bottom: window.innerHeight,
      left: 0
    };
  } else {
    containerRect = container.getBoundingClientRect();
  }
  return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
};

function isString$2(obj) {
  return Object.prototype.toString.call(obj) === '[object String]';
}
function isHtmlElement(node) {
  return node && node.nodeType === Node.ELEMENT_NODE;
}
if (typeof /./ !== 'function' && typeof Int8Array !== 'object' && (Vue.prototype.$isServer || typeof document.childNodes !== 'function')) ;

const hasOwnProperty$2 = Object.prototype.hasOwnProperty;
function hasOwn$1(obj, key) {
  return hasOwnProperty$2.call(obj, key);
}
const isFirefox = function () {
  return !Vue.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
};
function rafThrottle(fn) {
  let locked = false;
  return function (...args) {
    if (locked) return;
    locked = true;
    window.requestAnimationFrame(_ => {
      fn.apply(this, args);
      locked = false;
    });
  };
}

let hasModal = false;
let hasInitZIndex = false;
let zIndex$1;
const getModal = function () {
  if (Vue.prototype.$isServer) return;
  let modalDom = PopupManager.modalDom;
  if (modalDom) {
    hasModal = true;
  } else {
    hasModal = false;
    modalDom = document.createElement('div');
    PopupManager.modalDom = modalDom;
    modalDom.addEventListener('touchmove', function (event) {
      event.preventDefault();
      event.stopPropagation();
    });
    modalDom.addEventListener('click', function () {
      PopupManager.doOnModalClick && PopupManager.doOnModalClick();
    });
  }
  return modalDom;
};
const instances$2 = {};
const PopupManager = {
  modalFade: true,
  getInstance: function (id) {
    return instances$2[id];
  },
  register: function (id, instance) {
    if (id && instance) {
      instances$2[id] = instance;
    }
  },
  deregister: function (id) {
    if (id) {
      instances$2[id] = null;
      delete instances$2[id];
    }
  },
  nextZIndex: function () {
    return PopupManager.zIndex++;
  },
  modalStack: [],
  doOnModalClick: function () {
    const topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
    if (!topItem) return;
    const instance = PopupManager.getInstance(topItem.id);
    if (instance && instance.closeOnClickModal) {
      instance.close();
    }
  },
  openModal: function (id, zIndex, dom, modalClass, modalFade) {
    if (Vue.prototype.$isServer) return;
    if (!id || zIndex === undefined) return;
    this.modalFade = modalFade;
    const modalStack = this.modalStack;
    for (let i = 0, j = modalStack.length; i < j; i++) {
      const item = modalStack[i];
      if (item.id === id) {
        return;
      }
    }
    const modalDom = getModal();
    addClass$1(modalDom, 'v-modal');
    if (this.modalFade && !hasModal) {
      addClass$1(modalDom, 'v-modal-enter');
    }
    if (modalClass) {
      let classArr = modalClass.trim().split(/\s+/);
      classArr.forEach(item => addClass$1(modalDom, item));
    }
    setTimeout(() => {
      removeClass$1(modalDom, 'v-modal-enter');
    }, 200);
    if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
      dom.parentNode.appendChild(modalDom);
    } else {
      document.body.appendChild(modalDom);
    }
    if (zIndex) {
      modalDom.style.zIndex = zIndex;
    }
    modalDom.tabIndex = 0;
    modalDom.style.display = '';
    this.modalStack.push({
      id: id,
      zIndex: zIndex,
      modalClass: modalClass
    });
  },
  closeModal: function (id) {
    const modalStack = this.modalStack;
    const modalDom = getModal();
    if (modalStack.length > 0) {
      const topItem = modalStack[modalStack.length - 1];
      if (topItem.id === id) {
        if (topItem.modalClass) {
          let classArr = topItem.modalClass.trim().split(/\s+/);
          classArr.forEach(item => removeClass$1(modalDom, item));
        }
        modalStack.pop();
        if (modalStack.length > 0) {
          modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
        }
      } else {
        for (let i = modalStack.length - 1; i >= 0; i--) {
          if (modalStack[i].id === id) {
            modalStack.splice(i, 1);
            break;
          }
        }
      }
    }
    if (modalStack.length === 0) {
      if (this.modalFade) {
        addClass$1(modalDom, 'v-modal-leave');
      }
      setTimeout(() => {
        if (modalStack.length === 0) {
          if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
          modalDom.style.display = 'none';
          PopupManager.modalDom = undefined;
        }
        removeClass$1(modalDom, 'v-modal-leave');
      }, 200);
    }
  }
};
Object.defineProperty(PopupManager, 'zIndex', {
  configurable: true,
  get() {
    if (!hasInitZIndex) {
      zIndex$1 = zIndex$1 || (Vue.prototype.$ELEMENT || {}).zIndex || 2000;
      hasInitZIndex = true;
    }
    return zIndex$1;
  },
  set(value) {
    zIndex$1 = value;
  }
});
const getTopPopup = function () {
  if (Vue.prototype.$isServer) return;
  if (PopupManager.modalStack.length > 0) {
    const topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
    if (!topPopup) return;
    const instance = PopupManager.getInstance(topPopup.id);
    return instance;
  }
};
if (!Vue.prototype.$isServer) {
  // handle `esc` key when the popup is shown
  window.addEventListener('keydown', function (event) {
    if (event.keyCode === 27) {
      const topPopup = getTopPopup();
      if (topPopup && topPopup.closeOnPressEscape) {
        topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
      }
    }
  });
}

//
const Mode = {
  CONTAIN: {
    name: 'contain',
    icon: 'el-icon-full-screen'
  },
  ORIGINAL: {
    name: 'original',
    icon: 'el-icon-c-scale-to-original'
  }
};
const mousewheelEventName = isFirefox() ? 'DOMMouseScroll' : 'mousewheel';
var script$68 = {
  name: 'XmlImageViewer',
  props: {
    urlList: {
      type: Array,
      default: () => []
    },
    zIndex: {
      type: Number,
      default: 2000
    },
    onSwitch: {
      type: Function,
      default: () => {}
    },
    onClose: {
      type: Function,
      default: () => {}
    },
    initialIndex: {
      type: Number,
      default: 0
    },
    appendToBody: {
      type: Boolean,
      default: true
    },
    maskClosable: {
      type: Boolean,
      default: true
    },
    title: {
      type: Array,
      default: () => []
    },
    contents: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      index: this.initialIndex,
      isShow: false,
      infinite: true,
      loading: false,
      mode: Mode.CONTAIN,
      transform: {
        scale: 1,
        deg: 0,
        offsetX: 0,
        offsetY: 0,
        enableTransition: false
      },
      contentExpand: false,
      ellipsisReady: true,
      showEllipsisButton: false,
      startX: 0,
      startY: 0,
      offsetX: 0,
      offsetY: 0,
      slide: false
    };
  },
  computed: {
    isSingle() {
      return this.urlList.length <= 1;
    },
    isFirst() {
      return this.index === 0;
    },
    isLast() {
      return this.index === this.urlList.length - 1;
    },
    currentImg() {
      return this.urlList[this.index];
    },
    imgStyle() {
      const {
        scale,
        deg,
        offsetX,
        offsetY,
        enableTransition
      } = this.transform;
      const style = {
        transform: `scale(${scale}) rotate(${deg}deg)`,
        transition: enableTransition ? 'transform .3s' : '',
        'margin-left': `${offsetX}px`,
        'margin-top': `${offsetY}px`
      };
      if (this.mode === Mode.CONTAIN) {
        style.maxWidth = style.maxHeight = '100%';
      }
      return style;
    },
    viewerZIndex() {
      const nextZIndex = PopupManager.nextZIndex();
      return this.zIndex > nextZIndex ? this.zIndex : nextZIndex;
    }
  },
  watch: {
    index: {
      handler: function (val) {
        this.reset();
        this.onSwitch(val);
        this.contentExpand = false;
        this.ellipsisReady = true;
        this.setEllipsisButton();
      }
    },
    currentImg(val) {
      this.$nextTick(_ => {
        const $img = this.$refs.img[0];
        if (!$img.complete) {
          this.loading = true;
        }
      });
    }
  },
  methods: {
    setEllipsisButton() {
      this.$nextTick(() => {
        let wrapper = this.$refs['el-image-viewer__wrapper'] ? this.$refs['el-image-viewer__wrapper'].getBoundingClientRect() : {};
        if (!wrapper.width) {
          this.showEllipsisButton = false;
          return;
        }
        let content = this.contents.length ? this.contents[this.index] : '';
        let vDom = document.createElement('div');
        vDom.style.width = wrapper.width + 'px';
        vDom.style.padding = '0 15px';
        vDom.style.fontSize = '14px';
        vDom.style.lineHeight = '22px';
        vDom.style.position = 'absolute';
        vDom.style.top = '-9999px';
        vDom.innerHTML = content;
        document.documentElement.appendChild(vDom);
        let vRect = vDom.getBoundingClientRect();
        if (vRect.height && vRect.height > 66) {
          this.showEllipsisButton = true;
          return;
        }
        this.showEllipsisButton = false;
      });
    },
    toggleEllipsis() {
      this.contentExpand = !this.contentExpand;
      if (this.contentExpand) {
        this.ellipsisReady = false;
        setTimeout(() => {
          this.ellipsisReady = true;
        }, 80);
      }
    },
    hide() {
      this.deviceSupportUninstall();
      this.onClose();
    },
    deviceSupportInstall() {
      this._keyDownHandler = e => {
        e.stopPropagation();
        const keyCode = e.keyCode;
        switch (keyCode) {
          // ESC
          case 27:
            this.hide();
            break;
          // SPACE
          case 32:
            this.toggleMode();
            break;
          // LEFT_ARROW
          case 37:
            this.prev();
            break;
          // UP_ARROW
          case 38:
            this.handleActions('zoomIn');
            break;
          // RIGHT_ARROW
          case 39:
            this.next();
            break;
          // DOWN_ARROW
          case 40:
            this.handleActions('zoomOut');
            break;
        }
      };
      this._mouseWheelHandler = rafThrottle(e => {
        const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
        if (delta > 0) {
          this.handleActions('zoomIn', {
            zoomRate: 0.015,
            enableTransition: false
          });
        } else {
          this.handleActions('zoomOut', {
            zoomRate: 0.015,
            enableTransition: false
          });
        }
      });
      on$1(document, 'keydown', this._keyDownHandler);
      on$1(document, mousewheelEventName, this._mouseWheelHandler);
    },
    deviceSupportUninstall() {
      off$1(document, 'keydown', this._keyDownHandler);
      off$1(document, mousewheelEventName, this._mouseWheelHandler);
      this._keyDownHandler = null;
      this._mouseWheelHandler = null;
    },
    handleImgLoad(e) {
      this.loading = false;
    },
    handleImgError(e) {
      this.loading = false;
      e.target.alt = '加载失败';
    },
    // 移动端触摸开始
    touchstart(event) {
      let ev = event.touches[0];
      this.startX = ev.pageX;
      this.startY = ev.pageY;
      this.offsetY = this.transform.offsetY;
      this.offsetX = this.transform.offsetX;
      if (this.loading || ev.button !== 0) return;
    },
    // 移动端触摸结束
    touchmove(event) {
      let ev = event.touches[0];
      if (!this.slide) {
        this.slide = true;
        this.transform.offsetX = this.offsetX + ev.pageX - this.startX;
        this.transform.offsetY = this.offsetY + ev.pageY - this.startY;
        setTimeout(() => {
          this.slide = false;
        }, 100);
      }
      event.preventDefault();
    },
    handleMouseDown(e) {
      if (this.loading || e.button !== 0) return;
      const {
        offsetX,
        offsetY
      } = this.transform;
      const startX = e.pageX;
      const startY = e.pageY;
      this._dragHandler = rafThrottle(ev => {
        this.transform.offsetX = offsetX + ev.pageX - startX;
        this.transform.offsetY = offsetY + ev.pageY - startY;
      });
      on$1(document, 'mousemove', this._dragHandler);
      on$1(document, 'mouseup', ev => {
        off$1(document, 'mousemove', this._dragHandler);
      });
      e.preventDefault();
    },
    handleMaskClick() {
      if (this.maskClosable) {
        this.hide();
      }
    },
    reset() {
      this.transform = {
        scale: 1,
        deg: 0,
        offsetX: 0,
        offsetY: 0,
        enableTransition: false
      };
    },
    toggleMode() {
      if (this.loading) return;
      const modeNames = Object.keys(Mode);
      const modeValues = Object.values(Mode);
      const index = modeValues.indexOf(this.mode);
      const nextIndex = (index + 1) % modeNames.length;
      this.mode = Mode[modeNames[nextIndex]];
      this.reset();
    },
    prev() {
      if (this.isFirst && !this.infinite) return;
      const len = this.urlList.length;
      this.index = (this.index - 1 + len) % len;
    },
    next() {
      if (this.isLast && !this.infinite) return;
      const len = this.urlList.length;
      this.index = (this.index + 1) % len;
    },
    handleActions(action, options = {}) {
      if (this.loading) return;
      const {
        zoomRate,
        rotateDeg,
        enableTransition
      } = {
        zoomRate: 0.2,
        rotateDeg: 90,
        enableTransition: true,
        ...options
      };
      const {
        transform
      } = this;
      switch (action) {
        case 'zoomOut':
          if (transform.scale > 0.2) {
            transform.scale = parseFloat((transform.scale - zoomRate).toFixed(3));
          }
          break;
        case 'zoomIn':
          transform.scale = parseFloat((transform.scale + zoomRate).toFixed(3));
          break;
        case 'clocelise':
          transform.deg += rotateDeg;
          break;
        case 'anticlocelise':
          transform.deg -= rotateDeg;
          break;
      }
      transform.enableTransition = enableTransition;
    }
  },
  mounted() {
    this.deviceSupportInstall();
    if (this.appendToBody) {
      document.body.appendChild(this.$el);
    }
    // add tabindex then wrapper can be focusable via Javascript
    // focus wrapper so arrow key can't cause inner scroll behavior underneath
    this.$refs['el-image-viewer__wrapper'].focus();
    this.setEllipsisButton();
  },
  destroyed() {
    // if appendToBody is true, remove DOM node after destroy
    if (this.appendToBody && this.$el && this.$el.parentNode) {
      this.$el.parentNode.removeChild(this.$el);
    }
  }
};

/* script */
const __vue_script__$68 = script$68;

/* template */
var __vue_render__$67 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("transition", { attrs: { name: "viewer-fade" } }, [
    _c(
      "div",
      {
        ref: "el-image-viewer__wrapper",
        staticClass: "el-image-viewer__wrapper",
        style: { "z-index": _vm.viewerZIndex },
        attrs: { tabindex: "-1" },
      },
      [
        _c("div", {
          staticClass: "el-image-viewer__mask",
          on: {
            click: function ($event) {
              if ($event.target !== $event.currentTarget) {
                return null
              }
              return _vm.handleMaskClick.apply(null, arguments)
            },
          },
        }),
        _vm._v(" "),
        _c(
          "span",
          {
            staticClass: "el-image-viewer__btn el-image-viewer__close",
            on: { click: _vm.hide },
          },
          [_c("i", { staticClass: "el-icon-close" })]
        ),
        _vm._v(" "),
        _c(
          "div",
          { staticClass: "el-image-viewer__btn el-image-viewer__actions" },
          [
            _c("div", { staticClass: "el-image-viewer__actions__inner" }, [
              !_vm.isSingle
                ? _c("i", {
                    class: [
                      "el-icon-arrow-left",
                      !_vm.infinite && _vm.isFirst ? "is-disabled" : "",
                    ],
                    on: { click: _vm.prev },
                  })
                : _vm._e(),
              _vm._v(" "),
              _c("i", {
                staticClass: "el-icon-zoom-out",
                on: {
                  click: function ($event) {
                    return _vm.handleActions("zoomOut")
                  },
                },
              }),
              _vm._v(" "),
              _c("i", {
                staticClass: "el-icon-zoom-in",
                on: {
                  click: function ($event) {
                    return _vm.handleActions("zoomIn")
                  },
                },
              }),
              _vm._v(" "),
              _c("i", { staticClass: "el-image-viewer__actions__divider" }),
              _vm._v(" "),
              _c("i", { class: _vm.mode.icon, on: { click: _vm.toggleMode } }),
              _vm._v(" "),
              _c("i", { staticClass: "el-image-viewer__actions__divider" }),
              _vm._v(" "),
              _c("i", {
                staticClass: "el-icon-refresh-left",
                on: {
                  click: function ($event) {
                    return _vm.handleActions("anticlocelise")
                  },
                },
              }),
              _vm._v(" "),
              _c("i", {
                staticClass: "el-icon-refresh-right",
                on: {
                  click: function ($event) {
                    return _vm.handleActions("clocelise")
                  },
                },
              }),
              _vm._v(" "),
              !_vm.isSingle
                ? _c("i", {
                    class: [
                      "el-icon-arrow-right",
                      !_vm.infinite && _vm.isLast ? "is-disabled" : "",
                    ],
                    on: { click: _vm.next },
                  })
                : _vm._e(),
            ]),
          ]
        ),
        _vm._v(" "),
        _vm.title.length && _vm.title[_vm.index]
          ? _c(
              "div",
              { staticClass: "el-image-viewer__btn el-image-viewer__title" },
              [
                _vm._v(
                  "\n      " +
                    _vm._s(_vm.title.length ? _vm.title[_vm.index] : "") +
                    "\n    "
                ),
              ]
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.contents.length && _vm.contents[_vm.index]
          ? _c(
              "div",
              { staticClass: "el-image-viewer__btn el-image-viewer__content" },
              [
                _c(
                  "el-collapse-transition",
                  { attrs: { name: "el-fade-in" } },
                  [
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: _vm.ellipsisReady,
                            expression: "ellipsisReady",
                          },
                        ],
                        class: [
                          "ellipsis-box",
                          _vm.contentExpand ? "" : "text-ellipsis-3",
                        ],
                      },
                      [
                        _vm._v(
                          "\n          " +
                            _vm._s(
                              _vm.contents.length ? _vm.contents[_vm.index] : ""
                            ) +
                            "\n        "
                        ),
                      ]
                    ),
                  ]
                ),
                _vm._v(" "),
                _c(
                  "el-button",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: _vm.showEllipsisButton,
                        expression: "showEllipsisButton",
                      },
                    ],
                    attrs: { type: "text", size: "mini" },
                    on: { click: _vm.toggleEllipsis },
                  },
                  [
                    _vm._v(_vm._s(_vm.contentExpand ? "收起" : "展开")),
                    _c("i", {
                      class: _vm.contentExpand
                        ? "el-icon-arrow-up"
                        : "el-icon-arrow-down",
                    }),
                  ]
                ),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _c(
          "div",
          { staticClass: "el-image-viewer__canvas" },
          _vm._l(_vm.urlList, function (url, i) {
            return i === _vm.index
              ? _c("img", {
                  key: url,
                  ref: "img",
                  refInFor: true,
                  staticClass: "el-image-viewer__img",
                  style: _vm.imgStyle,
                  attrs: { src: _vm.currentImg },
                  on: {
                    load: _vm.handleImgLoad,
                    error: _vm.handleImgError,
                    mousedown: _vm.handleMouseDown,
                    touchstart: _vm.touchstart,
                    touchmove: _vm.touchmove,
                  },
                })
              : _vm._e()
          }),
          0
        ),
      ]
    ),
  ])
};
var __vue_staticRenderFns__$67 = [];
__vue_render__$67._withStripped = true;

  /* style */
  const __vue_inject_styles__$68 = undefined;
  /* scoped */
  const __vue_scope_id__$68 = undefined;
  /* module identifier */
  const __vue_module_identifier__$68 = undefined;
  /* functional template */
  const __vue_is_functional_template__$68 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$68 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$67, staticRenderFns: __vue_staticRenderFns__$67 },
    __vue_inject_styles__$68,
    __vue_script__$68,
    __vue_scope_id__$68,
    __vue_is_functional_template__$68,
    __vue_module_identifier__$68,
    false,
    undefined,
    undefined,
    undefined
  );

var recorder_mp3_min = createCommonjsModule(function (module) {
/*
录音
https://github.com/xiangyuecn/Recorder
src: recorder-core.js,engine/mp3.js,engine/mp3-engine.js
*/
!function (e) {
  var t = "object" == typeof window && !!window.document,
    a = t ? window : Object;
  !function (e, y) {

    var A = function () {},
      f = function (e) {
        return "number" == typeof e;
      },
      B = function (e) {
        return JSON.stringify(e);
      },
      W = function (e) {
        return new _(e);
      },
      k = W.LM = "2025-01-11 09:28",
      R = "https://github.com/xiangyuecn/Recorder",
      T = "Recorder",
      x = "getUserMedia",
      N = "srcSampleRate",
      V = "sampleRate",
      i = "bitRate",
      E = "catch",
      t = e[T];
    if (t && t.LM == k) return t.CLog(t.i18n.$T("K8zP::重复导入{1}", 0, T), 3);
    W.IsOpen = function () {
      var e = W.Stream;
      if (e) {
        var t = j(e),
          a = t[0];
        if (a) {
          var n = a.readyState;
          return "live" == n || n == a.LIVE;
        }
      }
      return !1;
    }, W.BufferSize = 4096, W.Destroy = function () {
      for (var e in Q(T + " Destroy"), F(), a) a[e]();
    };
    var a = {};
    W.BindDestroy = function (e, t) {
      a[e] = t;
    }, W.Support = function () {
      if (!y) return !1;
      var e = navigator.mediaDevices || {};
      return e[x] || (e = navigator)[x] || (e[x] = e.webkitGetUserMedia || e.mozGetUserMedia || e.msGetUserMedia), !!e[x] && (W.Scope = e, !!W.GetContext());
    }, W.GetContext = function (e) {
      if (!y) return null;
      var t = window.AudioContext;
      if (t || (t = window.webkitAudioContext), !t) return null;
      var a = W.Ctx,
        n = 0;
      return a || (a = W.Ctx = new t(), n = 1, W.NewCtxs = W.NewCtxs || [], W.BindDestroy("Ctx", function () {
        var e = W.Ctx;
        e && e.close && (s(e), W.Ctx = 0);
        var t = W.NewCtxs;
        W.NewCtxs = [];
        for (var a = 0; a < t.length; a++) s(t[a]);
      })), e && a.close && (n || (a._useC || s(a), a = new t()), a._useC = 1, W.NewCtxs.push(a)), a;
    }, W.CloseNewCtx = function (e) {
      if (e && e.close) {
        s(e);
        for (var t = W.NewCtxs || [], a = t.length, n = 0; n < t.length; n++) if (t[n] == e) {
          t.splice(n, 1);
          break;
        }
        Q($("mSxV::剩{1}个GetContext未close", 0, a + "-1=" + t.length), t.length ? 3 : 0);
      }
    };
    var s = function (e) {
        if (e && e.close && !e._isC && (e._isC = 1, "closed" != e.state)) try {
          e.close();
        } catch (e) {
          Q("ctx close err", 1, e);
        }
      },
      C = W.ResumeCtx = function (a, n, s, r) {
        var i = 0,
          o = 0,
          _ = 0,
          l = 0,
          f = "EventListener",
          c = "ResumeCtx ",
          u = function (e, t) {
            o && h(), i || (i = 1, e && r(e, l), t && s(l)), t && (!a._LsSC && a["add" + f] && a["add" + f]("statechange", b), a._LsSC = 1, _ = 1);
          },
          h = function (e) {
            if (!e || !o) {
              o = e ? 1 : 0;
              for (var t = ["focus", "mousedown", "mouseup", "touchstart", "touchend"], a = 0; a < t.length; a++) window[(e ? "add" : "remove") + f](t[a], b, !0);
            }
          },
          b = function () {
            var e = a.state,
              t = p(e);
            if (!i && !n(t ? ++l : l)) return u();
            t ? (_ && Q(c + "sc " + e, 3), h(1), a.resume().then(function () {
              _ && Q(c + "sc " + a.state), u(0, 1);
            })[E](function (e) {
              Q(c + "error", 1, e), p(a.state) || u(e.message || "error");
            })) : "closed" == e ? (_ && !a._isC && Q(c + "sc " + e, 1), u("ctx closed")) : u(0, 1);
          };
        b();
      },
      p = W.CtxSpEnd = function (e) {
        return "suspended" == e || "interrupted" == e;
      },
      I = function (e) {
        var t = e.state,
          a = "ctx.state=" + t;
        return p(t) && (a += $("nMIy::（注意：ctx不是running状态，rec.open和start至少要有一个在用户操作(触摸、点击等)时进行调用，否则将在rec.start时尝试进行ctx.resume，可能会产生兼容性问题(仅iOS)，请参阅文档中runningContext配置）")), a;
      },
      L = "ConnectEnableWebM";
    W[L] = !0;
    var P = "ConnectEnableWorklet";
    W[P] = !1;
    var H = function (e) {
        var _ = e.BufferSize || W.BufferSize,
          l = e.Stream,
          i = l._c,
          f = i[V],
          c = {},
          t = j(l),
          a = t[0],
          n = null,
          s = "";
        if (a && a.getSettings) {
          var r = (n = a.getSettings())[V];
          r && r != f && (s = $("eS8i::Stream的采样率{1}不等于{2}，将进行采样率转换（注意：音质不会变好甚至可能变差），主要在移动端未禁用回声消除时会产生此现象，浏览器有回声消除时可能只会返回16k采样率的音频数据，", 0, r, f));
        }
        l._ts = n, Q(s + "Stream TrackSet: " + B(n), s ? 3 : 0);
        var u,
          o,
          h,
          b = function (e) {
            var t = l._m = i.createMediaStreamSource(l),
              a = i.destination,
              n = "createMediaStreamDestination";
            i[n] && (a = l._d = i[n]()), t.connect(e), e.connect(a);
          },
          p = "",
          m = l._call,
          v = function (e, t) {
            for (var a in m) {
              if (t != f) {
                c.index = 0;
                var n = (c = W.SampleData([e], t, f, c, {
                    _sum: 1
                  })).data,
                  s = c._sum;
              } else {
                c = {};
                for (var r = e.length, n = new Int16Array(r), s = 0, i = 0; i < r; i++) {
                  var o = Math.max(-1, Math.min(1, e[i]));
                  o = o < 0 ? 32768 * o : 32767 * o, n[i] = o, s += Math.abs(o);
                }
              }
              for (var _ in m) m[_](n, s);
              return;
            }
          },
          d = "ScriptProcessor",
          g = "audioWorklet",
          S = T + " " + g,
          w = "RecProc",
          M = "MediaRecorder",
          y = M + ".WebM.PCM",
          A = i.createScriptProcessor || i.createJavaScriptNode,
          k = $("ZGlf::。由于{1}内部1秒375次回调，在移动端可能会有性能问题导致回调丢失录音变短，PC端无影响，暂不建议开启{1}。", 0, g),
          R = function () {
            o = l.isWorklet = !1, O(l), Q($("7TU0::Connect采用老的{1}，", 0, d) + U.get($(W[P] ? "JwCL::但已设置{1}尝试启用{2}" : "VGjB::可设置{1}尝试启用{2}", 2), [T + "." + P + "=true", g]) + p + k, 3);
            var e = l._p = A.call(i, _, 1, 1);
            b(e), e.onaudioprocess = function (e) {
              var t = e.inputBuffer.getChannelData(0);
              v(t, f);
            };
          },
          x = function () {
            u = l.isWebM = !1, D(l), o = l.isWorklet = !A || W[P];
            var t = window.AudioWorkletNode;
            if (o && i[g] && t) {
              var n = function () {
                  return o && l._na;
                },
                s = l._na = function () {
                  "" !== h && (clearTimeout(h), h = setTimeout(function () {
                    h = 0, n() && (Q($("MxX1::{1}未返回任何音频，恢复使用{2}", 0, g, d), 3), A && R());
                  }, 500));
                },
                r = function () {
                  if (n()) {
                    var e = l._n = new t(i, w, {
                      processorOptions: {
                        bufferSize: _
                      }
                    });
                    b(e), e.port.onmessage = function (e) {
                      h && (clearTimeout(h), h = ""), n() ? v(e.data.val, f) : o || Q($("XUap::{1}多余回调", 0, g), 3);
                    }, Q($("yOta::Connect采用{1}，设置{2}可恢复老式{3}", 0, g, T + "." + P + "=false", d) + p + k, 3);
                  }
                },
                e = function () {
                  if (n()) if (i[w]) r();else {
                    var e,
                      t,
                      a = (t = "class " + w + " extends AudioWorkletProcessor{", t += "constructor " + (e = function (e) {
                        return e.toString().replace(/^function|DEL_/g, "").replace(/\$RA/g, S);
                      })(function (e) {
                        DEL_super(e);
                        var t = this,
                          a = e.processorOptions.bufferSize;
                        t.bufferSize = a, t.buffer = new Float32Array(2 * a), t.pos = 0, t.port.onmessage = function (e) {
                          e.data.kill && (t.kill = !0, $C.log("$RA kill call"));
                        }, $C.log("$RA .ctor call", e);
                      }), t += "process " + e(function (e, t, a) {
                        var n = this,
                          s = n.bufferSize,
                          r = n.buffer,
                          i = n.pos;
                        if ((e = (e[0] || [])[0] || []).length) {
                          r.set(e, i);
                          var o = ~~((i += e.length) / s) * s;
                          if (o) {
                            this.port.postMessage({
                              val: r.slice(0, o)
                            });
                            var _ = r.subarray(o, i);
                            (r = new Float32Array(2 * s)).set(_), i = _.length, n.buffer = r;
                          }
                          n.pos = i;
                        }
                        return !n.kill;
                      }), t = (t += '}try{registerProcessor("' + w + '", ' + w + ')}catch(e){$C.error("' + S + ' Reg Error",e)}').replace(/\$C\./g, "console."), "data:text/javascript;base64," + btoa(unescape(encodeURIComponent(t))));
                    i[g].addModule(a).then(function (e) {
                      n() && (i[w] = 1, r(), h && s());
                    })[E](function (e) {
                      Q(g + ".addModule Error", 1, e), n() && R();
                    });
                  }
                };
              C(i, function () {
                return n();
              }, e, e);
            } else R();
          };
        !function () {
          var e = window[M],
            t = "ondataavailable",
            a = "audio/webm; codecs=pcm";
          u = l.isWebM = W[L];
          var n = e && t in e.prototype && e.isTypeSupported(a);
          if (p = n ? "" : $("VwPd::（此浏览器不支持{1}）", 0, y), !u || !n) return x();
          var s = function () {
            return u && l._ra;
          };
          l._ra = function () {
            "" !== h && (clearTimeout(h), h = setTimeout(function () {
              s() && (Q($("vHnb::{1}未返回任何音频，降级使用{2}", 0, M, g), 3), x());
            }, 500));
          };
          var r = Object.assign({
              mimeType: a
            }, W.ConnectWebMOptions),
            i = l._r = new e(l, r),
            o = l._rd = {};
          i[t] = function (e) {
            var t = new FileReader();
            t.onloadend = function () {
              if (s()) {
                var e = X(new Uint8Array(t.result), o);
                if (!e) return;
                if (-1 == e) return void x();
                h && (clearTimeout(h), h = ""), v(e, o.webmSR);
              } else u || Q($("O9P7::{1}多余回调", 0, M), 3);
            }, t.readAsArrayBuffer(e.data);
          };
          try {
            i.start(~~(_ / 48)), Q($("LMEm::Connect采用{1}，设置{2}可恢复使用{3}或老式{4}", 0, y, T + "." + L + "=false", g, d));
          } catch (e) {
            Q("mr start err", 1, e), x();
          }
        }();
      },
      r = function (e) {
        e._na && e._na(), e._ra && e._ra();
      },
      O = function (e) {
        e._na = null, e._n && (e._n.port.postMessage({
          kill: !0
        }), e._n.disconnect(), e._n = null);
      },
      D = function (e) {
        if (e._ra = null, e._r) {
          try {
            e._r.stop();
          } catch (e) {
            Q("mr stop err", 1, e);
          }
          e._r = null;
        }
      },
      F = function (e) {
        var t = (e = e || W) == W,
          a = e.Stream;
        a && (a._m && (a._m.disconnect(), a._m = null), !a._RC && a._c && W.CloseNewCtx(a._c), a._RC = null, a._c = null, a._d && (n(a._d.stream), a._d = null), a._p && (a._p.disconnect(), a._p.onaudioprocess = a._p = null), O(a), D(a), t && n(a)), e.Stream = 0;
      },
      n = W.StopS_ = function (e) {
        for (var t = j(e), a = 0; a < t.length; a++) {
          var n = t[a];
          n.stop && n.stop();
        }
        e.stop && e.stop();
      },
      j = function (e) {
        var t = 0,
          a = 0,
          n = [];
        e.getAudioTracks && (t = e.getAudioTracks(), a = e.getVideoTracks()), t || (t = e.audioTracks, a = e.videoTracks);
        for (var s = 0, r = t ? t.length : 0; s < r; s++) n.push(t[s]);
        for (var s = 0, r = a ? a.length : 0; s < r; s++) n.push(a[s]);
        return n;
      };
    W.SampleData = function (e, t, a, n, s) {
      var r = "SampleData";
      n || (n = {});
      var i = n.index || 0,
        o = n.offset || 0,
        _ = n.raisePrev || 0,
        l = n.filter;
      if (l && l.fn && (l.sr && l.sr != t || l.srn && l.srn != a) && (l = null, Q($("d48C::{1}的filter采样率变了，重设滤波", 0, r), 3)), !l) if (a <= t) {
        var f = 3 * t / 4 < a ? 0 : a / 2 * 3 / 4;
        l = {
          fn: f ? W.IIRFilter(!0, t, f) : 0
        };
      } else {
        var f = 3 * a / 4 < t ? 0 : t / 2 * 3 / 4;
        l = {
          fn: f ? W.IIRFilter(!0, a, f) : 0
        };
      }
      l.sr = t, l.srn = a;
      var c = l.fn,
        u = n.frameNext || [];
      s || (s = {});
      var h = s.frameSize || 1;
      s.frameType && (h = "mp3" == s.frameType ? 1152 : 1);
      var b = s._sum,
        p = 0,
        m = e.length;
      m + 1 < i && Q($("tlbC::{1}似乎传入了未重置chunk {2}", 0, r, i + ">" + m), 3);
      for (var v = 0, d = i; d < m; d++) v += e[d].length;
      var g = t / a;
      if (1 < g) v = Math.max(0, v - Math.floor(o)), v = Math.floor(v / g);else if (g < 1) {
        var S = 1 / g;
        v = Math.floor(v * S);
      }
      v += u.length;
      for (var w = new Int16Array(v), M = 0, d = 0; d < u.length; d++) w[M] = u[d], M++;
      for (; i < m; i++) {
        var y = e[i],
          A = y instanceof Float32Array,
          d = o,
          k = y.length,
          R = c && c.Embed,
          x = 0,
          B = 0,
          T = 0,
          E = 0;
        if (g < 1) {
          for (var C = M + d, I = _, L = 0; L < k; L++) {
            var P = y[L];
            A && (P = (P = Math.max(-1, Math.min(1, P))) < 0 ? 32768 * P : 32767 * P);
            var H = Math.floor(C);
            C += S;
            for (var O = Math.floor(C), N = (P - I) / (O - H), V = 1; H < O; H++, V++) {
              var D = Math.floor(I + V * N);
              R ? (T = D, E = R.b0 * T + R.b1 * R.x1 + R.b0 * R.x2 - R.a1 * R.y1 - R.a2 * R.y2, R.x2 = R.x1, R.x1 = T, R.y2 = R.y1, R.y1 = E, D = E) : D = c ? c(D) : D, 32767 < D ? D = 32767 : D < -32768 && (D = -32768), b && (p += Math.abs(D)), w[H] = D, M++;
            }
            I = _ = P, d += S;
          }
          o = d % 1;
        } else {
          for (var L = 0, F = 0; L < k; L++, F++) {
            if (F < k) {
              var P = y[F];
              A && (P = (P = Math.max(-1, Math.min(1, P))) < 0 ? 32768 * P : 32767 * P), R ? (T = P, E = R.b0 * T + R.b1 * R.x1 + R.b0 * R.x2 - R.a1 * R.y1 - R.a2 * R.y2, R.x2 = R.x1, R.x1 = T, R.y2 = R.y1, R.y1 = E) : E = c ? c(P) : P;
            }
            if (x = B, B = E, 0 != F) {
              var j = Math.floor(d);
              if (L == j) {
                var X = Math.ceil(d),
                  Y = d - j,
                  z = x,
                  q = X < k ? B : z,
                  G = z + (q - z) * Y;
                32767 < G ? G = 32767 : G < -32768 && (G = -32768), b && (p += Math.abs(G)), w[M] = G, M++, d += g;
              }
            } else L--;
          }
          o = Math.max(0, d - k);
        }
      }
      g < 1 && M + 1 == v && (v--, w = new Int16Array(w.buffer.slice(0, 2 * v))), M - 1 != v && M != v && Q(r + " idx:" + M + " != size:" + v, 3), u = null;
      var U = v % h;
      if (0 < U) {
        var K = 2 * (v - U);
        u = new Int16Array(w.buffer.slice(K)), w = new Int16Array(w.buffer.slice(0, K));
      }
      var Z = {
        index: i,
        offset: o,
        raisePrev: _,
        filter: l,
        frameNext: u,
        sampleRate: a,
        data: w
      };
      return b && (Z._sum = p), Z;
    }, W.IIRFilter = function (e, t, a) {
      var n = 2 * Math.PI * a / t,
        s = Math.sin(n),
        r = Math.cos(n),
        i = s / 2,
        o = 1 + i,
        _ = -2 * r / o,
        l = (1 - i) / o;
      if (e) var f = (1 - r) / 2 / o,
        c = (1 - r) / o;else var f = (1 + r) / 2 / o,
        c = -(1 + r) / o;
      var u = 0,
        h = 0,
        b = 0,
        p = 0,
        m = 0,
        v = function (e) {
          return b = f * e + c * u + f * h - _ * p - l * m, h = u, u = e, m = p, p = b;
        };
      return v.Embed = {
        x1: 0,
        x2: 0,
        y1: 0,
        y2: 0,
        b0: f,
        b1: c,
        a1: _,
        a2: l
      }, v;
    }, W.PowerLevel = function (e, t) {
      var a = e / t || 0;
      return a < 1251 ? Math.round(a / 1250 * 10) : Math.round(Math.min(100, Math.max(0, 100 * (1 + Math.log(a / 1e4) / Math.log(10)))));
    }, W.PowerDBFS = function (e) {
      var t = Math.max(.1, e || 0);
      return t = Math.min(t, 32767), t = 20 * Math.log(t / 32767) / Math.log(10), Math.max(-100, Math.round(t));
    }, W.CLog = function (e, t) {
      if ("object" == typeof console) {
        var a = new Date(),
          n = ("0" + a.getMinutes()).substr(-2) + ":" + ("0" + a.getSeconds()).substr(-2) + "." + ("00" + a.getMilliseconds()).substr(-3),
          s = this && this.envIn && this.envCheck && this.id,
          r = ["[" + n + " " + T + (s ? ":" + s : "") + "]" + e],
          i = arguments,
          o = W.CLog,
          _ = 2,
          l = o.log || console.log;
        for (f(t) ? l = 1 == t ? o.error || console.error : 3 == t ? o.warn || console.warn : l : _ = 1; _ < i.length; _++) r.push(i[_]);
        c ? l && l("[IsLoser]" + r[0], 1 < r.length ? r : "") : l.apply(console, r);
      }
    };
    var Q = function () {
        W.CLog.apply(this, arguments);
      },
      c = !0;
    try {
      c = !console.log.apply;
    } catch (e) {}
    var o = 0;
    function _(e) {
      var t = this;
      t.id = ++o, l();
      var a = {
        type: "mp3",
        onProcess: A
      };
      for (var n in e) a[n] = e[n];
      var s = (t.set = a)[i],
        r = a[V];
      (s && !f(s) || r && !f(r)) && t.CLog($.G("IllegalArgs-1", [$("VtS4::{1}和{2}必须是数值", 0, V, i)]), 1, e), a[i] = +s || 16, a[V] = +r || 16e3, t.state = 0, t._S = 9, t.Sync = {
        O: 9,
        C: 9
      };
    }
    W.Sync = {
      O: 9,
      C: 9
    }, W.prototype = _.prototype = {
      CLog: Q,
      _streamStore: function () {
        return this.set.sourceStream ? this : W;
      },
      _streamGet: function () {
        return this._streamStore().Stream;
      },
      _streamCtx: function () {
        var e = this._streamGet();
        return e && e._c;
      },
      open: function (e, a) {
        var _ = this,
          l = _.set,
          n = _._streamStore(),
          s = 0;
        e = e || A;
        var r = function (e, t) {
          t = !!t, _.CLog($("5tWi::录音open失败：") + e + ",isUserNotAllow:" + t, 1), s && W.CloseNewCtx(s), a && a(e, t);
        };
        _._streamTag = x;
        var i = function () {
            _.CLog("open ok, id:" + _.id + " stream:" + _._streamTag), e(), _._SO = 0;
          },
          o = n.Sync,
          f = ++o.O,
          c = o.C;
        _._O = _._O_ = f, _._SO = _._S;
        if (y) {
          var t = _.envCheck({
            envName: "H5",
            canProcess: !0
          });
          if (t) r($("A5bm::不能录音：") + t);else {
            var u,
              h = function () {
                (u = l.runningContext) || (u = s = W.GetContext(!0));
              };
            if (l.sourceStream) {
              if (_._streamTag = "set.sourceStream", !W.GetContext()) return void r($("1iU7::不支持此浏览器从流中获取录音"));
              h(), F(n);
              var b = _.Stream = l.sourceStream;
              b._c = u, b._RC = l.runningContext, b._call = {};
              try {
                H(n);
              } catch (e) {
                return F(n), void r($("BTW2::从流中打开录音失败：") + e.message);
              }
              i();
            } else {
              var p = function (e, t) {
                  try {
                    window.top.a;
                  } catch (e) {
                    return void r($("Nclz::无权录音(跨域，请尝试给iframe添加麦克风访问策略，如{1})", 0, 'allow="camera;microphone"'));
                  }
                  m(1, e) && (/Found/i.test(e) ? r(t + $("jBa9::，无可用麦克风")) : r(t));
                },
                m = function (e, t) {
                  if (/Permission|Allow/i.test(t)) e && r($("gyO5::用户拒绝了录音权限"), !0);else {
                    if (!1 !== window.isSecureContext) return 1;
                    e && r($("oWNo::浏览器禁止不安全页面录音，可开启https解决"));
                  }
                };
              if (W.IsOpen()) i();else if (W.Support()) {
                h();
                var v,
                  d,
                  g = function (t) {
                    setTimeout(function () {
                      t._call = {};
                      var e = W.Stream;
                      e && (F(), t._call = e._call), (W.Stream = t)._c = u, t._RC = l.runningContext, function () {
                        if (c != o.C || !_._O) {
                          var e = $("dFm8::open被取消");
                          return f == o.O ? _.close() : e = $("VtJO::open被中断"), r(e), !0;
                        }
                      }() || (W.IsOpen() ? (e && _.CLog($("upb8::发现同时多次调用open"), 1), H(n), i()) : r($("Q1GA::录音功能无效：无音频流")));
                    }, 100);
                  },
                  S = function (e) {
                    var t = e.name || e.message || e.code + ":" + e,
                      a = "";
                    1 == w && m(0, t) && (a = $("KxE2::，将尝试禁用回声消除后重试"));
                    var n = $("xEQR::请求录音权限错误"),
                      s = $("bDOG::无法录音：");
                    _.CLog(n + a + "|" + e, a || d ? 3 : 1, e), a ? (v = t, d = e, M(1)) : d ? (_.CLog(n + "|" + d, 1, d), p(v, s + d)) : p(t, s + e);
                  },
                  w = 0,
                  M = function (e) {
                    w++;
                    var t = "audioTrackSet",
                      a = "autoGainControl",
                      n = "echoCancellation",
                      s = "noiseSuppression",
                      r = JSON.parse(B(l[t] || !0));
                    _.CLog("open... " + w + " " + t + ":" + B(r)), e && ("object" != typeof r && (r = {}), r[a] = !1, r[n] = !1, r[s] = !1), r[V] && _.CLog($("IjL3::注意：已配置{1}参数，可能会出现浏览器不能正确选用麦克风、移动端无法启用回声消除等现象", 0, t + "." + V), 3);
                    var i = {
                      audio: r,
                      video: l.videoTrackSet || !1
                    };
                    try {
                      var o = W.Scope[x](i, g, S);
                    } catch (e) {
                      _.CLog(x, 3, e), i = {
                        audio: !0,
                        video: !1
                      }, o = W.Scope[x](i, g, S);
                    }
                    _.CLog(x + "(" + B(i) + ") " + I(u) + $("RiWe::，未配置 {1} 时浏览器可能会自动启用回声消除，移动端未禁用回声消除时可能会降低系统播放音量（关闭录音后可恢复）和仅提供16k采样率的音频流（不需要回声消除时可明确配置成禁用来获得48k高音质的流），请参阅文档中{2}配置", 0, "audioTrackSet:{echoCancellation,noiseSuppression,autoGainControl}", t) + "(" + R + ") LM:" + k + " UA:" + navigator.userAgent), o && o.then && o.then(g)[E](S);
                  };
                M();
              } else p("", $("COxc::此浏览器不支持录音"));
            }
          }
        } else r($.G("NonBrowser-1", ["open"]) + $("EMJq::，可尝试使用RecordApp解决方案") + "(" + R + "/tree/master/app-support-sample)");
      },
      close: function (e) {
        e = e || A;
        var t = this,
          a = t._streamStore();
        t._stop();
        var n = " stream:" + t._streamTag,
          s = a.Sync;
        if (t._O = 0, t._O_ != s.O) return t.CLog($("hWVz::close被忽略（因为同时open了多个rec，只有最后一个会真正close）") + n, 3), void e();
        s.C++, F(a), t.CLog("close," + n), e();
      },
      mock: function (e, t) {
        var a = this;
        return a._stop(), a.isMock = 1, a.mockEnvInfo = null, a.buffers = [e], a.recSize = e.length, a._setSrcSR(t), a._streamTag = "mock", a;
      },
      _setSrcSR: function (e) {
        var t = this.set,
          a = t[V];
        e < a ? t[V] = e : a = 0, this[N] = e, this.CLog(N + ": " + e + " set." + V + ": " + t[V] + (a ? " " + $("UHvm::忽略") + ": " + a : ""), a ? 3 : 0);
      },
      envCheck: function (e) {
        var t,
          a = this.set,
          n = "CPU_BE";
        if (t || W[n] || "function" != typeof Int8Array || new Int8Array(new Int32Array([1]).buffer)[0] || (l(n), t = $("Essp::不支持{1}架构", 0, n)), !t) {
          var s = a.type,
            r = this[s + "_envCheck"];
          a.takeoffEncodeChunk && (r ? e.canProcess || (t = $("7uMV::{1}环境不支持实时处理", 0, e.envName)) : t = $("2XBl::{1}类型不支持设置takeoffEncodeChunk", 0, s) + (this[s] ? "" : $("LG7e::(未加载编码器)"))), !t && r && (t = this[s + "_envCheck"](e, a));
        }
        return t || "";
      },
      envStart: function (e, t) {
        var a = this,
          n = a.set;
        if (a.isMock = e ? 1 : 0, a.mockEnvInfo = e, a.buffers = [], a.recSize = 0, e && (a._streamTag = "env$" + e.envName), a.state = 1, a.envInLast = 0, a.envInFirst = 0, a.envInFix = 0, a.envInFixTs = [], a._setSrcSR(t), a.engineCtx = 0, a[n.type + "_start"]) {
          var s = a.engineCtx = a[n.type + "_start"](n);
          s && (s.pcmDatas = [], s.pcmSize = 0);
        }
      },
      envResume: function () {
        this.envInFixTs = [];
      },
      envIn: function (e, t) {
        var s = this,
          r = s.set,
          i = s.engineCtx;
        if (1 == s.state) {
          var a = s[N],
            n = e.length,
            o = W.PowerLevel(t, n),
            _ = s.buffers,
            l = _.length;
          _.push(e);
          var f = _,
            c = l,
            u = Date.now(),
            h = Math.round(n / a * 1e3);
          s.envInLast = u, 1 == s.buffers.length && (s.envInFirst = u - h);
          var b = s.envInFixTs;
          b.splice(0, 0, {
            t: u,
            d: h
          });
          for (var p = u, m = 0, v = 0; v < b.length; v++) {
            var d = b[v];
            if (3e3 < u - d.t) {
              b.length = v;
              break;
            }
            p = d.t, m += d.d;
          }
          var g = b[1],
            S = u - p,
            w = S - m;
          if (S / 3 < w && (g && 1e3 < S || 6 <= b.length)) {
            var M = u - g.t - h;
            if (h / 5 < M) {
              var y = !r.disableEnvInFix;
              if (s.CLog("[" + u + "]" + U.get($(y ? "4Kfd::补偿{1}ms" : "bM5i::未补偿{1}ms", 1), [M]), 3), s.envInFix += M, y) {
                var A = new Int16Array(M * a / 1e3);
                n += A.length, _.push(A);
              }
            }
          }
          var k = s.recSize,
            R = n,
            x = k + R;
          if (s.recSize = x, i) {
            var B = W.SampleData(_, a, r[V], i.chunkInfo);
            i.chunkInfo = B, k = i.pcmSize, R = B.data.length, x = k + R, i.pcmSize = x, _ = i.pcmDatas, l = _.length, _.push(B.data), a = B[V];
          }
          var T = Math.round(x / a * 1e3),
            E = _.length,
            C = f.length,
            I = function () {
              for (var e = L ? 0 : -R, t = null == _[0], a = l; a < E; a++) {
                var n = _[a];
                null == n ? t = 1 : (e += n.length, i && n.length && s[r.type + "_encode"](i, n));
              }
              if (t && i) {
                var a = c;
                for (f[0] && (a = 0); a < C; a++) f[a] = null;
              }
              t && (e = L ? R : 0, _[0] = null), i ? i.pcmSize += e : s.recSize += e;
            },
            L = 0,
            P = "rec.set.onProcess";
          try {
            L = !0 === (L = r.onProcess(_, o, T, a, l, I));
          } catch (e) {
            console.error(P + $("gFUF::回调出错是不允许的，需保证不会抛异常"), e);
          }
          var H = Date.now() - u;
          if (10 < H && 1e3 < s.envInFirst - u && s.CLog(P + $("2ghS::低性能，耗时{1}ms", 0, H), 3), L) {
            for (var O = 0, v = l; v < E; v++) null == _[v] ? O = 1 : _[v] = new Int16Array(0);
            O ? s.CLog($("ufqH::未进入异步前不能清除buffers"), 3) : i ? i.pcmSize -= R : s.recSize -= R;
          } else I();
        } else s.state || s.CLog("envIn at state=0", 3);
      },
      start: function () {
        var t = this,
          e = 1;
        if (t.set.sourceStream ? t.Stream || (e = 0) : W.IsOpen() || (e = 0), e) {
          var a = t._streamCtx();
          if (t.CLog($("kLDN::start 开始录音，") + I(a) + " stream:" + t._streamTag), t._stop(), t.envStart(null, a[V]), t.state = 3, t._SO && t._SO + 1 != t._S) t.CLog($("Bp2y::start被中断"), 3);else {
            t._SO = 0;
            var n = function () {
                3 == t.state && (t.state = 1, t.resume());
              },
              s = "AudioContext resume: ",
              r = t._streamGet();
            r._call[t.id] = function () {
              t.CLog(s + a.state + "|stream ok"), n();
            }, C(a, function (e) {
              return e && t.CLog(s + "wait..."), 3 == t.state;
            }, function (e) {
              e && t.CLog(s + a.state), n();
            }, function (e) {
              t.CLog(s + a.state + $("upkE::，可能无法录音：") + e, 1), n();
            });
          }
        } else t.CLog($("6WmN::start失败：未open"), 1);
      },
      pause: function () {
        var e = this,
          t = e._streamGet();
        e.state && (e.state = 2, e.CLog("pause"), t && delete t._call[e.id]);
      },
      resume: function () {
        var a = this,
          t = a._streamGet(),
          n = "resume(wait ctx)";
        if (3 == a.state) a.CLog(n);else if (a.state) {
          a.state = 1, a.CLog("resume"), a.envResume(), t && (t._call[a.id] = function (e, t) {
            1 == a.state && a.envIn(e, t);
          }, r(t));
          var s = a._streamCtx();
          s && C(s, function (e) {
            return e && a.CLog(n + "..."), 1 == a.state;
          }, function (e) {
            e && a.CLog(n + s.state), r(t);
          }, function (e) {
            a.CLog(n + s.state + "[err]" + e, 1);
          });
        }
      },
      _stop: function (e) {
        var t = this,
          a = t.set;
        t.isMock || t._S++, t.state && (t.pause(), t.state = 0), !e && t[a.type + "_stop"] && (t[a.type + "_stop"](t.engineCtx), t.engineCtx = 0);
      },
      stop: function (c, t, e) {
        var u,
          h = this,
          b = h.set,
          a = h.envInLast - h.envInFirst,
          n = a && h.buffers.length;
        h.CLog($("Xq4s::stop 和start时差:") + (a ? a + "ms " + $("3CQP::补偿:") + h.envInFix + "ms envIn:" + n + " fps:" + (n / a * 1e3).toFixed(1) : "-") + " stream:" + h._streamTag + " (" + R + ") LM:" + k);
        var p = function () {
            h._stop(), e && h.close();
          },
          m = function (e) {
            h.CLog($("u8JG::结束录音失败：") + e, 1), t && t(e), p();
          },
          s = function (e, t, a) {
            var n = "arraybuffer",
              s = "dataType",
              r = "DefaultDataType",
              i = h[s] || W[r] || "blob",
              o = s + "=" + i,
              _ = e instanceof ArrayBuffer,
              l = 0,
              f = _ ? e.byteLength : e.size;
            if (i == n ? _ || (l = 1) : "blob" == i ? "function" != typeof Blob ? l = $.G("NonBrowser-1", [o]) + $("1skY::，请设置{1}", 0, T + "." + r + '="' + n + '"') : (_ && (e = new Blob([e], {
              type: t
            })), e instanceof Blob || (l = 1), t = e.type || t) : l = $.G("NotSupport-1", [o]), h.CLog($("Wv7l::结束录音 编码花{1}ms 音频时长{2}ms 文件大小{3}b", 0, Date.now() - u, a, f) + " " + o + "," + t), l) m(1 != l ? l : $("Vkbd::{1}编码器返回的不是{2}", 0, b.type, i) + ", " + o);else {
              if (b.takeoffEncodeChunk) h.CLog($("QWnr::启用takeoffEncodeChunk后stop返回的blob长度为0不提供音频数据"), 3);else if (f < Math.max(50, a / 5)) return void m($("Sz2H::生成的{1}无效", 0, b.type));
              c && c(e, a, t), p();
            }
          };
        if (!h.isMock) {
          var r = 3 == h.state;
          if (!h.state || r) return void m($("wf9t::未开始录音") + (r ? $("Dl2c::，开始录音前无用户交互导致AudioContext未运行") : ""));
        }
        h._stop(!0);
        var i = h.recSize;
        if (i) {
          if (h[b.type]) {
            if (h.isMock) {
              var o = h.envCheck(h.mockEnvInfo || {
                envName: "mock",
                canProcess: !1
              });
              if (o) return void m($("AxOH::录音错误：") + o);
            }
            var _ = h.engineCtx;
            if (h[b.type + "_complete"] && _) {
              var l = Math.round(_.pcmSize / b[V] * 1e3);
              return u = Date.now(), void h[b.type + "_complete"](_, function (e, t) {
                s(e, t, l);
              }, m);
            }
            if (u = Date.now(), h.buffers[0]) {
              var f = W.SampleData(h.buffers, h[N], b[V]);
              b[V] = f[V];
              var v = f.data,
                l = Math.round(v.length / b[V] * 1e3);
              h.CLog($("CxeT::采样:{1} 花:{2}ms", 0, i + "->" + v.length, Date.now() - u)), setTimeout(function () {
                u = Date.now(), h[b.type](v, function (e, t) {
                  s(e, t, l);
                }, function (e) {
                  m(e);
                });
              });
            } else m($("xkKd::音频buffers被释放"));
          } else m($("xGuI::未加载{1}编码器，请尝试到{2}的src/engine内找到{1}的编码器并加载", 0, b.type, T));
        } else m($("Ltz3::未采集到录音"));
      }
    };
    var X = function (e, t) {
        t.pos || (t.pos = [0], t.tracks = {}, t.bytes = []);
        var a = t.tracks,
          n = [t.pos[0]],
          s = function () {
            t.pos[0] = n[0];
          },
          r = t.bytes.length,
          i = new Uint8Array(r + e.length);
        if (i.set(t.bytes), i.set(e, r), t.bytes = i, !t._ht) {
          if (q(i, n), G(i, n), !Y(q(i, n), [24, 83, 128, 103])) return;
          for (q(i, n); n[0] < i.length;) {
            var o = q(i, n),
              _ = G(i, n),
              l = [0],
              f = 0;
            if (!_) return;
            if (Y(o, [22, 84, 174, 107])) {
              for (; l[0] < _.length;) {
                var c = q(_, l),
                  u = G(_, l),
                  h = [0],
                  b = {
                    channels: 0,
                    sampleRate: 0
                  };
                if (Y(c, [174])) for (; h[0] < u.length;) {
                  var p = q(u, h),
                    m = G(u, h),
                    v = [0];
                  if (Y(p, [215])) {
                    var d = z(m);
                    b.number = d, a[d] = b;
                  } else if (Y(p, [131])) {
                    var d = z(m);
                    1 == d ? b.type = "video" : 2 == d ? (b.type = "audio", f || (t.track0 = b), b.idx = f++) : b.type = "Type-" + d;
                  } else if (Y(p, [134])) {
                    for (var g = "", S = 0; S < m.length; S++) g += String.fromCharCode(m[S]);
                    b.codec = g;
                  } else if (Y(p, [225])) for (; v[0] < m.length;) {
                    var w = q(m, v),
                      M = G(m, v);
                    if (Y(w, [181])) {
                      var d = 0,
                        y = new Uint8Array(M.reverse()).buffer;
                      4 == M.length ? d = new Float32Array(y)[0] : 8 == M.length ? d = new Float64Array(y)[0] : Q("WebM Track !Float", 1, M), b[V] = Math.round(d);
                    } else Y(w, [98, 100]) ? b.bitDepth = z(M) : Y(w, [159]) && (b.channels = z(M));
                  }
                }
              }
              t._ht = 1, Q("WebM Tracks", a), s();
              break;
            }
          }
        }
        var A = t.track0;
        if (A) {
          var k = A[V];
          if (t.webmSR = k, 16 == A.bitDepth && /FLOAT/i.test(A.codec) && (A.bitDepth = 32, Q("WebM 16->32 bit", 3)), k < 8e3 || 32 != A.bitDepth || A.channels < 1 || !/(\b|_)PCM\b/i.test(A.codec)) return t.bytes = [], t.bad || Q("WebM Track Unexpected", 3, t), -(t.bad = 1);
          for (var R = [], x = 0; n[0] < i.length;) {
            var c = q(i, n),
              u = G(i, n);
            if (!u) break;
            if (Y(c, [163])) {
              var B = 15 & u[0],
                b = a[B];
              if (!b) return Q("WebM !Track" + B, 1, a), -1;
              if (0 === b.idx) {
                for (var T = new Uint8Array(u.length - 4), S = 4; S < u.length; S++) T[S - 4] = u[S];
                R.push(T), x += T.length;
              }
            }
            s();
          }
          if (x) {
            var E = new Uint8Array(i.length - t.pos[0]);
            E.set(i.subarray(t.pos[0])), t.bytes = E, t.pos[0] = 0;
            for (var T = new Uint8Array(x), S = 0, C = 0; S < R.length; S++) T.set(R[S], C), C += R[S].length;
            var y = new Float32Array(T.buffer);
            if (1 < A.channels) {
              for (var I = [], S = 0; S < y.length;) I.push(y[S]), S += A.channels;
              y = new Float32Array(I);
            }
            return y;
          }
        }
      },
      Y = function (e, t) {
        if (!e || e.length != t.length) return !1;
        if (1 == e.length) return e[0] == t[0];
        for (var a = 0; a < e.length; a++) if (e[a] != t[a]) return !1;
        return !0;
      },
      z = function (e) {
        for (var t = "", a = 0; a < e.length; a++) {
          var n = e[a];
          t += (n < 16 ? "0" : "") + n.toString(16);
        }
        return parseInt(t, 16) || 0;
      },
      q = function (e, t, a) {
        var n = t[0];
        if (!(n >= e.length)) {
          var s = e[n],
            r = ("0000000" + s.toString(2)).substr(-8),
            i = /^(0*1)(\d*)$/.exec(r);
          if (i) {
            var o = i[1].length,
              _ = [];
            if (!(n + o > e.length)) {
              for (var l = 0; l < o; l++) _[l] = e[n], n++;
              return a && (_[0] = parseInt(i[2] || "0", 2)), t[0] = n, _;
            }
          }
        }
      },
      G = function (e, t) {
        var a = q(e, t, 1);
        if (a) {
          var n = z(a),
            s = t[0],
            r = [];
          if (n < 2147483647) {
            if (s + n > e.length) return;
            for (var i = 0; i < n; i++) r[i] = e[s], s++;
          }
          return t[0] = s, r;
        }
      },
      U = W.i18n = {
        lang: "zh-CN",
        alias: {
          "zh-CN": "zh",
          "en-US": "en"
        },
        locales: {},
        data: {},
        put: function (e, t) {
          var a = T + ".i18n.put: ",
            n = e.overwrite;
          n = null == n || n;
          var s = e.lang;
          if (!(s = U.alias[s] || s)) throw new Error(a + "set.lang?");
          var r = U.locales[s];
          r || (r = {}, U.locales[s] = r);
          for (var i, o = /^([\w\-]+):/, _ = 0; _ < t.length; _++) {
            var l = t[_];
            if (i = o.exec(l)) {
              var f = i[1],
                l = l.substr(f.length + 1);
              !n && r[f] || (r[f] = l);
            } else Q(a + "'key:'? " + l, 3, e);
          }
        },
        get: function () {
          return U.v_G.apply(null, arguments);
        },
        v_G: function (n, s, e) {
          s = s || [], e = e || U.lang, e = U.alias[e] || e;
          var t = U.locales[e],
            r = t && t[n] || "";
          return r || "zh" == e ? (U.lastLang = e, "=Empty" == r ? "" : r.replace(/\{(\d+)(\!?)\}/g, function (e, t, a) {
            return e = s[(t = +t || 0) - 1], (t < 1 || t > s.length) && (e = "{?}", Q("i18n[" + n + "] no {" + t + "}: " + r, 3)), a ? "" : e;
          })) : "en" == e ? U.v_G(n, s, "zh") : U.v_G(n, s, "en");
        },
        $T: function () {
          return U.v_T.apply(null, arguments);
        },
        v_T: function () {
          for (var e, t = arguments, a = "", n = [], s = 0, r = T + ".i18n.$T:", i = /^([\w\-]*):/, o = 0; o < t.length; o++) {
            var _ = t[o];
            if (0 == o) {
              if (e = i.exec(_), !(a = e && e[1])) throw new Error(r + "0 'key:'?");
              _ = _.substr(a.length + 1);
            }
            if (-1 === s) n.push(_);else {
              if (s) throw new Error(r + " bad args");
              if (0 === _) s = -1;else if (f(_)) {
                if (_ < 1) throw new Error(r + " bad args");
                s = _;
              } else {
                var l = 1 == o ? "en" : o ? "" : "zh";
                if ((e = i.exec(_)) && (l = e[1] || l, _ = _.substr(e[1].length + 1)), !e || !l) throw new Error(r + o + " 'lang:'?");
                U.put({
                  lang: l,
                  overwrite: !1
                }, [a + ":" + _]);
              }
            }
          }
          return a ? 0 < s ? a : U.v_G(a, n) : "";
        }
      },
      $ = U.$T;
    $.G = U.get, $("NonBrowser-1::非浏览器环境，不支持{1}", 1), $("IllegalArgs-1::参数错误：{1}", 1), $("NeedImport-2::调用{1}需要先导入{2}", 2), $("NotSupport-1::不支持：{1}", 1), W.TrafficImgUrl = "//ia.51.la/go1?id=20469973&pvFlag=1";
    var l = W.Traffic = function (e) {
      if (y) {
        e = e ? "/" + T + "/Report/" + e : "";
        var t = W.TrafficImgUrl;
        if (t) {
          var a = W.Traffic,
            n = /^(https?:..[^\/#]*\/?)[^#]*/i.exec(location.href) || [],
            s = n[1] || "http://file/",
            r = (n[0] || s) + e;
          if (0 == t.indexOf("//") && (t = /^https:/i.test(r) ? "https:" + t : "http:" + t), e && (t = t + "&cu=" + encodeURIComponent(s + e)), !a[r]) {
            a[r] = 1;
            var i = new Image();
            i.src = t, Q("Traffic Analysis Image: " + (e || T + ".TrafficImgUrl=" + W.TrafficImgUrl));
          }
        }
      }
    };
    t && (Q($("8HO5::覆盖导入{1}", 0, T), 1), t.Destroy());
    e[T] = W;
  }(a, t), module.exports && (module.exports = a.Recorder);
}(), function (e) {
  var t = "object" == typeof window && !!window.document,
    a = (t ? window : Object).Recorder,
    n = a.i18n;
  !function (m, e, u, t) {

    var o = "48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000",
      _ = "8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 192, 224, 256, 320";
    m.prototype.enc_mp3 = {
      stable: !0,
      takeEC: "full",
      getTestMsg: function () {
        return u("Zm7L::采样率范围：{1}；比特率范围：{2}（不同比特率支持的采样率范围不同，小于32kbps时采样率需小于32000）", 0, o, _);
      }
    };
    var h,
      v = function (e) {
        var t = e.bitRate,
          a = e.sampleRate,
          n = a;
        if (-1 == (" " + _ + ",").indexOf(" " + t + ",") && m.CLog(u("eGB9::{1}不在mp3支持的取值范围：{2}", 0, "bitRate=" + t, _), 3), -1 == (" " + o + ",").indexOf(" " + a + ",")) {
          for (var s = o.split(", "), r = [], i = 0; i < s.length; i++) r.push({
            v: +s[i],
            s: Math.abs(s[i] - a)
          });
          r.sort(function (e, t) {
            return e.s - t.s;
          }), n = r[0].v, e.sampleRate = n, m.CLog(u("zLTa::sampleRate已更新为{1}，因为{2}不在mp3支持的取值范围：{3}", 0, n, a, o), 3);
        }
      },
      n = function () {
        return u.G("NeedImport-2", ["mp3.js", "src/engine/mp3-engine.js"]);
      },
      d = t && "function" == typeof Worker;
    m.prototype.mp3 = function (r, i, o) {
      var e = this,
        _ = e.set,
        l = r.length;
      if (m.lamejs) {
        if (d) {
          var t = e.mp3_start(_);
          if (t) {
            if (t.isW) return e.mp3_encode(t, r), void e.mp3_complete(t, i, o, 1);
            e.mp3_stop(t);
          }
        }
        v(_);
        var f = new m.lamejs.Mp3Encoder(1, _.sampleRate, _.bitRate),
          c = new Int8Array(5e5),
          u = 0,
          h = 0,
          b = 0,
          p = function () {
            try {
              if (h < l) var e = f.encodeBuffer(r.subarray(h, h + 57600));else {
                b = 1;
                var e = f.flush();
              }
            } catch (e) {
              if (console.error(e), !b) try {
                f.flush();
              } catch (e) {
                console.error(e);
              }
              return void o("MP3 Encoder: " + e.message);
            }
            var t = e.length;
            if (0 < t) {
              if (u + t > c.length) {
                var a = new Int8Array(c.length + Math.max(5e5, t));
                a.set(c.subarray(0, u)), c = a;
              }
              c.set(e, u), u += t;
            }
            if (h < l) h += 57600, setTimeout(p);else {
              var n = [c.buffer.slice(0, u)],
                s = g.fn(n, u, l, _.sampleRate);
              S(s, _), i(n[0] || new ArrayBuffer(0), "audio/mp3");
            }
          };
        p();
      } else o(n());
    }, m.BindDestroy("mp3Worker", function () {
      h && (m.CLog("mp3Worker Destroy"), h.terminate(), h = null);
    }), m.prototype.mp3_envCheck = function (e, t) {
      var a = "";
      return t.takeoffEncodeChunk && (p() || (a = u("yhUs::当前浏览器版本太低，无法实时处理"))), a || m.lamejs || (a = n()), a;
    }, m.prototype.mp3_start = function (e) {
      return p(e);
    };
    var b = {
        id: 0
      },
      p = function (t, e) {
        var f,
          a = function (e) {
            var t = e.data,
              a = f.wkScope.wk_ctxs,
              n = f.wkScope.wk_lame,
              s = f.wkScope.wk_mp3TrimFix,
              r = a[t.id];
            if ("init" == t.action) a[t.id] = {
              sampleRate: t.sampleRate,
              bitRate: t.bitRate,
              takeoff: t.takeoff,
              pcmSize: 0,
              memory: new Int8Array(5e5),
              mOffset: 0,
              encObj: new n.Mp3Encoder(1, t.sampleRate, t.bitRate)
            };else if (!r) return;
            var i = function (e) {
              var t = e.length;
              if (r.mOffset + t > r.memory.length) {
                var a = new Int8Array(r.memory.length + Math.max(5e5, t));
                a.set(r.memory.subarray(0, r.mOffset)), r.memory = a;
              }
              r.memory.set(e, r.mOffset), r.mOffset += t;
            };
            switch (t.action) {
              case "stop":
                if (!r.isCp) try {
                  r.encObj.flush();
                } catch (e) {
                  console.error(e);
                }
                r.encObj = null, delete a[t.id];
                break;
              case "encode":
                if (r.isCp) break;
                r.pcmSize += t.pcm.length;
                try {
                  var o = r.encObj.encodeBuffer(t.pcm);
                } catch (e) {
                  r.err = e, console.error(e);
                }
                o && 0 < o.length && (r.takeoff ? c.onmessage({
                  action: "takeoff",
                  id: t.id,
                  chunk: o
                }) : i(o));
                break;
              case "complete":
                r.isCp = 1;
                try {
                  var o = r.encObj.flush();
                } catch (e) {
                  r.err = e, console.error(e);
                }
                if (o && 0 < o.length && (r.takeoff ? c.onmessage({
                  action: "takeoff",
                  id: t.id,
                  chunk: o
                }) : i(o)), r.err) {
                  c.onmessage({
                    action: t.action,
                    id: t.id,
                    err: "MP3 Encoder: " + r.err.message
                  });
                  break;
                }
                var _ = [r.memory.buffer.slice(0, r.mOffset)],
                  l = s.fn(_, r.mOffset, r.pcmSize, r.sampleRate);
                c.onmessage({
                  action: t.action,
                  id: t.id,
                  blob: _[0] || new ArrayBuffer(0),
                  meta: l
                });
            }
          },
          n = function (n) {
            c.onmessage = function (e) {
              var t = e;
              n && (t = e.data);
              var a = b[t.id];
              a && ("takeoff" == t.action ? a.set.takeoffEncodeChunk(new Uint8Array(t.chunk.buffer)) : (a.call && a.call(t), a.call = null));
            };
          },
          s = function () {
            var e = {
              worker: c,
              set: t
            };
            return t ? (e.id = ++b.id, b[e.id] = e, v(t), c.postMessage({
              action: "init",
              id: e.id,
              sampleRate: t.sampleRate,
              bitRate: t.bitRate,
              takeoff: !!t.takeoffEncodeChunk,
              x: new Int16Array(5)
            })) : c.postMessage({
              x: new Int16Array(5)
            }), e;
          },
          c = h;
        if (e || !d) return m.CLog(u("k9PT::当前环境不支持Web Worker，mp3实时编码器运行在主线程中"), 3), c = {
          postMessage: function (e) {
            a({
              data: e
            });
          }
        }, f = {
          wkScope: {
            wk_ctxs: {},
            wk_lame: m.lamejs,
            wk_mp3TrimFix: g
          }
        }, n(), s();
        try {
          if (!c) {
            var r = (a + "").replace(/[\w\$]+\.onmessage/g, "self.postMessage"),
              i = ");wk_lame();self.onmessage=" + (r = r.replace(/[\w\$]+\.wkScope/g, "wkScope"));
            i += ";var wkScope={ wk_ctxs:{},wk_lame:wk_lame", i += ",wk_mp3TrimFix:{rm:" + g.rm + ",fn:" + g.fn + "} }";
            var o = m.lamejs.toString(),
              _ = (window.URL || webkitURL).createObjectURL(new Blob(["var wk_lame=(", o, i], {
                type: "text/javascript"
              }));
            c = new Worker(_), setTimeout(function () {
              (window.URL || webkitURL).revokeObjectURL(_);
            }, 1e4), n(1);
          }
          var l = s();
          return l.isW = 1, h = c, l;
        } catch (e) {
          return c && c.terminate(), console.error(e), p(t, 1);
        }
      };
    m.prototype.mp3_stop = function (e) {
      if (e && e.worker) {
        e.worker.postMessage({
          action: "stop",
          id: e.id
        }), e.worker = null, delete b[e.id];
        var t = -1;
        for (var a in b) t++;
        t && m.CLog(u("fT6M::mp3 worker剩{1}个未stop", 0, t), 3);
      }
    }, m.prototype.mp3_encode = function (e, t) {
      e && e.worker && e.worker.postMessage({
        action: "encode",
        id: e.id,
        pcm: t
      });
    }, m.prototype.mp3_complete = function (t, a, n, s) {
      var r = this;
      t && t.worker ? (t.call = function (e) {
        s && r.mp3_stop(t), e.err ? n(e.err) : (S(e.meta, t.set), a(e.blob, "audio/mp3"));
      }, t.worker.postMessage({
        action: "complete",
        id: t.id
      })) : n(u("mPxH::mp3编码器未start"));
    }, m.mp3ReadMeta = function (e, t) {
      var a = "undefined" != typeof window && window.parseInt || "undefined" != typeof self && self.parseInt || parseInt,
        n = new Uint8Array(e[0] || []);
      if (n.length < 4) return null;
      var s = function (e, t) {
          return ("0000000" + ((t || n)[e] || 0).toString(2)).substr(-8);
        },
        r = s(0) + s(1),
        i = s(2) + s(3);
      if (!/^1{11}/.test(r)) return null;
      var o = {
          "00": 2.5,
          10: 2,
          11: 1
        }[r.substr(11, 2)],
        _ = {
          "01": 3
        }[r.substr(13, 2)],
        l = {
          1: [44100, 48e3, 32e3],
          2: [22050, 24e3, 16e3],
          2.5: [11025, 12e3, 8e3]
        }[o];
      l && (l = l[a(i.substr(4, 2), 2)]);
      var f = [[0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160], [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320]][1 == o ? 1 : 0][a(i.substr(0, 4), 2)];
      if (!(o && _ && f && l)) return null;
      for (var c = Math.round(8 * t / f), u = 1 == _ ? 384 : 2 == _ ? 1152 : 1 == o ? 1152 : 576, h = u / l * 1e3, b = Math.floor(u * f / 8 / l * 1e3), p = 0, m = 0, v = 0; v < e.length; v++) {
        var d = e[v];
        if (m += d.byteLength, b + 3 <= m) {
          var g = new Uint8Array(d),
            S = d.byteLength - (m - (b + 3) + 1),
            w = s(S, g);
          p = "1" == w.charAt(6);
          break;
        }
      }
      return p && b++, {
        version: o,
        layer: _,
        sampleRate: l,
        bitRate: f,
        duration: c,
        size: t,
        hasPadding: p,
        frameSize: b,
        frameDurationFloat: h
      };
    };
    var g = {
        rm: m.mp3ReadMeta,
        fn: function (e, t, a, n) {
          var s = this.rm(e, t);
          if (!s) return {
            size: t,
            err: "mp3 unknown format"
          };
          var r = Math.round(a / n * 1e3),
            i = Math.floor((s.duration - r) / s.frameDurationFloat);
          if (0 < i) {
            var o = i * s.frameSize - (s.hasPadding ? 1 : 0);
            t -= o;
            for (var _ = 0, l = [], f = 0; f < e.length; f++) {
              var c = e[f];
              if (o <= 0) break;
              o >= c.byteLength ? (o -= c.byteLength, l.push(c), e.splice(f, 1), f--) : (e[f] = c.slice(o), _ = c, o = 0);
            }
            var u = this.rm(e, t);
            if (!u) {
              _ && (e[0] = _);
              for (var f = 0; f < l.length; f++) e.splice(f, 0, l[f]);
              s.err = "mp3 fix error: 已还原，错误原因不明";
            }
            var h = s.trimFix = {};
            h.remove = i, h.removeDuration = Math.round(i * s.frameDurationFloat), h.duration = Math.round(8 * t / s.bitRate);
          }
          return s;
        }
      },
      S = function (e, t) {
        var a = "MP3 Info: ";
        (e.sampleRate && e.sampleRate != t.sampleRate || e.bitRate && e.bitRate != t.bitRate) && (m.CLog(a + u("uY9i::和设置的不匹配{1}，已更新成{2}", 0, "set:" + t.bitRate + "kbps " + t.sampleRate + "hz", "set:" + e.bitRate + "kbps " + e.sampleRate + "hz"), 3, t), t.sampleRate = e.sampleRate, t.bitRate = e.bitRate);
        var n = e.trimFix;
        n ? (a += u("iMSm::Fix移除{1}帧", 0, n.remove) + " " + n.removeDuration + "ms -> " + n.duration + "ms", 2 < n.remove && (e.err = (e.err ? e.err + ", " : "") + u("b9zm::移除帧数过多"))) : a += (e.duration || "-") + "ms", e.err ? m.CLog(a, e.size ? 1 : 0, e.err, e) : m.CLog(a, e);
      };
  }(a, 0, n.$T, t);
}(), function (e) {

  function t() {
    var d = function (e) {
        return Math.log(e) / Math.log(10);
      },
      me = function (e) {
        throw new Error("abort(" + e + ")");
      };
    function w(e) {
      return new Int8Array(e);
    }
    function s(e) {
      return new Int16Array(e);
    }
    function ve(e) {
      return new Int32Array(e);
    }
    function de(e) {
      return new Float32Array(e);
    }
    function n(e) {
      return new Float64Array(e);
    }
    function ge(e) {
      if (1 == e.length) return de(e[0]);
      var t = e[0];
      e = e.slice(1);
      for (var a = [], n = 0; n < t; n++) a.push(ge(e));
      return a;
    }
    function S(e) {
      if (1 == e.length) return ve(e[0]);
      var t = e[0];
      e = e.slice(1);
      for (var a = [], n = 0; n < t; n++) a.push(S(e));
      return a;
    }
    function M(e) {
      if (1 == e.length) return s(e[0]);
      var t = e[0];
      e = e.slice(1);
      for (var a = [], n = 0; n < t; n++) a.push(M(e));
      return a;
    }
    function E(e) {
      if (1 == e.length) return new Array(e[0]);
      var t = e[0];
      e = e.slice(1);
      for (var a = [], n = 0; n < t; n++) a.push(E(e));
      return a;
    }
    var Se = {
        fill: function (e, t, a, n) {
          if (2 == arguments.length) for (var s = 0; s < e.length; s++) e[s] = t;else for (var s = t; s < a; s++) e[s] = n;
        }
      },
      I = {
        arraycopy: function (e, t, a, n, s) {
          for (var r = t + s; t < r;) a[n++] = e[t++];
        }
      },
      V = {};
    function we(e) {
      this.ordinal = e;
    }
    V.SQRT2 = 1.4142135623730951, V.FAST_LOG10 = function (e) {
      return d(e);
    }, V.FAST_LOG10_X = function (e, t) {
      return d(e) * t;
    }, we.short_block_allowed = new we(0), we.short_block_coupled = new we(1), we.short_block_dispensed = new we(2), we.short_block_forced = new we(3);
    var D = {};
    function Me(e) {
      this.ordinal = e;
    }
    function ye(e) {
      var t = e;
      this.ordinal = function () {
        return t;
      };
    }
    function A() {
      var w = null;
      function v(e) {
        this.bits = 0 | e;
      }
      this.qupvt = null, this.setModules = function (e) {
        this.qupvt = e, w = e;
      };
      var s = [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 1], [1, 1], [1, 2], [2, 2], [2, 3], [2, 3], [3, 4], [3, 4], [3, 4], [4, 5], [4, 5], [4, 6], [5, 6], [5, 6], [5, 7], [6, 7], [6, 7]];
      function M(e, t, a, n, s, r) {
        var i = .5946 / t;
        for (e >>= 1; 0 != e--;) s[r++] = i > a[n++] ? 0 : 1, s[r++] = i > a[n++] ? 0 : 1;
      }
      function y(e, t, a, n, s, r) {
        var i = (e >>= 1) % 2;
        for (e >>= 1; 0 != e--;) {
          var o, _, l, f, c, u, h, b;
          o = a[n++] * t, _ = a[n++] * t, c = 0 | o, l = a[n++] * t, u = 0 | _, f = a[n++] * t, h = 0 | l, o += w.adj43[c], b = 0 | f, _ += w.adj43[u], s[r++] = 0 | o, l += w.adj43[h], s[r++] = 0 | _, f += w.adj43[b], s[r++] = 0 | l, s[r++] = 0 | f;
        }
        0 != i && (o = a[n++] * t, _ = a[n++] * t, c = 0 | o, u = 0 | _, o += w.adj43[c], _ += w.adj43[u], s[r++] = 0 | o, s[r++] = 0 | _);
      }
      var o = [1, 2, 5, 7, 7, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13];
      function d(e, t, a, n) {
        var s = function (e, t, a) {
          var n = 0,
            s = 0;
          do {
            var r = e[t++],
              i = e[t++];
            n < r && (n = r), s < i && (s = i);
          } while (t < a);
          return n < s && (n = s), n;
        }(e, t, a);
        switch (s) {
          case 0:
            return s;
          case 1:
            return function (e, t, a, n) {
              var s = 0,
                r = k.ht[1].hlen;
              do {
                var i = 2 * e[t + 0] + e[t + 1];
                t += 2, s += r[i];
              } while (t < a);
              return n.bits += s, 1;
            }(e, t, a, n);
          case 2:
          case 3:
            return function (e, t, a, n, s) {
              var r,
                i,
                o = 0,
                _ = k.ht[n].xlen;
              i = 2 == n ? k.table23 : k.table56;
              do {
                var l = e[t + 0] * _ + e[t + 1];
                t += 2, o += i[l];
              } while (t < a);
              return (r = 65535 & o) < (o >>= 16) && (o = r, n++), s.bits += o, n;
            }(e, t, a, o[s - 1], n);
          case 4:
          case 5:
          case 6:
          case 7:
          case 8:
          case 9:
          case 10:
          case 11:
          case 12:
          case 13:
          case 14:
          case 15:
            return function (e, t, a, n, s) {
              var r = 0,
                i = 0,
                o = 0,
                _ = k.ht[n].xlen,
                l = k.ht[n].hlen,
                f = k.ht[n + 1].hlen,
                c = k.ht[n + 2].hlen;
              do {
                var u = e[t + 0] * _ + e[t + 1];
                t += 2, r += l[u], i += f[u], o += c[u];
              } while (t < a);
              var h = n;
              return i < r && (r = i, h++), o < r && (r = o, h = n + 2), s.bits += r, h;
            }(e, t, a, o[s - 1], n);
          default:
            var r, i;
            for (T.IXMAX_VAL < s && me(), s -= 15, r = 24; r < 32 && !(k.ht[r].linmax >= s); r++);
            for (i = r - 8; i < 24 && !(k.ht[i].linmax >= s); i++);
            return function (e, t, a, n, s, r) {
              var i,
                o = 65536 * k.ht[n].xlen + k.ht[s].xlen,
                _ = 0;
              do {
                var l = e[t++],
                  f = e[t++];
                0 != l && (14 < l && (l = 15, _ += o), l *= 16), 0 != f && (14 < f && (f = 15, _ += o), l += f), _ += k.largetbl[l];
              } while (t < a);
              return (i = 65535 & _) < (_ >>= 16) && (_ = i, n = s), r.bits += _, n;
            }(e, t, a, i, r, n);
        }
      }
      function h(e, t, a, n, s, r, i, o) {
        for (var _ = t.big_values, l = 2; l < Ae.SBMAX_l + 1; l++) {
          var f = e.scalefac_band.l[l];
          if (_ <= f) break;
          var c = s[l - 2] + t.count1bits;
          if (a.part2_3_length <= c) break;
          var u = new v(c),
            h = d(n, f, _, u);
          c = u.bits, a.part2_3_length <= c || (a.assign(t), a.part2_3_length = c, a.region0_count = r[l - 2], a.region1_count = l - 2 - r[l - 2], a.table_select[0] = i[l - 2], a.table_select[1] = o[l - 2], a.table_select[2] = h);
        }
      }
      this.noquant_count_bits = function (e, t, a) {
        var n = t.l3_enc,
          s = Math.min(576, t.max_nonzero_coeff + 2 >> 1 << 1);
        for (null != a && (a.sfb_count1 = 0); 1 < s && 0 == (n[s - 1] | n[s - 2]); s -= 2);
        t.count1 = s;
        for (var r = 0, i = 0; 3 < s; s -= 4) {
          var o;
          if (1 < (2147483647 & (n[s - 1] | n[s - 2] | n[s - 3] | n[s - 4]))) break;
          o = 2 * (2 * (2 * n[s - 4] + n[s - 3]) + n[s - 2]) + n[s - 1], r += k.t32l[o], i += k.t33l[o];
        }
        var _ = r;
        if (t.count1table_select = 0, i < r && (_ = i, t.count1table_select = 1), t.count1bits = _, 0 == (t.big_values = s)) return _;
        if (t.block_type == Ae.SHORT_TYPE) (r = 3 * e.scalefac_band.s[3]) > t.big_values && (r = t.big_values), i = t.big_values;else if (t.block_type == Ae.NORM_TYPE) {
          if (r = t.region0_count = e.bv_scf[s - 2], i = t.region1_count = e.bv_scf[s - 1], i = e.scalefac_band.l[r + i + 2], r = e.scalefac_band.l[r + 1], i < s) {
            var l = new v(_);
            t.table_select[2] = d(n, i, s, l), _ = l.bits;
          }
        } else t.region0_count = 7, t.region1_count = Ae.SBMAX_l - 1 - 7 - 1, r = e.scalefac_band.l[8], (i = s) < r && (r = i);
        if (r = Math.min(r, s), i = Math.min(i, s), 0 < r) {
          var l = new v(_);
          t.table_select[0] = d(n, 0, r, l), _ = l.bits;
        }
        if (r < i) {
          var l = new v(_);
          t.table_select[1] = d(n, r, i, l), _ = l.bits;
        }
        if (2 == e.use_best_huffman && me(), null != a && t.block_type == Ae.NORM_TYPE) {
          for (var f = 0; e.scalefac_band.l[f] < t.big_values;) f++;
          a.sfb_count1 = f;
        }
        return _;
      }, this.count_bits = function (e, t, a, n) {
        var s = a.l3_enc,
          r = T.IXMAX_VAL / w.IPOW20(a.global_gain);
        return a.xrpow_max > r ? T.LARGE_BITS : (function (e, t, a, n, s) {
          var r,
            i,
            o,
            _ = 0,
            l = 0,
            f = 0,
            c = 0,
            u = t,
            h = 0,
            b = u,
            p = 0,
            m = e,
            v = 0;
          for (o = null != s && n.global_gain == s.global_gain, i = n.block_type == Ae.SHORT_TYPE ? 38 : 21, r = 0; r <= i; r++) {
            var d = -1;
            if ((o || n.block_type == Ae.NORM_TYPE) && (d = n.global_gain - (n.scalefac[r] + (0 != n.preflag ? w.pretab[r] : 0) << n.scalefac_scale + 1) - 8 * n.subblock_gain[n.window[r]]), o && s.step[r] == d) 0 != l && (y(l, a, m, v, b, p), l = 0), 0 != f && me();else {
              var g,
                S = n.width[r];
              if (_ + n.width[r] > n.max_nonzero_coeff && (g = n.max_nonzero_coeff - _ + 1, Se.fill(t, n.max_nonzero_coeff, 576, 0), (S = g) < 0 && (S = 0), r = i + 1), 0 == l && 0 == f && (b = u, p = h, m = e, v = c), null != s && 0 < s.sfb_count1 && r >= s.sfb_count1 && 0 < s.step[r] && d >= s.step[r] ? (0 != l && (y(l, a, m, v, b, p), l = 0, b = u, p = h, m = e, v = c), f += S) : (0 != f && (M(f, a, m, v, b, p), f = 0, b = u, p = h, m = e, v = c), l += S), S <= 0) {
                0 != f && me(), 0 != l && me();
                break;
              }
            }
            r <= i && (h += n.width[r], c += n.width[r], _ += n.width[r]);
          }
          0 != l && (y(l, a, m, v, b, p), l = 0), 0 != f && me();
        }(t, s, w.IPOW20(a.global_gain), a, n), 0 != (2 & e.substep_shaping) && me(), this.noquant_count_bits(e, a, n));
      }, this.best_huffman_divide = function (e, t) {
        var a = new B(),
          n = t.l3_enc,
          s = ve(23),
          r = ve(23),
          i = ve(23),
          o = ve(23);
        if (t.block_type != Ae.SHORT_TYPE || 1 != e.mode_gr) {
          a.assign(t), t.block_type == Ae.NORM_TYPE && (function (e, t, a, n, s, r, i) {
            for (var o = t.big_values, _ = 0; _ <= 22; _++) n[_] = T.LARGE_BITS;
            for (var _ = 0; _ < 16; _++) {
              var l = e.scalefac_band.l[_ + 1];
              if (o <= l) break;
              var f = 0,
                c = new v(f),
                u = d(a, 0, l, c);
              f = c.bits;
              for (var h = 0; h < 8; h++) {
                var b = e.scalefac_band.l[_ + h + 2];
                if (o <= b) break;
                var p = f;
                c = new v(p);
                var m = d(a, l, b, c);
                p = c.bits, n[_ + h] > p && (n[_ + h] = p, s[_ + h] = _, r[_ + h] = u, i[_ + h] = m);
              }
            }
          }(e, t, n, s, r, i, o), h(e, a, t, n, s, r, i, o));
          var _ = a.big_values;
          if (!(0 == _ || 1 < (n[_ - 2] | n[_ - 1]) || 576 < (_ = t.count1 + 2))) {
            a.assign(t), a.count1 = _;
            for (var l = 0, f = 0; _ > a.big_values; _ -= 4) {
              var c = 2 * (2 * (2 * n[_ - 4] + n[_ - 3]) + n[_ - 2]) + n[_ - 1];
              l += k.t32l[c], f += k.t33l[c];
            }
            if (a.big_values = _, a.count1table_select = 0, f < l && (l = f, a.count1table_select = 1), a.count1bits = l, a.block_type == Ae.NORM_TYPE) h(e, a, t, n, s, r, i, o);else {
              if (a.part2_3_length = l, l = e.scalefac_band.l[8], _ < l && (l = _), 0 < l) {
                var u = new v(a.part2_3_length);
                a.table_select[0] = d(n, 0, l, u), a.part2_3_length = u.bits;
              }
              if (l < _) {
                var u = new v(a.part2_3_length);
                a.table_select[1] = d(n, l, _, u), a.part2_3_length = u.bits;
              }
              t.part2_3_length > a.part2_3_length && t.assign(a);
            }
          }
        }
      };
      var u = [1, 1, 1, 1, 8, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16],
        b = [1, 2, 4, 8, 1, 2, 4, 8, 2, 4, 8, 2, 4, 8, 4, 8],
        p = [0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4],
        m = [0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3];
      A.slen1_tab = p, A.slen2_tab = m, this.best_scalefac_store = function (e, t, a, n) {
        var s,
          r,
          i,
          o,
          _ = n.tt[t][a],
          l = 0;
        for (s = i = 0; s < _.sfbmax; s++) {
          var f = _.width[s];
          for (i += f, o = -f; o < 0 && 0 == _.l3_enc[o + i]; o++);
          0 == o && (_.scalefac[s] = l = -2);
        }
        if (0 == _.scalefac_scale && 0 == _.preflag) {
          var c = 0;
          for (s = 0; s < _.sfbmax; s++) 0 < _.scalefac[s] && (c |= _.scalefac[s]);
          if (0 == (1 & c) && 0 != c) {
            for (s = 0; s < _.sfbmax; s++) 0 < _.scalefac[s] && (_.scalefac[s] >>= 1);
            _.scalefac_scale = l = 1;
          }
        }
        if (0 == _.preflag && _.block_type != Ae.SHORT_TYPE && 2 == e.mode_gr) {
          for (s = 11; s < Ae.SBPSY_l && !(_.scalefac[s] < w.pretab[s] && -2 != _.scalefac[s]); s++);
          if (s == Ae.SBPSY_l) {
            for (s = 11; s < Ae.SBPSY_l; s++) 0 < _.scalefac[s] && (_.scalefac[s] -= w.pretab[s]);
            _.preflag = l = 1;
          }
        }
        for (r = 0; r < 4; r++) n.scfsi[a][r] = 0;
        for (2 == e.mode_gr && 1 == t && n.tt[0][a].block_type != Ae.SHORT_TYPE && n.tt[1][a].block_type != Ae.SHORT_TYPE && (function (e, t) {
          for (var a, n = t.tt[1][e], s = t.tt[0][e], r = 0; r < k.scfsi_band.length - 1; r++) {
            for (a = k.scfsi_band[r]; a < k.scfsi_band[r + 1] && !(s.scalefac[a] != n.scalefac[a] && 0 <= n.scalefac[a]); a++);
            if (a == k.scfsi_band[r + 1]) {
              for (a = k.scfsi_band[r]; a < k.scfsi_band[r + 1]; a++) n.scalefac[a] = -1;
              t.scfsi[e][r] = 1;
            }
          }
          var i = 0,
            o = 0;
          for (a = 0; a < 11; a++) -1 != n.scalefac[a] && (o++, i < n.scalefac[a] && (i = n.scalefac[a]));
          for (var _ = 0, l = 0; a < Ae.SBPSY_l; a++) -1 != n.scalefac[a] && (l++, _ < n.scalefac[a] && (_ = n.scalefac[a]));
          for (var r = 0; r < 16; r++) if (i < u[r] && _ < b[r]) {
            var f = p[r] * o + m[r] * l;
            n.part2_length > f && (n.part2_length = f, n.scalefac_compress = r);
          }
        }(a, n), l = 0), s = 0; s < _.sfbmax; s++) -2 == _.scalefac[s] && (_.scalefac[s] = 0);
        0 != l && (2 == e.mode_gr ? this.scale_bitcount(_) : this.scale_bitcount_lsf(e, _));
      };
      var _ = [0, 18, 36, 54, 54, 36, 54, 72, 54, 72, 90, 72, 90, 108, 108, 126],
        l = [0, 18, 36, 54, 51, 35, 53, 71, 52, 70, 88, 69, 87, 105, 104, 122],
        f = [0, 10, 20, 30, 33, 21, 31, 41, 32, 42, 52, 43, 53, 63, 64, 74];
      this.scale_bitcount = function (e) {
        var t,
          a,
          n,
          s = 0,
          r = 0,
          i = e.scalefac;
        if (e.block_type == Ae.SHORT_TYPE) n = _, 0 != e.mixed_block_flag && (n = l);else if (n = f, 0 == e.preflag) {
          for (a = 11; a < Ae.SBPSY_l && !(i[a] < w.pretab[a]); a++);
          if (a == Ae.SBPSY_l) for (e.preflag = 1, a = 11; a < Ae.SBPSY_l; a++) i[a] -= w.pretab[a];
        }
        for (a = 0; a < e.sfbdivide; a++) s < i[a] && (s = i[a]);
        for (; a < e.sfbmax; a++) r < i[a] && (r = i[a]);
        for (e.part2_length = T.LARGE_BITS, t = 0; t < 16; t++) s < u[t] && r < b[t] && e.part2_length > n[t] && (e.part2_length = n[t], e.scalefac_compress = t);
        return e.part2_length == T.LARGE_BITS;
      };
      var g = [[15, 15, 7, 7], [15, 15, 7, 0], [7, 3, 0, 0], [15, 31, 31, 0], [7, 7, 7, 0], [3, 3, 0, 0]];
      this.scale_bitcount_lsf = function (e, t) {
        var a,
          n,
          s,
          r,
          i,
          o,
          _,
          l,
          f = ve(4),
          c = t.scalefac;
        for (a = 0 != t.preflag ? 2 : 0, _ = 0; _ < 4; _++) f[_] = 0;
        if (t.block_type == Ae.SHORT_TYPE) {
          n = 1;
          var u = w.nr_of_sfb_block[a][n];
          for (s = l = 0; s < 4; s++) for (r = u[s] / 3, _ = 0; _ < r; _++, l++) for (i = 0; i < 3; i++) c[3 * l + i] > f[s] && (f[s] = c[3 * l + i]);
        } else {
          n = 0;
          var u = w.nr_of_sfb_block[a][n];
          for (s = l = 0; s < 4; s++) for (r = u[s], _ = 0; _ < r; _++, l++) c[l] > f[s] && (f[s] = c[l]);
        }
        for (o = !1, s = 0; s < 4; s++) f[s] > g[a][s] && (o = !0);
        if (!o) {
          var h, b, p, m;
          for (t.sfb_partition_table = w.nr_of_sfb_block[a][n], s = 0; s < 4; s++) t.slen[s] = S[f[s]];
          switch (h = t.slen[0], b = t.slen[1], p = t.slen[2], m = t.slen[3], a) {
            case 0:
              t.scalefac_compress = (5 * h + b << 4) + (p << 2) + m;
              break;
            case 1:
              t.scalefac_compress = 400 + (5 * h + b << 2) + p;
              break;
            case 2:
              t.scalefac_compress = 500 + 3 * h + b;
          }
        }
        if (!o) for (t.part2_length = 0, s = 0; s < 4; s++) t.part2_length += t.slen[s] * t.sfb_partition_table[s];
        return o;
      };
      var S = [0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4];
      this.huffman_init = function (e) {
        for (var t = 2; t <= 576; t += 2) {
          for (var a, n = 0; e.scalefac_band.l[++n] < t;);
          for (a = s[n][0]; e.scalefac_band.l[a + 1] > t;) a--;
          for (a < 0 && (a = s[n][0]), e.bv_scf[t - 2] = a, a = s[n][1]; e.scalefac_band.l[a + e.bv_scf[t - 2] + 2] > t;) a--;
          a < 0 && (a = s[n][1]), e.bv_scf[t - 1] = a;
        }
      };
    }
    function O() {}
    function y() {
      this.setModules = function (e, t, a) {};
      var o = [0, 49345, 49537, 320, 49921, 960, 640, 49729, 50689, 1728, 1920, 51009, 1280, 50625, 50305, 1088, 52225, 3264, 3456, 52545, 3840, 53185, 52865, 3648, 2560, 51905, 52097, 2880, 51457, 2496, 2176, 51265, 55297, 6336, 6528, 55617, 6912, 56257, 55937, 6720, 7680, 57025, 57217, 8e3, 56577, 7616, 7296, 56385, 5120, 54465, 54657, 5440, 55041, 6080, 5760, 54849, 53761, 4800, 4992, 54081, 4352, 53697, 53377, 4160, 61441, 12480, 12672, 61761, 13056, 62401, 62081, 12864, 13824, 63169, 63361, 14144, 62721, 13760, 13440, 62529, 15360, 64705, 64897, 15680, 65281, 16320, 16e3, 65089, 64001, 15040, 15232, 64321, 14592, 63937, 63617, 14400, 10240, 59585, 59777, 10560, 60161, 11200, 10880, 59969, 60929, 11968, 12160, 61249, 11520, 60865, 60545, 11328, 58369, 9408, 9600, 58689, 9984, 59329, 59009, 9792, 8704, 58049, 58241, 9024, 57601, 8640, 8320, 57409, 40961, 24768, 24960, 41281, 25344, 41921, 41601, 25152, 26112, 42689, 42881, 26432, 42241, 26048, 25728, 42049, 27648, 44225, 44417, 27968, 44801, 28608, 28288, 44609, 43521, 27328, 27520, 43841, 26880, 43457, 43137, 26688, 30720, 47297, 47489, 31040, 47873, 31680, 31360, 47681, 48641, 32448, 32640, 48961, 32e3, 48577, 48257, 31808, 46081, 29888, 30080, 46401, 30464, 47041, 46721, 30272, 29184, 45761, 45953, 29504, 45313, 29120, 28800, 45121, 20480, 37057, 37249, 20800, 37633, 21440, 21120, 37441, 38401, 22208, 22400, 38721, 21760, 38337, 38017, 21568, 39937, 23744, 23936, 40257, 24320, 40897, 40577, 24128, 23040, 39617, 39809, 23360, 39169, 22976, 22656, 38977, 34817, 18624, 18816, 35137, 19200, 35777, 35457, 19008, 19968, 36545, 36737, 20288, 36097, 19904, 19584, 35905, 17408, 33985, 34177, 17728, 34561, 18368, 18048, 34369, 33281, 17088, 17280, 33601, 16640, 33217, 32897, 16448];
      this.updateMusicCRC = function (e, t, a, n) {
        for (var s = 0; s < n; ++s) e[0] = (r = t[a + s], i = (i = e[0]) >> 8 ^ o[255 & (i ^ r)]);
        var r, i;
      };
    }
    function N() {
      var i = this,
        r = null,
        o = null;
      this.setModules = function (e, t, a, n) {
        r = a, o = n;
      };
      var _ = null,
        l = 0,
        f = 0,
        c = 0;
      function v(e, t, a) {
        for (; 0 < a;) {
          var n;
          0 == c && (c = 8, f++, e.header[e.w_ptr].write_timing == l && (s = e, I.arraycopy(s.header[s.w_ptr].buf, 0, _, f, s.sideinfo_len), f += s.sideinfo_len, l += 8 * s.sideinfo_len, s.w_ptr = s.w_ptr + 1 & j.MAX_HEADER_BUF - 1), _[f] = 0), n = Math.min(a, c), a -= n, c -= n, _[f] |= t >> a << c, l += n;
        }
        var s;
      }
      function u(e, t) {
        var a,
          n = e.internal_flags;
        if (8 <= t && (v(n, 76, 8), t -= 8), 8 <= t && (v(n, 65, 8), t -= 8), 8 <= t && (v(n, 77, 8), t -= 8), 8 <= t && (v(n, 69, 8), t -= 8), 32 <= t) {
          var s = r.getLameShortVersion();
          if (32 <= t) for (a = 0; a < s.length && 8 <= t; ++a) t -= 8, v(n, s.charCodeAt(a), 8);
        }
        for (; 1 <= t; t -= 1) v(n, n.ancillary_flag, 1), n.ancillary_flag ^= e.disable_reservoir ? 0 : 1;
      }
      function h(e, t, a) {
        for (var n = e.header[e.h_ptr].ptr; 0 < a;) {
          var s = Math.min(a, 8 - (7 & n));
          a -= s, e.header[e.h_ptr].buf[n >> 3] |= t >> a << 8 - (7 & n) - s, n += s;
        }
        e.header[e.h_ptr].ptr = n;
      }
      function m(e, t) {
        var a,
          n = k.ht[t.count1table_select + 32],
          s = 0,
          r = t.big_values,
          i = t.big_values;
        for (a = (t.count1 - t.big_values) / 4; 0 < a; --a) {
          var o = 0,
            _ = 0;
          0 != t.l3_enc[r + 0] && (_ += 8, t.xr[i + 0] < 0 && o++), 0 != t.l3_enc[r + 1] && (_ += 4, o *= 2, t.xr[i + 1] < 0 && o++), 0 != t.l3_enc[r + 2] && (_ += 2, o *= 2, t.xr[i + 2] < 0 && o++), 0 != t.l3_enc[r + 3] && (_++, o *= 2, t.xr[i + 3] < 0 && o++), r += 4, i += 4, v(e, o + n.table[_], n.hlen[_]), s += n.hlen[_];
        }
        return s;
      }
      function b(e, t, a, n, s) {
        var r = k.ht[t],
          i = 0;
        if (0 == t) return i;
        for (var o = a; o < n; o += 2) {
          var _ = 0,
            l = 0,
            f = r.xlen,
            c = r.xlen,
            u = 0,
            h = s.l3_enc[o],
            b = s.l3_enc[o + 1];
          if (0 != h && (s.xr[o] < 0 && u++, _--), 15 < t) {
            if (14 < h) {
              var p = h - 15;
              u |= p << 1, l = f, h = 15;
            }
            if (14 < b) {
              var m = b - 15;
              u <<= f, u |= m, l += f, b = 15;
            }
            c = 16;
          }
          0 != b && (u <<= 1, s.xr[o + 1] < 0 && u++, _--), h = h * c + b, l -= _, _ += r.hlen[h], v(e, r.table[h], _), v(e, u, l), i += _ + l;
        }
        return i;
      }
      function d(e, t) {
        var a = 3 * e.scalefac_band.s[3];
        a > t.big_values && (a = t.big_values);
        var n = b(e, t.table_select[0], 0, a, t);
        return n += b(e, t.table_select[1], a, t.big_values, t);
      }
      function g(e, t) {
        var a, n, s, r;
        a = t.big_values;
        var i = t.region0_count + 1;
        return s = e.scalefac_band.l[i], i += t.region1_count + 1, r = e.scalefac_band.l[i], a < s && (s = a), a < r && (r = a), n = b(e, t.table_select[0], 0, s, t), n += b(e, t.table_select[1], s, r, t), n += b(e, t.table_select[2], r, a, t);
      }
      function p() {
        this.total = 0;
      }
      function S(e, t) {
        var a,
          n,
          s,
          r = e.internal_flags;
        return r.w_ptr, -1 == (s = r.h_ptr - 1) && (s = j.MAX_HEADER_BUF - 1), a = r.header[s].write_timing - l, 0 <= (t.total = a) && me(), n = i.getframebits(e), a += n, t.total += n, t.total % 8 != 0 ? t.total = 1 + t.total / 8 : t.total = t.total / 8, t.total += f + 1, a;
      }
      this.getframebits = function (e) {
        var t,
          a = e.internal_flags;
        t = 0 != a.bitrate_index ? k.bitrate_table[e.version][a.bitrate_index] : e.brate;
        var n = 0 | 72e3 * (e.version + 1) * t / e.out_samplerate + a.padding;
        return 8 * n;
      }, this.flush_bitstream = function (e) {
        var t,
          a,
          n = e.internal_flags;
          n.h_ptr - 1;
        t = n.l3_side, (a = S(e, new p())) < 0 || (u(e, a), n.ResvSize = 0, t.main_data_begin = 0, n.findReplayGain && me(), n.findPeakSample && me());
      }, this.format_bitstream = function (e) {
        var t,
          a = e.internal_flags;
        t = a.l3_side;
        var n = this.getframebits(e);
        u(e, t.resvDrain_pre), function (e, t) {
          var a,
            n,
            s,
            r = e.internal_flags;
          if (a = r.l3_side, r.header[r.h_ptr].ptr = 0, Se.fill(r.header[r.h_ptr].buf, 0, r.sideinfo_len, 0), e.out_samplerate < 16e3 ? h(r, 4094, 12) : h(r, 4095, 12), h(r, e.version, 1), h(r, 1, 2), h(r, e.error_protection ? 0 : 1, 1), h(r, r.bitrate_index, 4), h(r, r.samplerate_index, 2), h(r, r.padding, 1), h(r, e.extension, 1), h(r, e.mode.ordinal(), 2), h(r, r.mode_ext, 2), h(r, e.copyright, 1), h(r, e.original, 1), h(r, e.emphasis, 2), e.error_protection && h(r, 0, 16), 1 == e.version) {
            for (h(r, a.main_data_begin, 9), 2 == r.channels_out ? h(r, a.private_bits, 3) : h(r, a.private_bits, 5), s = 0; s < r.channels_out; s++) {
              var i;
              for (i = 0; i < 4; i++) h(r, a.scfsi[s][i], 1);
            }
            for (n = 0; n < 2; n++) for (s = 0; s < r.channels_out; s++) {
              var o = a.tt[n][s];
              h(r, o.part2_3_length + o.part2_length, 12), h(r, o.big_values / 2, 9), h(r, o.global_gain, 8), h(r, o.scalefac_compress, 4), o.block_type != Ae.NORM_TYPE ? (h(r, 1, 1), h(r, o.block_type, 2), h(r, o.mixed_block_flag, 1), 14 == o.table_select[0] && (o.table_select[0] = 16), h(r, o.table_select[0], 5), 14 == o.table_select[1] && (o.table_select[1] = 16), h(r, o.table_select[1], 5), h(r, o.subblock_gain[0], 3), h(r, o.subblock_gain[1], 3), h(r, o.subblock_gain[2], 3)) : (h(r, 0, 1), 14 == o.table_select[0] && (o.table_select[0] = 16), h(r, o.table_select[0], 5), 14 == o.table_select[1] && (o.table_select[1] = 16), h(r, o.table_select[1], 5), 14 == o.table_select[2] && (o.table_select[2] = 16), h(r, o.table_select[2], 5), h(r, o.region0_count, 4), h(r, o.region1_count, 3)), h(r, o.preflag, 1), h(r, o.scalefac_scale, 1), h(r, o.count1table_select, 1);
            }
          } else for (h(r, a.main_data_begin, 8), h(r, a.private_bits, r.channels_out), s = n = 0; s < r.channels_out; s++) {
            var o = a.tt[n][s];
            h(r, o.part2_3_length + o.part2_length, 12), h(r, o.big_values / 2, 9), h(r, o.global_gain, 8), h(r, o.scalefac_compress, 9), o.block_type != Ae.NORM_TYPE ? (h(r, 1, 1), h(r, o.block_type, 2), h(r, o.mixed_block_flag, 1), 14 == o.table_select[0] && (o.table_select[0] = 16), h(r, o.table_select[0], 5), 14 == o.table_select[1] && (o.table_select[1] = 16), h(r, o.table_select[1], 5), h(r, o.subblock_gain[0], 3), h(r, o.subblock_gain[1], 3), h(r, o.subblock_gain[2], 3)) : (h(r, 0, 1), 14 == o.table_select[0] && (o.table_select[0] = 16), h(r, o.table_select[0], 5), 14 == o.table_select[1] && (o.table_select[1] = 16), h(r, o.table_select[1], 5), 14 == o.table_select[2] && (o.table_select[2] = 16), h(r, o.table_select[2], 5), h(r, o.region0_count, 4), h(r, o.region1_count, 3)), h(r, o.scalefac_scale, 1), h(r, o.count1table_select, 1);
          }
          e.error_protection && me();
          var _ = r.h_ptr;
          r.h_ptr = _ + 1 & j.MAX_HEADER_BUF - 1, r.header[r.h_ptr].write_timing = r.header[_].write_timing + t, r.h_ptr, r.w_ptr;
        }(e, n);
        var s = 8 * a.sideinfo_len;
        if (s += function (e) {
          var t,
            a,
            n,
            s,
            r = 0,
            i = e.internal_flags,
            o = i.l3_side;
          if (1 == e.version) for (t = 0; t < 2; t++) for (a = 0; a < i.channels_out; a++) {
            var _ = o.tt[t][a],
              l = A.slen1_tab[_.scalefac_compress],
              f = A.slen2_tab[_.scalefac_compress];
            for (n = s = 0; n < _.sfbdivide; n++) -1 != _.scalefac[n] && (v(i, _.scalefac[n], l), s += l);
            for (; n < _.sfbmax; n++) -1 != _.scalefac[n] && (v(i, _.scalefac[n], f), s += f);
            _.block_type == Ae.SHORT_TYPE ? s += d(i, _) : s += g(i, _), s += m(i, _), r += s;
          } else for (a = t = 0; a < i.channels_out; a++) {
            var c,
              u,
              _ = o.tt[t][a],
              h = 0;
            if (u = n = s = 0, _.block_type == Ae.SHORT_TYPE) {
              for (; u < 4; u++) {
                var b = _.sfb_partition_table[u] / 3,
                  p = _.slen[u];
                for (c = 0; c < b; c++, n++) v(i, Math.max(_.scalefac[3 * n + 0], 0), p), v(i, Math.max(_.scalefac[3 * n + 1], 0), p), v(i, Math.max(_.scalefac[3 * n + 2], 0), p), h += 3 * p;
              }
              s += d(i, _);
            } else {
              for (; u < 4; u++) {
                var b = _.sfb_partition_table[u],
                  p = _.slen[u];
                for (c = 0; c < b; c++, n++) v(i, Math.max(_.scalefac[n], 0), p), h += p;
              }
              s += g(i, _);
            }
            s += m(i, _), r += h + s;
          }
          return r;
        }(e), u(e, t.resvDrain_post), s += t.resvDrain_post, t.main_data_begin += (n - s) / 8, S(e, new p()), a.ResvSize, 8 * t.main_data_begin != a.ResvSize && (a.ResvSize = 8 * t.main_data_begin), 1e9 < l) {
          var r;
          for (r = 0; r < j.MAX_HEADER_BUF; ++r) a.header[r].write_timing -= l;
          l = 0;
        }
        return 0;
      }, this.copy_buffer = function (e, t, a, n, s) {
        var r = f + 1;
        if (r <= 0) return 0;
        if (0 != n && n < r) return -1;
        if (I.arraycopy(_, 0, t, a, r), f = -1, (c = 0) != s) {
          var i = ve(1);
          i[0] = e.nMusicCRC, o.updateMusicCRC(i, t, a, r), e.nMusicCRC = i[0], 0 < r && (e.VBR_seek_table.nBytesWritten += r), e.decode_on_the_fly && me();
        }
        return r;
      }, this.init_bit_stream_w = function (e) {
        _ = w(Y.LAME_MAXMP3BUFFER), e.h_ptr = e.w_ptr = 0, e.header[e.h_ptr].write_timing = 0, f = -1, l = c = 0;
      };
    }
    function e(e, t, a, n) {
      this.xlen = e, this.linmax = t, this.table = a, this.hlen = n;
    }
    D.MAX_VALUE = 3.4028235e38, Me.vbr_off = new Me(0), Me.vbr_mt = new Me(1), Me.vbr_rh = new Me(2), Me.vbr_abr = new Me(3), Me.vbr_mtrh = new Me(4), Me.vbr_default = Me.vbr_mtrh, ye.STEREO = new ye(0), ye.JOINT_STEREO = new ye(1), ye.DUAL_CHANNEL = new ye(2), ye.MONO = new ye(3), ye.NOT_SET = new ye(4), O.STEPS_per_dB = 100, O.MAX_dB = 120, O.GAIN_NOT_ENOUGH_SAMPLES = -24601, O.GAIN_ANALYSIS_ERROR = 0, O.GAIN_ANALYSIS_OK = 1, O.INIT_GAIN_ANALYSIS_ERROR = 0, O.INIT_GAIN_ANALYSIS_OK = 1, O.MAX_ORDER = O.YULE_ORDER = 10, O.MAX_SAMPLES_PER_WINDOW = (O.MAX_SAMP_FREQ = 48e3) * (O.RMS_WINDOW_TIME_NUMERATOR = 1) / (O.RMS_WINDOW_TIME_DENOMINATOR = 20) + 1, y.NUMTOCENTRIES = 100, y.MAXFRAMESIZE = 2880, N.EQ = function (e, t) {
      return Math.abs(e) > Math.abs(t) ? Math.abs(e - t) <= 1e-6 * Math.abs(e) : Math.abs(e - t) <= 1e-6 * Math.abs(t);
    }, N.NEQ = function (e, t) {
      return !N.EQ(e, t);
    };
    var k = {};
    function R(e) {
      this.bits = e;
    }
    function x() {
      this.over_noise = 0, this.tot_noise = 0, this.max_noise = 0, this.over_count = 0, this.over_SSD = 0, this.bits = 0;
    }
    function r(e, t, a, n) {
      this.l = ve(1 + Ae.SBMAX_l), this.s = ve(1 + Ae.SBMAX_s), this.psfb21 = ve(1 + Ae.PSFB21), this.psfb12 = ve(1 + Ae.PSFB12);
      var s = this.l,
        r = this.s;
      4 == arguments.length && (this.arrL = e, this.arrS = t, this.arr21 = a, this.arr12 = n, I.arraycopy(this.arrL, 0, s, 0, Math.min(this.arrL.length, this.l.length)), I.arraycopy(this.arrS, 0, r, 0, Math.min(this.arrS.length, this.s.length)), I.arraycopy(this.arr21, 0, this.psfb21, 0, Math.min(this.arr21.length, this.psfb21.length)), I.arraycopy(this.arr12, 0, this.psfb12, 0, Math.min(this.arr12.length, this.psfb12.length)));
    }
    function T() {
      var l = null,
        b = null,
        n = null;
      this.setModules = function (e, t, a) {
        l = e, b = t, n = a;
      }, this.IPOW20 = function (e) {
        return h[e];
      };
      var B = 2.220446049250313e-16,
        e = T.IXMAX_VAL,
        f = e + 2,
        c = T.Q_MAX,
        u = T.Q_MAX2,
        s = 100;
      this.nr_of_sfb_block = [[[6, 5, 5, 5], [9, 9, 9, 9], [6, 9, 9, 9]], [[6, 5, 7, 3], [9, 9, 12, 6], [6, 9, 12, 6]], [[11, 10, 0, 0], [18, 18, 0, 0], [15, 18, 0, 0]], [[7, 7, 7, 0], [12, 12, 12, 0], [6, 15, 12, 0]], [[6, 6, 6, 3], [12, 9, 9, 6], [6, 12, 9, 6]], [[8, 8, 5, 0], [15, 12, 9, 0], [6, 18, 9, 0]]];
      var M = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0];
      this.pretab = M, this.sfBandIndex = [new r([0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576], [0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]), new r([0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 332, 394, 464, 540, 576], [0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]), new r([0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576], [0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]), new r([0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342, 418, 576], [0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]), new r([0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330, 384, 576], [0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]), new r([0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448, 550, 576], [0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]), new r([0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576], [0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]), new r([0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576], [0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]), new r([0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568, 570, 572, 574, 576], [0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0])];
      var y = de(c + u + 1),
        h = de(c),
        p = de(f),
        m = de(f);
      function v(e, t) {
        var a = n.ATHformula(t, e);
        return a -= s, a = Math.pow(10, a / 10 + e.ATHlower);
      }
      function A(e) {
        this.s = e;
      }
      this.adj43 = m, this.iteration_init = function (e) {
        var t,
          a = e.internal_flags,
          n = a.l3_side;
        if (0 == a.iteration_init_init) {
          for (a.iteration_init_init = 1, n.main_data_begin = 0, function (e) {
            for (var t = e.internal_flags.ATH.l, a = e.internal_flags.ATH.psfb21, n = e.internal_flags.ATH.s, s = e.internal_flags.ATH.psfb12, r = e.internal_flags, i = e.out_samplerate, o = 0; o < Ae.SBMAX_l; o++) {
              var _ = r.scalefac_band.l[o],
                l = r.scalefac_band.l[o + 1];
              t[o] = D.MAX_VALUE;
              for (var f = _; f < l; f++) {
                var c = f * i / 1152,
                  u = v(e, c);
                t[o] = Math.min(t[o], u);
              }
            }
            for (var o = 0; o < Ae.PSFB21; o++) {
              var _ = r.scalefac_band.psfb21[o],
                l = r.scalefac_band.psfb21[o + 1];
              a[o] = D.MAX_VALUE;
              for (var f = _; f < l; f++) {
                var c = f * i / 1152,
                  u = v(e, c);
                a[o] = Math.min(a[o], u);
              }
            }
            for (var o = 0; o < Ae.SBMAX_s; o++) {
              var _ = r.scalefac_band.s[o],
                l = r.scalefac_band.s[o + 1];
              n[o] = D.MAX_VALUE;
              for (var f = _; f < l; f++) {
                var c = f * i / 384,
                  u = v(e, c);
                n[o] = Math.min(n[o], u);
              }
              n[o] *= r.scalefac_band.s[o + 1] - r.scalefac_band.s[o];
            }
            for (var o = 0; o < Ae.PSFB12; o++) {
              var _ = r.scalefac_band.psfb12[o],
                l = r.scalefac_band.psfb12[o + 1];
              s[o] = D.MAX_VALUE;
              for (var f = _; f < l; f++) {
                var c = f * i / 384,
                  u = v(e, c);
                s[o] = Math.min(s[o], u);
              }
              s[o] *= r.scalefac_band.s[13] - r.scalefac_band.s[12];
            }
            e.noATH && me(), r.ATH.floor = 10 * d(v(e, -1));
          }(e), p[0] = 0, t = 1; t < f; t++) p[t] = Math.pow(t, 4 / 3);
          for (t = 0; t < f - 1; t++) m[t] = t + 1 - Math.pow(.5 * (p[t] + p[t + 1]), .75);
          for (m[t] = .5, t = 0; t < c; t++) h[t] = Math.pow(2, -.1875 * (t - 210));
          for (t = 0; t <= c + u; t++) y[t] = Math.pow(2, .25 * (t - 210 - u));
          var s, r, i, o;
          for (l.huffman_init(a), 32 <= (t = e.exp_nspsytune >> 2 & 63) && (t -= 64), s = Math.pow(10, t / 4 / 10), 32 <= (t = e.exp_nspsytune >> 8 & 63) && (t -= 64), r = Math.pow(10, t / 4 / 10), 32 <= (t = e.exp_nspsytune >> 14 & 63) && (t -= 64), i = Math.pow(10, t / 4 / 10), 32 <= (t = e.exp_nspsytune >> 20 & 63) && (t -= 64), o = i * Math.pow(10, t / 4 / 10), t = 0; t < Ae.SBMAX_l; t++) _ = t <= 6 ? s : t <= 13 ? r : t <= 20 ? i : o, a.nsPsy.longfact[t] = _;
          for (t = 0; t < Ae.SBMAX_s; t++) {
            var _;
            _ = t <= 5 ? s : t <= 10 ? r : t <= 11 ? i : o, a.nsPsy.shortfact[t] = _;
          }
        }
      }, this.on_pe = function (e, t, a, n, s, r) {
        var i,
          o,
          _ = e.internal_flags,
          l = 0,
          f = ve(2),
          c = new R(l),
          u = b.ResvMaxBits(e, n, c, r),
          h = (l = c.bits) + u;
        for (j.MAX_BITS_PER_GRANULE < h && (h = j.MAX_BITS_PER_GRANULE), o = i = 0; o < _.channels_out; ++o) a[o] = Math.min(j.MAX_BITS_PER_CHANNEL, l / _.channels_out), f[o] = 0 | a[o] * t[s][o] / 700 - a[o], f[o] > 3 * n / 4 && (f[o] = 3 * n / 4), f[o] < 0 && (f[o] = 0), f[o] + a[o] > j.MAX_BITS_PER_CHANNEL && (f[o] = Math.max(0, j.MAX_BITS_PER_CHANNEL - a[o])), i += f[o];
        if (u < i) for (o = 0; o < _.channels_out; ++o) f[o] = u * f[o] / i;
        for (o = 0; o < _.channels_out; ++o) a[o] += f[o], u -= f[o];
        for (o = i = 0; o < _.channels_out; ++o) i += a[o];
        return j.MAX_BITS_PER_GRANULE < i && me(), h;
      }, this.athAdjust = function (e, t, a) {
        var n = 90.30873362,
          s = V.FAST_LOG10_X(t, 10),
          r = e * e,
          i = 0;
        return s -= a, 1e-20 < r && (i = 1 + V.FAST_LOG10_X(r, 10 / n)), i < 0 && (i = 0), s *= i, s += a + n - 94.82444863, Math.pow(10, .1 * s);
      }, this.calc_xmin = function (e, t, a, n) {
        var s,
          r = 0,
          i = e.internal_flags,
          o = 0,
          _ = 0,
          l = i.ATH,
          f = a.xr,
          c = e.VBR == Me.vbr_mtrh ? 1 : 0,
          u = i.masking_lower;
        for (e.VBR != Me.vbr_mtrh && e.VBR != Me.vbr_mt || (u = 1), s = 0; s < a.psy_lmax; s++) {
          for (S = e.VBR == Me.vbr_rh || e.VBR == Me.vbr_mtrh ? athAdjust(l.adjust, l.l[s], l.floor) : l.adjust * l.l[s], v = a.width[s], w = S / v, M = B, A = v >> 1, y = 0; k = f[o] * f[o], y += k, M += k < w ? k : w, R = f[++o] * f[o], y += R, M += R < w ? R : w, o++, 0 < --A;);
          if (S < y && _++, s == Ae.SBPSY_l && me(), 0 != c && (S = M), !e.ATHonly) {
            var h = t.en.l[s];
            0 < h && (x = y * t.thm.l[s] * u / h, 0 != c && (x *= i.nsPsy.longfact[s]), S < x && (S = x));
          }
          n[r++] = 0 != c ? S : S * i.nsPsy.longfact[s];
        }
        var b = 575;
        if (a.block_type != Ae.SHORT_TYPE) for (var p = 576; 0 != p-- && N.EQ(f[p], 0);) b = p;
        a.max_nonzero_coeff = b;
        for (var m = a.sfb_smin; s < a.psymax; m++, s += 3) {
          var v, d, g;
          for (g = e.VBR == Me.vbr_rh || e.VBR == Me.vbr_mtrh ? athAdjust(l.adjust, l.s[m], l.floor) : l.adjust * l.s[m], v = a.width[s], d = 0; d < 3; d++) {
            var S,
              w,
              M,
              y = 0,
              A = v >> 1;
            w = g / v, M = B;
            do {
              var k, R;
              k = f[o] * f[o], y += k, M += k < w ? k : w, R = f[++o] * f[o], y += R, M += R < w ? R : w, o++;
            } while (0 < --A);
            if (g < y && _++, m == Ae.SBPSY_s && me(), S = 0 != c ? M : g, !e.ATHonly && !e.ATHshort) {
              var x,
                h = t.en.s[m][d];
              0 < h && (x = y * t.thm.s[m][d] * u / h, 0 != c && (x *= i.nsPsy.shortfact[m]), S < x && (S = x));
            }
            n[r++] = 0 != c ? S : S * i.nsPsy.shortfact[m];
          }
          e.useTemporal && (n[r - 3] > n[r - 3 + 1] && (n[r - 3 + 1] += (n[r - 3] - n[r - 3 + 1]) * i.decay), n[r - 3 + 1] > n[r - 3 + 2] && (n[r - 3 + 2] += (n[r - 3 + 1] - n[r - 3 + 2]) * i.decay));
        }
        return _;
      }, this.calc_noise_core = function (e, t, a, n) {
        var s = 0,
          r = t.s,
          i = e.l3_enc;
        if (r > e.count1) for (; 0 != a--;) _ = e.xr[r], r++, s += _ * _, _ = e.xr[r], r++, s += _ * _;else if (r > e.big_values) {
          var o = de(2);
          for (o[0] = 0, o[1] = n; 0 != a--;) _ = Math.abs(e.xr[r]) - o[i[r]], r++, s += _ * _, _ = Math.abs(e.xr[r]) - o[i[r]], r++, s += _ * _;
        } else for (; 0 != a--;) {
          var _;
          _ = Math.abs(e.xr[r]) - p[i[r]] * n, r++, s += _ * _, _ = Math.abs(e.xr[r]) - p[i[r]] * n, r++, s += _ * _;
        }
        return t.s = r, s;
      }, this.calc_noise = function (e, t, a, n, s) {
        var r,
          i,
          o = 0,
          _ = 0,
          l = 0,
          f = 0,
          c = 0,
          u = -20,
          h = 0,
          b = e.scalefac,
          p = 0;
        for (n.over_SSD = 0, r = 0; r < e.psymax; r++) {
          var m,
            v = e.global_gain - (b[p++] + (0 != e.preflag ? M[r] : 0) << e.scalefac_scale + 1) - 8 * e.subblock_gain[e.window[r]],
            d = 0;
          if (null != s && s.step[r] == v) d = s.noise[r], h += e.width[r], a[o++] = d / t[_++], d = s.noise_log[r];else {
            var g,
              S = y[v + T.Q_MAX2];
            i = e.width[r] >> 1, h + e.width[r] > e.max_nonzero_coeff && (g = e.max_nonzero_coeff - h + 1, i = 0 < g ? g >> 1 : 0);
            var w = new A(h);
            d = this.calc_noise_core(e, w, i, S), h = w.s, null != s && (s.step[r] = v, s.noise[r] = d), d = a[o++] = d / t[_++], d = V.FAST_LOG10(Math.max(d, 1e-20)), null != s && (s.noise_log[r] = d);
          }
          null != s && (s.global_gain = e.global_gain), c += d, 0 < d && (m = Math.max(0 | 10 * d + .5, 1), n.over_SSD += m * m, l++, f += d), u = Math.max(u, d);
        }
        return n.over_count = l, n.tot_noise = c, n.over_noise = f, n.max_noise = u, l;
      };
    }
    function B() {
      this.xr = de(576), this.l3_enc = ve(576), this.scalefac = ve(F.SFBMAX), this.xrpow_max = 0, this.part2_3_length = 0, this.big_values = 0, this.count1 = 0, this.global_gain = 0, this.scalefac_compress = 0, this.block_type = 0, this.mixed_block_flag = 0, this.table_select = ve(3), this.subblock_gain = ve(4), this.region0_count = 0, this.region1_count = 0, this.preflag = 0, this.scalefac_scale = 0, this.count1table_select = 0, this.part2_length = 0, this.sfb_lmax = 0, this.sfb_smin = 0, this.psy_lmax = 0, this.sfbmax = 0, this.psymax = 0, this.sfbdivide = 0, this.width = ve(F.SFBMAX), this.window = ve(F.SFBMAX), this.count1bits = 0, this.sfb_partition_table = null, this.slen = ve(4), this.max_nonzero_coeff = 0;
      var a = this;
      function n(e) {
        return new Int32Array(e);
      }
      this.assign = function (e) {
        var t;
        a.xr = (t = e.xr, new Float32Array(t)), a.l3_enc = n(e.l3_enc), a.scalefac = n(e.scalefac), a.xrpow_max = e.xrpow_max, a.part2_3_length = e.part2_3_length, a.big_values = e.big_values, a.count1 = e.count1, a.global_gain = e.global_gain, a.scalefac_compress = e.scalefac_compress, a.block_type = e.block_type, a.mixed_block_flag = e.mixed_block_flag, a.table_select = n(e.table_select), a.subblock_gain = n(e.subblock_gain), a.region0_count = e.region0_count, a.region1_count = e.region1_count, a.preflag = e.preflag, a.scalefac_scale = e.scalefac_scale, a.count1table_select = e.count1table_select, a.part2_length = e.part2_length, a.sfb_lmax = e.sfb_lmax, a.sfb_smin = e.sfb_smin, a.psy_lmax = e.psy_lmax, a.sfbmax = e.sfbmax, a.psymax = e.psymax, a.sfbdivide = e.sfbdivide, a.width = n(e.width), a.window = n(e.window), a.count1bits = e.count1bits, a.sfb_partition_table = e.sfb_partition_table.slice(0), a.slen = n(e.slen), a.max_nonzero_coeff = e.max_nonzero_coeff;
      };
    }
    k.t1HB = [1, 1, 1, 0], k.t2HB = [1, 2, 1, 3, 1, 1, 3, 2, 0], k.t3HB = [3, 2, 1, 1, 1, 1, 3, 2, 0], k.t5HB = [1, 2, 6, 5, 3, 1, 4, 4, 7, 5, 7, 1, 6, 1, 1, 0], k.t6HB = [7, 3, 5, 1, 6, 2, 3, 2, 5, 4, 4, 1, 3, 3, 2, 0], k.t7HB = [1, 2, 10, 19, 16, 10, 3, 3, 7, 10, 5, 3, 11, 4, 13, 17, 8, 4, 12, 11, 18, 15, 11, 2, 7, 6, 9, 14, 3, 1, 6, 4, 5, 3, 2, 0], k.t8HB = [3, 4, 6, 18, 12, 5, 5, 1, 2, 16, 9, 3, 7, 3, 5, 14, 7, 3, 19, 17, 15, 13, 10, 4, 13, 5, 8, 11, 5, 1, 12, 4, 4, 1, 1, 0], k.t9HB = [7, 5, 9, 14, 15, 7, 6, 4, 5, 5, 6, 7, 7, 6, 8, 8, 8, 5, 15, 6, 9, 10, 5, 1, 11, 7, 9, 6, 4, 1, 14, 4, 6, 2, 6, 0], k.t10HB = [1, 2, 10, 23, 35, 30, 12, 17, 3, 3, 8, 12, 18, 21, 12, 7, 11, 9, 15, 21, 32, 40, 19, 6, 14, 13, 22, 34, 46, 23, 18, 7, 20, 19, 33, 47, 27, 22, 9, 3, 31, 22, 41, 26, 21, 20, 5, 3, 14, 13, 10, 11, 16, 6, 5, 1, 9, 8, 7, 8, 4, 4, 2, 0], k.t11HB = [3, 4, 10, 24, 34, 33, 21, 15, 5, 3, 4, 10, 32, 17, 11, 10, 11, 7, 13, 18, 30, 31, 20, 5, 25, 11, 19, 59, 27, 18, 12, 5, 35, 33, 31, 58, 30, 16, 7, 5, 28, 26, 32, 19, 17, 15, 8, 14, 14, 12, 9, 13, 14, 9, 4, 1, 11, 4, 6, 6, 6, 3, 2, 0], k.t12HB = [9, 6, 16, 33, 41, 39, 38, 26, 7, 5, 6, 9, 23, 16, 26, 11, 17, 7, 11, 14, 21, 30, 10, 7, 17, 10, 15, 12, 18, 28, 14, 5, 32, 13, 22, 19, 18, 16, 9, 5, 40, 17, 31, 29, 17, 13, 4, 2, 27, 12, 11, 15, 10, 7, 4, 1, 27, 12, 8, 12, 6, 3, 1, 0], k.t13HB = [1, 5, 14, 21, 34, 51, 46, 71, 42, 52, 68, 52, 67, 44, 43, 19, 3, 4, 12, 19, 31, 26, 44, 33, 31, 24, 32, 24, 31, 35, 22, 14, 15, 13, 23, 36, 59, 49, 77, 65, 29, 40, 30, 40, 27, 33, 42, 16, 22, 20, 37, 61, 56, 79, 73, 64, 43, 76, 56, 37, 26, 31, 25, 14, 35, 16, 60, 57, 97, 75, 114, 91, 54, 73, 55, 41, 48, 53, 23, 24, 58, 27, 50, 96, 76, 70, 93, 84, 77, 58, 79, 29, 74, 49, 41, 17, 47, 45, 78, 74, 115, 94, 90, 79, 69, 83, 71, 50, 59, 38, 36, 15, 72, 34, 56, 95, 92, 85, 91, 90, 86, 73, 77, 65, 51, 44, 43, 42, 43, 20, 30, 44, 55, 78, 72, 87, 78, 61, 46, 54, 37, 30, 20, 16, 53, 25, 41, 37, 44, 59, 54, 81, 66, 76, 57, 54, 37, 18, 39, 11, 35, 33, 31, 57, 42, 82, 72, 80, 47, 58, 55, 21, 22, 26, 38, 22, 53, 25, 23, 38, 70, 60, 51, 36, 55, 26, 34, 23, 27, 14, 9, 7, 34, 32, 28, 39, 49, 75, 30, 52, 48, 40, 52, 28, 18, 17, 9, 5, 45, 21, 34, 64, 56, 50, 49, 45, 31, 19, 12, 15, 10, 7, 6, 3, 48, 23, 20, 39, 36, 35, 53, 21, 16, 23, 13, 10, 6, 1, 4, 2, 16, 15, 17, 27, 25, 20, 29, 11, 17, 12, 16, 8, 1, 1, 0, 1], k.t15HB = [7, 12, 18, 53, 47, 76, 124, 108, 89, 123, 108, 119, 107, 81, 122, 63, 13, 5, 16, 27, 46, 36, 61, 51, 42, 70, 52, 83, 65, 41, 59, 36, 19, 17, 15, 24, 41, 34, 59, 48, 40, 64, 50, 78, 62, 80, 56, 33, 29, 28, 25, 43, 39, 63, 55, 93, 76, 59, 93, 72, 54, 75, 50, 29, 52, 22, 42, 40, 67, 57, 95, 79, 72, 57, 89, 69, 49, 66, 46, 27, 77, 37, 35, 66, 58, 52, 91, 74, 62, 48, 79, 63, 90, 62, 40, 38, 125, 32, 60, 56, 50, 92, 78, 65, 55, 87, 71, 51, 73, 51, 70, 30, 109, 53, 49, 94, 88, 75, 66, 122, 91, 73, 56, 42, 64, 44, 21, 25, 90, 43, 41, 77, 73, 63, 56, 92, 77, 66, 47, 67, 48, 53, 36, 20, 71, 34, 67, 60, 58, 49, 88, 76, 67, 106, 71, 54, 38, 39, 23, 15, 109, 53, 51, 47, 90, 82, 58, 57, 48, 72, 57, 41, 23, 27, 62, 9, 86, 42, 40, 37, 70, 64, 52, 43, 70, 55, 42, 25, 29, 18, 11, 11, 118, 68, 30, 55, 50, 46, 74, 65, 49, 39, 24, 16, 22, 13, 14, 7, 91, 44, 39, 38, 34, 63, 52, 45, 31, 52, 28, 19, 14, 8, 9, 3, 123, 60, 58, 53, 47, 43, 32, 22, 37, 24, 17, 12, 15, 10, 2, 1, 71, 37, 34, 30, 28, 20, 17, 26, 21, 16, 10, 6, 8, 6, 2, 0], k.t16HB = [1, 5, 14, 44, 74, 63, 110, 93, 172, 149, 138, 242, 225, 195, 376, 17, 3, 4, 12, 20, 35, 62, 53, 47, 83, 75, 68, 119, 201, 107, 207, 9, 15, 13, 23, 38, 67, 58, 103, 90, 161, 72, 127, 117, 110, 209, 206, 16, 45, 21, 39, 69, 64, 114, 99, 87, 158, 140, 252, 212, 199, 387, 365, 26, 75, 36, 68, 65, 115, 101, 179, 164, 155, 264, 246, 226, 395, 382, 362, 9, 66, 30, 59, 56, 102, 185, 173, 265, 142, 253, 232, 400, 388, 378, 445, 16, 111, 54, 52, 100, 184, 178, 160, 133, 257, 244, 228, 217, 385, 366, 715, 10, 98, 48, 91, 88, 165, 157, 148, 261, 248, 407, 397, 372, 380, 889, 884, 8, 85, 84, 81, 159, 156, 143, 260, 249, 427, 401, 392, 383, 727, 713, 708, 7, 154, 76, 73, 141, 131, 256, 245, 426, 406, 394, 384, 735, 359, 710, 352, 11, 139, 129, 67, 125, 247, 233, 229, 219, 393, 743, 737, 720, 885, 882, 439, 4, 243, 120, 118, 115, 227, 223, 396, 746, 742, 736, 721, 712, 706, 223, 436, 6, 202, 224, 222, 218, 216, 389, 386, 381, 364, 888, 443, 707, 440, 437, 1728, 4, 747, 211, 210, 208, 370, 379, 734, 723, 714, 1735, 883, 877, 876, 3459, 865, 2, 377, 369, 102, 187, 726, 722, 358, 711, 709, 866, 1734, 871, 3458, 870, 434, 0, 12, 10, 7, 11, 10, 17, 11, 9, 13, 12, 10, 7, 5, 3, 1, 3], k.t24HB = [15, 13, 46, 80, 146, 262, 248, 434, 426, 669, 653, 649, 621, 517, 1032, 88, 14, 12, 21, 38, 71, 130, 122, 216, 209, 198, 327, 345, 319, 297, 279, 42, 47, 22, 41, 74, 68, 128, 120, 221, 207, 194, 182, 340, 315, 295, 541, 18, 81, 39, 75, 70, 134, 125, 116, 220, 204, 190, 178, 325, 311, 293, 271, 16, 147, 72, 69, 135, 127, 118, 112, 210, 200, 188, 352, 323, 306, 285, 540, 14, 263, 66, 129, 126, 119, 114, 214, 202, 192, 180, 341, 317, 301, 281, 262, 12, 249, 123, 121, 117, 113, 215, 206, 195, 185, 347, 330, 308, 291, 272, 520, 10, 435, 115, 111, 109, 211, 203, 196, 187, 353, 332, 313, 298, 283, 531, 381, 17, 427, 212, 208, 205, 201, 193, 186, 177, 169, 320, 303, 286, 268, 514, 377, 16, 335, 199, 197, 191, 189, 181, 174, 333, 321, 305, 289, 275, 521, 379, 371, 11, 668, 184, 183, 179, 175, 344, 331, 314, 304, 290, 277, 530, 383, 373, 366, 10, 652, 346, 171, 168, 164, 318, 309, 299, 287, 276, 263, 513, 375, 368, 362, 6, 648, 322, 316, 312, 307, 302, 292, 284, 269, 261, 512, 376, 370, 364, 359, 4, 620, 300, 296, 294, 288, 282, 273, 266, 515, 380, 374, 369, 365, 361, 357, 2, 1033, 280, 278, 274, 267, 264, 259, 382, 378, 372, 367, 363, 360, 358, 356, 0, 43, 20, 19, 17, 15, 13, 11, 9, 7, 6, 4, 7, 5, 3, 1, 3], k.t32HB = [1, 10, 8, 20, 12, 20, 16, 32, 14, 12, 24, 0, 28, 16, 24, 16], k.t33HB = [15, 28, 26, 48, 22, 40, 36, 64, 14, 24, 20, 32, 12, 16, 8, 0], k.t1l = [1, 4, 3, 5], k.t2l = [1, 4, 7, 4, 5, 7, 6, 7, 8], k.t3l = [2, 3, 7, 4, 4, 7, 6, 7, 8], k.t5l = [1, 4, 7, 8, 4, 5, 8, 9, 7, 8, 9, 10, 8, 8, 9, 10], k.t6l = [3, 4, 6, 8, 4, 4, 6, 7, 5, 6, 7, 8, 7, 7, 8, 9], k.t7l = [1, 4, 7, 9, 9, 10, 4, 6, 8, 9, 9, 10, 7, 7, 9, 10, 10, 11, 8, 9, 10, 11, 11, 11, 8, 9, 10, 11, 11, 12, 9, 10, 11, 12, 12, 12], k.t8l = [2, 4, 7, 9, 9, 10, 4, 4, 6, 10, 10, 10, 7, 6, 8, 10, 10, 11, 9, 10, 10, 11, 11, 12, 9, 9, 10, 11, 12, 12, 10, 10, 11, 11, 13, 13], k.t9l = [3, 4, 6, 7, 9, 10, 4, 5, 6, 7, 8, 10, 5, 6, 7, 8, 9, 10, 7, 7, 8, 9, 9, 10, 8, 8, 9, 9, 10, 11, 9, 9, 10, 10, 11, 11], k.t10l = [1, 4, 7, 9, 10, 10, 10, 11, 4, 6, 8, 9, 10, 11, 10, 10, 7, 8, 9, 10, 11, 12, 11, 11, 8, 9, 10, 11, 12, 12, 11, 12, 9, 10, 11, 12, 12, 12, 12, 12, 10, 11, 12, 12, 13, 13, 12, 13, 9, 10, 11, 12, 12, 12, 13, 13, 10, 10, 11, 12, 12, 13, 13, 13], k.t11l = [2, 4, 6, 8, 9, 10, 9, 10, 4, 5, 6, 8, 10, 10, 9, 10, 6, 7, 8, 9, 10, 11, 10, 10, 8, 8, 9, 11, 10, 12, 10, 11, 9, 10, 10, 11, 11, 12, 11, 12, 9, 10, 11, 12, 12, 13, 12, 13, 9, 9, 9, 10, 11, 12, 12, 12, 9, 9, 10, 11, 12, 12, 12, 12], k.t12l = [4, 4, 6, 8, 9, 10, 10, 10, 4, 5, 6, 7, 9, 9, 10, 10, 6, 6, 7, 8, 9, 10, 9, 10, 7, 7, 8, 8, 9, 10, 10, 10, 8, 8, 9, 9, 10, 10, 10, 11, 9, 9, 10, 10, 10, 11, 10, 11, 9, 9, 9, 10, 10, 11, 11, 12, 10, 10, 10, 11, 11, 11, 11, 12], k.t13l = [1, 5, 7, 8, 9, 10, 10, 11, 10, 11, 12, 12, 13, 13, 14, 14, 4, 6, 8, 9, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, 14, 7, 8, 9, 10, 11, 11, 12, 12, 11, 12, 12, 13, 13, 14, 15, 15, 8, 9, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 15, 15, 9, 9, 11, 11, 12, 12, 13, 13, 12, 13, 13, 14, 14, 15, 15, 16, 10, 10, 11, 12, 12, 12, 13, 13, 13, 13, 14, 13, 15, 15, 16, 16, 10, 11, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 11, 11, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 18, 18, 10, 10, 11, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 16, 17, 17, 11, 11, 12, 12, 13, 13, 13, 15, 14, 15, 15, 16, 16, 16, 18, 17, 11, 12, 12, 13, 13, 14, 14, 15, 14, 15, 16, 15, 16, 17, 18, 19, 12, 12, 12, 13, 14, 14, 14, 14, 15, 15, 15, 16, 17, 17, 17, 18, 12, 13, 13, 14, 14, 15, 14, 15, 16, 16, 17, 17, 17, 18, 18, 18, 13, 13, 14, 15, 15, 15, 16, 16, 16, 16, 16, 17, 18, 17, 18, 18, 14, 14, 14, 15, 15, 15, 17, 16, 16, 19, 17, 17, 17, 19, 18, 18, 13, 14, 15, 16, 16, 16, 17, 16, 17, 17, 18, 18, 21, 20, 21, 18], k.t15l = [3, 5, 6, 8, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 14, 5, 5, 7, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 6, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 13, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 14, 10, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 14, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 14, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 15, 14, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 12, 12, 11, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 15, 15, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 14, 15, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15], k.t16_5l = [1, 5, 7, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 11, 4, 6, 8, 9, 10, 11, 11, 11, 12, 12, 12, 13, 14, 13, 14, 11, 7, 8, 9, 10, 11, 11, 12, 12, 13, 12, 13, 13, 13, 14, 14, 12, 9, 9, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 13, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 12, 10, 10, 11, 11, 12, 13, 13, 14, 13, 14, 14, 15, 15, 15, 16, 13, 11, 11, 11, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 16, 13, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 17, 17, 13, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 13, 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 15, 16, 15, 14, 12, 13, 12, 13, 14, 14, 14, 14, 15, 16, 16, 16, 17, 17, 16, 13, 13, 13, 13, 13, 14, 14, 15, 16, 16, 16, 16, 16, 16, 15, 16, 14, 13, 14, 14, 14, 14, 15, 15, 15, 15, 17, 16, 16, 16, 16, 18, 14, 15, 14, 14, 14, 15, 15, 16, 16, 16, 18, 17, 17, 17, 19, 17, 14, 14, 15, 13, 14, 16, 16, 15, 16, 16, 17, 18, 17, 19, 17, 16, 14, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 12], k.t16l = [1, 5, 7, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 10, 4, 6, 8, 9, 10, 11, 11, 11, 12, 12, 12, 13, 14, 13, 14, 10, 7, 8, 9, 10, 11, 11, 12, 12, 13, 12, 13, 13, 13, 14, 14, 11, 9, 9, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 12, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 11, 10, 10, 11, 11, 12, 13, 13, 14, 13, 14, 14, 15, 15, 15, 16, 12, 11, 11, 11, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 16, 12, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 17, 17, 12, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 12, 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 15, 16, 15, 13, 12, 13, 12, 13, 14, 14, 14, 14, 15, 16, 16, 16, 17, 17, 16, 12, 13, 13, 13, 13, 14, 14, 15, 16, 16, 16, 16, 16, 16, 15, 16, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 17, 16, 16, 16, 16, 18, 13, 15, 14, 14, 14, 15, 15, 16, 16, 16, 18, 17, 17, 17, 19, 17, 13, 14, 15, 13, 14, 16, 16, 15, 16, 16, 17, 18, 17, 19, 17, 16, 13, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 10], k.t24l = [4, 5, 7, 8, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 13, 10, 5, 6, 7, 8, 9, 10, 10, 11, 11, 11, 12, 12, 12, 12, 12, 10, 7, 7, 8, 9, 9, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 9, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 9, 10, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 9, 11, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 10, 12, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 10, 12, 12, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 10, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 10, 13, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 6], k.t32l = [1, 5, 5, 7, 5, 8, 7, 9, 5, 7, 7, 9, 7, 9, 9, 10], k.t33l = [4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8], k.ht = [new e(0, 0, null, null), new e(2, 0, k.t1HB, k.t1l), new e(3, 0, k.t2HB, k.t2l), new e(3, 0, k.t3HB, k.t3l), new e(0, 0, null, null), new e(4, 0, k.t5HB, k.t5l), new e(4, 0, k.t6HB, k.t6l), new e(6, 0, k.t7HB, k.t7l), new e(6, 0, k.t8HB, k.t8l), new e(6, 0, k.t9HB, k.t9l), new e(8, 0, k.t10HB, k.t10l), new e(8, 0, k.t11HB, k.t11l), new e(8, 0, k.t12HB, k.t12l), new e(16, 0, k.t13HB, k.t13l), new e(0, 0, null, k.t16_5l), new e(16, 0, k.t15HB, k.t15l), new e(1, 1, k.t16HB, k.t16l), new e(2, 3, k.t16HB, k.t16l), new e(3, 7, k.t16HB, k.t16l), new e(4, 15, k.t16HB, k.t16l), new e(6, 63, k.t16HB, k.t16l), new e(8, 255, k.t16HB, k.t16l), new e(10, 1023, k.t16HB, k.t16l), new e(13, 8191, k.t16HB, k.t16l), new e(4, 15, k.t24HB, k.t24l), new e(5, 31, k.t24HB, k.t24l), new e(6, 63, k.t24HB, k.t24l), new e(7, 127, k.t24HB, k.t24l), new e(8, 255, k.t24HB, k.t24l), new e(9, 511, k.t24HB, k.t24l), new e(11, 2047, k.t24HB, k.t24l), new e(13, 8191, k.t24HB, k.t24l), new e(0, 0, k.t32HB, k.t32l), new e(0, 0, k.t33HB, k.t33l)], k.largetbl = [65540, 327685, 458759, 589832, 655369, 655370, 720906, 720907, 786443, 786444, 786444, 851980, 851980, 851980, 917517, 655370, 262149, 393222, 524295, 589832, 655369, 720906, 720906, 720907, 786443, 786443, 786444, 851980, 917516, 851980, 917516, 655370, 458759, 524295, 589832, 655369, 720905, 720906, 786442, 786443, 851979, 786443, 851979, 851980, 851980, 917516, 917517, 720905, 589832, 589832, 655369, 720905, 720906, 786442, 786442, 786443, 851979, 851979, 917515, 917516, 917516, 983052, 983052, 786441, 655369, 655369, 720905, 720906, 786442, 786442, 851978, 851979, 851979, 917515, 917516, 917516, 983052, 983052, 983053, 720905, 655370, 655369, 720906, 720906, 786442, 851978, 851979, 917515, 851979, 917515, 917516, 983052, 983052, 983052, 1048588, 786441, 720906, 720906, 720906, 786442, 851978, 851979, 851979, 851979, 917515, 917516, 917516, 917516, 983052, 983052, 1048589, 786441, 720907, 720906, 786442, 786442, 851979, 851979, 851979, 917515, 917516, 983052, 983052, 983052, 983052, 1114125, 1114125, 786442, 720907, 786443, 786443, 851979, 851979, 851979, 917515, 917515, 983051, 983052, 983052, 983052, 1048588, 1048589, 1048589, 786442, 786443, 786443, 786443, 851979, 851979, 917515, 917515, 983052, 983052, 983052, 983052, 1048588, 983053, 1048589, 983053, 851978, 786444, 851979, 786443, 851979, 917515, 917516, 917516, 917516, 983052, 1048588, 1048588, 1048589, 1114125, 1114125, 1048589, 786442, 851980, 851980, 851979, 851979, 917515, 917516, 983052, 1048588, 1048588, 1048588, 1048588, 1048589, 1048589, 983053, 1048589, 851978, 851980, 917516, 917516, 917516, 917516, 983052, 983052, 983052, 983052, 1114124, 1048589, 1048589, 1048589, 1048589, 1179661, 851978, 983052, 917516, 917516, 917516, 983052, 983052, 1048588, 1048588, 1048589, 1179661, 1114125, 1114125, 1114125, 1245197, 1114125, 851978, 917517, 983052, 851980, 917516, 1048588, 1048588, 983052, 1048589, 1048589, 1114125, 1179661, 1114125, 1245197, 1114125, 1048589, 851978, 655369, 655369, 655369, 720905, 720905, 786441, 786441, 786441, 851977, 851977, 851977, 851978, 851978, 851978, 851978, 655366], k.table23 = [65538, 262147, 458759, 262148, 327684, 458759, 393222, 458759, 524296], k.table56 = [65539, 262148, 458758, 524296, 262148, 327684, 524294, 589831, 458757, 524294, 589831, 655368, 524295, 524295, 589832, 655369], k.bitrate_table = [[0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1], [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1], [0, 8, 16, 24, 32, 40, 48, 56, 64, -1, -1, -1, -1, -1, -1, -1]], k.samplerate_table = [[22050, 24e3, 16e3, -1], [44100, 48e3, 32e3, -1], [11025, 12e3, 8e3, -1]], k.scfsi_band = [0, 6, 11, 16, 21], T.Q_MAX = 257, T.Q_MAX2 = 116, T.LARGE_BITS = 1e5, T.IXMAX_VAL = 8206;
    var F = {};
    function C() {
      var r, g;
      this.rv = null, this.qupvt = null;
      var S,
        s = new function () {
          this.setModules = function (e, t) {};
        }();
      function w(e) {
        this.ordinal = e;
      }
      function o(e) {
        for (var t = 0; t < e.sfbmax; t++) if (e.scalefac[t] + e.subblock_gain[e.window[t]] == 0) return !1;
        return !0;
      }
      function M(e, t, a, n, s) {
        var r;
        switch (e) {
          default:
          case 9:
            0 < t.over_count ? (r = a.over_SSD <= t.over_SSD, a.over_SSD == t.over_SSD && (r = a.bits < t.bits)) : r = a.max_noise < 0 && 10 * a.max_noise + a.bits <= 10 * t.max_noise + t.bits;
            break;
          case 0:
            r = a.over_count < t.over_count || a.over_count == t.over_count && a.over_noise < t.over_noise || a.over_count == t.over_count && N.EQ(a.over_noise, t.over_noise) && a.tot_noise < t.tot_noise;
            break;
          case 8:
            me();
          case 1:
            r = a.max_noise < t.max_noise;
            break;
          case 2:
            r = a.tot_noise < t.tot_noise;
            break;
          case 3:
            r = a.tot_noise < t.tot_noise && a.max_noise < t.max_noise;
            break;
          case 4:
            r = a.max_noise <= 0 && .2 < t.max_noise || a.max_noise <= 0 && t.max_noise < 0 && t.max_noise > a.max_noise - .2 && a.tot_noise < t.tot_noise || a.max_noise <= 0 && 0 < t.max_noise && t.max_noise > a.max_noise - .2 && a.tot_noise < t.tot_noise + t.over_noise || 0 < a.max_noise && -.05 < t.max_noise && t.max_noise > a.max_noise - .1 && a.tot_noise + a.over_noise < t.tot_noise + t.over_noise || 0 < a.max_noise && -.1 < t.max_noise && t.max_noise > a.max_noise - .15 && a.tot_noise + a.over_noise + a.over_noise < t.tot_noise + t.over_noise + t.over_noise;
            break;
          case 5:
            r = a.over_noise < t.over_noise || N.EQ(a.over_noise, t.over_noise) && a.tot_noise < t.tot_noise;
            break;
          case 6:
            r = a.over_noise < t.over_noise || N.EQ(a.over_noise, t.over_noise) && (a.max_noise < t.max_noise || N.EQ(a.max_noise, t.max_noise) && a.tot_noise <= t.tot_noise);
            break;
          case 7:
            r = a.over_count < t.over_count || a.over_noise < t.over_noise;
        }
        return 0 == t.over_count && (r = r && a.bits < t.bits), r;
      }
      function y(e, t, a, n, s) {
        var r = e.internal_flags;
        !function (e, t, a, n, s) {
          var r,
            i = e.internal_flags;
          r = 0 == t.scalefac_scale ? 1.2968395546510096 : 1.6817928305074292;
          for (var o = 0, _ = 0; _ < t.sfbmax; _++) o < a[_] && (o = a[_]);
          var l = i.noise_shaping_amp;
          switch (3 == l && me(), l) {
            case 2:
              break;
            case 1:
              1 < o ? o = Math.pow(o, .5) : o *= .95;
              break;
            case 0:
            default:
              1 < o ? o = 1 : o *= .95;
          }
          for (var f = 0, _ = 0; _ < t.sfbmax; _++) {
            var c,
              u = t.width[_];
            if (f += u, !(a[_] < o)) {
              for (0 != (2 & i.substep_shaping) && me(), t.scalefac[_]++, c = -u; c < 0; c++) n[f + c] *= r, n[f + c] > t.xrpow_max && (t.xrpow_max = n[f + c]);
              if (2 == i.noise_shaping_amp) return;
            }
          }
        }(e, t, a, n);
        var i = o(t);
        return !(i || (i = 2 == r.mode_gr ? S.scale_bitcount(t) : S.scale_bitcount_lsf(r, t)) && (1 < r.noise_shaping && (Se.fill(r.pseudohalf, 0), 0 == t.scalefac_scale ? (function (e, t) {
          for (var a = 0, n = 0; n < e.sfbmax; n++) {
            var s = e.width[n],
              r = e.scalefac[n];
            if (0 != e.preflag && (r += g.pretab[n]), a += s, 0 != (1 & r)) {
              r++;
              for (var i = -s; i < 0; i++) t[a + i] *= 1.2968395546510096, t[a + i] > e.xrpow_max && (e.xrpow_max = t[a + i]);
            }
            e.scalefac[n] = r >> 1;
          }
          e.preflag = 0, e.scalefac_scale = 1;
        }(t, n), i = !1) : t.block_type == Ae.SHORT_TYPE && 0 < r.subblock_gain && (i = function (e, t, a) {
          var n,
            s = t.scalefac;
          for (n = 0; n < t.sfb_lmax; n++) if (16 <= s[n]) return !0;
          for (var r = 0; r < 3; r++) {
            var i = 0,
              o = 0;
            for (n = t.sfb_lmax + r; n < t.sfbdivide; n += 3) i < s[n] && (i = s[n]);
            for (; n < t.sfbmax; n += 3) o < s[n] && (o = s[n]);
            if (!(i < 16 && o < 8)) {
              if (7 <= t.subblock_gain[r]) return !0;
              t.subblock_gain[r]++;
              var _ = e.scalefac_band.l[t.sfb_lmax];
              for (n = t.sfb_lmax + r; n < t.sfbmax; n += 3) {
                var l = t.width[n],
                  f = s[n];
                if (0 <= (f -= 4 >> t.scalefac_scale)) s[n] = f, _ += 3 * l;else {
                  s[n] = 0;
                  var c = 210 + (f << t.scalefac_scale + 1);
                  h = g.IPOW20(c), _ += l * (r + 1);
                  for (var u = -l; u < 0; u++) a[_ + u] *= h, a[_ + u] > t.xrpow_max && (t.xrpow_max = a[_ + u]);
                  _ += l * (3 - r - 1);
                }
              }
              var h = g.IPOW20(202);
              _ += t.width[n] * (r + 1);
              for (var u = -t.width[n]; u < 0; u++) a[_ + u] *= h, a[_ + u] > t.xrpow_max && (t.xrpow_max = a[_ + u]);
            }
          }
          return !1;
        }(r, t, n) || o(t))), i || (i = 2 == r.mode_gr ? S.scale_bitcount(t) : S.scale_bitcount_lsf(r, t)), i));
      }
      this.setModules = function (e, t, a, n) {
        r = t, this.rv = t, g = a, this.qupvt = a, S = n, s.setModules(g, S);
      }, this.init_xrpow = function (e, t, a) {
        var n = 0,
          s = 0 | t.max_nonzero_coeff;
        if (t.xrpow_max = 0, Se.fill(a, s, 576, 0), 1e-20 < (n = function (e, t, a, n) {
          for (var s = n = 0; s <= a; ++s) {
            var r = Math.abs(e.xr[s]);
            n += r, t[s] = Math.sqrt(r * Math.sqrt(r)), t[s] > e.xrpow_max && (e.xrpow_max = t[s]);
          }
          return n;
        }(t, a, s, n))) {
          var r = 0;
          0 != (2 & e.substep_shaping) && (r = 1);
          for (var i = 0; i < t.psymax; i++) e.pseudohalf[i] = r;
          return !0;
        }
        return Se.fill(t.l3_enc, 0, 576, 0), !1;
      }, this.init_outer_loop = function (e, t) {
        t.part2_3_length = 0, t.big_values = 0, t.count1 = 0, t.global_gain = 210, t.scalefac_compress = 0, t.table_select[0] = 0, t.table_select[1] = 0, t.table_select[2] = 0, t.subblock_gain[0] = 0, t.subblock_gain[1] = 0, t.subblock_gain[2] = 0, t.subblock_gain[3] = 0, t.region0_count = 0, t.region1_count = 0, t.preflag = 0, t.scalefac_scale = 0, t.count1table_select = 0, t.part2_length = 0, t.sfb_lmax = Ae.SBPSY_l, t.sfb_smin = Ae.SBPSY_s, t.psy_lmax = e.sfb21_extra ? Ae.SBMAX_l : Ae.SBPSY_l, t.psymax = t.psy_lmax, t.sfbmax = t.sfb_lmax, t.sfbdivide = 11;
        for (var a = 0; a < Ae.SBMAX_l; a++) t.width[a] = e.scalefac_band.l[a + 1] - e.scalefac_band.l[a], t.window[a] = 3;
        if (t.block_type == Ae.SHORT_TYPE) {
          var n = de(576);
          t.sfb_smin = 0, (t.sfb_lmax = 0) != t.mixed_block_flag && me(), t.psymax = t.sfb_lmax + 3 * ((e.sfb21_extra ? Ae.SBMAX_s : Ae.SBPSY_s) - t.sfb_smin), t.sfbmax = t.sfb_lmax + 3 * (Ae.SBPSY_s - t.sfb_smin), t.sfbdivide = t.sfbmax - 18, t.psy_lmax = t.sfb_lmax;
          var s = e.scalefac_band.l[t.sfb_lmax];
          I.arraycopy(t.xr, 0, n, 0, 576);
          for (var a = t.sfb_smin; a < Ae.SBMAX_s; a++) for (var r = e.scalefac_band.s[a], i = e.scalefac_band.s[a + 1], o = 0; o < 3; o++) for (var _ = r; _ < i; _++) t.xr[s++] = n[3 * _ + o];
          for (var l = t.sfb_lmax, a = t.sfb_smin; a < Ae.SBMAX_s; a++) t.width[l] = t.width[l + 1] = t.width[l + 2] = e.scalefac_band.s[a + 1] - e.scalefac_band.s[a], t.window[l] = 0, t.window[l + 1] = 1, t.window[l + 2] = 2, l += 3;
        }
        t.count1bits = 0, t.sfb_partition_table = g.nr_of_sfb_block[0][0], t.slen[0] = 0, t.slen[1] = 0, t.slen[2] = 0, t.slen[3] = 0, t.max_nonzero_coeff = 575, Se.fill(t.scalefac, 0), function (e, t) {
          var a = e.ATH,
            n = t.xr;
          if (t.block_type != Ae.SHORT_TYPE) for (var s = !1, r = Ae.PSFB21 - 1; 0 <= r && !s; r--) {
            var i = e.scalefac_band.psfb21[r],
              o = e.scalefac_band.psfb21[r + 1],
              _ = g.athAdjust(a.adjust, a.psfb21[r], a.floor);
            1e-12 < e.nsPsy.longfact[21] && (_ *= e.nsPsy.longfact[21]);
            for (var l = o - 1; i <= l; l--) {
              if (!(Math.abs(n[l]) < _)) {
                s = !0;
                break;
              }
              n[l] = 0;
            }
          } else for (var f = 0; f < 3; f++) for (var s = !1, r = Ae.PSFB12 - 1; 0 <= r && !s; r--) {
            var i = 3 * e.scalefac_band.s[12] + (e.scalefac_band.s[13] - e.scalefac_band.s[12]) * f + (e.scalefac_band.psfb12[r] - e.scalefac_band.psfb12[0]),
              o = i + (e.scalefac_band.psfb12[r + 1] - e.scalefac_band.psfb12[r]),
              c = g.athAdjust(a.adjust, a.psfb12[r], a.floor);
            1e-12 < e.nsPsy.shortfact[12] && (c *= e.nsPsy.shortfact[12]);
            for (var l = o - 1; i <= l; l--) {
              if (!(Math.abs(n[l]) < c)) {
                s = !0;
                break;
              }
              n[l] = 0;
            }
          }
        }(e, t);
      }, w.BINSEARCH_NONE = new w(0), w.BINSEARCH_UP = new w(1), w.BINSEARCH_DOWN = new w(2), this.outer_loop = function (e, t, a, n, s, r) {
        var i = e.internal_flags,
          o = new B(),
          _ = de(576),
          l = de(F.SFBMAX),
          f = new x(),
          c = new function () {
            this.global_gain = 0, this.sfb_count1 = 0, this.step = ve(39), this.noise = de(39), this.noise_log = de(39);
          }(),
          u = 9999999,
          h = !1;
        if (function (e, t, a, n, s) {
          var r,
            i = e.CurrentStep[n],
            o = !1,
            _ = e.OldValue[n],
            l = w.BINSEARCH_NONE;
          for (t.global_gain = _, a -= t.part2_length;;) {
            var f;
            if (r = S.count_bits(e, s, t, null), 1 == i || r == a) break;
            a < r ? (l == w.BINSEARCH_DOWN && (o = !0), o && (i /= 2), l = w.BINSEARCH_UP, f = i) : (l == w.BINSEARCH_UP && (o = !0), o && (i /= 2), l = w.BINSEARCH_DOWN, f = -i), t.global_gain += f, t.global_gain < 0 && me(), 255 < t.global_gain && me();
          }
          for (; a < r && t.global_gain < 255;) t.global_gain++, r = S.count_bits(e, s, t, null);
          e.CurrentStep[n] = 4 <= _ - t.global_gain ? 4 : 2, e.OldValue[n] = t.global_gain, t.part2_3_length = r;
        }(i, t, r, s, n), 0 == i.noise_shaping) return 100;
        g.calc_noise(t, a, l, f, c), f.bits = t.part2_3_length, o.assign(t);
        var b = 0;
        for (I.arraycopy(n, 0, _, 0, 576); !h;) {
          do {
            var p,
              m = new x(),
              v = 255;
            if (p = 0 != (2 & i.substep_shaping) ? 20 : 3, i.sfb21_extra && me(), !y(e, o, l, n)) break;
            0 != o.scalefac_scale && (v = 254);
            var d = r - o.part2_length;
            if (d <= 0) break;
            for (; (o.part2_3_length = S.count_bits(i, n, o, c)) > d && o.global_gain <= v;) o.global_gain++;
            if (o.global_gain > v) break;
            if (0 == f.over_count) {
              for (; (o.part2_3_length = S.count_bits(i, n, o, c)) > u && o.global_gain <= v;) o.global_gain++;
              if (o.global_gain > v) break;
            }
            if (g.calc_noise(o, a, l, m, c), m.bits = o.part2_3_length, 0 != (M(t.block_type != Ae.SHORT_TYPE ? e.quant_comp : e.quant_comp_short, f, m) ? 1 : 0)) u = t.part2_3_length, f = m, t.assign(o), b = 0, I.arraycopy(n, 0, _, 0, 576);else if (0 == i.full_outer_loop) {
              if (++b > p && 0 == f.over_count) break;
              i.noise_shaping_amp, i.noise_shaping_amp;
            }
          } while (o.global_gain + o.scalefac_scale < 255);
          3 == i.noise_shaping_amp ? me() : h = !0;
        }
        return e.VBR == Me.vbr_rh || e.VBR == Me.vbr_mtrh ? I.arraycopy(_, 0, n, 0, 576) : 0 != (1 & i.substep_shaping) && me(), f.over_count;
      }, this.iteration_finish_one = function (e, t, a) {
        var n = e.l3_side,
          s = n.tt[t][a];
        S.best_scalefac_store(e, t, a, n), 1 == e.use_best_huffman && S.best_huffman_divide(e, s), r.ResvAdjust(e, s);
      };
    }
    function L() {
      this.thm = new i(), this.en = new i();
    }
    function Ae() {
      var k = Ae.MPG_MD_MS_LR,
        R = null,
        x = this.psy = null,
        B = null;
      this.setModules = function (e, t, a, n) {
        R = e, this.psy = t, x = t, B = n;
      };
      var T = new function () {
        var u = [-.1482523854003001, 32.308141959636465, 296.40344946382766, 883.1344870032432, 11113.947376231741, 1057.2713659324597, 305.7402417275812, 30.825928907280012, 3.8533188138216365, 59.42900443849514, 709.5899960123345, 5281.91112291017, -5829.66483675846, -817.6293103748613, -76.91656988279972, -4.594269939176596, .9063471690191471, .1960342806591213, -.15466694054279598, 34.324387823855965, 301.8067566458425, 817.599602898885, 11573.795901679885, 1181.2520595540152, 321.59731579894424, 31.232021761053772, 3.7107095756221318, 53.650946155329365, 684.167428119626, 5224.56624370173, -6366.391851890084, -908.9766368219582, -89.83068876699639, -5.411397422890401, .8206787908286602, .3901806440322567, -.16070888947830023, 36.147034243915876, 304.11815768187864, 732.7429163887613, 11989.60988270091, 1300.012278487897, 335.28490093152146, 31.48816102859945, 3.373875931311736, 47.232241542899175, 652.7371796173471, 5132.414255594984, -6909.087078780055, -1001.9990371107289, -103.62185754286375, -6.104916304710272, .7416505462720353, .5805693545089249, -.16636367662261495, 37.751650073343995, 303.01103387567713, 627.9747488785183, 12358.763425278165, 1412.2779918482834, 346.7496836825721, 31.598286663170416, 3.1598635433980946, 40.57878626349686, 616.1671130880391, 5007.833007176154, -7454.040671756168, -1095.7960341867115, -118.24411666465777, -6.818469345853504, .6681786379192989, .7653668647301797, -.1716176790982088, 39.11551877123304, 298.3413246578966, 503.5259106886539, 12679.589408408976, 1516.5821921214542, 355.9850766329023, 31.395241710249053, 2.9164211881972335, 33.79716964664243, 574.8943997801362, 4853.234992253242, -7997.57021486075, -1189.7624067269965, -133.6444792601766, -7.7202770609839915, .5993769336819237, .9427934736519954, -.17645823955292173, 40.21879108166477, 289.9982036694474, 359.3226160751053, 12950.259102786438, 1612.1013903507662, 362.85067106591504, 31.045922092242872, 2.822222032597987, 26.988862316190684, 529.8996541764288, 4671.371946949588, -8535.899136645805, -1282.5898586244496, -149.58553632943463, -8.643494270763135, .5345111359507916, 1.111140466039205, -.36174739330527045, 41.04429910497807, 277.5463268268618, 195.6386023135583, 13169.43812144731, 1697.6433561479398, 367.40983966190305, 30.557037410382826, 2.531473372857427, 20.070154905927314, 481.50208566532336, 4464.970341588308, -9065.36882077239, -1373.62841526722, -166.1660487028118, -9.58289321133207, .4729647758913199, 1.268786568327291, -.36970682634889585, 41.393213350082036, 261.2935935556502, 12.935476055240873, 13336.131683328815, 1772.508612059496, 369.76534388639965, 29.751323653701338, 2.4023193045459172, 13.304795348228817, 430.5615775526625, 4237.0568611071185, -9581.931701634761, -1461.6913552409758, -183.12733958476446, -10.718010163869403, .41421356237309503, 1.414213562373095, -.37677560326535325, 41.619486213528496, 241.05423794991074, -187.94665032361226, 13450.063605744153, 1836.153896465782, 369.4908799925761, 29.001847876923147, 2.0714759319987186, 6.779591200894186, 377.7767837205709, 3990.386575512536, -10081.709459700915, -1545.947424837898, -200.3762958015653, -11.864482073055006, .3578057213145241, 1.546020906725474, -.3829366947518991, 41.1516456456653, 216.47684307105183, -406.1569483347166, 13511.136535077321, 1887.8076599260432, 367.3025214564151, 28.136213436723654, 1.913880671464418, .3829366947518991, 323.85365704338597, 3728.1472257487526, -10561.233882199509, -1625.2025997821418, -217.62525175416, -13.015432208941645, .3033466836073424, 1.66293922460509, -.5822628872992417, 40.35639251440489, 188.20071124269245, -640.2706748618148, 13519.21490106562, 1927.6022433578062, 362.8197642637487, 26.968821921868447, 1.7463817695935329, -5.62650678237171, 269.3016715297017, 3453.386536448852, -11016.145278780888, -1698.6569643425091, -234.7658734267683, -14.16351421663124, .2504869601913055, 1.76384252869671, -.5887180101749253, 39.23429103868072, 155.76096234403798, -889.2492977967378, 13475.470561874661, 1955.0535223723712, 356.4450994756727, 25.894952980042156, 1.5695032905781554, -11.181939564328772, 214.80884394039484, 3169.1640829158237, -11443.321309975563, -1765.1588461316153, -251.68908574481912, -15.49755935939164, .198912367379658, 1.847759065022573, -.7912582233652842, 37.39369355329111, 119.699486012458, -1151.0956593239027, 13380.446257078214, 1970.3952110853447, 348.01959814116185, 24.731487364283044, 1.3850130831637748, -16.421408865300393, 161.05030052864092, 2878.3322807850063, -11838.991423510031, -1823.985884688674, -268.2854986386903, -16.81724543849939, .1483359875383474, 1.913880671464418, -.7960642926861912, 35.2322109610459, 80.01928065061526, -1424.0212633405113, 13235.794061869668, 1973.804052543835, 337.9908651258184, 23.289159354463873, 1.3934255946442087, -21.099669467133474, 108.48348407242611, 2583.700758091299, -12199.726194855148, -1874.2780658979746, -284.2467154529415, -18.11369784385905, .09849140335716425, 1.961570560806461, -.998795456205172, 32.56307803611191, 36.958364584370486, -1706.075448829146, 13043.287458812016, 1965.3831106103316, 326.43182772364605, 22.175018750622293, 1.198638339011324, -25.371248002043963, 57.53505923036915, 2288.41886619975, -12522.674544337233, -1914.8400385312243, -299.26241273417224, -19.37805630698734, .04912684976946725, 1.990369453344394, .035780907 * V.SQRT2 * .5 / 2384e-9, .017876148 * V.SQRT2 * .5 / 2384e-9, .003134727 * V.SQRT2 * .5 / 2384e-9, .002457142 * V.SQRT2 * .5 / 2384e-9, 971317e-9 * V.SQRT2 * .5 / 2384e-9, 218868e-9 * V.SQRT2 * .5 / 2384e-9, 101566e-9 * V.SQRT2 * .5 / 2384e-9, 13828e-9 * V.SQRT2 * .5 / 2384e-9, 12804.797818791945, 1945.5515939597317, 313.4244966442953, 49591e-9 / 2384e-9, 1995.1556208053692, 21458e-9 / 2384e-9, -69618e-9 / 2384e-9],
          A = [[2.382191739347913e-13, 6.423305872147834e-13, 9.400849094049688e-13, 1.122435026096556e-12, 1.183840321267481e-12, 1.122435026096556e-12, 9.40084909404969e-13, 6.423305872147839e-13, 2.382191739347918e-13, 5.456116108943412e-12, 4.878985199565852e-12, 4.240448995017367e-12, 3.559909094758252e-12, 2.858043359288075e-12, 2.156177623817898e-12, 1.475637723558783e-12, 8.371015190102974e-13, 2.599706096327376e-13, -5.456116108943412e-12, -4.878985199565852e-12, -4.240448995017367e-12, -3.559909094758252e-12, -2.858043359288076e-12, -2.156177623817898e-12, -1.475637723558783e-12, -8.371015190102975e-13, -2.599706096327376e-13, -2.382191739347923e-13, -6.423305872147843e-13, -9.400849094049696e-13, -1.122435026096556e-12, -1.183840321267481e-12, -1.122435026096556e-12, -9.400849094049694e-13, -6.42330587214784e-13, -2.382191739347918e-13], [2.382191739347913e-13, 6.423305872147834e-13, 9.400849094049688e-13, 1.122435026096556e-12, 1.183840321267481e-12, 1.122435026096556e-12, 9.400849094049688e-13, 6.423305872147841e-13, 2.382191739347918e-13, 5.456116108943413e-12, 4.878985199565852e-12, 4.240448995017367e-12, 3.559909094758253e-12, 2.858043359288075e-12, 2.156177623817898e-12, 1.475637723558782e-12, 8.371015190102975e-13, 2.599706096327376e-13, -5.461314069809755e-12, -4.921085770524055e-12, -4.343405037091838e-12, -3.732668368707687e-12, -3.093523840190885e-12, -2.430835727329465e-12, -1.734679010007751e-12, -9.74825365660928e-13, -2.797435120168326e-13, 0, 0, 0, 0, 0, 0, -2.283748241799531e-13, -4.037858874020686e-13, -2.146547464825323e-13], [.1316524975873958, .414213562373095, .7673269879789602, 1.091308501069271, 1.303225372841206, 1.56968557711749, 1.920982126971166, 2.414213562373094, 3.171594802363212, 4.510708503662055, 7.595754112725146, 22.90376554843115, .984807753012208, .6427876096865394, .3420201433256688, .9396926207859084, -.1736481776669303, -.7660444431189779, .8660254037844387, .5, -.5144957554275265, -.4717319685649723, -.3133774542039019, -.1819131996109812, -.09457419252642064, -.04096558288530405, -.01419856857247115, -.003699974673760037, .8574929257125442, .8817419973177052, .9496286491027329, .9833145924917901, .9955178160675857, .9991605581781475, .999899195244447, .9999931550702802], [0, 0, 0, 0, 0, 0, 2.283748241799531e-13, 4.037858874020686e-13, 2.146547464825323e-13, 5.461314069809755e-12, 4.921085770524055e-12, 4.343405037091838e-12, 3.732668368707687e-12, 3.093523840190885e-12, 2.430835727329466e-12, 1.734679010007751e-12, 9.74825365660928e-13, 2.797435120168326e-13, -5.456116108943413e-12, -4.878985199565852e-12, -4.240448995017367e-12, -3.559909094758253e-12, -2.858043359288075e-12, -2.156177623817898e-12, -1.475637723558782e-12, -8.371015190102975e-13, -2.599706096327376e-13, -2.382191739347913e-13, -6.423305872147834e-13, -9.400849094049688e-13, -1.122435026096556e-12, -1.183840321267481e-12, -1.122435026096556e-12, -9.400849094049688e-13, -6.423305872147841e-13, -2.382191739347918e-13]],
          k = A[Ae.SHORT_TYPE],
          w = A[Ae.SHORT_TYPE],
          R = A[Ae.SHORT_TYPE],
          x = A[Ae.SHORT_TYPE],
          B = [0, 1, 16, 17, 8, 9, 24, 25, 4, 5, 20, 21, 12, 13, 28, 29, 2, 3, 18, 19, 10, 11, 26, 27, 6, 7, 22, 23, 14, 15, 30, 31];
        function T(e, t, a) {
          for (var n, s, r, i = 10, o = t + 238 - 14 - 286, _ = -15; _ < 0; _++) {
            var l, f, c;
            l = u[i + -10], f = e[o + -224] * l, c = e[t + 224] * l, l = u[i + -9], f += e[o + -160] * l, c += e[t + 160] * l, l = u[i + -8], f += e[o + -96] * l, c += e[t + 96] * l, l = u[i + -7], f += e[o + -32] * l, c += e[t + 32] * l, l = u[i + -6], f += e[o + 32] * l, c += e[t + -32] * l, l = u[i + -5], f += e[o + 96] * l, c += e[t + -96] * l, l = u[i + -4], f += e[o + 160] * l, c += e[t + -160] * l, l = u[i + -3], f += e[o + 224] * l, c += e[t + -224] * l, l = u[i + -2], f += e[t + -256] * l, c -= e[o + 256] * l, l = u[i + -1], f += e[t + -192] * l, c -= e[o + 192] * l, l = u[i + 0], f += e[t + -128] * l, c -= e[o + 128] * l, l = u[i + 1], f += e[t + -64] * l, c -= e[o + 64] * l, l = u[i + 2], f += e[t + 0] * l, c -= e[o + 0] * l, l = u[i + 3], f += e[t + 64] * l, c -= e[o + -64] * l, l = u[i + 4], f += e[t + 128] * l, c -= e[o + -128] * l, l = u[i + 5], f += e[t + 192] * l, c -= e[o + -192] * l, f *= u[i + 6], l = c - f, a[30 + 2 * _] = c + f, a[31 + 2 * _] = u[i + 7] * l, i += 18, t--, o++;
          }
          c = e[t + -16] * u[i + -10], f = e[t + -32] * u[i + -2], c += (e[t + -48] - e[t + 16]) * u[i + -9], f += e[t + -96] * u[i + -1], c += (e[t + -80] + e[t + 48]) * u[i + -8], f += e[t + -160] * u[i + 0], c += (e[t + -112] - e[t + 80]) * u[i + -7], f += e[t + -224] * u[i + 1], c += (e[t + -144] + e[t + 112]) * u[i + -6], f -= e[t + 32] * u[i + 2], c += (e[t + -176] - e[t + 144]) * u[i + -5], f -= e[t + 96] * u[i + 3], c += (e[t + -208] + e[t + 176]) * u[i + -4], f -= e[t + 160] * u[i + 4], c += (e[t + -240] - e[t + 208]) * u[i + -3], f -= e[t + 224], n = f - c, s = f + c, c = a[14], f = a[15] - c, a[31] = s + c, a[30] = n + f, a[15] = n - f, a[14] = s - c, r = a[28] - a[0], a[0] += a[28], a[28] = r * u[i + -36 + 7], r = a[29] - a[1], a[1] += a[29], a[29] = r * u[i + -36 + 7], r = a[26] - a[2], a[2] += a[26], a[26] = r * u[i + -72 + 7], r = a[27] - a[3], a[3] += a[27], a[27] = r * u[i + -72 + 7], r = a[24] - a[4], a[4] += a[24], a[24] = r * u[i + -108 + 7], r = a[25] - a[5], a[5] += a[25], a[25] = r * u[i + -108 + 7], r = a[22] - a[6], a[6] += a[22], a[22] = r * V.SQRT2, r = a[23] - a[7], a[7] += a[23], a[23] = r * V.SQRT2 - a[7], a[7] -= a[6], a[22] -= a[7], a[23] -= a[22], r = a[6], a[6] = a[31] - r, a[31] = a[31] + r, r = a[7], a[7] = a[30] - r, a[30] = a[30] + r, r = a[22], a[22] = a[15] - r, a[15] = a[15] + r, r = a[23], a[23] = a[14] - r, a[14] = a[14] + r, r = a[20] - a[8], a[8] += a[20], a[20] = r * u[i + -180 + 7], r = a[21] - a[9], a[9] += a[21], a[21] = r * u[i + -180 + 7], r = a[18] - a[10], a[10] += a[18], a[18] = r * u[i + -216 + 7], r = a[19] - a[11], a[11] += a[19], a[19] = r * u[i + -216 + 7], r = a[16] - a[12], a[12] += a[16], a[16] = r * u[i + -252 + 7], r = a[17] - a[13], a[13] += a[17], a[17] = r * u[i + -252 + 7], r = -a[20] + a[24], a[20] += a[24], a[24] = r * u[i + -216 + 7], r = -a[21] + a[25], a[21] += a[25], a[25] = r * u[i + -216 + 7], r = a[4] - a[8], a[4] += a[8], a[8] = r * u[i + -216 + 7], r = a[5] - a[9], a[5] += a[9], a[9] = r * u[i + -216 + 7], r = a[0] - a[12], a[0] += a[12], a[12] = r * u[i + -72 + 7], r = a[1] - a[13], a[1] += a[13], a[13] = r * u[i + -72 + 7], r = a[16] - a[28], a[16] += a[28], a[28] = r * u[i + -72 + 7], r = -a[17] + a[29], a[17] += a[29], a[29] = r * u[i + -72 + 7], r = V.SQRT2 * (a[2] - a[10]), a[2] += a[10], a[10] = r, r = V.SQRT2 * (a[3] - a[11]), a[3] += a[11], a[11] = r, r = V.SQRT2 * (-a[18] + a[26]), a[18] += a[26], a[26] = r - a[18], r = V.SQRT2 * (-a[19] + a[27]), a[19] += a[27], a[27] = r - a[19], r = a[2], a[19] -= a[3], a[3] -= r, a[2] = a[31] - r, a[31] += r, r = a[3], a[11] -= a[19], a[18] -= r, a[3] = a[30] - r, a[30] += r, r = a[18], a[27] -= a[11], a[19] -= r, a[18] = a[15] - r, a[15] += r, r = a[19], a[10] -= r, a[19] = a[14] - r, a[14] += r, r = a[10], a[11] -= r, a[10] = a[23] - r, a[23] += r, r = a[11], a[26] -= r, a[11] = a[22] - r, a[22] += r, r = a[26], a[27] -= r, a[26] = a[7] - r, a[7] += r, r = a[27], a[27] = a[6] - r, a[6] += r, r = V.SQRT2 * (a[0] - a[4]), a[0] += a[4], a[4] = r, r = V.SQRT2 * (a[1] - a[5]), a[1] += a[5], a[5] = r, r = V.SQRT2 * (a[16] - a[20]), a[16] += a[20], a[20] = r, r = V.SQRT2 * (a[17] - a[21]), a[17] += a[21], a[21] = r, r = -V.SQRT2 * (a[8] - a[12]), a[8] += a[12], a[12] = r - a[8], r = -V.SQRT2 * (a[9] - a[13]), a[9] += a[13], a[13] = r - a[9], r = -V.SQRT2 * (a[25] - a[29]), a[25] += a[29], a[29] = r - a[25], r = -V.SQRT2 * (a[24] + a[28]), a[24] -= a[28], a[28] = r - a[24], r = a[24] - a[16], a[24] = r, r = a[20] - r, a[20] = r, r = a[28] - r, a[28] = r, r = a[25] - a[17], a[25] = r, r = a[21] - r, a[21] = r, r = a[29] - r, a[29] = r, r = a[17] - a[1], a[17] = r, r = a[9] - r, a[9] = r, r = a[25] - r, a[25] = r, r = a[5] - r, a[5] = r, r = a[21] - r, a[21] = r, r = a[13] - r, a[13] = r, r = a[29] - r, a[29] = r, r = a[1] - a[0], a[1] = r, r = a[16] - r, a[16] = r, r = a[17] - r, a[17] = r, r = a[8] - r, a[8] = r, r = a[9] - r, a[9] = r, r = a[24] - r, a[24] = r, r = a[25] - r, a[25] = r, r = a[4] - r, a[4] = r, r = a[5] - r, a[5] = r, r = a[20] - r, a[20] = r, r = a[21] - r, a[21] = r, r = a[12] - r, a[12] = r, r = a[13] - r, a[13] = r, r = a[28] - r, a[28] = r, r = a[29] - r, a[29] = r, r = a[0], a[0] += a[31], a[31] -= r, r = a[1], a[1] += a[30], a[30] -= r, r = a[16], a[16] += a[15], a[15] -= r, r = a[17], a[17] += a[14], a[14] -= r, r = a[8], a[8] += a[23], a[23] -= r, r = a[9], a[9] += a[22], a[22] -= r, r = a[24], a[24] += a[7], a[7] -= r, r = a[25], a[25] += a[6], a[6] -= r, r = a[4], a[4] += a[27], a[27] -= r, r = a[5], a[5] += a[26], a[26] -= r, r = a[20], a[20] += a[11], a[11] -= r, r = a[21], a[21] += a[10], a[10] -= r, r = a[12], a[12] += a[19], a[19] -= r, r = a[13], a[13] += a[18], a[18] -= r, r = a[28], a[28] += a[3], a[3] -= r, r = a[29], a[29] += a[2], a[2] -= r;
        }
        function E(e, t) {
          for (var a = 0; a < 3; a++) {
            var n, s, r, i, o, _;
            i = e[t + 6] * A[Ae.SHORT_TYPE][0] - e[t + 15], n = e[t + 0] * A[Ae.SHORT_TYPE][2] - e[t + 9], s = i + n, r = i - n, i = e[t + 15] * A[Ae.SHORT_TYPE][0] + e[t + 6], n = e[t + 9] * A[Ae.SHORT_TYPE][2] + e[t + 0], o = i + n, _ = -i + n, n = 2.069978111953089e-11 * (e[t + 3] * A[Ae.SHORT_TYPE][1] - e[t + 12]), i = 2.069978111953089e-11 * (e[t + 12] * A[Ae.SHORT_TYPE][1] + e[t + 3]), e[t + 0] = 1.90752519173728e-11 * s + n, e[t + 15] = 1.90752519173728e-11 * -o + i, r = .8660254037844387 * r * 1.907525191737281e-11, o = .5 * o * 1.907525191737281e-11 + i, e[t + 3] = r - o, e[t + 6] = r + o, s = .5 * s * 1.907525191737281e-11 - n, _ = .8660254037844387 * _ * 1.907525191737281e-11, e[t + 9] = s + _, e[t + 12] = s - _, t++;
          }
        }
        function C(e, t, a) {
          var n, s, r, i, o, _, l, f, c, u, h, b, p, m, v, d, g, S;
          r = a[17] - a[9], o = a[15] - a[11], _ = a[14] - a[12], l = a[0] + a[8], f = a[1] + a[7], c = a[2] + a[6], u = a[3] + a[5], e[t + 17] = l + c - u - (f - a[4]), s = (l + c - u) * w[19] + (f - a[4]), n = (r - o - _) * w[18], e[t + 5] = n + s, e[t + 6] = n - s, i = (a[16] - a[10]) * w[18], f = f * w[19] + a[4], n = r * w[12] + i + o * w[13] + _ * w[14], s = -l * w[16] + f - c * w[17] + u * w[15], e[t + 1] = n + s, e[t + 2] = n - s, n = r * w[13] - i - o * w[14] + _ * w[12], s = -l * w[17] + f - c * w[15] + u * w[16], e[t + 9] = n + s, e[t + 10] = n - s, n = r * w[14] - i + o * w[12] - _ * w[13], s = l * w[15] - f + c * w[16] - u * w[17], e[t + 13] = n + s, e[t + 14] = n - s, h = a[8] - a[0], p = a[6] - a[2], m = a[5] - a[3], v = a[17] + a[9], d = a[16] + a[10], g = a[15] + a[11], S = a[14] + a[12], e[t + 0] = v + g + S + (d + a[13]), n = (v + g + S) * w[19] - (d + a[13]), s = (h - p + m) * w[18], e[t + 11] = n + s, e[t + 12] = n - s, b = (a[7] - a[1]) * w[18], d = a[13] - d * w[19], n = v * w[15] - d + g * w[16] + S * w[17], s = h * w[14] + b + p * w[12] + m * w[13], e[t + 3] = n + s, e[t + 4] = n - s, n = -v * w[17] + d - g * w[15] - S * w[16], s = h * w[13] + b - p * w[14] - m * w[12], e[t + 7] = n + s, e[t + 8] = n - s, n = -v * w[16] + d - g * w[17] - S * w[15], s = h * w[12] - b + p * w[13] - m * w[14], e[t + 15] = n + s, e[t + 16] = n - s;
        }
        this.mdct_sub48 = function (e, t, a) {
          for (var n = t, s = 286, r = 0; r < e.channels_out; r++) {
            for (var i = 0; i < e.mode_gr; i++) {
              for (var o, _ = e.l3_side.tt[i][r], l = _.xr, f = 0, c = e.sb_sample[r][1 - i], u = 0, h = 0; h < 9; h++) for (T(n, s, c[u]), T(n, s + 32, c[u + 1]), u += 2, s += 64, o = 1; o < 32; o += 2) c[u - 1][o] *= -1;
              for (o = 0; o < 32; o++, f += 18) {
                var b = _.block_type,
                  p = e.sb_sample[r][i],
                  m = e.sb_sample[r][1 - i];
                if (0 != _.mixed_block_flag && o < 2 && (b = 0), e.amp_filter[o] < 1e-12) Se.fill(l, f + 0, f + 18, 0);else if (e.amp_filter[o] < 1 && me(), b == Ae.SHORT_TYPE) {
                  for (var h = -3; h < 0; h++) {
                    var v = A[Ae.SHORT_TYPE][h + 3];
                    l[f + 3 * h + 9] = p[9 + h][B[o]] * v - p[8 - h][B[o]], l[f + 3 * h + 18] = p[14 - h][B[o]] * v + p[15 + h][B[o]], l[f + 3 * h + 10] = p[15 + h][B[o]] * v - p[14 - h][B[o]], l[f + 3 * h + 19] = m[2 - h][B[o]] * v + m[3 + h][B[o]], l[f + 3 * h + 11] = m[3 + h][B[o]] * v - m[2 - h][B[o]], l[f + 3 * h + 20] = m[8 - h][B[o]] * v + m[9 + h][B[o]];
                  }
                  E(l, f);
                } else {
                  for (var d = de(18), h = -9; h < 0; h++) {
                    var g, S;
                    g = A[b][h + 27] * m[h + 9][B[o]] + A[b][h + 36] * m[8 - h][B[o]], S = A[b][h + 9] * p[h + 9][B[o]] - A[b][h + 18] * p[8 - h][B[o]], d[h + 9] = g - S * k[3 + h + 9], d[h + 18] = g * k[3 + h + 9] + S;
                  }
                  C(l, f, d);
                }
                if (b != Ae.SHORT_TYPE && 0 != o) for (var h = 7; 0 <= h; --h) {
                  var w, M;
                  w = l[f + h] * R[20 + h] + l[f + -1 - h] * x[28 + h], M = l[f + h] * x[28 + h] - l[f + -1 - h] * R[20 + h], l[f + -1 - h] = w, l[f + h] = M;
                }
              }
            }
            if (n = a, s = 286, 1 == e.mode_gr) for (var y = 0; y < 18; y++) I.arraycopy(e.sb_sample[r][1][y], 0, e.sb_sample[r][0][y], 0, 32);
          }
        };
      }();
      this.lame_encode_mp3_frame = function (e, t, a, n, s, r) {
        var i,
          o = E([2, 2]);
        o[0][0] = new L(), o[0][1] = new L(), o[1][0] = new L(), o[1][1] = new L();
        var _,
          l = E([2, 2]);
        l[0][0] = new L(), l[0][1] = new L(), l[1][0] = new L(), l[1][1] = new L();
        var f,
          c,
          u,
          h = [null, null],
          b = e.internal_flags,
          p = ge([2, 4]),
          m = [[0, 0], [0, 0]],
          v = [[0, 0], [0, 0]];
        if (h[0] = t, h[1] = a, 0 == b.lame_encode_frame_init && function (e, t) {
          var a,
            n,
            s = e.internal_flags;
          if (0 == s.lame_encode_frame_init) {
            var r,
              i,
              o = de(2014),
              _ = de(2014);
            for (s.lame_encode_frame_init = 1, i = r = 0; r < 286 + 576 * (1 + s.mode_gr); ++r) r < 576 * s.mode_gr ? (o[r] = 0, 2 == s.channels_out && (_[r] = 0)) : (o[r] = t[0][i], 2 == s.channels_out && (_[r] = t[1][i]), ++i);
            for (n = 0; n < s.mode_gr; n++) for (a = 0; a < s.channels_out; a++) s.l3_side.tt[n][a].block_type = Ae.SHORT_TYPE;
            T.mdct_sub48(s, o, _);
          }
        }(e, h), b.padding = 0, (b.slot_lag -= b.frac_SpF) < 0 && (b.slot_lag += e.out_samplerate, b.padding = 1), 0 != b.psymodel) {
          var d,
            g = [null, null],
            S = 0,
            w = ve(2);
          for (u = 0; u < b.mode_gr; u++) {
            for (c = 0; c < b.channels_out; c++) g[c] = h[c], S = 576 + 576 * u - Ae.FFTOFFSET;
            if (e.VBR == Me.vbr_mtrh || e.VBR == Me.vbr_mt ? me() : d = x.L3psycho_anal_ns(e, g, S, u, o, l, m[u], v[u], p[u], w), 0 != d) return -4;
            for (e.mode == ye.JOINT_STEREO && me(), c = 0; c < b.channels_out; c++) {
              var M = b.l3_side.tt[u][c];
              M.block_type = w[c], M.mixed_block_flag = 0;
            }
          }
        } else me();
        if (function (e) {
          var t, a;
          if (0 == e.ATH.useAdjust) return e.ATH.adjust = 1;
          if (a = e.loudness_sq[0][0], t = e.loudness_sq[1][0], 2 == e.channels_out ? me() : (a += a, t += t), 2 == e.mode_gr && (a = Math.max(a, t)), a *= .5, .03125 < (a *= e.ATH.aaSensitivityP)) 1 <= e.ATH.adjust ? e.ATH.adjust = 1 : e.ATH.adjust < e.ATH.adjustLimit && (e.ATH.adjust = e.ATH.adjustLimit), e.ATH.adjustLimit = 1;else {
            var n = 31.98 * a + 625e-6;
            e.ATH.adjust >= n ? (e.ATH.adjust *= .075 * n + .925, e.ATH.adjust < n && (e.ATH.adjust = n)) : e.ATH.adjustLimit >= n ? e.ATH.adjust = n : e.ATH.adjust < e.ATH.adjustLimit && (e.ATH.adjust = e.ATH.adjustLimit), e.ATH.adjustLimit = n;
          }
        }(b), T.mdct_sub48(b, h[0], h[1]), b.mode_ext = Ae.MPG_MD_LR_LR, e.force_ms ? b.mode_ext = Ae.MPG_MD_MS_LR : e.mode == ye.JOINT_STEREO && me(), b.mode_ext == k ? (_ = l, f = v) : (_ = o, f = m), e.analysis && null != b.pinfo && me(), e.VBR == Me.vbr_off || e.VBR == Me.vbr_abr) {
          var y, A;
          for (y = 0; y < 18; y++) b.nsPsy.pefirbuf[y] = b.nsPsy.pefirbuf[y + 1];
          for (u = A = 0; u < b.mode_gr; u++) for (c = 0; c < b.channels_out; c++) A += f[u][c];
          for (b.nsPsy.pefirbuf[18] = A, A = b.nsPsy.pefirbuf[9], y = 0; y < 9; y++) A += (b.nsPsy.pefirbuf[y] + b.nsPsy.pefirbuf[18 - y]) * Ae.fircoef[y];
          for (A = 3350 * b.mode_gr * b.channels_out / A, u = 0; u < b.mode_gr; u++) for (c = 0; c < b.channels_out; c++) f[u][c] *= A;
        }
        return b.iteration_loop.iteration_loop(e, f, [.5, .5], _), R.format_bitstream(e), i = R.copy_buffer(b, n, s, r, 1), e.bWriteVbrTag && B.addVbrFrame(e), e.analysis && null != b.pinfo && me(), function (e) {
          var t, a;
          for (e.bitrate_stereoMode_Hist[e.bitrate_index][4]++, e.bitrate_stereoMode_Hist[15][4]++, 2 == e.channels_out && me(), t = 0; t < e.mode_gr; ++t) for (a = 0; a < e.channels_out; ++a) {
            var n = 0 | e.l3_side.tt[t][a].block_type;
            0 != e.l3_side.tt[t][a].mixed_block_flag && (n = 4), e.bitrate_blockType_Hist[e.bitrate_index][n]++, e.bitrate_blockType_Hist[e.bitrate_index][5]++, e.bitrate_blockType_Hist[15][n]++, e.bitrate_blockType_Hist[15][5]++;
          }
        }(b), i;
      };
    }
    function i() {
      this.l = de(Ae.SBMAX_l), this.s = ge([Ae.SBMAX_s, 3]);
      var n = this;
      this.assign = function (e) {
        I.arraycopy(e.l, 0, n.l, 0, Ae.SBMAX_l);
        for (var t = 0; t < Ae.SBMAX_s; t++) for (var a = 0; a < 3; a++) n.s[t][a] = e.s[t][a];
      };
    }
    function j() {
      var e = 40;
      function t() {
        this.write_timing = 0, this.ptr = 0, this.buf = w(e);
      }
      this.Class_ID = 0, this.lame_encode_frame_init = 0, this.iteration_init_init = 0, this.fill_buffer_resample_init = 0, this.mfbuf = ge([2, j.MFSIZE]), this.mode_gr = 0, this.channels_in = 0, this.channels_out = 0, this.resample_ratio = 0, this.mf_samples_to_encode = 0, this.mf_size = 0, this.VBR_min_bitrate = 0, this.VBR_max_bitrate = 0, this.bitrate_index = 0, this.samplerate_index = 0, this.mode_ext = 0, this.lowpass1 = 0, this.lowpass2 = 0, this.highpass1 = 0, this.highpass2 = 0, this.noise_shaping = 0, this.noise_shaping_amp = 0, this.substep_shaping = 0, this.psymodel = 0, this.noise_shaping_stop = 0, this.subblock_gain = 0, this.use_best_huffman = 0, this.full_outer_loop = 0, this.l3_side = new function () {
        this.tt = [[null, null], [null, null]], this.main_data_begin = 0, this.private_bits = 0, this.resvDrain_pre = 0, this.resvDrain_post = 0, this.scfsi = [ve(4), ve(4)];
        for (var e = 0; e < 2; e++) for (var t = 0; t < 2; t++) this.tt[e][t] = new B();
      }(), this.ms_ratio = de(2), this.padding = 0, this.frac_SpF = 0, this.slot_lag = 0, this.tag_spec = null, this.nMusicCRC = 0, this.OldValue = ve(2), this.CurrentStep = ve(2), this.masking_lower = 0, this.bv_scf = ve(576), this.pseudohalf = ve(F.SFBMAX), this.sfb21_extra = !1, this.inbuf_old = new Array(2), this.blackfilt = new Array(2 * j.BPC + 1), this.itime = n(2), this.sideinfo_len = 0, this.sb_sample = ge([2, 2, 18, Ae.SBLIMIT]), this.amp_filter = de(32), this.header = new Array(j.MAX_HEADER_BUF), this.h_ptr = 0, this.w_ptr = 0, this.ancillary_flag = 0, this.ResvSize = 0, this.ResvMax = 0, this.scalefac_band = new r(), this.minval_l = de(Ae.CBANDS), this.minval_s = de(Ae.CBANDS), this.nb_1 = ge([4, Ae.CBANDS]), this.nb_2 = ge([4, Ae.CBANDS]), this.nb_s1 = ge([4, Ae.CBANDS]), this.nb_s2 = ge([4, Ae.CBANDS]), this.s3_ss = null, this.s3_ll = null, this.decay = 0, this.thm = new Array(4), this.en = new Array(4), this.tot_ener = de(4), this.loudness_sq = ge([2, 2]), this.loudness_sq_save = de(2), this.mld_l = de(Ae.SBMAX_l), this.mld_s = de(Ae.SBMAX_s), this.bm_l = ve(Ae.SBMAX_l), this.bo_l = ve(Ae.SBMAX_l), this.bm_s = ve(Ae.SBMAX_s), this.bo_s = ve(Ae.SBMAX_s), this.npart_l = 0, this.npart_s = 0, this.s3ind = S([Ae.CBANDS, 2]), this.s3ind_s = S([Ae.CBANDS, 2]), this.numlines_s = ve(Ae.CBANDS), this.numlines_l = ve(Ae.CBANDS), this.rnumlines_l = de(Ae.CBANDS), this.mld_cb_l = de(Ae.CBANDS), this.mld_cb_s = de(Ae.CBANDS), this.numlines_s_num1 = 0, this.numlines_l_num1 = 0, this.pe = de(4), this.ms_ratio_s_old = 0, this.ms_ratio_l_old = 0, this.ms_ener_ratio_old = 0, this.blocktype_old = ve(2), this.nsPsy = new function () {
        this.last_en_subshort = ge([4, 9]), this.lastAttacks = ve(4), this.pefirbuf = de(19), this.longfact = de(Ae.SBMAX_l), this.shortfact = de(Ae.SBMAX_s), this.attackthre = 0, this.attackthre_s = 0;
      }(), this.VBR_seek_table = new function () {
        this.sum = 0, this.seen = 0, this.want = 0, this.pos = 0, this.size = 0, this.bag = null, this.nVbrNumFrames = 0, this.nBytesWritten = 0, this.TotalFrameSize = 0;
      }(), this.ATH = null, this.PSY = null, this.nogap_total = 0, this.nogap_current = 0, this.decode_on_the_fly = !0, this.findReplayGain = !0, this.findPeakSample = !0, this.PeakSample = 0, this.RadioGain = 0, this.AudiophileGain = 0, this.rgdata = null, this.noclipGainChange = 0, this.noclipScale = 0, this.bitrate_stereoMode_Hist = S([16, 5]), this.bitrate_blockType_Hist = S([16, 6]), this.pinfo = null, this.hip = null, this.in_buffer_nsamples = 0, this.in_buffer_0 = null, this.in_buffer_1 = null, this.iteration_loop = null;
      for (var a = 0; a < this.en.length; a++) this.en[a] = new i();
      for (var a = 0; a < this.thm.length; a++) this.thm[a] = new i();
      for (var a = 0; a < this.header.length; a++) this.header[a] = new t();
    }
    function X() {
      var k = new function () {
          var h = de(Ae.BLKSIZE),
            p = de(Ae.BLKSIZE_s / 2),
            x = [.9238795325112867, .3826834323650898, .9951847266721969, .0980171403295606, .9996988186962042, .02454122852291229, .9999811752826011, .006135884649154475];
          function m(e, t, a) {
            var n,
              s,
              r,
              i = 0,
              o = t + (a <<= 1);
            n = 4;
            do {
              var _, l, f, c, u, h, b;
              for (b = n >> 1, h = (u = (c = n) << 1) + c, n = u << 1, r = (s = t) + b; w = e[s + 0] - e[s + c], S = e[s + 0] + e[s + c], k = e[s + u] - e[s + h], y = e[s + u] + e[s + h], e[s + u] = S - y, e[s + 0] = S + y, e[s + h] = w - k, e[s + c] = w + k, w = e[r + 0] - e[r + c], S = e[r + 0] + e[r + c], k = V.SQRT2 * e[r + h], y = V.SQRT2 * e[r + u], e[r + u] = S - y, e[r + 0] = S + y, e[r + h] = w - k, e[r + c] = w + k, r += n, (s += n) < o;);
              for (l = x[i + 0], _ = x[i + 1], f = 1; f < b; f++) {
                var p, m;
                p = 1 - 2 * _ * _, m = 2 * _ * l, s = t + f, r = t + c - f;
                do {
                  var v, d, g, S, w, M, y, A, k, R;
                  d = m * e[s + c] - p * e[r + c], v = p * e[s + c] + m * e[r + c], w = e[s + 0] - v, S = e[s + 0] + v, M = e[r + 0] - d, g = e[r + 0] + d, d = m * e[s + h] - p * e[r + h], v = p * e[s + h] + m * e[r + h], k = e[s + u] - v, y = e[s + u] + v, R = e[r + u] - d, A = e[r + u] + d, d = _ * y - l * R, v = l * y + _ * R, e[s + u] = S - v, e[s + 0] = S + v, e[r + h] = M - d, e[r + c] = M + d, d = l * A - _ * k, v = _ * A + l * k, e[r + u] = g - v, e[r + 0] = g + v, e[s + h] = w - d, e[s + c] = w + d, r += n, s += n;
                } while (s < o);
                l = (p = l) * x[i + 0] - _ * x[i + 1], _ = p * x[i + 1] + _ * x[i + 0];
              }
              i += 2;
            } while (n < a);
          }
          var v = [0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254];
          this.fft_short = function (e, t, a, n, s) {
            for (var r = 0; r < 3; r++) {
              var i = Ae.BLKSIZE_s / 2,
                o = 65535 & 192 * (r + 1),
                _ = Ae.BLKSIZE_s / 8 - 1;
              do {
                var l,
                  f,
                  c,
                  u,
                  h,
                  b = 255 & v[_ << 2];
                l = p[b] * n[a][s + b + o], h = p[127 - b] * n[a][s + b + o + 128], f = l - h, l += h, c = p[b + 64] * n[a][s + b + o + 64], h = p[63 - b] * n[a][s + b + o + 192], u = c - h, c += h, i -= 4, t[r][i + 0] = l + c, t[r][i + 2] = l - c, t[r][i + 1] = f + u, t[r][i + 3] = f - u, l = p[b + 1] * n[a][s + b + o + 1], h = p[126 - b] * n[a][s + b + o + 129], f = l - h, l += h, c = p[b + 65] * n[a][s + b + o + 65], h = p[62 - b] * n[a][s + b + o + 193], u = c - h, c += h, t[r][i + Ae.BLKSIZE_s / 2 + 0] = l + c, t[r][i + Ae.BLKSIZE_s / 2 + 2] = l - c, t[r][i + Ae.BLKSIZE_s / 2 + 1] = f + u, t[r][i + Ae.BLKSIZE_s / 2 + 3] = f - u;
              } while (0 <= --_);
              m(t[r], i, Ae.BLKSIZE_s / 2);
            }
          }, this.fft_long = function (e, t, a, n, s) {
            var r = Ae.BLKSIZE / 8 - 1,
              i = Ae.BLKSIZE / 2;
            do {
              var o,
                _,
                l,
                f,
                c,
                u = 255 & v[r];
              o = h[u] * n[a][s + u], c = h[u + 512] * n[a][s + u + 512], _ = o - c, o += c, l = h[u + 256] * n[a][s + u + 256], c = h[u + 768] * n[a][s + u + 768], f = l - c, l += c, t[0 + (i -= 4)] = o + l, t[i + 2] = o - l, t[i + 1] = _ + f, t[i + 3] = _ - f, o = h[u + 1] * n[a][s + u + 1], c = h[u + 513] * n[a][s + u + 513], _ = o - c, o += c, l = h[u + 257] * n[a][s + u + 257], c = h[u + 769] * n[a][s + u + 769], f = l - c, l += c, t[i + Ae.BLKSIZE / 2 + 0] = o + l, t[i + Ae.BLKSIZE / 2 + 2] = o - l, t[i + Ae.BLKSIZE / 2 + 1] = _ + f, t[i + Ae.BLKSIZE / 2 + 3] = _ - f;
            } while (0 <= --r);
            m(t, i, Ae.BLKSIZE / 2);
          }, this.init_fft = function (e) {
            for (var t = 0; t < Ae.BLKSIZE; t++) h[t] = .42 - .5 * Math.cos(2 * Math.PI * (t + .5) / Ae.BLKSIZE) + .08 * Math.cos(4 * Math.PI * (t + .5) / Ae.BLKSIZE);
            for (var t = 0; t < Ae.BLKSIZE_s / 2; t++) p[t] = .5 * (1 - Math.cos(2 * Math.PI * (t + .5) / Ae.BLKSIZE_s));
          };
        }(),
        R = 2.302585092994046,
        d = 2,
        g = 16,
        E = .34,
        v = 1 / 217621504 / (Ae.BLKSIZE / 2),
        S = .2302585093;
      function se(e, t, a, n, s, r, i, o, _, l, f) {
        var c = e.internal_flags;
        _ < 2 ? (k.fft_long(c, n[s], _, l, f), k.fft_short(c, r[i], _, l, f)) : 2 == _ && me(), t[0] = n[s + 0][0], t[0] *= t[0];
        for (var u = Ae.BLKSIZE / 2 - 1; 0 <= u; --u) {
          var h = n[s + 0][Ae.BLKSIZE / 2 - u],
            b = n[s + 0][Ae.BLKSIZE / 2 + u];
          t[Ae.BLKSIZE / 2 - u] = .5 * (h * h + b * b);
        }
        for (var p = 2; 0 <= p; --p) {
          a[p][0] = r[i + 0][p][0], a[p][0] *= a[p][0];
          for (var u = Ae.BLKSIZE_s / 2 - 1; 0 <= u; --u) {
            var h = r[i + 0][p][Ae.BLKSIZE_s / 2 - u],
              b = r[i + 0][p][Ae.BLKSIZE_s / 2 + u];
            a[p][Ae.BLKSIZE_s / 2 - u] = .5 * (h * h + b * b);
          }
        }
        for (var m = 0, u = 11; u < Ae.HBLKSIZE; u++) m += t[u];
        c.tot_ener[_] = m, e.analysis && me(), 2 == e.athaa_loudapprox && _ < 2 && (c.loudness_sq[o][_] = c.loudness_sq_save[_], c.loudness_sq_save[_] = function (e, t) {
          for (var a = 0, n = 0; n < Ae.BLKSIZE / 2; ++n) a += e[n] * t.ATH.eql_w[n];
          return a *= v;
        }(t, c));
      }
      var x,
        B,
        T,
        C = 8,
        I = 23,
        L = 15,
        re = [1, .79433, .63096, .63096, .63096, .63096, .63096, .25119, .11749],
        f = [3.3246 * 3.3246, 3.23837 * 3.23837, 9.9500500969, 9.0247369744, 8.1854926609, 7.0440875649, 2.46209 * 2.46209, 2.284 * 2.284, 4.4892710641, 1.96552 * 1.96552, 1.82335 * 1.82335, 1.69146 * 1.69146, 2.4621061921, 2.1508568964, 1.37074 * 1.37074, 1.31036 * 1.31036, 1.5691069696, 1.4555939904, 1.16203 * 1.16203, 1.2715945225, 1.09428 * 1.09428, 1.0659 * 1.0659, 1.0779838276, 1.0382591025, 1],
        c = [1.7782755904, 1.35879 * 1.35879, 1.38454 * 1.38454, 1.39497 * 1.39497, 1.40548 * 1.40548, 1.3537 * 1.3537, 1.6999465924, 1.22321 * 1.22321, 1.3169398564, 1],
        u = [5.5396212496, 2.29259 * 2.29259, 4.9868695969, 2.12675 * 2.12675, 2.02545 * 2.02545, 1.87894 * 1.87894, 1.74303 * 1.74303, 1.61695 * 1.61695, 2.2499700001, 1.39148 * 1.39148, 1.29083 * 1.29083, 1.19746 * 1.19746, 1.2339655056, 1.0779838276];
      function ie(e, t, a, n, s, r) {
        var i;
        if (e < t) {
          if (!(t < e * B)) return e + t;
          i = t / e;
        } else {
          if (t * B <= e) return e + t;
          i = e / t;
        }
        if (e += t, n + 3 <= 6) {
          if (x <= i) return e;
          var o = 0 | V.FAST_LOG10_X(i, 16);
          return e * c[o];
        }
        var _,
          l,
          o = 0 | V.FAST_LOG10_X(i, 16);
        return t = 0 != r ? s.ATH.cb_s[a] * s.ATH.adjust : s.ATH.cb_l[a] * s.ATH.adjust, e < T * t ? t < e ? (_ = 1, o <= 13 && (_ = u[o]), l = V.FAST_LOG10_X(e / t, 10 / 15), e * ((f[o] - _) * l + _)) : 13 < o ? e : e * u[o] : e * f[o];
      }
      function oe(e, t, a, n, s) {
        var r,
          i,
          o = 0,
          _ = 0;
        for (r = i = 0; r < Ae.SBMAX_s; ++i, ++r) {
          for (var l = e.bo_s[r], f = e.npart_s, c = l < f ? l : f; i < c;) o += t[i], _ += a[i], i++;
          if (e.en[n].s[r][s] = o, e.thm[n].s[r][s] = _, f <= i) {
            ++r;
            break;
          }
          var u = e.PSY.bo_s_weight[r],
            h = 1 - u;
          o = u * t[i], _ = u * a[i], e.en[n].s[r][s] += o, e.thm[n].s[r][s] += _, o = h * t[i], _ = h * a[i];
        }
        for (; r < Ae.SBMAX_s; ++r) e.en[n].s[r][s] = 0, e.thm[n].s[r][s] = 0;
      }
      function _e(e, t, a, n) {
        var s,
          r,
          i = 0,
          o = 0;
        for (s = r = 0; s < Ae.SBMAX_l; ++r, ++s) {
          for (var _ = e.bo_l[s], l = e.npart_l, f = _ < l ? _ : l; r < f;) i += t[r], o += a[r], r++;
          if (e.en[n].l[s] = i, e.thm[n].l[s] = o, l <= r) {
            ++s;
            break;
          }
          var c = e.PSY.bo_l_weight[s],
            u = 1 - c;
          i = c * t[r], o = c * a[r], e.en[n].l[s] += i, e.thm[n].l[s] += o, i = u * t[r], o = u * a[r];
        }
        for (; s < Ae.SBMAX_l; ++s) e.en[n].l[s] = 0, e.thm[n].l[s] = 0;
      }
      function le(e, t, a, n, s, r) {
        var i,
          o,
          _ = e.internal_flags;
        for (o = i = 0; o < _.npart_s; ++o) {
          for (var l = 0, f = 0, c = _.numlines_s[o], u = 0; u < c; ++u, ++i) {
            var h = t[r][i];
            l += h, f < h && (f = h);
          }
          a[o] = l;
        }
        for (i = o = 0; o < _.npart_s; o++) {
          var b = _.s3ind_s[o][0],
            p = _.s3_ss[i++] * a[b];
          for (++b; b <= _.s3ind_s[o][1];) p += _.s3_ss[i] * a[b], ++i, ++b;
          var m = d * _.nb_s1[s][o];
          if (n[o] = Math.min(p, m), _.blocktype_old[1 & s] == Ae.SHORT_TYPE) {
            var m = g * _.nb_s2[s][o],
              v = n[o];
            n[o] = Math.min(m, v);
          }
          _.nb_s2[s][o] = _.nb_s1[s][o], _.nb_s1[s][o] = p;
        }
        for (; o <= Ae.CBANDS; ++o) a[o] = 0, n[o] = 0;
      }
      function fe(e, t, a) {
        return 1 <= a ? e : a <= 0 ? t : 0 < t ? Math.pow(e / t, a) * t : 0;
      }
      var _ = [11.8, 13.6, 17.2, 32, 46.5, 51.3, 57.5, 67.1, 71.5, 84.6, 97.6, 130];
      function ce(e, t) {
        for (var a = 309.07, n = 0; n < Ae.SBMAX_s - 1; n++) for (var s = 0; s < 3; s++) {
          var r = e.thm.s[n][s];
          if (0 < r) {
            var i = r * t,
              o = e.en.s[n][s];
            i < o && (a += 1e10 * i < o ? _[n] * (10 * R) : _[n] * V.FAST_LOG10(o / i));
          }
        }
        return a;
      }
      var o = [6.8, 5.8, 5.8, 6.4, 6.5, 9.9, 12.1, 14.4, 15, 18.9, 21.6, 26.9, 34.2, 40.2, 46.8, 56.5, 60.7, 73.9, 85.7, 93.4, 126.1];
      function ue(e, t) {
        for (var a = 281.0575, n = 0; n < Ae.SBMAX_l - 1; n++) {
          var s = e.thm.l[n];
          if (0 < s) {
            var r = s * t,
              i = e.en.l[n];
            r < i && (a += 1e10 * r < i ? o[n] * (10 * R) : o[n] * V.FAST_LOG10(i / r));
          }
        }
        return a;
      }
      function he(e, t, a, n, s) {
        var r, i;
        for (r = i = 0; r < e.npart_l; ++r) {
          var o,
            _ = 0,
            l = 0;
          for (o = 0; o < e.numlines_l[r]; ++o, ++i) {
            var f = t[i];
            _ += f, l < f && (l = f);
          }
          a[r] = _, n[r] = l, s[r] = _ * e.rnumlines_l[r];
        }
      }
      function be(e, t, a, n) {
        var s = re.length - 1,
          r = 0,
          i = a[r] + a[r + 1];
        if (0 < i) {
          var o = t[r];
          o < t[r + 1] && (o = t[r + 1]);
          var _ = 0 | (i = 20 * (2 * o - i) / (i * (e.numlines_l[r] + e.numlines_l[r + 1] - 1)));
          s < _ && (_ = s), n[r] = _;
        } else n[r] = 0;
        for (r = 1; r < e.npart_l - 1; r++) if (0 < (i = a[r - 1] + a[r] + a[r + 1])) {
          var o = t[r - 1];
          o < t[r] && (o = t[r]), o < t[r + 1] && (o = t[r + 1]);
          var _ = 0 | (i = 20 * (3 * o - i) / (i * (e.numlines_l[r - 1] + e.numlines_l[r] + e.numlines_l[r + 1] - 1)));
          s < _ && (_ = s), n[r] = _;
        } else n[r] = 0;
        if (0 < (i = a[r - 1] + a[r])) {
          var o = t[r - 1];
          o < t[r] && (o = t[r]);
          var _ = 0 | (i = 20 * (2 * o - i) / (i * (e.numlines_l[r - 1] + e.numlines_l[r] - 1)));
          s < _ && (_ = s), n[r] = _;
        } else n[r] = 0;
      }
      var pe = [-1.730326e-17, -.01703172, -1.349528e-17, .0418072, -6.73278e-17, -.0876324, -3.0835e-17, .1863476, -1.104424e-16, -.627638];
      function P(e) {
        return e < 0 && (e = 0), e *= .001, 13 * Math.atan(.76 * e) + 3.5 * Math.atan(e * e / 56.25);
      }
      function H(e, t, a, n, s, r, i, o, _, l, f, c) {
        var u,
          h = de(Ae.CBANDS + 1),
          b = o / (15 < c ? 1152 : 384),
          p = ve(Ae.HBLKSIZE);
        o /= _;
        var m = 0,
          v = 0;
        for (u = 0; u < Ae.CBANDS; u++) {
          var d;
          for (x = P(o * m), h[u] = o * m, d = m; P(o * d) - x < E && d <= _ / 2; d++);
          for (e[u] = d - m, v = u + 1; m < d;) p[m++] = u;
          if (_ / 2 < m) {
            m = _ / 2, ++u;
            break;
          }
        }
        h[u] = o * m;
        for (var g = 0; g < c; g++) {
          var S, w, M, y, A;
          M = l[g], y = l[g + 1], (S = 0 | Math.floor(.5 + f * (M - .5))) < 0 && (S = 0), w = 0 | Math.floor(.5 + f * (y - .5)), _ / 2 < w && (w = _ / 2), a[g] = (p[S] + p[w]) / 2, t[g] = p[w];
          var k = b * y;
          i[g] = (k - h[t[g]]) / (h[t[g] + 1] - h[t[g]]), i[g] < 0 ? i[g] = 0 : 1 < i[g] && (i[g] = 1), A = P(o * l[g] * f), A = Math.min(A, 15.5) / 15.5, r[g] = Math.pow(10, 1.25 * (1 - Math.cos(Math.PI * A)) - 2.5);
        }
        for (var R = m = 0; R < v; R++) {
          var x,
            B,
            T = e[R];
          x = P(o * m), B = P(o * (m + T - 1)), n[R] = .5 * (x + B), x = P(o * (m - .5)), B = P(o * (m + T - .5)), s[R] = B - x, m += T;
        }
        return v;
      }
      function O(e, t, a, n, s, r) {
        var i,
          o,
          _,
          l,
          f,
          c,
          u = ge([Ae.CBANDS, Ae.CBANDS]),
          h = 0;
        if (r) for (var b = 0; b < t; b++) for (i = 0; i < t; i++) {
          var p = (o = a[b] - a[i], c = f = l = _ = void 0, _ = o, l = .5 <= (_ *= 0 <= _ ? 3 : 1.5) && _ <= 2.5 ? 8 * ((c = _ - .5) * c - 2 * c) : 0, ((f = 15.811389 + 7.5 * (_ += .474) - 17.5 * Math.sqrt(1 + _ * _)) <= -60 ? 0 : (_ = Math.exp((l + f) * S), _ /= .6609193)) * n[i]);
          u[b][i] = p * s[b];
        } else me();
        for (var b = 0; b < t; b++) {
          for (i = 0; i < t && !(0 < u[b][i]); i++);
          for (e[b][0] = i, i = t - 1; 0 < i && !(0 < u[b][i]); i--);
          e[b][1] = i, h += e[b][1] - e[b][0] + 1;
        }
        for (var m = de(h), v = 0, b = 0; b < t; b++) for (i = e[b][0]; i <= e[b][1]; i++) m[v++] = u[b][i];
        return m;
      }
      function N(e) {
        var t = P(e);
        return t = Math.min(t, 15.5) / 15.5, Math.pow(10, 1.25 * (1 - Math.cos(Math.PI * t)) - 2.5);
      }
      function n(e, t) {
        e < -.3 && (e = 3410), e /= 1e3, e = Math.max(.1, e);
        var a = 3.64 * Math.pow(e, -.8) - 6.8 * Math.exp(-.6 * Math.pow(e - 3.4, 2)) + 6 * Math.exp(-.15 * Math.pow(e - 8.7, 2)) + .001 * (.6 + .04 * t) * Math.pow(e, 4);
        return a;
      }
      this.L3psycho_anal_ns = function (e, t, a, n, s, r, i, o, _, l) {
        var f,
          c,
          u,
          h,
          b,
          p,
          m,
          v,
          d,
          g = e.internal_flags,
          S = ge([2, Ae.BLKSIZE]),
          w = ge([2, 3, Ae.BLKSIZE_s]),
          M = de(Ae.CBANDS + 1),
          y = de(Ae.CBANDS + 1),
          A = de(Ae.CBANDS + 2),
          k = ve(2),
          R = ve(2),
          x = ge([2, 576]),
          B = ve(Ae.CBANDS + 2),
          T = ve(Ae.CBANDS + 2);
        for (Se.fill(T, 0), f = g.channels_out, e.mode == ye.JOINT_STEREO && (f = 4), d = e.VBR == Me.vbr_off ? 0 == g.ResvMax ? 0 : g.ResvSize / g.ResvMax * .5 : e.VBR == Me.vbr_rh || e.VBR == Me.vbr_mtrh || e.VBR == Me.vbr_mt ? .6 : 1, c = 0; c < g.channels_out; c++) {
          var E = t[c],
            C = a + 576 - 350 - 21 + 192;
          for (h = 0; h < 576; h++) {
            var I, L;
            for (I = E[C + h + 10], b = L = 0; b < 9; b += 2) I += pe[b] * (E[C + h + b] + E[C + h + 21 - b]), L += pe[b + 1] * (E[C + h + b + 1] + E[C + h + 21 - b - 1]);
            x[c][h] = I + L;
          }
          s[n][c].en.assign(g.en[c]), s[n][c].thm.assign(g.thm[c]), 2 < f && me();
        }
        for (c = 0; c < f; c++) {
          var P,
            H = de(12),
            O = [0, 0, 0, 0],
            N = de(12),
            V = 1,
            D = de(Ae.CBANDS),
            F = de(Ae.CBANDS),
            j = [0, 0, 0, 0],
            X = de(Ae.HBLKSIZE),
            Y = ge([3, Ae.HBLKSIZE_s]);
          for (h = 0; h < 3; h++) H[h] = g.nsPsy.last_en_subshort[c][h + 6], N[h] = H[h] / g.nsPsy.last_en_subshort[c][h + 4], O[0] += H[h];
          2 == c && me();
          var z = x[1 & c],
            q = 0;
          for (h = 0; h < 9; h++) {
            for (var G = q + 64, U = 1; q < G; q++) U < Math.abs(z[q]) && (U = Math.abs(z[q]));
            g.nsPsy.last_en_subshort[c][h] = H[h + 3] = U, O[1 + h / 3] += U, U > H[h + 3 - 2] ? U /= H[h + 3 - 2] : U = H[h + 3 - 2] > 10 * U ? H[h + 3 - 2] / (10 * U) : 0, N[h + 3] = U;
          }
          for (e.analysis && me(), P = 3 == c ? g.nsPsy.attackthre_s : g.nsPsy.attackthre, h = 0; h < 12; h++) 0 == j[h / 3] && N[h] > P && (j[h / 3] = h % 3 + 1);
          for (h = 1; h < 4; h++) (O[h - 1] > O[h] ? O[h - 1] / O[h] : O[h] / O[h - 1]) < 1.7 && (j[h] = 0, 1 == h && (j[0] = 0));
          for (0 != j[0] && 0 != g.nsPsy.lastAttacks[c] && (j[0] = 0), 3 != g.nsPsy.lastAttacks[c] && j[0] + j[1] + j[2] + j[3] == 0 || ((V = 0) != j[1] && 0 != j[0] && (j[1] = 0), 0 != j[2] && 0 != j[1] && (j[2] = 0), 0 != j[3] && 0 != j[2] && (j[3] = 0)), c < 2 ? R[c] = V : me(), _[c] = g.tot_ener[c], se(e, X, Y, S, 1 & c, w, 1 & c, n, c, t, a), he(g, X, M, D, F), be(g, D, F, B), v = 0; v < 3; v++) {
            var K, Z;
            for (le(e, Y, y, A, c, v), oe(g, y, A, c, v), m = 0; m < Ae.SBMAX_s; m++) {
              if (Z = g.thm[c].s[m][v], Z *= .8, 2 <= j[v] || 1 == j[v + 1]) {
                var W = 0 != v ? v - 1 : 2,
                  U = fe(g.thm[c].s[m][W], Z, .6 * d);
                Z = Math.min(Z, U);
              }
              if (1 == j[v]) {
                var W = 0 != v ? v - 1 : 2,
                  U = fe(g.thm[c].s[m][W], Z, .3 * d);
                Z = Math.min(Z, U);
              } else if (0 != v && 3 == j[v - 1] || 0 == v && 3 == g.nsPsy.lastAttacks[c]) {
                var W = 2 != v ? v + 1 : 0,
                  U = fe(g.thm[c].s[m][W], Z, .3 * d);
                Z = Math.min(Z, U);
              }
              K = H[3 * v + 3] + H[3 * v + 4] + H[3 * v + 5], 6 * H[3 * v + 5] < K && (Z *= .5, 6 * H[3 * v + 4] < K && (Z *= .5)), g.thm[c].s[m][v] = Z;
            }
          }
          for (g.nsPsy.lastAttacks[c] = j[2], u = p = 0; u < g.npart_l; u++) {
            for (var Q = g.s3ind[u][0], $ = M[Q] * re[B[Q]], J = g.s3_ll[p++] * $; ++Q <= g.s3ind[u][1];) $ = M[Q] * re[B[Q]], J = ie(J, g.s3_ll[p++] * $, Q, Q - u, g, 0);
            J *= .158489319246111, g.blocktype_old[1 & c] == Ae.SHORT_TYPE ? A[u] = J : A[u] = fe(Math.min(J, Math.min(2 * g.nb_1[c][u], 16 * g.nb_2[c][u])), J, d), g.nb_2[c][u] = g.nb_1[c][u], g.nb_1[c][u] = J;
          }
          for (; u <= Ae.CBANDS; ++u) M[u] = 0, A[u] = 0;
          _e(g, M, A, c);
        }
        for (e.mode != ye.STEREO && e.mode != ye.JOINT_STEREO || me(), e.mode == ye.JOINT_STEREO && me(), function (e, t, a, n) {
          var s = e.internal_flags;
          e.short_blocks != we.short_block_coupled || 0 != t[0] && 0 != t[1] || (t[0] = t[1] = 0);
          for (var r = 0; r < s.channels_out; r++) n[r] = Ae.NORM_TYPE, e.short_blocks == we.short_block_dispensed && (t[r] = 1), e.short_blocks == we.short_block_forced && (t[r] = 0), 0 != t[r] ? s.blocktype_old[r] == Ae.SHORT_TYPE && (n[r] = Ae.STOP_TYPE) : (n[r] = Ae.SHORT_TYPE, s.blocktype_old[r] == Ae.NORM_TYPE && (s.blocktype_old[r] = Ae.START_TYPE), s.blocktype_old[r] == Ae.STOP_TYPE && (s.blocktype_old[r] = Ae.SHORT_TYPE)), a[r] = s.blocktype_old[r], s.blocktype_old[r] = n[r];
        }(e, R, l, k), c = 0; c < f; c++) {
          var ee,
            te,
            ae,
            ne = 0;
          1 < c ? me() : (ee = i, ne = 0, te = l[c], ae = s[n][c]), ee[ne + c] = te == Ae.SHORT_TYPE ? ce(ae, g.masking_lower) : ue(ae, g.masking_lower), e.analysis && (g.pinfo.pe[n][c] = ee[ne + c]);
        }
        return 0;
      }, this.psymodel_init = function (e) {
        var t,
          a = e.internal_flags,
          n = !0,
          s = 13,
          r = 0,
          i = 0,
          o = -8.25,
          _ = -4.5,
          l = de(Ae.CBANDS),
          f = de(Ae.CBANDS),
          c = de(Ae.CBANDS),
          u = e.out_samplerate;
        switch (e.experimentalZ) {
          default:
          case 0:
            n = !0;
            break;
          case 1:
            n = e.VBR != Me.vbr_mtrh && e.VBR != Me.vbr_mt;
            break;
          case 2:
            n = !1;
            break;
          case 3:
            s = 8, r = -1.75, i = -.0125, o = -8.25, _ = -2.25;
        }
        for (a.ms_ener_ratio_old = .25, a.blocktype_old[0] = a.blocktype_old[1] = Ae.NORM_TYPE, t = 0; t < 4; ++t) {
          for (var h = 0; h < Ae.CBANDS; ++h) a.nb_1[t][h] = 1e20, a.nb_2[t][h] = 1e20, a.nb_s1[t][h] = a.nb_s2[t][h] = 1;
          for (var b = 0; b < Ae.SBMAX_l; b++) a.en[t].l[b] = 1e20, a.thm[t].l[b] = 1e20;
          for (var h = 0; h < 3; ++h) {
            for (var b = 0; b < Ae.SBMAX_s; b++) a.en[t].s[b][h] = 1e20, a.thm[t].s[b][h] = 1e20;
            a.nsPsy.lastAttacks[t] = 0;
          }
          for (var h = 0; h < 9; h++) a.nsPsy.last_en_subshort[t][h] = 10;
        }
        for (a.loudness_sq_save[0] = a.loudness_sq_save[1] = 0, a.npart_l = H(a.numlines_l, a.bo_l, a.bm_l, l, f, a.mld_l, a.PSY.bo_l_weight, u, Ae.BLKSIZE, a.scalefac_band.l, Ae.BLKSIZE / 1152, Ae.SBMAX_l), t = 0; t < a.npart_l; t++) {
          var p = r;
          l[t] >= s && (p = i * (l[t] - s) / (24 - s) + r * (24 - l[t]) / (24 - s)), c[t] = Math.pow(10, p / 10), 0 < a.numlines_l[t] ? a.rnumlines_l[t] = 1 / a.numlines_l[t] : a.rnumlines_l[t] = 0;
        }
        a.s3_ll = O(a.s3ind, a.npart_l, l, f, c, n);
        var m,
          h = 0;
        for (t = 0; t < a.npart_l; t++) {
          g = D.MAX_VALUE;
          for (var v = 0; v < a.numlines_l[t]; v++, h++) {
            var d = u * h / (1e3 * Ae.BLKSIZE);
            S = this.ATHformula(1e3 * d, e) - 20, S = Math.pow(10, .1 * S), (S *= a.numlines_l[t]) < g && (g = S);
          }
          a.ATH.cb_l[t] = g, 6 < (g = 20 * l[t] / 10 - 20) && (g = 100), g < -15 && (g = -15), g -= 8, a.minval_l[t] = Math.pow(10, g / 10) * a.numlines_l[t];
        }
        for (a.npart_s = H(a.numlines_s, a.bo_s, a.bm_s, l, f, a.mld_s, a.PSY.bo_s_weight, u, Ae.BLKSIZE_s, a.scalefac_band.s, Ae.BLKSIZE_s / 384, Ae.SBMAX_s), t = h = 0; t < a.npart_s; t++) {
          var g,
            p = o;
          l[t] >= s && (p = _ * (l[t] - s) / (24 - s) + o * (24 - l[t]) / (24 - s)), c[t] = Math.pow(10, p / 10), g = D.MAX_VALUE;
          for (var v = 0; v < a.numlines_s[t]; v++, h++) {
            var S,
              d = u * h / (1e3 * Ae.BLKSIZE_s);
            S = this.ATHformula(1e3 * d, e) - 20, S = Math.pow(10, .1 * S), (S *= a.numlines_s[t]) < g && (g = S);
          }
          a.ATH.cb_s[t] = g, g = 7 * l[t] / 12 - 7, 12 < l[t] && (g *= 1 + 3.1 * Math.log(1 + g)), l[t] < 12 && (g *= 1 + 2.3 * Math.log(1 - g)), g < -15 && (g = -15), g -= 8, a.minval_s[t] = Math.pow(10, g / 10) * a.numlines_s[t];
        }
        a.s3_ss = O(a.s3ind_s, a.npart_s, l, f, c, n), x = Math.pow(10, (C + 1) / 16), B = Math.pow(10, (I + 1) / 16), T = Math.pow(10, L / 10), k.init_fft(a), a.decay = Math.exp(-1 * R / (.01 * u / 192)), m = 3.5, 0 != (2 & e.exp_nspsytune) && (m = 1), 0 < Math.abs(e.msfix) && (m = e.msfix), e.msfix = m;
        for (var w = 0; w < a.npart_l; w++) a.s3ind[w][1] > a.npart_l - 1 && (a.s3ind[w][1] = a.npart_l - 1);
        var M = 576 * a.mode_gr / u;
        if (a.ATH.decay = Math.pow(10, -1.2 * M), a.ATH.adjust = .01, -(a.ATH.adjustLimit = 1) != e.ATHtype) {
          var y = e.out_samplerate / Ae.BLKSIZE,
            A = 0;
          for (t = d = 0; t < Ae.BLKSIZE / 2; ++t) d += y, a.ATH.eql_w[t] = 1 / Math.pow(10, this.ATHformula(d, e) / 10), A += a.ATH.eql_w[t];
          for (A = 1 / A, t = Ae.BLKSIZE / 2; 0 <= --t;) a.ATH.eql_w[t] *= A;
        }
        for (var w = h = 0; w < a.npart_s; ++w) for (t = 0; t < a.numlines_s[w]; ++t) ++h;
        for (var w = h = 0; w < a.npart_l; ++w) for (t = 0; t < a.numlines_l[w]; ++t) ++h;
        for (t = h = 0; t < a.npart_l; t++) {
          var d = u * (h + a.numlines_l[t] / 2) / (1 * Ae.BLKSIZE);
          a.mld_cb_l[t] = N(d), h += a.numlines_l[t];
        }
        for (; t < Ae.CBANDS; ++t) a.mld_cb_l[t] = 1;
        for (t = h = 0; t < a.npart_s; t++) {
          var d = u * (h + a.numlines_s[t] / 2) / (1 * Ae.BLKSIZE_s);
          a.mld_cb_s[t] = N(d), h += a.numlines_s[t];
        }
        for (; t < Ae.CBANDS; ++t) a.mld_cb_s[t] = 1;
        return 0;
      }, this.ATHformula = function (e, t) {
        var a;
        switch (t.ATHtype) {
          case 0:
            a = n(e, 9);
            break;
          case 1:
            a = n(e, -1);
            break;
          case 2:
            a = n(e, 0);
            break;
          case 3:
            a = n(e, 1) + 6;
            break;
          case 4:
            a = n(e, t.ATHcurve);
            break;
          default:
            a = n(e, 0);
        }
        return a;
      };
    }
    function Y() {
      var T,
        E,
        u,
        h,
        b,
        C = this;
      Y.V9 = 410, Y.V8 = 420, Y.V7 = 430, Y.V6 = 440, Y.V5 = 450, Y.V4 = 460, Y.V3 = 470, Y.V2 = 480, Y.V1 = 490, Y.V0 = 500, Y.R3MIX = 1e3, Y.STANDARD = 1001, Y.EXTREME = 1002, Y.INSANE = 1003, Y.STANDARD_FAST = 1004, Y.EXTREME_FAST = 1005, Y.MEDIUM = 1006, Y.MEDIUM_FAST = 1007, Y.LAME_MAXMP3BUFFER = 147456;
      var p,
        m,
        v = new X();
      function d() {
        this.lowerlimit = 0;
      }
      function s(e, t) {
        this.lowpass = t;
      }
      this.enc = new Ae(), this.setModules = function (e, t, a, n, s, r, i, o, _) {
        T = e, E = t, u = a, h = n, b = s, p = r, m = o, this.enc.setModules(E, v, h, p);
      };
      var I = 4294479419;
      function g(e, t) {
        var a = [new s(8, 2e3), new s(16, 3700), new s(24, 3900), new s(32, 5500), new s(40, 7e3), new s(48, 7500), new s(56, 1e4), new s(64, 11e3), new s(80, 13500), new s(96, 15100), new s(112, 15600), new s(128, 17e3), new s(160, 17500), new s(192, 18600), new s(224, 19400), new s(256, 19700), new s(320, 20500)],
          n = C.nearestBitrateFullIndex(t);
        e.lowerlimit = a[n].lowpass;
      }
      function L(e) {
        var t = Ae.BLKSIZE + e.framesize - Ae.FFTOFFSET;
        return t = Math.max(t, 512 + e.framesize - 32);
      }
      function P() {
        this.n_in = 0, this.n_out = 0;
      }
      function H(e, t, a, n, s, r) {
        var i = e.internal_flags;
        if (i.resample_ratio < .9999 || 1.0001 < i.resample_ratio) me();else {
          r.n_out = Math.min(e.framesize, s), r.n_in = r.n_out;
          for (var o = 0; o < r.n_out; ++o) t[0][i.mf_size + o] = a[0][n + o], 2 == i.channels_out && (t[1][i.mf_size + o] = a[1][n + o]);
        }
      }
      this.lame_init = function () {
        var e,
          t,
          a = new function () {
            this.class_id = 0, this.num_samples = 0, this.num_channels = 0, this.in_samplerate = 0, this.out_samplerate = 0, this.scale = 0, this.scale_left = 0, this.scale_right = 0, this.analysis = !1, this.bWriteVbrTag = !1, this.decode_only = !1, this.quality = 0, this.mode = ye.STEREO, this.force_ms = !1, this.free_format = !1, this.findReplayGain = !1, this.decode_on_the_fly = !1, this.write_id3tag_automatic = !1, this.brate = 0, this.compression_ratio = 0, this.copyright = 0, this.original = 0, this.extension = 0, this.emphasis = 0, this.error_protection = 0, this.strict_ISO = !1, this.disable_reservoir = !1, this.quant_comp = 0, this.quant_comp_short = 0, this.experimentalY = !1, this.experimentalZ = 0, this.exp_nspsytune = 0, this.preset = 0, this.VBR = null, this.VBR_q_frac = 0, this.VBR_q = 0, this.VBR_mean_bitrate_kbps = 0, this.VBR_min_bitrate_kbps = 0, this.VBR_max_bitrate_kbps = 0, this.VBR_hard_min = 0, this.lowpassfreq = 0, this.highpassfreq = 0, this.lowpasswidth = 0, this.highpasswidth = 0, this.maskingadjust = 0, this.maskingadjust_short = 0, this.ATHonly = !1, this.ATHshort = !1, this.noATH = !1, this.ATHtype = 0, this.ATHcurve = 0, this.ATHlower = 0, this.athaa_type = 0, this.athaa_loudapprox = 0, this.athaa_sensitivity = 0, this.short_blocks = null, this.useTemporal = !1, this.interChRatio = 0, this.msfix = 0, this.tune = !1, this.tune_value_a = 0, this.version = 0, this.encoder_delay = 0, this.encoder_padding = 0, this.framesize = 0, this.frameNum = 0, this.lame_allocated_gfp = 0, this.internal_flags = null;
          }(),
          n = ((e = a).class_id = I, t = e.internal_flags = new j(), e.mode = ye.NOT_SET, e.original = 1, e.in_samplerate = 44100, e.num_channels = 2, e.num_samples = -1, e.bWriteVbrTag = !0, e.quality = -1, e.short_blocks = null, t.subblock_gain = -1, e.lowpassfreq = 0, e.highpassfreq = 0, e.lowpasswidth = -1, e.highpasswidth = -1, e.VBR = Me.vbr_off, e.VBR_q = 4, e.ATHcurve = -1, e.VBR_mean_bitrate_kbps = 128, e.VBR_min_bitrate_kbps = 0, e.VBR_max_bitrate_kbps = 0, e.VBR_hard_min = 0, t.VBR_min_bitrate = 1, t.VBR_max_bitrate = 13, e.quant_comp = -1, e.quant_comp_short = -1, e.msfix = -1, t.resample_ratio = 1, t.OldValue[0] = 180, t.OldValue[1] = 180, t.CurrentStep[0] = 4, t.CurrentStep[1] = 4, t.masking_lower = 1, t.nsPsy.attackthre = -1, t.nsPsy.attackthre_s = -1, e.scale = -1, e.athaa_type = -1, e.ATHtype = -1, e.athaa_loudapprox = -1, e.athaa_sensitivity = 0, e.useTemporal = null, e.interChRatio = -1, t.mf_samples_to_encode = Ae.ENCDELAY + Ae.POSTDELAY, e.encoder_padding = 0, t.mf_size = Ae.ENCDELAY - Ae.MDCTDELAY, e.findReplayGain = !1, e.decode_on_the_fly = !1, t.decode_on_the_fly = !1, t.findReplayGain = !1, t.findPeakSample = !1, t.RadioGain = 0, t.AudiophileGain = 0, t.noclipGainChange = 0, t.noclipScale = -1, e.preset = 0, e.write_id3tag_automatic = !0, 0);
        return 0 != n ? null : (a.lame_allocated_gfp = 1, a);
      }, this.nearestBitrateFullIndex = function (e) {
        var t = [8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320],
          a = 0,
          n = 0,
          s = 0,
          r = 0;
        r = t[16], n = t[s = 16], a = 16;
        for (var i = 0; i < 16; i++) if (Math.max(e, t[i + 1]) != e) {
          r = t[i + 1], s = i + 1, n = t[i], a = i;
          break;
        }
        return e - n < r - e ? a : s;
      }, this.lame_init_params = function (e) {
        var t,
          a,
          n = e.internal_flags;
        if (n.Class_ID = 0, null == n.ATH && (n.ATH = new function () {
          this.useAdjust = 0, this.aaSensitivityP = 0, this.adjust = 0, this.adjustLimit = 0, this.decay = 0, this.floor = 0, this.l = de(Ae.SBMAX_l), this.s = de(Ae.SBMAX_s), this.psfb21 = de(Ae.PSFB21), this.psfb12 = de(Ae.PSFB12), this.cb_l = de(Ae.CBANDS), this.cb_s = de(Ae.CBANDS), this.eql_w = de(Ae.BLKSIZE / 2);
        }()), null == n.PSY && (n.PSY = new function () {
          this.mask_adjust = 0, this.mask_adjust_short = 0, this.bo_l_weight = de(Ae.SBMAX_l), this.bo_s_weight = de(Ae.SBMAX_s);
        }()), null == n.rgdata && (n.rgdata = new function () {}()), n.channels_in = e.num_channels, 1 == n.channels_in && (e.mode = ye.MONO), n.channels_out = e.mode == ye.MONO ? 1 : 2, n.mode_ext = Ae.MPG_MD_MS_LR, e.mode == ye.MONO && (e.force_ms = !1), e.VBR == Me.vbr_off && 128 != e.VBR_mean_bitrate_kbps && 0 == e.brate && (e.brate = e.VBR_mean_bitrate_kbps), e.VBR == Me.vbr_off || e.VBR == Me.vbr_mtrh || e.VBR == Me.vbr_mt || (e.free_format = !1), e.VBR == Me.vbr_off && 0 == e.brate && me(), e.VBR == Me.vbr_off && 0 < e.compression_ratio && me(), 0 != e.out_samplerate && (e.out_samplerate < 16e3 ? (e.VBR_mean_bitrate_kbps = Math.max(e.VBR_mean_bitrate_kbps, 8), e.VBR_mean_bitrate_kbps = Math.min(e.VBR_mean_bitrate_kbps, 64)) : e.out_samplerate < 32e3 ? (e.VBR_mean_bitrate_kbps = Math.max(e.VBR_mean_bitrate_kbps, 8), e.VBR_mean_bitrate_kbps = Math.min(e.VBR_mean_bitrate_kbps, 160)) : (e.VBR_mean_bitrate_kbps = Math.max(e.VBR_mean_bitrate_kbps, 32), e.VBR_mean_bitrate_kbps = Math.min(e.VBR_mean_bitrate_kbps, 320))), 0 == e.lowpassfreq) {
          var s = 16e3;
          switch (e.VBR) {
            case Me.vbr_off:
              var r = new d();
              g(r, e.brate), s = r.lowerlimit;
              break;
            case Me.vbr_abr:
              var r = new d();
              g(r, e.VBR_mean_bitrate_kbps), s = r.lowerlimit;
              break;
            case Me.vbr_rh:
              me();
            default:
              me();
          }
          e.mode != ye.MONO || e.VBR != Me.vbr_off && e.VBR != Me.vbr_abr || (s *= 1.5), e.lowpassfreq = 0 | s;
        }
        switch (0 == e.out_samplerate && me(), e.lowpassfreq = Math.min(20500, e.lowpassfreq), e.lowpassfreq = Math.min(e.out_samplerate / 2, e.lowpassfreq), e.VBR == Me.vbr_off && (e.compression_ratio = 16 * e.out_samplerate * n.channels_out / (1e3 * e.brate)), e.VBR == Me.vbr_abr && me(), e.bWriteVbrTag || (e.findReplayGain = !1, e.decode_on_the_fly = !1, n.findPeakSample = !1), n.findReplayGain = e.findReplayGain, n.decode_on_the_fly = e.decode_on_the_fly, n.decode_on_the_fly && (n.findPeakSample = !0), n.findReplayGain && me(), n.decode_on_the_fly && !e.decode_only && me(), n.mode_gr = e.out_samplerate <= 24e3 ? 1 : 2, e.framesize = 576 * n.mode_gr, e.encoder_delay = Ae.ENCDELAY, n.resample_ratio = e.in_samplerate / e.out_samplerate, e.VBR) {
          case Me.vbr_mt:
          case Me.vbr_rh:
          case Me.vbr_mtrh:
            e.compression_ratio = [5.7, 6.5, 7.3, 8.2, 10, 11.9, 13, 14, 15, 16.5][e.VBR_q];
            break;
          case Me.vbr_abr:
            e.compression_ratio = 16 * e.out_samplerate * n.channels_out / (1e3 * e.VBR_mean_bitrate_kbps);
            break;
          default:
            e.compression_ratio = 16 * e.out_samplerate * n.channels_out / (1e3 * e.brate);
        }
        e.mode == ye.NOT_SET && (e.mode = ye.JOINT_STEREO), 0 < e.highpassfreq ? me() : (n.highpass1 = 0, n.highpass2 = 0), 0 < e.lowpassfreq ? (n.lowpass2 = 2 * e.lowpassfreq, 0 <= e.lowpasswidth ? me() : n.lowpass1 = 2 * e.lowpassfreq, n.lowpass1 /= e.out_samplerate, n.lowpass2 /= e.out_samplerate) : me(), function (e) {
          var t,
            a = e.internal_flags,
            n = 32;
          if (0 < a.lowpass1) {
            for (var s = 999, r = 0; r <= 31; r++) {
              var i = r / 31;
              i >= a.lowpass2 && (n = Math.min(n, r)), a.lowpass1 < i && i < a.lowpass2 && (s = Math.min(s, r));
            }
            a.lowpass1 = 999 == s ? (n - .75) / 31 : (s - .75) / 31, a.lowpass2 = n / 31;
          }
          0 < a.highpass2 && me(), 0 < a.highpass2 && me();
          for (var r = 0; r < 32; r++) {
            var o,
              _,
              i = r / 31;
            a.highpass2 > a.highpass1 ? me() : o = 1, _ = a.lowpass2 > a.lowpass1 ? 1 < (t = (i - a.lowpass1) / (a.lowpass2 - a.lowpass1 + 1e-20)) ? 0 : t <= 0 ? 1 : Math.cos(Math.PI / 2 * t) : 1, a.amp_filter[r] = o * _;
          }
        }(e), n.samplerate_index = function (e, t) {
          switch (e) {
            case 44100:
              return t.version = 1, 0;
            case 48e3:
              return t.version = 1;
            case 32e3:
              return t.version = 1, 2;
            case 22050:
              return t.version = 0;
            case 24e3:
              return t.version = 0, 1;
            case 16e3:
              return t.version = 0, 2;
            case 11025:
              return t.version = 0;
            case 12e3:
              return t.version = 0, 1;
            case 8e3:
              return t.version = 0, 2;
            default:
              return t.version = 0, -1;
          }
        }(e.out_samplerate, e), n.samplerate_index < 0 && me(), e.VBR == Me.vbr_off ? e.free_format ? n.bitrate_index = 0 : (e.brate = function (e, t, a) {
          a < 16e3 && (t = 2);
          for (var n = k.bitrate_table[t][1], s = 2; s <= 14; s++) 0 < k.bitrate_table[t][s] && Math.abs(k.bitrate_table[t][s] - e) < Math.abs(n - e) && (n = k.bitrate_table[t][s]);
          return n;
        }(e.brate, e.version, e.out_samplerate), n.bitrate_index = function (e, t, a) {
          a < 16e3 && (t = 2);
          for (var n = 0; n <= 14; n++) if (0 < k.bitrate_table[t][n] && k.bitrate_table[t][n] == e) return n;
          return -1;
        }(e.brate, e.version, e.out_samplerate), n.bitrate_index <= 0 && me()) : n.bitrate_index = 1, e.analysis && (e.bWriteVbrTag = !1), null != n.pinfo && (e.bWriteVbrTag = !1), E.init_bit_stream_w(n);
        for (var i, o = n.samplerate_index + 3 * e.version + 6 * (e.out_samplerate < 16e3 ? 1 : 0), _ = 0; _ < Ae.SBMAX_l + 1; _++) n.scalefac_band.l[_] = h.sfBandIndex[o].l[_];
        for (var _ = 0; _ < Ae.PSFB21 + 1; _++) {
          var l = (n.scalefac_band.l[22] - n.scalefac_band.l[21]) / Ae.PSFB21,
            f = n.scalefac_band.l[21] + _ * l;
          n.scalefac_band.psfb21[_] = f;
        }
        n.scalefac_band.psfb21[Ae.PSFB21] = 576;
        for (var _ = 0; _ < Ae.SBMAX_s + 1; _++) n.scalefac_band.s[_] = h.sfBandIndex[o].s[_];
        for (var _ = 0; _ < Ae.PSFB12 + 1; _++) {
          var l = (n.scalefac_band.s[13] - n.scalefac_band.s[12]) / Ae.PSFB12,
            f = n.scalefac_band.s[12] + _ * l;
          n.scalefac_band.psfb12[_] = f;
        }
        for (n.scalefac_band.psfb12[Ae.PSFB12] = 192, 1 == e.version ? n.sideinfo_len = 1 == n.channels_out ? 21 : 36 : n.sideinfo_len = 1 == n.channels_out ? 13 : 21, e.error_protection && (n.sideinfo_len += 2), a = void 0, a = (t = e).internal_flags, t.frameNum = 0, t.write_id3tag_automatic && m.id3tag_write_v2(t), a.bitrate_stereoMode_Hist = S([16, 5]), a.bitrate_blockType_Hist = S([16, 6]), a.PeakSample = 0, t.bWriteVbrTag && p.InitVbrTag(t), n.Class_ID = I, i = 0; i < 19; i++) n.nsPsy.pefirbuf[i] = 700 * n.mode_gr * n.channels_out;
        switch (-1 == e.ATHtype && (e.ATHtype = 4), e.VBR) {
          case Me.vbr_mt:
            e.VBR = Me.vbr_mtrh;
          case Me.vbr_mtrh:
            null == e.useTemporal && (e.useTemporal = !1), u.apply_preset(e, 500 - 10 * e.VBR_q, 0), e.quality < 0 && (e.quality = LAME_DEFAULT_QUALITY), e.quality < 5 && (e.quality = 0), 5 < e.quality && (e.quality = 5), n.PSY.mask_adjust = e.maskingadjust, n.PSY.mask_adjust_short = e.maskingadjust_short, e.experimentalY ? n.sfb21_extra = !1 : n.sfb21_extra = 44e3 < e.out_samplerate, n.iteration_loop = new VBRNewIterationLoop(b);
            break;
          case Me.vbr_rh:
            u.apply_preset(e, 500 - 10 * e.VBR_q, 0), n.PSY.mask_adjust = e.maskingadjust, n.PSY.mask_adjust_short = e.maskingadjust_short, e.experimentalY ? n.sfb21_extra = !1 : n.sfb21_extra = 44e3 < e.out_samplerate, 6 < e.quality && (e.quality = 6), e.quality < 0 && (e.quality = LAME_DEFAULT_QUALITY), n.iteration_loop = new VBROldIterationLoop(b);
            break;
          default:
            var c;
            n.sfb21_extra = !1, e.quality < 0 && (e.quality = LAME_DEFAULT_QUALITY), (c = e.VBR) == Me.vbr_off && (e.VBR_mean_bitrate_kbps = e.brate), u.apply_preset(e, e.VBR_mean_bitrate_kbps, 0), e.VBR = c, n.PSY.mask_adjust = e.maskingadjust, n.PSY.mask_adjust_short = e.maskingadjust_short, c == Me.vbr_off ? n.iteration_loop = new function (e) {
              var t = e;
              this.quantize = t, this.iteration_loop = function (e, t, a, n) {
                var s = e.internal_flags,
                  r = de(F.SFBMAX),
                  i = de(576),
                  o = ve(2),
                  _ = 0,
                  l = s.l3_side,
                  f = new R(_);
                this.quantize.rv.ResvFrameBegin(e, f), _ = f.bits;
                for (var c = 0; c < s.mode_gr; c++) {
                  this.quantize.qupvt.on_pe(e, t, o, _, c, c), s.mode_ext == Ae.MPG_MD_MS_LR && me();
                  for (var u = 0; u < s.channels_out; u++) {
                    var h,
                      b,
                      p = l.tt[c][u];
                    p.block_type != Ae.SHORT_TYPE ? (h = 0, b = s.PSY.mask_adjust - h) : (h = 0, b = s.PSY.mask_adjust_short - h), s.masking_lower = Math.pow(10, .1 * b), this.quantize.init_outer_loop(s, p), this.quantize.init_xrpow(s, p, i) && (this.quantize.qupvt.calc_xmin(e, n[c][u], p, r), this.quantize.outer_loop(e, p, r, i, u, o[u])), this.quantize.iteration_finish_one(s, c, u);
                  }
                }
                this.quantize.rv.ResvFrameEnd(s, _);
              };
            }(b) : me();
        }
        return e.VBR != Me.vbr_off && me(), e.tune && me(), function (e) {
          var t = e.internal_flags;
          switch (e.quality) {
            default:
            case 9:
              t.psymodel = 0, t.noise_shaping = 0, t.noise_shaping_amp = 0, t.noise_shaping_stop = 0, t.use_best_huffman = 0, t.full_outer_loop = 0;
              break;
            case 8:
              e.quality = 7;
            case 7:
              t.psymodel = 1, t.noise_shaping = 0, t.noise_shaping_amp = 0, t.noise_shaping_stop = 0, t.use_best_huffman = 0, t.full_outer_loop = 0;
              break;
            case 6:
            case 5:
              t.psymodel = 1, 0 == t.noise_shaping && (t.noise_shaping = 1), t.noise_shaping_amp = 0, t.noise_shaping_stop = 0, -1 == t.subblock_gain && (t.subblock_gain = 1), t.use_best_huffman = 0, t.full_outer_loop = 0;
              break;
            case 4:
              t.psymodel = 1, 0 == t.noise_shaping && (t.noise_shaping = 1), t.noise_shaping_amp = 0, t.noise_shaping_stop = 0, -1 == t.subblock_gain && (t.subblock_gain = 1), t.use_best_huffman = 1, t.full_outer_loop = 0;
              break;
            case 3:
              t.psymodel = 1, 0 == t.noise_shaping && (t.noise_shaping = 1), t.noise_shaping_amp = 1, -(t.noise_shaping_stop = 1) == t.subblock_gain && (t.subblock_gain = 1), t.use_best_huffman = 1, t.full_outer_loop = 0;
              break;
            case 2:
              t.psymodel = 1, 0 == t.noise_shaping && (t.noise_shaping = 1), 0 == t.substep_shaping && (t.substep_shaping = 2), t.noise_shaping_amp = 1, -(t.noise_shaping_stop = 1) == t.subblock_gain && (t.subblock_gain = 1), t.use_best_huffman = 1, t.full_outer_loop = 0;
              break;
            case 1:
            case 0:
              t.psymodel = 1, 0 == t.noise_shaping && (t.noise_shaping = 1), 0 == t.substep_shaping && (t.substep_shaping = 2), t.noise_shaping_amp = 2, -(t.noise_shaping_stop = 1) == t.subblock_gain && (t.subblock_gain = 1), t.use_best_huffman = 1, t.full_outer_loop = 0;
          }
        }(e), e.athaa_type < 0 ? n.ATH.useAdjust = 3 : n.ATH.useAdjust = e.athaa_type, n.ATH.aaSensitivityP = Math.pow(10, e.athaa_sensitivity / -10), null == e.short_blocks && (e.short_blocks = we.short_block_allowed), e.short_blocks != we.short_block_allowed || e.mode != ye.JOINT_STEREO && e.mode != ye.STEREO || (e.short_blocks = we.short_block_coupled), e.quant_comp < 0 && (e.quant_comp = 1), e.quant_comp_short < 0 && (e.quant_comp_short = 0), e.msfix < 0 && (e.msfix = 0), e.exp_nspsytune = 1 | e.exp_nspsytune, e.internal_flags.nsPsy.attackthre < 0 && (e.internal_flags.nsPsy.attackthre = X.NSATTACKTHRE), e.internal_flags.nsPsy.attackthre_s < 0 && (e.internal_flags.nsPsy.attackthre_s = X.NSATTACKTHRE_S), e.scale < 0 && (e.scale = 1), e.ATHtype < 0 && (e.ATHtype = 4), e.ATHcurve < 0 && (e.ATHcurve = 4), e.athaa_loudapprox < 0 && (e.athaa_loudapprox = 2), e.interChRatio < 0 && (e.interChRatio = 0), null == e.useTemporal && (e.useTemporal = !0), n.slot_lag = n.frac_SpF = 0, e.VBR == Me.vbr_off && (n.slot_lag = n.frac_SpF = 72e3 * (e.version + 1) * e.brate % e.out_samplerate | 0), h.iteration_init(e), v.psymodel_init(e), 0;
      }, this.lame_encode_flush = function (e, t, a, n) {
        var s,
          r,
          i,
          o,
          _ = e.internal_flags,
          l = M([2, 1152]),
          f = 0,
          c = _.mf_samples_to_encode - Ae.POSTDELAY,
          u = L(e);
        if (_.mf_samples_to_encode < 1) return 0;
        for (s = 0, e.in_samplerate != e.out_samplerate && me(), (i = e.framesize - c % e.framesize) < 576 && (i += e.framesize), e.encoder_padding = i, o = (c + i) / e.framesize; 0 < o && 0 <= f;) {
          var h = u - _.mf_size,
            b = e.frameNum;
          h *= e.in_samplerate, 1152 < (h /= e.out_samplerate) && (h = 1152), h < 1 && (h = 1), r = n - s, 0 == n && (r = 0), f = this.lame_encode_buffer(e, l[0], l[1], h, t, a, r), a += f, s += f, o -= b != e.frameNum ? 1 : 0;
        }
        return _.mf_samples_to_encode = 0, f < 0 ? f : (r = n - s, 0 == n && (r = 0), E.flush_bitstream(e), (f = E.copy_buffer(_, t, a, r, 1)) < 0 ? f : (a += f, r = n - (s += f), 0 == n && (r = 0), e.write_id3tag_automatic && me(), s));
      }, this.lame_encode_buffer = function (e, t, a, n, s, r, i) {
        var o,
          _,
          l = e.internal_flags,
          f = [null, null];
        if (l.Class_ID != I) return -3;
        if (0 == n) return 0;
        _ = n, (null == (o = l).in_buffer_0 || o.in_buffer_nsamples < _) && (o.in_buffer_0 = de(_), o.in_buffer_1 = de(_), o.in_buffer_nsamples = _), f[0] = l.in_buffer_0, f[1] = l.in_buffer_1;
        for (var c = 0; c < n; c++) f[0][c] = t[c], 1 < l.channels_in && (f[1][c] = a[c]);
        return function (e, t, a, n, s, r, i) {
          var o,
            _,
            l,
            f,
            c,
            u = e.internal_flags,
            h = 0,
            b = [null, null],
            p = [null, null];
          if (u.Class_ID != I) return -3;
          if (0 == n) return 0;
          if ((c = E.copy_buffer(u, s, r, i, 0)) < 0) return c;
          if (r += c, h += c, p[0] = t, p[1] = a, N.NEQ(e.scale, 0) && N.NEQ(e.scale, 1)) for (_ = 0; _ < n; ++_) p[0][_] *= e.scale, 2 == u.channels_out && (p[1][_] *= e.scale);
          if (N.NEQ(e.scale_left, 0) && N.NEQ(e.scale_left, 1)) for (_ = 0; _ < n; ++_) p[0][_] *= e.scale_left;
          if (N.NEQ(e.scale_right, 0) && N.NEQ(e.scale_right, 1)) for (_ = 0; _ < n; ++_) p[1][_] *= e.scale_right;
          2 == e.num_channels && 1 == u.channels_out && me(), f = L(e), b[0] = u.mfbuf[0], b[1] = u.mfbuf[1];
          for (var m, v, d, g, S, w, M, y = 0; 0 < n;) {
            var A = [null, null],
              k = 0,
              R = 0;
            A[0] = p[0], A[1] = p[1];
            var x = new P();
            if (H(e, b, A, y, n, x), k = x.n_in, R = x.n_out, u.findReplayGain && !u.decode_on_the_fly && T.AnalyzeSamples(u.rgdata, b[0], u.mf_size, b[1], u.mf_size, R, u.channels_out) == O.GAIN_ANALYSIS_ERROR) return -6;
            if (n -= k, y += k, u.channels_out, u.mf_size += R, u.mf_samples_to_encode < 1 && me(), u.mf_samples_to_encode += R, u.mf_size >= f) {
              var B = i - h;
              if (0 == i && (B = 0), m = e, v = b[0], d = b[1], g = s, S = r, w = B, M = C.enc.lame_encode_mp3_frame(m, v, d, g, S, w), m.frameNum++, (o = M) < 0) return o;
              for (r += o, h += o, u.mf_size -= e.framesize, u.mf_samples_to_encode -= e.framesize, l = 0; l < u.channels_out; l++) for (_ = 0; _ < u.mf_size; _++) b[l][_] = b[l][_ + e.framesize];
            }
          }
          return h;
        }(e, f[0], f[1], n, s, r, i);
      };
    }
    F.SFBMAX = 3 * Ae.SBMAX_s, Ae.ENCDELAY = 576, Ae.POSTDELAY = 1152, Ae.FFTOFFSET = 224 + (Ae.MDCTDELAY = 48), Ae.DECDELAY = 528, Ae.SBLIMIT = 32, Ae.CBANDS = 64, Ae.SBPSY_l = 21, Ae.SBPSY_s = 12, Ae.SBMAX_l = 22, Ae.SBMAX_s = 13, Ae.PSFB21 = 6, Ae.PSFB12 = 6, Ae.HBLKSIZE = (Ae.BLKSIZE = 1024) / 2 + 1, Ae.HBLKSIZE_s = (Ae.BLKSIZE_s = 256) / 2 + 1, Ae.NORM_TYPE = 0, Ae.START_TYPE = 1, Ae.SHORT_TYPE = 2, Ae.STOP_TYPE = 3, Ae.MPG_MD_LR_LR = 0, Ae.MPG_MD_LR_I = 1, Ae.MPG_MD_MS_LR = 2, Ae.MPG_MD_MS_I = 3, Ae.fircoef = [-.1039435, -.1892065, 5 * -.0432472, -.155915, 3.898045e-17, .0467745 * 5, .50455, .756825, .187098 * 5], j.MFSIZE = 3456 + Ae.ENCDELAY - Ae.MDCTDELAY, j.MAX_HEADER_BUF = 256, j.MAX_BITS_PER_CHANNEL = 4095, j.MAX_BITS_PER_GRANULE = 7680, j.BPC = 320, F.SFBMAX = 3 * Ae.SBMAX_s, t.Mp3Encoder = function (n, e, t) {
      1 != n && me("fix cc: only supports mono");
      var s = new Y(),
        a = new function () {
          this.setModules = function (e, t) {};
        }(),
        r = new O(),
        i = new N(),
        o = new function () {
          function e(e, t, a, n, s, r, i, o, _, l, f, c, u, h) {
            this.quant_comp = t, this.quant_comp_s = a, this.safejoint = n, this.nsmsfix = s, this.st_lrm = r, this.st_s = i, this.nsbass = o, this.scale = _, this.masking_adj = l, this.ath_lower = f, this.ath_curve = c, this.interch = u, this.sfscale = h;
          }
          var i;
          function n(e, t, a) {
            me();
          }
          this.setModules = function (e) {
            i = e;
          };
          var o = [new e(8, 9, 9, 0, 0, 6.6, 145, 0, .95, 0, -30, 11, .0012, 1), new e(16, 9, 9, 0, 0, 6.6, 145, 0, .95, 0, -25, 11, .001, 1), new e(24, 9, 9, 0, 0, 6.6, 145, 0, .95, 0, -20, 11, .001, 1), new e(32, 9, 9, 0, 0, 6.6, 145, 0, .95, 0, -15, 11, .001, 1), new e(40, 9, 9, 0, 0, 6.6, 145, 0, .95, 0, -10, 11, 9e-4, 1), new e(48, 9, 9, 0, 0, 6.6, 145, 0, .95, 0, -10, 11, 9e-4, 1), new e(56, 9, 9, 0, 0, 6.6, 145, 0, .95, 0, -6, 11, 8e-4, 1), new e(64, 9, 9, 0, 0, 6.6, 145, 0, .95, 0, -2, 11, 8e-4, 1), new e(80, 9, 9, 0, 0, 6.6, 145, 0, .95, 0, 0, 8, 7e-4, 1), new e(96, 9, 9, 0, 2.5, 6.6, 145, 0, .95, 0, 1, 5.5, 6e-4, 1), new e(112, 9, 9, 0, 2.25, 6.6, 145, 0, .95, 0, 2, 4.5, 5e-4, 1), new e(128, 9, 9, 0, 1.95, 6.4, 140, 0, .95, 0, 3, 4, 2e-4, 1), new e(160, 9, 9, 1, 1.79, 6, 135, 0, .95, -2, 5, 3.5, 0, 1), new e(192, 9, 9, 1, 1.49, 5.6, 125, 0, .97, -4, 7, 3, 0, 0), new e(224, 9, 9, 1, 1.25, 5.2, 125, 0, .98, -6, 9, 2, 0, 0), new e(256, 9, 9, 1, .97, 5.2, 125, 0, 1, -8, 10, 1, 0, 0), new e(320, 9, 9, 1, .9, 5.2, 125, 0, 1, -10, 12, 0, 0, 0)];
          function s(e, t, a) {
            var n = t,
              s = i.nearestBitrateFullIndex(t);
            if (e.VBR = Me.vbr_abr, e.VBR_mean_bitrate_kbps = n, e.VBR_mean_bitrate_kbps = Math.min(e.VBR_mean_bitrate_kbps, 320), e.VBR_mean_bitrate_kbps = Math.max(e.VBR_mean_bitrate_kbps, 8), e.brate = e.VBR_mean_bitrate_kbps, 320 < e.VBR_mean_bitrate_kbps && (e.disable_reservoir = !0), 0 < o[s].safejoint && (e.exp_nspsytune = 2 | e.exp_nspsytune), 0 < o[s].sfscale && (e.internal_flags.noise_shaping = 2), 0 < Math.abs(o[s].nsbass)) {
              var r = int(4 * o[s].nsbass);
              r < 0 && (r += 64), e.exp_nspsytune = e.exp_nspsytune | r << 2;
            }
            return 0 != a ? e.quant_comp = o[s].quant_comp : 0 < Math.abs(e.quant_comp - -1) || (e.quant_comp = o[s].quant_comp), 0 != a ? e.quant_comp_short = o[s].quant_comp_s : 0 < Math.abs(e.quant_comp_short - -1) || (e.quant_comp_short = o[s].quant_comp_s), 0 != a ? e.msfix = o[s].nsmsfix : 0 < Math.abs(e.msfix - -1) || (e.msfix = o[s].nsmsfix), 0 != a ? e.internal_flags.nsPsy.attackthre = o[s].st_lrm : 0 < Math.abs(e.internal_flags.nsPsy.attackthre - -1) || (e.internal_flags.nsPsy.attackthre = o[s].st_lrm), 0 != a ? e.internal_flags.nsPsy.attackthre_s = o[s].st_s : 0 < Math.abs(e.internal_flags.nsPsy.attackthre_s - -1) || (e.internal_flags.nsPsy.attackthre_s = o[s].st_s), 0 != a ? e.scale = o[s].scale : 0 < Math.abs(e.scale - -1) || (e.scale = o[s].scale), 0 != a ? e.maskingadjust = o[s].masking_adj : 0 < Math.abs(e.maskingadjust - 0) || (e.maskingadjust = o[s].masking_adj), 0 < o[s].masking_adj ? 0 != a ? e.maskingadjust_short = .9 * o[s].masking_adj : 0 < Math.abs(e.maskingadjust_short - 0) || (e.maskingadjust_short = .9 * o[s].masking_adj) : 0 != a ? e.maskingadjust_short = 1.1 * o[s].masking_adj : 0 < Math.abs(e.maskingadjust_short - 0) || (e.maskingadjust_short = 1.1 * o[s].masking_adj), 0 != a ? e.ATHlower = -o[s].ath_lower / 10 : 0 < Math.abs(10 * -e.ATHlower - 0) || (e.ATHlower = -o[s].ath_lower / 10), 0 != a ? e.ATHcurve = o[s].ath_curve : 0 < Math.abs(e.ATHcurve - -1) || (e.ATHcurve = o[s].ath_curve), 0 != a ? e.interChRatio = o[s].interch : 0 < Math.abs(e.interChRatio - -1) || (e.interChRatio = o[s].interch), t;
          }
          this.apply_preset = function (e, t, a) {
            switch (t) {
              case Y.R3MIX:
                t = Y.V3, e.VBR = Me.vbr_mtrh;
                break;
              case Y.MEDIUM:
                t = Y.V4, e.VBR = Me.vbr_rh;
                break;
              case Y.MEDIUM_FAST:
                t = Y.V4, e.VBR = Me.vbr_mtrh;
                break;
              case Y.STANDARD:
                t = Y.V2, e.VBR = Me.vbr_rh;
                break;
              case Y.STANDARD_FAST:
                t = Y.V2, e.VBR = Me.vbr_mtrh;
                break;
              case Y.EXTREME:
                t = Y.V0, e.VBR = Me.vbr_rh;
                break;
              case Y.EXTREME_FAST:
                t = Y.V0, e.VBR = Me.vbr_mtrh;
                break;
              case Y.INSANE:
                return t = 320, e.preset = t, s(e, t, a), e.VBR = Me.vbr_off, t;
            }
            switch (e.preset = t) {
              case Y.V9:
                return n(), t;
              case Y.V8:
                return n(), t;
              case Y.V7:
                return n(), t;
              case Y.V6:
                return n(), t;
              case Y.V5:
                return n(), t;
              case Y.V4:
                return n(), t;
              case Y.V3:
                return n(), t;
              case Y.V2:
                return n(), t;
              case Y.V1:
                return n(), t;
              case Y.V0:
                return n(), t;
            }
            return 8 <= t && t <= 320 ? s(e, t, a) : (e.preset = 0, t);
          };
        }(),
        _ = new T(),
        l = new C(),
        f = new y(),
        c = new function () {
          this.getLameShortVersion = function () {
            return "3.98.4";
          };
        }(),
        u = new function () {
          this.setModules = function (e, t) {};
        }(),
        h = new function () {
          var _;
          this.setModules = function (e) {
            _ = e;
          }, this.ResvFrameBegin = function (e, t) {
            var a,
              n = e.internal_flags,
              s = n.l3_side,
              r = _.getframebits(e);
            t.bits = (r - 8 * n.sideinfo_len) / n.mode_gr;
            var i = 2048 * n.mode_gr - 8;
            320 < e.brate ? me() : (a = 11520, e.strict_ISO && me()), n.ResvMax = a - r, n.ResvMax > i && (n.ResvMax = i), (n.ResvMax < 0 || e.disable_reservoir) && (n.ResvMax = 0);
            var o = t.bits * n.mode_gr + Math.min(n.ResvSize, n.ResvMax);
            return a < o && (o = a), s.resvDrain_pre = 0, null != n.pinfo && me(), o;
          }, this.ResvMaxBits = function (e, t, a, n) {
            var s,
              r = e.internal_flags,
              i = r.ResvSize,
              o = r.ResvMax;
            0 != n && (i += t), 0 != (1 & r.substep_shaping) && (o *= .9), a.bits = t, 9 * o < 10 * i ? (s = i - 9 * o / 10, a.bits += s, r.substep_shaping |= 128) : (s = 0, r.substep_shaping &= 127, e.disable_reservoir || 0 != (1 & r.substep_shaping) || (a.bits -= .1 * t));
            var _ = i < 6 * r.ResvMax / 10 ? i : 6 * r.ResvMax / 10;
            return (_ -= s) < 0 && (_ = 0), _;
          }, this.ResvAdjust = function (e, t) {
            e.ResvSize -= t.part2_3_length + t.part2_length;
          }, this.ResvFrameEnd = function (e, t) {
            var a,
              n = e.l3_side;
            e.ResvSize += t * e.mode_gr;
            var s = 0;
            n.resvDrain_post = 0, (n.resvDrain_pre = 0) != (a = e.ResvSize % 8) && (s += a), 0 < (a = e.ResvSize - s - e.ResvMax) && (s += a);
            var r = Math.min(8 * n.main_data_begin, s) / 8;
            n.resvDrain_pre += 8 * r, s -= 8 * r, e.ResvSize -= 8 * r, n.main_data_begin -= r, n.resvDrain_post += s, e.ResvSize -= s;
          };
        }(),
        b = new A(),
        p = new function () {
          this.setModules = function (e, t, a) {};
        }(),
        m = new function () {}();
      s.setModules(r, i, o, _, l, f, c, u, m), i.setModules(r, m, c, f), u.setModules(i, c), o.setModules(s), l.setModules(i, h, _, b), _.setModules(b, h, s.enc.psy), h.setModules(i), b.setModules(_), f.setModules(s, i, c), a.setModules(p, m), p.setModules(c, u, o);
      var v = s.lame_init();
      v.num_channels = n, v.in_samplerate = e, v.out_samplerate = e, v.brate = t, v.mode = ye.STEREO, v.quality = 3, v.bWriteVbrTag = !1, v.disable_reservoir = !0, v.write_id3tag_automatic = !1, s.lame_init_params(v);
      var d = 1152,
        g = 0 | 1.25 * d + 7200,
        S = w(g);
      this.encodeBuffer = function (e, t) {
        1 == n && (t = e), e.length > d && (d = e.length, S = w(g = 0 | 1.25 * d + 7200));
        var a = s.lame_encode_buffer(v, e, t, e.length, S, 0, g);
        return new Int8Array(S.subarray(0, a));
      }, this.flush = function () {
        var e = s.lame_encode_flush(v, S, 0, g);
        return new Int8Array(S.subarray(0, e));
      };
    };
  }
  t(), e.lamejs = t;
}(("object" == typeof window && window.document ? window : Object).Recorder);
});

/*
录音 Recorder扩展，动态波形显示
https://github.com/xiangyuecn/Recorder
*/
(function (factory) {
  var browser = typeof window == "object" && !!window.document;
  var win = browser ? window : Object; //非浏览器环境，Recorder挂载在Object下面
  var rec = win.Recorder,
    ni = rec.i18n;
  factory(rec, ni, ni.$T, browser);
})(function (Recorder, i18n, $T, isBrowser) {

  var WaveView = function (set) {
    return new fn(set);
  };
  var ViewTxt = "WaveView";
  var fn = function (set) {
    var This = this;
    var o = {
      /*
      elem:"css selector" //自动显示到dom，并以此dom大小为显示大小
      	//或者配置显示大小，手动把waveviewObj.elem显示到别的地方
      ,width:0 //显示宽度
      ,height:0 //显示高度
      
      H5环境以上配置二选一
      
      compatibleCanvas: CanvasObject //提供一个兼容H5的canvas对象，需支持getContext("2d")，支持设置width、height，支持drawImage(canvas,...)
      ,width:0 //canvas显示宽度
      ,height:0 //canvas显示高度
      非H5环境使用以上配置
      */

      scale: 2 //缩放系数，应为正整数，使用2(3? no!)倍宽高进行绘制，避免移动端绘制模糊
      ,
      speed: 9 //移动速度系数，越大越快
      ,
      phase: 21.8 //相位，调整了速度后，调整这个值得到一个看起来舒服的波形
      ,

      fps: 20 //绘制帧率，调整后也需调整phase值
      ,
      keep: true //当停止了input输入时，是否保持波形，设为false停止后将变成一条线
      ,

      lineWidth: 3 //线条基础粗细

      //渐变色配置：[位置，css颜色，...] 位置: 取值0.0-1.0之间
      ,
      linear1: [0, "rgba(150,96,238,1)", 0.2, "rgba(170,79,249,1)", 1, "rgba(53,199,253,1)"] //线条渐变色1，从左到右
      ,
      linear2: [0, "rgba(209,130,255,0.6)", 1, "rgba(53,199,255,0.6)"] //线条渐变色2，从左到右
      ,
      linearBg: [0, "rgba(255,255,255,0.2)", 1, "rgba(54,197,252,0.2)"] //背景渐变色，从上到下
    };
    for (var k in set) {
      o[k] = set[k];
    }
    This.set = set = o;
    var cCanvas = "compatibleCanvas";
    if (set[cCanvas]) {
      var canvas = This.canvas = set[cCanvas];
    } else {
      if (!isBrowser) throw new Error($T.G("NonBrowser-1", [ViewTxt]));
      var elem = set.elem;
      if (elem) {
        if (typeof elem == "string") {
          elem = document.querySelector(elem);
        } else if (elem.length) {
          elem = elem[0];
        }
      }
      if (elem) {
        set.width = elem.offsetWidth;
        set.height = elem.offsetHeight;
      }
      var thisElem = This.elem = document.createElement("div");
      thisElem.style.fontSize = 0;
      thisElem.innerHTML = '<canvas style="width:100%;height:100%;"/>';
      var canvas = This.canvas = thisElem.querySelector("canvas");
      if (elem) {
        elem.innerHTML = "";
        elem.appendChild(thisElem);
      }
    }
    var scale = set.scale;
    var width = set.width * scale;
    var height = set.height * scale;
    if (!width || !height) {
      throw new Error($T.G("IllegalArgs-1", [ViewTxt + " width=0 height=0"]));
    }
    canvas.width = width;
    canvas.height = height;
    var ctx = This.ctx = canvas.getContext("2d");
    This.linear1 = This.genLinear(ctx, width, set.linear1);
    This.linear2 = This.genLinear(ctx, width, set.linear2);
    This.linearBg = This.genLinear(ctx, height, set.linearBg, true);
    This._phase = 0;
  };
  fn.prototype = WaveView.prototype = {
    genLinear: function (ctx, size, colors, top) {
      var rtv = ctx.createLinearGradient(0, 0, top ? 0 : size, top ? size : 0);
      for (var i = 0; i < colors.length;) {
        rtv.addColorStop(colors[i++], colors[i++]);
      }
      return rtv;
    },
    genPath: function (frequency, amplitude, phase) {
      //曲线生成算法参考 https://github.com/HaloMartin/MCVoiceWave/blob/f6dc28975fbe0f7fc6cc4dbc2e61b0aa5574e9bc/MCVoiceWave/MCVoiceWaveView.m#L268
      var rtv = [];
      var This = this,
        set = This.set;
      var scale = set.scale;
      var width = set.width * scale;
      var maxAmplitude = set.height * scale / 2;
      for (var x = 0; x <= width; x += scale) {
        var scaling = (1 + Math.cos(Math.PI + x / width * 2 * Math.PI)) / 2;
        var y = scaling * maxAmplitude * amplitude * Math.sin(2 * Math.PI * (x / width) * frequency + phase) + maxAmplitude;
        rtv.push(y);
      }
      return rtv;
    },
    input: function (pcmData, powerLevel, sampleRate) {
      var This = this;
      This.sampleRate = sampleRate;
      This.pcmData = pcmData;
      This.pcmPos = 0;
      This.inputTime = Date.now();
      This.schedule();
    },
    schedule: function () {
      var This = this,
        set = This.set;
      var interval = Math.floor(1000 / set.fps);
      if (!This.timer) {
        This.timer = setInterval(function () {
          This.schedule();
        }, interval);
      }
      var now = Date.now();
      var drawTime = This.drawTime || 0;
      if (now - drawTime < interval) {
        //没到间隔时间，不绘制
        return;
      }
      This.drawTime = now;

      //切分当前需要的绘制数据
      var bufferSize = This.sampleRate / set.fps;
      var pcm = This.pcmData;
      var pos = This.pcmPos;
      var len = Math.max(0, Math.min(bufferSize, pcm.length - pos));
      var sum = 0;
      for (var i = 0; i < len; i++, pos++) {
        sum += Math.abs(pcm[pos]);
      }
      This.pcmPos = pos;

      //推入绘制
      if (len || !set.keep) {
        This.draw(Recorder.PowerLevel(sum, len));
      }
      if (!len && now - This.inputTime > 1300) {
        //超时没有输入，干掉定时器
        clearInterval(This.timer);
        This.timer = 0;
      }
    },
    draw: function (powerLevel) {
      var This = this,
        set = This.set;
      var ctx = This.ctx;
      var scale = set.scale;
      var width = set.width * scale;
      var height = set.height * scale;
      var speedx = set.speed / set.fps;
      var phase = This._phase -= speedx; //位移速度
      var phase2 = phase + speedx * set.phase;
      var amplitude = powerLevel / 100;
      var path1 = This.genPath(2, amplitude, phase);
      var path2 = This.genPath(1.8, amplitude, phase2);

      //开始绘制图形
      ctx.clearRect(0, 0, width, height);

      //绘制包围背景
      ctx.beginPath();
      for (var i = 0, x = 0; x <= width; i++, x += scale) {
        if (x == 0) {
          ctx.moveTo(x, path1[i]);
        } else {
          ctx.lineTo(x, path1[i]);
        }
      }
      i--;
      for (var x = width - 1; x >= 0; i--, x -= scale) {
        ctx.lineTo(x, path2[i]);
      }
      ctx.closePath();
      ctx.fillStyle = This.linearBg;
      ctx.fill();

      //绘制线
      This.drawPath(path2, This.linear2);
      This.drawPath(path1, This.linear1);
    },
    drawPath: function (path, linear) {
      var This = this,
        set = This.set;
      var ctx = This.ctx;
      var scale = set.scale;
      var width = set.width * scale;
      ctx.beginPath();
      for (var i = 0, x = 0; x <= width; i++, x += scale) {
        if (x == 0) {
          ctx.moveTo(x, path[i]);
        } else {
          ctx.lineTo(x, path[i]);
        }
      }
      ctx.lineWidth = set.lineWidth * scale;
      ctx.strokeStyle = linear;
      ctx.stroke();
    }
  };
  Recorder[ViewTxt] = WaveView;
});

/*
录音 Recorder扩展，频率直方图显示
使用本扩展需要引入src/extensions/lib.fft.js支持，直方图特意优化主要显示0-5khz语音部分（线性），其他高频显示区域较小，不适合用来展示音乐频谱，可通过配置fullFreq来恢复成完整的线性频谱，或自行修改源码修改成倍频程频谱（伯德图、对数频谱）；本可视化插件可以移植到其他语言环境，如需定制可联系作者

https://github.com/xiangyuecn/Recorder

本扩展核心算法主要参考了Java开源库jmp123 版本0.3 的代码：
https://www.iteye.com/topic/851459
https://sourceforge.net/projects/jmp123/files/
*/
(function (factory) {
  var browser = typeof window == "object" && !!window.document;
  var win = browser ? window : Object; //非浏览器环境，Recorder挂载在Object下面
  var rec = win.Recorder,
    ni = rec.i18n;
  factory(rec, ni, ni.$T, browser);
})(function (Recorder, i18n, $T, isBrowser) {

  var FrequencyHistogramView = function (set) {
    return new fn(set);
  };
  var ViewTxt = "FrequencyHistogramView";
  var fn = function (set) {
    var This = this;
    var o = {
      /*
      elem:"css selector" //自动显示到dom，并以此dom大小为显示大小
      	//或者配置显示大小，手动把frequencyObj.elem显示到别的地方
      ,width:0 //显示宽度
      ,height:0 //显示高度
      
      H5环境以上配置二选一
      
      compatibleCanvas: CanvasObject //提供一个兼容H5的canvas对象，需支持getContext("2d")，支持设置width、height，支持drawImage(canvas,...)
      ,width:0 //canvas显示宽度
      ,height:0 //canvas显示高度
      非H5环境使用以上配置
      */

      scale: 2 //缩放系数，应为正整数，使用2(3? no!)倍宽高进行绘制，避免移动端绘制模糊
      ,

      fps: 20 //绘制帧率，不可过高
      ,

      lineCount: 30 //直方图柱子数量，数量的多少对性能影响不大，密集运算集中在FFT算法中
      ,
      widthRatio: 0.6 //柱子线条宽度占比，为所有柱子占用整个视图宽度的比例，剩下的空白区域均匀插入柱子中间；默认值也基本相当于一根柱子占0.6，一根空白占0.4；设为1不留空白，当视图不足容下所有柱子时也不留空白
      ,
      spaceWidth: 0 //柱子间空白固定基础宽度，柱子宽度自适应，当不为0时widthRatio无效，当视图不足容下所有柱子时将不会留空白，允许为负数，让柱子发生重叠
      ,
      minHeight: 0 //柱子保留基础高度，position不为±1时应该保留点高度
      ,
      position: -1 //绘制位置，取值-1到1，-1为最底下，0为中间，1为最顶上，小数为百分比
      ,
      mirrorEnable: false //是否启用镜像，如果启用，视图宽度会分成左右两块，右边这块进行绘制，左边这块进行镜像（以中间这根柱子的中心进行镜像）
      ,

      stripeEnable: true //是否启用柱子顶上的峰值小横条，position不是-1时应当关闭，否则会很丑
      ,
      stripeHeight: 3 //峰值小横条基础高度
      ,
      stripeMargin: 6 //峰值小横条和柱子保持的基础距离
      ,

      fallDuration: 1000 //柱子从最顶上下降到最底部最长时间ms
      ,
      stripeFallDuration: 3500 //峰值小横条从最顶上下降到底部最长时间ms

      //柱子颜色配置：[位置，css颜色，...] 位置: 取值0.0-1.0之间
      ,
      linear: [0, "rgba(0,187,17,1)", 0.5, "rgba(255,215,0,1)", 1, "rgba(255,102,0,1)"]
      //峰值小横条渐变颜色配置，取值格式和linear一致，留空为柱子的渐变颜色
      ,
      stripeLinear: null,
      shadowBlur: 0 //柱子阴影基础大小，设为0不显示阴影，如果柱子数量太多时请勿开启，非常影响性能
      ,
      shadowColor: "#bbb" //柱子阴影颜色
      ,
      stripeShadowBlur: -1 //峰值小横条阴影基础大小，设为0不显示阴影，-1为柱子的大小，如果柱子数量太多时请勿开启，非常影响性能
      ,
      stripeShadowColor: "" //峰值小横条阴影颜色，留空为柱子的阴影颜色
      ,

      fullFreq: false //是否要绘制所有频率；默认false主要绘制5khz以下的频率，高频部分占比很少，此时不同的采样率对频谱显示几乎没有影响；设为true后不同采样率下显示的频谱是不一样的，因为 最大频率=采样率/2 会有差异
      //当发生绘制时会回调此方法，参数为当前绘制的频率数据和采样率，可实现多个直方图同时绘制，只消耗一个input输入和计算时间
      ,
      onDraw: function (frequencyData, sampleRate) {}
    };
    for (var k in set) {
      o[k] = set[k];
    }
    This.set = set = o;
    var cCanvas = "compatibleCanvas";
    if (set[cCanvas]) {
      var canvas = This.canvas = set[cCanvas];
    } else {
      if (!isBrowser) throw new Error($T.G("NonBrowser-1", [ViewTxt]));
      var elem = set.elem;
      if (elem) {
        if (typeof elem == "string") {
          elem = document.querySelector(elem);
        } else if (elem.length) {
          elem = elem[0];
        }
      }
      if (elem) {
        set.width = elem.offsetWidth;
        set.height = elem.offsetHeight;
      }
      var thisElem = This.elem = document.createElement("div");
      thisElem.style.fontSize = 0;
      thisElem.innerHTML = '<canvas style="width:100%;height:100%;"/>';
      var canvas = This.canvas = thisElem.querySelector("canvas");
      if (elem) {
        elem.innerHTML = "";
        elem.appendChild(thisElem);
      }
    }
    var scale = set.scale;
    var width = set.width * scale;
    var height = set.height * scale;
    if (!width || !height) {
      throw new Error($T.G("IllegalArgs-1", [ViewTxt + " width=0 height=0"]));
    }
    canvas.width = width;
    canvas.height = height;
    This.ctx = canvas.getContext("2d");
    if (!Recorder.LibFFT) {
      throw new Error($T.G("NeedImport-2", [ViewTxt, "src/extensions/lib.fft.js"]));
    }
    This.fft = Recorder.LibFFT(1024);

    //柱子所在高度
    This.lastH = [];
    //峰值小横条所在高度
    This.stripesH = [];
  };
  fn.prototype = FrequencyHistogramView.prototype = {
    genLinear: function (ctx, colors, from, to) {
      var rtv = ctx.createLinearGradient(0, from, 0, to);
      for (var i = 0; i < colors.length;) {
        rtv.addColorStop(colors[i++], colors[i++]);
      }
      return rtv;
    },
    input: function (pcmData, powerLevel, sampleRate) {
      var This = this;
      This.sampleRate = sampleRate;
      This.pcmData = pcmData;
      This.pcmPos = 0;
      This.inputTime = Date.now();
      This.schedule();
    },
    schedule: function () {
      var This = this,
        set = This.set;
      var interval = Math.floor(1000 / set.fps);
      if (!This.timer) {
        This.timer = setInterval(function () {
          This.schedule();
        }, interval);
      }
      var now = Date.now();
      var drawTime = This.drawTime || 0;
      if (now - This.inputTime > set.stripeFallDuration * 1.3) {
        //超时没有输入，顶部横条已全部落下，干掉定时器
        clearInterval(This.timer);
        This.timer = 0;
        This.lastH = []; //重置高度再绘制一次，避免定时不准没到底就停了
        This.stripesH = [];
        This.draw(null, This.sampleRate);
        return;
      }
      if (now - drawTime < interval) {
        //没到间隔时间，不绘制
        return;
      }
      This.drawTime = now;

      //调用FFT计算频率数据
      var bufferSize = This.fft.bufferSize;
      var pcm = This.pcmData;
      var pos = This.pcmPos;
      var arr = new Int16Array(bufferSize);
      for (var i = 0; i < bufferSize && pos < pcm.length; i++, pos++) {
        arr[i] = pcm[pos];
      }
      This.pcmPos = pos;
      var frequencyData = This.fft.transform(arr);

      //推入绘制
      This.draw(frequencyData, This.sampleRate);
    },
    draw: function (frequencyData, sampleRate) {
      var This = this,
        set = This.set;
      var ctx = This.ctx;
      var scale = set.scale;
      var width = set.width * scale;
      var height = set.height * scale;
      var lineCount = set.lineCount;
      var bufferSize = This.fft.bufferSize;

      //计算高度位置
      var position = set.position;
      var posAbs = Math.abs(set.position);
      var originY = position == 1 ? 0 : height; //y轴原点
      var heightY = height; //最高的一边高度
      if (posAbs < 1) {
        heightY = heightY / 2;
        originY = heightY;
        heightY = Math.floor(heightY * (1 + posAbs));
        originY = Math.floor(position > 0 ? originY * (1 - posAbs) : originY * (1 + posAbs));
      }
      var lastH = This.lastH;
      var stripesH = This.stripesH;
      var speed = Math.ceil(heightY / (set.fallDuration / (1000 / set.fps)));
      var stripeSpeed = Math.ceil(heightY / (set.stripeFallDuration / (1000 / set.fps)));
      var stripeMargin = set.stripeMargin * scale;
      var Y0 = 1 << (Math.round(Math.log(bufferSize) / Math.log(2) + 3) << 1);
      var logY0 = Math.log(Y0) / Math.log(10);
      var dBmax = 20 * Math.log(0x7fff) / Math.log(10);
      var fftSize = bufferSize / 2,
        fftSize5k = fftSize;
      if (!set.fullFreq) {
        //非绘制所有频率时，计算5khz所在位置，8000采样率及以下最高只有4khz
        fftSize5k = Math.min(fftSize, Math.floor(fftSize * 5000 / (sampleRate / 2)));
      }
      var isFullFreq = fftSize5k == fftSize;
      var line80 = isFullFreq ? lineCount : Math.round(lineCount * 0.8); //80%的柱子位置
      var fftSizeStep1 = fftSize5k / line80;
      var fftSizeStep2 = isFullFreq ? 0 : (fftSize - fftSize5k) / (lineCount - line80);
      var fftIdx = 0;
      for (var i = 0; i < lineCount; i++) {
        // !fullFreq 时不采用jmp123的非线性划分频段，录音语音并不适用于音乐的频率，应当弱化高频部分
        //80%关注0-5khz主要人声部分 20%关注剩下的高频，这样不管什么采样率都能做到大部分频率显示一致。
        var start = Math.ceil(fftIdx);
        if (i < line80) {
          //5khz以下
          fftIdx += fftSizeStep1;
        } else {
          //5khz以上
          fftIdx += fftSizeStep2;
        }
        var end = Math.ceil(fftIdx);
        if (end == start) end++;
        end = Math.min(end, fftSize);

        //参考AudioGUI.java .drawHistogram方法

        //查找当前频段的最大"幅值"
        var maxAmp = 0;
        if (frequencyData) {
          for (var j = start; j < end; j++) {
            maxAmp = Math.max(maxAmp, Math.abs(frequencyData[j]));
          }
        }

        //计算音量
        var dB = maxAmp > Y0 ? Math.floor((Math.log(maxAmp) / Math.log(10) - logY0) * 17) : 0;
        var h = heightY * Math.min(dB / dBmax, 1);

        //使柱子匀速下降
        lastH[i] = (lastH[i] || 0) - speed;
        if (h < lastH[i]) {
          h = lastH[i];
        }
        if (h < 0) {
          h = 0;
        }
        lastH[i] = h;
        var shi = stripesH[i] || 0;
        if (h && h + stripeMargin > shi) {
          stripesH[i] = h + stripeMargin;
        } else {
          //使峰值小横条匀速度下落
          var sh = shi - stripeSpeed;
          if (sh < 0) {
            sh = 0;
          }
          stripesH[i] = sh;
        }
      }

      //开始绘制图形
      ctx.clearRect(0, 0, width, height);
      var linear1 = This.genLinear(ctx, set.linear, originY, originY - heightY); //上半部分的填充
      var stripeLinear1 = set.stripeLinear && This.genLinear(ctx, set.stripeLinear, originY, originY - heightY) || linear1; //上半部分的峰值小横条填充

      var linear2 = This.genLinear(ctx, set.linear, originY, originY + heightY); //下半部分的填充
      var stripeLinear2 = set.stripeLinear && This.genLinear(ctx, set.stripeLinear, originY, originY + heightY) || linear2; //上半部分的峰值小横条填充

      //计算柱子间距
      var mirrorEnable = set.mirrorEnable;
      var mirrorCount = mirrorEnable ? lineCount * 2 - 1 : lineCount; //镜像柱子数量翻一倍-1根

      var widthRatio = set.widthRatio;
      var spaceWidth = set.spaceWidth * scale;
      if (spaceWidth != 0) {
        widthRatio = (width - spaceWidth * (mirrorCount + 1)) / width;
      }
      for (var i = 0; i < 2; i++) {
        var lineFloat = Math.max(1 * scale, width * widthRatio / mirrorCount); //柱子宽度至少1个单位
        var lineWN = Math.floor(lineFloat),
          lineWF = lineFloat - lineWN; //提取出小数部分
        var spaceFloat = (width - mirrorCount * lineFloat) / (mirrorCount + 1); //均匀间隔，首尾都留空，可能为负数，柱子将发生重叠
        if (spaceFloat > 0 && spaceFloat < 1) {
          widthRatio = 1;
          spaceFloat = 0; //不够一个像素，丢弃不绘制间隔，重新计算
        } else break;
      }

      //绘制
      var minHeight = set.minHeight * scale;
      var XFloat = mirrorEnable ? (width - lineWN) / 2 - spaceFloat : 0; //镜像时，中间柱子位于正中心
      for (var iMirror = 0; iMirror < 2; iMirror++) {
        if (iMirror) {
          ctx.save();
          ctx.scale(-1, 1);
        }
        var xMirror = iMirror ? width : 0; //绘制镜像部分，不用drawImage(canvas)进行镜像绘制，提升兼容性（iOS微信小程序bug https://developers.weixin.qq.com/community/develop/doc/000aaca2148dc8a235a0fb8c66b000）

        //绘制柱子
        ctx.shadowBlur = set.shadowBlur * scale;
        ctx.shadowColor = set.shadowColor;
        for (var i = 0, xFloat = XFloat, wFloat = 0, x, y, w, h; i < lineCount; i++) {
          xFloat += spaceFloat;
          x = Math.floor(xFloat) - xMirror;
          w = lineWN;
          wFloat += lineWF;
          if (wFloat >= 1) {
            w++;
            wFloat--;
          } //小数凑够1像素
          h = Math.max(lastH[i], minHeight);

          //绘制上半部分
          if (originY != 0) {
            y = originY - h;
            ctx.fillStyle = linear1;
            ctx.fillRect(x, y, w, h);
          }
          //绘制下半部分
          if (originY != height) {
            ctx.fillStyle = linear2;
            ctx.fillRect(x, originY, w, h);
          }
          xFloat += w;
        }

        //绘制柱子顶上峰值小横条
        if (set.stripeEnable) {
          var stripeShadowBlur = set.stripeShadowBlur;
          ctx.shadowBlur = (stripeShadowBlur == -1 ? set.shadowBlur : stripeShadowBlur) * scale;
          ctx.shadowColor = set.stripeShadowColor || set.shadowColor;
          var stripeHeight = set.stripeHeight * scale;
          for (var i = 0, xFloat = XFloat, wFloat = 0, x, y, w, h; i < lineCount; i++) {
            xFloat += spaceFloat;
            x = Math.floor(xFloat) - xMirror;
            w = lineWN;
            wFloat += lineWF;
            if (wFloat >= 1) {
              w++;
              wFloat--;
            } //小数凑够1像素
            h = stripesH[i];

            //绘制上半部分
            if (originY != 0) {
              y = originY - h - stripeHeight;
              if (y < 0) {
                y = 0;
              }
              ctx.fillStyle = stripeLinear1;
              ctx.fillRect(x, y, w, stripeHeight);
            }
            //绘制下半部分
            if (originY != height) {
              y = originY + h;
              if (y + stripeHeight > height) {
                y = height - stripeHeight;
              }
              ctx.fillStyle = stripeLinear2;
              ctx.fillRect(x, y, w, stripeHeight);
            }
            xFloat += w;
          }
        }
        if (iMirror) {
          ctx.restore();
        }
        if (!mirrorEnable) break;
      }
      if (frequencyData) {
        set.onDraw(frequencyData, sampleRate);
      }
    }
  };
  Recorder[ViewTxt] = FrequencyHistogramView;
});

/*
时域转频域，快速傅里叶变换(FFT)
https://github.com/xiangyuecn/Recorder

var fft=Recorder.LibFFT(bufferSize)
	bufferSize取值2的n次方

fft.bufferSize 实际采用的bufferSize
fft.transform(inBuffer)
	inBuffer:[Int16,...] 数组长度必须是bufferSize
	返回[Float64(Long),...]，长度为bufferSize/2
*/
(function (factory) {
  var browser = typeof window == "object" && !!window.document;
  var win = browser ? window : Object; //非浏览器环境，Recorder挂载在Object下面
  var rec = win.Recorder,
    ni = rec.i18n;
  factory(rec, ni, ni.$T, browser);
})(function (Recorder, i18n, $T, isBrowser) {

  /*
  从FFT.java 移植，Java开源库：jmp123 版本0.3
  https://www.iteye.com/topic/851459
  https://sourceforge.net/projects/jmp123/files/
  */
  Recorder.LibFFT = function (bufferSize) {
    var FFT_N_LOG, FFT_N, MINY;
    var real, imag, sintable, costable;
    var bitReverse;
    var FFT_Fn = function (bufferSize) {
      //bufferSize只能取值2的n次方
      FFT_N_LOG = Math.round(Math.log(bufferSize) / Math.log(2));
      FFT_N = 1 << FFT_N_LOG;
      MINY = (FFT_N << 2) * Math.sqrt(2);
      real = [];
      imag = [];
      sintable = [0];
      costable = [0];
      bitReverse = [];
      var i, j, k, reve;
      for (i = 0; i < FFT_N; i++) {
        k = i;
        for (j = 0, reve = 0; j != FFT_N_LOG; j++) {
          reve <<= 1;
          reve |= k & 1;
          k >>>= 1;
        }
        bitReverse[i] = reve;
      }
      var theta,
        dt = 2 * Math.PI / FFT_N;
      for (i = (FFT_N >> 1) - 1; i > 0; i--) {
        theta = i * dt;
        costable[i] = Math.cos(theta);
        sintable[i] = Math.sin(theta);
      }
    };

    /*
    用于频谱显示的快速傅里叶变换 
       inBuffer 输入FFT_N个实数，返回 FFT_N/2个输出值(复数模的平方)。 
    */
    var getModulus = function (inBuffer) {
      var i,
        j,
        k,
        ir,
        j0 = 1,
        idx = FFT_N_LOG - 1;
      var cosv, sinv, tmpr, tmpi;
      for (i = 0; i != FFT_N; i++) {
        real[i] = inBuffer[bitReverse[i]];
        imag[i] = 0;
      }
      for (i = FFT_N_LOG; i != 0; i--) {
        for (j = 0; j != j0; j++) {
          cosv = costable[j << idx];
          sinv = sintable[j << idx];
          for (k = j; k < FFT_N; k += j0 << 1) {
            ir = k + j0;
            tmpr = cosv * real[ir] - sinv * imag[ir];
            tmpi = cosv * imag[ir] + sinv * real[ir];
            real[ir] = real[k] - tmpr;
            imag[ir] = imag[k] - tmpi;
            real[k] += tmpr;
            imag[k] += tmpi;
          }
        }
        j0 <<= 1;
        idx--;
      }
      j = FFT_N >> 1;
      var outBuffer = new Float64Array(j);
      /*
       * 输出模的平方:
       * for(i = 1; i <= j; i++)
       * 	inBuffer[i-1] = real[i] * real[i] +  imag[i] * imag[i];
       * 
       * 如果FFT只用于频谱显示,可以"淘汰"幅值较小的而减少浮点乘法运算. MINY的值
       * 和Spectrum.Y0,Spectrum.logY0对应.
       */
      sinv = MINY;
      cosv = -MINY;
      for (i = j; i != 0; i--) {
        tmpr = real[i];
        tmpi = imag[i];
        if (tmpr > cosv && tmpr < sinv && tmpi > cosv && tmpi < sinv) outBuffer[i - 1] = 0;else outBuffer[i - 1] = Math.round(tmpr * tmpr + tmpi * tmpi);
      }
      return outBuffer;
    };
    FFT_Fn(bufferSize);
    return {
      transform: getModulus,
      bufferSize: FFT_N
    };
  };
});

var playIcon$6 = "data:image/png;base64,[encoded data, 8980 characters]";

var pauseIcon$5 = "data:image/png;base64,[encoded data, 8780 characters]";

var audioIcon$4 = "data:image/png;base64,[encoded data, 4516 characters]";

var coverLocal$1 = "5d9cf0a5d487a818.png";

var playRepeat$3 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgNzkuMTcxYzI3ZiwgMjAyMi8wOC8xNi0xODowMjo0MyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI0LjAgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0wOFQxNTowNToyNyswODowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDQtMjhUMTM6NDA6MDYrMDg6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDQtMjhUMTM6NDA6MDYrMDg6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjFkNmU3NmMwLTE5NWEtY2U0OS1iNGE4LTQ5NzZlY2FiMmRhNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5ZWQ4M2Q3Ny1hMDJjLTA3NGUtYWEyOC0xMWFkMzg3Yzg0ZjAiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5ZWQ4M2Q3Ny1hMDJjLTA3NGUtYWEyOC0xMWFkMzg3Yzg0ZjAiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjllZDgzZDc3LWEwMmMtMDc0ZS1hYTI4LTExYWQzODdjODRmMCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0wOFQxNTowNToyNyswODowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI0LjAgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDoxZDZlNzZjMC0xOTVhLWNlNDktYjRhOC00OTc2ZWNhYjJkYTUiIHN0RXZ0OndoZW49IjIwMjQtMDQtMjhUMTM6NDA6MDYrMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNC4wIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz77PGlAAAAEZElEQVRYhe3YW0ybZRgH8P/zfv06pOHQopuYRRdnDCMzUYeHYIAPtrHp2LLEK4270ZndOMZhCVcmaDKicmjBzbnEwyQxzmji5hKJiKPgYS6RgcbDhZuZ0YSpbaEwCm2/93m82KYECy1rp1zwT3rRL0/f75ce3ud9SiKCpRz1fwOSZRmYbpaB6WbJAx2JLhJRygtUtQdLmWS7At3BRKsAuQGCMAl+FgNnWKN3sLHg11TWSrTlUcKLKQBLD4d3ZV2K10HRvTKrnCAQEEAABAAEhjLfsUm3+Pd5vrvuQKsztJ60vAbCAyRXDEAvREZE0U/E6g9S+jYRVQTAAqRYREAEGHHy9TUV1F834COdwa0Rph6DGSIAO432aLZ69fTuvHPz3bTCG3pYidQRpBoCzDipN+r01AztoXhGgWsPTFYWuSKnptkAk+NHSGyHv2HlvLC5sXzhZyD2y0aMAYfj608b3fdlDLi9WbKnckMTAjGU4CunWWD11FI0VdzVVDeHakyxT07lAYDjoL/BszcjwE3toQ9E2Tu1mKP+Bvcti4XNTvEnU0/e/O2l14lNsGFa/Q05AwsBk+6DVZ3BUlayUxjQwGPp4ADgh82uN4SzThA0hGK+ZPVJgfGoMSPCE2Ks+PCzBvdAsvpUIpS7WzsIBNxttYbWL1ws8q/HfxGrI3SquiUgG96deGEhS8JOMjsVbWO7bG0f/6LppslMwMoO/FloZKuHiMhvO1GZE5Ai682xfArpHQC659Yv+BFX+UJvK6W7V5jGBasruDoTQGeuOkQs74G5VgwCTdt3UYC/AdFbiernBW70BU6C+fErzctDNkYs79iadIE6ktUtikFAAQSAwu0w5FYAl1IGlrWFj4KlRkDAlW5GQAEJj6T7TvqbXMeZ9TbQ7O86AWxYKQOdxOUaBM3yMQAGKAAgBiBPx5CbDhAABhsLP7LZ3EaXTxQabJT0788fSlSbcKMub4kUUvZ0vpPUFDP/osUYi5Ha6hKO9zW6h9MFXs2WjrAnSpzrr3dfAK6hk2w4Imbe9HhQtJ0TV+bmz+vz+zKFq+oI3B92FQzPPjQsupMM7aE4mI8RAU7hrozhusbXCnAmLxL6LVlt0k4y43C9KFBwkr3untappzIBJK2PAQIRJD1pJwV+WZt1XqAOxoTgMSOHH/TKmnRwle3h50WkRBFhxpH1dNpAAPA3uPcyZBQsZhaPny33Tq67FpzVEWwE2c8KANaq6XStK+kPLuWpzrRzKxjmtFJxtyHR4UpfcEvKsGZxWN6gV4m0KRYQjPf793teSuW1izryl3VFiw09MaBE3SgABNRDGof6p9w9aCaeW7/R9/sqzY4nCKhTkNWaCGzAN1ibeC7JyNBU2npxpVOZrxDhUZK/J7hpAN8DOCukIiK00oAuEeDOf4Y7GtWmem6wNv/IfGtndOy0vIFNILWPRCohcM26zdVVLj8jOm8LHb3oyG89l2RMSBm4lLLk//pYBqabZWC6WQamm78AEV4zMhfNvWEAAAAASUVORK5CYII=";

var playOnce$3 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAgCAMAAAA2a+hwAAAAAXNSR0IArs4c6QAAAlJQTFRFAAAAgID/QID/QID/OY7jRovoO4nrSZLtRIjuPIfwQIzyQJnySZLzRpfzQ4X0QIrqQo7sPo3tEN73RI/wPI3yQZDrPo/sQ4ztQ4zzO4jtQY7tPo7uPYvuQI/vOY3vPo3vPIzrQZHwNqL1QI7wRYTrK4b2QY/uP47uR47yQIvvP43rQI/wP5DwSXz0QozuPYvxQY/uQI3uQY3vQI/yQZDzQpDwQ472QI3uPIn3P4vqQo7vQo3tQI3uQJDuQI7uQI3uQI7sQo7sQpHxQY3sPo7vQI7tQI/xQY7tQY3tQY3vPo7vQo/rP5HuQY3uQJDxQorsQo7sQo7vOI3xQovrQo3rQY7tQY3tQI7tQI3sPY/wN5vvQo7vNKPyQY7tQ43tQY/uQorsQI7sQY3uPJfwQI7wPpPuP4/vQY7tTnTsRJPxP47vQYzsPZDvP43uQo7sO5jvQY3uPZDwQ4ftQI7tQo3uQY7uQo7uQY7tQY7tQ43wQY7tQI3tQI7uQI7tQI/wP4zuQ5DtQY7tRJHsQI7tQY7tQI7tQY7uQI7uQY3uQo7tPpHtQI7tQY/sQY7sQY/tQY7tQY7tQY3sQY/uQI7tQY7tQo7uQo/uSY7tQY/tTXnqQY3tQY7tQY7tQY7tQY7tQY7uQY7tPZXtQY3tQY7tQY7tQY7tQo/tP5LqQI/rQI/sQY3sQY7rQY7sQY7tQY/rQY/sQY/tQZDtQozsQo3rQo3sQo3tQo7qQo7rQo7sQo7tQo/tQ4vsQ4zrQ47qQ47sRIfrRInsRI/rRI/sRYnsR4TqR4fqvnKd/wAAAKd0Uk5TAAIECAkLDQ4PERQUFRYXGBsdHyImJykqKisrLS4wMTEzMzQ0NDs7PT1AQURFRklLS0xOUFNVWFxdYWFlZ2doa2xsbW5vb3BxcnJzdHl5fHx8fH+AgIGCg4iJjIyOjpGSkpOUlZeZm56goaKio6OjpKaqqq6vsLO0t7i5vL7GxsfHyMjLy8zN0tTW2trc4ubn6erq7Ozs7Ozu7vHz9Pb3+Pn6+/v9/v6utNnsAAABnklEQVQYGY3BhVsTcQDH4c8QRbCwu7tbVFQsPLu7u3t2YRfYXRhg7r4GMnYzMPm/nLf7nTjkeXxf/lv7I3OoVP+IllCpvg80l39rNiTrkrQymQpqTD4rV7QriabkRx3tnXdP9tQqkDGAP1IPKXw6qy7ZciYCqbLnY6RdkDKBUVI2MUlL39jr8eQV3elATKdTI4kb+6FsMa7NZY/rkWDw8589ielS8qU3FWwquRoAcu0N+Opg3AxNgFalr2rhSd/3qBuece8vwszvOXjGFEiz8dQOC46GRuNK3iMVaDzG+TBct3vgSpGGrpOFse0rPH3blLhGrdkqC2P5OyhUQ3y7ZWEs/AG31RlfUBbGmiLIdQbiC8rC2P8SNkaW4QvKwrgfhkGhu/h2aRKedsVhqGnb/TAOazqend8OAit0BWP4ycbEdXxR2hJIeRJZS6LArc87+K2Xo2n8Len46xsBXAs+fVxFeU3OhJ61wTNL0XPdMarOkPOwLb7M/GIdGNE8rVr1+n1WX3OcYw0oJ32LnKhcjvKGkaDFohOFirm8PQPPL6EvjEOwGD5qAAAAAElFTkSuQmCC";

var recStartIcon$1 = "data:image/png;base64,[encoded data, 12236 characters]";

var recStopIcon$1 = "data:image/png;base64,[encoded data, 8860 characters]";

var recDelete$1 = "data:image/png;base64,[encoded data, 4368 characters]";

var recMockWave$1 = "data:image/png;base64,[encoded data, 4992 characters]";

//
const uuid$1 = prefix => {
  const s = [];
  const hexDigits = '0123456789abcdef';
  for (let i = 0; i < 36; i += 1) {
    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
  }
  s[14] = '4';
  s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1);
  const id = s.join('');
  return prefix ? prefix + '__' + id : id;
};
var script$67 = {
  name: 'RecordPlayer',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    playStyle: {
      type: String,
      default: 'yuan-wen'
    },
    styleMode: {
      type: String,
      default: 'A'
    },
    url: {
      type: String,
      default: '',
      require: true
    },
    title: {
      type: String,
      default: '音频文件'
    },
    content: {
      type: String,
      default: '暂无简介'
    },
    coverImageUrl: {
      type: String,
      default: ''
    },
    //进度是否能控制
    scheduleControl: {
      type: String,
      default: ''
    },
    loop: {
      type: Boolean,
      default: true
    },
    playMode: {
      type: String,
      default: 'xun-huan'
    },
    targerLink: {
      type: String,
      default: ''
    },
    playerIndex: {
      type: Number,
      default: -1
    }
  },
  data() {
    return {
      playIcon: playIcon$6,
      pauseIcon: pauseIcon$5,
      audioIcon: audioIcon$4,
      coverLocal: coverLocal$1,
      recStartIcon: recStartIcon$1,
      recStopIcon: recStopIcon$1,
      recDelete: recDelete$1,
      recMockWave: recMockWave$1,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      link: {
        type: String,
        default: ''
      },
      //链接地址
      lastOperateTimeStamp: '',
      recordAudio: null,
      permissionDialogVisible: false,
      Rec: recorder_mp3_min,
      type: 'mp3',
      bitRate: 16,
      sampleRate: 16000,
      rec: null,
      recDuration: 0,
      powerLevel: 0,
      logs: [],
      recBolb: null,
      isRecing: false,
      hasInitSuccess: false,
      waveStore: {
        selected: 'Histogram2',
        WaveView: {},
        Histogram2: {},
        Histogram3: {}
      },
      recordDataUrl: '',
      lastAudioStamp: null,
      lastPlayStamp: null,
      waveBoxKey: uuid$1('wave'),
      recTimestamp: null
    };
  },
  computed: {
    videoAndMusicStop() {
      let playState = sessionStorage.getItem('SET_PLAY_STATE');
      return playState;
    },
    playModeIconSrc() {
      let srcMap = {
        'xun-huan': playRepeat$3,
        'dan-ci': playOnce$3
      };
      return srcMap[this.playMode];
    },
    controlStatusText() {
      let text = '';
      if (this.recBolb) {
        text = this.isPlay ? '' : '';
      } else {
        text = this.isRecing ? '结束录音' : '开始录音';
      }
      return text;
    }
  },
  watch: {
    url: {
      handler(newVal) {
        let _this = this;
        this.isPlay = false;
        let ua = navigator.userAgent;
        console.log('浏览器 UA', ua);
        /micromessenger/.test(ua.toLowerCase());
        let isIOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        // isWeixin && isIOS && newVal && this.$message({
        //   message: `当前UA为${ua}`,
        //   duration: 3000
        // })
        if (isIOS && newVal) {
          try {
            this.$nextTick(() => {
              _this.$refs.recordAudio.muted = true;
              const playPromise = _this.$refs.recordAudio.play();
              _this.$refs.recordAudio.muted = false;
              if (playPromise) {
                playPromise.then(() => {
                  _this.$refs.recordAudio.pause();
                }).catch(error => {
                  _this.$refs.recordAudio.pause();
                  console.log(error);
                });
              }
            });
          } catch (error) {
            console.log(error);
            this.$message({
              type: 'warning',
              message: error,
              duration: 5000
            });
          }
        }
      },
      immediate: true
    },
    videoAndMusicStop(val) {
      console.log('watch', val);
      let currentPlayStamp = val || '--';
      if (`${this.url}__playTimeStamp__${this.lastOperateTimeStamp}` !== currentPlayStamp) {
        this.recordAudio.pause();
      }
    }
  },
  mounted() {
    // 加载完毕后，先获取<video>标签DOM对象
    this.recordAudio = this.$refs.recordAudio;
    // let _this = this;
    // if(!this.recBolb && !this.isRecing) {
    //   let rec = this.rec = Recorder({
    //       type:_this.type,
    //       bitRate:_this.bitRate,
    //       sampleRate:_this.sampleRate,
    //       onProcess:function(buffers,powerLevel,duration,sampleRate){
    //           _this.recDuration = duration;
    //           _this.powerLevel = powerLevel;
    //           // _this.wave.input(buffers[buffers.length-1],powerLevel,sampleRate);
    //           //可视化图形绘制
    //           $(".recwave").html("").append(_this.waveStore[_this.waveStore.selected].elem);
    //           _this.waveStore[_this.waveStore.selected].input(buffers[buffers.length-1],powerLevel,sampleRate);
    //       }
    //   });

    //   _this.dialogInt=setTimeout(function(){//定时8秒后打开弹窗，用于监测浏览器没有发起权限请求的情况
    //       _this.showDialog();
    //   },8000);

    //   rec.open(function(){
    //       _this.dialogCancel();
    //       // _this.reclog("已打开:"+_this.type+" "+_this.sampleRate+"hz "+_this.bitRate+"kbps",2);

    //       _this.initWaveStore(".recwave");
    //       // rec.start();
    //       _this.hasInitSuccess = true
    //       // _this.isRecing = true
    //   },function(msg,isUserNotAllow){
    //       _this.dialogCancel();
    //       isUserNotAllow && _this.$message.error('启动录音失败，用户拒绝了授权')
    //       // _this.reclog((isUserNotAllow?"UserNotAllow，":"")+"打开失败："+msg,1);
    //   });

    //   _this.waitDialogClickFn=function(){
    //       _this.dialogCancel();
    //       _this.$message.error('启动录音失败，用户忽略了权限请求')
    //       // _this.reclog("打开失败：权限请求被忽略，用户主动点击的弹窗",1);
    //   };
    // }
  },
  methods: {
    changeDuration() {
      this.$nextTick(() => {
        this.playDuration = this.timeFormat(this.$refs.recordAudio.duration);
        this.totalDuration = this.$refs.recordAudio.duration;
      });
    },
    //将单位为秒的的时间转换成mm:ss的形式
    timeFormat(num) {
      let minute = parseInt(num / 60);
      let second = parseInt(num % 60);
      minute = minute >= 10 ? minute : `0${minute}`;
      second = second >= 10 ? second : `0${second}`;
      return `${minute}:${second}`;
    },
    resetRecorder() {
      let audio = this.$refs.recordAudio;
      if (!audio.paused) {
        audio.pause();
      }
      this.recBolb = null;
      this.isPlay = false;
      this.isRecing = false;
      this.playTime = 0;
      this.playDuration = '00:00';
      this.playCurrentTime = '00:00';
      this.totalDuration = 0;
      this.recDuration = 0;
      this.recordDataUrl = '';
      this.lastAudioStamp = null;
      this.lastPlayStamp = null;
    },
    setRecedDuration(ms) {
      this.playDuration = this.timeFormat(ms / 1000);
      this.totalDuration = ms / 1000;
    },
    initWaveStore(elem) {
      this.waveStore.WaveView = recorder_mp3_min.WaveView({
        elem: elem,
        width: 300,
        height: 100
      });
      this.waveStore.Histogram2 = recorder_mp3_min.FrequencyHistogramView({
        elem: elem,
        lineCount: 30,
        position: 0,
        minHeight: 12,
        mirrorEnable: true,
        stripeEnable: false,
        linear: [0, '#8FC1FD', 1, '#8FC1FD'],
        width: 300,
        height: 100
      });
      this.waveStore.Histogram3 = recorder_mp3_min.FrequencyHistogramView({
        elem: elem,
        lineCount: 20,
        position: 0,
        minHeight: 1,
        fallDuration: 400,
        stripeEnable: false,
        mirrorEnable: true,
        linear: [0, '#0ac', 1, '#0ac'],
        width: 300,
        height: 100
      });
    },
    toggleRec() {
      let _this = this;
      // if(!this.hasInitSuccess) {
      //   this.$message.warning('当前浏览器不支持或用户未进行授权，组件功能暂无法使用')
      //   return
      // }
      let waveBoxSelector = '#' + _this.waveBoxKey;
      if (!this.recBolb && !this.isRecing) {
        // _this.rec.start();
        // _this.isRecing = true
        if (recorder_mp3_min.IsOpen()) {
          _this.$message.warning('当前存在进行中的录制任务');
          return;
        }
        let rec = this.rec = recorder_mp3_min({
          type: _this.type,
          bitRate: _this.bitRate,
          sampleRate: _this.sampleRate,
          onProcess: function (buffers, powerLevel, duration, sampleRate) {
            _this.recDuration = duration;
            _this.powerLevel = powerLevel;
            // _this.wave.input(buffers[buffers.length-1],powerLevel,sampleRate);
            //可视化图形绘制
            jquery(waveBoxSelector).html('').append(_this.waveStore[_this.waveStore.selected].elem);
            _this.waveStore[_this.waveStore.selected].input(buffers[buffers.length - 1], powerLevel, sampleRate);
          }
        });
        _this.dialogInt = setTimeout(function () {
          //定时8秒后打开弹窗，用于监测浏览器没有发起权限请求的情况
          _this.showDialog();
        }, 15000);
        rec.open(function () {
          _this.dialogCancel();
          // _this.reclog("已打开:"+_this.type+" "+_this.sampleRate+"hz "+_this.bitRate+"kbps",2);
          console.log(waveBoxSelector);
          // _this.wave=Recorder.WaveView({elem:".ctrlProcessWave"});
          _this.initWaveStore(waveBoxSelector);
          rec.start();
          _this.isRecing = true;
          _this.recTimestamp = new Date().getTime();
        }, function (msg, isUserNotAllow) {
          _this.dialogCancel();
          console.log('启动录音错误信息', msg);
          let errMsg = '启动录音失败，当前浏览器不支持';
          if (isUserNotAllow) {
            errMsg = '启动录音失败，用户拒绝了授权';
          }
          if (msg.includes('麦克风')) {
            errMsg = '启动录音失败，无可用 MIC 设备';
          }
          _this.$message.error(errMsg);
          // _this.reclog((isUserNotAllow?"UserNotAllow，":"")+"打开失败："+msg,1);
        });
        _this.waitDialogClickFn = function () {
          _this.dialogCancel();
          _this.$message.error('启动录音失败，用户忽略了权限请求');
          // _this.reclog("打开失败：权限请求被忽略，用户主动点击的弹窗",1);
        };
        // _this.$nextTick(() => {
        //   if(!Recorder.IsOpen()){
        //     _this.$message.error('未获取录音权限')
        //     // this.reclog("未打开录音",1);
        //     return;
        //   }
        //   console.log('当前录音实例配置',_this.rec.set);
        //   rec.start();
        // })
      } else {
        if (!(_this.rec && recorder_mp3_min.IsOpen())) {
          _this.$message.error('录音未启动');
          return;
        }
        let doneTimestamp = new Date().getTime();
        if (!_this.recTimestamp || doneTimestamp - _this.recTimestamp < 5000) {
          _this.$message.warning('至少录制 5s 方可进行保存，请稍候');
          return;
        }
        let rec = _this.rec;
        rec.stop(function (blob, duration) {
          _this.$message.success('录制完成');
          _this.setAudioPath(blob, duration);
          jquery(waveBoxSelector).html('');
          _this.$emit('resData', {
            blob: blob,
            duration: duration
          });
        }, function (msg) {
          _this.recTimestamp = null;
          _this.$message.error(`录音失败：${msg}`);
        }, true); //录音结束时自动调用rec.close方法丢弃所有数据
      }
    },
    // 销毁录音实例
    destruction() {
      this.rec.close();
      this.isRecing = false;
      let waveBoxSelector = '#' + this.waveBoxKey;
      jquery(waveBoxSelector).html('');
    },
    setAudioPath(blob, duration) {
      this.recDuration = duration;
      this.setRecedDuration(duration);
      this.$nextTick(() => {
        this.recBolb = blob;
        this.isRecing = false;
        this.lastAudioStamp = new Date().getTime();
        this.recTimestamp = null;
      });
    },
    play() {
      if (!this.recBolb) {
        this.toggleRec();
      } else {
        // if (this.playStyle === 'yuan-wen') {
        //   this.doPlay()
        // }
        // if (this.playStyle === 'tan-chuang') {
        //   this.$emit('showDialog', { url: this.url, title: this.title, coverFileUrl: this.coverImageUrl, content: this.content, playerIndex: this.playerIndex })
        // }
        this.togglePlay();
      }
    },
    togglePlay() {
      let _this = this;
      let audios = document.querySelectorAll('audio');
      audios.forEach(i => i.pause());
      let video = document.querySelectorAll('video');
      if (video && video.length) {
        video.forEach(i => i.pause());
      }
      let audio = this.$refs.recordAudio;
      if (this.isPlay) {
        !(audio.ended || audio.paused) && audio.pause();
      } else {
        if (!this.lastPlayStamp || this.lastPlayStamp !== this.lastAudioStamp) {
          audio.onerror = function (e) {
            _this.$message.error(audio.error.message);
          };
          audio.currentTime = 0;
          audio.src = typeof _this.recBolb == 'object' ? (window.URL || webkitURL).createObjectURL(_this.recBolb) : _this.recBolb;
          audio.play();
          this.lastPlayStamp = this.lastAudioStamp;
        } else {
          audio.paused && audio.play();
        }
      }
      this.isPlay = !this.isPlay;
    },
    doPlay() {
      let _this = this;
      let rec = this.rec;
      let audio = this.$refs.LogAudioPlayer;
      audio.controls = true;
      if (!(audio.ended || audio.paused)) {
        audio.pause();
      }
      audio.onerror = function (e) {
        _this.$message.error(audio.error.message);
      };
      audio.src = (window.URL || webkitURL).createObjectURL(rec.blob);
      audio.play();
      // console.log('暂停')
      // let audio = document.querySelectorAll('audio')
      // audio.forEach((i) => i.pause())
      // let video = document.querySelectorAll('video')
      // if (video && video.length) {
      //   video.forEach((i) => i.pause())
      // }

      // this.isPlay ? this.$refs.recordAudio.pause() : this.$refs.recordAudio.play()
      // this.isPlay = !this.isPlay
      // let timeStamp = new Date().getTime()
      // this.lastOperateTimeStamp = timeStamp
      // let playStamp = `${this.url}__playTimeStamp__${timeStamp}`
      // // !this.isPlay && this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // // this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // sessionStorage.setItem('SET_PLAY_STATE', playStamp) //存储
    },
    updateTime(e) {
      this.playTime = this.$refs.recordAudio.currentTime;
      this.playCurrentTime = this.timeFormat(this.$refs.recordAudio.currentTime);
      if (!this.loop && this.playTime >= this.totalDuration) {
        this.isPlay = false;
      }
      // this.$emit('timeUpdate', {event:e, time: this.$refs.recordAudio.currentTime })
    },
    changeTime(val) {
      this.$refs.recordAudio.currentTime = val;
    },
    showDialog: function () {
      //选择性的弹一个对话框：为了防止移动端浏览器存在第三种情况：用户忽略，并且（或者国产系统UC系）浏览器没有任何回调
      if (!/mobile/i.test(navigator.userAgent)) {
        return; //只在移动端开启没有权限请求的检测
      }
      this.permissionDialogVisible = true;
    },
    dialogCancel: function () {
      clearTimeout(this.dialogInt);
      this.permissionDialogVisible = false;
    },
    waitDialogClick: function () {
      this.dialogCancel();
      this.waitDialogClickFn();
    }
  }
};

/* script */
const __vue_script__$67 = script$67;

/* template */
var __vue_render__$66 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { class: ["xml-audio-player", _vm.mode] },
    [
      _vm.recBolb
        ? _c("div", { staticClass: "play-mode-wrap" }, [
            _c("img", {
              staticClass: "play-control-image",
              attrs: { src: _vm.playModeIconSrc },
              on: {
                click: function ($event) {
                  _vm.$refs.recordAudio.currentTime = 0;
                },
              },
            }),
            _vm._v(" "),
            _c("img", {
              staticClass: "play-control-image",
              attrs: { src: _vm.recDelete },
              on: { click: _vm.resetRecorder },
            }),
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.styleMode !== "C"
        ? _c("div", { staticClass: "audio-cover" }, [
            _vm.styleMode === "A"
              ? _c("div", { staticClass: "play-button style-a" }, [
                  _c("img", {
                    staticClass: "button-image",
                    attrs: {
                      src: _vm.recBolb
                        ? _vm.isPlay
                          ? _vm.pauseIcon
                          : _vm.playIcon
                        : _vm.isRecing
                        ? _vm.recStopIcon
                        : _vm.recStartIcon,
                    },
                    on: {
                      click: function ($event) {
                        $event.stopPropagation();
                        return _vm.play.apply(null, arguments)
                      },
                    },
                  }),
                ])
              : _vm._e(),
            _vm._v(" "),
            _vm.controlStatusText
              ? _c("div", { staticClass: "play-text" }, [
                  _vm._v(_vm._s(_vm.controlStatusText)),
                ])
              : _vm._e(),
          ])
        : _vm._e(),
      _vm._v(" "),
      !_vm.recBolb
        ? _c("div", { staticClass: "record-player-control" }, [
            !_vm.recBolb
              ? _c("div", {
                  staticClass: "recwave",
                  staticStyle: { height: "80px", width: "100%" },
                  attrs: { id: _vm.waveBoxKey },
                })
              : _vm._e(),
            _vm._v(" "),
            !_vm.isRecing
              ? _c("div", { staticClass: "mock-wave" }, [
                  _c("img", {
                    staticClass: "button-image",
                    attrs: { src: _vm.recMockWave },
                  }),
                ])
              : _vm._e(),
          ])
        : _c("div", { staticClass: "audio-player-control" }, [
            _c("div", { staticClass: "audio-controls" }, [
              _vm.styleMode !== "A"
                ? _c(
                    "div",
                    { staticClass: "audio-controls__play-button-wrapper" },
                    [
                      _c("div", { staticClass: "play-button" }, [
                        _c("img", {
                          staticClass: "button-image",
                          attrs: {
                            src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon,
                          },
                          on: {
                            click: function ($event) {
                              $event.stopPropagation();
                              return _vm.play.apply(null, arguments)
                            },
                          },
                        }),
                      ]),
                    ]
                  )
                : _vm._e(),
              _vm._v(" "),
              _c("div", { staticClass: "audio-controls__handler" }, [
                _c(
                  "div",
                  { staticClass: "progress" },
                  [
                    _c("el-slider", {
                      attrs: {
                        max: _vm.totalDuration,
                        disabled: _vm.scheduleControl !== "yes",
                        "show-tooltip": false,
                      },
                      on: { change: _vm.changeTime },
                      model: {
                        value: _vm.playTime,
                        callback: function ($$v) {
                          _vm.playTime = $$v;
                        },
                        expression: "playTime",
                      },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c("div", { staticClass: "play-times" }, [
                  _c("div", { staticClass: "current-time" }, [
                    _vm._v(_vm._s(_vm.playCurrentTime)),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "total-time" }, [
                    _vm._v(_vm._s(_vm.playDuration)),
                  ]),
                ]),
              ]),
            ]),
          ]),
      _vm._v(" "),
      _c("audio", {
        ref: "recordAudio",
        staticClass: "audio-component",
        attrs: {
          controls: "",
          preload: "auto",
          src: _vm.recordDataUrl,
          loop: _vm.loop,
          link: _vm.link,
        },
        on: {
          canplay: _vm.changeDuration,
          timeupdate: _vm.updateTime,
          pause: function ($event) {
            _vm.isPlay = false;
          },
        },
      }),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          attrs: {
            title: "权限请求提醒",
            width: "320px",
            visible: _vm.permissionDialogVisible,
            "custom-class": "info-dialog",
            "append-to-body": "",
          },
          on: {
            "update:visible": function ($event) {
              _vm.permissionDialogVisible = $event;
            },
          },
        },
        [
          _c("div", [
            _c("p", { staticClass: "version-number" }, [
              _vm._v(
                "录音功能需要麦克风权限，请允许；如果未看到任何请求，请点击忽略"
              ),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticStyle: { "text-align": "right" } },
              [
                _c(
                  "el-button",
                  { attrs: { plain: "" }, on: { click: _vm.waitDialogClick } },
                  [_vm._v("忽略")]
                ),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$66 = [];
__vue_render__$66._withStripped = true;

  /* style */
  const __vue_inject_styles__$67 = undefined;
  /* scoped */
  const __vue_scope_id__$67 = undefined;
  /* module identifier */
  const __vue_module_identifier__$67 = undefined;
  /* functional template */
  const __vue_is_functional_template__$67 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$67 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$66, staticRenderFns: __vue_staticRenderFns__$66 },
    __vue_inject_styles__$67,
    __vue_script__$67,
    __vue_scope_id__$67,
    __vue_is_functional_template__$67,
    __vue_module_identifier__$67,
    false,
    undefined,
    undefined,
    undefined
  );

//
const _image = '.jpg,.png,.jpeg,.gif,';
const _audio = '.mp3,';
const _video = '.mp4,.MP4';
const _resources = 'application/x-zip-compressed,.zip,';
const _office = '.ppt,.xlsx,.xls,.doc,.docx,.pptx';
var script$66 = {
  components: {
    RecordPlayer: __vue_component__$67
  },
  name: 'addFile',
  props: {
    actionUrl: {
      type: String,
      default: ''
    },
    headers: {
      type: Object,
      default: () => {}
    },
    data: {
      // 上传文件附带的额外参数
      type: Object,
      default: () => {}
    },
    fileSize: {
      // 最大上传文件大小
      type: Number,
      default: 10
    }
  },
  data() {
    return {
      Accept: _image + _audio + _video + _resources + _office,
      fileRules: {
        resourcesName: [{
          required: true,
          message: '请输入资源名称',
          trigger: 'blur'
        }, {
          min: 2,
          max: 50,
          message: '长度在 2 到 50 个字符',
          trigger: 'blur'
        }],
        isDownload: [{
          required: true,
          message: '请选择是否允许下载',
          trigger: 'change'
        }],
        fileUrl: [{
          required: true,
          message: '请上传资源文件',
          trigger: 'change'
        }],
        isStudentShow: [{
          required: true,
          message: '请选择是否对学生可见',
          trigger: 'change'
        }]
      },
      recordedRules: {
        isStudentShow: [{
          required: true,
          message: '请选择是否对学生可见',
          trigger: 'change'
        }]
      },
      noteRules: {
        noteContent: [{
          required: true,
          message: '请输入笔记内容',
          trigger: 'blur'
        }, {
          min: 2,
          max: 1000,
          message: '长度在 2 到 1000 个字符',
          trigger: 'blur'
        }],
        isStudentShow: [{
          required: true,
          message: '请选择是否对学生可见',
          trigger: 'change'
        }]
      },
      fileList: [
        // {
        //   name: 'food.jpeg',
        //   url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
        // },
        // {
        //   name: 'food2.jpeg',
        //   // url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
        //   url:'../../../static/images/defaultCover/audio.png'
        // }
      ],
      fileData: {
        resourcesName: '',
        noteContent: '',
        isDownload: [0],
        fileUrl: '',
        id: '',
        resourcesType: '',
        fileExt: '',
        creationTime: '',
        textBookId: '',
        chapterId: '',
        orderNum: '',
        firstLevelId: '',
        firstLevelLabel: '',
        locationChapterId: '',
        isStudentShow: [0],
        location: '',
        duration: 0
      },
      recordedData: {
        resourcesName: '',
        noteContent: '',
        isDownload: [0],
        fileUrl: '',
        id: '',
        resourcesType: '',
        fileExt: '',
        creationTime: '',
        textBookId: '',
        chapterId: '',
        orderNum: '',
        firstLevelId: '',
        firstLevelLabel: '',
        locationChapterId: '',
        isStudentShow: [0],
        location: '',
        duration: 0
      },
      noteData: {
        resourcesName: '',
        noteContent: '',
        isDownload: [0],
        fileUrl: '',
        id: '',
        resourcesType: '',
        fileExt: '',
        creationTime: '',
        textBookId: '',
        chapterId: '',
        orderNum: '',
        firstLevelId: '',
        firstLevelLabel: '',
        locationChapterId: '',
        isStudentShow: [0],
        location: '',
        duration: 0
      },
      dialogImageUrl: '',
      dialogVisible: false,
      disabled: false,
      show: false,
      isEdit: false,
      chapterOrderNum: 1,
      isSwhoUpload: false,
      activeName: 'resource',
      recordedBlob: null,
      loadingInstance: null,
      limit: 1
    };
  },
  methods: {
    open(e) {
      console.log('e', e);
      this.show = true;
      this.recordedBlob = null;
      let fileData = e;
      // fileData.textBookId = e.textBookId
      // fileData.creationTime = e.creationTime
      // fileData.resourcesName = e.resourcesName
      // fileData.noteContent = e.noteContent
      fileData.isDownload = [e.isDownload];
      fileData.isStudentShow = [e.isStudentShow];
      // fileData.id = e.id
      // fileData.resourcesType = e.resourcesType
      // fileData.fileExt = e.fileExt
      // fileData.fileUrl = e.fileUrl
      // fileData.location = e.location
      // fileData.chapterId = e.chapterId
      // fileData.orderNum = e.orderNum
      // fileData.firstLevelId = e.firstLevelId
      // fileData.firstLevelLabel = e.firstLevelLabel
      // fileData.chapterOrderNum = e.chapterOrderNum
      // fileData.locationChapterId = e.locationChapterId
      // fileData.duration = e.duration
      this.isEdit = e.isEdit ? true : false;
      if (!this.isEdit) {
        fileData.id = new Date().getTime();
        fileData.creationTime = new Date();
        fileData.duration = 0;
        fileData.noteContent = '';
      } else {
        if (e.resourcesType == 'recorded') {
          this.activeName = 'recorded';
          this.$nextTick(() => {
            this.$refs.xmlRecordPlayer.setAudioPath(fileData.fileUrl, fileData.duration);
          });
        } else if (e.resourcesType == 'notes') {
          this.activeName = 'notes';
        } else {
          this.activeName = 'resource';
        }
        this.getFileList();
      }
      this.fileData = JSON.parse(JSON.stringify(fileData));
      this.recordedData = JSON.parse(JSON.stringify(fileData));
      this.noteData = JSON.parse(JSON.stringify(fileData));
    },
    setSingleCheckedValue(e, item, value) {
      item.isDownload = [value];
    },
    setSingleCheckedShowValue(e, item, value) {
      item.isStudentShow = [value];
      if (value == 1) {
        // 不显示添加资源
        console.log('不显示添加资源');
      }
    },
    //
    handleBeforeUpload(file) {
      const isPass = file.size / 1024 / 1024 > this.fileSize;
      if (isPass) {
        this.$message.error(`上传文件大小不能超过 ${this.fileSize}MB!`);
        return false;
      }
      let fileType = '';
      let fileExt = file.name.slice(file.name.lastIndexOf('.') + 1).toLowerCase();
      console.log(fileExt);
      if (this.Accept.indexOf('.' + fileExt) === -1) {
        this.$message.error('请上传指定类型文件');
        return false;
      }
      this.loadingInstance = this.$loading({
        lock: true,
        text: 'Loading',
        background: 'rgba(0, 0, 0, 0)'
      });
      this.fileData.resourcesName = file.name;
      if (_image.indexOf(fileExt) !== -1) {
        fileType = 'image';
      } else if (_audio.indexOf(fileExt) !== -1) {
        fileType = 'audio';
      } else if (_video.indexOf(fileExt) !== -1) {
        fileType = 'video';
      } else if (_resources.indexOf(fileExt) !== -1) {
        fileType = 'resources';
      } else if (_office.indexOf(fileExt) !== -1) {
        fileType = 'office';
      }
      this.fileData.resourcesType = fileType;
      this.fileData.fileExt = fileExt;
      this.fileData.resourcesName = this.fileData.resourcesName.length > 50 ? this.fileData.resourcesName.slice(0, 50) : this.fileData.resourcesName;
    },
    // 上传成功
    handleSuccess(file, item) {
      item.fileUrl = file.data;
      this.getFileList();
      this.loadingInstance.close();
      console.log(item, 'item'); //有值
      console.log(this.fileData, 'this.fileData1111'); //有值
    },
    getFileList() {
      console.log(this.fileData, 'fileData'); //有值 再次编辑就无值，因为触发了close
      this.fileList = [{
        name: this.fileData.resourcesName,
        url: this.fileData.resourcesType == 'image' ? this.fileData.fileUrl : 'data:image/png;base64,[encoded data, 24528 characters]'
      }];
      this.fileList.length > 0 ? this.isSwhoUpload = true : this.isSwhoUpload = false;
    },
    handleRemove(file) {
      this.fileData.fileUrl = '';
      this.fileList = [];
      this.fileList.length > 0 ? this.isSwhoUpload = true : this.isSwhoUpload = false;
      console.log(file);
    },
    handlePictureCardPreview(file) {
      this.fileData.fileUrl = file.url;
      this.dialogVisible = true;
    },
    handleDownload(file) {
      console.log(file);
    },
    submit(type) {
      // if(this.activeName == 'resource' && !this.fileData.fileUrl){
      //   this.$message.error('请上传文件')
      //   return
      // }
      this.$refs[this.activeName + 'RuleForm'].validate(valid => {
        if (valid) {
          if (this.activeName == 'resource') {
            if (!this.fileData.fileUrl) {
              this.$message.warning("请上传资源文件");
            }
            // 添加资源文件
            let fileData = JSON.parse(JSON.stringify(this.fileData)) || {};
            let data = {
              chapterOrderNum: this.chapterOrderNum,
              ...fileData
            };
            data.isDownload = this.fileData.isDownload[0];
            data.isStudentShow = this.fileData.isStudentShow[0];
            // 发送数据
            if (!this.isEdit) {
              this.$emit('addResources', data);
            } else {
              this.$emit('editResources', data);
            }
            setTimeout(() => {
              this.close();
              this.show = false;
            }, 200);
          } else if (this.activeName == 'recorded') {
            // 录音
            if (this.recordedData.duration < 100) {
              this.$message.error('请先录制音频');
              return;
            }
            if (this.recordedBlob) {
              this.addRecorder();
            } else {
              let recordedData = JSON.parse(JSON.stringify(this.recordedData)) || {};
              let data = {
                chapterOrderNum: this.chapterOrderNum,
                ...recordedData
              };
              data.isDownload = this.recordedData.isDownload[0];
              data.isStudentShow = this.recordedData.isStudentShow[0];
              data.resourcesType = 'recorded';
              // 发送数据
              if (!this.isEdit) {
                this.$emit('addResources', data);
              } else {
                this.$emit('editResources', data);
              }
              setTimeout(() => {
                this.close();
                this.show = false;
              }, 800);
            }
          } else if (this.activeName == 'notes') {
            // 教师笔记
            let noteData = JSON.parse(JSON.stringify(this.noteData)) || {};
            let data = {
              chapterOrderNum: this.chapterOrderNum,
              ...noteData
            };
            data.isDownload = this.noteData.isDownload[0];
            data.isStudentShow = this.noteData.isStudentShow[0];
            data.resourcesType = 'notes';
            // 发送数据
            if (!this.isEdit) {
              this.$emit('addTeacherNote', data);
            } else {
              this.$emit('editResources', data);
            }
            setTimeout(() => {
              this.close();
              this.show = false;
            }, 200);
          }

          // if (type === 'continue') {
          //   // 若是点击“保存并继续添加”
          //   // 提示保存成功
          //   this.$message({
          //     message: '保存成功',
          //     type: 'success',
          //     duration: 1500
          //   })

          //   // 清空表单
          //   this.$refs[this.activeName + 'RuleForm'].resetFields()
          //   this.fileData.fileUrl = ''
          //   this.fileList = []
          //   this.isSwhoUpload = false

          //   // 不关闭弹窗
          //   this.show = true
          // } else {
          //   setTimeout(() => {
          //     this.close()
          //     this.show = false
          //   }, 200)
          // }
        }
      });
    },
    close() {
      this.fileData.resourcesName = '';
      this.fileData.isDownload = [0];
      if (this.fileData.resourcesType !== 'image') {
        this.fileData.fileUrl = '';
      }
      this.fileList = [];
      this.show = false;
      // 等待200毫秒，显示添加文件按钮
      setTimeout(() => this.isSwhoUpload = false, 200);
      if (this.activeName == 'recorded') {
        this.$refs.xmlRecordPlayer.destruction();
        this.$refs.xmlRecordPlayer.resetRecorder();
      }
    },
    getresdata({
      blob,
      duration
    }) {
      this.recordedData.duration = duration;
      this.recordedBlob = blob;
    },
    addRecorder() {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        background: 'rgba(0, 0, 0, 0)'
      });
      let formData = new FormData();
      formData.append('file', this.recordedBlob, new Date().getTime() + '.mp3');
      for (let key in this.data) {
        formData.append(key, this.data[key]);
      }
      fetch(this.actionUrl, {
        method: 'post',
        body: formData,
        headers: this.headers
      }).then(data => {
        return data.text();
      }).then(res => {
        let urlData = JSON.parse(res);
        this.recordedData.fileUrl = urlData.data;
        let recordedData = JSON.parse(JSON.stringify(this.recordedData)) || {};
        let data = {
          chapterOrderNum: this.chapterOrderNum,
          ...recordedData
        };
        data.isDownload = this.recordedData.isDownload[0];
        data.isStudentShow = this.recordedData.isStudentShow[0];
        data.resourcesType = 'recorded';
        // 发送数据
        if (!this.isEdit) {
          this.$emit('addResources', data);
        } else {
          this.$emit('editResources', data);
        }
        setTimeout(() => {
          loading.close();
          this.close();
          this.show = false;
        }, 800);
      }).catch(() => {
        loading.close();
        this.close();
        this.show = false;
      });
    },
    carriageReturn(event) {
      event.preventDefault(); // 更推荐使用preventDefault来阻止默认行为，适用于现代浏览器
      if (event.keyCode === 13 || event.key === 'Enter' || event.code === 'Enter') {
        this.noteData.noteContent += '\n';
      }
    }
  },
  computed: {
    currentLength() {
      return this.noteData.noteContent.length;
    },
    maxLength() {
      return 1000;
    }
  },
  created() {},
  mounted() {}
};

/* script */
const __vue_script__$66 = script$66;
/* template */
var __vue_render__$65 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      staticClass: "add-teacher-resources-dialog",
      attrs: { "append-to-body": "", visible: _vm.show, width: "665px" },
      on: {
        "update:visible": function ($event) {
          _vm.show = $event;
        },
        close: _vm.close,
      },
    },
    [
      _c("div", { attrs: { slot: "title" }, slot: "title" }, [
        _vm._v(_vm._s(_vm.isEdit ? "编辑" : "添加") + "授课资源"),
      ]),
      _vm._v(" "),
      _c(
        "div",
        [
          _c(
            "el-tabs",
            {
              model: {
                value: _vm.activeName,
                callback: function ($$v) {
                  _vm.activeName = $$v;
                },
                expression: "activeName",
              },
            },
            [
              _c(
                "el-tab-pane",
                {
                  attrs: {
                    disabled: _vm.isEdit,
                    label: "资源上传",
                    name: "resource",
                  },
                },
                [
                  _c(
                    "div",
                    { staticClass: "add-teacher-container" },
                    [
                      _c(
                        "el-form",
                        {
                          ref: "resourceRuleForm",
                          attrs: {
                            "label-position": "left",
                            model: _vm.fileData,
                            rules: _vm.fileRules,
                          },
                        },
                        [
                          _c(
                            "el-form-item",
                            {
                              staticClass: "resouceName addOne",
                              attrs: {
                                "label-width": "96px",
                                label: "资源名称：",
                                prop: "resourcesName",
                              },
                            },
                            [
                              _c("el-input", {
                                staticClass: "inputresource",
                                attrs: { maxlength: "50" },
                                model: {
                                  value: _vm.fileData.resourcesName,
                                  callback: function ($$v) {
                                    _vm.$set(
                                      _vm.fileData,
                                      "resourcesName",
                                      typeof $$v === "string" ? $$v.trim() : $$v
                                    );
                                  },
                                  expression: "fileData.resourcesName",
                                },
                              }),
                            ],
                            1
                          ),
                          _vm._v(" "),
                          _c(
                            "el-form-item",
                            {
                              attrs: {
                                "label-width": "96px",
                                label: "下载设置：",
                                prop: "isDownload",
                              },
                            },
                            [
                              _c(
                                "el-checkbox-group",
                                {
                                  model: {
                                    value: _vm.fileData.isDownload,
                                    callback: function ($$v) {
                                      _vm.$set(_vm.fileData, "isDownload", $$v);
                                    },
                                    expression: "fileData.isDownload",
                                  },
                                },
                                [
                                  _c(
                                    "el-checkbox",
                                    {
                                      attrs: { label: 1 },
                                      on: {
                                        change: function (v) {
                                          return _vm.setSingleCheckedValue(
                                            v,
                                            _vm.fileData,
                                            1
                                          )
                                        },
                                      },
                                    },
                                    [_vm._v("允许学生下载")]
                                  ),
                                  _vm._v(" "),
                                  _c(
                                    "el-checkbox",
                                    {
                                      attrs: { label: 0 },
                                      on: {
                                        change: function (v) {
                                          return _vm.setSingleCheckedValue(
                                            v,
                                            _vm.fileData,
                                            0
                                          )
                                        },
                                      },
                                    },
                                    [_vm._v("不允许学生下载")]
                                  ),
                                ],
                                1
                              ),
                            ],
                            1
                          ),
                          _vm._v(" "),
                          _c(
                            "el-form-item",
                            {
                              attrs: {
                                "label-width": "96px",
                                label: "显示设置：",
                                prop: "isStudentShow",
                              },
                            },
                            [
                              _c(
                                "el-checkbox-group",
                                {
                                  model: {
                                    value: _vm.fileData.isStudentShow,
                                    callback: function ($$v) {
                                      _vm.$set(
                                        _vm.fileData,
                                        "isStudentShow",
                                        $$v
                                      );
                                    },
                                    expression: "fileData.isStudentShow",
                                  },
                                },
                                [
                                  _c(
                                    "el-checkbox",
                                    {
                                      attrs: { label: 0 },
                                      on: {
                                        change: function (v) {
                                          return _vm.setSingleCheckedShowValue(
                                            v,
                                            _vm.fileData,
                                            0
                                          )
                                        },
                                      },
                                    },
                                    [_vm._v("学生可见")]
                                  ),
                                  _vm._v(" "),
                                  _c(
                                    "el-checkbox",
                                    {
                                      attrs: { label: 1 },
                                      on: {
                                        change: function (v) {
                                          return _vm.setSingleCheckedShowValue(
                                            v,
                                            _vm.fileData,
                                            1
                                          )
                                        },
                                      },
                                    },
                                    [_vm._v("学生不可见")]
                                  ),
                                ],
                                1
                              ),
                            ],
                            1
                          ),
                          _vm._v(" "),
                          _c(
                            "el-form-item",
                            { attrs: { label: "文件上传：", prop: "fileUrl" } },
                            [
                              _c(
                                "el-upload",
                                {
                                  staticClass: "upload-demo",
                                  class: _vm.isSwhoUpload ? "disUoloadSty" : "",
                                  attrs: {
                                    action: _vm.actionUrl,
                                    headers: _vm.headers,
                                    data: _vm.data,
                                    "list-type": "picture-card",
                                    multiple: false,
                                    limit: _vm.limit,
                                    "file-list": _vm.fileList,
                                    playMode: "xun-huan",
                                    scheduleControl: "yes",
                                    accept: _vm.Accept,
                                    "on-success": function (e) {
                                      return _vm.handleSuccess(e, _vm.fileData)
                                    },
                                    "before-upload": _vm.handleBeforeUpload,
                                    "on-remove": _vm.handleRemove,
                                  },
                                },
                                [
                                  _c("i", {
                                    staticClass: "el-icon-plus",
                                    attrs: { slot: "default" },
                                    slot: "default",
                                  }),
                                ]
                              ),
                            ],
                            1
                          ),
                        ],
                        1
                      ),
                    ],
                    1
                  ),
                ]
              ),
              _vm._v(" "),
              _c(
                "el-tab-pane",
                {
                  attrs: {
                    disabled: _vm.isEdit,
                    label: "录音",
                    name: "recorded",
                  },
                },
                [
                  _c(
                    "div",
                    { staticClass: "add-teacher-container" },
                    [
                      _c(
                        "el-form",
                        {
                          ref: "recordedRuleForm",
                          attrs: {
                            "label-position": "left",
                            model: _vm.recordedData,
                            rules: _vm.recordedRules,
                          },
                        },
                        [
                          _c("el-form-item", [
                            _c(
                              "div",
                              {
                                staticClass:
                                  "parent-group xml-single-recorder-group",
                              },
                              [
                                _c(
                                  "div",
                                  { staticClass: "xml-recorder-container" },
                                  [
                                    _c(
                                      "div",
                                      {
                                        staticClass: "xml-recorder-player-box",
                                      },
                                      [
                                        _c("record-player", {
                                          ref: "xmlRecordPlayer",
                                          attrs: {
                                            mode: "preview",
                                            loop: false,
                                            "play-mode": "xun-huan",
                                            "play-style": "A",
                                            scheduleControl: "yes",
                                          },
                                          on: { resData: _vm.getresdata },
                                        }),
                                      ],
                                      1
                                    ),
                                  ]
                                ),
                              ]
                            ),
                          ]),
                          _vm._v(" "),
                          _c(
                            "el-form-item",
                            {
                              attrs: {
                                "label-width": "96px",
                                label: "显示设置：",
                                prop: "isStudentShow",
                              },
                            },
                            [
                              _c(
                                "el-checkbox-group",
                                {
                                  model: {
                                    value: _vm.recordedData.isStudentShow,
                                    callback: function ($$v) {
                                      _vm.$set(
                                        _vm.recordedData,
                                        "isStudentShow",
                                        $$v
                                      );
                                    },
                                    expression: "recordedData.isStudentShow",
                                  },
                                },
                                [
                                  _c(
                                    "el-checkbox",
                                    {
                                      attrs: { label: 0 },
                                      on: {
                                        change: function (v) {
                                          return _vm.setSingleCheckedShowValue(
                                            v,
                                            _vm.recordedData,
                                            0
                                          )
                                        },
                                      },
                                    },
                                    [_vm._v("学生可见")]
                                  ),
                                  _vm._v(" "),
                                  _c(
                                    "el-checkbox",
                                    {
                                      attrs: { label: 1 },
                                      on: {
                                        change: function (v) {
                                          return _vm.setSingleCheckedShowValue(
                                            v,
                                            _vm.recordedData,
                                            1
                                          )
                                        },
                                      },
                                    },
                                    [_vm._v("学生不可见")]
                                  ),
                                ],
                                1
                              ),
                            ],
                            1
                          ),
                        ],
                        1
                      ),
                    ],
                    1
                  ),
                ]
              ),
              _vm._v(" "),
              _c(
                "el-tab-pane",
                {
                  attrs: {
                    disabled: _vm.isEdit,
                    label: "教师笔记",
                    name: "notes",
                  },
                },
                [
                  _c(
                    "div",
                    { staticClass: "add-teacher-container" },
                    [
                      _c(
                        "el-form",
                        {
                          ref: "notesRuleForm",
                          attrs: {
                            "label-position": "left",
                            model: _vm.noteData,
                            rules: _vm.noteRules,
                          },
                        },
                        [
                          _c(
                            "el-form-item",
                            {
                              attrs: { label: "笔记内容", prop: "noteContent" },
                            },
                            [
                              _c("el-input", {
                                attrs: {
                                  type: "textarea",
                                  rows: 6,
                                  placeholder: "请输入内容",
                                  maxlength: "1000",
                                },
                                nativeOn: {
                                  keydown: function ($event) {
                                    if (
                                      !$event.type.indexOf("key") &&
                                      _vm._k(
                                        $event.keyCode,
                                        "enter",
                                        13,
                                        $event.key,
                                        "Enter"
                                      )
                                    ) {
                                      return null
                                    }
                                    return _vm.carriageReturn($event)
                                  },
                                },
                                model: {
                                  value: _vm.noteData.noteContent,
                                  callback: function ($$v) {
                                    _vm.$set(
                                      _vm.noteData,
                                      "noteContent",
                                      typeof $$v === "string" ? $$v.trim() : $$v
                                    );
                                  },
                                  expression: "noteData.noteContent",
                                },
                              }),
                              _vm._v(" "),
                              _c("span", { staticClass: "character-count" }, [
                                _vm._v(
                                  _vm._s(_vm.currentLength) +
                                    " / " +
                                    _vm._s(_vm.maxLength)
                                ),
                              ]),
                            ],
                            1
                          ),
                          _vm._v(" "),
                          _c(
                            "el-form-item",
                            {
                              attrs: {
                                "label-width": "96px",
                                label: "显示设置",
                                prop: "isStudentShow",
                              },
                            },
                            [
                              _c(
                                "el-checkbox-group",
                                {
                                  model: {
                                    value: _vm.noteData.isStudentShow,
                                    callback: function ($$v) {
                                      _vm.$set(
                                        _vm.noteData,
                                        "isStudentShow",
                                        $$v
                                      );
                                    },
                                    expression: "noteData.isStudentShow",
                                  },
                                },
                                [
                                  _c(
                                    "el-checkbox",
                                    {
                                      attrs: { label: 0 },
                                      on: {
                                        change: function (v) {
                                          return _vm.setSingleCheckedShowValue(
                                            v,
                                            _vm.noteData,
                                            0
                                          )
                                        },
                                      },
                                    },
                                    [_vm._v("学生可见")]
                                  ),
                                  _vm._v(" "),
                                  _c(
                                    "el-checkbox",
                                    {
                                      attrs: { label: 1 },
                                      on: {
                                        change: function (v) {
                                          return _vm.setSingleCheckedShowValue(
                                            v,
                                            _vm.noteData,
                                            1
                                          )
                                        },
                                      },
                                    },
                                    [_vm._v("学生不可见")]
                                  ),
                                ],
                                1
                              ),
                            ],
                            1
                          ),
                        ],
                        1
                      ),
                    ],
                    1
                  ),
                ]
              ),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "bottom" },
            [
              _c(
                "el-button",
                {
                  attrs: { size: "small" },
                  on: {
                    click: function ($event) {
                      return _vm.close()
                    },
                  },
                },
                [_vm._v("取消")]
              ),
              _vm._v(" "),
              _c(
                "el-button",
                {
                  attrs: { size: "small", type: "primary" },
                  on: {
                    click: function ($event) {
                      return _vm.submit("")
                    },
                  },
                },
                [_vm._v("确认")]
              ),
            ],
            1
          ),
        ],
        1
      ),
    ]
  )
};
var __vue_staticRenderFns__$65 = [];
__vue_render__$65._withStripped = true;

  /* style */
  const __vue_inject_styles__$66 = undefined;
  /* scoped */
  const __vue_scope_id__$66 = undefined;
  /* module identifier */
  const __vue_module_identifier__$66 = undefined;
  /* functional template */
  const __vue_is_functional_template__$66 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$66 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$65, staticRenderFns: __vue_staticRenderFns__$65 },
    __vue_inject_styles__$66,
    __vue_script__$66,
    __vue_scope_id__$66,
    __vue_is_functional_template__$66,
    __vue_module_identifier__$66,
    false,
    undefined,
    undefined,
    undefined
  );

var setupDefaults = {
  keyId: 1,
  cookies: {
    path: '/'
  },
  treeOptions: {
    parentKey: 'parentId',
    key: 'id',
    children: 'children'
  },
  parseDateFormat: 'yyyy-MM-dd HH:mm:ss',
  firstDayOfWeek: 1
};
var setupDefaults_1 = setupDefaults;

function arrayEach(list, iterate, context) {
  if (list) {
    if (list.forEach) {
      list.forEach(iterate, context);
    } else {
      for (var index = 0, len = list.length; index < len; index++) {
        iterate.call(context, list[index], index, list);
      }
    }
  }
}
var arrayEach_1 = arrayEach;

var objectToString = Object.prototype.toString;
var staticObjectToString = objectToString;

function helperCreateInInObjectString(type) {
  return function (obj) {
    return '[object ' + type + ']' === staticObjectToString.call(obj);
  };
}
var helperCreateInInObjectString_1 = helperCreateInInObjectString;

/**
  * 判断是否数组
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isArray$3 = Array.isArray || helperCreateInInObjectString_1('Array');
var isArray_1 = isArray$3;

/**
  * 判断对象自身属性中是否具有指定的属性
  *
  * @param {Object} obj 对象
  * @param {String/Number} key 键值
  * @return {Boolean}
  */
function hasOwnProp(obj, key) {
  return obj && obj.hasOwnProperty ? obj.hasOwnProperty(key) : false;
}
var hasOwnProp_1 = hasOwnProp;

function objectEach(obj, iterate, context) {
  if (obj) {
    for (var key in obj) {
      if (hasOwnProp_1(obj, key)) {
        iterate.call(context, obj[key], key, obj);
      }
    }
  }
}
var objectEach_1 = objectEach;

/**
  * 迭代器
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function each$h(obj, iterate, context) {
  if (obj) {
    return (isArray_1(obj) ? arrayEach_1 : objectEach_1)(obj, iterate, context);
  }
  return obj;
}
var each_1 = each$h;

/* eslint-disable valid-typeof */
function helperCreateInTypeof(type) {
  return function (obj) {
    return typeof obj === type;
  };
}
var helperCreateInTypeof_1 = helperCreateInTypeof;

/**
  * 判断是否方法
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isFunction$2 = helperCreateInTypeof_1('function');
var isFunction_1$1 = isFunction$2;

function helperCreateGetObjects(name, getIndex) {
  var proMethod = Object[name];
  return function (obj) {
    var result = [];
    if (obj) {
      if (proMethod) {
        return proMethod(obj);
      }
      each_1(obj, getIndex > 1 ? function (key) {
        result.push(['' + key, obj[key]]);
      } : function () {
        result.push(arguments[getIndex]);
      });
    }
    return result;
  };
}
var helperCreateGetObjects_1 = helperCreateGetObjects;

/**
  * 获取对象所有属性
  *
  * @param {Object} obj 对象/数组
  * @return {Array}
  */
var keys$2 = helperCreateGetObjects_1('keys', 1);
var keys_1 = keys$2;

function getCativeCtor(val, args) {
  var Ctor = val.__proto__.constructor;
  return args ? new Ctor(args) : new Ctor();
}
function handleValueClone(item, isDeep) {
  return isDeep ? copyValue$1(item, isDeep) : item;
}
function copyValue$1(val, isDeep) {
  if (val) {
    switch (staticObjectToString.call(val)) {
      case "[object Object]":
        {
          var restObj = Object.create(Object.getPrototypeOf(val));
          objectEach_1(val, function (item, key) {
            restObj[key] = handleValueClone(item, isDeep);
          });
          return restObj;
        }
      case "[object Date]":
      case "[object RegExp]":
        {
          return getCativeCtor(val, val.valueOf());
        }
      case "[object Array]":
      case "[object Arguments]":
        {
          var restArr = [];
          arrayEach_1(val, function (item) {
            restArr.push(handleValueClone(item, isDeep));
          });
          return restArr;
        }
      case "[object Set]":
        {
          var restSet = getCativeCtor(val);
          restSet.forEach(function (item) {
            restSet.add(handleValueClone(item, isDeep));
          });
          return restSet;
        }
      case "[object Map]":
        {
          var restMap = getCativeCtor(val);
          restMap.forEach(function (item, key) {
            restMap.set(key, handleValueClone(item, isDeep));
          });
          return restMap;
        }
    }
  }
  return val;
}

/**
  * 浅拷贝/深拷贝
  *
  * @param {Object} obj 对象/数组
  * @param {Boolean} deep 是否深拷贝
  * @return {Object}
  */
function clone$5(obj, deep) {
  if (obj) {
    return copyValue$1(obj, deep);
  }
  return obj;
}
var clone_1 = clone$5;

var objectAssignFns = Object.assign;
function handleAssign(destination, args, isClone) {
  var len = args.length;
  for (var source, index = 1; index < len; index++) {
    source = args[index];
    arrayEach_1(keys_1(args[index]), isClone ? function (key) {
      destination[key] = clone_1(source[key], isClone);
    } : function (key) {
      destination[key] = source[key];
    });
  }
  return destination;
}

/**
  * 将一个或多个源对象复制到目标对象中
  *
  * @param {Object} target 目标对象
  * @param {...Object}
  * @return {Boolean}
  */
var assign$2 = function (target) {
  if (target) {
    var args = arguments;
    if (target === true) {
      if (args.length > 1) {
        target = isArray_1(target[1]) ? [] : {};
        return handleAssign(target, args, true);
      }
    } else {
      return objectAssignFns ? objectAssignFns.apply(Object, args) : handleAssign(target, args);
    }
  }
  return target;
};
var assign_1 = assign$2;

var XEUtils = function () {};
function mixin$1() {
  arrayEach_1(arguments, function (methods) {
    each_1(methods, function (fn, name) {
      XEUtils[name] = isFunction_1$1(fn) ? function () {
        var result = fn.apply(XEUtils.$context, arguments);
        XEUtils.$context = null;
        return result;
      } : fn;
    });
  });
}
function setConfig(options) {
  return assign_1(setupDefaults_1, options);
}
function getConfig() {
  return setupDefaults_1;
}
var version$1 = '3.7.4';
XEUtils.VERSION = version$1;
XEUtils.version = version$1;
XEUtils.mixin = mixin$1;
XEUtils.setup = setConfig;
XEUtils.setConfig = setConfig;
XEUtils.getConfig = getConfig;
var ctor = XEUtils;

function lastArrayEach(obj, iterate, context) {
  for (var len = obj.length - 1; len >= 0; len--) {
    iterate.call(context, obj[len], len, obj);
  }
}
var lastArrayEach_1 = lastArrayEach;

function lastObjectEach(obj, iterate, context) {
  lastArrayEach_1(keys_1(obj), function (key) {
    iterate.call(context, obj[key], key, obj);
  });
}
var lastObjectEach_1 = lastObjectEach;

/**
  * 判断是否为Null
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isNull(obj) {
  return obj === null;
}
var isNull_1 = isNull;

/**
 * 返回一个获取对象属性的函数
 *
 * @param {String} name 属性名
 * @param {Object} defs 空值
 */
function property$1(name, defs) {
  return function (obj) {
    return isNull_1(obj) ? defs : obj[name];
  };
}
var property_1 = property$1;

/**
  * 指定方法后的返回值组成的新对象
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function objectMap(obj, iterate, context) {
  var result = {};
  if (obj) {
    if (iterate) {
      if (!isFunction_1$1(iterate)) {
        iterate = property_1(iterate);
      }
      each_1(obj, function (val, index) {
        result[index] = iterate.call(context, val, index, obj);
      });
    } else {
      return obj;
    }
  }
  return result;
}
var objectMap_1 = objectMap;

/**
  * 判断是否对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isPlainObject(obj) {
  return obj ? obj.constructor === Object : false;
}
var isPlainObject_1 = isPlainObject;

function helperCheckCopyKey(key) {
  return key !== '__proto__' && key !== 'constructor';
}
var helperCheckCopyKey_1 = helperCheckCopyKey;

function handleMerge(target, source) {
  if (isPlainObject_1(target) && isPlainObject_1(source) || isArray_1(target) && isArray_1(source)) {
    each_1(source, function (val, key) {
      if (helperCheckCopyKey_1(key)) {
        target[key] = isFunction_1$1(source) ? val : handleMerge(target[key], val);
      }
    });
    return target;
  }
  return source;
}

/**
  * 将一个或多个源对象合并到目标对象中
  *
  * @param {Object} target 目标对象
  * @param {...Object}
  * @return {Boolean}
  */
var merge$1 = function (target) {
  if (!target) {
    target = {};
  }
  var args = arguments;
  var len = args.length;
  for (var source, index = 1; index < len; index++) {
    source = args[index];
    if (source) {
      handleMerge(target, source);
    }
  }
  return target;
};
var merge_1 = merge$1;

/**
  * 指定方法后的返回值组成的新数组
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Array}
  */
function map$2(obj, iterate, context) {
  var result = [];
  if (obj && arguments.length > 1) {
    if (obj.map) {
      return obj.map(iterate, context);
    } else {
      each_1(obj, function () {
        result.push(iterate.apply(context, arguments));
      });
    }
  }
  return result;
}
var map_1 = map$2;

function helperCreateIterateHandle(prop, useArray, restIndex, matchValue, defaultValue) {
  return function (obj, iterate, context) {
    if (obj && iterate) {
      if (prop && obj[prop]) {
        return obj[prop](iterate, context);
      } else {
        if (useArray && isArray_1(obj)) {
          for (var index = 0, len = obj.length; index < len; index++) {
            if (!!iterate.call(context, obj[index], index, obj) === matchValue) {
              return [true, false, index, obj[index]][restIndex];
            }
          }
        } else {
          for (var key in obj) {
            if (hasOwnProp_1(obj, key)) {
              if (!!iterate.call(context, obj[key], key, obj) === matchValue) {
                return [true, false, key, obj[key]][restIndex];
              }
            }
          }
        }
      }
    }
    return defaultValue;
  };
}
var helperCreateIterateHandle_1 = helperCreateIterateHandle;

/**
  * 对象中的值中的每一项运行给定函数,如果函数对任一项返回true,则返回true,否则返回false
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Boolean}
  */
var some = helperCreateIterateHandle_1('some', 1, 0, true, false);
var some_1 = some;

/**
  * 对象中的值中的每一项运行给定函数,如果该函数对每一项都返回true,则返回true,否则返回false
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Boolean}
  */
var every = helperCreateIterateHandle_1('every', 1, 1, false, true);
var every_1 = every;

/**
  * 判断对象是否包含该值,成功返回true否则false
  *
  * @param {Object} obj 对象
  * @param {Object} val 值
  * @return {Boolean}
  */
function includes(obj, val) {
  if (obj) {
    if (obj.includes) {
      return obj.includes(val);
    }
    for (var key in obj) {
      if (hasOwnProp_1(obj, key)) {
        if (val === obj[key]) {
          return true;
        }
      }
    }
  }
  return false;
}
var includes_1 = includes;

/**
  * 判断数组是否包含另一数组
  *
  * @param {Array} array1 数组
  * @param {Array} array2 被包含数组
  * @return {Boolean}
  */
function includeArrays(array1, array2) {
  var len;
  var index = 0;
  if (isArray_1(array1) && isArray_1(array2)) {
    for (len = array2.length; index < len; index++) {
      if (!includes_1(array1, array2[index])) {
        return false;
      }
    }
    return true;
  }
  return includes_1(array1, array2);
}
var includeArrays_1 = includeArrays;

/**
 * 数组去重
 * 
 * @param {*} array  数组
 * @param {*} iterate 字段或回调
 * @param {*} context 
 * @returns 
 */
function uniq(array, iterate, context) {
  var result = [];
  if (iterate) {
    if (!isFunction_1$1(iterate)) {
      iterate = property_1(iterate);
    }
    var val,
      valMap = {};
    each_1(array, function (item, key) {
      val = iterate.call(context, item, key, array);
      if (!valMap[val]) {
        valMap[val] = 1;
        result.push(item);
      }
    });
  } else {
    each_1(array, function (value) {
      if (!includes_1(result, value)) {
        result.push(value);
      }
    });
  }
  return result;
}
var uniq_1 = uniq;

/**
 * 将对象或者伪数组转为新数组
 *
 * @param {Array} list 数组
 * @return {Array}
 */
function toArray(list) {
  return map_1(list, function (item) {
    return item;
  });
}
var toArray_1 = toArray;

/**
  * 将多个数的值返回唯一的并集数组
  *
  * @param {...Array} 数组
  * @return {Array}
  */
function union() {
  var args = arguments;
  var result = [];
  var index = 0;
  var len = args.length;
  for (; index < len; index++) {
    result = result.concat(toArray_1(args[index]));
  }
  return uniq_1(result);
}
var union_1 = union;

var staticStrUndefined = 'undefined';
var staticStrUndefined_1 = staticStrUndefined;

/**
  * 判断是否Undefined
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isUndefined = helperCreateInTypeof_1(staticStrUndefined_1);
var isUndefined_1 = isUndefined;

/**
 * 判断是否 undefined 和 null
 * @param {Object} obj 对象
 * @return {Boolean}
 */
function eqNull(obj) {
  return isNull_1(obj) || isUndefined_1(obj);
}
var eqNull_1 = eqNull;

var staticHGKeyRE = /(.+)?\[(\d+)\]$/;
var staticHGKeyRE_1 = staticHGKeyRE;

function helperGetHGSKeys(property) {
  // 以最快的方式判断数组，可忽略准确性
  return property ? property.splice && property.join ? property : ('' + property).replace(/(\[\d+\])\.?/g, '$1.').replace(/\.$/, '').split('.') : [];
}
var helperGetHGSKeys_1 = helperGetHGSKeys;

/**
 * 获取对象的属性的值，如果值为 undefined，则返回默认值
 * @param {Object/Array} obj 对象
 * @param {String/Function} property 键、路径
 * @param {Object} defaultValue 默认值
 * @return {Object}
 */
function get$2(obj, property, defaultValue) {
  if (eqNull_1(obj)) {
    return defaultValue;
  }
  var result = getValueByPath(obj, property);
  return isUndefined_1(result) ? defaultValue : result;
}
function getDeepProps(obj, key) {
  var matchs = key ? key.match(staticHGKeyRE_1) : '';
  return matchs ? matchs[1] ? obj[matchs[1]] ? obj[matchs[1]][matchs[2]] : undefined : obj[matchs[2]] : obj[key];
}
function getValueByPath(obj, property) {
  if (obj) {
    var rest, props, len;
    var index = 0;
    if (obj[property] || hasOwnProp_1(obj, property)) {
      return obj[property];
    } else {
      props = helperGetHGSKeys_1(property);
      len = props.length;
      if (len) {
        for (rest = obj; index < len; index++) {
          rest = getDeepProps(rest, props[index]);
          if (eqNull_1(rest)) {
            if (index === len - 1) {
              return rest;
            }
            return;
          }
        }
      }
      return rest;
    }
  }
}
var get_1 = get$2;

var ORDER_PROP_ASC = 'asc';
var ORDER_PROP_DESC = 'desc';

// function handleSort (v1, v2) {
//   return v1 > v2 ? 1 : -1
// }

// '' < 数字 < 字符 < null < undefined
function handleSort(v1, v2) {
  if (isUndefined_1(v1)) {
    return 1;
  }
  if (isNull_1(v1)) {
    return isUndefined_1(v2) ? -1 : 1;
  }
  return v1 && v1.localeCompare ? v1.localeCompare(v2) : v1 > v2 ? 1 : -1;
}
function buildMultiOrders(name, confs, compares) {
  return function (item1, item2) {
    var v1 = item1[name];
    var v2 = item2[name];
    if (v1 === v2) {
      return compares ? compares(item1, item2) : 0;
    }
    return confs.order === ORDER_PROP_DESC ? handleSort(v2, v1) : handleSort(v1, v2);
  };
}
function getSortConfs(arr, list, fieldConfs, context) {
  var sortConfs = [];
  fieldConfs = isArray_1(fieldConfs) ? fieldConfs : [fieldConfs];
  arrayEach_1(fieldConfs, function (handle, index) {
    if (handle) {
      var field = handle;
      var order;
      if (isArray_1(handle)) {
        field = handle[0];
        order = handle[1];
      } else if (isPlainObject_1(handle)) {
        field = handle.field;
        order = handle.order;
      }
      sortConfs.push({
        field: field,
        order: order || ORDER_PROP_ASC
      });
      arrayEach_1(list, isFunction_1$1(field) ? function (item, key) {
        item[index] = field.call(context, item.data, key, arr);
      } : function (item) {
        item[index] = field ? get_1(item.data, field) : item.data;
      });
    }
  });
  return sortConfs;
}

/**
  * 将数组进行排序
  *
  * @param {Array} arr 数组
  * @param {Function/String/Array} fieldConfs 方法或属性
  * @param {Object} context 上下文
  * @return {Array}
  */
function orderBy(arr, fieldConfs, context) {
  if (arr) {
    if (eqNull_1(fieldConfs)) {
      return toArray_1(arr).sort(handleSort);
    }
    var compares;
    var list = map_1(arr, function (item) {
      return {
        data: item
      };
    });
    var sortConfs = getSortConfs(arr, list, fieldConfs, context);
    var len = sortConfs.length - 1;
    while (len >= 0) {
      compares = buildMultiOrders(len, sortConfs[len], compares);
      len--;
    }
    if (compares) {
      list = list.sort(compares);
    }
    return map_1(list, property_1('data'));
  }
  return [];
}
var orderBy_1 = orderBy;

var sortBy = orderBy_1;
var sortBy_1 = sortBy;

/**
  * 获取一个指定范围内随机数
  *
  * @param {Number} minVal 最小值
  * @param {Number} maxVal 最大值
  * @return {Number}
  */
function random(minVal, maxVal) {
  return minVal >= maxVal ? minVal : (minVal = minVal >> 0) + Math.round(Math.random() * ((maxVal || 9) - minVal));
}
var random_1 = random;

/**
  * 获取对象所有值
  *
  * @param {Object} obj 对象/数组
  * @return {Array}
  */
var values = helperCreateGetObjects_1('values', 0);
var values_1 = values;

/**
  * 将一个数组随机打乱，返回一个新的数组
  *
  * @param {Array} array 数组
  * @return {Array}
  */
function shuffle(array) {
  var index;
  var result = [];
  var list = values_1(array);
  var len = list.length - 1;
  for (; len >= 0; len--) {
    index = len > 0 ? random_1(0, len) : 0;
    result.push(list[index]);
    list.splice(index, 1);
  }
  return result;
}
var shuffle_1 = shuffle;

/**
  * 从一个数组中随机返回几个元素
  *
  * @param {Array} array 数组
  * @param {Number} number 个数
  * @return {Array}
  */
function sample(array, number) {
  var result = shuffle_1(array);
  if (arguments.length <= 1) {
    return result[0];
  }
  if (number < result.length) {
    result.length = number || 0;
  }
  return result;
}
var sample_1 = sample;

function helperCreateToNumber(handle) {
  return function (str) {
    if (str) {
      var num = handle(str && str.replace ? str.replace(/,/g, '') : str);
      if (!isNaN(num)) {
        return num;
      }
    }
    return 0;
  };
}
var helperCreateToNumber_1 = helperCreateToNumber;

/**
 * 转数值
 * @param { String/Number } str 数值
 *
 * @return {Number}
 */
var toNumber = helperCreateToNumber_1(parseFloat);
var toNumber_1 = toNumber;

/**
 * 裁剪 Arguments 或数组 array，从 start 位置开始到 end 结束，但不包括 end 本身的位置
 * @param {Array/Arguments} array 数组或Arguments
 * @param {Number} startIndex 开始索引
 * @param {Number} endIndex 结束索引
 */
function slice$3(array, startIndex, endIndex) {
  var result = [];
  var argsSize = arguments.length;
  if (array) {
    startIndex = argsSize >= 2 ? toNumber_1(startIndex) : 0;
    endIndex = argsSize >= 3 ? toNumber_1(endIndex) : array.length;
    if (array.slice) {
      return array.slice(startIndex, endIndex);
    }
    for (; startIndex < endIndex; startIndex++) {
      result.push(array[startIndex]);
    }
  }
  return result;
}
var slice_1 = slice$3;

/**
  * 根据回调过滤数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function filter$1(obj, iterate, context) {
  var result = [];
  if (obj && iterate) {
    if (obj.filter) {
      return obj.filter(iterate, context);
    }
    each_1(obj, function (val, key) {
      if (iterate.call(context, val, key, obj)) {
        result.push(val);
      }
    });
  }
  return result;
}
var filter_1 = filter$1;

/**
  * 查找匹配第一条数据的键
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
var findKey = helperCreateIterateHandle_1('', 0, 2, true);
var findKey_1 = findKey;

/**
  * 从左至右遍历，匹配最近的一条数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
var find$1 = helperCreateIterateHandle_1('find', 1, 3, true);
var find_1 = find$1;

/**
  * 从右至左遍历，匹配最近的一条数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function findLast(obj, iterate, context) {
  if (obj) {
    if (!isArray_1(obj)) {
      obj = values_1(obj);
    }
    for (var len = obj.length - 1; len >= 0; len--) {
      if (iterate.call(context, obj[len], len, obj)) {
        return obj[len];
      }
    }
  }
}
var findLast_1 = findLast;

/**
  * 接收一个函数作为累加器，数组中的每个值（从左到右）开始合并，最终为一个值。
  *
  * @param {Array} array 数组
  * @param {Function} callback 方法
  * @param {Object} initialValue 初始值
  * @return {Number}
  */
function reduce$2(array, callback, initialValue) {
  if (array) {
    var len, reduceMethod;
    var index = 0;
    var context = null;
    var previous = initialValue;
    var isInitialVal = arguments.length > 2;
    var keyList = keys_1(array);
    if (array.length && array.reduce) {
      reduceMethod = function () {
        return callback.apply(context, arguments);
      };
      if (isInitialVal) {
        return array.reduce(reduceMethod, previous);
      }
      return array.reduce(reduceMethod);
    }
    if (isInitialVal) {
      index = 1;
      previous = array[keyList[0]];
    }
    for (len = keyList.length; index < len; index++) {
      previous = callback.call(context, previous, array[keyList[index]], index, array);
    }
    return previous;
  }
}
var reduce_1 = reduce$2;

/**
  * 浅复制数组的一部分到同一数组中的另一个位置,数组大小不变
  *
  * @param {Array} array 数组
  * @param {Number} target 从该位置开始替换数据
  * @param {Number} start 从该位置开始读取数据，默认为 0 。如果为负值，表示倒数
  * @param {Number} end 到该位置前停止读取数据，默认等于数组长度。如果为负值，表示倒数
  * @return {Array}
  */
function copyWithin(array, target, start, end) {
  if (isArray_1(array) && array.copyWithin) {
    return array.copyWithin(target, start, end);
  }
  var replaceIndex, replaceArray;
  var targetIndex = target >> 0;
  var startIndex = start >> 0;
  var len = array.length;
  var endIndex = arguments.length > 3 ? end >> 0 : len;
  if (targetIndex < len) {
    targetIndex = targetIndex >= 0 ? targetIndex : len + targetIndex;
    if (targetIndex >= 0) {
      startIndex = startIndex >= 0 ? startIndex : len + startIndex;
      endIndex = endIndex >= 0 ? endIndex : len + endIndex;
      if (startIndex < endIndex) {
        for (replaceIndex = 0, replaceArray = array.slice(startIndex, endIndex); targetIndex < len; targetIndex++) {
          if (replaceArray.length <= replaceIndex) {
            break;
          }
          array[targetIndex] = replaceArray[replaceIndex++];
        }
      }
    }
  }
  return array;
}
var copyWithin_1 = copyWithin;

/**
  * 将一个数组分割成大小的组。如果数组不能被平均分配，那么最后一块将是剩下的元素
  *
  * @param {Array} array 数组
  * @param {Number} size 每组大小
  * @return {Array}
  */
function chunk(array, size) {
  var index;
  var result = [];
  var arrLen = size >> 0 || 1;
  if (isArray_1(array)) {
    if (arrLen >= 0 && array.length > arrLen) {
      index = 0;
      while (index < array.length) {
        result.push(array.slice(index, index + arrLen));
        index += arrLen;
      }
    } else {
      result = array.length ? [array] : array;
    }
  }
  return result;
}
var chunk_1 = chunk;

/**
  * 获取数组对象中某属性值，返回一个数组
  *
  * @param {Array} array 数组
  * @param {String} key 属性值
  * @return {Array}
  */
function pluck(obj, key) {
  return map_1(obj, property_1(key));
}
var pluck_1 = pluck;

function helperCreateMinMax(handle) {
  return function (arr, iterate) {
    if (arr && arr.length) {
      var rest, itemIndex;
      arrayEach_1(arr, function (itemVal, index) {
        if (iterate) {
          itemVal = isFunction_1$1(iterate) ? iterate(itemVal, index, arr) : get_1(itemVal, iterate);
        }
        if (!eqNull_1(itemVal) && (eqNull_1(rest) || handle(rest, itemVal))) {
          itemIndex = index;
          rest = itemVal;
        }
      });
      return arr[itemIndex];
    }
    return rest;
  };
}
var helperCreateMinMax_1 = helperCreateMinMax;

/**
  * 获取最大值
  *
  * @param {Array} arr 数组
  * @param {Function} iterate(item, index, obj) 回调
  * @return {Number}
  */
var max$6 = helperCreateMinMax_1(function (rest, itemVal) {
  return rest < itemVal;
});
var max_1 = max$6;

/**
 * 与 zip 相反
 *
 * @param {Array} arrays 数组集合
 */
function unzip(arrays) {
  var index, maxItem, len;
  var result = [];
  if (arrays && arrays.length) {
    index = 0;
    maxItem = max_1(arrays, function (item) {
      return item ? item.length : 0;
    });
    for (len = maxItem ? maxItem.length : 0; index < len; index++) {
      result.push(pluck_1(arrays, index));
    }
  }
  return result;
}
var unzip_1 = unzip;

/**
 * 将每个数组中相应位置的值合并在一起
 *
 * @param {Array*} array 数组
 */
function zip() {
  return unzip_1(arguments);
}
var zip_1 = zip;

/**
 * 根据键数组、值数组对转换为对象
 *
 * @param {Array} props 键数组
 * @param {Number} arr 值数组
 * @return {Object}
 */
function zipObject(props, arr) {
  var result = {};
  arr = arr || [];
  each_1(values_1(props), function (val, key) {
    result[val] = arr[key];
  });
  return result;
}
var zipObject_1 = zipObject;

function flattenDeep(array, deep) {
  var result = [];
  arrayEach_1(array, function (vals) {
    result = result.concat(isArray_1(vals) ? deep ? flattenDeep(vals, deep) : vals : [vals]);
  });
  return result;
}

/**
  * 将一个多维数组铺平
  * @param {Array} array 数组
  * @param {Boolean} deep 是否深层
  * @return {Array}
  */
function flatten$1(array, deep) {
  if (isArray_1(array)) {
    return flattenDeep(array, deep);
  }
  return [];
}
var flatten_1 = flatten$1;

function deepGetObj(obj, path) {
  var index = 0;
  var len = path.length;
  while (obj && index < len) {
    obj = obj[path[index++]];
  }
  return len && obj ? obj : 0;
}

/**
 * 在list的每个元素上执行方法,任何传递的额外参数都会在调用方法的时候传递给它
 *
 * @param {Array} list
 * @param {Array/String/Function} path
 * @param {...Object} arguments
 * @return {Array}
 */
function invoke(list, path) {
  var func;
  var args = arguments;
  var params = [];
  var paths = [];
  var index = 2;
  var len = args.length;
  for (; index < len; index++) {
    params.push(args[index]);
  }
  if (isArray_1(path)) {
    len = path.length - 1;
    for (index = 0; index < len; index++) {
      paths.push(path[index]);
    }
    path = path[len];
  }
  return map_1(list, function (context) {
    if (paths.length) {
      context = deepGetObj(context, paths);
    }
    func = context[path] || path;
    if (func && func.apply) {
      return func.apply(context, params);
    }
  });
}
var invoke_1 = invoke;

function helperDeleteProperty(obj, property) {
  try {
    delete obj[property];
  } catch (e) {
    obj[property] = undefined;
  }
}
var helperDeleteProperty_1 = helperDeleteProperty;

/**
  * 迭代器,从最后开始迭代
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
function lastEach(obj, iterate, context) {
  if (obj) {
    return (isArray_1(obj) ? lastArrayEach_1 : lastObjectEach_1)(obj, iterate, context);
  }
  return obj;
}
var lastEach_1 = lastEach;

/**
  * 判断是否Object对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isObject$5 = helperCreateInTypeof_1('object');
var isObject_1 = isObject$5;

/**
  * 清空对象
  *
  * @param {Object} obj 对象
  * @param {*} defs 默认值,如果不传（清空所有属性）、如果传对象（清空并继承)、如果传值(给所有赋值)
  * @param {Object/Array} assigns 默认值
  * @return {Object}
  */
function clear$2(obj, defs, assigns) {
  if (obj) {
    var len;
    var isDefs = arguments.length > 1 && (isNull_1(defs) || !isObject_1(defs));
    var extds = isDefs ? assigns : defs;
    if (isPlainObject_1(obj)) {
      objectEach_1(obj, isDefs ? function (val, key) {
        obj[key] = defs;
      } : function (val, key) {
        helperDeleteProperty_1(obj, key);
      });
      if (extds) {
        assign_1(obj, extds);
      }
    } else if (isArray_1(obj)) {
      if (isDefs) {
        len = obj.length;
        while (len > 0) {
          len--;
          obj[len] = defs;
        }
      } else {
        obj.length = 0;
      }
      if (extds) {
        obj.push.apply(obj, extds);
      }
    }
  }
  return obj;
}
var clear_1 = clear$2;

function pluckProperty(name) {
  return function (obj, key) {
    return key === name;
  };
}

/**
  * 移除对象属性
  *
  * @param {Object/Array} obj 对象/数组
  * @param {Function/String} iterate 方法或属性
  * @param {Object} context 上下文
  * @return {Object/Array}
  */
function remove(obj, iterate, context) {
  if (obj) {
    if (!eqNull_1(iterate)) {
      var removeKeys = [];
      var rest = [];
      if (!isFunction_1$1(iterate)) {
        iterate = pluckProperty(iterate);
      }
      each_1(obj, function (item, index, rest) {
        if (iterate.call(context, item, index, rest)) {
          removeKeys.push(index);
        }
      });
      if (isArray_1(obj)) {
        lastEach_1(removeKeys, function (item, key) {
          rest.push(obj[item]);
          obj.splice(item, 1);
        });
      } else {
        rest = {};
        arrayEach_1(removeKeys, function (key) {
          rest[key] = obj[key];
          helperDeleteProperty_1(obj, key);
        });
      }
      return rest;
    }
    return clear_1(obj);
  }
  return obj;
}
var remove_1 = remove;

function strictTree(array, optChildren) {
  each_1(array, function (item) {
    if (item[optChildren] && !item[optChildren].length) {
      remove_1(item, optChildren);
    }
  });
}

/**
  * 将一个带层级的数据列表转成树结构
  *
  * @param {Array} array 数组
  * @param {Object} options {strict: false, parentKey: 'parentId', key: 'id', children: 'children', mapChildren: 'children', data: 'data'}
  * @return {Array}
  */
function toArrayTree(array, options) {
  var opts = assign_1({}, setupDefaults_1.treeOptions, options);
  var optStrict = opts.strict;
  var optKey = opts.key;
  var optParentKey = opts.parentKey;
  var optChildren = opts.children;
  var optMapChildren = opts.mapChildren;
  var optSortKey = opts.sortKey;
  var optReverse = opts.reverse;
  var optData = opts.data;
  var result = [];
  var treeMap = {};
  var idsMap = {};
  var id, treeData, parentId;
  if (optSortKey) {
    array = orderBy_1(clone_1(array), optSortKey);
    if (optReverse) {
      array = array.reverse();
    }
  }
  each_1(array, function (item) {
    id = item[optKey];
    idsMap[id] = true;
  });
  each_1(array, function (item) {
    id = item[optKey];
    if (optData) {
      treeData = {};
      treeData[optData] = item;
    } else {
      treeData = item;
    }
    parentId = item[optParentKey];
    treeMap[id] = treeMap[id] || [];
    treeData[optKey] = id;
    treeData[optParentKey] = parentId;
    if (id === parentId) {
      parentId = null;
      console.log('Fix infinite Loop.', item);
    }
    treeMap[parentId] = treeMap[parentId] || [];
    treeMap[parentId].push(treeData);
    treeData[optChildren] = treeMap[id];
    if (optMapChildren) {
      treeData[optMapChildren] = treeMap[id];
    }
    if (!optStrict || optStrict && eqNull_1(parentId)) {
      if (!idsMap[parentId]) {
        result.push(treeData);
      }
    }
  });
  if (optStrict) {
    strictTree(array, optChildren);
  }
  return result;
}
var toArrayTree_1 = toArrayTree;

function unTreeList(result, parentItem, array, opts) {
  var optKey = opts.key;
  var optParentKey = opts.parentKey;
  var optChildren = opts.children;
  var optData = opts.data;
  var optUpdated = opts.updated;
  var optClear = opts.clear;
  arrayEach_1(array, function (item) {
    var childList = item[optChildren];
    if (optData) {
      item = item[optData];
    }
    if (optUpdated !== false) {
      item[optParentKey] = parentItem ? parentItem[optKey] : null;
    }
    result.push(item);
    if (childList && childList.length) {
      unTreeList(result, item, childList, opts);
    }
    if (optClear) {
      delete item[optChildren];
    }
  });
  return result;
}

/**
  * 将一个树结构转成数组列表
  *
  * @param {Array} array 数组
  * @param {Object} options { children: 'children', data: 'data', clear: false }
  * @return {Array}
  */
function toTreeArray(array, options) {
  return unTreeList([], null, array, assign_1({}, setupDefaults_1.treeOptions, options));
}
var toTreeArray_1 = toTreeArray;

function helperCreateTreeFunc(handle) {
  return function (obj, iterate, options, context) {
    var opts = options || {};
    var optChildren = opts.children || 'children';
    return handle(null, obj, iterate, context, [], [], optChildren, opts);
  };
}
var helperCreateTreeFunc_1 = helperCreateTreeFunc;

function findTreeItem(parent, obj, iterate, context, path, node, parseChildren, opts) {
  if (obj) {
    var item, index, len, paths, nodes, match;
    for (index = 0, len = obj.length; index < len; index++) {
      item = obj[index];
      paths = path.concat(['' + index]);
      nodes = node.concat([item]);
      if (iterate.call(context, item, index, obj, paths, parent, nodes)) {
        return {
          index: index,
          item: item,
          path: paths,
          items: obj,
          parent: parent,
          nodes: nodes
        };
      }
      if (parseChildren && item) {
        match = findTreeItem(item, item[parseChildren], iterate, context, paths.concat([parseChildren]), nodes, parseChildren);
        if (match) {
          return match;
        }
      }
    }
  }
}

/**
  * 从树结构中查找匹配第一条数据的键、值、路径
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  * @param {Object} options {children: 'children'}
  * @param {Object} context 上下文
  * @return {Object} { item, index, items, path, parent, nodes }
  */
var findTree = helperCreateTreeFunc_1(findTreeItem);
var findTree_1 = findTree;

function eachTreeItem(parent, obj, iterate, context, path, node, parseChildren, opts) {
  var paths, nodes;
  each_1(obj, function (item, index) {
    paths = path.concat(['' + index]);
    nodes = node.concat([item]);
    iterate.call(context, item, index, obj, paths, parent, nodes);
    if (item && parseChildren) {
      paths.push(parseChildren);
      eachTreeItem(item, item[parseChildren], iterate, context, paths, nodes, parseChildren);
    }
  });
}

/**
  * 从树结构中遍历数据的键、值、路径
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  * @param {Object} options {children: 'children', mapChildren: 'children}
  * @param {Object} context 上下文
  */
var eachTree = helperCreateTreeFunc_1(eachTreeItem);
var eachTree_1 = eachTree;

function mapTreeItem(parent, obj, iterate, context, path, node, parseChildren, opts) {
  var paths, nodes, rest;
  var mapChildren = opts.mapChildren || parseChildren;
  return map_1(obj, function (item, index) {
    paths = path.concat(['' + index]);
    nodes = node.concat([item]);
    rest = iterate.call(context, item, index, obj, paths, parent, nodes);
    if (rest && item && parseChildren && item[parseChildren]) {
      rest[mapChildren] = mapTreeItem(item, item[parseChildren], iterate, context, paths, nodes, parseChildren, opts);
    }
    return rest;
  });
}

/**
  * 从树结构中指定方法后的返回值组成的新数组
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  * @param {Object} options {children: 'children'}
  * @param {Object} context 上下文
  * @return {Object/Array}
  */
var mapTree = helperCreateTreeFunc_1(mapTreeItem);
var mapTree_1 = mapTree;

/**
  * 从树结构中根据回调过滤数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent) 回调
  * @param {Object} options {children: 'children'}
  * @param {Object} context 上下文
  * @return {Array}
  */
function filterTree(obj, iterate, options, context) {
  var result = [];
  if (obj && iterate) {
    eachTree_1(obj, function (item, index, items, path, parent, nodes) {
      if (iterate.call(context, item, index, items, path, parent, nodes)) {
        result.push(item);
      }
    }, options);
  }
  return result;
}
var filterTree_1 = filterTree;

function searchTreeItem(matchParent, parent, obj, iterate, context, path, node, parseChildren, opts) {
  var paths, nodes, rest, isMatch, hasChild;
  var rests = [];
  var hasOriginal = opts.original;
  var sourceData = opts.data;
  var mapChildren = opts.mapChildren || parseChildren;
  var isEvery = opts.isEvery;
  arrayEach_1(obj, function (item, index) {
    paths = path.concat(['' + index]);
    nodes = node.concat([item]);
    isMatch = matchParent && !isEvery || iterate.call(context, item, index, obj, paths, parent, nodes);
    hasChild = parseChildren && item[parseChildren];
    if (isMatch || hasChild) {
      if (hasOriginal) {
        rest = item;
      } else {
        rest = assign_1({}, item);
        if (sourceData) {
          rest[sourceData] = item;
        }
      }
      rest[mapChildren] = searchTreeItem(isMatch, item, item[parseChildren], iterate, context, paths, nodes, parseChildren, opts);
      if (isMatch || rest[mapChildren].length) {
        rests.push(rest);
      }
    } else if (isMatch) {
      rests.push(rest);
    }
  });
  return rests;
}

/**
  * 从树结构中根据回调查找数据
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, items, path, parent, nodes) 回调
  * @param {Object} options {children: 'children'}
  * @param {Object} context 上下文
  * @return {Array}
  */
var searchTree = helperCreateTreeFunc_1(function (parent, obj, iterate, context, path, nodes, parseChildren, opts) {
  return searchTreeItem(0, parent, obj, iterate, context, path, nodes, parseChildren, opts);
});
var searchTree_1 = searchTree;

function arrayIndexOf(list, val) {
  if (list.indexOf) {
    return list.indexOf(val);
  }
  for (var index = 0, len = list.length; index < len; index++) {
    if (val === list[index]) {
      return index;
    }
  }
}
var arrayIndexOf_1 = arrayIndexOf;

function arrayLastIndexOf(list, val) {
  if (list.lastIndexOf) {
    return list.lastIndexOf(val);
  }
  for (var len = list.length - 1; len >= 0; len--) {
    if (val === list[len]) {
      return len;
    }
  }
  return -1;
}
var arrayLastIndexOf_1 = arrayLastIndexOf;

/**
  * 判断是否Number对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isNumber$1 = helperCreateInTypeof_1('number');
var isNumber_1 = isNumber$1;

/* eslint-disable eqeqeq */
function isNumberNaN(obj) {
  return isNumber_1(obj) && isNaN(obj);
}
var _isNaN = isNumberNaN;

/**
  * 判断是否String对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isString$1 = helperCreateInTypeof_1('string');
var isString_1 = isString$1;

/**
  * 判断是否Date对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isDate = helperCreateInInObjectString_1('Date');
var isDate_1 = isDate;

var staticParseInt = parseInt;
var staticParseInt_1 = staticParseInt;

function helperGetUTCDateTime(resMaps) {
  return Date.UTC(resMaps.y, resMaps.M || 0, resMaps.d || 1, resMaps.H || 0, resMaps.m || 0, resMaps.s || 0, resMaps.S || 0);
}
var helperGetUTCDateTime_1 = helperGetUTCDateTime;

function helperGetDateTime(date) {
  return date.getTime();
}
var helperGetDateTime_1 = helperGetDateTime;

function getParseRule(txt) {
  return '(\\d{' + txt + '})';
}
function toParseMs(num) {
  if (num < 10) {
    return num * 100;
  } else if (num < 100) {
    return num * 10;
  }
  return num;
}
function toParseNum(num) {
  return isNaN(num) ? num : staticParseInt_1(num);
}
var d2 = getParseRule(2);
var d1or2 = getParseRule('1,2');
var d1or7 = getParseRule('1,7');
var d3or4 = getParseRule('3,4');
var place = '.{1}';
var d1Or2RE = place + d1or2;
var dzZ = '(([zZ])|([-+]\\d{2}:?\\d{2}))';
var defaulParseStrs = [d3or4, d1Or2RE, d1Or2RE, d1Or2RE, d1Or2RE, d1Or2RE, place + d1or7, dzZ];
var defaulParseREs = [];
for (var len$1 = defaulParseStrs.length - 1; len$1 >= 0; len$1--) {
  var rule = '';
  for (var i$6 = 0; i$6 < len$1 + 1; i$6++) {
    rule += defaulParseStrs[i$6];
  }
  defaulParseREs.push(new RegExp('^' + rule + '$'));
}

/**
 * 解析默认格式
 */
function parseDefaultRules(str) {
  var matchRest,
    resMaps = {};
  for (var i = 0, dfrLen = defaulParseREs.length; i < dfrLen; i++) {
    matchRest = str.match(defaulParseREs[i]);
    if (matchRest) {
      resMaps.y = matchRest[1];
      resMaps.M = matchRest[2];
      resMaps.d = matchRest[3];
      resMaps.H = matchRest[4];
      resMaps.m = matchRest[5];
      resMaps.s = matchRest[6];
      resMaps.S = matchRest[7];
      resMaps.Z = matchRest[8];
      break;
    }
  }
  return resMaps;
}
var customParseStrs = [['yyyy', d3or4], ['yy', d2], ['MM', d2], ['M', d1or2], ['dd', d2], ['d', d1or2], ['HH', d2], ['H', d1or2], ['mm', d2], ['m', d1or2], ['ss', d2], ['s', d1or2], ['SSS', getParseRule(3)], ['S', d1or7], ['Z', dzZ]];
var parseRuleMaps = {};
var parseRuleKeys = ['\\[([^\\]]+)\\]'];
for (var i$6 = 0; i$6 < customParseStrs.length; i$6++) {
  var itemRule = customParseStrs[i$6];
  parseRuleMaps[itemRule[0]] = itemRule[1] + '?';
  parseRuleKeys.push(itemRule[0]);
}
var customParseRes = new RegExp(parseRuleKeys.join('|'), 'g');
var cacheFormatMaps = {};

/**
 * 解析自定义格式
 */
function parseCustomRules(str, format) {
  var cacheItem = cacheFormatMaps[format];
  if (!cacheItem) {
    var posIndexs = [];
    var re = format.replace(/([$(){}*+.?\\^|])/g, "\\$1").replace(customParseRes, function (text, val) {
      var firstChar = text.charAt(0);
      // 如果为转义符号:[关键字]
      if (firstChar === '[') {
        return val;
      }
      posIndexs.push(firstChar);
      return parseRuleMaps[text];
    });
    cacheItem = cacheFormatMaps[format] = {
      _i: posIndexs,
      _r: new RegExp(re)
    };
  }
  var resMaps = {};
  var matchRest = str.match(cacheItem._r);
  if (matchRest) {
    var _i = cacheItem._i;
    for (var i = 1, len = matchRest.length; i < len; i++) {
      resMaps[_i[i - 1]] = matchRest[i];
    }
    return resMaps;
  }
  return resMaps;
}

/**
 * 解析时区
 */
function parseTimeZone(resMaps) {
  // 如果为UTC 时间
  if (/^[zZ]/.test(resMaps.Z)) {
    return new Date(helperGetUTCDateTime_1(resMaps));
  } else {
    // 如果指定时区，时区转换
    var matchRest = resMaps.Z.match(/([-+])(\d{2}):?(\d{2})/);
    if (matchRest) {
      return new Date(helperGetUTCDateTime_1(resMaps) - (matchRest[1] === '-' ? -1 : 1) * staticParseInt_1(matchRest[2]) * 3600000 + staticParseInt_1(matchRest[3]) * 60000);
    }
  }
  return new Date('');
}

/**
  * 字符串转为日期
  *
  * @param {String/Number/Date} str 日期或数字
  * @param {String} format 解析日期格式(yyyy年份、MM月份、dd天、hh(12)HH(24)小时、mm分钟、ss秒、SSS毫秒、Z时区)
  * @return {Date}
  */
function toStringDate(str, format) {
  if (str) {
    var isDType = isDate_1(str);
    if (isDType || !format && /^[0-9]{11,15}$/.test(str)) {
      return new Date(isDType ? helperGetDateTime_1(str) : staticParseInt_1(str));
    }
    if (isString_1(str)) {
      var resMaps = format ? parseCustomRules(str, format) : parseDefaultRules(str);
      if (resMaps.y) {
        if (resMaps.M) {
          resMaps.M = toParseNum(resMaps.M) - 1;
        }
        if (resMaps.S) {
          // 如果7位则是微秒，只精确到3位毫秒
          resMaps.S = toParseMs(toParseNum(resMaps.S.substring(0, 3)));
        }
        if (resMaps.Z) {
          return parseTimeZone(resMaps);
        } else {
          return new Date(resMaps.y, resMaps.M || 0, resMaps.d || 1, resMaps.H || 0, resMaps.m || 0, resMaps.s || 0, resMaps.S || 0);
        }
      }
    }
  }
  return new Date('');
}
var toStringDate_1 = toStringDate;

function helperNewDate() {
  return new Date();
}
var helperNewDate_1 = helperNewDate;

/**
  * 判断是否闰年
  *
  * @param {Date} date 日期或数字
  * @return {Boolean}
  */
function isLeapYear(date) {
  var year;
  var currentDate = date ? toStringDate_1(date) : helperNewDate_1();
  if (isDate_1(currentDate)) {
    year = currentDate.getFullYear();
    return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
  }
  return false;
}
var isLeapYear_1 = isLeapYear;

/**
  * 已废弃，被 some, every 替换
  * @deprecated
  */
function forOf(obj, iterate, context) {
  if (obj) {
    if (isArray_1(obj)) {
      for (var index = 0, len = obj.length; index < len; index++) {
        if (iterate.call(context, obj[index], index, obj) === false) {
          break;
        }
      }
    } else {
      for (var key in obj) {
        if (hasOwnProp_1(obj, key)) {
          if (iterate.call(context, obj[key], key, obj) === false) {
            break;
          }
        }
      }
    }
  }
}
var forOf_1 = forOf;

/**
  * 已废弃
  * @deprecated
  */
function lastForOf(obj, iterate, context) {
  if (obj) {
    var len, list;
    if (isArray_1(obj)) {
      for (len = obj.length - 1; len >= 0; len--) {
        if (iterate.call(context, obj[len], len, obj) === false) {
          break;
        }
      }
    } else {
      list = hasOwnProp_1(obj);
      for (len = list.length - 1; len >= 0; len--) {
        if (iterate.call(context, obj[list[len]], list[len], obj) === false) {
          break;
        }
      }
    }
  }
}
var lastForOf_1 = lastForOf;

function helperCreateIndexOf(name, callback) {
  return function (obj, val) {
    if (obj) {
      if (obj[name]) {
        return obj[name](val);
      }
      if (isString_1(obj) || isArray_1(obj)) {
        return callback(obj, val);
      }
      for (var key in obj) {
        if (hasOwnProp_1(obj, key)) {
          if (val === obj[key]) {
            return key;
          }
        }
      }
    }
    return -1;
  };
}
var helperCreateIndexOf_1 = helperCreateIndexOf;

/**
  * 返回对象第一个索引值
  *
  * @param {Object} obj 对象
  * @param {Object} val 值
  * @return {Number}
  */
var indexOf$1 = helperCreateIndexOf_1('indexOf', arrayIndexOf_1);
var indexOf_1 = indexOf$1;

/**
  * 从最后开始的索引值,返回对象第一个索引值
  *
  * @param {Object} array 对象
  * @param {Object} val 值
  * @return {Number}
  */
var lastIndexOf = helperCreateIndexOf_1('lastIndexOf', arrayLastIndexOf_1);
var lastIndexOf_1 = lastIndexOf;

/**
  * 返回对象的长度
  *
  * @param {Object} obj 对象
  * @return {Number}
  */
function getSize$2(obj) {
  var len = 0;
  if (isString_1(obj) || isArray_1(obj)) {
    return obj.length;
  }
  each_1(obj, function () {
    len++;
  });
  return len;
}
var getSize_1 = getSize$2;

function isNumberFinite(obj) {
  return isNumber_1(obj) && isFinite(obj);
}
var _isFinite = isNumberFinite;

/**
  * 判断是否整数
  *
  * @param {Number, String} number 数值
  * @return {Boolean}
  */
var isInteger = function (obj) {
  return !isNull_1(obj) && !isNaN(obj) && !isArray_1(obj) && obj % 1 === 0;
};
var isInteger_1 = isInteger;

/**
  * 判断是否小数
  *
  * @param {Number} obj 数值
  * @return {Boolean}
  */
function isFloat(obj) {
  return !isNull_1(obj) && !isNaN(obj) && !isArray_1(obj) && !isInteger_1(obj);
}
var isFloat_1 = isFloat;

/**
  * 判断是否Boolean对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isBoolean = helperCreateInTypeof_1('boolean');
var isBoolean_1 = isBoolean;

/**
  * 判断是否RegExp对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isRegExp$1 = helperCreateInInObjectString_1('RegExp');
var isRegExp_1 = isRegExp$1;

/**
  * 判断是否Error对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isError = helperCreateInInObjectString_1('Error');
var isError_1 = isError;

/**
  * 判断是否TypeError对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isTypeError(obj) {
  return obj ? obj.constructor === TypeError : false;
}
var isTypeError_1 = isTypeError;

/**
  * 判断是否为空对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isEmpty$1(obj) {
  for (var key in obj) {
    return false;
  }
  return true;
}
var isEmpty_1 = isEmpty$1;

/* eslint-disable valid-typeof */


/**
  * 判断是否Symbol对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var supportSymbol = typeof Symbol !== staticStrUndefined_1;
function isSymbol(obj) {
  return supportSymbol && Symbol.isSymbol ? Symbol.isSymbol(obj) : typeof obj === 'symbol';
}
var isSymbol_1 = isSymbol;

/**
  * 判断是否Arguments对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var isArguments = helperCreateInInObjectString_1('Arguments');
var isArguments_1 = isArguments;

/**
  * 判断是否Element对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isElement$2(obj) {
  return !!(obj && isString_1(obj.nodeName) && isNumber_1(obj.nodeType));
}
var isElement_1 = isElement$2;

/* eslint-disable valid-typeof */
var staticDocument = typeof document === staticStrUndefined_1 ? 0 : document;
var staticDocument_1 = staticDocument;

/**
  * 判断是否Document对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isDocument(obj) {
  return !!(obj && staticDocument_1 && obj.nodeType === 9);
}
var isDocument_1 = isDocument;

/* eslint-disable valid-typeof */
var staticWindow = typeof window === staticStrUndefined_1 ? 0 : window;
var staticWindow_1 = staticWindow;

/**
  * 判断是否Window对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
function isWindow(obj) {
  return !!(staticWindow_1 && !!(obj && obj === obj.window));
}
var isWindow_1 = isWindow;

/* eslint-disable valid-typeof */


/**
  * 判断是否FormData对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
  */
var supportFormData = typeof FormData !== staticStrUndefined_1;
function isFormData(obj) {
  return supportFormData && obj instanceof FormData;
}
var isFormData_1 = isFormData;

/* eslint-disable valid-typeof */


/**
  * 判断是否Map对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
 */
var supportMap = typeof Map !== staticStrUndefined_1;
function isMap(obj) {
  return supportMap && obj instanceof Map;
}
var isMap_1 = isMap;

/* eslint-disable valid-typeof */


/**
  * 判断是否WeakMap对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
 */
var supportWeakMap = typeof WeakMap !== staticStrUndefined_1;
function isWeakMap(obj) {
  return supportWeakMap && obj instanceof WeakMap;
}
var isWeakMap_1 = isWeakMap;

/* eslint-disable valid-typeof */


/**
  * 判断是否Set对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
 */
var supportSet = typeof Set !== staticStrUndefined_1;
function isSet(obj) {
  return supportSet && obj instanceof Set;
}
var isSet_1 = isSet;

/* eslint-disable valid-typeof */


/**
  * 判断是否WeakSet对象
  *
  * @param {Object} obj 对象
  * @return {Boolean}
 */
var supportWeakSet = typeof WeakSet !== staticStrUndefined_1;
function isWeakSet(obj) {
  return supportWeakSet && obj instanceof WeakSet;
}
var isWeakSet_1 = isWeakSet;

function helperCreateiterateIndexOf(callback) {
  return function (obj, iterate, context) {
    if (obj && isFunction_1$1(iterate)) {
      if (isArray_1(obj) || isString_1(obj)) {
        return callback(obj, iterate, context);
      }
      for (var key in obj) {
        if (hasOwnProp_1(obj, key)) {
          if (iterate.call(context, obj[key], key, obj)) {
            return key;
          }
        }
      }
    }
    return -1;
  };
}
var helperCreateiterateIndexOf_1 = helperCreateiterateIndexOf;

/**
  * 返回对象第一个索引值
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
var findIndexOf = helperCreateiterateIndexOf_1(function (obj, iterate, context) {
  for (var index = 0, len = obj.length; index < len; index++) {
    if (iterate.call(context, obj[index], index, obj)) {
      return index;
    }
  }
  return -1;
});
var findIndexOf_1 = findIndexOf;

function helperEqualCompare(val1, val2, compare, func, key, obj1, obj2) {
  if (val1 === val2) {
    return true;
  }
  if (val1 && val2 && !isNumber_1(val1) && !isNumber_1(val2) && !isString_1(val1) && !isString_1(val2)) {
    if (isRegExp_1(val1)) {
      return compare('' + val1, '' + val2, key, obj1, obj2);
    }
    if (isDate_1(val1) || isBoolean_1(val1)) {
      return compare(+val1, +val2, key, obj1, obj2);
    } else {
      var result, val1Keys, val2Keys;
      var isObj1Arr = isArray_1(val1);
      var isObj2Arr = isArray_1(val2);
      if (isObj1Arr || isObj2Arr ? isObj1Arr && isObj2Arr : val1.constructor === val2.constructor) {
        val1Keys = keys_1(val1);
        val2Keys = keys_1(val2);
        if (func) {
          result = func(val1, val2, key);
        }
        if (val1Keys.length === val2Keys.length) {
          return isUndefined_1(result) ? every_1(val1Keys, function (key, index) {
            return key === val2Keys[index] && helperEqualCompare(val1[key], val2[val2Keys[index]], compare, func, isObj1Arr || isObj2Arr ? index : key, val1, val2);
          }) : !!result;
        }
        return false;
      }
    }
  }
  return compare(val1, val2, key, obj1, obj2);
}
var helperEqualCompare_1 = helperEqualCompare;

function helperDefaultCompare(v1, v2) {
  return v1 === v2;
}
var helperDefaultCompare_1 = helperDefaultCompare;

/**
 * 深度比较两个对象之间的值是否相等
 *
 * @param {Object} obj1 值1
 * @param {Object} obj2 值2
 * @return {Boolean}
 */
function isEqual(obj1, obj2) {
  return helperEqualCompare_1(obj1, obj2, helperDefaultCompare_1);
}
var isEqual_1 = isEqual;

/**
 * 判断属性中的键和值是否包含在对象中
 *
 * @param {Object/Array} obj 对象
 * @param {Object} source 值
 * @return {Boolean}
 */
function isMatch(obj, source) {
  var objKeys = keys_1(obj);
  var sourceKeys = keys_1(source);
  if (sourceKeys.length) {
    if (includeArrays_1(objKeys, sourceKeys)) {
      return some_1(sourceKeys, function (key2) {
        return findIndexOf_1(objKeys, function (key1) {
          return key1 === key2 && isEqual_1(obj[key1], source[key2]);
        }) > -1;
      });
    }
  } else {
    return true;
  }
  return isEqual_1(obj, source);
}
var isMatch_1 = isMatch;

/**
 * 深度比较两个对象之间的值是否相等，使用自定义比较函数
 *
 * @param {Object} obj1 值1
 * @param {Object} obj2 值2
 * @param {Function} func 自定义函数
 * @return {Boolean}
 */
function isEqualWith(obj1, obj2, func) {
  if (isFunction_1$1(func)) {
    return helperEqualCompare_1(obj1, obj2, function (v1, v2, key, obj1, obj2) {
      var result = func(v1, v2, key, obj1, obj2);
      return isUndefined_1(result) ? helperDefaultCompare_1(v1, v2) : !!result;
    }, func);
  }
  return helperEqualCompare_1(obj1, obj2, helperDefaultCompare_1);
}
var isEqualWith_1 = isEqualWith;

/**
  * 获取对象类型
  *
  * @param {Object} obj 对象
  * @return {String}
  */
function getType(obj) {
  if (isNull_1(obj)) {
    return 'null';
  }
  if (isSymbol_1(obj)) {
    return 'symbol';
  }
  if (isDate_1(obj)) {
    return 'date';
  }
  if (isArray_1(obj)) {
    return 'array';
  }
  if (isRegExp_1(obj)) {
    return 'regexp';
  }
  if (isError_1(obj)) {
    return 'error';
  }
  return typeof obj;
}
var getType_1 = getType;

/**
  * 获取一个全局唯一标识
  *
  * @param {String} prefix 前缀
  * @return {Number}
  */
function uniqueId(prefix) {
  return '' + (eqNull_1(prefix) ? '' : prefix) + setupDefaults_1.keyId++;
}
var uniqueId_1 = uniqueId;

/**
  * 从最后开始的索引值,返回对象第一个索引值
  *
  * @param {Object} obj 对象/数组
  * @param {Function} iterate(item, index, obj) 回调
  * @param {Object} context 上下文
  * @return {Object}
  */
var findLastIndexOf = helperCreateiterateIndexOf_1(function (obj, iterate, context) {
  for (var len = obj.length - 1; len >= 0; len--) {
    if (iterate.call(context, obj[len], len, obj)) {
      return len;
    }
  }
  return -1;
});
var findLastIndexOf_1 = findLastIndexOf;

/**
  * 字符串转JSON
  *
  * @param {String} str 字符串
  * @return {Object} 返回转换后对象
  */
function toStringJSON(str) {
  if (isPlainObject_1(str)) {
    return str;
  } else if (isString_1(str)) {
    try {
      return JSON.parse(str);
    } catch (e) {}
  }
  return {};
}
var toStringJSON_1 = toStringJSON;

/**
  * JSON转字符串
  *
  * @param {Object} obj 对象
  * @return {String} 返回字符串
  */
function toJSONString(obj) {
  return eqNull_1(obj) ? '' : JSON.stringify(obj);
}
var toJSONString_1 = toJSONString;

/**
  * 获取对象所有属性、值
  *
  * @param {Object} obj 对象/数组
  * @return {Array}
  */
var entries = helperCreateGetObjects_1('entries', 2);
var entries_1 = entries;

function helperCreatePickOmit(case1, case2) {
  return function (obj, callback) {
    var item, index;
    var rest = {};
    var result = [];
    var context = this;
    var args = arguments;
    var len = args.length;
    if (!isFunction_1$1(callback)) {
      for (index = 1; index < len; index++) {
        item = args[index];
        result.push.apply(result, isArray_1(item) ? item : [item]);
      }
      callback = 0;
    }
    each_1(obj, function (val, key) {
      if ((callback ? callback.call(context, val, key, obj) : findIndexOf_1(result, function (name) {
        return name === key;
      }) > -1) ? case1 : case2) {
        rest[key] = val;
      }
    });
    return rest;
  };
}
var helperCreatePickOmit_1 = helperCreatePickOmit;

/**
 * 根据 key 过滤指定的属性值，返回一个新的对象
 *
 * @param {Object} obj 对象
 * @param {String/Array} key 键数组
 * @return {Object}
 */
var pick$1 = helperCreatePickOmit_1(1, 0);
var pick_1 = pick$1;

/**
 * 根据 key 排除指定的属性值，返回一个新的对象
 *
 * @param {Object} obj 对象
 * @param {String/Array} key 键数组
 * @return {Object}
 */
var omit = helperCreatePickOmit_1(0, 1);
var omit_1 = omit;

/**
  * 获取对象第一个值
  *
  * @param {Object} obj 对象/数组
  * @return {Object}
  */
function first(obj) {
  return values_1(obj)[0];
}
var first_1 = first;

/**
  * 获取对象最后一个值
  *
  * @param {Object} obj 对象/数组
  * @return {Object}
  */
function last(obj) {
  var list = values_1(obj);
  return list[list.length - 1];
}
var last_1 = last;

/**
 * 检查键、路径是否是该对象的属性
 *
 * @param {Object/Array} data 对象
 * @param {String/Function} property 键、路径
 * @return {Boolean}
 */
function has$2(obj, property) {
  if (obj) {
    if (hasOwnProp_1(obj, property)) {
      return true;
    } else {
      var prop, arrIndex, objProp, matchs, rest, isHas;
      var props = helperGetHGSKeys_1(property);
      var index = 0;
      var len = props.length;
      for (rest = obj; index < len; index++) {
        isHas = false;
        prop = props[index];
        matchs = prop ? prop.match(staticHGKeyRE_1) : '';
        if (matchs) {
          arrIndex = matchs[1];
          objProp = matchs[2];
          if (arrIndex) {
            if (rest[arrIndex]) {
              if (hasOwnProp_1(rest[arrIndex], objProp)) {
                isHas = true;
                rest = rest[arrIndex][objProp];
              }
            }
          } else {
            if (hasOwnProp_1(rest, objProp)) {
              isHas = true;
              rest = rest[objProp];
            }
          }
        } else {
          if (hasOwnProp_1(rest, prop)) {
            isHas = true;
            rest = rest[prop];
          }
        }
        if (isHas) {
          if (index === len - 1) {
            return true;
          }
        } else {
          break;
        }
      }
    }
  }
  return false;
}
var has_1 = has$2;

var sKeyRE = /(.+)?\[(\d+)\]$/;
function setDeepProps(obj, key, isEnd, nextKey, value) {
  if (obj[key]) {
    if (isEnd) {
      obj[key] = value;
    }
  } else {
    var index;
    var rest;
    var currMatchs = key ? key.match(sKeyRE) : null;
    if (isEnd) {
      rest = value;
    } else {
      var nextMatchs = nextKey ? nextKey.match(sKeyRE) : null;
      if (nextMatchs && !nextMatchs[1]) {
        // 如果下一个属性为数组类型
        rest = new Array(staticParseInt_1(nextMatchs[2]) + 1);
      } else {
        rest = {};
      }
    }
    if (currMatchs) {
      if (currMatchs[1]) {
        // 如果为对象中数组
        index = staticParseInt_1(currMatchs[2]);
        if (obj[currMatchs[1]]) {
          if (isEnd) {
            obj[currMatchs[1]][index] = rest;
          } else {
            if (obj[currMatchs[1]][index]) {
              rest = obj[currMatchs[1]][index];
            } else {
              obj[currMatchs[1]][index] = rest;
            }
          }
        } else {
          obj[currMatchs[1]] = new Array(index + 1);
          obj[currMatchs[1]][index] = rest;
        }
      } else {
        // 如果为数组
        obj[currMatchs[2]] = rest;
      }
    } else {
      // 如果为对象
      obj[key] = rest;
    }
    return rest;
  }
  return obj[key];
}

/**
 * 设置对象属性上的值。如果属性不存在则创建它
 * @param {Object/Array} obj 对象
 * @param {String/Function} property 键、路径
 * @param {Object} value 值
 */
function set$2(obj, property, value) {
  if (obj && helperCheckCopyKey_1(property)) {
    if ((obj[property] || hasOwnProp_1(obj, property)) && !isPrototypePolluted(property)) {
      obj[property] = value;
    } else {
      var rest = obj;
      var props = helperGetHGSKeys_1(property);
      var len = props.length;
      for (var index = 0; index < len; index++) {
        if (isPrototypePolluted(props[index])) {
          continue;
        }
        var isEnd = index === len - 1;
        rest = setDeepProps(rest, props[index], isEnd, isEnd ? null : props[index + 1], value);
      }
    }
  }
  return obj;
}

/**
 * Blacklist certain keys to prevent Prototype Pollution
 * @param {string} key
 */
function isPrototypePolluted(key) {
  return key === '__proto__' || key === 'constructor' || key === 'prototype';
}
var set_1 = set$2;

function createiterateEmpty(iterate) {
  return function () {
    return isEmpty_1(iterate);
  };
}

/**
  * 集合分组,默认使用键值分组,如果有iterate则使用结果进行分组
  *
  * @param {Array} obj 对象
  * @param {Function} iterate 回调/对象属性
  * @param {Object} context 上下文
  * @return {Object}
  */
function groupBy(obj, iterate, context) {
  var groupKey;
  var result = {};
  if (obj) {
    if (iterate && isObject_1(iterate)) {
      iterate = createiterateEmpty(iterate);
    } else if (!isFunction_1$1(iterate)) {
      iterate = property_1(iterate);
    }
    each_1(obj, function (val, key) {
      groupKey = iterate ? iterate.call(context, val, key, obj) : val;
      if (result[groupKey]) {
        result[groupKey].push(val);
      } else {
        result[groupKey] = [val];
      }
    });
  }
  return result;
}
var groupBy_1 = groupBy;

/**
  * 集合分组统计,返回各组中对象的数量统计
  *
  * @param {Array} obj 对象
  * @param {Function} iterate 回调/对象属性
  * @param {Object} context 上下文
  * @return {Object}
  */
function countBy(obj, iterate, context) {
  var result = groupBy_1(obj, iterate, context || this);
  objectEach_1(result, function (item, key) {
    result[key] = item.length;
  });
  return result;
}
var countBy_1 = countBy;

/**
  * 序号列表生成函数
  *
  * @param {Number} start 起始值
  * @param {Number} stop 结束值
  * @param {Number} step 自增值
  * @return {Array}
  */
function range(start, stop, step) {
  var index, len;
  var result = [];
  var args = arguments;
  if (args.length < 2) {
    stop = args[0];
    start = 0;
  }
  index = start >> 0;
  len = stop >> 0;
  if (index < stop) {
    step = step >> 0 || 1;
    for (; index < len; index += step) {
      result.push(index);
    }
  }
  return result;
}
var range_1 = range;

/**
  * 将一个或者多个对象值解构到目标对象
  *
  * @param {Object} destination 目标对象
  * @param {...Object}
  * @return {Boolean}
  */
function destructuring(destination, sources) {
  if (destination && sources) {
    var rest = assign_1.apply(this, [{}].concat(slice_1(arguments, 1)));
    var restKeys = keys_1(rest);
    arrayEach_1(keys_1(destination), function (key) {
      if (includes_1(restKeys, key)) {
        destination[key] = rest[key];
      }
    });
  }
  return destination;
}
var destructuring_1 = destructuring;

/**
  * 获取最小值
  *
  * @param {Array} arr 数组
  * @param {Function} iterate(item, index, obj) 回调
  * @return {Number}
  */
var min$5 = helperCreateMinMax_1(function (rest, itemVal) {
  return rest > itemVal;
});
var min_1 = min$5;

function helperNumberDecimal(numStr) {
  return (numStr.split('.')[1] || '').length;
}
var helperNumberDecimal_1 = helperNumberDecimal;

function helperStringRepeat(str, count) {
  if (str.repeat) {
    return str.repeat(count);
  }
  var list = isNaN(count) ? [] : new Array(staticParseInt_1(count));
  return list.join(str) + (list.length > 0 ? str : '');
}
var helperStringRepeat_1 = helperStringRepeat;

function helperNumberOffsetPoint(str, offsetIndex) {
  return str.substring(0, offsetIndex) + '.' + str.substring(offsetIndex, str.length);
}
var helperNumberOffsetPoint_1 = helperNumberOffsetPoint;

/**
 * 数值转字符串，科学计数转字符串
 * @param { Number } num 数值
 *
 * @return {Number}
 */
function toNumberString(num) {
  var rest = '' + num;
  var scienceMatchs = rest.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);
  if (scienceMatchs) {
    var isNegative = num < 0;
    var absFlag = isNegative ? '-' : '';
    var intNumStr = scienceMatchs[3] || '';
    var dIntNumStr = scienceMatchs[5] || '';
    var dFloatNumStr = scienceMatchs[6] || '';
    var sciencFlag = scienceMatchs[7];
    var scienceNumStr = scienceMatchs[8];
    var floatOffsetIndex = scienceNumStr - dFloatNumStr.length;
    var intOffsetIndex = scienceNumStr - intNumStr.length;
    var dIntOffsetIndex = scienceNumStr - dIntNumStr.length;
    if (sciencFlag === '+') {
      if (intNumStr) {
        return absFlag + intNumStr + helperStringRepeat_1('0', scienceNumStr);
      }
      if (floatOffsetIndex > 0) {
        return absFlag + dIntNumStr + dFloatNumStr + helperStringRepeat_1('0', floatOffsetIndex);
      }
      return absFlag + dIntNumStr + helperNumberOffsetPoint_1(dFloatNumStr, scienceNumStr);
    }
    if (intNumStr) {
      if (intOffsetIndex > 0) {
        return absFlag + '0.' + helperStringRepeat_1('0', Math.abs(intOffsetIndex)) + intNumStr;
      }
      return absFlag + helperNumberOffsetPoint_1(intNumStr, intOffsetIndex);
    }
    if (dIntOffsetIndex > 0) {
      return absFlag + '0.' + helperStringRepeat_1('0', Math.abs(dIntOffsetIndex)) + dIntNumStr + dFloatNumStr;
    }
    return absFlag + helperNumberOffsetPoint_1(dIntNumStr, dIntOffsetIndex) + dFloatNumStr;
  }
  return rest;
}
var toNumberString_1 = toNumberString;

function helperMultiply(multiplier, multiplicand) {
  var str1 = toNumberString_1(multiplier);
  var str2 = toNumberString_1(multiplicand);
  return parseInt(str1.replace('.', '')) * parseInt(str2.replace('.', '')) / Math.pow(10, helperNumberDecimal_1(str1) + helperNumberDecimal_1(str2));
}
var helperMultiply_1 = helperMultiply;

function helperCreateMathNumber(name) {
  return function (num, digits) {
    var numRest = toNumber_1(num);
    var rest = numRest;
    if (numRest) {
      digits = digits >> 0;
      var numStr = toNumberString_1(numRest);
      var nums = numStr.split('.');
      var intStr = nums[0];
      var floatStr = nums[1] || '';
      var fStr = floatStr.substring(0, digits + 1);
      var subRest = intStr + (fStr ? '.' + fStr : '');
      if (digits >= floatStr.length) {
        return toNumber_1(subRest);
      }
      subRest = numRest;
      if (digits > 0) {
        var ratio = Math.pow(10, digits);
        rest = Math[name](helperMultiply_1(subRest, ratio)) / ratio;
      } else {
        rest = Math[name](subRest);
      }
    }
    return rest;
  };
}
var helperCreateMathNumber_1 = helperCreateMathNumber;

/**
 * 将数值四舍五入
 *
 * @param {string|number} num 数值
 * @param {number} digits 小数保留位数
 * @return {number}
 */
var round$6 = helperCreateMathNumber_1('round');
var round_1 = round$6;

/**
 * 将数值向上舍入
 *
 * @param {string|number} num 数值
 * @param {number} digits 小数保留位数
 * @return {number}
 */
var ceil$1 = helperCreateMathNumber_1('ceil');
var ceil_1 = ceil$1;

/**
 * 将数值向下舍入
 *
 * @param {string|number} num 数值
 * @param {number} digits 小数保留位数
 * @return {number}
 */
var floor$1 = helperCreateMathNumber_1('floor');
var floor_1 = floor$1;

function toValueString(obj) {
  if (isNumber_1(obj)) {
    return toNumberString_1(obj);
  }
  return '' + (eqNull_1(obj) ? '' : obj);
}
var toValueString_1 = toValueString;

/**
  * 将数值四舍五入并格式化为固定小数位的字符串
  *
 * @param {string|number} num 数值
 * @param {number} digits 小数保留位数
  * @return {String}
  */
function toFixed(num, digits) {
  digits = digits >> 0;
  var str = toValueString_1(round_1(num, digits));
  var nums = str.split('.');
  var intStr = nums[0];
  var floatStr = nums[1] || '';
  var digitOffsetIndex = digits - floatStr.length;
  if (digits) {
    if (digitOffsetIndex > 0) {
      return intStr + '.' + floatStr + helperStringRepeat_1('0', digitOffsetIndex);
    }
    return intStr + helperNumberOffsetPoint_1(floatStr, Math.abs(digitOffsetIndex));
  }
  return intStr;
}
var toFixed_1 = toFixed;

/**
  * 千分位分隔符、小数点
  *
  * @param {String/Number} num 数值
  * @param {CommafyOptions} options 参数
  * @return {String}
 */
function commafy(num, options) {
  var opts = assign_1({}, setupDefaults_1.commafyOptions, options);
  var optDigits = opts.digits;
  var isNum = isNumber_1(num);
  var rest, result, isNegative, intStr, floatStr;
  if (isNum) {
    rest = (opts.ceil ? ceil_1 : opts.floor ? floor_1 : round_1)(num, optDigits);
    result = toNumberString_1(optDigits ? toFixed_1(rest, optDigits) : rest).split('.');
    intStr = result[0];
    floatStr = result[1];
    isNegative = intStr && rest < 0;
    if (isNegative) {
      intStr = intStr.substring(1, intStr.length);
    }
  } else {
    rest = toValueString_1(num).replace(/,/g, '');
    result = rest ? [rest] : [];
    intStr = result[0];
  }
  if (result.length) {
    return (isNegative ? '-' : '') + intStr.replace(new RegExp('(?=(?!(\\b))(.{' + (opts.spaceNumber || 3) + '})+$)', 'g'), opts.separator || ',') + (floatStr ? '.' + floatStr : '');
  }
  return rest;
}
var commafy_1 = commafy;

/**
 * 转整数
 * @param { String/Number } str 数值
 *
 * @return {Number}
 */
var toInteger = helperCreateToNumber_1(staticParseInt_1);
var toInteger_1 = toInteger;

/**
 * 乘法运算
 *
 * @param { Number } num1 数值1
 * @param { Number } num2 数值2
 * @return {Number}
 */
function multiply(num1, num2) {
  var multiplier = toNumber_1(num1);
  var multiplicand = toNumber_1(num2);
  return helperMultiply_1(multiplier, multiplicand);
}
var multiply_1 = multiply;

function helperNumberAdd(addend, augend) {
  var str1 = toNumberString_1(addend);
  var str2 = toNumberString_1(augend);
  var ratio = Math.pow(10, Math.max(helperNumberDecimal_1(str1), helperNumberDecimal_1(str2)));
  return (multiply_1(addend, ratio) + multiply_1(augend, ratio)) / ratio;
}
var helperNumberAdd_1 = helperNumberAdd;

/**
 * 加法运算
 *
 * @param { Number } num1 被加数
 * @param { Number } num2 加数
 * @return {Number}
 */
function add$2(num1, num2) {
  return helperNumberAdd_1(toNumber_1(num1), toNumber_1(num2));
}
var add_1 = add$2;

/**
 * 减法运算
 *
 * @param { Number } num1 被减数
 * @param { Number } num2 减数
 * @return {Number}
 */
function subtract(num1, num2) {
  var subtrahend = toNumber_1(num1);
  var minuend = toNumber_1(num2);
  var str1 = toNumberString_1(subtrahend);
  var str2 = toNumberString_1(minuend);
  var digit1 = helperNumberDecimal_1(str1);
  var digit2 = helperNumberDecimal_1(str2);
  var ratio = Math.pow(10, Math.max(digit1, digit2));
  var precision = digit1 >= digit2 ? digit1 : digit2;
  return parseFloat(toFixed_1((subtrahend * ratio - minuend * ratio) / ratio, precision));
}
var subtract_1 = subtract;

function helperNumberDivide(divisor, dividend) {
  var str1 = toNumberString_1(divisor);
  var str2 = toNumberString_1(dividend);
  var divisorDecimal = helperNumberDecimal_1(str1);
  var dividendDecimal = helperNumberDecimal_1(str2);
  var powY = dividendDecimal - divisorDecimal;
  var isMinus = powY < 0;
  var multiplicand = Math.pow(10, isMinus ? Math.abs(powY) : powY);
  return multiply_1(str1.replace('.', '') / str2.replace('.', ''), isMinus ? 1 / multiplicand : multiplicand);
}
var helperNumberDivide_1 = helperNumberDivide;

/**
 * 除法运算
 *
 * @param { Number } num1 数值1
 * @param { Number } num2 数值2
 * @return {Number}
 */
function divide(num1, num2) {
  return helperNumberDivide_1(toNumber_1(num1), toNumber_1(num2));
}
var divide_1 = divide;

/**
  * 求和函数，将数值相加
  *
  * @param {Array} array 数组
  * @param {Function/String} iterate 方法或属性
  * @param {Object} context 上下文
  * @return {Number}
  */
function sum$1(array, iterate, context) {
  var result = 0;
  each_1(array && array.length > 2 && isArray_1(array) ? array.sort() : array, iterate ? isFunction_1$1(iterate) ? function () {
    result = helperNumberAdd_1(result, iterate.apply(context, arguments));
  } : function (val) {
    result = helperNumberAdd_1(result, get_1(val, iterate));
  } : function (val) {
    result = helperNumberAdd_1(result, val);
  });
  return result;
}
var sum_1 = sum$1;

/**
  * 求平均值函数
  *
  * @param {Array} array 数组
  * @param {Function/String} iterate 方法或属性
  * @param {Object} context 上下文
  * @return {Number}
  */
function mean(array, iterate, context) {
  return helperNumberDivide_1(sum_1(array, iterate, context), getSize_1(array));
}
var mean_1 = mean;

var staticStrFirst = 'first';
var staticStrFirst_1 = staticStrFirst;

var staticStrLast = 'last';
var staticStrLast_1 = staticStrLast;

function helperGetDateFullYear(date) {
  return date.getFullYear();
}
var helperGetDateFullYear_1 = helperGetDateFullYear;

var staticDayTime = 86400000;
var staticDayTime_1 = staticDayTime;

function helperGetDateMonth(date) {
  return date.getMonth();
}
var helperGetDateMonth_1 = helperGetDateMonth;

/**
  * 判断是否有效的Date对象
  *
  * @param {any} val 对象
  * @return {boolean}
  */
function isValidDate(val) {
  return isDate_1(val) && !isNaN(helperGetDateTime_1(val));
}
var isValidDate_1 = isValidDate;

/**
  * 返回前几月或后几月的日期
  *
  * @param {Date} date 日期或数字
  * @param {Number} offsetMonth 月(默认当前月)、前几个月、后几个月
  * @param {Number/String} offsetDay 获取哪天：月初(first)、月末(last)、指定天数(数值)，如果为空，但超过指定月份的天数时，则默认单月最后一天
  * @return {Date}
  */
function getWhatMonth(date, offsetMonth, offsetDay) {
  var monthNum = offsetMonth && !isNaN(offsetMonth) ? offsetMonth : 0;
  date = toStringDate_1(date);
  if (isValidDate_1(date)) {
    if (offsetDay === staticStrFirst_1) {
      return new Date(helperGetDateFullYear_1(date), helperGetDateMonth_1(date) + monthNum, 1);
    } else if (offsetDay === staticStrLast_1) {
      return new Date(helperGetDateTime_1(getWhatMonth(date, monthNum + 1, staticStrFirst_1)) - 1);
    } else if (isNumber_1(offsetDay)) {
      date.setDate(offsetDay);
    }
    if (monthNum) {
      var currDate = date.getDate();
      date.setMonth(helperGetDateMonth_1(date) + monthNum);
      if (currDate !== date.getDate()) {
        // 当为指定天数，且被跨月了，则默认单月最后一天
        date.setDate(1);
        return new Date(helperGetDateTime_1(date) - staticDayTime_1);
      }
    }
  }
  return date;
}
var getWhatMonth_1 = getWhatMonth;

/**
  * 返回前几年或后几年的日期
  *
  * @param {Date} date 日期或数字
  * @param {Number} offset 年(默认当前年)、前几个年(数值)、后几个年(数值)
  * @param {Number/String} month 获取哪月(null默认当前年)、年初(first)、年末(last)、指定月份（0-11）
  * @return {Date}
  */
function getWhatYear(date, offset, month) {
  var number;
  date = toStringDate_1(date);
  if (isValidDate_1(date)) {
    if (offset) {
      number = offset && !isNaN(offset) ? offset : 0;
      date.setFullYear(helperGetDateFullYear_1(date) + number);
    }
    if (month || !isNaN(month)) {
      if (month === staticStrFirst_1) {
        return new Date(helperGetDateFullYear_1(date), 0, 1);
      } else if (month === staticStrLast_1) {
        date.setMonth(11);
        return getWhatMonth_1(date, 0, staticStrLast_1);
      } else {
        date.setMonth(month);
      }
    }
  }
  return date;
}
var getWhatYear_1 = getWhatYear;

function getQuarterNumber(date) {
  var month = date.getMonth();
  if (month < 3) {
    return 1;
  } else if (month < 6) {
    return 2;
  } else if (month < 9) {
    return 3;
  }
  return 4;
}

/**
  * 返回前几季度或后几季度的日期
  *
  * @param {Date} date 日期
  * @param {Number} offset 季度(默认当前季度)、前几季度、后几季度
  * @param {Number} day 获取哪天：月初(first)、月末(last)、指定天数(数值)，如果为空，但超过指定月份的天数时，则默认单月最后一天
  * @return {Date}
  */
function getWhatQuarter(date, offset, day) {
  var currMonth,
    monthOffset = offset && !isNaN(offset) ? offset * 3 : 0;
  date = toStringDate_1(date);
  if (isValidDate_1(date)) {
    currMonth = (getQuarterNumber(date) - 1) * 3;
    date.setMonth(currMonth);
    return getWhatMonth_1(date, monthOffset, day);
  }
  return date;
}
var getWhatQuarter_1 = getWhatQuarter;

/**
  * 返回前几天或后几天的日期
  *
  * @param {Date} date 日期或数字
  * @param {Number} offset 天(默认当天)、前几天、后几天
  * @param {String} mode 获取时分秒(null默认当前时分秒)、日初(first)、日末(last)
  * @return {Date}
  */
function getWhatDay(date, offset, mode) {
  date = toStringDate_1(date);
  if (isValidDate_1(date) && !isNaN(offset)) {
    date.setDate(date.getDate() + staticParseInt_1(offset));
    if (mode === staticStrFirst_1) {
      return new Date(helperGetDateFullYear_1(date), helperGetDateMonth_1(date), date.getDate());
    } else if (mode === staticStrLast_1) {
      return new Date(helperGetDateTime_1(getWhatDay(date, 1, staticStrFirst_1)) - 1);
    }
  }
  return date;
}
var getWhatDay_1 = getWhatDay;

function helperStringUpperCase(str) {
  return str.toUpperCase();
}
var helperStringUpperCase_1 = helperStringUpperCase;

var staticWeekTime = staticDayTime_1 * 7;
var staticWeekTime_1 = staticWeekTime;

/**
  * 返回前几周或后几周的星期几
  *
  * @param {Date} date 日期
  * @param {Number} offsetWeek 周(默认当前周)、前几周、后几周
  * @param {Number} offsetDay 星期天(默认0)、星期一(1)、星期二(2)、星期三(3)、星期四(4)、星期五(5)、星期六(6)
  * @param {Number} firstDay 周视图的起始天，默认星期一
  * @return {Date}
  */
function getWhatWeek(date, offsetWeek, offsetDay, firstDay) {
  date = toStringDate_1(date);
  if (isValidDate_1(date)) {
    var hasCustomDay = isNumber_1(offsetDay);
    var hasStartDay = isNumber_1(firstDay);
    var whatDayTime = helperGetDateTime_1(date);
    // 如果指定了天或周视图起始天
    if (hasCustomDay || hasStartDay) {
      var viewStartDay = hasStartDay ? firstDay : setupDefaults_1.firstDayOfWeek;
      var currentDay = date.getDay();
      var customDay = hasCustomDay ? offsetDay : currentDay;
      if (currentDay !== customDay) {
        var offsetNum = 0;
        if (viewStartDay > currentDay) {
          offsetNum = -(7 - viewStartDay + currentDay);
        } else if (viewStartDay < currentDay) {
          offsetNum = viewStartDay - currentDay;
        }
        if (customDay > viewStartDay) {
          whatDayTime += ((customDay === 0 ? 7 : customDay) - viewStartDay + offsetNum) * staticDayTime_1;
        } else if (customDay < viewStartDay) {
          whatDayTime += (7 - viewStartDay + customDay + offsetNum) * staticDayTime_1;
        } else {
          whatDayTime += offsetNum * staticDayTime_1;
        }
      }
    }
    if (offsetWeek && !isNaN(offsetWeek)) {
      whatDayTime += offsetWeek * staticWeekTime_1;
    }
    return new Date(whatDayTime);
  }
  return date;
}
var getWhatWeek_1 = getWhatWeek;

var nextStartMaps = map_1(range_1(0, 7), function (day) {
  return [(day + 1) % 7, (day + 2) % 7, (day + 3) % 7];
});
function matchWeekStartDay(time, viewStartDay) {
  var day = new Date(time).getDay();
  return includes_1(nextStartMaps[viewStartDay], day);
}
function helperCreateGetDateWeek(getStartDate, checkCrossDate) {
  return function (date, firstDay) {
    var viewStartDay = isNumber_1(firstDay) ? firstDay : setupDefaults_1.firstDayOfWeek;
    var targetDate = toStringDate_1(date);
    if (isValidDate_1(targetDate)) {
      var targetWeekStartDate = getWhatWeek_1(targetDate, 0, viewStartDay, viewStartDay);
      var firstDate = getStartDate(targetWeekStartDate);
      var firstTime = helperGetDateTime_1(firstDate);
      var targetWeekStartTime = helperGetDateTime_1(targetWeekStartDate);
      var targetWeekEndTime = targetWeekStartTime + staticDayTime_1 * 6;
      var targetWeekEndDate = new Date(targetWeekEndTime);
      var firstWeekStartDate = getWhatWeek_1(firstDate, 0, viewStartDay, viewStartDay);
      var firstWeekStartTime = helperGetDateTime_1(firstWeekStartDate);
      var tempTime;
      if (targetWeekStartTime === firstWeekStartTime) {
        return 1;
      }
      if (checkCrossDate(targetWeekStartDate, targetWeekEndDate)) {
        tempTime = helperGetDateTime_1(getStartDate(targetWeekEndDate));
        for (; tempTime < targetWeekEndTime; tempTime += staticDayTime_1) {
          if (matchWeekStartDay(tempTime, viewStartDay)) {
            return 1;
          }
        }
      }
      var firstWeekEndTime = firstWeekStartTime + staticDayTime_1 * 6;
      var firstWeekEndDate = new Date(targetWeekEndTime);
      var offsetNum = 1;
      if (checkCrossDate(firstWeekStartDate, firstWeekEndDate)) {
        offsetNum = 0;
        tempTime = firstTime;
        for (; tempTime < firstWeekEndTime; tempTime += staticDayTime_1) {
          if (matchWeekStartDay(tempTime, viewStartDay)) {
            offsetNum++;
            break;
          }
        }
      }
      return Math.floor((targetWeekStartTime - firstWeekStartTime) / staticWeekTime_1) + offsetNum;
    }
    return NaN;
  };
}
var helperCreateGetDateWeek_1 = helperCreateGetDateWeek;

/**
  * 返回某个年份的第几周
  *
  * @param {Date} date 日期或数字
  * @param {Number} firstDay 从年初的星期几为起始开始周开始算，默认星期一
  * @return {Number}
  */
var getYearWeek = helperCreateGetDateWeek_1(function (targetDate) {
  return new Date(targetDate.getFullYear(), 0, 1);
}, function (date1, date2) {
  return date1.getFullYear() !== date2.getFullYear();
});
var getYearWeek_1 = getYearWeek;

function helperGetYMD(date) {
  return new Date(helperGetDateFullYear_1(date), helperGetDateMonth_1(date), date.getDate());
}
var helperGetYMD_1 = helperGetYMD;

function helperGetYMDTime(date) {
  return helperGetDateTime_1(helperGetYMD_1(date));
}
var helperGetYMDTime_1 = helperGetYMDTime;

/**
  * 返回某个年份的第几天
  *
  * @param {Date} date 日期或数字
  * @return {Number}
  */
function getYearDay(date) {
  date = toStringDate_1(date);
  if (isValidDate_1(date)) {
    return Math.floor((helperGetYMDTime_1(date) - helperGetYMDTime_1(getWhatYear_1(date, 0, staticStrFirst_1))) / staticDayTime_1) + 1;
  }
  return NaN;
}
var getYearDay_1 = getYearDay;

/**
  * 用指定字符从前面开始补全字符串
  *
  * @param {String} str 字符串
  * @param {Number} targetLength 结果长度
  * @param {Number} padString 补全字符
  * @return {String}
  */
function padStart(str, targetLength, padString) {
  var rest = toValueString_1(str);
  targetLength = targetLength >> 0;
  padString = isUndefined_1(padString) ? ' ' : '' + padString;
  if (rest.padStart) {
    return rest.padStart(targetLength, padString);
  }
  if (targetLength > rest.length) {
    targetLength -= rest.length;
    if (targetLength > padString.length) {
      padString += helperStringRepeat_1(padString, targetLength / padString.length);
    }
    return padString.slice(0, targetLength) + rest;
  }
  return rest;
}
var padStart_1 = padStart;

function handleCustomTemplate(date, formats, match, value) {
  var format = formats[match];
  if (format) {
    if (isFunction_1$1(format)) {
      return format(value, match, date);
    } else {
      return format[value];
    }
  }
  return value;
}
var dateFormatRE = /\[([^\]]+)]|y{2,4}|M{1,2}|d{1,2}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|S{1,3}|Z{1,2}|W{1,2}|D{1,3}|[aAeEq]/g;

/**
  * 日期格式化为字符串，转义符号 []
  *
  * @param {Date} date 日期或数字
  * @param {String} format 输出日期格式(年份(yy|yyyy)、月份(M|MM自动补0)、天(d|dd自动补0)、12小时制(h|hh自动补0)、24小时制(H|HH自动补0)、分钟(m|mm自动补0)、秒(s|ss自动补0)、毫秒(S|SSS自动补0)、D当年的第几天、a/A上午下午、e/E星期几、w当年的第几周、W当月的第几周、q当年第几个季度、Z时区)
  * @param {Object} options {formats: {q: ['日', '一', '二', '三', '四', '五', '六'], E: function (value, match, date) {return '三'}, }} 自定义格式化模板
  * @return {String}
  */
function toDateString(date, format, options) {
  if (date) {
    date = toStringDate_1(date);
    if (isValidDate_1(date)) {
      var result = format || setupDefaults_1.parseDateFormat || setupDefaults_1.formatString;
      var hours = date.getHours();
      var apm = hours < 12 ? 'am' : 'pm';
      var formats = assign_1({}, setupDefaults_1.parseDateRules || setupDefaults_1.formatStringMatchs, options ? options.formats : null);
      var fy = function (match, length) {
        return ('' + helperGetDateFullYear_1(date)).substr(4 - length);
      };
      var fM = function (match, length) {
        return padStart_1(helperGetDateMonth_1(date) + 1, length, '0');
      };
      var fd = function (match, length) {
        return padStart_1(date.getDate(), length, '0');
      };
      var fH = function (match, length) {
        return padStart_1(hours, length, '0');
      };
      var fh = function (match, length) {
        return padStart_1(hours <= 12 ? hours : hours - 12, length, '0');
      };
      var fm = function (match, length) {
        return padStart_1(date.getMinutes(), length, '0');
      };
      var fs = function (match, length) {
        return padStart_1(date.getSeconds(), length, '0');
      };
      var fS = function (match, length) {
        return padStart_1(date.getMilliseconds(), length, '0');
      };
      var fZ = function (match, length) {
        var zoneHours = date.getTimezoneOffset() / 60 * -1;
        return handleCustomTemplate(date, formats, match, (zoneHours >= 0 ? '+' : '-') + padStart_1(zoneHours, 2, '0') + (length === 1 ? ':' : '') + '00');
      };
      var fW = function (match, length) {
        return padStart_1(handleCustomTemplate(date, formats, match, getYearWeek_1(date, (options ? options.firstDay : null) || setupDefaults_1.firstDayOfWeek)), length, '0');
      };
      var fD = function (match, length) {
        return padStart_1(handleCustomTemplate(date, formats, match, getYearDay_1(date)), length, '0');
      };
      var parseDates = {
        yyyy: fy,
        yy: fy,
        MM: fM,
        M: fM,
        dd: fd,
        d: fd,
        HH: fH,
        H: fH,
        hh: fh,
        h: fh,
        mm: fm,
        m: fm,
        ss: fs,
        s: fs,
        SSS: fS,
        S: fS,
        ZZ: fZ,
        Z: fZ,
        WW: fW,
        W: fW,
        DDD: fD,
        D: fD,
        a: function (match) {
          return handleCustomTemplate(date, formats, match, apm);
        },
        A: function (match) {
          return handleCustomTemplate(date, formats, match, helperStringUpperCase_1(apm));
        },
        e: function (match) {
          return handleCustomTemplate(date, formats, match, date.getDay());
        },
        E: function (match) {
          return handleCustomTemplate(date, formats, match, date.getDay());
        },
        q: function (match) {
          return handleCustomTemplate(date, formats, match, Math.floor((helperGetDateMonth_1(date) + 3) / 3));
        }
      };
      return result.replace(dateFormatRE, function (match, skip) {
        return skip || (parseDates[match] ? parseDates[match](match, match.length) : match);
      });
    }
    return 'Invalid Date';
  }
  return '';
}
var toDateString_1 = toDateString;

/**
 * 返回当前时间戳
 *
 * @returns Number
 */
var now = Date.now || function () {
  return helperGetDateTime_1(helperNewDate_1());
};
var now_1 = now;

/**
 * 将日期格式化为时间戳
 *
  * @param {String/Number/Date} str 日期或数字
  * @param {String} format 解析日期格式
 * @returns Number
 */
var timestamp = function (str, format) {
  if (str) {
    var date = toStringDate_1(str, format);
    return isDate_1(date) ? helperGetDateTime_1(date) : date;
  }
  return now_1();
};
var timestamp_1 = timestamp;

/**
 * 比较两个日期
 *
 * @param {Number/String/Date} date1 日期
 * @param {Number/String/Date} date2 日期
 * @param {String} format 对比格式
 */
function isDateSame(date1, date2, format) {
  if (date1 && date2) {
    date1 = toDateString_1(date1, format);
    return date1 !== 'Invalid Date' && date1 === toDateString_1(date2, format);
  }
  return false;
}
var isDateSame_1 = isDateSame;

/**
  * 返回某个月的第几周
  *
  * @param {Date} date 日期或数字
  * @param {Number} firstDay 周视图的起始天，默认星期一
  * @return {Number}
  */
var getMonthWeek = helperCreateGetDateWeek_1(function (targetDate) {
  return new Date(targetDate.getFullYear(), targetDate.getMonth(), 1);
}, function (date1, date2) {
  return date1.getMonth() !== date2.getMonth();
});
var getMonthWeek_1 = getMonthWeek;

/**
  * 返回某个年份的天数
  *
  * @param {Date} date 日期或数字
  * @param {Number} offset 年(默认当年)、前几个年、后几个年
  * @return {Number}
  */
function getDayOfYear(date, year) {
  date = toStringDate_1(date);
  if (isValidDate_1(date)) {
    return isLeapYear_1(getWhatYear_1(date, year)) ? 366 : 365;
  }
  return NaN;
}
var getDayOfYear_1 = getDayOfYear;

/**
  * 返回某个月份的天数
  *
  * @param {Date} date 日期或数字
  * @param {Number} offset 月(默认当月)、前几个月、后几个月
  * @return {Number}
  */
function getDayOfMonth(date, month) {
  date = toStringDate_1(date);
  if (isValidDate_1(date)) {
    return Math.floor((helperGetDateTime_1(getWhatMonth_1(date, month, staticStrLast_1)) - helperGetDateTime_1(getWhatMonth_1(date, month, staticStrFirst_1))) / staticDayTime_1) + 1;
  }
  return NaN;
}
var getDayOfMonth_1 = getDayOfMonth;

var dateDiffRules = [['yyyy', 31536000000], ['MM', 2592000000], ['dd', 86400000], ['HH', 3600000], ['mm', 60000], ['ss', 1000], ['S', 0]];

/**
  * 返回两个日期之间差距,如果结束日期小于开始日期done为fasle
  *
  * @param {Date} startDate 开始日期
  * @param {Date} endDate 结束日期或当期日期
  * @return {Object}
  */
function getDateDiff(startDate, endDate) {
  var startTime, endTime, item, diffTime, len, index;
  var result = {
    done: false,
    time: 0
  };
  startDate = toStringDate_1(startDate);
  endDate = endDate ? toStringDate_1(endDate) : helperNewDate_1();
  if (isValidDate_1(startDate) && isValidDate_1(endDate)) {
    startTime = helperGetDateTime_1(startDate);
    endTime = helperGetDateTime_1(endDate);
    if (startTime < endTime) {
      diffTime = result.time = endTime - startTime;
      result.done = true;
      for (index = 0, len = dateDiffRules.length; index < len; index++) {
        item = dateDiffRules[index];
        if (diffTime >= item[1]) {
          if (index === len - 1) {
            result[item[0]] = diffTime || 0;
          } else {
            result[item[0]] = Math.floor(diffTime / item[1]);
            diffTime -= result[item[0]] * item[1];
          }
        } else {
          result[item[0]] = 0;
        }
      }
    }
  }
  return result;
}
var getDateDiff_1 = getDateDiff;

/**
  * 用指定字符从后面开始补全字符串
  *
  * @param {String} str 字符串
  * @param {Number} targetLength 结果长度
  * @param {Number} padString 补全字符
  * @return {String}
  */
function padEnd(str, targetLength, padString) {
  var rest = toValueString_1(str);
  targetLength = targetLength >> 0;
  padString = isUndefined_1(padString) ? ' ' : '' + padString;
  if (rest.padEnd) {
    return rest.padEnd(targetLength, padString);
  }
  if (targetLength > rest.length) {
    targetLength -= rest.length;
    if (targetLength > padString.length) {
      padString += helperStringRepeat_1(padString, targetLength / padString.length);
    }
    return rest + padString.slice(0, targetLength);
  }
  return rest;
}
var padEnd_1 = padEnd;

/**
  * 将字符串重复 n 次
  *
  * @param {String} str 字符串
  * @param {Number} count 次数
  * @return {String}
  */
function repeat(str, count) {
  return helperStringRepeat_1(toValueString_1(str), count);
}
var repeat_1 = repeat;

/**
  * 去除字符串右边的空格
  *
  * @param {String} str 字符串
  * @return {String}
  */
function trimRight$1(str) {
  return str && str.trimRight ? str.trimRight() : toValueString_1(str).replace(/[\s\uFEFF\xA0]+$/g, '');
}
var trimRight_1 = trimRight$1;

/**
  * 去除字符串左边的空格
  *
  * @param {String} str 字符串
  * @return {String}
  */
function trimLeft$1(str) {
  return str && str.trimLeft ? str.trimLeft() : toValueString_1(str).replace(/^[\s\uFEFF\xA0]+/g, '');
}
var trimLeft_1 = trimLeft$1;

/**
  * 去除字符串左右两边的空格
  *
  * @param {String} str 字符串
  * @return {String}
  */
function trim$3(str) {
  return str && str.trim ? str.trim() : trimRight_1(trimLeft_1(str));
}
var trim_1 = trim$3;

var staticEscapeMap = {
  '&': '&amp;',
  '<': '&lt;',
  '>': '&gt;',
  '"': '&quot;',
  "'": '&#x27;',
  '`': '&#x60;'
};
var staticEscapeMap_1 = staticEscapeMap;

function helperFormatEscaper(dataMap) {
  var replaceRegexp = new RegExp('(?:' + keys_1(dataMap).join('|') + ')', 'g');
  return function (str) {
    return toValueString_1(str).replace(replaceRegexp, function (match) {
      return dataMap[match];
    });
  };
}
var helperFormatEscaper_1 = helperFormatEscaper;

/**
  * 转义HTML字符串，替换&, <, >, ", ', `字符
  *
  * @param {String} str 字符串
  * @return {String}
  */
var escape$1 = helperFormatEscaper_1(staticEscapeMap_1);
var _escape = escape$1;

var unescapeMap = {};
each_1(staticEscapeMap_1, function (item, key) {
  unescapeMap[staticEscapeMap_1[key]] = key;
});

/**
  * 反转escape
  *
  * @param {String} str 字符串
  * @return {String}
  */
var unescape$1 = helperFormatEscaper_1(unescapeMap);
var _unescape = unescape$1;

function helperStringSubstring(str, start, end) {
  return str.substring(start, end);
}
var helperStringSubstring_1 = helperStringSubstring;

function helperStringLowerCase(str) {
  return str.toLowerCase();
}
var helperStringLowerCase_1 = helperStringLowerCase;

var camelCacheMaps = {};

/**
  * 将带字符串转成驼峰字符串,例如： project-name 转为 projectName
  *
  * @param {String} str 字符串
  * @return {String}
  */
function camelCase(str) {
  str = toValueString_1(str);
  if (camelCacheMaps[str]) {
    return camelCacheMaps[str];
  }
  var strLen = str.length;
  var rest = str.replace(/([-]+)/g, function (text, flag, index) {
    return index && index + flag.length < strLen ? '-' : '';
  });
  strLen = rest.length;
  rest = rest.replace(/([A-Z]+)/g, function (text, upper, index) {
    var upperLen = upper.length;
    upper = helperStringLowerCase_1(upper);
    if (index) {
      if (upperLen > 2 && index + upperLen < strLen) {
        return helperStringUpperCase_1(helperStringSubstring_1(upper, 0, 1)) + helperStringSubstring_1(upper, 1, upperLen - 1) + helperStringUpperCase_1(helperStringSubstring_1(upper, upperLen - 1, upperLen));
      }
      return helperStringUpperCase_1(helperStringSubstring_1(upper, 0, 1)) + helperStringSubstring_1(upper, 1, upperLen);
    } else {
      if (upperLen > 1 && index + upperLen < strLen) {
        return helperStringSubstring_1(upper, 0, upperLen - 1) + helperStringUpperCase_1(helperStringSubstring_1(upper, upperLen - 1, upperLen));
      }
    }
    return upper;
  }).replace(/(-[a-zA-Z])/g, function (text, upper) {
    return helperStringUpperCase_1(helperStringSubstring_1(upper, 1, upper.length));
  });
  camelCacheMaps[str] = rest;
  return rest;
}
var camelCase_1 = camelCase;

var kebabCacheMaps = {};

/**
  * 将带驼峰字符串转成字符串,例如： projectName 转为 project-name
  *
  * @param {String} str 字符串
  * @return {String}
  */
function kebabCase(str) {
  str = toValueString_1(str);
  if (kebabCacheMaps[str]) {
    return kebabCacheMaps[str];
  }
  if (/^[A-Z]+$/.test(str)) {
    return helperStringLowerCase_1(str);
  }
  var rest = str.replace(/^([a-z])([A-Z]+)([a-z]+)$/, function (text, prevLower, upper, nextLower) {
    var upperLen = upper.length;
    if (upperLen > 1) {
      return prevLower + '-' + helperStringLowerCase_1(helperStringSubstring_1(upper, 0, upperLen - 1)) + '-' + helperStringLowerCase_1(helperStringSubstring_1(upper, upperLen - 1, upperLen)) + nextLower;
    }
    return helperStringLowerCase_1(prevLower + '-' + upper + nextLower);
  }).replace(/^([A-Z]+)([a-z]+)?$/, function (text, upper, nextLower) {
    var upperLen = upper.length;
    return helperStringLowerCase_1(helperStringSubstring_1(upper, 0, upperLen - 1) + '-' + helperStringSubstring_1(upper, upperLen - 1, upperLen) + (nextLower || ''));
  }).replace(/([a-z]?)([A-Z]+)([a-z]?)/g, function (text, prevLower, upper, nextLower, index) {
    var upperLen = upper.length;
    if (upperLen > 1) {
      if (prevLower) {
        prevLower += '-';
      }
      if (nextLower) {
        return (prevLower || '') + helperStringLowerCase_1(helperStringSubstring_1(upper, 0, upperLen - 1)) + '-' + helperStringLowerCase_1(helperStringSubstring_1(upper, upperLen - 1, upperLen)) + nextLower;
      }
    }
    return (prevLower || '') + (index ? '-' : '') + helperStringLowerCase_1(upper) + (nextLower || '');
  });
  rest = rest.replace(/([-]+)/g, function (text, flag, index) {
    return index && index + flag.length < rest.length ? '-' : '';
  });
  kebabCacheMaps[str] = rest;
  return rest;
}
var kebabCase_1 = kebabCase;

/**
  * 判断字符串是否在源字符串的头部
  *
  * @param {String} str 字符串
  * @param {String/Number} val 值
  * @param {Number} startIndex 开始索引
  * @return {String}
  */
function startsWith(str, val, startIndex) {
  var rest = toValueString_1(str);
  return (arguments.length === 1 ? rest : rest.substring(startIndex)).indexOf(val) === 0;
}
var startsWith_1 = startsWith;

/**
  * 判断字符串是否在源字符串的尾部
  *
  * @param {String} str 字符串
  * @param {String/Number} val 值
  * @param {Number} startIndex 开始索引
  * @return {String}
  */
function endsWith(str, val, startIndex) {
  var rest = toValueString_1(str);
  var argsLen = arguments.length;
  return argsLen > 1 && (argsLen > 2 ? rest.substring(0, startIndex).indexOf(val) === startIndex - 1 : rest.indexOf(val) === rest.length - 1);
}
var endsWith_1 = endsWith;

/**
 * 解析动态字符串模板
 * @param {atring} str 字符串模板
 * @param {any | any[]} args 对象
 * @param {any} options 
 */
function template(str, args, options) {
  return toValueString_1(str).replace((options || setupDefaults_1).tmplRE || /\{{2}([.\w[\]\s]+)\}{2}/g, function (match, key) {
    return get_1(args, trim_1(key));
  });
}
var template_1 = template;

/**
 * 字符串格式化占位符
 * @param { string } str 
 * @param { object | any[] } obj 
 */
function toFormatString(str, obj) {
  return template_1(str, obj, {
    tmplRE: /\{([.\w[\]\s]+)\}/g
  });
}
var toFormatString_1 = toFormatString;

/**
 * 一个空的方法，始终返回 undefined，可用于初始化值
 */
function noop$2() {}
var noop_1 = noop$2;

/**
  * 创建一个绑定上下文的函数
  *
  * @param {Function} callback 函数
  * @param {Object} context 上下文
  * @param {*} args 额外的参数
  * @return {Object}
  */
function bind$3(callback, context) {
  var args = slice_1(arguments, 2);
  return function () {
    return callback.apply(context, slice_1(arguments).concat(args));
  };
}
var bind_1 = bind$3;

/**
  * 创建一个只能调用一次的函数,只会返回第一次执行后的结果
  *
  * @param {Function} callback 函数
  * @param {Object} context 上下文
  * @param {*} args 额外的参数
  * @return {Object}
  */
function once(callback, context) {
  var done = false;
  var rest = null;
  var args = slice_1(arguments, 2);
  return function () {
    if (done) {
      return rest;
    }
    rest = callback.apply(context, slice_1(arguments).concat(args));
    done = true;
    return rest;
  };
}
var once_1 = once;

/**
  * 创建一个函数, 调用次数超过 count 次之后执行回调并将所有结果记住后返回
  *
  * @param {Number} count 调用次数
  * @param {Function} callback 完成回调
  * @return {Object}
  */
function after(count, callback, context) {
  var runCount = 0;
  var rests = [];
  return function () {
    var args = arguments;
    runCount++;
    if (runCount <= count) {
      rests.push(args[0]);
    }
    if (runCount >= count) {
      callback.apply(context, [rests].concat(slice_1(args)));
    }
  };
}
var after_1 = after;

/**
  * 创建一个函数, 调用次数不超过 count 次之前执行回调并将所有结果记住后返回
  *
  * @param {Number} count 调用次数
  * @param {Function} callback 完成回调
  * @return {Object}
  */
function before(count, callback, context) {
  var runCount = 0;
  var rests = [];
  context = context || this;
  return function () {
    var args = arguments;
    runCount++;
    if (runCount < count) {
      rests.push(args[0]);
      callback.apply(context, [rests].concat(slice_1(args)));
    }
  };
}
var before_1 = before;

/**
  * 节流函数；当被调用 n 毫秒后才会执行，如果在这时间内又被调用则至少每隔 n 秒毫秒调用一次该函数
  *
  * @param {Function} callback 回调
  * @param {Number} wait 多少秒毫
  * @param {Object} options 参数{leading: 是否在之前执行, trailing: 是否在之后执行}
  * @return {Function}
  */
function throttle$3(callback, wait, options) {
  var args = null;
  var context = null;
  var opts = options || {};
  var runFlag = false;
  var timeout = null;
  var optLeading = 'leading' in opts ? opts.leading : true;
  var optTrailing = 'trailing' in opts ? opts.trailing : false;
  var gcFn = function () {
    args = null;
    context = null;
  };
  var runFn = function () {
    runFlag = true;
    callback.apply(context, args);
    timeout = setTimeout(endFn, wait);
    gcFn();
  };
  var endFn = function () {
    timeout = null;
    if (!runFlag && optTrailing === true) {
      runFn();
    }
  };
  var cancelFn = function () {
    var rest = timeout !== null;
    if (rest) {
      clearTimeout(timeout);
    }
    gcFn();
    timeout = null;
    runFlag = false;
    return rest;
  };
  var throttled = function () {
    args = arguments;
    context = this;
    runFlag = false;
    if (timeout === null) {
      if (optLeading === true) {
        runFn();
      } else if (optTrailing === true) {
        timeout = setTimeout(endFn, wait);
      }
    }
  };
  throttled.cancel = cancelFn;
  return throttled;
}
var throttle_1 = throttle$3;

/**
  * 函数去抖；当被调用 n 毫秒后才会执行，如果在这时间内又被调用则将重新计算执行时间
  *
  * @param {Function} callback 回调
  * @param {Number} wait 多少秒毫
  * @param {Object} options 参数{leading: 是否在之前执行, trailing: 是否在之后执行}
  * @return {Function}
  */
function debounce$3(callback, wait, options) {
  var args = null;
  var context = null;
  var opts = options || {};
  var runFlag = false;
  var timeout = null;
  var isLeading = typeof options === 'boolean';
  var optLeading = 'leading' in opts ? opts.leading : isLeading;
  var optTrailing = 'trailing' in opts ? opts.trailing : !isLeading;
  var gcFn = function () {
    args = null;
    context = null;
  };
  var runFn = function () {
    runFlag = true;
    callback.apply(context, args);
    gcFn();
  };
  var endFn = function () {
    if (optLeading === true) {
      timeout = null;
    }
    if (!runFlag && optTrailing === true) {
      runFn();
    }
  };
  var cancelFn = function () {
    var rest = timeout !== null;
    if (rest) {
      clearTimeout(timeout);
    }
    gcFn();
    timeout = null;
    runFlag = false;
    return rest;
  };
  var debounced = function () {
    runFlag = false;
    args = arguments;
    context = this;
    if (timeout === null) {
      if (optLeading === true) {
        runFn();
      }
    } else {
      clearTimeout(timeout);
    }
    timeout = setTimeout(endFn, wait);
  };
  debounced.cancel = cancelFn;
  return debounced;
}
var debounce_1 = debounce$3;

/**
  * 该方法和 setTimeout 一样的效果，区别就是支持上下文和额外参数
  *
  * @param {Function} callback 函数
  * @param {Number} wait 延迟毫秒
  * @param {*} args 额外的参数
  * @return {Number}
 */
function delay(callback, wait) {
  var args = slice_1(arguments, 2);
  var context = this;
  return setTimeout(function () {
    callback.apply(context, args);
  }, wait);
}
var delay_1 = delay;

var staticDecodeURIComponent = decodeURIComponent;
var staticDecodeURIComponent_1 = staticDecodeURIComponent;

/**
 * 反序列化查询参数
 * @param {String} query 字符串
 */
function unserialize(str) {
  var items;
  var result = {};
  if (str && isString_1(str)) {
    arrayEach_1(str.split('&'), function (param) {
      items = param.split('=');
      result[staticDecodeURIComponent_1(items[0])] = staticDecodeURIComponent_1(items[1] || '');
    });
  }
  return result;
}
var unserialize_1 = unserialize;

var staticEncodeURIComponent = encodeURIComponent;
var staticEncodeURIComponent_1 = staticEncodeURIComponent;

function stringifyParams(resultVal, resultKey, isArr) {
  var _arr;
  var result = [];
  each_1(resultVal, function (item, key) {
    _arr = isArray_1(item);
    if (isPlainObject_1(item) || _arr) {
      result = result.concat(stringifyParams(item, resultKey + '[' + key + ']', _arr));
    } else {
      result.push(staticEncodeURIComponent_1(resultKey + '[' + (isArr ? '' : key) + ']') + '=' + staticEncodeURIComponent_1(isNull_1(item) ? '' : item));
    }
  });
  return result;
}

/**
 * 序列化查询参数
 *
 * @param {Object} query 查询参数
 */
function serialize$1(query) {
  var _arr;
  var params = [];
  each_1(query, function (item, key) {
    if (!isUndefined_1(item)) {
      _arr = isArray_1(item);
      if (isPlainObject_1(item) || _arr) {
        params = params.concat(stringifyParams(item, key, _arr));
      } else {
        params.push(staticEncodeURIComponent_1(key) + '=' + staticEncodeURIComponent_1(isNull_1(item) ? '' : item));
      }
    }
  });
  return params.join('&').replace(/%20/g, '+');
}
var serialize_1 = serialize$1;

/* eslint-disable valid-typeof */
var staticLocation = typeof location === staticStrUndefined_1 ? 0 : location;
var staticLocation_1 = staticLocation;

function helperGetLocatOrigin() {
  return staticLocation_1 ? staticLocation_1.origin || staticLocation_1.protocol + '//' + staticLocation_1.host : '';
}
var helperGetLocatOrigin_1 = helperGetLocatOrigin;

function parseURLQuery(uri) {
  return unserialize_1(uri.split('?')[1] || '');
}
function parseUrl$1(url) {
  var hashs, portText, searchs, parsed;
  var href = '' + url;
  if (href.indexOf('//') === 0) {
    href = (staticLocation_1 ? staticLocation_1.protocol : '') + href;
  } else if (href.indexOf('/') === 0) {
    href = helperGetLocatOrigin_1() + href;
  }
  searchs = href.replace(/#.*/, '').match(/(\?.*)/);
  parsed = {
    href: href,
    hash: '',
    host: '',
    hostname: '',
    protocol: '',
    port: '',
    search: searchs && searchs[1] && searchs[1].length > 1 ? searchs[1] : ''
  };
  parsed.path = href.replace(/^([a-z0-9.+-]*:)\/\//, function (text, protocol) {
    parsed.protocol = protocol;
    return '';
  }).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/, function (text, hostname, port) {
    portText = port || '';
    parsed.port = portText.replace(':', '');
    parsed.hostname = hostname;
    parsed.host = hostname + portText;
    return '/';
  }).replace(/(#.*)/, function (text, hash) {
    parsed.hash = hash.length > 1 ? hash : '';
    return '';
  });
  hashs = parsed.hash.match(/#((.*)\?|(.*))/);
  parsed.pathname = parsed.path.replace(/(\?|#.*).*/, '');
  parsed.origin = parsed.protocol + '//' + parsed.host;
  parsed.hashKey = hashs ? hashs[2] || hashs[1] || '' : '';
  parsed.hashQuery = parseURLQuery(parsed.hash);
  parsed.searchQuery = parseURLQuery(parsed.search);
  return parsed;
}
var parseUrl_1 = parseUrl$1;

function getBaseURL() {
  if (staticLocation_1) {
    var pathname = staticLocation_1.pathname;
    var lastIndex = lastIndexOf_1(pathname, '/') + 1;
    return helperGetLocatOrigin_1() + (lastIndex === pathname.length ? pathname : pathname.substring(0, lastIndex));
  }
  return '';
}
var getBaseURL_1 = getBaseURL;

/**
  * 获取地址栏信息
  *
  * @return Object
  */
function locat() {
  return staticLocation_1 ? parseUrl_1(staticLocation_1.href) : {};
}
var locat_1 = locat;

function toCookieUnitTime(unit, expires) {
  var num = parseFloat(expires);
  var nowdate = helperNewDate_1();
  var time = helperGetDateTime_1(nowdate);
  switch (unit) {
    case 'y':
      return helperGetDateTime_1(getWhatYear_1(nowdate, num));
    case 'M':
      return helperGetDateTime_1(getWhatMonth_1(nowdate, num));
    case 'd':
      return helperGetDateTime_1(getWhatDay_1(nowdate, num));
    case 'h':
    case 'H':
      return time + num * 60 * 60 * 1000;
    case 'm':
      return time + num * 60 * 1000;
    case 's':
      return time + num * 1000;
  }
  return time;
}
function toCookieUTCString(date) {
  return (isDate_1(date) ? date : new Date(date)).toUTCString();
}

/**
  * cookie操作函数
  * @param {String/Array/Object} name 键/数组/对象
  * @param {String} value 值
  * @param {Object} options 参数
  *   @param {String} name: 键
  *   @param {Object} value: 值
  *   @param {String} path: 路径
  *   @param {String} domain: 作用域
  *   @param {Boolean} secure: 设置为安全的,只能用https协议
  *   @param {Number} expires: 过期时间,可以指定日期或者字符串，默认天
  */
function cookie(name, value, options) {
  if (staticDocument_1) {
    var opts, expires, values, result, cookies, keyIndex;
    var inserts = [];
    var args = arguments;
    if (isArray_1(name)) {
      inserts = name;
    } else if (args.length > 1) {
      inserts = [assign_1({
        name: name,
        value: value
      }, options)];
    } else if (isObject_1(name)) {
      inserts = [name];
    }
    if (inserts.length > 0) {
      arrayEach_1(inserts, function (obj) {
        opts = assign_1({}, setupDefaults_1.cookies, obj);
        values = [];
        if (opts.name) {
          expires = opts.expires;
          values.push(staticEncodeURIComponent_1(opts.name) + '=' + staticEncodeURIComponent_1(isObject_1(opts.value) ? JSON.stringify(opts.value) : opts.value));
          if (expires) {
            if (isNaN(expires)) {
              // UTCString || Unit
              expires = expires.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/, function (text, num, unit) {
                return toCookieUTCString(toCookieUnitTime(unit, num));
              });
            } else if (/^[0-9]{11,13}$/.test(expires) || isDate_1(expires)) {
              // Date || now
              expires = toCookieUTCString(expires);
            } else {
              // day
              expires = toCookieUTCString(toCookieUnitTime('d', expires));
            }
            opts.expires = expires;
          }
          arrayEach_1(['expires', 'path', 'domain', 'secure'], function (key) {
            if (!isUndefined_1(opts[key])) {
              values.push(opts[key] && key === 'secure' ? key : key + '=' + opts[key]);
            }
          });
        }
        staticDocument_1.cookie = values.join('; ');
      });
      return true;
    } else {
      result = {};
      cookies = staticDocument_1.cookie;
      if (cookies) {
        arrayEach_1(cookies.split('; '), function (val) {
          keyIndex = val.indexOf('=');
          result[staticDecodeURIComponent_1(val.substring(0, keyIndex))] = staticDecodeURIComponent_1(val.substring(keyIndex + 1) || '');
        });
      }
      return args.length === 1 ? result[name] : result;
    }
  }
  return false;
}
function hasCookieItem(value) {
  return includes_1(cookieKeys(), value);
}
function getCookieItem(name) {
  return cookie(name);
}
function setCookieItem(name, value, options) {
  cookie(name, value, options);
  return cookie;
}
function removeCookieItem(name, options) {
  cookie(name, '', assign_1({
    expires: -1
  }, setupDefaults_1.cookies, options));
}
function cookieKeys() {
  return keys_1(cookie());
}
function cookieJson() {
  return cookie();
}
assign_1(cookie, {
  has: hasCookieItem,
  set: setCookieItem,
  setItem: setCookieItem,
  get: getCookieItem,
  getItem: getCookieItem,
  remove: removeCookieItem,
  removeItem: removeCookieItem,
  keys: cookieKeys,
  getJSON: cookieJson
});
var cookie_1 = cookie;

/* eslint-disable valid-typeof */
function isBrowseStorage(storage) {
  try {
    var testKey = '__xe_t';
    storage.setItem(testKey, 1);
    storage.removeItem(testKey);
    return true;
  } catch (e) {
    return false;
  }
}
function isBrowseType(type) {
  return navigator.userAgent.indexOf(type) > -1;
}

/**
  * 获取浏览器内核
  * @return Object
  */
function browse() {
  var $body, isChrome, isEdge;
  var isMobile = false;
  var isLocalStorage = false;
  var isSessionStorage = false;
  var result = {
    isNode: false,
    isMobile: isMobile,
    isPC: false,
    isDoc: !!staticDocument_1
  };
  if (!staticWindow_1 && typeof process !== staticStrUndefined_1) {
    result.isNode = true;
  } else {
    isEdge = isBrowseType('Edge');
    isChrome = isBrowseType('Chrome');
    isMobile = /(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent);
    if (result.isDoc) {
      $body = staticDocument_1.body || staticDocument_1.documentElement;
      arrayEach_1(['webkit', 'khtml', 'moz', 'ms', 'o'], function (core) {
        result['-' + core] = !!$body[core + 'MatchesSelector'];
      });
    }
    try {
      isLocalStorage = isBrowseStorage(staticWindow_1.localStorage);
    } catch (e) {}
    try {
      isSessionStorage = isBrowseStorage(staticWindow_1.sessionStorage);
    } catch (e) {}
    assign_1(result, {
      edge: isEdge,
      firefox: isBrowseType('Firefox'),
      msie: !isEdge && result['-ms'],
      safari: !isChrome && !isEdge && isBrowseType('Safari'),
      isMobile: isMobile,
      isPC: !isMobile,
      isLocalStorage: isLocalStorage,
      isSessionStorage: isSessionStorage
    });
  }
  return result;
}
var browse_1 = browse;

// 核心


// 对象相关的方法






// 数组相关的方法






































// 基础方法

































































// 数值相关方法


















// 日期相关的方法


















// 字符串相关的方法
















// 函数相关的方法










// 地址相关的方法




// 浏览器相关的方法




assign_1(ctor, {
  // object
  assign: assign_1,
  objectEach: objectEach_1,
  lastObjectEach: lastObjectEach_1,
  objectMap: objectMap_1,
  merge: merge_1,
  // array
  uniq: uniq_1,
  union: union_1,
  sortBy: sortBy_1,
  orderBy: orderBy_1,
  shuffle: shuffle_1,
  sample: sample_1,
  some: some_1,
  every: every_1,
  slice: slice_1,
  filter: filter_1,
  find: find_1,
  findLast: findLast_1,
  findKey: findKey_1,
  includes: includes_1,
  arrayIndexOf: arrayIndexOf_1,
  arrayLastIndexOf: arrayLastIndexOf_1,
  map: map_1,
  reduce: reduce_1,
  copyWithin: copyWithin_1,
  chunk: chunk_1,
  zip: zip_1,
  unzip: unzip_1,
  zipObject: zipObject_1,
  flatten: flatten_1,
  toArray: toArray_1,
  includeArrays: includeArrays_1,
  pluck: pluck_1,
  invoke: invoke_1,
  arrayEach: arrayEach_1,
  lastArrayEach: lastArrayEach_1,
  toArrayTree: toArrayTree_1,
  toTreeArray: toTreeArray_1,
  findTree: findTree_1,
  eachTree: eachTree_1,
  mapTree: mapTree_1,
  filterTree: filterTree_1,
  searchTree: searchTree_1,
  // base
  hasOwnProp: hasOwnProp_1,
  eqNull: eqNull_1,
  isNaN: _isNaN,
  isFinite: _isFinite,
  isUndefined: isUndefined_1,
  isArray: isArray_1,
  isFloat: isFloat_1,
  isInteger: isInteger_1,
  isFunction: isFunction_1$1,
  isBoolean: isBoolean_1,
  isString: isString_1,
  isNumber: isNumber_1,
  isRegExp: isRegExp_1,
  isObject: isObject_1,
  isPlainObject: isPlainObject_1,
  isDate: isDate_1,
  isError: isError_1,
  isTypeError: isTypeError_1,
  isEmpty: isEmpty_1,
  isNull: isNull_1,
  isSymbol: isSymbol_1,
  isArguments: isArguments_1,
  isElement: isElement_1,
  isDocument: isDocument_1,
  isWindow: isWindow_1,
  isFormData: isFormData_1,
  isMap: isMap_1,
  isWeakMap: isWeakMap_1,
  isSet: isSet_1,
  isWeakSet: isWeakSet_1,
  isLeapYear: isLeapYear_1,
  isMatch: isMatch_1,
  isEqual: isEqual_1,
  isEqualWith: isEqualWith_1,
  getType: getType_1,
  uniqueId: uniqueId_1,
  getSize: getSize_1,
  indexOf: indexOf_1,
  lastIndexOf: lastIndexOf_1,
  findIndexOf: findIndexOf_1,
  findLastIndexOf: findLastIndexOf_1,
  toStringJSON: toStringJSON_1,
  toJSONString: toJSONString_1,
  keys: keys_1,
  values: values_1,
  entries: entries_1,
  pick: pick_1,
  omit: omit_1,
  first: first_1,
  last: last_1,
  each: each_1,
  forOf: forOf_1,
  lastForOf: lastForOf_1,
  lastEach: lastEach_1,
  has: has_1,
  get: get_1,
  set: set_1,
  groupBy: groupBy_1,
  countBy: countBy_1,
  clone: clone_1,
  clear: clear_1,
  remove: remove_1,
  range: range_1,
  destructuring: destructuring_1,
  // number
  random: random_1,
  min: min_1,
  max: max_1,
  commafy: commafy_1,
  round: round_1,
  ceil: ceil_1,
  floor: floor_1,
  toFixed: toFixed_1,
  toNumber: toNumber_1,
  toNumberString: toNumberString_1,
  toInteger: toInteger_1,
  add: add_1,
  subtract: subtract_1,
  multiply: multiply_1,
  divide: divide_1,
  sum: sum_1,
  mean: mean_1,
  // date
  now: now_1,
  timestamp: timestamp_1,
  isValidDate: isValidDate_1,
  isDateSame: isDateSame_1,
  toStringDate: toStringDate_1,
  toDateString: toDateString_1,
  getWhatYear: getWhatYear_1,
  getWhatQuarter: getWhatQuarter_1,
  getWhatMonth: getWhatMonth_1,
  getWhatWeek: getWhatWeek_1,
  getWhatDay: getWhatDay_1,
  getYearDay: getYearDay_1,
  getYearWeek: getYearWeek_1,
  getMonthWeek: getMonthWeek_1,
  getDayOfYear: getDayOfYear_1,
  getDayOfMonth: getDayOfMonth_1,
  getDateDiff: getDateDiff_1,
  // string
  trim: trim_1,
  trimLeft: trimLeft_1,
  trimRight: trimRight_1,
  escape: _escape,
  unescape: _unescape,
  camelCase: camelCase_1,
  kebabCase: kebabCase_1,
  repeat: repeat_1,
  padStart: padStart_1,
  padEnd: padEnd_1,
  startsWith: startsWith_1,
  endsWith: endsWith_1,
  template: template_1,
  toFormatString: toFormatString_1,
  toString: toValueString_1,
  toValueString: toValueString_1,
  // function
  noop: noop_1,
  property: property_1,
  bind: bind_1,
  once: once_1,
  after: after_1,
  before: before_1,
  throttle: throttle_1,
  debounce: debounce_1,
  delay: delay_1,
  // url
  unserialize: unserialize_1,
  serialize: serialize_1,
  parseUrl: parseUrl_1,
  // web
  getBaseURL: getBaseURL_1,
  locat: locat_1,
  browse: browse_1,
  cookie: cookie_1
});
var xeUtils = ctor;

var prism = createCommonjsModule(function (module) {
/* **********************************************
     Begin prism-core.js
********************************************** */

/// <reference lib="WebWorker"/>

var _self = typeof window !== 'undefined' ? window // if in browser
: typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self // if in worker
: {} // if in node js
;

/**
 * Prism: Lightweight, robust, elegant syntax highlighting
 *
 * @license MIT <https://opensource.org/licenses/MIT>
 * @author Lea Verou <https://lea.verou.me>
 * @namespace
 * @public
 */
var Prism = function (_self) {
  // Private helper vars
  var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
  var uniqueId = 0;

  // The grammar object for plaintext
  var plainTextGrammar = {};
  var _ = {
    /**
     * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
     * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
     * additional languages or plugins yourself.
     *
     * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
     *
     * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
     * empty Prism object into the global scope before loading the Prism script like this:
     *
     * ```js
     * window.Prism = window.Prism || {};
     * Prism.manual = true;
     * // add a new <script> to load Prism's script
     * ```
     *
     * @default false
     * @type {boolean}
     * @memberof Prism
     * @public
     */
    manual: _self.Prism && _self.Prism.manual,
    /**
     * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
     * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
     * own worker, you don't want it to do this.
     *
     * By setting this value to `true`, Prism will not add its own listeners to the worker.
     *
     * You obviously have to change this value before Prism executes. To do this, you can add an
     * empty Prism object into the global scope before loading the Prism script like this:
     *
     * ```js
     * window.Prism = window.Prism || {};
     * Prism.disableWorkerMessageHandler = true;
     * // Load Prism's script
     * ```
     *
     * @default false
     * @type {boolean}
     * @memberof Prism
     * @public
     */
    disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
    /**
     * A namespace for utility methods.
     *
     * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
     * change or disappear at any time.
     *
     * @namespace
     * @memberof Prism
     */
    util: {
      encode: function encode(tokens) {
        if (tokens instanceof Token) {
          return new Token(tokens.type, encode(tokens.content), tokens.alias);
        } else if (Array.isArray(tokens)) {
          return tokens.map(encode);
        } else {
          return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
        }
      },
      /**
       * Returns the name of the type of the given value.
       *
       * @param {any} o
       * @returns {string}
       * @example
       * type(null)      === 'Null'
       * type(undefined) === 'Undefined'
       * type(123)       === 'Number'
       * type('foo')     === 'String'
       * type(true)      === 'Boolean'
       * type([1, 2])    === 'Array'
       * type({})        === 'Object'
       * type(String)    === 'Function'
       * type(/abc+/)    === 'RegExp'
       */
      type: function (o) {
        return Object.prototype.toString.call(o).slice(8, -1);
      },
      /**
       * Returns a unique number for the given object. Later calls will still return the same number.
       *
       * @param {Object} obj
       * @returns {number}
       */
      objId: function (obj) {
        if (!obj['__id']) {
          Object.defineProperty(obj, '__id', {
            value: ++uniqueId
          });
        }
        return obj['__id'];
      },
      /**
       * Creates a deep clone of the given object.
       *
       * The main intended use of this function is to clone language definitions.
       *
       * @param {T} o
       * @param {Record<number, any>} [visited]
       * @returns {T}
       * @template T
       */
      clone: function deepClone(o, visited) {
        visited = visited || {};
        var clone;
        var id;
        switch (_.util.type(o)) {
          case 'Object':
            id = _.util.objId(o);
            if (visited[id]) {
              return visited[id];
            }
            clone = /** @type {Record<string, any>} */{};
            visited[id] = clone;
            for (var key in o) {
              if (o.hasOwnProperty(key)) {
                clone[key] = deepClone(o[key], visited);
              }
            }
            return /** @type {any} */clone;
          case 'Array':
            id = _.util.objId(o);
            if (visited[id]) {
              return visited[id];
            }
            clone = [];
            visited[id] = clone;
            (/** @type {Array} */ /** @type {any} */o).forEach(function (v, i) {
              clone[i] = deepClone(v, visited);
            });
            return /** @type {any} */clone;
          default:
            return o;
        }
      },
      /**
       * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
       *
       * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
       *
       * @param {Element} element
       * @returns {string}
       */
      getLanguage: function (element) {
        while (element) {
          var m = lang.exec(element.className);
          if (m) {
            return m[1].toLowerCase();
          }
          element = element.parentElement;
        }
        return 'none';
      },
      /**
       * Sets the Prism `language-xxxx` class of the given element.
       *
       * @param {Element} element
       * @param {string} language
       * @returns {void}
       */
      setLanguage: function (element, language) {
        // remove all `language-xxxx` classes
        // (this might leave behind a leading space)
        element.className = element.className.replace(RegExp(lang, 'gi'), '');

        // add the new `language-xxxx` class
        // (using `classList` will automatically clean up spaces for us)
        element.classList.add('language-' + language);
      },
      /**
       * Returns the script element that is currently executing.
       *
       * This does __not__ work for line script element.
       *
       * @returns {HTMLScriptElement | null}
       */
      currentScript: function () {
        if (typeof document === 'undefined') {
          return null;
        }
        if (document.currentScript && document.currentScript.tagName === 'SCRIPT' && 1 < 2 /* hack to trip TS' flow analysis */) {
          return /** @type {any} */document.currentScript;
        }

        // IE11 workaround
        // we'll get the src of the current script by parsing IE11's error stack trace
        // this will not work for inline scripts

        try {
          throw new Error();
        } catch (err) {
          // Get file src url from stack. Specifically works with the format of stack traces in IE.
          // A stack will look like this:
          //
          // Error
          //    at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
          //    at Global code (http://localhost/components/prism-core.js:606:1)

          var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
          if (src) {
            var scripts = document.getElementsByTagName('script');
            for (var i in scripts) {
              if (scripts[i].src == src) {
                return scripts[i];
              }
            }
          }
          return null;
        }
      },
      /**
       * Returns whether a given class is active for `element`.
       *
       * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
       * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
       * given class is just the given class with a `no-` prefix.
       *
       * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
       * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
       * ancestors have the given class or the negated version of it, then the default activation will be returned.
       *
       * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
       * version of it, the class is considered active.
       *
       * @param {Element} element
       * @param {string} className
       * @param {boolean} [defaultActivation=false]
       * @returns {boolean}
       */
      isActive: function (element, className, defaultActivation) {
        var no = 'no-' + className;
        while (element) {
          var classList = element.classList;
          if (classList.contains(className)) {
            return true;
          }
          if (classList.contains(no)) {
            return false;
          }
          element = element.parentElement;
        }
        return !!defaultActivation;
      }
    },
    /**
     * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
     *
     * @namespace
     * @memberof Prism
     * @public
     */
    languages: {
      /**
       * The grammar for plain, unformatted text.
       */
      plain: plainTextGrammar,
      plaintext: plainTextGrammar,
      text: plainTextGrammar,
      txt: plainTextGrammar,
      /**
       * Creates a deep copy of the language with the given id and appends the given tokens.
       *
       * If a token in `redef` also appears in the copied language, then the existing token in the copied language
       * will be overwritten at its original position.
       *
       * ## Best practices
       *
       * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
       * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
       * understand the language definition because, normally, the order of tokens matters in Prism grammars.
       *
       * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
       * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
       *
       * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
       * @param {Grammar} redef The new tokens to append.
       * @returns {Grammar} The new language created.
       * @public
       * @example
       * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
       *     // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
       *     // at its original position
       *     'comment': { ... },
       *     // CSS doesn't have a 'color' token, so this token will be appended
       *     'color': /\b(?:red|green|blue)\b/
       * });
       */
      extend: function (id, redef) {
        var lang = _.util.clone(_.languages[id]);
        for (var key in redef) {
          lang[key] = redef[key];
        }
        return lang;
      },
      /**
       * Inserts tokens _before_ another token in a language definition or any other grammar.
       *
       * ## Usage
       *
       * This helper method makes it easy to modify existing languages. For example, the CSS language definition
       * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
       * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
       * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
       * this:
       *
       * ```js
       * Prism.languages.markup.style = {
       *     // token
       * };
       * ```
       *
       * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
       * before existing tokens. For the CSS example above, you would use it like this:
       *
       * ```js
       * Prism.languages.insertBefore('markup', 'cdata', {
       *     'style': {
       *         // token
       *     }
       * });
       * ```
       *
       * ## Special cases
       *
       * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
       * will be ignored.
       *
       * This behavior can be used to insert tokens after `before`:
       *
       * ```js
       * Prism.languages.insertBefore('markup', 'comment', {
       *     'comment': Prism.languages.markup.comment,
       *     // tokens after 'comment'
       * });
       * ```
       *
       * ## Limitations
       *
       * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
       * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
       * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
       * deleting properties which is necessary to insert at arbitrary positions.
       *
       * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
       * Instead, it will create a new object and replace all references to the target object with the new one. This
       * can be done without temporarily deleting properties, so the iteration order is well-defined.
       *
       * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
       * you hold the target object in a variable, then the value of the variable will not change.
       *
       * ```js
       * var oldMarkup = Prism.languages.markup;
       * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
       *
       * assert(oldMarkup !== Prism.languages.markup);
       * assert(newMarkup === Prism.languages.markup);
       * ```
       *
       * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
       * object to be modified.
       * @param {string} before The key to insert before.
       * @param {Grammar} insert An object containing the key-value pairs to be inserted.
       * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
       * object to be modified.
       *
       * Defaults to `Prism.languages`.
       * @returns {Grammar} The new grammar object.
       * @public
       */
      insertBefore: function (inside, before, insert, root) {
        root = root || (/** @type {any} */_.languages);
        var grammar = root[inside];
        /** @type {Grammar} */
        var ret = {};
        for (var token in grammar) {
          if (grammar.hasOwnProperty(token)) {
            if (token == before) {
              for (var newToken in insert) {
                if (insert.hasOwnProperty(newToken)) {
                  ret[newToken] = insert[newToken];
                }
              }
            }

            // Do not insert token which also occur in insert. See #1525
            if (!insert.hasOwnProperty(token)) {
              ret[token] = grammar[token];
            }
          }
        }
        var old = root[inside];
        root[inside] = ret;

        // Update references in other language definitions
        _.languages.DFS(_.languages, function (key, value) {
          if (value === old && key != inside) {
            this[key] = ret;
          }
        });
        return ret;
      },
      // Traverse a language definition with Depth First Search
      DFS: function DFS(o, callback, type, visited) {
        visited = visited || {};
        var objId = _.util.objId;
        for (var i in o) {
          if (o.hasOwnProperty(i)) {
            callback.call(o, i, o[i], type || i);
            var property = o[i];
            var propertyType = _.util.type(property);
            if (propertyType === 'Object' && !visited[objId(property)]) {
              visited[objId(property)] = true;
              DFS(property, callback, null, visited);
            } else if (propertyType === 'Array' && !visited[objId(property)]) {
              visited[objId(property)] = true;
              DFS(property, callback, i, visited);
            }
          }
        }
      }
    },
    plugins: {},
    /**
     * This is the most high-level function in Prism’s API.
     * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
     * each one of them.
     *
     * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
     *
     * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
     * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
     * @memberof Prism
     * @public
     */
    highlightAll: function (async, callback) {
      _.highlightAllUnder(document, async, callback);
    },
    /**
     * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
     * {@link Prism.highlightElement} on each one of them.
     *
     * The following hooks will be run:
     * 1. `before-highlightall`
     * 2. `before-all-elements-highlight`
     * 3. All hooks of {@link Prism.highlightElement} for each element.
     *
     * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
     * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
     * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
     * @memberof Prism
     * @public
     */
    highlightAllUnder: function (container, async, callback) {
      var env = {
        callback: callback,
        container: container,
        selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
      };
      _.hooks.run('before-highlightall', env);
      env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
      _.hooks.run('before-all-elements-highlight', env);
      for (var i = 0, element; element = env.elements[i++];) {
        _.highlightElement(element, async === true, env.callback);
      }
    },
    /**
     * Highlights the code inside a single element.
     *
     * The following hooks will be run:
     * 1. `before-sanity-check`
     * 2. `before-highlight`
     * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
     * 4. `before-insert`
     * 5. `after-highlight`
     * 6. `complete`
     *
     * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
     * the element's language.
     *
     * @param {Element} element The element containing the code.
     * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
     * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
     * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
     * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
     *
     * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
     * asynchronous highlighting to work. You can build your own bundle on the
     * [Download page](https://prismjs.com/download.html).
     * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
     * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
     * @memberof Prism
     * @public
     */
    highlightElement: function (element, async, callback) {
      // Find language
      var language = _.util.getLanguage(element);
      var grammar = _.languages[language];

      // Set language on the element, if not present
      _.util.setLanguage(element, language);

      // Set language on the parent, for styling
      var parent = element.parentElement;
      if (parent && parent.nodeName.toLowerCase() === 'pre') {
        _.util.setLanguage(parent, language);
      }
      var code = element.textContent;
      var env = {
        element: element,
        language: language,
        grammar: grammar,
        code: code
      };
      function insertHighlightedCode(highlightedCode) {
        env.highlightedCode = highlightedCode;
        _.hooks.run('before-insert', env);
        env.element.innerHTML = env.highlightedCode;
        _.hooks.run('after-highlight', env);
        _.hooks.run('complete', env);
        callback && callback.call(env.element);
      }
      _.hooks.run('before-sanity-check', env);

      // plugins may change/add the parent/element
      parent = env.element.parentElement;
      if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
        parent.setAttribute('tabindex', '0');
      }
      if (!env.code) {
        _.hooks.run('complete', env);
        callback && callback.call(env.element);
        return;
      }
      _.hooks.run('before-highlight', env);
      if (!env.grammar) {
        insertHighlightedCode(_.util.encode(env.code));
        return;
      }
      if (async && _self.Worker) {
        var worker = new Worker(_.filename);
        worker.onmessage = function (evt) {
          insertHighlightedCode(evt.data);
        };
        worker.postMessage(JSON.stringify({
          language: env.language,
          code: env.code,
          immediateClose: true
        }));
      } else {
        insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
      }
    },
    /**
     * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
     * and the language definitions to use, and returns a string with the HTML produced.
     *
     * The following hooks will be run:
     * 1. `before-tokenize`
     * 2. `after-tokenize`
     * 3. `wrap`: On each {@link Token}.
     *
     * @param {string} text A string with the code to be highlighted.
     * @param {Grammar} grammar An object containing the tokens to use.
     *
     * Usually a language definition like `Prism.languages.markup`.
     * @param {string} language The name of the language definition passed to `grammar`.
     * @returns {string} The highlighted HTML.
     * @memberof Prism
     * @public
     * @example
     * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
     */
    highlight: function (text, grammar, language) {
      var env = {
        code: text,
        grammar: grammar,
        language: language
      };
      _.hooks.run('before-tokenize', env);
      if (!env.grammar) {
        throw new Error('The language "' + env.language + '" has no grammar.');
      }
      env.tokens = _.tokenize(env.code, env.grammar);
      _.hooks.run('after-tokenize', env);
      return Token.stringify(_.util.encode(env.tokens), env.language);
    },
    /**
     * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
     * and the language definitions to use, and returns an array with the tokenized code.
     *
     * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
     *
     * This method could be useful in other contexts as well, as a very crude parser.
     *
     * @param {string} text A string with the code to be highlighted.
     * @param {Grammar} grammar An object containing the tokens to use.
     *
     * Usually a language definition like `Prism.languages.markup`.
     * @returns {TokenStream} An array of strings and tokens, a token stream.
     * @memberof Prism
     * @public
     * @example
     * let code = `var foo = 0;`;
     * let tokens = Prism.tokenize(code, Prism.languages.javascript);
     * tokens.forEach(token => {
     *     if (token instanceof Prism.Token && token.type === 'number') {
     *         console.log(`Found numeric literal: ${token.content}`);
     *     }
     * });
     */
    tokenize: function (text, grammar) {
      var rest = grammar.rest;
      if (rest) {
        for (var token in rest) {
          grammar[token] = rest[token];
        }
        delete grammar.rest;
      }
      var tokenList = new LinkedList();
      addAfter(tokenList, tokenList.head, text);
      matchGrammar(text, tokenList, grammar, tokenList.head, 0);
      return toArray(tokenList);
    },
    /**
     * @namespace
     * @memberof Prism
     * @public
     */
    hooks: {
      all: {},
      /**
       * Adds the given callback to the list of callbacks for the given hook.
       *
       * The callback will be invoked when the hook it is registered for is run.
       * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
       *
       * One callback function can be registered to multiple hooks and the same hook multiple times.
       *
       * @param {string} name The name of the hook.
       * @param {HookCallback} callback The callback function which is given environment variables.
       * @public
       */
      add: function (name, callback) {
        var hooks = _.hooks.all;
        hooks[name] = hooks[name] || [];
        hooks[name].push(callback);
      },
      /**
       * Runs a hook invoking all registered callbacks with the given environment variables.
       *
       * Callbacks will be invoked synchronously and in the order in which they were registered.
       *
       * @param {string} name The name of the hook.
       * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
       * @public
       */
      run: function (name, env) {
        var callbacks = _.hooks.all[name];
        if (!callbacks || !callbacks.length) {
          return;
        }
        for (var i = 0, callback; callback = callbacks[i++];) {
          callback(env);
        }
      }
    },
    Token: Token
  };
  _self.Prism = _;

  // Typescript note:
  // The following can be used to import the Token type in JSDoc:
  //
  //   @typedef {InstanceType<import("./prism-core")["Token"]>} Token

  /**
   * Creates a new token.
   *
   * @param {string} type See {@link Token#type type}
   * @param {string | TokenStream} content See {@link Token#content content}
   * @param {string|string[]} [alias] The alias(es) of the token.
   * @param {string} [matchedStr=""] A copy of the full string this token was created from.
   * @class
   * @global
   * @public
   */
  function Token(type, content, alias, matchedStr) {
    /**
     * The type of the token.
     *
     * This is usually the key of a pattern in a {@link Grammar}.
     *
     * @type {string}
     * @see GrammarToken
     * @public
     */
    this.type = type;
    /**
     * The strings or tokens contained by this token.
     *
     * This will be a token stream if the pattern matched also defined an `inside` grammar.
     *
     * @type {string | TokenStream}
     * @public
     */
    this.content = content;
    /**
     * The alias(es) of the token.
     *
     * @type {string|string[]}
     * @see GrammarToken
     * @public
     */
    this.alias = alias;
    // Copy of the full string this token was created from
    this.length = (matchedStr || '').length | 0;
  }

  /**
   * A token stream is an array of strings and {@link Token Token} objects.
   *
   * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
   * them.
   *
   * 1. No adjacent strings.
   * 2. No empty strings.
   *
   *    The only exception here is the token stream that only contains the empty string and nothing else.
   *
   * @typedef {Array<string | Token>} TokenStream
   * @global
   * @public
   */

  /**
   * Converts the given token or token stream to an HTML representation.
   *
   * The following hooks will be run:
   * 1. `wrap`: On each {@link Token}.
   *
   * @param {string | Token | TokenStream} o The token or token stream to be converted.
   * @param {string} language The name of current language.
   * @returns {string} The HTML representation of the token or token stream.
   * @memberof Token
   * @static
   */
  Token.stringify = function stringify(o, language) {
    if (typeof o == 'string') {
      return o;
    }
    if (Array.isArray(o)) {
      var s = '';
      o.forEach(function (e) {
        s += stringify(e, language);
      });
      return s;
    }
    var env = {
      type: o.type,
      content: stringify(o.content, language),
      tag: 'span',
      classes: ['token', o.type],
      attributes: {},
      language: language
    };
    var aliases = o.alias;
    if (aliases) {
      if (Array.isArray(aliases)) {
        Array.prototype.push.apply(env.classes, aliases);
      } else {
        env.classes.push(aliases);
      }
    }
    _.hooks.run('wrap', env);
    var attributes = '';
    for (var name in env.attributes) {
      attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
    }
    return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
  };

  /**
   * @param {RegExp} pattern
   * @param {number} pos
   * @param {string} text
   * @param {boolean} lookbehind
   * @returns {RegExpExecArray | null}
   */
  function matchPattern(pattern, pos, text, lookbehind) {
    pattern.lastIndex = pos;
    var match = pattern.exec(text);
    if (match && lookbehind && match[1]) {
      // change the match to remove the text matched by the Prism lookbehind group
      var lookbehindLength = match[1].length;
      match.index += lookbehindLength;
      match[0] = match[0].slice(lookbehindLength);
    }
    return match;
  }

  /**
   * @param {string} text
   * @param {LinkedList<string | Token>} tokenList
   * @param {any} grammar
   * @param {LinkedListNode<string | Token>} startNode
   * @param {number} startPos
   * @param {RematchOptions} [rematch]
   * @returns {void}
   * @private
   *
   * @typedef RematchOptions
   * @property {string} cause
   * @property {number} reach
   */
  function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
    for (var token in grammar) {
      if (!grammar.hasOwnProperty(token) || !grammar[token]) {
        continue;
      }
      var patterns = grammar[token];
      patterns = Array.isArray(patterns) ? patterns : [patterns];
      for (var j = 0; j < patterns.length; ++j) {
        if (rematch && rematch.cause == token + ',' + j) {
          return;
        }
        var patternObj = patterns[j];
        var inside = patternObj.inside;
        var lookbehind = !!patternObj.lookbehind;
        var greedy = !!patternObj.greedy;
        var alias = patternObj.alias;
        if (greedy && !patternObj.pattern.global) {
          // Without the global flag, lastIndex won't work
          var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
          patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
        }

        /** @type {RegExp} */
        var pattern = patternObj.pattern || patternObj;
        for (
        // iterate the token list and keep track of the current token/string position
        var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
          if (rematch && pos >= rematch.reach) {
            break;
          }
          var str = currentNode.value;
          if (tokenList.length > text.length) {
            // Something went terribly wrong, ABORT, ABORT!
            return;
          }
          if (str instanceof Token) {
            continue;
          }
          var removeCount = 1; // this is the to parameter of removeBetween
          var match;
          if (greedy) {
            match = matchPattern(pattern, pos, text, lookbehind);
            if (!match || match.index >= text.length) {
              break;
            }
            var from = match.index;
            var to = match.index + match[0].length;
            var p = pos;

            // find the node that contains the match
            p += currentNode.value.length;
            while (from >= p) {
              currentNode = currentNode.next;
              p += currentNode.value.length;
            }
            // adjust pos (and p)
            p -= currentNode.value.length;
            pos = p;

            // the current node is a Token, then the match starts inside another Token, which is invalid
            if (currentNode.value instanceof Token) {
              continue;
            }

            // find the last node which is affected by this match
            for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === 'string'); k = k.next) {
              removeCount++;
              p += k.value.length;
            }
            removeCount--;

            // replace with the new match
            str = text.slice(pos, p);
            match.index -= pos;
          } else {
            match = matchPattern(pattern, 0, str, lookbehind);
            if (!match) {
              continue;
            }
          }

          // eslint-disable-next-line no-redeclare
          var from = match.index;
          var matchStr = match[0];
          var before = str.slice(0, from);
          var after = str.slice(from + matchStr.length);
          var reach = pos + str.length;
          if (rematch && reach > rematch.reach) {
            rematch.reach = reach;
          }
          var removeFrom = currentNode.prev;
          if (before) {
            removeFrom = addAfter(tokenList, removeFrom, before);
            pos += before.length;
          }
          removeRange(tokenList, removeFrom, removeCount);
          var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
          currentNode = addAfter(tokenList, removeFrom, wrapped);
          if (after) {
            addAfter(tokenList, currentNode, after);
          }
          if (removeCount > 1) {
            // at least one Token object was removed, so we have to do some rematching
            // this can only happen if the current pattern is greedy

            /** @type {RematchOptions} */
            var nestedRematch = {
              cause: token + ',' + j,
              reach: reach
            };
            matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);

            // the reach might have been extended because of the rematching
            if (rematch && nestedRematch.reach > rematch.reach) {
              rematch.reach = nestedRematch.reach;
            }
          }
        }
      }
    }
  }

  /**
   * @typedef LinkedListNode
   * @property {T} value
   * @property {LinkedListNode<T> | null} prev The previous node.
   * @property {LinkedListNode<T> | null} next The next node.
   * @template T
   * @private
   */

  /**
   * @template T
   * @private
   */
  function LinkedList() {
    /** @type {LinkedListNode<T>} */
    var head = {
      value: null,
      prev: null,
      next: null
    };
    /** @type {LinkedListNode<T>} */
    var tail = {
      value: null,
      prev: head,
      next: null
    };
    head.next = tail;

    /** @type {LinkedListNode<T>} */
    this.head = head;
    /** @type {LinkedListNode<T>} */
    this.tail = tail;
    this.length = 0;
  }

  /**
   * Adds a new node with the given value to the list.
   *
   * @param {LinkedList<T>} list
   * @param {LinkedListNode<T>} node
   * @param {T} value
   * @returns {LinkedListNode<T>} The added node.
   * @template T
   */
  function addAfter(list, node, value) {
    // assumes that node != list.tail && values.length >= 0
    var next = node.next;
    var newNode = {
      value: value,
      prev: node,
      next: next
    };
    node.next = newNode;
    next.prev = newNode;
    list.length++;
    return newNode;
  }
  /**
   * Removes `count` nodes after the given node. The given node will not be removed.
   *
   * @param {LinkedList<T>} list
   * @param {LinkedListNode<T>} node
   * @param {number} count
   * @template T
   */
  function removeRange(list, node, count) {
    var next = node.next;
    for (var i = 0; i < count && next !== list.tail; i++) {
      next = next.next;
    }
    node.next = next;
    next.prev = node;
    list.length -= i;
  }
  /**
   * @param {LinkedList<T>} list
   * @returns {T[]}
   * @template T
   */
  function toArray(list) {
    var array = [];
    var node = list.head.next;
    while (node !== list.tail) {
      array.push(node.value);
      node = node.next;
    }
    return array;
  }
  if (!_self.document) {
    if (!_self.addEventListener) {
      // in Node.js
      return _;
    }
    if (!_.disableWorkerMessageHandler) {
      // In worker
      _self.addEventListener('message', function (evt) {
        var message = JSON.parse(evt.data);
        var lang = message.language;
        var code = message.code;
        var immediateClose = message.immediateClose;
        _self.postMessage(_.highlight(code, _.languages[lang], lang));
        if (immediateClose) {
          _self.close();
        }
      }, false);
    }
    return _;
  }

  // Get current script and highlight
  var script = _.util.currentScript();
  if (script) {
    _.filename = script.src;
    if (script.hasAttribute('data-manual')) {
      _.manual = true;
    }
  }
  function highlightAutomaticallyCallback() {
    if (!_.manual) {
      _.highlightAll();
    }
  }
  if (!_.manual) {
    // If the document state is "loading", then we'll use DOMContentLoaded.
    // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
    // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
    // might take longer one animation frame to execute which can create a race condition where only some plugins have
    // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
    // See https://github.com/PrismJS/prism/issues/2102
    var readyState = document.readyState;
    if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
      document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
    } else {
      if (window.requestAnimationFrame) {
        window.requestAnimationFrame(highlightAutomaticallyCallback);
      } else {
        window.setTimeout(highlightAutomaticallyCallback, 16);
      }
    }
  }
  return _;
}(_self);
if (module.exports) {
  module.exports = Prism;
}

// hack for components to work correctly in node.js
if (typeof commonjsGlobal !== 'undefined') {
  commonjsGlobal.Prism = Prism;
}

// some additional documentation/types

/**
 * The expansion of a simple `RegExp` literal to support additional properties.
 *
 * @typedef GrammarToken
 * @property {RegExp} pattern The regular expression of the token.
 * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
 * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
 * @property {boolean} [greedy=false] Whether the token is greedy.
 * @property {string|string[]} [alias] An optional alias or list of aliases.
 * @property {Grammar} [inside] The nested grammar of this token.
 *
 * The `inside` grammar will be used to tokenize the text value of each token of this kind.
 *
 * This can be used to make nested and even recursive language definitions.
 *
 * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
 * each another.
 * @global
 * @public
 */

/**
 * @typedef Grammar
 * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
 * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
 * @global
 * @public
 */

/**
 * A function which will invoked after an element was successfully highlighted.
 *
 * @callback HighlightCallback
 * @param {Element} element The element successfully highlighted.
 * @returns {void}
 * @global
 * @public
 */

/**
 * @callback HookCallback
 * @param {Object<string, any>} env The environment variables of the hook.
 * @returns {void}
 * @global
 * @public
 */

/* **********************************************
     Begin prism-markup.js
********************************************** */

Prism.languages.markup = {
  'comment': {
    pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
    greedy: true
  },
  'prolog': {
    pattern: /<\?[\s\S]+?\?>/,
    greedy: true
  },
  'doctype': {
    // https://www.w3.org/TR/xml/#NT-doctypedecl
    pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
    greedy: true,
    inside: {
      'internal-subset': {
        pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
        lookbehind: true,
        greedy: true,
        inside: null // see below
      },
      'string': {
        pattern: /"[^"]*"|'[^']*'/,
        greedy: true
      },
      'punctuation': /^<!|>$|[[\]]/,
      'doctype-tag': /^DOCTYPE/i,
      'name': /[^\s<>'"]+/
    }
  },
  'cdata': {
    pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
    greedy: true
  },
  'tag': {
    pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
    greedy: true,
    inside: {
      'tag': {
        pattern: /^<\/?[^\s>\/]+/,
        inside: {
          'punctuation': /^<\/?/,
          'namespace': /^[^\s>\/:]+:/
        }
      },
      'special-attr': [],
      'attr-value': {
        pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
        inside: {
          'punctuation': [{
            pattern: /^=/,
            alias: 'attr-equals'
          }, {
            pattern: /^(\s*)["']|["']$/,
            lookbehind: true
          }]
        }
      },
      'punctuation': /\/?>/,
      'attr-name': {
        pattern: /[^\s>\/]+/,
        inside: {
          'namespace': /^[^\s>\/:]+:/
        }
      }
    }
  },
  'entity': [{
    pattern: /&[\da-z]{1,8};/i,
    alias: 'named-entity'
  }, /&#x?[\da-f]{1,8};/i]
};
Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity'];
Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;

// Plugin to make entity title show the real entity, idea by Roman Komarov
Prism.hooks.add('wrap', function (env) {
  if (env.type === 'entity') {
    env.attributes['title'] = env.content.replace(/&amp;/, '&');
  }
});
Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
  /**
   * Adds an inlined language to markup.
   *
   * An example of an inlined language is CSS with `<style>` tags.
   *
   * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
   * case insensitive.
   * @param {string} lang The language key.
   * @example
   * addInlined('style', 'css');
   */
  value: function addInlined(tagName, lang) {
    var includedCdataInside = {};
    includedCdataInside['language-' + lang] = {
      pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
      lookbehind: true,
      inside: Prism.languages[lang]
    };
    includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
    var inside = {
      'included-cdata': {
        pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
        inside: includedCdataInside
      }
    };
    inside['language-' + lang] = {
      pattern: /[\s\S]+/,
      inside: Prism.languages[lang]
    };
    var def = {};
    def[tagName] = {
      pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () {
        return tagName;
      }), 'i'),
      lookbehind: true,
      greedy: true,
      inside: inside
    };
    Prism.languages.insertBefore('markup', 'cdata', def);
  }
});
Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
  /**
   * Adds an pattern to highlight languages embedded in HTML attributes.
   *
   * An example of an inlined language is CSS with `style` attributes.
   *
   * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
   * case insensitive.
   * @param {string} lang The language key.
   * @example
   * addAttribute('style', 'css');
   */
  value: function (attrName, lang) {
    Prism.languages.markup.tag.inside['special-attr'].push({
      pattern: RegExp(/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source, 'i'),
      lookbehind: true,
      inside: {
        'attr-name': /^[^\s=]+/,
        'attr-value': {
          pattern: /=[\s\S]+/,
          inside: {
            'value': {
              pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
              lookbehind: true,
              alias: [lang, 'language-' + lang],
              inside: Prism.languages[lang]
            },
            'punctuation': [{
              pattern: /^=/,
              alias: 'attr-equals'
            }, /"|'/]
          }
        }
      }
    });
  }
});
Prism.languages.html = Prism.languages.markup;
Prism.languages.mathml = Prism.languages.markup;
Prism.languages.svg = Prism.languages.markup;
Prism.languages.xml = Prism.languages.extend('markup', {});
Prism.languages.ssml = Prism.languages.xml;
Prism.languages.atom = Prism.languages.xml;
Prism.languages.rss = Prism.languages.xml;

/* **********************************************
     Begin prism-css.js
********************************************** */

(function (Prism) {
  var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
  Prism.languages.css = {
    'comment': /\/\*[\s\S]*?\*\//,
    'atrule': {
      pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
      inside: {
        'rule': /^@[\w-]+/,
        'selector-function-argument': {
          pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
          lookbehind: true,
          alias: 'selector'
        },
        'keyword': {
          pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
          lookbehind: true
        }
        // See rest below
      }
    },
    'url': {
      // https://drafts.csswg.org/css-values-3/#urls
      pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
      greedy: true,
      inside: {
        'function': /^url/i,
        'punctuation': /^\(|\)$/,
        'string': {
          pattern: RegExp('^' + string.source + '$'),
          alias: 'url'
        }
      }
    },
    'selector': {
      pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
      lookbehind: true
    },
    'string': {
      pattern: string,
      greedy: true
    },
    'property': {
      pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
      lookbehind: true
    },
    'important': /!important\b/i,
    'function': {
      pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
      lookbehind: true
    },
    'punctuation': /[(){};:,]/
  };
  Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
  var markup = Prism.languages.markup;
  if (markup) {
    markup.tag.addInlined('style', 'css');
    markup.tag.addAttribute('style', 'css');
  }
})(Prism);

/* **********************************************
     Begin prism-clike.js
********************************************** */

Prism.languages.clike = {
  'comment': [{
    pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
    lookbehind: true,
    greedy: true
  }, {
    pattern: /(^|[^\\:])\/\/.*/,
    lookbehind: true,
    greedy: true
  }],
  'string': {
    pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
    greedy: true
  },
  'class-name': {
    pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
    lookbehind: true,
    inside: {
      'punctuation': /[.\\]/
    }
  },
  'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
  'boolean': /\b(?:false|true)\b/,
  'function': /\b\w+(?=\()/,
  'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
  'punctuation': /[{}[\];(),.:]/
};

/* **********************************************
     Begin prism-javascript.js
********************************************** */

Prism.languages.javascript = Prism.languages.extend('clike', {
  'class-name': [Prism.languages.clike['class-name'], {
    pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
    lookbehind: true
  }],
  'keyword': [{
    pattern: /((?:^|\})\s*)catch\b/,
    lookbehind: true
  }, {
    pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
    lookbehind: true
  }],
  // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
  'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
  'number': {
    pattern: RegExp(/(^|[^\w$])/.source + '(?:' + (
    // constant
    /NaN|Infinity/.source + '|' +
    // binary integer
    /0[bB][01]+(?:_[01]+)*n?/.source + '|' +
    // octal integer
    /0[oO][0-7]+(?:_[0-7]+)*n?/.source + '|' +
    // hexadecimal integer
    /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + '|' +
    // decimal bigint
    /\d+(?:_\d+)*n/.source + '|' +
    // decimal number (integer or float) but no bigint
    /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ')' + /(?![\w$])/.source),
    lookbehind: true
  },
  'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
});
Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
Prism.languages.insertBefore('javascript', 'keyword', {
  'regex': {
    pattern: RegExp(
    // lookbehind
    // eslint-disable-next-line regexp/no-dupe-characters-character-class
    /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
    // Regex pattern:
    // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
    // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
    // with the only syntax, so we have to define 2 different regex patterns.
    /\//.source + '(?:' + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + '|' +
    // `v` flag syntax. This supports 3 levels of nested character classes.
    /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ')' +
    // lookahead
    /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),
    lookbehind: true,
    greedy: true,
    inside: {
      'regex-source': {
        pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
        lookbehind: true,
        alias: 'language-regex',
        inside: Prism.languages.regex
      },
      'regex-delimiter': /^\/|\/$/,
      'regex-flags': /^[a-z]+$/
    }
  },
  // This must be declared before keyword because we use "function" inside the look-forward
  'function-variable': {
    pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
    alias: 'function'
  },
  'parameter': [{
    pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
    lookbehind: true,
    inside: Prism.languages.javascript
  }, {
    pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
    lookbehind: true,
    inside: Prism.languages.javascript
  }, {
    pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
    lookbehind: true,
    inside: Prism.languages.javascript
  }, {
    pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
    lookbehind: true,
    inside: Prism.languages.javascript
  }],
  'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
});
Prism.languages.insertBefore('javascript', 'string', {
  'hashbang': {
    pattern: /^#!.*/,
    greedy: true,
    alias: 'comment'
  },
  'template-string': {
    pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
    greedy: true,
    inside: {
      'template-punctuation': {
        pattern: /^`|`$/,
        alias: 'string'
      },
      'interpolation': {
        pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
        lookbehind: true,
        inside: {
          'interpolation-punctuation': {
            pattern: /^\$\{|\}$/,
            alias: 'punctuation'
          },
          rest: Prism.languages.javascript
        }
      },
      'string': /[\s\S]+/
    }
  },
  'string-property': {
    pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
    lookbehind: true,
    greedy: true,
    alias: 'property'
  }
});
Prism.languages.insertBefore('javascript', 'operator', {
  'literal-property': {
    pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
    lookbehind: true,
    alias: 'property'
  }
});
if (Prism.languages.markup) {
  Prism.languages.markup.tag.addInlined('script', 'javascript');

  // add attribute support for all DOM events.
  // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
  Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source, 'javascript');
}
Prism.languages.js = Prism.languages.javascript;

/* **********************************************
     Begin prism-file-highlight.js
********************************************** */

(function () {
  if (typeof Prism === 'undefined' || typeof document === 'undefined') {
    return;
  }

  // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
  if (!Element.prototype.matches) {
    Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
  }
  var LOADING_MESSAGE = 'Loading…';
  var FAILURE_MESSAGE = function (status, message) {
    return '✖ Error ' + status + ' while fetching file: ' + message;
  };
  var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
  var EXTENSIONS = {
    'js': 'javascript',
    'py': 'python',
    'rb': 'ruby',
    'ps1': 'powershell',
    'psm1': 'powershell',
    'sh': 'bash',
    'bat': 'batch',
    'h': 'c',
    'tex': 'latex'
  };
  var STATUS_ATTR = 'data-src-status';
  var STATUS_LOADING = 'loading';
  var STATUS_LOADED = 'loaded';
  var STATUS_FAILED = 'failed';
  var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])' + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';

  /**
   * Loads the given file.
   *
   * @param {string} src The URL or path of the source file to load.
   * @param {(result: string) => void} success
   * @param {(reason: string) => void} error
   */
  function loadFile(src, success, error) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', src, true);
    xhr.onreadystatechange = function () {
      if (xhr.readyState == 4) {
        if (xhr.status < 400 && xhr.responseText) {
          success(xhr.responseText);
        } else {
          if (xhr.status >= 400) {
            error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
          } else {
            error(FAILURE_EMPTY_MESSAGE);
          }
        }
      }
    };
    xhr.send(null);
  }

  /**
   * Parses the given range.
   *
   * This returns a range with inclusive ends.
   *
   * @param {string | null | undefined} range
   * @returns {[number, number | undefined] | undefined}
   */
  function parseRange(range) {
    var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
    if (m) {
      var start = Number(m[1]);
      var comma = m[2];
      var end = m[3];
      if (!comma) {
        return [start, start];
      }
      if (!end) {
        return [start, undefined];
      }
      return [start, Number(end)];
    }
    return undefined;
  }
  Prism.hooks.add('before-highlightall', function (env) {
    env.selector += ', ' + SELECTOR;
  });
  Prism.hooks.add('before-sanity-check', function (env) {
    var pre = /** @type {HTMLPreElement} */env.element;
    if (pre.matches(SELECTOR)) {
      env.code = ''; // fast-path the whole thing and go to complete

      pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading

      // add code element with loading message
      var code = pre.appendChild(document.createElement('CODE'));
      code.textContent = LOADING_MESSAGE;
      var src = pre.getAttribute('data-src');
      var language = env.language;
      if (language === 'none') {
        // the language might be 'none' because there is no language set;
        // in this case, we want to use the extension as the language
        var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
        language = EXTENSIONS[extension] || extension;
      }

      // set language classes
      Prism.util.setLanguage(code, language);
      Prism.util.setLanguage(pre, language);

      // preload the language
      var autoloader = Prism.plugins.autoloader;
      if (autoloader) {
        autoloader.loadLanguages(language);
      }

      // load file
      loadFile(src, function (text) {
        // mark as loaded
        pre.setAttribute(STATUS_ATTR, STATUS_LOADED);

        // handle data-range
        var range = parseRange(pre.getAttribute('data-range'));
        if (range) {
          var lines = text.split(/\r\n?|\n/g);

          // the range is one-based and inclusive on both ends
          var start = range[0];
          var end = range[1] == null ? lines.length : range[1];
          if (start < 0) {
            start += lines.length;
          }
          start = Math.max(0, Math.min(start - 1, lines.length));
          if (end < 0) {
            end += lines.length;
          }
          end = Math.max(0, Math.min(end, lines.length));
          text = lines.slice(start, end).join('\n');

          // add data-start for line numbers
          if (!pre.hasAttribute('data-start')) {
            pre.setAttribute('data-start', String(start + 1));
          }
        }

        // highlight code
        code.textContent = text;
        Prism.highlightElement(code);
      }, function (error) {
        // mark as failed
        pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
        code.textContent = error;
      });
    }
  });
  Prism.plugins.fileHighlight = {
    /**
     * Executes the File Highlight plugin for all matching `pre` elements under the given container.
     *
     * Note: Elements which are already loaded or currently loading will not be touched by this method.
     *
     * @param {ParentNode} [container=document]
     */
    highlight: function highlight(container) {
      var elements = (container || document).querySelectorAll(SELECTOR);
      for (var i = 0, element; element = elements[i++];) {
        Prism.highlightElement(element);
      }
    }
  };
  var logged = false;
  /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
  Prism.fileHighlight = function () {
    if (!logged) {
      console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
      logged = true;
    }
    Prism.plugins.fileHighlight.highlight.apply(this, arguments);
  };
})();
});

(function (Prism) {
  // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
  // + LC_ALL, RANDOM, REPLY, SECONDS.
  // + make sure PS1..4 are here as they are not always set,
  // - some useless things.
  var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
  var commandAfterHeredoc = {
    pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
    lookbehind: true,
    alias: 'punctuation',
    // this looks reasonably well in all themes
    inside: null // see below
  };
  var insideString = {
    'bash': commandAfterHeredoc,
    'environment': {
      pattern: RegExp('\\$' + envVars),
      alias: 'constant'
    },
    'variable': [
    // [0]: Arithmetic Environment
    {
      pattern: /\$?\(\([\s\S]+?\)\)/,
      greedy: true,
      inside: {
        // If there is a $ sign at the beginning highlight $(( and )) as variable
        'variable': [{
          pattern: /(^\$\(\([\s\S]+)\)\)/,
          lookbehind: true
        }, /^\$\(\(/],
        'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
        // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
        'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
        // If there is no $ sign at the beginning highlight (( and )) as punctuation
        'punctuation': /\(\(?|\)\)?|,|;/
      }
    },
    // [1]: Command Substitution
    {
      pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
      greedy: true,
      inside: {
        'variable': /^\$\(|^`|\)$|`$/
      }
    },
    // [2]: Brace expansion
    {
      pattern: /\$\{[^}]+\}/,
      greedy: true,
      inside: {
        'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
        'punctuation': /[\[\]]/,
        'environment': {
          pattern: RegExp('(\\{)' + envVars),
          lookbehind: true,
          alias: 'constant'
        }
      }
    }, /\$(?:\w+|[#?*!@$])/],
    // Escape sequences from echo and printf's manuals, and escaped quotes.
    'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
  };
  Prism.languages.bash = {
    'shebang': {
      pattern: /^#!\s*\/.*/,
      alias: 'important'
    },
    'comment': {
      pattern: /(^|[^"{\\$])#.*/,
      lookbehind: true
    },
    'function-name': [
    // a) function foo {
    // b) foo() {
    // c) function foo() {
    // but not “foo {”
    {
      // a) and c)
      pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
      lookbehind: true,
      alias: 'function'
    }, {
      // b)
      pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
      alias: 'function'
    }],
    // Highlight variable names as variables in for and select beginnings.
    'for-or-select': {
      pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
      alias: 'variable',
      lookbehind: true
    },
    // Highlight variable names as variables in the left-hand part
    // of assignments (“=” and “+=”).
    'assign-left': {
      pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
      inside: {
        'environment': {
          pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
          lookbehind: true,
          alias: 'constant'
        }
      },
      alias: 'variable',
      lookbehind: true
    },
    // Highlight parameter names as variables
    'parameter': {
      pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
      alias: 'variable',
      lookbehind: true
    },
    'string': [
    // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
    {
      pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
      lookbehind: true,
      greedy: true,
      inside: insideString
    },
    // Here-document with quotes around the tag
    // → No expansion (so no “inside”).
    {
      pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
      lookbehind: true,
      greedy: true,
      inside: {
        'bash': commandAfterHeredoc
      }
    },
    // “Normal” string
    {
      // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
      pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
      lookbehind: true,
      greedy: true,
      inside: insideString
    }, {
      // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
      pattern: /(^|[^$\\])'[^']*'/,
      lookbehind: true,
      greedy: true
    }, {
      // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
      pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
      greedy: true,
      inside: {
        'entity': insideString.entity
      }
    }],
    'environment': {
      pattern: RegExp('\\$?' + envVars),
      alias: 'constant'
    },
    'variable': insideString.variable,
    'function': {
      pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
      lookbehind: true
    },
    'keyword': {
      pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
      lookbehind: true
    },
    // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
    'builtin': {
      pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
      lookbehind: true,
      // Alias added to make those easier to distinguish from strings.
      alias: 'class-name'
    },
    'boolean': {
      pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
      lookbehind: true
    },
    'file-descriptor': {
      pattern: /\B&\d\b/,
      alias: 'important'
    },
    'operator': {
      // Lots of redirections here, but not just that.
      pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
      inside: {
        'file-descriptor': {
          pattern: /^\d/,
          alias: 'important'
        }
      }
    },
    'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
    'number': {
      pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
      lookbehind: true
    }
  };
  commandAfterHeredoc.inside = Prism.languages.bash;

  /* Patterns in command substitution. */
  var toBeCopied = ['comment', 'function-name', 'for-or-select', 'assign-left', 'parameter', 'string', 'environment', 'function', 'keyword', 'builtin', 'boolean', 'file-descriptor', 'operator', 'punctuation', 'number'];
  var inside = insideString.variable[1].inside;
  for (var i = 0; i < toBeCopied.length; i++) {
    inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
  }
  Prism.languages.sh = Prism.languages.bash;
  Prism.languages.shell = Prism.languages.bash;
})(Prism);

Prism.languages.c = Prism.languages.extend('clike', {
  'comment': {
    pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
    greedy: true
  },
  'string': {
    // https://en.cppreference.com/w/c/language/string_literal
    pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
    greedy: true
  },
  'class-name': {
    pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
    lookbehind: true
  },
  'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
  'function': /\b[a-z_]\w*(?=\s*\()/i,
  'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
  'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
});
Prism.languages.insertBefore('c', 'string', {
  'char': {
    // https://en.cppreference.com/w/c/language/character_constant
    pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
    greedy: true
  }
});
Prism.languages.insertBefore('c', 'string', {
  'macro': {
    // allow for multiline macro definitions
    // spaces after the # character compile fine with gcc
    pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
    lookbehind: true,
    greedy: true,
    alias: 'property',
    inside: {
      'string': [{
        // highlight the path of the include statement as a string
        pattern: /^(#\s*include\s*)<[^>]+>/,
        lookbehind: true
      }, Prism.languages.c['string']],
      'char': Prism.languages.c['char'],
      'comment': Prism.languages.c['comment'],
      'macro-name': [{
        pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
        lookbehind: true
      }, {
        pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
        lookbehind: true,
        alias: 'function'
      }],
      // highlight macro directives as keywords
      'directive': {
        pattern: /^(#\s*)[a-z]+/,
        lookbehind: true,
        alias: 'keyword'
      },
      'directive-hash': /^#/,
      'punctuation': /##|\\(?=[\r\n])/,
      'expression': {
        pattern: /\S[\s\S]*/,
        inside: Prism.languages.c
      }
    }
  }
});
Prism.languages.insertBefore('c', 'function', {
  // highlight predefined macros as constants
  'constant': /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
});
delete Prism.languages.c['boolean'];

(function (Prism) {
  var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
  var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function () {
    return keyword.source;
  });
  Prism.languages.cpp = Prism.languages.extend('c', {
    'class-name': [{
      pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function () {
        return keyword.source;
      })),
      lookbehind: true
    },
    // This is intended to capture the class name of method implementations like:
    //   void foo::bar() const {}
    // However! The `foo` in the above example could also be a namespace, so we only capture the class name if
    // it starts with an uppercase letter. This approximation should give decent results.
    /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
    // This will capture the class name before destructors like:
    //   Foo::~Foo() {}
    /\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
    // This also intends to capture the class name of method implementations but here the class has template
    // parameters, so it can't be a namespace (until C++ adds generic namespaces).
    /\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],
    'keyword': keyword,
    'number': {
      pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
      greedy: true
    },
    'operator': />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
    'boolean': /\b(?:false|true)\b/
  });
  Prism.languages.insertBefore('cpp', 'string', {
    'module': {
      // https://en.cppreference.com/w/cpp/language/modules
      pattern: RegExp(/(\b(?:import|module)\s+)/.source + '(?:' +
      // header-name
      /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source + '|' +
      // module name or partition or both
      /<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function () {
        return modName;
      }) + ')'),
      lookbehind: true,
      greedy: true,
      inside: {
        'string': /^[<"][\s\S]+/,
        'operator': /:/,
        'punctuation': /\./
      }
    },
    'raw-string': {
      pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
      alias: 'string',
      greedy: true
    }
  });
  Prism.languages.insertBefore('cpp', 'keyword', {
    'generic-function': {
      pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
      inside: {
        'function': /^\w+/,
        'generic': {
          pattern: /<[\s\S]+/,
          alias: 'class-name',
          inside: Prism.languages.cpp
        }
      }
    }
  });
  Prism.languages.insertBefore('cpp', 'operator', {
    'double-colon': {
      pattern: /::/,
      alias: 'punctuation'
    }
  });
  Prism.languages.insertBefore('cpp', 'class-name', {
    // the base clause is an optional list of parent classes
    // https://en.cppreference.com/w/cpp/language/class
    'base-clause': {
      pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
      lookbehind: true,
      greedy: true,
      inside: Prism.languages.extend('cpp', {})
    }
  });
  Prism.languages.insertBefore('inside', 'double-colon', {
    // All untokenized words that are not namespaces should be class names
    'class-name': /\b[a-z_]\w*\b(?!\s*::)/i
  }, Prism.languages.cpp['base-clause']);
})(Prism);

(function (Prism) {
  var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
  Prism.languages.css = {
    'comment': /\/\*[\s\S]*?\*\//,
    'atrule': {
      pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
      inside: {
        'rule': /^@[\w-]+/,
        'selector-function-argument': {
          pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
          lookbehind: true,
          alias: 'selector'
        },
        'keyword': {
          pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
          lookbehind: true
        }
        // See rest below
      }
    },
    'url': {
      // https://drafts.csswg.org/css-values-3/#urls
      pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
      greedy: true,
      inside: {
        'function': /^url/i,
        'punctuation': /^\(|\)$/,
        'string': {
          pattern: RegExp('^' + string.source + '$'),
          alias: 'url'
        }
      }
    },
    'selector': {
      pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
      lookbehind: true
    },
    'string': {
      pattern: string,
      greedy: true
    },
    'property': {
      pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
      lookbehind: true
    },
    'important': /!important\b/i,
    'function': {
      pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
      lookbehind: true
    },
    'punctuation': /[(){};:,]/
  };
  Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
  var markup = Prism.languages.markup;
  if (markup) {
    markup.tag.addInlined('style', 'css');
    markup.tag.addAttribute('style', 'css');
  }
})(Prism);

(function (Prism) {
  /**
   * Replaces all placeholders "<<n>>" of given pattern with the n-th replacement (zero based).
   *
   * Note: This is a simple text based replacement. Be careful when using backreferences!
   *
   * @param {string} pattern the given pattern.
   * @param {string[]} replacements a list of replacement which can be inserted into the given pattern.
   * @returns {string} the pattern with all placeholders replaced with their corresponding replacements.
   * @example replace(/a<<0>>a/.source, [/b+/.source]) === /a(?:b+)a/.source
   */
  function replace(pattern, replacements) {
    return pattern.replace(/<<(\d+)>>/g, function (m, index) {
      return '(?:' + replacements[+index] + ')';
    });
  }
  /**
   * @param {string} pattern
   * @param {string[]} replacements
   * @param {string} [flags]
   * @returns {RegExp}
   */
  function re(pattern, replacements, flags) {
    return RegExp(replace(pattern, replacements), flags || '');
  }

  /**
   * Creates a nested pattern where all occurrences of the string `<<self>>` are replaced with the pattern itself.
   *
   * @param {string} pattern
   * @param {number} depthLog2
   * @returns {string}
   */
  function nested(pattern, depthLog2) {
    for (var i = 0; i < depthLog2; i++) {
      pattern = pattern.replace(/<<self>>/g, function () {
        return '(?:' + pattern + ')';
      });
    }
    return pattern.replace(/<<self>>/g, '[^\\s\\S]');
  }

  // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/
  var keywordKinds = {
    // keywords which represent a return or variable type
    type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void',
    // keywords which are used to declare a type
    typeDeclaration: 'class enum interface record struct',
    // contextual keywords
    // ("var" and "dynamic" are missing because they are used like types)
    contextual: 'add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)',
    // all other keywords
    other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'
  };

  // keywords
  function keywordsToPattern(words) {
    return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b';
  }
  var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
  var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other));
  var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other);
  var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other);

  // types
  var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2); // the idea behind the other forbidden characters is to prevent false positives. Same for tupleElement.
  var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
  var name = /@?\b[A-Za-z_]\w*\b/.source;
  var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]);
  var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [nonTypeKeywords, genericName]);
  var array = /\[\s*(?:,\s*)*\]/.source;
  var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [identifier, array]);
  var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [generic, nestedRound, array]);
  var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
  var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [tuple, identifier, array]);
  var typeInside = {
    'keyword': keywords,
    'punctuation': /[<>()?,.:[\]]/
  };

  // strings & characters
  // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#character-literals
  // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#string-literals
  var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source; // simplified pattern
  var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
  var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
  Prism.languages.csharp = Prism.languages.extend('clike', {
    'string': [{
      pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
      lookbehind: true,
      greedy: true
    }, {
      pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
      lookbehind: true,
      greedy: true
    }],
    'class-name': [{
      // Using static
      // using static System.Math;
      pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
      lookbehind: true,
      inside: typeInside
    }, {
      // Using alias (type)
      // using Project = PC.MyCompany.Project;
      pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [name, typeExpression]),
      lookbehind: true,
      inside: typeInside
    }, {
      // Using alias (alias)
      // using Project = PC.MyCompany.Project;
      pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
      lookbehind: true
    }, {
      // Type declarations
      // class Foo<A, B>
      // interface Foo<out A, B>
      pattern: re(/(\b<<0>>\s+)<<1>>/.source, [typeDeclarationKeywords, genericName]),
      lookbehind: true,
      inside: typeInside
    }, {
      // Single catch exception declaration
      // catch(Foo)
      // (things like catch(Foo e) is covered by variable declaration)
      pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
      lookbehind: true,
      inside: typeInside
    }, {
      // Name of the type parameter of generic constraints
      // where Foo : class
      pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
      lookbehind: true
    }, {
      // Casts and checks via as and is.
      // as Foo<A>, is Bar<B>
      // (things like if(a is Foo b) is covered by variable declaration)
      pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
      lookbehind: true,
      inside: typeInside
    }, {
      // Variable, field and parameter declaration
      // (Foo bar, Bar baz, Foo[,,] bay, Foo<Bar, FooBar<Bar>> bax)
      pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [typeExpression, nonContextualKeywords, name]),
      inside: typeInside
    }],
    'keyword': keywords,
    // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#literals
    'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
    'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
    'punctuation': /\?\.?|::|[{}[\];(),.:]/
  });
  Prism.languages.insertBefore('csharp', 'number', {
    'range': {
      pattern: /\.\./,
      alias: 'operator'
    }
  });
  Prism.languages.insertBefore('csharp', 'punctuation', {
    'named-parameter': {
      pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
      lookbehind: true,
      alias: 'punctuation'
    }
  });
  Prism.languages.insertBefore('csharp', 'class-name', {
    'namespace': {
      // namespace Foo.Bar {}
      // using Foo.Bar;
      pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
      lookbehind: true,
      inside: {
        'punctuation': /\./
      }
    },
    'type-expression': {
      // default(Foo), typeof(Foo<Bar>), sizeof(int)
      pattern: re(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
      lookbehind: true,
      alias: 'class-name',
      inside: typeInside
    },
    'return-type': {
      // Foo<Bar> ForBar(); Foo IFoo.Bar() => 0
      // int this[int index] => 0; T IReadOnlyList<T>.this[int index] => this[index];
      // int Foo => 0; int Foo { get; set } = 0;
      pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [typeExpression, identifier]),
      inside: typeInside,
      alias: 'class-name'
    },
    'constructor-invocation': {
      // new List<Foo<Bar[]>> { }
      pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
      lookbehind: true,
      inside: typeInside,
      alias: 'class-name'
    },
    /*'explicit-implementation': {
    	// int IFoo<Foo>.Bar => 0; void IFoo<Foo<Foo>>.Foo<T>();
    	pattern: replace(/\b<<0>>(?=\.<<1>>)/, className, methodOrPropertyDeclaration),
    	inside: classNameInside,
    	alias: 'class-name'
    },*/
    'generic-method': {
      // foo<Bar>()
      pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [name, generic]),
      inside: {
        'function': re(/^<<0>>/.source, [name]),
        'generic': {
          pattern: RegExp(generic),
          alias: 'class-name',
          inside: typeInside
        }
      }
    },
    'type-list': {
      // The list of types inherited or of generic constraints
      // class Foo<F> : Bar, IList<FooBar>
      // where F : Bar, IList<int>
      pattern: re(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source, [typeDeclarationKeywords, genericName, name, typeExpression, keywords.source, nestedRound, /\bnew\s*\(\s*\)/.source]),
      lookbehind: true,
      inside: {
        'record-arguments': {
          pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [genericName, nestedRound]),
          lookbehind: true,
          greedy: true,
          inside: Prism.languages.csharp
        },
        'keyword': keywords,
        'class-name': {
          pattern: RegExp(typeExpression),
          greedy: true,
          inside: typeInside
        },
        'punctuation': /[,()]/
      }
    },
    'preprocessor': {
      pattern: /(^[\t ]*)#.*/m,
      lookbehind: true,
      alias: 'property',
      inside: {
        // highlight preprocessor directives as keywords
        'directive': {
          pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
          lookbehind: true,
          alias: 'keyword'
        }
      }
    }
  });

  // attributes
  var regularStringOrCharacter = regularString + '|' + character;
  var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
  var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);

  // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/attributes/#attribute-targets
  var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
  var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [identifier, roundExpression]);
  Prism.languages.insertBefore('csharp', 'class-name', {
    'attribute': {
      // Attributes
      // [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
      pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [attrTarget, attr]),
      lookbehind: true,
      greedy: true,
      inside: {
        'target': {
          pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
          alias: 'keyword'
        },
        'attribute-arguments': {
          pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
          inside: Prism.languages.csharp
        },
        'class-name': {
          pattern: RegExp(identifier),
          inside: {
            'punctuation': /\./
          }
        },
        'punctuation': /[:,]/
      }
    }
  });

  // string interpolation
  var formatString = /:[^}\r\n]+/.source;
  // multi line
  var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
  var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [mInterpolationRound, formatString]);
  // single line
  var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
  var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [sInterpolationRound, formatString]);
  function createInterpolationInside(interpolation, interpolationRound) {
    return {
      'interpolation': {
        pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
        lookbehind: true,
        inside: {
          'format-string': {
            pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [interpolationRound, formatString]),
            lookbehind: true,
            inside: {
              'punctuation': /^:/
            }
          },
          'punctuation': /^\{|\}$/,
          'expression': {
            pattern: /[\s\S]+/,
            alias: 'language-csharp',
            inside: Prism.languages.csharp
          }
        }
      },
      'string': /[\s\S]+/
    };
  }
  Prism.languages.insertBefore('csharp', 'string', {
    'interpolation-string': [{
      pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
      lookbehind: true,
      greedy: true,
      inside: createInterpolationInside(mInterpolation, mInterpolationRound)
    }, {
      pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
      lookbehind: true,
      greedy: true,
      inside: createInterpolationInside(sInterpolation, sInterpolationRound)
    }],
    'char': {
      pattern: RegExp(character),
      greedy: true
    }
  });
  Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;
})(Prism);

(function (Prism) {
  var keywords = [/\b(?:async|sync|yield)\*/, /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|covariant|default|deferred|do|dynamic|else|enum|export|extends|extension|external|factory|final|finally|for|get|hide|if|implements|import|in|interface|library|mixin|new|null|on|operator|part|rethrow|return|set|show|static|super|switch|sync|this|throw|try|typedef|var|void|while|with|yield)\b/];

  // Handles named imports, such as http.Client
  var packagePrefix = /(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;

  // based on the dart naming conventions
  var className = {
    pattern: RegExp(packagePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
    lookbehind: true,
    inside: {
      'namespace': {
        pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
        inside: {
          'punctuation': /\./
        }
      }
    }
  };
  Prism.languages.dart = Prism.languages.extend('clike', {
    'class-name': [className, {
      // variables and parameters
      // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
      pattern: RegExp(packagePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()])/.source),
      lookbehind: true,
      inside: className.inside
    }],
    'keyword': keywords,
    'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/
  });
  Prism.languages.insertBefore('dart', 'string', {
    'string-literal': {
      pattern: /r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/,
      greedy: true,
      inside: {
        'interpolation': {
          pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
          lookbehind: true,
          inside: {
            'punctuation': /^\$\{?|\}$/,
            'expression': {
              pattern: /[\s\S]+/,
              inside: Prism.languages.dart
            }
          }
        },
        'string': /[\s\S]+/
      }
    },
    'string': undefined
  });
  Prism.languages.insertBefore('dart', 'class-name', {
    'metadata': {
      pattern: /@\w+/,
      alias: 'function'
    }
  });
  Prism.languages.insertBefore('dart', 'class-name', {
    'generics': {
      pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,
      inside: {
        'class-name': className,
        'keyword': keywords,
        'punctuation': /[<>(),.:]/,
        'operator': /[?&|]/
      }
    }
  });
})(Prism);

(function (Prism) {
  Prism.languages.diff = {
    'coord': [
    // Match all kinds of coord lines (prefixed by "+++", "---" or "***").
    /^(?:\*{3}|-{3}|\+{3}).*$/m,
    // Match "@@ ... @@" coord lines in unified diff.
    /^@@.*@@$/m,
    // Match coord lines in normal diff (starts with a number).
    /^\d.*$/m]

    // deleted, inserted, unchanged, diff
  };

  /**
   * A map from the name of a block to its line prefix.
   *
   * @type {Object<string, string>}
   */
  var PREFIXES = {
    'deleted-sign': '-',
    'deleted-arrow': '<',
    'inserted-sign': '+',
    'inserted-arrow': '>',
    'unchanged': ' ',
    'diff': '!'
  };

  // add a token for each prefix
  Object.keys(PREFIXES).forEach(function (name) {
    var prefix = PREFIXES[name];
    var alias = [];
    if (!/^\w+$/.test(name)) {
      // "deleted-sign" -> "deleted"
      alias.push(/\w+/.exec(name)[0]);
    }
    if (name === 'diff') {
      alias.push('bold');
    }
    Prism.languages.diff[name] = {
      pattern: RegExp('^(?:[' + prefix + '].*(?:\r\n?|\n|(?![\\s\\S])))+', 'm'),
      alias: alias,
      inside: {
        'line': {
          pattern: /(.)(?=[\s\S]).*(?:\r\n?|\n)?/,
          lookbehind: true
        },
        'prefix': {
          pattern: /[\s\S]/,
          alias: /\w+/.exec(name)[0]
        }
      }
    };
  });

  // make prefixes available to Diff plugin
  Object.defineProperty(Prism.languages.diff, 'PREFIXES', {
    value: PREFIXES
  });
})(Prism);

Prism.languages.erlang = {
  'comment': /%.+/,
  'string': {
    pattern: /"(?:\\.|[^\\"\r\n])*"/,
    greedy: true
  },
  'quoted-function': {
    pattern: /'(?:\\.|[^\\'\r\n])+'(?=\()/,
    alias: 'function'
  },
  'quoted-atom': {
    pattern: /'(?:\\.|[^\\'\r\n])+'/,
    alias: 'atom'
  },
  'boolean': /\b(?:false|true)\b/,
  'keyword': /\b(?:after|begin|case|catch|end|fun|if|of|receive|try|when)\b/,
  'number': [/\$\\?./, /\b\d+#[a-z0-9]+/i, /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i],
  'function': /\b[a-z][\w@]*(?=\()/,
  'variable': {
    // Look-behind is used to prevent wrong highlighting of atoms containing "@"
    pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,
    lookbehind: true
  },
  'operator': [/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:and|andalso|band|bnot|bor|bsl|bsr|bxor|div|not|or|orelse|rem|xor)\b/, {
    // We don't want to match <<
    pattern: /(^|[^<])<(?!<)/,
    lookbehind: true
  }, {
    // We don't want to match >>
    pattern: /(^|[^>])>(?!>)/,
    lookbehind: true
  }],
  'atom': /\b[a-z][\w@]*/,
  'punctuation': /[()[\]{}:;,.#|]|<<|>>/
};

Prism.languages.go = Prism.languages.extend('clike', {
  'string': {
    pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
    lookbehind: true,
    greedy: true
  },
  'keyword': /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
  'boolean': /\b(?:_|false|iota|nil|true)\b/,
  'number': [
  // binary and octal integers
  /\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
  // hexadecimal integers and floats
  /\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
  // decimal integers and floats
  /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],
  'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
  'builtin': /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/
});
Prism.languages.insertBefore('go', 'string', {
  'char': {
    pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
    greedy: true
  }
});
delete Prism.languages.go['class-name'];

(function (Prism) {
  var interpolation = {
    pattern: /((?:^|[^\\$])(?:\\{2})*)\$(?:\w+|\{[^{}]*\})/,
    lookbehind: true,
    inside: {
      'interpolation-punctuation': {
        pattern: /^\$\{?|\}$/,
        alias: 'punctuation'
      },
      'expression': {
        pattern: /[\s\S]+/,
        inside: null // see below
      }
    }
  };
  Prism.languages.groovy = Prism.languages.extend('clike', {
    'string': {
      // https://groovy-lang.org/syntax.html#_dollar_slashy_string
      pattern: /'''(?:[^\\]|\\[\s\S])*?'''|'(?:\\.|[^\\'\r\n])*'/,
      greedy: true
    },
    'keyword': /\b(?:abstract|as|assert|boolean|break|byte|case|catch|char|class|const|continue|def|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/,
    'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?\d+)?)[glidf]?\b/i,
    'operator': {
      pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.\.(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/,
      lookbehind: true
    },
    'punctuation': /\.+|[{}[\];(),:$]/
  });
  Prism.languages.insertBefore('groovy', 'string', {
    'shebang': {
      pattern: /#!.+/,
      alias: 'comment',
      greedy: true
    },
    'interpolation-string': {
      // TODO: Slash strings (e.g. /foo/) can contain line breaks but this will cause a lot of trouble with
      // simple division (see JS regex), so find a fix maybe?
      pattern: /"""(?:[^\\]|\\[\s\S])*?"""|(["/])(?:\\.|(?!\1)[^\\\r\n])*\1|\$\/(?:[^/$]|\$(?:[/$]|(?![/$]))|\/(?!\$))*\/\$/,
      greedy: true,
      inside: {
        'interpolation': interpolation,
        'string': /[\s\S]+/
      }
    }
  });
  Prism.languages.insertBefore('groovy', 'punctuation', {
    'spock-block': /\b(?:and|cleanup|expect|given|setup|then|when|where):/
  });
  Prism.languages.insertBefore('groovy', 'function', {
    'annotation': {
      pattern: /(^|[^.])@\w+/,
      lookbehind: true,
      alias: 'punctuation'
    }
  });
  interpolation.inside.expression.inside = Prism.languages.groovy;
})(Prism);

Prism.languages.markup = {
  'comment': {
    pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
    greedy: true
  },
  'prolog': {
    pattern: /<\?[\s\S]+?\?>/,
    greedy: true
  },
  'doctype': {
    // https://www.w3.org/TR/xml/#NT-doctypedecl
    pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
    greedy: true,
    inside: {
      'internal-subset': {
        pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
        lookbehind: true,
        greedy: true,
        inside: null // see below
      },
      'string': {
        pattern: /"[^"]*"|'[^']*'/,
        greedy: true
      },
      'punctuation': /^<!|>$|[[\]]/,
      'doctype-tag': /^DOCTYPE/i,
      'name': /[^\s<>'"]+/
    }
  },
  'cdata': {
    pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
    greedy: true
  },
  'tag': {
    pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
    greedy: true,
    inside: {
      'tag': {
        pattern: /^<\/?[^\s>\/]+/,
        inside: {
          'punctuation': /^<\/?/,
          'namespace': /^[^\s>\/:]+:/
        }
      },
      'special-attr': [],
      'attr-value': {
        pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
        inside: {
          'punctuation': [{
            pattern: /^=/,
            alias: 'attr-equals'
          }, {
            pattern: /^(\s*)["']|["']$/,
            lookbehind: true
          }]
        }
      },
      'punctuation': /\/?>/,
      'attr-name': {
        pattern: /[^\s>\/]+/,
        inside: {
          'namespace': /^[^\s>\/:]+:/
        }
      }
    }
  },
  'entity': [{
    pattern: /&[\da-z]{1,8};/i,
    alias: 'named-entity'
  }, /&#x?[\da-f]{1,8};/i]
};
Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity'];
Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;

// Plugin to make entity title show the real entity, idea by Roman Komarov
Prism.hooks.add('wrap', function (env) {
  if (env.type === 'entity') {
    env.attributes['title'] = env.content.replace(/&amp;/, '&');
  }
});
Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
  /**
   * Adds an inlined language to markup.
   *
   * An example of an inlined language is CSS with `<style>` tags.
   *
   * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
   * case insensitive.
   * @param {string} lang The language key.
   * @example
   * addInlined('style', 'css');
   */
  value: function addInlined(tagName, lang) {
    var includedCdataInside = {};
    includedCdataInside['language-' + lang] = {
      pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
      lookbehind: true,
      inside: Prism.languages[lang]
    };
    includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
    var inside = {
      'included-cdata': {
        pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
        inside: includedCdataInside
      }
    };
    inside['language-' + lang] = {
      pattern: /[\s\S]+/,
      inside: Prism.languages[lang]
    };
    var def = {};
    def[tagName] = {
      pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () {
        return tagName;
      }), 'i'),
      lookbehind: true,
      greedy: true,
      inside: inside
    };
    Prism.languages.insertBefore('markup', 'cdata', def);
  }
});
Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
  /**
   * Adds an pattern to highlight languages embedded in HTML attributes.
   *
   * An example of an inlined language is CSS with `style` attributes.
   *
   * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
   * case insensitive.
   * @param {string} lang The language key.
   * @example
   * addAttribute('style', 'css');
   */
  value: function (attrName, lang) {
    Prism.languages.markup.tag.inside['special-attr'].push({
      pattern: RegExp(/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source, 'i'),
      lookbehind: true,
      inside: {
        'attr-name': /^[^\s=]+/,
        'attr-value': {
          pattern: /=[\s\S]+/,
          inside: {
            'value': {
              pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
              lookbehind: true,
              alias: [lang, 'language-' + lang],
              inside: Prism.languages[lang]
            },
            'punctuation': [{
              pattern: /^=/,
              alias: 'attr-equals'
            }, /"|'/]
          }
        }
      }
    });
  }
});
Prism.languages.html = Prism.languages.markup;
Prism.languages.mathml = Prism.languages.markup;
Prism.languages.svg = Prism.languages.markup;
Prism.languages.xml = Prism.languages.extend('markup', {});
Prism.languages.ssml = Prism.languages.xml;
Prism.languages.atom = Prism.languages.xml;
Prism.languages.rss = Prism.languages.xml;

(function (Prism) {
  /**
   * Returns the placeholder for the given language id and index.
   *
   * @param {string} language
   * @param {string|number} index
   * @returns {string}
   */
  function getPlaceholder(language, index) {
    return '___' + language.toUpperCase() + index + '___';
  }
  Object.defineProperties(Prism.languages['markup-templating'] = {}, {
    buildPlaceholders: {
      /**
       * Tokenize all inline templating expressions matching `placeholderPattern`.
       *
       * If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns
       * `true` will be replaced.
       *
       * @param {object} env The environment of the `before-tokenize` hook.
       * @param {string} language The language id.
       * @param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.
       * @param {(match: string) => boolean} [replaceFilter]
       */
      value: function (env, language, placeholderPattern, replaceFilter) {
        if (env.language !== language) {
          return;
        }
        var tokenStack = env.tokenStack = [];
        env.code = env.code.replace(placeholderPattern, function (match) {
          if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
            return match;
          }
          var i = tokenStack.length;
          var placeholder;

          // Check for existing strings
          while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1) {
            ++i;
          }

          // Create a sparse array
          tokenStack[i] = match;
          return placeholder;
        });

        // Switch the grammar to markup
        env.grammar = Prism.languages.markup;
      }
    },
    tokenizePlaceholders: {
      /**
       * Replace placeholders with proper tokens after tokenizing.
       *
       * @param {object} env The environment of the `after-tokenize` hook.
       * @param {string} language The language id.
       */
      value: function (env, language) {
        if (env.language !== language || !env.tokenStack) {
          return;
        }

        // Switch the grammar back
        env.grammar = Prism.languages[language];
        var j = 0;
        var keys = Object.keys(env.tokenStack);
        function walkTokens(tokens) {
          for (var i = 0; i < tokens.length; i++) {
            // all placeholders are replaced already
            if (j >= keys.length) {
              break;
            }
            var token = tokens[i];
            if (typeof token === 'string' || token.content && typeof token.content === 'string') {
              var k = keys[j];
              var t = env.tokenStack[k];
              var s = typeof token === 'string' ? token : token.content;
              var placeholder = getPlaceholder(language, k);
              var index = s.indexOf(placeholder);
              if (index > -1) {
                ++j;
                var before = s.substring(0, index);
                var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
                var after = s.substring(index + placeholder.length);
                var replacement = [];
                if (before) {
                  replacement.push.apply(replacement, walkTokens([before]));
                }
                replacement.push(middle);
                if (after) {
                  replacement.push.apply(replacement, walkTokens([after]));
                }
                if (typeof token === 'string') {
                  tokens.splice.apply(tokens, [i, 1].concat(replacement));
                } else {
                  token.content = replacement;
                }
              }
            } else if (token.content /* && typeof token.content !== 'string' */) {
              walkTokens(token.content);
            }
          }
          return tokens;
        }
        walkTokens(env.tokens);
      }
    }
  });
})(Prism);

(function (Prism) {
  var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;

  // full package (optional) + parent classes (optional)
  var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;

  // based on the java naming conventions
  var className = {
    pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
    lookbehind: true,
    inside: {
      'namespace': {
        pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
        inside: {
          'punctuation': /\./
        }
      },
      'punctuation': /\./
    }
  };
  Prism.languages.java = Prism.languages.extend('clike', {
    'string': {
      pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
      lookbehind: true,
      greedy: true
    },
    'class-name': [className, {
      // variables, parameters, and constructor references
      // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
      pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
      lookbehind: true,
      inside: className.inside
    }, {
      // class names based on keyword
      // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
      pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
      lookbehind: true,
      inside: className.inside
    }],
    'keyword': keywords,
    'function': [Prism.languages.clike.function, {
      pattern: /(::\s*)[a-z_]\w*/,
      lookbehind: true
    }],
    'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
    'operator': {
      pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
      lookbehind: true
    },
    'constant': /\b[A-Z][A-Z_\d]+\b/
  });
  Prism.languages.insertBefore('java', 'string', {
    'triple-quoted-string': {
      // http://openjdk.java.net/jeps/355#Description
      pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
      greedy: true,
      alias: 'string'
    },
    'char': {
      pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
      greedy: true
    }
  });
  Prism.languages.insertBefore('java', 'class-name', {
    'annotation': {
      pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
      lookbehind: true,
      alias: 'punctuation'
    },
    'generics': {
      pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
      inside: {
        'class-name': className,
        'keyword': keywords,
        'punctuation': /[<>(),.:]/,
        'operator': /[?&|]/
      }
    },
    'import': [{
      pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
      lookbehind: true,
      inside: {
        'namespace': className.inside.namespace,
        'punctuation': /\./,
        'operator': /\*/,
        'class-name': /\w+/
      }
    }, {
      pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
      lookbehind: true,
      alias: 'static',
      inside: {
        'namespace': className.inside.namespace,
        'static': /\b\w+$/,
        'punctuation': /\./,
        'operator': /\*/,
        'class-name': /\w+/
      }
    }],
    'namespace': {
      pattern: RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function () {
        return keywords.source;
      })),
      lookbehind: true,
      inside: {
        'punctuation': /\./
      }
    }
  });
})(Prism);

Prism.languages.javascript = Prism.languages.extend('clike', {
  'class-name': [Prism.languages.clike['class-name'], {
    pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
    lookbehind: true
  }],
  'keyword': [{
    pattern: /((?:^|\})\s*)catch\b/,
    lookbehind: true
  }, {
    pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
    lookbehind: true
  }],
  // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
  'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
  'number': {
    pattern: RegExp(/(^|[^\w$])/.source + '(?:' + (
    // constant
    /NaN|Infinity/.source + '|' +
    // binary integer
    /0[bB][01]+(?:_[01]+)*n?/.source + '|' +
    // octal integer
    /0[oO][0-7]+(?:_[0-7]+)*n?/.source + '|' +
    // hexadecimal integer
    /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + '|' +
    // decimal bigint
    /\d+(?:_\d+)*n/.source + '|' +
    // decimal number (integer or float) but no bigint
    /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ')' + /(?![\w$])/.source),
    lookbehind: true
  },
  'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
});
Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
Prism.languages.insertBefore('javascript', 'keyword', {
  'regex': {
    pattern: RegExp(
    // lookbehind
    // eslint-disable-next-line regexp/no-dupe-characters-character-class
    /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
    // Regex pattern:
    // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
    // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
    // with the only syntax, so we have to define 2 different regex patterns.
    /\//.source + '(?:' + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + '|' +
    // `v` flag syntax. This supports 3 levels of nested character classes.
    /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ')' +
    // lookahead
    /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),
    lookbehind: true,
    greedy: true,
    inside: {
      'regex-source': {
        pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
        lookbehind: true,
        alias: 'language-regex',
        inside: Prism.languages.regex
      },
      'regex-delimiter': /^\/|\/$/,
      'regex-flags': /^[a-z]+$/
    }
  },
  // This must be declared before keyword because we use "function" inside the look-forward
  'function-variable': {
    pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
    alias: 'function'
  },
  'parameter': [{
    pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
    lookbehind: true,
    inside: Prism.languages.javascript
  }, {
    pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
    lookbehind: true,
    inside: Prism.languages.javascript
  }, {
    pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
    lookbehind: true,
    inside: Prism.languages.javascript
  }, {
    pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
    lookbehind: true,
    inside: Prism.languages.javascript
  }],
  'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
});
Prism.languages.insertBefore('javascript', 'string', {
  'hashbang': {
    pattern: /^#!.*/,
    greedy: true,
    alias: 'comment'
  },
  'template-string': {
    pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
    greedy: true,
    inside: {
      'template-punctuation': {
        pattern: /^`|`$/,
        alias: 'string'
      },
      'interpolation': {
        pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
        lookbehind: true,
        inside: {
          'interpolation-punctuation': {
            pattern: /^\$\{|\}$/,
            alias: 'punctuation'
          },
          rest: Prism.languages.javascript
        }
      },
      'string': /[\s\S]+/
    }
  },
  'string-property': {
    pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
    lookbehind: true,
    greedy: true,
    alias: 'property'
  }
});
Prism.languages.insertBefore('javascript', 'operator', {
  'literal-property': {
    pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
    lookbehind: true,
    alias: 'property'
  }
});
if (Prism.languages.markup) {
  Prism.languages.markup.tag.addInlined('script', 'javascript');

  // add attribute support for all DOM events.
  // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
  Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source, 'javascript');
}
Prism.languages.js = Prism.languages.javascript;

// https://www.json.org/json-en.html
Prism.languages.json = {
  'property': {
    pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
    lookbehind: true,
    greedy: true
  },
  'string': {
    pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
    lookbehind: true,
    greedy: true
  },
  'comment': {
    pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
    greedy: true
  },
  'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  'punctuation': /[{}[\],]/,
  'operator': /:/,
  'boolean': /\b(?:false|true)\b/,
  'null': {
    pattern: /\bnull\b/,
    alias: 'keyword'
  }
};
Prism.languages.webmanifest = Prism.languages.json;

(function (Prism) {
  Prism.languages.kotlin = Prism.languages.extend('clike', {
    'keyword': {
      // The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get
      pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,
      lookbehind: true
    },
    'function': [{
      pattern: /(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,
      greedy: true
    }, {
      pattern: /(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,
      lookbehind: true,
      greedy: true
    }],
    'number': /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
    'operator': /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/
  });
  delete Prism.languages.kotlin['class-name'];
  var interpolationInside = {
    'interpolation-punctuation': {
      pattern: /^\$\{?|\}$/,
      alias: 'punctuation'
    },
    'expression': {
      pattern: /[\s\S]+/,
      inside: Prism.languages.kotlin
    }
  };
  Prism.languages.insertBefore('kotlin', 'string', {
    // https://kotlinlang.org/spec/expressions.html#string-interpolation-expressions
    'string-literal': [{
      pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,
      alias: 'multiline',
      inside: {
        'interpolation': {
          pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i,
          inside: interpolationInside
        },
        'string': /[\s\S]+/
      }
    }, {
      pattern: /"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,
      alias: 'singleline',
      inside: {
        'interpolation': {
          pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,
          lookbehind: true,
          inside: interpolationInside
        },
        'string': /[\s\S]+/
      }
    }],
    'char': {
      // https://kotlinlang.org/spec/expressions.html#character-literals
      pattern: /'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,
      greedy: true
    }
  });
  delete Prism.languages.kotlin['string'];
  Prism.languages.insertBefore('kotlin', 'keyword', {
    'annotation': {
      pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
      alias: 'builtin'
    }
  });
  Prism.languages.insertBefore('kotlin', 'function', {
    'label': {
      pattern: /\b\w+@|@\w+\b/,
      alias: 'symbol'
    }
  });
  Prism.languages.kt = Prism.languages.kotlin;
  Prism.languages.kts = Prism.languages.kotlin;
})(Prism);

(function (Prism) {
  var brackets = /(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;
  Prism.languages.perl = {
    'comment': [{
      // POD
      pattern: /(^\s*)=\w[\s\S]*?=cut.*/m,
      lookbehind: true,
      greedy: true
    }, {
      pattern: /(^|[^\\$])#.*/,
      lookbehind: true,
      greedy: true
    }],
    // TODO Could be nice to handle Heredoc too.
    'string': [{
      pattern: RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source + '(?:' + [
      // q/.../
      /([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
      // q a...a
      // eslint-disable-next-line regexp/strict
      /([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,
      // q(...)
      // q{...}
      // q[...]
      // q<...>
      brackets].join('|') + ')'),
      greedy: true
    },
    // "...", `...`
    {
      pattern: /("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,
      greedy: true
    },
    // '...'
    // FIXME Multi-line single-quoted strings are not supported as they would break variables containing '
    {
      pattern: /'(?:[^'\\\r\n]|\\.)*'/,
      greedy: true
    }],
    'regex': [{
      pattern: RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source + '(?:' + [
      // m/.../
      /([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
      // m a...a
      // eslint-disable-next-line regexp/strict
      /([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,
      // m(...)
      // m{...}
      // m[...]
      // m<...>
      brackets].join('|') + ')' + /[msixpodualngc]*/.source),
      greedy: true
    },
    // The lookbehinds prevent -s from breaking
    {
      pattern: RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source + '(?:' + [
      // s/.../.../
      // eslint-disable-next-line regexp/strict
      /([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,
      // s a...a...a
      // eslint-disable-next-line regexp/strict
      /([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,
      // s(...)(...)
      // s{...}{...}
      // s[...][...]
      // s<...><...>
      // s(...)[...]
      brackets + /\s*/.source + brackets].join('|') + ')' + /[msixpodualngcer]*/.source),
      lookbehind: true,
      greedy: true
    },
    // /.../
    // The look-ahead tries to prevent two divisions on
    // the same line from being highlighted as regex.
    // This does not support multi-line regex.
    {
      pattern: /\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,
      greedy: true
    }],
    // FIXME Not sure about the handling of ::, ', and #
    'variable': [
    // ${^POSTMATCH}
    /[&*$@%]\{\^[A-Z]+\}/,
    // $^V
    /[&*$@%]\^[A-Z_]/,
    // ${...}
    /[&*$@%]#?(?=\{)/,
    // $foo
    /[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,
    // $1
    /[&*$@%]\d+/,
    // $_, @_, %!
    // The negative lookahead prevents from breaking the %= operator
    /(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],
    'filehandle': {
      // <>, <FOO>, _
      pattern: /<(?![<=])\S*?>|\b_\b/,
      alias: 'symbol'
    },
    'v-string': {
      // v1.2, 1.2.3
      pattern: /v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,
      alias: 'string'
    },
    'function': {
      pattern: /(\bsub[ \t]+)\w+/,
      lookbehind: true
    },
    'keyword': /\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,
    'number': /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,
    'operator': /-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,
    'punctuation': /[{}[\];(),:]/
  };
})(Prism);

/**
 * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
 * Modified by Miles Johnson: http://milesj.me
 * Rewritten by Tom Pavelec
 *
 * Supports PHP 5.3 - 8.0
 */
(function (Prism) {
  var comment = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/;
  var constant = [{
    pattern: /\b(?:false|true)\b/i,
    alias: 'boolean'
  }, {
    pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,
    greedy: true,
    lookbehind: true
  }, {
    pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,
    greedy: true,
    lookbehind: true
  }, /\b(?:null)\b/i, /\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/];
  var number = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i;
  var operator = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/;
  var punctuation = /[{}\[\](),:;]/;
  Prism.languages.php = {
    'delimiter': {
      pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
      alias: 'important'
    },
    'comment': comment,
    'variable': /\$+(?:\w+\b|(?=\{))/,
    'package': {
      pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
      lookbehind: true,
      inside: {
        'punctuation': /\\/
      }
    },
    'class-name-definition': {
      pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
      lookbehind: true,
      alias: 'class-name'
    },
    'function-definition': {
      pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,
      lookbehind: true,
      alias: 'function'
    },
    'keyword': [{
      pattern: /(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,
      alias: 'type-casting',
      greedy: true,
      lookbehind: true
    }, {
      pattern: /([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,
      alias: 'type-hint',
      greedy: true,
      lookbehind: true
    }, {
      pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,
      alias: 'return-type',
      greedy: true,
      lookbehind: true
    }, {
      pattern: /\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,
      alias: 'type-declaration',
      greedy: true
    }, {
      pattern: /(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,
      alias: 'type-declaration',
      greedy: true,
      lookbehind: true
    }, {
      pattern: /\b(?:parent|self|static)(?=\s*::)/i,
      alias: 'static-context',
      greedy: true
    }, {
      // yield from
      pattern: /(\byield\s+)from\b/i,
      lookbehind: true
    },
    // `class` is always a keyword unlike other keywords
    /\bclass\b/i, {
      // https://www.php.net/manual/en/reserved.keywords.php
      //
      // keywords cannot be preceded by "->"
      // the complex lookbehind means `(?<!(?:->|::)\s*)`
      pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,
      lookbehind: true
    }],
    'argument-name': {
      pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,
      lookbehind: true
    },
    'class-name': [{
      pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
      greedy: true,
      lookbehind: true
    }, {
      pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i,
      greedy: true,
      lookbehind: true
    }, {
      pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,
      greedy: true
    }, {
      pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,
      alias: 'class-name-fully-qualified',
      greedy: true,
      lookbehind: true,
      inside: {
        'punctuation': /\\/
      }
    }, {
      pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,
      alias: 'class-name-fully-qualified',
      greedy: true,
      inside: {
        'punctuation': /\\/
      }
    }, {
      pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
      alias: 'class-name-fully-qualified',
      greedy: true,
      lookbehind: true,
      inside: {
        'punctuation': /\\/
      }
    }, {
      pattern: /\b[a-z_]\w*(?=\s*\$)/i,
      alias: 'type-declaration',
      greedy: true
    }, {
      pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
      alias: ['class-name-fully-qualified', 'type-declaration'],
      greedy: true,
      inside: {
        'punctuation': /\\/
      }
    }, {
      pattern: /\b[a-z_]\w*(?=\s*::)/i,
      alias: 'static-context',
      greedy: true
    }, {
      pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,
      alias: ['class-name-fully-qualified', 'static-context'],
      greedy: true,
      inside: {
        'punctuation': /\\/
      }
    }, {
      pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,
      alias: 'type-hint',
      greedy: true,
      lookbehind: true
    }, {
      pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
      alias: ['class-name-fully-qualified', 'type-hint'],
      greedy: true,
      lookbehind: true,
      inside: {
        'punctuation': /\\/
      }
    }, {
      pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,
      alias: 'return-type',
      greedy: true,
      lookbehind: true
    }, {
      pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
      alias: ['class-name-fully-qualified', 'return-type'],
      greedy: true,
      lookbehind: true,
      inside: {
        'punctuation': /\\/
      }
    }],
    'constant': constant,
    'function': {
      pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,
      lookbehind: true,
      inside: {
        'punctuation': /\\/
      }
    },
    'property': {
      pattern: /(->\s*)\w+/,
      lookbehind: true
    },
    'number': number,
    'operator': operator,
    'punctuation': punctuation
  };
  var string_interpolation = {
    pattern: /\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,
    lookbehind: true,
    inside: Prism.languages.php
  };
  var string = [{
    pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,
    alias: 'nowdoc-string',
    greedy: true,
    inside: {
      'delimiter': {
        pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
        alias: 'symbol',
        inside: {
          'punctuation': /^<<<'?|[';]$/
        }
      }
    }
  }, {
    pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,
    alias: 'heredoc-string',
    greedy: true,
    inside: {
      'delimiter': {
        pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
        alias: 'symbol',
        inside: {
          'punctuation': /^<<<"?|[";]$/
        }
      },
      'interpolation': string_interpolation
    }
  }, {
    pattern: /`(?:\\[\s\S]|[^\\`])*`/,
    alias: 'backtick-quoted-string',
    greedy: true
  }, {
    pattern: /'(?:\\[\s\S]|[^\\'])*'/,
    alias: 'single-quoted-string',
    greedy: true
  }, {
    pattern: /"(?:\\[\s\S]|[^\\"])*"/,
    alias: 'double-quoted-string',
    greedy: true,
    inside: {
      'interpolation': string_interpolation
    }
  }];
  Prism.languages.insertBefore('php', 'variable', {
    'string': string,
    'attribute': {
      pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,
      greedy: true,
      inside: {
        'attribute-content': {
          pattern: /^(#\[)[\s\S]+(?=\]$)/,
          lookbehind: true,
          // inside can appear subset of php
          inside: {
            'comment': comment,
            'string': string,
            'attribute-class-name': [{
              pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i,
              alias: 'class-name',
              greedy: true,
              lookbehind: true
            }, {
              pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i,
              alias: ['class-name', 'class-name-fully-qualified'],
              greedy: true,
              lookbehind: true,
              inside: {
                'punctuation': /\\/
              }
            }],
            'constant': constant,
            'number': number,
            'operator': operator,
            'punctuation': punctuation
          }
        },
        'delimiter': {
          pattern: /^#\[|\]$/,
          alias: 'punctuation'
        }
      }
    }
  });
  Prism.hooks.add('before-tokenize', function (env) {
    if (!/<\?/.test(env.code)) {
      return;
    }
    var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;
    Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
  });
  Prism.hooks.add('after-tokenize', function (env) {
    Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
  });
})(Prism);

(function (Prism) {
  var powershell = Prism.languages.powershell = {
    'comment': [{
      pattern: /(^|[^`])<#[\s\S]*?#>/,
      lookbehind: true
    }, {
      pattern: /(^|[^`])#.*/,
      lookbehind: true
    }],
    'string': [{
      pattern: /"(?:`[\s\S]|[^`"])*"/,
      greedy: true,
      inside: null // see below
    }, {
      pattern: /'(?:[^']|'')*'/,
      greedy: true
    }],
    // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices
    // Supports two levels of nested brackets (e.g. `[OutputType([System.Collections.Generic.List[int]])]`)
    'namespace': /\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,
    'boolean': /\$(?:false|true)\b/i,
    'variable': /\$\w+\b/,
    // Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example
    // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" }
    // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" }
    'function': [/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i, /\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],
    // per http://technet.microsoft.com/en-us/library/hh847744.aspx
    'keyword': /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,
    'operator': {
      pattern: /(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,
      lookbehind: true
    },
    'punctuation': /[|{}[\];(),.]/
  };

  // Variable interpolation inside strings, and nested expressions
  powershell.string[0].inside = {
    'function': {
      // Allow for one level of nesting
      pattern: /(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,
      lookbehind: true,
      inside: powershell
    },
    'boolean': powershell.boolean,
    'variable': powershell.variable
  };
})(Prism);

Prism.languages.python = {
  'comment': {
    pattern: /(^|[^\\])#.*/,
    lookbehind: true,
    greedy: true
  },
  'string-interpolation': {
    pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
    greedy: true,
    inside: {
      'interpolation': {
        // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
        pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
        lookbehind: true,
        inside: {
          'format-spec': {
            pattern: /(:)[^:(){}]+(?=\}$)/,
            lookbehind: true
          },
          'conversion-option': {
            pattern: /![sra](?=[:}]$)/,
            alias: 'punctuation'
          },
          rest: null
        }
      },
      'string': /[\s\S]+/
    }
  },
  'triple-quoted-string': {
    pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
    greedy: true,
    alias: 'string'
  },
  'string': {
    pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
    greedy: true
  },
  'function': {
    pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
    lookbehind: true
  },
  'class-name': {
    pattern: /(\bclass\s+)\w+/i,
    lookbehind: true
  },
  'decorator': {
    pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
    lookbehind: true,
    alias: ['annotation', 'punctuation'],
    inside: {
      'punctuation': /\./
    }
  },
  'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
  'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
  'boolean': /\b(?:False|None|True)\b/,
  'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
  'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
  'punctuation': /[{}[\];(),.:]/
};
Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
Prism.languages.py = Prism.languages.python;

/**
 * Original by Samuel Flores
 *
 * Adds the following new token classes:
 *     constant, builtin, variable, symbol, regex
 */
(function (Prism) {
  Prism.languages.ruby = Prism.languages.extend('clike', {
    'comment': {
      pattern: /#.*|^=begin\s[\s\S]*?^=end/m,
      greedy: true
    },
    'class-name': {
      pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
      lookbehind: true,
      inside: {
        'punctuation': /[.\\]/
      }
    },
    'keyword': /\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,
    'operator': /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,
    'punctuation': /[(){}[\].,;]/
  });
  Prism.languages.insertBefore('ruby', 'operator', {
    'double-colon': {
      pattern: /::/,
      alias: 'punctuation'
    }
  });
  var interpolation = {
    pattern: /((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,
    lookbehind: true,
    inside: {
      'content': {
        pattern: /^(#\{)[\s\S]+(?=\}$)/,
        lookbehind: true,
        inside: Prism.languages.ruby
      },
      'delimiter': {
        pattern: /^#\{|\}$/,
        alias: 'punctuation'
      }
    }
  };
  delete Prism.languages.ruby.function;
  var percentExpression = '(?:' + [/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source, /\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source, /\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source, /\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source, /<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join('|') + ')';
  var symbolName = /(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;
  Prism.languages.insertBefore('ruby', 'keyword', {
    'regex-literal': [{
      pattern: RegExp(/%r/.source + percentExpression + /[egimnosux]{0,6}/.source),
      greedy: true,
      inside: {
        'interpolation': interpolation,
        'regex': /[\s\S]+/
      }
    }, {
      pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,
      lookbehind: true,
      greedy: true,
      inside: {
        'interpolation': interpolation,
        'regex': /[\s\S]+/
      }
    }],
    'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
    'symbol': [{
      pattern: RegExp(/(^|[^:]):/.source + symbolName),
      lookbehind: true,
      greedy: true
    }, {
      pattern: RegExp(/([\r\n{(,][ \t]*)/.source + symbolName + /(?=:(?!:))/.source),
      lookbehind: true,
      greedy: true
    }],
    'method-definition': {
      pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
      lookbehind: true,
      inside: {
        'function': /\b\w+$/,
        'keyword': /^self\b/,
        'class-name': /^\w+/,
        'punctuation': /\./
      }
    }
  });
  Prism.languages.insertBefore('ruby', 'string', {
    'string-literal': [{
      pattern: RegExp(/%[qQiIwWs]?/.source + percentExpression),
      greedy: true,
      inside: {
        'interpolation': interpolation,
        'string': /[\s\S]+/
      }
    }, {
      pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,
      greedy: true,
      inside: {
        'interpolation': interpolation,
        'string': /[\s\S]+/
      }
    }, {
      pattern: /<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
      alias: 'heredoc-string',
      greedy: true,
      inside: {
        'delimiter': {
          pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
          inside: {
            'symbol': /\b\w+/,
            'punctuation': /^<<[-~]?/
          }
        },
        'interpolation': interpolation,
        'string': /[\s\S]+/
      }
    }, {
      pattern: /<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
      alias: 'heredoc-string',
      greedy: true,
      inside: {
        'delimiter': {
          pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
          inside: {
            'symbol': /\b\w+/,
            'punctuation': /^<<[-~]?'|'$/
          }
        },
        'string': /[\s\S]+/
      }
    }],
    'command-literal': [{
      pattern: RegExp(/%x/.source + percentExpression),
      greedy: true,
      inside: {
        'interpolation': interpolation,
        'command': {
          pattern: /[\s\S]+/,
          alias: 'string'
        }
      }
    }, {
      pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,
      greedy: true,
      inside: {
        'interpolation': interpolation,
        'command': {
          pattern: /[\s\S]+/,
          alias: 'string'
        }
      }
    }]
  });
  delete Prism.languages.ruby.string;
  Prism.languages.insertBefore('ruby', 'number', {
    'builtin': /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,
    'constant': /\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/
  });
  Prism.languages.rb = Prism.languages.ruby;
})(Prism);

Prism.languages.scala = Prism.languages.extend('java', {
  'triple-quoted-string': {
    pattern: /"""[\s\S]*?"""/,
    greedy: true,
    alias: 'string'
  },
  'string': {
    pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
    greedy: true
  },
  'keyword': /<-|=>|\b(?:abstract|case|catch|class|def|derives|do|else|enum|extends|extension|final|finally|for|forSome|given|if|implicit|import|infix|inline|lazy|match|new|null|object|opaque|open|override|package|private|protected|return|sealed|self|super|this|throw|trait|transparent|try|type|using|val|var|while|with|yield)\b/,
  'number': /\b0x(?:[\da-f]*\.)?[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e\d+)?[dfl]?/i,
  'builtin': /\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,
  'symbol': /'[^\d\s\\]\w*/
});
Prism.languages.insertBefore('scala', 'triple-quoted-string', {
  'string-interpolation': {
    pattern: /\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,
    greedy: true,
    inside: {
      'id': {
        pattern: /^\w+/,
        greedy: true,
        alias: 'function'
      },
      'escape': {
        pattern: /\\\$"|\$[$"]/,
        greedy: true,
        alias: 'symbol'
      },
      'interpolation': {
        pattern: /\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
        greedy: true,
        inside: {
          'punctuation': /^\$\{?|\}$/,
          'expression': {
            pattern: /[\s\S]+/,
            inside: Prism.languages.scala
          }
        }
      },
      'string': /[\s\S]+/
    }
  }
});
delete Prism.languages.scala['class-name'];
delete Prism.languages.scala['function'];
delete Prism.languages.scala['constant'];

Prism.languages.sql = {
  'comment': {
    pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
    lookbehind: true
  },
  'variable': [{
    pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
    greedy: true
  }, /@[\w.$]+/],
  'string': {
    pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
    greedy: true,
    lookbehind: true
  },
  'identifier': {
    pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,
    greedy: true,
    lookbehind: true,
    inside: {
      'punctuation': /^`|`$/
    }
  },
  'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
  // Should we highlight user defined functions too?
  'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
  'boolean': /\b(?:FALSE|NULL|TRUE)\b/i,
  'number': /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
  'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
  'punctuation': /[;[\]()`,.]/
};

Prism.languages['visual-basic'] = {
  'comment': {
    pattern: /(?:['‘’]|REM\b)(?:[^\r\n_]|_(?:\r\n?|\n)?)*/i,
    inside: {
      'keyword': /^REM/i
    }
  },
  'directive': {
    pattern: /#(?:Const|Else|ElseIf|End|ExternalChecksum|ExternalSource|If|Region)(?:\b_[ \t]*(?:\r\n?|\n)|.)+/i,
    alias: 'property',
    greedy: true
  },
  'string': {
    pattern: /\$?["“”](?:["“”]{2}|[^"“”])*["“”]C?/i,
    greedy: true
  },
  'date': {
    pattern: /#[ \t]*(?:\d+([/-])\d+\1\d+(?:[ \t]+(?:\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?))?|\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?)[ \t]*#/i,
    alias: 'number'
  },
  'number': /(?:(?:\b\d+(?:\.\d+)?|\.\d+)(?:E[+-]?\d+)?|&[HO][\dA-F]+)(?:[FRD]|U?[ILS])?/i,
  'boolean': /\b(?:False|Nothing|True)\b/i,
  'keyword': /\b(?:AddHandler|AddressOf|Alias|And(?:Also)?|As|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|C(?:Bool|Byte|Char|Date|Dbl|Dec|Int|Lng|Obj|SByte|Short|Sng|Str|Type|UInt|ULng|UShort)|Char|Class|Const|Continue|Currency|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else(?:If)?|End(?:If)?|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get(?:Type|XMLNamespace)?|Global|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|IsNot|Let|Lib|Like|Long|Loop|Me|Mod|Module|Must(?:Inherit|Override)|My(?:Base|Class)|Namespace|Narrowing|New|Next|Not(?:Inheritable|Overridable)?|Object|Of|On|Operator|Option(?:al)?|Or(?:Else)?|Out|Overloads|Overridable|Overrides|ParamArray|Partial|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|SByte|Select|Set|Shadows|Shared|short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TryCast|Type|TypeOf|U(?:Integer|Long|Short)|Until|Using|Variant|Wend|When|While|Widening|With(?:Events)?|WriteOnly|Xor)\b/i,
  'operator': /[+\-*/\\^<=>&#@$%!]|\b_(?=[ \t]*[\r\n])/,
  'punctuation': /[{}().,:?]/
};
Prism.languages.vb = Prism.languages['visual-basic'];
Prism.languages.vba = Prism.languages['visual-basic'];

(function (Prism) {
  /**
   * If the given language is present, it will insert the given doc comment grammar token into it.
   *
   * @param {string} lang
   * @param {any} docComment
   */
  function insertDocComment(lang, docComment) {
    if (Prism.languages[lang]) {
      Prism.languages.insertBefore(lang, 'comment', {
        'doc-comment': docComment
      });
    }
  }
  var tag = Prism.languages.markup.tag;
  var slashDocComment = {
    pattern: /\/\/\/.*/,
    greedy: true,
    alias: 'comment',
    inside: {
      'tag': tag
    }
  };
  var tickDocComment = {
    pattern: /'''.*/,
    greedy: true,
    alias: 'comment',
    inside: {
      'tag': tag
    }
  };
  insertDocComment('csharp', slashDocComment);
  insertDocComment('fsharp', slashDocComment);
  insertDocComment('vbnet', tickDocComment);
})(Prism);

(function (Prism) {
  // https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
  // https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
  var anchorOrAlias = /[*&][^\s[\]{},]+/;
  // https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
  var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
  // https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
  var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|' + anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)';
  // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
  // This is a simplified version that doesn't support "#" and multiline keys
  // All these long scarry character classes are simplified versions of YAML's characters
  var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, function () {
    return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
  });
  var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;

  /**
   *
   * @param {string} value
   * @param {string} [flags]
   * @returns {RegExp}
   */
  function createValuePattern(value, flags) {
    flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
    var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, function () {
      return properties;
    }).replace(/<<value>>/g, function () {
      return value;
    });
    return RegExp(pattern, flags);
  }
  Prism.languages.yaml = {
    'scalar': {
      pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, function () {
        return properties;
      })),
      lookbehind: true,
      alias: 'string'
    },
    'comment': /#.*/,
    'key': {
      pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, function () {
        return properties;
      }).replace(/<<key>>/g, function () {
        return '(?:' + plainKey + '|' + string + ')';
      })),
      lookbehind: true,
      greedy: true,
      alias: 'atrule'
    },
    'directive': {
      pattern: /(^[ \t]*)%.+/m,
      lookbehind: true,
      alias: 'important'
    },
    'datetime': {
      pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
      lookbehind: true,
      alias: 'number'
    },
    'boolean': {
      pattern: createValuePattern(/false|true/.source, 'i'),
      lookbehind: true,
      alias: 'important'
    },
    'null': {
      pattern: createValuePattern(/null|~/.source, 'i'),
      lookbehind: true,
      alias: 'important'
    },
    'string': {
      pattern: createValuePattern(string),
      lookbehind: true,
      greedy: true
    },
    'number': {
      pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
      lookbehind: true
    },
    'tag': tag,
    'important': anchorOrAlias,
    'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
  };
  Prism.languages.yml = Prism.languages.yaml;
})(Prism);

(function () {
  if (typeof Prism === 'undefined' || typeof document === 'undefined') {
    return;
  }

  /**
   * Plugin name which is used as a class name for <pre> which is activating the plugin
   *
   * @type {string}
   */
  var PLUGIN_NAME = 'line-numbers';

  /**
   * Regular expression used for determining line breaks
   *
   * @type {RegExp}
   */
  var NEW_LINE_EXP = /\n(?!$)/g;

  /**
   * Global exports
   */
  var config = Prism.plugins.lineNumbers = {
    /**
     * Get node for provided line number
     *
     * @param {Element} element pre element
     * @param {number} number line number
     * @returns {Element|undefined}
     */
    getLine: function (element, number) {
      if (element.tagName !== 'PRE' || !element.classList.contains(PLUGIN_NAME)) {
        return;
      }
      var lineNumberRows = element.querySelector('.line-numbers-rows');
      if (!lineNumberRows) {
        return;
      }
      var lineNumberStart = parseInt(element.getAttribute('data-start'), 10) || 1;
      var lineNumberEnd = lineNumberStart + (lineNumberRows.children.length - 1);
      if (number < lineNumberStart) {
        number = lineNumberStart;
      }
      if (number > lineNumberEnd) {
        number = lineNumberEnd;
      }
      var lineIndex = number - lineNumberStart;
      return lineNumberRows.children[lineIndex];
    },
    /**
     * Resizes the line numbers of the given element.
     *
     * This function will not add line numbers. It will only resize existing ones.
     *
     * @param {HTMLElement} element A `<pre>` element with line numbers.
     * @returns {void}
     */
    resize: function (element) {
      resizeElements([element]);
    },
    /**
     * Whether the plugin can assume that the units font sizes and margins are not depended on the size of
     * the current viewport.
     *
     * Setting this to `true` will allow the plugin to do certain optimizations for better performance.
     *
     * Set this to `false` if you use any of the following CSS units: `vh`, `vw`, `vmin`, `vmax`.
     *
     * @type {boolean}
     */
    assumeViewportIndependence: true
  };

  /**
   * Resizes the given elements.
   *
   * @param {HTMLElement[]} elements
   */
  function resizeElements(elements) {
    elements = elements.filter(function (e) {
      var codeStyles = getStyles(e);
      var whiteSpace = codeStyles['white-space'];
      return whiteSpace === 'pre-wrap' || whiteSpace === 'pre-line';
    });
    if (elements.length == 0) {
      return;
    }
    var infos = elements.map(function (element) {
      var codeElement = element.querySelector('code');
      var lineNumbersWrapper = element.querySelector('.line-numbers-rows');
      if (!codeElement || !lineNumbersWrapper) {
        return undefined;
      }

      /** @type {HTMLElement} */
      var lineNumberSizer = element.querySelector('.line-numbers-sizer');
      var codeLines = codeElement.textContent.split(NEW_LINE_EXP);
      if (!lineNumberSizer) {
        lineNumberSizer = document.createElement('span');
        lineNumberSizer.className = 'line-numbers-sizer';
        codeElement.appendChild(lineNumberSizer);
      }
      lineNumberSizer.innerHTML = '0';
      lineNumberSizer.style.display = 'block';
      var oneLinerHeight = lineNumberSizer.getBoundingClientRect().height;
      lineNumberSizer.innerHTML = '';
      return {
        element: element,
        lines: codeLines,
        lineHeights: [],
        oneLinerHeight: oneLinerHeight,
        sizer: lineNumberSizer
      };
    }).filter(Boolean);
    infos.forEach(function (info) {
      var lineNumberSizer = info.sizer;
      var lines = info.lines;
      var lineHeights = info.lineHeights;
      var oneLinerHeight = info.oneLinerHeight;
      lineHeights[lines.length - 1] = undefined;
      lines.forEach(function (line, index) {
        if (line && line.length > 1) {
          var e = lineNumberSizer.appendChild(document.createElement('span'));
          e.style.display = 'block';
          e.textContent = line;
        } else {
          lineHeights[index] = oneLinerHeight;
        }
      });
    });
    infos.forEach(function (info) {
      var lineNumberSizer = info.sizer;
      var lineHeights = info.lineHeights;
      var childIndex = 0;
      for (var i = 0; i < lineHeights.length; i++) {
        if (lineHeights[i] === undefined) {
          lineHeights[i] = lineNumberSizer.children[childIndex++].getBoundingClientRect().height;
        }
      }
    });
    infos.forEach(function (info) {
      var lineNumberSizer = info.sizer;
      var wrapper = info.element.querySelector('.line-numbers-rows');
      lineNumberSizer.style.display = 'none';
      lineNumberSizer.innerHTML = '';
      info.lineHeights.forEach(function (height, lineNumber) {
        wrapper.children[lineNumber].style.height = height + 'px';
      });
    });
  }

  /**
   * Returns style declarations for the element
   *
   * @param {Element} element
   */
  function getStyles(element) {
    if (!element) {
      return null;
    }
    return window.getComputedStyle ? getComputedStyle(element) : element.currentStyle || null;
  }
  var lastWidth = undefined;
  window.addEventListener('resize', function () {
    if (config.assumeViewportIndependence && lastWidth === window.innerWidth) {
      return;
    }
    lastWidth = window.innerWidth;
    resizeElements(Array.prototype.slice.call(document.querySelectorAll('pre.' + PLUGIN_NAME)));
  });
  Prism.hooks.add('complete', function (env) {
    if (!env.code) {
      return;
    }
    var code = /** @type {Element} */env.element;
    var pre = /** @type {HTMLElement} */code.parentNode;

    // works only for <code> wrapped inside <pre> (not inline)
    if (!pre || !/pre/i.test(pre.nodeName)) {
      return;
    }

    // Abort if line numbers already exists
    if (code.querySelector('.line-numbers-rows')) {
      return;
    }

    // only add line numbers if <code> or one of its ancestors has the `line-numbers` class
    if (!Prism.util.isActive(code, PLUGIN_NAME)) {
      return;
    }

    // Remove the class 'line-numbers' from the <code>
    code.classList.remove(PLUGIN_NAME);
    // Add the class 'line-numbers' to the <pre>
    pre.classList.add(PLUGIN_NAME);
    var match = env.code.match(NEW_LINE_EXP);
    var linesNum = match ? match.length + 1 : 1;
    var lineNumbersWrapper;
    var lines = new Array(linesNum + 1).join('<span></span>');
    lineNumbersWrapper = document.createElement('span');
    lineNumbersWrapper.setAttribute('aria-hidden', 'true');
    lineNumbersWrapper.className = 'line-numbers-rows';
    lineNumbersWrapper.innerHTML = lines;
    if (pre.hasAttribute('data-start')) {
      pre.style.counterReset = 'linenumber ' + (parseInt(pre.getAttribute('data-start'), 10) - 1);
    }
    env.element.appendChild(lineNumbersWrapper);
    resizeElements([pre]);
    Prism.hooks.run('line-numbers', env);
  });
  Prism.hooks.add('line-numbers', function (env) {
    env.plugins = env.plugins || {};
    env.plugins.lineNumbers = true;
  });
})();

(function () {
  if (typeof Prism === 'undefined' || typeof document === 'undefined') {
    return;
  }
  var callbacks = [];
  var map = {};
  var noop = function () {};
  Prism.plugins.toolbar = {};

  /**
   * @typedef ButtonOptions
   * @property {string} text The text displayed.
   * @property {string} [url] The URL of the link which will be created.
   * @property {Function} [onClick] The event listener for the `click` event of the created button.
   * @property {string} [className] The class attribute to include with element.
   */

  /**
   * Register a button callback with the toolbar.
   *
   * @param {string} key
   * @param {ButtonOptions|Function} opts
   */
  var registerButton = Prism.plugins.toolbar.registerButton = function (key, opts) {
    var callback;
    if (typeof opts === 'function') {
      callback = opts;
    } else {
      callback = function (env) {
        var element;
        if (typeof opts.onClick === 'function') {
          element = document.createElement('button');
          element.type = 'button';
          element.addEventListener('click', function () {
            opts.onClick.call(this, env);
          });
        } else if (typeof opts.url === 'string') {
          element = document.createElement('a');
          element.href = opts.url;
        } else {
          element = document.createElement('span');
        }
        if (opts.className) {
          element.classList.add(opts.className);
        }
        element.textContent = opts.text;
        return element;
      };
    }
    if (key in map) {
      console.warn('There is a button with the key "' + key + '" registered already.');
      return;
    }
    callbacks.push(map[key] = callback);
  };

  /**
   * Returns the callback order of the given element.
   *
   * @param {HTMLElement} element
   * @returns {string[] | undefined}
   */
  function getOrder(element) {
    while (element) {
      var order = element.getAttribute('data-toolbar-order');
      if (order != null) {
        order = order.trim();
        if (order.length) {
          return order.split(/\s*,\s*/g);
        } else {
          return [];
        }
      }
      element = element.parentElement;
    }
  }

  /**
   * Post-highlight Prism hook callback.
   *
   * @param env
   */
  var hook = Prism.plugins.toolbar.hook = function (env) {
    // Check if inline or actual code block (credit to line-numbers plugin)
    var pre = env.element.parentNode;
    if (!pre || !/pre/i.test(pre.nodeName)) {
      return;
    }

    // Autoloader rehighlights, so only do this once.
    if (pre.parentNode.classList.contains('code-toolbar')) {
      return;
    }

    // Create wrapper for <pre> to prevent scrolling toolbar with content
    var wrapper = document.createElement('div');
    wrapper.classList.add('code-toolbar');
    pre.parentNode.insertBefore(wrapper, pre);
    wrapper.appendChild(pre);

    // Setup the toolbar
    var toolbar = document.createElement('div');
    toolbar.classList.add('toolbar');

    // order callbacks
    var elementCallbacks = callbacks;
    var order = getOrder(env.element);
    if (order) {
      elementCallbacks = order.map(function (key) {
        return map[key] || noop;
      });
    }
    elementCallbacks.forEach(function (callback) {
      var element = callback(env);
      if (!element) {
        return;
      }
      var item = document.createElement('div');
      item.classList.add('toolbar-item');
      item.appendChild(element);
      toolbar.appendChild(item);
    });

    // Add our toolbar to the currently created wrapper of <pre> tag
    wrapper.appendChild(toolbar);
  };
  registerButton('label', function (env) {
    var pre = env.element.parentNode;
    if (!pre || !/pre/i.test(pre.nodeName)) {
      return;
    }
    if (!pre.hasAttribute('data-label')) {
      return;
    }
    var element;
    var template;
    var text = pre.getAttribute('data-label');
    try {
      // Any normal text will blow up this selector.
      template = document.querySelector('template#' + text);
    } catch (e) {/* noop */}
    if (template) {
      element = template.content;
    } else {
      if (pre.hasAttribute('data-url')) {
        element = document.createElement('a');
        element.href = pre.getAttribute('data-url');
      } else {
        element = document.createElement('span');
      }
      element.textContent = text;
    }
    return element;
  });

  /**
   * Register the toolbar with Prism.
   */
  Prism.hooks.add('complete', hook);
})();

(function () {
  if (typeof Prism === 'undefined' || typeof document === 'undefined') {
    return;
  }
  if (!Prism.plugins.toolbar) {
    console.warn('Show Languages plugin loaded before Toolbar plugin.');
    return;
  }

  /* eslint-disable */

  // The languages map is built automatically with gulp
  var Languages = /*languages_placeholder[*/{
    "none": "Plain text",
    "plain": "Plain text",
    "plaintext": "Plain text",
    "text": "Plain text",
    "txt": "Plain text",
    "html": "HTML",
    "xml": "XML",
    "svg": "SVG",
    "mathml": "MathML",
    "ssml": "SSML",
    "rss": "RSS",
    "css": "CSS",
    "clike": "C-like",
    "js": "JavaScript",
    "abap": "ABAP",
    "abnf": "ABNF",
    "al": "AL",
    "antlr4": "ANTLR4",
    "g4": "ANTLR4",
    "apacheconf": "Apache Configuration",
    "apl": "APL",
    "aql": "AQL",
    "ino": "Arduino",
    "arff": "ARFF",
    "armasm": "ARM Assembly",
    "arm-asm": "ARM Assembly",
    "art": "Arturo",
    "asciidoc": "AsciiDoc",
    "adoc": "AsciiDoc",
    "aspnet": "ASP.NET (C#)",
    "asm6502": "6502 Assembly",
    "asmatmel": "Atmel AVR Assembly",
    "autohotkey": "AutoHotkey",
    "autoit": "AutoIt",
    "avisynth": "AviSynth",
    "avs": "AviSynth",
    "avro-idl": "Avro IDL",
    "avdl": "Avro IDL",
    "awk": "AWK",
    "gawk": "GAWK",
    "sh": "Shell",
    "basic": "BASIC",
    "bbcode": "BBcode",
    "bbj": "BBj",
    "bnf": "BNF",
    "rbnf": "RBNF",
    "bqn": "BQN",
    "bsl": "BSL (1C:Enterprise)",
    "oscript": "OneScript",
    "csharp": "C#",
    "cs": "C#",
    "dotnet": "C#",
    "cpp": "C++",
    "cfscript": "CFScript",
    "cfc": "CFScript",
    "cil": "CIL",
    "cilkc": "Cilk/C",
    "cilk-c": "Cilk/C",
    "cilkcpp": "Cilk/C++",
    "cilk-cpp": "Cilk/C++",
    "cilk": "Cilk/C++",
    "cmake": "CMake",
    "cobol": "COBOL",
    "coffee": "CoffeeScript",
    "conc": "Concurnas",
    "csp": "Content-Security-Policy",
    "css-extras": "CSS Extras",
    "csv": "CSV",
    "cue": "CUE",
    "dataweave": "DataWeave",
    "dax": "DAX",
    "django": "Django/Jinja2",
    "jinja2": "Django/Jinja2",
    "dns-zone-file": "DNS zone file",
    "dns-zone": "DNS zone file",
    "dockerfile": "Docker",
    "dot": "DOT (Graphviz)",
    "gv": "DOT (Graphviz)",
    "ebnf": "EBNF",
    "editorconfig": "EditorConfig",
    "ejs": "EJS",
    "etlua": "Embedded Lua templating",
    "erb": "ERB",
    "excel-formula": "Excel Formula",
    "xlsx": "Excel Formula",
    "xls": "Excel Formula",
    "fsharp": "F#",
    "firestore-security-rules": "Firestore security rules",
    "ftl": "FreeMarker Template Language",
    "gml": "GameMaker Language",
    "gamemakerlanguage": "GameMaker Language",
    "gap": "GAP (CAS)",
    "gcode": "G-code",
    "gdscript": "GDScript",
    "gedcom": "GEDCOM",
    "gettext": "gettext",
    "po": "gettext",
    "glsl": "GLSL",
    "gn": "GN",
    "gni": "GN",
    "linker-script": "GNU Linker Script",
    "ld": "GNU Linker Script",
    "go-module": "Go module",
    "go-mod": "Go module",
    "graphql": "GraphQL",
    "hbs": "Handlebars",
    "hs": "Haskell",
    "hcl": "HCL",
    "hlsl": "HLSL",
    "http": "HTTP",
    "hpkp": "HTTP Public-Key-Pins",
    "hsts": "HTTP Strict-Transport-Security",
    "ichigojam": "IchigoJam",
    "icu-message-format": "ICU Message Format",
    "idr": "Idris",
    "ignore": ".ignore",
    "gitignore": ".gitignore",
    "hgignore": ".hgignore",
    "npmignore": ".npmignore",
    "inform7": "Inform 7",
    "javadoc": "JavaDoc",
    "javadoclike": "JavaDoc-like",
    "javastacktrace": "Java stack trace",
    "jq": "JQ",
    "jsdoc": "JSDoc",
    "js-extras": "JS Extras",
    "json": "JSON",
    "webmanifest": "Web App Manifest",
    "json5": "JSON5",
    "jsonp": "JSONP",
    "jsstacktrace": "JS stack trace",
    "js-templates": "JS Templates",
    "keepalived": "Keepalived Configure",
    "kts": "Kotlin Script",
    "kt": "Kotlin",
    "kumir": "KuMir (КуМир)",
    "kum": "KuMir (КуМир)",
    "latex": "LaTeX",
    "tex": "TeX",
    "context": "ConTeXt",
    "lilypond": "LilyPond",
    "ly": "LilyPond",
    "emacs": "Lisp",
    "elisp": "Lisp",
    "emacs-lisp": "Lisp",
    "llvm": "LLVM IR",
    "log": "Log file",
    "lolcode": "LOLCODE",
    "magma": "Magma (CAS)",
    "md": "Markdown",
    "markup-templating": "Markup templating",
    "matlab": "MATLAB",
    "maxscript": "MAXScript",
    "mel": "MEL",
    "metafont": "METAFONT",
    "mongodb": "MongoDB",
    "moon": "MoonScript",
    "n1ql": "N1QL",
    "n4js": "N4JS",
    "n4jsd": "N4JS",
    "nand2tetris-hdl": "Nand To Tetris HDL",
    "naniscript": "Naninovel Script",
    "nani": "Naninovel Script",
    "nasm": "NASM",
    "neon": "NEON",
    "nginx": "nginx",
    "nsis": "NSIS",
    "objectivec": "Objective-C",
    "objc": "Objective-C",
    "ocaml": "OCaml",
    "opencl": "OpenCL",
    "openqasm": "OpenQasm",
    "qasm": "OpenQasm",
    "parigp": "PARI/GP",
    "objectpascal": "Object Pascal",
    "psl": "PATROL Scripting Language",
    "pcaxis": "PC-Axis",
    "px": "PC-Axis",
    "peoplecode": "PeopleCode",
    "pcode": "PeopleCode",
    "php": "PHP",
    "phpdoc": "PHPDoc",
    "php-extras": "PHP Extras",
    "plant-uml": "PlantUML",
    "plantuml": "PlantUML",
    "plsql": "PL/SQL",
    "powerquery": "PowerQuery",
    "pq": "PowerQuery",
    "mscript": "PowerQuery",
    "powershell": "PowerShell",
    "promql": "PromQL",
    "properties": ".properties",
    "protobuf": "Protocol Buffers",
    "purebasic": "PureBasic",
    "pbfasm": "PureBasic",
    "purs": "PureScript",
    "py": "Python",
    "qsharp": "Q#",
    "qs": "Q#",
    "q": "Q (kdb+ database)",
    "qml": "QML",
    "rkt": "Racket",
    "cshtml": "Razor C#",
    "razor": "Razor C#",
    "jsx": "React JSX",
    "tsx": "React TSX",
    "renpy": "Ren'py",
    "rpy": "Ren'py",
    "res": "ReScript",
    "rest": "reST (reStructuredText)",
    "robotframework": "Robot Framework",
    "robot": "Robot Framework",
    "rb": "Ruby",
    "sas": "SAS",
    "sass": "Sass (Sass)",
    "scss": "Sass (SCSS)",
    "shell-session": "Shell session",
    "sh-session": "Shell session",
    "shellsession": "Shell session",
    "sml": "SML",
    "smlnj": "SML/NJ",
    "solidity": "Solidity (Ethereum)",
    "sol": "Solidity (Ethereum)",
    "solution-file": "Solution file",
    "sln": "Solution file",
    "soy": "Soy (Closure Template)",
    "sparql": "SPARQL",
    "rq": "SPARQL",
    "splunk-spl": "Splunk SPL",
    "sqf": "SQF: Status Quo Function (Arma 3)",
    "sql": "SQL",
    "stata": "Stata Ado",
    "iecst": "Structured Text (IEC 61131-3)",
    "supercollider": "SuperCollider",
    "sclang": "SuperCollider",
    "systemd": "Systemd configuration file",
    "t4-templating": "T4 templating",
    "t4-cs": "T4 Text Templates (C#)",
    "t4": "T4 Text Templates (C#)",
    "t4-vb": "T4 Text Templates (VB)",
    "tap": "TAP",
    "tt2": "Template Toolkit 2",
    "toml": "TOML",
    "trickle": "trickle",
    "troy": "troy",
    "trig": "TriG",
    "ts": "TypeScript",
    "tsconfig": "TSConfig",
    "uscript": "UnrealScript",
    "uc": "UnrealScript",
    "uorazor": "UO Razor Script",
    "uri": "URI",
    "url": "URL",
    "vbnet": "VB.Net",
    "vhdl": "VHDL",
    "vim": "vim",
    "visual-basic": "Visual Basic",
    "vba": "VBA",
    "vb": "Visual Basic",
    "wasm": "WebAssembly",
    "web-idl": "Web IDL",
    "webidl": "Web IDL",
    "wgsl": "WGSL",
    "wiki": "Wiki markup",
    "wolfram": "Wolfram language",
    "nb": "Mathematica Notebook",
    "wl": "Wolfram language",
    "xeoracube": "XeoraCube",
    "xml-doc": "XML doc (.net)",
    "xojo": "Xojo (REALbasic)",
    "xquery": "XQuery",
    "yaml": "YAML",
    "yml": "YAML",
    "yang": "YANG"
  } /*]*/;

  /* eslint-enable */

  Prism.plugins.toolbar.registerButton('show-language', function (env) {
    var pre = env.element.parentNode;
    if (!pre || !/pre/i.test(pre.nodeName)) {
      return;
    }

    /**
     * Tries to guess the name of a language given its id.
     *
     * @param {string} id The language id.
     * @returns {string}
     */
    function guessTitle(id) {
      if (!id) {
        return id;
      }
      return (id.substring(0, 1).toUpperCase() + id.substring(1)).replace(/s(?=cript)/, 'S');
    }
    var language = pre.getAttribute('data-language') || Languages[env.language] || guessTitle(env.language);
    if (!language) {
      return;
    }
    var element = document.createElement('span');
    element.textContent = language;
    return element;
  });
})();

(function () {
  if (typeof Prism === 'undefined' || typeof document === 'undefined') {
    return;
  }
  if (!Prism.plugins.toolbar) {
    console.warn('Copy to Clipboard plugin loaded before Toolbar plugin.');
    return;
  }

  /**
   * When the given elements is clicked by the user, the given text will be copied to clipboard.
   *
   * @param {HTMLElement} element
   * @param {CopyInfo} copyInfo
   *
   * @typedef CopyInfo
   * @property {() => string} getText
   * @property {() => void} success
   * @property {(reason: unknown) => void} error
   */
  function registerClipboard(element, copyInfo) {
    element.addEventListener('click', function () {
      copyTextToClipboard(copyInfo);
    });
  }

  // https://stackoverflow.com/a/30810322/7595472

  /** @param {CopyInfo} copyInfo */
  function fallbackCopyTextToClipboard(copyInfo) {
    var textArea = document.createElement('textarea');
    textArea.value = copyInfo.getText();

    // Avoid scrolling to bottom
    textArea.style.top = '0';
    textArea.style.left = '0';
    textArea.style.position = 'fixed';
    document.body.appendChild(textArea);
    textArea.focus();
    textArea.select();
    try {
      var successful = document.execCommand('copy');
      setTimeout(function () {
        if (successful) {
          copyInfo.success();
        } else {
          copyInfo.error();
        }
      }, 1);
    } catch (err) {
      setTimeout(function () {
        copyInfo.error(err);
      }, 1);
    }
    document.body.removeChild(textArea);
  }
  /** @param {CopyInfo} copyInfo */
  function copyTextToClipboard(copyInfo) {
    if (navigator.clipboard) {
      navigator.clipboard.writeText(copyInfo.getText()).then(copyInfo.success, function () {
        // try the fallback in case `writeText` didn't work
        fallbackCopyTextToClipboard(copyInfo);
      });
    } else {
      fallbackCopyTextToClipboard(copyInfo);
    }
  }

  /**
   * Selects the text content of the given element.
   *
   * @param {Element} element
   */
  function selectElementText(element) {
    // https://stackoverflow.com/a/20079910/7595472
    window.getSelection().selectAllChildren(element);
  }

  /**
   * Traverses up the DOM tree to find data attributes that override the default plugin settings.
   *
   * @param {Element} startElement An element to start from.
   * @returns {Settings} The plugin settings.
   * @typedef {Record<"copy" | "copy-error" | "copy-success" | "copy-timeout", string | number>} Settings
   */
  function getSettings(startElement) {
    /** @type {Settings} */
    var settings = {
      'copy': 'Copy',
      'copy-error': 'Press Ctrl+C to copy',
      'copy-success': 'Copied!',
      'copy-timeout': 5000
    };
    var prefix = 'data-prismjs-';
    for (var key in settings) {
      var attr = prefix + key;
      var element = startElement;
      while (element && !element.hasAttribute(attr)) {
        element = element.parentElement;
      }
      if (element) {
        settings[key] = element.getAttribute(attr);
      }
    }
    return settings;
  }
  Prism.plugins.toolbar.registerButton('copy-to-clipboard', function (env) {
    var element = env.element;
    var settings = getSettings(element);
    var linkCopy = document.createElement('button');
    linkCopy.className = 'copy-to-clipboard-button';
    linkCopy.setAttribute('type', 'button');
    var linkSpan = document.createElement('span');
    linkCopy.appendChild(linkSpan);
    setState('copy');
    registerClipboard(linkCopy, {
      getText: function () {
        return element.textContent;
      },
      success: function () {
        setState('copy-success');
        resetText();
      },
      error: function () {
        setState('copy-error');
        setTimeout(function () {
          selectElementText(element);
        }, 1);
        resetText();
      }
    });
    return linkCopy;
    function resetText() {
      setTimeout(function () {
        setState('copy');
      }, settings['copy-timeout']);
    }

    /** @param {"copy" | "copy-error" | "copy-success"} state */
    function setState(state) {
      linkSpan.textContent = settings[state];
      linkCopy.setAttribute('data-copy-state', state);
    }
  });
})();

var top = 'top';
var bottom = 'bottom';
var right = 'right';
var left = 'left';
var auto = 'auto';
var basePlacements = [top, bottom, right, left];
var start$1 = 'start';
var end$1 = 'end';
var clippingParents = 'clippingParents';
var viewport = 'viewport';
var popper = 'popper';
var reference$1 = 'reference';
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
  return acc.concat([placement + "-" + start$1, placement + "-" + end$1]);
}, []);
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
  return acc.concat([placement, placement + "-" + start$1, placement + "-" + end$1]);
}, []); // modifiers that need to read the DOM

var beforeRead = 'beforeRead';
var read = 'read';
var afterRead = 'afterRead'; // pure-logic modifiers

var beforeMain = 'beforeMain';
var main = 'main';
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)

var beforeWrite = 'beforeWrite';
var write = 'write';
var afterWrite = 'afterWrite';
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];

function getNodeName(element) {
  return element ? (element.nodeName || '').toLowerCase() : null;
}

function getWindow(node) {
  if (node == null) {
    return window;
  }
  if (node.toString() !== '[object Window]') {
    var ownerDocument = node.ownerDocument;
    return ownerDocument ? ownerDocument.defaultView || window : window;
  }
  return node;
}

function isElement$1(node) {
  var OwnElement = getWindow(node).Element;
  return node instanceof OwnElement || node instanceof Element;
}
function isHTMLElement$1(node) {
  var OwnElement = getWindow(node).HTMLElement;
  return node instanceof OwnElement || node instanceof HTMLElement;
}
function isShadowRoot(node) {
  // IE 11 has no ShadowRoot
  if (typeof ShadowRoot === 'undefined') {
    return false;
  }
  var OwnElement = getWindow(node).ShadowRoot;
  return node instanceof OwnElement || node instanceof ShadowRoot;
}

// and applies them to the HTMLElements such as popper and arrow

function applyStyles(_ref) {
  var state = _ref.state;
  Object.keys(state.elements).forEach(function (name) {
    var style = state.styles[name] || {};
    var attributes = state.attributes[name] || {};
    var element = state.elements[name]; // arrow is optional + virtual elements

    if (!isHTMLElement$1(element) || !getNodeName(element)) {
      return;
    } // Flow doesn't support to extend this property, but it's the most
    // effective way to apply styles to an HTMLElement
    // $FlowFixMe[cannot-write]

    Object.assign(element.style, style);
    Object.keys(attributes).forEach(function (name) {
      var value = attributes[name];
      if (value === false) {
        element.removeAttribute(name);
      } else {
        element.setAttribute(name, value === true ? '' : value);
      }
    });
  });
}
function effect$2(_ref2) {
  var state = _ref2.state;
  var initialStyles = {
    popper: {
      position: state.options.strategy,
      left: '0',
      top: '0',
      margin: '0'
    },
    arrow: {
      position: 'absolute'
    },
    reference: {}
  };
  Object.assign(state.elements.popper.style, initialStyles.popper);
  state.styles = initialStyles;
  if (state.elements.arrow) {
    Object.assign(state.elements.arrow.style, initialStyles.arrow);
  }
  return function () {
    Object.keys(state.elements).forEach(function (name) {
      var element = state.elements[name];
      var attributes = state.attributes[name] || {};
      var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them

      var style = styleProperties.reduce(function (style, property) {
        style[property] = '';
        return style;
      }, {}); // arrow is optional + virtual elements

      if (!isHTMLElement$1(element) || !getNodeName(element)) {
        return;
      }
      Object.assign(element.style, style);
      Object.keys(attributes).forEach(function (attribute) {
        element.removeAttribute(attribute);
      });
    });
  };
} // eslint-disable-next-line import/no-unused-modules

var applyStyles$1 = {
  name: 'applyStyles',
  enabled: true,
  phase: 'write',
  fn: applyStyles,
  effect: effect$2,
  requires: ['computeStyles']
};

function getBasePlacement$1(placement) {
  return placement.split('-')[0];
}

var max$5 = Math.max;
var min$4 = Math.min;
var round$5 = Math.round;

function getUAString() {
  var uaData = navigator.userAgentData;
  if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
    return uaData.brands.map(function (item) {
      return item.brand + "/" + item.version;
    }).join(' ');
  }
  return navigator.userAgent;
}

function isLayoutViewport() {
  return !/^((?!chrome|android).)*safari/i.test(getUAString());
}

function getBoundingClientRect$1(element, includeScale, isFixedStrategy) {
  if (includeScale === void 0) {
    includeScale = false;
  }
  if (isFixedStrategy === void 0) {
    isFixedStrategy = false;
  }
  var clientRect = element.getBoundingClientRect();
  var scaleX = 1;
  var scaleY = 1;
  if (includeScale && isHTMLElement$1(element)) {
    scaleX = element.offsetWidth > 0 ? round$5(clientRect.width) / element.offsetWidth || 1 : 1;
    scaleY = element.offsetHeight > 0 ? round$5(clientRect.height) / element.offsetHeight || 1 : 1;
  }
  var _ref = isElement$1(element) ? getWindow(element) : window,
    visualViewport = _ref.visualViewport;
  var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  var width = clientRect.width / scaleX;
  var height = clientRect.height / scaleY;
  return {
    width: width,
    height: height,
    top: y,
    right: x + width,
    bottom: y + height,
    left: x,
    x: x,
    y: y
  };
}

// means it doesn't take into account transforms.

function getLayoutRect$1(element) {
  var clientRect = getBoundingClientRect$1(element); // Use the clientRect sizes if it's not been transformed.
  // Fixes https://github.com/popperjs/popper-core/issues/1223

  var width = element.offsetWidth;
  var height = element.offsetHeight;
  if (Math.abs(clientRect.width - width) <= 1) {
    width = clientRect.width;
  }
  if (Math.abs(clientRect.height - height) <= 1) {
    height = clientRect.height;
  }
  return {
    x: element.offsetLeft,
    y: element.offsetTop,
    width: width,
    height: height
  };
}

function contains$1(parent, child) {
  var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method

  if (parent.contains(child)) {
    return true;
  } // then fallback to custom implementation with Shadow DOM support
  else if (rootNode && isShadowRoot(rootNode)) {
    var next = child;
    do {
      if (next && parent.isSameNode(next)) {
        return true;
      } // $FlowFixMe[prop-missing]: need a better way to handle this...

      next = next.parentNode || next.host;
    } while (next);
  } // Give up, the result is false

  return false;
}

function getComputedStyle$2(element) {
  return getWindow(element).getComputedStyle(element);
}

function isTableElement(element) {
  return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
}

function getDocumentElement(element) {
  // $FlowFixMe[incompatible-return]: assume body is always available
  return ((isElement$1(element) ? element.ownerDocument :
  // $FlowFixMe[prop-missing]
  element.document) || window.document).documentElement;
}

function getParentNode(element) {
  if (getNodeName(element) === 'html') {
    return element;
  }
  return (
    // this is a quicker (but less type safe) way to save quite some bytes from the bundle
    // $FlowFixMe[incompatible-return]
    // $FlowFixMe[prop-missing]
    element.assignedSlot ||
    // step into the shadow DOM of the parent of a slotted node
    element.parentNode || (
    // DOM Element detected
    isShadowRoot(element) ? element.host : null) ||
    // ShadowRoot detected
    // $FlowFixMe[incompatible-call]: HTMLElement is a Node
    getDocumentElement(element) // fallback
  );
}

function getTrueOffsetParent(element) {
  if (!isHTMLElement$1(element) ||
  // https://github.com/popperjs/popper-core/issues/837
  getComputedStyle$2(element).position === 'fixed') {
    return null;
  }
  return element.offsetParent;
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
// return the containing block

function getContainingBlock(element) {
  var isFirefox = /firefox/i.test(getUAString());
  var isIE = /Trident/i.test(getUAString());
  if (isIE && isHTMLElement$1(element)) {
    // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
    var elementCss = getComputedStyle$2(element);
    if (elementCss.position === 'fixed') {
      return null;
    }
  }
  var currentNode = getParentNode(element);
  if (isShadowRoot(currentNode)) {
    currentNode = currentNode.host;
  }
  while (isHTMLElement$1(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
    var css = getComputedStyle$2(currentNode); // This is non-exhaustive but covers the most common CSS properties that
    // create a containing block.
    // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block

    if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
      return currentNode;
    } else {
      currentNode = currentNode.parentNode;
    }
  }
  return null;
} // Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.

function getOffsetParent(element) {
  var window = getWindow(element);
  var offsetParent = getTrueOffsetParent(element);
  while (offsetParent && isTableElement(offsetParent) && getComputedStyle$2(offsetParent).position === 'static') {
    offsetParent = getTrueOffsetParent(offsetParent);
  }
  if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$2(offsetParent).position === 'static')) {
    return window;
  }
  return offsetParent || getContainingBlock(element) || window;
}

function getMainAxisFromPlacement(placement) {
  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
}

function within(min, value, max) {
  return max$5(min, min$4(value, max));
}
function withinMaxClamp(min, value, max) {
  var v = within(min, value, max);
  return v > max ? max : v;
}

function getFreshSideObject() {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0
  };
}

function mergePaddingObject(paddingObject) {
  return Object.assign({}, getFreshSideObject(), paddingObject);
}

function expandToHashMap(value, keys) {
  return keys.reduce(function (hashMap, key) {
    hashMap[key] = value;
    return hashMap;
  }, {});
}

var toPaddingObject = function toPaddingObject(padding, state) {
  padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
    placement: state.placement
  })) : padding;
  return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
};
function arrow(_ref) {
  var _state$modifiersData$;
  var state = _ref.state,
    name = _ref.name,
    options = _ref.options;
  var arrowElement = state.elements.arrow;
  var popperOffsets = state.modifiersData.popperOffsets;
  var basePlacement = getBasePlacement$1(state.placement);
  var axis = getMainAxisFromPlacement(basePlacement);
  var isVertical = [left, right].indexOf(basePlacement) >= 0;
  var len = isVertical ? 'height' : 'width';
  if (!arrowElement || !popperOffsets) {
    return;
  }
  var paddingObject = toPaddingObject(options.padding, state);
  var arrowRect = getLayoutRect$1(arrowElement);
  var minProp = axis === 'y' ? top : left;
  var maxProp = axis === 'y' ? bottom : right;
  var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
  var startDiff = popperOffsets[axis] - state.rects.reference[axis];
  var arrowOffsetParent = getOffsetParent(arrowElement);
  var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
  // outside of the popper bounds

  var min = paddingObject[minProp];
  var max = clientSize - arrowRect[len] - paddingObject[maxProp];
  var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  var offset = within(min, center, max); // Prevents breaking syntax highlighting...

  var axisProp = axis;
  state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
}
function effect$1(_ref2) {
  var state = _ref2.state,
    options = _ref2.options;
  var _options$element = options.element,
    arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
  if (arrowElement == null) {
    return;
  } // CSS selector

  if (typeof arrowElement === 'string') {
    arrowElement = state.elements.popper.querySelector(arrowElement);
    if (!arrowElement) {
      return;
    }
  }
  if (!contains$1(state.elements.popper, arrowElement)) {
    return;
  }
  state.elements.arrow = arrowElement;
} // eslint-disable-next-line import/no-unused-modules

var arrow$1 = {
  name: 'arrow',
  enabled: true,
  phase: 'main',
  fn: arrow,
  effect: effect$1,
  requires: ['popperOffsets'],
  requiresIfExists: ['preventOverflow']
};

function getVariation(placement) {
  return placement.split('-')[1];
}

var unsetSides = {
  top: 'auto',
  right: 'auto',
  bottom: 'auto',
  left: 'auto'
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
// Zooming can change the DPR, but it seems to report a value that will
// cleanly divide the values into the appropriate subpixels.

function roundOffsetsByDPR(_ref, win) {
  var x = _ref.x,
    y = _ref.y;
  var dpr = win.devicePixelRatio || 1;
  return {
    x: round$5(x * dpr) / dpr || 0,
    y: round$5(y * dpr) / dpr || 0
  };
}
function mapToStyles(_ref2) {
  var _Object$assign2;
  var popper = _ref2.popper,
    popperRect = _ref2.popperRect,
    placement = _ref2.placement,
    variation = _ref2.variation,
    offsets = _ref2.offsets,
    position = _ref2.position,
    gpuAcceleration = _ref2.gpuAcceleration,
    adaptive = _ref2.adaptive,
    roundOffsets = _ref2.roundOffsets,
    isFixed = _ref2.isFixed;
  var _offsets$x = offsets.x,
    x = _offsets$x === void 0 ? 0 : _offsets$x,
    _offsets$y = offsets.y,
    y = _offsets$y === void 0 ? 0 : _offsets$y;
  var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
    x: x,
    y: y
  }) : {
    x: x,
    y: y
  };
  x = _ref3.x;
  y = _ref3.y;
  var hasX = offsets.hasOwnProperty('x');
  var hasY = offsets.hasOwnProperty('y');
  var sideX = left;
  var sideY = top;
  var win = window;
  if (adaptive) {
    var offsetParent = getOffsetParent(popper);
    var heightProp = 'clientHeight';
    var widthProp = 'clientWidth';
    if (offsetParent === getWindow(popper)) {
      offsetParent = getDocumentElement(popper);
      if (getComputedStyle$2(offsetParent).position !== 'static' && position === 'absolute') {
        heightProp = 'scrollHeight';
        widthProp = 'scrollWidth';
      }
    } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it

    offsetParent = offsetParent;
    if (placement === top || (placement === left || placement === right) && variation === end$1) {
      sideY = bottom;
      var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height :
      // $FlowFixMe[prop-missing]
      offsetParent[heightProp];
      y -= offsetY - popperRect.height;
      y *= gpuAcceleration ? 1 : -1;
    }
    if (placement === left || (placement === top || placement === bottom) && variation === end$1) {
      sideX = right;
      var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width :
      // $FlowFixMe[prop-missing]
      offsetParent[widthProp];
      x -= offsetX - popperRect.width;
      x *= gpuAcceleration ? 1 : -1;
    }
  }
  var commonStyles = Object.assign({
    position: position
  }, adaptive && unsetSides);
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
    x: x,
    y: y
  }, getWindow(popper)) : {
    x: x,
    y: y
  };
  x = _ref4.x;
  y = _ref4.y;
  if (gpuAcceleration) {
    var _Object$assign;
    return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  }
  return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
}
function computeStyles(_ref5) {
  var state = _ref5.state,
    options = _ref5.options;
  var _options$gpuAccelerat = options.gpuAcceleration,
    gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
    _options$adaptive = options.adaptive,
    adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
    _options$roundOffsets = options.roundOffsets,
    roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  var commonStyles = {
    placement: getBasePlacement$1(state.placement),
    variation: getVariation(state.placement),
    popper: state.elements.popper,
    popperRect: state.rects.popper,
    gpuAcceleration: gpuAcceleration,
    isFixed: state.options.strategy === 'fixed'
  };
  if (state.modifiersData.popperOffsets != null) {
    state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
      offsets: state.modifiersData.popperOffsets,
      position: state.options.strategy,
      adaptive: adaptive,
      roundOffsets: roundOffsets
    })));
  }
  if (state.modifiersData.arrow != null) {
    state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
      offsets: state.modifiersData.arrow,
      position: 'absolute',
      adaptive: false,
      roundOffsets: roundOffsets
    })));
  }
  state.attributes.popper = Object.assign({}, state.attributes.popper, {
    'data-popper-placement': state.placement
  });
} // eslint-disable-next-line import/no-unused-modules

var computeStyles$1 = {
  name: 'computeStyles',
  enabled: true,
  phase: 'beforeWrite',
  fn: computeStyles,
  data: {}
};

var passive = {
  passive: true
};
function effect(_ref) {
  var state = _ref.state,
    instance = _ref.instance,
    options = _ref.options;
  var _options$scroll = options.scroll,
    scroll = _options$scroll === void 0 ? true : _options$scroll,
    _options$resize = options.resize,
    resize = _options$resize === void 0 ? true : _options$resize;
  var window = getWindow(state.elements.popper);
  var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  if (scroll) {
    scrollParents.forEach(function (scrollParent) {
      scrollParent.addEventListener('scroll', instance.update, passive);
    });
  }
  if (resize) {
    window.addEventListener('resize', instance.update, passive);
  }
  return function () {
    if (scroll) {
      scrollParents.forEach(function (scrollParent) {
        scrollParent.removeEventListener('scroll', instance.update, passive);
      });
    }
    if (resize) {
      window.removeEventListener('resize', instance.update, passive);
    }
  };
} // eslint-disable-next-line import/no-unused-modules

var eventListeners = {
  name: 'eventListeners',
  enabled: true,
  phase: 'write',
  fn: function fn() {},
  effect: effect,
  data: {}
};

var hash$1 = {
  left: 'right',
  right: 'left',
  bottom: 'top',
  top: 'bottom'
};
function getOppositePlacement(placement) {
  return placement.replace(/left|right|bottom|top/g, function (matched) {
    return hash$1[matched];
  });
}

var hash = {
  start: 'end',
  end: 'start'
};
function getOppositeVariationPlacement(placement) {
  return placement.replace(/start|end/g, function (matched) {
    return hash[matched];
  });
}

function getWindowScroll(node) {
  var win = getWindow(node);
  var scrollLeft = win.pageXOffset;
  var scrollTop = win.pageYOffset;
  return {
    scrollLeft: scrollLeft,
    scrollTop: scrollTop
  };
}

function getWindowScrollBarX(element) {
  // If <html> has a CSS width greater than the viewport, then this will be
  // incorrect for RTL.
  // Popper 1 is broken in this case and never had a bug report so let's assume
  // it's not an issue. I don't think anyone ever specifies width on <html>
  // anyway.
  // Browsers where the left scrollbar doesn't cause an issue report `0` for
  // this (e.g. Edge 2019, IE11, Safari)
  return getBoundingClientRect$1(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
}

function getViewportRect(element, strategy) {
  var win = getWindow(element);
  var html = getDocumentElement(element);
  var visualViewport = win.visualViewport;
  var width = html.clientWidth;
  var height = html.clientHeight;
  var x = 0;
  var y = 0;
  if (visualViewport) {
    width = visualViewport.width;
    height = visualViewport.height;
    var layoutViewport = isLayoutViewport();
    if (layoutViewport || !layoutViewport && strategy === 'fixed') {
      x = visualViewport.offsetLeft;
      y = visualViewport.offsetTop;
    }
  }
  return {
    width: width,
    height: height,
    x: x + getWindowScrollBarX(element),
    y: y
  };
}

// of the `<html>` and `<body>` rect bounds if horizontally scrollable

function getDocumentRect(element) {
  var _element$ownerDocumen;
  var html = getDocumentElement(element);
  var winScroll = getWindowScroll(element);
  var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  var width = max$5(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  var height = max$5(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  var y = -winScroll.scrollTop;
  if (getComputedStyle$2(body || html).direction === 'rtl') {
    x += max$5(html.clientWidth, body ? body.clientWidth : 0) - width;
  }
  return {
    width: width,
    height: height,
    x: x,
    y: y
  };
}

function isScrollParent(element) {
  // Firefox wants us to check `-x` and `-y` variations as well
  var _getComputedStyle = getComputedStyle$2(element),
    overflow = _getComputedStyle.overflow,
    overflowX = _getComputedStyle.overflowX,
    overflowY = _getComputedStyle.overflowY;
  return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}

function getScrollParent(node) {
  if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
    // $FlowFixMe[incompatible-return]: assume body is always available
    return node.ownerDocument.body;
  }
  if (isHTMLElement$1(node) && isScrollParent(node)) {
    return node;
  }
  return getScrollParent(getParentNode(node));
}

/*
given a DOM element, return the list of all scroll parents, up the list of ancesors
until we get to the top window object. This list is what we attach scroll listeners
to, because if any of these parent elements scroll, we'll need to re-calculate the
reference element's position.
*/

function listScrollParents(element, list) {
  var _element$ownerDocumen;
  if (list === void 0) {
    list = [];
  }
  var scrollParent = getScrollParent(element);
  var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  var win = getWindow(scrollParent);
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  var updatedList = list.concat(target);
  return isBody ? updatedList :
  // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  updatedList.concat(listScrollParents(getParentNode(target)));
}

function rectToClientRect(rect) {
  return Object.assign({}, rect, {
    left: rect.x,
    top: rect.y,
    right: rect.x + rect.width,
    bottom: rect.y + rect.height
  });
}

function getInnerBoundingClientRect(element, strategy) {
  var rect = getBoundingClientRect$1(element, false, strategy === 'fixed');
  rect.top = rect.top + element.clientTop;
  rect.left = rect.left + element.clientLeft;
  rect.bottom = rect.top + element.clientHeight;
  rect.right = rect.left + element.clientWidth;
  rect.width = element.clientWidth;
  rect.height = element.clientHeight;
  rect.x = rect.left;
  rect.y = rect.top;
  return rect;
}
function getClientRectFromMixedType(element, clippingParent, strategy) {
  return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
} // A "clipping parent" is an overflowable container with the characteristic of
// clipping (or hiding) overflowing elements with a position different from
// `initial`

function getClippingParents(element) {
  var clippingParents = listScrollParents(getParentNode(element));
  var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$2(element).position) >= 0;
  var clipperElement = canEscapeClipping && isHTMLElement$1(element) ? getOffsetParent(element) : element;
  if (!isElement$1(clipperElement)) {
    return [];
  } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414

  return clippingParents.filter(function (clippingParent) {
    return isElement$1(clippingParent) && contains$1(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
  });
} // Gets the maximum area that the element is visible in due to any number of
// clipping parents

function getClippingRect(element, boundary, rootBoundary, strategy) {
  var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
  var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
  var firstClippingParent = clippingParents[0];
  var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
    var rect = getClientRectFromMixedType(element, clippingParent, strategy);
    accRect.top = max$5(rect.top, accRect.top);
    accRect.right = min$4(rect.right, accRect.right);
    accRect.bottom = min$4(rect.bottom, accRect.bottom);
    accRect.left = max$5(rect.left, accRect.left);
    return accRect;
  }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  clippingRect.width = clippingRect.right - clippingRect.left;
  clippingRect.height = clippingRect.bottom - clippingRect.top;
  clippingRect.x = clippingRect.left;
  clippingRect.y = clippingRect.top;
  return clippingRect;
}

function computeOffsets(_ref) {
  var reference = _ref.reference,
    element = _ref.element,
    placement = _ref.placement;
  var basePlacement = placement ? getBasePlacement$1(placement) : null;
  var variation = placement ? getVariation(placement) : null;
  var commonX = reference.x + reference.width / 2 - element.width / 2;
  var commonY = reference.y + reference.height / 2 - element.height / 2;
  var offsets;
  switch (basePlacement) {
    case top:
      offsets = {
        x: commonX,
        y: reference.y - element.height
      };
      break;
    case bottom:
      offsets = {
        x: commonX,
        y: reference.y + reference.height
      };
      break;
    case right:
      offsets = {
        x: reference.x + reference.width,
        y: commonY
      };
      break;
    case left:
      offsets = {
        x: reference.x - element.width,
        y: commonY
      };
      break;
    default:
      offsets = {
        x: reference.x,
        y: reference.y
      };
  }
  var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  if (mainAxis != null) {
    var len = mainAxis === 'y' ? 'height' : 'width';
    switch (variation) {
      case start$1:
        offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
        break;
      case end$1:
        offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
        break;
    }
  }
  return offsets;
}

function detectOverflow(state, options) {
  if (options === void 0) {
    options = {};
  }
  var _options = options,
    _options$placement = _options.placement,
    placement = _options$placement === void 0 ? state.placement : _options$placement,
    _options$strategy = _options.strategy,
    strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
    _options$boundary = _options.boundary,
    boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
    _options$rootBoundary = _options.rootBoundary,
    rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
    _options$elementConte = _options.elementContext,
    elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
    _options$altBoundary = _options.altBoundary,
    altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
    _options$padding = _options.padding,
    padding = _options$padding === void 0 ? 0 : _options$padding;
  var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  var altContext = elementContext === popper ? reference$1 : popper;
  var popperRect = state.rects.popper;
  var element = state.elements[altBoundary ? altContext : elementContext];
  var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  var referenceClientRect = getBoundingClientRect$1(state.elements.reference);
  var popperOffsets = computeOffsets({
    reference: referenceClientRect,
    element: popperRect,
    strategy: 'absolute',
    placement: placement
  });
  var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
  var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
  // 0 or negative = within the clipping rect

  var overflowOffsets = {
    top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
    bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
    left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
    right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  };
  var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element

  if (elementContext === popper && offsetData) {
    var offset = offsetData[placement];
    Object.keys(overflowOffsets).forEach(function (key) {
      var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
      var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
      overflowOffsets[key] += offset[axis] * multiply;
    });
  }
  return overflowOffsets;
}

function computeAutoPlacement(state, options) {
  if (options === void 0) {
    options = {};
  }
  var _options = options,
    placement = _options.placement,
    boundary = _options.boundary,
    rootBoundary = _options.rootBoundary,
    padding = _options.padding,
    flipVariations = _options.flipVariations,
    _options$allowedAutoP = _options.allowedAutoPlacements,
    allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  var variation = getVariation(placement);
  var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
    return getVariation(placement) === variation;
  }) : basePlacements;
  var allowedPlacements = placements$1.filter(function (placement) {
    return allowedAutoPlacements.indexOf(placement) >= 0;
  });
  if (allowedPlacements.length === 0) {
    allowedPlacements = placements$1;
  } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...

  var overflows = allowedPlacements.reduce(function (acc, placement) {
    acc[placement] = detectOverflow(state, {
      placement: placement,
      boundary: boundary,
      rootBoundary: rootBoundary,
      padding: padding
    })[getBasePlacement$1(placement)];
    return acc;
  }, {});
  return Object.keys(overflows).sort(function (a, b) {
    return overflows[a] - overflows[b];
  });
}

function getExpandedFallbackPlacements(placement) {
  if (getBasePlacement$1(placement) === auto) {
    return [];
  }
  var oppositePlacement = getOppositePlacement(placement);
  return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
}
function flip$1(_ref) {
  var state = _ref.state,
    options = _ref.options,
    name = _ref.name;
  if (state.modifiersData[name]._skip) {
    return;
  }
  var _options$mainAxis = options.mainAxis,
    checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
    _options$altAxis = options.altAxis,
    checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
    specifiedFallbackPlacements = options.fallbackPlacements,
    padding = options.padding,
    boundary = options.boundary,
    rootBoundary = options.rootBoundary,
    altBoundary = options.altBoundary,
    _options$flipVariatio = options.flipVariations,
    flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
    allowedAutoPlacements = options.allowedAutoPlacements;
  var preferredPlacement = state.options.placement;
  var basePlacement = getBasePlacement$1(preferredPlacement);
  var isBasePlacement = basePlacement === preferredPlacement;
  var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
    return acc.concat(getBasePlacement$1(placement) === auto ? computeAutoPlacement(state, {
      placement: placement,
      boundary: boundary,
      rootBoundary: rootBoundary,
      padding: padding,
      flipVariations: flipVariations,
      allowedAutoPlacements: allowedAutoPlacements
    }) : placement);
  }, []);
  var referenceRect = state.rects.reference;
  var popperRect = state.rects.popper;
  var checksMap = new Map();
  var makeFallbackChecks = true;
  var firstFittingPlacement = placements[0];
  for (var i = 0; i < placements.length; i++) {
    var placement = placements[i];
    var _basePlacement = getBasePlacement$1(placement);
    var isStartVariation = getVariation(placement) === start$1;
    var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
    var len = isVertical ? 'width' : 'height';
    var overflow = detectOverflow(state, {
      placement: placement,
      boundary: boundary,
      rootBoundary: rootBoundary,
      altBoundary: altBoundary,
      padding: padding
    });
    var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
    if (referenceRect[len] > popperRect[len]) {
      mainVariationSide = getOppositePlacement(mainVariationSide);
    }
    var altVariationSide = getOppositePlacement(mainVariationSide);
    var checks = [];
    if (checkMainAxis) {
      checks.push(overflow[_basePlacement] <= 0);
    }
    if (checkAltAxis) {
      checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
    }
    if (checks.every(function (check) {
      return check;
    })) {
      firstFittingPlacement = placement;
      makeFallbackChecks = false;
      break;
    }
    checksMap.set(placement, checks);
  }
  if (makeFallbackChecks) {
    // `2` may be desired in some cases – research later
    var numberOfChecks = flipVariations ? 3 : 1;
    var _loop = function _loop(_i) {
      var fittingPlacement = placements.find(function (placement) {
        var checks = checksMap.get(placement);
        if (checks) {
          return checks.slice(0, _i).every(function (check) {
            return check;
          });
        }
      });
      if (fittingPlacement) {
        firstFittingPlacement = fittingPlacement;
        return "break";
      }
    };
    for (var _i = numberOfChecks; _i > 0; _i--) {
      var _ret = _loop(_i);
      if (_ret === "break") break;
    }
  }
  if (state.placement !== firstFittingPlacement) {
    state.modifiersData[name]._skip = true;
    state.placement = firstFittingPlacement;
    state.reset = true;
  }
} // eslint-disable-next-line import/no-unused-modules

var flip$2 = {
  name: 'flip',
  enabled: true,
  phase: 'main',
  fn: flip$1,
  requiresIfExists: ['offset'],
  data: {
    _skip: false
  }
};

function getSideOffsets(overflow, rect, preventedOffsets) {
  if (preventedOffsets === void 0) {
    preventedOffsets = {
      x: 0,
      y: 0
    };
  }
  return {
    top: overflow.top - rect.height - preventedOffsets.y,
    right: overflow.right - rect.width + preventedOffsets.x,
    bottom: overflow.bottom - rect.height + preventedOffsets.y,
    left: overflow.left - rect.width - preventedOffsets.x
  };
}
function isAnySideFullyClipped(overflow) {
  return [top, right, bottom, left].some(function (side) {
    return overflow[side] >= 0;
  });
}
function hide(_ref) {
  var state = _ref.state,
    name = _ref.name;
  var referenceRect = state.rects.reference;
  var popperRect = state.rects.popper;
  var preventedOffsets = state.modifiersData.preventOverflow;
  var referenceOverflow = detectOverflow(state, {
    elementContext: 'reference'
  });
  var popperAltOverflow = detectOverflow(state, {
    altBoundary: true
  });
  var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  state.modifiersData[name] = {
    referenceClippingOffsets: referenceClippingOffsets,
    popperEscapeOffsets: popperEscapeOffsets,
    isReferenceHidden: isReferenceHidden,
    hasPopperEscaped: hasPopperEscaped
  };
  state.attributes.popper = Object.assign({}, state.attributes.popper, {
    'data-popper-reference-hidden': isReferenceHidden,
    'data-popper-escaped': hasPopperEscaped
  });
} // eslint-disable-next-line import/no-unused-modules

var hide$1 = {
  name: 'hide',
  enabled: true,
  phase: 'main',
  requiresIfExists: ['preventOverflow'],
  fn: hide
};

function distanceAndSkiddingToXY(placement, rects, offset) {
  var basePlacement = getBasePlacement$1(placement);
  var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
      placement: placement
    })) : offset,
    skidding = _ref[0],
    distance = _ref[1];
  skidding = skidding || 0;
  distance = (distance || 0) * invertDistance;
  return [left, right].indexOf(basePlacement) >= 0 ? {
    x: distance,
    y: skidding
  } : {
    x: skidding,
    y: distance
  };
}
function offset(_ref2) {
  var state = _ref2.state,
    options = _ref2.options,
    name = _ref2.name;
  var _options$offset = options.offset,
    offset = _options$offset === void 0 ? [0, 0] : _options$offset;
  var data = placements.reduce(function (acc, placement) {
    acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
    return acc;
  }, {});
  var _data$state$placement = data[state.placement],
    x = _data$state$placement.x,
    y = _data$state$placement.y;
  if (state.modifiersData.popperOffsets != null) {
    state.modifiersData.popperOffsets.x += x;
    state.modifiersData.popperOffsets.y += y;
  }
  state.modifiersData[name] = data;
} // eslint-disable-next-line import/no-unused-modules

var offset$1 = {
  name: 'offset',
  enabled: true,
  phase: 'main',
  requires: ['popperOffsets'],
  fn: offset
};

function popperOffsets(_ref) {
  var state = _ref.state,
    name = _ref.name;
  // Offsets are the actual position the popper needs to have to be
  // properly positioned near its reference element
  // This is the most basic placement, and will be adjusted by
  // the modifiers in the next step
  state.modifiersData[name] = computeOffsets({
    reference: state.rects.reference,
    element: state.rects.popper,
    strategy: 'absolute',
    placement: state.placement
  });
} // eslint-disable-next-line import/no-unused-modules

var popperOffsets$1 = {
  name: 'popperOffsets',
  enabled: true,
  phase: 'read',
  fn: popperOffsets,
  data: {}
};

function getAltAxis(axis) {
  return axis === 'x' ? 'y' : 'x';
}

function preventOverflow(_ref) {
  var state = _ref.state,
    options = _ref.options,
    name = _ref.name;
  var _options$mainAxis = options.mainAxis,
    checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
    _options$altAxis = options.altAxis,
    checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
    boundary = options.boundary,
    rootBoundary = options.rootBoundary,
    altBoundary = options.altBoundary,
    padding = options.padding,
    _options$tether = options.tether,
    tether = _options$tether === void 0 ? true : _options$tether,
    _options$tetherOffset = options.tetherOffset,
    tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  var overflow = detectOverflow(state, {
    boundary: boundary,
    rootBoundary: rootBoundary,
    padding: padding,
    altBoundary: altBoundary
  });
  var basePlacement = getBasePlacement$1(state.placement);
  var variation = getVariation(state.placement);
  var isBasePlacement = !variation;
  var mainAxis = getMainAxisFromPlacement(basePlacement);
  var altAxis = getAltAxis(mainAxis);
  var popperOffsets = state.modifiersData.popperOffsets;
  var referenceRect = state.rects.reference;
  var popperRect = state.rects.popper;
  var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
    placement: state.placement
  })) : tetherOffset;
  var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
    mainAxis: tetherOffsetValue,
    altAxis: tetherOffsetValue
  } : Object.assign({
    mainAxis: 0,
    altAxis: 0
  }, tetherOffsetValue);
  var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  var data = {
    x: 0,
    y: 0
  };
  if (!popperOffsets) {
    return;
  }
  if (checkMainAxis) {
    var _offsetModifierState$;
    var mainSide = mainAxis === 'y' ? top : left;
    var altSide = mainAxis === 'y' ? bottom : right;
    var len = mainAxis === 'y' ? 'height' : 'width';
    var offset = popperOffsets[mainAxis];
    var min = offset + overflow[mainSide];
    var max = offset - overflow[altSide];
    var additive = tether ? -popperRect[len] / 2 : 0;
    var minLen = variation === start$1 ? referenceRect[len] : popperRect[len];
    var maxLen = variation === start$1 ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
    // outside the reference bounds

    var arrowElement = state.elements.arrow;
    var arrowRect = tether && arrowElement ? getLayoutRect$1(arrowElement) : {
      width: 0,
      height: 0
    };
    var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
    var arrowPaddingMin = arrowPaddingObject[mainSide];
    var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
    // to include its full size in the calculation. If the reference is small
    // and near the edge of a boundary, the popper can overflow even if the
    // reference is not overflowing as well (e.g. virtual elements with no
    // width or height)

    var arrowLen = within(0, referenceRect[len], arrowRect[len]);
    var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
    var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
    var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
    var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
    var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
    var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
    var tetherMax = offset + maxOffset - offsetModifierValue;
    var preventedOffset = within(tether ? min$4(min, tetherMin) : min, offset, tether ? max$5(max, tetherMax) : max);
    popperOffsets[mainAxis] = preventedOffset;
    data[mainAxis] = preventedOffset - offset;
  }
  if (checkAltAxis) {
    var _offsetModifierState$2;
    var _mainSide = mainAxis === 'x' ? top : left;
    var _altSide = mainAxis === 'x' ? bottom : right;
    var _offset = popperOffsets[altAxis];
    var _len = altAxis === 'y' ? 'height' : 'width';
    var _min = _offset + overflow[_mainSide];
    var _max = _offset - overflow[_altSide];
    var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
    var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
    var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
    var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
    var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
    popperOffsets[altAxis] = _preventedOffset;
    data[altAxis] = _preventedOffset - _offset;
  }
  state.modifiersData[name] = data;
} // eslint-disable-next-line import/no-unused-modules

var preventOverflow$1 = {
  name: 'preventOverflow',
  enabled: true,
  phase: 'main',
  fn: preventOverflow,
  requiresIfExists: ['offset']
};

function getHTMLElementScroll(element) {
  return {
    scrollLeft: element.scrollLeft,
    scrollTop: element.scrollTop
  };
}

function getNodeScroll(node) {
  if (node === getWindow(node) || !isHTMLElement$1(node)) {
    return getWindowScroll(node);
  } else {
    return getHTMLElementScroll(node);
  }
}

function isElementScaled(element) {
  var rect = element.getBoundingClientRect();
  var scaleX = round$5(rect.width) / element.offsetWidth || 1;
  var scaleY = round$5(rect.height) / element.offsetHeight || 1;
  return scaleX !== 1 || scaleY !== 1;
} // Returns the composite rect of an element relative to its offsetParent.
// Composite means it takes into account transforms as well as layout.

function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  if (isFixed === void 0) {
    isFixed = false;
  }
  var isOffsetParentAnElement = isHTMLElement$1(offsetParent);
  var offsetParentIsScaled = isHTMLElement$1(offsetParent) && isElementScaled(offsetParent);
  var documentElement = getDocumentElement(offsetParent);
  var rect = getBoundingClientRect$1(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  var scroll = {
    scrollLeft: 0,
    scrollTop: 0
  };
  var offsets = {
    x: 0,
    y: 0
  };
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
    if (getNodeName(offsetParent) !== 'body' ||
    // https://github.com/popperjs/popper-core/issues/1078
    isScrollParent(documentElement)) {
      scroll = getNodeScroll(offsetParent);
    }
    if (isHTMLElement$1(offsetParent)) {
      offsets = getBoundingClientRect$1(offsetParent, true);
      offsets.x += offsetParent.clientLeft;
      offsets.y += offsetParent.clientTop;
    } else if (documentElement) {
      offsets.x = getWindowScrollBarX(documentElement);
    }
  }
  return {
    x: rect.left + scroll.scrollLeft - offsets.x,
    y: rect.top + scroll.scrollTop - offsets.y,
    width: rect.width,
    height: rect.height
  };
}

function order(modifiers) {
  var map = new Map();
  var visited = new Set();
  var result = [];
  modifiers.forEach(function (modifier) {
    map.set(modifier.name, modifier);
  }); // On visiting object, check for its dependencies and visit them recursively

  function sort(modifier) {
    visited.add(modifier.name);
    var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
    requires.forEach(function (dep) {
      if (!visited.has(dep)) {
        var depModifier = map.get(dep);
        if (depModifier) {
          sort(depModifier);
        }
      }
    });
    result.push(modifier);
  }
  modifiers.forEach(function (modifier) {
    if (!visited.has(modifier.name)) {
      // check for visited object
      sort(modifier);
    }
  });
  return result;
}
function orderModifiers(modifiers) {
  // order based on dependencies
  var orderedModifiers = order(modifiers); // order based on phase

  return modifierPhases.reduce(function (acc, phase) {
    return acc.concat(orderedModifiers.filter(function (modifier) {
      return modifier.phase === phase;
    }));
  }, []);
}

function debounce$2(fn) {
  var pending;
  return function () {
    if (!pending) {
      pending = new Promise(function (resolve) {
        Promise.resolve().then(function () {
          pending = undefined;
          resolve(fn());
        });
      });
    }
    return pending;
  };
}

function mergeByName(modifiers) {
  var merged = modifiers.reduce(function (merged, current) {
    var existing = merged[current.name];
    merged[current.name] = existing ? Object.assign({}, existing, current, {
      options: Object.assign({}, existing.options, current.options),
      data: Object.assign({}, existing.data, current.data)
    }) : current;
    return merged;
  }, {}); // IE11 does not support Object.values

  return Object.keys(merged).map(function (key) {
    return merged[key];
  });
}

var DEFAULT_OPTIONS = {
  placement: 'bottom',
  modifiers: [],
  strategy: 'absolute'
};
function areValidElements() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }
  return !args.some(function (element) {
    return !(element && typeof element.getBoundingClientRect === 'function');
  });
}
function popperGenerator(generatorOptions) {
  if (generatorOptions === void 0) {
    generatorOptions = {};
  }
  var _generatorOptions = generatorOptions,
    _generatorOptions$def = _generatorOptions.defaultModifiers,
    defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
    _generatorOptions$def2 = _generatorOptions.defaultOptions,
    defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  return function createPopper(reference, popper, options) {
    if (options === void 0) {
      options = defaultOptions;
    }
    var state = {
      placement: 'bottom',
      orderedModifiers: [],
      options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
      modifiersData: {},
      elements: {
        reference: reference,
        popper: popper
      },
      attributes: {},
      styles: {}
    };
    var effectCleanupFns = [];
    var isDestroyed = false;
    var instance = {
      state: state,
      setOptions: function setOptions(setOptionsAction) {
        var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
        cleanupModifierEffects();
        state.options = Object.assign({}, defaultOptions, state.options, options);
        state.scrollParents = {
          reference: isElement$1(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
          popper: listScrollParents(popper)
        }; // Orders the modifiers based on their dependencies and `phase`
        // properties

        var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers

        state.orderedModifiers = orderedModifiers.filter(function (m) {
          return m.enabled;
        });
        runModifierEffects();
        return instance.update();
      },
      // Sync update – it will always be executed, even if not necessary. This
      // is useful for low frequency updates where sync behavior simplifies the
      // logic.
      // For high frequency updates (e.g. `resize` and `scroll` events), always
      // prefer the async Popper#update method
      forceUpdate: function forceUpdate() {
        if (isDestroyed) {
          return;
        }
        var _state$elements = state.elements,
          reference = _state$elements.reference,
          popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
        // anymore

        if (!areValidElements(reference, popper)) {
          return;
        } // Store the reference and popper rects to be read by modifiers

        state.rects = {
          reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
          popper: getLayoutRect$1(popper)
        }; // Modifiers have the ability to reset the current update cycle. The
        // most common use case for this is the `flip` modifier changing the
        // placement, which then needs to re-run all the modifiers, because the
        // logic was previously ran for the previous placement and is therefore
        // stale/incorrect

        state.reset = false;
        state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
        // is filled with the initial data specified by the modifier. This means
        // it doesn't persist and is fresh on each update.
        // To ensure persistent data, use `${name}#persistent`

        state.orderedModifiers.forEach(function (modifier) {
          return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
        });
        for (var index = 0; index < state.orderedModifiers.length; index++) {
          if (state.reset === true) {
            state.reset = false;
            index = -1;
            continue;
          }
          var _state$orderedModifie = state.orderedModifiers[index],
            fn = _state$orderedModifie.fn,
            _state$orderedModifie2 = _state$orderedModifie.options,
            _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
            name = _state$orderedModifie.name;
          if (typeof fn === 'function') {
            state = fn({
              state: state,
              options: _options,
              name: name,
              instance: instance
            }) || state;
          }
        }
      },
      // Async and optimistically optimized update – it will not be executed if
      // not necessary (debounced to run at most once-per-tick)
      update: debounce$2(function () {
        return new Promise(function (resolve) {
          instance.forceUpdate();
          resolve(state);
        });
      }),
      destroy: function destroy() {
        cleanupModifierEffects();
        isDestroyed = true;
      }
    };
    if (!areValidElements(reference, popper)) {
      return instance;
    }
    instance.setOptions(options).then(function (state) {
      if (!isDestroyed && options.onFirstUpdate) {
        options.onFirstUpdate(state);
      }
    }); // Modifiers have the ability to execute arbitrary code before the first
    // update cycle runs. They will be executed in the same order as the update
    // cycle. This is useful when a modifier adds some persistent data that
    // other modifiers need to use, but the modifier is run after the dependent
    // one.

    function runModifierEffects() {
      state.orderedModifiers.forEach(function (_ref) {
        var name = _ref.name,
          _ref$options = _ref.options,
          options = _ref$options === void 0 ? {} : _ref$options,
          effect = _ref.effect;
        if (typeof effect === 'function') {
          var cleanupFn = effect({
            state: state,
            name: name,
            instance: instance,
            options: options
          });
          var noopFn = function noopFn() {};
          effectCleanupFns.push(cleanupFn || noopFn);
        }
      });
    }
    function cleanupModifierEffects() {
      effectCleanupFns.forEach(function (fn) {
        return fn();
      });
      effectCleanupFns = [];
    }
    return instance;
  };
}

var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$2, preventOverflow$1, arrow$1, hide$1];
var createPopper = /*#__PURE__*/popperGenerator({
  defaultModifiers: defaultModifiers
}); // eslint-disable-next-line import/no-unused-modules

/**!
* tippy.js v6.3.7
* (c) 2017-2021 atomiks
* MIT License
*/
var BOX_CLASS = "tippy-box";
var CONTENT_CLASS = "tippy-content";
var BACKDROP_CLASS = "tippy-backdrop";
var ARROW_CLASS = "tippy-arrow";
var SVG_ARROW_CLASS = "tippy-svg-arrow";
var TOUCH_OPTIONS = {
  passive: true,
  capture: true
};
var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
  return document.body;
};
function hasOwnProperty$1(obj, key) {
  return {}.hasOwnProperty.call(obj, key);
}
function getValueAtIndexOrReturn(value, index, defaultValue) {
  if (Array.isArray(value)) {
    var v = value[index];
    return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
  }
  return value;
}
function isType(value, type) {
  var str = {}.toString.call(value);
  return str.indexOf('[object') === 0 && str.indexOf(type + "]") > -1;
}
function invokeWithArgsOrReturn(value, args) {
  return typeof value === 'function' ? value.apply(void 0, args) : value;
}
function debounce$1(fn, ms) {
  // Avoid wrapping in `setTimeout` if ms is 0 anyway
  if (ms === 0) {
    return fn;
  }
  var timeout;
  return function (arg) {
    clearTimeout(timeout);
    timeout = setTimeout(function () {
      fn(arg);
    }, ms);
  };
}
function removeProperties(obj, keys) {
  var clone = Object.assign({}, obj);
  keys.forEach(function (key) {
    delete clone[key];
  });
  return clone;
}
function splitBySpaces(value) {
  return value.split(/\s+/).filter(Boolean);
}
function normalizeToArray$1(value) {
  return [].concat(value);
}
function pushIfUnique(arr, value) {
  if (arr.indexOf(value) === -1) {
    arr.push(value);
  }
}
function unique(arr) {
  return arr.filter(function (item, index) {
    return arr.indexOf(item) === index;
  });
}
function getBasePlacement(placement) {
  return placement.split('-')[0];
}
function arrayFrom(value) {
  return [].slice.call(value);
}
function removeUndefinedProps(obj) {
  return Object.keys(obj).reduce(function (acc, key) {
    if (obj[key] !== undefined) {
      acc[key] = obj[key];
    }
    return acc;
  }, {});
}
function div$1() {
  return document.createElement('div');
}
function isElement(value) {
  return ['Element', 'Fragment'].some(function (type) {
    return isType(value, type);
  });
}
function isNodeList(value) {
  return isType(value, 'NodeList');
}
function isMouseEvent(value) {
  return isType(value, 'MouseEvent');
}
function isReferenceElement(value) {
  return !!(value && value._tippy && value._tippy.reference === value);
}
function getArrayOfElements(value) {
  if (isElement(value)) {
    return [value];
  }
  if (isNodeList(value)) {
    return arrayFrom(value);
  }
  if (Array.isArray(value)) {
    return value;
  }
  return arrayFrom(document.querySelectorAll(value));
}
function setTransitionDuration(els, value) {
  els.forEach(function (el) {
    if (el) {
      el.style.transitionDuration = value + "ms";
    }
  });
}
function setVisibilityState(els, state) {
  els.forEach(function (el) {
    if (el) {
      el.setAttribute('data-state', state);
    }
  });
}
function getOwnerDocument(elementOrElements) {
  var _element$ownerDocumen;
  var _normalizeToArray = normalizeToArray$1(elementOrElements),
    element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body

  return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
}
function isCursorOutsideInteractiveBorder(popperTreeData, event) {
  var clientX = event.clientX,
    clientY = event.clientY;
  return popperTreeData.every(function (_ref) {
    var popperRect = _ref.popperRect,
      popperState = _ref.popperState,
      props = _ref.props;
    var interactiveBorder = props.interactiveBorder;
    var basePlacement = getBasePlacement(popperState.placement);
    var offsetData = popperState.modifiersData.offset;
    if (!offsetData) {
      return true;
    }
    var topDistance = basePlacement === 'bottom' ? offsetData.top.y : 0;
    var bottomDistance = basePlacement === 'top' ? offsetData.bottom.y : 0;
    var leftDistance = basePlacement === 'right' ? offsetData.left.x : 0;
    var rightDistance = basePlacement === 'left' ? offsetData.right.x : 0;
    var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
    var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
    var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
    var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
    return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
  });
}
function updateTransitionEndListener(box, action, listener) {
  var method = action + "EventListener"; // some browsers apparently support `transition` (unprefixed) but only fire
  // `webkitTransitionEnd`...

  ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
    box[method](event, listener);
  });
}
/**
 * Compared to xxx.contains, this function works for dom structures with shadow
 * dom
 */

function actualContains(parent, child) {
  var target = child;
  while (target) {
    var _target$getRootNode;
    if (parent.contains(target)) {
      return true;
    }
    target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
  }
  return false;
}
var currentInput = {
  isTouch: false
};
var lastMouseMoveTime = 0;
/**
 * When a `touchstart` event is fired, it's assumed the user is using touch
 * input. We'll bind a `mousemove` event listener to listen for mouse input in
 * the future. This way, the `isTouch` property is fully dynamic and will handle
 * hybrid devices that use a mix of touch + mouse input.
 */

function onDocumentTouchStart() {
  if (currentInput.isTouch) {
    return;
  }
  currentInput.isTouch = true;
  if (window.performance) {
    document.addEventListener('mousemove', onDocumentMouseMove);
  }
}
/**
 * When two `mousemove` event are fired consecutively within 20ms, it's assumed
 * the user is using mouse input again. `mousemove` can fire on touch devices as
 * well, but very rarely that quickly.
 */

function onDocumentMouseMove() {
  var now = performance.now();
  if (now - lastMouseMoveTime < 20) {
    currentInput.isTouch = false;
    document.removeEventListener('mousemove', onDocumentMouseMove);
  }
  lastMouseMoveTime = now;
}
/**
 * When an element is in focus and has a tippy, leaving the tab/window and
 * returning causes it to show again. For mouse users this is unexpected, but
 * for keyboard use it makes sense.
 * TODO: find a better technique to solve this problem
 */

function onWindowBlur() {
  var activeElement = document.activeElement;
  if (isReferenceElement(activeElement)) {
    var instance = activeElement._tippy;
    if (activeElement.blur && !instance.state.isVisible) {
      activeElement.blur();
    }
  }
}
function bindGlobalEventListeners() {
  document.addEventListener('touchstart', onDocumentTouchStart, TOUCH_OPTIONS);
  window.addEventListener('blur', onWindowBlur);
}
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
var isIE11 = isBrowser ?
// @ts-ignore
!!window.msCrypto : false;
function createMemoryLeakWarning(method) {
  var txt = method === 'destroy' ? 'n already-' : ' ';
  return [method + "() was called on a" + txt + "destroyed instance. This is a no-op but", 'indicates a potential memory leak.'].join(' ');
}
function clean$1(value) {
  var spacesAndTabs = /[ \t]{2,}/g;
  var lineStartWithSpaces = /^[ \t]*/gm;
  return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim();
}
function getDevMessage(message) {
  return clean$1("\n  %ctippy.js\n\n  %c" + clean$1(message) + "\n\n  %c\uD83D\uDC77\u200D This is a development-only message. It will be removed in production.\n  ");
}
function getFormattedMessage(message) {
  return [getDevMessage(message),
  // title
  'color: #00C584; font-size: 1.3em; font-weight: bold;',
  // message
  'line-height: 1.5',
  // footer
  'color: #a6a095;'];
} // Assume warnings and errors never have the same message

var visitedMessages;
{
  resetVisitedMessages();
}
function resetVisitedMessages() {
  visitedMessages = new Set();
}
function warnWhen(condition, message) {
  if (condition && !visitedMessages.has(message)) {
    var _console;
    visitedMessages.add(message);
    (_console = console).warn.apply(_console, getFormattedMessage(message));
  }
}
function errorWhen(condition, message) {
  if (condition && !visitedMessages.has(message)) {
    var _console2;
    visitedMessages.add(message);
    (_console2 = console).error.apply(_console2, getFormattedMessage(message));
  }
}
function validateTargets(targets) {
  var didPassFalsyValue = !targets;
  var didPassPlainObject = Object.prototype.toString.call(targets) === '[object Object]' && !targets.addEventListener;
  errorWhen(didPassFalsyValue, ['tippy() was passed', '`' + String(targets) + '`', 'as its targets (first) argument. Valid types are: String, Element,', 'Element[], or NodeList.'].join(' '));
  errorWhen(didPassPlainObject, ['tippy() was passed a plain object which is not supported as an argument', 'for virtual positioning. Use props.getReferenceClientRect instead.'].join(' '));
}
var pluginProps = {
  animateFill: false,
  followCursor: false,
  inlinePositioning: false,
  sticky: false
};
var renderProps = {
  allowHTML: false,
  animation: 'fade',
  arrow: true,
  content: '',
  inertia: false,
  maxWidth: 350,
  role: 'tooltip',
  theme: '',
  zIndex: 9999
};
var defaultProps = Object.assign({
  appendTo: TIPPY_DEFAULT_APPEND_TO,
  aria: {
    content: 'auto',
    expanded: 'auto'
  },
  delay: 0,
  duration: [300, 250],
  getReferenceClientRect: null,
  hideOnClick: true,
  ignoreAttributes: false,
  interactive: false,
  interactiveBorder: 2,
  interactiveDebounce: 0,
  moveTransition: '',
  offset: [0, 10],
  onAfterUpdate: function onAfterUpdate() {},
  onBeforeUpdate: function onBeforeUpdate() {},
  onCreate: function onCreate() {},
  onDestroy: function onDestroy() {},
  onHidden: function onHidden() {},
  onHide: function onHide() {},
  onMount: function onMount() {},
  onShow: function onShow() {},
  onShown: function onShown() {},
  onTrigger: function onTrigger() {},
  onUntrigger: function onUntrigger() {},
  onClickOutside: function onClickOutside() {},
  placement: 'top',
  plugins: [],
  popperOptions: {},
  render: null,
  showOnCreate: false,
  touch: true,
  trigger: 'mouseenter focus',
  triggerTarget: null
}, pluginProps, renderProps);
var defaultKeys = Object.keys(defaultProps);
var setDefaultProps = function setDefaultProps(partialProps) {
  /* istanbul ignore else */
  {
    validateProps(partialProps, []);
  }
  var keys = Object.keys(partialProps);
  keys.forEach(function (key) {
    defaultProps[key] = partialProps[key];
  });
};
function getExtendedPassedProps(passedProps) {
  var plugins = passedProps.plugins || [];
  var pluginProps = plugins.reduce(function (acc, plugin) {
    var name = plugin.name,
      defaultValue = plugin.defaultValue;
    if (name) {
      var _name;
      acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
    }
    return acc;
  }, {});
  return Object.assign({}, passedProps, pluginProps);
}
function getDataAttributeProps(reference, plugins) {
  var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
    plugins: plugins
  }))) : defaultKeys;
  var props = propKeys.reduce(function (acc, key) {
    var valueAsString = (reference.getAttribute("data-tippy-" + key) || '').trim();
    if (!valueAsString) {
      return acc;
    }
    if (key === 'content') {
      acc[key] = valueAsString;
    } else {
      try {
        acc[key] = JSON.parse(valueAsString);
      } catch (e) {
        acc[key] = valueAsString;
      }
    }
    return acc;
  }, {});
  return props;
}
function evaluateProps(reference, props) {
  var out = Object.assign({}, props, {
    content: invokeWithArgsOrReturn(props.content, [reference])
  }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
  out.aria = Object.assign({}, defaultProps.aria, out.aria);
  out.aria = {
    expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
    content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
  };
  return out;
}
function validateProps(partialProps, plugins) {
  if (partialProps === void 0) {
    partialProps = {};
  }
  if (plugins === void 0) {
    plugins = [];
  }
  var keys = Object.keys(partialProps);
  keys.forEach(function (prop) {
    var nonPluginProps = removeProperties(defaultProps, Object.keys(pluginProps));
    var didPassUnknownProp = !hasOwnProperty$1(nonPluginProps, prop); // Check if the prop exists in `plugins`

    if (didPassUnknownProp) {
      didPassUnknownProp = plugins.filter(function (plugin) {
        return plugin.name === prop;
      }).length === 0;
    }
    warnWhen(didPassUnknownProp, ["`" + prop + "`", "is not a valid prop. You may have spelled it incorrectly, or if it's", 'a plugin, forgot to pass it in an array as props.plugins.', '\n\n', 'All props: https://atomiks.github.io/tippyjs/v6/all-props/\n', 'Plugins: https://atomiks.github.io/tippyjs/v6/plugins/'].join(' '));
  });
}
var innerHTML = function innerHTML() {
  return 'innerHTML';
};
function dangerouslySetInnerHTML(element, html) {
  element[innerHTML()] = html;
}
function createArrowElement(value) {
  var arrow = div$1();
  if (value === true) {
    arrow.className = ARROW_CLASS;
  } else {
    arrow.className = SVG_ARROW_CLASS;
    if (isElement(value)) {
      arrow.appendChild(value);
    } else {
      dangerouslySetInnerHTML(arrow, value);
    }
  }
  return arrow;
}
function setContent(content, props) {
  if (isElement(props.content)) {
    dangerouslySetInnerHTML(content, '');
    content.appendChild(props.content);
  } else if (typeof props.content !== 'function') {
    if (props.allowHTML) {
      dangerouslySetInnerHTML(content, props.content);
    } else {
      content.textContent = props.content;
    }
  }
}
function getChildren(popper) {
  var box = popper.firstElementChild;
  var boxChildren = arrayFrom(box.children);
  return {
    box: box,
    content: boxChildren.find(function (node) {
      return node.classList.contains(CONTENT_CLASS);
    }),
    arrow: boxChildren.find(function (node) {
      return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
    }),
    backdrop: boxChildren.find(function (node) {
      return node.classList.contains(BACKDROP_CLASS);
    })
  };
}
function render$1(instance) {
  var popper = div$1();
  var box = div$1();
  box.className = BOX_CLASS;
  box.setAttribute('data-state', 'hidden');
  box.setAttribute('tabindex', '-1');
  var content = div$1();
  content.className = CONTENT_CLASS;
  content.setAttribute('data-state', 'hidden');
  setContent(content, instance.props);
  popper.appendChild(box);
  box.appendChild(content);
  onUpdate(instance.props, instance.props);
  function onUpdate(prevProps, nextProps) {
    var _getChildren = getChildren(popper),
      box = _getChildren.box,
      content = _getChildren.content,
      arrow = _getChildren.arrow;
    if (nextProps.theme) {
      box.setAttribute('data-theme', nextProps.theme);
    } else {
      box.removeAttribute('data-theme');
    }
    if (typeof nextProps.animation === 'string') {
      box.setAttribute('data-animation', nextProps.animation);
    } else {
      box.removeAttribute('data-animation');
    }
    if (nextProps.inertia) {
      box.setAttribute('data-inertia', '');
    } else {
      box.removeAttribute('data-inertia');
    }
    box.style.maxWidth = typeof nextProps.maxWidth === 'number' ? nextProps.maxWidth + "px" : nextProps.maxWidth;
    if (nextProps.role) {
      box.setAttribute('role', nextProps.role);
    } else {
      box.removeAttribute('role');
    }
    if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
      setContent(content, instance.props);
    }
    if (nextProps.arrow) {
      if (!arrow) {
        box.appendChild(createArrowElement(nextProps.arrow));
      } else if (prevProps.arrow !== nextProps.arrow) {
        box.removeChild(arrow);
        box.appendChild(createArrowElement(nextProps.arrow));
      }
    } else if (arrow) {
      box.removeChild(arrow);
    }
  }
  return {
    popper: popper,
    onUpdate: onUpdate
  };
} // Runtime check to identify if the render function is the default one; this
// way we can apply default CSS transitions logic and it can be tree-shaken away

render$1.$$tippy = true;
var idCounter = 1;
var mouseMoveListeners = []; // Used by `hideAll()`

var mountedInstances = [];
function createTippy(reference, passedProps) {
  var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
  // 🔒 Private members
  // ===========================================================================

  var showTimeout;
  var hideTimeout;
  var scheduleHideAnimationFrame;
  var isVisibleFromClick = false;
  var didHideDueToDocumentMouseDown = false;
  var didTouchMove = false;
  var ignoreOnFirstUpdate = false;
  var lastTriggerEvent;
  var currentTransitionEndListener;
  var onFirstUpdate;
  var listeners = [];
  var debouncedOnMouseMove = debounce$1(onMouseMove, props.interactiveDebounce);
  var currentTarget; // ===========================================================================
  // 🔑 Public members
  // ===========================================================================

  var id = idCounter++;
  var popperInstance = null;
  var plugins = unique(props.plugins);
  var state = {
    // Is the instance currently enabled?
    isEnabled: true,
    // Is the tippy currently showing and not transitioning out?
    isVisible: false,
    // Has the instance been destroyed?
    isDestroyed: false,
    // Is the tippy currently mounted to the DOM?
    isMounted: false,
    // Has the tippy finished transitioning in?
    isShown: false
  };
  var instance = {
    // properties
    id: id,
    reference: reference,
    popper: div$1(),
    popperInstance: popperInstance,
    props: props,
    state: state,
    plugins: plugins,
    // methods
    clearDelayTimeouts: clearDelayTimeouts,
    setProps: setProps,
    setContent: setContent,
    show: show,
    hide: hide,
    hideWithInteractivity: hideWithInteractivity,
    enable: enable,
    disable: disable,
    unmount: unmount,
    destroy: destroy
  }; // TODO: Investigate why this early return causes a TDZ error in the tests —
  // it doesn't seem to happen in the browser

  /* istanbul ignore if */

  if (!props.render) {
    {
      errorWhen(true, 'render() function has not been supplied.');
    }
    return instance;
  } // ===========================================================================
  // Initial mutations
  // ===========================================================================

  var _props$render = props.render(instance),
    popper = _props$render.popper,
    onUpdate = _props$render.onUpdate;
  popper.setAttribute('data-tippy-root', '');
  popper.id = "tippy-" + instance.id;
  instance.popper = popper;
  reference._tippy = instance;
  popper._tippy = instance;
  var pluginsHooks = plugins.map(function (plugin) {
    return plugin.fn(instance);
  });
  var hasAriaExpanded = reference.hasAttribute('aria-expanded');
  addListeners();
  handleAriaExpandedAttribute();
  handleStyles();
  invokeHook('onCreate', [instance]);
  if (props.showOnCreate) {
    scheduleShow();
  } // Prevent a tippy with a delay from hiding if the cursor left then returned
  // before it started hiding

  popper.addEventListener('mouseenter', function () {
    if (instance.props.interactive && instance.state.isVisible) {
      instance.clearDelayTimeouts();
    }
  });
  popper.addEventListener('mouseleave', function () {
    if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
      getDocument().addEventListener('mousemove', debouncedOnMouseMove);
    }
  });
  return instance; // ===========================================================================
  // 🔒 Private methods
  // ===========================================================================

  function getNormalizedTouchSettings() {
    var touch = instance.props.touch;
    return Array.isArray(touch) ? touch : [touch, 0];
  }
  function getIsCustomTouchBehavior() {
    return getNormalizedTouchSettings()[0] === 'hold';
  }
  function getIsDefaultRenderFn() {
    var _instance$props$rende;

    // @ts-ignore
    return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
  }
  function getCurrentTarget() {
    return currentTarget || reference;
  }
  function getDocument() {
    var parent = getCurrentTarget().parentNode;
    return parent ? getOwnerDocument(parent) : document;
  }
  function getDefaultTemplateChildren() {
    return getChildren(popper);
  }
  function getDelay(isShow) {
    // For touch or keyboard input, force `0` delay for UX reasons
    // Also if the instance is mounted but not visible (transitioning out),
    // ignore delay
    if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === 'focus') {
      return 0;
    }
    return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
  }
  function handleStyles(fromHide) {
    if (fromHide === void 0) {
      fromHide = false;
    }
    popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
    popper.style.zIndex = "" + instance.props.zIndex;
  }
  function invokeHook(hook, args, shouldInvokePropsHook) {
    if (shouldInvokePropsHook === void 0) {
      shouldInvokePropsHook = true;
    }
    pluginsHooks.forEach(function (pluginHooks) {
      if (pluginHooks[hook]) {
        pluginHooks[hook].apply(pluginHooks, args);
      }
    });
    if (shouldInvokePropsHook) {
      var _instance$props;
      (_instance$props = instance.props)[hook].apply(_instance$props, args);
    }
  }
  function handleAriaContentAttribute() {
    var aria = instance.props.aria;
    if (!aria.content) {
      return;
    }
    var attr = "aria-" + aria.content;
    var id = popper.id;
    var nodes = normalizeToArray$1(instance.props.triggerTarget || reference);
    nodes.forEach(function (node) {
      var currentValue = node.getAttribute(attr);
      if (instance.state.isVisible) {
        node.setAttribute(attr, currentValue ? currentValue + " " + id : id);
      } else {
        var nextValue = currentValue && currentValue.replace(id, '').trim();
        if (nextValue) {
          node.setAttribute(attr, nextValue);
        } else {
          node.removeAttribute(attr);
        }
      }
    });
  }
  function handleAriaExpandedAttribute() {
    if (hasAriaExpanded || !instance.props.aria.expanded) {
      return;
    }
    var nodes = normalizeToArray$1(instance.props.triggerTarget || reference);
    nodes.forEach(function (node) {
      if (instance.props.interactive) {
        node.setAttribute('aria-expanded', instance.state.isVisible && node === getCurrentTarget() ? 'true' : 'false');
      } else {
        node.removeAttribute('aria-expanded');
      }
    });
  }
  function cleanupInteractiveMouseListeners() {
    getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
    mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
      return listener !== debouncedOnMouseMove;
    });
  }
  function onDocumentPress(event) {
    // Moved finger to scroll instead of an intentional tap outside
    if (currentInput.isTouch) {
      if (didTouchMove || event.type === 'mousedown') {
        return;
      }
    }
    var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper

    if (instance.props.interactive && actualContains(popper, actualTarget)) {
      return;
    } // Clicked on the event listeners target

    if (normalizeToArray$1(instance.props.triggerTarget || reference).some(function (el) {
      return actualContains(el, actualTarget);
    })) {
      if (currentInput.isTouch) {
        return;
      }
      if (instance.state.isVisible && instance.props.trigger.indexOf('click') >= 0) {
        return;
      }
    } else {
      invokeHook('onClickOutside', [instance, event]);
    }
    if (instance.props.hideOnClick === true) {
      instance.clearDelayTimeouts();
      instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
      // currentTarget. This lets a tippy with `focus` trigger know that it
      // should not show

      didHideDueToDocumentMouseDown = true;
      setTimeout(function () {
        didHideDueToDocumentMouseDown = false;
      }); // The listener gets added in `scheduleShow()`, but this may be hiding it
      // before it shows, and hide()'s early bail-out behavior can prevent it
      // from being cleaned up

      if (!instance.state.isMounted) {
        removeDocumentPress();
      }
    }
  }
  function onTouchMove() {
    didTouchMove = true;
  }
  function onTouchStart() {
    didTouchMove = false;
  }
  function addDocumentPress() {
    var doc = getDocument();
    doc.addEventListener('mousedown', onDocumentPress, true);
    doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
    doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
    doc.addEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
  }
  function removeDocumentPress() {
    var doc = getDocument();
    doc.removeEventListener('mousedown', onDocumentPress, true);
    doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
    doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
    doc.removeEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
  }
  function onTransitionedOut(duration, callback) {
    onTransitionEnd(duration, function () {
      if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
        callback();
      }
    });
  }
  function onTransitionedIn(duration, callback) {
    onTransitionEnd(duration, callback);
  }
  function onTransitionEnd(duration, callback) {
    var box = getDefaultTemplateChildren().box;
    function listener(event) {
      if (event.target === box) {
        updateTransitionEndListener(box, 'remove', listener);
        callback();
      }
    } // Make callback synchronous if duration is 0
    // `transitionend` won't fire otherwise

    if (duration === 0) {
      return callback();
    }
    updateTransitionEndListener(box, 'remove', currentTransitionEndListener);
    updateTransitionEndListener(box, 'add', listener);
    currentTransitionEndListener = listener;
  }
  function on(eventType, handler, options) {
    if (options === void 0) {
      options = false;
    }
    var nodes = normalizeToArray$1(instance.props.triggerTarget || reference);
    nodes.forEach(function (node) {
      node.addEventListener(eventType, handler, options);
      listeners.push({
        node: node,
        eventType: eventType,
        handler: handler,
        options: options
      });
    });
  }
  function addListeners() {
    if (getIsCustomTouchBehavior()) {
      on('touchstart', onTrigger, {
        passive: true
      });
      on('touchend', onMouseLeave, {
        passive: true
      });
    }
    splitBySpaces(instance.props.trigger).forEach(function (eventType) {
      if (eventType === 'manual') {
        return;
      }
      on(eventType, onTrigger);
      switch (eventType) {
        case 'mouseenter':
          on('mouseleave', onMouseLeave);
          break;
        case 'focus':
          on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
          break;
        case 'focusin':
          on('focusout', onBlurOrFocusOut);
          break;
      }
    });
  }
  function removeListeners() {
    listeners.forEach(function (_ref) {
      var node = _ref.node,
        eventType = _ref.eventType,
        handler = _ref.handler,
        options = _ref.options;
      node.removeEventListener(eventType, handler, options);
    });
    listeners = [];
  }
  function onTrigger(event) {
    var _lastTriggerEvent;
    var shouldScheduleClickHide = false;
    if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
      return;
    }
    var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === 'focus';
    lastTriggerEvent = event;
    currentTarget = event.currentTarget;
    handleAriaExpandedAttribute();
    if (!instance.state.isVisible && isMouseEvent(event)) {
      // If scrolling, `mouseenter` events can be fired if the cursor lands
      // over a new target, but `mousemove` events don't get fired. This
      // causes interactive tooltips to get stuck open until the cursor is
      // moved
      mouseMoveListeners.forEach(function (listener) {
        return listener(event);
      });
    } // Toggle show/hide when clicking click-triggered tooltips

    if (event.type === 'click' && (instance.props.trigger.indexOf('mouseenter') < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
      shouldScheduleClickHide = true;
    } else {
      scheduleShow(event);
    }
    if (event.type === 'click') {
      isVisibleFromClick = !shouldScheduleClickHide;
    }
    if (shouldScheduleClickHide && !wasFocused) {
      scheduleHide(event);
    }
  }
  function onMouseMove(event) {
    var target = event.target;
    var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
    if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
      return;
    }
    var popperTreeData = getNestedPopperTree().concat(popper).map(function (popper) {
      var _instance$popperInsta;
      var instance = popper._tippy;
      var state = (_instance$popperInsta = instance.popperInstance) == null ? void 0 : _instance$popperInsta.state;
      if (state) {
        return {
          popperRect: popper.getBoundingClientRect(),
          popperState: state,
          props: props
        };
      }
      return null;
    }).filter(Boolean);
    if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
      cleanupInteractiveMouseListeners();
      scheduleHide(event);
    }
  }
  function onMouseLeave(event) {
    var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf('click') >= 0 && isVisibleFromClick;
    if (shouldBail) {
      return;
    }
    if (instance.props.interactive) {
      instance.hideWithInteractivity(event);
      return;
    }
    scheduleHide(event);
  }
  function onBlurOrFocusOut(event) {
    if (instance.props.trigger.indexOf('focusin') < 0 && event.target !== getCurrentTarget()) {
      return;
    } // If focus was moved to within the popper

    if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
      return;
    }
    scheduleHide(event);
  }
  function isEventListenerStopped(event) {
    return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf('touch') >= 0 : false;
  }
  function createPopperInstance() {
    destroyPopperInstance();
    var _instance$props2 = instance.props,
      popperOptions = _instance$props2.popperOptions,
      placement = _instance$props2.placement,
      offset = _instance$props2.offset,
      getReferenceClientRect = _instance$props2.getReferenceClientRect,
      moveTransition = _instance$props2.moveTransition;
    var arrow = getIsDefaultRenderFn() ? getChildren(popper).arrow : null;
    var computedReference = getReferenceClientRect ? {
      getBoundingClientRect: getReferenceClientRect,
      contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
    } : reference;
    var tippyModifier = {
      name: '$$tippy',
      enabled: true,
      phase: 'beforeWrite',
      requires: ['computeStyles'],
      fn: function fn(_ref2) {
        var state = _ref2.state;
        if (getIsDefaultRenderFn()) {
          var _getDefaultTemplateCh = getDefaultTemplateChildren(),
            box = _getDefaultTemplateCh.box;
          ['placement', 'reference-hidden', 'escaped'].forEach(function (attr) {
            if (attr === 'placement') {
              box.setAttribute('data-placement', state.placement);
            } else {
              if (state.attributes.popper["data-popper-" + attr]) {
                box.setAttribute("data-" + attr, '');
              } else {
                box.removeAttribute("data-" + attr);
              }
            }
          });
          state.attributes.popper = {};
        }
      }
    };
    var modifiers = [{
      name: 'offset',
      options: {
        offset: offset
      }
    }, {
      name: 'preventOverflow',
      options: {
        padding: {
          top: 2,
          bottom: 2,
          left: 5,
          right: 5
        }
      }
    }, {
      name: 'flip',
      options: {
        padding: 5
      }
    }, {
      name: 'computeStyles',
      options: {
        adaptive: !moveTransition
      }
    }, tippyModifier];
    if (getIsDefaultRenderFn() && arrow) {
      modifiers.push({
        name: 'arrow',
        options: {
          element: arrow,
          padding: 3
        }
      });
    }
    modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
    instance.popperInstance = createPopper(computedReference, popper, Object.assign({}, popperOptions, {
      placement: placement,
      onFirstUpdate: onFirstUpdate,
      modifiers: modifiers
    }));
  }
  function destroyPopperInstance() {
    if (instance.popperInstance) {
      instance.popperInstance.destroy();
      instance.popperInstance = null;
    }
  }
  function mount() {
    var appendTo = instance.props.appendTo;
    var parentNode; // By default, we'll append the popper to the triggerTargets's parentNode so
    // it's directly after the reference element so the elements inside the
    // tippy can be tabbed to
    // If there are clipping issues, the user can specify a different appendTo
    // and ensure focus management is handled correctly manually

    var node = getCurrentTarget();
    if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
      parentNode = node.parentNode;
    } else {
      parentNode = invokeWithArgsOrReturn(appendTo, [node]);
    } // The popper element needs to exist on the DOM before its position can be
    // updated as Popper needs to read its dimensions

    if (!parentNode.contains(popper)) {
      parentNode.appendChild(popper);
    }
    instance.state.isMounted = true;
    createPopperInstance();
    /* istanbul ignore else */

    {
      // Accessibility check
      warnWhen(instance.props.interactive && appendTo === defaultProps.appendTo && node.nextElementSibling !== popper, ['Interactive tippy element may not be accessible via keyboard', 'navigation because it is not directly after the reference element', 'in the DOM source order.', '\n\n', 'Using a wrapper <div> or <span> tag around the reference element', 'solves this by creating a new parentNode context.', '\n\n', 'Specifying `appendTo: document.body` silences this warning, but it', 'assumes you are using a focus management solution to handle', 'keyboard navigation.', '\n\n', 'See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity'].join(' '));
    }
  }
  function getNestedPopperTree() {
    return arrayFrom(popper.querySelectorAll('[data-tippy-root]'));
  }
  function scheduleShow(event) {
    instance.clearDelayTimeouts();
    if (event) {
      invokeHook('onTrigger', [instance, event]);
    }
    addDocumentPress();
    var delay = getDelay(true);
    var _getNormalizedTouchSe = getNormalizedTouchSettings(),
      touchValue = _getNormalizedTouchSe[0],
      touchDelay = _getNormalizedTouchSe[1];
    if (currentInput.isTouch && touchValue === 'hold' && touchDelay) {
      delay = touchDelay;
    }
    if (delay) {
      showTimeout = setTimeout(function () {
        instance.show();
      }, delay);
    } else {
      instance.show();
    }
  }
  function scheduleHide(event) {
    instance.clearDelayTimeouts();
    invokeHook('onUntrigger', [instance, event]);
    if (!instance.state.isVisible) {
      removeDocumentPress();
      return;
    } // For interactive tippies, scheduleHide is added to a document.body handler
    // from onMouseLeave so must intercept scheduled hides from mousemove/leave
    // events when trigger contains mouseenter and click, and the tip is
    // currently shown as a result of a click.

    if (instance.props.trigger.indexOf('mouseenter') >= 0 && instance.props.trigger.indexOf('click') >= 0 && ['mouseleave', 'mousemove'].indexOf(event.type) >= 0 && isVisibleFromClick) {
      return;
    }
    var delay = getDelay(false);
    if (delay) {
      hideTimeout = setTimeout(function () {
        if (instance.state.isVisible) {
          instance.hide();
        }
      }, delay);
    } else {
      // Fixes a `transitionend` problem when it fires 1 frame too
      // late sometimes, we don't want hide() to be called.
      scheduleHideAnimationFrame = requestAnimationFrame(function () {
        instance.hide();
      });
    }
  } // ===========================================================================
  // 🔑 Public methods
  // ===========================================================================

  function enable() {
    instance.state.isEnabled = true;
  }
  function disable() {
    // Disabling the instance should also hide it
    // https://github.com/atomiks/tippy.js-react/issues/106
    instance.hide();
    instance.state.isEnabled = false;
  }
  function clearDelayTimeouts() {
    clearTimeout(showTimeout);
    clearTimeout(hideTimeout);
    cancelAnimationFrame(scheduleHideAnimationFrame);
  }
  function setProps(partialProps) {
    /* istanbul ignore else */
    {
      warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps'));
    }
    if (instance.state.isDestroyed) {
      return;
    }
    invokeHook('onBeforeUpdate', [instance, partialProps]);
    removeListeners();
    var prevProps = instance.props;
    var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
      ignoreAttributes: true
    }));
    instance.props = nextProps;
    addListeners();
    if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
      cleanupInteractiveMouseListeners();
      debouncedOnMouseMove = debounce$1(onMouseMove, nextProps.interactiveDebounce);
    } // Ensure stale aria-expanded attributes are removed

    if (prevProps.triggerTarget && !nextProps.triggerTarget) {
      normalizeToArray$1(prevProps.triggerTarget).forEach(function (node) {
        node.removeAttribute('aria-expanded');
      });
    } else if (nextProps.triggerTarget) {
      reference.removeAttribute('aria-expanded');
    }
    handleAriaExpandedAttribute();
    handleStyles();
    if (onUpdate) {
      onUpdate(prevProps, nextProps);
    }
    if (instance.popperInstance) {
      createPopperInstance(); // Fixes an issue with nested tippies if they are all getting re-rendered,
      // and the nested ones get re-rendered first.
      // https://github.com/atomiks/tippyjs-react/issues/177
      // TODO: find a cleaner / more efficient solution(!)

      getNestedPopperTree().forEach(function (nestedPopper) {
        // React (and other UI libs likely) requires a rAF wrapper as it flushes
        // its work in one
        requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
      });
    }
    invokeHook('onAfterUpdate', [instance, partialProps]);
  }
  function setContent(content) {
    instance.setProps({
      content: content
    });
  }
  function show() {
    /* istanbul ignore else */
    {
      warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show'));
    } // Early bail-out

    var isAlreadyVisible = instance.state.isVisible;
    var isDestroyed = instance.state.isDestroyed;
    var isDisabled = !instance.state.isEnabled;
    var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
    var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
    if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
      return;
    } // Normalize `disabled` behavior across browsers.
    // Firefox allows events on disabled elements, but Chrome doesn't.
    // Using a wrapper element (i.e. <span>) is recommended.

    if (getCurrentTarget().hasAttribute('disabled')) {
      return;
    }
    invokeHook('onShow', [instance], false);
    if (instance.props.onShow(instance) === false) {
      return;
    }
    instance.state.isVisible = true;
    if (getIsDefaultRenderFn()) {
      popper.style.visibility = 'visible';
    }
    handleStyles();
    addDocumentPress();
    if (!instance.state.isMounted) {
      popper.style.transition = 'none';
    } // If flipping to the opposite side after hiding at least once, the
    // animation will use the wrong placement without resetting the duration

    if (getIsDefaultRenderFn()) {
      var _getDefaultTemplateCh2 = getDefaultTemplateChildren(),
        box = _getDefaultTemplateCh2.box,
        content = _getDefaultTemplateCh2.content;
      setTransitionDuration([box, content], 0);
    }
    onFirstUpdate = function onFirstUpdate() {
      var _instance$popperInsta2;
      if (!instance.state.isVisible || ignoreOnFirstUpdate) {
        return;
      }
      ignoreOnFirstUpdate = true; // reflow

      void popper.offsetHeight;
      popper.style.transition = instance.props.moveTransition;
      if (getIsDefaultRenderFn() && instance.props.animation) {
        var _getDefaultTemplateCh3 = getDefaultTemplateChildren(),
          _box = _getDefaultTemplateCh3.box,
          _content = _getDefaultTemplateCh3.content;
        setTransitionDuration([_box, _content], duration);
        setVisibilityState([_box, _content], 'visible');
      }
      handleAriaContentAttribute();
      handleAriaExpandedAttribute();
      pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
      // popper has been positioned for the first time

      (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
      invokeHook('onMount', [instance]);
      if (instance.props.animation && getIsDefaultRenderFn()) {
        onTransitionedIn(duration, function () {
          instance.state.isShown = true;
          invokeHook('onShown', [instance]);
        });
      }
    };
    mount();
  }
  function hide() {
    /* istanbul ignore else */
    {
      warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide'));
    } // Early bail-out

    var isAlreadyHidden = !instance.state.isVisible;
    var isDestroyed = instance.state.isDestroyed;
    var isDisabled = !instance.state.isEnabled;
    var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
    if (isAlreadyHidden || isDestroyed || isDisabled) {
      return;
    }
    invokeHook('onHide', [instance], false);
    if (instance.props.onHide(instance) === false) {
      return;
    }
    instance.state.isVisible = false;
    instance.state.isShown = false;
    ignoreOnFirstUpdate = false;
    isVisibleFromClick = false;
    if (getIsDefaultRenderFn()) {
      popper.style.visibility = 'hidden';
    }
    cleanupInteractiveMouseListeners();
    removeDocumentPress();
    handleStyles(true);
    if (getIsDefaultRenderFn()) {
      var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
        box = _getDefaultTemplateCh4.box,
        content = _getDefaultTemplateCh4.content;
      if (instance.props.animation) {
        setTransitionDuration([box, content], duration);
        setVisibilityState([box, content], 'hidden');
      }
    }
    handleAriaContentAttribute();
    handleAriaExpandedAttribute();
    if (instance.props.animation) {
      if (getIsDefaultRenderFn()) {
        onTransitionedOut(duration, instance.unmount);
      }
    } else {
      instance.unmount();
    }
  }
  function hideWithInteractivity(event) {
    /* istanbul ignore else */
    {
      warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
    }
    getDocument().addEventListener('mousemove', debouncedOnMouseMove);
    pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
    debouncedOnMouseMove(event);
  }
  function unmount() {
    /* istanbul ignore else */
    {
      warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount'));
    }
    if (instance.state.isVisible) {
      instance.hide();
    }
    if (!instance.state.isMounted) {
      return;
    }
    destroyPopperInstance(); // If a popper is not interactive, it will be appended outside the popper
    // tree by default. This seems mainly for interactive tippies, but we should
    // find a workaround if possible

    getNestedPopperTree().forEach(function (nestedPopper) {
      nestedPopper._tippy.unmount();
    });
    if (popper.parentNode) {
      popper.parentNode.removeChild(popper);
    }
    mountedInstances = mountedInstances.filter(function (i) {
      return i !== instance;
    });
    instance.state.isMounted = false;
    invokeHook('onHidden', [instance]);
  }
  function destroy() {
    /* istanbul ignore else */
    {
      warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy'));
    }
    if (instance.state.isDestroyed) {
      return;
    }
    instance.clearDelayTimeouts();
    instance.unmount();
    removeListeners();
    delete reference._tippy;
    instance.state.isDestroyed = true;
    invokeHook('onDestroy', [instance]);
  }
}
function tippy(targets, optionalProps) {
  if (optionalProps === void 0) {
    optionalProps = {};
  }
  var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
  /* istanbul ignore else */

  {
    validateTargets(targets);
    validateProps(optionalProps, plugins);
  }
  bindGlobalEventListeners();
  var passedProps = Object.assign({}, optionalProps, {
    plugins: plugins
  });
  var elements = getArrayOfElements(targets);
  /* istanbul ignore else */

  {
    var isSingleContentElement = isElement(passedProps.content);
    var isMoreThanOneReferenceElement = elements.length > 1;
    warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ['tippy() was passed an Element as the `content` prop, but more than', 'one tippy instance was created by this invocation. This means the', 'content element will only be appended to the last tippy instance.', '\n\n', 'Instead, pass the .innerHTML of the element, or use a function that', 'returns a cloned version of the element instead.', '\n\n', '1) content: element.innerHTML\n', '2) content: () => element.cloneNode(true)'].join(' '));
  }
  var instances = elements.reduce(function (acc, reference) {
    var instance = reference && createTippy(reference, passedProps);
    if (instance) {
      acc.push(instance);
    }
    return acc;
  }, []);
  return isElement(targets) ? instances[0] : instances;
}
tippy.defaultProps = defaultProps;
tippy.setDefaultProps = setDefaultProps;
tippy.currentInput = currentInput;

// every time the popper is destroyed (i.e. a new target), removing the styles
// and causing transitions to break for singletons when the console is open, but
// most notably for non-transform styles being used, `gpuAcceleration: false`.

Object.assign({}, applyStyles$1, {
  effect: function effect(_ref) {
    var state = _ref.state;
    var initialStyles = {
      popper: {
        position: state.options.strategy,
        left: '0',
        top: '0',
        margin: '0'
      },
      arrow: {
        position: 'absolute'
      },
      reference: {}
    };
    Object.assign(state.elements.popper.style, initialStyles.popper);
    state.styles = initialStyles;
    if (state.elements.arrow) {
      Object.assign(state.elements.arrow.style, initialStyles.arrow);
    } // intentionally return no cleanup function
    // return () => { ... }
  }
});
var mouseCoords = {
  clientX: 0,
  clientY: 0
};
var activeInstances = [];
function storeMouseCoords(_ref) {
  var clientX = _ref.clientX,
    clientY = _ref.clientY;
  mouseCoords = {
    clientX: clientX,
    clientY: clientY
  };
}
function addMouseCoordsListener(doc) {
  doc.addEventListener('mousemove', storeMouseCoords);
}
function removeMouseCoordsListener(doc) {
  doc.removeEventListener('mousemove', storeMouseCoords);
}
var followCursor = {
  name: 'followCursor',
  defaultValue: false,
  fn: function fn(instance) {
    var reference = instance.reference;
    var doc = getOwnerDocument(instance.props.triggerTarget || reference);
    var isInternalUpdate = false;
    var wasFocusEvent = false;
    var isUnmounted = true;
    var prevProps = instance.props;
    function getIsInitialBehavior() {
      return instance.props.followCursor === 'initial' && instance.state.isVisible;
    }
    function addListener() {
      doc.addEventListener('mousemove', onMouseMove);
    }
    function removeListener() {
      doc.removeEventListener('mousemove', onMouseMove);
    }
    function unsetGetReferenceClientRect() {
      isInternalUpdate = true;
      instance.setProps({
        getReferenceClientRect: null
      });
      isInternalUpdate = false;
    }
    function onMouseMove(event) {
      // If the instance is interactive, avoid updating the position unless it's
      // over the reference element
      var isCursorOverReference = event.target ? reference.contains(event.target) : true;
      var followCursor = instance.props.followCursor;
      var clientX = event.clientX,
        clientY = event.clientY;
      var rect = reference.getBoundingClientRect();
      var relativeX = clientX - rect.left;
      var relativeY = clientY - rect.top;
      if (isCursorOverReference || !instance.props.interactive) {
        instance.setProps({
          // @ts-ignore - unneeded DOMRect properties
          getReferenceClientRect: function getReferenceClientRect() {
            var rect = reference.getBoundingClientRect();
            var x = clientX;
            var y = clientY;
            if (followCursor === 'initial') {
              x = rect.left + relativeX;
              y = rect.top + relativeY;
            }
            var top = followCursor === 'horizontal' ? rect.top : y;
            var right = followCursor === 'vertical' ? rect.right : x;
            var bottom = followCursor === 'horizontal' ? rect.bottom : y;
            var left = followCursor === 'vertical' ? rect.left : x;
            return {
              width: right - left,
              height: bottom - top,
              top: top,
              right: right,
              bottom: bottom,
              left: left
            };
          }
        });
      }
    }
    function create() {
      if (instance.props.followCursor) {
        activeInstances.push({
          instance: instance,
          doc: doc
        });
        addMouseCoordsListener(doc);
      }
    }
    function destroy() {
      activeInstances = activeInstances.filter(function (data) {
        return data.instance !== instance;
      });
      if (activeInstances.filter(function (data) {
        return data.doc === doc;
      }).length === 0) {
        removeMouseCoordsListener(doc);
      }
    }
    return {
      onCreate: create,
      onDestroy: destroy,
      onBeforeUpdate: function onBeforeUpdate() {
        prevProps = instance.props;
      },
      onAfterUpdate: function onAfterUpdate(_, _ref2) {
        var followCursor = _ref2.followCursor;
        if (isInternalUpdate) {
          return;
        }
        if (followCursor !== undefined && prevProps.followCursor !== followCursor) {
          destroy();
          if (followCursor) {
            create();
            if (instance.state.isMounted && !wasFocusEvent && !getIsInitialBehavior()) {
              addListener();
            }
          } else {
            removeListener();
            unsetGetReferenceClientRect();
          }
        }
      },
      onMount: function onMount() {
        if (instance.props.followCursor && !wasFocusEvent) {
          if (isUnmounted) {
            onMouseMove(mouseCoords);
            isUnmounted = false;
          }
          if (!getIsInitialBehavior()) {
            addListener();
          }
        }
      },
      onTrigger: function onTrigger(_, event) {
        if (isMouseEvent(event)) {
          mouseCoords = {
            clientX: event.clientX,
            clientY: event.clientY
          };
        }
        wasFocusEvent = event.type === 'focus';
      },
      onHidden: function onHidden() {
        if (instance.props.followCursor) {
          unsetGetReferenceClientRect();
          removeListener();
          isUnmounted = true;
        }
      }
    };
  }
};
tippy.setDefaultProps({
  render: render$1
});

var t$1 = function () {
  return t$1 = Object.assign || function (t) {
    for (var e, n = 1, i = arguments.length; n < i; n++) for (var r in e = arguments[n]) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
    return t;
  }, t$1.apply(this, arguments);
};
"function" == typeof SuppressedError && SuppressedError;
var e$2;
!function (t) {
  t[t.render = 0] = "render", t[t.selected = 1] = "selected";
}(e$2 || (e$2 = {}));
var n = function () {
  function e(e, n) {
    void 0 === n && (n = {}), this._initStatus = !1, this.onArr = [], this.prefix = "mark", this._selectionchangeTimeOut = 0, this.markRange = [], this.sectionChangeDelay = 100, this.lineColor = "#F17F53", this.lineWidth = 2, this.eventController = new AbortController(), this.options = {
      idPrefix: "mark-svg"
    };
    var i = null;
    if ("string" == typeof e ? i = document.getElementById(e) : e.nodeType == Node.ELEMENT_NODE && (i = e), !i) throw new Error("target错误 或 未找到对应元素");
    this.targetElement = i, this.onArr = [], this.options = t$1(t$1({}, this.options), n);
    var r = n.sectionChangeDelay,
      o = n.lineColor,
      a = n.lineWidth;
    r && (this.sectionChangeDelay = r), o && (this.lineColor = o), a && (this.lineWidth = a);
  }
  return e.prototype.render = function () {
    var t = this;
    if (!this._initStatus) {
      var e = this.targetElement.parentNode,
        n = document.createElement("div");
      n.className = "mark-view", n.style.position = "relative", n.style.width = "fit-content", n.style.height = "fit-content", n.style.width = "100%";
      var i = document.createElement("style");
      i.innerHTML = "\n              @keyframes blink {\n                0%, 100% { opacity: 0; }\n                50% { opacity: 1; }\n              }\n              .blink {\n                animation: blink 1s linear 0;\n                animation-iteration-count: 3;\n              }\n            ", n.appendChild(i);
      var r = this.targetElement.cloneNode(!0);
      this.targetNode = r, n.appendChild(r);
      var o = document.createElementNS("http://www.w3.org/2000/svg", "svg");
      this.svgDom = o, o.id = "".concat(this.options.idPrefix || "mark-svg").concat(this.options.id ? "_#_" + this.options.id : ""), o.style.position = "absolute", o.style.left = "0px", o.style.top = "0px", o.style.width = "100%", o.style.height = "100%", o.style.mixBlendMode = "multiply", o.setAttribute("width", "100%"), o.setAttribute("height", "100%"), o.setAttribute("pointer-events", "none"), n.appendChild(o), null == e || e.replaceChild(n, this.targetElement), this.rootElement = n, this.targetNodeRect = this.rootElement.getBoundingClientRect(), this.targetNode.addEventListener("click", function (e) {
        if (t.rootElement) {
          var n = t.rootElement.getBoundingClientRect(),
            i = e,
            r = i.pageX - n.x,
            o = i.pageY - n.y,
            a = t.markRange.filter(function (t) {
              return t.position.filter(function (t) {
                return r > t.x1 && r < t.x2 && o > t.y1 && o < t.y2;
              }).length > 0;
            });
          a.length > 0 && a.forEach(function (t) {
            var e = new Event("click");
            t.node.dispatchEvent(e);
          });
        }
      }, {
        signal: this.eventController.signal
      }), this._handletListener(), this._update(), this._handleOn("render", this.rootElement);
    }
    this._initStatus = !0;
  }, e.prototype.update = function () {
    var t = this;
    this.markRange.forEach(function (e) {
      var n = t.svgDom.querySelector("[data-id='".concat(e.markStr, "']"));
      if (n && (n.innerHTML = "", !t._handleEfiToRange(e.markStr).collapsed)) {
        var i = e.range.getClientRects(),
          r = [],
          o = document.createDocumentFragment(),
          a = t._detachRangeRects(i),
          l = a.textRunRects;
        a.rowRects;
        for (var s = 0; s < l.length; s++) {
          var h = l[s],
            c = {
              line: "underline" === e.type ? e.styleScheme : "",
              rect: "highlight" === e.type ? e.styleScheme : ""
            },
            d = t._handleCreateSvgG(h, o, e.type, c);
          d.group;
          var u = d.position;
          r.push(u);
        }
        n.appendChild(o), e.position = r;
      }
    });
  }, e.prototype.add = function (t) {
    var e,
      n,
      i = t.type,
      r = null !== (e = t.click) && void 0 !== e ? e : null,
      o = this._handleEfiToRange(t.markStr);
    if (!o.collapsed) {
      var a = o.getClientRects(),
        l = document.createElementNS("http://www.w3.org/2000/svg", "g"),
        s = "";
      t.className && (s = t.className.split("__")[1], l.classList.add(t.className)), this.options.id && l.setAttribute("id", "".concat(this.options.id, "_#_").concat(t.markStr)), l.setAttribute("data-id", t.markStr), l.setAttribute("data-styleScheme", s), l.setAttribute("data-type", t.type), l.setAttribute("opacity", "0.5");
      var h = [],
        c = document.createDocumentFragment(),
        d = this._detachRangeRects(a),
        u = d.textRunRects;
      d.rowRects;
      for (var p = 0; p < u.length; p++) {
        var g = u[p],
          f = {
            line: "underline" === t.type ? s : "",
            rect: "highlight" === t.type ? s : ""
          },
          m = this._handleCreateSvgG(g, c, i, f);
        m.group;
        var v = m.position;
        h.push(v);
      }
      l.appendChild(c), this.markRange.push({
        markStr: t.markStr,
        range: o,
        type: i,
        styleScheme: s,
        position: h,
        node: l,
        data: null !== (n = t.data) && void 0 !== n ? n : {}
      }), r && "function" == typeof r && l.addEventListener("click", function (t) {
        var e = this.getAttribute("data-id");
        r.apply(this, [t, e]);
      }, {
        signal: this.eventController.signal
      }), this.svgDom.appendChild(l);
    }
  }, e.prototype.remove = function (t, e) {
    var n;
    if (!t) throw new Error("未传入MarkEfiCode");
    for (var i = this.markRange.map(function (t, e) {
        return {
          item: t,
          index: e
        };
      }).filter(function (n) {
        return n.item.markStr == t && (!e || n.item.type == e);
      }), r = 0, o = this.svgDom, a = 0; a < i.length; a++) {
      var l = i[a].index - r,
        s = i[a].item;
      null === (n = o.querySelector("[data-id='".concat(s.markStr, "']"))) || void 0 === n || n.remove(), this.markRange.splice(l, 1), r++;
    }
  }, e.prototype.animate = function (t, e) {
    if (void 0 === e && (e = {
      type: "blink"
    }), !t) throw new Error("未传入动画目标target");
    var n = this.svgDom.querySelectorAll('g[data-id="'.concat(t, '"] > rect'));
    Array.from(n).forEach(function (t, n) {
      t.classList.add(e.type), t.addEventListener("animationend", function () {
        t.classList.contains("blink") && t.classList.remove("blink");
      });
    });
  }, e.prototype.highlight = function (t, e, n, i) {
    if (void 0 === i && (i = {}), !t) throw new Error("未传入MarkEfiCode");
    this.add({
      type: "highlight",
      markStr: t,
      className: e,
      click: n,
      data: i
    });
  }, e.prototype.underline = function (t, e, n, i) {
    if (void 0 === i && (i = {}), !t) throw new Error("未传入MarkEfiCode");
    this.add({
      type: "underline",
      markStr: t,
      className: e,
      click: n,
      data: i
    });
  }, e.prototype.show = function (t) {
    var e, n;
    t ? null === (e = this.svgDom) || void 0 === e || e.querySelectorAll('g[data-type="'.concat(t, '"]')).forEach(function (t) {
      t.setAttribute("display", "auto");
    }) : null === (n = this.svgDom) || void 0 === n || n.querySelectorAll("g").forEach(function (t) {
      t.setAttribute("display", "auto");
    });
  }, e.prototype.hide = function (t) {
    var e, n;
    t ? null === (e = this.svgDom) || void 0 === e || e.querySelectorAll('g[data-type="'.concat(t, '"]')).forEach(function (t) {
      t.setAttribute("display", "none");
    }) : null === (n = this.svgDom) || void 0 === n || n.querySelectorAll("g").forEach(function (t) {
      t.setAttribute("display", "none");
    });
  }, e.prototype.clear = function (t) {
    for (var e, n = this.markRange.map(function (t, e) {
        return {
          item: t,
          index: e
        };
      }).filter(function (e) {
        return !t || e.item.type == t;
      }), i = 0, r = this.svgDom, o = 0; o < n.length; o++) {
      var a = n[o].index - i,
        l = n[o].item;
      null === (e = r.querySelector("[data-id='".concat(l.markStr, "']"))) || void 0 === e || e.remove(), this.markRange.splice(a, 1), i++;
    }
  }, e.prototype.on = function (t, e) {
    this.onArr.push({
      key: t,
      func: e
    });
  }, e.prototype.destroy = function () {
    this.eventController.abort(), this.rootElement = void 0, this.targetNode = void 0, this.svgDom = void 0, this.markRange = [], this.onArr = [], this._initStatus = !1;
  }, e.prototype.getMarks = function () {
    return this.markRange.map(function (t) {
      return {
        markStr: t.markStr,
        type: t.type,
        data: t.data
      };
    });
  }, e.prototype._update = function () {
    var t = this;
    window.addEventListener("resize", function () {
      requestAnimationFrame(function () {
        t.rootElement && (t.targetNodeRect = t.rootElement.getBoundingClientRect(), t.update());
      });
    }, {
      signal: this.eventController.signal
    });
  }, e.prototype._handletListener = function () {
    var t = this,
      e = this;
    document.addEventListener("selectionchange", function () {
      for (var n = [], i = 0; i < arguments.length; i++) n[i] = arguments[i];
      clearTimeout(t._selectionchangeTimeOut), t._selectionchangeTimeOut = setTimeout(function () {
        t._handleSelected.apply(t, n);
      }, e.sectionChangeDelay || 250);
    }, {
      signal: e.eventController.signal
    });
  }, e.prototype._handleSelected = function () {
    var t,
      e,
      n,
      i = window.getSelection();
    if (i && !i.isCollapsed) {
      var r = i.getRangeAt(0),
        o = this._handleSelectRangePostion(r),
        a = r.getClientRects(),
        l = a[0],
        s = a[a.length - 1],
        h = (null === (t = this.rootElement) || void 0 === t ? void 0 : t.getBoundingClientRect()) || this.targetNodeRect || {},
        c = null !== (e = null == h ? void 0 : h.top) && void 0 !== e ? e : 0,
        d = null !== (n = null == h ? void 0 : h.left) && void 0 !== n ? n : 0,
        u = {
          top_left: [l.left - d, l.top - c],
          top_center: [l.left + l.width / 2 - d, l.top - c],
          top_right: [l.right - d, l.top - c],
          center_left: [s.left - d, l.top + (s.bottom - l.top) / 2 - c],
          center: [s.left + (l.right - s.left) / 2 - d, l.top + (s.bottom - l.top) / 2 - c],
          center_right: [l.right - d, l.top + (s.bottom - l.top) / 2 - c],
          bottom_left: [s.left - d, s.bottom - c],
          bottom_center: [s.left + s.width / 2 - d, s.top + s.height - c],
          bottom_right: [s.right - d, s.bottom - c]
        };
      this._handleOn("selected", {
        markStr: o,
        range: r,
        position: u
      });
    }
  }, e.prototype._handleSelectRangePostion = function (t) {
    var e = this._handleSelectNodePostion(t.startContainer),
      n = t.startOffset,
      i = this._handleSelectNodePostion(t.endContainer),
      r = t.endOffset;
    return "".concat(this.prefix, "(").concat(e, ":").concat(n, ",").concat(i, ":").concat(r, ")");
  }, e.prototype._handleSelectNodePostion = function (t) {
    for (var e = [], n = t; n != this.targetNode;) {
      for (var i = 0; n.previousSibling;) i++, n = n.previousSibling;
      if (e.push(i), null == n.parentNode) break;
      n = n.parentNode;
    }
    return e.reverse().join("/");
  }, e.prototype._handleEfiToRange = function (t) {
    var e = document.createRange(),
      n = this._handleCheckEfi(t);
    if (!n) return e;
    for (var i = this.targetNode, r = null, o = 0; o < n.start_arr.length; o++) {
      var a = n.start_arr[o];
      i = r = i.childNodes[a];
    }
    n.start_node = r, i = this.targetNode;
    for (o = 0; o < n.end_arr.length; o++) {
      a = n.end_arr[o];
      i = r = i.childNodes[a];
    }
    return n.end_node = r, e.setStart(n.start_node, n.start_offset), e.setEnd(n.end_node, n.end_offset), e;
  }, e.prototype._handleOn = function (t, e) {
    void 0 === e && (e = {}), this.onArr.filter(function (e) {
      return e.key == t;
    }).forEach(function (t) {
      null == t || t.func(e);
    });
  }, e.prototype._handleCheckEfi = function (t) {
    var e = new RegExp("".concat(this.prefix, "(.*,.*)")),
      n = t.match(e);
    if (!n || n.length < 2) return null;
    var i = n[1],
      r = (i = i.replace("(", "").replace(")", "")).split(",");
    return {
      start_arr: r[0].split(":")[0].split("/").map(function (t) {
        return Number(t);
      }),
      start_offset: Number(r[0].split(":")[1]),
      end_arr: r[1].split(":")[0].split("/").map(function (t) {
        return Number(t);
      }),
      end_offset: Number(r[1].split(":")[1]),
      start_node: null,
      end_node: null
    };
  }, e.prototype._detachRangeRects = function (t) {
    for (var e = [], n = [], i = [], r = 0, o = t.length; r < o; r++) {
      var a = !0,
        l = t[r],
        s = r ? t[r - 1] : null;
      s && s.x === l.x && l.y < s.y + s.height && (a = !1), a || (i[r - 1] = !1), i.push(!0);
    }
    return i.forEach(function (i, r) {
      i ? e.push(t[r]) : n.push(t[r]);
    }), {
      textRunRects: e,
      rowRects: n
    };
  }, e.prototype._handleCreateRect = function (t, e) {
    var n;
    void 0 === e && (e = {
      opcity: !1
    });
    var i = document.createElementNS("http://www.w3.org/2000/svg", "rect"),
      r = (null === (n = this.rootElement) || void 0 === n ? void 0 : n.getBoundingClientRect()) || this.targetNodeRect || {},
      o = t.x - r.x,
      a = t.y - r.y;
    return i.setAttribute("x", o.toString()), i.setAttribute("y", a.toString()), i.setAttribute("width", t.width.toString()), i.setAttribute("height", t.height.toString()), i.setAttribute("fill", e.isPlaceholder ? this.options.animationColor || "#D6D6D6" : "#FFFF00"), i.setAttribute("mix-blend-mode", "multiply"), e.opcity && i.setAttribute("opacity", "0"), i;
  }, e.prototype._handleCreateLine = function (t, e) {
    var n,
      i = document.createElementNS("http://www.w3.org/2000/svg", "line"),
      r = (null === (n = this.rootElement) || void 0 === n ? void 0 : n.getBoundingClientRect()) || this.targetNodeRect || {},
      o = this.lineColor,
      a = t.x - r.x,
      l = t.y - r.y + t.height;
    "dashed" === (null == e ? void 0 : e.styleScheme) && (l += 3, o = "#25B774");
    var s = a + t.width,
      h = l;
    return i.setAttribute("x1", a.toString()), i.setAttribute("y1", l.toString()), i.setAttribute("x2", s.toString()), i.setAttribute("y2", h.toString()), i.setAttribute("stroke-width", "".concat(this.lineWidth) || "2"), i.setAttribute("stroke", o || "#03a9f4"), i.setAttribute("mix-blend-mode", "multiply"), "dashed" === (null == e ? void 0 : e.styleScheme) && i.setAttribute("stroke-dasharray", "6,3"), i;
  }, e.prototype._handleCreateSvgG = function (t, e, n, i) {
    var r,
      o = (null === (r = this.rootElement) || void 0 === r ? void 0 : r.getBoundingClientRect()) || this.targetNodeRect || {},
      a = document.createDocumentFragment();
    if ("highlight" == n) {
      var l = this._handleCreateRect(t, {
        styleScheme: i.rect
      });
      e.appendChild(l);
    }
    if ("underline" == n) {
      l = this._handleCreateRect(t, {
        opcity: !0,
        isPlaceholder: !0
      });
      var s = this._handleCreateLine(t, {
        styleScheme: i.line
      });
      e.appendChild(l), e.appendChild(s);
    }
    var h = t.x - o.x,
      c = t.y - o.y;
    return {
      group: a,
      position: {
        x1: h,
        y1: c,
        x2: h + t.width,
        y2: c + t.height
      }
    };
  }, e;
}();

var katex = createCommonjsModule(function (module, exports) {
(function webpackUniversalModuleDefinition(root,factory){module.exports=factory();})(typeof self!=='undefined'?self:commonjsGlobal,function(){return/******/function(){// webpackBootstrap
/******/var __webpack_require__={};/******//************************************************************************//******//* webpack/runtime/define property getters *//******/!function(){/******/// define getter functions for harmony exports
/******/__webpack_require__.d=function(exports,definition){/******/for(var key in definition){/******/if(__webpack_require__.o(definition,key)&&!__webpack_require__.o(exports,key)){/******/Object.defineProperty(exports,key,{enumerable:true,get:definition[key]});/******/}/******/}/******/};/******/}();/******//******//* webpack/runtime/hasOwnProperty shorthand *//******/!function(){/******/__webpack_require__.o=function(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);};/******/}();/******//************************************************************************/var __webpack_exports__={};// EXPORTS
__webpack_require__.d(__webpack_exports__,{"default":function(){return/* binding */katex_webpack;}});/**
 * This is the ParseError class, which is the main error thrown by KaTeX
 * functions when something has gone wrong. This is used to distinguish internal
 * errors from errors in the expression that the user provided.
 *
 * If possible, a caller should provide a Token or ParseNode with information
 * about where in the source string the problem occurred.
 */class ParseError{// Error start position based on passed-in Token or ParseNode.
// Length of affected text based on passed-in Token or ParseNode.
// The underlying error message without any context added.
constructor(message,// The error message
token// An object providing position information
){this.name=void 0;this.position=void 0;this.length=void 0;this.rawMessage=void 0;let error="KaTeX parse error: "+message;let start;let end;const loc=token&&token.loc;if(loc&&loc.start<=loc.end){// If we have the input and a position, make the error a bit fancier
// Get the input
const input=loc.lexer.input;// Prepend some information
start=loc.start;end=loc.end;if(start===input.length){error+=" at end of input: ";}else {error+=" at position "+(start+1)+": ";}// Underline token in question using combining underscores
const underlined=input.slice(start,end).replace(/[^]/g,"$&\u0332");// Extract some context from the input and add it to the error
let left;if(start>15){left="…"+input.slice(start-15,start);}else {left=input.slice(0,start);}let right;if(end+15<input.length){right=input.slice(end,end+15)+"…";}else {right=input.slice(end);}error+=left+underlined+right;}// Some hackery to make ParseError a prototype of Error
// See http://stackoverflow.com/a/8460753
// $FlowFixMe
const self=new Error(error);self.name="ParseError";// $FlowFixMe
self.__proto__=ParseError.prototype;self.position=start;if(start!=null&&end!=null){self.length=end-start;}self.rawMessage=message;return self;}}// $FlowFixMe More hackery
ParseError.prototype.__proto__=Error.prototype;/* harmony default export */var src_ParseError=ParseError;/**
 * This file contains a list of utility functions which are useful in other
 * files.
 *//**
 * Return whether an element is contained in a list
 */const contains=function(list,elem){return list.indexOf(elem)!==-1;};/**
 * Provide a default value if a setting is undefined
 * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.
 */const deflt=function(setting,defaultIfUndefined){return setting===undefined?defaultIfUndefined:setting;};// hyphenate and escape adapted from Facebook's React under Apache 2 license
const uppercase=/([A-Z])/g;const hyphenate=function(str){return str.replace(uppercase,"-$1").toLowerCase();};const ESCAPE_LOOKUP={"&":"&amp;",">":"&gt;","<":"&lt;","\"":"&quot;","'":"&#x27;"};const ESCAPE_REGEX=/[&><"']/g;/**
 * Escapes text to prevent scripting attacks.
 */function utils_escape(text){return String(text).replace(ESCAPE_REGEX,match=>ESCAPE_LOOKUP[match]);}/**
 * Sometimes we want to pull out the innermost element of a group. In most
 * cases, this will just be the group itself, but when ordgroups and colors have
 * a single element, we want to pull that out.
 */const getBaseElem=function(group){if(group.type==="ordgroup"){if(group.body.length===1){return getBaseElem(group.body[0]);}else {return group;}}else if(group.type==="color"){if(group.body.length===1){return getBaseElem(group.body[0]);}else {return group;}}else if(group.type==="font"){return getBaseElem(group.body);}else {return group;}};/**
 * TeXbook algorithms often reference "character boxes", which are simply groups
 * with a single character in them. To decide if something is a character box,
 * we find its innermost group, and see if it is a single character.
 */const isCharacterBox=function(group){const baseElem=getBaseElem(group);// These are all they types of groups which hold single characters
return baseElem.type==="mathord"||baseElem.type==="textord"||baseElem.type==="atom";};const assert=function(value){if(!value){throw new Error('Expected non-null, but got '+String(value));}return value;};/**
 * Return the protocol of a URL, or "_relative" if the URL does not specify a
 * protocol (and thus is relative), or `null` if URL has invalid protocol
 * (so should be outright rejected).
 */const protocolFromUrl=function(url){// Check for possible leading protocol.
// https://url.spec.whatwg.org/#url-parsing strips leading whitespace
// (U+20) or C0 control (U+00-U+1F) characters.
// eslint-disable-next-line no-control-regex
const protocol=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(url);if(!protocol){return "_relative";}// Reject weird colons
if(protocol[2]!==":"){return null;}// Reject invalid characters in scheme according to
// https://datatracker.ietf.org/doc/html/rfc3986#section-3.1
if(!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])){return null;}// Lowercase the protocol
return protocol[1].toLowerCase();};/* harmony default export */var utils={contains,deflt,escape:utils_escape,hyphenate,getBaseElem,isCharacterBox,protocolFromUrl};/* eslint no-console:0 *//**
 * This is a module for storing settings passed into KaTeX. It correctly handles
 * default settings.
 */// TODO: automatically generate documentation
// TODO: check all properties on Settings exist
// TODO: check the type of a property on Settings matches
const SETTINGS_SCHEMA={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in "+"display style (so \\int and \\sum are large, for example), and "+"centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:true,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) ins"+"tead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' "+"(no #). This option determines the color of errors rendered by the "+"-t option.",cliProcessor:color=>"#"+color},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use "+"multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(def,defs)=>{defs.push(def);return defs;}},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines,"+" `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, "+"`\\hdashline`, `\\underline`, `\\overline`, and the borders of "+"`\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, "+"instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an "+"error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:false},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:Infinity,description:"If non-zero, all user-specified sizes, e.g. in "+"\\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, "+"elements and spaces can be arbitrarily large",processor:s=>Math.max(0,s),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1000,description:"Limit the number of macro expansions to the specified "+"number, to prevent e.g. infinite macro loops. If set to Infinity, "+"the macro expander will try to fully expand as in LaTeX.",processor:n=>Math.max(0,n),cli:"-e, --max-expand <n>",cliProcessor:n=>n==="Infinity"?Infinity:parseInt(n)},globalGroup:{type:"boolean",cli:false}};function getDefaultValue(schema){if(schema.default){return schema.default;}const type=schema.type;const defaultType=Array.isArray(type)?type[0]:type;if(typeof defaultType!=='string'){return defaultType.enum[0];}switch(defaultType){case'boolean':return false;case'string':return '';case'number':return 0;case'object':return {};}}/**
 * The main Settings object
 *
 * The current options stored are:
 *  - displayMode: Whether the expression should be typeset as inline math
 *                 (false, the default), meaning that the math starts in
 *                 \textstyle and is placed in an inline-block); or as display
 *                 math (true), meaning that the math starts in \displaystyle
 *                 and is placed in a block with vertical margin.
 */class Settings{constructor(options){this.displayMode=void 0;this.output=void 0;this.leqno=void 0;this.fleqn=void 0;this.throwOnError=void 0;this.errorColor=void 0;this.macros=void 0;this.minRuleThickness=void 0;this.colorIsTextColor=void 0;this.strict=void 0;this.trust=void 0;this.maxSize=void 0;this.maxExpand=void 0;this.globalGroup=void 0;// allow null options
options=options||{};for(const prop in SETTINGS_SCHEMA){if(SETTINGS_SCHEMA.hasOwnProperty(prop)){// $FlowFixMe
const schema=SETTINGS_SCHEMA[prop];// TODO: validate options
// $FlowFixMe
this[prop]=options[prop]!==undefined?schema.processor?schema.processor(options[prop]):options[prop]:getDefaultValue(schema);}}}/**
   * Report nonstrict (non-LaTeX-compatible) input.
   * Can safely not be called if `this.strict` is false in JavaScript.
   */reportNonstrict(errorCode,errorMsg,token){let strict=this.strict;if(typeof strict==="function"){// Allow return value of strict function to be boolean or string
// (or null/undefined, meaning no further processing).
strict=strict(errorCode,errorMsg,token);}if(!strict||strict==="ignore"){return;}else if(strict===true||strict==="error"){throw new src_ParseError("LaTeX-incompatible input and strict mode is set to 'error': "+(errorMsg+" ["+errorCode+"]"),token);}else if(strict==="warn"){typeof console!=="undefined"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(errorMsg+" ["+errorCode+"]"));}else {// won't happen in type-safe code
typeof console!=="undefined"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+strict+"': "+errorMsg+" ["+errorCode+"]"));}}/**
   * Check whether to apply strict (LaTeX-adhering) behavior for unusual
   * input (like `\\`).  Unlike `nonstrict`, will not throw an error;
   * instead, "error" translates to a return value of `true`, while "ignore"
   * translates to a return value of `false`.  May still print a warning:
   * "warn" prints a warning and returns `false`.
   * This is for the second category of `errorCode`s listed in the README.
   */useStrictBehavior(errorCode,errorMsg,token){let strict=this.strict;if(typeof strict==="function"){// Allow return value of strict function to be boolean or string
// (or null/undefined, meaning no further processing).
// But catch any exceptions thrown by function, treating them
// like "error".
try{strict=strict(errorCode,errorMsg,token);}catch(error){strict="error";}}if(!strict||strict==="ignore"){return false;}else if(strict===true||strict==="error"){return true;}else if(strict==="warn"){typeof console!=="undefined"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(errorMsg+" ["+errorCode+"]"));return false;}else {// won't happen in type-safe code
typeof console!=="undefined"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+strict+"': "+errorMsg+" ["+errorCode+"]"));return false;}}/**
   * Check whether to test potentially dangerous input, and return
   * `true` (trusted) or `false` (untrusted).  The sole argument `context`
   * should be an object with `command` field specifying the relevant LaTeX
   * command (as a string starting with `\`), and any other arguments, etc.
   * If `context` has a `url` field, a `protocol` field will automatically
   * get added by this function (changing the specified object).
   */isTrusted(context){if(context.url&&!context.protocol){const protocol=utils.protocolFromUrl(context.url);if(protocol==null){return false;}context.protocol=protocol;}const trust=typeof this.trust==="function"?this.trust(context):this.trust;return Boolean(trust);}}/**
 * This file contains information and classes for the various kinds of styles
 * used in TeX. It provides a generic `Style` class, which holds information
 * about a specific style. It then provides instances of all the different kinds
 * of styles possible, and provides functions to move between them and get
 * information about them.
 *//**
 * The main style class. Contains a unique id for the style, a size (which is
 * the same for cramped and uncramped version of a style), and a cramped flag.
 */class Style{constructor(id,size,cramped){this.id=void 0;this.size=void 0;this.cramped=void 0;this.id=id;this.size=size;this.cramped=cramped;}/**
   * Get the style of a superscript given a base in the current style.
   */sup(){return styles[sup[this.id]];}/**
   * Get the style of a subscript given a base in the current style.
   */sub(){return styles[sub[this.id]];}/**
   * Get the style of a fraction numerator given the fraction in the current
   * style.
   */fracNum(){return styles[fracNum[this.id]];}/**
   * Get the style of a fraction denominator given the fraction in the current
   * style.
   */fracDen(){return styles[fracDen[this.id]];}/**
   * Get the cramped version of a style (in particular, cramping a cramped style
   * doesn't change the style).
   */cramp(){return styles[cramp[this.id]];}/**
   * Get a text or display version of this style.
   */text(){return styles[Style_text[this.id]];}/**
   * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
   */isTight(){return this.size>=2;}}// Export an interface for type checking, but don't expose the implementation.
// This way, no more styles can be generated.
// IDs of the different styles
const D=0;const Dc=1;const T=2;const Tc=3;const S=4;const Sc=5;const SS=6;const SSc=7;// Instances of the different styles
const styles=[new Style(D,0,false),new Style(Dc,0,true),new Style(T,1,false),new Style(Tc,1,true),new Style(S,2,false),new Style(Sc,2,true),new Style(SS,3,false),new Style(SSc,3,true)];// Lookup tables for switching from one style to another
const sup=[S,Sc,S,Sc,SS,SSc,SS,SSc];const sub=[Sc,Sc,Sc,Sc,SSc,SSc,SSc,SSc];const fracNum=[T,Tc,S,Sc,SS,SSc,SS,SSc];const fracDen=[Tc,Tc,Sc,Sc,SSc,SSc,SSc,SSc];const cramp=[Dc,Dc,Tc,Tc,Sc,Sc,SSc,SSc];const Style_text=[D,Dc,T,Tc,T,Tc,T,Tc];// We only export some of the styles.
/* harmony default export */var src_Style={DISPLAY:styles[D],TEXT:styles[T],SCRIPT:styles[S],SCRIPTSCRIPT:styles[SS]};/*
 * This file defines the Unicode scripts and script families that we
 * support. To add new scripts or families, just add a new entry to the
 * scriptData array below. Adding scripts to the scriptData array allows
 * characters from that script to appear in \text{} environments.
 *//**
 * Each script or script family has a name and an array of blocks.
 * Each block is an array of two numbers which specify the start and
 * end points (inclusive) of a block of Unicode codepoints.
 *//**
 * Unicode block data for the families of scripts we support in \text{}.
 * Scripts only need to appear here if they do not have font metrics.
 */const scriptData=[{// Latin characters beyond the Latin-1 characters we have metrics for.
// Needed for Czech, Hungarian and Turkish text, for example.
name:'latin',blocks:[[0x0100,0x024f],// Latin Extended-A and Latin Extended-B
[0x0300,0x036f]// Combining Diacritical marks
]},{// The Cyrillic script used by Russian and related languages.
// A Cyrillic subset used to be supported as explicitly defined
// symbols in symbols.js
name:'cyrillic',blocks:[[0x0400,0x04ff]]},{// Armenian
name:'armenian',blocks:[[0x0530,0x058F]]},{// The Brahmic scripts of South and Southeast Asia
// Devanagari (0900–097F)
// Bengali (0980–09FF)
// Gurmukhi (0A00–0A7F)
// Gujarati (0A80–0AFF)
// Oriya (0B00–0B7F)
// Tamil (0B80–0BFF)
// Telugu (0C00–0C7F)
// Kannada (0C80–0CFF)
// Malayalam (0D00–0D7F)
// Sinhala (0D80–0DFF)
// Thai (0E00–0E7F)
// Lao (0E80–0EFF)
// Tibetan (0F00–0FFF)
// Myanmar (1000–109F)
name:'brahmic',blocks:[[0x0900,0x109F]]},{name:'georgian',blocks:[[0x10A0,0x10ff]]},{// Chinese and Japanese.
// The "k" in cjk is for Korean, but we've separated Korean out
name:"cjk",blocks:[[0x3000,0x30FF],// CJK symbols and punctuation, Hiragana, Katakana
[0x4E00,0x9FAF],// CJK ideograms
[0xFF00,0xFF60]// Fullwidth punctuation
// TODO: add halfwidth Katakana and Romanji glyphs
]},{// Korean
name:'hangul',blocks:[[0xAC00,0xD7AF]]}];/**
 * Given a codepoint, return the name of the script or script family
 * it is from, or null if it is not part of a known block
 */function scriptFromCodepoint(codepoint){for(let i=0;i<scriptData.length;i++){const script=scriptData[i];for(let i=0;i<script.blocks.length;i++){const block=script.blocks[i];if(codepoint>=block[0]&&codepoint<=block[1]){return script.name;}}}return null;}/**
 * A flattened version of all the supported blocks in a single array.
 * This is an optimization to make supportedCodepoint() fast.
 */const allBlocks=[];scriptData.forEach(s=>s.blocks.forEach(b=>allBlocks.push(...b)));/**
 * Given a codepoint, return true if it falls within one of the
 * scripts or script families defined above and false otherwise.
 *
 * Micro benchmarks shows that this is faster than
 * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test()
 * in Firefox, Chrome and Node.
 */function supportedCodepoint(codepoint){for(let i=0;i<allBlocks.length;i+=2){if(codepoint>=allBlocks[i]&&codepoint<=allBlocks[i+1]){return true;}}return false;}/**
 * This file provides support to domTree.js and delimiter.js.
 * It's a storehouse of path geometry for SVG images.
 */// In all paths below, the viewBox-to-em scale is 1000:1.
const hLinePad=80;// padding above a sqrt vinculum. Prevents image cropping.
// The vinculum of a \sqrt can be made thicker by a KaTeX rendering option.
// Think of variable extraVinculum as two detours in the SVG path.
// The detour begins at the lower left of the area labeled extraVinculum below.
// The detour proceeds one extraVinculum distance up and slightly to the right,
// displacing the radiused corner between surd and vinculum. The radius is
// traversed as usual, then the detour resumes. It goes right, to the end of
// the very long vinculum, then down one extraVinculum distance,
// after which it resumes regular path geometry for the radical.
/*                                                  vinculum
                                                   /
         /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraVinculum
        / █████████████████████←0.04em (40 unit) std vinculum thickness
       / /
      / /
     / /\
    / / surd
*/const sqrtMain=function(extraVinculum,hLinePad){// sqrtMain path geometry is from glyph U221A in the font KaTeX Main
return "M95,"+(622+extraVinculum+hLinePad)+"\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl"+extraVinculum/2.075+" -"+extraVinculum+"\nc5.3,-9.3,12,-14,20,-14\nH400000v"+(40+extraVinculum)+"H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM"+(834+extraVinculum)+" "+hLinePad+"h400000v"+(40+extraVinculum)+"h-400000z";};const sqrtSize1=function(extraVinculum,hLinePad){// size1 is from glyph U221A in the font KaTeX_Size1-Regular
return "M263,"+(601+extraVinculum+hLinePad)+"c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl"+extraVinculum/2.084+" -"+extraVinculum+"\nc4.7,-7.3,11,-11,19,-11\nH40000v"+(40+extraVinculum)+"H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM"+(1001+extraVinculum)+" "+hLinePad+"h400000v"+(40+extraVinculum)+"h-400000z";};const sqrtSize2=function(extraVinculum,hLinePad){// size2 is from glyph U221A in the font KaTeX_Size2-Regular
return "M983 "+(10+extraVinculum+hLinePad)+"\nl"+extraVinculum/3.13+" -"+extraVinculum+"\nc4,-6.7,10,-10,18,-10 H400000v"+(40+extraVinculum)+"\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM"+(1001+extraVinculum)+" "+hLinePad+"h400000v"+(40+extraVinculum)+"h-400000z";};const sqrtSize3=function(extraVinculum,hLinePad){// size3 is from glyph U221A in the font KaTeX_Size3-Regular
return "M424,"+(2398+extraVinculum+hLinePad)+"\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl"+extraVinculum/4.223+" -"+extraVinculum+"c4,-6.7,10,-10,18,-10 H400000\nv"+(40+extraVinculum)+"H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M"+(1001+extraVinculum)+" "+hLinePad+"\nh400000v"+(40+extraVinculum)+"h-400000z";};const sqrtSize4=function(extraVinculum,hLinePad){// size4 is from glyph U221A in the font KaTeX_Size4-Regular
return "M473,"+(2713+extraVinculum+hLinePad)+"\nc339.3,-1799.3,509.3,-2700,510,-2702 l"+extraVinculum/5.298+" -"+extraVinculum+"\nc3.3,-7.3,9.3,-11,18,-11 H400000v"+(40+extraVinculum)+"H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM"+(1001+extraVinculum)+" "+hLinePad+"h400000v"+(40+extraVinculum)+"H1017.7z";};const phasePath=function(y){const x=y/2;// x coordinate at top of angle
return "M400000 "+y+" H0 L"+x+" 0 l65 45 L145 "+(y-80)+" H400000z";};const sqrtTall=function(extraVinculum,hLinePad,viewBoxHeight){// sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular
// One path edge has a variable length. It runs vertically from the vinculum
// to a point near (14 units) the bottom of the surd. The vinculum
// is normally 40 units thick. So the length of the line in question is:
const vertSegment=viewBoxHeight-54-hLinePad-extraVinculum;return "M702 "+(extraVinculum+hLinePad)+"H400000"+(40+extraVinculum)+"\nH742v"+vertSegment+"l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 "+hLinePad+"H400000v"+(40+extraVinculum)+"H742z";};const sqrtPath=function(size,extraVinculum,viewBoxHeight){extraVinculum=1000*extraVinculum;// Convert from document ems to viewBox.
let path="";switch(size){case"sqrtMain":path=sqrtMain(extraVinculum,hLinePad);break;case"sqrtSize1":path=sqrtSize1(extraVinculum,hLinePad);break;case"sqrtSize2":path=sqrtSize2(extraVinculum,hLinePad);break;case"sqrtSize3":path=sqrtSize3(extraVinculum,hLinePad);break;case"sqrtSize4":path=sqrtSize4(extraVinculum,hLinePad);break;case"sqrtTall":path=sqrtTall(extraVinculum,hLinePad,viewBoxHeight);}return path;};const innerPath=function(name,height){// The inner part of stretchy tall delimiters
switch(name){case"\u239c":return "M291 0 H417 V"+height+" H291z M291 0 H417 V"+height+" H291z";case"\u2223":return "M145 0 H188 V"+height+" H145z M145 0 H188 V"+height+" H145z";case"\u2225":return "M145 0 H188 V"+height+" H145z M145 0 H188 V"+height+" H145z"+("M367 0 H410 V"+height+" H367z M367 0 H410 V"+height+" H367z");case"\u239f":return "M457 0 H583 V"+height+" H457z M457 0 H583 V"+height+" H457z";case"\u23a2":return "M319 0 H403 V"+height+" H319z M319 0 H403 V"+height+" H319z";case"\u23a5":return "M263 0 H347 V"+height+" H263z M263 0 H347 V"+height+" H263z";case"\u23aa":return "M384 0 H504 V"+height+" H384z M384 0 H504 V"+height+" H384z";case"\u23d0":return "M312 0 H355 V"+height+" H312z M312 0 H355 V"+height+" H312z";case"\u2016":return "M257 0 H300 V"+height+" H257z M257 0 H300 V"+height+" H257z"+("M478 0 H521 V"+height+" H478z M478 0 H521 V"+height+" H478z");default:return "";}};const path={// The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",// doublerightarrow is from glyph U+21D2 in font KaTeX Main
doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",// leftarrow is from glyph U+2190 in font KaTeX Main
leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",// overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",// overgroup is from the MnSymbol package (public domain)
leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",// Harpoons are from glyph U+21BD in font KaTeX Main
leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",// hook is from glyph U+21A9 in font KaTeX Main
lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",// tofrom is from glyph U+21C4 in font KaTeX AMS Regular
leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",// twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",// tilde1 is a modified version of a glyph from the MnSymbol package
tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",// ditto tilde2, tilde3, & tilde4
tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",// vec is from glyph U+20D7 in font KaTeX Main
vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",// widehat1 is a modified version of a glyph from the MnSymbol package
widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",// ditto widehat2, widehat3, & widehat4
widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",// widecheck paths are all inverted versions of widehat
widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",// The next ten paths support reaction arrows from the mhchem package.
// Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
// baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main
baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",// rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",// The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
// Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em
baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"};const tallDelim=function(label,midHeight){switch(label){case"lbrack":return "M403 1759 V84 H666 V0 H319 V1759 v"+midHeight+" v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v"+midHeight+" v1759 h84z";case"rbrack":return "M347 1759 V0 H0 V84 H263 V1759 v"+midHeight+" v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v"+midHeight+" v1759 h84z";case"vert":return "M145 15 v585 v"+midHeight+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-midHeight+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+midHeight+" v585 h43z";case"doublevert":return "M145 15 v585 v"+midHeight+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-midHeight+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v"+midHeight+" v585 h43z\nM367 15 v585 v"+midHeight+" v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v"+-midHeight+" v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v"+midHeight+" v585 h43z";case"lfloor":return "M319 602 V0 H403 V602 v"+midHeight+" v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v"+midHeight+" v1715 H319z";case"rfloor":return "M319 602 V0 H403 V602 v"+midHeight+" v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v"+midHeight+" v1715 H319z";case"lceil":return "M403 1759 V84 H666 V0 H319 V1759 v"+midHeight+" v602 h84z\nM403 1759 V0 H319 V1759 v"+midHeight+" v602 h84z";case"rceil":return "M347 1759 V0 H0 V84 H263 V1759 v"+midHeight+" v602 h84z\nM347 1759 V0 h-84 V1759 v"+midHeight+" v602 h84z";case"lparen":return "M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0,"+(midHeight+84)+"c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-"+(midHeight+92)+"c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z";case"rparen":return "M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,"+(midHeight+9)+"\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-"+(midHeight+144)+"c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z";default:// We should not ever get here.
throw new Error("Unknown stretchy delimiter.");}};/**
 * This node represents a document fragment, which contains elements, but when
 * placed into the DOM doesn't have any representation itself. It only contains
 * children and doesn't have any DOM node properties.
 */class DocumentFragment{// HtmlDomNode
// Never used; needed for satisfying interface.
constructor(children){this.children=void 0;this.classes=void 0;this.height=void 0;this.depth=void 0;this.maxFontSize=void 0;this.style=void 0;this.children=children;this.classes=[];this.height=0;this.depth=0;this.maxFontSize=0;this.style={};}hasClass(className){return utils.contains(this.classes,className);}/** Convert the fragment into a node. */toNode(){const frag=document.createDocumentFragment();for(let i=0;i<this.children.length;i++){frag.appendChild(this.children[i].toNode());}return frag;}/** Convert the fragment into HTML markup. */toMarkup(){let markup="";// Simply concatenate the markup for the children together.
for(let i=0;i<this.children.length;i++){markup+=this.children[i].toMarkup();}return markup;}/**
   * Converts the math node into a string, similar to innerText. Applies to
   * MathDomNode's only.
   */toText(){// To avoid this, we would subclass documentFragment separately for
// MathML, but polyfills for subclassing is expensive per PR 1469.
// $FlowFixMe: Only works for ChildType = MathDomNode.
const toText=child=>child.toText();return this.children.map(toText).join("");}}// This file is GENERATED by buildMetrics.sh. DO NOT MODIFY.
/* harmony default export */var fontMetricsData={"AMS-Regular":{"32":[0,0,0,0,0.25],"65":[0,0.68889,0,0,0.72222],"66":[0,0.68889,0,0,0.66667],"67":[0,0.68889,0,0,0.72222],"68":[0,0.68889,0,0,0.72222],"69":[0,0.68889,0,0,0.66667],"70":[0,0.68889,0,0,0.61111],"71":[0,0.68889,0,0,0.77778],"72":[0,0.68889,0,0,0.77778],"73":[0,0.68889,0,0,0.38889],"74":[0.16667,0.68889,0,0,0.5],"75":[0,0.68889,0,0,0.77778],"76":[0,0.68889,0,0,0.66667],"77":[0,0.68889,0,0,0.94445],"78":[0,0.68889,0,0,0.72222],"79":[0.16667,0.68889,0,0,0.77778],"80":[0,0.68889,0,0,0.61111],"81":[0.16667,0.68889,0,0,0.77778],"82":[0,0.68889,0,0,0.72222],"83":[0,0.68889,0,0,0.55556],"84":[0,0.68889,0,0,0.66667],"85":[0,0.68889,0,0,0.72222],"86":[0,0.68889,0,0,0.72222],"87":[0,0.68889,0,0,1.0],"88":[0,0.68889,0,0,0.72222],"89":[0,0.68889,0,0,0.72222],"90":[0,0.68889,0,0,0.66667],"107":[0,0.68889,0,0,0.55556],"160":[0,0,0,0,0.25],"165":[0,0.675,0.025,0,0.75],"174":[0.15559,0.69224,0,0,0.94666],"240":[0,0.68889,0,0,0.55556],"295":[0,0.68889,0,0,0.54028],"710":[0,0.825,0,0,2.33334],"732":[0,0.9,0,0,2.33334],"770":[0,0.825,0,0,2.33334],"771":[0,0.9,0,0,2.33334],"989":[0.08167,0.58167,0,0,0.77778],"1008":[0,0.43056,0.04028,0,0.66667],"8245":[0,0.54986,0,0,0.275],"8463":[0,0.68889,0,0,0.54028],"8487":[0,0.68889,0,0,0.72222],"8498":[0,0.68889,0,0,0.55556],"8502":[0,0.68889,0,0,0.66667],"8503":[0,0.68889,0,0,0.44445],"8504":[0,0.68889,0,0,0.66667],"8513":[0,0.68889,0,0,0.63889],"8592":[-0.03598,0.46402,0,0,0.5],"8594":[-0.03598,0.46402,0,0,0.5],"8602":[-0.13313,0.36687,0,0,1.0],"8603":[-0.13313,0.36687,0,0,1.0],"8606":[0.01354,0.52239,0,0,1.0],"8608":[0.01354,0.52239,0,0,1.0],"8610":[0.01354,0.52239,0,0,1.11111],"8611":[0.01354,0.52239,0,0,1.11111],"8619":[0,0.54986,0,0,1.0],"8620":[0,0.54986,0,0,1.0],"8621":[-0.13313,0.37788,0,0,1.38889],"8622":[-0.13313,0.36687,0,0,1.0],"8624":[0,0.69224,0,0,0.5],"8625":[0,0.69224,0,0,0.5],"8630":[0,0.43056,0,0,1.0],"8631":[0,0.43056,0,0,1.0],"8634":[0.08198,0.58198,0,0,0.77778],"8635":[0.08198,0.58198,0,0,0.77778],"8638":[0.19444,0.69224,0,0,0.41667],"8639":[0.19444,0.69224,0,0,0.41667],"8642":[0.19444,0.69224,0,0,0.41667],"8643":[0.19444,0.69224,0,0,0.41667],"8644":[0.1808,0.675,0,0,1.0],"8646":[0.1808,0.675,0,0,1.0],"8647":[0.1808,0.675,0,0,1.0],"8648":[0.19444,0.69224,0,0,0.83334],"8649":[0.1808,0.675,0,0,1.0],"8650":[0.19444,0.69224,0,0,0.83334],"8651":[0.01354,0.52239,0,0,1.0],"8652":[0.01354,0.52239,0,0,1.0],"8653":[-0.13313,0.36687,0,0,1.0],"8654":[-0.13313,0.36687,0,0,1.0],"8655":[-0.13313,0.36687,0,0,1.0],"8666":[0.13667,0.63667,0,0,1.0],"8667":[0.13667,0.63667,0,0,1.0],"8669":[-0.13313,0.37788,0,0,1.0],"8672":[-0.064,0.437,0,0,1.334],"8674":[-0.064,0.437,0,0,1.334],"8705":[0,0.825,0,0,0.5],"8708":[0,0.68889,0,0,0.55556],"8709":[0.08167,0.58167,0,0,0.77778],"8717":[0,0.43056,0,0,0.42917],"8722":[-0.03598,0.46402,0,0,0.5],"8724":[0.08198,0.69224,0,0,0.77778],"8726":[0.08167,0.58167,0,0,0.77778],"8733":[0,0.69224,0,0,0.77778],"8736":[0,0.69224,0,0,0.72222],"8737":[0,0.69224,0,0,0.72222],"8738":[0.03517,0.52239,0,0,0.72222],"8739":[0.08167,0.58167,0,0,0.22222],"8740":[0.25142,0.74111,0,0,0.27778],"8741":[0.08167,0.58167,0,0,0.38889],"8742":[0.25142,0.74111,0,0,0.5],"8756":[0,0.69224,0,0,0.66667],"8757":[0,0.69224,0,0,0.66667],"8764":[-0.13313,0.36687,0,0,0.77778],"8765":[-0.13313,0.37788,0,0,0.77778],"8769":[-0.13313,0.36687,0,0,0.77778],"8770":[-0.03625,0.46375,0,0,0.77778],"8774":[0.30274,0.79383,0,0,0.77778],"8776":[-0.01688,0.48312,0,0,0.77778],"8778":[0.08167,0.58167,0,0,0.77778],"8782":[0.06062,0.54986,0,0,0.77778],"8783":[0.06062,0.54986,0,0,0.77778],"8785":[0.08198,0.58198,0,0,0.77778],"8786":[0.08198,0.58198,0,0,0.77778],"8787":[0.08198,0.58198,0,0,0.77778],"8790":[0,0.69224,0,0,0.77778],"8791":[0.22958,0.72958,0,0,0.77778],"8796":[0.08198,0.91667,0,0,0.77778],"8806":[0.25583,0.75583,0,0,0.77778],"8807":[0.25583,0.75583,0,0,0.77778],"8808":[0.25142,0.75726,0,0,0.77778],"8809":[0.25142,0.75726,0,0,0.77778],"8812":[0.25583,0.75583,0,0,0.5],"8814":[0.20576,0.70576,0,0,0.77778],"8815":[0.20576,0.70576,0,0,0.77778],"8816":[0.30274,0.79383,0,0,0.77778],"8817":[0.30274,0.79383,0,0,0.77778],"8818":[0.22958,0.72958,0,0,0.77778],"8819":[0.22958,0.72958,0,0,0.77778],"8822":[0.1808,0.675,0,0,0.77778],"8823":[0.1808,0.675,0,0,0.77778],"8828":[0.13667,0.63667,0,0,0.77778],"8829":[0.13667,0.63667,0,0,0.77778],"8830":[0.22958,0.72958,0,0,0.77778],"8831":[0.22958,0.72958,0,0,0.77778],"8832":[0.20576,0.70576,0,0,0.77778],"8833":[0.20576,0.70576,0,0,0.77778],"8840":[0.30274,0.79383,0,0,0.77778],"8841":[0.30274,0.79383,0,0,0.77778],"8842":[0.13597,0.63597,0,0,0.77778],"8843":[0.13597,0.63597,0,0,0.77778],"8847":[0.03517,0.54986,0,0,0.77778],"8848":[0.03517,0.54986,0,0,0.77778],"8858":[0.08198,0.58198,0,0,0.77778],"8859":[0.08198,0.58198,0,0,0.77778],"8861":[0.08198,0.58198,0,0,0.77778],"8862":[0,0.675,0,0,0.77778],"8863":[0,0.675,0,0,0.77778],"8864":[0,0.675,0,0,0.77778],"8865":[0,0.675,0,0,0.77778],"8872":[0,0.69224,0,0,0.61111],"8873":[0,0.69224,0,0,0.72222],"8874":[0,0.69224,0,0,0.88889],"8876":[0,0.68889,0,0,0.61111],"8877":[0,0.68889,0,0,0.61111],"8878":[0,0.68889,0,0,0.72222],"8879":[0,0.68889,0,0,0.72222],"8882":[0.03517,0.54986,0,0,0.77778],"8883":[0.03517,0.54986,0,0,0.77778],"8884":[0.13667,0.63667,0,0,0.77778],"8885":[0.13667,0.63667,0,0,0.77778],"8888":[0,0.54986,0,0,1.11111],"8890":[0.19444,0.43056,0,0,0.55556],"8891":[0.19444,0.69224,0,0,0.61111],"8892":[0.19444,0.69224,0,0,0.61111],"8901":[0,0.54986,0,0,0.27778],"8903":[0.08167,0.58167,0,0,0.77778],"8905":[0.08167,0.58167,0,0,0.77778],"8906":[0.08167,0.58167,0,0,0.77778],"8907":[0,0.69224,0,0,0.77778],"8908":[0,0.69224,0,0,0.77778],"8909":[-0.03598,0.46402,0,0,0.77778],"8910":[0,0.54986,0,0,0.76042],"8911":[0,0.54986,0,0,0.76042],"8912":[0.03517,0.54986,0,0,0.77778],"8913":[0.03517,0.54986,0,0,0.77778],"8914":[0,0.54986,0,0,0.66667],"8915":[0,0.54986,0,0,0.66667],"8916":[0,0.69224,0,0,0.66667],"8918":[0.0391,0.5391,0,0,0.77778],"8919":[0.0391,0.5391,0,0,0.77778],"8920":[0.03517,0.54986,0,0,1.33334],"8921":[0.03517,0.54986,0,0,1.33334],"8922":[0.38569,0.88569,0,0,0.77778],"8923":[0.38569,0.88569,0,0,0.77778],"8926":[0.13667,0.63667,0,0,0.77778],"8927":[0.13667,0.63667,0,0,0.77778],"8928":[0.30274,0.79383,0,0,0.77778],"8929":[0.30274,0.79383,0,0,0.77778],"8934":[0.23222,0.74111,0,0,0.77778],"8935":[0.23222,0.74111,0,0,0.77778],"8936":[0.23222,0.74111,0,0,0.77778],"8937":[0.23222,0.74111,0,0,0.77778],"8938":[0.20576,0.70576,0,0,0.77778],"8939":[0.20576,0.70576,0,0,0.77778],"8940":[0.30274,0.79383,0,0,0.77778],"8941":[0.30274,0.79383,0,0,0.77778],"8994":[0.19444,0.69224,0,0,0.77778],"8995":[0.19444,0.69224,0,0,0.77778],"9416":[0.15559,0.69224,0,0,0.90222],"9484":[0,0.69224,0,0,0.5],"9488":[0,0.69224,0,0,0.5],"9492":[0,0.37788,0,0,0.5],"9496":[0,0.37788,0,0,0.5],"9585":[0.19444,0.68889,0,0,0.88889],"9586":[0.19444,0.74111,0,0,0.88889],"9632":[0,0.675,0,0,0.77778],"9633":[0,0.675,0,0,0.77778],"9650":[0,0.54986,0,0,0.72222],"9651":[0,0.54986,0,0,0.72222],"9654":[0.03517,0.54986,0,0,0.77778],"9660":[0,0.54986,0,0,0.72222],"9661":[0,0.54986,0,0,0.72222],"9664":[0.03517,0.54986,0,0,0.77778],"9674":[0.11111,0.69224,0,0,0.66667],"9733":[0.19444,0.69224,0,0,0.94445],"10003":[0,0.69224,0,0,0.83334],"10016":[0,0.69224,0,0,0.83334],"10731":[0.11111,0.69224,0,0,0.66667],"10846":[0.19444,0.75583,0,0,0.61111],"10877":[0.13667,0.63667,0,0,0.77778],"10878":[0.13667,0.63667,0,0,0.77778],"10885":[0.25583,0.75583,0,0,0.77778],"10886":[0.25583,0.75583,0,0,0.77778],"10887":[0.13597,0.63597,0,0,0.77778],"10888":[0.13597,0.63597,0,0,0.77778],"10889":[0.26167,0.75726,0,0,0.77778],"10890":[0.26167,0.75726,0,0,0.77778],"10891":[0.48256,0.98256,0,0,0.77778],"10892":[0.48256,0.98256,0,0,0.77778],"10901":[0.13667,0.63667,0,0,0.77778],"10902":[0.13667,0.63667,0,0,0.77778],"10933":[0.25142,0.75726,0,0,0.77778],"10934":[0.25142,0.75726,0,0,0.77778],"10935":[0.26167,0.75726,0,0,0.77778],"10936":[0.26167,0.75726,0,0,0.77778],"10937":[0.26167,0.75726,0,0,0.77778],"10938":[0.26167,0.75726,0,0,0.77778],"10949":[0.25583,0.75583,0,0,0.77778],"10950":[0.25583,0.75583,0,0,0.77778],"10955":[0.28481,0.79383,0,0,0.77778],"10956":[0.28481,0.79383,0,0,0.77778],"57350":[0.08167,0.58167,0,0,0.22222],"57351":[0.08167,0.58167,0,0,0.38889],"57352":[0.08167,0.58167,0,0,0.77778],"57353":[0,0.43056,0.04028,0,0.66667],"57356":[0.25142,0.75726,0,0,0.77778],"57357":[0.25142,0.75726,0,0,0.77778],"57358":[0.41951,0.91951,0,0,0.77778],"57359":[0.30274,0.79383,0,0,0.77778],"57360":[0.30274,0.79383,0,0,0.77778],"57361":[0.41951,0.91951,0,0,0.77778],"57366":[0.25142,0.75726,0,0,0.77778],"57367":[0.25142,0.75726,0,0,0.77778],"57368":[0.25142,0.75726,0,0,0.77778],"57369":[0.25142,0.75726,0,0,0.77778],"57370":[0.13597,0.63597,0,0,0.77778],"57371":[0.13597,0.63597,0,0,0.77778]},"Caligraphic-Regular":{"32":[0,0,0,0,0.25],"65":[0,0.68333,0,0.19445,0.79847],"66":[0,0.68333,0.03041,0.13889,0.65681],"67":[0,0.68333,0.05834,0.13889,0.52653],"68":[0,0.68333,0.02778,0.08334,0.77139],"69":[0,0.68333,0.08944,0.11111,0.52778],"70":[0,0.68333,0.09931,0.11111,0.71875],"71":[0.09722,0.68333,0.0593,0.11111,0.59487],"72":[0,0.68333,0.00965,0.11111,0.84452],"73":[0,0.68333,0.07382,0,0.54452],"74":[0.09722,0.68333,0.18472,0.16667,0.67778],"75":[0,0.68333,0.01445,0.05556,0.76195],"76":[0,0.68333,0,0.13889,0.68972],"77":[0,0.68333,0,0.13889,1.2009],"78":[0,0.68333,0.14736,0.08334,0.82049],"79":[0,0.68333,0.02778,0.11111,0.79611],"80":[0,0.68333,0.08222,0.08334,0.69556],"81":[0.09722,0.68333,0,0.11111,0.81667],"82":[0,0.68333,0,0.08334,0.8475],"83":[0,0.68333,0.075,0.13889,0.60556],"84":[0,0.68333,0.25417,0,0.54464],"85":[0,0.68333,0.09931,0.08334,0.62583],"86":[0,0.68333,0.08222,0,0.61278],"87":[0,0.68333,0.08222,0.08334,0.98778],"88":[0,0.68333,0.14643,0.13889,0.7133],"89":[0.09722,0.68333,0.08222,0.08334,0.66834],"90":[0,0.68333,0.07944,0.13889,0.72473],"160":[0,0,0,0,0.25]},"Fraktur-Regular":{"32":[0,0,0,0,0.25],"33":[0,0.69141,0,0,0.29574],"34":[0,0.69141,0,0,0.21471],"38":[0,0.69141,0,0,0.73786],"39":[0,0.69141,0,0,0.21201],"40":[0.24982,0.74947,0,0,0.38865],"41":[0.24982,0.74947,0,0,0.38865],"42":[0,0.62119,0,0,0.27764],"43":[0.08319,0.58283,0,0,0.75623],"44":[0,0.10803,0,0,0.27764],"45":[0.08319,0.58283,0,0,0.75623],"46":[0,0.10803,0,0,0.27764],"47":[0.24982,0.74947,0,0,0.50181],"48":[0,0.47534,0,0,0.50181],"49":[0,0.47534,0,0,0.50181],"50":[0,0.47534,0,0,0.50181],"51":[0.18906,0.47534,0,0,0.50181],"52":[0.18906,0.47534,0,0,0.50181],"53":[0.18906,0.47534,0,0,0.50181],"54":[0,0.69141,0,0,0.50181],"55":[0.18906,0.47534,0,0,0.50181],"56":[0,0.69141,0,0,0.50181],"57":[0.18906,0.47534,0,0,0.50181],"58":[0,0.47534,0,0,0.21606],"59":[0.12604,0.47534,0,0,0.21606],"61":[-0.13099,0.36866,0,0,0.75623],"63":[0,0.69141,0,0,0.36245],"65":[0,0.69141,0,0,0.7176],"66":[0,0.69141,0,0,0.88397],"67":[0,0.69141,0,0,0.61254],"68":[0,0.69141,0,0,0.83158],"69":[0,0.69141,0,0,0.66278],"70":[0.12604,0.69141,0,0,0.61119],"71":[0,0.69141,0,0,0.78539],"72":[0.06302,0.69141,0,0,0.7203],"73":[0,0.69141,0,0,0.55448],"74":[0.12604,0.69141,0,0,0.55231],"75":[0,0.69141,0,0,0.66845],"76":[0,0.69141,0,0,0.66602],"77":[0,0.69141,0,0,1.04953],"78":[0,0.69141,0,0,0.83212],"79":[0,0.69141,0,0,0.82699],"80":[0.18906,0.69141,0,0,0.82753],"81":[0.03781,0.69141,0,0,0.82699],"82":[0,0.69141,0,0,0.82807],"83":[0,0.69141,0,0,0.82861],"84":[0,0.69141,0,0,0.66899],"85":[0,0.69141,0,0,0.64576],"86":[0,0.69141,0,0,0.83131],"87":[0,0.69141,0,0,1.04602],"88":[0,0.69141,0,0,0.71922],"89":[0.18906,0.69141,0,0,0.83293],"90":[0.12604,0.69141,0,0,0.60201],"91":[0.24982,0.74947,0,0,0.27764],"93":[0.24982,0.74947,0,0,0.27764],"94":[0,0.69141,0,0,0.49965],"97":[0,0.47534,0,0,0.50046],"98":[0,0.69141,0,0,0.51315],"99":[0,0.47534,0,0,0.38946],"100":[0,0.62119,0,0,0.49857],"101":[0,0.47534,0,0,0.40053],"102":[0.18906,0.69141,0,0,0.32626],"103":[0.18906,0.47534,0,0,0.5037],"104":[0.18906,0.69141,0,0,0.52126],"105":[0,0.69141,0,0,0.27899],"106":[0,0.69141,0,0,0.28088],"107":[0,0.69141,0,0,0.38946],"108":[0,0.69141,0,0,0.27953],"109":[0,0.47534,0,0,0.76676],"110":[0,0.47534,0,0,0.52666],"111":[0,0.47534,0,0,0.48885],"112":[0.18906,0.52396,0,0,0.50046],"113":[0.18906,0.47534,0,0,0.48912],"114":[0,0.47534,0,0,0.38919],"115":[0,0.47534,0,0,0.44266],"116":[0,0.62119,0,0,0.33301],"117":[0,0.47534,0,0,0.5172],"118":[0,0.52396,0,0,0.5118],"119":[0,0.52396,0,0,0.77351],"120":[0.18906,0.47534,0,0,0.38865],"121":[0.18906,0.47534,0,0,0.49884],"122":[0.18906,0.47534,0,0,0.39054],"160":[0,0,0,0,0.25],"8216":[0,0.69141,0,0,0.21471],"8217":[0,0.69141,0,0,0.21471],"58112":[0,0.62119,0,0,0.49749],"58113":[0,0.62119,0,0,0.4983],"58114":[0.18906,0.69141,0,0,0.33328],"58115":[0.18906,0.69141,0,0,0.32923],"58116":[0.18906,0.47534,0,0,0.50343],"58117":[0,0.69141,0,0,0.33301],"58118":[0,0.62119,0,0,0.33409],"58119":[0,0.47534,0,0,0.50073]},"Main-Bold":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0,0,0.35],"34":[0,0.69444,0,0,0.60278],"35":[0.19444,0.69444,0,0,0.95833],"36":[0.05556,0.75,0,0,0.575],"37":[0.05556,0.75,0,0,0.95833],"38":[0,0.69444,0,0,0.89444],"39":[0,0.69444,0,0,0.31944],"40":[0.25,0.75,0,0,0.44722],"41":[0.25,0.75,0,0,0.44722],"42":[0,0.75,0,0,0.575],"43":[0.13333,0.63333,0,0,0.89444],"44":[0.19444,0.15556,0,0,0.31944],"45":[0,0.44444,0,0,0.38333],"46":[0,0.15556,0,0,0.31944],"47":[0.25,0.75,0,0,0.575],"48":[0,0.64444,0,0,0.575],"49":[0,0.64444,0,0,0.575],"50":[0,0.64444,0,0,0.575],"51":[0,0.64444,0,0,0.575],"52":[0,0.64444,0,0,0.575],"53":[0,0.64444,0,0,0.575],"54":[0,0.64444,0,0,0.575],"55":[0,0.64444,0,0,0.575],"56":[0,0.64444,0,0,0.575],"57":[0,0.64444,0,0,0.575],"58":[0,0.44444,0,0,0.31944],"59":[0.19444,0.44444,0,0,0.31944],"60":[0.08556,0.58556,0,0,0.89444],"61":[-0.10889,0.39111,0,0,0.89444],"62":[0.08556,0.58556,0,0,0.89444],"63":[0,0.69444,0,0,0.54305],"64":[0,0.69444,0,0,0.89444],"65":[0,0.68611,0,0,0.86944],"66":[0,0.68611,0,0,0.81805],"67":[0,0.68611,0,0,0.83055],"68":[0,0.68611,0,0,0.88194],"69":[0,0.68611,0,0,0.75555],"70":[0,0.68611,0,0,0.72361],"71":[0,0.68611,0,0,0.90416],"72":[0,0.68611,0,0,0.9],"73":[0,0.68611,0,0,0.43611],"74":[0,0.68611,0,0,0.59444],"75":[0,0.68611,0,0,0.90138],"76":[0,0.68611,0,0,0.69166],"77":[0,0.68611,0,0,1.09166],"78":[0,0.68611,0,0,0.9],"79":[0,0.68611,0,0,0.86388],"80":[0,0.68611,0,0,0.78611],"81":[0.19444,0.68611,0,0,0.86388],"82":[0,0.68611,0,0,0.8625],"83":[0,0.68611,0,0,0.63889],"84":[0,0.68611,0,0,0.8],"85":[0,0.68611,0,0,0.88472],"86":[0,0.68611,0.01597,0,0.86944],"87":[0,0.68611,0.01597,0,1.18888],"88":[0,0.68611,0,0,0.86944],"89":[0,0.68611,0.02875,0,0.86944],"90":[0,0.68611,0,0,0.70277],"91":[0.25,0.75,0,0,0.31944],"92":[0.25,0.75,0,0,0.575],"93":[0.25,0.75,0,0,0.31944],"94":[0,0.69444,0,0,0.575],"95":[0.31,0.13444,0.03194,0,0.575],"97":[0,0.44444,0,0,0.55902],"98":[0,0.69444,0,0,0.63889],"99":[0,0.44444,0,0,0.51111],"100":[0,0.69444,0,0,0.63889],"101":[0,0.44444,0,0,0.52708],"102":[0,0.69444,0.10903,0,0.35139],"103":[0.19444,0.44444,0.01597,0,0.575],"104":[0,0.69444,0,0,0.63889],"105":[0,0.69444,0,0,0.31944],"106":[0.19444,0.69444,0,0,0.35139],"107":[0,0.69444,0,0,0.60694],"108":[0,0.69444,0,0,0.31944],"109":[0,0.44444,0,0,0.95833],"110":[0,0.44444,0,0,0.63889],"111":[0,0.44444,0,0,0.575],"112":[0.19444,0.44444,0,0,0.63889],"113":[0.19444,0.44444,0,0,0.60694],"114":[0,0.44444,0,0,0.47361],"115":[0,0.44444,0,0,0.45361],"116":[0,0.63492,0,0,0.44722],"117":[0,0.44444,0,0,0.63889],"118":[0,0.44444,0.01597,0,0.60694],"119":[0,0.44444,0.01597,0,0.83055],"120":[0,0.44444,0,0,0.60694],"121":[0.19444,0.44444,0.01597,0,0.60694],"122":[0,0.44444,0,0,0.51111],"123":[0.25,0.75,0,0,0.575],"124":[0.25,0.75,0,0,0.31944],"125":[0.25,0.75,0,0,0.575],"126":[0.35,0.34444,0,0,0.575],"160":[0,0,0,0,0.25],"163":[0,0.69444,0,0,0.86853],"168":[0,0.69444,0,0,0.575],"172":[0,0.44444,0,0,0.76666],"176":[0,0.69444,0,0,0.86944],"177":[0.13333,0.63333,0,0,0.89444],"184":[0.17014,0,0,0,0.51111],"198":[0,0.68611,0,0,1.04166],"215":[0.13333,0.63333,0,0,0.89444],"216":[0.04861,0.73472,0,0,0.89444],"223":[0,0.69444,0,0,0.59722],"230":[0,0.44444,0,0,0.83055],"247":[0.13333,0.63333,0,0,0.89444],"248":[0.09722,0.54167,0,0,0.575],"305":[0,0.44444,0,0,0.31944],"338":[0,0.68611,0,0,1.16944],"339":[0,0.44444,0,0,0.89444],"567":[0.19444,0.44444,0,0,0.35139],"710":[0,0.69444,0,0,0.575],"711":[0,0.63194,0,0,0.575],"713":[0,0.59611,0,0,0.575],"714":[0,0.69444,0,0,0.575],"715":[0,0.69444,0,0,0.575],"728":[0,0.69444,0,0,0.575],"729":[0,0.69444,0,0,0.31944],"730":[0,0.69444,0,0,0.86944],"732":[0,0.69444,0,0,0.575],"733":[0,0.69444,0,0,0.575],"915":[0,0.68611,0,0,0.69166],"916":[0,0.68611,0,0,0.95833],"920":[0,0.68611,0,0,0.89444],"923":[0,0.68611,0,0,0.80555],"926":[0,0.68611,0,0,0.76666],"928":[0,0.68611,0,0,0.9],"931":[0,0.68611,0,0,0.83055],"933":[0,0.68611,0,0,0.89444],"934":[0,0.68611,0,0,0.83055],"936":[0,0.68611,0,0,0.89444],"937":[0,0.68611,0,0,0.83055],"8211":[0,0.44444,0.03194,0,0.575],"8212":[0,0.44444,0.03194,0,1.14999],"8216":[0,0.69444,0,0,0.31944],"8217":[0,0.69444,0,0,0.31944],"8220":[0,0.69444,0,0,0.60278],"8221":[0,0.69444,0,0,0.60278],"8224":[0.19444,0.69444,0,0,0.51111],"8225":[0.19444,0.69444,0,0,0.51111],"8242":[0,0.55556,0,0,0.34444],"8407":[0,0.72444,0.15486,0,0.575],"8463":[0,0.69444,0,0,0.66759],"8465":[0,0.69444,0,0,0.83055],"8467":[0,0.69444,0,0,0.47361],"8472":[0.19444,0.44444,0,0,0.74027],"8476":[0,0.69444,0,0,0.83055],"8501":[0,0.69444,0,0,0.70277],"8592":[-0.10889,0.39111,0,0,1.14999],"8593":[0.19444,0.69444,0,0,0.575],"8594":[-0.10889,0.39111,0,0,1.14999],"8595":[0.19444,0.69444,0,0,0.575],"8596":[-0.10889,0.39111,0,0,1.14999],"8597":[0.25,0.75,0,0,0.575],"8598":[0.19444,0.69444,0,0,1.14999],"8599":[0.19444,0.69444,0,0,1.14999],"8600":[0.19444,0.69444,0,0,1.14999],"8601":[0.19444,0.69444,0,0,1.14999],"8636":[-0.10889,0.39111,0,0,1.14999],"8637":[-0.10889,0.39111,0,0,1.14999],"8640":[-0.10889,0.39111,0,0,1.14999],"8641":[-0.10889,0.39111,0,0,1.14999],"8656":[-0.10889,0.39111,0,0,1.14999],"8657":[0.19444,0.69444,0,0,0.70277],"8658":[-0.10889,0.39111,0,0,1.14999],"8659":[0.19444,0.69444,0,0,0.70277],"8660":[-0.10889,0.39111,0,0,1.14999],"8661":[0.25,0.75,0,0,0.70277],"8704":[0,0.69444,0,0,0.63889],"8706":[0,0.69444,0.06389,0,0.62847],"8707":[0,0.69444,0,0,0.63889],"8709":[0.05556,0.75,0,0,0.575],"8711":[0,0.68611,0,0,0.95833],"8712":[0.08556,0.58556,0,0,0.76666],"8715":[0.08556,0.58556,0,0,0.76666],"8722":[0.13333,0.63333,0,0,0.89444],"8723":[0.13333,0.63333,0,0,0.89444],"8725":[0.25,0.75,0,0,0.575],"8726":[0.25,0.75,0,0,0.575],"8727":[-0.02778,0.47222,0,0,0.575],"8728":[-0.02639,0.47361,0,0,0.575],"8729":[-0.02639,0.47361,0,0,0.575],"8730":[0.18,0.82,0,0,0.95833],"8733":[0,0.44444,0,0,0.89444],"8734":[0,0.44444,0,0,1.14999],"8736":[0,0.69224,0,0,0.72222],"8739":[0.25,0.75,0,0,0.31944],"8741":[0.25,0.75,0,0,0.575],"8743":[0,0.55556,0,0,0.76666],"8744":[0,0.55556,0,0,0.76666],"8745":[0,0.55556,0,0,0.76666],"8746":[0,0.55556,0,0,0.76666],"8747":[0.19444,0.69444,0.12778,0,0.56875],"8764":[-0.10889,0.39111,0,0,0.89444],"8768":[0.19444,0.69444,0,0,0.31944],"8771":[0.00222,0.50222,0,0,0.89444],"8773":[0.027,0.638,0,0,0.894],"8776":[0.02444,0.52444,0,0,0.89444],"8781":[0.00222,0.50222,0,0,0.89444],"8801":[0.00222,0.50222,0,0,0.89444],"8804":[0.19667,0.69667,0,0,0.89444],"8805":[0.19667,0.69667,0,0,0.89444],"8810":[0.08556,0.58556,0,0,1.14999],"8811":[0.08556,0.58556,0,0,1.14999],"8826":[0.08556,0.58556,0,0,0.89444],"8827":[0.08556,0.58556,0,0,0.89444],"8834":[0.08556,0.58556,0,0,0.89444],"8835":[0.08556,0.58556,0,0,0.89444],"8838":[0.19667,0.69667,0,0,0.89444],"8839":[0.19667,0.69667,0,0,0.89444],"8846":[0,0.55556,0,0,0.76666],"8849":[0.19667,0.69667,0,0,0.89444],"8850":[0.19667,0.69667,0,0,0.89444],"8851":[0,0.55556,0,0,0.76666],"8852":[0,0.55556,0,0,0.76666],"8853":[0.13333,0.63333,0,0,0.89444],"8854":[0.13333,0.63333,0,0,0.89444],"8855":[0.13333,0.63333,0,0,0.89444],"8856":[0.13333,0.63333,0,0,0.89444],"8857":[0.13333,0.63333,0,0,0.89444],"8866":[0,0.69444,0,0,0.70277],"8867":[0,0.69444,0,0,0.70277],"8868":[0,0.69444,0,0,0.89444],"8869":[0,0.69444,0,0,0.89444],"8900":[-0.02639,0.47361,0,0,0.575],"8901":[-0.02639,0.47361,0,0,0.31944],"8902":[-0.02778,0.47222,0,0,0.575],"8968":[0.25,0.75,0,0,0.51111],"8969":[0.25,0.75,0,0,0.51111],"8970":[0.25,0.75,0,0,0.51111],"8971":[0.25,0.75,0,0,0.51111],"8994":[-0.13889,0.36111,0,0,1.14999],"8995":[-0.13889,0.36111,0,0,1.14999],"9651":[0.19444,0.69444,0,0,1.02222],"9657":[-0.02778,0.47222,0,0,0.575],"9661":[0.19444,0.69444,0,0,1.02222],"9667":[-0.02778,0.47222,0,0,0.575],"9711":[0.19444,0.69444,0,0,1.14999],"9824":[0.12963,0.69444,0,0,0.89444],"9825":[0.12963,0.69444,0,0,0.89444],"9826":[0.12963,0.69444,0,0,0.89444],"9827":[0.12963,0.69444,0,0,0.89444],"9837":[0,0.75,0,0,0.44722],"9838":[0.19444,0.69444,0,0,0.44722],"9839":[0.19444,0.69444,0,0,0.44722],"10216":[0.25,0.75,0,0,0.44722],"10217":[0.25,0.75,0,0,0.44722],"10815":[0,0.68611,0,0,0.9],"10927":[0.19667,0.69667,0,0,0.89444],"10928":[0.19667,0.69667,0,0,0.89444],"57376":[0.19444,0.69444,0,0,0]},"Main-BoldItalic":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0.11417,0,0.38611],"34":[0,0.69444,0.07939,0,0.62055],"35":[0.19444,0.69444,0.06833,0,0.94444],"37":[0.05556,0.75,0.12861,0,0.94444],"38":[0,0.69444,0.08528,0,0.88555],"39":[0,0.69444,0.12945,0,0.35555],"40":[0.25,0.75,0.15806,0,0.47333],"41":[0.25,0.75,0.03306,0,0.47333],"42":[0,0.75,0.14333,0,0.59111],"43":[0.10333,0.60333,0.03306,0,0.88555],"44":[0.19444,0.14722,0,0,0.35555],"45":[0,0.44444,0.02611,0,0.41444],"46":[0,0.14722,0,0,0.35555],"47":[0.25,0.75,0.15806,0,0.59111],"48":[0,0.64444,0.13167,0,0.59111],"49":[0,0.64444,0.13167,0,0.59111],"50":[0,0.64444,0.13167,0,0.59111],"51":[0,0.64444,0.13167,0,0.59111],"52":[0.19444,0.64444,0.13167,0,0.59111],"53":[0,0.64444,0.13167,0,0.59111],"54":[0,0.64444,0.13167,0,0.59111],"55":[0.19444,0.64444,0.13167,0,0.59111],"56":[0,0.64444,0.13167,0,0.59111],"57":[0,0.64444,0.13167,0,0.59111],"58":[0,0.44444,0.06695,0,0.35555],"59":[0.19444,0.44444,0.06695,0,0.35555],"61":[-0.10889,0.39111,0.06833,0,0.88555],"63":[0,0.69444,0.11472,0,0.59111],"64":[0,0.69444,0.09208,0,0.88555],"65":[0,0.68611,0,0,0.86555],"66":[0,0.68611,0.0992,0,0.81666],"67":[0,0.68611,0.14208,0,0.82666],"68":[0,0.68611,0.09062,0,0.87555],"69":[0,0.68611,0.11431,0,0.75666],"70":[0,0.68611,0.12903,0,0.72722],"71":[0,0.68611,0.07347,0,0.89527],"72":[0,0.68611,0.17208,0,0.8961],"73":[0,0.68611,0.15681,0,0.47166],"74":[0,0.68611,0.145,0,0.61055],"75":[0,0.68611,0.14208,0,0.89499],"76":[0,0.68611,0,0,0.69777],"77":[0,0.68611,0.17208,0,1.07277],"78":[0,0.68611,0.17208,0,0.8961],"79":[0,0.68611,0.09062,0,0.85499],"80":[0,0.68611,0.0992,0,0.78721],"81":[0.19444,0.68611,0.09062,0,0.85499],"82":[0,0.68611,0.02559,0,0.85944],"83":[0,0.68611,0.11264,0,0.64999],"84":[0,0.68611,0.12903,0,0.7961],"85":[0,0.68611,0.17208,0,0.88083],"86":[0,0.68611,0.18625,0,0.86555],"87":[0,0.68611,0.18625,0,1.15999],"88":[0,0.68611,0.15681,0,0.86555],"89":[0,0.68611,0.19803,0,0.86555],"90":[0,0.68611,0.14208,0,0.70888],"91":[0.25,0.75,0.1875,0,0.35611],"93":[0.25,0.75,0.09972,0,0.35611],"94":[0,0.69444,0.06709,0,0.59111],"95":[0.31,0.13444,0.09811,0,0.59111],"97":[0,0.44444,0.09426,0,0.59111],"98":[0,0.69444,0.07861,0,0.53222],"99":[0,0.44444,0.05222,0,0.53222],"100":[0,0.69444,0.10861,0,0.59111],"101":[0,0.44444,0.085,0,0.53222],"102":[0.19444,0.69444,0.21778,0,0.4],"103":[0.19444,0.44444,0.105,0,0.53222],"104":[0,0.69444,0.09426,0,0.59111],"105":[0,0.69326,0.11387,0,0.35555],"106":[0.19444,0.69326,0.1672,0,0.35555],"107":[0,0.69444,0.11111,0,0.53222],"108":[0,0.69444,0.10861,0,0.29666],"109":[0,0.44444,0.09426,0,0.94444],"110":[0,0.44444,0.09426,0,0.64999],"111":[0,0.44444,0.07861,0,0.59111],"112":[0.19444,0.44444,0.07861,0,0.59111],"113":[0.19444,0.44444,0.105,0,0.53222],"114":[0,0.44444,0.11111,0,0.50167],"115":[0,0.44444,0.08167,0,0.48694],"116":[0,0.63492,0.09639,0,0.385],"117":[0,0.44444,0.09426,0,0.62055],"118":[0,0.44444,0.11111,0,0.53222],"119":[0,0.44444,0.11111,0,0.76777],"120":[0,0.44444,0.12583,0,0.56055],"121":[0.19444,0.44444,0.105,0,0.56166],"122":[0,0.44444,0.13889,0,0.49055],"126":[0.35,0.34444,0.11472,0,0.59111],"160":[0,0,0,0,0.25],"168":[0,0.69444,0.11473,0,0.59111],"176":[0,0.69444,0,0,0.94888],"184":[0.17014,0,0,0,0.53222],"198":[0,0.68611,0.11431,0,1.02277],"216":[0.04861,0.73472,0.09062,0,0.88555],"223":[0.19444,0.69444,0.09736,0,0.665],"230":[0,0.44444,0.085,0,0.82666],"248":[0.09722,0.54167,0.09458,0,0.59111],"305":[0,0.44444,0.09426,0,0.35555],"338":[0,0.68611,0.11431,0,1.14054],"339":[0,0.44444,0.085,0,0.82666],"567":[0.19444,0.44444,0.04611,0,0.385],"710":[0,0.69444,0.06709,0,0.59111],"711":[0,0.63194,0.08271,0,0.59111],"713":[0,0.59444,0.10444,0,0.59111],"714":[0,0.69444,0.08528,0,0.59111],"715":[0,0.69444,0,0,0.59111],"728":[0,0.69444,0.10333,0,0.59111],"729":[0,0.69444,0.12945,0,0.35555],"730":[0,0.69444,0,0,0.94888],"732":[0,0.69444,0.11472,0,0.59111],"733":[0,0.69444,0.11472,0,0.59111],"915":[0,0.68611,0.12903,0,0.69777],"916":[0,0.68611,0,0,0.94444],"920":[0,0.68611,0.09062,0,0.88555],"923":[0,0.68611,0,0,0.80666],"926":[0,0.68611,0.15092,0,0.76777],"928":[0,0.68611,0.17208,0,0.8961],"931":[0,0.68611,0.11431,0,0.82666],"933":[0,0.68611,0.10778,0,0.88555],"934":[0,0.68611,0.05632,0,0.82666],"936":[0,0.68611,0.10778,0,0.88555],"937":[0,0.68611,0.0992,0,0.82666],"8211":[0,0.44444,0.09811,0,0.59111],"8212":[0,0.44444,0.09811,0,1.18221],"8216":[0,0.69444,0.12945,0,0.35555],"8217":[0,0.69444,0.12945,0,0.35555],"8220":[0,0.69444,0.16772,0,0.62055],"8221":[0,0.69444,0.07939,0,0.62055]},"Main-Italic":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0.12417,0,0.30667],"34":[0,0.69444,0.06961,0,0.51444],"35":[0.19444,0.69444,0.06616,0,0.81777],"37":[0.05556,0.75,0.13639,0,0.81777],"38":[0,0.69444,0.09694,0,0.76666],"39":[0,0.69444,0.12417,0,0.30667],"40":[0.25,0.75,0.16194,0,0.40889],"41":[0.25,0.75,0.03694,0,0.40889],"42":[0,0.75,0.14917,0,0.51111],"43":[0.05667,0.56167,0.03694,0,0.76666],"44":[0.19444,0.10556,0,0,0.30667],"45":[0,0.43056,0.02826,0,0.35778],"46":[0,0.10556,0,0,0.30667],"47":[0.25,0.75,0.16194,0,0.51111],"48":[0,0.64444,0.13556,0,0.51111],"49":[0,0.64444,0.13556,0,0.51111],"50":[0,0.64444,0.13556,0,0.51111],"51":[0,0.64444,0.13556,0,0.51111],"52":[0.19444,0.64444,0.13556,0,0.51111],"53":[0,0.64444,0.13556,0,0.51111],"54":[0,0.64444,0.13556,0,0.51111],"55":[0.19444,0.64444,0.13556,0,0.51111],"56":[0,0.64444,0.13556,0,0.51111],"57":[0,0.64444,0.13556,0,0.51111],"58":[0,0.43056,0.0582,0,0.30667],"59":[0.19444,0.43056,0.0582,0,0.30667],"61":[-0.13313,0.36687,0.06616,0,0.76666],"63":[0,0.69444,0.1225,0,0.51111],"64":[0,0.69444,0.09597,0,0.76666],"65":[0,0.68333,0,0,0.74333],"66":[0,0.68333,0.10257,0,0.70389],"67":[0,0.68333,0.14528,0,0.71555],"68":[0,0.68333,0.09403,0,0.755],"69":[0,0.68333,0.12028,0,0.67833],"70":[0,0.68333,0.13305,0,0.65277],"71":[0,0.68333,0.08722,0,0.77361],"72":[0,0.68333,0.16389,0,0.74333],"73":[0,0.68333,0.15806,0,0.38555],"74":[0,0.68333,0.14028,0,0.525],"75":[0,0.68333,0.14528,0,0.76888],"76":[0,0.68333,0,0,0.62722],"77":[0,0.68333,0.16389,0,0.89666],"78":[0,0.68333,0.16389,0,0.74333],"79":[0,0.68333,0.09403,0,0.76666],"80":[0,0.68333,0.10257,0,0.67833],"81":[0.19444,0.68333,0.09403,0,0.76666],"82":[0,0.68333,0.03868,0,0.72944],"83":[0,0.68333,0.11972,0,0.56222],"84":[0,0.68333,0.13305,0,0.71555],"85":[0,0.68333,0.16389,0,0.74333],"86":[0,0.68333,0.18361,0,0.74333],"87":[0,0.68333,0.18361,0,0.99888],"88":[0,0.68333,0.15806,0,0.74333],"89":[0,0.68333,0.19383,0,0.74333],"90":[0,0.68333,0.14528,0,0.61333],"91":[0.25,0.75,0.1875,0,0.30667],"93":[0.25,0.75,0.10528,0,0.30667],"94":[0,0.69444,0.06646,0,0.51111],"95":[0.31,0.12056,0.09208,0,0.51111],"97":[0,0.43056,0.07671,0,0.51111],"98":[0,0.69444,0.06312,0,0.46],"99":[0,0.43056,0.05653,0,0.46],"100":[0,0.69444,0.10333,0,0.51111],"101":[0,0.43056,0.07514,0,0.46],"102":[0.19444,0.69444,0.21194,0,0.30667],"103":[0.19444,0.43056,0.08847,0,0.46],"104":[0,0.69444,0.07671,0,0.51111],"105":[0,0.65536,0.1019,0,0.30667],"106":[0.19444,0.65536,0.14467,0,0.30667],"107":[0,0.69444,0.10764,0,0.46],"108":[0,0.69444,0.10333,0,0.25555],"109":[0,0.43056,0.07671,0,0.81777],"110":[0,0.43056,0.07671,0,0.56222],"111":[0,0.43056,0.06312,0,0.51111],"112":[0.19444,0.43056,0.06312,0,0.51111],"113":[0.19444,0.43056,0.08847,0,0.46],"114":[0,0.43056,0.10764,0,0.42166],"115":[0,0.43056,0.08208,0,0.40889],"116":[0,0.61508,0.09486,0,0.33222],"117":[0,0.43056,0.07671,0,0.53666],"118":[0,0.43056,0.10764,0,0.46],"119":[0,0.43056,0.10764,0,0.66444],"120":[0,0.43056,0.12042,0,0.46389],"121":[0.19444,0.43056,0.08847,0,0.48555],"122":[0,0.43056,0.12292,0,0.40889],"126":[0.35,0.31786,0.11585,0,0.51111],"160":[0,0,0,0,0.25],"168":[0,0.66786,0.10474,0,0.51111],"176":[0,0.69444,0,0,0.83129],"184":[0.17014,0,0,0,0.46],"198":[0,0.68333,0.12028,0,0.88277],"216":[0.04861,0.73194,0.09403,0,0.76666],"223":[0.19444,0.69444,0.10514,0,0.53666],"230":[0,0.43056,0.07514,0,0.71555],"248":[0.09722,0.52778,0.09194,0,0.51111],"338":[0,0.68333,0.12028,0,0.98499],"339":[0,0.43056,0.07514,0,0.71555],"710":[0,0.69444,0.06646,0,0.51111],"711":[0,0.62847,0.08295,0,0.51111],"713":[0,0.56167,0.10333,0,0.51111],"714":[0,0.69444,0.09694,0,0.51111],"715":[0,0.69444,0,0,0.51111],"728":[0,0.69444,0.10806,0,0.51111],"729":[0,0.66786,0.11752,0,0.30667],"730":[0,0.69444,0,0,0.83129],"732":[0,0.66786,0.11585,0,0.51111],"733":[0,0.69444,0.1225,0,0.51111],"915":[0,0.68333,0.13305,0,0.62722],"916":[0,0.68333,0,0,0.81777],"920":[0,0.68333,0.09403,0,0.76666],"923":[0,0.68333,0,0,0.69222],"926":[0,0.68333,0.15294,0,0.66444],"928":[0,0.68333,0.16389,0,0.74333],"931":[0,0.68333,0.12028,0,0.71555],"933":[0,0.68333,0.11111,0,0.76666],"934":[0,0.68333,0.05986,0,0.71555],"936":[0,0.68333,0.11111,0,0.76666],"937":[0,0.68333,0.10257,0,0.71555],"8211":[0,0.43056,0.09208,0,0.51111],"8212":[0,0.43056,0.09208,0,1.02222],"8216":[0,0.69444,0.12417,0,0.30667],"8217":[0,0.69444,0.12417,0,0.30667],"8220":[0,0.69444,0.1685,0,0.51444],"8221":[0,0.69444,0.06961,0,0.51444],"8463":[0,0.68889,0,0,0.54028]},"Main-Regular":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0,0,0.27778],"34":[0,0.69444,0,0,0.5],"35":[0.19444,0.69444,0,0,0.83334],"36":[0.05556,0.75,0,0,0.5],"37":[0.05556,0.75,0,0,0.83334],"38":[0,0.69444,0,0,0.77778],"39":[0,0.69444,0,0,0.27778],"40":[0.25,0.75,0,0,0.38889],"41":[0.25,0.75,0,0,0.38889],"42":[0,0.75,0,0,0.5],"43":[0.08333,0.58333,0,0,0.77778],"44":[0.19444,0.10556,0,0,0.27778],"45":[0,0.43056,0,0,0.33333],"46":[0,0.10556,0,0,0.27778],"47":[0.25,0.75,0,0,0.5],"48":[0,0.64444,0,0,0.5],"49":[0,0.64444,0,0,0.5],"50":[0,0.64444,0,0,0.5],"51":[0,0.64444,0,0,0.5],"52":[0,0.64444,0,0,0.5],"53":[0,0.64444,0,0,0.5],"54":[0,0.64444,0,0,0.5],"55":[0,0.64444,0,0,0.5],"56":[0,0.64444,0,0,0.5],"57":[0,0.64444,0,0,0.5],"58":[0,0.43056,0,0,0.27778],"59":[0.19444,0.43056,0,0,0.27778],"60":[0.0391,0.5391,0,0,0.77778],"61":[-0.13313,0.36687,0,0,0.77778],"62":[0.0391,0.5391,0,0,0.77778],"63":[0,0.69444,0,0,0.47222],"64":[0,0.69444,0,0,0.77778],"65":[0,0.68333,0,0,0.75],"66":[0,0.68333,0,0,0.70834],"67":[0,0.68333,0,0,0.72222],"68":[0,0.68333,0,0,0.76389],"69":[0,0.68333,0,0,0.68056],"70":[0,0.68333,0,0,0.65278],"71":[0,0.68333,0,0,0.78472],"72":[0,0.68333,0,0,0.75],"73":[0,0.68333,0,0,0.36111],"74":[0,0.68333,0,0,0.51389],"75":[0,0.68333,0,0,0.77778],"76":[0,0.68333,0,0,0.625],"77":[0,0.68333,0,0,0.91667],"78":[0,0.68333,0,0,0.75],"79":[0,0.68333,0,0,0.77778],"80":[0,0.68333,0,0,0.68056],"81":[0.19444,0.68333,0,0,0.77778],"82":[0,0.68333,0,0,0.73611],"83":[0,0.68333,0,0,0.55556],"84":[0,0.68333,0,0,0.72222],"85":[0,0.68333,0,0,0.75],"86":[0,0.68333,0.01389,0,0.75],"87":[0,0.68333,0.01389,0,1.02778],"88":[0,0.68333,0,0,0.75],"89":[0,0.68333,0.025,0,0.75],"90":[0,0.68333,0,0,0.61111],"91":[0.25,0.75,0,0,0.27778],"92":[0.25,0.75,0,0,0.5],"93":[0.25,0.75,0,0,0.27778],"94":[0,0.69444,0,0,0.5],"95":[0.31,0.12056,0.02778,0,0.5],"97":[0,0.43056,0,0,0.5],"98":[0,0.69444,0,0,0.55556],"99":[0,0.43056,0,0,0.44445],"100":[0,0.69444,0,0,0.55556],"101":[0,0.43056,0,0,0.44445],"102":[0,0.69444,0.07778,0,0.30556],"103":[0.19444,0.43056,0.01389,0,0.5],"104":[0,0.69444,0,0,0.55556],"105":[0,0.66786,0,0,0.27778],"106":[0.19444,0.66786,0,0,0.30556],"107":[0,0.69444,0,0,0.52778],"108":[0,0.69444,0,0,0.27778],"109":[0,0.43056,0,0,0.83334],"110":[0,0.43056,0,0,0.55556],"111":[0,0.43056,0,0,0.5],"112":[0.19444,0.43056,0,0,0.55556],"113":[0.19444,0.43056,0,0,0.52778],"114":[0,0.43056,0,0,0.39167],"115":[0,0.43056,0,0,0.39445],"116":[0,0.61508,0,0,0.38889],"117":[0,0.43056,0,0,0.55556],"118":[0,0.43056,0.01389,0,0.52778],"119":[0,0.43056,0.01389,0,0.72222],"120":[0,0.43056,0,0,0.52778],"121":[0.19444,0.43056,0.01389,0,0.52778],"122":[0,0.43056,0,0,0.44445],"123":[0.25,0.75,0,0,0.5],"124":[0.25,0.75,0,0,0.27778],"125":[0.25,0.75,0,0,0.5],"126":[0.35,0.31786,0,0,0.5],"160":[0,0,0,0,0.25],"163":[0,0.69444,0,0,0.76909],"167":[0.19444,0.69444,0,0,0.44445],"168":[0,0.66786,0,0,0.5],"172":[0,0.43056,0,0,0.66667],"176":[0,0.69444,0,0,0.75],"177":[0.08333,0.58333,0,0,0.77778],"182":[0.19444,0.69444,0,0,0.61111],"184":[0.17014,0,0,0,0.44445],"198":[0,0.68333,0,0,0.90278],"215":[0.08333,0.58333,0,0,0.77778],"216":[0.04861,0.73194,0,0,0.77778],"223":[0,0.69444,0,0,0.5],"230":[0,0.43056,0,0,0.72222],"247":[0.08333,0.58333,0,0,0.77778],"248":[0.09722,0.52778,0,0,0.5],"305":[0,0.43056,0,0,0.27778],"338":[0,0.68333,0,0,1.01389],"339":[0,0.43056,0,0,0.77778],"567":[0.19444,0.43056,0,0,0.30556],"710":[0,0.69444,0,0,0.5],"711":[0,0.62847,0,0,0.5],"713":[0,0.56778,0,0,0.5],"714":[0,0.69444,0,0,0.5],"715":[0,0.69444,0,0,0.5],"728":[0,0.69444,0,0,0.5],"729":[0,0.66786,0,0,0.27778],"730":[0,0.69444,0,0,0.75],"732":[0,0.66786,0,0,0.5],"733":[0,0.69444,0,0,0.5],"915":[0,0.68333,0,0,0.625],"916":[0,0.68333,0,0,0.83334],"920":[0,0.68333,0,0,0.77778],"923":[0,0.68333,0,0,0.69445],"926":[0,0.68333,0,0,0.66667],"928":[0,0.68333,0,0,0.75],"931":[0,0.68333,0,0,0.72222],"933":[0,0.68333,0,0,0.77778],"934":[0,0.68333,0,0,0.72222],"936":[0,0.68333,0,0,0.77778],"937":[0,0.68333,0,0,0.72222],"8211":[0,0.43056,0.02778,0,0.5],"8212":[0,0.43056,0.02778,0,1.0],"8216":[0,0.69444,0,0,0.27778],"8217":[0,0.69444,0,0,0.27778],"8220":[0,0.69444,0,0,0.5],"8221":[0,0.69444,0,0,0.5],"8224":[0.19444,0.69444,0,0,0.44445],"8225":[0.19444,0.69444,0,0,0.44445],"8230":[0,0.123,0,0,1.172],"8242":[0,0.55556,0,0,0.275],"8407":[0,0.71444,0.15382,0,0.5],"8463":[0,0.68889,0,0,0.54028],"8465":[0,0.69444,0,0,0.72222],"8467":[0,0.69444,0,0.11111,0.41667],"8472":[0.19444,0.43056,0,0.11111,0.63646],"8476":[0,0.69444,0,0,0.72222],"8501":[0,0.69444,0,0,0.61111],"8592":[-0.13313,0.36687,0,0,1.0],"8593":[0.19444,0.69444,0,0,0.5],"8594":[-0.13313,0.36687,0,0,1.0],"8595":[0.19444,0.69444,0,0,0.5],"8596":[-0.13313,0.36687,0,0,1.0],"8597":[0.25,0.75,0,0,0.5],"8598":[0.19444,0.69444,0,0,1.0],"8599":[0.19444,0.69444,0,0,1.0],"8600":[0.19444,0.69444,0,0,1.0],"8601":[0.19444,0.69444,0,0,1.0],"8614":[0.011,0.511,0,0,1.0],"8617":[0.011,0.511,0,0,1.126],"8618":[0.011,0.511,0,0,1.126],"8636":[-0.13313,0.36687,0,0,1.0],"8637":[-0.13313,0.36687,0,0,1.0],"8640":[-0.13313,0.36687,0,0,1.0],"8641":[-0.13313,0.36687,0,0,1.0],"8652":[0.011,0.671,0,0,1.0],"8656":[-0.13313,0.36687,0,0,1.0],"8657":[0.19444,0.69444,0,0,0.61111],"8658":[-0.13313,0.36687,0,0,1.0],"8659":[0.19444,0.69444,0,0,0.61111],"8660":[-0.13313,0.36687,0,0,1.0],"8661":[0.25,0.75,0,0,0.61111],"8704":[0,0.69444,0,0,0.55556],"8706":[0,0.69444,0.05556,0.08334,0.5309],"8707":[0,0.69444,0,0,0.55556],"8709":[0.05556,0.75,0,0,0.5],"8711":[0,0.68333,0,0,0.83334],"8712":[0.0391,0.5391,0,0,0.66667],"8715":[0.0391,0.5391,0,0,0.66667],"8722":[0.08333,0.58333,0,0,0.77778],"8723":[0.08333,0.58333,0,0,0.77778],"8725":[0.25,0.75,0,0,0.5],"8726":[0.25,0.75,0,0,0.5],"8727":[-0.03472,0.46528,0,0,0.5],"8728":[-0.05555,0.44445,0,0,0.5],"8729":[-0.05555,0.44445,0,0,0.5],"8730":[0.2,0.8,0,0,0.83334],"8733":[0,0.43056,0,0,0.77778],"8734":[0,0.43056,0,0,1.0],"8736":[0,0.69224,0,0,0.72222],"8739":[0.25,0.75,0,0,0.27778],"8741":[0.25,0.75,0,0,0.5],"8743":[0,0.55556,0,0,0.66667],"8744":[0,0.55556,0,0,0.66667],"8745":[0,0.55556,0,0,0.66667],"8746":[0,0.55556,0,0,0.66667],"8747":[0.19444,0.69444,0.11111,0,0.41667],"8764":[-0.13313,0.36687,0,0,0.77778],"8768":[0.19444,0.69444,0,0,0.27778],"8771":[-0.03625,0.46375,0,0,0.77778],"8773":[-0.022,0.589,0,0,0.778],"8776":[-0.01688,0.48312,0,0,0.77778],"8781":[-0.03625,0.46375,0,0,0.77778],"8784":[-0.133,0.673,0,0,0.778],"8801":[-0.03625,0.46375,0,0,0.77778],"8804":[0.13597,0.63597,0,0,0.77778],"8805":[0.13597,0.63597,0,0,0.77778],"8810":[0.0391,0.5391,0,0,1.0],"8811":[0.0391,0.5391,0,0,1.0],"8826":[0.0391,0.5391,0,0,0.77778],"8827":[0.0391,0.5391,0,0,0.77778],"8834":[0.0391,0.5391,0,0,0.77778],"8835":[0.0391,0.5391,0,0,0.77778],"8838":[0.13597,0.63597,0,0,0.77778],"8839":[0.13597,0.63597,0,0,0.77778],"8846":[0,0.55556,0,0,0.66667],"8849":[0.13597,0.63597,0,0,0.77778],"8850":[0.13597,0.63597,0,0,0.77778],"8851":[0,0.55556,0,0,0.66667],"8852":[0,0.55556,0,0,0.66667],"8853":[0.08333,0.58333,0,0,0.77778],"8854":[0.08333,0.58333,0,0,0.77778],"8855":[0.08333,0.58333,0,0,0.77778],"8856":[0.08333,0.58333,0,0,0.77778],"8857":[0.08333,0.58333,0,0,0.77778],"8866":[0,0.69444,0,0,0.61111],"8867":[0,0.69444,0,0,0.61111],"8868":[0,0.69444,0,0,0.77778],"8869":[0,0.69444,0,0,0.77778],"8872":[0.249,0.75,0,0,0.867],"8900":[-0.05555,0.44445,0,0,0.5],"8901":[-0.05555,0.44445,0,0,0.27778],"8902":[-0.03472,0.46528,0,0,0.5],"8904":[0.005,0.505,0,0,0.9],"8942":[0.03,0.903,0,0,0.278],"8943":[-0.19,0.313,0,0,1.172],"8945":[-0.1,0.823,0,0,1.282],"8968":[0.25,0.75,0,0,0.44445],"8969":[0.25,0.75,0,0,0.44445],"8970":[0.25,0.75,0,0,0.44445],"8971":[0.25,0.75,0,0,0.44445],"8994":[-0.14236,0.35764,0,0,1.0],"8995":[-0.14236,0.35764,0,0,1.0],"9136":[0.244,0.744,0,0,0.412],"9137":[0.244,0.745,0,0,0.412],"9651":[0.19444,0.69444,0,0,0.88889],"9657":[-0.03472,0.46528,0,0,0.5],"9661":[0.19444,0.69444,0,0,0.88889],"9667":[-0.03472,0.46528,0,0,0.5],"9711":[0.19444,0.69444,0,0,1.0],"9824":[0.12963,0.69444,0,0,0.77778],"9825":[0.12963,0.69444,0,0,0.77778],"9826":[0.12963,0.69444,0,0,0.77778],"9827":[0.12963,0.69444,0,0,0.77778],"9837":[0,0.75,0,0,0.38889],"9838":[0.19444,0.69444,0,0,0.38889],"9839":[0.19444,0.69444,0,0,0.38889],"10216":[0.25,0.75,0,0,0.38889],"10217":[0.25,0.75,0,0,0.38889],"10222":[0.244,0.744,0,0,0.412],"10223":[0.244,0.745,0,0,0.412],"10229":[0.011,0.511,0,0,1.609],"10230":[0.011,0.511,0,0,1.638],"10231":[0.011,0.511,0,0,1.859],"10232":[0.024,0.525,0,0,1.609],"10233":[0.024,0.525,0,0,1.638],"10234":[0.024,0.525,0,0,1.858],"10236":[0.011,0.511,0,0,1.638],"10815":[0,0.68333,0,0,0.75],"10927":[0.13597,0.63597,0,0,0.77778],"10928":[0.13597,0.63597,0,0,0.77778],"57376":[0.19444,0.69444,0,0,0]},"Math-BoldItalic":{"32":[0,0,0,0,0.25],"48":[0,0.44444,0,0,0.575],"49":[0,0.44444,0,0,0.575],"50":[0,0.44444,0,0,0.575],"51":[0.19444,0.44444,0,0,0.575],"52":[0.19444,0.44444,0,0,0.575],"53":[0.19444,0.44444,0,0,0.575],"54":[0,0.64444,0,0,0.575],"55":[0.19444,0.44444,0,0,0.575],"56":[0,0.64444,0,0,0.575],"57":[0.19444,0.44444,0,0,0.575],"65":[0,0.68611,0,0,0.86944],"66":[0,0.68611,0.04835,0,0.8664],"67":[0,0.68611,0.06979,0,0.81694],"68":[0,0.68611,0.03194,0,0.93812],"69":[0,0.68611,0.05451,0,0.81007],"70":[0,0.68611,0.15972,0,0.68889],"71":[0,0.68611,0,0,0.88673],"72":[0,0.68611,0.08229,0,0.98229],"73":[0,0.68611,0.07778,0,0.51111],"74":[0,0.68611,0.10069,0,0.63125],"75":[0,0.68611,0.06979,0,0.97118],"76":[0,0.68611,0,0,0.75555],"77":[0,0.68611,0.11424,0,1.14201],"78":[0,0.68611,0.11424,0,0.95034],"79":[0,0.68611,0.03194,0,0.83666],"80":[0,0.68611,0.15972,0,0.72309],"81":[0.19444,0.68611,0,0,0.86861],"82":[0,0.68611,0.00421,0,0.87235],"83":[0,0.68611,0.05382,0,0.69271],"84":[0,0.68611,0.15972,0,0.63663],"85":[0,0.68611,0.11424,0,0.80027],"86":[0,0.68611,0.25555,0,0.67778],"87":[0,0.68611,0.15972,0,1.09305],"88":[0,0.68611,0.07778,0,0.94722],"89":[0,0.68611,0.25555,0,0.67458],"90":[0,0.68611,0.06979,0,0.77257],"97":[0,0.44444,0,0,0.63287],"98":[0,0.69444,0,0,0.52083],"99":[0,0.44444,0,0,0.51342],"100":[0,0.69444,0,0,0.60972],"101":[0,0.44444,0,0,0.55361],"102":[0.19444,0.69444,0.11042,0,0.56806],"103":[0.19444,0.44444,0.03704,0,0.5449],"104":[0,0.69444,0,0,0.66759],"105":[0,0.69326,0,0,0.4048],"106":[0.19444,0.69326,0.0622,0,0.47083],"107":[0,0.69444,0.01852,0,0.6037],"108":[0,0.69444,0.0088,0,0.34815],"109":[0,0.44444,0,0,1.0324],"110":[0,0.44444,0,0,0.71296],"111":[0,0.44444,0,0,0.58472],"112":[0.19444,0.44444,0,0,0.60092],"113":[0.19444,0.44444,0.03704,0,0.54213],"114":[0,0.44444,0.03194,0,0.5287],"115":[0,0.44444,0,0,0.53125],"116":[0,0.63492,0,0,0.41528],"117":[0,0.44444,0,0,0.68102],"118":[0,0.44444,0.03704,0,0.56666],"119":[0,0.44444,0.02778,0,0.83148],"120":[0,0.44444,0,0,0.65903],"121":[0.19444,0.44444,0.03704,0,0.59028],"122":[0,0.44444,0.04213,0,0.55509],"160":[0,0,0,0,0.25],"915":[0,0.68611,0.15972,0,0.65694],"916":[0,0.68611,0,0,0.95833],"920":[0,0.68611,0.03194,0,0.86722],"923":[0,0.68611,0,0,0.80555],"926":[0,0.68611,0.07458,0,0.84125],"928":[0,0.68611,0.08229,0,0.98229],"931":[0,0.68611,0.05451,0,0.88507],"933":[0,0.68611,0.15972,0,0.67083],"934":[0,0.68611,0,0,0.76666],"936":[0,0.68611,0.11653,0,0.71402],"937":[0,0.68611,0.04835,0,0.8789],"945":[0,0.44444,0,0,0.76064],"946":[0.19444,0.69444,0.03403,0,0.65972],"947":[0.19444,0.44444,0.06389,0,0.59003],"948":[0,0.69444,0.03819,0,0.52222],"949":[0,0.44444,0,0,0.52882],"950":[0.19444,0.69444,0.06215,0,0.50833],"951":[0.19444,0.44444,0.03704,0,0.6],"952":[0,0.69444,0.03194,0,0.5618],"953":[0,0.44444,0,0,0.41204],"954":[0,0.44444,0,0,0.66759],"955":[0,0.69444,0,0,0.67083],"956":[0.19444,0.44444,0,0,0.70787],"957":[0,0.44444,0.06898,0,0.57685],"958":[0.19444,0.69444,0.03021,0,0.50833],"959":[0,0.44444,0,0,0.58472],"960":[0,0.44444,0.03704,0,0.68241],"961":[0.19444,0.44444,0,0,0.6118],"962":[0.09722,0.44444,0.07917,0,0.42361],"963":[0,0.44444,0.03704,0,0.68588],"964":[0,0.44444,0.13472,0,0.52083],"965":[0,0.44444,0.03704,0,0.63055],"966":[0.19444,0.44444,0,0,0.74722],"967":[0.19444,0.44444,0,0,0.71805],"968":[0.19444,0.69444,0.03704,0,0.75833],"969":[0,0.44444,0.03704,0,0.71782],"977":[0,0.69444,0,0,0.69155],"981":[0.19444,0.69444,0,0,0.7125],"982":[0,0.44444,0.03194,0,0.975],"1009":[0.19444,0.44444,0,0,0.6118],"1013":[0,0.44444,0,0,0.48333],"57649":[0,0.44444,0,0,0.39352],"57911":[0.19444,0.44444,0,0,0.43889]},"Math-Italic":{"32":[0,0,0,0,0.25],"48":[0,0.43056,0,0,0.5],"49":[0,0.43056,0,0,0.5],"50":[0,0.43056,0,0,0.5],"51":[0.19444,0.43056,0,0,0.5],"52":[0.19444,0.43056,0,0,0.5],"53":[0.19444,0.43056,0,0,0.5],"54":[0,0.64444,0,0,0.5],"55":[0.19444,0.43056,0,0,0.5],"56":[0,0.64444,0,0,0.5],"57":[0.19444,0.43056,0,0,0.5],"65":[0,0.68333,0,0.13889,0.75],"66":[0,0.68333,0.05017,0.08334,0.75851],"67":[0,0.68333,0.07153,0.08334,0.71472],"68":[0,0.68333,0.02778,0.05556,0.82792],"69":[0,0.68333,0.05764,0.08334,0.7382],"70":[0,0.68333,0.13889,0.08334,0.64306],"71":[0,0.68333,0,0.08334,0.78625],"72":[0,0.68333,0.08125,0.05556,0.83125],"73":[0,0.68333,0.07847,0.11111,0.43958],"74":[0,0.68333,0.09618,0.16667,0.55451],"75":[0,0.68333,0.07153,0.05556,0.84931],"76":[0,0.68333,0,0.02778,0.68056],"77":[0,0.68333,0.10903,0.08334,0.97014],"78":[0,0.68333,0.10903,0.08334,0.80347],"79":[0,0.68333,0.02778,0.08334,0.76278],"80":[0,0.68333,0.13889,0.08334,0.64201],"81":[0.19444,0.68333,0,0.08334,0.79056],"82":[0,0.68333,0.00773,0.08334,0.75929],"83":[0,0.68333,0.05764,0.08334,0.6132],"84":[0,0.68333,0.13889,0.08334,0.58438],"85":[0,0.68333,0.10903,0.02778,0.68278],"86":[0,0.68333,0.22222,0,0.58333],"87":[0,0.68333,0.13889,0,0.94445],"88":[0,0.68333,0.07847,0.08334,0.82847],"89":[0,0.68333,0.22222,0,0.58056],"90":[0,0.68333,0.07153,0.08334,0.68264],"97":[0,0.43056,0,0,0.52859],"98":[0,0.69444,0,0,0.42917],"99":[0,0.43056,0,0.05556,0.43276],"100":[0,0.69444,0,0.16667,0.52049],"101":[0,0.43056,0,0.05556,0.46563],"102":[0.19444,0.69444,0.10764,0.16667,0.48959],"103":[0.19444,0.43056,0.03588,0.02778,0.47697],"104":[0,0.69444,0,0,0.57616],"105":[0,0.65952,0,0,0.34451],"106":[0.19444,0.65952,0.05724,0,0.41181],"107":[0,0.69444,0.03148,0,0.5206],"108":[0,0.69444,0.01968,0.08334,0.29838],"109":[0,0.43056,0,0,0.87801],"110":[0,0.43056,0,0,0.60023],"111":[0,0.43056,0,0.05556,0.48472],"112":[0.19444,0.43056,0,0.08334,0.50313],"113":[0.19444,0.43056,0.03588,0.08334,0.44641],"114":[0,0.43056,0.02778,0.05556,0.45116],"115":[0,0.43056,0,0.05556,0.46875],"116":[0,0.61508,0,0.08334,0.36111],"117":[0,0.43056,0,0.02778,0.57246],"118":[0,0.43056,0.03588,0.02778,0.48472],"119":[0,0.43056,0.02691,0.08334,0.71592],"120":[0,0.43056,0,0.02778,0.57153],"121":[0.19444,0.43056,0.03588,0.05556,0.49028],"122":[0,0.43056,0.04398,0.05556,0.46505],"160":[0,0,0,0,0.25],"915":[0,0.68333,0.13889,0.08334,0.61528],"916":[0,0.68333,0,0.16667,0.83334],"920":[0,0.68333,0.02778,0.08334,0.76278],"923":[0,0.68333,0,0.16667,0.69445],"926":[0,0.68333,0.07569,0.08334,0.74236],"928":[0,0.68333,0.08125,0.05556,0.83125],"931":[0,0.68333,0.05764,0.08334,0.77986],"933":[0,0.68333,0.13889,0.05556,0.58333],"934":[0,0.68333,0,0.08334,0.66667],"936":[0,0.68333,0.11,0.05556,0.61222],"937":[0,0.68333,0.05017,0.08334,0.7724],"945":[0,0.43056,0.0037,0.02778,0.6397],"946":[0.19444,0.69444,0.05278,0.08334,0.56563],"947":[0.19444,0.43056,0.05556,0,0.51773],"948":[0,0.69444,0.03785,0.05556,0.44444],"949":[0,0.43056,0,0.08334,0.46632],"950":[0.19444,0.69444,0.07378,0.08334,0.4375],"951":[0.19444,0.43056,0.03588,0.05556,0.49653],"952":[0,0.69444,0.02778,0.08334,0.46944],"953":[0,0.43056,0,0.05556,0.35394],"954":[0,0.43056,0,0,0.57616],"955":[0,0.69444,0,0,0.58334],"956":[0.19444,0.43056,0,0.02778,0.60255],"957":[0,0.43056,0.06366,0.02778,0.49398],"958":[0.19444,0.69444,0.04601,0.11111,0.4375],"959":[0,0.43056,0,0.05556,0.48472],"960":[0,0.43056,0.03588,0,0.57003],"961":[0.19444,0.43056,0,0.08334,0.51702],"962":[0.09722,0.43056,0.07986,0.08334,0.36285],"963":[0,0.43056,0.03588,0,0.57141],"964":[0,0.43056,0.1132,0.02778,0.43715],"965":[0,0.43056,0.03588,0.02778,0.54028],"966":[0.19444,0.43056,0,0.08334,0.65417],"967":[0.19444,0.43056,0,0.05556,0.62569],"968":[0.19444,0.69444,0.03588,0.11111,0.65139],"969":[0,0.43056,0.03588,0,0.62245],"977":[0,0.69444,0,0.08334,0.59144],"981":[0.19444,0.69444,0,0.08334,0.59583],"982":[0,0.43056,0.02778,0,0.82813],"1009":[0.19444,0.43056,0,0.08334,0.51702],"1013":[0,0.43056,0,0.05556,0.4059],"57649":[0,0.43056,0,0.02778,0.32246],"57911":[0.19444,0.43056,0,0.08334,0.38403]},"SansSerif-Bold":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0,0,0.36667],"34":[0,0.69444,0,0,0.55834],"35":[0.19444,0.69444,0,0,0.91667],"36":[0.05556,0.75,0,0,0.55],"37":[0.05556,0.75,0,0,1.02912],"38":[0,0.69444,0,0,0.83056],"39":[0,0.69444,0,0,0.30556],"40":[0.25,0.75,0,0,0.42778],"41":[0.25,0.75,0,0,0.42778],"42":[0,0.75,0,0,0.55],"43":[0.11667,0.61667,0,0,0.85556],"44":[0.10556,0.13056,0,0,0.30556],"45":[0,0.45833,0,0,0.36667],"46":[0,0.13056,0,0,0.30556],"47":[0.25,0.75,0,0,0.55],"48":[0,0.69444,0,0,0.55],"49":[0,0.69444,0,0,0.55],"50":[0,0.69444,0,0,0.55],"51":[0,0.69444,0,0,0.55],"52":[0,0.69444,0,0,0.55],"53":[0,0.69444,0,0,0.55],"54":[0,0.69444,0,0,0.55],"55":[0,0.69444,0,0,0.55],"56":[0,0.69444,0,0,0.55],"57":[0,0.69444,0,0,0.55],"58":[0,0.45833,0,0,0.30556],"59":[0.10556,0.45833,0,0,0.30556],"61":[-0.09375,0.40625,0,0,0.85556],"63":[0,0.69444,0,0,0.51945],"64":[0,0.69444,0,0,0.73334],"65":[0,0.69444,0,0,0.73334],"66":[0,0.69444,0,0,0.73334],"67":[0,0.69444,0,0,0.70278],"68":[0,0.69444,0,0,0.79445],"69":[0,0.69444,0,0,0.64167],"70":[0,0.69444,0,0,0.61111],"71":[0,0.69444,0,0,0.73334],"72":[0,0.69444,0,0,0.79445],"73":[0,0.69444,0,0,0.33056],"74":[0,0.69444,0,0,0.51945],"75":[0,0.69444,0,0,0.76389],"76":[0,0.69444,0,0,0.58056],"77":[0,0.69444,0,0,0.97778],"78":[0,0.69444,0,0,0.79445],"79":[0,0.69444,0,0,0.79445],"80":[0,0.69444,0,0,0.70278],"81":[0.10556,0.69444,0,0,0.79445],"82":[0,0.69444,0,0,0.70278],"83":[0,0.69444,0,0,0.61111],"84":[0,0.69444,0,0,0.73334],"85":[0,0.69444,0,0,0.76389],"86":[0,0.69444,0.01528,0,0.73334],"87":[0,0.69444,0.01528,0,1.03889],"88":[0,0.69444,0,0,0.73334],"89":[0,0.69444,0.0275,0,0.73334],"90":[0,0.69444,0,0,0.67223],"91":[0.25,0.75,0,0,0.34306],"93":[0.25,0.75,0,0,0.34306],"94":[0,0.69444,0,0,0.55],"95":[0.35,0.10833,0.03056,0,0.55],"97":[0,0.45833,0,0,0.525],"98":[0,0.69444,0,0,0.56111],"99":[0,0.45833,0,0,0.48889],"100":[0,0.69444,0,0,0.56111],"101":[0,0.45833,0,0,0.51111],"102":[0,0.69444,0.07639,0,0.33611],"103":[0.19444,0.45833,0.01528,0,0.55],"104":[0,0.69444,0,0,0.56111],"105":[0,0.69444,0,0,0.25556],"106":[0.19444,0.69444,0,0,0.28611],"107":[0,0.69444,0,0,0.53056],"108":[0,0.69444,0,0,0.25556],"109":[0,0.45833,0,0,0.86667],"110":[0,0.45833,0,0,0.56111],"111":[0,0.45833,0,0,0.55],"112":[0.19444,0.45833,0,0,0.56111],"113":[0.19444,0.45833,0,0,0.56111],"114":[0,0.45833,0.01528,0,0.37222],"115":[0,0.45833,0,0,0.42167],"116":[0,0.58929,0,0,0.40417],"117":[0,0.45833,0,0,0.56111],"118":[0,0.45833,0.01528,0,0.5],"119":[0,0.45833,0.01528,0,0.74445],"120":[0,0.45833,0,0,0.5],"121":[0.19444,0.45833,0.01528,0,0.5],"122":[0,0.45833,0,0,0.47639],"126":[0.35,0.34444,0,0,0.55],"160":[0,0,0,0,0.25],"168":[0,0.69444,0,0,0.55],"176":[0,0.69444,0,0,0.73334],"180":[0,0.69444,0,0,0.55],"184":[0.17014,0,0,0,0.48889],"305":[0,0.45833,0,0,0.25556],"567":[0.19444,0.45833,0,0,0.28611],"710":[0,0.69444,0,0,0.55],"711":[0,0.63542,0,0,0.55],"713":[0,0.63778,0,0,0.55],"728":[0,0.69444,0,0,0.55],"729":[0,0.69444,0,0,0.30556],"730":[0,0.69444,0,0,0.73334],"732":[0,0.69444,0,0,0.55],"733":[0,0.69444,0,0,0.55],"915":[0,0.69444,0,0,0.58056],"916":[0,0.69444,0,0,0.91667],"920":[0,0.69444,0,0,0.85556],"923":[0,0.69444,0,0,0.67223],"926":[0,0.69444,0,0,0.73334],"928":[0,0.69444,0,0,0.79445],"931":[0,0.69444,0,0,0.79445],"933":[0,0.69444,0,0,0.85556],"934":[0,0.69444,0,0,0.79445],"936":[0,0.69444,0,0,0.85556],"937":[0,0.69444,0,0,0.79445],"8211":[0,0.45833,0.03056,0,0.55],"8212":[0,0.45833,0.03056,0,1.10001],"8216":[0,0.69444,0,0,0.30556],"8217":[0,0.69444,0,0,0.30556],"8220":[0,0.69444,0,0,0.55834],"8221":[0,0.69444,0,0,0.55834]},"SansSerif-Italic":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0.05733,0,0.31945],"34":[0,0.69444,0.00316,0,0.5],"35":[0.19444,0.69444,0.05087,0,0.83334],"36":[0.05556,0.75,0.11156,0,0.5],"37":[0.05556,0.75,0.03126,0,0.83334],"38":[0,0.69444,0.03058,0,0.75834],"39":[0,0.69444,0.07816,0,0.27778],"40":[0.25,0.75,0.13164,0,0.38889],"41":[0.25,0.75,0.02536,0,0.38889],"42":[0,0.75,0.11775,0,0.5],"43":[0.08333,0.58333,0.02536,0,0.77778],"44":[0.125,0.08333,0,0,0.27778],"45":[0,0.44444,0.01946,0,0.33333],"46":[0,0.08333,0,0,0.27778],"47":[0.25,0.75,0.13164,0,0.5],"48":[0,0.65556,0.11156,0,0.5],"49":[0,0.65556,0.11156,0,0.5],"50":[0,0.65556,0.11156,0,0.5],"51":[0,0.65556,0.11156,0,0.5],"52":[0,0.65556,0.11156,0,0.5],"53":[0,0.65556,0.11156,0,0.5],"54":[0,0.65556,0.11156,0,0.5],"55":[0,0.65556,0.11156,0,0.5],"56":[0,0.65556,0.11156,0,0.5],"57":[0,0.65556,0.11156,0,0.5],"58":[0,0.44444,0.02502,0,0.27778],"59":[0.125,0.44444,0.02502,0,0.27778],"61":[-0.13,0.37,0.05087,0,0.77778],"63":[0,0.69444,0.11809,0,0.47222],"64":[0,0.69444,0.07555,0,0.66667],"65":[0,0.69444,0,0,0.66667],"66":[0,0.69444,0.08293,0,0.66667],"67":[0,0.69444,0.11983,0,0.63889],"68":[0,0.69444,0.07555,0,0.72223],"69":[0,0.69444,0.11983,0,0.59722],"70":[0,0.69444,0.13372,0,0.56945],"71":[0,0.69444,0.11983,0,0.66667],"72":[0,0.69444,0.08094,0,0.70834],"73":[0,0.69444,0.13372,0,0.27778],"74":[0,0.69444,0.08094,0,0.47222],"75":[0,0.69444,0.11983,0,0.69445],"76":[0,0.69444,0,0,0.54167],"77":[0,0.69444,0.08094,0,0.875],"78":[0,0.69444,0.08094,0,0.70834],"79":[0,0.69444,0.07555,0,0.73611],"80":[0,0.69444,0.08293,0,0.63889],"81":[0.125,0.69444,0.07555,0,0.73611],"82":[0,0.69444,0.08293,0,0.64584],"83":[0,0.69444,0.09205,0,0.55556],"84":[0,0.69444,0.13372,0,0.68056],"85":[0,0.69444,0.08094,0,0.6875],"86":[0,0.69444,0.1615,0,0.66667],"87":[0,0.69444,0.1615,0,0.94445],"88":[0,0.69444,0.13372,0,0.66667],"89":[0,0.69444,0.17261,0,0.66667],"90":[0,0.69444,0.11983,0,0.61111],"91":[0.25,0.75,0.15942,0,0.28889],"93":[0.25,0.75,0.08719,0,0.28889],"94":[0,0.69444,0.0799,0,0.5],"95":[0.35,0.09444,0.08616,0,0.5],"97":[0,0.44444,0.00981,0,0.48056],"98":[0,0.69444,0.03057,0,0.51667],"99":[0,0.44444,0.08336,0,0.44445],"100":[0,0.69444,0.09483,0,0.51667],"101":[0,0.44444,0.06778,0,0.44445],"102":[0,0.69444,0.21705,0,0.30556],"103":[0.19444,0.44444,0.10836,0,0.5],"104":[0,0.69444,0.01778,0,0.51667],"105":[0,0.67937,0.09718,0,0.23889],"106":[0.19444,0.67937,0.09162,0,0.26667],"107":[0,0.69444,0.08336,0,0.48889],"108":[0,0.69444,0.09483,0,0.23889],"109":[0,0.44444,0.01778,0,0.79445],"110":[0,0.44444,0.01778,0,0.51667],"111":[0,0.44444,0.06613,0,0.5],"112":[0.19444,0.44444,0.0389,0,0.51667],"113":[0.19444,0.44444,0.04169,0,0.51667],"114":[0,0.44444,0.10836,0,0.34167],"115":[0,0.44444,0.0778,0,0.38333],"116":[0,0.57143,0.07225,0,0.36111],"117":[0,0.44444,0.04169,0,0.51667],"118":[0,0.44444,0.10836,0,0.46111],"119":[0,0.44444,0.10836,0,0.68334],"120":[0,0.44444,0.09169,0,0.46111],"121":[0.19444,0.44444,0.10836,0,0.46111],"122":[0,0.44444,0.08752,0,0.43472],"126":[0.35,0.32659,0.08826,0,0.5],"160":[0,0,0,0,0.25],"168":[0,0.67937,0.06385,0,0.5],"176":[0,0.69444,0,0,0.73752],"184":[0.17014,0,0,0,0.44445],"305":[0,0.44444,0.04169,0,0.23889],"567":[0.19444,0.44444,0.04169,0,0.26667],"710":[0,0.69444,0.0799,0,0.5],"711":[0,0.63194,0.08432,0,0.5],"713":[0,0.60889,0.08776,0,0.5],"714":[0,0.69444,0.09205,0,0.5],"715":[0,0.69444,0,0,0.5],"728":[0,0.69444,0.09483,0,0.5],"729":[0,0.67937,0.07774,0,0.27778],"730":[0,0.69444,0,0,0.73752],"732":[0,0.67659,0.08826,0,0.5],"733":[0,0.69444,0.09205,0,0.5],"915":[0,0.69444,0.13372,0,0.54167],"916":[0,0.69444,0,0,0.83334],"920":[0,0.69444,0.07555,0,0.77778],"923":[0,0.69444,0,0,0.61111],"926":[0,0.69444,0.12816,0,0.66667],"928":[0,0.69444,0.08094,0,0.70834],"931":[0,0.69444,0.11983,0,0.72222],"933":[0,0.69444,0.09031,0,0.77778],"934":[0,0.69444,0.04603,0,0.72222],"936":[0,0.69444,0.09031,0,0.77778],"937":[0,0.69444,0.08293,0,0.72222],"8211":[0,0.44444,0.08616,0,0.5],"8212":[0,0.44444,0.08616,0,1.0],"8216":[0,0.69444,0.07816,0,0.27778],"8217":[0,0.69444,0.07816,0,0.27778],"8220":[0,0.69444,0.14205,0,0.5],"8221":[0,0.69444,0.00316,0,0.5]},"SansSerif-Regular":{"32":[0,0,0,0,0.25],"33":[0,0.69444,0,0,0.31945],"34":[0,0.69444,0,0,0.5],"35":[0.19444,0.69444,0,0,0.83334],"36":[0.05556,0.75,0,0,0.5],"37":[0.05556,0.75,0,0,0.83334],"38":[0,0.69444,0,0,0.75834],"39":[0,0.69444,0,0,0.27778],"40":[0.25,0.75,0,0,0.38889],"41":[0.25,0.75,0,0,0.38889],"42":[0,0.75,0,0,0.5],"43":[0.08333,0.58333,0,0,0.77778],"44":[0.125,0.08333,0,0,0.27778],"45":[0,0.44444,0,0,0.33333],"46":[0,0.08333,0,0,0.27778],"47":[0.25,0.75,0,0,0.5],"48":[0,0.65556,0,0,0.5],"49":[0,0.65556,0,0,0.5],"50":[0,0.65556,0,0,0.5],"51":[0,0.65556,0,0,0.5],"52":[0,0.65556,0,0,0.5],"53":[0,0.65556,0,0,0.5],"54":[0,0.65556,0,0,0.5],"55":[0,0.65556,0,0,0.5],"56":[0,0.65556,0,0,0.5],"57":[0,0.65556,0,0,0.5],"58":[0,0.44444,0,0,0.27778],"59":[0.125,0.44444,0,0,0.27778],"61":[-0.13,0.37,0,0,0.77778],"63":[0,0.69444,0,0,0.47222],"64":[0,0.69444,0,0,0.66667],"65":[0,0.69444,0,0,0.66667],"66":[0,0.69444,0,0,0.66667],"67":[0,0.69444,0,0,0.63889],"68":[0,0.69444,0,0,0.72223],"69":[0,0.69444,0,0,0.59722],"70":[0,0.69444,0,0,0.56945],"71":[0,0.69444,0,0,0.66667],"72":[0,0.69444,0,0,0.70834],"73":[0,0.69444,0,0,0.27778],"74":[0,0.69444,0,0,0.47222],"75":[0,0.69444,0,0,0.69445],"76":[0,0.69444,0,0,0.54167],"77":[0,0.69444,0,0,0.875],"78":[0,0.69444,0,0,0.70834],"79":[0,0.69444,0,0,0.73611],"80":[0,0.69444,0,0,0.63889],"81":[0.125,0.69444,0,0,0.73611],"82":[0,0.69444,0,0,0.64584],"83":[0,0.69444,0,0,0.55556],"84":[0,0.69444,0,0,0.68056],"85":[0,0.69444,0,0,0.6875],"86":[0,0.69444,0.01389,0,0.66667],"87":[0,0.69444,0.01389,0,0.94445],"88":[0,0.69444,0,0,0.66667],"89":[0,0.69444,0.025,0,0.66667],"90":[0,0.69444,0,0,0.61111],"91":[0.25,0.75,0,0,0.28889],"93":[0.25,0.75,0,0,0.28889],"94":[0,0.69444,0,0,0.5],"95":[0.35,0.09444,0.02778,0,0.5],"97":[0,0.44444,0,0,0.48056],"98":[0,0.69444,0,0,0.51667],"99":[0,0.44444,0,0,0.44445],"100":[0,0.69444,0,0,0.51667],"101":[0,0.44444,0,0,0.44445],"102":[0,0.69444,0.06944,0,0.30556],"103":[0.19444,0.44444,0.01389,0,0.5],"104":[0,0.69444,0,0,0.51667],"105":[0,0.67937,0,0,0.23889],"106":[0.19444,0.67937,0,0,0.26667],"107":[0,0.69444,0,0,0.48889],"108":[0,0.69444,0,0,0.23889],"109":[0,0.44444,0,0,0.79445],"110":[0,0.44444,0,0,0.51667],"111":[0,0.44444,0,0,0.5],"112":[0.19444,0.44444,0,0,0.51667],"113":[0.19444,0.44444,0,0,0.51667],"114":[0,0.44444,0.01389,0,0.34167],"115":[0,0.44444,0,0,0.38333],"116":[0,0.57143,0,0,0.36111],"117":[0,0.44444,0,0,0.51667],"118":[0,0.44444,0.01389,0,0.46111],"119":[0,0.44444,0.01389,0,0.68334],"120":[0,0.44444,0,0,0.46111],"121":[0.19444,0.44444,0.01389,0,0.46111],"122":[0,0.44444,0,0,0.43472],"126":[0.35,0.32659,0,0,0.5],"160":[0,0,0,0,0.25],"168":[0,0.67937,0,0,0.5],"176":[0,0.69444,0,0,0.66667],"184":[0.17014,0,0,0,0.44445],"305":[0,0.44444,0,0,0.23889],"567":[0.19444,0.44444,0,0,0.26667],"710":[0,0.69444,0,0,0.5],"711":[0,0.63194,0,0,0.5],"713":[0,0.60889,0,0,0.5],"714":[0,0.69444,0,0,0.5],"715":[0,0.69444,0,0,0.5],"728":[0,0.69444,0,0,0.5],"729":[0,0.67937,0,0,0.27778],"730":[0,0.69444,0,0,0.66667],"732":[0,0.67659,0,0,0.5],"733":[0,0.69444,0,0,0.5],"915":[0,0.69444,0,0,0.54167],"916":[0,0.69444,0,0,0.83334],"920":[0,0.69444,0,0,0.77778],"923":[0,0.69444,0,0,0.61111],"926":[0,0.69444,0,0,0.66667],"928":[0,0.69444,0,0,0.70834],"931":[0,0.69444,0,0,0.72222],"933":[0,0.69444,0,0,0.77778],"934":[0,0.69444,0,0,0.72222],"936":[0,0.69444,0,0,0.77778],"937":[0,0.69444,0,0,0.72222],"8211":[0,0.44444,0.02778,0,0.5],"8212":[0,0.44444,0.02778,0,1.0],"8216":[0,0.69444,0,0,0.27778],"8217":[0,0.69444,0,0,0.27778],"8220":[0,0.69444,0,0,0.5],"8221":[0,0.69444,0,0,0.5]},"Script-Regular":{"32":[0,0,0,0,0.25],"65":[0,0.7,0.22925,0,0.80253],"66":[0,0.7,0.04087,0,0.90757],"67":[0,0.7,0.1689,0,0.66619],"68":[0,0.7,0.09371,0,0.77443],"69":[0,0.7,0.18583,0,0.56162],"70":[0,0.7,0.13634,0,0.89544],"71":[0,0.7,0.17322,0,0.60961],"72":[0,0.7,0.29694,0,0.96919],"73":[0,0.7,0.19189,0,0.80907],"74":[0.27778,0.7,0.19189,0,1.05159],"75":[0,0.7,0.31259,0,0.91364],"76":[0,0.7,0.19189,0,0.87373],"77":[0,0.7,0.15981,0,1.08031],"78":[0,0.7,0.3525,0,0.9015],"79":[0,0.7,0.08078,0,0.73787],"80":[0,0.7,0.08078,0,1.01262],"81":[0,0.7,0.03305,0,0.88282],"82":[0,0.7,0.06259,0,0.85],"83":[0,0.7,0.19189,0,0.86767],"84":[0,0.7,0.29087,0,0.74697],"85":[0,0.7,0.25815,0,0.79996],"86":[0,0.7,0.27523,0,0.62204],"87":[0,0.7,0.27523,0,0.80532],"88":[0,0.7,0.26006,0,0.94445],"89":[0,0.7,0.2939,0,0.70961],"90":[0,0.7,0.24037,0,0.8212],"160":[0,0,0,0,0.25]},"Size1-Regular":{"32":[0,0,0,0,0.25],"40":[0.35001,0.85,0,0,0.45834],"41":[0.35001,0.85,0,0,0.45834],"47":[0.35001,0.85,0,0,0.57778],"91":[0.35001,0.85,0,0,0.41667],"92":[0.35001,0.85,0,0,0.57778],"93":[0.35001,0.85,0,0,0.41667],"123":[0.35001,0.85,0,0,0.58334],"125":[0.35001,0.85,0,0,0.58334],"160":[0,0,0,0,0.25],"710":[0,0.72222,0,0,0.55556],"732":[0,0.72222,0,0,0.55556],"770":[0,0.72222,0,0,0.55556],"771":[0,0.72222,0,0,0.55556],"8214":[-0.00099,0.601,0,0,0.77778],"8593":[1e-05,0.6,0,0,0.66667],"8595":[1e-05,0.6,0,0,0.66667],"8657":[1e-05,0.6,0,0,0.77778],"8659":[1e-05,0.6,0,0,0.77778],"8719":[0.25001,0.75,0,0,0.94445],"8720":[0.25001,0.75,0,0,0.94445],"8721":[0.25001,0.75,0,0,1.05556],"8730":[0.35001,0.85,0,0,1.0],"8739":[-0.00599,0.606,0,0,0.33333],"8741":[-0.00599,0.606,0,0,0.55556],"8747":[0.30612,0.805,0.19445,0,0.47222],"8748":[0.306,0.805,0.19445,0,0.47222],"8749":[0.306,0.805,0.19445,0,0.47222],"8750":[0.30612,0.805,0.19445,0,0.47222],"8896":[0.25001,0.75,0,0,0.83334],"8897":[0.25001,0.75,0,0,0.83334],"8898":[0.25001,0.75,0,0,0.83334],"8899":[0.25001,0.75,0,0,0.83334],"8968":[0.35001,0.85,0,0,0.47222],"8969":[0.35001,0.85,0,0,0.47222],"8970":[0.35001,0.85,0,0,0.47222],"8971":[0.35001,0.85,0,0,0.47222],"9168":[-0.00099,0.601,0,0,0.66667],"10216":[0.35001,0.85,0,0,0.47222],"10217":[0.35001,0.85,0,0,0.47222],"10752":[0.25001,0.75,0,0,1.11111],"10753":[0.25001,0.75,0,0,1.11111],"10754":[0.25001,0.75,0,0,1.11111],"10756":[0.25001,0.75,0,0,0.83334],"10758":[0.25001,0.75,0,0,0.83334]},"Size2-Regular":{"32":[0,0,0,0,0.25],"40":[0.65002,1.15,0,0,0.59722],"41":[0.65002,1.15,0,0,0.59722],"47":[0.65002,1.15,0,0,0.81111],"91":[0.65002,1.15,0,0,0.47222],"92":[0.65002,1.15,0,0,0.81111],"93":[0.65002,1.15,0,0,0.47222],"123":[0.65002,1.15,0,0,0.66667],"125":[0.65002,1.15,0,0,0.66667],"160":[0,0,0,0,0.25],"710":[0,0.75,0,0,1.0],"732":[0,0.75,0,0,1.0],"770":[0,0.75,0,0,1.0],"771":[0,0.75,0,0,1.0],"8719":[0.55001,1.05,0,0,1.27778],"8720":[0.55001,1.05,0,0,1.27778],"8721":[0.55001,1.05,0,0,1.44445],"8730":[0.65002,1.15,0,0,1.0],"8747":[0.86225,1.36,0.44445,0,0.55556],"8748":[0.862,1.36,0.44445,0,0.55556],"8749":[0.862,1.36,0.44445,0,0.55556],"8750":[0.86225,1.36,0.44445,0,0.55556],"8896":[0.55001,1.05,0,0,1.11111],"8897":[0.55001,1.05,0,0,1.11111],"8898":[0.55001,1.05,0,0,1.11111],"8899":[0.55001,1.05,0,0,1.11111],"8968":[0.65002,1.15,0,0,0.52778],"8969":[0.65002,1.15,0,0,0.52778],"8970":[0.65002,1.15,0,0,0.52778],"8971":[0.65002,1.15,0,0,0.52778],"10216":[0.65002,1.15,0,0,0.61111],"10217":[0.65002,1.15,0,0,0.61111],"10752":[0.55001,1.05,0,0,1.51112],"10753":[0.55001,1.05,0,0,1.51112],"10754":[0.55001,1.05,0,0,1.51112],"10756":[0.55001,1.05,0,0,1.11111],"10758":[0.55001,1.05,0,0,1.11111]},"Size3-Regular":{"32":[0,0,0,0,0.25],"40":[0.95003,1.45,0,0,0.73611],"41":[0.95003,1.45,0,0,0.73611],"47":[0.95003,1.45,0,0,1.04445],"91":[0.95003,1.45,0,0,0.52778],"92":[0.95003,1.45,0,0,1.04445],"93":[0.95003,1.45,0,0,0.52778],"123":[0.95003,1.45,0,0,0.75],"125":[0.95003,1.45,0,0,0.75],"160":[0,0,0,0,0.25],"710":[0,0.75,0,0,1.44445],"732":[0,0.75,0,0,1.44445],"770":[0,0.75,0,0,1.44445],"771":[0,0.75,0,0,1.44445],"8730":[0.95003,1.45,0,0,1.0],"8968":[0.95003,1.45,0,0,0.58334],"8969":[0.95003,1.45,0,0,0.58334],"8970":[0.95003,1.45,0,0,0.58334],"8971":[0.95003,1.45,0,0,0.58334],"10216":[0.95003,1.45,0,0,0.75],"10217":[0.95003,1.45,0,0,0.75]},"Size4-Regular":{"32":[0,0,0,0,0.25],"40":[1.25003,1.75,0,0,0.79167],"41":[1.25003,1.75,0,0,0.79167],"47":[1.25003,1.75,0,0,1.27778],"91":[1.25003,1.75,0,0,0.58334],"92":[1.25003,1.75,0,0,1.27778],"93":[1.25003,1.75,0,0,0.58334],"123":[1.25003,1.75,0,0,0.80556],"125":[1.25003,1.75,0,0,0.80556],"160":[0,0,0,0,0.25],"710":[0,0.825,0,0,1.8889],"732":[0,0.825,0,0,1.8889],"770":[0,0.825,0,0,1.8889],"771":[0,0.825,0,0,1.8889],"8730":[1.25003,1.75,0,0,1.0],"8968":[1.25003,1.75,0,0,0.63889],"8969":[1.25003,1.75,0,0,0.63889],"8970":[1.25003,1.75,0,0,0.63889],"8971":[1.25003,1.75,0,0,0.63889],"9115":[0.64502,1.155,0,0,0.875],"9116":[1e-05,0.6,0,0,0.875],"9117":[0.64502,1.155,0,0,0.875],"9118":[0.64502,1.155,0,0,0.875],"9119":[1e-05,0.6,0,0,0.875],"9120":[0.64502,1.155,0,0,0.875],"9121":[0.64502,1.155,0,0,0.66667],"9122":[-0.00099,0.601,0,0,0.66667],"9123":[0.64502,1.155,0,0,0.66667],"9124":[0.64502,1.155,0,0,0.66667],"9125":[-0.00099,0.601,0,0,0.66667],"9126":[0.64502,1.155,0,0,0.66667],"9127":[1e-05,0.9,0,0,0.88889],"9128":[0.65002,1.15,0,0,0.88889],"9129":[0.90001,0,0,0,0.88889],"9130":[0,0.3,0,0,0.88889],"9131":[1e-05,0.9,0,0,0.88889],"9132":[0.65002,1.15,0,0,0.88889],"9133":[0.90001,0,0,0,0.88889],"9143":[0.88502,0.915,0,0,1.05556],"10216":[1.25003,1.75,0,0,0.80556],"10217":[1.25003,1.75,0,0,0.80556],"57344":[-0.00499,0.605,0,0,1.05556],"57345":[-0.00499,0.605,0,0,1.05556],"57680":[0,0.12,0,0,0.45],"57681":[0,0.12,0,0,0.45],"57682":[0,0.12,0,0,0.45],"57683":[0,0.12,0,0,0.45]},"Typewriter-Regular":{"32":[0,0,0,0,0.525],"33":[0,0.61111,0,0,0.525],"34":[0,0.61111,0,0,0.525],"35":[0,0.61111,0,0,0.525],"36":[0.08333,0.69444,0,0,0.525],"37":[0.08333,0.69444,0,0,0.525],"38":[0,0.61111,0,0,0.525],"39":[0,0.61111,0,0,0.525],"40":[0.08333,0.69444,0,0,0.525],"41":[0.08333,0.69444,0,0,0.525],"42":[0,0.52083,0,0,0.525],"43":[-0.08056,0.53055,0,0,0.525],"44":[0.13889,0.125,0,0,0.525],"45":[-0.08056,0.53055,0,0,0.525],"46":[0,0.125,0,0,0.525],"47":[0.08333,0.69444,0,0,0.525],"48":[0,0.61111,0,0,0.525],"49":[0,0.61111,0,0,0.525],"50":[0,0.61111,0,0,0.525],"51":[0,0.61111,0,0,0.525],"52":[0,0.61111,0,0,0.525],"53":[0,0.61111,0,0,0.525],"54":[0,0.61111,0,0,0.525],"55":[0,0.61111,0,0,0.525],"56":[0,0.61111,0,0,0.525],"57":[0,0.61111,0,0,0.525],"58":[0,0.43056,0,0,0.525],"59":[0.13889,0.43056,0,0,0.525],"60":[-0.05556,0.55556,0,0,0.525],"61":[-0.19549,0.41562,0,0,0.525],"62":[-0.05556,0.55556,0,0,0.525],"63":[0,0.61111,0,0,0.525],"64":[0,0.61111,0,0,0.525],"65":[0,0.61111,0,0,0.525],"66":[0,0.61111,0,0,0.525],"67":[0,0.61111,0,0,0.525],"68":[0,0.61111,0,0,0.525],"69":[0,0.61111,0,0,0.525],"70":[0,0.61111,0,0,0.525],"71":[0,0.61111,0,0,0.525],"72":[0,0.61111,0,0,0.525],"73":[0,0.61111,0,0,0.525],"74":[0,0.61111,0,0,0.525],"75":[0,0.61111,0,0,0.525],"76":[0,0.61111,0,0,0.525],"77":[0,0.61111,0,0,0.525],"78":[0,0.61111,0,0,0.525],"79":[0,0.61111,0,0,0.525],"80":[0,0.61111,0,0,0.525],"81":[0.13889,0.61111,0,0,0.525],"82":[0,0.61111,0,0,0.525],"83":[0,0.61111,0,0,0.525],"84":[0,0.61111,0,0,0.525],"85":[0,0.61111,0,0,0.525],"86":[0,0.61111,0,0,0.525],"87":[0,0.61111,0,0,0.525],"88":[0,0.61111,0,0,0.525],"89":[0,0.61111,0,0,0.525],"90":[0,0.61111,0,0,0.525],"91":[0.08333,0.69444,0,0,0.525],"92":[0.08333,0.69444,0,0,0.525],"93":[0.08333,0.69444,0,0,0.525],"94":[0,0.61111,0,0,0.525],"95":[0.09514,0,0,0,0.525],"96":[0,0.61111,0,0,0.525],"97":[0,0.43056,0,0,0.525],"98":[0,0.61111,0,0,0.525],"99":[0,0.43056,0,0,0.525],"100":[0,0.61111,0,0,0.525],"101":[0,0.43056,0,0,0.525],"102":[0,0.61111,0,0,0.525],"103":[0.22222,0.43056,0,0,0.525],"104":[0,0.61111,0,0,0.525],"105":[0,0.61111,0,0,0.525],"106":[0.22222,0.61111,0,0,0.525],"107":[0,0.61111,0,0,0.525],"108":[0,0.61111,0,0,0.525],"109":[0,0.43056,0,0,0.525],"110":[0,0.43056,0,0,0.525],"111":[0,0.43056,0,0,0.525],"112":[0.22222,0.43056,0,0,0.525],"113":[0.22222,0.43056,0,0,0.525],"114":[0,0.43056,0,0,0.525],"115":[0,0.43056,0,0,0.525],"116":[0,0.55358,0,0,0.525],"117":[0,0.43056,0,0,0.525],"118":[0,0.43056,0,0,0.525],"119":[0,0.43056,0,0,0.525],"120":[0,0.43056,0,0,0.525],"121":[0.22222,0.43056,0,0,0.525],"122":[0,0.43056,0,0,0.525],"123":[0.08333,0.69444,0,0,0.525],"124":[0.08333,0.69444,0,0,0.525],"125":[0.08333,0.69444,0,0,0.525],"126":[0,0.61111,0,0,0.525],"127":[0,0.61111,0,0,0.525],"160":[0,0,0,0,0.525],"176":[0,0.61111,0,0,0.525],"184":[0.19445,0,0,0,0.525],"305":[0,0.43056,0,0,0.525],"567":[0.22222,0.43056,0,0,0.525],"711":[0,0.56597,0,0,0.525],"713":[0,0.56555,0,0,0.525],"714":[0,0.61111,0,0,0.525],"715":[0,0.61111,0,0,0.525],"728":[0,0.61111,0,0,0.525],"730":[0,0.61111,0,0,0.525],"770":[0,0.61111,0,0,0.525],"771":[0,0.61111,0,0,0.525],"776":[0,0.61111,0,0,0.525],"915":[0,0.61111,0,0,0.525],"916":[0,0.61111,0,0,0.525],"920":[0,0.61111,0,0,0.525],"923":[0,0.61111,0,0,0.525],"926":[0,0.61111,0,0,0.525],"928":[0,0.61111,0,0,0.525],"931":[0,0.61111,0,0,0.525],"933":[0,0.61111,0,0,0.525],"934":[0,0.61111,0,0,0.525],"936":[0,0.61111,0,0,0.525],"937":[0,0.61111,0,0,0.525],"8216":[0,0.61111,0,0,0.525],"8217":[0,0.61111,0,0,0.525],"8242":[0,0.61111,0,0,0.525],"9251":[0.11111,0.21944,0,0,0.525]}};/**
 * This file contains metrics regarding fonts and individual symbols. The sigma
 * and xi variables, as well as the metricMap map contain data extracted from
 * TeX, TeX font metrics, and the TTF files. These data are then exposed via the
 * `metrics` variable and the getCharacterMetrics function.
 */// In TeX, there are actually three sets of dimensions, one for each of
// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:
// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt).  These are
// provided in the arrays below, in that order.
//
// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respectively.
// This was determined by running the following script:
//
//     latex -interaction=nonstopmode \
//     '\documentclass{article}\usepackage{amsmath}\begin{document}' \
//     '$a$ \expandafter\show\the\textfont2' \
//     '\expandafter\show\the\scriptfont2' \
//     '\expandafter\show\the\scriptscriptfont2' \
//     '\stop'
//
// The metrics themselves were retrieved using the following commands:
//
//     tftopl cmsy10
//     tftopl cmsy7
//     tftopl cmsy5
//
// The output of each of these commands is quite lengthy.  The only part we
// care about is the FONTDIMEN section. Each value is measured in EMs.
const sigmasAndXis={slant:[0.250,0.250,0.250],// sigma1
space:[0.000,0.000,0.000],// sigma2
stretch:[0.000,0.000,0.000],// sigma3
shrink:[0.000,0.000,0.000],// sigma4
xHeight:[0.431,0.431,0.431],// sigma5
quad:[1.000,1.171,1.472],// sigma6
extraSpace:[0.000,0.000,0.000],// sigma7
num1:[0.677,0.732,0.925],// sigma8
num2:[0.394,0.384,0.387],// sigma9
num3:[0.444,0.471,0.504],// sigma10
denom1:[0.686,0.752,1.025],// sigma11
denom2:[0.345,0.344,0.532],// sigma12
sup1:[0.413,0.503,0.504],// sigma13
sup2:[0.363,0.431,0.404],// sigma14
sup3:[0.289,0.286,0.294],// sigma15
sub1:[0.150,0.143,0.200],// sigma16
sub2:[0.247,0.286,0.400],// sigma17
supDrop:[0.386,0.353,0.494],// sigma18
subDrop:[0.050,0.071,0.100],// sigma19
delim1:[2.390,1.700,1.980],// sigma20
delim2:[1.010,1.157,1.420],// sigma21
axisHeight:[0.250,0.250,0.250],// sigma22
// These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
// they correspond to the font parameters of the extension fonts (family 3).
// See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
// match cmex7, we'd use cmex7.tfm values for script and scriptscript
// values.
defaultRuleThickness:[0.04,0.049,0.049],// xi8; cmex7: 0.049
bigOpSpacing1:[0.111,0.111,0.111],// xi9
bigOpSpacing2:[0.166,0.166,0.166],// xi10
bigOpSpacing3:[0.2,0.2,0.2],// xi11
bigOpSpacing4:[0.6,0.611,0.611],// xi12; cmex7: 0.611
bigOpSpacing5:[0.1,0.143,0.143],// xi13; cmex7: 0.143
// The \sqrt rule width is taken from the height of the surd character.
// Since we use the same font at all sizes, this thickness doesn't scale.
sqrtRuleThickness:[0.04,0.04,0.04],// This value determines how large a pt is, for metrics which are defined
// in terms of pts.
// This value is also used in katex.scss; if you change it make sure the
// values match.
ptPerEm:[10.0,10.0,10.0],// The space between adjacent `|` columns in an array definition. From
// `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
doubleRuleSep:[0.2,0.2,0.2],// The width of separator lines in {array} environments. From
// `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
arrayRuleWidth:[0.04,0.04,0.04],// Two values from LaTeX source2e:
fboxsep:[0.3,0.3,0.3],//        3 pt / ptPerEm
fboxrule:[0.04,0.04,0.04]// 0.4 pt / ptPerEm
};// This map contains a mapping from font name and character code to character
// metrics, including height, depth, italic correction, and skew (kern from the
// character to the corresponding \skewchar)
// This map is generated via `make metrics`. It should not be changed manually.
// These are very rough approximations.  We default to Times New Roman which
// should have Latin-1 and Cyrillic characters, but may not depending on the
// operating system.  The metrics do not account for extra height from the
// accents.  In the case of Cyrillic characters which have both ascenders and
// descenders we prefer approximations with ascenders, primarily to prevent
// the fraction bar or root line from intersecting the glyph.
// TODO(kevinb) allow union of multiple glyph metrics for better accuracy.
const extraCharacterMap={// Latin-1
'Å':'A','Ð':'D','Þ':'o','å':'a','ð':'d','þ':'o',// Cyrillic
'А':'A','Б':'B','В':'B','Г':'F','Д':'A','Е':'E','Ж':'K','З':'3','И':'N','Й':'N','К':'K','Л':'N','М':'M','Н':'H','О':'O','П':'N','Р':'P','С':'C','Т':'T','У':'y','Ф':'O','Х':'X','Ц':'U','Ч':'h','Ш':'W','Щ':'W','Ъ':'B','Ы':'X','Ь':'B','Э':'3','Ю':'X','Я':'R','а':'a','б':'b','в':'a','г':'r','д':'y','е':'e','ж':'m','з':'e','и':'n','й':'n','к':'n','л':'n','м':'m','н':'n','о':'o','п':'n','р':'p','с':'c','т':'o','у':'y','ф':'b','х':'x','ц':'n','ч':'n','ш':'w','щ':'w','ъ':'a','ы':'m','ь':'a','э':'e','ю':'m','я':'r'};/**
 * This function adds new font metrics to default metricMap
 * It can also override existing metrics
 */function setFontMetrics(fontName,metrics){fontMetricsData[fontName]=metrics;}/**
 * This function is a convenience function for looking up information in the
 * metricMap table. It takes a character as a string, and a font.
 *
 * Note: the `width` property may be undefined if fontMetricsData.js wasn't
 * built using `Make extended_metrics`.
 */function getCharacterMetrics(character,font,mode){if(!fontMetricsData[font]){throw new Error("Font metrics not found for font: "+font+".");}let ch=character.charCodeAt(0);let metrics=fontMetricsData[font][ch];if(!metrics&&character[0]in extraCharacterMap){ch=extraCharacterMap[character[0]].charCodeAt(0);metrics=fontMetricsData[font][ch];}if(!metrics&&mode==='text'){// We don't typically have font metrics for Asian scripts.
// But since we support them in text mode, we need to return
// some sort of metrics.
// So if the character is in a script we support but we
// don't have metrics for it, just use the metrics for
// the Latin capital letter M. This is close enough because
// we (currently) only care about the height of the glyph
// not its width.
if(supportedCodepoint(ch)){metrics=fontMetricsData[font][77];// 77 is the charcode for 'M'
}}if(metrics){return {depth:metrics[0],height:metrics[1],italic:metrics[2],skew:metrics[3],width:metrics[4]};}}const fontMetricsBySizeIndex={};/**
 * Get the font metrics for a given size.
 */function getGlobalMetrics(size){let sizeIndex;if(size>=5){sizeIndex=0;}else if(size>=3){sizeIndex=1;}else {sizeIndex=2;}if(!fontMetricsBySizeIndex[sizeIndex]){const metrics=fontMetricsBySizeIndex[sizeIndex]={cssEmPerMu:sigmasAndXis.quad[sizeIndex]/18};for(const key in sigmasAndXis){if(sigmasAndXis.hasOwnProperty(key)){metrics[key]=sigmasAndXis[key][sizeIndex];}}}return fontMetricsBySizeIndex[sizeIndex];}/**
 * This file contains information about the options that the Parser carries
 * around with it while parsing. Data is held in an `Options` object, and when
 * recursing, a new `Options` object can be created with the `.with*` and
 * `.reset` functions.
 */const sizeStyleMap=[// Each element contains [textsize, scriptsize, scriptscriptsize].
// The size mappings are taken from TeX with \normalsize=10pt.
[1,1,1],// size1: [5, 5, 5]              \tiny
[2,1,1],// size2: [6, 5, 5]
[3,1,1],// size3: [7, 5, 5]              \scriptsize
[4,2,1],// size4: [8, 6, 5]              \footnotesize
[5,2,1],// size5: [9, 6, 5]              \small
[6,3,1],// size6: [10, 7, 5]             \normalsize
[7,4,2],// size7: [12, 8, 6]             \large
[8,6,3],// size8: [14.4, 10, 7]          \Large
[9,7,6],// size9: [17.28, 12, 10]        \LARGE
[10,8,7],// size10: [20.74, 14.4, 12]     \huge
[11,10,9]// size11: [24.88, 20.74, 17.28] \HUGE
];const sizeMultipliers=[// fontMetrics.js:getGlobalMetrics also uses size indexes, so if
// you change size indexes, change that function.
0.5,0.6,0.7,0.8,0.9,1.0,1.2,1.44,1.728,2.074,2.488];const sizeAtStyle=function(size,style){return style.size<2?size:sizeStyleMap[size-1][style.size-1];};// In these types, "" (empty string) means "no change".
/**
 * This is the main options class. It contains the current style, size, color,
 * and font.
 *
 * Options objects should not be modified. To create a new Options with
 * different properties, call a `.having*` method.
 */class Options{// A font family applies to a group of fonts (i.e. SansSerif), while a font
// represents a specific font (i.e. SansSerif Bold).
// See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm
/**
   * The base size index.
   */constructor(data){this.style=void 0;this.color=void 0;this.size=void 0;this.textSize=void 0;this.phantom=void 0;this.font=void 0;this.fontFamily=void 0;this.fontWeight=void 0;this.fontShape=void 0;this.sizeMultiplier=void 0;this.maxSize=void 0;this.minRuleThickness=void 0;this._fontMetrics=void 0;this.style=data.style;this.color=data.color;this.size=data.size||Options.BASESIZE;this.textSize=data.textSize||this.size;this.phantom=!!data.phantom;this.font=data.font||"";this.fontFamily=data.fontFamily||"";this.fontWeight=data.fontWeight||'';this.fontShape=data.fontShape||'';this.sizeMultiplier=sizeMultipliers[this.size-1];this.maxSize=data.maxSize;this.minRuleThickness=data.minRuleThickness;this._fontMetrics=undefined;}/**
   * Returns a new options object with the same properties as "this".  Properties
   * from "extension" will be copied to the new options object.
   */extend(extension){const data={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(const key in extension){if(extension.hasOwnProperty(key)){data[key]=extension[key];}}return new Options(data);}/**
   * Return an options object with the given style. If `this.style === style`,
   * returns `this`.
   */havingStyle(style){if(this.style===style){return this;}else {return this.extend({style:style,size:sizeAtStyle(this.textSize,style)});}}/**
   * Return an options object with a cramped version of the current style. If
   * the current style is cramped, returns `this`.
   */havingCrampedStyle(){return this.havingStyle(this.style.cramp());}/**
   * Return an options object with the given size and in at least `\textstyle`.
   * Returns `this` if appropriate.
   */havingSize(size){if(this.size===size&&this.textSize===size){return this;}else {return this.extend({style:this.style.text(),size:size,textSize:size,sizeMultiplier:sizeMultipliers[size-1]});}}/**
   * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
   * changes to at least `\textstyle`.
   */havingBaseStyle(style){style=style||this.style.text();const wantSize=sizeAtStyle(Options.BASESIZE,style);if(this.size===wantSize&&this.textSize===Options.BASESIZE&&this.style===style){return this;}else {return this.extend({style:style,size:wantSize});}}/**
   * Remove the effect of sizing changes such as \Huge.
   * Keep the effect of the current style, such as \scriptstyle.
   */havingBaseSizing(){let size;switch(this.style.id){case 4:case 5:size=3;// normalsize in scriptstyle
break;case 6:case 7:size=1;// normalsize in scriptscriptstyle
break;default:size=6;// normalsize in textstyle or displaystyle
}return this.extend({style:this.style.text(),size:size});}/**
   * Create a new options object with the given color.
   */withColor(color){return this.extend({color:color});}/**
   * Create a new options object with "phantom" set to true.
   */withPhantom(){return this.extend({phantom:true});}/**
   * Creates a new options object with the given math font or old text font.
   * @type {[type]}
   */withFont(font){return this.extend({font});}/**
   * Create a new options objects with the given fontFamily.
   */withTextFontFamily(fontFamily){return this.extend({fontFamily,font:""});}/**
   * Creates a new options object with the given font weight
   */withTextFontWeight(fontWeight){return this.extend({fontWeight,font:""});}/**
   * Creates a new options object with the given font weight
   */withTextFontShape(fontShape){return this.extend({fontShape,font:""});}/**
   * Return the CSS sizing classes required to switch from enclosing options
   * `oldOptions` to `this`. Returns an array of classes.
   */sizingClasses(oldOptions){if(oldOptions.size!==this.size){return ["sizing","reset-size"+oldOptions.size,"size"+this.size];}else {return [];}}/**
   * Return the CSS sizing classes required to switch to the base size. Like
   * `this.havingSize(BASESIZE).sizingClasses(this)`.
   */baseSizingClasses(){if(this.size!==Options.BASESIZE){return ["sizing","reset-size"+this.size,"size"+Options.BASESIZE];}else {return [];}}/**
   * Return the font metrics for this size.
   */fontMetrics(){if(!this._fontMetrics){this._fontMetrics=getGlobalMetrics(this.size);}return this._fontMetrics;}/**
   * Gets the CSS color of the current options object
   */getColor(){if(this.phantom){return "transparent";}else {return this.color;}}}Options.BASESIZE=6;/* harmony default export */var src_Options=Options;/**
 * This file does conversion between units.  In particular, it provides
 * calculateSize to convert other units into ems.
 */// This table gives the number of TeX pts in one of each *absolute* TeX unit.
// Thus, multiplying a length by this number converts the length from units
// into pts.  Dividing the result by ptPerEm gives the number of ems
// *assuming* a font size of ptPerEm (normal size, normal style).
const ptPerUnit={// https://en.wikibooks.org/wiki/LaTeX/Lengths and
// https://tex.stackexchange.com/a/8263
"pt":1,// TeX point
"mm":7227/2540,// millimeter
"cm":7227/254,// centimeter
"in":72.27,// inch
"bp":803/800,// big (PostScript) points
"pc":12,// pica
"dd":1238/1157,// didot
"cc":14856/1157,// cicero (12 didot)
"nd":685/642,// new didot
"nc":1370/107,// new cicero (12 new didot)
"sp":1/65536,// scaled point (TeX's internal smallest unit)
// https://tex.stackexchange.com/a/41371
"px":803/800// \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
};// Dictionary of relative units, for fast validity testing.
const relativeUnit={"ex":true,"em":true,"mu":true};/**
 * Determine whether the specified unit (either a string defining the unit
 * or a "size" parse node containing a unit field) is valid.
 */const validUnit=function(unit){if(typeof unit!=="string"){unit=unit.unit;}return unit in ptPerUnit||unit in relativeUnit||unit==="ex";};/*
 * Convert a "size" parse node (with numeric "number" and string "unit" fields,
 * as parsed by functions.js argType "size") into a CSS em value for the
 * current style/scale.  `options` gives the current options.
 */const calculateSize=function(sizeValue,options){let scale;if(sizeValue.unit in ptPerUnit){// Absolute units
scale=ptPerUnit[sizeValue.unit]// Convert unit to pt
/options.fontMetrics().ptPerEm// Convert pt to CSS em
/options.sizeMultiplier;// Unscale to make absolute units
}else if(sizeValue.unit==="mu"){// `mu` units scale with scriptstyle/scriptscriptstyle.
scale=options.fontMetrics().cssEmPerMu;}else {// Other relative units always refer to the *textstyle* font
// in the current size.
let unitOptions;if(options.style.isTight()){// isTight() means current style is script/scriptscript.
unitOptions=options.havingStyle(options.style.text());}else {unitOptions=options;}// TODO: In TeX these units are relative to the quad of the current
// *text* font, e.g. cmr10. KaTeX instead uses values from the
// comparably-sized *Computer Modern symbol* font. At 10pt, these
// match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;
// cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$.
// TeX \showlists shows a kern of 1.13889 * fontsize;
// KaTeX shows a kern of 1.171 * fontsize.
if(sizeValue.unit==="ex"){scale=unitOptions.fontMetrics().xHeight;}else if(sizeValue.unit==="em"){scale=unitOptions.fontMetrics().quad;}else {throw new src_ParseError("Invalid unit: '"+sizeValue.unit+"'");}if(unitOptions!==options){scale*=unitOptions.sizeMultiplier/options.sizeMultiplier;}}return Math.min(sizeValue.number*scale,options.maxSize);};/**
 * Round `n` to 4 decimal places, or to the nearest 1/10,000th em. See
 * https://github.com/KaTeX/KaTeX/pull/2460.
 */const makeEm=function(n){return +n.toFixed(4)+"em";};/**
 * These objects store the data about the DOM nodes we create, as well as some
 * extra data. They can then be transformed into real DOM nodes with the
 * `toNode` function or HTML markup using `toMarkup`. They are useful for both
 * storing extra properties on the nodes, as well as providing a way to easily
 * work with the DOM.
 *
 * Similar functions for working with MathML nodes exist in mathMLTree.js.
 *
 * TODO: refactor `span` and `anchor` into common superclass when
 * target environments support class inheritance
 *//**
 * Create an HTML className based on a list of classes. In addition to joining
 * with spaces, we also remove empty classes.
 */const createClass=function(classes){return classes.filter(cls=>cls).join(" ");};const initNode=function(classes,options,style){this.classes=classes||[];this.attributes={};this.height=0;this.depth=0;this.maxFontSize=0;this.style=style||{};if(options){if(options.style.isTight()){this.classes.push("mtight");}const color=options.getColor();if(color){this.style.color=color;}}};/**
 * Convert into an HTML node
 */const toNode=function(tagName){const node=document.createElement(tagName);// Apply the class
node.className=createClass(this.classes);// Apply inline styles
for(const style in this.style){if(this.style.hasOwnProperty(style)){// $FlowFixMe Flow doesn't seem to understand span.style's type.
node.style[style]=this.style[style];}}// Apply attributes
for(const attr in this.attributes){if(this.attributes.hasOwnProperty(attr)){node.setAttribute(attr,this.attributes[attr]);}}// Append the children, also as HTML nodes
for(let i=0;i<this.children.length;i++){node.appendChild(this.children[i].toNode());}return node;};/**
 * https://w3c.github.io/html-reference/syntax.html#syntax-attributes
 *
 * > Attribute Names must consist of one or more characters
 * other than the space characters, U+0000 NULL,
 * '"', "'", ">", "/", "=", the control characters,
 * and any characters that are not defined by Unicode.
 */const invalidAttributeNameRegex=/[\s"'>/=\x00-\x1f]/;/**
 * Convert into an HTML markup string
 */const toMarkup=function(tagName){let markup="<"+tagName;// Add the class
if(this.classes.length){markup+=" class=\""+utils.escape(createClass(this.classes))+"\"";}let styles="";// Add the styles, after hyphenation
for(const style in this.style){if(this.style.hasOwnProperty(style)){styles+=utils.hyphenate(style)+":"+this.style[style]+";";}}if(styles){markup+=" style=\""+utils.escape(styles)+"\"";}// Add the attributes
for(const attr in this.attributes){if(this.attributes.hasOwnProperty(attr)){if(invalidAttributeNameRegex.test(attr)){throw new src_ParseError("Invalid attribute name '"+attr+"'");}markup+=" "+attr+"=\""+utils.escape(this.attributes[attr])+"\"";}}markup+=">";// Add the markup of the children, also as markup
for(let i=0;i<this.children.length;i++){markup+=this.children[i].toMarkup();}markup+="</"+tagName+">";return markup;};// Making the type below exact with all optional fields doesn't work due to
// - https://github.com/facebook/flow/issues/4582
// - https://github.com/facebook/flow/issues/5688
// However, since *all* fields are optional, $Shape<> works as suggested in 5688
// above.
// This type does not include all CSS properties. Additional properties should
// be added as needed.
/**
 * This node represents a span node, with a className, a list of children, and
 * an inline style. It also contains information about its height, depth, and
 * maxFontSize.
 *
 * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan
 * otherwise. This typesafety is important when HTML builders access a span's
 * children.
 */class Span{constructor(classes,children,options,style){this.children=void 0;this.attributes=void 0;this.classes=void 0;this.height=void 0;this.depth=void 0;this.width=void 0;this.maxFontSize=void 0;this.style=void 0;initNode.call(this,classes,options,style);this.children=children||[];}/**
   * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
   * all browsers support attributes the same, and having too many custom
   * attributes is probably bad.
   */setAttribute(attribute,value){this.attributes[attribute]=value;}hasClass(className){return utils.contains(this.classes,className);}toNode(){return toNode.call(this,"span");}toMarkup(){return toMarkup.call(this,"span");}}/**
 * This node represents an anchor (<a>) element with a hyperlink.  See `span`
 * for further details.
 */class Anchor{constructor(href,classes,children,options){this.children=void 0;this.attributes=void 0;this.classes=void 0;this.height=void 0;this.depth=void 0;this.maxFontSize=void 0;this.style=void 0;initNode.call(this,classes,options);this.children=children||[];this.setAttribute('href',href);}setAttribute(attribute,value){this.attributes[attribute]=value;}hasClass(className){return utils.contains(this.classes,className);}toNode(){return toNode.call(this,"a");}toMarkup(){return toMarkup.call(this,"a");}}/**
 * This node represents an image embed (<img>) element.
 */class Img{constructor(src,alt,style){this.src=void 0;this.alt=void 0;this.classes=void 0;this.height=void 0;this.depth=void 0;this.maxFontSize=void 0;this.style=void 0;this.alt=alt;this.src=src;this.classes=["mord"];this.style=style;}hasClass(className){return utils.contains(this.classes,className);}toNode(){const node=document.createElement("img");node.src=this.src;node.alt=this.alt;node.className="mord";// Apply inline styles
for(const style in this.style){if(this.style.hasOwnProperty(style)){// $FlowFixMe
node.style[style]=this.style[style];}}return node;}toMarkup(){let markup="<img src=\""+utils.escape(this.src)+"\""+(" alt=\""+utils.escape(this.alt)+"\"");// Add the styles, after hyphenation
let styles="";for(const style in this.style){if(this.style.hasOwnProperty(style)){styles+=utils.hyphenate(style)+":"+this.style[style]+";";}}if(styles){markup+=" style=\""+utils.escape(styles)+"\"";}markup+="'/>";return markup;}}const iCombinations={'î':'\u0131\u0302','ï':'\u0131\u0308','í':'\u0131\u0301',// 'ī': '\u0131\u0304', // enable when we add Extended Latin
'ì':'\u0131\u0300'};/**
 * A symbol node contains information about a single symbol. It either renders
 * to a single text node, or a span with a single text node in it, depending on
 * whether it has CSS classes, styles, or needs italic correction.
 */class SymbolNode{constructor(text,height,depth,italic,skew,width,classes,style){this.text=void 0;this.height=void 0;this.depth=void 0;this.italic=void 0;this.skew=void 0;this.width=void 0;this.maxFontSize=void 0;this.classes=void 0;this.style=void 0;this.text=text;this.height=height||0;this.depth=depth||0;this.italic=italic||0;this.skew=skew||0;this.width=width||0;this.classes=classes||[];this.style=style||{};this.maxFontSize=0;// Mark text from non-Latin scripts with specific classes so that we
// can specify which fonts to use.  This allows us to render these
// characters with a serif font in situations where the browser would
// either default to a sans serif or render a placeholder character.
// We use CSS class names like cjk_fallback, hangul_fallback and
// brahmic_fallback. See ./unicodeScripts.js for the set of possible
// script names
const script=scriptFromCodepoint(this.text.charCodeAt(0));if(script){this.classes.push(script+"_fallback");}if(/[îïíì]/.test(this.text)){// add ī when we add Extended Latin
this.text=iCombinations[this.text];}}hasClass(className){return utils.contains(this.classes,className);}/**
   * Creates a text node or span from a symbol node. Note that a span is only
   * created if it is needed.
   */toNode(){const node=document.createTextNode(this.text);let span=null;if(this.italic>0){span=document.createElement("span");span.style.marginRight=makeEm(this.italic);}if(this.classes.length>0){span=span||document.createElement("span");span.className=createClass(this.classes);}for(const style in this.style){if(this.style.hasOwnProperty(style)){span=span||document.createElement("span");// $FlowFixMe Flow doesn't seem to understand span.style's type.
span.style[style]=this.style[style];}}if(span){span.appendChild(node);return span;}else {return node;}}/**
   * Creates markup for a symbol node.
   */toMarkup(){// TODO(alpert): More duplication than I'd like from
// span.prototype.toMarkup and symbolNode.prototype.toNode...
let needsSpan=false;let markup="<span";if(this.classes.length){needsSpan=true;markup+=" class=\"";markup+=utils.escape(createClass(this.classes));markup+="\"";}let styles="";if(this.italic>0){styles+="margin-right:"+this.italic+"em;";}for(const style in this.style){if(this.style.hasOwnProperty(style)){styles+=utils.hyphenate(style)+":"+this.style[style]+";";}}if(styles){needsSpan=true;markup+=" style=\""+utils.escape(styles)+"\"";}const escaped=utils.escape(this.text);if(needsSpan){markup+=">";markup+=escaped;markup+="</span>";return markup;}else {return escaped;}}}/**
 * SVG nodes are used to render stretchy wide elements.
 */class SvgNode{constructor(children,attributes){this.children=void 0;this.attributes=void 0;this.children=children||[];this.attributes=attributes||{};}toNode(){const svgNS="http://www.w3.org/2000/svg";const node=document.createElementNS(svgNS,"svg");// Apply attributes
for(const attr in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,attr)){node.setAttribute(attr,this.attributes[attr]);}}for(let i=0;i<this.children.length;i++){node.appendChild(this.children[i].toNode());}return node;}toMarkup(){let markup="<svg xmlns=\"http://www.w3.org/2000/svg\"";// Apply attributes
for(const attr in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,attr)){markup+=" "+attr+"=\""+utils.escape(this.attributes[attr])+"\"";}}markup+=">";for(let i=0;i<this.children.length;i++){markup+=this.children[i].toMarkup();}markup+="</svg>";return markup;}}class PathNode{constructor(pathName,alternate){this.pathName=void 0;this.alternate=void 0;this.pathName=pathName;this.alternate=alternate;// Used only for \sqrt, \phase, & tall delims
}toNode(){const svgNS="http://www.w3.org/2000/svg";const node=document.createElementNS(svgNS,"path");if(this.alternate){node.setAttribute("d",this.alternate);}else {node.setAttribute("d",path[this.pathName]);}return node;}toMarkup(){if(this.alternate){return "<path d=\""+utils.escape(this.alternate)+"\"/>";}else {return "<path d=\""+utils.escape(path[this.pathName])+"\"/>";}}}class LineNode{constructor(attributes){this.attributes=void 0;this.attributes=attributes||{};}toNode(){const svgNS="http://www.w3.org/2000/svg";const node=document.createElementNS(svgNS,"line");// Apply attributes
for(const attr in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,attr)){node.setAttribute(attr,this.attributes[attr]);}}return node;}toMarkup(){let markup="<line";for(const attr in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,attr)){markup+=" "+attr+"=\""+utils.escape(this.attributes[attr])+"\"";}}markup+="/>";return markup;}}function assertSymbolDomNode(group){if(group instanceof SymbolNode){return group;}else {throw new Error("Expected symbolNode but got "+String(group)+".");}}function assertSpan(group){if(group instanceof Span){return group;}else {throw new Error("Expected span<HtmlDomNode> but got "+String(group)+".");}}/**
 * This file holds a list of all no-argument functions and single-character
 * symbols (like 'a' or ';').
 *
 * For each of the symbols, there are three properties they can have:
 * - font (required): the font to be used for this symbol. Either "main" (the
     normal font), or "ams" (the ams fonts).
 * - group (required): the ParseNode group type the symbol should have (i.e.
     "textord", "mathord", etc).
     See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types
 * - replace: the character that this symbol or function should be
 *   replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi
 *   character in the main font).
 *
 * The outermost map in the table indicates what mode the symbols should be
 * accepted in (e.g. "math" or "text").
 */// Some of these have a "-token" suffix since these are also used as `ParseNode`
// types for raw text tokens, and we want to avoid conflicts with higher-level
// `ParseNode` types. These `ParseNode`s are constructed within `Parser` by
// looking up the `symbols` map.
const ATOMS={"bin":1,"close":1,"inner":1,"open":1,"punct":1,"rel":1};const NON_ATOMS={"accent-token":1,"mathord":1,"op-token":1,"spacing":1,"textord":1};const symbols={"math":{},"text":{}};/* harmony default export */var src_symbols=symbols;/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */function defineSymbol(mode,font,group,replace,name,acceptUnicodeChar){symbols[mode][name]={font,group,replace};if(acceptUnicodeChar&&replace){symbols[mode][replace]=symbols[mode][name];}}// Some abbreviations for commonly used strings.
// This helps minify the code, and also spotting typos using jshint.
// modes:
const math="math";const symbols_text="text";// fonts:
const main="main";const ams="ams";// groups:
const accent="accent-token";const bin="bin";const symbols_close="close";const inner="inner";const mathord="mathord";const op="op-token";const symbols_open="open";const punct="punct";const rel="rel";const spacing="spacing";const textord="textord";// Now comes the symbol table
// Relation Symbols
defineSymbol(math,main,rel,"\u2261","\\equiv",true);defineSymbol(math,main,rel,"\u227a","\\prec",true);defineSymbol(math,main,rel,"\u227b","\\succ",true);defineSymbol(math,main,rel,"\u223c","\\sim",true);defineSymbol(math,main,rel,"\u22a5","\\perp");defineSymbol(math,main,rel,"\u2aaf","\\preceq",true);defineSymbol(math,main,rel,"\u2ab0","\\succeq",true);defineSymbol(math,main,rel,"\u2243","\\simeq",true);defineSymbol(math,main,rel,"\u2223","\\mid",true);defineSymbol(math,main,rel,"\u226a","\\ll",true);defineSymbol(math,main,rel,"\u226b","\\gg",true);defineSymbol(math,main,rel,"\u224d","\\asymp",true);defineSymbol(math,main,rel,"\u2225","\\parallel");defineSymbol(math,main,rel,"\u22c8","\\bowtie",true);defineSymbol(math,main,rel,"\u2323","\\smile",true);defineSymbol(math,main,rel,"\u2291","\\sqsubseteq",true);defineSymbol(math,main,rel,"\u2292","\\sqsupseteq",true);defineSymbol(math,main,rel,"\u2250","\\doteq",true);defineSymbol(math,main,rel,"\u2322","\\frown",true);defineSymbol(math,main,rel,"\u220b","\\ni",true);defineSymbol(math,main,rel,"\u221d","\\propto",true);defineSymbol(math,main,rel,"\u22a2","\\vdash",true);defineSymbol(math,main,rel,"\u22a3","\\dashv",true);defineSymbol(math,main,rel,"\u220b","\\owns");// Punctuation
defineSymbol(math,main,punct,"\u002e","\\ldotp");defineSymbol(math,main,punct,"\u22c5","\\cdotp");// Misc Symbols
defineSymbol(math,main,textord,"\u0023","\\#");defineSymbol(symbols_text,main,textord,"\u0023","\\#");defineSymbol(math,main,textord,"\u0026","\\&");defineSymbol(symbols_text,main,textord,"\u0026","\\&");defineSymbol(math,main,textord,"\u2135","\\aleph",true);defineSymbol(math,main,textord,"\u2200","\\forall",true);defineSymbol(math,main,textord,"\u210f","\\hbar",true);defineSymbol(math,main,textord,"\u2203","\\exists",true);defineSymbol(math,main,textord,"\u2207","\\nabla",true);defineSymbol(math,main,textord,"\u266d","\\flat",true);defineSymbol(math,main,textord,"\u2113","\\ell",true);defineSymbol(math,main,textord,"\u266e","\\natural",true);defineSymbol(math,main,textord,"\u2663","\\clubsuit",true);defineSymbol(math,main,textord,"\u2118","\\wp",true);defineSymbol(math,main,textord,"\u266f","\\sharp",true);defineSymbol(math,main,textord,"\u2662","\\diamondsuit",true);defineSymbol(math,main,textord,"\u211c","\\Re",true);defineSymbol(math,main,textord,"\u2661","\\heartsuit",true);defineSymbol(math,main,textord,"\u2111","\\Im",true);defineSymbol(math,main,textord,"\u2660","\\spadesuit",true);defineSymbol(math,main,textord,"\u00a7","\\S",true);defineSymbol(symbols_text,main,textord,"\u00a7","\\S");defineSymbol(math,main,textord,"\u00b6","\\P",true);defineSymbol(symbols_text,main,textord,"\u00b6","\\P");// Math and Text
defineSymbol(math,main,textord,"\u2020","\\dag");defineSymbol(symbols_text,main,textord,"\u2020","\\dag");defineSymbol(symbols_text,main,textord,"\u2020","\\textdagger");defineSymbol(math,main,textord,"\u2021","\\ddag");defineSymbol(symbols_text,main,textord,"\u2021","\\ddag");defineSymbol(symbols_text,main,textord,"\u2021","\\textdaggerdbl");// Large Delimiters
defineSymbol(math,main,symbols_close,"\u23b1","\\rmoustache",true);defineSymbol(math,main,symbols_open,"\u23b0","\\lmoustache",true);defineSymbol(math,main,symbols_close,"\u27ef","\\rgroup",true);defineSymbol(math,main,symbols_open,"\u27ee","\\lgroup",true);// Binary Operators
defineSymbol(math,main,bin,"\u2213","\\mp",true);defineSymbol(math,main,bin,"\u2296","\\ominus",true);defineSymbol(math,main,bin,"\u228e","\\uplus",true);defineSymbol(math,main,bin,"\u2293","\\sqcap",true);defineSymbol(math,main,bin,"\u2217","\\ast");defineSymbol(math,main,bin,"\u2294","\\sqcup",true);defineSymbol(math,main,bin,"\u25ef","\\bigcirc",true);defineSymbol(math,main,bin,"\u2219","\\bullet",true);defineSymbol(math,main,bin,"\u2021","\\ddagger");defineSymbol(math,main,bin,"\u2240","\\wr",true);defineSymbol(math,main,bin,"\u2a3f","\\amalg");defineSymbol(math,main,bin,"\u0026","\\And");// from amsmath
// Arrow Symbols
defineSymbol(math,main,rel,"\u27f5","\\longleftarrow",true);defineSymbol(math,main,rel,"\u21d0","\\Leftarrow",true);defineSymbol(math,main,rel,"\u27f8","\\Longleftarrow",true);defineSymbol(math,main,rel,"\u27f6","\\longrightarrow",true);defineSymbol(math,main,rel,"\u21d2","\\Rightarrow",true);defineSymbol(math,main,rel,"\u27f9","\\Longrightarrow",true);defineSymbol(math,main,rel,"\u2194","\\leftrightarrow",true);defineSymbol(math,main,rel,"\u27f7","\\longleftrightarrow",true);defineSymbol(math,main,rel,"\u21d4","\\Leftrightarrow",true);defineSymbol(math,main,rel,"\u27fa","\\Longleftrightarrow",true);defineSymbol(math,main,rel,"\u21a6","\\mapsto",true);defineSymbol(math,main,rel,"\u27fc","\\longmapsto",true);defineSymbol(math,main,rel,"\u2197","\\nearrow",true);defineSymbol(math,main,rel,"\u21a9","\\hookleftarrow",true);defineSymbol(math,main,rel,"\u21aa","\\hookrightarrow",true);defineSymbol(math,main,rel,"\u2198","\\searrow",true);defineSymbol(math,main,rel,"\u21bc","\\leftharpoonup",true);defineSymbol(math,main,rel,"\u21c0","\\rightharpoonup",true);defineSymbol(math,main,rel,"\u2199","\\swarrow",true);defineSymbol(math,main,rel,"\u21bd","\\leftharpoondown",true);defineSymbol(math,main,rel,"\u21c1","\\rightharpoondown",true);defineSymbol(math,main,rel,"\u2196","\\nwarrow",true);defineSymbol(math,main,rel,"\u21cc","\\rightleftharpoons",true);// AMS Negated Binary Relations
defineSymbol(math,ams,rel,"\u226e","\\nless",true);// Symbol names preceded by "@" each have a corresponding macro.
defineSymbol(math,ams,rel,"\ue010","\\@nleqslant");defineSymbol(math,ams,rel,"\ue011","\\@nleqq");defineSymbol(math,ams,rel,"\u2a87","\\lneq",true);defineSymbol(math,ams,rel,"\u2268","\\lneqq",true);defineSymbol(math,ams,rel,"\ue00c","\\@lvertneqq");defineSymbol(math,ams,rel,"\u22e6","\\lnsim",true);defineSymbol(math,ams,rel,"\u2a89","\\lnapprox",true);defineSymbol(math,ams,rel,"\u2280","\\nprec",true);// unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym.
defineSymbol(math,ams,rel,"\u22e0","\\npreceq",true);defineSymbol(math,ams,rel,"\u22e8","\\precnsim",true);defineSymbol(math,ams,rel,"\u2ab9","\\precnapprox",true);defineSymbol(math,ams,rel,"\u2241","\\nsim",true);defineSymbol(math,ams,rel,"\ue006","\\@nshortmid");defineSymbol(math,ams,rel,"\u2224","\\nmid",true);defineSymbol(math,ams,rel,"\u22ac","\\nvdash",true);defineSymbol(math,ams,rel,"\u22ad","\\nvDash",true);defineSymbol(math,ams,rel,"\u22ea","\\ntriangleleft");defineSymbol(math,ams,rel,"\u22ec","\\ntrianglelefteq",true);defineSymbol(math,ams,rel,"\u228a","\\subsetneq",true);defineSymbol(math,ams,rel,"\ue01a","\\@varsubsetneq");defineSymbol(math,ams,rel,"\u2acb","\\subsetneqq",true);defineSymbol(math,ams,rel,"\ue017","\\@varsubsetneqq");defineSymbol(math,ams,rel,"\u226f","\\ngtr",true);defineSymbol(math,ams,rel,"\ue00f","\\@ngeqslant");defineSymbol(math,ams,rel,"\ue00e","\\@ngeqq");defineSymbol(math,ams,rel,"\u2a88","\\gneq",true);defineSymbol(math,ams,rel,"\u2269","\\gneqq",true);defineSymbol(math,ams,rel,"\ue00d","\\@gvertneqq");defineSymbol(math,ams,rel,"\u22e7","\\gnsim",true);defineSymbol(math,ams,rel,"\u2a8a","\\gnapprox",true);defineSymbol(math,ams,rel,"\u2281","\\nsucc",true);// unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym.
defineSymbol(math,ams,rel,"\u22e1","\\nsucceq",true);defineSymbol(math,ams,rel,"\u22e9","\\succnsim",true);defineSymbol(math,ams,rel,"\u2aba","\\succnapprox",true);// unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym.
defineSymbol(math,ams,rel,"\u2246","\\ncong",true);defineSymbol(math,ams,rel,"\ue007","\\@nshortparallel");defineSymbol(math,ams,rel,"\u2226","\\nparallel",true);defineSymbol(math,ams,rel,"\u22af","\\nVDash",true);defineSymbol(math,ams,rel,"\u22eb","\\ntriangleright");defineSymbol(math,ams,rel,"\u22ed","\\ntrianglerighteq",true);defineSymbol(math,ams,rel,"\ue018","\\@nsupseteqq");defineSymbol(math,ams,rel,"\u228b","\\supsetneq",true);defineSymbol(math,ams,rel,"\ue01b","\\@varsupsetneq");defineSymbol(math,ams,rel,"\u2acc","\\supsetneqq",true);defineSymbol(math,ams,rel,"\ue019","\\@varsupsetneqq");defineSymbol(math,ams,rel,"\u22ae","\\nVdash",true);defineSymbol(math,ams,rel,"\u2ab5","\\precneqq",true);defineSymbol(math,ams,rel,"\u2ab6","\\succneqq",true);defineSymbol(math,ams,rel,"\ue016","\\@nsubseteqq");defineSymbol(math,ams,bin,"\u22b4","\\unlhd");defineSymbol(math,ams,bin,"\u22b5","\\unrhd");// AMS Negated Arrows
defineSymbol(math,ams,rel,"\u219a","\\nleftarrow",true);defineSymbol(math,ams,rel,"\u219b","\\nrightarrow",true);defineSymbol(math,ams,rel,"\u21cd","\\nLeftarrow",true);defineSymbol(math,ams,rel,"\u21cf","\\nRightarrow",true);defineSymbol(math,ams,rel,"\u21ae","\\nleftrightarrow",true);defineSymbol(math,ams,rel,"\u21ce","\\nLeftrightarrow",true);// AMS Misc
defineSymbol(math,ams,rel,"\u25b3","\\vartriangle");defineSymbol(math,ams,textord,"\u210f","\\hslash");defineSymbol(math,ams,textord,"\u25bd","\\triangledown");defineSymbol(math,ams,textord,"\u25ca","\\lozenge");defineSymbol(math,ams,textord,"\u24c8","\\circledS");defineSymbol(math,ams,textord,"\u00ae","\\circledR");defineSymbol(symbols_text,ams,textord,"\u00ae","\\circledR");defineSymbol(math,ams,textord,"\u2221","\\measuredangle",true);defineSymbol(math,ams,textord,"\u2204","\\nexists");defineSymbol(math,ams,textord,"\u2127","\\mho");defineSymbol(math,ams,textord,"\u2132","\\Finv",true);defineSymbol(math,ams,textord,"\u2141","\\Game",true);defineSymbol(math,ams,textord,"\u2035","\\backprime");defineSymbol(math,ams,textord,"\u25b2","\\blacktriangle");defineSymbol(math,ams,textord,"\u25bc","\\blacktriangledown");defineSymbol(math,ams,textord,"\u25a0","\\blacksquare");defineSymbol(math,ams,textord,"\u29eb","\\blacklozenge");defineSymbol(math,ams,textord,"\u2605","\\bigstar");defineSymbol(math,ams,textord,"\u2222","\\sphericalangle",true);defineSymbol(math,ams,textord,"\u2201","\\complement",true);// unicode-math maps U+F0 to \matheth. We map to AMS function \eth
defineSymbol(math,ams,textord,"\u00f0","\\eth",true);defineSymbol(symbols_text,main,textord,"\u00f0","\u00f0");defineSymbol(math,ams,textord,"\u2571","\\diagup");defineSymbol(math,ams,textord,"\u2572","\\diagdown");defineSymbol(math,ams,textord,"\u25a1","\\square");defineSymbol(math,ams,textord,"\u25a1","\\Box");defineSymbol(math,ams,textord,"\u25ca","\\Diamond");// unicode-math maps U+A5 to \mathyen. We map to AMS function \yen
defineSymbol(math,ams,textord,"\u00a5","\\yen",true);defineSymbol(symbols_text,ams,textord,"\u00a5","\\yen",true);defineSymbol(math,ams,textord,"\u2713","\\checkmark",true);defineSymbol(symbols_text,ams,textord,"\u2713","\\checkmark");// AMS Hebrew
defineSymbol(math,ams,textord,"\u2136","\\beth",true);defineSymbol(math,ams,textord,"\u2138","\\daleth",true);defineSymbol(math,ams,textord,"\u2137","\\gimel",true);// AMS Greek
defineSymbol(math,ams,textord,"\u03dd","\\digamma",true);defineSymbol(math,ams,textord,"\u03f0","\\varkappa");// AMS Delimiters
defineSymbol(math,ams,symbols_open,"\u250c","\\@ulcorner",true);defineSymbol(math,ams,symbols_close,"\u2510","\\@urcorner",true);defineSymbol(math,ams,symbols_open,"\u2514","\\@llcorner",true);defineSymbol(math,ams,symbols_close,"\u2518","\\@lrcorner",true);// AMS Binary Relations
defineSymbol(math,ams,rel,"\u2266","\\leqq",true);defineSymbol(math,ams,rel,"\u2a7d","\\leqslant",true);defineSymbol(math,ams,rel,"\u2a95","\\eqslantless",true);defineSymbol(math,ams,rel,"\u2272","\\lesssim",true);defineSymbol(math,ams,rel,"\u2a85","\\lessapprox",true);defineSymbol(math,ams,rel,"\u224a","\\approxeq",true);defineSymbol(math,ams,bin,"\u22d6","\\lessdot");defineSymbol(math,ams,rel,"\u22d8","\\lll",true);defineSymbol(math,ams,rel,"\u2276","\\lessgtr",true);defineSymbol(math,ams,rel,"\u22da","\\lesseqgtr",true);defineSymbol(math,ams,rel,"\u2a8b","\\lesseqqgtr",true);defineSymbol(math,ams,rel,"\u2251","\\doteqdot");defineSymbol(math,ams,rel,"\u2253","\\risingdotseq",true);defineSymbol(math,ams,rel,"\u2252","\\fallingdotseq",true);defineSymbol(math,ams,rel,"\u223d","\\backsim",true);defineSymbol(math,ams,rel,"\u22cd","\\backsimeq",true);defineSymbol(math,ams,rel,"\u2ac5","\\subseteqq",true);defineSymbol(math,ams,rel,"\u22d0","\\Subset",true);defineSymbol(math,ams,rel,"\u228f","\\sqsubset",true);defineSymbol(math,ams,rel,"\u227c","\\preccurlyeq",true);defineSymbol(math,ams,rel,"\u22de","\\curlyeqprec",true);defineSymbol(math,ams,rel,"\u227e","\\precsim",true);defineSymbol(math,ams,rel,"\u2ab7","\\precapprox",true);defineSymbol(math,ams,rel,"\u22b2","\\vartriangleleft");defineSymbol(math,ams,rel,"\u22b4","\\trianglelefteq");defineSymbol(math,ams,rel,"\u22a8","\\vDash",true);defineSymbol(math,ams,rel,"\u22aa","\\Vvdash",true);defineSymbol(math,ams,rel,"\u2323","\\smallsmile");defineSymbol(math,ams,rel,"\u2322","\\smallfrown");defineSymbol(math,ams,rel,"\u224f","\\bumpeq",true);defineSymbol(math,ams,rel,"\u224e","\\Bumpeq",true);defineSymbol(math,ams,rel,"\u2267","\\geqq",true);defineSymbol(math,ams,rel,"\u2a7e","\\geqslant",true);defineSymbol(math,ams,rel,"\u2a96","\\eqslantgtr",true);defineSymbol(math,ams,rel,"\u2273","\\gtrsim",true);defineSymbol(math,ams,rel,"\u2a86","\\gtrapprox",true);defineSymbol(math,ams,bin,"\u22d7","\\gtrdot");defineSymbol(math,ams,rel,"\u22d9","\\ggg",true);defineSymbol(math,ams,rel,"\u2277","\\gtrless",true);defineSymbol(math,ams,rel,"\u22db","\\gtreqless",true);defineSymbol(math,ams,rel,"\u2a8c","\\gtreqqless",true);defineSymbol(math,ams,rel,"\u2256","\\eqcirc",true);defineSymbol(math,ams,rel,"\u2257","\\circeq",true);defineSymbol(math,ams,rel,"\u225c","\\triangleq",true);defineSymbol(math,ams,rel,"\u223c","\\thicksim");defineSymbol(math,ams,rel,"\u2248","\\thickapprox");defineSymbol(math,ams,rel,"\u2ac6","\\supseteqq",true);defineSymbol(math,ams,rel,"\u22d1","\\Supset",true);defineSymbol(math,ams,rel,"\u2290","\\sqsupset",true);defineSymbol(math,ams,rel,"\u227d","\\succcurlyeq",true);defineSymbol(math,ams,rel,"\u22df","\\curlyeqsucc",true);defineSymbol(math,ams,rel,"\u227f","\\succsim",true);defineSymbol(math,ams,rel,"\u2ab8","\\succapprox",true);defineSymbol(math,ams,rel,"\u22b3","\\vartriangleright");defineSymbol(math,ams,rel,"\u22b5","\\trianglerighteq");defineSymbol(math,ams,rel,"\u22a9","\\Vdash",true);defineSymbol(math,ams,rel,"\u2223","\\shortmid");defineSymbol(math,ams,rel,"\u2225","\\shortparallel");defineSymbol(math,ams,rel,"\u226c","\\between",true);defineSymbol(math,ams,rel,"\u22d4","\\pitchfork",true);defineSymbol(math,ams,rel,"\u221d","\\varpropto");defineSymbol(math,ams,rel,"\u25c0","\\blacktriangleleft");// unicode-math says that \therefore is a mathord atom.
// We kept the amssymb atom type, which is rel.
defineSymbol(math,ams,rel,"\u2234","\\therefore",true);defineSymbol(math,ams,rel,"\u220d","\\backepsilon");defineSymbol(math,ams,rel,"\u25b6","\\blacktriangleright");// unicode-math says that \because is a mathord atom.
// We kept the amssymb atom type, which is rel.
defineSymbol(math,ams,rel,"\u2235","\\because",true);defineSymbol(math,ams,rel,"\u22d8","\\llless");defineSymbol(math,ams,rel,"\u22d9","\\gggtr");defineSymbol(math,ams,bin,"\u22b2","\\lhd");defineSymbol(math,ams,bin,"\u22b3","\\rhd");defineSymbol(math,ams,rel,"\u2242","\\eqsim",true);defineSymbol(math,main,rel,"\u22c8","\\Join");defineSymbol(math,ams,rel,"\u2251","\\Doteq",true);// AMS Binary Operators
defineSymbol(math,ams,bin,"\u2214","\\dotplus",true);defineSymbol(math,ams,bin,"\u2216","\\smallsetminus");defineSymbol(math,ams,bin,"\u22d2","\\Cap",true);defineSymbol(math,ams,bin,"\u22d3","\\Cup",true);defineSymbol(math,ams,bin,"\u2a5e","\\doublebarwedge",true);defineSymbol(math,ams,bin,"\u229f","\\boxminus",true);defineSymbol(math,ams,bin,"\u229e","\\boxplus",true);defineSymbol(math,ams,bin,"\u22c7","\\divideontimes",true);defineSymbol(math,ams,bin,"\u22c9","\\ltimes",true);defineSymbol(math,ams,bin,"\u22ca","\\rtimes",true);defineSymbol(math,ams,bin,"\u22cb","\\leftthreetimes",true);defineSymbol(math,ams,bin,"\u22cc","\\rightthreetimes",true);defineSymbol(math,ams,bin,"\u22cf","\\curlywedge",true);defineSymbol(math,ams,bin,"\u22ce","\\curlyvee",true);defineSymbol(math,ams,bin,"\u229d","\\circleddash",true);defineSymbol(math,ams,bin,"\u229b","\\circledast",true);defineSymbol(math,ams,bin,"\u22c5","\\centerdot");defineSymbol(math,ams,bin,"\u22ba","\\intercal",true);defineSymbol(math,ams,bin,"\u22d2","\\doublecap");defineSymbol(math,ams,bin,"\u22d3","\\doublecup");defineSymbol(math,ams,bin,"\u22a0","\\boxtimes",true);// AMS Arrows
// Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
// We'll map it to AMS function \dashrightarrow. It produces the same atom.
defineSymbol(math,ams,rel,"\u21e2","\\dashrightarrow",true);// unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym.
defineSymbol(math,ams,rel,"\u21e0","\\dashleftarrow",true);defineSymbol(math,ams,rel,"\u21c7","\\leftleftarrows",true);defineSymbol(math,ams,rel,"\u21c6","\\leftrightarrows",true);defineSymbol(math,ams,rel,"\u21da","\\Lleftarrow",true);defineSymbol(math,ams,rel,"\u219e","\\twoheadleftarrow",true);defineSymbol(math,ams,rel,"\u21a2","\\leftarrowtail",true);defineSymbol(math,ams,rel,"\u21ab","\\looparrowleft",true);defineSymbol(math,ams,rel,"\u21cb","\\leftrightharpoons",true);defineSymbol(math,ams,rel,"\u21b6","\\curvearrowleft",true);// unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym.
defineSymbol(math,ams,rel,"\u21ba","\\circlearrowleft",true);defineSymbol(math,ams,rel,"\u21b0","\\Lsh",true);defineSymbol(math,ams,rel,"\u21c8","\\upuparrows",true);defineSymbol(math,ams,rel,"\u21bf","\\upharpoonleft",true);defineSymbol(math,ams,rel,"\u21c3","\\downharpoonleft",true);defineSymbol(math,main,rel,"\u22b6","\\origof",true);// not in font
defineSymbol(math,main,rel,"\u22b7","\\imageof",true);// not in font
defineSymbol(math,ams,rel,"\u22b8","\\multimap",true);defineSymbol(math,ams,rel,"\u21ad","\\leftrightsquigarrow",true);defineSymbol(math,ams,rel,"\u21c9","\\rightrightarrows",true);defineSymbol(math,ams,rel,"\u21c4","\\rightleftarrows",true);defineSymbol(math,ams,rel,"\u21a0","\\twoheadrightarrow",true);defineSymbol(math,ams,rel,"\u21a3","\\rightarrowtail",true);defineSymbol(math,ams,rel,"\u21ac","\\looparrowright",true);defineSymbol(math,ams,rel,"\u21b7","\\curvearrowright",true);// unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym.
defineSymbol(math,ams,rel,"\u21bb","\\circlearrowright",true);defineSymbol(math,ams,rel,"\u21b1","\\Rsh",true);defineSymbol(math,ams,rel,"\u21ca","\\downdownarrows",true);defineSymbol(math,ams,rel,"\u21be","\\upharpoonright",true);defineSymbol(math,ams,rel,"\u21c2","\\downharpoonright",true);defineSymbol(math,ams,rel,"\u21dd","\\rightsquigarrow",true);defineSymbol(math,ams,rel,"\u21dd","\\leadsto");defineSymbol(math,ams,rel,"\u21db","\\Rrightarrow",true);defineSymbol(math,ams,rel,"\u21be","\\restriction");defineSymbol(math,main,textord,"\u2018","`");defineSymbol(math,main,textord,"$","\\$");defineSymbol(symbols_text,main,textord,"$","\\$");defineSymbol(symbols_text,main,textord,"$","\\textdollar");defineSymbol(math,main,textord,"%","\\%");defineSymbol(symbols_text,main,textord,"%","\\%");defineSymbol(math,main,textord,"_","\\_");defineSymbol(symbols_text,main,textord,"_","\\_");defineSymbol(symbols_text,main,textord,"_","\\textunderscore");defineSymbol(math,main,textord,"\u2220","\\angle",true);defineSymbol(math,main,textord,"\u221e","\\infty",true);defineSymbol(math,main,textord,"\u2032","\\prime");defineSymbol(math,main,textord,"\u25b3","\\triangle");defineSymbol(math,main,textord,"\u0393","\\Gamma",true);defineSymbol(math,main,textord,"\u0394","\\Delta",true);defineSymbol(math,main,textord,"\u0398","\\Theta",true);defineSymbol(math,main,textord,"\u039b","\\Lambda",true);defineSymbol(math,main,textord,"\u039e","\\Xi",true);defineSymbol(math,main,textord,"\u03a0","\\Pi",true);defineSymbol(math,main,textord,"\u03a3","\\Sigma",true);defineSymbol(math,main,textord,"\u03a5","\\Upsilon",true);defineSymbol(math,main,textord,"\u03a6","\\Phi",true);defineSymbol(math,main,textord,"\u03a8","\\Psi",true);defineSymbol(math,main,textord,"\u03a9","\\Omega",true);defineSymbol(math,main,textord,"A","\u0391");defineSymbol(math,main,textord,"B","\u0392");defineSymbol(math,main,textord,"E","\u0395");defineSymbol(math,main,textord,"Z","\u0396");defineSymbol(math,main,textord,"H","\u0397");defineSymbol(math,main,textord,"I","\u0399");defineSymbol(math,main,textord,"K","\u039A");defineSymbol(math,main,textord,"M","\u039C");defineSymbol(math,main,textord,"N","\u039D");defineSymbol(math,main,textord,"O","\u039F");defineSymbol(math,main,textord,"P","\u03A1");defineSymbol(math,main,textord,"T","\u03A4");defineSymbol(math,main,textord,"X","\u03A7");defineSymbol(math,main,textord,"\u00ac","\\neg",true);defineSymbol(math,main,textord,"\u00ac","\\lnot");defineSymbol(math,main,textord,"\u22a4","\\top");defineSymbol(math,main,textord,"\u22a5","\\bot");defineSymbol(math,main,textord,"\u2205","\\emptyset");defineSymbol(math,ams,textord,"\u2205","\\varnothing");defineSymbol(math,main,mathord,"\u03b1","\\alpha",true);defineSymbol(math,main,mathord,"\u03b2","\\beta",true);defineSymbol(math,main,mathord,"\u03b3","\\gamma",true);defineSymbol(math,main,mathord,"\u03b4","\\delta",true);defineSymbol(math,main,mathord,"\u03f5","\\epsilon",true);defineSymbol(math,main,mathord,"\u03b6","\\zeta",true);defineSymbol(math,main,mathord,"\u03b7","\\eta",true);defineSymbol(math,main,mathord,"\u03b8","\\theta",true);defineSymbol(math,main,mathord,"\u03b9","\\iota",true);defineSymbol(math,main,mathord,"\u03ba","\\kappa",true);defineSymbol(math,main,mathord,"\u03bb","\\lambda",true);defineSymbol(math,main,mathord,"\u03bc","\\mu",true);defineSymbol(math,main,mathord,"\u03bd","\\nu",true);defineSymbol(math,main,mathord,"\u03be","\\xi",true);defineSymbol(math,main,mathord,"\u03bf","\\omicron",true);defineSymbol(math,main,mathord,"\u03c0","\\pi",true);defineSymbol(math,main,mathord,"\u03c1","\\rho",true);defineSymbol(math,main,mathord,"\u03c3","\\sigma",true);defineSymbol(math,main,mathord,"\u03c4","\\tau",true);defineSymbol(math,main,mathord,"\u03c5","\\upsilon",true);defineSymbol(math,main,mathord,"\u03d5","\\phi",true);defineSymbol(math,main,mathord,"\u03c7","\\chi",true);defineSymbol(math,main,mathord,"\u03c8","\\psi",true);defineSymbol(math,main,mathord,"\u03c9","\\omega",true);defineSymbol(math,main,mathord,"\u03b5","\\varepsilon",true);defineSymbol(math,main,mathord,"\u03d1","\\vartheta",true);defineSymbol(math,main,mathord,"\u03d6","\\varpi",true);defineSymbol(math,main,mathord,"\u03f1","\\varrho",true);defineSymbol(math,main,mathord,"\u03c2","\\varsigma",true);defineSymbol(math,main,mathord,"\u03c6","\\varphi",true);defineSymbol(math,main,bin,"\u2217","*",true);defineSymbol(math,main,bin,"+","+");defineSymbol(math,main,bin,"\u2212","-",true);defineSymbol(math,main,bin,"\u22c5","\\cdot",true);defineSymbol(math,main,bin,"\u2218","\\circ",true);defineSymbol(math,main,bin,"\u00f7","\\div",true);defineSymbol(math,main,bin,"\u00b1","\\pm",true);defineSymbol(math,main,bin,"\u00d7","\\times",true);defineSymbol(math,main,bin,"\u2229","\\cap",true);defineSymbol(math,main,bin,"\u222a","\\cup",true);defineSymbol(math,main,bin,"\u2216","\\setminus",true);defineSymbol(math,main,bin,"\u2227","\\land");defineSymbol(math,main,bin,"\u2228","\\lor");defineSymbol(math,main,bin,"\u2227","\\wedge",true);defineSymbol(math,main,bin,"\u2228","\\vee",true);defineSymbol(math,main,textord,"\u221a","\\surd");defineSymbol(math,main,symbols_open,"\u27e8","\\langle",true);defineSymbol(math,main,symbols_open,"\u2223","\\lvert");defineSymbol(math,main,symbols_open,"\u2225","\\lVert");defineSymbol(math,main,symbols_close,"?","?");defineSymbol(math,main,symbols_close,"!","!");defineSymbol(math,main,symbols_close,"\u27e9","\\rangle",true);defineSymbol(math,main,symbols_close,"\u2223","\\rvert");defineSymbol(math,main,symbols_close,"\u2225","\\rVert");defineSymbol(math,main,rel,"=","=");defineSymbol(math,main,rel,":",":");defineSymbol(math,main,rel,"\u2248","\\approx",true);defineSymbol(math,main,rel,"\u2245","\\cong",true);defineSymbol(math,main,rel,"\u2265","\\ge");defineSymbol(math,main,rel,"\u2265","\\geq",true);defineSymbol(math,main,rel,"\u2190","\\gets");defineSymbol(math,main,rel,">","\\gt",true);defineSymbol(math,main,rel,"\u2208","\\in",true);defineSymbol(math,main,rel,"\ue020","\\@not");defineSymbol(math,main,rel,"\u2282","\\subset",true);defineSymbol(math,main,rel,"\u2283","\\supset",true);defineSymbol(math,main,rel,"\u2286","\\subseteq",true);defineSymbol(math,main,rel,"\u2287","\\supseteq",true);defineSymbol(math,ams,rel,"\u2288","\\nsubseteq",true);defineSymbol(math,ams,rel,"\u2289","\\nsupseteq",true);defineSymbol(math,main,rel,"\u22a8","\\models");defineSymbol(math,main,rel,"\u2190","\\leftarrow",true);defineSymbol(math,main,rel,"\u2264","\\le");defineSymbol(math,main,rel,"\u2264","\\leq",true);defineSymbol(math,main,rel,"<","\\lt",true);defineSymbol(math,main,rel,"\u2192","\\rightarrow",true);defineSymbol(math,main,rel,"\u2192","\\to");defineSymbol(math,ams,rel,"\u2271","\\ngeq",true);defineSymbol(math,ams,rel,"\u2270","\\nleq",true);defineSymbol(math,main,spacing,"\u00a0","\\ ");defineSymbol(math,main,spacing,"\u00a0","\\space");// Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{%
defineSymbol(math,main,spacing,"\u00a0","\\nobreakspace");defineSymbol(symbols_text,main,spacing,"\u00a0","\\ ");defineSymbol(symbols_text,main,spacing,"\u00a0"," ");defineSymbol(symbols_text,main,spacing,"\u00a0","\\space");defineSymbol(symbols_text,main,spacing,"\u00a0","\\nobreakspace");defineSymbol(math,main,spacing,null,"\\nobreak");defineSymbol(math,main,spacing,null,"\\allowbreak");defineSymbol(math,main,punct,",",",");defineSymbol(math,main,punct,";",";");defineSymbol(math,ams,bin,"\u22bc","\\barwedge",true);defineSymbol(math,ams,bin,"\u22bb","\\veebar",true);defineSymbol(math,main,bin,"\u2299","\\odot",true);defineSymbol(math,main,bin,"\u2295","\\oplus",true);defineSymbol(math,main,bin,"\u2297","\\otimes",true);defineSymbol(math,main,textord,"\u2202","\\partial",true);defineSymbol(math,main,bin,"\u2298","\\oslash",true);defineSymbol(math,ams,bin,"\u229a","\\circledcirc",true);defineSymbol(math,ams,bin,"\u22a1","\\boxdot",true);defineSymbol(math,main,bin,"\u25b3","\\bigtriangleup");defineSymbol(math,main,bin,"\u25bd","\\bigtriangledown");defineSymbol(math,main,bin,"\u2020","\\dagger");defineSymbol(math,main,bin,"\u22c4","\\diamond");defineSymbol(math,main,bin,"\u22c6","\\star");defineSymbol(math,main,bin,"\u25c3","\\triangleleft");defineSymbol(math,main,bin,"\u25b9","\\triangleright");defineSymbol(math,main,symbols_open,"{","\\{");defineSymbol(symbols_text,main,textord,"{","\\{");defineSymbol(symbols_text,main,textord,"{","\\textbraceleft");defineSymbol(math,main,symbols_close,"}","\\}");defineSymbol(symbols_text,main,textord,"}","\\}");defineSymbol(symbols_text,main,textord,"}","\\textbraceright");defineSymbol(math,main,symbols_open,"{","\\lbrace");defineSymbol(math,main,symbols_close,"}","\\rbrace");defineSymbol(math,main,symbols_open,"[","\\lbrack",true);defineSymbol(symbols_text,main,textord,"[","\\lbrack",true);defineSymbol(math,main,symbols_close,"]","\\rbrack",true);defineSymbol(symbols_text,main,textord,"]","\\rbrack",true);defineSymbol(math,main,symbols_open,"(","\\lparen",true);defineSymbol(math,main,symbols_close,")","\\rparen",true);defineSymbol(symbols_text,main,textord,"<","\\textless",true);// in T1 fontenc
defineSymbol(symbols_text,main,textord,">","\\textgreater",true);// in T1 fontenc
defineSymbol(math,main,symbols_open,"\u230a","\\lfloor",true);defineSymbol(math,main,symbols_close,"\u230b","\\rfloor",true);defineSymbol(math,main,symbols_open,"\u2308","\\lceil",true);defineSymbol(math,main,symbols_close,"\u2309","\\rceil",true);defineSymbol(math,main,textord,"\\","\\backslash");defineSymbol(math,main,textord,"\u2223","|");defineSymbol(math,main,textord,"\u2223","\\vert");defineSymbol(symbols_text,main,textord,"|","\\textbar",true);// in T1 fontenc
defineSymbol(math,main,textord,"\u2225","\\|");defineSymbol(math,main,textord,"\u2225","\\Vert");defineSymbol(symbols_text,main,textord,"\u2225","\\textbardbl");defineSymbol(symbols_text,main,textord,"~","\\textasciitilde");defineSymbol(symbols_text,main,textord,"\\","\\textbackslash");defineSymbol(symbols_text,main,textord,"^","\\textasciicircum");defineSymbol(math,main,rel,"\u2191","\\uparrow",true);defineSymbol(math,main,rel,"\u21d1","\\Uparrow",true);defineSymbol(math,main,rel,"\u2193","\\downarrow",true);defineSymbol(math,main,rel,"\u21d3","\\Downarrow",true);defineSymbol(math,main,rel,"\u2195","\\updownarrow",true);defineSymbol(math,main,rel,"\u21d5","\\Updownarrow",true);defineSymbol(math,main,op,"\u2210","\\coprod");defineSymbol(math,main,op,"\u22c1","\\bigvee");defineSymbol(math,main,op,"\u22c0","\\bigwedge");defineSymbol(math,main,op,"\u2a04","\\biguplus");defineSymbol(math,main,op,"\u22c2","\\bigcap");defineSymbol(math,main,op,"\u22c3","\\bigcup");defineSymbol(math,main,op,"\u222b","\\int");defineSymbol(math,main,op,"\u222b","\\intop");defineSymbol(math,main,op,"\u222c","\\iint");defineSymbol(math,main,op,"\u222d","\\iiint");defineSymbol(math,main,op,"\u220f","\\prod");defineSymbol(math,main,op,"\u2211","\\sum");defineSymbol(math,main,op,"\u2a02","\\bigotimes");defineSymbol(math,main,op,"\u2a01","\\bigoplus");defineSymbol(math,main,op,"\u2a00","\\bigodot");defineSymbol(math,main,op,"\u222e","\\oint");defineSymbol(math,main,op,"\u222f","\\oiint");defineSymbol(math,main,op,"\u2230","\\oiiint");defineSymbol(math,main,op,"\u2a06","\\bigsqcup");defineSymbol(math,main,op,"\u222b","\\smallint");defineSymbol(symbols_text,main,inner,"\u2026","\\textellipsis");defineSymbol(math,main,inner,"\u2026","\\mathellipsis");defineSymbol(symbols_text,main,inner,"\u2026","\\ldots",true);defineSymbol(math,main,inner,"\u2026","\\ldots",true);defineSymbol(math,main,inner,"\u22ef","\\@cdots",true);defineSymbol(math,main,inner,"\u22f1","\\ddots",true);// \vdots is a macro that uses one of these two symbols (with made-up names):
defineSymbol(math,main,textord,"\u22ee","\\varvdots");defineSymbol(symbols_text,main,textord,"\u22ee","\\varvdots");defineSymbol(math,main,accent,"\u02ca","\\acute");defineSymbol(math,main,accent,"\u02cb","\\grave");defineSymbol(math,main,accent,"\u00a8","\\ddot");defineSymbol(math,main,accent,"\u007e","\\tilde");defineSymbol(math,main,accent,"\u02c9","\\bar");defineSymbol(math,main,accent,"\u02d8","\\breve");defineSymbol(math,main,accent,"\u02c7","\\check");defineSymbol(math,main,accent,"\u005e","\\hat");defineSymbol(math,main,accent,"\u20d7","\\vec");defineSymbol(math,main,accent,"\u02d9","\\dot");defineSymbol(math,main,accent,"\u02da","\\mathring");// \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA
defineSymbol(math,main,mathord,"\ue131","\\@imath");defineSymbol(math,main,mathord,"\ue237","\\@jmath");defineSymbol(math,main,textord,"\u0131","\u0131");defineSymbol(math,main,textord,"\u0237","\u0237");defineSymbol(symbols_text,main,textord,"\u0131","\\i",true);defineSymbol(symbols_text,main,textord,"\u0237","\\j",true);defineSymbol(symbols_text,main,textord,"\u00df","\\ss",true);defineSymbol(symbols_text,main,textord,"\u00e6","\\ae",true);defineSymbol(symbols_text,main,textord,"\u0153","\\oe",true);defineSymbol(symbols_text,main,textord,"\u00f8","\\o",true);defineSymbol(symbols_text,main,textord,"\u00c6","\\AE",true);defineSymbol(symbols_text,main,textord,"\u0152","\\OE",true);defineSymbol(symbols_text,main,textord,"\u00d8","\\O",true);defineSymbol(symbols_text,main,accent,"\u02ca","\\'");// acute
defineSymbol(symbols_text,main,accent,"\u02cb","\\`");// grave
defineSymbol(symbols_text,main,accent,"\u02c6","\\^");// circumflex
defineSymbol(symbols_text,main,accent,"\u02dc","\\~");// tilde
defineSymbol(symbols_text,main,accent,"\u02c9","\\=");// macron
defineSymbol(symbols_text,main,accent,"\u02d8","\\u");// breve
defineSymbol(symbols_text,main,accent,"\u02d9","\\.");// dot above
defineSymbol(symbols_text,main,accent,"\u00b8","\\c");// cedilla
defineSymbol(symbols_text,main,accent,"\u02da","\\r");// ring above
defineSymbol(symbols_text,main,accent,"\u02c7","\\v");// caron
defineSymbol(symbols_text,main,accent,"\u00a8",'\\"');// diaeresis
defineSymbol(symbols_text,main,accent,"\u02dd","\\H");// double acute
defineSymbol(symbols_text,main,accent,"\u25ef","\\textcircled");// \bigcirc glyph
// These ligatures are detected and created in Parser.js's `formLigatures`.
const ligatures={"--":true,"---":true,"``":true,"''":true};defineSymbol(symbols_text,main,textord,"\u2013","--",true);defineSymbol(symbols_text,main,textord,"\u2013","\\textendash");defineSymbol(symbols_text,main,textord,"\u2014","---",true);defineSymbol(symbols_text,main,textord,"\u2014","\\textemdash");defineSymbol(symbols_text,main,textord,"\u2018","`",true);defineSymbol(symbols_text,main,textord,"\u2018","\\textquoteleft");defineSymbol(symbols_text,main,textord,"\u2019","'",true);defineSymbol(symbols_text,main,textord,"\u2019","\\textquoteright");defineSymbol(symbols_text,main,textord,"\u201c","``",true);defineSymbol(symbols_text,main,textord,"\u201c","\\textquotedblleft");defineSymbol(symbols_text,main,textord,"\u201d","''",true);defineSymbol(symbols_text,main,textord,"\u201d","\\textquotedblright");//  \degree from gensymb package
defineSymbol(math,main,textord,"\u00b0","\\degree",true);defineSymbol(symbols_text,main,textord,"\u00b0","\\degree");// \textdegree from inputenc package
defineSymbol(symbols_text,main,textord,"\u00b0","\\textdegree",true);// TODO: In LaTeX, \pounds can generate a different character in text and math
// mode, but among our fonts, only Main-Regular defines this character "163".
defineSymbol(math,main,textord,"\u00a3","\\pounds");defineSymbol(math,main,textord,"\u00a3","\\mathsterling",true);defineSymbol(symbols_text,main,textord,"\u00a3","\\pounds");defineSymbol(symbols_text,main,textord,"\u00a3","\\textsterling",true);defineSymbol(math,ams,textord,"\u2720","\\maltese");defineSymbol(symbols_text,ams,textord,"\u2720","\\maltese");// There are lots of symbols which are the same, so we add them in afterwards.
// All of these are textords in math mode
const mathTextSymbols="0123456789/@.\"";for(let i=0;i<mathTextSymbols.length;i++){const ch=mathTextSymbols.charAt(i);defineSymbol(math,main,textord,ch,ch);}// All of these are textords in text mode
const textSymbols="0123456789!@*()-=+\";:?/.,";for(let i=0;i<textSymbols.length;i++){const ch=textSymbols.charAt(i);defineSymbol(symbols_text,main,textord,ch,ch);}// All of these are textords in text mode, and mathords in math mode
const letters="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let i=0;i<letters.length;i++){const ch=letters.charAt(i);defineSymbol(math,main,mathord,ch,ch);defineSymbol(symbols_text,main,textord,ch,ch);}// Blackboard bold and script letters in Unicode range
defineSymbol(math,ams,textord,"C","\u2102");// blackboard bold
defineSymbol(symbols_text,ams,textord,"C","\u2102");defineSymbol(math,ams,textord,"H","\u210D");defineSymbol(symbols_text,ams,textord,"H","\u210D");defineSymbol(math,ams,textord,"N","\u2115");defineSymbol(symbols_text,ams,textord,"N","\u2115");defineSymbol(math,ams,textord,"P","\u2119");defineSymbol(symbols_text,ams,textord,"P","\u2119");defineSymbol(math,ams,textord,"Q","\u211A");defineSymbol(symbols_text,ams,textord,"Q","\u211A");defineSymbol(math,ams,textord,"R","\u211D");defineSymbol(symbols_text,ams,textord,"R","\u211D");defineSymbol(math,ams,textord,"Z","\u2124");defineSymbol(symbols_text,ams,textord,"Z","\u2124");defineSymbol(math,main,mathord,"h","\u210E");// italic h, Planck constant
defineSymbol(symbols_text,main,mathord,"h","\u210E");// The next loop loads wide (surrogate pair) characters.
// We support some letters in the Unicode range U+1D400 to U+1D7FF,
// Mathematical Alphanumeric Symbols.
// Some editors do not deal well with wide characters. So don't write the
// string into this file. Instead, create the string from the surrogate pair.
let wideChar="";for(let i=0;i<letters.length;i++){const ch=letters.charAt(i);// The hex numbers in the next line are a surrogate pair.
// 0xD835 is the high surrogate for all letters in the range we support.
// 0xDC00 is the low surrogate for bold A.
wideChar=String.fromCharCode(0xD835,0xDC00+i);// A-Z a-z bold
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDC34+i);// A-Z a-z italic
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDC68+i);// A-Z a-z bold italic
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDD04+i);// A-Z a-z Fraktur
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDD6C+i);// A-Z a-z bold Fraktur
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDDA0+i);// A-Z a-z sans-serif
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDDD4+i);// A-Z a-z sans bold
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDE08+i);// A-Z a-z sans italic
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDE70+i);// A-Z a-z monospace
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);if(i<26){// KaTeX fonts have only capital letters for blackboard bold and script.
// See exception for k below.
wideChar=String.fromCharCode(0xD835,0xDD38+i);// A-Z double struck
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDC9C+i);// A-Z script
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);}// TODO: Add bold script when it is supported by a KaTeX font.
}// "k" is the only double struck lower case letter in the KaTeX fonts.
wideChar=String.fromCharCode(0xD835,0xDD5C);// k double struck
defineSymbol(math,main,mathord,"k",wideChar);defineSymbol(symbols_text,main,textord,"k",wideChar);// Next, some wide character numerals
for(let i=0;i<10;i++){const ch=i.toString();wideChar=String.fromCharCode(0xD835,0xDFCE+i);// 0-9 bold
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDFE2+i);// 0-9 sans serif
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDFEC+i);// 0-9 bold sans
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);wideChar=String.fromCharCode(0xD835,0xDFF6+i);// 0-9 monospace
defineSymbol(math,main,mathord,ch,wideChar);defineSymbol(symbols_text,main,textord,ch,wideChar);}// We add these Latin-1 letters as symbols for backwards-compatibility,
// but they are not actually in the font, nor are they supported by the
// Unicode accent mechanism, so they fall back to Times font and look ugly.
// TODO(edemaine): Fix this.
const extraLatin="\u00d0\u00de\u00fe";for(let i=0;i<extraLatin.length;i++){const ch=extraLatin.charAt(i);defineSymbol(math,main,mathord,ch,ch);defineSymbol(symbols_text,main,textord,ch,ch);}/**
 * This file provides support for Unicode range U+1D400 to U+1D7FF,
 * Mathematical Alphanumeric Symbols.
 *
 * Function wideCharacterFont takes a wide character as input and returns
 * the font information necessary to render it properly.
 *//**
 * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf
 * That document sorts characters into groups by font type, say bold or italic.
 *
 * In the arrays below, each subarray consists three elements:
 *      * The CSS class of that group when in math mode.
 *      * The CSS class of that group when in text mode.
 *      * The font name, so that KaTeX can get font metrics.
 */const wideLatinLetterData=[["mathbf","textbf","Main-Bold"],// A-Z bold upright
["mathbf","textbf","Main-Bold"],// a-z bold upright
["mathnormal","textit","Math-Italic"],// A-Z italic
["mathnormal","textit","Math-Italic"],// a-z italic
["boldsymbol","boldsymbol","Main-BoldItalic"],// A-Z bold italic
["boldsymbol","boldsymbol","Main-BoldItalic"],// a-z bold italic
// Map fancy A-Z letters to script, not calligraphic.
// This aligns with unicode-math and math fonts (except Cambria Math).
["mathscr","textscr","Script-Regular"],// A-Z script
["","",""],// a-z script.  No font
["","",""],// A-Z bold script. No font
["","",""],// a-z bold script. No font
["mathfrak","textfrak","Fraktur-Regular"],// A-Z Fraktur
["mathfrak","textfrak","Fraktur-Regular"],// a-z Fraktur
["mathbb","textbb","AMS-Regular"],// A-Z double-struck
["mathbb","textbb","AMS-Regular"],// k double-struck
// Note that we are using a bold font, but font metrics for regular Fraktur.
["mathboldfrak","textboldfrak","Fraktur-Regular"],// A-Z bold Fraktur
["mathboldfrak","textboldfrak","Fraktur-Regular"],// a-z bold Fraktur
["mathsf","textsf","SansSerif-Regular"],// A-Z sans-serif
["mathsf","textsf","SansSerif-Regular"],// a-z sans-serif
["mathboldsf","textboldsf","SansSerif-Bold"],// A-Z bold sans-serif
["mathboldsf","textboldsf","SansSerif-Bold"],// a-z bold sans-serif
["mathitsf","textitsf","SansSerif-Italic"],// A-Z italic sans-serif
["mathitsf","textitsf","SansSerif-Italic"],// a-z italic sans-serif
["","",""],// A-Z bold italic sans. No font
["","",""],// a-z bold italic sans. No font
["mathtt","texttt","Typewriter-Regular"],// A-Z monospace
["mathtt","texttt","Typewriter-Regular"]// a-z monospace
];const wideNumeralData=[["mathbf","textbf","Main-Bold"],// 0-9 bold
["","",""],// 0-9 double-struck. No KaTeX font.
["mathsf","textsf","SansSerif-Regular"],// 0-9 sans-serif
["mathboldsf","textboldsf","SansSerif-Bold"],// 0-9 bold sans-serif
["mathtt","texttt","Typewriter-Regular"]// 0-9 monospace
];const wideCharacterFont=function(wideChar,mode){// IE doesn't support codePointAt(). So work with the surrogate pair.
const H=wideChar.charCodeAt(0);// high surrogate
const L=wideChar.charCodeAt(1);// low surrogate
const codePoint=(H-0xD800)*0x400+(L-0xDC00)+0x10000;const j=mode==="math"?0:1;// column index for CSS class.
if(0x1D400<=codePoint&&codePoint<0x1D6A4){// wideLatinLetterData contains exactly 26 chars on each row.
// So we can calculate the relevant row. No traverse necessary.
const i=Math.floor((codePoint-0x1D400)/26);return [wideLatinLetterData[i][2],wideLatinLetterData[i][j]];}else if(0x1D7CE<=codePoint&&codePoint<=0x1D7FF){// Numerals, ten per row.
const i=Math.floor((codePoint-0x1D7CE)/10);return [wideNumeralData[i][2],wideNumeralData[i][j]];}else if(codePoint===0x1D6A5||codePoint===0x1D6A6){// dotless i or j
return [wideLatinLetterData[0][2],wideLatinLetterData[0][j]];}else if(0x1D6A6<codePoint&&codePoint<0x1D7CE){// Greek letters. Not supported, yet.
return ["",""];}else {// We don't support any wide characters outside 1D400–1D7FF.
throw new src_ParseError("Unsupported character: "+wideChar);}};/* eslint no-console:0 *//**
 * This module contains general functions that can be used for building
 * different kinds of domTree nodes in a consistent manner.
 *//**
 * Looks up the given symbol in fontMetrics, after applying any symbol
 * replacements defined in symbol.js
 */const lookupSymbol=function(value,// TODO(#963): Use a union type for this.
fontName,mode){// Replace the value with its replaced value from symbol.js
if(src_symbols[mode][value]&&src_symbols[mode][value].replace){value=src_symbols[mode][value].replace;}return {value:value,metrics:getCharacterMetrics(value,fontName,mode)};};/**
 * Makes a symbolNode after translation via the list of symbols in symbols.js.
 * Correctly pulls out metrics for the character, and optionally takes a list of
 * classes to be attached to the node.
 *
 * TODO: make argument order closer to makeSpan
 * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
 * should if present come first in `classes`.
 * TODO(#953): Make `options` mandatory and always pass it in.
 */const makeSymbol=function(value,fontName,mode,options,classes){const lookup=lookupSymbol(value,fontName,mode);const metrics=lookup.metrics;value=lookup.value;let symbolNode;if(metrics){let italic=metrics.italic;if(mode==="text"||options&&options.font==="mathit"){italic=0;}symbolNode=new SymbolNode(value,metrics.height,metrics.depth,italic,metrics.skew,metrics.width,classes);}else {// TODO(emily): Figure out a good way to only print this in development
typeof console!=="undefined"&&console.warn("No character metrics "+("for '"+value+"' in style '"+fontName+"' and mode '"+mode+"'"));symbolNode=new SymbolNode(value,0,0,0,0,0,classes);}if(options){symbolNode.maxFontSize=options.sizeMultiplier;if(options.style.isTight()){symbolNode.classes.push("mtight");}const color=options.getColor();if(color){symbolNode.style.color=color;}}return symbolNode;};/**
 * Makes a symbol in Main-Regular or AMS-Regular.
 * Used for rel, bin, open, close, inner, and punct.
 */const mathsym=function(value,mode,options,classes){if(classes===void 0){classes=[];}// Decide what font to render the symbol in by its entry in the symbols
// table.
// Have a special case for when the value = \ because the \ is used as a
// textord in unsupported command errors but cannot be parsed as a regular
// text ordinal and is therefore not present as a symbol in the symbols
// table for text, as well as a special case for boldsymbol because it
// can be used for bold + and -
if(options.font==="boldsymbol"&&lookupSymbol(value,"Main-Bold",mode).metrics){return makeSymbol(value,"Main-Bold",mode,options,classes.concat(["mathbf"]));}else if(value==="\\"||src_symbols[mode][value].font==="main"){return makeSymbol(value,"Main-Regular",mode,options,classes);}else {return makeSymbol(value,"AMS-Regular",mode,options,classes.concat(["amsrm"]));}};/**
 * Determines which of the two font names (Main-Bold and Math-BoldItalic) and
 * corresponding style tags (mathbf or boldsymbol) to use for font "boldsymbol",
 * depending on the symbol.  Use this function instead of fontMap for font
 * "boldsymbol".
 */const boldsymbol=function(value,mode,options,classes,type){if(type!=="textord"&&lookupSymbol(value,"Math-BoldItalic",mode).metrics){return {fontName:"Math-BoldItalic",fontClass:"boldsymbol"};}else {// Some glyphs do not exist in Math-BoldItalic so we need to use
// Main-Bold instead.
return {fontName:"Main-Bold",fontClass:"mathbf"};}};/**
 * Makes either a mathord or textord in the correct font and color.
 */const makeOrd=function(group,options,type){const mode=group.mode;const text=group.text;const classes=["mord"];// Math mode or Old font (i.e. \rm)
const isFont=mode==="math"||mode==="text"&&options.font;const fontOrFamily=isFont?options.font:options.fontFamily;let wideFontName="";let wideFontClass="";if(text.charCodeAt(0)===0xD835){[wideFontName,wideFontClass]=wideCharacterFont(text,mode);}if(wideFontName.length>0){// surrogate pairs get special treatment
return makeSymbol(text,wideFontName,mode,options,classes.concat(wideFontClass));}else if(fontOrFamily){let fontName;let fontClasses;if(fontOrFamily==="boldsymbol"){const fontData=boldsymbol(text,mode,options,classes,type);fontName=fontData.fontName;fontClasses=[fontData.fontClass];}else if(isFont){fontName=fontMap[fontOrFamily].fontName;fontClasses=[fontOrFamily];}else {fontName=retrieveTextFontName(fontOrFamily,options.fontWeight,options.fontShape);fontClasses=[fontOrFamily,options.fontWeight,options.fontShape];}if(lookupSymbol(text,fontName,mode).metrics){return makeSymbol(text,fontName,mode,options,classes.concat(fontClasses));}else if(ligatures.hasOwnProperty(text)&&fontName.slice(0,10)==="Typewriter"){// Deconstruct ligatures in monospace fonts (\texttt, \tt).
const parts=[];for(let i=0;i<text.length;i++){parts.push(makeSymbol(text[i],fontName,mode,options,classes.concat(fontClasses)));}return makeFragment(parts);}}// Makes a symbol in the default font for mathords and textords.
if(type==="mathord"){return makeSymbol(text,"Math-Italic",mode,options,classes.concat(["mathnormal"]));}else if(type==="textord"){const font=src_symbols[mode][text]&&src_symbols[mode][text].font;if(font==="ams"){const fontName=retrieveTextFontName("amsrm",options.fontWeight,options.fontShape);return makeSymbol(text,fontName,mode,options,classes.concat("amsrm",options.fontWeight,options.fontShape));}else if(font==="main"||!font){const fontName=retrieveTextFontName("textrm",options.fontWeight,options.fontShape);return makeSymbol(text,fontName,mode,options,classes.concat(options.fontWeight,options.fontShape));}else {// fonts added by plugins
const fontName=retrieveTextFontName(font,options.fontWeight,options.fontShape);// We add font name as a css class
return makeSymbol(text,fontName,mode,options,classes.concat(fontName,options.fontWeight,options.fontShape));}}else {throw new Error("unexpected type: "+type+" in makeOrd");}};/**
 * Returns true if subsequent symbolNodes have the same classes, skew, maxFont,
 * and styles.
 */const canCombine=(prev,next)=>{if(createClass(prev.classes)!==createClass(next.classes)||prev.skew!==next.skew||prev.maxFontSize!==next.maxFontSize){return false;}// If prev and next both are just "mbin"s or "mord"s we don't combine them
// so that the proper spacing can be preserved.
if(prev.classes.length===1){const cls=prev.classes[0];if(cls==="mbin"||cls==="mord"){return false;}}for(const style in prev.style){if(prev.style.hasOwnProperty(style)&&prev.style[style]!==next.style[style]){return false;}}for(const style in next.style){if(next.style.hasOwnProperty(style)&&prev.style[style]!==next.style[style]){return false;}}return true;};/**
 * Combine consecutive domTree.symbolNodes into a single symbolNode.
 * Note: this function mutates the argument.
 */const tryCombineChars=chars=>{for(let i=0;i<chars.length-1;i++){const prev=chars[i];const next=chars[i+1];if(prev instanceof SymbolNode&&next instanceof SymbolNode&&canCombine(prev,next)){prev.text+=next.text;prev.height=Math.max(prev.height,next.height);prev.depth=Math.max(prev.depth,next.depth);// Use the last character's italic correction since we use
// it to add padding to the right of the span created from
// the combined characters.
prev.italic=next.italic;chars.splice(i+1,1);i--;}}return chars;};/**
 * Calculate the height, depth, and maxFontSize of an element based on its
 * children.
 */const sizeElementFromChildren=function(elem){let height=0;let depth=0;let maxFontSize=0;for(let i=0;i<elem.children.length;i++){const child=elem.children[i];if(child.height>height){height=child.height;}if(child.depth>depth){depth=child.depth;}if(child.maxFontSize>maxFontSize){maxFontSize=child.maxFontSize;}}elem.height=height;elem.depth=depth;elem.maxFontSize=maxFontSize;};/**
 * Makes a span with the given list of classes, list of children, and options.
 *
 * TODO(#953): Ensure that `options` is always provided (currently some call
 * sites don't pass it) and make the type below mandatory.
 * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
 * should if present come first in `classes`.
 */const makeSpan=function(classes,children,options,style){const span=new Span(classes,children,options,style);sizeElementFromChildren(span);return span;};// SVG one is simpler -- doesn't require height, depth, max-font setting.
// This is also a separate method for typesafety.
const makeSvgSpan=(classes,children,options,style)=>new Span(classes,children,options,style);const makeLineSpan=function(className,options,thickness){const line=makeSpan([className],[],options);line.height=Math.max(thickness||options.fontMetrics().defaultRuleThickness,options.minRuleThickness);line.style.borderBottomWidth=makeEm(line.height);line.maxFontSize=1.0;return line;};/**
 * Makes an anchor with the given href, list of classes, list of children,
 * and options.
 */const makeAnchor=function(href,classes,children,options){const anchor=new Anchor(href,classes,children,options);sizeElementFromChildren(anchor);return anchor;};/**
 * Makes a document fragment with the given list of children.
 */const makeFragment=function(children){const fragment=new DocumentFragment(children);sizeElementFromChildren(fragment);return fragment;};/**
 * Wraps group in a span if it's a document fragment, allowing to apply classes
 * and styles
 */const wrapFragment=function(group,options){if(group instanceof DocumentFragment){return makeSpan([],[group],options);}return group;};// These are exact object types to catch typos in the names of the optional fields.
// Computes the updated `children` list and the overall depth.
//
// This helper function for makeVList makes it easier to enforce type safety by
// allowing early exits (returns) in the logic.
const getVListChildrenAndDepth=function(params){if(params.positionType==="individualShift"){const oldChildren=params.children;const children=[oldChildren[0]];// Add in kerns to the list of params.children to get each element to be
// shifted to the correct specified shift
const depth=-oldChildren[0].shift-oldChildren[0].elem.depth;let currPos=depth;for(let i=1;i<oldChildren.length;i++){const diff=-oldChildren[i].shift-currPos-oldChildren[i].elem.depth;const size=diff-(oldChildren[i-1].elem.height+oldChildren[i-1].elem.depth);currPos=currPos+diff;children.push({type:"kern",size});children.push(oldChildren[i]);}return {children,depth};}let depth;if(params.positionType==="top"){// We always start at the bottom, so calculate the bottom by adding up
// all the sizes
let bottom=params.positionData;for(let i=0;i<params.children.length;i++){const child=params.children[i];bottom-=child.type==="kern"?child.size:child.elem.height+child.elem.depth;}depth=bottom;}else if(params.positionType==="bottom"){depth=-params.positionData;}else {const firstChild=params.children[0];if(firstChild.type!=="elem"){throw new Error('First child must have type "elem".');}if(params.positionType==="shift"){depth=-firstChild.elem.depth-params.positionData;}else if(params.positionType==="firstBaseline"){depth=-firstChild.elem.depth;}else {throw new Error("Invalid positionType "+params.positionType+".");}}return {children:params.children,depth};};/**
 * Makes a vertical list by stacking elements and kerns on top of each other.
 * Allows for many different ways of specifying the positioning method.
 *
 * See VListParam documentation above.
 */const makeVList=function(params,options){const{children,depth}=getVListChildrenAndDepth(params);// Create a strut that is taller than any list item. The strut is added to
// each item, where it will determine the item's baseline. Since it has
// `overflow:hidden`, the strut's top edge will sit on the item's line box's
// top edge and the strut's bottom edge will sit on the item's baseline,
// with no additional line-height spacing. This allows the item baseline to
// be positioned precisely without worrying about font ascent and
// line-height.
let pstrutSize=0;for(let i=0;i<children.length;i++){const child=children[i];if(child.type==="elem"){const elem=child.elem;pstrutSize=Math.max(pstrutSize,elem.maxFontSize,elem.height);}}pstrutSize+=2;const pstrut=makeSpan(["pstrut"],[]);pstrut.style.height=makeEm(pstrutSize);// Create a new list of actual children at the correct offsets
const realChildren=[];let minPos=depth;let maxPos=depth;let currPos=depth;for(let i=0;i<children.length;i++){const child=children[i];if(child.type==="kern"){currPos+=child.size;}else {const elem=child.elem;const classes=child.wrapperClasses||[];const style=child.wrapperStyle||{};const childWrap=makeSpan(classes,[pstrut,elem],undefined,style);childWrap.style.top=makeEm(-pstrutSize-currPos-elem.depth);if(child.marginLeft){childWrap.style.marginLeft=child.marginLeft;}if(child.marginRight){childWrap.style.marginRight=child.marginRight;}realChildren.push(childWrap);currPos+=elem.height+elem.depth;}minPos=Math.min(minPos,currPos);maxPos=Math.max(maxPos,currPos);}// The vlist contents go in a table-cell with `vertical-align:bottom`.
// This cell's bottom edge will determine the containing table's baseline
// without overly expanding the containing line-box.
const vlist=makeSpan(["vlist"],realChildren);vlist.style.height=makeEm(maxPos);// A second row is used if necessary to represent the vlist's depth.
let rows;if(minPos<0){// We will define depth in an empty span with display: table-cell.
// It should render with the height that we define. But Chrome, in
// contenteditable mode only, treats that span as if it contains some
// text content. And that min-height over-rides our desired height.
// So we put another empty span inside the depth strut span.
const emptySpan=makeSpan([],[]);const depthStrut=makeSpan(["vlist"],[emptySpan]);depthStrut.style.height=makeEm(-minPos);// Safari wants the first row to have inline content; otherwise it
// puts the bottom of the *second* row on the baseline.
const topStrut=makeSpan(["vlist-s"],[new SymbolNode("\u200b")]);rows=[makeSpan(["vlist-r"],[vlist,topStrut]),makeSpan(["vlist-r"],[depthStrut])];}else {rows=[makeSpan(["vlist-r"],[vlist])];}const vtable=makeSpan(["vlist-t"],rows);if(rows.length===2){vtable.classes.push("vlist-t2");}vtable.height=maxPos;vtable.depth=-minPos;return vtable;};// Glue is a concept from TeX which is a flexible space between elements in
// either a vertical or horizontal list. In KaTeX, at least for now, it's
// static space between elements in a horizontal layout.
const makeGlue=(measurement,options)=>{// Make an empty span for the space
const rule=makeSpan(["mspace"],[],options);const size=calculateSize(measurement,options);rule.style.marginRight=makeEm(size);return rule;};// Takes font options, and returns the appropriate fontLookup name
const retrieveTextFontName=function(fontFamily,fontWeight,fontShape){let baseFontName="";switch(fontFamily){case"amsrm":baseFontName="AMS";break;case"textrm":baseFontName="Main";break;case"textsf":baseFontName="SansSerif";break;case"texttt":baseFontName="Typewriter";break;default:baseFontName=fontFamily;// use fonts added by a plugin
}let fontStylesName;if(fontWeight==="textbf"&&fontShape==="textit"){fontStylesName="BoldItalic";}else if(fontWeight==="textbf"){fontStylesName="Bold";}else if(fontWeight==="textit"){fontStylesName="Italic";}else {fontStylesName="Regular";}return baseFontName+"-"+fontStylesName;};/**
 * Maps TeX font commands to objects containing:
 * - variant: string used for "mathvariant" attribute in buildMathML.js
 * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics
 */// A map between tex font commands an MathML mathvariant attribute values
const fontMap={// styles
"mathbf":{variant:"bold",fontName:"Main-Bold"},"mathrm":{variant:"normal",fontName:"Main-Regular"},"textit":{variant:"italic",fontName:"Main-Italic"},"mathit":{variant:"italic",fontName:"Main-Italic"},"mathnormal":{variant:"italic",fontName:"Math-Italic"},"mathsfit":{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},// "boldsymbol" is missing because they require the use of multiple fonts:
// Math-BoldItalic and Main-Bold.  This is handled by a special case in
// makeOrd which ends up calling boldsymbol.
// families
"mathbb":{variant:"double-struck",fontName:"AMS-Regular"},"mathcal":{variant:"script",fontName:"Caligraphic-Regular"},"mathfrak":{variant:"fraktur",fontName:"Fraktur-Regular"},"mathscr":{variant:"script",fontName:"Script-Regular"},"mathsf":{variant:"sans-serif",fontName:"SansSerif-Regular"},"mathtt":{variant:"monospace",fontName:"Typewriter-Regular"}};const svgData={//   path, width, height
vec:["vec",0.471,0.714],// values from the font glyph
oiintSize1:["oiintSize1",0.957,0.499],// oval to overlay the integrand
oiintSize2:["oiintSize2",1.472,0.659],oiiintSize1:["oiiintSize1",1.304,0.499],oiiintSize2:["oiiintSize2",1.98,0.659]};const staticSvg=function(value,options){// Create a span with inline SVG for the element.
const[pathName,width,height]=svgData[value];const path=new PathNode(pathName);const svgNode=new SvgNode([path],{"width":makeEm(width),"height":makeEm(height),// Override CSS rule `.katex svg { width: 100% }`
"style":"width:"+makeEm(width),"viewBox":"0 0 "+1000*width+" "+1000*height,"preserveAspectRatio":"xMinYMin"});const span=makeSvgSpan(["overlay"],[svgNode],options);span.height=height;span.style.height=makeEm(height);span.style.width=makeEm(width);return span;};/* harmony default export */var buildCommon={fontMap,makeSymbol,mathsym,makeSpan,makeSvgSpan,makeLineSpan,makeAnchor,makeFragment,wrapFragment,makeVList,makeOrd,makeGlue,staticSvg,svgData,tryCombineChars};/**
 * Describes spaces between different classes of atoms.
 */const thinspace={number:3,unit:"mu"};const mediumspace={number:4,unit:"mu"};const thickspace={number:5,unit:"mu"};// Making the type below exact with all optional fields doesn't work due to
// - https://github.com/facebook/flow/issues/4582
// - https://github.com/facebook/flow/issues/5688
// However, since *all* fields are optional, $Shape<> works as suggested in 5688
// above.
// Spacing relationships for display and text styles
const spacings={mord:{mop:thinspace,mbin:mediumspace,mrel:thickspace,minner:thinspace},mop:{mord:thinspace,mop:thinspace,mrel:thickspace,minner:thinspace},mbin:{mord:mediumspace,mop:mediumspace,mopen:mediumspace,minner:mediumspace},mrel:{mord:thickspace,mop:thickspace,mopen:thickspace,minner:thickspace},mopen:{},mclose:{mop:thinspace,mbin:mediumspace,mrel:thickspace,minner:thinspace},mpunct:{mord:thinspace,mop:thinspace,mrel:thickspace,mopen:thinspace,mclose:thinspace,mpunct:thinspace,minner:thinspace},minner:{mord:thinspace,mop:thinspace,mbin:mediumspace,mrel:thickspace,mopen:thinspace,mpunct:thinspace,minner:thinspace}};// Spacing relationships for script and scriptscript styles
const tightSpacings={mord:{mop:thinspace},mop:{mord:thinspace,mop:thinspace},mbin:{},mrel:{},mopen:{},mclose:{mop:thinspace},mpunct:{},minner:{mop:thinspace}};/** Context provided to function handlers for error messages. */// Note: reverse the order of the return type union will cause a flow error.
// See https://github.com/facebook/flow/issues/3663.
// More general version of `HtmlBuilder` for nodes (e.g. \sum, accent types)
// whose presence impacts super/subscripting. In this case, ParseNode<"supsub">
// delegates its HTML building to the HtmlBuilder corresponding to these nodes.
/**
 * Final function spec for use at parse time.
 * This is almost identical to `FunctionPropSpec`, except it
 * 1. includes the function handler, and
 * 2. requires all arguments except argTypes.
 * It is generated by `defineFunction()` below.
 *//**
 * All registered functions.
 * `functions.js` just exports this same dictionary again and makes it public.
 * `Parser.js` requires this dictionary.
 */const _functions={};/**
 * All HTML builders. Should be only used in the `define*` and the `build*ML`
 * functions.
 */const _htmlGroupBuilders={};/**
 * All MathML builders. Should be only used in the `define*` and the `build*ML`
 * functions.
 */const _mathmlGroupBuilders={};function defineFunction(_ref){let{type,names,props,handler,htmlBuilder,mathmlBuilder}=_ref;// Set default values of functions
const data={type,numArgs:props.numArgs,argTypes:props.argTypes,allowedInArgument:!!props.allowedInArgument,allowedInText:!!props.allowedInText,allowedInMath:props.allowedInMath===undefined?true:props.allowedInMath,numOptionalArgs:props.numOptionalArgs||0,infix:!!props.infix,primitive:!!props.primitive,handler:handler};for(let i=0;i<names.length;++i){_functions[names[i]]=data;}if(type){if(htmlBuilder){_htmlGroupBuilders[type]=htmlBuilder;}if(mathmlBuilder){_mathmlGroupBuilders[type]=mathmlBuilder;}}}/**
 * Use this to register only the HTML and MathML builders for a function (e.g.
 * if the function's ParseNode is generated in Parser.js rather than via a
 * stand-alone handler provided to `defineFunction`).
 */function defineFunctionBuilders(_ref2){let{type,htmlBuilder,mathmlBuilder}=_ref2;defineFunction({type,names:[],props:{numArgs:0},handler(){throw new Error('Should never be called.');},htmlBuilder,mathmlBuilder});}const normalizeArgument=function(arg){return arg.type==="ordgroup"&&arg.body.length===1?arg.body[0]:arg;};// Since the corresponding buildHTML/buildMathML function expects a
// list of elements, we normalize for different kinds of arguments
const ordargument=function(arg){return arg.type==="ordgroup"?arg.body:[arg];};/**
 * This file does the main work of building a domTree structure from a parse
 * tree. The entry point is the `buildHTML` function, which takes a parse tree.
 * Then, the buildExpression, buildGroup, and various groupBuilders functions
 * are called, to produce a final HTML tree.
 */const buildHTML_makeSpan=buildCommon.makeSpan;// Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)
// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,
// and the text before Rule 19.
const binLeftCanceller=["leftmost","mbin","mopen","mrel","mop","mpunct"];const binRightCanceller=["rightmost","mrel","mclose","mpunct"];const styleMap={"display":src_Style.DISPLAY,"text":src_Style.TEXT,"script":src_Style.SCRIPT,"scriptscript":src_Style.SCRIPTSCRIPT};const DomEnum={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"};/**
 * Take a list of nodes, build them in order, and return a list of the built
 * nodes. documentFragments are flattened into their contents, so the
 * returned list contains no fragments. `isRealGroup` is true if `expression`
 * is a real group (no atoms will be added on either side), as opposed to
 * a partial group (e.g. one created by \color). `surrounding` is an array
 * consisting type of nodes that will be added to the left and right.
 */const buildExpression=function(expression,options,isRealGroup,surrounding){if(surrounding===void 0){surrounding=[null,null];}// Parse expressions into `groups`.
const groups=[];for(let i=0;i<expression.length;i++){const output=buildGroup(expression[i],options);if(output instanceof DocumentFragment){const children=output.children;groups.push(...children);}else {groups.push(output);}}// Combine consecutive domTree.symbolNodes into a single symbolNode.
buildCommon.tryCombineChars(groups);// If `expression` is a partial group, let the parent handle spacings
// to avoid processing groups multiple times.
if(!isRealGroup){return groups;}let glueOptions=options;if(expression.length===1){const node=expression[0];if(node.type==="sizing"){glueOptions=options.havingSize(node.size);}else if(node.type==="styling"){glueOptions=options.havingStyle(styleMap[node.style]);}}// Dummy spans for determining spacings between surrounding atoms.
// If `expression` has no atoms on the left or right, class "leftmost"
// or "rightmost", respectively, is used to indicate it.
const dummyPrev=buildHTML_makeSpan([surrounding[0]||"leftmost"],[],options);const dummyNext=buildHTML_makeSpan([surrounding[1]||"rightmost"],[],options);// TODO: These code assumes that a node's math class is the first element
// of its `classes` array. A later cleanup should ensure this, for
// instance by changing the signature of `makeSpan`.
// Before determining what spaces to insert, perform bin cancellation.
// Binary operators change to ordinary symbols in some contexts.
const isRoot=isRealGroup==="root";traverseNonSpaceNodes(groups,(node,prev)=>{const prevType=prev.classes[0];const type=node.classes[0];if(prevType==="mbin"&&utils.contains(binRightCanceller,type)){prev.classes[0]="mord";}else if(type==="mbin"&&utils.contains(binLeftCanceller,prevType)){node.classes[0]="mord";}},{node:dummyPrev},dummyNext,isRoot);traverseNonSpaceNodes(groups,(node,prev)=>{const prevType=getTypeOfDomTree(prev);const type=getTypeOfDomTree(node);// 'mtight' indicates that the node is script or scriptscript style.
const space=prevType&&type?node.hasClass("mtight")?tightSpacings[prevType][type]:spacings[prevType][type]:null;if(space){// Insert glue (spacing) after the `prev`.
return buildCommon.makeGlue(space,glueOptions);}},{node:dummyPrev},dummyNext,isRoot);return groups;};// Depth-first traverse non-space `nodes`, calling `callback` with the current and
// previous node as arguments, optionally returning a node to insert after the
// previous node. `prev` is an object with the previous node and `insertAfter`
// function to insert after it. `next` is a node that will be added to the right.
// Used for bin cancellation and inserting spacings.
const traverseNonSpaceNodes=function(nodes,callback,prev,next,isRoot){if(next){// temporarily append the right node, if exists
nodes.push(next);}let i=0;for(;i<nodes.length;i++){const node=nodes[i];const partialGroup=checkPartialGroup(node);if(partialGroup){// Recursive DFS
// $FlowFixMe: make nodes a $ReadOnlyArray by returning a new array
traverseNonSpaceNodes(partialGroup.children,callback,prev,null,isRoot);continue;}// Ignore explicit spaces (e.g., \;, \,) when determining what implicit
// spacing should go between atoms of different classes
const nonspace=!node.hasClass("mspace");if(nonspace){const result=callback(node,prev.node);if(result){if(prev.insertAfter){prev.insertAfter(result);}else {// insert at front
nodes.unshift(result);i++;}}}if(nonspace){prev.node=node;}else if(isRoot&&node.hasClass("newline")){prev.node=buildHTML_makeSpan(["leftmost"]);// treat like beginning of line
}prev.insertAfter=(index=>n=>{nodes.splice(index+1,0,n);i++;})(i);}if(next){nodes.pop();}};// Check if given node is a partial group, i.e., does not affect spacing around.
const checkPartialGroup=function(node){if(node instanceof DocumentFragment||node instanceof Anchor||node instanceof Span&&node.hasClass("enclosing")){return node;}return null;};// Return the outermost node of a domTree.
const getOutermostNode=function(node,side){const partialGroup=checkPartialGroup(node);if(partialGroup){const children=partialGroup.children;if(children.length){if(side==="right"){return getOutermostNode(children[children.length-1],"right");}else if(side==="left"){return getOutermostNode(children[0],"left");}}}return node;};// Return math atom class (mclass) of a domTree.
// If `side` is given, it will get the type of the outermost node at given side.
const getTypeOfDomTree=function(node,side){if(!node){return null;}if(side){node=getOutermostNode(node,side);}// This makes a lot of assumptions as to where the type of atom
// appears.  We should do a better job of enforcing this.
return DomEnum[node.classes[0]]||null;};const makeNullDelimiter=function(options,classes){const moreClasses=["nulldelimiter"].concat(options.baseSizingClasses());return buildHTML_makeSpan(classes.concat(moreClasses));};/**
 * buildGroup is the function that takes a group and calls the correct groupType
 * function for it. It also handles the interaction of size and style changes
 * between parents and children.
 */const buildGroup=function(group,options,baseOptions){if(!group){return buildHTML_makeSpan();}if(_htmlGroupBuilders[group.type]){// Call the groupBuilders function
// $FlowFixMe
let groupNode=_htmlGroupBuilders[group.type](group,options);// If the size changed between the parent and the current group, account
// for that size difference.
if(baseOptions&&options.size!==baseOptions.size){groupNode=buildHTML_makeSpan(options.sizingClasses(baseOptions),[groupNode],options);const multiplier=options.sizeMultiplier/baseOptions.sizeMultiplier;groupNode.height*=multiplier;groupNode.depth*=multiplier;}return groupNode;}else {throw new src_ParseError("Got group of unknown type: '"+group.type+"'");}};/**
 * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`)
 * into an unbreakable HTML node of class .base, with proper struts to
 * guarantee correct vertical extent.  `buildHTML` calls this repeatedly to
 * make up the entire expression as a sequence of unbreakable units.
 */function buildHTMLUnbreakable(children,options){// Compute height and depth of this chunk.
const body=buildHTML_makeSpan(["base"],children,options);// Add strut, which ensures that the top of the HTML element falls at
// the height of the expression, and the bottom of the HTML element
// falls at the depth of the expression.
const strut=buildHTML_makeSpan(["strut"]);strut.style.height=makeEm(body.height+body.depth);if(body.depth){strut.style.verticalAlign=makeEm(-body.depth);}body.children.unshift(strut);return body;}/**
 * Take an entire parse tree, and build it into an appropriate set of HTML
 * nodes.
 */function buildHTML(tree,options){// Strip off outer tag wrapper for processing below.
let tag=null;if(tree.length===1&&tree[0].type==="tag"){tag=tree[0].tag;tree=tree[0].body;}// Build the expression contained in the tree
const expression=buildExpression(tree,options,"root");let eqnNum;if(expression.length===2&&expression[1].hasClass("tag")){// An environment with automatic equation numbers, e.g. {gather}.
eqnNum=expression.pop();}const children=[];// Create one base node for each chunk between potential line breaks.
// The TeXBook [p.173] says "A formula will be broken only after a
// relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary
// operation symbol like $+$ or $-$ or $\times$, where the relation or
// binary operation is on the ``outer level'' of the formula (i.e., not
// enclosed in {...} and not part of an \over construction)."
let parts=[];for(let i=0;i<expression.length;i++){parts.push(expression[i]);if(expression[i].hasClass("mbin")||expression[i].hasClass("mrel")||expression[i].hasClass("allowbreak")){// Put any post-operator glue on same line as operator.
// Watch for \nobreak along the way, and stop at \newline.
let nobreak=false;while(i<expression.length-1&&expression[i+1].hasClass("mspace")&&!expression[i+1].hasClass("newline")){i++;parts.push(expression[i]);if(expression[i].hasClass("nobreak")){nobreak=true;}}// Don't allow break if \nobreak among the post-operator glue.
if(!nobreak){children.push(buildHTMLUnbreakable(parts,options));parts=[];}}else if(expression[i].hasClass("newline")){// Write the line except the newline
parts.pop();if(parts.length>0){children.push(buildHTMLUnbreakable(parts,options));parts=[];}// Put the newline at the top level
children.push(expression[i]);}}if(parts.length>0){children.push(buildHTMLUnbreakable(parts,options));}// Now, if there was a tag, build it too and append it as a final child.
let tagChild;if(tag){tagChild=buildHTMLUnbreakable(buildExpression(tag,options,true));tagChild.classes=["tag"];children.push(tagChild);}else if(eqnNum){children.push(eqnNum);}const htmlNode=buildHTML_makeSpan(["katex-html"],children);htmlNode.setAttribute("aria-hidden","true");// Adjust the strut of the tag to be the maximum height of all children
// (the height of the enclosing htmlNode) for proper vertical alignment.
if(tagChild){const strut=tagChild.children[0];strut.style.height=makeEm(htmlNode.height+htmlNode.depth);if(htmlNode.depth){strut.style.verticalAlign=makeEm(-htmlNode.depth);}}return htmlNode;}/**
 * These objects store data about MathML nodes. This is the MathML equivalent
 * of the types in domTree.js. Since MathML handles its own rendering, and
 * since we're mainly using MathML to improve accessibility, we don't manage
 * any of the styling state that the plain DOM nodes do.
 *
 * The `toNode` and `toMarkup` functions work similarly to how they do in
 * domTree.js, creating namespaced DOM nodes and HTML text markup respectively.
 */function newDocumentFragment(children){return new DocumentFragment(children);}/**
 * This node represents a general purpose MathML node of any type. The
 * constructor requires the type of node to create (for example, `"mo"` or
 * `"mspace"`, corresponding to `<mo>` and `<mspace>` tags).
 */class MathNode{constructor(type,children,classes){this.type=void 0;this.attributes=void 0;this.children=void 0;this.classes=void 0;this.type=type;this.attributes={};this.children=children||[];this.classes=classes||[];}/**
   * Sets an attribute on a MathML node. MathML depends on attributes to convey a
   * semantic content, so this is used heavily.
   */setAttribute(name,value){this.attributes[name]=value;}/**
   * Gets an attribute on a MathML node.
   */getAttribute(name){return this.attributes[name];}/**
   * Converts the math node into a MathML-namespaced DOM element.
   */toNode(){const node=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(const attr in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,attr)){node.setAttribute(attr,this.attributes[attr]);}}if(this.classes.length>0){node.className=createClass(this.classes);}for(let i=0;i<this.children.length;i++){// Combine multiple TextNodes into one TextNode, to prevent
// screen readers from reading each as a separate word [#3995]
if(this.children[i]instanceof TextNode&&this.children[i+1]instanceof TextNode){let text=this.children[i].toText()+this.children[++i].toText();while(this.children[i+1]instanceof TextNode){text+=this.children[++i].toText();}node.appendChild(new TextNode(text).toNode());}else {node.appendChild(this.children[i].toNode());}}return node;}/**
   * Converts the math node into an HTML markup string.
   */toMarkup(){let markup="<"+this.type;// Add the attributes
for(const attr in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,attr)){markup+=" "+attr+"=\"";markup+=utils.escape(this.attributes[attr]);markup+="\"";}}if(this.classes.length>0){markup+=" class =\""+utils.escape(createClass(this.classes))+"\"";}markup+=">";for(let i=0;i<this.children.length;i++){markup+=this.children[i].toMarkup();}markup+="</"+this.type+">";return markup;}/**
   * Converts the math node into a string, similar to innerText, but escaped.
   */toText(){return this.children.map(child=>child.toText()).join("");}}/**
 * This node represents a piece of text.
 */class TextNode{constructor(text){this.text=void 0;this.text=text;}/**
   * Converts the text node into a DOM text node.
   */toNode(){return document.createTextNode(this.text);}/**
   * Converts the text node into escaped HTML markup
   * (representing the text itself).
   */toMarkup(){return utils.escape(this.toText());}/**
   * Converts the text node into a string
   * (representing the text itself).
   */toText(){return this.text;}}/**
 * This node represents a space, but may render as <mspace.../> or as text,
 * depending on the width.
 */class SpaceNode{/**
   * Create a Space node with width given in CSS ems.
   */constructor(width){this.width=void 0;this.character=void 0;this.width=width;// See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html
// for a table of space-like characters.  We use Unicode
// representations instead of &LongNames; as it's not clear how to
// make the latter via document.createTextNode.
if(width>=0.05555&&width<=0.05556){this.character="\u200a";// &VeryThinSpace;
}else if(width>=0.1666&&width<=0.1667){this.character="\u2009";// &ThinSpace;
}else if(width>=0.2222&&width<=0.2223){this.character="\u2005";// &MediumSpace;
}else if(width>=0.2777&&width<=0.2778){this.character="\u2005\u200a";// &ThickSpace;
}else if(width>=-0.05556&&width<=-0.05555){this.character="\u200a\u2063";// &NegativeVeryThinSpace;
}else if(width>=-0.1667&&width<=-0.1666){this.character="\u2009\u2063";// &NegativeThinSpace;
}else if(width>=-0.2223&&width<=-0.2222){this.character="\u205f\u2063";// &NegativeMediumSpace;
}else if(width>=-0.2778&&width<=-0.2777){this.character="\u2005\u2063";// &NegativeThickSpace;
}else {this.character=null;}}/**
   * Converts the math node into a MathML-namespaced DOM element.
   */toNode(){if(this.character){return document.createTextNode(this.character);}else {const node=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");node.setAttribute("width",makeEm(this.width));return node;}}/**
   * Converts the math node into an HTML markup string.
   */toMarkup(){if(this.character){return "<mtext>"+this.character+"</mtext>";}else {return "<mspace width=\""+makeEm(this.width)+"\"/>";}}/**
   * Converts the math node into a string, similar to innerText.
   */toText(){if(this.character){return this.character;}else {return " ";}}}/* harmony default export */var mathMLTree={MathNode,TextNode,SpaceNode,newDocumentFragment};/**
 * This file converts a parse tree into a corresponding MathML tree. The main
 * entry point is the `buildMathML` function, which takes a parse tree from the
 * parser.
 *//**
 * Takes a symbol and converts it into a MathML text node after performing
 * optional replacement from symbols.js.
 */const makeText=function(text,mode,options){if(src_symbols[mode][text]&&src_symbols[mode][text].replace&&text.charCodeAt(0)!==0xD835&&!(ligatures.hasOwnProperty(text)&&options&&(options.fontFamily&&options.fontFamily.slice(4,6)==="tt"||options.font&&options.font.slice(4,6)==="tt"))){text=src_symbols[mode][text].replace;}return new mathMLTree.TextNode(text);};/**
 * Wrap the given array of nodes in an <mrow> node if needed, i.e.,
 * unless the array has length 1.  Always returns a single node.
 */const makeRow=function(body){if(body.length===1){return body[0];}else {return new mathMLTree.MathNode("mrow",body);}};/**
 * Returns the math variant as a string or null if none is required.
 */const getVariant=function(group,options){// Handle \text... font specifiers as best we can.
// MathML has a limited list of allowable mathvariant specifiers; see
// https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt
if(options.fontFamily==="texttt"){return "monospace";}else if(options.fontFamily==="textsf"){if(options.fontShape==="textit"&&options.fontWeight==="textbf"){return "sans-serif-bold-italic";}else if(options.fontShape==="textit"){return "sans-serif-italic";}else if(options.fontWeight==="textbf"){return "bold-sans-serif";}else {return "sans-serif";}}else if(options.fontShape==="textit"&&options.fontWeight==="textbf"){return "bold-italic";}else if(options.fontShape==="textit"){return "italic";}else if(options.fontWeight==="textbf"){return "bold";}const font=options.font;if(!font||font==="mathnormal"){return null;}const mode=group.mode;if(font==="mathit"){return "italic";}else if(font==="boldsymbol"){return group.type==="textord"?"bold":"bold-italic";}else if(font==="mathbf"){return "bold";}else if(font==="mathbb"){return "double-struck";}else if(font==="mathsfit"){return "sans-serif-italic";}else if(font==="mathfrak"){return "fraktur";}else if(font==="mathscr"||font==="mathcal"){// MathML makes no distinction between script and calligraphic
return "script";}else if(font==="mathsf"){return "sans-serif";}else if(font==="mathtt"){return "monospace";}let text=group.text;if(utils.contains(["\\imath","\\jmath"],text)){return null;}if(src_symbols[mode][text]&&src_symbols[mode][text].replace){text=src_symbols[mode][text].replace;}const fontName=buildCommon.fontMap[font].fontName;if(getCharacterMetrics(text,fontName,mode)){return buildCommon.fontMap[font].variant;}return null;};/**
 * Check for <mi>.</mi> which is how a dot renders in MathML,
 * or <mo separator="true" lspace="0em" rspace="0em">,</mo>
 * which is how a braced comma {,} renders in MathML
 */function isNumberPunctuation(group){if(!group){return false;}if(group.type==='mi'&&group.children.length===1){const child=group.children[0];return child instanceof TextNode&&child.text==='.';}else if(group.type==='mo'&&group.children.length===1&&group.getAttribute('separator')==='true'&&group.getAttribute('lspace')==='0em'&&group.getAttribute('rspace')==='0em'){const child=group.children[0];return child instanceof TextNode&&child.text===',';}else {return false;}}/**
 * Takes a list of nodes, builds them, and returns a list of the generated
 * MathML nodes.  Also combine consecutive <mtext> outputs into a single
 * <mtext> tag.
 */const buildMathML_buildExpression=function(expression,options,isOrdgroup){if(expression.length===1){const group=buildMathML_buildGroup(expression[0],options);if(isOrdgroup&&group instanceof MathNode&&group.type==="mo"){// When TeX writers want to suppress spacing on an operator,
// they often put the operator by itself inside braces.
group.setAttribute("lspace","0em");group.setAttribute("rspace","0em");}return [group];}const groups=[];let lastGroup;for(let i=0;i<expression.length;i++){const group=buildMathML_buildGroup(expression[i],options);if(group instanceof MathNode&&lastGroup instanceof MathNode){// Concatenate adjacent <mtext>s
if(group.type==='mtext'&&lastGroup.type==='mtext'&&group.getAttribute('mathvariant')===lastGroup.getAttribute('mathvariant')){lastGroup.children.push(...group.children);continue;// Concatenate adjacent <mn>s
}else if(group.type==='mn'&&lastGroup.type==='mn'){lastGroup.children.push(...group.children);continue;// Concatenate <mn>...</mn> followed by <mi>.</mi>
}else if(isNumberPunctuation(group)&&lastGroup.type==='mn'){lastGroup.children.push(...group.children);continue;// Concatenate <mi>.</mi> followed by <mn>...</mn>
}else if(group.type==='mn'&&isNumberPunctuation(lastGroup)){group.children=[...lastGroup.children,...group.children];groups.pop();// Put preceding <mn>...</mn> or <mi>.</mi> inside base of
// <msup><mn>...base...</mn>...exponent...</msup> (or <msub>)
}else if((group.type==='msup'||group.type==='msub')&&group.children.length>=1&&(lastGroup.type==='mn'||isNumberPunctuation(lastGroup))){const base=group.children[0];if(base instanceof MathNode&&base.type==='mn'){base.children=[...lastGroup.children,...base.children];groups.pop();}// \not
}else if(lastGroup.type==='mi'&&lastGroup.children.length===1){const lastChild=lastGroup.children[0];if(lastChild instanceof TextNode&&lastChild.text==='\u0338'&&(group.type==='mo'||group.type==='mi'||group.type==='mn')){const child=group.children[0];if(child instanceof TextNode&&child.text.length>0){// Overlay with combining character long solidus
child.text=child.text.slice(0,1)+"\u0338"+child.text.slice(1);groups.pop();}}}}groups.push(group);lastGroup=group;}return groups;};/**
 * Equivalent to buildExpression, but wraps the elements in an <mrow>
 * if there's more than one.  Returns a single node instead of an array.
 */const buildExpressionRow=function(expression,options,isOrdgroup){return makeRow(buildMathML_buildExpression(expression,options,isOrdgroup));};/**
 * Takes a group from the parser and calls the appropriate groupBuilders function
 * on it to produce a MathML node.
 */const buildMathML_buildGroup=function(group,options){if(!group){return new mathMLTree.MathNode("mrow");}if(_mathmlGroupBuilders[group.type]){// Call the groupBuilders function
// $FlowFixMe
const result=_mathmlGroupBuilders[group.type](group,options);// $FlowFixMe
return result;}else {throw new src_ParseError("Got group of unknown type: '"+group.type+"'");}};/**
 * Takes a full parse tree and settings and builds a MathML representation of
 * it. In particular, we put the elements from building the parse tree into a
 * <semantics> tag so we can also include that TeX source as an annotation.
 *
 * Note that we actually return a domTree element with a `<math>` inside it so
 * we can do appropriate styling.
 */function buildMathML(tree,texExpression,options,isDisplayMode,forMathmlOnly){const expression=buildMathML_buildExpression(tree,options);// TODO: Make a pass thru the MathML similar to buildHTML.traverseNonSpaceNodes
// and add spacing nodes. This is necessary only adjacent to math operators
// like \sin or \lim or to subsup elements that contain math operators.
// MathML takes care of the other spacing issues.
// Wrap up the expression in an mrow so it is presented in the semantics
// tag correctly, unless it's a single <mrow> or <mtable>.
let wrapper;if(expression.length===1&&expression[0]instanceof MathNode&&utils.contains(["mrow","mtable"],expression[0].type)){wrapper=expression[0];}else {wrapper=new mathMLTree.MathNode("mrow",expression);}// Build a TeX annotation of the source
const annotation=new mathMLTree.MathNode("annotation",[new mathMLTree.TextNode(texExpression)]);annotation.setAttribute("encoding","application/x-tex");const semantics=new mathMLTree.MathNode("semantics",[wrapper,annotation]);const math=new mathMLTree.MathNode("math",[semantics]);math.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML");if(isDisplayMode){math.setAttribute("display","block");}// You can't style <math> nodes, so we wrap the node in a span.
// NOTE: The span class is not typed to have <math> nodes as children, and
// we don't want to make the children type more generic since the children
// of span are expected to have more fields in `buildHtml` contexts.
const wrapperClass=forMathmlOnly?"katex":"katex-mathml";// $FlowFixMe
return buildCommon.makeSpan([wrapperClass],[math]);}const optionsFromSettings=function(settings){return new src_Options({style:settings.displayMode?src_Style.DISPLAY:src_Style.TEXT,maxSize:settings.maxSize,minRuleThickness:settings.minRuleThickness});};const displayWrap=function(node,settings){if(settings.displayMode){const classes=["katex-display"];if(settings.leqno){classes.push("leqno");}if(settings.fleqn){classes.push("fleqn");}node=buildCommon.makeSpan(classes,[node]);}return node;};const buildTree=function(tree,expression,settings){const options=optionsFromSettings(settings);let katexNode;if(settings.output==="mathml"){return buildMathML(tree,expression,options,settings.displayMode,true);}else if(settings.output==="html"){const htmlNode=buildHTML(tree,options);katexNode=buildCommon.makeSpan(["katex"],[htmlNode]);}else {const mathMLNode=buildMathML(tree,expression,options,settings.displayMode,false);const htmlNode=buildHTML(tree,options);katexNode=buildCommon.makeSpan(["katex"],[mathMLNode,htmlNode]);}return displayWrap(katexNode,settings);};const buildHTMLTree=function(tree,expression,settings){const options=optionsFromSettings(settings);const htmlNode=buildHTML(tree,options);const katexNode=buildCommon.makeSpan(["katex"],[htmlNode]);return displayWrap(katexNode,settings);};/**
 * This file provides support to buildMathML.js and buildHTML.js
 * for stretchy wide elements rendered from SVG files
 * and other CSS trickery.
 */const stretchyCodePoint={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23df",overbrace:"\u23de",overgroup:"\u23e0",undergroup:"\u23e1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21d2",xRightarrow:"\u21d2",overleftharpoon:"\u21bc",xleftharpoonup:"\u21bc",overrightharpoon:"\u21c0",xrightharpoonup:"\u21c0",xLeftarrow:"\u21d0",xLeftrightarrow:"\u21d4",xhookleftarrow:"\u21a9",xhookrightarrow:"\u21aa",xmapsto:"\u21a6",xrightharpoondown:"\u21c1",xleftharpoondown:"\u21bd",xrightleftharpoons:"\u21cc",xleftrightharpoons:"\u21cb",xtwoheadleftarrow:"\u219e",xtwoheadrightarrow:"\u21a0",xlongequal:"=",xtofrom:"\u21c4",xrightleftarrows:"\u21c4",xrightequilibrium:"\u21cc",// Not a perfect match.
xleftequilibrium:"\u21cb",// None better available.
"\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="};const mathMLnode=function(label){const node=new mathMLTree.MathNode("mo",[new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/,'')])]);node.setAttribute("stretchy","true");return node;};// Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts.
// Copyright (c) 2009-2010, Design Science, Inc. (<www.mathjax.org>)
// Copyright (c) 2014-2017 Khan Academy (<www.khanacademy.org>)
// Licensed under the SIL Open Font License, Version 1.1.
// See \nhttp://scripts.sil.org/OFL
// Very Long SVGs
//    Many of the KaTeX stretchy wide elements use a long SVG image and an
//    overflow: hidden tactic to achieve a stretchy image while avoiding
//    distortion of arrowheads or brace corners.
//    The SVG typically contains a very long (400 em) arrow.
//    The SVG is in a container span that has overflow: hidden, so the span
//    acts like a window that exposes only part of the  SVG.
//    The SVG always has a longer, thinner aspect ratio than the container span.
//    After the SVG fills 100% of the height of the container span,
//    there is a long arrow shaft left over. That left-over shaft is not shown.
//    Instead, it is sliced off because the span's CSS has overflow: hidden.
//    Thus, the reader sees an arrow that matches the subject matter width
//    without distortion.
//    Some functions, such as \cancel, need to vary their aspect ratio. These
//    functions do not get the overflow SVG treatment.
// Second Brush Stroke
//    Low resolution monitors struggle to display images in fine detail.
//    So browsers apply anti-aliasing. A long straight arrow shaft therefore
//    will sometimes appear as if it has a blurred edge.
//    To mitigate this, these SVG files contain a second "brush-stroke" on the
//    arrow shafts. That is, a second long thin rectangular SVG path has been
//    written directly on top of each arrow shaft. This reinforcement causes
//    some of the screen pixels to display as black instead of the anti-aliased
//    gray pixel that a  single path would generate. So we get arrow shafts
//    whose edges appear to be sharper.
// In the katexImagesData object just below, the dimensions all
// correspond to path geometry inside the relevant SVG.
// For example, \overrightarrow uses the same arrowhead as glyph U+2192
// from the KaTeX Main font. The scaling factor is 1000.
// That is, inside the font, that arrowhead is 522 units tall, which
// corresponds to 0.522 em inside the document.
const katexImagesData={//   path(s), minWidth, height, align
overrightarrow:[["rightarrow"],0.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],0.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],0.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],0.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3.0,522,"xMaxYMin"],// CD minwwidth2.5pc
xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3.0,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],0.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],0.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],0.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],0.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],0.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],0.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],0.888,522,"xMaxYMin"],xlongequal:[["longequal"],0.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3.0,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],0.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],0.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],0.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],0.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],0.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],0.888,522],overgroup:[["leftgroup","rightgroup"],0.888,342],undergroup:[["leftgroupunder","rightgroupunder"],0.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],// The next three arrows are from the mhchem package.
// In mhchem.sty, min-length is 2.0em. But these arrows might appear in the
// document as \xrightarrow or \xrightleftharpoons. Those have
// min-length = 1.75em, so we set min-length on these next three to match.
xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]};const groupLength=function(arg){if(arg.type==="ordgroup"){return arg.body.length;}else {return 1;}};const svgSpan=function(group,options){// Create a span with inline SVG for the element.
function buildSvgSpan_(){let viewBoxWidth=400000;// default
const label=group.label.slice(1);if(utils.contains(["widehat","widecheck","widetilde","utilde"],label)){// Each type in the `if` statement corresponds to one of the ParseNode
// types below. This narrowing is required to access `grp.base`.
// $FlowFixMe
const grp=group;// There are four SVG images available for each function.
// Choose a taller image when there are more characters.
const numChars=groupLength(grp.base);let viewBoxHeight;let pathName;let height;if(numChars>5){if(label==="widehat"||label==="widecheck"){viewBoxHeight=420;viewBoxWidth=2364;height=0.42;pathName=label+"4";}else {viewBoxHeight=312;viewBoxWidth=2340;height=0.34;pathName="tilde4";}}else {const imgIndex=[1,1,2,2,3,3][numChars];if(label==="widehat"||label==="widecheck"){viewBoxWidth=[0,1062,2364,2364,2364][imgIndex];viewBoxHeight=[0,239,300,360,420][imgIndex];height=[0,0.24,0.3,0.3,0.36,0.42][imgIndex];pathName=label+imgIndex;}else {viewBoxWidth=[0,600,1033,2339,2340][imgIndex];viewBoxHeight=[0,260,286,306,312][imgIndex];height=[0,0.26,0.286,0.3,0.306,0.34][imgIndex];pathName="tilde"+imgIndex;}}const path=new PathNode(pathName);const svgNode=new SvgNode([path],{"width":"100%","height":makeEm(height),"viewBox":"0 0 "+viewBoxWidth+" "+viewBoxHeight,"preserveAspectRatio":"none"});return {span:buildCommon.makeSvgSpan([],[svgNode],options),minWidth:0,height};}else {const spans=[];const data=katexImagesData[label];const[paths,minWidth,viewBoxHeight]=data;const height=viewBoxHeight/1000;const numSvgChildren=paths.length;let widthClasses;let aligns;if(numSvgChildren===1){// $FlowFixMe: All these cases must be of the 4-tuple type.
const align1=data[3];widthClasses=["hide-tail"];aligns=[align1];}else if(numSvgChildren===2){widthClasses=["halfarrow-left","halfarrow-right"];aligns=["xMinYMin","xMaxYMin"];}else if(numSvgChildren===3){widthClasses=["brace-left","brace-center","brace-right"];aligns=["xMinYMin","xMidYMin","xMaxYMin"];}else {throw new Error("Correct katexImagesData or update code here to support\n                    "+numSvgChildren+" children.");}for(let i=0;i<numSvgChildren;i++){const path=new PathNode(paths[i]);const svgNode=new SvgNode([path],{"width":"400em","height":makeEm(height),"viewBox":"0 0 "+viewBoxWidth+" "+viewBoxHeight,"preserveAspectRatio":aligns[i]+" slice"});const span=buildCommon.makeSvgSpan([widthClasses[i]],[svgNode],options);if(numSvgChildren===1){return {span,minWidth,height};}else {span.style.height=makeEm(height);spans.push(span);}}return {span:buildCommon.makeSpan(["stretchy"],spans,options),minWidth,height};}}// buildSvgSpan_()
const{span,minWidth,height}=buildSvgSpan_();// Note that we are returning span.depth = 0.
// Any adjustments relative to the baseline must be done in buildHTML.
span.height=height;span.style.height=makeEm(height);if(minWidth>0){span.style.minWidth=makeEm(minWidth);}return span;};const encloseSpan=function(inner,label,topPad,bottomPad,options){// Return an image span for \cancel, \bcancel, \xcancel, \fbox, or \angl
let img;const totalHeight=inner.height+inner.depth+topPad+bottomPad;if(/fbox|color|angl/.test(label)){img=buildCommon.makeSpan(["stretchy",label],[],options);if(label==="fbox"){const color=options.color&&options.getColor();if(color){img.style.borderColor=color;}}}else {// \cancel, \bcancel, or \xcancel
// Since \cancel's SVG is inline and it omits the viewBox attribute,
// its stroke-width will not vary with span area.
const lines=[];if(/^[bx]cancel$/.test(label)){lines.push(new LineNode({"x1":"0","y1":"0","x2":"100%","y2":"100%","stroke-width":"0.046em"}));}if(/^x?cancel$/.test(label)){lines.push(new LineNode({"x1":"0","y1":"100%","x2":"100%","y2":"0","stroke-width":"0.046em"}));}const svgNode=new SvgNode(lines,{"width":"100%","height":makeEm(totalHeight)});img=buildCommon.makeSvgSpan([],[svgNode],options);}img.height=totalHeight;img.style.height=makeEm(totalHeight);return img;};/* harmony default export */var stretchy={encloseSpan,mathMLnode,svgSpan};/**
 * Asserts that the node is of the given type and returns it with stricter
 * typing. Throws if the node's type does not match.
 */function assertNodeType(node,type){if(!node||node.type!==type){throw new Error("Expected node of type "+type+", but got "+(node?"node of type "+node.type:String(node)));}// $FlowFixMe, >=0.125
return node;}/**
 * Returns the node more strictly typed iff it is of the given type. Otherwise,
 * returns null.
 */function assertSymbolNodeType(node){const typedNode=checkSymbolNodeType(node);if(!typedNode){throw new Error("Expected node of symbol group type, but got "+(node?"node of type "+node.type:String(node)));}return typedNode;}/**
 * Returns the node more strictly typed iff it is of the given type. Otherwise,
 * returns null.
 */function checkSymbolNodeType(node){if(node&&(node.type==="atom"||NON_ATOMS.hasOwnProperty(node.type))){// $FlowFixMe
return node;}return null;}// NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but
// also "supsub" since an accent can affect super/subscripting.
const htmlBuilder=(grp,options)=>{// Accents are handled in the TeXbook pg. 443, rule 12.
let base;let group;let supSubGroup;if(grp&&grp.type==="supsub"){// If our base is a character box, and we have superscripts and
// subscripts, the supsub will defer to us. In particular, we want
// to attach the superscripts and subscripts to the inner body (so
// that the position of the superscripts and subscripts won't be
// affected by the height of the accent). We accomplish this by
// sticking the base of the accent into the base of the supsub, and
// rendering that, while keeping track of where the accent is.
// The real accent group is the base of the supsub group
group=assertNodeType(grp.base,"accent");// The character box is the base of the accent group
base=group.base;// Stick the character box into the base of the supsub group
grp.base=base;// Rerender the supsub group with its new base, and store that
// result.
supSubGroup=assertSpan(buildGroup(grp,options));// reset original base
grp.base=group;}else {group=assertNodeType(grp,"accent");base=group.base;}// Build the base group
const body=buildGroup(base,options.havingCrampedStyle());// Does the accent need to shift for the skew of a character?
const mustShift=group.isShifty&&utils.isCharacterBox(base);// Calculate the skew of the accent. This is based on the line "If the
// nucleus is not a single character, let s = 0; otherwise set s to the
// kern amount for the nucleus followed by the \skewchar of its font."
// Note that our skew metrics are just the kern between each character
// and the skewchar.
let skew=0;if(mustShift){// If the base is a character box, then we want the skew of the
// innermost character. To do that, we find the innermost character:
const baseChar=utils.getBaseElem(base);// Then, we render its group to get the symbol inside it
const baseGroup=buildGroup(baseChar,options.havingCrampedStyle());// Finally, we pull the skew off of the symbol.
skew=assertSymbolDomNode(baseGroup).skew;// Note that we now throw away baseGroup, because the layers we
// removed with getBaseElem might contain things like \color which
// we can't get rid of.
// TODO(emily): Find a better way to get the skew
}const accentBelow=group.label==="\\c";// calculate the amount of space between the body and the accent
let clearance=accentBelow?body.height+body.depth:Math.min(body.height,options.fontMetrics().xHeight);// Build the accent
let accentBody;if(!group.isStretchy){let accent;let width;if(group.label==="\\vec"){// Before version 0.9, \vec used the combining font glyph U+20D7.
// But browsers, especially Safari, are not consistent in how they
// render combining characters when not preceded by a character.
// So now we use an SVG.
// If Safari reforms, we should consider reverting to the glyph.
accent=buildCommon.staticSvg("vec",options);width=buildCommon.svgData.vec[1];}else {accent=buildCommon.makeOrd({mode:group.mode,text:group.label},options,"textord");accent=assertSymbolDomNode(accent);// Remove the italic correction of the accent, because it only serves to
// shift the accent over to a place we don't want.
accent.italic=0;width=accent.width;if(accentBelow){clearance+=accent.depth;}}accentBody=buildCommon.makeSpan(["accent-body"],[accent]);// "Full" accents expand the width of the resulting symbol to be
// at least the width of the accent, and overlap directly onto the
// character without any vertical offset.
const accentFull=group.label==="\\textcircled";if(accentFull){accentBody.classes.push('accent-full');clearance=body.height;}// Shift the accent over by the skew.
let left=skew;// CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }`
// so that the accent doesn't contribute to the bounding box.
// We need to shift the character by its width (effectively half
// its width) to compensate.
if(!accentFull){left-=width/2;}accentBody.style.left=makeEm(left);// \textcircled uses the \bigcirc glyph, so it needs some
// vertical adjustment to match LaTeX.
if(group.label==="\\textcircled"){accentBody.style.top=".2em";}accentBody=buildCommon.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:body},{type:"kern",size:-clearance},{type:"elem",elem:accentBody}]},options);}else {accentBody=stretchy.svgSpan(group,options);accentBody=buildCommon.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:body},{type:"elem",elem:accentBody,wrapperClasses:["svg-align"],wrapperStyle:skew>0?{width:"calc(100% - "+makeEm(2*skew)+")",marginLeft:makeEm(2*skew)}:undefined}]},options);}const accentWrap=buildCommon.makeSpan(["mord","accent"],[accentBody],options);if(supSubGroup){// Here, we replace the "base" child of the supsub with our newly
// generated accent.
supSubGroup.children[0]=accentWrap;// Since we don't rerun the height calculation after replacing the
// accent, we manually recalculate height.
supSubGroup.height=Math.max(accentWrap.height,supSubGroup.height);// Accents should always be ords, even when their innards are not.
supSubGroup.classes[0]="mord";return supSubGroup;}else {return accentWrap;}};const mathmlBuilder=(group,options)=>{const accentNode=group.isStretchy?stretchy.mathMLnode(group.label):new mathMLTree.MathNode("mo",[makeText(group.label,group.mode)]);const node=new mathMLTree.MathNode("mover",[buildMathML_buildGroup(group.base,options),accentNode]);node.setAttribute("accent","true");return node;};const NON_STRETCHY_ACCENT_REGEX=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(accent=>"\\"+accent).join("|"));// Accents
defineFunction({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(context,args)=>{const base=normalizeArgument(args[0]);const isStretchy=!NON_STRETCHY_ACCENT_REGEX.test(context.funcName);const isShifty=!isStretchy||context.funcName==="\\widehat"||context.funcName==="\\widetilde"||context.funcName==="\\widecheck";return {type:"accent",mode:context.parser.mode,label:context.funcName,isStretchy:isStretchy,isShifty:isShifty,base:base};},htmlBuilder,mathmlBuilder});// Text-mode accents
defineFunction({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:true,allowedInMath:true,// unless in strict mode
argTypes:["primitive"]},handler:(context,args)=>{const base=args[0];let mode=context.parser.mode;if(mode==="math"){context.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+context.funcName+" works only in text mode");mode="text";}return {type:"accent",mode:mode,label:context.funcName,isStretchy:false,isShifty:true,base:base};},htmlBuilder,mathmlBuilder});// Horizontal overlap functions
defineFunction({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(_ref,args)=>{let{parser,funcName}=_ref;const base=args[0];return {type:"accentUnder",mode:parser.mode,label:funcName,base:base};},htmlBuilder:(group,options)=>{// Treat under accents much like underlines.
const innerGroup=buildGroup(group.base,options);const accentBody=stretchy.svgSpan(group,options);const kern=group.label==="\\utilde"?0.12:0;// Generate the vlist, with the appropriate kerns
const vlist=buildCommon.makeVList({positionType:"top",positionData:innerGroup.height,children:[{type:"elem",elem:accentBody,wrapperClasses:["svg-align"]},{type:"kern",size:kern},{type:"elem",elem:innerGroup}]},options);return buildCommon.makeSpan(["mord","accentunder"],[vlist],options);},mathmlBuilder:(group,options)=>{const accentNode=stretchy.mathMLnode(group.label);const node=new mathMLTree.MathNode("munder",[buildMathML_buildGroup(group.base,options),accentNode]);node.setAttribute("accentunder","true");return node;}});// Helper function
const paddedNode=group=>{const node=new mathMLTree.MathNode("mpadded",group?[group]:[]);node.setAttribute("width","+0.6em");node.setAttribute("lspace","0.3em");return node;};// Stretchy arrows with an optional argument
defineFunction({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom",// The next 3 functions are here to support the mhchem extension.
// Direct use of these functions is discouraged and may break someday.
"\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium",// The next 3 functions are here only to support the {CD} environment.
"\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(_ref,args,optArgs){let{parser,funcName}=_ref;return {type:"xArrow",mode:parser.mode,label:funcName,body:args[0],below:optArgs[0]};},// Flow is unable to correctly infer the type of `group`, even though it's
// unambiguously determined from the passed-in `type` above.
htmlBuilder(group,options){const style=options.style;// Build the argument groups in the appropriate style.
// Ref: amsmath.dtx:   \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
// Some groups can return document fragments.  Handle those by wrapping
// them in a span.
let newOptions=options.havingStyle(style.sup());const upperGroup=buildCommon.wrapFragment(buildGroup(group.body,newOptions,options),options);const arrowPrefix=group.label.slice(0,2)==="\\x"?"x":"cd";upperGroup.classes.push(arrowPrefix+"-arrow-pad");let lowerGroup;if(group.below){// Build the lower group
newOptions=options.havingStyle(style.sub());lowerGroup=buildCommon.wrapFragment(buildGroup(group.below,newOptions,options),options);lowerGroup.classes.push(arrowPrefix+"-arrow-pad");}const arrowBody=stretchy.svgSpan(group,options);// Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0.
// The point we want on the math axis is at 0.5 * arrowBody.height.
const arrowShift=-options.fontMetrics().axisHeight+0.5*arrowBody.height;// 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi
let upperShift=-options.fontMetrics().axisHeight-0.5*arrowBody.height-0.111;// 0.111 em = 2 mu
if(upperGroup.depth>0.25||group.label==="\\xleftequilibrium"){upperShift-=upperGroup.depth;// shift up if depth encroaches
}// Generate the vlist
let vlist;if(lowerGroup){const lowerShift=-options.fontMetrics().axisHeight+lowerGroup.height+0.5*arrowBody.height+0.111;vlist=buildCommon.makeVList({positionType:"individualShift",children:[{type:"elem",elem:upperGroup,shift:upperShift},{type:"elem",elem:arrowBody,shift:arrowShift},{type:"elem",elem:lowerGroup,shift:lowerShift}]},options);}else {vlist=buildCommon.makeVList({positionType:"individualShift",children:[{type:"elem",elem:upperGroup,shift:upperShift},{type:"elem",elem:arrowBody,shift:arrowShift}]},options);}// $FlowFixMe: Replace this with passing "svg-align" into makeVList.
vlist.children[0].children[0].children[1].classes.push("svg-align");return buildCommon.makeSpan(["mrel","x-arrow"],[vlist],options);},mathmlBuilder(group,options){const arrowNode=stretchy.mathMLnode(group.label);arrowNode.setAttribute("minsize",group.label.charAt(0)==="x"?"1.75em":"3.0em");let node;if(group.body){const upperNode=paddedNode(buildMathML_buildGroup(group.body,options));if(group.below){const lowerNode=paddedNode(buildMathML_buildGroup(group.below,options));node=new mathMLTree.MathNode("munderover",[arrowNode,lowerNode,upperNode]);}else {node=new mathMLTree.MathNode("mover",[arrowNode,upperNode]);}}else if(group.below){const lowerNode=paddedNode(buildMathML_buildGroup(group.below,options));node=new mathMLTree.MathNode("munder",[arrowNode,lowerNode]);}else {// This should never happen.
// Parser.js throws an error if there is no argument.
node=paddedNode();node=new mathMLTree.MathNode("mover",[arrowNode,node]);}return node;}});const mclass_makeSpan=buildCommon.makeSpan;function mclass_htmlBuilder(group,options){const elements=buildExpression(group.body,options,true);return mclass_makeSpan([group.mclass],elements,options);}function mclass_mathmlBuilder(group,options){let node;const inner=buildMathML_buildExpression(group.body,options);if(group.mclass==="minner"){node=new mathMLTree.MathNode("mpadded",inner);}else if(group.mclass==="mord"){if(group.isCharacterBox){node=inner[0];node.type="mi";}else {node=new mathMLTree.MathNode("mi",inner);}}else {if(group.isCharacterBox){node=inner[0];node.type="mo";}else {node=new mathMLTree.MathNode("mo",inner);}// Set spacing based on what is the most likely adjacent atom type.
// See TeXbook p170.
if(group.mclass==="mbin"){node.attributes.lspace="0.22em";// medium space
node.attributes.rspace="0.22em";}else if(group.mclass==="mpunct"){node.attributes.lspace="0em";node.attributes.rspace="0.17em";// thinspace
}else if(group.mclass==="mopen"||group.mclass==="mclose"){node.attributes.lspace="0em";node.attributes.rspace="0em";}else if(group.mclass==="minner"){node.attributes.lspace="0.0556em";// 1 mu is the most likely option
node.attributes.width="+0.1111em";}// MathML <mo> default space is 5/18 em, so <mrel> needs no action.
// Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
}return node;}// Math class commands except \mathop
defineFunction({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:true},handler(_ref,args){let{parser,funcName}=_ref;const body=args[0];return {type:"mclass",mode:parser.mode,mclass:"m"+funcName.slice(5),// TODO(kevinb): don't prefix with 'm'
body:ordargument(body),isCharacterBox:utils.isCharacterBox(body)};},htmlBuilder:mclass_htmlBuilder,mathmlBuilder:mclass_mathmlBuilder});const binrelClass=arg=>{// \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument.
// (by rendering separately and with {}s before and after, and measuring
// the change in spacing).  We'll do roughly the same by detecting the
// atom type directly.
const atom=arg.type==="ordgroup"&&arg.body.length?arg.body[0]:arg;if(atom.type==="atom"&&(atom.family==="bin"||atom.family==="rel")){return "m"+atom.family;}else {return "mord";}};// \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord.
// This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX.
defineFunction({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(_ref2,args){let{parser}=_ref2;return {type:"mclass",mode:parser.mode,mclass:binrelClass(args[0]),body:ordargument(args[1]),isCharacterBox:utils.isCharacterBox(args[1])};}});// Build a relation or stacked op by placing one symbol on top of another
defineFunction({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(_ref3,args){let{parser,funcName}=_ref3;const baseArg=args[1];const shiftedArg=args[0];let mclass;if(funcName!=="\\stackrel"){// LaTeX applies \binrel spacing to \overset and \underset.
mclass=binrelClass(baseArg);}else {mclass="mrel";// for \stackrel
}const baseOp={type:"op",mode:baseArg.mode,limits:true,alwaysHandleSupSub:true,parentIsSupSub:false,symbol:false,suppressBaseShift:funcName!=="\\stackrel",body:ordargument(baseArg)};const supsub={type:"supsub",mode:shiftedArg.mode,base:baseOp,sup:funcName==="\\underset"?null:shiftedArg,sub:funcName==="\\underset"?shiftedArg:null};return {type:"mclass",mode:parser.mode,mclass,body:[supsub],isCharacterBox:utils.isCharacterBox(supsub)};},htmlBuilder:mclass_htmlBuilder,mathmlBuilder:mclass_mathmlBuilder});// \pmb is a simulation of bold font.
// The version of \pmb in ambsy.sty works by typesetting three copies
// with small offsets. We use CSS text-shadow.
// It's a hack. Not as good as a real bold font. Better than nothing.
defineFunction({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:true},handler(_ref,args){let{parser}=_ref;return {type:"pmb",mode:parser.mode,mclass:binrelClass(args[0]),body:ordargument(args[0])};},htmlBuilder(group,options){const elements=buildExpression(group.body,options,true);const node=buildCommon.makeSpan([group.mclass],elements,options);node.style.textShadow="0.02em 0.01em 0.04px";return node;},mathmlBuilder(group,style){const inner=buildMathML_buildExpression(group.body,style);// Wrap with an <mstyle> element.
const node=new mathMLTree.MathNode("mstyle",inner);node.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px");return node;}});const cdArrowFunctionName={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal","A":"\\uparrow","V":"\\downarrow","|":"\\Vert",".":"no arrow"};const newCell=()=>{// Create an empty cell, to be filled below with parse nodes.
// The parseTree from this module must be constructed like the
// one created by parseArray(), so an empty CD cell must
// be a ParseNode<"styling">. And CD is always displaystyle.
// So these values are fixed and flow can do implicit typing.
return {type:"styling",body:[],mode:"math",style:"display"};};const isStartOfArrow=node=>{return node.type==="textord"&&node.text==="@";};const isLabelEnd=(node,endChar)=>{return (node.type==="mathord"||node.type==="atom")&&node.text===endChar;};function cdArrow(arrowChar,labels,parser){// Return a parse tree of an arrow and its labels.
// This acts in a way similar to a macro expansion.
const funcName=cdArrowFunctionName[arrowChar];switch(funcName){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return parser.callFunction(funcName,[labels[0]],[labels[1]]);case"\\uparrow":case"\\downarrow":{const leftLabel=parser.callFunction("\\\\cdleft",[labels[0]],[]);const bareArrow={type:"atom",text:funcName,mode:"math",family:"rel"};const sizedArrow=parser.callFunction("\\Big",[bareArrow],[]);const rightLabel=parser.callFunction("\\\\cdright",[labels[1]],[]);const arrowGroup={type:"ordgroup",mode:"math",body:[leftLabel,sizedArrow,rightLabel]};return parser.callFunction("\\\\cdparent",[arrowGroup],[]);}case"\\\\cdlongequal":return parser.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{const arrow={type:"textord",text:"\\Vert",mode:"math"};return parser.callFunction("\\Big",[arrow],[]);}default:return {type:"textord",text:" ",mode:"math"};}}function parseCD(parser){// Get the array's parse nodes with \\ temporarily mapped to \cr.
const parsedRows=[];parser.gullet.beginGroup();parser.gullet.macros.set("\\cr","\\\\\\relax");parser.gullet.beginGroup();while(true){// eslint-disable-line no-constant-condition
// Get the parse nodes for the next row.
parsedRows.push(parser.parseExpression(false,"\\\\"));parser.gullet.endGroup();parser.gullet.beginGroup();const next=parser.fetch().text;if(next==="&"||next==="\\\\"){parser.consume();}else if(next==="\\end"){if(parsedRows[parsedRows.length-1].length===0){parsedRows.pop();// final row ended in \\
}break;}else {throw new src_ParseError("Expected \\\\ or \\cr or \\end",parser.nextToken);}}let row=[];const body=[row];// Loop thru the parse nodes. Collect them into cells and arrows.
for(let i=0;i<parsedRows.length;i++){// Start a new row.
const rowNodes=parsedRows[i];// Create the first cell.
let cell=newCell();for(let j=0;j<rowNodes.length;j++){if(!isStartOfArrow(rowNodes[j])){// If a parseNode is not an arrow, it goes into a cell.
cell.body.push(rowNodes[j]);}else {// Parse node j is an "@", the start of an arrow.
// Before starting on the arrow, push the cell into `row`.
row.push(cell);// Now collect parseNodes into an arrow.
// The character after "@" defines the arrow type.
j+=1;const arrowChar=assertSymbolNodeType(rowNodes[j]).text;// Create two empty label nodes. We may or may not use them.
const labels=new Array(2);labels[0]={type:"ordgroup",mode:"math",body:[]};labels[1]={type:"ordgroup",mode:"math",body:[]};// Process the arrow.
if("=|.".indexOf(arrowChar)>-1);else if("<>AV".indexOf(arrowChar)>-1){// Four arrows, `@>>>`, `@<<<`, `@AAA`, and `@VVV`, each take
// two optional labels. E.g. the right-point arrow syntax is
// really:  @>{optional label}>{optional label}>
// Collect parseNodes into labels.
for(let labelNum=0;labelNum<2;labelNum++){let inLabel=true;for(let k=j+1;k<rowNodes.length;k++){if(isLabelEnd(rowNodes[k],arrowChar)){inLabel=false;j=k;break;}if(isStartOfArrow(rowNodes[k])){throw new src_ParseError("Missing a "+arrowChar+" character to complete a CD arrow.",rowNodes[k]);}labels[labelNum].body.push(rowNodes[k]);}if(inLabel){// isLabelEnd never returned a true.
throw new src_ParseError("Missing a "+arrowChar+" character to complete a CD arrow.",rowNodes[j]);}}}else {throw new src_ParseError("Expected one of \"<>AV=|.\" after @",rowNodes[j]);}// Now join the arrow to its labels.
const arrow=cdArrow(arrowChar,labels,parser);// Wrap the arrow in  ParseNode<"styling">.
// This is done to match parseArray() behavior.
const wrappedArrow={type:"styling",body:[arrow],mode:"math",style:"display"// CD is always displaystyle.
};row.push(wrappedArrow);// In CD's syntax, cells are implicit. That is, everything that
// is not an arrow gets collected into a cell. So create an empty
// cell now. It will collect upcoming parseNodes.
cell=newCell();}}if(i%2===0){// Even-numbered rows consist of: cell, arrow, cell, arrow, ... cell
// The last cell is not yet pushed into `row`, so:
row.push(cell);}else {// Odd-numbered rows consist of: vert arrow, empty cell, ... vert arrow
// Remove the empty cell that was placed at the beginning of `row`.
row.shift();}row=[];body.push(row);}// End row group
parser.gullet.endGroup();// End array group defining \\
parser.gullet.endGroup();// define column separation.
const cols=new Array(body[0].length).fill({type:"align",align:"c",pregap:0.25,// CD package sets \enskip between columns.
postgap:0.25// So pre and post each get half an \enskip, i.e. 0.25em.
});return {type:"array",mode:"math",body,arraystretch:1,addJot:true,rowGaps:[null],cols,colSeparationType:"CD",hLinesBeforeRow:new Array(body.length+1).fill([])};}// The functions below are not available for general use.
// They are here only for internal use by the {CD} environment in placing labels
// next to vertical arrows.
// We don't need any such functions for horizontal arrows because we can reuse
// the functionality that already exists for extensible arrows.
defineFunction({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(_ref,args){let{parser,funcName}=_ref;return {type:"cdlabel",mode:parser.mode,side:funcName.slice(4),label:args[0]};},htmlBuilder(group,options){const newOptions=options.havingStyle(options.style.sup());const label=buildCommon.wrapFragment(buildGroup(group.label,newOptions,options),options);label.classes.push("cd-label-"+group.side);label.style.bottom=makeEm(0.8-label.depth);// Zero out label height & depth, so vertical align of arrow is set
// by the arrow height, not by the label.
label.height=0;label.depth=0;return label;},mathmlBuilder(group,options){let label=new mathMLTree.MathNode("mrow",[buildMathML_buildGroup(group.label,options)]);label=new mathMLTree.MathNode("mpadded",[label]);label.setAttribute("width","0");if(group.side==="left"){label.setAttribute("lspace","-1width");}// We have to guess at vertical alignment. We know the arrow is 1.8em tall,
// But we don't know the height or depth of the label.
label.setAttribute("voffset","0.7em");label=new mathMLTree.MathNode("mstyle",[label]);label.setAttribute("displaystyle","false");label.setAttribute("scriptlevel","1");return label;}});defineFunction({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(_ref2,args){let{parser}=_ref2;return {type:"cdlabelparent",mode:parser.mode,fragment:args[0]};},htmlBuilder(group,options){// Wrap the vertical arrow and its labels.
// The parent gets position: relative. The child gets position: absolute.
// So CSS can locate the label correctly.
const parent=buildCommon.wrapFragment(buildGroup(group.fragment,options),options);parent.classes.push("cd-vert-arrow");return parent;},mathmlBuilder(group,options){return new mathMLTree.MathNode("mrow",[buildMathML_buildGroup(group.fragment,options)]);}});// \@char is an internal function that takes a grouped decimal argument like
// {123} and converts into symbol with code 123.  It is used by the *macro*
// \char defined in macros.js.
defineFunction({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:true},handler(_ref,args){let{parser}=_ref;const arg=assertNodeType(args[0],"ordgroup");const group=arg.body;let number="";for(let i=0;i<group.length;i++){const node=assertNodeType(group[i],"textord");number+=node.text;}let code=parseInt(number);let text;if(isNaN(code)){throw new src_ParseError("\\@char has non-numeric argument "+number);// If we drop IE support, the following code could be replaced with
// text = String.fromCodePoint(code)
}else if(code<0||code>=0x10ffff){throw new src_ParseError("\\@char with invalid code point "+number);}else if(code<=0xffff){text=String.fromCharCode(code);}else {// Astral code point; split into surrogate halves
code-=0x10000;text=String.fromCharCode((code>>10)+0xd800,(code&0x3ff)+0xdc00);}return {type:"textord",mode:parser.mode,text:text};}});const color_htmlBuilder=(group,options)=>{const elements=buildExpression(group.body,options.withColor(group.color),false);// \color isn't supposed to affect the type of the elements it contains.
// To accomplish this, we wrap the results in a fragment, so the inner
// elements will be able to directly interact with their neighbors. For
// example, `\color{red}{2 +} 3` has the same spacing as `2 + 3`
return buildCommon.makeFragment(elements);};const color_mathmlBuilder=(group,options)=>{const inner=buildMathML_buildExpression(group.body,options.withColor(group.color));const node=new mathMLTree.MathNode("mstyle",inner);node.setAttribute("mathcolor",group.color);return node;};defineFunction({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:true,argTypes:["color","original"]},handler(_ref,args){let{parser}=_ref;const color=assertNodeType(args[0],"color-token").color;const body=args[1];return {type:"color",mode:parser.mode,color,body:ordargument(body)};},htmlBuilder:color_htmlBuilder,mathmlBuilder:color_mathmlBuilder});defineFunction({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:true,argTypes:["color"]},handler(_ref2,args){let{parser,breakOnTokenText}=_ref2;const color=assertNodeType(args[0],"color-token").color;// Set macro \current@color in current namespace to store the current
// color, mimicking the behavior of color.sty.
// This is currently used just to correctly color a \right
// that follows a \color command.
parser.gullet.macros.set("\\current@color",color);// Parse out the implicit body that should be colored.
const body=parser.parseExpression(true,breakOnTokenText);return {type:"color",mode:parser.mode,color,body};},htmlBuilder:color_htmlBuilder,mathmlBuilder:color_mathmlBuilder});// Row breaks within tabular environments, and line breaks at top level
// \DeclareRobustCommand\\{...\@xnewline}
defineFunction({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:true},handler(_ref,args,optArgs){let{parser}=_ref;const size=parser.gullet.future().text==="["?parser.parseSizeGroup(true):null;const newLine=!parser.settings.displayMode||!parser.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline "+"does nothing in display mode");return {type:"cr",mode:parser.mode,newLine,size:size&&assertNodeType(size,"size").value};},// The following builders are called only at the top level,
// not within tabular/array environments.
htmlBuilder(group,options){const span=buildCommon.makeSpan(["mspace"],[],options);if(group.newLine){span.classes.push("newline");if(group.size){span.style.marginTop=makeEm(calculateSize(group.size,options));}}return span;},mathmlBuilder(group,options){const node=new mathMLTree.MathNode("mspace");if(group.newLine){node.setAttribute("linebreak","newline");if(group.size){node.setAttribute("height",makeEm(calculateSize(group.size,options)));}}return node;}});const globalMap={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"};const checkControlSequence=tok=>{const name=tok.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(name)){throw new src_ParseError("Expected a control sequence",tok);}return name;};const getRHS=parser=>{let tok=parser.gullet.popToken();if(tok.text==="="){// consume optional equals
tok=parser.gullet.popToken();if(tok.text===" "){// consume one optional space
tok=parser.gullet.popToken();}}return tok;};const letCommand=(parser,name,tok,global)=>{let macro=parser.gullet.macros.get(tok.text);if(macro==null){// don't expand it later even if a macro with the same name is defined
// e.g., \let\foo=\frac \def\frac{\relax} \frac12
tok.noexpand=true;macro={tokens:[tok],numArgs:0,// reproduce the same behavior in expansion
unexpandable:!parser.gullet.isExpandable(tok.text)};}parser.gullet.macros.set(name,macro,global);};// <assignment> -> <non-macro assignment>|<macro assignment>
// <non-macro assignment> -> <simple assignment>|\global<non-macro assignment>
// <macro assignment> -> <definition>|<prefix><macro assignment>
// <prefix> -> \global|\long|\outer
defineFunction({type:"internal",names:["\\global","\\long","\\\\globallong"// can’t be entered directly
],props:{numArgs:0,allowedInText:true},handler(_ref){let{parser,funcName}=_ref;parser.consumeSpaces();const token=parser.fetch();if(globalMap[token.text]){// KaTeX doesn't have \par, so ignore \long
if(funcName==="\\global"||funcName==="\\\\globallong"){token.text=globalMap[token.text];}return assertNodeType(parser.parseFunction(),"internal");}throw new src_ParseError("Invalid token after macro prefix",token);}});// Basic support for macro definitions: \def, \gdef, \edef, \xdef
// <definition> -> <def><control sequence><definition text>
// <def> -> \def|\gdef|\edef|\xdef
// <definition text> -> <parameter text><left brace><balanced text><right brace>
defineFunction({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:true,primitive:true},handler(_ref2){let{parser,funcName}=_ref2;let tok=parser.gullet.popToken();const name=tok.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(name)){throw new src_ParseError("Expected a control sequence",tok);}let numArgs=0;let insert;const delimiters=[[]];// <parameter text> contains no braces
while(parser.gullet.future().text!=="{"){tok=parser.gullet.popToken();if(tok.text==="#"){// If the very last character of the <parameter text> is #, so that
// this # is immediately followed by {, TeX will behave as if the {
// had been inserted at the right end of both the parameter text
// and the replacement text.
if(parser.gullet.future().text==="{"){insert=parser.gullet.future();delimiters[numArgs].push("{");break;}// A parameter, the first appearance of # must be followed by 1,
// the next by 2, and so on; up to nine #’s are allowed
tok=parser.gullet.popToken();if(!/^[1-9]$/.test(tok.text)){throw new src_ParseError("Invalid argument number \""+tok.text+"\"");}if(parseInt(tok.text)!==numArgs+1){throw new src_ParseError("Argument number \""+tok.text+"\" out of order");}numArgs++;delimiters.push([]);}else if(tok.text==="EOF"){throw new src_ParseError("Expected a macro definition");}else {delimiters[numArgs].push(tok.text);}}// replacement text, enclosed in '{' and '}' and properly nested
let{tokens}=parser.gullet.consumeArg();if(insert){tokens.unshift(insert);}if(funcName==="\\edef"||funcName==="\\xdef"){tokens=parser.gullet.expandTokens(tokens);tokens.reverse();// to fit in with stack order
}// Final arg is the expansion of the macro
parser.gullet.macros.set(name,{tokens,numArgs,delimiters},funcName===globalMap[funcName]);return {type:"internal",mode:parser.mode};}});// <simple assignment> -> <let assignment>
// <let assignment> -> \futurelet<control sequence><token><token>
//     | \let<control sequence><equals><one optional space><token>
// <equals> -> <optional spaces>|<optional spaces>=
defineFunction({type:"internal",names:["\\let","\\\\globallet"// can’t be entered directly
],props:{numArgs:0,allowedInText:true,primitive:true},handler(_ref3){let{parser,funcName}=_ref3;const name=checkControlSequence(parser.gullet.popToken());parser.gullet.consumeSpaces();const tok=getRHS(parser);letCommand(parser,name,tok,funcName==="\\\\globallet");return {type:"internal",mode:parser.mode};}});// ref: https://www.tug.org/TUGboat/tb09-3/tb22bechtolsheim.pdf
defineFunction({type:"internal",names:["\\futurelet","\\\\globalfuture"// can’t be entered directly
],props:{numArgs:0,allowedInText:true,primitive:true},handler(_ref4){let{parser,funcName}=_ref4;const name=checkControlSequence(parser.gullet.popToken());const middle=parser.gullet.popToken();const tok=parser.gullet.popToken();letCommand(parser,name,tok,funcName==="\\\\globalfuture");parser.gullet.pushToken(tok);parser.gullet.pushToken(middle);return {type:"internal",mode:parser.mode};}});/**
 * This file deals with creating delimiters of various sizes. The TeXbook
 * discusses these routines on page 441-442, in the "Another subroutine sets box
 * x to a specified variable delimiter" paragraph.
 *
 * There are three main routines here. `makeSmallDelim` makes a delimiter in the
 * normal font, but in either text, script, or scriptscript style.
 * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1,
 * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of
 * smaller pieces that are stacked on top of one another.
 *
 * The functions take a parameter `center`, which determines if the delimiter
 * should be centered around the axis.
 *
 * Then, there are three exposed functions. `sizedDelim` makes a delimiter in
 * one of the given sizes. This is used for things like `\bigl`.
 * `customSizedDelim` makes a delimiter with a given total height+depth. It is
 * called in places like `\sqrt`. `leftRightDelim` makes an appropriate
 * delimiter which surrounds an expression of a given height an depth. It is
 * used in `\left` and `\right`.
 *//**
 * Get the metrics for a given symbol and font, after transformation (i.e.
 * after following replacement from symbols.js)
 */const getMetrics=function(symbol,font,mode){const replace=src_symbols.math[symbol]&&src_symbols.math[symbol].replace;const metrics=getCharacterMetrics(replace||symbol,font,mode);if(!metrics){throw new Error("Unsupported symbol "+symbol+" and font size "+font+".");}return metrics;};/**
 * Puts a delimiter span in a given style, and adds appropriate height, depth,
 * and maxFontSizes.
 */const styleWrap=function(delim,toStyle,options,classes){const newOptions=options.havingBaseStyle(toStyle);const span=buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)),[delim],options);const delimSizeMultiplier=newOptions.sizeMultiplier/options.sizeMultiplier;span.height*=delimSizeMultiplier;span.depth*=delimSizeMultiplier;span.maxFontSize=newOptions.sizeMultiplier;return span;};const centerSpan=function(span,options,style){const newOptions=options.havingBaseStyle(style);const shift=(1-options.sizeMultiplier/newOptions.sizeMultiplier)*options.fontMetrics().axisHeight;span.classes.push("delimcenter");span.style.top=makeEm(shift);span.height-=shift;span.depth+=shift;};/**
 * Makes a small delimiter. This is a delimiter that comes in the Main-Regular
 * font, but is restyled to either be in textstyle, scriptstyle, or
 * scriptscriptstyle.
 */const makeSmallDelim=function(delim,style,center,options,mode,classes){const text=buildCommon.makeSymbol(delim,"Main-Regular",mode,options);const span=styleWrap(text,style,options,classes);if(center){centerSpan(span,options,style);}return span;};/**
 * Builds a symbol in the given font size (note size is an integer)
 */const mathrmSize=function(value,size,mode,options){return buildCommon.makeSymbol(value,"Size"+size+"-Regular",mode,options);};/**
 * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2,
 * Size3, or Size4 fonts. It is always rendered in textstyle.
 */const makeLargeDelim=function(delim,size,center,options,mode,classes){const inner=mathrmSize(delim,size,mode,options);const span=styleWrap(buildCommon.makeSpan(["delimsizing","size"+size],[inner],options),src_Style.TEXT,options,classes);if(center){centerSpan(span,options,src_Style.TEXT);}return span;};/**
 * Make a span from a font glyph with the given offset and in the given font.
 * This is used in makeStackedDelim to make the stacking pieces for the delimiter.
 */const makeGlyphSpan=function(symbol,font,mode){let sizeClass;// Apply the correct CSS class to choose the right font.
if(font==="Size1-Regular"){sizeClass="delim-size1";}else/* if (font === "Size4-Regular") */{sizeClass="delim-size4";}const corner=buildCommon.makeSpan(["delimsizinginner",sizeClass],[buildCommon.makeSpan([],[buildCommon.makeSymbol(symbol,font,mode)])]);// Since this will be passed into `makeVList` in the end, wrap the element
// in the appropriate tag that VList uses.
return {type:"elem",elem:corner};};const makeInner=function(ch,height,options){// Create a span with inline SVG for the inner part of a tall stacked delimiter.
const width=fontMetricsData['Size4-Regular'][ch.charCodeAt(0)]?fontMetricsData['Size4-Regular'][ch.charCodeAt(0)][4]:fontMetricsData['Size1-Regular'][ch.charCodeAt(0)][4];const path=new PathNode("inner",innerPath(ch,Math.round(1000*height)));const svgNode=new SvgNode([path],{"width":makeEm(width),"height":makeEm(height),// Override CSS rule `.katex svg { width: 100% }`
"style":"width:"+makeEm(width),"viewBox":"0 0 "+1000*width+" "+Math.round(1000*height),"preserveAspectRatio":"xMinYMin"});const span=buildCommon.makeSvgSpan([],[svgNode],options);span.height=height;span.style.height=makeEm(height);span.style.width=makeEm(width);return {type:"elem",elem:span};};// Helpers for makeStackedDelim
const lapInEms=0.008;const lap={type:"kern",size:-1*lapInEms};const verts=["|","\\lvert","\\rvert","\\vert"];const doubleVerts=["\\|","\\lVert","\\rVert","\\Vert"];/**
 * Make a stacked delimiter out of a given delimiter, with the total height at
 * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook.
 */const makeStackedDelim=function(delim,heightTotal,center,options,mode,classes){// There are four parts, the top, an optional middle, a repeated part, and a
// bottom.
let top;let middle;let repeat;let bottom;let svgLabel="";let viewBoxWidth=0;top=repeat=bottom=delim;middle=null;// Also keep track of what font the delimiters are in
let font="Size1-Regular";// We set the parts and font based on the symbol. Note that we use
// '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the
// repeats of the arrows
if(delim==="\\uparrow"){repeat=bottom="\u23d0";}else if(delim==="\\Uparrow"){repeat=bottom="\u2016";}else if(delim==="\\downarrow"){top=repeat="\u23d0";}else if(delim==="\\Downarrow"){top=repeat="\u2016";}else if(delim==="\\updownarrow"){top="\\uparrow";repeat="\u23d0";bottom="\\downarrow";}else if(delim==="\\Updownarrow"){top="\\Uparrow";repeat="\u2016";bottom="\\Downarrow";}else if(utils.contains(verts,delim)){repeat="\u2223";svgLabel="vert";viewBoxWidth=333;}else if(utils.contains(doubleVerts,delim)){repeat="\u2225";svgLabel="doublevert";viewBoxWidth=556;}else if(delim==="["||delim==="\\lbrack"){top="\u23a1";repeat="\u23a2";bottom="\u23a3";font="Size4-Regular";svgLabel="lbrack";viewBoxWidth=667;}else if(delim==="]"||delim==="\\rbrack"){top="\u23a4";repeat="\u23a5";bottom="\u23a6";font="Size4-Regular";svgLabel="rbrack";viewBoxWidth=667;}else if(delim==="\\lfloor"||delim==="\u230a"){repeat=top="\u23a2";bottom="\u23a3";font="Size4-Regular";svgLabel="lfloor";viewBoxWidth=667;}else if(delim==="\\lceil"||delim==="\u2308"){top="\u23a1";repeat=bottom="\u23a2";font="Size4-Regular";svgLabel="lceil";viewBoxWidth=667;}else if(delim==="\\rfloor"||delim==="\u230b"){repeat=top="\u23a5";bottom="\u23a6";font="Size4-Regular";svgLabel="rfloor";viewBoxWidth=667;}else if(delim==="\\rceil"||delim==="\u2309"){top="\u23a4";repeat=bottom="\u23a5";font="Size4-Regular";svgLabel="rceil";viewBoxWidth=667;}else if(delim==="("||delim==="\\lparen"){top="\u239b";repeat="\u239c";bottom="\u239d";font="Size4-Regular";svgLabel="lparen";viewBoxWidth=875;}else if(delim===")"||delim==="\\rparen"){top="\u239e";repeat="\u239f";bottom="\u23a0";font="Size4-Regular";svgLabel="rparen";viewBoxWidth=875;}else if(delim==="\\{"||delim==="\\lbrace"){top="\u23a7";middle="\u23a8";bottom="\u23a9";repeat="\u23aa";font="Size4-Regular";}else if(delim==="\\}"||delim==="\\rbrace"){top="\u23ab";middle="\u23ac";bottom="\u23ad";repeat="\u23aa";font="Size4-Regular";}else if(delim==="\\lgroup"||delim==="\u27ee"){top="\u23a7";bottom="\u23a9";repeat="\u23aa";font="Size4-Regular";}else if(delim==="\\rgroup"||delim==="\u27ef"){top="\u23ab";bottom="\u23ad";repeat="\u23aa";font="Size4-Regular";}else if(delim==="\\lmoustache"||delim==="\u23b0"){top="\u23a7";bottom="\u23ad";repeat="\u23aa";font="Size4-Regular";}else if(delim==="\\rmoustache"||delim==="\u23b1"){top="\u23ab";bottom="\u23a9";repeat="\u23aa";font="Size4-Regular";}// Get the metrics of the four sections
const topMetrics=getMetrics(top,font,mode);const topHeightTotal=topMetrics.height+topMetrics.depth;const repeatMetrics=getMetrics(repeat,font,mode);const repeatHeightTotal=repeatMetrics.height+repeatMetrics.depth;const bottomMetrics=getMetrics(bottom,font,mode);const bottomHeightTotal=bottomMetrics.height+bottomMetrics.depth;let middleHeightTotal=0;let middleFactor=1;if(middle!==null){const middleMetrics=getMetrics(middle,font,mode);middleHeightTotal=middleMetrics.height+middleMetrics.depth;middleFactor=2;// repeat symmetrically above and below middle
}// Calculate the minimal height that the delimiter can have.
// It is at least the size of the top, bottom, and optional middle combined.
const minHeight=topHeightTotal+bottomHeightTotal+middleHeightTotal;// Compute the number of copies of the repeat symbol we will need
const repeatCount=Math.max(0,Math.ceil((heightTotal-minHeight)/(middleFactor*repeatHeightTotal)));// Compute the total height of the delimiter including all the symbols
const realHeightTotal=minHeight+repeatCount*middleFactor*repeatHeightTotal;// The center of the delimiter is placed at the center of the axis. Note
// that in this context, "center" means that the delimiter should be
// centered around the axis in the current style, while normally it is
// centered around the axis in textstyle.
let axisHeight=options.fontMetrics().axisHeight;if(center){axisHeight*=options.sizeMultiplier;}// Calculate the depth
const depth=realHeightTotal/2-axisHeight;// Now, we start building the pieces that will go into the vlist
// Keep a list of the pieces of the stacked delimiter
const stack=[];if(svgLabel.length>0){// Instead of stacking glyphs, create a single SVG.
// This evades browser problems with imprecise positioning of spans.
const midHeight=realHeightTotal-topHeightTotal-bottomHeightTotal;const viewBoxHeight=Math.round(realHeightTotal*1000);const pathStr=tallDelim(svgLabel,Math.round(midHeight*1000));const path=new PathNode(svgLabel,pathStr);const width=(viewBoxWidth/1000).toFixed(3)+"em";const height=(viewBoxHeight/1000).toFixed(3)+"em";const svg=new SvgNode([path],{"width":width,"height":height,"viewBox":"0 0 "+viewBoxWidth+" "+viewBoxHeight});const wrapper=buildCommon.makeSvgSpan([],[svg],options);wrapper.height=viewBoxHeight/1000;wrapper.style.width=width;wrapper.style.height=height;stack.push({type:"elem",elem:wrapper});}else {// Stack glyphs
// Start by adding the bottom symbol
stack.push(makeGlyphSpan(bottom,font,mode));stack.push(lap);// overlap
if(middle===null){// The middle section will be an SVG. Make it an extra 0.016em tall.
// We'll overlap by 0.008em at top and bottom.
const innerHeight=realHeightTotal-topHeightTotal-bottomHeightTotal+2*lapInEms;stack.push(makeInner(repeat,innerHeight,options));}else {// When there is a middle bit, we need the middle part and two repeated
// sections
const innerHeight=(realHeightTotal-topHeightTotal-bottomHeightTotal-middleHeightTotal)/2+2*lapInEms;stack.push(makeInner(repeat,innerHeight,options));// Now insert the middle of the brace.
stack.push(lap);stack.push(makeGlyphSpan(middle,font,mode));stack.push(lap);stack.push(makeInner(repeat,innerHeight,options));}// Add the top symbol
stack.push(lap);stack.push(makeGlyphSpan(top,font,mode));}// Finally, build the vlist
const newOptions=options.havingBaseStyle(src_Style.TEXT);const inner=buildCommon.makeVList({positionType:"bottom",positionData:depth,children:stack},newOptions);return styleWrap(buildCommon.makeSpan(["delimsizing","mult"],[inner],newOptions),src_Style.TEXT,options,classes);};// All surds have 0.08em padding above the vinculum inside the SVG.
// That keeps browser span height rounding error from pinching the line.
const vbPad=80;// padding above the surd, measured inside the viewBox.
const emPad=0.08;// padding, in ems, measured in the document.
const sqrtSvg=function(sqrtName,height,viewBoxHeight,extraVinculum,options){const path=sqrtPath(sqrtName,extraVinculum,viewBoxHeight);const pathNode=new PathNode(sqrtName,path);const svg=new SvgNode([pathNode],{// Note: 1000:1 ratio of viewBox to document em width.
"width":"400em","height":makeEm(height),"viewBox":"0 0 400000 "+viewBoxHeight,"preserveAspectRatio":"xMinYMin slice"});return buildCommon.makeSvgSpan(["hide-tail"],[svg],options);};/**
 * Make a sqrt image of the given height,
 */const makeSqrtImage=function(height,options){// Define a newOptions that removes the effect of size changes such as \Huge.
// We don't pick different a height surd for \Huge. For it, we scale up.
const newOptions=options.havingBaseSizing();// Pick the desired surd glyph from a sequence of surds.
const delim=traverseSequence("\\surd",height*newOptions.sizeMultiplier,stackLargeDelimiterSequence,newOptions);let sizeMultiplier=newOptions.sizeMultiplier;// default
// The standard sqrt SVGs each have a 0.04em thick vinculum.
// If Settings.minRuleThickness is larger than that, we add extraVinculum.
const extraVinculum=Math.max(0,options.minRuleThickness-options.fontMetrics().sqrtRuleThickness);// Create a span containing an SVG image of a sqrt symbol.
let span;let spanHeight=0;let texHeight=0;let viewBoxHeight=0;let advanceWidth;// We create viewBoxes with 80 units of "padding" above each surd.
// Then browser rounding error on the parent span height will not
// encroach on the ink of the vinculum. But that padding is not
// included in the TeX-like `height` used for calculation of
// vertical alignment. So texHeight = span.height < span.style.height.
if(delim.type==="small"){// Get an SVG that is derived from glyph U+221A in font KaTeX-Main.
// 1000 unit normal glyph height.
viewBoxHeight=1000+1000*extraVinculum+vbPad;if(height<1.0){sizeMultiplier=1.0;// mimic a \textfont radical
}else if(height<1.4){sizeMultiplier=0.7;// mimic a \scriptfont radical
}spanHeight=(1.0+extraVinculum+emPad)/sizeMultiplier;texHeight=(1.00+extraVinculum)/sizeMultiplier;span=sqrtSvg("sqrtMain",spanHeight,viewBoxHeight,extraVinculum,options);span.style.minWidth="0.853em";advanceWidth=0.833/sizeMultiplier;// from the font.
}else if(delim.type==="large"){// These SVGs come from fonts: KaTeX_Size1, _Size2, etc.
viewBoxHeight=(1000+vbPad)*sizeToMaxHeight[delim.size];texHeight=(sizeToMaxHeight[delim.size]+extraVinculum)/sizeMultiplier;spanHeight=(sizeToMaxHeight[delim.size]+extraVinculum+emPad)/sizeMultiplier;span=sqrtSvg("sqrtSize"+delim.size,spanHeight,viewBoxHeight,extraVinculum,options);span.style.minWidth="1.02em";advanceWidth=1.0/sizeMultiplier;// 1.0 from the font.
}else {// Tall sqrt. In TeX, this would be stacked using multiple glyphs.
// We'll use a single SVG to accomplish the same thing.
spanHeight=height+extraVinculum+emPad;texHeight=height+extraVinculum;viewBoxHeight=Math.floor(1000*height+extraVinculum)+vbPad;span=sqrtSvg("sqrtTall",spanHeight,viewBoxHeight,extraVinculum,options);span.style.minWidth="0.742em";advanceWidth=1.056;}span.height=texHeight;span.style.height=makeEm(spanHeight);return {span,advanceWidth,// Calculate the actual line width.
// This actually should depend on the chosen font -- e.g. \boldmath
// should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
// have thicker rules.
ruleWidth:(options.fontMetrics().sqrtRuleThickness+extraVinculum)*sizeMultiplier};};// There are three kinds of delimiters, delimiters that stack when they become
// too large
const stackLargeDelimiters=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230a","\u230b","\\lceil","\\rceil","\u2308","\u2309","\\surd"];// delimiters that always stack
const stackAlwaysDelimiters=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27ee","\u27ef","\\lmoustache","\\rmoustache","\u23b0","\u23b1"];// and delimiters that never stack
const stackNeverDelimiters=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"];// Metrics of the different sizes. Found by looking at TeX's output of
// $\bigl| // \Bigl| \biggl| \Biggl| \showlists$
// Used to create stacked delimiters of appropriate sizes in makeSizedDelim.
const sizeToMaxHeight=[0,1.2,1.8,2.4,3.0];/**
 * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4.
 */const makeSizedDelim=function(delim,size,options,mode,classes){// < and > turn into \langle and \rangle in delimiters
if(delim==="<"||delim==="\\lt"||delim==="\u27e8"){delim="\\langle";}else if(delim===">"||delim==="\\gt"||delim==="\u27e9"){delim="\\rangle";}// Sized delimiters are never centered.
if(utils.contains(stackLargeDelimiters,delim)||utils.contains(stackNeverDelimiters,delim)){return makeLargeDelim(delim,size,false,options,mode,classes);}else if(utils.contains(stackAlwaysDelimiters,delim)){return makeStackedDelim(delim,sizeToMaxHeight[size],false,options,mode,classes);}else {throw new src_ParseError("Illegal delimiter: '"+delim+"'");}};/**
 * There are three different sequences of delimiter sizes that the delimiters
 * follow depending on the kind of delimiter. This is used when creating custom
 * sized delimiters to decide whether to create a small, large, or stacked
 * delimiter.
 *
 * In real TeX, these sequences aren't explicitly defined, but are instead
 * defined inside the font metrics. Since there are only three sequences that
 * are possible for the delimiters that TeX defines, it is easier to just encode
 * them explicitly here.
 */// Delimiters that never stack try small delimiters and large delimiters only
const stackNeverDelimiterSequence=[{type:"small",style:src_Style.SCRIPTSCRIPT},{type:"small",style:src_Style.SCRIPT},{type:"small",style:src_Style.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}];// Delimiters that always stack try the small delimiters first, then stack
const stackAlwaysDelimiterSequence=[{type:"small",style:src_Style.SCRIPTSCRIPT},{type:"small",style:src_Style.SCRIPT},{type:"small",style:src_Style.TEXT},{type:"stack"}];// Delimiters that stack when large try the small and then large delimiters, and
// stack afterwards
const stackLargeDelimiterSequence=[{type:"small",style:src_Style.SCRIPTSCRIPT},{type:"small",style:src_Style.SCRIPT},{type:"small",style:src_Style.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];/**
 * Get the font used in a delimiter based on what kind of delimiter it is.
 * TODO(#963) Use more specific font family return type once that is introduced.
 */const delimTypeToFont=function(type){if(type.type==="small"){return "Main-Regular";}else if(type.type==="large"){return "Size"+type.size+"-Regular";}else if(type.type==="stack"){return "Size4-Regular";}else {throw new Error("Add support for delim type '"+type.type+"' here.");}};/**
 * Traverse a sequence of types of delimiters to decide what kind of delimiter
 * should be used to create a delimiter of the given height+depth.
 */const traverseSequence=function(delim,height,sequence,options){// Here, we choose the index we should start at in the sequences. In smaller
// sizes (which correspond to larger numbers in style.size) we start earlier
// in the sequence. Thus, scriptscript starts at index 3-3=0, script starts
// at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2
const start=Math.min(2,3-options.style.size);for(let i=start;i<sequence.length;i++){if(sequence[i].type==="stack"){// This is always the last delimiter, so we just break the loop now.
break;}const metrics=getMetrics(delim,delimTypeToFont(sequence[i]),"math");let heightDepth=metrics.height+metrics.depth;// Small delimiters are scaled down versions of the same font, so we
// account for the style change size.
if(sequence[i].type==="small"){const newOptions=options.havingBaseStyle(sequence[i].style);heightDepth*=newOptions.sizeMultiplier;}// Check if the delimiter at this size works for the given height.
if(heightDepth>height){return sequence[i];}}// If we reached the end of the sequence, return the last sequence element.
return sequence[sequence.length-1];};/**
 * Make a delimiter of a given height+depth, with optional centering. Here, we
 * traverse the sequences, and create a delimiter that the sequence tells us to.
 */const makeCustomSizedDelim=function(delim,height,center,options,mode,classes){if(delim==="<"||delim==="\\lt"||delim==="\u27e8"){delim="\\langle";}else if(delim===">"||delim==="\\gt"||delim==="\u27e9"){delim="\\rangle";}// Decide what sequence to use
let sequence;if(utils.contains(stackNeverDelimiters,delim)){sequence=stackNeverDelimiterSequence;}else if(utils.contains(stackLargeDelimiters,delim)){sequence=stackLargeDelimiterSequence;}else {sequence=stackAlwaysDelimiterSequence;}// Look through the sequence
const delimType=traverseSequence(delim,height,sequence,options);// Get the delimiter from font glyphs.
// Depending on the sequence element we decided on, call the
// appropriate function.
if(delimType.type==="small"){return makeSmallDelim(delim,delimType.style,center,options,mode,classes);}else if(delimType.type==="large"){return makeLargeDelim(delim,delimType.size,center,options,mode,classes);}else/* if (delimType.type === "stack") */{return makeStackedDelim(delim,height,center,options,mode,classes);}};/**
 * Make a delimiter for use with `\left` and `\right`, given a height and depth
 * of an expression that the delimiters surround.
 */const makeLeftRightDelim=function(delim,height,depth,options,mode,classes){// We always center \left/\right delimiters, so the axis is always shifted
const axisHeight=options.fontMetrics().axisHeight*options.sizeMultiplier;// Taken from TeX source, tex.web, function make_left_right
const delimiterFactor=901;const delimiterExtend=5.0/options.fontMetrics().ptPerEm;const maxDistFromAxis=Math.max(height-axisHeight,depth+axisHeight);const totalHeight=Math.max(// In real TeX, calculations are done using integral values which are
// 65536 per pt, or 655360 per em. So, the division here truncates in
// TeX but doesn't here, producing different results. If we wanted to
// exactly match TeX's calculation, we could do
//   Math.floor(655360 * maxDistFromAxis / 500) *
//    delimiterFactor / 655360
// (To see the difference, compare
//    x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
// in TeX and KaTeX)
maxDistFromAxis/500*delimiterFactor,2*maxDistFromAxis-delimiterExtend);// Finally, we defer to `makeCustomSizedDelim` with our calculated total
// height
return makeCustomSizedDelim(delim,totalHeight,true,options,mode,classes);};/* harmony default export */var delimiter={sqrtImage:makeSqrtImage,sizedDelim:makeSizedDelim,sizeToMaxHeight:sizeToMaxHeight,customSizedDelim:makeCustomSizedDelim,leftRightDelim:makeLeftRightDelim};// Extra data needed for the delimiter handler down below
const delimiterSizes={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}};const delimiters=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230a","\u230b","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27e8","\\rangle","\u27e9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27ee","\u27ef","\\lmoustache","\\rmoustache","\u23b0","\u23b1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];// Delimiter functions
function checkDelimiter(delim,context){const symDelim=checkSymbolNodeType(delim);if(symDelim&&utils.contains(delimiters,symDelim.text)){return symDelim;}else if(symDelim){throw new src_ParseError("Invalid delimiter '"+symDelim.text+"' after '"+context.funcName+"'",delim);}else {throw new src_ParseError("Invalid delimiter type '"+delim.type+"'",delim);}}defineFunction({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(context,args)=>{const delim=checkDelimiter(args[0],context);return {type:"delimsizing",mode:context.parser.mode,size:delimiterSizes[context.funcName].size,mclass:delimiterSizes[context.funcName].mclass,delim:delim.text};},htmlBuilder:(group,options)=>{if(group.delim==="."){// Empty delimiters still count as elements, even though they don't
// show anything.
return buildCommon.makeSpan([group.mclass]);}// Use delimiter.sizedDelim to generate the delimiter.
return delimiter.sizedDelim(group.delim,group.size,options,group.mode,[group.mclass]);},mathmlBuilder:group=>{const children=[];if(group.delim!=="."){children.push(makeText(group.delim,group.mode));}const node=new mathMLTree.MathNode("mo",children);if(group.mclass==="mopen"||group.mclass==="mclose"){// Only some of the delimsizing functions act as fences, and they
// return "mopen" or "mclose" mclass.
node.setAttribute("fence","true");}else {// Explicitly disable fencing if it's not a fence, to override the
// defaults.
node.setAttribute("fence","false");}node.setAttribute("stretchy","true");const size=makeEm(delimiter.sizeToMaxHeight[group.size]);node.setAttribute("minsize",size);node.setAttribute("maxsize",size);return node;}});function assertParsed(group){if(!group.body){throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");}}defineFunction({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:true},handler:(context,args)=>{// \left case below triggers parsing of \right in
//   `const right = parser.parseFunction();`
// uses this return value.
const color=context.parser.gullet.macros.get("\\current@color");if(color&&typeof color!=="string"){throw new src_ParseError("\\current@color set to non-string in \\right");}return {type:"leftright-right",mode:context.parser.mode,delim:checkDelimiter(args[0],context).text,color// undefined if not set via \color
};}});defineFunction({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:true},handler:(context,args)=>{const delim=checkDelimiter(args[0],context);const parser=context.parser;// Parse out the implicit body
++parser.leftrightDepth;// parseExpression stops before '\\right'
const body=parser.parseExpression(false);--parser.leftrightDepth;// Check the next token
parser.expect("\\right",false);const right=assertNodeType(parser.parseFunction(),"leftright-right");return {type:"leftright",mode:parser.mode,body,left:delim.text,right:right.delim,rightColor:right.color};},htmlBuilder:(group,options)=>{assertParsed(group);// Build the inner expression
const inner=buildExpression(group.body,options,true,["mopen","mclose"]);let innerHeight=0;let innerDepth=0;let hadMiddle=false;// Calculate its height and depth
for(let i=0;i<inner.length;i++){// Property `isMiddle` not defined on `span`. See comment in
// "middle"'s htmlBuilder.
// $FlowFixMe
if(inner[i].isMiddle){hadMiddle=true;}else {innerHeight=Math.max(inner[i].height,innerHeight);innerDepth=Math.max(inner[i].depth,innerDepth);}}// The size of delimiters is the same, regardless of what style we are
// in. Thus, to correctly calculate the size of delimiter we need around
// a group, we scale down the inner size based on the size.
innerHeight*=options.sizeMultiplier;innerDepth*=options.sizeMultiplier;let leftDelim;if(group.left==="."){// Empty delimiters in \left and \right make null delimiter spaces.
leftDelim=makeNullDelimiter(options,["mopen"]);}else {// Otherwise, use leftRightDelim to generate the correct sized
// delimiter.
leftDelim=delimiter.leftRightDelim(group.left,innerHeight,innerDepth,options,group.mode,["mopen"]);}// Add it to the beginning of the expression
inner.unshift(leftDelim);// Handle middle delimiters
if(hadMiddle){for(let i=1;i<inner.length;i++){const middleDelim=inner[i];// Property `isMiddle` not defined on `span`. See comment in
// "middle"'s htmlBuilder.
// $FlowFixMe
const isMiddle=middleDelim.isMiddle;if(isMiddle){// Apply the options that were active when \middle was called
inner[i]=delimiter.leftRightDelim(isMiddle.delim,innerHeight,innerDepth,isMiddle.options,group.mode,[]);}}}let rightDelim;// Same for the right delimiter, but using color specified by \color
if(group.right==="."){rightDelim=makeNullDelimiter(options,["mclose"]);}else {const colorOptions=group.rightColor?options.withColor(group.rightColor):options;rightDelim=delimiter.leftRightDelim(group.right,innerHeight,innerDepth,colorOptions,group.mode,["mclose"]);}// Add it to the end of the expression.
inner.push(rightDelim);return buildCommon.makeSpan(["minner"],inner,options);},mathmlBuilder:(group,options)=>{assertParsed(group);const inner=buildMathML_buildExpression(group.body,options);if(group.left!=="."){const leftNode=new mathMLTree.MathNode("mo",[makeText(group.left,group.mode)]);leftNode.setAttribute("fence","true");inner.unshift(leftNode);}if(group.right!=="."){const rightNode=new mathMLTree.MathNode("mo",[makeText(group.right,group.mode)]);rightNode.setAttribute("fence","true");if(group.rightColor){rightNode.setAttribute("mathcolor",group.rightColor);}inner.push(rightNode);}return makeRow(inner);}});defineFunction({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:true},handler:(context,args)=>{const delim=checkDelimiter(args[0],context);if(!context.parser.leftrightDepth){throw new src_ParseError("\\middle without preceding \\left",delim);}return {type:"middle",mode:context.parser.mode,delim:delim.text};},htmlBuilder:(group,options)=>{let middleDelim;if(group.delim==="."){middleDelim=makeNullDelimiter(options,[]);}else {middleDelim=delimiter.sizedDelim(group.delim,1,options,group.mode,[]);const isMiddle={delim:group.delim,options};// Property `isMiddle` not defined on `span`. It is only used in
// this file above.
// TODO: Fix this violation of the `span` type and possibly rename
// things since `isMiddle` sounds like a boolean, but is a struct.
// $FlowFixMe
middleDelim.isMiddle=isMiddle;}return middleDelim;},mathmlBuilder:(group,options)=>{// A Firefox \middle will stretch a character vertically only if it
// is in the fence part of the operator dictionary at:
// https://www.w3.org/TR/MathML3/appendixc.html.
// So we need to avoid U+2223 and use plain "|" instead.
const textNode=group.delim==="\\vert"||group.delim==="|"?makeText("|","text"):makeText(group.delim,group.mode);const middleNode=new mathMLTree.MathNode("mo",[textNode]);middleNode.setAttribute("fence","true");// MathML gives 5/18em spacing to each <mo> element.
// \middle should get delimiter spacing instead.
middleNode.setAttribute("lspace","0.05em");middleNode.setAttribute("rspace","0.05em");return middleNode;}});const enclose_htmlBuilder=(group,options)=>{// \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox, \phase
// Some groups can return document fragments.  Handle those by wrapping
// them in a span.
const inner=buildCommon.wrapFragment(buildGroup(group.body,options),options);const label=group.label.slice(1);let scale=options.sizeMultiplier;let img;let imgShift=0;// In the LaTeX cancel package, line geometry is slightly different
// depending on whether the subject is wider than it is tall, or vice versa.
// We don't know the width of a group, so as a proxy, we test if
// the subject is a single character. This captures most of the
// subjects that should get the "tall" treatment.
const isSingleChar=utils.isCharacterBox(group.body);if(label==="sout"){img=buildCommon.makeSpan(["stretchy","sout"]);img.height=options.fontMetrics().defaultRuleThickness/scale;imgShift=-0.5*options.fontMetrics().xHeight;}else if(label==="phase"){// Set a couple of dimensions from the steinmetz package.
const lineWeight=calculateSize({number:0.6,unit:"pt"},options);const clearance=calculateSize({number:0.35,unit:"ex"},options);// Prevent size changes like \Huge from affecting line thickness
const newOptions=options.havingBaseSizing();scale=scale/newOptions.sizeMultiplier;const angleHeight=inner.height+inner.depth+lineWeight+clearance;// Reserve a left pad for the angle.
inner.style.paddingLeft=makeEm(angleHeight/2+lineWeight);// Create an SVG
const viewBoxHeight=Math.floor(1000*angleHeight*scale);const path=phasePath(viewBoxHeight);const svgNode=new SvgNode([new PathNode("phase",path)],{"width":"400em","height":makeEm(viewBoxHeight/1000),"viewBox":"0 0 400000 "+viewBoxHeight,"preserveAspectRatio":"xMinYMin slice"});// Wrap it in a span with overflow: hidden.
img=buildCommon.makeSvgSpan(["hide-tail"],[svgNode],options);img.style.height=makeEm(angleHeight);imgShift=inner.depth+lineWeight+clearance;}else {// Add horizontal padding
if(/cancel/.test(label)){if(!isSingleChar){inner.classes.push("cancel-pad");}}else if(label==="angl"){inner.classes.push("anglpad");}else {inner.classes.push("boxpad");}// Add vertical padding
let topPad=0;let bottomPad=0;let ruleThickness=0;// ref: cancel package: \advance\totalheight2\p@ % "+2"
if(/box/.test(label)){ruleThickness=Math.max(options.fontMetrics().fboxrule,// default
options.minRuleThickness// User override.
);topPad=options.fontMetrics().fboxsep+(label==="colorbox"?0:ruleThickness);bottomPad=topPad;}else if(label==="angl"){ruleThickness=Math.max(options.fontMetrics().defaultRuleThickness,options.minRuleThickness);topPad=4*ruleThickness;// gap = 3 × line, plus the line itself.
bottomPad=Math.max(0,0.25-inner.depth);}else {topPad=isSingleChar?0.2:0;bottomPad=topPad;}img=stretchy.encloseSpan(inner,label,topPad,bottomPad,options);if(/fbox|boxed|fcolorbox/.test(label)){img.style.borderStyle="solid";img.style.borderWidth=makeEm(ruleThickness);}else if(label==="angl"&&ruleThickness!==0.049){img.style.borderTopWidth=makeEm(ruleThickness);img.style.borderRightWidth=makeEm(ruleThickness);}imgShift=inner.depth+bottomPad;if(group.backgroundColor){img.style.backgroundColor=group.backgroundColor;if(group.borderColor){img.style.borderColor=group.borderColor;}}}let vlist;if(group.backgroundColor){vlist=buildCommon.makeVList({positionType:"individualShift",children:[// Put the color background behind inner;
{type:"elem",elem:img,shift:imgShift},{type:"elem",elem:inner,shift:0}]},options);}else {const classes=/cancel|phase/.test(label)?["svg-align"]:[];vlist=buildCommon.makeVList({positionType:"individualShift",children:[// Write the \cancel stroke on top of inner.
{type:"elem",elem:inner,shift:0},{type:"elem",elem:img,shift:imgShift,wrapperClasses:classes}]},options);}if(/cancel/.test(label)){// The cancel package documentation says that cancel lines add their height
// to the expression, but tests show that isn't how it actually works.
vlist.height=inner.height;vlist.depth=inner.depth;}if(/cancel/.test(label)&&!isSingleChar){// cancel does not create horiz space for its line extension.
return buildCommon.makeSpan(["mord","cancel-lap"],[vlist],options);}else {return buildCommon.makeSpan(["mord"],[vlist],options);}};const enclose_mathmlBuilder=(group,options)=>{let fboxsep=0;const node=new mathMLTree.MathNode(group.label.indexOf("colorbox")>-1?"mpadded":"menclose",[buildMathML_buildGroup(group.body,options)]);switch(group.label){case"\\cancel":node.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":node.setAttribute("notation","downdiagonalstrike");break;case"\\phase":node.setAttribute("notation","phasorangle");break;case"\\sout":node.setAttribute("notation","horizontalstrike");break;case"\\fbox":node.setAttribute("notation","box");break;case"\\angl":node.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":// <menclose> doesn't have a good notation option. So use <mpadded>
// instead. Set some attributes that come included with <menclose>.
fboxsep=options.fontMetrics().fboxsep*options.fontMetrics().ptPerEm;node.setAttribute("width","+"+2*fboxsep+"pt");node.setAttribute("height","+"+2*fboxsep+"pt");node.setAttribute("lspace",fboxsep+"pt");//
node.setAttribute("voffset",fboxsep+"pt");if(group.label==="\\fcolorbox"){const thk=Math.max(options.fontMetrics().fboxrule,// default
options.minRuleThickness// user override
);node.setAttribute("style","border: "+thk+"em solid "+String(group.borderColor));}break;case"\\xcancel":node.setAttribute("notation","updiagonalstrike downdiagonalstrike");break;}if(group.backgroundColor){node.setAttribute("mathbackground",group.backgroundColor);}return node;};defineFunction({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:true,argTypes:["color","text"]},handler(_ref,args,optArgs){let{parser,funcName}=_ref;const color=assertNodeType(args[0],"color-token").color;const body=args[1];return {type:"enclose",mode:parser.mode,label:funcName,backgroundColor:color,body};},htmlBuilder:enclose_htmlBuilder,mathmlBuilder:enclose_mathmlBuilder});defineFunction({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:true,argTypes:["color","color","text"]},handler(_ref2,args,optArgs){let{parser,funcName}=_ref2;const borderColor=assertNodeType(args[0],"color-token").color;const backgroundColor=assertNodeType(args[1],"color-token").color;const body=args[2];return {type:"enclose",mode:parser.mode,label:funcName,backgroundColor,borderColor,body};},htmlBuilder:enclose_htmlBuilder,mathmlBuilder:enclose_mathmlBuilder});defineFunction({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:true},handler(_ref3,args){let{parser}=_ref3;return {type:"enclose",mode:parser.mode,label:"\\fbox",body:args[0]};}});defineFunction({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(_ref4,args){let{parser,funcName}=_ref4;const body=args[0];return {type:"enclose",mode:parser.mode,label:funcName,body};},htmlBuilder:enclose_htmlBuilder,mathmlBuilder:enclose_mathmlBuilder});defineFunction({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:false},handler(_ref5,args){let{parser}=_ref5;return {type:"enclose",mode:parser.mode,label:"\\angl",body:args[0]};}});/**
 * All registered environments.
 * `environments.js` exports this same dictionary again and makes it public.
 * `Parser.js` requires this dictionary via `environments.js`.
 */const _environments={};function defineEnvironment(_ref){let{type,names,props,handler,htmlBuilder,mathmlBuilder}=_ref;// Set default values of environments.
const data={type,numArgs:props.numArgs||0,allowedInText:false,numOptionalArgs:0,handler};for(let i=0;i<names.length;++i){// TODO: The value type of _environments should be a type union of all
// possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is
// an existential type.
_environments[names[i]]=data;}if(htmlBuilder){_htmlGroupBuilders[type]=htmlBuilder;}if(mathmlBuilder){_mathmlGroupBuilders[type]=mathmlBuilder;}}/**
 * All registered global/built-in macros.
 * `macros.js` exports this same dictionary again and makes it public.
 * `Parser.js` requires this dictionary via `macros.js`.
 */const _macros={};// This function might one day accept an additional argument and do more things.
function defineMacro(name,body){_macros[name]=body;}/**
 * Lexing or parsing positional information for error reporting.
 * This object is immutable.
 */class SourceLocation{// The + prefix indicates that these fields aren't writeable
// Lexer holding the input string.
// Start offset, zero-based inclusive.
// End offset, zero-based exclusive.
constructor(lexer,start,end){this.lexer=void 0;this.start=void 0;this.end=void 0;this.lexer=lexer;this.start=start;this.end=end;}/**
   * Merges two `SourceLocation`s from location providers, given they are
   * provided in order of appearance.
   * - Returns the first one's location if only the first is provided.
   * - Returns a merged range of the first and the last if both are provided
   *   and their lexers match.
   * - Otherwise, returns null.
   */static range(first,second){if(!second){return first&&first.loc;}else if(!first||!first.loc||!second.loc||first.loc.lexer!==second.loc.lexer){return null;}else {return new SourceLocation(first.loc.lexer,first.loc.start,second.loc.end);}}}/**
 * Interface required to break circular dependency between Token, Lexer, and
 * ParseError.
 *//**
 * The resulting token returned from `lex`.
 *
 * It consists of the token text plus some position information.
 * The position information is essentially a range in an input string,
 * but instead of referencing the bare input string, we refer to the lexer.
 * That way it is possible to attach extra metadata to the input string,
 * like for example a file name or similar.
 *
 * The position information is optional, so it is OK to construct synthetic
 * tokens if appropriate. Not providing available position information may
 * lead to degraded error reporting, though.
 */class Token{// don't expand the token
// used in \noexpand
constructor(text,// the text of this token
loc){this.text=void 0;this.loc=void 0;this.noexpand=void 0;this.treatAsRelax=void 0;this.text=text;this.loc=loc;}/**
   * Given a pair of tokens (this and endToken), compute a `Token` encompassing
   * the whole input range enclosed by these two.
   */range(endToken,// last token of the range, inclusive
text// the text of the newly constructed token
){return new Token(text,SourceLocation.range(this,endToken));}}// Helper functions
function getHLines(parser){// Return an array. The array length = number of hlines.
// Each element in the array tells if the line is dashed.
const hlineInfo=[];parser.consumeSpaces();let nxt=parser.fetch().text;if(nxt==="\\relax"){// \relax is an artifact of the \cr macro below
parser.consume();parser.consumeSpaces();nxt=parser.fetch().text;}while(nxt==="\\hline"||nxt==="\\hdashline"){parser.consume();hlineInfo.push(nxt==="\\hdashline");parser.consumeSpaces();nxt=parser.fetch().text;}return hlineInfo;}const validateAmsEnvironmentContext=context=>{const settings=context.parser.settings;if(!settings.displayMode){throw new src_ParseError("{"+context.envName+"} can be used only in"+" display mode.");}};// autoTag (an argument to parseArray) can be one of three values:
// * undefined: Regular (not-top-level) array; no tags on each row
// * true: Automatic equation numbering, overridable by \tag
// * false: Tags allowed on each row, but no automatic numbering
// This function *doesn't* work with the "split" environment name.
function getAutoTag(name){if(name.indexOf("ed")===-1){return name.indexOf("*")===-1;}// return undefined;
}/**
 * Parse the body of the environment, with rows delimited by \\ and
 * columns delimited by &, and create a nested list in row-major order
 * with one group per cell.  If given an optional argument style
 * ("text", "display", etc.), then each cell is cast into that style.
 */function parseArray(parser,_ref,style){let{hskipBeforeAndAfter,addJot,cols,arraystretch,colSeparationType,autoTag,singleRow,emptySingleRow,maxNumCols,leqno}=_ref;parser.gullet.beginGroup();if(!singleRow){// \cr is equivalent to \\ without the optional size argument (see below)
// TODO: provide helpful error when \cr is used outside array environment
parser.gullet.macros.set("\\cr","\\\\\\relax");}// Get current arraystretch if it's not set by the environment
if(!arraystretch){const stretch=parser.gullet.expandMacroAsText("\\arraystretch");if(stretch==null){// Default \arraystretch from lttab.dtx
arraystretch=1;}else {arraystretch=parseFloat(stretch);if(!arraystretch||arraystretch<0){throw new src_ParseError("Invalid \\arraystretch: "+stretch);}}}// Start group for first cell
parser.gullet.beginGroup();let row=[];const body=[row];const rowGaps=[];const hLinesBeforeRow=[];const tags=autoTag!=null?[]:undefined;// amsmath uses \global\@eqnswtrue and \global\@eqnswfalse to represent
// whether this row should have an equation number.  Simulate this with
// a \@eqnsw macro set to 1 or 0.
function beginRow(){if(autoTag){parser.gullet.macros.set("\\@eqnsw","1",true);}}function endRow(){if(tags){if(parser.gullet.macros.get("\\df@tag")){tags.push(parser.subparse([new Token("\\df@tag")]));parser.gullet.macros.set("\\df@tag",undefined,true);}else {tags.push(Boolean(autoTag)&&parser.gullet.macros.get("\\@eqnsw")==="1");}}}beginRow();// Test for \hline at the top of the array.
hLinesBeforeRow.push(getHLines(parser));while(true){// eslint-disable-line no-constant-condition
// Parse each cell in its own group (namespace)
let cell=parser.parseExpression(false,singleRow?"\\end":"\\\\");parser.gullet.endGroup();parser.gullet.beginGroup();cell={type:"ordgroup",mode:parser.mode,body:cell};if(style){cell={type:"styling",mode:parser.mode,style,body:[cell]};}row.push(cell);const next=parser.fetch().text;if(next==="&"){if(maxNumCols&&row.length===maxNumCols){if(singleRow||colSeparationType){// {equation} or {split}
throw new src_ParseError("Too many tab characters: &",parser.nextToken);}else {// {array} environment
parser.settings.reportNonstrict("textEnv","Too few columns "+"specified in the {array} column argument.");}}parser.consume();}else if(next==="\\end"){endRow();// Arrays terminate newlines with `\crcr` which consumes a `\cr` if
// the last line is empty.  However, AMS environments keep the
// empty row if it's the only one.
// NOTE: Currently, `cell` is the last item added into `row`.
if(row.length===1&&cell.type==="styling"&&cell.body[0].body.length===0&&(body.length>1||!emptySingleRow)){body.pop();}if(hLinesBeforeRow.length<body.length+1){hLinesBeforeRow.push([]);}break;}else if(next==="\\\\"){parser.consume();let size;// \def\Let@{\let\\\math@cr}
// \def\math@cr{...\math@cr@}
// \def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}}
// \def\math@cr@@[#1]{...\math@cr@@@...}
// \def\math@cr@@@{\cr}
if(parser.gullet.future().text!==" "){size=parser.parseSizeGroup(true);}rowGaps.push(size?size.value:null);endRow();// check for \hline(s) following the row separator
hLinesBeforeRow.push(getHLines(parser));row=[];body.push(row);beginRow();}else {throw new src_ParseError("Expected & or \\\\ or \\cr or \\end",parser.nextToken);}}// End cell group
parser.gullet.endGroup();// End array group defining \cr
parser.gullet.endGroup();return {type:"array",mode:parser.mode,addJot,arraystretch,body,cols,rowGaps,hskipBeforeAndAfter,hLinesBeforeRow,colSeparationType,tags,leqno};}// Decides on a style for cells in an array according to whether the given
// environment name starts with the letter 'd'.
function dCellStyle(envName){if(envName.slice(0,1)==="d"){return "display";}else {return "text";}}const array_htmlBuilder=function(group,options){let r;let c;const nr=group.body.length;const hLinesBeforeRow=group.hLinesBeforeRow;let nc=0;let body=new Array(nr);const hlines=[];const ruleThickness=Math.max(// From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
options.fontMetrics().arrayRuleWidth,options.minRuleThickness// User override.
);// Horizontal spacing
const pt=1/options.fontMetrics().ptPerEm;let arraycolsep=5*pt;// default value, i.e. \arraycolsep in article.cls
if(group.colSeparationType&&group.colSeparationType==="small"){// We're in a {smallmatrix}. Default column space is \thickspace,
// i.e. 5/18em = 0.2778em, per amsmath.dtx for {smallmatrix}.
// But that needs adjustment because LaTeX applies \scriptstyle to the
// entire array, including the colspace, but this function applies
// \scriptstyle only inside each element.
const localMultiplier=options.havingStyle(src_Style.SCRIPT).sizeMultiplier;arraycolsep=0.2778*(localMultiplier/options.sizeMultiplier);}// Vertical spacing
const baselineskip=group.colSeparationType==="CD"?calculateSize({number:3,unit:"ex"},options):12*pt;// see size10.clo
// Default \jot from ltmath.dtx
// TODO(edemaine): allow overriding \jot via \setlength (#687)
const jot=3*pt;const arrayskip=group.arraystretch*baselineskip;const arstrutHeight=0.7*arrayskip;// \strutbox in ltfsstrc.dtx and
const arstrutDepth=0.3*arrayskip;// \@arstrutbox in lttab.dtx
let totalHeight=0;// Set a position for \hline(s) at the top of the array, if any.
function setHLinePos(hlinesInGap){for(let i=0;i<hlinesInGap.length;++i){if(i>0){totalHeight+=0.25;}hlines.push({pos:totalHeight,isDashed:hlinesInGap[i]});}}setHLinePos(hLinesBeforeRow[0]);for(r=0;r<group.body.length;++r){const inrow=group.body[r];let height=arstrutHeight;// \@array adds an \@arstrut
let depth=arstrutDepth;// to each tow (via the template)
if(nc<inrow.length){nc=inrow.length;}const outrow=new Array(inrow.length);for(c=0;c<inrow.length;++c){const elt=buildGroup(inrow[c],options);if(depth<elt.depth){depth=elt.depth;}if(height<elt.height){height=elt.height;}outrow[c]=elt;}const rowGap=group.rowGaps[r];let gap=0;if(rowGap){gap=calculateSize(rowGap,options);if(gap>0){// \@argarraycr
gap+=arstrutDepth;if(depth<gap){depth=gap;// \@xargarraycr
}gap=0;}}// In AMS multiline environments such as aligned and gathered, rows
// correspond to lines that have additional \jot added to the
// \baselineskip via \openup.
if(group.addJot){depth+=jot;}outrow.height=height;outrow.depth=depth;totalHeight+=height;outrow.pos=totalHeight;totalHeight+=depth+gap;// \@yargarraycr
body[r]=outrow;// Set a position for \hline(s), if any.
setHLinePos(hLinesBeforeRow[r+1]);}const offset=totalHeight/2+options.fontMetrics().axisHeight;const colDescriptions=group.cols||[];const cols=[];let colSep;let colDescrNum;const tagSpans=[];if(group.tags&&group.tags.some(tag=>tag)){// An environment with manual tags and/or automatic equation numbers.
// Create node(s), the latter of which trigger CSS counter increment.
for(r=0;r<nr;++r){const rw=body[r];const shift=rw.pos-offset;const tag=group.tags[r];let tagSpan;if(tag===true){// automatic numbering
tagSpan=buildCommon.makeSpan(["eqn-num"],[],options);}else if(tag===false){// \nonumber/\notag or starred environment
tagSpan=buildCommon.makeSpan([],[],options);}else {// manual \tag
tagSpan=buildCommon.makeSpan([],buildExpression(tag,options,true),options);}tagSpan.depth=rw.depth;tagSpan.height=rw.height;tagSpans.push({type:"elem",elem:tagSpan,shift});}}for(c=0,colDescrNum=0;// Continue while either there are more columns or more column
// descriptions, so trailing separators don't get lost.
c<nc||colDescrNum<colDescriptions.length;++c,++colDescrNum){let colDescr=colDescriptions[colDescrNum]||{};let firstSeparator=true;while(colDescr.type==="separator"){// If there is more than one separator in a row, add a space
// between them.
if(!firstSeparator){colSep=buildCommon.makeSpan(["arraycolsep"],[]);colSep.style.width=makeEm(options.fontMetrics().doubleRuleSep);cols.push(colSep);}if(colDescr.separator==="|"||colDescr.separator===":"){const lineType=colDescr.separator==="|"?"solid":"dashed";const separator=buildCommon.makeSpan(["vertical-separator"],[],options);separator.style.height=makeEm(totalHeight);separator.style.borderRightWidth=makeEm(ruleThickness);separator.style.borderRightStyle=lineType;separator.style.margin="0 "+makeEm(-ruleThickness/2);const shift=totalHeight-offset;if(shift){separator.style.verticalAlign=makeEm(-shift);}cols.push(separator);}else {throw new src_ParseError("Invalid separator type: "+colDescr.separator);}colDescrNum++;colDescr=colDescriptions[colDescrNum]||{};firstSeparator=false;}if(c>=nc){continue;}let sepwidth;if(c>0||group.hskipBeforeAndAfter){sepwidth=utils.deflt(colDescr.pregap,arraycolsep);if(sepwidth!==0){colSep=buildCommon.makeSpan(["arraycolsep"],[]);colSep.style.width=makeEm(sepwidth);cols.push(colSep);}}let col=[];for(r=0;r<nr;++r){const row=body[r];const elem=row[c];if(!elem){continue;}const shift=row.pos-offset;elem.depth=row.depth;elem.height=row.height;col.push({type:"elem",elem:elem,shift:shift});}col=buildCommon.makeVList({positionType:"individualShift",children:col},options);col=buildCommon.makeSpan(["col-align-"+(colDescr.align||"c")],[col]);cols.push(col);if(c<nc-1||group.hskipBeforeAndAfter){sepwidth=utils.deflt(colDescr.postgap,arraycolsep);if(sepwidth!==0){colSep=buildCommon.makeSpan(["arraycolsep"],[]);colSep.style.width=makeEm(sepwidth);cols.push(colSep);}}}body=buildCommon.makeSpan(["mtable"],cols);// Add \hline(s), if any.
if(hlines.length>0){const line=buildCommon.makeLineSpan("hline",options,ruleThickness);const dashes=buildCommon.makeLineSpan("hdashline",options,ruleThickness);const vListElems=[{type:"elem",elem:body,shift:0}];while(hlines.length>0){const hline=hlines.pop();const lineShift=hline.pos-offset;if(hline.isDashed){vListElems.push({type:"elem",elem:dashes,shift:lineShift});}else {vListElems.push({type:"elem",elem:line,shift:lineShift});}}body=buildCommon.makeVList({positionType:"individualShift",children:vListElems},options);}if(tagSpans.length===0){return buildCommon.makeSpan(["mord"],[body],options);}else {let eqnNumCol=buildCommon.makeVList({positionType:"individualShift",children:tagSpans},options);eqnNumCol=buildCommon.makeSpan(["tag"],[eqnNumCol],options);return buildCommon.makeFragment([body,eqnNumCol]);}};const alignMap={c:"center ",l:"left ",r:"right "};const array_mathmlBuilder=function(group,options){const tbl=[];const glue=new mathMLTree.MathNode("mtd",[],["mtr-glue"]);const tag=new mathMLTree.MathNode("mtd",[],["mml-eqn-num"]);for(let i=0;i<group.body.length;i++){const rw=group.body[i];const row=[];for(let j=0;j<rw.length;j++){row.push(new mathMLTree.MathNode("mtd",[buildMathML_buildGroup(rw[j],options)]));}if(group.tags&&group.tags[i]){row.unshift(glue);row.push(glue);if(group.leqno){row.unshift(tag);}else {row.push(tag);}}tbl.push(new mathMLTree.MathNode("mtr",row));}let table=new mathMLTree.MathNode("mtable",tbl);// Set column alignment, row spacing, column spacing, and
// array lines by setting attributes on the table element.
// Set the row spacing. In MathML, we specify a gap distance.
// We do not use rowGap[] because MathML automatically increases
// cell height with the height/depth of the element content.
// LaTeX \arraystretch multiplies the row baseline-to-baseline distance.
// We simulate this by adding (arraystretch - 1)em to the gap. This
// does a reasonable job of adjusting arrays containing 1 em tall content.
// The 0.16 and 0.09 values are found empirically. They produce an array
// similar to LaTeX and in which content does not interfere with \hlines.
const gap=group.arraystretch===0.5?0.1// {smallmatrix}, {subarray}
:0.16+group.arraystretch-1+(group.addJot?0.09:0);table.setAttribute("rowspacing",makeEm(gap));// MathML table lines go only between cells.
// To place a line on an edge we'll use <menclose>, if necessary.
let menclose="";let align="";if(group.cols&&group.cols.length>0){// Find column alignment, column spacing, and  vertical lines.
const cols=group.cols;let columnLines="";let prevTypeWasAlign=false;let iStart=0;let iEnd=cols.length;if(cols[0].type==="separator"){menclose+="top ";iStart=1;}if(cols[cols.length-1].type==="separator"){menclose+="bottom ";iEnd-=1;}for(let i=iStart;i<iEnd;i++){if(cols[i].type==="align"){align+=alignMap[cols[i].align];if(prevTypeWasAlign){columnLines+="none ";}prevTypeWasAlign=true;}else if(cols[i].type==="separator"){// MathML accepts only single lines between cells.
// So we read only the first of consecutive separators.
if(prevTypeWasAlign){columnLines+=cols[i].separator==="|"?"solid ":"dashed ";prevTypeWasAlign=false;}}}table.setAttribute("columnalign",align.trim());if(/[sd]/.test(columnLines)){table.setAttribute("columnlines",columnLines.trim());}}// Set column spacing.
if(group.colSeparationType==="align"){const cols=group.cols||[];let spacing="";for(let i=1;i<cols.length;i++){spacing+=i%2?"0em ":"1em ";}table.setAttribute("columnspacing",spacing.trim());}else if(group.colSeparationType==="alignat"||group.colSeparationType==="gather"){table.setAttribute("columnspacing","0em");}else if(group.colSeparationType==="small"){table.setAttribute("columnspacing","0.2778em");}else if(group.colSeparationType==="CD"){table.setAttribute("columnspacing","0.5em");}else {table.setAttribute("columnspacing","1em");}// Address \hline and \hdashline
let rowLines="";const hlines=group.hLinesBeforeRow;menclose+=hlines[0].length>0?"left ":"";menclose+=hlines[hlines.length-1].length>0?"right ":"";for(let i=1;i<hlines.length-1;i++){rowLines+=hlines[i].length===0?"none "// MathML accepts only a single line between rows. Read one element.
:hlines[i][0]?"dashed ":"solid ";}if(/[sd]/.test(rowLines)){table.setAttribute("rowlines",rowLines.trim());}if(menclose!==""){table=new mathMLTree.MathNode("menclose",[table]);table.setAttribute("notation",menclose.trim());}if(group.arraystretch&&group.arraystretch<1){// A small array. Wrap in scriptstyle so row gap is not too large.
table=new mathMLTree.MathNode("mstyle",[table]);table.setAttribute("scriptlevel","1");}return table;};// Convenience function for align, align*, aligned, alignat, alignat*, alignedat.
const alignedHandler=function(context,args){if(context.envName.indexOf("ed")===-1){validateAmsEnvironmentContext(context);}const cols=[];const separationType=context.envName.indexOf("at")>-1?"alignat":"align";const isSplit=context.envName==="split";const res=parseArray(context.parser,{cols,addJot:true,autoTag:isSplit?undefined:getAutoTag(context.envName),emptySingleRow:true,colSeparationType:separationType,maxNumCols:isSplit?2:undefined,leqno:context.parser.settings.leqno},"display");// Determining number of columns.
// 1. If the first argument is given, we use it as a number of columns,
//    and makes sure that each row doesn't exceed that number.
// 2. Otherwise, just count number of columns = maximum number
//    of cells in each row ("aligned" mode -- isAligned will be true).
//
// At the same time, prepend empty group {} at beginning of every second
// cell in each row (starting with second cell) so that operators become
// binary.  This behavior is implemented in amsmath's \start@aligned.
let numMaths;let numCols=0;const emptyGroup={type:"ordgroup",mode:context.mode,body:[]};if(args[0]&&args[0].type==="ordgroup"){let arg0="";for(let i=0;i<args[0].body.length;i++){const textord=assertNodeType(args[0].body[i],"textord");arg0+=textord.text;}numMaths=Number(arg0);numCols=numMaths*2;}const isAligned=!numCols;res.body.forEach(function(row){for(let i=1;i<row.length;i+=2){// Modify ordgroup node within styling node
const styling=assertNodeType(row[i],"styling");const ordgroup=assertNodeType(styling.body[0],"ordgroup");ordgroup.body.unshift(emptyGroup);}if(!isAligned){// Case 1
const curMaths=row.length/2;if(numMaths<curMaths){throw new src_ParseError("Too many math in a row: "+("expected "+numMaths+", but got "+curMaths),row[0]);}}else if(numCols<row.length){// Case 2
numCols=row.length;}});// Adjusting alignment.
// In aligned mode, we add one \qquad between columns;
// otherwise we add nothing.
for(let i=0;i<numCols;++i){let align="r";let pregap=0;if(i%2===1){align="l";}else if(i>0&&isAligned){// "aligned" mode.
pregap=1;// add one \quad
}cols[i]={type:"align",align:align,pregap:pregap,postgap:0};}res.colSeparationType=isAligned?"align":"alignat";return res;};// Arrays are part of LaTeX, defined in lttab.dtx so its documentation
// is part of the source2e.pdf file of LaTeX2e source documentation.
// {darray} is an {array} environment where cells are set in \displaystyle,
// as defined in nccmath.sty.
defineEnvironment({type:"array",names:["array","darray"],props:{numArgs:1},handler(context,args){// Since no types are specified above, the two possibilities are
// - The argument is wrapped in {} or [], in which case Parser's
//   parseGroup() returns an "ordgroup" wrapping some symbol node.
// - The argument is a bare symbol node.
const symNode=checkSymbolNodeType(args[0]);const colalign=symNode?[args[0]]:assertNodeType(args[0],"ordgroup").body;const cols=colalign.map(function(nde){const node=assertSymbolNodeType(nde);const ca=node.text;if("lcr".indexOf(ca)!==-1){return {type:"align",align:ca};}else if(ca==="|"){return {type:"separator",separator:"|"};}else if(ca===":"){return {type:"separator",separator:":"};}throw new src_ParseError("Unknown column alignment: "+ca,nde);});const res={cols,hskipBeforeAndAfter:true,// \@preamble in lttab.dtx
maxNumCols:cols.length};return parseArray(context.parser,res,dCellStyle(context.envName));},htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});// The matrix environments of amsmath builds on the array environment
// of LaTeX, which is discussed above.
// The mathtools package adds starred versions of the same environments.
// These have an optional argument to choose left|center|right justification.
defineEnvironment({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(context){const delimiters={"matrix":null,"pmatrix":["(",")"],"bmatrix":["[","]"],"Bmatrix":["\\{","\\}"],"vmatrix":["|","|"],"Vmatrix":["\\Vert","\\Vert"]}[context.envName.replace("*","")];// \hskip -\arraycolsep in amsmath
let colAlign="c";const payload={hskipBeforeAndAfter:false,cols:[{type:"align",align:colAlign}]};if(context.envName.charAt(context.envName.length-1)==="*"){// It's one of the mathtools starred functions.
// Parse the optional alignment argument.
const parser=context.parser;parser.consumeSpaces();if(parser.fetch().text==="["){parser.consume();parser.consumeSpaces();colAlign=parser.fetch().text;if("lcr".indexOf(colAlign)===-1){throw new src_ParseError("Expected l or c or r",parser.nextToken);}parser.consume();parser.consumeSpaces();parser.expect("]");parser.consume();payload.cols=[{type:"align",align:colAlign}];}}const res=parseArray(context.parser,payload,dCellStyle(context.envName));// Populate cols with the correct number of column alignment specs.
const numCols=Math.max(0,...res.body.map(row=>row.length));res.cols=new Array(numCols).fill({type:"align",align:colAlign});return delimiters?{type:"leftright",mode:context.mode,body:[res],left:delimiters[0],right:delimiters[1],rightColor:undefined// \right uninfluenced by \color in array
}:res;},htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});defineEnvironment({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(context){const payload={arraystretch:0.5};const res=parseArray(context.parser,payload,"script");res.colSeparationType="small";return res;},htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});defineEnvironment({type:"array",names:["subarray"],props:{numArgs:1},handler(context,args){// Parsing of {subarray} is similar to {array}
const symNode=checkSymbolNodeType(args[0]);const colalign=symNode?[args[0]]:assertNodeType(args[0],"ordgroup").body;const cols=colalign.map(function(nde){const node=assertSymbolNodeType(nde);const ca=node.text;// {subarray} only recognizes "l" & "c"
if("lc".indexOf(ca)!==-1){return {type:"align",align:ca};}throw new src_ParseError("Unknown column alignment: "+ca,nde);});if(cols.length>1){throw new src_ParseError("{subarray} can contain only one column");}let res={cols,hskipBeforeAndAfter:false,arraystretch:0.5};res=parseArray(context.parser,res,"script");if(res.body.length>0&&res.body[0].length>1){throw new src_ParseError("{subarray} can contain only one column");}return res;},htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});// A cases environment (in amsmath.sty) is almost equivalent to
// \def\arraystretch{1.2}%
// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right.
// {dcases} is a {cases} environment where cells are set in \displaystyle,
// as defined in mathtools.sty.
// {rcases} is another mathtools environment. It's brace is on the right side.
defineEnvironment({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(context){const payload={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,// TODO(kevinb) get the current style.
// For now we use the metrics for TEXT style which is what we were
// doing before.  Before attempting to get the current style we
// should look at TeX's behavior especially for \over and matrices.
postgap:1.0/* 1em quad */},{type:"align",align:"l",pregap:0,postgap:0}]};const res=parseArray(context.parser,payload,dCellStyle(context.envName));return {type:"leftright",mode:context.mode,body:[res],left:context.envName.indexOf("r")>-1?".":"\\{",right:context.envName.indexOf("r")>-1?"\\}":".",rightColor:undefined};},htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});// In the align environment, one uses ampersands, &, to specify number of
// columns in each row, and to locate spacing between each column.
// align gets automatic numbering. align* and aligned do not.
// The alignedat environment can be used in math mode.
// Note that we assume \nomallineskiplimit to be zero,
// so that \strut@ is the same as \strut.
defineEnvironment({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:alignedHandler,htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});// A gathered environment is like an array environment with one centered
// column, but where rows are considered lines so get \jot line spacing
// and contents are set in \displaystyle.
defineEnvironment({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(context){if(utils.contains(["gather","gather*"],context.envName)){validateAmsEnvironmentContext(context);}const res={cols:[{type:"align",align:"c"}],addJot:true,colSeparationType:"gather",autoTag:getAutoTag(context.envName),emptySingleRow:true,leqno:context.parser.settings.leqno};return parseArray(context.parser,res,"display");},htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});// alignat environment is like an align environment, but one must explicitly
// specify maximum number of columns in each row, and can adjust spacing between
// each columns.
defineEnvironment({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:alignedHandler,htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});defineEnvironment({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(context){validateAmsEnvironmentContext(context);const res={autoTag:getAutoTag(context.envName),emptySingleRow:true,singleRow:true,maxNumCols:1,leqno:context.parser.settings.leqno};return parseArray(context.parser,res,"display");},htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});defineEnvironment({type:"array",names:["CD"],props:{numArgs:0},handler(context){validateAmsEnvironmentContext(context);return parseCD(context.parser);},htmlBuilder:array_htmlBuilder,mathmlBuilder:array_mathmlBuilder});defineMacro("\\nonumber","\\gdef\\@eqnsw{0}");defineMacro("\\notag","\\nonumber");// Catch \hline outside array environment
defineFunction({type:"text",// Doesn't matter what this is.
names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:true,allowedInMath:true},handler(context,args){throw new src_ParseError(context.funcName+" valid only within array environment");}});const environments=_environments;/* harmony default export */var src_environments=environments;// All environment definitions should be imported below
// Environment delimiters. HTML/MathML rendering is defined in the corresponding
// defineEnvironment definitions.
defineFunction({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(_ref,args){let{parser,funcName}=_ref;const nameGroup=args[0];if(nameGroup.type!=="ordgroup"){throw new src_ParseError("Invalid environment name",nameGroup);}let envName="";for(let i=0;i<nameGroup.body.length;++i){envName+=assertNodeType(nameGroup.body[i],"textord").text;}if(funcName==="\\begin"){// begin...end is similar to left...right
if(!src_environments.hasOwnProperty(envName)){throw new src_ParseError("No such environment: "+envName,nameGroup);}// Build the environment object. Arguments and other information will
// be made available to the begin and end methods using properties.
const env=src_environments[envName];const{args,optArgs}=parser.parseArguments("\\begin{"+envName+"}",env);const context={mode:parser.mode,envName,parser};const result=env.handler(context,args,optArgs);parser.expect("\\end",false);const endNameToken=parser.nextToken;const end=assertNodeType(parser.parseFunction(),"environment");if(end.name!==envName){throw new src_ParseError("Mismatch: \\begin{"+envName+"} matched by \\end{"+end.name+"}",endNameToken);}// $FlowFixMe, "environment" handler returns an environment ParseNode
return result;}return {type:"environment",mode:parser.mode,name:envName,nameGroup};}});// TODO(kevinb): implement \\sl and \\sc
const font_htmlBuilder=(group,options)=>{const font=group.font;const newOptions=options.withFont(font);return buildGroup(group.body,newOptions);};const font_mathmlBuilder=(group,options)=>{const font=group.font;const newOptions=options.withFont(font);return buildMathML_buildGroup(group.body,newOptions);};const fontAliases={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};defineFunction({type:"font",names:[// styles, except \boldsymbol defined below
"\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit",// families
"\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt",// aliases, except \bm defined below
"\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:true},handler:(_ref,args)=>{let{parser,funcName}=_ref;const body=normalizeArgument(args[0]);let func=funcName;if(func in fontAliases){func=fontAliases[func];}return {type:"font",mode:parser.mode,font:func.slice(1),body};},htmlBuilder:font_htmlBuilder,mathmlBuilder:font_mathmlBuilder});defineFunction({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(_ref2,args)=>{let{parser}=_ref2;const body=args[0];const isCharacterBox=utils.isCharacterBox(body);// amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
// argument's bin|rel|ord status
return {type:"mclass",mode:parser.mode,mclass:binrelClass(body),body:[{type:"font",mode:parser.mode,font:"boldsymbol",body}],isCharacterBox:isCharacterBox};}});// Old font changing functions
defineFunction({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:true},handler:(_ref3,args)=>{let{parser,funcName,breakOnTokenText}=_ref3;const{mode}=parser;const body=parser.parseExpression(true,breakOnTokenText);const style="math"+funcName.slice(1);return {type:"font",mode:mode,font:style,body:{type:"ordgroup",mode:parser.mode,body}};},htmlBuilder:font_htmlBuilder,mathmlBuilder:font_mathmlBuilder});const adjustStyle=(size,originalStyle)=>{// Figure out what style this fraction should be in based on the
// function used
let style=originalStyle;if(size==="display"){// Get display style as a default.
// If incoming style is sub/sup, use style.text() to get correct size.
style=style.id>=src_Style.SCRIPT.id?style.text():src_Style.DISPLAY;}else if(size==="text"&&style.size===src_Style.DISPLAY.size){// We're in a \tfrac but incoming style is displaystyle, so:
style=src_Style.TEXT;}else if(size==="script"){style=src_Style.SCRIPT;}else if(size==="scriptscript"){style=src_Style.SCRIPTSCRIPT;}return style;};const genfrac_htmlBuilder=(group,options)=>{// Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
const style=adjustStyle(group.size,options.style);const nstyle=style.fracNum();const dstyle=style.fracDen();let newOptions;newOptions=options.havingStyle(nstyle);const numerm=buildGroup(group.numer,newOptions,options);if(group.continued){// \cfrac inserts a \strut into the numerator.
// Get \strut dimensions from TeXbook page 353.
const hStrut=8.5/options.fontMetrics().ptPerEm;const dStrut=3.5/options.fontMetrics().ptPerEm;numerm.height=numerm.height<hStrut?hStrut:numerm.height;numerm.depth=numerm.depth<dStrut?dStrut:numerm.depth;}newOptions=options.havingStyle(dstyle);const denomm=buildGroup(group.denom,newOptions,options);let rule;let ruleWidth;let ruleSpacing;if(group.hasBarLine){if(group.barSize){ruleWidth=calculateSize(group.barSize,options);rule=buildCommon.makeLineSpan("frac-line",options,ruleWidth);}else {rule=buildCommon.makeLineSpan("frac-line",options);}ruleWidth=rule.height;ruleSpacing=rule.height;}else {rule=null;ruleWidth=0;ruleSpacing=options.fontMetrics().defaultRuleThickness;}// Rule 15b
let numShift;let clearance;let denomShift;if(style.size===src_Style.DISPLAY.size||group.size==="display"){numShift=options.fontMetrics().num1;if(ruleWidth>0){clearance=3*ruleSpacing;}else {clearance=7*ruleSpacing;}denomShift=options.fontMetrics().denom1;}else {if(ruleWidth>0){numShift=options.fontMetrics().num2;clearance=ruleSpacing;}else {numShift=options.fontMetrics().num3;clearance=3*ruleSpacing;}denomShift=options.fontMetrics().denom2;}let frac;if(!rule){// Rule 15c
const candidateClearance=numShift-numerm.depth-(denomm.height-denomShift);if(candidateClearance<clearance){numShift+=0.5*(clearance-candidateClearance);denomShift+=0.5*(clearance-candidateClearance);}frac=buildCommon.makeVList({positionType:"individualShift",children:[{type:"elem",elem:denomm,shift:denomShift},{type:"elem",elem:numerm,shift:-numShift}]},options);}else {// Rule 15d
const axisHeight=options.fontMetrics().axisHeight;if(numShift-numerm.depth-(axisHeight+0.5*ruleWidth)<clearance){numShift+=clearance-(numShift-numerm.depth-(axisHeight+0.5*ruleWidth));}if(axisHeight-0.5*ruleWidth-(denomm.height-denomShift)<clearance){denomShift+=clearance-(axisHeight-0.5*ruleWidth-(denomm.height-denomShift));}const midShift=-(axisHeight-0.5*ruleWidth);frac=buildCommon.makeVList({positionType:"individualShift",children:[{type:"elem",elem:denomm,shift:denomShift},{type:"elem",elem:rule,shift:midShift},{type:"elem",elem:numerm,shift:-numShift}]},options);}// Since we manually change the style sometimes (with \dfrac or \tfrac),
// account for the possible size change here.
newOptions=options.havingStyle(style);frac.height*=newOptions.sizeMultiplier/options.sizeMultiplier;frac.depth*=newOptions.sizeMultiplier/options.sizeMultiplier;// Rule 15e
let delimSize;if(style.size===src_Style.DISPLAY.size){delimSize=options.fontMetrics().delim1;}else if(style.size===src_Style.SCRIPTSCRIPT.size){delimSize=options.havingStyle(src_Style.SCRIPT).fontMetrics().delim2;}else {delimSize=options.fontMetrics().delim2;}let leftDelim;let rightDelim;if(group.leftDelim==null){leftDelim=makeNullDelimiter(options,["mopen"]);}else {leftDelim=delimiter.customSizedDelim(group.leftDelim,delimSize,true,options.havingStyle(style),group.mode,["mopen"]);}if(group.continued){rightDelim=buildCommon.makeSpan([]);// zero width for \cfrac
}else if(group.rightDelim==null){rightDelim=makeNullDelimiter(options,["mclose"]);}else {rightDelim=delimiter.customSizedDelim(group.rightDelim,delimSize,true,options.havingStyle(style),group.mode,["mclose"]);}return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)),[leftDelim,buildCommon.makeSpan(["mfrac"],[frac]),rightDelim],options);};const genfrac_mathmlBuilder=(group,options)=>{let node=new mathMLTree.MathNode("mfrac",[buildMathML_buildGroup(group.numer,options),buildMathML_buildGroup(group.denom,options)]);if(!group.hasBarLine){node.setAttribute("linethickness","0px");}else if(group.barSize){const ruleWidth=calculateSize(group.barSize,options);node.setAttribute("linethickness",makeEm(ruleWidth));}const style=adjustStyle(group.size,options.style);if(style.size!==options.style.size){node=new mathMLTree.MathNode("mstyle",[node]);const isDisplay=style.size===src_Style.DISPLAY.size?"true":"false";node.setAttribute("displaystyle",isDisplay);node.setAttribute("scriptlevel","0");}if(group.leftDelim!=null||group.rightDelim!=null){const withDelims=[];if(group.leftDelim!=null){const leftOp=new mathMLTree.MathNode("mo",[new mathMLTree.TextNode(group.leftDelim.replace("\\",""))]);leftOp.setAttribute("fence","true");withDelims.push(leftOp);}withDelims.push(node);if(group.rightDelim!=null){const rightOp=new mathMLTree.MathNode("mo",[new mathMLTree.TextNode(group.rightDelim.replace("\\",""))]);rightOp.setAttribute("fence","true");withDelims.push(rightOp);}return makeRow(withDelims);}return node;};defineFunction({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac",// can’t be entered directly
"\\\\bracefrac","\\\\brackfrac"// ditto
],props:{numArgs:2,allowedInArgument:true},handler:(_ref,args)=>{let{parser,funcName}=_ref;const numer=args[0];const denom=args[1];let hasBarLine;let leftDelim=null;let rightDelim=null;let size="auto";switch(funcName){case"\\dfrac":case"\\frac":case"\\tfrac":hasBarLine=true;break;case"\\\\atopfrac":hasBarLine=false;break;case"\\dbinom":case"\\binom":case"\\tbinom":hasBarLine=false;leftDelim="(";rightDelim=")";break;case"\\\\bracefrac":hasBarLine=false;leftDelim="\\{";rightDelim="\\}";break;case"\\\\brackfrac":hasBarLine=false;leftDelim="[";rightDelim="]";break;default:throw new Error("Unrecognized genfrac command");}switch(funcName){case"\\dfrac":case"\\dbinom":size="display";break;case"\\tfrac":case"\\tbinom":size="text";break;}return {type:"genfrac",mode:parser.mode,continued:false,numer,denom,hasBarLine,leftDelim,rightDelim,size,barSize:null};},htmlBuilder:genfrac_htmlBuilder,mathmlBuilder:genfrac_mathmlBuilder});defineFunction({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(_ref2,args)=>{let{parser,funcName}=_ref2;const numer=args[0];const denom=args[1];return {type:"genfrac",mode:parser.mode,continued:true,numer,denom,hasBarLine:true,leftDelim:null,rightDelim:null,size:"display",barSize:null};}});// Infix generalized fractions -- these are not rendered directly, but replaced
// immediately by one of the variants above.
defineFunction({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:true},handler(_ref3){let{parser,funcName,token}=_ref3;let replaceWith;switch(funcName){case"\\over":replaceWith="\\frac";break;case"\\choose":replaceWith="\\binom";break;case"\\atop":replaceWith="\\\\atopfrac";break;case"\\brace":replaceWith="\\\\bracefrac";break;case"\\brack":replaceWith="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command");}return {type:"infix",mode:parser.mode,replaceWith,token};}});const stylArray=["display","text","script","scriptscript"];const delimFromValue=function(delimString){let delim=null;if(delimString.length>0){delim=delimString;delim=delim==="."?null:delim;}return delim;};defineFunction({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:true,argTypes:["math","math","size","text","math","math"]},handler(_ref4,args){let{parser}=_ref4;const numer=args[4];const denom=args[5];// Look into the parse nodes to get the desired delimiters.
const leftNode=normalizeArgument(args[0]);const leftDelim=leftNode.type==="atom"&&leftNode.family==="open"?delimFromValue(leftNode.text):null;const rightNode=normalizeArgument(args[1]);const rightDelim=rightNode.type==="atom"&&rightNode.family==="close"?delimFromValue(rightNode.text):null;const barNode=assertNodeType(args[2],"size");let hasBarLine;let barSize=null;if(barNode.isBlank){// \genfrac acts differently than \above.
// \genfrac treats an empty size group as a signal to use a
// standard bar size. \above would see size = 0 and omit the bar.
hasBarLine=true;}else {barSize=barNode.value;hasBarLine=barSize.number>0;}// Find out if we want displaystyle, textstyle, etc.
let size="auto";let styl=args[3];if(styl.type==="ordgroup"){if(styl.body.length>0){const textOrd=assertNodeType(styl.body[0],"textord");size=stylArray[Number(textOrd.text)];}}else {styl=assertNodeType(styl,"textord");size=stylArray[Number(styl.text)];}return {type:"genfrac",mode:parser.mode,numer,denom,continued:false,hasBarLine,barSize,leftDelim,rightDelim,size};},htmlBuilder:genfrac_htmlBuilder,mathmlBuilder:genfrac_mathmlBuilder});// \above is an infix fraction that also defines a fraction bar size.
defineFunction({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:true},handler(_ref5,args){let{parser,funcName,token}=_ref5;return {type:"infix",mode:parser.mode,replaceWith:"\\\\abovefrac",size:assertNodeType(args[0],"size").value,token};}});defineFunction({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(_ref6,args)=>{let{parser,funcName}=_ref6;const numer=args[0];const barSize=assert(assertNodeType(args[1],"infix").size);const denom=args[2];const hasBarLine=barSize.number>0;return {type:"genfrac",mode:parser.mode,numer,denom,continued:false,hasBarLine,barSize,leftDelim:null,rightDelim:null,size:"auto"};},htmlBuilder:genfrac_htmlBuilder,mathmlBuilder:genfrac_mathmlBuilder});// NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but
// also "supsub" since an over/underbrace can affect super/subscripting.
const horizBrace_htmlBuilder=(grp,options)=>{const style=options.style;// Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node.
let supSubGroup;let group;if(grp.type==="supsub"){// Ref: LaTeX source2e: }}}}\limits}
// i.e. LaTeX treats the brace similar to an op and passes it
// with \limits, so we need to assign supsub style.
supSubGroup=grp.sup?buildGroup(grp.sup,options.havingStyle(style.sup()),options):buildGroup(grp.sub,options.havingStyle(style.sub()),options);group=assertNodeType(grp.base,"horizBrace");}else {group=assertNodeType(grp,"horizBrace");}// Build the base group
const body=buildGroup(group.base,options.havingBaseStyle(src_Style.DISPLAY));// Create the stretchy element
const braceBody=stretchy.svgSpan(group,options);// Generate the vlist, with the appropriate kerns        ┏━━━━━━━━┓
// This first vlist contains the content and the brace:   equation
let vlist;if(group.isOver){vlist=buildCommon.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:body},{type:"kern",size:0.1},{type:"elem",elem:braceBody}]},options);// $FlowFixMe: Replace this with passing "svg-align" into makeVList.
vlist.children[0].children[0].children[1].classes.push("svg-align");}else {vlist=buildCommon.makeVList({positionType:"bottom",positionData:body.depth+0.1+braceBody.height,children:[{type:"elem",elem:braceBody},{type:"kern",size:0.1},{type:"elem",elem:body}]},options);// $FlowFixMe: Replace this with passing "svg-align" into makeVList.
vlist.children[0].children[0].children[0].classes.push("svg-align");}if(supSubGroup){// To write the supsub, wrap the first vlist in another vlist:
// They can't all go in the same vlist, because the note might be
// wider than the equation. We want the equation to control the
// brace width.
//      note          long note           long note
//   ┏━━━━━━━━┓   or    ┏━━━┓     not    ┏━━━━━━━━━┓
//    equation           eqn                 eqn
const vSpan=buildCommon.makeSpan(["mord",group.isOver?"mover":"munder"],[vlist],options);if(group.isOver){vlist=buildCommon.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:vSpan},{type:"kern",size:0.2},{type:"elem",elem:supSubGroup}]},options);}else {vlist=buildCommon.makeVList({positionType:"bottom",positionData:vSpan.depth+0.2+supSubGroup.height+supSubGroup.depth,children:[{type:"elem",elem:supSubGroup},{type:"kern",size:0.2},{type:"elem",elem:vSpan}]},options);}}return buildCommon.makeSpan(["mord",group.isOver?"mover":"munder"],[vlist],options);};const horizBrace_mathmlBuilder=(group,options)=>{const accentNode=stretchy.mathMLnode(group.label);return new mathMLTree.MathNode(group.isOver?"mover":"munder",[buildMathML_buildGroup(group.base,options),accentNode]);};// Horizontal stretchy braces
defineFunction({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(_ref,args){let{parser,funcName}=_ref;return {type:"horizBrace",mode:parser.mode,label:funcName,isOver:/^\\over/.test(funcName),base:args[0]};},htmlBuilder:horizBrace_htmlBuilder,mathmlBuilder:horizBrace_mathmlBuilder});defineFunction({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:true},handler:(_ref,args)=>{let{parser}=_ref;const body=args[1];const href=assertNodeType(args[0],"url").url;if(!parser.settings.isTrusted({command:"\\href",url:href})){return parser.formatUnsupportedCmd("\\href");}return {type:"href",mode:parser.mode,href,body:ordargument(body)};},htmlBuilder:(group,options)=>{const elements=buildExpression(group.body,options,false);return buildCommon.makeAnchor(group.href,[],elements,options);},mathmlBuilder:(group,options)=>{let math=buildExpressionRow(group.body,options);if(!(math instanceof MathNode)){math=new MathNode("mrow",[math]);}math.setAttribute("href",group.href);return math;}});defineFunction({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:true},handler:(_ref2,args)=>{let{parser}=_ref2;const href=assertNodeType(args[0],"url").url;if(!parser.settings.isTrusted({command:"\\url",url:href})){return parser.formatUnsupportedCmd("\\url");}const chars=[];for(let i=0;i<href.length;i++){let c=href[i];if(c==="~"){c="\\textasciitilde";}chars.push({type:"textord",mode:"text",text:c});}const body={type:"text",mode:parser.mode,font:"\\texttt",body:chars};return {type:"href",mode:parser.mode,href,body:ordargument(body)};}});// \hbox is provided for compatibility with LaTeX \vcenter.
// In LaTeX, \vcenter can act only on a box, as in
// \vcenter{\hbox{$\frac{a+b}{\dfrac{c}{d}}$}}
// This function by itself doesn't do anything but prevent a soft line break.
defineFunction({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:true,primitive:true},handler(_ref,args){let{parser}=_ref;return {type:"hbox",mode:parser.mode,body:ordargument(args[0])};},htmlBuilder(group,options){const elements=buildExpression(group.body,options,false);return buildCommon.makeFragment(elements);},mathmlBuilder(group,options){return new mathMLTree.MathNode("mrow",buildMathML_buildExpression(group.body,options));}});defineFunction({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:true},handler:(_ref,args)=>{let{parser,funcName,token}=_ref;const value=assertNodeType(args[0],"raw").string;const body=args[1];if(parser.settings.strict){parser.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");}let trustContext;const attributes={};switch(funcName){case"\\htmlClass":attributes.class=value;trustContext={command:"\\htmlClass",class:value};break;case"\\htmlId":attributes.id=value;trustContext={command:"\\htmlId",id:value};break;case"\\htmlStyle":attributes.style=value;trustContext={command:"\\htmlStyle",style:value};break;case"\\htmlData":{const data=value.split(",");for(let i=0;i<data.length;i++){const keyVal=data[i].split("=");if(keyVal.length!==2){throw new src_ParseError("Error parsing key-value for \\htmlData");}attributes["data-"+keyVal[0].trim()]=keyVal[1].trim();}trustContext={command:"\\htmlData",attributes};break;}default:throw new Error("Unrecognized html command");}if(!parser.settings.isTrusted(trustContext)){return parser.formatUnsupportedCmd(funcName);}return {type:"html",mode:parser.mode,attributes,body:ordargument(body)};},htmlBuilder:(group,options)=>{const elements=buildExpression(group.body,options,false);const classes=["enclosing"];if(group.attributes.class){classes.push(...group.attributes.class.trim().split(/\s+/));}const span=buildCommon.makeSpan(classes,elements,options);for(const attr in group.attributes){if(attr!=="class"&&group.attributes.hasOwnProperty(attr)){span.setAttribute(attr,group.attributes[attr]);}}return span;},mathmlBuilder:(group,options)=>{return buildExpressionRow(group.body,options);}});defineFunction({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:true},handler:(_ref,args)=>{let{parser}=_ref;return {type:"htmlmathml",mode:parser.mode,html:ordargument(args[0]),mathml:ordargument(args[1])};},htmlBuilder:(group,options)=>{const elements=buildExpression(group.html,options,false);return buildCommon.makeFragment(elements);},mathmlBuilder:(group,options)=>{return buildExpressionRow(group.mathml,options);}});const sizeData=function(str){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)){// str is a number with no unit specified.
// default unit is bp, per graphix package.
return {number:+str,unit:"bp"};}else {const match=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str);if(!match){throw new src_ParseError("Invalid size: '"+str+"' in \\includegraphics");}const data={number:+(match[1]+match[2]),// sign + magnitude, cast to number
unit:match[3]};if(!validUnit(data)){throw new src_ParseError("Invalid unit: '"+data.unit+"' in \\includegraphics.");}return data;}};defineFunction({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:false},handler:(_ref,args,optArgs)=>{let{parser}=_ref;let width={number:0,unit:"em"};let height={number:0.9,unit:"em"};// sorta character sized.
let totalheight={number:0,unit:"em"};let alt="";if(optArgs[0]){const attributeStr=assertNodeType(optArgs[0],"raw").string;// Parser.js does not parse key/value pairs. We get a string.
const attributes=attributeStr.split(",");for(let i=0;i<attributes.length;i++){const keyVal=attributes[i].split("=");if(keyVal.length===2){const str=keyVal[1].trim();switch(keyVal[0].trim()){case"alt":alt=str;break;case"width":width=sizeData(str);break;case"height":height=sizeData(str);break;case"totalheight":totalheight=sizeData(str);break;default:throw new src_ParseError("Invalid key: '"+keyVal[0]+"' in \\includegraphics.");}}}}const src=assertNodeType(args[0],"url").url;if(alt===""){// No alt given. Use the file name. Strip away the path.
alt=src;alt=alt.replace(/^.*[\\/]/,'');alt=alt.substring(0,alt.lastIndexOf('.'));}if(!parser.settings.isTrusted({command:"\\includegraphics",url:src})){return parser.formatUnsupportedCmd("\\includegraphics");}return {type:"includegraphics",mode:parser.mode,alt:alt,width:width,height:height,totalheight:totalheight,src:src};},htmlBuilder:(group,options)=>{const height=calculateSize(group.height,options);let depth=0;if(group.totalheight.number>0){depth=calculateSize(group.totalheight,options)-height;}let width=0;if(group.width.number>0){width=calculateSize(group.width,options);}const style={height:makeEm(height+depth)};if(width>0){style.width=makeEm(width);}if(depth>0){style.verticalAlign=makeEm(-depth);}const node=new Img(group.src,group.alt,style);node.height=height;node.depth=depth;return node;},mathmlBuilder:(group,options)=>{const node=new mathMLTree.MathNode("mglyph",[]);node.setAttribute("alt",group.alt);const height=calculateSize(group.height,options);let depth=0;if(group.totalheight.number>0){depth=calculateSize(group.totalheight,options)-height;node.setAttribute("valign",makeEm(-depth));}node.setAttribute("height",makeEm(height+depth));if(group.width.number>0){const width=calculateSize(group.width,options);node.setAttribute("width",makeEm(width));}node.setAttribute("src",group.src);return node;}});// Horizontal spacing commands
// TODO: \hskip and \mskip should support plus and minus in lengths
defineFunction({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:true,allowedInText:true},handler(_ref,args){let{parser,funcName}=_ref;const size=assertNodeType(args[0],"size");if(parser.settings.strict){const mathFunction=funcName[1]==='m';// \mkern, \mskip
const muUnit=size.value.unit==='mu';if(mathFunction){if(!muUnit){parser.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+funcName+" supports only mu units, "+("not "+size.value.unit+" units"));}if(parser.mode!=="math"){parser.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+funcName+" works only in math mode");}}else {// !mathFunction
if(muUnit){parser.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+funcName+" doesn't support mu units");}}}return {type:"kern",mode:parser.mode,dimension:size.value};},htmlBuilder(group,options){return buildCommon.makeGlue(group.dimension,options);},mathmlBuilder(group,options){const dimension=calculateSize(group.dimension,options);return new mathMLTree.SpaceNode(dimension);}});// Horizontal overlap functions
defineFunction({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:true},handler:(_ref,args)=>{let{parser,funcName}=_ref;const body=args[0];return {type:"lap",mode:parser.mode,alignment:funcName.slice(5),body};},htmlBuilder:(group,options)=>{// mathllap, mathrlap, mathclap
let inner;if(group.alignment==="clap"){// ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/
inner=buildCommon.makeSpan([],[buildGroup(group.body,options)]);// wrap, since CSS will center a .clap > .inner > span
inner=buildCommon.makeSpan(["inner"],[inner],options);}else {inner=buildCommon.makeSpan(["inner"],[buildGroup(group.body,options)]);}const fix=buildCommon.makeSpan(["fix"],[]);let node=buildCommon.makeSpan([group.alignment],[inner,fix],options);// At this point, we have correctly set horizontal alignment of the
// two items involved in the lap.
// Next, use a strut to set the height of the HTML bounding box.
// Otherwise, a tall argument may be misplaced.
// This code resolved issue #1153
const strut=buildCommon.makeSpan(["strut"]);strut.style.height=makeEm(node.height+node.depth);if(node.depth){strut.style.verticalAlign=makeEm(-node.depth);}node.children.unshift(strut);// Next, prevent vertical misplacement when next to something tall.
// This code resolves issue #1234
node=buildCommon.makeSpan(["thinbox"],[node],options);return buildCommon.makeSpan(["mord","vbox"],[node],options);},mathmlBuilder:(group,options)=>{// mathllap, mathrlap, mathclap
const node=new mathMLTree.MathNode("mpadded",[buildMathML_buildGroup(group.body,options)]);if(group.alignment!=="rlap"){const offset=group.alignment==="llap"?"-1":"-0.5";node.setAttribute("lspace",offset+"width");}node.setAttribute("width","0px");return node;}});// Switching from text mode back to math mode
defineFunction({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:true,allowedInMath:false},handler(_ref,args){let{funcName,parser}=_ref;const outerMode=parser.mode;parser.switchMode("math");const close=funcName==="\\("?"\\)":"$";const body=parser.parseExpression(false,close);parser.expect(close);parser.switchMode(outerMode);return {type:"styling",mode:parser.mode,style:"text",body};}});// Check for extra closing math delimiters
defineFunction({type:"text",// Doesn't matter what this is.
names:["\\)","\\]"],props:{numArgs:0,allowedInText:true,allowedInMath:false},handler(context,args){throw new src_ParseError("Mismatched "+context.funcName);}});const chooseMathStyle=(group,options)=>{switch(options.style.size){case src_Style.DISPLAY.size:return group.display;case src_Style.TEXT.size:return group.text;case src_Style.SCRIPT.size:return group.script;case src_Style.SCRIPTSCRIPT.size:return group.scriptscript;default:return group.text;}};defineFunction({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:true},handler:(_ref,args)=>{let{parser}=_ref;return {type:"mathchoice",mode:parser.mode,display:ordargument(args[0]),text:ordargument(args[1]),script:ordargument(args[2]),scriptscript:ordargument(args[3])};},htmlBuilder:(group,options)=>{const body=chooseMathStyle(group,options);const elements=buildExpression(body,options,false);return buildCommon.makeFragment(elements);},mathmlBuilder:(group,options)=>{const body=chooseMathStyle(group,options);return buildExpressionRow(body,options);}});// For an operator with limits, assemble the base, sup, and sub into a span.
const assembleSupSub=(base,supGroup,subGroup,options,style,slant,baseShift)=>{base=buildCommon.makeSpan([],[base]);const subIsSingleCharacter=subGroup&&utils.isCharacterBox(subGroup);let sub;let sup;// We manually have to handle the superscripts and subscripts. This,
// aside from the kern calculations, is copied from supsub.
if(supGroup){const elem=buildGroup(supGroup,options.havingStyle(style.sup()),options);sup={elem,kern:Math.max(options.fontMetrics().bigOpSpacing1,options.fontMetrics().bigOpSpacing3-elem.depth)};}if(subGroup){const elem=buildGroup(subGroup,options.havingStyle(style.sub()),options);sub={elem,kern:Math.max(options.fontMetrics().bigOpSpacing2,options.fontMetrics().bigOpSpacing4-elem.height)};}// Build the final group as a vlist of the possible subscript, base,
// and possible superscript.
let finalGroup;if(sup&&sub){const bottom=options.fontMetrics().bigOpSpacing5+sub.elem.height+sub.elem.depth+sub.kern+base.depth+baseShift;finalGroup=buildCommon.makeVList({positionType:"bottom",positionData:bottom,children:[{type:"kern",size:options.fontMetrics().bigOpSpacing5},{type:"elem",elem:sub.elem,marginLeft:makeEm(-slant)},{type:"kern",size:sub.kern},{type:"elem",elem:base},{type:"kern",size:sup.kern},{type:"elem",elem:sup.elem,marginLeft:makeEm(slant)},{type:"kern",size:options.fontMetrics().bigOpSpacing5}]},options);}else if(sub){const top=base.height-baseShift;// Shift the limits by the slant of the symbol. Note
// that we are supposed to shift the limits by 1/2 of the slant,
// but since we are centering the limits adding a full slant of
// margin will shift by 1/2 that.
finalGroup=buildCommon.makeVList({positionType:"top",positionData:top,children:[{type:"kern",size:options.fontMetrics().bigOpSpacing5},{type:"elem",elem:sub.elem,marginLeft:makeEm(-slant)},{type:"kern",size:sub.kern},{type:"elem",elem:base}]},options);}else if(sup){const bottom=base.depth+baseShift;finalGroup=buildCommon.makeVList({positionType:"bottom",positionData:bottom,children:[{type:"elem",elem:base},{type:"kern",size:sup.kern},{type:"elem",elem:sup.elem,marginLeft:makeEm(slant)},{type:"kern",size:options.fontMetrics().bigOpSpacing5}]},options);}else {// This case probably shouldn't occur (this would mean the
// supsub was sending us a group with no superscript or
// subscript) but be safe.
return base;}const parts=[finalGroup];if(sub&&slant!==0&&!subIsSingleCharacter){// A negative margin-left was applied to the lower limit.
// Avoid an overlap by placing a spacer on the left on the group.
const spacer=buildCommon.makeSpan(["mspace"],[],options);spacer.style.marginRight=makeEm(slant);parts.unshift(spacer);}return buildCommon.makeSpan(["mop","op-limits"],parts,options);};// Limits, symbols
// Most operators have a large successor symbol, but these don't.
const noSuccessor=["\\smallint"];// NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
// "supsub" since some of them (like \int) can affect super/subscripting.
const op_htmlBuilder=(grp,options)=>{// Operators are handled in the TeXbook pg. 443-444, rule 13(a).
let supGroup;let subGroup;let hasLimits=false;let group;if(grp.type==="supsub"){// If we have limits, supsub will pass us its group to handle. Pull
// out the superscript and subscript and set the group to the op in
// its base.
supGroup=grp.sup;subGroup=grp.sub;group=assertNodeType(grp.base,"op");hasLimits=true;}else {group=assertNodeType(grp,"op");}const style=options.style;let large=false;if(style.size===src_Style.DISPLAY.size&&group.symbol&&!utils.contains(noSuccessor,group.name)){// Most symbol operators get larger in displaystyle (rule 13)
large=true;}let base;if(group.symbol){// If this is a symbol, create the symbol.
const fontName=large?"Size2-Regular":"Size1-Regular";let stash="";if(group.name==="\\oiint"||group.name==="\\oiiint"){// No font glyphs yet, so use a glyph w/o the oval.
// TODO: When font glyphs are available, delete this code.
stash=group.name.slice(1);group.name=stash==="oiint"?"\\iint":"\\iiint";}base=buildCommon.makeSymbol(group.name,fontName,"math",options,["mop","op-symbol",large?"large-op":"small-op"]);if(stash.length>0){// We're in \oiint or \oiiint. Overlay the oval.
// TODO: When font glyphs are available, delete this code.
const italic=base.italic;const oval=buildCommon.staticSvg(stash+"Size"+(large?"2":"1"),options);base=buildCommon.makeVList({positionType:"individualShift",children:[{type:"elem",elem:base,shift:0},{type:"elem",elem:oval,shift:large?0.08:0}]},options);group.name="\\"+stash;base.classes.unshift("mop");// $FlowFixMe
base.italic=italic;}}else if(group.body){// If this is a list, compose that list.
const inner=buildExpression(group.body,options,true);if(inner.length===1&&inner[0]instanceof SymbolNode){base=inner[0];base.classes[0]="mop";// replace old mclass
}else {base=buildCommon.makeSpan(["mop"],inner,options);}}else {// Otherwise, this is a text operator. Build the text from the
// operator's name.
const output=[];for(let i=1;i<group.name.length;i++){output.push(buildCommon.mathsym(group.name[i],group.mode,options));}base=buildCommon.makeSpan(["mop"],output,options);}// If content of op is a single symbol, shift it vertically.
let baseShift=0;let slant=0;if((base instanceof SymbolNode||group.name==="\\oiint"||group.name==="\\oiiint")&&!group.suppressBaseShift){// We suppress the shift of the base of \overset and \underset. Otherwise,
// shift the symbol so its center lies on the axis (rule 13). It
// appears that our fonts have the centers of the symbols already
// almost on the axis, so these numbers are very small. Note we
// don't actually apply this here, but instead it is used either in
// the vlist creation or separately when there are no limits.
baseShift=(base.height-base.depth)/2-options.fontMetrics().axisHeight;// The slant of the symbol is just its italic correction.
// $FlowFixMe
slant=base.italic;}if(hasLimits){return assembleSupSub(base,supGroup,subGroup,options,style,slant,baseShift);}else {if(baseShift){base.style.position="relative";base.style.top=makeEm(baseShift);}return base;}};const op_mathmlBuilder=(group,options)=>{let node;if(group.symbol){// This is a symbol. Just add the symbol.
node=new MathNode("mo",[makeText(group.name,group.mode)]);if(utils.contains(noSuccessor,group.name)){node.setAttribute("largeop","false");}}else if(group.body){// This is an operator with children. Add them.
node=new MathNode("mo",buildMathML_buildExpression(group.body,options));}else {// This is a text operator. Add all of the characters from the
// operator's name.
node=new MathNode("mi",[new TextNode(group.name.slice(1))]);// Append an <mo>&ApplyFunction;</mo>.
// ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
const operator=new MathNode("mo",[makeText("\u2061","text")]);if(group.parentIsSupSub){node=new MathNode("mrow",[node,operator]);}else {node=newDocumentFragment([node,operator]);}}return node;};const singleCharBigOps={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22c0":"\\bigwedge","\u22c1":"\\bigvee","\u22c2":"\\bigcap","\u22c3":"\\bigcup","\u2a00":"\\bigodot","\u2a01":"\\bigoplus","\u2a02":"\\bigotimes","\u2a04":"\\biguplus","\u2a06":"\\bigsqcup"};defineFunction({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\u220F","\u2210","\u2211","\u22c0","\u22c1","\u22c2","\u22c3","\u2a00","\u2a01","\u2a02","\u2a04","\u2a06"],props:{numArgs:0},handler:(_ref,args)=>{let{parser,funcName}=_ref;let fName=funcName;if(fName.length===1){fName=singleCharBigOps[fName];}return {type:"op",mode:parser.mode,limits:true,parentIsSupSub:false,symbol:true,name:fName};},htmlBuilder:op_htmlBuilder,mathmlBuilder:op_mathmlBuilder});// Note: calling defineFunction with a type that's already been defined only
// works because the same htmlBuilder and mathmlBuilder are being used.
defineFunction({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:true},handler:(_ref2,args)=>{let{parser}=_ref2;const body=args[0];return {type:"op",mode:parser.mode,limits:false,parentIsSupSub:false,symbol:false,body:ordargument(body)};},htmlBuilder:op_htmlBuilder,mathmlBuilder:op_mathmlBuilder});// There are 2 flags for operators; whether they produce limits in
// displaystyle, and whether they are symbols and should grow in
// displaystyle. These four groups cover the four possible choices.
const singleCharIntegrals={"\u222b":"\\int","\u222c":"\\iint","\u222d":"\\iiint","\u222e":"\\oint","\u222f":"\\oiint","\u2230":"\\oiiint"};// No limits, not symbols
defineFunction({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(_ref3){let{parser,funcName}=_ref3;return {type:"op",mode:parser.mode,limits:false,parentIsSupSub:false,symbol:false,name:funcName};},htmlBuilder:op_htmlBuilder,mathmlBuilder:op_mathmlBuilder});// Limits, not symbols
defineFunction({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(_ref4){let{parser,funcName}=_ref4;return {type:"op",mode:parser.mode,limits:true,parentIsSupSub:false,symbol:false,name:funcName};},htmlBuilder:op_htmlBuilder,mathmlBuilder:op_mathmlBuilder});// No limits, symbols
defineFunction({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\u222b","\u222c","\u222d","\u222e","\u222f","\u2230"],props:{numArgs:0},handler(_ref5){let{parser,funcName}=_ref5;let fName=funcName;if(fName.length===1){fName=singleCharIntegrals[fName];}return {type:"op",mode:parser.mode,limits:false,parentIsSupSub:false,symbol:true,name:fName};},htmlBuilder:op_htmlBuilder,mathmlBuilder:op_mathmlBuilder});// NOTE: Unlike most `htmlBuilder`s, this one handles not only
// "operatorname", but also  "supsub" since \operatorname* can
// affect super/subscripting.
const operatorname_htmlBuilder=(grp,options)=>{// Operators are handled in the TeXbook pg. 443-444, rule 13(a).
let supGroup;let subGroup;let hasLimits=false;let group;if(grp.type==="supsub"){// If we have limits, supsub will pass us its group to handle. Pull
// out the superscript and subscript and set the group to the op in
// its base.
supGroup=grp.sup;subGroup=grp.sub;group=assertNodeType(grp.base,"operatorname");hasLimits=true;}else {group=assertNodeType(grp,"operatorname");}let base;if(group.body.length>0){const body=group.body.map(child=>{// $FlowFixMe: Check if the node has a string `text` property.
const childText=child.text;if(typeof childText==="string"){return {type:"textord",mode:child.mode,text:childText};}else {return child;}});// Consolidate function names into symbol characters.
const expression=buildExpression(body,options.withFont("mathrm"),true);for(let i=0;i<expression.length;i++){const child=expression[i];if(child instanceof SymbolNode){// Per amsopn package,
// change minus to hyphen and \ast to asterisk
child.text=child.text.replace(/\u2212/,"-").replace(/\u2217/,"*");}}base=buildCommon.makeSpan(["mop"],expression,options);}else {base=buildCommon.makeSpan(["mop"],[],options);}if(hasLimits){return assembleSupSub(base,supGroup,subGroup,options,options.style,0,0);}else {return base;}};const operatorname_mathmlBuilder=(group,options)=>{// The steps taken here are similar to the html version.
let expression=buildMathML_buildExpression(group.body,options.withFont("mathrm"));// Is expression a string or has it something like a fraction?
let isAllString=true;// default
for(let i=0;i<expression.length;i++){const node=expression[i];if(node instanceof mathMLTree.SpaceNode);else if(node instanceof mathMLTree.MathNode){switch(node.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;// Do nothing yet.
case"mo":{const child=node.children[0];if(node.children.length===1&&child instanceof mathMLTree.TextNode){child.text=child.text.replace(/\u2212/,"-").replace(/\u2217/,"*");}else {isAllString=false;}break;}default:isAllString=false;}}else {isAllString=false;}}if(isAllString){// Write a single TextNode instead of multiple nested tags.
const word=expression.map(node=>node.toText()).join("");expression=[new mathMLTree.TextNode(word)];}const identifier=new mathMLTree.MathNode("mi",expression);identifier.setAttribute("mathvariant","normal");// \u2061 is the same as &ApplyFunction;
// ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp
const operator=new mathMLTree.MathNode("mo",[makeText("\u2061","text")]);if(group.parentIsSupSub){return new mathMLTree.MathNode("mrow",[identifier,operator]);}else {return mathMLTree.newDocumentFragment([identifier,operator]);}};// \operatorname
// amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@
defineFunction({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(_ref,args)=>{let{parser,funcName}=_ref;const body=args[0];return {type:"operatorname",mode:parser.mode,body:ordargument(body),alwaysHandleSupSub:funcName==="\\operatornamewithlimits",limits:false,parentIsSupSub:false};},htmlBuilder:operatorname_htmlBuilder,mathmlBuilder:operatorname_mathmlBuilder});defineMacro("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");defineFunctionBuilders({type:"ordgroup",htmlBuilder(group,options){if(group.semisimple){return buildCommon.makeFragment(buildExpression(group.body,options,false));}return buildCommon.makeSpan(["mord"],buildExpression(group.body,options,true),options);},mathmlBuilder(group,options){return buildExpressionRow(group.body,options,true);}});defineFunction({type:"overline",names:["\\overline"],props:{numArgs:1},handler(_ref,args){let{parser}=_ref;const body=args[0];return {type:"overline",mode:parser.mode,body};},htmlBuilder(group,options){// Overlines are handled in the TeXbook pg 443, Rule 9.
// Build the inner group in the cramped style.
const innerGroup=buildGroup(group.body,options.havingCrampedStyle());// Create the line above the body
const line=buildCommon.makeLineSpan("overline-line",options);// Generate the vlist, with the appropriate kerns
const defaultRuleThickness=options.fontMetrics().defaultRuleThickness;const vlist=buildCommon.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:innerGroup},{type:"kern",size:3*defaultRuleThickness},{type:"elem",elem:line},{type:"kern",size:defaultRuleThickness}]},options);return buildCommon.makeSpan(["mord","overline"],[vlist],options);},mathmlBuilder(group,options){const operator=new mathMLTree.MathNode("mo",[new mathMLTree.TextNode("\u203e")]);operator.setAttribute("stretchy","true");const node=new mathMLTree.MathNode("mover",[buildMathML_buildGroup(group.body,options),operator]);node.setAttribute("accent","true");return node;}});defineFunction({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:true},handler:(_ref,args)=>{let{parser}=_ref;const body=args[0];return {type:"phantom",mode:parser.mode,body:ordargument(body)};},htmlBuilder:(group,options)=>{const elements=buildExpression(group.body,options.withPhantom(),false);// \phantom isn't supposed to affect the elements it contains.
// See "color" for more details.
return buildCommon.makeFragment(elements);},mathmlBuilder:(group,options)=>{const inner=buildMathML_buildExpression(group.body,options);return new mathMLTree.MathNode("mphantom",inner);}});defineFunction({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:true},handler:(_ref2,args)=>{let{parser}=_ref2;const body=args[0];return {type:"hphantom",mode:parser.mode,body};},htmlBuilder:(group,options)=>{let node=buildCommon.makeSpan([],[buildGroup(group.body,options.withPhantom())]);node.height=0;node.depth=0;if(node.children){for(let i=0;i<node.children.length;i++){node.children[i].height=0;node.children[i].depth=0;}}// See smash for comment re: use of makeVList
node=buildCommon.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:node}]},options);// For spacing, TeX treats \smash as a math group (same spacing as ord).
return buildCommon.makeSpan(["mord"],[node],options);},mathmlBuilder:(group,options)=>{const inner=buildMathML_buildExpression(ordargument(group.body),options);const phantom=new mathMLTree.MathNode("mphantom",inner);const node=new mathMLTree.MathNode("mpadded",[phantom]);node.setAttribute("height","0px");node.setAttribute("depth","0px");return node;}});defineFunction({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:true},handler:(_ref3,args)=>{let{parser}=_ref3;const body=args[0];return {type:"vphantom",mode:parser.mode,body};},htmlBuilder:(group,options)=>{const inner=buildCommon.makeSpan(["inner"],[buildGroup(group.body,options.withPhantom())]);const fix=buildCommon.makeSpan(["fix"],[]);return buildCommon.makeSpan(["mord","rlap"],[inner,fix],options);},mathmlBuilder:(group,options)=>{const inner=buildMathML_buildExpression(ordargument(group.body),options);const phantom=new mathMLTree.MathNode("mphantom",inner);const node=new mathMLTree.MathNode("mpadded",[phantom]);node.setAttribute("width","0px");return node;}});// Box manipulation
defineFunction({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:true},handler(_ref,args){let{parser}=_ref;const amount=assertNodeType(args[0],"size").value;const body=args[1];return {type:"raisebox",mode:parser.mode,dy:amount,body};},htmlBuilder(group,options){const body=buildGroup(group.body,options);const dy=calculateSize(group.dy,options);return buildCommon.makeVList({positionType:"shift",positionData:-dy,children:[{type:"elem",elem:body}]},options);},mathmlBuilder(group,options){const node=new mathMLTree.MathNode("mpadded",[buildMathML_buildGroup(group.body,options)]);const dy=group.dy.number+group.dy.unit;node.setAttribute("voffset",dy);return node;}});defineFunction({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:true,allowedInArgument:true},handler(_ref){let{parser}=_ref;return {type:"internal",mode:parser.mode};}});defineFunction({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:true,allowedInMath:true,argTypes:["size","size","size"]},handler(_ref,args,optArgs){let{parser}=_ref;const shift=optArgs[0];const width=assertNodeType(args[0],"size");const height=assertNodeType(args[1],"size");return {type:"rule",mode:parser.mode,shift:shift&&assertNodeType(shift,"size").value,width:width.value,height:height.value};},htmlBuilder(group,options){// Make an empty span for the rule
const rule=buildCommon.makeSpan(["mord","rule"],[],options);// Calculate the shift, width, and height of the rule, and account for units
const width=calculateSize(group.width,options);const height=calculateSize(group.height,options);const shift=group.shift?calculateSize(group.shift,options):0;// Style the rule to the right size
rule.style.borderRightWidth=makeEm(width);rule.style.borderTopWidth=makeEm(height);rule.style.bottom=makeEm(shift);// Record the height and width
rule.width=width;rule.height=height+shift;rule.depth=-shift;// Font size is the number large enough that the browser will
// reserve at least `absHeight` space above the baseline.
// The 1.125 factor was empirically determined
rule.maxFontSize=height*1.125*options.sizeMultiplier;return rule;},mathmlBuilder(group,options){const width=calculateSize(group.width,options);const height=calculateSize(group.height,options);const shift=group.shift?calculateSize(group.shift,options):0;const color=options.color&&options.getColor()||"black";const rule=new mathMLTree.MathNode("mspace");rule.setAttribute("mathbackground",color);rule.setAttribute("width",makeEm(width));rule.setAttribute("height",makeEm(height));const wrapper=new mathMLTree.MathNode("mpadded",[rule]);if(shift>=0){wrapper.setAttribute("height",makeEm(shift));}else {wrapper.setAttribute("height",makeEm(shift));wrapper.setAttribute("depth",makeEm(-shift));}wrapper.setAttribute("voffset",makeEm(shift));return wrapper;}});function sizingGroup(value,options,baseOptions){const inner=buildExpression(value,options,false);const multiplier=options.sizeMultiplier/baseOptions.sizeMultiplier;// Add size-resetting classes to the inner list and set maxFontSize
// manually. Handle nested size changes.
for(let i=0;i<inner.length;i++){const pos=inner[i].classes.indexOf("sizing");if(pos<0){Array.prototype.push.apply(inner[i].classes,options.sizingClasses(baseOptions));}else if(inner[i].classes[pos+1]==="reset-size"+options.size){// This is a nested size change: e.g., inner[i] is the "b" in
// `\Huge a \small b`. Override the old size (the `reset-` class)
// but not the new size.
inner[i].classes[pos+1]="reset-size"+baseOptions.size;}inner[i].height*=multiplier;inner[i].depth*=multiplier;}return buildCommon.makeFragment(inner);}const sizeFuncs=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];const sizing_htmlBuilder=(group,options)=>{// Handle sizing operators like \Huge. Real TeX doesn't actually allow
// these functions inside of math expressions, so we do some special
// handling.
const newOptions=options.havingSize(group.size);return sizingGroup(group.body,newOptions,options);};defineFunction({type:"sizing",names:sizeFuncs,props:{numArgs:0,allowedInText:true},handler:(_ref,args)=>{let{breakOnTokenText,funcName,parser}=_ref;const body=parser.parseExpression(false,breakOnTokenText);return {type:"sizing",mode:parser.mode,// Figure out what size to use based on the list of functions above
size:sizeFuncs.indexOf(funcName)+1,body};},htmlBuilder:sizing_htmlBuilder,mathmlBuilder:(group,options)=>{const newOptions=options.havingSize(group.size);const inner=buildMathML_buildExpression(group.body,newOptions);const node=new mathMLTree.MathNode("mstyle",inner);// TODO(emily): This doesn't produce the correct size for nested size
// changes, because we don't keep state of what style we're currently
// in, so we can't reset the size to normal before changing it.  Now
// that we're passing an options parameter we should be able to fix
// this.
node.setAttribute("mathsize",makeEm(newOptions.sizeMultiplier));return node;}});// smash, with optional [tb], as in AMS
defineFunction({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:true},handler:(_ref,args,optArgs)=>{let{parser}=_ref;let smashHeight=false;let smashDepth=false;const tbArg=optArgs[0]&&assertNodeType(optArgs[0],"ordgroup");if(tbArg){// Optional [tb] argument is engaged.
// ref: amsmath: \renewcommand{\smash}[1][tb]{%
//               def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}%
let letter="";for(let i=0;i<tbArg.body.length;++i){const node=tbArg.body[i];// $FlowFixMe: Not every node type has a `text` property.
letter=node.text;if(letter==="t"){smashHeight=true;}else if(letter==="b"){smashDepth=true;}else {smashHeight=false;smashDepth=false;break;}}}else {smashHeight=true;smashDepth=true;}const body=args[0];return {type:"smash",mode:parser.mode,body,smashHeight,smashDepth};},htmlBuilder:(group,options)=>{const node=buildCommon.makeSpan([],[buildGroup(group.body,options)]);if(!group.smashHeight&&!group.smashDepth){return node;}if(group.smashHeight){node.height=0;// In order to influence makeVList, we have to reset the children.
if(node.children){for(let i=0;i<node.children.length;i++){node.children[i].height=0;}}}if(group.smashDepth){node.depth=0;if(node.children){for(let i=0;i<node.children.length;i++){node.children[i].depth=0;}}}// At this point, we've reset the TeX-like height and depth values.
// But the span still has an HTML line height.
// makeVList applies "display: table-cell", which prevents the browser
// from acting on that line height. So we'll call makeVList now.
const smashedNode=buildCommon.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:node}]},options);// For spacing, TeX treats \hphantom as a math group (same spacing as ord).
return buildCommon.makeSpan(["mord"],[smashedNode],options);},mathmlBuilder:(group,options)=>{const node=new mathMLTree.MathNode("mpadded",[buildMathML_buildGroup(group.body,options)]);if(group.smashHeight){node.setAttribute("height","0px");}if(group.smashDepth){node.setAttribute("depth","0px");}return node;}});defineFunction({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(_ref,args,optArgs){let{parser}=_ref;const index=optArgs[0];const body=args[0];return {type:"sqrt",mode:parser.mode,body,index};},htmlBuilder(group,options){// Square roots are handled in the TeXbook pg. 443, Rule 11.
// First, we do the same steps as in overline to build the inner group
// and line
let inner=buildGroup(group.body,options.havingCrampedStyle());if(inner.height===0){// Render a small surd.
inner.height=options.fontMetrics().xHeight;}// Some groups can return document fragments.  Handle those by wrapping
// them in a span.
inner=buildCommon.wrapFragment(inner,options);// Calculate the minimum size for the \surd delimiter
const metrics=options.fontMetrics();const theta=metrics.defaultRuleThickness;let phi=theta;if(options.style.id<src_Style.TEXT.id){phi=options.fontMetrics().xHeight;}// Calculate the clearance between the body and line
let lineClearance=theta+phi/4;const minDelimiterHeight=inner.height+inner.depth+lineClearance+theta;// Create a sqrt SVG of the required minimum size
const{span:img,ruleWidth,advanceWidth}=delimiter.sqrtImage(minDelimiterHeight,options);const delimDepth=img.height-ruleWidth;// Adjust the clearance based on the delimiter size
if(delimDepth>inner.height+inner.depth+lineClearance){lineClearance=(lineClearance+delimDepth-inner.height-inner.depth)/2;}// Shift the sqrt image
const imgShift=img.height-inner.height-lineClearance-ruleWidth;inner.style.paddingLeft=makeEm(advanceWidth);// Overlay the image and the argument.
const body=buildCommon.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:inner,wrapperClasses:["svg-align"]},{type:"kern",size:-(inner.height+imgShift)},{type:"elem",elem:img},{type:"kern",size:ruleWidth}]},options);if(!group.index){return buildCommon.makeSpan(["mord","sqrt"],[body],options);}else {// Handle the optional root index
// The index is always in scriptscript style
const newOptions=options.havingStyle(src_Style.SCRIPTSCRIPT);const rootm=buildGroup(group.index,newOptions,options);// The amount the index is shifted by. This is taken from the TeX
// source, in the definition of `\r@@t`.
const toShift=0.6*(body.height-body.depth);// Build a VList with the superscript shifted up correctly
const rootVList=buildCommon.makeVList({positionType:"shift",positionData:-toShift,children:[{type:"elem",elem:rootm}]},options);// Add a class surrounding it so we can add on the appropriate
// kerning
const rootVListWrap=buildCommon.makeSpan(["root"],[rootVList]);return buildCommon.makeSpan(["mord","sqrt"],[rootVListWrap,body],options);}},mathmlBuilder(group,options){const{body,index}=group;return index?new mathMLTree.MathNode("mroot",[buildMathML_buildGroup(body,options),buildMathML_buildGroup(index,options)]):new mathMLTree.MathNode("msqrt",[buildMathML_buildGroup(body,options)]);}});const styling_styleMap={"display":src_Style.DISPLAY,"text":src_Style.TEXT,"script":src_Style.SCRIPT,"scriptscript":src_Style.SCRIPTSCRIPT};defineFunction({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:true,primitive:true},handler(_ref,args){let{breakOnTokenText,funcName,parser}=_ref;// parse out the implicit body
const body=parser.parseExpression(true,breakOnTokenText);// TODO: Refactor to avoid duplicating styleMap in multiple places (e.g.
// here and in buildHTML and de-dupe the enumeration of all the styles).
// $FlowFixMe: The names above exactly match the styles.
const style=funcName.slice(1,funcName.length-5);return {type:"styling",mode:parser.mode,// Figure out what style to use by pulling out the style from
// the function name
style,body};},htmlBuilder(group,options){// Style changes are handled in the TeXbook on pg. 442, Rule 3.
const newStyle=styling_styleMap[group.style];const newOptions=options.havingStyle(newStyle).withFont('');return sizingGroup(group.body,newOptions,options);},mathmlBuilder(group,options){// Figure out what style we're changing to.
const newStyle=styling_styleMap[group.style];const newOptions=options.havingStyle(newStyle);const inner=buildMathML_buildExpression(group.body,newOptions);const node=new mathMLTree.MathNode("mstyle",inner);const styleAttributes={"display":["0","true"],"text":["0","false"],"script":["1","false"],"scriptscript":["2","false"]};const attr=styleAttributes[group.style];node.setAttribute("scriptlevel",attr[0]);node.setAttribute("displaystyle",attr[1]);return node;}});/**
 * Sometimes, groups perform special rules when they have superscripts or
 * subscripts attached to them. This function lets the `supsub` group know that
 * Sometimes, groups perform special rules when they have superscripts or
 * its inner element should handle the superscripts and subscripts instead of
 * handling them itself.
 */const htmlBuilderDelegate=function(group,options){const base=group.base;if(!base){return null;}else if(base.type==="op"){// Operators handle supsubs differently when they have limits
// (e.g. `\displaystyle\sum_2^3`)
const delegate=base.limits&&(options.style.size===src_Style.DISPLAY.size||base.alwaysHandleSupSub);return delegate?op_htmlBuilder:null;}else if(base.type==="operatorname"){const delegate=base.alwaysHandleSupSub&&(options.style.size===src_Style.DISPLAY.size||base.limits);return delegate?operatorname_htmlBuilder:null;}else if(base.type==="accent"){return utils.isCharacterBox(base.base)?htmlBuilder:null;}else if(base.type==="horizBrace"){const isSup=!group.sub;return isSup===base.isOver?horizBrace_htmlBuilder:null;}else {return null;}};// Super scripts and subscripts, whose precise placement can depend on other
// functions that precede them.
defineFunctionBuilders({type:"supsub",htmlBuilder(group,options){// Superscript and subscripts are handled in the TeXbook on page
// 445-446, rules 18(a-f).
// Here is where we defer to the inner group if it should handle
// superscripts and subscripts itself.
const builderDelegate=htmlBuilderDelegate(group,options);if(builderDelegate){return builderDelegate(group,options);}const{base:valueBase,sup:valueSup,sub:valueSub}=group;const base=buildGroup(valueBase,options);let supm;let subm;const metrics=options.fontMetrics();// Rule 18a
let supShift=0;let subShift=0;const isCharacterBox=valueBase&&utils.isCharacterBox(valueBase);if(valueSup){const newOptions=options.havingStyle(options.style.sup());supm=buildGroup(valueSup,newOptions,options);if(!isCharacterBox){supShift=base.height-newOptions.fontMetrics().supDrop*newOptions.sizeMultiplier/options.sizeMultiplier;}}if(valueSub){const newOptions=options.havingStyle(options.style.sub());subm=buildGroup(valueSub,newOptions,options);if(!isCharacterBox){subShift=base.depth+newOptions.fontMetrics().subDrop*newOptions.sizeMultiplier/options.sizeMultiplier;}}// Rule 18c
let minSupShift;if(options.style===src_Style.DISPLAY){minSupShift=metrics.sup1;}else if(options.style.cramped){minSupShift=metrics.sup3;}else {minSupShift=metrics.sup2;}// scriptspace is a font-size-independent size, so scale it
// appropriately for use as the marginRight.
const multiplier=options.sizeMultiplier;const marginRight=makeEm(0.5/metrics.ptPerEm/multiplier);let marginLeft=null;if(subm){// Subscripts shouldn't be shifted by the base's italic correction.
// Account for that by shifting the subscript back the appropriate
// amount. Note we only do this when the base is a single symbol.
const isOiint=group.base&&group.base.type==="op"&&group.base.name&&(group.base.name==="\\oiint"||group.base.name==="\\oiiint");if(base instanceof SymbolNode||isOiint){// $FlowFixMe
marginLeft=makeEm(-base.italic);}}let supsub;if(supm&&subm){supShift=Math.max(supShift,minSupShift,supm.depth+0.25*metrics.xHeight);subShift=Math.max(subShift,metrics.sub2);const ruleWidth=metrics.defaultRuleThickness;// Rule 18e
const maxWidth=4*ruleWidth;if(supShift-supm.depth-(subm.height-subShift)<maxWidth){subShift=maxWidth-(supShift-supm.depth)+subm.height;const psi=0.8*metrics.xHeight-(supShift-supm.depth);if(psi>0){supShift+=psi;subShift-=psi;}}const vlistElem=[{type:"elem",elem:subm,shift:subShift,marginRight,marginLeft},{type:"elem",elem:supm,shift:-supShift,marginRight}];supsub=buildCommon.makeVList({positionType:"individualShift",children:vlistElem},options);}else if(subm){// Rule 18b
subShift=Math.max(subShift,metrics.sub1,subm.height-0.8*metrics.xHeight);const vlistElem=[{type:"elem",elem:subm,marginLeft,marginRight}];supsub=buildCommon.makeVList({positionType:"shift",positionData:subShift,children:vlistElem},options);}else if(supm){// Rule 18c, d
supShift=Math.max(supShift,minSupShift,supm.depth+0.25*metrics.xHeight);supsub=buildCommon.makeVList({positionType:"shift",positionData:-supShift,children:[{type:"elem",elem:supm,marginRight}]},options);}else {throw new Error("supsub must have either sup or sub.");}// Wrap the supsub vlist in a span.msupsub to reset text-align.
const mclass=getTypeOfDomTree(base,"right")||"mord";return buildCommon.makeSpan([mclass],[base,buildCommon.makeSpan(["msupsub"],[supsub])],options);},mathmlBuilder(group,options){// Is the inner group a relevant horizontal brace?
let isBrace=false;let isOver;let isSup;if(group.base&&group.base.type==="horizBrace"){isSup=!!group.sup;if(isSup===group.base.isOver){isBrace=true;isOver=group.base.isOver;}}if(group.base&&(group.base.type==="op"||group.base.type==="operatorname")){group.base.parentIsSupSub=true;}const children=[buildMathML_buildGroup(group.base,options)];if(group.sub){children.push(buildMathML_buildGroup(group.sub,options));}if(group.sup){children.push(buildMathML_buildGroup(group.sup,options));}let nodeType;if(isBrace){nodeType=isOver?"mover":"munder";}else if(!group.sub){const base=group.base;if(base&&base.type==="op"&&base.limits&&(options.style===src_Style.DISPLAY||base.alwaysHandleSupSub)){nodeType="mover";}else if(base&&base.type==="operatorname"&&base.alwaysHandleSupSub&&(base.limits||options.style===src_Style.DISPLAY)){nodeType="mover";}else {nodeType="msup";}}else if(!group.sup){const base=group.base;if(base&&base.type==="op"&&base.limits&&(options.style===src_Style.DISPLAY||base.alwaysHandleSupSub)){nodeType="munder";}else if(base&&base.type==="operatorname"&&base.alwaysHandleSupSub&&(base.limits||options.style===src_Style.DISPLAY)){nodeType="munder";}else {nodeType="msub";}}else {const base=group.base;if(base&&base.type==="op"&&base.limits&&options.style===src_Style.DISPLAY){nodeType="munderover";}else if(base&&base.type==="operatorname"&&base.alwaysHandleSupSub&&(options.style===src_Style.DISPLAY||base.limits)){nodeType="munderover";}else {nodeType="msubsup";}}return new mathMLTree.MathNode(nodeType,children);}});// Operator ParseNodes created in Parser.js from symbol Groups in src/symbols.js.
defineFunctionBuilders({type:"atom",htmlBuilder(group,options){return buildCommon.mathsym(group.text,group.mode,options,["m"+group.family]);},mathmlBuilder(group,options){const node=new mathMLTree.MathNode("mo",[makeText(group.text,group.mode)]);if(group.family==="bin"){const variant=getVariant(group,options);if(variant==="bold-italic"){node.setAttribute("mathvariant",variant);}}else if(group.family==="punct"){node.setAttribute("separator","true");}else if(group.family==="open"||group.family==="close"){// Delims built here should not stretch vertically.
// See delimsizing.js for stretchy delims.
node.setAttribute("stretchy","false");}return node;}});// "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in
// src/symbols.js.
const defaultVariant={"mi":"italic","mn":"normal","mtext":"normal"};defineFunctionBuilders({type:"mathord",htmlBuilder(group,options){return buildCommon.makeOrd(group,options,"mathord");},mathmlBuilder(group,options){const node=new mathMLTree.MathNode("mi",[makeText(group.text,group.mode,options)]);const variant=getVariant(group,options)||"italic";if(variant!==defaultVariant[node.type]){node.setAttribute("mathvariant",variant);}return node;}});defineFunctionBuilders({type:"textord",htmlBuilder(group,options){return buildCommon.makeOrd(group,options,"textord");},mathmlBuilder(group,options){const text=makeText(group.text,group.mode,options);const variant=getVariant(group,options)||"normal";let node;if(group.mode==='text'){node=new mathMLTree.MathNode("mtext",[text]);}else if(/[0-9]/.test(group.text)){node=new mathMLTree.MathNode("mn",[text]);}else if(group.text==="\\prime"){node=new mathMLTree.MathNode("mo",[text]);}else {node=new mathMLTree.MathNode("mi",[text]);}if(variant!==defaultVariant[node.type]){node.setAttribute("mathvariant",variant);}return node;}});// A map of CSS-based spacing functions to their CSS class.
const cssSpace={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"};// A lookup table to determine whether a spacing function/symbol should be
// treated like a regular space character.  If a symbol or command is a key
// in this table, then it should be a regular space character.  Furthermore,
// the associated value may have a `className` specifying an extra CSS class
// to add to the created `span`.
const regularSpace={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};// ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in
// src/symbols.js.
defineFunctionBuilders({type:"spacing",htmlBuilder(group,options){if(regularSpace.hasOwnProperty(group.text)){const className=regularSpace[group.text].className||"";// Spaces are generated by adding an actual space. Each of these
// things has an entry in the symbols table, so these will be turned
// into appropriate outputs.
if(group.mode==="text"){const ord=buildCommon.makeOrd(group,options,"textord");ord.classes.push(className);return ord;}else {return buildCommon.makeSpan(["mspace",className],[buildCommon.mathsym(group.text,group.mode,options)],options);}}else if(cssSpace.hasOwnProperty(group.text)){// Spaces based on just a CSS class.
return buildCommon.makeSpan(["mspace",cssSpace[group.text]],[],options);}else {throw new src_ParseError("Unknown type of space \""+group.text+"\"");}},mathmlBuilder(group,options){let node;if(regularSpace.hasOwnProperty(group.text)){node=new mathMLTree.MathNode("mtext",[new mathMLTree.TextNode("\u00a0")]);}else if(cssSpace.hasOwnProperty(group.text)){// CSS-based MathML spaces (\nobreak, \allowbreak) are ignored
return new mathMLTree.MathNode("mspace");}else {throw new src_ParseError("Unknown type of space \""+group.text+"\"");}return node;}});const pad=()=>{const padNode=new mathMLTree.MathNode("mtd",[]);padNode.setAttribute("width","50%");return padNode;};defineFunctionBuilders({type:"tag",mathmlBuilder(group,options){const table=new mathMLTree.MathNode("mtable",[new mathMLTree.MathNode("mtr",[pad(),new mathMLTree.MathNode("mtd",[buildExpressionRow(group.body,options)]),pad(),new mathMLTree.MathNode("mtd",[buildExpressionRow(group.tag,options)])])]);table.setAttribute("width","100%");return table;// TODO: Left-aligned tags.
// Currently, the group and options passed here do not contain
// enough info to set tag alignment. `leqno` is in Settings but it is
// not passed to Options. On the HTML side, leqno is
// set by a CSS class applied in buildTree.js. That would have worked
// in MathML if browsers supported <mlabeledtr>. Since they don't, we
// need to rewrite the way this function is called.
}});// Non-mathy text, possibly in a font
const textFontFamilies={"\\text":undefined,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"};const textFontWeights={"\\textbf":"textbf","\\textmd":"textmd"};const textFontShapes={"\\textit":"textit","\\textup":"textup"};const optionsWithFont=(group,options)=>{const font=group.font;// Checks if the argument is a font family or a font style.
if(!font){return options;}else if(textFontFamilies[font]){return options.withTextFontFamily(textFontFamilies[font]);}else if(textFontWeights[font]){return options.withTextFontWeight(textFontWeights[font]);}else if(font==="\\emph"){return options.fontShape==="textit"?options.withTextFontShape("textup"):options.withTextFontShape("textit");}return options.withTextFontShape(textFontShapes[font]);};defineFunction({type:"text",names:[// Font families
"\\text","\\textrm","\\textsf","\\texttt","\\textnormal",// Font weights
"\\textbf","\\textmd",// Font Shapes
"\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:true,allowedInText:true},handler(_ref,args){let{parser,funcName}=_ref;const body=args[0];return {type:"text",mode:parser.mode,body:ordargument(body),font:funcName};},htmlBuilder(group,options){const newOptions=optionsWithFont(group,options);const inner=buildExpression(group.body,newOptions,true);return buildCommon.makeSpan(["mord","text"],inner,newOptions);},mathmlBuilder(group,options){const newOptions=optionsWithFont(group,options);return buildExpressionRow(group.body,newOptions);}});defineFunction({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:true},handler(_ref,args){let{parser}=_ref;return {type:"underline",mode:parser.mode,body:args[0]};},htmlBuilder(group,options){// Underlines are handled in the TeXbook pg 443, Rule 10.
// Build the inner group.
const innerGroup=buildGroup(group.body,options);// Create the line to go below the body
const line=buildCommon.makeLineSpan("underline-line",options);// Generate the vlist, with the appropriate kerns
const defaultRuleThickness=options.fontMetrics().defaultRuleThickness;const vlist=buildCommon.makeVList({positionType:"top",positionData:innerGroup.height,children:[{type:"kern",size:defaultRuleThickness},{type:"elem",elem:line},{type:"kern",size:3*defaultRuleThickness},{type:"elem",elem:innerGroup}]},options);return buildCommon.makeSpan(["mord","underline"],[vlist],options);},mathmlBuilder(group,options){const operator=new mathMLTree.MathNode("mo",[new mathMLTree.TextNode("\u203e")]);operator.setAttribute("stretchy","true");const node=new mathMLTree.MathNode("munder",[buildMathML_buildGroup(group.body,options),operator]);node.setAttribute("accentunder","true");return node;}});// \vcenter:  Vertically center the argument group on the math axis.
defineFunction({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],// In LaTeX, \vcenter can act only on a box.
allowedInText:false},handler(_ref,args){let{parser}=_ref;return {type:"vcenter",mode:parser.mode,body:args[0]};},htmlBuilder(group,options){const body=buildGroup(group.body,options);const axisHeight=options.fontMetrics().axisHeight;const dy=0.5*(body.height-axisHeight-(body.depth+axisHeight));return buildCommon.makeVList({positionType:"shift",positionData:dy,children:[{type:"elem",elem:body}]},options);},mathmlBuilder(group,options){// There is no way to do this in MathML.
// Write a class as a breadcrumb in case some post-processor wants
// to perform a vcenter adjustment.
return new mathMLTree.MathNode("mpadded",[buildMathML_buildGroup(group.body,options)],["vcenter"]);}});defineFunction({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:true},handler(context,args,optArgs){// \verb and \verb* are dealt with directly in Parser.js.
// If we end up here, it's because of a failure to match the two delimiters
// in the regex in Lexer.js.  LaTeX raises the following error when \verb is
// terminated by end of line (or file).
throw new src_ParseError("\\verb ended by end of line instead of matching delimiter");},htmlBuilder(group,options){const text=makeVerb(group);const body=[];// \verb enters text mode and therefore is sized like \textstyle
const newOptions=options.havingStyle(options.style.text());for(let i=0;i<text.length;i++){let c=text[i];if(c==='~'){c='\\textasciitilde';}body.push(buildCommon.makeSymbol(c,"Typewriter-Regular",group.mode,newOptions,["mord","texttt"]));}return buildCommon.makeSpan(["mord","text"].concat(newOptions.sizingClasses(options)),buildCommon.tryCombineChars(body),newOptions);},mathmlBuilder(group,options){const text=new mathMLTree.TextNode(makeVerb(group));const node=new mathMLTree.MathNode("mtext",[text]);node.setAttribute("mathvariant","monospace");return node;}});/**
 * Converts verb group into body string.
 *
 * \verb* replaces each space with an open box \u2423
 * \verb replaces each space with a no-break space \xA0
 */const makeVerb=group=>group.body.replace(/ /g,group.star?'\u2423':'\xA0');/** Include this to ensure that all functions are defined. */const functions=_functions;/* harmony default export */var src_functions=functions;// TODO(kevinb): have functions return an object and call defineFunction with
/**
 * The Lexer class handles tokenizing the input in various ways. Since our
 * parser expects us to be able to backtrack, the lexer allows lexing from any
 * given starting point.
 *
 * Its main exposed function is the `lex` function, which takes a position to
 * lex from and a type of token to lex. It defers to the appropriate `_innerLex`
 * function.
 *
 * The various `_innerLex` functions perform the actual lexing of different
 * kinds.
 *//* The following tokenRegex
 * - matches typical whitespace (but not NBSP etc.) using its first group
 * - does not match any control character \x00-\x1f except whitespace
 * - does not match a bare backslash
 * - matches any ASCII character except those just mentioned
 * - does not match the BMP private use area \uE000-\uF8FF
 * - does not match bare surrogate code units
 * - matches any BMP character except for those just described
 * - matches any valid Unicode surrogate pair
 * - matches a backslash followed by one or more whitespace characters
 * - matches a backslash followed by one or more letters then whitespace
 * - matches a backslash followed by any BMP character
 * Capturing groups:
 *   [1] regular whitespace
 *   [2] backslash followed by whitespace
 *   [3] anything else, which may include:
 *     [4] left character of \verb*
 *     [5] left character of \verb
 *     [6] backslash followed by word, excluding any trailing whitespace
 * Just because the Lexer matches something doesn't mean it's valid input:
 * If there is no matching function or symbol definition, the Parser will
 * still reject the input.
 */const spaceRegexString="[ \r\n\t]";const controlWordRegexString="\\\\[a-zA-Z@]+";const controlSymbolRegexString="\\\\[^\uD800-\uDFFF]";const controlWordWhitespaceRegexString="("+controlWordRegexString+")"+spaceRegexString+"*";const controlSpaceRegexString="\\\\(\n|[ \r\t]+\n?)[ \r\t]*";const combiningDiacriticalMarkString="[\u0300-\u036f]";const combiningDiacriticalMarksEndRegex=new RegExp(combiningDiacriticalMarkString+"+$");const tokenRegexString="("+spaceRegexString+"+)|"+(// whitespace
controlSpaceRegexString+"|")+// \whitespace
"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(// single codepoint
combiningDiacriticalMarkString+"*")+// ...plus accents
"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(// surrogate pair
combiningDiacriticalMarkString+"*")+// ...plus accents
"|\\\\verb\\*([^]).*?\\4"+// \verb*
"|\\\\verb([^*a-zA-Z]).*?\\5"+(// \verb unstarred
"|"+controlWordWhitespaceRegexString)+(// \macroName + spaces
"|"+controlSymbolRegexString+")");// \\, \', etc.
/** Main Lexer class */class Lexer{// Category codes. The lexer only supports comment characters (14) for now.
// MacroExpander additionally distinguishes active (13).
constructor(input,settings){this.input=void 0;this.settings=void 0;this.tokenRegex=void 0;this.catcodes=void 0;// Separate accents from characters
this.input=input;this.settings=settings;this.tokenRegex=new RegExp(tokenRegexString,'g');this.catcodes={"%":14,// comment character
"~":13// active character
};}setCatcode(char,code){this.catcodes[char]=code;}/**
   * This function lexes a single token.
   */lex(){const input=this.input;const pos=this.tokenRegex.lastIndex;if(pos===input.length){return new Token("EOF",new SourceLocation(this,pos,pos));}const match=this.tokenRegex.exec(input);if(match===null||match.index!==pos){throw new src_ParseError("Unexpected character: '"+input[pos]+"'",new Token(input[pos],new SourceLocation(this,pos,pos+1)));}const text=match[6]||match[3]||(match[2]?"\\ ":" ");if(this.catcodes[text]===14){// comment character
const nlIndex=input.indexOf('\n',this.tokenRegex.lastIndex);if(nlIndex===-1){this.tokenRegex.lastIndex=input.length;// EOF
this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would "+"fail because of commenting the end of math mode (e.g. $)");}else {this.tokenRegex.lastIndex=nlIndex+1;}return this.lex();}return new Token(text,new SourceLocation(this,pos,this.tokenRegex.lastIndex));}}/**
 * A `Namespace` refers to a space of nameable things like macros or lengths,
 * which can be `set` either globally or local to a nested group, using an
 * undo stack similar to how TeX implements this functionality.
 * Performance-wise, `get` and local `set` take constant time, while global
 * `set` takes time proportional to the depth of group nesting.
 */class Namespace{/**
   * Both arguments are optional.  The first argument is an object of
   * built-in mappings which never change.  The second argument is an object
   * of initial (global-level) mappings, which will constantly change
   * according to any global/top-level `set`s done.
   */constructor(builtins,globalMacros){if(builtins===void 0){builtins={};}if(globalMacros===void 0){globalMacros={};}this.current=void 0;this.builtins=void 0;this.undefStack=void 0;this.current=globalMacros;this.builtins=builtins;this.undefStack=[];}/**
   * Start a new nested group, affecting future local `set`s.
   */beginGroup(){this.undefStack.push({});}/**
   * End current nested group, restoring values before the group began.
   */endGroup(){if(this.undefStack.length===0){throw new src_ParseError("Unbalanced namespace destruction: attempt "+"to pop global namespace; please report this as a bug");}const undefs=this.undefStack.pop();for(const undef in undefs){if(undefs.hasOwnProperty(undef)){if(undefs[undef]==null){delete this.current[undef];}else {this.current[undef]=undefs[undef];}}}}/**
   * Ends all currently nested groups (if any), restoring values before the
   * groups began.  Useful in case of an error in the middle of parsing.
   */endGroups(){while(this.undefStack.length>0){this.endGroup();}}/**
   * Detect whether `name` has a definition.  Equivalent to
   * `get(name) != null`.
   */has(name){return this.current.hasOwnProperty(name)||this.builtins.hasOwnProperty(name);}/**
   * Get the current value of a name, or `undefined` if there is no value.
   *
   * Note: Do not use `if (namespace.get(...))` to detect whether a macro
   * is defined, as the definition may be the empty string which evaluates
   * to `false` in JavaScript.  Use `if (namespace.get(...) != null)` or
   * `if (namespace.has(...))`.
   */get(name){if(this.current.hasOwnProperty(name)){return this.current[name];}else {return this.builtins[name];}}/**
   * Set the current value of a name, and optionally set it globally too.
   * Local set() sets the current value and (when appropriate) adds an undo
   * operation to the undo stack.  Global set() may change the undo
   * operation at every level, so takes time linear in their number.
   * A value of undefined means to delete existing definitions.
   */set(name,value,global){if(global===void 0){global=false;}if(global){// Global set is equivalent to setting in all groups.  Simulate this
// by destroying any undos currently scheduled for this name,
// and adding an undo with the *new* value (in case it later gets
// locally reset within this environment).
for(let i=0;i<this.undefStack.length;i++){delete this.undefStack[i][name];}if(this.undefStack.length>0){this.undefStack[this.undefStack.length-1][name]=value;}}else {// Undo this set at end of this group (possibly to `undefined`),
// unless an undo is already in place, in which case that older
// value is the correct one.
const top=this.undefStack[this.undefStack.length-1];if(top&&!top.hasOwnProperty(name)){top[name]=this.current[name];}}if(value==null){delete this.current[name];}else {this.current[name]=value;}}}/**
 * Predefined macros for KaTeX.
 * This can be used to define some commands in terms of others.
 */// Export global macros object from defineMacro
const macros=_macros;/* harmony default export */var src_macros=macros;//////////////////////////////////////////////////////////////////////
// macro tools
defineMacro("\\noexpand",function(context){// The expansion is the token itself; but that token is interpreted
// as if its meaning were ‘\relax’ if it is a control sequence that
// would ordinarily be expanded by TeX’s expansion rules.
const t=context.popToken();if(context.isExpandable(t.text)){t.noexpand=true;t.treatAsRelax=true;}return {tokens:[t],numArgs:0};});defineMacro("\\expandafter",function(context){// TeX first reads the token that comes immediately after \expandafter,
// without expanding it; let’s call this token t. Then TeX reads the
// token that comes after t (and possibly more tokens, if that token
// has an argument), replacing it by its expansion. Finally TeX puts
// t back in front of that expansion.
const t=context.popToken();context.expandOnce(true);// expand only an expandable token
return {tokens:[t],numArgs:0};});// LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2
// TeX source: \long\def\@firstoftwo#1#2{#1}
defineMacro("\\@firstoftwo",function(context){const args=context.consumeArgs(2);return {tokens:args[0],numArgs:0};});// LaTeX's \@secondoftwo{#1}{#2} expands to #2, skipping #1
// TeX source: \long\def\@secondoftwo#1#2{#2}
defineMacro("\\@secondoftwo",function(context){const args=context.consumeArgs(2);return {tokens:args[1],numArgs:0};});// LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded)
// symbol that isn't a space, consuming any spaces but not consuming the
// first nonspace character.  If that nonspace character matches #1, then
// the macro expands to #2; otherwise, it expands to #3.
defineMacro("\\@ifnextchar",function(context){const args=context.consumeArgs(3);// symbol, if, else
context.consumeSpaces();const nextToken=context.future();if(args[0].length===1&&args[0][0].text===nextToken.text){return {tokens:args[1],numArgs:0};}else {return {tokens:args[2],numArgs:0};}});// LaTeX's \@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol.
// If it is `*`, then it consumes the symbol, and the macro expands to #1;
// otherwise, the macro expands to #2 (without consuming the symbol).
// TeX source: \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}}
defineMacro("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");// LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode
defineMacro("\\TextOrMath",function(context){const args=context.consumeArgs(2);if(context.mode==='text'){return {tokens:args[0],numArgs:0};}else {return {tokens:args[1],numArgs:0};}});// Lookup table for parsing numbers in base 8 through 16
const digitToNumber={"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,"a":10,"A":10,"b":11,"B":11,"c":12,"C":12,"d":13,"D":13,"e":14,"E":14,"f":15,"F":15};// TeX \char makes a literal character (catcode 12) using the following forms:
// (see The TeXBook, p. 43)
//   \char123  -- decimal
//   \char'123 -- octal
//   \char"123 -- hex
//   \char`x   -- character that can be written (i.e. isn't active)
//   \char`\x  -- character that cannot be written (e.g. %)
// These all refer to characters from the font, so we turn them into special
// calls to a function \@char dealt with in the Parser.
defineMacro("\\char",function(context){let token=context.popToken();let base;let number='';if(token.text==="'"){base=8;token=context.popToken();}else if(token.text==='"'){base=16;token=context.popToken();}else if(token.text==="`"){token=context.popToken();if(token.text[0]==="\\"){number=token.text.charCodeAt(1);}else if(token.text==="EOF"){throw new src_ParseError("\\char` missing argument");}else {number=token.text.charCodeAt(0);}}else {base=10;}if(base){// Parse a number in the given base, starting with first `token`.
number=digitToNumber[token.text];if(number==null||number>=base){throw new src_ParseError("Invalid base-"+base+" digit "+token.text);}let digit;while((digit=digitToNumber[context.future().text])!=null&&digit<base){number*=base;number+=digit;context.popToken();}}return "\\@char{"+number+"}";});// \newcommand{\macro}[args]{definition}
// \renewcommand{\macro}[args]{definition}
// TODO: Optional arguments: \newcommand{\macro}[args][default]{definition}
const newcommand=(context,existsOK,nonexistsOK,skipIfExists)=>{let arg=context.consumeArg().tokens;if(arg.length!==1){throw new src_ParseError("\\newcommand's first argument must be a macro name");}const name=arg[0].text;const exists=context.isDefined(name);if(exists&&!existsOK){throw new src_ParseError("\\newcommand{"+name+"} attempting to redefine "+(name+"; use \\renewcommand"));}if(!exists&&!nonexistsOK){throw new src_ParseError("\\renewcommand{"+name+"} when command "+name+" "+"does not yet exist; use \\newcommand");}let numArgs=0;arg=context.consumeArg().tokens;if(arg.length===1&&arg[0].text==="["){let argText='';let token=context.expandNextToken();while(token.text!=="]"&&token.text!=="EOF"){// TODO: Should properly expand arg, e.g., ignore {}s
argText+=token.text;token=context.expandNextToken();}if(!argText.match(/^\s*[0-9]+\s*$/)){throw new src_ParseError("Invalid number of arguments: "+argText);}numArgs=parseInt(argText);arg=context.consumeArg().tokens;}if(!(exists&&skipIfExists)){// Final arg is the expansion of the macro
context.macros.set(name,{tokens:arg,numArgs});}return '';};defineMacro("\\newcommand",context=>newcommand(context,false,true,false));defineMacro("\\renewcommand",context=>newcommand(context,true,false,false));defineMacro("\\providecommand",context=>newcommand(context,true,true,true));// terminal (console) tools
defineMacro("\\message",context=>{const arg=context.consumeArgs(1)[0];// eslint-disable-next-line no-console
console.log(arg.reverse().map(token=>token.text).join(""));return '';});defineMacro("\\errmessage",context=>{const arg=context.consumeArgs(1)[0];// eslint-disable-next-line no-console
console.error(arg.reverse().map(token=>token.text).join(""));return '';});defineMacro("\\show",context=>{const tok=context.popToken();const name=tok.text;// eslint-disable-next-line no-console
console.log(tok,context.macros.get(name),src_functions[name],src_symbols.math[name],src_symbols.text[name]);return '';});//////////////////////////////////////////////////////////////////////
// Grouping
// \let\bgroup={ \let\egroup=}
defineMacro("\\bgroup","{");defineMacro("\\egroup","}");// Symbols from latex.ltx:
// \def~{\nobreakspace{}}
// \def\lq{`}
// \def\rq{'}
// \def \aa {\r a}
// \def \AA {\r A}
defineMacro("~","\\nobreakspace");defineMacro("\\lq","`");defineMacro("\\rq","'");defineMacro("\\aa","\\r a");defineMacro("\\AA","\\r A");// Copyright (C) and registered (R) symbols. Use raw symbol in MathML.
// \DeclareTextCommandDefault{\textcopyright}{\textcircled{c}}
// \DeclareTextCommandDefault{\textregistered}{\textcircled{%
//      \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
// \DeclareRobustCommand{\copyright}{%
//    \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi}
defineMacro("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");defineMacro("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");defineMacro("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");// Characters omitted from Unicode range 1D400–1D7FF
defineMacro("\u212C","\\mathscr{B}");// script
defineMacro("\u2130","\\mathscr{E}");defineMacro("\u2131","\\mathscr{F}");defineMacro("\u210B","\\mathscr{H}");defineMacro("\u2110","\\mathscr{I}");defineMacro("\u2112","\\mathscr{L}");defineMacro("\u2133","\\mathscr{M}");defineMacro("\u211B","\\mathscr{R}");defineMacro("\u212D","\\mathfrak{C}");// Fraktur
defineMacro("\u210C","\\mathfrak{H}");defineMacro("\u2128","\\mathfrak{Z}");// Define \Bbbk with a macro that works in both HTML and MathML.
defineMacro("\\Bbbk","\\Bbb{k}");// Unicode middle dot
// The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays
// the dot at U+22C5 and gives it punct spacing.
defineMacro("\u00b7","\\cdotp");// \llap and \rlap render their contents in text mode
defineMacro("\\llap","\\mathllap{\\textrm{#1}}");defineMacro("\\rlap","\\mathrlap{\\textrm{#1}}");defineMacro("\\clap","\\mathclap{\\textrm{#1}}");// \mathstrut from the TeXbook, p 360
defineMacro("\\mathstrut","\\vphantom{(}");// \underbar from TeXbook p 353
defineMacro("\\underbar","\\underline{\\text{#1}}");// \not is defined by base/fontmath.ltx via
// \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
// It's thus treated like a \mathrel, but defined by a symbol that has zero
// width but extends to the right.  We use \rlap to get that spacing.
// For MathML we write U+0338 here. buildMathML.js will then do the overlay.
defineMacro("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');// Negated symbols from base/fontmath.ltx:
// \def\neq{\not=} \let\ne=\neq
// \DeclareRobustCommand
//   \notin{\mathrel{\m@th\mathpalette\c@ncel\in}}
// \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}}
defineMacro("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");defineMacro("\\ne","\\neq");defineMacro("\u2260","\\neq");defineMacro("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}"+"{\\mathrel{\\char`∉}}");defineMacro("\u2209","\\notin");// Unicode stacked relations
defineMacro("\u2258","\\html@mathml{"+"\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}"+"}{\\mathrel{\\char`\u2258}}");defineMacro("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");defineMacro("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");defineMacro("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}"+"{\\mathrel{\\char`\u225B}}");defineMacro("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}"+"{\\mathrel{\\char`\u225D}}");defineMacro("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}"+"{\\mathrel{\\char`\u225E}}");defineMacro("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");// Misc Unicode
defineMacro("\u27C2","\\perp");defineMacro("\u203C","\\mathclose{!\\mkern-0.8mu!}");defineMacro("\u220C","\\notni");defineMacro("\u231C","\\ulcorner");defineMacro("\u231D","\\urcorner");defineMacro("\u231E","\\llcorner");defineMacro("\u231F","\\lrcorner");defineMacro("\u00A9","\\copyright");defineMacro("\u00AE","\\textregistered");defineMacro("\uFE0F","\\textregistered");// The KaTeX fonts have corners at codepoints that don't match Unicode.
// For MathML purposes, use the Unicode code point.
defineMacro("\\ulcorner","\\html@mathml{\\@ulcorner}{\\mathop{\\char\"231c}}");defineMacro("\\urcorner","\\html@mathml{\\@urcorner}{\\mathop{\\char\"231d}}");defineMacro("\\llcorner","\\html@mathml{\\@llcorner}{\\mathop{\\char\"231e}}");defineMacro("\\lrcorner","\\html@mathml{\\@lrcorner}{\\mathop{\\char\"231f}}");//////////////////////////////////////////////////////////////////////
// LaTeX_2ε
// \vdots{\vbox{\baselineskip4\p@  \lineskiplimit\z@
// \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
// We'll call \varvdots, which gets a glyph from symbols.js.
// The zero-width rule gets us an equivalent to the vertical 6pt kern.
defineMacro("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");defineMacro("\u22ee","\\vdots");//////////////////////////////////////////////////////////////////////
// amsmath.sty
// http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf
// Italic Greek capital letters.  AMS defines these with \DeclareMathSymbol,
// but they are equivalent to \mathit{\Letter}.
defineMacro("\\varGamma","\\mathit{\\Gamma}");defineMacro("\\varDelta","\\mathit{\\Delta}");defineMacro("\\varTheta","\\mathit{\\Theta}");defineMacro("\\varLambda","\\mathit{\\Lambda}");defineMacro("\\varXi","\\mathit{\\Xi}");defineMacro("\\varPi","\\mathit{\\Pi}");defineMacro("\\varSigma","\\mathit{\\Sigma}");defineMacro("\\varUpsilon","\\mathit{\\Upsilon}");defineMacro("\\varPhi","\\mathit{\\Phi}");defineMacro("\\varPsi","\\mathit{\\Psi}");defineMacro("\\varOmega","\\mathit{\\Omega}");//\newcommand{\substack}[1]{\subarray{c}#1\endsubarray}
defineMacro("\\substack","\\begin{subarray}{c}#1\\end{subarray}");// \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
// \mkern-\thinmuskip{:}\mskip6muplus1mu\relax}
defineMacro("\\colon","\\nobreak\\mskip2mu\\mathpunct{}"+"\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");// \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}
defineMacro("\\boxed","\\fbox{$\\displaystyle{#1}$}");// \def\iff{\DOTSB\;\Longleftrightarrow\;}
// \def\implies{\DOTSB\;\Longrightarrow\;}
// \def\impliedby{\DOTSB\;\Longleftarrow\;}
defineMacro("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");defineMacro("\\implies","\\DOTSB\\;\\Longrightarrow\\;");defineMacro("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");// \def\dddot#1{{\mathop{#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@
//  \hbox{\normalfont ...}\vss}}}}
// We use \overset which avoids the vertical shift of \mathop.
defineMacro("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");defineMacro("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");// AMSMath's automatic \dots, based on \mdots@@ macro.
const dotsByToken={',':'\\dotsc','\\not':'\\dotsb',// \keybin@ checks for the following:
'+':'\\dotsb','=':'\\dotsb','<':'\\dotsb','>':'\\dotsb','-':'\\dotsb','*':'\\dotsb',':':'\\dotsb',// Symbols whose definition starts with \DOTSB:
'\\DOTSB':'\\dotsb','\\coprod':'\\dotsb','\\bigvee':'\\dotsb','\\bigwedge':'\\dotsb','\\biguplus':'\\dotsb','\\bigcap':'\\dotsb','\\bigcup':'\\dotsb','\\prod':'\\dotsb','\\sum':'\\dotsb','\\bigotimes':'\\dotsb','\\bigoplus':'\\dotsb','\\bigodot':'\\dotsb','\\bigsqcup':'\\dotsb','\\And':'\\dotsb','\\longrightarrow':'\\dotsb','\\Longrightarrow':'\\dotsb','\\longleftarrow':'\\dotsb','\\Longleftarrow':'\\dotsb','\\longleftrightarrow':'\\dotsb','\\Longleftrightarrow':'\\dotsb','\\mapsto':'\\dotsb','\\longmapsto':'\\dotsb','\\hookrightarrow':'\\dotsb','\\doteq':'\\dotsb',// Symbols whose definition starts with \mathbin:
'\\mathbin':'\\dotsb',// Symbols whose definition starts with \mathrel:
'\\mathrel':'\\dotsb','\\relbar':'\\dotsb','\\Relbar':'\\dotsb','\\xrightarrow':'\\dotsb','\\xleftarrow':'\\dotsb',// Symbols whose definition starts with \DOTSI:
'\\DOTSI':'\\dotsi','\\int':'\\dotsi','\\oint':'\\dotsi','\\iint':'\\dotsi','\\iiint':'\\dotsi','\\iiiint':'\\dotsi','\\idotsint':'\\dotsi',// Symbols whose definition starts with \DOTSX:
'\\DOTSX':'\\dotsx'};defineMacro("\\dots",function(context){// TODO: If used in text mode, should expand to \textellipsis.
// However, in KaTeX, \textellipsis and \ldots behave the same
// (in text mode), and it's unlikely we'd see any of the math commands
// that affect the behavior of \dots when in text mode.  So fine for now
// (until we support \ifmmode ... \else ... \fi).
let thedots='\\dotso';const next=context.expandAfterFuture().text;if(next in dotsByToken){thedots=dotsByToken[next];}else if(next.slice(0,4)==='\\not'){thedots='\\dotsb';}else if(next in src_symbols.math){if(utils.contains(['bin','rel'],src_symbols.math[next].group)){thedots='\\dotsb';}}return thedots;});const spaceAfterDots={// \rightdelim@ checks for the following:
')':true,']':true,'\\rbrack':true,'\\}':true,'\\rbrace':true,'\\rangle':true,'\\rceil':true,'\\rfloor':true,'\\rgroup':true,'\\rmoustache':true,'\\right':true,'\\bigr':true,'\\biggr':true,'\\Bigr':true,'\\Biggr':true,// \extra@ also tests for the following:
'$':true,// \extrap@ checks for the following:
';':true,'.':true,',':true};defineMacro("\\dotso",function(context){const next=context.future().text;if(next in spaceAfterDots){return "\\ldots\\,";}else {return "\\ldots";}});defineMacro("\\dotsc",function(context){const next=context.future().text;// \dotsc uses \extra@ but not \extrap@, instead specially checking for
// ';' and '.', but doesn't check for ','.
if(next in spaceAfterDots&&next!==','){return "\\ldots\\,";}else {return "\\ldots";}});defineMacro("\\cdots",function(context){const next=context.future().text;if(next in spaceAfterDots){return "\\@cdots\\,";}else {return "\\@cdots";}});defineMacro("\\dotsb","\\cdots");defineMacro("\\dotsm","\\cdots");defineMacro("\\dotsi","\\!\\cdots");// amsmath doesn't actually define \dotsx, but \dots followed by a macro
// starting with \DOTSX implies \dotso, and then \extra@ detects this case
// and forces the added `\,`.
defineMacro("\\dotsx","\\ldots\\,");// \let\DOTSI\relax
// \let\DOTSB\relax
// \let\DOTSX\relax
defineMacro("\\DOTSI","\\relax");defineMacro("\\DOTSB","\\relax");defineMacro("\\DOTSX","\\relax");// Spacing, based on amsmath.sty's override of LaTeX defaults
// \DeclareRobustCommand{\tmspace}[3]{%
//   \ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
defineMacro("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");// \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}
// TODO: math mode should use \thinmuskip
defineMacro("\\,","\\tmspace+{3mu}{.1667em}");// \let\thinspace\,
defineMacro("\\thinspace","\\,");// \def\>{\mskip\medmuskip}
// \renewcommand{\:}{\tmspace+\medmuskip{.2222em}}
// TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu
defineMacro("\\>","\\mskip{4mu}");defineMacro("\\:","\\tmspace+{4mu}{.2222em}");// \let\medspace\:
defineMacro("\\medspace","\\:");// \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}}
// TODO: math mode should use \thickmuskip = 5mu plus 5mu
defineMacro("\\;","\\tmspace+{5mu}{.2777em}");// \let\thickspace\;
defineMacro("\\thickspace","\\;");// \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}}
// TODO: math mode should use \thinmuskip
defineMacro("\\!","\\tmspace-{3mu}{.1667em}");// \let\negthinspace\!
defineMacro("\\negthinspace","\\!");// \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}}
// TODO: math mode should use \medmuskip
defineMacro("\\negmedspace","\\tmspace-{4mu}{.2222em}");// \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}}
// TODO: math mode should use \thickmuskip
defineMacro("\\negthickspace","\\tmspace-{5mu}{.277em}");// \def\enspace{\kern.5em }
defineMacro("\\enspace","\\kern.5em ");// \def\enskip{\hskip.5em\relax}
defineMacro("\\enskip","\\hskip.5em\\relax");// \def\quad{\hskip1em\relax}
defineMacro("\\quad","\\hskip1em\\relax");// \def\qquad{\hskip2em\relax}
defineMacro("\\qquad","\\hskip2em\\relax");// \tag@in@display form of \tag
defineMacro("\\tag","\\@ifstar\\tag@literal\\tag@paren");defineMacro("\\tag@paren","\\tag@literal{({#1})}");defineMacro("\\tag@literal",context=>{if(context.macros.get("\\df@tag")){throw new src_ParseError("Multiple \\tag");}return "\\gdef\\df@tag{\\text{#1}}";});// \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin
//   {\operator@font mod}\penalty900
//   \mkern5mu\nonscript\mskip-\medmuskip}
// \newcommand{\pod}[1]{\allowbreak
//   \if@display\mkern18mu\else\mkern8mu\fi(#1)}
// \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}}
// \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu
//   \else\mkern12mu\fi{\operator@font mod}\,\,#1}
// TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu
defineMacro("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"+"\\mathbin{\\rm mod}"+"\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");defineMacro("\\pod","\\allowbreak"+"\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");defineMacro("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");defineMacro("\\mod","\\allowbreak"+"\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}"+"{\\rm mod}\\,\\,#1");//////////////////////////////////////////////////////////////////////
// LaTeX source2e
// \expandafter\let\expandafter\@normalcr
//     \csname\expandafter\@gobble\string\\ \endcsname
// \DeclareRobustCommand\newline{\@normalcr\relax}
defineMacro("\\newline","\\\\\\relax");// \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@}
// TODO: Doesn't normally work in math mode because \@ fails.  KaTeX doesn't
// support \@ yet, so that's omitted, and we add \text so that the result
// doesn't look funny in math mode.
defineMacro("\\TeX","\\textrm{\\html@mathml{"+"T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX"+"}{TeX}}");// \DeclareRobustCommand{\LaTeX}{L\kern-.36em%
//         {\sbox\z@ T%
//          \vbox to\ht\z@{\hbox{\check@mathfonts
//                               \fontsize\sf@size\z@
//                               \math@fontsfalse\selectfont
//                               A}%
//                         \vss}%
//         }%
//         \kern-.15em%
//         \TeX}
// This code aligns the top of the A with the T (from the perspective of TeX's
// boxes, though visually the A appears to extend above slightly).
// We compute the corresponding \raisebox when A is rendered in \normalsize
// \scriptstyle, which has a scale factor of 0.7 (see Options.js).
const latexRaiseA=makeEm(fontMetricsData['Main-Regular']["T".charCodeAt(0)][1]-0.7*fontMetricsData['Main-Regular']["A".charCodeAt(0)][1]);defineMacro("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+latexRaiseA+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");// New KaTeX logo based on tweaking LaTeX logo
defineMacro("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+latexRaiseA+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");// \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace}
// \def\@hspace#1{\hskip  #1\relax}
// \def\@hspacer#1{\vrule \@width\z@\nobreak
//                 \hskip #1\hskip \z@skip}
defineMacro("\\hspace","\\@ifstar\\@hspacer\\@hspace");defineMacro("\\@hspace","\\hskip #1\\relax");defineMacro("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");//////////////////////////////////////////////////////////////////////
// mathtools.sty
//\providecommand\ordinarycolon{:}
defineMacro("\\ordinarycolon",":");//\def\vcentcolon{\mathrel{\mathop\ordinarycolon}}
//TODO(edemaine): Not yet centered. Fix via \raisebox or #726
defineMacro("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");// \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
defineMacro("\\dblcolon","\\html@mathml{"+"\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}"+"{\\mathop{\\char\"2237}}");// \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
defineMacro("\\coloneqq","\\html@mathml{"+"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}"+"{\\mathop{\\char\"2254}}");// ≔
// \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
defineMacro("\\Coloneqq","\\html@mathml{"+"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}"+"{\\mathop{\\char\"2237\\char\"3d}}");// \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
defineMacro("\\coloneq","\\html@mathml{"+"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}"+"{\\mathop{\\char\"3a\\char\"2212}}");// \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
defineMacro("\\Coloneq","\\html@mathml{"+"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}"+"{\\mathop{\\char\"2237\\char\"2212}}");// \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
defineMacro("\\eqqcolon","\\html@mathml{"+"\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}"+"{\\mathop{\\char\"2255}}");// ≕
// \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
defineMacro("\\Eqqcolon","\\html@mathml{"+"\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}"+"{\\mathop{\\char\"3d\\char\"2237}}");// \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
defineMacro("\\eqcolon","\\html@mathml{"+"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}"+"{\\mathop{\\char\"2239}}");// \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
defineMacro("\\Eqcolon","\\html@mathml{"+"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}"+"{\\mathop{\\char\"2212\\char\"2237}}");// \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
defineMacro("\\colonapprox","\\html@mathml{"+"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}"+"{\\mathop{\\char\"3a\\char\"2248}}");// \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
defineMacro("\\Colonapprox","\\html@mathml{"+"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}"+"{\\mathop{\\char\"2237\\char\"2248}}");// \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
defineMacro("\\colonsim","\\html@mathml{"+"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}"+"{\\mathop{\\char\"3a\\char\"223c}}");// \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
defineMacro("\\Colonsim","\\html@mathml{"+"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}"+"{\\mathop{\\char\"2237\\char\"223c}}");// Some Unicode characters are implemented with macros to mathtools functions.
defineMacro("\u2237","\\dblcolon");// ::
defineMacro("\u2239","\\eqcolon");// -:
defineMacro("\u2254","\\coloneqq");// :=
defineMacro("\u2255","\\eqqcolon");// =:
defineMacro("\u2A74","\\Coloneqq");// ::=
//////////////////////////////////////////////////////////////////////
// colonequals.sty
// Alternate names for mathtools's macros:
defineMacro("\\ratio","\\vcentcolon");defineMacro("\\coloncolon","\\dblcolon");defineMacro("\\colonequals","\\coloneqq");defineMacro("\\coloncolonequals","\\Coloneqq");defineMacro("\\equalscolon","\\eqqcolon");defineMacro("\\equalscoloncolon","\\Eqqcolon");defineMacro("\\colonminus","\\coloneq");defineMacro("\\coloncolonminus","\\Coloneq");defineMacro("\\minuscolon","\\eqcolon");defineMacro("\\minuscoloncolon","\\Eqcolon");// \colonapprox name is same in mathtools and colonequals.
defineMacro("\\coloncolonapprox","\\Colonapprox");// \colonsim name is same in mathtools and colonequals.
defineMacro("\\coloncolonsim","\\Colonsim");// Additional macros, implemented by analogy with mathtools definitions:
defineMacro("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");defineMacro("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");defineMacro("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");defineMacro("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");// Present in newtxmath, pxfonts and txfonts
defineMacro("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");defineMacro("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");defineMacro("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");//////////////////////////////////////////////////////////////////////
// From amsopn.sty
defineMacro("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");defineMacro("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");defineMacro("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");defineMacro("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");defineMacro("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");defineMacro("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");//////////////////////////////////////////////////////////////////////
// MathML alternates for KaTeX glyphs in the Unicode private area
defineMacro("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");defineMacro("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");defineMacro("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");defineMacro("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");defineMacro("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");defineMacro("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");defineMacro("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");defineMacro("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");defineMacro("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");defineMacro("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");defineMacro("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");defineMacro("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");defineMacro("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");defineMacro("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");defineMacro("\\imath","\\html@mathml{\\@imath}{\u0131}");defineMacro("\\jmath","\\html@mathml{\\@jmath}{\u0237}");//////////////////////////////////////////////////////////////////////
// stmaryrd and semantic
// The stmaryrd and semantic packages render the next four items by calling a
// glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros.
defineMacro("\\llbracket","\\html@mathml{"+"\\mathopen{[\\mkern-3.2mu[}}"+"{\\mathopen{\\char`\u27e6}}");defineMacro("\\rrbracket","\\html@mathml{"+"\\mathclose{]\\mkern-3.2mu]}}"+"{\\mathclose{\\char`\u27e7}}");defineMacro("\u27e6","\\llbracket");// blackboard bold [
defineMacro("\u27e7","\\rrbracket");// blackboard bold ]
defineMacro("\\lBrace","\\html@mathml{"+"\\mathopen{\\{\\mkern-3.2mu[}}"+"{\\mathopen{\\char`\u2983}}");defineMacro("\\rBrace","\\html@mathml{"+"\\mathclose{]\\mkern-3.2mu\\}}}"+"{\\mathclose{\\char`\u2984}}");defineMacro("\u2983","\\lBrace");// blackboard bold {
defineMacro("\u2984","\\rBrace");// blackboard bold }
// TODO: Create variable sized versions of the last two items. I believe that
// will require new font glyphs.
// The stmaryrd function `\minuso` provides a "Plimsoll" symbol that
// superimposes the characters \circ and \mathminus. Used in chemistry.
defineMacro("\\minuso","\\mathbin{\\html@mathml{"+"{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}"+"{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}"+"{\\char`⦵}}");defineMacro("⦵","\\minuso");//////////////////////////////////////////////////////////////////////
// texvc.sty
// The texvc package contains macros available in mediawiki pages.
// We omit the functions deprecated at
// https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax
// We also omit texvc's \O, which conflicts with \text{\O}
defineMacro("\\darr","\\downarrow");defineMacro("\\dArr","\\Downarrow");defineMacro("\\Darr","\\Downarrow");defineMacro("\\lang","\\langle");defineMacro("\\rang","\\rangle");defineMacro("\\uarr","\\uparrow");defineMacro("\\uArr","\\Uparrow");defineMacro("\\Uarr","\\Uparrow");defineMacro("\\N","\\mathbb{N}");defineMacro("\\R","\\mathbb{R}");defineMacro("\\Z","\\mathbb{Z}");defineMacro("\\alef","\\aleph");defineMacro("\\alefsym","\\aleph");defineMacro("\\Alpha","\\mathrm{A}");defineMacro("\\Beta","\\mathrm{B}");defineMacro("\\bull","\\bullet");defineMacro("\\Chi","\\mathrm{X}");defineMacro("\\clubs","\\clubsuit");defineMacro("\\cnums","\\mathbb{C}");defineMacro("\\Complex","\\mathbb{C}");defineMacro("\\Dagger","\\ddagger");defineMacro("\\diamonds","\\diamondsuit");defineMacro("\\empty","\\emptyset");defineMacro("\\Epsilon","\\mathrm{E}");defineMacro("\\Eta","\\mathrm{H}");defineMacro("\\exist","\\exists");defineMacro("\\harr","\\leftrightarrow");defineMacro("\\hArr","\\Leftrightarrow");defineMacro("\\Harr","\\Leftrightarrow");defineMacro("\\hearts","\\heartsuit");defineMacro("\\image","\\Im");defineMacro("\\infin","\\infty");defineMacro("\\Iota","\\mathrm{I}");defineMacro("\\isin","\\in");defineMacro("\\Kappa","\\mathrm{K}");defineMacro("\\larr","\\leftarrow");defineMacro("\\lArr","\\Leftarrow");defineMacro("\\Larr","\\Leftarrow");defineMacro("\\lrarr","\\leftrightarrow");defineMacro("\\lrArr","\\Leftrightarrow");defineMacro("\\Lrarr","\\Leftrightarrow");defineMacro("\\Mu","\\mathrm{M}");defineMacro("\\natnums","\\mathbb{N}");defineMacro("\\Nu","\\mathrm{N}");defineMacro("\\Omicron","\\mathrm{O}");defineMacro("\\plusmn","\\pm");defineMacro("\\rarr","\\rightarrow");defineMacro("\\rArr","\\Rightarrow");defineMacro("\\Rarr","\\Rightarrow");defineMacro("\\real","\\Re");defineMacro("\\reals","\\mathbb{R}");defineMacro("\\Reals","\\mathbb{R}");defineMacro("\\Rho","\\mathrm{P}");defineMacro("\\sdot","\\cdot");defineMacro("\\sect","\\S");defineMacro("\\spades","\\spadesuit");defineMacro("\\sub","\\subset");defineMacro("\\sube","\\subseteq");defineMacro("\\supe","\\supseteq");defineMacro("\\Tau","\\mathrm{T}");defineMacro("\\thetasym","\\vartheta");// TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}");
defineMacro("\\weierp","\\wp");defineMacro("\\Zeta","\\mathrm{Z}");//////////////////////////////////////////////////////////////////////
// statmath.sty
// https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf
defineMacro("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");defineMacro("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");defineMacro("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");//////////////////////////////////////////////////////////////////////
// braket.sty
// http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/braket/braket.pdf
defineMacro("\\bra","\\mathinner{\\langle{#1}|}");defineMacro("\\ket","\\mathinner{|{#1}\\rangle}");defineMacro("\\braket","\\mathinner{\\langle{#1}\\rangle}");defineMacro("\\Bra","\\left\\langle#1\\right|");defineMacro("\\Ket","\\left|#1\\right\\rangle");const braketHelper=one=>context=>{const left=context.consumeArg().tokens;const middle=context.consumeArg().tokens;const middleDouble=context.consumeArg().tokens;const right=context.consumeArg().tokens;const oldMiddle=context.macros.get("|");const oldMiddleDouble=context.macros.get("\\|");context.macros.beginGroup();const midMacro=double=>context=>{if(one){// Only modify the first instance of | or \|
context.macros.set("|",oldMiddle);if(middleDouble.length){context.macros.set("\\|",oldMiddleDouble);}}let doubled=double;if(!double&&middleDouble.length){// Mimic \@ifnextchar
const nextToken=context.future();if(nextToken.text==="|"){context.popToken();doubled=true;}}return {tokens:doubled?middleDouble:middle,numArgs:0};};context.macros.set("|",midMacro(false));if(middleDouble.length){context.macros.set("\\|",midMacro(true));}const arg=context.consumeArg().tokens;const expanded=context.expandTokens([...right,...arg,...left// reversed
]);context.macros.endGroup();return {tokens:expanded.reverse(),numArgs:0};};defineMacro("\\bra@ket",braketHelper(false));defineMacro("\\bra@set",braketHelper(true));defineMacro("\\Braket","\\bra@ket{\\left\\langle}"+"{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");defineMacro("\\Set","\\bra@set{\\left\\{\\:}"+"{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");defineMacro("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");// has no support for special || or \|
//////////////////////////////////////////////////////////////////////
// actuarialangle.dtx
defineMacro("\\angln","{\\angl n}");// Custom Khan Academy colors, should be moved to an optional package
defineMacro("\\blue","\\textcolor{##6495ed}{#1}");defineMacro("\\orange","\\textcolor{##ffa500}{#1}");defineMacro("\\pink","\\textcolor{##ff00af}{#1}");defineMacro("\\red","\\textcolor{##df0030}{#1}");defineMacro("\\green","\\textcolor{##28ae7b}{#1}");defineMacro("\\gray","\\textcolor{gray}{#1}");defineMacro("\\purple","\\textcolor{##9d38bd}{#1}");defineMacro("\\blueA","\\textcolor{##ccfaff}{#1}");defineMacro("\\blueB","\\textcolor{##80f6ff}{#1}");defineMacro("\\blueC","\\textcolor{##63d9ea}{#1}");defineMacro("\\blueD","\\textcolor{##11accd}{#1}");defineMacro("\\blueE","\\textcolor{##0c7f99}{#1}");defineMacro("\\tealA","\\textcolor{##94fff5}{#1}");defineMacro("\\tealB","\\textcolor{##26edd5}{#1}");defineMacro("\\tealC","\\textcolor{##01d1c1}{#1}");defineMacro("\\tealD","\\textcolor{##01a995}{#1}");defineMacro("\\tealE","\\textcolor{##208170}{#1}");defineMacro("\\greenA","\\textcolor{##b6ffb0}{#1}");defineMacro("\\greenB","\\textcolor{##8af281}{#1}");defineMacro("\\greenC","\\textcolor{##74cf70}{#1}");defineMacro("\\greenD","\\textcolor{##1fab54}{#1}");defineMacro("\\greenE","\\textcolor{##0d923f}{#1}");defineMacro("\\goldA","\\textcolor{##ffd0a9}{#1}");defineMacro("\\goldB","\\textcolor{##ffbb71}{#1}");defineMacro("\\goldC","\\textcolor{##ff9c39}{#1}");defineMacro("\\goldD","\\textcolor{##e07d10}{#1}");defineMacro("\\goldE","\\textcolor{##a75a05}{#1}");defineMacro("\\redA","\\textcolor{##fca9a9}{#1}");defineMacro("\\redB","\\textcolor{##ff8482}{#1}");defineMacro("\\redC","\\textcolor{##f9685d}{#1}");defineMacro("\\redD","\\textcolor{##e84d39}{#1}");defineMacro("\\redE","\\textcolor{##bc2612}{#1}");defineMacro("\\maroonA","\\textcolor{##ffbde0}{#1}");defineMacro("\\maroonB","\\textcolor{##ff92c6}{#1}");defineMacro("\\maroonC","\\textcolor{##ed5fa6}{#1}");defineMacro("\\maroonD","\\textcolor{##ca337c}{#1}");defineMacro("\\maroonE","\\textcolor{##9e034e}{#1}");defineMacro("\\purpleA","\\textcolor{##ddd7ff}{#1}");defineMacro("\\purpleB","\\textcolor{##c6b9fc}{#1}");defineMacro("\\purpleC","\\textcolor{##aa87ff}{#1}");defineMacro("\\purpleD","\\textcolor{##7854ab}{#1}");defineMacro("\\purpleE","\\textcolor{##543b78}{#1}");defineMacro("\\mintA","\\textcolor{##f5f9e8}{#1}");defineMacro("\\mintB","\\textcolor{##edf2df}{#1}");defineMacro("\\mintC","\\textcolor{##e0e5cc}{#1}");defineMacro("\\grayA","\\textcolor{##f6f7f7}{#1}");defineMacro("\\grayB","\\textcolor{##f0f1f2}{#1}");defineMacro("\\grayC","\\textcolor{##e3e5e6}{#1}");defineMacro("\\grayD","\\textcolor{##d6d8da}{#1}");defineMacro("\\grayE","\\textcolor{##babec2}{#1}");defineMacro("\\grayF","\\textcolor{##888d93}{#1}");defineMacro("\\grayG","\\textcolor{##626569}{#1}");defineMacro("\\grayH","\\textcolor{##3b3e40}{#1}");defineMacro("\\grayI","\\textcolor{##21242c}{#1}");defineMacro("\\kaBlue","\\textcolor{##314453}{#1}");defineMacro("\\kaGreen","\\textcolor{##71B307}{#1}");/**
 * This file contains the “gullet” where macros are expanded
 * until only non-macro tokens remain.
 */// List of commands that act like macros but aren't defined as a macro,
// function, or symbol.  Used in `isDefined`.
const implicitCommands={"^":true,// Parser.js
"_":true,// Parser.js
"\\limits":true,// Parser.js
"\\nolimits":true// Parser.js
};class MacroExpander{constructor(input,settings,mode){this.settings=void 0;this.expansionCount=void 0;this.lexer=void 0;this.macros=void 0;this.stack=void 0;this.mode=void 0;this.settings=settings;this.expansionCount=0;this.feed(input);// Make new global namespace
this.macros=new Namespace(src_macros,settings.macros);this.mode=mode;this.stack=[];// contains tokens in REVERSE order
}/**
   * Feed a new input string to the same MacroExpander
   * (with existing macros etc.).
   */feed(input){this.lexer=new Lexer(input,this.settings);}/**
   * Switches between "text" and "math" modes.
   */switchMode(newMode){this.mode=newMode;}/**
   * Start a new group nesting within all namespaces.
   */beginGroup(){this.macros.beginGroup();}/**
   * End current group nesting within all namespaces.
   */endGroup(){this.macros.endGroup();}/**
   * Ends all currently nested groups (if any), restoring values before the
   * groups began.  Useful in case of an error in the middle of parsing.
   */endGroups(){this.macros.endGroups();}/**
   * Returns the topmost token on the stack, without expanding it.
   * Similar in behavior to TeX's `\futurelet`.
   */future(){if(this.stack.length===0){this.pushToken(this.lexer.lex());}return this.stack[this.stack.length-1];}/**
   * Remove and return the next unexpanded token.
   */popToken(){this.future();// ensure non-empty stack
return this.stack.pop();}/**
   * Add a given token to the token stack.  In particular, this get be used
   * to put back a token returned from one of the other methods.
   */pushToken(token){this.stack.push(token);}/**
   * Append an array of tokens to the token stack.
   */pushTokens(tokens){this.stack.push(...tokens);}/**
   * Find an macro argument without expanding tokens and append the array of
   * tokens to the token stack. Uses Token as a container for the result.
   */scanArgument(isOptional){let start;let end;let tokens;if(isOptional){this.consumeSpaces();// \@ifnextchar gobbles any space following it
if(this.future().text!=="["){return null;}start=this.popToken();// don't include [ in tokens
({tokens,end}=this.consumeArg(["]"]));}else {({tokens,start,end}=this.consumeArg());}// indicate the end of an argument
this.pushToken(new Token("EOF",end.loc));this.pushTokens(tokens);return start.range(end,"");}/**
   * Consume all following space tokens, without expansion.
   */consumeSpaces(){for(;;){const token=this.future();if(token.text===" "){this.stack.pop();}else {break;}}}/**
   * Consume an argument from the token stream, and return the resulting array
   * of tokens and start/end token.
   */consumeArg(delims){// The argument for a delimited parameter is the shortest (possibly
// empty) sequence of tokens with properly nested {...} groups that is
// followed ... by this particular list of non-parameter tokens.
// The argument for an undelimited parameter is the next nonblank
// token, unless that token is ‘{’, when the argument will be the
// entire {...} group that follows.
const tokens=[];const isDelimited=delims&&delims.length>0;if(!isDelimited){// Ignore spaces between arguments.  As the TeXbook says:
// "After you have said ‘\def\row#1#2{...}’, you are allowed to
//  put spaces between the arguments (e.g., ‘\row x n’), because
//  TeX doesn’t use single spaces as undelimited arguments."
this.consumeSpaces();}const start=this.future();let tok;let depth=0;let match=0;do{tok=this.popToken();tokens.push(tok);if(tok.text==="{"){++depth;}else if(tok.text==="}"){--depth;if(depth===-1){throw new src_ParseError("Extra }",tok);}}else if(tok.text==="EOF"){throw new src_ParseError("Unexpected end of input in a macro argument"+", expected '"+(delims&&isDelimited?delims[match]:"}")+"'",tok);}if(delims&&isDelimited){if((depth===0||depth===1&&delims[match]==="{")&&tok.text===delims[match]){++match;if(match===delims.length){// don't include delims in tokens
tokens.splice(-match,match);break;}}else {match=0;}}}while(depth!==0||isDelimited);// If the argument found ... has the form ‘{<nested tokens>}’,
// ... the outermost braces enclosing the argument are removed
if(start.text==="{"&&tokens[tokens.length-1].text==="}"){tokens.pop();tokens.shift();}tokens.reverse();// to fit in with stack order
return {tokens,start,end:tok};}/**
   * Consume the specified number of (delimited) arguments from the token
   * stream and return the resulting array of arguments.
   */consumeArgs(numArgs,delimiters){if(delimiters){if(delimiters.length!==numArgs+1){throw new src_ParseError("The length of delimiters doesn't match the number of args!");}const delims=delimiters[0];for(let i=0;i<delims.length;i++){const tok=this.popToken();if(delims[i]!==tok.text){throw new src_ParseError("Use of the macro doesn't match its definition",tok);}}}const args=[];for(let i=0;i<numArgs;i++){args.push(this.consumeArg(delimiters&&delimiters[i+1]).tokens);}return args;}/**
   * Increment `expansionCount` by the specified amount.
   * Throw an error if it exceeds `maxExpand`.
   */countExpansion(amount){this.expansionCount+=amount;if(this.expansionCount>this.settings.maxExpand){throw new src_ParseError("Too many expansions: infinite loop or "+"need to increase maxExpand setting");}}/**
   * Expand the next token only once if possible.
   *
   * If the token is expanded, the resulting tokens will be pushed onto
   * the stack in reverse order, and the number of such tokens will be
   * returned.  This number might be zero or positive.
   *
   * If not, the return value is `false`, and the next token remains at the
   * top of the stack.
   *
   * In either case, the next token will be on the top of the stack,
   * or the stack will be empty (in case of empty expansion
   * and no other tokens).
   *
   * Used to implement `expandAfterFuture` and `expandNextToken`.
   *
   * If expandableOnly, only expandable tokens are expanded and
   * an undefined control sequence results in an error.
   */expandOnce(expandableOnly){const topToken=this.popToken();const name=topToken.text;const expansion=!topToken.noexpand?this._getExpansion(name):null;if(expansion==null||expandableOnly&&expansion.unexpandable){if(expandableOnly&&expansion==null&&name[0]==="\\"&&!this.isDefined(name)){throw new src_ParseError("Undefined control sequence: "+name);}this.pushToken(topToken);return false;}this.countExpansion(1);let tokens=expansion.tokens;const args=this.consumeArgs(expansion.numArgs,expansion.delimiters);if(expansion.numArgs){// paste arguments in place of the placeholders
tokens=tokens.slice();// make a shallow copy
for(let i=tokens.length-1;i>=0;--i){let tok=tokens[i];if(tok.text==="#"){if(i===0){throw new src_ParseError("Incomplete placeholder at end of macro body",tok);}tok=tokens[--i];// next token on stack
if(tok.text==="#"){// ## → #
tokens.splice(i+1,1);// drop first #
}else if(/^[1-9]$/.test(tok.text)){// replace the placeholder with the indicated argument
tokens.splice(i,2,...args[+tok.text-1]);}else {throw new src_ParseError("Not a valid argument number",tok);}}}}// Concatenate expansion onto top of stack.
this.pushTokens(tokens);return tokens.length;}/**
   * Expand the next token only once (if possible), and return the resulting
   * top token on the stack (without removing anything from the stack).
   * Similar in behavior to TeX's `\expandafter\futurelet`.
   * Equivalent to expandOnce() followed by future().
   */expandAfterFuture(){this.expandOnce();return this.future();}/**
   * Recursively expand first token, then return first non-expandable token.
   */expandNextToken(){for(;;){if(this.expandOnce()===false){// fully expanded
const token=this.stack.pop();// the token after \noexpand is interpreted as if its meaning
// were ‘\relax’
if(token.treatAsRelax){token.text="\\relax";}return token;}}// Flow unable to figure out that this pathway is impossible.
// https://github.com/facebook/flow/issues/4808
throw new Error();// eslint-disable-line no-unreachable
}/**
   * Fully expand the given macro name and return the resulting list of
   * tokens, or return `undefined` if no such macro is defined.
   */expandMacro(name){return this.macros.has(name)?this.expandTokens([new Token(name)]):undefined;}/**
   * Fully expand the given token stream and return the resulting list of
   * tokens.  Note that the input tokens are in reverse order, but the
   * output tokens are in forward order.
   */expandTokens(tokens){const output=[];const oldStackLength=this.stack.length;this.pushTokens(tokens);while(this.stack.length>oldStackLength){// Expand only expandable tokens
if(this.expandOnce(true)===false){// fully expanded
const token=this.stack.pop();if(token.treatAsRelax){// the expansion of \noexpand is the token itself
token.noexpand=false;token.treatAsRelax=false;}output.push(token);}}// Count all of these tokens as additional expansions, to prevent
// exponential blowup from linearly many \edef's.
this.countExpansion(output.length);return output;}/**
   * Fully expand the given macro name and return the result as a string,
   * or return `undefined` if no such macro is defined.
   */expandMacroAsText(name){const tokens=this.expandMacro(name);if(tokens){return tokens.map(token=>token.text).join("");}else {return tokens;}}/**
   * Returns the expanded macro as a reversed array of tokens and a macro
   * argument count.  Or returns `null` if no such macro.
   */_getExpansion(name){const definition=this.macros.get(name);if(definition==null){// mainly checking for undefined here
return definition;}// If a single character has an associated catcode other than 13
// (active character), then don't expand it.
if(name.length===1){const catcode=this.lexer.catcodes[name];if(catcode!=null&&catcode!==13){return;}}const expansion=typeof definition==="function"?definition(this):definition;if(typeof expansion==="string"){let numArgs=0;if(expansion.indexOf("#")!==-1){const stripped=expansion.replace(/##/g,"");while(stripped.indexOf("#"+(numArgs+1))!==-1){++numArgs;}}const bodyLexer=new Lexer(expansion,this.settings);const tokens=[];let tok=bodyLexer.lex();while(tok.text!=="EOF"){tokens.push(tok);tok=bodyLexer.lex();}tokens.reverse();// to fit in with stack using push and pop
const expanded={tokens,numArgs};return expanded;}return expansion;}/**
   * Determine whether a command is currently "defined" (has some
   * functionality), meaning that it's a macro (in the current group),
   * a function, a symbol, or one of the special commands listed in
   * `implicitCommands`.
   */isDefined(name){return this.macros.has(name)||src_functions.hasOwnProperty(name)||src_symbols.math.hasOwnProperty(name)||src_symbols.text.hasOwnProperty(name)||implicitCommands.hasOwnProperty(name);}/**
   * Determine whether a command is expandable.
   */isExpandable(name){const macro=this.macros.get(name);return macro!=null?typeof macro==="string"||typeof macro==="function"||!macro.unexpandable:src_functions.hasOwnProperty(name)&&!src_functions[name].primitive;}}// Helpers for Parser.js handling of Unicode (sub|super)script characters.
const unicodeSubRegEx=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/;const uSubsAndSups=Object.freeze({'₊':'+','₋':'-','₌':'=','₍':'(','₎':')','₀':'0','₁':'1','₂':'2','₃':'3','₄':'4','₅':'5','₆':'6','₇':'7','₈':'8','₉':'9','\u2090':'a','\u2091':'e','\u2095':'h','\u1D62':'i','\u2C7C':'j','\u2096':'k','\u2097':'l','\u2098':'m','\u2099':'n','\u2092':'o','\u209A':'p','\u1D63':'r','\u209B':'s','\u209C':'t','\u1D64':'u','\u1D65':'v','\u2093':'x','\u1D66':'β','\u1D67':'γ','\u1D68':'ρ','\u1D69':'\u03d5','\u1D6A':'χ','⁺':'+','⁻':'-','⁼':'=','⁽':'(','⁾':')','⁰':'0','¹':'1','²':'2','³':'3','⁴':'4','⁵':'5','⁶':'6','⁷':'7','⁸':'8','⁹':'9','\u1D2C':'A','\u1D2E':'B','\u1D30':'D','\u1D31':'E','\u1D33':'G','\u1D34':'H','\u1D35':'I','\u1D36':'J','\u1D37':'K','\u1D38':'L','\u1D39':'M','\u1D3A':'N','\u1D3C':'O','\u1D3E':'P','\u1D3F':'R','\u1D40':'T','\u1D41':'U','\u2C7D':'V','\u1D42':'W','\u1D43':'a','\u1D47':'b','\u1D9C':'c','\u1D48':'d','\u1D49':'e','\u1DA0':'f','\u1D4D':'g','\u02B0':'h','\u2071':'i','\u02B2':'j','\u1D4F':'k','\u02E1':'l','\u1D50':'m','\u207F':'n','\u1D52':'o','\u1D56':'p','\u02B3':'r','\u02E2':'s','\u1D57':'t','\u1D58':'u','\u1D5B':'v','\u02B7':'w','\u02E3':'x','\u02B8':'y','\u1DBB':'z','\u1D5D':'β','\u1D5E':'γ','\u1D5F':'δ','\u1D60':'\u03d5','\u1D61':'χ','\u1DBF':'θ'});/* eslint no-constant-condition:0 */// Pre-evaluate both modules as unicodeSymbols require String.normalize()
const unicodeAccents={"́":{"text":"\\'","math":"\\acute"},"̀":{"text":"\\`","math":"\\grave"},"̈":{"text":"\\\"","math":"\\ddot"},"̃":{"text":"\\~","math":"\\tilde"},"̄":{"text":"\\=","math":"\\bar"},"̆":{"text":"\\u","math":"\\breve"},"̌":{"text":"\\v","math":"\\check"},"̂":{"text":"\\^","math":"\\hat"},"̇":{"text":"\\.","math":"\\dot"},"̊":{"text":"\\r","math":"\\mathring"},"̋":{"text":"\\H"},"̧":{"text":"\\c"}};const unicodeSymbols={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","ḉ":"ḉ","č":"č","ĉ":"ĉ","ċ":"ċ","ç":"ç","ď":"ď","ḋ":"ḋ","ḑ":"ḑ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ḝ":"ḝ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ȩ":"ȩ","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ģ":"ģ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","ḩ":"ḩ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ķ":"ķ","ĺ":"ĺ","ľ":"ľ","ļ":"ļ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ņ":"ņ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ŗ":"ŗ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ş":"ş","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ţ":"ţ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Ḉ":"Ḉ","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ç":"Ç","Ď":"Ď","Ḋ":"Ḋ","Ḑ":"Ḑ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ḝ":"Ḝ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ȩ":"Ȩ","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ģ":"Ģ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Ḩ":"Ḩ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ķ":"Ķ","Ĺ":"Ĺ","Ľ":"Ľ","Ļ":"Ļ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ņ":"Ņ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ŗ":"Ŗ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ş":"Ş","Ť":"Ť","Ṫ":"Ṫ","Ţ":"Ţ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};/**
 * This file contains the parser used to parse out a TeX expression from the
 * input. Since TeX isn't context-free, standard parsers don't work particularly
 * well.
 *
 * The strategy of this parser is as such:
 *
 * The main functions (the `.parse...` ones) take a position in the current
 * parse string to parse tokens from. The lexer (found in Lexer.js, stored at
 * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When
 * individual tokens are needed at a position, the lexer is called to pull out a
 * token, which is then used.
 *
 * The parser has a property called "mode" indicating the mode that
 * the parser is currently in. Currently it has to be one of "math" or
 * "text", which denotes whether the current environment is a math-y
 * one or a text-y one (e.g. inside \text). Currently, this serves to
 * limit the functions which can be used in text mode.
 *
 * The main functions then return an object which contains the useful data that
 * was parsed at its given point, and a new position at the end of the parsed
 * data. The main functions can call each other and continue the parsing by
 * using the returned position as a new starting point.
 *
 * There are also extra `.handle...` functions, which pull out some reused
 * functionality into self-contained functions.
 *
 * The functions return ParseNodes.
 */class Parser{constructor(input,settings){this.mode=void 0;this.gullet=void 0;this.settings=void 0;this.leftrightDepth=void 0;this.nextToken=void 0;// Start in math mode
this.mode="math";// Create a new macro expander (gullet) and (indirectly via that) also a
// new lexer (mouth) for this parser (stomach, in the language of TeX)
this.gullet=new MacroExpander(input,settings,this.mode);// Store the settings for use in parsing
this.settings=settings;// Count leftright depth (for \middle errors)
this.leftrightDepth=0;}/**
   * Checks a result to make sure it has the right type, and throws an
   * appropriate error otherwise.
   */expect(text,consume){if(consume===void 0){consume=true;}if(this.fetch().text!==text){throw new src_ParseError("Expected '"+text+"', got '"+this.fetch().text+"'",this.fetch());}if(consume){this.consume();}}/**
   * Discards the current lookahead token, considering it consumed.
   */consume(){this.nextToken=null;}/**
   * Return the current lookahead token, or if there isn't one (at the
   * beginning, or if the previous lookahead token was consume()d),
   * fetch the next token as the new lookahead token and return it.
   */fetch(){if(this.nextToken==null){this.nextToken=this.gullet.expandNextToken();}return this.nextToken;}/**
   * Switches between "text" and "math" modes.
   */switchMode(newMode){this.mode=newMode;this.gullet.switchMode(newMode);}/**
   * Main parsing function, which parses an entire input.
   */parse(){if(!this.settings.globalGroup){// Create a group namespace for the math expression.
// (LaTeX creates a new group for every $...$, $$...$$, \[...\].)
this.gullet.beginGroup();}// Use old \color behavior (same as LaTeX's \textcolor) if requested.
// We do this within the group for the math expression, so it doesn't
// pollute settings.macros.
if(this.settings.colorIsTextColor){this.gullet.macros.set("\\color","\\textcolor");}try{// Try to parse the input
const parse=this.parseExpression(false);// If we succeeded, make sure there's an EOF at the end
this.expect("EOF");// End the group namespace for the expression
if(!this.settings.globalGroup){this.gullet.endGroup();}return parse;// Close any leftover groups in case of a parse error.
}finally{this.gullet.endGroups();}}/**
   * Fully parse a separate sequence of tokens as a separate job.
   * Tokens should be specified in reverse order, as in a MacroDefinition.
   */subparse(tokens){// Save the next token from the current job.
const oldToken=this.nextToken;this.consume();// Run the new job, terminating it with an excess '}'
this.gullet.pushToken(new Token("}"));this.gullet.pushTokens(tokens);const parse=this.parseExpression(false);this.expect("}");// Restore the next token from the current job.
this.nextToken=oldToken;return parse;}/**
   * Parses an "expression", which is a list of atoms.
   *
   * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
   *                 happens when functions have higher precedence han infix
   *                 nodes in implicit parses.
   *
   * `breakOnTokenText`: The text of the token that the expression should end
   *                     with, or `null` if something else should end the
   *                     expression.
   */parseExpression(breakOnInfix,breakOnTokenText){const body=[];// Keep adding atoms to the body until we can't parse any more atoms (either
// we reached the end, a }, or a \right)
while(true){// Ignore spaces in math mode
if(this.mode==="math"){this.consumeSpaces();}const lex=this.fetch();if(Parser.endOfExpression.indexOf(lex.text)!==-1){break;}if(breakOnTokenText&&lex.text===breakOnTokenText){break;}if(breakOnInfix&&src_functions[lex.text]&&src_functions[lex.text].infix){break;}const atom=this.parseAtom(breakOnTokenText);if(!atom){break;}else if(atom.type==="internal"){// Internal nodes do not appear in parse tree
continue;}body.push(atom);}if(this.mode==="text"){this.formLigatures(body);}return this.handleInfixNodes(body);}/**
   * Rewrites infix operators such as \over with corresponding commands such
   * as \frac.
   *
   * There can only be one infix operator per group.  If there's more than one
   * then the expression is ambiguous.  This can be resolved by adding {}.
   */handleInfixNodes(body){let overIndex=-1;let funcName;for(let i=0;i<body.length;i++){if(body[i].type==="infix"){if(overIndex!==-1){throw new src_ParseError("only one infix operator per group",body[i].token);}overIndex=i;funcName=body[i].replaceWith;}}if(overIndex!==-1&&funcName){let numerNode;let denomNode;const numerBody=body.slice(0,overIndex);const denomBody=body.slice(overIndex+1);if(numerBody.length===1&&numerBody[0].type==="ordgroup"){numerNode=numerBody[0];}else {numerNode={type:"ordgroup",mode:this.mode,body:numerBody};}if(denomBody.length===1&&denomBody[0].type==="ordgroup"){denomNode=denomBody[0];}else {denomNode={type:"ordgroup",mode:this.mode,body:denomBody};}let node;if(funcName==="\\\\abovefrac"){node=this.callFunction(funcName,[numerNode,body[overIndex],denomNode],[]);}else {node=this.callFunction(funcName,[numerNode,denomNode],[]);}return [node];}else {return body;}}/**
   * Handle a subscript or superscript with nice errors.
   */handleSupSubscript(name// For error reporting.
){const symbolToken=this.fetch();const symbol=symbolToken.text;this.consume();this.consumeSpaces();// ignore spaces before sup/subscript argument
// Skip over allowed internal nodes such as \relax
let group;do{var _group;group=this.parseGroup(name);}while(((_group=group)==null?void 0:_group.type)==="internal");if(!group){throw new src_ParseError("Expected group after '"+symbol+"'",symbolToken);}return group;}/**
   * Converts the textual input of an unsupported command into a text node
   * contained within a color node whose color is determined by errorColor
   */formatUnsupportedCmd(text){const textordArray=[];for(let i=0;i<text.length;i++){textordArray.push({type:"textord",mode:"text",text:text[i]});}const textNode={type:"text",mode:this.mode,body:textordArray};const colorNode={type:"color",mode:this.mode,color:this.settings.errorColor,body:[textNode]};return colorNode;}/**
   * Parses a group with optional super/subscripts.
   */parseAtom(breakOnTokenText){// The body of an atom is an implicit group, so that things like
// \left(x\right)^2 work correctly.
const base=this.parseGroup("atom",breakOnTokenText);// Internal nodes (e.g. \relax) cannot support super/subscripts.
// Instead we will pick up super/subscripts with blank base next round.
if((base==null?void 0:base.type)==="internal"){return base;}// In text mode, we don't have superscripts or subscripts
if(this.mode==="text"){return base;}// Note that base may be empty (i.e. null) at this point.
let superscript;let subscript;while(true){// Guaranteed in math mode, so eat any spaces first.
this.consumeSpaces();// Lex the first token
const lex=this.fetch();if(lex.text==="\\limits"||lex.text==="\\nolimits"){// We got a limit control
if(base&&base.type==="op"){const limits=lex.text==="\\limits";base.limits=limits;base.alwaysHandleSupSub=true;}else if(base&&base.type==="operatorname"){if(base.alwaysHandleSupSub){base.limits=lex.text==="\\limits";}}else {throw new src_ParseError("Limit controls must follow a math operator",lex);}this.consume();}else if(lex.text==="^"){// We got a superscript start
if(superscript){throw new src_ParseError("Double superscript",lex);}superscript=this.handleSupSubscript("superscript");}else if(lex.text==="_"){// We got a subscript start
if(subscript){throw new src_ParseError("Double subscript",lex);}subscript=this.handleSupSubscript("subscript");}else if(lex.text==="'"){// We got a prime
if(superscript){throw new src_ParseError("Double superscript",lex);}const prime={type:"textord",mode:this.mode,text:"\\prime"};// Many primes can be grouped together, so we handle this here
const primes=[prime];this.consume();// Keep lexing tokens until we get something that's not a prime
while(this.fetch().text==="'"){// For each one, add another prime to the list
primes.push(prime);this.consume();}// If there's a superscript following the primes, combine that
// superscript in with the primes.
if(this.fetch().text==="^"){primes.push(this.handleSupSubscript("superscript"));}// Put everything into an ordgroup as the superscript
superscript={type:"ordgroup",mode:this.mode,body:primes};}else if(uSubsAndSups[lex.text]){// A Unicode subscript or superscript character.
// We treat these similarly to the unicode-math package.
// So we render a string of Unicode (sub|super)scripts the
// same as a (sub|super)script of regular characters.
const isSub=unicodeSubRegEx.test(lex.text);const subsupTokens=[];subsupTokens.push(new Token(uSubsAndSups[lex.text]));this.consume();// Continue fetching tokens to fill out the string.
while(true){const token=this.fetch().text;if(!uSubsAndSups[token]){break;}if(unicodeSubRegEx.test(token)!==isSub){break;}subsupTokens.unshift(new Token(uSubsAndSups[token]));this.consume();}// Now create a (sub|super)script.
const body=this.subparse(subsupTokens);if(isSub){subscript={type:"ordgroup",mode:"math",body};}else {superscript={type:"ordgroup",mode:"math",body};}}else {// If it wasn't ^, _, or ', stop parsing super/subscripts
break;}}// Base must be set if superscript or subscript are set per logic above,
// but need to check here for type check to pass.
if(superscript||subscript){// If we got either a superscript or subscript, create a supsub
return {type:"supsub",mode:this.mode,base:base,sup:superscript,sub:subscript};}else {// Otherwise return the original body
return base;}}/**
   * Parses an entire function, including its base and all of its arguments.
   */parseFunction(breakOnTokenText,name// For determining its context
){const token=this.fetch();const func=token.text;const funcData=src_functions[func];if(!funcData){return null;}this.consume();// consume command token
if(name&&name!=="atom"&&!funcData.allowedInArgument){throw new src_ParseError("Got function '"+func+"' with no arguments"+(name?" as "+name:""),token);}else if(this.mode==="text"&&!funcData.allowedInText){throw new src_ParseError("Can't use function '"+func+"' in text mode",token);}else if(this.mode==="math"&&funcData.allowedInMath===false){throw new src_ParseError("Can't use function '"+func+"' in math mode",token);}const{args,optArgs}=this.parseArguments(func,funcData);return this.callFunction(func,args,optArgs,token,breakOnTokenText);}/**
   * Call a function handler with a suitable context and arguments.
   */callFunction(name,args,optArgs,token,breakOnTokenText){const context={funcName:name,parser:this,token,breakOnTokenText};const func=src_functions[name];if(func&&func.handler){return func.handler(context,args,optArgs);}else {throw new src_ParseError("No function handler for "+name);}}/**
   * Parses the arguments of a function or environment
   */parseArguments(func,// Should look like "\name" or "\begin{name}".
funcData){const totalArgs=funcData.numArgs+funcData.numOptionalArgs;if(totalArgs===0){return {args:[],optArgs:[]};}const args=[];const optArgs=[];for(let i=0;i<totalArgs;i++){let argType=funcData.argTypes&&funcData.argTypes[i];const isOptional=i<funcData.numOptionalArgs;if(funcData.primitive&&argType==null||// \sqrt expands into primitive if optional argument doesn't exist
funcData.type==="sqrt"&&i===1&&optArgs[0]==null){argType="primitive";}const arg=this.parseGroupOfType("argument to '"+func+"'",argType,isOptional);if(isOptional){optArgs.push(arg);}else if(arg!=null){args.push(arg);}else {// should be unreachable
throw new src_ParseError("Null argument, please report this as a bug");}}return {args,optArgs};}/**
   * Parses a group when the mode is changing.
   */parseGroupOfType(name,type,optional){switch(type){case"color":return this.parseColorGroup(optional);case"size":return this.parseSizeGroup(optional);case"url":return this.parseUrlGroup(optional);case"math":case"text":return this.parseArgumentGroup(optional,type);case"hbox":{// hbox argument type wraps the argument in the equivalent of
// \hbox, which is like \text but switching to \textstyle size.
const group=this.parseArgumentGroup(optional,"text");return group!=null?{type:"styling",mode:group.mode,body:[group],style:"text"// simulate \textstyle
}:null;}case"raw":{const token=this.parseStringGroup("raw",optional);return token!=null?{type:"raw",mode:"text",string:token.text}:null;}case"primitive":{if(optional){throw new src_ParseError("A primitive argument cannot be optional");}const group=this.parseGroup(name);if(group==null){throw new src_ParseError("Expected group as "+name,this.fetch());}return group;}case"original":case null:case undefined:return this.parseArgumentGroup(optional);default:throw new src_ParseError("Unknown group type as "+name,this.fetch());}}/**
   * Discard any space tokens, fetching the next non-space token.
   */consumeSpaces(){while(this.fetch().text===" "){this.consume();}}/**
   * Parses a group, essentially returning the string formed by the
   * brace-enclosed tokens plus some position information.
   */parseStringGroup(modeName,// Used to describe the mode in error messages.
optional){const argToken=this.gullet.scanArgument(optional);if(argToken==null){return null;}let str="";let nextToken;while((nextToken=this.fetch()).text!=="EOF"){str+=nextToken.text;this.consume();}this.consume();// consume the end of the argument
argToken.text=str;return argToken;}/**
   * Parses a regex-delimited group: the largest sequence of tokens
   * whose concatenated strings match `regex`. Returns the string
   * formed by the tokens plus some position information.
   */parseRegexGroup(regex,modeName// Used to describe the mode in error messages.
){const firstToken=this.fetch();let lastToken=firstToken;let str="";let nextToken;while((nextToken=this.fetch()).text!=="EOF"&&regex.test(str+nextToken.text)){lastToken=nextToken;str+=lastToken.text;this.consume();}if(str===""){throw new src_ParseError("Invalid "+modeName+": '"+firstToken.text+"'",firstToken);}return firstToken.range(lastToken,str);}/**
   * Parses a color description.
   */parseColorGroup(optional){const res=this.parseStringGroup("color",optional);if(res==null){return null;}const match=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);if(!match){throw new src_ParseError("Invalid color: '"+res.text+"'",res);}let color=match[0];if(/^[0-9a-f]{6}$/i.test(color)){// We allow a 6-digit HTML color spec without a leading "#".
// This follows the xcolor package's HTML color model.
// Predefined color names are all missed by this RegEx pattern.
color="#"+color;}return {type:"color-token",mode:this.mode,color};}/**
   * Parses a size specification, consisting of magnitude and unit.
   */parseSizeGroup(optional){let res;let isBlank=false;// don't expand before parseStringGroup
this.gullet.consumeSpaces();if(!optional&&this.gullet.future().text!=="{"){res=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size");}else {res=this.parseStringGroup("size",optional);}if(!res){return null;}if(!optional&&res.text.length===0){// Because we've tested for what is !optional, this block won't
// affect \kern, \hspace, etc. It will capture the mandatory arguments
// to \genfrac and \above.
res.text="0pt";// Enable \above{}
isBlank=true;// This is here specifically for \genfrac
}const match=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text);if(!match){throw new src_ParseError("Invalid size: '"+res.text+"'",res);}const data={number:+(match[1]+match[2]),// sign + magnitude, cast to number
unit:match[3]};if(!validUnit(data)){throw new src_ParseError("Invalid unit: '"+data.unit+"'",res);}return {type:"size",mode:this.mode,value:data,isBlank};}/**
   * Parses an URL, checking escaped letters and allowed protocols,
   * and setting the catcode of % as an active character (as in \hyperref).
   */parseUrlGroup(optional){this.gullet.lexer.setCatcode("%",13);// active character
this.gullet.lexer.setCatcode("~",12);// other character
const res=this.parseStringGroup("url",optional);this.gullet.lexer.setCatcode("%",14);// comment character
this.gullet.lexer.setCatcode("~",13);// active character
if(res==null){return null;}// hyperref package allows backslashes alone in href, but doesn't
// generate valid links in such cases; we interpret this as
// "undefined" behaviour, and keep them as-is. Some browser will
// replace backslashes with forward slashes.
const url=res.text.replace(/\\([#$%&~_^{}])/g,'$1');return {type:"url",mode:this.mode,url};}/**
   * Parses an argument with the mode specified.
   */parseArgumentGroup(optional,mode){const argToken=this.gullet.scanArgument(optional);if(argToken==null){return null;}const outerMode=this.mode;if(mode){// Switch to specified mode
this.switchMode(mode);}this.gullet.beginGroup();const expression=this.parseExpression(false,"EOF");// TODO: find an alternative way to denote the end
this.expect("EOF");// expect the end of the argument
this.gullet.endGroup();const result={type:"ordgroup",mode:this.mode,loc:argToken.loc,body:expression};if(mode){// Switch mode back
this.switchMode(outerMode);}return result;}/**
   * Parses an ordinary group, which is either a single nucleus (like "x")
   * or an expression in braces (like "{x+y}") or an implicit group, a group
   * that starts at the current position, and ends right before a higher explicit
   * group ends, or at EOF.
   */parseGroup(name,// For error reporting.
breakOnTokenText){const firstToken=this.fetch();const text=firstToken.text;let result;// Try to parse an open brace or \begingroup
if(text==="{"||text==="\\begingroup"){this.consume();const groupEnd=text==="{"?"}":"\\endgroup";this.gullet.beginGroup();// If we get a brace, parse an expression
const expression=this.parseExpression(false,groupEnd);const lastToken=this.fetch();this.expect(groupEnd);// Check that we got a matching closing brace
this.gullet.endGroup();result={type:"ordgroup",mode:this.mode,loc:SourceLocation.range(firstToken,lastToken),body:expression,// A group formed by \begingroup...\endgroup is a semi-simple group
// which doesn't affect spacing in math mode, i.e., is transparent.
// https://tex.stackexchange.com/questions/1930/when-should-one-
// use-begingroup-instead-of-bgroup
semisimple:text==="\\begingroup"||undefined};}else {// If there exists a function with this name, parse the function.
// Otherwise, just return a nucleus
result=this.parseFunction(breakOnTokenText,name)||this.parseSymbol();if(result==null&&text[0]==="\\"&&!implicitCommands.hasOwnProperty(text)){if(this.settings.throwOnError){throw new src_ParseError("Undefined control sequence: "+text,firstToken);}result=this.formatUnsupportedCmd(text);this.consume();}}return result;}/**
   * Form ligature-like combinations of characters for text mode.
   * This includes inputs like "--", "---", "``" and "''".
   * The result will simply replace multiple textord nodes with a single
   * character in each value by a single textord node having multiple
   * characters in its value.  The representation is still ASCII source.
   * The group will be modified in place.
   */formLigatures(group){let n=group.length-1;for(let i=0;i<n;++i){const a=group[i];// $FlowFixMe: Not every node type has a `text` property.
const v=a.text;if(v==="-"&&group[i+1].text==="-"){if(i+1<n&&group[i+2].text==="-"){group.splice(i,3,{type:"textord",mode:"text",loc:SourceLocation.range(a,group[i+2]),text:"---"});n-=2;}else {group.splice(i,2,{type:"textord",mode:"text",loc:SourceLocation.range(a,group[i+1]),text:"--"});n-=1;}}if((v==="'"||v==="`")&&group[i+1].text===v){group.splice(i,2,{type:"textord",mode:"text",loc:SourceLocation.range(a,group[i+1]),text:v+v});n-=1;}}}/**
   * Parse a single symbol out of the string. Here, we handle single character
   * symbols and special functions like \verb.
   */parseSymbol(){const nucleus=this.fetch();let text=nucleus.text;if(/^\\verb[^a-zA-Z]/.test(text)){this.consume();let arg=text.slice(5);const star=arg.charAt(0)==="*";if(star){arg=arg.slice(1);}// Lexer's tokenRegex is constructed to always have matching
// first/last characters.
if(arg.length<2||arg.charAt(0)!==arg.slice(-1)){throw new src_ParseError("\\verb assertion failed --\n                    please report what input caused this bug");}arg=arg.slice(1,-1);// remove first and last char
return {type:"verb",mode:"text",body:arg,star};}// At this point, we should have a symbol, possibly with accents.
// First expand any accented base symbol according to unicodeSymbols.
if(unicodeSymbols.hasOwnProperty(text[0])&&!src_symbols[this.mode][text[0]]){// This behavior is not strict (XeTeX-compatible) in math mode.
if(this.settings.strict&&this.mode==="math"){this.settings.reportNonstrict("unicodeTextInMathMode","Accented Unicode text character \""+text[0]+"\" used in "+"math mode",nucleus);}text=unicodeSymbols[text[0]]+text.slice(1);}// Strip off any combining characters
const match=combiningDiacriticalMarksEndRegex.exec(text);if(match){text=text.substring(0,match.index);if(text==='i'){text='\u0131';// dotless i, in math and text mode
}else if(text==='j'){text='\u0237';// dotless j, in math and text mode
}}// Recognize base symbol
let symbol;if(src_symbols[this.mode][text]){if(this.settings.strict&&this.mode==='math'&&extraLatin.indexOf(text)>=0){this.settings.reportNonstrict("unicodeTextInMathMode","Latin-1/Unicode text character \""+text[0]+"\" used in "+"math mode",nucleus);}const group=src_symbols[this.mode][text].group;const loc=SourceLocation.range(nucleus);let s;if(ATOMS.hasOwnProperty(group)){// $FlowFixMe
const family=group;s={type:"atom",mode:this.mode,family,loc,text};}else {// $FlowFixMe
s={type:group,mode:this.mode,loc,text};}// $FlowFixMe
symbol=s;}else if(text.charCodeAt(0)>=0x80){// no symbol for e.g. ^
if(this.settings.strict){if(!supportedCodepoint(text.charCodeAt(0))){this.settings.reportNonstrict("unknownSymbol","Unrecognized Unicode character \""+text[0]+"\""+(" ("+text.charCodeAt(0)+")"),nucleus);}else if(this.mode==="math"){this.settings.reportNonstrict("unicodeTextInMathMode","Unicode text character \""+text[0]+"\" used in math mode",nucleus);}}// All nonmathematical Unicode characters are rendered as if they
// are in text mode (wrapped in \text) because that's what it
// takes to render them in LaTeX.  Setting `mode: this.mode` is
// another natural choice (the user requested math mode), but
// this makes it more difficult for getCharacterMetrics() to
// distinguish Unicode characters without metrics and those for
// which we want to simulate the letter M.
symbol={type:"textord",mode:"text",loc:SourceLocation.range(nucleus),text};}else {return null;// EOF, ^, _, {, }, etc.
}this.consume();// Transform combining characters into accents
if(match){for(let i=0;i<match[0].length;i++){const accent=match[0][i];if(!unicodeAccents[accent]){throw new src_ParseError("Unknown accent ' "+accent+"'",nucleus);}const command=unicodeAccents[accent][this.mode]||unicodeAccents[accent].text;if(!command){throw new src_ParseError("Accent "+accent+" unsupported in "+this.mode+" mode",nucleus);}symbol={type:"accent",mode:this.mode,loc:SourceLocation.range(nucleus),label:command,isStretchy:false,isShifty:true,// $FlowFixMe
base:symbol};}}// $FlowFixMe
return symbol;}}Parser.endOfExpression=["}","\\endgroup","\\end","\\right","&"];/**
 * Provides a single function for parsing an expression using a Parser
 * TODO(emily): Remove this
 *//**
 * Parses an expression using a Parser, then returns the parsed result.
 */const parseTree=function(toParse,settings){if(!(typeof toParse==='string'||toParse instanceof String)){throw new TypeError('KaTeX can only parse string typed expression');}const parser=new Parser(toParse,settings);// Blank out any \df@tag to avoid spurious "Duplicate \tag" errors
delete parser.gullet.macros.current["\\df@tag"];let tree=parser.parse();// Prevent a color definition from persisting between calls to katex.render().
delete parser.gullet.macros.current["\\current@color"];delete parser.gullet.macros.current["\\color"];// If the input used \tag, it will set the \df@tag macro to the tag.
// In this case, we separately parse the tag and wrap the tree.
if(parser.gullet.macros.get("\\df@tag")){if(!settings.displayMode){throw new src_ParseError("\\tag works only in display equations");}tree=[{type:"tag",mode:"text",body:tree,tag:parser.subparse([new Token("\\df@tag")])}];}return tree;};/* harmony default export */var src_parseTree=parseTree;/* eslint no-console:0 *//**
 * This is the main entry point for KaTeX. Here, we expose functions for
 * rendering expressions either to DOM nodes or to markup strings.
 *
 * We also expose the ParseError class to check if errors thrown from KaTeX are
 * errors in the expression, or errors in javascript handling.
 *//**
 * Parse and build an expression, and place that expression in the DOM node
 * given.
 */let render=function(expression,baseNode,options){baseNode.textContent="";const node=renderToDomTree(expression,options).toNode();baseNode.appendChild(node);};// KaTeX's styles don't work properly in quirks mode. Print out an error, and
// disable rendering.
if(typeof document!=="undefined"){if(document.compatMode!=="CSS1Compat"){typeof console!=="undefined"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your "+"website has a suitable doctype.");render=function(){throw new src_ParseError("KaTeX doesn't work in quirks mode.");};}}/**
 * Parse and build an expression, and return the markup for that.
 */const renderToString=function(expression,options){const markup=renderToDomTree(expression,options).toMarkup();return markup;};/**
 * Parse an expression and return the parse tree.
 */const generateParseTree=function(expression,options){const settings=new Settings(options);return src_parseTree(expression,settings);};/**
 * If the given error is a KaTeX ParseError and options.throwOnError is false,
 * renders the invalid LaTeX as a span with hover title giving the KaTeX
 * error message.  Otherwise, simply throws the error.
 */const renderError=function(error,expression,options){if(options.throwOnError||!(error instanceof src_ParseError)){throw error;}const node=buildCommon.makeSpan(["katex-error"],[new SymbolNode(expression)]);node.setAttribute("title",error.toString());node.setAttribute("style","color:"+options.errorColor);return node;};/**
 * Generates and returns the katex build tree. This is used for advanced
 * use cases (like rendering to custom output).
 */const renderToDomTree=function(expression,options){const settings=new Settings(options);try{const tree=src_parseTree(expression,settings);return buildTree(tree,expression,settings);}catch(error){return renderError(error,expression,settings);}};/**
 * Generates and returns the katex build tree, with just HTML (no MathML).
 * This is used for advanced use cases (like rendering to custom output).
 */const renderToHTMLTree=function(expression,options){const settings=new Settings(options);try{const tree=src_parseTree(expression,settings);return buildHTMLTree(tree,expression,settings);}catch(error){return renderError(error,expression,settings);}};const version="0.16.22";const __domTree={Span:Span,Anchor:Anchor,SymbolNode:SymbolNode,SvgNode:SvgNode,PathNode:PathNode,LineNode:LineNode};// ESM exports
// CJS exports and ESM default export
/* harmony default export */var katex={/**
   * Current KaTeX version
   */version,/**
   * Renders the given LaTeX into an HTML+MathML combination, and adds
   * it as a child to the specified DOM node.
   */render,/**
   * Renders the given LaTeX into an HTML+MathML combination string,
   * for sending to the client.
   */renderToString,/**
   * KaTeX error, usually during parsing.
   */ParseError:src_ParseError,/**
   * The schema of Settings
   */SETTINGS_SCHEMA:SETTINGS_SCHEMA,/**
   * Parses the given LaTeX into KaTeX's internal parse tree structure,
   * without rendering to HTML or MathML.
   *
   * NOTE: This method is not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */__parse:generateParseTree,/**
   * Renders the given LaTeX into an HTML+MathML internal DOM tree
   * representation, without flattening that representation to a string.
   *
   * NOTE: This method is not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */__renderToDomTree:renderToDomTree,/**
   * Renders the given LaTeX into an HTML internal DOM tree representation,
   * without MathML and without flattening that representation to a string.
   *
   * NOTE: This method is not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */__renderToHTMLTree:renderToHTMLTree,/**
   * extends internal font metrics object with a new object
   * each key in the new object represents a font name
  */__setFontMetrics:setFontMetrics,/**
   * adds a new symbol to builtin symbols table
   */__defineSymbol:defineSymbol,/**
   * adds a new function to builtin function list,
   * which directly produce parse tree elements
   * and have their own html/mathml builders
   */__defineFunction:defineFunction,/**
   * adds a new macro to builtin macro list
   */__defineMacro:defineMacro,/**
   * Expose the dom tree node types, which can be useful for type checking nodes.
   *
   * NOTE: These methods are not currently recommended for public use.
   * The internal tree representation is unstable and is very likely
   * to change. Use at your own risk.
   */__domTree};/**
 * This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2]
 * doesn't support CSS modules natively, a separate entry point is used and
 * it is not flowtyped.
 *
 * [1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
 * [2] https://facebook.github.io/jest/docs/en/webpack.html
 *//* harmony default export */var katex_webpack=katex;__webpack_exports__=__webpack_exports__["default"];/******/return __webpack_exports__;/******/}();});
});

/* eslint no-constant-condition:0 */
const findEndOfMath = function (delimiter, text, startIndex) {
  // Adapted from
  // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
  let index = startIndex;
  let braceLevel = 0;
  const delimLength = delimiter.length;
  while (index < text.length) {
    const character = text[index];
    if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
      return index;
    } else if (character === "\\") {
      index++;
    } else if (character === "{") {
      braceLevel++;
    } else if (character === "}") {
      braceLevel--;
    }
    index++;
  }
  return -1;
};
const escapeRegex = function (string) {
  return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
};
const amsRegex = /^\\begin{/;
const splitAtDelimiters = function (text, delimiters) {
  let index;
  const data = [];
  const regexLeft = new RegExp("(" + delimiters.map(x => escapeRegex(x.left)).join("|") + ")");
  while (true) {
    index = text.search(regexLeft);
    if (index === -1) {
      break;
    }
    if (index > 0) {
      data.push({
        type: "text",
        data: text.slice(0, index)
      });
      text = text.slice(index); // now text starts with delimiter
    }
    // ... so this always succeeds:
    const i = delimiters.findIndex(delim => text.startsWith(delim.left));
    index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
    if (index === -1) {
      break;
    }
    const rawData = text.slice(0, index + delimiters[i].right.length);
    const math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
    data.push({
      type: "math",
      data: math,
      rawData,
      display: delimiters[i].display
    });
    text = text.slice(index + delimiters[i].right.length);
  }
  if (text !== "") {
    data.push({
      type: "text",
      data: text
    });
  }
  return data;
};

/* eslint no-console:0 */

/* Note: optionsCopy is mutated by this method. If it is ever exposed in the
 * API, we should copy it before mutating.
 */
const renderMathInText = function (text, optionsCopy) {
  const data = splitAtDelimiters(text, optionsCopy.delimiters);
  if (data.length === 1 && data[0].type === 'text') {
    // There is no formula in the text.
    // Let's return null which means there is no need to replace
    // the current text node with a new one.
    return null;
  }
  const fragment = document.createDocumentFragment();
  for (let i = 0; i < data.length; i++) {
    if (data[i].type === "text") {
      fragment.appendChild(document.createTextNode(data[i].data));
    } else {
      const span = document.createElement("span");
      let math = data[i].data;
      // Override any display mode defined in the settings with that
      // defined by the text itself
      optionsCopy.displayMode = data[i].display;
      try {
        if (optionsCopy.preProcess) {
          math = optionsCopy.preProcess(math);
        }
        katex.render(math, span, optionsCopy);
      } catch (e) {
        if (!(e instanceof katex.ParseError)) {
          throw e;
        }
        optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
        fragment.appendChild(document.createTextNode(data[i].rawData));
        continue;
      }
      fragment.appendChild(span);
    }
  }
  return fragment;
};
const renderElem = function (elem, optionsCopy) {
  for (let i = 0; i < elem.childNodes.length; i++) {
    const childNode = elem.childNodes[i];
    if (childNode.nodeType === 3) {
      // Text node
      // Concatenate all sibling text nodes.
      // Webkit browsers split very large text nodes into smaller ones,
      // so the delimiters may be split across different nodes.
      let textContentConcat = childNode.textContent;
      let sibling = childNode.nextSibling;
      let nSiblings = 0;
      while (sibling && sibling.nodeType === Node.TEXT_NODE) {
        textContentConcat += sibling.textContent;
        sibling = sibling.nextSibling;
        nSiblings++;
      }
      const frag = renderMathInText(textContentConcat, optionsCopy);
      if (frag) {
        // Remove extra text nodes
        for (let j = 0; j < nSiblings; j++) {
          childNode.nextSibling.remove();
        }
        i += frag.childNodes.length - 1;
        elem.replaceChild(frag, childNode);
      } else {
        // If the concatenated text does not contain math
        // the siblings will not either
        i += nSiblings;
      }
    } else if (childNode.nodeType === 1) {
      // Element node
      const className = ' ' + childNode.className + ' ';
      const shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1);
      if (shouldRender) {
        renderElem(childNode, optionsCopy);
      }
    }
    // Otherwise, it's something else, and ignore it.
  }
};
const renderMathInElement = function (elem, options) {
  if (!elem) {
    throw new Error("No element provided to render");
  }
  const optionsCopy = {};

  // Object.assign(optionsCopy, option)
  for (const option in options) {
    if (options.hasOwnProperty(option)) {
      optionsCopy[option] = options[option];
    }
  }

  // default options
  optionsCopy.delimiters = optionsCopy.delimiters || [{
    left: "$$",
    right: "$$",
    display: true
  }, {
    left: "\\(",
    right: "\\)",
    display: false
  },
  // LaTeX uses $…$, but it ruins the display of normal `$` in text:
  // {left: "$", right: "$", display: false},
  // $ must come after $$

  // Render AMS environments even if outside $$…$$ delimiters.
  {
    left: "\\begin{equation}",
    right: "\\end{equation}",
    display: true
  }, {
    left: "\\begin{align}",
    right: "\\end{align}",
    display: true
  }, {
    left: "\\begin{alignat}",
    right: "\\end{alignat}",
    display: true
  }, {
    left: "\\begin{gather}",
    right: "\\end{gather}",
    display: true
  }, {
    left: "\\begin{CD}",
    right: "\\end{CD}",
    display: true
  }, {
    left: "\\[",
    right: "\\]",
    display: true
  }];
  optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"];
  optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
  optionsCopy.errorCallback = optionsCopy.errorCallback || console.error;

  // Enable sharing of global macros defined via `\gdef` between different
  // math elements within a single call to `renderMathInElement`.
  optionsCopy.macros = optionsCopy.macros || {};
  renderElem(elem, optionsCopy);
};

//
var script$65 = {
  name: 'XmlTextRender',
  components: {
    addFile: __vue_component__$66,
    XmlTextDialogRender: __vue_component__$69,
    [ImagePreview$1.Component.name]: ImagePreview$1.Component
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    pBlockData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    dataIndex: Number,
    //数据下标
    containerClass: String,
    extendParams: {
      type: Object,
      default: function () {
        return {
          //默认开启编辑器
          defaultOpenEditor: false
        };
      }
    },
    headers: {
      // 上传文件头部
      type: Object,
      default: () => {}
    },
    action: {
      // 上传文件地址
      type: String,
      default: ''
    },
    data: {
      // 上传文件附带的额外参数
      type: Object,
      default: () => {}
    },
    textBookData: Object //数字教材信息
  },
  data() {
    return {
      blockId: `blockId${v4()}`,
      propertyComponentsName: 'XmlTextProperty',
      editorId: `editor-container${`${Math.random()}`.replaceAll('0.', '')}`,
      blockData: {
        html: ''
      },
      imageViewerTitles: [],
      imageViewerSrcs: [],
      inlineWordsModal: {
        visible: false,
        title: '',
        content: '',
        stylemode: ''
      },
      markRootId: `mark-view__${v4()}`,
      markEfiStr: '',
      markInstance: null,
      activeTippy: null,
      tippyTplBarId: `tipbar-tpl__${v4()}`,
      tippyTplNoteId: `tipnote-tpl__${v4()}`,
      actionCopyId: `act-copy__${v4()}`,
      actionNoteId: `act-note__${v4()}`,
      actionErrorId: `act-error__${v4()}`,
      actionErrorTextId: `act-error__${v4()}`,
      actionHighlightId: `act-light__${v4()}`,
      actionLinkId: `act-link__${v4()}`,
      actionAiId: `act-ai__${v4()}`,
      actionEncyclopediasId: `act-encyclopedias__${v4()}`,
      actionDictionaryId: `act-dictionary__${v4()}`,
      addTeacherResourcesId: `add-teacher-resources__${v4()}`,
      noteInputId: `note_input__${v4()}`,
      errorInputId: `err_input__${v4()}`,
      actNoteCancelId: `act-cancel__${v4()}`,
      actNoteConfirmId: `act-confirm__${v4()}`,
      errorConfirmId: `err-cancel__${v4()}`,
      errorCancelId: `err-confirm__${v4()}`,
      editNoteTplId: `editnote-tpl__${v4()}`,
      actNoteDeleteId: `act-delete__${v4()}`,
      actNoteEditId: `act-edit__${v4()}`,
      noteOperateMode: '',
      tempMarkModel: {},
      noteData: {
        selectionText: '',
        content: ''
      },
      noteEditData: {
        selectionText: '',
        content: ''
      },
      noteError: {
        selectionText: '',
        content: ''
      },
      tempMarkEfiStr: '',
      isMobile: false,
      notePopupVisible: false,
      errorPopupVisible: false
    };
  },
  inject: {
    getProviderUserType: {
      from: 'getProviderUserType',
      default: () => () => ''
    },
    getProviderInsideIndex: {
      from: 'getProviderInsideIndex',
      default: () => () => -1
    },
    getSingleGroupLocation: {
      from: 'getSingleGroupLocation',
      default: () => () => ''
    },
    getToolbarVisible: {
      from: 'getToolbarVisible',
      default: () => () => false
    },
    getReaderBoxId: {
      from: 'getReaderBoxId',
      default: () => () => ''
    },
    getTeacherNoteList: {
      from: 'getTeacherNoteList',
      default: () => () => []
    },
    getStudentNoteList: {
      from: 'getStudentNoteList',
      default: () => () => []
    },
    getHighlightList: {
      from: 'getHighlightList',
      default: () => () => []
    },
    getKeyboardShow: {
      from: 'getKeyboardShow',
      default: () => () => false
    },
    getInitialLoad: {
      from: 'getInitialLoad',
      default: () => () => false
    },
    getResourceBasisPath: {
      from: 'getResourceBasisPath',
      default: () => () => ''
    },
    getSysEnv: {
      from: 'getSysEnv',
      default: () => () => {}
    },
    getIsShowAi: {
      from: 'getIsShowAi',
      default: () => () => false
    }
    // callFnReplaceKeywordsInHTML: {
    //   from: 'replaceKeywordsInHTML',
    //   default: () => () => () => []
    // }
  },
  computed: {
    feedback() {
      return {
        ruleIndex: this.ruleIndex,
        dataName: this.blockDataName,
        data: this.pBlockData,
        graphLinks: this.currentRule.data?.graphLinks || [],
        pureTextComponent: this.isPureTextComponent,
        dataIndex: this.dataIndex,
        blockId: this.blockId
      };
    },
    isImportContent() {
      let htmlStr = this.pBlockData?.html || '';
      return this.pBlockData?.inputBy?.includes('import--') || htmlStr.includes('<section class="docx">') && htmlStr.includes('</section>');
    },
    isPureTextComponent() {
      return this.currentRule.componentsName === 'xml-single-text-group';
    },
    userType() {
      return this.getProviderUserType();
    },
    insideIndex() {
      return this.getProviderInsideIndex();
    },
    groupLocation() {
      return this.getSingleGroupLocation();
    },
    toolbarVisible() {
      return this.getToolbarVisible();
    },
    readerBoxId() {
      return this.getReaderBoxId();
    },
    keyboardShow() {
      return this.getKeyboardShow();
    },
    evn() {
      return this.getSysEnv() || {
        tippy: {}
      };
    },
    isShowAi() {
      return this.getIsShowAi();
    },
    mergeMarkList() {
      let teacherNoteList = this.getTeacherNoteList() || [],
        studentNoteList = this.getStudentNoteList() || [],
        highlightList = this.getHighlightList() || [];
      return [...teacherNoteList.filter(item => item.location === this.groupLocation), ...studentNoteList.filter(item => item.location === this.groupLocation), ...highlightList.filter(item => item.location === this.groupLocation)];
    },
    resourceBasisPath() {
      return this.getResourceBasisPath();
    },
    richContent() {
      let formated = this.formatImg(this.pBlockData.html);
      let links = this.currentRule.data?.graphLinks || [];
      if (!links.length) {
        return formated;
      }
      let copy = formated;
      let tempWrapDom = document.createElement('div');
      tempWrapDom.innerHTML = copy;
      let content = '';
      Array.from(tempWrapDom.childNodes).forEach(child => {
        if (child.dataset.graphKey && child.tagName === 'P' && child.textContent) {
          let pCopy = child.outerHTML + '';
          for (let i = 0, len = links.length; i < len; i++) {
            let item = links[i];
            if (item.targets.includes(child.dataset.graphKey)) {
              pCopy = replaceKeywordsInHTML(pCopy, item.name, {
                flag: 'xml-graph-link',
                datasets: [{
                  key: 'graphLinkId',
                  value: item.id
                }]
              })[0];
            }
          }
          content += pCopy;
        } else {
          content += child.outerHTML;
        }
      });
      copy = '';
      tempWrapDom = null;
      return content;
    }
  },
  watch: {
    mergeMarkList: {
      handler(newValue) {
        // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'教师笔记回显0',newValue,this.markInstance)
        // this.$nextTick(() => {
        //   if (newValue?.length && this.markInstance) {
        //     this.updateMarkView()
        //   }
        // })
      },
      immediate: true,
      deep: true
    }
  },
  created() {},
  mounted() {
    // 兼容一期文本弹窗=====
    this.$nextTick(() => {
      setTimeout(() => {
        jquery('a').attr('target', '_self');
      }, 2000);
      window.inlineWordsShow = uuid => {
        const ele = document.getElementById(`words__${uuid}`);
        const {
          title = '',
          content = ''
        } = ele.dataset || {};
        this.inlineWordsModal = {
          title,
          content,
          visible: true
        };
      };
    });
    // ==================
    let _this = this;
    this.blockData = this.pBlockData;
    const defaultEmpty = `<p id="paragraph__${v4()}"><span>暂无内容</span></p>`;
    if (!this.blockData.html) {
      this.blockData.html = defaultEmpty;
    }
    `#${this.blockId} .richtext-reset-wrapper--view`;
    let mceMagicLinkRegistered = window.customElements?.get('magic-link');
    if (!mceMagicLinkRegistered) {
      window.customElements.whenDefined('magic-link').then(res => {
        // console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', '富文本组件MCE注册完成', res)
      });
      window.customElements.define('magic-link', MagicLink);
    }
    let containerSelector = `#${this.blockId}.richtext-reset-container`;
    this.$nextTick(() => {
      jquery(containerSelector).on('click', 'img', function (e) {
        let target = jquery(e.target);
        console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', '事件对象', e, target, target.index('img[preview]'));
        let title = target.attr('alt');
        let src = target.attr('src');
        let notallowgallery = target.attr('notallowgallery');
        let imgType = target.attr('data-img-type');
        if (!notallowgallery) {
          _this.$hevueImgPreview({
            multiple: true,
            nowImgIndex: 0,
            imgList: [{
              url: src,
              title: title
            }]
          });
        } else if (imgType == 3) {
          //问Ai
          let aiType = target.attr('data-ai-type');
          let problem = target.attr('data-problem');
          _this.$EventBus.$emit('openAiParsing', {
            isOpen: true,
            //是否直接打开阅读器的Ai
            aiType,
            text: problem
          });
        }
      });
      const getFileUrl = url => {
        if (url) {
          if (url.indexOf('./') === -1) {
            return url;
          }
          return `${_this.resourceBasisPath}${url.split('./')[1]}`;
        }
        return '';
      };
      jquery(containerSelector).on('click', 'magic-link', function (e) {
        let {
          plaintext,
          title,
          content,
          type,
          isPlaying,
          stylemode,
          showType,
          hotzoneType
        } = e.target.dataset;
        if (_this.mode === 'editor') {
          _this.$message.info('当前内容仅支持在预览模式下查看');
          return;
        }
        if (type === 'image') {
          // 魔链图片

          _this.$hevueImgPreview({
            multiple: true,
            nowImgIndex: 0,
            imgList: [{
              url: getFileUrl(content),
              title: plaintext
            }]
          });
        }
        if (type === 'audio') {
          // 魔链音频
          _this.$EventBus.$emit('handleMagicLinkAudioPlay', {
            plaintext,
            title,
            content: getFileUrl(content),
            type,
            isPlaying,
            targetId: e.target.id,
            callback: audio => {
              e.target.setAttribute('data-isplaying', audio.paused ? 'false' : 'true');
            }
          });
        }
        if (type === 'video') {
          // 魔链音频
          _this.$EventBus.$emit('handleMagicLinkVideoPlay', {
            plaintext,
            title,
            content: getFileUrl(content),
            type,
            isPlaying,
            targetId: e.target.id,
            callback: video => {
              e.target.setAttribute('data-isplaying', video.paused ? 'false' : 'true');
            }
          });
        }
        if (type === 'richtext') {
          content = content.replace(/text\-align:\s?justify/g, 'text-align:left');
          // 魔链富文本
          if (showType === 'popover') {
            return;
          }
          _this.inlineWordsModal = {
            title,
            content,
            stylemode,
            visible: true
          };
        }
        if (type === 'sheet') {
          // 插入活页
          _this.$EventBus.$emit('hotzoneClick', {
            type: hotzoneType || 'looseleaf',
            value: content,
            label: title
          });
          // window.open(
          //   process.env.VUE_APP_TEXTBOOK_WEB +
          //     'previewLooseLeaf?pageType=' +
          //     _this.pageType +
          //     '&businessType=looseLeaf' +
          //     '&looseLeafId=' +
          //     content +
          //     '&isTrial=' +
          //     true +
          //     '&uuid=' +
          //     uuidv4()
          // )
        }
      });
      jquery(containerSelector).on('openTarget', 'magic-link', function (e) {
        // let {plaintext,title,content,type,isPlaying,stylemode} = e.target.dataset
        console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', 'leaflet target点击', e, e.detail);
      });
      jquery(`#${this.blockId} .inline-link-wrap`).each(function (i) {
        let parent = jquery(this).parent();
        // let indent = parent ? parent.css("text-indent") : '' // 此处使用css()方法获取属性值有内部bug
        let elem = parent.length ? parent[0] : null;
        if (elem) {
          let indent = getComputedStyle(elem, null)['textIndent'];
          let hackStyle = jquery(this).attr('style') + `max-width:calc(100% - ${indent})`;
          jquery(this).attr('style', hackStyle);
        }
      });
      jquery(`#${this.blockId} :not(.inline-link-wrap) img`).each(function (i) {
        let parent = jquery(this).parent();
        let elem = parent.length ? parent[0] : null;
        if (elem) {
          let indent = getComputedStyle(elem, null)['textIndent'];
          let hackStyle = jquery(this).attr('style') + `max-width:calc(100% - ${indent}) !important`;
          jquery(this).attr('style', hackStyle);
        }
      });
      if ('ontouchstart' in window || 'onmsgesturechange' in window) {
        this.isMobile = true;
        console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', '当前环境:移动端');
      } else {
        this.isMobile = false;
        console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', '当前环境:PC端');
      }

      // @pos 初始化tippy
      tippy.setDefaultProps({
        plugins: [followCursor]
      });
      _this.activeTippy = tippy(`#${_this.blockId}`, {
        content: '',
        placement: 'top',
        trigger: 'manual',
        theme: 'light',
        animation: 'shift-away',
        interactive: true,
        allowHTML: true,
        // followCursor: this.isMobile ? true : 'initial',
        followCursor: 'initial',
        onShow(instance) {
          _this.$EventBus.$emit('tippyChange', {
            state: true
          });
        },
        onHide(instance) {
          _this.$EventBus.$emit('tippyChange', {
            state: false
          });
        }
      });
      function findParentByClassName(node, className) {
        if (node && !(node.nodeType == 1 && node.tagName.toLowerCase() === 'body')) {
          while (node) {
            let isBody = node && node.nodeType == 1 && node.tagName.toLowerCase() == 'body';
            let hasClass = node && node.nodeType == 1 && node.classList.contains(className);
            if (hasClass || isBody) {
              return !hasClass ? null : node;
            }
            node = node.parentNode;
          }
        }
        return null;
      }
      if (this.userType && this.evn.isAddMark && this.pBlockData.html.indexOf('<pre') === -1) {
        this.markInstance = new n(this.markRootId, {
          id: this.currentRule.xmlCompRef
        });
        let timer = null;
        this.markInstance.on('selected', data => {
          if (this.insideIndex === this.ruleIndex) {
            let {
              startContainer,
              endContainer
            } = data.range;
            let startParent = startContainer && findParentByClassName(startContainer, 'richtext-reset-wrapper--view');
            let endParent = endContainer && findParentByClassName(endContainer, 'richtext-reset-wrapper--view');
            if (startParent && endParent && startParent !== endParent) {
              // _this.activeTippy[0].setContent('暂不支持跨组件标注')
              _this.activeTippy[0].setContent(`<span style="color:#EE3751;">暂不支持跨组件标注</span>`);
              _this.activeTippy[0].show();
              let preOperateTippy = document.getElementById(`tippy-${_this.activeTippy[0].id - 1}`);
              preOperateTippy && preOperateTippy.remove();
              setTimeout(handler => {
                _this.hideTippy();
              }, 1500);
              return;
            }
            _this.markEfiStr = data.markStr;
            if (_this.tempMarkEfiStr) {
              this.markInstance.remove(_this.tempMarkEfiStr, 'underline');
            }
            if (timer) {
              clearTimeout(timer);
            }
            if (this.isMobile) {
              _this.activeTippy[0] && _this.hideTippy();
              timer = setTimeout(() => {
                _this.handleMouseUp();
              }, 200);
            }
          }
        });
        this.markInstance.render();
        this.$nextTick(() => {
          // console.log('绑定监听',_this.groupLocation);
          this.$EventBus.$on(`previewRepaint-${_this.groupLocation}`, () => {
            setTimeout(() => {
              _this.markInstance.update();
            }, 10);
          });
          this.$EventBus.$on(`markJumpIn-${_this.groupLocation}`, target => {
            setTimeout(() => {
              if (target.location === _this.groupLocation && target.blockIndex === _this.ruleIndex) {
                _this.markInstance.animate(target.markEfiCode);
              }
            }, 10);
          });
          this.$EventBus.$on(`clickToolbarTip-${_this.tippyTplBarId}`, function (data) {
            if (data.type == 'copy' && data.tippyTplBarId == _this.tippyTplBarId) {
              _this.actionCopy();
            } else if (data.type == 'note' && data.tippyTplBarId == _this.tippyTplBarId) {
              _this.actionAddNote();
            } else if (data.type == 'highlight' && data.tippyTplBarId == _this.tippyTplBarId) {
              _this.actionAddHighlight();
            } else if (data.type == 'link' && data.tippyTplBarId == _this.tippyTplBarId) {
              _this.actionAddLink();
            } else if (data.type == 'dictionary' && data.tippyTplBarId == _this.tippyTplBarId) {
              _this.openDictionary();
            } else if (data.type == 'encyclopedias' && data.tippyTplBarId == _this.tippyTplBarId) {
              _this.openEncyclopedias();
            } else if (data.type == 'error' && data.tippyTplBarId == _this.tippyTplBarId) {
              _this.actionAddError();
            } else if (data.type == 'Ai' && data.tippyTplBarId == _this.tippyTplBarId) {
              _this.actionOpenAi();
            }
            _this.$EventBus.$emit('selectionTextChange', {
              state: false,
              tippyTplBarId: _this.tippyTplBarId
            });
            _this.$EventBus.$emit('tippyChange', {
              state: false
            });
          });
          this.$EventBus.$on(`underlineSign-${_this.groupLocation}`, function (data) {
            // this.noteOperateMode = 'add'
            // let defaultUnderlineStyle = 'mk-underline__default'
            if (data.operationType == 'add' && _this.groupLocation == data.location) {
              _this.markInstance.underline(data.markEfiCode, data.styleType, e => {
              });
              _this.tempMarkEfiStr = '';
            } else if (data.operationType == 'remove' && _this.groupLocation == data.location) {
              _this.markInstance.remove(data.markEfiCode, data.signType);
            }
          });
          this.$once('hook:beforeDestroy', () => {
            // console.log('销毁监听',_this.groupLocation);
            _this.$EventBus.$off(`clickToolbarTip-${_this.tippyTplBarId}`);
            _this.$EventBus.$off(`previewRepaint-${_this.groupLocation}`);
            _this.$EventBus.$off(`markJumpIn-${_this.groupLocation}`);
            _this.$EventBus.$off(`underlineSign-${_this.groupLocation}`);
          });
          this.updateCodeBlock();
          setTimeout(() => {
            this.updateMarkView();
          }, this.getInitialLoad() ? 1000 : 0);
        });
      } else {
        this.updateCodeBlock();
      }
      if (this.richContent?.length) {
        this.renderMath();
      }
      if (this.mode == 'reader') {
        let ADom = document.getElementById(this.blockId).getElementsByTagName('a') || [];
        if (ADom) {
          for (let i = 0; i < ADom.length; i++) {
            let href = ADom[i].href;
            // if (JSON.stringify(this.releaseUrlList).indexOf(ADom[i].href) == -1) {
            ADom[i].href = 'javascript: void(0)';
            ADom[i].onclick = function (e) {
              _this.$EventBus.$emit('openTextHyperlink', {
                href: href
              });
              e.preventDefault();
              return false;
            };
            // }
          }
        }
      }
    });
  },
  beforeDestroy() {
    if (this.markInstance) {
      this.markInstance.destroy();
    }
    if (this.activeTippy && this.activeTippy[0]) {
      this.activeTippy[0].destroy();
    }
  },
  methods: {
    renderMath() {
      const renderOption = {
        delimiters: [{
          left: '$$',
          right: '$$',
          display: false
        }, {
          left: '$',
          right: '$',
          display: false
        }, {
          left: '\\(',
          right: '\\)',
          display: false
        }, {
          left: '\\begin{equation}\\begin{split}',
          right: '\\end{split}\\end{equation}',
          display: false
        }, {
          left: '\\begin{equation}',
          right: '\\end{equation}',
          display: false
        }, {
          left: '\\begin{align}',
          right: '\\end{align}',
          display: false
        }, {
          left: '\\begin{alignat}',
          right: '\\end{alignat}',
          display: false
        }, {
          left: '\\begin{gather}',
          right: '\\end{gather}',
          display: false
        }, {
          left: '\\begin{CD}',
          right: '\\end{CD}',
          display: false
        }, {
          left: '\\begin{matrix}',
          right: '\\end{matrix}',
          display: false
        }, {
          left: '\\begin{bmatrix}',
          right: '\\end{bmatrix}',
          display: false
        }, {
          left: '\\begin{pmatrix}',
          right: '\\end{pmatrix}',
          display: false
        }, {
          left: '\\begin{vmatrix}',
          right: '\\end{vmatrix}',
          display: false
        }, {
          left: '\\begin{Bmatrix}',
          right: '\\end{Bmatrix}',
          display: false
        }, {
          left: '\\begin{Vmatrix}',
          right: '\\end{Vmatrix}',
          display: false
        }, {
          left: '\\begin{cases}',
          right: '\\end{cases}',
          display: false
        }, {
          left: '\\begin{rcases}',
          right: '\\end{rcases}',
          display: false
        }, {
          left: '\\begin{smallmatrix}',
          right: '\\end{smallmatrix}',
          display: false
        }, {
          left: '\\[',
          right: '\\]',
          display: false
        }],
        throwOnError: false
      };
      this.$nextTick(() => {
        let dom = this.$refs.richtextSectionWrap;
        if (dom) {
          renderMathInElement(dom, renderOption);
        }
      });
    },
    // // 添加教师资源
    // addTeacherResources() {
    //   let markId = `mark__${uuidv4()}`
    //   // let styleType = 'mk-addTeacherResources__default'
    //   let model = {
    //     selectionText: this.noteData.selectionText,
    //     markEfiCode: this.markEfiStr,
    //     type: `note__${this.userType}`,
    //     // styleType,
    //     blockIndex: this.ruleIndex,
    //     markId
    //   }
    //   this.emitRollbackHandler('addTeacherResources', model)
    //     .then((id) => {
    //       id === markId && _this.markInstance.remove(rollbackMark, 'addTeacherResources')
    //       console.log(222)
    //     })
    //     .catch((err) => {
    //       console.log(err)
    //     })
    // },
    // 打开添加教师资源弹窗
    addTeacherResources(e) {
      let markId = `mark__${v4()}`;
      // let styleType = 'mk-addTeacherResources__default'
      let model = {
        selectionText: this.noteData.selectionText,
        markEfiCode: this.markEfiStr,
        type: `note__${this.userType}`,
        styleType: this.evn.resourcesStyle,
        blockIndex: this.ruleIndex,
        markId
      };
      let _this = this;
      // this.noteOperateMode = 'add'
      // let defaultUnderlineStyle = 'mk-underline__default'
      _this.tempMarkEfiStr = _this.markEfiStr;
      _this.noteData.content = '';
      // _this.markInstance.underline(_this.markEfiStr, defaultUnderlineStyle, (e) => {
      //   try {
      //     // 下划线点击事件, 比如打开编辑框
      //     // let markEfiStr = e.target.getAttribute('data-id')
      //     // _this.noteClick(e, markEfiStr)
      //   } catch (error) {
      //     console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'underline error', error)
      //   }
      // })
      this.emitRollbackHandler('addTeacherResources', model).then(id => {
        id === markId && _this.markInstance.remove(rollbackMark, 'underline');
      }).catch(err => {
        console.log(err);
      });
      this.hideTippy();
    },
    // 添加数据
    addData(type, item) {
      this.data[type].list.push(item);
      let list = JSON.stringify(this.data);
      localStorage.setItem('simulated-data_' + this.textBookData.id, list);
      this.getData(type, item);
    },
    // 确认添加教师资源
    addResources(e) {
      this.$emit('addResources', e);
    },
    // 编辑教师资源
    editTeachingResource(e) {
      this.$refs.addTeacherResources.open({
        isEdit: true,
        ...e
      });
    },
    // 确认编辑教师资源
    editResources(e) {
      this.$emit('editResources', e);
    },
    updateMarkView() {
      // @pos 硬刷新Mark视图
      let _this = this;
      this.markInstance.clear();
      this.mergeMarkList.forEach(item => {
        console.log('🚀 ~ this.mergeMarkList.forEach ~ item:', item);
        if (item.type === 'note__teacher' && item.resourcesType) {
          this.markInstance.underline(item.markEfiCode, item.styleType, e => {
            try {
              // 下划线点击事件, 比如打开编辑框
              let markEfiStr = e.target.getAttribute('data-id');
              console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', 'Mark Click', e, markEfiStr);
              console.log('下划线点击事件, 比如打开编辑框', markEfiStr);
              this.emitRollbackHandler('openTeacherResources', {
                ...e,
                markEfiStr
              });
              // _this.noteClick(e, markEfiStr)
            } catch (error) {
              console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'MarkClick Error', error);
            }
          });
        } else if (item.type === 'note__teacher') {
          this.markInstance.underline(item.markEfiCode, item.styleType, e => {
            try {
              // 下划线点击事件, 比如打开编辑框
              // if (!_this.markEfiStr) {
              let markEfiStr = e.target.getAttribute('data-id');
              _this.noteClick(e, markEfiStr);
              // }
            } catch (error) {
              console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'MarkClick Error', error);
            }
          });
        }
        if (item.type === 'note__student') {
          this.markInstance.underline(item.markEfiCode, item.styleType, e => {
            try {
              // 下划线点击事件, 比如打开编辑框
              // if (!_this.markEfiStr) {
              let markEfiStr = e.target.getAttribute('data-id');
              _this.noteClick(e, markEfiStr);
              // }
            } catch (error) {
              console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'MarkClick Error', error);
            }
          });
        }
        if (item.type === 'highlight__student') {
          this.markInstance.highlight(item.markEfiCode, item.styleType, e => {
            try {
              // 下划线点击事件, 比如打开编辑框
              let markEfiStr = e.target.getAttribute('data-id');
              _this.highlightClick(e, markEfiStr);
            } catch (error) {
              console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'HighlightClick Error', error);
            }
          });
        }
        if (item.type === 'highlight__teacher') {
          this.markInstance.highlight(item.markEfiCode, item.styleType, e => {
            try {
              // 下划线点击事件, 比如打开编辑框
              let markEfiStr = e.target.getAttribute('data-id');
              _this.highlightClick(e, markEfiStr);
            } catch (error) {
              console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'HighlightClick Error', error);
            }
          });
        }
      });
    },
    handleMouseUp() {
      // @pos MouseUp
      let _this = this;
      let u = navigator.userAgent;
      if (this.userType && this.insideIndex === this.ruleIndex && this.evn.isAddMark) {
        setTimeout(() => {
          // console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', 'MouseUp', _this.markEfiStr)
          this.$EventBus.$emit('selectionTextChange', {
            state: false,
            tippyTplBarId: _this.tippyTplBarId
          });
          _this.$EventBus.$emit('tippyChange', {
            state: false
          });
          const text = window?.getSelection()?.toString() || '';
          if (text.length && text.length <= 200 && _this.markEfiStr) {
            let checkHasSaved = _this.mergeMarkList.find(item => item.markEfiCode === _this.markEfiStr);
            let checkout = true;
            if (checkHasSaved) {
              let msg = '当前位置已存在标记',
                resourceType = checkHasSaved.resourcesType || checkHasSaved.type?.split('__')[0];
              if (checkHasSaved.resourcesName) {
                resourceType = 'resource';
              }
              switch (resourceType) {
                case 'notes':
                  msg = '当前位置已存在笔记';
                  break;
                case 'recorded':
                  msg = '当前位置已存在录音';
                  break;
                case 'underline':
                  msg = '当前位置已存在笔记';
                  break;
                case 'highlight':
                  msg = '当前位置已存在高亮';
                  break;
                case 'resource':
                  msg = '当前位置已存在资源';
                  break;
              }
              checkout = false;
              if (_this.pageType == 'pc' || !u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
                _this.activeTippy[0].setContent(`<span style="color:#EE3751;">${msg}</span>`);
                _this.activeTippy[0].show();
              } else {
                _this.$EventBus.$emit('showToastTippy', {
                  msg: msg
                });
              }
              let preOperateTippy = document.getElementById(`tippy-${_this.activeTippy[0].id - 1}`);
              preOperateTippy && preOperateTippy.remove();
              _this.markEfiStr = '';
              setTimeout(handler => {
                _this.hideTippy();
                checkout = true;
              }, 1500);
              return;
            }
            if (!checkout) {
              return;
            }
            _this.noteData.selectionText = text;
            _this.noteError.selectionText = text;
            const templateBar = document.getElementById(_this.tippyTplBarId);
            // let HTMLContentClone = $J(`#${_this.tippyTplBarId}`)?.clone(true,true)?.get(0)
            let content = templateBar?.innerHTML || '<span style="color:"#EE3751;"">选区解析错误</span>';
            let markId = `mark__${v4()}`;
            let noteModel = {
              selectionText: this.noteData.selectionText,
              noteContent: '',
              markEfiCode: this.markEfiStr,
              type: `note__${this.userType}`,
              styleType: this.evn.noteStyle,
              blockIndex: this.ruleIndex,
              markId
            };
            this.$EventBus.$emit('selectionTextChange', {
              state: false,
              tippyTplBarId: _this.tippyTplBarId,
              noteModel
            });
            _this.$EventBus.$emit('tippyChange', {
              state: false
            });
            if (_this.pageType == 'pc' || !this.evn.fixedTippy) {
              _this.activeTippy[0].setProps({
                content,
                onShown: instance => {
                  // @pos 显示tippybar
                  let actCopy = instance.popper.children[0]?.querySelector(`#${_this.actionCopyId}`),
                    actNote = instance.popper.children[0]?.querySelector(`#${_this.actionNoteId}`),
                    actHighlight = instance.popper.children[0]?.querySelector(`#${_this.actionHighlightId}`),
                    actLink = instance.popper.children[0]?.querySelector(`#${_this.actionLinkId}`),
                    actAi = instance.popper.children[0]?.querySelector(`#${_this.actionAiId}`),
                    addTeacherResources = instance.popper.children[0]?.querySelector(`#${_this.addTeacherResourcesId}`),
                    actionDictionary = instance.popper.children[0]?.querySelector(`#${_this.actionDictionaryId}`),
                    //词典
                    actionEncyclopedias = instance.popper.children[0]?.querySelector(`#${_this.actionEncyclopediasId}`),
                    //百科
                    actionError = instance.popper.children[0]?.querySelector(`#${_this.actionErrorId}`); //纠错

                  if (actCopy) {
                    actCopy.addEventListener('click', _this.actionCopy, {
                      once: true
                    });
                  }
                  if (actNote) {
                    actNote.addEventListener('click', _this.actionAddNote);
                  }
                  if (actionError) {
                    actionError.addEventListener('click', _this.actionAddError);
                  }
                  if (actionDictionary) {
                    actionDictionary.addEventListener('click', _this.openDictionary, {
                      once: true
                    });
                  }
                  if (actHighlight) {
                    actHighlight.addEventListener('click', _this.actionAddHighlight, {
                      once: true
                    });
                  }
                  if (actLink) {
                    actLink.addEventListener('click', _this.actionAddLink, {
                      once: true
                    });
                  }
                  if (actAi) {
                    actAi.addEventListener('click', _this.actionOpenAi, {
                      once: true
                    });
                  }
                  if (addTeacherResources) {
                    addTeacherResources.addEventListener('click', _this.addTeacherResources, {
                      once: true
                    });
                  }
                  if (actionDictionary) {
                    actionDictionary.addEventListener('click', _this.openDictionary, {
                      once: true
                    });
                  }
                  if (actionEncyclopedias) {
                    actionEncyclopedias.addEventListener('click', _this.openEncyclopedias, {
                      once: true
                    });
                  }
                }
              });
              // _this.activeTippy = tippy(e.target, {
              //   content: templateBar,
              //   placement: 'top',
              //   trigger: 'manual',
              //   theme: 'light',
              //   animation: 'shift-away',
              //   interactive: true,
              //   onClickOutside(instance, event) {
              //     instance.hide()
              //   },
              // })
              _this.activeTippy[0].show();
              let preTipTippy = document.getElementById(`tippy-${_this.activeTippy[0].id - 1}`);
              preTipTippy && preTipTippy.remove();
            } else {
              this.$EventBus.$emit('selectionTextChange', {
                state: true,
                tippyTplBarId: _this.tippyTplBarId
              });
              _this.$EventBus.$emit('tippyChange', {
                state: true
              });
            }
          } else if (text.length > 200) {
            _this.activeTippy[0].setContent(`<div style="color:#666;">可选文本最多为200字</div>`);
            _this.activeTippy[0].show();
            setTimeout(handler => {
              _this.activeTippy[0].hide();
            }, 2000);
          }
        }, 110);
      }
    },
    resetTempNote() {
      if (this.tempMarkEfiStr) {
        this.noteData.selectionText = '';
        this.markInstance.remove(this.tempMarkEfiStr, 'underline');
      }
    },
    actionCopy() {
      if (!this.noteData.selectionText) {
        this.$message.error('未选中任何内容');
        return;
      }
      let oInput = document.createElement('input');
      oInput.value = this.noteData.selectionText;
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand('Copy');
      oInput.remove();
      this.$message.success('复制成功');
      this.hideTippy();
      this.markEfiStr = '';
      this.noteData = {
        selectionText: '',
        content: ''
      };
      setTimeout(() => {
        window.getSelection()?.removeAllRanges();
      }, 300);
    },
    cancelEditNote(instance) {
      this.noteEditData = {
        selectionText: '',
        content: ''
      };
      this.noteOperateMode = '';
      this.tempMarkModel = {};
      instance.hide();
      instance.destroy();
    },
    deleteNote(instance) {
      let _this = this;
      let noteModel = {
        ...this.tempMarkModel
      };
      let markId = noteModel.markId;
      if (this.userType && this.insideIndex === this.ruleIndex) {
        let rollbackMark = noteModel.markEfiCode;
        this.emitRollbackHandler('deleteNote', noteModel).then(id => {
          id === markId && _this.markInstance.remove(rollbackMark, 'underline');
        });
      }
      this.cancelEditNote(instance);
    },
    confirmEditNote(noteInput, instance) {
      let value = noteInput?.value || '';
      if (!value) {
        this.$message.error('笔记内容不能为空');
        return;
      }
      let noteModel = {
        ...this.tempMarkModel,
        noteContent: value
      };
      if (this.userType && this.insideIndex === this.ruleIndex) {
        this.$EventBus.$emit('editNote', noteModel);
      }
      this.cancelEditNote(instance);
    },
    showEditNoteTippy() {
      let _this = this;
      try {
        const templateNote = document.getElementById(_this.editNoteTplId);
        let content = templateNote?.innerHTML || '笔记面板加载错误';
        // @pos 解决tippy不弹出问题
        let newTippy = tippy(`#${_this.blockId}`, {
          content,
          placement: 'top',
          trigger: 'manual',
          theme: 'light',
          animation: 'shift-away',
          interactive: true,
          allowHTML: true,
          followCursor: 'initial',
          onShown: instance => {
            // @pos 弹出编辑笔记tippy
            let actNoteCancel = instance.popper.children[0]?.querySelector(`#${_this.actNoteCancelId}`),
              actNoteDelete = instance.popper.children[0]?.querySelector(`#${_this.actNoteDeleteId}`),
              actNoteEditSave = instance.popper.children[0]?.querySelector(`#${_this.actNoteEditId}`),
              noteInput = instance.popper.children[0]?.querySelector(`#${_this.noteInputId}`);
            console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', '获取不到事件?', {
              actNoteCancel,
              actNoteDelete,
              actNoteEditSave,
              noteInput
            });
            if (noteInput) {
              noteInput.value = _this.noteEditData.content;
              noteInput.addEventListener('input', e => {
                let value = e.target.value;
                if (value === _this.noteEditData.content) {
                  actNoteEditSave && actNoteEditSave.parentElement.classList.add('disabled');
                } else {
                  actNoteEditSave && actNoteEditSave.parentElement.classList.remove('disabled');
                }
              });
            }
            if (actNoteCancel) {
              actNoteCancel.addEventListener('click', () => _this.cancelEditNote(instance), {
                once: true
              });
            }
            if (actNoteDelete) {
              actNoteDelete.addEventListener('click', () => _this.deleteNote(instance), {
                once: true
              });
            }
            if (actNoteEditSave && noteInput) {
              actNoteEditSave.addEventListener('click', () => _this.confirmEditNote(noteInput, instance), {
                once: true
              });
            }
          }
        });
        newTippy[0].show();
      } catch (error) {
        console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'error', error);
      }
    },
    // @pos 学生笔记编辑
    noteClick(e, markEfi) {
      let _this = this;
      let styleScheme = e.target.getAttribute('data-styleScheme');
      console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', '下划线样式', styleScheme);
      if (this.userType === 'student' && styleScheme === 'default') {
        // 学生和教师分别仅可触发各自对应的笔记下划线点击事件
        return;
      }
      let model = this.mergeMarkList.find(item => item.markEfiCode === markEfi);
      if (!model) {
        _this.activeTippy[0].setContent('查找笔记出错');
        _this.activeTippy[0].show();
        setTimeout(handler => {
          _this.hideTippy();
        }, 1500);
        return;
      }
      this.noteOperateMode = 'edit';
      this.tempMarkModel = model;
      if (this.userType && this.isMobile) {
        this.notePopupVisible = true;
        this.noteData = {
          selectionText: model.selectionText,
          content: model.noteContent
        };
      } else {
        this.noteEditData = {
          selectionText: model.selectionText,
          content: model.noteContent
        };
        this.$nextTick(() => {
          this.showEditNoteTippy(e);
        });
      }
    },
    actionAddNote(e) {
      console.log('eejieeieie', e);
      // @pos 添加笔记
      // e?.stopPropagation && e.stopPropagation()
      let _this = this;
      this.noteOperateMode = 'add';
      let defaultUnderlineStyle = this.evn.noteStyle;
      _this.markInstance.underline(_this.markEfiStr, defaultUnderlineStyle, e => {
        try {
          // 下划线点击事件, 比如打开编辑框
          let markEfiStr = e.target.getAttribute('data-id');
          console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', 'UnderlineClick', e, markEfiStr);
          _this.noteClick(e, markEfiStr);
        } catch (error) {
          console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'underline error', error);
        }
      });
      _this.tempMarkEfiStr = _this.markEfiStr;
      _this.noteData.content = '';
      console.log('this.isMobile', this.isMobile);
      if (!this.isMobile) {
        const templateNote = document.getElementById(_this.tippyTplNoteId);
        let content = templateNote?.innerHTML || '笔记面板加载错误';
        _this.activeTippy[0].setProps({
          content,
          onAfterUpdate: instance => {
            // @pos 更新tippy
            _this.noteEventController = new AbortController();
            let actNoteCancel = instance.popper.children[0]?.querySelector(`#${_this.actNoteCancelId}`),
              actNoteConfirm = instance.popper.children[0]?.querySelector(`#${_this.actNoteConfirmId}`),
              noteInput = instance.popper.children[0]?.querySelector(`#${_this.noteInputId}`);
            if (actNoteCancel && noteInput) {
              actNoteCancel.addEventListener('click', _this.cancelAddNote, {
                once: true
              });
            }
            if (actNoteConfirm) {
              actNoteConfirm.addEventListener('click', () => _this.confirmAddNote(noteInput), {
                signal: _this.noteEventController.signal
              });
            }
          },
          onUntrigger: instance => {
            console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'Untrigger');
          }
        });
      } else {
        this.hideTippy();
        this.notePopupVisible = true;
      }
      setTimeout(() => {
        window.getSelection()?.removeAllRanges();
      }, 300);
    },
    // 添加纠错
    actionAddError(e) {
      console.log('eejieeieie', e);
      // @pos 添加纠错
      // e?.stopPropagation && e.stopPropagation()
      let _this = this;
      this.noteOperateMode = 'add';
      this.evn.noteStyle;
      // _this.markInstance.underline(_this.markEfiStr, defaultUnderlineStyle, (e) => {
      //   try {
      //     // 下划线点击事件, 比如打开编辑框
      //     let markEfiStr = e.target.getAttribute('data-id')
      //     console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', 'UnderlineClick', e, markEfiStr)
      //     _this.noteClick(e, markEfiStr)
      //   } catch (error) {
      //     console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'underline error', error)
      //   }
      // })
      _this.tempMarkEfiStr = _this.markEfiStr;
      _this.noteError.content = '';
      console.log('this.isMobile', this.isMobile);
      if (!this.isMobile) {
        const templateNote = document.getElementById(_this.actionErrorTextId);
        let content = templateNote?.innerHTML || '笔记面板加载错误';
        _this.activeTippy[0].setProps({
          content,
          onAfterUpdate: instance => {
            // @pos 更新tippy
            _this.noteEventController = new AbortController();
            let errorCancel = instance.popper.children[0]?.querySelector(`#${_this.errorCancelId}`),
              errorConfirm = instance.popper.children[0]?.querySelector(`#${_this.errorConfirmId}`),
              noteInput = instance.popper.children[0]?.querySelector(`#${_this.errorInputId}`);
            if (errorCancel && noteInput) {
              errorCancel.addEventListener('click', _this.cancelAddNote, {
                once: true
              });
            }
            if (errorConfirm) {
              errorConfirm.addEventListener('click', () => _this.confirmAddError(noteInput), {
                signal: _this.noteEventController.signal
              });
            }
          },
          onUntrigger: instance => {
            console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'Untrigger');
          }
        });
      } else {
        this.hideTippy();
        this.errorPopupVisible = true;
      }
      setTimeout(() => {
        window.getSelection()?.removeAllRanges();
      }, 300);
    },
    // 提交纠错
    confirmAddError(content) {
      let noteContent = content?.value || '';
      console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', '内容', noteContent);
      if (!noteContent) {
        this.$message.error('请输入反馈内容');
        return;
      }
      if (!noteContent.trim()) {
        this.$message.error('反馈内容不能为空！');
        return;
      }
      this.hideTippy();
      let markId = `mark__${v4()}`;
      let noteModel = {
        selectionText: this.noteError.selectionText,
        noteContent,
        markEfiCode: this.markEfiStr,
        type: `note__${this.userType}`,
        styleType: this.evn.noteStyle,
        blockIndex: this.ruleIndex,
        markId
      };
      this.tempMarkEfiStr = '';
      this.noteError = {
        selectionText: '',
        content: ''
      };
      if (this.userType && this.insideIndex === this.ruleIndex) {
        let rollbackMark = this.markEfiStr;
        this.emitRollbackHandler('createError', noteModel).then(id => {
          id === markId && _this.markInstance.remove(rollbackMark, 'underline');
        });
      }
      this.errorPopupVisible = false;
    },
    confirmAddErrorPhone() {
      let noteContent = this.noteError.content;
      console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', '内容', noteContent);
      if (!noteContent) {
        this.$message.error('请输入反馈内容');
        return;
      }
      if (this.noteOperateMode === 'edit') {
        this.confirmEditStudentNote(noteContent);
        return;
      }
      let markId = `mark__${v4()}`;
      let noteModel = {
        selectionText: this.noteError.selectionText,
        noteContent,
        markEfiCode: this.markEfiStr,
        type: `note__${this.userType}`,
        styleType: this.evn.noteStyle,
        blockIndex: this.ruleIndex,
        markId
      };
      this.tempMarkEfiStr = '';
      this.noteError = {
        selectionText: '',
        content: ''
      };
      if (this.userType && this.insideIndex === this.ruleIndex) {
        let rollbackMark = this.markEfiStr;
        this.emitRollbackHandler('createError', noteModel).then(id => {
          id === markId && _this.markInstance.remove(rollbackMark, 'underline');
        });
      }
      this.errorPopupVisible = false;
    },
    confirmAddStudentNote() {
      let noteContent = this.noteData.content;
      console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', '内容', noteContent);
      if (!noteContent) {
        this.$message.error('请输入笔记内容');
        return;
      }
      if (this.noteOperateMode === 'edit') {
        this.confirmEditStudentNote(noteContent);
        return;
      }
      let markId = `mark__${v4()}`;
      let noteModel = {
        selectionText: this.noteData.selectionText,
        noteContent,
        markEfiCode: this.markEfiStr,
        type: `note__${this.userType}`,
        styleType: this.evn.noteStyle,
        blockIndex: this.ruleIndex,
        markId
      };
      this.tempMarkEfiStr = '';
      this.noteData = {
        selectionText: '',
        content: ''
      };
      if (this.userType && this.insideIndex === this.ruleIndex) {
        let rollbackMark = this.markEfiStr;
        this.emitRollbackHandler('createNote', noteModel).then(id => {
          id === markId && _this.markInstance.remove(rollbackMark, 'underline');
        });
      }
      this.notePopupVisible = false;
    },
    confirmEditStudentNote(noteContent) {
      let noteModel = {
        ...this.tempMarkModel,
        noteContent
      };
      this.tempMarkEfiStr = '';
      this.noteData = {
        selectionText: '',
        content: ''
      };
      if (this.userType && this.insideIndex === this.ruleIndex) {
        this.$EventBus.$emit('editNote', noteModel);
      }
      this.notePopupVisible = false;
      this.noteOperateMode = '';
      this.tempMarkModel = {};
    },
    deleteStudentNote() {
      let _this = this;
      let noteModel = {
        ...this.tempMarkModel
      };
      let markId = noteModel.markId;
      if (this.userType && this.insideIndex === this.ruleIndex) {
        let rollbackMark = noteModel.markEfiCode;
        this.emitRollbackHandler('deleteNote', noteModel).then(id => {
          id === markId && _this.markInstance.remove(rollbackMark, 'underline');
        });
      }
      this.notePopupVisible = false;
      this.noteOperateMode = '';
      this.tempMarkModel = {};
    },
    actionAddHighlight() {
      let _this = this;
      let styleType = this.evn.highlight;
      _this.markInstance.highlight(_this.markEfiStr, styleType, e => {
        try {
          let markEfiStr = e.target.getAttribute('data-id');
          _this.highlightClick(e, markEfiStr);
        } catch (error) {
          console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'underline error', error);
        }
      });
      this.hideTippy();
      let markId = `mark__${v4()}`;
      let model = {
        selectionText: this.noteData.selectionText,
        markEfiCode: this.markEfiStr,
        type: `highlight__${this.userType}`,
        styleType,
        blockIndex: this.ruleIndex,
        markId
      };
      this.noteData.selectionText = '';
      if (this.userType && this.insideIndex === this.ruleIndex) {
        // this.$EventBus.$emit('createHighlight', model)
        let rollbackMark = this.markEfiStr;
        this.emitRollbackHandler('createHighlight', model).then(id => {
          id === markId && _this.markInstance.remove(rollbackMark, 'highlight');
        });
      }
      setTimeout(() => {
        window.getSelection()?.removeAllRanges();
      }, 300);
    },
    actionAddLink() {
      let _this = this;
      let styleType = this.evn.linkStyle;
      _this.markInstance.underline(_this.markEfiStr, styleType, e => {
        try {
          let markEfiStr = e.target.getAttribute('data-id');
          _this.highlightClick(e, markEfiStr);
        } catch (error) {
          console.log('%c%s', 'font-size:2em;background: #DD5644;color: #FFF', 'underline error', error);
        }
      });
      this.hideTippy();
      let markId = `mark__${v4()}`;
      let model = {
        selectionText: this.noteData.selectionText,
        markEfiCode: this.markEfiStr,
        type: `link__${this.userType}`,
        styleType,
        blockIndex: this.ruleIndex,
        markId
      };
      this.noteData.selectionText = '';
      if (this.userType && this.insideIndex === this.ruleIndex) {
        // this.$EventBus.$emit('createHighlight', model)
        let rollbackMark = this.markEfiStr;
        this.emitRollbackHandler('createLink', model).then(id => {
          id === markId && _this.markInstance.remove(rollbackMark, 'underline');
        });
      }
      setTimeout(() => {
        window.getSelection()?.removeAllRanges();
      }, 300);
    },
    // 打开Ai解析
    actionOpenAi() {
      if (this.noteData.selectionText) {
        this.emitRollbackHandler('openAiParsing', {
          text: this.noteData.selectionText
        });
      }
      this.hideTippy();
      setTimeout(() => {
        window.getSelection()?.removeAllRanges();
      }, 300);
    },
    highlightClick(e, efi) {
      console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', 'HighLight Click', e, this.markEfiStr);
    },
    emitRollbackHandler(eventName, eventData) {
      console.log('emitRollbackHandler', eventName, eventData);
      return new Promise((resolve, reject) => {
        this.$EventBus.$emit(eventName, eventData, resolve);
      });
    },
    confirmAddNote(noteInput) {
      let value = noteInput?.value || '';
      if (!value) {
        this.$message.error('请输入笔记内容');
        return;
      }
      if (!value.trim()) {
        this.$message.error('笔记内容不能为空！');
        return;
      }
      this.hideTippy();
      let markId = `mark__${v4()}`;
      let noteModel = {
        selectionText: this.noteData.selectionText,
        noteContent: value,
        markEfiCode: this.markEfiStr,
        type: `note__${this.userType}`,
        styleType: this.evn.noteStyle,
        blockIndex: this.ruleIndex,
        markId
      };
      this.tempMarkEfiStr = '';
      this.noteData = {
        selectionText: '',
        content: ''
      };
      if (this.userType && this.insideIndex === this.ruleIndex) {
        let rollbackMark = this.markEfiStr;
        this.emitRollbackHandler('createNote', noteModel).then(id => {
          id === markId && _this.markInstance.remove(rollbackMark, 'underline');
        });
      }
      this.noteEventController.abort();
    },
    cancelAddNote() {
      this.hideTippy();
      this.markEfiStr && this.markInstance.remove(this.markEfiStr, 'underline');
      this.markEfiStr = '';
      this.noteData = {
        selectionText: '',
        content: ''
      };
    },
    hideTippy() {
      this.activeTippy[0].hide();
      this.activeTippy[0].setContent('');
    },
    formatImg(str) {
      if (str) {
        let data = str.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, p1) => {
          if (match.indexOf('style') !== -1) {
            // if (match.indexOf('http') !== -1) {
            //   return match
            // } else {
            //   let src = this.resourceBasisPath + p1.split('./')[1]
            //   let image = match.replace(p1, src)
            //   return image.split('style="')[0] + 'style="max-width:100% !important;' + image.split('style="')[1]
            // }
            let src = this.resourceBasisPath + p1.split('./')[1];
            let image = match.indexOf('http') !== -1 ? match : match.replace(p1, src);
            return image.split('style="')[0] + 'style="max-width:100% !important;' + image.split('style="')[1];
          } else if (match.indexOf('width') !== -1) {
            let src = this.resourceBasisPath + p1.split('./')[1];
            let image = match.indexOf('http') !== -1 ? match : match.replace(p1, src);
            let list = image.split('<img');
            return `<img style="max-width:100% !important;"${list[1]}`;
          } else {
            return `<img src='${p1.indexOf('http') > -1 ? p1 : this.resourceBasisPath + p1.split('./')[1]}' style="max-width:100%;" />`;
          }
        });
        return data;
      }
    },
    updateCodeBlock() {
      jquery(`#${this.blockId} .richtext-reset-wrapper--view pre`).each(function (i) {
        let classStrs = jquery(this).attr('class');
        let classArr = classStrs.split(';');
        classArr = classArr[0].split(':');
        let lang = 'language-' + classArr[1];
        let codeElemStr = '<code class="line-numbers ' + lang + '" data-prismjs-copy="复制代码" data-prismjs-copy-success="复制完成">' + jquery(this).html() + '</code>';
        jquery(this).html(codeElemStr);
        jquery(this).attr('class', 'line-numbers');
        let codeElem = jquery(this).children('code').get(0);
        // Prism.highlightAll();
        prism.highlightElement(codeElem);
      });
    },
    groupDataChange() {
      this.$emit('groupDataChange', {
        ruleIndex: this.ruleIndex,
        dataName: this.blockDataName,
        data: this.blockData,
        dataIndex: this.dataIndex
      });
    },
    //编辑器是否存在
    getIsEditorContainerExist() {
      const container = document.getElementById(this.editorId);
      if (!container) return false;
      const isWeExist = container.getAttribute('data-w-e-textarea');
      return isWeExist;
    },
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      console.log('blockClick11111');
      // this.markEfiStr = ''
      this.hideTippy();
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex,
        dataIndex: this.dataIndex
      });
    },
    openDictionary() {
      if (!this.noteData.selectionText) {
        this.$message.error('未选中任何内容');
        return;
      }
      // let url = `https://fanyi.baidu.com/mtpe-individual/multimodal?query=${this.noteData.selectionText}&lang=zh2en`
      let url = `https://dict.baidu.com/s?wd=${this.noteData.selectionText}&device=pc&from=home`;
      this.openLink(url);
    },
    openEncyclopedias() {
      if (!this.noteData.selectionText) {
        this.$message.error('未选中任何内容');
        return;
      }
      let url = 'https://baike.baidu.com/item/' + this.noteData.selectionText;
      this.openLink(url);
    },
    openLink(url) {
      if (this.pageType == 'pc') {
        window.open(url);
      } else {
        this.$EventBus.$emit('xmlOpenLink', {
          url
        });
      }
      this.hideTippy();
    }
  }
};

/* script */
const __vue_script__$65 = script$65;
/* template */
var __vue_render__$64 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      class: [
        "xml-text-" + _vm.pageType,
        "" + _vm.containerClass,
        "" +
          (_vm.currentRule.data.pGroupData.className
            ? _vm.currentRule.data.pGroupData.className
            : ""),
        "richtext-reset-container",
      ],
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick, mouseup: _vm.handleMouseUp },
    },
    [
      _vm.mode === "editor"
        ? _vm._t("editor", null, { feedback: _vm.feedback })
        : _c(
            "div",
            {
              staticClass: "richtext-reset-wrapper--view",
              class: [_vm.isPureTextComponent && "pure-text-component"],
              attrs: { id: _vm.markRootId },
            },
            [
              _c("section", {
                ref: "richtextSectionWrap",
                class: _vm.isImportContent && "docx",
                domProps: { innerHTML: _vm._s(_vm.richContent) },
              }),
            ]
          ),
      _vm._v(" "),
      _vm._t("mater-lib-dialog"),
      _vm._v(" "),
      _vm._t("mater-lib-dialog2"),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          staticClass: "xml-text-preview-box-dialog",
          attrs: {
            visible: _vm.inlineWordsModal.visible,
            "append-to-body": true,
            width: _vm.pageType == "pc" ? "40%" : "80%",
            center: "",
            "show-close": false,
          },
          on: {
            "update:visible": function ($event) {
              return _vm.$set(_vm.inlineWordsModal, "visible", $event)
            },
          },
        },
        [
          _c("xml-text-dialog-render", {
            attrs: {
              content: _vm.inlineWordsModal.content,
              textstyle: _vm.inlineWordsModal.stylemode
                ? _vm.inlineWordsModal.stylemode
                : "D",
              "page-type": _vm.pageType,
              resourceBasisPath: _vm.resourceBasisPath,
            },
          }),
        ],
        1
      ),
      _vm._v(" "),
      _c(
        "div",
        { staticStyle: { display: "none" }, attrs: { id: _vm.tippyTplBarId } },
        [
          _vm.isMobile && _vm.evn.tippy.maxWordCount
            ? _c("div", { staticClass: "tipbar-remark--mobile" }, [
                _c("span", { staticClass: "tipbar-remark" }, [
                  _vm._v("均<=200字"),
                ]),
              ])
            : _vm._e(),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "tipbar tipbar-tpl",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                },
              },
            },
            [
              _vm.evn.tippy.copy
                ? [
                    _c(
                      "div",
                      {
                        staticClass: "tipbar-action",
                        attrs: { id: _vm.actionCopyId },
                        on: {
                          click: function ($event) {
                            $event.stopPropagation();
                            return _vm.actionCopy.apply(null, arguments)
                          },
                        },
                      },
                      [
                        _vm.evn.tippy.copyIcon
                          ? _c("i", {
                              staticClass: "tipbar-icon",
                              class: _vm.evn.tippy.copyIcon,
                            })
                          : _vm._e(),
                        _vm._v(" "),
                        _c("span", [_vm._v("复制")]),
                      ]
                    ),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _vm.evn.tippy.note
                ? [
                    _vm.evn.tippy.noteLine
                      ? _c("span", { staticClass: "tipbar-separator" }, [
                          _vm._v("|"),
                        ])
                      : _vm._e(),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticClass: "tipbar-action",
                        attrs: { id: _vm.actionNoteId },
                        on: {
                          click: function ($event) {
                            $event.stopPropagation();
                            return _vm.actionAddNote.apply(null, arguments)
                          },
                        },
                      },
                      [
                        _vm.evn.tippy.noteIcon
                          ? _c("i", {
                              staticClass: "tipbar-icon",
                              class: _vm.evn.tippy.noteIcon,
                            })
                          : _vm._e(),
                        _vm._v(" "),
                        _c("span", [_vm._v("笔记")]),
                      ]
                    ),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _vm.evn.tippy.resources
                ? _c(
                    "div",
                    {
                      staticClass: "tipbar-action",
                      attrs: { id: _vm.addTeacherResourcesId },
                      on: {
                        click: function ($event) {
                          return _vm.addTeacherResources()
                        },
                      },
                    },
                    [
                      _c(
                        "span",
                        {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: _vm.evn.tippy.resourcesLine,
                              expression: "evn.tippy.resourcesLine",
                            },
                          ],
                          staticClass: "tipbar-separator",
                        },
                        [_vm._v("|")]
                      ),
                      _vm._v(" "),
                      _vm.evn.tippy.resourcesIcon
                        ? _c("i", {
                            staticClass: "tipbar-icon",
                            class: _vm.evn.tippy.resourcesIcon,
                          })
                        : _vm._e(),
                      _vm._v(" "),
                      _c("span", [_vm._v("资源")]),
                    ]
                  )
                : _vm._e(),
              _vm._v(" "),
              _vm.evn.tippy.highlight
                ? [
                    _c(
                      "span",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: _vm.evn.tippy.highlightLine,
                            expression: "evn.tippy.highlightLine",
                          },
                        ],
                        staticClass: "tipbar-separator",
                      },
                      [_vm._v("|")]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticClass: "tipbar-action",
                        attrs: { id: _vm.actionHighlightId },
                      },
                      [
                        _vm.evn.tippy.highlightIcon
                          ? _c("i", {
                              staticClass: "tipbar-icon",
                              class: _vm.evn.tippy.highlightIcon,
                            })
                          : _vm._e(),
                        _vm._v(" "),
                        _c("span", [_vm._v("高亮")]),
                      ]
                    ),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _vm.evn.tippy.error
                ? [
                    _vm.evn.tippy.noteLine
                      ? _c("span", { staticClass: "tipbar-separator" }, [
                          _vm._v("|"),
                        ])
                      : _vm._e(),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticClass: "tipbar-action",
                        attrs: { id: _vm.actionErrorId },
                        on: {
                          click: function ($event) {
                            $event.stopPropagation();
                            return _vm.actionAddError.apply(null, arguments)
                          },
                        },
                      },
                      [
                        _vm.evn.tippy.errorIcon
                          ? _c("i", {
                              staticClass: "tipbar-icon",
                              class: _vm.evn.tippy.errorIcon,
                            })
                          : _vm._e(),
                        _vm._v(" "),
                        _c("span", [_vm._v("纠错")]),
                      ]
                    ),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _vm.evn.tippy.link
                ? [
                    _c(
                      "span",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: _vm.evn.tippy.linkLine,
                            expression: "evn.tippy.linkLine",
                          },
                        ],
                        staticClass: "tipbar-separator",
                      },
                      [_vm._v("|")]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticClass: "tipbar-action",
                        attrs: { id: _vm.actionLinkId },
                      },
                      [
                        _vm.evn.tippy.linkIcon
                          ? _c("i", {
                              staticClass: "tipbar-icon",
                              class: _vm.evn.tippy.linkIcon,
                            })
                          : _vm._e(),
                        _vm._v(" "),
                        _c("span", [_vm._v("划线")]),
                      ]
                    ),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _vm.evn.tippy.Ai && _vm.isShowAi
                ? [
                    _c(
                      "span",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: _vm.evn.tippy.AiLine,
                            expression: "evn.tippy.AiLine",
                          },
                        ],
                        staticClass: "tipbar-separator",
                      },
                      [_vm._v("|")]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticClass: "tipbar-action",
                        attrs: { id: _vm.actionAiId },
                      },
                      [
                        _vm.evn.tippy.AiIcon
                          ? _c("i", {
                              staticClass: "tipbar-icon",
                              class: _vm.evn.tippy.AiIcon,
                            })
                          : _vm._e(),
                        _vm._v(" "),
                        _c("span", [_vm._v(_vm._s(_vm.evn.tippy.AiName))]),
                      ]
                    ),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _vm.evn.tippy.dictionary
                ? [
                    _vm.evn.tippy.dictionaryLine
                      ? _c("span", { staticClass: "tipbar-separator" }, [
                          _vm._v("|"),
                        ])
                      : _vm._e(),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticClass: "tipbar-action",
                        attrs: { id: _vm.actionDictionaryId },
                      },
                      [
                        _vm.evn.tippy.dictionaryIcon
                          ? _c("i", {
                              staticClass: "tipbar-icon",
                              class: _vm.evn.tippy.dictionaryIcon,
                            })
                          : _vm._e(),
                        _vm._v(" "),
                        _c("span", [_vm._v("词典")]),
                      ]
                    ),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _vm.evn.tippy.encyclopedias
                ? [
                    _vm.evn.tippy.encyclopediasLine
                      ? _c("span", { staticClass: "tipbar-separator" }, [
                          _vm._v("|"),
                        ])
                      : _vm._e(),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticClass: "tipbar-action",
                        attrs: { id: _vm.actionEncyclopediasId },
                      },
                      [
                        _vm.evn.tippy.encyclopediasIcon
                          ? _c("i", {
                              staticClass: "tipbar-icon",
                              class: _vm.evn.tippy.encyclopediasIcon,
                            })
                          : _vm._e(),
                        _vm._v(" "),
                        _c("span", [_vm._v("百科")]),
                      ]
                    ),
                  ]
                : _vm._e(),
              _vm._v(" "),
              !_vm.isMobile && _vm.evn.tippy.maxWordCount
                ? _c("span", { staticClass: "tipbar-remark" }, [
                    _vm._v("均<=200字"),
                  ])
                : _vm._e(),
            ],
            2
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "div",
        { staticStyle: { display: "none" }, attrs: { id: _vm.tippyTplNoteId } },
        [
          _c("div", { staticClass: "tipnote tipnote-tpl" }, [
            _c("div", { staticClass: "tipnote-title" }, [
              _vm._v(_vm._s(_vm.noteData.selectionText)),
            ]),
            _vm._v(" "),
            _c("textarea", {
              directives: [
                {
                  name: "model",
                  rawName: "v-model.trim",
                  value: _vm.noteData.content,
                  expression: "noteData.content",
                  modifiers: { trim: true },
                },
              ],
              ref: "tippyTextarea",
              staticClass: "tipnote-textarea",
              attrs: {
                id: _vm.noteInputId,
                placeholder: "请输入笔记内容",
                maxlength: "200",
                rows: "5",
              },
              domProps: { value: _vm.noteData.content },
              on: {
                input: function ($event) {
                  if ($event.target.composing) {
                    return
                  }
                  _vm.$set(_vm.noteData, "content", $event.target.value.trim());
                },
                blur: function ($event) {
                  return _vm.$forceUpdate()
                },
              },
            }),
            _vm._v(" "),
            _c("div", { staticClass: "tipnote-footer" }, [
              _c(
                "div",
                {
                  staticClass: "tipnote-btn cancel",
                  attrs: { id: _vm.actNoteCancelId },
                  on: { click: _vm.cancelAddNote },
                },
                [_c("span", [_vm._v("取消")])]
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "tipnote-btn confirm",
                  attrs: { id: _vm.actNoteConfirmId },
                  on: { click: _vm.confirmAddNote },
                },
                [_c("span", [_vm._v("确认")])]
              ),
            ]),
          ]),
        ]
      ),
      _vm._v(" "),
      _c(
        "div",
        {
          staticStyle: { display: "none" },
          attrs: { id: _vm.actionErrorTextId },
        },
        [
          _c("div", { staticClass: "tipnote tipnote-tpl" }, [
            _c("div", { staticClass: "tipnote-title" }, [
              _vm._v(_vm._s(_vm.noteError.selectionText)),
            ]),
            _vm._v(" "),
            _c("textarea", {
              directives: [
                {
                  name: "model",
                  rawName: "v-model.trim",
                  value: _vm.noteError.content,
                  expression: "noteError.content",
                  modifiers: { trim: true },
                },
              ],
              ref: "tippyTextarea",
              staticClass: "tipnote-textarea",
              attrs: {
                id: _vm.errorInputId,
                placeholder: "请输入反馈内容",
                maxlength: "200",
                rows: "5",
              },
              domProps: { value: _vm.noteError.content },
              on: {
                input: function ($event) {
                  if ($event.target.composing) {
                    return
                  }
                  _vm.$set(_vm.noteError, "content", $event.target.value.trim());
                },
                blur: function ($event) {
                  return _vm.$forceUpdate()
                },
              },
            }),
            _vm._v(" "),
            _c("div", { staticClass: "tipnote-footer" }, [
              _c(
                "div",
                {
                  staticClass: "tipnote-btn cancel",
                  attrs: { id: _vm.errorCancelId },
                  on: { click: _vm.cancelAddNote },
                },
                [_c("span", [_vm._v("取消")])]
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "tipnote-btn confirm",
                  attrs: { id: _vm.errorConfirmId },
                  on: { click: _vm.confirmAddError },
                },
                [_c("span", [_vm._v("确认")])]
              ),
            ]),
          ]),
        ]
      ),
      _vm._v(" "),
      _c(
        "div",
        { staticStyle: { display: "none" }, attrs: { id: _vm.editNoteTplId } },
        [
          _c("div", { staticClass: "tipnote tipnote-tpl" }, [
            _c("div", { staticClass: "tipnote-title" }, [
              _vm._v(_vm._s(_vm.noteEditData.selectionText)),
            ]),
            _vm._v(" "),
            _c("textarea", {
              ref: "tippyTextarea",
              staticClass: "tipnote-textarea",
              attrs: {
                id: _vm.noteInputId,
                placeholder: "请输入笔记内容",
                maxlength: "200",
                rows: "5",
              },
              domProps: { value: _vm.noteEditData.content },
            }),
            _vm._v(" "),
            _c("div", { staticClass: "tipnote-footer" }, [
              _c(
                "div",
                {
                  staticClass: "tipnote-btn cancel",
                  attrs: { id: _vm.actNoteCancelId },
                },
                [_c("span", [_vm._v("取消")])]
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "tipnote-btn delete",
                  attrs: { id: _vm.actNoteDeleteId },
                },
                [_c("span", [_vm._v("删除")])]
              ),
              _vm._v(" "),
              _c("div", { staticClass: "tipnote-btn btn-wrap disabled" }, [
                _c(
                  "div",
                  { staticClass: "btn-edit", attrs: { id: _vm.actNoteEditId } },
                  [_c("span", [_vm._v("保存修改")])]
                ),
              ]),
            ]),
          ]),
        ]
      ),
      _vm._v(" "),
      _vm.isMobile
        ? _c(
            "van-popup",
            {
              style: { backgroundColor: "transparent" },
              attrs: { "get-container": "body", position: "bottom" },
              on: { "click-overlay": _vm.resetTempNote },
              model: {
                value: _vm.notePopupVisible,
                callback: function ($$v) {
                  _vm.notePopupVisible = $$v;
                },
                expression: "notePopupVisible",
              },
            },
            [
              _c(
                "div",
                {
                  staticClass: "xml-reader-phone-mark-note-popup",
                  class: [
                    _vm.toolbarVisible &&
                      !_vm.keyboardShow &&
                      "is-toolbar-shown",
                    _vm.keyboardShow && "keyboard-show",
                    _vm.toolbarVisible && "toolbar-show",
                  ],
                  on: {
                    click: function ($event) {
                      $event.stopPropagation();
                    },
                  },
                },
                [
                  _c("div", { staticClass: "mark-note__selection" }, [
                    _c("div", [_vm._v(_vm._s(_vm.noteData.selectionText))]),
                  ]),
                  _vm._v(" "),
                  _c("section", { staticClass: "mark-note__wrap" }, [
                    _c("textarea", {
                      directives: [
                        {
                          name: "model",
                          rawName: "v-model.trim",
                          value: _vm.noteData.content,
                          expression: "noteData.content",
                          modifiers: { trim: true },
                        },
                      ],
                      ref: "popupTextarea",
                      staticClass: "mark-note__textarea",
                      attrs: {
                        placeholder: "添加笔记...",
                        maxlength: "200",
                        rows: "5",
                      },
                      domProps: { value: _vm.noteData.content },
                      on: {
                        input: function ($event) {
                          if ($event.target.composing) {
                            return
                          }
                          _vm.$set(
                            _vm.noteData,
                            "content",
                            $event.target.value.trim()
                          );
                        },
                        blur: function ($event) {
                          return _vm.$forceUpdate()
                        },
                      },
                    }),
                    _vm._v(" "),
                    _c("div", { staticClass: "mark-note__footer" }, [
                      _c("div", { staticClass: "mark-note__count" }, [
                        _vm._v(_vm._s(_vm.noteData.content.length) + "/200"),
                      ]),
                      _vm._v(" "),
                      _vm.noteOperateMode === "edit"
                        ? _c(
                            "div",
                            {
                              staticClass: "mark-note__delete",
                              on: {
                                click: function ($event) {
                                  if ($event.target !== $event.currentTarget) {
                                    return null
                                  }
                                  return _vm.deleteStudentNote.apply(
                                    null,
                                    arguments
                                  )
                                },
                              },
                            },
                            [_vm._v("删除")]
                          )
                        : _vm._e(),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "mark-note__confirm",
                          class: _vm.noteData.content.length && "enable",
                          on: {
                            click: function ($event) {
                              if ($event.target !== $event.currentTarget) {
                                return null
                              }
                              return _vm.confirmAddStudentNote.apply(
                                null,
                                arguments
                              )
                            },
                          },
                        },
                        [_vm._v("\n            保存\n          ")]
                      ),
                    ]),
                  ]),
                ]
              ),
            ]
          )
        : _vm._e(),
      _vm._v(" "),
      _vm.isMobile
        ? _c(
            "van-popup",
            {
              style: { backgroundColor: "transparent" },
              attrs: { "get-container": "body", position: "bottom" },
              on: { "click-overlay": _vm.resetTempNote },
              model: {
                value: _vm.errorPopupVisible,
                callback: function ($$v) {
                  _vm.errorPopupVisible = $$v;
                },
                expression: "errorPopupVisible",
              },
            },
            [
              _c(
                "div",
                {
                  staticClass: "xml-reader-phone-mark-note-popup",
                  class: [
                    _vm.toolbarVisible &&
                      !_vm.keyboardShow &&
                      "is-toolbar-shown",
                    _vm.keyboardShow && "keyboard-show",
                    _vm.toolbarVisible && "toolbar-show",
                  ],
                  on: {
                    click: function ($event) {
                      $event.stopPropagation();
                    },
                  },
                },
                [
                  _c("div", { staticClass: "mark-note__selection" }, [
                    _c("div", [_vm._v(_vm._s(_vm.noteError.selectionText))]),
                  ]),
                  _vm._v(" "),
                  _c("section", { staticClass: "mark-note__wrap" }, [
                    _c("textarea", {
                      directives: [
                        {
                          name: "model",
                          rawName: "v-model.trim",
                          value: _vm.noteError.content,
                          expression: "noteError.content",
                          modifiers: { trim: true },
                        },
                      ],
                      ref: "popupTextarea",
                      staticClass: "mark-note__textarea",
                      attrs: {
                        placeholder: "添加反馈...",
                        maxlength: "200",
                        rows: "5",
                      },
                      domProps: { value: _vm.noteError.content },
                      on: {
                        input: function ($event) {
                          if ($event.target.composing) {
                            return
                          }
                          _vm.$set(
                            _vm.noteError,
                            "content",
                            $event.target.value.trim()
                          );
                        },
                        blur: function ($event) {
                          return _vm.$forceUpdate()
                        },
                      },
                    }),
                    _vm._v(" "),
                    _c("div", { staticClass: "mark-note__footer" }, [
                      _c("div", { staticClass: "mark-note__count" }, [
                        _vm._v(_vm._s(_vm.noteError.content.length) + "/200"),
                      ]),
                      _vm._v(" "),
                      _vm.noteOperateMode === "edit"
                        ? _c(
                            "div",
                            {
                              staticClass: "mark-note__delete",
                              on: {
                                click: function ($event) {
                                  if ($event.target !== $event.currentTarget) {
                                    return null
                                  }
                                  return _vm.deleteStudentNote.apply(
                                    null,
                                    arguments
                                  )
                                },
                              },
                            },
                            [_vm._v("删除")]
                          )
                        : _vm._e(),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "mark-note__confirm",
                          class: _vm.noteError.content.length && "enable",
                          on: {
                            click: function ($event) {
                              if ($event.target !== $event.currentTarget) {
                                return null
                              }
                              return _vm.confirmAddErrorPhone.apply(
                                null,
                                arguments
                              )
                            },
                          },
                        },
                        [_vm._v("\n            提交\n          ")]
                      ),
                    ]),
                  ]),
                ]
              ),
            ]
          )
        : _vm._e(),
    ],
    2
  )
};
var __vue_staticRenderFns__$64 = [];
__vue_render__$64._withStripped = true;

  /* style */
  const __vue_inject_styles__$65 = undefined;
  /* scoped */
  const __vue_scope_id__$65 = "data-v-b3b65640";
  /* module identifier */
  const __vue_module_identifier__$65 = undefined;
  /* functional template */
  const __vue_is_functional_template__$65 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$65 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$64, staticRenderFns: __vue_staticRenderFns__$64 },
    __vue_inject_styles__$65,
    __vue_script__$65,
    __vue_scope_id__$65,
    __vue_is_functional_template__$65,
    __vue_module_identifier__$65,
    false,
    undefined,
    undefined,
    undefined
  );

let component = ['', __vue_component__$65]; // 组件列表

var script$64 = {
  name: 'xmlRender',
  props: {
    data: {
      type: Object,
      default: () => ({})
    },
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    bookReaderPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isReader: {
      // 是否阅读器
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      // component: ["", XmlTextRender], // 组件列表
      style: {
        '--background-color': this.pGroupData.renderData.data.themeColor,
        '--title-align': this.pGroupData.renderData.data.align
      }
    };
  },
  methods: {
    /**
     * 递归生成渲染函数
     * @param {Array} data - 节点数据
     * @param {number} serial - 层级序号
     * @returns {Array} - 渲染结果
     */
    JSONTurnRender(data, serial) {
      console.log(data, '数据333');
      let children = []; // 用于收集所有子节点

      for (let i = 0; i < data.length; i++) {
        let item = data[i];
        // 优先使用 props.text 作为内容
        let content = '';
        if (item.props) {
          content = item.props.text;
          console.log(content, '内容');
        } else {
          content = item.content;
        }
        // 递归生成子节点
        const childNodes = item.children && item.children.length > 0 ? this.JSONTurnRender(item.children, serial + 1) : content; // 使用 props.text 或 content
        //  if(item.props.text =='') {

        //  }

        // 创建当前节点的渲染结果
        const xmlRender = this.$createElement(item.type == 0 ? item.tagName : component[item.tagName],
        // item.type == 0 ? item.tagName : 'div',
        {
          class: item.class,
          // props:{...item.props,mode:'reader',pBlockData:{html:'<p>ddddddddd</p>'}},
          // props:{mode:'reader',pBlockData:{html:'ddddddddd'},currentRule:{data:{pGroupData:{html:'ddddddddd'}}}},
          props: {
            mode: this.mode,
            pBlockData: {
              html: content
            },
            currentRule: {
              data: {
                pGroupData: {
                  html: content
                }
              }
            },
            ruleIndex: this.ruleIndex
          },
          style: serial === 0 ? this.style : {}
        }, childNodes // 子节点或文本内容
        );
        // 将当前节点的渲染结果添加到 children 数组
        children.push(xmlRender);
      }

      // 返回所有子节点
      console.log(children, '子节点');
      return children;
    }
  },
  render(h) {
    // 调用递归函数并返回渲染结果

    return h('div', this.JSONTurnRender(this.pGroupData.renderData.data.tagList, 0));
  }
};

/* script */
const __vue_script__$64 = script$64;
/* template */

  /* style */
  const __vue_inject_styles__$64 = undefined;
  /* scoped */
  const __vue_scope_id__$64 = "data-v-3dc783b6";
  /* module identifier */
  const __vue_module_identifier__$64 = undefined;
  /* functional template */
  const __vue_is_functional_template__$64 = undefined;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$64 = /*#__PURE__*/normalizeComponent(
    {},
    __vue_inject_styles__$64,
    __vue_script__$64,
    __vue_scope_id__$64,
    __vue_is_functional_template__$64,
    __vue_module_identifier__$64,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$64.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('render', {
    prefix: options.prefix
  }), __vue_component__$64);
};

var defaultLang = {
  el: {
    colorpicker: {
      confirm: '确定',
      clear: '清空'
    },
    datepicker: {
      now: '此刻',
      today: '今天',
      cancel: '取消',
      clear: '清空',
      confirm: '确定',
      selectDate: '选择日期',
      selectTime: '选择时间',
      startDate: '开始日期',
      startTime: '开始时间',
      endDate: '结束日期',
      endTime: '结束时间',
      prevYear: '前一年',
      nextYear: '后一年',
      prevMonth: '上个月',
      nextMonth: '下个月',
      year: '年',
      month1: '1 月',
      month2: '2 月',
      month3: '3 月',
      month4: '4 月',
      month5: '5 月',
      month6: '6 月',
      month7: '7 月',
      month8: '8 月',
      month9: '9 月',
      month10: '10 月',
      month11: '11 月',
      month12: '12 月',
      // week: '周次',
      weeks: {
        sun: '日',
        mon: '一',
        tue: '二',
        wed: '三',
        thu: '四',
        fri: '五',
        sat: '六'
      },
      months: {
        jan: '一月',
        feb: '二月',
        mar: '三月',
        apr: '四月',
        may: '五月',
        jun: '六月',
        jul: '七月',
        aug: '八月',
        sep: '九月',
        oct: '十月',
        nov: '十一月',
        dec: '十二月'
      }
    },
    select: {
      loading: '加载中',
      noMatch: '无匹配数据',
      noData: '无数据',
      placeholder: '请选择'
    },
    cascader: {
      noMatch: '无匹配数据',
      loading: '加载中',
      placeholder: '请选择',
      noData: '暂无数据'
    },
    pagination: {
      goto: '前往',
      pagesize: '条/页',
      total: '共 {total} 条',
      pageClassifier: '页'
    },
    messagebox: {
      title: '提示',
      confirm: '确定',
      cancel: '取消',
      error: '输入的数据不合法!'
    },
    upload: {
      deleteTip: '按 delete 键可删除',
      delete: '删除',
      preview: '查看图片',
      continue: '继续上传'
    },
    table: {
      emptyText: '暂无数据',
      confirmFilter: '筛选',
      resetFilter: '重置',
      clearFilter: '全部',
      sumText: '合计'
    },
    tree: {
      emptyText: '暂无数据'
    },
    transfer: {
      noMatch: '无匹配数据',
      noData: '无数据',
      titles: ['列表 1', '列表 2'],
      filterPlaceholder: '请输入搜索内容',
      noCheckedFormat: '共 {total} 项',
      hasCheckedFormat: '已选 {checked}/{total} 项'
    },
    image: {
      error: '加载失败'
    },
    pageHeader: {
      title: '返回'
    },
    popconfirm: {
      confirmButtonText: '确定',
      cancelButtonText: '取消'
    },
    empty: {
      description: '暂无数据'
    }
  }
};

var isMergeableObject = function isMergeableObject(value) {
  return isNonNullObject(value) && !isSpecial(value);
};
function isNonNullObject(value) {
  return !!value && typeof value === 'object';
}
function isSpecial(value) {
  var stringValue = Object.prototype.toString.call(value);
  return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value);
}

// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
function isReactElement(value) {
  return value.$$typeof === REACT_ELEMENT_TYPE;
}
function emptyTarget(val) {
  return Array.isArray(val) ? [] : {};
}
function cloneIfNecessary(value, optionsArgument) {
  var clone = optionsArgument && optionsArgument.clone === true;
  return clone && isMergeableObject(value) ? deepmerge(emptyTarget(value), value, optionsArgument) : value;
}
function defaultArrayMerge(target, source, optionsArgument) {
  var destination = target.slice();
  source.forEach(function (e, i) {
    if (typeof destination[i] === 'undefined') {
      destination[i] = cloneIfNecessary(e, optionsArgument);
    } else if (isMergeableObject(e)) {
      destination[i] = deepmerge(target[i], e, optionsArgument);
    } else if (target.indexOf(e) === -1) {
      destination.push(cloneIfNecessary(e, optionsArgument));
    }
  });
  return destination;
}
function mergeObject(target, source, optionsArgument) {
  var destination = {};
  if (isMergeableObject(target)) {
    Object.keys(target).forEach(function (key) {
      destination[key] = cloneIfNecessary(target[key], optionsArgument);
    });
  }
  Object.keys(source).forEach(function (key) {
    if (!isMergeableObject(source[key]) || !target[key]) {
      destination[key] = cloneIfNecessary(source[key], optionsArgument);
    } else {
      destination[key] = deepmerge(target[key], source[key], optionsArgument);
    }
  });
  return destination;
}
function deepmerge(target, source, optionsArgument) {
  var sourceIsArray = Array.isArray(source);
  var targetIsArray = Array.isArray(target);
  var options = optionsArgument || {
    arrayMerge: defaultArrayMerge
  };
  var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
  if (!sourceAndTargetTypesMatch) {
    return cloneIfNecessary(source, optionsArgument);
  } else if (sourceIsArray) {
    var arrayMerge = options.arrayMerge || defaultArrayMerge;
    return arrayMerge(target, source, optionsArgument);
  } else {
    return mergeObject(target, source, optionsArgument);
  }
}
deepmerge.all = function deepmergeAll(array, optionsArgument) {
  if (!Array.isArray(array) || array.length < 2) {
    throw new Error('first argument should be an array with at least two elements');
  }

  // we are sure there are at least 2 values, so it is safe to have no initial value
  return array.reduce(function (prev, next) {
    return deepmerge(prev, next, optionsArgument);
  });
};
var deepmerge_1 = deepmerge;

const RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g;
/**
 *  String format template
 *  - Inspired:
 *    https://github.com/Matt-Esch/string-template/index.js
 */
function Format (Vue) {
  /**
   * template
   *
   * @param {String} string
   * @param {Array} ...args
   * @return {String}
   */

  function template(string, ...args) {
    if (args.length === 1 && typeof args[0] === 'object') {
      args = args[0];
    }
    if (!args || !args.hasOwnProperty) {
      args = {};
    }
    return string.replace(RE_NARGS, (match, prefix, i, index) => {
      let result;
      if (string[index - 1] === '{' && string[index + match.length] === '}') {
        return i;
      } else {
        result = hasOwn$1(args, i) ? args[i] : null;
        if (result === null || result === undefined) {
          return '';
        }
        return result;
      }
    });
  }
  return template;
}

const format$1 = Format();
let lang = defaultLang;
let merged = false;
let i18nHandler = function () {
  const vuei18n = Object.getPrototypeOf(this || Vue).$t;
  if (typeof vuei18n === 'function' && !!Vue.locale) {
    if (!merged) {
      merged = true;
      Vue.locale(Vue.config.lang, deepmerge_1(lang, Vue.locale(Vue.config.lang) || {}, {
        clone: true
      }));
    }
    return vuei18n.apply(this, arguments);
  }
};
const t = function (path, options) {
  let value = i18nHandler.apply(this, arguments);
  if (value !== null && value !== undefined) return value;
  const array = path.split('.');
  let current = lang;
  for (let i = 0, j = array.length; i < j; i++) {
    const property = array[i];
    value = current[property];
    if (i === j - 1) return format$1(value, options);
    if (!value) return '';
    current = value;
  }
  return '';
};

var Locale = {
  methods: {
    t(...args) {
      return t.apply(this, args);
    }
  }
};

/* eslint-disable no-undefined,no-param-reassign,no-shadow */

/**
 * Throttle execution of a function. Especially useful for rate limiting
 * execution of handlers on events like resize and scroll.
 *
 * @param  {Number}    delay          A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
 * @param  {Boolean}   [noTrailing]   Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
 *                                    throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
 *                                    after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
 *                                    the internal counter is reset)
 * @param  {Function}  callback       A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
 *                                    to `callback` when the throttled-function is executed.
 * @param  {Boolean}   [debounceMode] If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
 *                                    schedule `callback` to execute after `delay` ms.
 *
 * @return {Function}  A new, throttled, function.
 */
var throttle$2 = function (delay, noTrailing, callback, debounceMode) {
  // After wrapper has stopped being called, this timeout ensures that
  // `callback` is executed at the proper times in `throttle` and `end`
  // debounce modes.
  var timeoutID;

  // Keep track of the last time `callback` was executed.
  var lastExec = 0;

  // `noTrailing` defaults to falsy.
  if (typeof noTrailing !== 'boolean') {
    debounceMode = callback;
    callback = noTrailing;
    noTrailing = undefined;
  }

  // The `wrapper` function encapsulates all of the throttling / debouncing
  // functionality and when executed will limit the rate at which `callback`
  // is executed.
  function wrapper() {
    var self = this;
    var elapsed = Number(new Date()) - lastExec;
    var args = arguments;

    // Execute `callback` and update the `lastExec` timestamp.
    function exec() {
      lastExec = Number(new Date());
      callback.apply(self, args);
    }

    // If `debounceMode` is true (at begin) this is used to clear the flag
    // to allow future `callback` executions.
    function clear() {
      timeoutID = undefined;
    }
    if (debounceMode && !timeoutID) {
      // Since `wrapper` is being called for the first time and
      // `debounceMode` is true (at begin), execute `callback`.
      exec();
    }

    // Clear any existing timeout.
    if (timeoutID) {
      clearTimeout(timeoutID);
    }
    if (debounceMode === undefined && elapsed > delay) {
      // In throttle mode, if `delay` time has been exceeded, execute
      // `callback`.
      exec();
    } else if (noTrailing !== true) {
      // In trailing throttle mode, since `delay` time has not been
      // exceeded, schedule `callback` to execute `delay` ms after most
      // recent execution.
      //
      // If `debounceMode` is true (at begin), schedule `clear` to execute
      // after `delay` ms.
      //
      // If `debounceMode` is false (at end), schedule `callback` to
      // execute after `delay` ms.
      timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
    }
  }

  // Return the wrapper function.
  return wrapper;
};

//
const isSupportObjectFit = () => document.documentElement.style.objectFit !== undefined;
const ObjectFit = {
  NONE: 'none',
  CONTAIN: 'contain',
  COVER: 'cover',
  FILL: 'fill',
  SCALE_DOWN: 'scale-down'
};
var script$63 = {
  name: 'DesignPreviewImage',
  mixins: [Locale],
  inheritAttrs: false,
  props: {
    src: String,
    fit: String,
    lazy: Boolean,
    mode: String,
    scrollContainer: {},
    previewSrcList: {
      type: Array,
      default: () => []
    },
    imageList: {
      type: Array,
      default: () => []
    },
    zIndex: {
      type: Number,
      default: 2000
    },
    currentIndex: {
      type: Number,
      default: -1
    },
    current: {
      type: Number,
      default: 0
    },
    showTitle: {
      type: Boolean,
      default: false
    },
    title: {
      type: Array,
      default: () => []
    },
    contents: {
      type: Array,
      default: () => []
    },
    self: {
      type: Object,
      default: () => {
      }
    },
    titlePosition: {
      type: String,
      default: 'under'
    },
    titleAlign: {
      type: String,
      default: 'left'
    },
    clickEffect: {
      type: String,
      default: 'dian-ji-fang-da'
    },
    width: {
      type: Number,
      default: 100
    },
    pageType: {
      type: String,
      default: 'h5'
    }
  },
  data() {
    return {
      loading: true,
      error: false,
      show: !this.lazy,
      imageWidth: 0,
      imageHeight: 0,
      showViewer: false,
      clientWidth: 0
    };
  },
  computed: {
    placeholderStyle() {
      // console.log(this.clientWidth)
      let offsetWidth = this.self?.offsetWidth || 400;
      let offsetHeight = this.self?.offsetHeight || 600;
      let width = this.width / 100 * this.clientWidth;
      let height = width / offsetWidth * offsetHeight;
      return {
        width: width + 'px',
        height: height + 'px'
      };
    },
    imageStyle() {
      const {
        fit
      } = this;
      if (!this.$isServer && fit) {
        return isSupportObjectFit() ? {
          'object-fit': 'contain',
          width: this.width + '% !important'
        } : this.getImageStyle(fit);
      }
      return {
        width: this.width + '% !important'
      };
    },
    alignCenter() {
      return !this.$isServer && !isSupportObjectFit() && this.fit !== ObjectFit.FILL;
    },
    preview() {
      const {
        previewSrcList
      } = this;
      return Array.isArray(previewSrcList) && previewSrcList.length > 0 && this.mode != 'editor' && (this.clickEffect === 'dian-ji-fang-da' || this.clickEffect === 'dian-ji-tiao-zhuan');
    },
    imageIndex() {
      if (this.currentIndex !== -1) {
        return this.currentIndex;
      }
      let previewIndex = 0;
      const srcIndex = this.previewSrcList.indexOf(this.src);
      if (srcIndex >= 0) {
        previewIndex = srcIndex;
      }
      return previewIndex;
    }
  },
  watch: {
    src(val) {
      this.show && this.loadImage();
    },
    show(val) {
      val && this.loadImage();
    },
    title: {
      handler(n, o) {
        // console.log(n, o)
      },
      immediate: true,
      deep: true
    }
  },
  mounted() {
    this.clientWidth = this.$refs.placeholder?.clientWidth;
    if (this.lazy) {
      this.addLazyLoadListener();
    } else {
      this.loadImage();
    }
  },
  beforeDestroy() {
    this.lazy && this.removeLazyLoadListener();
  },
  methods: {
    loadImage() {
      if (this.$isServer) return;

      // reset status
      this.loading = true;
      this.error = false;
      const img = new Image();
      img.onload = e => this.handleLoad(e, img);
      img.onerror = this.handleError.bind(this);

      // bind html attrs
      // so it can behave consistently
      Object.keys(this.$attrs).forEach(key => {
        const value = this.$attrs[key];
        img.setAttribute(key, value);
      });
      img.src = this.src;
    },
    handleLoad(e, img) {
      this.imageWidth = img.width;
      this.imageHeight = img.height;
      this.loading = false;
      this.error = false;
    },
    handleError(e) {
      this.loading = false;
      this.error = true;
      this.$emit('error', e);
    },
    handleLazyLoad() {
      if (isInContainer(this.$el, this._scrollContainer)) {
        this.show = true;
        this.removeLazyLoadListener();
      }
    },
    addLazyLoadListener() {
      if (this.$isServer) return;
      const {
        scrollContainer
      } = this;
      let _scrollContainer = null;
      if (isHtmlElement(scrollContainer)) {
        _scrollContainer = scrollContainer;
      } else if (isString$2(scrollContainer)) {
        _scrollContainer = document.querySelector(scrollContainer);
      } else {
        _scrollContainer = getScrollContainer(this.$el);
      }
      if (_scrollContainer) {
        this._scrollContainer = _scrollContainer;
        this._lazyLoadHandler = throttle$2(200, this.handleLazyLoad);
        on$1(_scrollContainer, 'scroll', this._lazyLoadHandler);
        this.handleLazyLoad();
      }
    },
    removeLazyLoadListener() {
      const {
        _scrollContainer,
        _lazyLoadHandler
      } = this;
      if (this.$isServer || !_scrollContainer || !_lazyLoadHandler) return;
      off$1(_scrollContainer, 'scroll', _lazyLoadHandler);
      this._scrollContainer = null;
      this._lazyLoadHandler = null;
    },
    /**
     * simulate object-fit behavior to compatible with IE11 and other browsers which not support object-fit
     */
    getImageStyle(fit) {
      const {
        imageWidth,
        imageHeight
      } = this;
      const {
        clientWidth: containerWidth,
        clientHeight: containerHeight
      } = this.$el;
      if (!imageWidth || !imageHeight || !containerWidth || !containerHeight) return {};
      const imageAspectRatio = imageWidth / imageHeight;
      const containerAspectRatio = containerWidth / containerHeight;
      if (fit === ObjectFit.SCALE_DOWN) {
        const isSmaller = imageWidth < containerWidth && imageHeight < containerHeight;
        fit = isSmaller ? ObjectFit.NONE : ObjectFit.CONTAIN;
      }
      switch (fit) {
        case ObjectFit.NONE:
          return {
            width: this.width + '% !important',
            height: 'auto'
          };
        case ObjectFit.CONTAIN:
          return imageAspectRatio < containerAspectRatio ? {
            width: this.width + '% !important'
          } : {
            height: 'auto',
            width: this.width + '% !important'
          };
        case ObjectFit.COVER:
          return imageAspectRatio < containerAspectRatio ? {
            width: this.width + '% !important'
          } : {
            width: 'auto',
            width: this.width + '% !important'
          };
        default:
          return {
            width: this.width + '% !important'
          };
      }
    },
    clickHandler(isByTitle) {
      // don't show viewer when preview is false
      if (!this.preview) {
        return;
      }
      if (this.clickEffect === 'dian-ji-fang-da') {
        let imgList = [];
        this.previewSrcList.map((item, index) => {
          imgList.push({
            url: item,
            title: this.title[index],
            description: this.contents[index]
          });
        });
        this.$EventBus.$emit('learningStatistics', {
          type: 'image',
          info: this.imageList[this.current]
        });
        this.$hevueImgPreview({
          multiple: true,
          nowImgIndex: this.current,
          imgList
        });
      }
      if (isByTitle) {
        this.$emit('onBottomTitleClick');
      }
    }
  }
};

/* script */
const __vue_script__$63 = script$63;
/* template */
var __vue_render__$63 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      ref: "placeholder",
      staticClass: "el-image",
      staticStyle: { "{\n      width": "100px" },
    },
    [
      _vm.self && _vm.self.title && _vm.showTitle && _vm.titlePosition === "on"
        ? _c("div", {
            staticClass: "xml-image-title image-title--lay image-title--on",
            style: { textAlign: _vm.titleAlign || "left" },
            domProps: { innerHTML: _vm._s(_vm.self.title) },
          })
        : _vm._e(),
      _vm._v(" "),
      _vm.loading
        ? _vm._t("placeholder", function () {
            return [
              _c(
                "div",
                {
                  staticStyle: {
                    width: "100%",
                    display: "flex",
                    "justify-content": "center",
                  },
                },
                [
                  _c(
                    "div",
                    {
                      staticClass: "el-image__placeholder",
                      style: _vm.placeholderStyle,
                    },
                    [_c("i", { staticClass: "el-icon-loading" })]
                  ),
                ]
              ),
            ]
          })
        : _c(
            "img",
            _vm._g(
              _vm._b(
                {
                  staticClass: "el-image__inner",
                  class: {
                    "el-image__inner--center": _vm.alignCenter,
                    "el-image__preview": _vm.preview,
                  },
                  style: _vm.imageStyle,
                  attrs: { src: _vm.src },
                  on: { click: _vm.clickHandler },
                },
                "img",
                _vm.$attrs,
                false
              ),
              _vm.$listeners
            )
          ),
      _vm._v(" "),
      _vm.self &&
      _vm.self.title &&
      _vm.showTitle &&
      _vm.titlePosition === "bottom"
        ? _c("div", {
            staticClass:
              "xml-image-title image-title--fixed image-title--bottom",
            style: { textAlign: _vm.titleAlign || "left" },
            domProps: { innerHTML: _vm._s(_vm.self.title) },
            on: {
              click: function ($event) {
                return _vm.clickHandler(1)
              },
            },
          })
        : _vm._e(),
      _vm._v(" "),
      _vm.self && _vm.self.title && _vm.showTitle && _vm.titlePosition === "top"
        ? _c(
            "div",
            {
              staticClass:
                "xml-image-title image-title--fixed image-title--top",
              style: { textAlign: _vm.titleAlign || "left" },
              on: {
                click: function ($event) {
                  return _vm.clickHandler(1)
                },
              },
            },
            [_vm._v("\n    " + _vm._s(_vm.self.title) + "\n  ")]
          )
        : _vm._e(),
      _vm._v(" "),
      _vm.self &&
      _vm.self.title &&
      _vm.showTitle &&
      _vm.titlePosition === "under"
        ? _c("div", {
            staticClass: "xml-image-title image-title--lay image-title--under",
            style: { textAlign: _vm.titleAlign || "left" },
            domProps: { innerHTML: _vm._s(_vm.self.title) },
          })
        : _vm._e(),
    ],
    2
  )
};
var __vue_staticRenderFns__$63 = [];
__vue_render__$63._withStripped = true;

  /* style */
  const __vue_inject_styles__$63 = undefined;
  /* scoped */
  const __vue_scope_id__$63 = "data-v-2cbc6547";
  /* module identifier */
  const __vue_module_identifier__$63 = undefined;
  /* functional template */
  const __vue_is_functional_template__$63 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$63 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$63, staticRenderFns: __vue_staticRenderFns__$63 },
    __vue_inject_styles__$63,
    __vue_script__$63,
    __vue_scope_id__$63,
    __vue_is_functional_template__$63,
    __vue_module_identifier__$63,
    false,
    undefined,
    undefined,
    undefined
  );

/* istanbul ignore next */
__vue_component__$63.install = function (Vue) {
  Vue.component(__vue_component__$63.name, __vue_component__$63);
};

//
/***
 * 文本块
 */
var script$62 = {
  name: 'XmlImageRender',
  components: {
    previewImageRender: __vue_component__$63
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    pBlockData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    showTitle: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      // image,
      // noImage,
      previewKey: Math.random(),
      blockId: `blockId${Math.random()}`,
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {
        imageMode: 'dan-tu',
        showEffect: 'hua-lang',
        clickEffect: 'wu',
        titlePosition: 'under',
        // width: 100,
        titleAlign: 'left',
        imageList: [{
          source: 'upload',
          //来源：上传，素材
          uploadFileUrl: '',
          title: '',
          content: '',
          href: '' //跳转链接
        }]
      },
      carouselActiveIndex: 0,
      //属性组件名
      propertyComponentsName: 'xml-image-property',
      currentPreviewList: [],
      carouselHeight: '',
      currentIndex: -1
    };
  },
  inject: {
    getSysEnv: {
      from: 'getSysEnv',
      default: () => () => {}
    }
  },
  computed: {
    blockPreviewList() {
      let images = this.blockData.imageList || [],
        list = [];
      images.map(item => {
        let src = this.resourceBasisPath ? this.resourceBasisPath + item.uploadFileUrl.split('./')[1] : item.uploadFileUrl;
        list.push(src);
      });
      return this.blockData.imageMode == 'dan-tu' ? [list[0]] : list;
    },
    blockPreviewTitleList() {
      let images = this.blockData.imageList || [],
        list = [];
      images.map(item => {
        list.push(item.title);
      });
      return this.blockData.imageMode == 'dan-tu' ? [list[0]] : list;
    },
    blockPreviewContentList() {
      let images = this.blockData.imageList || [],
        list = [];
      images.map(item => {
        list.push(item.content || '');
      });
      return this.blockData.imageMode == 'dan-tu' ? [list[0]] : list;
    },
    indicatorText() {
      let allNum = this.blockData.imageList.length;
      return `${this.carouselActiveIndex + 1} / ${allNum}`;
    },
    carouselActiveTitle() {
      return this.blockData.imageList[this.carouselActiveIndex].title || '';
    },
    carouselActiveItem() {
      return this.blockData.imageList[this.carouselActiveIndex] || {};
    },
    allHaveNoTitle() {
      let has = false;
      this.blockData.imageList.forEach(item => {
        if (item.title) {
          has = true;
        }
      });
      return !has;
    },
    sysEnv() {
      return this.getSysEnv();
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    },
    'blockData.showEffect': {
      handler(newValue) {
        if (newValue === 'lun-bo') {
          this.setCarouselHeight();
        }
      },
      deep: true,
      immediate: true
    }
  },
  updated() {},
  methods: {
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    imageClick({
      source,
      uploadFileUrl,
      title,
      link,
      content,
      href,
      businessType,
      linkId,
      cIndex
    }, imgList) {
      if (this.mode === 'editor') return;
      console.log('??????????????????', linkId, cIndex);
      if (cIndex !== undefined) {
        this.currentIndex = cIndex;
      }
      if (this.blockData.clickEffect === 'dian-ji-fang-da') {
        if (this.blockData.showEffect === 'lun-bo') {
          let imgList = [];
          this.blockData.imageList.map(item => {
            imgList.push({
              url: item.uploadFileUrl?.indexOf('./') != -1 ? this.resourceBasisPath + item.uploadFileUrl.split('./')[1] : item.uploadFileUrl,
              title: item.title,
              description: item.content
            });
          });
          this.$hevueImgPreview({
            multiple: true,
            nowImgIndex: this.carouselActiveIndex,
            imgList
          });
        }
      } else if (this.blockData.clickEffect === 'dian-ji-tiao-zhuan') {
        //点击跳转
        // window.href = href
        if (linkId) {
          // window.open(link, '_blank')
          if (this.mode == 'reader') {
            window.open(this.sysEnv.webBaseUrl + 'previewLooseLeaf?pageType=' + this.pageType + '&businessType=looseLeaf' + '&looseLeafId=' + linkId + '&uuid=' + v4() + '&styleType=' + 'B', '_blank');
            // this.$EventBus.$emit('hotzoneClick', {
            // type: 'looseleaf',
            // value: linkId,
            // label: ''
            // })
          } else {
            window.open(process.env.VUE_APP_TEXTBOOK_WEB + 'previewLooseLeaf?pageType=' + this.pageType + '&businessType=looseLeaf' + '&looseLeafId=' + linkId + '&uuid=' + v4() + '&styleType=' + 'B', '_blank');
          }
        } else {
          this.$message.warning('获取资源链接失败，请检查链接地址');
        }
      }
    },
    setImage(image) {
      let imageEle = image.path[0];
      let {
        naturalWidth,
        naturalHeight
      } = imageEle;
      let renderWidth = naturalWidth / (naturalHeight / 200);
      image.path[0].style.width = `${renderWidth}px`;
    },
    setActiveImageIndex(current) {
      this.carouselActiveIndex = current;
    },
    setCarouselHeight() {
      // 获取容器宽度以16:9计算高度并设置
      let containerRect = this.$refs.carouselContainer ? this.$refs.carouselContainer.getBoundingClientRect() : {
        width: 568
      };
      if (this.blockData.proportion) {
        this.carouselHeight = containerRect.width * this.blockData.proportion + 'px';
      } else {
        this.carouselHeight = parseInt(containerRect.width / 16 * 9) + 'px';
      }
    },
    clickImg() {
      this.$emit('clickImg');
    }
  },
  mounted() {
    this.setCarouselHeight();
  }
};

/* script */
const __vue_script__$62 = script$62;
/* template */
var __vue_render__$62 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      ref: "carouselContainer",
      class:
        "xml-image-container-" +
        _vm.pageType +
        " image-container " +
        (_vm.blockData.showEffect === "hua-lang"
          ? "hua-lang-image-container"
          : ""),
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _vm.blockData.imageList.length > 0
        ? [
            _vm.blockData.imageMode == "dan-tu"
              ? _c(
                  "div",
                  { staticClass: "xml-image-dan-tu" },
                  [
                    _c("preview-image-render", {
                      class: "xml-image-dan-tu-" + _vm.pageType,
                      attrs: {
                        src: _vm.blockData.imageList[0].uploadFileUrl
                          ? _vm.blockData.imageList[0].uploadFileUrl.indexOf(
                              "./"
                            ) != -1
                            ? _vm.resourceBasisPath +
                              _vm.blockData.imageList[0].uploadFileUrl.split(
                                "./"
                              )[1]
                            : _vm.blockData.imageList[0].uploadFileUrl
                          : "",
                        mode: _vm.mode,
                        showTitle: _vm.showTitle,
                        pageType: _vm.pageType,
                        "preview-text": _vm.blockPreviewTitleList,
                        contents: _vm.blockPreviewContentList,
                        current: 0,
                        previewSrcList: _vm.blockPreviewList,
                        imageList: _vm.blockData.imageList,
                        clickEffect: _vm.blockData.clickEffect,
                        width: _vm.blockData.width,
                      },
                      on: {
                        click: function ($event) {
                          return _vm.imageClick(_vm.blockData.imageList[0])
                        },
                      },
                    }),
                  ],
                  1
                )
              : _vm._e(),
            _vm._v(" "),
            _vm.blockData.imageMode == "duo-tu"
              ? _c(
                  "div",
                  {
                    staticClass: "xml-image-duo-tu",
                    class: "xml-image-duo-tu " + _vm.blockData.showEffect,
                  },
                  [
                    _vm.blockData.showEffect === "hua-lang"
                      ? _c(
                          "div",
                          {
                            class: [
                              "xml-image-hualang",
                              _vm.allHaveNoTitle ? "no-title" : "",
                            ],
                            style: {
                              "--xml-image-hualang-background-color":
                                _vm.blockData.themeColor || "#f4f4f4",
                            },
                            on: {
                              touchstart: _vm.clickImg,
                              mousedown: _vm.clickImg,
                            },
                          },
                          _vm._l(
                            _vm.blockData.imageList,
                            function (item, index) {
                              return _c("preview-image-render", {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value:
                                      _vm.blockData.showEffect === "hua-lang",
                                    expression:
                                      "blockData.showEffect === 'hua-lang'",
                                  },
                                ],
                                key: index,
                                class: [
                                  "xml-image-" +
                                    _vm.blockData.showEffect +
                                    "-" +
                                    _vm.pageType,
                                  "xml-image-hua-lang  xml-group-item",
                                ],
                                style: {
                                  width: _vm.blockData.width
                                    ? (290 / 100) *
                                        Number(_vm.blockData.width) +
                                      "px"
                                    : "290px",
                                  height:
                                    (_vm.blockData.galleryHeight || 290) + "px",
                                },
                                attrs: {
                                  src: item.uploadFileUrl
                                    ? _vm.blockData.imageList[0].uploadFileUrl.indexOf(
                                        "./"
                                      ) != -1
                                      ? _vm.resourceBasisPath +
                                        item.uploadFileUrl.split("./")[1]
                                      : item.uploadFileUrl
                                    : "",
                                  "preview-text": _vm.blockPreviewTitleList,
                                  previewSrcList: _vm.blockPreviewList,
                                  imageList: _vm.blockData.imageList,
                                  showTitle: _vm.showTitle,
                                  pageType: _vm.pageType,
                                  current: index,
                                  title: _vm.blockPreviewTitleList,
                                  contents: _vm.blockPreviewContentList,
                                  currentIndex: _vm.currentIndex,
                                  titlePosition: _vm.blockData.titlePosition,
                                  titleAlign: _vm.blockData.titleAlign,
                                  mode: _vm.mode,
                                  self: item,
                                  clickEffect: _vm.blockData.clickEffect,
                                  width: _vm.blockData.width,
                                },
                                on: {
                                  click: function ($event) {
                                    return _vm.imageClick(
                                      Object.assign({}, item, {
                                        cIndex: index,
                                      }),
                                      _vm.blockData
                                    )
                                  },
                                  onBottomTitleClick: function ($event) {
                                    return _vm.imageClick(item, _vm.blockData)
                                  },
                                },
                              })
                            }
                          ),
                          1
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.blockData.showEffect === "ping-pu"
                      ? _c(
                          "div",
                          { staticClass: "xml-image-ping-pu" },
                          _vm._l(
                            _vm.blockData.imageList,
                            function (item, index) {
                              return _c("preview-image-render", {
                                key: index,
                                staticClass: "xml-group-item",
                                class:
                                  "xml-image-" +
                                  _vm.blockData.showEffect +
                                  "-" +
                                  _vm.pageType,
                                attrs: {
                                  src: item.uploadFileUrl
                                    ? _vm.blockData.imageList[0].uploadFileUrl.indexOf(
                                        "./"
                                      ) != -1
                                      ? _vm.resourceBasisPath +
                                        item.uploadFileUrl.split("./")[1]
                                      : item.uploadFileUrl
                                    : "",
                                  fit: "cover",
                                  title: _vm.blockPreviewTitleList,
                                  pageType: _vm.pageType,
                                  contents: _vm.blockPreviewContentList,
                                  currentIndex: _vm.currentIndex,
                                  current: index,
                                  showTitle: _vm.showTitle,
                                  titlePosition: _vm.blockData.titlePosition,
                                  titleAlign: _vm.blockData.titleAlign,
                                  self: item,
                                  mode: _vm.mode,
                                  "preview-text": _vm.blockPreviewTitleList,
                                  previewSrcList: _vm.blockPreviewList,
                                  imageList: _vm.blockData.imageList,
                                  clickEffect: _vm.blockData.clickEffect,
                                  width: _vm.blockData.width,
                                },
                                on: {
                                  click: function ($event) {
                                    return _vm.imageClick(
                                      Object.assign({}, item, { cIndex: index })
                                    )
                                  },
                                  onBottomTitleClick: function ($event) {
                                    return _vm.imageClick(item, _vm.blockData)
                                  },
                                },
                              })
                            }
                          ),
                          1
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.blockData.showEffect === "lun-bo"
                      ? _c(
                          "div",
                          {
                            staticClass: "xml-image-lun-bo xml-group-item",
                            style: { width: _vm.blockData.width + "%" },
                          },
                          [
                            _vm.showTitle &&
                            _vm.blockData.titlePosition === "on" &&
                            !_vm.allHaveNoTitle
                              ? _c("div", {
                                  staticClass:
                                    "image-title--lay image-title--on",
                                  style: {
                                    textAlign:
                                      _vm.blockData.titleAlign || "left",
                                  },
                                  domProps: {
                                    innerHTML: _vm._s(_vm.carouselActiveTitle),
                                  },
                                })
                              : _vm._e(),
                            _vm._v(" "),
                            _c(
                              "el-carousel",
                              {
                                ref: "imageCarousel",
                                attrs: {
                                  height: _vm.carouselHeight,
                                  arrow: "always",
                                  loop: "",
                                  "indicator-position": "none",
                                },
                                on: { change: _vm.setActiveImageIndex },
                              },
                              [
                                _vm._l(
                                  _vm.blockData.imageList,
                                  function (item, index) {
                                    return _c(
                                      "el-carousel-item",
                                      { key: index },
                                      [
                                        _c("img", {
                                          attrs: {
                                            src: item.uploadFileUrl
                                              ? _vm.blockData.imageList[0].uploadFileUrl.indexOf(
                                                  "./"
                                                ) != -1
                                                ? _vm.resourceBasisPath +
                                                  item.uploadFileUrl.split(
                                                    "./"
                                                  )[1]
                                                : item.uploadFileUrl
                                              : "",
                                          },
                                          on: {
                                            click: function ($event) {
                                              return _vm.imageClick(item)
                                            },
                                          },
                                        }),
                                      ]
                                    )
                                  }
                                ),
                                _vm._v(" "),
                                _c(
                                  "div",
                                  {
                                    class: [
                                      "custom-indicator",
                                      _vm.blockData.titlePosition === "bottom"
                                        ? "withBottomTitle"
                                        : _vm.blockData.titlePosition === "top"
                                        ? "withTopTitle"
                                        : "",
                                    ],
                                  },
                                  [
                                    _vm._v(
                                      "\n            " +
                                        _vm._s(_vm.indicatorText) +
                                        "\n          "
                                    ),
                                  ]
                                ),
                                _vm._v(" "),
                                _vm.showTitle &&
                                _vm.blockData.titlePosition === "bottom" &&
                                _vm.carouselActiveTitle
                                  ? _c("div", {
                                      staticClass:
                                        "image-title--fixed image-title--bottom",
                                      style: {
                                        textAlign:
                                          _vm.blockData.titleAlign || "left",
                                      },
                                      domProps: {
                                        innerHTML: _vm._s(
                                          _vm.carouselActiveTitle
                                        ),
                                      },
                                      on: {
                                        click: function ($event) {
                                          return _vm.imageClick(
                                            _vm.carouselActiveItem
                                          )
                                        },
                                      },
                                    })
                                  : _vm._e(),
                                _vm._v(" "),
                                _vm.showTitle &&
                                _vm.blockData.titlePosition === "top" &&
                                _vm.carouselActiveTitle
                                  ? _c(
                                      "div",
                                      {
                                        staticClass:
                                          "image-title--fixed image-title--top",
                                        style: {
                                          textAlign:
                                            _vm.blockData.titleAlign || "left",
                                        },
                                        on: {
                                          click: function ($event) {
                                            return _vm.imageClick(
                                              _vm.carouselActiveItem
                                            )
                                          },
                                        },
                                      },
                                      [
                                        _vm._v(
                                          "\n            " +
                                            _vm._s(_vm.carouselActiveTitle) +
                                            "\n          "
                                        ),
                                      ]
                                    )
                                  : _vm._e(),
                              ],
                              2
                            ),
                            _vm._v(" "),
                            _vm.showTitle &&
                            _vm.blockData.titlePosition === "under" &&
                            !_vm.allHaveNoTitle
                              ? _c("div", {
                                  staticClass:
                                    "xml-image-title image-title--lay image-title--under",
                                  style: {
                                    textAlign:
                                      _vm.blockData.titleAlign || "left",
                                  },
                                  domProps: {
                                    innerHTML: _vm._s(_vm.carouselActiveTitle),
                                  },
                                })
                              : _vm._e(),
                          ],
                          1
                        )
                      : _vm._e(),
                  ]
                )
              : _vm._e(),
          ]
        : [
            _c(
              "div",
              { staticClass: "xml-noimage-container" },
              [
                _c("el-image", {
                  staticClass: "xml-noimage",
                  class: "xml-image-dan-tu-" + _vm.pageType,
                  attrs: {
                    src: "../../../../static/images/defaultCover/no-image.png",
                    fit: "cover",
                  },
                }),
              ],
              1
            ),
          ],
    ],
    2
  )
};
var __vue_staticRenderFns__$62 = [];
__vue_render__$62._withStripped = true;

  /* style */
  const __vue_inject_styles__$62 = undefined;
  /* scoped */
  const __vue_scope_id__$62 = undefined;
  /* module identifier */
  const __vue_module_identifier__$62 = undefined;
  /* functional template */
  const __vue_is_functional_template__$62 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$62 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$62, staticRenderFns: __vue_staticRenderFns__$62 },
    __vue_inject_styles__$62,
    __vue_script__$62,
    __vue_scope_id__$62,
    __vue_is_functional_template__$62,
    __vue_module_identifier__$62,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$62.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('image-render', {
    prefix: options.prefix
  }), __vue_component__$62);
};

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

// import "../block.scss"
var script$61 = {
  name: 'xmlHtmlRender',
  components: {},
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'preview';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isCopyUrl: {
      // 是否显示复制链接
      type: Boolean,
      default: false
    },
    isReader: {
      // 是否阅读器
      type: Boolean,
      default: false
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        // console.log('XmlHtml组件(ruleIndex:' + this.ruleIndex + ')，watch触发，变量pBlockData：', newValue)
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
          if (this.blockData.htmlType === 'code') {
            this.addIframe();
          }
          // ios扫描二维码微信端不支持srcdoc，改为获取dom写入
          // 清除计时器
          // if (this.timer) {
          //   clearTimeout(this.timer)
          //   this.timer = null
          // }

          // this.timer = setTimeout(() => {
          //   if (this.blockData.htmlType === 'code') {
          //     var iframe = this.$refs.iframe
          //     iframe.contentWindow.document.write(this.pBlockData.code) // 动态写入返回页面到iframe
          //     iframe.contentWindow.document.close()

          //   }
          // }, 500)

          // console.log(this.blockData.code);
          // iframe.contentWindow.document.write(this.blockData.code) // 动态写入返回页面到iframe
          // iframe.contentWindow.document.close()
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      timer: null,
      fileBaseUrl: '',
      showDialog: false,
      height: '500px',
      noshow: false,
      retryCount: 10,
      //属性组件名
      propertyComponentsName: 'xml-html-property',
      src: 'data:image/png;base64,[encoded data, 23320 characters]'
      // ebookSetList:[]
    };
  },
  mounted() {
    // console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');

    // ios扫描二维码微信端不支持srcdoc，改为获取dom写入
    // var iframe = this.$refs.iframe
    // // console.log(this.blockData.code);
    // iframe.contentWindow.document.write(this.pBlockData.code) // 动态写入返回页面到iframe
    // iframe.contentWindow.document.close()

    this.height = window.innerHeight - 100 + 'px';
    // if (this.blockData.htmlType === 'code') {
    this.addIframe();
    // }
  },
  methods: {
    addIframe() {
      this.retryCount--;
      // console.log('addIframe', this.blockData, this.pBlockData,this.retryCount)
      if (this.pBlockData.htmlType == 'code' && this.pBlockData.code) {
        console.log('访问网址', this.pBlockData);
        let data = JSON.parse(JSON.stringify(this.blockData));
        var iframe = this.$refs.iframe;
        iframe.contentWindow.document.open();
        iframe.contentWindow.document.write(data.code); // 动态写入返回页面到iframe
        iframe.contentWindow.document.close();
      } else if (this.retryCount > 0) {
        setTimeout(() => {
          this.addIframe();
        }, 500);
      }
    },
    catchtouchmove() {},
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    goRead(info) {
      // console.log('🚀 ~ goRead ~ info:', info,this.mode,this.pageType)

      if (this.mode === 'preview' || this.mode == 'reader') {
        let url = '';
        if (info.htmlType == 'url') {
          url = info.link;
        } else {
          url = info.file.indexOf('./') !== -1 ? this.resourceBasisPath + info.file.split('./')[1] : info.file;
        }
        if (!this.isReader) {
          window.open(url);
        } else {
          this.$emit('openHtml', {
            previewUrl: url,
            title: info.materialName
          });
        }
      }
    },
    handleClose() {
      console.log('aaaaaaaaaaaaaaaaaaaa');
      this.showDialog = false;
    },
    open(info) {
      let url = '';
      if (info.htmlType == 'url') {
        url = info.link;
      } else {
        url = info.file.indexOf('./') !== -1 ? this.resourceBasisPath + info.file.split('./')[1] : info.file;
      }
      this.fileBaseUrl = url;
      this.showDialog = true;
    },
    toggleFullscreen() {
      const iframe = this.$el.querySelector('iframe');
      if (!iframe) return;
      if (!document.fullscreenElement) {
        if (iframe.requestFullscreen) {
          iframe.requestFullscreen();
        } else if (iframe.webkitRequestFullscreen) {
          iframe.webkitRequestFullscreen();
        } else if (iframe.msRequestFullscreen) {
          iframe.msRequestFullscreen();
        }
      } else {
        if (document.exitFullscreen) {
          document.exitFullscreen();
        } else if (document.webkitExitFullscreen) {
          document.webkitExitFullscreen();
        } else if (document.msExitFullscreen) {
          document.msExitFullscreen();
        }
      }
    },
    iframeLoaded() {
      this.addIframe();
    }
  },
  created() {
    // this.blockData = Object.assign( this.blockData,this.pBlockData)
  }
};

var __$_require_static_images_leaflet_resource_enter_html_cover_png__ = "data:image/png;base64,[encoded data, 4484 characters]";

/* script */
const __vue_script__$61 = script$61;
var __vue_render__$61 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-group-item xml-single-html-group-render",
      class: "xml-ebook-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _vm.noshow
        ? _c(
            "div",
            {
              staticClass: "xml-full-screen",
              staticStyle: { display: "none" },
              on: {
                click: function ($event) {
                  return _vm.open(_vm.blockData)
                },
              },
            },
            [
              _c("i", {
                staticClass: "el-icon-full-screen",
                attrs: { title: "全屏" },
              }),
            ]
          )
        : _vm._e(),
      _vm._v(" "),
      _vm.mode === "editor"
        ? _c("div", {
            staticClass: "xml-html-mask",
            attrs: { catchtouchmove: "catchtouchmove" },
          })
        : _vm._e(),
      _vm._v(" "),
      _vm.blockData.htmlType === "url"
        ? _c("div", { staticStyle: { width: "100%", overflow: "auto" } }, [
            _vm.isCopyUrl
              ? _c(
                  "div",
                  {
                    staticClass: "web-file-box",
                    on: {
                      click: function ($event) {
                        return _vm.$emit("copyHtmlUrl", _vm.blockData)
                      },
                    },
                  },
                  [
                    _c("div", { staticClass: "file-cover" }, [
                      _c("img", {
                        attrs: {
                          src: _vm.blockData.fileCover
                            ? _vm.blockData.fileCover.indexOf("http") !== -1
                              ? _vm.blockData.fileCover
                              : _vm.resourceBasisPath
                              ? _vm.resourceBasisPath +
                                _vm.blockData.fileCover.split("./")[1]
                              : _vm.blockData.file
                            : __$_require_static_images_leaflet_resource_enter_html_cover_png__,
                        },
                      }),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "file-title" }, [
                      _vm._v(
                        "\n        " +
                          _vm._s(
                            _vm.blockData.fileNames
                              ? _vm.blockData.fileNames
                              : "--"
                          ) +
                          "\n      "
                      ),
                    ]),
                  ]
                )
              : !_vm.isCopyUrl && _vm.blockData.styleModel == "A"
              ? _c(
                  "div",
                  {
                    staticClass: "web-file-box",
                    on: {
                      click: function ($event) {
                        return _vm.goRead(_vm.blockData)
                      },
                    },
                  },
                  [
                    _c("div", { staticClass: "file-cover" }, [
                      _c("img", {
                        attrs: {
                          src: _vm.blockData.fileCover
                            ? _vm.blockData.fileCover.indexOf("http") !== -1
                              ? _vm.blockData.fileCover
                              : _vm.resourceBasisPath
                              ? _vm.resourceBasisPath +
                                _vm.blockData.fileCover.split("./")[1]
                              : _vm.blockData.file
                            : __$_require_static_images_leaflet_resource_enter_html_cover_png__,
                        },
                      }),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "file-title" }, [
                      _vm._v(
                        "\n        " +
                          _vm._s(
                            _vm.blockData.fileNames
                              ? _vm.blockData.fileNames
                              : "--"
                          ) +
                          "\n      "
                      ),
                    ]),
                  ]
                )
              : _c("iframe", {
                  style: {
                    width: "100%",
                    border: "none",
                    height: _vm.blockData.htmlHeight + "px",
                    "padding-top": Number(_vm.blockData.htmlTopMargin) + "px",
                    "padding-bottom": _vm.blockData.htmlBottomMargin + "px",
                  },
                  attrs: { src: _vm.blockData.link, loading: "lazy" },
                }),
            _vm._v(" "),
            _c(
              "div",
              {
                staticClass: "fullscreen-btn",
                on: { click: _vm.toggleFullscreen },
              },
              [_c("i", { staticClass: "el-icon-full-screen" })]
            ),
          ])
        : _vm._e(),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: _vm.blockData.htmlType === "code",
              expression: "blockData.htmlType === 'code'",
            },
          ],
        },
        [
          _c("iframe", {
            ref: "iframe",
            style: {
              width: "100%",
              height: _vm.blockData.htmlHeight + "px",
              border: "none",
              "padding-top": Number(_vm.blockData.htmlTopMargin) + "px",
              "padding-bottom": _vm.blockData.htmlBottomMargin + "px",
            },
            attrs: { loading: "lazy" },
            on: { load: _vm.iframeLoaded },
          }),
        ]
      ),
      _vm._v(" "),
      _vm.blockData.htmlType === "file"
        ? _c("div", [
            _vm.blockData.styleModel == "A"
              ? _c(
                  "div",
                  {
                    staticClass: "web-file-box",
                    on: {
                      click: function ($event) {
                        return _vm.goRead(_vm.blockData)
                      },
                    },
                  },
                  [
                    _c("div", { staticClass: "file-cover" }, [
                      _c("img", {
                        attrs: {
                          src: _vm.blockData.fileCover
                            ? _vm.blockData.fileCover.indexOf("http") !== -1
                              ? _vm.blockData.fileCover
                              : _vm.resourceBasisPath
                              ? _vm.resourceBasisPath +
                                _vm.blockData.fileCover.split("./")[1]
                              : _vm.blockData.file
                            : __$_require_static_images_leaflet_resource_enter_html_cover_png__,
                        },
                      }),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "file-title" }, [
                      _vm._v(
                        "\n        " +
                          _vm._s(
                            _vm.blockData.fileNames
                              ? _vm.blockData.fileNames
                              : "--"
                          ) +
                          "\n      "
                      ),
                    ]),
                  ]
                )
              : _c("div", [
                  _c("iframe", {
                    style: {
                      width: "100%",
                      height: _vm.blockData.htmlHeight + "px",
                      border: "none",
                      "padding-top": Number(_vm.blockData.htmlTopMargin) + "px",
                      "padding-bottom": _vm.blockData.htmlBottomMargin + "px",
                    },
                    attrs: {
                      src: _vm.blockData.file
                        ? _vm.blockData.file.indexOf("http") !== -1
                          ? _vm.blockData.file
                          : _vm.resourceBasisPath
                          ? _vm.resourceBasisPath +
                            _vm.blockData.file.split("./")[1]
                          : _vm.blockData.file
                        : "",
                      loading: "lazy",
                    },
                  }),
                ]),
          ])
        : _vm._e(),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          attrs: { visible: _vm.showDialog, fullscreen: true },
          on: {
            "update:visible": function ($event) {
              _vm.showDialog = $event;
            },
          },
        },
        [
          _c("iframe", {
            ref: "xmlIframe",
            attrs: {
              width: "100%",
              height: _vm.height,
              frameborder: "0",
              src: _vm.fileBaseUrl,
            },
          }),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$61 = [];
__vue_render__$61._withStripped = true;

  /* style */
  const __vue_inject_styles__$61 = undefined;
  /* scoped */
  const __vue_scope_id__$61 = undefined;
  /* module identifier */
  const __vue_module_identifier__$61 = undefined;
  /* functional template */
  const __vue_is_functional_template__$61 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$61 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$61, staticRenderFns: __vue_staticRenderFns__$61 },
    __vue_inject_styles__$61,
    __vue_script__$61,
    __vue_scope_id__$61,
    __vue_is_functional_template__$61,
    __vue_module_identifier__$61,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$61.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('html-render', {
    prefix: options.prefix
  }), __vue_component__$61);
};

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

// import '../block.scss'
var script$60 = {
  name: 'XmlCatalogRender',
  components: {},
  inject: ['getCatalogList'],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'preview';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      blockId: `blockId${Math.random()}`,
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      //属性组件名
      propertyComponentsName: 'xml-catalog-property',
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      filteredTree: []
    };
  },
  computed: {
    catalogList() {
      return this.getCatalogList().data;
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
          this.$forceUpdate();
          // this.ebookSetList=Object.assign({},this.blockData.ebookSetList);
        });
      },
      deep: true,
      immediate: true
    },
    catalogList: {
      handler(newValue) {
        // this.$nextTick(() => {
        //   this.$refs.tree.filter('unexpected')
        // })
        let origin = newValue || [];
        const filterMenu = menuList => {
          return menuList.filter(item => {
            return item.hiddenFlag !== '1';
          }).map(item => {
            item = Object.assign({}, item);
            if (item.children) {
              item.children = filterMenu(item.children);
            }
            return item;
          });
        };
        this.filteredTree = filterMenu(origin);
      },
      deep: true,
      immediate: true
    }
  },
  created() {
    // this.blockData = Object.assign( this.blockData,this.pBlockData)
  },
  methods: {
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    nodeClick(data, node) {
      this.$EventBus.$emit('treeNodeClick', {
        data,
        node
      });
    },
    filterNode(value, data) {
      // if (!value) return true;
      return data.hiddenFlag !== '1';
    }
  }
};

/* script */
const __vue_script__$60 = script$60;
/* template */
var __vue_render__$60 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-show-catalog xml-group-item",
      class: "xml-catalog-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _c("el-tree", {
        ref: "tree",
        class: "preview-tree-box-" + _vm.pageType,
        staticStyle: { "margin-top": "0px" },
        attrs: {
          id: "built-in-tree",
          draggable: _vm.blockData.draggable,
          "default-expand-all": true,
          "highlight-current": "",
          data: _vm.filteredTree,
          "node-key": "id",
          props: _vm.defaultProps,
          "filter-node-method": _vm.filterNode,
          "expand-on-click-node": false,
        },
        on: { "node-click": _vm.nodeClick },
        scopedSlots: _vm._u([
          {
            key: "default",
            fn: function (ref) {
              var node = ref.node;
              var data = ref.data;
              return _c("div", { staticClass: "catalog-node-label" }, [
                data.uploadFileUrl
                  ? _c("img", {
                      staticStyle: { width: "15px", height: "15px" },
                      attrs: { src: data.uploadFileUrl, alt: "" },
                    })
                  : _vm._e(),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    class: ["node-label", node.expanded ? "expanded-node" : ""],
                  },
                  [_vm._v(_vm._s(node.label))]
                ),
              ])
            },
          },
        ]),
      }),
    ],
    1
  )
};
var __vue_staticRenderFns__$60 = [];
__vue_render__$60._withStripped = true;

  /* style */
  const __vue_inject_styles__$60 = undefined;
  /* scoped */
  const __vue_scope_id__$60 = "data-v-842ba544";
  /* module identifier */
  const __vue_module_identifier__$60 = undefined;
  /* functional template */
  const __vue_is_functional_template__$60 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$60 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$60, staticRenderFns: __vue_staticRenderFns__$60 },
    __vue_inject_styles__$60,
    __vue_script__$60,
    __vue_scope_id__$60,
    __vue_is_functional_template__$60,
    __vue_module_identifier__$60,
    false,
    undefined,
    undefined,
    undefined
  );

// 提交
__vue_component__$60.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('catalog-render', {
    prefix: options.prefix
  }), __vue_component__$60);
};

const TextComponents = [__vue_component__$65, __vue_component__$69];
var XmlText = {
  ...TextComponents
};

//
//
//
//
//
//
//
//
//
//
//

var script$5$ = {
  name: 'XmlGroupRender',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    ruleIndex: Number,
    currentRuleIndex: Number,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    field: String,
    typeText: {
      type: String,
      default: ''
    },
    showLine: {
      type: Boolean,
      default: true
    },
    pBlockData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    BookName: {
      type: String,
      default: ''
    },
    //块儿数据名
    blockDataName: String
  },
  data() {
    return {
      isShowUp: false,
      isShowDown: false,
      //当前所处组的规则
      currentRule: {},
      mouseHover: false,
      showBtn: false
    };
  },
  created() {
    const _this = this;
    this.$EventBus.$on('blockClick', function ({
      blockId,
      ruleIndex
    }) {
      if (_this.ruleIndex === ruleIndex) {
        _this.showBtn = true;
      } else {
        _this.showBtn = false;
      }
    });
  },
  watch: {
    currentRuleIndex: {
      handler(newVal, oldVal) {
        if (newVal === -1) {
          this.showBtn = false;
        }
      }
    }
  },
  mounted() {
    this.blockData = this.pBlockData;
  },
  methods: {
    hover() {
      this.mouseHover = true;
    },
    leave() {
      this.mouseHover = false;
    }
  }
};

/* script */
const __vue_script__$5$ = script$5$;
/* template */
var __vue_render__$5$ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      class: _vm.showLine ? "xml-group-box" : "",
      on: { mousemove: _vm.hover, mouseleave: _vm.leave },
    },
    [
      _vm.showBtn && _vm.mode === "editor"
        ? _vm._t("action-buttons")
        : _vm._e(),
      _vm._v(" "),
      _c(
        "div",
        {
          class: [
            "xml-group-" + _vm.pageType,
            _vm.mode === "editor" ? "xml-group--editor" : "",
            _vm.mouseHover && _vm.mode === "editor" ? "hovered" : "",
          ],
        },
        [_vm._t("default")],
        2
      ),
    ],
    2
  )
};
var __vue_staticRenderFns__$5$ = [];
__vue_render__$5$._withStripped = true;

  /* style */
  const __vue_inject_styles__$5$ = undefined;
  /* scoped */
  const __vue_scope_id__$5$ = "data-v-bcc366a2";
  /* module identifier */
  const __vue_module_identifier__$5$ = undefined;
  /* functional template */
  const __vue_is_functional_template__$5$ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5$ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5$, staticRenderFns: __vue_staticRenderFns__$5$ },
    __vue_inject_styles__$5$,
    __vue_script__$5$,
    __vue_scope_id__$5$,
    __vue_is_functional_template__$5$,
    __vue_module_identifier__$5$,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$5$.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('group-render', {
    prefix: options.prefix
  }), __vue_component__$5$);
};

var playIcon$5 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAABxBJREFUeF7dW2tsFFUU/s5sCygo7W4JwfggkZAYNNYnqBB31iI2jYnERwyiRuILFcJuwZQEAgYfDbSzii8CYqDlYRQhUQNIS3cFkRbERxXTYMCCgGI7U0ssXbbbOWa2bu1ruzOzM8suN9lfe+53vvPdc2fu4wwhBc1ddjYPjnA+VM4XBMdogHPAyGFoP2onQgsxt6is/g1QI1RuRFZWY9Cb22g3PbLLgcevFLKqFjKRm4AbTPth3gjQtmHZqNox13XWNE6cjpYK4C5TJhOpj4BQCNA4i8kqALZAVVcH5o86ZBW2JQKIkjID4BkAiqwilgBntVVCJCWA6FeKAC4BY3KKAu/lhsGlWWGhtLrE2WrWvykBCt5Uru5ktQRMs806tqofAT8xqDTgc24yg2lYgHvKW0SV1FUAxptxaFsfxocRYdiivd7hfxjxYUgAj7/5cWaqMOIgxbYNTFgc9Lq26PWrWwBRkr9I4UNOL/8B7ZhoUdDrfE0PiC4BREmuAlCgBzBdbJjopaDX+W4iPgkFEP3yWjBmJQJKy/+ZnwwU5w06ZQcVwF3etJRIWJKWwekkRcC0Gp9rVzzzuAJ4pObpDNqq0086m9ULwtB7d88bcWYgkgMK4Fl+5lrOzv4SzNemc2T6uVFlwOd8QrcAbkneSsB0/Q7S35KI59Z4897uy7RfBrjLlZlEXJn+IRlkyDjtECJTqr2jj/Xs2UuAwpU8NBRp+Qbgmw3CZ4r5moDP9WxcATySUsLgNzIlGlM8mYoCxc7tsb7dGVBQqozsHML1AK42BZwhnYiwrsbreqqfAJ5yZTYTv5chcSRDs41JuD523NadAaJf3mv3vn786CxMGJOF+lMdONrUmUwQSfallwM+5woNJCqAWCZPg4CdSaIO2n1J0QjcPX5It82+o2FU1oVw5EzETrfxsA8EfK6J3QLYveTtG3yMVaiDUVnXjs0HQykXgRl3BItdtV0ZICkBgN12sfj8xVwMHxJ/2/Hd7x3YUBvCDyc77KLQD5dApTU+50IqXClfHorA9JlaIsbavF814/JEZtH/Nx5oj06LcIR12Sdp1BDwua4jtyTfR8COJMHids+/MhvSw5fphm/4MxKdFvuP2Z8NHecdTnJLTc8ThPd1MzRoaFSAGPy2H0KorA3h73bVoEcD5qp6K3kk5Q3WjrZtamYF0OicUDqj2bC7IWwLO2I8ogmwmcGP2uIBQDICxDjtPHwey3e1WU6RmUpI9Ct7wWzbxYYVAmiRf3wohFV7zlkqAhGVkSjJPwOYYClyDzCrBNAgZ1W0olG2bgVJhA9I9MunwLgiEwQoq2rD9p/PW0aVgC1aBmh5dYllqH2ArMyA13f8g2prH4jVmgAtAHIyQYAn1rXiZIt1U4BBn5MoKd8DnJ/uAqyvbcf6/e3W0iSqII9f2cbMD1iL/D9aslNAWxRX2BF811b4LfL4ZT8z5qWjANomSQu+/qQ9W2Zm9RVNgKeZsSadBIioXaO+oc7ilO8bpMNRQGJZ0y0QhG/TRYCDx7tG/fBpe0a9R5yhYVnOHOo6Cle0N4Etr8JxoxxYPXNkQn3PRxjag+6j1B2OVAd8rqn/HYjI+wDcmZClSYPPXsjFiKHxD0Rqf+sadW0rnKqmzf9g8ailUVYX6kisLczRwD85lPojMXTypMCCvLquDFjRPBEOqrVT/YEORbXgf/3LuoWNbv6EuoDXNUmz73ksXgtG9KTUrqatCW68KgtfHQlbuqkxyjeW/r0EsHsaGCVppz3DcVvQlxN983VnwDSp1RlGR50NJa52xmIG+9OAz/VQrGOvR7PH3zKHWV1pBjVj+pDwYMCb21350u/dJPpl258FF0osIhys8bpu7+m/f4GEX3mMmDdcKJJ2+mWB7g/Oc2r1jt1twNWJW5K3E7SS94unaYXVQV/ewr4RDSiA6FfuAngXGJdeFBIQ9nBr/T3BpWK/pWbc9alban6JQP2KijJQEAUseALFuT8OxH3QQkmxXF4LytAq0f+iJVW4u2Z+7p54A5ewVNYtNX9HoJsycOTBRDODXufGwbgnFEDrLEpySq5rrRSZGWXBYteCRJi6BNBAMunNQKB3anzOOYmC77UU1mMsSspygBOqqgfLLhsCXq3xuRbrxdedATFAUZK9AJYBGK7XSYrsDH8tYjgDukVY0TyRBVpGhKkpCm5wNya/FzItQIxNdAstCM/Yebc4WOTazQ4ErO67vDUyKIanQF/wKf62MQ713HOpFMKKwGNxJC1ADEgTIhvhh1RWC23aR7SCeBN3CpuC851fGxnlpNcBRp25pdZxAqmFAHuYo+V3Zi9fTwHYycD+LIGqquc5TxjlksjesgwYzJF7RZMbAtyCIFzDTGMBHgtgLAgtYGh3EtqviUCNKtTjADc6OtVfdi8YrRVv29r+BTKBrQtOiFe6AAAAAElFTkSuQmCC";

var pauseIcon$4 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAABrJJREFUeF7lm21sU1UYx//PXbcJQ0d7mREkuixqlqiwRA0MQdqymIAoIOAHooD4Fkkc6R0TSCCMQALK1js00YhRXNTEOExQJBOBtgg6UFFQTAxgggYRYe2GA2EvvY+5hc52Xdt7u1O4y863pv/zvPzuyzn3POcQrkFzqmfLwFQKULEE6XYGFwMoAmAHwQ6GHcBJgE4S8UlN035nSdq51yM3Zzs8yoaDivrQbd1aeJqEnMkMdgK4JUM/IQb2SCTt01hqCiiFJzK0k7SbUADO2tBEytHmgWkegELRwTLQJJHU1IW8rfs8BX+JsC8EgLM+NB0anifwoyKCSmuDcJo17e2wNPSt/oLoF4BrnnhvMjoIYHPAI69JCy2JICMAk9SLI23a5XUgLMrUsch+zNhFGq/yV484aNauaQBONTiHGGsBlJp1lmX9RQCr/IqsmvFjCoDb27KSQXryFm70vl9xzDcaoGEAbrXlJWZ6zajh66z7ya/IY43EYAiA0xusIqDWiEErafyKnDa/tAK3GlzKjI1WSsxoLAzeHlBGPJZKnxKAq651PkhrMOrQijrSuNK3dMTryWJLCsBdF5zAEnaCMcyKiZmJiUmaFfDYt/XVp08Azhq/jQrH7AHjITOOLKtlnGfSKgJK0feJc6k+onZ6W9YTaLllE8ogMP07IqDI09IC0Ke3pPH2DHxYvgsTPRnwOD6MDTThEXCrwW+Z8YDls8kkQMJBv0cenxSAS219HKx9kontVH3Gjs6FTQKOnu5GRzenNJ9vI9wzyoZuDThyqkt0KCCSKn0ee8+oEHcHuLzBrQBmi/TqnXsTykbbIiaPnw3jjb3/Jk1MB7V48lDceXNORH/4VDeUxn9EhgOAT+Qhd9xOpTCkG+4B4PS23U8IfyfS2+S78rD6kfhR9NMjHdjk079bEtsSdwFmjM2P+2PNjgvYe6xTZFhgQk30E7oHgMsbfBVAtUhPC8qHYMH4IXEmU13V2Lsl2qnhwCU0NF8SGZZ+2XveBREAD288U9CVk3sUgL5YKaxZFoCeYZjH6+sHEQDOupaFRLRFWOZXDVkZALO2JlBVVBMB4PIGdwBImCT0F4iVAQD4xq/ID14BoAb/BGNUfxPu3d/SAJgvc3u7nSrUtpIwh38Tnbxuz9IA9AGRUU7ZnPpaHgC0F8lZd66GSFo9GO8AItST2xusZ2DJ4ARA28ilhhrAbHgV1Qwoqz8CAB0mpzf0WbZKWtYHgDZyeYO7AFSYubJGtQMAwCX9HdDIwByjSZnRWR4A4TS51eDbzHjWTGJGtZYHAPxCbjW0kZmXGk3KjM7yAIj2k7MutIyIN5hJzKjW6gAI9BG564JzmfCx0aTM6AYAgA3kqj13HyQpYb3cTKLJtFYHwPpUeOL6NntufjiyPia6WR8Apl79HA4dAfOYQQeAJHsUwMtgfmWQATjgV+TyK0tiamsZsfbjYAJAoA0+xbEidlX4AIBxIiFY+R3AwNSAIn8RAyBUDbC+NC6sWRYAYb/fI0/SE/2/MKK2FhNr+tJ4gSgC7tI8rJwaXxj5/OcOeHf3XRhRKgow/d74wsi6pgvw/Sq2MEJMi31VjjfjAOg/3GpwCzMWigIwLJ+gFzvuKLpS6tKb0tiOw0lqfmWjc+Gde2OP9sS5cKQ0dqEjdT3RZLx/5HTSmN3LHecTALjqQtNArC+RC2t3j7ShvCQXtw7PQeB4Z9oyl64tL8lDWAMCxzqFF0gJtMKnOHqm/gnlcZc3uBnAc8IIWMoQ/XCDzT6hqZI6omElAKhQ/y4Ja7Z9IPF1guvNgpmeClQ5PoiNo889QgNsU6QhrsS0zVflmNVbnHyXWBZXigxFLFZ0lsM0JVDt0Ee5uJYUgLO2pZRySN8pJrxkJjY3Q9Ze8Cuy/m5LaKk3SqrBRWC8Y8iFdUUNfkVOOrSn3SqbzcpR1pkR3vV75GdS+UkLQO88ECEw0BhQ5CfSQTYEYABC2ONXZEO1DsMAIhCse1ok5kJn6cBE1IPVzgvFTWoI1T6PbOpcg6k7INaZSx8hgLVWGCb1550JaiYnTTMGEHkkaltKJYnWZqu0ZuAF1gyG6quSG9Npk/3fLwBRo25v69MMTT8taujFk2mwMf0OAdicbHJjxr4QAFGHrk1tU6CF50HDbJD4o7MENDPwnojEozELBRA16lRbh0MLz5QkaQYzzzRzReK1fIyZvpKAL7VcNAcq5VOZ2+q7Z1YA9HblVFuL0d1dDImKAS6WSBrORHZm2Ak8hIA2ENoAatOYzyCsHerScOjrZUXtohPube8/AMNbG4WK/N0AAAAASUVORK5CYII=";

var audioIcon$3 = "data:image/png;base64,[encoded data, 4516 characters]";

var playRepeat$2 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAaCAMAAADhRa4NAAAAAXNSR0IArs4c6QAAAi5QTFRFAAAAAID/QID/M5n/JJL/SZL/TYD/O4nrQJ/vR47xQIz/OovoQ5DpPYXrPYX1QJLtPo3tRJDuOI//QI/vOpL4QpLwOZzxQI7qRYr4Po/sPo/zPYztPZL5QIvuQJHuOZL1RI3vPYrwQYzwOY7xQo7sQo3tQpHtPY7vQY7zI4XzPI/wQI/sQZDtSpHtP4/uPo3nPo3xQYvuRoDuQY3vQIn1QI/tOpfxP4zvQY3sKrv1MYv1QJDtQI/tPpLwQJDxQo/sQI7tQYzuPI7vQZDvQY3xQI7sM6nyQY3sQJLvPpLtQI/tQI/vRIntQI7uQI7vQY7uQY7tQY3tQo7tPYzxP47wQpDuRJDxQo7tQo7vQI3tQ5PtRI3uQJXxQYvxQZDxQJDuQ5DsQI7uPozsOpPtQY7tQI7tQI7uQI/uQ43sQY7tQI/tQY7tQ43vQ4/tQY7tQovsQI/tQY7uQI/wQo7uQo7tQI/uQYztQ43vQYvtQY7tQI7qQI7vQY3uQo/tQI/rQY7uQY7tQo7uP43vQI3vQY7tQY7rQpDvQY7tQY/tQY7tQY7vQY7sQo7tQ5DrQY7sQY7tQo7tQY7tQI3sQI7qQI7sQI/qQI/tQI/uQY3rQY3sQY3tQY7rQY7sQY7tQY/sQY/tQozsQo3pQo3qQo3sQo3tQo7rQo7sQo7tQo7uQo/qQo/sQo/tQ4nrQ4vuQ4zsQ43sQ47qQ47rQ47sQ4/qQ4/sRIvrRobsSI/qS3/qS5DpVRNwpwAAAJJ0Uk5TAAIEBQcHCg0QEhQWFxkZHB0eICAjIyQkJSkpKiosLDExMjM2Njo6Pz9BRERHSElKSktMTlBUXV1eYmNjZGdsbXN2fH6Ch4iJjI+Pj4+Tk5WZmpqgpaWmq6usrq+wsLGzs7a4ubm8vsLHyMvLy8vMzc/V1tbZ3N3e4ePm5ubp6+vs7e7u8PHy8/T29vj5+vz8/P6b5lOEAAABY0lEQVQYGY3BhztVYRwH8C+XsiIjM3tlFZGSPcsoM5SVUXZ2ocgOmSUj76+Lm3OsZEb/HR5d93iPp8fnAyn3+JzyqlfpoddxoeC6n0QkkJJYtgNkHCqVIpU9CguMTG2gLywFHL+Z3wuPLXHqdpmgKlVAyuuv0GgFjYjpjRpIXJlgFbqQunv49Qk08nbfgxOy+OsW1DzWlzzBK9ivh5pzfyFkDH4o7fFfr/8k4J/7VyFz7V7sQr7eA5x4xrpNwHsx16V820o49lIg6jIHJ+ibSMQ+AcjcpkkS+0zAubNGRC4A3k2VjH8cITvw/FfGXHDM2MZU6HF1gpy+OU4pBma9IeemgFrGchNkbrAOqFnQwUPwauff4MzT5VEznBcn7DlCo32r1xZSUcSiIWE9vPrZF2e0k1SbuTjnZqdIxQFaOGEU1bYznQiO4XNSfR+qTkvOaiaRPoRDzqdokIgYI2qJ0cGlHQE0EGWmZ0WkvQAAAABJRU5ErkJggg==";

var playOnce$2 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAgCAMAAAA2a+hwAAAAAXNSR0IArs4c6QAAAlJQTFRFAAAAgID/QID/QID/OY7jRovoO4nrSZLtRIjuPIfwQIzyQJnySZLzRpfzQ4X0QIrqQo7sPo3tEN73RI/wPI3yQZDrPo/sQ4ztQ4zzO4jtQY7tPo7uPYvuQI/vOY3vPo3vPIzrQZHwNqL1QI7wRYTrK4b2QY/uP47uR47yQIvvP43rQI/wP5DwSXz0QozuPYvxQY/uQI3uQY3vQI/yQZDzQpDwQ472QI3uPIn3P4vqQo7vQo3tQI3uQJDuQI7uQI3uQI7sQo7sQpHxQY3sPo7vQI7tQI/xQY7tQY3tQY3vPo7vQo/rP5HuQY3uQJDxQorsQo7sQo7vOI3xQovrQo3rQY7tQY3tQI7tQI3sPY/wN5vvQo7vNKPyQY7tQ43tQY/uQorsQI7sQY3uPJfwQI7wPpPuP4/vQY7tTnTsRJPxP47vQYzsPZDvP43uQo7sO5jvQY3uPZDwQ4ftQI7tQo3uQY7uQo7uQY7tQY7tQ43wQY7tQI3tQI7uQI7tQI/wP4zuQ5DtQY7tRJHsQI7tQY7tQI7tQY7uQI7uQY3uQo7tPpHtQI7tQY/sQY7sQY/tQY7tQY7tQY3sQY/uQI7tQY7tQo7uQo/uSY7tQY/tTXnqQY3tQY7tQY7tQY7tQY7tQY7uQY7tPZXtQY3tQY7tQY7tQY7tQo/tP5LqQI/rQI/sQY3sQY7rQY7sQY7tQY/rQY/sQY/tQZDtQozsQo3rQo3sQo3tQo7qQo7rQo7sQo7tQo/tQ4vsQ4zrQ47qQ47sRIfrRInsRI/rRI/sRYnsR4TqR4fqvnKd/wAAAKd0Uk5TAAIECAkLDQ4PERQUFRYXGBsdHyImJykqKisrLS4wMTEzMzQ0NDs7PT1AQURFRklLS0xOUFNVWFxdYWFlZ2doa2xsbW5vb3BxcnJzdHl5fHx8fH+AgIGCg4iJjIyOjpGSkpOUlZeZm56goaKio6OjpKaqqq6vsLO0t7i5vL7GxsfHyMjLy8zN0tTW2trc4ubn6erq7Ozs7Ozu7vHz9Pb3+Pn6+/v9/v6utNnsAAABnklEQVQYGY3BhVsTcQDH4c8QRbCwu7tbVFQsPLu7u3t2YRfYXRhg7r4GMnYzMPm/nLf7nTjkeXxf/lv7I3OoVP+IllCpvg80l39rNiTrkrQymQpqTD4rV7QriabkRx3tnXdP9tQqkDGAP1IPKXw6qy7ZciYCqbLnY6RdkDKBUVI2MUlL39jr8eQV3elATKdTI4kb+6FsMa7NZY/rkWDw8589ielS8qU3FWwquRoAcu0N+Opg3AxNgFalr2rhSd/3qBuece8vwszvOXjGFEiz8dQOC46GRuNK3iMVaDzG+TBct3vgSpGGrpOFse0rPH3blLhGrdkqC2P5OyhUQ3y7ZWEs/AG31RlfUBbGmiLIdQbiC8rC2P8SNkaW4QvKwrgfhkGhu/h2aRKedsVhqGnb/TAOazqend8OAit0BWP4ycbEdXxR2hJIeRJZS6LArc87+K2Xo2n8Len46xsBXAs+fVxFeU3OhJ61wTNL0XPdMarOkPOwLb7M/GIdGNE8rVr1+n1WX3OcYw0oJ32LnKhcjvKGkaDFohOFirm8PQPPL6EvjEOwGD5qAAAAAElFTkSuQmCC";

function parseLrc(lrc_s) {
  if (lrc_s) {
    lrc_s = lrc_s.replace(/([^\]^\n])\[/g, (match, p1) => p1 + '\n[');
    const lyric = lrc_s.split('\n');
    const lrc = [];
    const lyricLen = lyric.length;
    for (let i = 0; i < lyricLen; i++) {
      // match lrc time
      const lrcTimes = lyric[i].match(/\[(\d{2}):(\d{2})(\.(\d{2,3}))?]/g);
      // match lrc text
      const lrcText = lyric[i].replace(/.*\[(\d{2}):(\d{2})(\.(\d{2,3}))?]/g, '').replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g, '').replace(/^\s+|\s+$/g, '');
      if (lrcTimes) {
        // handle multiple time tag
        const timeLen = lrcTimes.length;
        for (let j = 0; j < timeLen; j++) {
          const oneTime = /\[(\d{2}):(\d{2})(\.(\d{2,3}))?]/.exec(lrcTimes[j]);
          const min2sec = oneTime[1] * 60;
          const sec2sec = parseInt(oneTime[2]);
          const msec2sec = oneTime[4] ? parseInt(oneTime[4]) / ((oneTime[4] + '').length === 2 ? 100 : 1000) : 0;
          const lrcTime = min2sec + sec2sec + msec2sec;
          lrc.push([lrcTime, lrcText]);
        }
      }
    }
    // sort by time
    lrc.sort((a, b) => a[0] - b[0]);
    return lrc;
  } else {
    return [];
  }
}

//
var script$5_ = {
  props: {
    currentMusic: {
      type: Object,
      required: true
    },
    playStat: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      displayLrc: '',
      currentLineIndex: 0
    };
  },
  computed: {
    lrcLines() {
      return parseLrc(this.displayLrc);
    },
    currentLine() {
      if (this.currentLineIndex > this.lrcLines.length - 1) {
        return null;
      }
      return this.lrcLines[this.currentLineIndex];
    },
    transformStyle() {
      // transform: translateY(0); -webkit-transform: translateY(0);
      return {
        transform: `translateY(${-this.currentLineIndex * 16}px)`,
        webkitTransform: `translateY(${-this.currentLineIndex * 16}px)`
      };
    }
  },
  methods: {
    applyLrc(lrc) {
      // if (/^https?:\/\//.test(lrc)) {
      //   this.fetchLrc(lrc)
      // } else {
      //   this.displayLrc = lrc
      // }
      this.fetchLrc(lrc);
    },
    fetchLrc(src) {
      fetch(src).then(response => response.text()).then(lrc => {
        this.displayLrc = lrc;
      });
    },
    hideLrc() {
      this.displayLrc = '';
    }
  },
  watch: {
    currentMusic: {
      deep: true,
      immediate: true,
      handler(music) {
        this.currentLineIndex = 0;
        if (music.lrc) {
          this.applyLrc(music.lrc);
        } else {
          this.hideLrc();
        }
      }
    },
    'playStat.playedTime'(playedTime) {
      for (let i = 0; i < this.lrcLines.length; i++) {
        const line = this.lrcLines[i];
        const nextLine = this.lrcLines[i + 1];
        if (playedTime >= line[0] && (!nextLine || playedTime < nextLine[0])) {
          this.currentLineIndex = i;
        }
      }
    }
  }
};

/* script */
const __vue_script__$5_ = script$5_;
/* template */
var __vue_render__$5_ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "aplayer-lrc" }, [
    _c(
      "div",
      { staticClass: "aplayer-lrc-contents", style: _vm.transformStyle },
      _vm._l(_vm.lrcLines, function (line, index) {
        return _c(
          "p",
          {
            key: index,
            class: { "aplayer-lrc-current": index === _vm.currentLineIndex },
          },
          [_vm._v("\n      " + _vm._s(line[1]) + "\n    ")]
        )
      }),
      0
    ),
  ])
};
var __vue_staticRenderFns__$5_ = [];
__vue_render__$5_._withStripped = true;

  /* style */
  const __vue_inject_styles__$5_ = undefined;
  /* scoped */
  const __vue_scope_id__$5_ = undefined;
  /* module identifier */
  const __vue_module_identifier__$5_ = undefined;
  /* functional template */
  const __vue_is_functional_template__$5_ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5_ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5_, staticRenderFns: __vue_staticRenderFns__$5_ },
    __vue_inject_styles__$5_,
    __vue_script__$5_,
    __vue_scope_id__$5_,
    __vue_is_functional_template__$5_,
    __vue_module_identifier__$5_,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5Z = {
  name: 'XmlAudioModalPlayer',
  components: {
    lyrics: __vue_component__$5_
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    playStyle: {
      type: String,
      default: 'yuan-wen'
    },
    styleMode: {
      type: String,
      default: 'A'
    },
    url: {
      type: String,
      default: '',
      require: true
    },
    title: {
      type: String,
      default: '音频文件'
    },
    coverImageUrl: {
      type: String,
      default: ''
    },
    //进度是否能控制
    scheduleControl: {
      type: String,
      default: ''
    },
    loop: {
      type: Boolean,
      default: true
    },
    playMode: {
      type: String,
      default: 'xun-huan'
    },
    content: {
      type: String,
      default: '暂无简介'
    },
    targerLink: {
      type: String,
      default: ''
    },
    subTitle: {
      type: Boolean,
      default: false
    },
    subTitleSrc: {
      type: String,
      default: ''
    },
    subTitleSrcName: {
      type: String,
      default: ''
    }
  },
  computed: {
    videoAndMusicStop() {
      let playState = sessionStorage.getItem('SET_PLAY_STATE');
      return playState;
    },
    playModeIconSrc() {
      let srcMap = {
        'xun-huan': playRepeat$2,
        'dan-ci': playOnce$2
      };
      return srcMap[this.playMode];
    }
  },
  watch: {
    url: {
      handler(newVal) {
        let _this = this;
        this.isPlay = false;
        let ua = navigator.userAgent;
        /micromessenger/.test(ua.toLowerCase());
        let isIOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        if (isIOS && newVal) {
          try {
            this.$nextTick(() => {
              _this.$refs.musicAudio.muted = true;
              const playPromise = _this.$refs.musicAudio.play();
              _this.$refs.musicAudio.muted = false;
              if (playPromise) {
                playPromise.then(() => {
                  _this.$refs.musicAudio.pause();
                }).catch(error => {
                  _this.$refs.musicAudio.pause();
                  console.log(error);
                });
              }
            });
          } catch (error) {
            console.log(error);
            this.$message({
              type: 'warning',
              message: error,
              duration: 5000
            });
          }
        }
      },
      immediate: true
    },
    subTitleSrc: {
      handler(newVal) {
        this.audio.title = this.title;
        this.audio.src = this.url;
        this.audio.pic = this.coverImageUrl || coverLocal$1;
        this.audio.lrc = newVal;
      },
      immediate: true
    },
    videoAndMusicStop(val) {
      console.log('watch', val);
      let currentPlayStamp = val || '--';
      if (`${this.url}__playTimeStamp__${this.lastOperateTimeStamp}` !== currentPlayStamp) {
        this.musicAudio.pause();
      }
    }
  },
  data() {
    return {
      playIcon: playIcon$5,
      pauseIcon: pauseIcon$4,
      audioIcon: audioIcon$3,
      coverLocal: coverLocal$1,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      link: {
        type: String,
        default: ''
      },
      //链接地址
      lastOperateTimeStamp: '',
      musicAudio: null,
      manualPlay: false,
      audio: {
        title: '',
        artist: '',
        src: '',
        pic: '',
        lrc: ''
      },
      playStat: {
        duration: 0,
        loadedTime: 0,
        playedTime: 0
      }
    };
  },
  mounted() {
    // 加载完毕后，先获取<video>标签DOM对象
    this.musicAudio = this.$refs.musicAudio;
    // this.videoContainer = this.$refs.videoContainer
    if (this.mode != 'editor' && this.playStyle === 'yuan-wen') {
      this.$emit('resetTimeUpdate');
    }
  },
  methods: {
    changeDuration() {
      this.$nextTick(() => {
        this.playDuration = this.timeFormat(this.$refs.musicAudio.duration);
        this.totalDuration = this.$refs.musicAudio.duration;
      });
    },
    //将单位为秒的的时间转换成mm:ss的形式
    timeFormat(num) {
      let minute = parseInt(num / 60);
      let second = parseInt(num % 60);
      minute = minute >= 10 ? minute : `0${minute}`;
      second = second >= 10 ? second : `0${second}`;
      return `${minute}:${second}`;
    },
    play() {
      // if (this.mode==='editor') {
      //   this.$message.warning('音频仅支持在预览模式下播放')
      //   return
      // }
      if (this.playStyle === 'yuan-wen') {
        this.doPlay();
      }
      if (this.playStyle === 'tiao-zhuan') {
        if (this.targerLink) {
          // window.location.href=this.targerLink
          window.open(this.targerLink, '_blank');
        } else {
          this.$message.warning('获取资源链接失败，请检查链接地址');
        }
      }
      if (this.playStyle === 'tan-chuang') {
        this.$emit('showDialog', {
          url: this.url,
          title: this.title,
          coverFileUrl: this.coverImageUrl
        });
      }
    },
    doPlay() {
      console.log('暂停');
      let audio = document.querySelectorAll('audio');
      audio.forEach(i => i.pause());
      let video = document.querySelectorAll('video');
      if (video && video.length) {
        video.forEach(i => i.pause());
      }
      if (this.isPlay) {
        this.$refs.musicAudio.pause();
        this.isPlay = !this.isPlay;
      } else {
        this.manualPlay = true;
        this.$refs.musicAudio.play().then(() => {
          this.isPlay = !this.isPlay;
          let timeStamp = new Date().getTime();
          this.lastOperateTimeStamp = timeStamp;
          let playStamp = `${this.url}__playTimeStamp__${timeStamp}`;
          sessionStorage.setItem('SET_PLAY_STATE', playStamp); //存储
        }).catch(error => {
          this.$message.warning('无效音频资源，请检查资源地址');
          console.log('音频播放catch', error);
        });
      }
      // this.isPlay ? this.$refs.musicAudio.pause() : this.$refs.musicAudio.play()
      // this.isPlay = !this.isPlay
      // let timeStamp = new Date().getTime()
      // this.lastOperateTimeStamp = timeStamp
      // let playStamp = `${this.url}__playTimeStamp__${timeStamp}`
      // // !this.isPlay && this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // // this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // sessionStorage.setItem('SET_PLAY_STATE', playStamp) //存储
    },
    updateTime(e) {
      this.playTime = this.$refs.musicAudio.currentTime;
      this.playStat.playedTime = this.$refs.musicAudio.currentTime;
      this.playCurrentTime = this.timeFormat(this.$refs.musicAudio.currentTime);
      if (this.playTime >= this.totalDuration) {
        this.isPlay = false;
      }
      this.$emit('timeUpdate', {
        event: e,
        time: this.$refs.musicAudio.currentTime
      });
    },
    changeTime(val) {
      this.$refs.musicAudio.currentTime = val;
    },
    onPlay() {
      if (!this.manualPlay) {
        this.$refs.musicAudio.pause();
      }
    }
  }
};

/* script */
const __vue_script__$5Z = script$5Z;

/* template */
var __vue_render__$5Z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "xml-audio-player" }, [
    _c("div", { staticClass: "audio-cover" }, [
      _c(
        "div",
        { staticClass: "square-wrapper" },
        [
          _c("el-image", {
            attrs: {
              src: _vm.coverImageUrl ? _vm.coverImageUrl : _vm.coverLocal,
              alt: "",
            },
          }),
          _vm._v(" "),
          _c("div", { staticClass: "play-button style-a" }, [
            _c("img", {
              staticClass: "button-image",
              attrs: { src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon },
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  return _vm.play.apply(null, arguments)
                },
              },
            }),
          ]),
        ],
        1
      ),
    ]),
    _vm._v(" "),
    _c("div", { staticClass: "audio-player-control" }, [
      _c(
        "div",
        {
          class: [
            "audio-player-title",
            "audio-player-title--modal",
            _vm.mode != "editor" && _vm.title.length >= 16 ? "preview" : "",
          ],
        },
        [
          _c(
            "div",
            {
              staticClass: "scroll-text",
              style:
                _vm.mode != "editor" && _vm.title.length >= 16
                  ? {
                      animation:
                        "fadeNum " +
                        _vm.title.length / 3 +
                        "s linear infinite backwards",
                    }
                  : "",
            },
            [_vm._v("\n        " + _vm._s(_vm.title) + "\n      ")]
          ),
          _vm._v(" "),
          _vm.subTitle
            ? _c("lyrics", {
                staticStyle: { "margin-top": "15px" },
                attrs: {
                  "current-music": _vm.audio,
                  "play-stat": _vm.playStat,
                },
              })
            : _vm._e(),
        ],
        1
      ),
      _vm._v(" "),
      _c("div", { staticClass: "audio-controls" }, [
        _c("div", { staticClass: "audio-controls__handler" }, [
          _c("div", { staticClass: "play-times" }, [
            _c("div", { staticClass: "current-time" }, [
              _vm._v(_vm._s(_vm.playCurrentTime)),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "progress" },
              [
                _c("el-slider", {
                  attrs: {
                    max: _vm.totalDuration,
                    disabled: _vm.scheduleControl !== "yes",
                    "show-tooltip": false,
                  },
                  on: { change: _vm.changeTime },
                  model: {
                    value: _vm.playTime,
                    callback: function ($$v) {
                      _vm.playTime = $$v;
                    },
                    expression: "playTime",
                  },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "total-time" }, [
              _vm._v(_vm._s(_vm.playDuration)),
            ]),
          ]),
        ]),
      ]),
      _vm._v(" "),
      _vm.content
        ? _c("div", { staticClass: "content-block" }, [
            _vm._m(0),
            _vm._v(" "),
            _c("div", { staticClass: "content" }, [
              _vm._v(_vm._s(_vm.content || "暂无")),
            ]),
          ])
        : _vm._e(),
    ]),
    _vm._v(" "),
    _c("audio", {
      ref: "musicAudio",
      staticClass: "audio-component",
      attrs: {
        controls: "",
        preload: "auto",
        src: _vm.url,
        loop: _vm.loop,
        link: _vm.link,
      },
      on: {
        canplay: _vm.changeDuration,
        timeupdate: _vm.updateTime,
        pause: function ($event) {
          _vm.isPlay = false;
        },
        play: _vm.onPlay,
      },
    }),
  ])
};
var __vue_staticRenderFns__$5Z = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "label" }, [_c("span", [_vm._v("简介")])])
  },
];
__vue_render__$5Z._withStripped = true;

  /* style */
  const __vue_inject_styles__$5Z = undefined;
  /* scoped */
  const __vue_scope_id__$5Z = undefined;
  /* module identifier */
  const __vue_module_identifier__$5Z = undefined;
  /* functional template */
  const __vue_is_functional_template__$5Z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5Z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5Z, staticRenderFns: __vue_staticRenderFns__$5Z },
    __vue_inject_styles__$5Z,
    __vue_script__$5Z,
    __vue_scope_id__$5Z,
    __vue_is_functional_template__$5Z,
    __vue_module_identifier__$5Z,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5Y = {
  name: 'XmlMusicRender',
  components: {
    XmlAudioModalPlayer: __vue_component__$5Z
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          console.log('新data', newValue);
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {
        playMode: 'xun-huan',
        scheduleControl: 'yes',
        playStyle: 'yuan-wen',
        styleMode: 'A'
      },
      //属性组件名
      propertyComponentsName: 'xml-music-property',
      dialogShow: false,
      curMusicUrl: '',
      curSubTitle: '',
      curSubTitleSrcName: '',
      curSubTitleSrc: '',
      curMusicTitle: '',
      curCoverFileUrl: '',
      curMusicContent: '',
      currentPlayer: {},
      modalPlayerKey: 'mpk' + new Date().getTime()
    };
  },
  methods: {
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    showDialog(param) {
      this.curMusicUrl = param.url;
      this.curSubTitle = param.subTitle;
      this.curSubTitleSrc = param.subTitleSrc;
      this.curSubTitleSrcName = param.subTitleSrcName;
      this.curMusicTitle = param.title;
      this.curCoverFileUrl = param.coverFileUrl;
      this.curMusicContent = param.content;
      this.currentPlayer = this.blockData.musicSetList[param.playerIndex];
      this.modalPlayerKey = 'mpk' + new Date().getTime();
      this.$nextTick(() => {
        this.dialogShow = true;
      });
    },
    timeUpdate({
      event,
      time
    }, data) {
      // console.log({event, time, data});
      // this.$EventBus.$emit('audioTimeUpdate', { event, time, data })
      this.$EventBus.$emit('audioTimeUpdate', {
        event,
        time,
        data: {
          ...data,
          chapterId: this.currentRule.chapterId,
          xmlCompRef: this.currentRule.xmlCompRef,
          duration: this.$refs.xmlAudioPlay.totalDuration,
          time
        }
      });
    },
    resetTimeUpdate(data) {
      this.$EventBus.$emit('resetTimeUpdate', data);
    }
  },
  created() {},
  computed: {
    isEmpty() {
      return !(this.blockData.musicSetList && this.blockData.musicSetList.length);
    }
  }
};

/* script */
const __vue_script__$5Y = script$5Y;

/* template */
var __vue_render__$5Y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-music-container",
      class: [
        "xml-music-container-" + _vm.pageType,
        "xml-music-style-mode-" + _vm.blockData.styleMode,
      ],
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _vm.blockData.musicSetList && _vm.blockData.musicSetList.length
        ? _vm._l(_vm.blockData.musicSetList, function (item, index) {
            return _c(
              "div",
              {
                key: index,
                staticClass: "fixed-ratio-container xml-group-item",
              },
              [
                _c(
                  "div",
                  {
                    class: [
                      "xml-music__wrapper",
                      "style-mode--" + _vm.blockData.styleMode,
                      _vm.mode,
                    ],
                  },
                  [
                    _c(
                      "div",
                      { staticClass: "xml-music-player-box" },
                      [
                        _c("xml-audio-play", {
                          ref: "xmlAudioPlay",
                          refInFor: true,
                          attrs: {
                            "targer-link": item.link,
                            mode: _vm.mode,
                            styleMode: _vm.blockData.styleMode,
                            "play-style": _vm.blockData.playStyle,
                            "play-mode": _vm.blockData.playMode,
                            url: item.uploadFileUrl
                              ? _vm.resourceBasisPath
                                ? _vm.resourceBasisPath +
                                  item.uploadFileUrl.split("./")[1]
                                : item.uploadFileUrl
                              : "",
                            loop: _vm.blockData.playMode === "xun-huan",
                            title: item.title,
                            playerIndex: index,
                            content: item.content,
                            scheduleControl: _vm.blockData.scheduleControl,
                            subTitle: _vm.blockData.subTitle == "showSubtitle",
                            subTitleSrcName: item.subTitleSrcName,
                            subTitleSrc: item.subTitleSrc,
                            "cover-image-url": item.coverFileUrl
                              ? _vm.resourceBasisPath
                                ? _vm.resourceBasisPath +
                                  item.coverFileUrl.split("./")[1]
                                : item.coverFileUrl
                              : "",
                          },
                          on: {
                            showDialog: _vm.showDialog,
                            timeUpdate: function (e) {
                              return _vm.timeUpdate(e, item)
                            },
                            resetTimeUpdate: function ($event) {
                              return _vm.resetTimeUpdate(item)
                            },
                          },
                        }),
                      ],
                      1
                    ),
                  ]
                ),
              ]
            )
          })
        : [
            _c("div", { staticClass: "fixed-ratio-container" }, [
              _c(
                "div",
                {
                  class: [
                    "xml-music__wrapper",
                    "style-mode--" + _vm.blockData.styleMode,
                    _vm.mode,
                  ],
                },
                [
                  _c(
                    "div",
                    { staticClass: "xml-music-player-box" },
                    [
                      _c("xml-audio-play", {
                        attrs: {
                          mode: _vm.mode,
                          styleMode: _vm.blockData.styleMode,
                          "play-mode": _vm.blockData.playMode,
                          title: "这是音频",
                        },
                      }),
                    ],
                    1
                  ),
                ]
              ),
            ]),
          ],
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          staticClass: "resource-preview player-dialog",
          attrs: {
            title: "",
            visible: _vm.dialogShow,
            "destroy-on-close": true,
            width: "100%",
            modal: false,
            "show-close": false,
            "append-to-body": "",
            "custom-class": "preview-modal-music",
            "close-on-click-modal": true,
          },
          on: {
            "update:visible": function ($event) {
              _vm.dialogShow = $event;
            },
          },
        },
        [
          _c(
            "div",
            { staticClass: "xml-modal-player__wrapper" },
            [
              _c("xml-audio-modal-player", {
                key: _vm.modalPlayerKey,
                attrs: {
                  mode: _vm.mode,
                  styleMode: _vm.blockData.styleMode,
                  "play-style": "yuan-wen",
                  "play-mode": _vm.blockData.playMode,
                  url: _vm.curMusicUrl,
                  loop: _vm.blockData.playMode === "xun-huan",
                  title: _vm.curMusicTitle,
                  content: _vm.curMusicContent,
                  scheduleControl: _vm.blockData.scheduleControl,
                  "cover-image-url": _vm.curCoverFileUrl,
                  subTitle: _vm.curSubTitle,
                  subTitleSrcName: _vm.curSubTitleSrcName,
                  subTitleSrc: _vm.curSubTitleSrc,
                },
                on: {
                  timeUpdate: function (e) {
                    return _vm.timeUpdate(e, _vm.currentPlayer)
                  },
                  resetTimeUpdate: function ($event) {
                    return _vm.resetTimeUpdate(_vm.currentPlayer)
                  },
                },
              }),
            ],
            1
          ),
        ]
      ),
    ],
    2
  )
};
var __vue_staticRenderFns__$5Y = [];
__vue_render__$5Y._withStripped = true;

  /* style */
  const __vue_inject_styles__$5Y = undefined;
  /* scoped */
  const __vue_scope_id__$5Y = undefined;
  /* module identifier */
  const __vue_module_identifier__$5Y = undefined;
  /* functional template */
  const __vue_is_functional_template__$5Y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5Y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5Y, staticRenderFns: __vue_staticRenderFns__$5Y },
    __vue_inject_styles__$5Y,
    __vue_script__$5Y,
    __vue_scope_id__$5Y,
    __vue_is_functional_template__$5Y,
    __vue_module_identifier__$5Y,
    false,
    undefined,
    undefined,
    undefined
  );

var playIcon2 = "data:image/png;base64,[encoded data, 5428 characters]";

var pauseIcon2 = "data:image/png;base64,[encoded data, 5180 characters]";

var recordIcon = "data:image/png;base64,[encoded data, 15340 characters]";

//
var script$5X = {
  name: 'AudioPlay',
  components: {
    lyrics: __vue_component__$5_
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    playStyle: {
      type: String,
      default: 'yuan-wen'
    },
    styleMode: {
      type: String,
      default: 'A'
    },
    url: {
      type: String,
      default: '',
      require: true
    },
    title: {
      type: String,
      default: '音频文件'
    },
    content: {
      type: String,
      default: '暂无简介'
    },
    coverImageUrl: {
      type: String,
      default: ''
    },
    //进度是否能控制
    scheduleControl: {
      type: String,
      default: ''
    },
    loop: {
      type: Boolean,
      default: true
    },
    playMode: {
      type: String,
      default: 'xun-huan'
    },
    targerLink: {
      type: String,
      default: ''
    },
    playerIndex: {
      type: Number,
      default: -1
    },
    subTitle: {
      type: Boolean,
      default: false
    },
    subTitleSrc: {
      type: String,
      default: ''
    },
    subTitleSrcName: {
      type: String,
      default: ''
    }
  },
  computed: {
    videoAndMusicStop() {
      let playState = sessionStorage.getItem('SET_PLAY_STATE');
      return playState;
    },
    playModeIconSrc() {
      let srcMap = {
        'xun-huan': playRepeat$2,
        'dan-ci': playOnce$2
      };
      return srcMap[this.playMode];
    }
  },
  watch: {
    url: {
      handler(newVal) {
        let _this = this;
        this.isPlay = false;
        let ua = navigator.userAgent;
        console.log('浏览器 UA', ua);
        /micromessenger/.test(ua.toLowerCase());
        let isIOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        // isWeixin && isIOS && newVal && this.$message({
        //   message: `当前UA为${ua}`,
        //   duration: 3000
        // })
        if (isIOS && newVal) {
          try {
            this.$nextTick(() => {
              _this.$refs.musicAudio.muted = true;
              const playPromise = _this.$refs.musicAudio.play();
              _this.$refs.musicAudio.muted = false;
              if (playPromise) {
                playPromise.then(() => {
                  _this.$refs.musicAudio.pause();
                }).catch(error => {
                  _this.$refs.musicAudio.pause();
                  console.log(error);
                });
              }
            });
          } catch (error) {
            console.log(error);
            this.$message({
              type: 'warning',
              message: error,
              duration: 5000
            });
          }
        }
      },
      immediate: true
    },
    subTitleSrc: {
      handler(newVal) {
        this.audio.title = this.title;
        this.audio.src = this.url;
        this.audio.pic = this.coverImageUrl || coverLocal$1;
        this.audio.lrc = newVal;
      },
      immediate: true
    },
    videoAndMusicStop(val) {
      console.log('watch', val);
      let currentPlayStamp = val || '--';
      if (`${this.url}__playTimeStamp__${this.lastOperateTimeStamp}` !== currentPlayStamp) {
        this.musicAudio.pause();
      }
    }
  },
  data() {
    return {
      playIcon: playIcon$5,
      playIcon2,
      pauseIcon: pauseIcon$4,
      pauseIcon2,
      audioIcon: audioIcon$3,
      coverLocal: coverLocal$1,
      recordIcon,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      link: {
        type: String,
        default: ''
      },
      //链接地址
      lastOperateTimeStamp: '',
      musicAudio: null,
      manualPlay: false,
      Volume: 100,
      //音量
      doubleSpeed: 1,
      //倍速
      audio: {
        title: '',
        artist: '',
        src: '',
        pic: '',
        lrc: ''
      },
      playStat: {
        duration: 0,
        loadedTime: 0,
        playedTime: 0
      }
    };
  },
  mounted() {
    // 加载完毕后，先获取<video>标签DOM对象
    this.musicAudio = this.$refs.musicAudio;
    // this.videoContainer = this.$refs.videoContainer
    if (this.mode != 'editor' && this.playStyle === 'yuan-wen') {
      this.$emit('resetTimeUpdate');
    }
  },
  methods: {
    changeDuration() {
      this.$nextTick(() => {
        this.playDuration = this.timeFormat(this.$refs.musicAudio.duration);
        this.totalDuration = this.$refs.musicAudio.duration;
      });
    },
    //将单位为秒的的时间转换成mm:ss的形式
    timeFormat(num) {
      let minute = parseInt(num / 60);
      let second = parseInt(num % 60);
      minute = minute >= 10 ? minute : `0${minute}`;
      second = second >= 10 ? second : `0${second}`;
      return `${minute}:${second}`;
    },
    play() {
      // if (this.mode==='editor') {
      //   this.$message.warning('音频仅支持在预览模式下播放')
      //   return
      // }
      if (this.playStyle === 'yuan-wen') {
        this.doPlay();
      }
      if (this.playStyle === 'tiao-zhuan') {
        if (this.targerLink) {
          // window.location.href=this.targerLink
          window.open(this.targerLink, '_blank');
        } else {
          this.$message.warning('获取资源链接失败，请检查链接地址');
        }
      }
      if (this.playStyle === 'tan-chuang') {
        this.$emit('showDialog', {
          url: this.url,
          title: this.title,
          coverFileUrl: this.coverImageUrl,
          content: this.content,
          playerIndex: this.playerIndex,
          subTitle: this.subTitle,
          subTitleSrc: this.subTitleSrc,
          subTitleSrcName: this.subTitleSrcName
        });
      }
    },
    doPlay() {
      let audio = document.querySelectorAll('audio');
      audio.forEach(i => i.pause());
      let video = document.querySelectorAll('video');
      if (video && video.length) {
        video.forEach(i => i.pause());
      }
      if (this.isPlay) {
        this.$refs.musicAudio.pause();
        this.isPlay = !this.isPlay;
      } else {
        this.manualPlay = true;
        this.$refs.musicAudio.play().then(() => {
          this.isPlay = !this.isPlay;
          let timeStamp = new Date().getTime();
          this.lastOperateTimeStamp = timeStamp;
          let playStamp = `${this.url}__playTimeStamp__${timeStamp}`;
          sessionStorage.setItem('SET_PLAY_STATE', playStamp); //存储
        }).catch(error => {
          this.$message.warning('无效音频资源，请检查资源地址');
          console.log('音频播放catch', error);
        });
      }
      // this.isPlay ? this.$refs.musicAudio.pause() : this.$refs.musicAudio.play()
      // this.isPlay = !this.isPlay
      // let timeStamp = new Date().getTime()
      // this.lastOperateTimeStamp = timeStamp
      // let playStamp = `${this.url}__playTimeStamp__${timeStamp}`
      // // !this.isPlay && this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // // this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // sessionStorage.setItem('SET_PLAY_STATE', playStamp) //存储
    },
    updateTime(e) {
      this.playTime = this.$refs.musicAudio.currentTime;
      this.playStat.playedTime = this.$refs.musicAudio.currentTime;
      this.playCurrentTime = this.timeFormat(this.$refs.musicAudio.currentTime);
      if (this.playTime >= this.totalDuration) {
        this.isPlay = false;
      }
      this.$emit('timeUpdate', {
        event: e,
        time: this.$refs.musicAudio.currentTime
      });
    },
    changeTime(val) {
      this.$refs.musicAudio.currentTime = val;
    },
    onPlay() {
      if (!this.manualPlay) {
        this.$refs.musicAudio.pause();
      }
    },
    changeVolume(val) {
      this.$refs.musicAudio.volume = val / 100;
    },
    changeDoubleSpeed() {
      if (this.doubleSpeed == 1) {
        this.doubleSpeed = 1.25;
      } else if (this.doubleSpeed == 1.25) {
        this.doubleSpeed = 1.5;
      } else if (this.doubleSpeed == 1.5) {
        this.doubleSpeed = 2;
      } else if (this.doubleSpeed == 2) {
        this.doubleSpeed = 0.5;
      } else if (this.doubleSpeed == 0.5) {
        this.doubleSpeed = 1;
      }
      this.$refs.musicAudio.playbackRate = this.doubleSpeed;
    }
  }
};

/* script */
const __vue_script__$5X = script$5X;

/* template */
var __vue_render__$5X = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { class: ["xml-audio-player", _vm.mode] },
    [
      _vm.styleMode == "A" || _vm.styleMode == "B" || _vm.styleMode == "C"
        ? _c("div", { staticClass: "play-mode-wrap" }, [
            _c("img", {
              staticClass: "play-control-image",
              attrs: { src: _vm.playModeIconSrc },
            }),
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.styleMode == "A" || _vm.styleMode == "B" || _vm.styleMode == "C"
        ? _c("div", { staticStyle: { width: "100%", display: "flex" } }, [
            _vm.styleMode !== "C"
              ? _c(
                  "div",
                  { staticClass: "audio-cover" },
                  [
                    _c("el-image", {
                      staticClass: "xml-round-6",
                      attrs: {
                        src: _vm.coverImageUrl
                          ? _vm.coverImageUrl
                          : _vm.coverLocal,
                        alt: "",
                      },
                    }),
                    _vm._v(" "),
                    _vm.styleMode === "A"
                      ? _c("div", { staticClass: "play-button style-a" }, [
                          _c("img", {
                            staticClass: "button-image",
                            attrs: {
                              src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon,
                            },
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.play.apply(null, arguments)
                              },
                            },
                          }),
                        ])
                      : _vm._e(),
                  ],
                  1
                )
              : _vm._e(),
            _vm._v(" "),
            _c("div", { staticClass: "audio-player-control" }, [
              _c(
                "div",
                {
                  class: [
                    "audio-player-title",
                    _vm.mode != "editor" && _vm.title.length >= 16
                      ? "preview"
                      : "",
                  ],
                },
                [
                  _c(
                    "div",
                    {
                      staticClass: "xml-audio-title scroll-text",
                      style:
                        _vm.mode != "editor" && _vm.title.length >= 16
                          ? {
                              animation:
                                "fadeNum " +
                                _vm.title.length / 3 +
                                "s linear infinite backwards",
                            }
                          : "",
                    },
                    [
                      _vm._v(
                        "\n            " + _vm._s(_vm.title) + "\n          "
                      ),
                    ]
                  ),
                ]
              ),
              _vm._v(" "),
              _c("div", { staticClass: "audio-controls" }, [
                _vm.styleMode !== "A"
                  ? _c(
                      "div",
                      { staticClass: "audio-controls__play-button-wrapper" },
                      [
                        _c("div", { staticClass: "play-button" }, [
                          _c("img", {
                            staticClass: "button-image",
                            attrs: {
                              src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon,
                            },
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.play.apply(null, arguments)
                              },
                            },
                          }),
                        ]),
                      ]
                    )
                  : _vm._e(),
                _vm._v(" "),
                _c("div", { staticClass: "audio-controls__handler" }, [
                  _c(
                    "div",
                    { staticClass: "progress" },
                    [
                      _vm.subTitle
                        ? _c("lyrics", {
                            staticStyle: { "margin-top": "-25px" },
                            attrs: {
                              "current-music": _vm.audio,
                              "play-stat": _vm.playStat,
                            },
                          })
                        : _vm._e(),
                      _vm._v(" "),
                      _c("el-slider", {
                        attrs: {
                          max: _vm.totalDuration,
                          disabled: _vm.scheduleControl !== "yes",
                          "show-tooltip": false,
                        },
                        on: { change: _vm.changeTime },
                        model: {
                          value: _vm.playTime,
                          callback: function ($$v) {
                            _vm.playTime = $$v;
                          },
                          expression: "playTime",
                        },
                      }),
                    ],
                    1
                  ),
                  _vm._v(" "),
                  _c("div", { staticClass: "play-times" }, [
                    _c("div", { staticClass: "current-time" }, [
                      _vm._v(_vm._s(_vm.playCurrentTime)),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "total-time" }, [
                      _vm._v(_vm._s(_vm.playDuration)),
                    ]),
                  ]),
                ]),
              ]),
            ]),
          ])
        : _vm.styleMode == "D"
        ? _c("div", { staticClass: "audio-play-box" }, [
            _c(
              "div",
              { staticClass: "audio-cover" },
              [
                _c("div", { staticClass: "video-pause-btn" }, [
                  _c(
                    "div",
                    { staticClass: "audio-controls__play-button-wrapper" },
                    [
                      _c("div", { staticClass: "play-button" }, [
                        _c("img", {
                          staticClass: "button-image",
                          attrs: {
                            src: _vm.isPlay ? _vm.pauseIcon2 : _vm.playIcon2,
                          },
                          on: {
                            click: function ($event) {
                              $event.stopPropagation();
                              return _vm.play.apply(null, arguments)
                            },
                          },
                        }),
                      ]),
                    ]
                  ),
                ]),
                _vm._v(" "),
                _c("el-image", {
                  staticClass: "xml-round-6",
                  attrs: { src: _vm.recordIcon, alt: "" },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "audio-player-control" }, [
              _c(
                "div",
                {
                  class: [
                    "audio-player-title",
                    _vm.mode != "editor" && _vm.title.length >= 16
                      ? "preview"
                      : "",
                  ],
                },
                [
                  _c(
                    "div",
                    {
                      staticClass: "xml-audio-title scroll-text",
                      style:
                        _vm.mode != "editor" && _vm.title.length >= 16
                          ? {
                              animation:
                                "fadeNum " +
                                _vm.title.length / 3 +
                                "s linear infinite backwards",
                            }
                          : "",
                    },
                    [_vm._v("\n          " + _vm._s(_vm.title) + "\n        ")]
                  ),
                ]
              ),
              _vm._v(" "),
              _c("div", { staticClass: "audio-controls" }, [
                _c("div", { staticClass: "audio-controls__handler" }, [
                  _c(
                    "div",
                    { staticClass: "progress" },
                    [
                      _vm.subTitle
                        ? _c("lyrics", {
                            staticStyle: { "margin-top": "-25px" },
                            attrs: {
                              "current-music": _vm.audio,
                              "play-stat": _vm.playStat,
                            },
                          })
                        : _vm._e(),
                      _vm._v(" "),
                      _c("el-slider", {
                        attrs: {
                          max: _vm.totalDuration,
                          disabled: _vm.scheduleControl !== "yes",
                          "show-tooltip": false,
                          "tooltip-class": "silder-bg",
                        },
                        on: { change: _vm.changeTime },
                        model: {
                          value: _vm.playTime,
                          callback: function ($$v) {
                            _vm.playTime = $$v;
                          },
                          expression: "playTime",
                        },
                      }),
                    ],
                    1
                  ),
                  _vm._v(" "),
                  _c("div", { staticClass: "play-times" }, [
                    _c("div", { staticClass: "current-time" }, [
                      _vm._v(_vm._s(_vm.playCurrentTime)),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "total-time" }, [
                      _vm._v(_vm._s(_vm.playDuration)),
                    ]),
                  ]),
                ]),
              ]),
            ]),
          ])
        : _vm.styleMode == "E"
        ? _c("div", { staticClass: "styleModeE_content" }, [
            _c("div", { staticClass: "styleModeE_title" }, [
              _vm._v(_vm._s(_vm.title)),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "styleModeE_row" }, [
              _c(
                "div",
                {
                  staticStyle: { cursor: "pointer" },
                  on: {
                    click: function ($event) {
                      $event.stopPropagation();
                      return _vm.play.apply(null, arguments)
                    },
                  },
                },
                [
                  _vm.isPlay
                    ? _c("i", {
                        staticClass: "el-icon-video-pause",
                        staticStyle: { "font-size": "28px" },
                      })
                    : _c("i", {
                        staticClass: "el-icon-caret-right",
                        staticStyle: { "font-size": "28px" },
                      }),
                ]
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "styleModeE_progress" },
                [
                  _vm.subTitle
                    ? _c("lyrics", {
                        staticStyle: { "margin-top": "-25px" },
                        attrs: {
                          "current-music": _vm.audio,
                          "play-stat": _vm.playStat,
                        },
                      })
                    : _vm._e(),
                  _vm._v(" "),
                  _c("el-slider", {
                    attrs: {
                      max: _vm.totalDuration,
                      disabled: _vm.scheduleControl !== "yes",
                      "show-tooltip": false,
                    },
                    on: { change: _vm.changeTime },
                    model: {
                      value: _vm.playTime,
                      callback: function ($$v) {
                        _vm.playTime = $$v;
                      },
                      expression: "playTime",
                    },
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticStyle: {
                    display: "flex",
                    "flex-direction": "row",
                    "align-items": "center",
                  },
                },
                [
                  _c("div", [
                    _vm._v(
                      _vm._s(_vm.playCurrentTime) +
                        "/ " +
                        _vm._s(_vm.playDuration)
                    ),
                  ]),
                  _vm._v(" "),
                  _c(
                    "el-popover",
                    {
                      attrs: {
                        placement: "bottom",
                        width: "200",
                        trigger: "click",
                      },
                    },
                    [
                      _c(
                        "div",
                        [
                          _c("el-slider", {
                            attrs: { "show-tooltip": false },
                            on: { change: _vm.changeVolume },
                            model: {
                              value: _vm.Volume,
                              callback: function ($$v) {
                                _vm.Volume = $$v;
                              },
                              expression: "Volume",
                            },
                          }),
                        ],
                        1
                      ),
                      _vm._v(" "),
                      _c("i", {
                        staticClass: "el-icon-s-tools",
                        staticStyle: {
                          "font-size": "18px",
                          "margin-left": "15px",
                          cursor: "pointer",
                        },
                        attrs: { slot: "reference" },
                        slot: "reference",
                      }),
                    ]
                  ),
                ],
                1
              ),
            ]),
          ])
        : _vm.styleMode == "F"
        ? [
            _c("div", { staticClass: "styleModeF_row styleModeF_content" }, [
              _c("div", { staticStyle: { position: "relative" } }, [
                _c("div", { staticClass: "styleModeF_IMG" }, [
                  _c("img", {
                    attrs: {
                      src: _vm.coverImageUrl
                        ? _vm.coverImageUrl
                        : _vm.coverLocal,
                      alt: "",
                    },
                  }),
                ]),
                _vm._v(" "),
                _vm.isPlay
                  ? _c("i", {
                      staticClass: "el-icon-video-pause styleModeF_I",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.play.apply(null, arguments)
                        },
                      },
                    })
                  : _c("i", {
                      staticClass: "el-icon-video-play styleModeF_I",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.play.apply(null, arguments)
                        },
                      },
                    }),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticStyle: { "margin-left": "20px", width: "100%" } },
                [
                  _c("div", { staticClass: "styleModeF_row" }, [
                    _c(
                      "div",
                      {
                        staticStyle: { cursor: "pointer" },
                        on: {
                          click: function ($event) {
                            $event.stopPropagation();
                            return _vm.play.apply(null, arguments)
                          },
                        },
                      },
                      [
                        _vm.isPlay
                          ? _c("i", {
                              staticClass: "el-icon-video-pause",
                              staticStyle: { "font-size": "28px" },
                            })
                          : _c("i", {
                              staticClass: "el-icon-caret-right",
                              staticStyle: { "font-size": "28px" },
                            }),
                      ]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "styleModeF_progress" },
                      [
                        _c("el-slider", {
                          attrs: {
                            max: _vm.totalDuration,
                            disabled: _vm.scheduleControl !== "yes",
                            "show-tooltip": false,
                          },
                          on: { change: _vm.changeTime },
                          model: {
                            value: _vm.playTime,
                            callback: function ($$v) {
                              _vm.playTime = $$v;
                            },
                            expression: "playTime",
                          },
                        }),
                      ],
                      1
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticStyle: {
                          display: "flex",
                          "flex-direction": "row",
                          "align-items": "center",
                        },
                      },
                      [
                        _c("div", [
                          _vm._v(
                            _vm._s(_vm.playCurrentTime) +
                              " / " +
                              _vm._s(_vm.playDuration)
                          ),
                        ]),
                        _vm._v(" "),
                        _c(
                          "el-popover",
                          {
                            attrs: {
                              placement: "bottom",
                              width: "200",
                              trigger: "click",
                            },
                          },
                          [
                            _c(
                              "div",
                              [
                                _c("el-slider", {
                                  attrs: { "show-tooltip": false },
                                  on: { change: _vm.changeVolume },
                                  model: {
                                    value: _vm.Volume,
                                    callback: function ($$v) {
                                      _vm.Volume = $$v;
                                    },
                                    expression: "Volume",
                                  },
                                }),
                              ],
                              1
                            ),
                            _vm._v(" "),
                            _c("i", {
                              staticClass: "el-icon-s-tools",
                              staticStyle: {
                                "font-size": "18px",
                                "margin-left": "15px",
                                cursor: "pointer",
                              },
                              attrs: { slot: "reference" },
                              slot: "reference",
                            }),
                          ]
                        ),
                      ],
                      1
                    ),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "styleModeF_title" }, [
                    _vm._v("当前倍速："),
                    _c(
                      "span",
                      {
                        staticStyle: { cursor: "pointer" },
                        on: { click: _vm.changeDoubleSpeed },
                      },
                      [_vm._v("X" + _vm._s(_vm.doubleSpeed))]
                    ),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "styleModeF_title" }, [
                    _vm._v("\n          " + _vm._s(_vm.title) + "\n        "),
                  ]),
                  _vm._v(" "),
                  _vm.subTitle
                    ? _c("lyrics", {
                        staticStyle: { "margin-top": "10px" },
                        attrs: {
                          "current-music": _vm.audio,
                          "play-stat": _vm.playStat,
                        },
                      })
                    : _vm._e(),
                ],
                1
              ),
            ]),
          ]
        : _vm._e(),
      _vm._v(" "),
      _c("audio", {
        ref: "musicAudio",
        staticClass: "audio-component",
        attrs: {
          controls: "",
          preload: "auto",
          src: _vm.url,
          loop: _vm.loop,
          link: _vm.link,
        },
        on: {
          canplay: _vm.changeDuration,
          timeupdate: _vm.updateTime,
          pause: function ($event) {
            _vm.isPlay = false;
          },
          play: _vm.onPlay,
        },
      }),
    ],
    2
  )
};
var __vue_staticRenderFns__$5X = [];
__vue_render__$5X._withStripped = true;

  /* style */
  const __vue_inject_styles__$5X = undefined;
  /* scoped */
  const __vue_scope_id__$5X = undefined;
  /* module identifier */
  const __vue_module_identifier__$5X = undefined;
  /* functional template */
  const __vue_is_functional_template__$5X = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5X = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5X, staticRenderFns: __vue_staticRenderFns__$5X },
    __vue_inject_styles__$5X,
    __vue_script__$5X,
    __vue_scope_id__$5X,
    __vue_is_functional_template__$5X,
    __vue_module_identifier__$5X,
    false,
    undefined,
    undefined,
    undefined
  );

const MusicComponents = [__vue_component__$5Y, __vue_component__$5X];
var XmlMusic = {
  ...MusicComponents
};

const radioType$1 = ['1', '4'];
const checkType$1 = ['2', '5'];
const showOptionsType$1 = ['1', '2', '4', '5'];
const showJudgeAnswerType$1 = ['3'];
const showSortType$1 = ['7'];
const showRichTextAnswerType$1 = ['10', '13'];
const isclozeType$1 = ['10', '11', '12'];
const isRadio$1 = type => {
  return radioType$1.includes(type);
};
const isCheck$1 = type => checkType$1.includes(type);
const showOptions$1 = type => showOptionsType$1.includes(type);
const showJudgeAnswer$1 = type => showJudgeAnswerType$1.includes(type);
const showSort$1 = type => showSortType$1.includes(type);
const showRichTextAnswer$1 = type => showRichTextAnswerType$1.includes(type);
const isCloze$1 = type => isclozeType$1.includes(type);

var playIcon$4 = "data:image/png;base64,[encoded data, 4152 characters]";

var pauseIcon$3 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAACvBJREFUeF7tnW2MHVUZx//PbHaTtiGQ9IOagCE1pnywInwQElstqUCB1iABPrb2bZ7ZYGo0UWkgiKGm1UQTFbNzbtwV9yOEVC2lLa8l+KFtImDBlCaFGCQYTCRW0y7srvOYczNX9uW+zMuZuTP3PpPc7LZ7znPO839+c2bumWfOIQzgMTU1tWZ2dvYaIloLYG38c6WIND9EtALAyvhjFbhERBftTxFpfjzP+0BEznqed3Z+fv7N0dHRs7t37/5g0OSiujs0PT29amZmZiOArQC+ZAMOYLQgv94norMi8oLneSdmZmZO792796OC2irFbC0BCMPwWiL6CoCb4sCPlKLW8kY+BPA8gFNRFJ0eHx8/3qd+ZG62NgAYY24AsBnAbQDs71U8zovIUc/zjvq+f7SKHVzap0oDUJOgd4pzLWCoJACNRmOLiPjx8F6HE6lXH48BmGLmJ3oVLPvvlQJgAAO/NJ4vichUEATTZQe6U3uVAGAIAr9IfyI6HUVRGATBb/oNQl8BmJiYuNrzvH0A7HA/jMeTnucd2LNnz5/65XzfADDG3AfgfgBX9sv5KrQrIjNEdADAQWaeK7tPpQNgjFkvIvuI6Payna1ye0R0Moqig0EQ/L7MfpYKgDHmAQD7y3Swhm09zMw/LKvfpQBgZ+48z9svIlvKcqzO7YjIISL6LjO/VbQfhQMQhmFARPasX120MwNm/y0Lge/7h4r0q1AAjDGPAdhepANDYLvQS0JhADQajWdE5OYhCFDhLorIZBAEu4toqBAAjDGvALiuiA4Pq00ROR4EgX0Y5vRwDkAYhu8Q0VVOe6nGWgr8hZk/51IOpwAYY2xWjc200aMgBUTk30EQXO7KvDMAjDH/AuCsY64cHFA7/2DmT7jwzQkAxpgzANa56JDaSKYAEb3g+/6mZKU7l8oNgDHmKQB35O2I1k+vgIj8MgiCvelrflwjFwDGmMcB3JOnA1o3twI/YebvZ7WSGQCd5MkqeSH1Mk8WZQIgnt6dKMQVNZpJASK6K8u0cWoA4pRsmwqtc/uZQlVYJfvg6Na0D5BSA9BoNA7rU73CgpjLsH2KGATBXWmMpAJAn+enkbZvZVPdDyQGwGbyAHi5b25pw4kVEJE7k2YWJQYgDMMjmsaVOAZ9LWjTy0Tky0lyDBMBECdwPtpXr7TxtAo8xMyP9KrUE4A4ddsO/UOdvdtLyKr93WYbj4yMbOiVct4TAGOMGeK8/arFNW1/nmTmu7tV6gpA/MbO4bStavnqKCAiO7u9gdQVAGPMHwboBc3qRKXEntjX0Hzf7/g6fUcA9OwvMUoFNyUi2zu9kNoRgCqf/UR0QkROJNDt4QRlkhTpaYeINoqIXaqmisdLzNy2b20BqPrZbwHwfd8uD9PxmJiY2Oh53osuohFF0U3j4+NdgWs0Gi9WGAArw73t1idoC0CVz37riQKQCetjzGyX11l0LAMgXpblZKYmSqqkAGQT2s7kLl27qB0APwDQ85qXrQtuaikA2XRsl0LWDgB79ld1Fa6m5wpANgAAnGfmzy6svQiAOgz/CkDm4LdOnkWXgaUAVH74VwDyAbD0MrAUgMoP/wpAPgCWXgb+D4Ax5noAfVusKI1beg+QRq3lZYlos+/7zWVtFwLwPQA/zme6nNoKQG6dH2Hmh5YCYIm4JbfpEgwoAPlEtqudB0HQfK2sOQJMTk5eNj8/b1/u9PKZLqe2ApBb54/Gxsau2LFjx4dNAMIwvJuIKreObSc3FYDcAEBEbgmC4NkWAL8mol35zZZjQQFwonPzPqAJgDHmdQBOV55w0sUORhSA/Oq2NGwBMFvgNiv5e7vEggLgRNL3mfmTZDdYmpubK3xBQiddjo0oAG7UHBkZWU1hGN5OREfcmCzHigLgRucoitaTMebbAH7mxmQ5VhQANzp7nrfbAhACYDcmy7GiADjT+adUg1y2Zd4qAG4AIKKnLQCnROSLbkyWY0UBcKOziJy0l4BazQFY1xUANwAAOGO/Bdhlydc4M1mCIQXAjchEdN6OAO8B+JQbk+VYUQDc6ExE71kAarfEqwLgBgAAFywAtZoG1nsAZ8G3huYUgAR6DsirYe08bQKgl4AeEAwwAM1LgN4EDi8Af9evgUN8CRCRt3UiaIgBAPCGTgUPMQB2+Rh9GDTcAJzQx8FDDIBNB9WEkOEG4DuaEjbEAIjIHZoUOsQAjI6OfkbTwocXgDlmHtMXQ4YXgDeYeV0LgFolhurj4ATU9i5imDloAWA3frQbQNbiUACchGkLMx9pAjA9Pb1qZmbmAoARJ6YLNqIA5Bb4vytWrLh827ZtFxeuEHIIwJ25TZdgQAHILfLvmPnrzeSaliljjN2D9ue5TZdgQAHILfK3mPkXiwCIN4R8LbfpEgwoAPlEFpEvBEHw50UA2H8YY3SZuDbaDlhG0ClmvrHlpi4UmeBkGjAAFm0sqUvFDh8ANzLzqbYjQF0uA3oPkIDa9kUWDf/L7gFiACq/XrACkBmAZfsK64YRCbQcoHuARcN/2xEgHgUqvV2cjgAJqF1e5DAzf23pf+umUQm0HIQRgIi2+r6/7HmPbhuXAIAkW+hUfNu4tmd/x0uA/UPVt45LFjct1Qxyh7O/KwB1uBfQ8CZSoOPZ3xMAHQUSCVzpQt3O/p4AxKOAbh9f6RB37VyDmbsuAdh193BremJi4mrP814GcGV9dRjKnr8bRdGG8fHxv3bzvicA8ShwH4BHh1LG+jr9TWb+Va/uJwLAGgnD8IjderSXQf17/xUQkaeDILB5nj2PxAAYY9YDsJcCPaqvwAZm/mOSbiYGIL4UPABgfxLDWqZvCjzIzD9K2noqAKzRRqNxWES2JG1Ay5WnABE95fv+1jQtpgYgzh18HsDqNA1p2cIV+KeIbGrl+iVtLTUA8Q1hQEQTSRvRcsUrICLjQRDYN7xSHZkAiO8HHgOwPVVrWrgoBX7LzN/IYjwzAPH9wDMicnOWhrWOGwWI6Fnf9zPv+JoLgHgkeAXAdW7cUSspFXiVme2m35mP3ADE9wTvENFVmXuhFVMrICJ/C4Lg06krLqngBIB4JLgIYGXeDmn9RApcYuZViUr2KOQMgBiC2q077ELEkm1cYOYrXLXpFIAYgjMA1rnqoNpZpMDrzPx5l5o4ByCGwCYfJnoY4dKZAbd1hJmdz8AWAkAMweMA7hnwoJTl3hPMfG8RjRUGQAyBThblj1rmSZ4kTRcKQPwV0U4b2yeI+uwgSUQ+LmPn9h/MMr2bppnCAYghuNbzvP36FDFZaOxTvSiKbPCbizgUeZQCQMsBY4zmE/SOZqrn+b3NdS9RKgDxfcF6Edmn6WWLA2PTuIjoQNJMnryBb9UvHYAFo4FNNL1fs43xLoCDSRI4XQV9oZ2+AWA7Eaec7wPgF+FcDWw2oig60Ct1u0g/+gpAy7H4DSQLQap0piKFKdj2YSJqtHtbt+B2l5mvBABDBEJlAt/3e4BupA/giFC5wFcagAU3ijcA2AzgNgD29zoddiWuowCOLVyVq2oOVOoS0E0cY0wdYKhF0CvzLSDr2WCMsWlQXwWwKf7pZbWVs14E4DkANk3+OWa26XG1OmozAnRSdXJy8rK5ublb7aWCiOwosRbAaEFRmANwTkTsmX5sdHT0+K5du/5TUFulmK09AO1UmpqaWjM7O3sNEVkY1sY/V4pI80NEK+L0tVYK2yUAl0Rkhogu2U/873NxwM+NjY29uXPnzrdLiUqJjfwPv88HKuMCFxkAAAAASUVORK5CYII=";

var audioIcon$2 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAAzxJREFUWEftmE1rU1EQhp+5N2msQVCogtWCC0EwG4OCG3+ClGpxobhQ8GMjKFjbFBfWVBQpght3LvzoxoVYwT8gLkQQNyKKigEXpXXhB9LEmOSMTK7R1sTkRpOmggMhJ+TcmefOmXPeuVeYZzo6uhPnDgIJRLrn/9eG8WfgCdHoFRkff1TxLzbQoaE4kchNYFcbAtd36XmObDYtly+ftYkBUCp1F+hfdJhKQFXw/SE5f/6S6PDwAJ53p2MwP6FyqG4UHRm5jcjujgOVl0pPiKZSL4BNSwIIbhjQW6BviQDdaj2QFahZqQSFghUrdHWFvd8WADkXBDZbtgxWrYLeXujrC77fvYOpqQCssf0BUD4PkQgsXw5r1sC6dUFwG69eDbFYVVg9dw6Zm2uMA00C2V3u2RMArFwJnhcmCDo+jmSzYeY2AeQcum0bYkBN2pIAcrlcWQaku3txM6SquOlp3OwsxUwGMhl0ZgZvdpaukyfxtmxpP1Dh6VOKjx/jMhm8Dx/w8nk8Efx4HM92mghYER8+DIlE+4Hc1avIy5dINGrHffD51ayIjxxZHCAmJ+HZs/ql/R/on8mQSUmlrg4c6HANmaAmEtDfH2ia/fb9Nuyy7/qlySSydy81i9qyEo/DyEiVurf2pDYRHRiADRvQfB7p6akNVEdaNJ1GcrkwgtNAy6ytOHasDLPAam17VUpr1+IfP75gqrMDMp3GCyfEdYBsCVasQE+fDh5N5plOTiI1dpn78oXi4CBdO3aUZ2upRP76dWLPnyPWsjS2+hlyIsjYGDKv47MzWScm8N6/r3YvQuHjRwq9veWl1TdviBUK+CYn4aw+kBaLfE0mie3b98Pd1/v3iUxNBZr1OxMpZ0esf6olK7+/snE/VJqbI9/Tg5dM4l69Ivr6NVFrzpoLFC4/zXSMznZYLFZVT2EjhZzXOEMhHbVqWhnIZHtzqzz+lR/VawZkbz32/5WjVl3s3CHR0dHtOPcQsTavg6Y6Qza7qfI6ZgzVM+XWszNWpFTaJRMT934QaCp1CjgDxBeNyY4OkWlEjsqFC/cs7oKU6PDwekQGEdmKc9WPoK0i9X1FJIdzD1C9LRcvfqq4/gYOF90Ot1xnCQAAAABJRU5ErkJggg==";

//
var script$5W = {
  name: 'audio-play',
  props: {
    url: {
      type: String,
      default: '',
      require: true
    },
    mobile: {
      type: Boolean,
      default: false
    },
    isLineFile: {
      type: Boolean,
      default: false
    },
    playbackControl: {
      type: String,
      default: '0'
    }
  },
  data() {
    return {
      playIcon: playIcon$4,
      pauseIcon: pauseIcon$3,
      audioIcon: audioIcon$2,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      isShowPlay: false
    };
  },
  watch: {
    url: {
      handler() {
        this.isPlay = false;
      }
    }
  },
  methods: {
    changeDuration() {
      this.$nextTick(() => {
        this.playDuration = this.timeFormat(this.$refs.musicAudio.duration);
        this.totalDuration = this.$refs.musicAudio.duration;
      });
    },
    //将单位为秒的的时间转换成mm:ss的形式
    timeFormat(num) {
      let minute = parseInt(num / 60);
      let second = parseInt(num % 60);
      minute = minute >= 10 ? minute : "0" + minute;
      second = second >= 10 ? second : "0" + second;
      return minute + ":" + second;
    },
    play() {
      // console.log()
      let audio = document.querySelectorAll('audio');
      audio.forEach(i => i.pause());
      let video = document.querySelectorAll('video');
      if (video && video.length) {
        video.forEach(i => i.pause());
      }
      this.isPlay ? this.$refs.musicAudio.pause() : this.$refs.musicAudio.play();
      this.isPlay = !this.isPlay;
      this.$emit('play');
    },
    updateTime() {
      this.playTime = this.$refs.musicAudio.currentTime;
      this.playCurrentTime = this.timeFormat(this.$refs.musicAudio.currentTime);
      if (this.playTime >= this.totalDuration) {
        this.isPlay = false;
      }
    },
    changeTime(val) {
      this.$refs.musicAudio.currentTime = val;
    }
  }
};

/* script */
const __vue_script__$5W = script$5W;
/* template */
var __vue_render__$5W = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticStyle: { width: "100%" } }, [
    !_vm.mobile && !_vm.isLineFile
      ? _c("div", { staticClass: "audio", attrs: { flex: "" } }, [
          _c("div", { staticClass: "audio-icon" }, [
            _c("img", { attrs: { src: _vm.audioIcon, alt: "" } }),
          ]),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "audio-controls",
              attrs: { flex: "dir:top main:justify" },
            },
            [
              _c(
                "div",
                {
                  staticClass: "audio-controls--handler",
                  attrs: { flex: "main:justify cross:center" },
                },
                [
                  _c("div", { staticClass: "current-time" }, [
                    _vm._v(_vm._s(_vm.playCurrentTime)),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "play" }, [
                    _c("img", {
                      staticClass: "play-handler",
                      attrs: { src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon },
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.play.apply(null, arguments)
                        },
                      },
                    }),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "total-time" }, [
                    _vm._v(_vm._s(_vm.playDuration)),
                  ]),
                ]
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "audio-controls--progress" },
                [
                  _c("el-slider", {
                    attrs: {
                      disabled: _vm.playbackControl === "1",
                      max: _vm.totalDuration,
                      "show-tooltip": false,
                    },
                    on: { change: _vm.changeTime },
                    model: {
                      value: _vm.playTime,
                      callback: function ($$v) {
                        _vm.playTime = $$v;
                      },
                      expression: "playTime",
                    },
                  }),
                ],
                1
              ),
            ]
          ),
        ])
      : _c(
          "div",
          [
            _c("img", {
              staticClass: "play-handler mobile",
              attrs: { src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon },
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  _vm.isShowPlay = true;
                },
              },
            }),
            _vm._v(" "),
            _c(
              "el-dialog",
              {
                attrs: {
                  width: "100%",
                  top: "60px",
                  "custom-class": "video-play--dialog",
                  "destroy-on-close": "",
                  "append-to-body": "",
                  visible: _vm.isShowPlay,
                },
                on: {
                  "update:visible": function ($event) {
                    _vm.isShowPlay = $event;
                  },
                },
              },
              [
                _c("div", { staticClass: "audio", attrs: { flex: "" } }, [
                  _c("div", { staticClass: "audio-icon" }, [
                    _c("img", { attrs: { src: _vm.audioIcon, alt: "" } }),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    {
                      staticClass: "audio-controls",
                      attrs: { flex: "dir:top main:justify" },
                    },
                    [
                      _c(
                        "div",
                        {
                          staticClass: "audio-controls--handler",
                          attrs: { flex: "main:justify cross:center" },
                        },
                        [
                          _c("div", { staticClass: "current-time" }, [
                            _vm._v(_vm._s(_vm.playCurrentTime)),
                          ]),
                          _vm._v(" "),
                          _c("div", { staticClass: "play" }, [
                            _c("img", {
                              staticClass: "play-handler",
                              attrs: {
                                src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon,
                              },
                              on: {
                                click: function ($event) {
                                  $event.stopPropagation();
                                  return _vm.play.apply(null, arguments)
                                },
                              },
                            }),
                          ]),
                          _vm._v(" "),
                          _c("div", { staticClass: "total-time" }, [
                            _vm._v(_vm._s(_vm.playDuration)),
                          ]),
                        ]
                      ),
                      _vm._v(" "),
                      _c(
                        "div",
                        { staticClass: "audio-controls--progress" },
                        [
                          _c("el-slider", {
                            attrs: {
                              disabled: _vm.playbackControl === "1",
                              max: _vm.totalDuration,
                              "show-tooltip": false,
                            },
                            on: { change: _vm.changeTime },
                            model: {
                              value: _vm.playTime,
                              callback: function ($$v) {
                                _vm.playTime = $$v;
                              },
                              expression: "playTime",
                            },
                          }),
                        ],
                        1
                      ),
                    ]
                  ),
                ]),
              ]
            ),
          ],
          1
        ),
    _vm._v(" "),
    _c("audio", {
      ref: "musicAudio",
      staticClass: "audio-component",
      attrs: { controls: "", preload: "auto", src: _vm.url },
      on: {
        canplay: _vm.changeDuration,
        timeupdate: _vm.updateTime,
        pause: function ($event) {
          _vm.isPlay = false;
        },
      },
    }),
  ])
};
var __vue_staticRenderFns__$5W = [];
__vue_render__$5W._withStripped = true;

  /* style */
  const __vue_inject_styles__$5W = undefined;
  /* scoped */
  const __vue_scope_id__$5W = "data-v-7be84416";
  /* module identifier */
  const __vue_module_identifier__$5W = undefined;
  /* functional template */
  const __vue_is_functional_template__$5W = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5W = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5W, staticRenderFns: __vue_staticRenderFns__$5W },
    __vue_inject_styles__$5W,
    __vue_script__$5W,
    __vue_scope_id__$5W,
    __vue_is_functional_template__$5W,
    __vue_module_identifier__$5W,
    false,
    undefined,
    undefined,
    undefined
  );

var videoIcon$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAaRJREFUSEu91surTXEUwPHP8iiSyAQTpRRTUkqu3CHFkETdy8BcKFNGir/AwKM8YuRRjOTGnfEHGJgwwUQMjDyWftr7dhxn733O0blruNfju9dvPX6/0CKZuQYHcQBbsL4y/4S3eILHEfG1KUwMUmTmOpzHKRRIm5TgV3EpIj73G/4DyMy9uIcNHYH71R9xJCJe9Cr+AmTmMdzE0hGD1+Y/MRMRt+sPC4DM3IPnWDZm8NrtB6YjYr58+APIzLV401PE/2QoTbAtIr7UgMs42xC1pP0AO7B5BPKViDgXmbkaH7CqwXk+IqYys+gv4nSdeQfsGzYWwCyutxjPRcR0rc/M3VUjlLnokhMFcAdHhwVUNVuJCziDJS2+dwvgFXaOAujJZleVzdYG/9cF8A6bxgFU2azAM5Sj65f3iwKY+BFNvMgzuDFsDUZs09nJD1rVCV2r4iG2j7UqFmXZVZApzHVMZtdqKPpf2BcRLxfWdc9kHsc1LB8m0gCb7zgZEbdq3aArs2Ryf8wr83D9542A6rgmd+n3pl09Ww5hf8Oz5SketT1bfgPyir14bBOMeQAAAABJRU5ErkJggg==";

var win;
if (typeof window !== "undefined") {
  win = window;
} else if (typeof commonjsGlobal !== "undefined") {
  win = commonjsGlobal;
} else if (typeof self !== "undefined") {
  win = self;
} else {
  win = {};
}
var window_1 = win;

var slice$2 = Array.prototype.slice;
var domWalk = iterativelyWalk;
function iterativelyWalk(nodes, cb) {
  if (!('length' in nodes)) {
    nodes = [nodes];
  }
  nodes = slice$2.call(nodes);
  while (nodes.length) {
    var node = nodes.shift(),
      ret = cb(node);
    if (ret) {
      return ret;
    }
    if (node.childNodes && node.childNodes.length) {
      nodes = slice$2.call(node.childNodes).concat(nodes);
    }
  }
}

var domComment = Comment;
function Comment(data, owner) {
  if (!(this instanceof Comment)) {
    return new Comment(data, owner);
  }
  this.data = data;
  this.nodeValue = data;
  this.length = data.length;
  this.ownerDocument = owner || null;
}
Comment.prototype.nodeType = 8;
Comment.prototype.nodeName = "#comment";
Comment.prototype.toString = function _Comment_toString() {
  return "[object Comment]";
};

var domText = DOMText;
function DOMText(value, owner) {
  if (!(this instanceof DOMText)) {
    return new DOMText(value);
  }
  this.data = value || "";
  this.length = this.data.length;
  this.ownerDocument = owner || null;
}
DOMText.prototype.type = "DOMTextNode";
DOMText.prototype.nodeType = 3;
DOMText.prototype.nodeName = "#text";
DOMText.prototype.toString = function _Text_toString() {
  return this.data;
};
DOMText.prototype.replaceData = function replaceData(index, length, value) {
  var current = this.data;
  var left = current.substring(0, index);
  var right = current.substring(index + length, current.length);
  this.data = left + value + right;
  this.length = this.data.length;
};

var dispatchEvent_1 = dispatchEvent;
function dispatchEvent(ev) {
  var elem = this;
  var type = ev.type;
  if (!ev.target) {
    ev.target = elem;
  }
  if (!elem.listeners) {
    elem.listeners = {};
  }
  var listeners = elem.listeners[type];
  if (listeners) {
    return listeners.forEach(function (listener) {
      ev.currentTarget = elem;
      if (typeof listener === 'function') {
        listener(ev);
      } else {
        listener.handleEvent(ev);
      }
    });
  }
  if (elem.parentNode) {
    elem.parentNode.dispatchEvent(ev);
  }
}

var addEventListener_1 = addEventListener$1;
function addEventListener$1(type, listener) {
  var elem = this;
  if (!elem.listeners) {
    elem.listeners = {};
  }
  if (!elem.listeners[type]) {
    elem.listeners[type] = [];
  }
  if (elem.listeners[type].indexOf(listener) === -1) {
    elem.listeners[type].push(listener);
  }
}

var removeEventListener_1 = removeEventListener$1;
function removeEventListener$1(type, listener) {
  var elem = this;
  if (!elem.listeners) {
    return;
  }
  if (!elem.listeners[type]) {
    return;
  }
  var list = elem.listeners[type];
  var index = list.indexOf(listener);
  if (index !== -1) {
    list.splice(index, 1);
  }
}

var serialize = serializeNode;
var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "menuitem", "meta", "param", "source", "track", "wbr"];
function serializeNode(node) {
  switch (node.nodeType) {
    case 3:
      return escapeText(node.data);
    case 8:
      return "<!--" + node.data + "-->";
    default:
      return serializeElement(node);
  }
}
function serializeElement(elem) {
  var strings = [];
  var tagname = elem.tagName;
  if (elem.namespaceURI === "http://www.w3.org/1999/xhtml") {
    tagname = tagname.toLowerCase();
  }
  strings.push("<" + tagname + properties(elem) + datasetify(elem));
  if (voidElements.indexOf(tagname) > -1) {
    strings.push(" />");
  } else {
    strings.push(">");
    if (elem.childNodes.length) {
      strings.push.apply(strings, elem.childNodes.map(serializeNode));
    } else if (elem.textContent || elem.innerText) {
      strings.push(escapeText(elem.textContent || elem.innerText));
    } else if (elem.innerHTML) {
      strings.push(elem.innerHTML);
    }
    strings.push("</" + tagname + ">");
  }
  return strings.join("");
}
function isProperty(elem, key) {
  var type = typeof elem[key];
  if (key === "style" && Object.keys(elem.style).length > 0) {
    return true;
  }
  return elem.hasOwnProperty(key) && (type === "string" || type === "boolean" || type === "number") && key !== "nodeName" && key !== "className" && key !== "tagName" && key !== "textContent" && key !== "innerText" && key !== "namespaceURI" && key !== "innerHTML";
}
function stylify(styles) {
  if (typeof styles === 'string') return styles;
  var attr = "";
  Object.keys(styles).forEach(function (key) {
    var value = styles[key];
    key = key.replace(/[A-Z]/g, function (c) {
      return "-" + c.toLowerCase();
    });
    attr += key + ":" + value + ";";
  });
  return attr;
}
function datasetify(elem) {
  var ds = elem.dataset;
  var props = [];
  for (var key in ds) {
    props.push({
      name: "data-" + key,
      value: ds[key]
    });
  }
  return props.length ? stringify$1(props) : "";
}
function stringify$1(list) {
  var attributes = [];
  list.forEach(function (tuple) {
    var name = tuple.name;
    var value = tuple.value;
    if (name === "style") {
      value = stylify(value);
    }
    attributes.push(name + "=" + "\"" + escapeAttributeValue(value) + "\"");
  });
  return attributes.length ? " " + attributes.join(" ") : "";
}
function properties(elem) {
  var props = [];
  for (var key in elem) {
    if (isProperty(elem, key)) {
      props.push({
        name: key,
        value: elem[key]
      });
    }
  }
  for (var ns in elem._attributes) {
    for (var attribute in elem._attributes[ns]) {
      var prop = elem._attributes[ns][attribute];
      var name = (prop.prefix ? prop.prefix + ":" : "") + attribute;
      props.push({
        name: name,
        value: prop.value
      });
    }
  }
  if (elem.className) {
    props.push({
      name: "class",
      value: elem.className
    });
  }
  return props.length ? stringify$1(props) : "";
}
function escapeText(s) {
  var str = '';
  if (typeof s === 'string') {
    str = s;
  } else if (s) {
    str = s.toString();
  }
  return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
function escapeAttributeValue(str) {
  return escapeText(str).replace(/"/g, "&quot;");
}

var htmlns = "http://www.w3.org/1999/xhtml";
var domElement = DOMElement;
function DOMElement(tagName, owner, namespace) {
  if (!(this instanceof DOMElement)) {
    return new DOMElement(tagName);
  }
  var ns = namespace === undefined ? htmlns : namespace || null;
  this.tagName = ns === htmlns ? String(tagName).toUpperCase() : tagName;
  this.nodeName = this.tagName;
  this.className = "";
  this.dataset = {};
  this.childNodes = [];
  this.parentNode = null;
  this.style = {};
  this.ownerDocument = owner || null;
  this.namespaceURI = ns;
  this._attributes = {};
  if (this.tagName === 'INPUT') {
    this.type = 'text';
  }
}
DOMElement.prototype.type = "DOMElement";
DOMElement.prototype.nodeType = 1;
DOMElement.prototype.appendChild = function _Element_appendChild(child) {
  if (child.parentNode) {
    child.parentNode.removeChild(child);
  }
  this.childNodes.push(child);
  child.parentNode = this;
  return child;
};
DOMElement.prototype.replaceChild = function _Element_replaceChild(elem, needle) {
  // TODO: Throw NotFoundError if needle.parentNode !== this

  if (elem.parentNode) {
    elem.parentNode.removeChild(elem);
  }
  var index = this.childNodes.indexOf(needle);
  needle.parentNode = null;
  this.childNodes[index] = elem;
  elem.parentNode = this;
  return needle;
};
DOMElement.prototype.removeChild = function _Element_removeChild(elem) {
  // TODO: Throw NotFoundError if elem.parentNode !== this

  var index = this.childNodes.indexOf(elem);
  this.childNodes.splice(index, 1);
  elem.parentNode = null;
  return elem;
};
DOMElement.prototype.insertBefore = function _Element_insertBefore(elem, needle) {
  // TODO: Throw NotFoundError if referenceElement is a dom node
  // and parentNode !== this

  if (elem.parentNode) {
    elem.parentNode.removeChild(elem);
  }
  var index = needle === null || needle === undefined ? -1 : this.childNodes.indexOf(needle);
  if (index > -1) {
    this.childNodes.splice(index, 0, elem);
  } else {
    this.childNodes.push(elem);
  }
  elem.parentNode = this;
  return elem;
};
DOMElement.prototype.setAttributeNS = function _Element_setAttributeNS(namespace, name, value) {
  var prefix = null;
  var localName = name;
  var colonPosition = name.indexOf(":");
  if (colonPosition > -1) {
    prefix = name.substr(0, colonPosition);
    localName = name.substr(colonPosition + 1);
  }
  if (this.tagName === 'INPUT' && name === 'type') {
    this.type = value;
  } else {
    var attributes = this._attributes[namespace] || (this._attributes[namespace] = {});
    attributes[localName] = {
      value: value,
      prefix: prefix
    };
  }
};
DOMElement.prototype.getAttributeNS = function _Element_getAttributeNS(namespace, name) {
  var attributes = this._attributes[namespace];
  var value = attributes && attributes[name] && attributes[name].value;
  if (this.tagName === 'INPUT' && name === 'type') {
    return this.type;
  }
  if (typeof value !== "string") {
    return null;
  }
  return value;
};
DOMElement.prototype.removeAttributeNS = function _Element_removeAttributeNS(namespace, name) {
  var attributes = this._attributes[namespace];
  if (attributes) {
    delete attributes[name];
  }
};
DOMElement.prototype.hasAttributeNS = function _Element_hasAttributeNS(namespace, name) {
  var attributes = this._attributes[namespace];
  return !!attributes && name in attributes;
};
DOMElement.prototype.setAttribute = function _Element_setAttribute(name, value) {
  return this.setAttributeNS(null, name, value);
};
DOMElement.prototype.getAttribute = function _Element_getAttribute(name) {
  return this.getAttributeNS(null, name);
};
DOMElement.prototype.removeAttribute = function _Element_removeAttribute(name) {
  return this.removeAttributeNS(null, name);
};
DOMElement.prototype.hasAttribute = function _Element_hasAttribute(name) {
  return this.hasAttributeNS(null, name);
};
DOMElement.prototype.removeEventListener = removeEventListener_1;
DOMElement.prototype.addEventListener = addEventListener_1;
DOMElement.prototype.dispatchEvent = dispatchEvent_1;

// Un-implemented
DOMElement.prototype.focus = function _Element_focus() {
  return void 0;
};
DOMElement.prototype.toString = function _Element_toString() {
  return serialize(this);
};
DOMElement.prototype.getElementsByClassName = function _Element_getElementsByClassName(classNames) {
  var classes = classNames.split(" ");
  var elems = [];
  domWalk(this, function (node) {
    if (node.nodeType === 1) {
      var nodeClassName = node.className || "";
      var nodeClasses = nodeClassName.split(" ");
      if (classes.every(function (item) {
        return nodeClasses.indexOf(item) !== -1;
      })) {
        elems.push(node);
      }
    }
  });
  return elems;
};
DOMElement.prototype.getElementsByTagName = function _Element_getElementsByTagName(tagName) {
  tagName = tagName.toLowerCase();
  var elems = [];
  domWalk(this.childNodes, function (node) {
    if (node.nodeType === 1 && (tagName === '*' || node.tagName.toLowerCase() === tagName)) {
      elems.push(node);
    }
  });
  return elems;
};
DOMElement.prototype.contains = function _Element_contains(element) {
  return domWalk(this, function (node) {
    return element === node;
  }) || false;
};

var domFragment = DocumentFragment;
function DocumentFragment(owner) {
  if (!(this instanceof DocumentFragment)) {
    return new DocumentFragment();
  }
  this.childNodes = [];
  this.parentNode = null;
  this.ownerDocument = owner || null;
}
DocumentFragment.prototype.type = "DocumentFragment";
DocumentFragment.prototype.nodeType = 11;
DocumentFragment.prototype.nodeName = "#document-fragment";
DocumentFragment.prototype.appendChild = domElement.prototype.appendChild;
DocumentFragment.prototype.replaceChild = domElement.prototype.replaceChild;
DocumentFragment.prototype.removeChild = domElement.prototype.removeChild;
DocumentFragment.prototype.toString = function _DocumentFragment_toString() {
  return this.childNodes.map(function (node) {
    return String(node);
  }).join("");
};

var event$2 = Event$1;
function Event$1(family) {}
Event$1.prototype.initEvent = function _Event_initEvent(type, bubbles, cancelable) {
  this.type = type;
  this.bubbles = bubbles;
  this.cancelable = cancelable;
};
Event$1.prototype.preventDefault = function _Event_preventDefault() {};

var document$2 = Document;
function Document() {
  if (!(this instanceof Document)) {
    return new Document();
  }
  this.head = this.createElement("head");
  this.body = this.createElement("body");
  this.documentElement = this.createElement("html");
  this.documentElement.appendChild(this.head);
  this.documentElement.appendChild(this.body);
  this.childNodes = [this.documentElement];
  this.nodeType = 9;
}
var proto$1 = Document.prototype;
proto$1.createTextNode = function createTextNode(value) {
  return new domText(value, this);
};
proto$1.createElementNS = function createElementNS(namespace, tagName) {
  var ns = namespace === null ? null : String(namespace);
  return new domElement(tagName, this, ns);
};
proto$1.createElement = function createElement(tagName) {
  return new domElement(tagName, this);
};
proto$1.createDocumentFragment = function createDocumentFragment() {
  return new domFragment(this);
};
proto$1.createEvent = function createEvent(family) {
  return new event$2();
};
proto$1.createComment = function createComment(data) {
  return new domComment(data, this);
};
proto$1.getElementById = function getElementById(id) {
  id = String(id);
  var result = domWalk(this.childNodes, function (node) {
    if (String(node.id) === id) {
      return node;
    }
  });
  return result || null;
};
proto$1.getElementsByClassName = domElement.prototype.getElementsByClassName;
proto$1.getElementsByTagName = domElement.prototype.getElementsByTagName;
proto$1.contains = domElement.prototype.contains;
proto$1.removeEventListener = removeEventListener_1;
proto$1.addEventListener = addEventListener_1;
proto$1.dispatchEvent = dispatchEvent_1;

var minDocument = new document$2();

var topLevel = typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : {};

var doccy;
if (typeof document !== 'undefined') {
  doccy = document;
} else {
  doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
  if (!doccy) {
    doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDocument;
  }
}
var document_1 = doccy;

function clean(s) {
  return s.replace(/\n\r?\s*/g, '');
}
var tsml$1 = function tsml(sa) {
  var s = '',
    i = 0;
  for (; i < arguments.length; i++) s += clean(sa[i]) + (arguments[i + 1] || '');
  return s;
};

var tuple = SafeParseTuple;
function SafeParseTuple(obj, reviver) {
  var json;
  var error = null;
  try {
    json = JSON.parse(obj, reviver);
  } catch (err) {
    error = err;
  }
  return [error, json];
}

var isFunction_1 = isFunction$1;
var toString$1 = Object.prototype.toString;
function isFunction$1(fn) {
  if (!fn) {
    return false;
  }
  var string = toString$1.call(fn);
  return string === '[object Function]' || typeof fn === 'function' && string !== '[object RegExp]' || typeof window !== 'undefined' && (
  // IE8 and below
  fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt);
}

var trim$2 = function (string) {
    return string.replace(/^\s+|\s+$/g, '');
  },
  isArray$2 = function (arg) {
    return Object.prototype.toString.call(arg) === '[object Array]';
  };
var parseHeaders = function (headers) {
  if (!headers) return {};
  var result = Object.create(null);
  var headersArr = trim$2(headers).split('\n');
  for (var i = 0; i < headersArr.length; i++) {
    var row = headersArr[i];
    var index = row.indexOf(':'),
      key = trim$2(row.slice(0, index)).toLowerCase(),
      value = trim$2(row.slice(index + 1));
    if (typeof result[key] === 'undefined') {
      result[key] = value;
    } else if (isArray$2(result[key])) {
      result[key].push(value);
    } else {
      result[key] = [result[key], value];
    }
  }
  return result;
};

var immutable = extend$2;
var hasOwnProperty = Object.prototype.hasOwnProperty;
function extend$2() {
  var target = {};
  for (var i = 0; i < arguments.length; i++) {
    var source = arguments[i];
    for (var key in source) {
      if (hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }
  return target;
}

var xhr$1 = createXHR;
createXHR.XMLHttpRequest = window_1.XMLHttpRequest || noop$1;
createXHR.XDomainRequest = "withCredentials" in new createXHR.XMLHttpRequest() ? createXHR.XMLHttpRequest : window_1.XDomainRequest;
forEachArray(["get", "put", "post", "patch", "head", "delete"], function (method) {
  createXHR[method === "delete" ? "del" : method] = function (uri, options, callback) {
    options = initParams(uri, options, callback);
    options.method = method.toUpperCase();
    return _createXHR(options);
  };
});
function forEachArray(array, iterator) {
  for (var i = 0; i < array.length; i++) {
    iterator(array[i]);
  }
}
function isEmpty(obj) {
  for (var i in obj) {
    if (obj.hasOwnProperty(i)) return false;
  }
  return true;
}
function initParams(uri, options, callback) {
  var params = uri;
  if (isFunction_1(options)) {
    callback = options;
    if (typeof uri === "string") {
      params = {
        uri: uri
      };
    }
  } else {
    params = immutable(options, {
      uri: uri
    });
  }
  params.callback = callback;
  return params;
}
function createXHR(uri, options, callback) {
  options = initParams(uri, options, callback);
  return _createXHR(options);
}
function _createXHR(options) {
  if (typeof options.callback === "undefined") {
    throw new Error("callback argument missing");
  }
  var called = false;
  var callback = function cbOnce(err, response, body) {
    if (!called) {
      called = true;
      options.callback(err, response, body);
    }
  };
  function readystatechange() {
    if (xhr.readyState === 4) {
      setTimeout(loadFunc, 0);
    }
  }
  function getBody() {
    // Chrome with requestType=blob throws errors arround when even testing access to responseText
    var body = undefined;
    if (xhr.response) {
      body = xhr.response;
    } else {
      body = xhr.responseText || getXml(xhr);
    }
    if (isJson) {
      try {
        body = JSON.parse(body);
      } catch (e) {}
    }
    return body;
  }
  function errorFunc(evt) {
    clearTimeout(timeoutTimer);
    if (!(evt instanceof Error)) {
      evt = new Error("" + (evt || "Unknown XMLHttpRequest Error"));
    }
    evt.statusCode = 0;
    return callback(evt, failureResponse);
  }

  // will load the data & process the response in a special response object
  function loadFunc() {
    if (aborted) return;
    var status;
    clearTimeout(timeoutTimer);
    if (options.useXDR && xhr.status === undefined) {
      //IE8 CORS GET successful response doesn't have a status field, but body is fine
      status = 200;
    } else {
      status = xhr.status === 1223 ? 204 : xhr.status;
    }
    var response = failureResponse;
    var err = null;
    if (status !== 0) {
      response = {
        body: getBody(),
        statusCode: status,
        method: method,
        headers: {},
        url: uri,
        rawRequest: xhr
      };
      if (xhr.getAllResponseHeaders) {
        //remember xhr can in fact be XDR for CORS in IE
        response.headers = parseHeaders(xhr.getAllResponseHeaders());
      }
    } else {
      err = new Error("Internal XMLHttpRequest Error");
    }
    return callback(err, response, response.body);
  }
  var xhr = options.xhr || null;
  if (!xhr) {
    if (options.cors || options.useXDR) {
      xhr = new createXHR.XDomainRequest();
    } else {
      xhr = new createXHR.XMLHttpRequest();
    }
  }
  var key;
  var aborted;
  var uri = xhr.url = options.uri || options.url;
  var method = xhr.method = options.method || "GET";
  var body = options.body || options.data;
  var headers = xhr.headers = options.headers || {};
  var sync = !!options.sync;
  var isJson = false;
  var timeoutTimer;
  var failureResponse = {
    body: undefined,
    headers: {},
    statusCode: 0,
    method: method,
    url: uri,
    rawRequest: xhr
  };
  if ("json" in options && options.json !== false) {
    isJson = true;
    headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json"); //Don't override existing accept header declared by user
    if (method !== "GET" && method !== "HEAD") {
      headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json"); //Don't override existing accept header declared by user
      body = JSON.stringify(options.json === true ? body : options.json);
    }
  }
  xhr.onreadystatechange = readystatechange;
  xhr.onload = loadFunc;
  xhr.onerror = errorFunc;
  // IE9 must have onprogress be set to a unique function.
  xhr.onprogress = function () {
    // IE must die
  };
  xhr.onabort = function () {
    aborted = true;
  };
  xhr.ontimeout = errorFunc;
  xhr.open(method, uri, !sync, options.username, options.password);
  //has to be after open
  if (!sync) {
    xhr.withCredentials = !!options.withCredentials;
  }
  // Cannot set timeout with sync request
  // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly
  // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent
  if (!sync && options.timeout > 0) {
    timeoutTimer = setTimeout(function () {
      if (aborted) return;
      aborted = true; //IE9 may still call readystatechange
      xhr.abort("timeout");
      var e = new Error("XMLHttpRequest timeout");
      e.code = "ETIMEDOUT";
      errorFunc(e);
    }, options.timeout);
  }
  if (xhr.setRequestHeader) {
    for (key in headers) {
      if (headers.hasOwnProperty(key)) {
        xhr.setRequestHeader(key, headers[key]);
      }
    }
  } else if (options.headers && !isEmpty(options.headers)) {
    throw new Error("Headers cannot be set on an XDomainRequest object");
  }
  if ("responseType" in options) {
    xhr.responseType = options.responseType;
  }
  if ("beforeSend" in options && typeof options.beforeSend === "function") {
    options.beforeSend(xhr);
  }

  // Microsoft Edge browser sends "undefined" when send is called with undefined value.
  // XMLHttpRequest spec says to pass null as body to indicate no body
  // See https://github.com/naugtur/xhr/issues/100.
  xhr.send(body || null);
  return xhr;
}
function getXml(xhr) {
  if (xhr.responseType === "document") {
    return xhr.responseXML;
  }
  var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror";
  if (xhr.responseType === "" && !firefoxBugTakenEffect) {
    return xhr.responseXML;
  }
  return null;
}
function noop$1() {}

/**
 * Copyright 2013 vtt.js Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
var _objCreate = Object.create || function () {
  function F() {}
  return function (o) {
    if (arguments.length !== 1) {
      throw new Error('Object.create shim only accepts one parameter.');
    }
    F.prototype = o;
    return new F();
  };
}();

// Creates a new ParserError object from an errorData object. The errorData
// object should have default code and message properties. The default message
// property can be overriden by passing in a message parameter.
// See ParsingError.Errors below for acceptable errors.
function ParsingError(errorData, message) {
  this.name = "ParsingError";
  this.code = errorData.code;
  this.message = message || errorData.message;
}
ParsingError.prototype = _objCreate(Error.prototype);
ParsingError.prototype.constructor = ParsingError;

// ParsingError metadata for acceptable ParsingErrors.
ParsingError.Errors = {
  BadSignature: {
    code: 0,
    message: "Malformed WebVTT signature."
  },
  BadTimeStamp: {
    code: 1,
    message: "Malformed time stamp."
  }
};

// Try to parse input as a time stamp.
function parseTimeStamp(input) {
  function computeSeconds(h, m, s, f) {
    return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;
  }
  var m = input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);
  if (!m) {
    return null;
  }
  if (m[3]) {
    // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]
    return computeSeconds(m[1], m[2], m[3].replace(":", ""), m[4]);
  } else if (m[1] > 59) {
    // Timestamp takes the form of [hours]:[minutes].[milliseconds]
    // First position is hours as it's over 59.
    return computeSeconds(m[1], m[2], 0, m[4]);
  } else {
    // Timestamp takes the form of [minutes]:[seconds].[milliseconds]
    return computeSeconds(0, m[1], m[2], m[4]);
  }
}

// A settings object holds key/value pairs and will ignore anything but the first
// assignment to a specific key.
function Settings() {
  this.values = _objCreate(null);
}
Settings.prototype = {
  // Only accept the first assignment to any key.
  set: function (k, v) {
    if (!this.get(k) && v !== "") {
      this.values[k] = v;
    }
  },
  // Return the value for a key, or a default value.
  // If 'defaultKey' is passed then 'dflt' is assumed to be an object with
  // a number of possible default values as properties where 'defaultKey' is
  // the key of the property that will be chosen; otherwise it's assumed to be
  // a single value.
  get: function (k, dflt, defaultKey) {
    if (defaultKey) {
      return this.has(k) ? this.values[k] : dflt[defaultKey];
    }
    return this.has(k) ? this.values[k] : dflt;
  },
  // Check whether we have a value for a key.
  has: function (k) {
    return k in this.values;
  },
  // Accept a setting if its one of the given alternatives.
  alt: function (k, v, a) {
    for (var n = 0; n < a.length; ++n) {
      if (v === a[n]) {
        this.set(k, v);
        break;
      }
    }
  },
  // Accept a setting if its a valid (signed) integer.
  integer: function (k, v) {
    if (/^-?\d+$/.test(v)) {
      // integer
      this.set(k, parseInt(v, 10));
    }
  },
  // Accept a setting if its a valid percentage.
  percent: function (k, v) {
    if (v.match(/^([\d]{1,3})(\.[\d]*)?%$/)) {
      v = parseFloat(v);
      if (v >= 0 && v <= 100) {
        this.set(k, v);
        return true;
      }
    }
    return false;
  }
};

// Helper function to parse input into groups separated by 'groupDelim', and
// interprete each group as a key/value pair separated by 'keyValueDelim'.
function parseOptions(input, callback, keyValueDelim, groupDelim) {
  var groups = groupDelim ? input.split(groupDelim) : [input];
  for (var i in groups) {
    if (typeof groups[i] !== "string") {
      continue;
    }
    var kv = groups[i].split(keyValueDelim);
    if (kv.length !== 2) {
      continue;
    }
    var k = kv[0];
    var v = kv[1];
    callback(k, v);
  }
}
function parseCue(input, cue, regionList) {
  // Remember the original input if we need to throw an error.
  var oInput = input;
  // 4.1 WebVTT timestamp
  function consumeTimeStamp() {
    var ts = parseTimeStamp(input);
    if (ts === null) {
      throw new ParsingError(ParsingError.Errors.BadTimeStamp, "Malformed timestamp: " + oInput);
    }
    // Remove time stamp from input.
    input = input.replace(/^[^\sa-zA-Z-]+/, "");
    return ts;
  }

  // 4.4.2 WebVTT cue settings
  function consumeCueSettings(input, cue) {
    var settings = new Settings();
    parseOptions(input, function (k, v) {
      switch (k) {
        case "region":
          // Find the last region we parsed with the same region id.
          for (var i = regionList.length - 1; i >= 0; i--) {
            if (regionList[i].id === v) {
              settings.set(k, regionList[i].region);
              break;
            }
          }
          break;
        case "vertical":
          settings.alt(k, v, ["rl", "lr"]);
          break;
        case "line":
          var vals = v.split(","),
            vals0 = vals[0];
          settings.integer(k, vals0);
          settings.percent(k, vals0) ? settings.set("snapToLines", false) : null;
          settings.alt(k, vals0, ["auto"]);
          if (vals.length === 2) {
            settings.alt("lineAlign", vals[1], ["start", "middle", "end"]);
          }
          break;
        case "position":
          vals = v.split(",");
          settings.percent(k, vals[0]);
          if (vals.length === 2) {
            settings.alt("positionAlign", vals[1], ["start", "middle", "end"]);
          }
          break;
        case "size":
          settings.percent(k, v);
          break;
        case "align":
          settings.alt(k, v, ["start", "middle", "end", "left", "right"]);
          break;
      }
    }, /:/, /\s/);

    // Apply default values for any missing fields.
    cue.region = settings.get("region", null);
    cue.vertical = settings.get("vertical", "");
    cue.line = settings.get("line", "auto");
    cue.lineAlign = settings.get("lineAlign", "start");
    cue.snapToLines = settings.get("snapToLines", true);
    cue.size = settings.get("size", 100);
    cue.align = settings.get("align", "middle");
    cue.position = settings.get("position", {
      start: 0,
      left: 0,
      middle: 50,
      end: 100,
      right: 100
    }, cue.align);
    cue.positionAlign = settings.get("positionAlign", {
      start: "start",
      left: "start",
      middle: "middle",
      end: "end",
      right: "end"
    }, cue.align);
  }
  function skipWhitespace() {
    input = input.replace(/^\s+/, "");
  }

  // 4.1 WebVTT cue timings.
  skipWhitespace();
  cue.startTime = consumeTimeStamp(); // (1) collect cue start time
  skipWhitespace();
  if (input.substr(0, 3) !== "-->") {
    // (3) next characters must match "-->"
    throw new ParsingError(ParsingError.Errors.BadTimeStamp, "Malformed time stamp (time stamps must be separated by '-->'): " + oInput);
  }
  input = input.substr(3);
  skipWhitespace();
  cue.endTime = consumeTimeStamp(); // (5) collect cue end time

  // 4.1 WebVTT cue settings list.
  skipWhitespace();
  consumeCueSettings(input, cue);
}
var ESCAPE = {
  "&amp;": "&",
  "&lt;": "<",
  "&gt;": ">",
  "&lrm;": "\u200e",
  "&rlm;": "\u200f",
  "&nbsp;": "\u00a0"
};
var TAG_NAME = {
  c: "span",
  i: "i",
  b: "b",
  u: "u",
  ruby: "ruby",
  rt: "rt",
  v: "span",
  lang: "span"
};
var TAG_ANNOTATION = {
  v: "title",
  lang: "lang"
};
var NEEDS_PARENT = {
  rt: "ruby"
};

// Parse content into a document fragment.
function parseContent(window, input) {
  function nextToken() {
    // Check for end-of-string.
    if (!input) {
      return null;
    }

    // Consume 'n' characters from the input.
    function consume(result) {
      input = input.substr(result.length);
      return result;
    }
    var m = input.match(/^([^<]*)(<[^>]*>?)?/);
    // If there is some text before the next tag, return it, otherwise return
    // the tag.
    return consume(m[1] ? m[1] : m[2]);
  }

  // Unescape a string 's'.
  function unescape1(e) {
    return ESCAPE[e];
  }
  function unescape(s) {
    while (m = s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/)) {
      s = s.replace(m[0], unescape1);
    }
    return s;
  }
  function shouldAdd(current, element) {
    return !NEEDS_PARENT[element.localName] || NEEDS_PARENT[element.localName] === current.localName;
  }

  // Create an element for this tag.
  function createElement(type, annotation) {
    var tagName = TAG_NAME[type];
    if (!tagName) {
      return null;
    }
    var element = window.document.createElement(tagName);
    element.localName = tagName;
    var name = TAG_ANNOTATION[type];
    if (name && annotation) {
      element[name] = annotation.trim();
    }
    return element;
  }
  var rootDiv = window.document.createElement("div"),
    current = rootDiv,
    t,
    tagStack = [];
  while ((t = nextToken()) !== null) {
    if (t[0] === '<') {
      if (t[1] === "/") {
        // If the closing tag matches, move back up to the parent node.
        if (tagStack.length && tagStack[tagStack.length - 1] === t.substr(2).replace(">", "")) {
          tagStack.pop();
          current = current.parentNode;
        }
        // Otherwise just ignore the end tag.
        continue;
      }
      var ts = parseTimeStamp(t.substr(1, t.length - 2));
      var node;
      if (ts) {
        // Timestamps are lead nodes as well.
        node = window.document.createProcessingInstruction("timestamp", ts);
        current.appendChild(node);
        continue;
      }
      var m = t.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
      // If we can't parse the tag, skip to the next tag.
      if (!m) {
        continue;
      }
      // Try to construct an element, and ignore the tag if we couldn't.
      node = createElement(m[1], m[3]);
      if (!node) {
        continue;
      }
      // Determine if the tag should be added based on the context of where it
      // is placed in the cuetext.
      if (!shouldAdd(current, node)) {
        continue;
      }
      // Set the class list (as a list of classes, separated by space).
      if (m[2]) {
        node.className = m[2].substr(1).replace('.', ' ');
      }
      // Append the node to the current node, and enter the scope of the new
      // node.
      tagStack.push(m[1]);
      current.appendChild(node);
      current = node;
      continue;
    }

    // Text nodes are leaf nodes.
    current.appendChild(window.document.createTextNode(unescape(t)));
  }
  return rootDiv;
}

// This is a list of all the Unicode characters that have a strong
// right-to-left category. What this means is that these characters are
// written right-to-left for sure. It was generated by pulling all the strong
// right-to-left characters out of the Unicode data table. That table can
// found at: http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
var strongRTLRanges = [[0x5be, 0x5be], [0x5c0, 0x5c0], [0x5c3, 0x5c3], [0x5c6, 0x5c6], [0x5d0, 0x5ea], [0x5f0, 0x5f4], [0x608, 0x608], [0x60b, 0x60b], [0x60d, 0x60d], [0x61b, 0x61b], [0x61e, 0x64a], [0x66d, 0x66f], [0x671, 0x6d5], [0x6e5, 0x6e6], [0x6ee, 0x6ef], [0x6fa, 0x70d], [0x70f, 0x710], [0x712, 0x72f], [0x74d, 0x7a5], [0x7b1, 0x7b1], [0x7c0, 0x7ea], [0x7f4, 0x7f5], [0x7fa, 0x7fa], [0x800, 0x815], [0x81a, 0x81a], [0x824, 0x824], [0x828, 0x828], [0x830, 0x83e], [0x840, 0x858], [0x85e, 0x85e], [0x8a0, 0x8a0], [0x8a2, 0x8ac], [0x200f, 0x200f], [0xfb1d, 0xfb1d], [0xfb1f, 0xfb28], [0xfb2a, 0xfb36], [0xfb38, 0xfb3c], [0xfb3e, 0xfb3e], [0xfb40, 0xfb41], [0xfb43, 0xfb44], [0xfb46, 0xfbc1], [0xfbd3, 0xfd3d], [0xfd50, 0xfd8f], [0xfd92, 0xfdc7], [0xfdf0, 0xfdfc], [0xfe70, 0xfe74], [0xfe76, 0xfefc], [0x10800, 0x10805], [0x10808, 0x10808], [0x1080a, 0x10835], [0x10837, 0x10838], [0x1083c, 0x1083c], [0x1083f, 0x10855], [0x10857, 0x1085f], [0x10900, 0x1091b], [0x10920, 0x10939], [0x1093f, 0x1093f], [0x10980, 0x109b7], [0x109be, 0x109bf], [0x10a00, 0x10a00], [0x10a10, 0x10a13], [0x10a15, 0x10a17], [0x10a19, 0x10a33], [0x10a40, 0x10a47], [0x10a50, 0x10a58], [0x10a60, 0x10a7f], [0x10b00, 0x10b35], [0x10b40, 0x10b55], [0x10b58, 0x10b72], [0x10b78, 0x10b7f], [0x10c00, 0x10c48], [0x1ee00, 0x1ee03], [0x1ee05, 0x1ee1f], [0x1ee21, 0x1ee22], [0x1ee24, 0x1ee24], [0x1ee27, 0x1ee27], [0x1ee29, 0x1ee32], [0x1ee34, 0x1ee37], [0x1ee39, 0x1ee39], [0x1ee3b, 0x1ee3b], [0x1ee42, 0x1ee42], [0x1ee47, 0x1ee47], [0x1ee49, 0x1ee49], [0x1ee4b, 0x1ee4b], [0x1ee4d, 0x1ee4f], [0x1ee51, 0x1ee52], [0x1ee54, 0x1ee54], [0x1ee57, 0x1ee57], [0x1ee59, 0x1ee59], [0x1ee5b, 0x1ee5b], [0x1ee5d, 0x1ee5d], [0x1ee5f, 0x1ee5f], [0x1ee61, 0x1ee62], [0x1ee64, 0x1ee64], [0x1ee67, 0x1ee6a], [0x1ee6c, 0x1ee72], [0x1ee74, 0x1ee77], [0x1ee79, 0x1ee7c], [0x1ee7e, 0x1ee7e], [0x1ee80, 0x1ee89], [0x1ee8b, 0x1ee9b], [0x1eea1, 0x1eea3], [0x1eea5, 0x1eea9], [0x1eeab, 0x1eebb], [0x10fffd, 0x10fffd]];
function isStrongRTLChar(charCode) {
  for (var i = 0; i < strongRTLRanges.length; i++) {
    var currentRange = strongRTLRanges[i];
    if (charCode >= currentRange[0] && charCode <= currentRange[1]) {
      return true;
    }
  }
  return false;
}
function determineBidi(cueDiv) {
  var nodeStack = [],
    text = "",
    charCode;
  if (!cueDiv || !cueDiv.childNodes) {
    return "ltr";
  }
  function pushNodes(nodeStack, node) {
    for (var i = node.childNodes.length - 1; i >= 0; i--) {
      nodeStack.push(node.childNodes[i]);
    }
  }
  function nextTextNode(nodeStack) {
    if (!nodeStack || !nodeStack.length) {
      return null;
    }
    var node = nodeStack.pop(),
      text = node.textContent || node.innerText;
    if (text) {
      // TODO: This should match all unicode type B characters (paragraph
      // separator characters). See issue #115.
      var m = text.match(/^.*(\n|\r)/);
      if (m) {
        nodeStack.length = 0;
        return m[0];
      }
      return text;
    }
    if (node.tagName === "ruby") {
      return nextTextNode(nodeStack);
    }
    if (node.childNodes) {
      pushNodes(nodeStack, node);
      return nextTextNode(nodeStack);
    }
  }
  pushNodes(nodeStack, cueDiv);
  while (text = nextTextNode(nodeStack)) {
    for (var i = 0; i < text.length; i++) {
      charCode = text.charCodeAt(i);
      if (isStrongRTLChar(charCode)) {
        return "rtl";
      }
    }
  }
  return "ltr";
}
function computeLinePos(cue) {
  if (typeof cue.line === "number" && (cue.snapToLines || cue.line >= 0 && cue.line <= 100)) {
    return cue.line;
  }
  if (!cue.track || !cue.track.textTrackList || !cue.track.textTrackList.mediaElement) {
    return -1;
  }
  var track = cue.track,
    trackList = track.textTrackList,
    count = 0;
  for (var i = 0; i < trackList.length && trackList[i] !== track; i++) {
    if (trackList[i].mode === "showing") {
      count++;
    }
  }
  return ++count * -1;
}
function StyleBox() {}

// Apply styles to a div. If there is no div passed then it defaults to the
// div on 'this'.
StyleBox.prototype.applyStyles = function (styles, div) {
  div = div || this.div;
  for (var prop in styles) {
    if (styles.hasOwnProperty(prop)) {
      div.style[prop] = styles[prop];
    }
  }
};
StyleBox.prototype.formatStyle = function (val, unit) {
  return val === 0 ? 0 : val + unit;
};

// Constructs the computed display state of the cue (a div). Places the div
// into the overlay which should be a block level element (usually a div).
function CueStyleBox(window, cue, styleOptions) {
  var isIE8 = /MSIE\s8\.0/.test(navigator.userAgent);
  var color = "rgba(255, 255, 255, 1)";
  var backgroundColor = "rgba(0, 0, 0, 0.8)";
  if (isIE8) {
    color = "rgb(255, 255, 255)";
    backgroundColor = "rgb(0, 0, 0)";
  }
  StyleBox.call(this);
  this.cue = cue;

  // Parse our cue's text into a DOM tree rooted at 'cueDiv'. This div will
  // have inline positioning and will function as the cue background box.
  this.cueDiv = parseContent(window, cue.text);
  var styles = {
    color: color,
    backgroundColor: backgroundColor,
    position: "relative",
    left: 0,
    right: 0,
    top: 0,
    bottom: 0,
    display: "inline"
  };
  if (!isIE8) {
    styles.writingMode = cue.vertical === "" ? "horizontal-tb" : cue.vertical === "lr" ? "vertical-lr" : "vertical-rl";
    styles.unicodeBidi = "plaintext";
  }
  this.applyStyles(styles, this.cueDiv);

  // Create an absolutely positioned div that will be used to position the cue
  // div. Note, all WebVTT cue-setting alignments are equivalent to the CSS
  // mirrors of them except "middle" which is "center" in CSS.
  this.div = window.document.createElement("div");
  styles = {
    textAlign: cue.align === "middle" ? "center" : cue.align,
    font: styleOptions.font,
    whiteSpace: "pre-line",
    position: "absolute"
  };
  if (!isIE8) {
    styles.direction = determineBidi(this.cueDiv);
    styles.writingMode = cue.vertical === "" ? "horizontal-tb" : cue.vertical === "lr" ? "vertical-lr" : "vertical-rl".stylesunicodeBidi = "plaintext";
  }
  this.applyStyles(styles);
  this.div.appendChild(this.cueDiv);

  // Calculate the distance from the reference edge of the viewport to the text
  // position of the cue box. The reference edge will be resolved later when
  // the box orientation styles are applied.
  var textPos = 0;
  switch (cue.positionAlign) {
    case "start":
      textPos = cue.position;
      break;
    case "middle":
      textPos = cue.position - cue.size / 2;
      break;
    case "end":
      textPos = cue.position - cue.size;
      break;
  }

  // Horizontal box orientation; textPos is the distance from the left edge of the
  // area to the left edge of the box and cue.size is the distance extending to
  // the right from there.
  if (cue.vertical === "") {
    this.applyStyles({
      left: this.formatStyle(textPos, "%"),
      width: this.formatStyle(cue.size, "%")
    });
    // Vertical box orientation; textPos is the distance from the top edge of the
    // area to the top edge of the box and cue.size is the height extending
    // downwards from there.
  } else {
    this.applyStyles({
      top: this.formatStyle(textPos, "%"),
      height: this.formatStyle(cue.size, "%")
    });
  }
  this.move = function (box) {
    this.applyStyles({
      top: this.formatStyle(box.top, "px"),
      bottom: this.formatStyle(box.bottom, "px"),
      left: this.formatStyle(box.left, "px"),
      right: this.formatStyle(box.right, "px"),
      height: this.formatStyle(box.height, "px"),
      width: this.formatStyle(box.width, "px")
    });
  };
}
CueStyleBox.prototype = _objCreate(StyleBox.prototype);
CueStyleBox.prototype.constructor = CueStyleBox;

// Represents the co-ordinates of an Element in a way that we can easily
// compute things with such as if it overlaps or intersects with another Element.
// Can initialize it with either a StyleBox or another BoxPosition.
function BoxPosition(obj) {
  var isIE8 = /MSIE\s8\.0/.test(navigator.userAgent);

  // Either a BoxPosition was passed in and we need to copy it, or a StyleBox
  // was passed in and we need to copy the results of 'getBoundingClientRect'
  // as the object returned is readonly. All co-ordinate values are in reference
  // to the viewport origin (top left).
  var lh, height, width, top;
  if (obj.div) {
    height = obj.div.offsetHeight;
    width = obj.div.offsetWidth;
    top = obj.div.offsetTop;
    var rects = (rects = obj.div.childNodes) && (rects = rects[0]) && rects.getClientRects && rects.getClientRects();
    obj = obj.div.getBoundingClientRect();
    // In certain cases the outter div will be slightly larger then the sum of
    // the inner div's lines. This could be due to bold text, etc, on some platforms.
    // In this case we should get the average line height and use that. This will
    // result in the desired behaviour.
    lh = rects ? Math.max(rects[0] && rects[0].height || 0, obj.height / rects.length) : 0;
  }
  this.left = obj.left;
  this.right = obj.right;
  this.top = obj.top || top;
  this.height = obj.height || height;
  this.bottom = obj.bottom || top + (obj.height || height);
  this.width = obj.width || width;
  this.lineHeight = lh !== undefined ? lh : obj.lineHeight;
  if (isIE8 && !this.lineHeight) {
    this.lineHeight = 13;
  }
}

// Move the box along a particular axis. Optionally pass in an amount to move
// the box. If no amount is passed then the default is the line height of the
// box.
BoxPosition.prototype.move = function (axis, toMove) {
  toMove = toMove !== undefined ? toMove : this.lineHeight;
  switch (axis) {
    case "+x":
      this.left += toMove;
      this.right += toMove;
      break;
    case "-x":
      this.left -= toMove;
      this.right -= toMove;
      break;
    case "+y":
      this.top += toMove;
      this.bottom += toMove;
      break;
    case "-y":
      this.top -= toMove;
      this.bottom -= toMove;
      break;
  }
};

// Check if this box overlaps another box, b2.
BoxPosition.prototype.overlaps = function (b2) {
  return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top;
};

// Check if this box overlaps any other boxes in boxes.
BoxPosition.prototype.overlapsAny = function (boxes) {
  for (var i = 0; i < boxes.length; i++) {
    if (this.overlaps(boxes[i])) {
      return true;
    }
  }
  return false;
};

// Check if this box is within another box.
BoxPosition.prototype.within = function (container) {
  return this.top >= container.top && this.bottom <= container.bottom && this.left >= container.left && this.right <= container.right;
};

// Check if this box is entirely within the container or it is overlapping
// on the edge opposite of the axis direction passed. For example, if "+x" is
// passed and the box is overlapping on the left edge of the container, then
// return true.
BoxPosition.prototype.overlapsOppositeAxis = function (container, axis) {
  switch (axis) {
    case "+x":
      return this.left < container.left;
    case "-x":
      return this.right > container.right;
    case "+y":
      return this.top < container.top;
    case "-y":
      return this.bottom > container.bottom;
  }
};

// Find the percentage of the area that this box is overlapping with another
// box.
BoxPosition.prototype.intersectPercentage = function (b2) {
  var x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)),
    y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)),
    intersectArea = x * y;
  return intersectArea / (this.height * this.width);
};

// Convert the positions from this box to CSS compatible positions using
// the reference container's positions. This has to be done because this
// box's positions are in reference to the viewport origin, whereas, CSS
// values are in referecne to their respective edges.
BoxPosition.prototype.toCSSCompatValues = function (reference) {
  return {
    top: this.top - reference.top,
    bottom: reference.bottom - this.bottom,
    left: this.left - reference.left,
    right: reference.right - this.right,
    height: this.height,
    width: this.width
  };
};

// Get an object that represents the box's position without anything extra.
// Can pass a StyleBox, HTMLElement, or another BoxPositon.
BoxPosition.getSimpleBoxPosition = function (obj) {
  var height = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0;
  var width = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0;
  var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0;
  obj = obj.div ? obj.div.getBoundingClientRect() : obj.tagName ? obj.getBoundingClientRect() : obj;
  var ret = {
    left: obj.left,
    right: obj.right,
    top: obj.top || top,
    height: obj.height || height,
    bottom: obj.bottom || top + (obj.height || height),
    width: obj.width || width
  };
  return ret;
};

// Move a StyleBox to its specified, or next best, position. The containerBox
// is the box that contains the StyleBox, such as a div. boxPositions are
// a list of other boxes that the styleBox can't overlap with.
function moveBoxToLinePosition(window, styleBox, containerBox, boxPositions) {
  // Find the best position for a cue box, b, on the video. The axis parameter
  // is a list of axis, the order of which, it will move the box along. For example:
  // Passing ["+x", "-x"] will move the box first along the x axis in the positive
  // direction. If it doesn't find a good position for it there it will then move
  // it along the x axis in the negative direction.
  function findBestPosition(b, axis) {
    var bestPosition,
      specifiedPosition = new BoxPosition(b),
      percentage = 1; // Highest possible so the first thing we get is better.

    for (var i = 0; i < axis.length; i++) {
      while (b.overlapsOppositeAxis(containerBox, axis[i]) || b.within(containerBox) && b.overlapsAny(boxPositions)) {
        b.move(axis[i]);
      }
      // We found a spot where we aren't overlapping anything. This is our
      // best position.
      if (b.within(containerBox)) {
        return b;
      }
      var p = b.intersectPercentage(containerBox);
      // If we're outside the container box less then we were on our last try
      // then remember this position as the best position.
      if (percentage > p) {
        bestPosition = new BoxPosition(b);
        percentage = p;
      }
      // Reset the box position to the specified position.
      b = new BoxPosition(specifiedPosition);
    }
    return bestPosition || specifiedPosition;
  }
  var boxPosition = new BoxPosition(styleBox),
    cue = styleBox.cue,
    linePos = computeLinePos(cue),
    axis = [];

  // If we have a line number to align the cue to.
  if (cue.snapToLines) {
    var size;
    switch (cue.vertical) {
      case "":
        axis = ["+y", "-y"];
        size = "height";
        break;
      case "rl":
        axis = ["+x", "-x"];
        size = "width";
        break;
      case "lr":
        axis = ["-x", "+x"];
        size = "width";
        break;
    }
    var step = boxPosition.lineHeight,
      position = step * Math.round(linePos),
      maxPosition = containerBox[size] + step,
      initialAxis = axis[0];

    // If the specified intial position is greater then the max position then
    // clamp the box to the amount of steps it would take for the box to
    // reach the max position.
    if (Math.abs(position) > maxPosition) {
      position = position < 0 ? -1 : 1;
      position *= Math.ceil(maxPosition / step) * step;
    }

    // If computed line position returns negative then line numbers are
    // relative to the bottom of the video instead of the top. Therefore, we
    // need to increase our initial position by the length or width of the
    // video, depending on the writing direction, and reverse our axis directions.
    if (linePos < 0) {
      position += cue.vertical === "" ? containerBox.height : containerBox.width;
      axis = axis.reverse();
    }

    // Move the box to the specified position. This may not be its best
    // position.
    boxPosition.move(initialAxis, position);
  } else {
    // If we have a percentage line value for the cue.
    var calculatedPercentage = boxPosition.lineHeight / containerBox.height * 100;
    switch (cue.lineAlign) {
      case "middle":
        linePos -= calculatedPercentage / 2;
        break;
      case "end":
        linePos -= calculatedPercentage;
        break;
    }

    // Apply initial line position to the cue box.
    switch (cue.vertical) {
      case "":
        styleBox.applyStyles({
          top: styleBox.formatStyle(linePos, "%")
        });
        break;
      case "rl":
        styleBox.applyStyles({
          left: styleBox.formatStyle(linePos, "%")
        });
        break;
      case "lr":
        styleBox.applyStyles({
          right: styleBox.formatStyle(linePos, "%")
        });
        break;
    }
    axis = ["+y", "-x", "+x", "-y"];

    // Get the box position again after we've applied the specified positioning
    // to it.
    boxPosition = new BoxPosition(styleBox);
  }
  var bestPosition = findBestPosition(boxPosition, axis);
  styleBox.move(bestPosition.toCSSCompatValues(containerBox));
}
function WebVTT$1() {
  // Nothing
}

// Helper to allow strings to be decoded instead of the default binary utf8 data.
WebVTT$1.StringDecoder = function () {
  return {
    decode: function (data) {
      if (!data) {
        return "";
      }
      if (typeof data !== "string") {
        throw new Error("Error - expected string data.");
      }
      return decodeURIComponent(encodeURIComponent(data));
    }
  };
};
WebVTT$1.convertCueToDOMTree = function (window, cuetext) {
  if (!window || !cuetext) {
    return null;
  }
  return parseContent(window, cuetext);
};
var FONT_SIZE_PERCENT = 0.05;
var FONT_STYLE = "sans-serif";
var CUE_BACKGROUND_PADDING = "1.5%";

// Runs the processing model over the cues and regions passed to it.
// @param overlay A block level element (usually a div) that the computed cues
//                and regions will be placed into.
WebVTT$1.processCues = function (window, cues, overlay) {
  if (!window || !cues || !overlay) {
    return null;
  }

  // Remove all previous children.
  while (overlay.firstChild) {
    overlay.removeChild(overlay.firstChild);
  }
  var paddedOverlay = window.document.createElement("div");
  paddedOverlay.style.position = "absolute";
  paddedOverlay.style.left = "0";
  paddedOverlay.style.right = "0";
  paddedOverlay.style.top = "0";
  paddedOverlay.style.bottom = "0";
  paddedOverlay.style.margin = CUE_BACKGROUND_PADDING;
  overlay.appendChild(paddedOverlay);

  // Determine if we need to compute the display states of the cues. This could
  // be the case if a cue's state has been changed since the last computation or
  // if it has not been computed yet.
  function shouldCompute(cues) {
    for (var i = 0; i < cues.length; i++) {
      if (cues[i].hasBeenReset || !cues[i].displayState) {
        return true;
      }
    }
    return false;
  }

  // We don't need to recompute the cues' display states. Just reuse them.
  if (!shouldCompute(cues)) {
    for (var i = 0; i < cues.length; i++) {
      paddedOverlay.appendChild(cues[i].displayState);
    }
    return;
  }
  var boxPositions = [],
    containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay),
    fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;
  var styleOptions = {
    font: fontSize + "px " + FONT_STYLE
  };
  (function () {
    var styleBox, cue;
    for (var i = 0; i < cues.length; i++) {
      cue = cues[i];

      // Compute the intial position and styles of the cue div.
      styleBox = new CueStyleBox(window, cue, styleOptions);
      paddedOverlay.appendChild(styleBox.div);

      // Move the cue div to it's correct line position.
      moveBoxToLinePosition(window, styleBox, containerBox, boxPositions);

      // Remember the computed div so that we don't have to recompute it later
      // if we don't have too.
      cue.displayState = styleBox.div;
      boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));
    }
  })();
};
WebVTT$1.Parser = function (window, vttjs, decoder) {
  if (!decoder) {
    decoder = vttjs;
    vttjs = {};
  }
  if (!vttjs) {
    vttjs = {};
  }
  this.window = window;
  this.vttjs = vttjs;
  this.state = "INITIAL";
  this.buffer = "";
  this.decoder = decoder || new TextDecoder("utf8");
  this.regionList = [];
};
WebVTT$1.Parser.prototype = {
  // If the error is a ParsingError then report it to the consumer if
  // possible. If it's not a ParsingError then throw it like normal.
  reportOrThrowError: function (e) {
    if (e instanceof ParsingError) {
      this.onparsingerror && this.onparsingerror(e);
    } else {
      throw e;
    }
  },
  parse: function (data) {
    var self = this;

    // If there is no data then we won't decode it, but will just try to parse
    // whatever is in buffer already. This may occur in circumstances, for
    // example when flush() is called.
    if (data) {
      // Try to decode the data that we received.
      self.buffer += self.decoder.decode(data, {
        stream: true
      });
    }
    function collectNextLine() {
      var buffer = self.buffer;
      var pos = 0;
      while (pos < buffer.length && buffer[pos] !== '\r' && buffer[pos] !== '\n') {
        ++pos;
      }
      var line = buffer.substr(0, pos);
      // Advance the buffer early in case we fail below.
      if (buffer[pos] === '\r') {
        ++pos;
      }
      if (buffer[pos] === '\n') {
        ++pos;
      }
      self.buffer = buffer.substr(pos);
      return line;
    }

    // 3.4 WebVTT region and WebVTT region settings syntax
    function parseRegion(input) {
      var settings = new Settings();
      parseOptions(input, function (k, v) {
        switch (k) {
          case "id":
            settings.set(k, v);
            break;
          case "width":
            settings.percent(k, v);
            break;
          case "lines":
            settings.integer(k, v);
            break;
          case "regionanchor":
          case "viewportanchor":
            var xy = v.split(',');
            if (xy.length !== 2) {
              break;
            }
            // We have to make sure both x and y parse, so use a temporary
            // settings object here.
            var anchor = new Settings();
            anchor.percent("x", xy[0]);
            anchor.percent("y", xy[1]);
            if (!anchor.has("x") || !anchor.has("y")) {
              break;
            }
            settings.set(k + "X", anchor.get("x"));
            settings.set(k + "Y", anchor.get("y"));
            break;
          case "scroll":
            settings.alt(k, v, ["up"]);
            break;
        }
      }, /=/, /\s/);

      // Create the region, using default values for any values that were not
      // specified.
      if (settings.has("id")) {
        var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)();
        region.width = settings.get("width", 100);
        region.lines = settings.get("lines", 3);
        region.regionAnchorX = settings.get("regionanchorX", 0);
        region.regionAnchorY = settings.get("regionanchorY", 100);
        region.viewportAnchorX = settings.get("viewportanchorX", 0);
        region.viewportAnchorY = settings.get("viewportanchorY", 100);
        region.scroll = settings.get("scroll", "");
        // Register the region.
        self.onregion && self.onregion(region);
        // Remember the VTTRegion for later in case we parse any VTTCues that
        // reference it.
        self.regionList.push({
          id: settings.get("id"),
          region: region
        });
      }
    }

    // draft-pantos-http-live-streaming-20
    // https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5
    // 3.5 WebVTT
    function parseTimestampMap(input) {
      var settings = new Settings();
      parseOptions(input, function (k, v) {
        switch (k) {
          case "MPEGT":
            settings.integer(k + 'S', v);
            break;
          case "LOCA":
            settings.set(k + 'L', parseTimeStamp(v));
            break;
        }
      }, /[^\d]:/, /,/);
      self.ontimestampmap && self.ontimestampmap({
        "MPEGTS": settings.get("MPEGTS"),
        "LOCAL": settings.get("LOCAL")
      });
    }

    // 3.2 WebVTT metadata header syntax
    function parseHeader(input) {
      if (input.match(/X-TIMESTAMP-MAP/)) {
        // This line contains HLS X-TIMESTAMP-MAP metadata
        parseOptions(input, function (k, v) {
          switch (k) {
            case "X-TIMESTAMP-MAP":
              parseTimestampMap(v);
              break;
          }
        }, /=/);
      } else {
        parseOptions(input, function (k, v) {
          switch (k) {
            case "Region":
              // 3.3 WebVTT region metadata header syntax
              parseRegion(v);
              break;
          }
        }, /:/);
      }
    }

    // 5.1 WebVTT file parsing.
    try {
      var line;
      if (self.state === "INITIAL") {
        // We can't start parsing until we have the first line.
        if (!/\r\n|\n/.test(self.buffer)) {
          return this;
        }
        line = collectNextLine();
        var m = line.match(/^WEBVTT([ \t].*)?$/);
        if (!m || !m[0]) {
          throw new ParsingError(ParsingError.Errors.BadSignature);
        }
        self.state = "HEADER";
      }
      var alreadyCollectedLine = false;
      while (self.buffer) {
        // We can't parse a line until we have the full line.
        if (!/\r\n|\n/.test(self.buffer)) {
          return this;
        }
        if (!alreadyCollectedLine) {
          line = collectNextLine();
        } else {
          alreadyCollectedLine = false;
        }
        switch (self.state) {
          case "HEADER":
            // 13-18 - Allow a header (metadata) under the WEBVTT line.
            if (/:/.test(line)) {
              parseHeader(line);
            } else if (!line) {
              // An empty line terminates the header and starts the body (cues).
              self.state = "ID";
            }
            continue;
          case "NOTE":
            // Ignore NOTE blocks.
            if (!line) {
              self.state = "ID";
            }
            continue;
          case "ID":
            // Check for the start of NOTE blocks.
            if (/^NOTE($|[ \t])/.test(line)) {
              self.state = "NOTE";
              break;
            }
            // 19-29 - Allow any number of line terminators, then initialize new cue values.
            if (!line) {
              continue;
            }
            self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, "");
            self.state = "CUE";
            // 30-39 - Check if self line contains an optional identifier or timing data.
            if (line.indexOf("-->") === -1) {
              self.cue.id = line;
              continue;
            }
          // Process line as start of a cue.
          /*falls through*/
          case "CUE":
            // 40 - Collect cue timings and settings.
            try {
              parseCue(line, self.cue, self.regionList);
            } catch (e) {
              self.reportOrThrowError(e);
              // In case of an error ignore rest of the cue.
              self.cue = null;
              self.state = "BADCUE";
              continue;
            }
            self.state = "CUETEXT";
            continue;
          case "CUETEXT":
            var hasSubstring = line.indexOf("-->") !== -1;
            // 34 - If we have an empty line then report the cue.
            // 35 - If we have the special substring '-->' then report the cue,
            // but do not collect the line as we need to process the current
            // one as a new cue.
            if (!line || hasSubstring && (alreadyCollectedLine = true)) {
              // We are done parsing self cue.
              self.oncue && self.oncue(self.cue);
              self.cue = null;
              self.state = "ID";
              continue;
            }
            if (self.cue.text) {
              self.cue.text += "\n";
            }
            self.cue.text += line;
            continue;
          case "BADCUE":
            // BADCUE
            // 54-62 - Collect and discard the remaining cue.
            if (!line) {
              self.state = "ID";
            }
            continue;
        }
      }
    } catch (e) {
      self.reportOrThrowError(e);

      // If we are currently parsing a cue, report what we have.
      if (self.state === "CUETEXT" && self.cue && self.oncue) {
        self.oncue(self.cue);
      }
      self.cue = null;
      // Enter BADWEBVTT state if header was not parsed correctly otherwise
      // another exception occurred so enter BADCUE state.
      self.state = self.state === "INITIAL" ? "BADWEBVTT" : "BADCUE";
    }
    return this;
  },
  flush: function () {
    var self = this;
    try {
      // Finish decoding the stream.
      self.buffer += self.decoder.decode();
      // Synthesize the end of the current cue or region.
      if (self.cue || self.state === "HEADER") {
        self.buffer += "\n\n";
        self.parse();
      }
      // If we've flushed, parsed, and we're still on the INITIAL state then
      // that means we don't have enough of the stream to parse the first
      // line.
      if (self.state === "INITIAL") {
        throw new ParsingError(ParsingError.Errors.BadSignature);
      }
    } catch (e) {
      self.reportOrThrowError(e);
    }
    self.onflush && self.onflush();
    return this;
  }
};
var vtt$1 = WebVTT$1;

/**
 * Copyright 2013 vtt.js Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var autoKeyword = "auto";
var directionSetting = {
  "": true,
  "lr": true,
  "rl": true
};
var alignSetting = {
  "start": true,
  "middle": true,
  "end": true,
  "left": true,
  "right": true
};
function findDirectionSetting(value) {
  if (typeof value !== "string") {
    return false;
  }
  var dir = directionSetting[value.toLowerCase()];
  return dir ? value.toLowerCase() : false;
}
function findAlignSetting(value) {
  if (typeof value !== "string") {
    return false;
  }
  var align = alignSetting[value.toLowerCase()];
  return align ? value.toLowerCase() : false;
}
function extend$1(obj) {
  var i = 1;
  for (; i < arguments.length; i++) {
    var cobj = arguments[i];
    for (var p in cobj) {
      obj[p] = cobj[p];
    }
  }
  return obj;
}
function VTTCue(startTime, endTime, text) {
  var cue = this;
  var isIE8 = /MSIE\s8\.0/.test(navigator.userAgent);
  var baseObj = {};
  if (isIE8) {
    cue = document.createElement('custom');
  } else {
    baseObj.enumerable = true;
  }

  /**
   * Shim implementation specific properties. These properties are not in
   * the spec.
   */

  // Lets us know when the VTTCue's data has changed in such a way that we need
  // to recompute its display state. This lets us compute its display state
  // lazily.
  cue.hasBeenReset = false;

  /**
   * VTTCue and TextTrackCue properties
   * http://dev.w3.org/html5/webvtt/#vttcue-interface
   */

  var _id = "";
  var _pauseOnExit = false;
  var _startTime = startTime;
  var _endTime = endTime;
  var _text = text;
  var _region = null;
  var _vertical = "";
  var _snapToLines = true;
  var _line = "auto";
  var _lineAlign = "start";
  var _position = 50;
  var _positionAlign = "middle";
  var _size = 50;
  var _align = "middle";
  Object.defineProperty(cue, "id", extend$1({}, baseObj, {
    get: function () {
      return _id;
    },
    set: function (value) {
      _id = "" + value;
    }
  }));
  Object.defineProperty(cue, "pauseOnExit", extend$1({}, baseObj, {
    get: function () {
      return _pauseOnExit;
    },
    set: function (value) {
      _pauseOnExit = !!value;
    }
  }));
  Object.defineProperty(cue, "startTime", extend$1({}, baseObj, {
    get: function () {
      return _startTime;
    },
    set: function (value) {
      if (typeof value !== "number") {
        throw new TypeError("Start time must be set to a number.");
      }
      _startTime = value;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "endTime", extend$1({}, baseObj, {
    get: function () {
      return _endTime;
    },
    set: function (value) {
      if (typeof value !== "number") {
        throw new TypeError("End time must be set to a number.");
      }
      _endTime = value;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "text", extend$1({}, baseObj, {
    get: function () {
      return _text;
    },
    set: function (value) {
      _text = "" + value;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "region", extend$1({}, baseObj, {
    get: function () {
      return _region;
    },
    set: function (value) {
      _region = value;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "vertical", extend$1({}, baseObj, {
    get: function () {
      return _vertical;
    },
    set: function (value) {
      var setting = findDirectionSetting(value);
      // Have to check for false because the setting an be an empty string.
      if (setting === false) {
        throw new SyntaxError("An invalid or illegal string was specified.");
      }
      _vertical = setting;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "snapToLines", extend$1({}, baseObj, {
    get: function () {
      return _snapToLines;
    },
    set: function (value) {
      _snapToLines = !!value;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "line", extend$1({}, baseObj, {
    get: function () {
      return _line;
    },
    set: function (value) {
      if (typeof value !== "number" && value !== autoKeyword) {
        throw new SyntaxError("An invalid number or illegal string was specified.");
      }
      _line = value;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "lineAlign", extend$1({}, baseObj, {
    get: function () {
      return _lineAlign;
    },
    set: function (value) {
      var setting = findAlignSetting(value);
      if (!setting) {
        throw new SyntaxError("An invalid or illegal string was specified.");
      }
      _lineAlign = setting;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "position", extend$1({}, baseObj, {
    get: function () {
      return _position;
    },
    set: function (value) {
      if (value < 0 || value > 100) {
        throw new Error("Position must be between 0 and 100.");
      }
      _position = value;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "positionAlign", extend$1({}, baseObj, {
    get: function () {
      return _positionAlign;
    },
    set: function (value) {
      var setting = findAlignSetting(value);
      if (!setting) {
        throw new SyntaxError("An invalid or illegal string was specified.");
      }
      _positionAlign = setting;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "size", extend$1({}, baseObj, {
    get: function () {
      return _size;
    },
    set: function (value) {
      if (value < 0 || value > 100) {
        throw new Error("Size must be between 0 and 100.");
      }
      _size = value;
      this.hasBeenReset = true;
    }
  }));
  Object.defineProperty(cue, "align", extend$1({}, baseObj, {
    get: function () {
      return _align;
    },
    set: function (value) {
      var setting = findAlignSetting(value);
      if (!setting) {
        throw new SyntaxError("An invalid or illegal string was specified.");
      }
      _align = setting;
      this.hasBeenReset = true;
    }
  }));

  /**
   * Other <track> spec defined properties
   */

  // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state
  cue.displayState = undefined;
  if (isIE8) {
    return cue;
  }
}

/**
 * VTTCue methods
 */

VTTCue.prototype.getCueAsHTML = function () {
  // Assume WebVTT.convertCueToDOMTree is on the global.
  return WebVTT.convertCueToDOMTree(window, this.text);
};
var vttcue = VTTCue;

/**
 * Copyright 2013 vtt.js Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var scrollSetting = {
  "": true,
  "up": true
};
function findScrollSetting(value) {
  if (typeof value !== "string") {
    return false;
  }
  var scroll = scrollSetting[value.toLowerCase()];
  return scroll ? value.toLowerCase() : false;
}
function isValidPercentValue(value) {
  return typeof value === "number" && value >= 0 && value <= 100;
}

// VTTRegion shim http://dev.w3.org/html5/webvtt/#vttregion-interface
function VTTRegion() {
  var _width = 100;
  var _lines = 3;
  var _regionAnchorX = 0;
  var _regionAnchorY = 100;
  var _viewportAnchorX = 0;
  var _viewportAnchorY = 100;
  var _scroll = "";
  Object.defineProperties(this, {
    "width": {
      enumerable: true,
      get: function () {
        return _width;
      },
      set: function (value) {
        if (!isValidPercentValue(value)) {
          throw new Error("Width must be between 0 and 100.");
        }
        _width = value;
      }
    },
    "lines": {
      enumerable: true,
      get: function () {
        return _lines;
      },
      set: function (value) {
        if (typeof value !== "number") {
          throw new TypeError("Lines must be set to a number.");
        }
        _lines = value;
      }
    },
    "regionAnchorY": {
      enumerable: true,
      get: function () {
        return _regionAnchorY;
      },
      set: function (value) {
        if (!isValidPercentValue(value)) {
          throw new Error("RegionAnchorX must be between 0 and 100.");
        }
        _regionAnchorY = value;
      }
    },
    "regionAnchorX": {
      enumerable: true,
      get: function () {
        return _regionAnchorX;
      },
      set: function (value) {
        if (!isValidPercentValue(value)) {
          throw new Error("RegionAnchorY must be between 0 and 100.");
        }
        _regionAnchorX = value;
      }
    },
    "viewportAnchorY": {
      enumerable: true,
      get: function () {
        return _viewportAnchorY;
      },
      set: function (value) {
        if (!isValidPercentValue(value)) {
          throw new Error("ViewportAnchorY must be between 0 and 100.");
        }
        _viewportAnchorY = value;
      }
    },
    "viewportAnchorX": {
      enumerable: true,
      get: function () {
        return _viewportAnchorX;
      },
      set: function (value) {
        if (!isValidPercentValue(value)) {
          throw new Error("ViewportAnchorX must be between 0 and 100.");
        }
        _viewportAnchorX = value;
      }
    },
    "scroll": {
      enumerable: true,
      get: function () {
        return _scroll;
      },
      set: function (value) {
        var setting = findScrollSetting(value);
        // Have to check for false as an empty string is a legal value.
        if (setting === false) {
          throw new SyntaxError("An invalid or illegal string was specified.");
        }
        _scroll = setting;
      }
    }
  });
}
var vttregion = VTTRegion;

var browserIndex = createCommonjsModule(function (module) {
/**
 * Copyright 2013 vtt.js Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Default exports for Node. Export the extended versions of VTTCue and
// VTTRegion in Node since we likely want the capability to convert back and
// forth between JSON. If we don't then it's not that big of a deal since we're
// off browser.


var vttjs = module.exports = {
  WebVTT: vtt$1,
  VTTCue: vttcue,
  VTTRegion: vttregion
};
window_1.vttjs = vttjs;
window_1.WebVTT = vttjs.WebVTT;
var cueShim = vttjs.VTTCue;
var regionShim = vttjs.VTTRegion;
var nativeVTTCue = window_1.VTTCue;
var nativeVTTRegion = window_1.VTTRegion;
vttjs.shim = function () {
  window_1.VTTCue = cueShim;
  window_1.VTTRegion = regionShim;
};
vttjs.restore = function () {
  window_1.VTTCue = nativeVTTCue;
  window_1.VTTRegion = nativeVTTRegion;
};
if (!window_1.VTTCue) {
  vttjs.shim();
}
});
browserIndex.WebVTT;
browserIndex.VTTCue;
browserIndex.VTTRegion;

/**
 * @license
 * Video.js 6.13.0 <http://videojs.com/>
 * Copyright Brightcove, Inc. <https://www.brightcove.com/>
 * Available under Apache License Version 2.0
 * <https://github.com/videojs/video.js/blob/master/LICENSE>
 *
 * Includes vtt.js <https://github.com/mozilla/vtt.js>
 * Available under Apache License Version 2.0
 * <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
 */function _interopDefault(ex){return ex&&typeof ex==='object'&&'default'in ex?ex['default']:ex;}var window$1=_interopDefault(window_1);var document$1=_interopDefault(document_1);var tsml=_interopDefault(tsml$1);var safeParseTuple=_interopDefault(tuple);var xhr=_interopDefault(xhr$1);var vtt=_interopDefault(browserIndex);var version="6.13.0";/**
 * @file browser.js
 * @module browser
 */var USER_AGENT=window$1.navigator&&window$1.navigator.userAgent||'';var webkitVersionMap=/AppleWebKit\/([\d.]+)/i.exec(USER_AGENT);var appleWebkitVersion=webkitVersionMap?parseFloat(webkitVersionMap.pop()):null;/*
 * Device is an iPhone
 *
 * @type {Boolean}
 * @constant
 * @private
 */var IS_IPAD=/iPad/i.test(USER_AGENT);// The Facebook app's UIWebView identifies as both an iPhone and iPad, so
// to identify iPhones, we need to exclude iPads.
// http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/
var IS_IPHONE=/iPhone/i.test(USER_AGENT)&&!IS_IPAD;var IS_IPOD=/iPod/i.test(USER_AGENT);var IS_IOS=IS_IPHONE||IS_IPAD||IS_IPOD;var IOS_VERSION=function(){var match=USER_AGENT.match(/OS (\d+)_/i);if(match&&match[1]){return match[1];}return null;}();var IS_ANDROID=/Android/i.test(USER_AGENT);var ANDROID_VERSION=function(){// This matches Android Major.Minor.Patch versions
// ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned
var match=USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!match){return null;}var major=match[1]&&parseFloat(match[1]);var minor=match[2]&&parseFloat(match[2]);if(major&&minor){return parseFloat(match[1]+'.'+match[2]);}else if(major){return major;}return null;}();// Old Android is defined as Version older than 2.3, and requiring a webkit version of the android browser
var IS_OLD_ANDROID=IS_ANDROID&&/webkit/i.test(USER_AGENT)&&ANDROID_VERSION<2.3;var IS_NATIVE_ANDROID=IS_ANDROID&&ANDROID_VERSION<5&&appleWebkitVersion<537;var IS_FIREFOX=/Firefox/i.test(USER_AGENT);var IS_EDGE=/Edge/i.test(USER_AGENT);var IS_CHROME=!IS_EDGE&&(/Chrome/i.test(USER_AGENT)||/CriOS/i.test(USER_AGENT));var CHROME_VERSION=function(){var match=USER_AGENT.match(/(Chrome|CriOS)\/(\d+)/);if(match&&match[2]){return parseFloat(match[2]);}return null;}();var IS_IE8=/MSIE\s8\.0/.test(USER_AGENT);var IE_VERSION=function(){var result=/MSIE\s(\d+)\.\d/.exec(USER_AGENT);var version=result&&parseFloat(result[1]);if(!version&&/Trident\/7.0/i.test(USER_AGENT)&&/rv:11.0/.test(USER_AGENT)){// IE 11 has a different user agent string than other IE versions
version=11.0;}return version;}();var IS_SAFARI=/Safari/i.test(USER_AGENT)&&!IS_CHROME&&!IS_ANDROID&&!IS_EDGE;var IS_ANY_SAFARI=(IS_SAFARI||IS_IOS)&&!IS_CHROME;var TOUCH_ENABLED=isReal()&&('ontouchstart'in window$1||window$1.navigator.maxTouchPoints||window$1.DocumentTouch&&window$1.document instanceof window$1.DocumentTouch);var BACKGROUND_SIZE_SUPPORTED=isReal()&&'backgroundSize'in window$1.document.createElement('video').style;var browser=(Object.freeze||Object)({IS_IPAD:IS_IPAD,IS_IPHONE:IS_IPHONE,IS_IPOD:IS_IPOD,IS_IOS:IS_IOS,IOS_VERSION:IOS_VERSION,IS_ANDROID:IS_ANDROID,ANDROID_VERSION:ANDROID_VERSION,IS_OLD_ANDROID:IS_OLD_ANDROID,IS_NATIVE_ANDROID:IS_NATIVE_ANDROID,IS_FIREFOX:IS_FIREFOX,IS_EDGE:IS_EDGE,IS_CHROME:IS_CHROME,CHROME_VERSION:CHROME_VERSION,IS_IE8:IS_IE8,IE_VERSION:IE_VERSION,IS_SAFARI:IS_SAFARI,IS_ANY_SAFARI:IS_ANY_SAFARI,TOUCH_ENABLED:TOUCH_ENABLED,BACKGROUND_SIZE_SUPPORTED:BACKGROUND_SIZE_SUPPORTED});var _typeof$2=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};var classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}};var inherits$1=function(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;};var possibleConstructorReturn=function(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;};var taggedTemplateLiteralLoose=function(strings,raw){strings.raw=raw;return strings;};/**
 * @file obj.js
 * @module obj
 *//**
 * @callback obj:EachCallback
 *
 * @param {Mixed} value
 *        The current key for the object that is being iterated over.
 *
 * @param {string} key
 *        The current key-value for object that is being iterated over
 *//**
 * @callback obj:ReduceCallback
 *
 * @param {Mixed} accum
 *        The value that is accumulating over the reduce loop.
 *
 * @param {Mixed} value
 *        The current key for the object that is being iterated over.
 *
 * @param {string} key
 *        The current key-value for object that is being iterated over
 *
 * @return {Mixed}
 *         The new accumulated value.
 */var toString=Object.prototype.toString;/**
 * Get the keys of an Object
 *
 * @param {Object}
 *        The Object to get the keys from
 *
 * @return {string[]}
 *         An array of the keys from the object. Returns an empty array if the
 *         object passed in was invalid or had no keys.
 *
 * @private
 */var keys$1=function keys(object){return isObject$4(object)?Object.keys(object):[];};/**
 * Array-like iteration for objects.
 *
 * @param {Object} object
 *        The object to iterate over
 *
 * @param {obj:EachCallback} fn
 *        The callback function which is called for each key in the object.
 */function each$g(object,fn){keys$1(object).forEach(function(key){return fn(object[key],key);});}/**
 * Array-like reduce for objects.
 *
 * @param {Object} object
 *        The Object that you want to reduce.
 *
 * @param {Function} fn
 *         A callback function which is called for each key in the object. It
 *         receives the accumulated value and the per-iteration value and key
 *         as arguments.
 *
 * @param {Mixed} [initial = 0]
 *        Starting value
 *
 * @return {Mixed}
 *         The final accumulated value.
 */function reduce$1(object,fn){var initial=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;return keys$1(object).reduce(function(accum,key){return fn(accum,object[key],key);},initial);}/**
 * Object.assign-style object shallow merge/extend.
 *
 * @param  {Object} target
 * @param  {Object} ...sources
 * @return {Object}
 */function assign$1(target){for(var _len=arguments.length,sources=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){sources[_key-1]=arguments[_key];}if(Object.assign){return Object.assign.apply(Object,[target].concat(sources));}sources.forEach(function(source){if(!source){return;}each$g(source,function(value,key){target[key]=value;});});return target;}/**
 * Returns whether a value is an object of any kind - including DOM nodes,
 * arrays, regular expressions, etc. Not functions, though.
 *
 * This avoids the gotcha where using `typeof` on a `null` value
 * results in `'object'`.
 *
 * @param  {Object} value
 * @return {Boolean}
 */function isObject$4(value){return !!value&&(typeof value==='undefined'?'undefined':_typeof$2(value))==='object';}/**
 * Returns whether an object appears to be a "plain" object - that is, a
 * direct instance of `Object`.
 *
 * @param  {Object} value
 * @return {Boolean}
 */function isPlain(value){return isObject$4(value)&&toString.call(value)==='[object Object]'&&value.constructor===Object;}/**
 * @file create-logger.js
 * @module create-logger
 */// This is the private tracking variable for the logging history.
var history=[];/**
 * Log messages to the console and history based on the type of message
 *
 * @private
 * @param  {string} type
 *         The name of the console method to use.
 *
 * @param  {Array} args
 *         The arguments to be passed to the matching console method.
 */var LogByTypeFactory=function LogByTypeFactory(name,log){return function(type,level,args,stringify){var lvl=log.levels[level];var lvlRegExp=new RegExp('^('+lvl+')$');if(type!=='log'){// Add the type to the front of the message when it's not "log".
args.unshift(type.toUpperCase()+':');}// Add console prefix after adding to history.
args.unshift(name+':');// Add a clone of the args at this point to history.
if(history){history.push([].concat(args));}// If there's no console then don't try to output messages, but they will
// still be stored in history.
if(!window$1.console){return;}// Was setting these once outside of this function, but containing them
// in the function makes it easier to test cases where console doesn't exist
// when the module is executed.
var fn=window$1.console[type];if(!fn&&type==='debug'){// Certain browsers don't have support for console.debug. For those, we
// should default to the closest comparable log.
fn=window$1.console.info||window$1.console.log;}// Bail out if there's no console or if this type is not allowed by the
// current logging level.
if(!fn||!lvl||!lvlRegExp.test(type)){return;}// IEs previous to 11 log objects uselessly as "[object Object]"; so, JSONify
// objects and arrays for those less-capable browsers.
if(stringify){args=args.map(function(a){if(isObject$4(a)||Array.isArray(a)){try{return JSON.stringify(a);}catch(x){return String(a);}}// Cast to string before joining, so we get null and undefined explicitly
// included in output (as we would in a modern console).
return String(a);}).join(' ');}// Old IE versions do not allow .apply() for console methods (they are
// reported as objects rather than functions).
if(!fn.apply){fn(args);}else {fn[Array.isArray(args)?'apply':'call'](window$1.console,args);}};};function createLogger$1(name){// This is the private tracking variable for logging level.
var level='info';// the curried logByType bound to the specific log and history
var logByType=void 0;/**
   * Logs plain debug messages. Similar to `console.log`.
   *
   * Due to [limitations](https://github.com/jsdoc3/jsdoc/issues/955#issuecomment-313829149)
   * of our JSDoc template, we cannot properly document this as both a function
   * and a namespace, so its function signature is documented here.
   *
   * #### Arguments
   * ##### *args
   * Mixed[]
   *
   * Any combination of values that could be passed to `console.log()`.
   *
   * #### Return Value
   *
   * `undefined`
   *
   * @namespace
   * @param    {Mixed[]} args
   *           One or more messages or objects that should be logged.
   */var log=function log(){var stringify=log.stringify||IE_VERSION&&IE_VERSION<11;for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}logByType('log',level,args,stringify);};// This is the logByType helper that the logging methods below use
logByType=LogByTypeFactory(name,log);/**
   * Create a new sublogger which chains the old name to the new name.
   *
   * For example, doing `videojs.log.createLogger('player')` and then using that logger will log the following:
   * ```js
   *  mylogger('foo');
   *  // > VIDEOJS: player: foo
   * ```
   *
   * @param {string} name
   *        The name to add call the new logger
   * @return {Object}
   */log.createLogger=function(subname){return createLogger$1(name+': '+subname);};/**
   * Enumeration of available logging levels, where the keys are the level names
   * and the values are `|`-separated strings containing logging methods allowed
   * in that logging level. These strings are used to create a regular expression
   * matching the function name being called.
   *
   * Levels provided by Video.js are:
   *
   * - `off`: Matches no calls. Any value that can be cast to `false` will have
   *   this effect. The most restrictive.
   * - `all`: Matches only Video.js-provided functions (`debug`, `log`,
   *   `log.warn`, and `log.error`).
   * - `debug`: Matches `log.debug`, `log`, `log.warn`, and `log.error` calls.
   * - `info` (default): Matches `log`, `log.warn`, and `log.error` calls.
   * - `warn`: Matches `log.warn` and `log.error` calls.
   * - `error`: Matches only `log.error` calls.
   *
   * @type {Object}
   */log.levels={all:'debug|log|warn|error',off:'',debug:'debug|log|warn|error',info:'log|warn|error',warn:'warn|error',error:'error',DEFAULT:level};/**
   * Get or set the current logging level.
   *
   * If a string matching a key from {@link module:log.levels} is provided, acts
   * as a setter.
   *
   * @param  {string} [lvl]
   *         Pass a valid level to set a new logging level.
   *
   * @return {string}
   *         The current logging level.
   */log.level=function(lvl){if(typeof lvl==='string'){if(!log.levels.hasOwnProperty(lvl)){throw new Error('"'+lvl+'" in not a valid log level');}level=lvl;}return level;};/**
   * Returns an array containing everything that has been logged to the history.
   *
   * This array is a shallow clone of the internal history record. However, its
   * contents are _not_ cloned; so, mutating objects inside this array will
   * mutate them in history.
   *
   * @return {Array}
   */log.history=function(){return history?[].concat(history):[];};/**
   * Allows you to filter the history by the given logger name
   *
   * @param {string} fname
   *        The name to filter by
   *
   * @return {Array}
   *         The filtered list to return
   */log.history.filter=function(fname){return (history||[]).filter(function(historyItem){// if the first item in each historyItem includes `fname`, then it's a match
return new RegExp('.*'+fname+'.*').test(historyItem[0]);});};/**
   * Clears the internal history tracking, but does not prevent further history
   * tracking.
   */log.history.clear=function(){if(history){history.length=0;}};/**
   * Disable history tracking if it is currently enabled.
   */log.history.disable=function(){if(history!==null){history.length=0;history=null;}};/**
   * Enable history tracking if it is currently disabled.
   */log.history.enable=function(){if(history===null){history=[];}};/**
   * Logs error messages. Similar to `console.error`.
   *
   * @param {Mixed[]} args
   *        One or more messages or objects that should be logged as an error
   */log.error=function(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}return logByType('error',level,args);};/**
   * Logs warning messages. Similar to `console.warn`.
   *
   * @param {Mixed[]} args
   *        One or more messages or objects that should be logged as a warning.
   */log.warn=function(){for(var _len3=arguments.length,args=Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}return logByType('warn',level,args);};/**
   * Logs debug messages. Similar to `console.debug`, but may also act as a comparable
   * log if `console.debug` is not available
   *
   * @param {Mixed[]} args
   *        One or more messages or objects that should be logged as debug.
   */log.debug=function(){for(var _len4=arguments.length,args=Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}return logByType('debug',level,args);};return log;}/**
 * @file log.js
 * @module log
 */var log$2=createLogger$1('VIDEOJS');var createLogger=log$2.createLogger;/**
 * @file computed-style.js
 * @module computed-style
 *//**
 * A safe getComputedStyle with an IE8 fallback.
 *
 * This is needed because in Firefox, if the player is loaded in an iframe with
 * `display:none`, then `getComputedStyle` returns `null`, so, we do a null-check to
 * make sure  that the player doesn't break in these cases.
 *
 * @param {Element} el
 *        The element you want the computed style of
 *
 * @param {string} prop
 *        The property name you want
 *
 * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397
 *
 * @static
 * @const
 */function computedStyle(el,prop){if(!el||!prop){return '';}if(typeof window$1.getComputedStyle==='function'){var cs=window$1.getComputedStyle(el);return cs?cs[prop]:'';}return el.currentStyle[prop]||'';}var _templateObject=taggedTemplateLiteralLoose(['Setting attributes in the second argument of createEl()\n                has been deprecated. Use the third argument instead.\n                createEl(type, properties, attributes). Attempting to set ',' to ','.'],['Setting attributes in the second argument of createEl()\n                has been deprecated. Use the third argument instead.\n                createEl(type, properties, attributes). Attempting to set ',' to ','.']);/**
 * @file dom.js
 * @module dom
 *//**
 * Detect if a value is a string with any non-whitespace characters.
 *
 * @param {string} str
 *        The string to check
 *
 * @return {boolean}
 *         - True if the string is non-blank
 *         - False otherwise
 *
 */function isNonBlankString(str){return typeof str==='string'&&/\S/.test(str);}/**
 * Throws an error if the passed string has whitespace. This is used by
 * class methods to be relatively consistent with the classList API.
 *
 * @param {string} str
 *         The string to check for whitespace.
 *
 * @throws {Error}
 *         Throws an error if there is whitespace in the string.
 *
 */function throwIfWhitespace(str){if(/\s/.test(str)){throw new Error('class has illegal whitespace characters');}}/**
 * Produce a regular expression for matching a className within an elements className.
 *
 * @param {string} className
 *         The className to generate the RegExp for.
 *
 * @return {RegExp}
 *         The RegExp that will check for a specific `className` in an elements
 *         className.
 */function classRegExp(className){return new RegExp('(^|\\s)'+className+'($|\\s)');}/**
 * Whether the current DOM interface appears to be real.
 *
 * @return {Boolean}
 */function isReal(){return(// Both document and window will never be undefined thanks to `global`.
document$1===window$1.document&&// In IE < 9, DOM methods return "object" as their type, so all we can
// confidently check is that it exists.
typeof document$1.createElement!=='undefined');}/**
 * Determines, via duck typing, whether or not a value is a DOM element.
 *
 * @param {Mixed} value
 *        The thing to check
 *
 * @return {boolean}
 *         - True if it is a DOM element
 *         - False otherwise
 */function isEl(value){return isObject$4(value)&&value.nodeType===1;}/**
 * Determines if the current DOM is embedded in an iframe.
 *
 * @return {boolean}
 *
 */function isInFrame(){// We need a try/catch here because Safari will throw errors when attempting
// to get either `parent` or `self`
try{return window$1.parent!==window$1.self;}catch(x){return true;}}/**
 * Creates functions to query the DOM using a given method.
 *
 * @param {string} method
 *         The method to create the query with.
 *
 * @return {Function}
 *         The query method
 */function createQuerier(method){return function(selector,context){if(!isNonBlankString(selector)){return document$1[method](null);}if(isNonBlankString(context)){context=document$1.querySelector(context);}var ctx=isEl(context)?context:document$1;return ctx[method]&&ctx[method](selector);};}/**
 * Creates an element and applies properties.
 *
 * @param {string} [tagName='div']
 *         Name of tag to be created.
 *
 * @param {Object} [properties={}]
 *         Element properties to be applied.
 *
 * @param {Object} [attributes={}]
 *         Element attributes to be applied.
 *
 * @param {String|Element|TextNode|Array|Function} [content]
 *         Contents for the element (see: {@link dom:normalizeContent})
 *
 * @return {Element}
 *         The element that was created.
 */function createEl$2(){var tagName=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'div';var properties=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var attributes=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var content=arguments[3];var el=document$1.createElement(tagName);Object.getOwnPropertyNames(properties).forEach(function(propName){var val=properties[propName];// See #2176
// We originally were accepting both properties and attributes in the
// same object, but that doesn't work so well.
if(propName.indexOf('aria-')!==-1||propName==='role'||propName==='type'){log$2.warn(tsml(_templateObject,propName,val));el.setAttribute(propName,val);// Handle textContent since it's not supported everywhere and we have a
// method for it.
}else if(propName==='textContent'){textContent(el,val);}else {el[propName]=val;}});Object.getOwnPropertyNames(attributes).forEach(function(attrName){el.setAttribute(attrName,attributes[attrName]);});if(content){appendContent(el,content);}return el;}/**
 * Injects text into an element, replacing any existing contents entirely.
 *
 * @param {Element} el
 *        The element to add text content into
 *
 * @param {string} text
 *        The text content to add.
 *
 * @return {Element}
 *         The element with added text content.
 */function textContent(el,text){if(typeof el.textContent==='undefined'){el.innerText=text;}else {el.textContent=text;}return el;}/**
 * Insert an element as the first child node of another
 *
 * @param {Element} child
 *        Element to insert
 *
 * @param {Element} parent
 *        Element to insert child into
 */function prependTo(child,parent){if(parent.firstChild){parent.insertBefore(child,parent.firstChild);}else {parent.appendChild(child);}}/**
 * Check if an element has a CSS class
 *
 * @param {Element} element
 *        Element to check
 *
 * @param {string} classToCheck
 *        Class name to check for
 *
 * @return {boolean}
 *         - True if the element had the class
 *         - False otherwise.
 *
 * @throws {Error}
 *         Throws an error if `classToCheck` has white space.
 */function hasClass(element,classToCheck){throwIfWhitespace(classToCheck);if(element.classList){return element.classList.contains(classToCheck);}return classRegExp(classToCheck).test(element.className);}/**
 * Add a CSS class name to an element
 *
 * @param {Element} element
 *        Element to add class name to.
 *
 * @param {string} classToAdd
 *        Class name to add.
 *
 * @return {Element}
 *         The dom element with the added class name.
 */function addClass(element,classToAdd){if(element.classList){element.classList.add(classToAdd);// Don't need to `throwIfWhitespace` here because `hasElClass` will do it
// in the case of classList not being supported.
}else if(!hasClass(element,classToAdd)){element.className=(element.className+' '+classToAdd).trim();}return element;}/**
 * Remove a CSS class name from an element
 *
 * @param {Element} element
 *        Element to remove a class name from.
 *
 * @param {string} classToRemove
 *        Class name to remove
 *
 * @return {Element}
 *         The dom element with class name removed.
 */function removeClass(element,classToRemove){if(element.classList){element.classList.remove(classToRemove);}else {throwIfWhitespace(classToRemove);element.className=element.className.split(/\s+/).filter(function(c){return c!==classToRemove;}).join(' ');}return element;}/**
 * The callback definition for toggleElClass.
 *
 * @callback Dom~PredicateCallback
 * @param {Element} element
 *        The DOM element of the Component.
 *
 * @param {string} classToToggle
 *        The `className` that wants to be toggled
 *
 * @return {boolean|undefined}
 *         - If true the `classToToggle` will get added to `element`.
 *         - If false the `classToToggle` will get removed from `element`.
 *         - If undefined this callback will be ignored
 *//**
 * Adds or removes a CSS class name on an element depending on an optional
 * condition or the presence/absence of the class name.
 *
 * @param {Element} element
 *        The element to toggle a class name on.
 *
 * @param {string} classToToggle
 *        The class that should be toggled
 *
 * @param {boolean|PredicateCallback} [predicate]
 *        See the return value for {@link Dom~PredicateCallback}
 *
 * @return {Element}
 *         The element with a class that has been toggled.
 */function toggleClass(element,classToToggle,predicate){// This CANNOT use `classList` internally because IE does not support the
// second parameter to the `classList.toggle()` method! Which is fine because
// `classList` will be used by the add/remove functions.
var has=hasClass(element,classToToggle);if(typeof predicate==='function'){predicate=predicate(element,classToToggle);}if(typeof predicate!=='boolean'){predicate=!has;}// If the necessary class operation matches the current state of the
// element, no action is required.
if(predicate===has){return;}if(predicate){addClass(element,classToToggle);}else {removeClass(element,classToToggle);}return element;}/**
 * Apply attributes to an HTML element.
 *
 * @param {Element} el
 *        Element to add attributes to.
 *
 * @param {Object} [attributes]
 *        Attributes to be applied.
 */function setAttributes(el,attributes){Object.getOwnPropertyNames(attributes).forEach(function(attrName){var attrValue=attributes[attrName];if(attrValue===null||typeof attrValue==='undefined'||attrValue===false){el.removeAttribute(attrName);}else {el.setAttribute(attrName,attrValue===true?'':attrValue);}});}/**
 * Get an element's attribute values, as defined on the HTML tag
 * Attributes are not the same as properties. They're defined on the tag
 * or with setAttribute (which shouldn't be used with HTML)
 * This will return true or false for boolean attributes.
 *
 * @param {Element} tag
 *        Element from which to get tag attributes.
 *
 * @return {Object}
 *         All attributes of the element.
 */function getAttributes(tag){var obj={};// known boolean attributes
// we can check for matching boolean properties, but older browsers
// won't know about HTML5 boolean attributes that we still read from
var knownBooleans=','+'autoplay,controls,playsinline,loop,muted,default,defaultMuted'+',';if(tag&&tag.attributes&&tag.attributes.length>0){var attrs=tag.attributes;for(var i=attrs.length-1;i>=0;i--){var attrName=attrs[i].name;var attrVal=attrs[i].value;// check for known booleans
// the matching element property will return a value for typeof
if(typeof tag[attrName]==='boolean'||knownBooleans.indexOf(','+attrName+',')!==-1){// the value of an included boolean attribute is typically an empty
// string ('') which would equal false if we just check for a false value.
// we also don't want support bad code like autoplay='false'
attrVal=attrVal!==null?true:false;}obj[attrName]=attrVal;}}return obj;}/**
 * Get the value of an element's attribute
 *
 * @param {Element} el
 *        A DOM element
 *
 * @param {string} attribute
 *        Attribute to get the value of
 *
 * @return {string}
 *         value of the attribute
 */function getAttribute$1(el,attribute){return el.getAttribute(attribute);}/**
 * Set the value of an element's attribute
 *
 * @param {Element} el
 *        A DOM element
 *
 * @param {string} attribute
 *        Attribute to set
 *
 * @param {string} value
 *        Value to set the attribute to
 */function setAttribute$1(el,attribute,value){el.setAttribute(attribute,value);}/**
 * Remove an element's attribute
 *
 * @param {Element} el
 *        A DOM element
 *
 * @param {string} attribute
 *        Attribute to remove
 */function removeAttribute(el,attribute){el.removeAttribute(attribute);}/**
 * Attempt to block the ability to select text while dragging controls
 */function blockTextSelection(){document$1.body.focus();document$1.onselectstart=function(){return false;};}/**
 * Turn off text selection blocking
 */function unblockTextSelection(){document$1.onselectstart=function(){return true;};}/**
 * Identical to the native `getBoundingClientRect` function, but ensures that
 * the method is supported at all (it is in all browsers we claim to support)
 * and that the element is in the DOM before continuing.
 *
 * This wrapper function also shims properties which are not provided by some
 * older browsers (namely, IE8).
 *
 * Additionally, some browsers do not support adding properties to a
 * `ClientRect`/`DOMRect` object; so, we shallow-copy it with the standard
 * properties (except `x` and `y` which are not widely supported). This helps
 * avoid implementations where keys are non-enumerable.
 *
 * @param  {Element} el
 *         Element whose `ClientRect` we want to calculate.
 *
 * @return {Object|undefined}
 *         Always returns a plain
 */function getBoundingClientRect(el){if(el&&el.getBoundingClientRect&&el.parentNode){var rect=el.getBoundingClientRect();var result={};['bottom','height','left','right','top','width'].forEach(function(k){if(rect[k]!==undefined){result[k]=rect[k];}});if(!result.height){result.height=parseFloat(computedStyle(el,'height'));}if(!result.width){result.width=parseFloat(computedStyle(el,'width'));}return result;}}/**
 * The postion of a DOM element on the page.
 *
 * @typedef {Object} module:dom~Position
 *
 * @property {number} left
 *           Pixels to the left
 *
 * @property {number} top
 *           Pixels on top
 *//**
 * Offset Left.
 * getBoundingClientRect technique from
 * John Resig
 *
 * @see http://ejohn.org/blog/getboundingclientrect-is-awesome/
 *
 * @param {Element} el
 *        Element from which to get offset
 *
 * @return {module:dom~Position}
 *         The position of the element that was passed in.
 */function findPosition(el){var box=void 0;if(el.getBoundingClientRect&&el.parentNode){box=el.getBoundingClientRect();}if(!box){return {left:0,top:0};}var docEl=document$1.documentElement;var body=document$1.body;var clientLeft=docEl.clientLeft||body.clientLeft||0;var scrollLeft=window$1.pageXOffset||body.scrollLeft;var left=box.left+scrollLeft-clientLeft;var clientTop=docEl.clientTop||body.clientTop||0;var scrollTop=window$1.pageYOffset||body.scrollTop;var top=box.top+scrollTop-clientTop;// Android sometimes returns slightly off decimal values, so need to round
return {left:Math.round(left),top:Math.round(top)};}/**
 * x and y coordinates for a dom element or mouse pointer
 *
 * @typedef {Object} Dom~Coordinates
 *
 * @property {number} x
 *           x coordinate in pixels
 *
 * @property {number} y
 *           y coordinate in pixels
 *//**
 * Get pointer position in element
 * Returns an object with x and y coordinates.
 * The base on the coordinates are the bottom left of the element.
 *
 * @param {Element} el
 *        Element on which to get the pointer position on
 *
 * @param {EventTarget~Event} event
 *        Event object
 *
 * @return {Dom~Coordinates}
 *         A Coordinates object corresponding to the mouse position.
 *
 */function getPointerPosition(el,event){var position={};var box=findPosition(el);var boxW=el.offsetWidth;var boxH=el.offsetHeight;var boxY=box.top;var boxX=box.left;var pageY=event.pageY;var pageX=event.pageX;if(event.changedTouches){pageX=event.changedTouches[0].pageX;pageY=event.changedTouches[0].pageY;}position.y=Math.max(0,Math.min(1,(boxY-pageY+boxH)/boxH));position.x=Math.max(0,Math.min(1,(pageX-boxX)/boxW));return position;}/**
 * Determines, via duck typing, whether or not a value is a text node.
 *
 * @param {Mixed} value
 *        Check if this value is a text node.
 *
 * @return {boolean}
 *         - True if it is a text node
 *         - False otherwise
 */function isTextNode$1(value){return isObject$4(value)&&value.nodeType===3;}/**
 * Empties the contents of an element.
 *
 * @param {Element} el
 *        The element to empty children from
 *
 * @return {Element}
 *         The element with no children
 */function emptyEl(el){while(el.firstChild){el.removeChild(el.firstChild);}return el;}/**
 * Normalizes content for eventual insertion into the DOM.
 *
 * This allows a wide range of content definition methods, but protects
 * from falling into the trap of simply writing to `innerHTML`, which is
 * an XSS concern.
 *
 * The content for an element can be passed in multiple types and
 * combinations, whose behavior is as follows:
 *
 * @param {String|Element|TextNode|Array|Function} content
 *        - String: Normalized into a text node.
 *        - Element/TextNode: Passed through.
 *        - Array: A one-dimensional array of strings, elements, nodes, or functions
 *          (which return single strings, elements, or nodes).
 *        - Function: If the sole argument, is expected to produce a string, element,
 *          node, or array as defined above.
 *
 * @return {Array}
 *         All of the content that was passed in normalized.
 */function normalizeContent(content){// First, invoke content if it is a function. If it produces an array,
// that needs to happen before normalization.
if(typeof content==='function'){content=content();}// Next up, normalize to an array, so one or many items can be normalized,
// filtered, and returned.
return (Array.isArray(content)?content:[content]).map(function(value){// First, invoke value if it is a function to produce a new value,
// which will be subsequently normalized to a Node of some kind.
if(typeof value==='function'){value=value();}if(isEl(value)||isTextNode$1(value)){return value;}if(typeof value==='string'&&/\S/.test(value)){return document$1.createTextNode(value);}}).filter(function(value){return value;});}/**
 * Normalizes and appends content to an element.
 *
 * @param {Element} el
 *        Element to append normalized content to.
 *
 *
 * @param {String|Element|TextNode|Array|Function} content
 *        See the `content` argument of {@link dom:normalizeContent}
 *
 * @return {Element}
 *         The element with appended normalized content.
 */function appendContent(el,content){normalizeContent(content).forEach(function(node){return el.appendChild(node);});return el;}/**
 * Normalizes and inserts content into an element; this is identical to
 * `appendContent()`, except it empties the element first.
 *
 * @param {Element} el
 *        Element to insert normalized content into.
 *
 * @param {String|Element|TextNode|Array|Function} content
 *        See the `content` argument of {@link dom:normalizeContent}
 *
 * @return {Element}
 *         The element with inserted normalized content.
 *
 */function insertContent(el,content){return appendContent(emptyEl(el),content);}/**
 * Check if event was a single left click
 *
 * @param {EventTarget~Event} event
 *        Event object
 *
 * @return {boolean}
 *         - True if a left click
 *         - False if not a left click
 */function isSingleLeftClick(event){// Note: if you create something draggable, be sure to
// call it on both `mousedown` and `mousemove` event,
// otherwise `mousedown` should be enough for a button
if(event.button===undefined&&event.buttons===undefined){// Why do we need `buttons` ?
// Because, middle mouse sometimes have this:
// e.button === 0 and e.buttons === 4
// Furthermore, we want to prevent combination click, something like
// HOLD middlemouse then left click, that would be
// e.button === 0, e.buttons === 5
// just `button` is not gonna work
// Alright, then what this block does ?
// this is for chrome `simulate mobile devices`
// I want to support this as well
return true;}if(event.button===0&&event.buttons===undefined){// Touch screen, sometimes on some specific device, `buttons`
// doesn't have anything (safari on ios, blackberry...)
return true;}if(IE_VERSION===9){// Ignore IE9
return true;}if(event.button!==0||event.buttons!==1){// This is the reason we have those if else block above
// if any special case we can catch and let it slide
// we do it above, when get to here, this definitely
// is-not-left-click
return false;}return true;}/**
 * Finds a single DOM element matching `selector` within the optional
 * `context` of another DOM element (defaulting to `document`).
 *
 * @param {string} selector
 *        A valid CSS selector, which will be passed to `querySelector`.
 *
 * @param {Element|String} [context=document]
 *        A DOM element within which to query. Can also be a selector
 *        string in which case the first matching element will be used
 *        as context. If missing (or no element matches selector), falls
 *        back to `document`.
 *
 * @return {Element|null}
 *         The element that was found or null.
 */var $$1=createQuerier('querySelector');/**
 * Finds a all DOM elements matching `selector` within the optional
 * `context` of another DOM element (defaulting to `document`).
 *
 * @param {string} selector
 *           A valid CSS selector, which will be passed to `querySelectorAll`.
 *
 * @param {Element|String} [context=document]
 *           A DOM element within which to query. Can also be a selector
 *           string in which case the first matching element will be used
 *           as context. If missing (or no element matches selector), falls
 *           back to `document`.
 *
 * @return {NodeList}
 *         A element list of elements that were found. Will be empty if none were found.
 *
 */var $$=createQuerier('querySelectorAll');var Dom=(Object.freeze||Object)({isReal:isReal,isEl:isEl,isInFrame:isInFrame,createEl:createEl$2,textContent:textContent,prependTo:prependTo,hasClass:hasClass,addClass:addClass,removeClass:removeClass,toggleClass:toggleClass,setAttributes:setAttributes,getAttributes:getAttributes,getAttribute:getAttribute$1,setAttribute:setAttribute$1,removeAttribute:removeAttribute,blockTextSelection:blockTextSelection,unblockTextSelection:unblockTextSelection,getBoundingClientRect:getBoundingClientRect,findPosition:findPosition,getPointerPosition:getPointerPosition,isTextNode:isTextNode$1,emptyEl:emptyEl,normalizeContent:normalizeContent,appendContent:appendContent,insertContent:insertContent,isSingleLeftClick:isSingleLeftClick,$:$$1,$$:$$});/**
 * @file guid.js
 * @module guid
 *//**
 * Unique ID for an element or function
 * @type {Number}
 */var _guid=1;/**
 * Get a unique auto-incrementing ID by number that has not been returned before.
 *
 * @return {number}
 *         A new unique ID.
 */function newGUID(){return _guid++;}/**
 * @file dom-data.js
 * @module dom-data
 *//**
 * Element Data Store.
 *
 * Allows for binding data to an element without putting it directly on the
 * element. Ex. Event listeners are stored here.
 * (also from jsninja.com, slightly modified and updated for closure compiler)
 *
 * @type {Object}
 * @private
 */var elData={};/*
 * Unique attribute name to store an element's guid in
 *
 * @type {String}
 * @constant
 * @private
 */var elIdAttr='vdata'+new Date().getTime();/**
 * Returns the cache object where data for an element is stored
 *
 * @param {Element} el
 *        Element to store data for.
 *
 * @return {Object}
 *         The cache object for that el that was passed in.
 */function getData$1(el){var id=el[elIdAttr];if(!id){id=el[elIdAttr]=newGUID();}if(!elData[id]){elData[id]={};}return elData[id];}/**
 * Returns whether or not an element has cached data
 *
 * @param {Element} el
 *        Check if this element has cached data.
 *
 * @return {boolean}
 *         - True if the DOM element has cached data.
 *         - False otherwise.
 */function hasData(el){var id=el[elIdAttr];if(!id){return false;}return !!Object.getOwnPropertyNames(elData[id]).length;}/**
 * Delete data for the element from the cache and the guid attr from getElementById
 *
 * @param {Element} el
 *        Remove cached data for this element.
 */function removeData(el){var id=el[elIdAttr];if(!id){return;}// Remove all stored data
delete elData[id];// Remove the elIdAttr property from the DOM node
try{delete el[elIdAttr];}catch(e){if(el.removeAttribute){el.removeAttribute(elIdAttr);}else {// IE doesn't appear to support removeAttribute on the document element
el[elIdAttr]=null;}}}/**
 * @file events.js. An Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)
 * (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)
 * This should work very similarly to jQuery's events, however it's based off the book version which isn't as
 * robust as jquery's, so there's probably some differences.
 *
 * @module events
 *//**
 * Clean up the listener cache and dispatchers
 *
 * @param {Element|Object} elem
 *        Element to clean up
 *
 * @param {string} type
 *        Type of event to clean up
 */function _cleanUpEvents(elem,type){var data=getData$1(elem);// Remove the events of a particular type if there are none left
if(data.handlers[type].length===0){delete data.handlers[type];// data.handlers[type] = null;
// Setting to null was causing an error with data.handlers
// Remove the meta-handler from the element
if(elem.removeEventListener){elem.removeEventListener(type,data.dispatcher,false);}else if(elem.detachEvent){elem.detachEvent('on'+type,data.dispatcher);}}// Remove the events object if there are no types left
if(Object.getOwnPropertyNames(data.handlers).length<=0){delete data.handlers;delete data.dispatcher;delete data.disabled;}// Finally remove the element data if there is no data left
if(Object.getOwnPropertyNames(data).length===0){removeData(elem);}}/**
 * Loops through an array of event types and calls the requested method for each type.
 *
 * @param {Function} fn
 *        The event method we want to use.
 *
 * @param {Element|Object} elem
 *        Element or object to bind listeners to
 *
 * @param {string} type
 *        Type of event to bind to.
 *
 * @param {EventTarget~EventListener} callback
 *        Event listener.
 */function _handleMultipleEvents(fn,elem,types,callback){types.forEach(function(type){// Call the event method for each one of the types
fn(elem,type,callback);});}/**
 * Fix a native event to have standard property values
 *
 * @param {Object} event
 *        Event object to fix.
 *
 * @return {Object}
 *         Fixed event object.
 */function fixEvent(event){function returnTrue(){return true;}function returnFalse(){return false;}// Test if fixing up is needed
// Used to check if !event.stopPropagation instead of isPropagationStopped
// But native events return true for stopPropagation, but don't have
// other expected methods like isPropagationStopped. Seems to be a problem
// with the Javascript Ninja code. So we're just overriding all events now.
if(!event||!event.isPropagationStopped){var old=event||window$1.event;event={};// Clone the old object so that we can modify the values event = {};
// IE8 Doesn't like when you mess with native event properties
// Firefox returns false for event.hasOwnProperty('type') and other props
//  which makes copying more difficult.
// TODO: Probably best to create a whitelist of event props
for(var key in old){// Safari 6.0.3 warns you if you try to copy deprecated layerX/Y
// Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation
// and webkitMovementX/Y
if(key!=='layerX'&&key!=='layerY'&&key!=='keyLocation'&&key!=='webkitMovementX'&&key!=='webkitMovementY'){// Chrome 32+ warns if you try to copy deprecated returnValue, but
// we still want to if preventDefault isn't supported (IE8).
if(!(key==='returnValue'&&old.preventDefault)){event[key]=old[key];}}}// The event occurred on this element
if(!event.target){event.target=event.srcElement||document$1;}// Handle which other element the event is related to
if(!event.relatedTarget){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement;}// Stop the default browser action
event.preventDefault=function(){if(old.preventDefault){old.preventDefault();}event.returnValue=false;old.returnValue=false;event.defaultPrevented=true;};event.defaultPrevented=false;// Stop the event from bubbling
event.stopPropagation=function(){if(old.stopPropagation){old.stopPropagation();}event.cancelBubble=true;old.cancelBubble=true;event.isPropagationStopped=returnTrue;};event.isPropagationStopped=returnFalse;// Stop the event from bubbling and executing other handlers
event.stopImmediatePropagation=function(){if(old.stopImmediatePropagation){old.stopImmediatePropagation();}event.isImmediatePropagationStopped=returnTrue;event.stopPropagation();};event.isImmediatePropagationStopped=returnFalse;// Handle mouse position
if(event.clientX!==null&&event.clientX!==undefined){var doc=document$1.documentElement;var body=document$1.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);}// Handle key presses
event.which=event.charCode||event.keyCode;// Fix button for mouse clicks:
// 0 == left; 1 == middle; 2 == right
if(event.button!==null&&event.button!==undefined){// The following is disabled because it does not pass videojs-standard
// and... yikes.
/* eslint-disable */event.button=event.button&1?0:event.button&4?1:event.button&2?2:0;/* eslint-enable */}}// Returns fixed-up instance
return event;}/**
 * Whether passive event listeners are supported
 */var _supportsPassive=false;(function(){try{var opts=Object.defineProperty({},'passive',{get:function get(){_supportsPassive=true;}});window$1.addEventListener('test',null,opts);window$1.removeEventListener('test',null,opts);}catch(e){// disregard
}})();/**
 * Touch events Chrome expects to be passive
 */var passiveEvents=['touchstart','touchmove'];/**
 * Add an event listener to element
 * It stores the handler function in a separate cache object
 * and adds a generic handler to the element's event,
 * along with a unique id (guid) to the element.
 *
 * @param {Element|Object} elem
 *        Element or object to bind listeners to
 *
 * @param {string|string[]} type
 *        Type of event to bind to.
 *
 * @param {EventTarget~EventListener} fn
 *        Event listener.
 */function on(elem,type,fn){if(Array.isArray(type)){return _handleMultipleEvents(on,elem,type,fn);}var data=getData$1(elem);// We need a place to store all our handler data
if(!data.handlers){data.handlers={};}if(!data.handlers[type]){data.handlers[type]=[];}if(!fn.guid){fn.guid=newGUID();}data.handlers[type].push(fn);if(!data.dispatcher){data.disabled=false;data.dispatcher=function(event,hash){if(data.disabled){return;}event=fixEvent(event);var handlers=data.handlers[event.type];if(handlers){// Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.
var handlersCopy=handlers.slice(0);for(var m=0,n=handlersCopy.length;m<n;m++){if(event.isImmediatePropagationStopped()){break;}else {try{handlersCopy[m].call(elem,event,hash);}catch(e){log$2.error(e);}}}}};}if(data.handlers[type].length===1){if(elem.addEventListener){var options=false;if(_supportsPassive&&passiveEvents.indexOf(type)>-1){options={passive:true};}elem.addEventListener(type,data.dispatcher,options);}else if(elem.attachEvent){elem.attachEvent('on'+type,data.dispatcher);}}}/**
 * Removes event listeners from an element
 *
 * @param {Element|Object} elem
 *        Object to remove listeners from.
 *
 * @param {string|string[]} [type]
 *        Type of listener to remove. Don't include to remove all events from element.
 *
 * @param {EventTarget~EventListener} [fn]
 *        Specific listener to remove. Don't include to remove listeners for an event
 *        type.
 */function off(elem,type,fn){// Don't want to add a cache object through getElData if not needed
if(!hasData(elem)){return;}var data=getData$1(elem);// If no events exist, nothing to unbind
if(!data.handlers){return;}if(Array.isArray(type)){return _handleMultipleEvents(off,elem,type,fn);}// Utility function
var removeType=function removeType(el,t){data.handlers[t]=[];_cleanUpEvents(el,t);};// Are we removing all bound events?
if(type===undefined){for(var t in data.handlers){if(Object.prototype.hasOwnProperty.call(data.handlers||{},t)){removeType(elem,t);}}return;}var handlers=data.handlers[type];// If no handlers exist, nothing to unbind
if(!handlers){return;}// If no listener was provided, remove all listeners for type
if(!fn){removeType(elem,type);return;}// We're only removing a single handler
if(fn.guid){for(var n=0;n<handlers.length;n++){if(handlers[n].guid===fn.guid){handlers.splice(n--,1);}}}_cleanUpEvents(elem,type);}/**
 * Trigger an event for an element
 *
 * @param {Element|Object} elem
 *        Element to trigger an event on
 *
 * @param {EventTarget~Event|string} event
 *        A string (the type) or an event object with a type attribute
 *
 * @param {Object} [hash]
 *        data hash to pass along with the event
 *
 * @return {boolean|undefined}
 *         - Returns the opposite of `defaultPrevented` if default was prevented
 *         - Otherwise returns undefined
 */function trigger$2(elem,event,hash){// Fetches element data and a reference to the parent (for bubbling).
// Don't want to add a data object to cache for every parent,
// so checking hasElData first.
var elemData=hasData(elem)?getData$1(elem):{};var parent=elem.parentNode||elem.ownerDocument;// type = event.type || event,
// handler;
// If an event name was passed as a string, creates an event out of it
if(typeof event==='string'){event={type:event,target:elem};}else if(!event.target){event.target=elem;}// Normalizes the event properties.
event=fixEvent(event);// If the passed element has a dispatcher, executes the established handlers.
if(elemData.dispatcher){elemData.dispatcher.call(elem,event,hash);}// Unless explicitly stopped or the event does not bubble (e.g. media events)
// recursively calls this function to bubble the event up the DOM.
if(parent&&!event.isPropagationStopped()&&event.bubbles===true){trigger$2.call(null,parent,event,hash);// If at the top of the DOM, triggers the default action unless disabled.
}else if(!parent&&!event.defaultPrevented){var targetData=getData$1(event.target);// Checks if the target has a default action for this event.
if(event.target[event.type]){// Temporarily disables event dispatching on the target as we have already executed the handler.
targetData.disabled=true;// Executes the default action.
if(typeof event.target[event.type]==='function'){event.target[event.type]();}// Re-enables event dispatching.
targetData.disabled=false;}}// Inform the triggerer if the default was prevented by returning false
return !event.defaultPrevented;}/**
 * Trigger a listener only once for an event
 *
 * @param {Element|Object} elem
 *        Element or object to bind to.
 *
 * @param {string|string[]} type
 *        Name/type of event
 *
 * @param {Event~EventListener} fn
 *        Event Listener function
 */function one(elem,type,fn){if(Array.isArray(type)){return _handleMultipleEvents(one,elem,type,fn);}var func=function func(){off(elem,type,func);fn.apply(this,arguments);};// copy the guid to the new function so it can removed using the original function's ID
func.guid=fn.guid=fn.guid||newGUID();on(elem,type,func);}var Events=(Object.freeze||Object)({fixEvent:fixEvent,on:on,off:off,trigger:trigger$2,one:one});/**
 * @file setup.js - Functions for setting up a player without
 * user interaction based on the data-setup `attribute` of the video tag.
 *
 * @module setup
 */var _windowLoaded=false;var videojs$2=void 0;/**
 * Set up any tags that have a data-setup `attribute` when the player is started.
 */var autoSetup=function autoSetup(){// Protect against breakage in non-browser environments and check global autoSetup option.
if(!isReal()||videojs$2.options.autoSetup===false){return;}// One day, when we stop supporting IE8, go back to this, but in the meantime...*hack hack hack*
// var vids = Array.prototype.slice.call(document.getElementsByTagName('video'));
// var audios = Array.prototype.slice.call(document.getElementsByTagName('audio'));
// var mediaEls = vids.concat(audios);
// Because IE8 doesn't support calling slice on a node list, we need to loop
// through each list of elements to build up a new, combined list of elements.
var vids=document$1.getElementsByTagName('video');var audios=document$1.getElementsByTagName('audio');var divs=document$1.getElementsByTagName('video-js');var mediaEls=[];if(vids&&vids.length>0){for(var i=0,e=vids.length;i<e;i++){mediaEls.push(vids[i]);}}if(audios&&audios.length>0){for(var _i=0,_e=audios.length;_i<_e;_i++){mediaEls.push(audios[_i]);}}if(divs&&divs.length>0){for(var _i2=0,_e2=divs.length;_i2<_e2;_i2++){mediaEls.push(divs[_i2]);}}// Check if any media elements exist
if(mediaEls&&mediaEls.length>0){for(var _i3=0,_e3=mediaEls.length;_i3<_e3;_i3++){var mediaEl=mediaEls[_i3];// Check if element exists, has getAttribute func.
// IE seems to consider typeof el.getAttribute == 'object' instead of
// 'function' like expected, at least when loading the player immediately.
if(mediaEl&&mediaEl.getAttribute){// Make sure this player hasn't already been set up.
if(mediaEl.player===undefined){var options=mediaEl.getAttribute('data-setup');// Check if data-setup attr exists.
// We only auto-setup if they've added the data-setup attr.
if(options!==null){// Create new video.js instance.
videojs$2(mediaEl);}}// If getAttribute isn't defined, we need to wait for the DOM.
}else {autoSetupTimeout(1);break;}}// No videos were found, so keep looping unless page is finished loading.
}else if(!_windowLoaded){autoSetupTimeout(1);}};/**
 * Wait until the page is loaded before running autoSetup. This will be called in
 * autoSetup if `hasLoaded` returns false.
 *
 * @param {number} wait
 *        How long to wait in ms
 *
 * @param {module:videojs} [vjs]
 *        The videojs library function
 */function autoSetupTimeout(wait,vjs){if(vjs){videojs$2=vjs;}window$1.setTimeout(autoSetup,wait);}if(isReal()&&document$1.readyState==='complete'){_windowLoaded=true;}else {/**
   * Listen for the load event on window, and set _windowLoaded to true.
   *
   * @listens load
   */one(window$1,'load',function(){_windowLoaded=true;});}/**
 * @file stylesheet.js
 * @module stylesheet
 *//**
 * Create a DOM syle element given a className for it.
 *
 * @param {string} className
 *        The className to add to the created style element.
 *
 * @return {Element}
 *         The element that was created.
 */var createStyleElement=function createStyleElement(className){var style=document$1.createElement('style');style.className=className;return style;};/**
 * Add text to a DOM element.
 *
 * @param {Element} el
 *        The Element to add text content to.
 *
 * @param {string} content
 *        The text to add to the element.
 */var setTextContent$1=function setTextContent(el,content){if(el.styleSheet){el.styleSheet.cssText=content;}else {el.textContent=content;}};/**
 * @file fn.js
 * @module fn
 *//**
 * Bind (a.k.a proxy or Context). A simple method for changing the context of a function
 * It also stores a unique id on the function so it can be easily removed from events.
 *
 * @param {Mixed} context
 *        The object to bind as scope.
 *
 * @param {Function} fn
 *        The function to be bound to a scope.
 *
 * @param {number} [uid]
 *        An optional unique ID for the function to be set
 *
 * @return {Function}
 *         The new function that will be bound into the context given
 */var bind$2=function bind(context,fn,uid){// Make sure the function has a unique ID
if(!fn.guid){fn.guid=newGUID();}// Create the new function that changes the context
var bound=function bound(){return fn.apply(context,arguments);};// Allow for the ability to individualize this function
// Needed in the case where multiple objects might share the same prototype
// IF both items add an event listener with the same function, then you try to remove just one
// it will remove both because they both have the same guid.
// when using this, you need to use the bind method when you remove the listener as well.
// currently used in text tracks
bound.guid=uid?uid+'_'+fn.guid:fn.guid;return bound;};/**
 * Wraps the given function, `fn`, with a new function that only invokes `fn`
 * at most once per every `wait` milliseconds.
 *
 * @param  {Function} fn
 *         The function to be throttled.
 *
 * @param  {Number}   wait
 *         The number of milliseconds by which to throttle.
 *
 * @return {Function}
 */var throttle$1=function throttle(fn,wait){var last=Date.now();var throttled=function throttled(){var now=Date.now();if(now-last>=wait){fn.apply(undefined,arguments);last=now;}};return throttled;};/**
 * Creates a debounced function that delays invoking `func` until after `wait`
 * milliseconds have elapsed since the last time the debounced function was
 * invoked.
 *
 * Inspired by lodash and underscore implementations.
 *
 * @param  {Function} func
 *         The function to wrap with debounce behavior.
 *
 * @param  {number} wait
 *         The number of milliseconds to wait after the last invocation.
 *
 * @param  {boolean} [immediate]
 *         Whether or not to invoke the function immediately upon creation.
 *
 * @param  {Object} [context=window]
 *         The "context" in which the debounced function should debounce. For
 *         example, if this function should be tied to a Video.js player,
 *         the player can be passed here. Alternatively, defaults to the
 *         global `window` object.
 *
 * @return {Function}
 *         A debounced function.
 */var debounce=function debounce(func,wait,immediate){var context=arguments.length>3&&arguments[3]!==undefined?arguments[3]:window$1;var timeout=void 0;var cancel=function cancel(){context.clearTimeout(timeout);timeout=null;};/* eslint-disable consistent-this */var debounced=function debounced(){var self=this;var args=arguments;var _later=function later(){timeout=null;_later=null;if(!immediate){func.apply(self,args);}};if(!timeout&&immediate){func.apply(self,args);}context.clearTimeout(timeout);timeout=context.setTimeout(_later,wait);};/* eslint-enable consistent-this */debounced.cancel=cancel;return debounced;};/**
 * @file src/js/event-target.js
 *//**
 * `EventTarget` is a class that can have the same API as the DOM `EventTarget`. It
 * adds shorthand functions that wrap around lengthy functions. For example:
 * the `on` function is a wrapper around `addEventListener`.
 *
 * @see [EventTarget Spec]{@link https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget}
 * @class EventTarget
 */var EventTarget=function EventTarget(){};/**
 * A Custom DOM event.
 *
 * @typedef {Object} EventTarget~Event
 * @see [Properties]{@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}
 *//**
 * All event listeners should follow the following format.
 *
 * @callback EventTarget~EventListener
 * @this {EventTarget}
 *
 * @param {EventTarget~Event} event
 *        the event that triggered this function
 *
 * @param {Object} [hash]
 *        hash of data sent during the event
 *//**
 * An object containing event names as keys and booleans as values.
 *
 * > NOTE: If an event name is set to a true value here {@link EventTarget#trigger}
 *         will have extra functionality. See that function for more information.
 *
 * @property EventTarget.prototype.allowedEvents_
 * @private
 */EventTarget.prototype.allowedEvents_={};/**
 * Adds an `event listener` to an instance of an `EventTarget`. An `event listener` is a
 * function that will get called when an event with a certain name gets triggered.
 *
 * @param {string|string[]} type
 *        An event name or an array of event names.
 *
 * @param {EventTarget~EventListener} fn
 *        The function to call with `EventTarget`s
 */EventTarget.prototype.on=function(type,fn){// Remove the addEventListener alias before calling Events.on
// so we don't get into an infinite type loop
var ael=this.addEventListener;this.addEventListener=function(){};on(this,type,fn);this.addEventListener=ael;};/**
 * An alias of {@link EventTarget#on}. Allows `EventTarget` to mimic
 * the standard DOM API.
 *
 * @function
 * @see {@link EventTarget#on}
 */EventTarget.prototype.addEventListener=EventTarget.prototype.on;/**
 * Removes an `event listener` for a specific event from an instance of `EventTarget`.
 * This makes it so that the `event listener` will no longer get called when the
 * named event happens.
 *
 * @param {string|string[]} type
 *        An event name or an array of event names.
 *
 * @param {EventTarget~EventListener} fn
 *        The function to remove.
 */EventTarget.prototype.off=function(type,fn){off(this,type,fn);};/**
 * An alias of {@link EventTarget#off}. Allows `EventTarget` to mimic
 * the standard DOM API.
 *
 * @function
 * @see {@link EventTarget#off}
 */EventTarget.prototype.removeEventListener=EventTarget.prototype.off;/**
 * This function will add an `event listener` that gets triggered only once. After the
 * first trigger it will get removed. This is like adding an `event listener`
 * with {@link EventTarget#on} that calls {@link EventTarget#off} on itself.
 *
 * @param {string|string[]} type
 *        An event name or an array of event names.
 *
 * @param {EventTarget~EventListener} fn
 *        The function to be called once for each event name.
 */EventTarget.prototype.one=function(type,fn){// Remove the addEventListener alialing Events.on
// so we don't get into an infinite type loop
var ael=this.addEventListener;this.addEventListener=function(){};one(this,type,fn);this.addEventListener=ael;};/**
 * This function causes an event to happen. This will then cause any `event listeners`
 * that are waiting for that event, to get called. If there are no `event listeners`
 * for an event then nothing will happen.
 *
 * If the name of the `Event` that is being triggered is in `EventTarget.allowedEvents_`.
 * Trigger will also call the `on` + `uppercaseEventName` function.
 *
 * Example:
 * 'click' is in `EventTarget.allowedEvents_`, so, trigger will attempt to call
 * `onClick` if it exists.
 *
 * @param {string|EventTarget~Event|Object} event
 *        The name of the event, an `Event`, or an object with a key of type set to
 *        an event name.
 */EventTarget.prototype.trigger=function(event){var type=event.type||event;if(typeof event==='string'){event={type:type};}event=fixEvent(event);if(this.allowedEvents_[type]&&this['on'+type]){this['on'+type](event);}trigger$2(this,event);};/**
 * An alias of {@link EventTarget#trigger}. Allows `EventTarget` to mimic
 * the standard DOM API.
 *
 * @function
 * @see {@link EventTarget#trigger}
 */EventTarget.prototype.dispatchEvent=EventTarget.prototype.trigger;/**
 * @file mixins/evented.js
 * @module evented
 *//**
 * Returns whether or not an object has had the evented mixin applied.
 *
 * @param  {Object} object
 *         An object to test.
 *
 * @return {boolean}
 *         Whether or not the object appears to be evented.
 */var isEvented=function isEvented(object){return object instanceof EventTarget||!!object.eventBusEl_&&['on','one','off','trigger'].every(function(k){return typeof object[k]==='function';});};/**
 * Whether a value is a valid event type - non-empty string or array.
 *
 * @private
 * @param  {string|Array} type
 *         The type value to test.
 *
 * @return {boolean}
 *         Whether or not the type is a valid event type.
 */var isValidEventType=function isValidEventType(type){return(// The regex here verifies that the `type` contains at least one non-
// whitespace character.
typeof type==='string'&&/\S/.test(type)||Array.isArray(type)&&!!type.length);};/**
 * Validates a value to determine if it is a valid event target. Throws if not.
 *
 * @private
 * @throws {Error}
 *         If the target does not appear to be a valid event target.
 *
 * @param  {Object} target
 *         The object to test.
 */var validateTarget=function validateTarget(target){if(!target.nodeName&&!isEvented(target)){throw new Error('Invalid target; must be a DOM node or evented object.');}};/**
 * Validates a value to determine if it is a valid event target. Throws if not.
 *
 * @private
 * @throws {Error}
 *         If the type does not appear to be a valid event type.
 *
 * @param  {string|Array} type
 *         The type to test.
 */var validateEventType=function validateEventType(type){if(!isValidEventType(type)){throw new Error('Invalid event type; must be a non-empty string or array.');}};/**
 * Validates a value to determine if it is a valid listener. Throws if not.
 *
 * @private
 * @throws {Error}
 *         If the listener is not a function.
 *
 * @param  {Function} listener
 *         The listener to test.
 */var validateListener=function validateListener(listener){if(typeof listener!=='function'){throw new Error('Invalid listener; must be a function.');}};/**
 * Takes an array of arguments given to `on()` or `one()`, validates them, and
 * normalizes them into an object.
 *
 * @private
 * @param  {Object} self
 *         The evented object on which `on()` or `one()` was called. This
 *         object will be bound as the `this` value for the listener.
 *
 * @param  {Array} args
 *         An array of arguments passed to `on()` or `one()`.
 *
 * @return {Object}
 *         An object containing useful values for `on()` or `one()` calls.
 */var normalizeListenArgs=function normalizeListenArgs(self,args){// If the number of arguments is less than 3, the target is always the
// evented object itself.
var isTargetingSelf=args.length<3||args[0]===self||args[0]===self.eventBusEl_;var target=void 0;var type=void 0;var listener=void 0;if(isTargetingSelf){target=self.eventBusEl_;// Deal with cases where we got 3 arguments, but we are still listening to
// the evented object itself.
if(args.length>=3){args.shift();}type=args[0];listener=args[1];}else {target=args[0];type=args[1];listener=args[2];}validateTarget(target);validateEventType(type);validateListener(listener);listener=bind$2(self,listener);return {isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener};};/**
 * Adds the listener to the event type(s) on the target, normalizing for
 * the type of target.
 *
 * @private
 * @param  {Element|Object} target
 *         A DOM node or evented object.
 *
 * @param  {string} method
 *         The event binding method to use ("on" or "one").
 *
 * @param  {string|Array} type
 *         One or more event type(s).
 *
 * @param  {Function} listener
 *         A listener function.
 */var listen=function listen(target,method,type,listener){validateTarget(target);if(target.nodeName){Events[method](target,type,listener);}else {target[method](type,listener);}};/**
 * Contains methods that provide event capabilites to an object which is passed
 * to {@link module:evented|evented}.
 *
 * @mixin EventedMixin
 */var EventedMixin={/**
   * Add a listener to an event (or events) on this object or another evented
   * object.
   *
   * @param  {string|Array|Element|Object} targetOrType
   *         If this is a string or array, it represents the event type(s)
   *         that will trigger the listener.
   *
   *         Another evented object can be passed here instead, which will
   *         cause the listener to listen for events on _that_ object.
   *
   *         In either case, the listener's `this` value will be bound to
   *         this object.
   *
   * @param  {string|Array|Function} typeOrListener
   *         If the first argument was a string or array, this should be the
   *         listener function. Otherwise, this is a string or array of event
   *         type(s).
   *
   * @param  {Function} [listener]
   *         If the first argument was another evented object, this will be
   *         the listener function.
   */on:function on$$1(){var _this=this;for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var _normalizeListenArgs=normalizeListenArgs(this,args),isTargetingSelf=_normalizeListenArgs.isTargetingSelf,target=_normalizeListenArgs.target,type=_normalizeListenArgs.type,listener=_normalizeListenArgs.listener;listen(target,'on',type,listener);// If this object is listening to another evented object.
if(!isTargetingSelf){// If this object is disposed, remove the listener.
var removeListenerOnDispose=function removeListenerOnDispose(){return _this.off(target,type,listener);};// Use the same function ID as the listener so we can remove it later it
// using the ID of the original listener.
removeListenerOnDispose.guid=listener.guid;// Add a listener to the target's dispose event as well. This ensures
// that if the target is disposed BEFORE this object, we remove the
// removal listener that was just added. Otherwise, we create a memory leak.
var removeRemoverOnTargetDispose=function removeRemoverOnTargetDispose(){return _this.off('dispose',removeListenerOnDispose);};// Use the same function ID as the listener so we can remove it later
// it using the ID of the original listener.
removeRemoverOnTargetDispose.guid=listener.guid;listen(this,'on','dispose',removeListenerOnDispose);listen(target,'on','dispose',removeRemoverOnTargetDispose);}},/**
   * Add a listener to an event (or events) on this object or another evented
   * object. The listener will only be called once and then removed.
   *
   * @param  {string|Array|Element|Object} targetOrType
   *         If this is a string or array, it represents the event type(s)
   *         that will trigger the listener.
   *
   *         Another evented object can be passed here instead, which will
   *         cause the listener to listen for events on _that_ object.
   *
   *         In either case, the listener's `this` value will be bound to
   *         this object.
   *
   * @param  {string|Array|Function} typeOrListener
   *         If the first argument was a string or array, this should be the
   *         listener function. Otherwise, this is a string or array of event
   *         type(s).
   *
   * @param  {Function} [listener]
   *         If the first argument was another evented object, this will be
   *         the listener function.
   */one:function one$$1(){var _this2=this;for(var _len2=arguments.length,args=Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}var _normalizeListenArgs2=normalizeListenArgs(this,args),isTargetingSelf=_normalizeListenArgs2.isTargetingSelf,target=_normalizeListenArgs2.target,type=_normalizeListenArgs2.type,listener=_normalizeListenArgs2.listener;// Targeting this evented object.
if(isTargetingSelf){listen(target,'one',type,listener);// Targeting another evented object.
}else {var wrapper=function wrapper(){for(var _len3=arguments.length,largs=Array(_len3),_key3=0;_key3<_len3;_key3++){largs[_key3]=arguments[_key3];}_this2.off(target,type,wrapper);listener.apply(null,largs);};// Use the same function ID as the listener so we can remove it later
// it using the ID of the original listener.
wrapper.guid=listener.guid;listen(target,'one',type,wrapper);}},/**
   * Removes listener(s) from event(s) on an evented object.
   *
   * @param  {string|Array|Element|Object} [targetOrType]
   *         If this is a string or array, it represents the event type(s).
   *
   *         Another evented object can be passed here instead, in which case
   *         ALL 3 arguments are _required_.
   *
   * @param  {string|Array|Function} [typeOrListener]
   *         If the first argument was a string or array, this may be the
   *         listener function. Otherwise, this is a string or array of event
   *         type(s).
   *
   * @param  {Function} [listener]
   *         If the first argument was another evented object, this will be
   *         the listener function; otherwise, _all_ listeners bound to the
   *         event type(s) will be removed.
   */off:function off$$1(targetOrType,typeOrListener,listener){// Targeting this evented object.
if(!targetOrType||isValidEventType(targetOrType)){off(this.eventBusEl_,targetOrType,typeOrListener);// Targeting another evented object.
}else {var target=targetOrType;var type=typeOrListener;// Fail fast and in a meaningful way!
validateTarget(target);validateEventType(type);validateListener(listener);// Ensure there's at least a guid, even if the function hasn't been used
listener=bind$2(this,listener);// Remove the dispose listener on this evented object, which was given
// the same guid as the event listener in on().
this.off('dispose',listener);if(target.nodeName){off(target,type,listener);off(target,'dispose',listener);}else if(isEvented(target)){target.off(type,listener);target.off('dispose',listener);}}},/**
   * Fire an event on this evented object, causing its listeners to be called.
   *
   * @param   {string|Object} event
   *          An event type or an object with a type property.
   *
   * @param   {Object} [hash]
   *          An additional object to pass along to listeners.
   *
   * @returns {boolean}
   *          Whether or not the default behavior was prevented.
   */trigger:function trigger$$1(event,hash){return trigger$2(this.eventBusEl_,event,hash);}};/**
 * Applies {@link module:evented~EventedMixin|EventedMixin} to a target object.
 *
 * @param  {Object} target
 *         The object to which to add event methods.
 *
 * @param  {Object} [options={}]
 *         Options for customizing the mixin behavior.
 *
 * @param  {String} [options.eventBusKey]
 *         By default, adds a `eventBusEl_` DOM element to the target object,
 *         which is used as an event bus. If the target object already has a
 *         DOM element that should be used, pass its key here.
 *
 * @return {Object}
 *         The target object.
 */function evented(target){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var eventBusKey=options.eventBusKey;// Set or create the eventBusEl_.
if(eventBusKey){if(!target[eventBusKey].nodeName){throw new Error('The eventBusKey "'+eventBusKey+'" does not refer to an element.');}target.eventBusEl_=target[eventBusKey];}else {target.eventBusEl_=createEl$2('span',{className:'vjs-event-bus'});}assign$1(target,EventedMixin);// When any evented object is disposed, it removes all its listeners.
target.on('dispose',function(){target.off();window$1.setTimeout(function(){target.eventBusEl_=null;},0);});return target;}/**
 * @file mixins/stateful.js
 * @module stateful
 *//**
 * Contains methods that provide statefulness to an object which is passed
 * to {@link module:stateful}.
 *
 * @mixin StatefulMixin
 */var StatefulMixin={/**
   * A hash containing arbitrary keys and values representing the state of
   * the object.
   *
   * @type {Object}
   */state:{},/**
   * Set the state of an object by mutating its
   * {@link module:stateful~StatefulMixin.state|state} object in place.
   *
   * @fires   module:stateful~StatefulMixin#statechanged
   * @param   {Object|Function} stateUpdates
   *          A new set of properties to shallow-merge into the plugin state.
   *          Can be a plain object or a function returning a plain object.
   *
   * @returns {Object|undefined}
   *          An object containing changes that occurred. If no changes
   *          occurred, returns `undefined`.
   */setState:function setState(stateUpdates){var _this=this;// Support providing the `stateUpdates` state as a function.
if(typeof stateUpdates==='function'){stateUpdates=stateUpdates();}var changes=void 0;each$g(stateUpdates,function(value,key){// Record the change if the value is different from what's in the
// current state.
if(_this.state[key]!==value){changes=changes||{};changes[key]={from:_this.state[key],to:value};}_this.state[key]=value;});// Only trigger "statechange" if there were changes AND we have a trigger
// function. This allows us to not require that the target object be an
// evented object.
if(changes&&isEvented(this)){/**
       * An event triggered on an object that is both
       * {@link module:stateful|stateful} and {@link module:evented|evented}
       * indicating that its state has changed.
       *
       * @event    module:stateful~StatefulMixin#statechanged
       * @type     {Object}
       * @property {Object} changes
       *           A hash containing the properties that were changed and
       *           the values they were changed `from` and `to`.
       */this.trigger({changes:changes,type:'statechanged'});}return changes;}};/**
 * Applies {@link module:stateful~StatefulMixin|StatefulMixin} to a target
 * object.
 *
 * If the target object is {@link module:evented|evented} and has a
 * `handleStateChanged` method, that method will be automatically bound to the
 * `statechanged` event on itself.
 *
 * @param   {Object} target
 *          The object to be made stateful.
 *
 * @param   {Object} [defaultState]
 *          A default set of properties to populate the newly-stateful object's
 *          `state` property.
 *
 * @returns {Object}
 *          Returns the `target`.
 */function stateful(target,defaultState){assign$1(target,StatefulMixin);// This happens after the mixing-in because we need to replace the `state`
// added in that step.
target.state=assign$1({},target.state,defaultState);// Auto-bind the `handleStateChanged` method of the target object if it exists.
if(typeof target.handleStateChanged==='function'&&isEvented(target)){target.on('statechanged',target.handleStateChanged);}return target;}/**
 * @file to-title-case.js
 * @module to-title-case
 *//**
 * Uppercase the first letter of a string.
 *
 * @param {string} string
 *        String to be uppercased
 *
 * @return {string}
 *         The string with an uppercased first letter
 */function toTitleCase(string){if(typeof string!=='string'){return string;}return string.charAt(0).toUpperCase()+string.slice(1);}/**
 * Compares the TitleCase versions of the two strings for equality.
 *
 * @param {string} str1
 *        The first string to compare
 *
 * @param {string} str2
 *        The second string to compare
 *
 * @return {boolean}
 *         Whether the TitleCase versions of the strings are equal
 */function titleCaseEquals(str1,str2){return toTitleCase(str1)===toTitleCase(str2);}/**
 * @file merge-options.js
 * @module merge-options
 *//**
 * Deep-merge one or more options objects, recursively merging **only** plain
 * object properties.
 *
 * @param   {Object[]} sources
 *          One or more objects to merge into a new object.
 *
 * @returns {Object}
 *          A new object that is the merged result of all sources.
 */function mergeOptions(){var result={};for(var _len=arguments.length,sources=Array(_len),_key=0;_key<_len;_key++){sources[_key]=arguments[_key];}sources.forEach(function(source){if(!source){return;}each$g(source,function(value,key){if(!isPlain(value)){result[key]=value;return;}if(!isPlain(result[key])){result[key]={};}result[key]=mergeOptions(result[key],value);});});return result;}/**
 * Player Component - Base class for all UI objects
 *
 * @file component.js
 *//**
 * Base class for all UI Components.
 * Components are UI objects which represent both a javascript object and an element
 * in the DOM. They can be children of other components, and can have
 * children themselves.
 *
 * Components can also use methods from {@link EventTarget}
 */var Component=function(){/**
   * A callback that is called when a component is ready. Does not have any
   * paramters and any callback value will be ignored.
   *
   * @callback Component~ReadyCallback
   * @this Component
   *//**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   *
   * @param {Object[]} [options.children]
   *        An array of children objects to intialize this component with. Children objects have
   *        a name property that will be used if more than one component of the same type needs to be
   *        added.
   *
   * @param {Component~ReadyCallback} [ready]
   *        Function that gets called when the `Component` is ready.
   */function Component(player,options,ready){classCallCheck(this,Component);// The component might be the player itself and we can't pass `this` to super
if(!player&&this.play){this.player_=player=this;// eslint-disable-line
}else {this.player_=player;}// Make a copy of prototype.options_ to protect against overriding defaults
this.options_=mergeOptions({},this.options_);// Updated options with supplied options
options=this.options_=mergeOptions(this.options_,options);// Get ID from options or options element if one is supplied
this.id_=options.id||options.el&&options.el.id;// If there was no ID from the options, generate one
if(!this.id_){// Don't require the player ID function in the case of mock players
var id=player&&player.id&&player.id()||'no_player';this.id_=id+'_component_'+newGUID();}this.name_=options.name||null;// Create element if one wasn't provided in options
if(options.el){this.el_=options.el;}else if(options.createEl!==false){this.el_=this.createEl();}// if evented is anything except false, we want to mixin in evented
if(options.evented!==false){// Make this an evented object and use `el_`, if available, as its event bus
evented(this,{eventBusKey:this.el_?'el_':null});}stateful(this,this.constructor.defaultState);this.children_=[];this.childIndex_={};this.childNameIndex_={};// Add any child components in options
if(options.initChildren!==false){this.initChildren();}this.ready(ready);// Don't want to trigger ready here or it will before init is actually
// finished for all children that run this constructor
if(options.reportTouchActivity!==false){this.enableTouchActivity();}}/**
   * Dispose of the `Component` and all child components.
   *
   * @fires Component#dispose
   */Component.prototype.dispose=function dispose(){/**
     * Triggered when a `Component` is disposed.
     *
     * @event Component#dispose
     * @type {EventTarget~Event}
     *
     * @property {boolean} [bubbles=false]
     *           set to false so that the close event does not
     *           bubble up
     */this.trigger({type:'dispose',bubbles:false});// Dispose all children.
if(this.children_){for(var i=this.children_.length-1;i>=0;i--){if(this.children_[i].dispose){this.children_[i].dispose();}}}// Delete child references
this.children_=null;this.childIndex_=null;this.childNameIndex_=null;if(this.el_){// Remove element from DOM
if(this.el_.parentNode){this.el_.parentNode.removeChild(this.el_);}removeData(this.el_);this.el_=null;}// remove reference to the player after disposing of the element
this.player_=null;};/**
   * Return the {@link Player} that the `Component` has attached to.
   *
   * @return {Player}
   *         The player that this `Component` has attached to.
   */Component.prototype.player=function player(){return this.player_;};/**
   * Deep merge of options objects with new options.
   * > Note: When both `obj` and `options` contain properties whose values are objects.
   *         The two properties get merged using {@link module:mergeOptions}
   *
   * @param {Object} obj
   *        The object that contains new options.
   *
   * @return {Object}
   *         A new object of `this.options_` and `obj` merged together.
   *
   * @deprecated since version 5
   */Component.prototype.options=function options(obj){log$2.warn('this.options() has been deprecated and will be moved to the constructor in 6.0');if(!obj){return this.options_;}this.options_=mergeOptions(this.options_,obj);return this.options_;};/**
   * Get the `Component`s DOM element
   *
   * @return {Element}
   *         The DOM element for this `Component`.
   */Component.prototype.el=function el(){return this.el_;};/**
   * Create the `Component`s DOM element.
   *
   * @param {string} [tagName]
   *        Element's DOM node type. e.g. 'div'
   *
   * @param {Object} [properties]
   *        An object of properties that should be set.
   *
   * @param {Object} [attributes]
   *        An object of attributes that should be set.
   *
   * @return {Element}
   *         The element that gets created.
   */Component.prototype.createEl=function createEl$$1(tagName,properties,attributes){return createEl$2(tagName,properties,attributes);};/**
   * Localize a string given the string in english.
   *
   * If tokens are provided, it'll try and run a simple token replacement on the provided string.
   * The tokens it looks for look like `{1}` with the index being 1-indexed into the tokens array.
   *
   * If a `defaultValue` is provided, it'll use that over `string`,
   * if a value isn't found in provided language files.
   * This is useful if you want to have a descriptive key for token replacement
   * but have a succinct localized string and not require `en.json` to be included.
   *
   * Currently, it is used for the progress bar timing.
   * ```js
   * {
   *   "progress bar timing: currentTime={1} duration={2}": "{1} of {2}"
   * }
   * ```
   * It is then used like so:
   * ```js
   * this.localize('progress bar timing: currentTime={1} duration{2}',
   *               [this.player_.currentTime(), this.player_.duration()],
   *               '{1} of {2}');
   * ```
   *
   * Which outputs something like: `01:23 of 24:56`.
   *
   *
   * @param {string} string
   *        The string to localize and the key to lookup in the language files.
   * @param {string[]} [tokens]
   *        If the current item has token replacements, provide the tokens here.
   * @param {string} [defaultValue]
   *        Defaults to `string`. Can be a default value to use for token replacement
   *        if the lookup key is needed to be separate.
   *
   * @return {string}
   *         The localized string or if no localization exists the english string.
   */Component.prototype.localize=function localize(string,tokens){var defaultValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:string;var code=this.player_.language&&this.player_.language();var languages=this.player_.languages&&this.player_.languages();var language=languages&&languages[code];var primaryCode=code&&code.split('-')[0];var primaryLang=languages&&languages[primaryCode];var localizedString=defaultValue;if(language&&language[string]){localizedString=language[string];}else if(primaryLang&&primaryLang[string]){localizedString=primaryLang[string];}if(tokens){localizedString=localizedString.replace(/\{(\d+)\}/g,function(match,index){var value=tokens[index-1];var ret=value;if(typeof value==='undefined'){ret=match;}return ret;});}return localizedString;};/**
   * Return the `Component`s DOM element. This is where children get inserted.
   * This will usually be the the same as the element returned in {@link Component#el}.
   *
   * @return {Element}
   *         The content element for this `Component`.
   */Component.prototype.contentEl=function contentEl(){return this.contentEl_||this.el_;};/**
   * Get this `Component`s ID
   *
   * @return {string}
   *         The id of this `Component`
   */Component.prototype.id=function id(){return this.id_;};/**
   * Get the `Component`s name. The name gets used to reference the `Component`
   * and is set during registration.
   *
   * @return {string}
   *         The name of this `Component`.
   */Component.prototype.name=function name(){return this.name_;};/**
   * Get an array of all child components
   *
   * @return {Array}
   *         The children
   */Component.prototype.children=function children(){return this.children_;};/**
   * Returns the child `Component` with the given `id`.
   *
   * @param {string} id
   *        The id of the child `Component` to get.
   *
   * @return {Component|undefined}
   *         The child `Component` with the given `id` or undefined.
   */Component.prototype.getChildById=function getChildById(id){return this.childIndex_[id];};/**
   * Returns the child `Component` with the given `name`.
   *
   * @param {string} name
   *        The name of the child `Component` to get.
   *
   * @return {Component|undefined}
   *         The child `Component` with the given `name` or undefined.
   */Component.prototype.getChild=function getChild(name){if(!name){return;}name=toTitleCase(name);return this.childNameIndex_[name];};/**
   * Add a child `Component` inside the current `Component`.
   *
   *
   * @param {string|Component} child
   *        The name or instance of a child to add.
   *
   * @param {Object} [options={}]
   *        The key/value store of options that will get passed to children of
   *        the child.
   *
   * @param {number} [index=this.children_.length]
   *        The index to attempt to add a child into.
   *
   * @return {Component}
   *         The `Component` that gets added as a child. When using a string the
   *         `Component` will get created by this process.
   */Component.prototype.addChild=function addChild(child){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var index=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.children_.length;var component=void 0;var componentName=void 0;// If child is a string, create component with options
if(typeof child==='string'){componentName=toTitleCase(child);var componentClassName=options.componentClass||componentName;// Set name through options
options.name=componentName;// Create a new object & element for this controls set
// If there's no .player_, this is a player
var ComponentClass=Component.getComponent(componentClassName);if(!ComponentClass){throw new Error('Component '+componentClassName+' does not exist');}// data stored directly on the videojs object may be
// misidentified as a component to retain
// backwards-compatibility with 4.x. check to make sure the
// component class can be instantiated.
if(typeof ComponentClass!=='function'){return null;}component=new ComponentClass(this.player_||this,options);// child is a component instance
}else {component=child;}this.children_.splice(index,0,component);if(typeof component.id==='function'){this.childIndex_[component.id()]=component;}// If a name wasn't used to create the component, check if we can use the
// name function of the component
componentName=componentName||component.name&&toTitleCase(component.name());if(componentName){this.childNameIndex_[componentName]=component;}// Add the UI object's element to the container div (box)
// Having an element is not required
if(typeof component.el==='function'&&component.el()){var childNodes=this.contentEl().children;var refNode=childNodes[index]||null;this.contentEl().insertBefore(component.el(),refNode);}// Return so it can stored on parent object if desired.
return component;};/**
   * Remove a child `Component` from this `Component`s list of children. Also removes
   * the child `Component`s element from this `Component`s element.
   *
   * @param {Component} component
   *        The child `Component` to remove.
   */Component.prototype.removeChild=function removeChild(component){if(typeof component==='string'){component=this.getChild(component);}if(!component||!this.children_){return;}var childFound=false;for(var i=this.children_.length-1;i>=0;i--){if(this.children_[i]===component){childFound=true;this.children_.splice(i,1);break;}}if(!childFound){return;}this.childIndex_[component.id()]=null;this.childNameIndex_[component.name()]=null;var compEl=component.el();if(compEl&&compEl.parentNode===this.contentEl()){this.contentEl().removeChild(component.el());}};/**
   * Add and initialize default child `Component`s based upon options.
   */Component.prototype.initChildren=function initChildren(){var _this=this;var children=this.options_.children;if(children){// `this` is `parent`
var parentOptions=this.options_;var handleAdd=function handleAdd(child){var name=child.name;var opts=child.opts;// Allow options for children to be set at the parent options
// e.g. videojs(id, { controlBar: false });
// instead of videojs(id, { children: { controlBar: false });
if(parentOptions[name]!==undefined){opts=parentOptions[name];}// Allow for disabling default components
// e.g. options['children']['posterImage'] = false
if(opts===false){return;}// Allow options to be passed as a simple boolean if no configuration
// is necessary.
if(opts===true){opts={};}// We also want to pass the original player options
// to each component as well so they don't need to
// reach back into the player for options later.
opts.playerOptions=_this.options_.playerOptions;// Create and add the child component.
// Add a direct reference to the child by name on the parent instance.
// If two of the same component are used, different names should be supplied
// for each
var newChild=_this.addChild(name,opts);if(newChild){_this[name]=newChild;}};// Allow for an array of children details to passed in the options
var workingChildren=void 0;var Tech=Component.getComponent('Tech');if(Array.isArray(children)){workingChildren=children;}else {workingChildren=Object.keys(children);}workingChildren// children that are in this.options_ but also in workingChildren  would
// give us extra children we do not want. So, we want to filter them out.
.concat(Object.keys(this.options_).filter(function(child){return !workingChildren.some(function(wchild){if(typeof wchild==='string'){return child===wchild;}return child===wchild.name;});})).map(function(child){var name=void 0;var opts=void 0;if(typeof child==='string'){name=child;opts=children[name]||_this.options_[name]||{};}else {name=child.name;opts=child;}return {name:name,opts:opts};}).filter(function(child){// we have to make sure that child.name isn't in the techOrder since
// techs are registerd as Components but can't aren't compatible
// See https://github.com/videojs/video.js/issues/2772
var c=Component.getComponent(child.opts.componentClass||toTitleCase(child.name));return c&&!Tech.isTech(c);}).forEach(handleAdd);}};/**
   * Builds the default DOM class name. Should be overriden by sub-components.
   *
   * @return {string}
   *         The DOM class name for this object.
   *
   * @abstract
   */Component.prototype.buildCSSClass=function buildCSSClass(){// Child classes can include a function that does:
// return 'CLASS NAME' + this._super();
return '';};/**
   * Bind a listener to the component's ready state.
   * Different from event listeners in that if the ready event has already happened
   * it will trigger the function immediately.
   *
   * @return {Component}
   *         Returns itself; method can be chained.
   */Component.prototype.ready=function ready(fn){var sync=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(!fn){return;}if(!this.isReady_){this.readyQueue_=this.readyQueue_||[];this.readyQueue_.push(fn);return;}if(sync){fn.call(this);}else {// Call the function asynchronously by default for consistency
this.setTimeout(fn,1);}};/**
   * Trigger all the ready listeners for this `Component`.
   *
   * @fires Component#ready
   */Component.prototype.triggerReady=function triggerReady(){this.isReady_=true;// Ensure ready is triggered asynchronously
this.setTimeout(function(){var readyQueue=this.readyQueue_;// Reset Ready Queue
this.readyQueue_=[];if(readyQueue&&readyQueue.length>0){readyQueue.forEach(function(fn){fn.call(this);},this);}// Allow for using event listeners also
/**
       * Triggered when a `Component` is ready.
       *
       * @event Component#ready
       * @type {EventTarget~Event}
       */this.trigger('ready');},1);};/**
   * Find a single DOM element matching a `selector`. This can be within the `Component`s
   * `contentEl()` or another custom context.
   *
   * @param {string} selector
   *        A valid CSS selector, which will be passed to `querySelector`.
   *
   * @param {Element|string} [context=this.contentEl()]
   *        A DOM element within which to query. Can also be a selector string in
   *        which case the first matching element will get used as context. If
   *        missing `this.contentEl()` gets used. If  `this.contentEl()` returns
   *        nothing it falls back to `document`.
   *
   * @return {Element|null}
   *         the dom element that was found, or null
   *
   * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)
   */Component.prototype.$=function $$$1(selector,context){return $$1(selector,context||this.contentEl());};/**
   * Finds all DOM element matching a `selector`. This can be within the `Component`s
   * `contentEl()` or another custom context.
   *
   * @param {string} selector
   *        A valid CSS selector, which will be passed to `querySelectorAll`.
   *
   * @param {Element|string} [context=this.contentEl()]
   *        A DOM element within which to query. Can also be a selector string in
   *        which case the first matching element will get used as context. If
   *        missing `this.contentEl()` gets used. If  `this.contentEl()` returns
   *        nothing it falls back to `document`.
   *
   * @return {NodeList}
   *         a list of dom elements that were found
   *
   * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)
   */Component.prototype.$$=function $$$$1(selector,context){return $$(selector,context||this.contentEl());};/**
   * Check if a component's element has a CSS class name.
   *
   * @param {string} classToCheck
   *        CSS class name to check.
   *
   * @return {boolean}
   *         - True if the `Component` has the class.
   *         - False if the `Component` does not have the class`
   */Component.prototype.hasClass=function hasClass$$1(classToCheck){return hasClass(this.el_,classToCheck);};/**
   * Add a CSS class name to the `Component`s element.
   *
   * @param {string} classToAdd
   *        CSS class name to add
   */Component.prototype.addClass=function addClass$$1(classToAdd){addClass(this.el_,classToAdd);};/**
   * Remove a CSS class name from the `Component`s element.
   *
   * @param {string} classToRemove
   *        CSS class name to remove
   */Component.prototype.removeClass=function removeClass$$1(classToRemove){removeClass(this.el_,classToRemove);};/**
   * Add or remove a CSS class name from the component's element.
   * - `classToToggle` gets added when {@link Component#hasClass} would return false.
   * - `classToToggle` gets removed when {@link Component#hasClass} would return true.
   *
   * @param  {string} classToToggle
   *         The class to add or remove based on (@link Component#hasClass}
   *
   * @param  {boolean|Dom~predicate} [predicate]
   *         An {@link Dom~predicate} function or a boolean
   */Component.prototype.toggleClass=function toggleClass$$1(classToToggle,predicate){toggleClass(this.el_,classToToggle,predicate);};/**
   * Show the `Component`s element if it is hidden by removing the
   * 'vjs-hidden' class name from it.
   */Component.prototype.show=function show(){this.removeClass('vjs-hidden');};/**
   * Hide the `Component`s element if it is currently showing by adding the
   * 'vjs-hidden` class name to it.
   */Component.prototype.hide=function hide(){this.addClass('vjs-hidden');};/**
   * Lock a `Component`s element in its visible state by adding the 'vjs-lock-showing'
   * class name to it. Used during fadeIn/fadeOut.
   *
   * @private
   */Component.prototype.lockShowing=function lockShowing(){this.addClass('vjs-lock-showing');};/**
   * Unlock a `Component`s element from its visible state by removing the 'vjs-lock-showing'
   * class name from it. Used during fadeIn/fadeOut.
   *
   * @private
   */Component.prototype.unlockShowing=function unlockShowing(){this.removeClass('vjs-lock-showing');};/**
   * Get the value of an attribute on the `Component`s element.
   *
   * @param {string} attribute
   *        Name of the attribute to get the value from.
   *
   * @return {string|null}
   *         - The value of the attribute that was asked for.
   *         - Can be an empty string on some browsers if the attribute does not exist
   *           or has no value
   *         - Most browsers will return null if the attibute does not exist or has
   *           no value.
   *
   * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute}
   */Component.prototype.getAttribute=function getAttribute$$1(attribute){return getAttribute$1(this.el_,attribute);};/**
   * Set the value of an attribute on the `Component`'s element
   *
   * @param {string} attribute
   *        Name of the attribute to set.
   *
   * @param {string} value
   *        Value to set the attribute to.
   *
   * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute}
   */Component.prototype.setAttribute=function setAttribute$$1(attribute,value){setAttribute$1(this.el_,attribute,value);};/**
   * Remove an attribute from the `Component`s element.
   *
   * @param {string} attribute
   *        Name of the attribute to remove.
   *
   * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute}
   */Component.prototype.removeAttribute=function removeAttribute$$1(attribute){removeAttribute(this.el_,attribute);};/**
   * Get or set the width of the component based upon the CSS styles.
   * See {@link Component#dimension} for more detailed information.
   *
   * @param {number|string} [num]
   *        The width that you want to set postfixed with '%', 'px' or nothing.
   *
   * @param {boolean} [skipListeners]
   *        Skip the componentresize event trigger
   *
   * @return {number|string}
   *         The width when getting, zero if there is no width. Can be a string
   *           postpixed with '%' or 'px'.
   */Component.prototype.width=function width(num,skipListeners){return this.dimension('width',num,skipListeners);};/**
   * Get or set the height of the component based upon the CSS styles.
   * See {@link Component#dimension} for more detailed information.
   *
   * @param {number|string} [num]
   *        The height that you want to set postfixed with '%', 'px' or nothing.
   *
   * @param {boolean} [skipListeners]
   *        Skip the componentresize event trigger
   *
   * @return {number|string}
   *         The width when getting, zero if there is no width. Can be a string
   *         postpixed with '%' or 'px'.
   */Component.prototype.height=function height(num,skipListeners){return this.dimension('height',num,skipListeners);};/**
   * Set both the width and height of the `Component` element at the same time.
   *
   * @param  {number|string} width
   *         Width to set the `Component`s element to.
   *
   * @param  {number|string} height
   *         Height to set the `Component`s element to.
   */Component.prototype.dimensions=function dimensions(width,height){// Skip componentresize listeners on width for optimization
this.width(width,true);this.height(height);};/**
   * Get or set width or height of the `Component` element. This is the shared code
   * for the {@link Component#width} and {@link Component#height}.
   *
   * Things to know:
   * - If the width or height in an number this will return the number postfixed with 'px'.
   * - If the width/height is a percent this will return the percent postfixed with '%'
   * - Hidden elements have a width of 0 with `window.getComputedStyle`. This function
   *   defaults to the `Component`s `style.width` and falls back to `window.getComputedStyle`.
   *   See [this]{@link http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/}
   *   for more information
   * - If you want the computed style of the component, use {@link Component#currentWidth}
   *   and {@link {Component#currentHeight}
   *
   * @fires Component#componentresize
   *
   * @param {string} widthOrHeight
   8        'width' or 'height'
   *
   * @param  {number|string} [num]
   8         New dimension
   *
   * @param  {boolean} [skipListeners]
   *         Skip componentresize event trigger
   *
   * @return {number}
   *         The dimension when getting or 0 if unset
   */Component.prototype.dimension=function dimension(widthOrHeight,num,skipListeners){if(num!==undefined){// Set to zero if null or literally NaN (NaN !== NaN)
if(num===null||num!==num){num=0;}// Check if using css width/height (% or px) and adjust
if((''+num).indexOf('%')!==-1||(''+num).indexOf('px')!==-1){this.el_.style[widthOrHeight]=num;}else if(num==='auto'){this.el_.style[widthOrHeight]='';}else {this.el_.style[widthOrHeight]=num+'px';}// skipListeners allows us to avoid triggering the resize event when setting both width and height
if(!skipListeners){/**
         * Triggered when a component is resized.
         *
         * @event Component#componentresize
         * @type {EventTarget~Event}
         */this.trigger('componentresize');}return;}// Not setting a value, so getting it
// Make sure element exists
if(!this.el_){return 0;}// Get dimension value from style
var val=this.el_.style[widthOrHeight];var pxIndex=val.indexOf('px');if(pxIndex!==-1){// Return the pixel value with no 'px'
return parseInt(val.slice(0,pxIndex),10);}// No px so using % or no style was set, so falling back to offsetWidth/height
// If component has display:none, offset will return 0
// TODO: handle display:none and no dimension style using px
return parseInt(this.el_['offset'+toTitleCase(widthOrHeight)],10);};/**
   * Get the computed width or the height of the component's element.
   *
   * Uses `window.getComputedStyle`.
   *
   * @param {string} widthOrHeight
   *        A string containing 'width' or 'height'. Whichever one you want to get.
   *
   * @return {number}
   *         The dimension that gets asked for or 0 if nothing was set
   *         for that dimension.
   */Component.prototype.currentDimension=function currentDimension(widthOrHeight){var computedWidthOrHeight=0;if(widthOrHeight!=='width'&&widthOrHeight!=='height'){throw new Error('currentDimension only accepts width or height value');}if(typeof window$1.getComputedStyle==='function'){var computedStyle=window$1.getComputedStyle(this.el_);computedWidthOrHeight=computedStyle.getPropertyValue(widthOrHeight)||computedStyle[widthOrHeight];}// remove 'px' from variable and parse as integer
computedWidthOrHeight=parseFloat(computedWidthOrHeight);// if the computed value is still 0, it's possible that the browser is lying
// and we want to check the offset values.
// This code also runs on IE8 and wherever getComputedStyle doesn't exist.
if(computedWidthOrHeight===0){var rule='offset'+toTitleCase(widthOrHeight);computedWidthOrHeight=this.el_[rule];}return computedWidthOrHeight;};/**
   * An object that contains width and height values of the `Component`s
   * computed style. Uses `window.getComputedStyle`.
   *
   * @typedef {Object} Component~DimensionObject
   *
   * @property {number} width
   *           The width of the `Component`s computed style.
   *
   * @property {number} height
   *           The height of the `Component`s computed style.
   *//**
   * Get an object that contains computed width and height values of the
   * component's element.
   *
   * Uses `window.getComputedStyle`.
   *
   * @return {Component~DimensionObject}
   *         The computed dimensions of the component's element.
   */Component.prototype.currentDimensions=function currentDimensions(){return {width:this.currentDimension('width'),height:this.currentDimension('height')};};/**
   * Get the computed width of the component's element.
   *
   * Uses `window.getComputedStyle`.
   *
   * @return {number}
   *         The computed width of the component's element.
   */Component.prototype.currentWidth=function currentWidth(){return this.currentDimension('width');};/**
   * Get the computed height of the component's element.
   *
   * Uses `window.getComputedStyle`.
   *
   * @return {number}
   *         The computed height of the component's element.
   */Component.prototype.currentHeight=function currentHeight(){return this.currentDimension('height');};/**
   * Set the focus to this component
   */Component.prototype.focus=function focus(){this.el_.focus();};/**
   * Remove the focus from this component
   */Component.prototype.blur=function blur(){this.el_.blur();};/**
   * Emit a 'tap' events when touch event support gets detected. This gets used to
   * support toggling the controls through a tap on the video. They get enabled
   * because every sub-component would have extra overhead otherwise.
   *
   * @private
   * @fires Component#tap
   * @listens Component#touchstart
   * @listens Component#touchmove
   * @listens Component#touchleave
   * @listens Component#touchcancel
   * @listens Component#touchend
    */Component.prototype.emitTapEvents=function emitTapEvents(){// Track the start time so we can determine how long the touch lasted
var touchStart=0;var firstTouch=null;// Maximum movement allowed during a touch event to still be considered a tap
// Other popular libs use anywhere from 2 (hammer.js) to 15,
// so 10 seems like a nice, round number.
var tapMovementThreshold=10;// The maximum length a touch can be while still being considered a tap
var touchTimeThreshold=200;var couldBeTap=void 0;this.on('touchstart',function(event){// If more than one finger, don't consider treating this as a click
if(event.touches.length===1){// Copy pageX/pageY from the object
firstTouch={pageX:event.touches[0].pageX,pageY:event.touches[0].pageY};// Record start time so we can detect a tap vs. "touch and hold"
touchStart=new Date().getTime();// Reset couldBeTap tracking
couldBeTap=true;}});this.on('touchmove',function(event){// If more than one finger, don't consider treating this as a click
if(event.touches.length>1){couldBeTap=false;}else if(firstTouch){// Some devices will throw touchmoves for all but the slightest of taps.
// So, if we moved only a small distance, this could still be a tap
var xdiff=event.touches[0].pageX-firstTouch.pageX;var ydiff=event.touches[0].pageY-firstTouch.pageY;var touchDistance=Math.sqrt(xdiff*xdiff+ydiff*ydiff);if(touchDistance>tapMovementThreshold){couldBeTap=false;}}});var noTap=function noTap(){couldBeTap=false;};// TODO: Listen to the original target. http://youtu.be/DujfpXOKUp8?t=13m8s
this.on('touchleave',noTap);this.on('touchcancel',noTap);// When the touch ends, measure how long it took and trigger the appropriate
// event
this.on('touchend',function(event){firstTouch=null;// Proceed only if the touchmove/leave/cancel event didn't happen
if(couldBeTap===true){// Measure how long the touch lasted
var touchTime=new Date().getTime()-touchStart;// Make sure the touch was less than the threshold to be considered a tap
if(touchTime<touchTimeThreshold){// Don't let browser turn this into a click
event.preventDefault();/**
           * Triggered when a `Component` is tapped.
           *
           * @event Component#tap
           * @type {EventTarget~Event}
           */this.trigger('tap');// It may be good to copy the touchend event object and change the
// type to tap, if the other event properties aren't exact after
// Events.fixEvent runs (e.g. event.target)
}}});};/**
   * This function reports user activity whenever touch events happen. This can get
   * turned off by any sub-components that wants touch events to act another way.
   *
   * Report user touch activity when touch events occur. User activity gets used to
   * determine when controls should show/hide. It is simple when it comes to mouse
   * events, because any mouse event should show the controls. So we capture mouse
   * events that bubble up to the player and report activity when that happens.
   * With touch events it isn't as easy as `touchstart` and `touchend` toggle player
   * controls. So touch events can't help us at the player level either.
   *
   * User activity gets checked asynchronously. So what could happen is a tap event
   * on the video turns the controls off. Then the `touchend` event bubbles up to
   * the player. Which, if it reported user activity, would turn the controls right
   * back on. We also don't want to completely block touch events from bubbling up.
   * Furthermore a `touchmove` event and anything other than a tap, should not turn
   * controls back on.
   *
   * @listens Component#touchstart
   * @listens Component#touchmove
   * @listens Component#touchend
   * @listens Component#touchcancel
   */Component.prototype.enableTouchActivity=function enableTouchActivity(){// Don't continue if the root player doesn't support reporting user activity
if(!this.player()||!this.player().reportUserActivity){return;}// listener for reporting that the user is active
var report=bind$2(this.player(),this.player().reportUserActivity);var touchHolding=void 0;this.on('touchstart',function(){report();// For as long as the they are touching the device or have their mouse down,
// we consider them active even if they're not moving their finger or mouse.
// So we want to continue to update that they are active
this.clearInterval(touchHolding);// report at the same interval as activityCheck
touchHolding=this.setInterval(report,250);});var touchEnd=function touchEnd(event){report();// stop the interval that maintains activity if the touch is holding
this.clearInterval(touchHolding);};this.on('touchmove',report);this.on('touchend',touchEnd);this.on('touchcancel',touchEnd);};/**
   * A callback that has no parameters and is bound into `Component`s context.
   *
   * @callback Component~GenericCallback
   * @this Component
   *//**
   * Creates a function that runs after an `x` millisecond timeout. This function is a
   * wrapper around `window.setTimeout`. There are a few reasons to use this one
   * instead though:
   * 1. It gets cleared via  {@link Component#clearTimeout} when
   *    {@link Component#dispose} gets called.
   * 2. The function callback will gets turned into a {@link Component~GenericCallback}
   *
   * > Note: You can't use `window.clearTimeout` on the id returned by this function. This
   *         will cause its dispose listener not to get cleaned up! Please use
   *         {@link Component#clearTimeout} or {@link Component#dispose} instead.
   *
   * @param {Component~GenericCallback} fn
   *        The function that will be run after `timeout`.
   *
   * @param {number} timeout
   *        Timeout in milliseconds to delay before executing the specified function.
   *
   * @return {number}
   *         Returns a timeout ID that gets used to identify the timeout. It can also
   *         get used in {@link Component#clearTimeout} to clear the timeout that
   *         was set.
   *
   * @listens Component#dispose
   * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout}
   */Component.prototype.setTimeout=function setTimeout(fn,timeout){var _this2=this;// declare as variables so they are properly available in timeout function
// eslint-disable-next-line
var timeoutId,disposeFn;fn=bind$2(this,fn);timeoutId=window$1.setTimeout(function(){_this2.off('dispose',disposeFn);fn();},timeout);disposeFn=function disposeFn(){return _this2.clearTimeout(timeoutId);};disposeFn.guid='vjs-timeout-'+timeoutId;this.on('dispose',disposeFn);return timeoutId;};/**
   * Clears a timeout that gets created via `window.setTimeout` or
   * {@link Component#setTimeout}. If you set a timeout via {@link Component#setTimeout}
   * use this function instead of `window.clearTimout`. If you don't your dispose
   * listener will not get cleaned up until {@link Component#dispose}!
   *
   * @param {number} timeoutId
   *        The id of the timeout to clear. The return value of
   *        {@link Component#setTimeout} or `window.setTimeout`.
   *
   * @return {number}
   *         Returns the timeout id that was cleared.
   *
   * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearTimeout}
   */Component.prototype.clearTimeout=function clearTimeout(timeoutId){window$1.clearTimeout(timeoutId);var disposeFn=function disposeFn(){};disposeFn.guid='vjs-timeout-'+timeoutId;this.off('dispose',disposeFn);return timeoutId;};/**
   * Creates a function that gets run every `x` milliseconds. This function is a wrapper
   * around `window.setInterval`. There are a few reasons to use this one instead though.
   * 1. It gets cleared via  {@link Component#clearInterval} when
   *    {@link Component#dispose} gets called.
   * 2. The function callback will be a {@link Component~GenericCallback}
   *
   * @param {Component~GenericCallback} fn
   *        The function to run every `x` seconds.
   *
   * @param {number} interval
   *        Execute the specified function every `x` milliseconds.
   *
   * @return {number}
   *         Returns an id that can be used to identify the interval. It can also be be used in
   *         {@link Component#clearInterval} to clear the interval.
   *
   * @listens Component#dispose
   * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval}
   */Component.prototype.setInterval=function setInterval(fn,interval){var _this3=this;fn=bind$2(this,fn);var intervalId=window$1.setInterval(fn,interval);var disposeFn=function disposeFn(){return _this3.clearInterval(intervalId);};disposeFn.guid='vjs-interval-'+intervalId;this.on('dispose',disposeFn);return intervalId;};/**
   * Clears an interval that gets created via `window.setInterval` or
   * {@link Component#setInterval}. If you set an inteval via {@link Component#setInterval}
   * use this function instead of `window.clearInterval`. If you don't your dispose
   * listener will not get cleaned up until {@link Component#dispose}!
   *
   * @param {number} intervalId
   *        The id of the interval to clear. The return value of
   *        {@link Component#setInterval} or `window.setInterval`.
   *
   * @return {number}
   *         Returns the interval id that was cleared.
   *
   * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearInterval}
   */Component.prototype.clearInterval=function clearInterval(intervalId){window$1.clearInterval(intervalId);var disposeFn=function disposeFn(){};disposeFn.guid='vjs-interval-'+intervalId;this.off('dispose',disposeFn);return intervalId;};/**
   * Queues up a callback to be passed to requestAnimationFrame (rAF), but
   * with a few extra bonuses:
   *
   * - Supports browsers that do not support rAF by falling back to
   *   {@link Component#setTimeout}.
   *
   * - The callback is turned into a {@link Component~GenericCallback} (i.e.
   *   bound to the component).
   *
   * - Automatic cancellation of the rAF callback is handled if the component
   *   is disposed before it is called.
   *
   * @param  {Component~GenericCallback} fn
   *         A function that will be bound to this component and executed just
   *         before the browser's next repaint.
   *
   * @return {number}
   *         Returns an rAF ID that gets used to identify the timeout. It can
   *         also be used in {@link Component#cancelAnimationFrame} to cancel
   *         the animation frame callback.
   *
   * @listens Component#dispose
   * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame}
   */Component.prototype.requestAnimationFrame=function requestAnimationFrame(fn){var _this4=this;// declare as variables so they are properly available in rAF function
// eslint-disable-next-line
var id,disposeFn;if(this.supportsRaf_){fn=bind$2(this,fn);id=window$1.requestAnimationFrame(function(){_this4.off('dispose',disposeFn);fn();});disposeFn=function disposeFn(){return _this4.cancelAnimationFrame(id);};disposeFn.guid='vjs-raf-'+id;this.on('dispose',disposeFn);return id;}// Fall back to using a timer.
return this.setTimeout(fn,1000/60);};/**
   * Cancels a queued callback passed to {@link Component#requestAnimationFrame}
   * (rAF).
   *
   * If you queue an rAF callback via {@link Component#requestAnimationFrame},
   * use this function instead of `window.cancelAnimationFrame`. If you don't,
   * your dispose listener will not get cleaned up until {@link Component#dispose}!
   *
   * @param {number} id
   *        The rAF ID to clear. The return value of {@link Component#requestAnimationFrame}.
   *
   * @return {number}
   *         Returns the rAF ID that was cleared.
   *
   * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/cancelAnimationFrame}
   */Component.prototype.cancelAnimationFrame=function cancelAnimationFrame(id){if(this.supportsRaf_){window$1.cancelAnimationFrame(id);var disposeFn=function disposeFn(){};disposeFn.guid='vjs-raf-'+id;this.off('dispose',disposeFn);return id;}// Fall back to using a timer.
return this.clearTimeout(id);};/**
   * Register a `Component` with `videojs` given the name and the component.
   *
   * > NOTE: {@link Tech}s should not be registered as a `Component`. {@link Tech}s
   *         should be registered using {@link Tech.registerTech} or
   *         {@link videojs:videojs.registerTech}.
   *
   * > NOTE: This function can also be seen on videojs as
   *         {@link videojs:videojs.registerComponent}.
   *
   * @param {string} name
   *        The name of the `Component` to register.
   *
   * @param {Component} ComponentToRegister
   *        The `Component` class to register.
   *
   * @return {Component}
   *         The `Component` that was registered.
   */Component.registerComponent=function registerComponent(name,ComponentToRegister){if(typeof name!=='string'||!name){throw new Error('Illegal component name, "'+name+'"; must be a non-empty string.');}var Tech=Component.getComponent('Tech');// We need to make sure this check is only done if Tech has been registered.
var isTech=Tech&&Tech.isTech(ComponentToRegister);var isComp=Component===ComponentToRegister||Component.prototype.isPrototypeOf(ComponentToRegister.prototype);if(isTech||!isComp){var reason=void 0;if(isTech){reason='techs must be registered using Tech.registerTech()';}else {reason='must be a Component subclass';}throw new Error('Illegal component, "'+name+'"; '+reason+'.');}name=toTitleCase(name);if(!Component.components_){Component.components_={};}var Player=Component.getComponent('Player');if(name==='Player'&&Player&&Player.players){var players=Player.players;var playerNames=Object.keys(players);// If we have players that were disposed, then their name will still be
// in Players.players. So, we must loop through and verify that the value
// for each item is not null. This allows registration of the Player component
// after all players have been disposed or before any were created.
if(players&&playerNames.length>0&&playerNames.map(function(pname){return players[pname];}).every(Boolean)){throw new Error('Can not register Player component after player has been created.');}}Component.components_[name]=ComponentToRegister;return ComponentToRegister;};/**
   * Get a `Component` based on the name it was registered with.
   *
   * @param {string} name
   *        The Name of the component to get.
   *
   * @return {Component}
   *         The `Component` that got registered under the given name.
   *
   * @deprecated In `videojs` 6 this will not return `Component`s that were not
   *             registered using {@link Component.registerComponent}. Currently we
   *             check the global `videojs` object for a `Component` name and
   *             return that if it exists.
   */Component.getComponent=function getComponent(name){if(!name){return;}name=toTitleCase(name);if(Component.components_&&Component.components_[name]){return Component.components_[name];}};return Component;}();/**
 * Whether or not this component supports `requestAnimationFrame`.
 *
 * This is exposed primarily for testing purposes.
 *
 * @private
 * @type {Boolean}
 */Component.prototype.supportsRaf_=typeof window$1.requestAnimationFrame==='function'&&typeof window$1.cancelAnimationFrame==='function';Component.registerComponent('Component',Component);/**
 * @file time-ranges.js
 * @module time-ranges
 *//**
 * Returns the time for the specified index at the start or end
 * of a TimeRange object.
 *
 * @function time-ranges:indexFunction
 *
 * @param {number} [index=0]
 *        The range number to return the time for.
 *
 * @return {number}
 *         The time that offset at the specified index.
 *
 * @depricated index must be set to a value, in the future this will throw an error.
 *//**
 * An object that contains ranges of time for various reasons.
 *
 * @typedef {Object} TimeRange
 *
 * @property {number} length
 *           The number of time ranges represented by this Object
 *
 * @property {time-ranges:indexFunction} start
 *           Returns the time offset at which a specified time range begins.
 *
 * @property {time-ranges:indexFunction} end
 *           Returns the time offset at which a specified time range ends.
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges
 *//**
 * Check if any of the time ranges are over the maximum index.
 *
 * @param {string} fnName
 *        The function name to use for logging
 *
 * @param {number} index
 *        The index to check
 *
 * @param {number} maxIndex
 *        The maximum possible index
 *
 * @throws {Error} if the timeRanges provided are over the maxIndex
 */function rangeCheck(fnName,index,maxIndex){if(typeof index!=='number'||index<0||index>maxIndex){throw new Error('Failed to execute \''+fnName+'\' on \'TimeRanges\': The index provided ('+index+') is non-numeric or out of bounds (0-'+maxIndex+').');}}/**
 * Get the time for the specified index at the start or end
 * of a TimeRange object.
 *
 * @param {string} fnName
 *        The function name to use for logging
 *
 * @param {string} valueIndex
 *        The proprety that should be used to get the time. should be 'start' or 'end'
 *
 * @param {Array} ranges
 *        An array of time ranges
 *
 * @param {Array} [rangeIndex=0]
 *        The index to start the search at
 *
 * @return {number}
 *         The time that offset at the specified index.
 *
 *
 * @depricated rangeIndex must be set to a value, in the future this will throw an error.
 * @throws {Error} if rangeIndex is more than the length of ranges
 */function getRange(fnName,valueIndex,ranges,rangeIndex){rangeCheck(fnName,rangeIndex,ranges.length-1);return ranges[rangeIndex][valueIndex];}/**
 * Create a time range object given ranges of time.
 *
 * @param {Array} [ranges]
 *        An array of time ranges.
 */function createTimeRangesObj(ranges){if(ranges===undefined||ranges.length===0){return {length:0,start:function start(){throw new Error('This TimeRanges object is empty');},end:function end(){throw new Error('This TimeRanges object is empty');}};}return {length:ranges.length,start:getRange.bind(null,'start',0,ranges),end:getRange.bind(null,'end',1,ranges)};}/**
 * Should create a fake `TimeRange` object which mimics an HTML5 time range instance.
 *
 * @param {number|Array} start
 *        The start of a single range or an array of ranges
 *
 * @param {number} end
 *        The end of a single range.
 *
 * @private
 */function createTimeRanges(start,end){if(Array.isArray(start)){return createTimeRangesObj(start);}else if(start===undefined||end===undefined){return createTimeRangesObj();}return createTimeRangesObj([[start,end]]);}/**
 * @file buffer.js
 * @module buffer
 *//**
 * Compute the percentage of the media that has been buffered.
 *
 * @param {TimeRange} buffered
 *        The current `TimeRange` object representing buffered time ranges
 *
 * @param {number} duration
 *        Total duration of the media
 *
 * @return {number}
 *         Percent buffered of the total duration in decimal form.
 */function bufferedPercent(buffered,duration){var bufferedDuration=0;var start=void 0;var end=void 0;if(!duration){return 0;}if(!buffered||!buffered.length){buffered=createTimeRanges(0,0);}for(var i=0;i<buffered.length;i++){start=buffered.start(i);end=buffered.end(i);// buffered end can be bigger than duration by a very small fraction
if(end>duration){end=duration;}bufferedDuration+=end-start;}return bufferedDuration/duration;}/**
 * @file fullscreen-api.js
 * @module fullscreen-api
 * @private
 *//**
 * Store the browser-specific methods for the fullscreen API.
 *
 * @type {Object}
 * @see [Specification]{@link https://fullscreen.spec.whatwg.org}
 * @see [Map Approach From Screenfull.js]{@link https://github.com/sindresorhus/screenfull.js}
 */var FullscreenApi={};// browser API methods
var apiMap=[['requestFullscreen','exitFullscreen','fullscreenElement','fullscreenEnabled','fullscreenchange','fullscreenerror'],// WebKit
['webkitRequestFullscreen','webkitExitFullscreen','webkitFullscreenElement','webkitFullscreenEnabled','webkitfullscreenchange','webkitfullscreenerror'],// Old WebKit (Safari 5.1)
['webkitRequestFullScreen','webkitCancelFullScreen','webkitCurrentFullScreenElement','webkitCancelFullScreen','webkitfullscreenchange','webkitfullscreenerror'],// Mozilla
['mozRequestFullScreen','mozCancelFullScreen','mozFullScreenElement','mozFullScreenEnabled','mozfullscreenchange','mozfullscreenerror'],// Microsoft
['msRequestFullscreen','msExitFullscreen','msFullscreenElement','msFullscreenEnabled','MSFullscreenChange','MSFullscreenError']];var specApi=apiMap[0];var browserApi=void 0;// determine the supported set of functions
for(var i$5=0;i$5<apiMap.length;i$5++){// check for exitFullscreen function
if(apiMap[i$5][1]in document$1){browserApi=apiMap[i$5];break;}}// map the browser API names to the spec API names
if(browserApi){for(var _i=0;_i<browserApi.length;_i++){FullscreenApi[specApi[_i]]=browserApi[_i];}}/**
 * @file media-error.js
 *//**
 * A Custom `MediaError` class which mimics the standard HTML5 `MediaError` class.
 *
 * @param {number|string|Object|MediaError} value
 *        This can be of multiple types:
 *        - number: should be a standard error code
 *        - string: an error message (the code will be 0)
 *        - Object: arbitrary properties
 *        - `MediaError` (native): used to populate a video.js `MediaError` object
 *        - `MediaError` (video.js): will return itself if it's already a
 *          video.js `MediaError` object.
 *
 * @see [MediaError Spec]{@link https://dev.w3.org/html5/spec-author-view/video.html#mediaerror}
 * @see [Encrypted MediaError Spec]{@link https://www.w3.org/TR/2013/WD-encrypted-media-20130510/#error-codes}
 *
 * @class MediaError
 */function MediaError(value){// Allow redundant calls to this constructor to avoid having `instanceof`
// checks peppered around the code.
if(value instanceof MediaError){return value;}if(typeof value==='number'){this.code=value;}else if(typeof value==='string'){// default code is zero, so this is a custom error
this.message=value;}else if(isObject$4(value)){// We assign the `code` property manually because native `MediaError` objects
// do not expose it as an own/enumerable property of the object.
if(typeof value.code==='number'){this.code=value.code;}assign$1(this,value);}if(!this.message){this.message=MediaError.defaultMessages[this.code]||'';}}/**
 * The error code that refers two one of the defined `MediaError` types
 *
 * @type {Number}
 */MediaError.prototype.code=0;/**
 * An optional message that to show with the error. Message is not part of the HTML5
 * video spec but allows for more informative custom errors.
 *
 * @type {String}
 */MediaError.prototype.message='';/**
 * An optional status code that can be set by plugins to allow even more detail about
 * the error. For example a plugin might provide a specific HTTP status code and an
 * error message for that code. Then when the plugin gets that error this class will
 * know how to display an error message for it. This allows a custom message to show
 * up on the `Player` error overlay.
 *
 * @type {Array}
 */MediaError.prototype.status=null;/**
 * Errors indexed by the W3C standard. The order **CANNOT CHANGE**! See the
 * specification listed under {@link MediaError} for more information.
 *
 * @enum {array}
 * @readonly
 * @property {string} 0 - MEDIA_ERR_CUSTOM
 * @property {string} 1 - MEDIA_ERR_CUSTOM
 * @property {string} 2 - MEDIA_ERR_ABORTED
 * @property {string} 3 - MEDIA_ERR_NETWORK
 * @property {string} 4 - MEDIA_ERR_SRC_NOT_SUPPORTED
 * @property {string} 5 - MEDIA_ERR_ENCRYPTED
 */MediaError.errorTypes=['MEDIA_ERR_CUSTOM','MEDIA_ERR_ABORTED','MEDIA_ERR_NETWORK','MEDIA_ERR_DECODE','MEDIA_ERR_SRC_NOT_SUPPORTED','MEDIA_ERR_ENCRYPTED'];/**
 * The default `MediaError` messages based on the {@link MediaError.errorTypes}.
 *
 * @type {Array}
 * @constant
 */MediaError.defaultMessages={1:'You aborted the media playback',2:'A network error caused the media download to fail part-way.',3:'The media playback was aborted due to a corruption problem or because the media used features your browser did not support.',4:'The media could not be loaded, either because the server or network failed or because the format is not supported.',5:'The media is encrypted and we do not have the keys to decrypt it.'};// Add types as properties on MediaError
// e.g. MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
for(var errNum=0;errNum<MediaError.errorTypes.length;errNum++){MediaError[MediaError.errorTypes[errNum]]=errNum;// values should be accessible on both the class and instance
MediaError.prototype[MediaError.errorTypes[errNum]]=errNum;}/**
 * Returns whether an object is `Promise`-like (i.e. has a `then` method).
 *
 * @param  {Object}  value
 *         An object that may or may not be `Promise`-like.
 *
 * @return {Boolean}
 *         Whether or not the object is `Promise`-like.
 */function isPromise(value){return value!==undefined&&value!==null&&typeof value.then==='function';}/**
 * Silence a Promise-like object.
 *
 * This is useful for avoiding non-harmful, but potentially confusing "uncaught
 * play promise" rejection error messages.
 *
 * @param  {Object} value
 *         An object that may or may not be `Promise`-like.
 */function silencePromise(value){if(isPromise(value)){value.then(null,function(e){});}}/**
 * @file text-track-list-converter.js Utilities for capturing text track state and
 * re-creating tracks based on a capture.
 *
 * @module text-track-list-converter
 *//**
 * Examine a single {@link TextTrack} and return a JSON-compatible javascript object that
 * represents the {@link TextTrack}'s state.
 *
 * @param {TextTrack} track
 *        The text track to query.
 *
 * @return {Object}
 *         A serializable javascript representation of the TextTrack.
 * @private
 */var trackToJson_=function trackToJson_(track){var ret=['kind','label','language','id','inBandMetadataTrackDispatchType','mode','src'].reduce(function(acc,prop,i){if(track[prop]){acc[prop]=track[prop];}return acc;},{cues:track.cues&&Array.prototype.map.call(track.cues,function(cue){return {startTime:cue.startTime,endTime:cue.endTime,text:cue.text,id:cue.id};})});return ret;};/**
 * Examine a {@link Tech} and return a JSON-compatible javascript array that represents the
 * state of all {@link TextTrack}s currently configured. The return array is compatible with
 * {@link text-track-list-converter:jsonToTextTracks}.
 *
 * @param {Tech} tech
 *        The tech object to query
 *
 * @return {Array}
 *         A serializable javascript representation of the {@link Tech}s
 *         {@link TextTrackList}.
 */var textTracksToJson=function textTracksToJson(tech){var trackEls=tech.$$('track');var trackObjs=Array.prototype.map.call(trackEls,function(t){return t.track;});var tracks=Array.prototype.map.call(trackEls,function(trackEl){var json=trackToJson_(trackEl.track);if(trackEl.src){json.src=trackEl.src;}return json;});return tracks.concat(Array.prototype.filter.call(tech.textTracks(),function(track){return trackObjs.indexOf(track)===-1;}).map(trackToJson_));};/**
 * Create a set of remote {@link TextTrack}s on a {@link Tech} based on an array of javascript
 * object {@link TextTrack} representations.
 *
 * @param {Array} json
 *        An array of `TextTrack` representation objects, like those that would be
 *        produced by `textTracksToJson`.
 *
 * @param {Tech} tech
 *        The `Tech` to create the `TextTrack`s on.
 */var jsonToTextTracks=function jsonToTextTracks(json,tech){json.forEach(function(track){var addedTrack=tech.addRemoteTextTrack(track).track;if(!track.src&&track.cues){track.cues.forEach(function(cue){return addedTrack.addCue(cue);});}});return tech.textTracks();};var textTrackConverter={textTracksToJson:textTracksToJson,jsonToTextTracks:jsonToTextTracks,trackToJson_:trackToJson_};/**
 * @file modal-dialog.js
 */var MODAL_CLASS_NAME='vjs-modal-dialog';var ESC=27;/**
 * The `ModalDialog` displays over the video and its controls, which blocks
 * interaction with the player until it is closed.
 *
 * Modal dialogs include a "Close" button and will close when that button
 * is activated - or when ESC is pressed anywhere.
 *
 * @extends Component
 */var ModalDialog=function(_Component){inherits$1(ModalDialog,_Component);/**
   * Create an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   *
   * @param {Mixed} [options.content=undefined]
   *        Provide customized content for this modal.
   *
   * @param {string} [options.description]
   *        A text description for the modal, primarily for accessibility.
   *
   * @param {boolean} [options.fillAlways=false]
   *        Normally, modals are automatically filled only the first time
   *        they open. This tells the modal to refresh its content
   *        every time it opens.
   *
   * @param {string} [options.label]
   *        A text label for the modal, primarily for accessibility.
   *
   * @param {boolean} [options.temporary=true]
   *        If `true`, the modal can only be opened once; it will be
   *        disposed as soon as it's closed.
   *
   * @param {boolean} [options.uncloseable=false]
   *        If `true`, the user will not be able to close the modal
   *        through the UI in the normal ways. Programmatic closing is
   *        still possible.
   */function ModalDialog(player,options){classCallCheck(this,ModalDialog);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.opened_=_this.hasBeenOpened_=_this.hasBeenFilled_=false;_this.closeable(!_this.options_.uncloseable);_this.content(_this.options_.content);// Make sure the contentEl is defined AFTER any children are initialized
// because we only want the contents of the modal in the contentEl
// (not the UI elements like the close button).
_this.contentEl_=createEl$2('div',{className:MODAL_CLASS_NAME+'-content'},{role:'document'});_this.descEl_=createEl$2('p',{className:MODAL_CLASS_NAME+'-description vjs-control-text',id:_this.el().getAttribute('aria-describedby')});textContent(_this.descEl_,_this.description());_this.el_.appendChild(_this.descEl_);_this.el_.appendChild(_this.contentEl_);return _this;}/**
   * Create the `ModalDialog`'s DOM element
   *
   * @return {Element}
   *         The DOM element that gets created.
   */ModalDialog.prototype.createEl=function createEl$$1(){return _Component.prototype.createEl.call(this,'div',{className:this.buildCSSClass(),tabIndex:-1},{'aria-describedby':this.id()+'_description','aria-hidden':'true','aria-label':this.label(),'role':'dialog'});};ModalDialog.prototype.dispose=function dispose(){this.contentEl_=null;this.descEl_=null;this.previouslyActiveEl_=null;_Component.prototype.dispose.call(this);};/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */ModalDialog.prototype.buildCSSClass=function buildCSSClass(){return MODAL_CLASS_NAME+' vjs-hidden '+_Component.prototype.buildCSSClass.call(this);};/**
   * Handles `keydown` events on the document, looking for ESC, which closes
   * the modal.
   *
   * @param {EventTarget~Event} e
   *        The keypress that triggered this event.
   *
   * @listens keydown
   */ModalDialog.prototype.handleKeyPress=function handleKeyPress(e){if(e.which===ESC&&this.closeable()){this.close();}};/**
   * Returns the label string for this modal. Primarily used for accessibility.
   *
   * @return {string}
   *         the localized or raw label of this modal.
   */ModalDialog.prototype.label=function label(){return this.localize(this.options_.label||'Modal Window');};/**
   * Returns the description string for this modal. Primarily used for
   * accessibility.
   *
   * @return {string}
   *         The localized or raw description of this modal.
   */ModalDialog.prototype.description=function description(){var desc=this.options_.description||this.localize('This is a modal window.');// Append a universal closeability message if the modal is closeable.
if(this.closeable()){desc+=' '+this.localize('This modal can be closed by pressing the Escape key or activating the close button.');}return desc;};/**
   * Opens the modal.
   *
   * @fires ModalDialog#beforemodalopen
   * @fires ModalDialog#modalopen
   */ModalDialog.prototype.open=function open(){if(!this.opened_){var player=this.player();/**
        * Fired just before a `ModalDialog` is opened.
        *
        * @event ModalDialog#beforemodalopen
        * @type {EventTarget~Event}
        */this.trigger('beforemodalopen');this.opened_=true;// Fill content if the modal has never opened before and
// never been filled.
if(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_){this.fill();}// If the player was playing, pause it and take note of its previously
// playing state.
this.wasPlaying_=!player.paused();if(this.options_.pauseOnOpen&&this.wasPlaying_){player.pause();}if(this.closeable()){this.on(this.el_.ownerDocument,'keydown',bind$2(this,this.handleKeyPress));}// Hide controls and note if they were enabled.
this.hadControls_=player.controls();player.controls(false);this.show();this.conditionalFocus_();this.el().setAttribute('aria-hidden','false');/**
        * Fired just after a `ModalDialog` is opened.
        *
        * @event ModalDialog#modalopen
        * @type {EventTarget~Event}
        */this.trigger('modalopen');this.hasBeenOpened_=true;}};/**
   * If the `ModalDialog` is currently open or closed.
   *
   * @param  {boolean} [value]
   *         If given, it will open (`true`) or close (`false`) the modal.
   *
   * @return {boolean}
   *         the current open state of the modaldialog
   */ModalDialog.prototype.opened=function opened(value){if(typeof value==='boolean'){this[value?'open':'close']();}return this.opened_;};/**
   * Closes the modal, does nothing if the `ModalDialog` is
   * not open.
   *
   * @fires ModalDialog#beforemodalclose
   * @fires ModalDialog#modalclose
   */ModalDialog.prototype.close=function close(){if(!this.opened_){return;}var player=this.player();/**
      * Fired just before a `ModalDialog` is closed.
      *
      * @event ModalDialog#beforemodalclose
      * @type {EventTarget~Event}
      */this.trigger('beforemodalclose');this.opened_=false;if(this.wasPlaying_&&this.options_.pauseOnOpen){player.play();}if(this.closeable()){this.off(this.el_.ownerDocument,'keydown',bind$2(this,this.handleKeyPress));}if(this.hadControls_){player.controls(true);}this.hide();this.el().setAttribute('aria-hidden','true');/**
      * Fired just after a `ModalDialog` is closed.
      *
      * @event ModalDialog#modalclose
      * @type {EventTarget~Event}
      */this.trigger('modalclose');this.conditionalBlur_();if(this.options_.temporary){this.dispose();}};/**
   * Check to see if the `ModalDialog` is closeable via the UI.
   *
   * @param  {boolean} [value]
   *         If given as a boolean, it will set the `closeable` option.
   *
   * @return {boolean}
   *         Returns the final value of the closable option.
   */ModalDialog.prototype.closeable=function closeable(value){if(typeof value==='boolean'){var closeable=this.closeable_=!!value;var close=this.getChild('closeButton');// If this is being made closeable and has no close button, add one.
if(closeable&&!close){// The close button should be a child of the modal - not its
// content element, so temporarily change the content element.
var temp=this.contentEl_;this.contentEl_=this.el_;close=this.addChild('closeButton',{controlText:'Close Modal Dialog'});this.contentEl_=temp;this.on(close,'close',this.close);}// If this is being made uncloseable and has a close button, remove it.
if(!closeable&&close){this.off(close,'close',this.close);this.removeChild(close);close.dispose();}}return this.closeable_;};/**
   * Fill the modal's content element with the modal's "content" option.
   * The content element will be emptied before this change takes place.
   */ModalDialog.prototype.fill=function fill(){this.fillWith(this.content());};/**
   * Fill the modal's content element with arbitrary content.
   * The content element will be emptied before this change takes place.
   *
   * @fires ModalDialog#beforemodalfill
   * @fires ModalDialog#modalfill
   *
   * @param {Mixed} [content]
   *        The same rules apply to this as apply to the `content` option.
   */ModalDialog.prototype.fillWith=function fillWith(content){var contentEl=this.contentEl();var parentEl=contentEl.parentNode;var nextSiblingEl=contentEl.nextSibling;/**
     * Fired just before a `ModalDialog` is filled with content.
     *
     * @event ModalDialog#beforemodalfill
     * @type {EventTarget~Event}
     */this.trigger('beforemodalfill');this.hasBeenFilled_=true;// Detach the content element from the DOM before performing
// manipulation to avoid modifying the live DOM multiple times.
parentEl.removeChild(contentEl);this.empty();insertContent(contentEl,content);/**
     * Fired just after a `ModalDialog` is filled with content.
     *
     * @event ModalDialog#modalfill
     * @type {EventTarget~Event}
     */this.trigger('modalfill');// Re-inject the re-filled content element.
if(nextSiblingEl){parentEl.insertBefore(contentEl,nextSiblingEl);}else {parentEl.appendChild(contentEl);}// make sure that the close button is last in the dialog DOM
var closeButton=this.getChild('closeButton');if(closeButton){parentEl.appendChild(closeButton.el_);}};/**
   * Empties the content element. This happens anytime the modal is filled.
   *
   * @fires ModalDialog#beforemodalempty
   * @fires ModalDialog#modalempty
   */ModalDialog.prototype.empty=function empty(){/**
     * Fired just before a `ModalDialog` is emptied.
     *
     * @event ModalDialog#beforemodalempty
     * @type {EventTarget~Event}
     */this.trigger('beforemodalempty');emptyEl(this.contentEl());/**
     * Fired just after a `ModalDialog` is emptied.
     *
     * @event ModalDialog#modalempty
     * @type {EventTarget~Event}
     */this.trigger('modalempty');};/**
   * Gets or sets the modal content, which gets normalized before being
   * rendered into the DOM.
   *
   * This does not update the DOM or fill the modal, but it is called during
   * that process.
   *
   * @param  {Mixed} [value]
   *         If defined, sets the internal content value to be used on the
   *         next call(s) to `fill`. This value is normalized before being
   *         inserted. To "clear" the internal content value, pass `null`.
   *
   * @return {Mixed}
   *         The current content of the modal dialog
   */ModalDialog.prototype.content=function content(value){if(typeof value!=='undefined'){this.content_=value;}return this.content_;};/**
   * conditionally focus the modal dialog if focus was previously on the player.
   *
   * @private
   */ModalDialog.prototype.conditionalFocus_=function conditionalFocus_(){var activeEl=document$1.activeElement;var playerEl=this.player_.el_;this.previouslyActiveEl_=null;if(playerEl.contains(activeEl)||playerEl===activeEl){this.previouslyActiveEl_=activeEl;this.focus();this.on(document$1,'keydown',this.handleKeyDown);}};/**
   * conditionally blur the element and refocus the last focused element
   *
   * @private
   */ModalDialog.prototype.conditionalBlur_=function conditionalBlur_(){if(this.previouslyActiveEl_){this.previouslyActiveEl_.focus();this.previouslyActiveEl_=null;}this.off(document$1,'keydown',this.handleKeyDown);};/**
   * Keydown handler. Attached when modal is focused.
   *
   * @listens keydown
   */ModalDialog.prototype.handleKeyDown=function handleKeyDown(event){// exit early if it isn't a tab key
if(event.which!==9){return;}var focusableEls=this.focusableEls_();var activeEl=this.el_.querySelector(':focus');var focusIndex=void 0;for(var i=0;i<focusableEls.length;i++){if(activeEl===focusableEls[i]){focusIndex=i;break;}}if(document$1.activeElement===this.el_){focusIndex=0;}if(event.shiftKey&&focusIndex===0){focusableEls[focusableEls.length-1].focus();event.preventDefault();}else if(!event.shiftKey&&focusIndex===focusableEls.length-1){focusableEls[0].focus();event.preventDefault();}};/**
   * get all focusable elements
   *
   * @private
   */ModalDialog.prototype.focusableEls_=function focusableEls_(){var allChildren=this.el_.querySelectorAll('*');return Array.prototype.filter.call(allChildren,function(child){return (child instanceof window$1.HTMLAnchorElement||child instanceof window$1.HTMLAreaElement)&&child.hasAttribute('href')||(child instanceof window$1.HTMLInputElement||child instanceof window$1.HTMLSelectElement||child instanceof window$1.HTMLTextAreaElement||child instanceof window$1.HTMLButtonElement)&&!child.hasAttribute('disabled')||child instanceof window$1.HTMLIFrameElement||child instanceof window$1.HTMLObjectElement||child instanceof window$1.HTMLEmbedElement||child.hasAttribute('tabindex')&&child.getAttribute('tabindex')!==-1||child.hasAttribute('contenteditable');});};return ModalDialog;}(Component);/**
 * Default options for `ModalDialog` default options.
 *
 * @type {Object}
 * @private
 */ModalDialog.prototype.options_={pauseOnOpen:true,temporary:true};Component.registerComponent('ModalDialog',ModalDialog);/**
 * @file track-list.js
 *//**
 * Common functionaliy between {@link TextTrackList}, {@link AudioTrackList}, and
 * {@link VideoTrackList}
 *
 * @extends EventTarget
 */var TrackList=function(_EventTarget){inherits$1(TrackList,_EventTarget);/**
   * Create an instance of this class
   *
   * @param {Track[]} tracks
   *        A list of tracks to initialize the list with.
   *
   * @param {Object} [list]
   *        The child object with inheritance done manually for ie8.
   *
   * @abstract
   */function TrackList(){var tracks=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var _ret;var list=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;classCallCheck(this,TrackList);var _this=possibleConstructorReturn(this,_EventTarget.call(this));if(!list){list=_this;// eslint-disable-line
if(IS_IE8){list=document$1.createElement('custom');for(var prop in TrackList.prototype){if(prop!=='constructor'){list[prop]=TrackList.prototype[prop];}}}}list.tracks_=[];/**
     * @memberof TrackList
     * @member {number} length
     *         The current number of `Track`s in the this Trackist.
     * @instance
     */Object.defineProperty(list,'length',{get:function get$$1(){return this.tracks_.length;}});for(var i=0;i<tracks.length;i++){list.addTrack(tracks[i]);}// must return the object, as for ie8 it will not be this
// but a reference to a document object
return _ret=list,possibleConstructorReturn(_this,_ret);}/**
   * Add a {@link Track} to the `TrackList`
   *
   * @param {Track} track
   *        The audio, video, or text track to add to the list.
   *
   * @fires TrackList#addtrack
   */TrackList.prototype.addTrack=function addTrack(track){var index=this.tracks_.length;if(!(''+index in this)){Object.defineProperty(this,index,{get:function get$$1(){return this.tracks_[index];}});}// Do not add duplicate tracks
if(this.tracks_.indexOf(track)===-1){this.tracks_.push(track);/**
       * Triggered when a track is added to a track list.
       *
       * @event TrackList#addtrack
       * @type {EventTarget~Event}
       * @property {Track} track
       *           A reference to track that was added.
       */this.trigger({track:track,type:'addtrack'});}};/**
   * Remove a {@link Track} from the `TrackList`
   *
   * @param {Track} rtrack
   *        The audio, video, or text track to remove from the list.
   *
   * @fires TrackList#removetrack
   */TrackList.prototype.removeTrack=function removeTrack(rtrack){var track=void 0;for(var i=0,l=this.length;i<l;i++){if(this[i]===rtrack){track=this[i];if(track.off){track.off();}this.tracks_.splice(i,1);break;}}if(!track){return;}/**
     * Triggered when a track is removed from track list.
     *
     * @event TrackList#removetrack
     * @type {EventTarget~Event}
     * @property {Track} track
     *           A reference to track that was removed.
     */this.trigger({track:track,type:'removetrack'});};/**
   * Get a Track from the TrackList by a tracks id
   *
   * @param {String} id - the id of the track to get
   * @method getTrackById
   * @return {Track}
   * @private
   */TrackList.prototype.getTrackById=function getTrackById(id){var result=null;for(var i=0,l=this.length;i<l;i++){var track=this[i];if(track.id===id){result=track;break;}}return result;};return TrackList;}(EventTarget);/**
 * Triggered when a different track is selected/enabled.
 *
 * @event TrackList#change
 * @type {EventTarget~Event}
 *//**
 * Events that can be called with on + eventName. See {@link EventHandler}.
 *
 * @property {Object} TrackList#allowedEvents_
 * @private
 */TrackList.prototype.allowedEvents_={change:'change',addtrack:'addtrack',removetrack:'removetrack'};// emulate attribute EventHandler support to allow for feature detection
for(var event$1 in TrackList.prototype.allowedEvents_){TrackList.prototype['on'+event$1]=null;}/**
 * @file audio-track-list.js
 *//**
 * Anywhere we call this function we diverge from the spec
 * as we only support one enabled audiotrack at a time
 *
 * @param {AudioTrackList} list
 *        list to work on
 *
 * @param {AudioTrack} track
 *        The track to skip
 *
 * @private
 */var disableOthers=function disableOthers(list,track){for(var i=0;i<list.length;i++){if(!Object.keys(list[i]).length||track.id===list[i].id){continue;}// another audio track is enabled, disable it
list[i].enabled=false;}};/**
 * The current list of {@link AudioTrack} for a media file.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist}
 * @extends TrackList
 */var AudioTrackList=function(_TrackList){inherits$1(AudioTrackList,_TrackList);/**
   * Create an instance of this class.
   *
   * @param {AudioTrack[]} [tracks=[]]
   *        A list of `AudioTrack` to instantiate the list with.
   */function AudioTrackList(){var _this,_ret;var tracks=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];classCallCheck(this,AudioTrackList);var list=void 0;// make sure only 1 track is enabled
// sorted from last index to first index
for(var i=tracks.length-1;i>=0;i--){if(tracks[i].enabled){disableOthers(tracks,tracks[i]);break;}}// IE8 forces us to implement inheritance ourselves
// as it does not support Object.defineProperty properly
if(IS_IE8){list=document$1.createElement('custom');for(var prop in TrackList.prototype){if(prop!=='constructor'){list[prop]=TrackList.prototype[prop];}}for(var _prop in AudioTrackList.prototype){if(_prop!=='constructor'){list[_prop]=AudioTrackList.prototype[_prop];}}}list=(_this=possibleConstructorReturn(this,_TrackList.call(this,tracks,list)),_this);list.changing_=false;return _ret=list,possibleConstructorReturn(_this,_ret);}/**
   * Add an {@link AudioTrack} to the `AudioTrackList`.
   *
   * @param {AudioTrack} track
   *        The AudioTrack to add to the list
   *
   * @fires TrackList#addtrack
   */AudioTrackList.prototype.addTrack=function addTrack(track){var _this2=this;if(track.enabled){disableOthers(this,track);}_TrackList.prototype.addTrack.call(this,track);// native tracks don't have this
if(!track.addEventListener){return;}/**
     * @listens AudioTrack#enabledchange
     * @fires TrackList#change
     */track.addEventListener('enabledchange',function(){// when we are disabling other tracks (since we don't support
// more than one track at a time) we will set changing_
// to true so that we don't trigger additional change events
if(_this2.changing_){return;}_this2.changing_=true;disableOthers(_this2,track);_this2.changing_=false;_this2.trigger('change');});};return AudioTrackList;}(TrackList);/**
 * @file video-track-list.js
 *//**
 * Un-select all other {@link VideoTrack}s that are selected.
 *
 * @param {VideoTrackList} list
 *        list to work on
 *
 * @param {VideoTrack} track
 *        The track to skip
 *
 * @private
 */var disableOthers$1=function disableOthers(list,track){for(var i=0;i<list.length;i++){if(!Object.keys(list[i]).length||track.id===list[i].id){continue;}// another video track is enabled, disable it
list[i].selected=false;}};/**
 * The current list of {@link VideoTrack} for a video.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist}
 * @extends TrackList
 */var VideoTrackList=function(_TrackList){inherits$1(VideoTrackList,_TrackList);/**
   * Create an instance of this class.
   *
   * @param {VideoTrack[]} [tracks=[]]
   *        A list of `VideoTrack` to instantiate the list with.
   */function VideoTrackList(){var _this,_ret;var tracks=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];classCallCheck(this,VideoTrackList);var list=void 0;// make sure only 1 track is enabled
// sorted from last index to first index
for(var i=tracks.length-1;i>=0;i--){if(tracks[i].selected){disableOthers$1(tracks,tracks[i]);break;}}// IE8 forces us to implement inheritance ourselves
// as it does not support Object.defineProperty properly
if(IS_IE8){list=document$1.createElement('custom');for(var prop in TrackList.prototype){if(prop!=='constructor'){list[prop]=TrackList.prototype[prop];}}for(var _prop in VideoTrackList.prototype){if(_prop!=='constructor'){list[_prop]=VideoTrackList.prototype[_prop];}}}list=(_this=possibleConstructorReturn(this,_TrackList.call(this,tracks,list)),_this);list.changing_=false;/**
     * @member {number} VideoTrackList#selectedIndex
     *         The current index of the selected {@link VideoTrack`}.
     */Object.defineProperty(list,'selectedIndex',{get:function get$$1(){for(var _i=0;_i<this.length;_i++){if(this[_i].selected){return _i;}}return -1;},set:function set$$1(){}});return _ret=list,possibleConstructorReturn(_this,_ret);}/**
   * Add a {@link VideoTrack} to the `VideoTrackList`.
   *
   * @param {VideoTrack} track
   *        The VideoTrack to add to the list
   *
   * @fires TrackList#addtrack
   */VideoTrackList.prototype.addTrack=function addTrack(track){var _this2=this;if(track.selected){disableOthers$1(this,track);}_TrackList.prototype.addTrack.call(this,track);// native tracks don't have this
if(!track.addEventListener){return;}/**
     * @listens VideoTrack#selectedchange
     * @fires TrackList#change
     */track.addEventListener('selectedchange',function(){if(_this2.changing_){return;}_this2.changing_=true;disableOthers$1(_this2,track);_this2.changing_=false;_this2.trigger('change');});};return VideoTrackList;}(TrackList);/**
 * @file text-track-list.js
 *//**
 * The current list of {@link TextTrack} for a media file.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist}
 * @extends TrackList
 */var TextTrackList=function(_TrackList){inherits$1(TextTrackList,_TrackList);/**
   * Create an instance of this class.
   *
   * @param {TextTrack[]} [tracks=[]]
   *        A list of `TextTrack` to instantiate the list with.
   */function TextTrackList(){var _this,_ret;var tracks=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];classCallCheck(this,TextTrackList);var list=void 0;// IE8 forces us to implement inheritance ourselves
// as it does not support Object.defineProperty properly
if(IS_IE8){list=document$1.createElement('custom');for(var prop in TrackList.prototype){if(prop!=='constructor'){list[prop]=TrackList.prototype[prop];}}for(var _prop in TextTrackList.prototype){if(_prop!=='constructor'){list[_prop]=TextTrackList.prototype[_prop];}}}list=(_this=possibleConstructorReturn(this,_TrackList.call(this,tracks,list)),_this);return _ret=list,possibleConstructorReturn(_this,_ret);}/**
   * Add a {@link TextTrack} to the `TextTrackList`
   *
   * @param {TextTrack} track
   *        The text track to add to the list.
   *
   * @fires TrackList#addtrack
   */TextTrackList.prototype.addTrack=function addTrack(track){_TrackList.prototype.addTrack.call(this,track);/**
     * @listens TextTrack#modechange
     * @fires TrackList#change
     */track.addEventListener('modechange',bind$2(this,function(){this.trigger('change');}));var nonLanguageTextTrackKind=['metadata','chapters'];if(nonLanguageTextTrackKind.indexOf(track.kind)===-1){track.addEventListener('modechange',bind$2(this,function(){this.trigger('selectedlanguagechange');}));}};return TextTrackList;}(TrackList);/**
 * @file html-track-element-list.js
 *//**
 * The current list of {@link HtmlTrackElement}s.
 */var HtmlTrackElementList=function(){/**
   * Create an instance of this class.
   *
   * @param {HtmlTrackElement[]} [tracks=[]]
   *        A list of `HtmlTrackElement` to instantiate the list with.
   */function HtmlTrackElementList(){var trackElements=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];classCallCheck(this,HtmlTrackElementList);var list=this;// eslint-disable-line
if(IS_IE8){list=document$1.createElement('custom');for(var prop in HtmlTrackElementList.prototype){if(prop!=='constructor'){list[prop]=HtmlTrackElementList.prototype[prop];}}}list.trackElements_=[];/**
     * @memberof HtmlTrackElementList
     * @member {number} length
     *         The current number of `Track`s in the this Trackist.
     * @instance
     */Object.defineProperty(list,'length',{get:function get$$1(){return this.trackElements_.length;}});for(var i=0,length=trackElements.length;i<length;i++){list.addTrackElement_(trackElements[i]);}if(IS_IE8){return list;}}/**
   * Add an {@link HtmlTrackElement} to the `HtmlTrackElementList`
   *
   * @param {HtmlTrackElement} trackElement
   *        The track element to add to the list.
   *
   * @private
   */HtmlTrackElementList.prototype.addTrackElement_=function addTrackElement_(trackElement){var index=this.trackElements_.length;if(!(''+index in this)){Object.defineProperty(this,index,{get:function get$$1(){return this.trackElements_[index];}});}// Do not add duplicate elements
if(this.trackElements_.indexOf(trackElement)===-1){this.trackElements_.push(trackElement);}};/**
   * Get an {@link HtmlTrackElement} from the `HtmlTrackElementList` given an
   * {@link TextTrack}.
   *
   * @param {TextTrack} track
   *        The track associated with a track element.
   *
   * @return {HtmlTrackElement|undefined}
   *         The track element that was found or undefined.
   *
   * @private
   */HtmlTrackElementList.prototype.getTrackElementByTrack_=function getTrackElementByTrack_(track){var trackElement_=void 0;for(var i=0,length=this.trackElements_.length;i<length;i++){if(track===this.trackElements_[i].track){trackElement_=this.trackElements_[i];break;}}return trackElement_;};/**
   * Remove a {@link HtmlTrackElement} from the `HtmlTrackElementList`
   *
   * @param {HtmlTrackElement} trackElement
   *        The track element to remove from the list.
   *
   * @private
   */HtmlTrackElementList.prototype.removeTrackElement_=function removeTrackElement_(trackElement){for(var i=0,length=this.trackElements_.length;i<length;i++){if(trackElement===this.trackElements_[i]){this.trackElements_.splice(i,1);break;}}};return HtmlTrackElementList;}();/**
 * @file text-track-cue-list.js
 *//**
 * @typedef {Object} TextTrackCueList~TextTrackCue
 *
 * @property {string} id
 *           The unique id for this text track cue
 *
 * @property {number} startTime
 *           The start time for this text track cue
 *
 * @property {number} endTime
 *           The end time for this text track cue
 *
 * @property {boolean} pauseOnExit
 *           Pause when the end time is reached if true.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcue}
 *//**
 * A List of TextTrackCues.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcuelist}
 */var TextTrackCueList=function(){/**
   * Create an instance of this class..
   *
   * @param {Array} cues
   *        A list of cues to be initialized with
   */function TextTrackCueList(cues){classCallCheck(this,TextTrackCueList);var list=this;// eslint-disable-line
if(IS_IE8){list=document$1.createElement('custom');for(var prop in TextTrackCueList.prototype){if(prop!=='constructor'){list[prop]=TextTrackCueList.prototype[prop];}}}TextTrackCueList.prototype.setCues_.call(list,cues);/**
     * @memberof TextTrackCueList
     * @member {number} length
     *         The current number of `TextTrackCue`s in the TextTrackCueList.
     * @instance
     */Object.defineProperty(list,'length',{get:function get$$1(){return this.length_;}});if(IS_IE8){return list;}}/**
   * A setter for cues in this list. Creates getters
   * an an index for the cues.
   *
   * @param {Array} cues
   *        An array of cues to set
   *
   * @private
   */TextTrackCueList.prototype.setCues_=function setCues_(cues){var oldLength=this.length||0;var i=0;var l=cues.length;this.cues_=cues;this.length_=cues.length;var defineProp=function defineProp(index){if(!(''+index in this)){Object.defineProperty(this,''+index,{get:function get$$1(){return this.cues_[index];}});}};if(oldLength<l){i=oldLength;for(;i<l;i++){defineProp.call(this,i);}}};/**
   * Get a `TextTrackCue` that is currently in the `TextTrackCueList` by id.
   *
   * @param {string} id
   *        The id of the cue that should be searched for.
   *
   * @return {TextTrackCueList~TextTrackCue|null}
   *         A single cue or null if none was found.
   */TextTrackCueList.prototype.getCueById=function getCueById(id){var result=null;for(var i=0,l=this.length;i<l;i++){var cue=this[i];if(cue.id===id){result=cue;break;}}return result;};return TextTrackCueList;}();/**
 * @file track-kinds.js
 *//**
 * All possible `VideoTrackKind`s
 *
 * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-videotrack-kind
 * @typedef VideoTrack~Kind
 * @enum
 */var VideoTrackKind={alternative:'alternative',captions:'captions',main:'main',sign:'sign',subtitles:'subtitles',commentary:'commentary'};/**
 * All possible `AudioTrackKind`s
 *
 * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-audiotrack-kind
 * @typedef AudioTrack~Kind
 * @enum
 */var AudioTrackKind={'alternative':'alternative','descriptions':'descriptions','main':'main','main-desc':'main-desc','translation':'translation','commentary':'commentary'};/**
 * All possible `TextTrackKind`s
 *
 * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-kind
 * @typedef TextTrack~Kind
 * @enum
 */var TextTrackKind={subtitles:'subtitles',captions:'captions',descriptions:'descriptions',chapters:'chapters',metadata:'metadata'};/**
 * All possible `TextTrackMode`s
 *
 * @see https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackmode
 * @typedef TextTrack~Mode
 * @enum
 */var TextTrackMode={disabled:'disabled',hidden:'hidden',showing:'showing'};/**
 * @file track.js
 *//**
 * A Track class that contains all of the common functionality for {@link AudioTrack},
 * {@link VideoTrack}, and {@link TextTrack}.
 *
 * > Note: This class should not be used directly
 *
 * @see {@link https://html.spec.whatwg.org/multipage/embedded-content.html}
 * @extends EventTarget
 * @abstract
 */var Track$1=function(_EventTarget){inherits$1(Track,_EventTarget);/**
   * Create an instance of this class.
   *
   * @param {Object} [options={}]
   *        Object of option names and values
   *
   * @param {string} [options.kind='']
   *        A valid kind for the track type you are creating.
   *
   * @param {string} [options.id='vjs_track_' + Guid.newGUID()]
   *        A unique id for this AudioTrack.
   *
   * @param {string} [options.label='']
   *        The menu label for this track.
   *
   * @param {string} [options.language='']
   *        A valid two character language code.
   *
   * @abstract
   */function Track(){var _ret;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,Track);var _this=possibleConstructorReturn(this,_EventTarget.call(this));var track=_this;// eslint-disable-line
if(IS_IE8){track=document$1.createElement('custom');for(var prop in Track.prototype){if(prop!=='constructor'){track[prop]=Track.prototype[prop];}}}var trackProps={id:options.id||'vjs_track_'+newGUID(),kind:options.kind||'',label:options.label||'',language:options.language||''};/**
     * @memberof Track
     * @member {string} id
     *         The id of this track. Cannot be changed after creation.
     * @instance
     *
     * @readonly
     *//**
     * @memberof Track
     * @member {string} kind
     *         The kind of track that this is. Cannot be changed after creation.
     * @instance
     *
     * @readonly
     *//**
     * @memberof Track
     * @member {string} label
     *         The label of this track. Cannot be changed after creation.
     * @instance
     *
     * @readonly
     *//**
     * @memberof Track
     * @member {string} language
     *         The two letter language code for this track. Cannot be changed after
     *         creation.
     * @instance
     *
     * @readonly
     */var _loop=function _loop(key){Object.defineProperty(track,key,{get:function get$$1(){return trackProps[key];},set:function set$$1(){}});};for(var key in trackProps){_loop(key);}return _ret=track,possibleConstructorReturn(_this,_ret);}return Track;}(EventTarget);/**
 * @file url.js
 * @module url
 *//**
 * @typedef {Object} url:URLObject
 *
 * @property {string} protocol
 *           The protocol of the url that was parsed.
 *
 * @property {string} hostname
 *           The hostname of the url that was parsed.
 *
 * @property {string} port
 *           The port of the url that was parsed.
 *
 * @property {string} pathname
 *           The pathname of the url that was parsed.
 *
 * @property {string} search
 *           The search query of the url that was parsed.
 *
 * @property {string} hash
 *           The hash of the url that was parsed.
 *
 * @property {string} host
 *           The host of the url that was parsed.
 *//**
 * Resolve and parse the elements of a URL.
 *
 * @param  {String} url
 *         The url to parse
 *
 * @return {url:URLObject}
 *         An object of url details
 */var parseUrl=function parseUrl(url){var props=['protocol','hostname','port','pathname','search','hash','host'];// add the url to an anchor and let the browser parse the URL
var a=document$1.createElement('a');a.href=url;// IE8 (and 9?) Fix
// ie8 doesn't parse the URL correctly until the anchor is actually
// added to the body, and an innerHTML is needed to trigger the parsing
var addToBody=a.host===''&&a.protocol!=='file:';var div=void 0;if(addToBody){div=document$1.createElement('div');div.innerHTML='<a href="'+url+'"></a>';a=div.firstChild;// prevent the div from affecting layout
div.setAttribute('style','display:none; position:absolute;');document$1.body.appendChild(div);}// Copy the specific URL properties to a new object
// This is also needed for IE8 because the anchor loses its
// properties when it's removed from the dom
var details={};for(var i=0;i<props.length;i++){details[props[i]]=a[props[i]];}// IE9 adds the port to the host property unlike everyone else. If
// a port identifier is added for standard ports, strip it.
if(details.protocol==='http:'){details.host=details.host.replace(/:80$/,'');}if(details.protocol==='https:'){details.host=details.host.replace(/:443$/,'');}if(!details.protocol){details.protocol=window$1.location.protocol;}if(addToBody){document$1.body.removeChild(div);}return details;};/**
 * Get absolute version of relative URL. Used to tell flash correct URL.
 *
 *
 * @param  {string} url
 *         URL to make absolute
 *
 * @return {string}
 *         Absolute URL
 *
 * @see http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue
 */var getAbsoluteURL=function getAbsoluteURL(url){// Check if absolute URL
if(!url.match(/^https?:\/\//)){// Convert to absolute URL. Flash hosted off-site needs an absolute URL.
var div=document$1.createElement('div');div.innerHTML='<a href="'+url+'">x</a>';url=div.firstChild.href;}return url;};/**
 * Returns the extension of the passed file name. It will return an empty string
 * if passed an invalid path.
 *
 * @param {string} path
 *        The fileName path like '/path/to/file.mp4'
 *
 * @returns {string}
 *          The extension in lower case or an empty string if no
 *          extension could be found.
 */var getFileExtension=function getFileExtension(path){if(typeof path==='string'){var splitPathRe=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i;var pathParts=splitPathRe.exec(path);if(pathParts){return pathParts.pop().toLowerCase();}}return '';};/**
 * Returns whether the url passed is a cross domain request or not.
 *
 * @param {string} url
 *        The url to check.
 *
 * @return {boolean}
 *         Whether it is a cross domain request or not.
 */var isCrossOrigin=function isCrossOrigin(url){var winLoc=window$1.location;var urlInfo=parseUrl(url);// IE8 protocol relative urls will return ':' for protocol
var srcProtocol=urlInfo.protocol===':'?winLoc.protocol:urlInfo.protocol;// Check if url is for another domain/origin
// IE8 doesn't know location.origin, so we won't rely on it here
var crossOrigin=srcProtocol+urlInfo.host!==winLoc.protocol+winLoc.host;return crossOrigin;};var Url=(Object.freeze||Object)({parseUrl:parseUrl,getAbsoluteURL:getAbsoluteURL,getFileExtension:getFileExtension,isCrossOrigin:isCrossOrigin});/**
 * @file text-track.js
 *//**
 * Takes a webvtt file contents and parses it into cues
 *
 * @param {string} srcContent
 *        webVTT file contents
 *
 * @param {TextTrack} track
 *        TextTrack to add cues to. Cues come from the srcContent.
 *
 * @private
 */var parseCues=function parseCues(srcContent,track){var parser=new window$1.WebVTT.Parser(window$1,window$1.vttjs,window$1.WebVTT.StringDecoder());var errors=[];parser.oncue=function(cue){track.addCue(cue);};parser.onparsingerror=function(error){errors.push(error);};parser.onflush=function(){track.trigger({type:'loadeddata',target:track});};parser.parse(srcContent);if(errors.length>0){if(window$1.console&&window$1.console.groupCollapsed){window$1.console.groupCollapsed('Text Track parsing errors for '+track.src);}errors.forEach(function(error){return log$2.error(error);});if(window$1.console&&window$1.console.groupEnd){window$1.console.groupEnd();}}parser.flush();};/**
 * Load a `TextTrack` from a specifed url.
 *
 * @param {string} src
 *        Url to load track from.
 *
 * @param {TextTrack} track
 *        Track to add cues to. Comes from the content at the end of `url`.
 *
 * @private
 */var loadTrack=function loadTrack(src,track){var opts={uri:src};var crossOrigin=isCrossOrigin(src);if(crossOrigin){opts.cors=crossOrigin;}xhr(opts,bind$2(this,function(err,response,responseBody){if(err){return log$2.error(err,response);}track.loaded_=true;// Make sure that vttjs has loaded, otherwise, wait till it finished loading
// NOTE: this is only used for the alt/video.novtt.js build
if(typeof window$1.WebVTT!=='function'){if(track.tech_){var loadHandler=function loadHandler(){return parseCues(responseBody,track);};track.tech_.on('vttjsloaded',loadHandler);track.tech_.on('vttjserror',function(){log$2.error('vttjs failed to load, stopping trying to process '+track.src);track.tech_.off('vttjsloaded',loadHandler);});}}else {parseCues(responseBody,track);}}));};/**
 * A representation of a single `TextTrack`.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrack}
 * @extends Track
 */var TextTrack=function(_Track){inherits$1(TextTrack,_Track);/**
   * Create an instance of this class.
   *
   * @param {Object} options={}
   *        Object of option names and values
   *
   * @param {Tech} options.tech
   *        A reference to the tech that owns this TextTrack.
   *
   * @param {TextTrack~Kind} [options.kind='subtitles']
   *        A valid text track kind.
   *
   * @param {TextTrack~Mode} [options.mode='disabled']
   *        A valid text track mode.
   *
   * @param {string} [options.id='vjs_track_' + Guid.newGUID()]
   *        A unique id for this TextTrack.
   *
   * @param {string} [options.label='']
   *        The menu label for this track.
   *
   * @param {string} [options.language='']
   *        A valid two character language code.
   *
   * @param {string} [options.srclang='']
   *        A valid two character language code. An alternative, but deprioritized
   *        vesion of `options.language`
   *
   * @param {string} [options.src]
   *        A url to TextTrack cues.
   *
   * @param {boolean} [options.default]
   *        If this track should default to on or off.
   */function TextTrack(){var _this,_ret;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,TextTrack);if(!options.tech){throw new Error('A tech was not provided.');}var settings=mergeOptions(options,{kind:TextTrackKind[options.kind]||'subtitles',language:options.language||options.srclang||''});var mode=TextTrackMode[settings.mode]||'disabled';var default_=settings['default'];if(settings.kind==='metadata'||settings.kind==='chapters'){mode='hidden';}// on IE8 this will be a document element
// for every other browser this will be a normal object
var tt=(_this=possibleConstructorReturn(this,_Track.call(this,settings)),_this);tt.tech_=settings.tech;if(IS_IE8){for(var prop in TextTrack.prototype){if(prop!=='constructor'){tt[prop]=TextTrack.prototype[prop];}}}tt.cues_=[];tt.activeCues_=[];var cues=new TextTrackCueList(tt.cues_);var activeCues=new TextTrackCueList(tt.activeCues_);var changed=false;var timeupdateHandler=bind$2(tt,function(){// Accessing this.activeCues for the side-effects of updating itself
// due to it's nature as a getter function. Do not remove or cues will
// stop updating!
// Use the setter to prevent deletion from uglify (pure_getters rule)
this.activeCues=this.activeCues;if(changed){this.trigger('cuechange');changed=false;}});if(mode!=='disabled'){tt.tech_.ready(function(){tt.tech_.on('timeupdate',timeupdateHandler);},true);}/**
     * @memberof TextTrack
     * @member {boolean} default
     *         If this track was set to be on or off by default. Cannot be changed after
     *         creation.
     * @instance
     *
     * @readonly
     */Object.defineProperty(tt,'default',{get:function get$$1(){return default_;},set:function set$$1(){}});/**
     * @memberof TextTrack
     * @member {string} mode
     *         Set the mode of this TextTrack to a valid {@link TextTrack~Mode}. Will
     *         not be set if setting to an invalid mode.
     * @instance
     *
     * @fires TextTrack#modechange
     */Object.defineProperty(tt,'mode',{get:function get$$1(){return mode;},set:function set$$1(newMode){var _this2=this;if(!TextTrackMode[newMode]){return;}mode=newMode;if(mode!=='disabled'){this.tech_.ready(function(){_this2.tech_.on('timeupdate',timeupdateHandler);},true);}else {this.tech_.off('timeupdate',timeupdateHandler);}/**
         * An event that fires when mode changes on this track. This allows
         * the TextTrackList that holds this track to act accordingly.
         *
         * > Note: This is not part of the spec!
         *
         * @event TextTrack#modechange
         * @type {EventTarget~Event}
         */this.trigger('modechange');}});/**
     * @memberof TextTrack
     * @member {TextTrackCueList} cues
     *         The text track cue list for this TextTrack.
     * @instance
     */Object.defineProperty(tt,'cues',{get:function get$$1(){if(!this.loaded_){return null;}return cues;},set:function set$$1(){}});/**
     * @memberof TextTrack
     * @member {TextTrackCueList} activeCues
     *         The list text track cues that are currently active for this TextTrack.
     * @instance
     */Object.defineProperty(tt,'activeCues',{get:function get$$1(){if(!this.loaded_){return null;}// nothing to do
if(this.cues.length===0){return activeCues;}var ct=this.tech_.currentTime();var active=[];for(var i=0,l=this.cues.length;i<l;i++){var cue=this.cues[i];if(cue.startTime<=ct&&cue.endTime>=ct){active.push(cue);}else if(cue.startTime===cue.endTime&&cue.startTime<=ct&&cue.startTime+0.5>=ct){active.push(cue);}}changed=false;if(active.length!==this.activeCues_.length){changed=true;}else {for(var _i=0;_i<active.length;_i++){if(this.activeCues_.indexOf(active[_i])===-1){changed=true;}}}this.activeCues_=active;activeCues.setCues_(this.activeCues_);return activeCues;},// /!\ Keep this setter empty (see the timeupdate handler above)
set:function set$$1(){}});if(settings.src){tt.src=settings.src;loadTrack(settings.src,tt);}else {tt.loaded_=true;}return _ret=tt,possibleConstructorReturn(_this,_ret);}/**
   * Add a cue to the internal list of cues.
   *
   * @param {TextTrack~Cue} cue
   *        The cue to add to our internal list
   */TextTrack.prototype.addCue=function addCue(originalCue){var cue=originalCue;if(window$1.vttjs&&!(originalCue instanceof window$1.vttjs.VTTCue)){cue=new window$1.vttjs.VTTCue(originalCue.startTime,originalCue.endTime,originalCue.text);for(var prop in originalCue){if(!(prop in cue)){cue[prop]=originalCue[prop];}}// make sure that `id` is copied over
cue.id=originalCue.id;cue.originalCue_=originalCue;}var tracks=this.tech_.textTracks();for(var i=0;i<tracks.length;i++){if(tracks[i]!==this){tracks[i].removeCue(cue);}}this.cues_.push(cue);this.cues.setCues_(this.cues_);};/**
   * Remove a cue from our internal list
   *
   * @param {TextTrack~Cue} removeCue
   *        The cue to remove from our internal list
   */TextTrack.prototype.removeCue=function removeCue(_removeCue){var i=this.cues_.length;while(i--){var cue=this.cues_[i];if(cue===_removeCue||cue.originalCue_&&cue.originalCue_===_removeCue){this.cues_.splice(i,1);this.cues.setCues_(this.cues_);break;}}};return TextTrack;}(Track$1);/**
 * cuechange - One or more cues in the track have become active or stopped being active.
 */TextTrack.prototype.allowedEvents_={cuechange:'cuechange'};/**
 * A representation of a single `AudioTrack`. If it is part of an {@link AudioTrackList}
 * only one `AudioTrack` in the list will be enabled at a time.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotrack}
 * @extends Track
 */var AudioTrack=function(_Track){inherits$1(AudioTrack,_Track);/**
   * Create an instance of this class.
   *
   * @param {Object} [options={}]
   *        Object of option names and values
   *
   * @param {AudioTrack~Kind} [options.kind='']
   *        A valid audio track kind
   *
   * @param {string} [options.id='vjs_track_' + Guid.newGUID()]
   *        A unique id for this AudioTrack.
   *
   * @param {string} [options.label='']
   *        The menu label for this track.
   *
   * @param {string} [options.language='']
   *        A valid two character language code.
   *
   * @param {boolean} [options.enabled]
   *        If this track is the one that is currently playing. If this track is part of
   *        an {@link AudioTrackList}, only one {@link AudioTrack} will be enabled.
   */function AudioTrack(){var _this,_ret;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,AudioTrack);var settings=mergeOptions(options,{kind:AudioTrackKind[options.kind]||''});// on IE8 this will be a document element
// for every other browser this will be a normal object
var track=(_this=possibleConstructorReturn(this,_Track.call(this,settings)),_this);var enabled=false;if(IS_IE8){for(var prop in AudioTrack.prototype){if(prop!=='constructor'){track[prop]=AudioTrack.prototype[prop];}}}/**
     * @memberof AudioTrack
     * @member {boolean} enabled
     *         If this `AudioTrack` is enabled or not. When setting this will
     *         fire {@link AudioTrack#enabledchange} if the state of enabled is changed.
     * @instance
     *
     * @fires VideoTrack#selectedchange
     */Object.defineProperty(track,'enabled',{get:function get$$1(){return enabled;},set:function set$$1(newEnabled){// an invalid or unchanged value
if(typeof newEnabled!=='boolean'||newEnabled===enabled){return;}enabled=newEnabled;/**
         * An event that fires when enabled changes on this track. This allows
         * the AudioTrackList that holds this track to act accordingly.
         *
         * > Note: This is not part of the spec! Native tracks will do
         *         this internally without an event.
         *
         * @event AudioTrack#enabledchange
         * @type {EventTarget~Event}
         */this.trigger('enabledchange');}});// if the user sets this track to selected then
// set selected to that true value otherwise
// we keep it false
if(settings.enabled){track.enabled=settings.enabled;}track.loaded_=true;return _ret=track,possibleConstructorReturn(_this,_ret);}return AudioTrack;}(Track$1);/**
 * A representation of a single `VideoTrack`.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotrack}
 * @extends Track
 */var VideoTrack=function(_Track){inherits$1(VideoTrack,_Track);/**
   * Create an instance of this class.
   *
   * @param {Object} [options={}]
   *        Object of option names and values
   *
   * @param {string} [options.kind='']
   *        A valid {@link VideoTrack~Kind}
   *
   * @param {string} [options.id='vjs_track_' + Guid.newGUID()]
   *        A unique id for this AudioTrack.
   *
   * @param {string} [options.label='']
   *        The menu label for this track.
   *
   * @param {string} [options.language='']
   *        A valid two character language code.
   *
   * @param {boolean} [options.selected]
   *        If this track is the one that is currently playing.
   */function VideoTrack(){var _this,_ret;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,VideoTrack);var settings=mergeOptions(options,{kind:VideoTrackKind[options.kind]||''});// on IE8 this will be a document element
// for every other browser this will be a normal object
var track=(_this=possibleConstructorReturn(this,_Track.call(this,settings)),_this);var selected=false;if(IS_IE8){for(var prop in VideoTrack.prototype){if(prop!=='constructor'){track[prop]=VideoTrack.prototype[prop];}}}/**
     * @memberof VideoTrack
     * @member {boolean} selected
     *         If this `VideoTrack` is selected or not. When setting this will
     *         fire {@link VideoTrack#selectedchange} if the state of selected changed.
     * @instance
     *
     * @fires VideoTrack#selectedchange
     */Object.defineProperty(track,'selected',{get:function get$$1(){return selected;},set:function set$$1(newSelected){// an invalid or unchanged value
if(typeof newSelected!=='boolean'||newSelected===selected){return;}selected=newSelected;/**
         * An event that fires when selected changes on this track. This allows
         * the VideoTrackList that holds this track to act accordingly.
         *
         * > Note: This is not part of the spec! Native tracks will do
         *         this internally without an event.
         *
         * @event VideoTrack#selectedchange
         * @type {EventTarget~Event}
         */this.trigger('selectedchange');}});// if the user sets this track to selected then
// set selected to that true value otherwise
// we keep it false
if(settings.selected){track.selected=settings.selected;}return _ret=track,possibleConstructorReturn(_this,_ret);}return VideoTrack;}(Track$1);/**
 * @file html-track-element.js
 *//**
 * @memberof HTMLTrackElement
 * @typedef {HTMLTrackElement~ReadyState}
 * @enum {number}
 */var NONE$1=0;var LOADING=1;var LOADED=2;var ERROR=3;/**
 * A single track represented in the DOM.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#htmltrackelement}
 * @extends EventTarget
 */var HTMLTrackElement=function(_EventTarget){inherits$1(HTMLTrackElement,_EventTarget);/**
   * Create an instance of this class.
   *
   * @param {Object} options={}
   *        Object of option names and values
   *
   * @param {Tech} options.tech
   *        A reference to the tech that owns this HTMLTrackElement.
   *
   * @param {TextTrack~Kind} [options.kind='subtitles']
   *        A valid text track kind.
   *
   * @param {TextTrack~Mode} [options.mode='disabled']
   *        A valid text track mode.
   *
   * @param {string} [options.id='vjs_track_' + Guid.newGUID()]
   *        A unique id for this TextTrack.
   *
   * @param {string} [options.label='']
   *        The menu label for this track.
   *
   * @param {string} [options.language='']
   *        A valid two character language code.
   *
   * @param {string} [options.srclang='']
   *        A valid two character language code. An alternative, but deprioritized
   *        vesion of `options.language`
   *
   * @param {string} [options.src]
   *        A url to TextTrack cues.
   *
   * @param {boolean} [options.default]
   *        If this track should default to on or off.
   */function HTMLTrackElement(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,HTMLTrackElement);var _this=possibleConstructorReturn(this,_EventTarget.call(this));var readyState=void 0;var trackElement=_this;// eslint-disable-line
if(IS_IE8){trackElement=document$1.createElement('custom');for(var prop in HTMLTrackElement.prototype){if(prop!=='constructor'){trackElement[prop]=HTMLTrackElement.prototype[prop];}}}var track=new TextTrack(options);trackElement.kind=track.kind;trackElement.src=track.src;trackElement.srclang=track.language;trackElement.label=track.label;trackElement['default']=track['default'];/**
     * @memberof HTMLTrackElement
     * @member {HTMLTrackElement~ReadyState} readyState
     *         The current ready state of the track element.
     * @instance
     */Object.defineProperty(trackElement,'readyState',{get:function get$$1(){return readyState;}});/**
     * @memberof HTMLTrackElement
     * @member {TextTrack} track
     *         The underlying TextTrack object.
     * @instance
     *
     */Object.defineProperty(trackElement,'track',{get:function get$$1(){return track;}});readyState=NONE$1;/**
     * @listens TextTrack#loadeddata
     * @fires HTMLTrackElement#load
     */track.addEventListener('loadeddata',function(){readyState=LOADED;trackElement.trigger({type:'load',target:trackElement});});if(IS_IE8){var _ret;return _ret=trackElement,possibleConstructorReturn(_this,_ret);}return _this;}return HTMLTrackElement;}(EventTarget);HTMLTrackElement.prototype.allowedEvents_={load:'load'};HTMLTrackElement.NONE=NONE$1;HTMLTrackElement.LOADING=LOADING;HTMLTrackElement.LOADED=LOADED;HTMLTrackElement.ERROR=ERROR;/*
 * This file contains all track properties that are used in
 * player.js, tech.js, html5.js and possibly other techs in the future.
 */var NORMAL$1={audio:{ListClass:AudioTrackList,TrackClass:AudioTrack,capitalName:'Audio'},video:{ListClass:VideoTrackList,TrackClass:VideoTrack,capitalName:'Video'},text:{ListClass:TextTrackList,TrackClass:TextTrack,capitalName:'Text'}};Object.keys(NORMAL$1).forEach(function(type){NORMAL$1[type].getterName=type+'Tracks';NORMAL$1[type].privateName=type+'Tracks_';});var REMOTE={remoteText:{ListClass:TextTrackList,TrackClass:TextTrack,capitalName:'RemoteText',getterName:'remoteTextTracks',privateName:'remoteTextTracks_'},remoteTextEl:{ListClass:HtmlTrackElementList,TrackClass:HTMLTrackElement,capitalName:'RemoteTextTrackEls',getterName:'remoteTextTrackEls',privateName:'remoteTextTrackEls_'}};var ALL=mergeOptions(NORMAL$1,REMOTE);REMOTE.names=Object.keys(REMOTE);NORMAL$1.names=Object.keys(NORMAL$1);ALL.names=[].concat(REMOTE.names).concat(NORMAL$1.names);/**
 * @file tech.js
 *//**
 * An Object containing a structure like: `{src: 'url', type: 'mimetype'}` or string
 * that just contains the src url alone.
 * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};`
   * `var SourceString = 'http://example.com/some-video.mp4';`
 *
 * @typedef {Object|string} Tech~SourceObject
 *
 * @property {string} src
 *           The url to the source
 *
 * @property {string} type
 *           The mime type of the source
 *//**
 * A function used by {@link Tech} to create a new {@link TextTrack}.
 *
 * @private
 *
 * @param {Tech} self
 *        An instance of the Tech class.
 *
 * @param {string} kind
 *        `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)
 *
 * @param {string} [label]
 *        Label to identify the text track
 *
 * @param {string} [language]
 *        Two letter language abbreviation
 *
 * @param {Object} [options={}]
 *        An object with additional text track options
 *
 * @return {TextTrack}
 *          The text track that was created.
 */function createTrackHelper(self,kind,label,language){var options=arguments.length>4&&arguments[4]!==undefined?arguments[4]:{};var tracks=self.textTracks();options.kind=kind;if(label){options.label=label;}if(language){options.language=language;}options.tech=self;var track=new ALL.text.TrackClass(options);tracks.addTrack(track);return track;}/**
 * This is the base class for media playback technology controllers, such as
 * {@link Flash} and {@link HTML5}
 *
 * @extends Component
 */var Tech=function(_Component){inherits$1(Tech,_Component);/**
   * Create an instance of this Tech.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   *
   * @param {Component~ReadyCallback} ready
   *        Callback function to call when the `HTML5` Tech is ready.
   */function Tech(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var ready=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(){};classCallCheck(this,Tech);// we don't want the tech to report user activity automatically.
// This is done manually in addControlsListeners
options.reportTouchActivity=false;// keep track of whether the current source has played at all to
// implement a very limited played()
var _this=possibleConstructorReturn(this,_Component.call(this,null,options,ready));_this.hasStarted_=false;_this.on('playing',function(){this.hasStarted_=true;});_this.on('loadstart',function(){this.hasStarted_=false;});ALL.names.forEach(function(name){var props=ALL[name];if(options&&options[props.getterName]){_this[props.privateName]=options[props.getterName];}});// Manually track progress in cases where the browser/flash player doesn't report it.
if(!_this.featuresProgressEvents){_this.manualProgressOn();}// Manually track timeupdates in cases where the browser/flash player doesn't report it.
if(!_this.featuresTimeupdateEvents){_this.manualTimeUpdatesOn();}['Text','Audio','Video'].forEach(function(track){if(options['native'+track+'Tracks']===false){_this['featuresNative'+track+'Tracks']=false;}});if(options.nativeCaptions===false||options.nativeTextTracks===false){_this.featuresNativeTextTracks=false;}else if(options.nativeCaptions===true||options.nativeTextTracks===true){_this.featuresNativeTextTracks=true;}if(!_this.featuresNativeTextTracks){_this.emulateTextTracks();}_this.autoRemoteTextTracks_=new ALL.text.ListClass();_this.initTrackListeners();// Turn on component tap events only if not using native controls
if(!options.nativeControlsForTouch){_this.emitTapEvents();}if(_this.constructor){_this.name_=_this.constructor.name||'Unknown Tech';}return _this;}/**
   * A special function to trigger source set in a way that will allow player
   * to re-trigger if the player or tech are not ready yet.
   *
   * @fires Tech#sourceset
   * @param {string} src The source string at the time of the source changing.
   */Tech.prototype.triggerSourceset=function triggerSourceset(src){var _this2=this;if(!this.isReady_){// on initial ready we have to trigger source set
// 1ms after ready so that player can watch for it.
this.one('ready',function(){return _this2.setTimeout(function(){return _this2.triggerSourceset(src);},1);});}/**
     * Fired when the source is set on the tech causing the media element
     * to reload.
     *
     * @see {@link Player#event:sourceset}
     * @event Tech#sourceset
     * @type {EventTarget~Event}
     */this.trigger({src:src,type:'sourceset'});};/* Fallbacks for unsupported event types
  ================================================================================ *//**
   * Polyfill the `progress` event for browsers that don't support it natively.
   *
   * @see {@link Tech#trackProgress}
   */Tech.prototype.manualProgressOn=function manualProgressOn(){this.on('durationchange',this.onDurationChange);this.manualProgress=true;// Trigger progress watching when a source begins loading
this.one('ready',this.trackProgress);};/**
   * Turn off the polyfill for `progress` events that was created in
   * {@link Tech#manualProgressOn}
   */Tech.prototype.manualProgressOff=function manualProgressOff(){this.manualProgress=false;this.stopTrackingProgress();this.off('durationchange',this.onDurationChange);};/**
   * This is used to trigger a `progress` event when the buffered percent changes. It
   * sets an interval function that will be called every 500 milliseconds to check if the
   * buffer end percent has changed.
   *
   * > This function is called by {@link Tech#manualProgressOn}
   *
   * @param {EventTarget~Event} event
   *        The `ready` event that caused this to run.
   *
   * @listens Tech#ready
   * @fires Tech#progress
   */Tech.prototype.trackProgress=function trackProgress(event){this.stopTrackingProgress();this.progressInterval=this.setInterval(bind$2(this,function(){// Don't trigger unless buffered amount is greater than last time
var numBufferedPercent=this.bufferedPercent();if(this.bufferedPercent_!==numBufferedPercent){/**
         * See {@link Player#progress}
         *
         * @event Tech#progress
         * @type {EventTarget~Event}
         */this.trigger('progress');}this.bufferedPercent_=numBufferedPercent;if(numBufferedPercent===1){this.stopTrackingProgress();}}),500);};/**
   * Update our internal duration on a `durationchange` event by calling
   * {@link Tech#duration}.
   *
   * @param {EventTarget~Event} event
   *        The `durationchange` event that caused this to run.
   *
   * @listens Tech#durationchange
   */Tech.prototype.onDurationChange=function onDurationChange(event){this.duration_=this.duration();};/**
   * Get and create a `TimeRange` object for buffering.
   *
   * @return {TimeRange}
   *         The time range object that was created.
   */Tech.prototype.buffered=function buffered(){return createTimeRanges(0,0);};/**
   * Get the percentage of the current video that is currently buffered.
   *
   * @return {number}
   *         A number from 0 to 1 that represents the decimal percentage of the
   *         video that is buffered.
   *
   */Tech.prototype.bufferedPercent=function bufferedPercent$$1(){return bufferedPercent(this.buffered(),this.duration_);};/**
   * Turn off the polyfill for `progress` events that was created in
   * {@link Tech#manualProgressOn}
   * Stop manually tracking progress events by clearing the interval that was set in
   * {@link Tech#trackProgress}.
   */Tech.prototype.stopTrackingProgress=function stopTrackingProgress(){this.clearInterval(this.progressInterval);};/**
   * Polyfill the `timeupdate` event for browsers that don't support it.
   *
   * @see {@link Tech#trackCurrentTime}
   */Tech.prototype.manualTimeUpdatesOn=function manualTimeUpdatesOn(){this.manualTimeUpdates=true;this.on('play',this.trackCurrentTime);this.on('pause',this.stopTrackingCurrentTime);};/**
   * Turn off the polyfill for `timeupdate` events that was created in
   * {@link Tech#manualTimeUpdatesOn}
   */Tech.prototype.manualTimeUpdatesOff=function manualTimeUpdatesOff(){this.manualTimeUpdates=false;this.stopTrackingCurrentTime();this.off('play',this.trackCurrentTime);this.off('pause',this.stopTrackingCurrentTime);};/**
   * Sets up an interval function to track current time and trigger `timeupdate` every
   * 250 milliseconds.
   *
   * @listens Tech#play
   * @triggers Tech#timeupdate
   */Tech.prototype.trackCurrentTime=function trackCurrentTime(){if(this.currentTimeInterval){this.stopTrackingCurrentTime();}this.currentTimeInterval=this.setInterval(function(){/**
       * Triggered at an interval of 250ms to indicated that time is passing in the video.
       *
       * @event Tech#timeupdate
       * @type {EventTarget~Event}
       */this.trigger({type:'timeupdate',target:this,manuallyTriggered:true});// 42 = 24 fps // 250 is what Webkit uses // FF uses 15
},250);};/**
   * Stop the interval function created in {@link Tech#trackCurrentTime} so that the
   * `timeupdate` event is no longer triggered.
   *
   * @listens {Tech#pause}
   */Tech.prototype.stopTrackingCurrentTime=function stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval);// #1002 - if the video ends right before the next timeupdate would happen,
// the progress bar won't make it all the way to the end
this.trigger({type:'timeupdate',target:this,manuallyTriggered:true});};/**
   * Turn off all event polyfills, clear the `Tech`s {@link AudioTrackList},
   * {@link VideoTrackList}, and {@link TextTrackList}, and dispose of this Tech.
   *
   * @fires Component#dispose
   */Tech.prototype.dispose=function dispose(){// clear out all tracks because we can't reuse them between techs
this.clearTracks(NORMAL$1.names);// Turn off any manual progress or timeupdate tracking
if(this.manualProgress){this.manualProgressOff();}if(this.manualTimeUpdates){this.manualTimeUpdatesOff();}_Component.prototype.dispose.call(this);};/**
   * Clear out a single `TrackList` or an array of `TrackLists` given their names.
   *
   * > Note: Techs without source handlers should call this between sources for `video`
   *         & `audio` tracks. You don't want to use them between tracks!
   *
   * @param {string[]|string} types
   *        TrackList names to clear, valid names are `video`, `audio`, and
   *        `text`.
   */Tech.prototype.clearTracks=function clearTracks(types){var _this3=this;types=[].concat(types);// clear out all tracks because we can't reuse them between techs
types.forEach(function(type){var list=_this3[type+'Tracks']()||[];var i=list.length;while(i--){var track=list[i];if(type==='text'){_this3.removeRemoteTextTrack(track);}list.removeTrack(track);}});};/**
   * Remove any TextTracks added via addRemoteTextTrack that are
   * flagged for automatic garbage collection
   */Tech.prototype.cleanupAutoTextTracks=function cleanupAutoTextTracks(){var list=this.autoRemoteTextTracks_||[];var i=list.length;while(i--){var track=list[i];this.removeRemoteTextTrack(track);}};/**
   * Reset the tech, which will removes all sources and reset the internal readyState.
   *
   * @abstract
   */Tech.prototype.reset=function reset(){};/**
   * Get or set an error on the Tech.
   *
   * @param {MediaError} [err]
   *        Error to set on the Tech
   *
   * @return {MediaError|null}
   *         The current error object on the tech, or null if there isn't one.
   */Tech.prototype.error=function error(err){if(err!==undefined){this.error_=new MediaError(err);this.trigger('error');}return this.error_;};/**
   * Returns the `TimeRange`s that have been played through for the current source.
   *
   * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`.
   *         It only checks wether the source has played at all or not.
   *
   * @return {TimeRange}
   *         - A single time range if this video has played
   *         - An empty set of ranges if not.
   */Tech.prototype.played=function played(){if(this.hasStarted_){return createTimeRanges(0,0);}return createTimeRanges();};/**
   * Causes a manual time update to occur if {@link Tech#manualTimeUpdatesOn} was
   * previously called.
   *
   * @fires Tech#timeupdate
   */Tech.prototype.setCurrentTime=function setCurrentTime(){// improve the accuracy of manual timeupdates
if(this.manualTimeUpdates){/**
       * A manual `timeupdate` event.
       *
       * @event Tech#timeupdate
       * @type {EventTarget~Event}
       */this.trigger({type:'timeupdate',target:this,manuallyTriggered:true});}};/**
   * Turn on listeners for {@link VideoTrackList}, {@link {AudioTrackList}, and
   * {@link TextTrackList} events.
   *
   * This adds {@link EventTarget~EventListeners} for `addtrack`, and  `removetrack`.
   *
   * @fires Tech#audiotrackchange
   * @fires Tech#videotrackchange
   * @fires Tech#texttrackchange
   */Tech.prototype.initTrackListeners=function initTrackListeners(){var _this4=this;/**
     * Triggered when tracks are added or removed on the Tech {@link AudioTrackList}
     *
     * @event Tech#audiotrackchange
     * @type {EventTarget~Event}
     *//**
     * Triggered when tracks are added or removed on the Tech {@link VideoTrackList}
     *
     * @event Tech#videotrackchange
     * @type {EventTarget~Event}
     *//**
     * Triggered when tracks are added or removed on the Tech {@link TextTrackList}
     *
     * @event Tech#texttrackchange
     * @type {EventTarget~Event}
     */NORMAL$1.names.forEach(function(name){var props=NORMAL$1[name];var trackListChanges=function trackListChanges(){_this4.trigger(name+'trackchange');};var tracks=_this4[props.getterName]();tracks.addEventListener('removetrack',trackListChanges);tracks.addEventListener('addtrack',trackListChanges);_this4.on('dispose',function(){tracks.removeEventListener('removetrack',trackListChanges);tracks.removeEventListener('addtrack',trackListChanges);});});};/**
   * Emulate TextTracks using vtt.js if necessary
   *
   * @fires Tech#vttjsloaded
   * @fires Tech#vttjserror
   */Tech.prototype.addWebVttScript_=function addWebVttScript_(){var _this5=this;if(window$1.WebVTT){return;}// Initially, Tech.el_ is a child of a dummy-div wait until the Component system
// signals that the Tech is ready at which point Tech.el_ is part of the DOM
// before inserting the WebVTT script
if(document$1.body.contains(this.el())){// load via require if available and vtt.js script location was not passed in
// as an option. novtt builds will turn the above require call into an empty object
// which will cause this if check to always fail.
if(!this.options_['vtt.js']&&isPlain(vtt)&&Object.keys(vtt).length>0){this.trigger('vttjsloaded');return;}// load vtt.js via the script location option or the cdn of no location was
// passed in
var script=document$1.createElement('script');script.src=this.options_['vtt.js']||'https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js';script.onload=function(){/**
         * Fired when vtt.js is loaded.
         *
         * @event Tech#vttjsloaded
         * @type {EventTarget~Event}
         */_this5.trigger('vttjsloaded');};script.onerror=function(){/**
         * Fired when vtt.js was not loaded due to an error
         *
         * @event Tech#vttjsloaded
         * @type {EventTarget~Event}
         */_this5.trigger('vttjserror');};this.on('dispose',function(){script.onload=null;script.onerror=null;});// but have not loaded yet and we set it to true before the inject so that
// we don't overwrite the injected window.WebVTT if it loads right away
window$1.WebVTT=true;this.el().parentNode.appendChild(script);}else {this.ready(this.addWebVttScript_);}};/**
   * Emulate texttracks
   *
   */Tech.prototype.emulateTextTracks=function emulateTextTracks(){var _this6=this;var tracks=this.textTracks();var remoteTracks=this.remoteTextTracks();var handleAddTrack=function handleAddTrack(e){return tracks.addTrack(e.track);};var handleRemoveTrack=function handleRemoveTrack(e){return tracks.removeTrack(e.track);};remoteTracks.on('addtrack',handleAddTrack);remoteTracks.on('removetrack',handleRemoveTrack);this.addWebVttScript_();var updateDisplay=function updateDisplay(){return _this6.trigger('texttrackchange');};var textTracksChanges=function textTracksChanges(){updateDisplay();for(var i=0;i<tracks.length;i++){var track=tracks[i];track.removeEventListener('cuechange',updateDisplay);if(track.mode==='showing'){track.addEventListener('cuechange',updateDisplay);}}};textTracksChanges();tracks.addEventListener('change',textTracksChanges);tracks.addEventListener('addtrack',textTracksChanges);tracks.addEventListener('removetrack',textTracksChanges);this.on('dispose',function(){remoteTracks.off('addtrack',handleAddTrack);remoteTracks.off('removetrack',handleRemoveTrack);tracks.removeEventListener('change',textTracksChanges);tracks.removeEventListener('addtrack',textTracksChanges);tracks.removeEventListener('removetrack',textTracksChanges);for(var i=0;i<tracks.length;i++){var track=tracks[i];track.removeEventListener('cuechange',updateDisplay);}});};/**
   * Create and returns a remote {@link TextTrack} object.
   *
   * @param {string} kind
   *        `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)
   *
   * @param {string} [label]
   *        Label to identify the text track
   *
   * @param {string} [language]
   *        Two letter language abbreviation
   *
   * @return {TextTrack}
   *         The TextTrack that gets created.
   */Tech.prototype.addTextTrack=function addTextTrack(kind,label,language){if(!kind){throw new Error('TextTrack kind is required but was not provided');}return createTrackHelper(this,kind,label,language);};/**
   * Create an emulated TextTrack for use by addRemoteTextTrack
   *
   * This is intended to be overridden by classes that inherit from
   * Tech in order to create native or custom TextTracks.
   *
   * @param {Object} options
   *        The object should contain the options to initialize the TextTrack with.
   *
   * @param {string} [options.kind]
   *        `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata).
   *
   * @param {string} [options.label].
   *        Label to identify the text track
   *
   * @param {string} [options.language]
   *        Two letter language abbreviation.
   *
   * @return {HTMLTrackElement}
   *         The track element that gets created.
   */Tech.prototype.createRemoteTextTrack=function createRemoteTextTrack(options){var track=mergeOptions(options,{tech:this});return new REMOTE.remoteTextEl.TrackClass(track);};/**
   * Creates a remote text track object and returns an html track element.
   *
   * > Note: This can be an emulated {@link HTMLTrackElement} or a native one.
   *
   * @param {Object} options
   *        See {@link Tech#createRemoteTextTrack} for more detailed properties.
   *
   * @param {boolean} [manualCleanup=true]
   *        - When false: the TextTrack will be automatically removed from the video
   *          element whenever the source changes
   *        - When True: The TextTrack will have to be cleaned up manually
   *
   * @return {HTMLTrackElement}
   *         An Html Track Element.
   *
   * @deprecated The default functionality for this function will be equivalent
   *             to "manualCleanup=false" in the future. The manualCleanup parameter will
   *             also be removed.
   */Tech.prototype.addRemoteTextTrack=function addRemoteTextTrack(){var _this7=this;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var manualCleanup=arguments[1];var htmlTrackElement=this.createRemoteTextTrack(options);if(manualCleanup!==true&&manualCleanup!==false){// deprecation warning
log$2.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js');manualCleanup=true;}// store HTMLTrackElement and TextTrack to remote list
this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);this.remoteTextTracks().addTrack(htmlTrackElement.track);if(manualCleanup!==true){// create the TextTrackList if it doesn't exist
this.ready(function(){return _this7.autoRemoteTextTracks_.addTrack(htmlTrackElement.track);});}return htmlTrackElement;};/**
   * Remove a remote text track from the remote `TextTrackList`.
   *
   * @param {TextTrack} track
   *        `TextTrack` to remove from the `TextTrackList`
   */Tech.prototype.removeRemoteTextTrack=function removeRemoteTextTrack(track){var trackElement=this.remoteTextTrackEls().getTrackElementByTrack_(track);// remove HTMLTrackElement and TextTrack from remote list
this.remoteTextTrackEls().removeTrackElement_(trackElement);this.remoteTextTracks().removeTrack(track);this.autoRemoteTextTracks_.removeTrack(track);};/**
   * Gets available media playback quality metrics as specified by the W3C's Media
   * Playback Quality API.
   *
   * @see [Spec]{@link https://wicg.github.io/media-playback-quality}
   *
   * @return {Object}
   *         An object with supported media playback quality metrics
   *
   * @abstract
   */Tech.prototype.getVideoPlaybackQuality=function getVideoPlaybackQuality(){return {};};/**
   * A method to set a poster from a `Tech`.
   *
   * @abstract
   */Tech.prototype.setPoster=function setPoster(){};/**
   * A method to check for the presence of the 'playsinine' <video> attribute.
   *
   * @abstract
   */Tech.prototype.playsinline=function playsinline(){};/**
   * A method to set or unset the 'playsinine' <video> attribute.
   *
   * @abstract
   */Tech.prototype.setPlaysinline=function setPlaysinline(){};/*
   * Check if the tech can support the given mime-type.
   *
   * The base tech does not support any type, but source handlers might
   * overwrite this.
   *
   * @param  {string} type
   *         The mimetype to check for support
   *
   * @return {string}
   *         'probably', 'maybe', or empty string
   *
   * @see [Spec]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canPlayType}
   *
   * @abstract
   */Tech.prototype.canPlayType=function canPlayType(){return '';};/**
   * Check if the type is supported by this tech.
   *
   * The base tech does not support any type, but source handlers might
   * overwrite this.
   *
   * @param {string} type
   *        The media type to check
   * @return {string} Returns the native video element's response
   */Tech.canPlayType=function canPlayType(){return '';};/**
   * Check if the tech can support the given source
   * @param {Object} srcObj
   *        The source object
   * @param {Object} options
   *        The options passed to the tech
   * @return {string} 'probably', 'maybe', or '' (empty string)
   */Tech.canPlaySource=function canPlaySource(srcObj,options){return Tech.canPlayType(srcObj.type);};/*
   * Return whether the argument is a Tech or not.
   * Can be passed either a Class like `Html5` or a instance like `player.tech_`
   *
   * @param {Object} component
   *        The item to check
   *
   * @return {boolean}
   *         Whether it is a tech or not
   *         - True if it is a tech
   *         - False if it is not
   */Tech.isTech=function isTech(component){return component.prototype instanceof Tech||component instanceof Tech||component===Tech;};/**
   * Registers a `Tech` into a shared list for videojs.
   *
   * @param {string} name
   *        Name of the `Tech` to register.
   *
   * @param {Object} tech
   *        The `Tech` class to register.
   */Tech.registerTech=function registerTech(name,tech){if(!Tech.techs_){Tech.techs_={};}if(!Tech.isTech(tech)){throw new Error('Tech '+name+' must be a Tech');}if(!Tech.canPlayType){throw new Error('Techs must have a static canPlayType method on them');}if(!Tech.canPlaySource){throw new Error('Techs must have a static canPlaySource method on them');}name=toTitleCase(name);Tech.techs_[name]=tech;if(name!=='Tech'){// camel case the techName for use in techOrder
Tech.defaultTechOrder_.push(name);}return tech;};/**
   * Get a `Tech` from the shared list by name.
   *
   * @param {string} name
   *        `camelCase` or `TitleCase` name of the Tech to get
   *
   * @return {Tech|undefined}
   *         The `Tech` or undefined if there was no tech with the name requsted.
   */Tech.getTech=function getTech(name){if(!name){return;}name=toTitleCase(name);if(Tech.techs_&&Tech.techs_[name]){return Tech.techs_[name];}if(window$1&&window$1.videojs&&window$1.videojs[name]){log$2.warn('The '+name+' tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)');return window$1.videojs[name];}};return Tech;}(Component);/**
 * Get the {@link VideoTrackList}
 *
 * @returns {VideoTrackList}
 * @method Tech.prototype.videoTracks
 *//**
 * Get the {@link AudioTrackList}
 *
 * @returns {AudioTrackList}
 * @method Tech.prototype.audioTracks
 *//**
 * Get the {@link TextTrackList}
 *
 * @returns {TextTrackList}
 * @method Tech.prototype.textTracks
 *//**
 * Get the remote element {@link TextTrackList}
 *
 * @returns {TextTrackList}
 * @method Tech.prototype.remoteTextTracks
 *//**
 * Get the remote element {@link HtmlTrackElementList}
 *
 * @returns {HtmlTrackElementList}
 * @method Tech.prototype.remoteTextTrackEls
 */ALL.names.forEach(function(name){var props=ALL[name];Tech.prototype[props.getterName]=function(){this[props.privateName]=this[props.privateName]||new props.ListClass();return this[props.privateName];};});/**
 * List of associated text tracks
 *
 * @type {TextTrackList}
 * @private
 * @property Tech#textTracks_
 *//**
 * List of associated audio tracks.
 *
 * @type {AudioTrackList}
 * @private
 * @property Tech#audioTracks_
 *//**
 * List of associated video tracks.
 *
 * @type {VideoTrackList}
 * @private
 * @property Tech#videoTracks_
 *//**
 * Boolean indicating wether the `Tech` supports volume control.
 *
 * @type {boolean}
 * @default
 */Tech.prototype.featuresVolumeControl=true;/**
 * Boolean indicating whether the `Tech` supports muting volume.
 *
 * @type {bolean}
 * @default
 */Tech.prototype.featuresMuteControl=true;/**
 * Boolean indicating whether the `Tech` supports fullscreen resize control.
 * Resizing plugins using request fullscreen reloads the plugin
 *
 * @type {boolean}
 * @default
 */Tech.prototype.featuresFullscreenResize=false;/**
 * Boolean indicating wether the `Tech` supports changing the speed at which the video
 * plays. Examples:
 *   - Set player to play 2x (twice) as fast
 *   - Set player to play 0.5x (half) as fast
 *
 * @type {boolean}
 * @default
 */Tech.prototype.featuresPlaybackRate=false;/**
 * Boolean indicating wether the `Tech` supports the `progress` event. This is currently
 * not triggered by video-js-swf. This will be used to determine if
 * {@link Tech#manualProgressOn} should be called.
 *
 * @type {boolean}
 * @default
 */Tech.prototype.featuresProgressEvents=false;/**
 * Boolean indicating wether the `Tech` supports the `sourceset` event.
 *
 * A tech should set this to `true` and then use {@link Tech#triggerSourceset}
 * to trigger a {@link Tech#event:sourceset} at the earliest time after getting
 * a new source.
 *
 * @type {boolean}
 * @default
 */Tech.prototype.featuresSourceset=false;/**
 * Boolean indicating wether the `Tech` supports the `timeupdate` event. This is currently
 * not triggered by video-js-swf. This will be used to determine if
 * {@link Tech#manualTimeUpdates} should be called.
 *
 * @type {boolean}
 * @default
 */Tech.prototype.featuresTimeupdateEvents=false;/**
 * Boolean indicating wether the `Tech` supports the native `TextTrack`s.
 * This will help us integrate with native `TextTrack`s if the browser supports them.
 *
 * @type {boolean}
 * @default
 */Tech.prototype.featuresNativeTextTracks=false;/**
 * A functional mixin for techs that want to use the Source Handler pattern.
 * Source handlers are scripts for handling specific formats.
 * The source handler pattern is used for adaptive formats (HLS, DASH) that
 * manually load video data and feed it into a Source Buffer (Media Source Extensions)
 * Example: `Tech.withSourceHandlers.call(MyTech);`
 *
 * @param {Tech} _Tech
 *        The tech to add source handler functions to.
 *
 * @mixes Tech~SourceHandlerAdditions
 */Tech.withSourceHandlers=function(_Tech){/**
   * Register a source handler
   *
   * @param {Function} handler
   *        The source handler class
   *
   * @param {number} [index]
   *        Register it at the following index
   */_Tech.registerSourceHandler=function(handler,index){var handlers=_Tech.sourceHandlers;if(!handlers){handlers=_Tech.sourceHandlers=[];}if(index===undefined){// add to the end of the list
index=handlers.length;}handlers.splice(index,0,handler);};/**
   * Check if the tech can support the given type. Also checks the
   * Techs sourceHandlers.
   *
   * @param {string} type
   *         The mimetype to check.
   *
   * @return {string}
   *         'probably', 'maybe', or '' (empty string)
   */_Tech.canPlayType=function(type){var handlers=_Tech.sourceHandlers||[];var can=void 0;for(var i=0;i<handlers.length;i++){can=handlers[i].canPlayType(type);if(can){return can;}}return '';};/**
   * Returns the first source handler that supports the source.
   *
   * TODO: Answer question: should 'probably' be prioritized over 'maybe'
   *
   * @param {Tech~SourceObject} source
   *        The source object
   *
   * @param {Object} options
   *        The options passed to the tech
   *
   * @return {SourceHandler|null}
   *          The first source handler that supports the source or null if
   *          no SourceHandler supports the source
   */_Tech.selectSourceHandler=function(source,options){var handlers=_Tech.sourceHandlers||[];var can=void 0;for(var i=0;i<handlers.length;i++){can=handlers[i].canHandleSource(source,options);if(can){return handlers[i];}}return null;};/**
   * Check if the tech can support the given source.
   *
   * @param {Tech~SourceObject} srcObj
   *        The source object
   *
   * @param {Object} options
   *        The options passed to the tech
   *
   * @return {string}
   *         'probably', 'maybe', or '' (empty string)
   */_Tech.canPlaySource=function(srcObj,options){var sh=_Tech.selectSourceHandler(srcObj,options);if(sh){return sh.canHandleSource(srcObj,options);}return '';};/**
   * When using a source handler, prefer its implementation of
   * any function normally provided by the tech.
   */var deferrable=['seekable','seeking','duration'];/**
   * A wrapper around {@link Tech#seekable} that will call a `SourceHandler`s seekable
   * function if it exists, with a fallback to the Techs seekable function.
   *
   * @method _Tech.seekable
   *//**
   * A wrapper around {@link Tech#duration} that will call a `SourceHandler`s duration
   * function if it exists, otherwise it will fallback to the techs duration function.
   *
   * @method _Tech.duration
   */deferrable.forEach(function(fnName){var originalFn=this[fnName];if(typeof originalFn!=='function'){return;}this[fnName]=function(){if(this.sourceHandler_&&this.sourceHandler_[fnName]){return this.sourceHandler_[fnName].apply(this.sourceHandler_,arguments);}return originalFn.apply(this,arguments);};},_Tech.prototype);/**
   * Create a function for setting the source using a source object
   * and source handlers.
   * Should never be called unless a source handler was found.
   *
   * @param {Tech~SourceObject} source
   *        A source object with src and type keys
   */_Tech.prototype.setSource=function(source){var sh=_Tech.selectSourceHandler(source,this.options_);if(!sh){// Fall back to a native source hander when unsupported sources are
// deliberately set
if(_Tech.nativeSourceHandler){sh=_Tech.nativeSourceHandler;}else {log$2.error('No source hander found for the current source.');}}// Dispose any existing source handler
this.disposeSourceHandler();this.off('dispose',this.disposeSourceHandler);if(sh!==_Tech.nativeSourceHandler){this.currentSource_=source;}this.sourceHandler_=sh.handleSource(source,this,this.options_);this.on('dispose',this.disposeSourceHandler);};/**
   * Clean up any existing SourceHandlers and listeners when the Tech is disposed.
   *
   * @listens Tech#dispose
   */_Tech.prototype.disposeSourceHandler=function(){// if we have a source and get another one
// then we are loading something new
// than clear all of our current tracks
if(this.currentSource_){this.clearTracks(['audio','video']);this.currentSource_=null;}// always clean up auto-text tracks
this.cleanupAutoTextTracks();if(this.sourceHandler_){if(this.sourceHandler_.dispose){this.sourceHandler_.dispose();}this.sourceHandler_=null;}};};// The base Tech class needs to be registered as a Component. It is the only
// Tech that can be registered as a Component.
Component.registerComponent('Tech',Tech);Tech.registerTech('Tech',Tech);/**
 * A list of techs that should be added to techOrder on Players
 *
 * @private
 */Tech.defaultTechOrder_=[];var middlewares={};var middlewareInstances={};var TERMINATOR={};function use$1(type,middleware){middlewares[type]=middlewares[type]||[];middlewares[type].push(middleware);}function setSource(player,src,next){player.setTimeout(function(){return setSourceHelper(src,middlewares[src.type],next,player);},1);}function setTech(middleware,tech){middleware.forEach(function(mw){return mw.setTech&&mw.setTech(tech);});}/**
 * Calls a getter on the tech first, through each middleware
 * from right to left to the player.
 */function get$1(middleware,tech,method){return middleware.reduceRight(middlewareIterator(method),tech[method]());}/**
 * Takes the argument given to the player and calls the setter method on each
 * middlware from left to right to the tech.
 */function set$1$1(middleware,tech,method,arg){return tech[method](middleware.reduce(middlewareIterator(method),arg));}/**
 * Takes the argument given to the player and calls the `call` version of the method
 * on each middleware from left to right.
 * Then, call the passed in method on the tech and return the result unchanged
 * back to the player, through middleware, this time from right to left.
 */function mediate(middleware,tech,method){var arg=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var callMethod='call'+toTitleCase(method);var middlewareValue=middleware.reduce(middlewareIterator(callMethod),arg);var terminated=middlewareValue===TERMINATOR;var returnValue=terminated?null:tech[method](middlewareValue);executeRight(middleware,method,returnValue,terminated);return returnValue;}var allowedGetters={buffered:1,currentTime:1,duration:1,seekable:1,played:1,paused:1};var allowedSetters={setCurrentTime:1};var allowedMediators={play:1,pause:1};function middlewareIterator(method){return function(value,mw){// if the previous middleware terminated, pass along the termination
if(value===TERMINATOR){return TERMINATOR;}if(mw[method]){return mw[method](value);}return value;};}function executeRight(mws,method,value,terminated){for(var i=mws.length-1;i>=0;i--){var mw=mws[i];if(mw[method]){mw[method](terminated,value);}}}function clearCacheForPlayer(player){middlewareInstances[player.id()]=null;}/**
 * {
 *  [playerId]: [[mwFactory, mwInstance], ...]
 * }
 */function getOrCreateFactory(player,mwFactory){var mws=middlewareInstances[player.id()];var mw=null;if(mws===undefined||mws===null){mw=mwFactory(player);middlewareInstances[player.id()]=[[mwFactory,mw]];return mw;}for(var i=0;i<mws.length;i++){var _mws$i=mws[i],mwf=_mws$i[0],mwi=_mws$i[1];if(mwf!==mwFactory){continue;}mw=mwi;}if(mw===null){mw=mwFactory(player);mws.push([mwFactory,mw]);}return mw;}function setSourceHelper(){var src=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var middleware=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var next=arguments[2];var player=arguments[3];var acc=arguments.length>4&&arguments[4]!==undefined?arguments[4]:[];var lastRun=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;var mwFactory=middleware[0],mwrest=middleware.slice(1);// if mwFactory is a string, then we're at a fork in the road
if(typeof mwFactory==='string'){setSourceHelper(src,middlewares[mwFactory],next,player,acc,lastRun);// if we have an mwFactory, call it with the player to get the mw,
// then call the mw's setSource method
}else if(mwFactory){var mw=getOrCreateFactory(player,mwFactory);// if setSource isn't present, implicitly select this middleware
if(!mw.setSource){acc.push(mw);return setSourceHelper(src,mwrest,next,player,acc,lastRun);}mw.setSource(assign$1({},src),function(err,_src){// something happened, try the next middleware on the current level
// make sure to use the old src
if(err){return setSourceHelper(src,mwrest,next,player,acc,lastRun);}// we've succeeded, now we need to go deeper
acc.push(mw);// if it's the same type, continue down the current chain
// otherwise, we want to go down the new chain
setSourceHelper(_src,src.type===_src.type?mwrest:middlewares[_src.type],next,player,acc,lastRun);});}else if(mwrest.length){setSourceHelper(src,mwrest,next,player,acc,lastRun);}else if(lastRun){next(src,acc);}else {setSourceHelper(src,middlewares['*'],next,player,acc,true);}}/**
 * Mimetypes
 *
 * @see http://hul.harvard.edu/ois/////systems/wax/wax-public-help/mimetypes.htm
 * @typedef Mimetypes~Kind
 * @enum
 */var MimetypesKind={opus:'video/ogg',ogv:'video/ogg',mp4:'video/mp4',mov:'video/mp4',m4v:'video/mp4',mkv:'video/x-matroska',mp3:'audio/mpeg',aac:'audio/aac',oga:'audio/ogg',m3u8:'application/x-mpegURL'};/**
 * Get the mimetype of a given src url if possible
 *
 * @param {string} src
 *        The url to the src
 *
 * @return {string}
 *         return the mimetype if it was known or empty string otherwise
 */var getMimetype=function getMimetype(){var src=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'';var ext=getFileExtension(src);var mimetype=MimetypesKind[ext.toLowerCase()];return mimetype||'';};/**
 * Find the mime type of a given source string if possible. Uses the player
 * source cache.
 *
 * @param {Player} player
 *        The player object
 *
 * @param {string} src
 *        The source string
 *
 * @return {string}
 *         The type that was found
 */var findMimetype=function findMimetype(player,src){if(!src){return '';}// 1. check for the type in the `source` cache
if(player.cache_.source.src===src&&player.cache_.source.type){return player.cache_.source.type;}// 2. see if we have this source in our `currentSources` cache
var matchingSources=player.cache_.sources.filter(function(s){return s.src===src;});if(matchingSources.length){return matchingSources[0].type;}// 3. look for the src url in source elements and use the type there
var sources=player.$$('source');for(var i=0;i<sources.length;i++){var s=sources[i];if(s.type&&s.src&&s.src===src){return s.type;}}// 4. finally fallback to our list of mime types based on src url extension
return getMimetype(src);};/**
 * @module filter-source
 *//**
 * Filter out single bad source objects or multiple source objects in an
 * array. Also flattens nested source object arrays into a 1 dimensional
 * array of source objects.
 *
 * @param {Tech~SourceObject|Tech~SourceObject[]} src
 *        The src object to filter
 *
 * @return {Tech~SourceObject[]}
 *         An array of sourceobjects containing only valid sources
 *
 * @private
 */var filterSource=function filterSource(src){// traverse array
if(Array.isArray(src)){var newsrc=[];src.forEach(function(srcobj){srcobj=filterSource(srcobj);if(Array.isArray(srcobj)){newsrc=newsrc.concat(srcobj);}else if(isObject$4(srcobj)){newsrc.push(srcobj);}});src=newsrc;}else if(typeof src==='string'&&src.trim()){// convert string into object
src=[fixSource({src:src})];}else if(isObject$4(src)&&typeof src.src==='string'&&src.src&&src.src.trim()){// src is already valid
src=[fixSource(src)];}else {// invalid source, turn it into an empty array
src=[];}return src;};/**
 * Checks src mimetype, adding it when possible
 *
 * @param {Tech~SourceObject} src
 *        The src object to check
 * @return {Tech~SourceObject}
 *        src Object with known type
 */function fixSource(src){var mimetype=getMimetype(src.src);if(!src.type&&mimetype){src.type=mimetype;}return src;}/**
 * @file loader.js
 *//**
 * The `MediaLoader` is the `Component` that decides which playback technology to load
 * when a player is initialized.
 *
 * @extends Component
 */var MediaLoader=function(_Component){inherits$1(MediaLoader,_Component);/**
   * Create an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should attach to.
   *
   * @param {Object} [options]
   *        The key/value stroe of player options.
   *
   * @param {Component~ReadyCallback} [ready]
   *        The function that is run when this component is ready.
   */function MediaLoader(player,options,ready){classCallCheck(this,MediaLoader);// MediaLoader has no element
var options_=mergeOptions({createEl:false},options);// If there are no sources when the player is initialized,
// load the first supported playback technology.
var _this=possibleConstructorReturn(this,_Component.call(this,player,options_,ready));if(!options.playerOptions.sources||options.playerOptions.sources.length===0){for(var i=0,j=options.playerOptions.techOrder;i<j.length;i++){var techName=toTitleCase(j[i]);var tech=Tech.getTech(techName);// Support old behavior of techs being registered as components.
// Remove once that deprecated behavior is removed.
if(!techName){tech=Component.getComponent(techName);}// Check if the browser supports this technology
if(tech&&tech.isSupported()){player.loadTech_(techName);break;}}}else {// Loop through playback technologies (HTML5, Flash) and check for support.
// Then load the best source.
// A few assumptions here:
//   All playback technologies respect preload false.
player.src(options.playerOptions.sources);}return _this;}return MediaLoader;}(Component);Component.registerComponent('MediaLoader',MediaLoader);/**
 * @file button.js
 *//**
 * Clickable Component which is clickable or keyboard actionable,
 * but is not a native HTML button.
 *
 * @extends Component
 */var ClickableComponent=function(_Component){inherits$1(ClickableComponent,_Component);/**
   * Creates an instance of this class.
   *
   * @param  {Player} player
   *         The `Player` that this class should be attached to.
   *
   * @param  {Object} [options]
   *         The key/value store of player options.
   */function ClickableComponent(player,options){classCallCheck(this,ClickableComponent);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.emitTapEvents();_this.enable();return _this;}/**
   * Create the `Component`s DOM element.
   *
   * @param {string} [tag=div]
   *        The element's node type.
   *
   * @param {Object} [props={}]
   *        An object of properties that should be set on the element.
   *
   * @param {Object} [attributes={}]
   *        An object of attributes that should be set on the element.
   *
   * @return {Element}
   *         The element that gets created.
   */ClickableComponent.prototype.createEl=function createEl$$1(){var tag=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'div';var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var attributes=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};props=assign$1({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass(),tabIndex:0},props);if(tag==='button'){log$2.error('Creating a ClickableComponent with an HTML element of '+tag+' is not supported; use a Button instead.');}// Add ARIA attributes for clickable element which is not a native HTML button
attributes=assign$1({role:'button'},attributes);this.tabIndex_=props.tabIndex;var el=_Component.prototype.createEl.call(this,tag,props,attributes);this.createControlTextEl(el);return el;};ClickableComponent.prototype.dispose=function dispose(){// remove controlTextEl_ on dipose
this.controlTextEl_=null;_Component.prototype.dispose.call(this);};/**
   * Create a control text element on this `Component`
   *
   * @param {Element} [el]
   *        Parent element for the control text.
   *
   * @return {Element}
   *         The control text element that gets created.
   */ClickableComponent.prototype.createControlTextEl=function createControlTextEl(el){this.controlTextEl_=createEl$2('span',{className:'vjs-control-text'},{// let the screen reader user know that the text of the element may change
'aria-live':'polite'});if(el){el.appendChild(this.controlTextEl_);}this.controlText(this.controlText_,el);return this.controlTextEl_;};/**
   * Get or set the localize text to use for the controls on the `Component`.
   *
   * @param {string} [text]
   *        Control text for element.
   *
   * @param {Element} [el=this.el()]
   *        Element to set the title on.
   *
   * @return {string}
   *         - The control text when getting
   */ClickableComponent.prototype.controlText=function controlText(text){var el=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.el();if(text===undefined){return this.controlText_||'Need Text';}var localizedText=this.localize(text);this.controlText_=text;textContent(this.controlTextEl_,localizedText);if(!this.nonIconControl){// Set title attribute if only an icon is shown
el.setAttribute('title',localizedText);}};/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */ClickableComponent.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-control vjs-button '+_Component.prototype.buildCSSClass.call(this);};/**
   * Enable this `Component`s element.
   */ClickableComponent.prototype.enable=function enable(){if(!this.enabled_){this.enabled_=true;this.removeClass('vjs-disabled');this.el_.setAttribute('aria-disabled','false');if(typeof this.tabIndex_!=='undefined'){this.el_.setAttribute('tabIndex',this.tabIndex_);}this.on(['tap','click'],this.handleClick);this.on('focus',this.handleFocus);this.on('blur',this.handleBlur);}};/**
   * Disable this `Component`s element.
   */ClickableComponent.prototype.disable=function disable(){this.enabled_=false;this.addClass('vjs-disabled');this.el_.setAttribute('aria-disabled','true');if(typeof this.tabIndex_!=='undefined'){this.el_.removeAttribute('tabIndex');}this.off(['tap','click'],this.handleClick);this.off('focus',this.handleFocus);this.off('blur',this.handleBlur);};/**
   * This gets called when a `ClickableComponent` gets:
   * - Clicked (via the `click` event, listening starts in the constructor)
   * - Tapped (via the `tap` event, listening starts in the constructor)
   * - The following things happen in order:
   *   1. {@link ClickableComponent#handleFocus} is called via a `focus` event on the
   *      `ClickableComponent`.
   *   2. {@link ClickableComponent#handleFocus} adds a listener for `keydown` on using
   *      {@link ClickableComponent#handleKeyPress}.
   *   3. `ClickableComponent` has not had a `blur` event (`blur` means that focus was lost). The user presses
   *      the space or enter key.
   *   4. {@link ClickableComponent#handleKeyPress} calls this function with the `keydown`
   *      event as a parameter.
   *
   * @param {EventTarget~Event} event
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   * @abstract
   */ClickableComponent.prototype.handleClick=function handleClick(event){};/**
   * This gets called when a `ClickableComponent` gains focus via a `focus` event.
   * Turns on listening for `keydown` events. When they happen it
   * calls `this.handleKeyPress`.
   *
   * @param {EventTarget~Event} event
   *        The `focus` event that caused this function to be called.
   *
   * @listens focus
   */ClickableComponent.prototype.handleFocus=function handleFocus(event){on(document$1,'keydown',bind$2(this,this.handleKeyPress));};/**
   * Called when this ClickableComponent has focus and a key gets pressed down. By
   * default it will call `this.handleClick` when the key is space or enter.
   *
   * @param {EventTarget~Event} event
   *        The `keydown` event that caused this function to be called.
   *
   * @listens keydown
   */ClickableComponent.prototype.handleKeyPress=function handleKeyPress(event){// Support Space (32) or Enter (13) key operation to fire a click event
if(event.which===32||event.which===13){event.preventDefault();this.trigger('click');}else if(_Component.prototype.handleKeyPress){// Pass keypress handling up for unsupported keys
_Component.prototype.handleKeyPress.call(this,event);}};/**
   * Called when a `ClickableComponent` loses focus. Turns off the listener for
   * `keydown` events. Which Stops `this.handleKeyPress` from getting called.
   *
   * @param {EventTarget~Event} event
   *        The `blur` event that caused this function to be called.
   *
   * @listens blur
   */ClickableComponent.prototype.handleBlur=function handleBlur(event){off(document$1,'keydown',bind$2(this,this.handleKeyPress));};return ClickableComponent;}(Component);Component.registerComponent('ClickableComponent',ClickableComponent);/**
 * @file poster-image.js
 *//**
 * A `ClickableComponent` that handles showing the poster image for the player.
 *
 * @extends ClickableComponent
 */var PosterImage=function(_ClickableComponent){inherits$1(PosterImage,_ClickableComponent);/**
   * Create an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should attach to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function PosterImage(player,options){classCallCheck(this,PosterImage);var _this=possibleConstructorReturn(this,_ClickableComponent.call(this,player,options));_this.update();player.on('posterchange',bind$2(_this,_this.update));return _this;}/**
   * Clean up and dispose of the `PosterImage`.
   */PosterImage.prototype.dispose=function dispose(){this.player().off('posterchange',this.update);_ClickableComponent.prototype.dispose.call(this);};/**
   * Create the `PosterImage`s DOM element.
   *
   * @return {Element}
   *         The element that gets created.
   */PosterImage.prototype.createEl=function createEl$$1(){var el=createEl$2('div',{className:'vjs-poster',// Don't want poster to be tabbable.
tabIndex:-1});// To ensure the poster image resizes while maintaining its original aspect
// ratio, use a div with `background-size` when available. For browsers that
// do not support `background-size` (e.g. IE8), fall back on using a regular
// img element.
if(!BACKGROUND_SIZE_SUPPORTED){this.fallbackImg_=createEl$2('img');el.appendChild(this.fallbackImg_);}return el;};/**
   * An {@link EventTarget~EventListener} for {@link Player#posterchange} events.
   *
   * @listens Player#posterchange
   *
   * @param {EventTarget~Event} [event]
   *        The `Player#posterchange` event that triggered this function.
   */PosterImage.prototype.update=function update(event){var url=this.player().poster();this.setSrc(url);// If there's no poster source we should display:none on this component
// so it's not still clickable or right-clickable
if(url){this.show();}else {this.hide();}};/**
   * Set the source of the `PosterImage` depending on the display method.
   *
   * @param {string} url
   *        The URL to the source for the `PosterImage`.
   */PosterImage.prototype.setSrc=function setSrc(url){if(this.fallbackImg_){this.fallbackImg_.src=url;}else {var backgroundImage='';// Any falsey values should stay as an empty string, otherwise
// this will throw an extra error
if(url){backgroundImage='url("'+url+'")';}this.el_.style.backgroundImage=backgroundImage;}};/**
   * An {@link EventTarget~EventListener} for clicks on the `PosterImage`. See
   * {@link ClickableComponent#handleClick} for instances where this will be triggered.
   *
   * @listens tap
   * @listens click
   * @listens keydown
   *
   * @param {EventTarget~Event} event
   +        The `click`, `tap` or `keydown` event that caused this function to be called.
   */PosterImage.prototype.handleClick=function handleClick(event){// We don't want a click to trigger playback when controls are disabled
if(!this.player_.controls()){return;}if(this.player_.paused()){silencePromise(this.player_.play());}else {this.player_.pause();}};return PosterImage;}(ClickableComponent);Component.registerComponent('PosterImage',PosterImage);/**
 * @file text-track-display.js
 */var darkGray='#222';var lightGray='#ccc';var fontMap={monospace:'monospace',sansSerif:'sans-serif',serif:'serif',monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:'sans-serif',proportionalSerif:'serif',casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};/**
 * Construct an rgba color from a given hex color code.
 *
 * @param {number} color
 *        Hex number for color, like #f0e or #f604e2.
 *
 * @param {number} opacity
 *        Value for opacity, 0.0 - 1.0.
 *
 * @return {string}
 *         The rgba color that was created, like 'rgba(255, 0, 0, 0.3)'.
 */function constructColor(color,opacity){var hex=void 0;if(color.length===4){// color looks like "#f0e"
hex=color[1]+color[1]+color[2]+color[2]+color[3]+color[3];}else if(color.length===7){// color looks like "#f604e2"
hex=color.slice(1);}else {throw new Error('Invalid color code provided, '+color+'; must be formatted as e.g. #f0e or #f604e2.');}return 'rgba('+parseInt(hex.slice(0,2),16)+','+parseInt(hex.slice(2,4),16)+','+parseInt(hex.slice(4,6),16)+','+opacity+')';}/**
 * Try to update the style of a DOM element. Some style changes will throw an error,
 * particularly in IE8. Those should be noops.
 *
 * @param {Element} el
 *        The DOM element to be styled.
 *
 * @param {string} style
 *        The CSS property on the element that should be styled.
 *
 * @param {string} rule
 *        The style rule that should be applied to the property.
 *
 * @private
 */function tryUpdateStyle(el,style,rule){try{el.style[style]=rule;}catch(e){// Satisfies linter.
return;}}/**
 * The component for displaying text track cues.
 *
 * @extends Component
 */var TextTrackDisplay=function(_Component){inherits$1(TextTrackDisplay,_Component);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   *
   * @param {Component~ReadyCallback} [ready]
   *        The function to call when `TextTrackDisplay` is ready.
   */function TextTrackDisplay(player,options,ready){classCallCheck(this,TextTrackDisplay);var _this=possibleConstructorReturn(this,_Component.call(this,player,options,ready));var updateDisplayHandler=bind$2(_this,_this.updateDisplay);player.on('loadstart',bind$2(_this,_this.toggleDisplay));player.on('texttrackchange',updateDisplayHandler);player.on('loadstart',bind$2(_this,_this.preselectTrack));// This used to be called during player init, but was causing an error
// if a track should show by default and the display hadn't loaded yet.
// Should probably be moved to an external track loader when we support
// tracks that don't need a display.
player.ready(bind$2(_this,function(){if(player.tech_&&player.tech_.featuresNativeTextTracks){this.hide();return;}player.on('fullscreenchange',updateDisplayHandler);player.on('playerresize',updateDisplayHandler);if(window$1.addEventListener){window$1.addEventListener('orientationchange',updateDisplayHandler);}player.on('dispose',function(){return window$1.removeEventListener('orientationchange',updateDisplayHandler);});var tracks=this.options_.playerOptions.tracks||[];for(var i=0;i<tracks.length;i++){this.player_.addRemoteTextTrack(tracks[i],true);}this.preselectTrack();}));return _this;}/**
  * Preselect a track following this precedence:
  * - matches the previously selected {@link TextTrack}'s language and kind
  * - matches the previously selected {@link TextTrack}'s language only
  * - is the first default captions track
  * - is the first default descriptions track
  *
  * @listens Player#loadstart
  */TextTrackDisplay.prototype.preselectTrack=function preselectTrack(){var modes={captions:1,subtitles:1};var trackList=this.player_.textTracks();var userPref=this.player_.cache_.selectedLanguage;var firstDesc=void 0;var firstCaptions=void 0;var preferredTrack=void 0;for(var i=0;i<trackList.length;i++){var track=trackList[i];if(userPref&&userPref.enabled&&userPref.language===track.language){// Always choose the track that matches both language and kind
if(track.kind===userPref.kind){preferredTrack=track;// or choose the first track that matches language
}else if(!preferredTrack){preferredTrack=track;}// clear everything if offTextTrackMenuItem was clicked
}else if(userPref&&!userPref.enabled){preferredTrack=null;firstDesc=null;firstCaptions=null;}else if(track['default']){if(track.kind==='descriptions'&&!firstDesc){firstDesc=track;}else if(track.kind in modes&&!firstCaptions){firstCaptions=track;}}}// The preferredTrack matches the user preference and takes
// precendence over all the other tracks.
// So, display the preferredTrack before the first default track
// and the subtitles/captions track before the descriptions track
if(preferredTrack){preferredTrack.mode='showing';}else if(firstCaptions){firstCaptions.mode='showing';}else if(firstDesc){firstDesc.mode='showing';}};/**
   * Turn display of {@link TextTrack}'s from the current state into the other state.
   * There are only two states:
   * - 'shown'
   * - 'hidden'
   *
   * @listens Player#loadstart
   */TextTrackDisplay.prototype.toggleDisplay=function toggleDisplay(){if(this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks){this.hide();}else {this.show();}};/**
   * Create the {@link Component}'s DOM element.
   *
   * @return {Element}
   *         The element that was created.
   */TextTrackDisplay.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-text-track-display'},{'aria-live':'off','aria-atomic':'true'});};/**
   * Clear all displayed {@link TextTrack}s.
   */TextTrackDisplay.prototype.clearDisplay=function clearDisplay(){if(typeof window$1.WebVTT==='function'){window$1.WebVTT.processCues(window$1,[],this.el_);}};/**
   * Update the displayed TextTrack when a either a {@link Player#texttrackchange} or
   * a {@link Player#fullscreenchange} is fired.
   *
   * @listens Player#texttrackchange
   * @listens Player#fullscreenchange
   */TextTrackDisplay.prototype.updateDisplay=function updateDisplay(){var tracks=this.player_.textTracks();this.clearDisplay();// Track display prioritization model: if multiple tracks are 'showing',
//  display the first 'subtitles' or 'captions' track which is 'showing',
//  otherwise display the first 'descriptions' track which is 'showing'
var descriptionsTrack=null;var captionsSubtitlesTrack=null;var i=tracks.length;while(i--){var track=tracks[i];if(track.mode==='showing'){if(track.kind==='descriptions'){descriptionsTrack=track;}else {captionsSubtitlesTrack=track;}}}if(captionsSubtitlesTrack){if(this.getAttribute('aria-live')!=='off'){this.setAttribute('aria-live','off');}this.updateForTrack(captionsSubtitlesTrack);}else if(descriptionsTrack){if(this.getAttribute('aria-live')!=='assertive'){this.setAttribute('aria-live','assertive');}this.updateForTrack(descriptionsTrack);}};/**
   * Add an {@link Texttrack} to to the {@link Tech}s {@link TextTrackList}.
   *
   * @param {TextTrack} track
   *        Text track object to be added to the list.
   */TextTrackDisplay.prototype.updateForTrack=function updateForTrack(track){if(typeof window$1.WebVTT!=='function'||!track.activeCues){return;}var cues=[];for(var _i=0;_i<track.activeCues.length;_i++){cues.push(track.activeCues[_i]);}window$1.WebVTT.processCues(window$1,cues,this.el_);if(!this.player_.textTrackSettings){return;}var overrides=this.player_.textTrackSettings.getValues();var i=cues.length;while(i--){var cue=cues[i];if(!cue){continue;}var cueDiv=cue.displayState;if(overrides.color){cueDiv.firstChild.style.color=overrides.color;}if(overrides.textOpacity){tryUpdateStyle(cueDiv.firstChild,'color',constructColor(overrides.color||'#fff',overrides.textOpacity));}if(overrides.backgroundColor){cueDiv.firstChild.style.backgroundColor=overrides.backgroundColor;}if(overrides.backgroundOpacity){tryUpdateStyle(cueDiv.firstChild,'backgroundColor',constructColor(overrides.backgroundColor||'#000',overrides.backgroundOpacity));}if(overrides.windowColor){if(overrides.windowOpacity){tryUpdateStyle(cueDiv,'backgroundColor',constructColor(overrides.windowColor,overrides.windowOpacity));}else {cueDiv.style.backgroundColor=overrides.windowColor;}}if(overrides.edgeStyle){if(overrides.edgeStyle==='dropshadow'){cueDiv.firstChild.style.textShadow='2px 2px 3px '+darkGray+', 2px 2px 4px '+darkGray+', 2px 2px 5px '+darkGray;}else if(overrides.edgeStyle==='raised'){cueDiv.firstChild.style.textShadow='1px 1px '+darkGray+', 2px 2px '+darkGray+', 3px 3px '+darkGray;}else if(overrides.edgeStyle==='depressed'){cueDiv.firstChild.style.textShadow='1px 1px '+lightGray+', 0 1px '+lightGray+', -1px -1px '+darkGray+', 0 -1px '+darkGray;}else if(overrides.edgeStyle==='uniform'){cueDiv.firstChild.style.textShadow='0 0 4px '+darkGray+', 0 0 4px '+darkGray+', 0 0 4px '+darkGray+', 0 0 4px '+darkGray;}}if(overrides.fontPercent&&overrides.fontPercent!==1){var fontSize=window$1.parseFloat(cueDiv.style.fontSize);cueDiv.style.fontSize=fontSize*overrides.fontPercent+'px';cueDiv.style.height='auto';cueDiv.style.top='auto';cueDiv.style.bottom='2px';}if(overrides.fontFamily&&overrides.fontFamily!=='default'){if(overrides.fontFamily==='small-caps'){cueDiv.firstChild.style.fontVariant='small-caps';}else {cueDiv.firstChild.style.fontFamily=fontMap[overrides.fontFamily];}}}};return TextTrackDisplay;}(Component);Component.registerComponent('TextTrackDisplay',TextTrackDisplay);/**
 * @file loading-spinner.js
 *//**
 * A loading spinner for use during waiting/loading events.
 *
 * @extends Component
 */var LoadingSpinner=function(_Component){inherits$1(LoadingSpinner,_Component);function LoadingSpinner(){classCallCheck(this,LoadingSpinner);return possibleConstructorReturn(this,_Component.apply(this,arguments));}/**
   * Create the `LoadingSpinner`s DOM element.
   *
   * @return {Element}
   *         The dom element that gets created.
   */LoadingSpinner.prototype.createEl=function createEl$$1(){var isAudio=this.player_.isAudio();var playerType=this.localize(isAudio?'Audio Player':'Video Player');var controlText=createEl$2('span',{className:'vjs-control-text',innerHTML:this.localize('{1} is loading.',[playerType])});var el=_Component.prototype.createEl.call(this,'div',{className:'vjs-loading-spinner',dir:'ltr'});el.appendChild(controlText);return el;};return LoadingSpinner;}(Component);Component.registerComponent('LoadingSpinner',LoadingSpinner);/**
 * @file button.js
 *//**
 * Base class for all buttons.
 *
 * @extends ClickableComponent
 */var Button=function(_ClickableComponent){inherits$1(Button,_ClickableComponent);function Button(){classCallCheck(this,Button);return possibleConstructorReturn(this,_ClickableComponent.apply(this,arguments));}/**
   * Create the `Button`s DOM element.
   *
   * @param {string} [tag="button"]
   *        The element's node type. This argument is IGNORED: no matter what
   *        is passed, it will always create a `button` element.
   *
   * @param {Object} [props={}]
   *        An object of properties that should be set on the element.
   *
   * @param {Object} [attributes={}]
   *        An object of attributes that should be set on the element.
   *
   * @return {Element}
   *         The element that gets created.
   */Button.prototype.createEl=function createEl(tag){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var attributes=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};tag='button';props=assign$1({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"></span>',className:this.buildCSSClass()},props);// Add attributes for button element
attributes=assign$1({// Necessary since the default button type is "submit"
type:'button'},attributes);var el=Component.prototype.createEl.call(this,tag,props,attributes);this.createControlTextEl(el);return el;};/**
   * Add a child `Component` inside of this `Button`.
   *
   * @param {string|Component} child
   *        The name or instance of a child to add.
   *
   * @param {Object} [options={}]
   *        The key/value store of options that will get passed to children of
   *        the child.
   *
   * @return {Component}
   *         The `Component` that gets added as a child. When using a string the
   *         `Component` will get created by this process.
   *
   * @deprecated since version 5
   */Button.prototype.addChild=function addChild(child){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var className=this.constructor.name;log$2.warn('Adding an actionable (user controllable) child to a Button ('+className+') is not supported; use a ClickableComponent instead.');// Avoid the error message generated by ClickableComponent's addChild method
return Component.prototype.addChild.call(this,child,options);};/**
   * Enable the `Button` element so that it can be activated or clicked. Use this with
   * {@link Button#disable}.
   */Button.prototype.enable=function enable(){_ClickableComponent.prototype.enable.call(this);this.el_.removeAttribute('disabled');};/**
   * Disable the `Button` element so that it cannot be activated or clicked. Use this with
   * {@link Button#enable}.
   */Button.prototype.disable=function disable(){_ClickableComponent.prototype.disable.call(this);this.el_.setAttribute('disabled','disabled');};/**
   * This gets called when a `Button` has focus and `keydown` is triggered via a key
   * press.
   *
   * @param {EventTarget~Event} event
   *        The event that caused this function to get called.
   *
   * @listens keydown
   */Button.prototype.handleKeyPress=function handleKeyPress(event){// Ignore Space (32) or Enter (13) key operation, which is handled by the browser for a button.
if(event.which===32||event.which===13){return;}// Pass keypress handling up for unsupported keys
_ClickableComponent.prototype.handleKeyPress.call(this,event);};return Button;}(ClickableComponent);Component.registerComponent('Button',Button);/**
 * @file big-play-button.js
 *//**
 * The initial play button that shows before the video has played. The hiding of the
 * `BigPlayButton` get done via CSS and `Player` states.
 *
 * @extends Button
 */var BigPlayButton=function(_Button){inherits$1(BigPlayButton,_Button);function BigPlayButton(player,options){classCallCheck(this,BigPlayButton);var _this=possibleConstructorReturn(this,_Button.call(this,player,options));_this.mouseused_=false;_this.on('mousedown',_this.handleMouseDown);return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object. Always returns 'vjs-big-play-button'.
   */BigPlayButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-big-play-button';};/**
   * This gets called when a `BigPlayButton` "clicked". See {@link ClickableComponent}
   * for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} event
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */BigPlayButton.prototype.handleClick=function handleClick(event){var playPromise=this.player_.play();// exit early if clicked via the mouse
if(this.mouseused_&&event.clientX&&event.clientY){silencePromise(playPromise);return;}var cb=this.player_.getChild('controlBar');var playToggle=cb&&cb.getChild('playToggle');if(!playToggle){this.player_.focus();return;}var playFocus=function playFocus(){return playToggle.focus();};if(isPromise(playPromise)){playPromise.then(playFocus,function(){});}else {this.setTimeout(playFocus,1);}};BigPlayButton.prototype.handleKeyPress=function handleKeyPress(event){this.mouseused_=false;_Button.prototype.handleKeyPress.call(this,event);};BigPlayButton.prototype.handleMouseDown=function handleMouseDown(event){this.mouseused_=true;};return BigPlayButton;}(Button);/**
 * The text that should display over the `BigPlayButton`s controls. Added to for localization.
 *
 * @type {string}
 * @private
 */BigPlayButton.prototype.controlText_='Play Video';Component.registerComponent('BigPlayButton',BigPlayButton);/**
 * @file close-button.js
 *//**
 * The `CloseButton` is a `{@link Button}` that fires a `close` event when
 * it gets clicked.
 *
 * @extends Button
 */var CloseButton=function(_Button){inherits$1(CloseButton,_Button);/**
   * Creates an instance of the this class.
   *
   * @param  {Player} player
   *         The `Player` that this class should be attached to.
   *
   * @param  {Object} [options]
   *         The key/value store of player options.
   */function CloseButton(player,options){classCallCheck(this,CloseButton);var _this=possibleConstructorReturn(this,_Button.call(this,player,options));_this.controlText(options&&options.controlText||_this.localize('Close'));return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */CloseButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-close-button '+_Button.prototype.buildCSSClass.call(this);};/**
   * This gets called when a `CloseButton` gets clicked. See
   * {@link ClickableComponent#handleClick} for more information on when this will be
   * triggered
   *
   * @param {EventTarget~Event} event
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   * @fires CloseButton#close
   */CloseButton.prototype.handleClick=function handleClick(event){/**
     * Triggered when the a `CloseButton` is clicked.
     *
     * @event CloseButton#close
     * @type {EventTarget~Event}
     *
     * @property {boolean} [bubbles=false]
     *           set to false so that the close event does not
     *           bubble up to parents if there is no listener
     */this.trigger({type:'close',bubbles:false});};return CloseButton;}(Button);Component.registerComponent('CloseButton',CloseButton);/**
 * @file play-toggle.js
 *//**
 * Button to toggle between play and pause.
 *
 * @extends Button
 */var PlayToggle=function(_Button){inherits$1(PlayToggle,_Button);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function PlayToggle(player,options){classCallCheck(this,PlayToggle);var _this=possibleConstructorReturn(this,_Button.call(this,player,options));_this.on(player,'play',_this.handlePlay);_this.on(player,'pause',_this.handlePause);_this.on(player,'ended',_this.handleEnded);return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */PlayToggle.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-play-control '+_Button.prototype.buildCSSClass.call(this);};/**
   * This gets called when an `PlayToggle` is "clicked". See
   * {@link ClickableComponent} for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} [event]
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */PlayToggle.prototype.handleClick=function handleClick(event){if(this.player_.paused()){this.player_.play();}else {this.player_.pause();}};/**
   * This gets called once after the video has ended and the user seeks so that
   * we can change the replay button back to a play button.
   *
   * @param {EventTarget~Event} [event]
   *        The event that caused this function to run.
   *
   * @listens Player#seeked
   */PlayToggle.prototype.handleSeeked=function handleSeeked(event){this.removeClass('vjs-ended');if(this.player_.paused()){this.handlePause(event);}else {this.handlePlay(event);}};/**
   * Add the vjs-playing class to the element so it can change appearance.
   *
   * @param {EventTarget~Event} [event]
   *        The event that caused this function to run.
   *
   * @listens Player#play
   */PlayToggle.prototype.handlePlay=function handlePlay(event){this.removeClass('vjs-ended');this.removeClass('vjs-paused');this.addClass('vjs-playing');// change the button text to "Pause"
this.controlText('Pause');};/**
   * Add the vjs-paused class to the element so it can change appearance.
   *
   * @param {EventTarget~Event} [event]
   *        The event that caused this function to run.
   *
   * @listens Player#pause
   */PlayToggle.prototype.handlePause=function handlePause(event){this.removeClass('vjs-playing');this.addClass('vjs-paused');// change the button text to "Play"
this.controlText('Play');};/**
   * Add the vjs-ended class to the element so it can change appearance
   *
   * @param {EventTarget~Event} [event]
   *        The event that caused this function to run.
   *
   * @listens Player#ended
   */PlayToggle.prototype.handleEnded=function handleEnded(event){this.removeClass('vjs-playing');this.addClass('vjs-ended');// change the button text to "Replay"
this.controlText('Replay');// on the next seek remove the replay button
this.one(this.player_,'seeked',this.handleSeeked);};return PlayToggle;}(Button);/**
 * The text that should display over the `PlayToggle`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */PlayToggle.prototype.controlText_='Play';Component.registerComponent('PlayToggle',PlayToggle);/**
 * @file format-time.js
 * @module format-time
 *//**
* Format seconds as a time string, H:MM:SS or M:SS. Supplying a guide (in seconds)
* will force a number of leading zeros to cover the length of the guide.
*
* @param {number} seconds
*        Number of seconds to be turned into a string
*
* @param {number} guide
*        Number (in seconds) to model the string after
*
* @return {string}
*         Time formatted as H:MM:SS or M:SS
*/var defaultImplementation=function defaultImplementation(seconds,guide){seconds=seconds<0?0:seconds;var s=Math.floor(seconds%60);var m=Math.floor(seconds/60%60);var h=Math.floor(seconds/3600);var gm=Math.floor(guide/60%60);var gh=Math.floor(guide/3600);// handle invalid times
if(isNaN(seconds)||seconds===Infinity){// '-' is false for all relational operators (e.g. <, >=) so this setting
// will add the minimum number of fields specified by the guide
h=m=s='-';}// Check if we need to show hours
h=h>0||gh>0?h+':':'';// If hours are showing, we may need to add a leading zero.
// Always show at least one digit of minutes.
m=((h||gm>=10)&&m<10?'0'+m:m)+':';// Check if leading zero is need for seconds
s=s<10?'0'+s:s;return h+m+s;};var implementation=defaultImplementation;/**
 * Replaces the default formatTime implementation with a custom implementation.
 *
 * @param {Function} customImplementation
 *        A function which will be used in place of the default formatTime implementation.
 *        Will receive the current time in seconds and the guide (in seconds) as arguments.
 */function setFormatTime(customImplementation){implementation=customImplementation;}/**
 * Resets formatTime to the default implementation.
 */function resetFormatTime(){implementation=defaultImplementation;}var formatTime=function(seconds){var guide=arguments.length>1&&arguments[1]!==undefined?arguments[1]:seconds;return implementation(seconds,guide);};/**
 * @file time-display.js
 *//**
 * Displays the time left in the video
 *
 * @extends Component
 */var TimeDisplay=function(_Component){inherits$1(TimeDisplay,_Component);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function TimeDisplay(player,options){classCallCheck(this,TimeDisplay);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.throttledUpdateContent=throttle$1(bind$2(_this,_this.updateContent),25);_this.on(player,'timeupdate',_this.throttledUpdateContent);return _this;}/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */TimeDisplay.prototype.createEl=function createEl$$1(plainName){var className=this.buildCSSClass();var el=_Component.prototype.createEl.call(this,'div',{className:className+' vjs-time-control vjs-control',innerHTML:'<span class="vjs-control-text">'+this.localize(this.labelText_)+'\xA0</span>'});this.contentEl_=createEl$2('span',{className:className+'-display'},{// tell screen readers not to automatically read the time as it changes
'aria-live':'off'});this.updateTextNode_();el.appendChild(this.contentEl_);return el;};TimeDisplay.prototype.dispose=function dispose(){this.contentEl_=null;this.textNode_=null;_Component.prototype.dispose.call(this);};/**
   * Updates the "remaining time" text node with new content using the
   * contents of the `formattedTime_` property.
   *
   * @private
   */TimeDisplay.prototype.updateTextNode_=function updateTextNode_(){if(!this.contentEl_){return;}while(this.contentEl_.firstChild){this.contentEl_.removeChild(this.contentEl_.firstChild);}this.textNode_=document$1.createTextNode(this.formattedTime_||this.formatTime_(0));this.contentEl_.appendChild(this.textNode_);};/**
   * Generates a formatted time for this component to use in display.
   *
   * @param  {number} time
   *         A numeric time, in seconds.
   *
   * @return {string}
   *         A formatted time
   *
   * @private
   */TimeDisplay.prototype.formatTime_=function formatTime_(time){return formatTime(time);};/**
   * Updates the time display text node if it has what was passed in changed
   * the formatted time.
   *
   * @param {number} time
   *        The time to update to
   *
   * @private
   */TimeDisplay.prototype.updateFormattedTime_=function updateFormattedTime_(time){var formattedTime=this.formatTime_(time);if(formattedTime===this.formattedTime_){return;}this.formattedTime_=formattedTime;this.requestAnimationFrame(this.updateTextNode_);};/**
   * To be filled out in the child class, should update the displayed time
   * in accordance with the fact that the current time has changed.
   *
   * @param {EventTarget~Event} [event]
   *        The `timeupdate`  event that caused this to run.
   *
   * @listens Player#timeupdate
   */TimeDisplay.prototype.updateContent=function updateContent(event){};return TimeDisplay;}(Component);/**
 * The text that is added to the `TimeDisplay` for screen reader users.
 *
 * @type {string}
 * @private
 */TimeDisplay.prototype.labelText_='Time';/**
 * The text that should display over the `TimeDisplay`s controls. Added to for localization.
 *
 * @type {string}
 * @private
 *
 * @deprecated in v7; controlText_ is not used in non-active display Components
 */TimeDisplay.prototype.controlText_='Time';Component.registerComponent('TimeDisplay',TimeDisplay);/**
 * @file current-time-display.js
 *//**
 * Displays the current time
 *
 * @extends Component
 */var CurrentTimeDisplay=function(_TimeDisplay){inherits$1(CurrentTimeDisplay,_TimeDisplay);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function CurrentTimeDisplay(player,options){classCallCheck(this,CurrentTimeDisplay);var _this=possibleConstructorReturn(this,_TimeDisplay.call(this,player,options));_this.on(player,'ended',_this.handleEnded);return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */CurrentTimeDisplay.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-current-time';};/**
   * Update current time display
   *
   * @param {EventTarget~Event} [event]
   *        The `timeupdate` event that caused this function to run.
   *
   * @listens Player#timeupdate
   */CurrentTimeDisplay.prototype.updateContent=function updateContent(event){// Allows for smooth scrubbing, when player can't keep up.
var time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(time);};/**
   * When the player fires ended there should be no time left. Sadly
   * this is not always the case, lets make it seem like that is the case
   * for users.
   *
   * @param {EventTarget~Event} [event]
   *        The `ended` event that caused this to run.
   *
   * @listens Player#ended
   */CurrentTimeDisplay.prototype.handleEnded=function handleEnded(event){if(!this.player_.duration()){return;}this.updateFormattedTime_(this.player_.duration());};return CurrentTimeDisplay;}(TimeDisplay);/**
 * The text that is added to the `CurrentTimeDisplay` for screen reader users.
 *
 * @type {string}
 * @private
 */CurrentTimeDisplay.prototype.labelText_='Current Time';/**
 * The text that should display over the `CurrentTimeDisplay`s controls. Added to for localization.
 *
 * @type {string}
 * @private
 *
 * @deprecated in v7; controlText_ is not used in non-active display Components
 */CurrentTimeDisplay.prototype.controlText_='Current Time';Component.registerComponent('CurrentTimeDisplay',CurrentTimeDisplay);/**
 * @file duration-display.js
 *//**
 * Displays the duration
 *
 * @extends Component
 */var DurationDisplay=function(_TimeDisplay){inherits$1(DurationDisplay,_TimeDisplay);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function DurationDisplay(player,options){classCallCheck(this,DurationDisplay);// we do not want to/need to throttle duration changes,
// as they should always display the changed duration as
// it has changed
var _this=possibleConstructorReturn(this,_TimeDisplay.call(this,player,options));_this.on(player,'durationchange',_this.updateContent);// Also listen for timeupdate (in the parent) and loadedmetadata because removing those
// listeners could have broken dependent applications/libraries. These
// can likely be removed for 7.0.
_this.on(player,'loadedmetadata',_this.throttledUpdateContent);return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */DurationDisplay.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-duration';};/**
   * Update duration time display.
   *
   * @param {EventTarget~Event} [event]
   *        The `durationchange`, `timeupdate`, or `loadedmetadata` event that caused
   *        this function to be called.
   *
   * @listens Player#durationchange
   * @listens Player#timeupdate
   * @listens Player#loadedmetadata
   */DurationDisplay.prototype.updateContent=function updateContent(event){var duration=this.player_.duration();if(duration&&this.duration_!==duration){this.duration_=duration;this.updateFormattedTime_(duration);}};return DurationDisplay;}(TimeDisplay);/**
 * The text that is added to the `DurationDisplay` for screen reader users.
 *
 * @type {string}
 * @private
 */DurationDisplay.prototype.labelText_='Duration';/**
 * The text that should display over the `DurationDisplay`s controls. Added to for localization.
 *
 * @type {string}
 * @private
 *
 * @deprecated in v7; controlText_ is not used in non-active display Components
 */DurationDisplay.prototype.controlText_='Duration';Component.registerComponent('DurationDisplay',DurationDisplay);/**
 * @file time-divider.js
 *//**
 * The separator between the current time and duration.
 * Can be hidden if it's not needed in the design.
 *
 * @extends Component
 */var TimeDivider=function(_Component){inherits$1(TimeDivider,_Component);function TimeDivider(){classCallCheck(this,TimeDivider);return possibleConstructorReturn(this,_Component.apply(this,arguments));}/**
   * Create the component's DOM element
   *
   * @return {Element}
   *         The element that was created.
   */TimeDivider.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-time-control vjs-time-divider',innerHTML:'<div><span>/</span></div>'});};return TimeDivider;}(Component);Component.registerComponent('TimeDivider',TimeDivider);/**
 * @file remaining-time-display.js
 *//**
 * Displays the time left in the video
 *
 * @extends Component
 */var RemainingTimeDisplay=function(_TimeDisplay){inherits$1(RemainingTimeDisplay,_TimeDisplay);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function RemainingTimeDisplay(player,options){classCallCheck(this,RemainingTimeDisplay);var _this=possibleConstructorReturn(this,_TimeDisplay.call(this,player,options));_this.on(player,'durationchange',_this.throttledUpdateContent);_this.on(player,'ended',_this.handleEnded);return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */RemainingTimeDisplay.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-remaining-time';};/**
   * The remaining time display prefixes numbers with a "minus" character.
   *
   * @param  {number} time
   *         A numeric time, in seconds.
   *
   * @return {string}
   *         A formatted time
   *
   * @private
   */RemainingTimeDisplay.prototype.formatTime_=function formatTime_(time){// TODO: The "-" should be decorative, and not announced by a screen reader
return '-'+_TimeDisplay.prototype.formatTime_.call(this,time);};/**
   * Update remaining time display.
   *
   * @param {EventTarget~Event} [event]
   *        The `timeupdate` or `durationchange` event that caused this to run.
   *
   * @listens Player#timeupdate
   * @listens Player#durationchange
   */RemainingTimeDisplay.prototype.updateContent=function updateContent(event){if(!this.player_.duration()){return;}// @deprecated We should only use remainingTimeDisplay
// as of video.js 7
if(this.player_.remainingTimeDisplay){this.updateFormattedTime_(this.player_.remainingTimeDisplay());}else {this.updateFormattedTime_(this.player_.remainingTime());}};/**
   * When the player fires ended there should be no time left. Sadly
   * this is not always the case, lets make it seem like that is the case
   * for users.
   *
   * @param {EventTarget~Event} [event]
   *        The `ended` event that caused this to run.
   *
   * @listens Player#ended
   */RemainingTimeDisplay.prototype.handleEnded=function handleEnded(event){if(!this.player_.duration()){return;}this.updateFormattedTime_(0);};return RemainingTimeDisplay;}(TimeDisplay);/**
 * The text that is added to the `RemainingTimeDisplay` for screen reader users.
 *
 * @type {string}
 * @private
 */RemainingTimeDisplay.prototype.labelText_='Remaining Time';/**
 * The text that should display over the `RemainingTimeDisplay`s controls. Added to for localization.
 *
 * @type {string}
 * @private
 *
 * @deprecated in v7; controlText_ is not used in non-active display Components
 */RemainingTimeDisplay.prototype.controlText_='Remaining Time';Component.registerComponent('RemainingTimeDisplay',RemainingTimeDisplay);/**
 * @file live-display.js
 */// TODO - Future make it click to snap to live
/**
 * Displays the live indicator when duration is Infinity.
 *
 * @extends Component
 */var LiveDisplay=function(_Component){inherits$1(LiveDisplay,_Component);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function LiveDisplay(player,options){classCallCheck(this,LiveDisplay);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.updateShowing();_this.on(_this.player(),'durationchange',_this.updateShowing);return _this;}/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */LiveDisplay.prototype.createEl=function createEl$$1(){var el=_Component.prototype.createEl.call(this,'div',{className:'vjs-live-control vjs-control'});this.contentEl_=createEl$2('div',{className:'vjs-live-display',innerHTML:'<span class="vjs-control-text">'+this.localize('Stream Type')+'\xA0</span>'+this.localize('LIVE')},{'aria-live':'off'});el.appendChild(this.contentEl_);return el;};LiveDisplay.prototype.dispose=function dispose(){this.contentEl_=null;_Component.prototype.dispose.call(this);};/**
   * Check the duration to see if the LiveDisplay should be showing or not. Then show/hide
   * it accordingly
   *
   * @param {EventTarget~Event} [event]
   *        The {@link Player#durationchange} event that caused this function to run.
   *
   * @listens Player#durationchange
   */LiveDisplay.prototype.updateShowing=function updateShowing(event){if(this.player().duration()===Infinity){this.show();}else {this.hide();}};return LiveDisplay;}(Component);Component.registerComponent('LiveDisplay',LiveDisplay);/**
 * @file slider.js
 *//**
 * The base functionality for a slider. Can be vertical or horizontal.
 * For instance the volume bar or the seek bar on a video is a slider.
 *
 * @extends Component
 */var Slider=function(_Component){inherits$1(Slider,_Component);/**
   * Create an instance of this class
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function Slider(player,options){classCallCheck(this,Slider);// Set property names to bar to match with the child Slider class is looking for
var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.bar=_this.getChild(_this.options_.barName);// Set a horizontal or vertical class on the slider depending on the slider type
_this.vertical(!!_this.options_.vertical);_this.enable();return _this;}/**
   * Are controls are currently enabled for this slider or not.
   *
   * @return {boolean}
   *         true if controls are enabled, false otherwise
   */Slider.prototype.enabled=function enabled(){return this.enabled_;};/**
   * Enable controls for this slider if they are disabled
   */Slider.prototype.enable=function enable(){if(this.enabled()){return;}this.on('mousedown',this.handleMouseDown);this.on('touchstart',this.handleMouseDown);this.on('focus',this.handleFocus);this.on('blur',this.handleBlur);this.on('click',this.handleClick);this.on(this.player_,'controlsvisible',this.update);if(this.playerEvent){this.on(this.player_,this.playerEvent,this.update);}this.removeClass('disabled');this.setAttribute('tabindex',0);this.enabled_=true;};/**
   * Disable controls for this slider if they are enabled
   */Slider.prototype.disable=function disable(){if(!this.enabled()){return;}var doc=this.bar.el_.ownerDocument;this.off('mousedown',this.handleMouseDown);this.off('touchstart',this.handleMouseDown);this.off('focus',this.handleFocus);this.off('blur',this.handleBlur);this.off('click',this.handleClick);this.off(this.player_,'controlsvisible',this.update);this.off(doc,'mousemove',this.handleMouseMove);this.off(doc,'mouseup',this.handleMouseUp);this.off(doc,'touchmove',this.handleMouseMove);this.off(doc,'touchend',this.handleMouseUp);this.removeAttribute('tabindex');this.addClass('disabled');if(this.playerEvent){this.off(this.player_,this.playerEvent,this.update);}this.enabled_=false;};/**
   * Create the `Button`s DOM element.
   *
   * @param {string} type
   *        Type of element to create.
   *
   * @param {Object} [props={}]
   *        List of properties in Object form.
   *
   * @param {Object} [attributes={}]
   *        list of attributes in Object form.
   *
   * @return {Element}
   *         The element that gets created.
   */Slider.prototype.createEl=function createEl$$1(type){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var attributes=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};// Add the slider element class to all sub classes
props.className=props.className+' vjs-slider';props=assign$1({tabIndex:0},props);attributes=assign$1({'role':'slider','aria-valuenow':0,'aria-valuemin':0,'aria-valuemax':100,'tabIndex':0},attributes);return _Component.prototype.createEl.call(this,type,props,attributes);};/**
   * Handle `mousedown` or `touchstart` events on the `Slider`.
   *
   * @param {EventTarget~Event} event
   *        `mousedown` or `touchstart` event that triggered this function
   *
   * @listens mousedown
   * @listens touchstart
   * @fires Slider#slideractive
   */Slider.prototype.handleMouseDown=function handleMouseDown(event){var doc=this.bar.el_.ownerDocument;if(event.type==='mousedown'){event.preventDefault();}// Do not call preventDefault() on touchstart in Chrome
// to avoid console warnings. Use a 'touch-action: none' style
// instead to prevent unintented scrolling.
// https://developers.google.com/web/updates/2017/01/scrolling-intervention
if(event.type==='touchstart'&&!IS_CHROME){event.preventDefault();}blockTextSelection();this.addClass('vjs-sliding');/**
     * Triggered when the slider is in an active state
     *
     * @event Slider#slideractive
     * @type {EventTarget~Event}
     */this.trigger('slideractive');this.on(doc,'mousemove',this.handleMouseMove);this.on(doc,'mouseup',this.handleMouseUp);this.on(doc,'touchmove',this.handleMouseMove);this.on(doc,'touchend',this.handleMouseUp);this.handleMouseMove(event);};/**
   * Handle the `mousemove`, `touchmove`, and `mousedown` events on this `Slider`.
   * The `mousemove` and `touchmove` events will only only trigger this function during
   * `mousedown` and `touchstart`. This is due to {@link Slider#handleMouseDown} and
   * {@link Slider#handleMouseUp}.
   *
   * @param {EventTarget~Event} event
   *        `mousedown`, `mousemove`, `touchstart`, or `touchmove` event that triggered
   *        this function
   *
   * @listens mousemove
   * @listens touchmove
   */Slider.prototype.handleMouseMove=function handleMouseMove(event){};/**
   * Handle `mouseup` or `touchend` events on the `Slider`.
   *
   * @param {EventTarget~Event} event
   *        `mouseup` or `touchend` event that triggered this function.
   *
   * @listens touchend
   * @listens mouseup
   * @fires Slider#sliderinactive
   */Slider.prototype.handleMouseUp=function handleMouseUp(){var doc=this.bar.el_.ownerDocument;unblockTextSelection();this.removeClass('vjs-sliding');/**
     * Triggered when the slider is no longer in an active state.
     *
     * @event Slider#sliderinactive
     * @type {EventTarget~Event}
     */this.trigger('sliderinactive');this.off(doc,'mousemove',this.handleMouseMove);this.off(doc,'mouseup',this.handleMouseUp);this.off(doc,'touchmove',this.handleMouseMove);this.off(doc,'touchend',this.handleMouseUp);this.update();};/**
   * Update the progress bar of the `Slider`.
   *
   * @returns {number}
   *          The percentage of progress the progress bar represents as a
   *          number from 0 to 1.
   */Slider.prototype.update=function update(){// In VolumeBar init we have a setTimeout for update that pops and update
// to the end of the execution stack. The player is destroyed before then
// update will cause an error
if(!this.el_){return;}// If scrubbing, we could use a cached value to make the handle keep up
// with the user's mouse. On HTML5 browsers scrubbing is really smooth, but
// some flash players are slow, so we might want to utilize this later.
// var progress =  (this.player_.scrubbing()) ? this.player_.getCache().currentTime / this.player_.duration() : this.player_.currentTime() / this.player_.duration();
var progress=this.getPercent();var bar=this.bar;// If there's no bar...
if(!bar){return;}// Protect against no duration and other division issues
if(typeof progress!=='number'||progress!==progress||progress<0||progress===Infinity){progress=0;}// Convert to a percentage for setting
var percentage=(progress*100).toFixed(2)+'%';var style=bar.el().style;// Set the new bar width or height
if(this.vertical()){style.height=percentage;}else {style.width=percentage;}return progress;};/**
   * Calculate distance for slider
   *
   * @param {EventTarget~Event} event
   *        The event that caused this function to run.
   *
   * @return {number}
   *         The current position of the Slider.
   *         - postition.x for vertical `Slider`s
   *         - postition.y for horizontal `Slider`s
   */Slider.prototype.calculateDistance=function calculateDistance(event){var position=getPointerPosition(this.el_,event);if(this.vertical()){return position.y;}return position.x;};/**
   * Handle a `focus` event on this `Slider`.
   *
   * @param {EventTarget~Event} event
   *        The `focus` event that caused this function to run.
   *
   * @listens focus
   */Slider.prototype.handleFocus=function handleFocus(){this.on(this.bar.el_.ownerDocument,'keydown',this.handleKeyPress);};/**
   * Handle a `keydown` event on the `Slider`. Watches for left, rigth, up, and down
   * arrow keys. This function will only be called when the slider has focus. See
   * {@link Slider#handleFocus} and {@link Slider#handleBlur}.
   *
   * @param {EventTarget~Event} event
   *        the `keydown` event that caused this function to run.
   *
   * @listens keydown
   */Slider.prototype.handleKeyPress=function handleKeyPress(event){// Left and Down Arrows
if(event.which===37||event.which===40){event.preventDefault();this.stepBack();// Up and Right Arrows
}else if(event.which===38||event.which===39){event.preventDefault();this.stepForward();}};/**
   * Handle a `blur` event on this `Slider`.
   *
   * @param {EventTarget~Event} event
   *        The `blur` event that caused this function to run.
   *
   * @listens blur
   */Slider.prototype.handleBlur=function handleBlur(){this.off(this.bar.el_.ownerDocument,'keydown',this.handleKeyPress);};/**
   * Listener for click events on slider, used to prevent clicks
   *   from bubbling up to parent elements like button menus.
   *
   * @param {Object} event
   *        Event that caused this object to run
   */Slider.prototype.handleClick=function handleClick(event){event.stopImmediatePropagation();event.preventDefault();};/**
   * Get/set if slider is horizontal for vertical
   *
   * @param {boolean} [bool]
   *        - true if slider is vertical,
   *        - false is horizontal
   *
   * @return {boolean}
   *         - true if slider is vertical, and getting
   *         - false if the slider is horizontal, and getting
   */Slider.prototype.vertical=function vertical(bool){if(bool===undefined){return this.vertical_||false;}this.vertical_=!!bool;if(this.vertical_){this.addClass('vjs-slider-vertical');}else {this.addClass('vjs-slider-horizontal');}};return Slider;}(Component);Component.registerComponent('Slider',Slider);/**
 * @file load-progress-bar.js
 *//**
 * Shows loading progress
 *
 * @extends Component
 */var LoadProgressBar=function(_Component){inherits$1(LoadProgressBar,_Component);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function LoadProgressBar(player,options){classCallCheck(this,LoadProgressBar);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.partEls_=[];_this.on(player,'progress',_this.update);return _this;}/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */LoadProgressBar.prototype.createEl=function createEl$$1(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-load-progress',innerHTML:'<span class="vjs-control-text"><span>'+this.localize('Loaded')+'</span>: 0%</span>'});};LoadProgressBar.prototype.dispose=function dispose(){this.partEls_=null;_Component.prototype.dispose.call(this);};/**
   * Update progress bar
   *
   * @param {EventTarget~Event} [event]
   *        The `progress` event that caused this function to run.
   *
   * @listens Player#progress
   */LoadProgressBar.prototype.update=function update(event){var buffered=this.player_.buffered();var duration=this.player_.duration();var bufferedEnd=this.player_.bufferedEnd();var children=this.partEls_;// get the percent width of a time compared to the total end
var percentify=function percentify(time,end){// no NaN
var percent=time/end||0;return (percent>=1?1:percent)*100+'%';};// update the width of the progress bar
this.el_.style.width=percentify(bufferedEnd,duration);// add child elements to represent the individual buffered time ranges
for(var i=0;i<buffered.length;i++){var start=buffered.start(i);var end=buffered.end(i);var part=children[i];if(!part){part=this.el_.appendChild(createEl$2());children[i]=part;}// set the percent based on the width of the progress bar (bufferedEnd)
part.style.left=percentify(start,bufferedEnd);part.style.width=percentify(end-start,bufferedEnd);}// remove unused buffered range elements
for(var _i=children.length;_i>buffered.length;_i--){this.el_.removeChild(children[_i-1]);}children.length=buffered.length;};return LoadProgressBar;}(Component);Component.registerComponent('LoadProgressBar',LoadProgressBar);/**
 * @file time-tooltip.js
 *//**
 * Time tooltips display a time above the progress bar.
 *
 * @extends Component
 */var TimeTooltip=function(_Component){inherits$1(TimeTooltip,_Component);function TimeTooltip(){classCallCheck(this,TimeTooltip);return possibleConstructorReturn(this,_Component.apply(this,arguments));}/**
   * Create the time tooltip DOM element
   *
   * @return {Element}
   *         The element that was created.
   */TimeTooltip.prototype.createEl=function createEl$$1(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-time-tooltip'});};/**
   * Updates the position of the time tooltip relative to the `SeekBar`.
   *
   * @param {Object} seekBarRect
   *        The `ClientRect` for the {@link SeekBar} element.
   *
   * @param {number} seekBarPoint
   *        A number from 0 to 1, representing a horizontal reference point
   *        from the left edge of the {@link SeekBar}
   */TimeTooltip.prototype.update=function update(seekBarRect,seekBarPoint,content){var tooltipRect=getBoundingClientRect(this.el_);var playerRect=getBoundingClientRect(this.player_.el());var seekBarPointPx=seekBarRect.width*seekBarPoint;// do nothing if either rect isn't available
// for example, if the player isn't in the DOM for testing
if(!playerRect||!tooltipRect){return;}// This is the space left of the `seekBarPoint` available within the bounds
// of the player. We calculate any gap between the left edge of the player
// and the left edge of the `SeekBar` and add the number of pixels in the
// `SeekBar` before hitting the `seekBarPoint`
var spaceLeftOfPoint=seekBarRect.left-playerRect.left+seekBarPointPx;// This is the space right of the `seekBarPoint` available within the bounds
// of the player. We calculate the number of pixels from the `seekBarPoint`
// to the right edge of the `SeekBar` and add to that any gap between the
// right edge of the `SeekBar` and the player.
var spaceRightOfPoint=seekBarRect.width-seekBarPointPx+(playerRect.right-seekBarRect.right);// This is the number of pixels by which the tooltip will need to be pulled
// further to the right to center it over the `seekBarPoint`.
var pullTooltipBy=tooltipRect.width/2;// Adjust the `pullTooltipBy` distance to the left or right depending on
// the results of the space calculations above.
if(spaceLeftOfPoint<pullTooltipBy){pullTooltipBy+=pullTooltipBy-spaceLeftOfPoint;}else if(spaceRightOfPoint<pullTooltipBy){pullTooltipBy=spaceRightOfPoint;}// Due to the imprecision of decimal/ratio based calculations and varying
// rounding behaviors, there are cases where the spacing adjustment is off
// by a pixel or two. This adds insurance to these calculations.
if(pullTooltipBy<0){pullTooltipBy=0;}else if(pullTooltipBy>tooltipRect.width){pullTooltipBy=tooltipRect.width;}this.el_.style.right='-'+pullTooltipBy+'px';textContent(this.el_,content);};return TimeTooltip;}(Component);Component.registerComponent('TimeTooltip',TimeTooltip);/**
 * @file play-progress-bar.js
 *//**
 * Used by {@link SeekBar} to display media playback progress as part of the
 * {@link ProgressControl}.
 *
 * @extends Component
 */var PlayProgressBar=function(_Component){inherits$1(PlayProgressBar,_Component);function PlayProgressBar(){classCallCheck(this,PlayProgressBar);return possibleConstructorReturn(this,_Component.apply(this,arguments));}/**
   * Create the the DOM element for this class.
   *
   * @return {Element}
   *         The element that was created.
   */PlayProgressBar.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-play-progress vjs-slider-bar',innerHTML:'<span class="vjs-control-text"><span>'+this.localize('Progress')+'</span>: 0%</span>'});};/**
   * Enqueues updates to its own DOM as well as the DOM of its
   * {@link TimeTooltip} child.
   *
   * @param {Object} seekBarRect
   *        The `ClientRect` for the {@link SeekBar} element.
   *
   * @param {number} seekBarPoint
   *        A number from 0 to 1, representing a horizontal reference point
   *        from the left edge of the {@link SeekBar}
   */PlayProgressBar.prototype.update=function update(seekBarRect,seekBarPoint){var _this2=this;// If there is an existing rAF ID, cancel it so we don't over-queue.
if(this.rafId_){this.cancelAnimationFrame(this.rafId_);}this.rafId_=this.requestAnimationFrame(function(){var time=_this2.player_.scrubbing()?_this2.player_.getCache().currentTime:_this2.player_.currentTime();var content=formatTime(time,_this2.player_.duration());var timeTooltip=_this2.getChild('timeTooltip');if(timeTooltip){timeTooltip.update(seekBarRect,seekBarPoint,content);}});};return PlayProgressBar;}(Component);/**
 * Default options for {@link PlayProgressBar}.
 *
 * @type {Object}
 * @private
 */PlayProgressBar.prototype.options_={children:[]};// Time tooltips should not be added to a player on mobile devices or IE8
if((!IE_VERSION||IE_VERSION>8)&&!IS_IOS&&!IS_ANDROID){PlayProgressBar.prototype.options_.children.push('timeTooltip');}Component.registerComponent('PlayProgressBar',PlayProgressBar);/**
 * @file mouse-time-display.js
 *//**
 * The {@link MouseTimeDisplay} component tracks mouse movement over the
 * {@link ProgressControl}. It displays an indicator and a {@link TimeTooltip}
 * indicating the time which is represented by a given point in the
 * {@link ProgressControl}.
 *
 * @extends Component
 */var MouseTimeDisplay=function(_Component){inherits$1(MouseTimeDisplay,_Component);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The {@link Player} that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function MouseTimeDisplay(player,options){classCallCheck(this,MouseTimeDisplay);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.update=throttle$1(bind$2(_this,_this.update),25);return _this;}/**
   * Create the DOM element for this class.
   *
   * @return {Element}
   *         The element that was created.
   */MouseTimeDisplay.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-mouse-display'});};/**
   * Enqueues updates to its own DOM as well as the DOM of its
   * {@link TimeTooltip} child.
   *
   * @param {Object} seekBarRect
   *        The `ClientRect` for the {@link SeekBar} element.
   *
   * @param {number} seekBarPoint
   *        A number from 0 to 1, representing a horizontal reference point
   *        from the left edge of the {@link SeekBar}
   */MouseTimeDisplay.prototype.update=function update(seekBarRect,seekBarPoint){var _this2=this;// If there is an existing rAF ID, cancel it so we don't over-queue.
if(this.rafId_){this.cancelAnimationFrame(this.rafId_);}this.rafId_=this.requestAnimationFrame(function(){var duration=_this2.player_.duration();var content=formatTime(seekBarPoint*duration,duration);_this2.el_.style.left=seekBarRect.width*seekBarPoint+'px';_this2.getChild('timeTooltip').update(seekBarRect,seekBarPoint,content);});};return MouseTimeDisplay;}(Component);/**
 * Default options for `MouseTimeDisplay`
 *
 * @type {Object}
 * @private
 */MouseTimeDisplay.prototype.options_={children:['timeTooltip']};Component.registerComponent('MouseTimeDisplay',MouseTimeDisplay);/**
 * @file seek-bar.js
 */// The number of seconds the `step*` functions move the timeline.
var STEP_SECONDS=5;// The interval at which the bar should update as it progresses.
var UPDATE_REFRESH_INTERVAL=30;/**
 * Seek bar and container for the progress bars. Uses {@link PlayProgressBar}
 * as its `bar`.
 *
 * @extends Slider
 */var SeekBar=function(_Slider){inherits$1(SeekBar,_Slider);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function SeekBar(player,options){classCallCheck(this,SeekBar);var _this=possibleConstructorReturn(this,_Slider.call(this,player,options));_this.setEventHandlers_();return _this;}/**
   * Sets the event handlers
   *
   * @private
   */SeekBar.prototype.setEventHandlers_=function setEventHandlers_(){var _this2=this;this.update=throttle$1(bind$2(this,this.update),UPDATE_REFRESH_INTERVAL);this.on(this.player_,'timeupdate',this.update);this.on(this.player_,'ended',this.handleEnded);// when playing, let's ensure we smoothly update the play progress bar
// via an interval
this.updateInterval=null;this.on(this.player_,['playing'],function(){_this2.clearInterval(_this2.updateInterval);_this2.updateInterval=_this2.setInterval(function(){_this2.requestAnimationFrame(function(){_this2.update();});},UPDATE_REFRESH_INTERVAL);});this.on(this.player_,['ended','pause','waiting'],function(){_this2.clearInterval(_this2.updateInterval);});this.on(this.player_,['timeupdate','ended'],this.update);};/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */SeekBar.prototype.createEl=function createEl$$1(){return _Slider.prototype.createEl.call(this,'div',{className:'vjs-progress-holder'},{'aria-label':this.localize('Progress Bar')});};/**
   * This function updates the play progress bar and accessiblity
   * attributes to whatever is passed in.
   *
   * @param {number} currentTime
   *        The currentTime value that should be used for accessiblity
   *
   * @param {number} percent
   *        The percentage as a decimal that the bar should be filled from 0-1.
   *
   * @private
   */SeekBar.prototype.update_=function update_(currentTime,percent){var duration=this.player_.duration();// machine readable value of progress bar (percentage complete)
this.el_.setAttribute('aria-valuenow',(percent*100).toFixed(2));// human readable value of progress bar (time complete)
this.el_.setAttribute('aria-valuetext',this.localize('progress bar timing: currentTime={1} duration={2}',[formatTime(currentTime,duration),formatTime(duration,duration)],'{1} of {2}'));// Update the `PlayProgressBar`.
this.bar.update(getBoundingClientRect(this.el_),percent);};/**
   * Update the seek bar's UI.
   *
   * @param {EventTarget~Event} [event]
   *        The `timeupdate` or `ended` event that caused this to run.
   *
   * @listens Player#timeupdate
   *
   * @returns {number}
   *          The current percent at a number from 0-1
   */SeekBar.prototype.update=function update(event){var percent=_Slider.prototype.update.call(this);this.update_(this.getCurrentTime_(),percent);return percent;};/**
   * Get the value of current time but allows for smooth scrubbing,
   * when player can't keep up.
   *
   * @return {number}
   *         The current time value to display
   *
   * @private
   */SeekBar.prototype.getCurrentTime_=function getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();};/**
   * We want the seek bar to be full on ended
   * no matter what the actual internal values are. so we force it.
   *
   * @param {EventTarget~Event} [event]
   *        The `timeupdate` or `ended` event that caused this to run.
   *
   * @listens Player#ended
   */SeekBar.prototype.handleEnded=function handleEnded(event){this.update_(this.player_.duration(),1);};/**
   * Get the percentage of media played so far.
   *
   * @return {number}
   *         The percentage of media played so far (0 to 1).
   */SeekBar.prototype.getPercent=function getPercent(){var percent=this.getCurrentTime_()/this.player_.duration();return percent>=1?1:percent;};/**
   * Handle mouse down on seek bar
   *
   * @param {EventTarget~Event} event
   *        The `mousedown` event that caused this to run.
   *
   * @listens mousedown
   */SeekBar.prototype.handleMouseDown=function handleMouseDown(event){if(!isSingleLeftClick(event)){return;}// Stop event propagation to prevent double fire in progress-control.js
event.stopPropagation();this.player_.scrubbing(true);this.videoWasPlaying=!this.player_.paused();this.player_.pause();_Slider.prototype.handleMouseDown.call(this,event);};/**
   * Handle mouse move on seek bar
   *
   * @param {EventTarget~Event} event
   *        The `mousemove` event that caused this to run.
   *
   * @listens mousemove
   */SeekBar.prototype.handleMouseMove=function handleMouseMove(event){if(!isSingleLeftClick(event)){return;}var newTime=this.calculateDistance(event)*this.player_.duration();// Don't let video end while scrubbing.
if(newTime===this.player_.duration()){newTime=newTime-0.1;}// Set new time (tell player to seek to new time)
this.player_.currentTime(newTime);};SeekBar.prototype.enable=function enable(){_Slider.prototype.enable.call(this);var mouseTimeDisplay=this.getChild('mouseTimeDisplay');if(!mouseTimeDisplay){return;}mouseTimeDisplay.show();};SeekBar.prototype.disable=function disable(){_Slider.prototype.disable.call(this);var mouseTimeDisplay=this.getChild('mouseTimeDisplay');if(!mouseTimeDisplay){return;}mouseTimeDisplay.hide();};/**
   * Handle mouse up on seek bar
   *
   * @param {EventTarget~Event} event
   *        The `mouseup` event that caused this to run.
   *
   * @listens mouseup
   */SeekBar.prototype.handleMouseUp=function handleMouseUp(event){_Slider.prototype.handleMouseUp.call(this,event);// Stop event propagation to prevent double fire in progress-control.js
if(event){event.stopPropagation();}this.player_.scrubbing(false);/**
     * Trigger timeupdate because we're done seeking and the time has changed.
     * This is particularly useful for if the player is paused to time the time displays.
     *
     * @event Tech#timeupdate
     * @type {EventTarget~Event}
     */this.player_.trigger({type:'timeupdate',target:this,manuallyTriggered:true});if(this.videoWasPlaying){silencePromise(this.player_.play());}};/**
   * Move more quickly fast forward for keyboard-only users
   */SeekBar.prototype.stepForward=function stepForward(){this.player_.currentTime(this.player_.currentTime()+STEP_SECONDS);};/**
   * Move more quickly rewind for keyboard-only users
   */SeekBar.prototype.stepBack=function stepBack(){this.player_.currentTime(this.player_.currentTime()-STEP_SECONDS);};/**
   * Toggles the playback state of the player
   * This gets called when enter or space is used on the seekbar
   *
   * @param {EventTarget~Event} event
   *        The `keydown` event that caused this function to be called
   *
   */SeekBar.prototype.handleAction=function handleAction(event){if(this.player_.paused()){this.player_.play();}else {this.player_.pause();}};/**
   * Called when this SeekBar has focus and a key gets pressed down. By
   * default it will call `this.handleAction` when the key is space or enter.
   *
   * @param {EventTarget~Event} event
   *        The `keydown` event that caused this function to be called.
   *
   * @listens keydown
   */SeekBar.prototype.handleKeyPress=function handleKeyPress(event){// Support Space (32) or Enter (13) key operation to fire a click event
if(event.which===32||event.which===13){event.preventDefault();this.handleAction(event);}else if(_Slider.prototype.handleKeyPress){// Pass keypress handling up for unsupported keys
_Slider.prototype.handleKeyPress.call(this,event);}};return SeekBar;}(Slider);/**
 * Default options for the `SeekBar`
 *
 * @type {Object}
 * @private
 */SeekBar.prototype.options_={children:['loadProgressBar','playProgressBar'],barName:'playProgressBar'};// MouseTimeDisplay tooltips should not be added to a player on mobile devices or IE8
if((!IE_VERSION||IE_VERSION>8)&&!IS_IOS&&!IS_ANDROID){SeekBar.prototype.options_.children.splice(1,0,'mouseTimeDisplay');}/**
 * Call the update event for this Slider when this event happens on the player.
 *
 * @type {string}
 */SeekBar.prototype.playerEvent='timeupdate';Component.registerComponent('SeekBar',SeekBar);/**
 * @file progress-control.js
 *//**
 * The Progress Control component contains the seek bar, load progress,
 * and play progress.
 *
 * @extends Component
 */var ProgressControl=function(_Component){inherits$1(ProgressControl,_Component);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function ProgressControl(player,options){classCallCheck(this,ProgressControl);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.handleMouseMove=throttle$1(bind$2(_this,_this.handleMouseMove),25);_this.throttledHandleMouseSeek=throttle$1(bind$2(_this,_this.handleMouseSeek),25);_this.enable();return _this;}/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */ProgressControl.prototype.createEl=function createEl$$1(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-progress-control vjs-control'});};/**
   * When the mouse moves over the `ProgressControl`, the pointer position
   * gets passed down to the `MouseTimeDisplay` component.
   *
   * @param {EventTarget~Event} event
   *        The `mousemove` event that caused this function to run.
   *
   * @listen mousemove
   */ProgressControl.prototype.handleMouseMove=function handleMouseMove(event){var seekBar=this.getChild('seekBar');if(seekBar){var mouseTimeDisplay=seekBar.getChild('mouseTimeDisplay');var seekBarEl=seekBar.el();var seekBarRect=getBoundingClientRect(seekBarEl);var seekBarPoint=getPointerPosition(seekBarEl,event).x;// The default skin has a gap on either side of the `SeekBar`. This means
// that it's possible to trigger this behavior outside the boundaries of
// the `SeekBar`. This ensures we stay within it at all times.
if(seekBarPoint>1){seekBarPoint=1;}else if(seekBarPoint<0){seekBarPoint=0;}if(mouseTimeDisplay){mouseTimeDisplay.update(seekBarRect,seekBarPoint);}}};/**
   * A throttled version of the {@link ProgressControl#handleMouseSeek} listener.
   *
   * @method ProgressControl#throttledHandleMouseSeek
   * @param {EventTarget~Event} event
   *        The `mousemove` event that caused this function to run.
   *
   * @listen mousemove
   * @listen touchmove
   *//**
   * Handle `mousemove` or `touchmove` events on the `ProgressControl`.
   *
   * @param {EventTarget~Event} event
   *        `mousedown` or `touchstart` event that triggered this function
   *
   * @listens mousemove
   * @listens touchmove
   */ProgressControl.prototype.handleMouseSeek=function handleMouseSeek(event){var seekBar=this.getChild('seekBar');if(seekBar){seekBar.handleMouseMove(event);}};/**
   * Are controls are currently enabled for this progress control.
   *
   * @return {boolean}
   *         true if controls are enabled, false otherwise
   */ProgressControl.prototype.enabled=function enabled(){return this.enabled_;};/**
   * Disable all controls on the progress control and its children
   */ProgressControl.prototype.disable=function disable(){this.children().forEach(function(child){return child.disable&&child.disable();});if(!this.enabled()){return;}this.off(['mousedown','touchstart'],this.handleMouseDown);this.off(this.el_,'mousemove',this.handleMouseMove);this.handleMouseUp();this.addClass('disabled');this.enabled_=false;};/**
   * Enable all controls on the progress control and its children
   */ProgressControl.prototype.enable=function enable(){this.children().forEach(function(child){return child.enable&&child.enable();});if(this.enabled()){return;}this.on(['mousedown','touchstart'],this.handleMouseDown);this.on(this.el_,'mousemove',this.handleMouseMove);this.removeClass('disabled');this.enabled_=true;};/**
   * Handle `mousedown` or `touchstart` events on the `ProgressControl`.
   *
   * @param {EventTarget~Event} event
   *        `mousedown` or `touchstart` event that triggered this function
   *
   * @listens mousedown
   * @listens touchstart
   */ProgressControl.prototype.handleMouseDown=function handleMouseDown(event){var doc=this.el_.ownerDocument;var seekBar=this.getChild('seekBar');if(seekBar){seekBar.handleMouseDown(event);}this.on(doc,'mousemove',this.throttledHandleMouseSeek);this.on(doc,'touchmove',this.throttledHandleMouseSeek);this.on(doc,'mouseup',this.handleMouseUp);this.on(doc,'touchend',this.handleMouseUp);};/**
   * Handle `mouseup` or `touchend` events on the `ProgressControl`.
   *
   * @param {EventTarget~Event} event
   *        `mouseup` or `touchend` event that triggered this function.
   *
   * @listens touchend
   * @listens mouseup
   */ProgressControl.prototype.handleMouseUp=function handleMouseUp(event){var doc=this.el_.ownerDocument;var seekBar=this.getChild('seekBar');if(seekBar){seekBar.handleMouseUp(event);}this.off(doc,'mousemove',this.throttledHandleMouseSeek);this.off(doc,'touchmove',this.throttledHandleMouseSeek);this.off(doc,'mouseup',this.handleMouseUp);this.off(doc,'touchend',this.handleMouseUp);};return ProgressControl;}(Component);/**
 * Default options for `ProgressControl`
 *
 * @type {Object}
 * @private
 */ProgressControl.prototype.options_={children:['seekBar']};Component.registerComponent('ProgressControl',ProgressControl);/**
 * @file fullscreen-toggle.js
 *//**
 * Toggle fullscreen video
 *
 * @extends Button
 */var FullscreenToggle=function(_Button){inherits$1(FullscreenToggle,_Button);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function FullscreenToggle(player,options){classCallCheck(this,FullscreenToggle);var _this=possibleConstructorReturn(this,_Button.call(this,player,options));_this.on(player,'fullscreenchange',_this.handleFullscreenChange);if(document$1[FullscreenApi.fullscreenEnabled]===false){_this.disable();}return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */FullscreenToggle.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-fullscreen-control '+_Button.prototype.buildCSSClass.call(this);};/**
   * Handles fullscreenchange on the player and change control text accordingly.
   *
   * @param {EventTarget~Event} [event]
   *        The {@link Player#fullscreenchange} event that caused this function to be
   *        called.
   *
   * @listens Player#fullscreenchange
   */FullscreenToggle.prototype.handleFullscreenChange=function handleFullscreenChange(event){if(this.player_.isFullscreen()){this.controlText('Non-Fullscreen');}else {this.controlText('Fullscreen');}};/**
   * This gets called when an `FullscreenToggle` is "clicked". See
   * {@link ClickableComponent} for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} [event]
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */FullscreenToggle.prototype.handleClick=function handleClick(event){if(!this.player_.isFullscreen()){this.player_.requestFullscreen();}else {this.player_.exitFullscreen();}};return FullscreenToggle;}(Button);/**
 * The text that should display over the `FullscreenToggle`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */FullscreenToggle.prototype.controlText_='Fullscreen';Component.registerComponent('FullscreenToggle',FullscreenToggle);/**
 * Check if volume control is supported and if it isn't hide the
 * `Component` that was passed  using the `vjs-hidden` class.
 *
 * @param {Component} self
 *        The component that should be hidden if volume is unsupported
 *
 * @param {Player} player
 *        A reference to the player
 *
 * @private
 */var checkVolumeSupport=function checkVolumeSupport(self,player){// hide volume controls when they're not supported by the current tech
if(player.tech_&&!player.tech_.featuresVolumeControl){self.addClass('vjs-hidden');}self.on(player,'loadstart',function(){if(!player.tech_.featuresVolumeControl){self.addClass('vjs-hidden');}else {self.removeClass('vjs-hidden');}});};/**
 * @file volume-level.js
 *//**
 * Shows volume level
 *
 * @extends Component
 */var VolumeLevel=function(_Component){inherits$1(VolumeLevel,_Component);function VolumeLevel(){classCallCheck(this,VolumeLevel);return possibleConstructorReturn(this,_Component.apply(this,arguments));}/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */VolumeLevel.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-volume-level',innerHTML:'<span class="vjs-control-text"></span>'});};return VolumeLevel;}(Component);Component.registerComponent('VolumeLevel',VolumeLevel);/**
 * @file volume-bar.js
 */// Required children
/**
 * The bar that contains the volume level and can be clicked on to adjust the level
 *
 * @extends Slider
 */var VolumeBar=function(_Slider){inherits$1(VolumeBar,_Slider);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function VolumeBar(player,options){classCallCheck(this,VolumeBar);var _this=possibleConstructorReturn(this,_Slider.call(this,player,options));_this.on('slideractive',_this.updateLastVolume_);_this.on(player,'volumechange',_this.updateARIAAttributes);player.ready(function(){return _this.updateARIAAttributes();});return _this;}/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */VolumeBar.prototype.createEl=function createEl$$1(){return _Slider.prototype.createEl.call(this,'div',{className:'vjs-volume-bar vjs-slider-bar'},{'aria-label':this.localize('Volume Level'),'aria-live':'polite'});};/**
   * Handle mouse down on volume bar
   *
   * @param {EventTarget~Event} event
   *        The `mousedown` event that caused this to run.
   *
   * @listens mousedown
   */VolumeBar.prototype.handleMouseDown=function handleMouseDown(event){if(!isSingleLeftClick(event)){return;}_Slider.prototype.handleMouseDown.call(this,event);};/**
   * Handle movement events on the {@link VolumeMenuButton}.
   *
   * @param {EventTarget~Event} event
   *        The event that caused this function to run.
   *
   * @listens mousemove
   */VolumeBar.prototype.handleMouseMove=function handleMouseMove(event){if(!isSingleLeftClick(event)){return;}this.checkMuted();this.player_.volume(this.calculateDistance(event));};/**
   * If the player is muted unmute it.
   */VolumeBar.prototype.checkMuted=function checkMuted(){if(this.player_.muted()){this.player_.muted(false);}};/**
   * Get percent of volume level
   *
   * @return {number}
   *         Volume level percent as a decimal number.
   */VolumeBar.prototype.getPercent=function getPercent(){if(this.player_.muted()){return 0;}return this.player_.volume();};/**
   * Increase volume level for keyboard users
   */VolumeBar.prototype.stepForward=function stepForward(){this.checkMuted();this.player_.volume(this.player_.volume()+0.1);};/**
   * Decrease volume level for keyboard users
   */VolumeBar.prototype.stepBack=function stepBack(){this.checkMuted();this.player_.volume(this.player_.volume()-0.1);};/**
   * Update ARIA accessibility attributes
   *
   * @param {EventTarget~Event} [event]
   *        The `volumechange` event that caused this function to run.
   *
   * @listens Player#volumechange
   */VolumeBar.prototype.updateARIAAttributes=function updateARIAAttributes(event){var ariaValue=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute('aria-valuenow',ariaValue);this.el_.setAttribute('aria-valuetext',ariaValue+'%');};/**
   * Returns the current value of the player volume as a percentage
   *
   * @private
   */VolumeBar.prototype.volumeAsPercentage_=function volumeAsPercentage_(){return Math.round(this.player_.volume()*100);};/**
   * When user starts dragging the VolumeBar, store the volume and listen for
   * the end of the drag. When the drag ends, if the volume was set to zero,
   * set lastVolume to the stored volume.
   *
   * @listens slideractive
   * @private
   */VolumeBar.prototype.updateLastVolume_=function updateLastVolume_(){var _this2=this;var volumeBeforeDrag=this.player_.volume();this.one('sliderinactive',function(){if(_this2.player_.volume()===0){_this2.player_.lastVolume_(volumeBeforeDrag);}});};return VolumeBar;}(Slider);/**
 * Default options for the `VolumeBar`
 *
 * @type {Object}
 * @private
 */VolumeBar.prototype.options_={children:['volumeLevel'],barName:'volumeLevel'};/**
 * Call the update event for this Slider when this event happens on the player.
 *
 * @type {string}
 */VolumeBar.prototype.playerEvent='volumechange';Component.registerComponent('VolumeBar',VolumeBar);/**
 * @file volume-control.js
 */// Required children
/**
 * The component for controlling the volume level
 *
 * @extends Component
 */var VolumeControl=function(_Component){inherits$1(VolumeControl,_Component);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options={}]
   *        The key/value store of player options.
   */function VolumeControl(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,VolumeControl);options.vertical=options.vertical||false;// Pass the vertical option down to the VolumeBar if
// the VolumeBar is turned on.
if(typeof options.volumeBar==='undefined'||isPlain(options.volumeBar)){options.volumeBar=options.volumeBar||{};options.volumeBar.vertical=options.vertical;}// hide this control if volume support is missing
var _this=possibleConstructorReturn(this,_Component.call(this,player,options));checkVolumeSupport(_this,player);_this.throttledHandleMouseMove=throttle$1(bind$2(_this,_this.handleMouseMove),25);_this.on('mousedown',_this.handleMouseDown);_this.on('touchstart',_this.handleMouseDown);// while the slider is active (the mouse has been pressed down and
// is dragging) or in focus we do not want to hide the VolumeBar
_this.on(_this.volumeBar,['focus','slideractive'],function(){_this.volumeBar.addClass('vjs-slider-active');_this.addClass('vjs-slider-active');_this.trigger('slideractive');});_this.on(_this.volumeBar,['blur','sliderinactive'],function(){_this.volumeBar.removeClass('vjs-slider-active');_this.removeClass('vjs-slider-active');_this.trigger('sliderinactive');});return _this;}/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */VolumeControl.prototype.createEl=function createEl(){var orientationClass='vjs-volume-horizontal';if(this.options_.vertical){orientationClass='vjs-volume-vertical';}return _Component.prototype.createEl.call(this,'div',{className:'vjs-volume-control vjs-control '+orientationClass});};/**
   * Handle `mousedown` or `touchstart` events on the `VolumeControl`.
   *
   * @param {EventTarget~Event} event
   *        `mousedown` or `touchstart` event that triggered this function
   *
   * @listens mousedown
   * @listens touchstart
   */VolumeControl.prototype.handleMouseDown=function handleMouseDown(event){var doc=this.el_.ownerDocument;this.on(doc,'mousemove',this.throttledHandleMouseMove);this.on(doc,'touchmove',this.throttledHandleMouseMove);this.on(doc,'mouseup',this.handleMouseUp);this.on(doc,'touchend',this.handleMouseUp);};/**
   * Handle `mouseup` or `touchend` events on the `VolumeControl`.
   *
   * @param {EventTarget~Event} event
   *        `mouseup` or `touchend` event that triggered this function.
   *
   * @listens touchend
   * @listens mouseup
   */VolumeControl.prototype.handleMouseUp=function handleMouseUp(event){var doc=this.el_.ownerDocument;this.off(doc,'mousemove',this.throttledHandleMouseMove);this.off(doc,'touchmove',this.throttledHandleMouseMove);this.off(doc,'mouseup',this.handleMouseUp);this.off(doc,'touchend',this.handleMouseUp);};/**
   * Handle `mousedown` or `touchstart` events on the `VolumeControl`.
   *
   * @param {EventTarget~Event} event
   *        `mousedown` or `touchstart` event that triggered this function
   *
   * @listens mousedown
   * @listens touchstart
   */VolumeControl.prototype.handleMouseMove=function handleMouseMove(event){this.volumeBar.handleMouseMove(event);};return VolumeControl;}(Component);/**
 * Default options for the `VolumeControl`
 *
 * @type {Object}
 * @private
 */VolumeControl.prototype.options_={children:['volumeBar']};Component.registerComponent('VolumeControl',VolumeControl);/**
 * Check if muting volume is supported and if it isn't hide the mute toggle
 * button.
 *
 * @param {Component} self
 *        A reference to the mute toggle button
 *
 * @param {Player} player
 *        A reference to the player
 *
 * @private
 */var checkMuteSupport=function checkMuteSupport(self,player){// hide mute toggle button if it's not supported by the current tech
if(player.tech_&&!player.tech_.featuresMuteControl){self.addClass('vjs-hidden');}self.on(player,'loadstart',function(){if(!player.tech_.featuresMuteControl){self.addClass('vjs-hidden');}else {self.removeClass('vjs-hidden');}});};/**
 * @file mute-toggle.js
 *//**
 * A button component for muting the audio.
 *
 * @extends Button
 */var MuteToggle=function(_Button){inherits$1(MuteToggle,_Button);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function MuteToggle(player,options){classCallCheck(this,MuteToggle);// hide this control if volume support is missing
var _this=possibleConstructorReturn(this,_Button.call(this,player,options));checkMuteSupport(_this,player);_this.on(player,['loadstart','volumechange'],_this.update);return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */MuteToggle.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-mute-control '+_Button.prototype.buildCSSClass.call(this);};/**
   * This gets called when an `MuteToggle` is "clicked". See
   * {@link ClickableComponent} for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} [event]
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */MuteToggle.prototype.handleClick=function handleClick(event){var vol=this.player_.volume();var lastVolume=this.player_.lastVolume_();if(vol===0){var volumeToSet=lastVolume<0.1?0.1:lastVolume;this.player_.volume(volumeToSet);this.player_.muted(false);}else {this.player_.muted(this.player_.muted()?false:true);}};/**
   * Update the `MuteToggle` button based on the state of `volume` and `muted`
   * on the player.
   *
   * @param {EventTarget~Event} [event]
   *        The {@link Player#loadstart} event if this function was called
   *        through an event.
   *
   * @listens Player#loadstart
   * @listens Player#volumechange
   */MuteToggle.prototype.update=function update(event){this.updateIcon_();this.updateControlText_();};/**
   * Update the appearance of the `MuteToggle` icon.
   *
   * Possible states (given `level` variable below):
   * - 0: crossed out
   * - 1: zero bars of volume
   * - 2: one bar of volume
   * - 3: two bars of volume
   *
   * @private
   */MuteToggle.prototype.updateIcon_=function updateIcon_(){var vol=this.player_.volume();var level=3;// in iOS when a player is loaded with muted attribute
// and volume is changed with a native mute button
// we want to make sure muted state is updated
if(IS_IOS){this.player_.muted(this.player_.tech_.el_.muted);}if(vol===0||this.player_.muted()){level=0;}else if(vol<0.33){level=1;}else if(vol<0.67){level=2;}// TODO improve muted icon classes
for(var i=0;i<4;i++){removeClass(this.el_,'vjs-vol-'+i);}addClass(this.el_,'vjs-vol-'+level);};/**
   * If `muted` has changed on the player, update the control text
   * (`title` attribute on `vjs-mute-control` element and content of
   * `vjs-control-text` element).
   *
   * @private
   */MuteToggle.prototype.updateControlText_=function updateControlText_(){var soundOff=this.player_.muted()||this.player_.volume()===0;var text=soundOff?'Unmute':'Mute';if(this.controlText()!==text){this.controlText(text);}};return MuteToggle;}(Button);/**
 * The text that should display over the `MuteToggle`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */MuteToggle.prototype.controlText_='Mute';Component.registerComponent('MuteToggle',MuteToggle);/**
 * @file volume-control.js
 */// Required children
/**
 * A Component to contain the MuteToggle and VolumeControl so that
 * they can work together.
 *
 * @extends Component
 */var VolumePanel=function(_Component){inherits$1(VolumePanel,_Component);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options={}]
   *        The key/value store of player options.
   */function VolumePanel(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,VolumePanel);if(typeof options.inline!=='undefined'){options.inline=options.inline;}else {options.inline=true;}// pass the inline option down to the VolumeControl as vertical if
// the VolumeControl is on.
if(typeof options.volumeControl==='undefined'||isPlain(options.volumeControl)){options.volumeControl=options.volumeControl||{};options.volumeControl.vertical=!options.inline;}var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.on(player,['loadstart'],_this.volumePanelState_);// while the slider is active (the mouse has been pressed down and
// is dragging) we do not want to hide the VolumeBar
_this.on(_this.volumeControl,['slideractive'],_this.sliderActive_);_this.on(_this.volumeControl,['sliderinactive'],_this.sliderInactive_);return _this;}/**
   * Add vjs-slider-active class to the VolumePanel
   *
   * @listens VolumeControl#slideractive
   * @private
   */VolumePanel.prototype.sliderActive_=function sliderActive_(){this.addClass('vjs-slider-active');};/**
   * Removes vjs-slider-active class to the VolumePanel
   *
   * @listens VolumeControl#sliderinactive
   * @private
   */VolumePanel.prototype.sliderInactive_=function sliderInactive_(){this.removeClass('vjs-slider-active');};/**
   * Adds vjs-hidden or vjs-mute-toggle-only to the VolumePanel
   * depending on MuteToggle and VolumeControl state
   *
   * @listens Player#loadstart
   * @private
   */VolumePanel.prototype.volumePanelState_=function volumePanelState_(){// hide volume panel if neither volume control or mute toggle
// are displayed
if(this.volumeControl.hasClass('vjs-hidden')&&this.muteToggle.hasClass('vjs-hidden')){this.addClass('vjs-hidden');}// if only mute toggle is visible we don't want
// volume panel expanding when hovered or active
if(this.volumeControl.hasClass('vjs-hidden')&&!this.muteToggle.hasClass('vjs-hidden')){this.addClass('vjs-mute-toggle-only');}};/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */VolumePanel.prototype.createEl=function createEl(){var orientationClass='vjs-volume-panel-horizontal';if(!this.options_.inline){orientationClass='vjs-volume-panel-vertical';}return _Component.prototype.createEl.call(this,'div',{className:'vjs-volume-panel vjs-control '+orientationClass});};return VolumePanel;}(Component);/**
 * Default options for the `VolumeControl`
 *
 * @type {Object}
 * @private
 */VolumePanel.prototype.options_={children:['muteToggle','volumeControl']};Component.registerComponent('VolumePanel',VolumePanel);/**
 * @file menu.js
 *//**
 * The Menu component is used to build popup menus, including subtitle and
 * captions selection menus.
 *
 * @extends Component
 */var Menu=function(_Component){inherits$1(Menu,_Component);/**
   * Create an instance of this class.
   *
   * @param {Player} player
   *        the player that this component should attach to
   *
   * @param {Object} [options]
   *        Object of option names and values
   *
   */function Menu(player,options){classCallCheck(this,Menu);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));if(options){_this.menuButton_=options.menuButton;}_this.focusedChild_=-1;_this.on('keydown',_this.handleKeyPress);return _this;}/**
   * Add a {@link MenuItem} to the menu.
   *
   * @param {Object|string} component
   *        The name or instance of the `MenuItem` to add.
   *
   */Menu.prototype.addItem=function addItem(component){this.addChild(component);component.on('click',bind$2(this,function(event){// Unpress the associated MenuButton, and move focus back to it
if(this.menuButton_){this.menuButton_.unpressButton();// don't focus menu button if item is a caption settings item
// because focus will move elsewhere and it logs an error on IE8
if(component.name()!=='CaptionSettingsMenuItem'){this.menuButton_.focus();}}}));};/**
   * Create the `Menu`s DOM element.
   *
   * @return {Element}
   *         the element that was created
   */Menu.prototype.createEl=function createEl$$1(){var contentElType=this.options_.contentElType||'ul';this.contentEl_=createEl$2(contentElType,{className:'vjs-menu-content'});this.contentEl_.setAttribute('role','menu');var el=_Component.prototype.createEl.call(this,'div',{append:this.contentEl_,className:'vjs-menu'});el.appendChild(this.contentEl_);// Prevent clicks from bubbling up. Needed for Menu Buttons,
// where a click on the parent is significant
on(el,'click',function(event){event.preventDefault();event.stopImmediatePropagation();});return el;};Menu.prototype.dispose=function dispose(){this.contentEl_=null;_Component.prototype.dispose.call(this);};/**
   * Handle a `keydown` event on this menu. This listener is added in the constructor.
   *
   * @param {EventTarget~Event} event
   *        A `keydown` event that happened on the menu.
   *
   * @listens keydown
   */Menu.prototype.handleKeyPress=function handleKeyPress(event){// Left and Down Arrows
if(event.which===37||event.which===40){event.preventDefault();this.stepForward();// Up and Right Arrows
}else if(event.which===38||event.which===39){event.preventDefault();this.stepBack();}};/**
   * Move to next (lower) menu item for keyboard users.
   */Menu.prototype.stepForward=function stepForward(){var stepChild=0;if(this.focusedChild_!==undefined){stepChild=this.focusedChild_+1;}this.focus(stepChild);};/**
   * Move to previous (higher) menu item for keyboard users.
   */Menu.prototype.stepBack=function stepBack(){var stepChild=0;if(this.focusedChild_!==undefined){stepChild=this.focusedChild_-1;}this.focus(stepChild);};/**
   * Set focus on a {@link MenuItem} in the `Menu`.
   *
   * @param {Object|string} [item=0]
   *        Index of child item set focus on.
   */Menu.prototype.focus=function focus(){var item=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var children=this.children().slice();var haveTitle=children.length&&children[0].className&&/vjs-menu-title/.test(children[0].className);if(haveTitle){children.shift();}if(children.length>0){if(item<0){item=0;}else if(item>=children.length){item=children.length-1;}this.focusedChild_=item;children[item].el_.focus();}};return Menu;}(Component);Component.registerComponent('Menu',Menu);/**
 * @file menu-button.js
 *//**
 * A `MenuButton` class for any popup {@link Menu}.
 *
 * @extends Component
 */var MenuButton=function(_Component){inherits$1(MenuButton,_Component);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options={}]
   *        The key/value store of player options.
   */function MenuButton(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,MenuButton);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.menuButton_=new Button(player,options);_this.menuButton_.controlText(_this.controlText_);_this.menuButton_.el_.setAttribute('aria-haspopup','true');// Add buildCSSClass values to the button, not the wrapper
var buttonClass=Button.prototype.buildCSSClass();_this.menuButton_.el_.className=_this.buildCSSClass()+' '+buttonClass;_this.menuButton_.removeClass('vjs-control');_this.addChild(_this.menuButton_);_this.update();_this.enabled_=true;_this.on(_this.menuButton_,'tap',_this.handleClick);_this.on(_this.menuButton_,'click',_this.handleClick);_this.on(_this.menuButton_,'focus',_this.handleFocus);_this.on(_this.menuButton_,'blur',_this.handleBlur);_this.on('keydown',_this.handleSubmenuKeyPress);return _this;}/**
   * Update the menu based on the current state of its items.
   */MenuButton.prototype.update=function update(){var menu=this.createMenu();if(this.menu){this.menu.dispose();this.removeChild(this.menu);}this.menu=menu;this.addChild(menu);/**
     * Track the state of the menu button
     *
     * @type {Boolean}
     * @private
     */this.buttonPressed_=false;this.menuButton_.el_.setAttribute('aria-expanded','false');if(this.items&&this.items.length<=this.hideThreshold_){this.hide();}else {this.show();}};/**
   * Create the menu and add all items to it.
   *
   * @return {Menu}
   *         The constructed menu
   */MenuButton.prototype.createMenu=function createMenu(){var menu=new Menu(this.player_,{menuButton:this});/**
     * Hide the menu if the number of items is less than or equal to this threshold. This defaults
     * to 0 and whenever we add items which can be hidden to the menu we'll increment it. We list
     * it here because every time we run `createMenu` we need to reset the value.
     *
     * @protected
     * @type {Number}
     */this.hideThreshold_=0;// Add a title list item to the top
if(this.options_.title){var title=createEl$2('li',{className:'vjs-menu-title',innerHTML:toTitleCase(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;menu.children_.unshift(title);prependTo(title,menu.contentEl());}this.items=this.createItems();if(this.items){// Add menu items to the menu
for(var i=0;i<this.items.length;i++){menu.addItem(this.items[i]);}}return menu;};/**
   * Create the list of menu items. Specific to each subclass.
   *
   * @abstract
   */MenuButton.prototype.createItems=function createItems(){};/**
   * Create the `MenuButtons`s DOM element.
   *
   * @return {Element}
   *         The element that gets created.
   */MenuButton.prototype.createEl=function createEl$$1(){return _Component.prototype.createEl.call(this,'div',{className:this.buildWrapperCSSClass()},{});};/**
   * Allow sub components to stack CSS class names for the wrapper element
   *
   * @return {string}
   *         The constructed wrapper DOM `className`
   */MenuButton.prototype.buildWrapperCSSClass=function buildWrapperCSSClass(){var menuButtonClass='vjs-menu-button';// If the inline option is passed, we want to use different styles altogether.
if(this.options_.inline===true){menuButtonClass+='-inline';}else {menuButtonClass+='-popup';}// TODO: Fix the CSS so that this isn't necessary
var buttonClass=Button.prototype.buildCSSClass();return 'vjs-menu-button '+menuButtonClass+' '+buttonClass+' '+_Component.prototype.buildCSSClass.call(this);};/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */MenuButton.prototype.buildCSSClass=function buildCSSClass(){var menuButtonClass='vjs-menu-button';// If the inline option is passed, we want to use different styles altogether.
if(this.options_.inline===true){menuButtonClass+='-inline';}else {menuButtonClass+='-popup';}return 'vjs-menu-button '+menuButtonClass+' '+_Component.prototype.buildCSSClass.call(this);};/**
   * Get or set the localized control text that will be used for accessibility.
   *
   * > NOTE: This will come from the internal `menuButton_` element.
   *
   * @param {string} [text]
   *        Control text for element.
   *
   * @param {Element} [el=this.menuButton_.el()]
   *        Element to set the title on.
   *
   * @return {string}
   *         - The control text when getting
   */MenuButton.prototype.controlText=function controlText(text){var el=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(text,el);};/**
   * Handle a click on a `MenuButton`.
   * See {@link ClickableComponent#handleClick} for instances where this is called.
   *
   * @param {EventTarget~Event} event
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */MenuButton.prototype.handleClick=function handleClick(event){// When you click the button it adds focus, which will show the menu.
// So we'll remove focus when the mouse leaves the button. Focus is needed
// for tab navigation.
this.one(this.menu.contentEl(),'mouseleave',bind$2(this,function(e){this.unpressButton();this.el_.blur();}));if(this.buttonPressed_){this.unpressButton();}else {this.pressButton();}};/**
   * Set the focus to the actual button, not to this element
   */MenuButton.prototype.focus=function focus(){this.menuButton_.focus();};/**
   * Remove the focus from the actual button, not this element
   */MenuButton.prototype.blur=function blur(){this.menuButton_.blur();};/**
   * This gets called when a `MenuButton` gains focus via a `focus` event.
   * Turns on listening for `keydown` events. When they happen it
   * calls `this.handleKeyPress`.
   *
   * @param {EventTarget~Event} event
   *        The `focus` event that caused this function to be called.
   *
   * @listens focus
   */MenuButton.prototype.handleFocus=function handleFocus(){on(document$1,'keydown',bind$2(this,this.handleKeyPress));};/**
   * Called when a `MenuButton` loses focus. Turns off the listener for
   * `keydown` events. Which Stops `this.handleKeyPress` from getting called.
   *
   * @param {EventTarget~Event} event
   *        The `blur` event that caused this function to be called.
   *
   * @listens blur
   */MenuButton.prototype.handleBlur=function handleBlur(){off(document$1,'keydown',bind$2(this,this.handleKeyPress));};/**
   * Handle tab, escape, down arrow, and up arrow keys for `MenuButton`. See
   * {@link ClickableComponent#handleKeyPress} for instances where this is called.
   *
   * @param {EventTarget~Event} event
   *        The `keydown` event that caused this function to be called.
   *
   * @listens keydown
   */MenuButton.prototype.handleKeyPress=function handleKeyPress(event){// Escape (27) key or Tab (9) key unpress the 'button'
if(event.which===27||event.which===9){if(this.buttonPressed_){this.unpressButton();}// Don't preventDefault for Tab key - we still want to lose focus
if(event.which!==9){event.preventDefault();// Set focus back to the menu button's button
this.menuButton_.el_.focus();}// Up (38) key or Down (40) key press the 'button'
}else if(event.which===38||event.which===40){if(!this.buttonPressed_){this.pressButton();event.preventDefault();}}};/**
   * Handle a `keydown` event on a sub-menu. The listener for this is added in
   * the constructor.
   *
   * @param {EventTarget~Event} event
   *        Key press event
   *
   * @listens keydown
   */MenuButton.prototype.handleSubmenuKeyPress=function handleSubmenuKeyPress(event){// Escape (27) key or Tab (9) key unpress the 'button'
if(event.which===27||event.which===9){if(this.buttonPressed_){this.unpressButton();}// Don't preventDefault for Tab key - we still want to lose focus
if(event.which!==9){event.preventDefault();// Set focus back to the menu button's button
this.menuButton_.el_.focus();}}};/**
   * Put the current `MenuButton` into a pressed state.
   */MenuButton.prototype.pressButton=function pressButton(){if(this.enabled_){this.buttonPressed_=true;this.menu.lockShowing();this.menuButton_.el_.setAttribute('aria-expanded','true');// set the focus into the submenu, except on iOS where it is resulting in
// undesired scrolling behavior when the player is in an iframe
if(IS_IOS&&isInFrame()){// Return early so that the menu isn't focused
return;}this.menu.focus();}};/**
   * Take the current `MenuButton` out of a pressed state.
   */MenuButton.prototype.unpressButton=function unpressButton(){if(this.enabled_){this.buttonPressed_=false;this.menu.unlockShowing();this.menuButton_.el_.setAttribute('aria-expanded','false');}};/**
   * Disable the `MenuButton`. Don't allow it to be clicked.
   */MenuButton.prototype.disable=function disable(){this.unpressButton();this.enabled_=false;this.addClass('vjs-disabled');this.menuButton_.disable();};/**
   * Enable the `MenuButton`. Allow it to be clicked.
   */MenuButton.prototype.enable=function enable(){this.enabled_=true;this.removeClass('vjs-disabled');this.menuButton_.enable();};return MenuButton;}(Component);Component.registerComponent('MenuButton',MenuButton);/**
 * @file track-button.js
 *//**
 * The base class for buttons that toggle specific  track types (e.g. subtitles).
 *
 * @extends MenuButton
 */var TrackButton=function(_MenuButton){inherits$1(TrackButton,_MenuButton);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function TrackButton(player,options){classCallCheck(this,TrackButton);var tracks=options.tracks;var _this=possibleConstructorReturn(this,_MenuButton.call(this,player,options));if(_this.items.length<=1){_this.hide();}if(!tracks){return possibleConstructorReturn(_this);}var updateHandler=bind$2(_this,_this.update);tracks.addEventListener('removetrack',updateHandler);tracks.addEventListener('addtrack',updateHandler);_this.player_.on('ready',updateHandler);_this.player_.on('dispose',function(){tracks.removeEventListener('removetrack',updateHandler);tracks.removeEventListener('addtrack',updateHandler);});return _this;}return TrackButton;}(MenuButton);Component.registerComponent('TrackButton',TrackButton);/**
 * @file menu-item.js
 *//**
 * The component for a menu item. `<li>`
 *
 * @extends ClickableComponent
 */var MenuItem=function(_ClickableComponent){inherits$1(MenuItem,_ClickableComponent);/**
   * Creates an instance of the this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options={}]
   *        The key/value store of player options.
   *
   */function MenuItem(player,options){classCallCheck(this,MenuItem);var _this=possibleConstructorReturn(this,_ClickableComponent.call(this,player,options));_this.selectable=options.selectable;_this.isSelected_=options.selected||false;_this.multiSelectable=options.multiSelectable;_this.selected(_this.isSelected_);if(_this.selectable){if(_this.multiSelectable){_this.el_.setAttribute('role','menuitemcheckbox');}else {_this.el_.setAttribute('role','menuitemradio');}}else {_this.el_.setAttribute('role','menuitem');}return _this;}/**
   * Create the `MenuItem's DOM element
   *
   * @param {string} [type=li]
   *        Element's node type, not actually used, always set to `li`.
   *
   * @param {Object} [props={}]
   *        An object of properties that should be set on the element
   *
   * @param {Object} [attrs={}]
   *        An object of attributes that should be set on the element
   *
   * @return {Element}
   *         The element that gets created.
   */MenuItem.prototype.createEl=function createEl(type,props,attrs){// The control is textual, not just an icon
this.nonIconControl=true;return _ClickableComponent.prototype.createEl.call(this,'li',assign$1({className:'vjs-menu-item',innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+'</span>',tabIndex:-1},props),attrs);};/**
   * Any click on a `MenuItem` puts it into the selected state.
   * See {@link ClickableComponent#handleClick} for instances where this is called.
   *
   * @param {EventTarget~Event} event
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */MenuItem.prototype.handleClick=function handleClick(event){this.selected(true);};/**
   * Set the state for this menu item as selected or not.
   *
   * @param {boolean} selected
   *        if the menu item is selected or not
   */MenuItem.prototype.selected=function selected(_selected){if(this.selectable){if(_selected){this.addClass('vjs-selected');this.el_.setAttribute('aria-checked','true');// aria-checked isn't fully supported by browsers/screen readers,
// so indicate selected state to screen reader in the control text.
this.controlText(', selected');this.isSelected_=true;}else {this.removeClass('vjs-selected');this.el_.setAttribute('aria-checked','false');// Indicate un-selected state to screen reader
this.controlText('');this.isSelected_=false;}}};return MenuItem;}(ClickableComponent);Component.registerComponent('MenuItem',MenuItem);/**
 * @file text-track-menu-item.js
 *//**
 * The specific menu item type for selecting a language within a text track kind
 *
 * @extends MenuItem
 */var TextTrackMenuItem=function(_MenuItem){inherits$1(TextTrackMenuItem,_MenuItem);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function TextTrackMenuItem(player,options){classCallCheck(this,TextTrackMenuItem);var track=options.track;var tracks=player.textTracks();// Modify options for parent MenuItem class's init.
options.label=track.label||track.language||'Unknown';options.selected=track.mode==='showing';var _this=possibleConstructorReturn(this,_MenuItem.call(this,player,options));_this.track=track;var changeHandler=function changeHandler(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this.handleTracksChange.apply(_this,args);};var selectedLanguageChangeHandler=function selectedLanguageChangeHandler(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}_this.handleSelectedLanguageChange.apply(_this,args);};player.on(['loadstart','texttrackchange'],changeHandler);tracks.addEventListener('change',changeHandler);tracks.addEventListener('selectedlanguagechange',selectedLanguageChangeHandler);_this.on('dispose',function(){player.off(['loadstart','texttrackchange'],changeHandler);tracks.removeEventListener('change',changeHandler);tracks.removeEventListener('selectedlanguagechange',selectedLanguageChangeHandler);});// iOS7 doesn't dispatch change events to TextTrackLists when an
// associated track's mode changes. Without something like
// Object.observe() (also not present on iOS7), it's not
// possible to detect changes to the mode attribute and polyfill
// the change event. As a poor substitute, we manually dispatch
// change events whenever the controls modify the mode.
if(tracks.onchange===undefined){var event=void 0;_this.on(['tap','click'],function(){if(_typeof$2(window$1.Event)!=='object'){// Android 2.3 throws an Illegal Constructor error for window.Event
try{event=new window$1.Event('change');}catch(err){// continue regardless of error
}}if(!event){event=document$1.createEvent('Event');event.initEvent('change',true,true);}tracks.dispatchEvent(event);});}// set the default state based on current tracks
_this.handleTracksChange();return _this;}/**
   * This gets called when an `TextTrackMenuItem` is "clicked". See
   * {@link ClickableComponent} for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} event
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */TextTrackMenuItem.prototype.handleClick=function handleClick(event){var kind=this.track.kind;var kinds=this.track.kinds;var tracks=this.player_.textTracks();if(!kinds){kinds=[kind];}_MenuItem.prototype.handleClick.call(this,event);if(!tracks){return;}for(var i=0;i<tracks.length;i++){var track=tracks[i];if(track===this.track&&kinds.indexOf(track.kind)>-1){if(track.mode!=='showing'){track.mode='showing';}}else if(track.mode!=='disabled'){track.mode='disabled';}}};/**
   * Handle text track list change
   *
   * @param {EventTarget~Event} event
   *        The `change` event that caused this function to be called.
   *
   * @listens TextTrackList#change
   */TextTrackMenuItem.prototype.handleTracksChange=function handleTracksChange(event){var shouldBeSelected=this.track.mode==='showing';// Prevent redundant selected() calls because they may cause
// screen readers to read the appended control text unnecessarily
if(shouldBeSelected!==this.isSelected_){this.selected(shouldBeSelected);}};TextTrackMenuItem.prototype.handleSelectedLanguageChange=function handleSelectedLanguageChange(event){if(this.track.mode==='showing'){var selectedLanguage=this.player_.cache_.selectedLanguage;// Don't replace the kind of track across the same language
if(selectedLanguage&&selectedLanguage.enabled&&selectedLanguage.language===this.track.language&&selectedLanguage.kind!==this.track.kind){return;}this.player_.cache_.selectedLanguage={enabled:true,language:this.track.language,kind:this.track.kind};}};TextTrackMenuItem.prototype.dispose=function dispose(){// remove reference to track object on dispose
this.track=null;_MenuItem.prototype.dispose.call(this);};return TextTrackMenuItem;}(MenuItem);Component.registerComponent('TextTrackMenuItem',TextTrackMenuItem);/**
 * @file off-text-track-menu-item.js
 *//**
 * A special menu item for turning of a specific type of text track
 *
 * @extends TextTrackMenuItem
 */var OffTextTrackMenuItem=function(_TextTrackMenuItem){inherits$1(OffTextTrackMenuItem,_TextTrackMenuItem);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function OffTextTrackMenuItem(player,options){classCallCheck(this,OffTextTrackMenuItem);// Create pseudo track info
// Requires options['kind']
options.track={player:player,kind:options.kind,kinds:options.kinds,'default':false,mode:'disabled'};if(!options.kinds){options.kinds=[options.kind];}if(options.label){options.track.label=options.label;}else {options.track.label=options.kinds.join(' and ')+' off';}// MenuItem is selectable
options.selectable=true;// MenuItem is NOT multiSelectable (i.e. only one can be marked "selected" at a time)
options.multiSelectable=false;return possibleConstructorReturn(this,_TextTrackMenuItem.call(this,player,options));}/**
   * Handle text track change
   *
   * @param {EventTarget~Event} event
   *        The event that caused this function to run
   */OffTextTrackMenuItem.prototype.handleTracksChange=function handleTracksChange(event){var tracks=this.player().textTracks();var shouldBeSelected=true;for(var i=0,l=tracks.length;i<l;i++){var track=tracks[i];if(this.options_.kinds.indexOf(track.kind)>-1&&track.mode==='showing'){shouldBeSelected=false;break;}}// Prevent redundant selected() calls because they may cause
// screen readers to read the appended control text unnecessarily
if(shouldBeSelected!==this.isSelected_){this.selected(shouldBeSelected);}};OffTextTrackMenuItem.prototype.handleSelectedLanguageChange=function handleSelectedLanguageChange(event){var tracks=this.player().textTracks();var allHidden=true;for(var i=0,l=tracks.length;i<l;i++){var track=tracks[i];if(['captions','descriptions','subtitles'].indexOf(track.kind)>-1&&track.mode==='showing'){allHidden=false;break;}}if(allHidden){this.player_.cache_.selectedLanguage={enabled:false};}};return OffTextTrackMenuItem;}(TextTrackMenuItem);Component.registerComponent('OffTextTrackMenuItem',OffTextTrackMenuItem);/**
 * @file text-track-button.js
 *//**
 * The base class for buttons that toggle specific text track types (e.g. subtitles)
 *
 * @extends MenuButton
 */var TextTrackButton=function(_TrackButton){inherits$1(TextTrackButton,_TrackButton);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options={}]
   *        The key/value store of player options.
   */function TextTrackButton(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,TextTrackButton);options.tracks=player.textTracks();return possibleConstructorReturn(this,_TrackButton.call(this,player,options));}/**
   * Create a menu item for each text track
   *
   * @param {TextTrackMenuItem[]} [items=[]]
   *        Existing array of items to use during creation
   *
   * @return {TextTrackMenuItem[]}
   *         Array of menu items that were created
   */TextTrackButton.prototype.createItems=function createItems(){var items=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var TrackMenuItem=arguments.length>1&&arguments[1]!==undefined?arguments[1]:TextTrackMenuItem;// Label is an overide for the [track] off label
// USed to localise captions/subtitles
var label=void 0;if(this.label_){label=this.label_+' off';}// Add an OFF menu item to turn all tracks off
items.push(new OffTextTrackMenuItem(this.player_,{kinds:this.kinds_,kind:this.kind_,label:label}));this.hideThreshold_+=1;var tracks=this.player_.textTracks();if(!Array.isArray(this.kinds_)){this.kinds_=[this.kind_];}for(var i=0;i<tracks.length;i++){var track=tracks[i];// only add tracks that are of an appropriate kind and have a label
if(this.kinds_.indexOf(track.kind)>-1){var item=new TrackMenuItem(this.player_,{track:track,// MenuItem is selectable
selectable:true,// MenuItem is NOT multiSelectable (i.e. only one can be marked "selected" at a time)
multiSelectable:false});item.addClass('vjs-'+track.kind+'-menu-item');items.push(item);}}return items;};return TextTrackButton;}(TrackButton);Component.registerComponent('TextTrackButton',TextTrackButton);/**
 * @file chapters-track-menu-item.js
 *//**
 * The chapter track menu item
 *
 * @extends MenuItem
 */var ChaptersTrackMenuItem=function(_MenuItem){inherits$1(ChaptersTrackMenuItem,_MenuItem);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function ChaptersTrackMenuItem(player,options){classCallCheck(this,ChaptersTrackMenuItem);var track=options.track;var cue=options.cue;var currentTime=player.currentTime();// Modify options for parent MenuItem class's init.
options.selectable=true;options.multiSelectable=false;options.label=cue.text;options.selected=cue.startTime<=currentTime&&currentTime<cue.endTime;var _this=possibleConstructorReturn(this,_MenuItem.call(this,player,options));_this.track=track;_this.cue=cue;track.addEventListener('cuechange',bind$2(_this,_this.update));return _this;}/**
   * This gets called when an `ChaptersTrackMenuItem` is "clicked". See
   * {@link ClickableComponent} for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} [event]
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */ChaptersTrackMenuItem.prototype.handleClick=function handleClick(event){_MenuItem.prototype.handleClick.call(this);this.player_.currentTime(this.cue.startTime);this.update(this.cue.startTime);};/**
   * Update chapter menu item
   *
   * @param {EventTarget~Event} [event]
   *        The `cuechange` event that caused this function to run.
   *
   * @listens TextTrack#cuechange
   */ChaptersTrackMenuItem.prototype.update=function update(event){var cue=this.cue;var currentTime=this.player_.currentTime();// vjs.log(currentTime, cue.startTime);
this.selected(cue.startTime<=currentTime&&currentTime<cue.endTime);};return ChaptersTrackMenuItem;}(MenuItem);Component.registerComponent('ChaptersTrackMenuItem',ChaptersTrackMenuItem);/**
 * @file chapters-button.js
 *//**
 * The button component for toggling and selecting chapters
 * Chapters act much differently than other text tracks
 * Cues are navigation vs. other tracks of alternative languages
 *
 * @extends TextTrackButton
 */var ChaptersButton=function(_TextTrackButton){inherits$1(ChaptersButton,_TextTrackButton);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   *
   * @param {Component~ReadyCallback} [ready]
   *        The function to call when this function is ready.
   */function ChaptersButton(player,options,ready){classCallCheck(this,ChaptersButton);return possibleConstructorReturn(this,_TextTrackButton.call(this,player,options,ready));}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */ChaptersButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-chapters-button '+_TextTrackButton.prototype.buildCSSClass.call(this);};ChaptersButton.prototype.buildWrapperCSSClass=function buildWrapperCSSClass(){return 'vjs-chapters-button '+_TextTrackButton.prototype.buildWrapperCSSClass.call(this);};/**
   * Update the menu based on the current state of its items.
   *
   * @param {EventTarget~Event} [event]
   *        An event that triggered this function to run.
   *
   * @listens TextTrackList#addtrack
   * @listens TextTrackList#removetrack
   * @listens TextTrackList#change
   */ChaptersButton.prototype.update=function update(event){if(!this.track_||event&&(event.type==='addtrack'||event.type==='removetrack')){this.setTrack(this.findChaptersTrack());}_TextTrackButton.prototype.update.call(this);};/**
   * Set the currently selected track for the chapters button.
   *
   * @param {TextTrack} track
   *        The new track to select. Nothing will change if this is the currently selected
   *        track.
   */ChaptersButton.prototype.setTrack=function setTrack(track){if(this.track_===track){return;}if(!this.updateHandler_){this.updateHandler_=this.update.bind(this);}// here this.track_ refers to the old track instance
if(this.track_){var remoteTextTrackEl=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(remoteTextTrackEl){remoteTextTrackEl.removeEventListener('load',this.updateHandler_);}this.track_=null;}this.track_=track;// here this.track_ refers to the new track instance
if(this.track_){this.track_.mode='hidden';var _remoteTextTrackEl=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);if(_remoteTextTrackEl){_remoteTextTrackEl.addEventListener('load',this.updateHandler_);}}};/**
   * Find the track object that is currently in use by this ChaptersButton
   *
   * @return {TextTrack|undefined}
   *         The current track or undefined if none was found.
   */ChaptersButton.prototype.findChaptersTrack=function findChaptersTrack(){var tracks=this.player_.textTracks()||[];for(var i=tracks.length-1;i>=0;i--){// We will always choose the last track as our chaptersTrack
var track=tracks[i];if(track.kind===this.kind_){return track;}}};/**
   * Get the caption for the ChaptersButton based on the track label. This will also
   * use the current tracks localized kind as a fallback if a label does not exist.
   *
   * @return {string}
   *         The tracks current label or the localized track kind.
   */ChaptersButton.prototype.getMenuCaption=function getMenuCaption(){if(this.track_&&this.track_.label){return this.track_.label;}return this.localize(toTitleCase(this.kind_));};/**
   * Create menu from chapter track
   *
   * @return {Menu}
   *         New menu for the chapter buttons
   */ChaptersButton.prototype.createMenu=function createMenu(){this.options_.title=this.getMenuCaption();return _TextTrackButton.prototype.createMenu.call(this);};/**
   * Create a menu item for each text track
   *
   * @return {TextTrackMenuItem[]}
   *         Array of menu items
   */ChaptersButton.prototype.createItems=function createItems(){var items=[];if(!this.track_){return items;}var cues=this.track_.cues;if(!cues){return items;}for(var i=0,l=cues.length;i<l;i++){var cue=cues[i];var mi=new ChaptersTrackMenuItem(this.player_,{track:this.track_,cue:cue});items.push(mi);}return items;};return ChaptersButton;}(TextTrackButton);/**
 * `kind` of TextTrack to look for to associate it with this menu.
 *
 * @type {string}
 * @private
 */ChaptersButton.prototype.kind_='chapters';/**
 * The text that should display over the `ChaptersButton`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */ChaptersButton.prototype.controlText_='Chapters';Component.registerComponent('ChaptersButton',ChaptersButton);/**
 * @file descriptions-button.js
 *//**
 * The button component for toggling and selecting descriptions
 *
 * @extends TextTrackButton
 */var DescriptionsButton=function(_TextTrackButton){inherits$1(DescriptionsButton,_TextTrackButton);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   *
   * @param {Component~ReadyCallback} [ready]
   *        The function to call when this component is ready.
   */function DescriptionsButton(player,options,ready){classCallCheck(this,DescriptionsButton);var _this=possibleConstructorReturn(this,_TextTrackButton.call(this,player,options,ready));var tracks=player.textTracks();var changeHandler=bind$2(_this,_this.handleTracksChange);tracks.addEventListener('change',changeHandler);_this.on('dispose',function(){tracks.removeEventListener('change',changeHandler);});return _this;}/**
   * Handle text track change
   *
   * @param {EventTarget~Event} event
   *        The event that caused this function to run
   *
   * @listens TextTrackList#change
   */DescriptionsButton.prototype.handleTracksChange=function handleTracksChange(event){var tracks=this.player().textTracks();var disabled=false;// Check whether a track of a different kind is showing
for(var i=0,l=tracks.length;i<l;i++){var track=tracks[i];if(track.kind!==this.kind_&&track.mode==='showing'){disabled=true;break;}}// If another track is showing, disable this menu button
if(disabled){this.disable();}else {this.enable();}};/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */DescriptionsButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-descriptions-button '+_TextTrackButton.prototype.buildCSSClass.call(this);};DescriptionsButton.prototype.buildWrapperCSSClass=function buildWrapperCSSClass(){return 'vjs-descriptions-button '+_TextTrackButton.prototype.buildWrapperCSSClass.call(this);};return DescriptionsButton;}(TextTrackButton);/**
 * `kind` of TextTrack to look for to associate it with this menu.
 *
 * @type {string}
 * @private
 */DescriptionsButton.prototype.kind_='descriptions';/**
 * The text that should display over the `DescriptionsButton`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */DescriptionsButton.prototype.controlText_='Descriptions';Component.registerComponent('DescriptionsButton',DescriptionsButton);/**
 * @file subtitles-button.js
 *//**
 * The button component for toggling and selecting subtitles
 *
 * @extends TextTrackButton
 */var SubtitlesButton=function(_TextTrackButton){inherits$1(SubtitlesButton,_TextTrackButton);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   *
   * @param {Component~ReadyCallback} [ready]
   *        The function to call when this component is ready.
   */function SubtitlesButton(player,options,ready){classCallCheck(this,SubtitlesButton);return possibleConstructorReturn(this,_TextTrackButton.call(this,player,options,ready));}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */SubtitlesButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-subtitles-button '+_TextTrackButton.prototype.buildCSSClass.call(this);};SubtitlesButton.prototype.buildWrapperCSSClass=function buildWrapperCSSClass(){return 'vjs-subtitles-button '+_TextTrackButton.prototype.buildWrapperCSSClass.call(this);};return SubtitlesButton;}(TextTrackButton);/**
 * `kind` of TextTrack to look for to associate it with this menu.
 *
 * @type {string}
 * @private
 */SubtitlesButton.prototype.kind_='subtitles';/**
 * The text that should display over the `SubtitlesButton`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */SubtitlesButton.prototype.controlText_='Subtitles';Component.registerComponent('SubtitlesButton',SubtitlesButton);/**
 * @file caption-settings-menu-item.js
 *//**
 * The menu item for caption track settings menu
 *
 * @extends TextTrackMenuItem
 */var CaptionSettingsMenuItem=function(_TextTrackMenuItem){inherits$1(CaptionSettingsMenuItem,_TextTrackMenuItem);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function CaptionSettingsMenuItem(player,options){classCallCheck(this,CaptionSettingsMenuItem);options.track={player:player,kind:options.kind,label:options.kind+' settings',selectable:false,'default':false,mode:'disabled'};// CaptionSettingsMenuItem has no concept of 'selected'
options.selectable=false;options.name='CaptionSettingsMenuItem';var _this=possibleConstructorReturn(this,_TextTrackMenuItem.call(this,player,options));_this.addClass('vjs-texttrack-settings');_this.controlText(', opens '+options.kind+' settings dialog');return _this;}/**
   * This gets called when an `CaptionSettingsMenuItem` is "clicked". See
   * {@link ClickableComponent} for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} [event]
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */CaptionSettingsMenuItem.prototype.handleClick=function handleClick(event){this.player().getChild('textTrackSettings').open();};return CaptionSettingsMenuItem;}(TextTrackMenuItem);Component.registerComponent('CaptionSettingsMenuItem',CaptionSettingsMenuItem);/**
 * @file captions-button.js
 *//**
 * The button component for toggling and selecting captions
 *
 * @extends TextTrackButton
 */var CaptionsButton=function(_TextTrackButton){inherits$1(CaptionsButton,_TextTrackButton);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   *
   * @param {Component~ReadyCallback} [ready]
   *        The function to call when this component is ready.
   */function CaptionsButton(player,options,ready){classCallCheck(this,CaptionsButton);return possibleConstructorReturn(this,_TextTrackButton.call(this,player,options,ready));}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */CaptionsButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-captions-button '+_TextTrackButton.prototype.buildCSSClass.call(this);};CaptionsButton.prototype.buildWrapperCSSClass=function buildWrapperCSSClass(){return 'vjs-captions-button '+_TextTrackButton.prototype.buildWrapperCSSClass.call(this);};/**
   * Create caption menu items
   *
   * @return {CaptionSettingsMenuItem[]}
   *         The array of current menu items.
   */CaptionsButton.prototype.createItems=function createItems(){var items=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild('textTrackSettings')){items.push(new CaptionSettingsMenuItem(this.player_,{kind:this.kind_}));this.hideThreshold_+=1;}return _TextTrackButton.prototype.createItems.call(this,items);};return CaptionsButton;}(TextTrackButton);/**
 * `kind` of TextTrack to look for to associate it with this menu.
 *
 * @type {string}
 * @private
 */CaptionsButton.prototype.kind_='captions';/**
 * The text that should display over the `CaptionsButton`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */CaptionsButton.prototype.controlText_='Captions';Component.registerComponent('CaptionsButton',CaptionsButton);/**
 * @file subs-caps-menu-item.js
 *//**
 * SubsCapsMenuItem has an [cc] icon to distinguish captions from subtitles
 * in the SubsCapsMenu.
 *
 * @extends TextTrackMenuItem
 */var SubsCapsMenuItem=function(_TextTrackMenuItem){inherits$1(SubsCapsMenuItem,_TextTrackMenuItem);function SubsCapsMenuItem(){classCallCheck(this,SubsCapsMenuItem);return possibleConstructorReturn(this,_TextTrackMenuItem.apply(this,arguments));}SubsCapsMenuItem.prototype.createEl=function createEl(type,props,attrs){var innerHTML='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);if(this.options_.track.kind==='captions'){innerHTML+='\n        <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n        <span class="vjs-control-text"> '+this.localize('Captions')+'</span>\n      ';}innerHTML+='</span>';var el=_TextTrackMenuItem.prototype.createEl.call(this,type,assign$1({innerHTML:innerHTML},props),attrs);return el;};return SubsCapsMenuItem;}(TextTrackMenuItem);Component.registerComponent('SubsCapsMenuItem',SubsCapsMenuItem);/**
 * @file sub-caps-button.js
 *//**
 * The button component for toggling and selecting captions and/or subtitles
 *
 * @extends TextTrackButton
 */var SubsCapsButton=function(_TextTrackButton){inherits$1(SubsCapsButton,_TextTrackButton);function SubsCapsButton(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,SubsCapsButton);// Although North America uses "captions" in most cases for
// "captions and subtitles" other locales use "subtitles"
var _this=possibleConstructorReturn(this,_TextTrackButton.call(this,player,options));_this.label_='subtitles';if(['en','en-us','en-ca','fr-ca'].indexOf(_this.player_.language_)>-1){_this.label_='captions';}_this.menuButton_.controlText(toTitleCase(_this.label_));return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */SubsCapsButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-subs-caps-button '+_TextTrackButton.prototype.buildCSSClass.call(this);};SubsCapsButton.prototype.buildWrapperCSSClass=function buildWrapperCSSClass(){return 'vjs-subs-caps-button '+_TextTrackButton.prototype.buildWrapperCSSClass.call(this);};/**
   * Create caption/subtitles menu items
   *
   * @return {CaptionSettingsMenuItem[]}
   *         The array of current menu items.
   */SubsCapsButton.prototype.createItems=function createItems(){var items=[];if(!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild('textTrackSettings')){items.push(new CaptionSettingsMenuItem(this.player_,{kind:this.label_}));this.hideThreshold_+=1;}items=_TextTrackButton.prototype.createItems.call(this,items,SubsCapsMenuItem);return items;};return SubsCapsButton;}(TextTrackButton);/**
 * `kind`s of TextTrack to look for to associate it with this menu.
 *
 * @type {array}
 * @private
 */SubsCapsButton.prototype.kinds_=['captions','subtitles'];/**
 * The text that should display over the `SubsCapsButton`s controls.
 *
 *
 * @type {string}
 * @private
 */SubsCapsButton.prototype.controlText_='Subtitles';Component.registerComponent('SubsCapsButton',SubsCapsButton);/**
 * @file audio-track-menu-item.js
 *//**
 * An {@link AudioTrack} {@link MenuItem}
 *
 * @extends MenuItem
 */var AudioTrackMenuItem=function(_MenuItem){inherits$1(AudioTrackMenuItem,_MenuItem);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function AudioTrackMenuItem(player,options){classCallCheck(this,AudioTrackMenuItem);var track=options.track;var tracks=player.audioTracks();// Modify options for parent MenuItem class's init.
options.label=track.label||track.language||'Unknown';options.selected=track.enabled;var _this=possibleConstructorReturn(this,_MenuItem.call(this,player,options));_this.track=track;_this.addClass('vjs-'+track.kind+'-menu-item');var changeHandler=function changeHandler(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this.handleTracksChange.apply(_this,args);};tracks.addEventListener('change',changeHandler);_this.on('dispose',function(){tracks.removeEventListener('change',changeHandler);});return _this;}AudioTrackMenuItem.prototype.createEl=function createEl(type,props,attrs){var innerHTML='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);if(this.options_.track.kind==='main-desc'){innerHTML+='\n        <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n        <span class="vjs-control-text"> '+this.localize('Descriptions')+'</span>\n      ';}innerHTML+='</span>';var el=_MenuItem.prototype.createEl.call(this,type,assign$1({innerHTML:innerHTML},props),attrs);return el;};/**
   * This gets called when an `AudioTrackMenuItem is "clicked". See {@link ClickableComponent}
   * for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} [event]
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */AudioTrackMenuItem.prototype.handleClick=function handleClick(event){var tracks=this.player_.audioTracks();_MenuItem.prototype.handleClick.call(this,event);for(var i=0;i<tracks.length;i++){var track=tracks[i];track.enabled=track===this.track;}};/**
   * Handle any {@link AudioTrack} change.
   *
   * @param {EventTarget~Event} [event]
   *        The {@link AudioTrackList#change} event that caused this to run.
   *
   * @listens AudioTrackList#change
   */AudioTrackMenuItem.prototype.handleTracksChange=function handleTracksChange(event){this.selected(this.track.enabled);};return AudioTrackMenuItem;}(MenuItem);Component.registerComponent('AudioTrackMenuItem',AudioTrackMenuItem);/**
 * @file audio-track-button.js
 *//**
 * The base class for buttons that toggle specific {@link AudioTrack} types.
 *
 * @extends TrackButton
 */var AudioTrackButton=function(_TrackButton){inherits$1(AudioTrackButton,_TrackButton);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options={}]
   *        The key/value store of player options.
   */function AudioTrackButton(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,AudioTrackButton);options.tracks=player.audioTracks();return possibleConstructorReturn(this,_TrackButton.call(this,player,options));}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */AudioTrackButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-audio-button '+_TrackButton.prototype.buildCSSClass.call(this);};AudioTrackButton.prototype.buildWrapperCSSClass=function buildWrapperCSSClass(){return 'vjs-audio-button '+_TrackButton.prototype.buildWrapperCSSClass.call(this);};/**
   * Create a menu item for each audio track
   *
   * @param {AudioTrackMenuItem[]} [items=[]]
   *        An array of existing menu items to use.
   *
   * @return {AudioTrackMenuItem[]}
   *         An array of menu items
   */AudioTrackButton.prototype.createItems=function createItems(){var items=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];// if there's only one audio track, there no point in showing it
this.hideThreshold_=1;var tracks=this.player_.audioTracks();for(var i=0;i<tracks.length;i++){var track=tracks[i];items.push(new AudioTrackMenuItem(this.player_,{track:track,// MenuItem is selectable
selectable:true,// MenuItem is NOT multiSelectable (i.e. only one can be marked "selected" at a time)
multiSelectable:false}));}return items;};return AudioTrackButton;}(TrackButton);/**
 * The text that should display over the `AudioTrackButton`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */AudioTrackButton.prototype.controlText_='Audio Track';Component.registerComponent('AudioTrackButton',AudioTrackButton);/**
 * @file playback-rate-menu-item.js
 *//**
 * The specific menu item type for selecting a playback rate.
 *
 * @extends MenuItem
 */var PlaybackRateMenuItem=function(_MenuItem){inherits$1(PlaybackRateMenuItem,_MenuItem);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function PlaybackRateMenuItem(player,options){classCallCheck(this,PlaybackRateMenuItem);var label=options.rate;var rate=parseFloat(label,10);// Modify options for parent MenuItem class's init.
options.label=label;options.selected=rate===1;options.selectable=true;options.multiSelectable=false;var _this=possibleConstructorReturn(this,_MenuItem.call(this,player,options));_this.label=label;_this.rate=rate;_this.on(player,'ratechange',_this.update);return _this;}/**
   * This gets called when an `PlaybackRateMenuItem` is "clicked". See
   * {@link ClickableComponent} for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} [event]
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */PlaybackRateMenuItem.prototype.handleClick=function handleClick(event){_MenuItem.prototype.handleClick.call(this);this.player().playbackRate(this.rate);};/**
   * Update the PlaybackRateMenuItem when the playbackrate changes.
   *
   * @param {EventTarget~Event} [event]
   *        The `ratechange` event that caused this function to run.
   *
   * @listens Player#ratechange
   */PlaybackRateMenuItem.prototype.update=function update(event){this.selected(this.player().playbackRate()===this.rate);};return PlaybackRateMenuItem;}(MenuItem);/**
 * The text that should display over the `PlaybackRateMenuItem`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */PlaybackRateMenuItem.prototype.contentElType='button';Component.registerComponent('PlaybackRateMenuItem',PlaybackRateMenuItem);/**
 * @file playback-rate-menu-button.js
 *//**
 * The component for controlling the playback rate.
 *
 * @extends MenuButton
 */var PlaybackRateMenuButton=function(_MenuButton){inherits$1(PlaybackRateMenuButton,_MenuButton);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   */function PlaybackRateMenuButton(player,options){classCallCheck(this,PlaybackRateMenuButton);var _this=possibleConstructorReturn(this,_MenuButton.call(this,player,options));_this.updateVisibility();_this.updateLabel();_this.on(player,'loadstart',_this.updateVisibility);_this.on(player,'ratechange',_this.updateLabel);return _this;}/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */PlaybackRateMenuButton.prototype.createEl=function createEl$$1(){var el=_MenuButton.prototype.createEl.call(this);this.labelEl_=createEl$2('div',{className:'vjs-playback-rate-value',innerHTML:'1x'});el.appendChild(this.labelEl_);return el;};PlaybackRateMenuButton.prototype.dispose=function dispose(){this.labelEl_=null;_MenuButton.prototype.dispose.call(this);};/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */PlaybackRateMenuButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-playback-rate '+_MenuButton.prototype.buildCSSClass.call(this);};PlaybackRateMenuButton.prototype.buildWrapperCSSClass=function buildWrapperCSSClass(){return 'vjs-playback-rate '+_MenuButton.prototype.buildWrapperCSSClass.call(this);};/**
   * Create the playback rate menu
   *
   * @return {Menu}
   *         Menu object populated with {@link PlaybackRateMenuItem}s
   */PlaybackRateMenuButton.prototype.createMenu=function createMenu(){var menu=new Menu(this.player());var rates=this.playbackRates();if(rates){for(var i=rates.length-1;i>=0;i--){menu.addChild(new PlaybackRateMenuItem(this.player(),{rate:rates[i]+'x'}));}}return menu;};/**
   * Updates ARIA accessibility attributes
   */PlaybackRateMenuButton.prototype.updateARIAAttributes=function updateARIAAttributes(){// Current playback rate
this.el().setAttribute('aria-valuenow',this.player().playbackRate());};/**
   * This gets called when an `PlaybackRateMenuButton` is "clicked". See
   * {@link ClickableComponent} for more detailed information on what a click can be.
   *
   * @param {EventTarget~Event} [event]
   *        The `keydown`, `tap`, or `click` event that caused this function to be
   *        called.
   *
   * @listens tap
   * @listens click
   */PlaybackRateMenuButton.prototype.handleClick=function handleClick(event){// select next rate option
var currentRate=this.player().playbackRate();var rates=this.playbackRates();// this will select first one if the last one currently selected
var newRate=rates[0];for(var i=0;i<rates.length;i++){if(rates[i]>currentRate){newRate=rates[i];break;}}this.player().playbackRate(newRate);};/**
   * Get possible playback rates
   *
   * @return {Array}
   *         All possible playback rates
   */PlaybackRateMenuButton.prototype.playbackRates=function playbackRates(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates;};/**
   * Get whether playback rates is supported by the tech
   * and an array of playback rates exists
   *
   * @return {boolean}
   *         Whether changing playback rate is supported
   */PlaybackRateMenuButton.prototype.playbackRateSupported=function playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0;};/**
   * Hide playback rate controls when they're no playback rate options to select
   *
   * @param {EventTarget~Event} [event]
   *        The event that caused this function to run.
   *
   * @listens Player#loadstart
   */PlaybackRateMenuButton.prototype.updateVisibility=function updateVisibility(event){if(this.playbackRateSupported()){this.removeClass('vjs-hidden');}else {this.addClass('vjs-hidden');}};/**
   * Update button label when rate changed
   *
   * @param {EventTarget~Event} [event]
   *        The event that caused this function to run.
   *
   * @listens Player#ratechange
   */PlaybackRateMenuButton.prototype.updateLabel=function updateLabel(event){if(this.playbackRateSupported()){this.labelEl_.innerHTML=this.player().playbackRate()+'x';}};return PlaybackRateMenuButton;}(MenuButton);/**
 * The text that should display over the `FullscreenToggle`s controls. Added for localization.
 *
 * @type {string}
 * @private
 */PlaybackRateMenuButton.prototype.controlText_='Playback Rate';Component.registerComponent('PlaybackRateMenuButton',PlaybackRateMenuButton);/**
 * @file spacer.js
 *//**
 * Just an empty spacer element that can be used as an append point for plugins, etc.
 * Also can be used to create space between elements when necessary.
 *
 * @extends Component
 */var Spacer=function(_Component){inherits$1(Spacer,_Component);function Spacer(){classCallCheck(this,Spacer);return possibleConstructorReturn(this,_Component.apply(this,arguments));}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */Spacer.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-spacer '+_Component.prototype.buildCSSClass.call(this);};/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */Spacer.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:this.buildCSSClass()});};return Spacer;}(Component);Component.registerComponent('Spacer',Spacer);/**
 * @file custom-control-spacer.js
 *//**
 * Spacer specifically meant to be used as an insertion point for new plugins, etc.
 *
 * @extends Spacer
 */var CustomControlSpacer=function(_Spacer){inherits$1(CustomControlSpacer,_Spacer);function CustomControlSpacer(){classCallCheck(this,CustomControlSpacer);return possibleConstructorReturn(this,_Spacer.apply(this,arguments));}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   */CustomControlSpacer.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-custom-control-spacer '+_Spacer.prototype.buildCSSClass.call(this);};/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */CustomControlSpacer.prototype.createEl=function createEl(){var el=_Spacer.prototype.createEl.call(this,{className:this.buildCSSClass()});// No-flex/table-cell mode requires there be some content
// in the cell to fill the remaining space of the table.
el.innerHTML='\xA0';return el;};return CustomControlSpacer;}(Spacer);Component.registerComponent('CustomControlSpacer',CustomControlSpacer);/**
 * @file control-bar.js
 */// Required children
/**
 * Container of main controls.
 *
 * @extends Component
 */var ControlBar=function(_Component){inherits$1(ControlBar,_Component);function ControlBar(){classCallCheck(this,ControlBar);return possibleConstructorReturn(this,_Component.apply(this,arguments));}/**
   * Create the `Component`'s DOM element
   *
   * @return {Element}
   *         The element that was created.
   */ControlBar.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-control-bar',dir:'ltr'});};return ControlBar;}(Component);/**
 * Default options for `ControlBar`
 *
 * @type {Object}
 * @private
 */ControlBar.prototype.options_={children:['playToggle','volumePanel','currentTimeDisplay','timeDivider','durationDisplay','progressControl','liveDisplay','remainingTimeDisplay','customControlSpacer','playbackRateMenuButton','chaptersButton','descriptionsButton','subsCapsButton','audioTrackButton','fullscreenToggle']};Component.registerComponent('ControlBar',ControlBar);/**
 * @file error-display.js
 *//**
 * A display that indicates an error has occurred. This means that the video
 * is unplayable.
 *
 * @extends ModalDialog
 */var ErrorDisplay=function(_ModalDialog){inherits$1(ErrorDisplay,_ModalDialog);/**
   * Creates an instance of this class.
   *
   * @param  {Player} player
   *         The `Player` that this class should be attached to.
   *
   * @param  {Object} [options]
   *         The key/value store of player options.
   */function ErrorDisplay(player,options){classCallCheck(this,ErrorDisplay);var _this=possibleConstructorReturn(this,_ModalDialog.call(this,player,options));_this.on(player,'error',_this.open);return _this;}/**
   * Builds the default DOM `className`.
   *
   * @return {string}
   *         The DOM `className` for this object.
   *
   * @deprecated Since version 5.
   */ErrorDisplay.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-error-display '+_ModalDialog.prototype.buildCSSClass.call(this);};/**
   * Gets the localized error message based on the `Player`s error.
   *
   * @return {string}
   *         The `Player`s error message localized or an empty string.
   */ErrorDisplay.prototype.content=function content(){var error=this.player().error();return error?this.localize(error.message):'';};return ErrorDisplay;}(ModalDialog);/**
 * The default options for an `ErrorDisplay`.
 *
 * @private
 */ErrorDisplay.prototype.options_=mergeOptions(ModalDialog.prototype.options_,{pauseOnOpen:false,fillAlways:true,temporary:false,uncloseable:true});Component.registerComponent('ErrorDisplay',ErrorDisplay);/**
 * @file text-track-settings.js
 */var LOCAL_STORAGE_KEY='vjs-text-track-settings';var COLOR_BLACK=['#000','Black'];var COLOR_BLUE=['#00F','Blue'];var COLOR_CYAN=['#0FF','Cyan'];var COLOR_GREEN=['#0F0','Green'];var COLOR_MAGENTA=['#F0F','Magenta'];var COLOR_RED=['#F00','Red'];var COLOR_WHITE=['#FFF','White'];var COLOR_YELLOW=['#FF0','Yellow'];var OPACITY_OPAQUE=['1','Opaque'];var OPACITY_SEMI=['0.5','Semi-Transparent'];var OPACITY_TRANS=['0','Transparent'];// Configuration for the various <select> elements in the DOM of this component.
//
// Possible keys include:
//
// `default`:
//   The default option index. Only needs to be provided if not zero.
// `parser`:
//   A function which is used to parse the value from the selected option in
//   a customized way.
// `selector`:
//   The selector used to find the associated <select> element.
var selectConfigs={backgroundColor:{selector:'.vjs-bg-color > select',id:'captions-background-color-%s',label:'Color',options:[COLOR_BLACK,COLOR_WHITE,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},backgroundOpacity:{selector:'.vjs-bg-opacity > select',id:'captions-background-opacity-%s',label:'Transparency',options:[OPACITY_OPAQUE,OPACITY_SEMI,OPACITY_TRANS]},color:{selector:'.vjs-fg-color > select',id:'captions-foreground-color-%s',label:'Color',options:[COLOR_WHITE,COLOR_BLACK,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},edgeStyle:{selector:'.vjs-edge-style > select',id:'%s',label:'Text Edge Style',options:[['none','None'],['raised','Raised'],['depressed','Depressed'],['uniform','Uniform'],['dropshadow','Dropshadow']]},fontFamily:{selector:'.vjs-font-family > select',id:'captions-font-family-%s',label:'Font Family',options:[['proportionalSansSerif','Proportional Sans-Serif'],['monospaceSansSerif','Monospace Sans-Serif'],['proportionalSerif','Proportional Serif'],['monospaceSerif','Monospace Serif'],['casual','Casual'],['script','Script'],['small-caps','Small Caps']]},fontPercent:{selector:'.vjs-font-percent > select',id:'captions-font-size-%s',label:'Font Size',options:[['0.50','50%'],['0.75','75%'],['1.00','100%'],['1.25','125%'],['1.50','150%'],['1.75','175%'],['2.00','200%'],['3.00','300%'],['4.00','400%']],'default':2,parser:function parser(v){return v==='1.00'?null:Number(v);}},textOpacity:{selector:'.vjs-text-opacity > select',id:'captions-foreground-opacity-%s',label:'Transparency',options:[OPACITY_OPAQUE,OPACITY_SEMI]},// Options for this object are defined below.
windowColor:{selector:'.vjs-window-color > select',id:'captions-window-color-%s',label:'Color'},// Options for this object are defined below.
windowOpacity:{selector:'.vjs-window-opacity > select',id:'captions-window-opacity-%s',label:'Transparency',options:[OPACITY_TRANS,OPACITY_SEMI,OPACITY_OPAQUE]}};selectConfigs.windowColor.options=selectConfigs.backgroundColor.options;/**
 * Get the actual value of an option.
 *
 * @param  {string} value
 *         The value to get
 *
 * @param  {Function} [parser]
 *         Optional function to adjust the value.
 *
 * @return {Mixed}
 *         - Will be `undefined` if no value exists
 *         - Will be `undefined` if the given value is "none".
 *         - Will be the actual value otherwise.
 *
 * @private
 */function parseOptionValue(value,parser){if(parser){value=parser(value);}if(value&&value!=='none'){return value;}}/**
 * Gets the value of the selected <option> element within a <select> element.
 *
 * @param  {Element} el
 *         the element to look in
 *
 * @param  {Function} [parser]
 *         Optional function to adjust the value.
 *
 * @return {Mixed}
 *         - Will be `undefined` if no value exists
 *         - Will be `undefined` if the given value is "none".
 *         - Will be the actual value otherwise.
 *
 * @private
 */function getSelectedOptionValue(el,parser){var value=el.options[el.options.selectedIndex].value;return parseOptionValue(value,parser);}/**
 * Sets the selected <option> element within a <select> element based on a
 * given value.
 *
 * @param {Element} el
 *        The element to look in.
 *
 * @param {string} value
 *        the property to look on.
 *
 * @param {Function} [parser]
 *        Optional function to adjust the value before comparing.
 *
 * @private
 */function setSelectedOption(el,value,parser){if(!value){return;}for(var i=0;i<el.options.length;i++){if(parseOptionValue(el.options[i].value,parser)===value){el.selectedIndex=i;break;}}}/**
 * Manipulate Text Tracks settings.
 *
 * @extends ModalDialog
 */var TextTrackSettings=function(_ModalDialog){inherits$1(TextTrackSettings,_ModalDialog);/**
   * Creates an instance of this class.
   *
   * @param {Player} player
   *         The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *         The key/value store of player options.
   */function TextTrackSettings(player,options){classCallCheck(this,TextTrackSettings);options.temporary=false;var _this=possibleConstructorReturn(this,_ModalDialog.call(this,player,options));_this.updateDisplay=bind$2(_this,_this.updateDisplay);// fill the modal and pretend we have opened it
_this.fill();_this.hasBeenOpened_=_this.hasBeenFilled_=true;_this.endDialog=createEl$2('p',{className:'vjs-control-text',textContent:_this.localize('End of dialog window.')});_this.el().appendChild(_this.endDialog);_this.setDefaults();// Grab `persistTextTrackSettings` from the player options if not passed in child options
if(options.persistTextTrackSettings===undefined){_this.options_.persistTextTrackSettings=_this.options_.playerOptions.persistTextTrackSettings;}_this.on(_this.$('.vjs-done-button'),'click',function(){_this.saveSettings();_this.close();});_this.on(_this.$('.vjs-default-button'),'click',function(){_this.setDefaults();_this.updateDisplay();});each$g(selectConfigs,function(config){_this.on(_this.$(config.selector),'change',_this.updateDisplay);});if(_this.options_.persistTextTrackSettings){_this.restoreSettings();}return _this;}TextTrackSettings.prototype.dispose=function dispose(){this.endDialog=null;_ModalDialog.prototype.dispose.call(this);};/**
   * Create a <select> element with configured options.
   *
   * @param {string} key
   *        Configuration key to use during creation.
   *
   * @return {string}
   *         An HTML string.
   *
   * @private
   */TextTrackSettings.prototype.createElSelect_=function createElSelect_(key){var _this2=this;var legendId=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'';var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'label';var config=selectConfigs[key];var id=config.id.replace('%s',this.id_);var selectLabelledbyIds=[legendId,id].join(' ').trim();return ['<'+type+' id="'+id+'" class="'+(type==='label'?'vjs-label':'')+'">',this.localize(config.label),'</'+type+'>','<select aria-labelledby="'+selectLabelledbyIds+'">'].concat(config.options.map(function(o){var optionId=id+'-'+o[1].replace(/\W+/g,'');return ['<option id="'+optionId+'" value="'+o[0]+'" ','aria-labelledby="'+selectLabelledbyIds+' '+optionId+'">',_this2.localize(o[1]),'</option>'].join('');})).concat('</select>').join('');};/**
   * Create foreground color element for the component
   *
   * @return {string}
   *         An HTML string.
   *
   * @private
   */TextTrackSettings.prototype.createElFgColor_=function createElFgColor_(){var legendId='captions-text-legend-'+this.id_;return ['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+legendId+'">',this.localize('Text'),'</legend>',this.createElSelect_('color',legendId),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_('textOpacity',legendId),'</span>','</fieldset>'].join('');};/**
   * Create background color element for the component
   *
   * @return {string}
   *         An HTML string.
   *
   * @private
   */TextTrackSettings.prototype.createElBgColor_=function createElBgColor_(){var legendId='captions-background-'+this.id_;return ['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+legendId+'">',this.localize('Background'),'</legend>',this.createElSelect_('backgroundColor',legendId),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_('backgroundOpacity',legendId),'</span>','</fieldset>'].join('');};/**
   * Create window color element for the component
   *
   * @return {string}
   *         An HTML string.
   *
   * @private
   */TextTrackSettings.prototype.createElWinColor_=function createElWinColor_(){var legendId='captions-window-'+this.id_;return ['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+legendId+'">',this.localize('Window'),'</legend>',this.createElSelect_('windowColor',legendId),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_('windowOpacity',legendId),'</span>','</fieldset>'].join('');};/**
   * Create color elements for the component
   *
   * @return {Element}
   *         The element that was created
   *
   * @private
   */TextTrackSettings.prototype.createElColors_=function createElColors_(){return createEl$2('div',{className:'vjs-track-settings-colors',innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join('')});};/**
   * Create font elements for the component
   *
   * @return {Element}
   *         The element that was created.
   *
   * @private
   */TextTrackSettings.prototype.createElFont_=function createElFont_(){return createEl$2('div',{className:'vjs-track-settings-font',innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_('fontPercent','','legend'),'</fieldset>','<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_('edgeStyle','','legend'),'</fieldset>','<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_('fontFamily','','legend'),'</fieldset>'].join('')});};/**
   * Create controls for the component
   *
   * @return {Element}
   *         The element that was created.
   *
   * @private
   */TextTrackSettings.prototype.createElControls_=function createElControls_(){var defaultsDescription=this.localize('restore all settings to the default values');return createEl$2('div',{className:'vjs-track-settings-controls',innerHTML:['<button type="button" class="vjs-default-button" title="'+defaultsDescription+'">',this.localize('Reset'),'<span class="vjs-control-text"> '+defaultsDescription+'</span>','</button>','<button type="button" class="vjs-done-button">'+this.localize('Done')+'</button>'].join('')});};TextTrackSettings.prototype.content=function content(){return [this.createElColors_(),this.createElFont_(),this.createElControls_()];};TextTrackSettings.prototype.label=function label(){return this.localize('Caption Settings Dialog');};TextTrackSettings.prototype.description=function description(){return this.localize('Beginning of dialog window. Escape will cancel and close the window.');};TextTrackSettings.prototype.buildCSSClass=function buildCSSClass(){return _ModalDialog.prototype.buildCSSClass.call(this)+' vjs-text-track-settings';};/**
   * Gets an object of text track settings (or null).
   *
   * @return {Object}
   *         An object with config values parsed from the DOM or localStorage.
   */TextTrackSettings.prototype.getValues=function getValues(){var _this3=this;return reduce$1(selectConfigs,function(accum,config,key){var value=getSelectedOptionValue(_this3.$(config.selector),config.parser);if(value!==undefined){accum[key]=value;}return accum;},{});};/**
   * Sets text track settings from an object of values.
   *
   * @param {Object} values
   *        An object with config values parsed from the DOM or localStorage.
   */TextTrackSettings.prototype.setValues=function setValues(values){var _this4=this;each$g(selectConfigs,function(config,key){setSelectedOption(_this4.$(config.selector),values[key],config.parser);});};/**
   * Sets all `<select>` elements to their default values.
   */TextTrackSettings.prototype.setDefaults=function setDefaults(){var _this5=this;each$g(selectConfigs,function(config){var index=config.hasOwnProperty('default')?config['default']:0;_this5.$(config.selector).selectedIndex=index;});};/**
   * Restore texttrack settings from localStorage
   */TextTrackSettings.prototype.restoreSettings=function restoreSettings(){var values=void 0;try{values=JSON.parse(window$1.localStorage.getItem(LOCAL_STORAGE_KEY));}catch(err){log$2.warn(err);}if(values){this.setValues(values);}};/**
   * Save text track settings to localStorage
   */TextTrackSettings.prototype.saveSettings=function saveSettings(){if(!this.options_.persistTextTrackSettings){return;}var values=this.getValues();try{if(Object.keys(values).length){window$1.localStorage.setItem(LOCAL_STORAGE_KEY,JSON.stringify(values));}else {window$1.localStorage.removeItem(LOCAL_STORAGE_KEY);}}catch(err){log$2.warn(err);}};/**
   * Update display of text track settings
   */TextTrackSettings.prototype.updateDisplay=function updateDisplay(){var ttDisplay=this.player_.getChild('textTrackDisplay');if(ttDisplay){ttDisplay.updateDisplay();}};/**
   * conditionally blur the element and refocus the captions button
   *
   * @private
   */TextTrackSettings.prototype.conditionalBlur_=function conditionalBlur_(){this.previouslyActiveEl_=null;this.off(document$1,'keydown',this.handleKeyDown);var cb=this.player_.controlBar;var subsCapsBtn=cb&&cb.subsCapsButton;var ccBtn=cb&&cb.captionsButton;if(subsCapsBtn){subsCapsBtn.focus();}else if(ccBtn){ccBtn.focus();}};return TextTrackSettings;}(ModalDialog);Component.registerComponent('TextTrackSettings',TextTrackSettings);/**
 * @file resize-manager.js
 *//**
 * A Resize Manager. It is in charge of triggering `playerresize` on the player in the right conditions.
 *
 * It'll either create an iframe and use a debounced resize handler on it or use the new {@link https://wicg.github.io/ResizeObserver/|ResizeObserver}.
 *
 * If the ResizeObserver is available natively, it will be used. A polyfill can be passed in as an option.
 * If a `playerresize` event is not needed, the ResizeManager component can be removed from the player, see the example below.
 * @example <caption>How to disable the resize manager</caption>
 * const player = videojs('#vid', {
 *   resizeManager: false
 * });
 *
 * @see {@link https://wicg.github.io/ResizeObserver/|ResizeObserver specification}
 *
 * @extends Component
 */var ResizeManager=function(_Component){inherits$1(ResizeManager,_Component);/**
   * Create the ResizeManager.
   *
   * @param {Object} player
   *        The `Player` that this class should be attached to.
   *
   * @param {Object} [options]
   *        The key/value store of ResizeManager options.
   *
   * @param {Object} [options.ResizeObserver]
   *        A polyfill for ResizeObserver can be passed in here.
   *        If this is set to null it will ignore the native ResizeObserver and fall back to the iframe fallback.
   */function ResizeManager(player,options){classCallCheck(this,ResizeManager);var RESIZE_OBSERVER_AVAILABLE=options.ResizeObserver||window$1.ResizeObserver;// if `null` was passed, we want to disable the ResizeObserver
if(options.ResizeObserver===null){RESIZE_OBSERVER_AVAILABLE=false;}// Only create an element when ResizeObserver isn't available
var options_=mergeOptions({createEl:!RESIZE_OBSERVER_AVAILABLE},options);var _this=possibleConstructorReturn(this,_Component.call(this,player,options_));_this.ResizeObserver=options.ResizeObserver||window$1.ResizeObserver;_this.loadListener_=null;_this.resizeObserver_=null;_this.debouncedHandler_=debounce(function(){_this.resizeHandler();},100,false,_this);if(RESIZE_OBSERVER_AVAILABLE){_this.resizeObserver_=new _this.ResizeObserver(_this.debouncedHandler_);_this.resizeObserver_.observe(player.el());}else {_this.loadListener_=function(){if(!_this.el_||!_this.el_.contentWindow){return;}on(_this.el_.contentWindow,'resize',_this.debouncedHandler_);};_this.one('load',_this.loadListener_);}return _this;}ResizeManager.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'iframe',{className:'vjs-resize-manager'});};/**
   * Called when a resize is triggered on the iframe or a resize is observed via the ResizeObserver
   *
   * @fires Player#playerresize
   */ResizeManager.prototype.resizeHandler=function resizeHandler(){/**
     * Called when the player size has changed
     *
     * @event Player#playerresize
     * @type {EventTarget~Event}
     */// make sure player is still around to trigger
// prevents this from causing an error after dispose
if(!this.player_||!this.player_.trigger){return;}this.player_.trigger('playerresize');};ResizeManager.prototype.dispose=function dispose(){if(this.debouncedHandler_){this.debouncedHandler_.cancel();}if(this.resizeObserver_){if(this.player_.el()){this.resizeObserver_.unobserve(this.player_.el());}this.resizeObserver_.disconnect();}if(this.el_&&this.el_.contentWindow){off(this.el_.contentWindow,'resize',this.debouncedHandler_);}if(this.loadListener_){this.off('load',this.loadListener_);}this.ResizeObserver=null;this.resizeObserver=null;this.debouncedHandler_=null;this.loadListener_=null;};return ResizeManager;}(Component);Component.registerComponent('ResizeManager',ResizeManager);/**
 * This function is used to fire a sourceset when there is something
 * similar to `mediaEl.load()` being called. It will try to find the source via
 * the `src` attribute and then the `<source>` elements. It will then fire `sourceset`
 * with the source that was found or empty string if we cannot know. If it cannot
 * find a source then `sourceset` will not be fired.
 *
 * @param {Html5} tech
 *        The tech object that sourceset was setup on
 *
 * @return {boolean}
 *         returns false if the sourceset was not fired and true otherwise.
 */var sourcesetLoad=function sourcesetLoad(tech){var el=tech.el();// if `el.src` is set, that source will be loaded.
if(el.hasAttribute('src')){tech.triggerSourceset(el.src);return true;}/**
   * Since there isn't a src property on the media element, source elements will be used for
   * implementing the source selection algorithm. This happens asynchronously and
   * for most cases were there is more than one source we cannot tell what source will
   * be loaded, without re-implementing the source selection algorithm. At this time we are not
   * going to do that. There are three special cases that we do handle here though:
   *
   * 1. If there are no sources, do not fire `sourceset`.
   * 2. If there is only one `<source>` with a `src` property/attribute that is our `src`
   * 3. If there is more than one `<source>` but all of them have the same `src` url.
   *    That will be our src.
   */var sources=tech.$$('source');var srcUrls=[];var src='';// if there are no sources, do not fire sourceset
if(!sources.length){return false;}// only count valid/non-duplicate source elements
for(var i=0;i<sources.length;i++){var url=sources[i].src;if(url&&srcUrls.indexOf(url)===-1){srcUrls.push(url);}}// there were no valid sources
if(!srcUrls.length){return false;}// there is only one valid source element url
// use that
if(srcUrls.length===1){src=srcUrls[0];}tech.triggerSourceset(src);return true;};/**
 * our implementation of an `innerHTML` descriptor for browsers
 * that do not have one.
 */var innerHTMLDescriptorPolyfill={};if(!IS_IE8){innerHTMLDescriptorPolyfill=Object.defineProperty({},'innerHTML',{get:function get(){return this.cloneNode(true).innerHTML;},set:function set(v){// make a dummy node to use innerHTML on
var dummy=document$1.createElement(this.nodeName.toLowerCase());// set innerHTML to the value provided
dummy.innerHTML=v;// make a document fragment to hold the nodes from dummy
var docFrag=document$1.createDocumentFragment();// copy all of the nodes created by the innerHTML on dummy
// to the document fragment
while(dummy.childNodes.length){docFrag.appendChild(dummy.childNodes[0]);}// remove content
this.innerText='';// now we add all of that html in one by appending the
// document fragment. This is how innerHTML does it.
window$1.Element.prototype.appendChild.call(this,docFrag);// then return the result that innerHTML's setter would
return this.innerHTML;}});}/**
 * Get a property descriptor given a list of priorities and the
 * property to get.
 */var getDescriptor=function getDescriptor(priority,prop){var descriptor={};for(var i=0;i<priority.length;i++){descriptor=Object.getOwnPropertyDescriptor(priority[i],prop);if(descriptor&&descriptor.set&&descriptor.get){break;}}descriptor.enumerable=true;descriptor.configurable=true;return descriptor;};var getInnerHTMLDescriptor=function getInnerHTMLDescriptor(tech){return getDescriptor([tech.el(),window$1.HTMLMediaElement.prototype,window$1.Element.prototype,innerHTMLDescriptorPolyfill],'innerHTML');};/**
 * Patches browser internal functions so that we can tell syncronously
 * if a `<source>` was appended to the media element. For some reason this
 * causes a `sourceset` if the the media element is ready and has no source.
 * This happens when:
 * - The page has just loaded and the media element does not have a source.
 * - The media element was emptied of all sources, then `load()` was called.
 *
 * It does this by patching the following functions/properties when they are supported:
 *
 * - `append()` - can be used to add a `<source>` element to the media element
 * - `appendChild()` - can be used to add a `<source>` element to the media element
 * - `insertAdjacentHTML()` -  can be used to add a `<source>` element to the media element
 * - `innerHTML` -  can be used to add a `<source>` element to the media element
 *
 * @param {Html5} tech
 *        The tech object that sourceset is being setup on.
 */var firstSourceWatch=function firstSourceWatch(tech){var el=tech.el();// make sure firstSourceWatch isn't setup twice.
if(el.resetSourceWatch_){return;}var old={};var innerDescriptor=getInnerHTMLDescriptor(tech);var appendWrapper=function appendWrapper(appendFn){return function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var retval=appendFn.apply(el,args);sourcesetLoad(tech);return retval;};};['append','appendChild','insertAdjacentHTML'].forEach(function(k){if(!el[k]){return;}// store the old function
old[k]=el[k];// call the old function with a sourceset if a source
// was loaded
el[k]=appendWrapper(old[k]);});Object.defineProperty(el,'innerHTML',mergeOptions(innerDescriptor,{set:appendWrapper(innerDescriptor.set)}));el.resetSourceWatch_=function(){el.resetSourceWatch_=null;Object.keys(old).forEach(function(k){el[k]=old[k];});Object.defineProperty(el,'innerHTML',innerDescriptor);};// on the first sourceset, we need to revert our changes
tech.one('sourceset',el.resetSourceWatch_);};/**
 * our implementation of a `src` descriptor for browsers
 * that do not have one.
 */var srcDescriptorPolyfill={};if(!IS_IE8){srcDescriptorPolyfill=Object.defineProperty({},'src',{get:function get(){if(this.hasAttribute('src')){return getAbsoluteURL(window$1.Element.prototype.getAttribute.call(this,'src'));}return '';},set:function set(v){window$1.Element.prototype.setAttribute.call(this,'src',v);return v;}});}var getSrcDescriptor=function getSrcDescriptor(tech){return getDescriptor([tech.el(),window$1.HTMLMediaElement.prototype,srcDescriptorPolyfill],'src');};/**
 * setup `sourceset` handling on the `Html5` tech. This function
 * patches the following element properties/functions:
 *
 * - `src` - to determine when `src` is set
 * - `setAttribute()` - to determine when `src` is set
 * - `load()` - this re-triggers the source selection algorithm, and can
 *              cause a sourceset.
 *
 * If there is no source when we are adding `sourceset` support or during a `load()`
 * we also patch the functions listed in `firstSourceWatch`.
 *
 * @param {Html5} tech
 *        The tech to patch
 */var setupSourceset=function setupSourceset(tech){if(!tech.featuresSourceset){return;}var el=tech.el();// make sure sourceset isn't setup twice.
if(el.resetSourceset_){return;}var srcDescriptor=getSrcDescriptor(tech);var oldSetAttribute=el.setAttribute;var oldLoad=el.load;Object.defineProperty(el,'src',mergeOptions(srcDescriptor,{set:function set(v){var retval=srcDescriptor.set.call(el,v);// we use the getter here to get the actual value set on src
tech.triggerSourceset(el.src);return retval;}}));el.setAttribute=function(n,v){var retval=oldSetAttribute.call(el,n,v);if(/src/i.test(n)){tech.triggerSourceset(el.src);}return retval;};el.load=function(){var retval=oldLoad.call(el);// if load was called, but there was no source to fire
// sourceset on. We have to watch for a source append
// as that can trigger a `sourceset` when the media element
// has no source
if(!sourcesetLoad(tech)){tech.triggerSourceset('');firstSourceWatch(tech);}return retval;};if(el.currentSrc){tech.triggerSourceset(el.currentSrc);}else if(!sourcesetLoad(tech)){firstSourceWatch(tech);}el.resetSourceset_=function(){el.resetSourceset_=null;el.load=oldLoad;el.setAttribute=oldSetAttribute;Object.defineProperty(el,'src',srcDescriptor);if(el.resetSourceWatch_){el.resetSourceWatch_();}};};var _templateObject$2=taggedTemplateLiteralLoose(['Text Tracks are being loaded from another origin but the crossorigin attribute isn\'t used.\n            This may prevent text tracks from loading.'],['Text Tracks are being loaded from another origin but the crossorigin attribute isn\'t used.\n            This may prevent text tracks from loading.']);/**
 * @file html5.js
 *//**
 * HTML5 Media Controller - Wrapper for HTML5 Media API
 *
 * @mixes Tech~SouceHandlerAdditions
 * @extends Tech
 */var Html5=function(_Tech){inherits$1(Html5,_Tech);/**
   * Create an instance of this Tech.
   *
   * @param {Object} [options]
   *        The key/value store of player options.
   *
   * @param {Component~ReadyCallback} ready
   *        Callback function to call when the `HTML5` Tech is ready.
   */function Html5(options,ready){classCallCheck(this,Html5);var _this=possibleConstructorReturn(this,_Tech.call(this,options,ready));var source=options.source;var crossoriginTracks=false;// Set the source if one is provided
// 1) Check if the source is new (if not, we want to keep the original so playback isn't interrupted)
// 2) Check to see if the network state of the tag was failed at init, and if so, reset the source
// anyway so the error gets fired.
if(source&&(_this.el_.currentSrc!==source.src||options.tag&&options.tag.initNetworkState_===3)){_this.setSource(source);}else {_this.handleLateInit_(_this.el_);}// setup sourceset after late sourceset/init
if(options.enableSourceset){_this.setupSourcesetHandling_();}if(_this.el_.hasChildNodes()){var nodes=_this.el_.childNodes;var nodesLength=nodes.length;var removeNodes=[];while(nodesLength--){var node=nodes[nodesLength];var nodeName=node.nodeName.toLowerCase();if(nodeName==='track'){if(!_this.featuresNativeTextTracks){// Empty video tag tracks so the built-in player doesn't use them also.
// This may not be fast enough to stop HTML5 browsers from reading the tags
// so we'll need to turn off any default tracks if we're manually doing
// captions and subtitles. videoElement.textTracks
removeNodes.push(node);}else {// store HTMLTrackElement and TextTrack to remote list
_this.remoteTextTrackEls().addTrackElement_(node);_this.remoteTextTracks().addTrack(node.track);_this.textTracks().addTrack(node.track);if(!crossoriginTracks&&!_this.el_.hasAttribute('crossorigin')&&isCrossOrigin(node.src)){crossoriginTracks=true;}}}}for(var i=0;i<removeNodes.length;i++){_this.el_.removeChild(removeNodes[i]);}}_this.proxyNativeTracks_();if(_this.featuresNativeTextTracks&&crossoriginTracks){log$2.warn(tsml(_templateObject$2));}// prevent iOS Safari from disabling metadata text tracks during native playback
_this.restoreMetadataTracksInIOSNativePlayer_();// Determine if native controls should be used
// Our goal should be to get the custom controls on mobile solid everywhere
// so we can remove this all together. Right now this will block custom
// controls on touch enabled laptops like the Chrome Pixel
if((TOUCH_ENABLED||IS_IPHONE||IS_NATIVE_ANDROID)&&options.nativeControlsForTouch===true){_this.setControls(true);}// on iOS, we want to proxy `webkitbeginfullscreen` and `webkitendfullscreen`
// into a `fullscreenchange` event
_this.proxyWebkitFullscreen_();_this.triggerReady();return _this;}/**
   * Dispose of `HTML5` media element and remove all tracks.
   */Html5.prototype.dispose=function dispose(){if(this.el_&&this.el_.resetSourceset_){this.el_.resetSourceset_();}Html5.disposeMediaElement(this.el_);this.options_=null;// tech will handle clearing of the emulated track list
_Tech.prototype.dispose.call(this);};/**
   * Modify the media element so that we can detect when
   * the source is changed. Fires `sourceset` just after the source has changed
   */Html5.prototype.setupSourcesetHandling_=function setupSourcesetHandling_(){setupSourceset(this);};/**
   * When a captions track is enabled in the iOS Safari native player, all other
   * tracks are disabled (including metadata tracks), which nulls all of their
   * associated cue points. This will restore metadata tracks to their pre-fullscreen
   * state in those cases so that cue points are not needlessly lost.
   *
   * @private
   */Html5.prototype.restoreMetadataTracksInIOSNativePlayer_=function restoreMetadataTracksInIOSNativePlayer_(){var textTracks=this.textTracks();var metadataTracksPreFullscreenState=void 0;// captures a snapshot of every metadata track's current state
var takeMetadataTrackSnapshot=function takeMetadataTrackSnapshot(){metadataTracksPreFullscreenState=[];for(var i=0;i<textTracks.length;i++){var track=textTracks[i];if(track.kind==='metadata'){metadataTracksPreFullscreenState.push({track:track,storedMode:track.mode});}}};// snapshot each metadata track's initial state, and update the snapshot
// each time there is a track 'change' event
takeMetadataTrackSnapshot();textTracks.addEventListener('change',takeMetadataTrackSnapshot);this.on('dispose',function(){return textTracks.removeEventListener('change',takeMetadataTrackSnapshot);});var restoreTrackMode=function restoreTrackMode(){for(var i=0;i<metadataTracksPreFullscreenState.length;i++){var storedTrack=metadataTracksPreFullscreenState[i];if(storedTrack.track.mode==='disabled'&&storedTrack.track.mode!==storedTrack.storedMode){storedTrack.track.mode=storedTrack.storedMode;}}// we only want this handler to be executed on the first 'change' event
textTracks.removeEventListener('change',restoreTrackMode);};// when we enter fullscreen playback, stop updating the snapshot and
// restore all track modes to their pre-fullscreen state
this.on('webkitbeginfullscreen',function(){textTracks.removeEventListener('change',takeMetadataTrackSnapshot);// remove the listener before adding it just in case it wasn't previously removed
textTracks.removeEventListener('change',restoreTrackMode);textTracks.addEventListener('change',restoreTrackMode);});// start updating the snapshot again after leaving fullscreen
this.on('webkitendfullscreen',function(){// remove the listener before adding it just in case it wasn't previously removed
textTracks.removeEventListener('change',takeMetadataTrackSnapshot);textTracks.addEventListener('change',takeMetadataTrackSnapshot);// remove the restoreTrackMode handler in case it wasn't triggered during fullscreen playback
textTracks.removeEventListener('change',restoreTrackMode);});};/**
   * Proxy all native track list events to our track lists if the browser we are playing
   * in supports that type of track list.
   *
   * @private
   */Html5.prototype.proxyNativeTracks_=function proxyNativeTracks_(){var _this2=this;NORMAL$1.names.forEach(function(name){var props=NORMAL$1[name];var elTracks=_this2.el()[props.getterName];var techTracks=_this2[props.getterName]();if(!_this2['featuresNative'+props.capitalName+'Tracks']||!elTracks||!elTracks.addEventListener){return;}var listeners={change:function change(e){techTracks.trigger({type:'change',target:techTracks,currentTarget:techTracks,srcElement:techTracks});},addtrack:function addtrack(e){techTracks.addTrack(e.track);},removetrack:function removetrack(e){techTracks.removeTrack(e.track);}};var removeOldTracks=function removeOldTracks(){var removeTracks=[];for(var i=0;i<techTracks.length;i++){var found=false;for(var j=0;j<elTracks.length;j++){if(elTracks[j]===techTracks[i]){found=true;break;}}if(!found){removeTracks.push(techTracks[i]);}}while(removeTracks.length){techTracks.removeTrack(removeTracks.shift());}};Object.keys(listeners).forEach(function(eventName){var listener=listeners[eventName];elTracks.addEventListener(eventName,listener);_this2.on('dispose',function(e){return elTracks.removeEventListener(eventName,listener);});});// Remove (native) tracks that are not used anymore
_this2.on('loadstart',removeOldTracks);_this2.on('dispose',function(e){return _this2.off('loadstart',removeOldTracks);});});};/**
   * Create the `Html5` Tech's DOM element.
   *
   * @return {Element}
   *         The element that gets created.
   */Html5.prototype.createEl=function createEl$$1(){var el=this.options_.tag;// Check if this browser supports moving the element into the box.
// On the iPhone video will break if you move the element,
// So we have to create a brand new element.
// If we ingested the player div, we do not need to move the media element.
if(!el||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){// If the original tag is still there, clone and remove it.
if(el){var clone=el.cloneNode(true);if(el.parentNode){el.parentNode.insertBefore(clone,el);}Html5.disposeMediaElement(el);el=clone;}else {el=document$1.createElement('video');// determine if native controls should be used
var tagAttributes=this.options_.tag&&getAttributes(this.options_.tag);var attributes=mergeOptions({},tagAttributes);if(!TOUCH_ENABLED||this.options_.nativeControlsForTouch!==true){delete attributes.controls;}setAttributes(el,assign$1(attributes,{id:this.options_.techId,'class':'vjs-tech'}));}el.playerId=this.options_.playerId;}if(typeof this.options_.preload!=='undefined'){setAttribute$1(el,'preload',this.options_.preload);}// Update specific tag settings, in case they were overridden
// `autoplay` has to be *last* so that `muted` and `playsinline` are present
// when iOS/Safari or other browsers attempt to autoplay.
var settingsAttrs=['loop','muted','playsinline','autoplay'];for(var i=0;i<settingsAttrs.length;i++){var attr=settingsAttrs[i];var value=this.options_[attr];if(typeof value!=='undefined'){if(value){setAttribute$1(el,attr,attr);}else {removeAttribute(el,attr);}el[attr]=value;}}return el;};/**
   * This will be triggered if the loadstart event has already fired, before videojs was
   * ready. Two known examples of when this can happen are:
   * 1. If we're loading the playback object after it has started loading
   * 2. The media is already playing the (often with autoplay on) then
   *
   * This function will fire another loadstart so that videojs can catchup.
   *
   * @fires Tech#loadstart
   *
   * @return {undefined}
   *         returns nothing.
   */Html5.prototype.handleLateInit_=function handleLateInit_(el){if(el.networkState===0||el.networkState===3){// The video element hasn't started loading the source yet
// or didn't find a source
return;}if(el.readyState===0){// NetworkState is set synchronously BUT loadstart is fired at the
// end of the current stack, usually before setInterval(fn, 0).
// So at this point we know loadstart may have already fired or is
// about to fire, and either way the player hasn't seen it yet.
// We don't want to fire loadstart prematurely here and cause a
// double loadstart so we'll wait and see if it happens between now
// and the next loop, and fire it if not.
// HOWEVER, we also want to make sure it fires before loadedmetadata
// which could also happen between now and the next loop, so we'll
// watch for that also.
var loadstartFired=false;var setLoadstartFired=function setLoadstartFired(){loadstartFired=true;};this.on('loadstart',setLoadstartFired);var triggerLoadstart=function triggerLoadstart(){// We did miss the original loadstart. Make sure the player
// sees loadstart before loadedmetadata
if(!loadstartFired){this.trigger('loadstart');}};this.on('loadedmetadata',triggerLoadstart);this.ready(function(){this.off('loadstart',setLoadstartFired);this.off('loadedmetadata',triggerLoadstart);if(!loadstartFired){// We did miss the original native loadstart. Fire it now.
this.trigger('loadstart');}});return;}// From here on we know that loadstart already fired and we missed it.
// The other readyState events aren't as much of a problem if we double
// them, so not going to go to as much trouble as loadstart to prevent
// that unless we find reason to.
var eventsToTrigger=['loadstart'];// loadedmetadata: newly equal to HAVE_METADATA (1) or greater
eventsToTrigger.push('loadedmetadata');// loadeddata: newly increased to HAVE_CURRENT_DATA (2) or greater
if(el.readyState>=2){eventsToTrigger.push('loadeddata');}// canplay: newly increased to HAVE_FUTURE_DATA (3) or greater
if(el.readyState>=3){eventsToTrigger.push('canplay');}// canplaythrough: newly equal to HAVE_ENOUGH_DATA (4)
if(el.readyState>=4){eventsToTrigger.push('canplaythrough');}// We still need to give the player time to add event listeners
this.ready(function(){eventsToTrigger.forEach(function(type){this.trigger(type);},this);});};/**
   * Set current time for the `HTML5` tech.
   *
   * @param {number} seconds
   *        Set the current time of the media to this.
   */Html5.prototype.setCurrentTime=function setCurrentTime(seconds){try{this.el_.currentTime=seconds;}catch(e){log$2(e,'Video is not ready. (Video.js)');// this.warning(VideoJS.warnings.videoNotReady);
}};/**
   * Get the current duration of the HTML5 media element.
   *
   * @return {number}
   *         The duration of the media or 0 if there is no duration.
   */Html5.prototype.duration=function duration(){var _this3=this;// Android Chrome will report duration as Infinity for VOD HLS until after
// playback has started, which triggers the live display erroneously.
// Return NaN if playback has not started and trigger a durationupdate once
// the duration can be reliably known.
if(this.el_.duration===Infinity&&IS_ANDROID&&IS_CHROME&&this.el_.currentTime===0){// Wait for the first `timeupdate` with currentTime > 0 - there may be
// several with 0
var checkProgress=function checkProgress(){if(_this3.el_.currentTime>0){// Trigger durationchange for genuinely live video
if(_this3.el_.duration===Infinity){_this3.trigger('durationchange');}_this3.off('timeupdate',checkProgress);}};this.on('timeupdate',checkProgress);return NaN;}return this.el_.duration||NaN;};/**
   * Get the current width of the HTML5 media element.
   *
   * @return {number}
   *         The width of the HTML5 media element.
   */Html5.prototype.width=function width(){return this.el_.offsetWidth;};/**
   * Get the current height of the HTML5 media element.
   *
   * @return {number}
   *         The heigth of the HTML5 media element.
   */Html5.prototype.height=function height(){return this.el_.offsetHeight;};/**
   * Proxy iOS `webkitbeginfullscreen` and `webkitendfullscreen` into
   * `fullscreenchange` event.
   *
   * @private
   * @fires fullscreenchange
   * @listens webkitendfullscreen
   * @listens webkitbeginfullscreen
   * @listens webkitbeginfullscreen
   */Html5.prototype.proxyWebkitFullscreen_=function proxyWebkitFullscreen_(){var _this4=this;if(!('webkitDisplayingFullscreen'in this.el_)){return;}var endFn=function endFn(){this.trigger('fullscreenchange',{isFullscreen:false});};var beginFn=function beginFn(){if('webkitPresentationMode'in this.el_&&this.el_.webkitPresentationMode!=='picture-in-picture'){this.one('webkitendfullscreen',endFn);this.trigger('fullscreenchange',{isFullscreen:true});}};this.on('webkitbeginfullscreen',beginFn);this.on('dispose',function(){_this4.off('webkitbeginfullscreen',beginFn);_this4.off('webkitendfullscreen',endFn);});};/**
   * Check if fullscreen is supported on the current playback device.
   *
   * @return {boolean}
   *         - True if fullscreen is supported.
   *         - False if fullscreen is not supported.
   */Html5.prototype.supportsFullScreen=function supportsFullScreen(){if(typeof this.el_.webkitEnterFullScreen==='function'){var userAgent=window$1.navigator&&window$1.navigator.userAgent||'';// Seems to be broken in Chromium/Chrome && Safari in Leopard
if(/Android/.test(userAgent)||!/Chrome|Mac OS X 10.5/.test(userAgent)){return true;}}return false;};/**
   * Request that the `HTML5` Tech enter fullscreen.
   */Html5.prototype.enterFullScreen=function enterFullScreen(){var video=this.el_;if(video.paused&&video.networkState<=video.HAVE_METADATA){// attempt to prime the video element for programmatic access
// this isn't necessary on the desktop but shouldn't hurt
this.el_.play();// playing and pausing synchronously during the transition to fullscreen
// can get iOS ~6.1 devices into a play/pause loop
this.setTimeout(function(){video.pause();video.webkitEnterFullScreen();},0);}else {video.webkitEnterFullScreen();}};/**
   * Request that the `HTML5` Tech exit fullscreen.
   */Html5.prototype.exitFullScreen=function exitFullScreen(){this.el_.webkitExitFullScreen();};/**
   * A getter/setter for the `Html5` Tech's source object.
   * > Note: Please use {@link Html5#setSource}
   *
   * @param {Tech~SourceObject} [src]
   *        The source object you want to set on the `HTML5` techs element.
   *
   * @return {Tech~SourceObject|undefined}
   *         - The current source object when a source is not passed in.
   *         - undefined when setting
   *
   * @deprecated Since version 5.
   */Html5.prototype.src=function src(_src){if(_src===undefined){return this.el_.src;}// Setting src through `src` instead of `setSrc` will be deprecated
this.setSrc(_src);};/**
   * Reset the tech by removing all sources and then calling
   * {@link Html5.resetMediaElement}.
   */Html5.prototype.reset=function reset(){Html5.resetMediaElement(this.el_);};/**
   * Get the current source on the `HTML5` Tech. Falls back to returning the source from
   * the HTML5 media element.
   *
   * @return {Tech~SourceObject}
   *         The current source object from the HTML5 tech. With a fallback to the
   *         elements source.
   */Html5.prototype.currentSrc=function currentSrc(){if(this.currentSource_){return this.currentSource_.src;}return this.el_.currentSrc;};/**
   * Set controls attribute for the HTML5 media Element.
   *
   * @param {string} val
   *        Value to set the controls attribute to
   */Html5.prototype.setControls=function setControls(val){this.el_.controls=!!val;};/**
   * Create and returns a remote {@link TextTrack} object.
   *
   * @param {string} kind
   *        `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)
   *
   * @param {string} [label]
   *        Label to identify the text track
   *
   * @param {string} [language]
   *        Two letter language abbreviation
   *
   * @return {TextTrack}
   *         The TextTrack that gets created.
   */Html5.prototype.addTextTrack=function addTextTrack(kind,label,language){if(!this.featuresNativeTextTracks){return _Tech.prototype.addTextTrack.call(this,kind,label,language);}return this.el_.addTextTrack(kind,label,language);};/**
   * Creates either native TextTrack or an emulated TextTrack depending
   * on the value of `featuresNativeTextTracks`
   *
   * @param {Object} options
   *        The object should contain the options to intialize the TextTrack with.
   *
   * @param {string} [options.kind]
   *        `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata).
   *
   * @param {string} [options.label].
   *        Label to identify the text track
   *
   * @param {string} [options.language]
   *        Two letter language abbreviation.
   *
   * @param {boolean} [options.default]
   *        Default this track to on.
   *
   * @param {string} [options.id]
   *        The internal id to assign this track.
   *
   * @param {string} [options.src]
   *        A source url for the track.
   *
   * @return {HTMLTrackElement}
   *         The track element that gets created.
   */Html5.prototype.createRemoteTextTrack=function createRemoteTextTrack(options){if(!this.featuresNativeTextTracks){return _Tech.prototype.createRemoteTextTrack.call(this,options);}var htmlTrackElement=document$1.createElement('track');if(options.kind){htmlTrackElement.kind=options.kind;}if(options.label){htmlTrackElement.label=options.label;}if(options.language||options.srclang){htmlTrackElement.srclang=options.language||options.srclang;}if(options['default']){htmlTrackElement['default']=options['default'];}if(options.id){htmlTrackElement.id=options.id;}if(options.src){htmlTrackElement.src=options.src;}return htmlTrackElement;};/**
   * Creates a remote text track object and returns an html track element.
   *
   * @param {Object} options The object should contain values for
   * kind, language, label, and src (location of the WebVTT file)
   * @param {Boolean} [manualCleanup=true] if set to false, the TextTrack will be
   * automatically removed from the video element whenever the source changes
   * @return {HTMLTrackElement} An Html Track Element.
   * This can be an emulated {@link HTMLTrackElement} or a native one.
   * @deprecated The default value of the "manualCleanup" parameter will default
   * to "false" in upcoming versions of Video.js
   */Html5.prototype.addRemoteTextTrack=function addRemoteTextTrack(options,manualCleanup){var htmlTrackElement=_Tech.prototype.addRemoteTextTrack.call(this,options,manualCleanup);if(this.featuresNativeTextTracks){this.el().appendChild(htmlTrackElement);}return htmlTrackElement;};/**
   * Remove remote `TextTrack` from `TextTrackList` object
   *
   * @param {TextTrack} track
   *        `TextTrack` object to remove
   */Html5.prototype.removeRemoteTextTrack=function removeRemoteTextTrack(track){_Tech.prototype.removeRemoteTextTrack.call(this,track);if(this.featuresNativeTextTracks){var tracks=this.$$('track');var i=tracks.length;while(i--){if(track===tracks[i]||track===tracks[i].track){this.el().removeChild(tracks[i]);}}}};/**
   * Gets available media playback quality metrics as specified by the W3C's Media
   * Playback Quality API.
   *
   * @see [Spec]{@link https://wicg.github.io/media-playback-quality}
   *
   * @return {Object}
   *         An object with supported media playback quality metrics
   */Html5.prototype.getVideoPlaybackQuality=function getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality==='function'){return this.el().getVideoPlaybackQuality();}var videoPlaybackQuality={};if(typeof this.el().webkitDroppedFrameCount!=='undefined'&&typeof this.el().webkitDecodedFrameCount!=='undefined'){videoPlaybackQuality.droppedVideoFrames=this.el().webkitDroppedFrameCount;videoPlaybackQuality.totalVideoFrames=this.el().webkitDecodedFrameCount;}if(window$1.performance&&typeof window$1.performance.now==='function'){videoPlaybackQuality.creationTime=window$1.performance.now();}else if(window$1.performance&&window$1.performance.timing&&typeof window$1.performance.timing.navigationStart==='number'){videoPlaybackQuality.creationTime=window$1.Date.now()-window$1.performance.timing.navigationStart;}return videoPlaybackQuality;};return Html5;}(Tech);/* HTML5 Support Testing ---------------------------------------------------- */if(isReal()){/**
   * Element for testing browser HTML5 media capabilities
   *
   * @type {Element}
   * @constant
   * @private
   */Html5.TEST_VID=document$1.createElement('video');var track=document$1.createElement('track');track.kind='captions';track.srclang='en';track.label='English';Html5.TEST_VID.appendChild(track);}/**
 * Check if HTML5 media is supported by this browser/device.
 *
 * @return {boolean}
 *         - True if HTML5 media is supported.
 *         - False if HTML5 media is not supported.
 */Html5.isSupported=function(){// IE9 with no Media Player is a LIAR! (#984)
try{Html5.TEST_VID.volume=0.5;}catch(e){return false;}return !!(Html5.TEST_VID&&Html5.TEST_VID.canPlayType);};/**
 * Check if the tech can support the given type
 *
 * @param {string} type
 *        The mimetype to check
 * @return {string} 'probably', 'maybe', or '' (empty string)
 */Html5.canPlayType=function(type){return Html5.TEST_VID.canPlayType(type);};/**
 * Check if the tech can support the given source
 * @param {Object} srcObj
 *        The source object
 * @param {Object} options
 *        The options passed to the tech
 * @return {string} 'probably', 'maybe', or '' (empty string)
 */Html5.canPlaySource=function(srcObj,options){return Html5.canPlayType(srcObj.type);};/**
 * Check if the volume can be changed in this browser/device.
 * Volume cannot be changed in a lot of mobile devices.
 * Specifically, it can't be changed from 1 on iOS.
 *
 * @return {boolean}
 *         - True if volume can be controlled
 *         - False otherwise
 */Html5.canControlVolume=function(){// IE will error if Windows Media Player not installed #3315
try{var volume=Html5.TEST_VID.volume;Html5.TEST_VID.volume=volume/2+0.1;return volume!==Html5.TEST_VID.volume;}catch(e){return false;}};/**
 * Check if the volume can be muted in this browser/device.
 * Some devices, e.g. iOS, don't allow changing volume
 * but permits muting/unmuting.
 *
 * @return {bolean}
 *      - True if volume can be muted
 *      - False otherwise
 */Html5.canMuteVolume=function(){try{var muted=Html5.TEST_VID.muted;// in some versions of iOS muted property doesn't always
// work, so we want to set both property and attribute
Html5.TEST_VID.muted=!muted;if(Html5.TEST_VID.muted){setAttribute$1(Html5.TEST_VID,'muted','muted');}else {removeAttribute(Html5.TEST_VID,'muted','muted');}return muted!==Html5.TEST_VID.muted;}catch(e){return false;}};/**
 * Check if the playback rate can be changed in this browser/device.
 *
 * @return {boolean}
 *         - True if playback rate can be controlled
 *         - False otherwise
 */Html5.canControlPlaybackRate=function(){// Playback rate API is implemented in Android Chrome, but doesn't do anything
// https://github.com/videojs/video.js/issues/3180
if(IS_ANDROID&&IS_CHROME&&CHROME_VERSION<58){return false;}// IE will error if Windows Media Player not installed #3315
try{var playbackRate=Html5.TEST_VID.playbackRate;Html5.TEST_VID.playbackRate=playbackRate/2+0.1;return playbackRate!==Html5.TEST_VID.playbackRate;}catch(e){return false;}};/**
 * Check if we can override a video/audio elements attributes, with
 * Object.defineProperty.
 *
 * @return {boolean}
 *         - True if builtin attributes can be overriden
 *         - False otherwise
 */Html5.canOverrideAttributes=function(){if(IS_IE8){return false;}// if we cannot overwrite the src/innerHTML property, there is no support
// iOS 7 safari for instance cannot do this.
try{var noop=function noop(){};Object.defineProperty(document$1.createElement('video'),'src',{get:noop,set:noop});Object.defineProperty(document$1.createElement('audio'),'src',{get:noop,set:noop});Object.defineProperty(document$1.createElement('video'),'innerHTML',{get:noop,set:noop});Object.defineProperty(document$1.createElement('audio'),'innerHTML',{get:noop,set:noop});}catch(e){return false;}return true;};/**
 * Check to see if native `TextTrack`s are supported by this browser/device.
 *
 * @return {boolean}
 *         - True if native `TextTrack`s are supported.
 *         - False otherwise
 */Html5.supportsNativeTextTracks=function(){return IS_ANY_SAFARI||IS_IOS&&IS_CHROME;};/**
 * Check to see if native `VideoTrack`s are supported by this browser/device
 *
 * @return {boolean}
 *        - True if native `VideoTrack`s are supported.
 *        - False otherwise
 */Html5.supportsNativeVideoTracks=function(){return !!(Html5.TEST_VID&&Html5.TEST_VID.videoTracks);};/**
 * Check to see if native `AudioTrack`s are supported by this browser/device
 *
 * @return {boolean}
 *        - True if native `AudioTrack`s are supported.
 *        - False otherwise
 */Html5.supportsNativeAudioTracks=function(){return !!(Html5.TEST_VID&&Html5.TEST_VID.audioTracks);};/**
 * An array of events available on the Html5 tech.
 *
 * @private
 * @type {Array}
 */Html5.Events=['loadstart','suspend','abort','error','emptied','stalled','loadedmetadata','loadeddata','canplay','canplaythrough','playing','waiting','seeking','seeked','ended','durationchange','timeupdate','progress','play','pause','ratechange','resize','volumechange'];/**
 * Boolean indicating whether the `Tech` supports volume control.
 *
 * @type {boolean}
 * @default {@link Html5.canControlVolume}
 */Html5.prototype.featuresVolumeControl=Html5.canControlVolume();/**
 * Boolean indicating whether the `Tech` supports muting volume.
 *
 * @type {bolean}
 * @default {@link Html5.canMuteVolume}
 */Html5.prototype.featuresMuteControl=Html5.canMuteVolume();/**
 * Boolean indicating whether the `Tech` supports changing the speed at which the media
 * plays. Examples:
 *   - Set player to play 2x (twice) as fast
 *   - Set player to play 0.5x (half) as fast
 *
 * @type {boolean}
 * @default {@link Html5.canControlPlaybackRate}
 */Html5.prototype.featuresPlaybackRate=Html5.canControlPlaybackRate();/**
 * Boolean indicating wether the `Tech` supports the `sourceset` event.
 *
 * @type {boolean}
 * @default
 */Html5.prototype.featuresSourceset=Html5.canOverrideAttributes();/**
 * Boolean indicating whether the `HTML5` tech currently supports the media element
 * moving in the DOM. iOS breaks if you move the media element, so this is set this to
 * false there. Everywhere else this should be true.
 *
 * @type {boolean}
 * @default
 */Html5.prototype.movingMediaElementInDOM=!IS_IOS;// TODO: Previous comment: No longer appears to be used. Can probably be removed.
//       Is this true?
/**
 * Boolean indicating whether the `HTML5` tech currently supports automatic media resize
 * when going into fullscreen.
 *
 * @type {boolean}
 * @default
 */Html5.prototype.featuresFullscreenResize=true;/**
 * Boolean indicating whether the `HTML5` tech currently supports the progress event.
 * If this is false, manual `progress` events will be triggred instead.
 *
 * @type {boolean}
 * @default
 */Html5.prototype.featuresProgressEvents=true;/**
 * Boolean indicating whether the `HTML5` tech currently supports the timeupdate event.
 * If this is false, manual `timeupdate` events will be triggred instead.
 *
 * @default
 */Html5.prototype.featuresTimeupdateEvents=true;/**
 * Boolean indicating whether the `HTML5` tech currently supports native `TextTrack`s.
 *
 * @type {boolean}
 * @default {@link Html5.supportsNativeTextTracks}
 */Html5.prototype.featuresNativeTextTracks=Html5.supportsNativeTextTracks();/**
 * Boolean indicating whether the `HTML5` tech currently supports native `VideoTrack`s.
 *
 * @type {boolean}
 * @default {@link Html5.supportsNativeVideoTracks}
 */Html5.prototype.featuresNativeVideoTracks=Html5.supportsNativeVideoTracks();/**
 * Boolean indicating whether the `HTML5` tech currently supports native `AudioTrack`s.
 *
 * @type {boolean}
 * @default {@link Html5.supportsNativeAudioTracks}
 */Html5.prototype.featuresNativeAudioTracks=Html5.supportsNativeAudioTracks();// HTML5 Feature detection and Device Fixes --------------------------------- //
var canPlayType=Html5.TEST_VID&&Html5.TEST_VID.constructor.prototype.canPlayType;var mpegurlRE=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;var mp4RE=/^video\/mp4/i;Html5.patchCanPlayType=function(){// Android 4.0 and above can play HLS to some extent but it reports being unable to do so
// Firefox and Chrome report correctly
if(ANDROID_VERSION>=4.0&&!IS_FIREFOX&&!IS_CHROME){Html5.TEST_VID.constructor.prototype.canPlayType=function(type){if(type&&mpegurlRE.test(type)){return 'maybe';}return canPlayType.call(this,type);};// Override Android 2.2 and less canPlayType method which is broken
}else if(IS_OLD_ANDROID){Html5.TEST_VID.constructor.prototype.canPlayType=function(type){if(type&&mp4RE.test(type)){return 'maybe';}return canPlayType.call(this,type);};}};Html5.unpatchCanPlayType=function(){var r=Html5.TEST_VID.constructor.prototype.canPlayType;Html5.TEST_VID.constructor.prototype.canPlayType=canPlayType;return r;};// by default, patch the media element
Html5.patchCanPlayType();Html5.disposeMediaElement=function(el){if(!el){return;}if(el.parentNode){el.parentNode.removeChild(el);}// remove any child track or source nodes to prevent their loading
while(el.hasChildNodes()){el.removeChild(el.firstChild);}// remove any src reference. not setting `src=''` because that causes a warning
// in firefox
el.removeAttribute('src');// force the media element to update its loading state by calling load()
// however IE on Windows 7N has a bug that throws an error so need a try/catch (#793)
if(typeof el.load==='function'){// wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473)
(function(){try{el.load();}catch(e){// not supported
}})();}};Html5.resetMediaElement=function(el){if(!el){return;}var sources=el.querySelectorAll('source');var i=sources.length;while(i--){el.removeChild(sources[i]);}// remove any src reference.
// not setting `src=''` because that throws an error
el.removeAttribute('src');if(typeof el.load==='function'){// wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473)
(function(){try{el.load();}catch(e){// satisfy linter
}})();}};/* Native HTML5 element property wrapping ----------------------------------- */// Wrap native boolean attributes with getters that check both property and attribute
// The list is as followed:
// muted, defaultMuted, autoplay, controls, loop, playsinline
[/**
 * Get the value of `muted` from the media element. `muted` indicates
 * that the volume for the media should be set to silent. This does not actually change
 * the `volume` attribute.
 *
 * @method Html5#muted
 * @return {boolean}
 *         - True if the value of `volume` should be ignored and the audio set to silent.
 *         - False if the value of `volume` should be used.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-muted}
 */'muted',/**
 * Get the value of `defaultMuted` from the media element. `defaultMuted` indicates
 * whether the media should start muted or not. Only changes the default state of the
 * media. `muted` and `defaultMuted` can have different values. {@link Html5#muted} indicates the
 * current state.
 *
 * @method Html5#defaultMuted
 * @return {boolean}
 *         - The value of `defaultMuted` from the media element.
 *         - True indicates that the media should start muted.
 *         - False indicates that the media should not start muted
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultmuted}
 */'defaultMuted',/**
 * Get the value of `autoplay` from the media element. `autoplay` indicates
 * that the media should start to play as soon as the page is ready.
 *
 * @method Html5#autoplay
 * @return {boolean}
 *         - The value of `autoplay` from the media element.
 *         - True indicates that the media should start as soon as the page loads.
 *         - False indicates that the media should not start as soon as the page loads.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-autoplay}
 */'autoplay',/**
 * Get the value of `controls` from the media element. `controls` indicates
 * whether the native media controls should be shown or hidden.
 *
 * @method Html5#controls
 * @return {boolean}
 *         - The value of `controls` from the media element.
 *         - True indicates that native controls should be showing.
 *         - False indicates that native controls should be hidden.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-controls}
 */'controls',/**
 * Get the value of `loop` from the media element. `loop` indicates
 * that the media should return to the start of the media and continue playing once
 * it reaches the end.
 *
 * @method Html5#loop
 * @return {boolean}
 *         - The value of `loop` from the media element.
 *         - True indicates that playback should seek back to start once
 *           the end of a media is reached.
 *         - False indicates that playback should not loop back to the start when the
 *           end of the media is reached.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-loop}
 */'loop',/**
 * Get the value of `playsinline` from the media element. `playsinline` indicates
 * to the browser that non-fullscreen playback is preferred when fullscreen
 * playback is the native default, such as in iOS Safari.
 *
 * @method Html5#playsinline
 * @return {boolean}
 *         - The value of `playsinline` from the media element.
 *         - True indicates that the media should play inline.
 *         - False indicates that the media should not play inline.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline}
 */'playsinline'].forEach(function(prop){Html5.prototype[prop]=function(){return this.el_[prop]||this.el_.hasAttribute(prop);};});// Wrap native boolean attributes with setters that set both property and attribute
// The list is as followed:
// setMuted, setDefaultMuted, setAutoplay, setLoop, setPlaysinline
// setControls is special-cased above
[/**
 * Set the value of `muted` on the media element. `muted` indicates that the current
 * audio level should be silent.
 *
 * @method Html5#setMuted
 * @param {boolean} muted
 *        - True if the audio should be set to silent
 *        - False otherwise
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-muted}
 */'muted',/**
 * Set the value of `defaultMuted` on the media element. `defaultMuted` indicates that the current
 * audio level should be silent, but will only effect the muted level on intial playback..
 *
 * @method Html5.prototype.setDefaultMuted
 * @param {boolean} defaultMuted
 *        - True if the audio should be set to silent
 *        - False otherwise
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultmuted}
 */'defaultMuted',/**
 * Set the value of `autoplay` on the media element. `autoplay` indicates
 * that the media should start to play as soon as the page is ready.
 *
 * @method Html5#setAutoplay
 * @param {boolean} autoplay
 *         - True indicates that the media should start as soon as the page loads.
 *         - False indicates that the media should not start as soon as the page loads.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-autoplay}
 */'autoplay',/**
 * Set the value of `loop` on the media element. `loop` indicates
 * that the media should return to the start of the media and continue playing once
 * it reaches the end.
 *
 * @method Html5#setLoop
 * @param {boolean} loop
 *         - True indicates that playback should seek back to start once
 *           the end of a media is reached.
 *         - False indicates that playback should not loop back to the start when the
 *           end of the media is reached.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-loop}
 */'loop',/**
 * Set the value of `playsinline` from the media element. `playsinline` indicates
 * to the browser that non-fullscreen playback is preferred when fullscreen
 * playback is the native default, such as in iOS Safari.
 *
 * @method Html5#setPlaysinline
 * @param {boolean} playsinline
 *         - True indicates that the media should play inline.
 *         - False indicates that the media should not play inline.
 *
 * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline}
 */'playsinline'].forEach(function(prop){Html5.prototype['set'+toTitleCase(prop)]=function(v){this.el_[prop]=v;if(v){this.el_.setAttribute(prop,prop);}else {this.el_.removeAttribute(prop);}};});// Wrap native properties with a getter
// The list is as followed
// paused, currentTime, buffered, volume, poster, preload, error, seeking
// seekable, ended, playbackRate, defaultPlaybackRate, played, networkState
// readyState, videoWidth, videoHeight
[/**
 * Get the value of `paused` from the media element. `paused` indicates whether the media element
 * is currently paused or not.
 *
 * @method Html5#paused
 * @return {boolean}
 *         The value of `paused` from the media element.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-paused}
 */'paused',/**
 * Get the value of `currentTime` from the media element. `currentTime` indicates
 * the current second that the media is at in playback.
 *
 * @method Html5#currentTime
 * @return {number}
 *         The value of `currentTime` from the media element.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-currenttime}
 */'currentTime',/**
 * Get the value of `buffered` from the media element. `buffered` is a `TimeRange`
 * object that represents the parts of the media that are already downloaded and
 * available for playback.
 *
 * @method Html5#buffered
 * @return {TimeRange}
 *         The value of `buffered` from the media element.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered}
 */'buffered',/**
 * Get the value of `volume` from the media element. `volume` indicates
 * the current playback volume of audio for a media. `volume` will be a value from 0
 * (silent) to 1 (loudest and default).
 *
 * @method Html5#volume
 * @return {number}
 *         The value of `volume` from the media element. Value will be between 0-1.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-a-volume}
 */'volume',/**
 * Get the value of `poster` from the media element. `poster` indicates
 * that the url of an image file that can/will be shown when no media data is available.
 *
 * @method Html5#poster
 * @return {string}
 *         The value of `poster` from the media element. Value will be a url to an
 *         image.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-video-poster}
 */'poster',/**
 * Get the value of `preload` from the media element. `preload` indicates
 * what should download before the media is interacted with. It can have the following
 * values:
 * - none: nothing should be downloaded
 * - metadata: poster and the first few frames of the media may be downloaded to get
 *   media dimensions and other metadata
 * - auto: allow the media and metadata for the media to be downloaded before
 *    interaction
 *
 * @method Html5#preload
 * @return {string}
 *         The value of `preload` from the media element. Will be 'none', 'metadata',
 *         or 'auto'.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-preload}
 */'preload',/**
 * Get the value of the `error` from the media element. `error` indicates any
 * MediaError that may have occured during playback. If error returns null there is no
 * current error.
 *
 * @method Html5#error
 * @return {MediaError|null}
 *         The value of `error` from the media element. Will be `MediaError` if there
 *         is a current error and null otherwise.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-error}
 */'error',/**
 * Get the value of `seeking` from the media element. `seeking` indicates whether the
 * media is currently seeking to a new position or not.
 *
 * @method Html5#seeking
 * @return {boolean}
 *         - The value of `seeking` from the media element.
 *         - True indicates that the media is currently seeking to a new position.
 *         - Flase indicates that the media is not seeking to a new position at this time.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seeking}
 */'seeking',/**
 * Get the value of `seekable` from the media element. `seekable` returns a
 * `TimeRange` object indicating ranges of time that can currently be `seeked` to.
 *
 * @method Html5#seekable
 * @return {TimeRange}
 *         The value of `seekable` from the media element. A `TimeRange` object
 *         indicating the current ranges of time that can be seeked to.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seekable}
 */'seekable',/**
 * Get the value of `ended` from the media element. `ended` indicates whether
 * the media has reached the end or not.
 *
 * @method Html5#ended
 * @return {boolean}
 *         - The value of `ended` from the media element.
 *         - True indicates that the media has ended.
 *         - False indicates that the media has not ended.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-ended}
 */'ended',/**
 * Get the value of `playbackRate` from the media element. `playbackRate` indicates
 * the rate at which the media is currently playing back. Examples:
 *   - if playbackRate is set to 2, media will play twice as fast.
 *   - if playbackRate is set to 0.5, media will play half as fast.
 *
 * @method Html5#playbackRate
 * @return {number}
 *         The value of `playbackRate` from the media element. A number indicating
 *         the current playback speed of the media, where 1 is normal speed.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate}
 */'playbackRate',/**
 * Get the value of `defaultPlaybackRate` from the media element. `defaultPlaybackRate` indicates
 * the rate at which the media is currently playing back. This value will not indicate the current
 * `playbackRate` after playback has started, use {@link Html5#playbackRate} for that.
 *
 * Examples:
 *   - if defaultPlaybackRate is set to 2, media will play twice as fast.
 *   - if defaultPlaybackRate is set to 0.5, media will play half as fast.
 *
 * @method Html5.prototype.defaultPlaybackRate
 * @return {number}
 *         The value of `defaultPlaybackRate` from the media element. A number indicating
 *         the current playback speed of the media, where 1 is normal speed.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate}
 */'defaultPlaybackRate',/**
 * Get the value of `played` from the media element. `played` returns a `TimeRange`
 * object representing points in the media timeline that have been played.
 *
 * @method Html5#played
 * @return {TimeRange}
 *         The value of `played` from the media element. A `TimeRange` object indicating
 *         the ranges of time that have been played.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-played}
 */'played',/**
 * Get the value of `networkState` from the media element. `networkState` indicates
 * the current network state. It returns an enumeration from the following list:
 * - 0: NETWORK_EMPTY
 * - 1: NEWORK_IDLE
 * - 2: NETWORK_LOADING
 * - 3: NETWORK_NO_SOURCE
 *
 * @method Html5#networkState
 * @return {number}
 *         The value of `networkState` from the media element. This will be a number
 *         from the list in the description.
 *
 * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-networkstate}
 */'networkState',/**
 * Get the value of `readyState` from the media element. `readyState` indicates
 * the current state of the media element. It returns an enumeration from the
 * following list:
 * - 0: HAVE_NOTHING
 * - 1: HAVE_METADATA
 * - 2: HAVE_CURRENT_DATA
 * - 3: HAVE_FUTURE_DATA
 * - 4: HAVE_ENOUGH_DATA
 *
 * @method Html5#readyState
 * @return {number}
 *         The value of `readyState` from the media element. This will be a number
 *         from the list in the description.
 *
 * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#ready-states}
 */'readyState',/**
 * Get the value of `videoWidth` from the video element. `videoWidth` indicates
 * the current width of the video in css pixels.
 *
 * @method Html5#videoWidth
 * @return {number}
 *         The value of `videoWidth` from the video element. This will be a number
 *         in css pixels.
 *
 * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth}
 */'videoWidth',/**
 * Get the value of `videoHeight` from the video element. `videoHeigth` indicates
 * the current height of the video in css pixels.
 *
 * @method Html5#videoHeight
 * @return {number}
 *         The value of `videoHeight` from the video element. This will be a number
 *         in css pixels.
 *
 * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth}
 */'videoHeight'].forEach(function(prop){Html5.prototype[prop]=function(){return this.el_[prop];};});// Wrap native properties with a setter in this format:
// set + toTitleCase(name)
// The list is as follows:
// setVolume, setSrc, setPoster, setPreload, setPlaybackRate, setDefaultPlaybackRate
[/**
 * Set the value of `volume` on the media element. `volume` indicates the current
 * audio level as a percentage in decimal form. This means that 1 is 100%, 0.5 is 50%, and
 * so on.
 *
 * @method Html5#setVolume
 * @param {number} percentAsDecimal
 *        The volume percent as a decimal. Valid range is from 0-1.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-a-volume}
 */'volume',/**
 * Set the value of `src` on the media element. `src` indicates the current
 * {@link Tech~SourceObject} for the media.
 *
 * @method Html5#setSrc
 * @param {Tech~SourceObject} src
 *        The source object to set as the current source.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-src}
 */'src',/**
 * Set the value of `poster` on the media element. `poster` is the url to
 * an image file that can/will be shown when no media data is available.
 *
 * @method Html5#setPoster
 * @param {string} poster
 *        The url to an image that should be used as the `poster` for the media
 *        element.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-poster}
 */'poster',/**
 * Set the value of `preload` on the media element. `preload` indicates
 * what should download before the media is interacted with. It can have the following
 * values:
 * - none: nothing should be downloaded
 * - metadata: poster and the first few frames of the media may be downloaded to get
 *   media dimensions and other metadata
 * - auto: allow the media and metadata for the media to be downloaded before
 *    interaction
 *
 * @method Html5#setPreload
 * @param {string} preload
 *         The value of `preload` to set on the media element. Must be 'none', 'metadata',
 *         or 'auto'.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-preload}
 */'preload',/**
 * Set the value of `playbackRate` on the media element. `playbackRate` indicates
 * the rate at which the media should play back. Examples:
 *   - if playbackRate is set to 2, media will play twice as fast.
 *   - if playbackRate is set to 0.5, media will play half as fast.
 *
 * @method Html5#setPlaybackRate
 * @return {number}
 *         The value of `playbackRate` from the media element. A number indicating
 *         the current playback speed of the media, where 1 is normal speed.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate}
 */'playbackRate',/**
 * Set the value of `defaultPlaybackRate` on the media element. `defaultPlaybackRate` indicates
 * the rate at which the media should play back upon initial startup. Changing this value
 * after a video has started will do nothing. Instead you should used {@link Html5#setPlaybackRate}.
 *
 * Example Values:
 *   - if playbackRate is set to 2, media will play twice as fast.
 *   - if playbackRate is set to 0.5, media will play half as fast.
 *
 * @method Html5.prototype.setDefaultPlaybackRate
 * @return {number}
 *         The value of `defaultPlaybackRate` from the media element. A number indicating
 *         the current playback speed of the media, where 1 is normal speed.
 *
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultplaybackrate}
 */'defaultPlaybackRate'].forEach(function(prop){Html5.prototype['set'+toTitleCase(prop)]=function(v){this.el_[prop]=v;};});// wrap native functions with a function
// The list is as follows:
// pause, load play
[/**
 * A wrapper around the media elements `pause` function. This will call the `HTML5`
 * media elements `pause` function.
 *
 * @method Html5#pause
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-pause}
 */'pause',/**
 * A wrapper around the media elements `load` function. This will call the `HTML5`s
 * media element `load` function.
 *
 * @method Html5#load
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-load}
 */'load',/**
 * A wrapper around the media elements `play` function. This will call the `HTML5`s
 * media element `play` function.
 *
 * @method Html5#play
 * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-play}
 */'play'].forEach(function(prop){Html5.prototype[prop]=function(){return this.el_[prop]();};});Tech.withSourceHandlers(Html5);/**
 * Native source handler for Html5, simply passes the source to the media element.
 *
 * @proprety {Tech~SourceObject} source
 *        The source object
 *
 * @proprety {Html5} tech
 *        The instance of the HTML5 tech.
 */Html5.nativeSourceHandler={};/**
 * Check if the media element can play the given mime type.
 *
 * @param {string} type
 *        The mimetype to check
 *
 * @return {string}
 *         'probably', 'maybe', or '' (empty string)
 */Html5.nativeSourceHandler.canPlayType=function(type){// IE9 on Windows 7 without MediaPlayer throws an error here
// https://github.com/videojs/video.js/issues/519
try{return Html5.TEST_VID.canPlayType(type);}catch(e){return '';}};/**
 * Check if the media element can handle a source natively.
 *
 * @param {Tech~SourceObject} source
 *         The source object
 *
 * @param {Object} [options]
 *         Options to be passed to the tech.
 *
 * @return {string}
 *         'probably', 'maybe', or '' (empty string).
 */Html5.nativeSourceHandler.canHandleSource=function(source,options){// If a type was provided we should rely on that
if(source.type){return Html5.nativeSourceHandler.canPlayType(source.type);// If no type, fall back to checking 'video/[EXTENSION]'
}else if(source.src){var ext=getFileExtension(source.src);return Html5.nativeSourceHandler.canPlayType('video/'+ext);}return '';};/**
 * Pass the source to the native media element.
 *
 * @param {Tech~SourceObject} source
 *        The source object
 *
 * @param {Html5} tech
 *        The instance of the Html5 tech
 *
 * @param {Object} [options]
 *        The options to pass to the source
 */Html5.nativeSourceHandler.handleSource=function(source,tech,options){tech.setSrc(source.src);};/**
 * A noop for the native dispose function, as cleanup is not needed.
 */Html5.nativeSourceHandler.dispose=function(){};// Register the native source handler
Html5.registerSourceHandler(Html5.nativeSourceHandler);Tech.registerTech('Html5',Html5);var _templateObject$1=taggedTemplateLiteralLoose(['\n        Using the tech directly can be dangerous. I hope you know what you\'re doing.\n        See https://github.com/videojs/video.js/issues/2617 for more info.\n      '],['\n        Using the tech directly can be dangerous. I hope you know what you\'re doing.\n        See https://github.com/videojs/video.js/issues/2617 for more info.\n      ']);/**
 * @file player.js
 */// Subclasses Component
// The following imports are used only to ensure that the corresponding modules
// are always included in the video.js package. Importing the modules will
// execute them and they will register themselves with video.js.
// Import Html5 tech, at least for disposing the original video tag.
// The following tech events are simply re-triggered
// on the player when they happen
var TECH_EVENTS_RETRIGGER=[/**
 * Fired while the user agent is downloading media data.
 *
 * @event Player#progress
 * @type {EventTarget~Event}
 *//**
 * Retrigger the `progress` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechProgress_
 * @fires Player#progress
 * @listens Tech#progress
 */'progress',/**
 * Fires when the loading of an audio/video is aborted.
 *
 * @event Player#abort
 * @type {EventTarget~Event}
 *//**
 * Retrigger the `abort` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechAbort_
 * @fires Player#abort
 * @listens Tech#abort
 */'abort',/**
 * Fires when the browser is intentionally not getting media data.
 *
 * @event Player#suspend
 * @type {EventTarget~Event}
 *//**
 * Retrigger the `suspend` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechSuspend_
 * @fires Player#suspend
 * @listens Tech#suspend
 */'suspend',/**
 * Fires when the current playlist is empty.
 *
 * @event Player#emptied
 * @type {EventTarget~Event}
 *//**
 * Retrigger the `emptied` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechEmptied_
 * @fires Player#emptied
 * @listens Tech#emptied
 */'emptied',/**
 * Fires when the browser is trying to get media data, but data is not available.
 *
 * @event Player#stalled
 * @type {EventTarget~Event}
 *//**
 * Retrigger the `stalled` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechStalled_
 * @fires Player#stalled
 * @listens Tech#stalled
 */'stalled',/**
 * Fires when the browser has loaded meta data for the audio/video.
 *
 * @event Player#loadedmetadata
 * @type {EventTarget~Event}
 *//**
 * Retrigger the `stalled` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechLoadedmetadata_
 * @fires Player#loadedmetadata
 * @listens Tech#loadedmetadata
 */'loadedmetadata',/**
 * Fires when the browser has loaded the current frame of the audio/video.
 *
 * @event Player#loadeddata
 * @type {event}
 *//**
 * Retrigger the `loadeddata` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechLoaddeddata_
 * @fires Player#loadeddata
 * @listens Tech#loadeddata
 */'loadeddata',/**
 * Fires when the current playback position has changed.
 *
 * @event Player#timeupdate
 * @type {event}
 *//**
 * Retrigger the `timeupdate` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechTimeUpdate_
 * @fires Player#timeupdate
 * @listens Tech#timeupdate
 */'timeupdate',/**
 * Fires when the video's intrinsic dimensions change
 *
 * @event Player#resize
 * @type {event}
 *//**
 * Retrigger the `resize` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechResize_
 * @fires Player#resize
 * @listens Tech#resize
 */'resize',/**
 * Fires when the volume has been changed
 *
 * @event Player#volumechange
 * @type {event}
 *//**
 * Retrigger the `volumechange` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechVolumechange_
 * @fires Player#volumechange
 * @listens Tech#volumechange
 */'volumechange',/**
 * Fires when the text track has been changed
 *
 * @event Player#texttrackchange
 * @type {event}
 *//**
 * Retrigger the `texttrackchange` event that was triggered by the {@link Tech}.
 *
 * @private
 * @method Player#handleTechTexttrackchange_
 * @fires Player#texttrackchange
 * @listens Tech#texttrackchange
 */'texttrackchange'];// events to queue when playback rate is zero
// this is a hash for the sole purpose of mapping non-camel-cased event names
// to camel-cased function names
var TECH_EVENTS_QUEUE={canplay:'CanPlay',canplaythrough:'CanPlayThrough',playing:'Playing',seeked:'Seeked'};var BREAKPOINT_ORDER=['tiny','xsmall','small','medium','large','xlarge','huge'];var BREAKPOINT_CLASSES={};// grep: vjs-layout-tiny
// grep: vjs-layout-x-small
// grep: vjs-layout-small
// grep: vjs-layout-medium
// grep: vjs-layout-large
// grep: vjs-layout-x-large
// grep: vjs-layout-huge
BREAKPOINT_ORDER.forEach(function(k){var v=k.charAt(0)==='x'?'x-'+k.substring(1):k;BREAKPOINT_CLASSES[k]='vjs-layout-'+v;});var DEFAULT_BREAKPOINTS={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:Infinity};/**
 * An instance of the `Player` class is created when any of the Video.js setup methods
 * are used to initialize a video.
 *
 * After an instance has been created it can be accessed globally in two ways:
 * 1. By calling `videojs('example_video_1');`
 * 2. By using it directly via  `videojs.players.example_video_1;`
 *
 * @extends Component
 */var Player=function(_Component){inherits$1(Player,_Component);/**
   * Create an instance of this class.
   *
   * @param {Element} tag
   *        The original video DOM element used for configuring options.
   *
   * @param {Object} [options]
   *        Object of option names and values.
   *
   * @param {Component~ReadyCallback} [ready]
   *        Ready callback function.
   */function Player(tag,options,ready){classCallCheck(this,Player);// Make sure tag ID exists
tag.id=tag.id||options.id||'vjs_video_'+newGUID();// Set Options
// The options argument overrides options set in the video tag
// which overrides globally set options.
// This latter part coincides with the load order
// (tag must exist before Player)
options=assign$1(Player.getTagSettings(tag),options);// Delay the initialization of children because we need to set up
// player properties first, and can't use `this` before `super()`
options.initChildren=false;// Same with creating the element
options.createEl=false;// don't auto mixin the evented mixin
options.evented=false;// we don't want the player to report touch activity on itself
// see enableTouchActivity in Component
options.reportTouchActivity=false;// If language is not set, get the closest lang attribute
if(!options.language){if(typeof tag.closest==='function'){var closest=tag.closest('[lang]');if(closest&&closest.getAttribute){options.language=closest.getAttribute('lang');}}else {var element=tag;while(element&&element.nodeType===1){if(getAttributes(element).hasOwnProperty('lang')){options.language=element.getAttribute('lang');break;}element=element.parentNode;}}}// Run base component initializing with new options
// create logger
var _this=possibleConstructorReturn(this,_Component.call(this,null,options,ready));_this.log=createLogger(_this.id_);// Tracks when a tech changes the poster
_this.isPosterFromTech_=false;// Holds callback info that gets queued when playback rate is zero
// and a seek is happening
_this.queuedCallbacks_=[];// Turn off API access because we're loading a new tech that might load asynchronously
_this.isReady_=false;// Init state hasStarted_
_this.hasStarted_=false;// Init state userActive_
_this.userActive_=false;// if the global option object was accidentally blown away by
// someone, bail early with an informative error
if(!_this.options_||!_this.options_.techOrder||!_this.options_.techOrder.length){throw new Error('No techOrder specified. Did you overwrite '+'videojs.options instead of just changing the '+'properties you want to override?');}// Store the original tag used to set options
_this.tag=tag;// Store the tag attributes used to restore html5 element
_this.tagAttributes=tag&&getAttributes(tag);// Update current language
_this.language(_this.options_.language);// Update Supported Languages
if(options.languages){// Normalise player option languages to lowercase
var languagesToLower={};Object.getOwnPropertyNames(options.languages).forEach(function(name$$1){languagesToLower[name$$1.toLowerCase()]=options.languages[name$$1];});_this.languages_=languagesToLower;}else {_this.languages_=Player.prototype.options_.languages;}// Cache for video property values.
_this.cache_={};// Set poster
_this.poster_=options.poster||'';// Set controls
_this.controls_=!!options.controls;// Set default values for lastVolume
_this.cache_.lastVolume=1;// Original tag settings stored in options
// now remove immediately so native controls don't flash.
// May be turned back on by HTML5 tech if nativeControlsForTouch is true
tag.controls=false;tag.removeAttribute('controls');// the attribute overrides the option
if(tag.hasAttribute('autoplay')){_this.options_.autoplay=true;}else {// otherwise use the setter to validate and
// set the correct value.
_this.autoplay(_this.options_.autoplay);}/*
     * Store the internal state of scrubbing
     *
     * @private
     * @return {Boolean} True if the user is scrubbing
     */_this.scrubbing_=false;_this.el_=_this.createEl();// Set default value for lastPlaybackRate
_this.cache_.lastPlaybackRate=_this.defaultPlaybackRate();// Make this an evented object and use `el_` as its event bus.
evented(_this,{eventBusKey:'el_'});// We also want to pass the original player options to each component and plugin
// as well so they don't need to reach back into the player for options later.
// We also need to do another copy of this.options_ so we don't end up with
// an infinite loop.
var playerOptionsCopy=mergeOptions(_this.options_);// Load plugins
if(options.plugins){var plugins=options.plugins;Object.keys(plugins).forEach(function(name$$1){if(typeof this[name$$1]==='function'){this[name$$1](plugins[name$$1]);}else {throw new Error('plugin "'+name$$1+'" does not exist');}},_this);}_this.options_.playerOptions=playerOptionsCopy;_this.middleware_=[];_this.initChildren();// Set isAudio based on whether or not an audio tag was used
_this.isAudio(tag.nodeName.toLowerCase()==='audio');// Update controls className. Can't do this when the controls are initially
// set because the element doesn't exist yet.
if(_this.controls()){_this.addClass('vjs-controls-enabled');}else {_this.addClass('vjs-controls-disabled');}// Set ARIA label and region role depending on player type
_this.el_.setAttribute('role','region');if(_this.isAudio()){_this.el_.setAttribute('aria-label',_this.localize('Audio Player'));}else {_this.el_.setAttribute('aria-label',_this.localize('Video Player'));}if(_this.isAudio()){_this.addClass('vjs-audio');}if(_this.flexNotSupported_()){_this.addClass('vjs-no-flex');}// TODO: Make this smarter. Toggle user state between touching/mousing
// using events, since devices can have both touch and mouse events.
// if (browser.TOUCH_ENABLED) {
//   this.addClass('vjs-touch-enabled');
// }
// iOS Safari has broken hover handling
if(!IS_IOS){_this.addClass('vjs-workinghover');}// Make player easily findable by ID
Player.players[_this.id_]=_this;// Add a major version class to aid css in plugins
var majorVersion=version.split('.')[0];_this.addClass('vjs-v'+majorVersion);// When the player is first initialized, trigger activity so components
// like the control bar show themselves if needed
_this.userActive(true);_this.reportUserActivity();_this.one('play',_this.listenForUserActivity_);_this.on('fullscreenchange',_this.handleFullscreenChange_);_this.on('stageclick',_this.handleStageClick_);_this.breakpoints(_this.options_.breakpoints);_this.responsive(_this.options_.responsive);_this.changingSrc_=false;_this.playWaitingForReady_=false;_this.playOnLoadstart_=null;return _this;}/**
   * Destroys the video player and does any necessary cleanup.
   *
   * This is especially helpful if you are dynamically adding and removing videos
   * to/from the DOM.
   *
   * @fires Player#dispose
   */Player.prototype.dispose=function dispose(){/**
     * Called when the player is being disposed of.
     *
     * @event Player#dispose
     * @type {EventTarget~Event}
     */this.trigger('dispose');// prevent dispose from being called twice
this.off('dispose');if(this.styleEl_&&this.styleEl_.parentNode){this.styleEl_.parentNode.removeChild(this.styleEl_);this.styleEl_=null;}// Kill reference to this player
Player.players[this.id_]=null;if(this.tag&&this.tag.player){this.tag.player=null;}if(this.el_&&this.el_.player){this.el_.player=null;}if(this.tech_){this.tech_.dispose();this.isPosterFromTech_=false;this.poster_='';}if(this.playerElIngest_){this.playerElIngest_=null;}if(this.tag){this.tag=null;}clearCacheForPlayer(this);// the actual .el_ is removed here
_Component.prototype.dispose.call(this);};/**
   * Create the `Player`'s DOM element.
   *
   * @return {Element}
   *         The DOM element that gets created.
   */Player.prototype.createEl=function createEl$$1(){var tag=this.tag;var el=void 0;var playerElIngest=this.playerElIngest_=tag.parentNode&&tag.parentNode.hasAttribute&&tag.parentNode.hasAttribute('data-vjs-player');var divEmbed=this.tag.tagName.toLowerCase()==='video-js';if(playerElIngest){el=this.el_=tag.parentNode;}else if(!divEmbed){el=this.el_=_Component.prototype.createEl.call(this,'div');}// Copy over all the attributes from the tag, including ID and class
// ID will now reference player box, not the video tag
var attrs=getAttributes(tag);if(divEmbed){el=this.el_=tag;tag=this.tag=document$1.createElement('video');while(el.children.length){tag.appendChild(el.firstChild);}if(!hasClass(el,'video-js')){addClass(el,'video-js');}el.appendChild(tag);playerElIngest=this.playerElIngest_=el;// copy over properties from the video-js element
// ie8 doesn't support Object.keys nor hasOwnProperty
// on dom elements so we have to specify properties individually
['autoplay','controls','crossOrigin','defaultMuted','defaultPlaybackRate','loop','muted','playbackRate','src','volume'].forEach(function(prop){if(typeof el[prop]!=='undefined'){tag[prop]=el[prop];}});}// set tabindex to -1 to remove the video element from the focus order
tag.setAttribute('tabindex','-1');attrs.tabindex='-1';// Workaround for #4583 (JAWS+IE doesn't announce BPB or play button)
// See https://github.com/FreedomScientific/VFO-standards-support/issues/78
// Note that we can't detect if JAWS is being used, but this ARIA attribute
//  doesn't change behavior of IE11 if JAWS is not being used
if(IE_VERSION){tag.setAttribute('role','application');attrs.role='application';}// Remove width/height attrs from tag so CSS can make it 100% width/height
tag.removeAttribute('width');tag.removeAttribute('height');if('width'in attrs){delete attrs.width;}if('height'in attrs){delete attrs.height;}Object.getOwnPropertyNames(attrs).forEach(function(attr){// workaround so we don't totally break IE7
// http://stackoverflow.com/questions/3653444/css-styles-not-applied-on-dynamic-elements-in-internet-explorer-7
if(attr==='class'){el.className+=' '+attrs[attr];if(divEmbed){tag.className+=' '+attrs[attr];}}else {el.setAttribute(attr,attrs[attr]);if(divEmbed){tag.setAttribute(attr,attrs[attr]);}}});// Update tag id/class for use as HTML5 playback tech
// Might think we should do this after embedding in container so .vjs-tech class
// doesn't flash 100% width/height, but class only applies with .video-js parent
tag.playerId=tag.id;tag.id+='_html5_api';tag.className='vjs-tech';// Make player findable on elements
tag.player=el.player=this;// Default state of video is paused
this.addClass('vjs-paused');// Add a style element in the player that we'll use to set the width/height
// of the player in a way that's still overrideable by CSS, just like the
// video element
if(window$1.VIDEOJS_NO_DYNAMIC_STYLE!==true){this.styleEl_=createStyleElement('vjs-styles-dimensions');var defaultsStyleEl=$$1('.vjs-styles-defaults');var head=$$1('head');head.insertBefore(this.styleEl_,defaultsStyleEl?defaultsStyleEl.nextSibling:head.firstChild);}this.fill_=false;this.fluid_=false;// Pass in the width/height/aspectRatio options which will update the style el
this.width(this.options_.width);this.height(this.options_.height);this.fill(this.options_.fill);this.fluid(this.options_.fluid);this.aspectRatio(this.options_.aspectRatio);// Hide any links within the video/audio tag, because IE doesn't hide them completely.
var links=tag.getElementsByTagName('a');for(var i=0;i<links.length;i++){var linkEl=links.item(i);addClass(linkEl,'vjs-hidden');linkEl.setAttribute('hidden','hidden');}// insertElFirst seems to cause the networkState to flicker from 3 to 2, so
// keep track of the original for later so we can know if the source originally failed
tag.initNetworkState_=tag.networkState;// Wrap video tag in div (el/box) container
if(tag.parentNode&&!playerElIngest){tag.parentNode.insertBefore(el,tag);}// insert the tag as the first child of the player element
// then manually add it to the children array so that this.addChild
// will work properly for other components
//
// Breaks iPhone, fixed in HTML5 setup.
prependTo(tag,el);this.children_.unshift(tag);// Set lang attr on player to ensure CSS :lang() in consistent with player
// if it's been set to something different to the doc
this.el_.setAttribute('lang',this.language_);this.el_=el;return el;};/**
   * A getter/setter for the `Player`'s width. Returns the player's configured value.
   * To get the current width use `currentWidth()`.
   *
   * @param {number} [value]
   *        The value to set the `Player`'s width to.
   *
   * @return {number}
   *         The current width of the `Player` when getting.
   */Player.prototype.width=function width(value){return this.dimension('width',value);};/**
   * A getter/setter for the `Player`'s height. Returns the player's configured value.
   * To get the current height use `currentheight()`.
   *
   * @param {number} [value]
   *        The value to set the `Player`'s heigth to.
   *
   * @return {number}
   *         The current height of the `Player` when getting.
   */Player.prototype.height=function height(value){return this.dimension('height',value);};/**
   * A getter/setter for the `Player`'s width & height.
   *
   * @param {string} dimension
   *        This string can be:
   *        - 'width'
   *        - 'height'
   *
   * @param {number} [value]
   *        Value for dimension specified in the first argument.
   *
   * @return {number}
   *         The dimension arguments value when getting (width/height).
   */Player.prototype.dimension=function dimension(_dimension,value){var privDimension=_dimension+'_';if(value===undefined){return this[privDimension]||0;}if(value===''){// If an empty string is given, reset the dimension to be automatic
this[privDimension]=undefined;this.updateStyleEl_();return;}var parsedVal=parseFloat(value);if(isNaN(parsedVal)){log$2.error('Improper value "'+value+'" supplied for for '+_dimension);return;}this[privDimension]=parsedVal;this.updateStyleEl_();};/**
   * A getter/setter/toggler for the vjs-fluid `className` on the `Player`.
   *
   * Turning this on will turn off fill mode.
   *
   * @param {boolean} [bool]
   *        - A value of true adds the class.
   *        - A value of false removes the class.
   *        - No value will be a getter.
   *
   * @return {boolean|undefined}
   *         - The value of fluid when getting.
   *         - `undefined` when setting.
   */Player.prototype.fluid=function fluid(bool){if(bool===undefined){return !!this.fluid_;}this.fluid_=!!bool;if(bool){this.addClass('vjs-fluid');this.fill(false);}else {this.removeClass('vjs-fluid');}this.updateStyleEl_();};/**
   * A getter/setter/toggler for the vjs-fill `className` on the `Player`.
   *
   * Turning this on will turn off fluid mode.
   *
   * @param {boolean} [bool]
   *        - A value of true adds the class.
   *        - A value of false removes the class.
   *        - No value will be a getter.
   *
   * @return {boolean|undefined}
   *         - The value of fluid when getting.
   *         - `undefined` when setting.
   */Player.prototype.fill=function fill(bool){if(bool===undefined){return !!this.fill_;}this.fill_=!!bool;if(bool){this.addClass('vjs-fill');this.fluid(false);}else {this.removeClass('vjs-fill');}};/**
   * Get/Set the aspect ratio
   *
   * @param {string} [ratio]
   *        Aspect ratio for player
   *
   * @return {string|undefined}
   *         returns the current aspect ratio when getting
   *//**
   * A getter/setter for the `Player`'s aspect ratio.
   *
   * @param {string} [ratio]
   *        The value to set the `Player's aspect ratio to.
   *
   * @return {string|undefined}
   *         - The current aspect ratio of the `Player` when getting.
   *         - undefined when setting
   */Player.prototype.aspectRatio=function aspectRatio(ratio){if(ratio===undefined){return this.aspectRatio_;}// Check for width:height format
if(!/^\d+\:\d+$/.test(ratio)){throw new Error('Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.');}this.aspectRatio_=ratio;// We're assuming if you set an aspect ratio you want fluid mode,
// because in fixed mode you could calculate width and height yourself.
this.fluid(true);this.updateStyleEl_();};/**
   * Update styles of the `Player` element (height, width and aspect ratio).
   *
   * @private
   * @listens Tech#loadedmetadata
   */Player.prototype.updateStyleEl_=function updateStyleEl_(){if(window$1.VIDEOJS_NO_DYNAMIC_STYLE===true){var _width=typeof this.width_==='number'?this.width_:this.options_.width;var _height=typeof this.height_==='number'?this.height_:this.options_.height;var techEl=this.tech_&&this.tech_.el();if(techEl){if(_width>=0){techEl.width=_width;}if(_height>=0){techEl.height=_height;}}return;}var width=void 0;var height=void 0;var aspectRatio=void 0;var idClass=void 0;// The aspect ratio is either used directly or to calculate width and height.
if(this.aspectRatio_!==undefined&&this.aspectRatio_!=='auto'){// Use any aspectRatio that's been specifically set
aspectRatio=this.aspectRatio_;}else if(this.videoWidth()>0){// Otherwise try to get the aspect ratio from the video metadata
aspectRatio=this.videoWidth()+':'+this.videoHeight();}else {// Or use a default. The video element's is 2:1, but 16:9 is more common.
aspectRatio='16:9';}// Get the ratio as a decimal we can use to calculate dimensions
var ratioParts=aspectRatio.split(':');var ratioMultiplier=ratioParts[1]/ratioParts[0];if(this.width_!==undefined){// Use any width that's been specifically set
width=this.width_;}else if(this.height_!==undefined){// Or calulate the width from the aspect ratio if a height has been set
width=this.height_/ratioMultiplier;}else {// Or use the video's metadata, or use the video el's default of 300
width=this.videoWidth()||300;}if(this.height_!==undefined){// Use any height that's been specifically set
height=this.height_;}else {// Otherwise calculate the height from the ratio and the width
height=width*ratioMultiplier;}// Ensure the CSS class is valid by starting with an alpha character
if(/^[^a-zA-Z]/.test(this.id())){idClass='dimensions-'+this.id();}else {idClass=this.id()+'-dimensions';}// Ensure the right class is still on the player for the style element
this.addClass(idClass);setTextContent$1(this.styleEl_,'\n      .'+idClass+' {\n        width: '+width+'px;\n        height: '+height+'px;\n      }\n\n      .'+idClass+'.vjs-fluid {\n        padding-top: '+ratioMultiplier*100+'%;\n      }\n    ');};/**
   * Load/Create an instance of playback {@link Tech} including element
   * and API methods. Then append the `Tech` element in `Player` as a child.
   *
   * @param {string} techName
   *        name of the playback technology
   *
   * @param {string} source
   *        video source
   *
   * @private
   */Player.prototype.loadTech_=function loadTech_(techName,source){var _this2=this;// Pause and remove current playback technology
if(this.tech_){this.unloadTech_();}var titleTechName=toTitleCase(techName);var camelTechName=techName.charAt(0).toLowerCase()+techName.slice(1);// get rid of the HTML5 video tag as soon as we are using another tech
if(titleTechName!=='Html5'&&this.tag){Tech.getTech('Html5').disposeMediaElement(this.tag);this.tag.player=null;this.tag=null;}this.techName_=titleTechName;// Turn off API access because we're loading a new tech that might load asynchronously
this.isReady_=false;// if autoplay is a string we pass false to the tech
// because the player is going to handle autoplay on `loadstart`
var autoplay=typeof this.autoplay()==='string'?false:this.autoplay();// Grab tech-specific options from player options and add source and parent element to use.
var techOptions={source:source,autoplay:autoplay,'nativeControlsForTouch':this.options_.nativeControlsForTouch,'playerId':this.id(),'techId':this.id()+'_'+camelTechName+'_api','playsinline':this.options_.playsinline,'preload':this.options_.preload,'loop':this.options_.loop,'muted':this.options_.muted,'poster':this.poster(),'language':this.language(),'playerElIngest':this.playerElIngest_||false,'vtt.js':this.options_['vtt.js'],'canOverridePoster':!!this.options_.techCanOverridePoster,'enableSourceset':this.options_.enableSourceset};ALL.names.forEach(function(name$$1){var props=ALL[name$$1];techOptions[props.getterName]=_this2[props.privateName];});assign$1(techOptions,this.options_[titleTechName]);assign$1(techOptions,this.options_[camelTechName]);assign$1(techOptions,this.options_[techName.toLowerCase()]);if(this.tag){techOptions.tag=this.tag;}if(source&&source.src===this.cache_.src&&this.cache_.currentTime>0){techOptions.startTime=this.cache_.currentTime;}// Initialize tech instance
var TechClass=Tech.getTech(techName);if(!TechClass){throw new Error('No Tech named \''+titleTechName+'\' exists! \''+titleTechName+'\' should be registered using videojs.registerTech()\'');}this.tech_=new TechClass(techOptions);// player.triggerReady is always async, so don't need this to be async
this.tech_.ready(bind$2(this,this.handleTechReady_),true);textTrackConverter.jsonToTextTracks(this.textTracksJson_||[],this.tech_);// Listen to all HTML5-defined events and trigger them on the player
TECH_EVENTS_RETRIGGER.forEach(function(event){_this2.on(_this2.tech_,event,_this2['handleTech'+toTitleCase(event)+'_']);});Object.keys(TECH_EVENTS_QUEUE).forEach(function(event){_this2.on(_this2.tech_,event,function(eventObj){if(_this2.tech_.playbackRate()===0&&_this2.tech_.seeking()){_this2.queuedCallbacks_.push({callback:_this2['handleTech'+TECH_EVENTS_QUEUE[event]+'_'].bind(_this2),event:eventObj});return;}_this2['handleTech'+TECH_EVENTS_QUEUE[event]+'_'](eventObj);});});this.on(this.tech_,'loadstart',this.handleTechLoadStart_);this.on(this.tech_,'sourceset',this.handleTechSourceset_);this.on(this.tech_,'waiting',this.handleTechWaiting_);this.on(this.tech_,'ended',this.handleTechEnded_);this.on(this.tech_,'seeking',this.handleTechSeeking_);this.on(this.tech_,'play',this.handleTechPlay_);this.on(this.tech_,'firstplay',this.handleTechFirstPlay_);this.on(this.tech_,'pause',this.handleTechPause_);this.on(this.tech_,'durationchange',this.handleTechDurationChange_);this.on(this.tech_,'fullscreenchange',this.handleTechFullscreenChange_);this.on(this.tech_,'error',this.handleTechError_);this.on(this.tech_,'loadedmetadata',this.updateStyleEl_);this.on(this.tech_,'posterchange',this.handleTechPosterChange_);this.on(this.tech_,'textdata',this.handleTechTextData_);this.on(this.tech_,'ratechange',this.handleTechRateChange_);this.usingNativeControls(this.techGet_('controls'));if(this.controls()&&!this.usingNativeControls()){this.addTechControlsListeners_();}// Add the tech element in the DOM if it was not already there
// Make sure to not insert the original video element if using Html5
if(this.tech_.el().parentNode!==this.el()&&(titleTechName!=='Html5'||!this.tag)){prependTo(this.tech_.el(),this.el());}// Get rid of the original video tag reference after the first tech is loaded
if(this.tag){this.tag.player=null;this.tag=null;}};/**
   * Unload and dispose of the current playback {@link Tech}.
   *
   * @private
   */Player.prototype.unloadTech_=function unloadTech_(){var _this3=this;// Save the current text tracks so that we can reuse the same text tracks with the next tech
ALL.names.forEach(function(name$$1){var props=ALL[name$$1];_this3[props.privateName]=_this3[props.getterName]();});this.textTracksJson_=textTrackConverter.textTracksToJson(this.tech_);this.isReady_=false;this.tech_.dispose();this.tech_=false;if(this.isPosterFromTech_){this.poster_='';this.trigger('posterchange');}this.isPosterFromTech_=false;};/**
   * Return a reference to the current {@link Tech}.
   * It will print a warning by default about the danger of using the tech directly
   * but any argument that is passed in will silence the warning.
   *
   * @param {*} [safety]
   *        Anything passed in to silence the warning
   *
   * @return {Tech}
   *         The Tech
   */Player.prototype.tech=function tech(safety){if(safety===undefined){log$2.warn(tsml(_templateObject$1));}return this.tech_;};/**
   * Set up click and touch listeners for the playback element
   *
   * - On desktops: a click on the video itself will toggle playback
   * - On mobile devices: a click on the video toggles controls
   *   which is done by toggling the user state between active and
   *   inactive
   * - A tap can signal that a user has become active or has become inactive
   *   e.g. a quick tap on an iPhone movie should reveal the controls. Another
   *   quick tap should hide them again (signaling the user is in an inactive
   *   viewing state)
   * - In addition to this, we still want the user to be considered inactive after
   *   a few seconds of inactivity.
   *
   * > Note: the only part of iOS interaction we can't mimic with this setup
   * is a touch and hold on the video element counting as activity in order to
   * keep the controls showing, but that shouldn't be an issue. A touch and hold
   * on any controls will still keep the user active
   *
   * @private
   */Player.prototype.addTechControlsListeners_=function addTechControlsListeners_(){// Make sure to remove all the previous listeners in case we are called multiple times.
this.removeTechControlsListeners_();// Some browsers (Chrome & IE) don't trigger a click on a flash swf, but do
// trigger mousedown/up.
// http://stackoverflow.com/questions/1444562/javascript-onclick-event-over-flash-object
// Any touch events are set to block the mousedown event from happening
this.on(this.tech_,'mousedown',this.handleTechClick_);// If the controls were hidden we don't want that to change without a tap event
// so we'll check if the controls were already showing before reporting user
// activity
this.on(this.tech_,'touchstart',this.handleTechTouchStart_);this.on(this.tech_,'touchmove',this.handleTechTouchMove_);this.on(this.tech_,'touchend',this.handleTechTouchEnd_);// The tap listener needs to come after the touchend listener because the tap
// listener cancels out any reportedUserActivity when setting userActive(false)
this.on(this.tech_,'tap',this.handleTechTap_);};/**
   * Remove the listeners used for click and tap controls. This is needed for
   * toggling to controls disabled, where a tap/touch should do nothing.
   *
   * @private
   */Player.prototype.removeTechControlsListeners_=function removeTechControlsListeners_(){// We don't want to just use `this.off()` because there might be other needed
// listeners added by techs that extend this.
this.off(this.tech_,'tap',this.handleTechTap_);this.off(this.tech_,'touchstart',this.handleTechTouchStart_);this.off(this.tech_,'touchmove',this.handleTechTouchMove_);this.off(this.tech_,'touchend',this.handleTechTouchEnd_);this.off(this.tech_,'mousedown',this.handleTechClick_);};/**
   * Player waits for the tech to be ready
   *
   * @private
   */Player.prototype.handleTechReady_=function handleTechReady_(){this.triggerReady();// Keep the same volume as before
if(this.cache_.volume){this.techCall_('setVolume',this.cache_.volume);}// Look if the tech found a higher resolution poster while loading
this.handleTechPosterChange_();// Update the duration if available
this.handleTechDurationChange_();// Chrome and Safari both have issues with autoplay.
// In Safari (5.1.1), when we move the video element into the container div, autoplay doesn't work.
// In Chrome (15), if you have autoplay + a poster + no controls, the video gets hidden (but audio plays)
// This fixes both issues. Need to wait for API, so it updates displays correctly
if((this.src()||this.currentSrc())&&this.tag&&this.options_.autoplay&&this.paused()){try{// Chrome Fix. Fixed in Chrome v16.
delete this.tag.poster;}catch(e){log$2('deleting tag.poster throws in some browsers',e);}}};/**
   * Retrigger the `loadstart` event that was triggered by the {@link Tech}. This
   * function will also trigger {@link Player#firstplay} if it is the first loadstart
   * for a video.
   *
   * @fires Player#loadstart
   * @fires Player#firstplay
   * @listens Tech#loadstart
   * @private
   */Player.prototype.handleTechLoadStart_=function handleTechLoadStart_(){// TODO: Update to use `emptied` event instead. See #1277.
this.removeClass('vjs-ended');this.removeClass('vjs-seeking');// reset the error state
this.error(null);// If it's already playing we want to trigger a firstplay event now.
// The firstplay event relies on both the play and loadstart events
// which can happen in any order for a new source
if(!this.paused()){/**
       * Fired when the user agent begins looking for media data
       *
       * @event Player#loadstart
       * @type {EventTarget~Event}
       */this.trigger('loadstart');this.trigger('firstplay');}else {// reset the hasStarted state
this.hasStarted(false);this.trigger('loadstart');}// autoplay happens after loadstart for the browser,
// so we mimic that behavior
this.manualAutoplay_(this.autoplay());};/**
   * Handle autoplay string values, rather than the typical boolean
   * values that should be handled by the tech. Note that this is not
   * part of any specification. Valid values and what they do can be
   * found on the autoplay getter at Player#autoplay()
   */Player.prototype.manualAutoplay_=function manualAutoplay_(type){var _this4=this;if(!this.tech_||typeof type!=='string'){return;}var muted=function muted(){var previouslyMuted=_this4.muted();_this4.muted(true);var playPromise=_this4.play();if(!playPromise||!playPromise.then||!playPromise['catch']){return;}return playPromise['catch'](function(e){// restore old value of muted on failure
_this4.muted(previouslyMuted);});};var promise=void 0;if(type==='any'){promise=this.play();if(promise&&promise.then&&promise['catch']){promise['catch'](function(){return muted();});}}else if(type==='muted'){promise=muted();}else {promise=this.play();}if(!promise||!promise.then||!promise['catch']){return;}return promise.then(function(){_this4.trigger({type:'autoplay-success',autoplay:type});})['catch'](function(e){_this4.trigger({type:'autoplay-failure',autoplay:type});});};/**
   * Update the internal source caches so that we return the correct source from
   * `src()`, `currentSource()`, and `currentSources()`.
   *
   * > Note: `currentSources` will not be updated if the source that is passed in exists
   *         in the current `currentSources` cache.
   *
   *
   * @param {Tech~SourceObject} srcObj
   *        A string or object source to update our caches to.
   */Player.prototype.updateSourceCaches_=function updateSourceCaches_(){var srcObj=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'';var src=srcObj;var type='';if(typeof src!=='string'){src=srcObj.src;type=srcObj.type;}// make sure all the caches are set to default values
// to prevent null checking
this.cache_.source=this.cache_.source||{};this.cache_.sources=this.cache_.sources||[];// try to get the type of the src that was passed in
if(src&&!type){type=findMimetype(this,src);}// update `currentSource` cache always
this.cache_.source=mergeOptions({},srcObj,{src:src,type:type});var matchingSources=this.cache_.sources.filter(function(s){return s.src&&s.src===src;});var sourceElSources=[];var sourceEls=this.$$('source');var matchingSourceEls=[];for(var i=0;i<sourceEls.length;i++){var sourceObj=getAttributes(sourceEls[i]);sourceElSources.push(sourceObj);if(sourceObj.src&&sourceObj.src===src){matchingSourceEls.push(sourceObj.src);}}// if we have matching source els but not matching sources
// the current source cache is not up to date
if(matchingSourceEls.length&&!matchingSources.length){this.cache_.sources=sourceElSources;// if we don't have matching source or source els set the
// sources cache to the `currentSource` cache
}else if(!matchingSources.length){this.cache_.sources=[this.cache_.source];}// update the tech `src` cache
this.cache_.src=src;};/**
   * *EXPERIMENTAL* Fired when the source is set or changed on the {@link Tech}
   * causing the media element to reload.
   *
   * It will fire for the initial source and each subsequent source.
   * This event is a custom event from Video.js and is triggered by the {@link Tech}.
   *
   * The event object for this event contains a `src` property that will contain the source
   * that was available when the event was triggered. This is generally only necessary if Video.js
   * is switching techs while the source was being changed.
   *
   * It is also fired when `load` is called on the player (or media element)
   * because the {@link https://html.spec.whatwg.org/multipage/media.html#dom-media-load|specification for `load`}
   * says that the resource selection algorithm needs to be aborted and restarted.
   * In this case, it is very likely that the `src` property will be set to the
   * empty string `""` to indicate we do not know what the source will be but
   * that it is changing.
   *
   * *This event is currently still experimental and may change in minor releases.*
   * __To use this, pass `enableSourceset` option to the player.__
   *
   * @event Player#sourceset
   * @type {EventTarget~Event}
   * @prop {string} src
   *                The source url available when the `sourceset` was triggered.
   *                It will be an empty string if we cannot know what the source is
   *                but know that the source will change.
   *//**
   * Retrigger the `sourceset` event that was triggered by the {@link Tech}.
   *
   * @fires Player#sourceset
   * @listens Tech#sourceset
   * @private
   */Player.prototype.handleTechSourceset_=function handleTechSourceset_(event){var _this5=this;// only update the source cache when the source
// was not updated using the player api
if(!this.changingSrc_){var updateSourceCaches=function updateSourceCaches(src){return _this5.updateSourceCaches_(src);};var playerSrc=this.currentSource().src;var eventSrc=event.src;// if we have a playerSrc that is not a blob, and a tech src that is a blob
if(playerSrc&&!/^blob:/.test(playerSrc)&&/^blob:/.test(eventSrc)){// if both the tech source and the player source were updated we assume
// something like @videojs/http-streaming did the sourceset and skip updating the source cache.
if(!this.lastSource_||this.lastSource_.tech!==eventSrc&&this.lastSource_.player!==playerSrc){updateSourceCaches=function updateSourceCaches(){};}}// update the source to the intial source right away
// in some cases this will be empty string
updateSourceCaches(eventSrc);// if the `sourceset` `src` was an empty string
// wait for a `loadstart` to update the cache to `currentSrc`.
// If a sourceset happens before a `loadstart`, we reset the state
// as this function will be called again.
if(!event.src){var updateCache=function updateCache(e){if(e.type!=='sourceset'){var techSrc=_this5.techGet('currentSrc');_this5.lastSource_.tech=techSrc;_this5.updateSourceCaches_(techSrc);}_this5.tech_.off(['sourceset','loadstart'],updateCache);};this.tech_.one(['sourceset','loadstart'],updateCache);}}this.lastSource_={player:this.currentSource().src,tech:event.src};this.trigger({src:event.src,type:'sourceset'});};/**
   * Add/remove the vjs-has-started class
   *
   * @fires Player#firstplay
   *
   * @param {boolean} request
   *        - true: adds the class
   *        - false: remove the class
   *
   * @return {boolean}
   *         the boolean value of hasStarted_
   */Player.prototype.hasStarted=function hasStarted(request){if(request===undefined){// act as getter, if we have no request to change
return this.hasStarted_;}if(request===this.hasStarted_){return;}this.hasStarted_=request;if(this.hasStarted_){this.addClass('vjs-has-started');this.trigger('firstplay');}else {this.removeClass('vjs-has-started');}};/**
   * Fired whenever the media begins or resumes playback
   *
   * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-play}
   * @fires Player#play
   * @listens Tech#play
   * @private
   */Player.prototype.handleTechPlay_=function handleTechPlay_(){this.removeClass('vjs-ended');this.removeClass('vjs-paused');this.addClass('vjs-playing');// hide the poster when the user hits play
this.hasStarted(true);/**
     * Triggered whenever an {@link Tech#play} event happens. Indicates that
     * playback has started or resumed.
     *
     * @event Player#play
     * @type {EventTarget~Event}
     */this.trigger('play');};/**
   * Retrigger the `ratechange` event that was triggered by the {@link Tech}.
   *
   * If there were any events queued while the playback rate was zero, fire
   * those events now.
   *
   * @private
   * @method Player#handleTechRateChange_
   * @fires Player#ratechange
   * @listens Tech#ratechange
   */Player.prototype.handleTechRateChange_=function handleTechRateChange_(){if(this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0){this.queuedCallbacks_.forEach(function(queued){return queued.callback(queued.event);});this.queuedCallbacks_=[];}this.cache_.lastPlaybackRate=this.tech_.playbackRate();/**
     * Fires when the playing speed of the audio/video is changed
     *
     * @event Player#ratechange
     * @type {event}
     */this.trigger('ratechange');};/**
   * Retrigger the `waiting` event that was triggered by the {@link Tech}.
   *
   * @fires Player#waiting
   * @listens Tech#waiting
   * @private
   */Player.prototype.handleTechWaiting_=function handleTechWaiting_(){var _this6=this;this.addClass('vjs-waiting');/**
     * A readyState change on the DOM element has caused playback to stop.
     *
     * @event Player#waiting
     * @type {EventTarget~Event}
     */this.trigger('waiting');this.one('timeupdate',function(){return _this6.removeClass('vjs-waiting');});};/**
   * Retrigger the `canplay` event that was triggered by the {@link Tech}.
   * > Note: This is not consistent between browsers. See #1351
   *
   * @fires Player#canplay
   * @listens Tech#canplay
   * @private
   */Player.prototype.handleTechCanPlay_=function handleTechCanPlay_(){this.removeClass('vjs-waiting');/**
     * The media has a readyState of HAVE_FUTURE_DATA or greater.
     *
     * @event Player#canplay
     * @type {EventTarget~Event}
     */this.trigger('canplay');};/**
   * Retrigger the `canplaythrough` event that was triggered by the {@link Tech}.
   *
   * @fires Player#canplaythrough
   * @listens Tech#canplaythrough
   * @private
   */Player.prototype.handleTechCanPlayThrough_=function handleTechCanPlayThrough_(){this.removeClass('vjs-waiting');/**
     * The media has a readyState of HAVE_ENOUGH_DATA or greater. This means that the
     * entire media file can be played without buffering.
     *
     * @event Player#canplaythrough
     * @type {EventTarget~Event}
     */this.trigger('canplaythrough');};/**
   * Retrigger the `playing` event that was triggered by the {@link Tech}.
   *
   * @fires Player#playing
   * @listens Tech#playing
   * @private
   */Player.prototype.handleTechPlaying_=function handleTechPlaying_(){this.removeClass('vjs-waiting');/**
     * The media is no longer blocked from playback, and has started playing.
     *
     * @event Player#playing
     * @type {EventTarget~Event}
     */this.trigger('playing');};/**
   * Retrigger the `seeking` event that was triggered by the {@link Tech}.
   *
   * @fires Player#seeking
   * @listens Tech#seeking
   * @private
   */Player.prototype.handleTechSeeking_=function handleTechSeeking_(){this.addClass('vjs-seeking');/**
     * Fired whenever the player is jumping to a new time
     *
     * @event Player#seeking
     * @type {EventTarget~Event}
     */this.trigger('seeking');};/**
   * Retrigger the `seeked` event that was triggered by the {@link Tech}.
   *
   * @fires Player#seeked
   * @listens Tech#seeked
   * @private
   */Player.prototype.handleTechSeeked_=function handleTechSeeked_(){this.removeClass('vjs-seeking');/**
     * Fired when the player has finished jumping to a new time
     *
     * @event Player#seeked
     * @type {EventTarget~Event}
     */this.trigger('seeked');};/**
   * Retrigger the `firstplay` event that was triggered by the {@link Tech}.
   *
   * @fires Player#firstplay
   * @listens Tech#firstplay
   * @deprecated As of 6.0 firstplay event is deprecated.
   *             As of 6.0 passing the `starttime` option to the player and the firstplay event are deprecated.
   * @private
   */Player.prototype.handleTechFirstPlay_=function handleTechFirstPlay_(){// If the first starttime attribute is specified
// then we will start at the given offset in seconds
if(this.options_.starttime){log$2.warn('Passing the `starttime` option to the player will be deprecated in 6.0');this.currentTime(this.options_.starttime);}this.addClass('vjs-has-started');/**
     * Fired the first time a video is played. Not part of the HLS spec, and this is
     * probably not the best implementation yet, so use sparingly. If you don't have a
     * reason to prevent playback, use `myPlayer.one('play');` instead.
     *
     * @event Player#firstplay
     * @deprecated As of 6.0 firstplay event is deprecated.
     * @type {EventTarget~Event}
     */this.trigger('firstplay');};/**
   * Retrigger the `pause` event that was triggered by the {@link Tech}.
   *
   * @fires Player#pause
   * @listens Tech#pause
   * @private
   */Player.prototype.handleTechPause_=function handleTechPause_(){this.removeClass('vjs-playing');this.addClass('vjs-paused');/**
     * Fired whenever the media has been paused
     *
     * @event Player#pause
     * @type {EventTarget~Event}
     */this.trigger('pause');};/**
   * Retrigger the `ended` event that was triggered by the {@link Tech}.
   *
   * @fires Player#ended
   * @listens Tech#ended
   * @private
   */Player.prototype.handleTechEnded_=function handleTechEnded_(){this.addClass('vjs-ended');if(this.options_.loop){this.currentTime(0);this.play();}else if(!this.paused()){this.pause();}/**
     * Fired when the end of the media resource is reached (currentTime == duration)
     *
     * @event Player#ended
     * @type {EventTarget~Event}
     */this.trigger('ended');};/**
   * Fired when the duration of the media resource is first known or changed
   *
   * @listens Tech#durationchange
   * @private
   */Player.prototype.handleTechDurationChange_=function handleTechDurationChange_(){this.duration(this.techGet_('duration'));};/**
   * Handle a click on the media element to play/pause
   *
   * @param {EventTarget~Event} event
   *        the event that caused this function to trigger
   *
   * @listens Tech#mousedown
   * @private
   */Player.prototype.handleTechClick_=function handleTechClick_(event){if(!isSingleLeftClick(event)){return;}// When controls are disabled a click should not toggle playback because
// the click is considered a control
if(!this.controls_){return;}if(this.paused()){silencePromise(this.play());}else {this.pause();}};/**
   * Handle a tap on the media element. It will toggle the user
   * activity state, which hides and shows the controls.
   *
   * @listens Tech#tap
   * @private
   */Player.prototype.handleTechTap_=function handleTechTap_(){this.userActive(!this.userActive());};/**
   * Handle touch to start
   *
   * @listens Tech#touchstart
   * @private
   */Player.prototype.handleTechTouchStart_=function handleTechTouchStart_(){this.userWasActive=this.userActive();};/**
   * Handle touch to move
   *
   * @listens Tech#touchmove
   * @private
   */Player.prototype.handleTechTouchMove_=function handleTechTouchMove_(){if(this.userWasActive){this.reportUserActivity();}};/**
   * Handle touch to end
   *
   * @param {EventTarget~Event} event
   *        the touchend event that triggered
   *        this function
   *
   * @listens Tech#touchend
   * @private
   */Player.prototype.handleTechTouchEnd_=function handleTechTouchEnd_(event){// Stop the mouse events from also happening
event.preventDefault();};/**
   * Fired when the player switches in or out of fullscreen mode
   *
   * @private
   * @listens Player#fullscreenchange
   */Player.prototype.handleFullscreenChange_=function handleFullscreenChange_(){if(this.isFullscreen()){this.addClass('vjs-fullscreen');}else {this.removeClass('vjs-fullscreen');}};/**
   * native click events on the SWF aren't triggered on IE11, Win8.1RT
   * use stageclick events triggered from inside the SWF instead
   *
   * @private
   * @listens stageclick
   */Player.prototype.handleStageClick_=function handleStageClick_(){this.reportUserActivity();};/**
   * Handle Tech Fullscreen Change
   *
   * @param {EventTarget~Event} event
   *        the fullscreenchange event that triggered this function
   *
   * @param {Object} data
   *        the data that was sent with the event
   *
   * @private
   * @listens Tech#fullscreenchange
   * @fires Player#fullscreenchange
   */Player.prototype.handleTechFullscreenChange_=function handleTechFullscreenChange_(event,data){if(data){this.isFullscreen(data.isFullscreen);}/**
     * Fired when going in and out of fullscreen.
     *
     * @event Player#fullscreenchange
     * @type {EventTarget~Event}
     */this.trigger('fullscreenchange');};/**
   * Fires when an error occurred during the loading of an audio/video.
   *
   * @private
   * @listens Tech#error
   */Player.prototype.handleTechError_=function handleTechError_(){var error=this.tech_.error();this.error(error);};/**
   * Retrigger the `textdata` event that was triggered by the {@link Tech}.
   *
   * @fires Player#textdata
   * @listens Tech#textdata
   * @private
   */Player.prototype.handleTechTextData_=function handleTechTextData_(){var data=null;if(arguments.length>1){data=arguments[1];}/**
     * Fires when we get a textdata event from tech
     *
     * @event Player#textdata
     * @type {EventTarget~Event}
     */this.trigger('textdata',data);};/**
   * Get object for cached values.
   *
   * @return {Object}
   *         get the current object cache
   */Player.prototype.getCache=function getCache(){return this.cache_;};/**
   * Pass values to the playback tech
   *
   * @param {string} [method]
   *        the method to call
   *
   * @param {Object} arg
   *        the argument to pass
   *
   * @private
   */Player.prototype.techCall_=function techCall_(method,arg){// If it's not ready yet, call method when it is
this.ready(function(){if(method in allowedSetters){return set$1$1(this.middleware_,this.tech_,method,arg);}else if(method in allowedMediators){return mediate(this.middleware_,this.tech_,method,arg);}try{if(this.tech_){this.tech_[method](arg);}}catch(e){log$2(e);throw e;}},true);};/**
   * Get calls can't wait for the tech, and sometimes don't need to.
   *
   * @param {string} method
   *        Tech method
   *
   * @return {Function|undefined}
   *         the method or undefined
   *
   * @private
   */Player.prototype.techGet_=function techGet_(method){if(!this.tech_||!this.tech_.isReady_){return;}if(method in allowedGetters){return get$1(this.middleware_,this.tech_,method);}else if(method in allowedMediators){return mediate(this.middleware_,this.tech_,method);}// Flash likes to die and reload when you hide or reposition it.
// In these cases the object methods go away and we get errors.
// When that happens we'll catch the errors and inform tech that it's not ready any more.
try{return this.tech_[method]();}catch(e){// When building additional tech libs, an expected method may not be defined yet
if(this.tech_[method]===undefined){log$2('Video.js: '+method+' method not defined for '+this.techName_+' playback technology.',e);throw e;}// When a method isn't available on the object it throws a TypeError
if(e.name==='TypeError'){log$2('Video.js: '+method+' unavailable on '+this.techName_+' playback technology element.',e);this.tech_.isReady_=false;throw e;}// If error unknown, just log and throw
log$2(e);throw e;}};/**
   * Attempt to begin playback at the first opportunity.
   *
   * @return {Promise|undefined}
   *         Returns a promise if the browser supports Promises (or one
   *         was passed in as an option). This promise will be resolved on
   *         the return value of play. If this is undefined it will fulfill the
   *         promise chain otherwise the promise chain will be fulfilled when
   *         the promise from play is fulfilled.
   */Player.prototype.play=function play(){var _this7=this;var PromiseClass=this.options_.Promise||window$1.Promise;if(PromiseClass){return new PromiseClass(function(resolve){_this7.play_(resolve);});}return this.play_();};/**
   * The actual logic for play, takes a callback that will be resolved on the
   * return value of play. This allows us to resolve to the play promise if there
   * is one on modern browsers.
   *
   * @private
   * @param {Function} [callback]
   *        The callback that should be called when the techs play is actually called
   */Player.prototype.play_=function play_(){var _this8=this;var callback=arguments.length>0&&arguments[0]!==undefined?arguments[0]:silencePromise;// If this is called while we have a play queued up on a loadstart, remove
// that listener to avoid getting in a potentially bad state.
if(this.playOnLoadstart_){this.off('loadstart',this.playOnLoadstart_);}// If the player/tech is not ready, queue up another call to `play()` for
// when it is. This will loop back into this method for another attempt at
// playback when the tech is ready.
if(!this.isReady_){// Bail out if we're already waiting for `ready`!
if(this.playWaitingForReady_){return;}this.playWaitingForReady_=true;this.ready(function(){_this8.playWaitingForReady_=false;callback(_this8.play());});// If the player/tech is ready and we have a source, we can attempt playback.
}else if(!this.changingSrc_&&(this.src()||this.currentSrc())){callback(this.techGet_('play'));return;// If the tech is ready, but we do not have a source, we'll need to wait
// for both the `ready` and a `loadstart` when the source is finally
// resolved by middleware and set on the player.
//
// This can happen if `play()` is called while changing sources or before
// one has been set on the player.
}else {this.playOnLoadstart_=function(){_this8.playOnLoadstart_=null;callback(_this8.play());};this.one('loadstart',this.playOnLoadstart_);}};/**
   * Pause the video playback
   *
   * @return {Player}
   *         A reference to the player object this function was called on
   */Player.prototype.pause=function pause(){this.techCall_('pause');};/**
   * Check if the player is paused or has yet to play
   *
   * @return {boolean}
   *         - false: if the media is currently playing
   *         - true: if media is not currently playing
   */Player.prototype.paused=function paused(){// The initial state of paused should be true (in Safari it's actually false)
return this.techGet_('paused')===false?false:true;};/**
   * Get a TimeRange object representing the current ranges of time that the user
   * has played.
   *
   * @return {TimeRange}
   *         A time range object that represents all the increments of time that have
   *         been played.
   */Player.prototype.played=function played(){return this.techGet_('played')||createTimeRanges(0,0);};/**
   * Returns whether or not the user is "scrubbing". Scrubbing is
   * when the user has clicked the progress bar handle and is
   * dragging it along the progress bar.
   *
   * @param {boolean} [isScrubbing]
   *        wether the user is or is not scrubbing
   *
   * @return {boolean}
   *         The value of scrubbing when getting
   */Player.prototype.scrubbing=function scrubbing(isScrubbing){if(typeof isScrubbing==='undefined'){return this.scrubbing_;}this.scrubbing_=!!isScrubbing;if(isScrubbing){this.addClass('vjs-scrubbing');}else {this.removeClass('vjs-scrubbing');}};/**
   * Get or set the current time (in seconds)
   *
   * @param {number|string} [seconds]
   *        The time to seek to in seconds
   *
   * @return {number}
   *         - the current time in seconds when getting
   */Player.prototype.currentTime=function currentTime(seconds){if(typeof seconds!=='undefined'){if(seconds<0){seconds=0;}this.techCall_('setCurrentTime',seconds);return;}// cache last currentTime and return. default to 0 seconds
//
// Caching the currentTime is meant to prevent a massive amount of reads on the tech's
// currentTime when scrubbing, but may not provide much performance benefit afterall.
// Should be tested. Also something has to read the actual current time or the cache will
// never get updated.
this.cache_.currentTime=this.techGet_('currentTime')||0;return this.cache_.currentTime;};/**
   * Normally gets the length in time of the video in seconds;
   * in all but the rarest use cases an argument will NOT be passed to the method
   *
   * > **NOTE**: The video must have started loading before the duration can be
   * known, and in the case of Flash, may not be known until the video starts
   * playing.
   *
   * @fires Player#durationchange
   *
   * @param {number} [seconds]
   *        The duration of the video to set in seconds
   *
   * @return {number}
   *         - The duration of the video in seconds when getting
   */Player.prototype.duration=function duration(seconds){if(seconds===undefined){// return NaN if the duration is not known
return this.cache_.duration!==undefined?this.cache_.duration:NaN;}seconds=parseFloat(seconds);// Standardize on Inifity for signaling video is live
if(seconds<0){seconds=Infinity;}if(seconds!==this.cache_.duration){// Cache the last set value for optimized scrubbing (esp. Flash)
this.cache_.duration=seconds;if(seconds===Infinity){this.addClass('vjs-live');}else {this.removeClass('vjs-live');}/**
       * @event Player#durationchange
       * @type {EventTarget~Event}
       */this.trigger('durationchange');}};/**
   * Calculates how much time is left in the video. Not part
   * of the native video API.
   *
   * @return {number}
   *         The time remaining in seconds
   */Player.prototype.remainingTime=function remainingTime(){return this.duration()-this.currentTime();};/**
   * A remaining time function that is intented to be used when
   * the time is to be displayed directly to the user.
   *
   * @return {number}
   *         The rounded time remaining in seconds
   */Player.prototype.remainingTimeDisplay=function remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime());};//
// Kind of like an array of portions of the video that have been downloaded.
/**
   * Get a TimeRange object with an array of the times of the video
   * that have been downloaded. If you just want the percent of the
   * video that's been downloaded, use bufferedPercent.
   *
   * @see [Buffered Spec]{@link http://dev.w3.org/html5/spec/video.html#dom-media-buffered}
   *
   * @return {TimeRange}
   *         A mock TimeRange object (following HTML spec)
   */Player.prototype.buffered=function buffered(){var buffered=this.techGet_('buffered');if(!buffered||!buffered.length){buffered=createTimeRanges(0,0);}return buffered;};/**
   * Get the percent (as a decimal) of the video that's been downloaded.
   * This method is not a part of the native HTML video API.
   *
   * @return {number}
   *         A decimal between 0 and 1 representing the percent
   *         that is bufferred 0 being 0% and 1 being 100%
   */Player.prototype.bufferedPercent=function bufferedPercent$$1(){return bufferedPercent(this.buffered(),this.duration());};/**
   * Get the ending time of the last buffered time range
   * This is used in the progress bar to encapsulate all time ranges.
   *
   * @return {number}
   *         The end of the last buffered time range
   */Player.prototype.bufferedEnd=function bufferedEnd(){var buffered=this.buffered();var duration=this.duration();var end=buffered.end(buffered.length-1);if(end>duration){end=duration;}return end;};/**
   * Get or set the current volume of the media
   *
   * @param  {number} [percentAsDecimal]
   *         The new volume as a decimal percent:
   *         - 0 is muted/0%/off
   *         - 1.0 is 100%/full
   *         - 0.5 is half volume or 50%
   *
   * @return {number}
   *         The current volume as a percent when getting
   */Player.prototype.volume=function volume(percentAsDecimal){var vol=void 0;if(percentAsDecimal!==undefined){// Force value to between 0 and 1
vol=Math.max(0,Math.min(1,parseFloat(percentAsDecimal)));this.cache_.volume=vol;this.techCall_('setVolume',vol);if(vol>0){this.lastVolume_(vol);}return;}// Default to 1 when returning current volume.
vol=parseFloat(this.techGet_('volume'));return isNaN(vol)?1:vol;};/**
   * Get the current muted state, or turn mute on or off
   *
   * @param {boolean} [muted]
   *        - true to mute
   *        - false to unmute
   *
   * @return {boolean}
   *         - true if mute is on and getting
   *         - false if mute is off and getting
   */Player.prototype.muted=function muted(_muted){if(_muted!==undefined){this.techCall_('setMuted',_muted);return;}return this.techGet_('muted')||false;};/**
   * Get the current defaultMuted state, or turn defaultMuted on or off. defaultMuted
   * indicates the state of muted on intial playback.
   *
   * ```js
   *   var myPlayer = videojs('some-player-id');
   *
   *   myPlayer.src("http://www.example.com/path/to/video.mp4");
   *
   *   // get, should be false
   *   console.log(myPlayer.defaultMuted());
   *   // set to true
   *   myPlayer.defaultMuted(true);
   *   // get should be true
   *   console.log(myPlayer.defaultMuted());
   * ```
   *
   * @param {boolean} [defaultMuted]
   *        - true to mute
   *        - false to unmute
   *
   * @return {boolean|Player}
   *         - true if defaultMuted is on and getting
   *         - false if defaultMuted is off and getting
   *         - A reference to the current player when setting
   */Player.prototype.defaultMuted=function defaultMuted(_defaultMuted){if(_defaultMuted!==undefined){return this.techCall_('setDefaultMuted',_defaultMuted);}return this.techGet_('defaultMuted')||false;};/**
   * Get the last volume, or set it
   *
   * @param  {number} [percentAsDecimal]
   *         The new last volume as a decimal percent:
   *         - 0 is muted/0%/off
   *         - 1.0 is 100%/full
   *         - 0.5 is half volume or 50%
   *
   * @return {number}
   *         the current value of lastVolume as a percent when getting
   *
   * @private
   */Player.prototype.lastVolume_=function lastVolume_(percentAsDecimal){if(percentAsDecimal!==undefined&&percentAsDecimal!==0){this.cache_.lastVolume=percentAsDecimal;return;}return this.cache_.lastVolume;};/**
   * Check if current tech can support native fullscreen
   * (e.g. with built in controls like iOS, so not our flash swf)
   *
   * @return {boolean}
   *         if native fullscreen is supported
   */Player.prototype.supportsFullScreen=function supportsFullScreen(){return this.techGet_('supportsFullScreen')||false;};/**
   * Check if the player is in fullscreen mode or tell the player that it
   * is or is not in fullscreen mode.
   *
   * > NOTE: As of the latest HTML5 spec, isFullscreen is no longer an official
   * property and instead document.fullscreenElement is used. But isFullscreen is
   * still a valuable property for internal player workings.
   *
   * @param  {boolean} [isFS]
   *         Set the players current fullscreen state
   *
   * @return {boolean}
   *         - true if fullscreen is on and getting
   *         - false if fullscreen is off and getting
   */Player.prototype.isFullscreen=function isFullscreen(isFS){if(isFS!==undefined){this.isFullscreen_=!!isFS;return;}return !!this.isFullscreen_;};/**
   * Increase the size of the video to full screen
   * In some browsers, full screen is not supported natively, so it enters
   * "full window mode", where the video fills the browser window.
   * In browsers and devices that support native full screen, sometimes the
   * browser's default controls will be shown, and not the Video.js custom skin.
   * This includes most mobile devices (iOS, Android) and older versions of
   * Safari.
   *
   * @fires Player#fullscreenchange
   */Player.prototype.requestFullscreen=function requestFullscreen(){var fsApi=FullscreenApi;this.isFullscreen(true);if(fsApi.requestFullscreen){// the browser supports going fullscreen at the element level so we can
// take the controls fullscreen as well as the video
// Trigger fullscreenchange event after change
// We have to specifically add this each time, and remove
// when canceling fullscreen. Otherwise if there's multiple
// players on a page, they would all be reacting to the same fullscreen
// events
on(document$1,fsApi.fullscreenchange,bind$2(this,function documentFullscreenChange(e){this.isFullscreen(document$1[fsApi.fullscreenElement]);// If cancelling fullscreen, remove event listener.
if(this.isFullscreen()===false){off(document$1,fsApi.fullscreenchange,documentFullscreenChange);}/**
         * @event Player#fullscreenchange
         * @type {EventTarget~Event}
         */this.trigger('fullscreenchange');}));this.el_[fsApi.requestFullscreen]();}else if(this.tech_.supportsFullScreen()){// we can't take the video.js controls fullscreen but we can go fullscreen
// with native controls
this.techCall_('enterFullScreen');}else {// fullscreen isn't supported so we'll just stretch the video element to
// fill the viewport
this.enterFullWindow();/**
       * @event Player#fullscreenchange
       * @type {EventTarget~Event}
       */this.trigger('fullscreenchange');}};/**
   * Return the video to its normal size after having been in full screen mode
   *
   * @fires Player#fullscreenchange
   */Player.prototype.exitFullscreen=function exitFullscreen(){var fsApi=FullscreenApi;this.isFullscreen(false);// Check for browser element fullscreen support
if(fsApi.requestFullscreen){document$1[fsApi.exitFullscreen]();}else if(this.tech_.supportsFullScreen()){this.techCall_('exitFullScreen');}else {this.exitFullWindow();/**
       * @event Player#fullscreenchange
       * @type {EventTarget~Event}
       */this.trigger('fullscreenchange');}};/**
   * When fullscreen isn't supported we can stretch the
   * video container to as wide as the browser will let us.
   *
   * @fires Player#enterFullWindow
   */Player.prototype.enterFullWindow=function enterFullWindow(){this.isFullWindow=true;// Storing original doc overflow value to return to when fullscreen is off
this.docOrigOverflow=document$1.documentElement.style.overflow;// Add listener for esc key to exit fullscreen
on(document$1,'keydown',bind$2(this,this.fullWindowOnEscKey));// Hide any scroll bars
document$1.documentElement.style.overflow='hidden';// Apply fullscreen styles
addClass(document$1.body,'vjs-full-window');/**
     * @event Player#enterFullWindow
     * @type {EventTarget~Event}
     */this.trigger('enterFullWindow');};/**
   * Check for call to either exit full window or
   * full screen on ESC key
   *
   * @param {string} event
   *        Event to check for key press
   */Player.prototype.fullWindowOnEscKey=function fullWindowOnEscKey(event){if(event.keyCode===27){if(this.isFullscreen()===true){this.exitFullscreen();}else {this.exitFullWindow();}}};/**
   * Exit full window
   *
   * @fires Player#exitFullWindow
   */Player.prototype.exitFullWindow=function exitFullWindow(){this.isFullWindow=false;off(document$1,'keydown',this.fullWindowOnEscKey);// Unhide scroll bars.
document$1.documentElement.style.overflow=this.docOrigOverflow;// Remove fullscreen styles
removeClass(document$1.body,'vjs-full-window');// Resize the box, controller, and poster to original sizes
// this.positionAll();
/**
     * @event Player#exitFullWindow
     * @type {EventTarget~Event}
     */this.trigger('exitFullWindow');};/**
   * Check whether the player can play a given mimetype
   *
   * @see https://www.w3.org/TR/2011/WD-html5-20110113/video.html#dom-navigator-canplaytype
   *
   * @param {string} type
   *        The mimetype to check
   *
   * @return {string}
   *         'probably', 'maybe', or '' (empty string)
   */Player.prototype.canPlayType=function canPlayType(type){var can=void 0;// Loop through each playback technology in the options order
for(var i=0,j=this.options_.techOrder;i<j.length;i++){var techName=j[i];var tech=Tech.getTech(techName);// Support old behavior of techs being registered as components.
// Remove once that deprecated behavior is removed.
if(!tech){tech=Component.getComponent(techName);}// Check if the current tech is defined before continuing
if(!tech){log$2.error('The "'+techName+'" tech is undefined. Skipped browser support check for that tech.');continue;}// Check if the browser supports this technology
if(tech.isSupported()){can=tech.canPlayType(type);if(can){return can;}}}return '';};/**
   * Select source based on tech-order or source-order
   * Uses source-order selection if `options.sourceOrder` is truthy. Otherwise,
   * defaults to tech-order selection
   *
   * @param {Array} sources
   *        The sources for a media asset
   *
   * @return {Object|boolean}
   *         Object of source and tech order or false
   */Player.prototype.selectSource=function selectSource(sources){var _this9=this;// Get only the techs specified in `techOrder` that exist and are supported by the
// current platform
var techs=this.options_.techOrder.map(function(techName){return [techName,Tech.getTech(techName)];}).filter(function(_ref){var techName=_ref[0],tech=_ref[1];// Check if the current tech is defined before continuing
if(tech){// Check if the browser supports this technology
return tech.isSupported();}log$2.error('The "'+techName+'" tech is undefined. Skipped browser support check for that tech.');return false;});// Iterate over each `innerArray` element once per `outerArray` element and execute
// `tester` with both. If `tester` returns a non-falsy value, exit early and return
// that value.
var findFirstPassingTechSourcePair=function findFirstPassingTechSourcePair(outerArray,innerArray,tester){var found=void 0;outerArray.some(function(outerChoice){return innerArray.some(function(innerChoice){found=tester(outerChoice,innerChoice);if(found){return true;}});});return found;};var foundSourceAndTech=void 0;var flip=function flip(fn){return function(a,b){return fn(b,a);};};var finder=function finder(_ref2,source){var techName=_ref2[0],tech=_ref2[1];if(tech.canPlaySource(source,_this9.options_[techName.toLowerCase()])){return {source:source,tech:techName};}};// Depending on the truthiness of `options.sourceOrder`, we swap the order of techs and sources
// to select from them based on their priority.
if(this.options_.sourceOrder){// Source-first ordering
foundSourceAndTech=findFirstPassingTechSourcePair(sources,techs,flip(finder));}else {// Tech-first ordering
foundSourceAndTech=findFirstPassingTechSourcePair(techs,sources,finder);}return foundSourceAndTech||false;};/**
   * Get or set the video source.
   *
   * @param {Tech~SourceObject|Tech~SourceObject[]|string} [source]
   *        A SourceObject, an array of SourceObjects, or a string referencing
   *        a URL to a media source. It is _highly recommended_ that an object
   *        or array of objects is used here, so that source selection
   *        algorithms can take the `type` into account.
   *
   *        If not provided, this method acts as a getter.
   *
   * @return {string|undefined}
   *         If the `source` argument is missing, returns the current source
   *         URL. Otherwise, returns nothing/undefined.
   */Player.prototype.src=function src(source){var _this10=this;// getter usage
if(typeof source==='undefined'){return this.cache_.src||'';}// filter out invalid sources and turn our source into
// an array of source objects
var sources=filterSource(source);// if a source was passed in then it is invalid because
// it was filtered to a zero length Array. So we have to
// show an error
if(!sources.length){this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)});},0);return;}// intial sources
this.changingSrc_=true;this.cache_.sources=sources;this.updateSourceCaches_(sources[0]);// middlewareSource is the source after it has been changed by middleware
setSource(this,sources[0],function(middlewareSource,mws){_this10.middleware_=mws;// since sourceSet is async we have to update the cache again after we select a source since
// the source that is selected could be out of order from the cache update above this callback.
_this10.cache_.sources=sources;_this10.updateSourceCaches_(middlewareSource);var err=_this10.src_(middlewareSource);if(err){if(sources.length>1){return _this10.src(sources.slice(1));}_this10.changingSrc_=false;// We need to wrap this in a timeout to give folks a chance to add error event handlers
_this10.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)});},0);// we could not find an appropriate tech, but let's still notify the delegate that this is it
// this needs a better comment about why this is needed
_this10.triggerReady();return;}setTech(mws,_this10.tech_);});};/**
   * Set the source object on the tech, returns a boolean that indicates wether
   * there is a tech that can play the source or not
   *
   * @param {Tech~SourceObject} source
   *        The source object to set on the Tech
   *
   * @return {Boolean}
   *         - True if there is no Tech to playback this source
   *         - False otherwise
   *
   * @private
   */Player.prototype.src_=function src_(source){var _this11=this;var sourceTech=this.selectSource([source]);if(!sourceTech){return true;}if(!titleCaseEquals(sourceTech.tech,this.techName_)){this.changingSrc_=true;// load this technology with the chosen source
this.loadTech_(sourceTech.tech,sourceTech.source);this.tech_.ready(function(){_this11.changingSrc_=false;});return false;}// wait until the tech is ready to set the source
// and set it synchronously if possible (#2326)
this.ready(function(){// The setSource tech method was added with source handlers
// so older techs won't support it
// We need to check the direct prototype for the case where subclasses
// of the tech do not support source handlers
if(this.tech_.constructor.prototype.hasOwnProperty('setSource')){this.techCall_('setSource',source);}else {this.techCall_('src',source.src);}this.changingSrc_=false;},true);return false;};/**
   * Begin loading the src data.
   */Player.prototype.load=function load(){this.techCall_('load');};/**
   * Reset the player. Loads the first tech in the techOrder,
   * removes all the text tracks in the existing `tech`,
   * and calls `reset` on the `tech`.
   */Player.prototype.reset=function reset(){if(this.tech_){this.tech_.clearTracks('text');}this.loadTech_(this.options_.techOrder[0],null);this.techCall_('reset');};/**
   * Returns all of the current source objects.
   *
   * @return {Tech~SourceObject[]}
   *         The current source objects
   */Player.prototype.currentSources=function currentSources(){var source=this.currentSource();var sources=[];// assume `{}` or `{ src }`
if(Object.keys(source).length!==0){sources.push(source);}return this.cache_.sources||sources;};/**
   * Returns the current source object.
   *
   * @return {Tech~SourceObject}
   *         The current source object
   */Player.prototype.currentSource=function currentSource(){return this.cache_.source||{};};/**
   * Returns the fully qualified URL of the current source value e.g. http://mysite.com/video.mp4
   * Can be used in conjuction with `currentType` to assist in rebuilding the current source object.
   *
   * @return {string}
   *         The current source
   */Player.prototype.currentSrc=function currentSrc(){return this.currentSource()&&this.currentSource().src||'';};/**
   * Get the current source type e.g. video/mp4
   * This can allow you rebuild the current source object so that you could load the same
   * source and tech later
   *
   * @return {string}
   *         The source MIME type
   */Player.prototype.currentType=function currentType(){return this.currentSource()&&this.currentSource().type||'';};/**
   * Get or set the preload attribute
   *
   * @param {boolean} [value]
   *        - true means that we should preload
   *        - false maens that we should not preload
   *
   * @return {string}
   *         The preload attribute value when getting
   */Player.prototype.preload=function preload(value){if(value!==undefined){this.techCall_('setPreload',value);this.options_.preload=value;return;}return this.techGet_('preload');};/**
   * Get or set the autoplay option. When this is a boolean it will
   * modify the attribute on the tech. When this is a string the attribute on
   * the tech will be removed and `Player` will handle autoplay on loadstarts.
   *
   * @param {boolean|string} [value]
   *        - true: autoplay using the browser behavior
   *        - false: do not autoplay
   *        - 'play': call play() on every loadstart
   *        - 'muted': call muted() then play() on every loadstart
   *        - 'any': call play() on every loadstart. if that fails call muted() then play().
   *        - *: values other than those listed here will be set `autoplay` to true
   *
   * @return {boolean|string}
   *         The current value of autoplay when getting
   */Player.prototype.autoplay=function autoplay(value){// getter usage
if(value===undefined){return this.options_.autoplay||false;}var techAutoplay=void 0;// if the value is a valid string set it to that
if(typeof value==='string'&&/(any|play|muted)/.test(value)){this.options_.autoplay=value;this.manualAutoplay_(value);techAutoplay=false;// any falsy value sets autoplay to false in the browser,
// lets do the same
}else if(!value){this.options_.autoplay=false;// any other value (ie truthy) sets autoplay to true
}else {this.options_.autoplay=true;}techAutoplay=techAutoplay||this.options_.autoplay;// if we don't have a tech then we do not queue up
// a setAutoplay call on tech ready. We do this because the
// autoplay option will be passed in the constructor and we
// do not need to set it twice
if(this.tech_){this.techCall_('setAutoplay',techAutoplay);}};/**
   * Set or unset the playsinline attribute.
   * Playsinline tells the browser that non-fullscreen playback is preferred.
   *
   * @param {boolean} [value]
   *        - true means that we should try to play inline by default
   *        - false means that we should use the browser's default playback mode,
   *          which in most cases is inline. iOS Safari is a notable exception
   *          and plays fullscreen by default.
   *
   * @return {string|Player}
   *         - the current value of playsinline
   *         - the player when setting
   *
   * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline}
   */Player.prototype.playsinline=function playsinline(value){if(value!==undefined){this.techCall_('setPlaysinline',value);this.options_.playsinline=value;return this;}return this.techGet_('playsinline');};/**
   * Get or set the loop attribute on the video element.
   *
   * @param {boolean} [value]
   *        - true means that we should loop the video
   *        - false means that we should not loop the video
   *
   * @return {string}
   *         The current value of loop when getting
   */Player.prototype.loop=function loop(value){if(value!==undefined){this.techCall_('setLoop',value);this.options_.loop=value;return;}return this.techGet_('loop');};/**
   * Get or set the poster image source url
   *
   * @fires Player#posterchange
   *
   * @param {string} [src]
   *        Poster image source URL
   *
   * @return {string}
   *         The current value of poster when getting
   */Player.prototype.poster=function poster(src){if(src===undefined){return this.poster_;}// The correct way to remove a poster is to set as an empty string
// other falsey values will throw errors
if(!src){src='';}if(src===this.poster_){return;}// update the internal poster variable
this.poster_=src;// update the tech's poster
this.techCall_('setPoster',src);this.isPosterFromTech_=false;// alert components that the poster has been set
/**
     * This event fires when the poster image is changed on the player.
     *
     * @event Player#posterchange
     * @type {EventTarget~Event}
     */this.trigger('posterchange');};/**
   * Some techs (e.g. YouTube) can provide a poster source in an
   * asynchronous way. We want the poster component to use this
   * poster source so that it covers up the tech's controls.
   * (YouTube's play button). However we only want to use this
   * source if the player user hasn't set a poster through
   * the normal APIs.
   *
   * @fires Player#posterchange
   * @listens Tech#posterchange
   * @private
   */Player.prototype.handleTechPosterChange_=function handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var newPoster=this.tech_.poster()||'';if(newPoster!==this.poster_){this.poster_=newPoster;this.isPosterFromTech_=true;// Let components know the poster has changed
this.trigger('posterchange');}}};/**
   * Get or set whether or not the controls are showing.
   *
   * @fires Player#controlsenabled
   *
   * @param {boolean} [bool]
   *        - true to turn controls on
   *        - false to turn controls off
   *
   * @return {boolean}
   *         The current value of controls when getting
   */Player.prototype.controls=function controls(bool){if(bool===undefined){return !!this.controls_;}bool=!!bool;// Don't trigger a change event unless it actually changed
if(this.controls_===bool){return;}this.controls_=bool;if(this.usingNativeControls()){this.techCall_('setControls',bool);}if(this.controls_){this.removeClass('vjs-controls-disabled');this.addClass('vjs-controls-enabled');/**
       * @event Player#controlsenabled
       * @type {EventTarget~Event}
       */this.trigger('controlsenabled');if(!this.usingNativeControls()){this.addTechControlsListeners_();}}else {this.removeClass('vjs-controls-enabled');this.addClass('vjs-controls-disabled');/**
       * @event Player#controlsdisabled
       * @type {EventTarget~Event}
       */this.trigger('controlsdisabled');if(!this.usingNativeControls()){this.removeTechControlsListeners_();}}};/**
   * Toggle native controls on/off. Native controls are the controls built into
   * devices (e.g. default iPhone controls), Flash, or other techs
   * (e.g. Vimeo Controls)
   * **This should only be set by the current tech, because only the tech knows
   * if it can support native controls**
   *
   * @fires Player#usingnativecontrols
   * @fires Player#usingcustomcontrols
   *
   * @param {boolean} [bool]
   *        - true to turn native controls on
   *        - false to turn native controls off
   *
   * @return {boolean}
   *         The current value of native controls when getting
   */Player.prototype.usingNativeControls=function usingNativeControls(bool){if(bool===undefined){return !!this.usingNativeControls_;}bool=!!bool;// Don't trigger a change event unless it actually changed
if(this.usingNativeControls_===bool){return;}this.usingNativeControls_=bool;if(this.usingNativeControls_){this.addClass('vjs-using-native-controls');/**
       * player is using the native device controls
       *
       * @event Player#usingnativecontrols
       * @type {EventTarget~Event}
       */this.trigger('usingnativecontrols');}else {this.removeClass('vjs-using-native-controls');/**
       * player is using the custom HTML controls
       *
       * @event Player#usingcustomcontrols
       * @type {EventTarget~Event}
       */this.trigger('usingcustomcontrols');}};/**
   * Set or get the current MediaError
   *
   * @fires Player#error
   *
   * @param  {MediaError|string|number} [err]
   *         A MediaError or a string/number to be turned
   *         into a MediaError
   *
   * @return {MediaError|null}
   *         The current MediaError when getting (or null)
   */Player.prototype.error=function error(err){if(err===undefined){return this.error_||null;}// restoring to default
if(err===null){this.error_=err;this.removeClass('vjs-error');if(this.errorDisplay){this.errorDisplay.close();}return;}this.error_=new MediaError(err);// add the vjs-error classname to the player
this.addClass('vjs-error');// log the name of the error type and any message
// ie8 just logs "[object object]" if you just log the error object
log$2.error('(CODE:'+this.error_.code+' '+MediaError.errorTypes[this.error_.code]+')',this.error_.message,this.error_);/**
     * @event Player#error
     * @type {EventTarget~Event}
     */this.trigger('error');return;};/**
   * Report user activity
   *
   * @param {Object} event
   *        Event object
   */Player.prototype.reportUserActivity=function reportUserActivity(event){this.userActivity_=true;};/**
   * Get/set if user is active
   *
   * @fires Player#useractive
   * @fires Player#userinactive
   *
   * @param {boolean} [bool]
   *        - true if the user is active
   *        - false if the user is inactive
   *
   * @return {boolean}
   *         The current value of userActive when getting
   */Player.prototype.userActive=function userActive(bool){if(bool===undefined){return this.userActive_;}bool=!!bool;if(bool===this.userActive_){return;}this.userActive_=bool;if(this.userActive_){this.userActivity_=true;this.removeClass('vjs-user-inactive');this.addClass('vjs-user-active');/**
       * @event Player#useractive
       * @type {EventTarget~Event}
       */this.trigger('useractive');return;}// Chrome/Safari/IE have bugs where when you change the cursor it can
// trigger a mousemove event. This causes an issue when you're hiding
// the cursor when the user is inactive, and a mousemove signals user
// activity. Making it impossible to go into inactive mode. Specifically
// this happens in fullscreen when we really need to hide the cursor.
//
// When this gets resolved in ALL browsers it can be removed
// https://code.google.com/p/chromium/issues/detail?id=103041
if(this.tech_){this.tech_.one('mousemove',function(e){e.stopPropagation();e.preventDefault();});}this.userActivity_=false;this.removeClass('vjs-user-active');this.addClass('vjs-user-inactive');/**
     * @event Player#userinactive
     * @type {EventTarget~Event}
     */this.trigger('userinactive');};/**
   * Listen for user activity based on timeout value
   *
   * @private
   */Player.prototype.listenForUserActivity_=function listenForUserActivity_(){var mouseInProgress=void 0;var lastMoveX=void 0;var lastMoveY=void 0;var handleActivity=bind$2(this,this.reportUserActivity);var handleMouseMove=function handleMouseMove(e){// #1068 - Prevent mousemove spamming
// Chrome Bug: https://code.google.com/p/chromium/issues/detail?id=366970
if(e.screenX!==lastMoveX||e.screenY!==lastMoveY){lastMoveX=e.screenX;lastMoveY=e.screenY;handleActivity();}};var handleMouseDown=function handleMouseDown(){handleActivity();// For as long as the they are touching the device or have their mouse down,
// we consider them active even if they're not moving their finger or mouse.
// So we want to continue to update that they are active
this.clearInterval(mouseInProgress);// Setting userActivity=true now and setting the interval to the same time
// as the activityCheck interval (250) should ensure we never miss the
// next activityCheck
mouseInProgress=this.setInterval(handleActivity,250);};var handleMouseUp=function handleMouseUp(event){handleActivity();// Stop the interval that maintains activity if the mouse/touch is down
this.clearInterval(mouseInProgress);};// Any mouse movement will be considered user activity
this.on('mousedown',handleMouseDown);this.on('mousemove',handleMouseMove);this.on('mouseup',handleMouseUp);// Listen for keyboard navigation
// Shouldn't need to use inProgress interval because of key repeat
this.on('keydown',handleActivity);this.on('keyup',handleActivity);// Run an interval every 250 milliseconds instead of stuffing everything into
// the mousemove/touchmove function itself, to prevent performance degradation.
// `this.reportUserActivity` simply sets this.userActivity_ to true, which
// then gets picked up by this loop
// http://ejohn.org/blog/learning-from-twitter/
var inactivityTimeout=void 0;this.setInterval(function(){// Check to see if mouse/touch activity has happened
if(!this.userActivity_){return;}// Reset the activity tracker
this.userActivity_=false;// If the user state was inactive, set the state to active
this.userActive(true);// Clear any existing inactivity timeout to start the timer over
this.clearTimeout(inactivityTimeout);var timeout=this.options_.inactivityTimeout;if(timeout<=0){return;}// In <timeout> milliseconds, if no more activity has occurred the
// user will be considered inactive
inactivityTimeout=this.setTimeout(function(){// Protect against the case where the inactivityTimeout can trigger just
// before the next user activity is picked up by the activity check loop
// causing a flicker
if(!this.userActivity_){this.userActive(false);}},timeout);},250);};/**
   * Gets or sets the current playback rate. A playback rate of
   * 1.0 represents normal speed and 0.5 would indicate half-speed
   * playback, for instance.
   *
   * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-playbackrate
   *
   * @param {number} [rate]
   *       New playback rate to set.
   *
   * @return {number}
   *         The current playback rate when getting or 1.0
   */Player.prototype.playbackRate=function playbackRate(rate){if(rate!==undefined){// NOTE: this.cache_.lastPlaybackRate is set from the tech handler
// that is registered above
this.techCall_('setPlaybackRate',rate);return;}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.cache_.lastPlaybackRate||this.techGet_('playbackRate');}return 1.0;};/**
   * Gets or sets the current default playback rate. A default playback rate of
   * 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance.
   * defaultPlaybackRate will only represent what the intial playbackRate of a video was, not
   * not the current playbackRate.
   *
   * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-defaultplaybackrate
   *
   * @param {number} [rate]
   *       New default playback rate to set.
   *
   * @return {number|Player}
   *         - The default playback rate when getting or 1.0
   *         - the player when setting
   */Player.prototype.defaultPlaybackRate=function defaultPlaybackRate(rate){if(rate!==undefined){return this.techCall_('setDefaultPlaybackRate',rate);}if(this.tech_&&this.tech_.featuresPlaybackRate){return this.techGet_('defaultPlaybackRate');}return 1.0;};/**
   * Gets or sets the audio flag
   *
   * @param {boolean} bool
   *        - true signals that this is an audio player
   *        - false signals that this is not an audio player
   *
   * @return {boolean}
   *         The current value of isAudio when getting
   */Player.prototype.isAudio=function isAudio(bool){if(bool!==undefined){this.isAudio_=!!bool;return;}return !!this.isAudio_;};/**
   * A helper method for adding a {@link TextTrack} to our
   * {@link TextTrackList}.
   *
   * In addition to the W3C settings we allow adding additional info through options.
   *
   * @see http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-addtexttrack
   *
   * @param {string} [kind]
   *        the kind of TextTrack you are adding
   *
   * @param {string} [label]
   *        the label to give the TextTrack label
   *
   * @param {string} [language]
   *        the language to set on the TextTrack
   *
   * @return {TextTrack|undefined}
   *         the TextTrack that was added or undefined
   *         if there is no tech
   */Player.prototype.addTextTrack=function addTextTrack(kind,label,language){if(this.tech_){return this.tech_.addTextTrack(kind,label,language);}};/**
   * Create a remote {@link TextTrack} and an {@link HTMLTrackElement}. It will
   * automatically removed from the video element whenever the source changes, unless
   * manualCleanup is set to false.
   *
   * @param {Object} options
   *        Options to pass to {@link HTMLTrackElement} during creation. See
   *        {@link HTMLTrackElement} for object properties that you should use.
   *
   * @param {boolean} [manualCleanup=true] if set to false, the TextTrack will be
   *
   * @return {HtmlTrackElement}
   *         the HTMLTrackElement that was created and added
   *         to the HtmlTrackElementList and the remote
   *         TextTrackList
   *
   * @deprecated The default value of the "manualCleanup" parameter will default
   *             to "false" in upcoming versions of Video.js
   */Player.prototype.addRemoteTextTrack=function addRemoteTextTrack(options,manualCleanup){if(this.tech_){return this.tech_.addRemoteTextTrack(options,manualCleanup);}};/**
   * Remove a remote {@link TextTrack} from the respective
   * {@link TextTrackList} and {@link HtmlTrackElementList}.
   *
   * @param {Object} track
   *        Remote {@link TextTrack} to remove
   *
   * @return {undefined}
   *         does not return anything
   */Player.prototype.removeRemoteTextTrack=function removeRemoteTextTrack(){var _ref3=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref3$track=_ref3.track,track=_ref3$track===undefined?arguments[0]:_ref3$track;// destructure the input into an object with a track argument, defaulting to arguments[0]
// default the whole argument to an empty object if nothing was passed in
if(this.tech_){return this.tech_.removeRemoteTextTrack(track);}};/**
   * Gets available media playback quality metrics as specified by the W3C's Media
   * Playback Quality API.
   *
   * @see [Spec]{@link https://wicg.github.io/media-playback-quality}
   *
   * @return {Object|undefined}
   *         An object with supported media playback quality metrics or undefined if there
   *         is no tech or the tech does not support it.
   */Player.prototype.getVideoPlaybackQuality=function getVideoPlaybackQuality(){return this.techGet_('getVideoPlaybackQuality');};/**
   * Get video width
   *
   * @return {number}
   *         current video width
   */Player.prototype.videoWidth=function videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0;};/**
   * Get video height
   *
   * @return {number}
   *         current video height
   */Player.prototype.videoHeight=function videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0;};/**
   * The player's language code
   * NOTE: The language should be set in the player options if you want the
   * the controls to be built with a specific language. Changing the lanugage
   * later will not update controls text.
   *
   * @param {string} [code]
   *        the language code to set the player to
   *
   * @return {string}
   *         The current language code when getting
   */Player.prototype.language=function language(code){if(code===undefined){return this.language_;}this.language_=String(code).toLowerCase();};/**
   * Get the player's language dictionary
   * Merge every time, because a newly added plugin might call videojs.addLanguage() at any time
   * Languages specified directly in the player options have precedence
   *
   * @return {Array}
   *         An array of of supported languages
   */Player.prototype.languages=function languages(){return mergeOptions(Player.prototype.options_.languages,this.languages_);};/**
   * returns a JavaScript object reperesenting the current track
   * information. **DOES not return it as JSON**
   *
   * @return {Object}
   *         Object representing the current of track info
   */Player.prototype.toJSON=function toJSON(){var options=mergeOptions(this.options_);var tracks=options.tracks;options.tracks=[];for(var i=0;i<tracks.length;i++){var track=tracks[i];// deep merge tracks and null out player so no circular references
track=mergeOptions(track);track.player=undefined;options.tracks[i]=track;}return options;};/**
   * Creates a simple modal dialog (an instance of the {@link ModalDialog}
   * component) that immediately overlays the player with arbitrary
   * content and removes itself when closed.
   *
   * @param {string|Function|Element|Array|null} content
   *        Same as {@link ModalDialog#content}'s param of the same name.
   *        The most straight-forward usage is to provide a string or DOM
   *        element.
   *
   * @param {Object} [options]
   *        Extra options which will be passed on to the {@link ModalDialog}.
   *
   * @return {ModalDialog}
   *         the {@link ModalDialog} that was created
   */Player.prototype.createModal=function createModal(content,options){var _this12=this;options=options||{};options.content=content||'';var modal=new ModalDialog(this,options);this.addChild(modal);modal.on('dispose',function(){_this12.removeChild(modal);});modal.open();return modal;};/**
   * Change breakpoint classes when the player resizes.
   *
   * @private
   */Player.prototype.updateCurrentBreakpoint_=function updateCurrentBreakpoint_(){if(!this.responsive()){return;}var currentBreakpoint=this.currentBreakpoint();var currentWidth=this.currentWidth();for(var i=0;i<BREAKPOINT_ORDER.length;i++){var candidateBreakpoint=BREAKPOINT_ORDER[i];var maxWidth=this.breakpoints_[candidateBreakpoint];if(currentWidth<=maxWidth){// The current breakpoint did not change, nothing to do.
if(currentBreakpoint===candidateBreakpoint){return;}// Only remove a class if there is a current breakpoint.
if(currentBreakpoint){this.removeClass(BREAKPOINT_CLASSES[currentBreakpoint]);}this.addClass(BREAKPOINT_CLASSES[candidateBreakpoint]);this.breakpoint_=candidateBreakpoint;break;}}};/**
   * Removes the current breakpoint.
   *
   * @private
   */Player.prototype.removeCurrentBreakpoint_=function removeCurrentBreakpoint_(){var className=this.currentBreakpointClass();this.breakpoint_='';if(className){this.removeClass(className);}};/**
   * Get or set breakpoints on the player.
   *
   * Calling this method with an object or `true` will remove any previous
   * custom breakpoints and start from the defaults again.
   *
   * @param  {Object|boolean} [breakpoints]
   *         If an object is given, it can be used to provide custom
   *         breakpoints. If `true` is given, will set default breakpoints.
   *         If this argument is not given, will simply return the current
   *         breakpoints.
   *
   * @param  {number} [breakpoints.tiny]
   *         The maximum width for the "vjs-layout-tiny" class.
   *
   * @param  {number} [breakpoints.xsmall]
   *         The maximum width for the "vjs-layout-x-small" class.
   *
   * @param  {number} [breakpoints.small]
   *         The maximum width for the "vjs-layout-small" class.
   *
   * @param  {number} [breakpoints.medium]
   *         The maximum width for the "vjs-layout-medium" class.
   *
   * @param  {number} [breakpoints.large]
   *         The maximum width for the "vjs-layout-large" class.
   *
   * @param  {number} [breakpoints.xlarge]
   *         The maximum width for the "vjs-layout-x-large" class.
   *
   * @param  {number} [breakpoints.huge]
   *         The maximum width for the "vjs-layout-huge" class.
   *
   * @return {Object}
   *         An object mapping breakpoint names to maximum width values.
   */Player.prototype.breakpoints=function breakpoints(_breakpoints){// Used as a getter.
if(_breakpoints===undefined){return assign$1(this.breakpoints_);}this.breakpoint_='';this.breakpoints_=assign$1({},DEFAULT_BREAKPOINTS,_breakpoints);// When breakpoint definitions change, we need to update the currently
// selected breakpoint.
this.updateCurrentBreakpoint_();// Clone the breakpoints before returning.
return assign$1(this.breakpoints_);};/**
   * Get or set a flag indicating whether or not this player should adjust
   * its UI based on its dimensions.
   *
   * @param  {boolean} value
   *         Should be `true` if the player should adjust its UI based on its
   *         dimensions; otherwise, should be `false`.
   *
   * @return {boolean}
   *         Will be `true` if this player should adjust its UI based on its
   *         dimensions; otherwise, will be `false`.
   */Player.prototype.responsive=function responsive(value){// Used as a getter.
if(value===undefined){return this.responsive_;}value=Boolean(value);var current=this.responsive_;// Nothing changed.
if(value===current){return;}// The value actually changed, set it.
this.responsive_=value;// Start listening for breakpoints and set the initial breakpoint if the
// player is now responsive.
if(value){this.on('playerresize',this.updateCurrentBreakpoint_);this.updateCurrentBreakpoint_();// Stop listening for breakpoints if the player is no longer responsive.
}else {this.off('playerresize',this.updateCurrentBreakpoint_);this.removeCurrentBreakpoint_();}return value;};/**
   * Get current breakpoint name, if any.
   *
   * @return {string}
   *         If there is currently a breakpoint set, returns a the key from the
   *         breakpoints object matching it. Otherwise, returns an empty string.
   */Player.prototype.currentBreakpoint=function currentBreakpoint(){return this.breakpoint_;};/**
   * Get the current breakpoint class name.
   *
   * @return {string}
   *         The matching class name (e.g. `"vjs-layout-tiny"` or
   *         `"vjs-layout-large"`) for the current breakpoint. Empty string if
   *         there is no current breakpoint.
   */Player.prototype.currentBreakpointClass=function currentBreakpointClass(){return BREAKPOINT_CLASSES[this.breakpoint_]||'';};/**
   * Gets tag settings
   *
   * @param {Element} tag
   *        The player tag
   *
   * @return {Object}
   *         An object containing all of the settings
   *         for a player tag
   */Player.getTagSettings=function getTagSettings(tag){var baseOptions={sources:[],tracks:[]};var tagOptions=getAttributes(tag);var dataSetup=tagOptions['data-setup'];if(hasClass(tag,'vjs-fill')){tagOptions.fill=true;}if(hasClass(tag,'vjs-fluid')){tagOptions.fluid=true;}// Check if data-setup attr exists.
if(dataSetup!==null){// Parse options JSON
// If empty string, make it a parsable json object.
var _safeParseTuple=safeParseTuple(dataSetup||'{}'),err=_safeParseTuple[0],data=_safeParseTuple[1];if(err){log$2.error(err);}assign$1(tagOptions,data);}assign$1(baseOptions,tagOptions);// Get tag children settings
if(tag.hasChildNodes()){var children=tag.childNodes;for(var i=0,j=children.length;i<j;i++){var child=children[i];// Change case needed: http://ejohn.org/blog/nodename-case-sensitivity/
var childName=child.nodeName.toLowerCase();if(childName==='source'){baseOptions.sources.push(getAttributes(child));}else if(childName==='track'){baseOptions.tracks.push(getAttributes(child));}}}return baseOptions;};/**
   * Determine wether or not flexbox is supported
   *
   * @return {boolean}
   *         - true if flexbox is supported
   *         - false if flexbox is not supported
   */Player.prototype.flexNotSupported_=function flexNotSupported_(){var elem=document$1.createElement('i');// Note: We don't actually use flexBasis (or flexOrder), but it's one of the more
// common flex features that we can rely on when checking for flex support.
return !('flexBasis'in elem.style||'webkitFlexBasis'in elem.style||'mozFlexBasis'in elem.style||'msFlexBasis'in elem.style||// IE10-specific (2012 flex spec)
'msFlexOrder'in elem.style);};return Player;}(Component);/**
 * Get the {@link VideoTrackList}
 * @link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist
 *
 * @return {VideoTrackList}
 *         the current video track list
 *
 * @method Player.prototype.videoTracks
 *//**
 * Get the {@link AudioTrackList}
 * @link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist
 *
 * @return {AudioTrackList}
 *         the current audio track list
 *
 * @method Player.prototype.audioTracks
 *//**
 * Get the {@link TextTrackList}
 *
 * @link http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-texttracks
 *
 * @return {TextTrackList}
 *         the current text track list
 *
 * @method Player.prototype.textTracks
 *//**
 * Get the remote {@link TextTrackList}
 *
 * @return {TextTrackList}
 *         The current remote text track list
 *
 * @method Player.prototype.remoteTextTracks
 *//**
 * Get the remote {@link HtmlTrackElementList} tracks.
 *
 * @return {HtmlTrackElementList}
 *         The current remote text track element list
 *
 * @method Player.prototype.remoteTextTrackEls
 */ALL.names.forEach(function(name$$1){var props=ALL[name$$1];Player.prototype[props.getterName]=function(){if(this.tech_){return this.tech_[props.getterName]();}// if we have not yet loadTech_, we create {video,audio,text}Tracks_
// these will be passed to the tech during loading
this[props.privateName]=this[props.privateName]||new props.ListClass();return this[props.privateName];};});/**
 * Global player list
 *
 * @type {Object}
 */Player.players={};var navigator$1=window$1.navigator;/*
 * Player instance options, surfaced using options
 * options = Player.prototype.options_
 * Make changes in options, not here.
 *
 * @type {Object}
 * @private
 */Player.prototype.options_={// Default order of fallback technology
techOrder:Tech.defaultTechOrder_,html5:{},flash:{},// default inactivity timeout
inactivityTimeout:2000,// default playback rates
playbackRates:[],// Add playback rate selection by adding rates
// 'playbackRates': [0.5, 1, 1.5, 2],
// Included control sets
children:['mediaLoader','posterImage','textTrackDisplay','loadingSpinner','bigPlayButton','controlBar','errorDisplay','textTrackSettings'],language:navigator$1&&(navigator$1.languages&&navigator$1.languages[0]||navigator$1.userLanguage||navigator$1.language)||'en',// locales and their language translations
languages:{},// Default message to show when a video cannot be played.
notSupportedMessage:'No compatible source was found for this media.',breakpoints:{},responsive:false};if(!IS_IE8){Player.prototype.options_.children.push('resizeManager');}[/**
 * Returns whether or not the player is in the "ended" state.
 *
 * @return {Boolean} True if the player is in the ended state, false if not.
 * @method Player#ended
 */'ended',/**
 * Returns whether or not the player is in the "seeking" state.
 *
 * @return {Boolean} True if the player is in the seeking state, false if not.
 * @method Player#seeking
 */'seeking',/**
 * Returns the TimeRanges of the media that are currently available
 * for seeking to.
 *
 * @return {TimeRanges} the seekable intervals of the media timeline
 * @method Player#seekable
 */'seekable',/**
 * Returns the current state of network activity for the element, from
 * the codes in the list below.
 * - NETWORK_EMPTY (numeric value 0)
 *   The element has not yet been initialised. All attributes are in
 *   their initial states.
 * - NETWORK_IDLE (numeric value 1)
 *   The element's resource selection algorithm is active and has
 *   selected a resource, but it is not actually using the network at
 *   this time.
 * - NETWORK_LOADING (numeric value 2)
 *   The user agent is actively trying to download data.
 * - NETWORK_NO_SOURCE (numeric value 3)
 *   The element's resource selection algorithm is active, but it has
 *   not yet found a resource to use.
 *
 * @see https://html.spec.whatwg.org/multipage/embedded-content.html#network-states
 * @return {number} the current network activity state
 * @method Player#networkState
 */'networkState',/**
 * Returns a value that expresses the current state of the element
 * with respect to rendering the current playback position, from the
 * codes in the list below.
 * - HAVE_NOTHING (numeric value 0)
 *   No information regarding the media resource is available.
 * - HAVE_METADATA (numeric value 1)
 *   Enough of the resource has been obtained that the duration of the
 *   resource is available.
 * - HAVE_CURRENT_DATA (numeric value 2)
 *   Data for the immediate current playback position is available.
 * - HAVE_FUTURE_DATA (numeric value 3)
 *   Data for the immediate current playback position is available, as
 *   well as enough data for the user agent to advance the current
 *   playback position in the direction of playback.
 * - HAVE_ENOUGH_DATA (numeric value 4)
 *   The user agent estimates that enough data is available for
 *   playback to proceed uninterrupted.
 *
 * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-readystate
 * @return {number} the current playback rendering state
 * @method Player#readyState
 */'readyState'].forEach(function(fn){Player.prototype[fn]=function(){return this.techGet_(fn);};});TECH_EVENTS_RETRIGGER.forEach(function(event){Player.prototype['handleTech'+toTitleCase(event)+'_']=function(){return this.trigger(event);};});/**
 * Fired when the player has initial duration and dimension information
 *
 * @event Player#loadedmetadata
 * @type {EventTarget~Event}
 *//**
 * Fired when the player has downloaded data at the current playback position
 *
 * @event Player#loadeddata
 * @type {EventTarget~Event}
 *//**
 * Fired when the current playback position has changed *
 * During playback this is fired every 15-250 milliseconds, depending on the
 * playback technology in use.
 *
 * @event Player#timeupdate
 * @type {EventTarget~Event}
 *//**
 * Fired when the volume changes
 *
 * @event Player#volumechange
 * @type {EventTarget~Event}
 *//**
 * Reports whether or not a player has a plugin available.
 *
 * This does not report whether or not the plugin has ever been initialized
 * on this player. For that, [usingPlugin]{@link Player#usingPlugin}.
 *
 * @method Player#hasPlugin
 * @param  {string}  name
 *         The name of a plugin.
 *
 * @return {boolean}
 *         Whether or not this player has the requested plugin available.
 *//**
 * Reports whether or not a player is using a plugin by name.
 *
 * For basic plugins, this only reports whether the plugin has _ever_ been
 * initialized on this player.
 *
 * @method Player#usingPlugin
 * @param  {string} name
 *         The name of a plugin.
 *
 * @return {boolean}
 *         Whether or not this player is using the requested plugin.
 */Component.registerComponent('Player',Player);/**
 * @file plugin.js
 *//**
 * The base plugin name.
 *
 * @private
 * @constant
 * @type {string}
 */var BASE_PLUGIN_NAME='plugin';/**
 * The key on which a player's active plugins cache is stored.
 *
 * @private
 * @constant
 * @type     {string}
 */var PLUGIN_CACHE_KEY='activePlugins_';/**
 * Stores registered plugins in a private space.
 *
 * @private
 * @type    {Object}
 */var pluginStorage={};/**
 * Reports whether or not a plugin has been registered.
 *
 * @private
 * @param   {string} name
 *          The name of a plugin.
 *
 * @returns {boolean}
 *          Whether or not the plugin has been registered.
 */var pluginExists=function pluginExists(name){return pluginStorage.hasOwnProperty(name);};/**
 * Get a single registered plugin by name.
 *
 * @private
 * @param   {string} name
 *          The name of a plugin.
 *
 * @returns {Function|undefined}
 *          The plugin (or undefined).
 */var getPlugin=function getPlugin(name){return pluginExists(name)?pluginStorage[name]:undefined;};/**
 * Marks a plugin as "active" on a player.
 *
 * Also, ensures that the player has an object for tracking active plugins.
 *
 * @private
 * @param   {Player} player
 *          A Video.js player instance.
 *
 * @param   {string} name
 *          The name of a plugin.
 */var markPluginAsActive=function markPluginAsActive(player,name){player[PLUGIN_CACHE_KEY]=player[PLUGIN_CACHE_KEY]||{};player[PLUGIN_CACHE_KEY][name]=true;};/**
 * Triggers a pair of plugin setup events.
 *
 * @private
 * @param  {Player} player
 *         A Video.js player instance.
 *
 * @param  {Plugin~PluginEventHash} hash
 *         A plugin event hash.
 *
 * @param  {Boolean} [before]
 *         If true, prefixes the event name with "before". In other words,
 *         use this to trigger "beforepluginsetup" instead of "pluginsetup".
 */var triggerSetupEvent=function triggerSetupEvent(player,hash,before){var eventName=(before?'before':'')+'pluginsetup';player.trigger(eventName,hash);player.trigger(eventName+':'+hash.name,hash);};/**
 * Takes a basic plugin function and returns a wrapper function which marks
 * on the player that the plugin has been activated.
 *
 * @private
 * @param   {string} name
 *          The name of the plugin.
 *
 * @param   {Function} plugin
 *          The basic plugin.
 *
 * @returns {Function}
 *          A wrapper function for the given plugin.
 */var createBasicPlugin=function createBasicPlugin(name,plugin){var basicPluginWrapper=function basicPluginWrapper(){// We trigger the "beforepluginsetup" and "pluginsetup" events on the player
// regardless, but we want the hash to be consistent with the hash provided
// for advanced plugins.
//
// The only potentially counter-intuitive thing here is the `instance` in
// the "pluginsetup" event is the value returned by the `plugin` function.
triggerSetupEvent(this,{name:name,plugin:plugin,instance:null},true);var instance=plugin.apply(this,arguments);markPluginAsActive(this,name);triggerSetupEvent(this,{name:name,plugin:plugin,instance:instance});return instance;};Object.keys(plugin).forEach(function(prop){basicPluginWrapper[prop]=plugin[prop];});return basicPluginWrapper;};/**
 * Takes a plugin sub-class and returns a factory function for generating
 * instances of it.
 *
 * This factory function will replace itself with an instance of the requested
 * sub-class of Plugin.
 *
 * @private
 * @param   {string} name
 *          The name of the plugin.
 *
 * @param   {Plugin} PluginSubClass
 *          The advanced plugin.
 *
 * @returns {Function}
 */var createPluginFactory=function createPluginFactory(name,PluginSubClass){// Add a `name` property to the plugin prototype so that each plugin can
// refer to itself by name.
PluginSubClass.prototype.name=name;return function(){triggerSetupEvent(this,{name:name,plugin:PluginSubClass,instance:null},true);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var instance=new(Function.prototype.bind.apply(PluginSubClass,[null].concat([this].concat(args))))();// The plugin is replaced by a function that returns the current instance.
this[name]=function(){return instance;};triggerSetupEvent(this,instance.getEventHash());return instance;};};/**
 * Parent class for all advanced plugins.
 *
 * @mixes   module:evented~EventedMixin
 * @mixes   module:stateful~StatefulMixin
 * @fires   Player#beforepluginsetup
 * @fires   Player#beforepluginsetup:$name
 * @fires   Player#pluginsetup
 * @fires   Player#pluginsetup:$name
 * @listens Player#dispose
 * @throws  {Error}
 *          If attempting to instantiate the base {@link Plugin} class
 *          directly instead of via a sub-class.
 */var Plugin=function(){/**
   * Creates an instance of this class.
   *
   * Sub-classes should call `super` to ensure plugins are properly initialized.
   *
   * @param {Player} player
   *        A Video.js player instance.
   */function Plugin(player){classCallCheck(this,Plugin);if(this.constructor===Plugin){throw new Error('Plugin must be sub-classed; not directly instantiated.');}this.player=player;// Make this object evented, but remove the added `trigger` method so we
// use the prototype version instead.
evented(this);delete this.trigger;stateful(this,this.constructor.defaultState);markPluginAsActive(player,this.name);// Auto-bind the dispose method so we can use it as a listener and unbind
// it later easily.
this.dispose=bind$2(this,this.dispose);// If the player is disposed, dispose the plugin.
player.on('dispose',this.dispose);}/**
   * Get the version of the plugin that was set on <pluginName>.VERSION
   */Plugin.prototype.version=function version(){return this.constructor.VERSION;};/**
   * Each event triggered by plugins includes a hash of additional data with
   * conventional properties.
   *
   * This returns that object or mutates an existing hash.
   *
   * @param   {Object} [hash={}]
   *          An object to be used as event an event hash.
   *
   * @returns {Plugin~PluginEventHash}
   *          An event hash object with provided properties mixed-in.
   */Plugin.prototype.getEventHash=function getEventHash(){var hash=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};hash.name=this.name;hash.plugin=this.constructor;hash.instance=this;return hash;};/**
   * Triggers an event on the plugin object and overrides
   * {@link module:evented~EventedMixin.trigger|EventedMixin.trigger}.
   *
   * @param   {string|Object} event
   *          An event type or an object with a type property.
   *
   * @param   {Object} [hash={}]
   *          Additional data hash to merge with a
   *          {@link Plugin~PluginEventHash|PluginEventHash}.
   *
   * @returns {boolean}
   *          Whether or not default was prevented.
   */Plugin.prototype.trigger=function trigger$$1(event){var hash=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return trigger$2(this.eventBusEl_,event,this.getEventHash(hash));};/**
   * Handles "statechanged" events on the plugin. No-op by default, override by
   * subclassing.
   *
   * @abstract
   * @param    {Event} e
   *           An event object provided by a "statechanged" event.
   *
   * @param    {Object} e.changes
   *           An object describing changes that occurred with the "statechanged"
   *           event.
   */Plugin.prototype.handleStateChanged=function handleStateChanged(e){};/**
   * Disposes a plugin.
   *
   * Subclasses can override this if they want, but for the sake of safety,
   * it's probably best to subscribe the "dispose" event.
   *
   * @fires Plugin#dispose
   */Plugin.prototype.dispose=function dispose(){var name=this.name,player=this.player;/**
     * Signals that a advanced plugin is about to be disposed.
     *
     * @event Plugin#dispose
     * @type  {EventTarget~Event}
     */this.trigger('dispose');this.off();player.off('dispose',this.dispose);// Eliminate any possible sources of leaking memory by clearing up
// references between the player and the plugin instance and nulling out
// the plugin's state and replacing methods with a function that throws.
player[PLUGIN_CACHE_KEY][name]=false;this.player=this.state=null;// Finally, replace the plugin name on the player with a new factory
// function, so that the plugin is ready to be set up again.
player[name]=createPluginFactory(name,pluginStorage[name]);};/**
   * Determines if a plugin is a basic plugin (i.e. not a sub-class of `Plugin`).
   *
   * @param   {string|Function} plugin
   *          If a string, matches the name of a plugin. If a function, will be
   *          tested directly.
   *
   * @returns {boolean}
   *          Whether or not a plugin is a basic plugin.
   */Plugin.isBasic=function isBasic(plugin){var p=typeof plugin==='string'?getPlugin(plugin):plugin;return typeof p==='function'&&!Plugin.prototype.isPrototypeOf(p.prototype);};/**
   * Register a Video.js plugin.
   *
   * @param   {string} name
   *          The name of the plugin to be registered. Must be a string and
   *          must not match an existing plugin or a method on the `Player`
   *          prototype.
   *
   * @param   {Function} plugin
   *          A sub-class of `Plugin` or a function for basic plugins.
   *
   * @returns {Function}
   *          For advanced plugins, a factory function for that plugin. For
   *          basic plugins, a wrapper function that initializes the plugin.
   */Plugin.registerPlugin=function registerPlugin(name,plugin){if(typeof name!=='string'){throw new Error('Illegal plugin name, "'+name+'", must be a string, was '+(typeof name==='undefined'?'undefined':_typeof$2(name))+'.');}if(pluginExists(name)){log$2.warn('A plugin named "'+name+'" already exists. You may want to avoid re-registering plugins!');}else if(Player.prototype.hasOwnProperty(name)){throw new Error('Illegal plugin name, "'+name+'", cannot share a name with an existing player method!');}if(typeof plugin!=='function'){throw new Error('Illegal plugin for "'+name+'", must be a function, was '+(typeof plugin==='undefined'?'undefined':_typeof$2(plugin))+'.');}pluginStorage[name]=plugin;// Add a player prototype method for all sub-classed plugins (but not for
// the base Plugin class).
if(name!==BASE_PLUGIN_NAME){if(Plugin.isBasic(plugin)){Player.prototype[name]=createBasicPlugin(name,plugin);}else {Player.prototype[name]=createPluginFactory(name,plugin);}}return plugin;};/**
   * De-register a Video.js plugin.
   *
   * @param {string} name
   *        The name of the plugin to be deregistered.
   */Plugin.deregisterPlugin=function deregisterPlugin(name){if(name===BASE_PLUGIN_NAME){throw new Error('Cannot de-register base plugin.');}if(pluginExists(name)){delete pluginStorage[name];delete Player.prototype[name];}};/**
   * Gets an object containing multiple Video.js plugins.
   *
   * @param   {Array} [names]
   *          If provided, should be an array of plugin names. Defaults to _all_
   *          plugin names.
   *
   * @returns {Object|undefined}
   *          An object containing plugin(s) associated with their name(s) or
   *          `undefined` if no matching plugins exist).
   */Plugin.getPlugins=function getPlugins(){var names=arguments.length>0&&arguments[0]!==undefined?arguments[0]:Object.keys(pluginStorage);var result=void 0;names.forEach(function(name){var plugin=getPlugin(name);if(plugin){result=result||{};result[name]=plugin;}});return result;};/**
   * Gets a plugin's version, if available
   *
   * @param   {string} name
   *          The name of a plugin.
   *
   * @returns {string}
   *          The plugin's version or an empty string.
   */Plugin.getPluginVersion=function getPluginVersion(name){var plugin=getPlugin(name);return plugin&&plugin.VERSION||'';};return Plugin;}();/**
 * Gets a plugin by name if it exists.
 *
 * @static
 * @method   getPlugin
 * @memberOf Plugin
 * @param    {string} name
 *           The name of a plugin.
 *
 * @returns  {Function|undefined}
 *           The plugin (or `undefined`).
 */Plugin.getPlugin=getPlugin;/**
 * The name of the base plugin class as it is registered.
 *
 * @type {string}
 */Plugin.BASE_PLUGIN_NAME=BASE_PLUGIN_NAME;Plugin.registerPlugin(BASE_PLUGIN_NAME,Plugin);/**
 * Documented in player.js
 *
 * @ignore
 */Player.prototype.usingPlugin=function(name){return !!this[PLUGIN_CACHE_KEY]&&this[PLUGIN_CACHE_KEY][name]===true;};/**
 * Documented in player.js
 *
 * @ignore
 */Player.prototype.hasPlugin=function(name){return !!pluginExists(name);};/**
 * Signals that a plugin is about to be set up on a player.
 *
 * @event    Player#beforepluginsetup
 * @type     {Plugin~PluginEventHash}
 *//**
 * Signals that a plugin is about to be set up on a player - by name. The name
 * is the name of the plugin.
 *
 * @event    Player#beforepluginsetup:$name
 * @type     {Plugin~PluginEventHash}
 *//**
 * Signals that a plugin has just been set up on a player.
 *
 * @event    Player#pluginsetup
 * @type     {Plugin~PluginEventHash}
 *//**
 * Signals that a plugin has just been set up on a player - by name. The name
 * is the name of the plugin.
 *
 * @event    Player#pluginsetup:$name
 * @type     {Plugin~PluginEventHash}
 *//**
 * @typedef  {Object} Plugin~PluginEventHash
 *
 * @property {string} instance
 *           For basic plugins, the return value of the plugin function. For
 *           advanced plugins, the plugin instance on which the event is fired.
 *
 * @property {string} name
 *           The name of the plugin.
 *
 * @property {string} plugin
 *           For basic plugins, the plugin function. For advanced plugins, the
 *           plugin class/constructor.
 *//**
 * @file extend.js
 * @module extend
 *//**
 * A combination of node inherits and babel's inherits (after transpile).
 * Both work the same but node adds `super_` to the subClass
 * and Bable adds the superClass as __proto__. Both seem useful.
 *
 * @param {Object} subClass
 *        The class to inherit to
 *
 * @param {Object} superClass
 *        The class to inherit from
 *
 * @private
 */var _inherits=function _inherits(subClass,superClass){if(typeof superClass!=='function'&&superClass!==null){throw new TypeError('Super expression must either be null or a function, not '+(typeof superClass==='undefined'?'undefined':_typeof$2(superClass)));}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass){// node
subClass.super_=superClass;}};/**
 * Function for subclassing using the same inheritance that
 * videojs uses internally
 *
 * @static
 * @const
 *
 * @param {Object} superClass
 *        The class to inherit from
 *
 * @param {Object} [subClassMethods={}]
 *        The class to inherit to
 *
 * @return {Object}
 *         The new object with subClassMethods that inherited superClass.
 */var extendFn=function extendFn(superClass){var subClassMethods=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var subClass=function subClass(){superClass.apply(this,arguments);};var methods={};if((typeof subClassMethods==='undefined'?'undefined':_typeof$2(subClassMethods))==='object'){if(subClassMethods.constructor!==Object.prototype.constructor){subClass=subClassMethods.constructor;}methods=subClassMethods;}else if(typeof subClassMethods==='function'){subClass=subClassMethods;}_inherits(subClass,superClass);// Extend subObj's prototype with functions and other properties from props
for(var name in methods){if(methods.hasOwnProperty(name)){subClass.prototype[name]=methods[name];}}return subClass;};/**
 * @file video.js
 * @module videojs
 */// Include the built-in techs
// HTML5 Element Shim for IE8
if(typeof HTMLVideoElement==='undefined'&&isReal()){document$1.createElement('video');document$1.createElement('audio');document$1.createElement('track');document$1.createElement('video-js');}/**
 * Normalize an `id` value by trimming off a leading `#`
 *
 * @param   {string} id
 *          A string, maybe with a leading `#`.
 *
 * @returns {string}
 *          The string, without any leading `#`.
 */var normalizeId=function normalizeId(id){return id.indexOf('#')===0?id.slice(1):id;};/**
 * Doubles as the main function for users to create a player instance and also
 * the main library object.
 * The `videojs` function can be used to initialize or retrieve a player.
  *
 * @param {string|Element} id
 *        Video element or video element ID
 *
 * @param {Object} [options]
 *        Optional options object for config/settings
 *
 * @param {Component~ReadyCallback} [ready]
 *        Optional ready callback
 *
 * @return {Player}
 *         A player instance
 */function videojs(id,options,ready){var player=videojs.getPlayer(id);if(player){if(options){log$2.warn('Player "'+id+'" is already initialised. Options will not be applied.');}if(ready){player.ready(ready);}return player;}var el=typeof id==='string'?$$1('#'+normalizeId(id)):id;if(!isEl(el)){throw new TypeError('The element or ID supplied is not valid. (videojs)');}if(!document$1.body.contains(el)){log$2.warn('The element supplied is not included in the DOM');}options=options||{};videojs.hooks('beforesetup').forEach(function(hookFunction){var opts=hookFunction(el,mergeOptions(options));if(!isObject$4(opts)||Array.isArray(opts)){log$2.error('please return an object in beforesetup hooks');return;}options=mergeOptions(options,opts);});// We get the current "Player" component here in case an integration has
// replaced it with a custom player.
var PlayerComponent=Component.getComponent('Player');player=new PlayerComponent(el,options,ready);videojs.hooks('setup').forEach(function(hookFunction){return hookFunction(player);});return player;}/**
 * An Object that contains lifecycle hooks as keys which point to an array
 * of functions that are run when a lifecycle is triggered
 */videojs.hooks_={};/**
 * Get a list of hooks for a specific lifecycle
 * @function videojs.hooks
 *
 * @param {string} type
 *        the lifecyle to get hooks from
 *
 * @param {Function|Function[]} [fn]
 *        Optionally add a hook (or hooks) to the lifecycle that your are getting.
 *
 * @return {Array}
 *         an array of hooks, or an empty array if there are none.
 */videojs.hooks=function(type,fn){videojs.hooks_[type]=videojs.hooks_[type]||[];if(fn){videojs.hooks_[type]=videojs.hooks_[type].concat(fn);}return videojs.hooks_[type];};/**
 * Add a function hook to a specific videojs lifecycle.
 *
 * @param {string} type
 *        the lifecycle to hook the function to.
 *
 * @param {Function|Function[]}
 *        The function or array of functions to attach.
 */videojs.hook=function(type,fn){videojs.hooks(type,fn);};/**
 * Add a function hook that will only run once to a specific videojs lifecycle.
 *
 * @param {string} type
 *        the lifecycle to hook the function to.
 *
 * @param {Function|Function[]}
 *        The function or array of functions to attach.
 */videojs.hookOnce=function(type,fn){videojs.hooks(type,[].concat(fn).map(function(original){var wrapper=function wrapper(){videojs.removeHook(type,wrapper);return original.apply(undefined,arguments);};return wrapper;}));};/**
 * Remove a hook from a specific videojs lifecycle.
 *
 * @param {string} type
 *        the lifecycle that the function hooked to
 *
 * @param {Function} fn
 *        The hooked function to remove
 *
 * @return {boolean}
 *         The function that was removed or undef
 */videojs.removeHook=function(type,fn){var index=videojs.hooks(type).indexOf(fn);if(index<=-1){return false;}videojs.hooks_[type]=videojs.hooks_[type].slice();videojs.hooks_[type].splice(index,1);return true;};// Add default styles
if(window$1.VIDEOJS_NO_DYNAMIC_STYLE!==true&&isReal()){var style=$$1('.vjs-styles-defaults');if(!style){style=createStyleElement('vjs-styles-defaults');var head=$$1('head');if(head){head.insertBefore(style,head.firstChild);}setTextContent$1(style,'\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid {\n        padding-top: 56.25%\n      }\n    ');}}// Run Auto-load players
// You have to wait at least once in case this script is loaded after your
// video in the DOM (weird behavior only with minified version)
autoSetupTimeout(1,videojs);/**
 * Current software version. Follows semver.
 *
 * @type {string}
 */videojs.VERSION=version;/**
 * The global options object. These are the settings that take effect
 * if no overrides are specified when the player is created.
 *
 * @type {Object}
 */videojs.options=Player.prototype.options_;/**
 * Get an object with the currently created players, keyed by player ID
 *
 * @return {Object}
 *         The created players
 */videojs.getPlayers=function(){return Player.players;};/**
 * Get a single player based on an ID or DOM element.
 *
 * This is useful if you want to check if an element or ID has an associated
 * Video.js player, but not create one if it doesn't.
 *
 * @param   {string|Element} id
 *          An HTML element - `<video>`, `<audio>`, or `<video-js>` -
 *          or a string matching the `id` of such an element.
 *
 * @returns {Player|undefined}
 *          A player instance or `undefined` if there is no player instance
 *          matching the argument.
 */videojs.getPlayer=function(id){var players=Player.players;var tag=void 0;if(typeof id==='string'){var nId=normalizeId(id);var player=players[nId];if(player){return player;}tag=$$1('#'+nId);}else {tag=id;}if(isEl(tag)){var _tag=tag,_player=_tag.player,playerId=_tag.playerId;// Element may have a `player` property referring to an already created
// player instance. If so, return that.
if(_player||players[playerId]){return _player||players[playerId];}}};/**
 * Returns an array of all current players.
 *
 * @return {Array}
 *         An array of all players. The array will be in the order that
 *         `Object.keys` provides, which could potentially vary between
 *         JavaScript engines.
 *
 */videojs.getAllPlayers=function(){return(// Disposed players leave a key with a `null` value, so we need to make sure
// we filter those out.
Object.keys(Player.players).map(function(k){return Player.players[k];}).filter(Boolean));};/**
 * Expose players object.
 *
 * @memberOf videojs
 * @property {Object} players
 */videojs.players=Player.players;/**
 * Get a component class object by name
 *
 * @borrows Component.getComponent as videojs.getComponent
 */videojs.getComponent=Component.getComponent;/**
 * Register a component so it can referred to by name. Used when adding to other
 * components, either through addChild `component.addChild('myComponent')` or through
 * default children options  `{ children: ['myComponent'] }`.
 *
 * > NOTE: You could also just initialize the component before adding.
 * `component.addChild(new MyComponent());`
 *
 * @param {string} name
 *        The class name of the component
 *
 * @param {Component} comp
 *        The component class
 *
 * @return {Component}
 *         The newly registered component
 */videojs.registerComponent=function(name$$1,comp){if(Tech.isTech(comp)){log$2.warn('The '+name$$1+' tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)');}Component.registerComponent.call(Component,name$$1,comp);};/**
 * Get a Tech class object by name
 *
 * @borrows Tech.getTech as videojs.getTech
 */videojs.getTech=Tech.getTech;/**
 * Register a Tech so it can referred to by name.
 * This is used in the tech order for the player.
 *
 * @borrows Tech.registerTech as videojs.registerTech
 */videojs.registerTech=Tech.registerTech;/**
 * Register a middleware to a source type.
 *
 * @param {String} type A string representing a MIME type.
 * @param {function(player):object} middleware A middleware factory that takes a player.
 */videojs.use=use$1;/**
 * An object that can be returned by a middleware to signify
 * that the middleware is being terminated.
 *
 * @type {object}
 * @memberOf {videojs}
 * @property {object} middleware.TERMINATOR
 */// Object.defineProperty is not available in IE8
if(!IS_IE8&&Object.defineProperty){Object.defineProperty(videojs,'middleware',{value:{},writeable:false,enumerable:true});Object.defineProperty(videojs.middleware,'TERMINATOR',{value:TERMINATOR,writeable:false,enumerable:true});}else {videojs.middleware={TERMINATOR:TERMINATOR};}/**
 * A suite of browser and device tests from {@link browser}.
 *
 * @type {Object}
 * @private
 */videojs.browser=browser;/**
 * Whether or not the browser supports touch events. Included for backward
 * compatibility with 4.x, but deprecated. Use `videojs.browser.TOUCH_ENABLED`
 * instead going forward.
 *
 * @deprecated since version 5.0
 * @type {boolean}
 */videojs.TOUCH_ENABLED=TOUCH_ENABLED;/**
 * Subclass an existing class
 * Mimics ES6 subclassing with the `extend` keyword
 *
 * @borrows extend:extendFn as videojs.extend
 */videojs.extend=extendFn;/**
 * Merge two options objects recursively
 * Performs a deep merge like lodash.merge but **only merges plain objects**
 * (not arrays, elements, anything else)
 * Other values will be copied directly from the second object.
 *
 * @borrows merge-options:mergeOptions as videojs.mergeOptions
 */videojs.mergeOptions=mergeOptions;/**
 * Change the context (this) of a function
 *
 * > NOTE: as of v5.0 we require an ES5 shim, so you should use the native
 * `function() {}.bind(newContext);` instead of this.
 *
 * @borrows fn:bind as videojs.bind
 */videojs.bind=bind$2;/**
 * Register a Video.js plugin.
 *
 * @borrows plugin:registerPlugin as videojs.registerPlugin
 * @method registerPlugin
 *
 * @param  {string} name
 *         The name of the plugin to be registered. Must be a string and
 *         must not match an existing plugin or a method on the `Player`
 *         prototype.
 *
 * @param  {Function} plugin
 *         A sub-class of `Plugin` or a function for basic plugins.
 *
 * @return {Function}
 *         For advanced plugins, a factory function for that plugin. For
 *         basic plugins, a wrapper function that initializes the plugin.
 */videojs.registerPlugin=Plugin.registerPlugin;/**
 * Deregister a Video.js plugin.
 *
 * @borrows plugin:deregisterPlugin as videojs.deregisterPlugin
 * @method deregisterPlugin
 *
 * @param  {string} name
 *         The name of the plugin to be deregistered. Must be a string and
 *         must match an existing plugin or a method on the `Player`
 *         prototype.
 *
 */videojs.deregisterPlugin=Plugin.deregisterPlugin;/**
 * Deprecated method to register a plugin with Video.js
 *
 * @deprecated
 *        videojs.plugin() is deprecated; use videojs.registerPlugin() instead
 *
 * @param {string} name
 *        The plugin name
 *
 * @param {Plugin|Function} plugin
 *         The plugin sub-class or function
 */videojs.plugin=function(name$$1,plugin){log$2.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead');return Plugin.registerPlugin(name$$1,plugin);};/**
 * Gets an object containing multiple Video.js plugins.
 *
 * @param  {Array} [names]
 *         If provided, should be an array of plugin names. Defaults to _all_
 *         plugin names.
 *
 * @return {Object|undefined}
 *         An object containing plugin(s) associated with their name(s) or
 *         `undefined` if no matching plugins exist).
 */videojs.getPlugins=Plugin.getPlugins;/**
 * Gets a plugin by name if it exists.
 *
 * @param  {string} name
 *         The name of a plugin.
 *
 * @return {Function|undefined}
 *         The plugin (or `undefined`).
 */videojs.getPlugin=Plugin.getPlugin;/**
 * Gets a plugin's version, if available
 *
 * @param  {string} name
 *         The name of a plugin.
 *
 * @return {string}
 *         The plugin's version or an empty string.
 */videojs.getPluginVersion=Plugin.getPluginVersion;/**
 * Adding languages so that they're available to all players.
 * Example: `videojs.addLanguage('es', { 'Hello': 'Hola' });`
 *
 * @param {string} code
 *        The language code or dictionary property
 *
 * @param {Object} data
 *        The data values to be translated
 *
 * @return {Object}
 *         The resulting language dictionary object
 */videojs.addLanguage=function(code,data){var _mergeOptions;code=(''+code).toLowerCase();videojs.options.languages=mergeOptions(videojs.options.languages,(_mergeOptions={},_mergeOptions[code]=data,_mergeOptions));return videojs.options.languages[code];};/**
 * Log messages
 *
 * @borrows log:log as videojs.log
 */videojs.log=log$2;videojs.createLogger=createLogger;/**
 * Creates an emulated TimeRange object.
 *
 * @borrows time-ranges:createTimeRanges as videojs.createTimeRange
 *//**
 * @borrows time-ranges:createTimeRanges as videojs.createTimeRanges
 */videojs.createTimeRange=videojs.createTimeRanges=createTimeRanges;/**
 * Format seconds as a time string, H:MM:SS or M:SS
 * Supplying a guide (in seconds) will force a number of leading zeros
 * to cover the length of the guide
 *
 * @borrows format-time:formatTime as videojs.formatTime
 */videojs.formatTime=formatTime;/**
 * Replaces format-time with a custom implementation, to be used in place of the default.
 *
 * @borrows format-time:setFormatTime as videojs.setFormatTime
 *
 * @method setFormatTime
 *
 * @param {Function} customFn
 *        A custom format-time function which will be called with the current time and guide (in seconds) as arguments.
 *        Passed fn should return a string.
 */videojs.setFormatTime=setFormatTime;/**
 * Resets format-time to the default implementation.
 *
 * @borrows format-time:resetFormatTime as videojs.resetFormatTime
 *
 * @method resetFormatTime
 */videojs.resetFormatTime=resetFormatTime;/**
 * Resolve and parse the elements of a URL
 *
 * @borrows url:parseUrl as videojs.parseUrl
 *
 */videojs.parseUrl=parseUrl;/**
 * Returns whether the url passed is a cross domain request or not.
 *
 * @borrows url:isCrossOrigin as videojs.isCrossOrigin
 */videojs.isCrossOrigin=isCrossOrigin;/**
 * Event target class.
 *
 * @borrows EventTarget as videojs.EventTarget
 */videojs.EventTarget=EventTarget;/**
 * Add an event listener to element
 * It stores the handler function in a separate cache object
 * and adds a generic handler to the element's event,
 * along with a unique id (guid) to the element.
 *
 * @borrows events:on as videojs.on
 */videojs.on=on;/**
 * Trigger a listener only once for an event
 *
 * @borrows events:one as videojs.one
 */videojs.one=one;/**
 * Removes event listeners from an element
 *
 * @borrows events:off as videojs.off
 */videojs.off=off;/**
 * Trigger an event for an element
 *
 * @borrows events:trigger as videojs.trigger
 */videojs.trigger=trigger$2;/**
 * A cross-browser XMLHttpRequest wrapper. Here's a simple example:
 *
 * @param {Object} options
 *        settings for the request.
 *
 * @return {XMLHttpRequest|XDomainRequest}
 *         The request object.
 *
 * @see https://github.com/Raynos/xhr
 */videojs.xhr=xhr;/**
 * TextTrack class
 *
 * @borrows TextTrack as videojs.TextTrack
 */videojs.TextTrack=TextTrack;/**
 * export the AudioTrack class so that source handlers can create
 * AudioTracks and then add them to the players AudioTrackList
 *
 * @borrows AudioTrack as videojs.AudioTrack
 */videojs.AudioTrack=AudioTrack;/**
 * export the VideoTrack class so that source handlers can create
 * VideoTracks and then add them to the players VideoTrackList
 *
 * @borrows VideoTrack as videojs.VideoTrack
 */videojs.VideoTrack=VideoTrack;/**
 * Determines, via duck typing, whether or not a value is a DOM element.
 *
 * @borrows dom:isEl as videojs.isEl
 * @deprecated Use videojs.dom.isEl() instead
 *//**
 * Determines, via duck typing, whether or not a value is a text node.
 *
 * @borrows dom:isTextNode as videojs.isTextNode
 * @deprecated Use videojs.dom.isTextNode() instead
 *//**
 * Creates an element and applies properties.
 *
 * @borrows dom:createEl as videojs.createEl
 * @deprecated Use videojs.dom.createEl() instead
 *//**
 * Check if an element has a CSS class
 *
 * @borrows dom:hasElClass as videojs.hasClass
 * @deprecated Use videojs.dom.hasClass() instead
 *//**
 * Add a CSS class name to an element
 *
 * @borrows dom:addElClass as videojs.addClass
 * @deprecated Use videojs.dom.addClass() instead
 *//**
 * Remove a CSS class name from an element
 *
 * @borrows dom:removeElClass as videojs.removeClass
 * @deprecated Use videojs.dom.removeClass() instead
 *//**
 * Adds or removes a CSS class name on an element depending on an optional
 * condition or the presence/absence of the class name.
 *
 * @borrows dom:toggleElClass as videojs.toggleClass
 * @deprecated Use videojs.dom.toggleClass() instead
 *//**
 * Apply attributes to an HTML element.
 *
 * @borrows dom:setElAttributes as videojs.setAttribute
 * @deprecated Use videojs.dom.setAttributes() instead
 *//**
 * Get an element's attribute values, as defined on the HTML tag
 * Attributes are not the same as properties. They're defined on the tag
 * or with setAttribute (which shouldn't be used with HTML)
 * This will return true or false for boolean attributes.
 *
 * @borrows dom:getElAttributes as videojs.getAttributes
 * @deprecated Use videojs.dom.getAttributes() instead
 *//**
 * Empties the contents of an element.
 *
 * @borrows dom:emptyEl as videojs.emptyEl
 * @deprecated Use videojs.dom.emptyEl() instead
 *//**
 * Normalizes and appends content to an element.
 *
 * The content for an element can be passed in multiple types and
 * combinations, whose behavior is as follows:
 *
 * - String
 *   Normalized into a text node.
 *
 * - Element, TextNode
 *   Passed through.
 *
 * - Array
 *   A one-dimensional array of strings, elements, nodes, or functions (which
 *   return single strings, elements, or nodes).
 *
 * - Function
 *   If the sole argument, is expected to produce a string, element,
 *   node, or array.
 *
 * @borrows dom:appendContents as videojs.appendContet
 * @deprecated Use videojs.dom.appendContent() instead
 *//**
 * Normalizes and inserts content into an element; this is identical to
 * `appendContent()`, except it empties the element first.
 *
 * The content for an element can be passed in multiple types and
 * combinations, whose behavior is as follows:
 *
 * - String
 *   Normalized into a text node.
 *
 * - Element, TextNode
 *   Passed through.
 *
 * - Array
 *   A one-dimensional array of strings, elements, nodes, or functions (which
 *   return single strings, elements, or nodes).
 *
 * - Function
 *   If the sole argument, is expected to produce a string, element,
 *   node, or array.
 *
 * @borrows dom:insertContent as videojs.insertContent
 * @deprecated Use videojs.dom.insertContent() instead
 */['isEl','isTextNode','createEl','hasClass','addClass','removeClass','toggleClass','setAttributes','getAttributes','emptyEl','appendContent','insertContent'].forEach(function(k){videojs[k]=function(){log$2.warn('videojs.'+k+'() is deprecated; use videojs.dom.'+k+'() instead');return Dom[k].apply(null,arguments);};});/**
 * A safe getComputedStyle with an IE8 fallback.
 *
 * This is because in Firefox, if the player is loaded in an iframe with `display:none`,
 * then `getComputedStyle` returns `null`, so, we do a null-check to make sure
 * that the player doesn't break in these cases.
 * See https://bugzilla.mozilla.org/show_bug.cgi?id=548397 for more details.
 *
 * @borrows computed-style:computedStyle as videojs.computedStyle
 */videojs.computedStyle=computedStyle;/**
 * Export the Dom utilities for use in external plugins
 * and Tech's
 */videojs.dom=Dom;/**
 * Export the Url utilities for use in external plugins
 * and Tech's
 */videojs.url=Url;var video_cjs=videojs;

var vueVideoPlayer = createCommonjsModule(function (module, exports) {
!function (e, t) {
  module.exports = t(video_cjs) ;
}(commonjsGlobal, function (e) {
  return function (e) {
    function t(i) {
      if (n[i]) return n[i].exports;
      var r = n[i] = {
        i: i,
        l: !1,
        exports: {}
      };
      return e[i].call(r.exports, r, r.exports, t), r.l = !0, r.exports;
    }
    var n = {};
    return t.m = e, t.c = n, t.i = function (e) {
      return e;
    }, t.d = function (e, n, i) {
      t.o(e, n) || Object.defineProperty(e, n, {
        configurable: !1,
        enumerable: !0,
        get: i
      });
    }, t.n = function (e) {
      var n = e && e.__esModule ? function () {
        return e.default;
      } : function () {
        return e;
      };
      return t.d(n, "a", n), n;
    }, t.o = function (e, t) {
      return Object.prototype.hasOwnProperty.call(e, t);
    }, t.p = "/", t(t.s = 3);
  }([function (t, n) {
    t.exports = e;
  }, function (e, t, n) {

    function i(e, t, n) {
      return t in e ? Object.defineProperty(e, t, {
        value: n,
        enumerable: !0,
        configurable: !0,
        writable: !0
      }) : e[t] = n, e;
    }
    Object.defineProperty(t, "__esModule", {
      value: !0
    });
    var r = n(0),
      o = function (e) {
        return e && e.__esModule ? e : {
          default: e
        };
      }(r),
      s = window.videojs || o.default;
    "function" != typeof Object.assign && Object.defineProperty(Object, "assign", {
      value: function (e, t) {
        if (null == e) throw new TypeError("Cannot convert undefined or null to object");
        for (var n = Object(e), i = 1; i < arguments.length; i++) {
          var r = arguments[i];
          if (null != r) for (var o in r) Object.prototype.hasOwnProperty.call(r, o) && (n[o] = r[o]);
        }
        return n;
      },
      writable: !0,
      configurable: !0
    });
    var a = ["loadeddata", "canplay", "canplaythrough", "play", "pause", "waiting", "playing", "ended", "error"];
    t.default = {
      name: "video-player",
      props: {
        start: {
          type: Number,
          default: 0
        },
        crossOrigin: {
          type: String,
          default: ""
        },
        playsinline: {
          type: Boolean,
          default: !1
        },
        customEventName: {
          type: String,
          default: "statechanged"
        },
        options: {
          type: Object,
          required: !0
        },
        events: {
          type: Array,
          default: function () {
            return [];
          }
        },
        globalOptions: {
          type: Object,
          default: function () {
            return {
              controls: !0,
              controlBar: {
                remainingTimeDisplay: !1,
                playToggle: {},
                progressControl: {},
                fullscreenToggle: {},
                volumeMenuButton: {
                  inline: !1,
                  vertical: !0
                }
              },
              techOrder: ["html5"],
              plugins: {}
            };
          }
        },
        globalEvents: {
          type: Array,
          default: function () {
            return [];
          }
        }
      },
      data: function () {
        return {
          player: null,
          reseted: !0
        };
      },
      mounted: function () {
        this.player || this.initialize();
      },
      beforeDestroy: function () {
        this.player && this.dispose();
      },
      methods: {
        initialize: function () {
          var e = this,
            t = Object.assign({}, this.globalOptions, this.options);
          this.playsinline && (this.$refs.video.setAttribute("playsinline", this.playsinline), this.$refs.video.setAttribute("webkit-playsinline", this.playsinline), this.$refs.video.setAttribute("x5-playsinline", this.playsinline), this.$refs.video.setAttribute("x5-video-player-type", "h5"), this.$refs.video.setAttribute("x5-video-player-fullscreen", !1)), "" !== this.crossOrigin && (this.$refs.video.crossOrigin = this.crossOrigin, this.$refs.video.setAttribute("crossOrigin", this.crossOrigin));
          var n = function (t, n) {
            t && e.$emit(t, e.player), n && e.$emit(e.customEventName, i({}, t, n));
          };
          t.plugins && delete t.plugins.__ob__;
          var r = this;
          this.player = s(this.$refs.video, t, function () {
            for (var e = this, t = a.concat(r.events).concat(r.globalEvents), i = {}, o = 0; o < t.length; o++) "string" == typeof t[o] && void 0 === i[t[o]] && function (t) {
              i[t] = null, e.on(t, function () {
                n(t, !0);
              });
            }(t[o]);
            this.on("timeupdate", function () {
              n("timeupdate", this.currentTime());
            }), r.$emit("ready", this);
          });
        },
        dispose: function (e) {
          var t = this;
          this.player && this.player.dispose && ("Flash" !== this.player.techName_ && this.player.pause && this.player.pause(), this.player.dispose(), this.player = null, this.$nextTick(function () {
            t.reseted = !1, t.$nextTick(function () {
              t.reseted = !0, t.$nextTick(function () {
                e && e();
              });
            });
          }));
        }
      },
      watch: {
        options: {
          deep: !0,
          handler: function (e, t) {
            var n = this;
            this.dispose(function () {
              e && e.sources && e.sources.length && n.initialize();
            });
          }
        }
      }
    };
  }, function (e, t, n) {

    Object.defineProperty(t, "__esModule", {
      value: !0
    });
    var i = n(1),
      r = n.n(i);
    for (var o in i) ["default", "default"].indexOf(o) < 0 && function (e) {
      n.d(t, e, function () {
        return i[e];
      });
    }(o);
    var s = n(5),
      a = n(4),
      l = a(r.a, s.a, !1, null, null, null);
    t.default = l.exports;
  }, function (e, t, n) {

    function i(e) {
      return e && e.__esModule ? e : {
        default: e
      };
    }
    Object.defineProperty(t, "__esModule", {
      value: !0
    }), t.install = t.videoPlayer = t.videojs = void 0;
    var r = n(0),
      o = i(r),
      s = n(2),
      a = i(s),
      l = window.videojs || o.default,
      u = function (e, t) {
        t && (t.options && (a.default.props.globalOptions.default = function () {
          return t.options;
        }), t.events && (a.default.props.globalEvents.default = function () {
          return t.events;
        })), e.component(a.default.name, a.default);
      },
      d = {
        videojs: l,
        videoPlayer: a.default,
        install: u
      };
    t.default = d, t.videojs = l, t.videoPlayer = a.default, t.install = u;
  }, function (e, t) {
    e.exports = function (e, t, n, i, r, o) {
      var s,
        a = e = e || {},
        l = typeof e.default;
      "object" !== l && "function" !== l || (s = e, a = e.default);
      var u = "function" == typeof a ? a.options : a;
      t && (u.render = t.render, u.staticRenderFns = t.staticRenderFns, u._compiled = !0), n && (u.functional = !0), r && (u._scopeId = r);
      var d;
      if (o ? (d = function (e) {
        e = e || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, e || "undefined" == typeof __VUE_SSR_CONTEXT__ || (e = __VUE_SSR_CONTEXT__), i && i.call(this, e), e && e._registeredComponents && e._registeredComponents.add(o);
      }, u._ssrRegister = d) : i && (d = i), d) {
        var c = u.functional,
          f = c ? u.render : u.beforeCreate;
        c ? (u._injectStyles = d, u.render = function (e, t) {
          return d.call(t), f(e, t);
        }) : u.beforeCreate = f ? [].concat(f, d) : [d];
      }
      return {
        esModule: s,
        exports: a,
        options: u
      };
    };
  }, function (e, t, n) {

    var i = function () {
        var e = this,
          t = e.$createElement,
          n = e._self._c || t;
        return e.reseted ? n("div", {
          staticClass: "video-player"
        }, [n("video", {
          ref: "video",
          staticClass: "video-js"
        })]) : e._e();
      },
      r = [],
      o = {
        render: i,
        staticRenderFns: r
      };
    t.a = o;
  }]);
});
});

var VueVideoPlayer = unwrapExports(vueVideoPlayer);
vueVideoPlayer.VueVideoPlayer;

//
var script$5V = {
  name: 'video-play',
  components: {
    videoPlayer: VueVideoPlayer.videoPlayer
  },
  props: {
    url: {
      type: String,
      default: '',
      require: true
    }
  },
  watch: {
    url: {
      handler() {
        // this.isPlay = false
        this.playerOptions.sources[0].src = this.url;
      },
      immediate: true
    }
  },
  data() {
    return {
      pageType: 'pc',
      isShowPlay: false,
      videoIcon: videoIcon$1,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      isShowControls: false,
      playerOptions: {
        playbackRates: [0.5, 1.0, 1.25, 1.5, 2.0],
        //播放速度
        autoplay: false,
        //如果true,浏览器准备好时开始回放。
        muted: false,
        // 默认情况下将会消除任何音频。
        loop: false,
        // 导致视频一结束就重新开始。
        preload: 'auto',
        // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频（如果浏览器支持）
        language: 'zh-CN',
        aspectRatio: '16:9',
        // 将播放器置于流畅模式，并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字（例如"16:9"或"4:3"）
        fluid: true,
        // 当true时，Video.js player将拥有流体大小。换句话说，它将按比例缩放以适应其容器。
        sources: [{
          type: '',
          //这里的种类支持很多种：基本视频格式、直播、流媒体等，具体可以参看git网址项目
          src: '' //url地址
        }],
        poster: '',
        //你的封面地址
        // width: document.documentElement.clientWidth, //播放器宽度
        notSupportedMessage: '获取视频失败，请刷新重试',
        //允许覆盖Video.js无法播放媒体源时显示的默认信息。
        controlBar: {
          timeDivider: true,
          durationDisplay: true,
          remainingTimeDisplay: false,
          fullscreenToggle: true //全屏按钮
        }
      },
      playerEvents: ['fullscreenchange']
    };
  },
  inject: ['wrapRoot', 'inKey'],
  created() {
    this.pageType = this.$route.query.pageType || 'pc';
  },
  methods: {
    onPlayerPlay(e) {
      let currentVideo = e.el_.children[0].getAttribute('id', 64);
      let videoList = document.getElementsByTagName('video');
      for (let i = 0; i < videoList.length; i++) {
        let id = videoList[i].getAttribute('id');
        if (currentVideo != id) {
          videoList[i].pause();
        }
      }
      let audio = document.querySelectorAll('audio');
      if (audio && audio.length) audio.forEach(i => i.pause());
    },
    showPlay() {
      this.isShowPlay = true;
      this.wrapRoot.currentInKey = this.inKey;
    },
    toggleFullscreen(e) {
      if (this.wrapRoot.currentInKey === this.inKey) {
        const data = {
          type: 'setIframeClass',
          value: e.isFullscreen()
        };
        window.parent.postMessage(data);
      }
    }
  }
};

/* script */
const __vue_script__$5V = script$5V;
/* template */
var __vue_render__$5V = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "video" },
    [
      _c(
        "div",
        {
          staticClass: "video-content",
          staticStyle: { "background-color": "#000" },
        },
        [
          _c("video", {
            staticStyle: { width: "180px", height: "100%" },
            attrs: { src: _vm.url },
          }),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "play",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  return _vm.showPlay.apply(null, arguments)
                },
              },
            },
            [_c("img", { attrs: { src: _vm.videoIcon, alt: "" } })]
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          attrs: {
            top: "60px",
            width: _vm.pageType === "pc" ? "50%" : "100%",
            "custom-class": "video-play--dialog",
            "destroy-on-close": "",
            "append-to-body": "",
            visible: _vm.isShowPlay,
          },
          on: {
            "update:visible": function ($event) {
              _vm.isShowPlay = $event;
            },
          },
        },
        [
          _c("video-player", {
            ref: "videoPlayer",
            staticClass: "video-player vjs-custom-skin",
            attrs: {
              events: _vm.playerEvents,
              playsinline: true,
              options: _vm.playerOptions,
            },
            on: {
              "!fullscreenchange": function ($event) {
                return _vm.toggleFullscreen($event)
              },
              play: function ($event) {
                return _vm.onPlayerPlay($event)
              },
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5V = [];
__vue_render__$5V._withStripped = true;

  /* style */
  const __vue_inject_styles__$5V = undefined;
  /* scoped */
  const __vue_scope_id__$5V = "data-v-726cb75e";
  /* module identifier */
  const __vue_module_identifier__$5V = undefined;
  /* functional template */
  const __vue_is_functional_template__$5V = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5V = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5V, staticRenderFns: __vue_staticRenderFns__$5V },
    __vue_inject_styles__$5V,
    __vue_script__$5V,
    __vue_scope_id__$5V,
    __vue_is_functional_template__$5V,
    __vue_module_identifier__$5V,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5U = {
  name: 'bc-file-render',
  components: {
    audioPlay: __vue_component__$5W,
    videoPlay: __vue_component__$5V
  },
  props: {
    fileInfo: {
      type: Object,
      default: () => ({
        fileUrl: '',
        fileType: '',
        fileSuffix: ''
      }),
      required: true
    },
    showHandler: {
      type: Boolean,
      default: true
    },
    mobile: {
      type: Boolean,
      default: false
    },
    isLineFile: {
      type: Boolean,
      default: false
    },
    playbackControl: {
      type: String,
      default: '0'
    }
  },
  computed: {
    fileType() {
      let type;
      if (this.fileInfo.fileType.includes('image')) type = 'image';
      if (this.fileInfo.fileType.includes('audio')) type = 'audio';
      if (this.fileInfo.fileType.includes('video')) type = 'video';
      return type;
    }
  },
  methods: {
    againUpload() {
      // this.$emit('remove')
      this.$emit('againUpload');
    },
    remove() {
      this.$emit('remove');
    }
  }
};

/* script */
const __vue_script__$5U = script$5U;
/* template */
var __vue_render__$5U = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "file-render", attrs: { flex: "" } },
    [
      _vm.fileType === "image"
        ? _c("div", [
            _c("img", {
              staticClass: "image-file",
              attrs: { src: _vm.fileInfo.fileUrl },
            }),
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.fileType === "audio"
        ? _c("audio-play", {
            style: { width: _vm.showHandler ? "256px" : "100%" },
            attrs: {
              playbackControl: _vm.playbackControl,
              isLineFile: _vm.isLineFile,
              mobile: _vm.mobile,
              url: _vm.fileInfo.fileUrl,
            },
            on: {
              play: function ($event) {
                return _vm.$emit("play")
              },
            },
          })
        : _vm._e(),
      _vm._v(" "),
      _vm.fileType === "video"
        ? _c("video-play", {
            staticClass: "file-render--video",
            attrs: {
              playbackControl: _vm.playbackControl,
              isLineFile: _vm.isLineFile,
              mobile: _vm.mobile,
              url: _vm.fileInfo.fileUrl,
            },
            on: {
              play: function ($event) {
                return _vm.$emit("play")
              },
            },
          })
        : _vm._e(),
      _vm._v(" "),
      _vm.showHandler
        ? _c(
            "div",
            {
              staticClass: "file-info",
              class: { videoHandler: _vm.fileType === "video" },
              staticStyle: { "margin-left": "28px" },
            },
            [
              _vm.fileType !== "audio"
                ? [
                    _vm.fileInfo.fileName
                      ? _c(
                          "el-tooltip",
                          {
                            staticClass: "item",
                            attrs: {
                              "popper-class": "atooltip",
                              effect: "dark",
                              content: "文件名称：" + _vm.fileInfo.fileName,
                              placement: "top-start",
                            },
                          },
                          [
                            _c(
                              "div",
                              { staticClass: "fileName text-overflow" },
                              [
                                _vm._v(
                                  "文件名称：" + _vm._s(_vm.fileInfo.fileName)
                                ),
                              ]
                            ),
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _c("div", { staticClass: "fileInfo" }, [
                      _vm._v("视频格式：" + _vm._s(_vm.fileInfo.fileSuffix)),
                    ]),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _c(
                "div",
                { attrs: { flex: "cross:center" } },
                [
                  _c(
                    "el-button",
                    {
                      staticClass: "dialog-submit",
                      attrs: { type: "primary" },
                      on: { click: _vm.againUpload },
                    },
                    [_vm._v("重新上传")]
                  ),
                  _vm._v(" "),
                  _c(
                    "el-button",
                    { staticClass: "dialog-close", on: { click: _vm.remove } },
                    [_vm._v("删除")]
                  ),
                ],
                1
              ),
            ],
            2
          )
        : _vm._e(),
    ],
    1
  )
};
var __vue_staticRenderFns__$5U = [];
__vue_render__$5U._withStripped = true;

  /* style */
  const __vue_inject_styles__$5U = undefined;
  /* scoped */
  const __vue_scope_id__$5U = "data-v-3e962af2";
  /* module identifier */
  const __vue_module_identifier__$5U = undefined;
  /* functional template */
  const __vue_is_functional_template__$5U = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5U = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5U, staticRenderFns: __vue_staticRenderFns__$5U },
    __vue_inject_styles__$5U,
    __vue_script__$5U,
    __vue_scope_id__$5U,
    __vue_is_functional_template__$5U,
    __vue_module_identifier__$5U,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5T = {
  name: 'BcViewCommon',
  components: {
    bcFileRenderNew: __vue_component__$5U
  },
  props: {
    content: {
      type: String,
      default: ''
    },
    standardAnswer: {
      type: Array,
      default: () => []
    },
    fileInfo: {
      type: Object,
      default: () => ({
        fileUrl: '',
        fileType: '',
        fileSuffix: ''
      })
    },
    placeholder: {
      type: String,
      default: ''
    },
    border: {
      type: Boolean,
      default: true
    },
    mobile: {
      type: Boolean,
      default: false
    },
    isLineFile: {
      type: Boolean,
      default: false
    },
    playbackControl: {
      type: String,
      default: '0'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'h5'
    }
  },
  data() {
    return {};
  },
  methods: {
    formatImg(str) {
      if (str) {
        let data = str.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, p1) => {
          if (match.indexOf('style') !== -1) {
            let src = this.resourceBasisPath + p1.split('./')[1];
            let image = match.indexOf('http') !== -1 ? match : match.replace(p1, src);
            return image.split('style="')[0] + 'style="max-width:100% !important;' + image.split('style="')[1];
          } else if (match.indexOf('width') !== -1) {
            let src = this.resourceBasisPath + p1.split('./')[1];
            let image = match.indexOf('http') !== -1 ? match : match.replace(p1, src);
            return image;
          } else {
            return `<img src='${p1.indexOf('http') > -1 ? p1 : this.resourceBasisPath + p1.split('./')[1]}' style="max-width:100%;" />`;
          }
        });
        return data;
      }
    },
    showImage(e) {
      if (e.target.tagName == 'IMG') {
        this.$hevueImgPreview({
          multiple: true,
          nowImgIndex: 0,
          imgList: [{
            url: e.target.src,
            title: ''
          }]
        });
      }
    }
  }
};

/* script */
const __vue_script__$5T = script$5T;
/* template */
var __vue_render__$5T = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "content" }, [
    _c(
      "div",
      { staticClass: "stem-content", class: { "no-border": !_vm.border } },
      [
        !_vm.content && !_vm.fileInfo.fileUrl && !_vm.standardAnswer
          ? _c("div", { staticClass: "placeholder" }, [
              _vm._v(_vm._s(_vm.placeholder)),
            ])
          : _vm.content
          ? _c("div", {
              staticClass: "text-break-all",
              domProps: { innerHTML: _vm._s(_vm.formatImg(_vm.content)) },
              on: {
                click: function ($event) {
                  return _vm.showImage($event)
                },
              },
            })
          : _vm.standardAnswer
          ? _c(
              "div",
              _vm._l(_vm.standardAnswer, function (item, index) {
                return _c("div", {
                  key: index,
                  domProps: { innerHTML: _vm._s(_vm.formatImg(item.content)) },
                  on: {
                    click: function ($event) {
                      return _vm.showImage($event)
                    },
                  },
                })
              }),
              0
            )
          : _vm._e(),
        _vm._v(" "),
        _vm._t("default"),
        _vm._v(" "),
        _vm.fileInfo.fileUrl
          ? _c("bc-file-render-new", {
              style: {
                "margin-top": _vm.content ? "16px" : 0,
                padding: "10px 0",
              },
              attrs: {
                playbackControl: _vm.playbackControl,
                isLineFile: _vm.isLineFile,
                mobile: _vm.mobile,
                showHandler: false,
                fileInfo: _vm.fileInfo,
              },
              on: {
                play: function ($event) {
                  return _vm.$emit("play")
                },
              },
            })
          : _vm._e(),
      ],
      2
    ),
  ])
};
var __vue_staticRenderFns__$5T = [];
__vue_render__$5T._withStripped = true;

  /* style */
  const __vue_inject_styles__$5T = undefined;
  /* scoped */
  const __vue_scope_id__$5T = "data-v-84c18bec";
  /* module identifier */
  const __vue_module_identifier__$5T = undefined;
  /* functional template */
  const __vue_is_functional_template__$5T = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5T = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5T, staticRenderFns: __vue_staticRenderFns__$5T },
    __vue_inject_styles__$5T,
    __vue_script__$5T,
    __vue_scope_id__$5T,
    __vue_is_functional_template__$5T,
    __vue_module_identifier__$5T,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5S = {
  name: 'bc-view-option-radio',
  components: {
    BcViewCommon: __vue_component__$5T
  },
  props: {
    option: {
      type: [String, Array],
      default: ''
    },
    showTitle: {
      type: Boolean,
      default: true
    },
    isSubmit: {
      type: Boolean,
      default: true
    },
    value: {
      type: String,
      default: ''
    },
    readonly: {
      type: Boolean,
      default: false
    },
    answer: {
      type: Object,
      default: () => {}
    },
    type: {
      type: String,
      default: 'radio'
    },
    standardAnswer: {
      type: Array
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'h5'
    }
  },
  data() {
    return {
      optionsList: [],
      selectData: '',
      isAnswer: false,
      radioJudeMap: {
        A: '正确',
        B: '错误'
      },
      serialNumber: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    };
  },
  inject: {
    getOptionNumber: {
      from: 'getOptionNumber',
      default: () => () => 'true'
    }
  },
  computed: {
    optionNumber() {
      return this.getOptionNumber();
    }
  },
  watch: {
    value: {
      handler(val) {
        this.selectData = val;
      },
      immediate: true
    },
    option: {
      handler(val) {
        try {
          if (Array.isArray(val)) {
            this.optionsList = val;
          } else {
            this.optionsList = JSON.parse(val);
          }
        } catch (err) {
          this.optionsList = [];
        }
      },
      immediate: true
    }
  },
  methods: {
    isActive(item) {
      return item.title === this.selectData && !this.readonly;
    },
    isTrue(item) {
      // if (this.type === 'radio') {
      //   if (this.selectData) {
      //     //当前等于选中
      //     if (item.title === this.selectData) {
      //       //等于正确答案
      //       if (item.title === this.standardAnswer[0].title) {
      //         return true
      //       } else {
      //         return false
      //       }
      //     } else {
      //       //等于正确答案
      //       if (item.title === this.standardAnswer[0].title) {
      //         return true
      //       } else {
      //         return false
      //       }
      //     }
      //   } else {
      //     return false
      //   }
      // } else {
      //   if (this.selectData) {
      //     //当前等于选中
      //     if (item.title === this.selectData) {
      //       //等于正确答案
      //       if (item.content === this.standardAnswer[0]) {
      //         return true
      //       } else {
      //         return false
      //       }
      //     } else {
      //       //等于正确答案
      //       if (item.content === this.standardAnswer[0]) {
      //         return true
      //       } else {
      //         return false
      //       }
      //     }
      //   } else {
      //     return false
      //   }
      // }
      if (this.type === 'radio') {
        return this.isAnswer && this.selectData && this.selectData === item.title && this.standardAnswer.some(i => i.title === item.title);
      } else {
        return this.isAnswer && this.selectData && this.selectData === item.title && this.standardAnswer.some(i => i === item.content);
      }
    },
    isFalse(item) {
      if (!this.isAnswer) {
        return false;
      }
      if (this.type === 'radio') {
        if (this.selectData) {
          //当前为选中的
          if (item.title === this.selectData) {
            if (this.standardAnswer[0].title === item.title) {
              return false;
            } else {
              return true;
            }
          } else {
            return false;
          }
        } else {
          return false;
        }
      } else {
        if (this.selectData) {
          //当前为选中的
          if (item.title === this.selectData) {
            if (this.standardAnswer[0] === item.content) {
              return false;
            } else {
              return true;
            }
          } else {
            return false;
          }
        } else {
          return false;
        }
      }
    },
    submitAnswer() {
      console.log('🚀 ~ file: radio.vue:258 ~ submitAnswer ~ this.selectData:', this.selectData);
      if (!this.selectData && this.isSubmit) {
        this.$message.error('请选择答案');
        return;
      }
      let answerIsTrue = false;
      if (this.type === 'radio') {
        answerIsTrue = this.standardAnswer.some(i => i.title === this.selectData);
      } else {
        answerIsTrue = this.standardAnswer.some(i => i === this.radioJudeMap[this.selectData]);
      }
      this.isAnswer = true;
      this.$emit('showAnalysis', answerIsTrue);
    },
    afresh() {
      this.selectData = '';
      this.isAnswer = false;
      this.$emit('afresh');
    },
    select(item) {
      this.selectData = item;
      // this.$emit('showAnalysis')
    }
  }
};

var __$_require_static_images_leaflet_icons_correct_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAA0klEQVQokWMs2MbsycDAMJeBgUGSgTjwnIGBIZmJRE0MULVzmUjUBNfMRIYmMCBaowSPFkO9433SNIrzaDKU215iuPpqK6ZGE6loBkZGTHMkebUZKmwvM+y918Ww5moOpkYb+SyGLrdPDKzMnCjOK7O5yLD3XifDlptV2P044bg1w7XX2xm63D4zCHMpMYhxq4Odt+tOC8OWm9UYLgElgP/IAv4a3QxaYp4MTIwsDKeeLGLYfbcNq78xNBILKIpHUNojFbwAaUwBMUjQ+ZSBgSEZAPrMNTg71FhgAAAAAElFTkSuQmCC";

var __$_require_static_images_leaflet_icons_error_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABNElEQVQokWO8ySDtycDAMJeBgUGSgTjwnIGBIRmk8RkJmmDgORNME39SBANfTBBOlTyBHgwCWfEwriQTXIaNlUFi8SQG3jBfDE3c7vYMUuvmMDDx8yIEbzJI/4fhZyFp/0HgRVIxXOyJbwJY7GVm5X9ktSgaQfhFcglY4SPrgP/31e3A7FfFTf/R1TGCdaMBDktjBrljG8GCT73jGL5u24fhfCYMEQYGhr8vXyOx32ANLAyNPP7uDIp3jzE89U1geGTlzyB3ZhsDX1wIhkYWZA6Xiy2D1Ia5DK9Lmhm+btkDFnsRl88gsWgiw/9fvxk+r4A4HyVUn0fnQEIvuxojIOByOTVwMbiNTPx8DK8L6hk+TF2A4axPS9czMHJwMDAJ8sPFyE1yL0CBkwJikKDpKQMDQzIArpej/rmzX0cAAAAASUVORK5CYII=";

/* script */
const __vue_script__$5S = script$5S;
var __vue_render__$5S = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", [
    _c(
      "div",
      {
        staticClass: "xml-checkbox-box",
        class: _vm.type == "judge" ? "xml-arrange-in-a-row" : "",
      },
      _vm._l(_vm.optionsList, function (item, index) {
        return _c(
          "div",
          {
            key: index,
            staticClass: "option-item",
            class: {
              isActive: _vm.isActive(item),
              isTrue: _vm.isTrue(item),
              isFalse: _vm.isFalse(item),
            },
            attrs: { flex: "" },
            on: {
              click: function ($event) {
                $event.stopPropagation();
                return _vm.select(item.title)
              },
            },
          },
          [
            _c(
              "div",
              { staticClass: "questionSeq" },
              [
                _vm.isTrue(item)
                  ? _c("img", {
                      staticStyle: { "margin-right": "10px" },
                      attrs: {
                        src: __$_require_static_images_leaflet_icons_correct_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                _vm.isFalse(item)
                  ? _c("img", {
                      staticStyle: { "margin-right": "10px" },
                      attrs: {
                        src: __$_require_static_images_leaflet_icons_error_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                !_vm.readonly && !_vm.isTrue(item) && !_vm.isFalse(item)
                  ? _c(
                      "el-radio",
                      { attrs: { value: _vm.selectData, label: item.title } },
                      [_vm._v(_vm._s(""))]
                    )
                  : _vm._e(),
              ],
              1
            ),
            _vm._v(" "),
            _vm.showTitle && _vm.optionNumber != "false"
              ? _c(
                  "div",
                  {
                    staticClass: "questionSeq",
                    staticStyle: { "margin-right": "2px" },
                  },
                  [
                    _vm._v(
                      "\n        " +
                        _vm._s(_vm.serialNumber[index]) +
                        "\n      "
                    ),
                  ]
                )
              : _vm._e(),
            _vm._v(" "),
            _c("bc-view-common", {
              attrs: {
                "flex-box": "1",
                border: false,
                content: item.content,
                fileInfo: item.fileInfo,
                resourceBasisPath: _vm.resourceBasisPath,
                pageType: _vm.pageType,
              },
            }),
          ],
          1
        )
      }),
      0
    ),
    _vm._v(" "),
    _vm.isSubmit
      ? _c(
          "div",
          {
            staticClass: "mt-4",
            staticStyle: {
              display: "flex",
              "justify-content": "flex-end",
              "text-align": "center",
              "margin-top": "12px",
            },
          },
          [
            !_vm.selectData || !_vm.isAnswer
              ? _c(
                  "div",
                  {
                    staticClass: "xml-submit-answer",
                    on: { click: _vm.submitAnswer },
                  },
                  [_vm._v("提交作答")]
                )
              : _c(
                  "div",
                  {
                    staticClass: "xml-submit-answer",
                    on: {
                      click: function ($event) {
                        return _vm.afresh()
                      },
                    },
                  },
                  [_vm._v("重新作答")]
                ),
          ]
        )
      : _vm._e(),
  ])
};
var __vue_staticRenderFns__$5S = [];
__vue_render__$5S._withStripped = true;

  /* style */
  const __vue_inject_styles__$5S = undefined;
  /* scoped */
  const __vue_scope_id__$5S = "data-v-669043fa";
  /* module identifier */
  const __vue_module_identifier__$5S = undefined;
  /* functional template */
  const __vue_is_functional_template__$5S = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5S = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5S, staticRenderFns: __vue_staticRenderFns__$5S },
    __vue_inject_styles__$5S,
    __vue_script__$5S,
    __vue_scope_id__$5S,
    __vue_is_functional_template__$5S,
    __vue_module_identifier__$5S,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5R = {
  name: 'bc-view-option-checkbox',
  components: {
    BcViewCommon: __vue_component__$5T
  },
  props: {
    option: {
      type: [String, Array],
      default: ''
    },
    showTitle: {
      type: Boolean,
      default: true
    },
    isSubmit: {
      type: Boolean,
      default: true
    },
    value: {
      type: [String],
      default: ''
    },
    readonly: {
      type: Boolean,
      default: false
    },
    answer: {
      type: Object,
      default: () => {}
    },
    standardAnswer: {
      type: Array,
      default: () => []
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'h5'
    }
  },
  data() {
    return {
      optionsList: [],
      selectData: [],
      isAnswer: false,
      serialNumber: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    };
  },
  watch: {
    // value: {
    //   handler(val) {
    //     this.selectData = val ? val : []
    //   },
    //   immediate: true
    // },
    option: {
      handler(val) {
        try {
          if (Array.isArray(val)) {
            this.optionsList = val;
          } else {
            this.optionsList = JSON.parse(val);
          }
        } catch (err) {
          this.optionsList = [];
        }
      },
      immediate: true
    }
  },
  methods: {
    select(item, e) {
      // debugger
      if (e.target.tagName === 'INPUT') {
        e.stopPropagation();
        return;
      }
      if (this.readonly) return;
      let index = this.selectData.findIndex(i => i === item);
      if (index !== -1) {
        this.selectData.splice(index, 1);
      } else {
        this.selectData.push(item);
      }
      this.selectData.sort((a, b) => a.charCodeAt() - b.charCodeAt());
      this.$emit('change', this.selectData.join(''));
    },
    submitAnswer() {
      if (!this.selectData.length && this.isSubmit) {
        this.$message.error('请选择答案');
        return;
      }
      let answerIsTrue = this.standardAnswer.map(i => i.title).join('、') === this.selectData.join('、');
      this.isAnswer = true;
      this.$emit('showAnalysis', answerIsTrue);
    },
    afresh() {
      this.selectData = [];
      this.isAnswer = false;
      this.$emit('afresh');
    },
    SkipProgress(e, title, val) {
      if (e.target.targetName === 'INPUT') {
        e.stopPropagation();
      }
    }
  }
};

/* script */
const __vue_script__$5R = script$5R;
var __vue_render__$5R = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", [
    _c(
      "div",
      { staticClass: "xml-checkbox-box" },
      _vm._l(_vm.optionsList, function (item, index) {
        return _c(
          "div",
          {
            key: index,
            staticClass: "option-item",
            class: {
              isActive: _vm.selectData.includes(item.title) && !_vm.readonly,
              isTrue:
                _vm.isAnswer &&
                _vm.selectData.length &&
                _vm.selectData.includes(item.title) &&
                _vm.standardAnswer.some(function (i) {
                  return i.title === item.title
                }),
              isFalse:
                _vm.isAnswer &&
                _vm.selectData.length &&
                _vm.selectData.includes(item.title) &&
                _vm.standardAnswer.every(function (i) {
                  return i.title !== item.title
                }),
            },
            attrs: { flex: "" },
            on: {
              click: function ($event) {
                $event.stopPropagation();
                return _vm.select(item.title, $event)
              },
            },
          },
          [
            _c(
              "div",
              { staticClass: "questionSeq" },
              [
                _vm.isAnswer &&
                _vm.selectData.length &&
                _vm.selectData.includes(item.title) &&
                _vm.standardAnswer.some(function (i) {
                  return i.title === item.title
                })
                  ? _c("img", {
                      staticStyle: { "margin-right": "10px" },
                      attrs: {
                        src: __$_require_static_images_leaflet_icons_correct_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                _vm.isAnswer &&
                _vm.selectData.length &&
                _vm.selectData.includes(item.title) &&
                _vm.standardAnswer.every(function (i) {
                  return i.title !== item.title
                })
                  ? _c("img", {
                      staticStyle: { "margin-right": "10px" },
                      attrs: {
                        src: __$_require_static_images_leaflet_icons_error_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                !_vm.readonly && !_vm.isAnswer
                  ? _c(
                      "el-checkbox",
                      {
                        attrs: { value: _vm.selectData.includes(item.title) },
                        nativeOn: {
                          click: function ($event) {
                            _vm.SkipProgress(
                              $event,
                              item.title,
                              _vm.selectData.includes(item.title)
                            );
                          },
                        },
                      },
                      [_vm._v(_vm._s(""))]
                    )
                  : _vm._e(),
              ],
              1
            ),
            _vm._v(" "),
            _vm.showTitle
              ? _c(
                  "div",
                  {
                    staticClass: "questionSeq",
                    staticStyle: { "margin-right": "2px" },
                  },
                  [
                    _vm._v(
                      "\n        " +
                        _vm._s(_vm.serialNumber[index]) +
                        "\n      "
                    ),
                  ]
                )
              : _vm._e(),
            _vm._v(" "),
            _c("bc-view-common", {
              attrs: {
                "flex-box": "1",
                border: false,
                content: item.content,
                fileInfo: item.fileInfo,
                resourceBasisPath: _vm.resourceBasisPath,
                pageType: _vm.pageType,
              },
            }),
          ],
          1
        )
      }),
      0
    ),
    _vm._v(" "),
    _vm.isSubmit
      ? _c(
          "div",
          {
            staticClass: "mt-4",
            staticStyle: {
              display: "flex",
              "justify-content": "flex-end",
              "text-align": "center",
              "margin-top": "12px",
            },
          },
          [
            !_vm.selectData || !_vm.isAnswer
              ? _c(
                  "div",
                  {
                    staticClass: "xml-submit-answer",
                    on: { click: _vm.submitAnswer },
                  },
                  [_vm._v("提交作答")]
                )
              : _c(
                  "div",
                  {
                    staticClass: "xml-submit-answer",
                    on: {
                      click: function ($event) {
                        return _vm.afresh()
                      },
                    },
                  },
                  [_vm._v("重新作答")]
                ),
          ]
        )
      : _vm._e(),
  ])
};
var __vue_staticRenderFns__$5R = [];
__vue_render__$5R._withStripped = true;

  /* style */
  const __vue_inject_styles__$5R = undefined;
  /* scoped */
  const __vue_scope_id__$5R = "data-v-2c28041a";
  /* module identifier */
  const __vue_module_identifier__$5R = undefined;
  /* functional template */
  const __vue_is_functional_template__$5R = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5R = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5R, staticRenderFns: __vue_staticRenderFns__$5R },
    __vue_inject_styles__$5R,
    __vue_script__$5R,
    __vue_scope_id__$5R,
    __vue_is_functional_template__$5R,
    __vue_module_identifier__$5R,
    false,
    undefined,
    undefined,
    undefined
  );

//
const lowercaseStr$1 = 'abcdefghijklmnopqrstuvwxyz'.split('');
const uppercaseStr$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
const colors$1 = ['rgba(240,63,36,0.55)', 'rgba(92,34,35,0.42)', 'rgba(240,124,130,0.7)', 'rgba(122,115,116,0.76)', 'rgba(238,184,195,0.8)', 'rgba(99,7,28,0.62)', 'rgba(126,22,113,0.56)', 'rgba(46,49,124,0.68)', '#61649f', '#0f59a4', '#619ac3', '#c4cbcf', '#22a2c3', '#21373d', '#12a182', '#1a3b32', '#41ae3c', '#bec936', '#fed71a', '#ffa60f', '#4d4030', '#954416', '#363433', '#652b1c', '#ed3333'];
var script$5Q = {
  name: 'bc-line-question-answer',
  components: {
    BcViewCommon: __vue_component__$5T
  },
  props: {
    options: {
      type: Array,
      default: () => []
    },
    readonly: {
      type: Boolean,
      default: false
    },
    answer: {
      type: Object,
      default: () => {}
    },
    mobile: {
      type: Boolean,
      default: false
    }
  },
  watch: {
    options: {
      handler(val) {
        console.log(val);
        this.optionsList = val.map(i => i.map(x => ({
          ...x
        })));
      },
      immediate: true
    },
    optionsList: {
      handler(val) {
        // this.loadLine()
      },
      immediate: true,
      deep: true
    },
    answer: {
      handler(val) {
        if (val.answerResults) {
          let str = val.answerResults.split(';');
          str.forEach(i => {
            let [left, right] = i.split('');
            this.selectRight.push(right || '');
            this.selectLeft.push(left || '');
          });
        }
      },
      immediate: true,
      deep: true
    }
  },
  data() {
    return {
      lowercaseStr: lowercaseStr$1,
      uppercaseStr: uppercaseStr$1,
      optionsList: [],
      instance: null,
      id: '',
      colors: colors$1,
      clickLeft: '',
      clickRight: '',
      selectLeft: [],
      selectRight: []
    };
  },
  created() {
    this.id = v4() + '--line';
  },
  mounted() {
    // this.loadLine()
  },
  methods: {
    getOptionsStyle(index, option) {
      if (this.readonly) {
        if (this.answer.answerSituation === '1') {
          if (index === 0) {
            if (colors$1[this.selectLeft.indexOf(option.title)]) {
              return {
                background: colors$1[this.selectLeft.indexOf(option.title)] + ' !important',
                border: '1px solid #70B603'
              };
            } else {
              return {
                background: '#FBFBFB'
              };
            }
          } else {
            if (colors$1[this.selectRight.indexOf(option.title)]) {
              return {
                background: colors$1[this.selectRight.indexOf(option.title)] + ' !important',
                border: '1px solid #70B603'
              };
            } else {
              return {
                background: '#FBFBFB'
              };
            }
          }
        } else {
          if (index === 0) {
            if (colors$1[this.selectLeft.indexOf(option.title)]) {
              return {
                background: colors$1[this.selectLeft.indexOf(option.title)] + ' !important',
                border: '1px solid #D9001B'
              };
            } else {
              return {
                background: '#FBFBFB',
                border: '1px solid #D9001B'
              };
            }
          } else {
            if (colors$1[this.selectRight.indexOf(option.title)]) {
              return {
                background: colors$1[this.selectRight.indexOf(option.title)] + ' !important',
                border: '1px solid #D9001B'
              };
            } else {
              return {
                background: '#FBFBFB',
                border: '1px solid #D9001B'
              };
            }
          }
        }
      } else {
        if (index === 0) {
          if (colors$1[this.selectLeft.indexOf(option.title)]) {
            return {
              background: colors$1[this.selectLeft.indexOf(option.title)] + ' !important'
            };
          } else {
            return {
              background: '#FBFBFB'
            };
          }
        } else {
          if (colors$1[this.selectRight.indexOf(option.title)]) {
            return {
              background: colors$1[this.selectRight.indexOf(option.title)] + ' !important'
            };
          } else {
            return {
              background: '#FBFBFB'
            };
          }
        }
      }
    },
    clickOptions(event, options, idx, type) {
      if (this.readonly) return;
      if (type === 'left') {
        this.clickLeft = options.title;
        let haveIndex = this.selectLeft.findIndex(i => i === options.title);
        if (haveIndex > -1) {
          this.$set(this.selectLeft, haveIndex, '');
          this.$set(this.selectRight, haveIndex, '');
        } else {
          let emptyIndex = this.selectLeft.findIndex(i => i === '');
          if (emptyIndex > -1) {
            this.$set(this.selectLeft, emptyIndex, options.title);
          } else {
            this.selectLeft.push(options.title);
          }
        }
      } else {
        this.clickRight = options.title;
        let haveIndex = this.selectRight.findIndex(i => i === options.title);
        if (haveIndex > -1) {
          this.$set(this.selectLeft, haveIndex, '');
          this.$set(this.selectRight, haveIndex, '');
        } else {
          let emptyIndex = this.selectRight.findIndex(i => i === '');
          if (emptyIndex > -1) {
            this.$set(this.selectRight, emptyIndex, options.title);
          } else {
            this.selectRight.push(options.title);
          }
        }
      }
      let obj = {};
      let str = '';
      this.selectLeft.forEach((i, index) => {
        let iTitle = this.optionsList.find(o => o[0].title === i);
        if (iTitle && iTitle.length) {
          let right = this.selectRight[index];
          let iValue = '';
          if (right) {
            let title = this.optionsList.find(o => o[1].title === right);
            iValue = title ? title[1].title : '';
          }
          obj[iTitle[0].title] = iValue;
        }
      });
      str = Object.keys(obj).map(key => `${key}${obj[key]}`).join(';');
      this.$emit('change', str);
    }
  }
};

/* script */
const __vue_script__$5Q = script$5Q;
/* template */
var __vue_render__$5Q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      ref: "line",
      staticClass: "line-content",
      staticStyle: { width: "100%" },
      attrs: { id: _vm.id },
    },
    _vm._l(_vm.optionsList, function (item, idx) {
      return _c(
        "div",
        { key: idx, staticClass: "line-content--item", attrs: { flex: "" } },
        _vm._l(item, function (option, index) {
          return _c(
            "div",
            {
              key: index,
              staticClass: "option-item",
              class: { isMobile: _vm.mobile },
              style: _vm.getOptionsStyle(index, option),
              attrs: { flex: "", name: index === 0 ? "source" : "target" },
              on: {
                click: function ($event) {
                  return _vm.clickOptions(
                    $event,
                    option,
                    idx,
                    index === 0 ? "left" : "right"
                  )
                },
              },
            },
            [
              _c(
                "div",
                {
                  staticClass: "questionSeq",
                  staticStyle: { "margin-right": "10px" },
                },
                [
                  _vm._v(
                    _vm._s(
                      index === 0
                        ? _vm.uppercaseStr[idx]
                        : _vm.lowercaseStr[idx]
                    ) + "\n      "
                  ),
                ]
              ),
              _vm._v(" "),
              _c("bc-view-common", {
                staticStyle: { flex: "1", "min-width": "0" },
                attrs: {
                  placeholder: "点击编辑选项",
                  border: false,
                  content: option.content,
                  fileInfo: option.fileInfo,
                  mobile: _vm.mobile,
                  isLineFile: _vm.mobile,
                },
              }),
            ],
            1
          )
        }),
        0
      )
    }),
    0
  )
};
var __vue_staticRenderFns__$5Q = [];
__vue_render__$5Q._withStripped = true;

  /* style */
  const __vue_inject_styles__$5Q = undefined;
  /* scoped */
  const __vue_scope_id__$5Q = "data-v-115d2322";
  /* module identifier */
  const __vue_module_identifier__$5Q = undefined;
  /* functional template */
  const __vue_is_functional_template__$5Q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5Q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5Q, staticRenderFns: __vue_staticRenderFns__$5Q },
    __vue_inject_styles__$5Q,
    __vue_script__$5Q,
    __vue_scope_id__$5Q,
    __vue_is_functional_template__$5Q,
    __vue_module_identifier__$5Q,
    false,
    undefined,
    undefined,
    undefined
  );

//
const lowercaseStr = "abcdefghijklmnopqrstuvwxyz".split("");
const uppercaseStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
const colors = ['rgba(240,63,36,0.55)', 'rgba(92,34,35,0.42)', 'rgba(240,124,130,0.7)', 'rgba(122,115,116,0.76)', 'rgba(238,184,195,0.8)', 'rgba(99,7,28,0.62)', 'rgba(126,22,113,0.56)', 'rgba(46,49,124,0.68)', '#61649f', '#0f59a4', '#619ac3', '#c4cbcf', '#22a2c3', '#21373d', '#12a182', '#1a3b32', '#41ae3c', '#bec936', '#fed71a', '#ffa60f', '#4d4030', '#954416', '#363433', '#652b1c', '#ed3333'];
var script$5P = {
  name: 'bc-line-question-view-line',
  components: {
    BcViewCommon: __vue_component__$5T
  },
  props: {
    options: {
      type: Array,
      default: () => []
    },
    mobile: {
      type: Boolean,
      default: false
    }
  },
  watch: {
    options: {
      handler(val) {
        this.optionsList = val.map(i => i.map(x => ({
          ...x,
          id: v4()
        })));
      },
      immediate: true
    },
    optionsList: {
      handler(val) {
        let left = val.map(i => i[0].title);
        let right = val.map(i => i[1].title);
        this.left = left;
        this.right = right;
        // this.loadLine()
      },
      immediate: true,
      deep: true
    }
  },
  data() {
    return {
      lowercaseStr,
      uppercaseStr,
      optionsList: [],
      instance: null,
      id: '',
      colors,
      left: [],
      right: []
    };
  },
  created() {
    this.id = v4() + '--line';
  },
  mounted() {
    // this.loadLine()
  },
  methods: {
    getOptionsStyle(index, option) {
      if (index === 0) {
        this.colors[this.left.indexOf(option.title)];
        return {
          background: colors[this.left.indexOf(option.title)] + ' !important'
        };
      } else {
        let colorIndex = this.left.indexOf(option.title.toLocaleUpperCase());
        return {
          background: colors[colorIndex] + ' !important'
        };
      }
    },
    loadLine() {
      // this.$nextTick(() => {
      //   let contents = XEUtils.flatten(XEUtils.flatten(this.optionsList.map(i => i.map(x => this.getImgSrc(x.content)))))
      //
      //   let promiseAll = []
      //
      //   let img = []
      //   for (let i = 0; i < contents.length; i++) {
      //     promiseAll[i] = new Promise((resolve, reject) => {
      //       img[i] = new Image();
      //       img[i].src = contents[i];
      //       img[i].onload = function() {
      //         resolve(this);
      //       };
      //     });
      //   }
      //   if (promiseAll.length) {
      //     Promise.all(promiseAll).then(img => {
      //       this.init()
      //     });
      //   } else {
      //     setTimeout(() => {
      //       this.init()
      //     }, 500)
      //   }
      //
      // })
    },
    getImgSrc(rich) {
      let imgList = [];
      rich.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, (match, capture) => {
        imgList.push(capture);
      });
      return imgList;
    },
    init() {
      this.instance = jsPlumb.getInstance({
        Container: this.id,
        EndpointStyle: {
          radius: 0.11,
          fill: '#999'
        },
        PaintStyle: {
          stroke: '#999',
          strokeWidth: 2
        },
        // 绘画样式，默认8px线宽  #456
        HoverPaintStyle: {
          stroke: '#994B0A',
          strokeWidth: 3
        },
        // 默认悬停样式  默认为null
        ConnectionOverlays: [
        // 此处可以设置所有箭头的样式
        ['Arrow', {
          // 设置参数可以参考中文文档
          location: 1,
          length: 12,
          paintStyle: {
            stroke: '#999',
            fill: '#999'
          },
          visible: false
        }]],
        Connector: ['Straight'],
        // 要使用的默认连接器的类型：直线，折线，曲线等
        DrapOptions: {
          cursor: 'crosshair',
          zIndex: 2000
        }
      });
      this.instance.batch(() => {
        for (let i = 0; i < this.optionsList.length; i++) {
          this.initElement(this.optionsList[i][0], 'source');
          this.initElement(this.optionsList[i][1], 'target');
        }
      });
      this.setjsPlumb(true, true);
      this.instance.ready(() => {
        this.setConnect();
      });
    },
    setConnect() {
      let left = this.optionsList.map(i => i[0]);
      let right = this.optionsList.map(i => i[1]);
      left.forEach(el => {
        let rightIndex = right.findIndex(i => i.title === el.title.toLocaleLowerCase());
        this.instance.connect({
          source: el.id + '-' + el.title,
          target: right[rightIndex].id + '-' + right[rightIndex].title
        });
      });
    },
    initElement(option, type) {
      const ins = this.instance;
      const elem = document.getElementById(option.id + '-' + option.title);
      if (type === 'source') {
        ins.makeSource(elem, {
          anchor: [1, 0.5, 0, 0],
          // 左 上 右 下
          allowLoopback: false,
          // 允许回连
          maxConnections: 1 // 最大连接数（-1表示不限制）
        });
      } else {
        ins.makeTarget(elem, {
          anchor: [0, 0.5, 0, 0],
          allowLoopback: false,
          maxConnections: 1
        });
      }
    },
    setjsPlumb(sourceFlag, targetFlag) {
      const source = document.getElementsByName('source');
      const target = document.getElementsByName('target');
      this.instance.setSourceEnabled(source, sourceFlag);
      this.instance.setTargetEnabled(target, targetFlag);
      this.instance.setDraggable(source, false); // 是否支持拖拽
      this.instance.setDraggable(target, false); // 是否支持拖拽
    }
  }
};

/* script */
const __vue_script__$5P = script$5P;
/* template */
var __vue_render__$5P = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      ref: "line",
      staticClass: "line-content",
      staticStyle: { width: "100%" },
      attrs: { id: _vm.id },
    },
    _vm._l(_vm.optionsList, function (item, idx) {
      return _c(
        "div",
        { key: idx, staticClass: "line-content--item", attrs: { flex: "" } },
        _vm._l(item, function (option, index) {
          return _c(
            "div",
            {
              key: index,
              staticClass: "option-item",
              class: { isMobile: _vm.mobile },
              style: _vm.getOptionsStyle(index, option),
              attrs: {
                flex: "",
                id: option.id + "-" + option.title,
                name: index === 0 ? "source" : "target",
              },
            },
            [
              _c(
                "div",
                {
                  staticClass: "questionSeq",
                  staticStyle: { "margin-right": "10px" },
                },
                [
                  _vm._v(
                    "\n        " +
                      _vm._s(
                        index === 0
                          ? _vm.uppercaseStr[idx]
                          : _vm.lowercaseStr[idx]
                      ) +
                      "\n      "
                  ),
                ]
              ),
              _vm._v(" "),
              _c("bc-view-common", {
                staticStyle: { flex: "1", "min-width": "0" },
                attrs: {
                  placeholder: "点击编辑选项",
                  border: false,
                  content: option.content,
                  fileInfo: option.fileInfo,
                  mobile: _vm.mobile,
                  isLineFile: _vm.mobile,
                },
              }),
            ],
            1
          )
        }),
        0
      )
    }),
    0
  )
};
var __vue_staticRenderFns__$5P = [];
__vue_render__$5P._withStripped = true;

  /* style */
  const __vue_inject_styles__$5P = undefined;
  /* scoped */
  const __vue_scope_id__$5P = "data-v-4508580a";
  /* module identifier */
  const __vue_module_identifier__$5P = undefined;
  /* functional template */
  const __vue_is_functional_template__$5P = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5P = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5P, staticRenderFns: __vue_staticRenderFns__$5P },
    __vue_inject_styles__$5P,
    __vue_script__$5P,
    __vue_scope_id__$5P,
    __vue_is_functional_template__$5P,
    __vue_module_identifier__$5P,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5O = {
  name: 'XmlQuestionItem',
  components: {
    BcViewOptionCheckbox: __vue_component__$5R,
    BcViewOptionRadio: __vue_component__$5S,
    BcViewCommon: __vue_component__$5T,
    bcLineQuestionAnswer: __vue_component__$5Q,
    bcLineQuestionViewLine: __vue_component__$5P
  },
  // dicts: ['question_type'],
  data() {
    return {
      // isShowAnalysis: false,
      // isShowAnswer: false,
      // isShowKnowledge: false,
      inputAnswer: '',
      dict: {
        label: {
          question_type: {
            1: '单选题',
            2: '多选题',
            3: '判断题',
            13: '简答题'
          }
        }
      },
      isAnswer: false,
      serialNumber: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    };
  },
  props: {
    question: Object,
    canShowAnswer: String,
    canShowAnalysis: String,
    canShowKnowledge: String,
    inKey: String,
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    border: {
      type: Boolean,
      default: false
    },
    isSubmit: {
      //是否显示提交作答按钮
      type: Boolean,
      default: true
    },
    questionNumber: {
      type: Number,
      default: 0
    },
    isShowAi: {
      type: String,
      default: '1'
    },
    aiType: {
      type: String,
      default: 'null'
    },
    analyzeTheBackground: {
      type: String,
      default: ''
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'h5'
    },
    answerRecordList: {
      type: Array,
      default: () => []
    }
  },
  provide: function () {
    return {
      inKey: this.inKey
    };
  },
  mounted() {
    console.log(this.question);
  },
  computed: {
    isShowAnalysis() {
      return this.isAnswer && this.canShowAnalysis === 'true';
    },
    isShowAnswer() {
      return this.isAnswer && this.canShowAnswer === 'true';
    },
    isShowKnowledge() {
      return this.isAnswer && this.canShowKnowledge === 'true';
    },
    isRadio() {
      return isRadio$1(String(this.question.questionType));
    },
    isCheck() {
      return isCheck$1(String(this.question.questionType));
    },
    showJudgeAnswer() {
      return showJudgeAnswer$1(String(this.question.questionType));
    },
    showRichTextAnswer() {
      return showRichTextAnswer$1(String(this.question.questionType));
    },
    showOptions() {
      return showOptions$1(String(this.question.questionType));
    },
    showSort() {
      return showSort$1(String(this.question.questionType));
    },
    isCloze() {
      return isCloze$1(String(this.question.questionType));
    },
    clozeLength() {
      this.question.stem.content.match(/fillInTheBlanksSpan/g);
      this.question.stem.content.match(/\((.+?)\)/g);
      // console.log( fillInTheBlanks,fillInTheBlanksSpan,'fillInTheBlanksSpanfillInTheBlanksSpanfillInTheBlanksSpan');
      let sortString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
      // let data = fillInTheBlanksSpan ? fillInTheBlanksSpan.length : fillInTheBlanks
      let data = this.question.standardAnswer.length;
      let list = [];
      for (let i = 0; i < data; i++) {
        list.push({
          content: '',
          title: sortString.split('')[i]
        });
      }
      // return fillInTheBlanksSpan ? fillInTheBlanksSpan.length : 0
      return list;
    },
    standardAnswer() {
      try {
        let answerTitle = '';
        if (!this.showRichTextAnswer) {
          if (this.showOptions) {
            answerTitle = this.question.standardAnswer.map(i => i.title).join('、');
          } else if (this.showJudgeAnswer) {
            answerTitle = this.question.standardAnswer.map(i => i).join('、');
          } else if (this.showSort) {
            let questionOption = xeUtils.clone(this.question.questionOption, true);
            answerTitle = questionOption.sort((c, n) => c.index - n.index).map(i => i.title).join('、');
          }
        }
        return answerTitle;
      } catch (e) {
        console.log('异常：', e);
        return '';
      }
    },
    answerRecord() {
      let answer = this.answerRecordList.find(i => i.questionId === this.questionInfo.id);
      let data = {
        answerResults: '',
        answerSituation: '0'
      };
      if (answer) {
        data.answerResults = answer.answerResults;
        data.answerSituation = answer.answerSituation;
      }
      return data;
    }
  },
  methods: {
    showAnalysis(answer) {
      if (!this.showRichTextAnswer) {
        this.isAnswer = true;
        let params = {
          ...answer,
          pass: answer,
          question: this.question
        };
        this.$emit('submitAnswer', params);
      } else {
        this.isAnswer = true;
      }
    },
    showAnalysis2(answer) {
      if (answer.questionType == 'shortSnswer' && this.isSubmit) {
        if (!answer.userAnswer) {
          this.$message.error('请先输入答案');
          return;
        }
      } else if (answer.questionType == 'fillInTheBlanks' && this.isSubmit && !this.question.isHorizontalAnswer) {
        for (let i = 0; i < this.clozeLength.length; i++) {
          if (!this.clozeLength[i].content) {
            this.$message.error('请先输入答案');
            return;
          }
        }
      }
      // console.log(answer,'showAnalysis2')
      this.isAnswer = true;
      let params = {
        ...answer,
        pass: answer,
        question: this.question
      };
      this.$emit('submitAnswer', params);
    },
    afresh(questionType) {
      this.isAnswer = false;
      if (questionType == 'shortSnswer') {
        this.inputAnswer = '';
      } else if (questionType == 'fillInTheBlanks') {
        for (let i = 0; i < this.clozeLength.length; i++) {
          this.clozeLength[i].content = '';
        }
      }
    },
    //
    changeAnswer() {
      if (this.isRadio || this.showJudgeAnswer) {
        this.$refs.bcViewOptionRadio?.submitAnswer();
      }
      if (this.isCheck) {
        this.$refs.bcViewOptionCheckbox?.submitAnswer();
      }
      if (this.showRichTextAnswer && !this.isCloze) {
        this.showAnalysis2({
          questionId: this.question.id,
          questionName: JSON.stringify(this.question.stem),
          userAnswer: this.inputAnswer,
          questionType: 'shortSnswer'
        });
      }
      if (this.isCloze) {
        this.showAnalysis2({
          questionId: this.question.id,
          questionName: JSON.stringify(this.question.stem),
          userAnswer: this.clozeLength,
          questionType: 'fillInTheBlanks'
        });
      }
    },
    // AIanalysis(){
    //   let params = {
    //       questionOption: JSON.stringify(this.question.questionOption),
    //       questionName: JSON.stringify(this.question.stem)
    //   }
    //   this.$emit('setanalysis', params)
    // },
    AIanalysis() {
      let serialNumber = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T'];
      let option = '';
      let question = this.question.stem.content;
      let optionList = this.question.questionOption;
      for (let i = 0; i < optionList.length; i++) {
        if (optionList[i].content) {
          option += serialNumber[i] + '.' + this.removeStyle(optionList[i].content) + (i < optionList.length - 1 ? ';' : '');
        }
      }
      if (this.question.questionType == '3') {
        option = 'A.正确;B.错误';
      }
      const data = {
        type: 'AiAnalysis',
        value: this.removeStyle(question) + option,
        code: 'success',
        aiType: this.aiType
      };
      this.$emit('setanalysis', data);
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      }
    },
    getPaperList(list) {
      if (list.length > 0) {
        let answerList = [];
        list.map(item => {
          if (typeof item == 'string') {
            let data = {
              selected: false,
              ...JSON.parse(item)
            };
            answerList.push(data);
          } else {
            this.$set(item, 'selected', false);
            answerList = list;
          }
        });
        return answerList;
      }
    },
    processTemplate(content) {
      if (this.mode == 'editor' || !this.question.isHorizontalAnswer) {
        return content;
      }
      if (content) {
        return content.replace(/<span class="fillInTheBlanksSpan[^>]*>/g, function (match) {
          if (!match.includes('contenteditable')) {
            return match.replace('>', ' contenteditable="true">');
          }
          return match;
        });
      } else {
        return '';
      }
    }
  }
};

var __$_require_static_images_leaflet_icons_ai_png__ = "data:image/png;base64,[encoded data, 6100 characters]";

/* script */
const __vue_script__$5O = script$5O;
var __vue_render__$5O = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", [
    _c(
      "div",
      {
        staticClass: "group-content",
        class: _vm.border ? "border-bottom" : "",
      },
      [
        _c("div", { staticClass: "group-content-box" }, [
          _c("div", { staticClass: "stem" }, [
            _c(
              "div",
              { staticClass: "stem-box", staticStyle: { display: "flex" } },
              [
                _c("bc-view-common", {
                  staticClass: "xml-question-title",
                  staticStyle: { flex: "1", "min-width": "0" },
                  attrs: {
                    content: _vm.processTemplate(_vm.question.stem.content),
                    border: false,
                    fileInfo: _vm.question.stem.fileInfo,
                    resourceBasisPath: _vm.resourceBasisPath,
                    isSubmit: _vm.isSubmit,
                    pageType: _vm.pageType,
                  },
                }),
              ],
              1
            ),
          ]),
        ]),
        _vm._v(" "),
        _vm.isRadio
          ? _c(
              "div",
              { staticClass: "mt-4" },
              [
                _c("bc-view-option-radio", {
                  ref: "bcViewOptionRadio",
                  attrs: {
                    standardAnswer: _vm.question.standardAnswer,
                    option: _vm.question.questionOption,
                    resourceBasisPath: _vm.resourceBasisPath,
                    isSubmit: _vm.isSubmit,
                    pageType: _vm.pageType,
                  },
                  on: { showAnalysis: _vm.showAnalysis, afresh: _vm.afresh },
                }),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.isCheck
          ? _c(
              "div",
              { staticClass: "mt-4" },
              [
                _c("bc-view-option-checkbox", {
                  ref: "bcViewOptionCheckbox",
                  attrs: {
                    option: _vm.question.questionOption,
                    standardAnswer: _vm.question.standardAnswer,
                    resourceBasisPath: _vm.resourceBasisPath,
                    isSubmit: _vm.isSubmit,
                    pageType: _vm.pageType,
                  },
                  on: { showAnalysis: _vm.showAnalysis, afresh: _vm.afresh },
                }),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.showRichTextAnswer && !_vm.isCloze
          ? _c(
              "div",
              {
                staticClass: "mt-4",
                staticStyle: { display: "flex", "flex-direction": "column" },
              },
              [
                _c("el-input", {
                  attrs: {
                    type: "textarea",
                    placeholder: "请输入您的回答",
                    autosize: { minRows: 2, maxRows: 8 },
                  },
                  model: {
                    value: _vm.inputAnswer,
                    callback: function ($$v) {
                      _vm.inputAnswer = $$v;
                    },
                    expression: "inputAnswer",
                  },
                }),
                _vm._v(" "),
                !_vm.isAnswer & _vm.isSubmit
                  ? _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            _vm.showAnalysis2({
                              questionId: _vm.question.id,
                              questionName: JSON.stringify(_vm.question.stem),
                              userAnswer: _vm.inputAnswer,
                              questionType: "shortSnswer",
                            });
                          },
                        },
                      },
                      [_vm._v("\n        提交作答\n      ")]
                    )
                  : _vm.isAnswer & _vm.isSubmit
                  ? _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            return _vm.afresh("shortSnswer")
                          },
                        },
                      },
                      [_vm._v("\n        重新作答\n      ")]
                    )
                  : _vm._e(),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.showJudgeAnswer
          ? _c(
              "div",
              [
                _c("bc-view-option-radio", {
                  ref: "bcViewOptionRadio",
                  attrs: {
                    standardAnswer: _vm.question.standardAnswer,
                    resourceBasisPath: _vm.resourceBasisPath,
                    pageType: _vm.pageType,
                    isSubmit: _vm.isSubmit,
                    type: "judge",
                    option: [
                      { title: "A", content: "正确" },
                      { title: "B", content: "错误" },
                    ],
                  },
                  on: { showAnalysis: _vm.showAnalysis, afresh: _vm.afresh },
                }),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.isCloze
          ? _c(
              "div",
              [
                !this.question.isHorizontalAnswer
                  ? _vm._l(_vm.clozeLength, function (item, index) {
                      return _c("div", { key: index, staticClass: "isTrue" }, [
                        _c("input", {
                          directives: [
                            {
                              name: "model",
                              rawName: "v-model",
                              value: item.content,
                              expression: "item.content",
                            },
                          ],
                          staticClass: "answer-cloze-input",
                          attrs: {
                            maxlength: "100",
                            placeholder: "请输入...",
                            type: "text",
                          },
                          domProps: { value: item.content },
                          on: {
                            input: function ($event) {
                              if ($event.target.composing) {
                                return
                              }
                              _vm.$set(item, "content", $event.target.value);
                            },
                          },
                        }),
                      ])
                    })
                  : _vm._e(),
                _vm._v(" "),
                !_vm.isAnswer && _vm.isSubmit
                  ? _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            _vm.showAnalysis2({
                              questionId: _vm.question.id,
                              questionName: JSON.stringify(_vm.question.stem),
                              userAnswer: _vm.clozeLength,
                              questionType: "fillInTheBlanks",
                            });
                          },
                        },
                      },
                      [_vm._v("\n        提交作答\n      ")]
                    )
                  : _vm.isAnswer & _vm.isSubmit
                  ? _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            return _vm.afresh("fillInTheBlanks")
                          },
                        },
                      },
                      [_vm._v("\n        重新作答\n      ")]
                    )
                  : _vm._e(),
              ],
              2
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.question.questionType == 6
          ? _c(
              "div",
              [
                _c("bc-line-question-answer", {
                  key: _vm.question.id,
                  ref: "bcLineQuestionAnswer",
                  attrs: {
                    options: _vm.question.questionOption,
                    mobile: _vm.pageType == "pc" ? false : true,
                    answer: _vm.answerRecord,
                  },
                  on: {
                    change: function (e) {
                      return (_vm.inputAnswer = e)
                    },
                  },
                }),
                _vm._v(" "),
                !_vm.isAnswer
                  ? _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            _vm.showAnalysis2({
                              questionId: _vm.question.id,
                              questionName: JSON.stringify(_vm.question.stem),
                              userAnswer: _vm.inputAnswer,
                              questionType: "line",
                            });
                          },
                        },
                      },
                      [_vm._v("\n        提交作答\n      ")]
                    )
                  : _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            return _vm.afresh("line")
                          },
                        },
                      },
                      [_vm._v("重新作答")]
                    ),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.isShowAnswer
          ? _c("div", [
              !_vm.showRichTextAnswer
                ? _c("div", { staticClass: "mt-6" }, [
                    _c(
                      "div",
                      {
                        staticStyle: {
                          display: "flex",
                          "flex-direction": "column",
                        },
                      },
                      [
                        _c("div", { staticClass: "question-label" }, [
                          _vm._v(
                            _vm._s(
                              _vm.question.questionType == 13
                                ? "参考答案:"
                                : "正确答案："
                            )
                          ),
                        ]),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            staticStyle: {
                              color: "#0070c1",
                              "min-width": "0",
                              flex: "1",
                              "line-height": "28px",
                              padding: "8px",
                              "border-radius": "6px",
                              "background-color": "#f5f5f5",
                            },
                          },
                          [
                            _vm.question.questionType == 6
                              ? [
                                  _c("bc-line-question-view-line", {
                                    key: _vm.question.id,
                                    attrs: {
                                      options: _vm.question.questionOption,
                                      mobile:
                                        _vm.pageType == "pc" ? false : true,
                                    },
                                  }),
                                ]
                              : _vm.question.questionType == 3
                              ? [
                                  _c("span", [
                                    _vm._v(
                                      "\n                " +
                                        _vm._s(_vm.standardAnswer) +
                                        "\n              "
                                    ),
                                  ]),
                                ]
                              : _vm._l(
                                  _vm.getPaperList(_vm.question.questionOption),
                                  function (item, index) {
                                    return _c(
                                      "span",
                                      {
                                        directives: [
                                          {
                                            name: "show",
                                            rawName: "v-show",
                                            value: _vm.standardAnswer.includes(
                                              item.title
                                            ),
                                            expression:
                                              "standardAnswer.includes(item.title)",
                                          },
                                        ],
                                        key: index,
                                      },
                                      [
                                        _vm._v(
                                          "\n                " +
                                            _vm._s(_vm.serialNumber[index]) +
                                            "\n              "
                                        ),
                                      ]
                                    )
                                  }
                                ),
                          ],
                          2
                        ),
                      ]
                    ),
                  ])
                : _c("div", { staticClass: "mt-6" }, [
                    _c(
                      "div",
                      {
                        staticStyle: {
                          display: "flex",
                          "flex-direction": "column",
                        },
                      },
                      [
                        _c("div", { staticClass: "question-label" }, [
                          _vm._v(
                            _vm._s(
                              _vm.question.questionType == 13
                                ? "参考答案:"
                                : "正确答案："
                            )
                          ),
                        ]),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            staticStyle: {
                              flex: "1",
                              "min-width": "0",
                              padding: "8px",
                              "border-radius": "6px",
                              "background-color": "#f5f5f5",
                            },
                          },
                          [
                            _c("bc-view-common", {
                              staticStyle: { flex: "1", "min-width": "0" },
                              attrs: {
                                content: _vm.question.standardAnswer.content,
                                standardAnswer:
                                  _vm.question.questionType == 10
                                    ? _vm.question.standardAnswer
                                    : [],
                                border: false,
                                fileInfo: _vm.question.standardAnswer.fileInfo,
                                resourceBasisPath: _vm.resourceBasisPath,
                                isSubmit: _vm.isSubmit,
                                pageType: _vm.pageType,
                              },
                            }),
                          ],
                          1
                        ),
                      ]
                    ),
                  ]),
            ])
          : _vm._e(),
        _vm._v(" "),
        _vm.isShowAnalysis &&
        _vm.question.analysis &&
        (_vm.question.analysis.content ||
          (_vm.question.analysis.fileInfo &&
            _vm.question.analysis.fileInfo.fileUrl))
          ? _c(
              "div",
              {
                staticClass: "mt-6 flex-direction-column",
                attrs: { flex: "" },
              },
              [
                _c(
                  "div",
                  {
                    staticClass: "question-label",
                    staticStyle: { "line-height": "40px" },
                  },
                  [_vm._v("解析：")]
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    staticClass: "stem",
                    class: {
                      "analysis-content": _vm.analyzeTheBackground != "false",
                    },
                    staticStyle: {
                      "min-width": "0",
                      flex: "1",
                      padding: "8px",
                      "border-radius": "6px",
                    },
                  },
                  [
                    _c("bc-view-common", {
                      attrs: {
                        border: false,
                        content: _vm.question.analysis.content,
                        fileInfo: _vm.question.analysis.fileInfo,
                        resourceBasisPath: _vm.resourceBasisPath,
                        isSubmit: _vm.isSubmit,
                        pageType: _vm.pageType,
                      },
                    }),
                  ],
                  1
                ),
              ]
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.isShowKnowledge && _vm.question.knowledgePointVoList.length
          ? _c("div", { staticClass: "info-item", attrs: { flex: "" } }, [
              _c("div", { staticClass: "info-item--label" }, [
                _vm._v("知识点："),
              ]),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "info-item--content",
                  staticStyle: { flex: "1" },
                },
                [
                  _vm.question.knowledgePointVoList &&
                  _vm.question.knowledgePointVoList.length
                    ? _vm._l(
                        _vm.question.knowledgePointVoList,
                        function (item) {
                          return _c(
                            "el-tag",
                            {
                              key: item.id,
                              staticStyle: {
                                "margin-right": "8px",
                                "margin-bottom": "8px",
                              },
                              attrs: { effect: "plain" },
                            },
                            [_vm._v(_vm._s(item.kpName))]
                          )
                        }
                      )
                    : [_c("span", [_vm._v("无")])],
                ],
                2
              ),
            ])
          : _vm._e(),
        _vm._v(" "),
        _vm.isShowAi == "0" || _vm.aiType != "null"
          ? _c("div", { staticClass: "AIbtn", on: { click: _vm.AIanalysis } }, [
              _c("img", {
                attrs: {
                  src: __$_require_static_images_leaflet_icons_ai_png__,
                  alt: "",
                },
              }),
            ])
          : _vm._e(),
      ]
    ),
  ])
};
var __vue_staticRenderFns__$5O = [];
__vue_render__$5O._withStripped = true;

  /* style */
  const __vue_inject_styles__$5O = undefined;
  /* scoped */
  const __vue_scope_id__$5O = "data-v-a6e2face";
  /* module identifier */
  const __vue_module_identifier__$5O = undefined;
  /* functional template */
  const __vue_is_functional_template__$5O = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5O = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5O, staticRenderFns: __vue_staticRenderFns__$5O },
    __vue_inject_styles__$5O,
    __vue_script__$5O,
    __vue_scope_id__$5O,
    __vue_is_functional_template__$5O,
    __vue_module_identifier__$5O,
    false,
    undefined,
    undefined,
    undefined
  );

const radioType = ['SingleSelect'];
const checkType = ['MultipleSelect'];
const showOptionsType = ['1', '2', '4', '5'];
const showJudgeAnswerType = ['Judgement'];
const showSortType = ['7'];
const showRichTextAnswerType = ['AskAnswer', 'Filling'];
const isclozeType = ['Filling'];
const isRadio = type => {
  return radioType.includes(type);
};
const isCheck = type => checkType.includes(type);
const showOptions = type => showOptionsType.includes(type);
const showJudgeAnswer = type => showJudgeAnswerType.includes(type);
const showSort = type => showSortType.includes(type);
const showRichTextAnswer = type => showRichTextAnswerType.includes(type);
const isCloze = type => isclozeType.includes(type);

var playIcon$3 = "data:image/png;base64,[encoded data, 4152 characters]";

var pauseIcon$2 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAACvBJREFUeF7tnW2MHVUZx//PbHaTtiGQ9IOagCE1pnywInwQElstqUCB1iABPrb2bZ7ZYGo0UWkgiKGm1UQTFbNzbtwV9yOEVC2lLa8l+KFtImDBlCaFGCQYTCRW0y7srvOYczNX9uW+zMuZuTP3PpPc7LZ7znPO839+c2bumWfOIQzgMTU1tWZ2dvYaIloLYG38c6WIND9EtALAyvhjFbhERBftTxFpfjzP+0BEznqed3Z+fv7N0dHRs7t37/5g0OSiujs0PT29amZmZiOArQC+ZAMOYLQgv94norMi8oLneSdmZmZO792796OC2irFbC0BCMPwWiL6CoCb4sCPlKLW8kY+BPA8gFNRFJ0eHx8/3qd+ZG62NgAYY24AsBnAbQDs71U8zovIUc/zjvq+f7SKHVzap0oDUJOgd4pzLWCoJACNRmOLiPjx8F6HE6lXH48BmGLmJ3oVLPvvlQJgAAO/NJ4vichUEATTZQe6U3uVAGAIAr9IfyI6HUVRGATBb/oNQl8BmJiYuNrzvH0A7HA/jMeTnucd2LNnz5/65XzfADDG3AfgfgBX9sv5KrQrIjNEdADAQWaeK7tPpQNgjFkvIvuI6Payna1ye0R0Moqig0EQ/L7MfpYKgDHmAQD7y3Swhm09zMw/LKvfpQBgZ+48z9svIlvKcqzO7YjIISL6LjO/VbQfhQMQhmFARPasX120MwNm/y0Lge/7h4r0q1AAjDGPAdhepANDYLvQS0JhADQajWdE5OYhCFDhLorIZBAEu4toqBAAjDGvALiuiA4Pq00ROR4EgX0Y5vRwDkAYhu8Q0VVOe6nGWgr8hZk/51IOpwAYY2xWjc200aMgBUTk30EQXO7KvDMAjDH/AuCsY64cHFA7/2DmT7jwzQkAxpgzANa56JDaSKYAEb3g+/6mZKU7l8oNgDHmKQB35O2I1k+vgIj8MgiCvelrflwjFwDGmMcB3JOnA1o3twI/YebvZ7WSGQCd5MkqeSH1Mk8WZQIgnt6dKMQVNZpJASK6K8u0cWoA4pRsmwqtc/uZQlVYJfvg6Na0D5BSA9BoNA7rU73CgpjLsH2KGATBXWmMpAJAn+enkbZvZVPdDyQGwGbyAHi5b25pw4kVEJE7k2YWJQYgDMMjmsaVOAZ9LWjTy0Tky0lyDBMBECdwPtpXr7TxtAo8xMyP9KrUE4A4ddsO/UOdvdtLyKr93WYbj4yMbOiVct4TAGOMGeK8/arFNW1/nmTmu7tV6gpA/MbO4bStavnqKCAiO7u9gdQVAGPMHwboBc3qRKXEntjX0Hzf7/g6fUcA9OwvMUoFNyUi2zu9kNoRgCqf/UR0QkROJNDt4QRlkhTpaYeINoqIXaqmisdLzNy2b20BqPrZbwHwfd8uD9PxmJiY2Oh53osuohFF0U3j4+NdgWs0Gi9WGAArw73t1idoC0CVz37riQKQCetjzGyX11l0LAMgXpblZKYmSqqkAGQT2s7kLl27qB0APwDQ85qXrQtuaikA2XRsl0LWDgB79ld1Fa6m5wpANgAAnGfmzy6svQiAOgz/CkDm4LdOnkWXgaUAVH74VwDyAbD0MrAUgMoP/wpAPgCWXgb+D4Ax5noAfVusKI1beg+QRq3lZYlos+/7zWVtFwLwPQA/zme6nNoKQG6dH2Hmh5YCYIm4JbfpEgwoAPlEtqudB0HQfK2sOQJMTk5eNj8/b1/u9PKZLqe2ApBb54/Gxsau2LFjx4dNAMIwvJuIKreObSc3FYDcAEBEbgmC4NkWAL8mol35zZZjQQFwonPzPqAJgDHmdQBOV55w0sUORhSA/Oq2NGwBMFvgNiv5e7vEggLgRNL3mfmTZDdYmpubK3xBQiddjo0oAG7UHBkZWU1hGN5OREfcmCzHigLgRucoitaTMebbAH7mxmQ5VhQANzp7nrfbAhACYDcmy7GiADjT+adUg1y2Zd4qAG4AIKKnLQCnROSLbkyWY0UBcKOziJy0l4BazQFY1xUANwAAOGO/Bdhlydc4M1mCIQXAjchEdN6OAO8B+JQbk+VYUQDc6ExE71kAarfEqwLgBgAAFywAtZoG1nsAZ8G3huYUgAR6DsirYe08bQKgl4AeEAwwAM1LgN4EDi8Af9evgUN8CRCRt3UiaIgBAPCGTgUPMQB2+Rh9GDTcAJzQx8FDDIBNB9WEkOEG4DuaEjbEAIjIHZoUOsQAjI6OfkbTwocXgDlmHtMXQ4YXgDeYeV0LgFolhurj4ATU9i5imDloAWA3frQbQNbiUACchGkLMx9pAjA9Pb1qZmbmAoARJ6YLNqIA5Bb4vytWrLh827ZtFxeuEHIIwJ25TZdgQAHILfLvmPnrzeSaliljjN2D9ue5TZdgQAHILfK3mPkXiwCIN4R8LbfpEgwoAPlEFpEvBEHw50UA2H8YY3SZuDbaDlhG0ClmvrHlpi4UmeBkGjAAFm0sqUvFDh8ANzLzqbYjQF0uA3oPkIDa9kUWDf/L7gFiACq/XrACkBmAZfsK64YRCbQcoHuARcN/2xEgHgUqvV2cjgAJqF1e5DAzf23pf+umUQm0HIQRgIi2+r6/7HmPbhuXAIAkW+hUfNu4tmd/x0uA/UPVt45LFjct1Qxyh7O/KwB1uBfQ8CZSoOPZ3xMAHQUSCVzpQt3O/p4AxKOAbh9f6RB37VyDmbsuAdh193BremJi4mrP814GcGV9dRjKnr8bRdGG8fHxv3bzvicA8ShwH4BHh1LG+jr9TWb+Va/uJwLAGgnD8IjderSXQf17/xUQkaeDILB5nj2PxAAYY9YDsJcCPaqvwAZm/mOSbiYGIL4UPABgfxLDWqZvCjzIzD9K2noqAKzRRqNxWES2JG1Ay5WnABE95fv+1jQtpgYgzh18HsDqNA1p2cIV+KeIbGrl+iVtLTUA8Q1hQEQTSRvRcsUrICLjQRDYN7xSHZkAiO8HHgOwPVVrWrgoBX7LzN/IYjwzAPH9wDMicnOWhrWOGwWI6Fnf9zPv+JoLgHgkeAXAdW7cUSspFXiVme2m35mP3ADE9wTvENFVmXuhFVMrICJ/C4Lg06krLqngBIB4JLgIYGXeDmn9RApcYuZViUr2KOQMgBiC2q077ELEkm1cYOYrXLXpFIAYgjMA1rnqoNpZpMDrzPx5l5o4ByCGwCYfJnoY4dKZAbd1hJmdz8AWAkAMweMA7hnwoJTl3hPMfG8RjRUGQAyBThblj1rmSZ4kTRcKQPwV0U4b2yeI+uwgSUQ+LmPn9h/MMr2bppnCAYghuNbzvP36FDFZaOxTvSiKbPCbizgUeZQCQMsBY4zmE/SOZqrn+b3NdS9RKgDxfcF6Edmn6WWLA2PTuIjoQNJMnryBb9UvHYAFo4FNNL1fs43xLoCDSRI4XQV9oZ2+AWA7Eaec7wPgF+FcDWw2oig60Ct1u0g/+gpAy7H4DSQLQap0piKFKdj2YSJqtHtbt+B2l5mvBABDBEJlAt/3e4BupA/giFC5wFcagAU3ijcA2AzgNgD29zoddiWuowCOLVyVq2oOVOoS0E0cY0wdYKhF0CvzLSDr2WCMsWlQXwWwKf7pZbWVs14E4DkANk3+OWa26XG1OmozAnRSdXJy8rK5ublb7aWCiOwosRbAaEFRmANwTkTsmX5sdHT0+K5du/5TUFulmK09AO1UmpqaWjM7O3sNEVkY1sY/V4pI80NEK+L0tVYK2yUAl0Rkhogu2U/873NxwM+NjY29uXPnzrdLiUqJjfwPv88HKuMCFxkAAAAASUVORK5CYII=";

var audioIcon$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAAzxJREFUWEftmE1rU1EQhp+5N2msQVCogtWCC0EwG4OCG3+ClGpxobhQ8GMjKFjbFBfWVBQpght3LvzoxoVYwT8gLkQQNyKKigEXpXXhB9LEmOSMTK7R1sTkRpOmggMhJ+TcmefOmXPeuVeYZzo6uhPnDgIJRLrn/9eG8WfgCdHoFRkff1TxLzbQoaE4kchNYFcbAtd36XmObDYtly+ftYkBUCp1F+hfdJhKQFXw/SE5f/6S6PDwAJ53p2MwP6FyqG4UHRm5jcjujgOVl0pPiKZSL4BNSwIIbhjQW6BviQDdaj2QFahZqQSFghUrdHWFvd8WADkXBDZbtgxWrYLeXujrC77fvYOpqQCssf0BUD4PkQgsXw5r1sC6dUFwG69eDbFYVVg9dw6Zm2uMA00C2V3u2RMArFwJnhcmCDo+jmSzYeY2AeQcum0bYkBN2pIAcrlcWQaku3txM6SquOlp3OwsxUwGMhl0ZgZvdpaukyfxtmxpP1Dh6VOKjx/jMhm8Dx/w8nk8Efx4HM92mghYER8+DIlE+4Hc1avIy5dINGrHffD51ayIjxxZHCAmJ+HZs/ql/R/on8mQSUmlrg4c6HANmaAmEtDfH2ia/fb9Nuyy7/qlySSydy81i9qyEo/DyEiVurf2pDYRHRiADRvQfB7p6akNVEdaNJ1GcrkwgtNAy6ytOHasDLPAam17VUpr1+IfP75gqrMDMp3GCyfEdYBsCVasQE+fDh5N5plOTiI1dpn78oXi4CBdO3aUZ2upRP76dWLPnyPWsjS2+hlyIsjYGDKv47MzWScm8N6/r3YvQuHjRwq9veWl1TdviBUK+CYn4aw+kBaLfE0mie3b98Pd1/v3iUxNBZr1OxMpZ0esf6olK7+/snE/VJqbI9/Tg5dM4l69Ivr6NVFrzpoLFC4/zXSMznZYLFZVT2EjhZzXOEMhHbVqWhnIZHtzqzz+lR/VawZkbz32/5WjVl3s3CHR0dHtOPcQsTavg6Y6Qza7qfI6ZgzVM+XWszNWpFTaJRMT934QaCp1CjgDxBeNyY4OkWlEjsqFC/cs7oKU6PDwekQGEdmKc9WPoK0i9X1FJIdzD1C9LRcvfqq4/gYOF90Ot1xnCQAAAABJRU5ErkJggg==";

//
var script$5N = {
  name: 'audio-play',
  props: {
    url: {
      type: String,
      default: '',
      require: true
    },
    mobile: {
      type: Boolean,
      default: false
    },
    isLineFile: {
      type: Boolean,
      default: false
    },
    playbackControl: {
      type: String,
      default: '0'
    }
  },
  data() {
    return {
      playIcon: playIcon$3,
      pauseIcon: pauseIcon$2,
      audioIcon: audioIcon$1,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      isShowPlay: false
    };
  },
  watch: {
    url: {
      handler() {
        this.isPlay = false;
      }
    }
  },
  methods: {
    changeDuration() {
      this.$nextTick(() => {
        this.playDuration = this.timeFormat(this.$refs.musicAudio.duration);
        this.totalDuration = this.$refs.musicAudio.duration;
      });
    },
    //将单位为秒的的时间转换成mm:ss的形式
    timeFormat(num) {
      let minute = parseInt(num / 60);
      let second = parseInt(num % 60);
      minute = minute >= 10 ? minute : "0" + minute;
      second = second >= 10 ? second : "0" + second;
      return minute + ":" + second;
    },
    play() {
      // console.log()
      let audio = document.querySelectorAll('audio');
      audio.forEach(i => i.pause());
      let video = document.querySelectorAll('video');
      if (video && video.length) {
        video.forEach(i => i.pause());
      }
      this.isPlay ? this.$refs.musicAudio.pause() : this.$refs.musicAudio.play();
      this.isPlay = !this.isPlay;
      this.$emit('play');
    },
    updateTime() {
      this.playTime = this.$refs.musicAudio.currentTime;
      this.playCurrentTime = this.timeFormat(this.$refs.musicAudio.currentTime);
      if (this.playTime >= this.totalDuration) {
        this.isPlay = false;
      }
    },
    changeTime(val) {
      this.$refs.musicAudio.currentTime = val;
    }
  }
};

/* script */
const __vue_script__$5N = script$5N;
/* template */
var __vue_render__$5N = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticStyle: { width: "100%" } }, [
    !_vm.mobile && !_vm.isLineFile
      ? _c("div", { staticClass: "audio", attrs: { flex: "" } }, [
          _c("div", { staticClass: "audio-icon" }, [
            _c("img", { attrs: { src: _vm.audioIcon, alt: "" } }),
          ]),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "audio-controls",
              attrs: { flex: "dir:top main:justify" },
            },
            [
              _c(
                "div",
                {
                  staticClass: "audio-controls--handler",
                  attrs: { flex: "main:justify cross:center" },
                },
                [
                  _c("div", { staticClass: "current-time" }, [
                    _vm._v(_vm._s(_vm.playCurrentTime)),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "play" }, [
                    _c("img", {
                      staticClass: "play-handler",
                      attrs: { src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon },
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.play.apply(null, arguments)
                        },
                      },
                    }),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "total-time" }, [
                    _vm._v(_vm._s(_vm.playDuration)),
                  ]),
                ]
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "audio-controls--progress" },
                [
                  _c("el-slider", {
                    attrs: {
                      disabled: _vm.playbackControl === "1",
                      max: _vm.totalDuration,
                      "show-tooltip": false,
                    },
                    on: { change: _vm.changeTime },
                    model: {
                      value: _vm.playTime,
                      callback: function ($$v) {
                        _vm.playTime = $$v;
                      },
                      expression: "playTime",
                    },
                  }),
                ],
                1
              ),
            ]
          ),
        ])
      : _c(
          "div",
          [
            _c("img", {
              staticClass: "play-handler mobile",
              attrs: { src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon },
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  _vm.isShowPlay = true;
                },
              },
            }),
            _vm._v(" "),
            _c(
              "el-dialog",
              {
                attrs: {
                  width: "100%",
                  top: "60px",
                  "custom-class": "video-play--dialog",
                  "destroy-on-close": "",
                  "append-to-body": "",
                  visible: _vm.isShowPlay,
                },
                on: {
                  "update:visible": function ($event) {
                    _vm.isShowPlay = $event;
                  },
                },
              },
              [
                _c("div", { staticClass: "audio", attrs: { flex: "" } }, [
                  _c("div", { staticClass: "audio-icon" }, [
                    _c("img", { attrs: { src: _vm.audioIcon, alt: "" } }),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    {
                      staticClass: "audio-controls",
                      attrs: { flex: "dir:top main:justify" },
                    },
                    [
                      _c(
                        "div",
                        {
                          staticClass: "audio-controls--handler",
                          attrs: { flex: "main:justify cross:center" },
                        },
                        [
                          _c("div", { staticClass: "current-time" }, [
                            _vm._v(_vm._s(_vm.playCurrentTime)),
                          ]),
                          _vm._v(" "),
                          _c("div", { staticClass: "play" }, [
                            _c("img", {
                              staticClass: "play-handler",
                              attrs: {
                                src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon,
                              },
                              on: {
                                click: function ($event) {
                                  $event.stopPropagation();
                                  return _vm.play.apply(null, arguments)
                                },
                              },
                            }),
                          ]),
                          _vm._v(" "),
                          _c("div", { staticClass: "total-time" }, [
                            _vm._v(_vm._s(_vm.playDuration)),
                          ]),
                        ]
                      ),
                      _vm._v(" "),
                      _c(
                        "div",
                        { staticClass: "audio-controls--progress" },
                        [
                          _c("el-slider", {
                            attrs: {
                              disabled: _vm.playbackControl === "1",
                              max: _vm.totalDuration,
                              "show-tooltip": false,
                            },
                            on: { change: _vm.changeTime },
                            model: {
                              value: _vm.playTime,
                              callback: function ($$v) {
                                _vm.playTime = $$v;
                              },
                              expression: "playTime",
                            },
                          }),
                        ],
                        1
                      ),
                    ]
                  ),
                ]),
              ]
            ),
          ],
          1
        ),
    _vm._v(" "),
    _c("audio", {
      ref: "musicAudio",
      staticClass: "audio-component",
      attrs: { controls: "", preload: "auto", src: _vm.url },
      on: {
        canplay: _vm.changeDuration,
        timeupdate: _vm.updateTime,
        pause: function ($event) {
          _vm.isPlay = false;
        },
      },
    }),
  ])
};
var __vue_staticRenderFns__$5N = [];
__vue_render__$5N._withStripped = true;

  /* style */
  const __vue_inject_styles__$5N = undefined;
  /* scoped */
  const __vue_scope_id__$5N = "data-v-4809edd2";
  /* module identifier */
  const __vue_module_identifier__$5N = undefined;
  /* functional template */
  const __vue_is_functional_template__$5N = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5N = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5N, staticRenderFns: __vue_staticRenderFns__$5N },
    __vue_inject_styles__$5N,
    __vue_script__$5N,
    __vue_scope_id__$5N,
    __vue_is_functional_template__$5N,
    __vue_module_identifier__$5N,
    false,
    undefined,
    undefined,
    undefined
  );

var videoIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAaRJREFUSEu91surTXEUwPHP8iiSyAQTpRRTUkqu3CHFkETdy8BcKFNGir/AwKM8YuRRjOTGnfEHGJgwwUQMjDyWftr7dhxn733O0blruNfju9dvPX6/0CKZuQYHcQBbsL4y/4S3eILHEfG1KUwMUmTmOpzHKRRIm5TgV3EpIj73G/4DyMy9uIcNHYH71R9xJCJe9Cr+AmTmMdzE0hGD1+Y/MRMRt+sPC4DM3IPnWDZm8NrtB6YjYr58+APIzLV401PE/2QoTbAtIr7UgMs42xC1pP0AO7B5BPKViDgXmbkaH7CqwXk+IqYys+gv4nSdeQfsGzYWwCyutxjPRcR0rc/M3VUjlLnokhMFcAdHhwVUNVuJCziDJS2+dwvgFXaOAujJZleVzdYG/9cF8A6bxgFU2azAM5Sj65f3iwKY+BFNvMgzuDFsDUZs09nJD1rVCV2r4iG2j7UqFmXZVZApzHVMZtdqKPpf2BcRLxfWdc9kHsc1LB8m0gCb7zgZEbdq3aArs2Ryf8wr83D9542A6rgmd+n3pl09Ww5hf8Oz5SketT1bfgPyir14bBOMeQAAAABJRU5ErkJggg==";

//
var script$5M = {
  name: 'video-play',
  components: {
    videoPlayer: VueVideoPlayer.videoPlayer
  },
  props: {
    url: {
      type: String,
      default: '',
      require: true
    }
  },
  watch: {
    url: {
      handler() {
        // this.isPlay = false
        this.playerOptions.sources[0].src = this.url;
      },
      immediate: true
    }
  },
  data() {
    return {
      pageType: 'pc',
      isShowPlay: false,
      videoIcon,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      isShowControls: false,
      playerOptions: {
        playbackRates: [0.5, 1.0, 1.25, 1.5, 2.0],
        //播放速度
        autoplay: false,
        //如果true,浏览器准备好时开始回放。
        muted: false,
        // 默认情况下将会消除任何音频。
        loop: false,
        // 导致视频一结束就重新开始。
        preload: 'auto',
        // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频（如果浏览器支持）
        language: 'zh-CN',
        aspectRatio: '16:9',
        // 将播放器置于流畅模式，并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字（例如"16:9"或"4:3"）
        fluid: true,
        // 当true时，Video.js player将拥有流体大小。换句话说，它将按比例缩放以适应其容器。
        sources: [{
          type: '',
          //这里的种类支持很多种：基本视频格式、直播、流媒体等，具体可以参看git网址项目
          src: '' //url地址
        }],
        poster: '',
        //你的封面地址
        // width: document.documentElement.clientWidth, //播放器宽度
        notSupportedMessage: '获取视频失败，请刷新重试',
        //允许覆盖Video.js无法播放媒体源时显示的默认信息。
        controlBar: {
          timeDivider: true,
          durationDisplay: true,
          remainingTimeDisplay: false,
          fullscreenToggle: true //全屏按钮
        }
      },
      playerEvents: ['fullscreenchange']
    };
  },
  inject: ['wrapRoot', 'inKey'],
  created() {
    this.pageType = this.$route.query.pageType || 'pc';
  },
  methods: {
    onPlayerPlay(e) {
      let currentVideo = e.el_.children[0].getAttribute('id', 64);
      let videoList = document.getElementsByTagName('video');
      for (let i = 0; i < videoList.length; i++) {
        let id = videoList[i].getAttribute('id');
        if (currentVideo != id) {
          videoList[i].pause();
        }
      }
      let audio = document.querySelectorAll('audio');
      if (audio && audio.length) audio.forEach(i => i.pause());
    },
    showPlay() {
      this.isShowPlay = true;
      this.wrapRoot.currentInKey = this.inKey;
    },
    toggleFullscreen(e) {
      if (this.wrapRoot.currentInKey === this.inKey) {
        const data = {
          type: 'setIframeClass',
          value: e.isFullscreen()
        };
        window.parent.postMessage(data);
      }
    }
  }
};

/* script */
const __vue_script__$5M = script$5M;
/* template */
var __vue_render__$5M = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "video" },
    [
      _c(
        "div",
        {
          staticClass: "video-content",
          staticStyle: { "background-color": "#000" },
        },
        [
          _c("video", {
            staticStyle: { width: "180px", height: "100%" },
            attrs: { src: _vm.url },
          }),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "play",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  return _vm.showPlay.apply(null, arguments)
                },
              },
            },
            [_c("img", { attrs: { src: _vm.videoIcon, alt: "" } })]
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          attrs: {
            top: "60px",
            width: _vm.pageType === "pc" ? "50%" : "100%",
            "custom-class": "video-play--dialog",
            "destroy-on-close": "",
            "append-to-body": "",
            visible: _vm.isShowPlay,
          },
          on: {
            "update:visible": function ($event) {
              _vm.isShowPlay = $event;
            },
          },
        },
        [
          _c("video-player", {
            ref: "videoPlayer",
            staticClass: "video-player vjs-custom-skin",
            attrs: {
              events: _vm.playerEvents,
              playsinline: true,
              options: _vm.playerOptions,
            },
            on: {
              "!fullscreenchange": function ($event) {
                return _vm.toggleFullscreen($event)
              },
              play: function ($event) {
                return _vm.onPlayerPlay($event)
              },
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5M = [];
__vue_render__$5M._withStripped = true;

  /* style */
  const __vue_inject_styles__$5M = undefined;
  /* scoped */
  const __vue_scope_id__$5M = "data-v-8495abd8";
  /* module identifier */
  const __vue_module_identifier__$5M = undefined;
  /* functional template */
  const __vue_is_functional_template__$5M = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5M = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5M, staticRenderFns: __vue_staticRenderFns__$5M },
    __vue_inject_styles__$5M,
    __vue_script__$5M,
    __vue_scope_id__$5M,
    __vue_is_functional_template__$5M,
    __vue_module_identifier__$5M,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5L = {
  name: 'bc-file-render',
  components: {
    audioPlay: __vue_component__$5N,
    videoPlay: __vue_component__$5M
  },
  props: {
    fileInfo: {
      type: Object,
      default: () => ({
        fileUrl: '',
        fileType: '',
        fileSuffix: ''
      }),
      required: true
    },
    showHandler: {
      type: Boolean,
      default: true
    },
    mobile: {
      type: Boolean,
      default: false
    },
    isLineFile: {
      type: Boolean,
      default: false
    },
    playbackControl: {
      type: String,
      default: '0'
    }
  },
  computed: {
    fileType() {
      let type;
      if (this.fileInfo.fileType.includes('image')) type = 'image';
      if (this.fileInfo.fileType.includes('audio')) type = 'audio';
      if (this.fileInfo.fileType.includes('video')) type = 'video';
      return type;
    }
  },
  methods: {
    againUpload() {
      // this.$emit('remove')
      this.$emit('againUpload');
    },
    remove() {
      this.$emit('remove');
    }
  }
};

/* script */
const __vue_script__$5L = script$5L;
/* template */
var __vue_render__$5L = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "file-render", attrs: { flex: "" } },
    [
      _vm.fileType === "image"
        ? _c("div", [
            _c("img", {
              staticClass: "image-file",
              attrs: { src: _vm.fileInfo.fileUrl },
            }),
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.fileType === "audio"
        ? _c("audio-play", {
            style: { width: _vm.showHandler ? "256px" : "100%" },
            attrs: {
              playbackControl: _vm.playbackControl,
              isLineFile: _vm.isLineFile,
              mobile: _vm.mobile,
              url: _vm.fileInfo.fileUrl,
            },
            on: {
              play: function ($event) {
                return _vm.$emit("play")
              },
            },
          })
        : _vm._e(),
      _vm._v(" "),
      _vm.fileType === "video"
        ? _c("video-play", {
            staticClass: "file-render--video",
            attrs: {
              playbackControl: _vm.playbackControl,
              isLineFile: _vm.isLineFile,
              mobile: _vm.mobile,
              url: _vm.fileInfo.fileUrl,
            },
            on: {
              play: function ($event) {
                return _vm.$emit("play")
              },
            },
          })
        : _vm._e(),
      _vm._v(" "),
      _vm.showHandler
        ? _c(
            "div",
            {
              staticClass: "file-info",
              class: { videoHandler: _vm.fileType === "video" },
              staticStyle: { "margin-left": "28px" },
            },
            [
              _vm.fileType !== "audio"
                ? [
                    _vm.fileInfo.fileName
                      ? _c(
                          "el-tooltip",
                          {
                            staticClass: "item",
                            attrs: {
                              "popper-class": "atooltip",
                              effect: "dark",
                              content: "文件名称：" + _vm.fileInfo.fileName,
                              placement: "top-start",
                            },
                          },
                          [
                            _c(
                              "div",
                              { staticClass: "fileName text-overflow" },
                              [
                                _vm._v(
                                  "文件名称：" + _vm._s(_vm.fileInfo.fileName)
                                ),
                              ]
                            ),
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _c("div", { staticClass: "fileInfo" }, [
                      _vm._v("视频格式：" + _vm._s(_vm.fileInfo.fileSuffix)),
                    ]),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _c(
                "div",
                { attrs: { flex: "cross:center" } },
                [
                  _c(
                    "el-button",
                    {
                      staticClass: "dialog-submit",
                      attrs: { type: "primary" },
                      on: { click: _vm.againUpload },
                    },
                    [_vm._v("重新上传")]
                  ),
                  _vm._v(" "),
                  _c(
                    "el-button",
                    { staticClass: "dialog-close", on: { click: _vm.remove } },
                    [_vm._v("删除")]
                  ),
                ],
                1
              ),
            ],
            2
          )
        : _vm._e(),
    ],
    1
  )
};
var __vue_staticRenderFns__$5L = [];
__vue_render__$5L._withStripped = true;

  /* style */
  const __vue_inject_styles__$5L = undefined;
  /* scoped */
  const __vue_scope_id__$5L = "data-v-1786cccf";
  /* module identifier */
  const __vue_module_identifier__$5L = undefined;
  /* functional template */
  const __vue_is_functional_template__$5L = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5L = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5L, staticRenderFns: __vue_staticRenderFns__$5L },
    __vue_inject_styles__$5L,
    __vue_script__$5L,
    __vue_scope_id__$5L,
    __vue_is_functional_template__$5L,
    __vue_module_identifier__$5L,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5K = {
  name: 'BcViewCommon',
  components: {
    bcFileRenderNew: __vue_component__$5L
  },
  props: {
    content: {
      type: String,
      default: ''
    },
    standardAnswer: {
      type: Array,
      default: () => []
    },
    fileInfo: {
      type: Object,
      default: () => ({
        fileUrl: '',
        fileType: '',
        fileSuffix: ''
      })
    },
    placeholder: {
      type: String,
      default: ''
    },
    border: {
      type: Boolean,
      default: true
    },
    mobile: {
      type: Boolean,
      default: false
    },
    isLineFile: {
      type: Boolean,
      default: false
    },
    playbackControl: {
      type: String,
      default: '0'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'h5'
    }
  },
  data() {
    return {};
  },
  methods: {
    formatImg(str) {
      if (str) {
        let data = str.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, (match, p1) => {
          if (match.indexOf('style') !== -1) {
            let src = this.resourceBasisPath + p1.split('./')[1];
            let image = match.indexOf('http') !== -1 ? match : match.replace(p1, src);
            return image.split('style="')[0] + 'style="max-width:100% !important;' + image.split('style="')[1];
          } else if (match.indexOf('width') !== -1) {
            let src = this.resourceBasisPath + p1.split('./')[1];
            let image = match.indexOf('http') !== -1 ? match : match.replace(p1, src);
            return image;
          } else {
            return `<img src='${p1.indexOf('http') > -1 ? p1 : this.resourceBasisPath + p1.split('./')[1]}' style="max-width:100%;" />`;
          }
        });
        return data;
      }
    },
    showImage(e) {
      if (e.target.tagName == 'IMG') {
        this.$hevueImgPreview({
          multiple: true,
          nowImgIndex: 0,
          imgList: [{
            url: e.target.src,
            title: ''
          }]
        });
      }
    }
  }
};

/* script */
const __vue_script__$5K = script$5K;
/* template */
var __vue_render__$5K = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "content" }, [
    _c(
      "div",
      { staticClass: "stem-content", class: { "no-border": !_vm.border } },
      [
        !_vm.content && !_vm.fileInfo.fileUrl && !_vm.standardAnswer
          ? _c("div", { staticClass: "placeholder" }, [
              _vm._v(_vm._s(_vm.placeholder)),
            ])
          : _vm.content
          ? _c("div", {
              staticClass: "text-break-all",
              domProps: { innerHTML: _vm._s(_vm.formatImg(_vm.content)) },
              on: {
                click: function ($event) {
                  return _vm.showImage($event)
                },
              },
            })
          : _vm.standardAnswer
          ? _c(
              "div",
              _vm._l(_vm.standardAnswer, function (item, index) {
                return _c("div", {
                  key: index,
                  domProps: { innerHTML: _vm._s(_vm.formatImg(item.content)) },
                  on: {
                    click: function ($event) {
                      return _vm.showImage($event)
                    },
                  },
                })
              }),
              0
            )
          : _vm._e(),
        _vm._v(" "),
        _vm._t("default"),
        _vm._v(" "),
        _vm.fileInfo.fileUrl
          ? _c("bc-file-render-new", {
              style: {
                "margin-top": _vm.content ? "16px" : 0,
                padding: "10px 0",
              },
              attrs: {
                playbackControl: _vm.playbackControl,
                isLineFile: _vm.isLineFile,
                mobile: _vm.mobile,
                showHandler: false,
                fileInfo: _vm.fileInfo,
              },
              on: {
                play: function ($event) {
                  return _vm.$emit("play")
                },
              },
            })
          : _vm._e(),
      ],
      2
    ),
  ])
};
var __vue_staticRenderFns__$5K = [];
__vue_render__$5K._withStripped = true;

  /* style */
  const __vue_inject_styles__$5K = undefined;
  /* scoped */
  const __vue_scope_id__$5K = "data-v-178d3ffd";
  /* module identifier */
  const __vue_module_identifier__$5K = undefined;
  /* functional template */
  const __vue_is_functional_template__$5K = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5K = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5K, staticRenderFns: __vue_staticRenderFns__$5K },
    __vue_inject_styles__$5K,
    __vue_script__$5K,
    __vue_scope_id__$5K,
    __vue_is_functional_template__$5K,
    __vue_module_identifier__$5K,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5J = {
  name: 'bc-view-option-radio',
  components: {
    BcViewCommon: __vue_component__$5K
  },
  props: {
    questionType: {
      type: String,
      default: ''
    },
    option: {
      type: [String, Array],
      default: ''
    },
    showTitle: {
      type: Boolean,
      default: true
    },
    isSubmit: {
      type: Boolean,
      default: true
    },
    value: {
      type: String,
      default: ''
    },
    readonly: {
      type: Boolean,
      default: false
    },
    answer: {
      type: Object,
      default: () => {}
    },
    type: {
      type: String,
      default: 'radio'
    },
    standardAnswer: {
      type: [String, Number],
      default: ''
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'h5'
    }
  },
  data() {
    return {
      optionsList: [],
      selectData: '',
      isAnswer: false,
      answerIsTrue: false,
      radioJudeMap: {
        A: '正确',
        B: '错误'
      },
      serialNumber: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    };
  },
  computed: {},
  watch: {
    value: {
      handler(val) {
        this.selectData = val;
      },
      immediate: true
    },
    option: {
      handler(val) {
        try {
          if (Array.isArray(val)) {
            this.optionsList = val;
          } else {
            this.optionsList = JSON.parse(val);
          }
        } catch (err) {
          this.optionsList = [];
        }
      },
      immediate: true
    }
  },
  methods: {
    isActive(item) {
      return item.number === this.selectData;
    },
    isTrue(item) {
      if (this.type === 'radio') {
        return this.isAnswer && item.number === this.selectData && item.isRightAnswer;
      }
    },
    isFalse(item) {
      if (!this.isAnswer) {
        return false;
      }
      if (this.type === 'radio') {
        if (this.selectData) {
          //当前为选中的
          return item.number === this.selectData && !item.isRightAnswer;
        } else {
          return false;
        }
      }
    },
    submitAnswer() {
      if (!this.selectData && this.isSubmit) {
        this.$message.error('请选择答案');
        return;
      }
      // let answerIsTrue = false
      // if (this.type === 'radio') {
      //   console.log(this.selectData, this.standardAnswer)
      //   answerIsTrue = this.optionsList[this.standardAnswer - 1].number === this.selectData ? true : false
      //   // answerIsTrue = this.standardAnswer.some((i) => i.title === this.selectData)
      // } else {
      //   answerIsTrue = this.standardAnswer.some((i) => i === this.radioJudeMap[this.selectData])
      // }

      this.isAnswer = true;
      this.$emit('showAnalysis', {
        answerIsTrue: this.answerIsTrue,
        userAnswer: this.selectData
      });
    },
    afresh() {
      this.selectData = '';
      this.isAnswer = false;
      this.$emit('afresh');
    },
    select(item) {
      this.selectData = item.number;
      this.answerIsTrue = item.isRightAnswer;
      // this.$emit('showAnalysis')
    }
  }
};

/* script */
const __vue_script__$5J = script$5J;
var __vue_render__$5J = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", [
    _c(
      "div",
      {
        staticClass: "xml-checkbox-box",
        class: _vm.optionsList.length == 2 ? "xml-arrange-in-a-row" : "",
      },
      _vm._l(_vm.optionsList, function (item, index) {
        return _c(
          "div",
          {
            key: index,
            staticClass: "option-item",
            class: {
              isActive: _vm.isActive(item),
              isTrue: _vm.isTrue(item),
              isFalse: _vm.isFalse(item),
            },
            attrs: { flex: "" },
            on: {
              click: function ($event) {
                $event.stopPropagation();
                return _vm.select(item)
              },
            },
          },
          [
            _c(
              "div",
              { staticClass: "questionSeq" },
              [
                _vm.isTrue(item)
                  ? _c("img", {
                      staticStyle: { "margin-right": "10px" },
                      attrs: {
                        src: __$_require_static_images_leaflet_icons_correct_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                _vm.isFalse(item)
                  ? _c("img", {
                      staticStyle: { "margin-right": "10px" },
                      attrs: {
                        src: __$_require_static_images_leaflet_icons_error_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                !_vm.readonly && !_vm.isTrue(item) && !_vm.isFalse(item)
                  ? _c(
                      "el-radio",
                      { attrs: { value: _vm.selectData, label: item.number } },
                      [_vm._v(_vm._s(""))]
                    )
                  : _vm._e(),
              ],
              1
            ),
            _vm._v(" "),
            _vm.showTitle
              ? _c(
                  "div",
                  {
                    staticClass: "questionSeq",
                    staticStyle: { "margin-right": "2px" },
                  },
                  [
                    _vm._v(
                      "\n        " +
                        _vm._s(_vm.serialNumber[index]) +
                        "\n      "
                    ),
                  ]
                )
              : _vm._e(),
            _vm._v(" "),
            _c("bc-view-common", {
              attrs: {
                "flex-box": "1",
                border: false,
                content: item.description,
                fileInfo: item.fileInfo,
                resourceBasisPath: _vm.resourceBasisPath,
                pageType: _vm.pageType,
              },
            }),
          ],
          1
        )
      }),
      0
    ),
    _vm._v(" "),
    _vm.isSubmit
      ? _c(
          "div",
          {
            staticClass: "mt-4",
            staticStyle: {
              display: "flex",
              "justify-content": "flex-end",
              "text-align": "center",
              "margin-top": "12px",
            },
          },
          [
            !_vm.selectData || !_vm.isAnswer
              ? _c(
                  "div",
                  {
                    staticClass: "xml-submit-answer",
                    on: { click: _vm.submitAnswer },
                  },
                  [_vm._v("提交作答")]
                )
              : _c(
                  "div",
                  {
                    staticClass: "xml-submit-answer",
                    on: {
                      click: function ($event) {
                        return _vm.afresh()
                      },
                    },
                  },
                  [_vm._v("重新作答")]
                ),
          ]
        )
      : _vm._e(),
  ])
};
var __vue_staticRenderFns__$5J = [];
__vue_render__$5J._withStripped = true;

  /* style */
  const __vue_inject_styles__$5J = undefined;
  /* scoped */
  const __vue_scope_id__$5J = "data-v-0bbbebe6";
  /* module identifier */
  const __vue_module_identifier__$5J = undefined;
  /* functional template */
  const __vue_is_functional_template__$5J = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5J = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5J, staticRenderFns: __vue_staticRenderFns__$5J },
    __vue_inject_styles__$5J,
    __vue_script__$5J,
    __vue_scope_id__$5J,
    __vue_is_functional_template__$5J,
    __vue_module_identifier__$5J,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5I = {
  name: 'bc-view-option-checkbox',
  components: {
    BcViewCommon: __vue_component__$5K
  },
  props: {
    option: {
      type: [String, Array],
      default: ''
    },
    showTitle: {
      type: Boolean,
      default: true
    },
    isSubmit: {
      type: Boolean,
      default: true
    },
    value: {
      type: [String],
      default: ''
    },
    readonly: {
      type: Boolean,
      default: false
    },
    answer: {
      type: Object,
      default: () => {}
    },
    standardAnswer: {
      type: [String, Number],
      default: ''
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'h5'
    }
  },
  data() {
    return {
      optionsList: [],
      selectData: [],
      isAnswer: false,
      serialNumber: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    };
  },
  watch: {
    // value: {
    //   handler(val) {
    //     this.selectData = val ? val : []
    //   },
    //   immediate: true
    // },
    option: {
      handler(val) {
        try {
          if (Array.isArray(val)) {
            this.optionsList = val;
          } else {
            this.optionsList = JSON.parse(val);
          }
        } catch (err) {
          this.optionsList = [];
        }
      },
      immediate: true
    }
  },
  methods: {
    select(item, e) {
      // debugger
      if (e.target.tagName === 'INPUT') {
        e.stopPropagation();
        return;
      }
      if (this.readonly) return;
      let index = this.selectData.findIndex(i => i === item);
      if (index !== -1) {
        this.selectData.splice(index, 1);
      } else {
        this.selectData.push(item);
      }
      this.$emit('change', this.selectData.join(''));
    },
    submitAnswer() {
      if (!this.selectData.length && this.isSubmit) {
        this.$message.error('请选择答案');
        return;
      }
      // console.log('this.standardAnswer', this.standardAnswer,this.selectData);
      let answerIsTrue = false;
      this.selectData.map(item => {
        answerIsTrue = this.standardAnswer.indexOf(item) != -1 && this.standardAnswer.split(',')?.length == this.selectData.length;
      });
      this.isAnswer = true;
      this.$emit('showAnalysis', {
        answerIsTrue,
        userAnswer: this.selectData.join(',')
      });
    },
    afresh() {
      this.selectData = [];
      this.isAnswer = false;
      this.$emit('afresh');
    },
    SkipProgress(e, title, val) {
      if (e.target.targetName === 'INPUT') {
        e.stopPropagation();
      }
    }
  }
};

/* script */
const __vue_script__$5I = script$5I;
var __vue_render__$5I = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", [
    _c(
      "div",
      { staticClass: "xml-checkbox-box" },
      _vm._l(_vm.optionsList, function (item, index) {
        return _c(
          "div",
          {
            key: index,
            staticClass: "option-item",
            class: {
              isActive: _vm.selectData.includes(item.number) && !_vm.readonly,
              isTrue:
                _vm.isAnswer &&
                _vm.selectData.includes(item.number) &&
                item.isRightAnswer,
              isFalse:
                _vm.isAnswer &&
                _vm.selectData.includes(item.number) &&
                !item.isRightAnswer,
            },
            attrs: { flex: "" },
            on: {
              click: function ($event) {
                $event.stopPropagation();
                return _vm.select(item.number, $event)
              },
            },
          },
          [
            _c(
              "div",
              { staticClass: "questionSeq" },
              [
                _vm.isAnswer &&
                _vm.selectData.includes(item.number) &&
                item.isRightAnswer
                  ? _c("img", {
                      staticStyle: { "margin-right": "10px" },
                      attrs: {
                        src: __$_require_static_images_leaflet_icons_correct_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                _vm.isAnswer &&
                _vm.selectData.includes(item.number) &&
                !item.isRightAnswer
                  ? _c("img", {
                      staticStyle: { "margin-right": "10px" },
                      attrs: {
                        src: __$_require_static_images_leaflet_icons_error_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                !_vm.readonly && !_vm.isAnswer
                  ? _c(
                      "el-checkbox",
                      {
                        attrs: { value: _vm.selectData.includes(item.number) },
                        nativeOn: {
                          click: function ($event) {
                            _vm.SkipProgress(
                              $event,
                              item.number,
                              _vm.selectData.includes(item.number)
                            );
                          },
                        },
                      },
                      [_vm._v(_vm._s(""))]
                    )
                  : _vm._e(),
              ],
              1
            ),
            _vm._v(" "),
            _vm.showTitle
              ? _c(
                  "div",
                  {
                    staticClass: "questionSeq",
                    staticStyle: { "margin-right": "2px" },
                  },
                  [
                    _vm._v(
                      "\n        " +
                        _vm._s(_vm.serialNumber[index]) +
                        "\n      "
                    ),
                  ]
                )
              : _vm._e(),
            _vm._v(" "),
            _c("bc-view-common", {
              attrs: {
                "flex-box": "1",
                border: false,
                content: item.description,
                fileInfo: item.fileInfo,
                resourceBasisPath: _vm.resourceBasisPath,
                pageType: _vm.pageType,
              },
            }),
          ],
          1
        )
      }),
      0
    ),
    _vm._v(" "),
    _vm.isSubmit
      ? _c(
          "div",
          {
            staticClass: "mt-4",
            staticStyle: {
              display: "flex",
              "justify-content": "flex-end",
              "text-align": "center",
              "margin-top": "12px",
            },
          },
          [
            !_vm.selectData || !_vm.isAnswer
              ? _c(
                  "div",
                  {
                    staticClass: "xml-submit-answer",
                    on: { click: _vm.submitAnswer },
                  },
                  [_vm._v("提交作答")]
                )
              : _c(
                  "div",
                  {
                    staticClass: "xml-submit-answer",
                    on: {
                      click: function ($event) {
                        return _vm.afresh()
                      },
                    },
                  },
                  [_vm._v("重新作答")]
                ),
          ]
        )
      : _vm._e(),
  ])
};
var __vue_staticRenderFns__$5I = [];
__vue_render__$5I._withStripped = true;

  /* style */
  const __vue_inject_styles__$5I = undefined;
  /* scoped */
  const __vue_scope_id__$5I = "data-v-35976a09";
  /* module identifier */
  const __vue_module_identifier__$5I = undefined;
  /* functional template */
  const __vue_is_functional_template__$5I = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5I = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5I, staticRenderFns: __vue_staticRenderFns__$5I },
    __vue_inject_styles__$5I,
    __vue_script__$5I,
    __vue_scope_id__$5I,
    __vue_is_functional_template__$5I,
    __vue_module_identifier__$5I,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5H = {
  name: 'CqQuestionItem',
  components: {
    BcViewOptionCheckbox: __vue_component__$5I,
    BcViewOptionRadio: __vue_component__$5J,
    BcViewCommon: __vue_component__$5K
  },
  // dicts: ['question_type'],
  data() {
    return {
      // isShowAnalysis: false,
      // isShowAnswer: false,
      // isShowKnowledge: false,
      inputAnswer: '',
      dict: {
        label: {
          question_type: {
            1: '单选题',
            2: '多选题',
            3: '判断题',
            13: '简答题'
          }
        }
      },
      isAnswer: false,
      JudgementList: ['错误', '正确'],
      serialNumber: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    };
  },
  props: {
    question: Object,
    canShowAnswer: String,
    canShowAnalysis: String,
    canShowKnowledge: String,
    inKey: String,
    border: {
      type: Boolean,
      default: false
    },
    isSubmit: {
      //是否显示提交作答按钮
      type: Boolean,
      default: true
    },
    questionNumber: {
      type: Number,
      default: -1
    },
    isShowAi: {
      type: String,
      default: '1'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'h5'
    }
  },
  provide: function () {
    return {
      inKey: this.inKey
    };
  },
  mounted() {
    // console.log(this.question)
  },
  computed: {
    isShowAnalysis() {
      return this.isAnswer && this.canShowAnalysis === 'true';
    },
    isShowAnswer() {
      return this.isAnswer && this.canShowAnswer === 'true';
    },
    isShowKnowledge() {
      return this.isAnswer && this.canShowKnowledge === 'true';
    },
    isRadio() {
      return isRadio(this.question.type);
    },
    isCheck() {
      return isCheck(this.question.type);
    },
    showJudgeAnswer() {
      return showJudgeAnswer(this.question.type);
    },
    showRichTextAnswer() {
      return showRichTextAnswer(this.question.type);
    },
    showOptions() {
      return showOptions(this.question.type);
    },
    showSort() {
      return showSort(this.question.type);
    },
    isCloze() {
      return isCloze(this.question.type);
    },
    clozeLength() {
      let fillInTheBlanksSpan = this.question.description.match(/______/g);
      let sortString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
      let data = fillInTheBlanksSpan?.length || 0;
      let list = [];
      for (let i = 0; i < data; i++) {
        list.push({
          content: '',
          title: sortString.split('')[i]
        });
      }
      // return fillInTheBlanksSpan ? fillInTheBlanksSpan.length : 0
      return list;
    },
    standardAnswer() {
      try {
        let answerTitle = '';
        if (!this.showRichTextAnswer) {
          if (this.showOptions) {
            answerTitle = this.question.standardAnswer.map(i => i.title).join('、');
          } else if (this.showJudgeAnswer) {
            answerTitle = this.question.standardAnswer.map(i => i).join('、');
          } else if (this.showSort) {
            let questionOption = xeUtils.clone(this.question.questionOption, true);
            answerTitle = questionOption.sort((c, n) => c.index - n.index).map(i => i.title).join('、');
          }
        }
        return answerTitle;
      } catch (e) {
        console.log('异常：', e);
        return '';
      }
    }
  },
  methods: {
    showAnalysis(answer) {
      if (!this.showRichTextAnswer) {
        this.isAnswer = true;
        let params = {
          ...answer,
          pass: answer,
          question: this.question
        };
        this.$emit('submitAnswer', params);
      } else {
        this.isAnswer = true;
      }
    },
    showAnalysis2(answer) {
      if (answer.questionType == 'shortSnswer' && this.isSubmit) {
        if (!answer.userAnswer && this.question.description.indexOf('[/答题模板]') == -1) {
          this.$message.error('请先输入答案');
          return;
        }
      } else if (answer.questionType == 'fillInTheBlanks' && this.isSubmit) {
        for (let i = 0; i < this.clozeLength?.length; i++) {
          if (!this.clozeLength[i].content) {
            this.$message.error('请先输入答案');
            return;
          }
        }
      }
      this.isAnswer = true;
      let params = {
        ...answer,
        pass: answer,
        question: this.question
      };
      this.$emit('submitAnswer', params);
    },
    afresh(questionType) {
      this.isAnswer = false;
      if (questionType == 'shortSnswer') {
        this.inputAnswer = '';
      } else if (questionType == 'fillInTheBlanks') {
        for (let i = 0; i < this.clozeLength?.length; i++) {
          this.clozeLength[i].content = '';
        }
      }
    },
    //
    changeAnswer() {
      if (this.isRadio || this.showJudgeAnswer) {
        this.$refs.bcViewOptionRadio?.submitAnswer();
      }
      if (this.isCheck) {
        this.$refs.bcViewOptionCheckbox?.submitAnswer();
      }
      if (this.showRichTextAnswer && !this.isCloze) {
        this.showAnalysis2({
          questionId: this.question.id,
          questionName: JSON.stringify(this.question.stem),
          userAnswer: this.inputAnswer,
          questionType: 'shortSnswer'
        });
      }
      if (this.isCloze) {
        this.showAnalysis2({
          questionId: this.question.id,
          questionName: JSON.stringify(this.question.stem),
          userAnswer: this.clozeLength,
          questionType: 'fillInTheBlanks'
        });
      }
    },
    // AIanalysis(){
    //   let params = {
    //       questionOption: JSON.stringify(this.question.questionOption),
    //       questionName: JSON.stringify(this.question.stem)
    //   }
    //   this.$emit('setanalysis', params)
    // },
    AIanalysis() {
      let serialNumber = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T'];
      let option = '';
      let question = this.question.stem.content;
      let optionList = this.question.questionOption || [];
      for (let i = 0; i < optionList.length; i++) {
        if (optionList[i].content) {
          option += serialNumber[i] + '.' + this.removeStyle(optionList[i].content) + (i < optionList.length - 1 ? ';' : '');
        }
      }
      if (this.question.questionType == '3') {
        option = 'A.正确;B.错误';
      }
      const data = {
        type: 'AiAnalysis',
        value: this.removeStyle(question) + option,
        code: 'success'
      };
      this.$emit('setanalysis', data);
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      }
    },
    // 格式化表格
    formatTable(content) {
      if (content) {
        const regex = /\[答题模板\]([\s\S]*?)\[\/答题模板\]/;
        const match = content.match(regex);
        if (match?.length > 0) {
          return this.processTemplate(match ? match[1] : '');
        } else {
          return content;
        }
      } else {
        return '';
      }
    },
    processTemplate(content) {
      if (content) {
        // 先替换表格标签，添加class和外层div
        // let processedContent = content.replace(/<table>/g, '<div class="xml-input-question-answer-table"><table>')
        // // 添加div的闭合标签
        // processedContent = processedContent.replace(/<\/table>/g, '</table></div>')
        // 只保留table内的内容
        // 匹配所有 table 标签及其内容（含属性）
        const tableRegex = /<table[^>]*>[\s\S]*?<\/table>/gi;
        // 获取所有匹配的 table 内容
        const tables = content.match(tableRegex) || [];
        let processedContent = '<div class="xml-input-question-answer-table">' + tables[0] + '</div>';
        // 处理输入框
        return processedContent.replace(/______/g, '<input type="text" placeholder="请输入">');
      } else {
        return '';
      }
    }
  }
};

/* script */
const __vue_script__$5H = script$5H;
/* template */
var __vue_render__$5H = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", [
    _c(
      "div",
      {
        staticClass: "group-content",
        class: _vm.border ? "border-bottom" : "",
      },
      [
        _c("div", { staticClass: "group-content-box" }, [
          _c("div", { staticClass: "stem" }, [
            _c(
              "div",
              { staticClass: "stem-box", staticStyle: { display: "flex" } },
              [
                _vm.questionNumber !== -1
                  ? _c(
                      "div",
                      {
                        staticClass: "question-number",
                        staticStyle: {
                          "line-height": "28px",
                          "padding-right": "4px",
                        },
                      },
                      [
                        _vm._v(
                          "\n            " +
                            _vm._s(_vm.questionNumber + 1) +
                            " .\n          "
                        ),
                      ]
                    )
                  : _vm._e(),
                _vm._v(" "),
                _c("bc-view-common", {
                  staticClass: "xml-question-title",
                  staticStyle: { flex: "1", "min-width": "0" },
                  attrs: {
                    content: _vm.formatTable(_vm.question.description),
                    border: false,
                    fileInfo: _vm.question.stem.fileInfo,
                    resourceBasisPath: _vm.resourceBasisPath,
                    isSubmit: _vm.isSubmit,
                    pageType: _vm.pageType,
                  },
                }),
              ],
              1
            ),
          ]),
        ]),
        _vm._v(" "),
        _vm.isRadio
          ? _c(
              "div",
              { staticClass: "mt-4" },
              [
                _c("bc-view-option-radio", {
                  ref: "bcViewOptionRadio",
                  attrs: {
                    standardAnswer: _vm.question.answer,
                    option: _vm.question.candidates,
                    resourceBasisPath: _vm.resourceBasisPath,
                    isSubmit: _vm.isSubmit,
                    pageType: _vm.pageType,
                    questionType: _vm.question.type,
                  },
                  on: { showAnalysis: _vm.showAnalysis, afresh: _vm.afresh },
                }),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.isCheck
          ? _c(
              "div",
              { staticClass: "mt-4" },
              [
                _c("bc-view-option-checkbox", {
                  ref: "bcViewOptionCheckbox",
                  attrs: {
                    option: _vm.question.candidates,
                    standardAnswer: _vm.question.answer,
                    resourceBasisPath: _vm.resourceBasisPath,
                    isSubmit: _vm.isSubmit,
                    pageType: _vm.pageType,
                  },
                  on: { showAnalysis: _vm.showAnalysis, afresh: _vm.afresh },
                }),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.showRichTextAnswer && !_vm.isCloze
          ? _c(
              "div",
              {
                staticClass: "mt-4",
                staticStyle: { display: "flex", "flex-direction": "column" },
              },
              [
                _vm.question.description.indexOf("[/答题模板]") == -1
                  ? _c("el-input", {
                      attrs: {
                        type: "textarea",
                        placeholder: "请输入您的回答",
                        autosize: { minRows: 2, maxRows: 8 },
                      },
                      model: {
                        value: _vm.inputAnswer,
                        callback: function ($$v) {
                          _vm.inputAnswer = $$v;
                        },
                        expression: "inputAnswer",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                !_vm.isAnswer & _vm.isSubmit
                  ? _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            _vm.showAnalysis2({
                              questionId: _vm.question.id,
                              questionName: JSON.stringify(_vm.question.stem),
                              userAnswer: _vm.inputAnswer,
                              questionType: "shortSnswer",
                            });
                          },
                        },
                      },
                      [_vm._v("\n        提交作答\n      ")]
                    )
                  : _vm.isAnswer & _vm.isSubmit
                  ? _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            return _vm.afresh("shortSnswer")
                          },
                        },
                      },
                      [_vm._v("\n        重新作答\n      ")]
                    )
                  : _vm._e(),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.showJudgeAnswer
          ? _c(
              "div",
              [
                _c("bc-view-option-radio", {
                  ref: "bcViewOptionRadio",
                  attrs: {
                    standardAnswer: _vm.question.answer,
                    resourceBasisPath: _vm.resourceBasisPath,
                    pageType: _vm.pageType,
                    isSubmit: _vm.isSubmit,
                    option: _vm.question.candidates,
                  },
                  on: { showAnalysis: _vm.showAnalysis, afresh: _vm.afresh },
                }),
              ],
              1
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.isCloze
          ? _c(
              "div",
              [
                _vm._l(_vm.clozeLength, function (item, index) {
                  return _c("div", { key: index, staticClass: "isTrue" }, [
                    _c("input", {
                      directives: [
                        {
                          name: "model",
                          rawName: "v-model",
                          value: item.content,
                          expression: "item.content",
                        },
                      ],
                      staticClass: "answer-cloze-input",
                      attrs: {
                        maxlength: "100",
                        placeholder: "请输入...",
                        type: "text",
                      },
                      domProps: { value: item.content },
                      on: {
                        input: function ($event) {
                          if ($event.target.composing) {
                            return
                          }
                          _vm.$set(item, "content", $event.target.value);
                        },
                      },
                    }),
                  ])
                }),
                _vm._v(" "),
                !_vm.isAnswer && _vm.isSubmit
                  ? _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            _vm.showAnalysis2({
                              questionId: _vm.question.id,
                              questionName: JSON.stringify(_vm.question.stem),
                              userAnswer: _vm.clozeLength,
                              questionType: "Filling",
                            });
                          },
                        },
                      },
                      [_vm._v("\n        提交作答\n      ")]
                    )
                  : _vm.isAnswer & _vm.isSubmit
                  ? _c(
                      "div",
                      {
                        staticClass:
                          "xml-submit-answer xml-submit-answer-right",
                        on: {
                          click: function ($event) {
                            return _vm.afresh("Filling")
                          },
                        },
                      },
                      [_vm._v("\n        重新作答\n      ")]
                    )
                  : _vm._e(),
              ],
              2
            )
          : _vm._e(),
        _vm._v(" "),
        _vm.isShowAnswer
          ? _c("div", [
              !_vm.showRichTextAnswer
                ? _c("div", { staticClass: "mt-6" }, [
                    _c(
                      "div",
                      {
                        staticStyle: {
                          display: "flex",
                          "flex-direction": "column",
                        },
                      },
                      [
                        _c(
                          "div",
                          { staticClass: "question-label" },
                          [
                            _vm._v("\n            正确答案：\n            "),
                            _vm.question.type == "SingleSelect"
                              ? [
                                  _c("span", [
                                    _vm._v(
                                      _vm._s(
                                        _vm.serialNumber[
                                          _vm.question.answer - 1
                                        ]
                                      )
                                    ),
                                  ]),
                                ]
                              : _vm.question.type == "Judgement"
                              ? [
                                  _c("span", [
                                    _vm._v(
                                      _vm._s(
                                        _vm.JudgementList[
                                          _vm.question.answer - 1
                                        ]
                                      )
                                    ),
                                  ]),
                                ]
                              : _vm._l(
                                  _vm.question.answer.split(","),
                                  function (item, index) {
                                    return _c("span", [
                                      _vm._v(
                                        "\n                " +
                                          _vm._s(_vm.serialNumber[item - 1]) +
                                          "\n              "
                                      ),
                                    ])
                                  }
                                ),
                          ],
                          2
                        ),
                        _vm._v(" "),
                        _c("div", {
                          staticStyle: {
                            color: "#0070c1",
                            "min-width": "0",
                            flex: "1",
                            "line-height": "28px",
                            display: "inline-block",
                          },
                        }),
                      ]
                    ),
                  ])
                : _c("div", { staticClass: "mt-6" }, [
                    _c(
                      "div",
                      {
                        staticStyle: {
                          display: "flex",
                          "flex-direction": "column",
                        },
                      },
                      [
                        _c("div", { staticClass: "question-label" }, [
                          _vm._v("正确答案："),
                        ]),
                        _vm._v(" "),
                        _c(
                          "div",
                          { staticStyle: { flex: "1", "min-width": "0" } },
                          [
                            _c("bc-view-common", {
                              staticStyle: { flex: "1", "min-width": "0" },
                              attrs: {
                                content: _vm.question.answer,
                                standardAnswer:
                                  _vm.question.questionType == 10
                                    ? _vm.question.standardAnswer
                                    : [],
                                border: false,
                                fileInfo: _vm.question.standardAnswer.fileInfo,
                                resourceBasisPath: _vm.resourceBasisPath,
                                isSubmit: _vm.isSubmit,
                                pageType: _vm.pageType,
                              },
                            }),
                          ],
                          1
                        ),
                      ]
                    ),
                  ]),
            ])
          : _vm._e(),
        _vm._v(" "),
        _vm.isShowAnalysis && _vm.question.feedback
          ? _c(
              "div",
              {
                staticClass: "mt-6 flex-direction-column",
                attrs: { flex: "" },
              },
              [
                _c(
                  "div",
                  {
                    staticClass: "question-label",
                    staticStyle: { "line-height": "40px" },
                  },
                  [_vm._v("解析：")]
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    staticClass: "stem",
                    class: {
                      "analysis-content": _vm.question.feedback,
                    },
                    staticStyle: { "min-width": "0", flex: "1" },
                  },
                  [
                    _c("bc-view-common", {
                      attrs: {
                        border: false,
                        content: _vm.question.feedback,
                        fileInfo: _vm.question.analysis.fileInfo,
                        resourceBasisPath: _vm.resourceBasisPath,
                        isSubmit: _vm.isSubmit,
                        pageType: _vm.pageType,
                      },
                    }),
                  ],
                  1
                ),
              ]
            )
          : _vm._e(),
      ]
    ),
  ])
};
var __vue_staticRenderFns__$5H = [];
__vue_render__$5H._withStripped = true;

  /* style */
  const __vue_inject_styles__$5H = undefined;
  /* scoped */
  const __vue_scope_id__$5H = "data-v-6b36d74a";
  /* module identifier */
  const __vue_module_identifier__$5H = undefined;
  /* functional template */
  const __vue_is_functional_template__$5H = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5H = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5H, staticRenderFns: __vue_staticRenderFns__$5H },
    __vue_inject_styles__$5H,
    __vue_script__$5H,
    __vue_scope_id__$5H,
    __vue_is_functional_template__$5H,
    __vue_module_identifier__$5H,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5G = {
  name: 'XmlQuestionRender',
  components: {
    XmlQuestionItem: __vue_component__$5O,
    CqQuestionItem: __vue_component__$5H
  },
  // dicts: [
  //     "question_type",
  //     "difficulty",
  //     "examine_status",
  //     "answer_platform",
  //     "answer_situation",
  // ],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isShowAi: {
      type: String,
      default: '1'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isSubmit: {
      type: Boolean,
      default: true
    }
  },
  computed: {},
  provide() {
    return {
      wrapRoot: this,
      getOptionNumber: () => this.pBlockData.optionNumber
    };
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
          this.questionSetList = this.blockData.questionSetList;
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      //属性组件名
      propertyComponentsName: 'xml-question-property',
      radio1: null,
      questionSetList: [],
      currentInKey: null
    };
  },
  methods: {
    //AI解析
    setanalysis(item) {
      this.$emit('setanalysis', item);
    },
    submitAnswer(val) {
      console.log('this.currentRule123', val, this.currentRule);
      if (val.question.questionType === '10') {
        let standardAnswer = val.question.standardAnswer;
        let userAnswer = val.pass.userAnswer;
        let falg = false;
        // 判断是否有错误
        for (let i = 0; i < standardAnswer.length; i++) {
          let answer = standardAnswer[i].content.replace(/<[^>]*>/g, '');
          if (answer == userAnswer[i].content) ; else {
            falg = true;
          }
        }
        // 判断给pass赋值
        if (falg) {
          val.pass.answerIsTrue = false;
        } else {
          val.pass.answerIsTrue = true;
        }
      }
      // if (!this.$route.query.templateId) {
      this.mode != 'editor' && this.$emit('submitAnswer', {
        ...val,
        chapterId: this.currentRule.chapterId,
        xmlCompRef: val.question.xmlCompRef,
        pass: val.pass.answerIsTrue ? val.pass.answerIsTrue != undefined ? val.pass.answerIsTrue : true : val.pass

        // pass: val.pass.answerIsTrue != undefined ? val.pass.answerIsTrue : false
      });
      // }
    },
    changeAnswer() {
      for (let i = 0; i < this.questionSetList.length; i++) {
        this.$refs['questionItem_' + this.questionSetList[i].id][0].changeAnswer();
      }
    },
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    uuid(prefix) {
      const s = [];
      const hexDigits = '0123456789abcdef';
      for (let i = 0; i < 36; i += 1) {
        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
      }
      s[14] = '4';
      s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1);
      const id = s.join('');
      return prefix ? prefix + '__' + id : id;
    }
  },
  created() {}
};

/* script */
const __vue_script__$5G = script$5G;
/* template */
var __vue_render__$5G = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      class: "xml-question-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _c("div", { staticClass: "question-box" }, [
        _c(
          "div",
          { staticClass: "question-item" },
          [
            _vm.questionSetList[0] &&
            _vm.questionSetList[0].stem &&
            _vm.questionSetList[0].stem.content
              ? _vm._l(_vm.questionSetList, function (item, index) {
                  return _c("XmlQuestionItem", {
                    key: item.id,
                    ref: "questionItem_" + item.id,
                    refInFor: true,
                    staticClass: "mb-4 xml-group-item",
                    attrs: {
                      flex: "",
                      inKey: _vm.uuid("qitem__"),
                      question: item,
                      mode: _vm.mode,
                      "can-show-analysis": _vm.pBlockData.showAnalysis,
                      "can-show-answer": _vm.pBlockData.showAnswer,
                      "can-show-knowledge": _vm.pBlockData.showRecommend,
                      border:
                        index < _vm.questionSetList.length - 1 ? true : false,
                      "question-number":
                        _vm.questionSetList.length > 1 ? index : -1,
                      "is-show-ai": _vm.isShowAi,
                      "ai-type": _vm.pBlockData.aiType,
                      analyzeTheBackground: _vm.pBlockData.analyzeTheBackground,
                      resourceBasisPath: _vm.resourceBasisPath,
                      pageType: _vm.pageType,
                      isSubmit: _vm.isSubmit,
                    },
                    on: {
                      submitAnswer: _vm.submitAnswer,
                      setanalysis: _vm.setanalysis,
                    },
                  })
                })
              : _vm._l(_vm.questionSetList, function (item, index) {
                  return _c("CqQuestionItem", {
                    key: item.id,
                    ref: "questionItem_" + item.id,
                    refInFor: true,
                    staticClass: "mb-4 xml-group-item",
                    attrs: {
                      flex: "",
                      inKey: _vm.uuid("qitem__"),
                      question: item,
                      mode: _vm.mode,
                      "can-show-analysis": _vm.pBlockData.showAnalysis,
                      "can-show-answer": _vm.pBlockData.showAnswer,
                      "can-show-knowledge": _vm.pBlockData.showRecommend,
                      border:
                        index < _vm.questionSetList.length - 1 ? true : false,
                      "question-number":
                        _vm.questionSetList.length > 1 ? index : -1,
                      "is-show-ai": _vm.isShowAi,
                      resourceBasisPath: _vm.resourceBasisPath,
                      pageType: _vm.pageType,
                      isSubmit: _vm.isSubmit,
                    },
                    on: {
                      submitAnswer: _vm.submitAnswer,
                      setanalysis: _vm.setanalysis,
                    },
                  })
                }),
          ],
          2
        ),
      ]),
    ]
  )
};
var __vue_staticRenderFns__$5G = [];
__vue_render__$5G._withStripped = true;

  /* style */
  const __vue_inject_styles__$5G = undefined;
  /* scoped */
  const __vue_scope_id__$5G = "data-v-7cde6dac";
  /* module identifier */
  const __vue_module_identifier__$5G = undefined;
  /* functional template */
  const __vue_is_functional_template__$5G = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5G = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5G, staticRenderFns: __vue_staticRenderFns__$5G },
    __vue_inject_styles__$5G,
    __vue_script__$5G,
    __vue_scope_id__$5G,
    __vue_is_functional_template__$5G,
    __vue_module_identifier__$5G,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$5G.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('question-render', {
    prefix: options.prefix
  }), __vue_component__$5G);
};

var epub = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAoCAMAAAChHKjRAAAAAXNSR0IArs4c6QAAAjdQTFRFAAAAiXb/kG/0inD6inX6jW72jXL2eGLpe2fuinL2i3H3iHf6i3L5dmTvjHH3inP4inH2i3L2d2TuhW7vjHH5d2TqjnH5fWnyd2bskHb5jXX1jHH2i3H3i3H4i3H4d2Xsd2Xqi3H4cmLoi3L4inH3i3L3inL3i3L3jHL3hG3zi3L3jHL4jnT5i3L3i3L3jHH2bFPvbl/nb2DncF/ncVP1cWHncWHocWHpclP2cmLpc2Lpc2Lqc2Ppc2PqdGPpdGPqd1r1d1z0d2TreFv2eFz0eFz1eGDxeGbseVv1eVz1el31el32el71el72e133e1/2e2TxfGD1fGXxfWD3fWH2fmjxf2T2f2rwgGX3gGnygWX2gWb2gWb3gWrzgWzzgmb3gmf2gmzyg23zhGj3hGn2hGr2hGr3hG3zhWr3hWv2hWv3hWz3hW7zhW70hmz3h233h273iG34iG/3iW34iW74iW/3iXD3iXH2inD4inH3inP2i3D4i3H3i3H4i3L3i3L4i3P4jHL3jHL4jHP3jHP4jHT2jHT3jHrxjHryjXP4jXT3jXT5jXX3jXvyjnT5jnX4j3T5j3T6j3b3lYH2l4H4mIL4mYP4movynY/xpJL3pJfzpZL5pZjzqJX5q5n5r576saD6uaz3va/7zMT5zcP7z8X70Mb70sj708n708r71c381c761s382ND72db4393549z+4+H55+b66OL96+b+6+r67+v+8/L99PD/9vT+///9///+////0H5GmAAAADB0Uk5TAA0XMjI6OkZNVVpefX+HjJCRkpSeoausra2vs7W2t7i5v8TN1tbd3t/o6+7v8PH8u0jmrQAAAapJREFUOMtjYGBgYBZQ1sMAOpoKHAwIwF+HDfSlG9nzElADVGRuZScEVcNWiVORvY29KESRZDluRfb2VhJgRSp1OBQlgRTZW8uDFKnjUpRrZgtSZamER1Fji5MhSJG9qTgDgxoORXXd5e5mYGDMjltRXV9nTiIIxAkjKeoq8veFg5DK5rqWvgl9QDBRCklRacG8BfOhYMHs/Bq4hBySIu9Fe5DAXH+4hDRCUaXnqj3b12+EgE3rJidjVeS1ZM9ig4AgMAh1S+3HpWiFX2EJGBRXN9fhUrQyBFt0oylaahIWBQZ5bbgVrW2eMhUMyrLacCqCgx2TUnAr2gUFW1szcCpaHd7RCwLtkVlduB1uEREDAvGFXXWUBcFy5+x8MMgrwh2Yyxyy8sCgKDqtB6sijzV7dm7eAgHbNkxLwKaoznvhbqSkMjMYq6La2BlzZkHBnOmZ9VgVtVX4OLpCgUtgUzNWRXV1zS1w0Ig9CHADaZyZEwnIMGgQViTLoEpYkQiDWBUhNTXcDKwEDdJnZGAQJKCmgQtUQvHhVaPNCSkRWQSVdfWwAi1FHiagAgAPu3js6FbZbgAAAABJRU5ErkJggg==";

var resource = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAoCAMAAAChHKjRAAAAAXNSR0IArs4c6QAAAqNQTFRFAAAAiXb/kG/0inD6inX6jW72jXL2eGLpe2fuinL2i3H3iHf6i3L5dmTvjHH3inP4inH2i3L2d2TuhW7vjHH5d2TqjnH5fWnyd2bskHb5jXX1jHH2i3H3i3H4i3H4d2Xsd2Xqi3H4cmLoi3L4inH3i3L3inL3i3L3jHL3hG3zi3L3jHL4jnT5i3L3i3L3jHH2bl/nb2DncFfwcF/ncWHncWHocWHpcljxclnxcmLpc1f0c2Lpc2Lqc2Ppc2PqdGPpdGPqdVX3dVrydl7xd1n2d1r1d1r2d1z0d2TreFr2eFv2eFz2eGDweGDxeGbseVz2eV32el32e171e172e2H1e2PyfWD3fWH2fWL1fmH2fmL2fmP2f2P3f2T2gGrygWX2gWb2gWf2gWzxgWzzgmj2gmzyg2j3g2v1g23zg27xhGn3hGr2hG3zhHDxhW7zhW70hmv4hnHxh233h273h3D0h3LyiG73iW34iXD3iXH2inD3inH3inH4inP2i3D4i3H3i3L3i3P3i3P4jHL3jHL4jHL5jHP3jHP4jHT3jXP4jXP5jXT3jXT4jXT5jXf1jXryjnT5jnX4jnf3j3T5j3T6kX31kYDxkoLxk3v4k4PxlX74lYbxl4L2mInymYP4moT4m4n1n5HzoIz4oY35ppP5ppb2p5rzqZb5rp/4saH5s6P5s6T4tKX5tav1tqn4t6j5uan7urH1vKz8vrH5wbn2x7v7yL37yMH2yb77yb/6ycT2zMH7zMH8zML7zcj2zsT6zsT8z8X70Mb70Mv30sf80sn808741dL31dL41s3819D719P42M/929L93NX84N746OL+6Of67uj/8fH79PD/9fb8+Pn9+vf/+vn//fv//f3//f79/v3//v7////9///+////+rYR5QAAADB0Uk5TAA0XMjI6OkZNVVpefX+HjJCRkpSeoausra2vs7W2t7i5v8TN1tbd3t/o6+7v8PH8u0jmrQAAAe5JREFUOMtjYGBgYBZQ1sMAOpoKHAwIwN+ADUzIMXTgJaAGqMjM2l4IqoatGqciB1sHUYgiyUrcihwcrCXAilQacCjKAClysJEHKVLHpSjf1A6kylIJj6Lmdg8DkCIHE3EGBjUcihp6K/1MwcCYHbeihgmdeakgkCyMqai+HsZqnzB5AhBMkUJT1FYd6+Ud39CGIiiHoqitIth/3rats9zC65GVSSMp6ijyDl985M6DBzf2zA8IrmrDpqg7K2H5uQdQcHRRVHEbFkUpMy48QAJns4uxKIqZcw9Z0enEMiyKJkaUrr0GU3J4dmhWNxZF4RvOLshdexuk5Ni0zM2XlkRjUeSy/8GDM1MLt1w+MTNp9c0HD9Z7YlHkvwNkyIESZ6MV10GslYHYFO0Gu+aK4yaIs7ArOgSRnHQKQq/CpsjtJFjubvdBiKI1XlgUhS0Fy91q3Aumr/alYVHUHLLwPEhRw04geX9Xf3QPFkVtna4+yy4+eFBx6MH9fdPNIydiTQUNPeVWcRu3x647PtcisKsNe1IBRU2Bu1NVum9Qa3dDA05FDQ0tLW01dagJE1MRNkCkInXCimQYNAgrkmVQJaxIhEGslpCaem4GVoIG6TMyMAgSUNPEBSqh+PCq0eaElIgsgsq6eliBliIPE1ABAEFwqt5aEHsEAAAAAElFTkSuQmCC";

var image$1 = {
  leaflet: {
    epub,
    resource
  }
};

//
// import { OuchnOss } from '@/api/business/file/OuchnOss'
// import { defaultCover } from '@/assets/remote'

var script$5F = {
  name: 'XmlResourceRender',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    officePreviewPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isReader: {
      // 是否阅读器
      type: Boolean,
      default: false
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      ouchnOss: null,
      image: image$1,
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      //属性组件名
      propertyComponentsName: 'xml-resource-property',
      styleClose: false //样式三开关
    };
  },
  computed: {
    // isNotLocalView() {
    //   return !(process.env.VUE_APP_ENV === 'localview')
    // }
  },
  methods: {
    showSize(i) {
      console.log(isNaN(Number(i.fileSize)));
    },
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    countFileSize(fileSize) {
      if (!fileSize) return;
      if (fileSize < 1024) {
        return fileSize + 'B';
      } else if (fileSize < 1024 * 1024) {
        var temp = fileSize / 1024;
        temp = temp.toFixed(2);
        return temp + 'KB';
      } else if (fileSize < 1024 * 1024 * 1024) {
        var temp = fileSize / (1024 * 1024);
        temp = temp.toFixed(2);
        return temp + 'MB';
      } else {
        var temp = fileSize / (1024 * 1024 * 1024);
        temp = temp.toFixed(2);
        return temp + 'GB';
      }
    },
    downloadFile(item) {
      let data = {
        ...item
      };
      data.coverFileUrl = this.resourceBasisPath + data.coverFileUrl.split('./')[1];
      data.uploadFileUrl = this.resourceBasisPath + data.uploadFileUrl.split('./')[1];
      this.$emit('downloadFile', data);
    },
    // 无数据时
    noFileUrlClick() {
      this.$message.warning('没有目标文件');
    },
    downloadFileUrl(item, fileName) {
      let data = {
        ...item
      };
      if (item.uploadFileUrl.indexOf('http') === -1) {
        data.coverFileUrl = this.resourceBasisPath + data.coverFileUrl.split('./')[1];
        data.uploadFileUrl = this.resourceBasisPath + data.uploadFileUrl.split('./')[1];
      }
      if (this.mode != 'editor') {
        this.$emit('downloadFileUrl', {
          item,
          fileName,
          resourceType: this.blockData.resourceType
        });
      } else {
        this.$message.warning('资源仅支持在预览时下载');
      }
    },
    //  跳转office在线预览
    previewToPathClick(item) {
      console.log(item);
      if (this.mode == 'preview' || this.mode == 'reader') {
        this.$EventBus.$emit('learningStatistics', {
          type: 'doc',
          info: item,
          data: item
        });
        // if (item.fileFormat == 'pdf') {
        //   // const pdfUrl = '/pdfjs/web/viewer.html?file=' + encodeURIComponent(item.uploadFileUrl)
        //   this.$router.push({
        //     path: '/webView',
        //     query: {
        //       baseUrl: encodeURIComponent('/pdfjs/web/viewer.html?file=' + item.uploadFileUrl),
        //       title: item.title
        //     }
        //   })
        //   return
        // }
        if (item.fileFormat == 'zip' || item.fileFormat == 'rar' || item.fileFormat == '7z') return;
        if (item.fileFormat == '无') {
          this.$message.warning('没有目标文件');
          return;
        }
        if (item.fileFormat == '外部链接' && !item.link) {
          this.$message.warning('获取资源链接失败，请检查链接地址');
          return;
        }
        if (item.fileFormat == '外部链接') {
          window.open(item.link);
          return;
        }
        let url = item.uploadFileUrl;
        if (item.uploadFileUrl.indexOf('./') !== -1) {
          url = this.resourceBasisPath + item.uploadFileUrl.split('./')[1];
        }
        if (this.isReader) {
          this.$emit('showFileReader', {
            fileFormat: item.fileFormat,
            fileUrl: url,
            title: item.title
          });
        } else {
          if (item.uploadFileUrl.indexOf('http') === -1) {
            window.open((this.officePreviewPath ? this.officePreviewPath : process.env.VUE_APP_OFFICES_READ) + this.resourceBasisPath + item.uploadFileUrl.split('./')[1]);
          } else {
            window.open((this.officePreviewPath ? this.officePreviewPath : process.env.VUE_APP_OFFICES_READ) + item.uploadFileUrl);
          }
        }
      }
    }
  },
  created() {
    // if (this.isNotLocalView) {
    //   this.ouchnOss = new OuchnOss(true)
    // }
  }
};

var __$_require_static_images_default_over_resource_png__ = "f25e95524c42aff3.png";

var __$_require_static_images_leaflet_icons_download_bule_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAWCAYAAADafVyIAAAAAXNSR0IArs4c6QAAAkVJREFUSEvtlEtoE1EUhv9zJ6lpCkYzBl3oSouioosiWII2kwas4gMXdeFSt0ViR0lXmu6UNpN0IejGunGhIPjowlczWdiN6ELFhYgbG8RHJglYsWSSe2QC1dqal5CF4F0Nc8//f3P/O+cQ2ryozf5oCRBOWpPMiCiCgo+j/vfNfFxLAM2wXgPYCpZHTD1wtw2AXAagPjBHTH3N9H/AsgQ041+IqOcKu/3FXOBRLPBh6RHqnSByIe8TSmnFw7PrPi/WLftNtVThHKQcJaKL6dP+kcXFtQB9qdwuIWkGwDdzWF1dH5DMB8E8BWAVBCbNqHpiQfATIDBgRtUHznstVTgMKe84z8QYTetqvC7A2ew1Zjs98DqNFAHwrGTL8Ews8FUzrCcAgkLQzumo/2UoacWJcd7RMLA/M6zeXxpr3U7WjNx1gI4D4pNS4s2VDk4AOMlwdTPKhwRgAPgOLvea+toXf2q8hqMibFjjDOgALAAfAWwD8TswbSTglbRxIBNTs7W6uiGgmrNhHQNw47dsmW6ndf/RRuOiKYBj0p/4okkSzvwhMF0ydf9QI/PBm6zQ3on8lMuW2+c8HT1Ph1Y6MdRc/WP5HVJwt6mrtxqZa+PWVSjYR7uvFdiXraDk5i1mLPCmkbDZfc2wZgGsp+DlXNFbgM/uog2ZU7Uvq1njhbpQMv9WsNxEexLFMY8snZnvVJ6zVEbcJRQAu1W/X/Xc4bK9GFDsctxVRrl6yaGJ/D3FrhxkEsyEub93ryoVkuwlwdl5T9fgD6jm9+bSxCy2AAAAAElFTkSuQmCC";

var __$_require_static_images_leaflet_icons_resource_icon_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAeCAYAAAA/xX6fAAAAAXNSR0IArs4c6QAAAqdJREFUSEvFls9LVFEUx7/fOzZTiWPjFKhgUG5Mg0QNQQpRgpCC/ol+ULSwtlFQQctcucj8I2oRVAszDENwrMBRCWpTGdX8yNFsZsx74j5nnjqN43tPpbN73HPO59x7frxDFEg0Lo2EPi9gDwSHrGPiIyFPBWqwKcypQhs338wrR0X8TOr7IrwMQG3gRAPyMLiortXV8bcbUF7XAhoYEvIEwCmHToZQxZ4mMutQ31azgJOx5X6SV9wYk9LfWOW76sbGyk40Lk2AvAPgc2csqPfNLAWYjgGYAvEc8D1isPl9KT+cjC/3Eex1B1vRrlLfUa2+FJqOQPEmK1peFvPJaFxPA2jwAgwwjXqfMf9HBMQAKlK9ZFd67akBZgD4vQAJwZGyt6VMXwOZs6zsSNhVuhWggkZDmUl/SRnDL+lmbdtirmh25EnXRyAc5L6WCxZwa0XzA9Xq82Y3NOcCxS5TSJxKyFERMYnw0hYwheNQXrGy9aTnxg+pGGrUJ4esnJpmsz3a/Mn0dFYCh514KOc8Dvo+wFSpO+Ede3jrn2+Gv0ltZ0IfKOnD3Mw0O6HdsayK4bANlLnILICajOxGUvZjQYJYEr91i13MwtwqxJibnBUL6OtaoOcB4OKq2f8KtJ7URbReVNc8aSoyBEGXFy+ObdYXzcRtQG45NvakyLurOUxOHIOyJs7OSb7x8wSZi4wAOLFDxNXRZgPnJzqh5YW1GG6vCLTuZuj4auPb0FTkAQQXt5VHDDDYeskaNoWOZXZ8L8o5BKB9m6Drf8DFnEpqLAwpM3vqVqFj4J8zDLbH85wNcyUyugfzgb7c87rN6coStSDX86vFpsCCQroHoMPhE49C6xumQIrpO45cUuMN0OoclJw2yxqAcM5hHMQ0NJ9B6ccMts2UCuwvOp8JMVRGUysAAAAASUVORK5CYII=";

var __$_require_static_images_leaflet_icons_resource_elliptic_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAAAaCAYAAAB2KPSUAAAAAXNSR0IArs4c6QAAB3VJREFUaEPtmttuJLcRhr+q7jlpd+WDhDgGBGOBXMW+i19gkQcP9gWcOztXARaGAMeBNra1kmamp8kKimzOQZqRRtqRIBsjgOKxe9isn1Wsvyjs//YrsLQCsl+N/Qosr8AeEHs8rKzAswaEmd1nfvcZ+xgwsG1fKiJbj932nbsa96SLuEHAy3OQtyCvQEYgfZD6HVLXyM8V0lPS2FqRSpCqq6vk9nNv68peL+XSXxZNyePv+ouwIrhouR66vJQPu/q8P2I+po15/CxiXwSsbbH2NdaAjcE+gL3Jv7H8OzfA8pQA2mph7lo4718j7PLuJOQ/gR68Q98PUBfsoEJ7FepC7CtaCzq5Sm1VUOpeRR2aXK6EKgqVempRL4t0OagKGlrU2zwFEClJUEC8zeeZ2mNqS+V132adgEyJpVx1gjPLbZ68LdWNWNXEmPuiGsHbvK41IRrB24IRqkhb9QmzQOvlWSAMD4itEZtIdHDNAnEaiA6koynx6jXxvxCvgWcFOLsCzYMAsSR8fz4J/ASq4Sl6PqDqV+i4ouop2o6pY01PKvr9GT2r6BPoo/RN6XnZc4PaIr1K6RPpI12y1NfD6CH0hFibUGPU4s9Ies4BUllSCimpORBiBoiRQZExkv7l/lv+pBNu3r0uf9x+JeH7m0u/QRBXGkYQJYjRGrQIbS5rizFDmAk5x2hSUpoQaURTXyuRGRVNyiNNKgeapsfMAo22zOoR7SwSR4HQBOLhlDA5IZ5CWAJMAstDQLIVIDoApMX8DvSLU2oXfNOjflnTu2oY1IGh1oxCZCjKUCKDoAzVGCIMzThQGJkwwuIIOPB2zOs+RjIIXPBQuWVIQjbqIugVgecxLtSKLHw3Fl4vyQ110hQZDEvJ0tjbv93NgMzVeVHrSTPIQs1HwA2Dg8Sf8HpIbTmFOWA64IjQOnhw0PjYOUCsQZggjDEmwBWiYzHGEcYiXHl7FCZVZGLK1CKTSpnElnFbMTnoM71omfVntA6Un09ov83zyIDe4uyycVEKCN6Cvn5H3R7Sp89g1nJgkRcYL4GXKa94JXAY4VCIrzBeeZ/BgYi4wAdAv0u+27Pwc1vSAL7bMfxU4IK+KcTVNv/CLGwXW9b/cxPVbfyVs8k1ZbDVRrhm25NlXHpPKee8nCskm5MONOWZOaCKcOa5g0OSqWmTBskpaxChmde9TZia2VgcLHCB8MHQDwrnBucEPiBcdH0Xolz2aq5omNbnNO9e077pALIJHOttqJn+AHV1xiDCyyB8ivAZwucSORLhGIlHGJ8Dn/o5UIQD890Owy45CAau2jshX9+9KhkAPodOpd/YtdsKrjsSbHPaebQx9/Ecro8tgHFt475VdPPUgaZoG+9z8LhmmXbJNclEhLGZg8TPqfyK8D9M35txZsp7zOv8Uhm/KlyEY6ZfOwD9NHXXTjEzPT1lcDnkM4MvTfgK4SsjnmD8GZEjgU+MpAVeQAKB7/R6rsKLKs+7etlWrxPwfYT+aNJ8Ri9eB6zltgKUYppK7kBxjTIGLgXXHvyG2XuE/wh6ivGjeIKfXkz45eSE6XVQrAjDzcQP0KvOOI7KN1H4mxC/IYqD4hg4TLbfD3kZAAUERei3qelntOZ/iKmsM19Fmzg4PLn5cfNyjnGG2o+Gfq/GPzXyfTjm7GuYLZuPG4D47idGL4b8xYy/m9gbjL9CAoNrAgdCUf3PQU3/IST7CB9RwFIA4sBwzXGG8C8xeSvCPy4n/PvbL/3AuiDK9oB4BGk8g1fuDhB7k/EMxLndFB7fZHSM48ccKgs3kPmB/aFyO9GujrrvobJwH7s/VJZ5uaexye3U6C4nx1g8cjcU+GSD2+nuZ+IZls4dy6TR3u1cAGE7tzO7opmnIJFX69zO35KbKeru5llUzj7K7VwCRaGl1xFTTki5y7mOmDqck1bulmZiqpBQOc809E1iasE+PiYxdV83d1PgaTfE1ILRXEdMFeE7ADJRZR4X47KQT4aebyCmLkW52AkxdV3PPYi6NoZBGDh1LcYoCqNEXZuzl3FkMBJJdaevV6jrFKNwcCxILXdvPVahHqvozFHRNpm6dpJrYaJSuWMzS3v2ihZk2N3qPNPXxe/PFpVEGi12dCGQfNxm6nqh1jtyKcU/csyji21k6lqEiRnORo7NNFHWTl2rMTZhnKhrY2o+7imp69tW66HBLVr6vS6gtS645ZpEhV6MDDzvYhtOc/c88IV4QOvu4JZ5NDRHNCWV57S3OKDuDGyVb18EuCyBIlHSOQ5hHgn18pbBrdYDWF2QK9HS0ZipMvXcd/6m4NbMA101zbMKbt29lW4Pf3tAzO837CL8HdsUBk9RzBQGXxP+jlmTpABWAcM8JO7k76J946elsLfTyNUi1F1AkdrBtIt+PkX42+9PLAWqSoxkPv9tAlfbyPG+9nSbd25e5PU3oFbYzYdekPF7Ff7D5VLM8kWZ5Qsy216OKR+xfEmmXIDxvnJJpuR+j2F/Qeaj4HH3w/srdHev0a5HPKmG2PXk9+/b/QrsAbH7Nf1dv3EPiN+1+HY/+f8DdDLzV5L1opoAAAAASUVORK5CYII=";

var __$_require_static_images_leaflet_icons_download_white_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c6QAAAjlJREFUSEvtlcurjWEUh59fSpFLJOUUcquDciuXRExkrkxMMDkGkpPEgAEDipJIIuU2MPAnKJLEQK4hhDoZSCEhcv1p7dbJbnf23t+3nW201+Sr911rPd+6vqJFsT0NeJ7mOyUdLONKZZSrdW1PBV7kWa+kI2V8/Qt4CvAyYVskHeuAG2Wgk+rC/WG701yDN062J0p6NVD+i6ba9gTgvaRv1X7qdrXtS8AqYI+kvbXwImDb64DzuVpnSnK/n0bgR8CsVNwnaXfNymzYXLY3AqfT5hcwVNLvIuAxwA2gO5X3S9rVb9goYtvrgbOpGyleKulOoVSHku3hwGNgchodkrQ972YAz/J8q6Sjed4DnMzz78AiSfdrS9V0c9keD1wHAhRSidz2WOBdnvVIOlWT3oh0uaRbAzVnU3BGMQ64CUxPJ5slHbf9BRgGrAA+A7fz/gewWNLdehupEDjhAYi/n53OLgArgS7gakQHDAG+AkskPWi0BguDEz4y0z6njtOALpD0pBE07kqBqxruIRDjVC0/gfmS4q6plAYnfFTWs7/mUdOItBC0ErHtgG8D3ko61/RXU8H26KxtfNdIulfCdlmA1wIX06hL0uuiDlrRsx1N+jHAO4AD6aRb0tNWHBa1yb3wJsC9wOH/GPGISlltbwDOJHhus/krGlk9Pdsxkh8CPAnoS8XLwGpJ8Zq0RWyfADZVxsl2PF/xjIV8Aq4B7YDPAyLQvwvE9hVgIRA1aKfEdutraYEMxl/9AUsz/weMzneQAAAAAElFTkSuQmCC";

/* script */
const __vue_script__$5F = script$5F;
var __vue_render__$5F = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      class: "xml-resource-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _c("div", { staticClass: "resource-box" }, [
        _c(
          "div",
          {
            class: [
              "preview-container-resource",
              "preview-container-resource-" + _vm.mode,
            ],
          },
          [
            _vm.blockData.styleMode == "A" || !_vm.blockData.styleMode
              ? _c(
                  "div",
                  [
                    _vm.blockData.resourceSetList &&
                    _vm.blockData.resourceSetList.length
                      ? _vm._l(
                          _vm.blockData.resourceSetList,
                          function (item, index) {
                            return _c(
                              "div",
                              {
                                key: index,
                                staticClass:
                                  "workbench-shop-item resource-style1 xml-group-item",
                              },
                              [
                                _c(
                                  "div",
                                  {
                                    staticClass:
                                      "shop-item-img slip-over-cover",
                                    on: {
                                      click: function ($event) {
                                        return _vm.previewToPathClick(item)
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      staticClass:
                                        "shop-item-img-resource xml-round-6",
                                      attrs: {
                                        src:
                                          item.coverFileUrl &&
                                          item.coverFileUrl.indexOf(
                                            "http://124.133.23.84:20000"
                                          ) === -1
                                            ? item.coverFileUrl.indexOf(
                                                "./"
                                              ) !== -1
                                              ? _vm.resourceBasisPath +
                                                item.coverFileUrl.split("./")[1]
                                              : item.coverFileUrl
                                            : __$_require_static_images_default_over_resource_png__,
                                      },
                                    }),
                                  ]
                                ),
                                _vm._v(" "),
                                _c("div", { staticClass: "shop-item-desc" }, [
                                  _c("div", { staticClass: "filecont" }, [
                                    _c(
                                      "div",
                                      {
                                        staticClass:
                                          "xml-resource-title shop-item-desc-title preview-item-file",
                                        on: {
                                          click: function ($event) {
                                            return _vm.previewToPathClick(item)
                                          },
                                        },
                                      },
                                      [
                                        _vm._v(
                                          "\n                  " +
                                            _vm._s(
                                              item.title
                                                ? item.title
                                                : "资源样例"
                                            ) +
                                            "\n                "
                                        ),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      { staticClass: "shop-item-desc-detail" },
                                      [
                                        _vm._v(
                                          "\n                  文件格式：" +
                                            _vm._s(
                                              item.fileFormat
                                                ? item.fileFormat
                                                : "无"
                                            ) +
                                            "\n\n                  "
                                        ),
                                        _vm.blockData.resourceType == "0" &&
                                        item.source != "" &&
                                        !isNaN(Number(item.fileSize))
                                          ? _c(
                                              "div",
                                              {
                                                staticClass: "pointer",
                                                on: {
                                                  click: function ($event) {
                                                    $event.stopPropagation();
                                                    return _vm.downloadFileUrl(
                                                      item,
                                                      item.title +
                                                        "." +
                                                        item.fileFormat
                                                    )
                                                  },
                                                },
                                              },
                                              [
                                                _c("img", {
                                                  staticClass:
                                                    "shop-item-img-resource",
                                                  attrs: {
                                                    src: __$_require_static_images_leaflet_icons_download_bule_png__,
                                                  },
                                                }),
                                                _vm._v(
                                                  "立即下载\n                  "
                                                ),
                                              ]
                                            )
                                          : _vm._e(),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      {
                                        staticClass: "shop-item-desc-detail",
                                        on: {
                                          click: function ($event) {
                                            return _vm.showSize(item)
                                          },
                                        },
                                      },
                                      [
                                        _vm._v(
                                          "\n                  文件大小：" +
                                            _vm._s(
                                              !isNaN(Number(item.fileSize))
                                                ? _vm.countFileSize(
                                                    item.fileSize
                                                  )
                                                : "无"
                                            ) +
                                            "\n                "
                                        ),
                                      ]
                                    ),
                                  ]),
                                ]),
                              ]
                            )
                          }
                        )
                      : [
                          _c(
                            "div",
                            {
                              staticClass:
                                "workbench-shop-item resource-style1 xml-group-item",
                            },
                            [
                              _c("div", { staticClass: "shop-item-img" }, [
                                _c("img", {
                                  staticClass: "shop-item-img-resource",
                                  attrs: {
                                    src: __$_require_static_images_default_over_resource_png__,
                                  },
                                }),
                              ]),
                              _vm._v(" "),
                              _c("div", { staticClass: "shop-item-desc" }, [
                                _vm._m(0),
                                _vm._v(" "),
                                _vm.blockData.resourceType == "0"
                                  ? _c(
                                      "div",
                                      { staticClass: "shop-item-desc-detail" },
                                      [
                                        !isNaN(Number(_vm.item.fileSize))
                                          ? _c("div", [
                                              _c("img", {
                                                staticClass:
                                                  "shop-item-img-resource",
                                                attrs: {
                                                  src: __$_require_static_images_leaflet_icons_download_bule_png__,
                                                },
                                              }),
                                              _vm._v(
                                                "立即下载\n                "
                                              ),
                                            ])
                                          : _vm._e(),
                                      ]
                                    )
                                  : _vm._e(),
                              ]),
                            ]
                          ),
                        ],
                  ],
                  2
                )
              : _vm._e(),
            _vm._v(" "),
            _vm.blockData.styleMode == "B"
              ? _c(
                  "div",
                  [
                    _vm.blockData.resourceSetList &&
                    _vm.blockData.resourceSetList.length
                      ? _vm._l(
                          _vm.blockData.resourceSetList,
                          function (item, index) {
                            return _c(
                              "div",
                              {
                                key: index,
                                staticClass:
                                  "style-mode__item--body xml-group-item",
                              },
                              [
                                _c("div", { staticClass: "right" }, [
                                  _c(
                                    "div",
                                    {
                                      staticClass: "title",
                                      on: {
                                        click: function ($event) {
                                          return _vm.previewToPathClick(item)
                                        },
                                      },
                                    },
                                    [
                                      _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_leaflet_icons_resource_icon_png__,
                                          alt: "",
                                        },
                                      }),
                                      _vm._v(" "),
                                      _c(
                                        "span",
                                        { staticClass: "xml-resource-title" },
                                        [
                                          _vm._v(
                                            _vm._s(
                                              item.title
                                                ? item.title
                                                : "资源样例"
                                            )
                                          ),
                                        ]
                                      ),
                                    ]
                                  ),
                                  _vm._v(" "),
                                  !isNaN(Number(item.fileSize))
                                    ? _c(
                                        "div",
                                        { staticClass: "downloadbtn" },
                                        [
                                          _vm.blockData.resourceType == "0" &&
                                          item.source != ""
                                            ? _c(
                                                "div",
                                                {
                                                  staticClass: "pointer",
                                                  on: {
                                                    click: function ($event) {
                                                      $event.stopPropagation();
                                                      return _vm.downloadFileUrl(
                                                        item,
                                                        item.title +
                                                          "." +
                                                          item.fileFormat
                                                      )
                                                    },
                                                  },
                                                },
                                                [
                                                  _c("img", {
                                                    staticClass:
                                                      "shop-item-img-resource",
                                                    attrs: {
                                                      src: __$_require_static_images_leaflet_icons_download_bule_png__,
                                                    },
                                                  }),
                                                  _vm._v(
                                                    "立即下载\n                "
                                                  ),
                                                ]
                                              )
                                            : _vm._e(),
                                        ]
                                      )
                                    : _vm._e(),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "left" }, [
                                  _c(
                                    "div",
                                    {
                                      staticClass: "default-cover",
                                      on: {
                                        click: function ($event) {
                                          return _vm.previewToPathClick(item)
                                        },
                                      },
                                    },
                                    [
                                      _c("img", {
                                        staticClass:
                                          "shop-item-img-resource xml-round-6",
                                        attrs: {
                                          src:
                                            item.coverFileUrl &&
                                            item.coverFileUrl.indexOf(
                                              "http://124.133.23.84:20000"
                                            ) === -1
                                              ? item.coverFileUrl.indexOf(
                                                  "./"
                                                ) !== -1
                                                ? _vm.resourceBasisPath +
                                                  item.coverFileUrl.split(
                                                    "./"
                                                  )[1]
                                                : item.coverFileUrl
                                              : __$_require_static_images_default_over_resource_png__,
                                        },
                                      }),
                                    ]
                                  ),
                                  _vm._v(" "),
                                  _c(
                                    "div",
                                    { staticClass: "cover-bot-elliptic" },
                                    [
                                      _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_leaflet_icons_resource_elliptic_png__,
                                          alt: "",
                                        },
                                      }),
                                    ]
                                  ),
                                ]),
                              ]
                            )
                          }
                        )
                      : [
                          _c(
                            "div",
                            {
                              staticClass:
                                "style-mode__item--body xml-group-item",
                            },
                            [
                              _c("div", { staticClass: "right" }, [
                                _c("div", { staticClass: "title" }, [
                                  _c("img", {
                                    attrs: {
                                      src: __$_require_static_images_leaflet_icons_resource_icon_png__,
                                      alt: "",
                                    },
                                  }),
                                  _vm._v("资源名称\n              "),
                                ]),
                                _vm._v(" "),
                                !isNaN(Number(_vm.item.fileSize))
                                  ? _c("div", { staticClass: "downloadbtn" }, [
                                      _vm.blockData.resourceType == "0"
                                        ? _c("div", [
                                            _c("img", {
                                              staticClass:
                                                "shop-item-img-resource",
                                              attrs: {
                                                src: __$_require_static_images_leaflet_icons_download_bule_png__,
                                              },
                                            }),
                                            _vm._v(
                                              "立即下载\n                "
                                            ),
                                          ])
                                        : _vm._e(),
                                    ])
                                  : _vm._e(),
                              ]),
                              _vm._v(" "),
                              _c("div", { staticClass: "left" }, [
                                _c("div", { staticClass: "default-cover" }, [
                                  _c("img", {
                                    staticClass: "shop-item-img-resource",
                                    attrs: {
                                      src: __$_require_static_images_default_over_resource_png__,
                                    },
                                  }),
                                ]),
                                _vm._v(" "),
                                _c(
                                  "div",
                                  { staticClass: "cover-bot-elliptic" },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_leaflet_icons_resource_elliptic_png__,
                                        alt: "",
                                      },
                                    }),
                                  ]
                                ),
                              ]),
                            ]
                          ),
                        ],
                  ],
                  2
                )
              : _vm._e(),
            _vm._v(" "),
            _vm.blockData.styleMode == "C"
              ? _c(
                  "div",
                  [
                    _vm.blockData.resourceSetList &&
                    _vm.blockData.resourceSetList.length
                      ? [
                          _c(
                            "div",
                            { staticClass: "style-mode__item--body" },
                            [
                              _c(
                                "el-row",
                                _vm._l(
                                  _vm.blockData.resourceSetList,
                                  function (item, index) {
                                    return _c(
                                      "el-col",
                                      { key: index, attrs: { span: 4 } },
                                      [
                                        _c(
                                          "div",
                                          {
                                            staticClass:
                                              "filecard xml-group-item",
                                          },
                                          [
                                            _c(
                                              "div",
                                              { staticClass: "default-cover" },
                                              [
                                                _c("img", {
                                                  staticClass:
                                                    "shop-item-img-resource xml-round-6",
                                                  attrs: {
                                                    src:
                                                      item.coverFileUrl &&
                                                      item.coverFileUrl.indexOf(
                                                        "http://124.133.23.84:20000"
                                                      ) === -1
                                                        ? item.coverFileUrl.indexOf(
                                                            "./"
                                                          ) !== -1
                                                          ? _vm.resourceBasisPath +
                                                            item.coverFileUrl.split(
                                                              "./"
                                                            )[1]
                                                          : item.coverFileUrl
                                                        : __$_require_static_images_default_over_resource_png__,
                                                  },
                                                }),
                                                _vm._v(" "),
                                                _vm.blockData.resourceType ==
                                                  "0" &&
                                                item.source != "" &&
                                                !isNaN(Number(item.fileSize))
                                                  ? _c(
                                                      "div",
                                                      {
                                                        staticClass:
                                                          "downloadmask pointer",
                                                        on: {
                                                          click: function (
                                                            $event
                                                          ) {
                                                            $event.stopPropagation();
                                                            return _vm.downloadFileUrl(
                                                              item,
                                                              item.title +
                                                                "." +
                                                                item.fileFormat
                                                            )
                                                          },
                                                        },
                                                      },
                                                      [
                                                        _c("img", {
                                                          staticClass:
                                                            "shop-item-img-resource",
                                                          attrs: {
                                                            src: __$_require_static_images_leaflet_icons_download_white_png__,
                                                          },
                                                        }),
                                                        _vm._v(
                                                          "\n                      立即下载\n                    "
                                                        ),
                                                      ]
                                                    )
                                                  : _vm._e(),
                                              ]
                                            ),
                                            _vm._v(" "),
                                            _c(
                                              "div",
                                              {
                                                staticClass:
                                                  "xml-resource-title filename",
                                                on: {
                                                  click: function ($event) {
                                                    return _vm.previewToPathClick(
                                                      item
                                                    )
                                                  },
                                                },
                                              },
                                              [
                                                _vm._v(
                                                  "\n                    " +
                                                    _vm._s(
                                                      item.title
                                                        ? item.title
                                                        : "资源样例"
                                                    ) +
                                                    "\n                  "
                                                ),
                                              ]
                                            ),
                                          ]
                                        ),
                                      ]
                                    )
                                  }
                                ),
                                1
                              ),
                            ],
                            1
                          ),
                        ]
                      : [
                          _c(
                            "div",
                            { staticClass: "style-mode__item--body" },
                            [
                              _c(
                                "el-row",
                                [
                                  _c("el-col", { attrs: { span: 8 } }, [
                                    _c(
                                      "div",
                                      {
                                        staticClass: "filecard xml-group-item",
                                      },
                                      [
                                        _c(
                                          "div",
                                          { staticClass: "default-cover" },
                                          [
                                            _c("img", {
                                              staticClass:
                                                "shop-item-img-resource",
                                              attrs: {
                                                src: __$_require_static_images_default_over_resource_png__,
                                              },
                                            }),
                                            _vm._v(" "),
                                            _vm.blockData.resourceType == "0" &&
                                            !isNaN(Number(_vm.item.fileSize))
                                              ? _c(
                                                  "div",
                                                  {
                                                    staticClass: "downloadmask",
                                                  },
                                                  [
                                                    _c("img", {
                                                      staticClass:
                                                        "shop-item-img-resource",
                                                      attrs: {
                                                        src: __$_require_static_images_leaflet_icons_download_white_png__,
                                                      },
                                                    }),
                                                    _vm._v(
                                                      "\n                      立即下载\n                    "
                                                    ),
                                                  ]
                                                )
                                              : _vm._e(),
                                          ]
                                        ),
                                        _vm._v(" "),
                                        _c("div", { staticClass: "filename" }, [
                                          _vm._v(
                                            "资源名称资源名称资源名称资源名称资源名称"
                                          ),
                                        ]),
                                      ]
                                    ),
                                  ]),
                                ],
                                1
                              ),
                            ],
                            1
                          ),
                        ],
                  ],
                  2
                )
              : _vm._e(),
            _vm._v(" "),
            _vm.blockData.styleMode == "D"
              ? _c(
                  "div",
                  [
                    _vm.blockData.resourceSetList &&
                    _vm.blockData.resourceSetList.length
                      ? _vm._l(
                          _vm.blockData.resourceSetList,
                          function (item, index) {
                            return _c(
                              "div",
                              {
                                key: index,
                                staticClass:
                                  "workbench-shop-item resource-style4 xml-group-item",
                              },
                              [
                                _c(
                                  "div",
                                  {
                                    staticClass:
                                      "shop-item-img slip-over-cover",
                                    on: {
                                      click: function ($event) {
                                        return _vm.previewToPathClick(item)
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      staticClass:
                                        "shop-item-img-resource xml-round-6",
                                      attrs: {
                                        src:
                                          item.coverFileUrl &&
                                          item.coverFileUrl.indexOf(
                                            "http://124.133.23.84:20000"
                                          ) === -1
                                            ? item.coverFileUrl.indexOf(
                                                "./"
                                              ) !== -1
                                              ? _vm.resourceBasisPath +
                                                item.coverFileUrl.split("./")[1]
                                              : item.coverFileUrl
                                            : __$_require_static_images_default_over_resource_png__,
                                      },
                                    }),
                                  ]
                                ),
                                _vm._v(" "),
                                _c("div", { staticClass: "shop-item-desc" }, [
                                  _c("div", { staticClass: "filecont" }, [
                                    _c(
                                      "div",
                                      {
                                        staticClass:
                                          "shop-item-desc-title preview-item-file",
                                        on: {
                                          click: function ($event) {
                                            return _vm.previewToPathClick(item)
                                          },
                                        },
                                      },
                                      [
                                        _vm._v(
                                          "\n                  " +
                                            _vm._s(
                                              item.title
                                                ? item.title
                                                : "资源样例"
                                            ) +
                                            "\n                "
                                        ),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      { staticClass: "shop-item-desc-detail" },
                                      [
                                        _vm._v(
                                          "\n                  文件格式：" +
                                            _vm._s(
                                              item.fileFormat
                                                ? item.fileFormat
                                                : "无"
                                            ) +
                                            "\n\n                  "
                                        ),
                                        _vm.blockData.resourceType == "0" &&
                                        item.source != "" &&
                                        !isNaN(Number(item.fileSize))
                                          ? _c(
                                              "div",
                                              {
                                                staticClass: "pointer",
                                                on: {
                                                  click: function ($event) {
                                                    $event.stopPropagation();
                                                    return _vm.downloadFileUrl(
                                                      item,
                                                      item.title +
                                                        "." +
                                                        item.fileFormat
                                                    )
                                                  },
                                                },
                                              },
                                              [
                                                _c("img", {
                                                  staticClass:
                                                    "shop-item-img-resource",
                                                  attrs: {
                                                    src: __$_require_static_images_leaflet_icons_download_bule_png__,
                                                  },
                                                }),
                                                _vm._v(
                                                  "立即下载\n                  "
                                                ),
                                              ]
                                            )
                                          : _vm._e(),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      { staticClass: "shop-item-desc-detail" },
                                      [
                                        _vm._v(
                                          "\n                  文件大小：" +
                                            _vm._s(
                                              !isNaN(Number(item.fileSize))
                                                ? _vm.countFileSize(
                                                    item.fileSize
                                                  )
                                                : "无"
                                            ) +
                                            "\n                "
                                        ),
                                      ]
                                    ),
                                  ]),
                                ]),
                              ]
                            )
                          }
                        )
                      : [
                          _c(
                            "div",
                            {
                              staticClass:
                                "workbench-shop-item resource-style4 xml-group-item",
                            },
                            [
                              _c("div", { staticClass: "shop-item-img" }, [
                                _c("img", {
                                  staticClass: "shop-item-img-resource",
                                  attrs: {
                                    src: __$_require_static_images_default_over_resource_png__,
                                  },
                                }),
                              ]),
                              _vm._v(" "),
                              _c("div", { staticClass: "shop-item-desc" }, [
                                _vm._m(1),
                                _vm._v(" "),
                                _vm.blockData.resourceType == "0"
                                  ? _c(
                                      "div",
                                      { staticClass: "shop-item-desc-detail" },
                                      [
                                        !isNaN(Number(_vm.item.fileSize))
                                          ? _c("div", [
                                              _c("img", {
                                                staticClass:
                                                  "shop-item-img-resource",
                                                attrs: {
                                                  src: __$_require_static_images_leaflet_icons_download_bule_png__,
                                                },
                                              }),
                                              _vm._v(
                                                "立即下载\n                "
                                              ),
                                            ])
                                          : _vm._e(),
                                      ]
                                    )
                                  : _vm._e(),
                              ]),
                            ]
                          ),
                        ],
                  ],
                  2
                )
              : _vm._e(),
            _vm._v(" "),
            _vm.blockData.styleMode == "E"
              ? _c(
                  "div",
                  [
                    _vm.blockData.resourceSetList &&
                    _vm.blockData.resourceSetList.length
                      ? _vm._l(
                          _vm.blockData.resourceSetList,
                          function (item, index) {
                            return _c(
                              "div",
                              {
                                key: index,
                                staticClass:
                                  "workbench-shop-item resource-style5 xml-group-item",
                              },
                              [
                                _c(
                                  "div",
                                  {
                                    staticClass:
                                      "shop-item-img slip-over-cover",
                                    on: {
                                      click: function ($event) {
                                        return _vm.previewToPathClick(item)
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      staticClass:
                                        "shop-item-img-resource xml-round-6",
                                      attrs: {
                                        src:
                                          item.coverFileUrl &&
                                          item.coverFileUrl.indexOf(
                                            "http://124.133.23.84:20000"
                                          ) === -1
                                            ? item.coverFileUrl.indexOf(
                                                "./"
                                              ) !== -1
                                              ? _vm.resourceBasisPath +
                                                item.coverFileUrl.split("./")[1]
                                              : item.coverFileUrl
                                            : __$_require_static_images_default_over_resource_png__,
                                      },
                                    }),
                                  ]
                                ),
                                _vm._v(" "),
                                _c("div", { staticClass: "shop-item-desc" }, [
                                  _c("div", { staticClass: "filecont" }, [
                                    _c(
                                      "div",
                                      {
                                        staticClass:
                                          "shop-item-desc-title shop-item-desc-title2 preview-item-file",
                                        on: {
                                          click: function ($event) {
                                            return _vm.previewToPathClick(item)
                                          },
                                        },
                                      },
                                      [
                                        _vm._v(
                                          "\n                  " +
                                            _vm._s(
                                              item.title
                                                ? item.title
                                                : "资源样例"
                                            ) +
                                            "\n                "
                                        ),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      {
                                        staticClass:
                                          "shop-item-desc-detail shop-item-desc-detail2",
                                      },
                                      [
                                        _vm._v(
                                          "\n                  文件格式：" +
                                            _vm._s(
                                              item.fileFormat
                                                ? item.fileFormat
                                                : "无"
                                            ) +
                                            "\n\n                  "
                                        ),
                                        _vm.blockData.resourceType == "0" &&
                                        item.source != "" &&
                                        !isNaN(Number(item.fileSize))
                                          ? _c(
                                              "div",
                                              {
                                                staticClass:
                                                  "pointer color-white",
                                                on: {
                                                  click: function ($event) {
                                                    $event.stopPropagation();
                                                    return _vm.downloadFileUrl(
                                                      item,
                                                      item.title +
                                                        "." +
                                                        item.fileFormat
                                                    )
                                                  },
                                                },
                                              },
                                              [
                                                _c("img", {
                                                  staticClass:
                                                    "shop-item-img-resource",
                                                  attrs: {
                                                    src: __$_require_static_images_leaflet_icons_download_bule_png__,
                                                  },
                                                }),
                                                _vm._v(
                                                  "立即下载\n                  "
                                                ),
                                              ]
                                            )
                                          : _vm._e(),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      {
                                        staticClass:
                                          "shop-item-desc-detail shop-item-desc-detail2",
                                      },
                                      [
                                        _vm._v(
                                          "\n                  文件大小：" +
                                            _vm._s(
                                              !isNaN(Number(item.fileSize))
                                                ? _vm.countFileSize(
                                                    item.fileSize
                                                  )
                                                : "无"
                                            ) +
                                            "\n                "
                                        ),
                                      ]
                                    ),
                                  ]),
                                ]),
                              ]
                            )
                          }
                        )
                      : [
                          _c(
                            "div",
                            {
                              staticClass:
                                "workbench-shop-item resource-style5 xml-group-item",
                            },
                            [
                              _c("div", { staticClass: "shop-item-img" }, [
                                _c("img", {
                                  staticClass: "shop-item-img-resource",
                                  attrs: {
                                    src: __$_require_static_images_default_over_resource_png__,
                                  },
                                }),
                              ]),
                              _vm._v(" "),
                              _c("div", { staticClass: "shop-item-desc" }, [
                                _vm._m(2),
                                _vm._v(" "),
                                _vm.blockData.resourceType == "0"
                                  ? _c(
                                      "div",
                                      {
                                        staticClass:
                                          "shop-item-desc-detail shop-item-desc-detail2",
                                      },
                                      [
                                        !isNaN(Number(_vm.item.fileSize))
                                          ? _c("div", [
                                              _c("img", {
                                                staticClass:
                                                  "shop-item-img-resource",
                                                attrs: {
                                                  src: __$_require_static_images_leaflet_icons_download_bule_png__,
                                                },
                                              }),
                                              _vm._v(
                                                "立即下载\n                "
                                              ),
                                            ])
                                          : _vm._e(),
                                      ]
                                    )
                                  : _vm._e(),
                              ]),
                            ]
                          ),
                        ],
                  ],
                  2
                )
              : _vm._e(),
          ]
        ),
      ]),
    ]
  )
};
var __vue_staticRenderFns__$5F = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", [
      _c("div", { staticClass: "shop-item-desc-title" }, [_vm._v("资源样例")]),
      _vm._v(" "),
      _c("div", { staticClass: "shop-item-desc-detail" }, [
        _vm._v("文件格式：无"),
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "shop-item-desc-detail" }, [
        _vm._v("文件大小：0"),
      ]),
    ])
  },
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", [
      _c("div", { staticClass: "shop-item-desc-title" }, [_vm._v("资源样例")]),
      _vm._v(" "),
      _c("div", { staticClass: "shop-item-desc-detail" }, [
        _vm._v("文件格式：无"),
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "shop-item-desc-detail" }, [
        _vm._v("文件大小：0"),
      ]),
    ])
  },
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", [
      _c("div", { staticClass: "shop-item-desc-title shop-item-desc-title2" }, [
        _vm._v("资源样例"),
      ]),
      _vm._v(" "),
      _c(
        "div",
        { staticClass: "shop-item-desc-detail shop-item-desc-detail2" },
        [_vm._v("文件格式：无")]
      ),
      _vm._v(" "),
      _c(
        "div",
        { staticClass: "shop-item-desc-detail shop-item-desc-detail2" },
        [_vm._v("文件大小：0")]
      ),
    ])
  },
];
__vue_render__$5F._withStripped = true;

  /* style */
  const __vue_inject_styles__$5F = undefined;
  /* scoped */
  const __vue_scope_id__$5F = "data-v-830a69c8";
  /* module identifier */
  const __vue_module_identifier__$5F = undefined;
  /* functional template */
  const __vue_is_functional_template__$5F = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5F = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5F, staticRenderFns: __vue_staticRenderFns__$5F },
    __vue_inject_styles__$5F,
    __vue_script__$5F,
    __vue_scope_id__$5F,
    __vue_is_functional_template__$5F,
    __vue_module_identifier__$5F,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$5F.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('resource-render', {
    prefix: options.prefix
  }), __vue_component__$5F);
};

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$5E = {
  name: 'PdfView',
  props: {
    show: {
      type: Boolean,
      default: false
    },
    baseUrl: {
      type: String,
      default: ''
    },
    textInfo: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'pc'
    },
    width: {
      type: String,
      default: '800px'
    },
    height: {
      type: String,
      default: '80vh'
    }
  },
  data() {
    return {
      src: encodeURI('http://ouchn-textbook-public.oss-cn-qingdao.aliyuncs.com/ouchn-test-paper-web/stem-files/faf5276a-e523-4df1-8d11-ac858c954cf3.pdf'),
      loading: false
    };
  },
  methods: {
    onBackClick() {
      this.$emit('handleClose', false);
    },
    open() {
      window.open(this.baseUrl);
    }
  }
};

var __$_require_static_images_leaflet_icons_back_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAABACAYAAAB2kAXpAAAAAXNSR0IArs4c6QAABABJREFUaEPVmluopmMUx39/UUy44cJMg+FikEMuGMnIOJcwlHIYpKkZmchxuJDT5MIpIzXIpMkhh5QwlPPx0uHKhbiYKCJXSMTor7U9W4/t29/3rP3t55usm137+z/v+r3Pca31vGIHme19gVXAEuBXYKukd6ZxtCO4bJ8HPAHsNsP/RknXxf8mDmZ7NfDYkA65UtKmiYLZvhp4YMQofSVpycTAbN8M3NkwdbZL2mUiYLbvBW5ogArJ15L27w5m+yHgikaokK2WtKUrmO2ngQsTUBsk3dZ1Vdp+EViZgFov6b5u+5jtnYE3gBMTUOskPVzr53UobS8A3gWWJaBWSYoh/5fNG5jtfYA4Ug5JQJ0j6aVB+nkBs70f8CEQf1tsO3CqpPdmE48NZvswIBzs1UJUDuwTJH00TD8WmO2jgbeBPRqhfgBOkvTZKP2cwWyvKFA7jXJSfv8GOF7Sthb9nMBsx/4U+1SrfQ6skPR9a4M0mO1LgcdbHQAxl2Ki/5hok4vHbK8DNiUcxPZxmqQ/E22mpM09Zvsm4K6EgwiVz07o8xus7TuAWxNOnpF0UUL/H+nIHrP9IHBVwslmSWsT+oHSoWC2twCXJZzcL+n6hH5W6axgtl8Azk04uV1SDPm82EAw26/Hakp4uFbSqCQj8bgZq7KELW8BxyaeslbS5oS+SfpPj9neE3gfOLKp5d+iCyQ9l9A3S6fASroeEcKBzS3hLEmvJPQpqWwvLWHLwsaWv5cj5oNG/ZxkAfZTImz5uRzGn87JW6JRgLlR/20kGJK+aNSPJWsF+wRYLum3sbwlGv/vweJdYyhPlhRBX3eLHvsDiCS1xX4pk//jFvE4mgA7puSDkay2WLxIBH+zpl4tDxmlmd5gDy9we49qUP2+UtLLCX1KWh9JB5SNtjVpDUd9j6TpVylpfhzihyZer+8hXsHtXgojRyXg+oY9FVys0jdjBSbg+geKFeBW4MwEXP/QuoJ7Fjg/Adc/GangHgEuT8D1T98quHuA9Qm4/glvBXcLsCEBFyWC0yVFoS5lIxPemU+zfQ2wMeElztVTuhZVqp5bAzyagOtfhqrgYqXGim21/oW7Cu4MIDKl1inRv9RZwR0HxPm6a2PXxW1u3+JwBRdJciTLkTS3WP9yegV3UInpFrWQFU3fC4gKbjEQiXDEdq3W98qmgouLiNhYj2glA/peclVw8XVA3MAtT8D1vRasQWy/FkdSAq7/RWrVe88D8Z1Fq10i6anWjbH1oQN1yVrul5KWTgQsaBPV78l93lANa3x3Ed9fDLPvJC2cWI9VcDcCdw8hm1qdEwcrwxphelzOz/T/pKS4RGuOCsaa/IMa2z4YuLicElHVfLWu6f4FuhpYUNovLf0AAAAASUVORK5CYII=";

/* script */
const __vue_script__$5E = script$5E;
var __vue_render__$5E = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    [
      _vm.pageType == "pc"
        ? _c(
            "el-dialog",
            {
              attrs: {
                title: _vm.textInfo,
                visible: _vm.show,
                width: _vm.width,
                top: "80px",
                "custom-class": "xml-epub-pdf-dialog",
                "modal-append-to-body": "",
                "before-close": _vm.onBackClick,
              },
              on: {
                "update:visible": function ($event) {
                  _vm.show = $event;
                },
              },
            },
            [
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "loading",
                      rawName: "v-loading",
                      value: _vm.loading,
                      expression: "loading",
                    },
                  ],
                  staticClass: "mod-config",
                  staticStyle: { position: "relative" },
                  style: {
                    height: _vm.height,
                    width: "100%",
                    padding: "0px 14px 20px 14px",
                  },
                  attrs: {
                    "element-loading-text": "拼命加载中",
                    "element-loading-spinner": "el-icon-loading",
                    "element-loading-background": "rgba(0, 0, 0, 0.8)",
                  },
                },
                [
                  _c(
                    "div",
                    {
                      staticStyle: {
                        position: "absolute",
                        top: "10px",
                        right: "10px",
                        cursor: "pointer",
                        "font-size": "16px",
                      },
                      on: { click: _vm.open },
                    },
                    [
                      _c("i", {
                        staticClass: "el-icon-full-screen",
                        attrs: { title: "全屏" },
                      }),
                    ]
                  ),
                ]
              ),
            ]
          )
        : _c(
            "div",
            {
              directives: [
                {
                  name: "show",
                  rawName: "v-show",
                  value: _vm.show,
                  expression: "show",
                },
              ],
              staticClass: "xml-epub-pdf-view",
            },
            [
              _vm.textInfo
                ? _c("div", { staticClass: "xmlPreviewSearch-title" }, [
                    _c("img", {
                      staticClass: "img",
                      attrs: {
                        src: __$_require_static_images_leaflet_icons_back_png__,
                      },
                      on: { click: _vm.onBackClick },
                    }),
                    _vm._v(" "),
                    _c("div", { staticClass: "xmlPreviewSearch-sou" }, [
                      _vm._v(_vm._s(_vm.textInfo)),
                    ]),
                  ])
                : _c("div", { staticClass: "xmlPreviewSearch-navbar" }, [
                    _c("i", {
                      staticClass: "el-icon-close",
                      on: { click: _vm.onBackClick },
                    }),
                  ]),
              _vm._v(" "),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "loading",
                      rawName: "v-loading",
                      value: _vm.loading,
                      expression: "loading",
                    },
                  ],
                  staticClass: "mod-config",
                  staticStyle: { height: "calc(100vh - 60px)", width: "100%" },
                  attrs: {
                    "element-loading-text": "拼命加载中",
                    "element-loading-spinner": "el-icon-loading",
                    "element-loading-background": "rgba(0, 0, 0, 0.8)",
                  },
                },
                [
                  _c("iframe", {
                    staticClass: "xml-iframe-web-view",
                    attrs: { frameborder: "0", src: _vm.baseUrl },
                  }),
                ]
              ),
            ]
          ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5E = [];
__vue_render__$5E._withStripped = true;

  /* style */
  const __vue_inject_styles__$5E = undefined;
  /* scoped */
  const __vue_scope_id__$5E = undefined;
  /* module identifier */
  const __vue_module_identifier__$5E = undefined;
  /* functional template */
  const __vue_is_functional_template__$5E = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5E = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5E, staticRenderFns: __vue_staticRenderFns__$5E },
    __vue_inject_styles__$5E,
    __vue_script__$5E,
    __vue_scope_id__$5E,
    __vue_is_functional_template__$5E,
    __vue_module_identifier__$5E,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5D = {
  name: 'XmlEbookRender',
  components: {
    PdfView: __vue_component__$5E
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'preview';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    bookReaderPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isReader: {
      // 是否阅读器
      type: Boolean,
      default: false
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        console.log('XmlEbook组件(ruleIndex:' + this.ruleIndex + ')，watch触发，变量pBlockData：', newValue);
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
          // this.ebookSetList=Object.assign({},this.blockData.ebookSetList);
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      image: image$1,
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      //属性组件名
      propertyComponentsName: 'xml-ebook-property',
      showPdf: false,
      baseUrl: '',
      textInfo: ''
      // ebookSetList:[]
    };
  },
  methods: {
    handleClose() {
      this.showPdf = false;
    },
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    goRead(info) {
      console.log('🚀 ~ goRead ~ info:', info);
      if (this.mode === 'preview' || this.mode == 'reader') {
        this.$EventBus.$emit('learningStatistics', {
          type: 'ebook',
          info: info,
          data: info
        });
        if (info.source != 'netlink') {
          const baseUrl = info.uploadFileUrl.indexOf('./') !== -1 ? this.resourceBasisPath + info.uploadFileUrl.split('./')[1] : info.uploadFileUrl;
          if (info.uploadFileUrl.indexOf('.epub') > 0) {
            this.baseUrl = this.bookReaderPath + '/static/epubjs/index.html#/epub-read?flow=scrolled&bookPath=' + baseUrl;
          } else {
            // const baseUrl = this.resourceBasisPath + info.uploadFileUrl.split('./')[1]
            this.baseUrl = this.bookReaderPath + `/static/pdfjs/web/viewer.html?file=${baseUrl}`;
          }
          if (this.isReader) {
            this.$emit('showFileReader', {
              fileFormat: info.fileFormat,
              fileUrl: this.baseUrl,
              title: info.name || info.title
            });
          } else if (info.uploadFileUrl) {
            this.showPdf = true;
            this.textInfo = info.name || info.title;
          }
        } else {
          if (info.link) {
            window.open(info.link, '_blank');
            // this.$emit('showPdfRead', { type: 'link', url: info.link, pageType: this.pageType })
          } else {
            this.$message.warning('获取资源链接失败，请检查链接地址');
          }
        }
      }
    },
    countFileSize(fileSize) {
      if (!fileSize) return;
      if (fileSize < 1024) {
        return fileSize + 'B';
      } else if (fileSize < 1024 * 1024) {
        var temp = fileSize / 1024;
        temp = temp.toFixed(2);
        return temp + 'KB';
      } else if (fileSize < 1024 * 1024 * 1024) {
        var temp = fileSize / (1024 * 1024);
        temp = temp.toFixed(2);
        return temp + 'MB';
      } else {
        var temp = fileSize / (1024 * 1024 * 1024);
        temp = temp.toFixed(2);
        return temp + 'GB';
      }
    },
    iframeHeight(e) {
      let height = 600;
      if (e) {
        let dom = document.querySelector('.xml-ebook-container');
        let width = dom.clientWidth - 60;
        height = width * Number(e);
      }
      return height;
    },
    getEbookSrc(item) {
      let src = '';
      let uploadFileUrl = item.uploadFileUrl.indexOf('./') !== -1 ? this.resourceBasisPath + item.uploadFileUrl.split('./')[1] : item.uploadFileUrl;
      if (item.uploadFileUrl.indexOf('.epub') !== -1) {
        src = this.bookReaderPath + '/static/epubjs/index.html#/epub-read?flow=scrolled&bookPath=' + uploadFileUrl;
      } else if (item.uploadFileUrl.indexOf('.pdf') !== -1) {
        src = this.bookReaderPath + '/static/pdfjs/web/viewer.html?file=' + uploadFileUrl;
      } else {
        src = item.uploadFileUrl;
      }
      return src;
    }
  },
  created() {
    // this.blockData = Object.assign( this.blockData,this.pBlockData)
  }
};

var __$_require_static_images_default_over_ebook_png__ = "2539d578aeabf7c9.png";

/* script */
const __vue_script__$5D = script$5D;
var __vue_render__$5D = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      class: ["xml-ebook-container", "xml-ebook-container-" + _vm.pageType],
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _vm.blockData.styleMode === "A"
        ? _c(
            "div",
            { staticClass: "resource-box xml-group-item", class: _vm.mode },
            _vm._l(_vm.blockData.ebookSetList, function (item, index) {
              return _c(
                "div",
                {
                  key: index + Math.random(),
                  staticClass: "workbench-shop-item",
                  on: {
                    click: function ($event) {
                      return _vm.goRead(item)
                    },
                  },
                },
                [
                  _c("img", {
                    staticClass: "shop-item-img-resource-first xml-round-6",
                    attrs: {
                      src:
                        item.coverFileUrl &&
                        item.coverFileUrl.indexOf(
                          "http://124.133.23.84:20000"
                        ) === -1
                          ? item.coverFileUrl.indexOf("./") !== -1
                            ? _vm.resourceBasisPath +
                              item.coverFileUrl.split("./")[1]
                            : item.coverFileUrl
                          : __$_require_static_images_default_over_ebook_png__,
                    },
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "shop-item-desc" }, [
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: item.name,
                            expression: "item.name",
                          },
                        ],
                        staticClass: "xml-ebook-title shop-item-desc-title",
                      },
                      [_vm._v(_vm._s(item.name))]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: item.author,
                            expression: "item.author",
                          },
                        ],
                        staticClass: "shop-item-desc-detail",
                      },
                      [_vm._v("作者：" + _vm._s(item.author))]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: item.publisher,
                            expression: "item.publisher",
                          },
                        ],
                        staticClass: "shop-item-desc-detail",
                      },
                      [_vm._v("出版社：" + _vm._s(item.publisher))]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: item.isbn,
                            expression: "item.isbn",
                          },
                        ],
                        staticClass: "shop-item-desc-detail",
                      },
                      [_vm._v("ISBN:" + _vm._s(item.isbn))]
                    ),
                  ]),
                ]
              )
            }),
            0
          )
        : _vm._e(),
      _vm._v(" "),
      _vm.blockData.styleMode === "B"
        ? _c(
            "div",
            { staticClass: "resource-box xml-group-item", class: _vm.mode },
            _vm._l(_vm.blockData.ebookSetList, function (item, index) {
              return _c(
                "div",
                {
                  key: index + Math.random(),
                  staticClass: "workbench-shop-item styleB",
                },
                [
                  _c("iframe", {
                    attrs: {
                      width: "100%",
                      height: _vm.iframeHeight(item.proportion),
                      src: _vm.getEbookSrc(item),
                      frameborder: "0",
                    },
                  }),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "xml-ebook-title title xml-text-center" },
                    [_vm._v(_vm._s(item.name))]
                  ),
                ]
              )
            }),
            0
          )
        : _vm._e(),
      _vm._v(" "),
      _vm.blockData.styleMode === "C"
        ? _c(
            "div",
            {
              staticClass: "resource-box resource-box-sytleC xml-group-item",
              class: _vm.mode,
            },
            _vm._l(_vm.blockData.ebookSetList, function (item, index) {
              return _c(
                "div",
                {
                  key: index + Math.random(),
                  staticClass: "workbench-shop-item",
                  on: {
                    click: function ($event) {
                      return _vm.goRead(item)
                    },
                  },
                },
                [
                  _c("img", {
                    staticClass: "shop-item-img-resource xml-round-6",
                    attrs: {
                      src:
                        item.coverFileUrl &&
                        item.coverFileUrl.indexOf(
                          "http://124.133.23.84:20000"
                        ) === -1
                          ? item.coverFileUrl.indexOf("./") !== -1
                            ? _vm.resourceBasisPath +
                              item.coverFileUrl.split("./")[1]
                            : item.coverFileUrl
                          : __$_require_static_images_default_over_ebook_png__,
                    },
                  }),
                  _vm._v(" "),
                  _c("span", { staticClass: "xml-ebook-title" }, [
                    _vm._v(_vm._s(item.name)),
                  ]),
                ]
              )
            }),
            0
          )
        : _vm._e(),
      _vm._v(" "),
      _vm.blockData.styleMode === "D"
        ? _c(
            "div",
            {
              staticClass: "resource-box resource-box-sytleD xml-group-item",
              class: _vm.mode,
            },
            _vm._l(_vm.blockData.ebookSetList, function (item, index) {
              return _c(
                "div",
                {
                  key: index + Math.random(),
                  staticClass: "ebook_style_4 workbench-shop-item",
                  on: {
                    click: function ($event) {
                      return _vm.goRead(item)
                    },
                  },
                },
                [
                  _c("div", { staticClass: "left" }, [
                    _c("img", {
                      attrs: {
                        src:
                          item.coverFileUrl &&
                          item.coverFileUrl.indexOf(
                            "http://124.133.23.84:20000"
                          ) === -1
                            ? item.coverFileUrl.indexOf("./") !== -1
                              ? _vm.resourceBasisPath +
                                item.coverFileUrl.split("./")[1]
                              : item.coverFileUrl
                            : __$_require_static_images_default_over_ebook_png__,
                      },
                    }),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "right" },
                    [
                      _c(
                        "el-tooltip",
                        {
                          staticClass: "item",
                          attrs: { effect: "dark", placement: "top-start" },
                        },
                        [
                          _c(
                            "div",
                            {
                              staticClass: "title-popper",
                              attrs: { slot: "content" },
                              slot: "content",
                            },
                            [_vm._v(_vm._s(item.name))]
                          ),
                          _vm._v(" "),
                          _c(
                            "div",
                            { staticClass: "xml-ebook-title title-box" },
                            [_vm._v(_vm._s(item.name))]
                          ),
                        ]
                      ),
                      _vm._v(" "),
                      _c("div", { staticClass: "book_info" }, [
                        _vm._v(
                          "\n          文件大小：" +
                            _vm._s(
                              _vm.countFileSize(item.fileSize)
                                ? _vm.countFileSize(item.fileSize)
                                : "无"
                            ) +
                            "\n        "
                        ),
                      ]),
                    ],
                    1
                  ),
                ]
              )
            }),
            0
          )
        : _vm._e(),
      _vm._v(" "),
      _c("PdfView", {
        attrs: {
          show: _vm.showPdf,
          baseUrl: _vm.baseUrl,
          textInfo: _vm.textInfo,
          pageType: "h5",
        },
        on: { handleClose: _vm.handleClose },
      }),
    ],
    1
  )
};
var __vue_staticRenderFns__$5D = [];
__vue_render__$5D._withStripped = true;

  /* style */
  const __vue_inject_styles__$5D = undefined;
  /* scoped */
  const __vue_scope_id__$5D = "data-v-153d7766";
  /* module identifier */
  const __vue_module_identifier__$5D = undefined;
  /* functional template */
  const __vue_is_functional_template__$5D = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5D = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5D, staticRenderFns: __vue_staticRenderFns__$5D },
    __vue_inject_styles__$5D,
    __vue_script__$5D,
    __vue_scope_id__$5D,
    __vue_is_functional_template__$5D,
    __vue_module_identifier__$5D,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$5D.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('ebook-render', {
    prefix: options.prefix
  }), __vue_component__$5D);
};

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

// import { Player, Video, Ui, ClickToPlay, Skeleton, Controls, ScrubberControl } from '@vime/vue'
var script$5C = {
  name: 'VmPlayer',
  // components: { Player, Video, Ui, ClickToPlay, Skeleton, Controls, ScrubberControl },
  props: {
    src: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      currentTime: 0
    };
  },
  computed: {
    player() {
      return this.$refs.player;
    }
  },
  mounted() {},
  watch: {},
  methods: {
    // Example function to showcase updating property.
    seekForward() {
      this.currentTime = this.currentTime + 5;
    },
    // Example function to showcase calling player method.
    enterFullscreen() {
      this.player.enterFulllscreen();
    },
    onTimeUpdate(time) {
      this.currentTime = time;
    },
    onFullscreenChange(active) {
    },
    onPlaybackReady() {
      // ...
    }
  }
};

/* script */
const __vue_script__$5C = script$5C;

/* template */
var __vue_render__$5C = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "Player",
    {
      ref: "player",
      attrs: {
        controls: "",
        autoplay: "",
        muted: "",
        playsinline: "",
        currentTime: _vm.currentTime,
      },
      on: {
        vPlaybackReady: _vm.onPlaybackReady,
        vmCurrentTimeChange: _vm.onTimeUpdate,
        vmFullscreenChange: _vm.onFullscreenChange,
      },
    },
    [
      _c("Video", [
        _c("source", { attrs: { "data-src": _vm.src, type: "video/mp4" } }),
      ]),
      _vm._v(" "),
      _c(
        "Ui",
        [
          _c("ClickToPlay"),
          _vm._v(" "),
          _c("Skeleton"),
          _vm._v(" "),
          _c(
            "Controls",
            { attrs: { fullWidth: "", activeDuration: 3200 } },
            [_c("ScrubberControl")],
            1
          ),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5C = [];
__vue_render__$5C._withStripped = true;

  /* style */
  const __vue_inject_styles__$5C = undefined;
  /* scoped */
  const __vue_scope_id__$5C = undefined;
  /* module identifier */
  const __vue_module_identifier__$5C = undefined;
  /* functional template */
  const __vue_is_functional_template__$5C = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5C = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5C, staticRenderFns: __vue_staticRenderFns__$5C },
    __vue_inject_styles__$5C,
    __vue_script__$5C,
    __vue_scope_id__$5C,
    __vue_is_functional_template__$5C,
    __vue_module_identifier__$5C,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5B = {
  name: 'VideoPlayer',
  components: {
    VmPlayer: __vue_component__$5C,
    videoPlayer: VueVideoPlayer.videoPlayer
  },
  props: {
    src: {
      type: String,
      default: ''
    },
    // 这里接收父组件传来的src参数，视频的url
    loop: {
      type: Boolean,
      default: false
    },
    //控制循环还是单次播放
    canSkip: {
      type: Boolean,
      default: true
    },
    //是否允许控制播放进度
    playStyle: {
      type: String,
      default: 'yuan-wen'
    },
    //yuan-wen:原文播放；tan-chaung：弹窗播放；tiao-zhuan：跳转播放
    title: {
      type: String,
      default: ''
    },
    //视频标题
    link: {
      type: String,
      default: ''
    },
    //链接地址
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    aspectRatio: '16:9',
    poster: {
      type: String,
      default: ''
    },
    titlePosition: {
      type: String,
      default: ''
    },
    titleAlign: {
      type: String,
      default: ''
    },
    playerIndex: {
      type: Number,
      default: -1
    },
    content: {
      type: String,
      default: '暂无简介'
    },
    isEmptyPlaceholder: {
      type: Boolean,
      default: false
    },
    initialTime: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      // 用于存放<video>标签对象，方便调用原生API
      videoRef: null,
      videoContainer: null,
      // 是否暂停，用于控制播放与暂停
      isPaused: true,
      // 播放当前时间
      currentTime: '00:00',
      totalTime: '00:00',
      // 声音是否静音
      isMuted: false,
      scrollDuration: 0,
      isShow: true,
      // 是否全屏
      isFullScreen: false,
      controlsActive: false,
      isVideoEnd: false,
      stopDefaultEvent: false,
      lastOperateTimeStamp: '',
      timeData: null,
      isAmin: false,
      playerOptions: {
        playbackRates: [0.5, 1.0, 1.25, 1.5, 2.0],
        //播放速度
        autoplay: false,
        //如果true,浏览器准备好时开始回放。
        muted: false,
        // 默认情况下将会消除任何音频。
        loop: false,
        // 导致视频一结束就重新开始。
        preload: 'auto',
        // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频（如果浏览器支持）
        language: 'zh-CN',
        aspectRatio: this.aspectRatio,
        // 将播放器置于流畅模式，并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字（例如"16:9"或"4:3"）
        fluid: true,
        // 当true时，Video.js player将拥有流体大小。换句话说，它将按比例缩放以适应其容器。
        sources: [{
          type: '',
          //这里的种类支持很多种：基本视频格式、直播、流媒体等，具体可以参看git网址项目
          src: this.src
        }],
        poster: this.poster,
        //你的封面地址
        // width: document.documentElement.clientWidth, //播放器宽度
        notSupportedMessage: '获取视频失败，请检查链接地址',
        //允许覆盖Video.js无法播放媒体源时显示的默认信息。
        controlBar: {
          timeDivider: false,
          durationDisplay: true,
          remainingTimeDisplay: false,
          fullscreenToggle: true,
          //全屏按钮
          progressControl: true,
          volumePanel: {
            inline: false
          }
        }
      },
      playerEvents: ['fullscreenchange', 'timeupdate', 'seeked', 'seeking']
    };
  },
  computed: {
    durationVar() {
      return {
        '--scroll-duration': this.scrollDuration + 's',
        'text-align': this.titleAlign
      };
    },
    videoAndMusicStop() {
      let playState = sessionStorage.getItem('SET_PLAY_STATE');
      return playState;
    },
    isAsyncConvert() {
      return this.src.split('__')[0] === 'convertTask';
    },
    computedAlign() {
      let style = {};
      switch (this.titleAlign) {
        case 'left':
          style = {
            justifyContent: 'flex-start'
          };
          break;
        case 'center':
          style = {
            justifyContent: 'center'
          };
          break;
        case 'right':
          style = {
            justifyContent: 'flex-end'
          };
          break;
      }
      return style;
    }
  },
  mounted() {
    this.timeData = 'v' + Math.random();
    // 加载完毕后，先获取<video>标签DOM对象
    this.videoRef = this.$refs.videoRef;
    this.videoContainer = this.$refs.videoContainer;
    this.checkTitleScroll();
    if (this.mode != 'editor' && this.playStyle === 'yuan-wen') {
      this.$emit('resetTimeUpdate');
    }
  },
  watch: {
    title: {
      handler(n, o) {
        this.checkTitleScroll();
      }
    },
    titlePosition: {
      handler(n, o) {
        this.checkTitleScroll();
      }
    },
    poster: {
      handler(n, o) {
        !this.isAsyncConvert && this.$nextTick(function () {
          this.playerOptions.poster = n;
        });
      }
    },
    canSkip: {
      handler(n, o) {
        !this.isAsyncConvert && this.$nextTick(function () {
          // this.$refs.videoRef.src = n
          //alert(n);
          // this.playerOptions.controlBar.progressControl = n
        });
      },
      immediate: true
    },
    loop: {
      handler(n, o) {
        !this.isAsyncConvert && this.$nextTick(function () {
          // this.$refs.videoRef.src = n
          //alert(n);
          this.playerOptions.loop = n;
        });
      },
      immediate: true
    },
    src: {
      handler(n, o) {
        if (n == '') {
          this.isShow = false;
        } else {
          this.isShow = true;
        }
        !this.isAsyncConvert && this.$nextTick(function () {
          // this.$refs.videoRef.src = n
          this.playerOptions.sources[0].src = n;
        });
      },
      immediate: true
    },
    videoAndMusicStop(val) {
      let currentPlayStamp = val || '--';
      if (currentPlayStamp !== this.src + '__playTimeStamp__' + this.lastOperateTimeStamp) {
        this.videoRef.stopPlay();
        this.handlePause();
      }
    }
  },
  methods: {
    checkTitleScroll() {
      this.$nextTick(() => {
        if (this.$refs.previewTitleText) {
          let titleWidth = this.$refs.previewTitleText.offsetWidth;
          let parentWidth = this.$refs.parentTitle.offsetWidth;
          if (titleWidth >= parentWidth + 1) {
            this.isAmin = true;
            // this.$refs.previewTitleText.classList.value = 'animate-title'
            this.scrollDuration = titleWidth / 60 + 1;
          } else {
            this.isAmin = false;
          }
        }
      });
    },
    playsinLine() {
      let ua = navigator.userAgent.toLocaleLowerCase();
      //
      if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
        return false;
      } else {
        return true;
      }
    },
    toggleFullscreen(item, e) {
      // this.isFullScreen = !this.isFullScreen
      let videoParent = document.getElementById(item);
      videoParent.getElementsByTagName('video')[0].id;
      let bar = videoParent.querySelector('.vjs-control-bar');
      if (e.isFullscreen() == true) bar.className = 'vjs-control-bar fullscren';else {
        // alert(1);
        bar.className = 'vjs-control-bar';
      }
      this.videoPlayerDom = videoParent.getElementsByTagName('video')[0];

      //  if (this.wrapRoot && this.wrapRoot.currentInKey === this.inKey) {
      const data = {
        type: 'setIframeClass',
        value: e.isFullscreen()
      };
      window.parent.postMessage(data);
      //  }
      //this.isFullScreen = !this.isFullScreen;
      if (/AppleWebKit.*mobile/i.test(navigator.userAgent) || /MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent)) {
        if (window.location.href.indexOf('?mobile') < 0) {
          try {
            if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
              //   alert(1);

              this.videoPlayer.attr('x-webkit-airplay', 'true') //设置允许设备播放
              .attr('x5-playsinline', 'true') // 设置android在微信中内联播放视频
              .attr('x5-video-player-type', 'web') // 关闭同层X5内核播放器    x5-video-player-type='h5' 启用Ｈ5同层播放器
              // .attr('x5-video-player-fullscreen','true')  // 进入全屏通知
              .attr('x5-video-orientation', 'portrait'); //控制横竖屏 可选值： landscape 横屏, portraint竖屏  默

              return;
            } else if (/iPad/i.test(navigator.userAgent)) {
              //window.location.href="平板页面";
            } else {
              //window.location.href="其他移动端页面"
            }
          } catch (e) {}
        }
      }
      //this.videoPlayer.controls = false;
      //this.playerOptions.controls = true;
      //   bar.className = "vjs-control-bar";
    },
    onPlayerPlay(e) {
      let currentVideo = e.el_.children[0].getAttribute('id', 64);
      let videoList = document.getElementsByTagName('video');
      for (let i = 0; i < videoList.length; i++) {
        let id = videoList[i].getAttribute('id');
        if (currentVideo != id) {
          this.videoPlayerDom = videoList[i];
        }
      }

      //let audio = document.querySelectorAll('audio')
      //if (audio && audio.length) audio.forEach((i) => i.pause())
    },
    handlePlay(item, e) {
      // if (this.stopDefaultEvent) return
      // if (this.mode==='editor') {
      //   this.videoRef.pause()
      //   this.$message.warning('视频仅支持在预览模式下播放')
      //   return
      // }
      this.videoId = item;
      let videoParent = document.getElementById(item);
      let id = videoParent.getElementsByTagName('video')[0].id;
      this.videoPlayerDom = videoParent.getElementsByTagName('video')[0];
      item = id;
      this.isPaused = false;
      let audio = document.querySelectorAll('audio');
      if (audio && audio.length) {
        audio.forEach(i => i.pause());
      }
      let video = document.querySelectorAll('video');
      video.forEach(i => {
        if (i.id != item) {
          i.pause();
        }
      });
      this.setPlayStamp();
      if (this.playStyle === 'tiao-zhuan') {
        setTimeout(() => {
          videoParent.getElementsByTagName('video')[0].pause();
        }, 150);
        if (this.link) {
          window.location.href = this.link;
        } else {
          this.$message.warning('获取资源链接失败，请检查链接地址');
        }

        // window.open(this.src,"_blank")
      }
      if (this.playStyle === 'tan-chuang') {
        setTimeout(() => {
          videoParent.getElementsByTagName('video')[0].pause();
          videoParent.getElementsByTagName('video')[0].currentTime = 0;
          this.$refs.videoRef.player.src('');
        }, 300);
        this.$emit('showDialog', {
          url: this.src,
          title: this.title,
          content: this.content,
          poster: this.poster,
          playerIndex: this.playerIndex,
          initialTime: this.initialTime
        });
        setTimeout(() => {
          // videojs(videoParent.getElementsByTagName('video')[0]).trigger('loadstart')
          // this.$refs.videoRef.player.reset()
          this.$refs.videoRef.player.load();
          this.$refs.videoRef.player.src(this.src);
        }, 500);
      }
    },
    handlePause() {
      if (this.stopDefaultEvent) return;
      this.isPaused = true;
    },
    // 播放与暂停,注意,这里isPause的变化,对应图标的变化
    togglePlay(event) {
      if (this.mode === 'editor') ;
    },
    doPlay() {
      this.isPaused = !this.isPaused;
      this.stopDefaultEvent = true;
      if (this.isPaused) ; else {
        let audio = document.querySelectorAll('audio');
        if (audio && audio.length) {
          audio.forEach(i => i.pause());
        }
        let video = document.querySelectorAll('video');
        video.forEach(i => {
          if (i.id != this.timeData) {
            i.pause();
          }
        });
        // this.videoRef.play()
        this.setPlayStamp();
      }
      setTimeout(() => {
        this.stopDefaultEvent = false;
      }, 500);
    },
    setPlayStamp() {
      let timeStamp = new Date().getTime();
      this.lastOperateTimeStamp = timeStamp;
      let playStamp = `${this.src}__playTimeStamp__${timeStamp}`;
      // this.$store.commit('leaflet/SET_PLAY_STATE', this.src)
      // this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      sessionStorage.setItem('SET_PLAY_STATE', playStamp); //存储
    },
    rePlay() {
      // this.videoRef.play()
      this.isPaused = false;
      this.isVideoEnd = false;
    },
    // 停止播放
    stopPlay() {
      //this.videoRef.pause()
      this.videoRef.currentTime = 0;
      // 停止播放了，要将播放图标从暂停切换到播放,isPaused为true的时候，图标是播放
      this.isPaused = true;
    },
    playEnd() {
      if (!this.loop) {
        this.videoRef.currentTime = 0;
        this.isPaused = true;
        this.isVideoEnd = true;
      }
    },
    // 定义一个时间处理函数，例如将100秒，处理成1:40
    timeFormat(time) {
      let minute = Math.floor(time % 3600 / 60); // 取余
      let second = Math.floor(time % 60);
      minute = minute < 10 ? '0' + minute : minute;
      second = second < 10 ? '0' + second : second;
      return `${minute}:${second}`;
    },
    // 当事件oncanplay触发时，获取视频的总时间信息，然后通过timeFormat函数处理成00:00的格式，并渲染到template中
    getTotalTime() {
      this.currentTime = this.timeFormat(this.videoRef.currentTime);
      this.totalTime = this.timeFormat(this.videoRef.duration);
    },
    // 时间timeupdate触发时，更新当前播放时间
    timeUpdate(e) {
      // this.currentTime = this.timeFormat(this.videoRef.currentTime)
      // this.$emit('timeUpdate', { event: e, time: this.videoRef.currentTime })
      if (e.currentTime() >= this.initialTime) {
        this.currentTime = this.timeFormat(e.currentTime());
        this.$emit('timeUpdate', {
          event: e,
          time: e.currentTime()
        });
      } else {
        e.currentTime(this.initialTime);
      }
    },
    handleError(player) {
      if (player.error()?.message.includes('The media could not be loaded')) {
        player.error('服务器或网络错误, 视频资源无法加载');
        player.errorDisplay.contentEl_.innerText = '服务器或网络错误, 视频资源无法加载';
      }
    },
    playerReadied(player) {
      if (this.initialTime > 0) {
        player.currentTime(this.initialTime);
      }
    },
    // 声音是否静音
    toggleMuted() {
      this.isMuted = !this.isMuted;
      this.videoRef.muted = !this.videoRef.muted;
    },
    // 切换全屏,注意，这里进入全屏时，使用的元素是this.video，而不是this.myvideo。video是myvideo的父标签，这样控制条才能正确显示
    toggleFullScreen(event) {
      let fullscreen = document.webkitIsFullScreen || document.fullscreen;
      this.isFullScreen = fullscreen;
      if (!this.isFullScreen) {
        this.isFullScreen = !this.isFullScreen;
        const inFun = this.videoContainer.requestFullscreen || this.videoContainer.webkitRequestFullScreen;
        inFun.call(this.videoContainer);
      } else {
        this.isFullScreen = !this.isFullScreen;
        const exitFun = document.exitFullscreen || this.document.webkitExitFullScreen;
        exitFun.call(document);
      }
    },
    // 正在拖动
    videoSeeking() {
      this.isPaused = false;
    },
    // 拖动结束
    videoSeeked() {
      this.isPaused = false;
    }
  }
};

/* script */
const __vue_script__$5B = script$5B;

/* template */
var __vue_render__$5B = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      ref: "videoContainer",
      staticClass: "xml-video-player xml-video-player-16-9",
      on: { click: _vm.togglePlay },
    },
    [
      _vm.isAsyncConvert
        ? [_vm._m(0)]
        : [
            _c("video-player", {
              ref: "videoRef",
              class: [
                "video-player",
                "vjs-custom-skin",
                _vm.canSkip ? "" : "vjs-no-select",
                _vm.title && _vm.titlePosition === "bottom"
                  ? "with-bottom-title"
                  : "",
                _vm.mode === "editor"
                  ? "is-edit-mode"
                  : _vm.mode === "demo"
                  ? "is-demo-mode"
                  : "",
                _vm.isEmptyPlaceholder ? ".vjs-empty-placeholder" : "",
              ],
              style: { width: "100%", height: "100%", overflow: "hide" },
              attrs: {
                id: _vm.timeData,
                events: _vm.playerEvents,
                playsinline: true,
                options: _vm.playerOptions,
                "x5-video-orientation": "portraint",
              },
              on: {
                "!click": function ($event) {
                  return _vm.togglePlay($event)
                },
                play: function ($event) {
                  return _vm.handlePlay(_vm.timeData, $event)
                },
                error: _vm.handleError,
                ready: _vm.playerReadied,
                "!fullscreenchange": function ($event) {
                  return _vm.toggleFullscreen(_vm.timeData, $event)
                },
                timeupdate: _vm.timeUpdate,
                seeking: _vm.videoSeeking,
                seeked: _vm.videoSeeked,
              },
            }),
          ],
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: _vm.title && _vm.titlePosition === "bottom",
              expression: "title && titlePosition === 'bottom'",
            },
          ],
          staticClass: "video-title",
          style: _vm.computedAlign,
        },
        [
          _c(
            "div",
            {
              ref: "parentTitle",
              staticStyle: { width: "100%" },
              style: _vm.durationVar,
            },
            [
              _c(
                "div",
                {
                  ref: "previewTitleText",
                  class: _vm.isAmin ? "animate-title" : "",
                },
                [_c("div", { domProps: { innerHTML: _vm._s(_vm.title) } })]
              ),
            ]
          ),
        ]
      ),
      _vm._v(" "),
      _c("div", {
        directives: [
          {
            name: "show",
            rawName: "v-show",
            value: _vm.mode == "editor",
            expression: "mode == 'editor'",
          },
        ],
        staticClass: "dialog-box",
      }),
    ],
    2
  )
};
var __vue_staticRenderFns__$5B = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "convert-placeholder" }, [
      _c("div", { staticClass: "convert-placeholder__text" }, [
        _vm._v("视频转码中，无法即时预览，请稍候在活页/教材预览中查看"),
      ]),
    ])
  },
];
__vue_render__$5B._withStripped = true;

  /* style */
  const __vue_inject_styles__$5B = undefined;
  /* scoped */
  const __vue_scope_id__$5B = undefined;
  /* module identifier */
  const __vue_module_identifier__$5B = undefined;
  /* functional template */
  const __vue_is_functional_template__$5B = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5B = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5B, staticRenderFns: __vue_staticRenderFns__$5B },
    __vue_inject_styles__$5B,
    __vue_script__$5B,
    __vue_scope_id__$5B,
    __vue_is_functional_template__$5B,
    __vue_module_identifier__$5B,
    false,
    undefined,
    undefined,
    undefined
  );

var playIcon$2 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAByCAMAAAC4A3VPAAAAAXNSR0IArs4c6QAAAZtQTFRFAAAA////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////LHKW/AAAAIl0Uk5TAAECAwQFBgcICQoLDQ4PEBESExQVFhcYGRwdHh8gISIjJCUmJygpKistLi8wMTIzNDU2Nzg6Ozw9Pj9AQUJFRkdJS0xOUFFSVFVYWV9gYWJjZWZnaWprbG1ub3BydHZ3eHl7fH1+gIGCg4SFhoeIiouMjo+QkpOUlZaYmZqbnJ2en6ChoqOkpabH29nvAAADgElEQVRo3u2a+0MSQRDHB4/CEiFLwtJMkx6+DSuTqAw1Lcm0q4jKB6VSQRi+34Qc3fzZ/eAdcnDAcne7/nLfH29n9nO3LLOzOwtgypQpU6bOTJa+aHL6Kpmt1R9PvrTrRj5HRNwj6odbRERcsehF7iMiotBa2dK2ISIiigM6iTY8UcpbydKZkExf6P3KpNTR8aPydu6YZCg06UXeS0ldZQfLmTVsS2bilP4pew3lzoZLGznSaNSwAgC4cx8wXsqk40AeCr/FkL+m+4/8Ca/VDbqOpPb0U6PCgXNdZn7gVJrvZGTiQ+NC0EV54MRI8cD1ZuUX8hgZ9mwrcreL1oKmZ6LUcthmbKg9Nyczl22KhjGZuHlDcxh3NHsDwbdFmpWRuJv/+EvucaTYJxjwNjsqTuHWWEZEI5X51VIWeGkpi4Yru+QsTXycQSpKPShFDCA1+dSJXqSom6prwV+ayJTK72lLIFVFikOlHylrsESOQ1Ex1USOqsSuAuQ36kj8XIA8oo9cUxLb6RMxo0ROMECicnWbI3FZ7Xb3f/2nHflEgVwhcXEBAPQmNSOVyVqUxEWKH8+0LnAfq0fKxvVvtCE/aUcCtEVE1kgA3zpzJEBQEFkjwbXMHAkwkGCOBOvkAWskgGU+yxoJltY11kgAzr/DGglw4V2aNRLAvimyRkJNzz5rJIB9UmCNBHCEBdZIgPY9kTUS7GnmyLIpOCVkP3Mkt8EcGWI9fTp/MP6TuPgs21BgC7AOeH3bIltk86LIdvFyTgnIdL209pOeiRmF7NglzqCNQTbMC4gskfWvqtr36UdyPdXkzUYgm7YYb4Pq3ld/dqsLaRs5ZLultXg2Ddi4E52ISLUALq7xICakQC6QuNgBAGqDadSoaQVylsRljINa35b2o6ZRZRWJyGd7DvVIWRJzMzjCyxbUhfaYH47CPH1kuADpo3/QfbdwVdihjVwqWoiGaSN7ipDn43SJIZU6pjNFk7iverHlPkWicJl1MfHwVqmEdJhSyTR2vXTW3RinUBg+DlnL7mY8G0YTo1cq7RFrXLd9k7M8z/N5+VuCJ1I4P7zxPD8zPuRpqOaGQejUf4TMg8vLo+u0XGpoy+UbGdJXPV0cYtouUvyU/WdIPbpyU0br/ZfvJ/5TVmKX7pMZf9Si+f7LUPh3NNhZU821q4nI6sJoo3ll0pQpU6bORv8BFtxQhtIU9fkAAAAASUVORK5CYII=";

var titleLeftIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAuCAYAAABjwOorAAAAAXNSR0IArs4c6QAABQ1JREFUaEPtWGtsk1UYft7TbmtBmOCFAHJryy0aYyJB4w8CatQfGo0LxsREQ2IwUYOoWceQyweBQiFozJQfmKi/xAsEjDEKiZj4A/+oIUGNhrZOLgqKMOSySdv3Medr6751q2xdRwfpyf4s5z19n+c87+18gqt0yVXKCzViV5qyNcVqig2TG6iF4jARot8wylbsJodjAw2YQsCU8pYF/moP4wgek2y/EVXIsGxioY2cbATrhBhfGot+pzRvJVslUSG8/f6ZsonhQ/oi7VglyuWUEo2eOEbq+uRY3zt4RtL9RlUBw/KJAZjxKidqmu8BuKNPLIQC3KXGOKmoHPLahONcIIq5vc4Z/JboxHY4khkMv0ERs46nxLmgTvkugLF9AhEcp8i65AVsxxq5WLAJbeJ0n3IvBZN6nCPOwCcPJprl66oSw0L6QrejWcCoBSI2LIn8H2yMksJPFen1v7QEfvaCDcUzi3xq2uiadS8K9iSXSRMgLJfcoBWzjm0hAfiGIe6U/C/S0mOOJAQnCVmbPIZdaJN//gPr0ESCiJFcbC+E9oRlKaAaWZyKys6qEoNDE27AfDF8XYgxxWBy1849MCaWiErSuz9l/fnxdSa4HYKZlpBrSSuVfJ/twsJ2RzrKIVcRxazjG1bzmsYReFrIJVoUWi4wwVmBrEUQnySWeFSzisc5xyg/gKe6ElDxycuJZvm4qsQASmgTIiarqygy1xta3RnELwkTSy2Tw8Vgbb4JzFIh/J6945kGaWp/ceCqVUwxF8xi1oXCmCfgagHGuDlWyLUc2k5A1tZ3Ys+PngppN8Zt5shRqm1QuTWvsE02Evp+ssW3ZaCqVZYYgKmv8Vp/Gk9AuUi8Iel6sqmDby+m4fz6ivxeDDa8jpNMPd+EojFPzhaTU5qRF5Ir5MhAyFWcmA3JSAyzYfC8CG/zgnELH5khJJZIYR+29Z5GbOM24FIq6gvkhLr7UKt/W5WJAXDoj4zI3A34nhXkb9+DSsmf0mqWH26V073AOvSHA7rUwHinkqwSKwcycw6BYjmoNiTrLuJxAR92G7ANwsKy/2Vky6ED2IePek/+EYejEdAWMZiALAQ+EGp+4Ai0FVfUUioOGTGXXIyz/KJPQmR2D2K5dDvaIab1ZIuc7QvczM2cllU8B2rANnsBMirpralooMfMWRViucaduU+MvwnE6GIQKtiWapEv+gTn0ITqsw8Yn8wr7BPmaLITW+GIXirfhlQx63zyBo4JAE00ehcBv533C09TEXMifQEr2x3pKkVuehBPKTChcIppfJZaId9UnZgFMCPGWerHI0Kdln9xdw+3YnYkorK3FNCJMV4XMHhUBCOtDYHT5wx2nGiW8/9HbsgVc507NNODuIfAAqiOoi0G+WUUZzo6TfzPNXKuFNBpcc6s09zzJmNAMTiYbJY/qk8s9wJoNMBDgN5M02NsAmk+L5lrl4q5EvuXR7G88/AGRkRwP0XH5apk/jsQ0ZEG3u6zr10JxNypZBPmkZgDIFBoASJut9qfiOKrwTwuvXdwWRWzjq+Pc1Sj4l4BptK2XrengaI43dWA3UdfklNlitTj2GUnZr3bYVfqMJ+ecYuKjBAHk8uxvxKqVYWY+3bbiFuQxY1+kxu17CcpfxZ/+9M4UPykKUfBKhEDsJr1oSCC2tU9Q/oBTQAXBvvpLRfdV+mqEbvShK0pVlNsmNxALRSHiRD9hlFTrN9XNUwM/wU+QeA+cB9fBQAAAABJRU5ErkJggg==";

var titleRightIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAAuCAYAAABjwOorAAAAAXNSR0IArs4c6QAABSNJREFUaEPtWEtslFUU/r77Tx9TmphqEHkUCp0GA0YN6soQE1e6kBijBInESAwFFFQS+kQZCNBSRCS6UeMGN6aAQlxQEhIIMS58kZCoCDMtYEuqAgWF0k7/uZ/5pw9m+rAz06EFMrO8c8893+Pcc88McZd+eJfyQpbYneZs1rGsY7eJAtlSvE2MSBrGxDj2iXLKLmI+cjBjJKTWItrt4mTrBrYlzSZu44QQm12vR3ywb0NmwUig5aBFxIrwev51RxArCSrfl29XA6wEce8IoCXDN8LX8TmCtBNETCzejql+i/zBADrzcKV1HS/HrwcatEBWmwk8DYww+Rh95cis/L2S/6ZDyosZcynO2KLpfh++lFScAILohlgequax/vUZH8if5+J1WFUTKBwOtIQLrstnz73LlnRJZYRYaX20nOBuMFEkAU3XDJf+uZ7X+wEGGiILYH1BAE8m3HNPXkEgBHBlqBL7AWrCiM2sU1GO0Q+0mBIPQsBFkU81V/F8//q0oAry8/GqkWpB5MSoMAY/VjUeCyvtu+4zFfFipEsu/VIMygT89j1YvtmrNEgCErqt4drmCu6PBzV7hx52rLYCeHS4pAIuRHu4uGUDz6VLJj4ubWJz6jXTQHsJTE90S0e7cs2K1nW80b8+ZYcmFUaxFFBVTIK+T28FAgaIiKwK3cAhbGJkQokFtkdXS1w3SKVLcvlieAP/uLkuBuoxD4i5NTe2HvMXkHcvBRfigS5hV1sNL2WCVNrNY9ZWTc119LUSO1tEYG24iofiwU3eqMKiSVgiac2wXRA8DUWCoarcX8faMMZWii/JKXvCVgNmkaxuljL1bVe7qWnddbMEPU9KtmFujtEWGM6EjTW/gRgCVy35cXc7DifGjd23lO9Y7G5RuwkUxaW/2kOWn61gezwkrxP6/dFXDMyywVAF9FBs6jHYMzhu7LTSeKDL6twVonm+t1kDNIhY8MNwJY8mAhLnNCDgyG4CeP8QYuSpqO35rKUq52QmSzC+MSUt0Oz3NcvnYhuA3P4gwZ5Am9kZ+ojdCQdtVG6Z374GcdFQUroMmMauXByJ755JA0liY/Kl2CinrBmrZezjiIJwIETxD2Q2h2r49+BcpXUKGIMaCPckPAeyPTDmuAz2pTu5J8Er+VmxdKeK6dq3QBR487YFXNHsaa7kj8MlCtRrFWkXxr7z5nPjtXkjyIatdRvDtbm/3IoSTLkUS+u1BMY+NhAonQp1Ol8M96B6btHYdwj4+96t2ItF4YqFPYw237EhpZuMDSnsSaoUS+pU4hgsI+B48lOms6cLn54N8sqQXBIDDXYViIcGRIiC1piIsTjRDRw8X82OFDCmtXV0YkH5Avl4QcSsWBe0cGnQdKaSvw2XsWSbHnQcu5yEb6AMvSoU2uiYA6EKhtNCmmLQqMRKGvSAY/EceydyMIrzZyJoQpDukFzeYFyA5bC2NKFhENccmuOnS/AdFjOaIsa0to9KbN5GFXbGjU6++9ARWjuotfelDtRrPoRFMP3PgYVoPCJnop04eDbIrrRQphE0KrGkz2yUE2jGywKmse9HJ70eCHREDb65FdPF/2HLGLHAZs1nHhYKvf990JvbhW65+D5Uy5+TFihDGzNDLChfWQGekRJ/SVuhvfknNGHv+NyreE0yQiywRnluMYp8nX2d0HuPfdC1yei4UM7ODJmQ0jEZIZZSxnHanCU2TkJnLE3WsYxJOU4HZR0bJ6EzlibrWMakHKeDso6Nk9AZS/Mf+LvuPmZJ/LcAAAAASUVORK5CYII=";

//
var script$5A = {
  name: 'VideoModalPlayer',
  components: {
    videoPlayer: VueVideoPlayer.videoPlayer
  },
  props: {
    src: {
      type: String,
      default: ''
    },
    // 这里接收父组件传来的src参数，视频的url
    loop: {
      type: Boolean,
      default: false
    },
    //控制循环还是单次播放
    canSkip: {
      type: Boolean,
      default: true
    },
    //是否允许控制播放进度
    playStyle: {
      type: String,
      default: 'yuan-wen'
    },
    //yuan-wen:原文播放；tan-chaung：弹窗播放；tiao-zhuan：跳转播放
    title: {
      type: String,
      default: ''
    },
    //视频标题
    link: {
      type: String,
      default: ''
    },
    //链接地址
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    aspectRatio: '4:3',
    poster: {
      type: String,
      default: ''
    },
    content: {
      type: String,
      default: ''
    },
    initialTime: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      playIcon: playIcon$2,
      titleLeftIcon,
      titleRightIcon,
      // 用于存放<video>标签对象，方便调用原生API
      videoRef: null,
      videoContainer: null,
      // 是否暂停，用于控制播放与暂停
      isPaused: true,
      // 播放当前时间
      currentTime: '00:00',
      totalTime: '00:00',
      // 声音是否静音
      isMuted: false,
      // 是否全屏
      isFullScreen: false,
      controlsActive: false,
      isVideoEnd: false,
      stopDefaultEvent: false,
      lastOperateTimeStamp: '',
      timeData: null,
      playerEvents: ['fullscreenchange', 'timeupdate', 'seeked', 'seeking'],
      playerOptions: {
        playbackRates: [0.5, 1.0, 1.25, 1.5, 2.0],
        //播放速度
        autoplay: false,
        //如果true,浏览器准备好时开始回放。
        muted: false,
        // 默认情况下将会消除任何音频。
        loop: false,
        // 导致视频一结束就重新开始。
        preload: 'auto',
        // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频（如果浏览器支持）
        language: 'zh-CN',
        aspectRatio: this.aspectRatio,
        // 将播放器置于流畅模式，并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字（例如"16:9"或"4:3"）
        fluid: true,
        // 当true时，Video.js player将拥有流体大小。换句话说，它将按比例缩放以适应其容器。
        sources: [{
          type: '',
          //这里的种类支持很多种：基本视频格式、直播、流媒体等，具体可以参看git网址项目
          src: this.src
        }],
        poster: this.poster,
        //你的封面地址
        // width: document.documentElement.clientWidth, //播放器宽度
        notSupportedMessage: '获取视频失败，请检查链接地址',
        //允许覆盖Video.js无法播放媒体源时显示的默认信息。
        controls: true,
        controlBar: {
          timeDivider: false,
          durationDisplay: true,
          remainingTimeDisplay: false,
          fullscreenToggle: true,
          //全屏按钮
          progressControl: true,
          volumePanel: {
            inline: false
          }
        }
      }
    };
  },
  computed: {
    player() {
      return this.$refs.videoRef.player;
    },
    videoAndMusicStop() {
      let playState = sessionStorage.getItem('SET_PLAY_STATE');
      return playState;
    },
    isAsyncConvert() {
      return this.src.split('__')[0] === 'convertTask';
    }
  },
  mounted() {
    this.timeData = 'v' + Math.random();
    // 加载完毕后，先获取<video>标签DOM对象
    this.videoRef = this.$refs.videoRef;
    this.videoContainer = this.$refs.videoContainer;
    if (this.mode != 'editor') {
      this.$emit('resetTimeUpdate');
    }
  },
  watch: {
    canSkip: {
      handler(n, o) {
        !this.isAsyncConvert && this.$nextTick(function () {
          // this.$refs.videoRef.src = n
          //alert(n);
          // this.playerOptions.controlBar.progressControl = n;
        });
      },
      immediate: true
    },
    loop: {
      handler(n, o) {
        !this.isAsyncConvert && this.$nextTick(function () {
          // this.$refs.videoRef.src = n
          //alert(n);
          this.playerOptions.loop = n;
        });
      },
      immediate: true
    },
    src: {
      handler(n, o) {
        !this.isAsyncConvert && this.$nextTick(function () {
          // this.$refs.videoRef.src = n
          this.playerOptions.sources.src = n;
        });
      },
      immediate: true
    },
    videoAndMusicStop(val) {
      console.log('watch');
      let currentPlayStamp = val || '--';
      if (currentPlayStamp !== this.src + '__playTimeStamp__' + this.lastOperateTimeStamp) {
        this.videoRef.pause();
        this.handlePause();
      }
    }
  },
  methods: {
    toggleFullscreen(item, e) {
      // this.isFullScreen = !this.isFullScreen
      let videoParent = document.getElementById(item);
      videoParent.getElementsByTagName('video')[0].id;
      let bar = videoParent.querySelector('.vjs-control-bar');
      console.log(e.isFullscreen());
      if (e.isFullscreen() == true) {
        bar.className = 'vjs-control-bar fullscren';
      } else {
        // alert(1);
        bar.className = 'vjs-control-bar';
      }
      console.log(bar);
      this.videoPlayerDom = videoParent.getElementsByTagName('video')[0];
      console.log('======', e.isFullscreen());
      const data = {
        type: 'setIframeClass',
        value: e.isFullscreen()
      };
      window.parent.postMessage(data);

      //this.isFullScreen = !this.isFullScreen;
      if (/AppleWebKit.*mobile/i.test(navigator.userAgent) || /MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent)) {
        if (window.location.href.indexOf('?mobile') < 0) {
          try {
            if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
              //   alert(1);

              this.videoPlayer.attr('x-webkit-airplay', 'true') //设置允许设备播放
              .attr('x5-playsinline', 'true') // 设置android在微信中内联播放视频
              .attr('x5-video-player-type', 'web') // 关闭同层X5内核播放器    x5-video-player-type='h5' 启用Ｈ5同层播放器
              // .attr('x5-video-player-fullscreen','true')  // 进入全屏通知
              .attr('x5-video-orientation', 'portrait'); //控制横竖屏 可选值： landscape 横屏, portraint竖屏  默

              return;
            } else if (/iPad/i.test(navigator.userAgent)) {
              //window.location.href="平板页面";
            } else {
              //window.location.href="其他移动端页面"
            }
          } catch (e) {}
        }
      }
      //this.videoPlayer.controls = false;
      //this.playerOptions.controls = true;
      //   bar.className = "vjs-control-bar";
    },
    handlePlay(item) {
      if (this.stopDefaultEvent) return;
      // if (this.mode==='editor') {
      //   this.$message.warning('视频仅支持在预览模式下播放')
      //   return
      // }
      this.isPaused = false;
      let audio = document.querySelectorAll('audio');
      if (audio && audio.length) {
        audio.forEach(i => i.pause());
      }
      let video = document.querySelectorAll('video');
      video.forEach(i => {
        if (i.id != item) {
          i.pause();
        }
      });
      this.setPlayStamp();
      // if (this.playStyle === 'tiao-zhuan') {
      //   setTimeout(() => {
      //     this.videoRef.pause()
      //   }, 650)
      //   if (this.link) {
      //     window.location.href = this.link
      //   } else {
      //     this.$message.warning('跳转链接未配置')
      //   }

      //   // window.open(this.src,"_blank")
      // }
      // if (this.playStyle === 'tan-chuang') {
      //   setTimeout(() => {
      //     this.videoRef.pause()
      //   }, 650)
      //   this.$emit('showDialog', { url: this.src, title: this.title })
      // }
    },
    handlePause() {
      if (this.stopDefaultEvent) return;
      this.isPaused = true;
    },
    // 播放与暂停,注意,这里isPause的变化,对应图标的变化
    togglePlay() {
      console.log('播放');
      if (this.mode === 'editor') ; else {
        if (this.playStyle === 'yuan-wen') ;
        // if (this.playStyle === 'tiao-zhuan') {
        //   setTimeout(() => {
        //     this.videoRef.pause()
        //   }, 650)
        //   if (this.link) {
        //     window.location.href = this.link
        //   } else {
        //     this.$message.error('跳转链接未配置')
        //   }

        //   // window.open(this.src,"_blank")
        // }
        // if (this.playStyle === 'tan-chuang') {
        //   setTimeout(() => {
        //     this.videoRef.pause()
        //   }, 150)
        //   this.$emit('showDialog', { url: this.src, title: this.title })
        // }
      }
    },
    doPlay() {
      this.isPaused = !this.isPaused;
      this.stopDefaultEvent = true;
      if (this.isPaused) {
        this.videoRef.pause();
      } else {
        let audio = document.querySelectorAll('audio');
        if (audio && audio.length) {
          audio.forEach(i => i.pause());
        }
        let video = document.querySelectorAll('video');
        video.forEach(i => {
          if (i.id != this.timeData) {
            i.pause();
          }
        });
        this.videoRef.play();
        this.setPlayStamp();
      }
      setTimeout(() => {
        this.stopDefaultEvent = false;
      }, 8000);
    },
    setPlayStamp() {
      let timeStamp = new Date().getTime();
      this.lastOperateTimeStamp = timeStamp;
      let playStamp = `${this.src}__playTimeStamp__${timeStamp}`;
      // this.$store.commit('leaflet/SET_PLAY_STATE', this.src)
      // this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      sessionStorage.setItem('SET_PLAY_STATE', playStamp); //存储
    },
    rePlay() {
      this.videoRef.play();
      this.isPaused = false;
      this.isVideoEnd = false;
    },
    // 停止播放
    stopPlay() {
      this.videoRef.pause();
      this.videoRef.currentTime = 0;
      // 停止播放了，要将播放图标从暂停切换到播放,isPaused为true的时候，图标是播放
      this.isPaused = true;
    },
    playEnd() {
      if (!this.loop) {
        this.videoRef.currentTime = 0;
        this.isPaused = true;
        this.isVideoEnd = true;
      }
    },
    // 定义一个时间处理函数，例如将100秒，处理成1:40
    timeFormat(time) {
      let minute = Math.floor(time % 3600 / 60); // 取余
      let second = Math.floor(time % 60);
      minute = minute < 10 ? '0' + minute : minute;
      second = second < 10 ? '0' + second : second;
      return `${minute}:${second}`;
    },
    // 当事件oncanplay触发时，获取视频的总时间信息，然后通过timeFormat函数处理成00:00的格式，并渲染到template中
    getTotalTime() {
      this.currentTime = this.timeFormat(this.videoRef.currentTime);
      this.totalTime = this.timeFormat(this.videoRef.duration);
      if (this.currentTime >= this.totalTime) {
        console.log('开始时间大于结束时间');
      }
    },
    handleError(player) {
      console.log('%c%s', 'font-size:2em;background: #00965E;color: #FFF', '播放器错误', player);
      if (player.error()?.message.includes('The media could not be loaded')) {
        player.error('服务器或网络错误, 视频资源无法加载');
        player.errorDisplay.contentEl_.innerText = '服务器或网络错误, 视频资源无法加载';
      }
    },
    playerReadied(player) {
      if (this.initialTime > 0) {
        player.currentTime(this.initialTime);
      }
    },
    // 时间timeupdate触发时，更新当前播放时间
    timeUpdate(e) {
      // this.currentTime = this.timeFormat(this.videoRef.currentTime)
      // this.$emit('timeUpdate', { event: e, time: this.videoRef.currentTime })

      if (e.currentTime() >= this.initialTime) {
        this.currentTime = this.timeFormat(e.currentTime());
        this.$emit('timeUpdate', {
          event: e,
          time: e.currentTime()
        });
      } else {
        e.currentTime(this.initialTime);
      }
    },
    // 声音是否静音
    toggleMuted() {
      this.isMuted = !this.isMuted;
      this.videoRef.muted = !this.videoRef.muted;
    },
    // 切换全屏,注意，这里进入全屏时，使用的元素是this.video，而不是this.myvideo。video是myvideo的父标签，这样控制条才能正确显示
    toggleFullScreen(event) {
      let fullscreen = document.webkitIsFullScreen || document.fullscreen;
      this.isFullScreen = fullscreen;
      if (!this.isFullScreen) {
        this.isFullScreen = !this.isFullScreen;
        const inFun = this.videoContainer.requestFullscreen || this.videoContainer.webkitRequestFullScreen;
        inFun.call(this.videoContainer);
      } else {
        this.isFullScreen = !this.isFullScreen;
        const exitFun = document.exitFullscreen || this.document.webkitExitFullScreen;
        exitFun.call(document);
      }
    },
    // 正在拖动
    videoSeeking() {
      this.stopDefaultEvent = true;
    },
    // 拖动结束
    videoSeeked() {
      this.stopDefaultEvent = true;
    }
  }
};

/* script */
const __vue_script__$5A = script$5A;

/* template */
var __vue_render__$5A = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      ref: "videoContainer",
      staticClass: "xml-video-player modal-player xml-video-player-16-9",
    },
    [
      _vm.isAsyncConvert
        ? [_vm._m(0)]
        : [
            _vm.title
              ? _c("div", { staticClass: "title-block" }, [
                  _c("div", { staticClass: "title-adorn" }, [
                    _c("img", { attrs: { src: _vm.titleLeftIcon } }),
                  ]),
                  _vm._v(" "),
                  _c("div", {
                    staticClass: "title",
                    domProps: { innerHTML: _vm._s(_vm.title) },
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "title-adorn" }, [
                    _c("img", { attrs: { src: _vm.titleRightIcon } }),
                  ]),
                ])
              : _vm._e(),
            _vm._v(" "),
            _c("div", { class: ["fixed-ratio-container"] }, [
              _c(
                "div",
                { class: ["xml-video__wrapper", _vm.mode] },
                [
                  _c("video-player", {
                    ref: "videoRef",
                    class: [
                      "video-player",
                      "vjs-custom-skin",
                      _vm.canSkip ? "" : "vjs-no-select",
                    ],
                    style: { width: "100%", height: "100%", overflow: "hide" },
                    attrs: {
                      id: _vm.timeData,
                      playsinline: true,
                      options: _vm.playerOptions,
                      events: _vm.playerEvents,
                    },
                    on: {
                      error: _vm.handleError,
                      ready: _vm.playerReadied,
                      "!fullscreenchange": function ($event) {
                        return _vm.toggleFullscreen(_vm.timeData, $event)
                      },
                      timeupdate: _vm.timeUpdate,
                      seeking: function ($event) {
                        return _vm.videoSeeking()
                      },
                      seeked: function ($event) {
                        return _vm.videoSeeked()
                      },
                    },
                  }),
                ],
                1
              ),
            ]),
          ],
      _vm._v(" "),
      _vm.content
        ? _c("div", { staticClass: "content-block" }, [
            _vm._m(1),
            _vm._v(" "),
            _c("div", { staticClass: "content" }, [
              _vm._v(_vm._s(_vm.content || "暂无")),
            ]),
          ])
        : _vm._e(),
    ],
    2
  )
};
var __vue_staticRenderFns__$5A = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "convert-placeholder" }, [
      _c("div", [
        _vm._v("视频转码中，无法即时预览，请稍候在活页/教材预览中查看"),
      ]),
    ])
  },
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "label" }, [_c("span", [_vm._v("简介")])])
  },
];
__vue_render__$5A._withStripped = true;

  /* style */
  const __vue_inject_styles__$5A = undefined;
  /* scoped */
  const __vue_scope_id__$5A = undefined;
  /* module identifier */
  const __vue_module_identifier__$5A = undefined;
  /* functional template */
  const __vue_is_functional_template__$5A = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5A = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5A, staticRenderFns: __vue_staticRenderFns__$5A },
    __vue_inject_styles__$5A,
    __vue_script__$5A,
    __vue_scope_id__$5A,
    __vue_is_functional_template__$5A,
    __vue_module_identifier__$5A,
    false,
    undefined,
    undefined,
    undefined
  );

//
// import '../block.scss'
var script$5z = {
  name: 'XmlVideoRender',
  components: {
    VideoPlayer: __vue_component__$5B,
    VideoModalPlayer: __vue_component__$5A
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {
        playMode: 'xun-huan',
        scheduleControl: 'yes',
        playStyle: 'yuan-wen',
        link: '',
        titlePosition: 'under',
        titleAlign: 'left'
      },
      //属性组件名
      propertyComponentsName: 'xml-video-property',
      dialogShow: false,
      curVideoUrl: '',
      curVideoTitle: '',
      curVideoContent: '',
      curVideoPoster: '',
      currentPlayer: {},
      initialTime: 0,
      modalPlayerKey: 'mpk' + new Date().getTime()
    };
  },
  methods: {
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    showDialog(param) {
      console.log(param);
      this.initialTime = param.initialTime;
      this.curVideoUrl = param.url;
      this.curVideoTitle = param.title;
      this.curVideoContent = param.content;
      this.curVideoPoster = param.poster;
      this.currentPlayer = this.blockData.videoSetList[param.playerIndex];
      this.modalPlayerKey = 'mpk' + new Date().getTime();
      this.$nextTick(() => {
        this.dialogShow = true;
      });
    },
    timeUpdate({
      event,
      time,
      duration
    }, data) {
      // console.log({event, time, data});
      this.$EventBus.$emit('videoTimeUpdate', {
        event,
        time,
        data: {
          ...data,
          chapterId: this.currentRule.chapterId,
          xmlCompRef: this.currentRule.xmlCompRef,
          duration: event.cache_.duration,
          time
        }
      });
    },
    resetTimeUpdate(data) {
      this.$EventBus.$emit('resetTimeUpdate', data);
    }
  },
  computed: {
    isEmpty() {
      return !(this.blockData.videoSetList && this.blockData.videoSetList.length);
    }
  }
};

/* script */
const __vue_script__$5z = script$5z;
/* template */
var __vue_render__$5z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      class: [
        "xml-video-container",
        "video-content",
        "xml-video-container-" + _vm.pageType,
      ],
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _vm.isEmpty
        ? [
            _c(
              "div",
              {
                style: {
                  width: _vm.blockData.width
                    ? _vm.blockData.width + "%"
                    : "100%",
                },
              },
              [
                _c(
                  "div",
                  {
                    class: [
                      "fixed-ratio-container xml-group-item",
                      _vm.blockData.titlePosition === "under"
                        ? "with-under-title"
                        : "",
                    ],
                  },
                  [
                    _c("div", { class: ["xml-video__wrapper", _vm.mode] }, [
                      _c(
                        "div",
                        { staticClass: "xml-video-player-box" },
                        [
                          _c("video-player", {
                            attrs: {
                              src: "",
                              title: "这是视频名称",
                              mode: _vm.mode,
                              isEmptyPlaceholder: "",
                              titleAlign: _vm.blockData.titleAlign,
                              titlePosition: _vm.blockData.titlePosition,
                            },
                          }),
                        ],
                        1
                      ),
                    ]),
                  ]
                ),
                _vm._v(" "),
                _vm.blockData.titlePosition === "under"
                  ? _c(
                      "div",
                      {
                        staticClass: "xml-video-title video-title--under",
                        style: { textAlign: _vm.blockData.titleAlign },
                      },
                      [_vm._v("\n        这是视频名称\n      ")]
                    )
                  : _vm._e(),
              ]
            ),
          ]
        : _vm._l(_vm.blockData.videoSetList, function (item, index) {
            return _c(
              "div",
              {
                key: index,
                style: {
                  width: _vm.blockData.width
                    ? _vm.blockData.width + "%"
                    : "100%",
                },
              },
              [
                _c(
                  "div",
                  {
                    class: [
                      "fixed-ratio-container xml-group-item",
                      _vm.blockData.titlePosition === "under"
                        ? "with-under-title"
                        : "",
                    ],
                  },
                  [
                    _c("div", { class: ["xml-video__wrapper", _vm.mode] }, [
                      _c(
                        "div",
                        { staticClass: "xml-video-player-box" },
                        [
                          _c("video-player", {
                            attrs: {
                              poster: item.coverFileUrl
                                ? item.coverFileUrl.indexOf("./") !== -1
                                  ? _vm.resourceBasisPath +
                                    item.coverFileUrl.split("./")[1]
                                  : item.coverFileUrl
                                : "",
                              mode: _vm.mode,
                              loop: _vm.blockData.playMode !== "dan-ci",
                              src: item.uploadFileUrl
                                ? item.uploadFileUrl.indexOf("./") !== -1
                                  ? _vm.resourceBasisPath +
                                    item.uploadFileUrl.split("./")[1]
                                  : item.uploadFileUrl
                                : "",
                              playStyle: _vm.blockData.playStyle,
                              title: item.title || "",
                              link: item.link,
                              playerIndex: index,
                              canSkip: _vm.blockData.scheduleControl === "yes",
                              content: item.content,
                              titlePosition: _vm.blockData.titlePosition,
                              titleAlign: _vm.blockData.titleAlign,
                              initialTime: item.currentTime
                                ? item.currentTime
                                : 0,
                            },
                            on: {
                              showDialog: _vm.showDialog,
                              timeUpdate: function (e) {
                                return _vm.timeUpdate(e, item)
                              },
                              resetTimeUpdate: function ($event) {
                                return _vm.resetTimeUpdate(item)
                              },
                            },
                          }),
                        ],
                        1
                      ),
                    ]),
                  ]
                ),
                _vm._v(" "),
                _vm.blockData.titlePosition === "under" && item.title
                  ? _c("div", {
                      staticClass: "xml-video-title video-title--under",
                      style: { textAlign: _vm.blockData.titleAlign },
                      domProps: { innerHTML: _vm._s(item.title) },
                    })
                  : _vm._e(),
              ]
            )
          }),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          staticClass: "resource-preview player-dialog",
          attrs: {
            title: "",
            visible: _vm.dialogShow,
            "destroy-on-close": true,
            width: "100%",
            modal: false,
            "show-close": false,
            "append-to-body": "",
            "custom-class": "preview-modal-video",
            "close-on-click-modal": true,
          },
          on: {
            "update:visible": function ($event) {
              _vm.dialogShow = $event;
            },
          },
        },
        [
          _c(
            "div",
            { staticClass: "xml-modal-player__wrapper xml-group-item" },
            [
              _c("video-modal-player", {
                key: _vm.modalPlayerKey,
                attrs: {
                  mode: _vm.mode,
                  loop: _vm.blockData.playMode !== "dan-ci",
                  src: _vm.curVideoUrl,
                  canSkip: _vm.blockData.scheduleControl === "yes",
                  playStyle: "yuan-wen",
                  title: _vm.curVideoTitle,
                  initialTime: _vm.initialTime,
                  poster: _vm.curVideoPoster,
                  content: _vm.curVideoContent,
                },
                on: {
                  timeUpdate: function (e) {
                    return _vm.timeUpdate(e, _vm.currentPlayer)
                  },
                  resetTimeUpdate: function ($event) {
                    return _vm.resetTimeUpdate(_vm.currentPlayer)
                  },
                },
              }),
            ],
            1
          ),
        ]
      ),
    ],
    2
  )
};
var __vue_staticRenderFns__$5z = [];
__vue_render__$5z._withStripped = true;

  /* style */
  const __vue_inject_styles__$5z = undefined;
  /* scoped */
  const __vue_scope_id__$5z = "data-v-19241f7a";
  /* module identifier */
  const __vue_module_identifier__$5z = undefined;
  /* functional template */
  const __vue_is_functional_template__$5z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5z, staticRenderFns: __vue_staticRenderFns__$5z },
    __vue_inject_styles__$5z,
    __vue_script__$5z,
    __vue_scope_id__$5z,
    __vue_is_functional_template__$5z,
    __vue_module_identifier__$5z,
    false,
    undefined,
    undefined,
    undefined
  );

//
// import '../block.scss'
var script$5y = {
  name: 'XmlVideoImgRender',
  components: {
    VideoPlayer: __vue_component__$5B,
    VideoModalPlayer: __vue_component__$5A
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {
        playMode: 'xun-huan',
        scheduleControl: 'yes',
        playStyle: 'yuan-wen',
        link: '',
        titlePosition: 'under',
        titleAlign: 'left'
      },
      //属性组件名
      propertyComponentsName: 'xml-video-property',
      dialogShow: false,
      curVideoUrl: '',
      curVideoTitle: '',
      curVideoContent: '',
      curVideoPoster: '',
      currentPlayer: {},
      modalPlayerKey: 'mpk' + new Date().getTime()
    };
  },
  methods: {
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    showDialog(param) {
      this.curVideoUrl = param.url;
      this.curVideoTitle = param.title;
      this.curVideoContent = param.content;
      this.curVideoPoster = param.poster;
      this.currentPlayer = this.blockData.videoSetList[param.playerIndex];
      this.modalPlayerKey = 'mpk' + new Date().getTime();
      this.$nextTick(() => {
        this.dialogShow = true;
      });
    },
    timeUpdate({
      event,
      time
    }, data) {
      // console.log({event, time, data});
      this.$EventBus.$emit('videoTimeUpdate', {
        event,
        time,
        data
      });
    },
    resetTimeUpdate(data) {
      this.$EventBus.$emit('resetTimeUpdate', data);
    }
  },
  computed: {
    isEmpty() {
      return !(this.blockData.videoSetList && this.blockData.videoSetList.length);
    }
  }
};

var __$_require_images_play_circle_png__ = "data:image/png;base64,[encoded data, 4556 characters]";

/* script */
const __vue_script__$5y = script$5y;
var __vue_render__$5y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      class: [
        "xml-video-container",
        "video-content",
        "xml-video-container-" + _vm.pageType,
      ],
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    _vm._l(_vm.blockData.videoSetList, function (item, index) {
      return _c("div", { key: index }, [
        _c("div", { staticClass: "xml-video-container-pdf" }, [
          _c("img", {
            staticClass: "cover",
            attrs: { src: item.coverFileUrl, alt: "" },
          }),
          _vm._v(" "),
          _vm._m(0, true),
        ]),
        _vm._v(" "),
        _vm.blockData.titlePosition === "under" && item.title
          ? _c(
              "div",
              {
                staticClass: "video-title--under",
                style: { textAlign: _vm.blockData.titleAlign },
              },
              [_vm._v("\n      " + _vm._s(item.title) + "\n    ")]
            )
          : _vm._e(),
      ])
    }),
    0
  )
};
var __vue_staticRenderFns__$5y = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "play-box" }, [
      _c("img", {
        staticClass: "play",
        attrs: { src: __$_require_images_play_circle_png__, alt: "" },
      }),
    ])
  },
];
__vue_render__$5y._withStripped = true;

  /* style */
  const __vue_inject_styles__$5y = undefined;
  /* scoped */
  const __vue_scope_id__$5y = "data-v-26092a25";
  /* module identifier */
  const __vue_module_identifier__$5y = undefined;
  /* functional template */
  const __vue_is_functional_template__$5y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5y, staticRenderFns: __vue_staticRenderFns__$5y },
    __vue_inject_styles__$5y,
    __vue_script__$5y,
    __vue_scope_id__$5y,
    __vue_is_functional_template__$5y,
    __vue_module_identifier__$5y,
    false,
    undefined,
    undefined,
    undefined
  );

const video = [__vue_component__$5z, __vue_component__$5y, __vue_component__$5A];
var XmlVideo = {
  ...video
};

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

// import '../block.scss'
// import { isRadio } from '@/utils/questionType'
// import { defaultCover } from '@/assets/remote'

/***
 * 试卷块儿
 */
var script$5x = {
  name: 'XmlTestPaperRender',
  // dicts: ['question_type', 'difficulty', 'examine_status', 'answer_platform', 'answer_situation'],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    reader: {
      type: Boolean,
      default: false
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isShowAi: {
      type: String,
      default: '1'
    },
    BookName: {
      type: String,
      default: ''
    }
  },
  computed: {},
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          console.log('Question组件(ruleIndex:' + this.ruleIndex + ')，watch触发，变量pBlockData：', newValue);
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    },
    pageType: {
      deep: true,
      immediate: true,
      handler(newValue) {
        this.tmpPageType = newValue;
      }
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      //属性组件名
      propertyComponentsName: 'xml-test-paper-property',
      radio1: null,
      tmpPageType: ''
      // defaultCover
    };
  },
  methods: {
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    pageClick(info) {
      this.$emit('openTestPaper', {
        info: info,
        showRobot: this.isShowAi == '0' ? 'true' : 'false'
      });
      // console.log(this.BookName, '打印的info')
      //info.link 跳转地址
      // window.href = info.link
      // if (this.reader) {
      //   this.$emit('openTestPaper', { info: info, showRobot: this.isShowAi == '0' ? 'true' : 'false' })
      //   return
      // }
      // if (this.mode === 'preview') {
      //   if (this.tmpPageType === 'h5' || this.tmpPageType === 'pad') {
      // const url =
      //   process.env.VUE_APP_TESTPAPER_WEB +
      //   `/mobile-answer?testPaperId=${info.id}&showRobot=${this.isShowAi == '0' ? 'true' : 'false'}&BookName=${
      //     this.BookName
      //   }`
      // // const url = info.link
      // console.log('跳转url:' + url)
      // // window.location.href = url
      // this.$router.push({
      //   path: '/webView',
      //   query: {
      //     baseUrl: encodeURIComponent(url),
      //     title: info.paperName
      //   }
      // })
      //   } else {
      //     console.log(this.blockData)
      //     // window.location.href = process.env.VUE_APP_TESTPAPER_WEB + `/answer?testPaperId=${info.id}`
      //     this.$router.push({
      //       path: '/webView',
      //       query: {
      //         baseUrl: encodeURIComponent(
      //           process.env.VUE_APP_TESTPAPER_WEB +
      //             `/answer?testPaperId=${info.id}&showRobot=${this.isShowAi == '0' ? 'true' : 'false'}&BookName=${
      //               this.BookName
      //             }`
      //         ),
      //         title: info.paperName
      //       }
      //     })
      //     // window.location.href = info.link
      //   }
      // }
    }
  },
  created() {}
};

var __$_require_static_images_default_over_test_aper_png__ = "data:image/png;base64,[encoded data, 18764 characters]";

/* script */
const __vue_script__$5x = script$5x;
var __vue_render__$5x = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      class: "xml-question-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _c(
        "div",
        { staticClass: "question", staticStyle: { height: "100%" } },
        _vm._l(_vm.blockData.testPaperSetList, function (item, index) {
          return _c(
            "div",
            {
              key: index + Math.random(),
              staticClass: "workbench-shop-item xml-group-item",
              on: {
                click: function ($event) {
                  return _vm.pageClick(item)
                },
              },
            },
            [
              _vm._m(0, true),
              _vm._v(" "),
              _c("div", { staticClass: "text" }, [
                _c("div", { staticClass: "xml-paper-title title" }, [
                  _vm._v(_vm._s(item.paperName || item.title)),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "info" }, [
                  _c(
                    "span",
                    {
                      directives: [
                        {
                          name: "show",
                          rawName: "v-show",
                          value: item.questionNum,
                          expression: "item.questionNum",
                        },
                      ],
                    },
                    [_vm._v("共" + _vm._s(item.questionNum) + "题")]
                  ),
                  _vm._v(" "),
                  _c("span"),
                  _vm._v(" "),
                  _c(
                    "span",
                    {
                      directives: [
                        {
                          name: "show",
                          rawName: "v-show",
                          value: item.fullMark > 0,
                          expression: "item.fullMark > 0",
                        },
                      ],
                    },
                    [
                      _vm._v("\n            满分"),
                      _c("span", [_vm._v(_vm._s(item.fullMark))]),
                      _vm._v("分"),
                    ]
                  ),
                ]),
              ]),
            ]
          )
        }),
        0
      ),
    ]
  )
};
var __vue_staticRenderFns__$5x = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "shop-item-img" }, [
      _c("img", {
        staticClass: "question-img",
        attrs: {
          src: __$_require_static_images_default_over_test_aper_png__,
        },
      }),
    ])
  },
];
__vue_render__$5x._withStripped = true;

  /* style */
  const __vue_inject_styles__$5x = undefined;
  /* scoped */
  const __vue_scope_id__$5x = "data-v-d8637fba";
  /* module identifier */
  const __vue_module_identifier__$5x = undefined;
  /* functional template */
  const __vue_is_functional_template__$5x = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5x = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5x, staticRenderFns: __vue_staticRenderFns__$5x },
    __vue_inject_styles__$5x,
    __vue_script__$5x,
    __vue_scope_id__$5x,
    __vue_is_functional_template__$5x,
    __vue_module_identifier__$5x,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$5x.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('test-paper-render', {
    prefix: options.prefix
  }), __vue_component__$5x);
};

//
var script$5w = {
  name: 'XmlRecorderRender',
  components: {
    RecordPlayer: __vue_component__$67
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          console.log('新data', newValue);
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {
        playMode: 'xun-huan',
        scheduleControl: 'yes',
        playStyle: 'yuan-wen',
        styleMode: 'A'
      },
      //属性组件名
      propertyComponentsName: 'xml-recorder-property',
      dialogShow: false,
      curRecordUrl: '',
      curRecordTitle: '',
      curCoverFileUrl: '',
      curRecordContent: '',
      currentPlayer: {},
      modalPlayerKey: 'mpk' + new Date().getTime()
    };
  },
  methods: {
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    showDialog(param) {
      this.curRecordUrl = param.url;
      this.curRecordTitle = param.title;
      this.curCoverFileUrl = param.coverFileUrl;
      this.curRecordContent = param.content;
      this.currentPlayer = this.blockData.recordSetList[param.playerIndex];
      this.modalPlayerKey = 'mpk' + new Date().getTime();
      this.$nextTick(() => {
        this.dialogShow = true;
      });
    },
    timeUpdate({
      event,
      time
    }, data) {
      // console.log({event, time, data});
      this.$EventBus.$emit('audioTimeUpdate', {
        event,
        time,
        data
      });
    },
    getresdata({
      blob,
      duration
    }) {
      this.$emit('getresdata', {
        blob,
        duration
      });
    }
  },
  created() {},
  computed: {
    isEmpty() {
      return !(this.blockData.recordSetList && this.blockData.recordSetList.length);
    }
  }
};

/* script */
const __vue_script__$5w = script$5w;

/* template */
var __vue_render__$5w = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-recorder-container",
      class: "xml-recorder-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      [
        _c("div", { staticClass: "fixed-ratio-container" }, [
          _c(
            "div",
            {
              class: [
                "xml-recorder__wrapper",
                "style-mode--" + _vm.blockData.styleMode,
                _vm.mode,
              ],
            },
            [
              _c(
                "div",
                { staticClass: "xml-recorder-player-box xml-group-item" },
                [
                  _c("record-player", {
                    attrs: {
                      mode: _vm.mode,
                      loop: _vm.blockData.playMode === "xun-huan",
                      "play-mode": _vm.blockData.playMode,
                      "play-style": _vm.blockData.playStyle,
                      scheduleControl: _vm.blockData.scheduleControl,
                    },
                    on: { resData: _vm.getresdata },
                  }),
                ],
                1
              ),
            ]
          ),
        ]),
      ],
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          staticClass: "resource-preview player-dialog",
          attrs: {
            title: "",
            visible: _vm.dialogShow,
            "destroy-on-close": true,
            width: "100%",
            modal: false,
            "show-close": false,
            "append-to-body": "",
            "custom-class": "preview-modal-recorder",
            "close-on-click-modal": true,
          },
          on: {
            "update:visible": function ($event) {
              _vm.dialogShow = $event;
            },
          },
        },
        [
          _c(
            "div",
            { staticClass: "xml-modal-player__wrapper" },
            [
              _c("xml-audio-modal-player", {
                key: _vm.modalPlayerKey,
                attrs: {
                  mode: _vm.mode,
                  styleMode: _vm.blockData.styleMode,
                  "play-style": "yuan-wen",
                  "play-mode": _vm.blockData.playMode,
                  url: _vm.curRecordUrl,
                  loop: _vm.blockData.playMode === "xun-huan",
                  title: _vm.curRecordTitle,
                  content: _vm.curRecordContent,
                  scheduleControl: _vm.blockData.scheduleControl,
                  "cover-image-url": _vm.curCoverFileUrl,
                },
                on: {
                  timeUpdate: function (e) {
                    return _vm.timeUpdate(e, _vm.currentPlayer)
                  },
                },
              }),
            ],
            1
          ),
        ]
      ),
    ],
    2
  )
};
var __vue_staticRenderFns__$5w = [];
__vue_render__$5w._withStripped = true;

  /* style */
  const __vue_inject_styles__$5w = undefined;
  /* scoped */
  const __vue_scope_id__$5w = undefined;
  /* module identifier */
  const __vue_module_identifier__$5w = undefined;
  /* functional template */
  const __vue_is_functional_template__$5w = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5w = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5w, staticRenderFns: __vue_staticRenderFns__$5w },
    __vue_inject_styles__$5w,
    __vue_script__$5w,
    __vue_scope_id__$5w,
    __vue_is_functional_template__$5w,
    __vue_module_identifier__$5w,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$5w.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-recorder-group-render', {
    prefix: options.prefix
  }), __vue_component__$5w);
};

var checkbox = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAPCAYAAADtc08vAAACT0lEQVQ4T3WTv2tUQRDHv7Pvnqig8VQwIvgjqJWVaGMj2PkHxE548N5uDrUwJBJNQK2NNhoOsrsXrxL1bJQgEhRPrGxUBG0iWIigEHJ3Ri3O93Zkz3vhjMk2y8585zOzszuEv4viOD5GREeJaBsRUdeeb98BvAXwXGv9Wym1nZljAC8piqL1YRgOE9FmAHPM/MU55/LILMuoUCh46HEi2ppl2VwQBKeY+UOz2ZwiKWWJiDY0Go2btVotW5G59yiklFeIaADA+0ajMen1pJQyhUJhuFwu/1greHBwcF2xWDwL4HBXM6W1ftW5u1JqRGt9QykVeoO/Yy9IKbURwAiAgwCWmPkNEf3UWt/pAJIkUcz8IAiC8845AeCWtfabd/pgIhpj5gFmZufcNQA7hBADxhizDEjT9FEYhuNEVATwi4jM4uLiu2KxONbNDOfcrLX2XpIkJwDst9bqZYA/RFHUH4bhBBFtAcAAvgLY6UXM/Hl+fv5yvV5P1wR4YalU2uWcuwSgL++Dr5yZr1prP3nbfwAp5RljTDkP8JA0TSeEEJu62Z8ZY6q5X0p5UgjRPz09fTt/heta69EVnd8N4CIzF7IsG5mZmVnK/Uqpc1mWfaxUKk86ACnlJIBZY8yLlRDn3CFr7ePcniTJPiHEeLvdvlCtVpsdwNDQ0AFmHnXOPWy1Wk9rtVp7lQ8l4jg+EgRB5Jy7b62t55rO0MRxvEcIcRrAXgALRJT2NFH4AQPQAnBXa/26N8E/U6eU6kvT1A+O/1CdFQSBf9KW1nphlcrwB3YxGYrLREgxAAAAAElFTkSuQmCC";

var chackboxactive = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAPCAYAAADtc08vAAACU0lEQVQ4T3VTO2hUQRQ9d+a91RWNaUJQMRHRCGlc2ey+N2sTsBHRxg+BdLEKllooKaxESSEoIQh+EFKI2ghRg5BgtspMgksKYQuDkE6DAXGbTeZ9rry37PKMZKq5d84998ydMwQADIjI80ZZiCsM9BNAST6zNph5boPo2VGtm1yp9IfMT4l5hnhwcH/Y1TULoh6O4ykC6gyE7WKSkmLmY4L5OoiOCOapmOg+AYvS2hEKlZph5oNOo3GN6nW7o3MnZEAGShkChgAsONZeoFotoECpRtPa41212uauxcXivtB1X4PoUoKJmUf2GPM22ScEH1ytL/Lw8N40Ua1uZYm4UOgO8vmPBFTAvMnAewJ+u8bcSvGh77+UUXQ3kPIdEUmH6CotLX1Ph1sodIf5/DwS2cwxmM8z0QkA5ZwxYx2CMI4fSCkXARwG8x8iGpPApwCYJ+Bsqoh50jXmjvX9cQF4TpYgCbbK5QEpZRXAoRTOvEZEA61a/uo2GkPJkHclSIGeNxgK8RlAb2YOEUeRn1tZ+ZLk/iOwSr3KaT3aLkhIIiGqDPSkd2R+4hhzo30e+P7NRJmj9XhrBkqtSa0HKDVka9ly+bQQYgGA29zePnlgdfVX+yxU6g0BWmr9KCWwvv9NEE06Wr/IPp8tlQpSiHNyeflhRl0xFGLRsfYU1Wo/Wj4olSqQcg5E9xxgmrRu7jRU4sJIqcsApmPmiZwxzztWTyUrdYaAx2AuMrBORFlLCwB9AH4S823HmNlsg39+HXtebyBlH6JIdkBE7AIbZMz6TmVJ/BfZ8hBQpXDnDQAAAABJRU5ErkJggg==";

var playIcon$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAtCAYAAABf9xDlAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OEE1RTlCNzNCOTk2MTFFRTg1MkJBRkNBN0FBNEIwN0QiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OEE1RTlCNzRCOTk2MTFFRTg1MkJBRkNBN0FBNEIwN0QiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4QTVFOUI3MUI5OTYxMUVFODUyQkFGQ0E3QUE0QjA3RCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4QTVFOUI3MkI5OTYxMUVFODUyQkFGQ0E3QUE0QjA3RCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppwbv/YAAAJ+SURBVHja7Ji/SxxBFMfnohL8weEPLhaKopKk0COxNIWYRq6w8C+wsbI7LCwOsUiT2iJwjTbGUkijpIvIcaY0iFVMFL0TzsNDRQ3hlMl35bswTm5vZ39EJPjgw7pv3g9n5+2buRVSSmFIAnwEh6BMDqlLmMQwSdIFNqS7bNDWd7KXoCjNpUifivEitxkrSwPYBr3Cm/wEcXClDzyp4jTjI5Ggz0ylAaeZ1YA8aBf+pAA6wI3JzOIBEgn6xnVlrYNxBMwr901g0iXBArjQYhg9Rl2ege8g6jB+Dp6D42pBnB5jEkiFQpVEgmMFzSfppRpDl3tN5rRmT0G9ViA7LmvWrxXIL/DbpBoHQUIrELc1S2kF8hl8vWPl0MeSMrgk9bj/b4E8iGr8J2JX41TAxmu0E9gzk/e9ZmnQQlIhxE4p8dL6S21tmKf8Ox9CsrwSr0ad2RHoVgz3Q0imxrBiH9lrtgqGQIxbeR1bT7PPRKdscWXOqgg27Zmt8dmO8r5sP2efkmYMwZgttznYt9rABciACHXNIOejJ+boKxgrw9htaqOcpfG0ohsEJQ+JSvSx/aepn9VPxHX8L27AhKJ/AbIGibK0tf0mGCvD2H9tMTGwRecPIKqMjYFlcKD8sDigbkyxi9JXMlas2lm/ESzR+AS8BwOaTURZW5sB2p7Qd4mxjM76b8EcGOG99Sp847VEXStL/BWvlqyDd+CLn67fB8bBG54zOkEjxy5BjueTLPgEfoS9xWzx+vpxp35MFp64/IC33v4FcGbQrs7BotoxvHwtaAe7Prr+Ln09JVsJcPRe8fJpooefGIKI9dVgz6RAhkMoh2HTarwKIdm1rvgjwADXwMhaII0Z/AAAAABJRU5ErkJggg==";

var pauseIcon$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAcCAYAAAA9UNxEAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OTlFQzg3NThCOTk2MTFFRTlENDY5MUNCQzg0RTlFQzgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OTlFQzg3NTlCOTk2MTFFRTlENDY5MUNCQzg0RTlFQzgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5OUVDODc1NkI5OTYxMUVFOUQ0NjkxQ0JDODRFOUVDOCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5OUVDODc1N0I5OTYxMUVFOUQ0NjkxQ0JDODRFOUVDOCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PngvZYIAAAJRSURBVHja7JlLKEVBGMcdj7ySVxaeRfLckZIrdEWJjYUlIWxs2CiKhWJjoaykFCvXzmtFVyllwcZKKGFFEaG8Ltd/8l3G6Yx7zpyDW85Xv87cOXO+M/+Zb2bOzFW8Xm/Qf7Jgg+WLwDIYMPHODvAI1kDID2hKBynCu6yHDeD2flqOwWd9bHM+CiV9iKgEHvAMHFplvuvhTJClykvk0lE6WroflKjywwRpI8YioxO0qaK0iu6FAqfWg6EChxVgHSigFrglKuUCZSQ6icLYKmsHU5R+AHOUVlSNonsM+1qK3S/38/I4sAkOQTGXn0rXGJCsQ0QNOAErINxP2VQunWvFpMXnK3581AEHyKYJSdZ6QAao1xgGfzZLaxnfG5Em/EQLhlozhWypCd/VYB40MseVoAnMgu0AWzbjwQx1TC4tizLGfKSBBiZ4EcRSKGUGmOBYLgoTTPiJ8a0sweTU15r2l5Yt2BZsC7YF24Jtwbbgfyv4XpA2as90fWGCX+mHJwAFn4MxsA+GTfgZBAdgiAmeANdgXNLZC5f2WNALzPiTxT6Qx23yZWySNh+jTHAvfUePSDrbABckdsFEpVwk9Bjs/lTIiI54HgUtr2WntHGPAFdc/i0XAZc66jJNDXaj4523qrA3LZhtlltoUnPpnFzUk0oXnWIsqSr4nV3qLMfOs7IoqmatEHwE8k1GzxahtldB2oixBuz+jWVpj65P4Eyysqt0ZQd2hxYPUY9gWH6YYvCvFnZC2Qp2gt5PKmWtgMb+ncWCmd91mjectJx9sTcBBgBvGSJPfLhgBQAAAABJRU5ErkJggg==";

var playIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAABxBJREFUeF7dW2tsFFUU/s5sCygo7W4JwfggkZAYNNYnqBB31iI2jYnERwyiRuILFcJuwZQEAgYfDbSzii8CYqDlYRQhUQNIS3cFkRbERxXTYMCCgGI7U0ssXbbbOWa2bu1ruzOzM8suN9lfe+53vvPdc2fu4wwhBc1ddjYPjnA+VM4XBMdogHPAyGFoP2onQgsxt6is/g1QI1RuRFZWY9Cb22g3PbLLgcevFLKqFjKRm4AbTPth3gjQtmHZqNox13XWNE6cjpYK4C5TJhOpj4BQCNA4i8kqALZAVVcH5o86ZBW2JQKIkjID4BkAiqwilgBntVVCJCWA6FeKAC4BY3KKAu/lhsGlWWGhtLrE2WrWvykBCt5Uru5ktQRMs806tqofAT8xqDTgc24yg2lYgHvKW0SV1FUAxptxaFsfxocRYdiivd7hfxjxYUgAj7/5cWaqMOIgxbYNTFgc9Lq26PWrWwBRkr9I4UNOL/8B7ZhoUdDrfE0PiC4BREmuAlCgBzBdbJjopaDX+W4iPgkFEP3yWjBmJQJKy/+ZnwwU5w06ZQcVwF3etJRIWJKWwekkRcC0Gp9rVzzzuAJ4pObpDNqq0086m9ULwtB7d88bcWYgkgMK4Fl+5lrOzv4SzNemc2T6uVFlwOd8QrcAbkneSsB0/Q7S35KI59Z4897uy7RfBrjLlZlEXJn+IRlkyDjtECJTqr2jj/Xs2UuAwpU8NBRp+Qbgmw3CZ4r5moDP9WxcATySUsLgNzIlGlM8mYoCxc7tsb7dGVBQqozsHML1AK42BZwhnYiwrsbreqqfAJ5yZTYTv5chcSRDs41JuD523NadAaJf3mv3vn786CxMGJOF+lMdONrUmUwQSfallwM+5woNJCqAWCZPg4CdSaIO2n1J0QjcPX5It82+o2FU1oVw5EzETrfxsA8EfK6J3QLYveTtG3yMVaiDUVnXjs0HQykXgRl3BItdtV0ZICkBgN12sfj8xVwMHxJ/2/Hd7x3YUBvCDyc77KLQD5dApTU+50IqXClfHorA9JlaIsbavF814/JEZtH/Nx5oj06LcIR12Sdp1BDwua4jtyTfR8COJMHids+/MhvSw5fphm/4MxKdFvuP2Z8NHecdTnJLTc8ThPd1MzRoaFSAGPy2H0KorA3h73bVoEcD5qp6K3kk5Q3WjrZtamYF0OicUDqj2bC7IWwLO2I8ogmwmcGP2uIBQDICxDjtPHwey3e1WU6RmUpI9Ct7wWzbxYYVAmiRf3wohFV7zlkqAhGVkSjJPwOYYClyDzCrBNAgZ1W0olG2bgVJhA9I9MunwLgiEwQoq2rD9p/PW0aVgC1aBmh5dYllqH2ArMyA13f8g2prH4jVmgAtAHIyQYAn1rXiZIt1U4BBn5MoKd8DnJ/uAqyvbcf6/e3W0iSqII9f2cbMD1iL/D9aslNAWxRX2BF811b4LfL4ZT8z5qWjANomSQu+/qQ9W2Zm9RVNgKeZsSadBIioXaO+oc7ilO8bpMNRQGJZ0y0QhG/TRYCDx7tG/fBpe0a9R5yhYVnOHOo6Cle0N4Etr8JxoxxYPXNkQn3PRxjag+6j1B2OVAd8rqn/HYjI+wDcmZClSYPPXsjFiKHxD0Rqf+sadW0rnKqmzf9g8ailUVYX6kisLczRwD85lPojMXTypMCCvLquDFjRPBEOqrVT/YEORbXgf/3LuoWNbv6EuoDXNUmz73ksXgtG9KTUrqatCW68KgtfHQlbuqkxyjeW/r0EsHsaGCVppz3DcVvQlxN983VnwDSp1RlGR50NJa52xmIG+9OAz/VQrGOvR7PH3zKHWV1pBjVj+pDwYMCb21350u/dJPpl258FF0osIhys8bpu7+m/f4GEX3mMmDdcKJJ2+mWB7g/Oc2r1jt1twNWJW5K3E7SS94unaYXVQV/ewr4RDSiA6FfuAngXGJdeFBIQ9nBr/T3BpWK/pWbc9alban6JQP2KijJQEAUseALFuT8OxH3QQkmxXF4LytAq0f+iJVW4u2Z+7p54A5ewVNYtNX9HoJsycOTBRDODXufGwbgnFEDrLEpySq5rrRSZGWXBYteCRJi6BNBAMunNQKB3anzOOYmC77UU1mMsSspygBOqqgfLLhsCXq3xuRbrxdedATFAUZK9AJYBGK7XSYrsDH8tYjgDukVY0TyRBVpGhKkpCm5wNya/FzItQIxNdAstCM/Yebc4WOTazQ4ErO67vDUyKIanQF/wKf62MQ713HOpFMKKwGNxJC1ADEgTIhvhh1RWC23aR7SCeBN3CpuC851fGxnlpNcBRp25pdZxAqmFAHuYo+V3Zi9fTwHYycD+LIGqquc5TxjlksjesgwYzJF7RZMbAtyCIFzDTGMBHgtgLAgtYGh3EtqviUCNKtTjADc6OtVfdi8YrRVv29r+BTKBrQtOiFe6AAAAAElFTkSuQmCC";

var pauseIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAABrJJREFUeF7lm21sU1UYx//PXbcJQ0d7mREkuixqlqiwRA0MQdqymIAoIOAHooD4Fkkc6R0TSCCMQALK1js00YhRXNTEOExQJBOBtgg6UFFQTAxgggYRYe2GA2EvvY+5hc52Xdt7u1O4y863pv/zvPzuyzn3POcQrkFzqmfLwFQKULEE6XYGFwMoAmAHwQ6GHcBJgE4S8UlN035nSdq51yM3Zzs8yoaDivrQbd1aeJqEnMkMdgK4JUM/IQb2SCTt01hqCiiFJzK0k7SbUADO2tBEytHmgWkegELRwTLQJJHU1IW8rfs8BX+JsC8EgLM+NB0anifwoyKCSmuDcJo17e2wNPSt/oLoF4BrnnhvMjoIYHPAI69JCy2JICMAk9SLI23a5XUgLMrUsch+zNhFGq/yV484aNauaQBONTiHGGsBlJp1lmX9RQCr/IqsmvFjCoDb27KSQXryFm70vl9xzDcaoGEAbrXlJWZ6zajh66z7ya/IY43EYAiA0xusIqDWiEErafyKnDa/tAK3GlzKjI1WSsxoLAzeHlBGPJZKnxKAq651PkhrMOrQijrSuNK3dMTryWJLCsBdF5zAEnaCMcyKiZmJiUmaFfDYt/XVp08Azhq/jQrH7AHjITOOLKtlnGfSKgJK0feJc6k+onZ6W9YTaLllE8ogMP07IqDI09IC0Ke3pPH2DHxYvgsTPRnwOD6MDTThEXCrwW+Z8YDls8kkQMJBv0cenxSAS219HKx9kontVH3Gjs6FTQKOnu5GRzenNJ9vI9wzyoZuDThyqkt0KCCSKn0ee8+oEHcHuLzBrQBmi/TqnXsTykbbIiaPnw3jjb3/Jk1MB7V48lDceXNORH/4VDeUxn9EhgOAT+Qhd9xOpTCkG+4B4PS23U8IfyfS2+S78rD6kfhR9NMjHdjk079bEtsSdwFmjM2P+2PNjgvYe6xTZFhgQk30E7oHgMsbfBVAtUhPC8qHYMH4IXEmU13V2Lsl2qnhwCU0NF8SGZZ+2XveBREAD288U9CVk3sUgL5YKaxZFoCeYZjH6+sHEQDOupaFRLRFWOZXDVkZALO2JlBVVBMB4PIGdwBImCT0F4iVAQD4xq/ID14BoAb/BGNUfxPu3d/SAJgvc3u7nSrUtpIwh38Tnbxuz9IA9AGRUU7ZnPpaHgC0F8lZd66GSFo9GO8AItST2xusZ2DJ4ARA28ilhhrAbHgV1Qwoqz8CAB0mpzf0WbZKWtYHgDZyeYO7AFSYubJGtQMAwCX9HdDIwByjSZnRWR4A4TS51eDbzHjWTGJGtZYHAPxCbjW0kZmXGk3KjM7yAIj2k7MutIyIN5hJzKjW6gAI9BG564JzmfCx0aTM6AYAgA3kqj13HyQpYb3cTKLJtFYHwPpUeOL6NntufjiyPia6WR8Apl79HA4dAfOYQQeAJHsUwMtgfmWQATjgV+TyK0tiamsZsfbjYAJAoA0+xbEidlX4AIBxIiFY+R3AwNSAIn8RAyBUDbC+NC6sWRYAYb/fI0/SE/2/MKK2FhNr+tJ4gSgC7tI8rJwaXxj5/OcOeHf3XRhRKgow/d74wsi6pgvw/Sq2MEJMi31VjjfjAOg/3GpwCzMWigIwLJ+gFzvuKLpS6tKb0tiOw0lqfmWjc+Gde2OP9sS5cKQ0dqEjdT3RZLx/5HTSmN3LHecTALjqQtNArC+RC2t3j7ShvCQXtw7PQeB4Z9oyl64tL8lDWAMCxzqFF0gJtMKnOHqm/gnlcZc3uBnAc8IIWMoQ/XCDzT6hqZI6omElAKhQ/y4Ja7Z9IPF1guvNgpmeClQ5PoiNo889QgNsU6QhrsS0zVflmNVbnHyXWBZXigxFLFZ0lsM0JVDt0Ee5uJYUgLO2pZRySN8pJrxkJjY3Q9Ze8Cuy/m5LaKk3SqrBRWC8Y8iFdUUNfkVOOrSn3SqbzcpR1pkR3vV75GdS+UkLQO88ECEw0BhQ5CfSQTYEYABC2ONXZEO1DsMAIhCse1ok5kJn6cBE1IPVzgvFTWoI1T6PbOpcg6k7INaZSx8hgLVWGCb1550JaiYnTTMGEHkkaltKJYnWZqu0ZuAF1gyG6quSG9Npk/3fLwBRo25v69MMTT8taujFk2mwMf0OAdicbHJjxr4QAFGHrk1tU6CF50HDbJD4o7MENDPwnojEozELBRA16lRbh0MLz5QkaQYzzzRzReK1fIyZvpKAL7VcNAcq5VOZ2+q7Z1YA9HblVFuL0d1dDImKAS6WSBrORHZm2Ak8hIA2ENoAatOYzyCsHerScOjrZUXtohPube8/AMNbG4WK/N0AAAAASUVORK5CYII=";

var audioIcon = "data:image/png;base64,[encoded data, 4516 characters]";

var playRepeat$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAaCAMAAADhRa4NAAAAAXNSR0IArs4c6QAAAi5QTFRFAAAAAID/QID/M5n/JJL/SZL/TYD/O4nrQJ/vR47xQIz/OovoQ5DpPYXrPYX1QJLtPo3tRJDuOI//QI/vOpL4QpLwOZzxQI7qRYr4Po/sPo/zPYztPZL5QIvuQJHuOZL1RI3vPYrwQYzwOY7xQo7sQo3tQpHtPY7vQY7zI4XzPI/wQI/sQZDtSpHtP4/uPo3nPo3xQYvuRoDuQY3vQIn1QI/tOpfxP4zvQY3sKrv1MYv1QJDtQI/tPpLwQJDxQo/sQI7tQYzuPI7vQZDvQY3xQI7sM6nyQY3sQJLvPpLtQI/tQI/vRIntQI7uQI7vQY7uQY7tQY3tQo7tPYzxP47wQpDuRJDxQo7tQo7vQI3tQ5PtRI3uQJXxQYvxQZDxQJDuQ5DsQI7uPozsOpPtQY7tQI7tQI7uQI/uQ43sQY7tQI/tQY7tQ43vQ4/tQY7tQovsQI/tQY7uQI/wQo7uQo7tQI/uQYztQ43vQYvtQY7tQI7qQI7vQY3uQo/tQI/rQY7uQY7tQo7uP43vQI3vQY7tQY7rQpDvQY7tQY/tQY7tQY7vQY7sQo7tQ5DrQY7sQY7tQo7tQY7tQI3sQI7qQI7sQI/qQI/tQI/uQY3rQY3sQY3tQY7rQY7sQY7tQY/sQY/tQozsQo3pQo3qQo3sQo3tQo7rQo7sQo7tQo7uQo/qQo/sQo/tQ4nrQ4vuQ4zsQ43sQ47qQ47rQ47sQ4/qQ4/sRIvrRobsSI/qS3/qS5DpVRNwpwAAAJJ0Uk5TAAIEBQcHCg0QEhQWFxkZHB0eICAjIyQkJSkpKiosLDExMjM2Njo6Pz9BRERHSElKSktMTlBUXV1eYmNjZGdsbXN2fH6Ch4iJjI+Pj4+Tk5WZmpqgpaWmq6usrq+wsLGzs7a4ubm8vsLHyMvLy8vMzc/V1tbZ3N3e4ePm5ubp6+vs7e7u8PHy8/T29vj5+vz8/P6b5lOEAAABY0lEQVQYGY3BhztVYRwH8C+XsiIjM3tlFZGSPcsoM5SVUXZ2ocgOmSUj76+Lm3OsZEb/HR5d93iPp8fnAyn3+JzyqlfpoddxoeC6n0QkkJJYtgNkHCqVIpU9CguMTG2gLywFHL+Z3wuPLXHqdpmgKlVAyuuv0GgFjYjpjRpIXJlgFbqQunv49Qk08nbfgxOy+OsW1DzWlzzBK9ivh5pzfyFkDH4o7fFfr/8k4J/7VyFz7V7sQr7eA5x4xrpNwHsx16V820o49lIg6jIHJ+ibSMQ+AcjcpkkS+0zAubNGRC4A3k2VjH8cITvw/FfGXHDM2MZU6HF1gpy+OU4pBma9IeemgFrGchNkbrAOqFnQwUPwauff4MzT5VEznBcn7DlCo32r1xZSUcSiIWE9vPrZF2e0k1SbuTjnZqdIxQFaOGEU1bYznQiO4XNSfR+qTkvOaiaRPoRDzqdokIgYI2qJ0cGlHQE0EGWmZ0WkvQAAAABJRU5ErkJggg==";

var playOnce$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAgCAMAAAA2a+hwAAAAAXNSR0IArs4c6QAAAlJQTFRFAAAAgID/QID/QID/OY7jRovoO4nrSZLtRIjuPIfwQIzyQJnySZLzRpfzQ4X0QIrqQo7sPo3tEN73RI/wPI3yQZDrPo/sQ4ztQ4zzO4jtQY7tPo7uPYvuQI/vOY3vPo3vPIzrQZHwNqL1QI7wRYTrK4b2QY/uP47uR47yQIvvP43rQI/wP5DwSXz0QozuPYvxQY/uQI3uQY3vQI/yQZDzQpDwQ472QI3uPIn3P4vqQo7vQo3tQI3uQJDuQI7uQI3uQI7sQo7sQpHxQY3sPo7vQI7tQI/xQY7tQY3tQY3vPo7vQo/rP5HuQY3uQJDxQorsQo7sQo7vOI3xQovrQo3rQY7tQY3tQI7tQI3sPY/wN5vvQo7vNKPyQY7tQ43tQY/uQorsQI7sQY3uPJfwQI7wPpPuP4/vQY7tTnTsRJPxP47vQYzsPZDvP43uQo7sO5jvQY3uPZDwQ4ftQI7tQo3uQY7uQo7uQY7tQY7tQ43wQY7tQI3tQI7uQI7tQI/wP4zuQ5DtQY7tRJHsQI7tQY7tQI7tQY7uQI7uQY3uQo7tPpHtQI7tQY/sQY7sQY/tQY7tQY7tQY3sQY/uQI7tQY7tQo7uQo/uSY7tQY/tTXnqQY3tQY7tQY7tQY7tQY7tQY7uQY7tPZXtQY3tQY7tQY7tQY7tQo/tP5LqQI/rQI/sQY3sQY7rQY7sQY7tQY/rQY/sQY/tQZDtQozsQo3rQo3sQo3tQo7qQo7rQo7sQo7tQo/tQ4vsQ4zrQ47qQ47sRIfrRInsRI/rRI/sRYnsR4TqR4fqvnKd/wAAAKd0Uk5TAAIECAkLDQ4PERQUFRYXGBsdHyImJykqKisrLS4wMTEzMzQ0NDs7PT1AQURFRklLS0xOUFNVWFxdYWFlZ2doa2xsbW5vb3BxcnJzdHl5fHx8fH+AgIGCg4iJjIyOjpGSkpOUlZeZm56goaKio6OjpKaqqq6vsLO0t7i5vL7GxsfHyMjLy8zN0tTW2trc4ubn6erq7Ozs7Ozu7vHz9Pb3+Pn6+/v9/v6utNnsAAABnklEQVQYGY3BhVsTcQDH4c8QRbCwu7tbVFQsPLu7u3t2YRfYXRhg7r4GMnYzMPm/nLf7nTjkeXxf/lv7I3OoVP+IllCpvg80l39rNiTrkrQymQpqTD4rV7QriabkRx3tnXdP9tQqkDGAP1IPKXw6qy7ZciYCqbLnY6RdkDKBUVI2MUlL39jr8eQV3elATKdTI4kb+6FsMa7NZY/rkWDw8589ielS8qU3FWwquRoAcu0N+Opg3AxNgFalr2rhSd/3qBuece8vwszvOXjGFEiz8dQOC46GRuNK3iMVaDzG+TBct3vgSpGGrpOFse0rPH3blLhGrdkqC2P5OyhUQ3y7ZWEs/AG31RlfUBbGmiLIdQbiC8rC2P8SNkaW4QvKwrgfhkGhu/h2aRKedsVhqGnb/TAOazqend8OAit0BWP4ycbEdXxR2hJIeRJZS6LArc87+K2Xo2n8Len46xsBXAs+fVxFeU3OhJ61wTNL0XPdMarOkPOwLb7M/GIdGNE8rVr1+n1WX3OcYw0oJ32LnKhcjvKGkaDFohOFirm8PQPPL6EvjEOwGD5qAAAAAElFTkSuQmCC";

var recStartIcon = "data:image/png;base64,[encoded data, 6904 characters]";

var recStopIcon = "data:image/png;base64,[encoded data, 7504 characters]";

var recDelete = "data:image/png;base64,[encoded data, 4368 characters]";

var recMockWave = "data:image/png;base64,[encoded data, 4992 characters]";

var core = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory();
  }
})(commonjsGlobal, function () {
  /*globals window, global, require*/

  /**
   * CryptoJS core components.
   */
  var CryptoJS = CryptoJS || function (Math, undefined$1) {
    var crypto$1;

    // Native crypto from window (Browser)
    if (typeof window !== 'undefined' && window.crypto) {
      crypto$1 = window.crypto;
    }

    // Native crypto in web worker (Browser)
    if (typeof self !== 'undefined' && self.crypto) {
      crypto$1 = self.crypto;
    }

    // Native crypto from worker
    if (typeof globalThis !== 'undefined' && globalThis.crypto) {
      crypto$1 = globalThis.crypto;
    }

    // Native (experimental IE 11) crypto from window (Browser)
    if (!crypto$1 && typeof window !== 'undefined' && window.msCrypto) {
      crypto$1 = window.msCrypto;
    }

    // Native crypto from global (NodeJS)
    if (!crypto$1 && typeof commonjsGlobal !== 'undefined' && commonjsGlobal.crypto) {
      crypto$1 = commonjsGlobal.crypto;
    }

    // Native crypto import via require (NodeJS)
    if (!crypto$1 && typeof commonjsRequire === 'function') {
      try {
        crypto$1 = crypto;
      } catch (err) {}
    }

    /*
     * Cryptographically secure pseudorandom number generator
     *
     * As Math.random() is cryptographically not safe to use
     */
    var cryptoSecureRandomInt = function () {
      if (crypto$1) {
        // Use getRandomValues method (Browser)
        if (typeof crypto$1.getRandomValues === 'function') {
          try {
            return crypto$1.getRandomValues(new Uint32Array(1))[0];
          } catch (err) {}
        }

        // Use randomBytes method (NodeJS)
        if (typeof crypto$1.randomBytes === 'function') {
          try {
            return crypto$1.randomBytes(4).readInt32LE();
          } catch (err) {}
        }
      }
      throw new Error('Native crypto module could not be used to get secure random number.');
    };

    /*
     * Local polyfill of Object.create
      */
    var create = Object.create || function () {
      function F() {}
      return function (obj) {
        var subtype;
        F.prototype = obj;
        subtype = new F();
        F.prototype = null;
        return subtype;
      };
    }();

    /**
     * CryptoJS namespace.
     */
    var C = {};

    /**
     * Library namespace.
     */
    var C_lib = C.lib = {};

    /**
     * Base object for prototypal inheritance.
     */
    var Base = C_lib.Base = function () {
      return {
        /**
         * Creates a new object that inherits from this object.
         *
         * @param {Object} overrides Properties to copy into the new object.
         *
         * @return {Object} The new object.
         *
         * @static
         *
         * @example
         *
         *     var MyType = CryptoJS.lib.Base.extend({
         *         field: 'value',
         *
         *         method: function () {
         *         }
         *     });
         */
        extend: function (overrides) {
          // Spawn
          var subtype = create(this);

          // Augment
          if (overrides) {
            subtype.mixIn(overrides);
          }

          // Create default initializer
          if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
            subtype.init = function () {
              subtype.$super.init.apply(this, arguments);
            };
          }

          // Initializer's prototype is the subtype object
          subtype.init.prototype = subtype;

          // Reference supertype
          subtype.$super = this;
          return subtype;
        },
        /**
         * Extends this object and runs the init method.
         * Arguments to create() will be passed to init().
         *
         * @return {Object} The new object.
         *
         * @static
         *
         * @example
         *
         *     var instance = MyType.create();
         */
        create: function () {
          var instance = this.extend();
          instance.init.apply(instance, arguments);
          return instance;
        },
        /**
         * Initializes a newly created object.
         * Override this method to add some logic when your objects are created.
         *
         * @example
         *
         *     var MyType = CryptoJS.lib.Base.extend({
         *         init: function () {
         *             // ...
         *         }
         *     });
         */
        init: function () {},
        /**
         * Copies properties into this object.
         *
         * @param {Object} properties The properties to mix in.
         *
         * @example
         *
         *     MyType.mixIn({
         *         field: 'value'
         *     });
         */
        mixIn: function (properties) {
          for (var propertyName in properties) {
            if (properties.hasOwnProperty(propertyName)) {
              this[propertyName] = properties[propertyName];
            }
          }

          // IE won't copy toString using the loop above
          if (properties.hasOwnProperty('toString')) {
            this.toString = properties.toString;
          }
        },
        /**
         * Creates a copy of this object.
         *
         * @return {Object} The clone.
         *
         * @example
         *
         *     var clone = instance.clone();
         */
        clone: function () {
          return this.init.prototype.extend(this);
        }
      };
    }();

    /**
     * An array of 32-bit words.
     *
     * @property {Array} words The array of 32-bit words.
     * @property {number} sigBytes The number of significant bytes in this word array.
     */
    var WordArray = C_lib.WordArray = Base.extend({
      /**
       * Initializes a newly created word array.
       *
       * @param {Array} words (Optional) An array of 32-bit words.
       * @param {number} sigBytes (Optional) The number of significant bytes in the words.
       *
       * @example
       *
       *     var wordArray = CryptoJS.lib.WordArray.create();
       *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
       *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
       */
      init: function (words, sigBytes) {
        words = this.words = words || [];
        if (sigBytes != undefined$1) {
          this.sigBytes = sigBytes;
        } else {
          this.sigBytes = words.length * 4;
        }
      },
      /**
       * Converts this word array to a string.
       *
       * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
       *
       * @return {string} The stringified word array.
       *
       * @example
       *
       *     var string = wordArray + '';
       *     var string = wordArray.toString();
       *     var string = wordArray.toString(CryptoJS.enc.Utf8);
       */
      toString: function (encoder) {
        return (encoder || Hex).stringify(this);
      },
      /**
       * Concatenates a word array to this word array.
       *
       * @param {WordArray} wordArray The word array to append.
       *
       * @return {WordArray} This word array.
       *
       * @example
       *
       *     wordArray1.concat(wordArray2);
       */
      concat: function (wordArray) {
        // Shortcuts
        var thisWords = this.words;
        var thatWords = wordArray.words;
        var thisSigBytes = this.sigBytes;
        var thatSigBytes = wordArray.sigBytes;

        // Clamp excess bits
        this.clamp();

        // Concat
        if (thisSigBytes % 4) {
          // Copy one byte at a time
          for (var i = 0; i < thatSigBytes; i++) {
            var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
            thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8;
          }
        } else {
          // Copy one word at a time
          for (var j = 0; j < thatSigBytes; j += 4) {
            thisWords[thisSigBytes + j >>> 2] = thatWords[j >>> 2];
          }
        }
        this.sigBytes += thatSigBytes;

        // Chainable
        return this;
      },
      /**
       * Removes insignificant bits.
       *
       * @example
       *
       *     wordArray.clamp();
       */
      clamp: function () {
        // Shortcuts
        var words = this.words;
        var sigBytes = this.sigBytes;

        // Clamp
        words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8;
        words.length = Math.ceil(sigBytes / 4);
      },
      /**
       * Creates a copy of this word array.
       *
       * @return {WordArray} The clone.
       *
       * @example
       *
       *     var clone = wordArray.clone();
       */
      clone: function () {
        var clone = Base.clone.call(this);
        clone.words = this.words.slice(0);
        return clone;
      },
      /**
       * Creates a word array filled with random bytes.
       *
       * @param {number} nBytes The number of random bytes to generate.
       *
       * @return {WordArray} The random word array.
       *
       * @static
       *
       * @example
       *
       *     var wordArray = CryptoJS.lib.WordArray.random(16);
       */
      random: function (nBytes) {
        var words = [];
        for (var i = 0; i < nBytes; i += 4) {
          words.push(cryptoSecureRandomInt());
        }
        return new WordArray.init(words, nBytes);
      }
    });

    /**
     * Encoder namespace.
     */
    var C_enc = C.enc = {};

    /**
     * Hex encoding strategy.
     */
    var Hex = C_enc.Hex = {
      /**
       * Converts a word array to a hex string.
       *
       * @param {WordArray} wordArray The word array.
       *
       * @return {string} The hex string.
       *
       * @static
       *
       * @example
       *
       *     var hexString = CryptoJS.enc.Hex.stringify(wordArray);
       */
      stringify: function (wordArray) {
        // Shortcuts
        var words = wordArray.words;
        var sigBytes = wordArray.sigBytes;

        // Convert
        var hexChars = [];
        for (var i = 0; i < sigBytes; i++) {
          var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
          hexChars.push((bite >>> 4).toString(16));
          hexChars.push((bite & 0x0f).toString(16));
        }
        return hexChars.join('');
      },
      /**
       * Converts a hex string to a word array.
       *
       * @param {string} hexStr The hex string.
       *
       * @return {WordArray} The word array.
       *
       * @static
       *
       * @example
       *
       *     var wordArray = CryptoJS.enc.Hex.parse(hexString);
       */
      parse: function (hexStr) {
        // Shortcut
        var hexStrLength = hexStr.length;

        // Convert
        var words = [];
        for (var i = 0; i < hexStrLength; i += 2) {
          words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4;
        }
        return new WordArray.init(words, hexStrLength / 2);
      }
    };

    /**
     * Latin1 encoding strategy.
     */
    var Latin1 = C_enc.Latin1 = {
      /**
       * Converts a word array to a Latin1 string.
       *
       * @param {WordArray} wordArray The word array.
       *
       * @return {string} The Latin1 string.
       *
       * @static
       *
       * @example
       *
       *     var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
       */
      stringify: function (wordArray) {
        // Shortcuts
        var words = wordArray.words;
        var sigBytes = wordArray.sigBytes;

        // Convert
        var latin1Chars = [];
        for (var i = 0; i < sigBytes; i++) {
          var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
          latin1Chars.push(String.fromCharCode(bite));
        }
        return latin1Chars.join('');
      },
      /**
       * Converts a Latin1 string to a word array.
       *
       * @param {string} latin1Str The Latin1 string.
       *
       * @return {WordArray} The word array.
       *
       * @static
       *
       * @example
       *
       *     var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
       */
      parse: function (latin1Str) {
        // Shortcut
        var latin1StrLength = latin1Str.length;

        // Convert
        var words = [];
        for (var i = 0; i < latin1StrLength; i++) {
          words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8;
        }
        return new WordArray.init(words, latin1StrLength);
      }
    };

    /**
     * UTF-8 encoding strategy.
     */
    var Utf8 = C_enc.Utf8 = {
      /**
       * Converts a word array to a UTF-8 string.
       *
       * @param {WordArray} wordArray The word array.
       *
       * @return {string} The UTF-8 string.
       *
       * @static
       *
       * @example
       *
       *     var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
       */
      stringify: function (wordArray) {
        try {
          return decodeURIComponent(escape(Latin1.stringify(wordArray)));
        } catch (e) {
          throw new Error('Malformed UTF-8 data');
        }
      },
      /**
       * Converts a UTF-8 string to a word array.
       *
       * @param {string} utf8Str The UTF-8 string.
       *
       * @return {WordArray} The word array.
       *
       * @static
       *
       * @example
       *
       *     var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
       */
      parse: function (utf8Str) {
        return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
      }
    };

    /**
     * Abstract buffered block algorithm template.
     *
     * The property blockSize must be implemented in a concrete subtype.
     *
     * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
     */
    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
      /**
       * Resets this block algorithm's data buffer to its initial state.
       *
       * @example
       *
       *     bufferedBlockAlgorithm.reset();
       */
      reset: function () {
        // Initial values
        this._data = new WordArray.init();
        this._nDataBytes = 0;
      },
      /**
       * Adds new data to this block algorithm's buffer.
       *
       * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
       *
       * @example
       *
       *     bufferedBlockAlgorithm._append('data');
       *     bufferedBlockAlgorithm._append(wordArray);
       */
      _append: function (data) {
        // Convert string to WordArray, else assume WordArray already
        if (typeof data == 'string') {
          data = Utf8.parse(data);
        }

        // Append
        this._data.concat(data);
        this._nDataBytes += data.sigBytes;
      },
      /**
       * Processes available data blocks.
       *
       * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
       *
       * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
       *
       * @return {WordArray} The processed data.
       *
       * @example
       *
       *     var processedData = bufferedBlockAlgorithm._process();
       *     var processedData = bufferedBlockAlgorithm._process(!!'flush');
       */
      _process: function (doFlush) {
        var processedWords;

        // Shortcuts
        var data = this._data;
        var dataWords = data.words;
        var dataSigBytes = data.sigBytes;
        var blockSize = this.blockSize;
        var blockSizeBytes = blockSize * 4;

        // Count blocks ready
        var nBlocksReady = dataSigBytes / blockSizeBytes;
        if (doFlush) {
          // Round up to include partial blocks
          nBlocksReady = Math.ceil(nBlocksReady);
        } else {
          // Round down to include only full blocks,
          // less the number of blocks that must remain in the buffer
          nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
        }

        // Count words ready
        var nWordsReady = nBlocksReady * blockSize;

        // Count bytes ready
        var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);

        // Process blocks
        if (nWordsReady) {
          for (var offset = 0; offset < nWordsReady; offset += blockSize) {
            // Perform concrete-algorithm logic
            this._doProcessBlock(dataWords, offset);
          }

          // Remove processed words
          processedWords = dataWords.splice(0, nWordsReady);
          data.sigBytes -= nBytesReady;
        }

        // Return processed words
        return new WordArray.init(processedWords, nBytesReady);
      },
      /**
       * Creates a copy of this object.
       *
       * @return {Object} The clone.
       *
       * @example
       *
       *     var clone = bufferedBlockAlgorithm.clone();
       */
      clone: function () {
        var clone = Base.clone.call(this);
        clone._data = this._data.clone();
        return clone;
      },
      _minBufferSize: 0
    });

    /**
     * Abstract hasher template.
     *
     * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
     */
    C_lib.Hasher = BufferedBlockAlgorithm.extend({
      /**
       * Configuration options.
       */
      cfg: Base.extend(),
      /**
       * Initializes a newly created hasher.
       *
       * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
       *
       * @example
       *
       *     var hasher = CryptoJS.algo.SHA256.create();
       */
      init: function (cfg) {
        // Apply config defaults
        this.cfg = this.cfg.extend(cfg);

        // Set initial values
        this.reset();
      },
      /**
       * Resets this hasher to its initial state.
       *
       * @example
       *
       *     hasher.reset();
       */
      reset: function () {
        // Reset data buffer
        BufferedBlockAlgorithm.reset.call(this);

        // Perform concrete-hasher logic
        this._doReset();
      },
      /**
       * Updates this hasher with a message.
       *
       * @param {WordArray|string} messageUpdate The message to append.
       *
       * @return {Hasher} This hasher.
       *
       * @example
       *
       *     hasher.update('message');
       *     hasher.update(wordArray);
       */
      update: function (messageUpdate) {
        // Append
        this._append(messageUpdate);

        // Update the hash
        this._process();

        // Chainable
        return this;
      },
      /**
       * Finalizes the hash computation.
       * Note that the finalize operation is effectively a destructive, read-once operation.
       *
       * @param {WordArray|string} messageUpdate (Optional) A final message update.
       *
       * @return {WordArray} The hash.
       *
       * @example
       *
       *     var hash = hasher.finalize();
       *     var hash = hasher.finalize('message');
       *     var hash = hasher.finalize(wordArray);
       */
      finalize: function (messageUpdate) {
        // Final message update
        if (messageUpdate) {
          this._append(messageUpdate);
        }

        // Perform concrete-hasher logic
        var hash = this._doFinalize();
        return hash;
      },
      blockSize: 512 / 32,
      /**
       * Creates a shortcut function to a hasher's object interface.
       *
       * @param {Hasher} hasher The hasher to create a helper for.
       *
       * @return {Function} The shortcut function.
       *
       * @static
       *
       * @example
       *
       *     var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
       */
      _createHelper: function (hasher) {
        return function (message, cfg) {
          return new hasher.init(cfg).finalize(message);
        };
      },
      /**
       * Creates a shortcut function to the HMAC's object interface.
       *
       * @param {Hasher} hasher The hasher to use in this HMAC helper.
       *
       * @return {Function} The shortcut function.
       *
       * @static
       *
       * @example
       *
       *     var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
       */
      _createHmacHelper: function (hasher) {
        return function (message, key) {
          return new C_algo.HMAC.init(hasher, key).finalize(message);
        };
      }
    });

    /**
     * Algorithm namespace.
     */
    var C_algo = C.algo = {};
    return C;
  }(Math);
  return CryptoJS;
});
});

var x64Core = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function (undefined$1) {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var Base = C_lib.Base;
    var X32WordArray = C_lib.WordArray;

    /**
     * x64 namespace.
     */
    var C_x64 = C.x64 = {};

    /**
     * A 64-bit word.
     */
    C_x64.Word = Base.extend({
      /**
       * Initializes a newly created 64-bit word.
       *
       * @param {number} high The high 32 bits.
       * @param {number} low The low 32 bits.
       *
       * @example
       *
       *     var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
       */
      init: function (high, low) {
        this.high = high;
        this.low = low;
      }

      /**
       * Bitwise NOTs this word.
       *
       * @return {X64Word} A new x64-Word object after negating.
       *
       * @example
       *
       *     var negated = x64Word.not();
       */
      // not: function () {
      // var high = ~this.high;
      // var low = ~this.low;

      // return X64Word.create(high, low);
      // },

      /**
       * Bitwise ANDs this word with the passed word.
       *
       * @param {X64Word} word The x64-Word to AND with this word.
       *
       * @return {X64Word} A new x64-Word object after ANDing.
       *
       * @example
       *
       *     var anded = x64Word.and(anotherX64Word);
       */
      // and: function (word) {
      // var high = this.high & word.high;
      // var low = this.low & word.low;

      // return X64Word.create(high, low);
      // },

      /**
       * Bitwise ORs this word with the passed word.
       *
       * @param {X64Word} word The x64-Word to OR with this word.
       *
       * @return {X64Word} A new x64-Word object after ORing.
       *
       * @example
       *
       *     var ored = x64Word.or(anotherX64Word);
       */
      // or: function (word) {
      // var high = this.high | word.high;
      // var low = this.low | word.low;

      // return X64Word.create(high, low);
      // },

      /**
       * Bitwise XORs this word with the passed word.
       *
       * @param {X64Word} word The x64-Word to XOR with this word.
       *
       * @return {X64Word} A new x64-Word object after XORing.
       *
       * @example
       *
       *     var xored = x64Word.xor(anotherX64Word);
       */
      // xor: function (word) {
      // var high = this.high ^ word.high;
      // var low = this.low ^ word.low;

      // return X64Word.create(high, low);
      // },

      /**
       * Shifts this word n bits to the left.
       *
       * @param {number} n The number of bits to shift.
       *
       * @return {X64Word} A new x64-Word object after shifting.
       *
       * @example
       *
       *     var shifted = x64Word.shiftL(25);
       */
      // shiftL: function (n) {
      // if (n < 32) {
      // var high = (this.high << n) | (this.low >>> (32 - n));
      // var low = this.low << n;
      // } else {
      // var high = this.low << (n - 32);
      // var low = 0;
      // }

      // return X64Word.create(high, low);
      // },

      /**
       * Shifts this word n bits to the right.
       *
       * @param {number} n The number of bits to shift.
       *
       * @return {X64Word} A new x64-Word object after shifting.
       *
       * @example
       *
       *     var shifted = x64Word.shiftR(7);
       */
      // shiftR: function (n) {
      // if (n < 32) {
      // var low = (this.low >>> n) | (this.high << (32 - n));
      // var high = this.high >>> n;
      // } else {
      // var low = this.high >>> (n - 32);
      // var high = 0;
      // }

      // return X64Word.create(high, low);
      // },

      /**
       * Rotates this word n bits to the left.
       *
       * @param {number} n The number of bits to rotate.
       *
       * @return {X64Word} A new x64-Word object after rotating.
       *
       * @example
       *
       *     var rotated = x64Word.rotL(25);
       */
      // rotL: function (n) {
      // return this.shiftL(n).or(this.shiftR(64 - n));
      // },

      /**
       * Rotates this word n bits to the right.
       *
       * @param {number} n The number of bits to rotate.
       *
       * @return {X64Word} A new x64-Word object after rotating.
       *
       * @example
       *
       *     var rotated = x64Word.rotR(7);
       */
      // rotR: function (n) {
      // return this.shiftR(n).or(this.shiftL(64 - n));
      // },

      /**
       * Adds this word with the passed word.
       *
       * @param {X64Word} word The x64-Word to add with this word.
       *
       * @return {X64Word} A new x64-Word object after adding.
       *
       * @example
       *
       *     var added = x64Word.add(anotherX64Word);
       */
      // add: function (word) {
      // var low = (this.low + word.low) | 0;
      // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
      // var high = (this.high + word.high + carry) | 0;

      // return X64Word.create(high, low);
      // }
    });

    /**
     * An array of 64-bit words.
     *
     * @property {Array} words The array of CryptoJS.x64.Word objects.
     * @property {number} sigBytes The number of significant bytes in this word array.
     */
    C_x64.WordArray = Base.extend({
      /**
       * Initializes a newly created word array.
       *
       * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
       * @param {number} sigBytes (Optional) The number of significant bytes in the words.
       *
       * @example
       *
       *     var wordArray = CryptoJS.x64.WordArray.create();
       *
       *     var wordArray = CryptoJS.x64.WordArray.create([
       *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
       *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
       *     ]);
       *
       *     var wordArray = CryptoJS.x64.WordArray.create([
       *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
       *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
       *     ], 10);
       */
      init: function (words, sigBytes) {
        words = this.words = words || [];
        if (sigBytes != undefined$1) {
          this.sigBytes = sigBytes;
        } else {
          this.sigBytes = words.length * 8;
        }
      },
      /**
       * Converts this 64-bit word array to a 32-bit word array.
       *
       * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
       *
       * @example
       *
       *     var x32WordArray = x64WordArray.toX32();
       */
      toX32: function () {
        // Shortcuts
        var x64Words = this.words;
        var x64WordsLength = x64Words.length;

        // Convert
        var x32Words = [];
        for (var i = 0; i < x64WordsLength; i++) {
          var x64Word = x64Words[i];
          x32Words.push(x64Word.high);
          x32Words.push(x64Word.low);
        }
        return X32WordArray.create(x32Words, this.sigBytes);
      },
      /**
       * Creates a copy of this word array.
       *
       * @return {X64WordArray} The clone.
       *
       * @example
       *
       *     var clone = x64WordArray.clone();
       */
      clone: function () {
        var clone = Base.clone.call(this);

        // Clone "words" array
        var words = clone.words = this.words.slice(0);

        // Clone each X64Word object
        var wordsLength = words.length;
        for (var i = 0; i < wordsLength; i++) {
          words[i] = words[i].clone();
        }
        return clone;
      }
    });
  })();
  return CryptoJS;
});
});

var libTypedarrays = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Check if typed arrays are supported
    if (typeof ArrayBuffer != 'function') {
      return;
    }

    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;

    // Reference original init
    var superInit = WordArray.init;

    // Augment WordArray.init to handle typed arrays
    var subInit = WordArray.init = function (typedArray) {
      // Convert buffers to uint8
      if (typedArray instanceof ArrayBuffer) {
        typedArray = new Uint8Array(typedArray);
      }

      // Convert other array views to uint8
      if (typedArray instanceof Int8Array || typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray || typedArray instanceof Int16Array || typedArray instanceof Uint16Array || typedArray instanceof Int32Array || typedArray instanceof Uint32Array || typedArray instanceof Float32Array || typedArray instanceof Float64Array) {
        typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
      }

      // Handle Uint8Array
      if (typedArray instanceof Uint8Array) {
        // Shortcut
        var typedArrayByteLength = typedArray.byteLength;

        // Extract bytes
        var words = [];
        for (var i = 0; i < typedArrayByteLength; i++) {
          words[i >>> 2] |= typedArray[i] << 24 - i % 4 * 8;
        }

        // Initialize this word array
        superInit.call(this, words, typedArrayByteLength);
      } else {
        // Else call normal init
        superInit.apply(this, arguments);
      }
    };
    subInit.prototype = WordArray;
  })();
  return CryptoJS.lib.WordArray;
});
});

var encUtf16 = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var C_enc = C.enc;

    /**
     * UTF-16 BE encoding strategy.
     */
    C_enc.Utf16 = C_enc.Utf16BE = {
      /**
       * Converts a word array to a UTF-16 BE string.
       *
       * @param {WordArray} wordArray The word array.
       *
       * @return {string} The UTF-16 BE string.
       *
       * @static
       *
       * @example
       *
       *     var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
       */
      stringify: function (wordArray) {
        // Shortcuts
        var words = wordArray.words;
        var sigBytes = wordArray.sigBytes;

        // Convert
        var utf16Chars = [];
        for (var i = 0; i < sigBytes; i += 2) {
          var codePoint = words[i >>> 2] >>> 16 - i % 4 * 8 & 0xffff;
          utf16Chars.push(String.fromCharCode(codePoint));
        }
        return utf16Chars.join('');
      },
      /**
       * Converts a UTF-16 BE string to a word array.
       *
       * @param {string} utf16Str The UTF-16 BE string.
       *
       * @return {WordArray} The word array.
       *
       * @static
       *
       * @example
       *
       *     var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
       */
      parse: function (utf16Str) {
        // Shortcut
        var utf16StrLength = utf16Str.length;

        // Convert
        var words = [];
        for (var i = 0; i < utf16StrLength; i++) {
          words[i >>> 1] |= utf16Str.charCodeAt(i) << 16 - i % 2 * 16;
        }
        return WordArray.create(words, utf16StrLength * 2);
      }
    };

    /**
     * UTF-16 LE encoding strategy.
     */
    C_enc.Utf16LE = {
      /**
       * Converts a word array to a UTF-16 LE string.
       *
       * @param {WordArray} wordArray The word array.
       *
       * @return {string} The UTF-16 LE string.
       *
       * @static
       *
       * @example
       *
       *     var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
       */
      stringify: function (wordArray) {
        // Shortcuts
        var words = wordArray.words;
        var sigBytes = wordArray.sigBytes;

        // Convert
        var utf16Chars = [];
        for (var i = 0; i < sigBytes; i += 2) {
          var codePoint = swapEndian(words[i >>> 2] >>> 16 - i % 4 * 8 & 0xffff);
          utf16Chars.push(String.fromCharCode(codePoint));
        }
        return utf16Chars.join('');
      },
      /**
       * Converts a UTF-16 LE string to a word array.
       *
       * @param {string} utf16Str The UTF-16 LE string.
       *
       * @return {WordArray} The word array.
       *
       * @static
       *
       * @example
       *
       *     var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
       */
      parse: function (utf16Str) {
        // Shortcut
        var utf16StrLength = utf16Str.length;

        // Convert
        var words = [];
        for (var i = 0; i < utf16StrLength; i++) {
          words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << 16 - i % 2 * 16);
        }
        return WordArray.create(words, utf16StrLength * 2);
      }
    };
    function swapEndian(word) {
      return word << 8 & 0xff00ff00 | word >>> 8 & 0x00ff00ff;
    }
  })();
  return CryptoJS.enc.Utf16;
});
});

var encBase64 = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var C_enc = C.enc;

    /**
     * Base64 encoding strategy.
     */
    C_enc.Base64 = {
      /**
       * Converts a word array to a Base64 string.
       *
       * @param {WordArray} wordArray The word array.
       *
       * @return {string} The Base64 string.
       *
       * @static
       *
       * @example
       *
       *     var base64String = CryptoJS.enc.Base64.stringify(wordArray);
       */
      stringify: function (wordArray) {
        // Shortcuts
        var words = wordArray.words;
        var sigBytes = wordArray.sigBytes;
        var map = this._map;

        // Clamp excess bits
        wordArray.clamp();

        // Convert
        var base64Chars = [];
        for (var i = 0; i < sigBytes; i += 3) {
          var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
          var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff;
          var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff;
          var triplet = byte1 << 16 | byte2 << 8 | byte3;
          for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {
            base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f));
          }
        }

        // Add padding
        var paddingChar = map.charAt(64);
        if (paddingChar) {
          while (base64Chars.length % 4) {
            base64Chars.push(paddingChar);
          }
        }
        return base64Chars.join('');
      },
      /**
       * Converts a Base64 string to a word array.
       *
       * @param {string} base64Str The Base64 string.
       *
       * @return {WordArray} The word array.
       *
       * @static
       *
       * @example
       *
       *     var wordArray = CryptoJS.enc.Base64.parse(base64String);
       */
      parse: function (base64Str) {
        // Shortcuts
        var base64StrLength = base64Str.length;
        var map = this._map;
        var reverseMap = this._reverseMap;
        if (!reverseMap) {
          reverseMap = this._reverseMap = [];
          for (var j = 0; j < map.length; j++) {
            reverseMap[map.charCodeAt(j)] = j;
          }
        }

        // Ignore padding
        var paddingChar = map.charAt(64);
        if (paddingChar) {
          var paddingIndex = base64Str.indexOf(paddingChar);
          if (paddingIndex !== -1) {
            base64StrLength = paddingIndex;
          }
        }

        // Convert
        return parseLoop(base64Str, base64StrLength, reverseMap);
      },
      _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
    };
    function parseLoop(base64Str, base64StrLength, reverseMap) {
      var words = [];
      var nBytes = 0;
      for (var i = 0; i < base64StrLength; i++) {
        if (i % 4) {
          var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2;
          var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2;
          var bitsCombined = bits1 | bits2;
          words[nBytes >>> 2] |= bitsCombined << 24 - nBytes % 4 * 8;
          nBytes++;
        }
      }
      return WordArray.create(words, nBytes);
    }
  })();
  return CryptoJS.enc.Base64;
});
});

var encBase64url = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var C_enc = C.enc;

    /**
     * Base64url encoding strategy.
     */
    C_enc.Base64url = {
      /**
       * Converts a word array to a Base64url string.
       *
       * @param {WordArray} wordArray The word array.
       *
       * @param {boolean} urlSafe Whether to use url safe
       *
       * @return {string} The Base64url string.
       *
       * @static
       *
       * @example
       *
       *     var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
       */
      stringify: function (wordArray, urlSafe) {
        if (urlSafe === undefined) {
          urlSafe = true;
        }
        // Shortcuts
        var words = wordArray.words;
        var sigBytes = wordArray.sigBytes;
        var map = urlSafe ? this._safe_map : this._map;

        // Clamp excess bits
        wordArray.clamp();

        // Convert
        var base64Chars = [];
        for (var i = 0; i < sigBytes; i += 3) {
          var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
          var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff;
          var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff;
          var triplet = byte1 << 16 | byte2 << 8 | byte3;
          for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {
            base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f));
          }
        }

        // Add padding
        var paddingChar = map.charAt(64);
        if (paddingChar) {
          while (base64Chars.length % 4) {
            base64Chars.push(paddingChar);
          }
        }
        return base64Chars.join('');
      },
      /**
       * Converts a Base64url string to a word array.
       *
       * @param {string} base64Str The Base64url string.
       *
       * @param {boolean} urlSafe Whether to use url safe
       *
       * @return {WordArray} The word array.
       *
       * @static
       *
       * @example
       *
       *     var wordArray = CryptoJS.enc.Base64url.parse(base64String);
       */
      parse: function (base64Str, urlSafe) {
        if (urlSafe === undefined) {
          urlSafe = true;
        }

        // Shortcuts
        var base64StrLength = base64Str.length;
        var map = urlSafe ? this._safe_map : this._map;
        var reverseMap = this._reverseMap;
        if (!reverseMap) {
          reverseMap = this._reverseMap = [];
          for (var j = 0; j < map.length; j++) {
            reverseMap[map.charCodeAt(j)] = j;
          }
        }

        // Ignore padding
        var paddingChar = map.charAt(64);
        if (paddingChar) {
          var paddingIndex = base64Str.indexOf(paddingChar);
          if (paddingIndex !== -1) {
            base64StrLength = paddingIndex;
          }
        }

        // Convert
        return parseLoop(base64Str, base64StrLength, reverseMap);
      },
      _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
      _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
    };
    function parseLoop(base64Str, base64StrLength, reverseMap) {
      var words = [];
      var nBytes = 0;
      for (var i = 0; i < base64StrLength; i++) {
        if (i % 4) {
          var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2;
          var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2;
          var bitsCombined = bits1 | bits2;
          words[nBytes >>> 2] |= bitsCombined << 24 - nBytes % 4 * 8;
          nBytes++;
        }
      }
      return WordArray.create(words, nBytes);
    }
  })();
  return CryptoJS.enc.Base64url;
});
});

var md5 = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function (Math) {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var Hasher = C_lib.Hasher;
    var C_algo = C.algo;

    // Constants table
    var T = [];

    // Compute constants
    (function () {
      for (var i = 0; i < 64; i++) {
        T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0;
      }
    })();

    /**
     * MD5 hash algorithm.
     */
    var MD5 = C_algo.MD5 = Hasher.extend({
      _doReset: function () {
        this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]);
      },
      _doProcessBlock: function (M, offset) {
        // Swap endian
        for (var i = 0; i < 16; i++) {
          // Shortcuts
          var offset_i = offset + i;
          var M_offset_i = M[offset_i];
          M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00;
        }

        // Shortcuts
        var H = this._hash.words;
        var M_offset_0 = M[offset + 0];
        var M_offset_1 = M[offset + 1];
        var M_offset_2 = M[offset + 2];
        var M_offset_3 = M[offset + 3];
        var M_offset_4 = M[offset + 4];
        var M_offset_5 = M[offset + 5];
        var M_offset_6 = M[offset + 6];
        var M_offset_7 = M[offset + 7];
        var M_offset_8 = M[offset + 8];
        var M_offset_9 = M[offset + 9];
        var M_offset_10 = M[offset + 10];
        var M_offset_11 = M[offset + 11];
        var M_offset_12 = M[offset + 12];
        var M_offset_13 = M[offset + 13];
        var M_offset_14 = M[offset + 14];
        var M_offset_15 = M[offset + 15];

        // Working variables
        var a = H[0];
        var b = H[1];
        var c = H[2];
        var d = H[3];

        // Computation
        a = FF(a, b, c, d, M_offset_0, 7, T[0]);
        d = FF(d, a, b, c, M_offset_1, 12, T[1]);
        c = FF(c, d, a, b, M_offset_2, 17, T[2]);
        b = FF(b, c, d, a, M_offset_3, 22, T[3]);
        a = FF(a, b, c, d, M_offset_4, 7, T[4]);
        d = FF(d, a, b, c, M_offset_5, 12, T[5]);
        c = FF(c, d, a, b, M_offset_6, 17, T[6]);
        b = FF(b, c, d, a, M_offset_7, 22, T[7]);
        a = FF(a, b, c, d, M_offset_8, 7, T[8]);
        d = FF(d, a, b, c, M_offset_9, 12, T[9]);
        c = FF(c, d, a, b, M_offset_10, 17, T[10]);
        b = FF(b, c, d, a, M_offset_11, 22, T[11]);
        a = FF(a, b, c, d, M_offset_12, 7, T[12]);
        d = FF(d, a, b, c, M_offset_13, 12, T[13]);
        c = FF(c, d, a, b, M_offset_14, 17, T[14]);
        b = FF(b, c, d, a, M_offset_15, 22, T[15]);
        a = GG(a, b, c, d, M_offset_1, 5, T[16]);
        d = GG(d, a, b, c, M_offset_6, 9, T[17]);
        c = GG(c, d, a, b, M_offset_11, 14, T[18]);
        b = GG(b, c, d, a, M_offset_0, 20, T[19]);
        a = GG(a, b, c, d, M_offset_5, 5, T[20]);
        d = GG(d, a, b, c, M_offset_10, 9, T[21]);
        c = GG(c, d, a, b, M_offset_15, 14, T[22]);
        b = GG(b, c, d, a, M_offset_4, 20, T[23]);
        a = GG(a, b, c, d, M_offset_9, 5, T[24]);
        d = GG(d, a, b, c, M_offset_14, 9, T[25]);
        c = GG(c, d, a, b, M_offset_3, 14, T[26]);
        b = GG(b, c, d, a, M_offset_8, 20, T[27]);
        a = GG(a, b, c, d, M_offset_13, 5, T[28]);
        d = GG(d, a, b, c, M_offset_2, 9, T[29]);
        c = GG(c, d, a, b, M_offset_7, 14, T[30]);
        b = GG(b, c, d, a, M_offset_12, 20, T[31]);
        a = HH(a, b, c, d, M_offset_5, 4, T[32]);
        d = HH(d, a, b, c, M_offset_8, 11, T[33]);
        c = HH(c, d, a, b, M_offset_11, 16, T[34]);
        b = HH(b, c, d, a, M_offset_14, 23, T[35]);
        a = HH(a, b, c, d, M_offset_1, 4, T[36]);
        d = HH(d, a, b, c, M_offset_4, 11, T[37]);
        c = HH(c, d, a, b, M_offset_7, 16, T[38]);
        b = HH(b, c, d, a, M_offset_10, 23, T[39]);
        a = HH(a, b, c, d, M_offset_13, 4, T[40]);
        d = HH(d, a, b, c, M_offset_0, 11, T[41]);
        c = HH(c, d, a, b, M_offset_3, 16, T[42]);
        b = HH(b, c, d, a, M_offset_6, 23, T[43]);
        a = HH(a, b, c, d, M_offset_9, 4, T[44]);
        d = HH(d, a, b, c, M_offset_12, 11, T[45]);
        c = HH(c, d, a, b, M_offset_15, 16, T[46]);
        b = HH(b, c, d, a, M_offset_2, 23, T[47]);
        a = II(a, b, c, d, M_offset_0, 6, T[48]);
        d = II(d, a, b, c, M_offset_7, 10, T[49]);
        c = II(c, d, a, b, M_offset_14, 15, T[50]);
        b = II(b, c, d, a, M_offset_5, 21, T[51]);
        a = II(a, b, c, d, M_offset_12, 6, T[52]);
        d = II(d, a, b, c, M_offset_3, 10, T[53]);
        c = II(c, d, a, b, M_offset_10, 15, T[54]);
        b = II(b, c, d, a, M_offset_1, 21, T[55]);
        a = II(a, b, c, d, M_offset_8, 6, T[56]);
        d = II(d, a, b, c, M_offset_15, 10, T[57]);
        c = II(c, d, a, b, M_offset_6, 15, T[58]);
        b = II(b, c, d, a, M_offset_13, 21, T[59]);
        a = II(a, b, c, d, M_offset_4, 6, T[60]);
        d = II(d, a, b, c, M_offset_11, 10, T[61]);
        c = II(c, d, a, b, M_offset_2, 15, T[62]);
        b = II(b, c, d, a, M_offset_9, 21, T[63]);

        // Intermediate hash value
        H[0] = H[0] + a | 0;
        H[1] = H[1] + b | 0;
        H[2] = H[2] + c | 0;
        H[3] = H[3] + d | 0;
      },
      _doFinalize: function () {
        // Shortcuts
        var data = this._data;
        var dataWords = data.words;
        var nBitsTotal = this._nDataBytes * 8;
        var nBitsLeft = data.sigBytes * 8;

        // Add padding
        dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
        var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
        var nBitsTotalL = nBitsTotal;
        dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00;
        dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00;
        data.sigBytes = (dataWords.length + 1) * 4;

        // Hash final blocks
        this._process();

        // Shortcuts
        var hash = this._hash;
        var H = hash.words;

        // Swap endian
        for (var i = 0; i < 4; i++) {
          // Shortcut
          var H_i = H[i];
          H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00;
        }

        // Return final computed hash
        return hash;
      },
      clone: function () {
        var clone = Hasher.clone.call(this);
        clone._hash = this._hash.clone();
        return clone;
      }
    });
    function FF(a, b, c, d, x, s, t) {
      var n = a + (b & c | ~b & d) + x + t;
      return (n << s | n >>> 32 - s) + b;
    }
    function GG(a, b, c, d, x, s, t) {
      var n = a + (b & d | c & ~d) + x + t;
      return (n << s | n >>> 32 - s) + b;
    }
    function HH(a, b, c, d, x, s, t) {
      var n = a + (b ^ c ^ d) + x + t;
      return (n << s | n >>> 32 - s) + b;
    }
    function II(a, b, c, d, x, s, t) {
      var n = a + (c ^ (b | ~d)) + x + t;
      return (n << s | n >>> 32 - s) + b;
    }

    /**
     * Shortcut function to the hasher's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     *
     * @return {WordArray} The hash.
     *
     * @static
     *
     * @example
     *
     *     var hash = CryptoJS.MD5('message');
     *     var hash = CryptoJS.MD5(wordArray);
     */
    C.MD5 = Hasher._createHelper(MD5);

    /**
     * Shortcut function to the HMAC's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     * @param {WordArray|string} key The secret key.
     *
     * @return {WordArray} The HMAC.
     *
     * @static
     *
     * @example
     *
     *     var hmac = CryptoJS.HmacMD5(message, key);
     */
    C.HmacMD5 = Hasher._createHmacHelper(MD5);
  })(Math);
  return CryptoJS.MD5;
});
});

var sha1 = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var Hasher = C_lib.Hasher;
    var C_algo = C.algo;

    // Reusable object
    var W = [];

    /**
     * SHA-1 hash algorithm.
     */
    var SHA1 = C_algo.SHA1 = Hasher.extend({
      _doReset: function () {
        this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]);
      },
      _doProcessBlock: function (M, offset) {
        // Shortcut
        var H = this._hash.words;

        // Working variables
        var a = H[0];
        var b = H[1];
        var c = H[2];
        var d = H[3];
        var e = H[4];

        // Computation
        for (var i = 0; i < 80; i++) {
          if (i < 16) {
            W[i] = M[offset + i] | 0;
          } else {
            var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
            W[i] = n << 1 | n >>> 31;
          }
          var t = (a << 5 | a >>> 27) + e + W[i];
          if (i < 20) {
            t += (b & c | ~b & d) + 0x5a827999;
          } else if (i < 40) {
            t += (b ^ c ^ d) + 0x6ed9eba1;
          } else if (i < 60) {
            t += (b & c | b & d | c & d) - 0x70e44324;
          } else /* if (i < 80) */{
              t += (b ^ c ^ d) - 0x359d3e2a;
            }
          e = d;
          d = c;
          c = b << 30 | b >>> 2;
          b = a;
          a = t;
        }

        // Intermediate hash value
        H[0] = H[0] + a | 0;
        H[1] = H[1] + b | 0;
        H[2] = H[2] + c | 0;
        H[3] = H[3] + d | 0;
        H[4] = H[4] + e | 0;
      },
      _doFinalize: function () {
        // Shortcuts
        var data = this._data;
        var dataWords = data.words;
        var nBitsTotal = this._nDataBytes * 8;
        var nBitsLeft = data.sigBytes * 8;

        // Add padding
        dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
        dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
        dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
        data.sigBytes = dataWords.length * 4;

        // Hash final blocks
        this._process();

        // Return final computed hash
        return this._hash;
      },
      clone: function () {
        var clone = Hasher.clone.call(this);
        clone._hash = this._hash.clone();
        return clone;
      }
    });

    /**
     * Shortcut function to the hasher's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     *
     * @return {WordArray} The hash.
     *
     * @static
     *
     * @example
     *
     *     var hash = CryptoJS.SHA1('message');
     *     var hash = CryptoJS.SHA1(wordArray);
     */
    C.SHA1 = Hasher._createHelper(SHA1);

    /**
     * Shortcut function to the HMAC's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     * @param {WordArray|string} key The secret key.
     *
     * @return {WordArray} The HMAC.
     *
     * @static
     *
     * @example
     *
     *     var hmac = CryptoJS.HmacSHA1(message, key);
     */
    C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
  })();
  return CryptoJS.SHA1;
});
});

var sha256 = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function (Math) {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var Hasher = C_lib.Hasher;
    var C_algo = C.algo;

    // Initialization and round constants tables
    var H = [];
    var K = [];

    // Compute constants
    (function () {
      function isPrime(n) {
        var sqrtN = Math.sqrt(n);
        for (var factor = 2; factor <= sqrtN; factor++) {
          if (!(n % factor)) {
            return false;
          }
        }
        return true;
      }
      function getFractionalBits(n) {
        return (n - (n | 0)) * 0x100000000 | 0;
      }
      var n = 2;
      var nPrime = 0;
      while (nPrime < 64) {
        if (isPrime(n)) {
          if (nPrime < 8) {
            H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
          }
          K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
          nPrime++;
        }
        n++;
      }
    })();

    // Reusable object
    var W = [];

    /**
     * SHA-256 hash algorithm.
     */
    var SHA256 = C_algo.SHA256 = Hasher.extend({
      _doReset: function () {
        this._hash = new WordArray.init(H.slice(0));
      },
      _doProcessBlock: function (M, offset) {
        // Shortcut
        var H = this._hash.words;

        // Working variables
        var a = H[0];
        var b = H[1];
        var c = H[2];
        var d = H[3];
        var e = H[4];
        var f = H[5];
        var g = H[6];
        var h = H[7];

        // Computation
        for (var i = 0; i < 64; i++) {
          if (i < 16) {
            W[i] = M[offset + i] | 0;
          } else {
            var gamma0x = W[i - 15];
            var gamma0 = (gamma0x << 25 | gamma0x >>> 7) ^ (gamma0x << 14 | gamma0x >>> 18) ^ gamma0x >>> 3;
            var gamma1x = W[i - 2];
            var gamma1 = (gamma1x << 15 | gamma1x >>> 17) ^ (gamma1x << 13 | gamma1x >>> 19) ^ gamma1x >>> 10;
            W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
          }
          var ch = e & f ^ ~e & g;
          var maj = a & b ^ a & c ^ b & c;
          var sigma0 = (a << 30 | a >>> 2) ^ (a << 19 | a >>> 13) ^ (a << 10 | a >>> 22);
          var sigma1 = (e << 26 | e >>> 6) ^ (e << 21 | e >>> 11) ^ (e << 7 | e >>> 25);
          var t1 = h + sigma1 + ch + K[i] + W[i];
          var t2 = sigma0 + maj;
          h = g;
          g = f;
          f = e;
          e = d + t1 | 0;
          d = c;
          c = b;
          b = a;
          a = t1 + t2 | 0;
        }

        // Intermediate hash value
        H[0] = H[0] + a | 0;
        H[1] = H[1] + b | 0;
        H[2] = H[2] + c | 0;
        H[3] = H[3] + d | 0;
        H[4] = H[4] + e | 0;
        H[5] = H[5] + f | 0;
        H[6] = H[6] + g | 0;
        H[7] = H[7] + h | 0;
      },
      _doFinalize: function () {
        // Shortcuts
        var data = this._data;
        var dataWords = data.words;
        var nBitsTotal = this._nDataBytes * 8;
        var nBitsLeft = data.sigBytes * 8;

        // Add padding
        dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
        dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
        dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
        data.sigBytes = dataWords.length * 4;

        // Hash final blocks
        this._process();

        // Return final computed hash
        return this._hash;
      },
      clone: function () {
        var clone = Hasher.clone.call(this);
        clone._hash = this._hash.clone();
        return clone;
      }
    });

    /**
     * Shortcut function to the hasher's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     *
     * @return {WordArray} The hash.
     *
     * @static
     *
     * @example
     *
     *     var hash = CryptoJS.SHA256('message');
     *     var hash = CryptoJS.SHA256(wordArray);
     */
    C.SHA256 = Hasher._createHelper(SHA256);

    /**
     * Shortcut function to the HMAC's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     * @param {WordArray|string} key The secret key.
     *
     * @return {WordArray} The HMAC.
     *
     * @static
     *
     * @example
     *
     *     var hmac = CryptoJS.HmacSHA256(message, key);
     */
    C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
  })(Math);
  return CryptoJS.SHA256;
});
});

var sha224 = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, sha256);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var C_algo = C.algo;
    var SHA256 = C_algo.SHA256;

    /**
     * SHA-224 hash algorithm.
     */
    var SHA224 = C_algo.SHA224 = SHA256.extend({
      _doReset: function () {
        this._hash = new WordArray.init([0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4]);
      },
      _doFinalize: function () {
        var hash = SHA256._doFinalize.call(this);
        hash.sigBytes -= 4;
        return hash;
      }
    });

    /**
     * Shortcut function to the hasher's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     *
     * @return {WordArray} The hash.
     *
     * @static
     *
     * @example
     *
     *     var hash = CryptoJS.SHA224('message');
     *     var hash = CryptoJS.SHA224(wordArray);
     */
    C.SHA224 = SHA256._createHelper(SHA224);

    /**
     * Shortcut function to the HMAC's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     * @param {WordArray|string} key The secret key.
     *
     * @return {WordArray} The HMAC.
     *
     * @static
     *
     * @example
     *
     *     var hmac = CryptoJS.HmacSHA224(message, key);
     */
    C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
  })();
  return CryptoJS.SHA224;
});
});

var sha512 = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, x64Core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var Hasher = C_lib.Hasher;
    var C_x64 = C.x64;
    var X64Word = C_x64.Word;
    var X64WordArray = C_x64.WordArray;
    var C_algo = C.algo;
    function X64Word_create() {
      return X64Word.create.apply(X64Word, arguments);
    }

    // Constants
    var K = [X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)];

    // Reusable objects
    var W = [];
    (function () {
      for (var i = 0; i < 80; i++) {
        W[i] = X64Word_create();
      }
    })();

    /**
     * SHA-512 hash algorithm.
     */
    var SHA512 = C_algo.SHA512 = Hasher.extend({
      _doReset: function () {
        this._hash = new X64WordArray.init([new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)]);
      },
      _doProcessBlock: function (M, offset) {
        // Shortcuts
        var H = this._hash.words;
        var H0 = H[0];
        var H1 = H[1];
        var H2 = H[2];
        var H3 = H[3];
        var H4 = H[4];
        var H5 = H[5];
        var H6 = H[6];
        var H7 = H[7];
        var H0h = H0.high;
        var H0l = H0.low;
        var H1h = H1.high;
        var H1l = H1.low;
        var H2h = H2.high;
        var H2l = H2.low;
        var H3h = H3.high;
        var H3l = H3.low;
        var H4h = H4.high;
        var H4l = H4.low;
        var H5h = H5.high;
        var H5l = H5.low;
        var H6h = H6.high;
        var H6l = H6.low;
        var H7h = H7.high;
        var H7l = H7.low;

        // Working variables
        var ah = H0h;
        var al = H0l;
        var bh = H1h;
        var bl = H1l;
        var ch = H2h;
        var cl = H2l;
        var dh = H3h;
        var dl = H3l;
        var eh = H4h;
        var el = H4l;
        var fh = H5h;
        var fl = H5l;
        var gh = H6h;
        var gl = H6l;
        var hh = H7h;
        var hl = H7l;

        // Rounds
        for (var i = 0; i < 80; i++) {
          var Wil;
          var Wih;

          // Shortcut
          var Wi = W[i];

          // Extend message
          if (i < 16) {
            Wih = Wi.high = M[offset + i * 2] | 0;
            Wil = Wi.low = M[offset + i * 2 + 1] | 0;
          } else {
            // Gamma0
            var gamma0x = W[i - 15];
            var gamma0xh = gamma0x.high;
            var gamma0xl = gamma0x.low;
            var gamma0h = (gamma0xh >>> 1 | gamma0xl << 31) ^ (gamma0xh >>> 8 | gamma0xl << 24) ^ gamma0xh >>> 7;
            var gamma0l = (gamma0xl >>> 1 | gamma0xh << 31) ^ (gamma0xl >>> 8 | gamma0xh << 24) ^ (gamma0xl >>> 7 | gamma0xh << 25);

            // Gamma1
            var gamma1x = W[i - 2];
            var gamma1xh = gamma1x.high;
            var gamma1xl = gamma1x.low;
            var gamma1h = (gamma1xh >>> 19 | gamma1xl << 13) ^ (gamma1xh << 3 | gamma1xl >>> 29) ^ gamma1xh >>> 6;
            var gamma1l = (gamma1xl >>> 19 | gamma1xh << 13) ^ (gamma1xl << 3 | gamma1xh >>> 29) ^ (gamma1xl >>> 6 | gamma1xh << 26);

            // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
            var Wi7 = W[i - 7];
            var Wi7h = Wi7.high;
            var Wi7l = Wi7.low;
            var Wi16 = W[i - 16];
            var Wi16h = Wi16.high;
            var Wi16l = Wi16.low;
            Wil = gamma0l + Wi7l;
            Wih = gamma0h + Wi7h + (Wil >>> 0 < gamma0l >>> 0 ? 1 : 0);
            Wil = Wil + gamma1l;
            Wih = Wih + gamma1h + (Wil >>> 0 < gamma1l >>> 0 ? 1 : 0);
            Wil = Wil + Wi16l;
            Wih = Wih + Wi16h + (Wil >>> 0 < Wi16l >>> 0 ? 1 : 0);
            Wi.high = Wih;
            Wi.low = Wil;
          }
          var chh = eh & fh ^ ~eh & gh;
          var chl = el & fl ^ ~el & gl;
          var majh = ah & bh ^ ah & ch ^ bh & ch;
          var majl = al & bl ^ al & cl ^ bl & cl;
          var sigma0h = (ah >>> 28 | al << 4) ^ (ah << 30 | al >>> 2) ^ (ah << 25 | al >>> 7);
          var sigma0l = (al >>> 28 | ah << 4) ^ (al << 30 | ah >>> 2) ^ (al << 25 | ah >>> 7);
          var sigma1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9);
          var sigma1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9);

          // t1 = h + sigma1 + ch + K[i] + W[i]
          var Ki = K[i];
          var Kih = Ki.high;
          var Kil = Ki.low;
          var t1l = hl + sigma1l;
          var t1h = hh + sigma1h + (t1l >>> 0 < hl >>> 0 ? 1 : 0);
          var t1l = t1l + chl;
          var t1h = t1h + chh + (t1l >>> 0 < chl >>> 0 ? 1 : 0);
          var t1l = t1l + Kil;
          var t1h = t1h + Kih + (t1l >>> 0 < Kil >>> 0 ? 1 : 0);
          var t1l = t1l + Wil;
          var t1h = t1h + Wih + (t1l >>> 0 < Wil >>> 0 ? 1 : 0);

          // t2 = sigma0 + maj
          var t2l = sigma0l + majl;
          var t2h = sigma0h + majh + (t2l >>> 0 < sigma0l >>> 0 ? 1 : 0);

          // Update working variables
          hh = gh;
          hl = gl;
          gh = fh;
          gl = fl;
          fh = eh;
          fl = el;
          el = dl + t1l | 0;
          eh = dh + t1h + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0;
          dh = ch;
          dl = cl;
          ch = bh;
          cl = bl;
          bh = ah;
          bl = al;
          al = t1l + t2l | 0;
          ah = t1h + t2h + (al >>> 0 < t1l >>> 0 ? 1 : 0) | 0;
        }

        // Intermediate hash value
        H0l = H0.low = H0l + al;
        H0.high = H0h + ah + (H0l >>> 0 < al >>> 0 ? 1 : 0);
        H1l = H1.low = H1l + bl;
        H1.high = H1h + bh + (H1l >>> 0 < bl >>> 0 ? 1 : 0);
        H2l = H2.low = H2l + cl;
        H2.high = H2h + ch + (H2l >>> 0 < cl >>> 0 ? 1 : 0);
        H3l = H3.low = H3l + dl;
        H3.high = H3h + dh + (H3l >>> 0 < dl >>> 0 ? 1 : 0);
        H4l = H4.low = H4l + el;
        H4.high = H4h + eh + (H4l >>> 0 < el >>> 0 ? 1 : 0);
        H5l = H5.low = H5l + fl;
        H5.high = H5h + fh + (H5l >>> 0 < fl >>> 0 ? 1 : 0);
        H6l = H6.low = H6l + gl;
        H6.high = H6h + gh + (H6l >>> 0 < gl >>> 0 ? 1 : 0);
        H7l = H7.low = H7l + hl;
        H7.high = H7h + hh + (H7l >>> 0 < hl >>> 0 ? 1 : 0);
      },
      _doFinalize: function () {
        // Shortcuts
        var data = this._data;
        var dataWords = data.words;
        var nBitsTotal = this._nDataBytes * 8;
        var nBitsLeft = data.sigBytes * 8;

        // Add padding
        dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
        dataWords[(nBitsLeft + 128 >>> 10 << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
        dataWords[(nBitsLeft + 128 >>> 10 << 5) + 31] = nBitsTotal;
        data.sigBytes = dataWords.length * 4;

        // Hash final blocks
        this._process();

        // Convert hash to 32-bit word array before returning
        var hash = this._hash.toX32();

        // Return final computed hash
        return hash;
      },
      clone: function () {
        var clone = Hasher.clone.call(this);
        clone._hash = this._hash.clone();
        return clone;
      },
      blockSize: 1024 / 32
    });

    /**
     * Shortcut function to the hasher's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     *
     * @return {WordArray} The hash.
     *
     * @static
     *
     * @example
     *
     *     var hash = CryptoJS.SHA512('message');
     *     var hash = CryptoJS.SHA512(wordArray);
     */
    C.SHA512 = Hasher._createHelper(SHA512);

    /**
     * Shortcut function to the HMAC's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     * @param {WordArray|string} key The secret key.
     *
     * @return {WordArray} The HMAC.
     *
     * @static
     *
     * @example
     *
     *     var hmac = CryptoJS.HmacSHA512(message, key);
     */
    C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
  })();
  return CryptoJS.SHA512;
});
});

var sha384 = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, x64Core, sha512);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_x64 = C.x64;
    var X64Word = C_x64.Word;
    var X64WordArray = C_x64.WordArray;
    var C_algo = C.algo;
    var SHA512 = C_algo.SHA512;

    /**
     * SHA-384 hash algorithm.
     */
    var SHA384 = C_algo.SHA384 = SHA512.extend({
      _doReset: function () {
        this._hash = new X64WordArray.init([new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)]);
      },
      _doFinalize: function () {
        var hash = SHA512._doFinalize.call(this);
        hash.sigBytes -= 16;
        return hash;
      }
    });

    /**
     * Shortcut function to the hasher's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     *
     * @return {WordArray} The hash.
     *
     * @static
     *
     * @example
     *
     *     var hash = CryptoJS.SHA384('message');
     *     var hash = CryptoJS.SHA384(wordArray);
     */
    C.SHA384 = SHA512._createHelper(SHA384);

    /**
     * Shortcut function to the HMAC's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     * @param {WordArray|string} key The secret key.
     *
     * @return {WordArray} The HMAC.
     *
     * @static
     *
     * @example
     *
     *     var hmac = CryptoJS.HmacSHA384(message, key);
     */
    C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
  })();
  return CryptoJS.SHA384;
});
});

var sha3 = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, x64Core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function (Math) {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var Hasher = C_lib.Hasher;
    var C_x64 = C.x64;
    var X64Word = C_x64.Word;
    var C_algo = C.algo;

    // Constants tables
    var RHO_OFFSETS = [];
    var PI_INDEXES = [];
    var ROUND_CONSTANTS = [];

    // Compute Constants
    (function () {
      // Compute rho offset constants
      var x = 1,
        y = 0;
      for (var t = 0; t < 24; t++) {
        RHO_OFFSETS[x + 5 * y] = (t + 1) * (t + 2) / 2 % 64;
        var newX = y % 5;
        var newY = (2 * x + 3 * y) % 5;
        x = newX;
        y = newY;
      }

      // Compute pi index constants
      for (var x = 0; x < 5; x++) {
        for (var y = 0; y < 5; y++) {
          PI_INDEXES[x + 5 * y] = y + (2 * x + 3 * y) % 5 * 5;
        }
      }

      // Compute round constants
      var LFSR = 0x01;
      for (var i = 0; i < 24; i++) {
        var roundConstantMsw = 0;
        var roundConstantLsw = 0;
        for (var j = 0; j < 7; j++) {
          if (LFSR & 0x01) {
            var bitPosition = (1 << j) - 1;
            if (bitPosition < 32) {
              roundConstantLsw ^= 1 << bitPosition;
            } else /* if (bitPosition >= 32) */{
                roundConstantMsw ^= 1 << bitPosition - 32;
              }
          }

          // Compute next LFSR
          if (LFSR & 0x80) {
            // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
            LFSR = LFSR << 1 ^ 0x71;
          } else {
            LFSR <<= 1;
          }
        }
        ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
      }
    })();

    // Reusable objects for temporary values
    var T = [];
    (function () {
      for (var i = 0; i < 25; i++) {
        T[i] = X64Word.create();
      }
    })();

    /**
     * SHA-3 hash algorithm.
     */
    var SHA3 = C_algo.SHA3 = Hasher.extend({
      /**
       * Configuration options.
       *
       * @property {number} outputLength
       *   The desired number of bits in the output hash.
       *   Only values permitted are: 224, 256, 384, 512.
       *   Default: 512
       */
      cfg: Hasher.cfg.extend({
        outputLength: 512
      }),
      _doReset: function () {
        var state = this._state = [];
        for (var i = 0; i < 25; i++) {
          state[i] = new X64Word.init();
        }
        this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
      },
      _doProcessBlock: function (M, offset) {
        // Shortcuts
        var state = this._state;
        var nBlockSizeLanes = this.blockSize / 2;

        // Absorb
        for (var i = 0; i < nBlockSizeLanes; i++) {
          // Shortcuts
          var M2i = M[offset + 2 * i];
          var M2i1 = M[offset + 2 * i + 1];

          // Swap endian
          M2i = (M2i << 8 | M2i >>> 24) & 0x00ff00ff | (M2i << 24 | M2i >>> 8) & 0xff00ff00;
          M2i1 = (M2i1 << 8 | M2i1 >>> 24) & 0x00ff00ff | (M2i1 << 24 | M2i1 >>> 8) & 0xff00ff00;

          // Absorb message into state
          var lane = state[i];
          lane.high ^= M2i1;
          lane.low ^= M2i;
        }

        // Rounds
        for (var round = 0; round < 24; round++) {
          // Theta
          for (var x = 0; x < 5; x++) {
            // Mix column lanes
            var tMsw = 0,
              tLsw = 0;
            for (var y = 0; y < 5; y++) {
              var lane = state[x + 5 * y];
              tMsw ^= lane.high;
              tLsw ^= lane.low;
            }

            // Temporary values
            var Tx = T[x];
            Tx.high = tMsw;
            Tx.low = tLsw;
          }
          for (var x = 0; x < 5; x++) {
            // Shortcuts
            var Tx4 = T[(x + 4) % 5];
            var Tx1 = T[(x + 1) % 5];
            var Tx1Msw = Tx1.high;
            var Tx1Lsw = Tx1.low;

            // Mix surrounding columns
            var tMsw = Tx4.high ^ (Tx1Msw << 1 | Tx1Lsw >>> 31);
            var tLsw = Tx4.low ^ (Tx1Lsw << 1 | Tx1Msw >>> 31);
            for (var y = 0; y < 5; y++) {
              var lane = state[x + 5 * y];
              lane.high ^= tMsw;
              lane.low ^= tLsw;
            }
          }

          // Rho Pi
          for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
            var tMsw;
            var tLsw;

            // Shortcuts
            var lane = state[laneIndex];
            var laneMsw = lane.high;
            var laneLsw = lane.low;
            var rhoOffset = RHO_OFFSETS[laneIndex];

            // Rotate lanes
            if (rhoOffset < 32) {
              tMsw = laneMsw << rhoOffset | laneLsw >>> 32 - rhoOffset;
              tLsw = laneLsw << rhoOffset | laneMsw >>> 32 - rhoOffset;
            } else /* if (rhoOffset >= 32) */{
                tMsw = laneLsw << rhoOffset - 32 | laneMsw >>> 64 - rhoOffset;
                tLsw = laneMsw << rhoOffset - 32 | laneLsw >>> 64 - rhoOffset;
              }

            // Transpose lanes
            var TPiLane = T[PI_INDEXES[laneIndex]];
            TPiLane.high = tMsw;
            TPiLane.low = tLsw;
          }

          // Rho pi at x = y = 0
          var T0 = T[0];
          var state0 = state[0];
          T0.high = state0.high;
          T0.low = state0.low;

          // Chi
          for (var x = 0; x < 5; x++) {
            for (var y = 0; y < 5; y++) {
              // Shortcuts
              var laneIndex = x + 5 * y;
              var lane = state[laneIndex];
              var TLane = T[laneIndex];
              var Tx1Lane = T[(x + 1) % 5 + 5 * y];
              var Tx2Lane = T[(x + 2) % 5 + 5 * y];

              // Mix rows
              lane.high = TLane.high ^ ~Tx1Lane.high & Tx2Lane.high;
              lane.low = TLane.low ^ ~Tx1Lane.low & Tx2Lane.low;
            }
          }

          // Iota
          var lane = state[0];
          var roundConstant = ROUND_CONSTANTS[round];
          lane.high ^= roundConstant.high;
          lane.low ^= roundConstant.low;
        }
      },
      _doFinalize: function () {
        // Shortcuts
        var data = this._data;
        var dataWords = data.words;
        this._nDataBytes * 8;
        var nBitsLeft = data.sigBytes * 8;
        var blockSizeBits = this.blockSize * 32;

        // Add padding
        dataWords[nBitsLeft >>> 5] |= 0x1 << 24 - nBitsLeft % 32;
        dataWords[(Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits >>> 5) - 1] |= 0x80;
        data.sigBytes = dataWords.length * 4;

        // Hash final blocks
        this._process();

        // Shortcuts
        var state = this._state;
        var outputLengthBytes = this.cfg.outputLength / 8;
        var outputLengthLanes = outputLengthBytes / 8;

        // Squeeze
        var hashWords = [];
        for (var i = 0; i < outputLengthLanes; i++) {
          // Shortcuts
          var lane = state[i];
          var laneMsw = lane.high;
          var laneLsw = lane.low;

          // Swap endian
          laneMsw = (laneMsw << 8 | laneMsw >>> 24) & 0x00ff00ff | (laneMsw << 24 | laneMsw >>> 8) & 0xff00ff00;
          laneLsw = (laneLsw << 8 | laneLsw >>> 24) & 0x00ff00ff | (laneLsw << 24 | laneLsw >>> 8) & 0xff00ff00;

          // Squeeze state to retrieve hash
          hashWords.push(laneLsw);
          hashWords.push(laneMsw);
        }

        // Return final computed hash
        return new WordArray.init(hashWords, outputLengthBytes);
      },
      clone: function () {
        var clone = Hasher.clone.call(this);
        var state = clone._state = this._state.slice(0);
        for (var i = 0; i < 25; i++) {
          state[i] = state[i].clone();
        }
        return clone;
      }
    });

    /**
     * Shortcut function to the hasher's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     *
     * @return {WordArray} The hash.
     *
     * @static
     *
     * @example
     *
     *     var hash = CryptoJS.SHA3('message');
     *     var hash = CryptoJS.SHA3(wordArray);
     */
    C.SHA3 = Hasher._createHelper(SHA3);

    /**
     * Shortcut function to the HMAC's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     * @param {WordArray|string} key The secret key.
     *
     * @return {WordArray} The HMAC.
     *
     * @static
     *
     * @example
     *
     *     var hmac = CryptoJS.HmacSHA3(message, key);
     */
    C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
  })(Math);
  return CryptoJS.SHA3;
});
});

var ripemd160 = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  /** @preserve
  (c) 2012 by Cédric Mesnil. All rights reserved.
  	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
      - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

  (function (Math) {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var Hasher = C_lib.Hasher;
    var C_algo = C.algo;

    // Constants table
    var _zl = WordArray.create([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
    var _zr = WordArray.create([5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
    var _sl = WordArray.create([11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]);
    var _sr = WordArray.create([8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]);
    var _hl = WordArray.create([0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
    var _hr = WordArray.create([0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);

    /**
     * RIPEMD160 hash algorithm.
     */
    var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
      _doReset: function () {
        this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
      },
      _doProcessBlock: function (M, offset) {
        // Swap endian
        for (var i = 0; i < 16; i++) {
          // Shortcuts
          var offset_i = offset + i;
          var M_offset_i = M[offset_i];

          // Swap
          M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00;
        }
        // Shortcut
        var H = this._hash.words;
        var hl = _hl.words;
        var hr = _hr.words;
        var zl = _zl.words;
        var zr = _zr.words;
        var sl = _sl.words;
        var sr = _sr.words;

        // Working variables
        var al, bl, cl, dl, el;
        var ar, br, cr, dr, er;
        ar = al = H[0];
        br = bl = H[1];
        cr = cl = H[2];
        dr = dl = H[3];
        er = el = H[4];
        // Computation
        var t;
        for (var i = 0; i < 80; i += 1) {
          t = al + M[offset + zl[i]] | 0;
          if (i < 16) {
            t += f1(bl, cl, dl) + hl[0];
          } else if (i < 32) {
            t += f2(bl, cl, dl) + hl[1];
          } else if (i < 48) {
            t += f3(bl, cl, dl) + hl[2];
          } else if (i < 64) {
            t += f4(bl, cl, dl) + hl[3];
          } else {
            // if (i<80) {
            t += f5(bl, cl, dl) + hl[4];
          }
          t = t | 0;
          t = rotl(t, sl[i]);
          t = t + el | 0;
          al = el;
          el = dl;
          dl = rotl(cl, 10);
          cl = bl;
          bl = t;
          t = ar + M[offset + zr[i]] | 0;
          if (i < 16) {
            t += f5(br, cr, dr) + hr[0];
          } else if (i < 32) {
            t += f4(br, cr, dr) + hr[1];
          } else if (i < 48) {
            t += f3(br, cr, dr) + hr[2];
          } else if (i < 64) {
            t += f2(br, cr, dr) + hr[3];
          } else {
            // if (i<80) {
            t += f1(br, cr, dr) + hr[4];
          }
          t = t | 0;
          t = rotl(t, sr[i]);
          t = t + er | 0;
          ar = er;
          er = dr;
          dr = rotl(cr, 10);
          cr = br;
          br = t;
        }
        // Intermediate hash value
        t = H[1] + cl + dr | 0;
        H[1] = H[2] + dl + er | 0;
        H[2] = H[3] + el + ar | 0;
        H[3] = H[4] + al + br | 0;
        H[4] = H[0] + bl + cr | 0;
        H[0] = t;
      },
      _doFinalize: function () {
        // Shortcuts
        var data = this._data;
        var dataWords = data.words;
        var nBitsTotal = this._nDataBytes * 8;
        var nBitsLeft = data.sigBytes * 8;

        // Add padding
        dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
        dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotal << 8 | nBitsTotal >>> 24) & 0x00ff00ff | (nBitsTotal << 24 | nBitsTotal >>> 8) & 0xff00ff00;
        data.sigBytes = (dataWords.length + 1) * 4;

        // Hash final blocks
        this._process();

        // Shortcuts
        var hash = this._hash;
        var H = hash.words;

        // Swap endian
        for (var i = 0; i < 5; i++) {
          // Shortcut
          var H_i = H[i];

          // Swap
          H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00;
        }

        // Return final computed hash
        return hash;
      },
      clone: function () {
        var clone = Hasher.clone.call(this);
        clone._hash = this._hash.clone();
        return clone;
      }
    });
    function f1(x, y, z) {
      return x ^ y ^ z;
    }
    function f2(x, y, z) {
      return x & y | ~x & z;
    }
    function f3(x, y, z) {
      return (x | ~y) ^ z;
    }
    function f4(x, y, z) {
      return x & z | y & ~z;
    }
    function f5(x, y, z) {
      return x ^ (y | ~z);
    }
    function rotl(x, n) {
      return x << n | x >>> 32 - n;
    }

    /**
     * Shortcut function to the hasher's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     *
     * @return {WordArray} The hash.
     *
     * @static
     *
     * @example
     *
     *     var hash = CryptoJS.RIPEMD160('message');
     *     var hash = CryptoJS.RIPEMD160(wordArray);
     */
    C.RIPEMD160 = Hasher._createHelper(RIPEMD160);

    /**
     * Shortcut function to the HMAC's object interface.
     *
     * @param {WordArray|string} message The message to hash.
     * @param {WordArray|string} key The secret key.
     *
     * @return {WordArray} The HMAC.
     *
     * @static
     *
     * @example
     *
     *     var hmac = CryptoJS.HmacRIPEMD160(message, key);
     */
    C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
  })();
  return CryptoJS.RIPEMD160;
});
});

var hmac = createCommonjsModule(function (module, exports) {
(function (root, factory) {
  {
    // CommonJS
    module.exports = factory(core);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var Base = C_lib.Base;
    var C_enc = C.enc;
    var Utf8 = C_enc.Utf8;
    var C_algo = C.algo;

    /**
     * HMAC algorithm.
     */
    C_algo.HMAC = Base.extend({
      /**
       * Initializes a newly created HMAC.
       *
       * @param {Hasher} hasher The hash algorithm to use.
       * @param {WordArray|string} key The secret key.
       *
       * @example
       *
       *     var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
       */
      init: function (hasher, key) {
        // Init hasher
        hasher = this._hasher = new hasher.init();

        // Convert string to WordArray, else assume WordArray already
        if (typeof key == 'string') {
          key = Utf8.parse(key);
        }

        // Shortcuts
        var hasherBlockSize = hasher.blockSize;
        var hasherBlockSizeBytes = hasherBlockSize * 4;

        // Allow arbitrary length keys
        if (key.sigBytes > hasherBlockSizeBytes) {
          key = hasher.finalize(key);
        }

        // Clamp excess bits
        key.clamp();

        // Clone key for inner and outer pads
        var oKey = this._oKey = key.clone();
        var iKey = this._iKey = key.clone();

        // Shortcuts
        var oKeyWords = oKey.words;
        var iKeyWords = iKey.words;

        // XOR keys with pad constants
        for (var i = 0; i < hasherBlockSize; i++) {
          oKeyWords[i] ^= 0x5c5c5c5c;
          iKeyWords[i] ^= 0x36363636;
        }
        oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;

        // Set initial values
        this.reset();
      },
      /**
       * Resets this HMAC to its initial state.
       *
       * @example
       *
       *     hmacHasher.reset();
       */
      reset: function () {
        // Shortcut
        var hasher = this._hasher;

        // Reset
        hasher.reset();
        hasher.update(this._iKey);
      },
      /**
       * Updates this HMAC with a message.
       *
       * @param {WordArray|string} messageUpdate The message to append.
       *
       * @return {HMAC} This HMAC instance.
       *
       * @example
       *
       *     hmacHasher.update('message');
       *     hmacHasher.update(wordArray);
       */
      update: function (messageUpdate) {
        this._hasher.update(messageUpdate);

        // Chainable
        return this;
      },
      /**
       * Finalizes the HMAC computation.
       * Note that the finalize operation is effectively a destructive, read-once operation.
       *
       * @param {WordArray|string} messageUpdate (Optional) A final message update.
       *
       * @return {WordArray} The HMAC.
       *
       * @example
       *
       *     var hmac = hmacHasher.finalize();
       *     var hmac = hmacHasher.finalize('message');
       *     var hmac = hmacHasher.finalize(wordArray);
       */
      finalize: function (messageUpdate) {
        // Shortcut
        var hasher = this._hasher;

        // Compute HMAC
        var innerHash = hasher.finalize(messageUpdate);
        hasher.reset();
        var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
        return hmac;
      }
    });
  })();
});
});

var pbkdf2 = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, sha256, hmac);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var Base = C_lib.Base;
    var WordArray = C_lib.WordArray;
    var C_algo = C.algo;
    var SHA256 = C_algo.SHA256;
    var HMAC = C_algo.HMAC;

    /**
     * Password-Based Key Derivation Function 2 algorithm.
     */
    var PBKDF2 = C_algo.PBKDF2 = Base.extend({
      /**
       * Configuration options.
       *
       * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
       * @property {Hasher} hasher The hasher to use. Default: SHA256
       * @property {number} iterations The number of iterations to perform. Default: 250000
       */
      cfg: Base.extend({
        keySize: 128 / 32,
        hasher: SHA256,
        iterations: 250000
      }),
      /**
       * Initializes a newly created key derivation function.
       *
       * @param {Object} cfg (Optional) The configuration options to use for the derivation.
       *
       * @example
       *
       *     var kdf = CryptoJS.algo.PBKDF2.create();
       *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
       *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
       */
      init: function (cfg) {
        this.cfg = this.cfg.extend(cfg);
      },
      /**
       * Computes the Password-Based Key Derivation Function 2.
       *
       * @param {WordArray|string} password The password.
       * @param {WordArray|string} salt A salt.
       *
       * @return {WordArray} The derived key.
       *
       * @example
       *
       *     var key = kdf.compute(password, salt);
       */
      compute: function (password, salt) {
        // Shortcut
        var cfg = this.cfg;

        // Init HMAC
        var hmac = HMAC.create(cfg.hasher, password);

        // Initial values
        var derivedKey = WordArray.create();
        var blockIndex = WordArray.create([0x00000001]);

        // Shortcuts
        var derivedKeyWords = derivedKey.words;
        var blockIndexWords = blockIndex.words;
        var keySize = cfg.keySize;
        var iterations = cfg.iterations;

        // Generate key
        while (derivedKeyWords.length < keySize) {
          var block = hmac.update(salt).finalize(blockIndex);
          hmac.reset();

          // Shortcuts
          var blockWords = block.words;
          var blockWordsLength = blockWords.length;

          // Iterations
          var intermediate = block;
          for (var i = 1; i < iterations; i++) {
            intermediate = hmac.finalize(intermediate);
            hmac.reset();

            // Shortcut
            var intermediateWords = intermediate.words;

            // XOR intermediate with block
            for (var j = 0; j < blockWordsLength; j++) {
              blockWords[j] ^= intermediateWords[j];
            }
          }
          derivedKey.concat(block);
          blockIndexWords[0]++;
        }
        derivedKey.sigBytes = keySize * 4;
        return derivedKey;
      }
    });

    /**
     * Computes the Password-Based Key Derivation Function 2.
     *
     * @param {WordArray|string} password The password.
     * @param {WordArray|string} salt A salt.
     * @param {Object} cfg (Optional) The configuration options to use for this computation.
     *
     * @return {WordArray} The derived key.
     *
     * @static
     *
     * @example
     *
     *     var key = CryptoJS.PBKDF2(password, salt);
     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
     */
    C.PBKDF2 = function (password, salt, cfg) {
      return PBKDF2.create(cfg).compute(password, salt);
    };
  })();
  return CryptoJS.PBKDF2;
});
});

var evpkdf = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, sha1, hmac);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var Base = C_lib.Base;
    var WordArray = C_lib.WordArray;
    var C_algo = C.algo;
    var MD5 = C_algo.MD5;

    /**
     * This key derivation function is meant to conform with EVP_BytesToKey.
     * www.openssl.org/docs/crypto/EVP_BytesToKey.html
     */
    var EvpKDF = C_algo.EvpKDF = Base.extend({
      /**
       * Configuration options.
       *
       * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
       * @property {Hasher} hasher The hash algorithm to use. Default: MD5
       * @property {number} iterations The number of iterations to perform. Default: 1
       */
      cfg: Base.extend({
        keySize: 128 / 32,
        hasher: MD5,
        iterations: 1
      }),
      /**
       * Initializes a newly created key derivation function.
       *
       * @param {Object} cfg (Optional) The configuration options to use for the derivation.
       *
       * @example
       *
       *     var kdf = CryptoJS.algo.EvpKDF.create();
       *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
       *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
       */
      init: function (cfg) {
        this.cfg = this.cfg.extend(cfg);
      },
      /**
       * Derives a key from a password.
       *
       * @param {WordArray|string} password The password.
       * @param {WordArray|string} salt A salt.
       *
       * @return {WordArray} The derived key.
       *
       * @example
       *
       *     var key = kdf.compute(password, salt);
       */
      compute: function (password, salt) {
        var block;

        // Shortcut
        var cfg = this.cfg;

        // Init hasher
        var hasher = cfg.hasher.create();

        // Initial values
        var derivedKey = WordArray.create();

        // Shortcuts
        var derivedKeyWords = derivedKey.words;
        var keySize = cfg.keySize;
        var iterations = cfg.iterations;

        // Generate key
        while (derivedKeyWords.length < keySize) {
          if (block) {
            hasher.update(block);
          }
          block = hasher.update(password).finalize(salt);
          hasher.reset();

          // Iterations
          for (var i = 1; i < iterations; i++) {
            block = hasher.finalize(block);
            hasher.reset();
          }
          derivedKey.concat(block);
        }
        derivedKey.sigBytes = keySize * 4;
        return derivedKey;
      }
    });

    /**
     * Derives a key from a password.
     *
     * @param {WordArray|string} password The password.
     * @param {WordArray|string} salt A salt.
     * @param {Object} cfg (Optional) The configuration options to use for this computation.
     *
     * @return {WordArray} The derived key.
     *
     * @static
     *
     * @example
     *
     *     var key = CryptoJS.EvpKDF(password, salt);
     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
     */
    C.EvpKDF = function (password, salt, cfg) {
      return EvpKDF.create(cfg).compute(password, salt);
    };
  })();
  return CryptoJS.EvpKDF;
});
});

var cipherCore = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, evpkdf);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * Cipher core components.
   */
  CryptoJS.lib.Cipher || function (undefined$1) {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var Base = C_lib.Base;
    var WordArray = C_lib.WordArray;
    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
    var C_enc = C.enc;
    C_enc.Utf8;
    var Base64 = C_enc.Base64;
    var C_algo = C.algo;
    var EvpKDF = C_algo.EvpKDF;

    /**
     * Abstract base cipher template.
     *
     * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
     * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
     * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
     * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
     */
    var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
      /**
       * Configuration options.
       *
       * @property {WordArray} iv The IV to use for this operation.
       */
      cfg: Base.extend(),
      /**
       * Creates this cipher in encryption mode.
       *
       * @param {WordArray} key The key.
       * @param {Object} cfg (Optional) The configuration options to use for this operation.
       *
       * @return {Cipher} A cipher instance.
       *
       * @static
       *
       * @example
       *
       *     var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
       */
      createEncryptor: function (key, cfg) {
        return this.create(this._ENC_XFORM_MODE, key, cfg);
      },
      /**
       * Creates this cipher in decryption mode.
       *
       * @param {WordArray} key The key.
       * @param {Object} cfg (Optional) The configuration options to use for this operation.
       *
       * @return {Cipher} A cipher instance.
       *
       * @static
       *
       * @example
       *
       *     var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
       */
      createDecryptor: function (key, cfg) {
        return this.create(this._DEC_XFORM_MODE, key, cfg);
      },
      /**
       * Initializes a newly created cipher.
       *
       * @param {number} xformMode Either the encryption or decryption transormation mode constant.
       * @param {WordArray} key The key.
       * @param {Object} cfg (Optional) The configuration options to use for this operation.
       *
       * @example
       *
       *     var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
       */
      init: function (xformMode, key, cfg) {
        // Apply config defaults
        this.cfg = this.cfg.extend(cfg);

        // Store transform mode and key
        this._xformMode = xformMode;
        this._key = key;

        // Set initial values
        this.reset();
      },
      /**
       * Resets this cipher to its initial state.
       *
       * @example
       *
       *     cipher.reset();
       */
      reset: function () {
        // Reset data buffer
        BufferedBlockAlgorithm.reset.call(this);

        // Perform concrete-cipher logic
        this._doReset();
      },
      /**
       * Adds data to be encrypted or decrypted.
       *
       * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
       *
       * @return {WordArray} The data after processing.
       *
       * @example
       *
       *     var encrypted = cipher.process('data');
       *     var encrypted = cipher.process(wordArray);
       */
      process: function (dataUpdate) {
        // Append
        this._append(dataUpdate);

        // Process available blocks
        return this._process();
      },
      /**
       * Finalizes the encryption or decryption process.
       * Note that the finalize operation is effectively a destructive, read-once operation.
       *
       * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
       *
       * @return {WordArray} The data after final processing.
       *
       * @example
       *
       *     var encrypted = cipher.finalize();
       *     var encrypted = cipher.finalize('data');
       *     var encrypted = cipher.finalize(wordArray);
       */
      finalize: function (dataUpdate) {
        // Final data update
        if (dataUpdate) {
          this._append(dataUpdate);
        }

        // Perform concrete-cipher logic
        var finalProcessedData = this._doFinalize();
        return finalProcessedData;
      },
      keySize: 128 / 32,
      ivSize: 128 / 32,
      _ENC_XFORM_MODE: 1,
      _DEC_XFORM_MODE: 2,
      /**
       * Creates shortcut functions to a cipher's object interface.
       *
       * @param {Cipher} cipher The cipher to create a helper for.
       *
       * @return {Object} An object with encrypt and decrypt shortcut functions.
       *
       * @static
       *
       * @example
       *
       *     var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
       */
      _createHelper: function () {
        function selectCipherStrategy(key) {
          if (typeof key == 'string') {
            return PasswordBasedCipher;
          } else {
            return SerializableCipher;
          }
        }
        return function (cipher) {
          return {
            encrypt: function (message, key, cfg) {
              return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
            },
            decrypt: function (ciphertext, key, cfg) {
              return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
            }
          };
        };
      }()
    });

    /**
     * Abstract base stream cipher template.
     *
     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
     */
    C_lib.StreamCipher = Cipher.extend({
      _doFinalize: function () {
        // Process partial blocks
        var finalProcessedBlocks = this._process(!!'flush');
        return finalProcessedBlocks;
      },
      blockSize: 1
    });

    /**
     * Mode namespace.
     */
    var C_mode = C.mode = {};

    /**
     * Abstract base block cipher mode template.
     */
    var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
      /**
       * Creates this mode for encryption.
       *
       * @param {Cipher} cipher A block cipher instance.
       * @param {Array} iv The IV words.
       *
       * @static
       *
       * @example
       *
       *     var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
       */
      createEncryptor: function (cipher, iv) {
        return this.Encryptor.create(cipher, iv);
      },
      /**
       * Creates this mode for decryption.
       *
       * @param {Cipher} cipher A block cipher instance.
       * @param {Array} iv The IV words.
       *
       * @static
       *
       * @example
       *
       *     var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
       */
      createDecryptor: function (cipher, iv) {
        return this.Decryptor.create(cipher, iv);
      },
      /**
       * Initializes a newly created mode.
       *
       * @param {Cipher} cipher A block cipher instance.
       * @param {Array} iv The IV words.
       *
       * @example
       *
       *     var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
       */
      init: function (cipher, iv) {
        this._cipher = cipher;
        this._iv = iv;
      }
    });

    /**
     * Cipher Block Chaining mode.
     */
    var CBC = C_mode.CBC = function () {
      /**
       * Abstract base CBC mode.
       */
      var CBC = BlockCipherMode.extend();

      /**
       * CBC encryptor.
       */
      CBC.Encryptor = CBC.extend({
        /**
         * Processes the data block at offset.
         *
         * @param {Array} words The data words to operate on.
         * @param {number} offset The offset where the block starts.
         *
         * @example
         *
         *     mode.processBlock(data.words, offset);
         */
        processBlock: function (words, offset) {
          // Shortcuts
          var cipher = this._cipher;
          var blockSize = cipher.blockSize;

          // XOR and encrypt
          xorBlock.call(this, words, offset, blockSize);
          cipher.encryptBlock(words, offset);

          // Remember this block to use with next block
          this._prevBlock = words.slice(offset, offset + blockSize);
        }
      });

      /**
       * CBC decryptor.
       */
      CBC.Decryptor = CBC.extend({
        /**
         * Processes the data block at offset.
         *
         * @param {Array} words The data words to operate on.
         * @param {number} offset The offset where the block starts.
         *
         * @example
         *
         *     mode.processBlock(data.words, offset);
         */
        processBlock: function (words, offset) {
          // Shortcuts
          var cipher = this._cipher;
          var blockSize = cipher.blockSize;

          // Remember this block to use with next block
          var thisBlock = words.slice(offset, offset + blockSize);

          // Decrypt and XOR
          cipher.decryptBlock(words, offset);
          xorBlock.call(this, words, offset, blockSize);

          // This block becomes the previous block
          this._prevBlock = thisBlock;
        }
      });
      function xorBlock(words, offset, blockSize) {
        var block;

        // Shortcut
        var iv = this._iv;

        // Choose mixing block
        if (iv) {
          block = iv;

          // Remove IV for subsequent blocks
          this._iv = undefined$1;
        } else {
          block = this._prevBlock;
        }

        // XOR blocks
        for (var i = 0; i < blockSize; i++) {
          words[offset + i] ^= block[i];
        }
      }
      return CBC;
    }();

    /**
     * Padding namespace.
     */
    var C_pad = C.pad = {};

    /**
     * PKCS #5/7 padding strategy.
     */
    var Pkcs7 = C_pad.Pkcs7 = {
      /**
       * Pads data using the algorithm defined in PKCS #5/7.
       *
       * @param {WordArray} data The data to pad.
       * @param {number} blockSize The multiple that the data should be padded to.
       *
       * @static
       *
       * @example
       *
       *     CryptoJS.pad.Pkcs7.pad(wordArray, 4);
       */
      pad: function (data, blockSize) {
        // Shortcut
        var blockSizeBytes = blockSize * 4;

        // Count padding bytes
        var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;

        // Create padding word
        var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes;

        // Create padding
        var paddingWords = [];
        for (var i = 0; i < nPaddingBytes; i += 4) {
          paddingWords.push(paddingWord);
        }
        var padding = WordArray.create(paddingWords, nPaddingBytes);

        // Add padding
        data.concat(padding);
      },
      /**
       * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
       *
       * @param {WordArray} data The data to unpad.
       *
       * @static
       *
       * @example
       *
       *     CryptoJS.pad.Pkcs7.unpad(wordArray);
       */
      unpad: function (data) {
        // Get number of padding bytes from last byte
        var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff;

        // Remove padding
        data.sigBytes -= nPaddingBytes;
      }
    };

    /**
     * Abstract base block cipher template.
     *
     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
     */
    C_lib.BlockCipher = Cipher.extend({
      /**
       * Configuration options.
       *
       * @property {Mode} mode The block mode to use. Default: CBC
       * @property {Padding} padding The padding strategy to use. Default: Pkcs7
       */
      cfg: Cipher.cfg.extend({
        mode: CBC,
        padding: Pkcs7
      }),
      reset: function () {
        var modeCreator;

        // Reset cipher
        Cipher.reset.call(this);

        // Shortcuts
        var cfg = this.cfg;
        var iv = cfg.iv;
        var mode = cfg.mode;

        // Reset block mode
        if (this._xformMode == this._ENC_XFORM_MODE) {
          modeCreator = mode.createEncryptor;
        } else /* if (this._xformMode == this._DEC_XFORM_MODE) */{
            modeCreator = mode.createDecryptor;
            // Keep at least one block in the buffer for unpadding
            this._minBufferSize = 1;
          }
        if (this._mode && this._mode.__creator == modeCreator) {
          this._mode.init(this, iv && iv.words);
        } else {
          this._mode = modeCreator.call(mode, this, iv && iv.words);
          this._mode.__creator = modeCreator;
        }
      },
      _doProcessBlock: function (words, offset) {
        this._mode.processBlock(words, offset);
      },
      _doFinalize: function () {
        var finalProcessedBlocks;

        // Shortcut
        var padding = this.cfg.padding;

        // Finalize
        if (this._xformMode == this._ENC_XFORM_MODE) {
          // Pad data
          padding.pad(this._data, this.blockSize);

          // Process final blocks
          finalProcessedBlocks = this._process(!!'flush');
        } else /* if (this._xformMode == this._DEC_XFORM_MODE) */{
            // Process final blocks
            finalProcessedBlocks = this._process(!!'flush');

            // Unpad data
            padding.unpad(finalProcessedBlocks);
          }
        return finalProcessedBlocks;
      },
      blockSize: 128 / 32
    });

    /**
     * A collection of cipher parameters.
     *
     * @property {WordArray} ciphertext The raw ciphertext.
     * @property {WordArray} key The key to this ciphertext.
     * @property {WordArray} iv The IV used in the ciphering operation.
     * @property {WordArray} salt The salt used with a key derivation function.
     * @property {Cipher} algorithm The cipher algorithm.
     * @property {Mode} mode The block mode used in the ciphering operation.
     * @property {Padding} padding The padding scheme used in the ciphering operation.
     * @property {number} blockSize The block size of the cipher.
     * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
     */
    var CipherParams = C_lib.CipherParams = Base.extend({
      /**
       * Initializes a newly created cipher params object.
       *
       * @param {Object} cipherParams An object with any of the possible cipher parameters.
       *
       * @example
       *
       *     var cipherParams = CryptoJS.lib.CipherParams.create({
       *         ciphertext: ciphertextWordArray,
       *         key: keyWordArray,
       *         iv: ivWordArray,
       *         salt: saltWordArray,
       *         algorithm: CryptoJS.algo.AES,
       *         mode: CryptoJS.mode.CBC,
       *         padding: CryptoJS.pad.PKCS7,
       *         blockSize: 4,
       *         formatter: CryptoJS.format.OpenSSL
       *     });
       */
      init: function (cipherParams) {
        this.mixIn(cipherParams);
      },
      /**
       * Converts this cipher params object to a string.
       *
       * @param {Format} formatter (Optional) The formatting strategy to use.
       *
       * @return {string} The stringified cipher params.
       *
       * @throws Error If neither the formatter nor the default formatter is set.
       *
       * @example
       *
       *     var string = cipherParams + '';
       *     var string = cipherParams.toString();
       *     var string = cipherParams.toString(CryptoJS.format.OpenSSL);
       */
      toString: function (formatter) {
        return (formatter || this.formatter).stringify(this);
      }
    });

    /**
     * Format namespace.
     */
    var C_format = C.format = {};

    /**
     * OpenSSL formatting strategy.
     */
    var OpenSSLFormatter = C_format.OpenSSL = {
      /**
       * Converts a cipher params object to an OpenSSL-compatible string.
       *
       * @param {CipherParams} cipherParams The cipher params object.
       *
       * @return {string} The OpenSSL-compatible string.
       *
       * @static
       *
       * @example
       *
       *     var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
       */
      stringify: function (cipherParams) {
        var wordArray;

        // Shortcuts
        var ciphertext = cipherParams.ciphertext;
        var salt = cipherParams.salt;

        // Format
        if (salt) {
          wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
        } else {
          wordArray = ciphertext;
        }
        return wordArray.toString(Base64);
      },
      /**
       * Converts an OpenSSL-compatible string to a cipher params object.
       *
       * @param {string} openSSLStr The OpenSSL-compatible string.
       *
       * @return {CipherParams} The cipher params object.
       *
       * @static
       *
       * @example
       *
       *     var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
       */
      parse: function (openSSLStr) {
        var salt;

        // Parse base64
        var ciphertext = Base64.parse(openSSLStr);

        // Shortcut
        var ciphertextWords = ciphertext.words;

        // Test for salt
        if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
          // Extract salt
          salt = WordArray.create(ciphertextWords.slice(2, 4));

          // Remove salt from ciphertext
          ciphertextWords.splice(0, 4);
          ciphertext.sigBytes -= 16;
        }
        return CipherParams.create({
          ciphertext: ciphertext,
          salt: salt
        });
      }
    };

    /**
     * A cipher wrapper that returns ciphertext as a serializable cipher params object.
     */
    var SerializableCipher = C_lib.SerializableCipher = Base.extend({
      /**
       * Configuration options.
       *
       * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
       */
      cfg: Base.extend({
        format: OpenSSLFormatter
      }),
      /**
       * Encrypts a message.
       *
       * @param {Cipher} cipher The cipher algorithm to use.
       * @param {WordArray|string} message The message to encrypt.
       * @param {WordArray} key The key.
       * @param {Object} cfg (Optional) The configuration options to use for this operation.
       *
       * @return {CipherParams} A cipher params object.
       *
       * @static
       *
       * @example
       *
       *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
       *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
       *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
       */
      encrypt: function (cipher, message, key, cfg) {
        // Apply config defaults
        cfg = this.cfg.extend(cfg);

        // Encrypt
        var encryptor = cipher.createEncryptor(key, cfg);
        var ciphertext = encryptor.finalize(message);

        // Shortcut
        var cipherCfg = encryptor.cfg;

        // Create and return serializable cipher params
        return CipherParams.create({
          ciphertext: ciphertext,
          key: key,
          iv: cipherCfg.iv,
          algorithm: cipher,
          mode: cipherCfg.mode,
          padding: cipherCfg.padding,
          blockSize: cipher.blockSize,
          formatter: cfg.format
        });
      },
      /**
       * Decrypts serialized ciphertext.
       *
       * @param {Cipher} cipher The cipher algorithm to use.
       * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
       * @param {WordArray} key The key.
       * @param {Object} cfg (Optional) The configuration options to use for this operation.
       *
       * @return {WordArray} The plaintext.
       *
       * @static
       *
       * @example
       *
       *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
       *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
       */
      decrypt: function (cipher, ciphertext, key, cfg) {
        // Apply config defaults
        cfg = this.cfg.extend(cfg);

        // Convert string to CipherParams
        ciphertext = this._parse(ciphertext, cfg.format);

        // Decrypt
        var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
        return plaintext;
      },
      /**
       * Converts serialized ciphertext to CipherParams,
       * else assumed CipherParams already and returns ciphertext unchanged.
       *
       * @param {CipherParams|string} ciphertext The ciphertext.
       * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
       *
       * @return {CipherParams} The unserialized ciphertext.
       *
       * @static
       *
       * @example
       *
       *     var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
       */
      _parse: function (ciphertext, format) {
        if (typeof ciphertext == 'string') {
          return format.parse(ciphertext, this);
        } else {
          return ciphertext;
        }
      }
    });

    /**
     * Key derivation function namespace.
     */
    var C_kdf = C.kdf = {};

    /**
     * OpenSSL key derivation function.
     */
    var OpenSSLKdf = C_kdf.OpenSSL = {
      /**
       * Derives a key and IV from a password.
       *
       * @param {string} password The password to derive from.
       * @param {number} keySize The size in words of the key to generate.
       * @param {number} ivSize The size in words of the IV to generate.
       * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
       *
       * @return {CipherParams} A cipher params object with the key, IV, and salt.
       *
       * @static
       *
       * @example
       *
       *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
       *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
       */
      execute: function (password, keySize, ivSize, salt, hasher) {
        // Generate random salt
        if (!salt) {
          salt = WordArray.random(64 / 8);
        }

        // Derive key and IV
        if (!hasher) {
          var key = EvpKDF.create({
            keySize: keySize + ivSize
          }).compute(password, salt);
        } else {
          var key = EvpKDF.create({
            keySize: keySize + ivSize,
            hasher: hasher
          }).compute(password, salt);
        }

        // Separate key and IV
        var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
        key.sigBytes = keySize * 4;

        // Return params
        return CipherParams.create({
          key: key,
          iv: iv,
          salt: salt
        });
      }
    };

    /**
     * A serializable cipher wrapper that derives the key from a password,
     * and returns ciphertext as a serializable cipher params object.
     */
    var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
      /**
       * Configuration options.
       *
       * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
       */
      cfg: SerializableCipher.cfg.extend({
        kdf: OpenSSLKdf
      }),
      /**
       * Encrypts a message using a password.
       *
       * @param {Cipher} cipher The cipher algorithm to use.
       * @param {WordArray|string} message The message to encrypt.
       * @param {string} password The password.
       * @param {Object} cfg (Optional) The configuration options to use for this operation.
       *
       * @return {CipherParams} A cipher params object.
       *
       * @static
       *
       * @example
       *
       *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
       *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
       */
      encrypt: function (cipher, message, password, cfg) {
        // Apply config defaults
        cfg = this.cfg.extend(cfg);

        // Derive key and other params
        var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher);

        // Add IV to config
        cfg.iv = derivedParams.iv;

        // Encrypt
        var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);

        // Mix in derived params
        ciphertext.mixIn(derivedParams);
        return ciphertext;
      },
      /**
       * Decrypts serialized ciphertext using a password.
       *
       * @param {Cipher} cipher The cipher algorithm to use.
       * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
       * @param {string} password The password.
       * @param {Object} cfg (Optional) The configuration options to use for this operation.
       *
       * @return {WordArray} The plaintext.
       *
       * @static
       *
       * @example
       *
       *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
       *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
       */
      decrypt: function (cipher, ciphertext, password, cfg) {
        // Apply config defaults
        cfg = this.cfg.extend(cfg);

        // Convert string to CipherParams
        ciphertext = this._parse(ciphertext, cfg.format);

        // Derive key and other params
        var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt, cfg.hasher);

        // Add IV to config
        cfg.iv = derivedParams.iv;

        // Decrypt
        var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
        return plaintext;
      }
    });
  }();
});
});

var modeCfb = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * Cipher Feedback block mode.
   */
  CryptoJS.mode.CFB = function () {
    var CFB = CryptoJS.lib.BlockCipherMode.extend();
    CFB.Encryptor = CFB.extend({
      processBlock: function (words, offset) {
        // Shortcuts
        var cipher = this._cipher;
        var blockSize = cipher.blockSize;
        generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);

        // Remember this block to use with next block
        this._prevBlock = words.slice(offset, offset + blockSize);
      }
    });
    CFB.Decryptor = CFB.extend({
      processBlock: function (words, offset) {
        // Shortcuts
        var cipher = this._cipher;
        var blockSize = cipher.blockSize;

        // Remember this block to use with next block
        var thisBlock = words.slice(offset, offset + blockSize);
        generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);

        // This block becomes the previous block
        this._prevBlock = thisBlock;
      }
    });
    function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
      var keystream;

      // Shortcut
      var iv = this._iv;

      // Generate keystream
      if (iv) {
        keystream = iv.slice(0);

        // Remove IV for subsequent blocks
        this._iv = undefined;
      } else {
        keystream = this._prevBlock;
      }
      cipher.encryptBlock(keystream, 0);

      // Encrypt
      for (var i = 0; i < blockSize; i++) {
        words[offset + i] ^= keystream[i];
      }
    }
    return CFB;
  }();
  return CryptoJS.mode.CFB;
});
});

var modeCtr = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * Counter block mode.
   */
  CryptoJS.mode.CTR = function () {
    var CTR = CryptoJS.lib.BlockCipherMode.extend();
    var Encryptor = CTR.Encryptor = CTR.extend({
      processBlock: function (words, offset) {
        // Shortcuts
        var cipher = this._cipher;
        var blockSize = cipher.blockSize;
        var iv = this._iv;
        var counter = this._counter;

        // Generate keystream
        if (iv) {
          counter = this._counter = iv.slice(0);

          // Remove IV for subsequent blocks
          this._iv = undefined;
        }
        var keystream = counter.slice(0);
        cipher.encryptBlock(keystream, 0);

        // Increment counter
        counter[blockSize - 1] = counter[blockSize - 1] + 1 | 0;

        // Encrypt
        for (var i = 0; i < blockSize; i++) {
          words[offset + i] ^= keystream[i];
        }
      }
    });
    CTR.Decryptor = Encryptor;
    return CTR;
  }();
  return CryptoJS.mode.CTR;
});
});

var modeCtrGladman = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /** @preserve
   * Counter block mode compatible with  Dr Brian Gladman fileenc.c
   * derived from CryptoJS.mode.CTR
   * Jan Hruby jhruby.web@gmail.com
   */
  CryptoJS.mode.CTRGladman = function () {
    var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
    function incWord(word) {
      if ((word >> 24 & 0xff) === 0xff) {
        //overflow
        var b1 = word >> 16 & 0xff;
        var b2 = word >> 8 & 0xff;
        var b3 = word & 0xff;
        if (b1 === 0xff)
          // overflow b1
          {
            b1 = 0;
            if (b2 === 0xff) {
              b2 = 0;
              if (b3 === 0xff) {
                b3 = 0;
              } else {
                ++b3;
              }
            } else {
              ++b2;
            }
          } else {
          ++b1;
        }
        word = 0;
        word += b1 << 16;
        word += b2 << 8;
        word += b3;
      } else {
        word += 0x01 << 24;
      }
      return word;
    }
    function incCounter(counter) {
      if ((counter[0] = incWord(counter[0])) === 0) {
        // encr_data in fileenc.c from  Dr Brian Gladman's counts only with DWORD j < 8
        counter[1] = incWord(counter[1]);
      }
      return counter;
    }
    var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
      processBlock: function (words, offset) {
        // Shortcuts
        var cipher = this._cipher;
        var blockSize = cipher.blockSize;
        var iv = this._iv;
        var counter = this._counter;

        // Generate keystream
        if (iv) {
          counter = this._counter = iv.slice(0);

          // Remove IV for subsequent blocks
          this._iv = undefined;
        }
        incCounter(counter);
        var keystream = counter.slice(0);
        cipher.encryptBlock(keystream, 0);

        // Encrypt
        for (var i = 0; i < blockSize; i++) {
          words[offset + i] ^= keystream[i];
        }
      }
    });
    CTRGladman.Decryptor = Encryptor;
    return CTRGladman;
  }();
  return CryptoJS.mode.CTRGladman;
});
});

var modeOfb = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * Output Feedback block mode.
   */
  CryptoJS.mode.OFB = function () {
    var OFB = CryptoJS.lib.BlockCipherMode.extend();
    var Encryptor = OFB.Encryptor = OFB.extend({
      processBlock: function (words, offset) {
        // Shortcuts
        var cipher = this._cipher;
        var blockSize = cipher.blockSize;
        var iv = this._iv;
        var keystream = this._keystream;

        // Generate keystream
        if (iv) {
          keystream = this._keystream = iv.slice(0);

          // Remove IV for subsequent blocks
          this._iv = undefined;
        }
        cipher.encryptBlock(keystream, 0);

        // Encrypt
        for (var i = 0; i < blockSize; i++) {
          words[offset + i] ^= keystream[i];
        }
      }
    });
    OFB.Decryptor = Encryptor;
    return OFB;
  }();
  return CryptoJS.mode.OFB;
});
});

var modeEcb = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * Electronic Codebook block mode.
   */
  CryptoJS.mode.ECB = function () {
    var ECB = CryptoJS.lib.BlockCipherMode.extend();
    ECB.Encryptor = ECB.extend({
      processBlock: function (words, offset) {
        this._cipher.encryptBlock(words, offset);
      }
    });
    ECB.Decryptor = ECB.extend({
      processBlock: function (words, offset) {
        this._cipher.decryptBlock(words, offset);
      }
    });
    return ECB;
  }();
  return CryptoJS.mode.ECB;
});
});

var padAnsix923 = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * ANSI X.923 padding strategy.
   */
  CryptoJS.pad.AnsiX923 = {
    pad: function (data, blockSize) {
      // Shortcuts
      var dataSigBytes = data.sigBytes;
      var blockSizeBytes = blockSize * 4;

      // Count padding bytes
      var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;

      // Compute last byte position
      var lastBytePos = dataSigBytes + nPaddingBytes - 1;

      // Pad
      data.clamp();
      data.words[lastBytePos >>> 2] |= nPaddingBytes << 24 - lastBytePos % 4 * 8;
      data.sigBytes += nPaddingBytes;
    },
    unpad: function (data) {
      // Get number of padding bytes from last byte
      var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff;

      // Remove padding
      data.sigBytes -= nPaddingBytes;
    }
  };
  return CryptoJS.pad.Ansix923;
});
});

var padIso10126 = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * ISO 10126 padding strategy.
   */
  CryptoJS.pad.Iso10126 = {
    pad: function (data, blockSize) {
      // Shortcut
      var blockSizeBytes = blockSize * 4;

      // Count padding bytes
      var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;

      // Pad
      data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
    },
    unpad: function (data) {
      // Get number of padding bytes from last byte
      var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff;

      // Remove padding
      data.sigBytes -= nPaddingBytes;
    }
  };
  return CryptoJS.pad.Iso10126;
});
});

var padIso97971 = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * ISO/IEC 9797-1 Padding Method 2.
   */
  CryptoJS.pad.Iso97971 = {
    pad: function (data, blockSize) {
      // Add 0x80 byte
      data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));

      // Zero pad the rest
      CryptoJS.pad.ZeroPadding.pad(data, blockSize);
    },
    unpad: function (data) {
      // Remove zero padding
      CryptoJS.pad.ZeroPadding.unpad(data);

      // Remove one more byte -- the 0x80 byte
      data.sigBytes--;
    }
  };
  return CryptoJS.pad.Iso97971;
});
});

var padZeropadding = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * Zero padding strategy.
   */
  CryptoJS.pad.ZeroPadding = {
    pad: function (data, blockSize) {
      // Shortcut
      var blockSizeBytes = blockSize * 4;

      // Pad
      data.clamp();
      data.sigBytes += blockSizeBytes - (data.sigBytes % blockSizeBytes || blockSizeBytes);
    },
    unpad: function (data) {
      // Shortcut
      var dataWords = data.words;

      // Unpad
      var i = data.sigBytes - 1;
      for (var i = data.sigBytes - 1; i >= 0; i--) {
        if (dataWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff) {
          data.sigBytes = i + 1;
          break;
        }
      }
    }
  };
  return CryptoJS.pad.ZeroPadding;
});
});

var padNopadding = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  /**
   * A noop padding strategy.
   */
  CryptoJS.pad.NoPadding = {
    pad: function () {},
    unpad: function () {}
  };
  return CryptoJS.pad.NoPadding;
});
});

var formatHex = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function (undefined$1) {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var CipherParams = C_lib.CipherParams;
    var C_enc = C.enc;
    var Hex = C_enc.Hex;
    var C_format = C.format;
    C_format.Hex = {
      /**
       * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
       *
       * @param {CipherParams} cipherParams The cipher params object.
       *
       * @return {string} The hexadecimally encoded string.
       *
       * @static
       *
       * @example
       *
       *     var hexString = CryptoJS.format.Hex.stringify(cipherParams);
       */
      stringify: function (cipherParams) {
        return cipherParams.ciphertext.toString(Hex);
      },
      /**
       * Converts a hexadecimally encoded ciphertext string to a cipher params object.
       *
       * @param {string} input The hexadecimally encoded string.
       *
       * @return {CipherParams} The cipher params object.
       *
       * @static
       *
       * @example
       *
       *     var cipherParams = CryptoJS.format.Hex.parse(hexString);
       */
      parse: function (input) {
        var ciphertext = Hex.parse(input);
        return CipherParams.create({
          ciphertext: ciphertext
        });
      }
    };
  })();
  return CryptoJS.format.Hex;
});
});

var aes = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, encBase64, md5, evpkdf, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var BlockCipher = C_lib.BlockCipher;
    var C_algo = C.algo;

    // Lookup tables
    var SBOX = [];
    var INV_SBOX = [];
    var SUB_MIX_0 = [];
    var SUB_MIX_1 = [];
    var SUB_MIX_2 = [];
    var SUB_MIX_3 = [];
    var INV_SUB_MIX_0 = [];
    var INV_SUB_MIX_1 = [];
    var INV_SUB_MIX_2 = [];
    var INV_SUB_MIX_3 = [];

    // Compute lookup tables
    (function () {
      // Compute double table
      var d = [];
      for (var i = 0; i < 256; i++) {
        if (i < 128) {
          d[i] = i << 1;
        } else {
          d[i] = i << 1 ^ 0x11b;
        }
      }

      // Walk GF(2^8)
      var x = 0;
      var xi = 0;
      for (var i = 0; i < 256; i++) {
        // Compute sbox
        var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;
        sx = sx >>> 8 ^ sx & 0xff ^ 0x63;
        SBOX[x] = sx;
        INV_SBOX[sx] = x;

        // Compute multiplication
        var x2 = d[x];
        var x4 = d[x2];
        var x8 = d[x4];

        // Compute sub bytes, mix columns tables
        var t = d[sx] * 0x101 ^ sx * 0x1010100;
        SUB_MIX_0[x] = t << 24 | t >>> 8;
        SUB_MIX_1[x] = t << 16 | t >>> 16;
        SUB_MIX_2[x] = t << 8 | t >>> 24;
        SUB_MIX_3[x] = t;

        // Compute inv sub bytes, inv mix columns tables
        var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;
        INV_SUB_MIX_0[sx] = t << 24 | t >>> 8;
        INV_SUB_MIX_1[sx] = t << 16 | t >>> 16;
        INV_SUB_MIX_2[sx] = t << 8 | t >>> 24;
        INV_SUB_MIX_3[sx] = t;

        // Compute next counter
        if (!x) {
          x = xi = 1;
        } else {
          x = x2 ^ d[d[d[x8 ^ x2]]];
          xi ^= d[d[xi]];
        }
      }
    })();

    // Precomputed Rcon lookup
    var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];

    /**
     * AES block cipher algorithm.
     */
    var AES = C_algo.AES = BlockCipher.extend({
      _doReset: function () {
        var t;

        // Skip reset of nRounds has been set before and key did not change
        if (this._nRounds && this._keyPriorReset === this._key) {
          return;
        }

        // Shortcuts
        var key = this._keyPriorReset = this._key;
        var keyWords = key.words;
        var keySize = key.sigBytes / 4;

        // Compute number of rounds
        var nRounds = this._nRounds = keySize + 6;

        // Compute number of key schedule rows
        var ksRows = (nRounds + 1) * 4;

        // Compute key schedule
        var keySchedule = this._keySchedule = [];
        for (var ksRow = 0; ksRow < ksRows; ksRow++) {
          if (ksRow < keySize) {
            keySchedule[ksRow] = keyWords[ksRow];
          } else {
            t = keySchedule[ksRow - 1];
            if (!(ksRow % keySize)) {
              // Rot word
              t = t << 8 | t >>> 24;

              // Sub word
              t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff];

              // Mix Rcon
              t ^= RCON[ksRow / keySize | 0] << 24;
            } else if (keySize > 6 && ksRow % keySize == 4) {
              // Sub word
              t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff];
            }
            keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
          }
        }

        // Compute inv key schedule
        var invKeySchedule = this._invKeySchedule = [];
        for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
          var ksRow = ksRows - invKsRow;
          if (invKsRow % 4) {
            var t = keySchedule[ksRow];
          } else {
            var t = keySchedule[ksRow - 4];
          }
          if (invKsRow < 4 || ksRow <= 4) {
            invKeySchedule[invKsRow] = t;
          } else {
            invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
          }
        }
      },
      encryptBlock: function (M, offset) {
        this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
      },
      decryptBlock: function (M, offset) {
        // Swap 2nd and 4th rows
        var t = M[offset + 1];
        M[offset + 1] = M[offset + 3];
        M[offset + 3] = t;
        this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);

        // Inv swap 2nd and 4th rows
        var t = M[offset + 1];
        M[offset + 1] = M[offset + 3];
        M[offset + 3] = t;
      },
      _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
        // Shortcut
        var nRounds = this._nRounds;

        // Get input, add round key
        var s0 = M[offset] ^ keySchedule[0];
        var s1 = M[offset + 1] ^ keySchedule[1];
        var s2 = M[offset + 2] ^ keySchedule[2];
        var s3 = M[offset + 3] ^ keySchedule[3];

        // Key schedule row counter
        var ksRow = 4;

        // Rounds
        for (var round = 1; round < nRounds; round++) {
          // Shift rows, sub bytes, mix columns, add round key
          var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
          var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
          var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
          var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];

          // Update state
          s0 = t0;
          s1 = t1;
          s2 = t2;
          s3 = t3;
        }

        // Shift rows, sub bytes, add round key
        var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
        var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
        var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
        var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];

        // Set output
        M[offset] = t0;
        M[offset + 1] = t1;
        M[offset + 2] = t2;
        M[offset + 3] = t3;
      },
      keySize: 256 / 32
    });

    /**
     * Shortcut functions to the cipher's object interface.
     *
     * @example
     *
     *     var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
     *     var plaintext  = CryptoJS.AES.decrypt(ciphertext, key, cfg);
     */
    C.AES = BlockCipher._createHelper(AES);
  })();
  return CryptoJS.AES;
});
});

var tripledes = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, encBase64, md5, evpkdf, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var WordArray = C_lib.WordArray;
    var BlockCipher = C_lib.BlockCipher;
    var C_algo = C.algo;

    // Permuted Choice 1 constants
    var PC1 = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4];

    // Permuted Choice 2 constants
    var PC2 = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32];

    // Cumulative bit shift constants
    var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];

    // SBOXes and round permutation constants
    var SBOX_P = [{
      0x0: 0x808200,
      0x10000000: 0x8000,
      0x20000000: 0x808002,
      0x30000000: 0x2,
      0x40000000: 0x200,
      0x50000000: 0x808202,
      0x60000000: 0x800202,
      0x70000000: 0x800000,
      0x80000000: 0x202,
      0x90000000: 0x800200,
      0xa0000000: 0x8200,
      0xb0000000: 0x808000,
      0xc0000000: 0x8002,
      0xd0000000: 0x800002,
      0xe0000000: 0x0,
      0xf0000000: 0x8202,
      0x8000000: 0x0,
      0x18000000: 0x808202,
      0x28000000: 0x8202,
      0x38000000: 0x8000,
      0x48000000: 0x808200,
      0x58000000: 0x200,
      0x68000000: 0x808002,
      0x78000000: 0x2,
      0x88000000: 0x800200,
      0x98000000: 0x8200,
      0xa8000000: 0x808000,
      0xb8000000: 0x800202,
      0xc8000000: 0x800002,
      0xd8000000: 0x8002,
      0xe8000000: 0x202,
      0xf8000000: 0x800000,
      0x1: 0x8000,
      0x10000001: 0x2,
      0x20000001: 0x808200,
      0x30000001: 0x800000,
      0x40000001: 0x808002,
      0x50000001: 0x8200,
      0x60000001: 0x200,
      0x70000001: 0x800202,
      0x80000001: 0x808202,
      0x90000001: 0x808000,
      0xa0000001: 0x800002,
      0xb0000001: 0x8202,
      0xc0000001: 0x202,
      0xd0000001: 0x800200,
      0xe0000001: 0x8002,
      0xf0000001: 0x0,
      0x8000001: 0x808202,
      0x18000001: 0x808000,
      0x28000001: 0x800000,
      0x38000001: 0x200,
      0x48000001: 0x8000,
      0x58000001: 0x800002,
      0x68000001: 0x2,
      0x78000001: 0x8202,
      0x88000001: 0x8002,
      0x98000001: 0x800202,
      0xa8000001: 0x202,
      0xb8000001: 0x808200,
      0xc8000001: 0x800200,
      0xd8000001: 0x0,
      0xe8000001: 0x8200,
      0xf8000001: 0x808002
    }, {
      0x0: 0x40084010,
      0x1000000: 0x4000,
      0x2000000: 0x80000,
      0x3000000: 0x40080010,
      0x4000000: 0x40000010,
      0x5000000: 0x40084000,
      0x6000000: 0x40004000,
      0x7000000: 0x10,
      0x8000000: 0x84000,
      0x9000000: 0x40004010,
      0xa000000: 0x40000000,
      0xb000000: 0x84010,
      0xc000000: 0x80010,
      0xd000000: 0x0,
      0xe000000: 0x4010,
      0xf000000: 0x40080000,
      0x800000: 0x40004000,
      0x1800000: 0x84010,
      0x2800000: 0x10,
      0x3800000: 0x40004010,
      0x4800000: 0x40084010,
      0x5800000: 0x40000000,
      0x6800000: 0x80000,
      0x7800000: 0x40080010,
      0x8800000: 0x80010,
      0x9800000: 0x0,
      0xa800000: 0x4000,
      0xb800000: 0x40080000,
      0xc800000: 0x40000010,
      0xd800000: 0x84000,
      0xe800000: 0x40084000,
      0xf800000: 0x4010,
      0x10000000: 0x0,
      0x11000000: 0x40080010,
      0x12000000: 0x40004010,
      0x13000000: 0x40084000,
      0x14000000: 0x40080000,
      0x15000000: 0x10,
      0x16000000: 0x84010,
      0x17000000: 0x4000,
      0x18000000: 0x4010,
      0x19000000: 0x80000,
      0x1a000000: 0x80010,
      0x1b000000: 0x40000010,
      0x1c000000: 0x84000,
      0x1d000000: 0x40004000,
      0x1e000000: 0x40000000,
      0x1f000000: 0x40084010,
      0x10800000: 0x84010,
      0x11800000: 0x80000,
      0x12800000: 0x40080000,
      0x13800000: 0x4000,
      0x14800000: 0x40004000,
      0x15800000: 0x40084010,
      0x16800000: 0x10,
      0x17800000: 0x40000000,
      0x18800000: 0x40084000,
      0x19800000: 0x40000010,
      0x1a800000: 0x40004010,
      0x1b800000: 0x80010,
      0x1c800000: 0x0,
      0x1d800000: 0x4010,
      0x1e800000: 0x40080010,
      0x1f800000: 0x84000
    }, {
      0x0: 0x104,
      0x100000: 0x0,
      0x200000: 0x4000100,
      0x300000: 0x10104,
      0x400000: 0x10004,
      0x500000: 0x4000004,
      0x600000: 0x4010104,
      0x700000: 0x4010000,
      0x800000: 0x4000000,
      0x900000: 0x4010100,
      0xa00000: 0x10100,
      0xb00000: 0x4010004,
      0xc00000: 0x4000104,
      0xd00000: 0x10000,
      0xe00000: 0x4,
      0xf00000: 0x100,
      0x80000: 0x4010100,
      0x180000: 0x4010004,
      0x280000: 0x0,
      0x380000: 0x4000100,
      0x480000: 0x4000004,
      0x580000: 0x10000,
      0x680000: 0x10004,
      0x780000: 0x104,
      0x880000: 0x4,
      0x980000: 0x100,
      0xa80000: 0x4010000,
      0xb80000: 0x10104,
      0xc80000: 0x10100,
      0xd80000: 0x4000104,
      0xe80000: 0x4010104,
      0xf80000: 0x4000000,
      0x1000000: 0x4010100,
      0x1100000: 0x10004,
      0x1200000: 0x10000,
      0x1300000: 0x4000100,
      0x1400000: 0x100,
      0x1500000: 0x4010104,
      0x1600000: 0x4000004,
      0x1700000: 0x0,
      0x1800000: 0x4000104,
      0x1900000: 0x4000000,
      0x1a00000: 0x4,
      0x1b00000: 0x10100,
      0x1c00000: 0x4010000,
      0x1d00000: 0x104,
      0x1e00000: 0x10104,
      0x1f00000: 0x4010004,
      0x1080000: 0x4000000,
      0x1180000: 0x104,
      0x1280000: 0x4010100,
      0x1380000: 0x0,
      0x1480000: 0x10004,
      0x1580000: 0x4000100,
      0x1680000: 0x100,
      0x1780000: 0x4010004,
      0x1880000: 0x10000,
      0x1980000: 0x4010104,
      0x1a80000: 0x10104,
      0x1b80000: 0x4000004,
      0x1c80000: 0x4000104,
      0x1d80000: 0x4010000,
      0x1e80000: 0x4,
      0x1f80000: 0x10100
    }, {
      0x0: 0x80401000,
      0x10000: 0x80001040,
      0x20000: 0x401040,
      0x30000: 0x80400000,
      0x40000: 0x0,
      0x50000: 0x401000,
      0x60000: 0x80000040,
      0x70000: 0x400040,
      0x80000: 0x80000000,
      0x90000: 0x400000,
      0xa0000: 0x40,
      0xb0000: 0x80001000,
      0xc0000: 0x80400040,
      0xd0000: 0x1040,
      0xe0000: 0x1000,
      0xf0000: 0x80401040,
      0x8000: 0x80001040,
      0x18000: 0x40,
      0x28000: 0x80400040,
      0x38000: 0x80001000,
      0x48000: 0x401000,
      0x58000: 0x80401040,
      0x68000: 0x0,
      0x78000: 0x80400000,
      0x88000: 0x1000,
      0x98000: 0x80401000,
      0xa8000: 0x400000,
      0xb8000: 0x1040,
      0xc8000: 0x80000000,
      0xd8000: 0x400040,
      0xe8000: 0x401040,
      0xf8000: 0x80000040,
      0x100000: 0x400040,
      0x110000: 0x401000,
      0x120000: 0x80000040,
      0x130000: 0x0,
      0x140000: 0x1040,
      0x150000: 0x80400040,
      0x160000: 0x80401000,
      0x170000: 0x80001040,
      0x180000: 0x80401040,
      0x190000: 0x80000000,
      0x1a0000: 0x80400000,
      0x1b0000: 0x401040,
      0x1c0000: 0x80001000,
      0x1d0000: 0x400000,
      0x1e0000: 0x40,
      0x1f0000: 0x1000,
      0x108000: 0x80400000,
      0x118000: 0x80401040,
      0x128000: 0x0,
      0x138000: 0x401000,
      0x148000: 0x400040,
      0x158000: 0x80000000,
      0x168000: 0x80001040,
      0x178000: 0x40,
      0x188000: 0x80000040,
      0x198000: 0x1000,
      0x1a8000: 0x80001000,
      0x1b8000: 0x80400040,
      0x1c8000: 0x1040,
      0x1d8000: 0x80401000,
      0x1e8000: 0x400000,
      0x1f8000: 0x401040
    }, {
      0x0: 0x80,
      0x1000: 0x1040000,
      0x2000: 0x40000,
      0x3000: 0x20000000,
      0x4000: 0x20040080,
      0x5000: 0x1000080,
      0x6000: 0x21000080,
      0x7000: 0x40080,
      0x8000: 0x1000000,
      0x9000: 0x20040000,
      0xa000: 0x20000080,
      0xb000: 0x21040080,
      0xc000: 0x21040000,
      0xd000: 0x0,
      0xe000: 0x1040080,
      0xf000: 0x21000000,
      0x800: 0x1040080,
      0x1800: 0x21000080,
      0x2800: 0x80,
      0x3800: 0x1040000,
      0x4800: 0x40000,
      0x5800: 0x20040080,
      0x6800: 0x21040000,
      0x7800: 0x20000000,
      0x8800: 0x20040000,
      0x9800: 0x0,
      0xa800: 0x21040080,
      0xb800: 0x1000080,
      0xc800: 0x20000080,
      0xd800: 0x21000000,
      0xe800: 0x1000000,
      0xf800: 0x40080,
      0x10000: 0x40000,
      0x11000: 0x80,
      0x12000: 0x20000000,
      0x13000: 0x21000080,
      0x14000: 0x1000080,
      0x15000: 0x21040000,
      0x16000: 0x20040080,
      0x17000: 0x1000000,
      0x18000: 0x21040080,
      0x19000: 0x21000000,
      0x1a000: 0x1040000,
      0x1b000: 0x20040000,
      0x1c000: 0x40080,
      0x1d000: 0x20000080,
      0x1e000: 0x0,
      0x1f000: 0x1040080,
      0x10800: 0x21000080,
      0x11800: 0x1000000,
      0x12800: 0x1040000,
      0x13800: 0x20040080,
      0x14800: 0x20000000,
      0x15800: 0x1040080,
      0x16800: 0x80,
      0x17800: 0x21040000,
      0x18800: 0x40080,
      0x19800: 0x21040080,
      0x1a800: 0x0,
      0x1b800: 0x21000000,
      0x1c800: 0x1000080,
      0x1d800: 0x40000,
      0x1e800: 0x20040000,
      0x1f800: 0x20000080
    }, {
      0x0: 0x10000008,
      0x100: 0x2000,
      0x200: 0x10200000,
      0x300: 0x10202008,
      0x400: 0x10002000,
      0x500: 0x200000,
      0x600: 0x200008,
      0x700: 0x10000000,
      0x800: 0x0,
      0x900: 0x10002008,
      0xa00: 0x202000,
      0xb00: 0x8,
      0xc00: 0x10200008,
      0xd00: 0x202008,
      0xe00: 0x2008,
      0xf00: 0x10202000,
      0x80: 0x10200000,
      0x180: 0x10202008,
      0x280: 0x8,
      0x380: 0x200000,
      0x480: 0x202008,
      0x580: 0x10000008,
      0x680: 0x10002000,
      0x780: 0x2008,
      0x880: 0x200008,
      0x980: 0x2000,
      0xa80: 0x10002008,
      0xb80: 0x10200008,
      0xc80: 0x0,
      0xd80: 0x10202000,
      0xe80: 0x202000,
      0xf80: 0x10000000,
      0x1000: 0x10002000,
      0x1100: 0x10200008,
      0x1200: 0x10202008,
      0x1300: 0x2008,
      0x1400: 0x200000,
      0x1500: 0x10000000,
      0x1600: 0x10000008,
      0x1700: 0x202000,
      0x1800: 0x202008,
      0x1900: 0x0,
      0x1a00: 0x8,
      0x1b00: 0x10200000,
      0x1c00: 0x2000,
      0x1d00: 0x10002008,
      0x1e00: 0x10202000,
      0x1f00: 0x200008,
      0x1080: 0x8,
      0x1180: 0x202000,
      0x1280: 0x200000,
      0x1380: 0x10000008,
      0x1480: 0x10002000,
      0x1580: 0x2008,
      0x1680: 0x10202008,
      0x1780: 0x10200000,
      0x1880: 0x10202000,
      0x1980: 0x10200008,
      0x1a80: 0x2000,
      0x1b80: 0x202008,
      0x1c80: 0x200008,
      0x1d80: 0x0,
      0x1e80: 0x10000000,
      0x1f80: 0x10002008
    }, {
      0x0: 0x100000,
      0x10: 0x2000401,
      0x20: 0x400,
      0x30: 0x100401,
      0x40: 0x2100401,
      0x50: 0x0,
      0x60: 0x1,
      0x70: 0x2100001,
      0x80: 0x2000400,
      0x90: 0x100001,
      0xa0: 0x2000001,
      0xb0: 0x2100400,
      0xc0: 0x2100000,
      0xd0: 0x401,
      0xe0: 0x100400,
      0xf0: 0x2000000,
      0x8: 0x2100001,
      0x18: 0x0,
      0x28: 0x2000401,
      0x38: 0x2100400,
      0x48: 0x100000,
      0x58: 0x2000001,
      0x68: 0x2000000,
      0x78: 0x401,
      0x88: 0x100401,
      0x98: 0x2000400,
      0xa8: 0x2100000,
      0xb8: 0x100001,
      0xc8: 0x400,
      0xd8: 0x2100401,
      0xe8: 0x1,
      0xf8: 0x100400,
      0x100: 0x2000000,
      0x110: 0x100000,
      0x120: 0x2000401,
      0x130: 0x2100001,
      0x140: 0x100001,
      0x150: 0x2000400,
      0x160: 0x2100400,
      0x170: 0x100401,
      0x180: 0x401,
      0x190: 0x2100401,
      0x1a0: 0x100400,
      0x1b0: 0x1,
      0x1c0: 0x0,
      0x1d0: 0x2100000,
      0x1e0: 0x2000001,
      0x1f0: 0x400,
      0x108: 0x100400,
      0x118: 0x2000401,
      0x128: 0x2100001,
      0x138: 0x1,
      0x148: 0x2000000,
      0x158: 0x100000,
      0x168: 0x401,
      0x178: 0x2100400,
      0x188: 0x2000001,
      0x198: 0x2100000,
      0x1a8: 0x0,
      0x1b8: 0x2100401,
      0x1c8: 0x100401,
      0x1d8: 0x400,
      0x1e8: 0x2000400,
      0x1f8: 0x100001
    }, {
      0x0: 0x8000820,
      0x1: 0x20000,
      0x2: 0x8000000,
      0x3: 0x20,
      0x4: 0x20020,
      0x5: 0x8020820,
      0x6: 0x8020800,
      0x7: 0x800,
      0x8: 0x8020000,
      0x9: 0x8000800,
      0xa: 0x20800,
      0xb: 0x8020020,
      0xc: 0x820,
      0xd: 0x0,
      0xe: 0x8000020,
      0xf: 0x20820,
      0x80000000: 0x800,
      0x80000001: 0x8020820,
      0x80000002: 0x8000820,
      0x80000003: 0x8000000,
      0x80000004: 0x8020000,
      0x80000005: 0x20800,
      0x80000006: 0x20820,
      0x80000007: 0x20,
      0x80000008: 0x8000020,
      0x80000009: 0x820,
      0x8000000a: 0x20020,
      0x8000000b: 0x8020800,
      0x8000000c: 0x0,
      0x8000000d: 0x8020020,
      0x8000000e: 0x8000800,
      0x8000000f: 0x20000,
      0x10: 0x20820,
      0x11: 0x8020800,
      0x12: 0x20,
      0x13: 0x800,
      0x14: 0x8000800,
      0x15: 0x8000020,
      0x16: 0x8020020,
      0x17: 0x20000,
      0x18: 0x0,
      0x19: 0x20020,
      0x1a: 0x8020000,
      0x1b: 0x8000820,
      0x1c: 0x8020820,
      0x1d: 0x20800,
      0x1e: 0x820,
      0x1f: 0x8000000,
      0x80000010: 0x20000,
      0x80000011: 0x800,
      0x80000012: 0x8020020,
      0x80000013: 0x20820,
      0x80000014: 0x20,
      0x80000015: 0x8020000,
      0x80000016: 0x8000000,
      0x80000017: 0x8000820,
      0x80000018: 0x8020820,
      0x80000019: 0x8000020,
      0x8000001a: 0x8000800,
      0x8000001b: 0x0,
      0x8000001c: 0x20800,
      0x8000001d: 0x820,
      0x8000001e: 0x20020,
      0x8000001f: 0x8020800
    }];

    // Masks that select the SBOX input
    var SBOX_MASK = [0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f];

    /**
     * DES block cipher algorithm.
     */
    var DES = C_algo.DES = BlockCipher.extend({
      _doReset: function () {
        // Shortcuts
        var key = this._key;
        var keyWords = key.words;

        // Select 56 bits according to PC1
        var keyBits = [];
        for (var i = 0; i < 56; i++) {
          var keyBitPos = PC1[i] - 1;
          keyBits[i] = keyWords[keyBitPos >>> 5] >>> 31 - keyBitPos % 32 & 1;
        }

        // Assemble 16 subkeys
        var subKeys = this._subKeys = [];
        for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
          // Create subkey
          var subKey = subKeys[nSubKey] = [];

          // Shortcut
          var bitShift = BIT_SHIFTS[nSubKey];

          // Select 48 bits according to PC2
          for (var i = 0; i < 24; i++) {
            // Select from the left 28 key bits
            subKey[i / 6 | 0] |= keyBits[(PC2[i] - 1 + bitShift) % 28] << 31 - i % 6;

            // Select from the right 28 key bits
            subKey[4 + (i / 6 | 0)] |= keyBits[28 + (PC2[i + 24] - 1 + bitShift) % 28] << 31 - i % 6;
          }

          // Since each subkey is applied to an expanded 32-bit input,
          // the subkey can be broken into 8 values scaled to 32-bits,
          // which allows the key to be used without expansion
          subKey[0] = subKey[0] << 1 | subKey[0] >>> 31;
          for (var i = 1; i < 7; i++) {
            subKey[i] = subKey[i] >>> (i - 1) * 4 + 3;
          }
          subKey[7] = subKey[7] << 5 | subKey[7] >>> 27;
        }

        // Compute inverse subkeys
        var invSubKeys = this._invSubKeys = [];
        for (var i = 0; i < 16; i++) {
          invSubKeys[i] = subKeys[15 - i];
        }
      },
      encryptBlock: function (M, offset) {
        this._doCryptBlock(M, offset, this._subKeys);
      },
      decryptBlock: function (M, offset) {
        this._doCryptBlock(M, offset, this._invSubKeys);
      },
      _doCryptBlock: function (M, offset, subKeys) {
        // Get input
        this._lBlock = M[offset];
        this._rBlock = M[offset + 1];

        // Initial permutation
        exchangeLR.call(this, 4, 0x0f0f0f0f);
        exchangeLR.call(this, 16, 0x0000ffff);
        exchangeRL.call(this, 2, 0x33333333);
        exchangeRL.call(this, 8, 0x00ff00ff);
        exchangeLR.call(this, 1, 0x55555555);

        // Rounds
        for (var round = 0; round < 16; round++) {
          // Shortcuts
          var subKey = subKeys[round];
          var lBlock = this._lBlock;
          var rBlock = this._rBlock;

          // Feistel function
          var f = 0;
          for (var i = 0; i < 8; i++) {
            f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
          }
          this._lBlock = rBlock;
          this._rBlock = lBlock ^ f;
        }

        // Undo swap from last round
        var t = this._lBlock;
        this._lBlock = this._rBlock;
        this._rBlock = t;

        // Final permutation
        exchangeLR.call(this, 1, 0x55555555);
        exchangeRL.call(this, 8, 0x00ff00ff);
        exchangeRL.call(this, 2, 0x33333333);
        exchangeLR.call(this, 16, 0x0000ffff);
        exchangeLR.call(this, 4, 0x0f0f0f0f);

        // Set output
        M[offset] = this._lBlock;
        M[offset + 1] = this._rBlock;
      },
      keySize: 64 / 32,
      ivSize: 64 / 32,
      blockSize: 64 / 32
    });

    // Swap bits across the left and right words
    function exchangeLR(offset, mask) {
      var t = (this._lBlock >>> offset ^ this._rBlock) & mask;
      this._rBlock ^= t;
      this._lBlock ^= t << offset;
    }
    function exchangeRL(offset, mask) {
      var t = (this._rBlock >>> offset ^ this._lBlock) & mask;
      this._lBlock ^= t;
      this._rBlock ^= t << offset;
    }

    /**
     * Shortcut functions to the cipher's object interface.
     *
     * @example
     *
     *     var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
     *     var plaintext  = CryptoJS.DES.decrypt(ciphertext, key, cfg);
     */
    C.DES = BlockCipher._createHelper(DES);

    /**
     * Triple-DES block cipher algorithm.
     */
    var TripleDES = C_algo.TripleDES = BlockCipher.extend({
      _doReset: function () {
        // Shortcuts
        var key = this._key;
        var keyWords = key.words;
        // Make sure the key length is valid (64, 128 or >= 192 bit)
        if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
          throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');
        }

        // Extend the key according to the keying options defined in 3DES standard
        var key1 = keyWords.slice(0, 2);
        var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
        var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);

        // Create DES instances
        this._des1 = DES.createEncryptor(WordArray.create(key1));
        this._des2 = DES.createEncryptor(WordArray.create(key2));
        this._des3 = DES.createEncryptor(WordArray.create(key3));
      },
      encryptBlock: function (M, offset) {
        this._des1.encryptBlock(M, offset);
        this._des2.decryptBlock(M, offset);
        this._des3.encryptBlock(M, offset);
      },
      decryptBlock: function (M, offset) {
        this._des3.decryptBlock(M, offset);
        this._des2.encryptBlock(M, offset);
        this._des1.decryptBlock(M, offset);
      },
      keySize: 192 / 32,
      ivSize: 64 / 32,
      blockSize: 64 / 32
    });

    /**
     * Shortcut functions to the cipher's object interface.
     *
     * @example
     *
     *     var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
     *     var plaintext  = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
     */
    C.TripleDES = BlockCipher._createHelper(TripleDES);
  })();
  return CryptoJS.TripleDES;
});
});

var rc4 = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, encBase64, md5, evpkdf, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var StreamCipher = C_lib.StreamCipher;
    var C_algo = C.algo;

    /**
     * RC4 stream cipher algorithm.
     */
    var RC4 = C_algo.RC4 = StreamCipher.extend({
      _doReset: function () {
        // Shortcuts
        var key = this._key;
        var keyWords = key.words;
        var keySigBytes = key.sigBytes;

        // Init sbox
        var S = this._S = [];
        for (var i = 0; i < 256; i++) {
          S[i] = i;
        }

        // Key setup
        for (var i = 0, j = 0; i < 256; i++) {
          var keyByteIndex = i % keySigBytes;
          var keyByte = keyWords[keyByteIndex >>> 2] >>> 24 - keyByteIndex % 4 * 8 & 0xff;
          j = (j + S[i] + keyByte) % 256;

          // Swap
          var t = S[i];
          S[i] = S[j];
          S[j] = t;
        }

        // Counters
        this._i = this._j = 0;
      },
      _doProcessBlock: function (M, offset) {
        M[offset] ^= generateKeystreamWord.call(this);
      },
      keySize: 256 / 32,
      ivSize: 0
    });
    function generateKeystreamWord() {
      // Shortcuts
      var S = this._S;
      var i = this._i;
      var j = this._j;

      // Generate keystream word
      var keystreamWord = 0;
      for (var n = 0; n < 4; n++) {
        i = (i + 1) % 256;
        j = (j + S[i]) % 256;

        // Swap
        var t = S[i];
        S[i] = S[j];
        S[j] = t;
        keystreamWord |= S[(S[i] + S[j]) % 256] << 24 - n * 8;
      }

      // Update counters
      this._i = i;
      this._j = j;
      return keystreamWord;
    }

    /**
     * Shortcut functions to the cipher's object interface.
     *
     * @example
     *
     *     var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
     *     var plaintext  = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
     */
    C.RC4 = StreamCipher._createHelper(RC4);

    /**
     * Modified RC4 stream cipher algorithm.
     */
    var RC4Drop = C_algo.RC4Drop = RC4.extend({
      /**
       * Configuration options.
       *
       * @property {number} drop The number of keystream words to drop. Default 192
       */
      cfg: RC4.cfg.extend({
        drop: 192
      }),
      _doReset: function () {
        RC4._doReset.call(this);

        // Drop
        for (var i = this.cfg.drop; i > 0; i--) {
          generateKeystreamWord.call(this);
        }
      }
    });

    /**
     * Shortcut functions to the cipher's object interface.
     *
     * @example
     *
     *     var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
     *     var plaintext  = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
     */
    C.RC4Drop = StreamCipher._createHelper(RC4Drop);
  })();
  return CryptoJS.RC4;
});
});

var rabbit = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, encBase64, md5, evpkdf, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var StreamCipher = C_lib.StreamCipher;
    var C_algo = C.algo;

    // Reusable objects
    var S = [];
    var C_ = [];
    var G = [];

    /**
     * Rabbit stream cipher algorithm
     */
    var Rabbit = C_algo.Rabbit = StreamCipher.extend({
      _doReset: function () {
        // Shortcuts
        var K = this._key.words;
        var iv = this.cfg.iv;

        // Swap endian
        for (var i = 0; i < 4; i++) {
          K[i] = (K[i] << 8 | K[i] >>> 24) & 0x00ff00ff | (K[i] << 24 | K[i] >>> 8) & 0xff00ff00;
        }

        // Generate initial state values
        var X = this._X = [K[0], K[3] << 16 | K[2] >>> 16, K[1], K[0] << 16 | K[3] >>> 16, K[2], K[1] << 16 | K[0] >>> 16, K[3], K[2] << 16 | K[1] >>> 16];

        // Generate initial counter values
        var C = this._C = [K[2] << 16 | K[2] >>> 16, K[0] & 0xffff0000 | K[1] & 0x0000ffff, K[3] << 16 | K[3] >>> 16, K[1] & 0xffff0000 | K[2] & 0x0000ffff, K[0] << 16 | K[0] >>> 16, K[2] & 0xffff0000 | K[3] & 0x0000ffff, K[1] << 16 | K[1] >>> 16, K[3] & 0xffff0000 | K[0] & 0x0000ffff];

        // Carry bit
        this._b = 0;

        // Iterate the system four times
        for (var i = 0; i < 4; i++) {
          nextState.call(this);
        }

        // Modify the counters
        for (var i = 0; i < 8; i++) {
          C[i] ^= X[i + 4 & 7];
        }

        // IV setup
        if (iv) {
          // Shortcuts
          var IV = iv.words;
          var IV_0 = IV[0];
          var IV_1 = IV[1];

          // Generate four subvectors
          var i0 = (IV_0 << 8 | IV_0 >>> 24) & 0x00ff00ff | (IV_0 << 24 | IV_0 >>> 8) & 0xff00ff00;
          var i2 = (IV_1 << 8 | IV_1 >>> 24) & 0x00ff00ff | (IV_1 << 24 | IV_1 >>> 8) & 0xff00ff00;
          var i1 = i0 >>> 16 | i2 & 0xffff0000;
          var i3 = i2 << 16 | i0 & 0x0000ffff;

          // Modify counter values
          C[0] ^= i0;
          C[1] ^= i1;
          C[2] ^= i2;
          C[3] ^= i3;
          C[4] ^= i0;
          C[5] ^= i1;
          C[6] ^= i2;
          C[7] ^= i3;

          // Iterate the system four times
          for (var i = 0; i < 4; i++) {
            nextState.call(this);
          }
        }
      },
      _doProcessBlock: function (M, offset) {
        // Shortcut
        var X = this._X;

        // Iterate the system
        nextState.call(this);

        // Generate four keystream words
        S[0] = X[0] ^ X[5] >>> 16 ^ X[3] << 16;
        S[1] = X[2] ^ X[7] >>> 16 ^ X[5] << 16;
        S[2] = X[4] ^ X[1] >>> 16 ^ X[7] << 16;
        S[3] = X[6] ^ X[3] >>> 16 ^ X[1] << 16;
        for (var i = 0; i < 4; i++) {
          // Swap endian
          S[i] = (S[i] << 8 | S[i] >>> 24) & 0x00ff00ff | (S[i] << 24 | S[i] >>> 8) & 0xff00ff00;

          // Encrypt
          M[offset + i] ^= S[i];
        }
      },
      blockSize: 128 / 32,
      ivSize: 64 / 32
    });
    function nextState() {
      // Shortcuts
      var X = this._X;
      var C = this._C;

      // Save old counter values
      for (var i = 0; i < 8; i++) {
        C_[i] = C[i];
      }

      // Calculate new counter values
      C[0] = C[0] + 0x4d34d34d + this._b | 0;
      C[1] = C[1] + 0xd34d34d3 + (C[0] >>> 0 < C_[0] >>> 0 ? 1 : 0) | 0;
      C[2] = C[2] + 0x34d34d34 + (C[1] >>> 0 < C_[1] >>> 0 ? 1 : 0) | 0;
      C[3] = C[3] + 0x4d34d34d + (C[2] >>> 0 < C_[2] >>> 0 ? 1 : 0) | 0;
      C[4] = C[4] + 0xd34d34d3 + (C[3] >>> 0 < C_[3] >>> 0 ? 1 : 0) | 0;
      C[5] = C[5] + 0x34d34d34 + (C[4] >>> 0 < C_[4] >>> 0 ? 1 : 0) | 0;
      C[6] = C[6] + 0x4d34d34d + (C[5] >>> 0 < C_[5] >>> 0 ? 1 : 0) | 0;
      C[7] = C[7] + 0xd34d34d3 + (C[6] >>> 0 < C_[6] >>> 0 ? 1 : 0) | 0;
      this._b = C[7] >>> 0 < C_[7] >>> 0 ? 1 : 0;

      // Calculate the g-values
      for (var i = 0; i < 8; i++) {
        var gx = X[i] + C[i];

        // Construct high and low argument for squaring
        var ga = gx & 0xffff;
        var gb = gx >>> 16;

        // Calculate high and low result of squaring
        var gh = ((ga * ga >>> 17) + ga * gb >>> 15) + gb * gb;
        var gl = ((gx & 0xffff0000) * gx | 0) + ((gx & 0x0000ffff) * gx | 0);

        // High XOR low
        G[i] = gh ^ gl;
      }

      // Calculate new state values
      X[0] = G[0] + (G[7] << 16 | G[7] >>> 16) + (G[6] << 16 | G[6] >>> 16) | 0;
      X[1] = G[1] + (G[0] << 8 | G[0] >>> 24) + G[7] | 0;
      X[2] = G[2] + (G[1] << 16 | G[1] >>> 16) + (G[0] << 16 | G[0] >>> 16) | 0;
      X[3] = G[3] + (G[2] << 8 | G[2] >>> 24) + G[1] | 0;
      X[4] = G[4] + (G[3] << 16 | G[3] >>> 16) + (G[2] << 16 | G[2] >>> 16) | 0;
      X[5] = G[5] + (G[4] << 8 | G[4] >>> 24) + G[3] | 0;
      X[6] = G[6] + (G[5] << 16 | G[5] >>> 16) + (G[4] << 16 | G[4] >>> 16) | 0;
      X[7] = G[7] + (G[6] << 8 | G[6] >>> 24) + G[5] | 0;
    }

    /**
     * Shortcut functions to the cipher's object interface.
     *
     * @example
     *
     *     var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
     *     var plaintext  = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
     */
    C.Rabbit = StreamCipher._createHelper(Rabbit);
  })();
  return CryptoJS.Rabbit;
});
});

var rabbitLegacy = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, encBase64, md5, evpkdf, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var StreamCipher = C_lib.StreamCipher;
    var C_algo = C.algo;

    // Reusable objects
    var S = [];
    var C_ = [];
    var G = [];

    /**
     * Rabbit stream cipher algorithm.
     *
     * This is a legacy version that neglected to convert the key to little-endian.
     * This error doesn't affect the cipher's security,
     * but it does affect its compatibility with other implementations.
     */
    var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
      _doReset: function () {
        // Shortcuts
        var K = this._key.words;
        var iv = this.cfg.iv;

        // Generate initial state values
        var X = this._X = [K[0], K[3] << 16 | K[2] >>> 16, K[1], K[0] << 16 | K[3] >>> 16, K[2], K[1] << 16 | K[0] >>> 16, K[3], K[2] << 16 | K[1] >>> 16];

        // Generate initial counter values
        var C = this._C = [K[2] << 16 | K[2] >>> 16, K[0] & 0xffff0000 | K[1] & 0x0000ffff, K[3] << 16 | K[3] >>> 16, K[1] & 0xffff0000 | K[2] & 0x0000ffff, K[0] << 16 | K[0] >>> 16, K[2] & 0xffff0000 | K[3] & 0x0000ffff, K[1] << 16 | K[1] >>> 16, K[3] & 0xffff0000 | K[0] & 0x0000ffff];

        // Carry bit
        this._b = 0;

        // Iterate the system four times
        for (var i = 0; i < 4; i++) {
          nextState.call(this);
        }

        // Modify the counters
        for (var i = 0; i < 8; i++) {
          C[i] ^= X[i + 4 & 7];
        }

        // IV setup
        if (iv) {
          // Shortcuts
          var IV = iv.words;
          var IV_0 = IV[0];
          var IV_1 = IV[1];

          // Generate four subvectors
          var i0 = (IV_0 << 8 | IV_0 >>> 24) & 0x00ff00ff | (IV_0 << 24 | IV_0 >>> 8) & 0xff00ff00;
          var i2 = (IV_1 << 8 | IV_1 >>> 24) & 0x00ff00ff | (IV_1 << 24 | IV_1 >>> 8) & 0xff00ff00;
          var i1 = i0 >>> 16 | i2 & 0xffff0000;
          var i3 = i2 << 16 | i0 & 0x0000ffff;

          // Modify counter values
          C[0] ^= i0;
          C[1] ^= i1;
          C[2] ^= i2;
          C[3] ^= i3;
          C[4] ^= i0;
          C[5] ^= i1;
          C[6] ^= i2;
          C[7] ^= i3;

          // Iterate the system four times
          for (var i = 0; i < 4; i++) {
            nextState.call(this);
          }
        }
      },
      _doProcessBlock: function (M, offset) {
        // Shortcut
        var X = this._X;

        // Iterate the system
        nextState.call(this);

        // Generate four keystream words
        S[0] = X[0] ^ X[5] >>> 16 ^ X[3] << 16;
        S[1] = X[2] ^ X[7] >>> 16 ^ X[5] << 16;
        S[2] = X[4] ^ X[1] >>> 16 ^ X[7] << 16;
        S[3] = X[6] ^ X[3] >>> 16 ^ X[1] << 16;
        for (var i = 0; i < 4; i++) {
          // Swap endian
          S[i] = (S[i] << 8 | S[i] >>> 24) & 0x00ff00ff | (S[i] << 24 | S[i] >>> 8) & 0xff00ff00;

          // Encrypt
          M[offset + i] ^= S[i];
        }
      },
      blockSize: 128 / 32,
      ivSize: 64 / 32
    });
    function nextState() {
      // Shortcuts
      var X = this._X;
      var C = this._C;

      // Save old counter values
      for (var i = 0; i < 8; i++) {
        C_[i] = C[i];
      }

      // Calculate new counter values
      C[0] = C[0] + 0x4d34d34d + this._b | 0;
      C[1] = C[1] + 0xd34d34d3 + (C[0] >>> 0 < C_[0] >>> 0 ? 1 : 0) | 0;
      C[2] = C[2] + 0x34d34d34 + (C[1] >>> 0 < C_[1] >>> 0 ? 1 : 0) | 0;
      C[3] = C[3] + 0x4d34d34d + (C[2] >>> 0 < C_[2] >>> 0 ? 1 : 0) | 0;
      C[4] = C[4] + 0xd34d34d3 + (C[3] >>> 0 < C_[3] >>> 0 ? 1 : 0) | 0;
      C[5] = C[5] + 0x34d34d34 + (C[4] >>> 0 < C_[4] >>> 0 ? 1 : 0) | 0;
      C[6] = C[6] + 0x4d34d34d + (C[5] >>> 0 < C_[5] >>> 0 ? 1 : 0) | 0;
      C[7] = C[7] + 0xd34d34d3 + (C[6] >>> 0 < C_[6] >>> 0 ? 1 : 0) | 0;
      this._b = C[7] >>> 0 < C_[7] >>> 0 ? 1 : 0;

      // Calculate the g-values
      for (var i = 0; i < 8; i++) {
        var gx = X[i] + C[i];

        // Construct high and low argument for squaring
        var ga = gx & 0xffff;
        var gb = gx >>> 16;

        // Calculate high and low result of squaring
        var gh = ((ga * ga >>> 17) + ga * gb >>> 15) + gb * gb;
        var gl = ((gx & 0xffff0000) * gx | 0) + ((gx & 0x0000ffff) * gx | 0);

        // High XOR low
        G[i] = gh ^ gl;
      }

      // Calculate new state values
      X[0] = G[0] + (G[7] << 16 | G[7] >>> 16) + (G[6] << 16 | G[6] >>> 16) | 0;
      X[1] = G[1] + (G[0] << 8 | G[0] >>> 24) + G[7] | 0;
      X[2] = G[2] + (G[1] << 16 | G[1] >>> 16) + (G[0] << 16 | G[0] >>> 16) | 0;
      X[3] = G[3] + (G[2] << 8 | G[2] >>> 24) + G[1] | 0;
      X[4] = G[4] + (G[3] << 16 | G[3] >>> 16) + (G[2] << 16 | G[2] >>> 16) | 0;
      X[5] = G[5] + (G[4] << 8 | G[4] >>> 24) + G[3] | 0;
      X[6] = G[6] + (G[5] << 16 | G[5] >>> 16) + (G[4] << 16 | G[4] >>> 16) | 0;
      X[7] = G[7] + (G[6] << 8 | G[6] >>> 24) + G[5] | 0;
    }

    /**
     * Shortcut functions to the cipher's object interface.
     *
     * @example
     *
     *     var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
     *     var plaintext  = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
     */
    C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
  })();
  return CryptoJS.RabbitLegacy;
});
});

var blowfish = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, encBase64, md5, evpkdf, cipherCore);
  }
})(commonjsGlobal, function (CryptoJS) {
  (function () {
    // Shortcuts
    var C = CryptoJS;
    var C_lib = C.lib;
    var BlockCipher = C_lib.BlockCipher;
    var C_algo = C.algo;
    const N = 16;

    //Origin pbox and sbox, derived from PI
    const ORIG_P = [0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917, 0x9216D5D9, 0x8979FB1B];
    const ORIG_S = [[0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7, 0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99, 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16, 0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E, 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE, 0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013, 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF, 0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E, 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60, 0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440, 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE, 0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A, 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E, 0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677, 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193, 0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032, 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88, 0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239, 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E, 0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0, 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3, 0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98, 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88, 0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE, 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6, 0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D, 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B, 0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7, 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA, 0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463, 0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F, 0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09, 0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3, 0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB, 0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279, 0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8, 0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB, 0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82, 0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB, 0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573, 0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0, 0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B, 0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790, 0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8, 0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4, 0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0, 0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7, 0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C, 0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD, 0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1, 0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299, 0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9, 0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477, 0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF, 0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49, 0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF, 0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA, 0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5, 0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41, 0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915, 0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400, 0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915, 0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664, 0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A], [0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623, 0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266, 0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1, 0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E, 0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6, 0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1, 0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E, 0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1, 0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737, 0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8, 0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF, 0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD, 0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701, 0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7, 0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41, 0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331, 0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF, 0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF, 0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E, 0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87, 0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C, 0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2, 0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16, 0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD, 0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B, 0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509, 0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E, 0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3, 0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F, 0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A, 0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4, 0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960, 0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66, 0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28, 0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802, 0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84, 0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510, 0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF, 0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14, 0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E, 0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50, 0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7, 0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8, 0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281, 0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99, 0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696, 0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128, 0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73, 0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0, 0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0, 0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105, 0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250, 0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3, 0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285, 0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00, 0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061, 0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB, 0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E, 0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735, 0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC, 0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9, 0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340, 0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20, 0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7], [0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934, 0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068, 0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF, 0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840, 0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45, 0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504, 0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A, 0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB, 0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE, 0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6, 0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42, 0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B, 0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2, 0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB, 0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527, 0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B, 0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33, 0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C, 0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3, 0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC, 0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17, 0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564, 0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B, 0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115, 0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922, 0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728, 0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0, 0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E, 0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37, 0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D, 0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804, 0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B, 0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3, 0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB, 0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D, 0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C, 0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350, 0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9, 0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A, 0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE, 0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D, 0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC, 0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F, 0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61, 0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2, 0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9, 0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2, 0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C, 0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E, 0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633, 0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10, 0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169, 0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52, 0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027, 0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5, 0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62, 0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634, 0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76, 0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24, 0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC, 0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4, 0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C, 0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837, 0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0], [0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B, 0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE, 0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B, 0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4, 0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8, 0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6, 0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304, 0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22, 0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4, 0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6, 0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9, 0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59, 0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593, 0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51, 0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28, 0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C, 0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B, 0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28, 0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C, 0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD, 0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A, 0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319, 0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB, 0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F, 0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991, 0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32, 0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680, 0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166, 0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE, 0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB, 0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5, 0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47, 0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370, 0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D, 0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84, 0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048, 0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8, 0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD, 0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9, 0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7, 0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38, 0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F, 0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C, 0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525, 0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1, 0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442, 0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964, 0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E, 0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8, 0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D, 0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F, 0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299, 0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02, 0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC, 0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614, 0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A, 0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6, 0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B, 0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0, 0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060, 0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E, 0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9, 0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F, 0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6]];
    var BLOWFISH_CTX = {
      pbox: [],
      sbox: []
    };
    function F(ctx, x) {
      let a = x >> 24 & 0xFF;
      let b = x >> 16 & 0xFF;
      let c = x >> 8 & 0xFF;
      let d = x & 0xFF;
      let y = ctx.sbox[0][a] + ctx.sbox[1][b];
      y = y ^ ctx.sbox[2][c];
      y = y + ctx.sbox[3][d];
      return y;
    }
    function BlowFish_Encrypt(ctx, left, right) {
      let Xl = left;
      let Xr = right;
      let temp;
      for (let i = 0; i < N; ++i) {
        Xl = Xl ^ ctx.pbox[i];
        Xr = F(ctx, Xl) ^ Xr;
        temp = Xl;
        Xl = Xr;
        Xr = temp;
      }
      temp = Xl;
      Xl = Xr;
      Xr = temp;
      Xr = Xr ^ ctx.pbox[N];
      Xl = Xl ^ ctx.pbox[N + 1];
      return {
        left: Xl,
        right: Xr
      };
    }
    function BlowFish_Decrypt(ctx, left, right) {
      let Xl = left;
      let Xr = right;
      let temp;
      for (let i = N + 1; i > 1; --i) {
        Xl = Xl ^ ctx.pbox[i];
        Xr = F(ctx, Xl) ^ Xr;
        temp = Xl;
        Xl = Xr;
        Xr = temp;
      }
      temp = Xl;
      Xl = Xr;
      Xr = temp;
      Xr = Xr ^ ctx.pbox[1];
      Xl = Xl ^ ctx.pbox[0];
      return {
        left: Xl,
        right: Xr
      };
    }

    /**
     * Initialization ctx's pbox and sbox.
     *
     * @param {Object} ctx The object has pbox and sbox.
     * @param {Array} key An array of 32-bit words.
     * @param {int} keysize The length of the key.
     *
     * @example
     *
     *     BlowFishInit(BLOWFISH_CTX, key, 128/32);
     */
    function BlowFishInit(ctx, key, keysize) {
      for (let Row = 0; Row < 4; Row++) {
        ctx.sbox[Row] = [];
        for (let Col = 0; Col < 256; Col++) {
          ctx.sbox[Row][Col] = ORIG_S[Row][Col];
        }
      }
      let keyIndex = 0;
      for (let index = 0; index < N + 2; index++) {
        ctx.pbox[index] = ORIG_P[index] ^ key[keyIndex];
        keyIndex++;
        if (keyIndex >= keysize) {
          keyIndex = 0;
        }
      }
      let Data1 = 0;
      let Data2 = 0;
      let res = 0;
      for (let i = 0; i < N + 2; i += 2) {
        res = BlowFish_Encrypt(ctx, Data1, Data2);
        Data1 = res.left;
        Data2 = res.right;
        ctx.pbox[i] = Data1;
        ctx.pbox[i + 1] = Data2;
      }
      for (let i = 0; i < 4; i++) {
        for (let j = 0; j < 256; j += 2) {
          res = BlowFish_Encrypt(ctx, Data1, Data2);
          Data1 = res.left;
          Data2 = res.right;
          ctx.sbox[i][j] = Data1;
          ctx.sbox[i][j + 1] = Data2;
        }
      }
      return true;
    }

    /**
     * Blowfish block cipher algorithm.
     */
    var Blowfish = C_algo.Blowfish = BlockCipher.extend({
      _doReset: function () {
        // Skip reset of nRounds has been set before and key did not change
        if (this._keyPriorReset === this._key) {
          return;
        }

        // Shortcuts
        var key = this._keyPriorReset = this._key;
        var keyWords = key.words;
        var keySize = key.sigBytes / 4;

        //Initialization pbox and sbox
        BlowFishInit(BLOWFISH_CTX, keyWords, keySize);
      },
      encryptBlock: function (M, offset) {
        var res = BlowFish_Encrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
        M[offset] = res.left;
        M[offset + 1] = res.right;
      },
      decryptBlock: function (M, offset) {
        var res = BlowFish_Decrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
        M[offset] = res.left;
        M[offset + 1] = res.right;
      },
      blockSize: 64 / 32,
      keySize: 128 / 32,
      ivSize: 64 / 32
    });

    /**
     * Shortcut functions to the cipher's object interface.
     *
     * @example
     *
     *     var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg);
     *     var plaintext  = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg);
     */
    C.Blowfish = BlockCipher._createHelper(Blowfish);
  })();
  return CryptoJS.Blowfish;
});
});

var cryptoJs = createCommonjsModule(function (module, exports) {
(function (root, factory, undef) {
  {
    // CommonJS
    module.exports = factory(core, x64Core, libTypedarrays, encUtf16, encBase64, encBase64url, md5, sha1, sha256, sha224, sha512, sha384, sha3, ripemd160, hmac, pbkdf2, evpkdf, cipherCore, modeCfb, modeCtr, modeCtrGladman, modeOfb, modeEcb, padAnsix923, padIso10126, padIso97971, padZeropadding, padNopadding, formatHex, aes, tripledes, rc4, rabbit, rabbitLegacy, blowfish);
  }
})(commonjsGlobal, function (CryptoJS) {
  return CryptoJS;
});
});

//
const uuid = prefix => {
  const s = [];
  const hexDigits = '0123456789abcdef';
  for (let i = 0; i < 36; i += 1) {
    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
  }
  s[14] = '4';
  s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1);
  const id = s.join('');
  return prefix ? prefix + '__' + id : id;
};

// import CryptoJS from 'crypto-js'
// import RecorderManager from '../processor.worker'
let Base64$1 = require('js-base64').Base64;
// import parser from 'fast-xml-parser'

// let transWorker = new RecorderManager()
//APPID，APISecret，APIKey在控制台-我的应用-语音评测（流式版）页面获取
const APPID$1 = '98fcf4d6';
const API_SECRET$1 = 'Y2FkN2Y1MGZjN2U0M2I1MTU4Y2FlZjA0';
const API_KEY$1 = 'b7e405d6af09050e4a6976f31ec37640';
const recorder$1 = new RecorderManager('/audio/recorder');
var script$5v = {
  name: 'VoicePlayer',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    playStyle: {
      type: String,
      default: 'yuan-wen'
    },
    styleMode: {
      type: String,
      default: 'A'
    },
    url: {
      type: String,
      default: '',
      require: true
    },
    title: {
      type: String,
      default: '音频文件'
    },
    content: {
      type: String,
      default: '暂无简介'
    },
    coverImageUrl: {
      type: String,
      default: ''
    },
    //进度是否能控制
    scheduleControl: {
      type: String,
      default: ''
    },
    loop: {
      type: Boolean,
      default: true
    },
    playMode: {
      type: String,
      default: 'xun-huan'
    },
    targerLink: {
      type: String,
      default: ''
    },
    playerIndex: {
      type: Number,
      default: -1
    }
  },
  data() {
    return {
      textarea: '语音评测',
      playIcon,
      pauseIcon,
      audioIcon,
      coverLocal: coverLocal$1,
      recStartIcon,
      recStopIcon,
      recDelete,
      recMockWave,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      link: {
        type: String,
        default: ''
      },
      //链接地址
      lastOperateTimeStamp: '',
      recordAudio: null,
      permissionDialogVisible: false,
      Rec: recorder_mp3_min,
      type: 'mp3',
      bitRate: 16,
      sampleRate: 16000,
      testSampleRate: 16000,
      rec: null,
      recDuration: 0,
      powerLevel: 0,
      logs: [],
      recBolb: null,
      isRecing: false,
      hasInitSuccess: false,
      waveStore: {
        selected: 'Histogram2',
        WaveView: {},
        Histogram2: {},
        Histogram3: {}
      },
      recordDataUrl: '',
      lastAudioStamp: null,
      lastPlayStamp: null,
      waveBoxKey: uuid('wave'),
      recTimestamp: null,
      iseWS: null,
      SendFrameSize: 1280,
      realTimeSendTryNumber: null,
      transferUploadNumberMax: null,
      realTimeSendTryChunk: null,
      realTimeSendTryChunks: null,
      buffersArr: [],
      audioData: [],
      status: '',
      //
      webSocket: null,
      total: '0',
      accuracy: '0',
      fluency: '0',
      integrity: '0',
      phone: '0',
      tone: '0',
      emotion: '0',
      voicedata: {}
    };
  },
  computed: {
    videoAndMusicStop() {
      let playState = sessionStorage.getItem('SET_PLAY_STATE');
      return playState;
    },
    playModeIconSrc() {
      let srcMap = {
        'xun-huan': playRepeat$1,
        'dan-ci': playOnce$1
      };
      return srcMap[this.playMode];
    },
    controlStatusText() {
      let text = '';
      if (this.recBolb) {
        text = this.isPlay ? '' : '';
      } else {
        text = this.isRecing ? '结束录音' : '开始录音';
      }
      return text;
    }
  },
  watch: {
    url: {
      handler(newVal) {
        let _this = this;
        this.isPlay = false;
        let ua = navigator.userAgent;
        console.log('浏览器 UA', ua);
        /micromessenger/.test(ua.toLowerCase());
        let isIOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        // isWeixin && isIOS && newVal && this.$message({
        //   message: `当前UA为${ua}`,
        //   duration: 3000
        // })
        if (isIOS && newVal) {
          try {
            this.$nextTick(() => {
              _this.$refs.recordAudio.muted = true;
              const playPromise = _this.$refs.recordAudio.play();
              _this.$refs.recordAudio.muted = false;
              if (playPromise) {
                playPromise.then(() => {
                  _this.$refs.recordAudio.pause();
                }).catch(error => {
                  _this.$refs.recordAudio.pause();
                  console.log(error);
                });
              }
            });
          } catch (error) {
            console.log(error);
            this.$message({
              type: 'warning',
              message: error,
              duration: 5000
            });
          }
        }
      },
      immediate: true
    },
    videoAndMusicStop(val) {
      console.log('watch', val);
      let currentPlayStamp = val || '--';
      if (`${this.url}__playTimeStamp__${this.lastOperateTimeStamp}` !== currentPlayStamp) {
        this.recordAudio.pause();
      }
    }
  },
  mounted() {
    console.log(recorder$1);
    // 加载完毕后，先获取<video>标签DOM对象
    this.recordAudio = this.$refs.recordAudio;
    // let _this = this;
    // if(!this.recBolb && !this.isRecing) {
    //   let rec = this.rec = Recorder({
    //       type:_this.type,
    //       bitRate:_this.bitRate,
    //       sampleRate:_this.sampleRate,
    //       onProcess:function(buffers,powerLevel,duration,sampleRate){
    //           _this.recDuration = duration;
    //           _this.powerLevel = powerLevel;
    //           // _this.wave.input(buffers[buffers.length-1],powerLevel,sampleRate);
    //           //可视化图形绘制
    //           $(".recwave").html("").append(_this.waveStore[_this.waveStore.selected].elem);
    //           _this.waveStore[_this.waveStore.selected].input(buffers[buffers.length-1],powerLevel,sampleRate);
    //       }
    //   });

    //   _this.dialogInt=setTimeout(function(){//定时8秒后打开弹窗，用于监测浏览器没有发起权限请求的情况
    //       _this.showDialog();
    //   },8000);

    //   rec.open(function(){
    //       _this.dialogCancel();
    //       // _this.reclog("已打开:"+_this.type+" "+_this.sampleRate+"hz "+_this.bitRate+"kbps",2);

    //       _this.initWaveStore(".recwave");
    //       // rec.start();
    //       _this.hasInitSuccess = true
    //       // _this.isRecing = true
    //   },function(msg,isUserNotAllow){
    //       _this.dialogCancel();
    //       isUserNotAllow && _this.$message.error('启动录音失败，用户拒绝了授权')
    //       // _this.reclog((isUserNotAllow?"UserNotAllow，":"")+"打开失败："+msg,1);
    //   });

    //   _this.waitDialogClickFn=function(){
    //       _this.dialogCancel();
    //       _this.$message.error('启动录音失败，用户忽略了权限请求')
    //       // _this.reclog("打开失败：权限请求被忽略，用户主动点击的弹窗",1);
    //   };
    // }
  },
  methods: {
    ontrolBtn() {
      if (!this.isRecing) {
        this.connectWebSocket();
        this.isRecing = true;
        recorder$1.onFrameRecorded = ({
          isLastFrame,
          frameBuffer
        }) => {
          this.buffersArr.push(frameBuffer);
          this.webSocket.send(JSON.stringify({
            business: {
              aue: 'raw',
              cmd: 'auw',
              aus: isLastFrame ? 4 : 2
            },
            data: {
              status: isLastFrame ? 2 : 1,
              data: this.toBase64(frameBuffer),
              data_type: 1
            }
          }));
          if (isLastFrame) {
            this.isRecing = false;
          }
        };
      } else {
        recorder$1.stop();
        let _this = this;
        _this.isRecing = false;
        recorder$1.onStop = function (res) {
          console.log(res);
          const blob = new Blob(_this.buffersArr, {
            type: 'audio/mp3'
          });
          // _this.recBolb = blob
          console.log(blob);
          console.log(URL.createObjectURL(blob));

          // this.recordedAudio = URL.createObjectURL(blob);
          // this.$refs.audioPlayer.src = this.recordedAudio;
        };
        console.log('结束');
      }
    },
    /**
     * 获取websocket url
     * 该接口需要后端提供，这里为了方便前端处理
     */
    getWebSocketUrl() {
      return new Promise((resolve, reject) => {
        // 请求地址根据语种不同变化
        var url = 'wss://ise-api.xfyun.cn/v2/open-ise';
        var host = 'ise-api.xfyun.cn';
        var apiKey = API_KEY$1;
        var apiSecret = API_SECRET$1;
        var date = new Date().toGMTString();
        var algorithm = 'hmac-sha256';
        var headers = 'host date request-line';
        var signatureOrigin = `host: ${host}\ndate: ${date}\nGET /v2/open-ise HTTP/1.1`;
        var signatureSha = cryptoJs.HmacSHA256(signatureOrigin, apiSecret);
        var signature = cryptoJs.enc.Base64.stringify(signatureSha);
        var authorizationOrigin = `api_key="${apiKey}", algorithm="${algorithm}", headers="${headers}", signature="${signature}"`;
        var authorization = btoa(authorizationOrigin);
        url = `${url}?authorization=${authorization}&date=${date}&host=${host}`;
        resolve(url);
      });
    },
    // 修改录音评测状态
    setStatus(status) {
      this.onWillStatusChange && this.status !== status && this.onWillStatusChange(this.status, status);
      this.status = status;
    },
    // 连接websocket
    connectWebSocket() {
      return this.getWebSocketUrl().then(url => {
        let iseWS;
        if ('WebSocket' in window) {
          iseWS = new WebSocket(url);
        } else if ('MozWebSocket' in window) {
          iseWS = new MozWebSocket(url);
        } else {
          alert('浏览器不支持WebSocket');
          return;
        }
        this.webSocket = iseWS;
        this.setStatus('init');
        iseWS.onopen = e => {
          this.setStatus('ing');
          // 重新开始录音

          recorder$1.start({
            sampleRate: 16000,
            frameSize: 1280
          });
          var params = {
            common: {
              app_id: APPID$1
            },
            business: {
              category: 'read_sentence',
              // read_syllable/单字朗读，汉语专有 read_word/词语朗读  read_sentence/句子朗读 https://www.xfyun.cn/doc/Ise/IseAPI.html#%E6%8E%A5%E5%8F%A3%E8%B0%83%E7%94%A8%E6%B5%81%E7%A8%8B
              rstcd: 'utf8',
              group: 'pupil',
              sub: 'ise',
              tte: 'utf-8',
              cmd: 'ssb',
              auf: 'audio/L16;rate=16000',
              ent: 'cn_vip',
              aus: 1,
              aue: 'raw',
              text: '\uFEFF' + (this.textarea || 'where are you')
            },
            data: {
              status: 0
              // data_type: 1,
              // encoding: "raw",
            }
          };
          iseWS.send(JSON.stringify(params));
        };
        iseWS.onmessage = e => {
          this.result(e.data);
        };
        iseWS.onerror = e => {
          // this.recorderStop()
        };
        iseWS.onclose = e => {
          // this.recorderStop()
        };
      });
    },
    // 对处理后的音频数据进行base64编码
    toBase64(buffer) {
      var binary = '';
      var bytes = new Uint8Array(buffer);
      var len = bytes.byteLength;
      for (var i = 0; i < len; i++) {
        binary += String.fromCharCode(bytes[i]);
      }
      return window.btoa(binary);
    },
    // 向webSocket发送数据
    webSocketSend(audioDatajson) {
      if (this.webSocket.readyState !== 1) {
        return;
      }
      // let audioDatajson = this.audioData.splice(0, 1280)
      var params = {
        common: {
          app_id: APPID$1
        },
        business: {
          category: 'read_sentence',
          // read_syllable/单字朗读，汉语专有 read_word/词语朗读  read_sentence/句子朗读 https://www.xfyun.cn/doc/Ise/IseAPI.html#%E6%8E%A5%E5%8F%A3%E8%B0%83%E7%94%A8%E6%B5%81%E7%A8%8B
          rstcd: 'utf8',
          group: 'pupil',
          sub: 'ise',
          tte: 'utf-8',
          cmd: 'ssb',
          auf: 'audio/L16;rate=16000',
          ent: 'cn_vip',
          aus: 1,
          aue: 'lame',
          text: '\uFEFF' + '测试语音' ,
          ise_unite: '1',
          rst: 'entirety',
          extra_ability: 'multi_dimension'
        },
        data: {
          status: 0,
          encoding: 'lame',
          data_type: 1,
          data: this.toBase64(audioDatajson)
        }
      };
      this.webSocket.send(JSON.stringify(params));
      this.handlerInterval = setInterval(() => {
        // websocket未连接
        if (this.webSocket.readyState !== 1) {
          this.audioData = [];
          clearInterval(this.handlerInterval);
          return;
        }
        // 最后一帧
        if (this.audioData.length === 0) {
          if (this.status === 'end') {
            console.log('最后一帧并结束');
            this.webSocket.send(JSON.stringify({
              business: {
                cmd: 'auw',
                aus: 4,
                aue: 'lame'
              },
              data: {
                status: 2,
                data_type: 1,
                data: ''
              }
            }));
            this.audioData = [];
            clearInterval(this.handlerInterval);
          }
          return false;
        }
        this.audioData.splice(0, 1280);

        // 中间帧
        this.webSocket.send(JSON.stringify({
          business: {
            cmd: 'auw',
            aus: 2,
            aue: 'lame'
          },
          data: {
            status: 1,
            encoding: 'lame',
            data_type: 1,
            data: this.toBase64(audioDatajson)
          }
        }));
      }, 40);
    },
    result(resultData) {
      // 识别结束
      let jsonData = JSON.parse(resultData);
      console.log(jsonData);
      if (jsonData.data && jsonData.data.data) {
        // console.log(jsonData.data.data,'jsonData.data.data');
        let data = Base64$1.decode(jsonData.data.data);
        // console.log(data, 'dasdsadasdasdasdasdasdasdas');
        let grade = parser.parse(data, {
          attributeNamePrefix: '',
          ignoreAttributes: false
        });
        console.log(grade, 'grade结束的这一次');
        grade?.xml_result?.read_sentence?.rec_paper?.read_sentence;
        this.voicedata = grade?.xml_result?.read_sentence?.rec_paper?.read_sentence;
        console.log(this.voicedata);

        // this.accuracy = readSentence?.accuracy_score;
        // this.fluency= readSentence?.fluency_score;
        // this.integrity= readSentence?.integrity_score;
        // this.phone= readSentence?.phone_score;
        // this.tone= readSentence?.tone_score;
        // this.emotion= readSentence?.emotion_score;
      }
      if (jsonData.code === 0 && jsonData.data.status === 2) {
        this.webSocket.close();
      }
      if (jsonData.code !== 0) {
        this.webSocket.close();
      }
    },
    changeDuration() {
      this.$nextTick(() => {
        this.playDuration = this.timeFormat(this.$refs.recordAudio.duration);
        this.totalDuration = this.$refs.recordAudio.duration;
      });
    },
    //将单位为秒的的时间转换成mm:ss的形式
    timeFormat(num) {
      let minute = parseInt(num / 60);
      let second = parseInt(num % 60);
      minute = minute >= 10 ? minute : `0${minute}`;
      second = second >= 10 ? second : `0${second}`;
      return `${minute}:${second}`;
    },
    resetRecorder() {
      let audio = this.$refs.recordAudio;
      if (!audio.paused) {
        audio.pause();
      }
      this.recBolb = null;
      this.isPlay = false;
      this.isRecing = false;
      this.playTime = 0;
      this.playDuration = '00:00';
      this.playCurrentTime = '00:00';
      this.totalDuration = 0;
      this.recDuration = 0;
      this.recordDataUrl = '';
      this.lastAudioStamp = null;
      this.lastPlayStamp = null;
    },
    setRecedDuration(ms) {
      this.playDuration = this.timeFormat(ms / 1000);
      this.totalDuration = ms / 1000;
    },
    initWaveStore(elem) {
      this.waveStore.WaveView = recorder_mp3_min.WaveView({
        elem: elem,
        width: 300,
        height: 100
      });
      this.waveStore.Histogram2 = recorder_mp3_min.FrequencyHistogramView({
        elem: elem,
        lineCount: 30,
        position: 0,
        minHeight: 12,
        mirrorEnable: true,
        stripeEnable: false,
        linear: [0, '#8FC1FD', 1, '#8FC1FD']
      });
      this.waveStore.Histogram3 = recorder_mp3_min.FrequencyHistogramView({
        elem: elem,
        lineCount: 20,
        position: 0,
        minHeight: 1,
        fallDuration: 400,
        stripeEnable: false,
        mirrorEnable: true,
        linear: [0, '#0ac', 1, '#0ac']
      });
    },
    toggleRec() {
      let _this = this;
      // if(!this.hasInitSuccess) {
      //   this.$message.warning('当前浏览器不支持或用户未进行授权，组件功能暂无法使用')
      //   return
      // }
      let waveBoxSelector = '#' + _this.waveBoxKey;
      if (!this.recBolb && !this.isRecing) {
        // _this.rec.start();
        // _this.isRecing = true
        if (recorder_mp3_min.IsOpen()) {
          _this.$message.warning('当前存在进行中的录制任务');
          return;
        }
        let rec = this.rec = recorder_mp3_min({
          type: _this.type,
          bitRate: _this.bitRate,
          sampleRate: _this.sampleRate,
          onProcess: function (buffers, powerLevel, duration, sampleRate) {
            _this.recDuration = duration;
            _this.powerLevel = powerLevel;
            // _this.wave.input(buffers[buffers.length-1],powerLevel,sampleRate);
            //可视化图形绘制
            jquery(waveBoxSelector).html('').append(_this.waveStore[_this.waveStore.selected].elem);
            _this.waveStore[_this.waveStore.selected].input(buffers[buffers.length - 1], powerLevel, sampleRate);

            // _this.audioData.push(buffers)
            // window.btoa(String.fromCharCode(...new Uint8Array(buffers[buffers.length - 1])))
            // _this.webSocketSend(buffers)
          }
        });
        var t = setTimeout(function () {
          // Runtime.Log("无法录音：权限请求被忽略（超时假装手动点击了确认对话框）",1);
        }, 8000);
        rec.open(function () {
          //打开麦克风授权获得相关资源
          clearTimeout(t);
          _this.dialogCancel();
          _this.initWaveStore(waveBoxSelector);
          rec.start();
          _this.isRecing = true;
          _this.recTimestamp = new Date().getTime();
        }, function (msg, isUserNotAllow) {
          clearTimeout(t);
          // Runtime.Log((isUserNotAllow?"UserNotAllow，":"")+"无法录音:"+msg, 1);
        });
      } else {
        if (!(_this.rec && recorder_mp3_min.IsOpen())) {
          _this.$message.error('录音未启动');
          return;
        }
        let doneTimestamp = new Date().getTime();
        if (!_this.recTimestamp || doneTimestamp - _this.recTimestamp < 5000) {
          _this.$message.warning('至少录制 5s 方可进行保存，请稍候');
          return;
        }
        let rec = _this.rec;
        rec.stop(function (blob, duration) {
          _this.$message.success('录制完成');
          _this.recDuration = duration;
          _this.setRecedDuration(duration);
          jquery(waveBoxSelector).html('');
          _this.$nextTick(() => {
            _this.recBolb = blob;
            _this.isRecing = false;
            _this.lastAudioStamp = new Date().getTime();
            _this.recTimestamp = null;
          });
          _this.setStatus('end');

          //_this.$emit('resData',{blob:blob,duration:duration})
        }, function (msg) {
          _this.recTimestamp = null;
          _this.$message.error(`录音失败：${msg}`);
        }, true); //录音结束时自动调用rec.close方法丢弃所有数据
      }
    },
    play() {
      // if(!this.recBolb) {
      //   // this.toggleRec()
      //   this.ontrolBtn()
      // }else {
      //   // if (this.playStyle === 'yuan-wen') {
      //   //   this.doPlay()
      //   // }
      //   // if (this.playStyle === 'tan-chuang') {
      //   //   this.$emit('showDialog', { url: this.url, title: this.title, coverFileUrl: this.coverImageUrl, content: this.content, playerIndex: this.playerIndex })
      //   // }
      //   this.togglePlay()
      // }
      this.$emit('showDialog');
    },
    togglePlay() {
      let _this = this;
      let audios = document.querySelectorAll('audio');
      audios.forEach(i => i.pause());
      let video = document.querySelectorAll('video');
      if (video && video.length) {
        video.forEach(i => i.pause());
      }
      let audio = this.$refs.recordAudio;
      if (this.isPlay) {
        !(audio.ended || audio.paused) && audio.pause();
      } else {
        if (!this.lastPlayStamp || this.lastPlayStamp !== this.lastAudioStamp) {
          audio.onerror = function (e) {
            _this.$message.error(audio.error.message);
          };
          audio.currentTime = 0;
          audio.src = (window.URL || webkitURL).createObjectURL(_this.recBolb);
          console.log((window.URL || webkitURL).createObjectURL(_this.recBolb));
          audio.play();
          this.lastPlayStamp = this.lastAudioStamp;
        } else {
          audio.paused && audio.play();
        }
      }
      this.isPlay = !this.isPlay;
    },
    doPlay() {
      let _this = this;
      let rec = this.rec;
      let audio = this.$refs.LogAudioPlayer;
      audio.controls = true;
      if (!(audio.ended || audio.paused)) {
        audio.pause();
      }
      audio.onerror = function (e) {
        _this.$message.error(audio.error.message);
      };
      audio.src = (window.URL || webkitURL).createObjectURL(rec.blob);
      audio.play();
      // console.log('暂停')
      // let audio = document.querySelectorAll('audio')
      // audio.forEach((i) => i.pause())
      // let video = document.querySelectorAll('video')
      // if (video && video.length) {
      //   video.forEach((i) => i.pause())
      // }

      // this.isPlay ? this.$refs.recordAudio.pause() : this.$refs.recordAudio.play()
      // this.isPlay = !this.isPlay
      // let timeStamp = new Date().getTime()
      // this.lastOperateTimeStamp = timeStamp
      // let playStamp = `${this.url}__playTimeStamp__${timeStamp}`
      // // !this.isPlay && this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // // this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // sessionStorage.setItem('SET_PLAY_STATE', playStamp) //存储
    },
    updateTime(e) {
      this.playTime = this.$refs.recordAudio.currentTime;
      this.playCurrentTime = this.timeFormat(this.$refs.recordAudio.currentTime);
      if (!this.loop && this.playTime >= this.totalDuration) {
        this.isPlay = false;
      }
      // this.$emit('timeUpdate', {event:e, time: this.$refs.recordAudio.currentTime })
    },
    changeTime(val) {
      this.$refs.recordAudio.currentTime = val;
    },
    showDialog: function () {
      //选择性的弹一个对话框：为了防止移动端浏览器存在第三种情况：用户忽略，并且（或者国产系统UC系）浏览器没有任何回调
      if (!/mobile/i.test(navigator.userAgent)) {
        return; //只在移动端开启没有权限请求的检测
      }
      this.permissionDialogVisible = true;
    },
    dialogCancel: function () {
      clearTimeout(this.dialogInt);
      this.permissionDialogVisible = false;
    },
    waitDialogClick: function () {
      this.dialogCancel();
      this.waitDialogClickFn();
    }
  }
};

/* script */
const __vue_script__$5v = script$5v;

/* template */
var __vue_render__$5v = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "xml-voice-player", class: ["xml-audio-player", _vm.mode] },
    [
      _vm.recBolb
        ? _c("div", { staticClass: "play-mode-wrap" }, [
            _c("img", {
              staticClass: "play-control-image",
              attrs: { src: _vm.recDelete },
              on: { click: _vm.resetRecorder },
            }),
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.styleMode !== "C"
        ? _c("div", { staticClass: "audio-cover" }, [
            _c("img", {
              attrs: {
                src: _vm.coverImageUrl ? _vm.coverImageUrl : _vm.coverLocal,
                alt: "",
              },
            }),
            _vm._v(" "),
            _vm.styleMode === "A"
              ? _c("div", { staticClass: "play-button style-a" }, [
                  _c("img", {
                    staticClass: "button-image",
                    attrs: {
                      src: _vm.recBolb
                        ? _vm.isPlay
                          ? _vm.pauseIcon
                          : _vm.playIcon
                        : _vm.isRecing
                        ? _vm.recStopIcon
                        : _vm.recStartIcon,
                    },
                    on: {
                      click: function ($event) {
                        $event.stopPropagation();
                        return _vm.play.apply(null, arguments)
                      },
                    },
                  }),
                ])
              : _vm._e(),
            _vm._v(" "),
            _vm.controlStatusText
              ? _c("div", { staticClass: "play-text" }, [
                  _vm._v(_vm._s(_vm.controlStatusText)),
                ])
              : _vm._e(),
          ])
        : _vm._e(),
      _vm._v(" "),
      !_vm.recBolb
        ? _c("div", { staticClass: "record-player-control" }, [
            !_vm.recBolb
              ? _c("div", {
                  staticClass: "recwave",
                  staticStyle: { height: "75%", width: "100%" },
                  attrs: { id: _vm.waveBoxKey },
                })
              : _vm._e(),
            _vm._v(" "),
            !_vm.isRecing
              ? _c("div", { staticClass: "mock-wave" }, [
                  _c("img", {
                    staticClass: "button-image",
                    attrs: { src: _vm.recMockWave },
                  }),
                ])
              : _vm._e(),
          ])
        : _c("div", { staticClass: "audio-player-control" }, [
            _c("div", { staticClass: "audio-controls" }, [
              _vm.styleMode !== "A"
                ? _c(
                    "div",
                    { staticClass: "audio-controls__play-button-wrapper" },
                    [
                      _c("div", { staticClass: "play-button" }, [
                        _c("img", {
                          staticClass: "button-image",
                          attrs: {
                            src: _vm.isPlay ? _vm.pauseIcon : _vm.playIcon,
                          },
                          on: {
                            click: function ($event) {
                              $event.stopPropagation();
                              return _vm.play.apply(null, arguments)
                            },
                          },
                        }),
                      ]),
                    ]
                  )
                : _vm._e(),
              _vm._v(" "),
              _c("div", { staticClass: "audio-controls__handler" }, [
                _c(
                  "div",
                  { staticClass: "progress" },
                  [
                    _c("el-slider", {
                      attrs: {
                        max: _vm.totalDuration,
                        disabled: _vm.scheduleControl !== "yes",
                        "show-tooltip": false,
                      },
                      on: { change: _vm.changeTime },
                      model: {
                        value: _vm.playTime,
                        callback: function ($$v) {
                          _vm.playTime = $$v;
                        },
                        expression: "playTime",
                      },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c("div", { staticClass: "play-times" }, [
                  _c("div", { staticClass: "current-time" }, [
                    _vm._v(_vm._s(_vm.playCurrentTime)),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "total-time" }, [
                    _vm._v(_vm._s(_vm.playDuration)),
                  ]),
                ]),
              ]),
            ]),
          ]),
    ]
  )
};
var __vue_staticRenderFns__$5v = [];
__vue_render__$5v._withStripped = true;

  /* style */
  const __vue_inject_styles__$5v = undefined;
  /* scoped */
  const __vue_scope_id__$5v = undefined;
  /* module identifier */
  const __vue_module_identifier__$5v = undefined;
  /* functional template */
  const __vue_is_functional_template__$5v = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5v = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5v, staticRenderFns: __vue_staticRenderFns__$5v },
    __vue_inject_styles__$5v,
    __vue_script__$5v,
    __vue_scope_id__$5v,
    __vue_is_functional_template__$5v,
    __vue_module_identifier__$5v,
    false,
    undefined,
    undefined,
    undefined
  );

var audioplay = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAjCAYAAABsFtHvAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Nzg2N0EwMkRCOTk2MTFFRTkyODY5NjkyNzIzQkJCMjUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Nzg2N0EwMkVCOTk2MTFFRTkyODY5NjkyNzIzQkJCMjUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo3ODY3QTAyQkI5OTYxMUVFOTI4Njk2OTI3MjNCQkIyNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo3ODY3QTAyQ0I5OTYxMUVFOTI4Njk2OTI3MjNCQkIyNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqQzfXsAAABxSURBVHja7NfLDYAgEIThhS60I+vQ1gW7WCHhpEiYk5d/kk0Ij/nORHffyiSfS2r3rTNyT6gLM1tsPrnM2tmXeyrupid09uSeaD8GHBwcHBwcHBwcHBwcHPyFZ/HNNfi3Sz0VPwaFz5xl9o8zuecWYABkIYg317fc8QAAAABJRU5ErkJggg==";

var audiopluse = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAtCAYAAAA6GuKaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NjVGNTA1NTBCOTk2MTFFRUJEN0NCMzZBQzlFRTc5ODciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NjVGNTA1NTFCOTk2MTFFRUJEN0NCMzZBQzlFRTc5ODciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo2NUY1MDU0RUI5OTYxMUVFQkQ3Q0IzNkFDOUVFNzk4NyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo2NUY1MDU0RkI5OTYxMUVFQkQ3Q0IzNkFDOUVFNzk4NyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PvUcl+EAAALBSURBVHja7JlBSBRRGMed3RKUapf0oChGrUmtEkZghHuQDoGBYJfYkySYdfDeJSQCha6CYNChc9RFyMAy99BNLFsSBSlIrKBATGvNdJn+I9+Dz+ebZWac2X3BPPjB7Nv33vebN2/mvTdjmKZZ9r+lQz60cQpcBZdAMzgBYsAAm2ANLIIsyIDXYP1AEa2e9kAF6Aezpvu0DZ6BTmB4ie+2QhTcAl9Nf9I70O1W2nAxps+Ax+Ci4r8F8ALM0PEq+EPDpA60gBS4Ao4r6r8Ct8FHP4fHdfBbcZkfgVaXV6oLPFf0utV+j1/D444iwDho9Hg/CC6AaUXbo3RynqXvSg3mQO8BZTkGtbcuxXkKyr1I35QaWgHnfRTmnAZZhXjUjXQ7+CsJNwYkLIiBjGKoOJI+Cj6ximvgbMDCgkqFeI8T6RGpUmeRhHmPZ6WnSqKQdBLssAojRRbmY5zfnC8LST9hBa1Z70iJpC1uSFe8WyV9Uurl3hIKi8fhtDTlG7L0ECuwDA6XWFpMQPvurwib0dPseAxsa7B0ngUT7HcfX3u0SGfUoEEvC7qk9c4x0dMd7Gzeg2WNNioTtGoUm5bLQrqNFcpotrvKg0n2u0NIN7HMtxpuC9+w43MRts8TaUlD6Q98MyKkYyzzm4bSX9hxXEiXs8xfGkr/ZMcVEUWBHQ2l98wZkQIFq8ADMAUegkQR5BIUa4piVxXa2PIUp/ca81L+D1Af4CRSTzF4mieXOM+06+lrICnlVYOBAHt5gGLwlCSXMifDw24o1AQoXePUxU46qtFNGHUqrXUKpUNpB9J58dgGWxp6bpHbrquQHgQr4D69vdctbZKb5TgoPl8MEzqne0R4I4bSobTO0t9t8nMBuuQcu9gsyGvBhrQgz9MXgqA2Ae0Ug6cNcnH8zSUF5qjyZ5AuwiuwNMUyKXZKVe6fAAMABGTajLpD+ggAAAAASUVORK5CYII=";

var statr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAARCAYAAADtyJ2fAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MEI5NTc1MUNCOUJEMTFFRTkwRUJDMDQwM0I2NDI4OUQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MEI5NTc1MURCOUJEMTFFRTkwRUJDMDQwM0I2NDI4OUQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowQjk1NzUxQUI5QkQxMUVFOTBFQkMwNDAzQjY0Mjg5RCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowQjk1NzUxQkI5QkQxMUVFOTBFQkMwNDAzQjY0Mjg5RCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnfCIgEAAADUSURBVHjaYvz//z8DEHABsREQXwTizwzEAKBGbiC++R8CXgJxDMgwQhhEOP/HBLuBWAWfRiagpRxYHOICxJeAuAaI2XA51fs/fnAViG2x2UgIaAHxQSCeA8RCMEEmBuIAIxAnA/F1II4FCbAwkAbEgHgREGszMZAHwsnVuJpUp74H4gognk2KxuVAXAjEL4kNnHtAnAXEO5EF8fnxNxB3ArEOuiaYjT+xaDoOxOlAfBlf7uAF4gfQ5PUeiDOBmIlQ7mCE5kcBIDYH4rNA/IaYkAIIMABItNd0UvL9QAAAAABJRU5ErkJggg==";

//
let Base64 = require('js-base64').Base64;
const APPID = '98fcf4d6';
const API_SECRET = 'Y2FkN2Y1MGZjN2U0M2I1MTU4Y2FlZjA0';
const API_KEY = 'b7e405d6af09050e4a6976f31ec37640';
const recorder = new RecorderManager('/audio/recorder');
var script$5u = {
  name: 'XmlVoiceRender',
  components: {
    VoicePlayer: __vue_component__$5v
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //评测数据
    voicedata: {},
    sourcedata: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          console.log('新data', newValue);
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    },
    sourcedata: {
      handler(newval) {
        if (newval) {
          this.ratingData = newval;
        }
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {
        playMode: 'xun-huan',
        scheduleControl: 'yes',
        playStyle: 'yuan-wen',
        styleMode: 'A'
      },
      //属性组件名
      propertyComponentsName: 'xml-recorder-property',
      dialogShow: false,
      curRecordUrl: '',
      curRecordTitle: '',
      curCoverFileUrl: '',
      curRecordContent: '',
      currentPlayer: {},
      modalPlayerKey: 'mpk' + new Date().getTime(),
      isRecing: false,
      playIcon: playIcon$1,
      pauseIcon: pauseIcon$1,
      checkbox,
      chackboxactive,
      buffersArr: [],
      webSocket: null,
      ratingData: {},
      //测评数据
      showresult: false,
      //成绩弹窗
      countdown: 300,
      //倒计时长
      timer: null,
      //定时器
      loading: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      audioplay,
      audiopluse,
      statr,
      isPlay: false,
      recordAudio: null,
      lastAudioStamp: null
    };
  },
  methods: {
    updateTime(e) {
      this.playTime = this.$refs.recordAudio.currentTime;
      this.playCurrentTime = this.timeFormat(this.$refs.recordAudio.currentTime);
      if (this.voicedata.model != '1' && this.playTime >= this.totalDuration) {
        this.isPlay = false;
      }
    },
    //将单位为秒的的时间转换成mm:ss的形式
    timeFormat(num) {
      let minute = parseInt(num / 60);
      let second = parseInt(num % 60);
      minute = minute >= 10 ? minute : `0${minute}`;
      second = second >= 10 ? second : `0${second}`;
      return `${minute}:${second}`;
    },
    changeDuration() {
      this.$nextTick(() => {
        this.playDuration = this.timeFormat(this.$refs.recordAudio.duration);
        this.totalDuration = this.$refs.recordAudio.duration;
      });
    },
    togglePlay() {
      let _this = this;
      let audios = document.querySelectorAll('audio');
      audios.forEach(i => i.pause());
      let video = document.querySelectorAll('video');
      if (video && video.length) {
        video.forEach(i => i.pause());
      }
      let audio = this.$refs.recordAudio;
      if (this.isPlay) {
        !(audio.ended || audio.paused) && audio.pause();
      } else {
        if (!this.lastPlayStamp || this.lastPlayStamp !== this.lastAudioStamp) {
          audio.onerror = function (e) {
            _this.$message.error(audio.error.message);
          };
          audio.currentTime = 0;
          audio.src = this.voicedata.recordDataUrl;
          audio.play();
          this.lastPlayStamp = this.lastAudioStamp;
        } else {
          audio.paused && audio.play();
        }
      }
      this.isPlay = !this.isPlay;
    },
    changeTime(val) {},
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    showDialog() {
      this.$nextTick(() => {
        this.dialogShow = true;
      });
    },
    timeUpdate({
      event,
      time
    }, data) {
      // console.log({event, time, data});
      this.$EventBus.$emit('audioTimeUpdate', {
        event,
        time,
        data
      });
    },
    getresdata({
      blob,
      duration
    }) {
      this.$emit('getresdata', {
        blob,
        duration
      });
    },
    getTime(time) {
      let m = parseInt(time / 60 % 60);
      m = m < 10 ? '0' + m : m;
      let s = parseInt(time % 60);
      s = s < 10 ? '0' + s : s;
      // 作为返回值返回
      return m + ':' + s;
    },
    /**
     * 获取websocket url
     * 该接口需要后端提供，这里为了方便前端处理
     */
    getWebSocketUrl() {
      return new Promise((resolve, reject) => {
        // 请求地址根据语种不同变化
        var url = 'wss://ise-api.xfyun.cn/v2/open-ise';
        var host = 'ise-api.xfyun.cn';
        var apiKey = API_KEY;
        var apiSecret = API_SECRET;
        var date = new Date().toGMTString();
        var algorithm = 'hmac-sha256';
        var headers = 'host date request-line';
        var signatureOrigin = `host: ${host}\ndate: ${date}\nGET /v2/open-ise HTTP/1.1`;
        var signatureSha = cryptoJs.HmacSHA256(signatureOrigin, apiSecret);
        var signature = cryptoJs.enc.Base64.stringify(signatureSha);
        var authorizationOrigin = `api_key="${apiKey}", algorithm="${algorithm}", headers="${headers}", signature="${signature}"`;
        var authorization = btoa(authorizationOrigin);
        url = `${url}?authorization=${authorization}&date=${date}&host=${host}`;
        resolve(url);
      });
    },
    ontrolBtn() {
      if (this.isPlay) {
        this.togglePlay();
      }
      if (!this.isRecing) {
        this.connectWebSocket();
        this.isRecing = true;
        recorder.onFrameRecorded = ({
          isLastFrame,
          frameBuffer
        }) => {
          this.buffersArr.push(frameBuffer);
          this.webSocket.send(JSON.stringify({
            business: {
              aue: 'raw',
              cmd: 'auw',
              aus: isLastFrame ? 4 : 2
            },
            data: {
              status: isLastFrame ? 2 : 1,
              data: this.toBase64(frameBuffer),
              data_type: 1
            }
          }));
          if (isLastFrame) {
            this.isRecing = false;
          }
        };
        this.timer = setInterval(() => {
          if (this.countdown > 0) {
            this.countdown--;
          } else {
            clearInterval(this.timer);
            this.countdown = 300;
            recorder.stop();
          }
        }, 1000);
      } else {
        recorder.stop();
        let _this = this;
        _this.loading = true;
        _this.isRecing = false;
        clearInterval(this.timer);
        this.countdown = 300;
        recorder.onStop = function (res) {
          console.log(res);
          console.log(recorder);
          // const audioContext = new AudioContext();
          // const audioSource = audioContext.createBufferSource()
          // console.log(audioContext,audioSource);
          // audioContext.decodeAudioData(res[1], (buffer) => {
          //   console.log(buffer);
          //   audioSource.buffer = buffer;
          //   audioSource.connect(audioContext.destination);
          // })

          // const blob = new Blob(res, { type: 'audio/mp3' });
          // console.log(blob);
          // console.log((window.URL||webkitURL).createObjectURL(blob));

          // this.recordedAudio = URL.createObjectURL(blob);
          // this.$refs.audioPlayer.src = this.recordedAudio;
        };
        console.log('结束');
      }
    },
    // 连接websocket
    connectWebSocket() {
      return this.getWebSocketUrl().then(url => {
        let iseWS;
        if ('WebSocket' in window) {
          iseWS = new WebSocket(url);
        } else if ('MozWebSocket' in window) {
          iseWS = new MozWebSocket(url);
        } else {
          alert('浏览器不支持WebSocket');
          return;
        }
        this.webSocket = iseWS;
        this.webSocket.onopen = e => {
          // 重新开始录音

          recorder.start({
            sampleRate: 16000,
            frameSize: 1280
          });
          var params = {
            common: {
              app_id: APPID
            },
            business: {
              category: 'read_sentence',
              // read_syllable/单字朗读，汉语专有 read_word/词语朗读  read_sentence/句子朗读 https://www.xfyun.cn/doc/Ise/IseAPI.html#%E6%8E%A5%E5%8F%A3%E8%B0%83%E7%94%A8%E6%B5%81%E7%A8%8B
              rstcd: 'utf8',
              group: 'pupil',
              sub: 'ise',
              tte: 'utf-8',
              cmd: 'ssb',
              auf: 'audio/L16;rate=16000',
              ent: this.voicedata.language == 'cn' ? 'cn_vip' : 'en_vip',
              aus: 1,
              aue: 'raw',
              text: '\uFEFF' + this.voicedata.content
            },
            data: {
              status: 0
              // data_type: 1,
              // encoding: "raw",
            }
          };
          this.webSocket.send(JSON.stringify(params));
        };
        this.webSocket.onmessage = e => {
          this.result(e.data);
        };
        this.webSocket.onerror = e => {
          // this.recorderStop()
        };
        this.webSocket.onclose = e => {
          // this.recorderStop()
        };
      });
    },
    // 对处理后的音频数据进行base64编码
    toBase64(buffer) {
      var binary = '';
      var bytes = new Uint8Array(buffer);
      var len = bytes.byteLength;
      for (var i = 0; i < len; i++) {
        binary += String.fromCharCode(bytes[i]);
      }
      return window.btoa(binary);
    },
    result(resultData) {

      // 识别结束
      let jsonData = JSON.parse(resultData);
      if (jsonData.data && jsonData.data.data) {
        // console.log(jsonData.data.data,'jsonData.data.data');
        let data = Base64.decode(jsonData.data.data);
        // console.log(data, 'dasdsadasdasdasdasdasdasdas');
        let grade = parser.parse(data, {
          attributeNamePrefix: '',
          ignoreAttributes: false
        });
        console.log(grade, 'grade结束的这一次');
        if (this.voicedata.language == 'en') {
          this.ratingData = grade?.xml_result?.read_sentence?.rec_paper?.read_chapter;
        } else {
          this.ratingData = grade?.xml_result?.read_sentence?.rec_paper?.read_sentence;
        }
        this.showresult = true;
        // this.blockData.ratingData = this.ratingData
        this.$emit('ratedata', {
          ratingData: this.ratingData,
          ruleIndex: this.ruleIndex,
          dataName: this.blockDataName
        });
        this.loading = false;
        // this.accuracy = readSentence?.accuracy_score;
        // this.fluency= readSentence?.fluency_score;
        // this.integrity= readSentence?.integrity_score;
        // this.phone= readSentence?.phone_score;
        // this.tone= readSentence?.tone_score;
        // this.emotion= readSentence?.emotion_score;
      }
      if (jsonData.code === 0 && jsonData.data.status === 2) {
        this.webSocket.close();
      }
      if (jsonData.code !== 0) {
        this.webSocket.close();
      }
    },
    format(num) {
      let total = num;
      if (num) {
        if (this.voicedata.language == 'en') {
          total = num * 20;
        }
      }
      return Number(total?.toFixed(0));
    }
  },
  created() {},
  computed: {
    isEmpty() {
      return !(this.blockData.recordSetList && this.blockData.recordSetList.length);
    },
    percentage() {
      let total = this.ratingData.total_score;
      if (this.voicedata.language == 'en') {
        total = this.ratingData.total_score * 20;
      }
      return Number(total?.toFixed(0));
    }
  }
};

var __$_require_images_voice_icon5_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAAiCAYAAAAKyxrjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUU3NDIwMTdCOTk2MTFFRUI1NTZDRTIwQjAwNDdFQkUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUU3NDIwMThCOTk2MTFFRUI1NTZDRTIwQjAwNDdFQkUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBRTc0MjAxNUI5OTYxMUVFQjU1NkNFMjBCMDA0N0VCRSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBRTc0MjAxNkI5OTYxMUVFQjU1NkNFMjBCMDA0N0VCRSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhLzVf8AAARHSURBVHja1JhXaFRREIZ3jYrd2LvGFksSa7ArdiyggiiIoIgFBCsoCII+6IsECyqKoIgP+uBDFJRgFDUWRGzYYjf2ltiSaDRqsv4H5so4nLbGkOzAx925c3bOnVvmzJxwJBIJOaQDaMD0e+CrZXxtMBx0Bk1BLrgALgPnZEx6E+3AL5r3BPgcikZUgBbag4LI39LKMLY+2AwKI3q5BLo45lNMArcNPpTvJR4+/mAz1gPXxQQfDGO7g5yIW96B5gYfcWB7xE+WljXAeHBW4zhLM1Zd8GtxE6aDmqAGWC987DTMuVmM2wMSyJYK3jBbEWj4rwEmgWzDndsmxobBSWYvBn3EmCrgGRtTQE+Lj5kMStmY3ZrrWiiuZX60Aao7vprujkkWCAdThX2DYaK9YlwSs1UDj5ktjz4P3WfAZZdPgFWQZ+LAYnAfrAc1Kf/cBFdETrol9LXs90+w0ZDLcoXekv2eRZk6kB2gQOPjrdBb+SRRFWB3sBW0oXPZYA7oC8I84YLbTO8HUph+TBOISaqz33OFbZ/lWrnU9ZmoKq1X50AWSAfXyRZHwQfyFBQyfYbwlWGZJ17oxXRMAAPEGptj8NFQ6IW+AaYTUjqx11X3eo4S+inLPG2FnkfH0eItsfnoaPDhfEVNkmL5/hqBZKar6uKhxVdXoT+l4zBx/rLFR6LQn5RngD3Fnb9lKcPqiCf4GuSzcozLDcv1JAv9TnkG2EHYHlj8pIp5eGZuH4WfvkK/+D8DLBaTNxZjX1j8DBX6GTrWosI8kHxLEa+K/R5MfwZeliXA2uIp3aWKnr92IXFxJhkv9KN0rCbO27qEMZTVAznk20yYAkwSNplB5UJcasl8fBm4xN6E71E0PTOFfqCsAaY4KpjnnlXFMpGMNonX/iPTmxiuR2XgCUzPcmRbr35wi6j7xgl7giiO72h89AI/2JiLVJzzMYfFPEM0xXwms/8CAx31p+pgOrrapZMeTW6mGLOCdQljwStm+wwSNT4mCh9XQAuyNQMHhX2NR4GdQTdftWVxpkG5Hk1uIl247Ljzxbk8x12XQfykxrhU06mEHcHNFv/pEjI0sK4mNyDF0Bgr+Up9XWPHRamnvg58Mfi5pvlEdDSjhxHIaXVDwppNJ5WO6zH9h2OTSUk3WojVJtMn8AqcB0VRZEo152BanlSyeUdFQY7n/w+CafT7G62bj0LRbOBUYqaIp74ysIU9tg0ru8RTDxs00VdBf1DiKtViRdJYcGpXYV4QXCwEqErGVdSU62SE2BFIYw2718ZvRXOcvqkXoJOwqU2yR+y7u0uLvPfGb0Wj8sN7FsAT0JrZ05itRFMFVfoAFYNoPQ3kIVU6qVS2BbLd5CMWsuhIcIT6xxDb2UtmhX+yaRMqVpaJCdQDVtfYJtp29GJlmcigbcoScX6/Y7sy5hb65aynLKJ91TzXvmgsyVaqXNRivshnb/S3AAMAp9T1voGemc8AAAAASUVORK5CYII=";

/* script */
const __vue_script__$5u = script$5u;
var __vue_render__$5u = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-recorder-container",
      class: "xml-recorder-container-" + _vm.pageType,
      style: [
        {
          "--themecolor": _vm.voicedata.ThemeColor
            ? _vm.voicedata.ThemeColor
            : "#2D5DD8",
        },
      ],
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      [
        _c("div", { staticClass: "fixed-voice-container" }, [
          _c(
            "div",
            {
              class: [
                "xml-voice__wrapper",
                "style-mode--" + _vm.blockData.styleMode,
                _vm.mode,
              ],
            },
            [
              _c(
                "div",
                { staticClass: "xml-recorder-player-box xml-group-item" },
                [
                  _c("div", { staticClass: "voice-image-con" }, [
                    _vm.voicedata.imgurl
                      ? _c("img", {
                          style: { width: _vm.voicedata.imgWidth + "%" },
                          attrs: { src: _vm.voicedata.imgurl, alt: "" },
                        })
                      : _c("div", [_vm._v(_vm._s(_vm.voicedata.content))]),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "btn-group" }, [
                    _c("div", { on: { click: _vm.togglePlay } }, [
                      _c(
                        "div",
                        {
                          staticClass: "icon-box",
                          staticStyle: {
                            "background-color": "var(--themecolor)",
                          },
                        },
                        [
                          _c("img", {
                            staticClass: "img1",
                            attrs: {
                              src: _vm.isPlay ? _vm.audioplay : _vm.audiopluse,
                              alt: "",
                            },
                          }),
                        ]
                      ),
                      _vm._v(" "),
                      _c("span", { staticClass: "text" }, [
                        _vm._v(
                          _vm._s(
                            _vm.voicedata.btntype == "en"
                              ? "listen"
                              : "原音试听"
                          )
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        on: {
                          click: function ($event) {
                            $event.stopPropagation();
                            return _vm.ontrolBtn.apply(null, arguments)
                          },
                        },
                      },
                      [
                        _c(
                          "div",
                          {
                            staticClass: "icon-box",
                            staticStyle: {
                              "background-color": "var(--themecolor)",
                            },
                          },
                          [
                            !_vm.isRecing
                              ? _c("img", {
                                  staticClass: "img4",
                                  attrs: { src: _vm.playIcon, alt: "" },
                                })
                              : _c("img", {
                                  staticClass: "img2",
                                  attrs: { src: _vm.pauseIcon, alt: "" },
                                }),
                          ]
                        ),
                        _vm._v(" "),
                        _c("span", { staticClass: "text" }, [
                          _vm._v(
                            _vm._s(
                              _vm.voicedata.btntype == "en"
                                ? "record"
                                : "点击话筒，录音测验"
                            )
                          ),
                        ]),
                      ]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        on: {
                          click: function ($event) {
                            _vm.ratingData.total_score
                              ? (_vm.showresult = true)
                              : "";
                          },
                        },
                      },
                      [
                        _vm._m(0),
                        _vm._v(" "),
                        _c("span", { staticClass: "text" }, [
                          _vm._v(
                            _vm._s(
                              _vm.voicedata.btntype == "en"
                                ? "check out"
                                : "评分查看"
                            )
                          ),
                        ]),
                      ]
                    ),
                  ]),
                  _vm._v(" "),
                  _vm.voicedata.isProgress != "none"
                    ? _c(
                        "div",
                        {
                          staticClass: "play-box",
                          staticStyle: {
                            "background-color": "var(--themecolor)",
                          },
                        },
                        [
                          _c("div", { staticClass: "top-box" }, [
                            _c("div", { staticClass: "text" }, [
                              _vm._v(
                                _vm._s(_vm.playCurrentTime) +
                                  " / " +
                                  _vm._s(_vm.playDuration)
                              ),
                            ]),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "play-icon",
                                on: { click: _vm.togglePlay },
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: _vm.isPlay ? _vm.audioplay : _vm.statr,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", { staticClass: "text" }, [
                              _vm._v("原音试听"),
                            ]),
                          ]),
                          _vm._v(" "),
                          _c(
                            "div",
                            { staticClass: "slider-box" },
                            [
                              _c("el-slider", {
                                attrs: {
                                  max: _vm.totalDuration,
                                  disabled: _vm.voicedata.progress !== "1",
                                  "show-tooltip": false,
                                },
                                on: { change: _vm.changeTime },
                                model: {
                                  value: _vm.playTime,
                                  callback: function ($$v) {
                                    _vm.playTime = $$v;
                                  },
                                  expression: "playTime",
                                },
                              }),
                            ],
                            1
                          ),
                        ]
                      )
                    : _vm._e(),
                ]
              ),
            ]
          ),
        ]),
      ],
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          style: [
            {
              "--themecolor": _vm.voicedata.ThemeColor
                ? _vm.voicedata.ThemeColor
                : "#2D5DD8",
            },
          ],
          attrs: {
            title: "查看分数",
            visible: _vm.showresult,
            width:
              _vm.pageType != "pc" && _vm.mode != "editor" ? "80vw" : "456px",
            top: "50vh",
            modal: false,
            "show-close": true,
            "append-to-body": "",
            "close-on-click-modal": true,
            "custom-class": "xml-voice-container",
          },
          on: {
            "update:visible": function ($event) {
              _vm.showresult = $event;
            },
          },
        },
        [
          _c("div", { staticClass: "xml-result-con" }, [
            _c(
              "div",
              { staticClass: "total" },
              [
                _c("div", { staticClass: "number-box" }, [
                  _c("div", [_vm._v("满分100分")]),
                  _vm._v(" "),
                  _c("div", [
                    _c("span", [_vm._v(_vm._s(_vm.percentage))]),
                    _vm._v("分\n          "),
                  ]),
                ]),
                _vm._v(" "),
                _c("el-progress", {
                  attrs: {
                    type: "circle",
                    percentage: _vm.percentage,
                    "stroke-width": 8,
                    color: _vm.voicedata.ThemeColor,
                    "show-text": false,
                  },
                }),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    staticClass: "comprehensive",
                    style: { background: _vm.voicedata.ThemeColor },
                  },
                  [_vm._v("综合评分")]
                ),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "score-item-box" }, [
              _c("div", [
                _c("div", [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      attrs: {
                        t: "1705998006086",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "11718",
                        width: "16",
                        height: "16",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M450.484288 840.399261L160.887246 543.231054l49.212569-70.033272 236.598891 181.707948L946.395564 246.062847C857.434381 100.31793 694.654344 1.892791 511.053604 1.892791 229.027726 1.892791 0 230.920518 0 512.946396s229.027726 511.053604 511.053604 511.053604 511.053604-229.027726 511.053605-511.053604c0-70.033272-13.249538-136.280961-39.748614-196.850278L450.484288 840.399261z",
                          fill: _vm.voicedata.ThemeColor,
                          "p-id": "11719",
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("span", [_vm._v("准确度分")]),
                ]),
                _vm._v(" "),
                _c("span", [
                  _vm._v(_vm._s(_vm.format(_vm.ratingData.accuracy_score))),
                ]),
              ]),
              _vm._v(" "),
              _c("div", [
                _c("div", [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      attrs: {
                        t: "1705998006086",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "11718",
                        width: "16",
                        height: "16",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M450.484288 840.399261L160.887246 543.231054l49.212569-70.033272 236.598891 181.707948L946.395564 246.062847C857.434381 100.31793 694.654344 1.892791 511.053604 1.892791 229.027726 1.892791 0 230.920518 0 512.946396s229.027726 511.053604 511.053604 511.053604 511.053604-229.027726 511.053605-511.053604c0-70.033272-13.249538-136.280961-39.748614-196.850278L450.484288 840.399261z",
                          fill: _vm.voicedata.ThemeColor,
                          "p-id": "11719",
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("span", [_vm._v("流畅度分")]),
                ]),
                _vm._v(" "),
                _c("span", [
                  _vm._v(_vm._s(_vm.format(_vm.ratingData.fluency_score))),
                ]),
              ]),
              _vm._v(" "),
              _c("div", [
                _c("div", [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      attrs: {
                        t: "1705998006086",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "11718",
                        width: "16",
                        height: "16",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M450.484288 840.399261L160.887246 543.231054l49.212569-70.033272 236.598891 181.707948L946.395564 246.062847C857.434381 100.31793 694.654344 1.892791 511.053604 1.892791 229.027726 1.892791 0 230.920518 0 512.946396s229.027726 511.053604 511.053604 511.053604 511.053604-229.027726 511.053605-511.053604c0-70.033272-13.249538-136.280961-39.748614-196.850278L450.484288 840.399261z",
                          fill: _vm.voicedata.ThemeColor,
                          "p-id": "11719",
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("span", [_vm._v("完整度分")]),
                ]),
                _vm._v(" "),
                _c("span", [
                  _vm._v(_vm._s(_vm.format(_vm.ratingData.integrity_score))),
                ]),
              ]),
              _vm._v(" "),
              _vm.voicedata.language == "cn"
                ? _c(
                    "div",
                    { class: _vm.voicedata.language == "cn" ? "" : "Gray" },
                    [
                      _c("div", [
                        _c(
                          "svg",
                          {
                            staticClass: "icon",
                            attrs: {
                              t: "1705998006086",
                              viewBox: "0 0 1024 1024",
                              version: "1.1",
                              xmlns: "http://www.w3.org/2000/svg",
                              "p-id": "11718",
                              width: "16",
                              height: "16",
                            },
                          },
                          [
                            _c("path", {
                              attrs: {
                                d: "M450.484288 840.399261L160.887246 543.231054l49.212569-70.033272 236.598891 181.707948L946.395564 246.062847C857.434381 100.31793 694.654344 1.892791 511.053604 1.892791 229.027726 1.892791 0 230.920518 0 512.946396s229.027726 511.053604 511.053604 511.053604 511.053604-229.027726 511.053605-511.053604c0-70.033272-13.249538-136.280961-39.748614-196.850278L450.484288 840.399261z",
                                fill:
                                  _vm.voicedata.language == "cn"
                                    ? _vm.voicedata.ThemeColor
                                    : "#ccc",
                                "p-id": "11719",
                              },
                            }),
                          ]
                        ),
                        _vm._v(" "),
                        _c("span", [_vm._v("声韵分")]),
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(
                          _vm._s(
                            _vm.voicedata.language == "cn"
                              ? _vm.format(_vm.ratingData.phone_score)
                              : "-"
                          )
                        ),
                      ]),
                    ]
                  )
                : _vm._e(),
              _vm._v(" "),
              _vm.voicedata.language == "cn"
                ? _c(
                    "div",
                    { class: _vm.voicedata.language == "cn" ? "" : "Gray" },
                    [
                      _c("div", [
                        _c(
                          "svg",
                          {
                            staticClass: "icon",
                            attrs: {
                              t: "1705998006086",
                              viewBox: "0 0 1024 1024",
                              version: "1.1",
                              xmlns: "http://www.w3.org/2000/svg",
                              "p-id": "11718",
                              width: "16",
                              height: "16",
                            },
                          },
                          [
                            _c("path", {
                              attrs: {
                                d: "M450.484288 840.399261L160.887246 543.231054l49.212569-70.033272 236.598891 181.707948L946.395564 246.062847C857.434381 100.31793 694.654344 1.892791 511.053604 1.892791 229.027726 1.892791 0 230.920518 0 512.946396s229.027726 511.053604 511.053604 511.053604 511.053604-229.027726 511.053605-511.053604c0-70.033272-13.249538-136.280961-39.748614-196.850278L450.484288 840.399261z",
                                fill:
                                  _vm.voicedata.language == "cn"
                                    ? _vm.voicedata.ThemeColor
                                    : "#ccc",
                                "p-id": "11719",
                              },
                            }),
                          ]
                        ),
                        _vm._v(" "),
                        _c("span", [_vm._v("调型分")]),
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(
                          _vm._s(
                            _vm.voicedata.language == "cn"
                              ? _vm.format(_vm.ratingData.tone_score)
                              : "-"
                          )
                        ),
                      ]),
                    ]
                  )
                : _vm._e(),
              _vm._v(" "),
              _vm.voicedata.language == "cn"
                ? _c(
                    "div",
                    { class: _vm.voicedata.language == "cn" ? "" : "Gray" },
                    [
                      _c("div", [
                        _c(
                          "svg",
                          {
                            staticClass: "icon",
                            attrs: {
                              t: "1705998006086",
                              viewBox: "0 0 1024 1024",
                              version: "1.1",
                              xmlns: "http://www.w3.org/2000/svg",
                              "p-id": "11718",
                              width: "16",
                              height: "16",
                            },
                          },
                          [
                            _c("path", {
                              attrs: {
                                d: "M450.484288 840.399261L160.887246 543.231054l49.212569-70.033272 236.598891 181.707948L946.395564 246.062847C857.434381 100.31793 694.654344 1.892791 511.053604 1.892791 229.027726 1.892791 0 230.920518 0 512.946396s229.027726 511.053604 511.053604 511.053604 511.053604-229.027726 511.053605-511.053604c0-70.033272-13.249538-136.280961-39.748614-196.850278L450.484288 840.399261z",
                                fill:
                                  _vm.voicedata.language == "cn"
                                    ? _vm.voicedata.ThemeColor
                                    : "#ccc",
                                "p-id": "11719",
                              },
                            }),
                          ]
                        ),
                        _vm._v(" "),
                        _c("span", [_vm._v("整体印象分")]),
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(
                          _vm._s(
                            _vm.voicedata.language == "cn"
                              ? _vm.format(_vm.ratingData.emotion_score)
                              : "-"
                          )
                        ),
                      ]),
                    ]
                  )
                : _vm._e(),
            ]),
          ]),
        ]
      ),
      _vm._v(" "),
      _c("audio", {
        ref: "recordAudio",
        staticClass: "audio-component",
        attrs: {
          controls: "",
          preload: "auto",
          src: _vm.voicedata.recordDataUrl,
          loop: _vm.voicedata.model == "1" ? true : false,
        },
        on: {
          canplay: _vm.changeDuration,
          timeupdate: _vm.updateTime,
          pause: function ($event) {
            _vm.isPlay = false;
          },
        },
      }),
    ],
    2
  )
};
var __vue_staticRenderFns__$5u = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c(
      "div",
      {
        staticClass: "icon-box",
        staticStyle: { "background-color": "var(--themecolor)" },
      },
      [
        _c("img", {
          staticClass: "img3",
          attrs: { src: __$_require_images_voice_icon5_png__, alt: "" },
        }),
      ]
    )
  },
];
__vue_render__$5u._withStripped = true;

  /* style */
  const __vue_inject_styles__$5u = undefined;
  /* scoped */
  const __vue_scope_id__$5u = undefined;
  /* module identifier */
  const __vue_module_identifier__$5u = undefined;
  /* functional template */
  const __vue_is_functional_template__$5u = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5u = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5u, staticRenderFns: __vue_staticRenderFns__$5u },
    __vue_inject_styles__$5u,
    __vue_script__$5u,
    __vue_scope_id__$5u,
    __vue_is_functional_template__$5u,
    __vue_module_identifier__$5u,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$5u.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-recorder-group-render', {
    prefix: options.prefix
  }), __vue_component__$5u);
};

class DomUtils {
  static config = {
    MIN_LIMIT: 20,
    // Min size of zone
    DECIMAL_PLACES: 4 // Hotzone positioning decimal point limit number of digits
  };

  /**
   * Get a power result of 10 for the power of the constant
   * @return {Number}
   */
  static getMultiple = (decimalPlaces = this.config.DECIMAL_PLACES) => 10 ** decimalPlaces;

  /**
   * Limit decimal places
   * @param  {Number} num
   * @return {Number}
   */
  static decimalPoint = (val = 0) => Math.round(val * this.getMultiple()) / this.getMultiple() || 0;

  /**
   * Get element width and height
   * @param  {Object} elem
   * @return {Object}
   */
  static getOffset = (elem = {}) => ({
    width: elem.clientWidth || 0,
    height: elem.clientHeight || 0
  });

  /**
   * Get pageX
   * @param  {Object} e
   * @return {Number}
   */
  static getPageX = e => 'pageX' in e ? e.pageX : e.touches[0].pageX;

  /**
   * Get pageY
   * @param  {Object} e
   * @return {Number}
   */
  static getPageY = e => 'pageY' in e ? e.pageY : e.touches[0].pageY;

  /**
   * Gets the abscissa value of the mouse click relative to the target node
   * @param  {Object} e
   * @param  {Object} container
   * @return {Number}
   */
  static getDistanceX = (e, container) => this.getPageX(e) - (container.getBoundingClientRect().left + window.pageXOffset);

  /**
   * Gets the ordinate value of the mouse click relative to the target node
   * @param  {Object} e
   * @param  {Object} container
   * @return {Number}
   */
  static getDistanceY = (e, container) => this.getPageY(e) - (container.getBoundingClientRect().top + window.pageYOffset);

  /**
   * Treatment of boundary conditions when changing the size of the hotzone
   * @param {Object} itemInfo
   * @param {Object} styleInfo
   * @param {Object} container
   */
  static dealEdgeValue = (itemInfo, styleInfo, container) => {
    if (styleInfo.hasOwnProperty('left') && styleInfo.left < 0) {
      styleInfo.left = 0;
      styleInfo.width = itemInfo.width + itemInfo.left;
    }
    if (styleInfo.hasOwnProperty('top') && styleInfo.top < 0) {
      styleInfo.top = 0;
      styleInfo.height = itemInfo.height + itemInfo.top;
    }
    if (!styleInfo.hasOwnProperty('left') && styleInfo.hasOwnProperty('width')) {
      if (itemInfo.left + styleInfo.width > container.width) {
        styleInfo.width = container.width - itemInfo.left;
      }
    }
    if (!styleInfo.hasOwnProperty('top') && styleInfo.hasOwnProperty('height')) {
      if (itemInfo.top + styleInfo.height > container.height) {
        styleInfo.height = container.height - itemInfo.top;
      }
    }
    return Object.assign(itemInfo, styleInfo);
  };

  /**
   * Handle different drag points, capital letters mean: T-top，L-left，C-center，R-right，B-bottom
   * @param  {Object} itemInfo
   * @param  {Number} moveX
   * @param  {Number} moveY
   * @return {Object}
   */
  static dealTL = (itemInfo, moveX, moveY, minLimit = this.config.MIN_LIMIT) => {
    const styleInfo = {};
    const width = itemInfo.width - moveX;
    const height = itemInfo.height - moveY;
    if (width >= Math.min(minLimit, itemInfo.width)) {
      Object.assign(styleInfo, {
        width,
        left: itemInfo.left + moveX
      });
    }
    if (height >= Math.min(minLimit, itemInfo.height)) {
      Object.assign(styleInfo, {
        height,
        top: itemInfo.top + moveY
      });
    }
    return styleInfo;
  };
  static dealTC = (itemInfo, moveX, moveY, minLimit = this.config.MIN_LIMIT) => {
    let styleInfo = {};
    const height = itemInfo.height - moveY;
    if (height >= Math.min(minLimit, itemInfo.height)) {
      styleInfo = {
        height,
        top: itemInfo.top + moveY
      };
    }
    return styleInfo;
  };
  static dealTR = (itemInfo, moveX, moveY, minLimit = this.config.MIN_LIMIT) => {
    const styleInfo = {};
    const width = itemInfo.width + moveX;
    const height = itemInfo.height - moveY;
    if (width >= Math.min(minLimit, itemInfo.width)) {
      Object.assign(styleInfo, {
        width
      });
    }
    if (height >= Math.min(minLimit, itemInfo.height)) {
      Object.assign(styleInfo, {
        height,
        top: itemInfo.top + moveY
      });
    }
    return styleInfo;
  };
  static dealCL = (itemInfo, moveX, moveY, minLimit = this.config.MIN_LIMIT) => {
    const styleInfo = {};
    const width = itemInfo.width - moveX;
    if (width >= Math.min(minLimit, itemInfo.width)) {
      Object.assign(styleInfo, {
        width,
        left: itemInfo.left + moveX
      });
    }
    return styleInfo;
  };
  static dealCR = (itemInfo, moveX, moveY, minLimit = this.config.MIN_LIMIT) => {
    const styleInfo = {};
    const width = itemInfo.width + moveX;
    if (width >= Math.min(minLimit, itemInfo.width)) {
      Object.assign(styleInfo, {
        width
      });
    }
    return styleInfo;
  };
  static dealBL = (itemInfo, moveX, moveY, minLimit = this.config.MIN_LIMIT) => {
    const styleInfo = {};
    const width = itemInfo.width - moveX;
    const height = itemInfo.height + moveY;
    if (width >= Math.min(minLimit, itemInfo.width)) {
      Object.assign(styleInfo, {
        width,
        left: itemInfo.left + moveX
      });
    }
    if (height >= Math.min(minLimit, itemInfo.height)) {
      Object.assign(styleInfo, {
        height
      });
    }
    return styleInfo;
  };
  static dealBC = (itemInfo, moveX, moveY, minLimit = this.config.MIN_LIMIT) => {
    const styleInfo = {};
    const height = itemInfo.height + moveY;
    if (height >= Math.min(minLimit, itemInfo.height)) {
      Object.assign(styleInfo, {
        height
      });
    }
    return styleInfo;
  };
  static dealBR = (itemInfo, moveX, moveY, minLimit = this.config.MIN_LIMIT) => {
    const styleInfo = {};
    const width = itemInfo.width + moveX;
    const height = itemInfo.height + moveY;
    if (width >= Math.min(minLimit, itemInfo.width)) {
      Object.assign(styleInfo, {
        width
      });
    }
    if (height >= Math.min(minLimit, itemInfo.height)) {
      Object.assign(styleInfo, {
        height
      });
    }
    return styleInfo;
  };
}

var changeSize = {
  bind(el, binding, vnode) {
    if (!vnode.context.isInCreater) {
      return;
    }
    el.addEventListener('mousedown', handleMouseDown);
    function handleMouseDown(e) {
      const pointer = e.target.dataset.pointer;
      if (!pointer) {
        return;
      }
      e.stopPropagation();
      const zone = el.parentNode;
      const setting = vnode.context.setting;
      const container = DomUtils.getOffset(zone.parentNode);
      let itemInfo = {
        width: DomUtils.getOffset(zone).width || 0,
        height: DomUtils.getOffset(zone).height || 0,
        top: setting.topPer * container.height || 0,
        left: setting.leftPer * container.width || 0
      };
      let preX = DomUtils.getPageX(e);
      let preY = DomUtils.getPageY(e);
      let flag;

      // Hide the info displayed by hover
      vnode.context.handlehideZone(true);
      window.addEventListener('mousemove', handleChange);
      window.addEventListener('mouseup', handleMouseUp);

      // eslint-disable-next-line no-shadow
      function handleChange(e) {
        e.preventDefault();
        flag = true;
        const moveX = DomUtils.getPageX(e) - preX;
        const moveY = DomUtils.getPageY(e) - preY;
        preX = DomUtils.getPageX(e);
        preY = DomUtils.getPageY(e);

        // Handling the situation when different dragging points are selected
        const styleInfo = DomUtils[pointer](itemInfo, moveX, moveY);

        // Boundary value processing
        itemInfo = DomUtils.dealEdgeValue(itemInfo, styleInfo, container);
        Object.assign(zone.style, {
          top: `${itemInfo.top}px`,
          left: `${itemInfo.left}px`,
          width: `${itemInfo.width}px`,
          height: `${itemInfo.height}px`
        });
      }
      function handleMouseUp() {
        if (flag) {
          flag = false;
          const perInfo = {
            topPer: DomUtils.decimalPoint(itemInfo.top / container.height),
            leftPer: DomUtils.decimalPoint(itemInfo.left / container.width),
            widthPer: DomUtils.decimalPoint(itemInfo.width / container.width),
            heightPer: DomUtils.decimalPoint(itemInfo.height / container.height)
          };
          vnode.context.changeInfo(perInfo);

          // 兼容数据无变更情况下导致 computed 不更新，数据仍为 px 时 resize 出现的问题
          Object.assign(zone.style, {
            top: `${itemInfo.top}px`,
            left: `${itemInfo.left}px`,
            width: `${itemInfo.width}px`,
            height: `${itemInfo.height}px`
          });
        }
        // Show the info
        vnode.context.handlehideZone(false);
        window.removeEventListener('mousemove', handleChange);
        window.removeEventListener('mouseup', handleMouseUp);
      }
    }
    el.$destroy = () => el.removeEventListener('mousedown', handleMouseDown);
  },
  unbind(el) {
    el && el.$destroy && el.$destroy();
  }
};

console.log('工具函数集', DomUtils);
var dragItem = {
  bind(el, binding, vnode) {
    if (!vnode.context.isInCreater) {
      return;
    }
    el.addEventListener('mousedown', handleMouseDown);
    function handleMouseDown(e) {
      e.stopPropagation();
      const container = DomUtils.getOffset(el.parentNode);
      const preX = DomUtils.getPageX(e);
      const preY = DomUtils.getPageY(e);
      let topPer;
      let leftPer;
      let flag;
      window.addEventListener('mousemove', handleChange);
      window.addEventListener('mouseup', handleMouseUp);

      // eslint-disable-next-line no-shadow
      function handleChange(e) {
        e.preventDefault();
        flag = true;

        // Hide the info displayed by hover
        vnode.context.handlehideZone(true);
        const setting = vnode.context.setting;
        let moveX = DomUtils.getPageX(e) - preX;
        let moveY = DomUtils.getPageY(e) - preY;
        setting.topPer = setting.topPer || 0;
        setting.leftPer = setting.leftPer || 0;
        topPer = DomUtils.decimalPoint(moveY / container.height + setting.topPer);
        leftPer = DomUtils.decimalPoint(moveX / container.width + setting.leftPer);

        // Hotzone moving boundary processing
        if (topPer < 0) {
          topPer = 0;
          moveY = -container.height * setting.topPer;
        }
        if (leftPer < 0) {
          leftPer = 0;
          moveX = -container.width * setting.leftPer;
        }
        if (topPer + setting.heightPer > 1) {
          topPer = 1 - setting.heightPer;
          moveY = container.height * (topPer - setting.topPer);
        }
        if (leftPer + setting.widthPer > 1) {
          leftPer = 1 - setting.widthPer;
          moveX = container.width * (leftPer - setting.leftPer);
        }
        el.style.transform = `translate(${moveX}px, ${moveY}px)`;
      }
      function handleMouseUp() {
        if (flag) {
          flag = false;
          el.style.transform = 'translate(0, 0)';
          vnode.context.changeInfo({
            topPer,
            leftPer
          });
        }

        // Show the info
        vnode.context.handlehideZone(false);
        window.removeEventListener('mousemove', handleChange);
        window.removeEventListener('mouseup', handleMouseUp);
      }
    }
    el.$destroy = () => el.removeEventListener('mousedown', handleMouseDown);
  },
  unbind(el) {
    el && el.$destroy && el.$destroy();
  }
};

//
var script$5t = {
  name: 'Zone',
  directives: {
    changeSize,
    dragItem
  },
  props: {
    index: {
      type: [Number, String],
      default: ''
    },
    setting: {
      type: [Object],
      default: () => ({})
    },
    isInCreater: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      zoneTop: '',
      zoneLeft: '',
      zoneWidth: '',
      zoneHeight: '',
      hideZone: false,
      tooSmall: false
    };
  },
  computed: {
    hoverTitle() {
      let {
        hotTarget
      } = this.setting;
      let text = '';
      if (hotTarget) {
        switch (hotTarget.type) {
          case 'link':
            text = '链接';
            break;
          case 'looseleaf':
            text = '活页';
            break;
          case 'chapter':
            text = '章节';
            break;
        }
      }
      return text;
    }
  },
  watch: {
    setting: {
      handler(val) {
        this.setZoneInfo(val);
      },
      deep: true
    }
  },
  mounted() {
    this.setZoneInfo(this.setting);
  },
  methods: {
    setZoneInfo(val) {
      this.zoneTop = this.getZoneStyle(val.topPer);
      this.zoneLeft = this.getZoneStyle(val.leftPer);
      this.zoneWidth = this.getZoneStyle(val.widthPer);
      this.zoneHeight = this.getZoneStyle(val.heightPer);
      this.tooSmall = val.widthPer < 0.01 && val.heightPer < 0.01;
    },
    handlehideZone(isHide = true) {
      if (this.hideZone === isHide) {
        return;
      }
      this.hideZone = isHide;
    },
    changeInfo(info = {}) {
      const {
        index
      } = this;
      this.$emit('changeInfo', {
        info,
        index
      });
    },
    delItem(index) {
      this.$emit('delItem', index);
    },
    getZoneStyle(val) {
      return `${(val || 0) * 100}%`;
    }
  }
};

/* script */
const __vue_script__$5t = script$5t;

/* template */
var __vue_render__$5t = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      directives: [{ name: "drag-item", rawName: "v-drag-item" }],
      style: {
        top: _vm.zoneTop,
        left: _vm.zoneLeft,
        width: _vm.zoneWidth,
        height: _vm.zoneHeight,
      },
      attrs: { title: _vm.hoverTitle },
    },
    [
      _c(
        "ul",
        {
          directives: [{ name: "change-size", rawName: "v-change-size" }],
          staticClass: "hz-m-box",
          class: {
            "hz-z-hidden": _vm.tooSmall,
            "hz-m-hoverbox": !_vm.hideZone,
          },
        },
        [
          _c(
            "li",
            {
              staticClass: "hz-u-index",
              attrs: { title: "热区" + (_vm.index + 1) },
            },
            [_vm._v(_vm._s(_vm.isInCreater ? "热区" + (_vm.index + 1) : ""))]
          ),
          _vm._v(" "),
          _c(
            "li",
            {
              directives: [
                {
                  name: "show",
                  rawName: "v-show",
                  value: !_vm.hideZone && _vm.isInCreater,
                  expression: "!hideZone && isInCreater",
                },
              ],
              staticClass: "hz-u-close",
              attrs: { title: "删除该热区" },
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  return _vm.delItem(_vm.index)
                },
              },
            },
            [
              _c(
                "svg",
                {
                  staticClass: "hz-u-close-icon",
                  attrs: {
                    xmlns: "http://www.w3.org/2000/svg",
                    viewBox: "0 0 1024 1024",
                  },
                },
                [
                  _c("path", {
                    attrs: {
                      d: "M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1\n          191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0\n          0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z",
                    },
                  }),
                ]
              ),
            ]
          ),
          _vm._v(" "),
          _c("li", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.isInCreater,
                expression: "isInCreater",
              },
            ],
            staticClass: "hz-u-square hz-u-square-tl",
            attrs: { "data-pointer": "dealTL" },
          }),
          _vm._v(" "),
          _c("li", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.isInCreater,
                expression: "isInCreater",
              },
            ],
            staticClass: "hz-u-square hz-u-square-tc",
            attrs: { "data-pointer": "dealTC" },
          }),
          _vm._v(" "),
          _c("li", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.isInCreater,
                expression: "isInCreater",
              },
            ],
            staticClass: "hz-u-square hz-u-square-tr",
            attrs: { "data-pointer": "dealTR" },
          }),
          _vm._v(" "),
          _c("li", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.isInCreater,
                expression: "isInCreater",
              },
            ],
            staticClass: "hz-u-square hz-u-square-cl",
            attrs: { "data-pointer": "dealCL" },
          }),
          _vm._v(" "),
          _c("li", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.isInCreater,
                expression: "isInCreater",
              },
            ],
            staticClass: "hz-u-square hz-u-square-cr",
            attrs: { "data-pointer": "dealCR" },
          }),
          _vm._v(" "),
          _c("li", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.isInCreater,
                expression: "isInCreater",
              },
            ],
            staticClass: "hz-u-square hz-u-square-bl",
            attrs: { "data-pointer": "dealBL" },
          }),
          _vm._v(" "),
          _c("li", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.isInCreater,
                expression: "isInCreater",
              },
            ],
            staticClass: "hz-u-square hz-u-square-bc",
            attrs: { "data-pointer": "dealBC" },
          }),
          _vm._v(" "),
          _c("li", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.isInCreater,
                expression: "isInCreater",
              },
            ],
            staticClass: "hz-u-square hz-u-square-br",
            attrs: { "data-pointer": "dealBR" },
          }),
        ]
      ),
    ]
  )
};
var __vue_staticRenderFns__$5t = [];
__vue_render__$5t._withStripped = true;

  /* style */
  const __vue_inject_styles__$5t = undefined;
  /* scoped */
  const __vue_scope_id__$5t = undefined;
  /* module identifier */
  const __vue_module_identifier__$5t = undefined;
  /* functional template */
  const __vue_is_functional_template__$5t = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5t = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5t, staticRenderFns: __vue_staticRenderFns__$5t },
    __vue_inject_styles__$5t,
    __vue_script__$5t,
    __vue_scope_id__$5t,
    __vue_is_functional_template__$5t,
    __vue_module_identifier__$5t,
    false,
    undefined,
    undefined,
    undefined
  );

var addItem = {
  bind(el, binding, vnode) {
    const MIN_LIMIT = DomUtils.config.MIN_LIMIT;
    if (!vnode.context.isInCreater) {
      return;
    }
    el.addEventListener('mousedown', handleMouseDown);
    function handleMouseDown(e) {
      e.preventDefault();
      if (vnode.context?.zones?.length >= vnode.context.max) {
        vnode.context.onMaxCount();
        return;
      }
      let itemInfo = {
        top: DomUtils.getDistanceY(e, el),
        left: DomUtils.getDistanceX(e, el),
        width: 0,
        height: 0
      };
      const container = DomUtils.getOffset(el);

      // Only used once at the beginning of init
      const setting = {
        topPer: DomUtils.decimalPoint(itemInfo.top / container.height),
        leftPer: DomUtils.decimalPoint(itemInfo.left / container.width),
        widthPer: 0,
        heightPer: 0,
        hotTarget: {
          type: null,
          value: ''
        }
      };
      let preX = DomUtils.getPageX(e);
      let preY = DomUtils.getPageY(e);
      vnode.context.addItem(setting);
      window.addEventListener('mousemove', handleChange);
      window.addEventListener('mouseup', handleMouseUp);

      // eslint-disable-next-line no-shadow
      function handleChange(e) {
        e.preventDefault();
        const moveX = DomUtils.getPageX(e) - preX;
        const moveY = DomUtils.getPageY(e) - preY;
        preX = DomUtils.getPageX(e);
        preY = DomUtils.getPageY(e);

        // Not consider the direction of movement first, consider only the lower right drag point
        const minLimit = 0;
        const styleInfo = DomUtils.dealBR(itemInfo, moveX, moveY, minLimit);

        // Boundary value processing
        itemInfo = DomUtils.dealEdgeValue(itemInfo, styleInfo, container);
        Object.assign(el.lastElementChild.style, {
          top: `${itemInfo.top}px`,
          left: `${itemInfo.left}px`,
          width: `${itemInfo.width}px`,
          height: `${itemInfo.height}px`
        });
      }
      function handleMouseUp() {
        const perInfo = {
          topPer: DomUtils.decimalPoint(itemInfo.top / container.height),
          leftPer: DomUtils.decimalPoint(itemInfo.left / container.width),
          widthPer: DomUtils.decimalPoint(itemInfo.width / container.width),
          heightPer: DomUtils.decimalPoint(itemInfo.height / container.height),
          hotTarget: {
            type: null,
            value: ''
          }
        };
        if (vnode.context.isOverRange()) {
          console.log('isOverRange!!!!!!!!!!');
          vnode.context.overRange();
        } else if (container.height < MIN_LIMIT && itemInfo.width > MIN_LIMIT) {
          vnode.context.changeItem(Object.assign(perInfo, {
            topPer: 0,
            heightPer: 1
          }));
        } else if (container.width < MIN_LIMIT && itemInfo.height > MIN_LIMIT) {
          vnode.context.changeItem(Object.assign(perInfo, {
            leftper: 0,
            widthPer: 1
          }));
        } else if (itemInfo.width > MIN_LIMIT && itemInfo.height > MIN_LIMIT) {
          vnode.context.changeItem(perInfo);
        } else {
          console.log('eraseItem!!!!!!!!!!');
          vnode.context.eraseItem();
        }
        window.removeEventListener('mousemove', handleChange);
        window.removeEventListener('mouseup', handleMouseUp);
      }
    }
    el.$destroy = () => el.removeEventListener('mousedown', handleMouseDown);
  },
  unbind(el) {
    el && el.$destroy && el.$destroy();
  }
};

//
var script$5s = {
  name: 'HotZone',
  directives: {
    addItem
  },
  components: {
    Zone: __vue_component__$5t
  },
  inject: {
    getCurrentRuleIndex: {
      value: 'getCurrentRuleIndex',
      default: null
    },
    getSelfRuleIndex: {
      value: 'getSelfRuleIndex',
      default: null
    }
  },
  props: {
    image: {
      type: String,
      required: true
    },
    value: {
      type: Array,
      default: () => []
    },
    max: {
      type: Number,
      default: Infinity
    },
    isInCreater: {
      type: Boolean,
      default: false
    },
    zoneVisible: {
      type: Boolean,
      default: true
    },
    mode: {
      type: String,
      default: 'editor'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  computed: {
    zones: {
      get() {
        return this.value;
      },
      set(value) {
        this.$emit('input', value);
      }
    },
    isInEditor() {
      return !this.isInCreater && this.mode === 'editor';
    }
  },
  methods: {
    findCurSelect() {
      return this.value.find(item => item.selected);
    },
    onSelect(zone, by) {
      console.log('热区zone选择', this.isInCreater, by);
      if (!this.isInCreater && by === 'addItem') {
        this.$emit('wrap-click');
      }
      if (this.isInCreater || by === 'wrap') {
        const curZone = this.findCurSelect();
        if (curZone) curZone.selected = 0;
        if (zone) {
          this.$set(zone, 'selected', 1);
        }
        this.$emit('select-zone', zone);
        this.hasChange();
      } else {
        if (by === 'click') {
          const curZone = this.findCurSelect();
          if (curZone) curZone.selected = 0;
          if (zone) {
            this.$set(zone, 'selected', 1);
          }
          let {
            type,
            value,
            label,
            desc,
            cover
          } = zone.hotTarget || {};
          console.log('zone点击', type, this.isInEditor, zone);
          this.$EventBus.$emit('hotzoneClick', {
            type,
            value,
            label,
            desc,
            cover
          });
          if (this.isInEditor) {
            this.$emit('wrap-click');
          }
        }
      }
    },
    changeInfo(res) {
      const {
        info,
        index
      } = res;
      this.changeItem(info, index, 1);
    },
    addItem(setting) {
      this.zones.push(setting);
      this.hasChange();
      this.$emit('add', setting);
      this.onSelect(setting, 'addItem');
    },
    onMaxCount() {
      this.$message.warning(`最多可创建${this.max}个热区`);
    },
    eraseItem(index = this.zones.length - 1) {
      this.removeItem(index);
      this.$emit('erase', index);
    },
    isOverRange() {
      const {
        max,
        zones
      } = this;
      return max && zones.length > max;
    },
    overRange() {
      const index = this.zones.length - 1;
      this.removeItem(index);
      this.$emit('overRange', index);
    },
    removeItem(index = this.zones.length - 1) {
      const curZone = this.zones[index];
      // 移除当前选中的
      if (curZone === this.findCurSelect()) {
        this.onSelect(null);
      }

      //  移除当前项
      this.zones.splice(index, 1);
      this.hasChange();
      this.$emit('remove', curZone, index);
    },
    changeItem(info, index = this.zones.length - 1, isChangeInfo) {
      Object.assign(this.zones[index], info);
      this.hasChange();
      this.onSelect(this.zones[index], isChangeInfo ? 'changeItem' : 'changeItem');
    },
    hasChange() {
      this.$emit('change', this.zones);
    },
    setZoneTarget(data) {
      const curZone = this.findCurSelect();
      let isOperating = this.getCurrentRuleIndex && this.getCurrentRuleIndex() === this.getSelfRuleIndex();
      if (curZone && (isOperating || this.isInCreater)) {
        curZone.hotTarget = {
          ...data
        };
        this.hasChange();
      }
    }
  },
  mounted() {
    let _this = this;
    this.$EventBus.$on('setZoneTarget', data => {
      _this.setZoneTarget(data);
    });
    // this.$EventBus.$on('setInitZones', (data) => {
    //   console.log('热区数据更新', data);
    //   try {
    //     let current = data.find(item => item.selected)
    //   if(!current) {
    //     data[0].selected = true
    //   }
    //   data.forEach((item,index) => {
    //     _this.zones.splice(index,1,item)
    //   })
    //   // setTimeout(() => {
    //   //   _this.zones = [...data]
    //   // },500)
    //   console.log('没更新????',this.zones);
    //   } catch (error) {
    //     console.log('出错了',error);
    //   }

    // })
  },
  destroyed() {
    this.$EventBus.$off('setZoneTarget');
    // this.$EventBus.$off('setInitZones')
  }
};

/* script */
const __vue_script__$5s = script$5s;

/* template */
var __vue_render__$5s = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      ref: "content",
      class: ["hz-m-wrap", _vm.isInCreater ? "editing" : ""],
      on: {
        click: function ($event) {
          if ($event.target !== $event.currentTarget) {
            return null
          }
          return _vm.onSelect(null, "wrap")
        },
      },
    },
    [
      _c("img", {
        staticClass: "hz-u-img",
        attrs: {
          src:
            _vm.image.indexOf("./") !== -1
              ? _vm.resourceBasisPath + _vm.image.split("./")[1]
              : _vm.image,
          alt: "",
        },
      }),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [{ name: "add-item", rawName: "v-add-item" }],
          staticClass: "hz-m-area",
        },
        _vm._l(_vm.zones, function (zone, index) {
          return _c("zone", {
            key: index,
            staticClass: "hz-m-item",
            class: {
              "hz-m-item-selected": zone.selected,
              "in-editor": _vm.mode === "editor" && !_vm.isInCreater,
              "is-transparent": !_vm.isInCreater && !_vm.zoneVisible,
            },
            attrs: {
              index: index,
              setting: zone,
              isInCreater: _vm.isInCreater,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: {
              delItem: function ($event) {
                return _vm.removeItem($event)
              },
              changeInfo: function ($event) {
                return _vm.changeInfo($event)
              },
            },
            nativeOn: {
              click: function ($event) {
                $event.stopPropagation();
                return _vm.onSelect(zone, "click")
              },
            },
          })
        }),
        1
      ),
    ]
  )
};
var __vue_staticRenderFns__$5s = [];
__vue_render__$5s._withStripped = true;

  /* style */
  const __vue_inject_styles__$5s = undefined;
  /* scoped */
  const __vue_scope_id__$5s = undefined;
  /* module identifier */
  const __vue_module_identifier__$5s = undefined;
  /* functional template */
  const __vue_is_functional_template__$5s = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5s = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5s, staticRenderFns: __vue_staticRenderFns__$5s },
    __vue_inject_styles__$5s,
    __vue_script__$5s,
    __vue_scope_id__$5s,
    __vue_is_functional_template__$5s,
    __vue_module_identifier__$5s,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5r = {
  name: 'XmlHotzoneRender',
  components: {
    HotZone: __vue_component__$5s
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    max: {
      type: Number,
      default: Infinity
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {
        titleVisible: 'yes',
        titlePosition: 'under',
        titleAlign: 'left',
        zoneVisible: 'yes',
        zoneWidth: 100,
        imageList: [{
          source: 'upload',
          //来源：上传，素材
          uploadFileUrl: '',
          title: '图片名称',
          content: '',
          hotzoneSetList: [{
            widthPer: 0.25,
            heightPer: 0.25,
            topPer: 0.25,
            leftPer: 0.25,
            selected: 0,
            hotTarget: {
              type: 'link',
              value: '',
              label: ''
            }
          }]
        }]
      },
      zones: [{
        widthPer: 0.25,
        heightPer: 0.25,
        topPer: 0.25,
        leftPer: 0.25,
        selected: 0,
        hotTarget: {
          type: 'link',
          value: '',
          label: ''
        }
      }],
      //属性组件名
      propertyComponentsName: 'xml-hotzone-property',
      dialogShow: false,
      curRecordUrl: '',
      curRecordTitle: '',
      curCoverFileUrl: '',
      curRecordContent: '',
      currentPlayer: {},
      modalPlayerKey: 'mpk' + new Date().getTime(),
      hasInitSet: false
    };
  },
  computed: {
    isEmpty() {
      return !(this.blockData.recordSetList && this.blockData.recordSetList.length);
    },
    zoneImageModel() {
      return this.blockData.imageList ? this.blockData.imageList[0] : {};
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          console.log('新data', newValue);
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    },
    blockData: {
      handler(newValue) {
        if (!this.extendParams.isInCreater || this.extendParams.isEditMode && !this.hasInitSet) {
          if (this.extendParams.isEditMode) {
            this.hasInitSet = true;
          }
          this.$nextTick(() => {
            let newZones = this.zoneImageModel.hotzoneSetList || [];
            this.zones = [...newZones];
          });
        }
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    showDialog(param) {
      this.curRecordUrl = param.url;
      this.curRecordTitle = param.title;
      this.curCoverFileUrl = param.coverFileUrl;
      this.curRecordContent = param.content;
      this.currentPlayer = this.blockData.recordSetList[param.playerIndex];
      this.modalPlayerKey = 'mpk' + new Date().getTime();
      this.$nextTick(() => {
        this.dialogShow = true;
      });
    },
    onSelect(zone) {
      // console.log('当前选择热区', zone, this.zones);
    },
    updateZones(zones) {
      this.$EventBus.$emit('updateZoneInfo', {
        zones
      });
    },
    remove(curZone, index) {
      this.$emit('remove', curZone, index);
    },
    addZone(zone) {
      // console.log('添加了', zone);
    },
    wrapClick() {
      this.$emit('wrap-click', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    }
  },
  created() {},
  mounted() {
    if (!this.extendParams.isInCreater) {
      this.zones = [...this.zoneImageModel.hotzoneSetList];
    }
  }
  // destroyed() {
  //   this.$EventBus.$off('setInitZones')
  // }
};

/* script */
const __vue_script__$5r = script$5r;

/* template */
var __vue_render__$5r = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-hotzone-container xml-group-item",
      class: "xml-hotzone-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      [
        _c("div", { staticClass: "fixed-ratio-container" }, [
          _c(
            "div",
            {
              class: [
                "xml-hotzone__wrapper",
                "style-mode--" + _vm.blockData.styleMode,
                _vm.mode,
              ],
              style: { width: _vm.blockData.zoneWidth + "%" },
            },
            [
              _c(
                "div",
                { staticClass: "xml-hotzone-box" },
                [
                  _c("hot-zone", {
                    staticStyle: { width: "100%", height: "100%" },
                    attrs: {
                      image:
                        _vm.zoneImageModel.uploadFileUrl ||
                        _vm.extendParams.emptyImage ||
                        "",
                      mode: _vm.mode,
                      max: _vm.max,
                      resourceBasisPath: _vm.resourceBasisPath,
                      isInCreater: _vm.extendParams.isInCreater,
                      zoneVisible: _vm.blockData.zoneVisible === "yes",
                    },
                    on: {
                      "wrap-click": _vm.wrapClick,
                      "select-zone": _vm.onSelect,
                      add: _vm.addZone,
                      change: _vm.updateZones,
                      remove: _vm.remove,
                    },
                    model: {
                      value: _vm.zones,
                      callback: function ($$v) {
                        _vm.zones = $$v;
                      },
                      expression: "zones",
                    },
                  }),
                  _vm._v(" "),
                  _vm.zoneImageModel.title &&
                  _vm.blockData.titleVisible !== "no" &&
                  _vm.blockData.titlePosition === "bottom"
                    ? _c(
                        "div",
                        {
                          staticClass: "xml-hot-zone-title image-title--bottom",
                          style: {
                            textAlign: _vm.blockData.titleAlign || "left",
                          },
                        },
                        [
                          _vm._v(
                            "\n            " +
                              _vm._s(_vm.zoneImageModel.title) +
                              "\n          "
                          ),
                        ]
                      )
                    : _vm._e(),
                ],
                1
              ),
            ]
          ),
        ]),
        _vm._v(" "),
        _vm.zoneImageModel.title &&
        _vm.blockData.titleVisible !== "no" &&
        _vm.blockData.titlePosition === "under"
          ? _c(
              "div",
              {
                staticClass: "xml-hot-zone-title image-title--under",
                style: { textAlign: _vm.blockData.titleAlign || "left" },
              },
              [_vm._v("\n      " + _vm._s(_vm.zoneImageModel.title) + "\n    ")]
            )
          : _vm._e(),
      ],
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          staticClass: "resource-preview player-dialog",
          attrs: {
            title: "",
            visible: _vm.dialogShow,
            "destroy-on-close": true,
            width: "100%",
            modal: false,
            "show-close": false,
            "append-to-body": "",
            "custom-class": "preview-modal-hotzone",
            "close-on-click-modal": true,
          },
          on: {
            "update:visible": function ($event) {
              _vm.dialogShow = $event;
            },
          },
        },
        [_c("div", { staticClass: "xml-modal-player__wrapper" })]
      ),
    ],
    2
  )
};
var __vue_staticRenderFns__$5r = [];
__vue_render__$5r._withStripped = true;

  /* style */
  const __vue_inject_styles__$5r = undefined;
  /* scoped */
  const __vue_scope_id__$5r = undefined;
  /* module identifier */
  const __vue_module_identifier__$5r = undefined;
  /* functional template */
  const __vue_is_functional_template__$5r = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5r = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5r, staticRenderFns: __vue_staticRenderFns__$5r },
    __vue_inject_styles__$5r,
    __vue_script__$5r,
    __vue_scope_id__$5r,
    __vue_is_functional_template__$5r,
    __vue_module_identifier__$5r,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5q = {
  name: 'XmlHotTargetModalViewer',
  components: {
    XmlAudioModalPlayer: __vue_component__$5Z,
    XmlVideoModalPlayer: __vue_component__$5A,
    XmlTextDialog: __vue_component__$69
  },
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    data: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      playIcon: playIcon$2,
      titleLeftIcon,
      titleRightIcon,
      modalPlayerKey: 'mpk' + new Date().getTime()
    };
  },
  computed: {
    dialogVisible: {
      get() {
        return this.visible;
      },
      set(value) {
        this.$emit('update:visible', value);
      }
    },
    isMaterialType() {
      const dict = ['image', 'audio', 'video'];
      return dict.includes(this.data.type);
    }
  },
  mounted() {},
  watch: {
    visible: {
      handler(n, o) {
        if (n) {
          this.modalPlayerKey = 'mpk' + new Date().getTime();
        }
      },
      immediate: true
    }
  },
  methods: {
    timeUpdate(e) {},
    resetTimeUpdate() {}
  }
};

/* script */
const __vue_script__$5q = script$5q;

/* template */
var __vue_render__$5q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      staticClass: "xml-custom-modal player-dialog",
      attrs: {
        title: "",
        visible: _vm.dialogVisible,
        "destroy-on-close": true,
        width: "100%",
        modal: false,
        "show-close": false,
        "append-to-body": "",
        "custom-class": "xml-modal-viewer xml-modal-viewer--hotzone",
        "close-on-click-modal": true,
      },
      on: {
        "update:visible": function ($event) {
          _vm.dialogVisible = $event;
        },
      },
    },
    [
      _c(
        "div",
        { staticClass: "xml-modal-viewer__wrapper" },
        [
          _vm.isMaterialType
            ? [
                _vm.data.type === "audio"
                  ? _c("xml-audio-modal-player", {
                      key: _vm.modalPlayerKey,
                      attrs: {
                        mode: "preview",
                        "play-style": "yuan-wen",
                        loop: false,
                        scheduleControl: "yes",
                        url: _vm.data.value,
                        title: _vm.data.label,
                        content: _vm.data.desc,
                        "cover-image-url": _vm.data.cover,
                        styleMode: "A",
                        "play-mode": "dan-ci",
                      },
                      on: {
                        timeUpdate: function (e) {
                          return _vm.timeUpdate(e)
                        },
                        resetTimeUpdate: function ($event) {
                          return _vm.resetTimeUpdate()
                        },
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                _vm.data.type === "video"
                  ? _c("xml-video-modal-player", {
                      key: _vm.modalPlayerKey,
                      attrs: {
                        mode: "preview",
                        playStyle: "yuan-wen",
                        loop: false,
                        canSkip: true,
                        src: _vm.data.value,
                        title: _vm.data.label,
                        content: _vm.data.desc,
                        poster: _vm.data.cover,
                      },
                      on: {
                        timeUpdate: function (e) {
                          return _vm.timeUpdate(e)
                        },
                        resetTimeUpdate: function ($event) {
                          return _vm.resetTimeUpdate()
                        },
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                _vm.data.type === "image"
                  ? _c("div", { staticClass: "xml-modal-viewer__image" }, [
                      _vm.data.label
                        ? _c("div", { staticClass: "title-block" }, [
                            _c("div", { staticClass: "title-adorn" }, [
                              _c("img", { attrs: { src: _vm.titleLeftIcon } }),
                            ]),
                            _vm._v(" "),
                            _c("div", { staticClass: "title" }, [
                              _vm._v(_vm._s(_vm.data.label)),
                            ]),
                            _vm._v(" "),
                            _c("div", { staticClass: "title-adorn" }, [
                              _c("img", { attrs: { src: _vm.titleRightIcon } }),
                            ]),
                          ])
                        : _vm._e(),
                      _vm._v(" "),
                      _c(
                        "div",
                        { staticClass: "xml-modal-viewer__scroll-wrapper" },
                        [
                          _c(
                            "div",
                            {
                              class: [
                                "xml-image-container",
                                "xml-image-container--aspect-fit",
                              ],
                            },
                            [
                              _c("el-image", {
                                attrs: { src: _vm.data.value },
                              }),
                            ],
                            1
                          ),
                          _vm._v(" "),
                          _vm.data.desc
                            ? _c("div", { staticClass: "content-block" }, [
                                _c("div", { staticClass: "label" }, [
                                  _c("span", [_vm._v("简介")]),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "content" }, [
                                  _vm._v(_vm._s(_vm.data.desc || "暂无")),
                                ]),
                              ])
                            : _vm._e(),
                        ]
                      ),
                    ])
                  : _vm._e(),
              ]
            : void 0,
        ],
        2
      ),
    ]
  )
};
var __vue_staticRenderFns__$5q = [];
__vue_render__$5q._withStripped = true;

  /* style */
  const __vue_inject_styles__$5q = undefined;
  /* scoped */
  const __vue_scope_id__$5q = undefined;
  /* module identifier */
  const __vue_module_identifier__$5q = undefined;
  /* functional template */
  const __vue_is_functional_template__$5q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5q, staticRenderFns: __vue_staticRenderFns__$5q },
    __vue_inject_styles__$5q,
    __vue_script__$5q,
    __vue_scope_id__$5q,
    __vue_is_functional_template__$5q,
    __vue_module_identifier__$5q,
    false,
    undefined,
    undefined,
    undefined
  );

const components$2 = [__vue_component__$5r, __vue_component__$5q];
var XmlHotzone = {
  ...components$2
};

const presetBgColors = ['#ede3fc', '#ffe4d2', '#ecebb4', '#fcdff6', '#d9f0b3', '#ccf1d9', '#bef1fe', '#fee6b4', '#cdedfc', '#dce8fa'];

//
var script$5p = {
  name: 'XmlLayoutRender',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    bindingComponents: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      blockData: {
        //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
        height: 'auto',
        rows: [1],
        columns: [1, 1],
        rowsUnit: 'fr',
        columnsUnit: 'fr',
        rowGap: 0,
        columnGap: 0,
        autoFlow: ['row', 'dense'],
        padding: [2, 2, 2, 2],
        areaBoxes: []
      },
      propertyComponentsName: 'xml-layout-property',
      //属性组件名
      presetBgColors,
      refreshKey: 'mpk' + new Date().getTime()
    };
  },
  computed: {
    containerStyle() {
      let {
        height,
        padding,
        rows,
        columns,
        rowsUnit,
        columnsUnit,
        rowGap,
        columnGap,
        autoFlow
      } = this.blockData;
      let stringPadding = padding.map(item => item + 'px');
      let gridTemplateRows = rows.map(item => item + rowsUnit).join(' ');
      let gridTemplateColumns = columns.map(item => item + columnsUnit).join(' ');
      return {
        display: 'grid',
        height: height === 'auto' ? 'auto' : `${height}px`,
        padding: stringPadding.join(' '),
        gridAutoFlow: autoFlow.join(' '),
        gridTemplateRows,
        gridTemplateColumns,
        gap: `${rowGap}px ${columnGap}px`
      };
    },
    injectedAreaBoxes() {
      return this.blockData.areaBoxes.filter(item => !!item.injectComponent?.data);
    },
    spareAreaBoxes() {
      return this.blockData.areaBoxes.filter(item => !item.injectComponent?.data);
    },
    isEmpty() {
      return !(this.blockData.recordSetList && this.blockData.recordSetList.length);
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          console.log('新data', newValue);
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    }
  },
  provide() {
    return {
      getCatalogList: () => ({
        data: this.catalogList
      }),
      getCurrentRuleIndex: () => this.currentRuLeIndex,
      getXmlLayoutInstance: () => this
    };
  },
  methods: {
    // getAreaBoxMainIndex(uuid) {
    //   return this.blockData.areaBoxes.findIndex(item => item.uuid === uuid)
    // },
    // genAreaBoxStyle(areaBox,index) {
    //   let { rowStart, rowEnd, columnStart, columnEnd } = areaBox
    //   let target = index % this.presetBgColors.length

    //   return {
    //     '--areabox-color': this.presetBgColors[target],
    //     gridRow: `${rowStart} / ${rowEnd}`,
    //     gridColumn: `${columnStart} / ${columnEnd}`,
    //     backgroundColor: `${this.presetBgColors[target]}66`, // 66透明度
    //   }
    // },
    // spareAreaBoxClick(event, item) {
    //   let rect = event.target.getBoundingClientRect()
    //   this.$EventBus.$emit('areaBoxClick', { ...item, type: 'spare', rect }, { blockId: this.blockId, ruleIndex: this.ruleIndex})
    // },
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    }
  },
  created() {}
};

/* script */
const __vue_script__$5p = script$5p;

/* template */
var __vue_render__$5p = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-layout-container",
      class: "xml-layout-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: {
        "!click": function ($event) {
          return _vm.blockClick.apply(null, arguments)
        },
      },
    },
    [
      _c("div", { class: ["xml-layout__wrapper", _vm.mode] }, [
        _c(
          "div",
          {
            staticClass: "xml-grid-layout xml-grid-layout__container",
            style: _vm.containerStyle,
          },
          [
            _vm._t("default"),
            _vm._v(" "),
            _vm._l(_vm.blockData.areaBoxes, function (item, index) {
              return _c("XmlAreaBox", {
                key: item.uuid,
                attrs: {
                  injected: _vm.bindingComponents.indexOf(item.uuid) !== -1,
                  data: item,
                  ruleIndex: _vm.ruleIndex,
                  boxIndex: index,
                  mode: _vm.mode,
                  sign: _vm.currentRule.sign,
                },
              })
            }),
          ],
          2
        ),
      ]),
    ]
  )
};
var __vue_staticRenderFns__$5p = [];
__vue_render__$5p._withStripped = true;

  /* style */
  const __vue_inject_styles__$5p = undefined;
  /* scoped */
  const __vue_scope_id__$5p = undefined;
  /* module identifier */
  const __vue_module_identifier__$5p = undefined;
  /* functional template */
  const __vue_is_functional_template__$5p = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5p = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5p, staticRenderFns: __vue_staticRenderFns__$5p },
    __vue_inject_styles__$5p,
    __vue_script__$5p,
    __vue_scope_id__$5p,
    __vue_is_functional_template__$5p,
    __vue_module_identifier__$5p,
    false,
    undefined,
    undefined,
    undefined
  );

/*! 
 * portal-vue © Thorsten Lünborg, 2019 
 * 
 * Version: 2.1.7
 * 
 * LICENCE: MIT 
 * 
 * https://github.com/linusborg/portal-vue
 * 
*/
function _typeof$1(obj) {
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof$1 = function (obj) {
      return typeof obj;
    };
  } else {
    _typeof$1 = function (obj) {
      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };
  }
  return _typeof$1(obj);
}
function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
    return arr2;
  }
}
function _iterableToArray(iter) {
  if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance");
}
var inBrowser = typeof window !== 'undefined';
function freeze(item) {
  if (Array.isArray(item) || _typeof$1(item) === 'object') {
    return Object.freeze(item);
  }
  return item;
}
function combinePassengers(transports) {
  var slotProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  return transports.reduce(function (passengers, transport) {
    var temp = transport.passengers[0];
    var newPassengers = typeof temp === 'function' ? temp(slotProps) : transport.passengers;
    return passengers.concat(newPassengers);
  }, []);
}
function stableSort(array, compareFn) {
  return array.map(function (v, idx) {
    return [idx, v];
  }).sort(function (a, b) {
    return compareFn(a[1], b[1]) || a[0] - b[0];
  }).map(function (c) {
    return c[1];
  });
}
function pick(obj, keys) {
  return keys.reduce(function (acc, key) {
    if (obj.hasOwnProperty(key)) {
      acc[key] = obj[key];
    }
    return acc;
  }, {});
}
var transports = {};
var targets = {};
var sources = {};
var Wormhole = Vue.extend({
  data: function data() {
    return {
      transports: transports,
      targets: targets,
      sources: sources,
      trackInstances: inBrowser
    };
  },
  methods: {
    open: function open(transport) {
      if (!inBrowser) return;
      var to = transport.to,
        from = transport.from,
        passengers = transport.passengers,
        _transport$order = transport.order,
        order = _transport$order === void 0 ? Infinity : _transport$order;
      if (!to || !from || !passengers) return;
      var newTransport = {
        to: to,
        from: from,
        passengers: freeze(passengers),
        order: order
      };
      var keys = Object.keys(this.transports);
      if (keys.indexOf(to) === -1) {
        Vue.set(this.transports, to, []);
      }
      var currentIndex = this.$_getTransportIndex(newTransport); // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays

      var newTransports = this.transports[to].slice(0);
      if (currentIndex === -1) {
        newTransports.push(newTransport);
      } else {
        newTransports[currentIndex] = newTransport;
      }
      this.transports[to] = stableSort(newTransports, function (a, b) {
        return a.order - b.order;
      });
    },
    close: function close(transport) {
      var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
      var to = transport.to,
        from = transport.from;
      if (!to || !from && force === false) return;
      if (!this.transports[to]) {
        return;
      }
      if (force) {
        this.transports[to] = [];
      } else {
        var index = this.$_getTransportIndex(transport);
        if (index >= 0) {
          // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays
          var newTransports = this.transports[to].slice(0);
          newTransports.splice(index, 1);
          this.transports[to] = newTransports;
        }
      }
    },
    registerTarget: function registerTarget(target, vm, force) {
      if (!inBrowser) return;
      if (this.trackInstances && !force && this.targets[target]) {
        console.warn("[portal-vue]: Target ".concat(target, " already exists"));
      }
      this.$set(this.targets, target, Object.freeze([vm]));
    },
    unregisterTarget: function unregisterTarget(target) {
      this.$delete(this.targets, target);
    },
    registerSource: function registerSource(source, vm, force) {
      if (!inBrowser) return;
      if (this.trackInstances && !force && this.sources[source]) {
        console.warn("[portal-vue]: source ".concat(source, " already exists"));
      }
      this.$set(this.sources, source, Object.freeze([vm]));
    },
    unregisterSource: function unregisterSource(source) {
      this.$delete(this.sources, source);
    },
    hasTarget: function hasTarget(to) {
      return !!(this.targets[to] && this.targets[to][0]);
    },
    hasSource: function hasSource(to) {
      return !!(this.sources[to] && this.sources[to][0]);
    },
    hasContentFor: function hasContentFor(to) {
      return !!this.transports[to] && !!this.transports[to].length;
    },
    // Internal
    $_getTransportIndex: function $_getTransportIndex(_ref) {
      var to = _ref.to,
        from = _ref.from;
      for (var i in this.transports[to]) {
        if (this.transports[to][i].from === from) {
          return +i;
        }
      }
      return -1;
    }
  }
});
var wormhole = new Wormhole(transports);
var _id$3 = 1;
var Portal = Vue.extend({
  name: 'portal',
  props: {
    disabled: {
      type: Boolean
    },
    name: {
      type: String,
      default: function _default() {
        return String(_id$3++);
      }
    },
    order: {
      type: Number,
      default: 0
    },
    slim: {
      type: Boolean
    },
    slotProps: {
      type: Object,
      default: function _default() {
        return {};
      }
    },
    tag: {
      type: String,
      default: 'DIV'
    },
    to: {
      type: String,
      default: function _default() {
        return String(Math.round(Math.random() * 10000000));
      }
    }
  },
  created: function created() {
    var _this = this;
    this.$nextTick(function () {
      wormhole.registerSource(_this.name, _this);
    });
  },
  mounted: function mounted() {
    if (!this.disabled) {
      this.sendUpdate();
    }
  },
  updated: function updated() {
    if (this.disabled) {
      this.clear();
    } else {
      this.sendUpdate();
    }
  },
  beforeDestroy: function beforeDestroy() {
    wormhole.unregisterSource(this.name);
    this.clear();
  },
  watch: {
    to: function to(newValue, oldValue) {
      oldValue && oldValue !== newValue && this.clear(oldValue);
      this.sendUpdate();
    }
  },
  methods: {
    clear: function clear(target) {
      var closer = {
        from: this.name,
        to: target || this.to
      };
      wormhole.close(closer);
    },
    normalizeSlots: function normalizeSlots() {
      return this.$scopedSlots.default ? [this.$scopedSlots.default] : this.$slots.default;
    },
    normalizeOwnChildren: function normalizeOwnChildren(children) {
      return typeof children === 'function' ? children(this.slotProps) : children;
    },
    sendUpdate: function sendUpdate() {
      var slotContent = this.normalizeSlots();
      if (slotContent) {
        var transport = {
          from: this.name,
          to: this.to,
          passengers: _toConsumableArray(slotContent),
          order: this.order
        };
        wormhole.open(transport);
      } else {
        this.clear();
      }
    }
  },
  render: function render(h) {
    var children = this.$slots.default || this.$scopedSlots.default || [];
    var Tag = this.tag;
    if (children && this.disabled) {
      return children.length <= 1 && this.slim ? this.normalizeOwnChildren(children)[0] : h(Tag, [this.normalizeOwnChildren(children)]);
    } else {
      return this.slim ? h() : h(Tag, {
        class: {
          'v-portal': true
        },
        style: {
          display: 'none'
        },
        key: 'v-portal-placeholder'
      });
    }
  }
});
var PortalTarget = Vue.extend({
  name: 'portalTarget',
  props: {
    multiple: {
      type: Boolean,
      default: false
    },
    name: {
      type: String,
      required: true
    },
    slim: {
      type: Boolean,
      default: false
    },
    slotProps: {
      type: Object,
      default: function _default() {
        return {};
      }
    },
    tag: {
      type: String,
      default: 'div'
    },
    transition: {
      type: [String, Object, Function]
    }
  },
  data: function data() {
    return {
      transports: wormhole.transports,
      firstRender: true
    };
  },
  created: function created() {
    var _this = this;
    this.$nextTick(function () {
      wormhole.registerTarget(_this.name, _this);
    });
  },
  watch: {
    ownTransports: function ownTransports() {
      this.$emit('change', this.children().length > 0);
    },
    name: function name(newVal, oldVal) {
      /**
       * TODO
       * This should warn as well ...
       */
      wormhole.unregisterTarget(oldVal);
      wormhole.registerTarget(newVal, this);
    }
  },
  mounted: function mounted() {
    var _this2 = this;
    if (this.transition) {
      this.$nextTick(function () {
        // only when we have a transition, because it causes a re-render
        _this2.firstRender = false;
      });
    }
  },
  beforeDestroy: function beforeDestroy() {
    wormhole.unregisterTarget(this.name);
  },
  computed: {
    ownTransports: function ownTransports() {
      var transports = this.transports[this.name] || [];
      if (this.multiple) {
        return transports;
      }
      return transports.length === 0 ? [] : [transports[transports.length - 1]];
    },
    passengers: function passengers() {
      return combinePassengers(this.ownTransports, this.slotProps);
    }
  },
  methods: {
    // can't be a computed prop because it has to "react" to $slot changes.
    children: function children() {
      return this.passengers.length !== 0 ? this.passengers : this.$scopedSlots.default ? this.$scopedSlots.default(this.slotProps) : this.$slots.default || [];
    },
    // can't be a computed prop because it has to "react" to this.children().
    noWrapper: function noWrapper() {
      var noWrapper = this.slim && !this.transition;
      if (noWrapper && this.children().length > 1) {
        console.warn('[portal-vue]: PortalTarget with `slim` option received more than one child element.');
      }
      return noWrapper;
    }
  },
  render: function render(h) {
    var noWrapper = this.noWrapper();
    var children = this.children();
    var Tag = this.transition || this.tag;
    return noWrapper ? children[0] : this.slim && !Tag ? h() : h(Tag, {
      props: {
        // if we have a transition component, pass the tag if it exists
        tag: this.transition && this.tag ? this.tag : undefined
      },
      class: {
        'vue-portal-target': true
      }
    }, children);
  }
});
var _id$1$1 = 0;
var portalProps = ['disabled', 'name', 'order', 'slim', 'slotProps', 'tag', 'to'];
var targetProps = ['multiple', 'transition'];
Vue.extend({
  name: 'MountingPortal',
  inheritAttrs: false,
  props: {
    append: {
      type: [Boolean, String]
    },
    bail: {
      type: Boolean
    },
    mountTo: {
      type: String,
      required: true
    },
    // Portal
    disabled: {
      type: Boolean
    },
    // name for the portal
    name: {
      type: String,
      default: function _default() {
        return 'mounted_' + String(_id$1$1++);
      }
    },
    order: {
      type: Number,
      default: 0
    },
    slim: {
      type: Boolean
    },
    slotProps: {
      type: Object,
      default: function _default() {
        return {};
      }
    },
    tag: {
      type: String,
      default: 'DIV'
    },
    // name for the target
    to: {
      type: String,
      default: function _default() {
        return String(Math.round(Math.random() * 10000000));
      }
    },
    // Target
    multiple: {
      type: Boolean,
      default: false
    },
    targetSlim: {
      type: Boolean
    },
    targetSlotProps: {
      type: Object,
      default: function _default() {
        return {};
      }
    },
    targetTag: {
      type: String,
      default: 'div'
    },
    transition: {
      type: [String, Object, Function]
    }
  },
  created: function created() {
    if (typeof document === 'undefined') return;
    var el = document.querySelector(this.mountTo);
    if (!el) {
      console.error("[portal-vue]: Mount Point '".concat(this.mountTo, "' not found in document"));
      return;
    }
    var props = this.$props; // Target already exists

    if (wormhole.targets[props.name]) {
      if (props.bail) {
        console.warn("[portal-vue]: Target ".concat(props.name, " is already mounted.\n        Aborting because 'bail: true' is set"));
      } else {
        this.portalTarget = wormhole.targets[props.name];
      }
      return;
    }
    var append = props.append;
    if (append) {
      var type = typeof append === 'string' ? append : 'DIV';
      var mountEl = document.createElement(type);
      el.appendChild(mountEl);
      el = mountEl;
    } // get props for target from $props
    // we have to rename a few of them

    var _props = pick(this.$props, targetProps);
    _props.slim = this.targetSlim;
    _props.tag = this.targetTag;
    _props.slotProps = this.targetSlotProps;
    _props.name = this.to;
    this.portalTarget = new PortalTarget({
      el: el,
      parent: this.$parent || this,
      propsData: _props
    });
  },
  beforeDestroy: function beforeDestroy() {
    var target = this.portalTarget;
    if (this.append) {
      var el = target.$el;
      el.parentNode.removeChild(el);
    }
    target.$destroy();
  },
  render: function render(h) {
    if (!this.portalTarget) {
      console.warn("[portal-vue] Target wasn't mounted");
      return h();
    } // if there's no "manual" scoped slot, so we create a <Portal> ourselves

    if (!this.$scopedSlots.manual) {
      var props = pick(this.$props, portalProps);
      return h(Portal, {
        props: props,
        attrs: this.$attrs,
        on: this.$listeners,
        scopedSlots: this.$scopedSlots
      }, this.$slots.default);
    } // else, we render the scoped slot

    var content = this.$scopedSlots.manual({
      to: this.to
    }); // if user used <template> for the scoped slot
    // content will be an array

    if (Array.isArray(content)) {
      content = content[0];
    }
    if (!content) return h();
    return content;
  }
});

var iconReplace = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA2hJREFUWEe9l19oU2cYxn9vojNxCKMwRXexghPRZMw/DVpvZnGOaXGjbmNXgyJeiG2KvRJB0F7ohbKbtI6JF4JXA3WIjioq2ru4NWGMxgrqRfFCBUXc1DYpzXnlnJNzenIakxyb9tzl+97n+Z68/773E81yFqWTYN8YQlI28qcDW73n2ZKFHy65bP4W5W8DbhVkUfphv/xfjVo0gwY7u2St9EmCow52bXKiM4Sc9XFNCNwoGsbx0VOL/6p0jl/AUA0xW919n4BYrzbJVOEiMG3jJVPtyw1EXcHOllfAkLTQVk2ADrMV4bZl4xPg4D7vGm9FQptVaAV+LOMTLuZSkR+8aw0X4CWPd+W3E+YEyjpn3TCMzd5wzKkA59B4T+ECqt/bntN0biC6Zc5CUCmEaw7o8nCx8Hg6f6bzYV48YB4c7544isiRUv4M5gYi7XbJTpdhQ5LwXUlcXqb6fPKDyJr7v8jzeRMQ681/JlM8cGMvtI+kIoNzLuCLfeOfFBeE94IhbgjsZOzzh8Cq7aqNSDBrOFatD1TCx7vGOwiF/pixJ/Q0rBXX6KDEuwvHET3k2Clcvdsf2WkKuANsqkVQYb9LWvg1CC6WzN8U2GZiDNFPR1PRR6JpmllAcxAiirzA4IFsYSIILtb7X5NMLRoDDuf6IykrB4IQNMI21pP/5m4qcs2tBi+pZvhaWrjeiIPq5XA9oBnr5jpDmGZZz8t6CUy71l6Nvsq/WUU43BQElxuIDlkCdIRlFHhaKq8rkuDbIESx7vx+EU4FwZRss7aADGeAvS6BcFg2cqxewrI+Xy+oZCc6zM8I52bglHZJMFgPn09AFlV3VqyIdy4l6zIaLs11gn1TWS4pdUThtLTwpJaI8ptO28zYVsPEk3lzqrJGNzsEw3yHcMkDWlHPwY797AX8y1ImuYdgZ7Gwyztyz7kHLC9kuYHylRMC78g9PwLMXPDmQYiYbGC01uHm/qxD4OZehofAypIXMpIgMb8CsvyE8runH1xhkoPSyr2qWV02771HFXjJNWO996yB0fOdR0gzxR3ZRNovpmEhcEORpQNl5gRjG2QJsUM28KxiGdqLdT/x3nkda8bKhZPADiDi+9dlw8isWnGtJNN/+Iii9Sb80n1ivWKXtPHa9UCysBuM30A+rsXn2x96C4xUoavxY8kaAAAAAElFTkSuQmCC";

var iconSetup = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA7NJREFUWEftl2tsVEUUx/9nku7ei2AkPEQCGlSg6b3bUiuPoCGCJVGTkihUwgdIUEBt9y4hqIkfUB6+osbEvatGTfmICV1C4AspjwR5JFBeoZ0SEjQhtDXAyhdM9t4t6T1m2t2lu92227ut8YPz6U7m3Pn/zpk5M3MI/0Kbt+X+1DItWAvunUGe6JDfa8cyspSvH4o4Gz0WywSwkMHGSHzM+Lkjpr0zlF2llVrjgT8FMP+hDe2VdvBt1c8BMC13P4D6kURzxpl3yZi+s9A/ZmPydQgRByBem3sMj0+8C5mocC50VetM/GVHVP8oC2CGnZ0g+gTAHYAaUBa4IL+lzlHBDDA2LLeOCHEwAu8tbELDor19o8kHOjYf+g5tdwyAeEMfgBlJLgWLswDapK1V+RXN/BcKu68yURzgCQPFM+NHf1+B7S17VLe5D8AIuz8RYQuReL49GrhUCoC51V0JDwcATCokrua+lijH2v1NIPCv/RGw3IsApklbe6oUcSPsrKA+zzF5KHE1v/JeRQHMuzIADOCktLXlfgFCjc4yFogDNG048R9a38Kl7gUHznfX3FPZMyYAZuTBUnCv8vyJ4cS/OLUN+9rXKM+Xy5h+MpuGpuX6jkBFY3KxEKIZwOzhxD87tR3ybvkJebvimoxpkZyDyC9AKNJTw+wp8TlFrvkmGdObBi6z7yUwrJ4qYi8OwrNFiQPN0tbezN9jvgAqIynTY1ael5ci7nsPmFbqMMB1pYr7Api1rVOf4k1JzHns5iMH160vmLXZPB8i7CXtgYpG52Uh6Hi9cQgfv/TVIIBixNP3zgRpax+Oeg8YYWcHEe3+vHY36ua35AAUI54+eVXaQ9oajR7Aco8Q8ErLhtWYOek27qceRWt3NY7cqO0/XosIezrt/QGEIsm/zenXJ9Y+/Rtau57DxT8XcKo3mLnWC6Za/jqVBmA5+xi0Ljsp4zIIZ0B0VkaD6kEzYisNIJyqZ3gGSLSVIXD6ik2JERXzDEoCGK1YIfv/Af6LEXA6QfSXjGrVY7HGw82hipRAMJAAuEva+uzMQaTSZ6W0tcnjDWCEky8QiTOZA6sf4GFN8KO0tYbxhDAt9zSAF9WDVBU02cIkZLndDMwE0RsyGjw4HhBm2P0ahPeJ6Hx7NLgkex2rj/Tb7lxa+DhAt8Ce78pooAMsMJeYVG1YA+ZOGdOfzHkTZjqV7/J0Luv5hcGrxiMCYHwjY9oHg94Dgy6LralKsFcFD8+MCYgQV8Gsyr4/8uf7B8Tx9p9D/L0VAAAAAElFTkSuQmCC";

var iconRemove = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAgCAYAAAB6kdqOAAAAAXNSR0IArs4c6QAAAtdJREFUWEftmM1LFHEYxz/Pau1YSpfq0AtIdIhaJdC9GFhePHgUBEtouwSGStHLWf0DpHLWgqiQjKhDRYfyEqmHCHPUYmeVwugShHkpFXxJfWq3dl213FlnJA8NDMww3+f5feY7v3me+Y3gYAvUTzUh0uhA6kwivBHlVsQ0wssDxEmGQMO0OtFlqlGR49FW//3UOGdAXjuUJJBXtukvyRgo0ztPp0913DaNJaY4cijdAJleTwt04NxUfta8r1HQ/EyTp9Wr9tjhnKZU3apABQ0zNYreTZvYpUCRQ1HTPxRLsypQoGH6IVDpcrz04arNCafSAa3LK/0Hwm7bNMqcOPQfaAM8Mh0FGf6nj0zRdhFeCFlDs5Pf3r+7vWMiMa8KG3SP6kyVilStqNTr0adUtSYazrmnXeSylUJ8FKKUIPiAXuaJMoctR/iyorl6CiQMb9LvRwfNvDG1OAtcAPauUhNapJiLS3qZh0DjtmlsiyXXfnpQStMXp7jiI0K5FDESOxGvgESpiISNTrX4AOxzCLMomyBPypj0BEiFy9FW47xa1ALXM4aJ28oDCVLtAZCO2WbOTn1NCT5erglmMeiMB0DEW4Ja3ABOuwSy3QMJ1+xWo077GEQ47BLI/aRWpc6uNjowGE+B6UZpdgTnI4RyKqF175BqWSSUA0JXEkApkyDdjoBi89ki2eBdAylywg75nwFfN4ZDcNE2jRbt5y1KoVNX/qZz7RDKYztsVKpF+8+qG3IJNOIe6BfB/shJ4xjCTVdASps3QL+/l9XiKVCxRqjPUswuCdRPfUJk9xqTJMJmFxYWSofatvSmvjEZ5VQqJEhnDMiTHwkKT4wZu8qqLT7IAs+B7Y6BlJAEuRPv9imLxGRxcpxopXAA31yFfTV3VPtoQlj9j4nQwWYuSQGjycKYOIiBZc/hzco12zdqX/EPq0U5ShAhCPE9tnQfRBnEx4AU8Wj5Pf0AgUJM93Ow4uMAAAAASUVORK5CYII=";

//
var script$5o = {
  name: 'XmlAreaBox',
  components: {
    PortalTarget
  },
  props: {
    data: {
      type: Object,
      default: () => {}
    },
    boxIndex: Number,
    // mainIndex: Number,
    injected: {
      type: Boolean,
      default: false
    },
    sign: {
      type: String,
      default: ''
    },
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    //属性中传递过来的块儿数据
    pBlockData: {
      type: Object,
      default: () => {}
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: () => {}
    },
    ruleIndex: Number
  },
  data() {
    return {
      presetBgColors,
      images: {
        iconReplace,
        iconSetup,
        iconRemove
      },
      clickInside: false,
      refreshKey: 'apk' + new Date().getTime()
    };
  },
  directives: {
    clickInside: {
      bind(el, binding, vnode) {
        function clickHandler(e) {
          let isInside = false;
          if (el.contains(e.target)) {
            isInside = true;
          }
          if (binding.expression) {
            binding.value(isInside);
          }
        }
        el.__vueClickOutside__ = clickHandler;
        document.addEventListener('click', clickHandler);
      },
      update() {},
      unbind(el, binding) {
        document.removeEventListener('click', el.__vueClickOutside__);
        delete el.__vueClickOutside__;
      }
    }
  },
  computed: {
    activeInjectId() {
      return this.getActiveInjectId;
    },
    activeInjectedBoxId() {
      return this.getActiveInjectedBoxId;
    },
    isInActive() {
      return this.activeInjectId && this.activeInjectId === this.data.uuid || this.activeInjectedBoxId && this.activeInjectedBoxId === this.data.uuid;
    }
  },
  provide() {
    return {
      getAreaBoxProvider: () => ({
        injected: this.injected,
        data: this.data,
        boxIndex: this.boxIndex,
        mainIndex: this.mainIndex
      })
    };
  },
  inject: {
    getActiveInjectId: {
      from: 'getActiveInjectId',
      default: () => ''
    },
    getActiveInjectedBoxId: {
      from: 'getActiveInjectedBoxId',
      default: () => ''
    }
  },
  methods: {
    setClickInside(isInside) {
      this.clickInside = isInside;
    },
    setupInjectComponent() {
      this.$emit('injectSetup', {
        ...this.data,
        type: 'injected',
        ruleIndex: this.ruleIndex,
        mainIndex: this.mainIndex
      });
    },
    replaceInjectComponent() {
      let rect = this.$el.getBoundingClientRect();
      this.$EventBus.$emit('injectComponentReplace', {
        ...this.data,
        type: 'injected',
        rect,
        ruleIndex: this.ruleIndex,
        boxIndex: this.boxIndex,
        sign: this.sign
      });
    },
    removeInjectComponent() {
      this.$EventBus.$emit('injectComponentRemove', {
        ...this.data,
        type: 'injected',
        ruleIndex: this.ruleIndex,
        boxIndex: this.boxIndex
      });
    },
    genAreaBoxStyle() {
      let {
        rowStart,
        rowEnd,
        columnStart,
        columnEnd
      } = this.data;
      let baseStyle = {
        gridRow: `${rowStart} / ${rowEnd}`,
        gridColumn: `${columnStart} / ${columnEnd}`
      };
      if (!this.injected) {
        let target = this.boxIndex % this.presetBgColors.length;
        baseStyle['--areabox-color'] = this.presetBgColors[target];
        baseStyle.backgroundColor = `${this.presetBgColors[target]}99`; // 66透明度
      }
      return baseStyle;
    },
    spareAreaBoxClick(event) {
      if (this.injected) {
        // this.$EventBus.$emit('injectedGroupProxy', { ...this.data, type: 'injected', ruleIndex: this.ruleIndex, mainIndex: this.mainIndex })
        // this.$emit('areaBoxClick', { ...this.data, type: 'injected' })
        this.$EventBus.$emit('areaBoxClick', {
          ...this.data,
          type: 'injected'
        }, {
          ruleIndex: this.ruleIndex,
          sign: this.sign
        });
      } else {
        let rect = event.target.getBoundingClientRect();
        this.$EventBus.$emit('areaBoxClick', {
          ...this.data,
          type: 'spare',
          rect
        }, {
          ruleIndex: this.ruleIndex,
          sign: this.sign
        });
      }
    }
  },
  created() {}
};

/* script */
const __vue_script__$5o = script$5o;

/* template */
var __vue_render__$5o = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "section",
    {
      directives: [
        {
          name: "click-inside",
          rawName: "v-click-inside",
          value: _vm.setClickInside,
          expression: "setClickInside",
        },
      ],
      class: [
        "xml-grid-layout__area-box",
        "xml-grid-layout__area-box" + (_vm.injected ? "--injected" : "--spare"),
        _vm.mode === "editor" && "is-in-editor",
        _vm.isInActive && "inject-active",
      ],
      style: _vm.genAreaBoxStyle(),
      on: { click: _vm.spareAreaBoxClick },
    },
    [
      _vm.injected
        ? [
            _c("div", { staticClass: "xml-grid-layout__control" }, [
              _c("div", { staticClass: "xml-grid-layout__control-wrap" }, [
                _c(
                  "div",
                  {
                    staticClass: "xml-grid-layout__button",
                    on: {
                      click: function ($event) {
                        $event.stopPropagation();
                        return _vm.replaceInjectComponent.apply(null, arguments)
                      },
                    },
                  },
                  [
                    _c(
                      "el-tooltip",
                      {
                        staticClass: "item",
                        attrs: {
                          effect: "dark",
                          content: "替换组件",
                          placement: "top",
                        },
                      },
                      [
                        _c("el-image", {
                          attrs: { src: _vm.images.iconReplace },
                        }),
                      ],
                      1
                    ),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    staticClass: "xml-grid-layout__button",
                    on: {
                      click: function ($event) {
                        $event.stopPropagation();
                        return _vm.removeInjectComponent.apply(null, arguments)
                      },
                    },
                  },
                  [
                    _c(
                      "el-tooltip",
                      {
                        staticClass: "item",
                        attrs: {
                          effect: "dark",
                          content: "移除组件",
                          placement: "top",
                        },
                      },
                      [
                        _c("el-image", {
                          attrs: { src: _vm.images.iconRemove },
                        }),
                      ],
                      1
                    ),
                  ],
                  1
                ),
              ]),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "xml-grid-layout__inject-wrap" },
              [_c("PortalTarget", { attrs: { name: _vm.data.uuid } })],
              1
            ),
          ]
        : _vm._e(),
    ],
    2
  )
};
var __vue_staticRenderFns__$5o = [];
__vue_render__$5o._withStripped = true;

  /* style */
  const __vue_inject_styles__$5o = undefined;
  /* scoped */
  const __vue_scope_id__$5o = undefined;
  /* module identifier */
  const __vue_module_identifier__$5o = undefined;
  /* functional template */
  const __vue_is_functional_template__$5o = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5o = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5o, staticRenderFns: __vue_staticRenderFns__$5o },
    __vue_inject_styles__$5o,
    __vue_script__$5o,
    __vue_scope_id__$5o,
    __vue_is_functional_template__$5o,
    __vue_module_identifier__$5o,
    false,
    undefined,
    undefined,
    undefined
  );

const components$1 = [__vue_component__$5p, __vue_component__$5o];
var XmlLayout = {
  ...components$1
};

var singleGroupMixin = {
  props: {
    activeIndex: {
      type: Number,
      default: -1
    },
    location: {
      type: String,
      default: ''
    },
    islast: {
      type: Boolean,
      default: false
    },
    isBatchEditing: {
      type: Boolean,
      default: false
    },
    batchRuleIndexs: {
      type: Array,
      default: () => []
    }
  },
  provide() {
    return {
      getSingleGroupLocation: () => this.location
    };
  },
  computed: {
    groupIsActive() {
      if (this.isBatchEditing) {
        return this.batchRuleIndexs.includes(this.ruleIndex);
      }
      return this.ruleIndex === this.activeIndex;
    }
  },
  watch: {
    pGroupData: {
      handler() {
        if (this.pGroupData.options?.marginTop !== undefined && this.pGroupData.options.marginTop !== -1) {
          this.$nextTick(() => {
            this.$el && this.$el.style.setProperty('--book-marginTop', this.pGroupData.options.marginTop + 'px');
          });
        }
      },
      deep: true,
      immediate: true
    }
  },
  created() {
    if (this.pGroupData.options?.marginTop === undefined) {
      let options = this.pGroupData.options ? {
        ...this.pGroupData.options,
        marginTop: -1
      } : {
        marginTop: -1
      };
      this.$emit('updateModel', {
        key: 'pGroupData',
        value: {
          ...this.pGroupData,
          options
        }
      });
    }
  },
  mounted() {
    console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=', this.islast);
    if (this.islast) {
      this.$nextTick(() => {
        this.$EventBus.$emit('mounted_success');
      });
    }
  },
  methods: {
    emitClick(e) {
      this.$emit('click', e, this.ruleIndex, this.currentRule);
    }
  }
};

//
var script$5n = {
  mixins: [singleGroupMixin],
  name: 'titleFifthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5n = script$5n;
/* template */
var __vue_render__$5n = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-fifth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-bottom" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5n = [];
__vue_render__$5n._withStripped = true;

  /* style */
  const __vue_inject_styles__$5n = undefined;
  /* scoped */
  const __vue_scope_id__$5n = "data-v-497e98e7";
  /* module identifier */
  const __vue_module_identifier__$5n = undefined;
  /* functional template */
  const __vue_is_functional_template__$5n = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5n = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5n, staticRenderFns: __vue_staticRenderFns__$5n },
    __vue_inject_styles__$5n,
    __vue_script__$5n,
    __vue_scope_id__$5n,
    __vue_is_functional_template__$5n,
    __vue_module_identifier__$5n,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5m = {
  mixins: [singleGroupMixin],
  name: 'titleFirstRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5m = script$5m;
/* template */
var __vue_render__$5m = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-first-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5m = [];
__vue_render__$5m._withStripped = true;

  /* style */
  const __vue_inject_styles__$5m = undefined;
  /* scoped */
  const __vue_scope_id__$5m = "data-v-07b2de11";
  /* module identifier */
  const __vue_module_identifier__$5m = undefined;
  /* functional template */
  const __vue_is_functional_template__$5m = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5m = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5m, staticRenderFns: __vue_staticRenderFns__$5m },
    __vue_inject_styles__$5m,
    __vue_script__$5m,
    __vue_scope_id__$5m,
    __vue_is_functional_template__$5m,
    __vue_module_identifier__$5m,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5l = {
  mixins: [singleGroupMixin],
  name: 'titleHexagonRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5l = script$5l;
/* template */
var __vue_render__$5l = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-hexagon-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5l = [];
__vue_render__$5l._withStripped = true;

  /* style */
  const __vue_inject_styles__$5l = undefined;
  /* scoped */
  const __vue_scope_id__$5l = "data-v-341a9450";
  /* module identifier */
  const __vue_module_identifier__$5l = undefined;
  /* functional template */
  const __vue_is_functional_template__$5l = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5l = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5l, staticRenderFns: __vue_staticRenderFns__$5l },
    __vue_inject_styles__$5l,
    __vue_script__$5l,
    __vue_scope_id__$5l,
    __vue_is_functional_template__$5l,
    __vue_module_identifier__$5l,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5k = {
  mixins: [singleGroupMixin],
  name: 'titleRectangleRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

var __$_require_assets_images_title_rectangle_left_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAlCAYAAADBa/A+AAACaklEQVRYhcWXu24TQRSGvzVxuAjEJQVSiFAuDRUIJIoYIZQGiSIhT0BHi8SL8AoUPAGXhgIaRAqEAwkgEJGJYickGBwwSSD2rnfRbDzG8p69RPLs/oWnODPWp3POnn/GmrpXI07P757yHBduP6hz8WyeO1NHAidWf7W4db8e+1/7US7p3ndrNiubLTbqLTFeXHH6CsZ+4F6WbH8tTAyK8WLZ7iPWnhLDzZWaWBZMjuUDMdeDN5WM4ErfW2z8djl3eoCho8EjH9cddhpeNnBzX5r+WpgIZk3ptYGSkhQurt/mM4QbWfrmMHwix9jQgUDwT9Pzy5oV3LTqpishWXtbsVEz0ISSwM2qn8nxkH4zMN+04uCOA9eOHbI4f0aGMzHftOLgrgMHC+OD5KxgsLrlUvkpO0YacDElNZc1YuAU0Q2gcXlUhjM1QrSi4K4CJ4Fnh/PBmnqe2X4jBu5me30oBZeqDvW//besbkXBzagEAU+kYLFsboRohcFdAEaBV8BXGc5sSYmAm2mvj6Rgw/H8y6dphcHpfhPhFlYdbHPjrSMJbgS4pK5xwHvpkOkREgU3DVhhXykpDF8tCW62vT6WDmzuuCz/SKGmApxv9IoBeCEdUCPE7HT7r1443+jbs01MT1olRYDTJRW/UqV5A6+sMHXDdYweeCrtX661qG0buvYK6obrGD2wLW0uplhSeuAijZ6U+40euEijV46wuGbe7Lul4WKN/sO6za6d1hDZk4aLNHoMv7LCpOEijZ4MPgbacLFGv7Xr8bmaTea00YdnrWz7b4a0lUviCmnceiUNAJ+A4TCj9+Ey6DeAfxBN203Xb87aAAAAAElFTkSuQmCC";

var __$_require_assets_images_title_rectangle_right_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAlCAYAAAC+uuLPAAAA/0lEQVRYhb3W3QqCQBAF4Bl3s0iKKEIklW6iKEh0n6AX7E17hmK2IPP3pjl7E159jMc9Dd/ujycBT7wIKECCclxu8WiZGSzKLCh40sPW0HLGWLTKrf+Foi4zWHRqmc4JeNLrztDkPSgOdZ88oahcFSi6jpj2my8FQavMEteeIWg9TwgqE5YpGJUsJVMoWjVeLQbNwKg0kDQRFL0k1ncuFK3y9pT6aEeeqqhsCLIpQFEpeG7HqYs2qw+CyqoJRdNV4Dd5KNpVferoUJ4qqAmIio7qU0VPsaF52HNXtNCxPFVQ11N9amgUMh3j4Tz/jhap8R8SFB27Kipo31/ZzyGiFwxgDupQsmgnAAAAAElFTkSuQmCC";

/* script */
const __vue_script__$5k = script$5k;
var __vue_render__$5k = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-rectangle-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_assets_images_title_rectangle_left_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_assets_images_title_rectangle_right_png__,
                    alt: "",
                  },
                }),
              ]),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5k = [];
__vue_render__$5k._withStripped = true;

  /* style */
  const __vue_inject_styles__$5k = undefined;
  /* scoped */
  const __vue_scope_id__$5k = "data-v-15849fd5";
  /* module identifier */
  const __vue_module_identifier__$5k = undefined;
  /* functional template */
  const __vue_is_functional_template__$5k = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5k = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5k, staticRenderFns: __vue_staticRenderFns__$5k },
    __vue_inject_styles__$5k,
    __vue_script__$5k,
    __vue_scope_id__$5k,
    __vue_is_functional_template__$5k,
    __vue_module_identifier__$5k,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5j = {
  mixins: [singleGroupMixin],
  name: 'titleRotundityRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5j = script$5j;
/* template */
var __vue_render__$5j = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-rotundity-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5j = [];
__vue_render__$5j._withStripped = true;

  /* style */
  const __vue_inject_styles__$5j = undefined;
  /* scoped */
  const __vue_scope_id__$5j = "data-v-16f693b6";
  /* module identifier */
  const __vue_module_identifier__$5j = undefined;
  /* functional template */
  const __vue_is_functional_template__$5j = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5j = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5j, staticRenderFns: __vue_staticRenderFns__$5j },
    __vue_inject_styles__$5j,
    __vue_script__$5j,
    __vue_scope_id__$5j,
    __vue_is_functional_template__$5j,
    __vue_module_identifier__$5j,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5i = {
  mixins: [singleGroupMixin],
  name: 'titleSecondRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5i = script$5i;
/* template */
var __vue_render__$5i = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-second-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5i = [];
__vue_render__$5i._withStripped = true;

  /* style */
  const __vue_inject_styles__$5i = undefined;
  /* scoped */
  const __vue_scope_id__$5i = "data-v-8a21da46";
  /* module identifier */
  const __vue_module_identifier__$5i = undefined;
  /* functional template */
  const __vue_is_functional_template__$5i = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5i = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5i, staticRenderFns: __vue_staticRenderFns__$5i },
    __vue_inject_styles__$5i,
    __vue_script__$5i,
    __vue_scope_id__$5i,
    __vue_is_functional_template__$5i,
    __vue_module_identifier__$5i,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5h = {
  mixins: [singleGroupMixin],
  name: 'titleSemicircleRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5h = script$5h;
/* template */
var __vue_render__$5h = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-semicircle-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5h = [];
__vue_render__$5h._withStripped = true;

  /* style */
  const __vue_inject_styles__$5h = undefined;
  /* scoped */
  const __vue_scope_id__$5h = "data-v-4a27fae8";
  /* module identifier */
  const __vue_module_identifier__$5h = undefined;
  /* functional template */
  const __vue_is_functional_template__$5h = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5h = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5h, staticRenderFns: __vue_staticRenderFns__$5h },
    __vue_inject_styles__$5h,
    __vue_script__$5h,
    __vue_scope_id__$5h,
    __vue_is_functional_template__$5h,
    __vue_module_identifier__$5h,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5g = {
  mixins: [singleGroupMixin],
  name: 'titleSixthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5g = script$5g;
/* template */
var __vue_render__$5g = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-sixth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-left-div" }, [
              _c(
                "div",
                { staticClass: "title-number" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.numberTextDataName],
                      "block-data-name": _vm.numberTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container-left",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "title-left-line" }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-right-div" },
              [
                _c("div", { staticClass: "title-right-line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "title-right-line2" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container-right",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
                _vm._v(" "),
                _c("div", { staticClass: "title-right-line3" }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5g = [];
__vue_render__$5g._withStripped = true;

  /* style */
  const __vue_inject_styles__$5g = undefined;
  /* scoped */
  const __vue_scope_id__$5g = "data-v-54287811";
  /* module identifier */
  const __vue_module_identifier__$5g = undefined;
  /* functional template */
  const __vue_is_functional_template__$5g = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5g = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5g, staticRenderFns: __vue_staticRenderFns__$5g },
    __vue_inject_styles__$5g,
    __vue_script__$5g,
    __vue_scope_id__$5g,
    __vue_is_functional_template__$5g,
    __vue_module_identifier__$5g,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5f = {
  mixins: [singleGroupMixin],
  name: 'titleSquareRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5f = script$5f;
/* template */
var __vue_render__$5f = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-square-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5f = [];
__vue_render__$5f._withStripped = true;

  /* style */
  const __vue_inject_styles__$5f = undefined;
  /* scoped */
  const __vue_scope_id__$5f = "data-v-8a1f7a32";
  /* module identifier */
  const __vue_module_identifier__$5f = undefined;
  /* functional template */
  const __vue_is_functional_template__$5f = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5f = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5f, staticRenderFns: __vue_staticRenderFns__$5f },
    __vue_inject_styles__$5f,
    __vue_script__$5f,
    __vue_scope_id__$5f,
    __vue_is_functional_template__$5f,
    __vue_module_identifier__$5f,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5e = {
  mixins: [singleGroupMixin],
  name: 'titleThirdRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    /**
     * 更新块数据
     * @param dataName  数据name
     * @param blockData 数据值
     */
    updateBlockData(dataName, blockData) {
      this.groupData[dataName] = blockData;
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5e = script$5e;
/* template */
var __vue_render__$5e = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-third-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-left" }, [
              _c(
                "span",
                { staticClass: "title-number" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.numberTextDataName],
                      "block-data-name": _vm.numberTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      "rule-index": _vm.ruleIndex,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5e = [];
__vue_render__$5e._withStripped = true;

  /* style */
  const __vue_inject_styles__$5e = undefined;
  /* scoped */
  const __vue_scope_id__$5e = "data-v-a2b1f85e";
  /* module identifier */
  const __vue_module_identifier__$5e = undefined;
  /* functional template */
  const __vue_is_functional_template__$5e = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5e = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5e, staticRenderFns: __vue_staticRenderFns__$5e },
    __vue_inject_styles__$5e,
    __vue_script__$5e,
    __vue_scope_id__$5e,
    __vue_is_functional_template__$5e,
    __vue_module_identifier__$5e,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5d = {
  mixins: [singleGroupMixin],
  name: 'titleTriangleRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5d = script$5d;
/* template */
var __vue_render__$5d = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-triangle-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5d = [];
__vue_render__$5d._withStripped = true;

  /* style */
  const __vue_inject_styles__$5d = undefined;
  /* scoped */
  const __vue_scope_id__$5d = "data-v-202dbeb2";
  /* module identifier */
  const __vue_module_identifier__$5d = undefined;
  /* functional template */
  const __vue_is_functional_template__$5d = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5d = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5d, staticRenderFns: __vue_staticRenderFns__$5d },
    __vue_inject_styles__$5d,
    __vue_script__$5d,
    __vue_scope_id__$5d,
    __vue_is_functional_template__$5d,
    __vue_module_identifier__$5d,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5c = {
  mixins: [singleGroupMixin],
  name: 'titleTwelfthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    /**
     * 更新块数据
     * @param dataName  数据name
     * @param blockData 数据值
     */
    updateBlockData(dataName, blockData) {
      this.groupData[dataName] = blockData;
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$5c = script$5c;
/* template */
var __vue_render__$5c = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-twelfth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-left" }, [
              _c(
                "span",
                { staticClass: "title-number" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.numberTextDataName],
                      "block-data-name": _vm.numberTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      "rule-index": _vm.ruleIndex,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5c = [];
__vue_render__$5c._withStripped = true;

  /* style */
  const __vue_inject_styles__$5c = undefined;
  /* scoped */
  const __vue_scope_id__$5c = "data-v-46870548";
  /* module identifier */
  const __vue_module_identifier__$5c = undefined;
  /* functional template */
  const __vue_is_functional_template__$5c = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5c = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5c, staticRenderFns: __vue_staticRenderFns__$5c },
    __vue_inject_styles__$5c,
    __vue_script__$5c,
    __vue_scope_id__$5c,
    __vue_is_functional_template__$5c,
    __vue_module_identifier__$5c,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5b = {
  mixins: [singleGroupMixin],
  name: 'titlethirteenthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$5b = script$5b;
/* template */
var __vue_render__$5b = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirteenth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "topleft" }),
              _vm._v(" "),
              _c("div", { staticClass: "topborder" }, [
                _c("div", { staticClass: "topborder-left" }, [
                  _c("div", { staticClass: "Line1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "Line2" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "block" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "block" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "block" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "topborder-right" }, [
                  _c("div", { staticClass: "Line3" }),
                ]),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "bottomborder" }, [
                _c("div", { staticClass: "Line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "block" }),
                _vm._v(" "),
                _c("div", { staticClass: "block" }),
                _vm._v(" "),
                _c("div", { staticClass: "Line2" }),
                _vm._v(" "),
                _c("div", { staticClass: "Line3" }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "rightbottom" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5b = [];
__vue_render__$5b._withStripped = true;

  /* style */
  const __vue_inject_styles__$5b = undefined;
  /* scoped */
  const __vue_scope_id__$5b = "data-v-617feb3c";
  /* module identifier */
  const __vue_module_identifier__$5b = undefined;
  /* functional template */
  const __vue_is_functional_template__$5b = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5b = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5b, staticRenderFns: __vue_staticRenderFns__$5b },
    __vue_inject_styles__$5b,
    __vue_script__$5b,
    __vue_scope_id__$5b,
    __vue_is_functional_template__$5b,
    __vue_module_identifier__$5b,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$5a = {
  mixins: [singleGroupMixin],
  name: 'titlefourteenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$5a = script$5a;
/* template */
var __vue_render__$5a = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-fourteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "cont-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$5a = [];
__vue_render__$5a._withStripped = true;

  /* style */
  const __vue_inject_styles__$5a = undefined;
  /* scoped */
  const __vue_scope_id__$5a = "data-v-83ec7e8a";
  /* module identifier */
  const __vue_module_identifier__$5a = undefined;
  /* functional template */
  const __vue_is_functional_template__$5a = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5a = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5a, staticRenderFns: __vue_staticRenderFns__$5a },
    __vue_inject_styles__$5a,
    __vue_script__$5a,
    __vue_scope_id__$5a,
    __vue_is_functional_template__$5a,
    __vue_module_identifier__$5a,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$59 = {
  mixins: [singleGroupMixin],
  name: 'titleFifteenRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  isUnPrefix: true,
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$59 = script$59;
/* template */
var __vue_render__$59 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-fifteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$59 = [];
__vue_render__$59._withStripped = true;

  /* style */
  const __vue_inject_styles__$59 = undefined;
  /* scoped */
  const __vue_scope_id__$59 = "data-v-5243766a";
  /* module identifier */
  const __vue_module_identifier__$59 = undefined;
  /* functional template */
  const __vue_is_functional_template__$59 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$59 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$59, staticRenderFns: __vue_staticRenderFns__$59 },
    __vue_inject_styles__$59,
    __vue_script__$59,
    __vue_scope_id__$59,
    __vue_is_functional_template__$59,
    __vue_module_identifier__$59,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$58 = {
  mixins: [singleGroupMixin],
  name: 'titleSixteenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$58 = script$58;
/* template */
var __vue_render__$58 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-sixteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "left-image" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "right-icon" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$58 = [];
__vue_render__$58._withStripped = true;

  /* style */
  const __vue_inject_styles__$58 = undefined;
  /* scoped */
  const __vue_scope_id__$58 = "data-v-6d4920a5";
  /* module identifier */
  const __vue_module_identifier__$58 = undefined;
  /* functional template */
  const __vue_is_functional_template__$58 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$58 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$58, staticRenderFns: __vue_staticRenderFns__$58 },
    __vue_inject_styles__$58,
    __vue_script__$58,
    __vue_scope_id__$58,
    __vue_is_functional_template__$58,
    __vue_module_identifier__$58,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$57 = {
  mixins: [singleGroupMixin],
  name: 'titleSeventeenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$57 = script$57;
/* template */
var __vue_render__$57 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-seventeen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("div", { staticClass: "zhuanshi" }, [
                  _c("div", { staticClass: "line1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "line2" }),
                ]),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$57 = [];
__vue_render__$57._withStripped = true;

  /* style */
  const __vue_inject_styles__$57 = undefined;
  /* scoped */
  const __vue_scope_id__$57 = "data-v-5a09ba0a";
  /* module identifier */
  const __vue_module_identifier__$57 = undefined;
  /* functional template */
  const __vue_is_functional_template__$57 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$57 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$57, staticRenderFns: __vue_staticRenderFns__$57 },
    __vue_inject_styles__$57,
    __vue_script__$57,
    __vue_scope_id__$57,
    __vue_is_functional_template__$57,
    __vue_module_identifier__$57,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$56 = {
  mixins: [singleGroupMixin],
  name: 'titleeighteenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$56 = script$56;
/* template */
var __vue_render__$56 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-eighteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c(
              "div",
              { staticClass: "title-container" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "linebox" }, [
              _c("div", { staticClass: "line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "line2" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$56 = [];
__vue_render__$56._withStripped = true;

  /* style */
  const __vue_inject_styles__$56 = undefined;
  /* scoped */
  const __vue_scope_id__$56 = "data-v-5014efd5";
  /* module identifier */
  const __vue_module_identifier__$56 = undefined;
  /* functional template */
  const __vue_is_functional_template__$56 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$56 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$56, staticRenderFns: __vue_staticRenderFns__$56 },
    __vue_inject_styles__$56,
    __vue_script__$56,
    __vue_scope_id__$56,
    __vue_is_functional_template__$56,
    __vue_module_identifier__$56,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$55 = {
  mixins: [singleGroupMixin],
  name: 'titleEighteenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$55 = script$55;
/* template */
var __vue_render__$55 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-eighteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c(
              "div",
              { staticClass: "title-container" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "linebox" }, [
              _c("div", { staticClass: "line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "line2" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$55 = [];
__vue_render__$55._withStripped = true;

  /* style */
  const __vue_inject_styles__$55 = undefined;
  /* scoped */
  const __vue_scope_id__$55 = "data-v-4bd0430e";
  /* module identifier */
  const __vue_module_identifier__$55 = undefined;
  /* functional template */
  const __vue_is_functional_template__$55 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$55 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$55, staticRenderFns: __vue_staticRenderFns__$55 },
    __vue_inject_styles__$55,
    __vue_script__$55,
    __vue_scope_id__$55,
    __vue_is_functional_template__$55,
    __vue_module_identifier__$55,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$54 = {
  mixins: [singleGroupMixin],
  name: 'titleNineteenRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$54 = script$54;
/* template */
var __vue_render__$54 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-nineteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c(
              "div",
              { staticClass: "title-container" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$54 = [];
__vue_render__$54._withStripped = true;

  /* style */
  const __vue_inject_styles__$54 = undefined;
  /* scoped */
  const __vue_scope_id__$54 = "data-v-054b0426";
  /* module identifier */
  const __vue_module_identifier__$54 = undefined;
  /* functional template */
  const __vue_is_functional_template__$54 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$54 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$54, staticRenderFns: __vue_staticRenderFns__$54 },
    __vue_inject_styles__$54,
    __vue_script__$54,
    __vue_scope_id__$54,
    __vue_is_functional_template__$54,
    __vue_module_identifier__$54,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$53 = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme1Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$53 = script$53;
/* template */
var __vue_render__$53 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "zhuangshi" }, [
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$53 = [];
__vue_render__$53._withStripped = true;

  /* style */
  const __vue_inject_styles__$53 = undefined;
  /* scoped */
  const __vue_scope_id__$53 = "data-v-4a6f701e";
  /* module identifier */
  const __vue_module_identifier__$53 = undefined;
  /* functional template */
  const __vue_is_functional_template__$53 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$53 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$53, staticRenderFns: __vue_staticRenderFns__$53 },
    __vue_inject_styles__$53,
    __vue_script__$53,
    __vue_scope_id__$53,
    __vue_is_functional_template__$53,
    __vue_module_identifier__$53,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$52 = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$52 = script$52;
/* template */
var __vue_render__$52 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "top-zhuangshi" }, [
                _c("div", [
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                  _vm._v(" "),
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                ]),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "bottomzhuangshi" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$52 = [];
__vue_render__$52._withStripped = true;

  /* style */
  const __vue_inject_styles__$52 = undefined;
  /* scoped */
  const __vue_scope_id__$52 = "data-v-2b203fb7";
  /* module identifier */
  const __vue_module_identifier__$52 = undefined;
  /* functional template */
  const __vue_is_functional_template__$52 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$52 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$52, staticRenderFns: __vue_staticRenderFns__$52 },
    __vue_inject_styles__$52,
    __vue_script__$52,
    __vue_scope_id__$52,
    __vue_is_functional_template__$52,
    __vue_module_identifier__$52,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$51 = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$51 = script$51;
/* template */
var __vue_render__$51 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
                _vm._v(" "),
                _c("div", { staticClass: "right-top-bg" }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$51 = [];
__vue_render__$51._withStripped = true;

  /* style */
  const __vue_inject_styles__$51 = undefined;
  /* scoped */
  const __vue_scope_id__$51 = "data-v-9cf76e64";
  /* module identifier */
  const __vue_module_identifier__$51 = undefined;
  /* functional template */
  const __vue_is_functional_template__$51 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$51 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$51, staticRenderFns: __vue_staticRenderFns__$51 },
    __vue_inject_styles__$51,
    __vue_script__$51,
    __vue_scope_id__$51,
    __vue_is_functional_template__$51,
    __vue_module_identifier__$51,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$50 = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme4Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$50 = script$50;
/* template */
var __vue_render__$50 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "cont-box" }, [
            _c("div", { staticClass: "title-container" }, [
              _c("div", { staticClass: "right-top-bg" }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$50 = [];
__vue_render__$50._withStripped = true;

  /* style */
  const __vue_inject_styles__$50 = undefined;
  /* scoped */
  const __vue_scope_id__$50 = "data-v-0016b5ce";
  /* module identifier */
  const __vue_module_identifier__$50 = undefined;
  /* functional template */
  const __vue_is_functional_template__$50 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$50 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$50, staticRenderFns: __vue_staticRenderFns__$50 },
    __vue_inject_styles__$50,
    __vue_script__$50,
    __vue_scope_id__$50,
    __vue_is_functional_template__$50,
    __vue_module_identifier__$50,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4$ = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme5Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4$ = script$4$;
/* template */
var __vue_render__$4$ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme5-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4$ = [];
__vue_render__$4$._withStripped = true;

  /* style */
  const __vue_inject_styles__$4$ = undefined;
  /* scoped */
  const __vue_scope_id__$4$ = "data-v-4c8d7686";
  /* module identifier */
  const __vue_module_identifier__$4$ = undefined;
  /* functional template */
  const __vue_is_functional_template__$4$ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4$ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4$, staticRenderFns: __vue_staticRenderFns__$4$ },
    __vue_inject_styles__$4$,
    __vue_script__$4$,
    __vue_scope_id__$4$,
    __vue_is_functional_template__$4$,
    __vue_module_identifier__$4$,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4_ = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme6Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4_ = script$4_;
/* template */
var __vue_render__$4_ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme6-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }, [
                _c("div", { staticClass: "line" }),
                _vm._v(" "),
                _c("div", { staticClass: "block1" }),
                _vm._v(" "),
                _c("div", { staticClass: "block1" }),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }, [
                _c("div", { staticClass: "block1" }),
                _vm._v(" "),
                _c("div", { staticClass: "block1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line" }),
              ]),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4_ = [];
__vue_render__$4_._withStripped = true;

  /* style */
  const __vue_inject_styles__$4_ = undefined;
  /* scoped */
  const __vue_scope_id__$4_ = "data-v-01b4200e";
  /* module identifier */
  const __vue_module_identifier__$4_ = undefined;
  /* functional template */
  const __vue_is_functional_template__$4_ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4_ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4_, staticRenderFns: __vue_staticRenderFns__$4_ },
    __vue_inject_styles__$4_,
    __vue_script__$4_,
    __vue_scope_id__$4_,
    __vue_is_functional_template__$4_,
    __vue_module_identifier__$4_,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4Z = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme1Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4Z = script$4Z;
/* template */
var __vue_render__$4Z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    resourceBasisPath: _vm.resourceBasisPath,
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
                _vm._v(" "),
                _c("div", { staticClass: "jiantou1" }),
                _vm._v(" "),
                _c("div", { staticClass: "jiantou2" }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "zhuangshi" }, [
                _c("div", { staticClass: "line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line2" }),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4Z = [];
__vue_render__$4Z._withStripped = true;

  /* style */
  const __vue_inject_styles__$4Z = undefined;
  /* scoped */
  const __vue_scope_id__$4Z = "data-v-67dad623";
  /* module identifier */
  const __vue_module_identifier__$4Z = undefined;
  /* functional template */
  const __vue_is_functional_template__$4Z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4Z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4Z, staticRenderFns: __vue_staticRenderFns__$4Z },
    __vue_inject_styles__$4Z,
    __vue_script__$4Z,
    __vue_scope_id__$4Z,
    __vue_is_functional_template__$4Z,
    __vue_module_identifier__$4Z,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4Y = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4Y = script$4Y;
/* template */
var __vue_render__$4Y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-icon" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4Y = [];
__vue_render__$4Y._withStripped = true;

  /* style */
  const __vue_inject_styles__$4Y = undefined;
  /* scoped */
  const __vue_scope_id__$4Y = "data-v-9fd88dae";
  /* module identifier */
  const __vue_module_identifier__$4Y = undefined;
  /* functional template */
  const __vue_is_functional_template__$4Y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4Y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4Y, staticRenderFns: __vue_staticRenderFns__$4Y },
    __vue_inject_styles__$4Y,
    __vue_script__$4Y,
    __vue_scope_id__$4Y,
    __vue_is_functional_template__$4Y,
    __vue_module_identifier__$4Y,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4X = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4X = script$4X;
/* template */
var __vue_render__$4X = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-icon" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4X = [];
__vue_render__$4X._withStripped = true;

  /* style */
  const __vue_inject_styles__$4X = undefined;
  /* scoped */
  const __vue_scope_id__$4X = "data-v-2649608a";
  /* module identifier */
  const __vue_module_identifier__$4X = undefined;
  /* functional template */
  const __vue_is_functional_template__$4X = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4X = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4X, staticRenderFns: __vue_staticRenderFns__$4X },
    __vue_inject_styles__$4X,
    __vue_script__$4X,
    __vue_scope_id__$4X,
    __vue_is_functional_template__$4X,
    __vue_module_identifier__$4X,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4W = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme4Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4W = script$4W;
/* template */
var __vue_render__$4W = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4W = [];
__vue_render__$4W._withStripped = true;

  /* style */
  const __vue_inject_styles__$4W = undefined;
  /* scoped */
  const __vue_scope_id__$4W = "data-v-7cc2fe15";
  /* module identifier */
  const __vue_module_identifier__$4W = undefined;
  /* functional template */
  const __vue_is_functional_template__$4W = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4W = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4W, staticRenderFns: __vue_staticRenderFns__$4W },
    __vue_inject_styles__$4W,
    __vue_script__$4W,
    __vue_scope_id__$4W,
    __vue_is_functional_template__$4W,
    __vue_module_identifier__$4W,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4V = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme5Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4V = script$4V;
/* template */
var __vue_render__$4V = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme5-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-img" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-img" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4V = [];
__vue_render__$4V._withStripped = true;

  /* style */
  const __vue_inject_styles__$4V = undefined;
  /* scoped */
  const __vue_scope_id__$4V = "data-v-2fbd39a2";
  /* module identifier */
  const __vue_module_identifier__$4V = undefined;
  /* functional template */
  const __vue_is_functional_template__$4V = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4V = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4V, staticRenderFns: __vue_staticRenderFns__$4V },
    __vue_inject_styles__$4V,
    __vue_script__$4V,
    __vue_scope_id__$4V,
    __vue_is_functional_template__$4V,
    __vue_module_identifier__$4V,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4U = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme6Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4U = script$4U;
/* template */
var __vue_render__$4U = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme6-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "zhuangshi1" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "zhuangshi2" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4U = [];
__vue_render__$4U._withStripped = true;

  /* style */
  const __vue_inject_styles__$4U = undefined;
  /* scoped */
  const __vue_scope_id__$4U = "data-v-3cd6ed0e";
  /* module identifier */
  const __vue_module_identifier__$4U = undefined;
  /* functional template */
  const __vue_is_functional_template__$4U = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4U = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4U, staticRenderFns: __vue_staticRenderFns__$4U },
    __vue_inject_styles__$4U,
    __vue_script__$4U,
    __vue_scope_id__$4U,
    __vue_is_functional_template__$4U,
    __vue_module_identifier__$4U,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4T = {
  mixins: [singleGroupMixin],
  name: 'titleKnowledgeRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      numberTextDataName: 'numberTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4T = script$4T;
/* template */
var __vue_render__$4T = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Knowledge-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.numberTextDataName],
                    "block-data-name": _vm.numberTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4T = [];
__vue_render__$4T._withStripped = true;

  /* style */
  const __vue_inject_styles__$4T = undefined;
  /* scoped */
  const __vue_scope_id__$4T = "data-v-63331c9f";
  /* module identifier */
  const __vue_module_identifier__$4T = undefined;
  /* functional template */
  const __vue_is_functional_template__$4T = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4T = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4T, staticRenderFns: __vue_staticRenderFns__$4T },
    __vue_inject_styles__$4T,
    __vue_script__$4T,
    __vue_scope_id__$4T,
    __vue_is_functional_template__$4T,
    __vue_module_identifier__$4T,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4S = {
  mixins: [singleGroupMixin],
  name: 'titleSanQintheme1Render',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {},
      mouseHover: false
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4S = script$4S;
/* template */
var __vue_render__$4S = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group",
      class: [
        "xml-title-SanQintheme1-" + _vm.pageType,
        _vm.mouseHover ? "hovered" : "",
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4S = [];
__vue_render__$4S._withStripped = true;

  /* style */
  const __vue_inject_styles__$4S = undefined;
  /* scoped */
  const __vue_scope_id__$4S = "data-v-72baa80a";
  /* module identifier */
  const __vue_module_identifier__$4S = undefined;
  /* functional template */
  const __vue_is_functional_template__$4S = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4S = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4S, staticRenderFns: __vue_staticRenderFns__$4S },
    __vue_inject_styles__$4S,
    __vue_script__$4S,
    __vue_scope_id__$4S,
    __vue_is_functional_template__$4S,
    __vue_module_identifier__$4S,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4R = {
  mixins: [singleGroupMixin],
  name: 'titleSanQintheme2Render',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {},
      mouseHover: false
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4R = script$4R;
/* template */
var __vue_render__$4R = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group",
      class: [
        "xml-title-SanQintheme2-" + _vm.pageType,
        _vm.mouseHover ? "hovered" : "",
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4R = [];
__vue_render__$4R._withStripped = true;

  /* style */
  const __vue_inject_styles__$4R = undefined;
  /* scoped */
  const __vue_scope_id__$4R = "data-v-648c816e";
  /* module identifier */
  const __vue_module_identifier__$4R = undefined;
  /* functional template */
  const __vue_is_functional_template__$4R = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4R = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4R, staticRenderFns: __vue_staticRenderFns__$4R },
    __vue_inject_styles__$4R,
    __vue_script__$4R,
    __vue_scope_id__$4R,
    __vue_is_functional_template__$4R,
    __vue_module_identifier__$4R,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4Q = {
  mixins: [singleGroupMixin],
  name: 'titleSanQintheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4Q = script$4Q;
/* template */
var __vue_render__$4Q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-SanQintheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4Q = [];
__vue_render__$4Q._withStripped = true;

  /* style */
  const __vue_inject_styles__$4Q = undefined;
  /* scoped */
  const __vue_scope_id__$4Q = "data-v-6608562e";
  /* module identifier */
  const __vue_module_identifier__$4Q = undefined;
  /* functional template */
  const __vue_is_functional_template__$4Q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4Q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4Q, staticRenderFns: __vue_staticRenderFns__$4Q },
    __vue_inject_styles__$4Q,
    __vue_script__$4Q,
    __vue_scope_id__$4Q,
    __vue_is_functional_template__$4Q,
    __vue_module_identifier__$4Q,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4P = {
  mixins: [singleGroupMixin],
  name: 'titleTwentyRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4P = script$4P;
/* template */
var __vue_render__$4P = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-twenty-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c("div", { staticClass: "left-bg" }),
            _vm._v(" "),
            _c("div", { staticClass: "left-block" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-container" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4P = [];
__vue_render__$4P._withStripped = true;

  /* style */
  const __vue_inject_styles__$4P = undefined;
  /* scoped */
  const __vue_scope_id__$4P = "data-v-4696af6b";
  /* module identifier */
  const __vue_module_identifier__$4P = undefined;
  /* functional template */
  const __vue_is_functional_template__$4P = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4P = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4P, staticRenderFns: __vue_staticRenderFns__$4P },
    __vue_inject_styles__$4P,
    __vue_script__$4P,
    __vue_scope_id__$4P,
    __vue_is_functional_template__$4P,
    __vue_module_identifier__$4P,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4O = {
  mixins: [singleGroupMixin],
  name: 'titleTwentyoneRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_title_icon2_png__ = "data:image/png;base64,[encoded data, 11236 characters]";

/* script */
const __vue_script__$4O = script$4O;
var __vue_render__$4O = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-twentyone-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c("div", { staticClass: "left-bg" }, [
              _c("img", {
                attrs: {
                  src: __$_require_static_images_leaflet_resource_enter_title_icon2_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-container" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4O = [];
__vue_render__$4O._withStripped = true;

  /* style */
  const __vue_inject_styles__$4O = undefined;
  /* scoped */
  const __vue_scope_id__$4O = "data-v-84706d08";
  /* module identifier */
  const __vue_module_identifier__$4O = undefined;
  /* functional template */
  const __vue_is_functional_template__$4O = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4O = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4O, staticRenderFns: __vue_staticRenderFns__$4O },
    __vue_inject_styles__$4O,
    __vue_script__$4O,
    __vue_scope_id__$4O,
    __vue_is_functional_template__$4O,
    __vue_module_identifier__$4O,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4N = {
  mixins: [singleGroupMixin],
  name: 'titleTwentytwoRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_title_icon3_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAjCAYAAAA5dzKxAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QTJFNDVBQkQzNTJCMTFFRjhENDZEMUE5MzEyNkI3OTkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QTJFNDVBQkUzNTJCMTFFRjhENDZEMUE5MzEyNkI3OTkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBMkU0NUFCQjM1MkIxMUVGOEQ0NkQxQTkzMTI2Qjc5OSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBMkU0NUFCQzM1MkIxMUVGOEQ0NkQxQTkzMTI2Qjc5OSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhQPLJgAAAHvSURBVHja3JhPKARhGMZnZ5eDQiklB/lbJJFwc1kXDg5KSi5KFBdcnJQo5cKWlhNJDo4ulFzERsvFxEXaA4VycVkXkfW8eqemMbNtmhnzzlO/dna+nT/Pfu/3ft/7hVJ7GcVCITALBkCB4h+lwQ5YtmqM2FzUDxYUf6oZ3IAjc4Nqc0Grgw9Pgii4dvCelu+nevBPnoFjcOn2gyIemJkEnaD9v83EOT6d0KYD9+gAI381cwgOfDT437KZUZUAyQ0zPZy5okEwUwWaOETHpZvR+DMPrIM1j7KmK2YoxL4M3ye4l0okmqGMkzKd6wIXoF6aGdKVxblaXtp0B8EMqRjsg2lJZrQsbWGwAjZAvoS1mZbDb2gmp2Jq1O9mXsAzKLdoOwGvoBCcS1k1azZmnsCQpDFjTgJU6r7z8SCXBKLMaIZ5ZwrEDPsLq5wIxJhJcm/EeIwscoiRWsCYJDOPoBTMGXpoxtA+7/Tz3a5n0px+de2CUz7+lLgHYBQZ6wO9IGFakIozo/D42fZyQ0MPgUpQ7aPKuCJbiNqZSfBn3IelfsbwfjmZoa3PYZ7gwj4y8gG2uDb6pZDNxrlI6T1TBOqEeqDeuKN5LMIF0y0oE9wp96CBJs1G4Ub0rFuj8jIjCPoJM9oYXwJtgo1QwffwLcAAudpcGOn8/bYAAAAASUVORK5CYII=";

/* script */
const __vue_script__$4N = script$4N;
var __vue_render__$4N = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-twentytwo-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c("div", { staticClass: "left-bg" }, [
              _c("div", [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_title_icon3_png__,
                    alt: "",
                  },
                }),
              ]),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "title-container" }, [
              _c(
                "div",
                { staticClass: "title-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4N = [];
__vue_render__$4N._withStripped = true;

  /* style */
  const __vue_inject_styles__$4N = undefined;
  /* scoped */
  const __vue_scope_id__$4N = "data-v-a5945a92";
  /* module identifier */
  const __vue_module_identifier__$4N = undefined;
  /* functional template */
  const __vue_is_functional_template__$4N = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4N = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4N, staticRenderFns: __vue_staticRenderFns__$4N },
    __vue_inject_styles__$4N,
    __vue_script__$4N,
    __vue_scope_id__$4N,
    __vue_is_functional_template__$4N,
    __vue_module_identifier__$4N,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4M = {
  mixins: [singleGroupMixin],
  name: 'titleTwentythreeRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_title_icon4_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAA9CAYAAADmgpoeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RjFGNTAyNDgzNTJDMTFFRkJDNjRDNzBDOThGMUQ4MEYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RjFGNTAyNDkzNTJDMTFFRkJDNjRDNzBDOThGMUQ4MEYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGMUY1MDI0NjM1MkMxMUVGQkM2NEM3MEM5OEYxRDgwRiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGMUY1MDI0NzM1MkMxMUVGQkM2NEM3MEM5OEYxRDgwRiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PvQDMF8AAAbaSURBVHja3Jt5bFVFFIffe6UtUErLorEUqyXQQisoxopsJUKsIhEoppjGoCUuRIMgwURTkQSJQCFG/YMgVIMriChRRC0JQtxYREqiiCwGaCNFq9LSUpAW+vxNPdccT+du782zlpN8yZ0782buuXPuLOfMC4bD4YAhGWCgjgbwu4mHCRpUzERFq8CjJh4mFLhM5bJVrIvBumax6ztAIUs/Ds57yDto7GnUN+bAILAVXOlSTvJU+N+S4jHPC0WgHMQ5lXPqsUFgB0gH28F4UNvBFlYE1oM44iFwyc83lsWUUpILVnawUmngLVJIyUzwCku7mmIW+FmYyw8ezbELGAU2id/XgRZwFpwTeQ+Cazya4XRwUfx+rc4svSh1wEUpVekksA7UhyOXg+BZ+q79KveaVM5NKSWHQbqmgW5gHqgKm5VWUAHybRS7X6NYO+WslYf1TfWzse8jNHicpPR9YBnZvZ2cAYfBUXAW1IMEkETtqDYzQbxDHRVgLrWvpMTxuwoEXgcPtA0opOHnGvM7Ie4dAWNo+NfJJbANPAZyPX4z3cFtYJlDz6tv8kn6FmVPVWjuFXNT7E8Pzr+pa8FxD6ZzBjwHMnzOR5IQmAA+8Wiyq0CQ5jVLuRd035hS7gNwBbvnpFwzWB7BBOuFm8AuD0rxSXuF06goCdJwKqXSh7kFxGi51EcPzgJNou2L9Ek4/t6t8hUapVaCRJ89EIliFtfRyMylnno1IsXmaobh+RGaVjSKKfqA3eJ5frGZhhwVyxejjVLq4Si+mWgVUySBL4RyX4MEXXndWjFZrMmUPA3WsLTKmxzjtWEquJWlm8Bd4AC7Nwos8rpWfEm8lQ/FCKRm9w2U90SMeiwVfAsu0HKN52WDBlafWoNe72aKNwoTVEus3mKkelcoPt+wYimklCVKuYmizAzxDDvFy29nikuECard7WmWbgU/snQz+MmwCZ4DJ8TS7KQo8ybYxtIjwVQ7Uxwu3sJnDm91Eb3JKTEyxXiwEdSCYTZlBpMZWrLXzhTLhWJjXRrPivGoqJQb4FLmbfHMI6UpdgPTWUfuBl+6mMyRGI+KLeCYS5kykS6RroFJoCcrsLaTeNm+A7tY+m5rjOCK8Te1oRO5EDey6z5gBFcsn2V+QyNRZ5FtIj3GUqy3CCjsMNio5SLrzu5NAMMNtqFWIr+x9A2WYrmi4PeGGkwEH9FSjG//88gqig0GQ/gzD7YUyxQFDxlq8GUw0cG1ribZ0YbaOix8om0N9BWFTrHrceAWh+HVTjLJ4cNXE+/R/bHMTBc4KC9FmW+BCDk10HUNu5/UBiazhWKS68omwKUiz+uEPFP87k6Wt0WsA4Me63xE1JnhsHdMC9HkzOVPQ1sOLvvYdSW7Vu64rgbaaxbp+JBmaE820JBcGD9DA8hAYaI1LIQUjfQQ6SbVjbNFN6YLb28vhp/dbq2o9zztxLk876PORPEsIZa3WNTb1mPVDkFy9TbrGF5F7XbniHvK5IIsfZy2SV7lgniWVjFYWaLmtJaQGCr/GS4NyDu0KK3X5O0hl/kfhtrKZtdHreH+GL2NRMq4GbxqqEHlS99Mm8AssoCvaHVj6riCGvyGipVIm2It9Aat9eJ4w2u5uhjvFkazTglYq/2QZn040FqWdBKRE/x2rtjHInNGJzr1cI+YI6u5YnuFk6aEJs//u0xhcXLLydMuuP4Gu+5HwWs7URu6xQ4BOBMyBMxzyFdTR6lYfazTealShdOligJzOj/6fiqz3u28RYTkkG9eSalNmWmaUK2tw3SJKLxEE9rZo4m+mFSqL1OKnyyQK5sq4Q3OclJM9dopsfqW4ZpCum9FPHJi0GOl7Bn2k5Xw/JVC8Re9RFvuFT86polaTgXVYEgMlOLKVWqUKhLPVwN6elEsSCFb6RVO0ByHCMQY2cYIEeFs1QQtHONjvTSnBt63i0V5QNV1mlgYYR3DNDuG5ZFENIdqTtqooxA9OiDwN46OLXHZQm7wgNfAH/dWTRO70wJai/2XS67ZYKvYle8hl3yLve/K/W0VgEbxttRhrzl0KMxLHWrUWk0UevzN1ZpvPUzHJFw3vV5NIU9MA/xYxO2GBww1wi3QvMwwnapL8lKPnwavAtttDpSo2FRJhN8fj3eV0QCjOywzz4dHK+C38TgKzTY6nHvaTO6wPN38wqaUDArBllHP28k+tzMdOiI9d9+fTr8VB9xPgv8KGskbFk8epTSN209KLZ0IWB2wOR7r7PiOfrFa7tCDkcghOkGXFM2zmfqnRArtjSZTNCXV5+/VXvBTsAnsNOEPMfkXEL7Hy6H9VDa5xpJJ2WYyS+Uiqwr8fc6+kszVqPwlwACntu8G7KPwnAAAAABJRU5ErkJggg==";

/* script */
const __vue_script__$4M = script$4M;
var __vue_render__$4M = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-twentythree-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c("div", { staticClass: "left-bg" }, [
              _c("div", [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_title_icon4_png__,
                    alt: "",
                  },
                }),
              ]),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "title-container" }, [
              _c(
                "div",
                { staticClass: "title-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4M = [];
__vue_render__$4M._withStripped = true;

  /* style */
  const __vue_inject_styles__$4M = undefined;
  /* scoped */
  const __vue_scope_id__$4M = "data-v-22142bca";
  /* module identifier */
  const __vue_module_identifier__$4M = undefined;
  /* functional template */
  const __vue_is_functional_template__$4M = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4M = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4M, staticRenderFns: __vue_staticRenderFns__$4M },
    __vue_inject_styles__$4M,
    __vue_script__$4M,
    __vue_scope_id__$4M,
    __vue_is_functional_template__$4M,
    __vue_module_identifier__$4M,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4L = {
  mixins: [singleGroupMixin],
  name: 'titleTwentyfourRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_title_bg2_png__ = "data:image/png;base64,[encoded data, 14588 characters]";

/* script */
const __vue_script__$4L = script$4L;
var __vue_render__$4L = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-twentyfour-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c("div", { staticClass: "left-bg" }, [
              _c("img", {
                attrs: {
                  src: __$_require_static_images_leaflet_resource_enter_title_bg2_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "title-container" }, [
              _c("div", { staticClass: "left-line" }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "title-body" },
                [
                  _c("div", { staticClass: "title-body-box" }),
                  _vm._v(" "),
                  _c("xml-text-render", {
                    staticClass: "text-container",
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "right-line" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4L = [];
__vue_render__$4L._withStripped = true;

  /* style */
  const __vue_inject_styles__$4L = undefined;
  /* scoped */
  const __vue_scope_id__$4L = "data-v-1b912bd3";
  /* module identifier */
  const __vue_module_identifier__$4L = undefined;
  /* functional template */
  const __vue_is_functional_template__$4L = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4L = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4L, staticRenderFns: __vue_staticRenderFns__$4L },
    __vue_inject_styles__$4L,
    __vue_script__$4L,
    __vue_scope_id__$4L,
    __vue_is_functional_template__$4L,
    __vue_module_identifier__$4L,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4K = {
  mixins: [singleGroupMixin],
  name: 'titleTwentyfiveRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_title_icon8_png__ = "data:image/png;base64,[encoded data, 12400 characters]";

/* script */
const __vue_script__$4K = script$4K;
var __vue_render__$4K = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-twentyfive-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c("div", { staticClass: "left-bg" }, [
              _c("img", {
                attrs: {
                  src: __$_require_static_images_leaflet_resource_enter_title_bg2_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "title-container" }, [
              _c("img", {
                staticClass: "icon",
                attrs: {
                  src: __$_require_static_images_leaflet_resource_enter_title_icon8_png__,
                  alt: "",
                },
              }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "title-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4K = [];
__vue_render__$4K._withStripped = true;

  /* style */
  const __vue_inject_styles__$4K = undefined;
  /* scoped */
  const __vue_scope_id__$4K = "data-v-50a246ce";
  /* module identifier */
  const __vue_module_identifier__$4K = undefined;
  /* functional template */
  const __vue_is_functional_template__$4K = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4K = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4K, staticRenderFns: __vue_staticRenderFns__$4K },
    __vue_inject_styles__$4K,
    __vue_script__$4K,
    __vue_scope_id__$4K,
    __vue_is_functional_template__$4K,
    __vue_module_identifier__$4K,
    false,
    undefined,
    undefined,
    undefined
  );

const TitleComponents$4 = [__vue_component__$5n, __vue_component__$5m, __vue_component__$5l, __vue_component__$5k, __vue_component__$5j, __vue_component__$5i, __vue_component__$5h, __vue_component__$5g, __vue_component__$5f, __vue_component__$5e, __vue_component__$5d, __vue_component__$5c, __vue_component__$5b, __vue_component__$5a, __vue_component__$59, __vue_component__$58, __vue_component__$57, __vue_component__$56, __vue_component__$55, __vue_component__$54, __vue_component__$53, __vue_component__$52, __vue_component__$51, __vue_component__$50, __vue_component__$4$, __vue_component__$4_, __vue_component__$4Z, __vue_component__$4Y, __vue_component__$4X, __vue_component__$4W, __vue_component__$4V, __vue_component__$4U, __vue_component__$4T, __vue_component__$4S, __vue_component__$4R, __vue_component__$4Q, __vue_component__$4P, __vue_component__$4O, __vue_component__$4N, __vue_component__$4M, __vue_component__$4L, __vue_component__$4K];
var XmlTitle = {
  // install,
  ...TitleComponents$4
};

//
var script$4J = {
  mixins: [singleGroupMixin],
  name: 'imageTextEighthRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4J = script$4J;
/* template */
var __vue_render__$4J = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-eighth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "iamge-bg-box" },
            [
              _c("xml-image-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                  "block-data-name": _vm.imageBlockDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "image-container",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                },
                on: { blockclick: _vm.handleBlockClick },
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4J = [];
__vue_render__$4J._withStripped = true;

  /* style */
  const __vue_inject_styles__$4J = undefined;
  /* scoped */
  const __vue_scope_id__$4J = "data-v-6ab1a2cd";
  /* module identifier */
  const __vue_module_identifier__$4J = undefined;
  /* functional template */
  const __vue_is_functional_template__$4J = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4J = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4J, staticRenderFns: __vue_staticRenderFns__$4J },
    __vue_inject_styles__$4J,
    __vue_script__$4J,
    __vue_scope_id__$4J,
    __vue_is_functional_template__$4J,
    __vue_module_identifier__$4J,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4I = {
  mixins: [singleGroupMixin],
  name: 'imageTextFifthRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4I = script$4I;
/* template */
var __vue_render__$4I = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-fifth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticStyle: { "border-radius": "6px", padding: "9px 11px" } },
            [
              _c(
                "div",
                { staticClass: "iamge-bg-box" },
                [
                  _c(
                    "div",
                    { staticClass: "image-top-title" },
                    [
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.titleTextDataName],
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                  _vm._v(" "),
                  _c("xml-image-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                      "block-data-name": _vm.imageBlockDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "image-container",
                      mode: _vm.mode,
                      resourceBasisPath: _vm.resourceBasisPath,
                    },
                    on: { blockclick: _vm.handleBlockClick },
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "image-text-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4I = [];
__vue_render__$4I._withStripped = true;

  /* style */
  const __vue_inject_styles__$4I = undefined;
  /* scoped */
  const __vue_scope_id__$4I = "data-v-00d16ca6";
  /* module identifier */
  const __vue_module_identifier__$4I = undefined;
  /* functional template */
  const __vue_is_functional_template__$4I = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4I = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4I, staticRenderFns: __vue_staticRenderFns__$4I },
    __vue_inject_styles__$4I,
    __vue_script__$4I,
    __vue_scope_id__$4I,
    __vue_is_functional_template__$4I,
    __vue_module_identifier__$4I,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4H = {
  mixins: [singleGroupMixin],
  name: 'imageTextFirstRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4H = script$4H;
/* template */
var __vue_render__$4H = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-first-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticStyle: {
                background: "#4c95ee",
                "border-radius": "6px",
                padding: "9px 11px",
              },
            },
            [
              _c(
                "div",
                { staticStyle: { display: "flex", "flex-wrap": "nowrap" } },
                [
                  _c(
                    "div",
                    [
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.titleTextDataName],
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                      _vm._v(" "),
                      _c("xml-image-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                          "block-data-name": _vm.imageBlockDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "image-container",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                        },
                        on: { blockclick: _vm.handleBlockClick },
                      }),
                      _vm._v(" "),
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                          "block-data-name": _vm.bodyTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-body-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                ]
              ),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4H = [];
__vue_render__$4H._withStripped = true;

  /* style */
  const __vue_inject_styles__$4H = undefined;
  /* scoped */
  const __vue_scope_id__$4H = "data-v-661c981f";
  /* module identifier */
  const __vue_module_identifier__$4H = undefined;
  /* functional template */
  const __vue_is_functional_template__$4H = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4H = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4H, staticRenderFns: __vue_staticRenderFns__$4H },
    __vue_inject_styles__$4H,
    __vue_script__$4H,
    __vue_scope_id__$4H,
    __vue_is_functional_template__$4H,
    __vue_module_identifier__$4H,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4G = {
  mixins: [singleGroupMixin],
  name: 'imageTextFourthRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4G = script$4G;
/* template */
var __vue_render__$4G = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-fourth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticStyle: { "border-radius": "6px", padding: "9px 11px" } },
            [
              _c(
                "div",
                { staticClass: "iamge-bg-box" },
                [
                  _c("xml-image-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                      "block-data-name": _vm.imageBlockDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "image-container",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                    },
                    on: { blockclick: _vm.handleBlockClick },
                  }),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "image-text-box" },
                    [
                      _c(
                        "div",
                        { staticClass: "image-top-title" },
                        [
                          _c("xml-text-render", {
                            attrs: {
                              "p-block-data":
                                _vm.groupData[_vm.numberTextDataName],
                              "block-data-name": _vm.numberTextDataName,
                              "extend-params": _vm.extendParams,
                              "current-rule": _vm.currentRule,
                              "rule-index": _vm.ruleIndex,
                              "container-class": "text-container-number",
                              "editor-class": "editor",
                              mode: _vm.mode,
                              "page-type": _vm.pageType,
                              resourceBasisPath: _vm.resourceBasisPath,
                              scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                            },
                            on: {
                              blockclick: _vm.handleBlockClick,
                              groupDataChange: _vm.groupDataChange,
                            },
                            scopedSlots: _vm._u(
                              [
                                _vm._l(
                                  _vm.$scopedSlots,
                                  function (index, name) {
                                    return {
                                      key: name,
                                      fn: function (deliver) {
                                        return [
                                          _vm._t(name, null, null, deliver),
                                        ]
                                      },
                                    }
                                  }
                                ),
                              ],
                              null,
                              true
                            ),
                          }),
                          _vm._v(" "),
                          _c("xml-text-render", {
                            attrs: {
                              "p-block-data":
                                _vm.groupData[_vm.titleTextDataName],
                              "block-data-name": _vm.titleTextDataName,
                              "extend-params": _vm.extendParams,
                              "current-rule": _vm.currentRule,
                              "rule-index": _vm.ruleIndex,
                              "container-class": "text-container",
                              "editor-class": "editor",
                              mode: _vm.mode,
                              "page-type": _vm.pageType,
                              resourceBasisPath: _vm.resourceBasisPath,
                              scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                            },
                            on: {
                              blockclick: _vm.handleBlockClick,
                              groupDataChange: _vm.groupDataChange,
                            },
                            scopedSlots: _vm._u(
                              [
                                _vm._l(
                                  _vm.$scopedSlots,
                                  function (index, name) {
                                    return {
                                      key: name,
                                      fn: function (deliver) {
                                        return [
                                          _vm._t(name, null, null, deliver),
                                        ]
                                      },
                                    }
                                  }
                                ),
                              ],
                              null,
                              true
                            ),
                          }),
                        ],
                        1
                      ),
                      _vm._v(" "),
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                          "block-data-name": _vm.bodyTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-body-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                ],
                1
              ),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4G = [];
__vue_render__$4G._withStripped = true;

  /* style */
  const __vue_inject_styles__$4G = undefined;
  /* scoped */
  const __vue_scope_id__$4G = "data-v-b320880c";
  /* module identifier */
  const __vue_module_identifier__$4G = undefined;
  /* functional template */
  const __vue_is_functional_template__$4G = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4G = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4G, staticRenderFns: __vue_staticRenderFns__$4G },
    __vue_inject_styles__$4G,
    __vue_script__$4G,
    __vue_scope_id__$4G,
    __vue_is_functional_template__$4G,
    __vue_module_identifier__$4G,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4F = {
  mixins: [singleGroupMixin],
  name: 'imageTextSecondRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4F = script$4F;
/* template */
var __vue_render__$4F = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-second-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticStyle: { display: "flex", "align-items": "center" } },
            [
              _c(
                "div",
                { staticClass: "image-box" },
                [
                  _c("xml-image-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                      "block-data-name": _vm.imageBlockDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "image-container",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "title-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: { blockclick: _vm.handleBlockClick },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]
          ),
          _vm._v(" "),
          _c("div", { staticClass: "body-box" }, [
            _c(
              "div",
              { staticClass: "body-box-inner" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4F = [];
__vue_render__$4F._withStripped = true;

  /* style */
  const __vue_inject_styles__$4F = undefined;
  /* scoped */
  const __vue_scope_id__$4F = "data-v-0816a7ae";
  /* module identifier */
  const __vue_module_identifier__$4F = undefined;
  /* functional template */
  const __vue_is_functional_template__$4F = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4F = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4F, staticRenderFns: __vue_staticRenderFns__$4F },
    __vue_inject_styles__$4F,
    __vue_script__$4F,
    __vue_scope_id__$4F,
    __vue_is_functional_template__$4F,
    __vue_module_identifier__$4F,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4E = {
  mixins: [singleGroupMixin],
  name: 'imageTextSeventhRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4E = script$4E;
/* template */
var __vue_render__$4E = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-seventh-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticStyle: { "border-radius": "6px", padding: "9px 11px" } },
            [
              _c("div", {}, [
                _c("div", { staticClass: "image-text-decorate2" }),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "iamge-bg-box" },
                  [
                    _c("xml-image-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                        "block-data-name": _vm.imageBlockDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "image-container",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        resourceBasisPath: _vm.resourceBasisPath,
                      },
                      on: { blockclick: _vm.handleBlockClick },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "image-text-box" },
                  [
                    _c(
                      "xml-text-render",
                      {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                          "block-data-name": _vm.bodyTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-body-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      },
                      [_vm._v("s\n          ")]
                    ),
                  ],
                  1
                ),
                _vm._v(" "),
                _c("div", { staticClass: "image-text-decorate" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4E = [];
__vue_render__$4E._withStripped = true;

  /* style */
  const __vue_inject_styles__$4E = undefined;
  /* scoped */
  const __vue_scope_id__$4E = "data-v-0442f464";
  /* module identifier */
  const __vue_module_identifier__$4E = undefined;
  /* functional template */
  const __vue_is_functional_template__$4E = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4E = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4E, staticRenderFns: __vue_staticRenderFns__$4E },
    __vue_inject_styles__$4E,
    __vue_script__$4E,
    __vue_scope_id__$4E,
    __vue_is_functional_template__$4E,
    __vue_module_identifier__$4E,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4D = {
  mixins: [singleGroupMixin],
  name: 'imageTextSixthRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4D = script$4D;
/* template */
var __vue_render__$4D = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-sixth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticStyle: {
                "border-radius": "6px",
                padding: "9px 11px",
                display: "flex",
              },
            },
            [
              _c("div", { staticStyle: { display: "flex" } }, [
                _c(
                  "div",
                  { staticClass: "iamge-bg-box" },
                  [
                    _c(
                      "div",
                      { staticClass: "image-top-title" },
                      [
                        _c("xml-text-render", {
                          attrs: {
                            "p-block-data":
                              _vm.groupData[_vm.titleTextDataName],
                            "block-data-name": _vm.titleTextDataName,
                            "extend-params": _vm.extendParams,
                            "current-rule": _vm.currentRule,
                            "rule-index": _vm.ruleIndex,
                            "container-class": "text-container",
                            "editor-class": "editor",
                            mode: _vm.mode,
                            "page-type": _vm.pageType,
                            resourceBasisPath: _vm.resourceBasisPath,
                            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                          },
                          on: {
                            blockclick: _vm.handleBlockClick,
                            groupDataChange: _vm.groupDataChange,
                          },
                          scopedSlots: _vm._u(
                            [
                              _vm._l(_vm.$scopedSlots, function (index, name) {
                                return {
                                  key: name,
                                  fn: function (deliver) {
                                    return [_vm._t(name, null, null, deliver)]
                                  },
                                }
                              }),
                            ],
                            null,
                            true
                          ),
                        }),
                      ],
                      1
                    ),
                    _vm._v(" "),
                    _c("xml-image-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                        "block-data-name": _vm.imageBlockDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "image-container",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        resourceBasisPath: _vm.resourceBasisPath,
                      },
                      on: { blockclick: _vm.handleBlockClick },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "image-text-box" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                        "block-data-name": _vm.bodyTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-body-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        resourceBasisPath: _vm.resourceBasisPath,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c("div", { staticClass: "image-text-decorate" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4D = [];
__vue_render__$4D._withStripped = true;

  /* style */
  const __vue_inject_styles__$4D = undefined;
  /* scoped */
  const __vue_scope_id__$4D = "data-v-5ea07dc4";
  /* module identifier */
  const __vue_module_identifier__$4D = undefined;
  /* functional template */
  const __vue_is_functional_template__$4D = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4D = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4D, staticRenderFns: __vue_staticRenderFns__$4D },
    __vue_inject_styles__$4D,
    __vue_script__$4D,
    __vue_scope_id__$4D,
    __vue_is_functional_template__$4D,
    __vue_module_identifier__$4D,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4C = {
  mixins: [singleGroupMixin],
  name: 'imageTextThirdRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4C = script$4C;
/* template */
var __vue_render__$4C = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-third-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticStyle: { "border-radius": "6px", padding: "9px 11px" } },
            [
              _c(
                "div",
                {
                  staticStyle: {
                    display: "flex",
                    "flex-wrap": "nowrap",
                    "justify-content": "space-between",
                    "align-items": "center",
                  },
                },
                [
                  _c(
                    "div",
                    { staticStyle: { width: "48%" } },
                    [
                      _c("xml-image-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                          "block-data-name": _vm.imageBlockDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "image-container",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                        },
                        on: { blockclick: _vm.handleBlockClick },
                      }),
                    ],
                    1
                  ),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticStyle: { width: "48%" } },
                    [
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.titleTextDataName],
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                      _vm._v(" "),
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                          "block-data-name": _vm.bodyTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-body-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                ]
              ),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4C = [];
__vue_render__$4C._withStripped = true;

  /* style */
  const __vue_inject_styles__$4C = undefined;
  /* scoped */
  const __vue_scope_id__$4C = "data-v-586c477d";
  /* module identifier */
  const __vue_module_identifier__$4C = undefined;
  /* functional template */
  const __vue_is_functional_template__$4C = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4C = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4C, staticRenderFns: __vue_staticRenderFns__$4C },
    __vue_inject_styles__$4C,
    __vue_script__$4C,
    __vue_scope_id__$4C,
    __vue_is_functional_template__$4C,
    __vue_module_identifier__$4C,
    false,
    undefined,
    undefined,
    undefined
  );

const ImageTextComponents = [__vue_component__$4J, __vue_component__$4I, __vue_component__$4H, __vue_component__$4G, __vue_component__$4F, __vue_component__$4E, __vue_component__$4D, __vue_component__$4C];
var ImageText = {
  // install,
  ...ImageTextComponents
};

//
var script$4B = {
  mixins: [singleGroupMixin],
  name: 'ParagrapheighthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4B = script$4B;
/* template */
var __vue_render__$4B = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-eighth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-row-box" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "text-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                ],
                1
              ),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4B = [];
__vue_render__$4B._withStripped = true;

  /* style */
  const __vue_inject_styles__$4B = undefined;
  /* scoped */
  const __vue_scope_id__$4B = "data-v-1c443d0a";
  /* module identifier */
  const __vue_module_identifier__$4B = undefined;
  /* functional template */
  const __vue_is_functional_template__$4B = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4B = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4B, staticRenderFns: __vue_staticRenderFns__$4B },
    __vue_inject_styles__$4B,
    __vue_script__$4B,
    __vue_scope_id__$4B,
    __vue_is_functional_template__$4B,
    __vue_module_identifier__$4B,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4A = {
  mixins: [singleGroupMixin],
  name: 'paragraphFirstRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4A = script$4A;
/* template */
var __vue_render__$4A = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-first-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "rotate-container" }, [
            _c(
              "div",
              { staticClass: "rotate-container-inner" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
          _vm._v(" "),
          _c("xml-text-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.bodyTextDataName],
              "block-data-name": _vm.bodyTextDataName,
              "extend-params": _vm.extendParams,
              "current-rule": _vm.currentRule,
              "rule-index": _vm.ruleIndex,
              "container-class": "text-body-container",
              "editor-class": "editor",
              mode: _vm.mode,
              "page-type": _vm.pageType,
              resourceBasisPath: _vm.resourceBasisPath,
              scopedSlots: { $scopedSlots: _vm.$scopedSlots },
            },
            on: {
              blockclick: _vm.handleBlockClick,
              groupDataChange: _vm.groupDataChange,
            },
            scopedSlots: _vm._u(
              [
                _vm._l(_vm.$scopedSlots, function (index, name) {
                  return {
                    key: name,
                    fn: function (deliver) {
                      return [_vm._t(name, null, null, deliver)]
                    },
                  }
                }),
              ],
              null,
              true
            ),
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4A = [];
__vue_render__$4A._withStripped = true;

  /* style */
  const __vue_inject_styles__$4A = undefined;
  /* scoped */
  const __vue_scope_id__$4A = "data-v-37e1234e";
  /* module identifier */
  const __vue_module_identifier__$4A = undefined;
  /* functional template */
  const __vue_is_functional_template__$4A = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4A = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4A, staticRenderFns: __vue_staticRenderFns__$4A },
    __vue_inject_styles__$4A,
    __vue_script__$4A,
    __vue_scope_id__$4A,
    __vue_is_functional_template__$4A,
    __vue_module_identifier__$4A,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4z = {
  mixins: [singleGroupMixin],
  name: 'paragraphIsoscelesRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4z = script$4z;
/* template */
var __vue_render__$4z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-isosceles-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "circle" }),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "shape" }, [
            _c("div", { staticClass: "triangle" }),
            _vm._v(" "),
            _c("div", { staticClass: "triangle2" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4z = [];
__vue_render__$4z._withStripped = true;

  /* style */
  const __vue_inject_styles__$4z = undefined;
  /* scoped */
  const __vue_scope_id__$4z = "data-v-2beadc9c";
  /* module identifier */
  const __vue_module_identifier__$4z = undefined;
  /* functional template */
  const __vue_is_functional_template__$4z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4z, staticRenderFns: __vue_staticRenderFns__$4z },
    __vue_inject_styles__$4z,
    __vue_script__$4z,
    __vue_scope_id__$4z,
    __vue_is_functional_template__$4z,
    __vue_module_identifier__$4z,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4y = {
  mixins: [singleGroupMixin],
  name: 'paragraphninthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。

      bodyTextDataName2: 'bodyTextData2',
      titleTextDataName2: 'titleTextData2',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4y = script$4y;
/* template */
var __vue_render__$4y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-ninth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-row-box" },
            [
              _c(
                "div",
                { staticClass: "text-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName2],
                      "block-data-name": _vm.bodyTextDataName2,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle2" }),
                ],
                1
              ),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                  "block-data-name": _vm.titleTextDataName2,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4y = [];
__vue_render__$4y._withStripped = true;

  /* style */
  const __vue_inject_styles__$4y = undefined;
  /* scoped */
  const __vue_scope_id__$4y = "data-v-7949c233";
  /* module identifier */
  const __vue_module_identifier__$4y = undefined;
  /* functional template */
  const __vue_is_functional_template__$4y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4y, staticRenderFns: __vue_staticRenderFns__$4y },
    __vue_inject_styles__$4y,
    __vue_script__$4y,
    __vue_scope_id__$4y,
    __vue_is_functional_template__$4y,
    __vue_module_identifier__$4y,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4x = {
  mixins: [singleGroupMixin],
  name: 'paragraphQuadrangleRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4x = script$4x;
/* template */
var __vue_render__$4x = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-quadrangle-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin1" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin2" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin3" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin4" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin5" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin6" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin7" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin8" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4x = [];
__vue_render__$4x._withStripped = true;

  /* style */
  const __vue_inject_styles__$4x = undefined;
  /* scoped */
  const __vue_scope_id__$4x = "data-v-711d223a";
  /* module identifier */
  const __vue_module_identifier__$4x = undefined;
  /* functional template */
  const __vue_is_functional_template__$4x = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4x = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4x, staticRenderFns: __vue_staticRenderFns__$4x },
    __vue_inject_styles__$4x,
    __vue_script__$4x,
    __vue_scope_id__$4x,
    __vue_is_functional_template__$4x,
    __vue_module_identifier__$4x,
    false,
    undefined,
    undefined,
    undefined
  );

var Left$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAkCAYAAABSSLCCAAAAAXNSR0IArs4c6QAAARVJREFUSEvtlbtOw0AQRe9dFAsTbEtIPCr+wTX0ES8FgahIfoeKBhMeSiq+jD/YQOOV7MSD1thSgpGXksLbn5md0ehcDhL90ffgLZZAIXA+ITJevujs/jrohZsKS7EUXWDO4bNOZ+PI391WsAydDAwvnnQ6G0X+XlhBq31+KUBYyHa6jfz9GvpTpw6yu+22V11Yt4huEetS+/8XUcsy+GFY67/a7SsuLGV59fpt2J2+aji8VLu1+7pADW+mOr0bBn7oKxRVALRKljAcJDrb8tCzFevKjtgwPJ3M3/OFHBYiqkwZmxwtlNiZTh710YbiAyGxAM3BmgUMAeH55DMGZQpIDAcoQF79RHiWzI+p8AbioG0mAbIvFBoA7XBwjR8AAAAASUVORK5CYII=";

var Right = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAkCAYAAACJ8xqgAAAAAXNSR0IArs4c6QAAAf9JREFUSEvtljtv01AcR8+182jUJg4gxMTCgPgI7IipDKxQqqA27YQCAx8Bda2EFPEYiICoCo+9dEAsSIyRmAEhnqmSJo5bOyGx70XXBBQ2O80E8Wrp3P/j6v6OWCy3baFIEfFTQMoEw4CDHzSAwk7pyGsQ+hfiezcYAMmIPECRMgVtT3Lz+b5subK+kEms71yz6hoqlFIekIkKVAqEgF0nYK3q0BsiFaqeSJghNASqqEAFGqjb/dDy2XjhUjibofKmL981/fqcIa5PXOH7ps/Gtsv9KxafOz63X3ny7dfg08TAb3ZA6anDw0Ke+bTg415A6YkzjA/UmwQ6nmS50mVrxSKXMWjuS1Yfd3vxgaOlaOBSxaa2mic3Z9BwJMV/FDg2w+m0PAMe/trMZjib4QTP19SvzX/4Ho63/MCmVpxiBCxXbLZW8mFI/ZUpkYI+NBeQSmEagtaBpFjt8uiqdbiQ+q0sOjZvPHO4ezlHdjz1Gk7goWK4DYqkKfjSkWy+dClfyjGfEmHL69VuT1y8044lS7pC09BBr8hnRLgUfcAf4LnNPU9ElaUxRev0JaeOJagVLQwh2HVG5nChHL9CrSLeQLKQNri3ZHE8a9BxJWu65cVyeyBiCedo2/LXxk+fSHL+TIqTRw1ubbtDDbQF0ZV4XEwDqej7YAjIpgU9n8FPuCBZn/dscCMAAAAASUVORK5CYII=";

//
var script$4w = {
  mixins: [singleGroupMixin],
  name: 'paragraphSecondRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      groupData: {},
      Left: Left$1,
      Right
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4w = script$4w;
/* template */
var __vue_render__$4w = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-second-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-second-title" },
            [
              _c("el-image", {
                staticClass: "left-image",
                attrs: { src: _vm.Left },
              }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("el-image", {
                staticClass: "right-image",
                attrs: { src: _vm.Right },
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4w = [];
__vue_render__$4w._withStripped = true;

  /* style */
  const __vue_inject_styles__$4w = undefined;
  /* scoped */
  const __vue_scope_id__$4w = "data-v-34db4c8e";
  /* module identifier */
  const __vue_module_identifier__$4w = undefined;
  /* functional template */
  const __vue_is_functional_template__$4w = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4w = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4w, staticRenderFns: __vue_staticRenderFns__$4w },
    __vue_inject_styles__$4w,
    __vue_script__$4w,
    __vue_scope_id__$4w,
    __vue_is_functional_template__$4w,
    __vue_module_identifier__$4w,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4v = {
  mixins: [singleGroupMixin],
  name: 'paragraphSeventhRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      numberTextDataName: 'numberTextData',
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4v = script$4v;
/* template */
var __vue_render__$4v = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-seventh-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-suptitle-box" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.numberTextDataName],
                  "block-data-name": _vm.numberTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container-left",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "paragraph-row-box" }, [
            _c(
              "div",
              { staticClass: "paragraph-subtitle-box" },
              [
                _c("div", { staticClass: "subtitle-left-dec" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                    "block-data-name": _vm.titleTextDataName2,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-body-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "paragraph-subtitle-box" },
              [
                _c("div", { staticClass: "subtitle-left-dec" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName3],
                    "block-data-name": _vm.titleTextDataName3,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-body-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName2],
                    "block-data-name": _vm.bodyTextDataName2,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4v = [];
__vue_render__$4v._withStripped = true;

  /* style */
  const __vue_inject_styles__$4v = undefined;
  /* scoped */
  const __vue_scope_id__$4v = "data-v-7b17b9e0";
  /* module identifier */
  const __vue_module_identifier__$4v = undefined;
  /* functional template */
  const __vue_is_functional_template__$4v = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4v = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4v, staticRenderFns: __vue_staticRenderFns__$4v },
    __vue_inject_styles__$4v,
    __vue_script__$4v,
    __vue_scope_id__$4v,
    __vue_is_functional_template__$4v,
    __vue_module_identifier__$4v,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4u = {
  mixins: [singleGroupMixin],
  name: 'paragraphtenthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      numberTextDataName: 'numberTextData',
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4u = script$4u;
/* template */
var __vue_render__$4u = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-tenth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-suptitle-box" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.numberTextDataName],
                  "block-data-name": _vm.numberTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container-left",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "paragraph-row-box" }, [
            _c(
              "div",
              { staticClass: "paragraph-subtitle-box" },
              [
                _c("div", { staticClass: "subtitle-left-dec" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                    "block-data-name": _vm.titleTextDataName2,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-body-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4u = [];
__vue_render__$4u._withStripped = true;

  /* style */
  const __vue_inject_styles__$4u = undefined;
  /* scoped */
  const __vue_scope_id__$4u = "data-v-aaa45a2e";
  /* module identifier */
  const __vue_module_identifier__$4u = undefined;
  /* functional template */
  const __vue_is_functional_template__$4u = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4u = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4u, staticRenderFns: __vue_staticRenderFns__$4u },
    __vue_inject_styles__$4u,
    __vue_script__$4u,
    __vue_scope_id__$4u,
    __vue_is_functional_template__$4u,
    __vue_module_identifier__$4u,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4t = {
  mixins: [singleGroupMixin],
  name: 'paragraphThirdRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4t = script$4t;
/* template */
var __vue_render__$4t = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-third-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4t = [];
__vue_render__$4t._withStripped = true;

  /* style */
  const __vue_inject_styles__$4t = undefined;
  /* scoped */
  const __vue_scope_id__$4t = "data-v-4cfd54b1";
  /* module identifier */
  const __vue_module_identifier__$4t = undefined;
  /* functional template */
  const __vue_is_functional_template__$4t = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4t = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4t, staticRenderFns: __vue_staticRenderFns__$4t },
    __vue_inject_styles__$4t,
    __vue_script__$4t,
    __vue_scope_id__$4t,
    __vue_is_functional_template__$4t,
    __vue_module_identifier__$4t,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4s = {
  mixins: [singleGroupMixin],
  name: 'paragraphWaveRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$4s = script$4s;
/* template */
var __vue_render__$4s = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-wave-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-row-box" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "text-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                ],
                1
              ),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-row-box" },
            [
              _c(
                "div",
                { staticClass: "text-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName2],
                      "block-data-name": _vm.bodyTextDataName2,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle2" }),
                ],
                1
              ),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                  "block-data-name": _vm.titleTextDataName2,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-row-box" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName3],
                  "block-data-name": _vm.titleTextDataName3,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "text-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName3],
                      "block-data-name": _vm.bodyTextDataName3,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                ],
                1
              ),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4s = [];
__vue_render__$4s._withStripped = true;

  /* style */
  const __vue_inject_styles__$4s = undefined;
  /* scoped */
  const __vue_scope_id__$4s = "data-v-ba2ec304";
  /* module identifier */
  const __vue_module_identifier__$4s = undefined;
  /* functional template */
  const __vue_is_functional_template__$4s = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4s = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4s, staticRenderFns: __vue_staticRenderFns__$4s },
    __vue_inject_styles__$4s,
    __vue_script__$4s,
    __vue_scope_id__$4s,
    __vue_is_functional_template__$4s,
    __vue_module_identifier__$4s,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4r = {
  mixins: [singleGroupMixin],
  name: 'paragraphElevenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4r = script$4r;
/* template */
var __vue_render__$4r = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-eleven-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text" }, [
            _c("div", { staticClass: "boder-top" }, [
              _c("div", { staticClass: "boder-top-line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "boder-top-line2" }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "boder-bottom" }, [
              _c("div", { staticClass: "boder-bottom-line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "boder-bottom-line2" }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "boder-left" }, [
              _c("div", { staticClass: "boder-left-line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "boder-left-line2" }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "boder-right" }, [
              _c("div", { staticClass: "boder-right-line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "boder-right-line2" }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-container" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4r = [];
__vue_render__$4r._withStripped = true;

  /* style */
  const __vue_inject_styles__$4r = undefined;
  /* scoped */
  const __vue_scope_id__$4r = "data-v-bdc80304";
  /* module identifier */
  const __vue_module_identifier__$4r = undefined;
  /* functional template */
  const __vue_is_functional_template__$4r = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4r = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4r, staticRenderFns: __vue_staticRenderFns__$4r },
    __vue_inject_styles__$4r,
    __vue_script__$4r,
    __vue_scope_id__$4r,
    __vue_is_functional_template__$4r,
    __vue_module_identifier__$4r,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4q = {
  mixins: [singleGroupMixin],
  name: 'paragraphTwelveRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_paragraph_tweleve_bg_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAxCAYAAACs0jsDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QTQ0NEJDQjZBQ0Q5MTFFREI5RDRDMjIyNEY3MEMwRjUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QTQ0NEJDQjdBQ0Q5MTFFREI5RDRDMjIyNEY3MEMwRjUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBNDQ0QkNCNEFDRDkxMUVEQjlENEMyMjI0RjcwQzBGNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBNDQ0QkNCNUFDRDkxMUVEQjlENEMyMjI0RjcwQzBGNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pqfr0oYAAAHtSURBVHja7JlLKERRGMdnNPIo71JSFiIrC1FKbAYpVkpmKUrKQs1CsVFWNpqRhc3IQhYspBQWYmPJRh6xmw0pzGxclOf/q6vG15lJc+fMfKNz6tftfPfW/XXu+c7rur2BR1cmy4G//Fe9Mxj5YvfddM1xZUkxokbUiBpRI2pEjej/FvVIkMCKiTxqQYNU0XZIDuDqBfUgX5ooyU2ADqmfvhnMgW7JfXQSzIKCBM+8glsQBRY4TKdoEQgBX5z7JLUHdsAxiWL7YaW7RSvBJiVNHMElsAyxcCY/fQXYBq2Ke1tgGlzzzV26RWmYWVdIfoApMC8lmRZBF4tRvxuyu4KImWkYjCqy2WcnjIi5vg4EFPExJ5I6RBdAKYvRAL8qaVHSD/pY7AjMqB7+a7anukXz7FkntryAcfAuaZk3CBpZLAjOk21BHS2aC/wsdpPMWKlblNaSTYpxNCpNdITV78GKk8TRIVoFelhsAzxI29yRZElM/ROsSdyF9rL6GTiRJkoL4jYW27VXSKJEadysZrF9iQcQLYpsP5UoysfOCxCRKMpPNbS1phPRYlDDYlcJjmwyJkobtzIWC0tsUTpEKIyp02/BO52iHvslToulM5FSuXB+thEvSnP8WzaIXoInrX3053+405KKIShR+RZgACQqX9Suk5GsAAAAAElFTkSuQmCC";

var __$_require_static_images_leaflet_resource_enter_clover_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAASCAYAAAC9+TVUAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Mjg4QTIyRUVBQ0QzMTFFREI2MTJFMUY2MkYzNTBCNkIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Mjg4QTIyRUZBQ0QzMTFFREI2MTJFMUY2MkYzNTBCNkIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyODhBMjJFQ0FDRDMxMUVEQjYxMkUxRjYyRjM1MEI2QiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyODhBMjJFREFDRDMxMUVEQjYxMkUxRjYyRjM1MEI2QiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnzdDxEAAAGQSURBVHjajJJNKIRRFIa/GZM0SX5mY2GDkI2aEiXUzIYSyUIpGwthNZIaspAVkslCVrKxkZ2lECkyopGNGVmSyM9uhDGeq6O+7txpvree5s75zn3vveccVzqdtpSCkVdLUxlUQiGk4BkS++OlKT3RbWVKxabgGqJwAEcQg1MO8zsx8cEslGvxfGiEUX2Dx/CMd7iSDSZFndzkE2ayGJzBZsZNwAVz0AY7sAq7EIZ5W+49DFLYJLdvYD0BFTCtTJpsJyujHpUMC1AsZgnox+AWgyHWESiSPYtuMbGrVW7SDNUSO8QghkGI9brNQKneI/OgqwaO5blKwxhUqXEy5Ba4pSYmebT/wSx5f915McRvYEk6pfQILRAy5H4ok3NDG7tgUrr1Pztx6rLC7xgkbflxZXIip15IlwJwBwPQKYl1sEddfBitSfG3ZfDCrsCy6TWWXwrr1eLqZr0Y/eSa2DwZMq/hWzf0ORl71fJ2K7s6nJi8wQZ8G749wFauWVD6ghFQBayFEokpg0vq8aRv+BVgAPdmZWgTmMj6AAAAAElFTkSuQmCC";

/* script */
const __vue_script__$4q = script$4q;
var __vue_render__$4q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-twelve-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "left-top-img" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_paragraph_tweleve_bg_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "left-top-clover" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_clover_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "right-bottom-clover" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_clover_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "right-bottom-img" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_paragraph_tweleve_bg_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4q = [];
__vue_render__$4q._withStripped = true;

  /* style */
  const __vue_inject_styles__$4q = undefined;
  /* scoped */
  const __vue_scope_id__$4q = "data-v-bd6c843c";
  /* module identifier */
  const __vue_module_identifier__$4q = undefined;
  /* functional template */
  const __vue_is_functional_template__$4q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4q, staticRenderFns: __vue_staticRenderFns__$4q },
    __vue_inject_styles__$4q,
    __vue_script__$4q,
    __vue_scope_id__$4q,
    __vue_is_functional_template__$4q,
    __vue_module_identifier__$4q,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4p = {
  mixins: [singleGroupMixin],
  name: 'paragraphThirteenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4p = script$4p;
/* template */
var __vue_render__$4p = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-thirteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "text-border-top" }),
              _vm._v(" "),
              _c("div", { staticClass: "text-border-bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "text-border-left" }),
              _vm._v(" "),
              _c("div", { staticClass: "text-border-right" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4p = [];
__vue_render__$4p._withStripped = true;

  /* style */
  const __vue_inject_styles__$4p = undefined;
  /* scoped */
  const __vue_scope_id__$4p = "data-v-7b2d0c3f";
  /* module identifier */
  const __vue_module_identifier__$4p = undefined;
  /* functional template */
  const __vue_is_functional_template__$4p = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4p = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4p, staticRenderFns: __vue_staticRenderFns__$4p },
    __vue_inject_styles__$4p,
    __vue_script__$4p,
    __vue_scope_id__$4p,
    __vue_is_functional_template__$4p,
    __vue_module_identifier__$4p,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4o = {
  mixins: [singleGroupMixin],
  name: 'paragraphFourteenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4o = script$4o;
/* template */
var __vue_render__$4o = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-fourteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "right-image" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4o = [];
__vue_render__$4o._withStripped = true;

  /* style */
  const __vue_inject_styles__$4o = undefined;
  /* scoped */
  const __vue_scope_id__$4o = "data-v-e1e63cc4";
  /* module identifier */
  const __vue_module_identifier__$4o = undefined;
  /* functional template */
  const __vue_is_functional_template__$4o = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4o = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4o, staticRenderFns: __vue_staticRenderFns__$4o },
    __vue_inject_styles__$4o,
    __vue_script__$4o,
    __vue_scope_id__$4o,
    __vue_is_functional_template__$4o,
    __vue_module_identifier__$4o,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4n = {
  mixins: [singleGroupMixin],
  name: 'paragraphFifteenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4n = script$4n;
/* template */
var __vue_render__$4n = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-fifteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "top" }),
              _vm._v(" "),
              _c("div", { staticClass: "left" }),
              _vm._v(" "),
              _c("div", { staticClass: "bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "right" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4n = [];
__vue_render__$4n._withStripped = true;

  /* style */
  const __vue_inject_styles__$4n = undefined;
  /* scoped */
  const __vue_scope_id__$4n = "data-v-db81a63a";
  /* module identifier */
  const __vue_module_identifier__$4n = undefined;
  /* functional template */
  const __vue_is_functional_template__$4n = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4n = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4n, staticRenderFns: __vue_staticRenderFns__$4n },
    __vue_inject_styles__$4n,
    __vue_script__$4n,
    __vue_scope_id__$4n,
    __vue_is_functional_template__$4n,
    __vue_module_identifier__$4n,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4m = {
  mixins: [singleGroupMixin],
  name: 'paragraphGreentheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4m = script$4m;
/* template */
var __vue_render__$4m = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Greentheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "border-top" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-bg" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-right" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4m = [];
__vue_render__$4m._withStripped = true;

  /* style */
  const __vue_inject_styles__$4m = undefined;
  /* scoped */
  const __vue_scope_id__$4m = "data-v-dd1c4f00";
  /* module identifier */
  const __vue_module_identifier__$4m = undefined;
  /* functional template */
  const __vue_is_functional_template__$4m = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4m = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4m, staticRenderFns: __vue_staticRenderFns__$4m },
    __vue_inject_styles__$4m,
    __vue_script__$4m,
    __vue_scope_id__$4m,
    __vue_is_functional_template__$4m,
    __vue_module_identifier__$4m,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4l = {
  mixins: [singleGroupMixin],
  name: 'paragraphGreentheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4l = script$4l;
/* template */
var __vue_render__$4l = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Greentheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-bg" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4l = [];
__vue_render__$4l._withStripped = true;

  /* style */
  const __vue_inject_styles__$4l = undefined;
  /* scoped */
  const __vue_scope_id__$4l = "data-v-5445cbed";
  /* module identifier */
  const __vue_module_identifier__$4l = undefined;
  /* functional template */
  const __vue_is_functional_template__$4l = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4l = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4l, staticRenderFns: __vue_staticRenderFns__$4l },
    __vue_inject_styles__$4l,
    __vue_script__$4l,
    __vue_scope_id__$4l,
    __vue_is_functional_template__$4l,
    __vue_module_identifier__$4l,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4k = {
  mixins: [singleGroupMixin],
  name: 'paragraphGreentheme4Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4k = script$4k;
/* template */
var __vue_render__$4k = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Greentheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "body-text-bg1" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-bg2" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4k = [];
__vue_render__$4k._withStripped = true;

  /* style */
  const __vue_inject_styles__$4k = undefined;
  /* scoped */
  const __vue_scope_id__$4k = "data-v-72c0dc84";
  /* module identifier */
  const __vue_module_identifier__$4k = undefined;
  /* functional template */
  const __vue_is_functional_template__$4k = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4k = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4k, staticRenderFns: __vue_staticRenderFns__$4k },
    __vue_inject_styles__$4k,
    __vue_script__$4k,
    __vue_scope_id__$4k,
    __vue_is_functional_template__$4k,
    __vue_module_identifier__$4k,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4j = {
  mixins: [singleGroupMixin],
  name: 'paragraphGreentheme5Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4j = script$4j;
/* template */
var __vue_render__$4j = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Greentheme5-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "body-text-bg1" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "border-top" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-left" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-right" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-bg2" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4j = [];
__vue_render__$4j._withStripped = true;

  /* style */
  const __vue_inject_styles__$4j = undefined;
  /* scoped */
  const __vue_scope_id__$4j = "data-v-9b8cfa40";
  /* module identifier */
  const __vue_module_identifier__$4j = undefined;
  /* functional template */
  const __vue_is_functional_template__$4j = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4j = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4j, staticRenderFns: __vue_staticRenderFns__$4j },
    __vue_inject_styles__$4j,
    __vue_script__$4j,
    __vue_scope_id__$4j,
    __vue_is_functional_template__$4j,
    __vue_module_identifier__$4j,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4i = {
  mixins: [singleGroupMixin],
  name: 'paragraphYellowtheme1Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4i = script$4i;
/* template */
var __vue_render__$4i = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "border-top" }, [
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "border-bottom" }, [
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4i = [];
__vue_render__$4i._withStripped = true;

  /* style */
  const __vue_inject_styles__$4i = undefined;
  /* scoped */
  const __vue_scope_id__$4i = "data-v-23162926";
  /* module identifier */
  const __vue_module_identifier__$4i = undefined;
  /* functional template */
  const __vue_is_functional_template__$4i = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4i = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4i, staticRenderFns: __vue_staticRenderFns__$4i },
    __vue_inject_styles__$4i,
    __vue_script__$4i,
    __vue_scope_id__$4i,
    __vue_is_functional_template__$4i,
    __vue_module_identifier__$4i,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4h = {
  mixins: [singleGroupMixin],
  name: 'paragraphYellowtheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4h = script$4h;
/* template */
var __vue_render__$4h = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "block1" }),
            _vm._v(" "),
            _c("div", { staticClass: "block2" }),
            _vm._v(" "),
            _c("div", { staticClass: "block3" }),
            _vm._v(" "),
            _c("div", { staticClass: "block4" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4h = [];
__vue_render__$4h._withStripped = true;

  /* style */
  const __vue_inject_styles__$4h = undefined;
  /* scoped */
  const __vue_scope_id__$4h = "data-v-13bb479c";
  /* module identifier */
  const __vue_module_identifier__$4h = undefined;
  /* functional template */
  const __vue_is_functional_template__$4h = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4h = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4h, staticRenderFns: __vue_staticRenderFns__$4h },
    __vue_inject_styles__$4h,
    __vue_script__$4h,
    __vue_scope_id__$4h,
    __vue_is_functional_template__$4h,
    __vue_module_identifier__$4h,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4g = {
  mixins: [singleGroupMixin],
  name: 'paragraphYellowtheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4g = script$4g;
/* template */
var __vue_render__$4g = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "right-img" }, [_c("div")]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4g = [];
__vue_render__$4g._withStripped = true;

  /* style */
  const __vue_inject_styles__$4g = undefined;
  /* scoped */
  const __vue_scope_id__$4g = "data-v-4e32752e";
  /* module identifier */
  const __vue_module_identifier__$4g = undefined;
  /* functional template */
  const __vue_is_functional_template__$4g = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4g = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4g, staticRenderFns: __vue_staticRenderFns__$4g },
    __vue_inject_styles__$4g,
    __vue_script__$4g,
    __vue_scope_id__$4g,
    __vue_is_functional_template__$4g,
    __vue_module_identifier__$4g,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4f = {
  mixins: [singleGroupMixin],
  name: 'paragraphYellowtheme4Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4f = script$4f;
/* template */
var __vue_render__$4f = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "block1" }),
            _vm._v(" "),
            _c("div", { staticClass: "block2" }),
            _vm._v(" "),
            _c("div", { staticClass: "block3" }),
            _vm._v(" "),
            _c("div", { staticClass: "block4" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4f = [];
__vue_render__$4f._withStripped = true;

  /* style */
  const __vue_inject_styles__$4f = undefined;
  /* scoped */
  const __vue_scope_id__$4f = "data-v-8f51ada0";
  /* module identifier */
  const __vue_module_identifier__$4f = undefined;
  /* functional template */
  const __vue_is_functional_template__$4f = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4f = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4f, staticRenderFns: __vue_staticRenderFns__$4f },
    __vue_inject_styles__$4f,
    __vue_script__$4f,
    __vue_scope_id__$4f,
    __vue_is_functional_template__$4f,
    __vue_module_identifier__$4f,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4e = {
  mixins: [singleGroupMixin],
  name: 'paragraphYellowtheme5Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4e = script$4e;
/* template */
var __vue_render__$4e = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme5-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "left-img" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-img" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4e = [];
__vue_render__$4e._withStripped = true;

  /* style */
  const __vue_inject_styles__$4e = undefined;
  /* scoped */
  const __vue_scope_id__$4e = "data-v-d41cbb6c";
  /* module identifier */
  const __vue_module_identifier__$4e = undefined;
  /* functional template */
  const __vue_is_functional_template__$4e = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4e = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4e, staticRenderFns: __vue_staticRenderFns__$4e },
    __vue_inject_styles__$4e,
    __vue_script__$4e,
    __vue_scope_id__$4e,
    __vue_is_functional_template__$4e,
    __vue_module_identifier__$4e,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4d = {
  mixins: [singleGroupMixin],
  name: 'paragraphRedtheme1Render',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4d = script$4d;
/* template */
var __vue_render__$4d = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4d = [];
__vue_render__$4d._withStripped = true;

  /* style */
  const __vue_inject_styles__$4d = undefined;
  /* scoped */
  const __vue_scope_id__$4d = "data-v-742d977e";
  /* module identifier */
  const __vue_module_identifier__$4d = undefined;
  /* functional template */
  const __vue_is_functional_template__$4d = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4d = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4d, staticRenderFns: __vue_staticRenderFns__$4d },
    __vue_inject_styles__$4d,
    __vue_script__$4d,
    __vue_scope_id__$4d,
    __vue_is_functional_template__$4d,
    __vue_module_identifier__$4d,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4c = {
  mixins: [singleGroupMixin],
  name: 'paragraphRedtheme2Render',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4c = script$4c;
/* template */
var __vue_render__$4c = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "left-line" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-line" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4c = [];
__vue_render__$4c._withStripped = true;

  /* style */
  const __vue_inject_styles__$4c = undefined;
  /* scoped */
  const __vue_scope_id__$4c = "data-v-7c44c2bc";
  /* module identifier */
  const __vue_module_identifier__$4c = undefined;
  /* functional template */
  const __vue_is_functional_template__$4c = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4c = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4c, staticRenderFns: __vue_staticRenderFns__$4c },
    __vue_inject_styles__$4c,
    __vue_script__$4c,
    __vue_scope_id__$4c,
    __vue_is_functional_template__$4c,
    __vue_module_identifier__$4c,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4b = {
  mixins: [singleGroupMixin],
  name: 'paragraphRedtheme3Render',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4b = script$4b;
/* template */
var __vue_render__$4b = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "top-line" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "bottom-line" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4b = [];
__vue_render__$4b._withStripped = true;

  /* style */
  const __vue_inject_styles__$4b = undefined;
  /* scoped */
  const __vue_scope_id__$4b = "data-v-7d8d8d48";
  /* module identifier */
  const __vue_module_identifier__$4b = undefined;
  /* functional template */
  const __vue_is_functional_template__$4b = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4b = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4b, staticRenderFns: __vue_staticRenderFns__$4b },
    __vue_inject_styles__$4b,
    __vue_script__$4b,
    __vue_scope_id__$4b,
    __vue_is_functional_template__$4b,
    __vue_module_identifier__$4b,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$4a = {
  mixins: [singleGroupMixin],
  name: 'paragraphRedtheme4Render',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$4a = script$4a;
/* template */
var __vue_render__$4a = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-title" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4a = [];
__vue_render__$4a._withStripped = true;

  /* style */
  const __vue_inject_styles__$4a = undefined;
  /* scoped */
  const __vue_scope_id__$4a = "data-v-41e6898e";
  /* module identifier */
  const __vue_module_identifier__$4a = undefined;
  /* functional template */
  const __vue_is_functional_template__$4a = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4a = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4a, staticRenderFns: __vue_staticRenderFns__$4a },
    __vue_inject_styles__$4a,
    __vue_script__$4a,
    __vue_scope_id__$4a,
    __vue_is_functional_template__$4a,
    __vue_module_identifier__$4a,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$49 = {
  mixins: [singleGroupMixin],
  name: 'paragraphRedtheme5Render',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$49 = script$49;
/* template */
var __vue_render__$49 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme5-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-box" }, [
            _c(
              "div",
              { staticClass: "body-text-bg" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$49 = [];
__vue_render__$49._withStripped = true;

  /* style */
  const __vue_inject_styles__$49 = undefined;
  /* scoped */
  const __vue_scope_id__$49 = "data-v-ed711b42";
  /* module identifier */
  const __vue_module_identifier__$49 = undefined;
  /* functional template */
  const __vue_is_functional_template__$49 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$49 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$49, staticRenderFns: __vue_staticRenderFns__$49 },
    __vue_inject_styles__$49,
    __vue_script__$49,
    __vue_scope_id__$49,
    __vue_is_functional_template__$49,
    __vue_module_identifier__$49,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$48 = {
  mixins: [singleGroupMixin],
  name: 'paragraphRedtheme6Render',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$48 = script$48;
/* template */
var __vue_render__$48 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme6-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$48 = [];
__vue_render__$48._withStripped = true;

  /* style */
  const __vue_inject_styles__$48 = undefined;
  /* scoped */
  const __vue_scope_id__$48 = "data-v-4ee08bf9";
  /* module identifier */
  const __vue_module_identifier__$48 = undefined;
  /* functional template */
  const __vue_is_functional_template__$48 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$48 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$48, staticRenderFns: __vue_staticRenderFns__$48 },
    __vue_inject_styles__$48,
    __vue_script__$48,
    __vue_scope_id__$48,
    __vue_is_functional_template__$48,
    __vue_module_identifier__$48,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$47 = {
  mixins: [singleGroupMixin],
  name: 'paragraphSixteenRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      numberTextDataName: 'numberTextData',
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$47 = script$47;
/* template */
var __vue_render__$47 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-sixteen-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "paragraph-row-box" }, [
            _c(
              "div",
              { staticClass: "paragraph-subtitle-box" },
              [
                _c("div", { staticClass: "subtitle-left-dec" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName3],
                    "block-data-name": _vm.titleTextDataName3,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-body-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName2],
                    "block-data-name": _vm.bodyTextDataName2,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$47 = [];
__vue_render__$47._withStripped = true;

  /* style */
  const __vue_inject_styles__$47 = undefined;
  /* scoped */
  const __vue_scope_id__$47 = "data-v-7d4ab5dc";
  /* module identifier */
  const __vue_module_identifier__$47 = undefined;
  /* functional template */
  const __vue_is_functional_template__$47 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$47 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$47, staticRenderFns: __vue_staticRenderFns__$47 },
    __vue_inject_styles__$47,
    __vue_script__$47,
    __vue_scope_id__$47,
    __vue_is_functional_template__$47,
    __vue_module_identifier__$47,
    false,
    undefined,
    undefined,
    undefined
  );

var Left = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAbCAYAAACJISRoAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OEZERjBFNTUxMzJCMTFFRThFM0M5RDlDNDZFMDJEQjAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OEZERjBFNTYxMzJCMTFFRThFM0M5RDlDNDZFMDJEQjAiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4RkRGMEU1MzEzMkIxMUVFOEUzQzlEOUM0NkUwMkRCMCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4RkRGMEU1NDEzMkIxMUVFOEUzQzlEOUM0NkUwMkRCMCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Plhysp0AAAIfSURBVHjatJU7T1VBEMd3D/deeXmNhbw1hIRPYImaKEhpY6GJUFD7AWjUCKGgNSaQEBKMjYWJMXY0JBCgsbEyUBiNhdKY8BS4Isf/mP8Jw3oeey7XSX7Ze2d2d3ZnZufYxbG2S8aYXnBk/KQObIGP8ufGk+9/lUvj7Q8xPAcWOqsXFMAdMGvyySroc3SWfHEnF2gQ+QTWQJCwcQia5fBqjWs3cQcuKOMLMJFxgx4exua5duA4zJKixxyb5sRHfnL8HWM74HgYF6646hkBUnXHSi+/W/n7MhhlVRlW5nXaBqA7VnvbJCePwZWUG4ltMsE2SDLzIFevgEdgk2GVEHWCp+CzciI5+AVug/vgHXgLSllOAi6cAntK30Un38CM8xgtnSxDN+ebeFl03tE1q5C6Us/xXFp1RVVRYZLl/ew483c9qsukVddVcI9voUzbMHMSSQfHFoYmqi4T02ZOOYke2F2iZTphnTTUV74PVpx84GZHKt4PQBN4ycRbhu8iGAIb4LXzwkM6WPknuWj1cadZZ7m2qTxEj/ArN7qmq8u3d0VSot6qaoqkKaW6cjmpqM6879j2TRUiObmpelTImzTyALfAD95K5nQ73w5vJwsp9jcJ+oa8Tgw/me8Za6GfG80zRIHTjdfyOLFheHJz9bDW2adEsZ22QbXVVVT6BlMDCTI+n/Z/Oam5JDkpqzI+s8R9tKSNPwMXYlp9VfJHgAEAjWxw8vlaPHgAAAAASUVORK5CYII=";

//
var script$46 = {
  mixins: [singleGroupMixin],
  name: 'paragraphSanQintheme1Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      groupData: {},
      Left: Left
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$46 = script$46;
/* template */
var __vue_render__$46 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-SanQintheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-SanQintheme1-title" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("el-image", {
                staticClass: "left-top-image",
                attrs: { src: _vm.Left },
              }),
              _vm._v(" "),
              _c("el-image", {
                staticClass: "left-bottom-image",
                attrs: { src: _vm.Left },
              }),
              _vm._v(" "),
              _c("el-image", {
                staticClass: "right-top-image",
                attrs: { src: _vm.Left },
              }),
              _vm._v(" "),
              _c("el-image", {
                staticClass: "right-bottom-image",
                attrs: { src: _vm.Left },
              }),
              _vm._v(" "),
              _c("div", { staticClass: "top-line" }),
              _vm._v(" "),
              _c("div", { staticClass: "bottom-line" }),
              _vm._v(" "),
              _c("div", { staticClass: "right-line" }),
              _vm._v(" "),
              _c("div", { staticClass: "left-line" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$46 = [];
__vue_render__$46._withStripped = true;

  /* style */
  const __vue_inject_styles__$46 = undefined;
  /* scoped */
  const __vue_scope_id__$46 = "data-v-c21e6f1e";
  /* module identifier */
  const __vue_module_identifier__$46 = undefined;
  /* functional template */
  const __vue_is_functional_template__$46 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$46 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$46, staticRenderFns: __vue_staticRenderFns__$46 },
    __vue_inject_styles__$46,
    __vue_script__$46,
    __vue_scope_id__$46,
    __vue_is_functional_template__$46,
    __vue_module_identifier__$46,
    false,
    undefined,
    undefined,
    undefined
  );

var Icon$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAA8CAYAAABb5PswAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RTUyQjM3NjQxMzM5MTFFRTkxRENFOTE0MUZCRUI2MDEiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RTUyQjM3NjUxMzM5MTFFRTkxRENFOTE0MUZCRUI2MDEiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpFNTJCMzc2MjEzMzkxMUVFOTFEQ0U5MTQxRkJFQjYwMSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpFNTJCMzc2MzEzMzkxMUVFOTFEQ0U5MTQxRkJFQjYwMSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkiCyOIAAAP4SURBVHjaVFVNjxtFEK2q7rExTvAuKwIRYDYKHwpIgRxClr9Abkj8iRy5gEDiB/AbIJE4QiQUThEScOAUIRACbUQ2WQTZiAV2cSDYY9kzXU1Vdfc4sXe84+nq915VvS67y598AK9tvQTffb/76Hg8fmc4HF4YjdbatdHRnY8vvRs95NdkMnnr8PDgPb0nojdOn37uTFX5nwiRe8ePr8OJzWPDEszMdP71c33nK/BVj/zGxujI2bMnNyqPMBx4mNYNPLZRPe/cct8v/528fXP79ptbTw+e3XryFBAgRESE33+7OFkbfOrrOzffP/hlHwgj6FtfMUZol21/ePDni37ZBHAOwDvdy8C6GBQFoGkXlYfIohqhXxFU5CAww2zRQGiDYIWalE4+oBIE5yNIVrKHZbcEcJhSzJyyIndoFIEjNEGeBW4o4kqYvYU8yGIIgtQwmAaFZA6aoOxkEZlQYghCr5kTgWbI8hAFiWWTIQgfOdcHFYqEqcxgsek/R6TqyLqmI0GULwQniJq6cAo+B8gqbTHdl7Yh+MCtFSVUWkkw7ja02lGhCNGTxqFCkm11LlEYmlSQVEzJAqUmlJCtbrIcPYoGVhqWTKLepwgjlKp5dF7gvUA720WeV931LlI2WecF9UVqoNBVhJ4jdmmy9ScRWEpgmoQ3sJXZ+qKBnL/LE7J8Y0zVMeVo2WjpJTuk1Ac7C6nMUIISNUVrdzQUtQYbRdKkyomgOy5mVLKGxdQPBeeyHrHzQoG3ymJM+Su0oWYLEhUNmEubTWMCs4QUCKmLXRbFE5Y2iWnLouzWViuVc7n9+sfm1mipQszYud1qTNKTo7XQb6p6VdQs0sqYTaIoRQEnlTqCZKdyaotVskspGoVLrjPliK7jdpTSlkKL6dAmSq5a2hm7hsnJoqIhm6Q0LtcJqRjUPACZOztMT7pkybkx6ailUZEDOaZSF1siZOOUekXVJZYvHU1IkLKyLxwpNLW1DLNRtCd2CJKjkJbzqW0z68UsgnNbIDmsgzar2VDAVE2bPzEdXEN8QAtaKwkfOM3YBSVfytFbjRNKQdq88kiGaq4v2ISF+9GyAyiZ5X4Nq4bpWfI6F2z8t9EGqc6oUFY1i4dHR+9Sv7Ipr9O15RVV1fMLakbj80+9eu7CHvd++Gb3ELb/quWawhOnnrl8bPz4R77X4+uPrPe2f7w1OfPl1zuvDAZ9WC4afuHlkx/2Hqq+9cLT3v17Ptvbm9TzOkDbLKCRX6F7/7X3msb94+/c9vPJZAo/39g3cl1Uidd36nbzxDrTbAa8c+sPWCya7kdW/Xz1i2u0++sB+Gk9g8+uXNWHl+TalGss17W6nt+48vlX8L8AAwDOGiR0ANbDwwAAAABJRU5ErkJggg==";

//
var script$45 = {
  mixins: [singleGroupMixin],
  name: 'paragraphSanQintheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      groupData: {},
      Icon: Icon$1
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$45 = script$45;
/* template */
var __vue_render__$45 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-SanQintheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-SanQintheme2-title" },
            [
              _c("el-image", {
                staticClass: "left-image",
                attrs: { src: _vm.Icon },
              }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "text-container-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("el-image", {
                staticClass: "right-image",
                attrs: { src: _vm.Icon },
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$45 = [];
__vue_render__$45._withStripped = true;

  /* style */
  const __vue_inject_styles__$45 = undefined;
  /* scoped */
  const __vue_scope_id__$45 = "data-v-1c5dd8e0";
  /* module identifier */
  const __vue_module_identifier__$45 = undefined;
  /* functional template */
  const __vue_is_functional_template__$45 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$45 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$45, staticRenderFns: __vue_staticRenderFns__$45 },
    __vue_inject_styles__$45,
    __vue_script__$45,
    __vue_scope_id__$45,
    __vue_is_functional_template__$45,
    __vue_module_identifier__$45,
    false,
    undefined,
    undefined,
    undefined
  );

var Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAA3CAYAAACYV8NnAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDkwQ0JBM0QxMzM1MTFFRUJFQURCMzkxQzE4OTQ5RjAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDkwQ0JBM0UxMzM1MTFFRUJFQURCMzkxQzE4OTQ5RjAiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpEOTBDQkEzQjEzMzUxMUVFQkVBREIzOTFDMTg5NDlGMCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpEOTBDQkEzQzEzMzUxMUVFQkVBREIzOTFDMTg5NDlGMCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgCsdJgAAAOLSURBVHja1JpJaBNRGMffvKRat2prVRTqVlxQsdQFlYJxuYioSMFDD+LdgwpeFEEqFrxJr4IXL4IIBRdED0KLaKEutUVUPAgiilvVurdZxv+X/McMkrSZ5E3C++DHJM2bN/+8fPMtb+oMdR8+q5RaBqrBKIgAF6SIvHZAAlSBOJjAo/aN8cZr3xg5JwqSKmP+sUnffN4x11jvtcz3HfTLoBhYo+yxW7IqX8CIJYJlpYc1f3pbLK1V04dtES4+ntB0fNcS0embXXO1bXKRlP4vtNjg045tq+za6B6iU2tll8lKu95KWyVcM9/b5B6OCJ7IgkUxpQ+Ct3w/D6wFU8ss7gl4Q3eYA1ZQpyTCiIi+DxpAN7jEEz7y5FlgJdgP9pZBbC+4SE0fKHomRe8DW+VvDkrTJXixHPSB93kmky91DBwMUXAXOFUX6xzM9eHnniPzcdgCXovoQiedAS6D7YbvAVnNftAKwa8KOSFI5PgKTtLvTdpP0FGo4KCiPZ97ZjDtyzzPwbUgJxUTo/vZRpkwae9uY5UTYYt+xyLLlOiBoCcVI/q3QfdI+cJrqKLrDKZ+19d9hyp6FTOTCYsweYQquhasNihaUnNL2KIlnc81GKNlA2Ynsl19WKLFLQ5xdUxao6TvoKKlwmsCs8cYJ6n7PC9guowVVzuA1T4DJuUbhM9qQU26PkXt0Y7jboafe+ARS1O5sxeBTWAzBYdpsst1F9xgAhvmr7oYbATrwUvQLqXpLpXdy2sGQ+AXRU8D9ao8JgK3gXXgk8pucNawRNb8An1RukfSK7DHcZNyWA3JZw3etqwtJvdT1Ma9vLhtO0zK1h2mpI370442WBuXdaUjlq22dVti/25EbaN7aMs8o0pzE8YW4ZNBtdQeR8FCCnd9XUlUZZ+mprxw4xuTYEPQxi8exHrAQ87rBQLvV/eeDI+wSUj6SmhpqntFWBcF5oqJ7jiRJc52aXqBEUjGXwDHwR/fdfL5r5NDT9xbzWKLpraAjYFc5zpLz0xrH+ssa8iTLuMEmBKwS2mqZJxuYWcTxMQvd1RSdHOee2G86y0FCyolerTIklYiQl2lRA8UKdoptUgrRbR0zk+LED7ErroioiV8dQQULYnjisr8s0nFqryrFF6oPQi6mxSGaEmxp1XmcdnjMcb9AOfAHtksKlV0VJVuCZYCN8EG7gQ1cu5v9Ps74IUy9NjjrwADAJTZ3NG+K85NAAAAAElFTkSuQmCC";

//
var script$44 = {
  mixins: [singleGroupMixin],
  name: 'paragraphSanQintheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      groupData: {},
      Icon: Icon
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$44 = script$44;
/* template */
var __vue_render__$44 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-SanQintheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "top-image" },
            [_c("el-image", { attrs: { src: _vm.Icon } })],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$44 = [];
__vue_render__$44._withStripped = true;

  /* style */
  const __vue_inject_styles__$44 = undefined;
  /* scoped */
  const __vue_scope_id__$44 = "data-v-74bef240";
  /* module identifier */
  const __vue_module_identifier__$44 = undefined;
  /* functional template */
  const __vue_is_functional_template__$44 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$44 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$44, staticRenderFns: __vue_staticRenderFns__$44 },
    __vue_inject_styles__$44,
    __vue_script__$44,
    __vue_scope_id__$44,
    __vue_is_functional_template__$44,
    __vue_module_identifier__$44,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$43 = {
  mixins: [singleGroupMixin],
  name: 'paragraphThirtyfiveRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$43 = script$43;
/* template */
var __vue_render__$43 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Thirtyfive-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c(
                "div",
                { staticClass: "left-image" },
                [
                  _c("xml-image-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                      "block-data-name": _vm.imageBlockDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "show-title": false,
                      "container-class": "image-container",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                    },
                    on: { blockclick: _vm.handleBlockClick },
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "icon-box" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$43 = [];
__vue_render__$43._withStripped = true;

  /* style */
  const __vue_inject_styles__$43 = undefined;
  /* scoped */
  const __vue_scope_id__$43 = "data-v-78c663c9";
  /* module identifier */
  const __vue_module_identifier__$43 = undefined;
  /* functional template */
  const __vue_is_functional_template__$43 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$43 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$43, staticRenderFns: __vue_staticRenderFns__$43 },
    __vue_inject_styles__$43,
    __vue_script__$43,
    __vue_scope_id__$43,
    __vue_is_functional_template__$43,
    __vue_module_identifier__$43,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$42 = {
  mixins: [singleGroupMixin],
  name: 'paragraphThirtysixRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$42 = script$42;
/* template */
var __vue_render__$42 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Thirtysix-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c(
                "div",
                { staticClass: "left-image" },
                [
                  _c("xml-image-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                      "block-data-name": _vm.imageBlockDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "show-title": false,
                      "container-class": "image-container",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                    },
                    on: { blockclick: _vm.handleBlockClick },
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "icon-box" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$42 = [];
__vue_render__$42._withStripped = true;

  /* style */
  const __vue_inject_styles__$42 = undefined;
  /* scoped */
  const __vue_scope_id__$42 = "data-v-27b6c181";
  /* module identifier */
  const __vue_module_identifier__$42 = undefined;
  /* functional template */
  const __vue_is_functional_template__$42 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$42 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$42, staticRenderFns: __vue_staticRenderFns__$42 },
    __vue_inject_styles__$42,
    __vue_script__$42,
    __vue_scope_id__$42,
    __vue_is_functional_template__$42,
    __vue_module_identifier__$42,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$41 = {
  mixins: [singleGroupMixin],
  name: 'paragraphThirtysevenRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_title_icon5_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAAArCAYAAADhXXHAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MEY2RDg3QTAzOTExMTFFRkE0MTVDMjI1MTc5NzBCNDMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MEY2RDg3QTEzOTExMTFFRkE0MTVDMjI1MTc5NzBCNDMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowRjZEODc5RTM5MTExMUVGQTQxNUMyMjUxNzk3MEI0MyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDowRjZEODc5RjM5MTExMUVGQTQxNUMyMjUxNzk3MEI0MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqOpO40AAAYSSURBVHjavFlpbFVFFH59VrBgES2IUYosKlFRS2g1IGqN+xKWkqqIxRJU3MW4hJoYFRqXwA+VqixBqNAiFYwo1lDBRlDUgqKijcEFwaXQKouibS2P53eSb8xhnHnv3r4XTvLlzrtz78y5Z87yzbyM8k2fRFKUDOBWYBowwOr7B/gYuAf4MtWJopHU5V5grkNRkS7AhcB6YGCqE2WmQdkHeG0FVgMdqu9E4HygB61fdjiU7cbr346+XF7fBG6w+o4ADrDdzzN2L+APukxKbnAysJaD/QmsAwap/q6qHXO8H/M8KzIe+BloAfYAT/HjOmVZ8cF6KmzkAuB94CbgcmByiFUcBzQALwLdgdkMTrNyEqB9gVLPh3uVtRX9AIhT2ZPYZ8tHnrEk3ZzHdgGwUPUd5O8xQA6NEPEp7HKDvpaiq2nFS4G3rWdlGcuBPKDCo+xFwCigyvJLUeYW4jLgd94XhV9WVk+obLWl6FhGukxUBFQCnwJ30H8fBb5IsPztwFtUYhA/qhG4WVl5s6XwRGaPQxO6VRROAJrUsl5CRQ+XDKXbHAm8x/m9Ppth+VMsxEQSyYPp790Y5VuBX0OMcYCxEQniBk0qUCSZv84qlEjOoo+Jcl8Dq4Aa+v0vvCfF4Jgk45zJNGnmWxHEZydyEpFrWEp9hULS0OfAJOBYz3NnAE8C3zmKhpHjuOy9+fs1YE6Q1CWDlvBlkbMdz8ig7wDD1L3vGUhCWPYzxRUwExzNSrUUOMdRdiVWjmd7B3Bj0NQVYWQaqXBYVCsq6asYOBWYAfxIZSXpTyA/mKXKriT/R6wxG5nLTVk+LWi57aIq00/AYqt/llJ0EyN4C7Ac2MUVqWVKi7BMPwRcpbjFdGCkNe4Tqn2nT9kM0rztjMR2tSTVyiImmKawLX59NZAPbGQO1m4Vt+ZaQ982mWO2FfFraRyRu/h+By1eYJQVRZ/zsKIa6/d9ajXuZ1BJ1GbzntT+qcAVdAnXeG+wLVXvYuvjahwxJVnpXUmJmRzc0L9aZZEPgc+sPDqO7W1c9uWKPop7POywaMThRmPYLlaBLPIMx+ulArmQaW+yKNufHZIfr08wiZTKnmyvpFVHKYsGUdQYoYWKDLP6Wix/zVRkvn/Uqh6JJFe1t3AZjY9WBVRUv29IU7KK9l91DbMH66HabRaZ3hqSA7Q6xkzrHqxJtSVbLGMKijEAwkgfXn8Lq2wHWU4uc6xvL7RDtQuo5GOdYFZHAUMCrsgpelsfZXCYLUs7fU+wwSIxwp6+YXt02CVUUkSFTW7VMhzYrXT4VvU1RJkv9zsGlRevte5V8trdUTKDWrVcHYC84tjWuwiRGG5hlNVHIvtp+uFK9VCx9dIcpheRB1lCw8g8dRiyyIqDbFZEkZ1kXotZzYSEt2UqxqSZ0Ffkl6PJiHby/l5WsWoWiRXc3NUkUTKLdLKEv5tJaLRM4XMiz3NrHoh1VahJbDq3lKtg+peRpA/3KFlC2lhqUcwi69lCldYWhEld+v6Vjv4ylufH+cFjCbNb2MuEP0QFk7FobxKY+bxnFJtgOADLa3MQy47nMpjt8nTPB80gEdlsWayQtT9fKdpB5QZz1xpXChs6uo88ehv5Qp9kyoofPsuBYhy4KoEvrmN9l0le4hZnN5dS6F4dV0H4x220+IIACkvg3Z7MDfopLrvEOj3xSZxcdU2IrGCWfr7DJUThc4PsFJpZGCLMsXmezd3paTgjcFm4NMwp4l/KX3NorTxru9xIrOeRUkZA5bKZm1epbbmt8MywR55lyk+NwkO5palXjj+S0budhDrHM8cI4FWW65nc3tdZCk8iqUkUH/87PtKBtkid6rXx67PUjtbmoi8AdzvG2qNIuxlLyvsPPPDbF9RvfEUhRv9Zomp6ltpHDeAx5jz1ju+Qo6eimNN46DeCW/S6dPHZGE9nZHd5HdNRLfnBQbK1BqakIFLPPZYJ5HxXekqFfMd5fDQ3ydYjk5bqqrKJ/T9Ch/XeLuusoNNuEEYaVG1vU1w0zuCzn+u0pEPZqTx1SSQbeNKYkqTjf7CNPLyTfDkwcug/Lq1UtJJWT0n+FWAAyL17smFntQsAAAAASUVORK5CYII=";

/* script */
const __vue_script__$41 = script$41;
var __vue_render__$41 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Thirtyseven-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "sub-title" },
            [
              _c("div", { staticClass: "icon-box" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_title_icon5_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "body-text",
              class: !_vm.isFold ? "body-text-fold" : "",
            },
            [
              _c("div", { staticClass: "border-top" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-right" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-left" }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "seemore", on: { click: _vm.changepanel } },
                [
                  _c("span", [
                    _vm._v(_vm._s(!_vm.isFold ? "查看更多" : "折叠")),
                  ]),
                  _vm._v(" "),
                  !_vm.isFold
                    ? _c("i", { staticClass: "el-icon-d-arrow-left down" })
                    : _c("i", { staticClass: "el-icon-d-arrow-left up" }),
                ]
              ),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "icon-box" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$41 = [];
__vue_render__$41._withStripped = true;

  /* style */
  const __vue_inject_styles__$41 = undefined;
  /* scoped */
  const __vue_scope_id__$41 = "data-v-0676d71a";
  /* module identifier */
  const __vue_module_identifier__$41 = undefined;
  /* functional template */
  const __vue_is_functional_template__$41 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$41 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$41, staticRenderFns: __vue_staticRenderFns__$41 },
    __vue_inject_styles__$41,
    __vue_script__$41,
    __vue_scope_id__$41,
    __vue_is_functional_template__$41,
    __vue_module_identifier__$41,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$40 = {
  mixins: [singleGroupMixin],
  name: 'paragraphThirtyseven2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_title_icon6_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAAAlCAYAAADbVxCwAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6M0U3QTk3QjAzOTExMTFFRkJFM0NGNThEREEwRTZGNzIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6M0U3QTk3QjEzOTExMTFFRkJFM0NGNThEREEwRTZGNzIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozRTdBOTdBRTM5MTExMUVGQkUzQ0Y1OEREQTBFNkY3MiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozRTdBOTdBRjM5MTExMUVGQkUzQ0Y1OEREQTBFNkY3MiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv+pvSYAAATdSURBVHjazJh5bBVVFMZfS1lFlsgWQQRaiQtQoSDSNIAmkhQiiyiKLcQNZRH4R6gQCWgqyBKCtmFJgEpZFTRKW4GwJAYIgpJKVCo0AQqkltBigVZbCjy+k3zXnFzntTNvpgkn+eXN3NnOO/ds98Zk/nI85FO6ggEgAfQAbcAD4C64Dq6AC+AP8CuojfZDcVE+lwwmglQQ7+G5GnAYfA+2g2tePhrr8Y+9BX4HR8H7HhUVaQFeANmgFGwCjwdt2VFgFafaSYo5xSWgHNykYuIO3UEvkATaqmeag8kgDeSAD0GFH2Vbg9VgkjUu/rgXfA1+AFddzuJAMBakg0c43gS8A8aAN0FBNG4g1vjZUvQWWMvpH8VpvOpyduQPngDzQU/wCvhNXe8I8sBCr8r2oV9qf5LASATTGN1+5A7YBfqD2aCK4zFgEQ0S40ZZ8cuDoAvPw3zBc+DPULAiSn8BBoHTavw9sLQhZVvwH3dSL5MM8DGPG0vECCmcTSNzmB4jKpvJqTYyE3ypzmXaMpj4tXQAc8ETPhT+m3Gg/Xgti87/lH2S/mNEgmeNOp/CAPkMDFPjSZxCmbapPi0sFW88U1+IRlnmpGyGSmVSImepa48xhUlETwf5KvXtYCSvBx8F4BLF1nsm0pD/KdsZvKZuWAxuWA+IYp/S2mGOP8OAPALeVRbxK2KYiypDTNPKjgPNeCxKbrQeNimsL91gCfuDBBWYS3jtjQCUvQ2y1PmroquZ9hHqQoHKeyHlOyIvq7Eh4CseDyRGdjm8w6tIdVyuCkafWBXlRn50+bImUV5zKxet4pMYp3pSI2cCzJ8P00WMXGbJbk+MSKtY6fD8GfbIIvFx7IyaqhucOp9wBGXC9Sj6NjOElkIwgW1mczX+L3N0iXW/1qWtKFvnogRv4Mt1vd7CfiHfst5Z5suECM1RF0tRkZbswmxlm6njujhOSxXbQeMSp6yHviNO8mIjluFO2sqxqjYb6Re6PyTWKv1FRtmf1GBqQB/7K0KXVcFK6HRNy7NqZSGxccIom69uSqFv+ZUsFhHJv8+rZqWI7ze5uYjXyq3ndXE5CcqMsgeVJWTsgwCUDTPqT6o8foy/JRwXa/Zm6jpnLe/T1Xmujnwpb59bHVZiAApL9lgHVjCQsy3LHWYBWWa5wVJmCDMbOXaakmm7pLqpraCVT2UfpIXKwEtA76ikMb8v0m0gm6Y0q8eusle3/4AZYDfPnwLb2OSEo1RWmqJHQTUTv5YxNEa5FS/rLV/NilQA8rgm0i8c5tO65Q6KGuNoRaWZ2qNm8zqtXFdftVrpsNxo7HyawW7PFKZauk1xQ5scyeq40loTBS0DOM36mzfpeofc7MikqOOjVgJ/mlF8mf5cGmWGGM7F6Fir3zjPNVih2+2jFGtjw6wUPmHzHaOWPvu5fXSM7Vx1BAW7sQDI3sNo1fZp2cx1X6Xbva523I0xcok5Lt3hXkk7I4kpAqX8WI3aK+uucqaTyBbVPBYmT7uI/a2gy3Xo+gu5zIl3mN6uViNf3xorn/sC+6Ld8rxSz/JEAm0B87BYcTDTzVBWu44NlN6z3Hc4wMiv8OrstrKyWbGTO3x6HS/bR9utYDtuVaSHaO127JaqmIJKuZaq8Zs6nALsdfAtI1+m/BtOW0NSEY21vMg9AQYAto0XA8CZObsAAAAASUVORK5CYII=";

/* script */
const __vue_script__$40 = script$40;
var __vue_render__$40 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Thirtyseven-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "sub-title" },
            [
              _c("div", { staticClass: "icon-box" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_title_icon6_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "body-text",
              class: !_vm.isFold ? "body-text-fold" : "",
            },
            [
              _c("div", { staticClass: "border-top" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-right" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-left" }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "seemore", on: { click: _vm.changepanel } },
                [
                  _c("span", [
                    _vm._v(_vm._s(!_vm.isFold ? "查看更多" : "折叠")),
                  ]),
                  _vm._v(" "),
                  !_vm.isFold
                    ? _c("i", { staticClass: "el-icon-d-arrow-left down" })
                    : _c("i", { staticClass: "el-icon-d-arrow-left up" }),
                ]
              ),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "icon-box" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$40 = [];
__vue_render__$40._withStripped = true;

  /* style */
  const __vue_inject_styles__$40 = undefined;
  /* scoped */
  const __vue_scope_id__$40 = "data-v-5095eb51";
  /* module identifier */
  const __vue_module_identifier__$40 = undefined;
  /* functional template */
  const __vue_is_functional_template__$40 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$40 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$40, staticRenderFns: __vue_staticRenderFns__$40 },
    __vue_inject_styles__$40,
    __vue_script__$40,
    __vue_scope_id__$40,
    __vue_is_functional_template__$40,
    __vue_module_identifier__$40,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3$ = {
  mixins: [singleGroupMixin],
  name: 'paragraphThirtyseven3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_title_icon7_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAlCAYAAADFniADAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NEQ5MkI2QTIzOTExMTFFRjhGNTJGMjU5M0IyNjYyN0MiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NEQ5MkI2QTMzOTExMTFFRjhGNTJGMjU5M0IyNjYyN0MiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0RDkyQjZBMDM5MTExMUVGOEY1MkYyNTkzQjI2NjI3QyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0RDkyQjZBMTM5MTExMUVGOEY1MkYyNTkzQjI2NjI3QyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgyuc50AAAQdSURBVHjazJgLaI1hGMe/Mwdr2BhzS3JZMpchyXWYGHOXWLnNvUhYIXKJcokScxmhaNiMYhIbidxis6a5ZrQQc537ZSOX/1v/tx6fc/m+s++Up37tfZ9955z/e3ue5/1cqwvyjACsDegIWoEIEAo+gGfgPshjPyBz23i2NZgJkkBjP8/+BOdAOsgCP+yICrHwTFN+8R2QYkGQsipgANgPisFYJ2dqOkgFYSb/S3AB3APPwW9QC0SDrqCDGHAzDmo8mArKAhWlRroFzBa+XyCbIi+z783UbCaDeaABfcNBPkjk7NlaPhfYaxJUBLqB0eCiH0HKSsE6zlwqZ1JZC3CJfluiVoKJop9OQdeFr7rF7fEZzAdDwSf66oMcUNuqqHiwVPS3gcmgnP1YfuFX0MXG3j0FEvg5gzO1y4ooNfo07idluRylnvo5oAAM4qw9sRl+rnGz6+8bwxn0KWoaY5HBE5LMeKNsCdgKvoFxoDtPoF3L5sC1rfe0hULE5k4R/lXgFdsjwBrwgmIyxWgDsWXgvcgMg72J6i1OxBuwh+2aYAf4DkaCu0blTQnaKfoTvIkaInyZXCYdPBuBTcxnTtk+0U4U+/gvUX2EL0e0nzBQbjCcNZW0S9gOZwb4R1SM8OWL9lEQB94ZzluBaMeYRUUwb+lgV2YEx+qZcuhj0W5iFhUu+u+CJMjFJTvg5bdqmkWVi35okETVAZGmCZC/VW4W9UEESfXhqkEQ1ZJ/HwlffVOY+EvUd7G+bhHVnbQEkWq0tRPtYk+nT564vg4LcjOFqcEfpy9MJHRVBhV6EnVW+JIcFjUXNAcHwWv6Rony54b5xGtRxzgSZT1tliW+TMW4tdwzK4R/jmhneUszb1nky+xdWRsGTnL5JoGn9I9k0Wgwne31VbqsF1chVezNCFBMW3CE+6cqE+4J/q8uSyBt21kAeL04PAAbwWL2N4ObFhJxLPdhFJe9I/23uMF1GV0NHBbRu5Qlkd/bjKrPB4JOPCGnWB1e9SEqhSWzDoK53AqHxAUjjNVHP3FZnWKOT95q9ApeHJ+zH8mb7iymCk+2gD/WjvlNlSIZQpCKe1d4xZIXilI7t5mHoD/fC+h0kMarVZyH59VxPs8b9Bfhj+LJKxJLqi2Cg21r59p+l6FBlhe9KOw290IPUV3oC2w0N3YGs8QS7iW9tGvEi48oDuYfYS4/b11UgFsOFoovN9sXxrjaPpb4Kl+O3Oa1/jRny2BAjedMW3rBUcFCXxVhu0WZLK0GE7knQYXcSz0oyOBpHuhrxkIsxp4SjrQhl2cfw4UU+Zvlcy4H0h50FjFKmk9hbpuB8SNz2EHTElfn/+xYHquHM1xKLSwuxIF0UhGAIHkfSDDN2CInRFXWtLAyboHLbuP/sHy+JlLB+tEfAQYAZSjxOOFdJ8EAAAAASUVORK5CYII=";

/* script */
const __vue_script__$3$ = script$3$;
var __vue_render__$3$ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Thirtyseven-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "sub-title" },
            [
              _c("div", { staticClass: "icon-box" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_title_icon7_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "body-text",
              class: !_vm.isFold ? "body-text-fold" : "",
            },
            [
              _c("div", { staticClass: "border-top" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-right" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-left" }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "seemore", on: { click: _vm.changepanel } },
                [
                  _c("span", [
                    _vm._v(_vm._s(!_vm.isFold ? "查看更多" : "折叠")),
                  ]),
                  _vm._v(" "),
                  !_vm.isFold
                    ? _c("i", { staticClass: "el-icon-d-arrow-left down" })
                    : _c("i", { staticClass: "el-icon-d-arrow-left up" }),
                ]
              ),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "icon-box" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3$ = [];
__vue_render__$3$._withStripped = true;

  /* style */
  const __vue_inject_styles__$3$ = undefined;
  /* scoped */
  const __vue_scope_id__$3$ = "data-v-68c8a414";
  /* module identifier */
  const __vue_module_identifier__$3$ = undefined;
  /* functional template */
  const __vue_is_functional_template__$3$ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3$ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3$, staticRenderFns: __vue_staticRenderFns__$3$ },
    __vue_inject_styles__$3$,
    __vue_script__$3$,
    __vue_scope_id__$3$,
    __vue_is_functional_template__$3$,
    __vue_module_identifier__$3$,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3_ = {
  mixins: [singleGroupMixin],
  name: 'paragraphThirtyeightRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

var __$_require_static_images_leaflet_resource_enter_paragraph_icon3_png__ = "data:image/png;base64,[encoded data, 12304 characters]";

var __$_require_static_images_leaflet_resource_enter_paragraph_icon4_png__ = "data:image/png;base64,[encoded data, 14284 characters]";

/* script */
const __vue_script__$3_ = script$3_;
var __vue_render__$3_ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Thirtyeight-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "sub-title" },
            [
              _c("div", { staticClass: "icon-box" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_paragraph_icon3_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "border-right" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_paragraph_icon4_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "border-left" }, [
                _c("img", {
                  attrs: {
                    src: __$_require_static_images_leaflet_resource_enter_paragraph_icon4_png__,
                    alt: "",
                  },
                }),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "icon-box" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3_ = [];
__vue_render__$3_._withStripped = true;

  /* style */
  const __vue_inject_styles__$3_ = undefined;
  /* scoped */
  const __vue_scope_id__$3_ = "data-v-786d6f82";
  /* module identifier */
  const __vue_module_identifier__$3_ = undefined;
  /* functional template */
  const __vue_is_functional_template__$3_ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3_ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3_, staticRenderFns: __vue_staticRenderFns__$3_ },
    __vue_inject_styles__$3_,
    __vue_script__$3_,
    __vue_scope_id__$3_,
    __vue_is_functional_template__$3_,
    __vue_module_identifier__$3_,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3Z = {
  mixins: [singleGroupMixin],
  name: 'paragraphFortyRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$3Z = script$3Z;
/* template */
var __vue_render__$3Z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Forty-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "top-image" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "bottom-image" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3Z = [];
__vue_render__$3Z._withStripped = true;

  /* style */
  const __vue_inject_styles__$3Z = undefined;
  /* scoped */
  const __vue_scope_id__$3Z = "data-v-5e526e60";
  /* module identifier */
  const __vue_module_identifier__$3Z = undefined;
  /* functional template */
  const __vue_is_functional_template__$3Z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3Z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3Z, staticRenderFns: __vue_staticRenderFns__$3Z },
    __vue_inject_styles__$3Z,
    __vue_script__$3Z,
    __vue_scope_id__$3Z,
    __vue_is_functional_template__$3Z,
    __vue_module_identifier__$3Z,
    false,
    undefined,
    undefined,
    undefined
  );

const ParagraphComponents = [__vue_component__$4B, __vue_component__$4A, __vue_component__$4z, __vue_component__$4y, __vue_component__$4x, __vue_component__$4w, __vue_component__$4v, __vue_component__$4u, __vue_component__$4t, __vue_component__$4s, __vue_component__$4r, __vue_component__$4q, __vue_component__$4p, __vue_component__$4o, __vue_component__$4n, __vue_component__$4m, __vue_component__$4l, __vue_component__$4k, __vue_component__$4j, __vue_component__$4i, __vue_component__$4h, __vue_component__$4g, __vue_component__$4f, __vue_component__$4e, __vue_component__$4d, __vue_component__$4c, __vue_component__$4b, __vue_component__$4a, __vue_component__$49, __vue_component__$48, __vue_component__$47, __vue_component__$46, __vue_component__$45, __vue_component__$44, __vue_component__$43, __vue_component__$42, __vue_component__$41, __vue_component__$40, __vue_component__$3$, __vue_component__$3_, __vue_component__$3Z];
var paragraph = {
  // install,
  ...ParagraphComponents
};

//
var script$3Y = {
  mixins: [singleGroupMixin],
  name: 'splitlineFirstRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'SplitlineData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex: this.ruleIndex,
        dataName: this.titleTextDataName,
        data: this.pGroupData
      });
    }
  }
};

/* script */
const __vue_script__$3Y = script$3Y;
/* template */
var __vue_render__$3Y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-first-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c("xml-group-render", {
        ref: "xmlGroup",
        attrs: {
          "page-type": _vm.pageType,
          mode: _vm.mode,
          "type-text": _vm.typeText,
          showLine: false,
          "rule-index": _vm.ruleIndex,
          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
        },
        scopedSlots: _vm._u(
          [
            _vm._l(_vm.$scopedSlots, function (index, name) {
              return {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t(name)]
                },
                proxy: true,
              }
            }),
          ],
          null,
          true
        ),
      }),
      _vm._v(" "),
      _c(
        "div",
        {
          staticClass: "title-container",
          attrs: { id: _vm.blockId },
          on: { click: _vm.handleBlockClick },
        },
        [
          _c("div", { staticClass: "line" }),
          _vm._v(" "),
          _c("div", { staticClass: "centerimg" }),
          _vm._v(" "),
          _c("div", { staticClass: "line" }),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3Y = [];
__vue_render__$3Y._withStripped = true;

  /* style */
  const __vue_inject_styles__$3Y = undefined;
  /* scoped */
  const __vue_scope_id__$3Y = "data-v-da82d744";
  /* module identifier */
  const __vue_module_identifier__$3Y = undefined;
  /* functional template */
  const __vue_is_functional_template__$3Y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3Y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3Y, staticRenderFns: __vue_staticRenderFns__$3Y },
    __vue_inject_styles__$3Y,
    __vue_script__$3Y,
    __vue_scope_id__$3Y,
    __vue_is_functional_template__$3Y,
    __vue_module_identifier__$3Y,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3X = {
  mixins: [singleGroupMixin],
  name: 'splitlineSecondRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3X = script$3X;
/* template */
var __vue_render__$3X = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-second-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "line1" }, [_c("div")]),
              _vm._v(" "),
              _c("div", { staticClass: "line2" }, [_c("div")]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3X = [];
__vue_render__$3X._withStripped = true;

  /* style */
  const __vue_inject_styles__$3X = undefined;
  /* scoped */
  const __vue_scope_id__$3X = "data-v-74c278fa";
  /* module identifier */
  const __vue_module_identifier__$3X = undefined;
  /* functional template */
  const __vue_is_functional_template__$3X = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3X = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3X, staticRenderFns: __vue_staticRenderFns__$3X },
    __vue_inject_styles__$3X,
    __vue_script__$3X,
    __vue_scope_id__$3X,
    __vue_is_functional_template__$3X,
    __vue_module_identifier__$3X,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3W = {
  mixins: [singleGroupMixin],
  name: 'splitlineThirdRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3W = script$3W;
/* template */
var __vue_render__$3W = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-third-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3W = [];
__vue_render__$3W._withStripped = true;

  /* style */
  const __vue_inject_styles__$3W = undefined;
  /* scoped */
  const __vue_scope_id__$3W = "data-v-97010f26";
  /* module identifier */
  const __vue_module_identifier__$3W = undefined;
  /* functional template */
  const __vue_is_functional_template__$3W = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3W = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3W, staticRenderFns: __vue_staticRenderFns__$3W },
    __vue_inject_styles__$3W,
    __vue_script__$3W,
    __vue_scope_id__$3W,
    __vue_is_functional_template__$3W,
    __vue_module_identifier__$3W,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3V = {
  mixins: [singleGroupMixin],
  name: 'splitlineFourthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3V = script$3V;
/* template */
var __vue_render__$3V = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-fourth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "line" }),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }),
              _vm._v(" "),
              _c("div", { staticClass: "line" }),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3V = [];
__vue_render__$3V._withStripped = true;

  /* style */
  const __vue_inject_styles__$3V = undefined;
  /* scoped */
  const __vue_scope_id__$3V = "data-v-078d71fb";
  /* module identifier */
  const __vue_module_identifier__$3V = undefined;
  /* functional template */
  const __vue_is_functional_template__$3V = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3V = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3V, staticRenderFns: __vue_staticRenderFns__$3V },
    __vue_inject_styles__$3V,
    __vue_script__$3V,
    __vue_scope_id__$3V,
    __vue_is_functional_template__$3V,
    __vue_module_identifier__$3V,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3U = {
  mixins: [singleGroupMixin],
  name: 'splitlineFifthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3U = script$3U;
/* template */
var __vue_render__$3U = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-fifth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "line" }),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }, [_c("div")]),
              _vm._v(" "),
              _c("div", { staticClass: "line" }),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3U = [];
__vue_render__$3U._withStripped = true;

  /* style */
  const __vue_inject_styles__$3U = undefined;
  /* scoped */
  const __vue_scope_id__$3U = "data-v-42a497c9";
  /* module identifier */
  const __vue_module_identifier__$3U = undefined;
  /* functional template */
  const __vue_is_functional_template__$3U = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3U = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3U, staticRenderFns: __vue_staticRenderFns__$3U },
    __vue_inject_styles__$3U,
    __vue_script__$3U,
    __vue_scope_id__$3U,
    __vue_is_functional_template__$3U,
    __vue_module_identifier__$3U,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3T = {
  mixins: [singleGroupMixin],
  name: 'splitlineSixthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3T = script$3T;
/* template */
var __vue_render__$3T = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-sixth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }, [
                _c("div", { staticClass: "block1" }),
                _vm._v(" "),
                _c("div", { staticClass: "block2" }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "line2" }),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3T = [];
__vue_render__$3T._withStripped = true;

  /* style */
  const __vue_inject_styles__$3T = undefined;
  /* scoped */
  const __vue_scope_id__$3T = "data-v-6c39a1f8";
  /* module identifier */
  const __vue_module_identifier__$3T = undefined;
  /* functional template */
  const __vue_is_functional_template__$3T = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3T = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3T, staticRenderFns: __vue_staticRenderFns__$3T },
    __vue_inject_styles__$3T,
    __vue_script__$3T,
    __vue_scope_id__$3T,
    __vue_is_functional_template__$3T,
    __vue_module_identifier__$3T,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3S = {
  mixins: [singleGroupMixin],
  name: 'splitlineSeventhRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3S = script$3S;
/* template */
var __vue_render__$3S = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-seventh-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "dotted" }, [
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }),
              _vm._v(" "),
              _c("div", { staticClass: "dotted" }, [
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3S = [];
__vue_render__$3S._withStripped = true;

  /* style */
  const __vue_inject_styles__$3S = undefined;
  /* scoped */
  const __vue_scope_id__$3S = "data-v-3c0f998a";
  /* module identifier */
  const __vue_module_identifier__$3S = undefined;
  /* functional template */
  const __vue_is_functional_template__$3S = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3S = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3S, staticRenderFns: __vue_staticRenderFns__$3S },
    __vue_inject_styles__$3S,
    __vue_script__$3S,
    __vue_scope_id__$3S,
    __vue_is_functional_template__$3S,
    __vue_module_identifier__$3S,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3R = {
  mixins: [singleGroupMixin],
  name: 'splitlineEighthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3R = script$3R;
/* template */
var __vue_render__$3R = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-eighth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "centerimg" }, [
                _c("div", { staticClass: "line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line2" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3R = [];
__vue_render__$3R._withStripped = true;

  /* style */
  const __vue_inject_styles__$3R = undefined;
  /* scoped */
  const __vue_scope_id__$3R = "data-v-50ce8380";
  /* module identifier */
  const __vue_module_identifier__$3R = undefined;
  /* functional template */
  const __vue_is_functional_template__$3R = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3R = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3R, staticRenderFns: __vue_staticRenderFns__$3R },
    __vue_inject_styles__$3R,
    __vue_script__$3R,
    __vue_scope_id__$3R,
    __vue_is_functional_template__$3R,
    __vue_module_identifier__$3R,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3Q = {
  mixins: [singleGroupMixin],
  name: 'splitlineNinthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3Q = script$3Q;
/* template */
var __vue_render__$3Q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-ninth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "centerimg" }, [
                _c("div", { staticClass: "skeybox" }),
                _vm._v(" "),
                _c("div", { staticClass: "line" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3Q = [];
__vue_render__$3Q._withStripped = true;

  /* style */
  const __vue_inject_styles__$3Q = undefined;
  /* scoped */
  const __vue_scope_id__$3Q = "data-v-3235b0ba";
  /* module identifier */
  const __vue_module_identifier__$3Q = undefined;
  /* functional template */
  const __vue_is_functional_template__$3Q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3Q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3Q, staticRenderFns: __vue_staticRenderFns__$3Q },
    __vue_inject_styles__$3Q,
    __vue_script__$3Q,
    __vue_scope_id__$3Q,
    __vue_is_functional_template__$3Q,
    __vue_module_identifier__$3Q,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3P = {
  mixins: [singleGroupMixin],
  name: 'splitlineTenthRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3P = script$3P;
/* template */
var __vue_render__$3P = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-tenth-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", [
                _c("div", { staticClass: "centerimg" }),
                _vm._v(" "),
                _c("div", { staticClass: "line" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3P = [];
__vue_render__$3P._withStripped = true;

  /* style */
  const __vue_inject_styles__$3P = undefined;
  /* scoped */
  const __vue_scope_id__$3P = "data-v-a2835e64";
  /* module identifier */
  const __vue_module_identifier__$3P = undefined;
  /* functional template */
  const __vue_is_functional_template__$3P = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3P = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3P, staticRenderFns: __vue_staticRenderFns__$3P },
    __vue_inject_styles__$3P,
    __vue_script__$3P,
    __vue_scope_id__$3P,
    __vue_is_functional_template__$3P,
    __vue_module_identifier__$3P,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3O = {
  mixins: [singleGroupMixin],
  name: 'splitlineEleventhRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3O = script$3O;
/* template */
var __vue_render__$3O = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-eleventh-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", [
                _c("div", { staticClass: "line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line2" }),
                _vm._v(" "),
                _c("div", { staticClass: "centerimg" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3O = [];
__vue_render__$3O._withStripped = true;

  /* style */
  const __vue_inject_styles__$3O = undefined;
  /* scoped */
  const __vue_scope_id__$3O = "data-v-56e0e9d6";
  /* module identifier */
  const __vue_module_identifier__$3O = undefined;
  /* functional template */
  const __vue_is_functional_template__$3O = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3O = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3O, staticRenderFns: __vue_staticRenderFns__$3O },
    __vue_inject_styles__$3O,
    __vue_script__$3O,
    __vue_scope_id__$3O,
    __vue_is_functional_template__$3O,
    __vue_module_identifier__$3O,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3N = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreytheme1Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

var __$_require_static_images_leaflet_resource_enter_reytheme1_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAcCAYAAAC+lOV/AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NkVEQjlDNkFFNDEzMTFFRDk3MjZDM0M4NDc0N0Y2M0QiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NkVEQjlDNkJFNDEzMTFFRDk3MjZDM0M4NDc0N0Y2M0QiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo2RURCOUM2OEU0MTMxMUVEOTcyNkMzQzg0NzQ3RjYzRCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo2RURCOUM2OUU0MTMxMUVEOTcyNkMzQzg0NzQ3RjYzRCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnHmU/UAAACvSURBVHjaYnx7MJ+HgYGBlYF08JMFSKwAYm8yNE9nYqAAjGoe1TyqeVBpBhUGC4D4MBl6z4M0XwbiCUDMRYLGv0DsC9J8E4hLgXgZCZqLgPgEzM/LgbiPSI1LgbgfPcDKgHgPIX8CcRq20Ab5IxKI7+PQ+BqIA4H4G66oegPEQcgKkAyOAOKHhOL5AhAno4mBAnQfsYkEVBH0QtlLYAGELZHgAuVAzAjEtbgUAAQYADfpIG4AZtNeAAAAAElFTkSuQmCC";

/* script */
const __vue_script__$3N = script$3N;
var __vue_render__$3N = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c("img", {
                    attrs: {
                      src: __$_require_static_images_leaflet_resource_enter_reytheme1_png__,
                      alt: "",
                    },
                  }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3N = [];
__vue_render__$3N._withStripped = true;

  /* style */
  const __vue_inject_styles__$3N = undefined;
  /* scoped */
  const __vue_scope_id__$3N = "data-v-139da5c7";
  /* module identifier */
  const __vue_module_identifier__$3N = undefined;
  /* functional template */
  const __vue_is_functional_template__$3N = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3N = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3N, staticRenderFns: __vue_staticRenderFns__$3N },
    __vue_inject_styles__$3N,
    __vue_script__$3N,
    __vue_scope_id__$3N,
    __vue_is_functional_template__$3N,
    __vue_module_identifier__$3N,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3M = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreytheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

var __$_require_static_images_leaflet_resource_enter_reytheme2_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAYCAYAAADkgu3FAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6ODBENkQyRjlFNDEzMTFFREI0QzA4RUJBQTYzQUY4QTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6ODBENkQyRkFFNDEzMTFFREI0QzA4RUJBQTYzQUY4QTMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4MEQ2RDJGN0U0MTMxMUVEQjRDMDhFQkFBNjNBRjhBMyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4MEQ2RDJGOEU0MTMxMUVEQjRDMDhFQkFBNjNBRjhBMyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pmq84K4AAAGmSURBVHjavNXPKwRhGAfwd8YmUgoHKeFA+RlFnIVcrLObhNrkpITk4Lqb/wDlwk3JRVws5WbXQbkoRKg5rMKBjfV96pl6m3Zmn9HOPPU57Ls7+33nfWee17BiyypPVUETvMCrklU5lMBHvi9Nx+deOAYLUhx0DRMuf07XT0MaPuEdnmEDqt2CxuECRnhmdnXAHmw6xivhiMd7wODxOljg8GZnUAvsQqnH0tDM17Xr9nlSbtUAB1CmByWgQrAPtKF9MAdDgt+3w7wdVA9R4YbT0sVhVcmLgowI377p48JB5a8aoY0COlXw1UpBtSEE1ZgqnIpQ0GMIQQ8UlAw4hLpF0uSWcxNg0A61Jwr6hRh8BxByC2t6ZziDKfgpYsg9DMObs6lSrxuDTBFCTqGfHgK3Y4K6cTec/DPgC5a4D1pe55Hix30UZuzbFlaaG26c910VCqLKwRZ0wbkghM6kAT4kleSEddYTL8O2x4RoqWYh69kaBLPN8jIa/GTqtcjHdsGS9rocz/pQG0tIQ6R3ZBe9Y5NwBXew4qur+nx8M3ycX/p9uf8EGACIV0806+7CtAAAAABJRU5ErkJggg==";

/* script */
const __vue_script__$3M = script$3M;
var __vue_render__$3M = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c("img", {
                    attrs: {
                      src: __$_require_static_images_leaflet_resource_enter_reytheme2_png__,
                      alt: "",
                    },
                  }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3M = [];
__vue_render__$3M._withStripped = true;

  /* style */
  const __vue_inject_styles__$3M = undefined;
  /* scoped */
  const __vue_scope_id__$3M = "data-v-43c8b7b4";
  /* module identifier */
  const __vue_module_identifier__$3M = undefined;
  /* functional template */
  const __vue_is_functional_template__$3M = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3M = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3M, staticRenderFns: __vue_staticRenderFns__$3M },
    __vue_inject_styles__$3M,
    __vue_script__$3M,
    __vue_scope_id__$3M,
    __vue_is_functional_template__$3M,
    __vue_module_identifier__$3M,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3L = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreytheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

var __$_require_static_images_leaflet_resource_enter_reytheme3_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAZCAYAAADaILXQAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OTAyNjJBQTlFNDEzMTFFRDk2NjdEMTQ0QjA1QzE1NUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OTAyNjJBQUFFNDEzMTFFRDk2NjdEMTQ0QjA1QzE1NUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5MDI2MkFBN0U0MTMxMUVEOTY2N0QxNDRCMDVDMTU1QiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5MDI2MkFBOEU0MTMxMUVEOTY2N0QxNDRCMDVDMTU1QiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppo2R5QAAAF5SURBVHjatNbNKwVRGMfxmesl7yIl5Y66iYWIYmEhC2s7edtZSDd5ibJgYesf0BXlH5AFydKa3KQUW2QjlvKWt++p52pMM/eec2ec+tR05s5vnnPmnJlrPybbLINWgSfdH8cMgqtwaHKNSfg8+jASdXgNFuR4FYVRhi+iWo5bMR5VeB1mPX1a1euEL6HS05fARNjwekwHnFtBcbaLvUNT89ojutGLsoBrm3CFY6RxijM8u8Mn0S9hLbANlmdCZB7wBy7lRgcq/B6jKLDCN5XXgWZsqTnfx5wVXfvEGE4yD3QdqYjCZ6TgP6vltzNEW3MXGfMbTp7BqrDlbOtcLaNB3BoGp6Ww71yb6AHXhuHn7vWda4fGDcMd3e2v+hoNw+O64Q0o+q/KnYCANxzhy+dcOWp1wr1DfMeGbOkBtGPH5yaOSeUqdFNeZkncSb96MQ2jE7uu5efozvm2fM6mcBMwTRcYQhf2/B6q7fO/pRQveezQEry6O34EGACZzD919vhTGQAAAABJRU5ErkJggg==";

/* script */
const __vue_script__$3L = script$3L;
var __vue_render__$3L = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c("img", {
                    attrs: {
                      src: __$_require_static_images_leaflet_resource_enter_reytheme3_png__,
                      alt: "",
                    },
                  }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3L = [];
__vue_render__$3L._withStripped = true;

  /* style */
  const __vue_inject_styles__$3L = undefined;
  /* scoped */
  const __vue_scope_id__$3L = "data-v-8d06f582";
  /* module identifier */
  const __vue_module_identifier__$3L = undefined;
  /* functional template */
  const __vue_is_functional_template__$3L = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3L = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3L, staticRenderFns: __vue_staticRenderFns__$3L },
    __vue_inject_styles__$3L,
    __vue_script__$3L,
    __vue_scope_id__$3L,
    __vue_is_functional_template__$3L,
    __vue_module_identifier__$3L,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3K = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreytheme4Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

var __$_require_static_images_leaflet_resource_enter_reytheme4_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAYAAADk3wSdAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OUVGMjNFQThFNDEzMTFFREFEM0VENTk1ODYyNDhCRTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OUVGMjNFQTlFNDEzMTFFREFEM0VENTk1ODYyNDhCRTMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5RUYyM0VBNkU0MTMxMUVEQUQzRUQ1OTU4NjI0OEJFMyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5RUYyM0VBN0U0MTMxMUVEQUQzRUQ1OTU4NjI0OEJFMyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PsVWod0AAAHgSURBVHjarJVJKIVRFMd5pkRYiY1nLBuJDLFSyhhRlpShlKQMRYaiZIEiUTYkZWHMQmFhKCIWyoJeFoaQMqYMCwn/W/+n4+t93sd7p3517v3O+X/3O/fc+7m2b1S5GLQcsAQ+7QWaDAqquAGQYTTYiBWASFDnLFFX0EY/EyQ4QzQXxIlxqzNEGzTjfJbi36JRIM1GToUjonE684l/EQ0EPmL8qJP3IHwP5nlpRdWKLOAaPNMvBxvgzoboLIgGC+CJeSquUT10B35gEQSJJJUwyg0ZAh3i2Sk4AzvAX8z7gm5wqVZapBGU1gyuwKuYGwFTGkFpNSZ77QFrAjP0X0AACP0lPkR9/oVm8gBscsMKQQSY5LNVkEV/HRwCM8hmKZWdK2cZfHDThkG1uIm6wC5453gf5HH1PWIhqXyJJ1gxsfDjTGzRXG1qQ7ZAGHgDwWL3pW2DeXAPBq0tVQ+mbfRlL09VuDhhyvr4Iq1wMbgxiSYv0QSZee6PQT9vqzE2fjW/zEPED7KUP07Uh/BTKKb6LhncUiCeibXgiD1ste+yueu0RQxwY1k6xWcngTJunrfe3aAnOs3L2MLfSKzYfbXCdNXkYOIvoqrGlWKsxE7AHMd7oNTRf9Qnb/w1I8FfAgwA7f9kYofT4PIAAAAASUVORK5CYII=";

/* script */
const __vue_script__$3K = script$3K;
var __vue_render__$3K = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c("img", {
                    attrs: {
                      src: __$_require_static_images_leaflet_resource_enter_reytheme4_png__,
                      alt: "",
                    },
                  }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3K = [];
__vue_render__$3K._withStripped = true;

  /* style */
  const __vue_inject_styles__$3K = undefined;
  /* scoped */
  const __vue_scope_id__$3K = "data-v-e728160a";
  /* module identifier */
  const __vue_module_identifier__$3K = undefined;
  /* functional template */
  const __vue_is_functional_template__$3K = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3K = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3K, staticRenderFns: __vue_staticRenderFns__$3K },
    __vue_inject_styles__$3K,
    __vue_script__$3K,
    __vue_scope_id__$3K,
    __vue_is_functional_template__$3K,
    __vue_module_identifier__$3K,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3J = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreytheme5Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

var __$_require_static_images_leaflet_resource_enter_reytheme5_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAXCAYAAAARIY8tAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QjA0QzIwODRFNDEzMTFFREEzRkZDRjE5OUYyRjk4RkUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QjA0QzIwODVFNDEzMTFFREEzRkZDRjE5OUYyRjk4RkUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpCMDRDMjA4MkU0MTMxMUVEQTNGRkNGMTk5RjJGOThGRSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpCMDRDMjA4M0U0MTMxMUVEQTNGRkNGMTk5RjJGOThGRSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PiMgT5kAAAK/SURBVHjatJZraM5xFMef59nIZeWWNt56QSYUy2UvaLJ4MaYolFbCUm4lGnPPZS9opoiaMfECLxStNF6Y3K9hLjWZiAxhRhh5fE59/+t4/P96vHDq0/O7/c/5/c45v/N74rGDr2Ihkgn74C5UQQZMg1vwEorgCjyHfFgKm5Il2Y1hisJkPMyFb3BS/Ro4Bydk1MaLYQeMAtvpknQNmKJHMAgqYIzGHwqTKbBdyn/C/jBF8QgXmUyH467/GQZAC5yFCW7uMO6Zk66BGh09Dj3d+BZYo/ZIuKY1gfF2eAfDMfYp+Cjxh8FYrAB6pSg3Oe/a9+G963fXN3bCgX+LwVBYBP3dWAmMhQ1Qr7HF0BvaYKViEJwkFq9tyQpO4Q2MU3BPw2Q3fh1uKtBTdZIyzVWiaG/H8WtbSvm5oSxbFuYik0lyUyC34ZjaW2G13PFaWRQo78bPenWTYTFogDqnKO7myuE7DIblbk2bW2OXrR98VEJ0ZJFlxDb1bUGu2hfhi1OQBz1Sgt7u+qMhC97AHY2dMgM7Zf1/SLMFeRd01UCuaovJIfjqFs+Q7wM5Cq2ubwmQDS+cq+vNwBMolc+vaqJO6endM19tM9oFHtvFI4uCINvFq4a+Vl4Yb04NcrEUWU6vSjlqhTZwQQGPKQ1z3Jpa1a/OsDEsi5qk/Ajcc+MTXdrapdoDz3R71wWL2PEPpXDMFcTfLlqj6v5MvQWBBMqtPF9W2/L9AMzDNZku760WJTCWjCp2cT0oORFvRIPaGaqqfULW5WPgUlQtMsuVcksnlY9AZjsDhSnKH2hjraqyab0HC+XvpE5mPh6iWNnTOczNnWHXhWFKEhHKLYBr1a5SfOy0m2GWlJvBBUEiEIuCfzGQp7LRqrpS5tYnXFpWu0tVFPXvIepNLldev5WSEfAUPsjnTVq7QifcHabolwADAMmYvYIeJigVAAAAAElFTkSuQmCC";

/* script */
const __vue_script__$3J = script$3J;
var __vue_render__$3J = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme5-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c("img", {
                    attrs: {
                      src: __$_require_static_images_leaflet_resource_enter_reytheme5_png__,
                      alt: "",
                    },
                  }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3J = [];
__vue_render__$3J._withStripped = true;

  /* style */
  const __vue_inject_styles__$3J = undefined;
  /* scoped */
  const __vue_scope_id__$3J = "data-v-5f5b64b7";
  /* module identifier */
  const __vue_module_identifier__$3J = undefined;
  /* functional template */
  const __vue_is_functional_template__$3J = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3J = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3J, staticRenderFns: __vue_staticRenderFns__$3J },
    __vue_inject_styles__$3J,
    __vue_script__$3J,
    __vue_scope_id__$3J,
    __vue_is_functional_template__$3J,
    __vue_module_identifier__$3J,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3I = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreytheme6Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

var __$_require_static_images_leaflet_resource_enter_reytheme6_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAaCAYAAABYQRdDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QzhCNDAxMkRFNDEzMTFFRDk0QkVFQjNBMzJBNTY3Q0QiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QzhCNDAxMkVFNDEzMTFFRDk0QkVFQjNBMzJBNTY3Q0QiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDOEI0MDEyQkU0MTMxMUVEOTRCRUVCM0EzMkE1NjdDRCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDOEI0MDEyQ0U0MTMxMUVEOTRCRUVCM0EzMkE1NjdDRCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PuQHbIYAAAIZSURBVHjaYnzGIMhARaAExKZMVDTQDojPALEMC5UMdALizUDMBcRvqeFSHSBeBzUQBD5QaqgAEK8HYn4ksU+UGjoViFXQxBhZvAwVxIAMHlJNm/D8rYfai89RWKSEQBHVD8RRpBjIyfCfQfjHT1zSKmR5P+zrdwbhD79wSTugJ6lXQPwFn4GS//6yBNx9IwsKOyzS14C4Fd3Qwm3nHyyDskG++IdF4xwgTsYwTYr3h9azz1ZA5kdc3lcF4pNALI8mLgfEseiKL0nzMVSKC78GGQhzDToIh2Y3EyDOQpMrA2I2ZIEHYlwMLWKCDL8ZgLGH5EUwAKmc8uwVyFsrgJgPKpwEjmxEQk9ANhBoyuc2SWFgJKAGL9hQuX9/GSY8fcWg9PKbE5rLRECRDWWnADE3spm3JXiLnjAxY3gVbOhHRiaGuzycUMsxQA40ptPQxKcVSArvwhYhUEMZGXr5eRnWqop2gwoENDWgsC2GRh4M3IKGLwNOQ2FgLg/3RVDiBeIXaOrakdigZJYIxN+IMhQKQAa7wZIHFCCn55lAfAxfBsGVTi8DcRAQo+dFkA8qCWVjfHl/HzTGkUENmg9INhQEFgPxLKRgmU9MgYOe9/OA5WsAsgAPw3/mqQ9efFotIfh1CwfHCjT1XMQYag7FcADKLZVyYgzPmZitiC0aiapNn2HJNfgAo4GhoTm09KEUgNLt1vPnzjEABBgAWt12zyTTtPoAAAAASUVORK5CYII=";

/* script */
const __vue_script__$3I = script$3I;
var __vue_render__$3I = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme6-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c("img", {
                    attrs: {
                      src: __$_require_static_images_leaflet_resource_enter_reytheme6_png__,
                      alt: "",
                    },
                  }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3I = [];
__vue_render__$3I._withStripped = true;

  /* style */
  const __vue_inject_styles__$3I = undefined;
  /* scoped */
  const __vue_scope_id__$3I = "data-v-324ad473";
  /* module identifier */
  const __vue_module_identifier__$3I = undefined;
  /* functional template */
  const __vue_is_functional_template__$3I = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3I = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3I, staticRenderFns: __vue_staticRenderFns__$3I },
    __vue_inject_styles__$3I,
    __vue_script__$3I,
    __vue_scope_id__$3I,
    __vue_is_functional_template__$3I,
    __vue_module_identifier__$3I,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3H = {
  mixins: [singleGroupMixin],
  name: 'splitlineYellowtheme1Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3H = script$3H;
/* template */
var __vue_render__$3H = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Yellowtheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3H = [];
__vue_render__$3H._withStripped = true;

  /* style */
  const __vue_inject_styles__$3H = undefined;
  /* scoped */
  const __vue_scope_id__$3H = "data-v-b7792f68";
  /* module identifier */
  const __vue_module_identifier__$3H = undefined;
  /* functional template */
  const __vue_is_functional_template__$3H = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3H = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3H, staticRenderFns: __vue_staticRenderFns__$3H },
    __vue_inject_styles__$3H,
    __vue_script__$3H,
    __vue_scope_id__$3H,
    __vue_is_functional_template__$3H,
    __vue_module_identifier__$3H,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3G = {
  mixins: [singleGroupMixin],
  name: 'splitlineYellowtheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3G = script$3G;
/* template */
var __vue_render__$3G = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Yellowtheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3G = [];
__vue_render__$3G._withStripped = true;

  /* style */
  const __vue_inject_styles__$3G = undefined;
  /* scoped */
  const __vue_scope_id__$3G = "data-v-522120e9";
  /* module identifier */
  const __vue_module_identifier__$3G = undefined;
  /* functional template */
  const __vue_is_functional_template__$3G = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3G = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3G, staticRenderFns: __vue_staticRenderFns__$3G },
    __vue_inject_styles__$3G,
    __vue_script__$3G,
    __vue_scope_id__$3G,
    __vue_is_functional_template__$3G,
    __vue_module_identifier__$3G,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3F = {
  mixins: [singleGroupMixin],
  name: 'splitlineYellowtheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3F = script$3F;
/* template */
var __vue_render__$3F = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Yellowtheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3F = [];
__vue_render__$3F._withStripped = true;

  /* style */
  const __vue_inject_styles__$3F = undefined;
  /* scoped */
  const __vue_scope_id__$3F = "data-v-00024cf4";
  /* module identifier */
  const __vue_module_identifier__$3F = undefined;
  /* functional template */
  const __vue_is_functional_template__$3F = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3F = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3F, staticRenderFns: __vue_staticRenderFns__$3F },
    __vue_inject_styles__$3F,
    __vue_script__$3F,
    __vue_scope_id__$3F,
    __vue_is_functional_template__$3F,
    __vue_module_identifier__$3F,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3E = {
  mixins: [singleGroupMixin],
  name: 'splitlineYellowtheme4Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3E = script$3E;
/* template */
var __vue_render__$3E = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Yellowtheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3E = [];
__vue_render__$3E._withStripped = true;

  /* style */
  const __vue_inject_styles__$3E = undefined;
  /* scoped */
  const __vue_scope_id__$3E = "data-v-a446dbba";
  /* module identifier */
  const __vue_module_identifier__$3E = undefined;
  /* functional template */
  const __vue_is_functional_template__$3E = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3E = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3E, staticRenderFns: __vue_staticRenderFns__$3E },
    __vue_inject_styles__$3E,
    __vue_script__$3E,
    __vue_scope_id__$3E,
    __vue_is_functional_template__$3E,
    __vue_module_identifier__$3E,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3D = {
  mixins: [singleGroupMixin],
  name: 'splitlineRedtheme1Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3D = script$3D;
/* template */
var __vue_render__$3D = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Redtheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3D = [];
__vue_render__$3D._withStripped = true;

  /* style */
  const __vue_inject_styles__$3D = undefined;
  /* scoped */
  const __vue_scope_id__$3D = "data-v-449d3a0a";
  /* module identifier */
  const __vue_module_identifier__$3D = undefined;
  /* functional template */
  const __vue_is_functional_template__$3D = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3D = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3D, staticRenderFns: __vue_staticRenderFns__$3D },
    __vue_inject_styles__$3D,
    __vue_script__$3D,
    __vue_scope_id__$3D,
    __vue_is_functional_template__$3D,
    __vue_module_identifier__$3D,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3C = {
  mixins: [singleGroupMixin],
  name: 'splitlineRedtheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3C = script$3C;
/* template */
var __vue_render__$3C = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Redtheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3C = [];
__vue_render__$3C._withStripped = true;

  /* style */
  const __vue_inject_styles__$3C = undefined;
  /* scoped */
  const __vue_scope_id__$3C = "data-v-7c8d9b7a";
  /* module identifier */
  const __vue_module_identifier__$3C = undefined;
  /* functional template */
  const __vue_is_functional_template__$3C = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3C = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3C, staticRenderFns: __vue_staticRenderFns__$3C },
    __vue_inject_styles__$3C,
    __vue_script__$3C,
    __vue_scope_id__$3C,
    __vue_is_functional_template__$3C,
    __vue_module_identifier__$3C,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3B = {
  mixins: [singleGroupMixin],
  name: 'splitlineRedtheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3B = script$3B;
/* template */
var __vue_render__$3B = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Redtheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3B = [];
__vue_render__$3B._withStripped = true;

  /* style */
  const __vue_inject_styles__$3B = undefined;
  /* scoped */
  const __vue_scope_id__$3B = "data-v-1b69d3f9";
  /* module identifier */
  const __vue_module_identifier__$3B = undefined;
  /* functional template */
  const __vue_is_functional_template__$3B = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3B = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3B, staticRenderFns: __vue_staticRenderFns__$3B },
    __vue_inject_styles__$3B,
    __vue_script__$3B,
    __vue_scope_id__$3B,
    __vue_is_functional_template__$3B,
    __vue_module_identifier__$3B,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3A = {
  mixins: [singleGroupMixin],
  name: 'splitlineRedtheme4Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3A = script$3A;
/* template */
var __vue_render__$3A = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Redtheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3A = [];
__vue_render__$3A._withStripped = true;

  /* style */
  const __vue_inject_styles__$3A = undefined;
  /* scoped */
  const __vue_scope_id__$3A = "data-v-8b73e710";
  /* module identifier */
  const __vue_module_identifier__$3A = undefined;
  /* functional template */
  const __vue_is_functional_template__$3A = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3A = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3A, staticRenderFns: __vue_staticRenderFns__$3A },
    __vue_inject_styles__$3A,
    __vue_script__$3A,
    __vue_scope_id__$3A,
    __vue_is_functional_template__$3A,
    __vue_module_identifier__$3A,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3z = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreentheme1Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3z = script$3z;
/* template */
var __vue_render__$3z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greentheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3z = [];
__vue_render__$3z._withStripped = true;

  /* style */
  const __vue_inject_styles__$3z = undefined;
  /* scoped */
  const __vue_scope_id__$3z = "data-v-65eb5c6e";
  /* module identifier */
  const __vue_module_identifier__$3z = undefined;
  /* functional template */
  const __vue_is_functional_template__$3z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3z, staticRenderFns: __vue_staticRenderFns__$3z },
    __vue_inject_styles__$3z,
    __vue_script__$3z,
    __vue_scope_id__$3z,
    __vue_is_functional_template__$3z,
    __vue_module_identifier__$3z,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3y = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreentheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3y = script$3y;
/* template */
var __vue_render__$3y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greentheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3y = [];
__vue_render__$3y._withStripped = true;

  /* style */
  const __vue_inject_styles__$3y = undefined;
  /* scoped */
  const __vue_scope_id__$3y = "data-v-5a978688";
  /* module identifier */
  const __vue_module_identifier__$3y = undefined;
  /* functional template */
  const __vue_is_functional_template__$3y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3y, staticRenderFns: __vue_staticRenderFns__$3y },
    __vue_inject_styles__$3y,
    __vue_script__$3y,
    __vue_scope_id__$3y,
    __vue_is_functional_template__$3y,
    __vue_module_identifier__$3y,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3x = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreentheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3x = script$3x;
/* template */
var __vue_render__$3x = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greentheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3x = [];
__vue_render__$3x._withStripped = true;

  /* style */
  const __vue_inject_styles__$3x = undefined;
  /* scoped */
  const __vue_scope_id__$3x = "data-v-3175eb78";
  /* module identifier */
  const __vue_module_identifier__$3x = undefined;
  /* functional template */
  const __vue_is_functional_template__$3x = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3x = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3x, staticRenderFns: __vue_staticRenderFns__$3x },
    __vue_inject_styles__$3x,
    __vue_script__$3x,
    __vue_scope_id__$3x,
    __vue_is_functional_template__$3x,
    __vue_module_identifier__$3x,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3w = {
  mixins: [singleGroupMixin],
  name: 'splitlineGreentheme4Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3w = script$3w;
/* template */
var __vue_render__$3w = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greentheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3w = [];
__vue_render__$3w._withStripped = true;

  /* style */
  const __vue_inject_styles__$3w = undefined;
  /* scoped */
  const __vue_scope_id__$3w = "data-v-75b1f006";
  /* module identifier */
  const __vue_module_identifier__$3w = undefined;
  /* functional template */
  const __vue_is_functional_template__$3w = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3w = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3w, staticRenderFns: __vue_staticRenderFns__$3w },
    __vue_inject_styles__$3w,
    __vue_script__$3w,
    __vue_scope_id__$3w,
    __vue_is_functional_template__$3w,
    __vue_module_identifier__$3w,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3v = {
  mixins: [singleGroupMixin],
  name: 'splitlineBluetheme1Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3v = script$3v;
/* template */
var __vue_render__$3v = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Bluetheme1-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3v = [];
__vue_render__$3v._withStripped = true;

  /* style */
  const __vue_inject_styles__$3v = undefined;
  /* scoped */
  const __vue_scope_id__$3v = "data-v-ae52654c";
  /* module identifier */
  const __vue_module_identifier__$3v = undefined;
  /* functional template */
  const __vue_is_functional_template__$3v = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3v = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3v, staticRenderFns: __vue_staticRenderFns__$3v },
    __vue_inject_styles__$3v,
    __vue_script__$3v,
    __vue_scope_id__$3v,
    __vue_is_functional_template__$3v,
    __vue_module_identifier__$3v,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3u = {
  mixins: [singleGroupMixin],
  name: 'splitlineBluetheme2Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3u = script$3u;
/* template */
var __vue_render__$3u = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Bluetheme2-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3u = [];
__vue_render__$3u._withStripped = true;

  /* style */
  const __vue_inject_styles__$3u = undefined;
  /* scoped */
  const __vue_scope_id__$3u = "data-v-1842f937";
  /* module identifier */
  const __vue_module_identifier__$3u = undefined;
  /* functional template */
  const __vue_is_functional_template__$3u = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3u = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3u, staticRenderFns: __vue_staticRenderFns__$3u },
    __vue_inject_styles__$3u,
    __vue_script__$3u,
    __vue_scope_id__$3u,
    __vue_is_functional_template__$3u,
    __vue_module_identifier__$3u,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3t = {
  mixins: [singleGroupMixin],
  name: 'splitlineBluetheme3Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3t = script$3t;
/* template */
var __vue_render__$3t = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Bluetheme3-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3t = [];
__vue_render__$3t._withStripped = true;

  /* style */
  const __vue_inject_styles__$3t = undefined;
  /* scoped */
  const __vue_scope_id__$3t = "data-v-f0a1b5d8";
  /* module identifier */
  const __vue_module_identifier__$3t = undefined;
  /* functional template */
  const __vue_is_functional_template__$3t = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3t = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3t, staticRenderFns: __vue_staticRenderFns__$3t },
    __vue_inject_styles__$3t,
    __vue_script__$3t,
    __vue_scope_id__$3t,
    __vue_is_functional_template__$3t,
    __vue_module_identifier__$3t,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$3s = {
  mixins: [singleGroupMixin],
  name: 'splitlineBluetheme4Render',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$3s = script$3s;
/* template */
var __vue_render__$3s = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Bluetheme4-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "linebox" })]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3s = [];
__vue_render__$3s._withStripped = true;

  /* style */
  const __vue_inject_styles__$3s = undefined;
  /* scoped */
  const __vue_scope_id__$3s = "data-v-11c95e1e";
  /* module identifier */
  const __vue_module_identifier__$3s = undefined;
  /* functional template */
  const __vue_is_functional_template__$3s = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3s = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3s, staticRenderFns: __vue_staticRenderFns__$3s },
    __vue_inject_styles__$3s,
    __vue_script__$3s,
    __vue_scope_id__$3s,
    __vue_is_functional_template__$3s,
    __vue_module_identifier__$3s,
    false,
    undefined,
    undefined,
    undefined
  );

const SplitlineComponents = [__vue_component__$3Y, __vue_component__$3X, __vue_component__$3W, __vue_component__$3V, __vue_component__$3U, __vue_component__$3T, __vue_component__$3S, __vue_component__$3R, __vue_component__$3Q, __vue_component__$3P, __vue_component__$3O, __vue_component__$3N, __vue_component__$3M, __vue_component__$3L, __vue_component__$3K, __vue_component__$3J, __vue_component__$3I, __vue_component__$3H, __vue_component__$3G, __vue_component__$3F, __vue_component__$3E, __vue_component__$3D, __vue_component__$3C, __vue_component__$3B, __vue_component__$3A, __vue_component__$3z, __vue_component__$3y, __vue_component__$3x, __vue_component__$3w, __vue_component__$3v, __vue_component__$3u, __vue_component__$3t, __vue_component__$3s];
var splitline = {
  // install,
  ...SplitlineComponents
};

//

/**
 * 单图片组合
 */
var script$3r = {
  name: 'XmlSingleImageGroupRender',
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图片',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    clickImg() {
      this.$emit('clickImg');
    }
  }
};

/* script */
const __vue_script__$3r = script$3r;

/* template */
var __vue_render__$3r = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-image-group",
        "xml-single-image-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            pageType: _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-image-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.imageBlockDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.imageBlockDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              "show-title": true,
              pageType: _vm.pageType,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: { blockclick: _vm.handleBlockClick, clickImg: _vm.clickImg },
          }),
        ],
        1
      ),
      _vm._v(" "),
      _vm.groupData[_vm.imageBlockDataName].imageCaption &&
      _vm.groupData[_vm.imageBlockDataName].showEffect === "hua-lang"
        ? _c("div", {
            staticClass: "xml-group-action-image-caption",
            domProps: {
              innerHTML: _vm._s(
                _vm.groupData[_vm.imageBlockDataName].imageCaption
              ),
            },
          })
        : _vm._e(),
    ],
    1
  )
};
var __vue_staticRenderFns__$3r = [];
__vue_render__$3r._withStripped = true;

  /* style */
  const __vue_inject_styles__$3r = undefined;
  /* scoped */
  const __vue_scope_id__$3r = undefined;
  /* module identifier */
  const __vue_module_identifier__$3r = undefined;
  /* functional template */
  const __vue_is_functional_template__$3r = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3r = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3r, staticRenderFns: __vue_staticRenderFns__$3r },
    __vue_inject_styles__$3r,
    __vue_script__$3r,
    __vue_scope_id__$3r,
    __vue_is_functional_template__$3r,
    __vue_module_identifier__$3r,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3r.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-image-group-render', {
    prefix: options.prefix
  }), __vue_component__$3r);
};

//
var script$3q = {
  name: 'XmlSingleCatalogGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '目录',
      dataName: 'catalogData',
      groupData: {},
      blockId: 'blockId' + Math.random()
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex: this.ruleIndex
      });
    }
  }
};

/* script */
const __vue_script__$3q = script$3q;
/* template */
var __vue_render__$3q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "xml-catalog-render",
            {
              attrs: {
                "p-block-data": _vm.groupData[_vm.dataName],
                "current-rule": _vm.currentRule,
                "block-data-name": _vm.dataName,
                "extend-params": _vm.extendParams,
                "rule-index": _vm.ruleIndex,
                pageType: _vm.pageType,
                mode: _vm.mode,
              },
              on: { blockclick: _vm.handleBlockClick },
            },
            [_vm._v("\n      >\n    ")]
          ),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3q = [];
__vue_render__$3q._withStripped = true;

  /* style */
  const __vue_inject_styles__$3q = undefined;
  /* scoped */
  const __vue_scope_id__$3q = "data-v-34f72946";
  /* module identifier */
  const __vue_module_identifier__$3q = undefined;
  /* functional template */
  const __vue_is_functional_template__$3q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3q, staticRenderFns: __vue_staticRenderFns__$3q },
    __vue_inject_styles__$3q,
    __vue_script__$3q,
    __vue_scope_id__$3q,
    __vue_is_functional_template__$3q,
    __vue_module_identifier__$3q,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3q.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-ctalog-group-render', {
    prefix: options.prefix
  }), __vue_component__$3q);
};

//
var script$3p = {
  name: 'XmlSingleBookGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '电子书',
      ebookDataName: 'ebookData',
      groupData: {},
      blockId: 'blockId' + Math.random()
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    bookReaderPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isReader: {
      // 是否阅读器
      type: Boolean,
      default: false
    }
  },
  watch: {
    pGroupData(newVal) {
      this.groupData = this.pGroupData;
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex: this.ruleIndex
      });
    },
    showFileReader(e) {
      this.$emit('showFileReader', e);
    }
  }
};

/* script */
const __vue_script__$3p = script$3p;
/* template */
var __vue_render__$3p = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-ebook-group",
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-ebook-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.ebookDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.ebookDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
              bookReaderPath: _vm.bookReaderPath,
              isReader: _vm.isReader,
            },
            on: {
              blockclick: _vm.handleBlockClick,
              showFileReader: _vm.showFileReader,
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3p = [];
__vue_render__$3p._withStripped = true;

  /* style */
  const __vue_inject_styles__$3p = undefined;
  /* scoped */
  const __vue_scope_id__$3p = "data-v-662ea276";
  /* module identifier */
  const __vue_module_identifier__$3p = undefined;
  /* functional template */
  const __vue_is_functional_template__$3p = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3p = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3p, staticRenderFns: __vue_staticRenderFns__$3p },
    __vue_inject_styles__$3p,
    __vue_script__$3p,
    __vue_scope_id__$3p,
    __vue_is_functional_template__$3p,
    __vue_module_identifier__$3p,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3p.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-ebook-group-render', {
    prefix: options.prefix
  }), __vue_component__$3p);
};

//
var script$3o = {
  name: 'XmlSingleHtmlGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: 'html',
      ebookDataName: 'htmlData',
      groupData: {},
      blockId: 'blockId' + Math.random()
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isCopyUrl: {
      type: Boolean,
      default: false
    },
    isReader: {
      // 是否阅读器
      type: Boolean,
      default: false
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex: this.ruleIndex
      });
    },
    openHtml(data) {
      this.$emit('openHtml', data);
    },
    copyHtmlUrl(data) {
      this.$emit('copyHtmlUrl', data);
    }
  }
};

/* script */
const __vue_script__$3o = script$3o;
/* template */
var __vue_render__$3o = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-html-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.ebookDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.ebookDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              "page-type": _vm.pageType,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
              isCopyUrl: _vm.isCopyUrl,
              isReader: _vm.isReader,
            },
            on: {
              blockclick: _vm.handleBlockClick,
              copyHtmlUrl: _vm.copyHtmlUrl,
              openHtml: _vm.openHtml,
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3o = [];
__vue_render__$3o._withStripped = true;

  /* style */
  const __vue_inject_styles__$3o = undefined;
  /* scoped */
  const __vue_scope_id__$3o = "data-v-f8e4bff6";
  /* module identifier */
  const __vue_module_identifier__$3o = undefined;
  /* functional template */
  const __vue_is_functional_template__$3o = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3o = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3o, staticRenderFns: __vue_staticRenderFns__$3o },
    __vue_inject_styles__$3o,
    __vue_script__$3o,
    __vue_scope_id__$3o,
    __vue_is_functional_template__$3o,
    __vue_module_identifier__$3o,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3o.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-html-group-render', {
    prefix: options.prefix
  }), __vue_component__$3o);
};

//
var script$3n = {
  name: 'XmlSingleMusicGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '音频',
      musicDataName: 'musicData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  watch: {
    pGroupData(newVal) {
      this.groupData = this.pGroupData;
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    }
  }
};

/* script */
const __vue_script__$3n = script$3n;
/* template */
var __vue_render__$3n = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-music-group",
        "xml-single-music-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-music-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.musicDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.musicDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: { blockclick: _vm.handleBlockClick },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3n = [];
__vue_render__$3n._withStripped = true;

  /* style */
  const __vue_inject_styles__$3n = undefined;
  /* scoped */
  const __vue_scope_id__$3n = "data-v-46631b30";
  /* module identifier */
  const __vue_module_identifier__$3n = undefined;
  /* functional template */
  const __vue_is_functional_template__$3n = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3n = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3n, staticRenderFns: __vue_staticRenderFns__$3n },
    __vue_inject_styles__$3n,
    __vue_script__$3n,
    __vue_scope_id__$3n,
    __vue_is_functional_template__$3n,
    __vue_module_identifier__$3n,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3n.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-music-group-render', {
    prefix: options.prefix
  }), __vue_component__$3n);
};

//
var script$3m = {
  name: 'XmlSingleQuestionGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '题库',
      questionDataName: 'questionData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isShowAi: {
      type: String,
      default: '1'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    changeAnswer() {
      this.$refs.xmlQuestion.changeAnswer();
    },
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    }
  }
};

/* script */
const __vue_script__$3m = script$3m;
/* template */
var __vue_render__$3m = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-question-group",
        "xml-single-question-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-question-render", {
            ref: "xmlQuestion",
            attrs: {
              "p-block-data": _vm.groupData[_vm.questionDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.questionDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              mode: _vm.mode,
              isShowAi: _vm.isShowAi,
              pageType: _vm.pageType,
              isSubmit:
                _vm.groupData[_vm.questionDataName].questionMode == "false"
                  ? false
                  : true,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: {
              blockclick: _vm.handleBlockClick,
              submitAnswer: function ($event) {
                return _vm.$emit("submitAnswer", $event)
              },
              setanalysis: function ($event) {
                return _vm.$emit("setanalysis", $event)
              },
            },
          }),
        ],
        1
      ),
      _vm._v(" "),
      _vm.groupData[_vm.questionDataName].questionMode == "false"
        ? _c(
            "div",
            {
              staticClass: "xml-submit-answer xml-submit-answer-right",
              on: {
                click: function ($event) {
                  return _vm.changeAnswer()
                },
              },
            },
            [_vm._v("\n    提交作答\n  ")]
          )
        : _vm._e(),
    ],
    1
  )
};
var __vue_staticRenderFns__$3m = [];
__vue_render__$3m._withStripped = true;

  /* style */
  const __vue_inject_styles__$3m = undefined;
  /* scoped */
  const __vue_scope_id__$3m = "data-v-5f63859c";
  /* module identifier */
  const __vue_module_identifier__$3m = undefined;
  /* functional template */
  const __vue_is_functional_template__$3m = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3m = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3m, staticRenderFns: __vue_staticRenderFns__$3m },
    __vue_inject_styles__$3m,
    __vue_script__$3m,
    __vue_scope_id__$3m,
    __vue_is_functional_template__$3m,
    __vue_module_identifier__$3m,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3m.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-question-group-render', {
    prefix: options.prefix
  }), __vue_component__$3m);
};

//
// import { OuchnOss } from '@/api/business/file/OuchnOss'
var script$3l = {
  name: 'XmlSingleResourceGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '资源',
      resourceDataName: 'resourceData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    officePreviewPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isReader: {
      // 是否阅读器
      type: Boolean,
      default: false
    }
  },
  watch: {
    pGroupData(newVal) {
      this.groupData = this.pGroupData;
    }
  },
  computed: {
    isNotLocalView() {
      return !(process.env.VUE_APP_ENV === 'localview');
    }
  },
  created() {
    this.groupData = this.pGroupData;
    // console.log(this.pGroupData, 'pGroupData---------')
    // if (this.isNotLocalView) {
    //   this.ouchnOss = new OuchnOss(true)
    // }
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    downloadFileUrl({
      item,
      fileName,
      resourceType
    }) {
      this.$emit('downloadFileUrl', {
        item,
        fileName,
        resourceType
      });
    },
    showFileReader(e) {
      this.$emit('showFileReader', e);
    }
  }
};

/* script */
const __vue_script__$3l = script$3l;
/* template */
var __vue_render__$3l = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-resource-group",
        "xml-single-resource-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-resource-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.resourceDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.resourceDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
              officePreviewPath: _vm.officePreviewPath,
              isReader: _vm.isReader,
              pageType: _vm.pageType,
            },
            on: {
              blockclick: _vm.handleBlockClick,
              downloadFileUrl: _vm.downloadFileUrl,
              showFileReader: _vm.showFileReader,
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3l = [];
__vue_render__$3l._withStripped = true;

  /* style */
  const __vue_inject_styles__$3l = undefined;
  /* scoped */
  const __vue_scope_id__$3l = "data-v-9ac26d94";
  /* module identifier */
  const __vue_module_identifier__$3l = undefined;
  /* functional template */
  const __vue_is_functional_template__$3l = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3l = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3l, staticRenderFns: __vue_staticRenderFns__$3l },
    __vue_inject_styles__$3l,
    __vue_script__$3l,
    __vue_scope_id__$3l,
    __vue_is_functional_template__$3l,
    __vue_module_identifier__$3l,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3l.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-resource-group-render', {
    prefix: options.prefix
  }), __vue_component__$3l);
};

//
var script$3k = {
  name: 'XmlSingleTestPaperGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '试卷',
      questionDataName: 'testPaperData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    reader: {
      type: Boolean,
      default: false
    },
    isShowAi: {
      type: String,
      default: '1'
    },
    BookName: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    openTestPaper({
      info,
      showRobot
    }) {
      console.log(showRobot);
      this.$emit('openTestPaper', {
        info: info,
        showRobot: showRobot
      });
    }
  }
};

/* script */
const __vue_script__$3k = script$3k;
/* template */
var __vue_render__$3k = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-test-paper-group",
        "xml-single-question-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _vm.mode === "editor"
        ? _c("span", { staticClass: "xml-group-type-text" })
        : _vm._e(),
      _vm._v(" "),
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            BookName: _vm.BookName,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-test-paper-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.questionDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.questionDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              mode: _vm.mode,
              reader: _vm.reader,
              pageType: _vm.pageType,
              BookName: _vm.BookName,
              isShowAi: _vm.isShowAi,
            },
            on: {
              blockclick: _vm.handleBlockClick,
              openTestPaper: _vm.openTestPaper,
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3k = [];
__vue_render__$3k._withStripped = true;

  /* style */
  const __vue_inject_styles__$3k = undefined;
  /* scoped */
  const __vue_scope_id__$3k = "data-v-18c66dfc";
  /* module identifier */
  const __vue_module_identifier__$3k = undefined;
  /* functional template */
  const __vue_is_functional_template__$3k = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3k = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3k, staticRenderFns: __vue_staticRenderFns__$3k },
    __vue_inject_styles__$3k,
    __vue_script__$3k,
    __vue_scope_id__$3k,
    __vue_is_functional_template__$3k,
    __vue_module_identifier__$3k,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3k.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-test-paper-group-render', {
    prefix: options.prefix
  }), __vue_component__$3k);
};

//
/**
 * 单文本组合
 */
var script$3j = {
  name: 'XmlSingleTextGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '文本',
      textDataName: 'textData',
      showComponentButtons: false,
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    ruleIndex: Number,
    currentRuleIndex: Number,
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    projectId: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    getClassName() {
      return this.groupData.textData.className || '';
    }
  }
};

/* script */
const __vue_script__$3j = script$3j;
/* template */
var __vue_render__$3j = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark text-body-mark",
      class: [
        "xml-single-text-group",
        "xml-single-text-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
        _vm.getClassName(),
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          staticClass: "optional-text",
          attrs: {
            "page-type": _vm.pageType,
            "type-text": _vm.typeText,
            projectId: _vm.projectId,
            mode: _vm.mode,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-text-render", {
            ref: "xmlText",
            attrs: {
              projectId: _vm.projectId,
              pBlockData: _vm.groupData[_vm.textDataName],
              "block-data-name": _vm.textDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              currentRule: _vm.currentRule,
              "css-theme": "default",
              "container-class": "text-container",
              "text-container": "default-text-container",
              resourceBasisPath: _vm.resourceBasisPath,
              mode: _vm.mode,
              "page-type": _vm.pageType,
              scopedSlots: { $scopedSlots: _vm.$scopedSlots },
            },
            on: {
              "update:pBlockData": function ($event) {
                return _vm.$set(_vm.groupData, _vm.textDataName, $event)
              },
              "update:p-block-data": function ($event) {
                return _vm.$set(_vm.groupData, _vm.textDataName, $event)
              },
              blockclick: _vm.handleBlockClick,
              groupDataChange: _vm.groupDataChange,
            },
            scopedSlots: _vm._u(
              [
                _vm._l(_vm.$scopedSlots, function (index, name) {
                  return {
                    key: name,
                    fn: function (deliver) {
                      return [_vm._t(name, null, null, deliver)]
                    },
                  }
                }),
              ],
              null,
              true
            ),
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3j = [];
__vue_render__$3j._withStripped = true;

  /* style */
  const __vue_inject_styles__$3j = undefined;
  /* scoped */
  const __vue_scope_id__$3j = "data-v-f04b1f34";
  /* module identifier */
  const __vue_module_identifier__$3j = undefined;
  /* functional template */
  const __vue_is_functional_template__$3j = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3j = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3j, staticRenderFns: __vue_staticRenderFns__$3j },
    __vue_inject_styles__$3j,
    __vue_script__$3j,
    __vue_scope_id__$3j,
    __vue_is_functional_template__$3j,
    __vue_module_identifier__$3j,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3j.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-text-group-render', {
    prefix: options.prefix
  }), __vue_component__$3j);
};

//
var script$3i = {
  name: "XmlSingleVideoGroupRender",
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: "视频",
      videoDataName: "videoData",
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return "editor";
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: "h5"
    },
    resourceBasisPath: {
      type: String,
      default: ""
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    videoImg: {
      type: Boolean,
      default: false
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit("blockclick", {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    }
  }
};

/* script */
const __vue_script__$3i = script$3i;
/* template */
var __vue_render__$3i = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-video-group",
        "xml-single-video-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _vm.videoImg
            ? _c("xml-video-img-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.videoDataName],
                  "current-rule": _vm.currentRule,
                  "block-data-name": _vm.videoDataName,
                  "extend-params": _vm.extendParams,
                  "rule-index": _vm.ruleIndex,
                  resourceBasisPath: _vm.resourceBasisPath,
                  mode: _vm.mode,
                },
                on: { blockclick: _vm.handleBlockClick },
              })
            : _c("xml-video-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.videoDataName],
                  "current-rule": _vm.currentRule,
                  "block-data-name": _vm.videoDataName,
                  "extend-params": _vm.extendParams,
                  "rule-index": _vm.ruleIndex,
                  resourceBasisPath: _vm.resourceBasisPath,
                  mode: _vm.mode,
                },
                on: { blockclick: _vm.handleBlockClick },
              }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3i = [];
__vue_render__$3i._withStripped = true;

  /* style */
  const __vue_inject_styles__$3i = undefined;
  /* scoped */
  const __vue_scope_id__$3i = "data-v-a0261188";
  /* module identifier */
  const __vue_module_identifier__$3i = undefined;
  /* functional template */
  const __vue_is_functional_template__$3i = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3i = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3i, staticRenderFns: __vue_staticRenderFns__$3i },
    __vue_inject_styles__$3i,
    __vue_script__$3i,
    __vue_scope_id__$3i,
    __vue_is_functional_template__$3i,
    __vue_module_identifier__$3i,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3i.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-video-group-render', {
    prefix: options.prefix
  }), __vue_component__$3i);
};

//
var script$3h = {
  name: 'XmlSingleRecorderGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '录音',
      recorderDataName: 'recorderData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    getresdata({
      blob,
      duration
    }) {
      this.$emit('getresdata', {
        blob,
        duration
      });
    }
  }
};

/* script */
const __vue_script__$3h = script$3h;

/* template */
var __vue_render__$3h = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-recorder-group",
        "xml-single-recorder-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-recorder-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.recorderDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.recorderDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: {
              blockclick: _vm.handleBlockClick,
              getresdata: _vm.getresdata,
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3h = [];
__vue_render__$3h._withStripped = true;

  /* style */
  const __vue_inject_styles__$3h = undefined;
  /* scoped */
  const __vue_scope_id__$3h = undefined;
  /* module identifier */
  const __vue_module_identifier__$3h = undefined;
  /* functional template */
  const __vue_is_functional_template__$3h = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3h = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3h, staticRenderFns: __vue_staticRenderFns__$3h },
    __vue_inject_styles__$3h,
    __vue_script__$3h,
    __vue_scope_id__$3h,
    __vue_is_functional_template__$3h,
    __vue_module_identifier__$3h,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3h.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1(__vue_component__$3h.name, {
    prefix: options.prefix
  }), __vue_component__$3h);
};

//
var script$3g = {
  name: 'XmlSingleVoiceGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '录音',
      recorderDataName: 'recorderData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    sourcedata: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  watch: {
    currentRule: {
      handler(newValue) {
        this.groupData = newValue.data.pGroupData;
      },
      deep: true,
      immediate: true
    }
  },
  created() {
    this.groupData = this.pGroupData;
    console.log(this.sourcedata, 'group页');
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    getresdata({
      blob,
      duration
    }) {
      this.$emit('getresdata', {
        blob,
        duration
      });
    },
    ratedata({
      ratingData,
      ruleIndex,
      dataName
    }) {
      this.$emit('ratedata', {
        ratingData: ratingData,
        ruleIndex: ruleIndex,
        dataName: dataName
      });
    }
  }
};

/* script */
const __vue_script__$3g = script$3g;

/* template */
var __vue_render__$3g = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-recorder-group",
        "xml-single-recorder-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-voice-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.recorderDataName],
              voicedata: _vm.groupData,
              sourcedata: _vm.sourcedata,
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.recorderDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              mode: _vm.mode,
              "page-type": _vm.pageType,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: {
              blockclick: _vm.handleBlockClick,
              getresdata: _vm.getresdata,
              ratedata: _vm.ratedata,
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3g = [];
__vue_render__$3g._withStripped = true;

  /* style */
  const __vue_inject_styles__$3g = undefined;
  /* scoped */
  const __vue_scope_id__$3g = undefined;
  /* module identifier */
  const __vue_module_identifier__$3g = undefined;
  /* functional template */
  const __vue_is_functional_template__$3g = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3g = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3g, staticRenderFns: __vue_staticRenderFns__$3g },
    __vue_inject_styles__$3g,
    __vue_script__$3g,
    __vue_scope_id__$3g,
    __vue_is_functional_template__$3g,
    __vue_module_identifier__$3g,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3g.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1(__vue_component__$3g.name, {
    prefix: options.prefix
  }), __vue_component__$3g);
};

//
/**
 * 热点组
 */
var script$3f = {
  name: 'XmlSingleHotzoneGroupRender',
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    max: {
      type: Number,
      default: 10
    }
  },
  provide() {
    return {
      getSelfRuleIndex: () => {
        return this.ruleIndex;
      }
    };
  },
  data() {
    return {
      typeText: '热区',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      blockDataKey: 'xmlBlockData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  watch: {
    pGroupData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.groupData = Object.assign({}, this.groupData, newValue);
        });
      },
      deep: true,
      immediate: true
    }
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      console.log('触发');
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    remove(curZone, index) {
      this.$emit('remove', curZone, index);
    }
  }
};

/* script */
const __vue_script__$3f = script$3f;

/* template */
var __vue_render__$3f = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-hotzone-group",
        "xml-single-hotzone-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": "pc",
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-hotzone-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.blockDataKey],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.blockDataKey,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              "show-title": true,
              mode: _vm.mode,
              max: _vm.max,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: {
              blockclick: _vm.handleBlockClick,
              "wrap-click": _vm.handleBlockClick,
              remove: _vm.remove,
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3f = [];
__vue_render__$3f._withStripped = true;

  /* style */
  const __vue_inject_styles__$3f = undefined;
  /* scoped */
  const __vue_scope_id__$3f = undefined;
  /* module identifier */
  const __vue_module_identifier__$3f = undefined;
  /* functional template */
  const __vue_is_functional_template__$3f = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3f = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3f, staticRenderFns: __vue_staticRenderFns__$3f },
    __vue_inject_styles__$3f,
    __vue_script__$3f,
    __vue_scope_id__$3f,
    __vue_is_functional_template__$3f,
    __vue_module_identifier__$3f,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3f.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-hotzone-group-render', {
    prefix: options.prefix
  }), __vue_component__$3f);
};

//
/**
 * 热点组
 */
var script$3e = {
  name: 'XmlSingleLayoutGroupRender',
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    // activeIndex: {
    //   type: Number,
    //   default: -1
    // },
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    max: {
      type: Number,
      default: 10
    }
  },
  provide() {
    return {
      getSelfRuleIndex: () => {
        return this.ruleIndex;
      }
    };
  },
  data() {
    return {
      typeText: '分栏布局',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      blockDataKey: 'xmlBlockData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  // watch: {
  //   pGroupData: {
  //     handler(newValue) {
  //       this.$nextTick(() => {
  //         this.groupData = Object.assign({}, this.groupData, newValue)
  //       })
  //     },
  //     deep: true,
  //     immediate: true
  //   }
  // },

  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      console.log('触发块点击');
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    }
  }
};

/* script */
const __vue_script__$3e = script$3e;

/* template */
var __vue_render__$3e = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-layout-group",
        "xml-single-layout-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "xml-layout-render",
            {
              attrs: {
                "p-block-data": _vm.groupData[_vm.blockDataKey],
                "current-rule": _vm.currentRule,
                blockDataName: _vm.blockDataKey,
                "extend-params": _vm.extendParams,
                "rule-index": _vm.ruleIndex,
                "show-title": true,
                mode: _vm.mode,
                max: _vm.max,
                bindingComponents: _vm.currentRule.bindingComponents,
                resourceBasisPath: _vm.resourceBasisPath,
              },
              on: { blockclick: _vm.handleBlockClick },
            },
            [
              _vm.$slots.injectComponents
                ? [_vm._t("injectComponents")]
                : _vm._e(),
            ],
            2
          ),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3e = [];
__vue_render__$3e._withStripped = true;

  /* style */
  const __vue_inject_styles__$3e = undefined;
  /* scoped */
  const __vue_scope_id__$3e = undefined;
  /* module identifier */
  const __vue_module_identifier__$3e = undefined;
  /* functional template */
  const __vue_is_functional_template__$3e = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3e = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3e, staticRenderFns: __vue_staticRenderFns__$3e },
    __vue_inject_styles__$3e,
    __vue_script__$3e,
    __vue_scope_id__$3e,
    __vue_is_functional_template__$3e,
    __vue_module_identifier__$3e,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3e.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-layout-group-render', {
    prefix: options.prefix
  }), __vue_component__$3e);
};

const needWrapComponents = ['xml-single-text-group', 'imageTextFirst', 'imageTextSecond', 'imageTextThird', 'imageTextFourth', 'imageTextFifth', 'imageTextSixth', 'imageTextSeventh', 'titleFirst', 'titleSecond', 'titleThird', 'titleHexagon', 'titleFifth', 'titleSixth', 'titleTriangle', 'titleRectangle', 'titleRotundity', 'titleSquare', 'titleSemicircle', 'titleTwelfth', 'titlethirteenth', 'titlefourteen', 'titleFifteen', 'titleSixteen', 'titleSeventeen', 'titleEighteen', 'titleNineteen', 'titleGreentheme1', 'titleGreentheme2', 'titleGreentheme3', 'titleGreentheme4', 'titleGreentheme5', 'titleGreentheme6', 'titleYellowtheme1', 'titleYellowtheme2', 'titleYellowtheme3', 'titleYellowtheme4', 'titleYellowtheme5', 'titleYellowtheme6', 'titleKnowledge', 'paragraphFirst', 'paragraphSecond', 'paragraphThird', 'paragraphQuadrangle', 'paragraphIsosceles', 'paragrapheighth', 'paragraphninth', 'paragraphtenth', 'paragraphWave', 'paragraphSeventh', 'paragraphEleven', 'paragraphTwelve', 'paragraphThirteen', 'paragraphFourteen', 'paragraphFifteen', 'paragraphGreentheme2', 'paragraphGreentheme3', 'paragraphGreentheme4', 'paragraphGreentheme5', 'paragraphYellowtheme1', 'paragraphYellowtheme2', 'paragraphYellowtheme3', 'paragraphYellowtheme4', 'paragraphYellowtheme5', 'paragraphRedtheme1', 'paragraphRedtheme2', 'paragraphRedtheme3', 'paragraphRedtheme4', 'paragraphRedtheme5', 'paragraphRedtheme6', 'paragraphSixteen', 'splitlineFirst', 'splitlineSecond', 'splitlineThird', 'splitlineFourth', 'splitlineFifth', 'splitlineSixth', 'splitlineSeventh', 'splitlineEighth', 'splitlineNinth', 'splitlineTenth', 'splitlineEleventh', 'splitlineGreytheme1', 'splitlineGreytheme2', 'splitlineGreytheme3', 'splitlineGreytheme4', 'splitlineGreytheme5', 'splitlineGreytheme6', 'splitlineYellowtheme1', 'splitlineYellowtheme2', 'splitlineYellowtheme3', 'splitlineYellowtheme4', 'splitlineRedtheme1', 'splitlineRedtheme2', 'splitlineRedtheme3', 'splitlineRedtheme4', 'splitlineGreentheme1', 'splitlineGreentheme2', 'splitlineGreentheme3', 'splitlineGreentheme4', 'splitlineBluetheme1', 'splitlineBluetheme2', 'splitlineBluetheme3', 'splitlineBluetheme4', 'titleThirdLibrary', 'titleFirstLibrary', 'titleSixthLibrary', 'titleRectangleLibrary', 'titleSemicircleLibrary', 'titleYellowtheme1Library', 'titleYellowtheme2Library', 'titleYellowtheme4Library', 'titleYellowtheme5Library', 'titleYellowtheme6Library', 'titleThirteenthLibrary', 'titleTwelfthLibrary', 'titleGreentheme1Library', 'titleGreentheme2Library', 'titleGreentheme3Library', 'titleGreentheme4Library', 'titleGreentheme6Library', 'titleNineteenLibrary', 'titleHexagonLibrary', 'titleFourteenLibrary', 'titleSeventeenLibrary', 'titleSixteenLibrary', 'titleFifteenLibrary', 'titleKnowledgeLibrary', 'titleFifthLibrary', 'titleTriangleLibrary', 'paragraphFirstLibrary', 'paragraphSecondLibrary', 'paragraphThirdLibrary', 'paragraphQuadrangleLibrary', 'paragraphIsoscelesLibrary', 'paragraphNinthLibrary', 'paragraphEighthLibrary', 'paragraphTenthLibrary', 'paragraphSixteenLibrary', 'paragraphSeventhLibrary', 'paragraphElevenLibrary', 'paragraphThirteenLibrary', 'paragraphFourteenLibrary', 'paragraphGreentheme2Library', 'paragraphGreentheme3Library', 'paragraphGreentheme4Library', 'paragraphGreentheme5Library', 'paragraphYellowtheme1Library', 'paragraphYellowtheme2Library', 'paragraphYellowtheme3Library', 'paragraphYellowtheme4Library', 'paragraphYellowtheme5Library', 'paragraphRedtheme1Library', 'paragraphRedtheme2Library', 'paragraphRedtheme3Library', 'paragraphRedtheme4Library', 'paragraphRedtheme5Library', 'imageTextFirstLibrary', 'imageTextSecondLibrary', 'imageTextThirdLibrary', 'imageTextFourthLibrary', 'imageTextFifthLibrary', 'imageTextSixthLibrary', 'imageTextSeventhLibrary', 'splitlineFirstLibrary', 'splitlineSecondLibrary', 'splitlineFourthLibrary', 'splitlineFifthLibrary', 'splitlineSixthLibrary', 'splitlineSeventhLibrary', 'splitlineEighthLibrary', 'splitlineTenthLibrary', 'splitlineEleventhLibrary', 'splitlineNinthLibrary', 'splitlineRedtheme1Library', 'splitlineGreytheme2Library', 'splitlineGreytheme3Library', 'splitlineGreytheme5Library', 'splitlineYellowtheme3Library', 'splitlineBluetheme1Library', 'splitlineBluetheme2Library', 'splitlineYellowtheme2Library', 'splitlineRedtheme4Library', 'splitlineYellowtheme1Library', 'splitlineGreytheme1Library', 'splitlineBluetheme4Library', 'titleRedtheme1Library', 'titleRedtheme2Library', 'titleRedtheme3Library', 'titleRedtheme4Library', 'paragraphRedtheme6Library', 'paragraphRedtheme7Library', 'paragraphFoldtheme1Library', 'paragraphFoldtheme2Library', 'paragraphFoldtheme3Library', 'paragraphTabstheme1Library', 'paragraphTabstheme2Library', 'paragraphTabstheme3Library', 'paragraphTabstheme4Library', 'titleSanQintheme1', 'titleSanQintheme2', 'titleSanQintheme3', 'paragraphSanQintheme1', 'paragraphSanQintheme2', 'paragraphSanQintheme3', 'paragraphSanQintheme1Library', 'paragraphTwelveLibrary', 'titleThirtyoneLibrary', 'titleThirtytwoLibrary', 'titleThirtythreeLibrary', 'titleThirtyfourLibrary', 'titleThirtyfiveLibrary', 'titleThirtysixLibrary', 'titleThirtysevenLibrary', 'titleThirtyeightLibrary', 'paragraphFoldtheme4Library', 'paragraphFoldtheme5Library', 'paragraphTabstheme5Library', 'paragraphTabstheme6Library', 'paragraphFortytwoLibrary', 'paragraphFortythreeLibrary', 'paragraphFortyfourLibrary', 'paragraphFortyfiveLibrary'];
const toKebabCase = value => {
  if (allCapital(value)) {
    return value.toLocaleLowerCase();
  }
  return value.charAt(0).toLowerCase() + value.slice(1).replace(/([A-Z])/g, '-$1').toLowerCase();
};
const isComponentNameNeedEditorWrap = name => {
  if (needWrapComponents.includes(name)) {
    let formated;
    if (name.includes('-')) {
      formated = name + '-editor';
    } else {
      formated = toKebabCase(name) + '-editor';
    }
    return formated;
  }
  return name + '-render';
};

//
/**
 * SingleGroup代理
 */
var script$3d = {
  name: 'XmlSingleAgentGroupRender',
  components: {
    Portal
  },
  props: {
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      // typeText: '分栏布局',
      // //定义此变量，是为了解决页面中有多个块儿的情况。
      // blockDataKey: 'xmlBlockData',
      // groupData: {}
    };
  },
  computed: {
    isInjectSingleGroup() {
      return !!this.currentRule.trueComponentsName && !!this.currentRule.injectTarget;
    }
  },
  // created() {
  // },
  // watch: {
  //   pGroupData: {
  //     handler(newValue) {
  //       this.$nextTick(() => {
  //         this.groupData = Object.assign({}, this.groupData, newValue)
  //       })
  //     },
  //     deep: true,
  //     immediate: true
  //   }
  // },

  mounted() {},
  methods: {
    isComponentNameNeedEditorWrap,
    forwordAreaboxInjectClick(e) {
      this.$emit('agentClick', this.currentRule);
    }
  }
};

/* script */
const __vue_script__$3d = script$3d;
/* template */
var __vue_render__$3d = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "Portal",
    {
      staticClass: "parent-group parent-group-mark xml-single-agent-group",
      attrs: { to: this.currentRule.injectTarget },
    },
    [
      _c(
        _vm.isComponentNameNeedEditorWrap(_vm.currentRule.trueComponentsName),
        _vm._g(
          _vm._b(
            {
              tag: "component",
              attrs: {
                currentRule: _vm.currentRule,
                isInAgent: true,
                scopedSlots: { $scopedSlots: _vm.$scopedSlots },
              },
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  return _vm.forwordAreaboxInjectClick.apply(null, arguments)
                },
              },
              scopedSlots: _vm._u(
                [
                  _vm._l(_vm.$scopedSlots, function (index, name) {
                    return {
                      key: name,
                      fn: function (deliver) {
                        return [_vm._t(name, null, null, deliver)]
                      },
                    }
                  }),
                ],
                null,
                true
              ),
            },
            "component",
            _vm.$attrs,
            false
          ),
          _vm.$listeners
        )
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3d = [];
__vue_render__$3d._withStripped = true;

  /* style */
  const __vue_inject_styles__$3d = undefined;
  /* scoped */
  const __vue_scope_id__$3d = "data-v-4172b6f6";
  /* module identifier */
  const __vue_module_identifier__$3d = undefined;
  /* functional template */
  const __vue_is_functional_template__$3d = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3d = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3d, staticRenderFns: __vue_staticRenderFns__$3d },
    __vue_inject_styles__$3d,
    __vue_script__$3d,
    __vue_scope_id__$3d,
    __vue_is_functional_template__$3d,
    __vue_module_identifier__$3d,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3d.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-agent-group-render', {
    prefix: options.prefix
  }), __vue_component__$3d);
};

//
var script$3c = {
  name: 'XmlSingleSkeletonGroupRender',
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: '录音',
      recorderDataName: 'recorderData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    sourcedata: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    pageHeight: {
      type: Number,
      default: 600
    }
  },
  watch: {
    currentRule: {
      handler(newValue) {
        this.groupData = newValue.data.pGroupData;
      },
      deep: true,
      immediate: true
    }
  },
  created() {
    this.groupData = this.pGroupData;
    // console.log(this.sourcedata,'group页');
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    getresdata({
      blob,
      duration
    }) {
      this.$emit('getresdata', {
        blob,
        duration
      });
    },
    ratedata({
      ratingData,
      ruleIndex,
      dataName
    }) {
      this.$emit('ratedata', {
        ratingData: ratingData,
        ruleIndex: ruleIndex,
        dataName: dataName
      });
    }
  }
};

/* script */
const __vue_script__$3c = script$3c;
/* template */
var __vue_render__$3c = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-recorder-group",
        "xml-single-recorder-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: {
        height: _vm.pageHeight + "px",
        overflow: "hidden",
      },
      on: { click: _vm.emitClick },
    },
    [_c("div", { staticClass: "xml-skeleton-item" })]
  )
};
var __vue_staticRenderFns__$3c = [];
__vue_render__$3c._withStripped = true;

  /* style */
  const __vue_inject_styles__$3c = undefined;
  /* scoped */
  const __vue_scope_id__$3c = undefined;
  /* module identifier */
  const __vue_module_identifier__$3c = undefined;
  /* functional template */
  const __vue_is_functional_template__$3c = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3c = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3c, staticRenderFns: __vue_staticRenderFns__$3c },
    __vue_inject_styles__$3c,
    __vue_script__$3c,
    __vue_scope_id__$3c,
    __vue_is_functional_template__$3c,
    __vue_module_identifier__$3c,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3c.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1(__vue_component__$3c.name, {
    prefix: options.prefix
  }), __vue_component__$3c);
};

//
//
//
//
//
//
//
//

var script$3b = {
  name: 'renderGroupRender',
  isUnPrefix: true,
  data() {
    return {
      typeText: '',
      titleTextDataName: 'renderData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      console.log('接收块儿点击事件，数据：', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName: '',
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName: '',
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$3b = script$3b;
/* template */
var __vue_render__$3b = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "parent-group parent-group-mark" },
    [
      _c("xml-render", {
        attrs: {
          mode: _vm.mode,
          pGroupData: _vm.pGroupData,
          currentRule: _vm.currentRule,
          "rule-index": _vm.ruleIndex,
        },
        on: { blockclick: _vm.handleBlockClick },
      }),
    ],
    1
  )
};
var __vue_staticRenderFns__$3b = [];
__vue_render__$3b._withStripped = true;

  /* style */
  const __vue_inject_styles__$3b = undefined;
  /* scoped */
  const __vue_scope_id__$3b = "data-v-07f11a56";
  /* module identifier */
  const __vue_module_identifier__$3b = undefined;
  /* functional template */
  const __vue_is_functional_template__$3b = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3b = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3b, staticRenderFns: __vue_staticRenderFns__$3b },
    __vue_inject_styles__$3b,
    __vue_script__$3b,
    __vue_scope_id__$3b,
    __vue_is_functional_template__$3b,
    __vue_module_identifier__$3b,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3b.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('renderGroupRender', {
    prefix: options.prefix
  }), __vue_component__$3b);
};

// This file is autogenerated. It's used to publish ESM to npm.
function _typeof(obj) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
    return typeof obj;
  } : function (obj) {
    return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  }, _typeof(obj);
}

// https://github.com/bgrins/TinyColor
// Brian Grinstead, MIT License

var trimLeft = /^\s+/;
var trimRight = /\s+$/;
function tinycolor(color, opts) {
  color = color ? color : "";
  opts = opts || {};

  // If input is already a tinycolor, return itself
  if (color instanceof tinycolor) {
    return color;
  }
  // If we are called as a function, call using new instead
  if (!(this instanceof tinycolor)) {
    return new tinycolor(color, opts);
  }
  var rgb = inputToRGB(color);
  this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
  this._gradientType = opts.gradientType;

  // Don't let the range of [0,255] come back in [0,1].
  // Potentially lose a little bit of precision here, but will fix issues where
  // .5 gets interpreted as half of the total, instead of half of 1
  // If it was supposed to be 128, this was already taken care of by `inputToRgb`
  if (this._r < 1) this._r = Math.round(this._r);
  if (this._g < 1) this._g = Math.round(this._g);
  if (this._b < 1) this._b = Math.round(this._b);
  this._ok = rgb.ok;
}
tinycolor.prototype = {
  isDark: function isDark() {
    return this.getBrightness() < 128;
  },
  isLight: function isLight() {
    return !this.isDark();
  },
  isValid: function isValid() {
    return this._ok;
  },
  getOriginalInput: function getOriginalInput() {
    return this._originalInput;
  },
  getFormat: function getFormat() {
    return this._format;
  },
  getAlpha: function getAlpha() {
    return this._a;
  },
  getBrightness: function getBrightness() {
    //http://www.w3.org/TR/AERT#color-contrast
    var rgb = this.toRgb();
    return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
  },
  getLuminance: function getLuminance() {
    //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
    var rgb = this.toRgb();
    var RsRGB, GsRGB, BsRGB, R, G, B;
    RsRGB = rgb.r / 255;
    GsRGB = rgb.g / 255;
    BsRGB = rgb.b / 255;
    if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
    if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
    if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
    return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  },
  setAlpha: function setAlpha(value) {
    this._a = boundAlpha(value);
    this._roundA = Math.round(100 * this._a) / 100;
    return this;
  },
  toHsv: function toHsv() {
    var hsv = rgbToHsv(this._r, this._g, this._b);
    return {
      h: hsv.h * 360,
      s: hsv.s,
      v: hsv.v,
      a: this._a
    };
  },
  toHsvString: function toHsvString() {
    var hsv = rgbToHsv(this._r, this._g, this._b);
    var h = Math.round(hsv.h * 360),
      s = Math.round(hsv.s * 100),
      v = Math.round(hsv.v * 100);
    return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
  },
  toHsl: function toHsl() {
    var hsl = rgbToHsl(this._r, this._g, this._b);
    return {
      h: hsl.h * 360,
      s: hsl.s,
      l: hsl.l,
      a: this._a
    };
  },
  toHslString: function toHslString() {
    var hsl = rgbToHsl(this._r, this._g, this._b);
    var h = Math.round(hsl.h * 360),
      s = Math.round(hsl.s * 100),
      l = Math.round(hsl.l * 100);
    return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
  },
  toHex: function toHex(allow3Char) {
    return rgbToHex(this._r, this._g, this._b, allow3Char);
  },
  toHexString: function toHexString(allow3Char) {
    return "#" + this.toHex(allow3Char);
  },
  toHex8: function toHex8(allow4Char) {
    return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
  },
  toHex8String: function toHex8String(allow4Char) {
    return "#" + this.toHex8(allow4Char);
  },
  toRgb: function toRgb() {
    return {
      r: Math.round(this._r),
      g: Math.round(this._g),
      b: Math.round(this._b),
      a: this._a
    };
  },
  toRgbString: function toRgbString() {
    return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
  },
  toPercentageRgb: function toPercentageRgb() {
    return {
      r: Math.round(bound01(this._r, 255) * 100) + "%",
      g: Math.round(bound01(this._g, 255) * 100) + "%",
      b: Math.round(bound01(this._b, 255) * 100) + "%",
      a: this._a
    };
  },
  toPercentageRgbString: function toPercentageRgbString() {
    return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
  },
  toName: function toName() {
    if (this._a === 0) {
      return "transparent";
    }
    if (this._a < 1) {
      return false;
    }
    return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
  },
  toFilter: function toFilter(secondColor) {
    var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
    var secondHex8String = hex8String;
    var gradientType = this._gradientType ? "GradientType = 1, " : "";
    if (secondColor) {
      var s = tinycolor(secondColor);
      secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
    }
    return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
  },
  toString: function toString(format) {
    var formatSet = !!format;
    format = format || this._format;
    var formattedString = false;
    var hasAlpha = this._a < 1 && this._a >= 0;
    var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
    if (needsAlphaFormat) {
      // Special case for "transparent", all other non-alpha formats
      // will return rgba when there is transparency.
      if (format === "name" && this._a === 0) {
        return this.toName();
      }
      return this.toRgbString();
    }
    if (format === "rgb") {
      formattedString = this.toRgbString();
    }
    if (format === "prgb") {
      formattedString = this.toPercentageRgbString();
    }
    if (format === "hex" || format === "hex6") {
      formattedString = this.toHexString();
    }
    if (format === "hex3") {
      formattedString = this.toHexString(true);
    }
    if (format === "hex4") {
      formattedString = this.toHex8String(true);
    }
    if (format === "hex8") {
      formattedString = this.toHex8String();
    }
    if (format === "name") {
      formattedString = this.toName();
    }
    if (format === "hsl") {
      formattedString = this.toHslString();
    }
    if (format === "hsv") {
      formattedString = this.toHsvString();
    }
    return formattedString || this.toHexString();
  },
  clone: function clone() {
    return tinycolor(this.toString());
  },
  _applyModification: function _applyModification(fn, args) {
    var color = fn.apply(null, [this].concat([].slice.call(args)));
    this._r = color._r;
    this._g = color._g;
    this._b = color._b;
    this.setAlpha(color._a);
    return this;
  },
  lighten: function lighten() {
    return this._applyModification(_lighten, arguments);
  },
  brighten: function brighten() {
    return this._applyModification(_brighten, arguments);
  },
  darken: function darken() {
    return this._applyModification(_darken, arguments);
  },
  desaturate: function desaturate() {
    return this._applyModification(_desaturate, arguments);
  },
  saturate: function saturate() {
    return this._applyModification(_saturate, arguments);
  },
  greyscale: function greyscale() {
    return this._applyModification(_greyscale, arguments);
  },
  spin: function spin() {
    return this._applyModification(_spin, arguments);
  },
  _applyCombination: function _applyCombination(fn, args) {
    return fn.apply(null, [this].concat([].slice.call(args)));
  },
  analogous: function analogous() {
    return this._applyCombination(_analogous, arguments);
  },
  complement: function complement() {
    return this._applyCombination(_complement, arguments);
  },
  monochromatic: function monochromatic() {
    return this._applyCombination(_monochromatic, arguments);
  },
  splitcomplement: function splitcomplement() {
    return this._applyCombination(_splitcomplement, arguments);
  },
  // Disabled until https://github.com/bgrins/TinyColor/issues/254
  // polyad: function (number) {
  //   return this._applyCombination(polyad, [number]);
  // },
  triad: function triad() {
    return this._applyCombination(polyad, [3]);
  },
  tetrad: function tetrad() {
    return this._applyCombination(polyad, [4]);
  }
};

// If input is an object, force 1 into "1.0" to handle ratios properly
// String input requires "1.0" as input, so 1 will be treated as 1
tinycolor.fromRatio = function (color, opts) {
  if (_typeof(color) == "object") {
    var newColor = {};
    for (var i in color) {
      if (color.hasOwnProperty(i)) {
        if (i === "a") {
          newColor[i] = color[i];
        } else {
          newColor[i] = convertToPercentage(color[i]);
        }
      }
    }
    color = newColor;
  }
  return tinycolor(color, opts);
};

// Given a string or object, convert that input to RGB
// Possible string inputs:
//
//     "red"
//     "#f00" or "f00"
//     "#ff0000" or "ff0000"
//     "#ff000000" or "ff000000"
//     "rgb 255 0 0" or "rgb (255, 0, 0)"
//     "rgb 1.0 0 0" or "rgb (1, 0, 0)"
//     "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
//     "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
//     "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
//     "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
//     "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
//
function inputToRGB(color) {
  var rgb = {
    r: 0,
    g: 0,
    b: 0
  };
  var a = 1;
  var s = null;
  var v = null;
  var l = null;
  var ok = false;
  var format = false;
  if (typeof color == "string") {
    color = stringInputToObject(color);
  }
  if (_typeof(color) == "object") {
    if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
      rgb = rgbToRgb(color.r, color.g, color.b);
      ok = true;
      format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
    } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
      s = convertToPercentage(color.s);
      v = convertToPercentage(color.v);
      rgb = hsvToRgb(color.h, s, v);
      ok = true;
      format = "hsv";
    } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
      s = convertToPercentage(color.s);
      l = convertToPercentage(color.l);
      rgb = hslToRgb(color.h, s, l);
      ok = true;
      format = "hsl";
    }
    if (color.hasOwnProperty("a")) {
      a = color.a;
    }
  }
  a = boundAlpha(a);
  return {
    ok: ok,
    format: color.format || format,
    r: Math.min(255, Math.max(rgb.r, 0)),
    g: Math.min(255, Math.max(rgb.g, 0)),
    b: Math.min(255, Math.max(rgb.b, 0)),
    a: a
  };
}

// Conversion Functions
// --------------------

// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>

// `rgbToRgb`
// Handle bounds / percentage checking to conform to CSS color spec
// <http://www.w3.org/TR/css3-color/>
// *Assumes:* r, g, b in [0, 255] or [0, 1]
// *Returns:* { r, g, b } in [0, 255]
function rgbToRgb(r, g, b) {
  return {
    r: bound01(r, 255) * 255,
    g: bound01(g, 255) * 255,
    b: bound01(b, 255) * 255
  };
}

// `rgbToHsl`
// Converts an RGB color value to HSL.
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
// *Returns:* { h, s, l } in [0,1]
function rgbToHsl(r, g, b) {
  r = bound01(r, 255);
  g = bound01(g, 255);
  b = bound01(b, 255);
  var max = Math.max(r, g, b),
    min = Math.min(r, g, b);
  var h,
    s,
    l = (max + min) / 2;
  if (max == min) {
    h = s = 0; // achromatic
  } else {
    var d = max - min;
    s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
    switch (max) {
      case r:
        h = (g - b) / d + (g < b ? 6 : 0);
        break;
      case g:
        h = (b - r) / d + 2;
        break;
      case b:
        h = (r - g) / d + 4;
        break;
    }
    h /= 6;
  }
  return {
    h: h,
    s: s,
    l: l
  };
}

// `hslToRgb`
// Converts an HSL color value to RGB.
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
// *Returns:* { r, g, b } in the set [0, 255]
function hslToRgb(h, s, l) {
  var r, g, b;
  h = bound01(h, 360);
  s = bound01(s, 100);
  l = bound01(l, 100);
  function hue2rgb(p, q, t) {
    if (t < 0) t += 1;
    if (t > 1) t -= 1;
    if (t < 1 / 6) return p + (q - p) * 6 * t;
    if (t < 1 / 2) return q;
    if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
    return p;
  }
  if (s === 0) {
    r = g = b = l; // achromatic
  } else {
    var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
    var p = 2 * l - q;
    r = hue2rgb(p, q, h + 1 / 3);
    g = hue2rgb(p, q, h);
    b = hue2rgb(p, q, h - 1 / 3);
  }
  return {
    r: r * 255,
    g: g * 255,
    b: b * 255
  };
}

// `rgbToHsv`
// Converts an RGB color value to HSV
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
// *Returns:* { h, s, v } in [0,1]
function rgbToHsv(r, g, b) {
  r = bound01(r, 255);
  g = bound01(g, 255);
  b = bound01(b, 255);
  var max = Math.max(r, g, b),
    min = Math.min(r, g, b);
  var h,
    s,
    v = max;
  var d = max - min;
  s = max === 0 ? 0 : d / max;
  if (max == min) {
    h = 0; // achromatic
  } else {
    switch (max) {
      case r:
        h = (g - b) / d + (g < b ? 6 : 0);
        break;
      case g:
        h = (b - r) / d + 2;
        break;
      case b:
        h = (r - g) / d + 4;
        break;
    }
    h /= 6;
  }
  return {
    h: h,
    s: s,
    v: v
  };
}

// `hsvToRgb`
// Converts an HSV color value to RGB.
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
// *Returns:* { r, g, b } in the set [0, 255]
function hsvToRgb(h, s, v) {
  h = bound01(h, 360) * 6;
  s = bound01(s, 100);
  v = bound01(v, 100);
  var i = Math.floor(h),
    f = h - i,
    p = v * (1 - s),
    q = v * (1 - f * s),
    t = v * (1 - (1 - f) * s),
    mod = i % 6,
    r = [v, q, p, p, t, v][mod],
    g = [t, v, v, q, p, p][mod],
    b = [p, p, t, v, v, q][mod];
  return {
    r: r * 255,
    g: g * 255,
    b: b * 255
  };
}

// `rgbToHex`
// Converts an RGB color to hex
// Assumes r, g, and b are contained in the set [0, 255]
// Returns a 3 or 6 character hex
function rgbToHex(r, g, b, allow3Char) {
  var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];

  // Return a 3 character hex if possible
  if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
    return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  }
  return hex.join("");
}

// `rgbaToHex`
// Converts an RGBA color plus alpha transparency to hex
// Assumes r, g, b are contained in the set [0, 255] and
// a in [0, 1]. Returns a 4 or 8 character rgba hex
function rgbaToHex(r, g, b, a, allow4Char) {
  var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];

  // Return a 4 character hex if possible
  if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
    return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  }
  return hex.join("");
}

// `rgbaToArgbHex`
// Converts an RGBA color to an ARGB Hex8 string
// Rarely used, but required for "toFilter()"
function rgbaToArgbHex(r, g, b, a) {
  var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
  return hex.join("");
}

// `equals`
// Can be called with any tinycolor input
tinycolor.equals = function (color1, color2) {
  if (!color1 || !color2) return false;
  return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
};
tinycolor.random = function () {
  return tinycolor.fromRatio({
    r: Math.random(),
    g: Math.random(),
    b: Math.random()
  });
};

// Modification Functions
// ----------------------
// Thanks to less.js for some of the basics here
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>

function _desaturate(color, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color).toHsl();
  hsl.s -= amount / 100;
  hsl.s = clamp01(hsl.s);
  return tinycolor(hsl);
}
function _saturate(color, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color).toHsl();
  hsl.s += amount / 100;
  hsl.s = clamp01(hsl.s);
  return tinycolor(hsl);
}
function _greyscale(color) {
  return tinycolor(color).desaturate(100);
}
function _lighten(color, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color).toHsl();
  hsl.l += amount / 100;
  hsl.l = clamp01(hsl.l);
  return tinycolor(hsl);
}
function _brighten(color, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var rgb = tinycolor(color).toRgb();
  rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  return tinycolor(rgb);
}
function _darken(color, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color).toHsl();
  hsl.l -= amount / 100;
  hsl.l = clamp01(hsl.l);
  return tinycolor(hsl);
}

// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
// Values outside of this range will be wrapped into this range.
function _spin(color, amount) {
  var hsl = tinycolor(color).toHsl();
  var hue = (hsl.h + amount) % 360;
  hsl.h = hue < 0 ? 360 + hue : hue;
  return tinycolor(hsl);
}

// Combination Functions
// ---------------------
// Thanks to jQuery xColor for some of the ideas behind these
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>

function _complement(color) {
  var hsl = tinycolor(color).toHsl();
  hsl.h = (hsl.h + 180) % 360;
  return tinycolor(hsl);
}
function polyad(color, number) {
  if (isNaN(number) || number <= 0) {
    throw new Error("Argument to polyad must be a positive number");
  }
  var hsl = tinycolor(color).toHsl();
  var result = [tinycolor(color)];
  var step = 360 / number;
  for (var i = 1; i < number; i++) {
    result.push(tinycolor({
      h: (hsl.h + i * step) % 360,
      s: hsl.s,
      l: hsl.l
    }));
  }
  return result;
}
function _splitcomplement(color) {
  var hsl = tinycolor(color).toHsl();
  var h = hsl.h;
  return [tinycolor(color), tinycolor({
    h: (h + 72) % 360,
    s: hsl.s,
    l: hsl.l
  }), tinycolor({
    h: (h + 216) % 360,
    s: hsl.s,
    l: hsl.l
  })];
}
function _analogous(color, results, slices) {
  results = results || 6;
  slices = slices || 30;
  var hsl = tinycolor(color).toHsl();
  var part = 360 / slices;
  var ret = [tinycolor(color)];
  for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
    hsl.h = (hsl.h + part) % 360;
    ret.push(tinycolor(hsl));
  }
  return ret;
}
function _monochromatic(color, results) {
  results = results || 6;
  var hsv = tinycolor(color).toHsv();
  var h = hsv.h,
    s = hsv.s,
    v = hsv.v;
  var ret = [];
  var modification = 1 / results;
  while (results--) {
    ret.push(tinycolor({
      h: h,
      s: s,
      v: v
    }));
    v = (v + modification) % 1;
  }
  return ret;
}

// Utility Functions
// ---------------------

tinycolor.mix = function (color1, color2, amount) {
  amount = amount === 0 ? 0 : amount || 50;
  var rgb1 = tinycolor(color1).toRgb();
  var rgb2 = tinycolor(color2).toRgb();
  var p = amount / 100;
  var rgba = {
    r: (rgb2.r - rgb1.r) * p + rgb1.r,
    g: (rgb2.g - rgb1.g) * p + rgb1.g,
    b: (rgb2.b - rgb1.b) * p + rgb1.b,
    a: (rgb2.a - rgb1.a) * p + rgb1.a
  };
  return tinycolor(rgba);
};

// Readability Functions
// ---------------------
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)

// `contrast`
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
tinycolor.readability = function (color1, color2) {
  var c1 = tinycolor(color1);
  var c2 = tinycolor(color2);
  return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
};

// `isReadable`
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
// The third argument is an optional Object.
//      the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
//      the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.

// *Example*
//    tinycolor.isReadable("#000", "#111") => false
//    tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
tinycolor.isReadable = function (color1, color2, wcag2) {
  var readability = tinycolor.readability(color1, color2);
  var wcag2Parms, out;
  out = false;
  wcag2Parms = validateWCAG2Parms(wcag2);
  switch (wcag2Parms.level + wcag2Parms.size) {
    case "AAsmall":
    case "AAAlarge":
      out = readability >= 4.5;
      break;
    case "AAlarge":
      out = readability >= 3;
      break;
    case "AAAsmall":
      out = readability >= 7;
      break;
  }
  return out;
};

// `mostReadable`
// Given a base color and a list of possible foreground or background
// colors for that base, returns the most readable color.
// Optionally returns Black or White if the most readable color is unreadable.
// *Example*
//    tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
//    tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString();  // "#ffffff"
//    tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
//    tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
tinycolor.mostReadable = function (baseColor, colorList, args) {
  var bestColor = null;
  var bestScore = 0;
  var readability;
  var includeFallbackColors, level, size;
  args = args || {};
  includeFallbackColors = args.includeFallbackColors;
  level = args.level;
  size = args.size;
  for (var i = 0; i < colorList.length; i++) {
    readability = tinycolor.readability(baseColor, colorList[i]);
    if (readability > bestScore) {
      bestScore = readability;
      bestColor = tinycolor(colorList[i]);
    }
  }
  if (tinycolor.isReadable(baseColor, bestColor, {
    level: level,
    size: size
  }) || !includeFallbackColors) {
    return bestColor;
  } else {
    args.includeFallbackColors = false;
    return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
  }
};

// Big List of Colors
// ------------------
// <https://www.w3.org/TR/css-color-4/#named-colors>
var names = tinycolor.names = {
  aliceblue: "f0f8ff",
  antiquewhite: "faebd7",
  aqua: "0ff",
  aquamarine: "7fffd4",
  azure: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "000",
  blanchedalmond: "ffebcd",
  blue: "00f",
  blueviolet: "8a2be2",
  brown: "a52a2a",
  burlywood: "deb887",
  burntsienna: "ea7e5d",
  cadetblue: "5f9ea0",
  chartreuse: "7fff00",
  chocolate: "d2691e",
  coral: "ff7f50",
  cornflowerblue: "6495ed",
  cornsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "0ff",
  darkblue: "00008b",
  darkcyan: "008b8b",
  darkgoldenrod: "b8860b",
  darkgray: "a9a9a9",
  darkgreen: "006400",
  darkgrey: "a9a9a9",
  darkkhaki: "bdb76b",
  darkmagenta: "8b008b",
  darkolivegreen: "556b2f",
  darkorange: "ff8c00",
  darkorchid: "9932cc",
  darkred: "8b0000",
  darksalmon: "e9967a",
  darkseagreen: "8fbc8f",
  darkslateblue: "483d8b",
  darkslategray: "2f4f4f",
  darkslategrey: "2f4f4f",
  darkturquoise: "00ced1",
  darkviolet: "9400d3",
  deeppink: "ff1493",
  deepskyblue: "00bfff",
  dimgray: "696969",
  dimgrey: "696969",
  dodgerblue: "1e90ff",
  firebrick: "b22222",
  floralwhite: "fffaf0",
  forestgreen: "228b22",
  fuchsia: "f0f",
  gainsboro: "dcdcdc",
  ghostwhite: "f8f8ff",
  gold: "ffd700",
  goldenrod: "daa520",
  gray: "808080",
  green: "008000",
  greenyellow: "adff2f",
  grey: "808080",
  honeydew: "f0fff0",
  hotpink: "ff69b4",
  indianred: "cd5c5c",
  indigo: "4b0082",
  ivory: "fffff0",
  khaki: "f0e68c",
  lavender: "e6e6fa",
  lavenderblush: "fff0f5",
  lawngreen: "7cfc00",
  lemonchiffon: "fffacd",
  lightblue: "add8e6",
  lightcoral: "f08080",
  lightcyan: "e0ffff",
  lightgoldenrodyellow: "fafad2",
  lightgray: "d3d3d3",
  lightgreen: "90ee90",
  lightgrey: "d3d3d3",
  lightpink: "ffb6c1",
  lightsalmon: "ffa07a",
  lightseagreen: "20b2aa",
  lightskyblue: "87cefa",
  lightslategray: "789",
  lightslategrey: "789",
  lightsteelblue: "b0c4de",
  lightyellow: "ffffe0",
  lime: "0f0",
  limegreen: "32cd32",
  linen: "faf0e6",
  magenta: "f0f",
  maroon: "800000",
  mediumaquamarine: "66cdaa",
  mediumblue: "0000cd",
  mediumorchid: "ba55d3",
  mediumpurple: "9370db",
  mediumseagreen: "3cb371",
  mediumslateblue: "7b68ee",
  mediumspringgreen: "00fa9a",
  mediumturquoise: "48d1cc",
  mediumvioletred: "c71585",
  midnightblue: "191970",
  mintcream: "f5fffa",
  mistyrose: "ffe4e1",
  moccasin: "ffe4b5",
  navajowhite: "ffdead",
  navy: "000080",
  oldlace: "fdf5e6",
  olive: "808000",
  olivedrab: "6b8e23",
  orange: "ffa500",
  orangered: "ff4500",
  orchid: "da70d6",
  palegoldenrod: "eee8aa",
  palegreen: "98fb98",
  paleturquoise: "afeeee",
  palevioletred: "db7093",
  papayawhip: "ffefd5",
  peachpuff: "ffdab9",
  peru: "cd853f",
  pink: "ffc0cb",
  plum: "dda0dd",
  powderblue: "b0e0e6",
  purple: "800080",
  rebeccapurple: "663399",
  red: "f00",
  rosybrown: "bc8f8f",
  royalblue: "4169e1",
  saddlebrown: "8b4513",
  salmon: "fa8072",
  sandybrown: "f4a460",
  seagreen: "2e8b57",
  seashell: "fff5ee",
  sienna: "a0522d",
  silver: "c0c0c0",
  skyblue: "87ceeb",
  slateblue: "6a5acd",
  slategray: "708090",
  slategrey: "708090",
  snow: "fffafa",
  springgreen: "00ff7f",
  steelblue: "4682b4",
  tan: "d2b48c",
  teal: "008080",
  thistle: "d8bfd8",
  tomato: "ff6347",
  turquoise: "40e0d0",
  violet: "ee82ee",
  wheat: "f5deb3",
  white: "fff",
  whitesmoke: "f5f5f5",
  yellow: "ff0",
  yellowgreen: "9acd32"
};

// Make it easy to access colors via `hexNames[hex]`
var hexNames = tinycolor.hexNames = flip(names);

// Utilities
// ---------

// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
function flip(o) {
  var flipped = {};
  for (var i in o) {
    if (o.hasOwnProperty(i)) {
      flipped[o[i]] = i;
    }
  }
  return flipped;
}

// Return a valid alpha value [0,1] with all invalid values being set to 1
function boundAlpha(a) {
  a = parseFloat(a);
  if (isNaN(a) || a < 0 || a > 1) {
    a = 1;
  }
  return a;
}

// Take input from [0, n] and return it as [0, 1]
function bound01(n, max) {
  if (isOnePointZero(n)) n = "100%";
  var processPercent = isPercentage(n);
  n = Math.min(max, Math.max(0, parseFloat(n)));

  // Automatically convert percentage into number
  if (processPercent) {
    n = parseInt(n * max, 10) / 100;
  }

  // Handle floating point rounding errors
  if (Math.abs(n - max) < 0.000001) {
    return 1;
  }

  // Convert into [0, 1] range if it isn't already
  return n % max / parseFloat(max);
}

// Force a number between 0 and 1
function clamp01(val) {
  return Math.min(1, Math.max(0, val));
}

// Parse a base-16 hex value into a base-10 integer
function parseIntFromHex(val) {
  return parseInt(val, 16);
}

// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
function isOnePointZero(n) {
  return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
}

// Check to see if string passed in is a percentage
function isPercentage(n) {
  return typeof n === "string" && n.indexOf("%") != -1;
}

// Force a hex value to have 2 characters
function pad2(c) {
  return c.length == 1 ? "0" + c : "" + c;
}

// Replace a decimal with it's percentage value
function convertToPercentage(n) {
  if (n <= 1) {
    n = n * 100 + "%";
  }
  return n;
}

// Converts a decimal to a hex value
function convertDecimalToHex(d) {
  return Math.round(parseFloat(d) * 255).toString(16);
}
// Converts a hex value to a decimal
function convertHexToDecimal(h) {
  return parseIntFromHex(h) / 255;
}
var matchers = function () {
  // <http://www.w3.org/TR/css3-values/#integers>
  var CSS_INTEGER = "[-\\+]?\\d+%?";

  // <http://www.w3.org/TR/css3-values/#number-value>
  var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";

  // Allow positive/negative integer/number.  Don't capture the either/or, just the entire outcome.
  var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";

  // Actual matching.
  // Parentheses and commas are optional, but not required.
  // Whitespace can take the place of commas or opening paren
  var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
  var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
  return {
    CSS_UNIT: new RegExp(CSS_UNIT),
    rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
    rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
    hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
    hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
    hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
    hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
    hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
    hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  };
}();

// `isValidCSSUnit`
// Take in a single string / number and check to see if it looks like a CSS unit
// (see `matchers` above for definition).
function isValidCSSUnit(color) {
  return !!matchers.CSS_UNIT.exec(color);
}

// `stringInputToObject`
// Permissive string parsing.  Take in a number of formats, and output an object
// based on detected format.  Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
function stringInputToObject(color) {
  color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
  var named = false;
  if (names[color]) {
    color = names[color];
    named = true;
  } else if (color == "transparent") {
    return {
      r: 0,
      g: 0,
      b: 0,
      a: 0,
      format: "name"
    };
  }

  // Try to match string input using regular expressions.
  // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
  // Just return an object and let the conversion functions handle that.
  // This way the result will be the same whether the tinycolor is initialized with string or object.
  var match;
  if (match = matchers.rgb.exec(color)) {
    return {
      r: match[1],
      g: match[2],
      b: match[3]
    };
  }
  if (match = matchers.rgba.exec(color)) {
    return {
      r: match[1],
      g: match[2],
      b: match[3],
      a: match[4]
    };
  }
  if (match = matchers.hsl.exec(color)) {
    return {
      h: match[1],
      s: match[2],
      l: match[3]
    };
  }
  if (match = matchers.hsla.exec(color)) {
    return {
      h: match[1],
      s: match[2],
      l: match[3],
      a: match[4]
    };
  }
  if (match = matchers.hsv.exec(color)) {
    return {
      h: match[1],
      s: match[2],
      v: match[3]
    };
  }
  if (match = matchers.hsva.exec(color)) {
    return {
      h: match[1],
      s: match[2],
      v: match[3],
      a: match[4]
    };
  }
  if (match = matchers.hex8.exec(color)) {
    return {
      r: parseIntFromHex(match[1]),
      g: parseIntFromHex(match[2]),
      b: parseIntFromHex(match[3]),
      a: convertHexToDecimal(match[4]),
      format: named ? "name" : "hex8"
    };
  }
  if (match = matchers.hex6.exec(color)) {
    return {
      r: parseIntFromHex(match[1]),
      g: parseIntFromHex(match[2]),
      b: parseIntFromHex(match[3]),
      format: named ? "name" : "hex"
    };
  }
  if (match = matchers.hex4.exec(color)) {
    return {
      r: parseIntFromHex(match[1] + "" + match[1]),
      g: parseIntFromHex(match[2] + "" + match[2]),
      b: parseIntFromHex(match[3] + "" + match[3]),
      a: convertHexToDecimal(match[4] + "" + match[4]),
      format: named ? "name" : "hex8"
    };
  }
  if (match = matchers.hex3.exec(color)) {
    return {
      r: parseIntFromHex(match[1] + "" + match[1]),
      g: parseIntFromHex(match[2] + "" + match[2]),
      b: parseIntFromHex(match[3] + "" + match[3]),
      format: named ? "name" : "hex"
    };
  }
  return false;
}
function validateWCAG2Parms(parms) {
  // return valid WCAG2 parms for isReadable.
  // If input parms are invalid, return {"level":"AA", "size":"small"}
  var level, size;
  parms = parms || {
    level: "AA",
    size: "small"
  };
  level = (parms.level || "AA").toUpperCase();
  size = (parms.size || "small").toLowerCase();
  if (level !== "AA" && level !== "AAA") {
    level = "AA";
  }
  if (size !== "small" && size !== "large") {
    size = "small";
  }
  return {
    level: level,
    size: size
  };
}

//arr遍历的数组   search 搜索的值
function XmlSearchWord(arr, search) {
  let searchLis = [];
  arr.map(item => {
    if (item.Text) {
      if (item.Text.indexOf(search) != -1) {
        let pList = item.Text.split('</p>');
        for (let i = 0; i < pList.length; i++) {
          if (pList[i].indexOf(search) != -1) {
            const Reg = new RegExp(search, 'g');
            if (pList[i].indexOf('id="paragraph') === -1) {
              let searchText = pList[i]?.replace(/<[^>]+>/g, '').replace(/&nbsp;/gi, '');
              searchText.replace(Reg, (match, searchIndex) => {
                let data = {
                  pId: '',
                  searchText,
                  ...item
                };
                // console.log(pList[i].replace(/<[^>]+>/g, '').replace(/&nbsp;/gi, ''));
                let StrIndex = searchIndex > 30 ? searchIndex - 30 : 0;
                let EndIndex = data.searchText.length - searchIndex > 30 ? searchIndex + 30 : data.searchText.length;
                data.searchText = data.searchText.slice(StrIndex, EndIndex) + '...';
                searchLis.push(data);
              });
            } else {
              pList[i].replace(/id=['"]([^'"]+)[^>]/gi, (match, pId) => {
                if (pId.indexOf('paragraph') !== -1) {
                  let searchText = pList[i]?.replace(/<[^>]+>/g, '').replace(/&nbsp;/gi, '');
                  searchText.replace(Reg, (match, searchIndex) => {
                    let data = {
                      pId,
                      searchText,
                      ...item
                    };
                    // console.log(pList[i].replace(/<[^>]+>/g, '').replace(/&nbsp;/gi, ''));
                    let StrIndex = searchIndex > 30 ? searchIndex - 30 : 0;
                    let EndIndex = data.searchText.length - searchIndex > 30 ? searchIndex + 30 : data.searchText.length;
                    data.searchText = data.searchText.slice(StrIndex, EndIndex) + '...';
                    searchLis.push(data);
                  });
                }
              });
            }
          }
        }
      }
    } else if (item.textList) {
      if (JSON.stringify(item.textList).indexOf(search) != -1) {
        for (let i = 0; i < item.textList.length; i++) {
          let searchText = item.textList[i].title?.replace(/<[^>]+>/g, '').replace(/&nbsp;/gi, '');
          if (searchText.indexOf(search) != -1) {
            let data = {
              searchText,
              className: item.textList[i].titleClass,
              index: item.textList[i].index,
              ...item
            };
            let searchIndex = searchText.indexOf(search);
            let StrIndex = searchIndex > 30 ? searchIndex - 30 : 0;
            let EndIndex = data.searchText.length - searchIndex > 30 ? searchIndex + 30 : data.searchText.length;
            data.searchText = data.searchText.slice(StrIndex, EndIndex) + '...';
            searchLis.push(data);
          }
        }
      }
    }
  });
  return searchLis;
}

//
var script$3a = {
  name: 'xmlPreviewSearch',
  props: {
    viewList: Object,
    componentList: Array,
    title: String,
    pageType: {
      type: String,
      default: 'h5'
    },
    searchValue: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      list: [],
      input: '',
      ArrList: [],
      show: false
    };
  },
  created() {
    // this.ArrList = XmlSearchList(this.viewList, this.componentList).arr
  },
  watch: {
    input(a, b) {
      if (a.replace(/\s+/g, '') != b.replace(/\s+/g, '')) {
        this.changeInput();
      }
    },
    searchValue: {
      handler(newValue) {
        this.input = newValue;
      }
    }
  },
  methods: {
    changeInput() {
      if (this.input.replace(/\s+/g, '') !== '') {
        this.list = XmlSearchWord(this.componentList, this.input.replace(/\s+/g, ''));
        if (this.list.length > 0) {
          this.show = true;
        } else {
          this.show = false;
        }
      } else {
        this.list = [];
        this.show = false;
      }
    },
    seachItem(e) {
      e.inputText = this.input.replace(/\s+/g, '');
      this.$emit('seachItem', e, this.input);
      this.input = '';
    },
    onBackClick() {
      this.$emit('onBackClick');
    },
    quxiao() {
      this.input = '';
      this.list = [];
      this.show = false;
    },
    brightenKeyword(val) {
      const keyword = this.input.replace(/\s+/g, '');
      const Reg = new RegExp(keyword, 'g');
      let res = '';
      if (val) {
        res = val.replace(Reg, `<span style="color: red;">${keyword}</span>`);
        return res;
      }
    }
  }
};

var __$_require_assets_images_icons_back_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAABACAYAAAB2kAXpAAAAAXNSR0IArs4c6QAABABJREFUaEPVmluopmMUx39/UUy44cJMg+FikEMuGMnIOJcwlHIYpKkZmchxuJDT5MIpIzXIpMkhh5QwlPPx0uHKhbiYKCJXSMTor7U9W4/t29/3rP3t55usm137+z/v+r3Pca31vGIHme19gVXAEuBXYKukd6ZxtCO4bJ8HPAHsNsP/RknXxf8mDmZ7NfDYkA65UtKmiYLZvhp4YMQofSVpycTAbN8M3NkwdbZL2mUiYLbvBW5ogArJ15L27w5m+yHgikaokK2WtKUrmO2ngQsTUBsk3dZ1Vdp+EViZgFov6b5u+5jtnYE3gBMTUOskPVzr53UobS8A3gWWJaBWSYoh/5fNG5jtfYA4Ug5JQJ0j6aVB+nkBs70f8CEQf1tsO3CqpPdmE48NZvswIBzs1UJUDuwTJH00TD8WmO2jgbeBPRqhfgBOkvTZKP2cwWyvKFA7jXJSfv8GOF7Sthb9nMBsx/4U+1SrfQ6skPR9a4M0mO1LgcdbHQAxl2Ki/5hok4vHbK8DNiUcxPZxmqQ/E22mpM09Zvsm4K6EgwiVz07o8xus7TuAWxNOnpF0UUL/H+nIHrP9IHBVwslmSWsT+oHSoWC2twCXJZzcL+n6hH5W6axgtl8Azk04uV1SDPm82EAw26/Hakp4uFbSqCQj8bgZq7KELW8BxyaeslbS5oS+SfpPj9neE3gfOLKp5d+iCyQ9l9A3S6fASroeEcKBzS3hLEmvJPQpqWwvLWHLwsaWv5cj5oNG/ZxkAfZTImz5uRzGn87JW6JRgLlR/20kGJK+aNSPJWsF+wRYLum3sbwlGv/vweJdYyhPlhRBX3eLHvsDiCS1xX4pk//jFvE4mgA7puSDkay2WLxIBH+zpl4tDxmlmd5gDy9we49qUP2+UtLLCX1KWh9JB5SNtjVpDUd9j6TpVylpfhzihyZer+8hXsHtXgojRyXg+oY9FVys0jdjBSbg+geKFeBW4MwEXP/QuoJ7Fjg/Adc/GangHgEuT8D1T98quHuA9Qm4/glvBXcLsCEBFyWC0yVFoS5lIxPemU+zfQ2wMeElztVTuhZVqp5bAzyagOtfhqrgYqXGim21/oW7Cu4MIDKl1inRv9RZwR0HxPm6a2PXxW1u3+JwBRdJciTLkTS3WP9yegV3UInpFrWQFU3fC4gKbjEQiXDEdq3W98qmgouLiNhYj2glA/peclVw8XVA3MAtT8D1vRasQWy/FkdSAq7/RWrVe88D8Z1Fq10i6anWjbH1oQN1yVrul5KWTgQsaBPV78l93lANa3x3Ed9fDLPvJC2cWI9VcDcCdw8hm1qdEwcrwxphelzOz/T/pKS4RGuOCsaa/IMa2z4YuLicElHVfLWu6f4FuhpYUNovLf0AAAAASUVORK5CYII=";

var __$_require_assets_images_icons_zanwu_png__ = "data:image/png;base64,[encoded data, 19060 characters]";

/* script */
const __vue_script__$3a = script$3a;
var __vue_render__$3a = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { class: "xmlPreviewSearch-box-" + _vm.pageType }, [
    _vm.pageType == "h5"
      ? _c("div", { staticClass: "xmlPreviewSearch-title" }, [
          _c("img", {
            staticClass: "img",
            staticStyle: { cursor: "pointer" },
            attrs: { src: __$_require_assets_images_icons_back_png__ },
            on: { click: _vm.onBackClick },
          }),
          _vm._v(" "),
          _c("div", { staticClass: "xmlPreviewSearch-sou" }, [
            _vm._v(_vm._s(_vm.title)),
          ]),
        ])
      : _vm._e(),
    _vm._v(" "),
    _vm.pageType == "h5"
      ? _c("div", { staticClass: "xmlPreviewSearch-input" }, [
          _c(
            "div",
            {
              staticClass: "xmlPreviewSearch-icon",
              on: { click: _vm.changeInput },
            },
            [_c("i", { staticClass: "el-icon-search" })]
          ),
          _vm._v(" "),
          _c("input", {
            directives: [
              {
                name: "model",
                rawName: "v-model",
                value: _vm.input,
                expression: "input",
              },
            ],
            staticClass: "input",
            attrs: { maxlength: "20", placeholder: "请输入搜索内容" },
            domProps: { value: _vm.input },
            on: {
              change: _vm.changeInput,
              input: function ($event) {
                if ($event.target.composing) {
                  return
                }
                _vm.input = $event.target.value;
              },
            },
          }),
          _vm._v(" "),
          _c(
            "button",
            {
              staticClass: "input_text",
              on: {
                click: function ($event) {
                  return _vm.quxiao()
                },
              },
            },
            [_vm._v("取消")]
          ),
        ])
      : _vm._e(),
    _vm._v(" "),
    _vm.pageType == "pc"
      ? _c("div", { class: "xmlPreviewSearch-input-" + _vm.pageType }, [
          _c(
            "div",
            {
              staticStyle: { "font-size": "16px", cursor: "pointer" },
              on: { click: _vm.onBackClick },
            },
            [
              _c("i", {
                staticClass: "el-icon-arrow-left",
                staticStyle: { "font-size": "16px" },
              }),
              _vm._v("返回\n    "),
            ]
          ),
        ])
      : _vm._e(),
    _vm._v(" "),
    _c(
      "div",
      { staticClass: "seach-list" },
      [
        _vm._l(_vm.list, function (item, index) {
          return _c(
            "div",
            {
              key: index,
              staticClass: "seach-box",
              on: {
                click: function ($event) {
                  return _vm.seachItem(item)
                },
              },
            },
            [
              _c("div", { staticClass: "seach-label" }, [
                _vm._v(_vm._s(item.label)),
              ]),
              _vm._v(" "),
              _c("div", {
                staticClass: "seach-text",
                domProps: {
                  innerHTML: _vm._s(
                    _vm.brightenKeyword(item.searchText, _vm.input)
                  ),
                },
              }),
            ]
          )
        }),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.show,
                expression: "!show",
              },
            ],
            staticClass: "seach_zaiwu",
          },
          [
            _c("img", {
              attrs: { src: __$_require_assets_images_icons_zanwu_png__ },
            }),
            _vm._v(" "),
            _c("div", [
              _vm._v(_vm._s(_vm.input ? "未搜索到相关内容" : "请输入搜索内容")),
            ]),
          ]
        ),
      ],
      2
    ),
  ])
};
var __vue_staticRenderFns__$3a = [];
__vue_render__$3a._withStripped = true;

  /* style */
  const __vue_inject_styles__$3a = undefined;
  /* scoped */
  const __vue_scope_id__$3a = "data-v-7290c0bc";
  /* module identifier */
  const __vue_module_identifier__$3a = undefined;
  /* functional template */
  const __vue_is_functional_template__$3a = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3a = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3a, staticRenderFns: __vue_staticRenderFns__$3a },
    __vue_inject_styles__$3a,
    __vue_script__$3a,
    __vue_scope_id__$3a,
    __vue_is_functional_template__$3a,
    __vue_module_identifier__$3a,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$39 = {
  name: 'xml-toolbar-pc',
  props: {
    textBookResource: {
      type: Object,
      default: () => {}
    },
    userType: {
      // 用户类型，可选teacher、student
      type: String,
      default: 'student'
    },
    NumShow: {
      type: Number,
      default: 0
    },
    isShowTeacherResource: {
      type: Boolean,
      default: false
    },
    sysEnv: {
      type: Object,
      default: () => {}
    },
    showoQuestionBank: {
      //是否显示打开题库按钮
      type: Boolean,
      default: false
    }
  },
  watch: {
    textBookResource(newValue) {
      this.getToolbarList();
    }
  },
  data() {
    return {
      toolbarList: [],
      current: 0
    };
  },
  mounted() {
    this.getToolbarList();
  },
  methods: {
    getToolbarList() {
      this.toolbarList = [];
      this.sysEnv.toolbarList.map(item => {
        if (this.isShowTool(item.total)) {
          this.toolbarList.push(item);
        }
      });
      if (!this.isShowTeacherResource && this.userType != 'teacher') {
        this.toolbarList.splice(1, 1);
        this.openToolbar({
          index: 1,
          item: this.toolbarList[1]
        });
      } else {
        this.openToolbar({
          index: 2,
          item: this.toolbarList[2]
        });
      }
    },
    clickToolbar(data) {
      if (data.item.type == 'questionBank') {
        this.$emit('openQuestionBank');
      } else if (data.item.type == 'studyPlan') {
        this.$emit('openStudyPlan');
      } else {
        this.current = data.index;
        this.$emit('clickToolbar', this.toolbarList[data.index]);
      }
    },
    getResourceNum(type) {
      let total = this.textBookResource[type];
      if (total == undefined) {
        total = type;
      }
      return total;
    },
    isShowTool(type) {
      let list = ['none', 'teachingResourceTotal'];
      let show = true;
      let total = this.textBookResource[type];
      if (total == undefined) {
        total = type;
      }
      if (Number(total) == 0 && this.sysEnv.dynamicToolbar && !list.includes(type)) {
        show = false;
      }
      return show;
    },
    // 打开有资源的工具栏
    openToolbar(data) {
      if (this.sysEnv.isOpenToolbar) {
        setTimeout(() => {
          this.clickToolbar(data);
        }, 500);
      }
    }
  }
};

/* script */
const __vue_script__$39 = script$39;

/* template */
var __vue_render__$39 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-toolbar-pc",
      style: _vm.toolbarList[_vm.current].style,
    },
    [
      _vm._l(_vm.toolbarList, function (item, index) {
        return _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value:
                  item.type !== "questionBank" ||
                  (item.type == "questionBank" && _vm.showoQuestionBank),
                expression:
                  "item.type !== 'questionBank' || (item.type == 'questionBank' && showoQuestionBank)",
              },
            ],
            key: index,
            staticClass: "toolbar-item",
            class: [
              index == _vm.current ? item.select : item.default,
              _vm.sysEnv.toolbarSecond && index == _vm.current
                ? "current-toolbar"
                : "",
              item.newApplication ? "new-application" : "",
            ],
            on: {
              click: function ($event) {
                return _vm.clickToolbar({ index: index, item: item })
              },
            },
          },
          [
            _c("div", { staticClass: "toolbar-icon" }),
            _vm._v(" "),
            _c("div", { staticClass: "toolbar-name" }, [
              _vm._v(_vm._s(item.name)),
            ]),
            _vm._v(" "),
            _c(
              "div",
              {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: item.total != "none",
                    expression: "item.total != 'none'",
                  },
                ],
              },
              [_vm._v("(" + _vm._s(_vm.getResourceNum(item.total)) + ")")]
            ),
          ]
        )
      }),
      _vm._v(" "),
      _vm.sysEnv.toolbarFirst
        ? _c(
            "div",
            {
              staticClass: "select-toolbar",
              style: { top: _vm.current * 86 + 8 + "px" },
            },
            [_c("div", { staticClass: "toolbar" })]
          )
        : _vm._e(),
    ],
    2
  )
};
var __vue_staticRenderFns__$39 = [];
__vue_render__$39._withStripped = true;

  /* style */
  const __vue_inject_styles__$39 = undefined;
  /* scoped */
  const __vue_scope_id__$39 = undefined;
  /* module identifier */
  const __vue_module_identifier__$39 = undefined;
  /* functional template */
  const __vue_is_functional_template__$39 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$39 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$39, staticRenderFns: __vue_staticRenderFns__$39 },
    __vue_inject_styles__$39,
    __vue_script__$39,
    __vue_scope_id__$39,
    __vue_is_functional_template__$39,
    __vue_module_identifier__$39,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$38 = {
  name: 'xmlPreviewSearch',
  props: {
    viewList: Object,
    componentList: Array,
    title: String,
    pageType: {
      type: String,
      default: 'pc'
    },
    searchValue: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      urlPre: "../assets/images/icons/",
      list: [],
      input: '',
      ArrList: [],
      searchTextShow: true,
      showEllipsisButton: false,
      contentExpand: false,
      show: false,
      launchValue: 0
    };
  },
  computed: {
    searchList() {
      let list = this.list;
      const map = [];
      list.forEach(e => {
        if (e.type == 'note__teacher') {
          this.teacherNoteList.push(e);
        }
        const findObj = map.find(innerTmp => innerTmp.firstLevelId === e.firstLevelId);
        if (findObj) {
          findObj.list.push(e);
        } else {
          map.push({
            firstLevelId: e.firstLevelId,
            firstLevelLabel: e.firstLevelLabel,
            chapterOrderNum: e.chapterOrderNum,
            list: [e]
          });
        }
      });
      return map;
    }
  },
  watch: {
    // 监听输入框
    // 监听input的值，当值改变时，调用changeInput方法
    input(a, b) {
      if (a.replace(/\s+/g, '') != b.replace(/\s+/g, '')) {
        this.changeInput();
        this.contentExpand = false;
      }
    },
    searchValue: {
      handler(newValue) {
        this.input = newValue;
      }
    }
  },
  methods: {
    changeInput() {
      if (this.input.replace(/\s+/g, '') !== '') {
        this.list = XmlSearchWord(this.componentList, this.input.replace(/\s+/g, ''));
        if (this.list.length > 0) {
          this.showEllipsisButton = true;
        }
      } else {
        this.list = [];
        console.log('输入为空');
      }
    },
    seachItem(e) {
      e.inputText = this.input.replace(/\s+/g, '');
      this.$emit('seachItem', e, this.input);
    },
    onBackClick() {
      this.$emit('onBackClick');
    },
    brightenKeyword(val) {
      const keyword = this.input.replace(/\s+/g, '');
      const Reg = new RegExp(keyword, 'g');
      let res = '';
      if (val) {
        res = val.replace(Reg, `<span style="background-color: #e7f0ff; color: #75a9f2;">${keyword}</span>`);
        return res;
      }
    },
    // 展开下拉
    toggleSearchText(id) {
      this.contentExpand = !this.contentExpand;
      this.searchTextShow = !this.searchTextShow;
    }
  }
};

var __$_require_assets_images_icons_searchmin_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAATtJREFUOE+V0j1rVVEQheFnYWFhMPkLEQT9AZKAIJLGyjaN4AfWEpKQKqYyFlHEyk7Q1o/KykLQTkRbG6sQiIha2FjK9s71nHC8xAvucu95Z9Zas2PitNbmsIBZ7OF9kl+TdekvWmsz2MF1HB0UfsZmksdDeAx20GucxG08wzecxg1cxvZo8lYP9+ADXMLZJB8Pkb+Ke1hK8qbe03n6gq0kdyehgZV3+JrkYg9ewEvMJ9mdAm7gZpIKbTxxeeTlCWaS/JwCXsPDJEd6cBFvcSbJhylgJb6cZL4Hq0Pt61WSK4eBrbXj+FTKkqyMwW4dV/EIayMP94dwBz2txHEqyf4B2MG3atH1U/Ac36sQpeJYZdCFU3v+M3EQ+Xms41xXWBZe4A5K1XYP/wX+K5hB41JUjU/8F9hZmkvy4zcDEm8cuHdPWwAAAABJRU5ErkJggg==";

var __$_require_assets_images_icons_without_png__ = "data:image/png;base64,[encoded data, 19056 characters]";

/* script */
const __vue_script__$38 = script$38;
var __vue_render__$38 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { class: "xmlPreviewSearch-box-" + _vm.pageType }, [
    _vm.pageType == "pc"
      ? _c("div", { staticClass: "xmlPreviewSearch-input" }, [
          _c("input", {
            directives: [
              {
                name: "model",
                rawName: "v-model",
                value: _vm.input,
                expression: "input",
              },
            ],
            staticClass: "input",
            attrs: { maxlength: "20", placeholder: "请输入" },
            domProps: { value: _vm.input },
            on: {
              change: _vm.changeInput,
              input: function ($event) {
                if ($event.target.composing) {
                  return
                }
                _vm.input = $event.target.value;
              },
            },
          }),
          _vm._v(" "),
          _c(
            "button",
            {
              staticClass: "input_text",
              on: {
                click: function ($event) {
                  return _vm.changeInput()
                },
              },
            },
            [
              _c("img", {
                attrs: {
                  src: __$_require_assets_images_icons_searchmin_png__,
                  alt: "",
                },
              }),
            ]
          ),
        ])
      : _vm._e(),
    _vm._v(" "),
    _c(
      "div",
      { staticClass: "seach-list" },
      [
        _c(
          "el-collapse",
          {
            attrs: { accordion: "" },
            model: {
              value: _vm.launchValue,
              callback: function ($$v) {
                _vm.launchValue = $$v;
              },
              expression: "launchValue",
            },
          },
          _vm._l(_vm.searchList, function (item, index) {
            return _c(
              "el-collapse-item",
              { key: index, attrs: { name: index } },
              [
                _c("template", { slot: "title" }, [
                  _c("div", { staticClass: "collapse-title" }, [
                    _vm._v(
                      "\n              " +
                        _vm._s(item.firstLevelLabel) +
                        "\n            "
                    ),
                  ]),
                ]),
                _vm._v(" "),
                _vm._l(item.list, function (items, index) {
                  return _c(
                    "div",
                    {
                      on: {
                        click: function ($event) {
                          return _vm.seachItem(items)
                        },
                      },
                    },
                    [
                      _c("div", {
                        staticClass: "xml-seach-item-text",
                        domProps: {
                          innerHTML: _vm._s(
                            _vm.brightenKeyword(items.searchText, _vm.input)
                          ),
                        },
                      }),
                    ]
                  )
                }),
              ],
              2
            )
          }),
          1
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.searchList.length == 0 && _vm.input == "",
                expression: "searchList.length==0 && input==''",
              },
            ],
            staticClass: "seach_zaiwu",
          },
          [
            _c("div", { staticClass: "search_left_img" }, [
              _c("img", {
                attrs: { src: __$_require_assets_images_icons_without_png__ },
              }),
            ]),
          ]
        ),
      ],
      1
    ),
  ])
};
var __vue_staticRenderFns__$38 = [];
__vue_render__$38._withStripped = true;

  /* style */
  const __vue_inject_styles__$38 = undefined;
  /* scoped */
  const __vue_scope_id__$38 = "data-v-42d4d60c";
  /* module identifier */
  const __vue_module_identifier__$38 = undefined;
  /* functional template */
  const __vue_is_functional_template__$38 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$38 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$38, staticRenderFns: __vue_staticRenderFns__$38 },
    __vue_inject_styles__$38,
    __vue_script__$38,
    __vue_scope_id__$38,
    __vue_is_functional_template__$38,
    __vue_module_identifier__$38,
    false,
    undefined,
    undefined,
    undefined
  );

var coverLocal = "data:image/png;base64,[encoded data, 7436 characters]";

//
var script$37 = {
  name: 'audioPlayerPage',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    playStyle: {
      type: String,
      default: 'yuan-wen'
    },
    styleMode: {
      type: String,
      default: 'A'
    },
    url: {
      type: String,
      default: '',
      require: true
    },
    title: {
      type: String,
      default: '音频文件'
    },
    coverImageUrl: {
      type: String,
      default: ''
    },
    //进度是否能控制
    scheduleControl: {
      type: String,
      default: ''
    },
    loop: {
      type: Boolean,
      default: true
    },
    playMode: {
      type: String,
      default: 'xun-huan'
    },
    content: {
      type: String,
      default: '暂无简介'
    },
    targerLink: {
      type: String,
      default: ''
    }
  },
  computed: {
    videoAndMusicStop() {
      let playState = sessionStorage.getItem('SET_PLAY_STATE');
      return playState;
    },
    playModeIconSrc() {
      let srcMap = {
        'xun-huan': playRepeat,
        'dan-ci': playOnce
      };
      return srcMap[this.playMode];
    }
  },
  watch: {
    url: {
      handler(newVal) {
        let _this = this;
        this.isPlay = false;
        let ua = navigator.userAgent;
        /micromessenger/.test(ua.toLowerCase());
        let isIOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        if (isIOS && newVal) {
          try {
            this.$nextTick(() => {
              _this.$refs.musicAudio.muted = true;
              const playPromise = _this.$refs.musicAudio.play();
              _this.$refs.musicAudio.muted = false;
              if (playPromise) {
                playPromise.then(() => {
                  _this.$refs.musicAudio.pause();
                }).catch(error => {
                  _this.$refs.musicAudio.pause();
                  console.log(error);
                });
              }
            });
          } catch (error) {
            console.log(error);
            this.$message({
              type: 'warning',
              message: error,
              duration: 5000
            });
          }
        }
      },
      immediate: true
    },
    videoAndMusicStop(val) {
      console.log('watch', val);
      let currentPlayStamp = val || '--';
      if (`${this.url}__playTimeStamp__${this.lastOperateTimeStamp}` !== currentPlayStamp) {
        this.musicAudio.pause();
      }
    }
  },
  data() {
    return {
      coverLocal,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      link: {
        type: String,
        default: ''
      },
      //链接地址
      lastOperateTimeStamp: '',
      musicAudio: null,
      manualPlay: false,
      Volume: 100,
      showVolume: false
    };
  },
  mounted() {
    // 加载完毕后，先获取<video>标签DOM对象
    this.musicAudio = this.$refs.musicAudio;
    // this.videoContainer = this.$refs.videoContainer
    if (this.mode != 'editor' && this.playStyle === 'yuan-wen') {
      this.$emit('resetTimeUpdate');
    }
  },
  methods: {
    changeDuration() {
      this.$nextTick(() => {
        this.playDuration = this.timeFormat(this.$refs.musicAudio.duration);
        this.totalDuration = this.$refs.musicAudio.duration;
      });
    },
    //将单位为秒的的时间转换成mm:ss的形式
    timeFormat(num) {
      let minute = parseInt(num / 60);
      let second = parseInt(num % 60);
      minute = minute >= 10 ? minute : `0${minute}`;
      second = second >= 10 ? second : `0${second}`;
      return `${minute}:${second}`;
    },
    play() {
      // if (this.mode==='editor') {
      //   this.$message.warning('音频仅支持在预览模式下播放')
      //   return
      // }
      if (this.playStyle === 'yuan-wen') {
        this.doPlay();
      }
      if (this.playStyle === 'tiao-zhuan') {
        if (this.targerLink) {
          // window.location.href=this.targerLink
          window.open(this.targerLink, '_blank');
        } else {
          this.$message.warning('获取资源链接失败，请检查链接地址');
        }
      }
      if (this.playStyle === 'tan-chuang') {
        this.$emit('showDialog', {
          url: this.url,
          title: this.title,
          coverFileUrl: this.coverImageUrl
        });
      }
    },
    doPlay() {
      console.log('暂停');
      let audio = document.querySelectorAll('audio');
      audio.forEach(i => i.pause());
      let video = document.querySelectorAll('video');
      if (video && video.length) {
        video.forEach(i => i.pause());
      }
      if (this.isPlay) {
        this.$refs.musicAudio.pause();
        this.isPlay = !this.isPlay;
      } else {
        this.manualPlay = true;
        this.$refs.musicAudio.play().then(() => {
          this.isPlay = !this.isPlay;
          let timeStamp = new Date().getTime();
          this.lastOperateTimeStamp = timeStamp;
          let playStamp = `${this.url}__playTimeStamp__${timeStamp}`;
          sessionStorage.setItem('SET_PLAY_STATE', playStamp); //存储
        }).catch(error => {
          this.$message.warning('无效音频资源，请检查资源地址');
          console.log('音频播放catch', error);
        });
      }
      // this.isPlay ? this.$refs.musicAudio.pause() : this.$refs.musicAudio.play()
      // this.isPlay = !this.isPlay
      // let timeStamp = new Date().getTime()
      // this.lastOperateTimeStamp = timeStamp
      // let playStamp = `${this.url}__playTimeStamp__${timeStamp}`
      // // !this.isPlay && this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // // this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // sessionStorage.setItem('SET_PLAY_STATE', playStamp) //存储
    },
    updateTime(e) {
      this.playTime = this.$refs.musicAudio.currentTime;
      this.playCurrentTime = this.timeFormat(this.$refs.musicAudio.currentTime);
      if (this.playTime >= this.totalDuration) {
        this.isPlay = false;
      }
      this.$emit('timeUpdate', {
        event: e,
        time: this.$refs.musicAudio.currentTime
      });
    },
    changeTime(val) {
      this.$refs.musicAudio.currentTime = val;
    },
    changeVolume(val) {
      this.$refs.musicAudio.volume = val / 100;
    },
    onPlay() {
      if (!this.manualPlay) {
        this.$refs.musicAudio.pause();
      }
    }
  }
};

/* script */
const __vue_script__$37 = script$37;

/* template */
var __vue_render__$37 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "xml-audio-player-page" }, [
    _c("i", {
      staticClass: "el-icon-back",
      on: {
        click: function ($event) {
          return _vm.$emit("back")
        },
      },
    }),
    _vm._v(" "),
    _c("div", { staticClass: "audio-cover" }, [
      _c(
        "div",
        { staticClass: "square-wrapper" },
        [
          _c("el-image", {
            staticClass: "rotate",
            class: _vm.isPlay ? "active" : "paused",
            attrs: {
              src: _vm.coverImageUrl ? _vm.coverImageUrl : _vm.coverLocal,
              alt: "",
            },
          }),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "play-button",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  return _vm.play.apply(null, arguments)
                },
              },
            },
            [
              _c("i", {
                class: _vm.isPlay
                  ? "el-icon-video-pause"
                  : "el-icon-video-play",
              }),
            ]
          ),
        ],
        1
      ),
    ]),
    _vm._v(" "),
    _c("div", { staticClass: "audio-player-title" }, [
      _vm._v("\n    " + _vm._s(_vm.title) + "\n  "),
    ]),
    _vm._v(" "),
    _c(
      "div",
      {
        staticClass: "audio-controls",
        on: {
          click: function ($event) {
            _vm.showVolume = false;
          },
        },
      },
      [
        _c("div", { staticClass: "audio-controls__handler" }, [
          _c("div", { staticClass: "play-times" }, [
            _c("div", { staticClass: "current-time" }, [
              _vm._v(_vm._s(_vm.playCurrentTime)),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "progress" },
              [
                _c("el-slider", {
                  attrs: { max: _vm.totalDuration, "show-tooltip": false },
                  on: { change: _vm.changeTime },
                  model: {
                    value: _vm.playTime,
                    callback: function ($$v) {
                      _vm.playTime = $$v;
                    },
                    expression: "playTime",
                  },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "total-time" }, [
              _vm._v(_vm._s(_vm.playDuration)),
            ]),
          ]),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "volume-box",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                },
              },
            },
            [
              _c("el-slider", {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: _vm.showVolume,
                    expression: "showVolume",
                  },
                ],
                attrs: { vertical: "", height: "100px", "show-tooltip": false },
                on: { change: _vm.changeVolume },
                model: {
                  value: _vm.Volume,
                  callback: function ($$v) {
                    _vm.Volume = $$v;
                  },
                  expression: "Volume",
                },
              }),
              _vm._v(" "),
              _c("div", {
                staticClass: "volume-btn",
                class: _vm.Volume == 0 ? "volume-mute" : "",
                on: {
                  click: function ($event) {
                    $event.stopPropagation();
                    _vm.showVolume = !_vm.showVolume;
                  },
                },
              }),
            ],
            1
          ),
        ]),
      ]
    ),
    _vm._v(" "),
    _c("audio", {
      ref: "musicAudio",
      staticClass: "audio-component",
      attrs: {
        controls: "",
        preload: "auto",
        src: _vm.url,
        loop: _vm.loop,
        link: _vm.link,
      },
      on: {
        canplay: _vm.changeDuration,
        timeupdate: _vm.updateTime,
        pause: function ($event) {
          _vm.isPlay = false;
        },
        play: _vm.onPlay,
      },
    }),
  ])
};
var __vue_staticRenderFns__$37 = [];
__vue_render__$37._withStripped = true;

  /* style */
  const __vue_inject_styles__$37 = undefined;
  /* scoped */
  const __vue_scope_id__$37 = undefined;
  /* module identifier */
  const __vue_module_identifier__$37 = undefined;
  /* functional template */
  const __vue_is_functional_template__$37 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$37 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$37, staticRenderFns: __vue_staticRenderFns__$37 },
    __vue_inject_styles__$37,
    __vue_script__$37,
    __vue_scope_id__$37,
    __vue_is_functional_template__$37,
    __vue_module_identifier__$37,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$36 = {
  name: 'audioPlayerPage',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    playStyle: {
      type: String,
      default: 'yuan-wen'
    },
    styleMode: {
      type: String,
      default: 'A'
    },
    url: {
      type: String,
      default: '',
      require: true
    },
    title: {
      type: String,
      default: '音频文件'
    },
    coverImageUrl: {
      type: String,
      default: ''
    },
    //进度是否能控制
    scheduleControl: {
      type: String,
      default: ''
    },
    loop: {
      type: Boolean,
      default: true
    },
    playMode: {
      type: String,
      default: 'xun-huan'
    },
    content: {
      type: String,
      default: '暂无简介'
    },
    targerLink: {
      type: String,
      default: ''
    }
  },
  computed: {
    videoAndMusicStop() {
      let playState = sessionStorage.getItem('SET_PLAY_STATE');
      return playState;
    },
    playModeIconSrc() {
      let srcMap = {
        'xun-huan': playRepeat,
        'dan-ci': playOnce
      };
      return srcMap[this.playMode];
    }
  },
  watch: {
    url: {
      handler(newVal) {
        let _this = this;
        this.isPlay = false;
        let ua = navigator.userAgent;
        /micromessenger/.test(ua.toLowerCase());
        let isIOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        if (isIOS && newVal) {
          try {
            this.$nextTick(() => {
              _this.$refs.musicAudio.muted = true;
              const playPromise = _this.$refs.musicAudio.play();
              _this.$refs.musicAudio.muted = false;
              if (playPromise) {
                playPromise.then(() => {
                  _this.$refs.musicAudio.pause();
                }).catch(error => {
                  _this.$refs.musicAudio.pause();
                  console.log(error);
                });
              }
            });
          } catch (error) {
            console.log(error);
            this.$message({
              type: 'warning',
              message: error,
              duration: 5000
            });
          }
        }
      },
      immediate: true
    },
    videoAndMusicStop(val) {
      console.log('watch', val);
      let currentPlayStamp = val || '--';
      if (`${this.url}__playTimeStamp__${this.lastOperateTimeStamp}` !== currentPlayStamp) {
        this.musicAudio.pause();
      }
    }
  },
  data() {
    return {
      coverLocal,
      isPlay: false,
      playTime: 0,
      playDuration: '00:00',
      playCurrentTime: '00:00',
      totalDuration: 0,
      link: {
        type: String,
        default: ''
      },
      //链接地址
      lastOperateTimeStamp: '',
      musicAudio: null,
      manualPlay: false,
      Volume: 100,
      showVolume: false
    };
  },
  mounted() {
    // 加载完毕后，先获取<video>标签DOM对象
    this.musicAudio = this.$refs.musicAudio;
    // this.videoContainer = this.$refs.videoContainer
    if (this.mode != 'editor' && this.playStyle === 'yuan-wen') {
      this.$emit('resetTimeUpdate');
    }
  },
  methods: {
    changeDuration() {
      this.$nextTick(() => {
        this.playDuration = this.timeFormat(this.$refs.musicAudio.duration);
        this.totalDuration = this.$refs.musicAudio.duration;
      });
    },
    //将单位为秒的的时间转换成mm:ss的形式
    timeFormat(num) {
      let minute = parseInt(num / 60);
      let second = parseInt(num % 60);
      minute = minute >= 10 ? minute : `0${minute}`;
      second = second >= 10 ? second : `0${second}`;
      return `${minute}:${second}`;
    },
    play() {
      // if (this.mode==='editor') {
      //   this.$message.warning('音频仅支持在预览模式下播放')
      //   return
      // }
      if (this.playStyle === 'yuan-wen') {
        this.doPlay();
      }
      if (this.playStyle === 'tiao-zhuan') {
        if (this.targerLink) {
          // window.location.href=this.targerLink
          window.open(this.targerLink, '_blank');
        } else {
          this.$message.warning('获取资源链接失败，请检查链接地址');
        }
      }
      if (this.playStyle === 'tan-chuang') {
        this.$emit('showDialog', {
          url: this.url,
          title: this.title,
          coverFileUrl: this.coverImageUrl
        });
      }
    },
    doPlay() {
      console.log('暂停');
      let audio = document.querySelectorAll('audio');
      audio.forEach(i => i.pause());
      let video = document.querySelectorAll('video');
      if (video && video.length) {
        video.forEach(i => i.pause());
      }
      if (this.isPlay) {
        this.$refs.musicAudio.pause();
        this.isPlay = !this.isPlay;
      } else {
        this.manualPlay = true;
        this.$refs.musicAudio.play().then(() => {
          this.isPlay = !this.isPlay;
          let timeStamp = new Date().getTime();
          this.lastOperateTimeStamp = timeStamp;
          let playStamp = `${this.url}__playTimeStamp__${timeStamp}`;
          sessionStorage.setItem('SET_PLAY_STATE', playStamp); //存储
        }).catch(error => {
          this.$message.warning('无效音频资源，请检查资源地址');
          console.log('音频播放catch', error);
        });
      }
      // this.isPlay ? this.$refs.musicAudio.pause() : this.$refs.musicAudio.play()
      // this.isPlay = !this.isPlay
      // let timeStamp = new Date().getTime()
      // this.lastOperateTimeStamp = timeStamp
      // let playStamp = `${this.url}__playTimeStamp__${timeStamp}`
      // // !this.isPlay && this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // // this.$store.commit('leaflet/SET_PLAY_STATE', playStamp)
      // sessionStorage.setItem('SET_PLAY_STATE', playStamp) //存储
    },
    updateTime(e) {
      this.playTime = this.$refs.musicAudio.currentTime;
      this.playCurrentTime = this.timeFormat(this.$refs.musicAudio.currentTime);
      if (this.playTime >= this.totalDuration) {
        this.isPlay = false;
      }
      this.$emit('timeUpdate', {
        event: e,
        time: this.$refs.musicAudio.currentTime
      });
    },
    changeTime(val) {
      this.$refs.musicAudio.currentTime = val;
    },
    changeVolume(val) {
      this.$refs.musicAudio.volume = val / 100;
    },
    onPlay() {
      if (!this.manualPlay) {
        this.$refs.musicAudio.pause();
      }
    }
  }
};

/* script */
const __vue_script__$36 = script$36;

/* template */
var __vue_render__$36 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "xml-audio-player-page-pc" }, [
    _c("i", {
      staticClass: "el-icon-back",
      on: {
        click: function ($event) {
          return _vm.$emit("back")
        },
      },
    }),
    _vm._v(" "),
    _c("div", { staticClass: "audio-cover" }, [
      _c(
        "div",
        { staticClass: "square-wrapper" },
        [
          _c("el-image", {
            staticClass: "rotate",
            class: _vm.isPlay ? "active" : "paused",
            attrs: {
              src: _vm.coverImageUrl ? _vm.coverImageUrl : _vm.coverLocal,
              alt: "",
            },
          }),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "play-button",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  return _vm.play.apply(null, arguments)
                },
              },
            },
            [
              _c("i", {
                class: _vm.isPlay
                  ? "el-icon-video-pause"
                  : "el-icon-video-play",
              }),
            ]
          ),
        ],
        1
      ),
    ]),
    _vm._v(" "),
    _c("div", { staticClass: "audio-player-title" }, [
      _vm._v("\n    " + _vm._s(_vm.title) + "\n  "),
    ]),
    _vm._v(" "),
    _c(
      "div",
      {
        staticClass: "audio-controls",
        on: {
          click: function ($event) {
            _vm.showVolume = false;
          },
        },
      },
      [
        _c("div", { staticClass: "audio-controls__handler" }, [
          _c("div", { staticClass: "play-times" }, [
            _c("div", { staticClass: "current-time" }, [
              _vm._v(_vm._s(_vm.playCurrentTime)),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "progress" },
              [
                _c("el-slider", {
                  attrs: { max: _vm.totalDuration, "show-tooltip": false },
                  on: { change: _vm.changeTime },
                  model: {
                    value: _vm.playTime,
                    callback: function ($$v) {
                      _vm.playTime = $$v;
                    },
                    expression: "playTime",
                  },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "total-time" }, [
              _vm._v(_vm._s(_vm.playDuration)),
            ]),
          ]),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "volume-box",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                },
              },
            },
            [
              _c("el-slider", {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: _vm.showVolume,
                    expression: "showVolume",
                  },
                ],
                attrs: { vertical: "", height: "100px", "show-tooltip": false },
                on: { change: _vm.changeVolume },
                model: {
                  value: _vm.Volume,
                  callback: function ($$v) {
                    _vm.Volume = $$v;
                  },
                  expression: "Volume",
                },
              }),
              _vm._v(" "),
              _c("div", {
                staticClass: "volume-btn",
                class: _vm.Volume == 0 ? "volume-mute" : "",
                on: {
                  click: function ($event) {
                    $event.stopPropagation();
                    _vm.showVolume = !_vm.showVolume;
                  },
                },
              }),
            ],
            1
          ),
        ]),
      ]
    ),
    _vm._v(" "),
    _c("audio", {
      ref: "musicAudio",
      staticClass: "audio-component",
      attrs: {
        controls: "",
        preload: "auto",
        src: _vm.url,
        loop: _vm.loop,
        link: _vm.link,
      },
      on: {
        canplay: _vm.changeDuration,
        timeupdate: _vm.updateTime,
        pause: function ($event) {
          _vm.isPlay = false;
        },
        play: _vm.onPlay,
      },
    }),
  ])
};
var __vue_staticRenderFns__$36 = [];
__vue_render__$36._withStripped = true;

  /* style */
  const __vue_inject_styles__$36 = undefined;
  /* scoped */
  const __vue_scope_id__$36 = undefined;
  /* module identifier */
  const __vue_module_identifier__$36 = undefined;
  /* functional template */
  const __vue_is_functional_template__$36 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$36 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$36, staticRenderFns: __vue_staticRenderFns__$36 },
    __vue_inject_styles__$36,
    __vue_script__$36,
    __vue_scope_id__$36,
    __vue_is_functional_template__$36,
    __vue_module_identifier__$36,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$35 = {
  name: 'resource-list-pc',
  components: {
    xmlPreviewSearch: __vue_component__$38,
    VideoModalPlayer: __vue_component__$5A,
    audioPlayerPage: __vue_component__$37,
    audioPlayerPagePc: __vue_component__$36
  },
  props: {
    textBookResource: {
      type: Object,
      default: () => {}
    },
    resourceType: {
      type: String,
      default: ''
    },
    resourceIcon: {
      type: String,
      default: ''
    },
    resourcesList: {
      type: Array,
      default: () => []
    },
    userType: {
      // 用户类型，可选teacher、student
      type: String,
      default: 'teacher'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    graphStoreKeyPrefix: {
      type: String,
      default: ''
    },
    componentList: {
      type: Array,
      default: () => []
    },
    sysEnv: {
      type: Object,
      default: () => {}
    }
  },
  watch: {
    resourceType() {
      if (this.resourceType == 'teachingResource') {
        this.list = this.resourcesList || [];
      } else if (this.resourceType === 'graphList') {
        let list = this.textBookResource[this.resourceType] || [];
        // list.forEach((item) => {
        //   item.graphList = item.graphList.map(graph => {
        //     // console.log(graph, this.graphStoreKeyPrefix,);

        //     return findNodeTree(graph, this.graphStoreKeyPrefix)
        //   })
        // })
        this.list = list;
      } else {
        this.list = this.textBookResource[this.resourceType] || [];
      }
      if (this.list.length > 0) {
        this.launchValue = 'teaching-resource_' + (this.resourceType == 'teachingResource' ? this.list[0].firstLevelId : this.list[0].chapterId);
      }
    },
    resourcesList() {
      if (this.resourceType == 'teachingResource') {
        this.list = this.resourcesList || [];
      }
    }
  },
  data() {
    return {
      list: [],
      launchValue: '',
      //教师资源展开的唯一值
      location: '',
      Ahover: false,
      itemHoverStates: {},
      videoData: {
        show: false,
        src: '',
        info: {},
        content: ""
      },
      audioData: {
        show: false,
        src: '',
        title: '',
        info: {}
      },
      isMasked: false,
      audioUrl: '',
      isPlay: '',
      currentResources: '',
      endTime: 0,
      learningTools: this.sysEnv.learningTools,
      videoTemp: {},
      audioTemp: {}
    };
  },
  mounted() {
    this.sendList();
  },
  methods: {
    sendList() {
      this.$EventBus.$emit('listUpdate', this.list);
    },
    getFileUrl(url) {
      if (url && url.indexOf('./') !== -1) {
        return this.resourceBasisPath + url.split('./')[1];
      } else if (url && url.indexOf('./') === -1) {
        return url;
      }
    },
    // 跳转到资源所在位置
    resourceDetails(item, items) {
      console.log(item, items, 'item, items');
      this.currentResources = items.id;
      this.location = '';
      let data = {
        location: items.location,
        maxTop: -30,
        type: 'resource',
        selectorType: 'class',
        selectorId: items.titleClass,
        markTarget: '',
        classIndex: items.index
      };
      this.$emit('resourceDetails', data);
    },
    // 跳转教师笔记
    goTeacherNotes(item, items) {
      this.location = '';
      let list = items.location.split('/');
      let selectorId = `${list[2]}_#_${items.markEfiCode}`;
      let data = {
        location: items.location,
        maxTop: -30,
        type: 'marker',
        selectorType: 'id',
        selectorId,
        markTarget: items,
        classIndex: 0
      };
      this.$emit('resourceDetails', data);
    },
    resourcePlay(item, items) {
      if (items.resourcesType == 'recorded') {
        if (this.isPlay == '') {
          this.isPlay = items.id;
          this.audioUrl = items.fileUrl;
          this.$nextTick(() => {
            this.$refs.musicAudio.play();
          });
        } else {
          this.isPlay = '';
          this.$refs.musicAudio.pause();
        }
      }
    },
    // 跳转到资源所在位置
    resourceReader(item, items) {
      this.$emit('resourceReader', items);
    },
    setHoverState(index, isHovered) {
      this.$set(this.itemHoverStates, index, isHovered);
    },
    isItemHovered(index) {
      return this.itemHoverStates[index] || false;
    },
    // 图片预览
    imgPreview(item, items) {
      if (!items.isTrialExternal) {
        this.$EventBus.$emit('learningStatistics', {
          type: 'image',
          info: items
        });
        this.$hevueImgPreview({
          multiple: true,
          nowImgIndex: 0,
          imgList: [{
            url: this.getFileUrl(items.uploadFileUrl),
            title: items.title
          }]
        });
      }
      // this.$refs.xmlPopup.show = false
    },
    //资源预览
    resourcePrewiew(item, items) {
      if (items.isTrialExternal) {
        return;
      }
      if (items.resourcesType == 'image') {
        this.$EventBus.$emit('learningStatistics', {
          type: 'image',
          info: items
        });
        this.$hevueImgPreview({
          multiple: true,
          nowImgIndex: 0,
          imgList: [{
            url: this.getFileUrl(items.fileUrl),
            title: items.resourcesName
          }]
        });
      } else if (items.resourcesType == 'video') {
        this.videoData.src = this.getFileUrl(items.fileUrl);
        this.videoData.show = true;
        this.videoData.content = items.content;
        this.videoData.info = items;
      } else if (items.resourcesType == 'audio') {
        this.audioData.src = this.getFileUrl(items.fileUrl);
        this.audioData.show = true;
        this.audioData.title = items.resourcesName;
        this.audioData.info = items;
      } else if (items.resourcesType == 'office' || items.resourcesType == 'resources') {
        this.$emit('PrewiewOff', items);
      } else if (items.resourcesType == 'recorded') {
        if (this.isPlay == '') {
          this.isPlay = items.id;
          this.audioUrl = items.fileUrl;
          this.$nextTick(() => {
            this.$refs.musicAudio.play();
          });
        } else {
          this.isPlay = '';
          this.$refs.musicAudio.pause();
        }
      }
    },
    // 图谱预览
    graphPreview(graph) {
      this.$EventBus.$emit('graphPreview', graph);
    },
    // 打开学习工具
    openLearningTools(item) {
      this.$EventBus.$emit('xmlOpenLink', {
        url: item.url,
        title: item.name
      });
    },
    // 视频预览
    videoPreview(item, items) {
      this.videoTemp = items;
      // console.log('items', items,item);
      if (!items.isTrialExternal) {
        this.videoData.src = this.getFileUrl(items.uploadFileUrl);
        this.videoData.show = true;
        this.videoData.content = items.content;
        this.videoData.info = items;
      }
      // this.$refs.xmlPopup.show = false
    },
    handleClose(done) {
      this.$confirm('确认关闭？').then(_ => {
        done();
      }).catch(_ => {});
    },
    // 音频预览
    audioPreview(item, items) {
      console.log(this.audioTemp, '预览音频');
      this.audioTemp = items;
      this.audioData.src = this.getFileUrl(items.uploadFileUrl);
      this.audioData.show = true;
      this.audioData.title = items.resourcesName;
      this.audioData.info = items;
      // this.$refs.xmlPopup.show = false
    },
    // 删除教师笔记
    deleteTeacherNotes(items) {
      this.$confirm(`确认删除此条笔记吗？`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        duration: 1000
      }).then(() => {
        this.$emit('deleteTeacherNotes', items);
      }).catch(() => {});
    },
    deleteFile(item, items) {
      this.$confirm(`确认删除${items.resourcesName}吗？`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        let data = {
          firstLevelId: item.chapterId,
          firstLevelLabel: item.firstLevelLabel,
          ...items
        };
        this.$emit('deleteTeachingResource', data);
      }).catch(() => {});
    },
    editFile(item, items) {
      let data = {
        firstLevelId: item.chapterId,
        firstLevelLabel: item.firstLevelLabel,
        ...items
      };
      this.$emit('editTeachingResource', data);
    },
    //下载
    downLoadFile(item, items) {
      // this.$emit('downLoadFile',items)
      // console.log(items,this.resourceBasisPath);
      window.open(items.fileUrl);
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      } else {
        return '';
      }
    },
    change(e) {
      let i = e.split('_');
      let id = i[1];
      for (let index = 0; index < this.list.length; index++) {
        const element = this.list[index];
        if (element.chapterId == id) {
          this.list[index].state = true;
          return;
        }
      }
    },
    seachItem(item, text) {
      let data = {
        location: item.location,
        maxTop: -30,
        type: 'search',
        selectorType: 'class',
        selectorId: 'xml-search-highlight',
        markTarget: '',
        classIndex: 0,
        seachText: text
      };
      this.$emit('resourceDetails', data);
    },
    scrollFun(firstLevelId, location) {
      let currentTime = new Date().getTime();
      this.launchValue = 'teaching-resource_' + firstLevelId;
      if (location == this.location && currentTime > this.endTime + 2000) {
        this.location = '';
        this.endTime = new Date().getTime();
      }
      setTimeout(() => {
        this.location = location;
      }, 200);
      setTimeout(() => {
        let Dom = document.getElementsByClassName('current-teacher-resources')[0];
        if (Dom) {
          let scrollTop = this.$refs.xmlResourceListPc.scrollTop + (Dom.getBoundingClientRect().top > 50 ? Dom.getBoundingClientRect().top - 50 : Dom.getBoundingClientRect().top < 0 ? Dom.getBoundingClientRect().top - 50 : 0);
          this.$refs.xmlResourceListPc.scrollTop = scrollTop;
        }
      }, 700);
    },
    formatTime(time) {
      if (time) {
        let Seconds = time / 1000;
        let m = parseInt(Seconds / 60);
        let s = Seconds % 60;
        // let date = (m > 9 ? m : '0' + m) + "'" + (s > 9 ? s : '0' + s) +
        let date = (m > 0 ? m + "'" : '') + s + '"';
        return date + ' 录音';
      } else {
        return '录音';
      }
    },
    timeVideoUpdate({
      event,
      time
    }) {
      // console.log({event, time},'侧边栏视频');
      this.$EventBus.$emit('videoTimeUpdate', {
        event,
        time,
        data: {
          ...this.videoTemp,
          duration: event.cache_.duration,
          time
        },
        info: this.videoData.info
      });
    },
    timeAudioUpdate({
      event,
      time
    }) {
      // console.log({event, time},this.audioData,'侧边音频');
      this.$EventBus.$emit('audioTimeUpdate', {
        event,
        time,
        data: {
          ...this.audioTemp,
          time,
          duration: ''
        },
        info: this.audioData.info
      });
    }
  }
};

var __$_require_static_images_icons_resource_lock_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2230%22%20height%3D%2230%22%20viewBox%3D%220%200%2030%2030%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M25.0612%2012.739H22.8417V8.07855C22.8417%204.17358%2019.3255%201%2014.9998%201C10.6744%201%207.15441%204.17358%207.15441%208.07855V12.739H4.93665C3.86676%2012.739%203%2013.5216%203%2014.4874V27.25C3%2028.2171%203.86676%2029%204.93665%2029H25.0632C26.1331%2029%2027%2028.2171%2027%2027.25V14.4874C27%2013.5216%2026.1332%2012.739%2025.0612%2012.739ZM16.0872%2021.2017V23.9876C16.0872%2024.1124%2015.9729%2024.2183%2015.8342%2024.2183H14.1676C14.0268%2024.2183%2013.9129%2024.1124%2013.9129%2023.9876V21.2017C13.1299%2020.8396%2012.5881%2020.1168%2012.5881%2019.2691C12.5881%2018.0675%2013.6696%2017.0917%2014.9998%2017.0917C16.3305%2017.0917%2017.4099%2018.0675%2017.4099%2019.2691C17.4136%2020.1168%2016.8702%2020.8396%2016.0872%2021.2017ZM19.831%2012.739H10.1687V8.19313C10.1687%205.7886%2012.3392%203.83183%2015.0019%203.83183C17.6664%203.83183%2019.8309%205.7886%2019.8309%208.19313L19.831%2012.739Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E";

var __$_require_static_images_default_over_video_cover_png__ = "data:image/png;base64,[encoded data, 4848 characters]";

var __$_require_static_images_icons_resource_note_icon_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2218%22%20viewBox%3D%220%200%2018%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M9.27034%2010.2555C9.80903%209.48573%2011.7823%206.71929%2012.5213%206.12418C11.579%208.23479%209.72279%2010.4064%208.61195%2012.4771C10.664%2013.1309%2011.594%2012.356%2012.7261%2011.4539L11.6043%2011.2515C13.029%2010.8125%2012.9295%2010.9751%2013.4284%2010.3266C13.8242%209.8123%2014.1527%209.11816%2014.2731%208.39322L13.346%208.50179C13.6418%208.33986%2014.3005%208.05532%2014.4052%207.89662C14.685%207.47231%2015.42%203.41471%2015.4286%202.57129C12.5954%202.59592%208.06861%208.16155%207.74116%2010.8215C7.41169%2013.4959%204.17444%2017.537%209.27034%2010.2555ZM13.4937%2011.7593C14.3387%2012.2331%2014.8413%2012.845%2014.8413%2013.5268C14.8413%2017.2052%202.57141%2017.2052%202.57141%2013.5268C2.57141%2011.8377%205.35854%2011.0801%206.80242%2010.8726C6.76843%2011.0999%206.69425%2011.3317%206.59731%2011.5687C5.60493%2011.7394%203.26887%2012.3708%203.26887%2013.5268C3.26887%2016.3054%2014.1438%2016.3054%2014.1438%2013.5268C14.1438%2013.0392%2013.6767%2012.574%2012.9049%2012.2C13.1025%2012.0647%2013.2964%2011.9154%2013.4937%2011.7593Z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E";

var __$_require_static_images_icons_resource_invisible_02_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAADTlvzyAAAAAXNSR0IArs4c6QAAAstJREFUSEu9lVmIjmEYhq/HHkWWE0v2UrInSSlLyhZFzoyEI2eWKCYksmQ5c2QcYE6USGMpWVLW5ECRbexbKSRkncd3j+f7vfP7zUhj3pr+f/q/972e537v+/mMJl7WxDx+A7r7BGA6UG5mHxu7oFLAHcAS4IzAjQ0tBWwLVAHj/we05B26ezH0IDAOGAz0BlqH1J+BB8B14BxwyMye13cNfzSNuw8HLgGtkgO+A0+Bt0BzoDPQBWgZz9QICqw1sxulwKUk1UHl8dcC+AS0AW4BY4BO8enABeBJBhkKTAPmhwIqbFMGXGdm+l5YdYAh5YHYrC5WAZXA4bjTR0CvZL+ge4DFZvbF3VWgoJuj+2PAnNR4BaC7q7PjwKTMnVeB2Wb2WIdHITcT2BbgA7AgOqows0V5Ie7eI6QdCZwEpuSdpsANwGrgiqBm9i45oB9wL+msNjJhnmtRSH8zu5/saR+wUdkdbzQzXdPP4Lt7H+AOIMgQM3uW6u7uZcBeQJ3pgEJkgGXAeqDMzPYX7eseDhZ8gArKgergNvAmgC+KNs4F9gFrgO1FOZUiK4F5ZqZnCsvduwawYwCrU0lV/YpwniQtjDV37xuSyjQjAOUvHw45QJJWJ5Iqy7o/OXurmamoX7M0HHYCmAhczCqbZWYvkwN2ZxFYmLnwYTizXXSmR1TIwLxId++WDQkNi9HAqSzPk7M7/FYHmLjxSEBfxf1UmlmNu2sA7ApnpnHKoyIjzZS7gW0RC8FmlIxF0ommhhy7PDNDM+AuUAEcBRQNjTbJJKiCr8LOA4MiKupcYRdUb5zazvJV32gbFuCpifSaOpqVrzMDaYx1KJqtOvdrJuNYM7ucghoEJh33DJny4a3/NSS0VL0ipOF9NrJZ71vmn9747i7ZzMzeF8WgwVfbPwFLSVUUhzwyO7OJtfSv7rC+Qxv6LWavjFdlZqfT538AuZz9F89GCIAAAAAASUVORK5CYII=";

var __$_require_static_images_icons_resource_invisible_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAADTlvzyAAAAAXNSR0IArs4c6QAAA6pJREFUSEu9lVtoXFUUhr91ztgJBup4IRAVrVooiNYLIhIQqhLwUhQszpMVMWZ2koGAVixo0EEqWqkKecjkzDh9iPZlQCJSLxBqpWC8ID4ELN61XiaGghkalYzJ2cvZ9ZzhNJm2UGL30wxn7/Xttdb/ry2c5SVnmccqYLlcvt1auxUYMcb8vdYXWgUMguAV4DHgILB1raHtgOcC+4Hb/g9o2x4GQbAS+qaIbFHVa4ENQDoqdQP4UVVnRORQKpWa7Ovrq52qDScVTbFYvMHzvE+AdYkAIfArUAd84ELgIuCcaI8FJkXk2Vwu92U78CpgtVr15+fnR5xogBSwCHQAX4Vh2OP7/gUi0mOtVWvttO/7v6jqdSJyD/BwVIFQRF7IZDKFbDbrLtlaJwCjUlYBd9hl8VSj0diXTqffinp6BLg8cV5FZG8mkxnKZrP/FAqFVHd3t4O+6LIXkXdV9YGk8FpAl1m9Xn9PVXub6vwc2GaM+dkFjy5yOIaJyG5V/Qt4xGUkIpVcLvdofJFyuXyptXayKb6bRGQqk8ncFWfaAgZBsAt4WkQ+W1xc7B0eHj4WBwiC4Crgu0Rmxy0ThmHa9/0v3EXCMNw4NDT0Q7xndHR0fUdHx5Sq3tzs8fPGGNei/4xfLpevsNZ+Axyz1m4eHBz8LVn3Uqm0XVUnosxcgJZlgB3Ac6q6fWBg4I3kuWKxeInneTPA+jAMN7kLHQdGGXwNzAObjTGzyYPj4+MPisjrwDPAy0mfuoqo6k4ReSiXy7k9rRUEQTfggOcDm4wx3ydLuht4EpgGepONHhsbu9L3fVfSI2EY3uj7vvNfPBxiwEYXMNEG5+UpoAd4yRizs1VS9yNS2PvAHcDHy8vL9+fz+d/jAKVS6TVV7WtK/ydgr4h0usyi7069V8eXrFQqFy8tLblhcQtwYHZ29s5CobB8AjChxrcj6FER2VGr1fYVCgVbrVbX1ev1MVV1ykzaKbbKwVQqdV8YhttUdU80FA4A97a1RaIUbmo4xT7RFIMHfKuqFVV9Z25u7nBXV9cGz/N6PM8TVZ1uNBpH0+n0R8A1gLNKJ+CMv6dWq43EmcXxTzraSqXS9arqwHcnMnJTx83KP0TEqup5K2ari7vULOOtxphPkwI6LTCR8WVuCABbADe83X83R91yfXEWmlHVD0XEvaOnfGXO6MWfmJjoXFhYkHw+/+cKG5z2aTsjYLtSrbBDbJlXjTGPJ/evOTCh9l2e5+3v7+//IAn8F8PthyYfFsMJAAAAAElFTkSuQmCC";

var __$_require_static_images_icons_books_edit_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAYAAAAy2w7YAAAAAXNSR0IArs4c6QAAAphJREFUSEu11k9IFFEcB/Dvb8ZNF3cmgi3Cg/1B7BIkEYTOJrKnPUQh/YEoPHiNCFxWy5MFhe0sEXiqDkUURNElpItgUUyGYJfCUikIwQ4FhTOuUrvvF7PbbLrN/pvdfcf3Zn4ffr/33m+GUIMRCOk9xNAB+Ag8vGwMPssPS9U6gS49TIRxBmYl4BMDvYB03DSiT9fHrgpyEIDeKGvW4aWZkaSixS8AdDkf8wz9Q7DYCHHguzFkOhm4YZ6gXLkYH4jQwcBDq2VHHx6fTBfCKobyy2U1BXoZfK8YRqCjFUFue2JnoGqJ0wWxkD4ORrBsqBDilMoNCxy6upXEpmkGz5cFlULcMPZxVPpNEwC2M9I9JaFykXwMwDKAlBByeGVq4F1RqFLExuxyScI3w0BQCPmgjdjzBSGvCAnfpF0uJxMnU1eo1ohrRvVA/oPqhWyA6onkIDUU72OmWwCmlbWViN2FS30+spfRfePd3s0cBkXTXwHoAmAxke5v8N/49uKsVQirFMllpGiJ94C4D9BOAP3Zy8Y3zR/JS5gd+bUe9IJkoROPZGXpS5IhIpYx9HyLNtqagnwFwBmAL5rG4KgDeUUy0OZufZdI43NKllpXX0YXc0E1/QEBYVPIuzE1sFoNkoHUUDwimJ5YRqx5fYnUzuttLKU/gnmY5dSdSjbe9TCoocR5Zu43jdi+/AcUTb8L4AiArwC25beVUidzw89JQNPHCGgxjdgxeyGoXVOSoqFNktLtYHQS0Tn7cAghdzsNshIg1+tUTZ9gYC+AeQDtdkP8u7iUmWP+yaAx63XMbpaeByla/DYDfjAtAJgTLM01NzYtFLtHXrSSHz4vQQt2hloFKxaH1FDiFMB76ovRHClaYhLg/XWG3v4BEfuzLdxGxe4AAAAASUVORK5CYII=";

var __$_require_static_images_icons_books_delete_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAeCAYAAAA2Lt7lAAAAAXNSR0IArs4c6QAAAfBJREFUSEvtlrFrVEEQxr+Zl+SCWuTSihEh9hGEFCKJCCa7uesUMRYasPVv8AoFO9E/QCxExMZY5O07SJEiWiloZZugoGJjRJHD7H66icpx9+5y78BGb9qdmd/sx+zMCv6ySS/5Wa3uQ5KM5Po2GkGc+9wpT1cAFxbKnnwi5Mk9CtlU4KI497TVryvAG3MVwB0B6gTe50JIhch5AdbVudPFANbWQF5TkWOSpi873cJbu3OWpOlULoCVytHg/WMAB1ockhgH4DsAdpFp+NdZ9Gu2LzsScW5u0qs+EJERkJMA9kPkVS8N0OZDTgAoA3hNYBfQbNvGrAkwkzjXU4e1xntj7gG4pOQRybKN/wTgjbkO4Fvi3I1taxeFrCbOXaC1UyRvSghLUq+/i3L1JZE3ZgMin2Ib/klQKpVDo3EZwK1AnhrOsrUBYCDR7pvMe8mDLtpz2P0DEs3PP6fI1yHnZry1t0FeUWDcA2cFuK+qx2Vl5UXfoyIuf8Tfw+rqFo0pIYTxONwICKydkDTd/K1zX8OuyGbrGaDOqXTfw7ncYO0jkucUOCTOvW3baN6YuwCWSD5T4GOR6qE69DPuDIAPOj19WGq10AZgpXLQe/9QgBOIGhe3N0ouSpatx9COCTg7O4qxsdHC+ZeXt5ql7afCQswffRcc+OCKtZMAAAAASUVORK5CYII=";

var __$_require_static_images_icons_resource_download_icon_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA7RJREFUWEftlk9oFHcUx79vZsXdzExZTz0YMIKlQSxdQci6o5DSHCL2EJCempKA9laoJftPrDiiEHY3oMUeBD2kVMFCwYCUWkIxh8xutDm0UEoKFiPYPwdB6c7UmJ2dZ36bbjPZbHZnlxUv/q7z3vt+fu/3/gzhJR96yfp4BdByBkJ9magcoBEwDYC4RzwhMR66wAxYum4X4t+38qz+ASJGWFO6zgM0KgSY8QuABQAOwL1EFFkV5luOwx89vZN66AfEF4DSd+F1kkszROgF4yqxc+afwol7XoFgdLxnixw4C2AYzIslSP1L+fiDZhC+AFQ9O02gARc0apvxLxsF1fTcUQBXmLHgAmkq2XfsH42/N/NpCqDpEyMATzLzOSufPNXsRuK7pmfHAUpXbZl5iojTRTP1W61/fYCIEVa7lE8AHiSiPQxY1h/2TiwaS34A0G8EQk9D+wIy9UKiw8w8JGqFXXfILqTXFekGAOVg5l0q0yQRdTMgUncPkL6wzLGvfYnXMXrtQK6PGVMMDhM44s3EOgBNz7zJoJ/AeMQsj9qFsR/aFa31ExAu8yxAs5aZeKf6fR2AquduExAplZ29S3MnFjslXo2jxXJfgTBcKjs7q/H/B/ivje6DkS7mE5lOi4t4aix7ZKWmvnHhDttm6lpliFWFFD3zgQTpKvPyW1b+pBgyHT9qdLyf5MBt1+XjdiH5eQ3AxIgEnlx2nTee1QyZTpGsZWBtnqxlIJobkGRMlxnv/ZtPfNspUW8cTc9eBuiY95JrRdhjBLXtyl8rvT9XNJOH/ACosewNMSPsfPLDZvbB2MSOALkLBJovmomD9bsgljtJhHPMMKx84kyzoFose5+BJ1Y+ubehrVhkXV3TTNjDJTlq3x37uS6AmGBaSbkJYBDMc2WmKxI7v8NxH1nzGwuzIUDECCvBrfsgSW8T6LgYbPU6bOMo7jeC6rKSAnGaQMEqab3ibASg6rmLBHws/MVEZVDcNuOV1vOezZdRZR+EBiSSul24S5aZulTr3Ahg6/7xXVskaZDL7oIdfDaDGcOp90xNt6HXKdSX6ZYDpFtmsrIXagFEmzmQ5v38B9SvgSZVp8ayZ4nos5WhNlE0EwkvgBrLnSaCwcAFy0x82qyA2wLAbkNVtynfEXBACBHzkOgCgKZWxWnWemwdwq+G9WIARFQPxGqBsUOgQDvi60axX+KKXQ0EgFvFx/b7rdy8vSfwUq5C3AQjbP1p7/f9t+S7DVtKSfvGLbVh+zKbe74CeA6HppswnaiUHAAAAABJRU5ErkJggg==";

/* script */
const __vue_script__$35 = script$35;
var __vue_render__$35 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { ref: "xmlResourceListPc", staticClass: "xml-resource-list-pc" },
    [
      _vm.resourceType == "imageList"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.chapterId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " + _vm._s(item.label) + "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticClass: "flie-title resource-list",
                        class: { "is-masked": _vm.isMasked },
                      },
                      _vm._l(item[_vm.resourceType], function (items, index) {
                        return _c(
                          "div",
                          {
                            staticClass: "resource-item image-item",
                            class: { "is-masked": _vm.isMasked },
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.imgPreview(item, items)
                              },
                            },
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: items.isTrialExternal,
                                    expression: "items.isTrialExternal",
                                  },
                                ],
                                staticClass: "mask-layer-trial-external",
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_lock_svg__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "cover",
                                attrs: { title: "点击预览" },
                              },
                              [
                                item.state
                                  ? _c("img", {
                                      attrs: {
                                        src: _vm.getFileUrl(
                                          items.uploadFileUrl
                                        ),
                                        alt: "",
                                      },
                                    })
                                  : _vm._e(),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", { staticClass: "image-title-box" }, [
                              _c(
                                "div",
                                {
                                  staticClass: "image-title",
                                  attrs: {
                                    title: _vm.removeStyle(items.title),
                                  },
                                },
                                [
                                  _vm._v(
                                    "\n                " +
                                      _vm._s(
                                        items.title
                                          ? _vm.removeStyle(items.title)
                                          : item.label
                                      ) +
                                      "\n              "
                                  ),
                                ]
                              ),
                              _vm._v(" "),
                              _c("div", {
                                staticClass: "resource-icon",
                                attrs: { title: "跳转" },
                                on: {
                                  click: function ($event) {
                                    $event.stopPropagation();
                                    return _vm.resourceDetails(item, items)
                                  },
                                },
                              }),
                            ]),
                          ]
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "videoList" ||
          _vm.resourceType == "animationList" ||
          _vm.resourceType == "curriculumList"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.chapterId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " + _vm._s(item.label) + "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "resource-list" },
                      _vm._l(item[_vm.resourceType], function (items, index) {
                        return _c(
                          "div",
                          {
                            staticClass: "resource-item image-item",
                            on: {
                              mouseover: function ($event) {
                                return _vm.setHoverState(index, true)
                              },
                              mouseout: function ($event) {
                                return _vm.setHoverState(index, false)
                              },
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.videoPreview(item, items)
                              },
                            },
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: items.isTrialExternal,
                                    expression: "items.isTrialExternal",
                                  },
                                ],
                                staticClass: "mask-layer-trial-external",
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_lock_svg__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "cover",
                                attrs: { title: "点击预览" },
                              },
                              [
                                item.state && items.coverFileUrl
                                  ? _c("img", {
                                      attrs: {
                                        src: _vm.getFileUrl(items.coverFileUrl),
                                        alt: "",
                                      },
                                    })
                                  : _vm._e(),
                                _vm._v(" "),
                                !items.coverFileUrl
                                  ? _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_default_over_video_cover_png__,
                                        alt: "",
                                      },
                                    })
                                  : _vm._e(),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", { staticClass: "image-title-box" }, [
                              _c(
                                "div",
                                {
                                  staticClass: "image-title",
                                  attrs: {
                                    title: _vm.removeStyle(items.title),
                                  },
                                },
                                [_vm._v(_vm._s(_vm.removeStyle(items.title)))]
                              ),
                              _vm._v(" "),
                              _c("div", {
                                staticClass: "resource-icon",
                                attrs: { title: "跳转" },
                                on: {
                                  click: function ($event) {
                                    $event.stopPropagation();
                                    return _vm.resourceDetails(item, items)
                                  },
                                },
                              }),
                            ]),
                          ]
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "audioList"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.chapterId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " + _vm._s(item.label) + "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "resource-list" },
                      _vm._l(item[_vm.resourceType], function (items, index) {
                        return _c(
                          "div",
                          {
                            staticClass: "resource-item",
                            on: {
                              mouseover: function ($event) {
                                return _vm.setHoverState(index, true)
                              },
                              mouseout: function ($event) {
                                return _vm.setHoverState(index, false)
                              },
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.audioPreview(item, items)
                              },
                            },
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: items.isTrialExternal,
                                    expression: "items.isTrialExternal",
                                  },
                                ],
                                staticClass:
                                  "mask-layer-trial-external min-mask-layer",
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_lock_svg__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "icon",
                              class: _vm.resourceIcon,
                            }),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "flie-title resource-title",
                                attrs: { title: items.title },
                              },
                              [_vm._v(_vm._s(items.title))]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "resource-icon",
                              attrs: { title: "跳转" },
                              on: {
                                click: function ($event) {
                                  $event.stopPropagation();
                                  return _vm.resourceDetails(item, items)
                                },
                              },
                            }),
                          ]
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "questionList"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.chapterId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " + _vm._s(item.label) + "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "resource-list" },
                      _vm._l(item[_vm.resourceType], function (items, index) {
                        return _c(
                          "div",
                          {
                            staticClass: "resource-item",
                            on: {
                              mouseover: function ($event) {
                                return _vm.setHoverState(index, true)
                              },
                              mouseout: function ($event) {
                                return _vm.setHoverState(index, false)
                              },
                            },
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: items.isTrialExternal,
                                    expression: "items.isTrialExternal",
                                  },
                                ],
                                staticClass:
                                  "mask-layer-trial-external min-mask-layer",
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_lock_svg__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "icon",
                              class: _vm.resourceIcon,
                            }),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "flie-title resource-title",
                                attrs: {
                                  title: _vm.removeStyle(items.stem.content),
                                },
                              },
                              [
                                _vm._v(
                                  "\n              " +
                                    _vm._s(
                                      _vm.removeStyle(items.stem.content)
                                    ) +
                                    "\n            "
                                ),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "resource-icon",
                              attrs: { title: "跳转" },
                              on: {
                                click: function ($event) {
                                  $event.stopPropagation();
                                  return _vm.resourceDetails(item, items)
                                },
                              },
                            }),
                          ]
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "testPaperList"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.chapterId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " + _vm._s(item.label) + "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "resource-list" },
                      _vm._l(item[_vm.resourceType], function (items, index) {
                        return _c(
                          "div",
                          {
                            staticClass: "resource-item",
                            on: {
                              mouseover: function ($event) {
                                return _vm.setHoverState(index, true)
                              },
                              mouseout: function ($event) {
                                return _vm.setHoverState(index, false)
                              },
                            },
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: items.isTrialExternal,
                                    expression: "items.isTrialExternal",
                                  },
                                ],
                                staticClass:
                                  "mask-layer-trial-external min-mask-layer",
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_lock_svg__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "icon",
                              class: _vm.resourceIcon,
                            }),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "flie-title resource-title",
                                attrs: { title: items.paperName },
                              },
                              [
                                _vm._v(
                                  "\n              " +
                                    _vm._s(items.paperName || items.title) +
                                    "\n            "
                                ),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "resource-icon",
                              attrs: { title: "跳转" },
                              on: {
                                click: function ($event) {
                                  $event.stopPropagation();
                                  return _vm.resourceDetails(item, items)
                                },
                              },
                            }),
                          ]
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "formulaList" ||
          _vm.resourceType == "interactionList"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.chapterId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " + _vm._s(item.label) + "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "resource-list" },
                      _vm._l(item[_vm.resourceType], function (items, index) {
                        return _c(
                          "div",
                          {
                            staticClass: "resource-item flex-column",
                            on: {
                              mouseover: function ($event) {
                                return _vm.setHoverState(index, true)
                              },
                              mouseout: function ($event) {
                                return _vm.setHoverState(index, false)
                              },
                            },
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: items.isTrialExternal,
                                    expression: "items.isTrialExternal",
                                  },
                                ],
                                staticClass: "mask-layer-trial-external",
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_lock_svg__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", { staticClass: "resource-title-box" }, [
                              _c("div", {
                                staticClass: "icon",
                                class: _vm.resourceIcon,
                              }),
                              _vm._v(" "),
                              _c(
                                "div",
                                {
                                  staticClass: "flie-title resource-title",
                                  attrs: { title: items.fileNames },
                                },
                                [_vm._v(_vm._s(items.fileNames))]
                              ),
                              _vm._v(" "),
                              _c("div", {
                                staticClass: "resource-icon",
                                attrs: { title: "跳转" },
                                on: {
                                  click: function ($event) {
                                    $event.stopPropagation();
                                    return _vm.resourceDetails(item, items)
                                  },
                                },
                              }),
                            ]),
                            _vm._v(" "),
                            _c("XmlSingleHtmlGroupRender", {
                              directives: [
                                {
                                  name: "show",
                                  rawName: "v-show",
                                  value: _vm.resourceType == "formulaList",
                                  expression: "resourceType == 'formulaList'",
                                },
                              ],
                              attrs: {
                                pageType: "pc",
                                mode: "preview",
                                "p-group-data": {
                                  htmlData: Object.assign({}, items),
                                },
                                resourceBasisPath: _vm.resourceBasisPath,
                              },
                            }),
                          ],
                          1
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "resourceList"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.chapterId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " + _vm._s(item.label) + "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "resource-list" },
                      _vm._l(item[_vm.resourceType], function (items, index) {
                        return _c(
                          "div",
                          {
                            staticClass: "resource-item",
                            on: {
                              mouseover: function ($event) {
                                return _vm.setHoverState(index, true)
                              },
                              mouseout: function ($event) {
                                return _vm.setHoverState(index, false)
                              },
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.resourceDetails(item, items)
                              },
                            },
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: items.isTrialExternal,
                                    expression: "items.isTrialExternal",
                                  },
                                ],
                                staticClass:
                                  "mask-layer-trial-external min-mask-layer",
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_lock_svg__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "icon",
                              class: _vm.resourceIcon,
                            }),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "flie-title resource-title",
                                attrs: {
                                  title:
                                    items.ilk == "ebook"
                                      ? items.name
                                      : items.title,
                                },
                              },
                              [
                                _vm._v(
                                  "\n              " +
                                    _vm._s(
                                      items.ilk == "ebook"
                                        ? items.name
                                        : items.title
                                    ) +
                                    "\n            "
                                ),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "resource-icon",
                              attrs: { title: "跳转" },
                              on: {
                                click: function ($event) {
                                  $event.stopPropagation();
                                  return _vm.resourceDetails(item, items)
                                },
                              },
                            }),
                          ]
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "graphList"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.chapterId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " + _vm._s(item.label) + "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "resource-list" },
                      _vm._l(item[_vm.resourceType], function (items, index) {
                        return _c(
                          "div",
                          {
                            staticClass: "resource-item graph-item",
                            on: {
                              mouseover: function ($event) {
                                return _vm.setHoverState(index, true)
                              },
                              mouseout: function ($event) {
                                return _vm.setHoverState(index, false)
                              },
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.graphPreview(items)
                              },
                            },
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: items.isTrialExternal,
                                    expression: "items.isTrialExternal",
                                  },
                                ],
                                staticClass:
                                  "mask-layer-trial-external min-mask-layer",
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_lock_svg__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", { staticClass: "graph-item__title" }, [
                              _c(
                                "div",
                                {
                                  staticClass: "resource-title",
                                  attrs: { title: items.name },
                                },
                                [
                                  _vm._v(
                                    "\n                " +
                                      _vm._s(items.name) +
                                      "\n              "
                                  ),
                                ]
                              ),
                              _vm._v(" "),
                              _c("div", {
                                staticClass: "resource-icon",
                                attrs: { title: "跳转" },
                                on: {
                                  click: function ($event) {
                                    $event.stopPropagation();
                                    return _vm.resourceDetails(item, items)
                                  },
                                },
                              }),
                            ]),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "graph-item__viewer",
                                attrs: { title: "点击预览" },
                              },
                              [
                                _c("XmlKnowledgeGraph", {
                                  attrs: { model: items },
                                }),
                              ],
                              1
                            ),
                          ]
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "tableList"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.chapterId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " + _vm._s(item.label) + "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "resource-list" },
                      _vm._l(item[_vm.resourceType], function (items, index) {
                        return _c(
                          "div",
                          {
                            staticClass: "resource-item",
                            on: {
                              mouseover: function ($event) {
                                return _vm.setHoverState(index, true)
                              },
                              mouseout: function ($event) {
                                return _vm.setHoverState(index, false)
                              },
                            },
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: items.isTrialExternal,
                                    expression: "items.isTrialExternal",
                                  },
                                ],
                                staticClass:
                                  "mask-layer-trial-external min-mask-layer",
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_lock_svg__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "icon",
                              class: _vm.resourceIcon,
                            }),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "flie-title resource-title",
                                attrs: { title: items.tableInfo.tableTitle },
                              },
                              [
                                _vm._v(
                                  "\n              " +
                                    _vm._s(items.tableInfo.tableTitle) +
                                    "\n            "
                                ),
                              ]
                            ),
                            _vm._v(" "),
                            _c("div", {
                              staticClass: "resource-icon",
                              attrs: { title: "跳转" },
                              on: {
                                click: function ($event) {
                                  $event.stopPropagation();
                                  return _vm.resourceDetails(item, items)
                                },
                              },
                            }),
                          ]
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "teachingResource"
        ? [
            _c(
              "el-collapse",
              {
                attrs: { accordion: "" },
                on: { change: _vm.change },
                model: {
                  value: _vm.launchValue,
                  callback: function ($$v) {
                    _vm.launchValue = $$v;
                  },
                  expression: "launchValue",
                },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c(
                  "el-collapse-item",
                  {
                    key: index,
                    attrs: { name: "teaching-resource_" + item.firstLevelId },
                  },
                  [
                    _c("template", { slot: "title" }, [
                      _c("div", { staticClass: "collapse-title" }, [
                        _vm._v(
                          "\n            " +
                            _vm._s(item.firstLevelLabel) +
                            "\n          "
                        ),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "resource-list" },
                      _vm._l(item.list, function (items, index) {
                        return _c(
                          "div",
                          {
                            key: index,
                            staticClass: "xml-teaching-resource",
                            class:
                              items.location == _vm.location
                                ? "current-teacher-resources"
                                : "",
                          },
                          [
                            items.resourcesType == "notes"
                              ? [
                                  _c(
                                    "div",
                                    { staticClass: "xml-teacher-note" },
                                    [
                                      _c(
                                        "div",
                                        { staticClass: "xml-note-header" },
                                        [
                                          _c("img", {
                                            staticClass: "note-icon",
                                            attrs: {
                                              src: __$_require_static_images_icons_resource_note_icon_svg__,
                                              alt: "",
                                            },
                                          }),
                                          _vm._v(" "),
                                          _c("img", {
                                            directives: [
                                              {
                                                name: "show",
                                                rawName: "v-show",
                                                value:
                                                  items.isStudentShow != 0 &&
                                                  _vm.userType == "teacher",
                                                expression:
                                                  "items.isStudentShow != 0 && userType == 'teacher'",
                                              },
                                            ],
                                            staticClass: "eye",
                                            attrs: {
                                              src: __$_require_static_images_icons_resource_invisible_02_png__,
                                              alt: "",
                                            },
                                          }),
                                          _vm._v(" "),
                                          _vm.userType == "teacher"
                                            ? _c(
                                                "el-popover",
                                                {
                                                  attrs: {
                                                    placement: "bottom",
                                                    width: "40px",
                                                    trigger: "hover",
                                                    "popper-class":
                                                      "customPopper",
                                                  },
                                                },
                                                [
                                                  _c(
                                                    "div",
                                                    {
                                                      staticClass:
                                                        "teacher-note-popover",
                                                    },
                                                    [
                                                      _c(
                                                        "span",
                                                        {
                                                          on: {
                                                            click: function (
                                                              $event
                                                            ) {
                                                              return _vm.$emit(
                                                                "updateTeacherNotes",
                                                                items
                                                              )
                                                            },
                                                          },
                                                        },
                                                        [_vm._v("编辑")]
                                                      ),
                                                      _vm._v(" "),
                                                      _c(
                                                        "span",
                                                        {
                                                          on: {
                                                            click: function (
                                                              $event
                                                            ) {
                                                              return _vm.deleteTeacherNotes(
                                                                items
                                                              )
                                                            },
                                                          },
                                                        },
                                                        [_vm._v("删除")]
                                                      ),
                                                    ]
                                                  ),
                                                  _vm._v(" "),
                                                  _c("i", {
                                                    staticClass: "el-icon-more",
                                                    attrs: {
                                                      slot: "reference",
                                                    },
                                                    slot: "reference",
                                                  }),
                                                ]
                                              )
                                            : _vm._e(),
                                        ],
                                        1
                                      ),
                                      _vm._v(" "),
                                      _c(
                                        "div",
                                        {
                                          staticClass: "note-content",
                                          on: {
                                            click: function ($event) {
                                              return _vm.goTeacherNotes(
                                                item,
                                                items
                                              )
                                            },
                                          },
                                        },
                                        [
                                          _c("xmlTextOverflow", {
                                            attrs: { info: items.noteContent },
                                          }),
                                        ],
                                        1
                                      ),
                                    ]
                                  ),
                                ]
                              : [
                                  _c(
                                    "div",
                                    {
                                      staticClass:
                                        "resource-item teaching-resource-item",
                                      class:
                                        _vm.currentResources == items.id
                                          ? "xml-current-resources"
                                          : "",
                                    },
                                    [
                                      _c("div", {
                                        staticClass: "icon",
                                        class: [
                                          items.resourcesType == "recorded"
                                            ? "recorded"
                                            : items.fileExt
                                            ? items.fileExt.replace(/\./gi, "")
                                            : "",
                                          _vm.isPlay == items.id
                                            ? "isPlay"
                                            : "",
                                        ],
                                      }),
                                      _vm._v(" "),
                                      _c(
                                        "div",
                                        {
                                          staticClass:
                                            "resource-title resource-title-width",
                                          on: {
                                            click: function ($event) {
                                              $event.stopPropagation();
                                              return _vm.resourcePrewiew(
                                                item,
                                                items
                                              )
                                            },
                                          },
                                        },
                                        [
                                          _c(
                                            "span",
                                            {
                                              staticClass: "teacher-flie-title",
                                              attrs: {
                                                title: items.resourcesName,
                                              },
                                            },
                                            [
                                              _vm._v(
                                                _vm._s(
                                                  items.resourcesType ==
                                                    "recorded"
                                                    ? _vm.formatTime(
                                                        items.duration
                                                      )
                                                    : items.resourcesName
                                                )
                                              ),
                                            ]
                                          ),
                                          _vm._v(" "),
                                          _c("img", {
                                            directives: [
                                              {
                                                name: "show",
                                                rawName: "v-show",
                                                value:
                                                  items.isStudentShow != 0 &&
                                                  _vm.userType == "teacher",
                                                expression:
                                                  "items.isStudentShow != 0 && userType == 'teacher'",
                                              },
                                            ],
                                            attrs: {
                                              src: __$_require_static_images_icons_resource_invisible_png__,
                                              alt: "",
                                            },
                                          }),
                                        ]
                                      ),
                                      _vm._v(" "),
                                      _vm.userType == "teacher"
                                        ? _c("img", {
                                            attrs: {
                                              src: __$_require_static_images_icons_books_edit_png__,
                                              alt: "",
                                            },
                                            on: {
                                              click: function ($event) {
                                                $event.stopPropagation();
                                                return _vm.editFile(item, items)
                                              },
                                            },
                                          })
                                        : _vm._e(),
                                      _vm._v(" "),
                                      _vm.userType == "teacher"
                                        ? _c("img", {
                                            attrs: {
                                              src: __$_require_static_images_icons_books_delete_png__,
                                              alt: "",
                                            },
                                            on: {
                                              click: function ($event) {
                                                $event.stopPropagation();
                                                return _vm.deleteFile(
                                                  item,
                                                  items
                                                )
                                              },
                                            },
                                          })
                                        : _vm._e(),
                                      _vm._v(" "),
                                      items.isDownload == 1 &&
                                      _vm.userType != "teacher"
                                        ? _c("img", {
                                            staticStyle: { width: "20px" },
                                            attrs: {
                                              src: __$_require_static_images_icons_resource_download_icon_png__,
                                              alt: "",
                                            },
                                            on: {
                                              click: function ($event) {
                                                $event.stopPropagation();
                                                return _vm.downLoadFile(
                                                  item,
                                                  items
                                                )
                                              },
                                            },
                                          })
                                        : _vm._e(),
                                      _vm._v(" "),
                                      _c("div", {
                                        staticClass: "resource-icon",
                                        attrs: { title: "跳转" },
                                        on: {
                                          click: function ($event) {
                                            $event.stopPropagation();
                                            return _vm.resourceDetails(
                                              item,
                                              items
                                            )
                                          },
                                        },
                                      }),
                                    ]
                                  ),
                                ],
                          ],
                          2
                        )
                      }),
                      0
                    ),
                  ],
                  2
                )
              }),
              1
            ),
          ]
        : _vm.resourceType == "learningTools"
        ? [
            _c(
              "div",
              { staticClass: "resource-list" },
              _vm._l(_vm.learningTools, function (item, index) {
                return _c(
                  "div",
                  {
                    key: index,
                    staticClass: "learning-tools-item",
                    on: {
                      click: function ($event) {
                        return _vm.openLearningTools(item)
                      },
                    },
                  },
                  [
                    _c("img", {
                      staticStyle: { width: "30px" },
                      attrs: { src: item.icon, alt: "", srcset: "" },
                    }),
                    _vm._v("\n        " + _vm._s(item.name) + "\n      "),
                  ]
                )
              }),
              0
            ),
          ]
        : _vm._e(),
      _vm._v(" "),
      _c("xml-empty", {
        directives: [
          {
            name: "show",
            rawName: "v-show",
            value:
              _vm.list.length == 0 &&
              _vm.resourceType != "search" &&
              _vm.resourceType != "learningTools",
            expression:
              "list.length == 0 && resourceType != 'search'&& resourceType != 'learningTools'",
          },
        ],
      }),
      _vm._v(" "),
      _vm.resourceType == "search"
        ? _c("xml-preview-search", {
            staticClass: "search-toobar",
            attrs: { componentList: _vm.componentList },
            on: { seachItem: _vm.seachItem },
          })
        : _vm._e(),
      _vm._v(" "),
      _c("audio", {
        ref: "musicAudio",
        staticClass: "audio-component",
        attrs: { controls: "", preload: "auto", src: _vm.audioUrl },
        on: {
          ended: function ($event) {
            _vm.isPlay = "";
          },
        },
      }),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          attrs: {
            visible: _vm.videoData.show,
            width: "1000px",
            "z-index": "1000",
            "show-close": false,
            "before-close": _vm.handleClose,
          },
          on: {
            "update:visible": function ($event) {
              return _vm.$set(_vm.videoData, "show", $event)
            },
          },
        },
        [
          _c(
            "div",
            { staticClass: "video-content" },
            [
              _c(
                "div",
                {
                  staticClass: "xml-el-icon-close-dialog",
                  on: {
                    click: function ($event) {
(_vm.videoData.show = false), (_vm.videoData.src = "");
                    },
                  },
                },
                [_c("i", { staticClass: "el-icon-close" })]
              ),
              _vm._v(" "),
              _vm.videoData.show
                ? _c("video-modal-player", {
                    attrs: {
                      src: _vm.videoData.src,
                      content: _vm.videoData.content,
                    },
                    on: {
                      timeUpdate: function (e) {
                        return _vm.timeVideoUpdate(e)
                      },
                    },
                  })
                : _vm._e(),
            ],
            1
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "div",
        { staticClass: "resource-item", staticStyle: { position: "relative" } },
        [
          _c(
            "el-dialog",
            {
              attrs: {
                visible: _vm.audioData.show,
                width: "840px",
                "show-close": false,
                "before-close": _vm.handleClose,
              },
              on: {
                "update:visible": function ($event) {
                  return _vm.$set(_vm.audioData, "show", $event)
                },
              },
            },
            [
              _c(
                "div",
                {
                  staticClass: "xml-el-icon-close-dialog",
                  on: {
                    click: function ($event) {
                      _vm.audioData.show = false;
                    },
                  },
                },
                [_c("i", { staticClass: "el-icon-close" })]
              ),
              _vm._v(" "),
              _vm.audioData.show
                ? _c("audio-player-page-pc", {
                    staticStyle: { "z-index": "9999" },
                    attrs: {
                      url: _vm.audioData.src,
                      title: _vm.removeStyle(_vm.audioData.title),
                    },
                    on: {
                      back: function ($event) {
                        _vm.audioData.show = false;
                      },
                      timeUpdate: function (e) {
                        return _vm.timeAudioUpdate(e)
                      },
                    },
                  })
                : _vm._e(),
            ],
            1
          ),
        ],
        1
      ),
    ],
    2
  )
};
var __vue_staticRenderFns__$35 = [];
__vue_render__$35._withStripped = true;

  /* style */
  const __vue_inject_styles__$35 = undefined;
  /* scoped */
  const __vue_scope_id__$35 = undefined;
  /* module identifier */
  const __vue_module_identifier__$35 = undefined;
  /* functional template */
  const __vue_is_functional_template__$35 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$35 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$35, staticRenderFns: __vue_staticRenderFns__$35 },
    __vue_inject_styles__$35,
    __vue_script__$35,
    __vue_scope_id__$35,
    __vue_is_functional_template__$35,
    __vue_module_identifier__$35,
    false,
    undefined,
    undefined,
    undefined
  );

const fontSizeLabelMap = {
  1: '小',
  2: '中',
  3: '大'
};
const fontSizeValueMap = {
  1: '12px',
  2: '16px',
  3: '20px'
};

// 系统环境变量
class systemEnvironmentVariables {
  constructor(key, e) {
    let systemEnvList = [{
      systemName: '斯麦尔',
      system: 'xml',
      //系统缩写
      isJiXie: true,
      //是否是斯麦尔
      className: '',
      systemId: 'ffe86842-a20a-474d-bff0-664e8b516b50',
      theFirstLayout: true,
      //第一种布局
      resourceStyle: 1,
      //资源样式
      toolbarFirst: true,
      //第一种pc端工具栏
      isShowAi: true,
      //是否显示Ai
      dynamicToolbar: false,
      //是否资源为0的资源隐藏显示
      toolbarList: [{
        name: '搜索',
        type: 'search',
        default: 'icon_01',
        select: 'icon_up_01',
        total: 'none',
        icon: ''
      }, {
        name: '授课',
        type: 'teachingResource',
        default: 'icon_02',
        select: 'icon_up_02',
        total: 'teachingResourceTotal',
        icon: ''
      }, {
        name: '图片',
        type: 'imageList',
        default: 'icon_03',
        select: 'icon_up_03',
        total: 'imageTotal',
        icon: ''
      }, {
        name: '视频',
        type: 'videoList',
        default: 'icon_04',
        select: 'icon_up_04',
        total: 'videoTotal',
        icon: ''
      }, {
        name: '音频',
        type: 'audioList',
        default: 'icon_05',
        select: 'icon_up_05',
        total: 'audioTotal',
        icon: 'icon_01'
      }, {
        name: '公式',
        type: 'formulaList',
        default: 'icon_06',
        select: 'icon_up_06',
        total: 'formulaTotal',
        icon: 'icon_02'
      }, {
        name: '互动',
        type: 'interactionList',
        default: 'icon_07',
        select: 'icon_up_07',
        total: 'interactionTotal',
        icon: 'icon_03'
      }, {
        name: '试题',
        type: 'questionList',
        default: 'icon_08',
        select: 'icon_up_08',
        total: 'questionTotal',
        icon: 'icon_04'
      }, {
        name: '文件',
        type: 'resourceList',
        default: 'icon_09',
        select: 'icon_up_09',
        total: 'resourceTotal',
        icon: 'icon_05'
      }],
      isAddMark: e.isAddMark,
      //是否可以添加标记
      isNoteHighlight: e.userType == 'student',
      //是否有笔记高亮功能
      fixedTippy: e.isiOS,
      //tixed固定在底部
      tippy: {
        copy: true,
        //复制
        copyIcon: 'copy',
        copyLine: false,
        note: e.userType == 'student',
        //笔记
        noteIcon: 'note',
        noteLine: true,
        resources: e.userType == 'teacher',
        //资源
        resourcesIcon: 'addTeacherResources',
        resourcesLine: true,
        highlight: e.userType == 'student',
        //高亮
        highlightIcon: 'highlight',
        highlightLine: true,
        link: false,
        //划线
        linkIcon: '',
        linkLine: false,
        dictionary: false,
        //词典
        dictionaryIcon: 'dictionary',
        dictionaryLine: true,
        encyclopedias: false,
        //百科
        encyclopediasIcon: 'encyclopedias',
        encyclopediasLine: true,
        maxWordCount: true,
        //最大选择字数
        wordIcon: '',
        wordLine: true,
        bookmark: e.userType == 'student',
        //书签
        bookmarkIcon: 'bookmark',
        bookmarkLine: true
      },
      noteStyle: 'mk-underline__dashed',
      highlight: 'mk-hightlight__default',
      linkStyle: '',
      resourcesStyle: 'mk-underline__default',
      isShowToolbar: true,
      //移动端工具栏默认是否显示
      fontFamily: [{
        label: '默认',
        value: ''
      }, {
        label: '宋体',
        value: '宋体, SimSun'
      }, {
        label: '楷体',
        value: '楷体, 楷体_GB2312, SimKai'
      }, {
        label: '黑体',
        value: '黑体, SimHei'
      }]
    }, {
      systemName: '机械工业天工讲堂',
      system: 'jx',
      //系统缩写
      isJiXie: true,
      //是否是机械工业天工讲堂
      className: '',
      systemId: '885d44db-8f0f-41ff-b2af-7ec4a6844685',
      theFirstLayout: true,
      //第一种布局
      resourceStyle: 1,
      //资源样式
      toolbarFirst: true,
      //第一种pc端工具栏
      isShowAi: false,
      //是否显示Ai
      dynamicToolbar: false,
      //是否资源为0的资源隐藏显示
      toolbarList: [{
        name: '搜索',
        type: 'search',
        default: 'icon_01',
        select: 'icon_up_01',
        total: 'none',
        icon: ''
      }, {
        name: '授课',
        type: 'teachingResource',
        default: 'icon_02',
        select: 'icon_up_02',
        total: 'teachingResourceTotal',
        icon: ''
      }, {
        name: '图片',
        type: 'imageList',
        default: 'icon_03',
        select: 'icon_up_03',
        total: 'imageTotal',
        icon: ''
      }, {
        name: '视频',
        type: 'videoList',
        default: 'icon_04',
        select: 'icon_up_04',
        total: 'videoTotal',
        icon: ''
      }, {
        name: '音频',
        type: 'audioList',
        default: 'icon_05',
        select: 'icon_up_05',
        total: 'audioTotal',
        icon: 'icon_01'
      }, {
        name: '公式',
        type: 'formulaList',
        default: 'icon_06',
        select: 'icon_up_06',
        total: 'formulaTotal',
        icon: 'icon_02'
      }, {
        name: '互动',
        type: 'interactionList',
        default: 'icon_07',
        select: 'icon_up_07',
        total: 'interactionTotal',
        icon: 'icon_03'
      }, {
        name: '试题',
        type: 'questionList',
        default: 'icon_08',
        select: 'icon_up_08',
        total: 'questionTotal',
        icon: 'icon_04'
      }, {
        name: '文件',
        type: 'resourceList',
        default: 'icon_09',
        select: 'icon_up_09',
        total: 'resourceTotal',
        icon: 'icon_05'
      }],
      isAddMark: e.isAddMark,
      //是否可以添加标记
      isNoteHighlight: e.userType == 'student',
      //是否有笔记高亮功能
      fixedTippy: e.isiOS,
      //tixed固定在底部
      tippy: {
        copy: true,
        //复制
        copyIcon: 'copy',
        copyLine: false,
        note: e.userType == 'student',
        //笔记
        noteIcon: 'note',
        noteLine: true,
        resources: e.userType == 'teacher',
        //资源
        resourcesIcon: 'addTeacherResources',
        resourcesLine: true,
        highlight: e.userType == 'student',
        //高亮
        highlightIcon: 'highlight',
        highlightLine: true,
        link: false,
        //划线
        linkIcon: '',
        linkLine: false,
        dictionary: false,
        //词典
        dictionaryIcon: 'dictionary',
        dictionaryLine: true,
        encyclopedias: false,
        //百科
        encyclopediasIcon: 'encyclopedias',
        encyclopediasLine: true,
        maxWordCount: true,
        //最大选择字数
        wordIcon: '',
        wordLine: true,
        bookmark: e.userType == 'student',
        //书签
        bookmarkIcon: 'bookmark',
        bookmarkLine: true
      },
      noteStyle: 'mk-underline__dashed',
      highlight: 'mk-hightlight__default',
      linkStyle: '',
      resourcesStyle: 'mk-underline__default',
      isShowToolbar: true,
      //移动端工具栏默认是否显示
      fontFamily: [{
        label: '默认',
        value: ''
      }, {
        label: '宋体',
        value: '宋体, SimSun'
      }, {
        label: '楷体',
        value: '楷体, 楷体_GB2312, SimKai'
      }, {
        label: '黑体',
        value: '黑体, SimHei'
      }]
    }, {
      systemName: '华腾',
      system: 'ht',
      //系统缩写
      isHuaTeng: true,
      //是否是华腾
      className: e.pageType == 'pc' ? 'xml-reader-preview-huateng' : 'xml-reader-preview-guokai',
      systemId: '855e5965-d6a9-4aa0-9933-177e705399af',
      theFirstLayout: true,
      //第一种布局
      resourceStyle: 2,
      //资源样式
      toolbarSecond: true,
      //第二种pc端工具栏
      isShowAi: true,
      //是否显示Ai
      dynamicToolbar: true,
      //是否资源为0的资源隐藏显示
      isOpenToolbar: true,
      //是否默认打开第一个有资源的工具栏
      toolbarList: [{
        name: '搜索',
        type: 'search',
        default: 'icon_01',
        select: 'icon_up_01',
        total: 'none',
        icon: ''
      }, {
        name: '授课',
        type: 'teachingResource',
        default: 'icon_02',
        select: 'icon_up_02',
        total: 'teachingResourceTotal',
        icon: ''
      }, {
        name: '图片',
        type: 'imageList',
        default: 'icon_03',
        select: 'icon_up_03',
        total: 'imageTotal',
        icon: ''
      }, {
        name: '视频',
        type: 'videoList',
        default: 'icon_04',
        select: 'icon_up_04',
        total: 'videoTotal',
        icon: ''
      }, {
        name: '动画',
        type: 'animationList',
        default: 'icon_04',
        select: 'icon_up_04',
        total: 'animationTotal',
        icon: ''
      }, {
        name: '微课',
        type: 'curriculumList',
        default: 'icon_04',
        select: 'icon_up_04',
        total: 'curriculumTotal',
        icon: ''
      }, {
        name: '音频',
        type: 'audioList',
        default: 'icon_05',
        select: 'icon_up_05',
        total: 'audioTotal',
        icon: 'icon_01'
      }, {
        name: '公式',
        type: 'formulaList',
        default: 'icon_06',
        select: 'icon_up_06',
        total: 'formulaTotal',
        icon: 'icon_02'
      }, {
        name: '交互',
        type: 'interactionList',
        default: 'icon_07',
        select: 'icon_up_07',
        total: 'interactionTotal',
        icon: 'icon_03'
      }, {
        name: '试题',
        type: 'questionList',
        default: 'icon_08',
        select: 'icon_up_08',
        total: 'questionTotal',
        icon: 'icon_04'
      }, {
        name: '文件',
        type: 'resourceList',
        default: 'icon_09',
        select: 'icon_up_09',
        total: 'resourceTotal',
        icon: 'icon_05'
      }],
      isAddMark: e.isAddMark,
      //是否可以添加标记
      isNoteHighlight: e.isAddMark,
      //是否有笔记高亮功能
      fixedTippy: true,
      //tixed固定在底部
      tippy: {
        copy: true,
        //复制
        copyIcon: 'copy',
        copyLine: false,
        note: true,
        //笔记
        noteIcon: 'note',
        noteLine: e.pageType == 'pc' ? true : false,
        resources: e.userType == 'teacher' && e.pageType == 'pc',
        //资源
        resourcesIcon: 'addTeacherResources',
        resourcesLine: e.pageType == 'pc' ? true : false,
        highlight: true,
        //高亮
        highlightIcon: 'highlight',
        highlightLine: e.pageType == 'pc' ? true : false,
        link: false,
        //划线
        linkIcon: '',
        linkLine: false,
        dictionary: true,
        //词典
        dictionaryIcon: 'dictionary',
        dictionaryLine: e.pageType == 'pc' ? true : false,
        encyclopedias: true,
        //百科
        encyclopediasIcon: 'encyclopedias',
        encyclopediasLine: e.pageType == 'pc' ? true : false,
        maxWordCount: true,
        //最大选择字数
        wordIcon: '',
        wordLine: true,
        bookmark: true,
        //书签
        bookmarkIcon: 'bookmark',
        bookmarkLine: true
      },
      noteStyle: 'mk-underline__dashed',
      highlight: 'mk-hightlight__default',
      linkStyle: '',
      resourcesStyle: 'mk-underline__default',
      isShowToolbar: true,
      //移动端工具栏默认是否显示
      fontFamily: [{
        label: '默认',
        value: ''
      }, {
        label: '宋体',
        value: '宋体, SimSun'
      }, {
        label: '楷体',
        value: '楷体, 楷体_GB2312, SimKai'
      }, {
        label: '黑体',
        value: '黑体, SimHei'
      }]
    }, {
      systemName: '国家开放大学',
      system: 'gk',
      //系统缩写
      isGuoKai: true,
      //是否是国家开放大学
      className: 'xml-reader-preview-guokai',
      systemId: 'd58a0f05-b562-46fc-9516-55be91e21655',
      theFirstLayout: true,
      //第一种布局
      resourceStyle: 2,
      //资源样式
      toolbarSecond: true,
      //第二种pc端工具栏
      isShowAi: false,
      //是否显示Ai
      dynamicToolbar: false,
      //是否资源为0的资源隐藏显示
      isReadingMode: true,
      //是否显示切换阅读模式
      toolbarList: [{
        name: '搜索',
        type: 'search',
        default: 'icon_01',
        select: 'icon_up_01',
        total: 'none',
        icon: '',
        style: {
          '--xml-reader-toolbar-color': '#93ccf9',
          '--xml-reader-toolbar-border-color': '#7abeea'
        }
      }, {
        name: '授课',
        type: 'teachingResource',
        default: 'icon_02',
        select: 'icon_up_02',
        total: 'teachingResourceTotal',
        icon: '',
        style: {
          '--xml-reader-toolbar-color': '#f8d9a6',
          '--xml-reader-toolbar-border-color': '#e6b57b'
        }
      }, {
        name: '图片',
        type: 'imageList',
        default: 'icon_03',
        select: 'icon_up_03',
        total: 'imageTotal',
        icon: '',
        style: {
          '--xml-reader-toolbar-color': '#f8d9a6',
          '--xml-reader-toolbar-border-color': '#e6b57b'
        }
      }, {
        name: '视频',
        type: 'videoList',
        default: 'icon_04',
        select: 'icon_up_04',
        total: 'videoTotal',
        icon: '',
        style: {
          '--xml-reader-toolbar-color': '#f6ada3',
          '--xml-reader-toolbar-border-color': '#e37f73'
        }
      }, {
        name: '音频',
        type: 'audioList',
        default: 'icon_05',
        select: 'icon_up_05',
        total: 'audioTotal',
        icon: 'icon_01',
        style: {
          '--xml-reader-toolbar-color': '#a684f5',
          '--xml-reader-toolbar-border-color': '#7852cb'
        }
      }, {
        name: '试题',
        type: 'questionList',
        default: 'icon_06',
        select: 'icon_up_06',
        total: 'questionTotal',
        icon: 'icon_04',
        style: {
          '--xml-reader-toolbar-color': '#8fe7b8',
          '--xml-reader-toolbar-border-color': '#6dd0a0'
        }
      }, {
        name: '试卷',
        type: 'testPaperList',
        default: 'icon_08',
        select: 'icon_up_08',
        total: 'testPaperTotal',
        icon: 'icon_04',
        style: {
          '--xml-reader-toolbar-color': '#bb8ef9',
          '--xml-reader-toolbar-border-color': '#8d52cb'
        }
      }, {
        name: '文件',
        type: 'resourceList',
        default: 'icon_09',
        select: 'icon_up_09',
        total: 'resourceTotal',
        icon: 'icon_05',
        style: {
          '--xml-reader-toolbar-color': '#84aaf4',
          '--xml-reader-toolbar-border-color': '#5c7dcf'
        }
      }, {
        name: '图谱',
        type: 'graphList',
        default: 'icon_010',
        select: 'icon_up_010',
        total: 'graphTotal',
        icon: 'icon_05',
        style: {
          '--xml-reader-toolbar-color': '#f8d9a6',
          '--xml-reader-toolbar-border-color': '#e6b57b',
          '--xml-reader-toolbar-font-color': '#00B42A'
        }
      }, {
        name: '表格',
        type: 'tableList',
        default: 'icon_013',
        select: 'icon_up_013',
        total: 'tableTotal',
        icon: 'icon_05',
        style: {
          '--xml-reader-toolbar-color': '#f8d9a6',
          '--xml-reader-toolbar-border-color': '#e6b57b',
          '--xml-reader-toolbar-font-color': '#0FC6C2'
        }
      }, {
        name: '智练',
        type: 'questionBank',
        default: 'icon_011',
        select: 'icon_up_011',
        total: 'none',
        icon: 'icon_05',
        style: {
          '--xml-reader-toolbar-color': '#f8d9a6',
          '--xml-reader-toolbar-border-color': '#e6b57b',
          '--xml-reader-toolbar-font-color': '#8D4EDA'
        }
      }, {
        name: '计划',
        type: 'studyPlan',
        default: 'icon_012',
        select: 'icon_up_012',
        total: 'none',
        icon: 'icon_05',
        style: {
          '--xml-reader-toolbar-color': '#ff8587',
          '--xml-reader-toolbar-border-color': '#f44c50',
          '--xml-reader-toolbar-font-color': '#FF7D00'
        }
      }],
      isAddMark: e.userType == 'student',
      //是否可以添加标记
      isNoteHighlight: e.userType == 'student',
      //是否有笔记高亮功能
      fixedTippy: e.isiOS,
      //tixed固定在底部
      tippy: {
        copy: false,
        //复制
        copyIcon: '',
        copyLine: false,
        note: e.userType == 'student',
        //笔记
        noteIcon: '',
        noteLine: false,
        resources: false,
        //资源
        resourcesIcon: '',
        resourcesLine: false,
        highlight: e.userType == 'student',
        //高亮
        highlightIcon: '',
        highlightLine: true,
        link: e.userType == 'student',
        //划线
        linkIcon: '',
        linkLine: true,
        dictionary: false,
        //词典
        dictionaryIcon: '',
        dictionaryLine: false,
        encyclopedias: false,
        //百科
        encyclopediasIcon: '',
        encyclopediasLine: false,
        maxWordCount: false,
        //最大选择字数
        wordIcon: '',
        wordLine: false,
        bookmark: e.userType == 'student',
        //书签
        bookmarkIcon: 'bookmark',
        bookmarkLine: true,
        Ai: true,
        AiLine: true,
        AiIcon: '',
        AiName: '问Ai'
      },
      noteStyle: 'mk-underline__dashed',
      highlight: 'mk-hightlight__default',
      linkStyle: 'mk-underline__default',
      resourcesStyle: '',
      isShowToolbar: true,
      //移动端工具栏默认是否显示
      fontFamily: [{
        label: '默认',
        value: ''
      }, {
        label: '宋体',
        value: '宋体, SimSun'
      }, {
        label: '楷体',
        value: '楷体, 楷体_GB2312, SimKai'
      }, {
        label: '黑体',
        value: '黑体, SimHei'
      }]
    }, {
      systemName: '北京师范大学出版社',
      system: 'bsd',
      //系统缩写
      isBSD: true,
      //是否是机械工业天工讲堂
      className: '',
      systemId: '86bea987-ff10-4aca-82d3-75035f4fcea9',
      theFirstLayout: true,
      //第一种布局
      resourceStyle: 1,
      //资源样式
      toolbarFirst: true,
      //第一种pc端工具栏
      isShowAi: true,
      //是否显示Ai
      dynamicToolbar: false,
      //是否资源为0的资源隐藏显示
      toolbarList: [{
        name: '搜索',
        type: 'search',
        default: 'icon_01',
        select: 'icon_up_01',
        total: 'none',
        icon: ''
      }, {
        name: '授课',
        type: 'teachingResource',
        default: 'icon_02',
        select: 'icon_up_02',
        total: 'teachingResourceTotal',
        icon: ''
      }, {
        name: '工具',
        type: 'learningTools',
        default: 'icon_02',
        select: 'icon_up_02',
        total: '3',
        icon: ''
      }, {
        name: '图片',
        type: 'imageList',
        default: 'icon_03',
        select: 'icon_up_03',
        total: 'imageTotal',
        icon: ''
      }, {
        name: '视频',
        type: 'videoList',
        default: 'icon_04',
        select: 'icon_up_04',
        total: 'videoTotal',
        icon: ''
      }, {
        name: '音频',
        type: 'audioList',
        default: 'icon_05',
        select: 'icon_up_05',
        total: 'audioTotal',
        icon: 'icon_01'
      }, {
        name: '公式',
        type: 'formulaList',
        default: 'icon_06',
        select: 'icon_up_06',
        total: 'formulaTotal',
        icon: 'icon_02'
      }, {
        name: '互动',
        type: 'interactionList',
        default: 'icon_07',
        select: 'icon_up_07',
        total: 'interactionTotal',
        icon: 'icon_03'
      }, {
        name: '试题',
        type: 'questionList',
        default: 'icon_08',
        select: 'icon_up_08',
        total: 'questionTotal',
        icon: 'icon_04'
      }, {
        name: '文件',
        type: 'resourceList',
        default: 'icon_09',
        select: 'icon_up_09',
        total: 'resourceTotal',
        icon: 'icon_05'
      }],
      isAddMark: e.isAddMark,
      //是否可以添加标记
      isNoteHighlight: e.userType == 'student',
      //是否有笔记高亮功能
      fixedTippy: e.isiOS,
      //tixed固定在底部
      tippy: {
        copy: true,
        //复制
        copyIcon: 'copy',
        copyLine: false,
        error: true,
        //纠错
        errorIcon: 'error',
        note: e.userType == 'student',
        //笔记
        noteIcon: 'note',
        noteLine: true,
        resources: e.userType == 'teacher',
        //资源
        resourcesIcon: 'addTeacherResources',
        resourcesLine: true,
        highlight: e.userType == 'student',
        //高亮
        highlightIcon: 'highlight',
        highlightLine: true,
        link: false,
        //划线
        linkIcon: '',
        linkLine: false,
        dictionary: true,
        //词典
        dictionaryIcon: 'dictionary',
        dictionaryLine: e.pageType == 'pc' ? true : false,
        encyclopedias: true,
        //百科
        encyclopediasIcon: 'encyclopedias',
        encyclopediasLine: e.pageType == 'pc' ? true : false,
        maxWordCount: true,
        //最大选择字数
        wordIcon: '',
        wordLine: true,
        bookmark: e.userType == 'student',
        //书签
        bookmarkIcon: 'bookmark',
        bookmarkLine: true
      },
      noteStyle: 'mk-underline__dashed',
      highlight: 'mk-hightlight__default',
      linkStyle: 'mk-underline__default',
      resourcesStyle: 'mk-underline__default',
      isShowToolbar: true,
      //移动端工具栏默认是否显示
      learningTools: [{
        name: "AI智能问答",
        url: "https://yiyan.baidu.com/",
        width: "700px",
        icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAYAAADhu0ooAAAAAXNSR0IArs4c6QAACFhJREFUaEPNm39sVtUZxz8n+6GxEEBEGC6jSiIoOKZDxTniljhWSRmgE5mu0UG2LPvLLLolW7aoROYUW2j5JSCTwUTUOVj8AVMZ29AphQ6Yc+hCNpERWtSxYbspkbs+Pee25z09595z276tb9K8ue+958fnPM/zfZ577q3C/ixNajjFLBRTgNEl5wbqIDEDx3wr4BRHgJeAzdym1qfTllOwNBlDwipg2kDxeMcVuBRQLoiBta+D36D4FrepNzRoQ7ITuPJDASkw2jL+76KwCTv5vpqqaEi+Aaz90ED6LFdqpZ5Ydp6AbgW+POCgMZZKLZ2C25bPbr9NQI8CIwcMtHcx2D2G/f01C6h9qv94bQvEW8bvthExPTCgITfLi88Y905N5Vzb/6Cxk3XVt0g7N4Y7BLw/XbfoZNMJ++KuYF4tP2goLxaF7mVMlxd0AGKxI0Q945YPNMZiPrVNK6KY9i5URn99D9o/eVFra95iWNcUBq0cDLVTYdJZcO5gPZYsZLm/dxyCHW9CfSMcfy8C0onpQqBjBkPjHBh6Wj/VFenqWblxXwt8aWNx2EKgj1ZBdWWZIT1wHS5jwS5rgtufc+5ucty4EOgrN4JYtdtcElDWZKSo7Dg2g0fM3WXJPN7fAleuM+TSeUSeLQT6r2+GrenCuEFbAu8Jau/5UkOWwA9bZIFGqG8h0GPzLeUpsweXdG8rnTkxojZDkDyKHA+awNH5kK5859jGTTt/d44XNeqZfW60/vOp86MHYNOr+roFU2HCCOu6QP+jBDQvxVj3r/mglv8flr2IAp9X34Zpj+kGE86CbV914sn0VdsItbv0ucdnw5Rz8gf55OJiKSYM6qlR/zEvkDAD81qyB+p2d6njCzfBOYO6J94lu6FOQIFNs+DyrP1HM69KAbUEL6948IO6Um1c5OAtOSvtxNKMJ0Csmk7iR1fALRd176N+NywRF0/g4Zk5oKb52Po4tU3duztoRj567WYPaCB3nHgPJsuuqtXfBcNh87VOHwks3QMNAqpg/Qy4TFzXI0B2y3ENnhiNrnVzku5fauJVd8vf4Ae/15MZfyYcMJZ9di6MFve1Psv3wDJxcWDdDJhsu66dI602E5ZFxKjxRPlS1CdJyT5qBuz+Gkt1bTX0hO6tz8P2Q/rE2ukw7yk9y+9dDl+faPox7VY2wQoDurZag3pV3Brn08s9FrXASmJWpaCBmOxcQHO+6aZAjHrc7KqH4cT7MHkkrLoGrtqgj8edCRtnlU7ygSaQP5nc6mr47CcCIWL9fMnKCItaXIolZhfQZ0nH53fdmBGjFmxTM3xbdouB714Kcy+E25+H372pd+B/PQdGVXSFwZo/wSoBBVZOh0tsUF/iBS4T0AK7hxo0JzbT838U0EDM2EuwuBE2/VVfKzF3/jB4+iAskAcfCdx6KdwwocuqD+4FgZVzy6fDxaOcBfV4zBXypCh11ahad3GGRR2f/8PXIvJoAtdvgaMnwjE0ahA8Jupr8uDP9sFasaiChir4jA0aUN+pqzNi1GNpRZ0DGgpo4Lc3WJ3bydoyQHMrzN2cLxRrZsDYoRpu3V54aK9exMVVMMm1aNq/ZbkvPhgRoxaLotYCzfH55+bkq+ETB2C5ccOxw6DiI12Waz0JB9/Rs752PHxnsu5v/X74uYAC90/ToEHVNWp/dfpYLCvsSmpdAc3ycevcVqlVfR/rmrt2wosiOsDj18Ggj3U1EGvfbKw9sqLdkkZ9N+yDDfu1he6bBhe5T4I8ulD1kLGob+4eeMX9kap7Cp60QQNqWL1Jg503BOqruovX/C3Q3KbVt2E6nDsUNv4ZfiGgwD1Xw0QBDVVG5vdqAfU9cwlYWINGqq6Ub86uhtYTcSfg5SOw8AU9ya+cD/Mm6Z2G9LwMU/8ybP+7uWYczL8YHnkFNhrQuwX0bCOopl93TaX/mXZ5aetKQGMU95nKKAL2l7OtbRQzur0z0NIGLa0aesQZcHZFF2TqwC3vwrE2/XvFx6FyKBxrBfldFqVyCFTI5pvdvxUu6XjXpW8n2PPOrHUF1FW1APS9X4AxQzxBmpdb3fMht/Soq08S3ninvZR8pqjq3uvUuhk75TUToeo8k/5Cta5vR8AOuZh2oetNGGx9vf0uZ49ZgghPFBdTCKh7ccDnz/iormrGD3fWua8sFurHms+h47BwO7S9b/tzPrTipxGqmw5kYuDzn4Lhp3e/w585zqOWxk3fboO3RG1dt405Bt5qBYF89nULqlCtK6Ax5vfFj7SzrLCq2llZcyiQC3ZYVsjK2wHV7Ogq5HkR/Snuia91OwcLvDOwotqpaNrvP9tOQt2LcPjfGe5VwDJRRvHWuj+Jr3WDg5jVlgLAtvB/T7YXDS/lQGZZKjIb5M1LulEsjK91ve5juVPdNV2g/zsJS3fBP48X261zdwY63yBLx+nh81MN6vp4hM/7oBeZNwnFkit2wRG5VYvpu480IsutFXdHxGhkDIkaXzgCnnwNjvzHE5MFatPMWIx4r8htr0F7sqI+q/emn77uz4l9xYL4Wrebu0ZaOhjb1v1iZ37tYQwG25v+NGhP1S1dtR7GdG/yYp4wukyKu+Jr3ajO00rHfd821q191/XWczqEX0Czat3exE5fWTqyFs9W3TvNa6xZK+nUukWeYpUrLxaM6WbFnclWEvNicp572UqWFZ95/WRZuogHxWvENsUdiWxR/So6xdgQA5gXo/OsvvGYrbeAfuy8bh5rkZjVL3I3Uo6YVmzhATVLg96RjOcD9qI4rVe1ZbnyYk81QvEuH3ABa9Rhe1MPfpjUoBBXntL+fzD6KWWM1UIeEB9DOu3leVKMRiTmH3wSNrO66x98/g8vdBZtPtJIXgAAAABJRU5ErkJggg=="
      }, {
        name: "GGB函数工具",
        url: "https://www.geogebra.org/calculator",
        width: "1200px",
        icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAYAAACoYAD2AAAAAXNSR0IArs4c6QAABntJREFUWEfFmWtsFFUYhp/T7tIWEIo0JRBqNYJRFEy1RRHqJQFENJEEgz+IMUQiURKECMQUFJEilxahAkaDMaj8kGpCSCQSQFEEvACRgomIiIiASDGl3Nu9HPnmzOzOTmdvLY2bbHaanc48837v957LKryv5foxYAKae4F+aHqiCaDtE+Wzg8dKLhG/RhhNM5pTwF4U9VSrzW4sOd+8Vup+hKkHhlsQHQSxrpniOjkKdNSGdd/L0OwgxNPUqNPyh4Gs1aUE2I22lLt+gG5QL4iGXBs06ndPzXFyKGeRapTTFCvYh6bsugImq4QLXBSyQDVEor7Kf8FSNVZRp8cSZVNnAno8mGAD+S7gAhULxKwiBxHKFcv1u2im/J8eVBq65EI0CmHxaSLoMoFsIMqQdEbP6CE64EFRNM8FKsD2PXcr3tJn0fTutHL7eTAKEadZXN4V0HwHNBI756RimQ51cg5m5UEpfX7ANFNIQKO0Kmq1zqiUWeZmqhwUxYJ2s4QjCcFuPZB83zVoPBoKy981dva3Jx9TeFAUcUD9clBApFmkSaRZXB6MgXazQQ1kewCzycEMPCiljT2M69rdu4iSS69juX2UdUorjSJqeXNQvi8IxEtrhbpnSFUs6UC5PUPdlHKYfA/cXgTrGuCFjeZ+Vmlz7BxM48HWsGv0sWENZKblTuHBqRWw6gmoXAPPlsGYgVCyND7UuXMw5CjqiR/HgwIqPhUueTjF4g6WGyjMg79nw8UW6LvEDHMSI+euJE5WclyB7edBeZDu0iwSP1ZXQ15APhd1oNy2slLiNeNg3X545lOPpzyWEFB5ACde/DzYIw+CloIOrEBmWm7PDYsK4M5imPsQjLwVqr+GdT/Br40GZOLdcKgRdv1hwEsLofIWWL8/7lGvBx3/3lhg8rPpssC+maLcacbi8n4wfhC88qDxUPV22HkMvjwCW5+DkQNAwnrYO+bzxWHQEob6Bth1NB7YjgcdwIIgRCLmwUR5xcIsy+0BH3cHbJgI247AqA+MBwXu0YFw+gLUPg4bfoZ/L8G0jTB+MPx4HA6fMeV0PBi2PZgfNCW+1GIgb7ByUiAzLbePsuLFyeUw/XOo22Ugb+5lmkaC+K8qaI1AyQI4c7HtrF9AxYMB24OXW+GyDehwKaoz7O4kpW+sgqJuULIYTjQnzq6LusKBGdC3B1Suhp1H/YLazHwKC4yC56+ClN8tnGKBq9xpPOhVfEQpfPs87D8FZW8bgJ75pkTNV2DyUKPqtBGwYgfM3wITy2D1zsSQl5gRMMlEucfVsAG2cjJXyi2QqcqdArxmDMyshLlbYOFX5qIPlJqGuK0IPjsAxd3g4Ew4fR6+/xPe2w2bD8VHIYFoCdnq2R6UiYmjpoF8o/3d/dvLMKA3DKyBI2eNOoOKYdhNsPUwHG8y4MufhKeGQO12qLumqNPFkoXS7ZZqLjF65JtZuryutMr585N0d5rS39UHDr4Ee09Axcq2XktWHWvCkWPeoqBEkxvQmcL1snOy2cpJgfSWOwngfSVwNQQNp2DOI1A9GibVw9p9qTcCnEm1zDGlix0FnSyMd7HxoHhU1JWym5HndU+5Uyh4YR6cOAeD6+CXGXCsCUa9nwWgMpBSYmuS67qXo6BAih9FZYHvauXkvMy7e+r9MH24yUAp86xNZlKRbvlhKaggJ8co5AcYzDXdLYCxCLIfwkB6Z9k+WyLpQJJ60N5OkdLJzCdh0muvZyyP2go60eOoLAorXvM0TjLAdoLLNorcSPzn2kmLrWNE4UCuUdhqIs8cU+ANpM8a2O2X9h6byUHbmbazIhTAXNsCsb2gWIlNE5mcfFW3ogkmlDOTkcd9js+xKVPbVaADKAo7gH4rRbFAF9PlIcVc/Q+a4phaaW6eqTeVva3nd74FKBPaJMsISQCriSIQCnFGMUfvAco7s3ncTSVw8gAxj3o8KIDydnl0ryi5iihT2+u7TJWV64tH5e0ssrxNInCisgC69itXK6r0KGBLZzVPbLTxetSTFlYT2THl8ehosx1dpX8gytDOVDO2keozBFsetRW0Yir+AHtYq4YayNm6P4rvgP7ZlC/lFC/DvJXyC2Bs4yr+f01oKvhQ/W4gjZp9iPAJmoczvnmWO21eAWQUSuLRb4gwiY+Vtc6MQzqws/RoNBOACuvXCCiM7V9mC5Uib2U8t3JUI7/jnENzEthDhPV8pLbFxLt28B+znzUFN+BtZAAAAABJRU5ErkJggg=="
      }, {
        name: "思维导图",
        url: "https://www.iodraw.com/mind",
        width: "1200px",
        icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAYAAADhu0ooAAAAAXNSR0IArs4c6QAACmJJREFUaEPVW21wFdUZfk5ukpvvkA+JA9i0AWdak6oU2xEoAgm5QafjBC2dTmOqFCUoYkVQWu0AplIVqx2HMozMWBDa/oG2dtqZ8lHpqHxNrWNkdKZYUPJBvkgINV+Q7N3TOWf3nHt279m9e0Ml5P7Zu7l79+6zz/u87/O+Z0OgvNpqKuupSWtBUm4H6BT1s4nynlK0E+CECbxZeujwHnHdhL1pr6wsjaZiB4DIRAHkeZ2UgooPqXnQMEMryg4fbuZA2yKVRygwdyKDpJSCEAK2ZS++b22PlL719jzSUlO5jFD8ZiKDhABngxBgxd9Nih+RluqF+wkhNRMVqMIcwBg1zXhmCQ6QtkhlJwVKJiRQoUfGqAhbm10RvtYWXaQ1Uim1O5HABmFS1eo1BzStrAwpmVl2UqHgKZSxRClGTv1bJhr7jbWxaZPJVrCqJqZrhdHMOXOR/2ADUoqKADMKGFHQaBTUMOS+2d+PwYN/w+Bf/2LdCFuTImztLOvOunz/mmB00spVyKldwoEhaoAabMuAGtbWtT/07jv4fM8bnkw6wlqUmvFmNHzzLbjupVd4tvRiUmWWMxyN4r+7dmL4nyf0WdYGJxMSIePPaNGmRmTOnguYps2oN5MCJGN4tPksel/8BdeuyKbu+in3xzN0075ShoyZs5DfsNLSFGNU0aQMV1ujMZAinA10PbbK+p5dWphGzZgjiml1PBglGRnIq6tHWtl0fiEZt33TSpaMGR6WOo3GtMp0K25C5+qHHYxKh6SppVc1GTGQ+ctXIHVKrDFKL69ASmamzagCUsukKbNwtL8f3U+tlZ5Wy6TQ6tVmNPfepQh/YxYn0Ohox8C+vciqjiDvvh/yRKTPthZ4Z0Y2MHTsKC7ueUNGg+qEpG4VD3zVGE0pKEDhuvX8wsy+PvT9+lXQS5eQkpPDs25q6Ze9NaqUGtMwQAcGcH5zI8zeXr0mFSaFhq8a0PDMWcj97lIOtH/fXlz+4H3pOEOTS1C0YRPSGFgGhNdTK/tabFoaZSbC6O7ChW1bMdrWGtOn4oC8HNNVA5pVtQhZlYv4dVzc+iqMzg5HVmR3Prs6gvSbyhEqvs4Cy8KZgzbBNHn5/fcweORdR5bV9J9Ox2R3M+MCtOeZnzi1JbJuzKzKm+BgSM2mir+Nq5/KZ0K74wZUTgSC1EGX5tyTBN3NcJ8/KaDMriV6mYODGD1zOu4wNXTPP73eGnNomEzJzrYSk92xcLZME0ZPD6I95+WoxJ1l1X3tWCWI12XpP6/+/kQY5efmwAD6Xt6C4WNH5d9y6+oRvqmc7/c8vd452yEE4dlzkP/9OqSVlsayr+2UhNeNdnfh4u9/i0tNH+hmQ3GaVx1TQkZZ+1S0sTEwSHEgA9v1SAOiXZ1gRqHg0ceQUlDIS0vvlueti7IZzY4sRuGatXamZdnVyrw82ypZlzkn9nfWvfTt3mWx7jbwis5j00Ca2NQXrHsK2dVjGyn1PruBs6oahcG3DmHo74csR0MI0r9+M0pe/lXMLNjdibu0uL1uz/ZtuPxhU1xkmMrMSPW+CRllxTyINnWUswbZHBqUvpYZhN4Xn4c5PCQPL372OWTOnmPVSVfdtJwSq6XxXtdoa0HXc1akqV2K2s2oDukLBWq0t8NoP+cb9uFbZ4KEQhYYHpp22EpwDCTzuKP21gYNinMrH3J6XZ+Jw7gD5d0L61yYJkcZGJexdzskoVk2eG940LqJrrlunNdlMkmUda8kdI22VhidnZLR0ZZmjHxyKnZxhGDSw48ilJvLGZWTBNGXOvpTi0nmdfl2eBgdj692el2PuS77wS8UKJvrDP/rPeQt/R5IRiYH2Pfadox8ekZqa9L9y5DPuhc3OI3XlVplmff4MVzY+br3BFDVbhBG+eBqyT1Jlxf2he51a3jNC5eXI7/+AX6Oyx9/hIu7d8nJAMnOxtTXXkeoqMjJqByMOZlkYJkp6WrchGhvj2MaqHNMYlCWkNHUkusxefsOMMeSzIux1rliuWSu6MdrkDplKg+57o0/k7piB6RNn47JGxsRKip2Zl5bj7HsG4U50I/uLS9gpLXFqU3NVEGtswmBWhcyg7PKQLtfrCjzJTn7xe7gyMkP8fkf9oKZBpH6c79zN7Lm3cGP6lQmA2r3kV97D+TEgXcv9kSBsm2Uy2DgyDugQ0Nxc12deVDnvIGA+jGp1jDPKRylyKmOSOPR8eQTYknPWQfdfaVXjVSzrHatRS4ZyvOPGWiyax+s18yxHVbnk0/EeVXHzMdrVUwzr5WrZ64uyN2njg2oY1XZnqsm0EhOpEYC7Vi3xpNJNihjWhahaJVJCqOvjycfsa9oxTHXdS9LiOOSBqpjknUJiTTCQjcnspj/bi/zqaf/w8NXMJlRUYHcyJ1ImzbNUykMaN8f92Ho5Enpld1zXTeT4vzJAVXXI31WsXRrHwxIwQNWFu4/uB/9B/bLmU/Wbd9CwQ/qAif1gePHceF3u7X9rIPxsUwBdRcfZBVLdCmsqyh5ZgNChYUcUM+2rRg5cxrp02egeNXqwCDFged3bI8xq2nV3JEXiNEgMxntnVR0y0I7XFGBwmW2PwUw8PY/kHbDlxC2p/bJoB1pbUX7C5utr3hNAZNh1KtkBJn5MKei9ofsmvLurkXO/AXJYPI8tnnVyrjze+UQX0YTghRznZhbiMuKul4xs6IC+bX3yjAeK+qzjzTEZW919Vt97wlUOy8Vi6qavs9rFcsvK4Zn3Iji5Q+BZFqGP5kXs5Itax9PODsSEaUF6sekrn7pNKLOa9T3bi3n3XkX8hbflQxGfizLvOd374xj1HF+W7/cpsp+NMgzAS7Nea5HatY+vOosG5xdv/6nCBUWBQbL2Dy3+ecw7O5FZxL0c131OR3n42VxmvOayYjs56UR9U7LhGHf8bSp01BYdx/Sp92QECxvuF/5JUbaWmOzogRrL5zRluqFlPdxCbwi12CA43jYBz3Opfm8hVVIv3EGQuzxG7srUh+CGmpqQv+xozAvDXuC9KoGpLV6oXU/XP7VrSW+r9Ysv/qlfOZmUjAfpyXXRED7PZtvvy5JvU7HXLdl0QJGlXblOE6DPjMZhwaV8yXK3u46q3Vg4sYpkaLVvE81IAyoX1b0fCpLx4Ca5XQTdE2/6ad5rSPTRJLfXFdEBmmums81mugZAN1Tk/IkLlC652bHUmdlRI1B8+7f40BFqlPvYJDs6bv24aM5R4b2O841SZAJKsAKd1yWP1s5v5MQlGi1lEgTOib/T+udXtnTq99Us70morpIc9Ud+ymFtYp0Bf2mLIAJsndcpATI3gmZ1E03nJFygHxWNa+WUPInr2wn76z6SKibSdUJBT3OZt53MuGT5XVdiscz9aApdAmfVH62cN5+ADW6J6+CPmvnV4eD9rNxoD3qsd8TYu76T4E/z/z4VK0FdMGCr1IYTQQIOzQQINsFmd5JkzAGzfvWWcG4JqLsmzFAQtGv3XLydJs6e8an879dT0BrKaW3A5gS2DFdwdMiWgfmmkzEdUJuTapenaIdME+A4M1bP/pE/oPP/wBESnIEzJe9ogAAAABJRU5ErkJggg=="
      }, {
        name: "计算器",
        url: "https://www.geogebra.org/scientific",
        width: "700px",
        icon: "data:image/png;base64,[encoded data, 4724 characters]"
      }],
      fontFamily: [{
        label: '默认',
        value: ''
      }, {
        label: '新宋体',
        value: 'NSimSun'
      }, {
        label: '宋体',
        value: '宋体, SimSun'
      }, {
        label: '楷体',
        value: '楷体, 楷体_GB2312, SimKai'
      }, {
        label: '黑体',
        value: '黑体, SimHei'
      }, {
        label: '隶书',
        value: '隶书'
      }, {
        label: 'Times New Roman',
        value: 'Times New Roman'
      }, {
        label: '仿宋',
        value: '仿宋'
      }, {
        label: 'Cursive',
        value: 'Cursive'
      }, {
        label: 'Serif',
        value: 'Serif'
      }, {
        label: 'Arial',
        value: 'Arial'
      }, {
        label: 'Fantasy',
        value: 'Fantasy'
      }, {
        label: 'Tahoma',
        value: 'Tahoma'
      }]
    }];
    this.data = systemEnvList.find(arr => arr.systemId === key);
    console.log('this.data', this.data);
  }
}
const operationType = [{
  value: 0,
  label: '点击学习情况'
}];

//
var script$34 = {
  name: 'setPop',
  props: {
    settingData: {
      type: Object,
      default: () => {}
    },
    sysEnv: {
      type: Object,
      default: () => {}
    }
  },
  mounted() {
    // console.log(this.sysEnv,'sysEnv');
  },
  data() {
    return {
      visible: false,
      selectedColor: null,
      isBlackBackground: false,
      ruleForm: {
        font: '宋体',
        //。。默认字体
        fontSize: 30,
        // 默认字号
        backgroundColor: '#f87db7',
        // 默认背景颜色
        lineHeight: 1.5,
        // 默认行间距
        WordOption: '20'
      },
      form: {
        themeFontFamily: '',
        //字体
        themeFontSize: 2,
        //字号
        themeBgColor: '',
        //当前颜色
        themeLineHeight: 'null',
        //行间距
        themeLetterSpacing: 'null' //字间距
      },
      fontSizeLabelMap,
      RowOptions: [{
        value: '10',
        label: '10'
      }, {
        value: '20',
        label: '20'
      }, {
        value: '30',
        label: '30'
      }],
      WordOptions: [{
        value: '10',
        label: '10'
      }, {
        value: '20',
        label: '20'
      }, {
        value: '30',
        label: '30'
      }],
      colorOptions: [{
        label: '蓝色',
        value: '#efefef'
      }, {
        label: '暗绿色',
        value: '#ddd8c5'
      }, {
        label: '黄色',
        value: '#f2dcc4'
      }, {
        label: '绿色',
        value: '#e6f7e5'
      }, {
        label: '粉色',
        value: '#fbdee2'
      }
      // { label: '黑色', value: '#000000' }
      ],
      WordOptions: [{
        value: '10',
        label: '10'
      }, {
        value: '20',
        label: '20'
      }, {
        value: '30',
        label: '30'
      }],
      size: 'null'
    };
  },
  watch: {
    settingData: {
      handler(newValue) {
        this.form = {
          ...this.form,
          ...newValue
        };
        // if (this.form.themeLetterSpacing == 0) {
        //   this.form.themeLetterSpacing = '0'
        // }
        console.log(this.form, 'newValue');
      },
      immediate: true,
      deep: true
    }
  },
  methods: {
    // handleColorClick(colorValue) {
    //   this.ruleForm.backgroundColor = colorValue
    //   this.selectedColor = colorValue
    //   this.isBlackBackground = colorValue.toLowerCase() === '#000000'
    // },
    // 设置字体
    setThemeFontFamily(value) {
      this.form.themeFontFamily = value;
      this.$emit('settingChange', 'themeFontFamily', value);
    },
    // 设置字号
    setThemeFontSize(type) {
      let emit = false;
      switch (type) {
        case 'plus':
          if (this.form.themeFontSize < 3) {
            this.form.themeFontSize++;
            emit = true;
          }
          break;
        case 'minus':
          if (this.form.themeFontSize > 1) {
            this.form.themeFontSize--;
            emit = true;
          }
          break;
      }
      emit && this.$emit('settingChange', 'themeFontSize', this.form.themeFontSize);
    },
    readingMode(type) {
      this.$emit('settingChange', 'readingMode', type);
    },
    // 设置背景色
    setThemeBgColor(color) {
      if (color === this.form.themeBgColor) {
        color = '';
      }
      this.form.themeBgColor = color;
      this.selectedColor = color;
      this.isBlackBackground = color.toLowerCase() === '#000000';
      this.$emit('settingChange', 'themeBgColor', color);
    },
    setThemeLineHeight(value) {
      this.form.themeLineHeight = value;
      this.$emit('settingChange', 'themeLineHeight', value);
    },
    setThemeLetterSpacing(value) {
      this.form.themeLetterSpacing = value;
      this.$emit('settingChange', 'themeLetterSpacing', value);
    }
  }
};

/* script */
const __vue_script__$34 = script$34;
/* template */
var __vue_render__$34 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      staticClass: "header",
      attrs: {
        "append-to-body": "",
        title: "文本设置",
        width: "500px",
        visible: _vm.visible,
      },
      on: {
        "update:visible": function ($event) {
          _vm.visible = $event;
        },
      },
    },
    [
      _c(
        "div",
        {
          staticClass: "xml-set-pop-pc",
          staticStyle: { width: "500px", margin: "0 auto", height: "300px" },
        },
        [
          _c(
            "el-form",
            { staticClass: "pop" },
            [
              _c(
                "el-form-item",
                { attrs: { label: "字体", prop: "font" } },
                [
                  _c(
                    "el-select",
                    {
                      staticClass: "select-font",
                      on: { change: _vm.setThemeFontFamily },
                      model: {
                        value: _vm.form.themeFontFamily,
                        callback: function ($$v) {
                          _vm.$set(_vm.form, "themeFontFamily", $$v);
                        },
                        expression: "form.themeFontFamily",
                      },
                    },
                    _vm._l(_vm.sysEnv.fontFamily, function (item, index) {
                      return _c("el-option", {
                        key: index,
                        attrs: { label: item.label, value: item.value },
                      })
                    }),
                    1
                  ),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "set-item" }, [
                _c("span", { staticClass: "keyname" }, [_vm._v("字号")]),
                _vm._v(" "),
                _c("div", { staticStyle: { "margin-left": "14px" } }, [
                  _c(
                    "div",
                    {
                      staticClass: "size-btn",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.setThemeFontSize("minus")
                        },
                      },
                    },
                    [_vm._v("A-")]
                  ),
                  _vm._v(" "),
                  _c("span", [
                    _vm._v(
                      _vm._s(_vm.fontSizeLabelMap[_vm.form.themeFontSize])
                    ),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    {
                      staticClass: "size-btn",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.setThemeFontSize("plus")
                        },
                      },
                    },
                    [_vm._v("A+")]
                  ),
                ]),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "set-item spacing-box" },
                [
                  _c("span", { staticClass: "keyname" }, [_vm._v("行间距")]),
                  _vm._v(" "),
                  _c(
                    "el-select",
                    {
                      attrs: { placeholder: "请选择" },
                      on: { change: _vm.setThemeLineHeight },
                      model: {
                        value: _vm.form.themeLineHeight,
                        callback: function ($$v) {
                          _vm.$set(_vm.form, "themeLineHeight", $$v);
                        },
                        expression: "form.themeLineHeight",
                      },
                    },
                    [
                      _c("el-option", {
                        key: "1",
                        attrs: { label: "默认", value: "null" },
                      }),
                      _vm._v(" "),
                      _c("el-option", {
                        key: "1.25",
                        attrs: { label: "1.25", value: "1.3" },
                      }),
                      _vm._v(" "),
                      _c("el-option", {
                        key: "1.5",
                        attrs: { label: "1.5", value: "1.5" },
                      }),
                      _vm._v(" "),
                      _c("el-option", {
                        key: "1.8",
                        attrs: { label: "1.75", value: "1.8" },
                      }),
                      _vm._v(" "),
                      _c("el-option", {
                        key: "2",
                        attrs: { label: "2", value: "2" },
                      }),
                      _vm._v(" "),
                      _c("el-option", {
                        key: "3",
                        attrs: { label: "3", value: "3" },
                      }),
                      _vm._v(" "),
                      _c("el-option", {
                        key: "4",
                        attrs: { label: "4", value: "4" },
                      }),
                      _vm._v(" "),
                      _c("el-option", {
                        key: "5",
                        attrs: { label: "5", value: "5" },
                      }),
                    ],
                    1
                  ),
                  _vm._v(" "),
                  _c("span", { staticClass: "keyname m-l23" }, [
                    _vm._v("字间距"),
                  ]),
                  _vm._v(" "),
                  _c(
                    "el-select",
                    {
                      attrs: { placeholder: "请选择" },
                      on: { change: _vm.setThemeLetterSpacing },
                      model: {
                        value: _vm.form.themeLetterSpacing,
                        callback: function ($$v) {
                          _vm.$set(_vm.form, "themeLetterSpacing", $$v);
                        },
                        expression: "form.themeLetterSpacing",
                      },
                    },
                    [
                      _c("el-option", {
                        key: "0",
                        attrs: { label: "默认", value: _vm.size },
                      }),
                      _vm._v(" "),
                      _vm._l(30, function (item) {
                        return _c("el-option", {
                          key: item,
                          attrs: { label: item, value: item },
                        })
                      }),
                    ],
                    2
                  ),
                ],
                1
              ),
              _vm._v(" "),
              _vm.sysEnv.isReadingMode
                ? _c("div", { staticClass: "set-item" }, [
                    _c("span", { staticClass: "keyname" }, [
                      _vm._v("阅读模式"),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticStyle: { "margin-left": "14px" } }, [
                      _c(
                        "div",
                        {
                          staticClass: "reading-mode",
                          class:
                            _vm.settingData.readingMode == "roll"
                              ? "current-reading-mode"
                              : "",
                          on: {
                            click: function ($event) {
                              $event.stopPropagation();
                              return _vm.readingMode("roll")
                            },
                          },
                        },
                        [_vm._v("\n            滑动\n          ")]
                      ),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "reading-mode",
                          class:
                            _vm.settingData.readingMode == "page"
                              ? "current-reading-mode"
                              : "",
                          on: {
                            click: function ($event) {
                              $event.stopPropagation();
                              return _vm.readingMode("page")
                            },
                          },
                        },
                        [_vm._v("\n            翻页\n          ")]
                      ),
                    ]),
                  ])
                : _vm._e(),
              _vm._v(" "),
              _c("div", { staticClass: "set-item" }, [
                _c("span", { staticClass: "keyname" }, [_vm._v("背景色")]),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "color-container" },
                  _vm._l(_vm.colorOptions, function (color, index) {
                    return _c(
                      "div",
                      {
                        key: index,
                        staticClass: "color-item",
                        class: {
                          "active-color": _vm.form.themeBgColor === color.value,
                        },
                        style: { backgroundColor: color.value },
                        on: {
                          click: function ($event) {
                            return _vm.setThemeBgColor(color.value)
                          },
                        },
                      },
                      [
                        _vm.form.themeBgColor === color.value
                          ? _c(
                              "div",
                              {
                                staticClass: "check-mark",
                                class: { "white-check": _vm.isBlackBackground },
                              },
                              [
                                _vm._v(
                                  "\n              " +
                                    _vm._s("✔") +
                                    "\n            "
                                ),
                              ]
                            )
                          : _vm._e(),
                      ]
                    )
                  }),
                  0
                ),
              ]),
            ],
            1
          ),
        ],
        1
      ),
    ]
  )
};
var __vue_staticRenderFns__$34 = [];
__vue_render__$34._withStripped = true;

  /* style */
  const __vue_inject_styles__$34 = undefined;
  /* scoped */
  const __vue_scope_id__$34 = undefined;
  /* module identifier */
  const __vue_module_identifier__$34 = undefined;
  /* functional template */
  const __vue_is_functional_template__$34 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$34 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$34, staticRenderFns: __vue_staticRenderFns__$34 },
    __vue_inject_styles__$34,
    __vue_script__$34,
    __vue_scope_id__$34,
    __vue_is_functional_template__$34,
    __vue_module_identifier__$34,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$33 = {
  name: 'highlight',
  props: {
    sysEnv: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      visiblea: false
    };
  }
};

var __$_require_static_images_icons_books_green_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD0AAAACCAYAAADrTtSRAAAAAXNSR0IArs4c6QAAAGJJREFUKFNjVN5WksPE+F+XAQEe///PyAPnMv7/cMeztwNJHsxU2lqoy8zElDPU9P37z3iZUWFrqQQr0z8/mOP//2P8wMDIoIjwzL9Pd7z6pmN4elOeHDMrq8dQ0/fv379HAIOFVE1DkUsjAAAAAElFTkSuQmCC";

var __$_require_static_images_icons_books_yellow_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE8AAAAPCAYAAAClbJLqAAAAAXNSR0IArs4c6QAAAExJREFUWEft1LENACAMBDHYf+ggMUKudfprrFfuzJnjVgIX3srtR/D2dvCCHTx4RSC0fh68IBBSy4MXBEJqefCCQEgtD14QCKnlBbwHYtAs4xEgiVMAAAAASUVORK5CYII=";

/* script */
const __vue_script__$33 = script$33;
var __vue_render__$33 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      staticClass: "header",
      attrs: {
        "append-to-body": "",
        title: "图例",
        width: "240px",
        height: "192px",
        visible: _vm.visiblea,
      },
      on: {
        "update:visible": function ($event) {
          _vm.visiblea = $event;
        },
      },
    },
    [
      _c("div", { staticClass: "legend" }, [
        _c("span", [_vm._v("笔记：")]),
        _vm._v(" "),
        _c("img", {
          attrs: {
            src: __$_require_static_images_icons_books_green_png__,
            alt: "",
          },
        }),
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "legend" }, [
        _c("span", [_vm._v("高亮：")]),
        _vm._v(" "),
        _c("img", {
          attrs: {
            src: __$_require_static_images_icons_books_yellow_png__,
            alt: "",
          },
        }),
      ]),
      _vm._v(" "),
      _vm.sysEnv.system != "bsd"
        ? _c("div", { staticClass: "legend" }, [
            _c("span", [
              _vm._v(_vm._s(_vm.sysEnv.isGuoKai ? "划线" : "授课资源") + "："),
            ]),
            _vm._v(" "),
            _c("p", {
              staticStyle: {
                width: "61px",
                height: "1px",
                border: "1px solid #f17f53",
              },
            }),
          ])
        : _vm._e(),
    ]
  )
};
var __vue_staticRenderFns__$33 = [];
__vue_render__$33._withStripped = true;

  /* style */
  const __vue_inject_styles__$33 = undefined;
  /* scoped */
  const __vue_scope_id__$33 = undefined;
  /* module identifier */
  const __vue_module_identifier__$33 = undefined;
  /* functional template */
  const __vue_is_functional_template__$33 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$33 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$33, staticRenderFns: __vue_staticRenderFns__$33 },
    __vue_inject_styles__$33,
    __vue_script__$33,
    __vue_scope_id__$33,
    __vue_is_functional_template__$33,
    __vue_module_identifier__$33,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//

var script$32 = {
  name: 'bookmark',
  data() {
    return {};
  },
  props: {
    visibleb: false
  },
  mounted() {}
};

/* script */
const __vue_script__$32 = script$32;

/* template */
var __vue_render__$32 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      staticClass: "header",
      attrs: {
        "append-to-body": "",
        title: "书签设置",
        width: "500px",
        visible: _vm.visibleb,
      },
      on: {
        "update:visible": function ($event) {
          _vm.visibleb = $event;
        },
      },
    },
    [_vm._v(" ??? ")]
  )
};
var __vue_staticRenderFns__$32 = [];
__vue_render__$32._withStripped = true;

  /* style */
  const __vue_inject_styles__$32 = undefined;
  /* scoped */
  const __vue_scope_id__$32 = undefined;
  /* module identifier */
  const __vue_module_identifier__$32 = undefined;
  /* functional template */
  const __vue_is_functional_template__$32 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$32 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$32, staticRenderFns: __vue_staticRenderFns__$32 },
    __vue_inject_styles__$32,
    __vue_script__$32,
    __vue_scope_id__$32,
    __vue_is_functional_template__$32,
    __vue_module_identifier__$32,
    false,
    undefined,
    undefined,
    undefined
  );

/*!
 * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */

var extendStatics$1 = function (d, b) {
  extendStatics$1 = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (d, b) {
    d.__proto__ = b;
  } || function (d, b) {
    for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  };
  return extendStatics$1(d, b);
};
function __extends$1(d, b) {
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  extendStatics$1(d, b);
  function __() {
    this.constructor = d;
  }
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function () {
  __assign = Object.assign || function __assign(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
    }
    return t;
  };
  return __assign.apply(this, arguments);
};
function __awaiter(thisArg, _arguments, P, generator) {
  function adopt(value) {
    return value instanceof P ? value : new P(function (resolve) {
      resolve(value);
    });
  }
  return new (P || (P = Promise))(function (resolve, reject) {
    function fulfilled(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    }
    function rejected(value) {
      try {
        step(generator["throw"](value));
      } catch (e) {
        reject(e);
      }
    }
    function step(result) {
      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
    }
    step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
}
function __generator(thisArg, body) {
  var _ = {
      label: 0,
      sent: function () {
        if (t[0] & 1) throw t[1];
        return t[1];
      },
      trys: [],
      ops: []
    },
    f,
    y,
    t,
    g;
  return g = {
    next: verb(0),
    "throw": verb(1),
    "return": verb(2)
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
    return this;
  }), g;
  function verb(n) {
    return function (v) {
      return step([n, v]);
    };
  }
  function step(op) {
    if (f) throw new TypeError("Generator is already executing.");
    while (_) try {
      if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
      if (y = 0, t) op = [op[0] & 2, t.value];
      switch (op[0]) {
        case 0:
        case 1:
          t = op;
          break;
        case 4:
          _.label++;
          return {
            value: op[1],
            done: false
          };
        case 5:
          _.label++;
          y = op[1];
          op = [0];
          continue;
        case 7:
          op = _.ops.pop();
          _.trys.pop();
          continue;
        default:
          if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
            _ = 0;
            continue;
          }
          if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
            _.label = op[1];
            break;
          }
          if (op[0] === 6 && _.label < t[1]) {
            _.label = t[1];
            t = op;
            break;
          }
          if (t && _.label < t[2]) {
            _.label = t[2];
            _.ops.push(op);
            break;
          }
          if (t[2]) _.ops.pop();
          _.trys.pop();
          continue;
      }
      op = body.call(thisArg, _);
    } catch (e) {
      op = [6, e];
      y = 0;
    } finally {
      f = t = 0;
    }
    if (op[0] & 5) throw op[1];
    return {
      value: op[0] ? op[1] : void 0,
      done: true
    };
  }
}
function __spreadArray(to, from, pack) {
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
    if (ar || !(i in from)) {
      if (!ar) ar = Array.prototype.slice.call(from, 0, i);
      ar[i] = from[i];
    }
  }
  return to.concat(ar || from);
}
var Bounds = /** @class */function () {
  function Bounds(left, top, width, height) {
    this.left = left;
    this.top = top;
    this.width = width;
    this.height = height;
  }
  Bounds.prototype.add = function (x, y, w, h) {
    return new Bounds(this.left + x, this.top + y, this.width + w, this.height + h);
  };
  Bounds.fromClientRect = function (context, clientRect) {
    return new Bounds(clientRect.left + context.windowBounds.left, clientRect.top + context.windowBounds.top, clientRect.width, clientRect.height);
  };
  Bounds.fromDOMRectList = function (context, domRectList) {
    var domRect = Array.from(domRectList).find(function (rect) {
      return rect.width !== 0;
    });
    return domRect ? new Bounds(domRect.left + context.windowBounds.left, domRect.top + context.windowBounds.top, domRect.width, domRect.height) : Bounds.EMPTY;
  };
  Bounds.EMPTY = new Bounds(0, 0, 0, 0);
  return Bounds;
}();
var parseBounds = function (context, node) {
  return Bounds.fromClientRect(context, node.getBoundingClientRect());
};
var parseDocumentSize = function (document) {
  var body = document.body;
  var documentElement = document.documentElement;
  if (!body || !documentElement) {
    throw new Error("Unable to get document size");
  }
  var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth));
  var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight));
  return new Bounds(0, 0, width, height);
};

/*
 * css-line-break 2.1.0 <https://github.com/niklasvh/css-line-break#readme>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
var toCodePoints$1 = function (str) {
  var codePoints = [];
  var i = 0;
  var length = str.length;
  while (i < length) {
    var value = str.charCodeAt(i++);
    if (value >= 0xd800 && value <= 0xdbff && i < length) {
      var extra = str.charCodeAt(i++);
      if ((extra & 0xfc00) === 0xdc00) {
        codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
      } else {
        codePoints.push(value);
        i--;
      }
    } else {
      codePoints.push(value);
    }
  }
  return codePoints;
};
var fromCodePoint$1 = function () {
  var codePoints = [];
  for (var _i = 0; _i < arguments.length; _i++) {
    codePoints[_i] = arguments[_i];
  }
  if (String.fromCodePoint) {
    return String.fromCodePoint.apply(String, codePoints);
  }
  var length = codePoints.length;
  if (!length) {
    return '';
  }
  var codeUnits = [];
  var index = -1;
  var result = '';
  while (++index < length) {
    var codePoint = codePoints[index];
    if (codePoint <= 0xffff) {
      codeUnits.push(codePoint);
    } else {
      codePoint -= 0x10000;
      codeUnits.push((codePoint >> 10) + 0xd800, codePoint % 0x400 + 0xdc00);
    }
    if (index + 1 === length || codeUnits.length > 0x4000) {
      result += String.fromCharCode.apply(String, codeUnits);
      codeUnits.length = 0;
    }
  }
  return result;
};
var chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// Use a lookup table to find the index.
var lookup$2 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
for (var i$2 = 0; i$2 < chars$2.length; i$2++) {
  lookup$2[chars$2.charCodeAt(i$2)] = i$2;
}

/*
 * utrie 1.0.2 <https://github.com/niklasvh/utrie>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
var chars$1$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// Use a lookup table to find the index.
var lookup$1$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
for (var i$1$1 = 0; i$1$1 < chars$1$1.length; i$1$1++) {
  lookup$1$1[chars$1$1.charCodeAt(i$1$1)] = i$1$1;
}
var decode$1 = function (base64) {
  var bufferLength = base64.length * 0.75,
    len = base64.length,
    i,
    p = 0,
    encoded1,
    encoded2,
    encoded3,
    encoded4;
  if (base64[base64.length - 1] === '=') {
    bufferLength--;
    if (base64[base64.length - 2] === '=') {
      bufferLength--;
    }
  }
  var buffer = typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint8Array.prototype.slice !== 'undefined' ? new ArrayBuffer(bufferLength) : new Array(bufferLength);
  var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer);
  for (i = 0; i < len; i += 4) {
    encoded1 = lookup$1$1[base64.charCodeAt(i)];
    encoded2 = lookup$1$1[base64.charCodeAt(i + 1)];
    encoded3 = lookup$1$1[base64.charCodeAt(i + 2)];
    encoded4 = lookup$1$1[base64.charCodeAt(i + 3)];
    bytes[p++] = encoded1 << 2 | encoded2 >> 4;
    bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
    bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;
  }
  return buffer;
};
var polyUint16Array$1 = function (buffer) {
  var length = buffer.length;
  var bytes = [];
  for (var i = 0; i < length; i += 2) {
    bytes.push(buffer[i + 1] << 8 | buffer[i]);
  }
  return bytes;
};
var polyUint32Array$1 = function (buffer) {
  var length = buffer.length;
  var bytes = [];
  for (var i = 0; i < length; i += 4) {
    bytes.push(buffer[i + 3] << 24 | buffer[i + 2] << 16 | buffer[i + 1] << 8 | buffer[i]);
  }
  return bytes;
};

/** Shift size for getting the index-2 table offset. */
var UTRIE2_SHIFT_2$1 = 5;
/** Shift size for getting the index-1 table offset. */
var UTRIE2_SHIFT_1$1 = 6 + 5;
/**
 * Shift size for shifting left the index array values.
 * Increases possible data size with 16-bit index values at the cost
 * of compactability.
 * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY.
 */
var UTRIE2_INDEX_SHIFT$1 = 2;
/**
 * Difference between the two shift sizes,
 * for getting an index-1 offset from an index-2 offset. 6=11-5
 */
var UTRIE2_SHIFT_1_2$1 = UTRIE2_SHIFT_1$1 - UTRIE2_SHIFT_2$1;
/**
 * The part of the index-2 table for U+D800..U+DBFF stores values for
 * lead surrogate code _units_ not code _points_.
 * Values for lead surrogate code _points_ are indexed with this portion of the table.
 * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.)
 */
var UTRIE2_LSCP_INDEX_2_OFFSET$1 = 0x10000 >> UTRIE2_SHIFT_2$1;
/** Number of entries in a data block. 32=0x20 */
var UTRIE2_DATA_BLOCK_LENGTH$1 = 1 << UTRIE2_SHIFT_2$1;
/** Mask for getting the lower bits for the in-data-block offset. */
var UTRIE2_DATA_MASK$1 = UTRIE2_DATA_BLOCK_LENGTH$1 - 1;
var UTRIE2_LSCP_INDEX_2_LENGTH$1 = 0x400 >> UTRIE2_SHIFT_2$1;
/** Count the lengths of both BMP pieces. 2080=0x820 */
var UTRIE2_INDEX_2_BMP_LENGTH$1 = UTRIE2_LSCP_INDEX_2_OFFSET$1 + UTRIE2_LSCP_INDEX_2_LENGTH$1;
/**
 * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820.
 * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2.
 */
var UTRIE2_UTF8_2B_INDEX_2_OFFSET$1 = UTRIE2_INDEX_2_BMP_LENGTH$1;
var UTRIE2_UTF8_2B_INDEX_2_LENGTH$1 = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */
/**
 * The index-1 table, only used for supplementary code points, at offset 2112=0x840.
 * Variable length, for code points up to highStart, where the last single-value range starts.
 * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1.
 * (For 0x100000 supplementary code points U+10000..U+10ffff.)
 *
 * The part of the index-2 table for supplementary code points starts
 * after this index-1 table.
 *
 * Both the index-1 table and the following part of the index-2 table
 * are omitted completely if there is only BMP data.
 */
var UTRIE2_INDEX_1_OFFSET$1 = UTRIE2_UTF8_2B_INDEX_2_OFFSET$1 + UTRIE2_UTF8_2B_INDEX_2_LENGTH$1;
/**
 * Number of index-1 entries for the BMP. 32=0x20
 * This part of the index-1 table is omitted from the serialized form.
 */
var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH$1 = 0x10000 >> UTRIE2_SHIFT_1$1;
/** Number of entries in an index-2 block. 64=0x40 */
var UTRIE2_INDEX_2_BLOCK_LENGTH$1 = 1 << UTRIE2_SHIFT_1_2$1;
/** Mask for getting the lower bits for the in-index-2-block offset. */
var UTRIE2_INDEX_2_MASK$1 = UTRIE2_INDEX_2_BLOCK_LENGTH$1 - 1;
var slice16$1 = function (view, start, end) {
  if (view.slice) {
    return view.slice(start, end);
  }
  return new Uint16Array(Array.prototype.slice.call(view, start, end));
};
var slice32$1 = function (view, start, end) {
  if (view.slice) {
    return view.slice(start, end);
  }
  return new Uint32Array(Array.prototype.slice.call(view, start, end));
};
var createTrieFromBase64$1 = function (base64, _byteLength) {
  var buffer = decode$1(base64);
  var view32 = Array.isArray(buffer) ? polyUint32Array$1(buffer) : new Uint32Array(buffer);
  var view16 = Array.isArray(buffer) ? polyUint16Array$1(buffer) : new Uint16Array(buffer);
  var headerLength = 24;
  var index = slice16$1(view16, headerLength / 2, view32[4] / 2);
  var data = view32[5] === 2 ? slice16$1(view16, (headerLength + view32[4]) / 2) : slice32$1(view32, Math.ceil((headerLength + view32[4]) / 4));
  return new Trie$1(view32[0], view32[1], view32[2], view32[3], index, data);
};
var Trie$1 = /** @class */function () {
  function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) {
    this.initialValue = initialValue;
    this.errorValue = errorValue;
    this.highStart = highStart;
    this.highValueIndex = highValueIndex;
    this.index = index;
    this.data = data;
  }
  /**
   * Get the value for a code point as stored in the Trie.
   *
   * @param codePoint the code point
   * @return the value
   */
  Trie.prototype.get = function (codePoint) {
    var ix;
    if (codePoint >= 0) {
      if (codePoint < 0x0d800 || codePoint > 0x0dbff && codePoint <= 0x0ffff) {
        // Ordinary BMP code point, excluding leading surrogates.
        // BMP uses a single level lookup.  BMP index starts at offset 0 in the Trie2 index.
        // 16 bit data is stored in the index array itself.
        ix = this.index[codePoint >> UTRIE2_SHIFT_2$1];
        ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1);
        return this.data[ix];
      }
      if (codePoint <= 0xffff) {
        // Lead Surrogate Code Point.  A Separate index section is stored for
        // lead surrogate code units and code points.
        //   The main index has the code unit data.
        //   For this function, we need the code point data.
        // Note: this expression could be refactored for slightly improved efficiency, but
        //       surrogate code points will be so rare in practice that it's not worth it.
        ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET$1 + (codePoint - 0xd800 >> UTRIE2_SHIFT_2$1)];
        ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1);
        return this.data[ix];
      }
      if (codePoint < this.highStart) {
        // Supplemental code point, use two-level lookup.
        ix = UTRIE2_INDEX_1_OFFSET$1 - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH$1 + (codePoint >> UTRIE2_SHIFT_1$1);
        ix = this.index[ix];
        ix += codePoint >> UTRIE2_SHIFT_2$1 & UTRIE2_INDEX_2_MASK$1;
        ix = this.index[ix];
        ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1);
        return this.data[ix];
      }
      if (codePoint <= 0x10ffff) {
        return this.data[this.highValueIndex];
      }
    }
    // Fall through.  The code point is outside of the legal range of 0..0x10ffff.
    return this.errorValue;
  };
  return Trie;
}();

/*
 * base64-arraybuffer 1.0.2 <https://github.com/niklasvh/base64-arraybuffer>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
var chars$3 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// Use a lookup table to find the index.
var lookup$3 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
for (var i$3 = 0; i$3 < chars$3.length; i$3++) {
  lookup$3[chars$3.charCodeAt(i$3)] = i$3;
}
var base64$1 = '[encoded data, 52888 characters]';
var LETTER_NUMBER_MODIFIER = 50;
// Non-tailorable Line Breaking Classes
var BK = 1; //  Cause a line break (after)
var CR$1 = 2; //  Cause a line break (after), except between CR and LF
var LF$1 = 3; //  Cause a line break (after)
var CM = 4; //  Prohibit a line break between the character and the preceding character
var NL = 5; //  Cause a line break (after)
var WJ = 7; //  Prohibit line breaks before and after
var ZW = 8; //  Provide a break opportunity
var GL = 9; //  Prohibit line breaks before and after
var SP = 10; // Enable indirect line breaks
var ZWJ$1 = 11; // Prohibit line breaks within joiner sequences
// Break Opportunities
var B2 = 12; //  Provide a line break opportunity before and after the character
var BA = 13; //  Generally provide a line break opportunity after the character
var BB = 14; //  Generally provide a line break opportunity before the character
var HY = 15; //  Provide a line break opportunity after the character, except in numeric context
var CB = 16; //   Provide a line break opportunity contingent on additional information
// Characters Prohibiting Certain Breaks
var CL = 17; //  Prohibit line breaks before
var CP = 18; //  Prohibit line breaks before
var EX = 19; //  Prohibit line breaks before
var IN = 20; //  Allow only indirect line breaks between pairs
var NS = 21; //  Allow only indirect line breaks before
var OP = 22; //  Prohibit line breaks after
var QU = 23; //  Act like they are both opening and closing
// Numeric Context
var IS = 24; //  Prevent breaks after any and before numeric
var NU = 25; //  Form numeric expressions for line breaking purposes
var PO = 26; //  Do not break following a numeric expression
var PR = 27; //  Do not break in front of a numeric expression
var SY = 28; //  Prevent a break before; and allow a break after
// Other Characters
var AI = 29; //  Act like AL when the resolvedEAW is N; otherwise; act as ID
var AL = 30; //  Are alphabetic characters or symbols that are used with alphabetic characters
var CJ = 31; //  Treat as NS or ID for strict or normal breaking.
var EB = 32; //  Do not break from following Emoji Modifier
var EM = 33; //  Do not break from preceding Emoji Base
var H2 = 34; //  Form Korean syllable blocks
var H3 = 35; //  Form Korean syllable blocks
var HL = 36; //  Do not break around a following hyphen; otherwise act as Alphabetic
var ID = 37; //  Break before or after; except in some numeric context
var JL = 38; //  Form Korean syllable blocks
var JV = 39; //  Form Korean syllable blocks
var JT = 40; //  Form Korean syllable blocks
var RI$1 = 41; //  Keep pairs together. For pairs; break before and after other classes
var SA = 42; //  Provide a line break opportunity contingent on additional, language-specific context analysis
var XX = 43; //  Have as yet unknown line breaking behavior or unassigned code positions
var ea_OP = [0x2329, 0xff08];
var BREAK_MANDATORY = '!';
var BREAK_NOT_ALLOWED$1 = '×';
var BREAK_ALLOWED$1 = '÷';
var UnicodeTrie$1 = createTrieFromBase64$1(base64$1);
var ALPHABETICS = [AL, HL];
var HARD_LINE_BREAKS = [BK, CR$1, LF$1, NL];
var SPACE$1 = [SP, ZW];
var PREFIX_POSTFIX = [PR, PO];
var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE$1);
var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3];
var HYPHEN = [HY, BA];
var codePointsToCharacterClasses = function (codePoints, lineBreak) {
  if (lineBreak === void 0) {
    lineBreak = 'strict';
  }
  var types = [];
  var indices = [];
  var categories = [];
  codePoints.forEach(function (codePoint, index) {
    var classType = UnicodeTrie$1.get(codePoint);
    if (classType > LETTER_NUMBER_MODIFIER) {
      categories.push(true);
      classType -= LETTER_NUMBER_MODIFIER;
    } else {
      categories.push(false);
    }
    if (['normal', 'auto', 'loose'].indexOf(lineBreak) !== -1) {
      // U+2010, – U+2013, 〜 U+301C, ゠ U+30A0
      if ([0x2010, 0x2013, 0x301c, 0x30a0].indexOf(codePoint) !== -1) {
        indices.push(index);
        return types.push(CB);
      }
    }
    if (classType === CM || classType === ZWJ$1) {
      // LB10 Treat any remaining combining mark or ZWJ as AL.
      if (index === 0) {
        indices.push(index);
        return types.push(AL);
      }
      // LB9 Do not break a combining character sequence; treat it as if it has the line breaking class of
      // the base character in all of the following rules. Treat ZWJ as if it were CM.
      var prev = types[index - 1];
      if (LINE_BREAKS.indexOf(prev) === -1) {
        indices.push(indices[index - 1]);
        return types.push(prev);
      }
      indices.push(index);
      return types.push(AL);
    }
    indices.push(index);
    if (classType === CJ) {
      return types.push(lineBreak === 'strict' ? NS : ID);
    }
    if (classType === SA) {
      return types.push(AL);
    }
    if (classType === AI) {
      return types.push(AL);
    }
    // For supplementary characters, a useful default is to treat characters in the range 10000..1FFFD as AL
    // and characters in the ranges 20000..2FFFD and 30000..3FFFD as ID, until the implementation can be revised
    // to take into account the actual line breaking properties for these characters.
    if (classType === XX) {
      if (codePoint >= 0x20000 && codePoint <= 0x2fffd || codePoint >= 0x30000 && codePoint <= 0x3fffd) {
        return types.push(ID);
      } else {
        return types.push(AL);
      }
    }
    types.push(classType);
  });
  return [indices, types, categories];
};
var isAdjacentWithSpaceIgnored = function (a, b, currentIndex, classTypes) {
  var current = classTypes[currentIndex];
  if (Array.isArray(a) ? a.indexOf(current) !== -1 : a === current) {
    var i = currentIndex;
    while (i <= classTypes.length) {
      i++;
      var next = classTypes[i];
      if (next === b) {
        return true;
      }
      if (next !== SP) {
        break;
      }
    }
  }
  if (current === SP) {
    var i = currentIndex;
    while (i > 0) {
      i--;
      var prev = classTypes[i];
      if (Array.isArray(a) ? a.indexOf(prev) !== -1 : a === prev) {
        var n = currentIndex;
        while (n <= classTypes.length) {
          n++;
          var next = classTypes[n];
          if (next === b) {
            return true;
          }
          if (next !== SP) {
            break;
          }
        }
      }
      if (prev !== SP) {
        break;
      }
    }
  }
  return false;
};
var previousNonSpaceClassType = function (currentIndex, classTypes) {
  var i = currentIndex;
  while (i >= 0) {
    var type = classTypes[i];
    if (type === SP) {
      i--;
    } else {
      return type;
    }
  }
  return 0;
};
var _lineBreakAtIndex = function (codePoints, classTypes, indicies, index, forbiddenBreaks) {
  if (indicies[index] === 0) {
    return BREAK_NOT_ALLOWED$1;
  }
  var currentIndex = index - 1;
  if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) {
    return BREAK_NOT_ALLOWED$1;
  }
  var beforeIndex = currentIndex - 1;
  var afterIndex = currentIndex + 1;
  var current = classTypes[currentIndex];
  // LB4 Always break after hard line breaks.
  // LB5 Treat CR followed by LF, as well as CR, LF, and NL as hard line breaks.
  var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0;
  var next = classTypes[afterIndex];
  if (current === CR$1 && next === LF$1) {
    return BREAK_NOT_ALLOWED$1;
  }
  if (HARD_LINE_BREAKS.indexOf(current) !== -1) {
    return BREAK_MANDATORY;
  }
  // LB6 Do not break before hard line breaks.
  if (HARD_LINE_BREAKS.indexOf(next) !== -1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB7 Do not break before spaces or zero width space.
  if (SPACE$1.indexOf(next) !== -1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB8 Break before any character following a zero-width space, even if one or more spaces intervene.
  if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) {
    return BREAK_ALLOWED$1;
  }
  // LB8a Do not break after a zero width joiner.
  if (UnicodeTrie$1.get(codePoints[currentIndex]) === ZWJ$1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // zwj emojis
  if ((current === EB || current === EM) && UnicodeTrie$1.get(codePoints[afterIndex]) === ZWJ$1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB11 Do not break before or after Word joiner and related characters.
  if (current === WJ || next === WJ) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB12 Do not break after NBSP and related characters.
  if (current === GL) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB12a Do not break before NBSP and related characters, except after spaces and hyphens.
  if ([SP, BA, HY].indexOf(current) === -1 && next === GL) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB13 Do not break before ‘]’ or ‘!’ or ‘;’ or ‘/’, even after spaces.
  if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB14 Do not break after ‘[’, even after spaces.
  if (previousNonSpaceClassType(currentIndex, classTypes) === OP) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB15 Do not break within ‘”[’, even with intervening spaces.
  if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB16 Do not break between closing punctuation and a nonstarter (lb=NS), even with intervening spaces.
  if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB17 Do not break within ‘——’, even with intervening spaces.
  if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB18 Break after spaces.
  if (current === SP) {
    return BREAK_ALLOWED$1;
  }
  // LB19 Do not break before or after quotation marks, such as ‘ ” ’.
  if (current === QU || next === QU) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB20 Break before and after unresolved CB.
  if (next === CB || current === CB) {
    return BREAK_ALLOWED$1;
  }
  // LB21 Do not break before hyphen-minus, other hyphens, fixed-width spaces, small kana, and other non-starters, or after acute accents.
  if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB21a Don't break after Hebrew + Hyphen.
  if (before === HL && HYPHEN.indexOf(current) !== -1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB21b Don’t break between Solidus and Hebrew letters.
  if (current === SY && next === HL) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB22 Do not break before ellipsis.
  if (next === IN) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB23 Do not break between digits and letters.
  if (ALPHABETICS.indexOf(next) !== -1 && current === NU || ALPHABETICS.indexOf(current) !== -1 && next === NU) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB23a Do not break between numeric prefixes and ideographs, or between ideographs and numeric postfixes.
  if (current === PR && [ID, EB, EM].indexOf(next) !== -1 || [ID, EB, EM].indexOf(current) !== -1 && next === PO) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB24 Do not break between numeric prefix/postfix and letters, or between letters and prefix/postfix.
  if (ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1 || PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB25 Do not break between the following pairs of classes relevant to numbers:
  if (
  // (PR | PO) × ( OP | HY )? NU
  [PR, PO].indexOf(current) !== -1 && (next === NU || [OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU) ||
  // ( OP | HY ) × NU
  [OP, HY].indexOf(current) !== -1 && next === NU ||
  // NU ×	(NU | SY | IS)
  current === NU && [NU, SY, IS].indexOf(next) !== -1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // NU (NU | SY | IS)* × (NU | SY | IS | CL | CP)
  if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) {
    var prevIndex = currentIndex;
    while (prevIndex >= 0) {
      var type = classTypes[prevIndex];
      if (type === NU) {
        return BREAK_NOT_ALLOWED$1;
      } else if ([SY, IS].indexOf(type) !== -1) {
        prevIndex--;
      } else {
        break;
      }
    }
  }
  // NU (NU | SY | IS)* (CL | CP)? × (PO | PR))
  if ([PR, PO].indexOf(next) !== -1) {
    var prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex;
    while (prevIndex >= 0) {
      var type = classTypes[prevIndex];
      if (type === NU) {
        return BREAK_NOT_ALLOWED$1;
      } else if ([SY, IS].indexOf(type) !== -1) {
        prevIndex--;
      } else {
        break;
      }
    }
  }
  // LB26 Do not break a Korean syllable.
  if (JL === current && [JL, JV, H2, H3].indexOf(next) !== -1 || [JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1 || [JT, H3].indexOf(current) !== -1 && next === JT) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB27 Treat a Korean Syllable Block the same as ID.
  if (KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1 || KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB28 Do not break between alphabetics (“at”).
  if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB29 Do not break between numeric punctuation and alphabetics (“e.g.”).
  if (current === IS && ALPHABETICS.indexOf(next) !== -1) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB30 Do not break between letters, numbers, or ordinary symbols and opening or closing parentheses.
  if (ALPHABETICS.concat(NU).indexOf(current) !== -1 && next === OP && ea_OP.indexOf(codePoints[afterIndex]) === -1 || ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP) {
    return BREAK_NOT_ALLOWED$1;
  }
  // LB30a Break between two regional indicator symbols if and only if there are an even number of regional
  // indicators preceding the position of the break.
  if (current === RI$1 && next === RI$1) {
    var i = indicies[currentIndex];
    var count = 1;
    while (i > 0) {
      i--;
      if (classTypes[i] === RI$1) {
        count++;
      } else {
        break;
      }
    }
    if (count % 2 !== 0) {
      return BREAK_NOT_ALLOWED$1;
    }
  }
  // LB30b Do not break between an emoji base and an emoji modifier.
  if (current === EB && next === EM) {
    return BREAK_NOT_ALLOWED$1;
  }
  return BREAK_ALLOWED$1;
};
var cssFormattedClasses = function (codePoints, options) {
  if (!options) {
    options = {
      lineBreak: 'normal',
      wordBreak: 'normal'
    };
  }
  var _a = codePointsToCharacterClasses(codePoints, options.lineBreak),
    indicies = _a[0],
    classTypes = _a[1],
    isLetterNumber = _a[2];
  if (options.wordBreak === 'break-all' || options.wordBreak === 'break-word') {
    classTypes = classTypes.map(function (type) {
      return [NU, AL, SA].indexOf(type) !== -1 ? ID : type;
    });
  }
  var forbiddenBreakpoints = options.wordBreak === 'keep-all' ? isLetterNumber.map(function (letterNumber, i) {
    return letterNumber && codePoints[i] >= 0x4e00 && codePoints[i] <= 0x9fff;
  }) : undefined;
  return [indicies, classTypes, forbiddenBreakpoints];
};
var Break$1 = /** @class */function () {
  function Break(codePoints, lineBreak, start, end) {
    this.codePoints = codePoints;
    this.required = lineBreak === BREAK_MANDATORY;
    this.start = start;
    this.end = end;
  }
  Break.prototype.slice = function () {
    return fromCodePoint$1.apply(void 0, this.codePoints.slice(this.start, this.end));
  };
  return Break;
}();
var LineBreaker = function (str, options) {
  var codePoints = toCodePoints$1(str);
  var _a = cssFormattedClasses(codePoints, options),
    indicies = _a[0],
    classTypes = _a[1],
    forbiddenBreakpoints = _a[2];
  var length = codePoints.length;
  var lastEnd = 0;
  var nextIndex = 0;
  return {
    next: function () {
      if (nextIndex >= length) {
        return {
          done: true,
          value: null
        };
      }
      var lineBreak = BREAK_NOT_ALLOWED$1;
      while (nextIndex < length && (lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) === BREAK_NOT_ALLOWED$1) {}
      if (lineBreak !== BREAK_NOT_ALLOWED$1 || nextIndex === length) {
        var value = new Break$1(codePoints, lineBreak, lastEnd, nextIndex);
        lastEnd = nextIndex;
        return {
          value: value,
          done: false
        };
      }
      return {
        done: true,
        value: null
      };
    }
  };
};

// https://www.w3.org/TR/css-syntax-3
var FLAG_UNRESTRICTED = 1 << 0;
var FLAG_ID = 1 << 1;
var FLAG_INTEGER = 1 << 2;
var FLAG_NUMBER = 1 << 3;
var LINE_FEED = 0x000a;
var SOLIDUS = 0x002f;
var REVERSE_SOLIDUS = 0x005c;
var CHARACTER_TABULATION = 0x0009;
var SPACE = 0x0020;
var QUOTATION_MARK = 0x0022;
var EQUALS_SIGN = 0x003d;
var NUMBER_SIGN = 0x0023;
var DOLLAR_SIGN = 0x0024;
var PERCENTAGE_SIGN = 0x0025;
var APOSTROPHE = 0x0027;
var LEFT_PARENTHESIS = 0x0028;
var RIGHT_PARENTHESIS = 0x0029;
var LOW_LINE = 0x005f;
var HYPHEN_MINUS = 0x002d;
var EXCLAMATION_MARK = 0x0021;
var LESS_THAN_SIGN = 0x003c;
var GREATER_THAN_SIGN = 0x003e;
var COMMERCIAL_AT = 0x0040;
var LEFT_SQUARE_BRACKET = 0x005b;
var RIGHT_SQUARE_BRACKET = 0x005d;
var CIRCUMFLEX_ACCENT = 0x003d;
var LEFT_CURLY_BRACKET = 0x007b;
var QUESTION_MARK = 0x003f;
var RIGHT_CURLY_BRACKET = 0x007d;
var VERTICAL_LINE = 0x007c;
var TILDE = 0x007e;
var CONTROL = 0x0080;
var REPLACEMENT_CHARACTER = 0xfffd;
var ASTERISK = 0x002a;
var PLUS_SIGN = 0x002b;
var COMMA = 0x002c;
var COLON = 0x003a;
var SEMICOLON = 0x003b;
var FULL_STOP = 0x002e;
var NULL = 0x0000;
var BACKSPACE = 0x0008;
var LINE_TABULATION = 0x000b;
var SHIFT_OUT = 0x000e;
var INFORMATION_SEPARATOR_ONE = 0x001f;
var DELETE = 0x007f;
var EOF = -1;
var ZERO = 0x0030;
var a = 0x0061;
var e$1 = 0x0065;
var f = 0x0066;
var u = 0x0075;
var z = 0x007a;
var A = 0x0041;
var E = 0x0045;
var F = 0x0046;
var U = 0x0055;
var Z = 0x005a;
var isDigit = function (codePoint) {
  return codePoint >= ZERO && codePoint <= 0x0039;
};
var isSurrogateCodePoint = function (codePoint) {
  return codePoint >= 0xd800 && codePoint <= 0xdfff;
};
var isHex = function (codePoint) {
  return isDigit(codePoint) || codePoint >= A && codePoint <= F || codePoint >= a && codePoint <= f;
};
var isLowerCaseLetter = function (codePoint) {
  return codePoint >= a && codePoint <= z;
};
var isUpperCaseLetter = function (codePoint) {
  return codePoint >= A && codePoint <= Z;
};
var isLetter = function (codePoint) {
  return isLowerCaseLetter(codePoint) || isUpperCaseLetter(codePoint);
};
var isNonASCIICodePoint = function (codePoint) {
  return codePoint >= CONTROL;
};
var isWhiteSpace = function (codePoint) {
  return codePoint === LINE_FEED || codePoint === CHARACTER_TABULATION || codePoint === SPACE;
};
var isNameStartCodePoint = function (codePoint) {
  return isLetter(codePoint) || isNonASCIICodePoint(codePoint) || codePoint === LOW_LINE;
};
var isNameCodePoint = function (codePoint) {
  return isNameStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === HYPHEN_MINUS;
};
var isNonPrintableCodePoint = function (codePoint) {
  return codePoint >= NULL && codePoint <= BACKSPACE || codePoint === LINE_TABULATION || codePoint >= SHIFT_OUT && codePoint <= INFORMATION_SEPARATOR_ONE || codePoint === DELETE;
};
var isValidEscape = function (c1, c2) {
  if (c1 !== REVERSE_SOLIDUS) {
    return false;
  }
  return c2 !== LINE_FEED;
};
var isIdentifierStart = function (c1, c2, c3) {
  if (c1 === HYPHEN_MINUS) {
    return isNameStartCodePoint(c2) || isValidEscape(c2, c3);
  } else if (isNameStartCodePoint(c1)) {
    return true;
  } else if (c1 === REVERSE_SOLIDUS && isValidEscape(c1, c2)) {
    return true;
  }
  return false;
};
var isNumberStart = function (c1, c2, c3) {
  if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
    if (isDigit(c2)) {
      return true;
    }
    return c2 === FULL_STOP && isDigit(c3);
  }
  if (c1 === FULL_STOP) {
    return isDigit(c2);
  }
  return isDigit(c1);
};
var stringToNumber = function (codePoints) {
  var c = 0;
  var sign = 1;
  if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
    if (codePoints[c] === HYPHEN_MINUS) {
      sign = -1;
    }
    c++;
  }
  var integers = [];
  while (isDigit(codePoints[c])) {
    integers.push(codePoints[c++]);
  }
  var int = integers.length ? parseInt(fromCodePoint$1.apply(void 0, integers), 10) : 0;
  if (codePoints[c] === FULL_STOP) {
    c++;
  }
  var fraction = [];
  while (isDigit(codePoints[c])) {
    fraction.push(codePoints[c++]);
  }
  var fracd = fraction.length;
  var frac = fracd ? parseInt(fromCodePoint$1.apply(void 0, fraction), 10) : 0;
  if (codePoints[c] === E || codePoints[c] === e$1) {
    c++;
  }
  var expsign = 1;
  if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
    if (codePoints[c] === HYPHEN_MINUS) {
      expsign = -1;
    }
    c++;
  }
  var exponent = [];
  while (isDigit(codePoints[c])) {
    exponent.push(codePoints[c++]);
  }
  var exp = exponent.length ? parseInt(fromCodePoint$1.apply(void 0, exponent), 10) : 0;
  return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
};
var LEFT_PARENTHESIS_TOKEN = {
  type: 2 /* LEFT_PARENTHESIS_TOKEN */
};
var RIGHT_PARENTHESIS_TOKEN = {
  type: 3 /* RIGHT_PARENTHESIS_TOKEN */
};
var COMMA_TOKEN = {
  type: 4 /* COMMA_TOKEN */
};
var SUFFIX_MATCH_TOKEN = {
  type: 13 /* SUFFIX_MATCH_TOKEN */
};
var PREFIX_MATCH_TOKEN = {
  type: 8 /* PREFIX_MATCH_TOKEN */
};
var COLUMN_TOKEN = {
  type: 21 /* COLUMN_TOKEN */
};
var DASH_MATCH_TOKEN = {
  type: 9 /* DASH_MATCH_TOKEN */
};
var INCLUDE_MATCH_TOKEN = {
  type: 10 /* INCLUDE_MATCH_TOKEN */
};
var LEFT_CURLY_BRACKET_TOKEN = {
  type: 11 /* LEFT_CURLY_BRACKET_TOKEN */
};
var RIGHT_CURLY_BRACKET_TOKEN = {
  type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */
};
var SUBSTRING_MATCH_TOKEN = {
  type: 14 /* SUBSTRING_MATCH_TOKEN */
};
var BAD_URL_TOKEN = {
  type: 23 /* BAD_URL_TOKEN */
};
var BAD_STRING_TOKEN = {
  type: 1 /* BAD_STRING_TOKEN */
};
var CDO_TOKEN = {
  type: 25 /* CDO_TOKEN */
};
var CDC_TOKEN = {
  type: 24 /* CDC_TOKEN */
};
var COLON_TOKEN = {
  type: 26 /* COLON_TOKEN */
};
var SEMICOLON_TOKEN = {
  type: 27 /* SEMICOLON_TOKEN */
};
var LEFT_SQUARE_BRACKET_TOKEN = {
  type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */
};
var RIGHT_SQUARE_BRACKET_TOKEN = {
  type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */
};
var WHITESPACE_TOKEN = {
  type: 31 /* WHITESPACE_TOKEN */
};
var EOF_TOKEN = {
  type: 32 /* EOF_TOKEN */
};
var Tokenizer = /** @class */function () {
  function Tokenizer() {
    this._value = [];
  }
  Tokenizer.prototype.write = function (chunk) {
    this._value = this._value.concat(toCodePoints$1(chunk));
  };
  Tokenizer.prototype.read = function () {
    var tokens = [];
    var token = this.consumeToken();
    while (token !== EOF_TOKEN) {
      tokens.push(token);
      token = this.consumeToken();
    }
    return tokens;
  };
  Tokenizer.prototype.consumeToken = function () {
    var codePoint = this.consumeCodePoint();
    switch (codePoint) {
      case QUOTATION_MARK:
        return this.consumeStringToken(QUOTATION_MARK);
      case NUMBER_SIGN:
        var c1 = this.peekCodePoint(0);
        var c2 = this.peekCodePoint(1);
        var c3 = this.peekCodePoint(2);
        if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
          var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
          var value = this.consumeName();
          return {
            type: 5 /* HASH_TOKEN */,
            value: value,
            flags: flags
          };
        }
        break;
      case DOLLAR_SIGN:
        if (this.peekCodePoint(0) === EQUALS_SIGN) {
          this.consumeCodePoint();
          return SUFFIX_MATCH_TOKEN;
        }
        break;
      case APOSTROPHE:
        return this.consumeStringToken(APOSTROPHE);
      case LEFT_PARENTHESIS:
        return LEFT_PARENTHESIS_TOKEN;
      case RIGHT_PARENTHESIS:
        return RIGHT_PARENTHESIS_TOKEN;
      case ASTERISK:
        if (this.peekCodePoint(0) === EQUALS_SIGN) {
          this.consumeCodePoint();
          return SUBSTRING_MATCH_TOKEN;
        }
        break;
      case PLUS_SIGN:
        if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) {
          this.reconsumeCodePoint(codePoint);
          return this.consumeNumericToken();
        }
        break;
      case COMMA:
        return COMMA_TOKEN;
      case HYPHEN_MINUS:
        var e1 = codePoint;
        var e2 = this.peekCodePoint(0);
        var e3 = this.peekCodePoint(1);
        if (isNumberStart(e1, e2, e3)) {
          this.reconsumeCodePoint(codePoint);
          return this.consumeNumericToken();
        }
        if (isIdentifierStart(e1, e2, e3)) {
          this.reconsumeCodePoint(codePoint);
          return this.consumeIdentLikeToken();
        }
        if (e2 === HYPHEN_MINUS && e3 === GREATER_THAN_SIGN) {
          this.consumeCodePoint();
          this.consumeCodePoint();
          return CDC_TOKEN;
        }
        break;
      case FULL_STOP:
        if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) {
          this.reconsumeCodePoint(codePoint);
          return this.consumeNumericToken();
        }
        break;
      case SOLIDUS:
        if (this.peekCodePoint(0) === ASTERISK) {
          this.consumeCodePoint();
          while (true) {
            var c = this.consumeCodePoint();
            if (c === ASTERISK) {
              c = this.consumeCodePoint();
              if (c === SOLIDUS) {
                return this.consumeToken();
              }
            }
            if (c === EOF) {
              return this.consumeToken();
            }
          }
        }
        break;
      case COLON:
        return COLON_TOKEN;
      case SEMICOLON:
        return SEMICOLON_TOKEN;
      case LESS_THAN_SIGN:
        if (this.peekCodePoint(0) === EXCLAMATION_MARK && this.peekCodePoint(1) === HYPHEN_MINUS && this.peekCodePoint(2) === HYPHEN_MINUS) {
          this.consumeCodePoint();
          this.consumeCodePoint();
          return CDO_TOKEN;
        }
        break;
      case COMMERCIAL_AT:
        var a1 = this.peekCodePoint(0);
        var a2 = this.peekCodePoint(1);
        var a3 = this.peekCodePoint(2);
        if (isIdentifierStart(a1, a2, a3)) {
          var value = this.consumeName();
          return {
            type: 7 /* AT_KEYWORD_TOKEN */,
            value: value
          };
        }
        break;
      case LEFT_SQUARE_BRACKET:
        return LEFT_SQUARE_BRACKET_TOKEN;
      case REVERSE_SOLIDUS:
        if (isValidEscape(codePoint, this.peekCodePoint(0))) {
          this.reconsumeCodePoint(codePoint);
          return this.consumeIdentLikeToken();
        }
        break;
      case RIGHT_SQUARE_BRACKET:
        return RIGHT_SQUARE_BRACKET_TOKEN;
      case CIRCUMFLEX_ACCENT:
        if (this.peekCodePoint(0) === EQUALS_SIGN) {
          this.consumeCodePoint();
          return PREFIX_MATCH_TOKEN;
        }
        break;
      case LEFT_CURLY_BRACKET:
        return LEFT_CURLY_BRACKET_TOKEN;
      case RIGHT_CURLY_BRACKET:
        return RIGHT_CURLY_BRACKET_TOKEN;
      case u:
      case U:
        var u1 = this.peekCodePoint(0);
        var u2 = this.peekCodePoint(1);
        if (u1 === PLUS_SIGN && (isHex(u2) || u2 === QUESTION_MARK)) {
          this.consumeCodePoint();
          this.consumeUnicodeRangeToken();
        }
        this.reconsumeCodePoint(codePoint);
        return this.consumeIdentLikeToken();
      case VERTICAL_LINE:
        if (this.peekCodePoint(0) === EQUALS_SIGN) {
          this.consumeCodePoint();
          return DASH_MATCH_TOKEN;
        }
        if (this.peekCodePoint(0) === VERTICAL_LINE) {
          this.consumeCodePoint();
          return COLUMN_TOKEN;
        }
        break;
      case TILDE:
        if (this.peekCodePoint(0) === EQUALS_SIGN) {
          this.consumeCodePoint();
          return INCLUDE_MATCH_TOKEN;
        }
        break;
      case EOF:
        return EOF_TOKEN;
    }
    if (isWhiteSpace(codePoint)) {
      this.consumeWhiteSpace();
      return WHITESPACE_TOKEN;
    }
    if (isDigit(codePoint)) {
      this.reconsumeCodePoint(codePoint);
      return this.consumeNumericToken();
    }
    if (isNameStartCodePoint(codePoint)) {
      this.reconsumeCodePoint(codePoint);
      return this.consumeIdentLikeToken();
    }
    return {
      type: 6 /* DELIM_TOKEN */,
      value: fromCodePoint$1(codePoint)
    };
  };
  Tokenizer.prototype.consumeCodePoint = function () {
    var value = this._value.shift();
    return typeof value === 'undefined' ? -1 : value;
  };
  Tokenizer.prototype.reconsumeCodePoint = function (codePoint) {
    this._value.unshift(codePoint);
  };
  Tokenizer.prototype.peekCodePoint = function (delta) {
    if (delta >= this._value.length) {
      return -1;
    }
    return this._value[delta];
  };
  Tokenizer.prototype.consumeUnicodeRangeToken = function () {
    var digits = [];
    var codePoint = this.consumeCodePoint();
    while (isHex(codePoint) && digits.length < 6) {
      digits.push(codePoint);
      codePoint = this.consumeCodePoint();
    }
    var questionMarks = false;
    while (codePoint === QUESTION_MARK && digits.length < 6) {
      digits.push(codePoint);
      codePoint = this.consumeCodePoint();
      questionMarks = true;
    }
    if (questionMarks) {
      var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) {
        return digit === QUESTION_MARK ? ZERO : digit;
      })), 16);
      var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) {
        return digit === QUESTION_MARK ? F : digit;
      })), 16);
      return {
        type: 30 /* UNICODE_RANGE_TOKEN */,
        start: start_1,
        end: end
      };
    }
    var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16);
    if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
      this.consumeCodePoint();
      codePoint = this.consumeCodePoint();
      var endDigits = [];
      while (isHex(codePoint) && endDigits.length < 6) {
        endDigits.push(codePoint);
        codePoint = this.consumeCodePoint();
      }
      var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16);
      return {
        type: 30 /* UNICODE_RANGE_TOKEN */,
        start: start,
        end: end
      };
    } else {
      return {
        type: 30 /* UNICODE_RANGE_TOKEN */,
        start: start,
        end: start
      };
    }
  };
  Tokenizer.prototype.consumeIdentLikeToken = function () {
    var value = this.consumeName();
    if (value.toLowerCase() === 'url' && this.peekCodePoint(0) === LEFT_PARENTHESIS) {
      this.consumeCodePoint();
      return this.consumeUrlToken();
    } else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
      this.consumeCodePoint();
      return {
        type: 19 /* FUNCTION_TOKEN */,
        value: value
      };
    }
    return {
      type: 20 /* IDENT_TOKEN */,
      value: value
    };
  };
  Tokenizer.prototype.consumeUrlToken = function () {
    var value = [];
    this.consumeWhiteSpace();
    if (this.peekCodePoint(0) === EOF) {
      return {
        type: 22 /* URL_TOKEN */,
        value: ''
      };
    }
    var next = this.peekCodePoint(0);
    if (next === APOSTROPHE || next === QUOTATION_MARK) {
      var stringToken = this.consumeStringToken(this.consumeCodePoint());
      if (stringToken.type === 0 /* STRING_TOKEN */) {
        this.consumeWhiteSpace();
        if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
          this.consumeCodePoint();
          return {
            type: 22 /* URL_TOKEN */,
            value: stringToken.value
          };
        }
      }
      this.consumeBadUrlRemnants();
      return BAD_URL_TOKEN;
    }
    while (true) {
      var codePoint = this.consumeCodePoint();
      if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
        return {
          type: 22 /* URL_TOKEN */,
          value: fromCodePoint$1.apply(void 0, value)
        };
      } else if (isWhiteSpace(codePoint)) {
        this.consumeWhiteSpace();
        if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
          this.consumeCodePoint();
          return {
            type: 22 /* URL_TOKEN */,
            value: fromCodePoint$1.apply(void 0, value)
          };
        }
        this.consumeBadUrlRemnants();
        return BAD_URL_TOKEN;
      } else if (codePoint === QUOTATION_MARK || codePoint === APOSTROPHE || codePoint === LEFT_PARENTHESIS || isNonPrintableCodePoint(codePoint)) {
        this.consumeBadUrlRemnants();
        return BAD_URL_TOKEN;
      } else if (codePoint === REVERSE_SOLIDUS) {
        if (isValidEscape(codePoint, this.peekCodePoint(0))) {
          value.push(this.consumeEscapedCodePoint());
        } else {
          this.consumeBadUrlRemnants();
          return BAD_URL_TOKEN;
        }
      } else {
        value.push(codePoint);
      }
    }
  };
  Tokenizer.prototype.consumeWhiteSpace = function () {
    while (isWhiteSpace(this.peekCodePoint(0))) {
      this.consumeCodePoint();
    }
  };
  Tokenizer.prototype.consumeBadUrlRemnants = function () {
    while (true) {
      var codePoint = this.consumeCodePoint();
      if (codePoint === RIGHT_PARENTHESIS || codePoint === EOF) {
        return;
      }
      if (isValidEscape(codePoint, this.peekCodePoint(0))) {
        this.consumeEscapedCodePoint();
      }
    }
  };
  Tokenizer.prototype.consumeStringSlice = function (count) {
    var SLICE_STACK_SIZE = 50000;
    var value = '';
    while (count > 0) {
      var amount = Math.min(SLICE_STACK_SIZE, count);
      value += fromCodePoint$1.apply(void 0, this._value.splice(0, amount));
      count -= amount;
    }
    this._value.shift();
    return value;
  };
  Tokenizer.prototype.consumeStringToken = function (endingCodePoint) {
    var value = '';
    var i = 0;
    do {
      var codePoint = this._value[i];
      if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
        value += this.consumeStringSlice(i);
        return {
          type: 0 /* STRING_TOKEN */,
          value: value
        };
      }
      if (codePoint === LINE_FEED) {
        this._value.splice(0, i);
        return BAD_STRING_TOKEN;
      }
      if (codePoint === REVERSE_SOLIDUS) {
        var next = this._value[i + 1];
        if (next !== EOF && next !== undefined) {
          if (next === LINE_FEED) {
            value += this.consumeStringSlice(i);
            i = -1;
            this._value.shift();
          } else if (isValidEscape(codePoint, next)) {
            value += this.consumeStringSlice(i);
            value += fromCodePoint$1(this.consumeEscapedCodePoint());
            i = -1;
          }
        }
      }
      i++;
    } while (true);
  };
  Tokenizer.prototype.consumeNumber = function () {
    var repr = [];
    var type = FLAG_INTEGER;
    var c1 = this.peekCodePoint(0);
    if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
      repr.push(this.consumeCodePoint());
    }
    while (isDigit(this.peekCodePoint(0))) {
      repr.push(this.consumeCodePoint());
    }
    c1 = this.peekCodePoint(0);
    var c2 = this.peekCodePoint(1);
    if (c1 === FULL_STOP && isDigit(c2)) {
      repr.push(this.consumeCodePoint(), this.consumeCodePoint());
      type = FLAG_NUMBER;
      while (isDigit(this.peekCodePoint(0))) {
        repr.push(this.consumeCodePoint());
      }
    }
    c1 = this.peekCodePoint(0);
    c2 = this.peekCodePoint(1);
    var c3 = this.peekCodePoint(2);
    if ((c1 === E || c1 === e$1) && ((c2 === PLUS_SIGN || c2 === HYPHEN_MINUS) && isDigit(c3) || isDigit(c2))) {
      repr.push(this.consumeCodePoint(), this.consumeCodePoint());
      type = FLAG_NUMBER;
      while (isDigit(this.peekCodePoint(0))) {
        repr.push(this.consumeCodePoint());
      }
    }
    return [stringToNumber(repr), type];
  };
  Tokenizer.prototype.consumeNumericToken = function () {
    var _a = this.consumeNumber(),
      number = _a[0],
      flags = _a[1];
    var c1 = this.peekCodePoint(0);
    var c2 = this.peekCodePoint(1);
    var c3 = this.peekCodePoint(2);
    if (isIdentifierStart(c1, c2, c3)) {
      var unit = this.consumeName();
      return {
        type: 15 /* DIMENSION_TOKEN */,
        number: number,
        flags: flags,
        unit: unit
      };
    }
    if (c1 === PERCENTAGE_SIGN) {
      this.consumeCodePoint();
      return {
        type: 16 /* PERCENTAGE_TOKEN */,
        number: number,
        flags: flags
      };
    }
    return {
      type: 17 /* NUMBER_TOKEN */,
      number: number,
      flags: flags
    };
  };
  Tokenizer.prototype.consumeEscapedCodePoint = function () {
    var codePoint = this.consumeCodePoint();
    if (isHex(codePoint)) {
      var hex = fromCodePoint$1(codePoint);
      while (isHex(this.peekCodePoint(0)) && hex.length < 6) {
        hex += fromCodePoint$1(this.consumeCodePoint());
      }
      if (isWhiteSpace(this.peekCodePoint(0))) {
        this.consumeCodePoint();
      }
      var hexCodePoint = parseInt(hex, 16);
      if (hexCodePoint === 0 || isSurrogateCodePoint(hexCodePoint) || hexCodePoint > 0x10ffff) {
        return REPLACEMENT_CHARACTER;
      }
      return hexCodePoint;
    }
    if (codePoint === EOF) {
      return REPLACEMENT_CHARACTER;
    }
    return codePoint;
  };
  Tokenizer.prototype.consumeName = function () {
    var result = '';
    while (true) {
      var codePoint = this.consumeCodePoint();
      if (isNameCodePoint(codePoint)) {
        result += fromCodePoint$1(codePoint);
      } else if (isValidEscape(codePoint, this.peekCodePoint(0))) {
        result += fromCodePoint$1(this.consumeEscapedCodePoint());
      } else {
        this.reconsumeCodePoint(codePoint);
        return result;
      }
    }
  };
  return Tokenizer;
}();
var Parser = /** @class */function () {
  function Parser(tokens) {
    this._tokens = tokens;
  }
  Parser.create = function (value) {
    var tokenizer = new Tokenizer();
    tokenizer.write(value);
    return new Parser(tokenizer.read());
  };
  Parser.parseValue = function (value) {
    return Parser.create(value).parseComponentValue();
  };
  Parser.parseValues = function (value) {
    return Parser.create(value).parseComponentValues();
  };
  Parser.prototype.parseComponentValue = function () {
    var token = this.consumeToken();
    while (token.type === 31 /* WHITESPACE_TOKEN */) {
      token = this.consumeToken();
    }
    if (token.type === 32 /* EOF_TOKEN */) {
      throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
    }
    this.reconsumeToken(token);
    var value = this.consumeComponentValue();
    do {
      token = this.consumeToken();
    } while (token.type === 31 /* WHITESPACE_TOKEN */);
    if (token.type === 32 /* EOF_TOKEN */) {
      return value;
    }
    throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
  };
  Parser.prototype.parseComponentValues = function () {
    var values = [];
    while (true) {
      var value = this.consumeComponentValue();
      if (value.type === 32 /* EOF_TOKEN */) {
        return values;
      }
      values.push(value);
      values.push();
    }
  };
  Parser.prototype.consumeComponentValue = function () {
    var token = this.consumeToken();
    switch (token.type) {
      case 11 /* LEFT_CURLY_BRACKET_TOKEN */:
      case 28 /* LEFT_SQUARE_BRACKET_TOKEN */:
      case 2 /* LEFT_PARENTHESIS_TOKEN */:
        return this.consumeSimpleBlock(token.type);
      case 19 /* FUNCTION_TOKEN */:
        return this.consumeFunction(token);
    }
    return token;
  };
  Parser.prototype.consumeSimpleBlock = function (type) {
    var block = {
      type: type,
      values: []
    };
    var token = this.consumeToken();
    while (true) {
      if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) {
        return block;
      }
      this.reconsumeToken(token);
      block.values.push(this.consumeComponentValue());
      token = this.consumeToken();
    }
  };
  Parser.prototype.consumeFunction = function (functionToken) {
    var cssFunction = {
      name: functionToken.value,
      values: [],
      type: 18 /* FUNCTION */
    };
    while (true) {
      var token = this.consumeToken();
      if (token.type === 32 /* EOF_TOKEN */ || token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */) {
        return cssFunction;
      }
      this.reconsumeToken(token);
      cssFunction.values.push(this.consumeComponentValue());
    }
  };
  Parser.prototype.consumeToken = function () {
    var token = this._tokens.shift();
    return typeof token === 'undefined' ? EOF_TOKEN : token;
  };
  Parser.prototype.reconsumeToken = function (token) {
    this._tokens.unshift(token);
  };
  return Parser;
}();
var isDimensionToken = function (token) {
  return token.type === 15 /* DIMENSION_TOKEN */;
};
var isNumberToken = function (token) {
  return token.type === 17 /* NUMBER_TOKEN */;
};
var isIdentToken = function (token) {
  return token.type === 20 /* IDENT_TOKEN */;
};
var isStringToken = function (token) {
  return token.type === 0 /* STRING_TOKEN */;
};
var isIdentWithValue = function (token, value) {
  return isIdentToken(token) && token.value === value;
};
var nonWhiteSpace = function (token) {
  return token.type !== 31 /* WHITESPACE_TOKEN */;
};
var nonFunctionArgSeparator = function (token) {
  return token.type !== 31 /* WHITESPACE_TOKEN */ && token.type !== 4 /* COMMA_TOKEN */;
};
var parseFunctionArgs = function (tokens) {
  var args = [];
  var arg = [];
  tokens.forEach(function (token) {
    if (token.type === 4 /* COMMA_TOKEN */) {
      if (arg.length === 0) {
        throw new Error("Error parsing function args, zero tokens for arg");
      }
      args.push(arg);
      arg = [];
      return;
    }
    if (token.type !== 31 /* WHITESPACE_TOKEN */) {
      arg.push(token);
    }
  });
  if (arg.length) {
    args.push(arg);
  }
  return args;
};
var isEndingTokenFor = function (token, type) {
  if (type === 11 /* LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* RIGHT_CURLY_BRACKET_TOKEN */) {
    return true;
  }
  if (type === 28 /* LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* RIGHT_SQUARE_BRACKET_TOKEN */) {
    return true;
  }
  return type === 2 /* LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */;
};
var isLength = function (token) {
  return token.type === 17 /* NUMBER_TOKEN */ || token.type === 15 /* DIMENSION_TOKEN */;
};
var isLengthPercentage = function (token) {
  return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token);
};
var parseLengthPercentageTuple = function (tokens) {
  return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
};
var ZERO_LENGTH = {
  type: 17 /* NUMBER_TOKEN */,
  number: 0,
  flags: FLAG_INTEGER
};
var FIFTY_PERCENT = {
  type: 16 /* PERCENTAGE_TOKEN */,
  number: 50,
  flags: FLAG_INTEGER
};
var HUNDRED_PERCENT = {
  type: 16 /* PERCENTAGE_TOKEN */,
  number: 100,
  flags: FLAG_INTEGER
};
var getAbsoluteValueForTuple = function (tuple, width, height) {
  var x = tuple[0],
    y = tuple[1];
  return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)];
};
var getAbsoluteValue = function (token, parent) {
  if (token.type === 16 /* PERCENTAGE_TOKEN */) {
    return token.number / 100 * parent;
  }
  if (isDimensionToken(token)) {
    switch (token.unit) {
      case 'rem':
      case 'em':
        return 16 * token.number;
      // TODO use correct font-size
      case 'px':
      default:
        return token.number;
    }
  }
  return token.number;
};
var DEG = 'deg';
var GRAD = 'grad';
var RAD = 'rad';
var TURN = 'turn';
var angle = {
  name: 'angle',
  parse: function (_context, value) {
    if (value.type === 15 /* DIMENSION_TOKEN */) {
      switch (value.unit) {
        case DEG:
          return Math.PI * value.number / 180;
        case GRAD:
          return Math.PI / 200 * value.number;
        case RAD:
          return value.number;
        case TURN:
          return Math.PI * 2 * value.number;
      }
    }
    throw new Error("Unsupported angle type");
  }
};
var isAngle = function (value) {
  if (value.type === 15 /* DIMENSION_TOKEN */) {
    if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
      return true;
    }
  }
  return false;
};
var parseNamedSide = function (tokens) {
  var sideOrCorner = tokens.filter(isIdentToken).map(function (ident) {
    return ident.value;
  }).join(' ');
  switch (sideOrCorner) {
    case 'to bottom right':
    case 'to right bottom':
    case 'left top':
    case 'top left':
      return [ZERO_LENGTH, ZERO_LENGTH];
    case 'to top':
    case 'bottom':
      return deg(0);
    case 'to bottom left':
    case 'to left bottom':
    case 'right top':
    case 'top right':
      return [ZERO_LENGTH, HUNDRED_PERCENT];
    case 'to right':
    case 'left':
      return deg(90);
    case 'to top left':
    case 'to left top':
    case 'right bottom':
    case 'bottom right':
      return [HUNDRED_PERCENT, HUNDRED_PERCENT];
    case 'to bottom':
    case 'top':
      return deg(180);
    case 'to top right':
    case 'to right top':
    case 'left bottom':
    case 'bottom left':
      return [HUNDRED_PERCENT, ZERO_LENGTH];
    case 'to left':
    case 'right':
      return deg(270);
  }
  return 0;
};
var deg = function (deg) {
  return Math.PI * deg / 180;
};
var color$1 = {
  name: 'color',
  parse: function (context, value) {
    if (value.type === 18 /* FUNCTION */) {
      var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
      if (typeof colorFunction === 'undefined') {
        throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\"");
      }
      return colorFunction(context, value.values);
    }
    if (value.type === 5 /* HASH_TOKEN */) {
      if (value.value.length === 3) {
        var r = value.value.substring(0, 1);
        var g = value.value.substring(1, 2);
        var b = value.value.substring(2, 3);
        return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
      }
      if (value.value.length === 4) {
        var r = value.value.substring(0, 1);
        var g = value.value.substring(1, 2);
        var b = value.value.substring(2, 3);
        var a = value.value.substring(3, 4);
        return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255);
      }
      if (value.value.length === 6) {
        var r = value.value.substring(0, 2);
        var g = value.value.substring(2, 4);
        var b = value.value.substring(4, 6);
        return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
      }
      if (value.value.length === 8) {
        var r = value.value.substring(0, 2);
        var g = value.value.substring(2, 4);
        var b = value.value.substring(4, 6);
        var a = value.value.substring(6, 8);
        return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255);
      }
    }
    if (value.type === 20 /* IDENT_TOKEN */) {
      var namedColor = COLORS[value.value.toUpperCase()];
      if (typeof namedColor !== 'undefined') {
        return namedColor;
      }
    }
    return COLORS.TRANSPARENT;
  }
};
var isTransparent = function (color) {
  return (0xff & color) === 0;
};
var asString = function (color) {
  var alpha = 0xff & color;
  var blue = 0xff & color >> 8;
  var green = 0xff & color >> 16;
  var red = 0xff & color >> 24;
  return alpha < 255 ? "rgba(" + red + "," + green + "," + blue + "," + alpha / 255 + ")" : "rgb(" + red + "," + green + "," + blue + ")";
};
var pack = function (r, g, b, a) {
  return (r << 24 | g << 16 | b << 8 | Math.round(a * 255) << 0) >>> 0;
};
var getTokenColorValue = function (token, i) {
  if (token.type === 17 /* NUMBER_TOKEN */) {
    return token.number;
  }
  if (token.type === 16 /* PERCENTAGE_TOKEN */) {
    var max = i === 3 ? 1 : 255;
    return i === 3 ? token.number / 100 * max : Math.round(token.number / 100 * max);
  }
  return 0;
};
var rgb = function (_context, args) {
  var tokens = args.filter(nonFunctionArgSeparator);
  if (tokens.length === 3) {
    var _a = tokens.map(getTokenColorValue),
      r = _a[0],
      g = _a[1],
      b = _a[2];
    return pack(r, g, b, 1);
  }
  if (tokens.length === 4) {
    var _b = tokens.map(getTokenColorValue),
      r = _b[0],
      g = _b[1],
      b = _b[2],
      a = _b[3];
    return pack(r, g, b, a);
  }
  return 0;
};
function hue2rgb$2(t1, t2, hue) {
  if (hue < 0) {
    hue += 1;
  }
  if (hue >= 1) {
    hue -= 1;
  }
  if (hue < 1 / 6) {
    return (t2 - t1) * hue * 6 + t1;
  } else if (hue < 1 / 2) {
    return t2;
  } else if (hue < 2 / 3) {
    return (t2 - t1) * 6 * (2 / 3 - hue) + t1;
  } else {
    return t1;
  }
}
var hsl = function (context, args) {
  var tokens = args.filter(nonFunctionArgSeparator);
  var hue = tokens[0],
    saturation = tokens[1],
    lightness = tokens[2],
    alpha = tokens[3];
  var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2);
  var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
  var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
  var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
  if (s === 0) {
    return pack(l * 255, l * 255, l * 255, 1);
  }
  var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
  var t1 = l * 2 - t2;
  var r = hue2rgb$2(t1, t2, h + 1 / 3);
  var g = hue2rgb$2(t1, t2, h);
  var b = hue2rgb$2(t1, t2, h - 1 / 3);
  return pack(r * 255, g * 255, b * 255, a);
};
var SUPPORTED_COLOR_FUNCTIONS = {
  hsl: hsl,
  hsla: hsl,
  rgb: rgb,
  rgba: rgb
};
var parseColor = function (context, value) {
  return color$1.parse(context, Parser.create(value).parseComponentValue());
};
var COLORS = {
  ALICEBLUE: 0xf0f8ffff,
  ANTIQUEWHITE: 0xfaebd7ff,
  AQUA: 0x00ffffff,
  AQUAMARINE: 0x7fffd4ff,
  AZURE: 0xf0ffffff,
  BEIGE: 0xf5f5dcff,
  BISQUE: 0xffe4c4ff,
  BLACK: 0x000000ff,
  BLANCHEDALMOND: 0xffebcdff,
  BLUE: 0x0000ffff,
  BLUEVIOLET: 0x8a2be2ff,
  BROWN: 0xa52a2aff,
  BURLYWOOD: 0xdeb887ff,
  CADETBLUE: 0x5f9ea0ff,
  CHARTREUSE: 0x7fff00ff,
  CHOCOLATE: 0xd2691eff,
  CORAL: 0xff7f50ff,
  CORNFLOWERBLUE: 0x6495edff,
  CORNSILK: 0xfff8dcff,
  CRIMSON: 0xdc143cff,
  CYAN: 0x00ffffff,
  DARKBLUE: 0x00008bff,
  DARKCYAN: 0x008b8bff,
  DARKGOLDENROD: 0xb886bbff,
  DARKGRAY: 0xa9a9a9ff,
  DARKGREEN: 0x006400ff,
  DARKGREY: 0xa9a9a9ff,
  DARKKHAKI: 0xbdb76bff,
  DARKMAGENTA: 0x8b008bff,
  DARKOLIVEGREEN: 0x556b2fff,
  DARKORANGE: 0xff8c00ff,
  DARKORCHID: 0x9932ccff,
  DARKRED: 0x8b0000ff,
  DARKSALMON: 0xe9967aff,
  DARKSEAGREEN: 0x8fbc8fff,
  DARKSLATEBLUE: 0x483d8bff,
  DARKSLATEGRAY: 0x2f4f4fff,
  DARKSLATEGREY: 0x2f4f4fff,
  DARKTURQUOISE: 0x00ced1ff,
  DARKVIOLET: 0x9400d3ff,
  DEEPPINK: 0xff1493ff,
  DEEPSKYBLUE: 0x00bfffff,
  DIMGRAY: 0x696969ff,
  DIMGREY: 0x696969ff,
  DODGERBLUE: 0x1e90ffff,
  FIREBRICK: 0xb22222ff,
  FLORALWHITE: 0xfffaf0ff,
  FORESTGREEN: 0x228b22ff,
  FUCHSIA: 0xff00ffff,
  GAINSBORO: 0xdcdcdcff,
  GHOSTWHITE: 0xf8f8ffff,
  GOLD: 0xffd700ff,
  GOLDENROD: 0xdaa520ff,
  GRAY: 0x808080ff,
  GREEN: 0x008000ff,
  GREENYELLOW: 0xadff2fff,
  GREY: 0x808080ff,
  HONEYDEW: 0xf0fff0ff,
  HOTPINK: 0xff69b4ff,
  INDIANRED: 0xcd5c5cff,
  INDIGO: 0x4b0082ff,
  IVORY: 0xfffff0ff,
  KHAKI: 0xf0e68cff,
  LAVENDER: 0xe6e6faff,
  LAVENDERBLUSH: 0xfff0f5ff,
  LAWNGREEN: 0x7cfc00ff,
  LEMONCHIFFON: 0xfffacdff,
  LIGHTBLUE: 0xadd8e6ff,
  LIGHTCORAL: 0xf08080ff,
  LIGHTCYAN: 0xe0ffffff,
  LIGHTGOLDENRODYELLOW: 0xfafad2ff,
  LIGHTGRAY: 0xd3d3d3ff,
  LIGHTGREEN: 0x90ee90ff,
  LIGHTGREY: 0xd3d3d3ff,
  LIGHTPINK: 0xffb6c1ff,
  LIGHTSALMON: 0xffa07aff,
  LIGHTSEAGREEN: 0x20b2aaff,
  LIGHTSKYBLUE: 0x87cefaff,
  LIGHTSLATEGRAY: 0x778899ff,
  LIGHTSLATEGREY: 0x778899ff,
  LIGHTSTEELBLUE: 0xb0c4deff,
  LIGHTYELLOW: 0xffffe0ff,
  LIME: 0x00ff00ff,
  LIMEGREEN: 0x32cd32ff,
  LINEN: 0xfaf0e6ff,
  MAGENTA: 0xff00ffff,
  MAROON: 0x800000ff,
  MEDIUMAQUAMARINE: 0x66cdaaff,
  MEDIUMBLUE: 0x0000cdff,
  MEDIUMORCHID: 0xba55d3ff,
  MEDIUMPURPLE: 0x9370dbff,
  MEDIUMSEAGREEN: 0x3cb371ff,
  MEDIUMSLATEBLUE: 0x7b68eeff,
  MEDIUMSPRINGGREEN: 0x00fa9aff,
  MEDIUMTURQUOISE: 0x48d1ccff,
  MEDIUMVIOLETRED: 0xc71585ff,
  MIDNIGHTBLUE: 0x191970ff,
  MINTCREAM: 0xf5fffaff,
  MISTYROSE: 0xffe4e1ff,
  MOCCASIN: 0xffe4b5ff,
  NAVAJOWHITE: 0xffdeadff,
  NAVY: 0x000080ff,
  OLDLACE: 0xfdf5e6ff,
  OLIVE: 0x808000ff,
  OLIVEDRAB: 0x6b8e23ff,
  ORANGE: 0xffa500ff,
  ORANGERED: 0xff4500ff,
  ORCHID: 0xda70d6ff,
  PALEGOLDENROD: 0xeee8aaff,
  PALEGREEN: 0x98fb98ff,
  PALETURQUOISE: 0xafeeeeff,
  PALEVIOLETRED: 0xdb7093ff,
  PAPAYAWHIP: 0xffefd5ff,
  PEACHPUFF: 0xffdab9ff,
  PERU: 0xcd853fff,
  PINK: 0xffc0cbff,
  PLUM: 0xdda0ddff,
  POWDERBLUE: 0xb0e0e6ff,
  PURPLE: 0x800080ff,
  REBECCAPURPLE: 0x663399ff,
  RED: 0xff0000ff,
  ROSYBROWN: 0xbc8f8fff,
  ROYALBLUE: 0x4169e1ff,
  SADDLEBROWN: 0x8b4513ff,
  SALMON: 0xfa8072ff,
  SANDYBROWN: 0xf4a460ff,
  SEAGREEN: 0x2e8b57ff,
  SEASHELL: 0xfff5eeff,
  SIENNA: 0xa0522dff,
  SILVER: 0xc0c0c0ff,
  SKYBLUE: 0x87ceebff,
  SLATEBLUE: 0x6a5acdff,
  SLATEGRAY: 0x708090ff,
  SLATEGREY: 0x708090ff,
  SNOW: 0xfffafaff,
  SPRINGGREEN: 0x00ff7fff,
  STEELBLUE: 0x4682b4ff,
  TAN: 0xd2b48cff,
  TEAL: 0x008080ff,
  THISTLE: 0xd8bfd8ff,
  TOMATO: 0xff6347ff,
  TRANSPARENT: 0x00000000,
  TURQUOISE: 0x40e0d0ff,
  VIOLET: 0xee82eeff,
  WHEAT: 0xf5deb3ff,
  WHITE: 0xffffffff,
  WHITESMOKE: 0xf5f5f5ff,
  YELLOW: 0xffff00ff,
  YELLOWGREEN: 0x9acd32ff
};
var backgroundClip = {
  name: 'background-clip',
  initialValue: 'border-box',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    return tokens.map(function (token) {
      if (isIdentToken(token)) {
        switch (token.value) {
          case 'padding-box':
            return 1 /* PADDING_BOX */;
          case 'content-box':
            return 2 /* CONTENT_BOX */;
        }
      }
      return 0 /* BORDER_BOX */;
    });
  }
};
var backgroundColor$1 = {
  name: "background-color",
  initialValue: 'transparent',
  prefix: false,
  type: 3 /* TYPE_VALUE */,
  format: 'color'
};
var parseColorStop = function (context, args) {
  var color = color$1.parse(context, args[0]);
  var stop = args[1];
  return stop && isLengthPercentage(stop) ? {
    color: color,
    stop: stop
  } : {
    color: color,
    stop: null
  };
};
var processColorStops = function (stops, lineLength) {
  var first = stops[0];
  var last = stops[stops.length - 1];
  if (first.stop === null) {
    first.stop = ZERO_LENGTH;
  }
  if (last.stop === null) {
    last.stop = HUNDRED_PERCENT;
  }
  var processStops = [];
  var previous = 0;
  for (var i = 0; i < stops.length; i++) {
    var stop_1 = stops[i].stop;
    if (stop_1 !== null) {
      var absoluteValue = getAbsoluteValue(stop_1, lineLength);
      if (absoluteValue > previous) {
        processStops.push(absoluteValue);
      } else {
        processStops.push(previous);
      }
      previous = absoluteValue;
    } else {
      processStops.push(null);
    }
  }
  var gapBegin = null;
  for (var i = 0; i < processStops.length; i++) {
    var stop_2 = processStops[i];
    if (stop_2 === null) {
      if (gapBegin === null) {
        gapBegin = i;
      }
    } else if (gapBegin !== null) {
      var gapLength = i - gapBegin;
      var beforeGap = processStops[gapBegin - 1];
      var gapValue = (stop_2 - beforeGap) / (gapLength + 1);
      for (var g = 1; g <= gapLength; g++) {
        processStops[gapBegin + g - 1] = gapValue * g;
      }
      gapBegin = null;
    }
  }
  return stops.map(function (_a, i) {
    var color = _a.color;
    return {
      color: color,
      stop: Math.max(Math.min(1, processStops[i] / lineLength), 0)
    };
  });
};
var getAngleFromCorner = function (corner, width, height) {
  var centerX = width / 2;
  var centerY = height / 2;
  var x = getAbsoluteValue(corner[0], width) - centerX;
  var y = centerY - getAbsoluteValue(corner[1], height);
  return (Math.atan2(y, x) + Math.PI * 2) % (Math.PI * 2);
};
var calculateGradientDirection = function (angle, width, height) {
  var radian = typeof angle === 'number' ? angle : getAngleFromCorner(angle, width, height);
  var lineLength = Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian));
  var halfWidth = width / 2;
  var halfHeight = height / 2;
  var halfLineLength = lineLength / 2;
  var yDiff = Math.sin(radian - Math.PI / 2) * halfLineLength;
  var xDiff = Math.cos(radian - Math.PI / 2) * halfLineLength;
  return [lineLength, halfWidth - xDiff, halfWidth + xDiff, halfHeight - yDiff, halfHeight + yDiff];
};
var distance$2 = function (a, b) {
  return Math.sqrt(a * a + b * b);
};
var findCorner = function (width, height, x, y, closest) {
  var corners = [[0, 0], [0, height], [width, 0], [width, height]];
  return corners.reduce(function (stat, corner) {
    var cx = corner[0],
      cy = corner[1];
    var d = distance$2(x - cx, y - cy);
    if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) {
      return {
        optimumCorner: corner,
        optimumDistance: d
      };
    }
    return stat;
  }, {
    optimumDistance: closest ? Infinity : -Infinity,
    optimumCorner: null
  }).optimumCorner;
};
var calculateRadius = function (gradient, x, y, width, height) {
  var rx = 0;
  var ry = 0;
  switch (gradient.size) {
    case 0 /* CLOSEST_SIDE */:
      // The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
      // If the shape is an ellipse, it exactly meets the closest side in each dimension.
      if (gradient.shape === 0 /* CIRCLE */) {
        rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
      } else if (gradient.shape === 1 /* ELLIPSE */) {
        rx = Math.min(Math.abs(x), Math.abs(x - width));
        ry = Math.min(Math.abs(y), Math.abs(y - height));
      }
      break;
    case 2 /* CLOSEST_CORNER */:
      // The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
      // If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
      if (gradient.shape === 0 /* CIRCLE */) {
        rx = ry = Math.min(distance$2(x, y), distance$2(x, y - height), distance$2(x - width, y), distance$2(x - width, y - height));
      } else if (gradient.shape === 1 /* ELLIPSE */) {
        // Compute the ratio ry/rx (which is to be the same as for "closest-side")
        var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
        var _a = findCorner(width, height, x, y, true),
          cx = _a[0],
          cy = _a[1];
        rx = distance$2(cx - x, (cy - y) / c);
        ry = c * rx;
      }
      break;
    case 1 /* FARTHEST_SIDE */:
      // Same as closest-side, except the ending shape is sized based on the farthest side(s)
      if (gradient.shape === 0 /* CIRCLE */) {
        rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
      } else if (gradient.shape === 1 /* ELLIPSE */) {
        rx = Math.max(Math.abs(x), Math.abs(x - width));
        ry = Math.max(Math.abs(y), Math.abs(y - height));
      }
      break;
    case 3 /* FARTHEST_CORNER */:
      // Same as closest-corner, except the ending shape is sized based on the farthest corner.
      // If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
      if (gradient.shape === 0 /* CIRCLE */) {
        rx = ry = Math.max(distance$2(x, y), distance$2(x, y - height), distance$2(x - width, y), distance$2(x - width, y - height));
      } else if (gradient.shape === 1 /* ELLIPSE */) {
        // Compute the ratio ry/rx (which is to be the same as for "farthest-side")
        var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
        var _b = findCorner(width, height, x, y, false),
          cx = _b[0],
          cy = _b[1];
        rx = distance$2(cx - x, (cy - y) / c);
        ry = c * rx;
      }
      break;
  }
  if (Array.isArray(gradient.size)) {
    rx = getAbsoluteValue(gradient.size[0], width);
    ry = gradient.size.length === 2 ? getAbsoluteValue(gradient.size[1], height) : rx;
  }
  return [rx, ry];
};
var linearGradient = function (context, tokens) {
  var angle$1 = deg(180);
  var stops = [];
  parseFunctionArgs(tokens).forEach(function (arg, i) {
    if (i === 0) {
      var firstToken = arg[0];
      if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') {
        angle$1 = parseNamedSide(arg);
        return;
      } else if (isAngle(firstToken)) {
        angle$1 = angle.parse(context, firstToken);
        return;
      }
    }
    var colorStop = parseColorStop(context, arg);
    stops.push(colorStop);
  });
  return {
    angle: angle$1,
    stops: stops,
    type: 1 /* LINEAR_GRADIENT */
  };
};
var prefixLinearGradient = function (context, tokens) {
  var angle$1 = deg(180);
  var stops = [];
  parseFunctionArgs(tokens).forEach(function (arg, i) {
    if (i === 0) {
      var firstToken = arg[0];
      if (firstToken.type === 20 /* IDENT_TOKEN */ && ['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) {
        angle$1 = parseNamedSide(arg);
        return;
      } else if (isAngle(firstToken)) {
        angle$1 = (angle.parse(context, firstToken) + deg(270)) % deg(360);
        return;
      }
    }
    var colorStop = parseColorStop(context, arg);
    stops.push(colorStop);
  });
  return {
    angle: angle$1,
    stops: stops,
    type: 1 /* LINEAR_GRADIENT */
  };
};
var webkitGradient = function (context, tokens) {
  var angle = deg(180);
  var stops = [];
  var type = 1 /* LINEAR_GRADIENT */;
  var shape = 0 /* CIRCLE */;
  var size = 3 /* FARTHEST_CORNER */;
  var position = [];
  parseFunctionArgs(tokens).forEach(function (arg, i) {
    var firstToken = arg[0];
    if (i === 0) {
      if (isIdentToken(firstToken) && firstToken.value === 'linear') {
        type = 1 /* LINEAR_GRADIENT */;
        return;
      } else if (isIdentToken(firstToken) && firstToken.value === 'radial') {
        type = 2 /* RADIAL_GRADIENT */;
        return;
      }
    }
    if (firstToken.type === 18 /* FUNCTION */) {
      if (firstToken.name === 'from') {
        var color = color$1.parse(context, firstToken.values[0]);
        stops.push({
          stop: ZERO_LENGTH,
          color: color
        });
      } else if (firstToken.name === 'to') {
        var color = color$1.parse(context, firstToken.values[0]);
        stops.push({
          stop: HUNDRED_PERCENT,
          color: color
        });
      } else if (firstToken.name === 'color-stop') {
        var values = firstToken.values.filter(nonFunctionArgSeparator);
        if (values.length === 2) {
          var color = color$1.parse(context, values[1]);
          var stop_1 = values[0];
          if (isNumberToken(stop_1)) {
            stops.push({
              stop: {
                type: 16 /* PERCENTAGE_TOKEN */,
                number: stop_1.number * 100,
                flags: stop_1.flags
              },
              color: color
            });
          }
        }
      }
    }
  });
  return type === 1 /* LINEAR_GRADIENT */ ? {
    angle: (angle + deg(180)) % deg(360),
    stops: stops,
    type: type
  } : {
    size: size,
    shape: shape,
    stops: stops,
    position: position,
    type: type
  };
};
var CLOSEST_SIDE = 'closest-side';
var FARTHEST_SIDE = 'farthest-side';
var CLOSEST_CORNER = 'closest-corner';
var FARTHEST_CORNER = 'farthest-corner';
var CIRCLE = 'circle';
var ELLIPSE = 'ellipse';
var COVER = 'cover';
var CONTAIN = 'contain';
var radialGradient = function (context, tokens) {
  var shape = 0 /* CIRCLE */;
  var size = 3 /* FARTHEST_CORNER */;
  var stops = [];
  var position = [];
  parseFunctionArgs(tokens).forEach(function (arg, i) {
    var isColorStop = true;
    if (i === 0) {
      var isAtPosition_1 = false;
      isColorStop = arg.reduce(function (acc, token) {
        if (isAtPosition_1) {
          if (isIdentToken(token)) {
            switch (token.value) {
              case 'center':
                position.push(FIFTY_PERCENT);
                return acc;
              case 'top':
              case 'left':
                position.push(ZERO_LENGTH);
                return acc;
              case 'right':
              case 'bottom':
                position.push(HUNDRED_PERCENT);
                return acc;
            }
          } else if (isLengthPercentage(token) || isLength(token)) {
            position.push(token);
          }
        } else if (isIdentToken(token)) {
          switch (token.value) {
            case CIRCLE:
              shape = 0 /* CIRCLE */;
              return false;
            case ELLIPSE:
              shape = 1 /* ELLIPSE */;
              return false;
            case 'at':
              isAtPosition_1 = true;
              return false;
            case CLOSEST_SIDE:
              size = 0 /* CLOSEST_SIDE */;
              return false;
            case COVER:
            case FARTHEST_SIDE:
              size = 1 /* FARTHEST_SIDE */;
              return false;
            case CONTAIN:
            case CLOSEST_CORNER:
              size = 2 /* CLOSEST_CORNER */;
              return false;
            case FARTHEST_CORNER:
              size = 3 /* FARTHEST_CORNER */;
              return false;
          }
        } else if (isLength(token) || isLengthPercentage(token)) {
          if (!Array.isArray(size)) {
            size = [];
          }
          size.push(token);
          return false;
        }
        return acc;
      }, isColorStop);
    }
    if (isColorStop) {
      var colorStop = parseColorStop(context, arg);
      stops.push(colorStop);
    }
  });
  return {
    size: size,
    shape: shape,
    stops: stops,
    position: position,
    type: 2 /* RADIAL_GRADIENT */
  };
};
var prefixRadialGradient = function (context, tokens) {
  var shape = 0 /* CIRCLE */;
  var size = 3 /* FARTHEST_CORNER */;
  var stops = [];
  var position = [];
  parseFunctionArgs(tokens).forEach(function (arg, i) {
    var isColorStop = true;
    if (i === 0) {
      isColorStop = arg.reduce(function (acc, token) {
        if (isIdentToken(token)) {
          switch (token.value) {
            case 'center':
              position.push(FIFTY_PERCENT);
              return false;
            case 'top':
            case 'left':
              position.push(ZERO_LENGTH);
              return false;
            case 'right':
            case 'bottom':
              position.push(HUNDRED_PERCENT);
              return false;
          }
        } else if (isLengthPercentage(token) || isLength(token)) {
          position.push(token);
          return false;
        }
        return acc;
      }, isColorStop);
    } else if (i === 1) {
      isColorStop = arg.reduce(function (acc, token) {
        if (isIdentToken(token)) {
          switch (token.value) {
            case CIRCLE:
              shape = 0 /* CIRCLE */;
              return false;
            case ELLIPSE:
              shape = 1 /* ELLIPSE */;
              return false;
            case CONTAIN:
            case CLOSEST_SIDE:
              size = 0 /* CLOSEST_SIDE */;
              return false;
            case FARTHEST_SIDE:
              size = 1 /* FARTHEST_SIDE */;
              return false;
            case CLOSEST_CORNER:
              size = 2 /* CLOSEST_CORNER */;
              return false;
            case COVER:
            case FARTHEST_CORNER:
              size = 3 /* FARTHEST_CORNER */;
              return false;
          }
        } else if (isLength(token) || isLengthPercentage(token)) {
          if (!Array.isArray(size)) {
            size = [];
          }
          size.push(token);
          return false;
        }
        return acc;
      }, isColorStop);
    }
    if (isColorStop) {
      var colorStop = parseColorStop(context, arg);
      stops.push(colorStop);
    }
  });
  return {
    size: size,
    shape: shape,
    stops: stops,
    position: position,
    type: 2 /* RADIAL_GRADIENT */
  };
};
var isLinearGradient$1 = function (background) {
  return background.type === 1 /* LINEAR_GRADIENT */;
};
var isRadialGradient$1 = function (background) {
  return background.type === 2 /* RADIAL_GRADIENT */;
};
var image = {
  name: 'image',
  parse: function (context, value) {
    if (value.type === 22 /* URL_TOKEN */) {
      var image_1 = {
        url: value.value,
        type: 0 /* URL */
      };
      context.cache.addImage(value.value);
      return image_1;
    }
    if (value.type === 18 /* FUNCTION */) {
      var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
      if (typeof imageFunction === 'undefined') {
        throw new Error("Attempting to parse an unsupported image function \"" + value.name + "\"");
      }
      return imageFunction(context, value.values);
    }
    throw new Error("Unsupported image type " + value.type);
  }
};
function isSupportedImage(value) {
  return !(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') && (value.type !== 18 /* FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]);
}
var SUPPORTED_IMAGE_FUNCTIONS = {
  'linear-gradient': linearGradient,
  '-moz-linear-gradient': prefixLinearGradient,
  '-ms-linear-gradient': prefixLinearGradient,
  '-o-linear-gradient': prefixLinearGradient,
  '-webkit-linear-gradient': prefixLinearGradient,
  'radial-gradient': radialGradient,
  '-moz-radial-gradient': prefixRadialGradient,
  '-ms-radial-gradient': prefixRadialGradient,
  '-o-radial-gradient': prefixRadialGradient,
  '-webkit-radial-gradient': prefixRadialGradient,
  '-webkit-gradient': webkitGradient
};
var backgroundImage = {
  name: 'background-image',
  initialValue: 'none',
  type: 1 /* LIST */,
  prefix: false,
  parse: function (context, tokens) {
    if (tokens.length === 0) {
      return [];
    }
    var first = tokens[0];
    if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
      return [];
    }
    return tokens.filter(function (value) {
      return nonFunctionArgSeparator(value) && isSupportedImage(value);
    }).map(function (value) {
      return image.parse(context, value);
    });
  }
};
var backgroundOrigin = {
  name: 'background-origin',
  initialValue: 'border-box',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    return tokens.map(function (token) {
      if (isIdentToken(token)) {
        switch (token.value) {
          case 'padding-box':
            return 1 /* PADDING_BOX */;
          case 'content-box':
            return 2 /* CONTENT_BOX */;
        }
      }
      return 0 /* BORDER_BOX */;
    });
  }
};
var backgroundPosition = {
  name: 'background-position',
  initialValue: '0% 0%',
  type: 1 /* LIST */,
  prefix: false,
  parse: function (_context, tokens) {
    return parseFunctionArgs(tokens).map(function (values) {
      return values.filter(isLengthPercentage);
    }).map(parseLengthPercentageTuple);
  }
};
var backgroundRepeat = {
  name: 'background-repeat',
  initialValue: 'repeat',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    return parseFunctionArgs(tokens).map(function (values) {
      return values.filter(isIdentToken).map(function (token) {
        return token.value;
      }).join(' ');
    }).map(parseBackgroundRepeat);
  }
};
var parseBackgroundRepeat = function (value) {
  switch (value) {
    case 'no-repeat':
      return 1 /* NO_REPEAT */;
    case 'repeat-x':
    case 'repeat no-repeat':
      return 2 /* REPEAT_X */;
    case 'repeat-y':
    case 'no-repeat repeat':
      return 3 /* REPEAT_Y */;
    case 'repeat':
    default:
      return 0 /* REPEAT */;
  }
};
var BACKGROUND_SIZE;
(function (BACKGROUND_SIZE) {
  BACKGROUND_SIZE["AUTO"] = "auto";
  BACKGROUND_SIZE["CONTAIN"] = "contain";
  BACKGROUND_SIZE["COVER"] = "cover";
})(BACKGROUND_SIZE || (BACKGROUND_SIZE = {}));
var backgroundSize = {
  name: 'background-size',
  initialValue: '0',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    return parseFunctionArgs(tokens).map(function (values) {
      return values.filter(isBackgroundSizeInfoToken);
    });
  }
};
var isBackgroundSizeInfoToken = function (value) {
  return isIdentToken(value) || isLengthPercentage(value);
};
var borderColorForSide = function (side) {
  return {
    name: "border-" + side + "-color",
    initialValue: 'transparent',
    prefix: false,
    type: 3 /* TYPE_VALUE */,
    format: 'color'
  };
};
var borderTopColor = borderColorForSide('top');
var borderRightColor = borderColorForSide('right');
var borderBottomColor = borderColorForSide('bottom');
var borderLeftColor = borderColorForSide('left');
var borderRadiusForSide = function (side) {
  return {
    name: "border-radius-" + side,
    initialValue: '0 0',
    prefix: false,
    type: 1 /* LIST */,
    parse: function (_context, tokens) {
      return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));
    }
  };
};
var borderTopLeftRadius = borderRadiusForSide('top-left');
var borderTopRightRadius = borderRadiusForSide('top-right');
var borderBottomRightRadius = borderRadiusForSide('bottom-right');
var borderBottomLeftRadius = borderRadiusForSide('bottom-left');
var borderStyleForSide = function (side) {
  return {
    name: "border-" + side + "-style",
    initialValue: 'solid',
    prefix: false,
    type: 2 /* IDENT_VALUE */,
    parse: function (_context, style) {
      switch (style) {
        case 'none':
          return 0 /* NONE */;
        case 'dashed':
          return 2 /* DASHED */;
        case 'dotted':
          return 3 /* DOTTED */;
        case 'double':
          return 4 /* DOUBLE */;
      }
      return 1 /* SOLID */;
    }
  };
};
var borderTopStyle = borderStyleForSide('top');
var borderRightStyle = borderStyleForSide('right');
var borderBottomStyle = borderStyleForSide('bottom');
var borderLeftStyle = borderStyleForSide('left');
var borderWidthForSide = function (side) {
  return {
    name: "border-" + side + "-width",
    initialValue: '0',
    type: 0 /* VALUE */,
    prefix: false,
    parse: function (_context, token) {
      if (isDimensionToken(token)) {
        return token.number;
      }
      return 0;
    }
  };
};
var borderTopWidth = borderWidthForSide('top');
var borderRightWidth = borderWidthForSide('right');
var borderBottomWidth = borderWidthForSide('bottom');
var borderLeftWidth = borderWidthForSide('left');
var color$2 = {
  name: "color",
  initialValue: 'transparent',
  prefix: false,
  type: 3 /* TYPE_VALUE */,
  format: 'color'
};
var direction = {
  name: 'direction',
  initialValue: 'ltr',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, direction) {
    switch (direction) {
      case 'rtl':
        return 1 /* RTL */;
      case 'ltr':
      default:
        return 0 /* LTR */;
    }
  }
};
var display = {
  name: 'display',
  initialValue: 'inline-block',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    return tokens.filter(isIdentToken).reduce(function (bit, token) {
      return bit | parseDisplayValue(token.value);
    }, 0 /* NONE */);
  }
};
var parseDisplayValue = function (display) {
  switch (display) {
    case 'block':
    case '-webkit-box':
      return 2 /* BLOCK */;
    case 'inline':
      return 4 /* INLINE */;
    case 'run-in':
      return 8 /* RUN_IN */;
    case 'flow':
      return 16 /* FLOW */;
    case 'flow-root':
      return 32 /* FLOW_ROOT */;
    case 'table':
      return 64 /* TABLE */;
    case 'flex':
    case '-webkit-flex':
      return 128 /* FLEX */;
    case 'grid':
    case '-ms-grid':
      return 256 /* GRID */;
    case 'ruby':
      return 512 /* RUBY */;
    case 'subgrid':
      return 1024 /* SUBGRID */;
    case 'list-item':
      return 2048 /* LIST_ITEM */;
    case 'table-row-group':
      return 4096 /* TABLE_ROW_GROUP */;
    case 'table-header-group':
      return 8192 /* TABLE_HEADER_GROUP */;
    case 'table-footer-group':
      return 16384 /* TABLE_FOOTER_GROUP */;
    case 'table-row':
      return 32768 /* TABLE_ROW */;
    case 'table-cell':
      return 65536 /* TABLE_CELL */;
    case 'table-column-group':
      return 131072 /* TABLE_COLUMN_GROUP */;
    case 'table-column':
      return 262144 /* TABLE_COLUMN */;
    case 'table-caption':
      return 524288 /* TABLE_CAPTION */;
    case 'ruby-base':
      return 1048576 /* RUBY_BASE */;
    case 'ruby-text':
      return 2097152 /* RUBY_TEXT */;
    case 'ruby-base-container':
      return 4194304 /* RUBY_BASE_CONTAINER */;
    case 'ruby-text-container':
      return 8388608 /* RUBY_TEXT_CONTAINER */;
    case 'contents':
      return 16777216 /* CONTENTS */;
    case 'inline-block':
      return 33554432 /* INLINE_BLOCK */;
    case 'inline-list-item':
      return 67108864 /* INLINE_LIST_ITEM */;
    case 'inline-table':
      return 134217728 /* INLINE_TABLE */;
    case 'inline-flex':
      return 268435456 /* INLINE_FLEX */;
    case 'inline-grid':
      return 536870912 /* INLINE_GRID */;
  }
  return 0 /* NONE */;
};
var float$1 = {
  name: 'float',
  initialValue: 'none',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, float) {
    switch (float) {
      case 'left':
        return 1 /* LEFT */;
      case 'right':
        return 2 /* RIGHT */;
      case 'inline-start':
        return 3 /* INLINE_START */;
      case 'inline-end':
        return 4 /* INLINE_END */;
    }
    return 0 /* NONE */;
  }
};
var letterSpacing = {
  name: 'letter-spacing',
  initialValue: '0',
  prefix: false,
  type: 0 /* VALUE */,
  parse: function (_context, token) {
    if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') {
      return 0;
    }
    if (token.type === 17 /* NUMBER_TOKEN */) {
      return token.number;
    }
    if (token.type === 15 /* DIMENSION_TOKEN */) {
      return token.number;
    }
    return 0;
  }
};
var LINE_BREAK;
(function (LINE_BREAK) {
  LINE_BREAK["NORMAL"] = "normal";
  LINE_BREAK["STRICT"] = "strict";
})(LINE_BREAK || (LINE_BREAK = {}));
var lineBreak = {
  name: 'line-break',
  initialValue: 'normal',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, lineBreak) {
    switch (lineBreak) {
      case 'strict':
        return LINE_BREAK.STRICT;
      case 'normal':
      default:
        return LINE_BREAK.NORMAL;
    }
  }
};
var lineHeight = {
  name: 'line-height',
  initialValue: 'normal',
  prefix: false,
  type: 4 /* TOKEN_VALUE */
};
var computeLineHeight = function (token, fontSize) {
  if (isIdentToken(token) && token.value === 'normal') {
    return 1.2 * fontSize;
  } else if (token.type === 17 /* NUMBER_TOKEN */) {
    return fontSize * token.number;
  } else if (isLengthPercentage(token)) {
    return getAbsoluteValue(token, fontSize);
  }
  return fontSize;
};
var listStyleImage = {
  name: 'list-style-image',
  initialValue: 'none',
  type: 0 /* VALUE */,
  prefix: false,
  parse: function (context, token) {
    if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
      return null;
    }
    return image.parse(context, token);
  }
};
var listStylePosition = {
  name: 'list-style-position',
  initialValue: 'outside',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, position) {
    switch (position) {
      case 'inside':
        return 0 /* INSIDE */;
      case 'outside':
      default:
        return 1 /* OUTSIDE */;
    }
  }
};
var listStyleType = {
  name: 'list-style-type',
  initialValue: 'none',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, type) {
    switch (type) {
      case 'disc':
        return 0 /* DISC */;
      case 'circle':
        return 1 /* CIRCLE */;
      case 'square':
        return 2 /* SQUARE */;
      case 'decimal':
        return 3 /* DECIMAL */;
      case 'cjk-decimal':
        return 4 /* CJK_DECIMAL */;
      case 'decimal-leading-zero':
        return 5 /* DECIMAL_LEADING_ZERO */;
      case 'lower-roman':
        return 6 /* LOWER_ROMAN */;
      case 'upper-roman':
        return 7 /* UPPER_ROMAN */;
      case 'lower-greek':
        return 8 /* LOWER_GREEK */;
      case 'lower-alpha':
        return 9 /* LOWER_ALPHA */;
      case 'upper-alpha':
        return 10 /* UPPER_ALPHA */;
      case 'arabic-indic':
        return 11 /* ARABIC_INDIC */;
      case 'armenian':
        return 12 /* ARMENIAN */;
      case 'bengali':
        return 13 /* BENGALI */;
      case 'cambodian':
        return 14 /* CAMBODIAN */;
      case 'cjk-earthly-branch':
        return 15 /* CJK_EARTHLY_BRANCH */;
      case 'cjk-heavenly-stem':
        return 16 /* CJK_HEAVENLY_STEM */;
      case 'cjk-ideographic':
        return 17 /* CJK_IDEOGRAPHIC */;
      case 'devanagari':
        return 18 /* DEVANAGARI */;
      case 'ethiopic-numeric':
        return 19 /* ETHIOPIC_NUMERIC */;
      case 'georgian':
        return 20 /* GEORGIAN */;
      case 'gujarati':
        return 21 /* GUJARATI */;
      case 'gurmukhi':
        return 22 /* GURMUKHI */;
      case 'hebrew':
        return 22 /* HEBREW */;
      case 'hiragana':
        return 23 /* HIRAGANA */;
      case 'hiragana-iroha':
        return 24 /* HIRAGANA_IROHA */;
      case 'japanese-formal':
        return 25 /* JAPANESE_FORMAL */;
      case 'japanese-informal':
        return 26 /* JAPANESE_INFORMAL */;
      case 'kannada':
        return 27 /* KANNADA */;
      case 'katakana':
        return 28 /* KATAKANA */;
      case 'katakana-iroha':
        return 29 /* KATAKANA_IROHA */;
      case 'khmer':
        return 30 /* KHMER */;
      case 'korean-hangul-formal':
        return 31 /* KOREAN_HANGUL_FORMAL */;
      case 'korean-hanja-formal':
        return 32 /* KOREAN_HANJA_FORMAL */;
      case 'korean-hanja-informal':
        return 33 /* KOREAN_HANJA_INFORMAL */;
      case 'lao':
        return 34 /* LAO */;
      case 'lower-armenian':
        return 35 /* LOWER_ARMENIAN */;
      case 'malayalam':
        return 36 /* MALAYALAM */;
      case 'mongolian':
        return 37 /* MONGOLIAN */;
      case 'myanmar':
        return 38 /* MYANMAR */;
      case 'oriya':
        return 39 /* ORIYA */;
      case 'persian':
        return 40 /* PERSIAN */;
      case 'simp-chinese-formal':
        return 41 /* SIMP_CHINESE_FORMAL */;
      case 'simp-chinese-informal':
        return 42 /* SIMP_CHINESE_INFORMAL */;
      case 'tamil':
        return 43 /* TAMIL */;
      case 'telugu':
        return 44 /* TELUGU */;
      case 'thai':
        return 45 /* THAI */;
      case 'tibetan':
        return 46 /* TIBETAN */;
      case 'trad-chinese-formal':
        return 47 /* TRAD_CHINESE_FORMAL */;
      case 'trad-chinese-informal':
        return 48 /* TRAD_CHINESE_INFORMAL */;
      case 'upper-armenian':
        return 49 /* UPPER_ARMENIAN */;
      case 'disclosure-open':
        return 50 /* DISCLOSURE_OPEN */;
      case 'disclosure-closed':
        return 51 /* DISCLOSURE_CLOSED */;
      case 'none':
      default:
        return -1 /* NONE */;
    }
  }
};
var marginForSide = function (side) {
  return {
    name: "margin-" + side,
    initialValue: '0',
    prefix: false,
    type: 4 /* TOKEN_VALUE */
  };
};
var marginTop = marginForSide('top');
var marginRight = marginForSide('right');
var marginBottom = marginForSide('bottom');
var marginLeft = marginForSide('left');
var overflow = {
  name: 'overflow',
  initialValue: 'visible',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    return tokens.filter(isIdentToken).map(function (overflow) {
      switch (overflow.value) {
        case 'hidden':
          return 1 /* HIDDEN */;
        case 'scroll':
          return 2 /* SCROLL */;
        case 'clip':
          return 3 /* CLIP */;
        case 'auto':
          return 4 /* AUTO */;
        case 'visible':
        default:
          return 0 /* VISIBLE */;
      }
    });
  }
};
var overflowWrap = {
  name: 'overflow-wrap',
  initialValue: 'normal',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, overflow) {
    switch (overflow) {
      case 'break-word':
        return "break-word" /* BREAK_WORD */;
      case 'normal':
      default:
        return "normal" /* NORMAL */;
    }
  }
};
var paddingForSide = function (side) {
  return {
    name: "padding-" + side,
    initialValue: '0',
    prefix: false,
    type: 3 /* TYPE_VALUE */,
    format: 'length-percentage'
  };
};
var paddingTop = paddingForSide('top');
var paddingRight = paddingForSide('right');
var paddingBottom = paddingForSide('bottom');
var paddingLeft = paddingForSide('left');
var textAlign = {
  name: 'text-align',
  initialValue: 'left',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, textAlign) {
    switch (textAlign) {
      case 'right':
        return 2 /* RIGHT */;
      case 'center':
      case 'justify':
        return 1 /* CENTER */;
      case 'left':
      default:
        return 0 /* LEFT */;
    }
  }
};
var position$1 = {
  name: 'position',
  initialValue: 'static',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, position) {
    switch (position) {
      case 'relative':
        return 1 /* RELATIVE */;
      case 'absolute':
        return 2 /* ABSOLUTE */;
      case 'fixed':
        return 3 /* FIXED */;
      case 'sticky':
        return 4 /* STICKY */;
    }
    return 0 /* STATIC */;
  }
};
var textShadow = {
  name: 'text-shadow',
  initialValue: 'none',
  type: 1 /* LIST */,
  prefix: false,
  parse: function (context, tokens) {
    if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
      return [];
    }
    return parseFunctionArgs(tokens).map(function (values) {
      var shadow = {
        color: COLORS.TRANSPARENT,
        offsetX: ZERO_LENGTH,
        offsetY: ZERO_LENGTH,
        blur: ZERO_LENGTH
      };
      var c = 0;
      for (var i = 0; i < values.length; i++) {
        var token = values[i];
        if (isLength(token)) {
          if (c === 0) {
            shadow.offsetX = token;
          } else if (c === 1) {
            shadow.offsetY = token;
          } else {
            shadow.blur = token;
          }
          c++;
        } else {
          shadow.color = color$1.parse(context, token);
        }
      }
      return shadow;
    });
  }
};
var textTransform = {
  name: 'text-transform',
  initialValue: 'none',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, textTransform) {
    switch (textTransform) {
      case 'uppercase':
        return 2 /* UPPERCASE */;
      case 'lowercase':
        return 1 /* LOWERCASE */;
      case 'capitalize':
        return 3 /* CAPITALIZE */;
    }
    return 0 /* NONE */;
  }
};
var transform$1 = {
  name: 'transform',
  initialValue: 'none',
  prefix: true,
  type: 0 /* VALUE */,
  parse: function (_context, token) {
    if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
      return null;
    }
    if (token.type === 18 /* FUNCTION */) {
      var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
      if (typeof transformFunction === 'undefined') {
        throw new Error("Attempting to parse an unsupported transform function \"" + token.name + "\"");
      }
      return transformFunction(token.values);
    }
    return null;
  }
};
var matrix = function (args) {
  var values = args.filter(function (arg) {
    return arg.type === 17 /* NUMBER_TOKEN */;
  }).map(function (arg) {
    return arg.number;
  });
  return values.length === 6 ? values : null;
};
// doesn't support 3D transforms at the moment
var matrix3d = function (args) {
  var values = args.filter(function (arg) {
    return arg.type === 17 /* NUMBER_TOKEN */;
  }).map(function (arg) {
    return arg.number;
  });
  var a1 = values[0],
    b1 = values[1];
  values[2];
  values[3];
  var a2 = values[4],
    b2 = values[5];
  values[6];
  values[7];
  values[8];
  values[9];
  values[10];
  values[11];
  var a4 = values[12],
    b4 = values[13];
  values[14];
  values[15];
  return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
};
var SUPPORTED_TRANSFORM_FUNCTIONS = {
  matrix: matrix,
  matrix3d: matrix3d
};
var DEFAULT_VALUE = {
  type: 16 /* PERCENTAGE_TOKEN */,
  number: 50,
  flags: FLAG_INTEGER
};
var DEFAULT = [DEFAULT_VALUE, DEFAULT_VALUE];
var transformOrigin = {
  name: 'transform-origin',
  initialValue: '50% 50%',
  prefix: true,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    var origins = tokens.filter(isLengthPercentage);
    if (origins.length !== 2) {
      return DEFAULT;
    }
    return [origins[0], origins[1]];
  }
};
var visibility = {
  name: 'visible',
  initialValue: 'none',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, visibility) {
    switch (visibility) {
      case 'hidden':
        return 1 /* HIDDEN */;
      case 'collapse':
        return 2 /* COLLAPSE */;
      case 'visible':
      default:
        return 0 /* VISIBLE */;
    }
  }
};
var WORD_BREAK;
(function (WORD_BREAK) {
  WORD_BREAK["NORMAL"] = "normal";
  WORD_BREAK["BREAK_ALL"] = "break-all";
  WORD_BREAK["KEEP_ALL"] = "keep-all";
})(WORD_BREAK || (WORD_BREAK = {}));
var wordBreak = {
  name: 'word-break',
  initialValue: 'normal',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, wordBreak) {
    switch (wordBreak) {
      case 'break-all':
        return WORD_BREAK.BREAK_ALL;
      case 'keep-all':
        return WORD_BREAK.KEEP_ALL;
      case 'normal':
      default:
        return WORD_BREAK.NORMAL;
    }
  }
};
var zIndex = {
  name: 'z-index',
  initialValue: 'auto',
  prefix: false,
  type: 0 /* VALUE */,
  parse: function (_context, token) {
    if (token.type === 20 /* IDENT_TOKEN */) {
      return {
        auto: true,
        order: 0
      };
    }
    if (isNumberToken(token)) {
      return {
        auto: false,
        order: token.number
      };
    }
    throw new Error("Invalid z-index number parsed");
  }
};
var time = {
  name: 'time',
  parse: function (_context, value) {
    if (value.type === 15 /* DIMENSION_TOKEN */) {
      switch (value.unit.toLowerCase()) {
        case 's':
          return 1000 * value.number;
        case 'ms':
          return value.number;
      }
    }
    throw new Error("Unsupported time type");
  }
};
var opacity = {
  name: 'opacity',
  initialValue: '1',
  type: 0 /* VALUE */,
  prefix: false,
  parse: function (_context, token) {
    if (isNumberToken(token)) {
      return token.number;
    }
    return 1;
  }
};
var textDecorationColor = {
  name: "text-decoration-color",
  initialValue: 'transparent',
  prefix: false,
  type: 3 /* TYPE_VALUE */,
  format: 'color'
};
var textDecorationLine = {
  name: 'text-decoration-line',
  initialValue: 'none',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    return tokens.filter(isIdentToken).map(function (token) {
      switch (token.value) {
        case 'underline':
          return 1 /* UNDERLINE */;
        case 'overline':
          return 2 /* OVERLINE */;
        case 'line-through':
          return 3 /* LINE_THROUGH */;
        case 'none':
          return 4 /* BLINK */;
      }
      return 0 /* NONE */;
    }).filter(function (line) {
      return line !== 0 /* NONE */;
    });
  }
};
var fontFamily = {
  name: "font-family",
  initialValue: '',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    var accumulator = [];
    var results = [];
    tokens.forEach(function (token) {
      switch (token.type) {
        case 20 /* IDENT_TOKEN */:
        case 0 /* STRING_TOKEN */:
          accumulator.push(token.value);
          break;
        case 17 /* NUMBER_TOKEN */:
          accumulator.push(token.number.toString());
          break;
        case 4 /* COMMA_TOKEN */:
          results.push(accumulator.join(' '));
          accumulator.length = 0;
          break;
      }
    });
    if (accumulator.length) {
      results.push(accumulator.join(' '));
    }
    return results.map(function (result) {
      return result.indexOf(' ') === -1 ? result : "'" + result + "'";
    });
  }
};
var fontSize = {
  name: "font-size",
  initialValue: '0',
  prefix: false,
  type: 3 /* TYPE_VALUE */,
  format: 'length'
};
var fontWeight = {
  name: 'font-weight',
  initialValue: 'normal',
  type: 0 /* VALUE */,
  prefix: false,
  parse: function (_context, token) {
    if (isNumberToken(token)) {
      return token.number;
    }
    if (isIdentToken(token)) {
      switch (token.value) {
        case 'bold':
          return 700;
        case 'normal':
        default:
          return 400;
      }
    }
    return 400;
  }
};
var fontVariant = {
  name: 'font-variant',
  initialValue: 'none',
  type: 1 /* LIST */,
  prefix: false,
  parse: function (_context, tokens) {
    return tokens.filter(isIdentToken).map(function (token) {
      return token.value;
    });
  }
};
var fontStyle = {
  name: 'font-style',
  initialValue: 'normal',
  prefix: false,
  type: 2 /* IDENT_VALUE */,
  parse: function (_context, overflow) {
    switch (overflow) {
      case 'oblique':
        return "oblique" /* OBLIQUE */;
      case 'italic':
        return "italic" /* ITALIC */;
      case 'normal':
      default:
        return "normal" /* NORMAL */;
    }
  }
};
var contains = function (bit, value) {
  return (bit & value) !== 0;
};
var content = {
  name: 'content',
  initialValue: 'none',
  type: 1 /* LIST */,
  prefix: false,
  parse: function (_context, tokens) {
    if (tokens.length === 0) {
      return [];
    }
    var first = tokens[0];
    if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
      return [];
    }
    return tokens;
  }
};
var counterIncrement = {
  name: 'counter-increment',
  initialValue: 'none',
  prefix: true,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    if (tokens.length === 0) {
      return null;
    }
    var first = tokens[0];
    if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
      return null;
    }
    var increments = [];
    var filtered = tokens.filter(nonWhiteSpace);
    for (var i = 0; i < filtered.length; i++) {
      var counter = filtered[i];
      var next = filtered[i + 1];
      if (counter.type === 20 /* IDENT_TOKEN */) {
        var increment = next && isNumberToken(next) ? next.number : 1;
        increments.push({
          counter: counter.value,
          increment: increment
        });
      }
    }
    return increments;
  }
};
var counterReset = {
  name: 'counter-reset',
  initialValue: 'none',
  prefix: true,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    if (tokens.length === 0) {
      return [];
    }
    var resets = [];
    var filtered = tokens.filter(nonWhiteSpace);
    for (var i = 0; i < filtered.length; i++) {
      var counter = filtered[i];
      var next = filtered[i + 1];
      if (isIdentToken(counter) && counter.value !== 'none') {
        var reset = next && isNumberToken(next) ? next.number : 0;
        resets.push({
          counter: counter.value,
          reset: reset
        });
      }
    }
    return resets;
  }
};
var duration = {
  name: 'duration',
  initialValue: '0s',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (context, tokens) {
    return tokens.filter(isDimensionToken).map(function (token) {
      return time.parse(context, token);
    });
  }
};
var quotes = {
  name: 'quotes',
  initialValue: 'none',
  prefix: true,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    if (tokens.length === 0) {
      return null;
    }
    var first = tokens[0];
    if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
      return null;
    }
    var quotes = [];
    var filtered = tokens.filter(isStringToken);
    if (filtered.length % 2 !== 0) {
      return null;
    }
    for (var i = 0; i < filtered.length; i += 2) {
      var open_1 = filtered[i].value;
      var close_1 = filtered[i + 1].value;
      quotes.push({
        open: open_1,
        close: close_1
      });
    }
    return quotes;
  }
};
var getQuote = function (quotes, depth, open) {
  if (!quotes) {
    return '';
  }
  var quote = quotes[Math.min(depth, quotes.length - 1)];
  if (!quote) {
    return '';
  }
  return open ? quote.open : quote.close;
};
var boxShadow = {
  name: 'box-shadow',
  initialValue: 'none',
  type: 1 /* LIST */,
  prefix: false,
  parse: function (context, tokens) {
    if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
      return [];
    }
    return parseFunctionArgs(tokens).map(function (values) {
      var shadow = {
        color: 0x000000ff,
        offsetX: ZERO_LENGTH,
        offsetY: ZERO_LENGTH,
        blur: ZERO_LENGTH,
        spread: ZERO_LENGTH,
        inset: false
      };
      var c = 0;
      for (var i = 0; i < values.length; i++) {
        var token = values[i];
        if (isIdentWithValue(token, 'inset')) {
          shadow.inset = true;
        } else if (isLength(token)) {
          if (c === 0) {
            shadow.offsetX = token;
          } else if (c === 1) {
            shadow.offsetY = token;
          } else if (c === 2) {
            shadow.blur = token;
          } else {
            shadow.spread = token;
          }
          c++;
        } else {
          shadow.color = color$1.parse(context, token);
        }
      }
      return shadow;
    });
  }
};
var paintOrder = {
  name: 'paint-order',
  initialValue: 'normal',
  prefix: false,
  type: 1 /* LIST */,
  parse: function (_context, tokens) {
    var DEFAULT_VALUE = [0 /* FILL */, 1 /* STROKE */, 2 /* MARKERS */];
    var layers = [];
    tokens.filter(isIdentToken).forEach(function (token) {
      switch (token.value) {
        case 'stroke':
          layers.push(1 /* STROKE */);
          break;
        case 'fill':
          layers.push(0 /* FILL */);
          break;
        case 'markers':
          layers.push(2 /* MARKERS */);
          break;
      }
    });
    DEFAULT_VALUE.forEach(function (value) {
      if (layers.indexOf(value) === -1) {
        layers.push(value);
      }
    });
    return layers;
  }
};
var webkitTextStrokeColor = {
  name: "-webkit-text-stroke-color",
  initialValue: 'currentcolor',
  prefix: false,
  type: 3 /* TYPE_VALUE */,
  format: 'color'
};
var webkitTextStrokeWidth = {
  name: "-webkit-text-stroke-width",
  initialValue: '0',
  type: 0 /* VALUE */,
  prefix: false,
  parse: function (_context, token) {
    if (isDimensionToken(token)) {
      return token.number;
    }
    return 0;
  }
};
var CSSParsedDeclaration = /** @class */function () {
  function CSSParsedDeclaration(context, declaration) {
    var _a, _b;
    this.animationDuration = parse$1(context, duration, declaration.animationDuration);
    this.backgroundClip = parse$1(context, backgroundClip, declaration.backgroundClip);
    this.backgroundColor = parse$1(context, backgroundColor$1, declaration.backgroundColor);
    this.backgroundImage = parse$1(context, backgroundImage, declaration.backgroundImage);
    this.backgroundOrigin = parse$1(context, backgroundOrigin, declaration.backgroundOrigin);
    this.backgroundPosition = parse$1(context, backgroundPosition, declaration.backgroundPosition);
    this.backgroundRepeat = parse$1(context, backgroundRepeat, declaration.backgroundRepeat);
    this.backgroundSize = parse$1(context, backgroundSize, declaration.backgroundSize);
    this.borderTopColor = parse$1(context, borderTopColor, declaration.borderTopColor);
    this.borderRightColor = parse$1(context, borderRightColor, declaration.borderRightColor);
    this.borderBottomColor = parse$1(context, borderBottomColor, declaration.borderBottomColor);
    this.borderLeftColor = parse$1(context, borderLeftColor, declaration.borderLeftColor);
    this.borderTopLeftRadius = parse$1(context, borderTopLeftRadius, declaration.borderTopLeftRadius);
    this.borderTopRightRadius = parse$1(context, borderTopRightRadius, declaration.borderTopRightRadius);
    this.borderBottomRightRadius = parse$1(context, borderBottomRightRadius, declaration.borderBottomRightRadius);
    this.borderBottomLeftRadius = parse$1(context, borderBottomLeftRadius, declaration.borderBottomLeftRadius);
    this.borderTopStyle = parse$1(context, borderTopStyle, declaration.borderTopStyle);
    this.borderRightStyle = parse$1(context, borderRightStyle, declaration.borderRightStyle);
    this.borderBottomStyle = parse$1(context, borderBottomStyle, declaration.borderBottomStyle);
    this.borderLeftStyle = parse$1(context, borderLeftStyle, declaration.borderLeftStyle);
    this.borderTopWidth = parse$1(context, borderTopWidth, declaration.borderTopWidth);
    this.borderRightWidth = parse$1(context, borderRightWidth, declaration.borderRightWidth);
    this.borderBottomWidth = parse$1(context, borderBottomWidth, declaration.borderBottomWidth);
    this.borderLeftWidth = parse$1(context, borderLeftWidth, declaration.borderLeftWidth);
    this.boxShadow = parse$1(context, boxShadow, declaration.boxShadow);
    this.color = parse$1(context, color$2, declaration.color);
    this.direction = parse$1(context, direction, declaration.direction);
    this.display = parse$1(context, display, declaration.display);
    this.float = parse$1(context, float$1, declaration.cssFloat);
    this.fontFamily = parse$1(context, fontFamily, declaration.fontFamily);
    this.fontSize = parse$1(context, fontSize, declaration.fontSize);
    this.fontStyle = parse$1(context, fontStyle, declaration.fontStyle);
    this.fontVariant = parse$1(context, fontVariant, declaration.fontVariant);
    this.fontWeight = parse$1(context, fontWeight, declaration.fontWeight);
    this.letterSpacing = parse$1(context, letterSpacing, declaration.letterSpacing);
    this.lineBreak = parse$1(context, lineBreak, declaration.lineBreak);
    this.lineHeight = parse$1(context, lineHeight, declaration.lineHeight);
    this.listStyleImage = parse$1(context, listStyleImage, declaration.listStyleImage);
    this.listStylePosition = parse$1(context, listStylePosition, declaration.listStylePosition);
    this.listStyleType = parse$1(context, listStyleType, declaration.listStyleType);
    this.marginTop = parse$1(context, marginTop, declaration.marginTop);
    this.marginRight = parse$1(context, marginRight, declaration.marginRight);
    this.marginBottom = parse$1(context, marginBottom, declaration.marginBottom);
    this.marginLeft = parse$1(context, marginLeft, declaration.marginLeft);
    this.opacity = parse$1(context, opacity, declaration.opacity);
    var overflowTuple = parse$1(context, overflow, declaration.overflow);
    this.overflowX = overflowTuple[0];
    this.overflowY = overflowTuple[overflowTuple.length > 1 ? 1 : 0];
    this.overflowWrap = parse$1(context, overflowWrap, declaration.overflowWrap);
    this.paddingTop = parse$1(context, paddingTop, declaration.paddingTop);
    this.paddingRight = parse$1(context, paddingRight, declaration.paddingRight);
    this.paddingBottom = parse$1(context, paddingBottom, declaration.paddingBottom);
    this.paddingLeft = parse$1(context, paddingLeft, declaration.paddingLeft);
    this.paintOrder = parse$1(context, paintOrder, declaration.paintOrder);
    this.position = parse$1(context, position$1, declaration.position);
    this.textAlign = parse$1(context, textAlign, declaration.textAlign);
    this.textDecorationColor = parse$1(context, textDecorationColor, (_a = declaration.textDecorationColor) !== null && _a !== void 0 ? _a : declaration.color);
    this.textDecorationLine = parse$1(context, textDecorationLine, (_b = declaration.textDecorationLine) !== null && _b !== void 0 ? _b : declaration.textDecoration);
    this.textShadow = parse$1(context, textShadow, declaration.textShadow);
    this.textTransform = parse$1(context, textTransform, declaration.textTransform);
    this.transform = parse$1(context, transform$1, declaration.transform);
    this.transformOrigin = parse$1(context, transformOrigin, declaration.transformOrigin);
    this.visibility = parse$1(context, visibility, declaration.visibility);
    this.webkitTextStrokeColor = parse$1(context, webkitTextStrokeColor, declaration.webkitTextStrokeColor);
    this.webkitTextStrokeWidth = parse$1(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth);
    this.wordBreak = parse$1(context, wordBreak, declaration.wordBreak);
    this.zIndex = parse$1(context, zIndex, declaration.zIndex);
  }
  CSSParsedDeclaration.prototype.isVisible = function () {
    return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */;
  };
  CSSParsedDeclaration.prototype.isTransparent = function () {
    return isTransparent(this.backgroundColor);
  };
  CSSParsedDeclaration.prototype.isTransformed = function () {
    return this.transform !== null;
  };
  CSSParsedDeclaration.prototype.isPositioned = function () {
    return this.position !== 0 /* STATIC */;
  };
  CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () {
    return this.isPositioned() && !this.zIndex.auto;
  };
  CSSParsedDeclaration.prototype.isFloating = function () {
    return this.float !== 0 /* NONE */;
  };
  CSSParsedDeclaration.prototype.isInlineLevel = function () {
    return contains(this.display, 4 /* INLINE */) || contains(this.display, 33554432 /* INLINE_BLOCK */) || contains(this.display, 268435456 /* INLINE_FLEX */) || contains(this.display, 536870912 /* INLINE_GRID */) || contains(this.display, 67108864 /* INLINE_LIST_ITEM */) || contains(this.display, 134217728 /* INLINE_TABLE */);
  };
  return CSSParsedDeclaration;
}();
var CSSParsedPseudoDeclaration = /** @class */function () {
  function CSSParsedPseudoDeclaration(context, declaration) {
    this.content = parse$1(context, content, declaration.content);
    this.quotes = parse$1(context, quotes, declaration.quotes);
  }
  return CSSParsedPseudoDeclaration;
}();
var CSSParsedCounterDeclaration = /** @class */function () {
  function CSSParsedCounterDeclaration(context, declaration) {
    this.counterIncrement = parse$1(context, counterIncrement, declaration.counterIncrement);
    this.counterReset = parse$1(context, counterReset, declaration.counterReset);
  }
  return CSSParsedCounterDeclaration;
}();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var parse$1 = function (context, descriptor, style) {
  var tokenizer = new Tokenizer();
  var value = style !== null && typeof style !== 'undefined' ? style.toString() : descriptor.initialValue;
  tokenizer.write(value);
  var parser = new Parser(tokenizer.read());
  switch (descriptor.type) {
    case 2 /* IDENT_VALUE */:
      var token = parser.parseComponentValue();
      return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue);
    case 0 /* VALUE */:
      return descriptor.parse(context, parser.parseComponentValue());
    case 1 /* LIST */:
      return descriptor.parse(context, parser.parseComponentValues());
    case 4 /* TOKEN_VALUE */:
      return parser.parseComponentValue();
    case 3 /* TYPE_VALUE */:
      switch (descriptor.format) {
        case 'angle':
          return angle.parse(context, parser.parseComponentValue());
        case 'color':
          return color$1.parse(context, parser.parseComponentValue());
        case 'image':
          return image.parse(context, parser.parseComponentValue());
        case 'length':
          var length_1 = parser.parseComponentValue();
          return isLength(length_1) ? length_1 : ZERO_LENGTH;
        case 'length-percentage':
          var value_1 = parser.parseComponentValue();
          return isLengthPercentage(value_1) ? value_1 : ZERO_LENGTH;
        case 'time':
          return time.parse(context, parser.parseComponentValue());
      }
      break;
  }
};
var elementDebuggerAttribute = 'data-html2canvas-debug';
var getElementDebugType = function (element) {
  var attribute = element.getAttribute(elementDebuggerAttribute);
  switch (attribute) {
    case 'all':
      return 1 /* ALL */;
    case 'clone':
      return 2 /* CLONE */;
    case 'parse':
      return 3 /* PARSE */;
    case 'render':
      return 4 /* RENDER */;
    default:
      return 0 /* NONE */;
  }
};
var isDebugging = function (element, type) {
  var elementType = getElementDebugType(element);
  return elementType === 1 /* ALL */ || type === elementType;
};
var ElementContainer = /** @class */function () {
  function ElementContainer(context, element) {
    this.context = context;
    this.textNodes = [];
    this.elements = [];
    this.flags = 0;
    if (isDebugging(element, 3 /* PARSE */)) {
      debugger;
    }
    this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
    if (isHTMLElementNode(element)) {
      if (this.styles.animationDuration.some(function (duration) {
        return duration > 0;
      })) {
        element.style.animationDuration = '0s';
      }
      if (this.styles.transform !== null) {
        // getBoundingClientRect takes transforms into account
        element.style.transform = 'none';
      }
    }
    this.bounds = parseBounds(this.context, element);
    if (isDebugging(element, 4 /* RENDER */)) {
      this.flags |= 16 /* DEBUG_RENDER */;
    }
  }
  return ElementContainer;
}();

/*
 * text-segmentation 1.0.3 <https://github.com/niklasvh/text-segmentation>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
var base64 = '[encoded data, 26156 characters]';

/*
 * utrie 1.0.2 <https://github.com/niklasvh/utrie>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// Use a lookup table to find the index.
var lookup$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
for (var i$1$2 = 0; i$1$2 < chars$1.length; i$1$2++) {
  lookup$1[chars$1.charCodeAt(i$1$2)] = i$1$2;
}
var decode$2 = function (base64) {
  var bufferLength = base64.length * 0.75,
    len = base64.length,
    i,
    p = 0,
    encoded1,
    encoded2,
    encoded3,
    encoded4;
  if (base64[base64.length - 1] === '=') {
    bufferLength--;
    if (base64[base64.length - 2] === '=') {
      bufferLength--;
    }
  }
  var buffer = typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint8Array.prototype.slice !== 'undefined' ? new ArrayBuffer(bufferLength) : new Array(bufferLength);
  var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer);
  for (i = 0; i < len; i += 4) {
    encoded1 = lookup$1[base64.charCodeAt(i)];
    encoded2 = lookup$1[base64.charCodeAt(i + 1)];
    encoded3 = lookup$1[base64.charCodeAt(i + 2)];
    encoded4 = lookup$1[base64.charCodeAt(i + 3)];
    bytes[p++] = encoded1 << 2 | encoded2 >> 4;
    bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
    bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;
  }
  return buffer;
};
var polyUint16Array = function (buffer) {
  var length = buffer.length;
  var bytes = [];
  for (var i = 0; i < length; i += 2) {
    bytes.push(buffer[i + 1] << 8 | buffer[i]);
  }
  return bytes;
};
var polyUint32Array = function (buffer) {
  var length = buffer.length;
  var bytes = [];
  for (var i = 0; i < length; i += 4) {
    bytes.push(buffer[i + 3] << 24 | buffer[i + 2] << 16 | buffer[i + 1] << 8 | buffer[i]);
  }
  return bytes;
};

/** Shift size for getting the index-2 table offset. */
var UTRIE2_SHIFT_2 = 5;
/** Shift size for getting the index-1 table offset. */
var UTRIE2_SHIFT_1 = 6 + 5;
/**
 * Shift size for shifting left the index array values.
 * Increases possible data size with 16-bit index values at the cost
 * of compactability.
 * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY.
 */
var UTRIE2_INDEX_SHIFT = 2;
/**
 * Difference between the two shift sizes,
 * for getting an index-1 offset from an index-2 offset. 6=11-5
 */
var UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2;
/**
 * The part of the index-2 table for U+D800..U+DBFF stores values for
 * lead surrogate code _units_ not code _points_.
 * Values for lead surrogate code _points_ are indexed with this portion of the table.
 * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.)
 */
var UTRIE2_LSCP_INDEX_2_OFFSET = 0x10000 >> UTRIE2_SHIFT_2;
/** Number of entries in a data block. 32=0x20 */
var UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2;
/** Mask for getting the lower bits for the in-data-block offset. */
var UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1;
var UTRIE2_LSCP_INDEX_2_LENGTH = 0x400 >> UTRIE2_SHIFT_2;
/** Count the lengths of both BMP pieces. 2080=0x820 */
var UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH;
/**
 * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820.
 * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2.
 */
var UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH;
var UTRIE2_UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */
/**
 * The index-1 table, only used for supplementary code points, at offset 2112=0x840.
 * Variable length, for code points up to highStart, where the last single-value range starts.
 * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1.
 * (For 0x100000 supplementary code points U+10000..U+10ffff.)
 *
 * The part of the index-2 table for supplementary code points starts
 * after this index-1 table.
 *
 * Both the index-1 table and the following part of the index-2 table
 * are omitted completely if there is only BMP data.
 */
var UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH;
/**
 * Number of index-1 entries for the BMP. 32=0x20
 * This part of the index-1 table is omitted from the serialized form.
 */
var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UTRIE2_SHIFT_1;
/** Number of entries in an index-2 block. 64=0x40 */
var UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2;
/** Mask for getting the lower bits for the in-index-2-block offset. */
var UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1;
var slice16 = function (view, start, end) {
  if (view.slice) {
    return view.slice(start, end);
  }
  return new Uint16Array(Array.prototype.slice.call(view, start, end));
};
var slice32 = function (view, start, end) {
  if (view.slice) {
    return view.slice(start, end);
  }
  return new Uint32Array(Array.prototype.slice.call(view, start, end));
};
var createTrieFromBase64 = function (base64, _byteLength) {
  var buffer = decode$2(base64);
  var view32 = Array.isArray(buffer) ? polyUint32Array(buffer) : new Uint32Array(buffer);
  var view16 = Array.isArray(buffer) ? polyUint16Array(buffer) : new Uint16Array(buffer);
  var headerLength = 24;
  var index = slice16(view16, headerLength / 2, view32[4] / 2);
  var data = view32[5] === 2 ? slice16(view16, (headerLength + view32[4]) / 2) : slice32(view32, Math.ceil((headerLength + view32[4]) / 4));
  return new Trie(view32[0], view32[1], view32[2], view32[3], index, data);
};
var Trie = /** @class */function () {
  function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) {
    this.initialValue = initialValue;
    this.errorValue = errorValue;
    this.highStart = highStart;
    this.highValueIndex = highValueIndex;
    this.index = index;
    this.data = data;
  }
  /**
   * Get the value for a code point as stored in the Trie.
   *
   * @param codePoint the code point
   * @return the value
   */
  Trie.prototype.get = function (codePoint) {
    var ix;
    if (codePoint >= 0) {
      if (codePoint < 0x0d800 || codePoint > 0x0dbff && codePoint <= 0x0ffff) {
        // Ordinary BMP code point, excluding leading surrogates.
        // BMP uses a single level lookup.  BMP index starts at offset 0 in the Trie2 index.
        // 16 bit data is stored in the index array itself.
        ix = this.index[codePoint >> UTRIE2_SHIFT_2];
        ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
        return this.data[ix];
      }
      if (codePoint <= 0xffff) {
        // Lead Surrogate Code Point.  A Separate index section is stored for
        // lead surrogate code units and code points.
        //   The main index has the code unit data.
        //   For this function, we need the code point data.
        // Note: this expression could be refactored for slightly improved efficiency, but
        //       surrogate code points will be so rare in practice that it's not worth it.
        ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + (codePoint - 0xd800 >> UTRIE2_SHIFT_2)];
        ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
        return this.data[ix];
      }
      if (codePoint < this.highStart) {
        // Supplemental code point, use two-level lookup.
        ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1);
        ix = this.index[ix];
        ix += codePoint >> UTRIE2_SHIFT_2 & UTRIE2_INDEX_2_MASK;
        ix = this.index[ix];
        ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
        return this.data[ix];
      }
      if (codePoint <= 0x10ffff) {
        return this.data[this.highValueIndex];
      }
    }
    // Fall through.  The code point is outside of the legal range of 0..0x10ffff.
    return this.errorValue;
  };
  return Trie;
}();

/*
 * base64-arraybuffer 1.0.2 <https://github.com/niklasvh/base64-arraybuffer>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
// Use a lookup table to find the index.
var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
for (var i$4 = 0; i$4 < chars.length; i$4++) {
  lookup[chars.charCodeAt(i$4)] = i$4;
}
var Prepend = 1;
var CR = 2;
var LF = 3;
var Control = 4;
var Extend = 5;
var SpacingMark = 7;
var L = 8;
var V = 9;
var T = 10;
var LV = 11;
var LVT = 12;
var ZWJ = 13;
var Extended_Pictographic = 14;
var RI = 15;
var toCodePoints = function (str) {
  var codePoints = [];
  var i = 0;
  var length = str.length;
  while (i < length) {
    var value = str.charCodeAt(i++);
    if (value >= 0xd800 && value <= 0xdbff && i < length) {
      var extra = str.charCodeAt(i++);
      if ((extra & 0xfc00) === 0xdc00) {
        codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
      } else {
        codePoints.push(value);
        i--;
      }
    } else {
      codePoints.push(value);
    }
  }
  return codePoints;
};
var fromCodePoint = function () {
  var codePoints = [];
  for (var _i = 0; _i < arguments.length; _i++) {
    codePoints[_i] = arguments[_i];
  }
  if (String.fromCodePoint) {
    return String.fromCodePoint.apply(String, codePoints);
  }
  var length = codePoints.length;
  if (!length) {
    return '';
  }
  var codeUnits = [];
  var index = -1;
  var result = '';
  while (++index < length) {
    var codePoint = codePoints[index];
    if (codePoint <= 0xffff) {
      codeUnits.push(codePoint);
    } else {
      codePoint -= 0x10000;
      codeUnits.push((codePoint >> 10) + 0xd800, codePoint % 0x400 + 0xdc00);
    }
    if (index + 1 === length || codeUnits.length > 0x4000) {
      result += String.fromCharCode.apply(String, codeUnits);
      codeUnits.length = 0;
    }
  }
  return result;
};
var UnicodeTrie = createTrieFromBase64(base64);
var BREAK_NOT_ALLOWED = '×';
var BREAK_ALLOWED = '÷';
var codePointToClass = function (codePoint) {
  return UnicodeTrie.get(codePoint);
};
var _graphemeBreakAtIndex = function (_codePoints, classTypes, index) {
  var prevIndex = index - 2;
  var prev = classTypes[prevIndex];
  var current = classTypes[index - 1];
  var next = classTypes[index];
  // GB3 Do not break between a CR and LF
  if (current === CR && next === LF) {
    return BREAK_NOT_ALLOWED;
  }
  // GB4 Otherwise, break before and after controls.
  if (current === CR || current === LF || current === Control) {
    return BREAK_ALLOWED;
  }
  // GB5
  if (next === CR || next === LF || next === Control) {
    return BREAK_ALLOWED;
  }
  // Do not break Hangul syllable sequences.
  // GB6
  if (current === L && [L, V, LV, LVT].indexOf(next) !== -1) {
    return BREAK_NOT_ALLOWED;
  }
  // GB7
  if ((current === LV || current === V) && (next === V || next === T)) {
    return BREAK_NOT_ALLOWED;
  }
  // GB8
  if ((current === LVT || current === T) && next === T) {
    return BREAK_NOT_ALLOWED;
  }
  // GB9 Do not break before extending characters or ZWJ.
  if (next === ZWJ || next === Extend) {
    return BREAK_NOT_ALLOWED;
  }
  // Do not break before SpacingMarks, or after Prepend characters.
  // GB9a
  if (next === SpacingMark) {
    return BREAK_NOT_ALLOWED;
  }
  // GB9a
  if (current === Prepend) {
    return BREAK_NOT_ALLOWED;
  }
  // GB11 Do not break within emoji modifier sequences or emoji zwj sequences.
  if (current === ZWJ && next === Extended_Pictographic) {
    while (prev === Extend) {
      prev = classTypes[--prevIndex];
    }
    if (prev === Extended_Pictographic) {
      return BREAK_NOT_ALLOWED;
    }
  }
  // GB12 Do not break within emoji flag sequences.
  // That is, do not break between regional indicator (RI) symbols
  // if there is an odd number of RI characters before the break point.
  if (current === RI && next === RI) {
    var countRI = 0;
    while (prev === RI) {
      countRI++;
      prev = classTypes[--prevIndex];
    }
    if (countRI % 2 === 0) {
      return BREAK_NOT_ALLOWED;
    }
  }
  return BREAK_ALLOWED;
};
var GraphemeBreaker = function (str) {
  var codePoints = toCodePoints(str);
  var length = codePoints.length;
  var index = 0;
  var lastEnd = 0;
  var classTypes = codePoints.map(codePointToClass);
  return {
    next: function () {
      if (index >= length) {
        return {
          done: true,
          value: null
        };
      }
      var graphemeBreak = BREAK_NOT_ALLOWED;
      while (index < length && (graphemeBreak = _graphemeBreakAtIndex(codePoints, classTypes, ++index)) === BREAK_NOT_ALLOWED) {}
      if (graphemeBreak !== BREAK_NOT_ALLOWED || index === length) {
        var value = fromCodePoint.apply(null, codePoints.slice(lastEnd, index));
        lastEnd = index;
        return {
          value: value,
          done: false
        };
      }
      return {
        done: true,
        value: null
      };
    }
  };
};
var splitGraphemes = function (str) {
  var breaker = GraphemeBreaker(str);
  var graphemes = [];
  var bk;
  while (!(bk = breaker.next()).done) {
    if (bk.value) {
      graphemes.push(bk.value.slice());
    }
  }
  return graphemes;
};
var testRangeBounds = function (document) {
  var TEST_HEIGHT = 123;
  if (document.createRange) {
    var range = document.createRange();
    if (range.getBoundingClientRect) {
      var testElement = document.createElement('boundtest');
      testElement.style.height = TEST_HEIGHT + "px";
      testElement.style.display = 'block';
      document.body.appendChild(testElement);
      range.selectNode(testElement);
      var rangeBounds = range.getBoundingClientRect();
      var rangeHeight = Math.round(rangeBounds.height);
      document.body.removeChild(testElement);
      if (rangeHeight === TEST_HEIGHT) {
        return true;
      }
    }
  }
  return false;
};
var testIOSLineBreak = function (document) {
  var testElement = document.createElement('boundtest');
  testElement.style.width = '50px';
  testElement.style.display = 'block';
  testElement.style.fontSize = '12px';
  testElement.style.letterSpacing = '0px';
  testElement.style.wordSpacing = '0px';
  document.body.appendChild(testElement);
  var range = document.createRange();
  testElement.innerHTML = typeof ''.repeat === 'function' ? '&#128104;'.repeat(10) : '';
  var node = testElement.firstChild;
  var textList = toCodePoints$1(node.data).map(function (i) {
    return fromCodePoint$1(i);
  });
  var offset = 0;
  var prev = {};
  // ios 13 does not handle range getBoundingClientRect line changes correctly #2177
  var supports = textList.every(function (text, i) {
    range.setStart(node, offset);
    range.setEnd(node, offset + text.length);
    var rect = range.getBoundingClientRect();
    offset += text.length;
    var boundAhead = rect.x > prev.x || rect.y > prev.y;
    prev = rect;
    if (i === 0) {
      return true;
    }
    return boundAhead;
  });
  document.body.removeChild(testElement);
  return supports;
};
var testCORS = function () {
  return typeof new Image().crossOrigin !== 'undefined';
};
var testResponseType = function () {
  return typeof new XMLHttpRequest().responseType === 'string';
};
var testSVG = function (document) {
  var img = new Image();
  var canvas = document.createElement('canvas');
  var ctx = canvas.getContext('2d');
  if (!ctx) {
    return false;
  }
  img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
  try {
    ctx.drawImage(img, 0, 0);
    canvas.toDataURL();
  } catch (e) {
    return false;
  }
  return true;
};
var isGreenPixel = function (data) {
  return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255;
};
var testForeignObject = function (document) {
  var canvas = document.createElement('canvas');
  var size = 100;
  canvas.width = size;
  canvas.height = size;
  var ctx = canvas.getContext('2d');
  if (!ctx) {
    return Promise.reject(false);
  }
  ctx.fillStyle = 'rgb(0, 255, 0)';
  ctx.fillRect(0, 0, size, size);
  var img = new Image();
  var greenImageSrc = canvas.toDataURL();
  img.src = greenImageSrc;
  var svg = createForeignObjectSVG(size, size, 0, 0, img);
  ctx.fillStyle = 'red';
  ctx.fillRect(0, 0, size, size);
  return loadSerializedSVG$1(svg).then(function (img) {
    ctx.drawImage(img, 0, 0);
    var data = ctx.getImageData(0, 0, size, size).data;
    ctx.fillStyle = 'red';
    ctx.fillRect(0, 0, size, size);
    var node = document.createElement('div');
    node.style.backgroundImage = "url(" + greenImageSrc + ")";
    node.style.height = size + "px";
    // Firefox 55 does not render inline <img /> tags
    return isGreenPixel(data) ? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node)) : Promise.reject(false);
  }).then(function (img) {
    ctx.drawImage(img, 0, 0);
    // Edge does not render background-images
    return isGreenPixel(ctx.getImageData(0, 0, size, size).data);
  }).catch(function () {
    return false;
  });
};
var createForeignObjectSVG = function (width, height, x, y, node) {
  var xmlns = 'http://www.w3.org/2000/svg';
  var svg = document.createElementNS(xmlns, 'svg');
  var foreignObject = document.createElementNS(xmlns, 'foreignObject');
  svg.setAttributeNS(null, 'width', width.toString());
  svg.setAttributeNS(null, 'height', height.toString());
  foreignObject.setAttributeNS(null, 'width', '100%');
  foreignObject.setAttributeNS(null, 'height', '100%');
  foreignObject.setAttributeNS(null, 'x', x.toString());
  foreignObject.setAttributeNS(null, 'y', y.toString());
  foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true');
  svg.appendChild(foreignObject);
  foreignObject.appendChild(node);
  return svg;
};
var loadSerializedSVG$1 = function (svg) {
  return new Promise(function (resolve, reject) {
    var img = new Image();
    img.onload = function () {
      return resolve(img);
    };
    img.onerror = reject;
    img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
  });
};
var FEATURES = {
  get SUPPORT_RANGE_BOUNDS() {
    var value = testRangeBounds(document);
    Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', {
      value: value
    });
    return value;
  },
  get SUPPORT_WORD_BREAKING() {
    var value = FEATURES.SUPPORT_RANGE_BOUNDS && testIOSLineBreak(document);
    Object.defineProperty(FEATURES, 'SUPPORT_WORD_BREAKING', {
      value: value
    });
    return value;
  },
  get SUPPORT_SVG_DRAWING() {
    var value = testSVG(document);
    Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', {
      value: value
    });
    return value;
  },
  get SUPPORT_FOREIGNOBJECT_DRAWING() {
    var value = typeof Array.from === 'function' && typeof window.fetch === 'function' ? testForeignObject(document) : Promise.resolve(false);
    Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', {
      value: value
    });
    return value;
  },
  get SUPPORT_CORS_IMAGES() {
    var value = testCORS();
    Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', {
      value: value
    });
    return value;
  },
  get SUPPORT_RESPONSE_TYPE() {
    var value = testResponseType();
    Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', {
      value: value
    });
    return value;
  },
  get SUPPORT_CORS_XHR() {
    var value = 'withCredentials' in new XMLHttpRequest();
    Object.defineProperty(FEATURES, 'SUPPORT_CORS_XHR', {
      value: value
    });
    return value;
  },
  get SUPPORT_NATIVE_TEXT_SEGMENTATION() {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    var value = !!(typeof Intl !== 'undefined' && Intl.Segmenter);
    Object.defineProperty(FEATURES, 'SUPPORT_NATIVE_TEXT_SEGMENTATION', {
      value: value
    });
    return value;
  }
};
var TextBounds = /** @class */function () {
  function TextBounds(text, bounds) {
    this.text = text;
    this.bounds = bounds;
  }
  return TextBounds;
}();
var parseTextBounds = function (context, value, styles, node) {
  var textList = breakText(value, styles);
  var textBounds = [];
  var offset = 0;
  textList.forEach(function (text) {
    if (styles.textDecorationLine.length || text.trim().length > 0) {
      if (FEATURES.SUPPORT_RANGE_BOUNDS) {
        var clientRects = createRange(node, offset, text.length).getClientRects();
        if (clientRects.length > 1) {
          var subSegments = segmentGraphemes(text);
          var subOffset_1 = 0;
          subSegments.forEach(function (subSegment) {
            textBounds.push(new TextBounds(subSegment, Bounds.fromDOMRectList(context, createRange(node, subOffset_1 + offset, subSegment.length).getClientRects())));
            subOffset_1 += subSegment.length;
          });
        } else {
          textBounds.push(new TextBounds(text, Bounds.fromDOMRectList(context, clientRects)));
        }
      } else {
        var replacementNode = node.splitText(text.length);
        textBounds.push(new TextBounds(text, getWrapperBounds(context, node)));
        node = replacementNode;
      }
    } else if (!FEATURES.SUPPORT_RANGE_BOUNDS) {
      node = node.splitText(text.length);
    }
    offset += text.length;
  });
  return textBounds;
};
var getWrapperBounds = function (context, node) {
  var ownerDocument = node.ownerDocument;
  if (ownerDocument) {
    var wrapper = ownerDocument.createElement('html2canvaswrapper');
    wrapper.appendChild(node.cloneNode(true));
    var parentNode = node.parentNode;
    if (parentNode) {
      parentNode.replaceChild(wrapper, node);
      var bounds = parseBounds(context, wrapper);
      if (wrapper.firstChild) {
        parentNode.replaceChild(wrapper.firstChild, wrapper);
      }
      return bounds;
    }
  }
  return Bounds.EMPTY;
};
var createRange = function (node, offset, length) {
  var ownerDocument = node.ownerDocument;
  if (!ownerDocument) {
    throw new Error('Node has no owner document');
  }
  var range = ownerDocument.createRange();
  range.setStart(node, offset);
  range.setEnd(node, offset + length);
  return range;
};
var segmentGraphemes = function (value) {
  if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    var segmenter = new Intl.Segmenter(void 0, {
      granularity: 'grapheme'
    });
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    return Array.from(segmenter.segment(value)).map(function (segment) {
      return segment.segment;
    });
  }
  return splitGraphemes(value);
};
var segmentWords = function (value, styles) {
  if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    var segmenter = new Intl.Segmenter(void 0, {
      granularity: 'word'
    });
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    return Array.from(segmenter.segment(value)).map(function (segment) {
      return segment.segment;
    });
  }
  return breakWords(value, styles);
};
var breakText = function (value, styles) {
  return styles.letterSpacing !== 0 ? segmentGraphemes(value) : segmentWords(value, styles);
};
// https://drafts.csswg.org/css-text/#word-separator
var wordSeparators = [0x0020, 0x00a0, 0x1361, 0x10100, 0x10101, 0x1039, 0x1091];
var breakWords = function (str, styles) {
  var breaker = LineBreaker(str, {
    lineBreak: styles.lineBreak,
    wordBreak: styles.overflowWrap === "break-word" /* BREAK_WORD */ ? 'break-word' : styles.wordBreak
  });
  var words = [];
  var bk;
  var _loop_1 = function () {
    if (bk.value) {
      var value = bk.value.slice();
      var codePoints = toCodePoints$1(value);
      var word_1 = '';
      codePoints.forEach(function (codePoint) {
        if (wordSeparators.indexOf(codePoint) === -1) {
          word_1 += fromCodePoint$1(codePoint);
        } else {
          if (word_1.length) {
            words.push(word_1);
          }
          words.push(fromCodePoint$1(codePoint));
          word_1 = '';
        }
      });
      if (word_1.length) {
        words.push(word_1);
      }
    }
  };
  while (!(bk = breaker.next()).done) {
    _loop_1();
  }
  return words;
};
var TextContainer = /** @class */function () {
  function TextContainer(context, node, styles) {
    this.text = transform(node.data, styles.textTransform);
    this.textBounds = parseTextBounds(context, this.text, styles, node);
  }
  return TextContainer;
}();
var transform = function (text, transform) {
  switch (transform) {
    case 1 /* LOWERCASE */:
      return text.toLowerCase();
    case 3 /* CAPITALIZE */:
      return text.replace(CAPITALIZE, capitalize);
    case 2 /* UPPERCASE */:
      return text.toUpperCase();
    default:
      return text;
  }
};
var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g;
var capitalize = function (m, p1, p2) {
  if (m.length > 0) {
    return p1 + p2.toUpperCase();
  }
  return m;
};
var ImageElementContainer = /** @class */function (_super) {
  __extends$1(ImageElementContainer, _super);
  function ImageElementContainer(context, img) {
    var _this = _super.call(this, context, img) || this;
    _this.src = img.currentSrc || img.src;
    _this.intrinsicWidth = img.naturalWidth;
    _this.intrinsicHeight = img.naturalHeight;
    _this.context.cache.addImage(_this.src);
    return _this;
  }
  return ImageElementContainer;
}(ElementContainer);
var CanvasElementContainer = /** @class */function (_super) {
  __extends$1(CanvasElementContainer, _super);
  function CanvasElementContainer(context, canvas) {
    var _this = _super.call(this, context, canvas) || this;
    _this.canvas = canvas;
    _this.intrinsicWidth = canvas.width;
    _this.intrinsicHeight = canvas.height;
    return _this;
  }
  return CanvasElementContainer;
}(ElementContainer);
var SVGElementContainer = /** @class */function (_super) {
  __extends$1(SVGElementContainer, _super);
  function SVGElementContainer(context, img) {
    var _this = _super.call(this, context, img) || this;
    var s = new XMLSerializer();
    var bounds = parseBounds(context, img);
    img.setAttribute('width', bounds.width + "px");
    img.setAttribute('height', bounds.height + "px");
    _this.svg = "data:image/svg+xml," + encodeURIComponent(s.serializeToString(img));
    _this.intrinsicWidth = img.width.baseVal.value;
    _this.intrinsicHeight = img.height.baseVal.value;
    _this.context.cache.addImage(_this.svg);
    return _this;
  }
  return SVGElementContainer;
}(ElementContainer);
var LIElementContainer = /** @class */function (_super) {
  __extends$1(LIElementContainer, _super);
  function LIElementContainer(context, element) {
    var _this = _super.call(this, context, element) || this;
    _this.value = element.value;
    return _this;
  }
  return LIElementContainer;
}(ElementContainer);
var OLElementContainer = /** @class */function (_super) {
  __extends$1(OLElementContainer, _super);
  function OLElementContainer(context, element) {
    var _this = _super.call(this, context, element) || this;
    _this.start = element.start;
    _this.reversed = typeof element.reversed === 'boolean' && element.reversed === true;
    return _this;
  }
  return OLElementContainer;
}(ElementContainer);
var CHECKBOX_BORDER_RADIUS = [{
  type: 15 /* DIMENSION_TOKEN */,
  flags: 0,
  unit: 'px',
  number: 3
}];
var RADIO_BORDER_RADIUS = [{
  type: 16 /* PERCENTAGE_TOKEN */,
  flags: 0,
  number: 50
}];
var reformatInputBounds = function (bounds) {
  if (bounds.width > bounds.height) {
    return new Bounds(bounds.left + (bounds.width - bounds.height) / 2, bounds.top, bounds.height, bounds.height);
  } else if (bounds.width < bounds.height) {
    return new Bounds(bounds.left, bounds.top + (bounds.height - bounds.width) / 2, bounds.width, bounds.width);
  }
  return bounds;
};
var getInputValue = function (node) {
  var value = node.type === PASSWORD ? new Array(node.value.length + 1).join('\u2022') : node.value;
  return value.length === 0 ? node.placeholder || '' : value;
};
var CHECKBOX = 'checkbox';
var RADIO = 'radio';
var PASSWORD = 'password';
var INPUT_COLOR = 0x2a2a2aff;
var InputElementContainer = /** @class */function (_super) {
  __extends$1(InputElementContainer, _super);
  function InputElementContainer(context, input) {
    var _this = _super.call(this, context, input) || this;
    _this.type = input.type.toLowerCase();
    _this.checked = input.checked;
    _this.value = getInputValue(input);
    if (_this.type === CHECKBOX || _this.type === RADIO) {
      _this.styles.backgroundColor = 0xdededeff;
      _this.styles.borderTopColor = _this.styles.borderRightColor = _this.styles.borderBottomColor = _this.styles.borderLeftColor = 0xa5a5a5ff;
      _this.styles.borderTopWidth = _this.styles.borderRightWidth = _this.styles.borderBottomWidth = _this.styles.borderLeftWidth = 1;
      _this.styles.borderTopStyle = _this.styles.borderRightStyle = _this.styles.borderBottomStyle = _this.styles.borderLeftStyle = 1 /* SOLID */;
      _this.styles.backgroundClip = [0 /* BORDER_BOX */];
      _this.styles.backgroundOrigin = [0 /* BORDER_BOX */];
      _this.bounds = reformatInputBounds(_this.bounds);
    }
    switch (_this.type) {
      case CHECKBOX:
        _this.styles.borderTopRightRadius = _this.styles.borderTopLeftRadius = _this.styles.borderBottomRightRadius = _this.styles.borderBottomLeftRadius = CHECKBOX_BORDER_RADIUS;
        break;
      case RADIO:
        _this.styles.borderTopRightRadius = _this.styles.borderTopLeftRadius = _this.styles.borderBottomRightRadius = _this.styles.borderBottomLeftRadius = RADIO_BORDER_RADIUS;
        break;
    }
    return _this;
  }
  return InputElementContainer;
}(ElementContainer);
var SelectElementContainer = /** @class */function (_super) {
  __extends$1(SelectElementContainer, _super);
  function SelectElementContainer(context, element) {
    var _this = _super.call(this, context, element) || this;
    var option = element.options[element.selectedIndex || 0];
    _this.value = option ? option.text || '' : '';
    return _this;
  }
  return SelectElementContainer;
}(ElementContainer);
var TextareaElementContainer = /** @class */function (_super) {
  __extends$1(TextareaElementContainer, _super);
  function TextareaElementContainer(context, element) {
    var _this = _super.call(this, context, element) || this;
    _this.value = element.value;
    return _this;
  }
  return TextareaElementContainer;
}(ElementContainer);
var IFrameElementContainer = /** @class */function (_super) {
  __extends$1(IFrameElementContainer, _super);
  function IFrameElementContainer(context, iframe) {
    var _this = _super.call(this, context, iframe) || this;
    _this.src = iframe.src;
    _this.width = parseInt(iframe.width, 10) || 0;
    _this.height = parseInt(iframe.height, 10) || 0;
    _this.backgroundColor = _this.styles.backgroundColor;
    try {
      if (iframe.contentWindow && iframe.contentWindow.document && iframe.contentWindow.document.documentElement) {
        _this.tree = parseTree(context, iframe.contentWindow.document.documentElement);
        // http://www.w3.org/TR/css3-background/#special-backgrounds
        var documentBackgroundColor = iframe.contentWindow.document.documentElement ? parseColor(context, getComputedStyle(iframe.contentWindow.document.documentElement).backgroundColor) : COLORS.TRANSPARENT;
        var bodyBackgroundColor = iframe.contentWindow.document.body ? parseColor(context, getComputedStyle(iframe.contentWindow.document.body).backgroundColor) : COLORS.TRANSPARENT;
        _this.backgroundColor = isTransparent(documentBackgroundColor) ? isTransparent(bodyBackgroundColor) ? _this.styles.backgroundColor : bodyBackgroundColor : documentBackgroundColor;
      }
    } catch (e) {}
    return _this;
  }
  return IFrameElementContainer;
}(ElementContainer);
var LIST_OWNERS = ['OL', 'UL', 'MENU'];
var parseNodeTree = function (context, node, parent, root) {
  for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
    nextNode = childNode.nextSibling;
    if (isTextNode(childNode) && childNode.data.trim().length > 0) {
      parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
    } else if (isElementNode(childNode)) {
      if (isSlotElement(childNode) && childNode.assignedNodes) {
        childNode.assignedNodes().forEach(function (childNode) {
          return parseNodeTree(context, childNode, parent, root);
        });
      } else {
        var container = createContainer(context, childNode);
        if (container.styles.isVisible()) {
          if (createsRealStackingContext(childNode, container, root)) {
            container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
          } else if (createsStackingContext(container.styles)) {
            container.flags |= 2 /* CREATES_STACKING_CONTEXT */;
          }
          if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
            container.flags |= 8 /* IS_LIST_OWNER */;
          }
          parent.elements.push(container);
          childNode.slot;
          if (childNode.shadowRoot) {
            parseNodeTree(context, childNode.shadowRoot, container, root);
          } else if (!isTextareaElement(childNode) && !isSVGElement(childNode) && !isSelectElement(childNode)) {
            parseNodeTree(context, childNode, container, root);
          }
        }
      }
    }
  }
};
var createContainer = function (context, element) {
  if (isImageElement(element)) {
    return new ImageElementContainer(context, element);
  }
  if (isCanvasElement(element)) {
    return new CanvasElementContainer(context, element);
  }
  if (isSVGElement(element)) {
    return new SVGElementContainer(context, element);
  }
  if (isLIElement(element)) {
    return new LIElementContainer(context, element);
  }
  if (isOLElement(element)) {
    return new OLElementContainer(context, element);
  }
  if (isInputElement(element)) {
    return new InputElementContainer(context, element);
  }
  if (isSelectElement(element)) {
    return new SelectElementContainer(context, element);
  }
  if (isTextareaElement(element)) {
    return new TextareaElementContainer(context, element);
  }
  if (isIFrameElement(element)) {
    return new IFrameElementContainer(context, element);
  }
  return new ElementContainer(context, element);
};
var parseTree = function (context, element) {
  var container = createContainer(context, element);
  container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
  parseNodeTree(context, element, container, container);
  return container;
};
var createsRealStackingContext = function (node, container, root) {
  return container.styles.isPositionedWithZIndex() || container.styles.opacity < 1 || container.styles.isTransformed() || isBodyElement(node) && root.styles.isTransparent();
};
var createsStackingContext = function (styles) {
  return styles.isPositioned() || styles.isFloating();
};
var isTextNode = function (node) {
  return node.nodeType === Node.TEXT_NODE;
};
var isElementNode = function (node) {
  return node.nodeType === Node.ELEMENT_NODE;
};
var isHTMLElementNode = function (node) {
  return isElementNode(node) && typeof node.style !== 'undefined' && !isSVGElementNode(node);
};
var isSVGElementNode = function (element) {
  return typeof element.className === 'object';
};
var isLIElement = function (node) {
  return node.tagName === 'LI';
};
var isOLElement = function (node) {
  return node.tagName === 'OL';
};
var isInputElement = function (node) {
  return node.tagName === 'INPUT';
};
var isHTMLElement = function (node) {
  return node.tagName === 'HTML';
};
var isSVGElement = function (node) {
  return node.tagName === 'svg';
};
var isBodyElement = function (node) {
  return node.tagName === 'BODY';
};
var isCanvasElement = function (node) {
  return node.tagName === 'CANVAS';
};
var isVideoElement = function (node) {
  return node.tagName === 'VIDEO';
};
var isImageElement = function (node) {
  return node.tagName === 'IMG';
};
var isIFrameElement = function (node) {
  return node.tagName === 'IFRAME';
};
var isStyleElement = function (node) {
  return node.tagName === 'STYLE';
};
var isScriptElement = function (node) {
  return node.tagName === 'SCRIPT';
};
var isTextareaElement = function (node) {
  return node.tagName === 'TEXTAREA';
};
var isSelectElement = function (node) {
  return node.tagName === 'SELECT';
};
var isSlotElement = function (node) {
  return node.tagName === 'SLOT';
};
// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
var isCustomElement = function (node) {
  return node.tagName.indexOf('-') > 0;
};
var CounterState = /** @class */function () {
  function CounterState() {
    this.counters = {};
  }
  CounterState.prototype.getCounterValue = function (name) {
    var counter = this.counters[name];
    if (counter && counter.length) {
      return counter[counter.length - 1];
    }
    return 1;
  };
  CounterState.prototype.getCounterValues = function (name) {
    var counter = this.counters[name];
    return counter ? counter : [];
  };
  CounterState.prototype.pop = function (counters) {
    var _this = this;
    counters.forEach(function (counter) {
      return _this.counters[counter].pop();
    });
  };
  CounterState.prototype.parse = function (style) {
    var _this = this;
    var counterIncrement = style.counterIncrement;
    var counterReset = style.counterReset;
    var canReset = true;
    if (counterIncrement !== null) {
      counterIncrement.forEach(function (entry) {
        var counter = _this.counters[entry.counter];
        if (counter && entry.increment !== 0) {
          canReset = false;
          if (!counter.length) {
            counter.push(1);
          }
          counter[Math.max(0, counter.length - 1)] += entry.increment;
        }
      });
    }
    var counterNames = [];
    if (canReset) {
      counterReset.forEach(function (entry) {
        var counter = _this.counters[entry.counter];
        counterNames.push(entry.counter);
        if (!counter) {
          counter = _this.counters[entry.counter] = [];
        }
        counter.push(entry.reset);
      });
    }
    return counterNames;
  };
  return CounterState;
}();
var ROMAN_UPPER = {
  integers: [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
  values: ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
};
var ARMENIAN = {
  integers: [9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
  values: ['Ք', 'Փ', 'Ւ', 'Ց', 'Ր', 'Տ', 'Վ', 'Ս', 'Ռ', 'Ջ', 'Պ', 'Չ', 'Ո', 'Շ', 'Ն', 'Յ', 'Մ', 'Ճ', 'Ղ', 'Ձ', 'Հ', 'Կ', 'Ծ', 'Խ', 'Լ', 'Ի', 'Ժ', 'Թ', 'Ը', 'Է', 'Զ', 'Ե', 'Դ', 'Գ', 'Բ', 'Ա']
};
var HEBREW = {
  integers: [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 19, 18, 17, 16, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
  values: ['י׳', 'ט׳', 'ח׳', 'ז׳', 'ו׳', 'ה׳', 'ד׳', 'ג׳', 'ב׳', 'א׳', 'ת', 'ש', 'ר', 'ק', 'צ', 'פ', 'ע', 'ס', 'נ', 'מ', 'ל', 'כ', 'יט', 'יח', 'יז', 'טז', 'טו', 'י', 'ט', 'ח', 'ז', 'ו', 'ה', 'ד', 'ג', 'ב', 'א']
};
var GEORGIAN = {
  integers: [10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
  values: ['ჵ', 'ჰ', 'ჯ', 'ჴ', 'ხ', 'ჭ', 'წ', 'ძ', 'ც', 'ჩ', 'შ', 'ყ', 'ღ', 'ქ', 'ფ', 'ჳ', 'ტ', 'ს', 'რ', 'ჟ', 'პ', 'ო', 'ჲ', 'ნ', 'მ', 'ლ', 'კ', 'ი', 'თ', 'ჱ', 'ზ', 'ვ', 'ე', 'დ', 'გ', 'ბ', 'ა']
};
var createAdditiveCounter = function (value, min, max, symbols, fallback, suffix) {
  if (value < min || value > max) {
    return createCounterText(value, fallback, suffix.length > 0);
  }
  return symbols.integers.reduce(function (string, integer, index) {
    while (value >= integer) {
      value -= integer;
      string += symbols.values[index];
    }
    return string;
  }, '') + suffix;
};
var createCounterStyleWithSymbolResolver = function (value, codePointRangeLength, isNumeric, resolver) {
  var string = '';
  do {
    if (!isNumeric) {
      value--;
    }
    string = resolver(value) + string;
    value /= codePointRangeLength;
  } while (value * codePointRangeLength >= codePointRangeLength);
  return string;
};
var createCounterStyleFromRange = function (value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) {
  var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1;
  return (value < 0 ? '-' : '') + (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function (codePoint) {
    return fromCodePoint$1(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart);
  }) + suffix);
};
var createCounterStyleFromSymbols = function (value, symbols, suffix) {
  if (suffix === void 0) {
    suffix = '. ';
  }
  var codePointRangeLength = symbols.length;
  return createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function (codePoint) {
    return symbols[Math.floor(codePoint % codePointRangeLength)];
  }) + suffix;
};
var CJK_ZEROS = 1 << 0;
var CJK_TEN_COEFFICIENTS = 1 << 1;
var CJK_TEN_HIGH_COEFFICIENTS = 1 << 2;
var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) {
  if (value < -9999 || value > 9999) {
    return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0);
  }
  var tmp = Math.abs(value);
  var string = suffix;
  if (tmp === 0) {
    return numbers[0] + string;
  }
  for (var digit = 0; tmp > 0 && digit <= 4; digit++) {
    var coefficient = tmp % 10;
    if (coefficient === 0 && contains(flags, CJK_ZEROS) && string !== '') {
      string = numbers[coefficient] + string;
    } else if (coefficient > 1 || coefficient === 1 && digit === 0 || coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_COEFFICIENTS) || coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_HIGH_COEFFICIENTS) && value > 100 || coefficient === 1 && digit > 1 && contains(flags, CJK_HUNDRED_COEFFICIENTS)) {
      string = numbers[coefficient] + (digit > 0 ? multipliers[digit - 1] : '') + string;
    } else if (coefficient === 1 && digit > 0) {
      string = multipliers[digit - 1] + string;
    }
    tmp = Math.floor(tmp / 10);
  }
  return (value < 0 ? negativeSign : '') + string;
};
var CHINESE_INFORMAL_MULTIPLIERS = '十百千萬';
var CHINESE_FORMAL_MULTIPLIERS = '拾佰仟萬';
var JAPANESE_NEGATIVE = 'マイナス';
var KOREAN_NEGATIVE = '마이너스';
var createCounterText = function (value, type, appendSuffix) {
  var defaultSuffix = appendSuffix ? '. ' : '';
  var cjkSuffix = appendSuffix ? '、' : '';
  var koreanSuffix = appendSuffix ? ', ' : '';
  var spaceSuffix = appendSuffix ? ' ' : '';
  switch (type) {
    case 0 /* DISC */:
      return '•' + spaceSuffix;
    case 1 /* CIRCLE */:
      return '◦' + spaceSuffix;
    case 2 /* SQUARE */:
      return '◾' + spaceSuffix;
    case 5 /* DECIMAL_LEADING_ZERO */:
      var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
      return string.length < 4 ? "0" + string : string;
    case 4 /* CJK_DECIMAL */:
      return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
    case 6 /* LOWER_ROMAN */:
      return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
    case 7 /* UPPER_ROMAN */:
      return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix);
    case 8 /* LOWER_GREEK */:
      return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
    case 9 /* LOWER_ALPHA */:
      return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
    case 10 /* UPPER_ALPHA */:
      return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
    case 11 /* ARABIC_INDIC */:
      return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
    case 12 /* ARMENIAN */:
    case 49 /* UPPER_ARMENIAN */:
      return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix);
    case 35 /* LOWER_ARMENIAN */:
      return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
    case 13 /* BENGALI */:
      return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
    case 14 /* CAMBODIAN */:
    case 30 /* KHMER */:
      return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
    case 15 /* CJK_EARTHLY_BRANCH */:
      return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
    case 16 /* CJK_HEAVENLY_STEM */:
      return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
    case 17 /* CJK_IDEOGRAPHIC */:
    case 48 /* TRAD_CHINESE_INFORMAL */:
      return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
    case 47 /* TRAD_CHINESE_FORMAL */:
      return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
    case 42 /* SIMP_CHINESE_INFORMAL */:
      return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
    case 41 /* SIMP_CHINESE_FORMAL */:
      return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
    case 26 /* JAPANESE_INFORMAL */:
      return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
    case 25 /* JAPANESE_FORMAL */:
      return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
    case 31 /* KOREAN_HANGUL_FORMAL */:
      return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
    case 33 /* KOREAN_HANJA_INFORMAL */:
      return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
    case 32 /* KOREAN_HANJA_FORMAL */:
      return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
    case 18 /* DEVANAGARI */:
      return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
    case 20 /* GEORGIAN */:
      return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix);
    case 21 /* GUJARATI */:
      return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
    case 22 /* GURMUKHI */:
      return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
    case 22 /* HEBREW */:
      return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix);
    case 23 /* HIRAGANA */:
      return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
    case 24 /* HIRAGANA_IROHA */:
      return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
    case 27 /* KANNADA */:
      return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
    case 28 /* KATAKANA */:
      return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
    case 29 /* KATAKANA_IROHA */:
      return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
    case 34 /* LAO */:
      return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
    case 37 /* MONGOLIAN */:
      return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
    case 38 /* MYANMAR */:
      return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
    case 39 /* ORIYA */:
      return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
    case 40 /* PERSIAN */:
      return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
    case 43 /* TAMIL */:
      return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
    case 44 /* TELUGU */:
      return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
    case 45 /* THAI */:
      return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
    case 46 /* TIBETAN */:
      return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
    case 3 /* DECIMAL */:
    default:
      return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
  }
};
var IGNORE_ATTRIBUTE = 'data-html2canvas-ignore';
var DocumentCloner = /** @class */function () {
  function DocumentCloner(context, element, options) {
    this.context = context;
    this.options = options;
    this.scrolledElements = [];
    this.referenceElement = element;
    this.counters = new CounterState();
    this.quoteDepth = 0;
    if (!element.ownerDocument) {
      throw new Error('Cloned element does not have an owner document');
    }
    this.documentElement = this.cloneNode(element.ownerDocument.documentElement, false);
  }
  DocumentCloner.prototype.toIFrame = function (ownerDocument, windowSize) {
    var _this = this;
    var iframe = createIFrameContainer(ownerDocument, windowSize);
    if (!iframe.contentWindow) {
      return Promise.reject("Unable to find iframe window");
    }
    var scrollX = ownerDocument.defaultView.pageXOffset;
    var scrollY = ownerDocument.defaultView.pageYOffset;
    var cloneWindow = iframe.contentWindow;
    var documentClone = cloneWindow.document;
    /* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
     if window url is about:blank, we can assign the url to current by writing onto the document
     */
    var iframeLoad = iframeLoader(iframe).then(function () {
      return __awaiter(_this, void 0, void 0, function () {
        var onclone, referenceElement;
        return __generator(this, function (_a) {
          switch (_a.label) {
            case 0:
              this.scrolledElements.forEach(restoreNodeScroll);
              if (cloneWindow) {
                cloneWindow.scrollTo(windowSize.left, windowSize.top);
                if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (cloneWindow.scrollY !== windowSize.top || cloneWindow.scrollX !== windowSize.left)) {
                  this.context.logger.warn('Unable to restore scroll position for cloned document');
                  this.context.windowBounds = this.context.windowBounds.add(cloneWindow.scrollX - windowSize.left, cloneWindow.scrollY - windowSize.top, 0, 0);
                }
              }
              onclone = this.options.onclone;
              referenceElement = this.clonedReferenceElement;
              if (typeof referenceElement === 'undefined') {
                return [2 /*return*/, Promise.reject("Error finding the " + this.referenceElement.nodeName + " in the cloned document")];
              }
              if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2];
              return [4 /*yield*/, documentClone.fonts.ready];
            case 1:
              _a.sent();
              _a.label = 2;
            case 2:
              if (!/(AppleWebKit)/g.test(navigator.userAgent)) return [3 /*break*/, 4];
              return [4 /*yield*/, imagesReady(documentClone)];
            case 3:
              _a.sent();
              _a.label = 4;
            case 4:
              if (typeof onclone === 'function') {
                return [2 /*return*/, Promise.resolve().then(function () {
                  return onclone(documentClone, referenceElement);
                }).then(function () {
                  return iframe;
                })];
              }
              return [2 /*return*/, iframe];
          }
        });
      });
    });
    documentClone.open();
    documentClone.write(serializeDoctype(document.doctype) + "<html></html>");
    // Chrome scrolls the parent document for some reason after the write to the cloned window???
    restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
    documentClone.replaceChild(documentClone.adoptNode(this.documentElement), documentClone.documentElement);
    documentClone.close();
    return iframeLoad;
  };
  DocumentCloner.prototype.createElementClone = function (node) {
    if (isDebugging(node, 2 /* CLONE */)) {
      debugger;
    }
    if (isCanvasElement(node)) {
      return this.createCanvasClone(node);
    }
    if (isVideoElement(node)) {
      return this.createVideoClone(node);
    }
    if (isStyleElement(node)) {
      return this.createStyleClone(node);
    }
    var clone = node.cloneNode(false);
    if (isImageElement(clone)) {
      if (isImageElement(node) && node.currentSrc && node.currentSrc !== node.src) {
        clone.src = node.currentSrc;
        clone.srcset = '';
      }
      if (clone.loading === 'lazy') {
        clone.loading = 'eager';
      }
    }
    if (isCustomElement(clone)) {
      return this.createCustomElementClone(clone);
    }
    return clone;
  };
  DocumentCloner.prototype.createCustomElementClone = function (node) {
    var clone = document.createElement('html2canvascustomelement');
    copyCSSStyles(node.style, clone);
    return clone;
  };
  DocumentCloner.prototype.createStyleClone = function (node) {
    try {
      var sheet = node.sheet;
      if (sheet && sheet.cssRules) {
        var css = [].slice.call(sheet.cssRules, 0).reduce(function (css, rule) {
          if (rule && typeof rule.cssText === 'string') {
            return css + rule.cssText;
          }
          return css;
        }, '');
        var style = node.cloneNode(false);
        style.textContent = css;
        return style;
      }
    } catch (e) {
      // accessing node.sheet.cssRules throws a DOMException
      this.context.logger.error('Unable to access cssRules property', e);
      if (e.name !== 'SecurityError') {
        throw e;
      }
    }
    return node.cloneNode(false);
  };
  DocumentCloner.prototype.createCanvasClone = function (canvas) {
    var _a;
    if (this.options.inlineImages && canvas.ownerDocument) {
      var img = canvas.ownerDocument.createElement('img');
      try {
        img.src = canvas.toDataURL();
        return img;
      } catch (e) {
        this.context.logger.info("Unable to inline canvas contents, canvas is tainted", canvas);
      }
    }
    var clonedCanvas = canvas.cloneNode(false);
    try {
      clonedCanvas.width = canvas.width;
      clonedCanvas.height = canvas.height;
      var ctx = canvas.getContext('2d');
      var clonedCtx = clonedCanvas.getContext('2d');
      if (clonedCtx) {
        if (!this.options.allowTaint && ctx) {
          clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
        } else {
          var gl = (_a = canvas.getContext('webgl2')) !== null && _a !== void 0 ? _a : canvas.getContext('webgl');
          if (gl) {
            var attribs = gl.getContextAttributes();
            if ((attribs === null || attribs === void 0 ? void 0 : attribs.preserveDrawingBuffer) === false) {
              this.context.logger.warn('Unable to clone WebGL context as it has preserveDrawingBuffer=false', canvas);
            }
          }
          clonedCtx.drawImage(canvas, 0, 0);
        }
      }
      return clonedCanvas;
    } catch (e) {
      this.context.logger.info("Unable to clone canvas as it is tainted", canvas);
    }
    return clonedCanvas;
  };
  DocumentCloner.prototype.createVideoClone = function (video) {
    var canvas = video.ownerDocument.createElement('canvas');
    canvas.width = video.offsetWidth;
    canvas.height = video.offsetHeight;
    var ctx = canvas.getContext('2d');
    try {
      if (ctx) {
        ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
        if (!this.options.allowTaint) {
          ctx.getImageData(0, 0, canvas.width, canvas.height);
        }
      }
      return canvas;
    } catch (e) {
      this.context.logger.info("Unable to clone video as it is tainted", video);
    }
    var blankCanvas = video.ownerDocument.createElement('canvas');
    blankCanvas.width = video.offsetWidth;
    blankCanvas.height = video.offsetHeight;
    return blankCanvas;
  };
  DocumentCloner.prototype.appendChildNode = function (clone, child, copyStyles) {
    if (!isElementNode(child) || !isScriptElement(child) && !child.hasAttribute(IGNORE_ATTRIBUTE) && (typeof this.options.ignoreElements !== 'function' || !this.options.ignoreElements(child))) {
      if (!this.options.copyStyles || !isElementNode(child) || !isStyleElement(child)) {
        clone.appendChild(this.cloneNode(child, copyStyles));
      }
    }
  };
  DocumentCloner.prototype.cloneChildNodes = function (node, clone, copyStyles) {
    var _this = this;
    for (var child = node.shadowRoot ? node.shadowRoot.firstChild : node.firstChild; child; child = child.nextSibling) {
      if (isElementNode(child) && isSlotElement(child) && typeof child.assignedNodes === 'function') {
        var assignedNodes = child.assignedNodes();
        if (assignedNodes.length) {
          assignedNodes.forEach(function (assignedNode) {
            return _this.appendChildNode(clone, assignedNode, copyStyles);
          });
        }
      } else {
        this.appendChildNode(clone, child, copyStyles);
      }
    }
  };
  DocumentCloner.prototype.cloneNode = function (node, copyStyles) {
    if (isTextNode(node)) {
      return document.createTextNode(node.data);
    }
    if (!node.ownerDocument) {
      return node.cloneNode(false);
    }
    var window = node.ownerDocument.defaultView;
    if (window && isElementNode(node) && (isHTMLElementNode(node) || isSVGElementNode(node))) {
      var clone = this.createElementClone(node);
      clone.style.transitionProperty = 'none';
      var style = window.getComputedStyle(node);
      var styleBefore = window.getComputedStyle(node, ':before');
      var styleAfter = window.getComputedStyle(node, ':after');
      if (this.referenceElement === node && isHTMLElementNode(clone)) {
        this.clonedReferenceElement = clone;
      }
      if (isBodyElement(clone)) {
        createPseudoHideStyles(clone);
      }
      var counters = this.counters.parse(new CSSParsedCounterDeclaration(this.context, style));
      var before = this.resolvePseudoContent(node, clone, styleBefore, PseudoElementType.BEFORE);
      if (isCustomElement(node)) {
        copyStyles = true;
      }
      if (!isVideoElement(node)) {
        this.cloneChildNodes(node, clone, copyStyles);
      }
      if (before) {
        clone.insertBefore(before, clone.firstChild);
      }
      var after = this.resolvePseudoContent(node, clone, styleAfter, PseudoElementType.AFTER);
      if (after) {
        clone.appendChild(after);
      }
      this.counters.pop(counters);
      if (style && (this.options.copyStyles || isSVGElementNode(node)) && !isIFrameElement(node) || copyStyles) {
        copyCSSStyles(style, clone);
      }
      if (node.scrollTop !== 0 || node.scrollLeft !== 0) {
        this.scrolledElements.push([clone, node.scrollLeft, node.scrollTop]);
      }
      if ((isTextareaElement(node) || isSelectElement(node)) && (isTextareaElement(clone) || isSelectElement(clone))) {
        clone.value = node.value;
      }
      return clone;
    }
    return node.cloneNode(false);
  };
  DocumentCloner.prototype.resolvePseudoContent = function (node, clone, style, pseudoElt) {
    var _this = this;
    if (!style) {
      return;
    }
    var value = style.content;
    var document = clone.ownerDocument;
    if (!document || !value || value === 'none' || value === '-moz-alt-content' || style.display === 'none') {
      return;
    }
    this.counters.parse(new CSSParsedCounterDeclaration(this.context, style));
    var declaration = new CSSParsedPseudoDeclaration(this.context, style);
    var anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
    copyCSSStyles(style, anonymousReplacedElement);
    declaration.content.forEach(function (token) {
      if (token.type === 0 /* STRING_TOKEN */) {
        anonymousReplacedElement.appendChild(document.createTextNode(token.value));
      } else if (token.type === 22 /* URL_TOKEN */) {
        var img = document.createElement('img');
        img.src = token.value;
        img.style.opacity = '1';
        anonymousReplacedElement.appendChild(img);
      } else if (token.type === 18 /* FUNCTION */) {
        if (token.name === 'attr') {
          var attr = token.values.filter(isIdentToken);
          if (attr.length) {
            anonymousReplacedElement.appendChild(document.createTextNode(node.getAttribute(attr[0].value) || ''));
          }
        } else if (token.name === 'counter') {
          var _a = token.values.filter(nonFunctionArgSeparator),
            counter = _a[0],
            counterStyle = _a[1];
          if (counter && isIdentToken(counter)) {
            var counterState = _this.counters.getCounterValue(counter.value);
            var counterType = counterStyle && isIdentToken(counterStyle) ? listStyleType.parse(_this.context, counterStyle.value) : 3 /* DECIMAL */;
            anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false)));
          }
        } else if (token.name === 'counters') {
          var _b = token.values.filter(nonFunctionArgSeparator),
            counter = _b[0],
            delim = _b[1],
            counterStyle = _b[2];
          if (counter && isIdentToken(counter)) {
            var counterStates = _this.counters.getCounterValues(counter.value);
            var counterType_1 = counterStyle && isIdentToken(counterStyle) ? listStyleType.parse(_this.context, counterStyle.value) : 3 /* DECIMAL */;
            var separator = delim && delim.type === 0 /* STRING_TOKEN */ ? delim.value : '';
            var text = counterStates.map(function (value) {
              return createCounterText(value, counterType_1, false);
            }).join(separator);
            anonymousReplacedElement.appendChild(document.createTextNode(text));
          }
        } else ;
      } else if (token.type === 20 /* IDENT_TOKEN */) {
        switch (token.value) {
          case 'open-quote':
            anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true)));
            break;
          case 'close-quote':
            anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, --_this.quoteDepth, false)));
            break;
          default:
            // safari doesn't parse string tokens correctly because of lack of quotes
            anonymousReplacedElement.appendChild(document.createTextNode(token.value));
        }
      }
    });
    anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
    var newClassName = pseudoElt === PseudoElementType.BEFORE ? " " + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE : " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
    if (isSVGElementNode(clone)) {
      clone.className.baseValue += newClassName;
    } else {
      clone.className += newClassName;
    }
    return anonymousReplacedElement;
  };
  DocumentCloner.destroy = function (container) {
    if (container.parentNode) {
      container.parentNode.removeChild(container);
      return true;
    }
    return false;
  };
  return DocumentCloner;
}();
var PseudoElementType;
(function (PseudoElementType) {
  PseudoElementType[PseudoElementType["BEFORE"] = 0] = "BEFORE";
  PseudoElementType[PseudoElementType["AFTER"] = 1] = "AFTER";
})(PseudoElementType || (PseudoElementType = {}));
var createIFrameContainer = function (ownerDocument, bounds) {
  var cloneIframeContainer = ownerDocument.createElement('iframe');
  cloneIframeContainer.className = 'html2canvas-container';
  cloneIframeContainer.style.visibility = 'hidden';
  cloneIframeContainer.style.position = 'fixed';
  cloneIframeContainer.style.left = '-10000px';
  cloneIframeContainer.style.top = '0px';
  cloneIframeContainer.style.border = '0';
  cloneIframeContainer.width = bounds.width.toString();
  cloneIframeContainer.height = bounds.height.toString();
  cloneIframeContainer.scrolling = 'no'; // ios won't scroll without it
  cloneIframeContainer.setAttribute(IGNORE_ATTRIBUTE, 'true');
  ownerDocument.body.appendChild(cloneIframeContainer);
  return cloneIframeContainer;
};
var imageReady = function (img) {
  return new Promise(function (resolve) {
    if (img.complete) {
      resolve();
      return;
    }
    if (!img.src) {
      resolve();
      return;
    }
    img.onload = resolve;
    img.onerror = resolve;
  });
};
var imagesReady = function (document) {
  return Promise.all([].slice.call(document.images, 0).map(imageReady));
};
var iframeLoader = function (iframe) {
  return new Promise(function (resolve, reject) {
    var cloneWindow = iframe.contentWindow;
    if (!cloneWindow) {
      return reject("No window assigned for iframe");
    }
    var documentClone = cloneWindow.document;
    cloneWindow.onload = iframe.onload = function () {
      cloneWindow.onload = iframe.onload = null;
      var interval = setInterval(function () {
        if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
          clearInterval(interval);
          resolve(iframe);
        }
      }, 50);
    };
  });
};
var ignoredStyleProperties = ['all', 'd', 'content' // Safari shows pseudoelements if content is set
];
var copyCSSStyles = function (style, target) {
  // Edge does not provide value for cssText
  for (var i = style.length - 1; i >= 0; i--) {
    var property = style.item(i);
    if (ignoredStyleProperties.indexOf(property) === -1) {
      target.style.setProperty(property, style.getPropertyValue(property));
    }
  }
  return target;
};
var serializeDoctype = function (doctype) {
  var str = '';
  if (doctype) {
    str += '<!DOCTYPE ';
    if (doctype.name) {
      str += doctype.name;
    }
    if (doctype.internalSubset) {
      str += doctype.internalSubset;
    }
    if (doctype.publicId) {
      str += "\"" + doctype.publicId + "\"";
    }
    if (doctype.systemId) {
      str += "\"" + doctype.systemId + "\"";
    }
    str += '>';
  }
  return str;
};
var restoreOwnerScroll = function (ownerDocument, x, y) {
  if (ownerDocument && ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {
    ownerDocument.defaultView.scrollTo(x, y);
  }
};
var restoreNodeScroll = function (_a) {
  var element = _a[0],
    x = _a[1],
    y = _a[2];
  element.scrollLeft = x;
  element.scrollTop = y;
};
var PSEUDO_BEFORE = ':before';
var PSEUDO_AFTER = ':after';
var PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = '___html2canvas___pseudoelement_before';
var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
var PSEUDO_HIDE_ELEMENT_STYLE = "{\n    content: \"\" !important;\n    display: none !important;\n}";
var createPseudoHideStyles = function (body) {
  createStyles(body, "." + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + PSEUDO_BEFORE + PSEUDO_HIDE_ELEMENT_STYLE + "\n         ." + PSEUDO_HIDE_ELEMENT_CLASS_AFTER + PSEUDO_AFTER + PSEUDO_HIDE_ELEMENT_STYLE);
};
var createStyles = function (body, styles) {
  var document = body.ownerDocument;
  if (document) {
    var style = document.createElement('style');
    style.textContent = styles;
    body.appendChild(style);
  }
};
var CacheStorage = /** @class */function () {
  function CacheStorage() {}
  CacheStorage.getOrigin = function (url) {
    var link = CacheStorage._link;
    if (!link) {
      return 'about:blank';
    }
    link.href = url;
    link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
    return link.protocol + link.hostname + link.port;
  };
  CacheStorage.isSameOrigin = function (src) {
    return CacheStorage.getOrigin(src) === CacheStorage._origin;
  };
  CacheStorage.setContext = function (window) {
    CacheStorage._link = window.document.createElement('a');
    CacheStorage._origin = CacheStorage.getOrigin(window.location.href);
  };
  CacheStorage._origin = 'about:blank';
  return CacheStorage;
}();
var Cache$1 = /** @class */function () {
  function Cache(context, _options) {
    this.context = context;
    this._options = _options;
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    this._cache = {};
  }
  Cache.prototype.addImage = function (src) {
    var result = Promise.resolve();
    if (this.has(src)) {
      return result;
    }
    if (isBlobImage(src) || isRenderable(src)) {
      (this._cache[src] = this.loadImage(src)).catch(function () {
        // prevent unhandled rejection
      });
      return result;
    }
    return result;
  };
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  Cache.prototype.match = function (src) {
    return this._cache[src];
  };
  Cache.prototype.loadImage = function (key) {
    return __awaiter(this, void 0, void 0, function () {
      var isSameOrigin, useCORS, useProxy, src;
      var _this = this;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            isSameOrigin = CacheStorage.isSameOrigin(key);
            useCORS = !isInlineImage(key) && this._options.useCORS === true && FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin;
            useProxy = !isInlineImage(key) && !isSameOrigin && !isBlobImage(key) && typeof this._options.proxy === 'string' && FEATURES.SUPPORT_CORS_XHR && !useCORS;
            if (!isSameOrigin && this._options.allowTaint === false && !isInlineImage(key) && !isBlobImage(key) && !useProxy && !useCORS) {
              return [2 /*return*/];
            }
            src = key;
            if (!useProxy) return [3 /*break*/, 2];
            return [4 /*yield*/, this.proxy(src)];
          case 1:
            src = _a.sent();
            _a.label = 2;
          case 2:
            this.context.logger.debug("Added image " + key.substring(0, 256));
            return [4 /*yield*/, new Promise(function (resolve, reject) {
              var img = new Image();
              img.onload = function () {
                return resolve(img);
              };
              img.onerror = reject;
              //ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous
              if (isInlineBase64Image(src) || useCORS) {
                img.crossOrigin = 'anonymous';
              }
              img.src = src;
              if (img.complete === true) {
                // Inline XML images may fail to parse, throwing an Error later on
                setTimeout(function () {
                  return resolve(img);
                }, 500);
              }
              if (_this._options.imageTimeout > 0) {
                setTimeout(function () {
                  return reject("Timed out (" + _this._options.imageTimeout + "ms) loading image");
                }, _this._options.imageTimeout);
              }
            })];
          case 3:
            return [2 /*return*/, _a.sent()];
        }
      });
    });
  };
  Cache.prototype.has = function (key) {
    return typeof this._cache[key] !== 'undefined';
  };
  Cache.prototype.keys = function () {
    return Promise.resolve(Object.keys(this._cache));
  };
  Cache.prototype.proxy = function (src) {
    var _this = this;
    var proxy = this._options.proxy;
    if (!proxy) {
      throw new Error('No proxy defined');
    }
    var key = src.substring(0, 256);
    return new Promise(function (resolve, reject) {
      var responseType = FEATURES.SUPPORT_RESPONSE_TYPE ? 'blob' : 'text';
      var xhr = new XMLHttpRequest();
      xhr.onload = function () {
        if (xhr.status === 200) {
          if (responseType === 'text') {
            resolve(xhr.response);
          } else {
            var reader_1 = new FileReader();
            reader_1.addEventListener('load', function () {
              return resolve(reader_1.result);
            }, false);
            reader_1.addEventListener('error', function (e) {
              return reject(e);
            }, false);
            reader_1.readAsDataURL(xhr.response);
          }
        } else {
          reject("Failed to proxy resource " + key + " with status code " + xhr.status);
        }
      };
      xhr.onerror = reject;
      var queryString = proxy.indexOf('?') > -1 ? '&' : '?';
      xhr.open('GET', "" + proxy + queryString + "url=" + encodeURIComponent(src) + "&responseType=" + responseType);
      if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
        xhr.responseType = responseType;
      }
      if (_this._options.imageTimeout) {
        var timeout_1 = _this._options.imageTimeout;
        xhr.timeout = timeout_1;
        xhr.ontimeout = function () {
          return reject("Timed out (" + timeout_1 + "ms) proxying " + key);
        };
      }
      xhr.send();
    });
  };
  return Cache;
}();
var INLINE_SVG = /^data:image\/svg\+xml/i;
var INLINE_BASE64 = /^data:image\/.*;base64,/i;
var INLINE_IMG = /^data:image\/.*/i;
var isRenderable = function (src) {
  return FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src);
};
var isInlineImage = function (src) {
  return INLINE_IMG.test(src);
};
var isInlineBase64Image = function (src) {
  return INLINE_BASE64.test(src);
};
var isBlobImage = function (src) {
  return src.substr(0, 4) === 'blob';
};
var isSVG = function (src) {
  return src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src);
};
var Vector = /** @class */function () {
  function Vector(x, y) {
    this.type = 0 /* VECTOR */;
    this.x = x;
    this.y = y;
  }
  Vector.prototype.add = function (deltaX, deltaY) {
    return new Vector(this.x + deltaX, this.y + deltaY);
  };
  return Vector;
}();
var lerp$4 = function (a, b, t) {
  return new Vector(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
};
var BezierCurve$2 = /** @class */function () {
  function BezierCurve(start, startControl, endControl, end) {
    this.type = 1 /* BEZIER_CURVE */;
    this.start = start;
    this.startControl = startControl;
    this.endControl = endControl;
    this.end = end;
  }
  BezierCurve.prototype.subdivide = function (t, firstHalf) {
    var ab = lerp$4(this.start, this.startControl, t);
    var bc = lerp$4(this.startControl, this.endControl, t);
    var cd = lerp$4(this.endControl, this.end, t);
    var abbc = lerp$4(ab, bc, t);
    var bccd = lerp$4(bc, cd, t);
    var dest = lerp$4(abbc, bccd, t);
    return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end);
  };
  BezierCurve.prototype.add = function (deltaX, deltaY) {
    return new BezierCurve(this.start.add(deltaX, deltaY), this.startControl.add(deltaX, deltaY), this.endControl.add(deltaX, deltaY), this.end.add(deltaX, deltaY));
  };
  BezierCurve.prototype.reverse = function () {
    return new BezierCurve(this.end, this.endControl, this.startControl, this.start);
  };
  return BezierCurve;
}();
var isBezierCurve = function (path) {
  return path.type === 1 /* BEZIER_CURVE */;
};
var BoundCurves = /** @class */function () {
  function BoundCurves(element) {
    var styles = element.styles;
    var bounds = element.bounds;
    var _a = getAbsoluteValueForTuple(styles.borderTopLeftRadius, bounds.width, bounds.height),
      tlh = _a[0],
      tlv = _a[1];
    var _b = getAbsoluteValueForTuple(styles.borderTopRightRadius, bounds.width, bounds.height),
      trh = _b[0],
      trv = _b[1];
    var _c = getAbsoluteValueForTuple(styles.borderBottomRightRadius, bounds.width, bounds.height),
      brh = _c[0],
      brv = _c[1];
    var _d = getAbsoluteValueForTuple(styles.borderBottomLeftRadius, bounds.width, bounds.height),
      blh = _d[0],
      blv = _d[1];
    var factors = [];
    factors.push((tlh + trh) / bounds.width);
    factors.push((blh + brh) / bounds.width);
    factors.push((tlv + blv) / bounds.height);
    factors.push((trv + brv) / bounds.height);
    var maxFactor = Math.max.apply(Math, factors);
    if (maxFactor > 1) {
      tlh /= maxFactor;
      tlv /= maxFactor;
      trh /= maxFactor;
      trv /= maxFactor;
      brh /= maxFactor;
      brv /= maxFactor;
      blh /= maxFactor;
      blv /= maxFactor;
    }
    var topWidth = bounds.width - trh;
    var rightHeight = bounds.height - brv;
    var bottomWidth = bounds.width - brh;
    var leftHeight = bounds.height - blv;
    var borderTopWidth = styles.borderTopWidth;
    var borderRightWidth = styles.borderRightWidth;
    var borderBottomWidth = styles.borderBottomWidth;
    var borderLeftWidth = styles.borderLeftWidth;
    var paddingTop = getAbsoluteValue(styles.paddingTop, element.bounds.width);
    var paddingRight = getAbsoluteValue(styles.paddingRight, element.bounds.width);
    var paddingBottom = getAbsoluteValue(styles.paddingBottom, element.bounds.width);
    var paddingLeft = getAbsoluteValue(styles.paddingLeft, element.bounds.width);
    this.topLeftBorderDoubleOuterBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + borderLeftWidth / 3, bounds.top + borderTopWidth / 3, tlh - borderLeftWidth / 3, tlv - borderTopWidth / 3, CORNER.TOP_LEFT) : new Vector(bounds.left + borderLeftWidth / 3, bounds.top + borderTopWidth / 3);
    this.topRightBorderDoubleOuterBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + topWidth, bounds.top + borderTopWidth / 3, trh - borderRightWidth / 3, trv - borderTopWidth / 3, CORNER.TOP_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth / 3, bounds.top + borderTopWidth / 3);
    this.bottomRightBorderDoubleOuterBox = brh > 0 || brv > 0 ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh - borderRightWidth / 3, brv - borderBottomWidth / 3, CORNER.BOTTOM_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth / 3, bounds.top + bounds.height - borderBottomWidth / 3);
    this.bottomLeftBorderDoubleOuterBox = blh > 0 || blv > 0 ? getCurvePoints(bounds.left + borderLeftWidth / 3, bounds.top + leftHeight, blh - borderLeftWidth / 3, blv - borderBottomWidth / 3, CORNER.BOTTOM_LEFT) : new Vector(bounds.left + borderLeftWidth / 3, bounds.top + bounds.height - borderBottomWidth / 3);
    this.topLeftBorderDoubleInnerBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + borderLeftWidth * 2 / 3, bounds.top + borderTopWidth * 2 / 3, tlh - borderLeftWidth * 2 / 3, tlv - borderTopWidth * 2 / 3, CORNER.TOP_LEFT) : new Vector(bounds.left + borderLeftWidth * 2 / 3, bounds.top + borderTopWidth * 2 / 3);
    this.topRightBorderDoubleInnerBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + topWidth, bounds.top + borderTopWidth * 2 / 3, trh - borderRightWidth * 2 / 3, trv - borderTopWidth * 2 / 3, CORNER.TOP_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth * 2 / 3, bounds.top + borderTopWidth * 2 / 3);
    this.bottomRightBorderDoubleInnerBox = brh > 0 || brv > 0 ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh - borderRightWidth * 2 / 3, brv - borderBottomWidth * 2 / 3, CORNER.BOTTOM_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth * 2 / 3, bounds.top + bounds.height - borderBottomWidth * 2 / 3);
    this.bottomLeftBorderDoubleInnerBox = blh > 0 || blv > 0 ? getCurvePoints(bounds.left + borderLeftWidth * 2 / 3, bounds.top + leftHeight, blh - borderLeftWidth * 2 / 3, blv - borderBottomWidth * 2 / 3, CORNER.BOTTOM_LEFT) : new Vector(bounds.left + borderLeftWidth * 2 / 3, bounds.top + bounds.height - borderBottomWidth * 2 / 3);
    this.topLeftBorderStroke = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + borderLeftWidth / 2, bounds.top + borderTopWidth / 2, tlh - borderLeftWidth / 2, tlv - borderTopWidth / 2, CORNER.TOP_LEFT) : new Vector(bounds.left + borderLeftWidth / 2, bounds.top + borderTopWidth / 2);
    this.topRightBorderStroke = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + topWidth, bounds.top + borderTopWidth / 2, trh - borderRightWidth / 2, trv - borderTopWidth / 2, CORNER.TOP_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth / 2, bounds.top + borderTopWidth / 2);
    this.bottomRightBorderStroke = brh > 0 || brv > 0 ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh - borderRightWidth / 2, brv - borderBottomWidth / 2, CORNER.BOTTOM_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth / 2, bounds.top + bounds.height - borderBottomWidth / 2);
    this.bottomLeftBorderStroke = blh > 0 || blv > 0 ? getCurvePoints(bounds.left + borderLeftWidth / 2, bounds.top + leftHeight, blh - borderLeftWidth / 2, blv - borderBottomWidth / 2, CORNER.BOTTOM_LEFT) : new Vector(bounds.left + borderLeftWidth / 2, bounds.top + bounds.height - borderBottomWidth / 2);
    this.topLeftBorderBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left, bounds.top, tlh, tlv, CORNER.TOP_LEFT) : new Vector(bounds.left, bounds.top);
    this.topRightBorderBox = trh > 0 || trv > 0 ? getCurvePoints(bounds.left + topWidth, bounds.top, trh, trv, CORNER.TOP_RIGHT) : new Vector(bounds.left + bounds.width, bounds.top);
    this.bottomRightBorderBox = brh > 0 || brv > 0 ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh, brv, CORNER.BOTTOM_RIGHT) : new Vector(bounds.left + bounds.width, bounds.top + bounds.height);
    this.bottomLeftBorderBox = blh > 0 || blv > 0 ? getCurvePoints(bounds.left, bounds.top + leftHeight, blh, blv, CORNER.BOTTOM_LEFT) : new Vector(bounds.left, bounds.top + bounds.height);
    this.topLeftPaddingBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + borderLeftWidth, bounds.top + borderTopWidth, Math.max(0, tlh - borderLeftWidth), Math.max(0, tlv - borderTopWidth), CORNER.TOP_LEFT) : new Vector(bounds.left + borderLeftWidth, bounds.top + borderTopWidth);
    this.topRightPaddingBox = trh > 0 || trv > 0 ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width - borderRightWidth), bounds.top + borderTopWidth, topWidth > bounds.width + borderRightWidth ? 0 : Math.max(0, trh - borderRightWidth), Math.max(0, trv - borderTopWidth), CORNER.TOP_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + borderTopWidth);
    this.bottomRightPaddingBox = brh > 0 || brv > 0 ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - borderLeftWidth), bounds.top + Math.min(rightHeight, bounds.height - borderBottomWidth), Math.max(0, brh - borderRightWidth), Math.max(0, brv - borderBottomWidth), CORNER.BOTTOM_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + bounds.height - borderBottomWidth);
    this.bottomLeftPaddingBox = blh > 0 || blv > 0 ? getCurvePoints(bounds.left + borderLeftWidth, bounds.top + Math.min(leftHeight, bounds.height - borderBottomWidth), Math.max(0, blh - borderLeftWidth), Math.max(0, blv - borderBottomWidth), CORNER.BOTTOM_LEFT) : new Vector(bounds.left + borderLeftWidth, bounds.top + bounds.height - borderBottomWidth);
    this.topLeftContentBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop, Math.max(0, tlh - (borderLeftWidth + paddingLeft)), Math.max(0, tlv - (borderTopWidth + paddingTop)), CORNER.TOP_LEFT) : new Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop);
    this.topRightContentBox = trh > 0 || trv > 0 ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borderLeftWidth + paddingLeft), bounds.top + borderTopWidth + paddingTop, topWidth > bounds.width + borderLeftWidth + paddingLeft ? 0 : trh - borderLeftWidth + paddingLeft, trv - (borderTopWidth + paddingTop), CORNER.TOP_RIGHT) : new Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + borderTopWidth + paddingTop);
    this.bottomRightContentBox = brh > 0 || brv > 0 ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - (borderLeftWidth + paddingLeft)), bounds.top + Math.min(rightHeight, bounds.height + borderTopWidth + paddingTop), Math.max(0, brh - (borderRightWidth + paddingRight)), brv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_RIGHT) : new Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + bounds.height - (borderBottomWidth + paddingBottom));
    this.bottomLeftContentBox = blh > 0 || blv > 0 ? getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + leftHeight, Math.max(0, blh - (borderLeftWidth + paddingLeft)), blv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_LEFT) : new Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + bounds.height - (borderBottomWidth + paddingBottom));
  }
  return BoundCurves;
}();
var CORNER;
(function (CORNER) {
  CORNER[CORNER["TOP_LEFT"] = 0] = "TOP_LEFT";
  CORNER[CORNER["TOP_RIGHT"] = 1] = "TOP_RIGHT";
  CORNER[CORNER["BOTTOM_RIGHT"] = 2] = "BOTTOM_RIGHT";
  CORNER[CORNER["BOTTOM_LEFT"] = 3] = "BOTTOM_LEFT";
})(CORNER || (CORNER = {}));
var getCurvePoints = function (x, y, r1, r2, position) {
  var kappa = 4 * ((Math.sqrt(2) - 1) / 3);
  var ox = r1 * kappa; // control point offset horizontal
  var oy = r2 * kappa; // control point offset vertical
  var xm = x + r1; // x-middle
  var ym = y + r2; // y-middle
  switch (position) {
    case CORNER.TOP_LEFT:
      return new BezierCurve$2(new Vector(x, ym), new Vector(x, ym - oy), new Vector(xm - ox, y), new Vector(xm, y));
    case CORNER.TOP_RIGHT:
      return new BezierCurve$2(new Vector(x, y), new Vector(x + ox, y), new Vector(xm, ym - oy), new Vector(xm, ym));
    case CORNER.BOTTOM_RIGHT:
      return new BezierCurve$2(new Vector(xm, y), new Vector(xm, y + oy), new Vector(x + ox, ym), new Vector(x, ym));
    case CORNER.BOTTOM_LEFT:
    default:
      return new BezierCurve$2(new Vector(xm, ym), new Vector(xm - ox, ym), new Vector(x, y + oy), new Vector(x, y));
  }
};
var calculateBorderBoxPath = function (curves) {
  return [curves.topLeftBorderBox, curves.topRightBorderBox, curves.bottomRightBorderBox, curves.bottomLeftBorderBox];
};
var calculateContentBoxPath = function (curves) {
  return [curves.topLeftContentBox, curves.topRightContentBox, curves.bottomRightContentBox, curves.bottomLeftContentBox];
};
var calculatePaddingBoxPath = function (curves) {
  return [curves.topLeftPaddingBox, curves.topRightPaddingBox, curves.bottomRightPaddingBox, curves.bottomLeftPaddingBox];
};
var TransformEffect = /** @class */function () {
  function TransformEffect(offsetX, offsetY, matrix) {
    this.offsetX = offsetX;
    this.offsetY = offsetY;
    this.matrix = matrix;
    this.type = 0 /* TRANSFORM */;
    this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
  }
  return TransformEffect;
}();
var ClipEffect = /** @class */function () {
  function ClipEffect(path, target) {
    this.path = path;
    this.target = target;
    this.type = 1 /* CLIP */;
  }
  return ClipEffect;
}();
var OpacityEffect = /** @class */function () {
  function OpacityEffect(opacity) {
    this.opacity = opacity;
    this.type = 2 /* OPACITY */;
    this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
  }
  return OpacityEffect;
}();
var isTransformEffect = function (effect) {
  return effect.type === 0 /* TRANSFORM */;
};
var isClipEffect = function (effect) {
  return effect.type === 1 /* CLIP */;
};
var isOpacityEffect = function (effect) {
  return effect.type === 2 /* OPACITY */;
};
var equalPath = function (a, b) {
  if (a.length === b.length) {
    return a.some(function (v, i) {
      return v === b[i];
    });
  }
  return false;
};
var transformPath$1 = function (path, deltaX, deltaY, deltaW, deltaH) {
  return path.map(function (point, index) {
    switch (index) {
      case 0:
        return point.add(deltaX, deltaY);
      case 1:
        return point.add(deltaX + deltaW, deltaY);
      case 2:
        return point.add(deltaX + deltaW, deltaY + deltaH);
      case 3:
        return point.add(deltaX, deltaY + deltaH);
    }
    return point;
  });
};
var StackingContext = /** @class */function () {
  function StackingContext(container) {
    this.element = container;
    this.inlineLevel = [];
    this.nonInlineLevel = [];
    this.negativeZIndex = [];
    this.zeroOrAutoZIndexOrTransformedOrOpacity = [];
    this.positiveZIndex = [];
    this.nonPositionedFloats = [];
    this.nonPositionedInlineLevel = [];
  }
  return StackingContext;
}();
var ElementPaint = /** @class */function () {
  function ElementPaint(container, parent) {
    this.container = container;
    this.parent = parent;
    this.effects = [];
    this.curves = new BoundCurves(this.container);
    if (this.container.styles.opacity < 1) {
      this.effects.push(new OpacityEffect(this.container.styles.opacity));
    }
    if (this.container.styles.transform !== null) {
      var offsetX = this.container.bounds.left + this.container.styles.transformOrigin[0].number;
      var offsetY = this.container.bounds.top + this.container.styles.transformOrigin[1].number;
      var matrix = this.container.styles.transform;
      this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
    }
    if (this.container.styles.overflowX !== 0 /* VISIBLE */) {
      var borderBox = calculateBorderBoxPath(this.curves);
      var paddingBox = calculatePaddingBoxPath(this.curves);
      if (equalPath(borderBox, paddingBox)) {
        this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
      } else {
        this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
        this.effects.push(new ClipEffect(paddingBox, 4 /* CONTENT */));
      }
    }
  }
  ElementPaint.prototype.getEffects = function (target) {
    var inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(this.container.styles.position) === -1;
    var parent = this.parent;
    var effects = this.effects.slice(0);
    while (parent) {
      var croplessEffects = parent.effects.filter(function (effect) {
        return !isClipEffect(effect);
      });
      if (inFlow || parent.container.styles.position !== 0 /* STATIC */ || !parent.parent) {
        effects.unshift.apply(effects, croplessEffects);
        inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(parent.container.styles.position) === -1;
        if (parent.container.styles.overflowX !== 0 /* VISIBLE */) {
          var borderBox = calculateBorderBoxPath(parent.curves);
          var paddingBox = calculatePaddingBoxPath(parent.curves);
          if (!equalPath(borderBox, paddingBox)) {
            effects.unshift(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
          }
        }
      } else {
        effects.unshift.apply(effects, croplessEffects);
      }
      parent = parent.parent;
    }
    return effects.filter(function (effect) {
      return contains(effect.target, target);
    });
  };
  return ElementPaint;
}();
var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) {
  parent.container.elements.forEach(function (child) {
    var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
    var createsStackingContext = contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */);
    var paintContainer = new ElementPaint(child, parent);
    if (contains(child.styles.display, 2048 /* LIST_ITEM */)) {
      listItems.push(paintContainer);
    }
    var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
    if (treatAsRealStackingContext || createsStackingContext) {
      var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
      var stack = new StackingContext(paintContainer);
      if (child.styles.isPositioned() || child.styles.opacity < 1 || child.styles.isTransformed()) {
        var order_1 = child.styles.zIndex.order;
        if (order_1 < 0) {
          var index_1 = 0;
          parentStack.negativeZIndex.some(function (current, i) {
            if (order_1 > current.element.container.styles.zIndex.order) {
              index_1 = i;
              return false;
            } else if (index_1 > 0) {
              return true;
            }
            return false;
          });
          parentStack.negativeZIndex.splice(index_1, 0, stack);
        } else if (order_1 > 0) {
          var index_2 = 0;
          parentStack.positiveZIndex.some(function (current, i) {
            if (order_1 >= current.element.container.styles.zIndex.order) {
              index_2 = i + 1;
              return false;
            } else if (index_2 > 0) {
              return true;
            }
            return false;
          });
          parentStack.positiveZIndex.splice(index_2, 0, stack);
        } else {
          parentStack.zeroOrAutoZIndexOrTransformedOrOpacity.push(stack);
        }
      } else {
        if (child.styles.isFloating()) {
          parentStack.nonPositionedFloats.push(stack);
        } else {
          parentStack.nonPositionedInlineLevel.push(stack);
        }
      }
      parseStackTree(paintContainer, stack, treatAsRealStackingContext ? stack : realStackingContext, listOwnerItems);
    } else {
      if (child.styles.isInlineLevel()) {
        stackingContext.inlineLevel.push(paintContainer);
      } else {
        stackingContext.nonInlineLevel.push(paintContainer);
      }
      parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
    }
    if (contains(child.flags, 8 /* IS_LIST_OWNER */)) {
      processListItems(child, listOwnerItems);
    }
  });
};
var processListItems = function (owner, elements) {
  var numbering = owner instanceof OLElementContainer ? owner.start : 1;
  var reversed = owner instanceof OLElementContainer ? owner.reversed : false;
  for (var i = 0; i < elements.length; i++) {
    var item = elements[i];
    if (item.container instanceof LIElementContainer && typeof item.container.value === 'number' && item.container.value !== 0) {
      numbering = item.container.value;
    }
    item.listValue = createCounterText(numbering, item.container.styles.listStyleType, true);
    numbering += reversed ? -1 : 1;
  }
};
var parseStackingContexts = function (container) {
  var paintContainer = new ElementPaint(container, null);
  var root = new StackingContext(paintContainer);
  var listItems = [];
  parseStackTree(paintContainer, root, root, listItems);
  processListItems(paintContainer.container, listItems);
  return root;
};
var parsePathForBorder = function (curves, borderSide) {
  switch (borderSide) {
    case 0:
      return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftPaddingBox, curves.topRightBorderBox, curves.topRightPaddingBox);
    case 1:
      return createPathFromCurves(curves.topRightBorderBox, curves.topRightPaddingBox, curves.bottomRightBorderBox, curves.bottomRightPaddingBox);
    case 2:
      return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox);
    case 3:
    default:
      return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox, curves.topLeftBorderBox, curves.topLeftPaddingBox);
  }
};
var parsePathForBorderDoubleOuter = function (curves, borderSide) {
  switch (borderSide) {
    case 0:
      return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftBorderDoubleOuterBox, curves.topRightBorderBox, curves.topRightBorderDoubleOuterBox);
    case 1:
      return createPathFromCurves(curves.topRightBorderBox, curves.topRightBorderDoubleOuterBox, curves.bottomRightBorderBox, curves.bottomRightBorderDoubleOuterBox);
    case 2:
      return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightBorderDoubleOuterBox, curves.bottomLeftBorderBox, curves.bottomLeftBorderDoubleOuterBox);
    case 3:
    default:
      return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftBorderDoubleOuterBox, curves.topLeftBorderBox, curves.topLeftBorderDoubleOuterBox);
  }
};
var parsePathForBorderDoubleInner = function (curves, borderSide) {
  switch (borderSide) {
    case 0:
      return createPathFromCurves(curves.topLeftBorderDoubleInnerBox, curves.topLeftPaddingBox, curves.topRightBorderDoubleInnerBox, curves.topRightPaddingBox);
    case 1:
      return createPathFromCurves(curves.topRightBorderDoubleInnerBox, curves.topRightPaddingBox, curves.bottomRightBorderDoubleInnerBox, curves.bottomRightPaddingBox);
    case 2:
      return createPathFromCurves(curves.bottomRightBorderDoubleInnerBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderDoubleInnerBox, curves.bottomLeftPaddingBox);
    case 3:
    default:
      return createPathFromCurves(curves.bottomLeftBorderDoubleInnerBox, curves.bottomLeftPaddingBox, curves.topLeftBorderDoubleInnerBox, curves.topLeftPaddingBox);
  }
};
var parsePathForBorderStroke = function (curves, borderSide) {
  switch (borderSide) {
    case 0:
      return createStrokePathFromCurves(curves.topLeftBorderStroke, curves.topRightBorderStroke);
    case 1:
      return createStrokePathFromCurves(curves.topRightBorderStroke, curves.bottomRightBorderStroke);
    case 2:
      return createStrokePathFromCurves(curves.bottomRightBorderStroke, curves.bottomLeftBorderStroke);
    case 3:
    default:
      return createStrokePathFromCurves(curves.bottomLeftBorderStroke, curves.topLeftBorderStroke);
  }
};
var createStrokePathFromCurves = function (outer1, outer2) {
  var path = [];
  if (isBezierCurve(outer1)) {
    path.push(outer1.subdivide(0.5, false));
  } else {
    path.push(outer1);
  }
  if (isBezierCurve(outer2)) {
    path.push(outer2.subdivide(0.5, true));
  } else {
    path.push(outer2);
  }
  return path;
};
var createPathFromCurves = function (outer1, inner1, outer2, inner2) {
  var path = [];
  if (isBezierCurve(outer1)) {
    path.push(outer1.subdivide(0.5, false));
  } else {
    path.push(outer1);
  }
  if (isBezierCurve(outer2)) {
    path.push(outer2.subdivide(0.5, true));
  } else {
    path.push(outer2);
  }
  if (isBezierCurve(inner2)) {
    path.push(inner2.subdivide(0.5, true).reverse());
  } else {
    path.push(inner2);
  }
  if (isBezierCurve(inner1)) {
    path.push(inner1.subdivide(0.5, false).reverse());
  } else {
    path.push(inner1);
  }
  return path;
};
var paddingBox = function (element) {
  var bounds = element.bounds;
  var styles = element.styles;
  return bounds.add(styles.borderLeftWidth, styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth), -(styles.borderTopWidth + styles.borderBottomWidth));
};
var contentBox = function (element) {
  var styles = element.styles;
  var bounds = element.bounds;
  var paddingLeft = getAbsoluteValue(styles.paddingLeft, bounds.width);
  var paddingRight = getAbsoluteValue(styles.paddingRight, bounds.width);
  var paddingTop = getAbsoluteValue(styles.paddingTop, bounds.width);
  var paddingBottom = getAbsoluteValue(styles.paddingBottom, bounds.width);
  return bounds.add(paddingLeft + styles.borderLeftWidth, paddingTop + styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth + paddingLeft + paddingRight), -(styles.borderTopWidth + styles.borderBottomWidth + paddingTop + paddingBottom));
};
var calculateBackgroundPositioningArea = function (backgroundOrigin, element) {
  if (backgroundOrigin === 0 /* BORDER_BOX */) {
    return element.bounds;
  }
  if (backgroundOrigin === 2 /* CONTENT_BOX */) {
    return contentBox(element);
  }
  return paddingBox(element);
};
var calculateBackgroundPaintingArea = function (backgroundClip, element) {
  if (backgroundClip === 0 /* BORDER_BOX */) {
    return element.bounds;
  }
  if (backgroundClip === 2 /* CONTENT_BOX */) {
    return contentBox(element);
  }
  return paddingBox(element);
};
var calculateBackgroundRendering = function (container, index, intrinsicSize) {
  var backgroundPositioningArea = calculateBackgroundPositioningArea(getBackgroundValueForIndex(container.styles.backgroundOrigin, index), container);
  var backgroundPaintingArea = calculateBackgroundPaintingArea(getBackgroundValueForIndex(container.styles.backgroundClip, index), container);
  var backgroundImageSize = calculateBackgroundSize(getBackgroundValueForIndex(container.styles.backgroundSize, index), intrinsicSize, backgroundPositioningArea);
  var sizeWidth = backgroundImageSize[0],
    sizeHeight = backgroundImageSize[1];
  var position = getAbsoluteValueForTuple(getBackgroundValueForIndex(container.styles.backgroundPosition, index), backgroundPositioningArea.width - sizeWidth, backgroundPositioningArea.height - sizeHeight);
  var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
  var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
  var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
  return [path, offsetX, offsetY, sizeWidth, sizeHeight];
};
var isAuto = function (token) {
  return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO;
};
var hasIntrinsicValue = function (value) {
  return typeof value === 'number';
};
var calculateBackgroundSize = function (size, _a, bounds) {
  var intrinsicWidth = _a[0],
    intrinsicHeight = _a[1],
    intrinsicProportion = _a[2];
  var first = size[0],
    second = size[1];
  if (!first) {
    return [0, 0];
  }
  if (isLengthPercentage(first) && second && isLengthPercentage(second)) {
    return [getAbsoluteValue(first, bounds.width), getAbsoluteValue(second, bounds.height)];
  }
  var hasIntrinsicProportion = hasIntrinsicValue(intrinsicProportion);
  if (isIdentToken(first) && (first.value === BACKGROUND_SIZE.CONTAIN || first.value === BACKGROUND_SIZE.COVER)) {
    if (hasIntrinsicValue(intrinsicProportion)) {
      var targetRatio = bounds.width / bounds.height;
      return targetRatio < intrinsicProportion !== (first.value === BACKGROUND_SIZE.COVER) ? [bounds.width, bounds.width / intrinsicProportion] : [bounds.height * intrinsicProportion, bounds.height];
    }
    return [bounds.width, bounds.height];
  }
  var hasIntrinsicWidth = hasIntrinsicValue(intrinsicWidth);
  var hasIntrinsicHeight = hasIntrinsicValue(intrinsicHeight);
  var hasIntrinsicDimensions = hasIntrinsicWidth || hasIntrinsicHeight;
  // If the background-size is auto or auto auto:
  if (isAuto(first) && (!second || isAuto(second))) {
    // If the image has both horizontal and vertical intrinsic dimensions, it's rendered at that size.
    if (hasIntrinsicWidth && hasIntrinsicHeight) {
      return [intrinsicWidth, intrinsicHeight];
    }
    // If the image has no intrinsic dimensions and has no intrinsic proportions,
    // it's rendered at the size of the background positioning area.
    if (!hasIntrinsicProportion && !hasIntrinsicDimensions) {
      return [bounds.width, bounds.height];
    }
    // TODO If the image has no intrinsic dimensions but has intrinsic proportions, it's rendered as if contain had been specified instead.
    // If the image has only one intrinsic dimension and has intrinsic proportions, it's rendered at the size corresponding to that one dimension.
    // The other dimension is computed using the specified dimension and the intrinsic proportions.
    if (hasIntrinsicDimensions && hasIntrinsicProportion) {
      var width_1 = hasIntrinsicWidth ? intrinsicWidth : intrinsicHeight * intrinsicProportion;
      var height_1 = hasIntrinsicHeight ? intrinsicHeight : intrinsicWidth / intrinsicProportion;
      return [width_1, height_1];
    }
    // If the image has only one intrinsic dimension but has no intrinsic proportions,
    // it's rendered using the specified dimension and the other dimension of the background positioning area.
    var width_2 = hasIntrinsicWidth ? intrinsicWidth : bounds.width;
    var height_2 = hasIntrinsicHeight ? intrinsicHeight : bounds.height;
    return [width_2, height_2];
  }
  // If the image has intrinsic proportions, it's stretched to the specified dimension.
  // The unspecified dimension is computed using the specified dimension and the intrinsic proportions.
  if (hasIntrinsicProportion) {
    var width_3 = 0;
    var height_3 = 0;
    if (isLengthPercentage(first)) {
      width_3 = getAbsoluteValue(first, bounds.width);
    } else if (isLengthPercentage(second)) {
      height_3 = getAbsoluteValue(second, bounds.height);
    }
    if (isAuto(first)) {
      width_3 = height_3 * intrinsicProportion;
    } else if (!second || isAuto(second)) {
      height_3 = width_3 / intrinsicProportion;
    }
    return [width_3, height_3];
  }
  // If the image has no intrinsic proportions, it's stretched to the specified dimension.
  // The unspecified dimension is computed using the image's corresponding intrinsic dimension,
  // if there is one. If there is no such intrinsic dimension,
  // it becomes the corresponding dimension of the background positioning area.
  var width = null;
  var height = null;
  if (isLengthPercentage(first)) {
    width = getAbsoluteValue(first, bounds.width);
  } else if (second && isLengthPercentage(second)) {
    height = getAbsoluteValue(second, bounds.height);
  }
  if (width !== null && (!second || isAuto(second))) {
    height = hasIntrinsicWidth && hasIntrinsicHeight ? width / intrinsicWidth * intrinsicHeight : bounds.height;
  }
  if (height !== null && isAuto(first)) {
    width = hasIntrinsicWidth && hasIntrinsicHeight ? height / intrinsicHeight * intrinsicWidth : bounds.width;
  }
  if (width !== null && height !== null) {
    return [width, height];
  }
  throw new Error("Unable to calculate background-size for element");
};
var getBackgroundValueForIndex = function (values, index) {
  var value = values[index];
  if (typeof value === 'undefined') {
    return values[0];
  }
  return value;
};
var calculateBackgroundRepeatPath = function (repeat, _a, _b, backgroundPositioningArea, backgroundPaintingArea) {
  var x = _a[0],
    y = _a[1];
  var width = _b[0],
    height = _b[1];
  switch (repeat) {
    case 2 /* REPEAT_X */:
      return [new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)), new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)), new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)), new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))];
    case 3 /* REPEAT_Y */:
      return [new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)), new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)), new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)), new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))];
    case 1 /* NO_REPEAT */:
      return [new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)), new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)), new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y + height)), new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y + height))];
    default:
      return [new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.top)), new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.top)), new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top)), new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top))];
  }
};
var SMALL_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
var SAMPLE_TEXT = 'Hidden Text';
var FontMetrics = /** @class */function () {
  function FontMetrics(document) {
    this._data = {};
    this._document = document;
  }
  FontMetrics.prototype.parseMetrics = function (fontFamily, fontSize) {
    var container = this._document.createElement('div');
    var img = this._document.createElement('img');
    var span = this._document.createElement('span');
    var body = this._document.body;
    container.style.visibility = 'hidden';
    container.style.fontFamily = fontFamily;
    container.style.fontSize = fontSize;
    container.style.margin = '0';
    container.style.padding = '0';
    container.style.whiteSpace = 'nowrap';
    body.appendChild(container);
    img.src = SMALL_IMAGE;
    img.width = 1;
    img.height = 1;
    img.style.margin = '0';
    img.style.padding = '0';
    img.style.verticalAlign = 'baseline';
    span.style.fontFamily = fontFamily;
    span.style.fontSize = fontSize;
    span.style.margin = '0';
    span.style.padding = '0';
    span.appendChild(this._document.createTextNode(SAMPLE_TEXT));
    container.appendChild(span);
    container.appendChild(img);
    var baseline = img.offsetTop - span.offsetTop + 2;
    container.removeChild(span);
    container.appendChild(this._document.createTextNode(SAMPLE_TEXT));
    container.style.lineHeight = 'normal';
    img.style.verticalAlign = 'super';
    var middle = img.offsetTop - container.offsetTop + 2;
    body.removeChild(container);
    return {
      baseline: baseline,
      middle: middle
    };
  };
  FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
    var key = fontFamily + " " + fontSize;
    if (typeof this._data[key] === 'undefined') {
      this._data[key] = this.parseMetrics(fontFamily, fontSize);
    }
    return this._data[key];
  };
  return FontMetrics;
}();
var Renderer = /** @class */function () {
  function Renderer(context, options) {
    this.context = context;
    this.options = options;
  }
  return Renderer;
}();
var MASK_OFFSET = 10000;
var CanvasRenderer = /** @class */function (_super) {
  __extends$1(CanvasRenderer, _super);
  function CanvasRenderer(context, options) {
    var _this = _super.call(this, context, options) || this;
    _this._activeEffects = [];
    _this.canvas = options.canvas ? options.canvas : document.createElement('canvas');
    _this.ctx = _this.canvas.getContext('2d');
    if (!options.canvas) {
      _this.canvas.width = Math.floor(options.width * options.scale);
      _this.canvas.height = Math.floor(options.height * options.scale);
      _this.canvas.style.width = options.width + "px";
      _this.canvas.style.height = options.height + "px";
    }
    _this.fontMetrics = new FontMetrics(document);
    _this.ctx.scale(_this.options.scale, _this.options.scale);
    _this.ctx.translate(-options.x, -options.y);
    _this.ctx.textBaseline = 'bottom';
    _this._activeEffects = [];
    _this.context.logger.debug("Canvas renderer initialized (" + options.width + "x" + options.height + ") with scale " + options.scale);
    return _this;
  }
  CanvasRenderer.prototype.applyEffects = function (effects) {
    var _this = this;
    while (this._activeEffects.length) {
      this.popEffect();
    }
    effects.forEach(function (effect) {
      return _this.applyEffect(effect);
    });
  };
  CanvasRenderer.prototype.applyEffect = function (effect) {
    this.ctx.save();
    if (isOpacityEffect(effect)) {
      this.ctx.globalAlpha = effect.opacity;
    }
    if (isTransformEffect(effect)) {
      this.ctx.translate(effect.offsetX, effect.offsetY);
      this.ctx.transform(effect.matrix[0], effect.matrix[1], effect.matrix[2], effect.matrix[3], effect.matrix[4], effect.matrix[5]);
      this.ctx.translate(-effect.offsetX, -effect.offsetY);
    }
    if (isClipEffect(effect)) {
      this.path(effect.path);
      this.ctx.clip();
    }
    this._activeEffects.push(effect);
  };
  CanvasRenderer.prototype.popEffect = function () {
    this._activeEffects.pop();
    this.ctx.restore();
  };
  CanvasRenderer.prototype.renderStack = function (stack) {
    return __awaiter(this, void 0, void 0, function () {
      var styles;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            styles = stack.element.container.styles;
            if (!styles.isVisible()) return [3 /*break*/, 2];
            return [4 /*yield*/, this.renderStackContent(stack)];
          case 1:
            _a.sent();
            _a.label = 2;
          case 2:
            return [2 /*return*/];
        }
      });
    });
  };
  CanvasRenderer.prototype.renderNode = function (paint) {
    return __awaiter(this, void 0, void 0, function () {
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            if (contains(paint.container.flags, 16 /* DEBUG_RENDER */)) {
              debugger;
            }
            if (!paint.container.styles.isVisible()) return [3 /*break*/, 3];
            return [4 /*yield*/, this.renderNodeBackgroundAndBorders(paint)];
          case 1:
            _a.sent();
            return [4 /*yield*/, this.renderNodeContent(paint)];
          case 2:
            _a.sent();
            _a.label = 3;
          case 3:
            return [2 /*return*/];
        }
      });
    });
  };
  CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing, baseline) {
    var _this = this;
    if (letterSpacing === 0) {
      this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
    } else {
      var letters = segmentGraphemes(text.text);
      letters.reduce(function (left, letter) {
        _this.ctx.fillText(letter, left, text.bounds.top + baseline);
        return left + _this.ctx.measureText(letter).width;
      }, text.bounds.left);
    }
  };
  CanvasRenderer.prototype.createFontStyle = function (styles) {
    var fontVariant = styles.fontVariant.filter(function (variant) {
      return variant === 'normal' || variant === 'small-caps';
    }).join('');
    var fontFamily = fixIOSSystemFonts(styles.fontFamily).join(', ');
    var fontSize = isDimensionToken(styles.fontSize) ? "" + styles.fontSize.number + styles.fontSize.unit : styles.fontSize.number + "px";
    return [[styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '), fontFamily, fontSize];
  };
  CanvasRenderer.prototype.renderTextNode = function (text, styles) {
    return __awaiter(this, void 0, void 0, function () {
      var _a, font, fontFamily, fontSize, _b, baseline, middle, paintOrder;
      var _this = this;
      return __generator(this, function (_c) {
        _a = this.createFontStyle(styles), font = _a[0], fontFamily = _a[1], fontSize = _a[2];
        this.ctx.font = font;
        this.ctx.direction = styles.direction === 1 /* RTL */ ? 'rtl' : 'ltr';
        this.ctx.textAlign = 'left';
        this.ctx.textBaseline = 'alphabetic';
        _b = this.fontMetrics.getMetrics(fontFamily, fontSize), baseline = _b.baseline, middle = _b.middle;
        paintOrder = styles.paintOrder;
        text.textBounds.forEach(function (text) {
          paintOrder.forEach(function (paintOrderLayer) {
            switch (paintOrderLayer) {
              case 0 /* FILL */:
                _this.ctx.fillStyle = asString(styles.color);
                _this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
                var textShadows = styles.textShadow;
                if (textShadows.length && text.text.trim().length) {
                  textShadows.slice(0).reverse().forEach(function (textShadow) {
                    _this.ctx.shadowColor = asString(textShadow.color);
                    _this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale;
                    _this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale;
                    _this.ctx.shadowBlur = textShadow.blur.number;
                    _this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
                  });
                  _this.ctx.shadowColor = '';
                  _this.ctx.shadowOffsetX = 0;
                  _this.ctx.shadowOffsetY = 0;
                  _this.ctx.shadowBlur = 0;
                }
                if (styles.textDecorationLine.length) {
                  _this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
                  styles.textDecorationLine.forEach(function (textDecorationLine) {
                    switch (textDecorationLine) {
                      case 1 /* UNDERLINE */:
                        // Draws a line at the baseline of the font
                        // TODO As some browsers display the line as more than 1px if the font-size is big,
                        // need to take that into account both in position and size
                        _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1);
                        break;
                      case 2 /* OVERLINE */:
                        _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top), text.bounds.width, 1);
                        break;
                      case 3 /* LINE_THROUGH */:
                        // TODO try and find exact position for line-through
                        _this.ctx.fillRect(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1);
                        break;
                    }
                  });
                }
                break;
              case 1 /* STROKE */:
                if (styles.webkitTextStrokeWidth && text.text.trim().length) {
                  _this.ctx.strokeStyle = asString(styles.webkitTextStrokeColor);
                  _this.ctx.lineWidth = styles.webkitTextStrokeWidth;
                  // eslint-disable-next-line @typescript-eslint/no-explicit-any
                  _this.ctx.lineJoin = !!window.chrome ? 'miter' : 'round';
                  _this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top + baseline);
                }
                _this.ctx.strokeStyle = '';
                _this.ctx.lineWidth = 0;
                _this.ctx.lineJoin = 'miter';
                break;
            }
          });
        });
        return [2 /*return*/];
      });
    });
  };
  CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
    if (image && container.intrinsicWidth > 0 && container.intrinsicHeight > 0) {
      var box = contentBox(container);
      var path = calculatePaddingBoxPath(curves);
      this.path(path);
      this.ctx.save();
      this.ctx.clip();
      this.ctx.drawImage(image, 0, 0, container.intrinsicWidth, container.intrinsicHeight, box.left, box.top, box.width, box.height);
      this.ctx.restore();
    }
  };
  CanvasRenderer.prototype.renderNodeContent = function (paint) {
    return __awaiter(this, void 0, void 0, function () {
      var container, curves, styles, _i, _a, child, image, image, iframeRenderer, canvas, size, _b, fontFamily, fontSize, baseline, bounds, x, textBounds, img, image, url, fontFamily, bounds;
      return __generator(this, function (_c) {
        switch (_c.label) {
          case 0:
            this.applyEffects(paint.getEffects(4 /* CONTENT */));
            container = paint.container;
            curves = paint.curves;
            styles = container.styles;
            _i = 0, _a = container.textNodes;
            _c.label = 1;
          case 1:
            if (!(_i < _a.length)) return [3 /*break*/, 4];
            child = _a[_i];
            return [4 /*yield*/, this.renderTextNode(child, styles)];
          case 2:
            _c.sent();
            _c.label = 3;
          case 3:
            _i++;
            return [3 /*break*/, 1];
          case 4:
            if (!(container instanceof ImageElementContainer)) return [3 /*break*/, 8];
            _c.label = 5;
          case 5:
            _c.trys.push([5, 7,, 8]);
            return [4 /*yield*/, this.context.cache.match(container.src)];
          case 6:
            image = _c.sent();
            this.renderReplacedElement(container, curves, image);
            return [3 /*break*/, 8];
          case 7:
            _c.sent();
            this.context.logger.error("Error loading image " + container.src);
            return [3 /*break*/, 8];
          case 8:
            if (container instanceof CanvasElementContainer) {
              this.renderReplacedElement(container, curves, container.canvas);
            }
            if (!(container instanceof SVGElementContainer)) return [3 /*break*/, 12];
            _c.label = 9;
          case 9:
            _c.trys.push([9, 11,, 12]);
            return [4 /*yield*/, this.context.cache.match(container.svg)];
          case 10:
            image = _c.sent();
            this.renderReplacedElement(container, curves, image);
            return [3 /*break*/, 12];
          case 11:
            _c.sent();
            this.context.logger.error("Error loading svg " + container.svg.substring(0, 255));
            return [3 /*break*/, 12];
          case 12:
            if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14];
            iframeRenderer = new CanvasRenderer(this.context, {
              scale: this.options.scale,
              backgroundColor: container.backgroundColor,
              x: 0,
              y: 0,
              width: container.width,
              height: container.height
            });
            return [4 /*yield*/, iframeRenderer.render(container.tree)];
          case 13:
            canvas = _c.sent();
            if (container.width && container.height) {
              this.ctx.drawImage(canvas, 0, 0, container.width, container.height, container.bounds.left, container.bounds.top, container.bounds.width, container.bounds.height);
            }
            _c.label = 14;
          case 14:
            if (container instanceof InputElementContainer) {
              size = Math.min(container.bounds.width, container.bounds.height);
              if (container.type === CHECKBOX) {
                if (container.checked) {
                  this.ctx.save();
                  this.path([new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79), new Vector(container.bounds.left + size * 0.16, container.bounds.top + size * 0.5549), new Vector(container.bounds.left + size * 0.27347, container.bounds.top + size * 0.44071), new Vector(container.bounds.left + size * 0.39694, container.bounds.top + size * 0.5649), new Vector(container.bounds.left + size * 0.72983, container.bounds.top + size * 0.23), new Vector(container.bounds.left + size * 0.84, container.bounds.top + size * 0.34085), new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79)]);
                  this.ctx.fillStyle = asString(INPUT_COLOR);
                  this.ctx.fill();
                  this.ctx.restore();
                }
              } else if (container.type === RADIO) {
                if (container.checked) {
                  this.ctx.save();
                  this.ctx.beginPath();
                  this.ctx.arc(container.bounds.left + size / 2, container.bounds.top + size / 2, size / 4, 0, Math.PI * 2, true);
                  this.ctx.fillStyle = asString(INPUT_COLOR);
                  this.ctx.fill();
                  this.ctx.restore();
                }
              }
            }
            if (isTextInputElement(container) && container.value.length) {
              _b = this.createFontStyle(styles), fontFamily = _b[0], fontSize = _b[1];
              baseline = this.fontMetrics.getMetrics(fontFamily, fontSize).baseline;
              this.ctx.font = fontFamily;
              this.ctx.fillStyle = asString(styles.color);
              this.ctx.textBaseline = 'alphabetic';
              this.ctx.textAlign = canvasTextAlign(container.styles.textAlign);
              bounds = contentBox(container);
              x = 0;
              switch (container.styles.textAlign) {
                case 1 /* CENTER */:
                  x += bounds.width / 2;
                  break;
                case 2 /* RIGHT */:
                  x += bounds.width;
                  break;
              }
              textBounds = bounds.add(x, 0, 0, -bounds.height / 2 + 1);
              this.ctx.save();
              this.path([new Vector(bounds.left, bounds.top), new Vector(bounds.left + bounds.width, bounds.top), new Vector(bounds.left + bounds.width, bounds.top + bounds.height), new Vector(bounds.left, bounds.top + bounds.height)]);
              this.ctx.clip();
              this.renderTextWithLetterSpacing(new TextBounds(container.value, textBounds), styles.letterSpacing, baseline);
              this.ctx.restore();
              this.ctx.textBaseline = 'alphabetic';
              this.ctx.textAlign = 'left';
            }
            if (!contains(container.styles.display, 2048 /* LIST_ITEM */)) return [3 /*break*/, 20];
            if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
            img = container.styles.listStyleImage;
            if (!(img.type === 0 /* URL */)) return [3 /*break*/, 18];
            image = void 0;
            url = img.url;
            _c.label = 15;
          case 15:
            _c.trys.push([15, 17,, 18]);
            return [4 /*yield*/, this.context.cache.match(url)];
          case 16:
            image = _c.sent();
            this.ctx.drawImage(image, container.bounds.left - (image.width + 10), container.bounds.top);
            return [3 /*break*/, 18];
          case 17:
            _c.sent();
            this.context.logger.error("Error loading list-style-image " + url);
            return [3 /*break*/, 18];
          case 18:
            return [3 /*break*/, 20];
          case 19:
            if (paint.listValue && container.styles.listStyleType !== -1 /* NONE */) {
              fontFamily = this.createFontStyle(styles)[0];
              this.ctx.font = fontFamily;
              this.ctx.fillStyle = asString(styles.color);
              this.ctx.textBaseline = 'middle';
              this.ctx.textAlign = 'right';
              bounds = new Bounds(container.bounds.left, container.bounds.top + getAbsoluteValue(container.styles.paddingTop, container.bounds.width), container.bounds.width, computeLineHeight(styles.lineHeight, styles.fontSize.number) / 2 + 1);
              this.renderTextWithLetterSpacing(new TextBounds(paint.listValue, bounds), styles.letterSpacing, computeLineHeight(styles.lineHeight, styles.fontSize.number) / 2 + 2);
              this.ctx.textBaseline = 'bottom';
              this.ctx.textAlign = 'left';
            }
            _c.label = 20;
          case 20:
            return [2 /*return*/];
        }
      });
    });
  };
  CanvasRenderer.prototype.renderStackContent = function (stack) {
    return __awaiter(this, void 0, void 0, function () {
      var _i, _a, child, _b, _c, child, _d, _e, child, _f, _g, child, _h, _j, child, _k, _l, child, _m, _o, child;
      return __generator(this, function (_p) {
        switch (_p.label) {
          case 0:
            if (contains(stack.element.container.flags, 16 /* DEBUG_RENDER */)) {
              debugger;
            }
            // https://www.w3.org/TR/css-position-3/#painting-order
            // 1. the background and borders of the element forming the stacking context.
            return [4 /*yield*/, this.renderNodeBackgroundAndBorders(stack.element)];
          case 1:
            // https://www.w3.org/TR/css-position-3/#painting-order
            // 1. the background and borders of the element forming the stacking context.
            _p.sent();
            _i = 0, _a = stack.negativeZIndex;
            _p.label = 2;
          case 2:
            if (!(_i < _a.length)) return [3 /*break*/, 5];
            child = _a[_i];
            return [4 /*yield*/, this.renderStack(child)];
          case 3:
            _p.sent();
            _p.label = 4;
          case 4:
            _i++;
            return [3 /*break*/, 2];
          case 5:
            // 3. For all its in-flow, non-positioned, block-level descendants in tree order:
            return [4 /*yield*/, this.renderNodeContent(stack.element)];
          case 6:
            // 3. For all its in-flow, non-positioned, block-level descendants in tree order:
            _p.sent();
            _b = 0, _c = stack.nonInlineLevel;
            _p.label = 7;
          case 7:
            if (!(_b < _c.length)) return [3 /*break*/, 10];
            child = _c[_b];
            return [4 /*yield*/, this.renderNode(child)];
          case 8:
            _p.sent();
            _p.label = 9;
          case 9:
            _b++;
            return [3 /*break*/, 7];
          case 10:
            _d = 0, _e = stack.nonPositionedFloats;
            _p.label = 11;
          case 11:
            if (!(_d < _e.length)) return [3 /*break*/, 14];
            child = _e[_d];
            return [4 /*yield*/, this.renderStack(child)];
          case 12:
            _p.sent();
            _p.label = 13;
          case 13:
            _d++;
            return [3 /*break*/, 11];
          case 14:
            _f = 0, _g = stack.nonPositionedInlineLevel;
            _p.label = 15;
          case 15:
            if (!(_f < _g.length)) return [3 /*break*/, 18];
            child = _g[_f];
            return [4 /*yield*/, this.renderStack(child)];
          case 16:
            _p.sent();
            _p.label = 17;
          case 17:
            _f++;
            return [3 /*break*/, 15];
          case 18:
            _h = 0, _j = stack.inlineLevel;
            _p.label = 19;
          case 19:
            if (!(_h < _j.length)) return [3 /*break*/, 22];
            child = _j[_h];
            return [4 /*yield*/, this.renderNode(child)];
          case 20:
            _p.sent();
            _p.label = 21;
          case 21:
            _h++;
            return [3 /*break*/, 19];
          case 22:
            _k = 0, _l = stack.zeroOrAutoZIndexOrTransformedOrOpacity;
            _p.label = 23;
          case 23:
            if (!(_k < _l.length)) return [3 /*break*/, 26];
            child = _l[_k];
            return [4 /*yield*/, this.renderStack(child)];
          case 24:
            _p.sent();
            _p.label = 25;
          case 25:
            _k++;
            return [3 /*break*/, 23];
          case 26:
            _m = 0, _o = stack.positiveZIndex;
            _p.label = 27;
          case 27:
            if (!(_m < _o.length)) return [3 /*break*/, 30];
            child = _o[_m];
            return [4 /*yield*/, this.renderStack(child)];
          case 28:
            _p.sent();
            _p.label = 29;
          case 29:
            _m++;
            return [3 /*break*/, 27];
          case 30:
            return [2 /*return*/];
        }
      });
    });
  };
  CanvasRenderer.prototype.mask = function (paths) {
    this.ctx.beginPath();
    this.ctx.moveTo(0, 0);
    this.ctx.lineTo(this.canvas.width, 0);
    this.ctx.lineTo(this.canvas.width, this.canvas.height);
    this.ctx.lineTo(0, this.canvas.height);
    this.ctx.lineTo(0, 0);
    this.formatPath(paths.slice(0).reverse());
    this.ctx.closePath();
  };
  CanvasRenderer.prototype.path = function (paths) {
    this.ctx.beginPath();
    this.formatPath(paths);
    this.ctx.closePath();
  };
  CanvasRenderer.prototype.formatPath = function (paths) {
    var _this = this;
    paths.forEach(function (point, index) {
      var start = isBezierCurve(point) ? point.start : point;
      if (index === 0) {
        _this.ctx.moveTo(start.x, start.y);
      } else {
        _this.ctx.lineTo(start.x, start.y);
      }
      if (isBezierCurve(point)) {
        _this.ctx.bezierCurveTo(point.startControl.x, point.startControl.y, point.endControl.x, point.endControl.y, point.end.x, point.end.y);
      }
    });
  };
  CanvasRenderer.prototype.renderRepeat = function (path, pattern, offsetX, offsetY) {
    this.path(path);
    this.ctx.fillStyle = pattern;
    this.ctx.translate(offsetX, offsetY);
    this.ctx.fill();
    this.ctx.translate(-offsetX, -offsetY);
  };
  CanvasRenderer.prototype.resizeImage = function (image, width, height) {
    var _a;
    if (image.width === width && image.height === height) {
      return image;
    }
    var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !== void 0 ? _a : document;
    var canvas = ownerDocument.createElement('canvas');
    canvas.width = Math.max(1, width);
    canvas.height = Math.max(1, height);
    var ctx = canvas.getContext('2d');
    ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, width, height);
    return canvas;
  };
  CanvasRenderer.prototype.renderBackgroundImage = function (container) {
    return __awaiter(this, void 0, void 0, function () {
      var index, _loop_1, this_1, _i, _a, backgroundImage;
      return __generator(this, function (_b) {
        switch (_b.label) {
          case 0:
            index = container.styles.backgroundImage.length - 1;
            _loop_1 = function (backgroundImage) {
              var image, url, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
              return __generator(this, function (_h) {
                switch (_h.label) {
                  case 0:
                    if (!(backgroundImage.type === 0 /* URL */)) return [3 /*break*/, 5];
                    image = void 0;
                    url = backgroundImage.url;
                    _h.label = 1;
                  case 1:
                    _h.trys.push([1, 3,, 4]);
                    return [4 /*yield*/, this_1.context.cache.match(url)];
                  case 2:
                    image = _h.sent();
                    return [3 /*break*/, 4];
                  case 3:
                    _h.sent();
                    this_1.context.logger.error("Error loading background-image " + url);
                    return [3 /*break*/, 4];
                  case 4:
                    if (image) {
                      _c = calculateBackgroundRendering(container, index, [image.width, image.height, image.width / image.height]), path = _c[0], x = _c[1], y = _c[2], width = _c[3], height = _c[4];
                      pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
                      this_1.renderRepeat(path, pattern, x, y);
                    }
                    return [3 /*break*/, 6];
                  case 5:
                    if (isLinearGradient$1(backgroundImage)) {
                      _d = calculateBackgroundRendering(container, index, [null, null, null]), path = _d[0], x = _d[1], y = _d[2], width = _d[3], height = _d[4];
                      _e = calculateGradientDirection(backgroundImage.angle, width, height), lineLength = _e[0], x0 = _e[1], x1 = _e[2], y0 = _e[3], y1 = _e[4];
                      canvas = document.createElement('canvas');
                      canvas.width = width;
                      canvas.height = height;
                      ctx = canvas.getContext('2d');
                      gradient_1 = ctx.createLinearGradient(x0, y0, x1, y1);
                      processColorStops(backgroundImage.stops, lineLength).forEach(function (colorStop) {
                        return gradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
                      });
                      ctx.fillStyle = gradient_1;
                      ctx.fillRect(0, 0, width, height);
                      if (width > 0 && height > 0) {
                        pattern = this_1.ctx.createPattern(canvas, 'repeat');
                        this_1.renderRepeat(path, pattern, x, y);
                      }
                    } else if (isRadialGradient$1(backgroundImage)) {
                      _f = calculateBackgroundRendering(container, index, [null, null, null]), path = _f[0], left = _f[1], top_1 = _f[2], width = _f[3], height = _f[4];
                      position = backgroundImage.position.length === 0 ? [FIFTY_PERCENT] : backgroundImage.position;
                      x = getAbsoluteValue(position[0], width);
                      y = getAbsoluteValue(position[position.length - 1], height);
                      _g = calculateRadius(backgroundImage, x, y, width, height), rx = _g[0], ry = _g[1];
                      if (rx > 0 && ry > 0) {
                        radialGradient_1 = this_1.ctx.createRadialGradient(left + x, top_1 + y, 0, left + x, top_1 + y, rx);
                        processColorStops(backgroundImage.stops, rx * 2).forEach(function (colorStop) {
                          return radialGradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
                        });
                        this_1.path(path);
                        this_1.ctx.fillStyle = radialGradient_1;
                        if (rx !== ry) {
                          midX = container.bounds.left + 0.5 * container.bounds.width;
                          midY = container.bounds.top + 0.5 * container.bounds.height;
                          f = ry / rx;
                          invF = 1 / f;
                          this_1.ctx.save();
                          this_1.ctx.translate(midX, midY);
                          this_1.ctx.transform(1, 0, 0, f, 0, 0);
                          this_1.ctx.translate(-midX, -midY);
                          this_1.ctx.fillRect(left, invF * (top_1 - midY) + midY, width, height * invF);
                          this_1.ctx.restore();
                        } else {
                          this_1.ctx.fill();
                        }
                      }
                    }
                    _h.label = 6;
                  case 6:
                    index--;
                    return [2 /*return*/];
                }
              });
            };
            this_1 = this;
            _i = 0, _a = container.styles.backgroundImage.slice(0).reverse();
            _b.label = 1;
          case 1:
            if (!(_i < _a.length)) return [3 /*break*/, 4];
            backgroundImage = _a[_i];
            return [5 /*yield**/, _loop_1(backgroundImage)];
          case 2:
            _b.sent();
            _b.label = 3;
          case 3:
            _i++;
            return [3 /*break*/, 1];
          case 4:
            return [2 /*return*/];
        }
      });
    });
  };
  CanvasRenderer.prototype.renderSolidBorder = function (color, side, curvePoints) {
    return __awaiter(this, void 0, void 0, function () {
      return __generator(this, function (_a) {
        this.path(parsePathForBorder(curvePoints, side));
        this.ctx.fillStyle = asString(color);
        this.ctx.fill();
        return [2 /*return*/];
      });
    });
  };
  CanvasRenderer.prototype.renderDoubleBorder = function (color, width, side, curvePoints) {
    return __awaiter(this, void 0, void 0, function () {
      var outerPaths, innerPaths;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            if (!(width < 3)) return [3 /*break*/, 2];
            return [4 /*yield*/, this.renderSolidBorder(color, side, curvePoints)];
          case 1:
            _a.sent();
            return [2 /*return*/];
          case 2:
            outerPaths = parsePathForBorderDoubleOuter(curvePoints, side);
            this.path(outerPaths);
            this.ctx.fillStyle = asString(color);
            this.ctx.fill();
            innerPaths = parsePathForBorderDoubleInner(curvePoints, side);
            this.path(innerPaths);
            this.ctx.fill();
            return [2 /*return*/];
        }
      });
    });
  };
  CanvasRenderer.prototype.renderNodeBackgroundAndBorders = function (paint) {
    return __awaiter(this, void 0, void 0, function () {
      var styles, hasBackground, borders, backgroundPaintingArea, side, _i, borders_1, border;
      var _this = this;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            this.applyEffects(paint.getEffects(2 /* BACKGROUND_BORDERS */));
            styles = paint.container.styles;
            hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
            borders = [{
              style: styles.borderTopStyle,
              color: styles.borderTopColor,
              width: styles.borderTopWidth
            }, {
              style: styles.borderRightStyle,
              color: styles.borderRightColor,
              width: styles.borderRightWidth
            }, {
              style: styles.borderBottomStyle,
              color: styles.borderBottomColor,
              width: styles.borderBottomWidth
            }, {
              style: styles.borderLeftStyle,
              color: styles.borderLeftColor,
              width: styles.borderLeftWidth
            }];
            backgroundPaintingArea = calculateBackgroundCurvedPaintingArea(getBackgroundValueForIndex(styles.backgroundClip, 0), paint.curves);
            if (!(hasBackground || styles.boxShadow.length)) return [3 /*break*/, 2];
            this.ctx.save();
            this.path(backgroundPaintingArea);
            this.ctx.clip();
            if (!isTransparent(styles.backgroundColor)) {
              this.ctx.fillStyle = asString(styles.backgroundColor);
              this.ctx.fill();
            }
            return [4 /*yield*/, this.renderBackgroundImage(paint.container)];
          case 1:
            _a.sent();
            this.ctx.restore();
            styles.boxShadow.slice(0).reverse().forEach(function (shadow) {
              _this.ctx.save();
              var borderBoxArea = calculateBorderBoxPath(paint.curves);
              var maskOffset = shadow.inset ? 0 : MASK_OFFSET;
              var shadowPaintingArea = transformPath$1(borderBoxArea, -maskOffset + (shadow.inset ? 1 : -1) * shadow.spread.number, (shadow.inset ? 1 : -1) * shadow.spread.number, shadow.spread.number * (shadow.inset ? -2 : 2), shadow.spread.number * (shadow.inset ? -2 : 2));
              if (shadow.inset) {
                _this.path(borderBoxArea);
                _this.ctx.clip();
                _this.mask(shadowPaintingArea);
              } else {
                _this.mask(borderBoxArea);
                _this.ctx.clip();
                _this.path(shadowPaintingArea);
              }
              _this.ctx.shadowOffsetX = shadow.offsetX.number + maskOffset;
              _this.ctx.shadowOffsetY = shadow.offsetY.number;
              _this.ctx.shadowColor = asString(shadow.color);
              _this.ctx.shadowBlur = shadow.blur.number;
              _this.ctx.fillStyle = shadow.inset ? asString(shadow.color) : 'rgba(0,0,0,1)';
              _this.ctx.fill();
              _this.ctx.restore();
            });
            _a.label = 2;
          case 2:
            side = 0;
            _i = 0, borders_1 = borders;
            _a.label = 3;
          case 3:
            if (!(_i < borders_1.length)) return [3 /*break*/, 13];
            border = borders_1[_i];
            if (!(border.style !== 0 /* NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
            if (!(border.style === 2 /* DASHED */)) return [3 /*break*/, 5];
            return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* DASHED */)];
          case 4:
            _a.sent();
            return [3 /*break*/, 11];
          case 5:
            if (!(border.style === 3 /* DOTTED */)) return [3 /*break*/, 7];
            return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* DOTTED */)];
          case 6:
            _a.sent();
            return [3 /*break*/, 11];
          case 7:
            if (!(border.style === 4 /* DOUBLE */)) return [3 /*break*/, 9];
            return [4 /*yield*/, this.renderDoubleBorder(border.color, border.width, side, paint.curves)];
          case 8:
            _a.sent();
            return [3 /*break*/, 11];
          case 9:
            return [4 /*yield*/, this.renderSolidBorder(border.color, side, paint.curves)];
          case 10:
            _a.sent();
            _a.label = 11;
          case 11:
            side++;
            _a.label = 12;
          case 12:
            _i++;
            return [3 /*break*/, 3];
          case 13:
            return [2 /*return*/];
        }
      });
    });
  };
  CanvasRenderer.prototype.renderDashedDottedBorder = function (color, width, side, curvePoints, style) {
    return __awaiter(this, void 0, void 0, function () {
      var strokePaths, boxPaths, startX, startY, endX, endY, length, dashLength, spaceLength, useLineDash, multiplier, numberOfDashes, minSpace, maxSpace, path1, path2, path1, path2;
      return __generator(this, function (_a) {
        this.ctx.save();
        strokePaths = parsePathForBorderStroke(curvePoints, side);
        boxPaths = parsePathForBorder(curvePoints, side);
        if (style === 2 /* DASHED */) {
          this.path(boxPaths);
          this.ctx.clip();
        }
        if (isBezierCurve(boxPaths[0])) {
          startX = boxPaths[0].start.x;
          startY = boxPaths[0].start.y;
        } else {
          startX = boxPaths[0].x;
          startY = boxPaths[0].y;
        }
        if (isBezierCurve(boxPaths[1])) {
          endX = boxPaths[1].end.x;
          endY = boxPaths[1].end.y;
        } else {
          endX = boxPaths[1].x;
          endY = boxPaths[1].y;
        }
        if (side === 0 || side === 2) {
          length = Math.abs(startX - endX);
        } else {
          length = Math.abs(startY - endY);
        }
        this.ctx.beginPath();
        if (style === 3 /* DOTTED */) {
          this.formatPath(strokePaths);
        } else {
          this.formatPath(boxPaths.slice(0, 2));
        }
        dashLength = width < 3 ? width * 3 : width * 2;
        spaceLength = width < 3 ? width * 2 : width;
        if (style === 3 /* DOTTED */) {
          dashLength = width;
          spaceLength = width;
        }
        useLineDash = true;
        if (length <= dashLength * 2) {
          useLineDash = false;
        } else if (length <= dashLength * 2 + spaceLength) {
          multiplier = length / (2 * dashLength + spaceLength);
          dashLength *= multiplier;
          spaceLength *= multiplier;
        } else {
          numberOfDashes = Math.floor((length + spaceLength) / (dashLength + spaceLength));
          minSpace = (length - numberOfDashes * dashLength) / (numberOfDashes - 1);
          maxSpace = (length - (numberOfDashes + 1) * dashLength) / numberOfDashes;
          spaceLength = maxSpace <= 0 || Math.abs(spaceLength - minSpace) < Math.abs(spaceLength - maxSpace) ? minSpace : maxSpace;
        }
        if (useLineDash) {
          if (style === 3 /* DOTTED */) {
            this.ctx.setLineDash([0, dashLength + spaceLength]);
          } else {
            this.ctx.setLineDash([dashLength, spaceLength]);
          }
        }
        if (style === 3 /* DOTTED */) {
          this.ctx.lineCap = 'round';
          this.ctx.lineWidth = width;
        } else {
          this.ctx.lineWidth = width * 2 + 1.1;
        }
        this.ctx.strokeStyle = asString(color);
        this.ctx.stroke();
        this.ctx.setLineDash([]);
        // dashed round edge gap
        if (style === 2 /* DASHED */) {
          if (isBezierCurve(boxPaths[0])) {
            path1 = boxPaths[3];
            path2 = boxPaths[0];
            this.ctx.beginPath();
            this.formatPath([new Vector(path1.end.x, path1.end.y), new Vector(path2.start.x, path2.start.y)]);
            this.ctx.stroke();
          }
          if (isBezierCurve(boxPaths[1])) {
            path1 = boxPaths[1];
            path2 = boxPaths[2];
            this.ctx.beginPath();
            this.formatPath([new Vector(path1.end.x, path1.end.y), new Vector(path2.start.x, path2.start.y)]);
            this.ctx.stroke();
          }
        }
        this.ctx.restore();
        return [2 /*return*/];
      });
    });
  };
  CanvasRenderer.prototype.render = function (element) {
    return __awaiter(this, void 0, void 0, function () {
      var stack;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            if (this.options.backgroundColor) {
              this.ctx.fillStyle = asString(this.options.backgroundColor);
              this.ctx.fillRect(this.options.x, this.options.y, this.options.width, this.options.height);
            }
            stack = parseStackingContexts(element);
            return [4 /*yield*/, this.renderStack(stack)];
          case 1:
            _a.sent();
            this.applyEffects([]);
            return [2 /*return*/, this.canvas];
        }
      });
    });
  };
  return CanvasRenderer;
}(Renderer);
var isTextInputElement = function (container) {
  if (container instanceof TextareaElementContainer) {
    return true;
  } else if (container instanceof SelectElementContainer) {
    return true;
  } else if (container instanceof InputElementContainer && container.type !== RADIO && container.type !== CHECKBOX) {
    return true;
  }
  return false;
};
var calculateBackgroundCurvedPaintingArea = function (clip, curves) {
  switch (clip) {
    case 0 /* BORDER_BOX */:
      return calculateBorderBoxPath(curves);
    case 2 /* CONTENT_BOX */:
      return calculateContentBoxPath(curves);
    case 1 /* PADDING_BOX */:
    default:
      return calculatePaddingBoxPath(curves);
  }
};
var canvasTextAlign = function (textAlign) {
  switch (textAlign) {
    case 1 /* CENTER */:
      return 'center';
    case 2 /* RIGHT */:
      return 'right';
    case 0 /* LEFT */:
    default:
      return 'left';
  }
};
// see https://github.com/niklasvh/html2canvas/pull/2645
var iOSBrokenFonts = ['-apple-system', 'system-ui'];
var fixIOSSystemFonts = function (fontFamilies) {
  return /iPhone OS 15_(0|1)/.test(window.navigator.userAgent) ? fontFamilies.filter(function (fontFamily) {
    return iOSBrokenFonts.indexOf(fontFamily) === -1;
  }) : fontFamilies;
};
var ForeignObjectRenderer = /** @class */function (_super) {
  __extends$1(ForeignObjectRenderer, _super);
  function ForeignObjectRenderer(context, options) {
    var _this = _super.call(this, context, options) || this;
    _this.canvas = options.canvas ? options.canvas : document.createElement('canvas');
    _this.ctx = _this.canvas.getContext('2d');
    _this.options = options;
    _this.canvas.width = Math.floor(options.width * options.scale);
    _this.canvas.height = Math.floor(options.height * options.scale);
    _this.canvas.style.width = options.width + "px";
    _this.canvas.style.height = options.height + "px";
    _this.ctx.scale(_this.options.scale, _this.options.scale);
    _this.ctx.translate(-options.x, -options.y);
    _this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale);
    return _this;
  }
  ForeignObjectRenderer.prototype.render = function (element) {
    return __awaiter(this, void 0, void 0, function () {
      var svg, img;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            svg = createForeignObjectSVG(this.options.width * this.options.scale, this.options.height * this.options.scale, this.options.scale, this.options.scale, element);
            return [4 /*yield*/, loadSerializedSVG(svg)];
          case 1:
            img = _a.sent();
            if (this.options.backgroundColor) {
              this.ctx.fillStyle = asString(this.options.backgroundColor);
              this.ctx.fillRect(0, 0, this.options.width * this.options.scale, this.options.height * this.options.scale);
            }
            this.ctx.drawImage(img, -this.options.x * this.options.scale, -this.options.y * this.options.scale);
            return [2 /*return*/, this.canvas];
        }
      });
    });
  };
  return ForeignObjectRenderer;
}(Renderer);
var loadSerializedSVG = function (svg) {
  return new Promise(function (resolve, reject) {
    var img = new Image();
    img.onload = function () {
      resolve(img);
    };
    img.onerror = reject;
    img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
  });
};
var Logger = /** @class */function () {
  function Logger(_a) {
    var id = _a.id,
      enabled = _a.enabled;
    this.id = id;
    this.enabled = enabled;
    this.start = Date.now();
  }
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  Logger.prototype.debug = function () {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
      args[_i] = arguments[_i];
    }
    if (this.enabled) {
      // eslint-disable-next-line no-console
      if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
        // eslint-disable-next-line no-console
        console.debug.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
      } else {
        this.info.apply(this, args);
      }
    }
  };
  Logger.prototype.getTime = function () {
    return Date.now() - this.start;
  };
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  Logger.prototype.info = function () {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
      args[_i] = arguments[_i];
    }
    if (this.enabled) {
      // eslint-disable-next-line no-console
      if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
        // eslint-disable-next-line no-console
        console.info.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
      }
    }
  };
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  Logger.prototype.warn = function () {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
      args[_i] = arguments[_i];
    }
    if (this.enabled) {
      // eslint-disable-next-line no-console
      if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
        // eslint-disable-next-line no-console
        console.warn.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
      } else {
        this.info.apply(this, args);
      }
    }
  };
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  Logger.prototype.error = function () {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
      args[_i] = arguments[_i];
    }
    if (this.enabled) {
      // eslint-disable-next-line no-console
      if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
        // eslint-disable-next-line no-console
        console.error.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
      } else {
        this.info.apply(this, args);
      }
    }
  };
  Logger.instances = {};
  return Logger;
}();
var Context = /** @class */function () {
  function Context(options, windowBounds) {
    var _a;
    this.windowBounds = windowBounds;
    this.instanceName = "#" + Context.instanceCount++;
    this.logger = new Logger({
      id: this.instanceName,
      enabled: options.logging
    });
    this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache$1(this, options);
  }
  Context.instanceCount = 1;
  return Context;
}();
var html2canvas = function (element, options) {
  if (options === void 0) {
    options = {};
  }
  return renderElement(element, options);
};
if (typeof window !== 'undefined') {
  CacheStorage.setContext(window);
}
var renderElement = function (element, opts) {
  return __awaiter(void 0, void 0, void 0, function () {
    var ownerDocument, defaultView, resourceOptions, contextOptions, windowOptions, windowBounds, context, foreignObjectRendering, cloneOptions, documentCloner, clonedElement, container, _a, width, height, left, top, backgroundColor, renderOptions, canvas, renderer, root, renderer;
    var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
    return __generator(this, function (_u) {
      switch (_u.label) {
        case 0:
          if (!element || typeof element !== 'object') {
            return [2 /*return*/, Promise.reject('Invalid element provided as first argument')];
          }
          ownerDocument = element.ownerDocument;
          if (!ownerDocument) {
            throw new Error("Element is not attached to a Document");
          }
          defaultView = ownerDocument.defaultView;
          if (!defaultView) {
            throw new Error("Document is not attached to a Window");
          }
          resourceOptions = {
            allowTaint: (_b = opts.allowTaint) !== null && _b !== void 0 ? _b : false,
            imageTimeout: (_c = opts.imageTimeout) !== null && _c !== void 0 ? _c : 15000,
            proxy: opts.proxy,
            useCORS: (_d = opts.useCORS) !== null && _d !== void 0 ? _d : false
          };
          contextOptions = __assign({
            logging: (_e = opts.logging) !== null && _e !== void 0 ? _e : true,
            cache: opts.cache
          }, resourceOptions);
          windowOptions = {
            windowWidth: (_f = opts.windowWidth) !== null && _f !== void 0 ? _f : defaultView.innerWidth,
            windowHeight: (_g = opts.windowHeight) !== null && _g !== void 0 ? _g : defaultView.innerHeight,
            scrollX: (_h = opts.scrollX) !== null && _h !== void 0 ? _h : defaultView.pageXOffset,
            scrollY: (_j = opts.scrollY) !== null && _j !== void 0 ? _j : defaultView.pageYOffset
          };
          windowBounds = new Bounds(windowOptions.scrollX, windowOptions.scrollY, windowOptions.windowWidth, windowOptions.windowHeight);
          context = new Context(contextOptions, windowBounds);
          foreignObjectRendering = (_k = opts.foreignObjectRendering) !== null && _k !== void 0 ? _k : false;
          cloneOptions = {
            allowTaint: (_l = opts.allowTaint) !== null && _l !== void 0 ? _l : false,
            onclone: opts.onclone,
            ignoreElements: opts.ignoreElements,
            inlineImages: foreignObjectRendering,
            copyStyles: foreignObjectRendering
          };
          context.logger.debug("Starting document clone with size " + windowBounds.width + "x" + windowBounds.height + " scrolled to " + -windowBounds.left + "," + -windowBounds.top);
          documentCloner = new DocumentCloner(context, element, cloneOptions);
          clonedElement = documentCloner.clonedReferenceElement;
          if (!clonedElement) {
            return [2 /*return*/, Promise.reject("Unable to find element in cloned iframe")];
          }
          return [4 /*yield*/, documentCloner.toIFrame(ownerDocument, windowBounds)];
        case 1:
          container = _u.sent();
          _a = isBodyElement(clonedElement) || isHTMLElement(clonedElement) ? parseDocumentSize(clonedElement.ownerDocument) : parseBounds(context, clonedElement), width = _a.width, height = _a.height, left = _a.left, top = _a.top;
          backgroundColor = parseBackgroundColor(context, clonedElement, opts.backgroundColor);
          renderOptions = {
            canvas: opts.canvas,
            backgroundColor: backgroundColor,
            scale: (_o = (_m = opts.scale) !== null && _m !== void 0 ? _m : defaultView.devicePixelRatio) !== null && _o !== void 0 ? _o : 1,
            x: ((_p = opts.x) !== null && _p !== void 0 ? _p : 0) + left,
            y: ((_q = opts.y) !== null && _q !== void 0 ? _q : 0) + top,
            width: (_r = opts.width) !== null && _r !== void 0 ? _r : Math.ceil(width),
            height: (_s = opts.height) !== null && _s !== void 0 ? _s : Math.ceil(height)
          };
          if (!foreignObjectRendering) return [3 /*break*/, 3];
          context.logger.debug("Document cloned, using foreign object rendering");
          renderer = new ForeignObjectRenderer(context, renderOptions);
          return [4 /*yield*/, renderer.render(clonedElement)];
        case 2:
          canvas = _u.sent();
          return [3 /*break*/, 5];
        case 3:
          context.logger.debug("Document cloned, element located at " + left + "," + top + " with size " + width + "x" + height + " using computed rendering");
          context.logger.debug("Starting DOM parsing");
          root = parseTree(context, clonedElement);
          if (backgroundColor === root.styles.backgroundColor) {
            root.styles.backgroundColor = COLORS.TRANSPARENT;
          }
          context.logger.debug("Starting renderer for element at " + renderOptions.x + "," + renderOptions.y + " with size " + renderOptions.width + "x" + renderOptions.height);
          renderer = new CanvasRenderer(context, renderOptions);
          return [4 /*yield*/, renderer.render(root)];
        case 4:
          canvas = _u.sent();
          _u.label = 5;
        case 5:
          if ((_t = opts.removeContainer) !== null && _t !== void 0 ? _t : true) {
            if (!DocumentCloner.destroy(container)) {
              context.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore");
            }
          }
          context.logger.debug("Finished rendering");
          return [2 /*return*/, canvas];
      }
    });
  });
};
var parseBackgroundColor = function (context, element, backgroundColorOverride) {
  var ownerDocument = element.ownerDocument;
  // http://www.w3.org/TR/css3-background/#special-backgrounds
  var documentBackgroundColor = ownerDocument.documentElement ? parseColor(context, getComputedStyle(ownerDocument.documentElement).backgroundColor) : COLORS.TRANSPARENT;
  var bodyBackgroundColor = ownerDocument.body ? parseColor(context, getComputedStyle(ownerDocument.body).backgroundColor) : COLORS.TRANSPARENT;
  var defaultBackgroundColor = typeof backgroundColorOverride === 'string' ? parseColor(context, backgroundColorOverride) : backgroundColorOverride === null ? COLORS.TRANSPARENT : 0xffffffff;
  return element === ownerDocument.documentElement ? isTransparent(documentBackgroundColor) ? isTransparent(bodyBackgroundColor) ? defaultBackgroundColor : bodyBackgroundColor : documentBackgroundColor : defaultBackgroundColor;
};

//
var script$31 = {
  name: 'xmlRobotPhone',
  props: {
    bookName: {
      type: String,
      default: '建筑构造'
    },
    robotData: {
      type: Object,
      default: () => {}
    },
    name: {
      type: String,
      default: '小新'
    },
    sysEnv: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      startTop: 0,
      startLeft: 0,
      top: 200,
      left: 0,
      width: 100,
      windowWidth: window.innerWidth,
      windowHeight: window.innerHeight,
      drag: false,
      show: false,
      question: '',
      list: [],
      minimize: false,
      //是否最小化
      click: false,
      exportStatic: false,
      conversationId: ''
    };
  },
  computed: {
    // 悬浮小智的宽度
    robotWidth() {
      let px = this.windowWidth / 750 * Number(this.width);
      return Math.floor(px);
    },
    robotX() {
      let px = this.windowWidth / 750 * Number(this.width);
      return this.windowWidth - Math.floor(px);
    },
    scale() {
      let scale = this.windowWidth / 750;
      return scale;
    }
  },
  mounted() {
    this.left = this.robotX;
    this.createAConversation();
  },
  methods: {
    // 打开Ai解析
    openAiAnalysis(type, question) {
      this.show = true;
      this.sendingMsg(question);
    },
    // 发送消息
    sendingMsg(question) {
      if (question.replace(/\s+/g, '') != '') {
        let rightData = {
          id: 'right_' + new Date().getTime(),
          direction: 'right',
          content: question.replace(/\s+/g, ''),
          type: 'text',
          loading: false,
          time: this.getTime(),
          videoUrl: '',
          question: question.replace(/\s+/g, ''),
          loadingCompleted: true
        };
        this.list.push(rightData);
        // 发送消息是创建一条内为空的回答
        let leftData = {
          id: 'left_' + new Date().getTime(),
          direction: 'left',
          content: '',
          type: 'text',
          loading: true,
          time: this.getTime(),
          videoUrl: '',
          question: question.replace(/\s+/g, ''),
          loadingCompleted: false
        };
        this.list.push(leftData);
        // this.scrollPage()
        // 获取回答内容
        this.loadData(question.replace(/\s+/g, ''), this.list.length - 1);
        this.question = '';
        setTimeout(() => {
          this.scrollToBottom();
        }, 200);
      }
    },
    // 创建消息
    async createAConversation() {
      fetch(this.robotData.baseUrl, {
        method: 'post',
        headers: {
          'Content-Type': 'application/json;charset=utf-8',
          Authorization: 'Bearer ' + this.robotData.token
        },
        body: JSON.stringify({
          app_id: this.robotData.appId,
          client_id: this.robotData.client_id,
          client_secret: this.robotData.token,
          user_id: String(this.robotData.user_id)
        })
      }).then(response => response.json()).then(json => {
        // this.conversationId = json.token.split('|')[0]
        this.conversationId = json.conversation_id;
        this.tmpToken = json.token;
      });
    },
    // 获取小智答疑答案
    async loadData(question, index) {
      this.$nextTick;
      let controller = new AbortController();
      try {
        const response = await fetch(this.robotData.conversationUrl, {
          method: 'post',
          headers: {
            'Content-Type': 'application/json;charset=utf-8',
            Authorization: 'Bearer ' + this.robotData.token
            // Authorization: 'Bearer ' + this.tmpToken
          },
          body: JSON.stringify({
            app_id: this.robotData.appId,
            query: question,
            stream: true,
            conversation_id: this.conversationId,
            signal: controller.signal
            // kb_id: 117,
            // kb_type: 'book',
            // message: question,
          })
        });
        const reader = response.body.getReader();
        let data = '';
        let videoUrl = '';
        let content = '';
        while (true) {
          const {
            done,
            value
          } = await reader.read();
          console.log('🚀 ~ loadData ~ done:', done);
          if (done) {
            this.list[index].loadingCompleted = true;
            // setLoading(false);
            break;
          }
          data = new TextDecoder().decode(value);
          if (data.indexOf('answer')) {
            let textList = data.split('"answer": "') || [];
            if (textList.length > 1) {
              let text = textList[1].split('", "conversation_id')[0] || '';
              if (text.replace(/\s+/g, '') != '') {
                // console.log(text,text.replace(/\n/g,'<br/>'));
                content += text.replace(/\\n/g, '<br/>');
                this.list[index].content = marked.parse(content);
                // console.log("🚀 ~ loadData ~ this.list[index].content:", this.list[index].content,this.list[index].content.replace(/\n/g,'<br/>'))
              }
            }
          }
          this.list[index].loading = false;
          this.list[index].type = 'text';

          // this.list[index].videoUrl = videoUrl
          setTimeout(() => {
            // this.scrollToBottom();
            let itemDom = document.getElementById('robot-content-' + index);
            let Dom = this.$refs.scrollDiv;
            Dom.scrollTop = itemDom.offsetTop + itemDom.offsetHeight - 500;
            // console.log(DOM.offsetHeight);
            // console.log(DOM.offsetTop);
          }, 200);
          // .then((response) => response.json())
          // .then((json) => {
          //   // console.log(json, 'ajkjijjj')
          //   let list = json.data.conversation.completions || []
          //   let content = ''
          //   list.map((item, index) => {
          //     content += item.content
          //     this.list[this.list.length - 1].content = marked.parse(content).replace( `${question}` ,'')
          //     this.list[this.list.length - 1].content = this.list[this.list.length - 1].content.replace(
          //       /##.*?\$\$/g,
          //       ''
          //     )
          //     this.list[this.list.length - 1].loading = false
          //     this.list[this.list.length - 1].loadingCompleted = true
          //     this.list[this.list.length - 1].type = 'text'
          //     // setTimeout(() => {
          //     //   let itemDom = document.getElementById('robot-content-' + index)
          //     //   let Dom = this.$refs.scrollDiv
          //     //   Dom.scrollTop = itemDom.offsetTop + itemDom.offsetHeight - 500
          //     // }, 200)
          //   })
          // })

          // const reader = response.body.getReader()
          // let data = ''
          // let videoUrl = ''
          // let content = ''
          // while (true) {
          //   const { done, value } = await reader.read()
          //   console.log('🚀 ~ loadData ~ done:', done)

          //   if (done) {
          //     this.list[index].loadingCompleted = true
          //     break
          //   }
          //   data = new TextDecoder().decode(value)
          //   if (data.indexOf('answer')) {
          //     let textList = data.split('"answer": "') || []
          //     if (textList.length > 1) {
          //       let text = textList[1].split('", "conversation_id')[0] || ''
          //       if (text.replace(/\s+/g, '') != '') {
          //         // this.list[index].content += text
          //         content += text.replace(/\\n/g,'<br/>')
          //         this.list[index].content =marked.parse(content)
          //       }
          //     }
          //   }

          //   this.list[index].loading = false

          //   this.list[index].type = 'text'

          //   setTimeout(() => {
          //     this.scrollToBottom()
          //   }, 200)
          // }
        }
      } catch {
        this.list[index].loading = false;
        this.list[index].loadingCompleted = true;
        this.list[index].content = '亲，我的知识库里无法找到答案，请您修改问题重新提问。';
        this.list[index].type = 'text';
      }
    },
    // 滚动内容
    scrollToBottom() {
      let Dom = this.$refs.scrollDiv;
      Dom.scrollTop = Dom.scrollHeight;
    },
    // 删除消息
    removalMessage(item, index) {
      this.list.splice(index, 1);
    },
    // 刷新消息
    refreshMessage(item, index) {
      this.list[index].loadingCompleted = false;
      this.list[index].loading = true;
      this.list[index].content = '';
      this.list[index].type = '';
      this.list[index].videoUrl = '';
      this.loadData(item.question, index);
    },
    // 点击小智
    clickRobot() {
      if (this.minimize) {
        this.minimize = false;
        this.width = 100;
        this.$nextTick(() => {
          this.left = this.robotX;
        });
      } else {
        this.show = true;
      }
    },
    onTouchstart(e) {
      this.drag = true;
      this.click = true;
      this.startTop = e.touches[0].radiusY;
      this.startLeft = e.touches[0].radiusX;
      setTimeout(() => {
        this.click = false;
      }, 200);
    },
    noTouchmove(e) {
      let top = e.changedTouches[0].clientY - this.startTop;
      let left = e.changedTouches[0].clientX - this.startLeft;
      if (left > -20 && top > -20 && left < this.robotX + 20 && top < this.windowHeight - 60 && !this.minimize) {
        this.top = e.changedTouches[0].clientY - this.startTop;
        this.left = e.changedTouches[0].clientX - this.startLeft;
      }
    },
    // 手指松开
    onMouseup(e) {
      this.drag = false;
      if (!this.click) {
        let robotX = this.windowWidth - (e.changedTouches[0].clientX + (this.robotWidth - this.startLeft));
        if (robotX < -10) {
          this.minimize = true;
          this.width = 30;
        }
        this.$nextTick(() => {
          this.left = this.robotX;
        });
      }
    },
    /**
     * 将页面指定节点内容转为图片
     * 1.拿到想要转换为图片的内容节点DOM；
     * 2.转换，拿到转换后的canvas
     * 3.转换为图片
     */
    clickGeneratePicture() {
      // const loading = this.$loading({
      //   lock: true,
      //   text: "正在生成图片",
      //   spinner: "el-icon-loading",
      //   background: "rgba(0, 0, 0, 0.7)",
      // });
      this.exportStatic = true;
      setTimeout(() => {
        html2canvas(this.$refs.downloadDom, {
          allowTaint: true,
          // 允许渲染跨域图片
          scale: window.devicePixelRatio * 2,
          // 增加清晰度
          useCORS: true // 允许跨域
        }).then(canvas => {
          this.exportStatic = false;
          // 转成图片，生成图片地址
          let imgUrl = canvas.toDataURL('image/png');
          console.log('🚀 ~ file: xmlRobot.vue:345 ~ clickGeneratePicture ~ imgUrl:', imgUrl);
          document.querySelector('#downimg').href = imgUrl;
          document.querySelector('#downimg').download = new Date().getTime() + '.png';
          document.querySelector('#downimg').click();
          // loading.close();
        });
      }, 1000);
    },
    // 获取当前时间
    getTime() {
      let date = new Date();
      let h = date.getHours();
      let m = date.getMinutes();
      return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m);
    }
  }
};

var __$_require_static_images_icons_ai_xiaozhi_logo2_png__ = "data:image/png;base64,[encoded data, 6932 characters]";

/* script */
const __vue_script__$31 = script$31;
var __vue_render__$31 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-robot-content-phone",
      class: _vm.show ? "pointer-events" : "",
    },
    [
      _c(
        "div",
        {
          staticClass: "levitated-sphere",
          class: _vm.minimize ? "min-robot" : !_vm.drag ? "drag-left" : "",
          style: {
            width: _vm.robotWidth + "px",
            top: _vm.top + "px",
            left: _vm.left + "px",
            height: 192 * _vm.scale + "px",
          },
          on: {
            touchstart: function ($event) {
              $event.preventDefault();
              return _vm.onTouchstart.apply(null, arguments)
            },
            touchmove: function ($event) {
              $event.preventDefault();
              return _vm.noTouchmove.apply(null, arguments)
            },
            touchend: function ($event) {
              $event.preventDefault();
              return _vm.onMouseup.apply(null, arguments)
            },
            click: _vm.clickRobot,
          },
        },
        [
          _c("div", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.minimize,
                expression: "!minimize",
              },
            ],
            staticClass: "xml-robot-image",
            style: {
              width: 160 * _vm.scale + "px",
              height: 192 * _vm.scale + "px",
            },
          }),
        ]
      ),
      _vm._v(" "),
      _c(
        "van-popup",
        {
          attrs: { position: "bottom", round: "" },
          model: {
            value: _vm.show,
            callback: function ($$v) {
              _vm.show = $$v;
            },
            expression: "show",
          },
        },
        [
          _c("div", { staticClass: "xml-robot-content" }, [
            _c(
              "div",
              {
                staticClass: "navbar-box",
                style: {
                  width: 750 * _vm.scale + "px",
                  height: 80 * _vm.scale + "px",
                },
              },
              [
                _c("img", {
                  style: { width: 76 * _vm.scale + "px" },
                  attrs: {
                    src: __$_require_static_images_icons_ai_xiaozhi_logo2_png__,
                    alt: "",
                  },
                }),
                _vm._v(" "),
                _c("span", { style: { fontSize: 34 * _vm.scale + "px" } }, [
                  _vm._v(_vm._s(_vm.name) + "AI"),
                ]),
              ]
            ),
            _vm._v(" "),
            _c(
              "div",
              {
                ref: "scrollDiv",
                staticClass: "robot-dialog-box",
                style: { height: "calc(80vh - " + 220 * _vm.scale + "px)" },
              },
              [
                _c(
                  "div",
                  {
                    staticClass: "xiaozhi-tips",
                    style: {
                      fontSize: 22 * _vm.scale + "px",
                      lineHeight: 48 * _vm.scale + "px",
                      padding: 26 * _vm.scale + "px",
                    },
                  },
                  [
                    _vm._v(
                      "\n          你好，我是你的学习助手“" +
                        _vm._s(_vm.name) +
                        "”\n          ，我可以为你解答此教材相关的内容，如章节摘要、段意总结、习题解析等，试试在下方输入问题吧\n        "
                    ),
                  ]
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    ref: "downloadDom",
                    staticClass: "robot-dialog-main",
                    style: { padding: "0 " + 32 * _vm.scale + "px" },
                  },
                  _vm._l(_vm.list, function (item, index) {
                    return _c(
                      "div",
                      {
                        key: index,
                        staticClass: "robot-item-box",
                        style: { paddingBottom: 56 * _vm.scale + "px" },
                      },
                      [
                        _c(
                          "div",
                          {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: item.direction === "right",
                                expression: "item.direction === 'right'",
                              },
                            ],
                            staticClass: "timer",
                            style: {
                              fontSize: 24 * _vm.scale + "px",
                              lineHeight: 30 * _vm.scale + "px",
                              paddingBottom: 34 * _vm.scale + "px",
                            },
                          },
                          [
                            _vm._v(
                              "\n              " +
                                _vm._s(item.time) +
                                "\n            "
                            ),
                          ]
                        ),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            staticClass: "item",
                            class: item.direction + "-item",
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value:
                                      item.direction === "right" &&
                                      !_vm.exportStatic,
                                    expression:
                                      "item.direction === 'right' && !exportStatic",
                                  },
                                ],
                                staticClass: "icon-box",
                                style: {
                                  width: 42 * _vm.scale + "px",
                                  paddingRight: 16 * _vm.scale + "px",
                                },
                              },
                              [
                                _c("div", {
                                  staticClass: "delete",
                                  style: {
                                    width: 26 * _vm.scale + "px",
                                    height: 30 * _vm.scale + "px",
                                    paddingRight: 16 * _vm.scale + "px",
                                  },
                                  on: {
                                    click: function ($event) {
                                      return _vm.removalMessage(item, index)
                                    },
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "content-box",
                                class: item.direction,
                                style: {
                                  maxWidth:
                                    "calc(100% - " + 42 * _vm.scale + "px)",
                                  minHeight: 70 * _vm.scale + "px",
                                  padding:
                                    28 * _vm.scale +
                                    "px " +
                                    30 * _vm.scale +
                                    "px",
                                  fontSize: 28 * _vm.scale + "px",
                                  lineHeight: 34 * _vm.scale + "px",
                                },
                              },
                              [
                                _c("div", {
                                  domProps: {
                                    innerHTML: _vm._s(
                                      item.content
                                        ? item.content
                                        : "正在生成 . . ."
                                    ),
                                  },
                                }),
                                _vm._v(" "),
                                item.videoUrl
                                  ? _c("div", [
                                      _vm._v(
                                        "\n                  下面“" +
                                          _vm._s(_vm.name) +
                                          "”还为您推荐视频\n                  "
                                      ),
                                      _vm._v(" "),
                                      item.videoUrl
                                        ? _c(
                                            "video",
                                            {
                                              staticStyle: {
                                                margin: "14px 0 0 0",
                                              },
                                              attrs: {
                                                width: "100%",
                                                controls: "",
                                                controlslist: "nodownload",
                                              },
                                            },
                                            [
                                              _c("source", {
                                                attrs: {
                                                  src: item.videoUrl,
                                                  type: "video/mp4",
                                                },
                                              }),
                                            ]
                                          )
                                        : _vm._e(),
                                    ])
                                  : _vm._e(),
                                _vm._v(" "),
                                !item.loadingCompleted
                                  ? _c("div", {
                                      staticClass: "loading-box",
                                      style: {
                                        height: 12 * _vm.scale + "px",
                                        border:
                                          "0 0 " +
                                          16 * _vm.scale +
                                          "px " +
                                          16 * _vm.scale +
                                          "px",
                                      },
                                    })
                                  : _vm._e(),
                              ]
                            ),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value:
                                      item.direction === "left" &&
                                      item.loadingCompleted &&
                                      !_vm.exportStatic,
                                    expression:
                                      "item.direction === 'left' && item.loadingCompleted && !exportStatic",
                                  },
                                ],
                                staticClass: "icon-box",
                                style: {
                                  width: 42 * _vm.scale + "px",
                                  paddingLeft: 16 * _vm.scale + "px",
                                },
                              },
                              [
                                _c("div", {
                                  staticClass: "delete",
                                  style: {
                                    width: 26 * _vm.scale + "px",
                                    height: 30 * _vm.scale + "px",
                                    paddingRight: 16 * _vm.scale + "px",
                                  },
                                  on: {
                                    click: function ($event) {
                                      return _vm.removalMessage(item, index)
                                    },
                                  },
                                }),
                                _vm._v(" "),
                                _c("div", {
                                  staticClass: "refresh",
                                  style: {
                                    width: 26 * _vm.scale + "px",
                                    height: 30 * _vm.scale + "px",
                                    marginTop: 14 * _vm.scale + "px",
                                  },
                                  on: {
                                    click: function ($event) {
                                      return _vm.refreshMessage(item, index)
                                    },
                                  },
                                }),
                              ]
                            ),
                          ]
                        ),
                      ]
                    )
                  }),
                  0
                ),
              ]
            ),
            _vm._v(" "),
            _c(
              "div",
              {
                staticClass: "bottom-box",
                style: {
                  bottom: 0,
                  height: 160 * _vm.scale + "px",
                  padding: 28 * _vm.scale + "px",
                },
              },
              [
                _c(
                  "div",
                  {
                    staticClass: "input-right",
                    style: {
                      width: 684 * _vm.scale + "px",
                      borderRadius: 10 * _vm.scale + "px",
                      padding:
                        4 * _vm.scale +
                        "px " +
                        20 * _vm.scale +
                        "px " +
                        4 * _vm.scale +
                        "px 0",
                    },
                  },
                  [
                    _c("textarea", {
                      directives: [
                        {
                          name: "model",
                          rawName: "v-model",
                          value: _vm.question,
                          expression: "question",
                        },
                      ],
                      staticClass: "input-content",
                      style: {
                        width: "calc(100% - " + 40 * _vm.scale + "px)",
                        maxHeight: 80 * _vm.scale + "px",
                        padding: 12 * _vm.scale + "px " + 20 * _vm.scale + "px",
                        fontSize: 28 * _vm.scale + "px",
                        borderRadius: 10 * _vm.scale + "px",
                      },
                      attrs: { placeholder: "请输入问题描述" },
                      domProps: { value: _vm.question },
                      on: {
                        input: function ($event) {
                          if ($event.target.composing) {
                            return
                          }
                          _vm.question = $event.target.value;
                        },
                      },
                    }),
                    _vm._v(" "),
                    _c("div", {
                      staticClass: "sending",
                      style: {
                        width: 24 * _vm.scale + "px",
                        height: 32 * _vm.scale + "px",
                      },
                      on: {
                        click: function ($event) {
                          return _vm.sendingMsg(_vm.question)
                        },
                      },
                    }),
                  ]
                ),
              ]
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$31 = [];
__vue_render__$31._withStripped = true;

  /* style */
  const __vue_inject_styles__$31 = undefined;
  /* scoped */
  const __vue_scope_id__$31 = "data-v-0439b525";
  /* module identifier */
  const __vue_module_identifier__$31 = undefined;
  /* functional template */
  const __vue_is_functional_template__$31 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$31 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$31, staticRenderFns: __vue_staticRenderFns__$31 },
    __vue_inject_styles__$31,
    __vue_script__$31,
    __vue_scope_id__$31,
    __vue_is_functional_template__$31,
    __vue_module_identifier__$31,
    false,
    undefined,
    undefined,
    undefined
  );

var getRobotData = {
  data() {
    return {
      elfinList: [{
        id: '001',
        title: 'Ai助教',
        type: 'xml'
      }, {
        id: '002',
        title: 'deepseek',
        type: 'deepseek'
      }, {
        id: '003',
        title: '文心一言',
        type: 'qianfan'
      }, {
        id: '004',
        title: '豆包',
        type: 'doubao'
      }, {
        id: '005',
        title: 'AI试题',
        type: 'bailian'
      }],
      elfinData: {},
      robotSign: '-robot-sign',
      answerData: {
        xml: [],
        deepseek: [],
        qianfan: [],
        doubao: [],
        bailian: []
      },
      qianfanConversationId: '',
      bailianConversationId: '',
      messages: []
    };
  },
  methods: {
    // 初始化机器人
    initRobot() {
      if (this.robotData.xml) {
        this.createXmlConversation();
      }
      if (this.robotData.qianfan) {
        this.createQianfanConversation();
      }
    },
    // 打开对话框
    openRobot(item) {
      if (this.elfinData.type != item.type) {
        // let data = sessionStorage.getItem(this.elfinData.type+this.robotSign)||'[]'
        // this.list= JSON.parse(data)
        if (this.robotData[item.type]) {
          console.log(item, '内容是', this.robotData, '乐乐了', this.elfinData);
          this.elfinData = item;
          this.robotShwo = true;
          this.show = true;
          if (this.elfinData.type == 'bailian') {
            this.createBaiLianConversation();
            this.answerData[this.elfinData.type][0] = {
              content: '多学科智能命题，辅助学习的好帮手。 <br> 试试说：“八年级物理力学单元测验，20道题”',
              direction: "left",
              id: 0,
              loading: false,
              loadingCompleted: true,
              type: 'text'
            };
          }
          setTimeout(() => {
            this.saveData(this.answerData[this.elfinData.type].length - 1);
          });
        } else {
          this.$message({
            showClose: true,
            message: '该功能暂未开启',
            type: 'warning'
          });
        }
      }
    },
    // 调用不同的al接口
    async loadData(question, index) {
      console.log(this.elfinData, 'elfinData.type');
      if (this.elfinData.type == 'xml') {
        this.getSmileData(question, index);
      } else if (this.elfinData.type == 'deepseek') {
        this.getDeepseekData(question, index);
      } else if (this.elfinData.type == 'qianfan') {
        this.getQianFanData(question, index);
      } else if (this.elfinData.type == 'doubao') {
        this.getDouBaoData(question, index);
      } else if (this.elfinData.type == 'bailian') {
        this.getBaiLianData(question, index);
      }
    },
    // 获取斯麦尔模型会话ID
    async createXmlConversation() {
      console.log(this.textBookId, '获取斯麦尔模型会话ID');
      const bookId = {
        "1851240843253485569": "118",
        "1906522834656100352": "121",
        "1894995909482508288": '122'
      };
      fetch(this.robotData.xml.baseUrl, {
        method: 'post',
        headers: {
          'Content-Type': 'application/json',
          Authorization: 'Bearer ' + this.robotData.xml.token
        },
        body: JSON.stringify({
          app_id: this.robotData.xml.appId,
          client_id: this.robotData.xml.client_id,
          client_secret: this.robotData.xml.token,
          user_id: String(this.robotData.xml.user_id)
        })
      }).then(response => response.json()).then(json => {
        // this.conversationId = json.conversation_id
        // this.conversationId = json.data.token.split('|')[0]
        this.tmpToken = json.data.token;
        // console.log(json,this.conversationId, 'conversationIdconversationIdconversationId')

        fetch(this.robotData.xml.conversationUrl, {
          method: 'post',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + this.tmpToken
          },
          body: JSON.stringify({
            app_id: this.robotData.xml.appId,
            // conversation_id: this.conversationId,
            kb_id: bookId[this.textBookId] || this.robotData.xml.kbId,
            kb_type: 'book',
            message: ''

            // content_text:'出版学是一门应用科学，研究编辑、出',
            // title:'出版学',
            // outside_uid:'8899'
          })
        }).then(response => response.json()).then(json => {
          // this.conversationId = json.conversation_id
          console.log(json.data.conversation.id, 'kkksksksk');
          this.conversationId = json.data.conversation.id;
        });
      });
    },
    // 获取斯麦尔模型回答
    async getSmileData(question, index) {
      let controller = new AbortController();
      try {
        const response = await fetch(this.robotData.xml.conversationUrl + '/' + this.conversationId, {
          method: 'put',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + this.tmpToken
          },
          body: JSON.stringify({
            message: question,
            stream: 1,
            signal: controller.signal
          })
        });
        const reader = response.body.getReader();
        let data = '';
        let content = '';
        while (true) {
          const {
            done,
            value
          } = await reader.read();
          if (done) {
            this.answerData['xml'][index].loadingCompleted = true;
            break;
          }
          data = new TextDecoder().decode(value);
          // console.log(data, 'ddddddddddddddd')
          if (data.indexOf(',"data":true') == -1) {
            let list = data.split('data: ') || [];
            // console.log(list,'aaaaaaaaa');

            this.answerData['xml'][index].loading = false;
            this.answerData['xml'][index].type = 'text';
            list.map(item => {
              if (item && item != '\n\n' && item != '\n') {
                let json = JSON.parse(item);
                // console.log(json,'ddkk');

                let text = json.complete.content || '';
                content = text.replace(/\\n/g, '<br/>');
                this.answerData['xml'][index].content = marked.parse(content);
                this.saveData(index);
              }
            });
          } else {
            this.answerData['xml'][index].loadingCompleted = true;
          }
        }
      } catch {
        this.getErrorData(question, index, 'xml');
      }
      // let controller = new AbortController()
      // try {
      //   const response = fetch(this.robotData.xml.conversationUrl, {
      //     method: 'post',
      //     headers: {
      // 'Content-Type': 'application/json',
      // Authorization: 'Bearer ' + this.tmpToken
      //     },
      //     body: JSON.stringify({
      // app_id: this.robotData.xml.appId,
      // query: question,
      // conversation_id: this.conversationId,
      // kb_id: this.robotData.xml.kbId,
      // kb_type: 'book',
      // message: question,
      // stream:1,
      // signal: controller.signal
      //     })
      //   })
      //   const reader = response.body.getReader()
      //   let data = ''
      //   let content = ''
      //   while (true) {
      //     const { done, value } = await reader.read()

      //     // if (done) {
      //     //   this.answerData['qianfan'][index].loadingCompleted = true
      //     //   break
      //     // }
      //     // let data=decoder.decode(value);
      //     data = new TextDecoder().decode(value)
      //     console.log(data, 'data');

      //     // if (data.indexOf('data: [DONE]') == -1) {
      //     //   let list = data.split('data: ') || []
      //     //   this.answerData['deepseek'][index].loading = false
      //     //   this.answerData['deepseek'][index].type = 'text'
      //     //   list.map((item) => {
      //     //     if (item) {
      //     //       let json = JSON.parse(item)
      //     //       let text = json.choices[0].delta.content || ''
      //     //       content += text.replace(/\\n/g, '<br/>')
      //     //       this.answerData['deepseek'][index].content = marked.parse(content)
      //     //       this.saveData(index)
      //     //     }
      //     //   })
      //     // } else {
      //     //   // this.answerData['deepseek'][index].loadingCompleted = true
      //     // }
      //   }

      //     // .then((response) => response.json())
      //     // .then((json) => {
      //     //   console.log(json, 'ajkjijjj')
      //     //   if (json.code == 200) {
      //     //     let list = json.data.conversation.completions || []
      //     //     let content = ''
      //     //     list.map((item, index) => {
      //     //       content += item.content
      //     //       this.answerData['xml'][this.answerData['xml'].length - 1].content = marked
      //     //         .parse(content)
      //     //         .replace(`${question}`, '')
      //     //       this.answerData['xml'][this.answerData['xml'].length - 1].content = this.answerData['xml'][
      //     //         this.answerData['xml'].length - 1
      //     //       ].content.replace(/##.*?\$\$/g, '')
      //     //       this.answerData['xml'][this.answerData['xml'].length - 1].loading = false
      //     //       this.answerData['xml'][this.answerData['xml'].length - 1].loadingCompleted = true
      //     //       this.answerData['xml'][this.answerData['xml'].length - 1].type = 'text'
      //     //     })
      //     //     this.saveData(index)
      //     //   } else {
      //     //     this.getErrorData(question, index, 'xml')
      //     //   }
      //     // })
      // } catch {
      //   this.getErrorData(question, index, 'xml')
      // }
    },
    // //   获取deepseek回答
    // getDeepseekData(question, index) {
    //   try {
    //     fetch('http://192.168.1.220:8001/v1/chat', {
    //       method: 'post',
    //       headers: {
    //         'Content-Type': 'application/json'
    //       },
    //       body: JSON.stringify({
    //         prompt: question
    //       })
    //     })
    //       .then((response) => response.json())
    //       .then((json) => {
    // this.answerData['deepseek'][index].content = json.content
    // this.answerData['deepseek'][index].loading = false
    // this.answerData['deepseek'][index].loadingCompleted = true
    // this.answerData['deepseek'][index].type = 'text'
    // this.saveData(index)
    //       })
    //   } catch {
    //     this.getErrorData(question, index, 'deepseek')
    //   }
    // },

    //   获取deepseek回答
    async getDeepseekData(question, index) {
      this.messages = [{
        role: 'user',
        content: '你是AI智能助手，请根据用户问题给出解答'
      }]; //清空消息记录,防止连续思考
      this.messages.push({
        role: 'user',
        content: question
      });
      let controller = new AbortController();
      try {
        const response = await fetch(this.robotData.deepseek.conversationUrl, {
          method: 'post',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + this.robotData.deepseek.token
          },
          body: JSON.stringify({
            model: this.robotData.deepseek.model,
            messages: this.messages,
            temperature: this.robotData.deepseek.temperature,
            max_tokens: this.robotData.deepseek.max_tokens,
            stream: true,
            signal: controller.signal
          })
        });
        const reader = response.body.getReader();
        let data = '';
        let content = '';
        while (true) {
          const {
            done,
            value
          } = await reader.read();
          if (done) {
            this.answerData['deepseek'][index].loadingCompleted = true;
            break;
          }
          // let data=decoder.decode(value);

          data = new TextDecoder().decode(value);
          if (data.indexOf('data: [DONE]') == -1) {
            let list = data.split('data: ') || [];
            this.answerData['deepseek'][index].loading = false;
            this.answerData['deepseek'][index].type = 'text';
            list.map(item => {
              if (item) {
                let json = JSON.parse(item);
                let text = json.choices[0].delta.content || '';
                content += text.replace(/\\n/g, '<br/>');
                this.answerData['deepseek'][index].content = marked.parse(content);
                this.saveData(index);
              }
            });
            console.log(list, 'map000');
          } else {
            this.answerData['deepseek'][index].loadingCompleted = true;
          }
        }
      } catch {
        this.getErrorData(question, index, 'deepseek');
      }
    },
    // 获取千帆模型会话ID
    async createQianfanConversation() {
      fetch(this.robotData.qianfan.baseUrl, {
        method: 'post',
        headers: {
          'Content-Type': 'application/json;charset=utf-8'
          // Authorization: 'Bearer ' + this.robotData.qianfan.token
        },
        body: JSON.stringify({
          token: 'Bearer ' + this.robotData.qianfan.token,
          app_id: this.robotData.qianfan.appId
        })
      }).then(response => response.json()).then(json => {
        this.qianfanConversationId = json.data.conversation_id;
      });
    },
    // 获取千帆回答
    /**
     * 异步获取千帆API的流式对话数据并实时更新答案内容
     * @param {string} question - 用户输入的问题或对话内容
     * @param {number} index - 当前答案在答案数组中的索引位置
     */
    async getQianFanData(question, index) {
      // 创建请求中断控制器用于可能的请求中止
      let controller = new AbortController();
      try {
        // 发送流式对话请求到千帆API
        const response = await fetch(this.robotData.qianfan.conversationUrl, {
          method: 'post',
          headers: {
            'Content-Type': 'application/json;charset:utf-8'
          },
          // 构造包含认证令牌和应用ID的请求体
          body: JSON.stringify({
            token: 'Bearer ' + this.robotData.qianfan.token,
            app_id: 'e87e452e-de5a-4bce-a33f-41cde439a2f7',
            query: question,
            stream: true,
            conversation_id: this.qianfanConversationId,
            signal: controller.signal
          })
        });

        // 处理流式响应数据
        const reader = response.body.getReader();
        let data = '';
        let content = '';
        // 持续读取流数据直到完成
        while (true) {
          const {
            done,
            value
          } = await reader.read();

          // 流结束时标记完成状态
          if (done) {
            this.answerData['qianfan'][index].loadingCompleted = true;
            break;
          }

          // 解码并处理服务端推送的事件数据
          data = new TextDecoder().decode(value);
          let list = data.split('data: ') || [];
          this.answerData['qianfan'][index].loading = false;
          this.answerData['qianfan'][index].type = 'text';

          // 解析每个事件数据块并拼接答案内容
          list.map(item => {
            if (item && item != '\n\n') {
              let json = {};
              try {
                json = JSON.parse(item) || {};
              } catch (e) {}
              let text = json.answer || '';
              // 格式化文本内容并转换为Markdown
              content += text.replace(/\\n/g, '<br/>');
              this.answerData['qianfan'][index].content = marked.parse(content);
              this.saveData(index);
            }
          });
        }
      } catch {
        // 异常处理：获取并记录错误数据
        this.getErrorData(question, index, 'qianfan');
      }
    },
    // 获取豆包回答
    async getDouBaoData(question, index) {
      this.messages = [{
        role: 'user',
        content: '你是AI智能助手，请根据用户问题给出解答'
      }]; //清空消息记录,防止连续思考
      this.messages.push({
        role: 'user',
        content: question
      });
      new AbortController();
      try {
        const response = await fetch(this.robotData.doubao.conversationUrl, {
          method: 'post',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + this.robotData.doubao.token
          },
          body: JSON.stringify({
            model: this.robotData.doubao.model,
            messages: this.messages,
            temperature: this.robotData.doubao.temperature,
            max_tokens: this.robotData.doubao.max_tokens,
            stream: true
          })
        });
        const reader = response.body.getReader();
        let data = '';
        let content = '';
        while (true) {
          const {
            done,
            value
          } = await reader.read();
          if (done) {
            this.answerData['doubao'][index].loadingCompleted = true;
            break;
          }
          // let data=decoder.decode(value);
          data = new TextDecoder().decode(value);
          if (data.indexOf('data: [DONE]') == -1) {
            let list = data.split('data: ') || [];
            this.answerData['doubao'][index].loading = false;
            this.answerData['doubao'][index].type = 'text';
            list.map(item => {
              if (item) {
                let json = JSON.parse(item);
                let text = json.choices[0].delta.content || '';
                content += text.replace(/\\n/g, '<br/>');
                this.answerData['doubao'][index].content = marked.parse(content);
                this.saveData(index);
              }
            });
          } else {
            this.answerData['doubao'][index].loadingCompleted = true;
          }
        }
      } catch {
        this.getErrorData(question, index, 'doubao');
      }
    },
    // 获取bailian使用的千帆模型会话ID
    async createBaiLianConversation() {
      fetch(this.robotData.qianfan.baseUrl, {
        method: 'post',
        headers: {
          'Content-Type': 'application/json;charset=utf-8'
          // Authorization: 'Bearer ' + this.robotData.qianfan.token
        },
        body: JSON.stringify({
          token: 'Bearer ' + this.robotData.bailian.token,
          app_id: this.robotData.bailian.appId
        })
      }).then(response => response.json()).then(json => {
        this.bailianConversationId = json.data.conversation_id;
      });
    },
    // 获取百炼回答
    async getBaiLianData(question, index) {
      // 创建请求中断控制器用于可能的请求中止
      new AbortController();
      console.log(question, index, 'question, indexquestion, index', this.answerData[this.elfinData.type]);
      try {
        // 发送流式对话请求到千帆API
        const response = await fetch(this.robotData.bailian.conversationUrl, {
          method: 'post',
          headers: {
            'Content-Type': 'application/json;charset:utf-8'
          },
          // 构造包含认证令牌和应用ID的请求体
          body: JSON.stringify({
            token: 'Bearer ' + this.robotData.bailian.token,
            app_id: this.robotData.bailian.appId,
            query: question,
            stream: true,
            conversation_id: this.bailianConversationId
            // signal: controller.signal,
          })
        });

        // 处理流式响应数据
        const reader = response.body.getReader();
        let data = '';
        let content = '';
        // 持续读取流数据直到完成
        while (true) {
          const {
            done,
            value
          } = await reader.read();

          // 流结束时标记完成状态
          if (done) {
            this.answerData['bailian'][index].loadingCompleted = true;
            break;
          }

          // 解码并处理服务端推送的事件数据
          data = new TextDecoder().decode(value);
          let list = data.split('data: ');
          this.answerData['bailian'][index].loading = false;
          this.answerData['bailian'][index].type = 'text';

          // 解析每个事件数据块并拼接答案内容
          list.map(item => {
            // console.log(item, 'item', item != '');
            const regex = /"answer":\s*"([^"]+)"/;
            const match = regex.exec(item);
            if (match) {
              // const answer = match[1];
              // 格式化文本内容并转换为Markdown
              content += match[1].replace(/\\n/g, '<br/>');
              this.answerData['bailian'][index].content = marked.parse(content);
              // console.log(`The answer is ${content}`);
              this.saveData(index);
            } else {
              console.log('No answer found.');
            }
            // if (item != '') {
            //   let json = {}
            //   try {
            //     json = JSON.parse(item) || {}
            //     // console.log(json, 'json');
            //   } catch (e) {
            //   }

            //   let text = json.answer || ''
            //   // 格式化文本内容并转换为Markdown
            //   // content += text.replace(/\\n/g, '<br/>')

            //   // this.answerData['bailian'][index].content = marked.parse(content)
            //   // console.log(this.answerData['bailian'][index].content,'contentcontentcontentcontent');

            //   // this.saveData(index)
            // }
          });
        }
      } catch {
        // 异常处理：获取并记录错误数据
        this.getErrorData(question, index, 'bailian');
      }
      // this.messages = [{ role: 'user', content: question }]
      // try {
      //   const response = await fetch(this.robotData.bailian.conversationUrl, {
      //     method: 'post',
      //     headers: {
      //       'Content-Type': 'application/json',
      //       Authorization: 'Bearer ' + this.robotData.bailian.token,
      //       'X-DashScope-SSE': 'enable' // 流式输出
      //     },
      //     body: JSON.stringify({
      //       input: {
      //         prompt: question,
      //         session_id: this.answerData[this.elfinData.type][index - 2]?.session_id || '',
      //       },
      //       parameters: {
      //         'incremental_output': 'true' // 增量输出
      //       },
      //       debug: {}
      //     })
      //   })
      //   const reader = response.body.getReader()
      //   let data = ''
      //   let content = ''
      //   while (true) {
      //     const { done, value } = await reader.read()

      //     if (done) {
      //       this.answerData['bailian'][index].loadingCompleted = true
      //       break
      //     }
      //     // let data=decoder.decode(value);
      //     data = new TextDecoder().decode(value)
      //     // console.log(data, '流失输出data');

      //     if (data.indexOf('data: [DONE]') == -1) {
      //       const eventPattern = /id:\d+\nevent:result\n:HTTP_STATUS\/200\ndata:(.*?)(?=id:|$)/gs;
      //       let list = []

      //       let match
      //       while ((match = eventPattern.exec(data)) !== null) {
      //         try {
      //           // 提取并解析data部分
      //           const dataString = match[1].trim();
      //           const dataObject = JSON.parse(dataString);
      //           list.push(dataObject);
      //         } catch (error) {
      //           console.error('解析事件失败:', error);
      //         }
      //       }
      //       // console.log(list, '流失输出list');
      //       this.answerData['bailian'][index].loading = false
      //       this.answerData['bailian'][index].type = 'text'
      //       list.map((item) => {
      //         let text = item.output.text || ''
      //         content += text.replace(/\\n/g, '<br/>')
      //         // console.log(content, '流失输出content', text);

      //         this.answerData['bailian'][index].content = marked.parse(content)
      //         this.answerData['bailian'][index].session_id = item.output.session_id

      //         this.saveData(index)
      //       })
      //     } else {
      //       this.answerData['bailian'][index].loadingCompleted = true
      //     }
      //   }
      // } catch {
      //   this.getErrorData(question, index, 'bailian')
      // }
    },
    /**
     * 处理获取数据失败的情况，并记录错误信息
     * @param {string} question - 用户输入的问题或对话内容
     * @param {number} index - 当前答案在答案数组中的索引位置
     * @param {string} type - 当前机器人类型
     */
    getErrorData(question, index, type) {
      if (!this.answerData[type][index].content) {
        this.answerData[type][index].loading = false;
        this.answerData[type][index].loadingCompleted = true;
        this.answerData[type][index].content = '亲，我的知识库里无法找到答案，请您修改问题重新提问。';
        this.answerData[type][index].type = 'text';
        setTimeout(() => {
          let itemDom = document.getElementById('robot-content-' + index);
          let Dom = this.$refs.scrollDiv;
          Dom.scrollTop = itemDom.offsetTop + itemDom.offsetHeight - 500;
        }, 200);
      }
    },
    // 存储数据
    saveData(index) {
      console.log('777');
      setTimeout(() => {
        let itemDom = document.getElementById('robot-content-' + index);
        if (itemDom) {
          let Dom = this.$refs.scrollDiv;
          Dom.scrollTop = itemDom.offsetTop + itemDom.offsetHeight - 500;
        }
      }, 200);
      // let list=this.list||[]
      // sessionStorage.setItem(this.elfinData.type+this.robotSign, JSON.stringify(list));
    },
    //   发送的时候分辨是哪个ai接口
    sending(Text) {
      console.log(Text, '米骄傲');
      if (Text.replace(/\s+/g, '') != '') {
        let rightData = {
          id: 'right_' + new Date().getTime(),
          direction: 'right',
          content: Text.replace(/\s+/g, ''),
          type: 'text',
          loading: false,
          time: this.getTime(),
          videoUrl: '',
          loadingCompleted: true
        };
        this.answerData[this.elfinData.type].push(rightData);
        // 发送消息是创建一条内为空的回答
        let leftData = {
          id: 'left_' + new Date().getTime(),
          direction: 'left',
          content: '',
          type: 'text',
          loading: true,
          time: this.getTime(),
          videoUrl: '',
          loadingCompleted: false
        };
        this.answerData[this.elfinData.type].push(leftData);
        // 获取回答内容
        let index = this.answerData[this.elfinData.type].length - 1;
        this.loadData(Text.replace(/\s+/g, ''), index);
        this.$refs.Input.innerHTML = '';
        setTimeout(() => {
          this.saveData(index);
        }, 200);
      }
    },
    // 打开Ai解析
    openAiAnalysis(type, question) {
      this.elfinData = this.elfinList.find(item => {
        return item.type == type;
      });
      this.robotShwo = true;
      this.sending(question);
    },
    // 获取当前时间
    getTime() {
      let date = new Date();
      let h = date.getHours();
      let m = date.getMinutes();
      return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m);
    }
  }
};

//
var script$30 = {
  mixins: [getRobotData],
  name: 'xmlGeneralRobotPc',
  props: {
    bookName: {
      type: String,
      default: ''
    },
    goodsId: {
      type: String,
      default: ''
    },
    textBookId: {
      type: String,
      default: ''
    },
    robotData: {
      type: Object,
      default: () => {}
    },
    name: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      // list: [],
      robotShwo: false,
      timer: 0,
      textIndex: 1,
      Interval: null,
      robotWidth: 362,
      //400
      robotHeight: 500,
      //600
      left: 0,
      current: 0,
      screenX: 0,
      screenY: 0,
      correct: ['Hi', '，', '快', '来', '一', '起', '学', '习', '吧', '!'],
      elfinStatic: true,
      exportStatic: false,
      timeout: null,
      conversationId: '',
      tmpToken: ''
    };
  },
  directives: {
    drag: {
      bind: function (el, direction) {
        // console.log(el);
        let oDiv = el; // 获取当前元素
        oDiv.onmousedown = e => {
          // console.log(e);
          let dir = direction.value || {
            top: true,
            left: true,
            dragClass: ''
          };
          if (!dir.dragClass || e.target.className.indexOf(dir.dragClass) !== -1) {
            // 算出鼠标相对元素的位置
            let disX = e.clientX - oDiv.offsetLeft;
            let disY = e.clientY - oDiv.offsetTop;
            document.onmousemove = e => {
              // 用鼠标的位置减去鼠标相对元素的位置，得到元素的位置
              let left = e.clientX - disX;
              let top = e.clientY - disY;
              if (dir.top && top > 0) {
                oDiv.style.top = top + 'px';
              }
              if (dir.left) {
                oDiv.style.left = left + 'px';
              }
            };
            document.onmouseup = e => {
              document.onmousemove = null;
              document.onmouseup = null;
            };
          }
        };
      }
    }
  },
  computed: {
    list() {
      return this.answerData[this.elfinData.type];
    }
  },
  mounted() {
    this.robotHeight = window.innerHeight - 300;
    // calc((100% - 220px) / 2)
    this.left = document.documentElement.clientWidth - this.robotWidth - 86 + 'px';
    this.initRobot();
    // console.log(this.robotData,'robotDatarobotDatarobotDatarobotData');

    setTimeout(() => {
      this.elfinStatic = false;
    }, 5000);
  },
  methods: {
    mousedown(event, axial, direction) {
      this.current = axial == 'X' ? event.screenX : event.screenY;
      let top = Number(this.$refs.robotView.style.top.split('px')[0]);
      let left = Number(this.$refs.robotView.style.left.split('px')[0]);
      document.onmousemove = e => {
        if (direction == 'right') {
          if (e.screenX - this.current < 0 && this.robotWidth + this.screenX > 300) {
            this.screenX = e.screenX - this.current;
          } else if (e.screenX - this.current > 0 && this.robotWidth + this.screenX < 1000) {
            this.screenX = e.screenX - this.current;
          }
        } else if (direction == 'bottom') {
          if (e.screenY - this.current < 0 && this.robotHeight + this.screenY > 500) {
            this.screenY = e.screenY - this.current;
          } else if (e.screenY - this.current > 0 && this.robotHeight + this.screenY < document.documentElement.clientHeight - 140) {
            this.screenY = e.screenY - this.current;
          }
        } else if (direction == 'top') {
          if (this.current - e.screenY < 0 && this.robotHeight + this.screenY > 500) {
            this.screenY = this.current - e.screenY;
          } else if (this.current - e.screenY > 0 && this.robotHeight + this.screenY < document.documentElement.clientHeight - 140 && top - this.screenY > 0) {
            this.screenY = this.current - e.screenY;
          }
          this.$refs.robotView.style.top = top - this.screenY + 'px';
        } else if (direction == 'left') {
          if (this.current - e.screenX < 0 && this.robotWidth + this.screenX > 300) {
            this.screenX = this.current - e.screenX;
          } else if (this.current - e.screenX > 0 && this.robotWidth + this.screenX < 1000) {
            this.screenX = this.current - e.screenX;
          }
          this.$refs.robotView.style.left = left - this.screenX + 'px';
        }
      };
      document.onmouseup = e => {
        this.robotWidth += this.screenX;
        this.robotHeight += this.screenY;
        this.screenX = 0;
        this.screenY = 0;
        document.onmousemove = null;
      };
    },
    // 获取当前时间
    getTime() {
      let date = new Date();
      let h = date.getHours();
      let m = date.getMinutes();
      return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m);
    },
    // 回车事件
    handlePushKeyword(event) {
      if (event.keyCode === 13) {
        event.preventDefault(); // 阻止浏览器默认换行操作
        this.sending(this.$refs.Input.innerText); // 发送文本
        return false;
      }
    },
    // 滚动内容
    scrollToBottom() {
      let Dom = this.$refs.scrollDiv;
      Dom.scrollTop = Dom.scrollHeight;
    },
    moveStart() {
      this.timer = new Date().getTime();
    },
    // 打开小智答疑窗口
    elfinClick() {
      // let timer = new Date().getTime()
      // if (timer - this.timer < 400) {
      //   // this.$message.warning("功能升级中..")
      //   // this.robotShwo = true
      //   if (this.answerData[this.elfinData.type].length === 0) {
      //     //创建一条欢迎语

      //     this.printer(18)
      //   }
      // }
    },
    closeRobot() {
      this.robotShwo = false;
      setTimeout(() => {
        this.elfinData = {};
      }, 1000);
      let videoList = document.getElementById('robot-content-box').querySelectorAll('video') || [];
      videoList.forEach(i => {
        i.pause();
      });
    },
    /**
     *
     */
    // 文字打印机
    printer(num) {
      this.textIndex = 1;
      this.Interval = setInterval(() => {
        this.textIndex++;
        setTimeout(() => {
          this.scrollToBottom();
        }, 200);
        if (this.textIndex > num) {
          clearInterval(this.Interval);
          this.Interval = null;
        }
      }, 50);
    },
    // 删除消息
    removalMessage(item, index) {
      this.answerData[this.elfinData.type].splice(index, 1);
      console.log(item, index);
    },
    // 刷新消息
    refreshMessage(item, index) {
      this.answerData[this.elfinData.type][index].loadingCompleted = false;
      this.answerData[this.elfinData.type][index].loading = true;
      this.answerData[this.elfinData.type][index].content = '';
      this.answerData[this.elfinData.type][index].type = '';
      this.answerData[this.elfinData.type][index].videoUrl = '';
      this.loadData(this.answerData[this.elfinData.type][index - 1].content, index);
      console.log(item, index);
    },
    /**
     * 将页面指定节点内容转为图片
     * 1.拿到想要转换为图片的内容节点DOM；
     * 2.转换，拿到转换后的canvas
     * 3.转换为图片
     */
    clickGeneratePicture() {
      const loading = this.$loading({
        lock: true,
        text: '正在生成图片',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      this.exportStatic = true;
      html2canvas(this.$refs.downloadDom, {
        allowTaint: true,
        // 允许渲染跨域图片
        scale: window.devicePixelRatio * 2,
        // 增加清晰度
        useCORS: true // 允许跨域
      }).then(canvas => {
        this.exportStatic = false;
        // 转成图片，生成图片地址
        let imgUrl = canvas.toDataURL('image/png');
        document.querySelector('#downimg').href = imgUrl;
        document.querySelector('#downimg').download = new Date().getTime() + '.png';
        document.querySelector('#downimg').click();
        loading.close();
      });
    },
    // 复制消息
    copyMessage(item, index) {
      let oInput = document.createElement('input');
      oInput.value = this.removeStyle(item.content);
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand('Copy');
      oInput.remove();
      this.$message.success('复制成功');
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      }
    }
  }
};

/* script */
const __vue_script__$30 = script$30;
/* template */
var __vue_render__$30 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-general-robot-content-pc",
      style: { pointerEvents: !_vm.robotShwo ? "none" : "none" },
      on: {
        click: function ($event) {
          if ($event.target !== $event.currentTarget) {
            return null
          }
          return _vm.closeRobot.apply(null, arguments)
        },
      },
    },
    [
      _c("transition", { attrs: { name: "Fade" } }, [
        _c(
          "div",
          {
            directives: [
              {
                name: "drag",
                rawName: "v-drag:{top:false,left:false,dragClass:null}",
                value: {
                  top: true,
                  left: true,
                  dragClass: "drag-box",
                },
                expression:
                  "{\n        top: true,\n        left: true,\n        dragClass: 'drag-box'\n      }",
                arg: "{top:false,left:false,dragClass:null}",
              },
              {
                name: "show",
                rawName: "v-show",
                value: _vm.robotShwo,
                expression: "robotShwo",
              },
            ],
            ref: "robotView",
            staticClass: "robot-view",
            style: {
              width: _vm.robotWidth + _vm.screenX + "px",
              top: "10px",
              left: _vm.left,
            },
          },
          [
            _c("div", { staticClass: "title-bar drag-box" }, [
              _c("div", { staticClass: "logo drag-box" }, [
                _c("div", {
                  staticClass: "drag-box robot-logo xml-select",
                  class: _vm.elfinData.type + "-select",
                }),
                _vm._v(" "),
                _c("span", { staticClass: "drag-box" }, [
                  _vm._v(_vm._s(_vm.elfinData.title)),
                ]),
              ]),
              _vm._v(" "),
              _c("i", {
                staticClass: "el-icon-close",
                on: { click: _vm.closeRobot },
              }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              {
                ref: "scrollDiv",
                staticClass: "content scroll",
                style: { height: _vm.robotHeight + _vm.screenY + "px" },
                attrs: { id: "robot-content-box" },
              },
              _vm._l(_vm.list, function (item, index) {
                return _c("div", { key: item.id, staticClass: "niubi-item" }, [
                  _c(
                    "div",
                    {
                      directives: [
                        {
                          name: "show",
                          rawName: "v-show",
                          value:
                            item.direction === "right" || item.id == "left_777",
                          expression:
                            "item.direction === 'right' || item.id == 'left_777'",
                        },
                      ],
                      staticClass: "timer",
                    },
                    [
                      _vm._v(
                        "\n            " + _vm._s(item.time) + "\n          "
                      ),
                    ]
                  ),
                  _vm._v(" "),
                  _c(
                    "div",
                    {
                      directives: [
                        {
                          name: "show",
                          rawName: "v-show",
                          value: item.direction === "left",
                          expression: "item.direction === 'left'",
                        },
                      ],
                      staticClass: "item",
                      class: item.direction,
                      attrs: { id: "robot-content-" + index },
                    },
                    [
                      _c("div", { staticClass: "text" }, [
                        _c("div", {
                          domProps: { innerHTML: _vm._s(item.content) },
                        }),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: item.videoUrl,
                                expression: "item.videoUrl",
                              },
                            ],
                          },
                          [
                            _vm._v(
                              "\n                下面“" +
                                _vm._s(_vm.name) +
                                "”还为您推荐视频\n                "
                            ),
                            item.videoUrl
                              ? _c(
                                  "video",
                                  {
                                    staticStyle: { margin: "14px 0 0 0" },
                                    attrs: {
                                      width: "100%",
                                      controls: "",
                                      controlslist: "nodownload",
                                    },
                                  },
                                  [
                                    _c("source", {
                                      attrs: {
                                        src: item.videoUrl,
                                        type: "video/mp4",
                                      },
                                    }),
                                  ]
                                )
                              : _vm._e(),
                          ]
                        ),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: item.loading,
                                expression: "item.loading",
                              },
                            ],
                            staticStyle: { "line-height": "24px" },
                          },
                          [_vm._v("正在生成. . .")]
                        ),
                        _vm._v(" "),
                        _c("span", {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: !item.loadingCompleted,
                              expression: "!item.loadingCompleted",
                            },
                          ],
                        }),
                      ]),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: item.loadingCompleted,
                              expression: "item.loadingCompleted",
                            },
                          ],
                          staticClass: "operating",
                        },
                        [
                          _c("div", {
                            staticClass: "copy",
                            on: {
                              click: function ($event) {
                                return _vm.copyMessage(item, index)
                              },
                            },
                          }),
                          _vm._v(" "),
                          _c("div", {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: item.id != "left_777",
                                expression: "item.id != 'left_777'",
                              },
                            ],
                            staticClass: "refresh",
                            on: {
                              click: function ($event) {
                                return _vm.refreshMessage(item, index)
                              },
                            },
                          }),
                        ]
                      ),
                    ]
                  ),
                  _vm._v(" "),
                  _c(
                    "div",
                    {
                      directives: [
                        {
                          name: "show",
                          rawName: "v-show",
                          value: item.direction === "right",
                          expression: "item.direction === 'right'",
                        },
                      ],
                      staticClass: "item",
                      class: item.direction,
                    },
                    [
                      _c("div", { staticClass: "text" }, [
                        _c("div", {
                          domProps: { innerHTML: _vm._s(item.content) },
                        }),
                      ]),
                    ]
                  ),
                ])
              }),
              0
            ),
            _vm._v(" "),
            _c(
              "div",
              {
                staticClass: "download-dom",
                style: {
                  width: _vm.robotWidth + _vm.screenX + "px",
                },
              },
              [
                _c(
                  "div",
                  { ref: "downloadDom", staticClass: "content" },
                  _vm._l(_vm.list, function (item) {
                    return _c(
                      "div",
                      { key: item.id, staticClass: "niubi-item" },
                      [
                        _c(
                          "div",
                          {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: item.direction === "left",
                                expression: "item.direction === 'left'",
                              },
                            ],
                            staticClass: "item",
                            class: item.direction,
                          },
                          [
                            _c("div", { staticClass: "text" }, [
                              _c("div", {
                                domProps: { innerHTML: _vm._s(item.content) },
                              }),
                              _vm._v(" "),
                              _c(
                                "div",
                                {
                                  directives: [
                                    {
                                      name: "show",
                                      rawName: "v-show",
                                      value: item.videoUrl,
                                      expression: "item.videoUrl",
                                    },
                                  ],
                                },
                                [
                                  _vm._v(
                                    "\n                  下面“" +
                                      _vm._s(_vm.name) +
                                      "”还为您推荐视频\n                  "
                                  ),
                                  item.videoUrl
                                    ? _c(
                                        "video",
                                        {
                                          staticStyle: { margin: "14px 0 0 0" },
                                          attrs: {
                                            width: "100%",
                                            controls: "",
                                            controlslist: "nodownload",
                                          },
                                        },
                                        [
                                          _c("source", {
                                            attrs: {
                                              src: item.videoUrl,
                                              type: "video/mp4",
                                            },
                                          }),
                                        ]
                                      )
                                    : _vm._e(),
                                ]
                              ),
                              _vm._v(" "),
                              _c(
                                "div",
                                {
                                  directives: [
                                    {
                                      name: "show",
                                      rawName: "v-show",
                                      value: item.loading,
                                      expression: "item.loading",
                                    },
                                  ],
                                  staticStyle: { "line-height": "24px" },
                                },
                                [_vm._v("正在生成. . .")]
                              ),
                              _vm._v(" "),
                              _c("span", {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: !item.loadingCompleted,
                                    expression: "!item.loadingCompleted",
                                  },
                                ],
                              }),
                            ]),
                          ]
                        ),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: item.direction === "right",
                                expression: "item.direction === 'right'",
                              },
                            ],
                            staticClass: "item",
                            class: item.direction,
                          },
                          [
                            _c("div", { staticClass: "text" }, [
                              _c("div", {
                                domProps: { innerHTML: _vm._s(item.content) },
                              }),
                            ]),
                          ]
                        ),
                      ]
                    )
                  }),
                  0
                ),
              ]
            ),
            _vm._v(" "),
            _c("div", { staticClass: "input-box" }, [
              _c("div", { staticClass: "input-right" }, [
                _c("div", {
                  ref: "Input",
                  staticClass: "input-content",
                  attrs: {
                    contenteditable: "true",
                    placeholder: "请输入问题描述",
                  },
                  on: {
                    keydown: function ($event) {
                      return _vm.handlePushKeyword($event)
                    },
                  },
                }),
                _vm._v(" "),
                _c("div", {
                  staticClass: "sending",
                  on: {
                    click: function ($event) {
                      return _vm.sending(_vm.$refs.Input.innerText)
                    },
                  },
                }),
              ]),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "aboutai" }, [
              _vm._v("内容由AI生成，仅供参考"),
            ]),
            _vm._v(" "),
            _c("div", {
              staticClass: "point point-right",
              on: {
                mousedown: function ($event) {
                  return _vm.mousedown($event, "X", "right")
                },
              },
            }),
            _vm._v(" "),
            _c("div", {
              staticClass: "point point-bottom",
              on: {
                mousedown: function ($event) {
                  return _vm.mousedown($event, "Y", "bottom")
                },
              },
            }),
          ]
        ),
      ]),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [
            {
              name: "drag",
              rawName: "v-drag:{top:false,left:false}",
              value: { top: true, left: true },
              expression: "{ top: true, left: true }",
              arg: "{top:false,left:false}",
            },
          ],
          staticClass: "elfin-box",
          on: {
            mousedown: _vm.moveStart,
            click: function ($event) {
              $event.preventDefault();
              return _vm.elfinClick.apply(null, arguments)
            },
          },
        },
        _vm._l(_vm.elfinList, function (item, index) {
          return _c("div", {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.robotData[item.type],
                expression: "robotData[item.type]",
              },
            ],
            key: index,
            staticClass: "elfin-item",
            class:
              item.type + (item.type == _vm.elfinData.type ? "-select" : ""),
            attrs: { title: item.title },
            on: {
              click: function ($event) {
                return _vm.openRobot(item)
              },
            },
          })
        }),
        0
      ),
      _vm._v(" "),
      _c("a", {
        staticStyle: { display: "none" },
        attrs: { id: "downimg", href: "" },
      }),
    ],
    1
  )
};
var __vue_staticRenderFns__$30 = [];
__vue_render__$30._withStripped = true;

  /* style */
  const __vue_inject_styles__$30 = undefined;
  /* scoped */
  const __vue_scope_id__$30 = "data-v-08f61646";
  /* module identifier */
  const __vue_module_identifier__$30 = undefined;
  /* functional template */
  const __vue_is_functional_template__$30 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$30 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$30, staticRenderFns: __vue_staticRenderFns__$30 },
    __vue_inject_styles__$30,
    __vue_script__$30,
    __vue_scope_id__$30,
    __vue_is_functional_template__$30,
    __vue_module_identifier__$30,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$2$ = {
  name: 'DownloadFileUppop',
  props: {
    downloadFileLink: {
      type: String,
      default: ''
    },
    showToast: {
      type: Function,
      default: null
    }
  },
  data() {
    return {
      isShow: false,
      prompt: ''
    };
  },
  methods: {
    close() {
      setTimeout(() => {
        this.prompt = '';
      }, 700);
    },
    // async copyInputContent() {

    //   try {
    //     await navigator.clipboard.writeText(this.codeData)
    //     console.log('复制成功')
    //   } catch (error) {
    //     console.log('复制失败')
    //   }
    // }

    // /**
    //  * 提示语
    //  * type
    //  * @param {*}  warning : 提示
    //  * @param {*}  error : 错误
    //  * @param {*}  success : 成功
    //  */
    //  showToast(text, type) {
    //   this.showPrompt = true
    //   this.promptText = text
    //   this.toastType = type ? type : 'warning'
    //   setTimeout(() => {
    //     this.showPrompt = false
    //   }, 2000)
    // },

    /**
     * 复制文本
     * @param {*}  text : 复制的文本
     */
    copyInputContent() {
      let oInput = document.createElement('input');
      oInput.value = this.downloadFileLink;
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand('Copy');
      oInput.remove();
      // alert('复制成功,请到浏览器进行下载')
      this.showToast('复制成功', 'success');
      console.log('成功');
      this.isShow = false;
      this.$emit('CopySuccess');
    }
  },
  watch: {}
};

/* script */
const __vue_script__$2$ = script$2$;

/* template */
var __vue_render__$2$ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "van-popup",
    {
      style: { borderRadius: "8px" },
      on: { close: _vm.close },
      model: {
        value: _vm.isShow,
        callback: function ($$v) {
          _vm.isShow = $$v;
        },
        expression: "isShow",
      },
    },
    [
      _c("div", { staticClass: "xml-download-file-uppop" }, [
        _c("div", { staticClass: "code-path" }, [
          _c("div", { staticClass: "download-file-link" }, [
            _vm._v("\n        " + _vm._s(_vm.downloadFileLink) + "\n      "),
          ]),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "copy-btn", on: { click: _vm.copyInputContent } },
            [_vm._v("复制")]
          ),
        ]),
        _vm._v(" "),
        _c("p", { staticClass: "code-text" }, [
          _vm._v(
            "*" + _vm._s(_vm.prompt ? _vm.prompt : "请复制链接至浏览器下载")
          ),
        ]),
      ]),
    ]
  )
};
var __vue_staticRenderFns__$2$ = [];
__vue_render__$2$._withStripped = true;

  /* style */
  const __vue_inject_styles__$2$ = undefined;
  /* scoped */
  const __vue_scope_id__$2$ = undefined;
  /* module identifier */
  const __vue_module_identifier__$2$ = undefined;
  /* functional template */
  const __vue_is_functional_template__$2$ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2$ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2$, staticRenderFns: __vue_staticRenderFns__$2$ },
    __vue_inject_styles__$2$,
    __vue_script__$2$,
    __vue_scope_id__$2$,
    __vue_is_functional_template__$2$,
    __vue_module_identifier__$2$,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2_ = {
  name: 'resource-list-phone',
  components: {
    VideoModalPlayer: __vue_component__$5A,
    audioPlayerPage: __vue_component__$37,
    downFileUppop: __vue_component__$2$
  },
  props: {
    textBookResource: {
      type: Object,
      default: () => {}
    },
    resourcesList: {
      type: Array,
      default: () => []
    },
    userType: {
      // 用户类型，可选teacher、student
      type: String,
      default: 'teacher'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    showToast: {
      type: Function,
      default: null
    },
    isShowTeacherResource: {
      type: Boolean,
      default: false
    },
    sysEnv: {
      type: Object,
      default: () => {}
    }
  },
  watch: {
    resourceType() {
      if (this.resourceType == 'teachingResource') {
        this.list = this.resourcesList || [];
      } else {
        this.list = this.textBookResource[this.resourceType] || [];
      }
    },
    resourcesList() {
      if (this.isShowTeacherResource && this.resourceType == 'teachingResource') {
        this.list = this.resourcesList || [];
      }
    },
    textBookResource(newValue) {
      this.getToolbarList();
    }
  },
  data() {
    return {
      toolbarList: [],
      current: 0,
      resourceType: 'teachingResource',
      list: this.resourcesList,
      collapseCurrent: 0,
      resourceIcon: '',
      audioData: {
        show: false,
        src: '',
        info: {}
      },
      videoData: {
        show: false,
        src: '',
        info: {}
      },
      downloadFileLink: '',
      showDown: false,
      audioUrl: '',
      isPlay: '',
      location: '',
      endTime: 0
    };
  },
  mounted() {
    this.getToolbarList();
  },
  methods: {
    getToolbarList() {
      this.toolbarList = [];
      this.sysEnv.toolbarList.map(item => {
        if (this.isShowTool(item.total)) {
          this.toolbarList.push(item);
        }
      });
      if (!this.isShowTeacherResource) {
        this.resourceType = 'imageList';
        this.list = this.textBookResource[this.resourceType] || [];
        this.toolbarList.splice(0, 2);
      } else {
        this.toolbarList.splice(0, 1);
      }
      this.resourceType = this.toolbarList[0]?.type || '';
    },
    clickToolbar(e) {
      // console.log(e)

      // this.location = ''
      // this.current = index
      // this.resourceType = item.type
      // this.resourceIcon = item.icon

      this.location = '';
      this.resourceType = this.toolbarList[e].type;
      this.resourceIcon = this.toolbarList[e].icon;
      this.current = this.toolbarList.findIndex(item => item.type == this.resourceType) || 0;
    },
    getFileUrl(url) {
      if (url && url.indexOf('./') !== -1) {
        return this.resourceBasisPath + url.split('./')[1];
      } else if (url && url.indexOf('./') === -1) {
        return url;
      }
    },
    // 跳转到资源所在位置
    resourceDetails(item, items, type) {
      this.location = '';
      // this.$emit('resourceDetails', items)
      if (items.resourcesType == 'recorded') {
        if (this.isPlay == '') {
          this.isPlay = items.id;
          this.audioUrl = items.fileUrl;
          this.$nextTick(() => {
            this.$refs.musicAudio.play();
          });
        } else {
          this.isPlay = '';
          this.$refs.musicAudio.pause();
        }
      } else {
        this.$emit('resourceDetails', {
          jumpType: type,
          toolbarIndex: 2,
          ...items
        });
      }
    },
    // 教师资源预览
    resourceReader(item, items) {
      if (items.resourcesType == 'image') {
        this.$EventBus.$emit('learningStatistics', {
          type: 'image',
          info: items
        });
        this.$hevueImgPreview({
          multiple: true,
          nowImgIndex: 0,
          imgList: [{
            url: items.fileUrl,
            title: items.resourcesName
          }]
        });
      } else if (items.resourcesType == 'audio') {
        this.audioData.src = items.fileUrl;
        this.audioData.show = true;
        this.audioData.info = items;
      } else if (items.resourcesType == 'recorded') {
        this.resourceDetails(item, items);
      } else if (items.resourcesType == 'video') {
        this.videoData.src = items.fileUrl;
        this.videoData.show = true;
        this.videoData.info = items;
      } else {
        this.$emit('resourceReader', items);
      }
      // this.$refs.xmlPopup.show = false
    },
    closeViewer() {
      this.videoData.show = false;
    },
    // 图片预览
    imgPreview(item, items) {
      this.$EventBus.$emit('learningStatistics', {
        type: 'image',
        info: items
      });
      this.$hevueImgPreview({
        multiple: true,
        nowImgIndex: 0,
        imgList: [{
          url: this.getFileUrl(items.uploadFileUrl),
          title: items.title
        }]
      });
    },
    // 音频预览
    audioPreview(item, items) {
      this.audioData.src = this.getFileUrl(items.uploadFileUrl);
      this.audioData.show = true;
      this.audioData.info = items;
      // this.$refs.xmlPopup.show = false
    },
    // 视频预览
    videoPreview(item, items) {
      this.videoData.src = this.getFileUrl(items.uploadFileUrl);
      this.videoData.show = true;
      this.videoData.info = items;
      // this.$refs.xmlPopup.show = false
    },
    close() {
      // this.$refs.xmlPopup.show = false
      this.$emit('close');
    },
    showResourceList(type) {
      if (type) {
        this.$refs.xmlPopup.show = !this.$refs.xmlPopup.show;
      } else {
        this.$refs.xmlPopup.show = false;
      }
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      }
    },
    openTeacherResoucesList(e) {
      let index = this.list.findIndex(item => item.firstLevelId === e.firstLevelId);
      this.current = 0;
      this.resourceType = 'teachingResource';
      this.resourceIcon = '';
      this.collapseCurrent = index !== -1 ? index : 0;
      // this.location = e.location
      let currentTime = new Date().getTime();
      // this.launchValue = 'teaching-resource_' + firstLevelId
      if (e.location == this.location && currentTime > this.endTime + 2000) {
        this.location = '';
        this.endTime = new Date().getTime();
      }
      setTimeout(() => {
        this.location = e.location;
      }, 200);
      this.$refs.xmlPopup.show = true;
    },
    formatTime(time) {
      if (time) {
        let Seconds = time / 1000;
        let m = parseInt(Seconds / 60);
        let s = Seconds % 60;
        // let date = (m > 9 ? m : '0' + m) + "'" + (s > 9 ? s : '0' + s) +
        let date = (m > 0 ? m + "'" : '') + s + '"';
        return date + ' 录音';
      } else {
        return '录音';
      }
    },
    timeVideoUpdate({
      event,
      time
    }, data) {
      // console.log({event, time, data});
      this.$EventBus.$emit('videoTimeUpdate', {
        event,
        time,
        data,
        info: this.videoData.info
      });
    },
    timeAudioUpdate({
      event,
      time
    }, data) {
      // console.log({event, time, data});
      this.$EventBus.$emit('audioTimeUpdate', {
        event,
        time,
        data,
        info: this.videoData.info
      });
    },
    isShowTool(type) {
      let list = ['none', 'teachingResourceTotal'];
      let show = true;
      let total = this.textBookResource[type];
      if (total == undefined) {
        total = type;
      }
      if (Number(total) == 0 && this.sysEnv.dynamicToolbar && !list.includes(type)) {
        show = false;
      }
      return show;
    }
  }
};

var __$_require_static_images_icons_resource_positioning_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAd4SURBVHgB7VrNbhNXFD5nZhyiJlCz6KYSxWwqdji7kNAyWcCim8IT1HkCYomAUBdxVilYVcITkKy6THZVxSKOmqRIXWCeAEc8QC2SSMbzc3uO7bHvjO/EnjsTSiW+hTUzvnPnfnPOPb8D8Bn/byB8JOTtSr7VupDn48nJD81mrdKEj4BzI8iEnA9TJTTgR3pIkS9FhjQFQF0IseX5Xq316kkDzgGZE8zbawWvba4D4r1ENwqx6fjeatZETcgQUzerSyCM34ncdUgKxKJpGEsTV+5C+93LPcgImUiQ1dF1prZpMnvoTyH20MCa8EVDGNjoPBQxLzyviIA2ndxW3LNjTuQWm7Vy6n2amiCT850vdgVgMfSHQFI5k1Su3Dj7/vWC57gVOvwJwgurGzlrIS3J1AQvzj3bDu03ASQpWDzZX65BAjBR33HpRUFhMJfYOT58dB9SwIAUmJ77dSVKzvGthaTkGCSpBkuM3nijf5Hmnrr5dAlSQFuCHWvpWK8hMP89cqNUcvS8Q5Jsmjnrmq6qWqAJzzEqIPs20y+3DuPJTc+u2WiYBT4Wvtc4efWkphrHkpy+VV1EAbu9S3m33WYpVkADWhKkt5wnw/AW+tLDzePDh4uqsew6DANWIOrohWj4AKunh482VfddnK8yQbt3qi1FrT3otR3ed/0FC8PZUo3jPUrk1mE4iuH9VTAQX0zPVVdU9wqEVek073SfmRh6RgaF3T+mvXeyP6xuZF1LiH4lcuOQBBChMn1rzY5eZ0NF6nUkXRr2l2NAi6AA48bgDGuqMbRwSTJEzPDvHx88vHx8sIyknqzOfbIoLLUUAWqD+SJ+dkxoEUTJV/nCexP9f2ruWZEcvzTGLx//+XgnOCfftikEPJdusSdn1wrReXwf6qpnJoGuHxzsKVSonY+hPcfZQnSM5buboXNrmICBoql8ZgKkcvRp4Bim1oKTQldFjwbHohD935q06qFz03oQHUPSCUUoljVZj44R8tzkVkADWo6e/Nc/RPJqdxF4Nfo/+yvyYzXo+TEau0RWNU8OfgvRyNNrJZNvDIJr8qMqH4fhAP4INKAXyVAKBD2rZqhSJAI55kUKBgahHGIJTas0PBKbnHUoH4N4dRCJGG9BA7oqOlAnctgqC8ghFzlrzgTOiD6w6QtTGb9yrNsrdXTgg6+VBGsRpGR0Rz63DKOkGsfOmiQ5Q4dbYSePTarFPHc8c+b0sFxX3UtlDzt07udqoAHtbEKOFckY1E8OHs2MuieQ9Dh1l+n56utAglycOjlYHjm/CvpuwsC+o2ZjoAq3omBiY5GbrdqyerK0QRPaBE3TrMEY4ZYO0PRL8rmuejK0CbJZj4Zb40hxFNi4RF1ImiQ6VSRjTVgbkLEUXcd6IZ/HuZBxkYqgSooXv3uqlbcxOimW7FdTSo+ROhaNShE8XOeMHxKi4/fkFKtT40knPUZqgp0QS4hy/wI5ftdxE6sq13hCKRaI1bTS6ywHMkKkhkLa5S6oMn3lvaSa9GIGe49CQcoZbcgAmaVLHHuCbHB884UqhIuiYzUR1wdXODbNlSAjZEaQY09Sh8GeIVXNmWGLGEW37G+y5Pt7lrP/LFQzgFZ3iRdmfnXn+tS337dajVoruP7h3ctXF67cKUrdpcLEN3fz1C36QzVP7usffqOxs8E5RyxURvwFMsTYe5ALtxSe3aMw43Y/jKIklALvGTmXYwtKlenXco/B9/3y6V+PN0LzUUkxVHUjq3l8uHwt+lyu71B5cbc7JHnD9EyCnbZYe+oBmW/OvpWmX2VMpEUNVA+wdHrwcCuOXFzZn4zXJkQ6T91boMZk4wrHAVCXWPcp8dZuyDLSNvWFWKA3YveKwcESmpw2xe27S/PVJSKzDvFrOLNCPkSQ376JsC37JHkx1FjY8wXWPOHujFKTS7eqFYp0ZJ/Iqhx+YVwvlUqKKlCvwiY9t2MbpgxqgdN2KUdLHyGCKtXq3bxH3dmKZVn1pP0BBUn54eX3B8sbkACdhmnbsakQvCIitVJV0zRE8NL8s7chyfWI6fT7QvMqSNIeXH2//7gCKdBtD4SJ0vEGJcf9yArlwfKeyWIBMmSSWc6t6gxT0HE5kGLf0Qspg2arliU5xvv95Qq3wBzPvZbl3BxgeEKE2tyu2+pzUUcyCPlxwiydxZzHBz+GLJzh/4IjlC1ZPmeYu+dBMmt0vs0JBerhdl7EyFQ3RdSpntMXSGnRiaxMayX6bQ752kXZJ4YI9lrT26CoVgeRw3l+VzYK3XDRuh0XgKiMlzKSOct3MTgmRCHqFEHsgePUT//+uQ4ZoxNNtS4UBVpFREGkyMnHRVVnfJuD8Q9Qf4EUB9Et53PFmtImcSSE0eT+Hn9REXdP8NUFRUZ5RK9AneMvuZPba3aOUfbAJpF/bljWRlwAMjKbCCIHkj+rxQ34z9EJF9+MG1klKllIZG3omuaPQLhHiDWELH3ScDFVTYaNkuu6ReEB7RM/3+vnkbohqRt+SYo7VnUtaKiSetfpp0ldKVJzpBQqvUHLrOgUB34JrVZLSfRTcz2f8SniXwP2q2L+oDicAAAAAElFTkSuQmCC";

/* script */
const __vue_script__$2_ = script$2_;
var __vue_render__$2_ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    [
      _c(
        "xml-popup",
        {
          ref: "xmlPopup",
          attrs: { round: false },
          on: {
            close: function ($event) {
              return _vm.close()
            },
          },
        },
        [
          _c(
            "div",
            { staticClass: "xml-resource-list-phone" },
            [
              _vm.sysEnv.resourceStyle == 1
                ? _c("div", {
                    staticClass: "xml-popup-mback",
                    on: {
                      click: function ($event) {
                        $event.stopPropagation();
                        _vm.$refs.xmlPopup.show = false;
                      },
                    },
                  })
                : [
                    _c("div", { staticClass: "navBar" }, [
                      _c(
                        "div",
                        {
                          staticClass: "back-icon",
                          on: {
                            click: function ($event) {
                              $event.stopPropagation();
                              _vm.$refs.xmlPopup.show = false;
                            },
                          },
                        },
                        [_c("i", { staticClass: "el-icon-arrow-left" })]
                      ),
                      _vm._v(" "),
                      _c("div", [_vm._v("资源")]),
                    ]),
                    _vm._v(" "),
                    _c(
                      "van-tabs",
                      {
                        attrs: {
                          color: "#57A9FB",
                          background: "#F6FBFF",
                          "line-width": "45px",
                        },
                        on: { click: _vm.clickToolbar },
                      },
                      _vm._l(_vm.toolbarList, function (item, index) {
                        return _c("van-tab", {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: item.type !== "questionBank",
                              expression: "item.type !== 'questionBank'",
                            },
                          ],
                          key: index,
                          scopedSlots: _vm._u(
                            [
                              {
                                key: "title",
                                fn: function () {
                                  return [
                                    _c("div", [
                                      _vm._v(
                                        "\n                " +
                                          _vm._s(item.name) +
                                          "\n                "
                                      ),
                                      _c("span", [
                                        _vm._v(
                                          "(" +
                                            _vm._s(
                                              _vm.textBookResource[item.total]
                                                ? _vm.textBookResource[
                                                    item.total
                                                  ]
                                                : "0"
                                            ) +
                                            ")"
                                        ),
                                      ]),
                                    ]),
                                  ]
                                },
                                proxy: true,
                              },
                            ],
                            null,
                            true
                          ),
                        })
                      }),
                      1
                    ),
                  ],
              _vm._v(" "),
              _c("div", { staticClass: "xml-resource-list" }, [
                _vm.sysEnv.resourceStyle == 1
                  ? _c(
                      "div",
                      { staticClass: "xml-left-toolbar-phone" },
                      [
                        _vm._l(_vm.toolbarList, function (item, index) {
                          return _c(
                            "div",
                            {
                              key: index,
                              staticClass: "toolbar-item",
                              class:
                                item.type == _vm.resourceType
                                  ? "current-toolbar"
                                  : "",
                              on: {
                                click: function ($event) {
                                  $event.stopPropagation();
                                  return _vm.clickToolbar(index, item)
                                },
                              },
                            },
                            [
                              _vm._v(
                                "\n            " +
                                  _vm._s(item.name) +
                                  "\n            "
                              ),
                              _c("span", [
                                _vm._v(
                                  "(" +
                                    _vm._s(
                                      _vm.textBookResource[item.total]
                                        ? _vm.textBookResource[item.total]
                                        : "0"
                                    ) +
                                    ")"
                                ),
                              ]),
                            ]
                          )
                        }),
                        _vm._v(" "),
                        _c("div", {
                          staticClass: "select-toolbar",
                          style: { top: _vm.current * 14 + "vw" },
                        }),
                      ],
                      2
                    )
                  : _vm._e(),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "xml-resource-content" },
                  [
                    _vm.resourceType == "imageList"
                      ? _vm._l(_vm.list, function (item, index) {
                          return _c(
                            "xml-collapse",
                            {
                              key: index,
                              attrs: {
                                title: item.label,
                                name: index,
                                current: _vm.textBookResource["imageCurrent"],
                                className: "max-resource-content",
                              },
                              on: {
                                collapseClick: function (e) {
                                  return (
                                    (_vm.textBookResource["imageCurrent"] = e),
                                    (item.state = true)
                                  )
                                },
                              },
                            },
                            _vm._l(
                              item[_vm.resourceType],
                              function (items, index) {
                                return _c(
                                  "div",
                                  { staticClass: "max-resource-item" },
                                  [
                                    _c(
                                      "div",
                                      {
                                        directives: [
                                          {
                                            name: "show",
                                            rawName: "v-show",
                                            value: items.isTrialExternal,
                                            expression: "items.isTrialExternal",
                                          },
                                        ],
                                        staticClass:
                                          "mask-layer-trial-external",
                                      },
                                      [
                                        _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_resource_lock_svg__,
                                            alt: "",
                                          },
                                        }),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      {
                                        staticClass: "resource-cover",
                                        on: {
                                          click: function ($event) {
                                            $event.stopPropagation();
                                            return _vm.imgPreview(item, items)
                                          },
                                        },
                                      },
                                      [
                                        item.state
                                          ? _c("img", {
                                              attrs: {
                                                src: _vm.getFileUrl(
                                                  items.uploadFileUrl
                                                ),
                                                alt: "",
                                              },
                                            })
                                          : _vm._e(),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("div", { staticClass: "item-bottom" }, [
                                      _c(
                                        "div",
                                        { staticClass: "resource-title" },
                                        [
                                          _vm._v(
                                            _vm._s(
                                              items.title
                                                ? _vm.removeStyle(items.title)
                                                : item.label
                                            )
                                          ),
                                        ]
                                      ),
                                      _vm._v(" "),
                                      _c("img", {
                                        staticClass: "location",
                                        attrs: {
                                          src: __$_require_static_images_icons_resource_positioning_png__,
                                          alt: "",
                                        },
                                        on: {
                                          click: function ($event) {
                                            $event.stopPropagation();
                                            return _vm.resourceDetails(
                                              item,
                                              items,
                                              "resource"
                                            )
                                          },
                                        },
                                      }),
                                    ]),
                                  ]
                                )
                              }
                            ),
                            0
                          )
                        })
                      : _vm.resourceType == "videoList" ||
                        _vm.resourceType == "animationList" ||
                        _vm.resourceType == "curriculumList"
                      ? _vm._l(_vm.list, function (item, index) {
                          return _c(
                            "xml-collapse",
                            {
                              key: index,
                              attrs: {
                                title: item.label,
                                name: index,
                                current: _vm.textBookResource["videoCurrent"],
                                className: "max-resource-content",
                              },
                              on: {
                                collapseClick: function (e) {
                                  return (
                                    (_vm.textBookResource["videoCurrent"] = e),
                                    (item.state = true)
                                  )
                                },
                              },
                            },
                            _vm._l(
                              item[_vm.resourceType],
                              function (items, index) {
                                return _c(
                                  "div",
                                  { staticClass: "max-resource-item" },
                                  [
                                    _c(
                                      "div",
                                      {
                                        directives: [
                                          {
                                            name: "show",
                                            rawName: "v-show",
                                            value: items.isTrialExternal,
                                            expression: "items.isTrialExternal",
                                          },
                                        ],
                                        staticClass:
                                          "mask-layer-trial-external",
                                      },
                                      [
                                        _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_resource_lock_svg__,
                                            alt: "",
                                          },
                                        }),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      {
                                        staticClass: "resource-cover",
                                        on: {
                                          click: function ($event) {
                                            $event.stopPropagation();
                                            return _vm.videoPreview(item, items)
                                          },
                                        },
                                      },
                                      [
                                        item.state && items.coverFileUrl
                                          ? _c("img", {
                                              attrs: {
                                                src: _vm.getFileUrl(
                                                  items.coverFileUrl
                                                ),
                                                alt: "",
                                              },
                                            })
                                          : _vm._e(),
                                        _vm._v(" "),
                                        !items.coverFileUrl
                                          ? _c("img", {
                                              attrs: {
                                                src: __$_require_static_images_default_over_video_cover_png__,
                                                alt: "",
                                              },
                                            })
                                          : _vm._e(),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("div", { staticClass: "item-bottom" }, [
                                      _c(
                                        "div",
                                        { staticClass: "resource-title" },
                                        [
                                          _vm._v(
                                            _vm._s(_vm.removeStyle(items.title))
                                          ),
                                        ]
                                      ),
                                      _vm._v(" "),
                                      _c("img", {
                                        staticClass: "location",
                                        attrs: {
                                          src: __$_require_static_images_icons_resource_positioning_png__,
                                          alt: "",
                                        },
                                        on: {
                                          click: function ($event) {
                                            $event.stopPropagation();
                                            return _vm.resourceDetails(
                                              item,
                                              items,
                                              "resource"
                                            )
                                          },
                                        },
                                      }),
                                    ]),
                                  ]
                                )
                              }
                            ),
                            0
                          )
                        })
                      : _vm.resourceType == "audioList"
                      ? _vm._l(_vm.list, function (item, index) {
                          return _c(
                            "xml-collapse",
                            {
                              key: index,
                              attrs: {
                                title: item.label,
                                name: index,
                                current: _vm.textBookResource["audioCurrent"],
                              },
                              on: {
                                collapseClick: function (e) {
                                  return (
                                    (_vm.textBookResource["audioCurrent"] = e),
                                    (item.state = true)
                                  )
                                },
                              },
                            },
                            _vm._l(
                              item[_vm.resourceType],
                              function (items, index) {
                                return _c(
                                  "div",
                                  { staticClass: "resource-item" },
                                  [
                                    _c(
                                      "div",
                                      {
                                        directives: [
                                          {
                                            name: "show",
                                            rawName: "v-show",
                                            value: items.isTrialExternal,
                                            expression: "items.isTrialExternal",
                                          },
                                        ],
                                        staticClass:
                                          "mask-layer-trial-external min-mask-layer",
                                      },
                                      [
                                        _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_resource_lock_svg__,
                                            alt: "",
                                          },
                                        }),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("div", {
                                      staticClass: "resource-icon",
                                      class: _vm.resourceIcon,
                                    }),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      {
                                        staticClass: "resource-title",
                                        on: {
                                          click: function ($event) {
                                            $event.stopPropagation();
                                            return _vm.audioPreview(item, items)
                                          },
                                        },
                                      },
                                      [_vm._v(_vm._s(items.title))]
                                    ),
                                    _vm._v(" "),
                                    _c("img", {
                                      staticClass: "location",
                                      attrs: {
                                        src: __$_require_static_images_icons_resource_positioning_png__,
                                        alt: "",
                                      },
                                      on: {
                                        click: function ($event) {
                                          $event.stopPropagation();
                                          return _vm.resourceDetails(
                                            item,
                                            items,
                                            "resource"
                                          )
                                        },
                                      },
                                    }),
                                  ]
                                )
                              }
                            ),
                            0
                          )
                        })
                      : _vm.resourceType == "questionList"
                      ? _vm._l(_vm.list, function (item, index) {
                          return _c(
                            "xml-collapse",
                            {
                              key: index,
                              attrs: {
                                title: item.label,
                                name: index,
                                current:
                                  _vm.textBookResource["questionCurrent"],
                              },
                              on: {
                                collapseClick: function (e) {
                                  return (
                                    (_vm.textBookResource["questionCurrent"] =
                                      e),
                                    (item.state = true)
                                  )
                                },
                              },
                            },
                            _vm._l(
                              item[_vm.resourceType],
                              function (items, index) {
                                return _c(
                                  "div",
                                  { staticClass: "resource-item" },
                                  [
                                    _c(
                                      "div",
                                      {
                                        directives: [
                                          {
                                            name: "show",
                                            rawName: "v-show",
                                            value: items.isTrialExternal,
                                            expression: "items.isTrialExternal",
                                          },
                                        ],
                                        staticClass:
                                          "mask-layer-trial-external min-mask-layer",
                                      },
                                      [
                                        _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_resource_lock_svg__,
                                            alt: "",
                                          },
                                        }),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("div", {
                                      staticClass: "resource-icon",
                                      class: _vm.resourceIcon,
                                    }),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      { staticClass: "resource-title" },
                                      [
                                        _vm._v(
                                          _vm._s(
                                            _vm.removeStyle(items.stem.content)
                                          )
                                        ),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("img", {
                                      staticClass: "location",
                                      attrs: {
                                        src: __$_require_static_images_icons_resource_positioning_png__,
                                        alt: "",
                                      },
                                      on: {
                                        click: function ($event) {
                                          $event.stopPropagation();
                                          return _vm.resourceDetails(
                                            item,
                                            items,
                                            "resource"
                                          )
                                        },
                                      },
                                    }),
                                  ]
                                )
                              }
                            ),
                            0
                          )
                        })
                      : _vm.resourceType == "testPaperList"
                      ? _vm._l(_vm.list, function (item, index) {
                          return _c(
                            "xml-collapse",
                            {
                              key: index,
                              attrs: {
                                title: item.label,
                                name: index,
                                current: _vm.textBookResource["testPaperTotal"],
                              },
                              on: {
                                collapseClick: function (e) {
                                  return (
                                    (_vm.textBookResource["testPaperTotal"] =
                                      e),
                                    (item.state = true)
                                  )
                                },
                              },
                            },
                            _vm._l(
                              item[_vm.resourceType],
                              function (items, index) {
                                return _c(
                                  "div",
                                  { staticClass: "resource-item" },
                                  [
                                    _c(
                                      "div",
                                      {
                                        directives: [
                                          {
                                            name: "show",
                                            rawName: "v-show",
                                            value: items.isTrialExternal,
                                            expression: "items.isTrialExternal",
                                          },
                                        ],
                                        staticClass:
                                          "mask-layer-trial-external min-mask-layer",
                                      },
                                      [
                                        _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_resource_lock_svg__,
                                            alt: "",
                                          },
                                        }),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("div", {
                                      staticClass: "resource-icon",
                                      class: _vm.resourceIcon,
                                    }),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      { staticClass: "resource-title" },
                                      [
                                        _vm._v(
                                          _vm._s(items.paperName || items.title)
                                        ),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("img", {
                                      staticClass: "location",
                                      attrs: {
                                        src: __$_require_static_images_icons_resource_positioning_png__,
                                        alt: "",
                                      },
                                      on: {
                                        click: function ($event) {
                                          $event.stopPropagation();
                                          return _vm.resourceDetails(
                                            item,
                                            items,
                                            "resource"
                                          )
                                        },
                                      },
                                    }),
                                  ]
                                )
                              }
                            ),
                            0
                          )
                        })
                      : _vm.resourceType == "formulaList"
                      ? _vm._l(_vm.list, function (item, index) {
                          return _c(
                            "xml-collapse",
                            {
                              key: index,
                              attrs: {
                                title: item.label,
                                name: index,
                                current: _vm.textBookResource["formulaCurrent"],
                              },
                              on: {
                                collapseClick: function (e) {
                                  return (
                                    (_vm.textBookResource["formulaCurrent"] =
                                      e),
                                    (item.state = true)
                                  )
                                },
                              },
                            },
                            _vm._l(
                              item[_vm.resourceType],
                              function (items, index) {
                                return _c(
                                  "div",
                                  { staticClass: "resource-item flex-column" },
                                  [
                                    _c(
                                      "div",
                                      {
                                        directives: [
                                          {
                                            name: "show",
                                            rawName: "v-show",
                                            value: items.isTrialExternal,
                                            expression: "items.isTrialExternal",
                                          },
                                        ],
                                        staticClass:
                                          "mask-layer-trial-external",
                                      },
                                      [
                                        _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_resource_lock_svg__,
                                            alt: "",
                                          },
                                        }),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      { staticClass: "resource-title-box" },
                                      [
                                        _c("div", {
                                          staticClass: "resource-icon",
                                          class: _vm.resourceIcon,
                                        }),
                                        _vm._v(" "),
                                        _c(
                                          "div",
                                          { staticClass: "resource-title" },
                                          [_vm._v(_vm._s(items.fileNames))]
                                        ),
                                        _vm._v(" "),
                                        _c("img", {
                                          staticClass: "location",
                                          attrs: {
                                            src: __$_require_static_images_icons_resource_positioning_png__,
                                            alt: "",
                                          },
                                          on: {
                                            click: function ($event) {
                                              $event.stopPropagation();
                                              return _vm.resourceDetails(
                                                item,
                                                items,
                                                "resource"
                                              )
                                            },
                                          },
                                        }),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("iframe", {
                                      attrs: {
                                        width: "100%",
                                        height: "120px",
                                        src: _vm.getFileUrl(items.file),
                                        frameborder: "0",
                                      },
                                    }),
                                  ]
                                )
                              }
                            ),
                            0
                          )
                        })
                      : _vm.resourceType == "interactionList"
                      ? _vm._l(_vm.list, function (item, index) {
                          return _c(
                            "xml-collapse",
                            {
                              key: index,
                              attrs: {
                                title: item.label,
                                name: index,
                                current:
                                  _vm.textBookResource["interactionCurrent"],
                              },
                              on: {
                                collapseClick: function (e) {
                                  return (
                                    (_vm.textBookResource[
                                      "interactionCurrent"
                                    ] = e),
                                    (item.state = true)
                                  )
                                },
                              },
                            },
                            _vm._l(
                              item[_vm.resourceType],
                              function (items, index) {
                                return _c(
                                  "div",
                                  { staticClass: "resource-item" },
                                  [
                                    _c(
                                      "div",
                                      {
                                        directives: [
                                          {
                                            name: "show",
                                            rawName: "v-show",
                                            value: items.isTrialExternal,
                                            expression: "items.isTrialExternal",
                                          },
                                        ],
                                        staticClass:
                                          "mask-layer-trial-external min-mask-layer",
                                      },
                                      [
                                        _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_resource_lock_svg__,
                                            alt: "",
                                          },
                                        }),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("div", {
                                      staticClass: "resource-icon",
                                      class: _vm.resourceIcon,
                                    }),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      { staticClass: "resource-title" },
                                      [_vm._v(_vm._s(items.fileNames))]
                                    ),
                                    _vm._v(" "),
                                    _c("img", {
                                      staticClass: "location",
                                      attrs: {
                                        src: __$_require_static_images_icons_resource_positioning_png__,
                                        alt: "",
                                      },
                                      on: {
                                        click: function ($event) {
                                          $event.stopPropagation();
                                          return _vm.resourceDetails(
                                            item,
                                            items,
                                            "resource"
                                          )
                                        },
                                      },
                                    }),
                                  ]
                                )
                              }
                            ),
                            0
                          )
                        })
                      : _vm.resourceType == "resourceList"
                      ? _vm._l(_vm.list, function (item, index) {
                          return _c(
                            "xml-collapse",
                            {
                              key: index,
                              attrs: {
                                title: item.label,
                                name: index,
                                current: _vm.textBookResource["imageCurrent"],
                              },
                              on: {
                                collapseClick: function (e) {
                                  return (
                                    (_vm.textBookResource["imageCurrent"] = e),
                                    (item.state = true)
                                  )
                                },
                              },
                            },
                            _vm._l(
                              item[_vm.resourceType],
                              function (items, index) {
                                return _c(
                                  "div",
                                  { staticClass: "resource-item" },
                                  [
                                    _c(
                                      "div",
                                      {
                                        directives: [
                                          {
                                            name: "show",
                                            rawName: "v-show",
                                            value: items.isTrialExternal,
                                            expression: "items.isTrialExternal",
                                          },
                                        ],
                                        staticClass:
                                          "mask-layer-trial-external min-mask-layer",
                                      },
                                      [
                                        _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_resource_lock_svg__,
                                            alt: "",
                                          },
                                        }),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("div", {
                                      staticClass: "resource-icon",
                                      class: _vm.resourceIcon,
                                    }),
                                    _vm._v(" "),
                                    _c(
                                      "div",
                                      { staticClass: "resource-title" },
                                      [
                                        _vm._v(
                                          _vm._s(
                                            items.ilk == "ebook"
                                              ? items.name
                                              : items.title
                                          )
                                        ),
                                      ]
                                    ),
                                    _vm._v(" "),
                                    _c("img", {
                                      staticClass: "location",
                                      attrs: {
                                        src: __$_require_static_images_icons_resource_positioning_png__,
                                        alt: "",
                                      },
                                      on: {
                                        click: function ($event) {
                                          $event.stopPropagation();
                                          return _vm.resourceDetails(
                                            item,
                                            items,
                                            "resource"
                                          )
                                        },
                                      },
                                    }),
                                  ]
                                )
                              }
                            ),
                            0
                          )
                        })
                      : _vm.resourceType == "teachingResource"
                      ? _vm._l(_vm.list, function (item, index) {
                          return _c(
                            "xml-collapse",
                            {
                              key: index,
                              attrs: {
                                title: item.firstLevelLabel,
                                name: index,
                                current: _vm.collapseCurrent,
                              },
                              on: {
                                collapseClick: function (e) {
                                  return (
                                    (_vm.collapseCurrent = e),
                                    (item.state = true)
                                  )
                                },
                              },
                            },
                            _vm._l(item.list, function (items, index) {
                              return _c(
                                "div",
                                {
                                  key: index,
                                  class: [
                                    items.location == _vm.location
                                      ? "current-teacher-resources"
                                      : "",
                                    items.resourcesType == "notes"
                                      ? "xml-teacher-note-box"
                                      : "",
                                  ],
                                },
                                [
                                  items.resourcesType == "notes"
                                    ? [
                                        _c(
                                          "div",
                                          { staticClass: "xml-teacher-note" },
                                          [
                                            _c(
                                              "div",
                                              {
                                                staticClass: "xml-note-header",
                                              },
                                              [
                                                _c("img", {
                                                  staticClass: "note-icon",
                                                  attrs: {
                                                    src: __$_require_static_images_icons_resource_note_icon_svg__,
                                                    alt: "",
                                                  },
                                                }),
                                                _vm._v(" "),
                                                _c("img", {
                                                  staticClass: "location",
                                                  attrs: {
                                                    src: __$_require_static_images_icons_resource_positioning_png__,
                                                    alt: "",
                                                  },
                                                  on: {
                                                    click: function ($event) {
                                                      $event.stopPropagation();
                                                      return _vm.resourceDetails(
                                                        item,
                                                        items,
                                                        "marker"
                                                      )
                                                    },
                                                  },
                                                }),
                                              ]
                                            ),
                                            _vm._v(" "),
                                            _c(
                                              "div",
                                              { staticClass: "note-content" },
                                              [
                                                _c("xmlTextOverflow", {
                                                  attrs: {
                                                    info: items.noteContent,
                                                  },
                                                }),
                                              ],
                                              1
                                            ),
                                          ]
                                        ),
                                      ]
                                    : [
                                        _c(
                                          "div",
                                          { staticClass: "resource-item" },
                                          [
                                            _c("div", {
                                              staticClass: "resource-icon",
                                              class: [
                                                items.resourcesType ==
                                                "recorded"
                                                  ? "recorded"
                                                  : items.fileExt
                                                  ? items.fileExt.replace(
                                                      /\./gi,
                                                      ""
                                                    )
                                                  : "",
                                                _vm.isPlay == items.id
                                                  ? "isPlay"
                                                  : "",
                                              ],
                                              attrs: { userType: _vm.userType },
                                            }),
                                            _vm._v(" "),
                                            _c(
                                              "div",
                                              {
                                                staticClass: "resource-title",
                                                on: {
                                                  click: function ($event) {
                                                    return _vm.resourceReader(
                                                      item,
                                                      items
                                                    )
                                                  },
                                                },
                                              },
                                              [
                                                _vm._v(
                                                  "\n                      " +
                                                    _vm._s(
                                                      items.resourcesType ==
                                                        "recorded"
                                                        ? _vm.formatTime(
                                                            items.duration
                                                          )
                                                        : items.resourcesName
                                                    ) +
                                                    "\n                    "
                                                ),
                                              ]
                                            ),
                                            _vm._v(" "),
                                            _c("img", {
                                              directives: [
                                                {
                                                  name: "show",
                                                  rawName: "v-show",
                                                  value: items.isDownload == 1,
                                                  expression:
                                                    "items.isDownload == 1",
                                                },
                                              ],
                                              staticClass: "location",
                                              attrs: {
                                                src: __$_require_static_images_icons_resource_download_icon_png__,
                                                alt: "",
                                              },
                                              on: {
                                                click: function ($event) {
                                                  $event.stopPropagation()
                                                  ;(_vm.downloadFileLink =
                                                    items.fileUrl),
                                                    (_vm.$refs.downFileUppop.isShow = true);
                                                },
                                              },
                                            }),
                                            _vm._v(" "),
                                            _c("img", {
                                              staticClass: "location",
                                              attrs: {
                                                src: __$_require_static_images_icons_resource_positioning_png__,
                                                alt: "",
                                              },
                                              on: {
                                                click: function ($event) {
                                                  $event.stopPropagation();
                                                  return _vm.resourceDetails(
                                                    item,
                                                    items,
                                                    "marker"
                                                  )
                                                },
                                              },
                                            }),
                                          ]
                                        ),
                                      ],
                                ],
                                2
                              )
                            }),
                            0
                          )
                        })
                      : _vm._e(),
                    _vm._v(" "),
                    _c("xml-empty", {
                      directives: [
                        {
                          name: "show",
                          rawName: "v-show",
                          value: _vm.list.length == 0,
                          expression: "list.length == 0",
                        },
                      ],
                    }),
                  ],
                  2
                ),
              ]),
            ],
            2
          ),
        ]
      ),
      _vm._v(" "),
      _vm.audioData.show
        ? _c("audio-player-page", {
            attrs: { url: _vm.audioData.src },
            on: {
              back: function ($event) {
                _vm.audioData.show = false;
              },
              timeUpdate: function (e) {
                return _vm.timeAudioUpdate(e)
              },
            },
          })
        : _vm._e(),
      _vm._v(" "),
      _vm.videoData.show
        ? _c("div", { staticClass: "video-resource-player" }, [
            _c("i", {
              staticClass: "el-icon-back",
              attrs: { "on-close": _vm.closeViewer },
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                  _vm.videoData.show = false;
                },
              },
            }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "video-content" },
              [
                _c("video-modal-player", {
                  attrs: { src: _vm.videoData.src },
                  on: {
                    timeUpdate: function (e) {
                      return _vm.timeVideoUpdate(e)
                    },
                  },
                }),
              ],
              1
            ),
          ])
        : _vm._e(),
      _vm._v(" "),
      _c("down-file-uppop", {
        ref: "downFileUppop",
        attrs: {
          downloadFileLink: _vm.downloadFileLink,
          showToast: _vm.showToast,
        },
      }),
      _vm._v(" "),
      _c("audio", {
        ref: "musicAudio",
        staticClass: "audio-component",
        attrs: { controls: "", preload: "auto", src: _vm.audioUrl },
        on: {
          ended: function ($event) {
            _vm.isPlay = "";
          },
        },
      }),
    ],
    1
  )
};
var __vue_staticRenderFns__$2_ = [];
__vue_render__$2_._withStripped = true;

  /* style */
  const __vue_inject_styles__$2_ = undefined;
  /* scoped */
  const __vue_scope_id__$2_ = undefined;
  /* module identifier */
  const __vue_module_identifier__$2_ = undefined;
  /* functional template */
  const __vue_is_functional_template__$2_ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2_ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2_, staticRenderFns: __vue_staticRenderFns__$2_ },
    __vue_inject_styles__$2_,
    __vue_script__$2_,
    __vue_scope_id__$2_,
    __vue_is_functional_template__$2_,
    __vue_module_identifier__$2_,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2Z = {
  name: 'xmlPreviewSearch',
  props: {
    viewList: Object,
    componentList: Array,
    title: String,
    pageType: {
      type: String,
      default: 'h5'
    },
    searchValue: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      urlPre: '../assets/images/icons/',
      list: [],
      input: '',
      ArrList: [],
      searchTextShow: true,
      showEllipsisButton: false,
      contentExpand: false,
      show: true,
      collapseCurrent: 0
    };
  },
  watch: {
    // 监听输入框
    // 监听input的值，当值改变时，调用changeInput方法
    input(a, b) {
      if (a.replace(/\s+/g, '') != b.replace(/\s+/g, '')) {
        this.changeInput();
        this.contentExpand = false;
      }
    },
    searchValue: {
      handler(newValue) {
        this.input = newValue;
      }
    }
  },
  computed: {
    searchList() {
      let list = this.list;
      const map = [];
      list.forEach(e => {
        if (e.type == 'note__teacher') {
          this.teacherNoteList.push(e);
        }
        const findObj = map.find(innerTmp => innerTmp.firstLevelId === e.firstLevelId);
        if (findObj) {
          findObj.list.push(e);
        } else {
          map.push({
            firstLevelId: e.firstLevelId,
            firstLevelLabel: e.firstLevelLabel,
            chapterOrderNum: e.chapterOrderNum,
            list: [e]
          });
        }
      });
      return map;
    }
  },
  methods: {
    changeInput() {
      if (this.input.replace(/\s+/g, '') !== '') {
        this.list = XmlSearchWord(this.componentList, this.input.replace(/\s+/g, ''));
        if (this.list.length > 0) {
          this.showEllipsisButton = true;
        }
      } else {
        this.list = [];
        console.log('输入为空');
      }
    },
    stopPropagation(event) {
      event.stopPropagation();
    },
    seachItem(e) {
      e.inputText = this.input.replace(/\s+/g, '');
      this.$emit('seachItem', e, this.input, this.show);
    },
    onBackClick() {
      this.$emit('onBackClick');
    },
    brightenKeyword(val) {
      const keyword = this.input.replace(/\s+/g, '');
      const Reg = new RegExp(keyword, 'g');
      let res = '';
      if (val) {
        res = val.replace(Reg, `<span style="color: red;">${keyword}</span>`);
        return res;
      }
    },
    // 展开下拉
    toggleSearchText(id) {
      this.contentExpand = !this.contentExpand;
      this.searchTextShow = !this.searchTextShow;
    }
  }
};

/* script */
const __vue_script__$2Z = script$2Z;
var __vue_render__$2Z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { class: "xmlPreviewSearch-box-" + _vm.pageType }, [
    _vm.pageType == "h5"
      ? _c("div", { staticClass: "xmlPreviewSearch-input" }, [
          _c("input", {
            directives: [
              {
                name: "model",
                rawName: "v-model",
                value: _vm.input,
                expression: "input",
              },
            ],
            staticClass: "input",
            attrs: { maxlength: "20", placeholder: "请输入" },
            domProps: { value: _vm.input },
            on: {
              change: _vm.changeInput,
              input: function ($event) {
                if ($event.target.composing) {
                  return
                }
                _vm.input = $event.target.value;
              },
            },
          }),
          _vm._v(" "),
          _c(
            "button",
            {
              staticClass: "input_text",
              on: {
                click: function ($event) {
                  return _vm.changeInput()
                },
              },
            },
            [
              _c(
                "span",
                {
                  staticStyle: {
                    color: "#fff",
                    "font-size": "14px",
                    "font-weight": "normal",
                  },
                },
                [_vm._v("搜索")]
              ),
            ]
          ),
        ])
      : _vm._e(),
    _vm._v(" "),
    _vm.pageType == "pc"
      ? _c("div", { class: "xmlPreviewSearch-input-" + _vm.pageType }, [
          _c(
            "div",
            {
              staticStyle: { "font-size": "16px", cursor: "pointer" },
              on: { click: _vm.onBackClick },
            },
            [
              _c("i", {
                staticClass: "el-icon-arrow-left",
                staticStyle: { "font-size": "16px" },
              }),
              _vm._v("返回\n    "),
            ]
          ),
        ])
      : _vm._e(),
    _vm._v(" "),
    _c(
      "div",
      { staticClass: "seach-list", on: { click: _vm.stopPropagation } },
      [
        _vm._l(_vm.searchList, function (item, index) {
          return _c(
            "xml-collapse",
            {
              key: index,
              attrs: {
                title: item.firstLevelLabel,
                name: index,
                current: _vm.collapseCurrent,
              },
              on: {
                collapseClick: function (e) {
                  return (_vm.collapseCurrent = e)
                },
              },
            },
            _vm._l(item.list, function (items, index) {
              return _c(
                "div",
                {
                  staticClass: "resource-item",
                  on: {
                    click: function ($event) {
                      return _vm.seachItem(items)
                    },
                  },
                },
                [
                  _c("div", {
                    staticClass: "seach-text",
                    domProps: {
                      innerHTML: _vm._s(
                        _vm.brightenKeyword(items.searchText, _vm.input)
                      ),
                    },
                  }),
                ]
              )
            }),
            0
          )
        }),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.list.length == 0 && _vm.input == "",
                expression: "list.length == 0 && input == ''",
              },
            ],
            staticClass: "seach_zaiwu",
          },
          [
            _c("div", { staticClass: "search_left_img" }, [
              _c("img", {
                attrs: { src: __$_require_assets_images_icons_without_png__ },
              }),
            ]),
          ]
        ),
        _vm._v(" "),
        _c(
          "p",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.input !== "" && _vm.list.length == 0,
                expression: "input !== '' && list.length == 0",
              },
            ],
            staticClass: "search_no_data",
            staticStyle: {
              margin: "0",
              "text-align": "center",
              "line-height": "14",
              color: "#666666",
              "font-size": "24px",
              "font-weight": "100",
            },
          },
          [_vm._v("\n      搜索无结果\n    ")]
        ),
      ],
      2
    ),
  ])
};
var __vue_staticRenderFns__$2Z = [];
__vue_render__$2Z._withStripped = true;

  /* style */
  const __vue_inject_styles__$2Z = undefined;
  /* scoped */
  const __vue_scope_id__$2Z = "data-v-557f2afa";
  /* module identifier */
  const __vue_module_identifier__$2Z = undefined;
  /* functional template */
  const __vue_is_functional_template__$2Z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2Z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2Z, staticRenderFns: __vue_staticRenderFns__$2Z },
    __vue_inject_styles__$2Z,
    __vue_script__$2Z,
    __vue_scope_id__$2Z,
    __vue_is_functional_template__$2Z,
    __vue_module_identifier__$2Z,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2Y = {
  name: 'xml-toolbar-phone',
  components: {
    resourceListPhone: __vue_component__$2_,
    searchPhone: __vue_component__$2Z
  },
  props: {
    pageType: {
      type: String,
      default: 'h5'
    },
    textBookName: {
      type: String,
      default: ''
    },
    textBookResource: {
      type: Object,
      default: () => {}
    },
    resourcesList: {
      type: Array,
      default: () => []
    },
    catalogList: {
      type: Array,
      default: () => []
    },
    userType: {
      // 用户类型，可选teacher、student
      type: String,
      default: ''
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    componentList: {
      type: Array,
      default: () => []
    },
    schedule: {
      type: String,
      default: '0'
    },
    location: {
      type: String,
      default: ''
    },
    showToast: {
      type: Function,
      default: null
    },
    notesList: {
      type: Array,
      default: () => []
    },
    //笔记列表
    bookmarkList: {
      type: Array,
      default: () => []
    },
    //书签列表
    highlightList: {
      //高亮列表
      type: Array,
      default: () => []
    },
    linkList: {
      //划线列表
      type: Array,
      default: () => []
    },
    title: {
      type: String,
      default: ''
    },
    checkedId: {
      //当前选中视频
      type: String,
      default: ''
    },
    isShowTeacherResource: {
      type: Boolean,
      default: false
    },
    settingData: {
      type: Object,
      default: () => {}
    },
    sysEnv: {
      type: Object,
      default: () => {}
    },
    loadingMode: {
      // 加载模式，可选roll、page
      type: String,
      default: 'page'
    },
    showToolbar: {
      type: Boolean,
      default: true
    },
    isAddMark: {
      //是否可以添加标记
      type: Boolean,
      default: true
    },
    readableChapters: {
      //可以阅读的章节
      type: Array,
      default: () => []
    },
    showoQuestionBank: {
      //是否显示打开题库按钮
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      activeNames: ['1'],
      curnotetabs: 0,
      noteTabbarList: [{
        id: 0,
        name: '笔记',
        show: this.sysEnv.tippy.note
      }, {
        id: 3,
        name: '划线',
        show: this.sysEnv.tippy.link
      }, {
        id: 1,
        name: '书签',
        show: this.sysEnv.tippy.bookmark
      }, {
        id: 2,
        name: '高亮',
        show: this.sysEnv.tippy.highlight
      }],
      toolbarList: [{
        id: 0,
        name: '目录',
        default: 'icon_10',
        select: 'icon_up_10'
      }, {
        id: 1,
        name: '记录',
        default: 'icon_11',
        select: 'icon_up_11'
      }, {
        id: 2,
        name: '资源',
        default: 'icon_12',
        select: 'icon_up_12'
      }, {
        id: 3,
        name: '智练',
        default: 'icon_14',
        select: 'icon_14'
      }, {
        id: 4,
        name: '设置',
        default: 'icon_13',
        select: 'icon_up_13'
      }],
      current: -1,
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      form: {
        themeFontFamily: '',
        //字体
        themeFontSize: 2,
        //字号
        themeBgColor: '',
        //当前颜色
        themeLineHeight: undefined,
        //行间距
        themeLetterSpacing: undefined //字间距
      },
      fontSizeLabelMap,
      options: [{
        value: '',
        label: '默认'
      }, {
        value: '宋体, SimSun',
        label: '宋体'
      }, {
        value: '楷体, 楷体_GB2312, SimKai',
        label: '楷体'
      }, {
        value: '黑体, SimHei',
        label: '黑体'
      }],
      RowOptions: [{
        value: '10',
        label: '10'
      }, {
        value: '20',
        label: '20'
      }, {
        value: '30',
        label: '30'
      }],
      WordOptions: [{
        value: '10',
        label: '10'
      }, {
        value: '20',
        label: '20'
      }, {
        value: '30',
        label: '30'
      }],
      colorList: [{
        colorval: '#EFEFEF'
      }, {
        colorval: '#DDD8C5'
      }, {
        colorval: '#F2DCC4'
      }, {
        colorval: '#E6F7E5'
      }, {
        colorval: '#FBDEE2'
      }
      // {
      //   colorval: '#000000'
      // }
      ],
      selectId: '',
      isShowSearch: false,
      isShowToolbar: this.showToolbar,
      innerHeight: window.innerHeight,
      noteNames: '',
      bookmarkNames: '',
      highlightNames: '',
      linkNames: ''
    };
  },
  watch: {
    settingData: {
      handler(newValue) {
        this.form = {
          ...this.form,
          ...newValue
        };
      },
      immediate: true,
      deep: true
    },
    notesList: {
      handler(newValue) {
        if (this.noteNames == '' || JSON.stringify(newValue).indexOf(this.noteNames) == -1) {
          this.noteNames = newValue[0]?.firstLevelId;
        }
      },
      immediate: true,
      deep: true
    },
    bookmarkList: {
      handler(newValue) {
        if (this.bookmarkNames == '' || JSON.stringify(newValue).indexOf(this.bookmarkNames) == -1) {
          this.bookmarkNames = newValue[0]?.firstLevelId;
        }
      },
      immediate: true,
      deep: true
    },
    highlightList: {
      handler(newValue) {
        if (this.highlightNames == '' || JSON.stringify(newValue).indexOf(this.highlightNames) == -1) {
          this.highlightNames = newValue[0]?.firstLevelId;
        }
      },
      immediate: true,
      deep: true
    },
    linkList: {
      handler(newValue) {
        if (this.linkNames == '' || JSON.stringify(newValue).indexOf(this.linkNames) == -1) {
          this.linkNames = newValue[0]?.firstLevelId;
        }
      },
      immediate: true,
      deep: true
    }
  },
  mounted() {
    // console.log('this.notesList[0]111111', this.notesList[0])
    // this.noteNames = this.notesList[0]?.firstLevelId
    // this.noteNames = this.notesList[0]?.firstLevelId
    // this.noteNames = this.notesList[0]?.firstLevelId
  },
  methods: {
    //
    clickToolbar(e) {
      if (this.current != e.id && e.id != 3) {
        setTimeout(() => {
          this.current = e.id;
        }, 100);
      } else {
        this.current = -1;
      }
      if (e.id == 0) {
        this.$refs.catalogPopup.show = !this.$refs.catalogPopup.show;
        this.selectId = this.checkedId;
        this.$refs.setPopup.show = false;
        this.$refs.notePpoup.show = false;
        this.$refs.resourceListPopup.showResourceList(false);
      } else if (e.id == 1) {
        this.$refs.notePpoup.show = !this.$refs.notePpoup.show;
        this.$refs.setPopup.show = false;
        this.$refs.catalogPopup.show = false;
        this.$refs.resourceListPopup.showResourceList(false);
      } else if (e.id == 2) {
        this.$refs.setPopup.show = false;
        this.$refs.catalogPopup.show = false;
        this.$refs.notePpoup.show = false;
        this.$refs.resourceListPopup.showResourceList(true);
      } else if (e.id == 3) ; else if (e.id == 4) {
        this.$refs.setPopup.show = !this.$refs.setPopup.show;
        this.$refs.catalogPopup.show = false;
        this.$refs.notePpoup.show = false;
        this.$refs.resourceListPopup.showResourceList(false);
      }
      this.$refs.searchPopShow.show = false;
      if (e.id == 3) {
        this.$emit('openQuestionBank');
      } else {
        this.$emit('clickToolbarPhone', this.toolbarList[e]);
      }
    },
    // 设置字体
    setThemeFontFamily(value) {
      this.form.themeFontFamily = value;
      this.$emit('settingChange', 'themeFontFamily', value);
    },
    // 设置字号
    setThemeFontSize(type) {
      let emit = false;
      switch (type) {
        case 'plus':
          if (this.form.themeFontSize < 3) {
            this.form.themeFontSize++;
            emit = true;
          }
          break;
        case 'minus':
          if (this.form.themeFontSize > 1) {
            this.form.themeFontSize--;
            emit = true;
          }
          break;
      }
      emit && this.$emit('settingChange', 'themeFontSize', this.form.themeFontSize);
    },
    readingMode(type) {
      this.$emit('settingChange', 'readingMode', type);
    },
    // 选择颜色
    setThemeBgColor(color) {
      if (color === this.form.themeBgColor) {
        color = '';
      }
      this.form.themeBgColor = color;
      this.$emit('settingChange', 'themeBgColor', color);
    },
    setThemeLineHeight(value) {
      this.form.themeLineHeight = value;
      this.$emit('settingChange', 'themeLineHeight', value);
    },
    setThemeLetterSpacing(value) {
      this.form.themeLetterSpacing = value;
      this.$emit('settingChange', 'themeLetterSpacing', value);
    },
    //笔记点击标签
    clicknotetab(e) {
      this.curnotetabs = e;
    },
    //当前展开
    handleChange(val) {
      console.log(val);
    },
    expandOrCollapseNode(node) {
      node.expanded = !node.expanded;
    },
    nodeClick(data) {
      this.$emit('onNodeClick', {
        id: data.id,
        label: data.label,
        xmlCompRef: data.xmlCompRef,
        locationChapterId: data.locationChapterId
      });
      this.selectId = data.id;
      this.clickToolbar({
        id: 0
      });
    },
    backClick() {
      this.$emit('onBackClick');
    },
    filterNode(value, data, node) {
      return data.hiddenFlag !== '1';
    },
    expandHandle() {
      //   this.expandAll = !this.expandAll;
      // this.expandNodes(this.$refs.tree.store.root, 1)
    },
    // 遍历树形数据，设置每一项的expanded属性，实现展开收起
    expandNodes(node, level) {
      //   node.expanded = this.expandAll;

      node.expanded = true;
      for (let i = 0; i < node.childNodes.length; i++) {
        node.childNodes[i].expanded = this.expandAll;
        if (node.childNodes[i].childNodes.length > 0 && this.catalogShow == 0) {
          this.expandNodes(node.childNodes[i], level + 1);
        } else if (node.childNodes[i].childNodes.length > 0 && level < this.catalogShow) {
          this.expandNodes(node.childNodes[i], level + 1);
        }
      }
    },
    // 跳转到资源所在位置
    resourceDetails(data) {
      let list = data.location.split('/');
      let markId = `${list[2]}_#_${data.markEfiCode}`;
      let selectorId = data.jumpType == 'resource' ? data.titleClass : data.jumpType == 'marker' ? markId : '';
      console.log('🚀 ~ resourceDetails ~ selectorId:', data.type, selectorId);
      let selectorType = data.jumpType == 'resource' ? 'class' : data.jumpType == 'marker' ? 'id' : '';
      this.$emit('resourceDetails', {
        location: data.location,
        maxTop: -30,
        type: data.jumpType,
        selectorType,
        selectorId,
        markTarget: data,
        classIndex: data.index
      });
      this.clickToolbar({
        id: data.toolbarIndex
      });
    },
    // 教师资源预览
    resourceReader(items) {
      this.isShowToolbar = false;
      this.$emit('resourceReader', items);
    },
    showSearch() {
      this.$refs.searchPopShow.show = true;
      this.current = 9;
    },
    seachItem(item, text) {
      let data = {
        location: item.location,
        maxTop: -30,
        type: 'search',
        selectorType: 'class',
        selectorId: 'xml-search-highlight',
        markTarget: '',
        classIndex: 0,
        seachText: text
      };
      this.$emit('resourceDetails', data);
      this.$refs.searchPopShow.show = false;
    },
    // 添加书签
    addBookmark(location) {
      if (JSON.stringify(this.bookmarkList).indexOf(this.location) === -1) {
        // 添加书签

        this.$emit('addBookmark', location);
      } else {
        console.log('移除', location);
        // 移除书签
        this.$emit('deleteBookmark', location);
      }
    },
    // 打开教师资源列表
    openTeacherResoucesList(e) {
      this.$refs.resourceListPopup.openTeacherResoucesList(e);
    },
    deleteNote(items) {
      Dialog.confirm({
        title: '提示',
        message: '确认删除此条笔记吗？',
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        overlayClass: 'xml-dialog-overlay',
        className: 'xml-dialog-confirm'
      }).then(() => {
        this.$EventBus.$emit('deleteNote', items, () => {});
      }).catch(() => {});
    },
    deleteBookmark(items) {
      Dialog.confirm({
        title: '提示',
        message: '确认删除此条书签吗？',
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        overlayClass: 'xml-dialog-overlay',
        className: 'xml-dialog-confirm'
      }).then(() => {
        this.$EventBus.$emit('deleteBookmark', items);
      }).catch(() => {});
    },
    deleteHighlight(items, type) {
      Dialog.confirm({
        title: '提示',
        message: `确认删除此条${type == 'highlight' ? '高亮' : '划线'}吗？`,
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        overlayClass: 'xml-dialog-overlay',
        className: 'xml-dialog-confirm'
      }).then(() => {
        this.$EventBus.$emit(type == 'highlight' ? 'deleteHighlight' : 'deleteLink', items, () => {});
      }).catch(() => {});
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      }
    },
    isTrialReading(chapterId) {
      if (!this.isTrial) return false;
      let i = !this.readableChapters.includes(chapterId);
      return i;
    }
  }
};

var __$_require_static_images_icons_toolbar_bookmark_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M12%2010.5V14.5C12%2014.5905%2011.9755%2014.6793%2011.929%2014.757C11.8825%2014.8346%2011.8158%2014.8982%2011.736%2014.9409C11.6562%2014.9836%2011.5663%2015.0038%2011.4759%2014.9995C11.3855%2014.9951%2011.298%2014.9663%2011.2227%2014.9161L7%2012.1009L2.77734%2014.9161C2.70204%2014.9663%202.61452%2014.9951%202.52412%2014.9995C2.43372%2015.0038%202.34383%2014.9836%202.26404%2014.9409C2.18425%2014.8982%202.11754%2014.8346%202.07104%2014.757C2.02454%2014.6793%201.99999%2014.5905%202%2014.5V2C2.00029%201.73487%202.10574%201.48069%202.29321%201.29321C2.48069%201.10574%202.73487%201.00029%203%201H11C11.2651%201.00029%2011.5193%201.10574%2011.7068%201.29321C11.8943%201.48069%2011.9997%201.73487%2012%202V2.5C12%202.63261%2011.9473%202.75979%2011.8536%202.85355C11.7598%202.94732%2011.6326%203%2011.5%203C11.3674%203%2011.2402%202.94732%2011.1464%202.85355C11.0527%202.75979%2011%202.63261%2011%202.5V2H3V13.5658L6.72266%2011.0839C6.80479%2011.0292%206.90129%2010.9999%207%2010.9999C7.09871%2010.9999%207.19521%2011.0292%207.27734%2011.0839L11%2013.5658V10.5C11%2010.3674%2011.0527%2010.2402%2011.1464%2010.1464C11.2402%2010.0527%2011.3674%2010%2011.5%2010C11.6326%2010%2011.7598%2010.0527%2011.8536%2010.1464C11.9473%2010.2402%2012%2010.3674%2012%2010.5ZM13.5%206H12V4.5C12%204.36739%2011.9473%204.24021%2011.8536%204.14645C11.7598%204.05268%2011.6326%204%2011.5%204C11.3674%204%2011.2402%204.05268%2011.1464%204.14645C11.0527%204.24021%2011%204.36739%2011%204.5V6H9.5C9.36739%206%209.24021%206.05268%209.14645%206.14645C9.05268%206.24021%209%206.36739%209%206.5C9%206.63261%209.05268%206.75979%209.14645%206.85355C9.24021%206.94732%209.36739%207%209.5%207H11V8.5C11%208.63261%2011.0527%208.75979%2011.1464%208.85355C11.2402%208.94732%2011.3674%209%2011.5%209C11.6326%209%2011.7598%208.94732%2011.8536%208.85355C11.9473%208.75979%2012%208.63261%2012%208.5V7H13.5C13.6326%207%2013.7598%206.94732%2013.8536%206.85355C13.9473%206.75979%2014%206.63261%2014%206.5C14%206.36739%2013.9473%206.24021%2013.8536%206.14645C13.7598%206.05268%2013.6326%206%2013.5%206Z%22%20fill%3D%22%230D3B8B%22%2F%3E%3C%2Fsvg%3E";

var __$_require_static_images_icons_toolbar_bookmark_up_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url%28%23clip0_134_1211%29%22%3E%3Cpath%20d%3D%22M13.3333%200H2.66666C2.43091%200%202.20482%200.0936505%202.03812%200.260349C1.87142%200.427048%201.77777%200.653141%201.77777%200.888888V15.1111C1.77823%2015.2626%201.81741%2015.4115%201.8916%2015.5436C1.9658%2015.6758%202.07253%2015.7867%202.20167%2015.866C2.3308%2015.9452%202.47806%2015.9902%202.62945%2015.9965C2.78084%2016.0029%202.93134%2015.9704%203.06666%2015.9022L7.99999%2013.44L12.9333%2015.9022C13.0572%2015.9657%2013.1942%2015.9992%2013.3333%2016C13.4997%2016.0005%2013.663%2015.9543%2013.8044%2015.8667C13.9325%2015.7866%2014.0381%2015.6752%2014.1112%2015.543C14.1843%2015.4108%2014.2225%2015.2622%2014.2222%2015.1111V0.888888C14.2222%200.653141%2014.1286%200.427048%2013.9619%200.260349C13.7952%200.0936505%2013.5691%200%2013.3333%200ZM11.2978%205.96444L7.74221%209.51999C7.65958%209.60331%207.56127%209.66944%207.45295%209.71456C7.34463%209.75969%207.22844%209.78293%207.1111%209.78293C6.99376%209.78293%206.87757%209.75969%206.76926%209.71456C6.66094%209.66944%206.56262%209.60331%206.47999%209.51999L4.70221%207.74222C4.53483%207.57484%204.4408%207.34782%204.4408%207.11111C4.4408%206.87439%204.53483%206.64738%204.70221%206.48C4.86959%206.31262%205.09661%206.21858%205.33332%206.21858C5.57004%206.21858%205.79705%206.31262%205.96444%206.48L7.1111%207.63555L10.0355%204.70222C10.2029%204.53484%2010.4299%204.4408%2010.6667%204.4408C10.9034%204.4408%2011.1304%204.53484%2011.2978%204.70222C11.4651%204.8696%2011.5592%205.09662%2011.5592%205.33333C11.5592%205.57004%2011.4651%205.79706%2011.2978%205.96444Z%22%20fill%3D%22%231681E5%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip0_134_1211%22%3E%3Crect%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22white%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E";

var __$_require_static_images_icons_toolbar_search_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M6.97055%202.77438C9.12004%202.77782%2010.9176%204.40873%2011.1293%206.54772C11.3413%208.68671%209.89843%2010.6386%207.79156%2011.0635C5.68449%2011.4885%203.59802%2010.2485%202.96428%208.19459C2.33055%206.14065%203.35519%203.94065%205.33519%203.10428C5.85257%202.88543%206.40879%202.77322%206.97055%202.77438ZM6.97055%201.80469C4.11438%201.80469%201.79883%204.12024%201.79883%206.9764C1.79883%209.83257%204.11438%2012.1481%206.97055%2012.1481C9.82671%2012.1481%2012.1423%209.83257%2012.1423%206.9764C12.1423%204.12024%209.82671%201.80469%206.97055%201.80469ZM13.7099%2014.2006C13.6462%2014.2008%2013.5831%2014.1883%2013.5243%2014.1639C13.4654%2014.1394%2013.412%2014.1036%2013.3671%2014.0584L10.9105%2011.6019C10.7269%2011.4116%2010.7295%2011.1091%2010.9164%2010.9221C11.1035%2010.735%2011.4059%2010.7324%2011.596%2010.9162L14.0526%2013.3728C14.1203%2013.4406%2014.1665%2013.527%2014.1852%2013.621C14.2039%2013.715%2014.1943%2013.8125%2014.1576%2013.9011C14.121%2013.9897%2014.059%2014.0655%2013.9793%2014.1188C13.8996%2014.1721%2013.8058%2014.2006%2013.7099%2014.2006Z%22%20fill%3D%22%230D3B8B%22%2F%3E%3C%2Fsvg%3E";

var __$_require_static_images_icons_resource_note_icon_02_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2218%22%20viewBox%3D%220%200%2018%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M9.27034%2010.2555C9.80903%209.48573%2011.7823%206.71929%2012.5213%206.12418C11.579%208.23479%209.72279%2010.4064%208.61195%2012.4771C10.664%2013.1309%2011.594%2012.356%2012.7261%2011.4539L11.6043%2011.2515C13.029%2010.8125%2012.9295%2010.9751%2013.4284%2010.3266C13.8242%209.8123%2014.1527%209.11816%2014.2731%208.39322L13.346%208.50179C13.6418%208.33986%2014.3005%208.05532%2014.4052%207.89662C14.685%207.47231%2015.42%203.41471%2015.4286%202.57129C12.5954%202.59592%208.06861%208.16155%207.74116%2010.8215C7.41169%2013.4959%204.17444%2017.537%209.27034%2010.2555ZM13.4937%2011.7593C14.3387%2012.2331%2014.8413%2012.845%2014.8413%2013.5268C14.8413%2017.2052%202.57141%2017.2052%202.57141%2013.5268C2.57141%2011.8377%205.35854%2011.0801%206.80242%2010.8726C6.76843%2011.0999%206.69425%2011.3317%206.59731%2011.5687C5.60493%2011.7394%203.26887%2012.3708%203.26887%2013.5268C3.26887%2016.3054%2014.1438%2016.3054%2014.1438%2013.5268C14.1438%2013.0392%2013.6767%2012.574%2012.9049%2012.2C13.1025%2012.0647%2013.2964%2011.9154%2013.4937%2011.7593Z%22%20fill%3D%22%23333333%22%2F%3E%3C%2Fsvg%3E";

var __$_require_static_images_icons_resource_delete_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2014%2014%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20id%3D%22%26%23229%3B%26%23136%3B%26%23160%3B%26%23233%3B%26%23153%3B%26%23164%3B3%201%22%20clip-path%3D%22url%28%23clip0_235_1461%29%22%3E%3Cpath%20id%3D%22Vector%22%20d%3D%22M10.9266%2011.9545C10.9266%2012.4248%2010.5437%2012.8076%2010.0734%2012.8076H3.92656C3.45625%2012.8076%203.07344%2012.4248%203.07344%2011.9545V2.89824H10.9266V11.9545ZM4.77969%201.36699C4.77969%201.26855%204.85625%201.19199%204.95469%201.19199H9.05625C9.15469%201.19199%209.23125%201.26855%209.23125%201.36699V1.88105H4.77969V1.36699ZM13.4859%201.88105H10.2484V1.36699C10.2484%200.710728%209.7125%200.174805%209.05625%200.174805H4.95469C4.29844%200.174805%203.7625%200.710728%203.7625%201.36699V1.88105H0.514062C0.229687%201.88105%200%202.11074%200%202.39512C0%202.67949%200.229687%202.90918%200.514062%202.90918H2.04531V11.9545C2.04531%2012.9936%202.8875%2013.8357%203.92656%2013.8357H10.0734C11.1125%2013.8357%2011.9547%2012.9936%2011.9547%2011.9545V2.89824H13.4859C13.7703%202.89824%2014%202.66855%2014%202.38418C14%202.0998%2013.7703%201.88105%2013.4859%201.88105ZM7%2011.2654C7.28437%2011.2654%207.51406%2011.0357%207.51406%2010.7514V5.28262C7.51406%204.99824%207.28437%204.76855%207%204.76855C6.71563%204.76855%206.48594%204.99824%206.48594%205.28262V10.7514C6.48594%2011.0357%206.71563%2011.2654%207%2011.2654ZM4.60469%2011.2654C4.88906%2011.2654%205.11875%2011.0357%205.11875%2010.7514V5.28262C5.11875%204.99824%204.88906%204.76855%204.60469%204.76855C4.32031%204.76855%204.09063%204.99824%204.09063%205.28262V10.7514C4.10156%2011.0357%204.33125%2011.2654%204.60469%2011.2654ZM9.39531%2011.2654C9.67969%2011.2654%209.90937%2011.0357%209.90937%2010.7514V5.28262C9.90937%204.99824%209.67969%204.76855%209.39531%204.76855C9.11094%204.76855%208.88125%204.99824%208.88125%205.28262V10.7514C8.88125%2011.0357%209.11094%2011.2654%209.39531%2011.2654Z%22%20fill%3D%22%23FF5A5A%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip0_235_1461%22%3E%3Crect%20width%3D%2214%22%20height%3D%2214%22%20fill%3D%22white%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E";

var __$_require_static_images_icons_resource_student_bookmark_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2218%22%20viewBox%3D%220%200%2018%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10.1977%2015.4284C10.0303%2015.4296%209.8643%2015.3975%209.70937%2015.3341C9.55445%2015.2707%209.41363%2015.1772%209.29508%2015.059L8.89674%2014.6617C6.96962%2012.7382%205.04489%2010.8123%203.12255%208.8839C2.92267%208.68157%202.6826%208.40348%202.60468%208.03972C2.58456%207.94673%202.57413%207.8519%202.57355%207.75675C2.57115%206.4344%202.57077%205.11234%202.5724%203.79056C2.57326%203.10466%203.08898%202.58176%203.77086%202.57459C4.02714%202.57129%205.15529%202.57129%205.15529%202.57129H7.69226C8.00694%202.57129%208.28532%202.66887%208.57847%202.87995C8.81567%203.05099%209.01556%203.25174%209.2275%203.4644L15.0368%209.27005C15.4408%209.67427%2015.5434%2010.279%2015.2928%2010.7754C15.2315%2010.8974%2015.1512%2011.0088%2015.0549%2011.1055C13.7412%2012.4255%2012.4255%2013.7421%2011.1078%2015.0553C10.9883%2015.1745%2010.8463%2015.2689%2010.6901%2015.3329C10.5338%2015.3969%2010.3665%2015.4294%2010.1977%2015.4284ZM3.80487%203.42594C3.57327%203.42594%203.42375%203.56944%203.42375%203.79056C3.42217%205.33428%203.4226%206.5943%203.42533%207.75517C3.42533%207.8064%203.43609%207.87829%203.46694%207.9255C3.55017%208.05579%203.64444%208.20288%203.76081%208.31882C5.42706%209.98996%209.86102%2014.4219%209.86102%2014.4219C9.96147%2014.5224%2010.0786%2014.5762%2010.1978%2014.5762C10.317%2014.5762%2010.4361%2014.5218%2010.5385%2014.4183L11.6277%2013.3286C12.5426%2012.415%2013.4857%2011.471%2014.419%2010.5476C14.5091%2010.4541%2014.5595%2010.3293%2014.5595%2010.1994C14.5595%2010.0695%2014.5091%209.94468%2014.419%209.8512C13.5696%209.00788%2012.7078%208.14677%2011.8748%207.31378L9.34903%204.79545C9.23108%204.67793%209.11514%204.55639%209.00278%204.43887C8.69327%204.11515%208.4037%203.81209%208.053%203.56025C7.9382%203.47875%207.83388%203.4235%207.69183%203.4235L4.54056%203.42436L3.80487%203.42594ZM7.03807%208.69047C6.60029%208.68872%206.18103%208.5136%205.87208%208.20344C5.56313%207.89327%205.38965%207.47333%205.38961%207.03555C5.39363%206.13053%206.13377%205.39497%207.03979%205.39497C7.25757%205.39437%207.47331%205.43705%207.67446%205.52054C7.8756%205.60403%208.05816%205.72666%208.2115%205.8813C8.36485%206.03595%208.48594%206.21953%208.56773%206.42137C8.64953%206.62321%208.69039%206.8393%208.68796%207.05707C8.68394%207.95807%207.9461%208.69033%207.04352%208.69033L7.03807%208.69047ZM7.04453%206.03381C6.49064%206.03381%206.03591%206.48309%206.03074%207.03469C6.02929%207.16662%206.05418%207.29751%206.10395%207.4197C6.15373%207.54188%206.22738%207.65291%206.3206%207.74628C6.41406%207.84151%206.52548%207.91726%206.64841%207.96913C6.77134%208.021%206.90335%208.04797%207.03678%208.04848C7.59497%208.04848%208.04898%207.59676%208.04927%207.04201C8.04905%206.77597%207.94378%206.52079%207.75637%206.33198C7.56896%206.14317%207.31457%206.03601%207.04854%206.03381H7.04453Z%22%20fill%3D%22%23333333%22%2F%3E%3C%2Fsvg%3E";

var __$_require_static_images_icons_resource_student_lighheight_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2218%22%20height%3D%2218%22%20viewBox%3D%220%200%2018%2018%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M9.00006%204.7421C10.7915%204.7421%2012.2487%206.18175%2012.2487%207.9509C12.2511%208.59456%2012.0565%209.22392%2011.6904%209.75641C11.3243%2010.2889%2010.8038%2010.6997%2010.1972%2010.9348L10.2025%2010.9489C10.1438%2010.9763%2010.0943%2011.0196%2010.0597%2011.0739C10.0251%2011.1281%2010.0068%2011.1909%2010.0071%2011.255H9.97036V12.0391H7.97819V11.255H7.94136C7.94136%2011.2506%207.94365%2011.2465%207.94365%2011.2421C7.9409%2011.178%207.91967%2011.1161%207.88247%2011.0636C7.84528%2011.0111%207.79366%2010.9702%207.7337%2010.9457L7.7476%2010.9126C7.15564%2010.6693%206.65003%2010.258%206.29471%209.73086C5.93938%209.20369%205.75031%208.58428%205.7514%207.95096C5.75133%206.18141%207.20852%204.7421%209.00006%204.7421ZM9.66757%2014.2579H8.28105C8.20085%2014.2578%208.12395%2014.2263%208.06719%2014.1703C8.01044%2014.1144%207.97846%2014.0385%207.97826%2013.9592V12.7812H9.97036V13.9592C9.97027%2014.0385%209.93833%2014.1145%209.88155%2014.1705C9.82477%2014.2265%209.74781%2014.2579%209.66757%2014.2579ZM7.22694%2011.4918V13.9592C7.22777%2014.5338%207.69923%2014.9993%208.28098%2015H9.66757C10.2493%2014.9993%2010.7209%2014.5338%2010.7217%2013.9592V11.517C11.4053%2011.198%2011.9827%2010.6932%2012.3862%2010.0616C12.7897%209.43008%2013.0026%208.69802%2013%207.95124C13%205.7725%2011.2054%204%208.99999%204C6.79453%204%205%205.7725%205%207.9509C4.99892%208.68773%205.20701%209.4101%205.60065%2010.036C5.99428%2010.6619%206.5577%2011.1662%207.22694%2011.4918Z%22%20fill%3D%22%23333333%22%2F%3E%3Cpath%20d%3D%22M9.0153%203.84177C9.22323%203.83368%209.384%203.65988%209.38436%203.45215L9.38471%203.44979C9.38471%203.44521%209.38663%203.44127%209.38663%203.43705C9.38663%203.43397%209.38471%203.43161%209.38471%203.42853V2.38767C9.38471%202.38266%209.38706%202.37844%209.38663%202.37293C9.38276%202.27142%209.33946%202.1755%209.26604%202.10578C9.19262%202.03606%209.09495%201.9981%208.99402%202.00007C8.89309%202.00204%208.79696%202.04378%208.72628%202.11631C8.65561%202.18884%208.61604%202.28638%208.61607%202.38796L8.61564%202.39068C8.61564%202.39454%208.61337%202.39841%208.61337%202.40306C8.61372%202.40614%208.61529%202.4085%208.61564%202.41158V3.45201C8.61564%203.45738%208.61337%203.4621%208.61337%203.46711C8.61742%203.57038%208.66201%203.66781%208.73736%203.73805C8.81271%203.80828%208.91266%203.84558%209.0153%203.84177ZM6.68205%204.46259C6.85811%204.35092%206.91097%204.11957%206.80803%203.93947L6.80711%203.93733C6.80483%203.93332%206.80455%203.92895%206.80248%203.9253C6.80099%203.92265%206.79807%203.92158%206.79658%203.91893L6.27934%203.01758C6.27685%203.01322%206.27678%203.00835%206.27372%203.00384C6.22074%202.91614%206.13536%202.85316%206.03631%202.82869C5.93726%202.80422%205.8326%202.82026%205.74528%202.8733C5.65796%202.92634%205.5951%203.01205%205.57048%203.11164C5.54586%203.21124%205.56147%203.31659%205.61391%203.40462L5.61491%203.4072C5.61683%203.41056%205.61676%203.41507%205.61911%203.41908C5.62096%203.42159%205.62352%203.4228%205.6253%203.42531L6.14233%204.32637C6.14503%204.33102%206.14538%204.33625%206.14787%204.34061C6.20273%204.42795%206.28977%204.48984%206.3899%204.51271C6.49004%204.53557%206.5951%204.51755%206.68205%204.46259ZM4.9699%206.17416C5.06694%205.9889%204.99772%205.76192%204.81902%205.6577L4.81717%205.65627C4.81319%205.65398%204.81077%205.65033%204.80714%205.64818C4.80451%205.64668%204.80145%205.64718%204.79882%205.6456L3.90305%205.12521C3.89871%205.1227%203.89629%205.11848%203.89138%205.11619C3.8019%205.06652%203.69647%205.05465%203.59829%205.0832C3.5001%205.11174%203.41721%205.17836%203.36785%205.26841C3.31848%205.35845%203.30669%205.46454%203.33506%205.56333C3.36342%205.66213%203.42964%205.74553%203.51912%205.79521L3.52126%205.79692C3.5246%205.79886%203.5268%205.80279%203.53079%205.80508C3.53363%205.8063%203.53641%205.80609%203.53925%205.80738L4.43474%206.32762C4.43936%206.33027%204.44228%206.33464%204.44662%206.33715C4.53751%206.38524%204.64365%206.39509%204.74175%206.36453C4.83986%206.33398%204.92191%206.26551%204.9699%206.17416ZM13.0302%2010.8922C12.9332%2011.0774%2013.0024%2011.3044%2013.1811%2011.4086L13.1829%2011.4102C13.1869%2011.4124%2013.1892%2011.4162%2013.1928%2011.4182C13.1954%2011.4197%2013.1986%2011.4192%2013.2012%2011.4207L14.097%2011.9412C14.1013%2011.9437%2014.1038%2011.9479%2014.1086%2011.9503C14.153%2011.9754%2014.2018%2011.9914%2014.2523%2011.9973C14.3028%2012.0033%2014.354%2011.9992%2014.4029%2011.9852C14.4518%2011.9712%2014.4975%2011.9475%2014.5373%2011.9157C14.5771%2011.8838%2014.6102%2011.8444%2014.6348%2011.7995C14.6594%2011.7547%2014.6749%2011.7055%2014.6804%2011.6546C14.686%2011.6037%2014.6815%2011.5523%2014.6672%2011.5032C14.6529%2011.4541%2014.629%2011.4083%2014.5971%2011.3685C14.5651%2011.3287%2014.5256%2011.2957%2014.4809%2011.2713L14.4788%2011.2695C14.4755%2011.2676%2014.4732%2011.2637%2014.4692%2011.2614C14.4665%2011.26%2014.4636%2011.2603%2014.4608%2011.259L13.5653%2010.7388C13.5608%2010.7361%2013.5577%2010.7318%2013.5534%2010.7293C13.4625%2010.6812%2013.3564%2010.6714%2013.2583%2010.7019C13.1602%2010.7324%2013.0782%2010.8009%2013.0302%2010.8922ZM4.33763%208.51778C4.32959%208.30855%204.15687%208.14678%203.95036%208.14642L3.94801%208.14606C3.94346%208.14606%203.93947%208.14413%203.93535%208.14413C3.93236%208.14413%203.92994%208.14606%203.92688%208.14606H2.89254C2.88756%208.14606%202.88336%208.1437%202.87789%208.14413C2.7757%208.14613%202.67849%208.18888%202.60764%208.263C2.53678%208.33711%202.49809%208.43651%202.50007%208.53933C2.50205%208.64215%202.54455%208.73997%202.6182%208.81126C2.69186%208.88256%202.79064%208.92149%202.89282%208.9195L2.89553%208.91993C2.89937%208.91993%202.90321%208.92222%202.90783%208.92222C2.91089%208.92186%202.91324%208.92028%202.9163%208.91993H3.95029C3.95562%208.91993%203.96032%208.92222%203.9653%208.92222C4.06793%208.91815%204.16477%208.87329%204.23458%208.79747C4.30438%208.72165%204.34144%208.62107%204.33763%208.51778ZM13.6624%208.54856C13.6704%208.75772%2013.8431%208.9195%2014.0496%208.91993L14.052%208.92028C14.0565%208.92028%2014.0604%208.92236%2014.0646%208.92236C14.0676%208.92236%2014.0701%208.92028%2014.0731%208.92035H15.1075C15.1124%208.92035%2015.1167%208.92279%2015.122%208.92236C15.2242%208.92033%2015.3214%208.87755%2015.3923%208.80343C15.4632%208.72931%2015.5019%208.62992%2015.4999%208.52709C15.4979%208.42428%2015.4554%208.3265%2015.3817%208.25522C15.3081%208.18395%2015.2093%208.14502%2015.1071%208.147L15.1045%208.14649C15.1006%208.14649%2015.0967%208.14435%2015.0921%208.14435C15.0891%208.14456%2015.0868%208.14628%2015.0837%208.14649H14.0497C14.0444%208.14649%2014.0396%208.14428%2014.0346%208.14435C13.932%208.14837%2013.8352%208.19319%2013.7654%208.26898C13.6956%208.34476%2013.6586%208.44531%2013.6624%208.54856ZM4.95461%2010.8656C4.84371%2010.6884%204.61372%2010.6352%204.43474%2010.7389L4.4326%2010.7397C4.42862%2010.742%204.42428%2010.7423%204.42065%2010.7444C4.41802%2010.7459%204.41695%2010.7488%204.41432%2010.7503L3.51855%2011.2708C3.51421%2011.2733%203.50938%2011.2734%203.50489%2011.2764C3.41774%2011.3298%203.35514%2011.4157%203.33083%2011.5153C3.30651%2011.615%203.32245%2011.7203%203.37516%2011.8082C3.42788%2011.896%203.51305%2011.9593%203.61203%2011.9841C3.71101%2012.0088%203.81571%2011.9931%203.90319%2011.9404L3.90575%2011.9393C3.9091%2011.9374%203.91358%2011.9375%203.91756%2011.9351C3.92005%2011.9333%203.92126%2011.9307%203.92375%2011.9288L4.81923%2011.4086C4.82386%2011.4059%204.82905%2011.4056%204.83339%2011.4031C4.92019%2011.3479%204.98169%2011.2603%205.00442%2011.1596C5.02714%2011.0588%205.00923%2010.9531%204.95461%2010.8656ZM13.0454%206.20078C13.1564%206.37787%2013.3863%206.43106%2013.5653%206.32755L13.5675%206.32662C13.5715%206.32433%2013.5759%206.32419%2013.5795%206.32211C13.5821%206.32061%2013.5832%206.3176%2013.5859%206.31603L14.4817%205.79564C14.4859%205.79313%2014.4908%205.79306%2014.4953%205.79005C14.5828%205.7369%2014.6457%205.65095%2014.6702%205.55111C14.6948%205.45126%2014.6789%205.34569%2014.6261%205.25763C14.5732%205.1696%2014.4878%205.10629%2014.3886%205.08163C14.2893%205.05698%2014.1844%205.07298%2014.097%205.12614L14.0945%205.12707C14.091%205.129%2014.0866%205.12908%2014.0827%205.13144C14.0802%205.13308%2014.079%205.1358%2014.0765%205.13752L13.181%205.65777C13.1764%205.66042%2013.1711%205.66085%2013.1669%205.66343C13.08%205.71854%2013.0185%205.80607%2012.9957%205.90682C12.9729%206.00756%2012.9908%206.11329%2013.0454%206.20078ZM11.3444%204.47798C11.5285%204.57554%2011.7541%204.50596%2011.8577%204.32615L11.8592%204.32422C11.8614%204.32021%2011.8652%204.31792%2011.8673%204.31427C11.8688%204.31162%2011.8682%204.30847%2011.8698%204.30575L12.387%203.40441C12.3894%203.40011%2012.3936%203.39753%2012.396%203.39274C12.4444%203.30277%2012.4555%203.19719%2012.4269%203.099C12.3983%203.00082%2012.3323%202.91799%2012.2433%202.86856C12.1542%202.81914%2012.0494%202.80713%2011.9516%202.83515C11.8538%202.86317%2011.771%202.92895%2011.7212%203.01816L11.7195%203.02023C11.7175%203.02367%2011.7136%203.02596%2011.7113%203.02997C11.71%203.03269%2011.7103%203.03562%2011.7091%203.03834L11.192%203.9394C11.1893%203.94398%2011.1851%203.94706%2011.1827%203.95143C11.1348%204.04285%2011.1249%204.14965%2011.1553%204.24838C11.1856%204.34711%2011.2536%204.42968%2011.3444%204.47798Z%22%20fill%3D%22%23333333%22%2F%3E%3C%2Fsvg%3E";

/* script */
const __vue_script__$2Y = script$2Y;
var __vue_render__$2Y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    [
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: _vm.isShowToolbar,
              expression: "isShowToolbar",
            },
          ],
          staticClass: "title-bar",
        },
        [
          _c("div", { staticClass: "title-bar-con" }, [
            _c("div", { staticClass: "cur-name" }, [_vm._v(_vm._s(_vm.title))]),
            _vm._v(" "),
            _c("div", { staticClass: "search-box" }, [
              _c("div", [_vm._v(_vm._s(_vm.schedule) + "%")]),
              _vm._v(" "),
              _vm.isAddMark
                ? _c(
                    "div",
                    {
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.addBookmark(_vm.location)
                        },
                      },
                    },
                    [
                      _c("img", {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value:
                              JSON.stringify(_vm.bookmarkList).indexOf(
                                _vm.location
                              ) == -1,
                            expression:
                              "JSON.stringify(bookmarkList).indexOf(location) == -1",
                          },
                        ],
                        staticClass: "icon",
                        attrs: {
                          src: __$_require_static_images_icons_toolbar_bookmark_svg__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c("img", {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value:
                              JSON.stringify(_vm.bookmarkList).indexOf(
                                _vm.location
                              ) !== -1,
                            expression:
                              "JSON.stringify(bookmarkList).indexOf(location) !== -1",
                          },
                        ],
                        staticClass: "icon",
                        attrs: {
                          src: __$_require_static_images_icons_toolbar_bookmark_up_svg__,
                          alt: "",
                        },
                      }),
                    ]
                  )
                : _vm._e(),
              _vm._v(" "),
              _c(
                "div",
                {
                  on: {
                    click: function ($event) {
                      $event.stopPropagation();
                      return _vm.showSearch.apply(null, arguments)
                    },
                  },
                },
                [
                  _c("img", {
                    staticClass: "icon",
                    attrs: {
                      src: __$_require_static_images_icons_toolbar_search_svg__,
                      alt: "",
                    },
                  }),
                ]
              ),
            ]),
          ]),
        ]
      ),
      _vm._v(" "),
      _c(
        "div",
        {
          staticClass: "xml-toolbar-phone-content",
          style: { height: _vm.innerHeight + "px" },
        },
        [
          _c(
            "div",
            {
              directives: [
                {
                  name: "show",
                  rawName: "v-show",
                  value: _vm.isShowToolbar,
                  expression: "isShowToolbar",
                },
              ],
              staticClass: "xml-toolbar-phone",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                },
              },
            },
            [
              _vm.loadingMode == "page" && _vm.current == -1
                ? _c("div", { staticClass: "btn-list" }, [
                    _c(
                      "div",
                      {
                        staticClass: "btn-item",
                        on: {
                          click: function ($event) {
                            return _vm.$emit("prevPage")
                          },
                        },
                      },
                      [_c("i", { staticClass: "el-icon-d-arrow-left" })]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        staticClass: "btn-item",
                        on: {
                          click: function ($event) {
                            return _vm.$emit("nextPage")
                          },
                        },
                      },
                      [_c("i", { staticClass: "el-icon-d-arrow-right" })]
                    ),
                  ])
                : _vm._e(),
              _vm._v(" "),
              _vm._l(_vm.toolbarList, function (item, index) {
                return _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value:
                          item.id !== 3 ||
                          (item.id == 3 && _vm.showoQuestionBank),
                        expression:
                          "item.id !== 3||(item.id==3&&showoQuestionBank)",
                      },
                    ],
                    key: index,
                    staticClass: "toolbar-phone-item",
                    class: item.id == _vm.current ? item.select : item.default,
                    on: {
                      click: function ($event) {
                        $event.stopPropagation();
                        return _vm.clickToolbar(item)
                      },
                    },
                  },
                  [
                    _c("div", { staticClass: "toolbar-icon" }),
                    _vm._v(" "),
                    _c("div", [_vm._v(_vm._s(item.name))]),
                  ]
                )
              }),
            ],
            2
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "xml-popup",
        {
          ref: "searchPopShow",
          on: {
            close: function ($event) {
              _vm.current = -1;
            },
          },
        },
        [
          _c(
            "div",
            {
              staticClass: "search-pop",
              style: { height: (_vm.innerHeight / 10) * 8 + "px" },
            },
            [
              _c("div", {
                staticClass: "xml-popup-mback",
                on: {
                  click: function ($event) {
                    $event.stopPropagation();
                    _vm.$refs.searchPopShow.show = false;
                  },
                },
              }),
              _vm._v(" "),
              _c("search-phone", {
                staticClass: "search-pop-content",
                attrs: { componentList: _vm.componentList },
                on: { seachItem: _vm.seachItem },
              }),
            ],
            1
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "xml-popup",
        {
          ref: "catalogPopup",
          on: {
            close: function ($event) {
              _vm.current = -1;
            },
          },
        },
        [
          _c(
            "div",
            { staticClass: "catalog-pop" },
            [
              _c("div", {
                staticClass: "xml-popup-mback",
                on: {
                  click: function ($event) {
                    $event.stopPropagation();
                    return _vm.clickToolbar({ id: 0 })
                  },
                },
              }),
              _vm._v(" "),
              _c("div", { staticClass: "book-name" }, [
                _vm._v(_vm._s(_vm.textBookName)),
              ]),
              _vm._v(" "),
              _c("el-tree", {
                ref: "tree",
                class:
                  "preview-tree-box-" + _vm.pageType + " custom-catalog-tree",
                attrs: {
                  id: "preview-tree",
                  indent: 24,
                  draggable: false,
                  "default-expand-all": true,
                  data: _vm.catalogList,
                  "node-key": "id",
                  props: _vm.defaultProps,
                  "filter-node-method": _vm.filterNode,
                  "expand-on-click-node": false,
                },
                scopedSlots: _vm._u([
                  {
                    key: "default",
                    fn: function (ref) {
                      var node = ref.node;
                      var data = ref.data;
                      return _c(
                        "div",
                        {
                          staticClass: "catalog-node",
                          class: [node.childNodes.length ? "parent-node" : ""],
                        },
                        [
                          _c(
                            "div",
                            {
                              class: [
                                "catalog-node__left",
                                node.level === 1 ? "with-prefix" : "",
                              ],
                              on: {
                                click: function () {
                                  return _vm.nodeClick(data)
                                },
                              },
                            },
                            [
                              _c(
                                "div",
                                {
                                  staticClass: "catalog-node__label",
                                  class:
                                    data.isSampleSeal == "0"
                                      ? "sample-seal"
                                      : "",
                                },
                                [
                                  _c(
                                    "div",
                                    {
                                      class: [
                                        "node-label",
                                        node.expanded ? "expanded-node" : "",
                                      ],
                                    },
                                    [
                                      _c(
                                        "span",
                                        {
                                          class:
                                            _vm.selectId == data.id
                                              ? "highlight-bg"
                                              : "",
                                        },
                                        [
                                          _vm._v(
                                            "\n                  " +
                                              _vm._s(node.label) +
                                              "\n                "
                                          ),
                                        ]
                                      ),
                                    ]
                                  ),
                                  _vm._v(" "),
                                  _vm.isTrialReading(data.id)
                                    ? _c("div", {
                                        staticClass:
                                          "exceeding_the_trial_reading",
                                      })
                                    : _vm._e(),
                                ]
                              ),
                            ]
                          ),
                          _vm._v(" "),
                          _c(
                            "div",
                            {
                              staticClass: "catalog-node__right",
                              on: {
                                click: function () {
                                  return _vm.expandOrCollapseNode(node)
                                },
                              },
                            },
                            [
                              node.childNodes.length && node.expanded
                                ? _c("i", {
                                    staticClass: "el-icon-arrow-down",
                                    staticStyle: {
                                      color: "var(--preview-theme-color)",
                                      "font-size": "16px",
                                      "font-weight": "600",
                                    },
                                  })
                                : node.childNodes.length && !node.expanded
                                ? _c("i", {
                                    staticClass: "el-icon-arrow-right",
                                    staticStyle: {
                                      "font-size": "16px",
                                      "font-weight": "600",
                                    },
                                  })
                                : _vm._e(),
                            ]
                          ),
                        ]
                      )
                    },
                  },
                ]),
              }),
            ],
            1
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "xml-popup",
        {
          ref: "setPopup",
          on: {
            close: function ($event) {
              _vm.current = -1;
            },
          },
        },
        [
          _c(
            "div",
            {
              staticClass: "set-pop",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                },
              },
            },
            [
              _c("div", { staticClass: "set-item" }, [
                _c("span", { staticClass: "keyname" }, [_vm._v("字体")]),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    staticClass: "family-select-box",
                    staticStyle: { "margin-left": "14px" },
                  },
                  [
                    _c(
                      "el-select",
                      {
                        attrs: {
                          placeholder: "请选择",
                          "popper-append-to-body": false,
                        },
                        on: {
                          change: function ($event) {
                            $event.preventDefault();
                            return _vm.setThemeFontFamily.apply(null, arguments)
                          },
                        },
                        model: {
                          value: _vm.form.themeFontFamily,
                          callback: function ($$v) {
                            _vm.$set(_vm.form, "themeFontFamily", $$v);
                          },
                          expression: "form.themeFontFamily",
                        },
                      },
                      _vm._l(_vm.sysEnv.fontFamily, function (item, index) {
                        return _c("el-option", {
                          key: index,
                          attrs: { label: item.label, value: item.value },
                        })
                      }),
                      1
                    ),
                  ],
                  1
                ),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "set-item" }, [
                _c("span", { staticClass: "keyname" }, [_vm._v("字号")]),
                _vm._v(" "),
                _c("div", { staticStyle: { "margin-left": "14px" } }, [
                  _c(
                    "div",
                    {
                      staticClass: "size-btn",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.setThemeFontSize("minus")
                        },
                      },
                    },
                    [_vm._v("A-")]
                  ),
                  _vm._v(" "),
                  _c("span", [
                    _vm._v(
                      _vm._s(_vm.fontSizeLabelMap[_vm.form.themeFontSize])
                    ),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    {
                      staticClass: "size-btn",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.setThemeFontSize("plus")
                        },
                      },
                    },
                    [_vm._v("A+")]
                  ),
                ]),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "set-item spacing-box number-input" },
                [
                  _c("span", { staticClass: "keyname" }, [_vm._v("行间距")]),
                  _vm._v(" "),
                  _c("el-input-number", {
                    attrs: {
                      size: "small",
                      min: 0,
                      max: 5,
                      step: 0.1,
                      "step-strictly": "",
                    },
                    on: { change: _vm.setThemeLineHeight },
                    model: {
                      value: _vm.form.themeLineHeight,
                      callback: function ($$v) {
                        _vm.$set(_vm.form, "themeLineHeight", $$v);
                      },
                      expression: "form.themeLineHeight",
                    },
                  }),
                  _vm._v(" "),
                  _c("span", { staticClass: "keyname m-l23" }, [
                    _vm._v("字间距"),
                  ]),
                  _vm._v(" "),
                  _c("el-input-number", {
                    attrs: { size: "small", min: 0, max: 30 },
                    on: { change: _vm.setThemeLetterSpacing },
                    model: {
                      value: _vm.form.themeLetterSpacing,
                      callback: function ($$v) {
                        _vm.$set(_vm.form, "themeLetterSpacing", $$v);
                      },
                      expression: "form.themeLetterSpacing",
                    },
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _vm.sysEnv.isReadingMode
                ? _c("div", { staticClass: "set-item" }, [
                    _c("span", { staticClass: "keyname" }, [
                      _vm._v("阅读模式"),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticStyle: { "margin-left": "14px" } }, [
                      _c(
                        "div",
                        {
                          staticClass: "reading-mode",
                          class:
                            _vm.settingData.readingMode == "roll"
                              ? "current-reading-mode"
                              : "",
                          on: {
                            click: function ($event) {
                              $event.stopPropagation();
                              return _vm.readingMode("roll")
                            },
                          },
                        },
                        [_vm._v("滑动")]
                      ),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "reading-mode",
                          class:
                            _vm.settingData.readingMode == "page"
                              ? "current-reading-mode"
                              : "",
                          on: {
                            click: function ($event) {
                              $event.stopPropagation();
                              return _vm.readingMode("page")
                            },
                          },
                        },
                        [_vm._v("翻页")]
                      ),
                    ]),
                  ])
                : _vm._e(),
              _vm._v(" "),
              _c("div", { staticClass: "set-item" }, [
                _c("span", { staticClass: "keyname" }, [_vm._v("背景色")]),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "color-box" },
                  _vm._l(_vm.colorList, function (item, index) {
                    return _c("div", {
                      staticClass: "color-tag",
                      class:
                        _vm.form.themeBgColor === item.colorval ? "active" : "",
                      style: { background: item.colorval },
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.setThemeBgColor(item.colorval)
                        },
                      },
                    })
                  }),
                  0
                ),
              ]),
            ]
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "xml-popup",
        {
          ref: "notePpoup",
          on: {
            close: function ($event) {
              _vm.current = -1;
            },
          },
        },
        [
          _c(
            "div",
            {
              staticClass: "note-pop",
              on: {
                click: function ($event) {
                  $event.stopPropagation();
                },
              },
            },
            [
              _c("div", {
                staticClass: "xml-popup-mback",
                on: {
                  click: function ($event) {
                    $event.stopPropagation();
                    return _vm.clickToolbar({ id: 1 })
                  },
                },
              }),
              _vm._v(" "),
              _vm.curnotetabs == 0
                ? [
                    _c(
                      "div",
                      { staticClass: "note-list" },
                      [
                        _c(
                          "el-collapse",
                          {
                            attrs: { accordion: "" },
                            on: { change: _vm.handleChange },
                            model: {
                              value: _vm.noteNames,
                              callback: function ($$v) {
                                _vm.noteNames = $$v;
                              },
                              expression: "noteNames",
                            },
                          },
                          _vm._l(_vm.notesList, function (item, index) {
                            return _c(
                              "el-collapse-item",
                              {
                                key: index,
                                attrs: { name: item.firstLevelId },
                              },
                              [
                                _c("template", { slot: "title" }, [
                                  _c("div", { staticClass: "collapse-title" }, [
                                    _vm._v(
                                      "\n                  " +
                                        _vm._s(item.firstLevelLabel) +
                                        "\n                "
                                    ),
                                  ]),
                                ]),
                                _vm._v(" "),
                                _vm._l(item.list, function (items, index) {
                                  return _c(
                                    "div",
                                    {
                                      key: index,
                                      staticClass: "note-item collapse-item",
                                      on: {
                                        click: function ($event) {
                                          return _vm.resourceDetails(
                                            Object.assign(
                                              {},
                                              {
                                                jumpType: "marker",
                                                toolbarIndex: 1,
                                              },
                                              items
                                            )
                                          )
                                        },
                                      },
                                    },
                                    [
                                      _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_resource_note_icon_02_svg__,
                                          alt: "",
                                        },
                                      }),
                                      _vm._v(" "),
                                      _c("div", [
                                        _c("div", { staticClass: "or-text" }, [
                                          _vm._v(
                                            "\n                    " +
                                              _vm._s(
                                                _vm.removeStyle(
                                                  items.selectionText
                                                )
                                              ) +
                                              "\n                  "
                                          ),
                                        ]),
                                        _vm._v(" "),
                                        _c(
                                          "div",
                                          { staticClass: "note-con" },
                                          [
                                            _c("xmlTextOverflow", {
                                              attrs: {
                                                info: items.noteContent,
                                              },
                                            }),
                                          ],
                                          1
                                        ),
                                      ]),
                                      _vm._v(" "),
                                      _c(
                                        "div",
                                        { staticClass: "operate-btns" },
                                        [
                                          _c(
                                            "div",
                                            {
                                              staticClass: "delete-btn",
                                              on: {
                                                "!click": function ($event) {
                                                  $event.stopPropagation();
                                                  return _vm.deleteNote(items)
                                                },
                                              },
                                            },
                                            [
                                              _c("img", {
                                                attrs: {
                                                  src: __$_require_static_images_icons_resource_delete_svg__,
                                                  alt: "",
                                                },
                                              }),
                                              _vm._v(
                                                "\n                    删除\n                  "
                                              ),
                                            ]
                                          ),
                                        ]
                                      ),
                                    ]
                                  )
                                }),
                              ],
                              2
                            )
                          }),
                          1
                        ),
                        _vm._v(" "),
                        _c("xml-empty", {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: _vm.notesList.length == 0,
                              expression: "notesList.length == 0",
                            },
                          ],
                        }),
                      ],
                      1
                    ),
                  ]
                : _vm.curnotetabs == 1
                ? [
                    _c(
                      "div",
                      { staticClass: "note-list" },
                      [
                        _c(
                          "el-collapse",
                          {
                            attrs: { accordion: "" },
                            on: { change: _vm.handleChange },
                            model: {
                              value: _vm.bookmarkNames,
                              callback: function ($$v) {
                                _vm.bookmarkNames = $$v;
                              },
                              expression: "bookmarkNames",
                            },
                          },
                          _vm._l(_vm.bookmarkList, function (item, index) {
                            return _c(
                              "el-collapse-item",
                              {
                                key: index,
                                attrs: { name: item.firstLevelId },
                              },
                              [
                                _c("template", { slot: "title" }, [
                                  _c("div", { staticClass: "collapse-title" }, [
                                    _vm._v(
                                      "\n                  " +
                                        _vm._s(item.firstLevelLabel) +
                                        "\n                "
                                    ),
                                  ]),
                                ]),
                                _vm._v(" "),
                                _vm._l(item.list, function (items, k) {
                                  return _c(
                                    "div",
                                    {
                                      key: k,
                                      staticClass: "mark-item collapse-item",
                                      on: {
                                        click: function ($event) {
                                          return _vm.resourceDetails(
                                            Object.assign(
                                              {},
                                              {
                                                jumpType: "marker",
                                                toolbarIndex: 1,
                                              },
                                              items
                                            )
                                          )
                                        },
                                      },
                                    },
                                    [
                                      _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_resource_student_bookmark_svg__,
                                          alt: "",
                                        },
                                      }),
                                      _vm._v(" "),
                                      _c("div", [
                                        _vm._v(
                                          _vm._s(
                                            _vm.removeStyle(items.bookmarkText)
                                          )
                                        ),
                                      ]),
                                      _vm._v(" "),
                                      _c(
                                        "div",
                                        { staticClass: "operate-btns" },
                                        [
                                          _c(
                                            "div",
                                            {
                                              staticClass: "delete-btn",
                                              on: {
                                                "!click": function ($event) {
                                                  $event.stopPropagation();
                                                  return _vm.deleteBookmark(
                                                    items
                                                  )
                                                },
                                              },
                                            },
                                            [
                                              _c("img", {
                                                attrs: {
                                                  src: __$_require_static_images_icons_resource_delete_svg__,
                                                  alt: "",
                                                },
                                              }),
                                              _vm._v(
                                                "\n                    删除\n                  "
                                              ),
                                            ]
                                          ),
                                        ]
                                      ),
                                    ]
                                  )
                                }),
                              ],
                              2
                            )
                          }),
                          1
                        ),
                        _vm._v(" "),
                        _c("xml-empty", {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: _vm.bookmarkList.length == 0,
                              expression: "bookmarkList.length == 0",
                            },
                          ],
                        }),
                      ],
                      1
                    ),
                  ]
                : _vm.curnotetabs == 2
                ? [
                    _c(
                      "div",
                      { staticClass: "note-list" },
                      [
                        _c(
                          "el-collapse",
                          {
                            attrs: { accordion: "" },
                            on: { change: _vm.handleChange },
                            model: {
                              value: _vm.highlightNames,
                              callback: function ($$v) {
                                _vm.highlightNames = $$v;
                              },
                              expression: "highlightNames",
                            },
                          },
                          _vm._l(_vm.highlightList, function (item, index) {
                            return _c(
                              "el-collapse-item",
                              {
                                key: index,
                                attrs: { name: item.firstLevelId },
                              },
                              [
                                _c("template", { slot: "title" }, [
                                  _c("div", { staticClass: "collapse-title" }, [
                                    _vm._v(
                                      "\n                  " +
                                        _vm._s(item.firstLevelLabel) +
                                        "\n                "
                                    ),
                                  ]),
                                ]),
                                _vm._v(" "),
                                _vm._l(item.list, function (items, index) {
                                  return _c(
                                    "div",
                                    {
                                      key: index,
                                      staticClass:
                                        "Highlight-item collapse-item",
                                      on: {
                                        click: function ($event) {
                                          return _vm.resourceDetails(
                                            Object.assign(
                                              {},
                                              {
                                                jumpType: "marker",
                                                toolbarIndex: 1,
                                              },
                                              items
                                            )
                                          )
                                        },
                                      },
                                    },
                                    [
                                      _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_resource_student_lighheight_svg__,
                                          alt: "",
                                        },
                                      }),
                                      _vm._v(" "),
                                      _c("div", [
                                        _vm._v(
                                          "\n                  " +
                                            _vm._s(
                                              _vm.removeStyle(
                                                items.selectionText
                                              )
                                            ) +
                                            "\n                "
                                        ),
                                      ]),
                                      _vm._v(" "),
                                      _c(
                                        "div",
                                        { staticClass: "operate-btns" },
                                        [
                                          _c(
                                            "div",
                                            {
                                              staticClass: "delete-btn",
                                              on: {
                                                "!click": function ($event) {
                                                  $event.stopPropagation();
                                                  return _vm.deleteHighlight(
                                                    items,
                                                    "highlight"
                                                  )
                                                },
                                              },
                                            },
                                            [
                                              _c("img", {
                                                attrs: {
                                                  src: __$_require_static_images_icons_resource_delete_svg__,
                                                  alt: "",
                                                },
                                              }),
                                              _vm._v(
                                                "\n                    删除\n                  "
                                              ),
                                            ]
                                          ),
                                        ]
                                      ),
                                    ]
                                  )
                                }),
                              ],
                              2
                            )
                          }),
                          1
                        ),
                        _vm._v(" "),
                        _c("xml-empty", {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: _vm.highlightList.length == 0,
                              expression: "highlightList.length == 0",
                            },
                          ],
                        }),
                      ],
                      1
                    ),
                  ]
                : _vm.curnotetabs == 3
                ? [
                    _c(
                      "div",
                      { staticClass: "note-list" },
                      [
                        _c(
                          "el-collapse",
                          {
                            attrs: { accordion: "" },
                            on: { change: _vm.handleChange },
                            model: {
                              value: _vm.linkNames,
                              callback: function ($$v) {
                                _vm.linkNames = $$v;
                              },
                              expression: "linkNames",
                            },
                          },
                          _vm._l(_vm.linkList, function (item, index) {
                            return _c(
                              "el-collapse-item",
                              {
                                key: index,
                                attrs: { name: item.firstLevelId },
                              },
                              [
                                _c("template", { slot: "title" }, [
                                  _c("div", { staticClass: "collapse-title" }, [
                                    _vm._v(
                                      "\n                  " +
                                        _vm._s(item.firstLevelLabel) +
                                        "\n                "
                                    ),
                                  ]),
                                ]),
                                _vm._v(" "),
                                _vm._l(item.list, function (items, index) {
                                  return _c(
                                    "div",
                                    {
                                      key: index,
                                      staticClass:
                                        "Highlight-item collapse-item",
                                      on: {
                                        click: function ($event) {
                                          return _vm.resourceDetails(
                                            Object.assign(
                                              {},
                                              {
                                                jumpType: "marker",
                                                toolbarIndex: 1,
                                              },
                                              items
                                            )
                                          )
                                        },
                                      },
                                    },
                                    [
                                      _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_resource_student_lighheight_svg__,
                                          alt: "",
                                        },
                                      }),
                                      _vm._v(" "),
                                      _c("div", [
                                        _vm._v(
                                          "\n                  " +
                                            _vm._s(
                                              _vm.removeStyle(
                                                items.selectionText
                                              )
                                            ) +
                                            "\n                "
                                        ),
                                      ]),
                                      _vm._v(" "),
                                      _c(
                                        "div",
                                        { staticClass: "operate-btns" },
                                        [
                                          _c(
                                            "div",
                                            {
                                              staticClass: "delete-btn",
                                              on: {
                                                "!click": function ($event) {
                                                  $event.stopPropagation();
                                                  return _vm.deleteHighlight(
                                                    items,
                                                    "link"
                                                  )
                                                },
                                              },
                                            },
                                            [
                                              _c("img", {
                                                attrs: {
                                                  src: __$_require_static_images_icons_resource_delete_svg__,
                                                  alt: "",
                                                },
                                              }),
                                              _vm._v(
                                                "\n                    删除\n                  "
                                              ),
                                            ]
                                          ),
                                        ]
                                      ),
                                    ]
                                  )
                                }),
                              ],
                              2
                            )
                          }),
                          1
                        ),
                        _vm._v(" "),
                        _c("xml-empty", {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: _vm.linkList.length == 0,
                              expression: "linkList.length == 0",
                            },
                          ],
                        }),
                      ],
                      1
                    ),
                  ]
                : _vm._e(),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "note-tabbar" },
                _vm._l(_vm.noteTabbarList, function (item, index) {
                  return _c(
                    "div",
                    {
                      directives: [
                        {
                          name: "show",
                          rawName: "v-show",
                          value: item.show,
                          expression: "item.show",
                        },
                      ],
                      class: _vm.curnotetabs == item.id ? "active" : "",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.clicknotetab(item.id)
                        },
                      },
                    },
                    [_vm._v("\n          " + _vm._s(item.name) + "\n        ")]
                  )
                }),
                0
              ),
            ],
            2
          ),
        ]
      ),
      _vm._v(" "),
      _c("resource-list-phone", {
        ref: "resourceListPopup",
        attrs: {
          textBookResource: _vm.textBookResource,
          resourcesList: _vm.resourcesList,
          resourceBasisPath: _vm.resourceBasisPath,
          showToast: _vm.showToast,
          isShowTeacherResource: _vm.isShowTeacherResource,
          userType: _vm.userType,
          sysEnv: _vm.sysEnv,
        },
        on: {
          resourceDetails: _vm.resourceDetails,
          resourceReader: _vm.resourceReader,
          close: function ($event) {
            _vm.current = -1;
          },
        },
      }),
    ],
    1
  )
};
var __vue_staticRenderFns__$2Y = [];
__vue_render__$2Y._withStripped = true;

  /* style */
  const __vue_inject_styles__$2Y = undefined;
  /* scoped */
  const __vue_scope_id__$2Y = undefined;
  /* module identifier */
  const __vue_module_identifier__$2Y = undefined;
  /* functional template */
  const __vue_is_functional_template__$2Y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2Y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2Y, staticRenderFns: __vue_staticRenderFns__$2Y },
    __vue_inject_styles__$2Y,
    __vue_script__$2Y,
    __vue_scope_id__$2Y,
    __vue_is_functional_template__$2Y,
    __vue_module_identifier__$2Y,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$2X = {
  name: 'modifyNotes',
  props: {},
  data() {
    return {
      show: false,
      noteContent: '',
      selectionText: '',
      data: ''
    };
  },
  methods: {
    open(data) {
      this.show = true;
      this.noteContent = data.noteContent;
      this.selectionText = data.selectionText;
      this.data = data;
    },
    // 点击关闭按钮
    close() {},
    onCancelClick() {
      this.show = false;
    },
    onSaveClick() {
      console.log('保存');
      if (!this.noteContent.trim()) {
        this.$message({
          message: '笔记内容不能为空',
          type: 'warning'
        });
        return;
      }
      this.data.noteContent = this.noteContent;
      this.$emit('saveNote', this.data);
      // 关闭对话框
      this.show = false;
    }
  }
};

/* script */
const __vue_script__$2X = script$2X;
/* template */
var __vue_render__$2X = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      attrs: {
        "append-to-body": "",
        title: "编辑笔记",
        visible: _vm.show,
        width: "400px",
      },
      on: {
        "update:visible": function ($event) {
          _vm.show = $event;
        },
        close: _vm.close,
      },
      scopedSlots: _vm._u([
        {
          key: "footer",
          fn: function () {
            return [
              _c("el-button", { on: { click: _vm.onCancelClick } }, [
                _vm._v("取消"),
              ]),
              _vm._v(" "),
              _c(
                "el-button",
                { attrs: { type: "primary" }, on: { click: _vm.onSaveClick } },
                [_vm._v("保存")]
              ),
            ]
          },
          proxy: true,
        },
      ]),
    },
    [
      _c(
        "div",
        { staticClass: "add-teacher-resources-dialog" },
        [
          _c(
            "el-form",
            { attrs: { "label-width": "100px", "label-position": "left" } },
            [
              _c("div", { staticClass: "content-left" }, [
                _vm._v(_vm._s(_vm.selectionText)),
              ]),
              _vm._v(" "),
              _c("el-input", {
                attrs: {
                  type: "textarea",
                  rows: 4,
                  placeholder: "请输入笔记内容",
                  maxlength: "200",
                },
                model: {
                  value: _vm.noteContent,
                  callback: function ($$v) {
                    _vm.noteContent = $$v;
                  },
                  expression: "noteContent",
                },
              }),
            ],
            1
          ),
        ],
        1
      ),
    ]
  )
};
var __vue_staticRenderFns__$2X = [];
__vue_render__$2X._withStripped = true;

  /* style */
  const __vue_inject_styles__$2X = undefined;
  /* scoped */
  const __vue_scope_id__$2X = undefined;
  /* module identifier */
  const __vue_module_identifier__$2X = undefined;
  /* functional template */
  const __vue_is_functional_template__$2X = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2X = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2X, staticRenderFns: __vue_staticRenderFns__$2X },
    __vue_inject_styles__$2X,
    __vue_script__$2X,
    __vue_scope_id__$2X,
    __vue_is_functional_template__$2X,
    __vue_module_identifier__$2X,
    false,
    undefined,
    undefined,
    undefined
  );

/*
 * Released under BSD License
 * Copyright (c) 2019-2020 Allen_sun_js@hotmail.com
 *
 * Project Home:
 *  https://github.com/allensunjian
 */
(function ($w, temp) {
  var Jm = $w[temp];
  var name = 'menu';
  var $d = $w['document'];
  var menuEvent = 'oncontextmenu';
  var clickEvent = 'onclick';
  var $c = function (tag) {
    return $d.createElement(tag);
  };
  var _noop = function () {};
  var logger = typeof console === 'undefined' ? {
    log: _noop,
    debug: _noop,
    error: _noop,
    warn: _noop,
    info: _noop
  } : console;
  var $t = function (n, t) {
    if (n.hasChildNodes()) {
      n.firstChild.nodeValue = t;
    } else {
      n.appendChild($d.createTextNode(t));
    }
  };
  var $h = function (n, t) {
    if (t instanceof HTMLElement) {
      t.innerHTML = '';
      n.appendChild(t);
    } else {
      n.innerHTML = t;
    }
  };
  if (!Jm || Jm[name]) return;
  Jm.menu = function (_jm) {
    this._get_menu_options(_jm, function () {
      this.init(_jm);
      this._mount_events();
    });
  };
  Jm.menu.prototype = {
    defaultDataMap: {
      funcMap: {
        edit: {
          isDepNode: true,
          // defaultFn不受到中台变量的控制，始终会先于fn去执行
          defaultFn: function (node) {
            var f = this._menu_default_mind_methods._menu_begin_edit.call(this.jm);
            f && this._menu_default_mind_methods._menu_edit_node_begin(this.jm.view, node);
          },
          fn: _noop,
          text: 'edit node'
        },
        addChild: {
          isDepNode: true,
          fn: function (nodeid, text) {
            var selected_node = this.get_selected_node();
            if (selected_node) {
              var node = this.add_node(selected_node, nodeid, text);
              if (node) {
                this.select_node(nodeid);
                this.begin_edit(nodeid);
              }
            }
          },
          text: 'append child'
        },
        addBrother: {
          isDepNode: true,
          fn: function (nodeid, text) {
            var selected_node = this.get_selected_node();
            if (!!selected_node && !selected_node.isroot) {
              var node = this.insert_node_after(selected_node, nodeid, text);
              if (node) {
                this.select_node(nodeid);
                this.begin_edit(nodeid);
              }
            }
          },
          text: 'append brother'
        },
        delete: {
          isDepNode: true,
          fn: function () {
            this.shortcut.handle_delnode.call(this.shortcut, this);
          },
          text: 'delete node'
        },
        showAll: {
          sDepNode: false,
          fn: function () {
            this.expand_all(this);
          },
          text: 'show all'
        },
        hideAll: {
          isDepNode: false,
          fn: function () {
            this.collapse_all(this);
          },
          text: 'hide all'
        },
        screenshot: {
          isDepNode: false,
          fn: function () {
            if (!this.screenshot) {
              logger.error('[jsmind] screenshot dependent on jsmind.screenshot.js !');
              return;
            }
            this.screenshot.shootDownload();
          },
          text: 'load mind picture'
        },
        showNode: {
          isDepNode: true,
          fn: function (node) {
            this.expand_node(node);
          },
          text: 'show target node'
        },
        hideNode: {
          isDepNode: true,
          fn: function (node) {
            this.collapse_node(node);
          },
          text: 'hide target node'
        }
      },
      menuStl: {
        'width': '150px',
        'padding': '12px 0',
        'position': 'fixed',
        'z-index': '10',
        'background': '#fff',
        'box-shadow': '0 2px 12px 0 rgba(0,0,0,0.1)',
        'border-radius': '5px',
        'font-size': '12px',
        'display': 'none'
      },
      menuItemStl: {
        padding: '5px 15px',
        cursor: 'pointer',
        display: 'block',
        'text-align': 'center',
        'transition': 'all .2s'
      },
      injectionList: ['edit', 'addChild', 'delete']
    },
    init: function (_jm) {
      this._create_menu(_jm);
      this._get_injectionList(_jm);
      this.menuOpts.switchMidStage && Jm.util.dom.add_event(_jm.view.e_editor, 'blur', function (e) {
        this._menu_default_mind_methods._menu_edit_node_end.call(_jm.view);
        if (typeof this.menuOpts.editCaller === 'function') {
          this.menuOpts.editCaller($w.menu._update_node_info, this._menu_default_mind_methods._menu_update_edit_node);
          return;
        }
        this._menu_default_mind_methods._menu_update_edit_node();
      }.bind(this));
    },
    _event_contextMenu(e) {
      e.preventDefault();
      this.menu.style.left = e.clientX + 'px';
      this.menu.style.top = e.clientY + 'px';
      this.menu.style.display = 'block';
      this.selected_node = this.jm.get_selected_node();
    },
    _event_hideMenu() {
      this.menu.style.display = 'none';
    },
    _mount_events() {
      $w[menuEvent] = this._event_contextMenu.bind(this);
      $w[clickEvent] = this._event_hideMenu.bind(this);
    },
    _create_menu(_jm) {
      var d = $c('menu');
      this._set_menu_wrap_syl(d);
      this.menu = d;
      this.e_panel = _jm.view.e_panel;
      this.e_panel.appendChild(d);
    },
    _create_menu_item(j, text, fn, isDepNode, cb, defaultFn) {
      var d = $c('menu-item');
      var _this = this;
      this._set_menu_item_syl(d);
      d.innerText = text;
      d.addEventListener('click', function () {
        if (this.selected_node || !isDepNode) {
          defaultFn.call(_this, this.selected_node);
          if (!_this._get_mid_opts()) {
            cb(this.selected_node, _noop);
            fn.call(j, Jm.util.uuid.newid(), this.menuOpts.newNodeText || '请输入节点名称');
            return;
          }
          cb(this.selected_node, _this._mid_stage_next(function () {
            var retArgs = [this.selected_node];
            var argus = Array.prototype.slice.call(arguments[0], 0);
            argus[1] = this.menuOpts.newNodeText || '请输入节点名称';
            if (argus[0]) {
              retArgs = argus;
            }
            fn.apply(j, retArgs);
          }.bind(this)));
          return;
        }
        alert(this.menuOpts.tipContent || 'Continue with node selected！');
      }.bind(this));
      d.addEventListener('mouseover', function () {
        d.style.background = 'rgb(179, 216, 255)';
      });
      d.addEventListener('mouseleave', function () {
        d.style.background = '#fff';
      });
      return d;
    },
    _set_menu_wrap_syl(d) {
      var os = this._get_option_sty('menu', this._get_mixin_sty);
      d.style.cssText = this._format_cssText(os);
    },
    _set_menu_item_syl(d) {
      var os = this._get_option_sty('menuItem', this._get_mixin_sty);
      d.style.cssText = this._format_cssText(os);
    },
    _format_cssText(o) {
      var text = '';
      Object.keys(o).forEach(function (k) {
        text += k + ':' + o[k] + ';';
      });
      return text;
    },
    _empty_object(o) {
      return Object.keys(o).length == 0;
    },
    _get_option_sty(type, fn) {
      var sty = this.menuOpts.style;
      var menu = this.defaultDataMap.menuStl;
      var menuItem = this.defaultDataMap.menuItemStl;
      var o = {
        menu,
        menuItem
      };
      if (!sty) return o[type];
      if (!sty[type]) return o[type];
      if (!sty[type] || this._empty_object(sty[type])) return o[type];
      return fn(o[type], sty[type]);
    },
    _get_mixin_sty(dSty, oSty) {
      var o = {};
      Object.keys(oSty).forEach(function (k) {
        o[k] = oSty[k];
      });
      Object.keys(dSty).forEach(function (k) {
        if (!o[k]) o[k] = dSty[k];
      });
      return o;
    },
    _get_menu_options(j, fn) {
      var options = j.options;
      if (!options.menuOpts) return;
      if (!options.menuOpts.showMenu) return;
      this.menuOpts = j.options.menuOpts;
      fn.call(this);
    },
    _get_injectionDetail() {
      var iLs = this.menuOpts.injectionList;
      var dLs = this.defaultDataMap.injectionList;
      if (!iLs) return dLs;
      if (!Array.isArray(iLs)) {
        logger.error('[jsmind] injectionList must be a Array');
        return;
      }
      if (iLs.length == 0) return dLs;
      return iLs;
    },
    _get_injectionList(j) {
      var list = this._get_injectionDetail();
      var _this = this;
      list.forEach(function (k) {
        var o = null;
        var text = '';
        var callback = _noop;
        var defaultFn = _noop;
        if (typeof k === 'object') {
          o = _this.defaultDataMap.funcMap[k.target];
          text = k.text;
          k.callback && (callback = k.callback);
        } else {
          o = _this.defaultDataMap.funcMap[k];
          text = o.text;
        }
        if (o.defaultFn) defaultFn = o.defaultFn;
        _this.menu.appendChild(_this._create_menu_item(j, text, o.fn, o.isDepNode, callback, defaultFn));
      });
    },
    _get_mid_opts() {
      var b = this.menuOpts.switchMidStage;
      if (!b) return false;
      if (typeof b !== 'boolean') {
        logger.error('[jsmind] switchMidStage must be Boolean');
        return false;
      }
      return b;
    },
    _switch_view_db_event(b, jm) {
      Jm.prototype.dblclick_handle = _noop;
      Jm.shortcut_provider.prototype.handler = _noop;
      Jm.view_provider.prototype.edit_node_end = _noop;
    },
    _mid_stage_next(fn) {
      return function () {
        fn(arguments);
      };
    },
    _reset_mind_event_edit() {},
    _menu_default_mind_methods: {
      _menu_begin_edit: function () {
        var f = this.get_editable();
        if (!f) {
          logger.error('fail, this mind map is not editable.');
        }
        return f;
      },
      _menu_edit_node_begin(scope, node) {
        if (!node.topic) {
          logger.warn("don't edit image nodes");
          return;
        }
        if (scope.editing_node != null) {
          this._menu_default_mind_methods._menu_edit_node_end.call(scope);
        }
        scope.editing_node = node;
        var view_data = node._data.view;
        var element = view_data.element;
        var topic = node.topic;
        var ncs = getComputedStyle(element);
        scope.e_editor.value = topic;
        scope.e_editor.style.width = element.clientWidth - parseInt(ncs.getPropertyValue('padding-left')) - parseInt(ncs.getPropertyValue('padding-right')) + 'px';
        element.innerHTML = '';
        element.appendChild(scope.e_editor);
        element.style.zIndex = 5;
        scope.e_editor.focus();
        scope.e_editor.select();
      },
      _menu_edit_node_end: function () {
        if (this.editing_node != null) {
          var node = this.editing_node;
          this.editing_node = null;
          var view_data = node._data.view;
          var element = view_data.element;
          var topic = this.e_editor.value;
          element.style.zIndex = 'auto';
          element.removeChild(this.e_editor);
          $w.menu._update_node_info = {
            id: node.id,
            topic: topic
          };
          if (Jm.util.text.is_empty(topic) || node.topic === topic) {
            if (this.opts.support_html) {
              $h(element, node.topic);
            } else {
              $t(element, node.topic);
            }
          }
        }
      },
      _menu_update_edit_node: function () {
        var info = $w.menu._update_node_info;
        $w.menu.jm.update_node(info.id, info.topic);
      }
    }
  };
  var plugin = new Jm.plugin('menu', function (_jm) {
    $w.menu = new Jm.menu(_jm);
    menu.jm = _jm;
    if (menu.menuOpts) _jm.menu = menu;
  });
  Jm.register_plugin(plugin);
  function preventMindEventDefault() {
    Jm.menu.prototype._switch_view_db_event();
  }
  Jm.preventMindEventDefault = preventMindEventDefault;
})(window, 'jsMind');

//
var script$2W = {
  //预览教材目录
  name: 'PreviewCatalog',
  props: {
    textBookName: String,
    textBookId: String,
    catalogList: Array,
    userType: {
      type: String,
      default: 'teacher'
    },
    notesList: {
      type: Array,
      default: []
    },
    checkedId: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'h5'
    },
    styleType: {
      type: String,
      default: ''
    },
    isTrial: {
      type: Boolean,
      default: false
    },
    isShow: false,
    title: String,
    PreviewCatalog: false,
    sysEnv: {
      type: Object,
      default: () => {}
    },
    componentList: {
      type: Array,
      default: () => {}
    },
    readableChapters: {
      //可以阅读的章节
      type: Array,
      default: () => []
    },
    studentCatalog: {
      // 章节学习数据
      type: Array,
      default: () => [{
        chapterId: '0',
        //章节id
        studyTime: 0,
        //本章学习时间，单位秒
        studyProgress: '0',
        //本章学习进度
        testProgress: '0',
        //本章试题完成进度
        accuracy: '',
        //本章试题正确率
        testNum: '0' //本章试题完成个数
      }]
    }
  },
  data() {
    return {
      deleteItem: '',
      deletetype: '',
      reminder: false,
      xmlshow: false,
      currentActive: 0,
      tabs: ['目录', '笔记', '书签'],
      scrollTop: 0,
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      selectId: '',
      catalogLists: [],
      searchValue: '',
      currentNodeKey: '',
      chapterShow: false,
      chapterDate: {},
      isLoading: false,
      mindShow: false,
      aiMessage: '',
      //ai信息
      mindComponentList: [],
      looseLeafId: '',
      //活页id
      aiToken: '',
      //ai token
      jm: {},
      //mind主体
      jsmindContainer: null,
      //渲染的体
      mindLoading: false,
      pBlockData: {},
      bailianConversationId: '',
      //mind的ai对话id
      answerData: {
        xml: [],
        deepseek: [],
        qianfan: [],
        doubao: [],
        bailian: {}
      },
      levelChapterId: [],
      //活页id数组
      chanpterName: '' //章节名
      // image
    };
  },
  inject: {
    getGeneralAPI: {
      from: 'getGeneralAPI',
      default: {
        getCatalogStudent: e => {
          return new Promise((resolve, reject) => {
            resolve(e);
          });
        }
      }
    }
  },
  computed: {
    generalAPI() {
      return this.getGeneralAPI();
    }
  },
  watch: {
    catalogList: {
      handler(newValue) {
        this.formatCatalog();
      },
      immediate: true
    },
    checkedId: {
      handler(newValue) {
        this.currentNodeKey = this.checkedId || this.catalogList[0].id;
        this.scrollTopFun();
        // if (this.$refs.tree) {
        //   this.$refs.tree.setCurrentKey(newValue)
        //   let Dom = document.getElementsByClassName('highlight-bg')
        //   let DomBox = document.getElementById('preview-tree')

        //   if (Dom) {
        //     setTimeout(() => {
        //       if (Dom[0].getBoundingClientRect().top > 400 || Dom[0].getBoundingClientRect().top < 200) {
        //         DomBox.scrollTop = 0
        //         DomBox.scrollTop = Dom[0].getBoundingClientRect().top - 300
        //       }
        //     }, 500)
        //   }
        // }
      },
      immediate: true,
      deep: true
    },
    isShow: {
      handler(newValue) {
        let dom = document.getElementById('preview-tree');
        if (dom) {
          dom.animate({
            scrollTop: this.scrollTop
          }, 200);
        }
      },
      immediate: true
    },
    searchValue: {
      handler(newValue) {
        this.$emit('onSearchPc', newValue);
      }
    }
  },
  created() {},
  mounted() {
    this.scrollTopFun();
    this.formatCatalog();
  },
  methods: {
    // 判断寻找章节数据
    chooseDate(data) {
      // console.log(data,'判断寻找章节数据');
      if (this.generalAPI?.isCatalogStudent) {
        this.isLoading = true;
        this.generalAPI.getCatalogStudent({
          id: data.id
        }).then(res => {
          this.isLoading = false;
          this.chapterDate = res.data || {};
          // console.log(res)
        });
      }
    },
    stopOpen() {
      return '';
    },
    // 转换时间
    getHours(time) {
      if (time) {
        let date = (time / 60 / 60).toFixed(1);
        if (date != 0.0) {
          return date;
        } else {
          return 0;
        }
      } else {
        return 0;
      }
    },
    // 点击展开章节数据
    openChapterDate() {
      this.chapterShow = true;
    },
    // 树节点鼠标移入移出
    mouseover(node, data) {
      // console.log(node,data);
      this.$set(data, 'show', true);
    },
    // 树节点鼠标移入
    mouseleave(node, data) {
      this.$set(data, 'show', false);
    },
    // 格式化目录
    formatCatalog() {
      const origin = this.catalogList;
      const filterMenu = menuList => {
        return menuList.filter(item => {
          return item.hiddenFlag !== '1';
        }).map(item => {
          item = Object.assign({}, item);
          if (item.children?.length) {
            item.children = filterMenu(item.children);
          }
          return item;
        });
      };
      this.catalogLists = filterMenu(origin);
      setTimeout(() => {
        if (this.catalogLists.length > 0) {
          this.currentNodeKey = this.catalogLists[0].id;
        }
      }, 500);
    },
    nodeclick(data, onj, node) {
      this.$emit('onNodeClick', {
        id: data.id,
        label: data.label,
        xmlCompRef: data.xmlCompRef,
        locationChapterId: data.locationChapterId
      });
      this.selectId = data.id;
    },
    changeTab(val) {
      this.currentActive = val;
      if (this.currentActive == 0) {
        setTimeout(() => {
          this.scrollTopFun();
        }, 500);
      }
    },
    expandOrCollapseNode(node, data) {
      node.expanded = !node.expanded;
    },
    // nodeClick(data) {
    //   this.$emit('onNodeClick', { id: data.id, label: data.label, xmlCompRef: data.xmlCompRef })
    //   this.$emit('resourceDetails', data, 'id', '')
    //   this.selectId = data.id
    // },
    backClick() {
      this.$emit('onBackClick');
    },
    jumpingNotes(item) {
      this.$emit('onBackClick');
      this.$emit('jumpingNotes', item);
    },
    jumpingBookmark(item) {
      this.$emit('onBackClick');
      this.$emit('jumpingBookmark', item);
    },
    editNotoPC(item) {
      if (this.pageType == 'h5') {
        this.$emit('onBackClick');
      }
      this.$emit('editNotoPC', item);
    },
    deleteNotoPC(item, type) {
      this.reminder = true;
      // this.$emit('deleteNotoPC', item, index)
      this.deleteItem = item;
      this.deletetype = type;
    },
    confirmDelete() {
      this.reminder = false;
      this.$emit('deleteNotoPC', this.deleteItem, this.deletetype);
    },
    scrollTopFun() {
      if (this.$refs.tree) {
        this.$refs.tree.setCurrentKey(this.checkedId);
        let Dom = document.getElementsByClassName('is-current');
        let DomBox = document.getElementById('preview-left-student');
        if (Dom) {
          setTimeout(() => {
            if (Dom[0]) {
              if (Dom[0].getBoundingClientRect().top > document.documentElement.clientHeight - 40 || Dom[0].getBoundingClientRect().top < 60) {
                if (DomBox) {
                  DomBox.scrollTop = 0;
                  DomBox.scrollTo({
                    top: Dom[0].getBoundingClientRect().top - 300,
                    behavior: 'smooth'
                  });
                }
              }
            }
          }, 500);
        }
      }
    },
    filterNode(value, data, node) {
      return data.hiddenFlag !== '1';
    },
    isTrialReading(chapterId) {
      if (!this.isTrial) return false;
      let i = !this.readableChapters.includes(chapterId);
      // console.log(i,'isTrialReading');
      return i;
    },
    // 递归函数获取本章所有活页id
    getAllLeaf(data) {
      // console.log(data, 'getAllLeaf');

      let result = [];
      // 检查当前节点是否有id属性
      if (data.id) {
        this.chanpterName += data.label + ',';
        result.push(data.id);
      }
      // 递归处理子节点
      if (data.children && Array.isArray(data.children)) {
        for (let child of data.children) {
          result = result.concat(this.getAllLeaf(child));
        }
      }
      return result;
    },
    // 点击展开mind弹窗
    openMindDia(node) {
      console.log('点击了 openChapterDate', this.mindShow, node);
      this.pBlockData.jsMindData = '';
      this.aiMessage = '';
      this.mindComponentList = [];
      this.chanpterName = '';
      this.mindShow = true;
      this.mindLoading = true;
      this.looseLeafId = node.id;
      this.levelChapterId = node.id;
      let data = localStorage.getItem('mind_data_' + this.levelChapterId) || '';
      if (data) {
        this.pBlockData = JSON.parse(data);
        this.mindLoading = false;
      } else {
        this.levelChapterId = this.getAllLeaf(node);
        // console.log('this.levelChapterId', this.levelChapterId);
        if (sysEnv.isBSD) {
          this.levelChapterId.forEach(async (item, index) => {
            await fetch(process.env.VUE_APP_BASE_API + '/business/looseLeaf/getById?id=' + item, {
              method: 'get',
              headers: {
                'Accept': 'application/json'
              },
              query: {
                id: item
              }
            }).then(response => response.json()).then(res => {
              if (res.data) {
                let data = {};
                data[item] = res.data;
                this.formattedData(data, item, index);
              }
            });
            // getLeaf(item).then(res => {
            //   if (res.data) {
            //     let data = {}
            //     data[item] = res.data
            //     this.formattedData(data, item, index)
            //   }
            // })
          });
        }
      }
    },
    // getMindAi() {

    //   getLeaf(this.looseLeafId).then(res => {
    //     if (res.data) {
    //       let data = {}
    //       data[this.looseLeafId] = res.data
    //       this.formattedData(data, this.looseLeafId, 'chapter')
    //     }
    //   })

    //   // console.log(this.$refs.tree.getCheckedNodes(), 'getMindAi');
    // },
    // 处理活页json数据信息
    formattedData(looseLeafData, chapterId, index) {
      let list = [];
      let searchList = [];
      list = JSON.parse(looseLeafData[chapterId].looseLeafInfo) || [];
      list.map((element, index) => {
        let groupIndex = index;
        // 向数据里添加位置信息，第一位：章节Id 、第二位：模块Id
        this.$set(element, 'location', `xml-digital-teaching/${chapterId}/${element.xmlCompRef}`);

        // 向数据里添加章节Id
        this.$set(element, 'chapterId', chapterId);
        this.$set(element, 'label', looseLeafData[chapterId].looseLeafName); //章节名字
        this.$set(element, 'groupIndex', groupIndex); //块的索引
        // if (item.componentsName.indexOf('xml-single-text-group') !== -1) {
        //   this.$set(item, 'Text', item.data.pGroupData.textData?.html) //文本内容
        // } else if (item.componentsName.indexOf('paragrap') !== -1) {
        //   this.$set(item, 'Text', item.data.pGroupData.bodyTextData?.html) //文本内容
        // }
        if (element.componentsName == 'xml-single-text-group' || element.componentsName == 'xml-single-agent-group') {
          // 文本
          let textList = [];
          if (element.data.pGroupData.textData?.html.indexOf(this.searchText) !== -1) {
            textList.push({
              componentType: 'textGroup',
              Text: element.data.pGroupData.textData?.html,
              modulIndex: 0
            });
          }
          this.$set(element, 'componentType', 'textGroup');
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-image-group') {
          // 图片
          let textList = [];
          element.data.pGroupData.imageData.imageList.map((item, index) => {
            textList.push({
              title: item.title,
              titleClass: 'xml-image-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-music-group') {
          // 音频
          let textList = [];
          element.data.pGroupData.musicData.musicSetList.map((item, index) => {
            textList.push({
              title: item.title,
              titleClass: 'xml-audio-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-video-group') {
          // 视频
          let textList = [];
          element.data.pGroupData.videoData.videoSetList.map((item, index) => {
            textList.push({
              title: item.title,
              titleClass: 'xml-video-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-resource-group') {
          // 资源
          let textList = [];
          element.data.pGroupData.resourceData.resourceSetList.map((item, index) => {
            let title = item.title || item.fileFormat;
            textList.push({
              title: title,
              titleClass: 'xml-resource-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-book-group') {
          // 电子书
          let textList = [];
          element.data.pGroupData.ebookData.ebookSetList.map((item, index) => {
            let title = item.title || item.name;
            textList.push({
              title: title,
              titleClass: 'xml-ebook-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-question-group') {
          // 试题
          let textList = [];
          element.data.pGroupData.questionData.questionSetList.map((item, index) => {
            textList.push({
              title: item.stem.content,
              titleClass: 'xml-question-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-test-paper-group') {
          // 试卷
          let textList = [];
          element.data.pGroupData.testPaperData.testPaperSetList.map((item, index) => {
            textList.push({
              title: item.paperName,
              titleClass: 'xml-paper-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-hotzone-group') {
          //热区
          let textList = [];
          element.data.pGroupData.xmlBlockData.imageList.map((item, index) => {
            textList.push({
              title: item.title,
              titleClass: 'xml-hot-zone-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-html-group') {
          if (element.data.pGroupData.htmlData.code) ;
        } else if (element.componentsName.indexOf('title') !== -1) {
          //标题
          let modulIndex = 0;
          let textList = [];
          for (let item in element.data.pGroupData) {
            if (element.data.pGroupData[item].html && element.data.pGroupData[item].html.indexOf(this.searchText) !== -1) {
              textList.push({
                componentType: 'textGroup',
                Text: element.data.pGroupData[item].html,
                textKey: item,
                modulIndex
              });
            }
            modulIndex++;
          }
          this.$set(element, 'componentType', 'textGroup');
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName.indexOf('paragraph') !== -1) {
          //段落
          let modulIndex = 0;
          let textList = [];
          for (let item in element.data.pGroupData) {
            if (Array.isArray(element.data.pGroupData[item])) {
              for (let index in element.data.pGroupData[item]) {
                if (element.data.pGroupData[item][index].html && element.data.pGroupData[item][index].html.indexOf(this.searchText) !== -1) {
                  textList.push({
                    componentType: 'textGroup',
                    Text: element.data.pGroupData[item][index].html,
                    textKey: item,
                    modulIndex
                  });
                }
                modulIndex++;
              }
            } else if (element.data.pGroupData[item].html && element.data.pGroupData[item].html.indexOf(this.searchText) !== -1) {
              textList.push({
                componentType: 'textGroup',
                Text: element.data.pGroupData[item].html,
                textKey: item,
                modulIndex
              });
            }
            modulIndex++;
          }
          this.$set(element, 'componentType', 'textGroup');
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName.indexOf('imageText') !== -1) {
          //图文
          let modulIndex = 0;
          let textList = [];
          for (let item in element.data.pGroupData) {
            if (element.data.pGroupData[item].html && element.data.pGroupData[item].html.indexOf(this.searchText) !== -1) {
              textList.push({
                componentType: 'textGroup',
                Text: element.data.pGroupData[item].html,
                textKey: item,
                modulIndex
              });
            }
            modulIndex++;
          }
          this.$set(element, 'componentType', 'textGroup');
          this.$set(element, 'textList', textList); //文本内容
        }
      });
      this.mindComponentList = this.mindComponentList.concat(list);
      // console.log('处理后的数据', this.mindComponentList);

      if (index == this.levelChapterId.length - 1) {
        this.mindComponentList.map(item => {
          if (item.componentType == 'textGroup') {
            if (item.data.pGroupData.textData) {
              searchList.push(item.data.pGroupData.textData.html.replace(/<[^>]*>/g, ''));
            } else if (item.data.pGroupData.titleTextData) {
              searchList.push(item.data.pGroupData.titleTextData.html.replace(/<[^>]*>/g, ''));
            }
          } else if (item.textList) {
            for (let i = 0; i < item.textList.length; i++) {
              searchList.push(item.textList[i].title);
            }
          }
        });
        searchList = JSON.parse(JSON.stringify(searchList));
        for (let i = 0; i < searchList.length; i++) {
          this.aiMessage += (searchList[i] + ',').replace(/<[^>]*>/g, '');
        }
        // this.getAiToken()
        this.createBaiLianConversation();
        // console.log('获取的本章文字', this.aiMessage, this.chanpterName);
      }
    },
    // 获取bailian使用的千帆模型会话ID
    async createBaiLianConversation() {
      fetch('https://jc.jsxfedu.com/dt-api/baidu/addDialogue', {
        method: 'post',
        headers: {
          'Content-Type': 'application/json;charset=utf-8'
          // Authorization: 'Bearer ' + this.robotData.qianfan.token
        },
        body: JSON.stringify({
          token: 'Bearer ' + 'bce-v3/ALTAK-sKDHFjjywLlncMntGoo9z/81eededf553cad3cdd627d81b20a7735bf876634',
          app_id: '4a579ce3-7176-42c5-a760-1960b195bb38'
        })
      }).then(response => response.json()).then(json => {
        this.bailianConversationId = json.data.conversation_id;
        this.getBaiLianData();
      });
    },
    // 调用ai
    async getBaiLianData() {
      // 创建请求中断控制器用于可能的请求中止
      let controller = new AbortController();
      // console.log('getBaiLianDatagetBaiLianDatagetBaiLianData');
      try {
        // 发送流式对话请求到千帆API
        const response = await fetch('https://jc.jsxfedu.com/dt-api/baidu/dialogue', {
          method: 'post',
          headers: {
            'Content-Type': 'application/json;charset:utf-8'
          },
          // 构造包含认证令牌和应用ID的请求体
          body: JSON.stringify({
            token: 'Bearer ' + 'bce-v3/ALTAK-sKDHFjjywLlncMntGoo9z/81eededf553cad3cdd627d81b20a7735bf876634',
            app_id: '4a579ce3-7176-42c5-a760-1960b195bb38',
            query: this.chanpterName,
            // query: this.aiMessage,
            stream: true,
            conversation_id: this.bailianConversationId,
            signal: controller.signal
          })
        });

        // 处理流式响应数据
        const reader = response.body.getReader();
        let data = '';
        let content = '';
        // 持续读取流数据直到完成
        while (true) {
          const {
            done,
            value
          } = await reader.read();

          // 流结束时标记完成状态
          if (done) {
            this.answerData['bailian'].loadingCompleted = true;
            // let str = this.transformString(this.answerData['bailian'].content)
            let str = this.convertMarkdown(this.answerData['bailian'].content);
            let jsMindData = this.convertToJsMindData(str);
            this.pBlockData = {
              jsMindData: jsMindData.data,
              mindHeight: 600,
              top: 0,
              width: 100,
              left: 0
            };
            localStorage.setItem('mind_data_' + this.levelChapterId, JSON.stringify(this.pBlockData));
            this.mindLoading = false;
            console.log(this.answerData['bailian'].content, jsMindData, str, 'mind_data_' + this.levelChapterId, "this.answerData['bailian'][index].content");
            break;
          }

          // 解码并处理服务端推送的事件数据
          data = new TextDecoder().decode(value);
          let list = data.split('data: ') || [];
          this.answerData['bailian'].loading = false;
          this.answerData['bailian'].type = 'text';
          // console.log(data, "ai获取data");

          // 解析每个事件数据块并拼接答案内容
          list.map(item => {
            if (item && item != '\n\n') {
              let json = {};
              try {
                json = JSON.parse(item) || {};
              } catch (e) {}
              let text = json.answer || '';
              // 格式化文本内容并转换为Markdown
              content += text.replace(/\\n/g, '<br/>');
              // console.log(content, "content");

              this.answerData['bailian'].content = content;
            }
          });
        }
      } catch {
        // 异常处理：获取并记录错误数据
        // this.getErrorData(question, index, 'bailian')
      }
    },
    // 获取ai的token
    getAiToken() {
      fetch('https://services.isbn.ink/api/auth/oauth/token', {
        method: 'post',
        headers: {
          'Content-Type': 'application/json',
          Authorization: 'Bearer ' + 'UmlKLUwBXuFvKaIpsSNa7oUY041sQlklUvVlUxcm'
        },
        body: JSON.stringify({
          app_id: '123',
          client_id: 1,
          client_secret: 'UmlKLUwBXuFvKaIpsSNa7oUY041sQlklUvVlUxcm',
          user_id: '2132'
        })
      }).then(response => response.json()).then(json => {
        // this.conversationId = json.conversation_id
        // this.conversationId = json.data.token.split('|')[0]
        this.aiToken = json.data.token;
        this.useAi();
        // console.log(json,this.conversationId, 'conversationIdconversationIdconversationId')
      });
    },
    // 使用ai
    useAi() {
      fetch('https://services.isbn.ink/api/admin/articles', {
        method: 'post',
        headers: {
          'Content-Type': 'application/json',
          Authorization: 'Bearer ' + this.aiToken
        },
        body: JSON.stringify({
          title: '出版学',
          outside_uid: '8899',
          content_text: this.aiMessage

          // content_text: markdown.value,
          // kb_id:113,
          // kb_type:'book',
          // message:'你知道什么资料'
        })
      }).then(response => response.json()).then(json => {
        let str = this.transformString(json.data.article.content_markmap);
        let jsMindData = this.convertToJsMindData(str);
        this.pBlockData = {
          jsMindData: jsMindData.data,
          mindHeight: 600,
          top: 0,
          width: 100,
          left: 0
        };
        // localStorage.setItem('mind_data_' + this.levelChapterId, JSON.stringify(this.pBlockData))
        this.mindLoading = false;
      });
    },
    getMousePositionRelativeToElement(event, element) {
      // 获取元素的边界矩形
      const rect = element.getBoundingClientRect();

      // 计算鼠标相对于元素的位置
      const x = event.clientX - rect.left;
      const y = event.clientY - rect.top;
      return {
        x,
        y
      };
    },
    convertMarkdown(value) {
      let result = '';
      let lastHeadingLevel = 0;

      // 分割输入文本为行
      const lines = value.split('\n');
      for (let line of lines) {
        // 处理标题行
        const headingMatch = line.match(/^(#+)\s+(.*)$/);
        if (headingMatch) {
          const level = headingMatch[1].length;
          lastHeadingLevel = level;
          result += line + '\n';
          continue;
        }

        // 处理列表项行
        const listItemMatch = line.match(/^-\s+(.*)$/);
        if (listItemMatch) {
          // 根据上一个标题级别生成新的标题级别
          const newHeadingLevel = lastHeadingLevel + 1;
          const newHeadingPrefix = '#'.repeat(newHeadingLevel);
          result += `${newHeadingPrefix} ${listItemMatch[1]}\n`;
          continue;
        }

        // 处理空行
        if (line.trim() === '') {
          result += '\n';
          continue;
        }

        // 其他行保持不变
        result += line + '\n';
      }
      return result;
    },
    // ai获取到的字符串转化
    transformString(inputString) {
      // console.log(inputString, 'inputString')

      let result = '';
      const lines = inputString.split('\n');
      for (const line of lines) {
        let depth = 0;
        let content = '';
        for (let i = 0; i < line.length; i++) {
          if (line[i] === ' ') {
            depth++;
          } else if (line[i] === '-') {
            // 跳过 '-' 和后面的空格
            i++;
            while (i < line.length && line[i] === ' ') {
              i++;
            }
            content = line.slice(i);
            break;
          }
        }
        // 如果没有空格，至少添加一个 #
        const hashCount = depth === 0 ? 1 : Math.ceil(depth / 2) + 1;
        const hashes = '#'.repeat(hashCount);
        result += `${hashes} ${content}\n`;
      }
      console.log(result.trim(), 'result');
      return result.trim();
    },
    convertToJsMindData(str) {
      const lines = str.split('\n');
      ({
        id: 'root',
        topic: lines[0].replace(/#+\s*/, ''),
        children: [],
        leval: 1
      });
      // stack[0].children=[]
      // console.log(stack, 'root', lines)

      let tempList = [];
      for (let i = 0; i < lines.length; i++) {
        const match = lines[i].match(/^(#+)\s*(.*)/);
        if (match) {
          const level = match[1].length;
          const topic = match[2];
          const node = {
            id: `node${i}`,
            topic: topic,
            children: [],
            leval: level
          };
          tempList.push(node);
        }
      }
      let datas = this.arrayToTree(tempList);
      console.log(tempList, 'tempList', datas, {
        meta: {
          name: '项目规划思维导图',
          author: '作者',
          version: '0.1'
        },
        format: 'node_tree',
        data: datas[0]
      });
      return {
        meta: {
          name: '项目规划思维导图',
          author: '作者',
          version: '0.1'
        },
        format: 'node_tree',
        data: datas[0]
      };
    },
    // 转换格式化
    arrayToTree(data) {
      const tree = [];
      const map = {};

      // 先将所有节点存入 map 中
      data.forEach(item => {
        map[item.id] = {
          ...item,
          children: []
        };
      });
      data.forEach((item, index) => {
        const current = map[item.id];
        if (item.leval === 1) {
          tree.push(current);
        } else {
          // 找到父节点
          const parentLeval = item.leval - 1;
          let parent = null;
          // 从当前元素往前找合适的父节点
          for (let i = index - 1; i >= 0; i--) {
            if (data[i].leval === parentLeval) {
              parent = map[data[i].id];
              break;
            }
          }
          if (parent) {
            parent.children.push(current);
          }
        }
      });
      return tree;
    }
  }
};

var __$_require_assets_images_condition_ht_v_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAABDtJREFUWEftmM1u2lgUx//H7mRGs6JPMPQJYqRCnFmRN4DQSt21WbaplPAEgScgaCYzy2Y/DeUNSlfjBEZxn2DoE5RlFeJ7Jscf1MY2BhykqhpvkPD9+N3/Ofd8mPCNP/SN8+H7BzTNWlGscAu4v8FDDia6joll9cd5rLS0ggJyy1pNJ2wzkQFGAXNQaSDMmIBgg9RHVjS+JdW3lwTPBHxs1qoE/YSAah4l5ucyMJjCOcgCXQj4eGf/WCPqhBcXNYj4E8A2QGMGXBPq0CKmVMQFZi6QqzIXASoy0zaRq/zsUeDWyOq10w6fClgx908AaslED4q6Gm7P8/pUufzUIF0dA3geQC2CTAQsl2sG6fq1twCP2dHrw+Ff9n2a2DSfFRWm7wM/VqC9kfV2ML9HImDFbPwrE0U5nZxSXtXSDiaQDk+vxezik0PrYi8T0DRrVQVdTgYFao+st66ZN/VUzP0WQCf+fjEVYwqGJ2hwHm1KveDARrVW2Pqif/YAuT2yehFBYoA7ZuP9ndxVZtjDy4vSppQLr1vZbVyDYSSZOQZY3ml8dn2CVHf49zu5bRt/yrv1U2LtSHx+eHnxMLxhBDAiN3NzdNk7zaT7jWvQ4PoQgAMc0sq3PRxv590qAhi+II5y6v9c9fsLAf/gDhhhlSe4QQlNiubf31nGyCHO8Zqa82tWdhs1MN65Qc3RSuGQlgqYFpfcxTtcxA94A5qlvwkwyxA2Dsnz3Q4X8CNOQof4+i5EORc5Ijd5dcAOG9hyT+tVL24RgDqUq+SR+x/jFFN0/XGGP24MRj3JBZYGLP/61CCl3AySauIzlvfepkAXP6OFAxIFgfA7r4IJ8u4HaHiBl3Om9xdZGlBKKgVdsggYfDC0eucxHzxjuTjPwWjjNUUv0Z9chIIcIFwQdHFIC6PB0pdEYHKHmTOWWvEcdHcEQhuvaPFFkz2XDTMCOAvUKbkxM+ysMeDrnvxhaPUidWc8UPunkX1ufnIe2oO+518begzzWXELU8+tEpJDDNA0n1QV2C8W4rnxvjnL5v4LAr2RdZNCW3K5FeRGxmRKTimrLF8X2lfPrwl5fGX1Hs2vlQgYVlEK1huovfuGjMKlR40FJf+T1l2x7+dYlt6jPYUa5AWVfP/gi3ZETMdBf7Ko7lzYNFXMMKQvvmQOhTGIP0rDxFBu3g364MBE0idrUhWx5jZOBPzCILmhkf45qyjObDt9JxYlIwuv63ezeQRbY2paCX1IeO1MwGCw+CWTU2MmSXMFgLZXhPwEhk2aGhPr/SywYO2lAZNgvM8eD1xlFVQ16C3uIlpbgzZwHJro+jTX549cgGHoRQl/RaUjw79vQGnwWfcrF9aM4DOJIm6C1az0H1n9WEO+rKprKxhuT7M2S2ons+bkviSrAMqluZrrdzcOKBtI6MnaSG5ynu86a5s4C+y+3v8PmFfJ/wB+gCpHvZMVuAAAAABJRU5ErkJggg==";

var __$_require_assets_images_condition_bsd_mind_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAyVJREFUWEe9V11SGkEQ/nqwzFNKqFVTeRJfU1E2J4icIHiCwA3gBPSeQHOC6AnkBpgTZMUDiE+p6BrJq2F3Yu8P7A8rbIBMFQXMzk5//U331z2EcJh8Z2qoE0BVAU3R/Gq/SQP6kvBk2fx2KHv7hg4t5zNpxQS3ZfPO5WqNJncz2WmIo0TEdrdyTib/qGq86hOobnPFR7XuYfJjVUP3CeNjOmTnTAE9m7d76zYc39/k+yONUpdq/HBzxcb+/zQe2RLbKwEgAexBNQnYSjviwft2zbtnsxyssTNcGsAB/2wobFzMYfDsio1Wes0/A3jHd6YClQlUVqATAFWARhreVdwIQe0BuipzHtxWmonCAN7z/VEJ6mtgMDkIXn1WCtf44RFA+fmdDAuFAMyjWgOnAzY6yUiXFN/8LgA09JcBb7fjzwsBkIgNqR6KYAFjXzNEQyKaAYzCT2RnwtQshhYGEFLfD6RTH8c1IxKVGIhMPBJg2WzwwkEo6uhhoxGeHQilGqDlPwjuB5t37fRmIrEetBmfV6AhUOrZXBFmMmMmA4d83ya/KOWP51LFg65hLSteGQBBXdiUsxZfR4D+nYr1LUBLRCMv6ouAygCIe09Q++niFJy35wPU8DoD3jktYnBuDByw01QgyfOZZx1naC0ATH4shx76NANIl2eZD48gy1BRNmYGockPbQ28GIR5abUSALKJnLWHcTPaMJmGSR0I1t+UXbxuUKj7MSAjhXEvar/mxkCeB0HzoEIhSmp+GBfyLFMfov3y0nZhJUzFxtCDa/2B6/eOr7AZN36bcmJvymK2WC0MIKBZmknKrfsEdGw2EmkZpq1fjJauhlMQopJBjY+PdI2Inq2sHMeNSQsGkJ+OGkpYkd+inKka4a/x6wNBt2zeTrRmhY4gP0Cdpg7FK28NAec2G5OsmrKzgp5wmrauNBuRgE2wvNTyr4SBouITXx+25b/6BNda95UsDfSAnYYCfaLgUlq6IDzV8xRrGS9nvRuJF0HV/cupyX4gdT2MO9f8Zq1XtKizJmhLsmJyDQ/032WC+ijJtZ5B0kfcKpTaNlf8lP0LOlbu2CPsJZYAAAAASUVORK5CYII=";

/* script */
const __vue_script__$2W = script$2W;
var __vue_render__$2W = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-preview-catalog-pc",
      class: _vm.sysEnv.isHuaTeng ? "preview-left-student" : "",
      attrs: { id: "xmlPreviewCatalogPc" },
    },
    [
      !_vm.sysEnv.isNoteHighlight && !_vm.sysEnv.isHuaTeng
        ? _c(
            "div",
            {
              staticClass: "catalog-header",
              class: _vm.userType == "teacher" ? "catalogHeaderHeader" : "",
            },
            [
              _c("div", { staticClass: "catalog-img catalog-img-left" }),
              _vm._v(" "),
              _c("div", { staticClass: "catalog-title" }, [_vm._v("教材目录")]),
              _vm._v(" "),
              _c("div", { staticClass: "catalog-img catalog-img-right" }),
            ]
          )
        : _vm._e(),
      _vm._v(" "),
      !_vm.sysEnv.isNoteHighlight
        ? _c("div", { staticClass: "xml-text-book-name" }, [
            !_vm.sysEnv.isNoteHighlight
              ? _c(
                  "div",
                  {
                    staticClass: "text-book-name",
                    class:
                      _vm.userType == "teacher" ? "textbookNameTeacer" : "",
                  },
                  [
                    _c("span", [
                      _vm._v(
                        _vm._s(
                          _vm.textBookName ? _vm.textBookName : "未选择教材"
                        )
                      ),
                    ]),
                  ]
                )
              : _vm._e(),
          ])
        : _vm._e(),
      _vm._v(" "),
      _c(
        "div",
        {
          staticClass: "catalog-content",
          class: _vm.userType == "teacher" ? "catalogContentTeacher" : "",
        },
        [
          _vm.currentNodeKey != ""
            ? _c("el-tree", {
                ref: "tree",
                attrs: {
                  id: "preview-tree",
                  "default-expand-all": true,
                  data: _vm.catalogLists,
                  props: _vm.defaultProps,
                  "highlight-current": _vm.PreviewCatalog,
                  indent: 24,
                  draggable: false,
                  "node-key": "id",
                  "filter-node-method": _vm.filterNode,
                  "expand-on-click-node": false,
                  "current-node-key": _vm.currentNodeKey,
                },
                on: { "node-click": _vm.nodeclick },
                scopedSlots: _vm._u(
                  [
                    {
                      key: "default",
                      fn: function (ref) {
                        var node = ref.node;
                        var data = ref.data;
                        return _c(
                          "span",
                          {
                            staticStyle: { width: "100%" },
                            on: {
                              mouseover: function ($event) {
                                _vm.sysEnv.isHuaTeng || _vm.sysEnv.isBSD
                                  ? _vm.mouseover(node, data)
                                  : "";
                              },
                              mouseleave: function ($event) {
                                _vm.sysEnv.isHuaTeng || _vm.sysEnv.isBSD
                                  ? _vm.mouseleave(node, data)
                                  : "";
                              },
                            },
                          },
                          [
                            [
                              _c(
                                "div",
                                {
                                  staticClass: "catalog-node__right",
                                  on: {
                                    click: function ($event) {
                                      $event.stopPropagation();
                                      return function () {
                                        return _vm.expandOrCollapseNode(
                                          node,
                                          data
                                        )
                                      }.apply(null, arguments)
                                    },
                                  },
                                },
                                [
                                  node.childNodes.length && node.expanded
                                    ? _c("i", {
                                        staticClass: "el-icon-arrow-down",
                                        staticStyle: {
                                          "font-size": "16px",
                                          "font-weight": "600",
                                        },
                                      })
                                    : node.childNodes.length && !node.expanded
                                    ? _c("i", {
                                        staticClass: "el-icon-arrow-right",
                                        staticStyle: {
                                          "font-size": "16px",
                                          "font-weight": "600",
                                        },
                                      })
                                    : _vm._e(),
                                ]
                              ),
                              _vm._v(" "),
                              _c("span", {
                                staticClass: "custom-tree-node",
                                attrs: { title: node.label },
                                domProps: { textContent: _vm._s(node.label) },
                              }),
                              _vm._v(" "),
                              _vm.isTrialReading(data.id)
                                ? _c("div", {
                                    staticClass: "exceeding_the_trial_reading",
                                  })
                                : _vm._e(),
                              _vm._v(" "),
                              _vm.sysEnv.isHuaTeng && data.catalogLevel == 1
                                ? _c(
                                    "div",
                                    {
                                      directives: [
                                        {
                                          name: "show",
                                          rawName: "v-show",
                                          value:
                                            data.show &&
                                            !_vm.isTrialReading(data.id),
                                          expression:
                                            "data.show && !isTrialReading(data.id)",
                                        },
                                      ],
                                      staticClass: "ht_tv",
                                      on: {
                                        click: function ($event) {
                                          $event.stopPropagation();
                                          return _vm.stopOpen.apply(
                                            null,
                                            arguments
                                          )
                                        },
                                      },
                                    },
                                    [
                                      _c(
                                        "el-popover",
                                        {
                                          attrs: {
                                            placement: "right",
                                            width: "238",
                                            trigger: "hover",
                                            "popper-class":
                                              "xml-ht-previewcatalog-custom-popover",
                                          },
                                          on: {
                                            show: function ($event) {
                                              return _vm.chooseDate(data)
                                            },
                                          },
                                        },
                                        [
                                          _c(
                                            "div",
                                            {
                                              directives: [
                                                {
                                                  name: "loading",
                                                  rawName: "v-loading",
                                                  value: _vm.isLoading,
                                                  expression: "isLoading",
                                                },
                                              ],
                                            },
                                            [
                                              _c(
                                                "div",
                                                { staticClass: "font" },
                                                [
                                                  _vm._v(
                                                    "\n                  本章学习\n                  "
                                                  ),
                                                  _c(
                                                    "div",
                                                    {
                                                      staticClass: "time_color",
                                                    },
                                                    [
                                                      _vm._v(
                                                        " " +
                                                          _vm._s(
                                                            _vm.getHours(
                                                              _vm.chapterDate
                                                                .studyTime
                                                            )
                                                          ) +
                                                          " "
                                                      ),
                                                    ]
                                                  ),
                                                  _vm._v(
                                                    "\n                  小时\n                "
                                                  ),
                                                ]
                                              ),
                                              _vm._v(" "),
                                              _c("el-progress", {
                                                attrs: {
                                                  percentage:
                                                    Number(
                                                      _vm.chapterDate
                                                        .studyProgress
                                                    ) || 0,
                                                  "text-inside": true,
                                                  "stroke-width": 8,
                                                  "define-back-color":
                                                    "#EDEDED",
                                                },
                                              }),
                                              _vm._v(" "),
                                              _c(
                                                "div",
                                                {
                                                  staticClass: "font",
                                                  staticStyle: {
                                                    "margin-top": "18px",
                                                  },
                                                },
                                                [
                                                  _vm._v(
                                                    "\n                  试题完成\n                  "
                                                  ),
                                                  _c(
                                                    "div",
                                                    {
                                                      staticClass: "test_color",
                                                    },
                                                    [
                                                      _vm._v(
                                                        " " +
                                                          _vm._s(
                                                            _vm.chapterDate
                                                              .testNum
                                                          ) +
                                                          " "
                                                      ),
                                                    ]
                                                  ),
                                                  _vm._v(
                                                    "\n                  道，正确率\n                  "
                                                  ),
                                                  _c(
                                                    "div",
                                                    {
                                                      staticClass: "test_color",
                                                    },
                                                    [
                                                      _vm._v(
                                                        " " +
                                                          _vm._s(
                                                            _vm.chapterDate
                                                              .accuracy
                                                          ) +
                                                          "% "
                                                      ),
                                                    ]
                                                  ),
                                                ]
                                              ),
                                              _vm._v(" "),
                                              _c("el-progress", {
                                                staticClass: "orange",
                                                attrs: {
                                                  percentage:
                                                    Number(
                                                      _vm.chapterDate.accuracy
                                                    ) || 0,
                                                  "text-inside": true,
                                                  "stroke-width": 8,
                                                  "define-back-color":
                                                    "#EDEDED",
                                                  color: "#F99057",
                                                },
                                              }),
                                            ],
                                            1
                                          ),
                                          _vm._v(" "),
                                          _c("img", {
                                            attrs: {
                                              slot: "reference",
                                              src: __$_require_assets_images_condition_ht_v_png__,
                                              alt: "",
                                            },
                                            on: { click: _vm.openChapterDate },
                                            slot: "reference",
                                          }),
                                        ]
                                      ),
                                    ],
                                    1
                                  )
                                : _vm._e(),
                              _vm._v(" "),
                              _vm.sysEnv.isBSD && data.catalogLevel == 1
                                ? _c(
                                    "div",
                                    {
                                      directives: [
                                        {
                                          name: "show",
                                          rawName: "v-show",
                                          value: data.show,
                                          expression: "data.show",
                                        },
                                      ],
                                      staticClass: "ht_tv",
                                      on: {
                                        click: function ($event) {
                                          $event.stopPropagation();
                                          return _vm.openMindDia(data)
                                        },
                                      },
                                    },
                                    [
                                      _c("img", {
                                        attrs: {
                                          src: __$_require_assets_images_condition_bsd_mind_png__,
                                          alt: "",
                                        },
                                      }),
                                    ]
                                  )
                                : _vm._e(),
                            ],
                          ],
                          2
                        )
                      },
                    },
                  ],
                  null,
                  false,
                  3981698639
                ),
              })
            : _vm._e(),
        ],
        1
      ),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          attrs: { title: "思维导图", visible: _vm.mindShow, width: "1000px" },
          on: {
            "update:visible": function ($event) {
              _vm.mindShow = $event;
            },
          },
        },
        [
          _c(
            "div",
            {
              directives: [
                {
                  name: "loading",
                  rawName: "v-loading",
                  value: _vm.mindLoading,
                  expression: "mindLoading",
                },
              ],
              staticClass: "xml-single-mind-group",
              staticStyle: { height: "600px" },
            },
            [
              _vm.pBlockData.jsMindData
                ? _c("xml-mind-render", {
                    attrs: {
                      "p-block-data": _vm.pBlockData,
                      "block-data-name": "mindData",
                      "show-title": true,
                      pageType: _vm.pageType,
                      mode: "preview",
                    },
                  })
                : _vm._e(),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "span",
            {
              staticClass: "dialog-footer",
              attrs: { slot: "footer" },
              slot: "footer",
            },
            [
              _c(
                "el-button",
                {
                  on: {
                    click: function ($event) {
                      _vm.mindShow = false;
                    },
                  },
                },
                [_vm._v("取 消")]
              ),
              _vm._v(" "),
              _c(
                "el-button",
                {
                  attrs: { type: "primary" },
                  on: {
                    click: function ($event) {
                      _vm.mindShow = false;
                    },
                  },
                },
                [_vm._v("确 定")]
              ),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2W = [];
__vue_render__$2W._withStripped = true;

  /* style */
  const __vue_inject_styles__$2W = undefined;
  /* scoped */
  const __vue_scope_id__$2W = undefined;
  /* module identifier */
  const __vue_module_identifier__$2W = undefined;
  /* functional template */
  const __vue_is_functional_template__$2W = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2W = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2W, staticRenderFns: __vue_staticRenderFns__$2W },
    __vue_inject_styles__$2W,
    __vue_script__$2W,
    __vue_scope_id__$2W,
    __vue_is_functional_template__$2W,
    __vue_module_identifier__$2W,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$2V = {
  name: 'xmlEmpty'
};

/* script */
const __vue_script__$2V = script$2V;

/* template */
var __vue_render__$2V = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "xml-empty-content" }, [
    _c(
      "svg",
      {
        staticClass: "icon",
        attrs: {
          t: "1712834383184",
          viewBox: "0 0 1238 1024",
          version: "1.1",
          xmlns: "http://www.w3.org/2000/svg",
          "p-id": "2473",
          "xmlns:xlink": "http://www.w3.org/1999/xlink",
          width: "154.75",
          height: "128",
        },
      },
      [
        _c("path", {
          attrs: {
            d: "M23.81001 23.81h904.93a23.81 23.81 0 0 1 23.82 23.82v940.65a23.81 23.81 0 0 1-23.82 23.81H23.81001A23.81 23.81 0 0 1 0.00001 988.28V47.63A23.81 23.81 0 0 1 23.81001 23.8z m95.26 95.26a23.81 23.81 0 0 0-23.81 23.81v750.14a23.81 23.81 0 0 0 23.81 23.82h714.42a23.81 23.81 0 0 0 23.81-23.82V142.88a23.81 23.81 0 0 0-23.81-23.81H119.07001z",
            fill: "#ECF0F9",
            "p-id": "2474",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M190.51001 285.77h571.54v59.53H190.50001v-59.53z m0 142.88h571.54v59.54H190.50001v-59.54z m0 142.88h404.84v59.54H190.50001v-59.54z",
            fill: "#ECF0F9",
            "p-id": "2475",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M309.58001 0h333.4a23.81 23.81 0 0 1 23.81 23.81v83.35a23.81 23.81 0 0 1-23.81 23.82h-333.4a23.81 23.81 0 0 1-23.81-23.82V23.81A23.81 23.81 0 0 1 309.58001 0z",
            fill: "#E0E4ED",
            "p-id": "2476",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M995.98001 357.44c-5.13 10.8-6.46 23.04-3.99 36.73 3.73 20.54 15.16 35.14 28.1 35.14l0.92 17.76c13.4 3.99 24.96 1.67 34.7-6.98-5.61-12.37-7.88-23.83-6.8-34.4l8.36-7.03 1.88-18.82-11.22-4.76-13.21-28.73-38.73 11.07z",
            fill: "#FFDCBC",
            "p-id": "2477",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M883.63001 965.52a142.88 47.63 0 1 0 285.77 0 142.88 47.63 0 1 0-285.77 0z",
            fill: "#E2E6EF",
            "p-id": "2478",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M1006.22001 909.48c-1.82 12.8-8.83 23.06-21.04 30.81-18.31 11.63-7.91 19.98 5.52 19.98 13.44 0 47.5-14.02 49.89-25.4 1.58-7.57-1.58-17.2-9.45-28.88l-24.92 3.49z",
            fill: "#416396",
            "p-id": "2479",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M1036.86001 926.15c-32.34 23.38-40.82 38.89-25.43 46.5 15.37 7.62 34.5-0.14 57.38-23.25 5.89-7.7 3.02-16.76-8.61-27.2-8.48-2.93-16.26-1.61-23.34 3.95z",
            fill: "#466DA6",
            "p-id": "2480",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M992.15001 360.3c7.73-19.88 21.82-28.74 42.28-26.6 20.47 2.15 32.03 14.98 34.66 38.49-0.43 17.35-6.84 30.22-19.23 38.61-2.02-2.49-1.87-4.76 0.47-6.86 3.04-2.72 9.22-10.14 6.25-17.1-1.98-4.61-5.05-5.91-9.2-3.86 1.18-12.46-5-20.9-18.53-25.34-13.55-4.43-25.78-3.55-36.7 2.67z",
            fill: "#58626B",
            "p-id": "2481",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M1085.63001 670.67l-16.97 260.96c-12.02 8.57-22.86 7.84-32.53-2.15l-11.05-218.81-11.3 103.91 18.4 95.37c-5.31 7.2-13.9 9.34-25.74 6.41l-39.46-105.03 4.86-150.5 113.8 9.84z",
            fill: "#2274FF",
            "p-id": "2482",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M1102.20001 513.96c15.71 26.9 29.17 38.96 40.36 36.23 16.79-4.11 51.67-60.17 61.21-66.28 5.96-3.8 18.39-3.95 33.48-1.49 1.43 0 1.7-0.68 0.8-1.99-20.12-17.83-35.08-22.14-44.89-12.91a4921.51 4921.51 0 0 1-50.6 46.44l-17-26.49-23.38 26.5z m-108.52-2.35c-15.71 34.82-29.17 50.88-40.36 48.14-16.79-4.11-51.68-60.17-61.21-66.28-5.96-3.8-18.39-15.87-33.49-13.4-1.42-0.02-1.7-0.68-0.8-1.98 20.13-9.9 35.08-10.24 44.9-1.03 9.82 9.22 26.68 24.71 50.6 46.45l16.98-26.5 23.38 14.6z",
            fill: "#FFDCBC",
            "p-id": "2483",
          },
        }),
        _vm._v(" "),
        _c("path", {
          attrs: {
            d: "M1023.64001 445.38c11.87 3.05 23.4 0.71 34.6-7 19.41-2.35 32.8 1.08 40.14 10.29a938.75 938.75 0 0 0 28.73 33.88c-3.8 18.21-13.38 29.93-28.73 35.17l-7.34-7.43c3.34 98.59 2.23 153.57-3.34 164.93-47.95 3.1-87.28-0.51-117.95-10.79l14.74-149.92-22.8-19.58L990.27001 454c5.69-6.34 10.9-10.13 15.64-11.36 4.74-1.22 10.66-0.32 17.74 2.74z",
            fill: "#F6F8FC",
            "p-id": "2484",
          },
        }),
      ]
    ),
  ])
};
var __vue_staticRenderFns__$2V = [];
__vue_render__$2V._withStripped = true;

  /* style */
  const __vue_inject_styles__$2V = undefined;
  /* scoped */
  const __vue_scope_id__$2V = undefined;
  /* module identifier */
  const __vue_module_identifier__$2V = undefined;
  /* functional template */
  const __vue_is_functional_template__$2V = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2V = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2V, staticRenderFns: __vue_staticRenderFns__$2V },
    __vue_inject_styles__$2V,
    __vue_script__$2V,
    __vue_scope_id__$2V,
    __vue_is_functional_template__$2V,
    __vue_module_identifier__$2V,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2U = {
  name: 'BookMarkStudent',
  components: {
    xmlResourceListPc: __vue_component__$35,
    xmlEmpty: __vue_component__$2V
  },
  props: {
    bookmarkList: [],
    location: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      launchValue: ''
    };
  },
  watch: {
    bookmarkList() {
      if (this.launchValue == '' || JSON.stringify(this.bookmarkList).indexOf(this.launchValue) == -1) {
        this.launchValue = this.bookmarkList[0]?.firstLevelId;
      }
    },
    settingData: {
      handler(newValue) {
        this.form = {
          ...this.form,
          ...newValue
        };
      },
      immediate: true,
      deep: true
    }
  },
  mounted() {
    this.launchValue = this.bookmarkList[0]?.firstLevelId;
  },
  methods: {
    deleteBookmarkItem(item) {
      this.$confirm(`确认删除此条书签吗？`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        duration: 1000
      }).then(() => {
        this.$EventBus.$emit('deleteBookmark', item);
      });
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      }
    }
  }
};

var __$_require_static_images_icons_resource_student_bookmark_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAASRJREFUWEftmO1twkAQRGc6SDqghLRAJYQOSAUhHZAO6CDpAKgESqCDCSPZEjH49pDMl7T316u757fns8fEgw0+GA8SKOpI0ZCkTwAzAC/RRJXX9wCWJD/66nuBGph55UKXln2RPDt3CWh7uJvRpStV1u9Jvp6rLQGpcvKaMrfqX9t5UHRPoDGAdwCTFiKBOu1IQ9HGTkNPacjn0FtDviO5vOs5RHIdafT1W53U4wQK2pGGov2ahtJQn4Fd5WfuTfbQN8mZJKcSp5NSMrkqkK1Mj09eSQ4Dq4KtqwH9NjD+aD8ZkhxtbKs7BgcygLPUInqcJPmN/tOxNSjQxomBpFtVNZoW2labMgYBclD0xg2t9FFKcvRxCw1UdUP59yPqeRqKDP0BRLexJdlzdwMAAAAASUVORK5CYII=";

/* script */
const __vue_script__$2U = script$2U;
var __vue_render__$2U = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "bookm-mark-student demo-collapse" },
    [
      _vm.bookmarkList.length == 0
        ? _c("xmlEmpty", { staticClass: "xml-empty" })
        : _vm._e(),
      _vm._v(" "),
      _c(
        "el-collapse",
        {
          staticClass: "pcbookmarkList",
          attrs: { accordion: "" },
          model: {
            value: _vm.launchValue,
            callback: function ($$v) {
              _vm.launchValue = $$v;
            },
            expression: "launchValue",
          },
        },
        _vm._l(_vm.bookmarkList, function (item) {
          return _c(
            "el-collapse-item",
            { key: item.firstLevelId, attrs: { name: item.firstLevelId } },
            [
              _c("template", { slot: "title" }, [
                _c("div", { staticClass: "collapse-title" }, [
                  _vm._v(
                    "\n          " + _vm._s(item.firstLevelLabel) + "\n        "
                  ),
                ]),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "resource-list" }, [
                _c(
                  "div",
                  { staticStyle: { width: "100%" } },
                  [
                    _vm._l(item.list, function (items, index) {
                      return _c(
                        "div",
                        { key: index, staticClass: "xml-teacher-note" },
                        [
                          _c(
                            "div",
                            { staticClass: "xml-note-header delete-btn" },
                            [
                              _c("img", {
                                staticClass: "note-icon",
                                attrs: {
                                  src: __$_require_static_images_icons_resource_student_bookmark_png__,
                                  alt: "",
                                },
                              }),
                              _vm._v(" "),
                              _c("div", {
                                staticClass: "delete-btn-item",
                                on: {
                                  click: function ($event) {
                                    return _vm.deleteBookmarkItem(items)
                                  },
                                },
                              }),
                            ]
                          ),
                          _vm._v(" "),
                          _c(
                            "div",
                            {
                              staticClass: "note-content",
                              attrs: { title: items.bookmarkText },
                              on: {
                                click: function ($event) {
                                  return _vm.$emit("resourceDetails", items)
                                },
                              },
                            },
                            [
                              _vm._v(
                                "\n                " +
                                  _vm._s(_vm.removeStyle(items.bookmarkText)) +
                                  "\n              "
                              ),
                            ]
                          ),
                        ]
                      )
                    }),
                  ],
                  2
                ),
              ]),
            ],
            2
          )
        }),
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2U = [];
__vue_render__$2U._withStripped = true;

  /* style */
  const __vue_inject_styles__$2U = undefined;
  /* scoped */
  const __vue_scope_id__$2U = undefined;
  /* module identifier */
  const __vue_module_identifier__$2U = undefined;
  /* functional template */
  const __vue_is_functional_template__$2U = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2U = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2U, staticRenderFns: __vue_staticRenderFns__$2U },
    __vue_inject_styles__$2U,
    __vue_script__$2U,
    __vue_scope_id__$2U,
    __vue_is_functional_template__$2U,
    __vue_module_identifier__$2U,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2T = {
  name: 'nodeStudent',
  components: {
    xmlResourceListPc: __vue_component__$35,
    xmlEmpty: __vue_component__$2V
  },
  props: {
    nodesList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      show: false,
      expansion: false,
      isContentLong: false,
      isMasked: false,
      exoabsionShowFalse: false,
      exoabsionShow: true,
      launchValue: ''
    };
  },
  watch: {
    nodesList() {
      if (this.launchValue == '' || JSON.stringify(this.nodesList).indexOf(this.launchValue) == -1) {
        this.launchValue = this.nodesList[0]?.firstLevelId;
      }
    },
    settingData: {
      handler(newValue) {
        this.form = {
          ...this.form,
          ...newValue
        };
      },
      immediate: true,
      deep: true
    }
  },
  mounted() {
    this.launchValue = this.nodesList[0]?.firstLevelId;
  },
  methods: {
    toggleExpansion(e) {
      this.expansion = !this.expansion;
      //  e= e.noteContent.split('')
      e = e.split('');
      if (e.length >= 151) {
        this.exoabsionShow = true;
      }
    },
    deleteItem(items) {
      // 删除提示
      this.$confirm(`确认删除此条笔记吗？`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        duration: 1000
      }).then(() => {
        this.$EventBus.$emit('deleteNote', items, () => {});
      }).catch(() => {});
    },
    editNoteStudent(items) {
      this.$EventBus.$emit('editStudentNote', items);
    }
  },
  created() {}
};

/* script */
const __vue_script__$2T = script$2T;
var __vue_render__$2T = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "node-student demo-collapse" },
    [
      _vm.nodesList.length == 0
        ? _c("xmlEmpty", { staticClass: "xml-empty" })
        : _vm._e(),
      _vm._v(" "),
      _c(
        "el-collapse",
        {
          staticClass: "pcnotelist",
          attrs: { accordion: "" },
          model: {
            value: _vm.launchValue,
            callback: function ($$v) {
              _vm.launchValue = $$v;
            },
            expression: "launchValue",
          },
        },
        _vm._l(_vm.nodesList, function (item) {
          return _c(
            "el-collapse-item",
            { key: item.firstLevelId, attrs: { name: item.firstLevelId } },
            [
              _c("template", { slot: "title" }, [
                _c("div", { staticClass: "collapse-title" }, [
                  _vm._v(
                    "\n          " + _vm._s(item.firstLevelLabel) + "\n        "
                  ),
                ]),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "resource-list" }, [
                _c(
                  "div",
                  { staticStyle: { width: "100%" } },
                  [
                    _vm._l(item.list, function (items, index) {
                      return _c(
                        "div",
                        { key: index, staticClass: "xml-teacher-note" },
                        [
                          _c(
                            "div",
                            { staticClass: "xml-note-header delete-btn" },
                            [
                              _c("img", {
                                staticClass: "note-icon",
                                attrs: {
                                  src: __$_require_static_images_icons_resource_note_icon_svg__,
                                  alt: "",
                                },
                              }),
                              _vm._v(" "),
                              _c("div", {
                                staticClass: "delete-btn-item",
                                on: {
                                  click: function ($event) {
                                    return _vm.deleteItem(items)
                                  },
                                },
                              }),
                            ]
                          ),
                          _vm._v(" "),
                          _c(
                            "div",
                            {
                              staticClass:
                                "note-content note-content-studentnode",
                              class: _vm.expansion
                                ? "note-content-studentnodeFlex"
                                : "",
                              on: {
                                click: function ($event) {
                                  $event.stopPropagation();
                                  return _vm.$emit("resourceDetails", items)
                                },
                              },
                            },
                            [
                              _c("xmlTextOverflow", {
                                attrs: { info: items.noteContent },
                              }),
                            ],
                            1
                          ),
                        ]
                      )
                    }),
                  ],
                  2
                ),
              ]),
            ],
            2
          )
        }),
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2T = [];
__vue_render__$2T._withStripped = true;

  /* style */
  const __vue_inject_styles__$2T = undefined;
  /* scoped */
  const __vue_scope_id__$2T = undefined;
  /* module identifier */
  const __vue_module_identifier__$2T = undefined;
  /* functional template */
  const __vue_is_functional_template__$2T = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2T = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2T, staticRenderFns: __vue_staticRenderFns__$2T },
    __vue_inject_styles__$2T,
    __vue_script__$2T,
    __vue_scope_id__$2T,
    __vue_is_functional_template__$2T,
    __vue_module_identifier__$2T,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2S = {
  name: 'highlightStudent',
  components: {
    xmlResourceListPc: __vue_component__$35,
    xmlEmpty: __vue_component__$2V
  },
  props: {
    highlightList: {
      type: Array,
      default: () => []
    },
    type: {
      type: String,
      default: 'highlight'
    }
  },
  data() {
    return {
      launchValue: ''
    };
  },
  watch: {
    highlightList() {
      if (this.launchValue == '' || JSON.stringify(this.highlightList).indexOf(this.launchValue) == -1) {
        this.launchValue = this.highlightList[0]?.firstLevelId;
      }
    },
    settingData: {
      handler(newValue) {
        this.form = {
          ...this.form,
          ...newValue
        };
      },
      immediate: true,
      deep: true
    }
  },
  mounted() {
    this.launchValue = this.highlightList[0]?.firstLevelId;
  },
  methods: {
    deleteHighlightItem(items) {
      this.$confirm(`确认删除此条${this.type == 'highlight' ? '高亮' : '划线'}吗？`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        duration: 1000
      }).then(() => {
        this.$EventBus.$emit(this.type == 'highlight' ? 'deleteHighlight' : 'deleteLink', items, () => {});
      }).catch(() => {});
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      }
    }
  },
  created() {}
};

var __$_require_static_images_icons_resource_student_lighheight_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAAAXNSR0IArs4c6QAAAihJREFUSEvNlkuIjXEYxn9PriU2QogpERsjdlIWrinZWIiysJCFIlFmIRvXmrJwSUlZkCRRKJSFslBDLhuXhbKSGU1pWLgMj/9b36nPzPedOedwvpw6m3Pe8/7+7/t/nud8osKXKmTxf8NsjwKmAr2SfjWzmaYns90BvAY6JPVVAXsLzKgCNgt4DiyQ9LHdk8V9rQHuSOpvC8x2J3AemA+MAX4Aj4Ddkt4MhdqOmkFJrn33h0BsTwLuZU0uAi8lfbO9D+gGbidhXADeZ9A9wCJgo6TrtscCsebjISBglaSBMtjoKAB2AiujCTAXOAmsk3S3YIIu4BiwCfiQ4DeAm0lA54AeST8LYbUPbY8DpgCTgQfACUmHyu7Hdky8OEGWZDX9kgaH1tf1me047ZW0lvGxzjqwAPWkK1gq6UlZ3UiwXUkMRyRNrKc62xOAL8AGSbdahW0GLksa6VBxr5EqMdnjVmHzgFhLt6TDddYYYgjlzam3gdIT214WPgFWAEeB1ZLuF6hxfyb1MPqnLDOvFUGHwTKvnQK2JEWeAfYCB7N3SDp89g6IKbalydfnfLY158MDyTaX8v8MRbBovD0gkq7m7LAWOA1MyxLke/LWK2CHpBe5ukiOs0BEWVdpgsQPbIe/Pkv6WrQK27OB5ZE0VQTx9JQuDzPltT31ZwLPgIWSetuS+rk7CdhToLMKWO0ZpC8fso1M2PQzSCNNW0qQv2nckKn/NSDf7zfsx8Uc87Rk2QAAAABJRU5ErkJggg==";

/* script */
const __vue_script__$2S = script$2S;
var __vue_render__$2S = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "highlight-student demo-collapse" },
    [
      _vm.highlightList.length == 0
        ? _c("xmlEmpty", { staticClass: "xml-empty" })
        : _vm._e(),
      _vm._v(" "),
      _c(
        "el-collapse",
        {
          staticClass: "pcstudenthighlight",
          attrs: { accordion: "" },
          model: {
            value: _vm.launchValue,
            callback: function ($$v) {
              _vm.launchValue = $$v;
            },
            expression: "launchValue",
          },
        },
        _vm._l(_vm.highlightList, function (item) {
          return _c(
            "el-collapse-item",
            { key: item.firstLevelId, attrs: { name: item.firstLevelId } },
            [
              _c("template", { slot: "title" }, [
                _c("div", { staticClass: "collapse-title" }, [
                  _vm._v(
                    "\n          " + _vm._s(item.firstLevelLabel) + "\n        "
                  ),
                ]),
              ]),
              _vm._v(" "),
              _vm._l(item.list, function (items, index) {
                return _c("div", { key: index, staticClass: "resource-list" }, [
                  _c(
                    "div",
                    { staticStyle: { width: "100%" } },
                    [
                      [
                        _c("div", { staticClass: "xml-teacher-note" }, [
                          _c(
                            "div",
                            { staticClass: "xml-note-header delete-btn" },
                            [
                              _c("img", {
                                staticClass: "note-icon",
                                attrs: {
                                  src: __$_require_static_images_icons_resource_student_lighheight_png__,
                                  alt: "",
                                },
                              }),
                              _vm._v(" "),
                              _c("div", {
                                staticClass: "delete-btn-item",
                                on: {
                                  click: function ($event) {
                                    return _vm.deleteHighlightItem(items)
                                  },
                                },
                              }),
                            ]
                          ),
                          _vm._v(" "),
                          _c(
                            "div",
                            {
                              staticClass: "note-content",
                              attrs: { title: items.selectionText },
                              on: {
                                click: function ($event) {
                                  return _vm.$emit("resourceDetails", items)
                                },
                              },
                            },
                            [
                              _c("xmlTextOverflow", {
                                attrs: {
                                  info: _vm.removeStyle(items.selectionText),
                                },
                              }),
                            ],
                            1
                          ),
                        ]),
                      ],
                    ],
                    2
                  ),
                ])
              }),
            ],
            2
          )
        }),
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2S = [];
__vue_render__$2S._withStripped = true;

  /* style */
  const __vue_inject_styles__$2S = undefined;
  /* scoped */
  const __vue_scope_id__$2S = undefined;
  /* module identifier */
  const __vue_module_identifier__$2S = undefined;
  /* functional template */
  const __vue_is_functional_template__$2S = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2S = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2S, staticRenderFns: __vue_staticRenderFns__$2S },
    __vue_inject_styles__$2S,
    __vue_script__$2S,
    __vue_scope_id__$2S,
    __vue_is_functional_template__$2S,
    __vue_module_identifier__$2S,
    false,
    undefined,
    undefined,
    undefined
  );

var utils = {
  each: function (obj, iterator, context) {
    if (obj == null) return;
    if (obj.length === +obj.length) {
      for (var i = 0, l = obj.length; i < l; i++) {
        if (iterator.call(context, obj[i], i, obj) === false) return false;
      }
    } else {
      for (var key in obj) {
        if (obj.hasOwnProperty(key)) {
          if (iterator.call(context, obj[key], key, obj) === false) return false;
        }
      }
    }
  },
  bind: function (fn, context) {
    return function () {
      return fn.apply(context, arguments);
    };
  },
  indexOf: function (array, item, start) {
    var index = -1;
    start = this.isNumber(start) ? start : 0;
    this.each(array, function (v, i) {
      if (i >= start && v === item) {
        index = i;
        return false;
      }
    });
    return index;
  },
  trim: function (str) {
    return str.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, "");
  },
  listToMap: function (list) {
    if (!list) return {};
    list = utils.isArray(list) ? list : list.split(",");
    for (var i = 0, ci, obj = {}; ci = list[i++];) {
      obj[ci.toUpperCase()] = obj[ci] = 1;
    }
    return obj;
  },
  cssStyleToDomStyle: function () {
    var test = document.createElement("div").style,
      cache = {
        float: test.cssFloat != undefined ? "cssFloat" : test.styleFloat != undefined ? "styleFloat" : "float"
      };
    return function (cssName) {
      return cache[cssName] || (cache[cssName] = cssName.toLowerCase().replace(/-./g, function (match) {
        return match.charAt(1).toUpperCase();
      }));
    };
  }(),
  /**
     * 把rgb格式的颜色值转换成16进制格式
     * @method fixColor
     * @param { String } rgb格式的颜色值
     * @param { String }
     * @example
     * rgb(255,255,255)  => "#ffffff"
     */
  fixColor: function (name, value) {
    if (/color/i.test(name) && /rgba?/.test(value)) {
      var array = value.split(",");
      if (array.length > 3) return "";
      value = "#";
      for (var i = 0, color; color = array[i++];) {
        color = parseInt(color.replace(/[^\d]/gi, ""), 10).toString(16);
        value += color.length == 1 ? "0" + color : color;
      }
      value = value.toUpperCase();
    }
    return value;
  },
  transUnitToPx: function (val) {
    if (!/(pt|cm)/.test(val)) {
      return val;
    }
    var unit;
    val.replace(/([\d.]+)(\w+)/, function (str, v, u) {
      val = v;
      unit = u;
    });
    switch (unit) {
      case "cm":
        val = parseFloat(val) * 25;
        break;
      case "pt":
        val = Math.round(parseFloat(val) * 96 / 72);
    }
    return val + (val ? "px" : "");
  }
};
utils.each(["String", "Function", "Array", "Number", "RegExp", "Object", "Date"], function (v) {
  utils["is" + v] = function (obj) {
    return Object.prototype.toString.apply(obj) == "[object " + v + "]";
  };
});

// 格式化日期
const formatDate = function (date, format = 'YYYY-MM-DD HH:mm:ss') {
  // if (!this.isDate(date)) date = new Date(date);
  date = new Date(date);
  const pad = n => n < 10 ? '0' + n : n;
  return format.replace(/YYYY|MM|DD|HH|mm|ss/g, match => {
    switch (match) {
      case 'YYYY':
        return date.getFullYear();
      case 'MM':
        return pad(date.getMonth() + 1);
      case 'DD':
        return pad(date.getDate());
      case 'HH':
        return pad(date.getHours());
      case 'mm':
        return pad(date.getMinutes());
      case 'ss':
        return pad(date.getSeconds());
      default:
        return match;
    }
  });
};

//
var script$2R = {
  name: 'tableStudent',
  components: {
    xmlResourceListPc: __vue_component__$35,
    xmlEmpty: __vue_component__$2V
  },
  props: {
    tableList: {
      type: Array,
      default: () => []
    },
    type: {
      type: String,
      default: 'highlight'
    }
  },
  data() {
    return {
      launchValue: '',
      showTable: false,
      showDialog: false,
      tableData: {
        tableList: []
      }
    };
  },
  watch: {
    tableList() {
      if (this.launchValue == '' || JSON.stringify(this.tableList).indexOf(this.launchValue) == -1) {
        this.launchValue = this.tableList[0]?.firstLevelId;
      }
    },
    settingData: {
      handler(newValue) {
        this.form = {
          ...this.form,
          ...newValue
        };
      },
      immediate: true,
      deep: true
    }
  },
  mounted() {
    this.launchValue = this.tableList[0]?.firstLevelId;
  },
  methods: {
    deleteTableItem(items) {
      this.$confirm(`确认删除此条表格记录吗？`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        duration: 1000
      }).then(() => {
        this.$EventBus.$emit('deleteTableItem', items, () => {});
      }).catch(() => {});
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      }
    },
    formatDate(time, format) {
      return formatDate(time, format);
    },
    resourceDetails(items) {
      this.showTable = false;
      this.tableData.tableList[0] = items;
      this.tableData.tableList[0].tableInfo.isCanSubmit = 'false';
      setTimeout(() => {
        this.showTable = true;
        this.showDialog = true;
      }, 100);
    }
  },
  created() {}
};

var __$_require_static_images_icons_resource_table_first_level_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAsVJREFUWEfNlz9sUlEUxr/7iggKCWBowMFCwK2JNbFuJq0mjU64GAcH7djJatwcpDE6GcXJUUaTLq2LSRNTE6ZGkzK0Li19tImioFBtLZZCrzmXQuDx4MHjn3fice8553e+c++57zEoxlqCj0kM1yUDAuDwKOd1PkfBEUUBM143i1f6YKUHWeY2WPAIwLTOIM2ahWDAjNfOtslAAIjgJ7EIhpFmvbS5LgoDxgmiCJDiL3qQuZI55HWye0xOcA8MkNvMSJd5Po9xtvGdh5mE27o8tGl0yPGSySm+DPSs9tXIHHEC4MpE0rsFvHr3s25+fpcRNy/ZyvO0lmwajYc3BlWn6wI8nU3W9edzGTF17VR5/slsEhkNgGeTbn0AgYtWmIySMF7Z+ovVrX0oAVY2s8jmaoSsCjh69oQ+AJLObhkQxgvLO1iI7tYAtLMXNUvQd4DJKw6YjMWO/WltDx/Xs71VQE1e5R7oagn6AtBqRh0/hv8NADWXyOoffEkfCCY6yxf85hq+WGJfk9nnPt58HxA7fj2L+aVfNQ3GYRkQXbDUGzQjayxQ7QOU+fP5lAhOgUb9ZtHrCYpG109BqeNR8PsBJ8xHfYBacfh9RkA8vuUq/9+OCqoKvIlsi2wp88pbjwI9eJ0Q8aauOlCvrq0AqQJQ7SOf92qkptLQkaNBypx2GMTvr+k8srnDhnGpbGpDFSD2LVd+H5g4b8XwGZMI8HbptzgRVJrK+70rfaBUBjXqO5ftGB4ylafaAthI8TgDhtQC0Waky6f0skEyToxYOlL7o3hRFkvykMRwt1EBMzt5MW23FmvescEQpj0wBmCxY05bcWSAV1z0sR88JPHGKrTit5m19EruG2TTxS+jDLchL1Toz6dZCeKwgGC3laDMpWMIVn2cVkomZ7iHHyBIajCGc83IqbWGA5ucY05imPM62YfK9f8AIMuCLDq1VNUAAAAASUVORK5CYII=";

var __$_require_static_images_icons_resource_table_time_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAaNJREFUWEftV71OwlAU/s6lTjKACSRMtvEB9BHgCXRxNj6BmDjpIAw6mVifQHYW3gDfwO4GihMRjDC4CRxzS0hqbbk35achodvNOd/5vvOd2/ZeQuB563JREE6EgWMwzGA85toBw8EYVatAHX8Nmi1clzNI4xZAOSaJLsyGgaqVpaEEeAI88l00QTjSrbJgngMDJSliKqDPj2voPKjZtnJ0SW6XTRhwF+woFnw0QonaH1wjgbNYFRYETRhP5Pb5FdCb/dVz16N8OC+EUqvi/0CMjhTAuo2oCFTxMJ5IAff1Hr6+x7ra5ubtpVO4Ps2H5kQKmHWzFAVzxqYU4J+3yuKwuAqzWQLijGOpDiQiIA5pGCbq26HcA4kLiFKuK2zz98DWga0DWwd033dVXuSXsN3nDgH7wQJ39R4GSzqQZNMp3IQfSBxq9dgWhAtVByuJE2ryX1AE0FwJgaqoAcu7mLQ+2Ra8XhfkkfwgT+XpzWjAGYw8F5K5ms1ETMaorNoJ2bnYQeXP5dQ/KnfAJv+gIt0gwqFqjDpxBt6Z0RCEhpWjFz/mF7WtHCxbzu8EAAAAAElFTkSuQmCC";

/* script */
const __vue_script__$2R = script$2R;
var __vue_render__$2R = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "highlight-student demo-collapse" },
    [
      _vm.tableList.length == 0
        ? _c("xmlEmpty", { staticClass: "xml-empty" })
        : _vm._e(),
      _vm._v(" "),
      _c(
        "el-collapse",
        {
          staticClass: "pcstudenthighlight",
          attrs: { accordion: "" },
          model: {
            value: _vm.launchValue,
            callback: function ($$v) {
              _vm.launchValue = $$v;
            },
            expression: "launchValue",
          },
        },
        _vm._l(_vm.tableList, function (item) {
          return _c(
            "el-collapse-item",
            { key: item.firstLevelId, attrs: { name: item.firstLevelId } },
            [
              _c("template", { slot: "title" }, [
                _c("div", { staticClass: "collapse-title" }, [
                  _vm._v(
                    "\n          " + _vm._s(item.firstLevelLabel) + "\n        "
                  ),
                ]),
              ]),
              _vm._v(" "),
              _vm._l(item.list, function (items, index) {
                return _c("div", { key: index, staticClass: "resource-list" }, [
                  _c(
                    "div",
                    { staticStyle: { width: "100%" } },
                    [
                      [
                        _c("div", { staticClass: "xml-teacher-note" }, [
                          _c(
                            "div",
                            { staticClass: "xml-note-header delete-btn" },
                            [
                              _c("img", {
                                staticClass: "note-icon",
                                attrs: {
                                  src: __$_require_static_images_icons_resource_student_lighheight_png__,
                                  alt: "",
                                },
                              }),
                              _vm._v(" "),
                              _c("div", {
                                staticClass: "delete-btn-item",
                                on: {
                                  click: function ($event) {
                                    return _vm.deleteTableItem(items)
                                  },
                                },
                              }),
                            ]
                          ),
                          _vm._v(" "),
                          _c(
                            "div",
                            {
                              staticClass: "note-content",
                              attrs: { title: items.selectionText },
                              on: {
                                click: function ($event) {
                                  return _vm.resourceDetails(items)
                                },
                              },
                            },
                            [
                              _c("div", { staticClass: "table-info" }, [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_table_first_level_png__,
                                    alt: "",
                                  },
                                }),
                                _vm._v(
                                  "\n                    " +
                                    _vm._s(items.tableInfo.tableTitle)
                                ),
                              ]),
                              _vm._v(" "),
                              _c("div", { staticClass: "table-info" }, [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_resource_table_time_png__,
                                    alt: "",
                                  },
                                }),
                                _vm._v(
                                  "\n                    " +
                                    _vm._s(
                                      _vm.formatDate(
                                        items.createTime,
                                        "YYYY-MM-DD HH:mm"
                                      )
                                    )
                                ),
                              ]),
                            ]
                          ),
                        ]),
                      ],
                    ],
                    2
                  ),
                ])
              }),
            ],
            2
          )
        }),
        1
      ),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          attrs: {
            visible: _vm.showDialog,
            width: "1000px",
            "z-index": "1000",
            "show-close": false,
          },
          on: {
            "update:visible": function ($event) {
              _vm.showDialog = $event;
            },
          },
        },
        [
          _vm.showTable
            ? _c(
                "div",
                [
                  _c("xml-table-render", {
                    attrs: { mode: "preview", "p-block-data": _vm.tableData },
                  }),
                ],
                1
              )
            : _vm._e(),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2R = [];
__vue_render__$2R._withStripped = true;

  /* style */
  const __vue_inject_styles__$2R = undefined;
  /* scoped */
  const __vue_scope_id__$2R = undefined;
  /* module identifier */
  const __vue_module_identifier__$2R = undefined;
  /* functional template */
  const __vue_is_functional_template__$2R = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2R = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2R, staticRenderFns: __vue_staticRenderFns__$2R },
    __vue_inject_styles__$2R,
    __vue_script__$2R,
    __vue_scope_id__$2R,
    __vue_is_functional_template__$2R,
    __vue_module_identifier__$2R,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2Q = {
  name: 'PreviewLeftStudent',
  data() {
    return {
      GkActiveName: 'catalogue',
      activeName: 'fourth',
      data: {
        notes: {
          list: []
        },
        bookmark: {
          list: []
        },
        highlight: {
          list: []
        },
        resources: {
          list: []
        }
      },
      businessType: 'textBook',
      selectId: '',
      PreviewCatalog: false,
      textBookList: [],
      scrollTop: 0,
      catalogLists: [],
      suptablist: [{
        name: '目录'
      }, {
        name: '资源'
      }],
      cursuptab: 0
    };
  },
  components: {
    PreviewCatalog: __vue_component__$2W,
    BookMarkStudent: __vue_component__$2U,
    nodeStudent: __vue_component__$2T,
    highlightStudent: __vue_component__$2S,
    tableStudent: __vue_component__$2R
  },
  props: {
    textBookId: String,
    catalogList: Array,
    location: {
      type: String,
      default: ''
    },
    deleteNote: {
      type: Function,
      default: () => {}
    },
    editNote: {
      type: Function,
      default: () => {}
    },
    deleteBookmark: {
      type: Function,
      default: () => {}
    },
    deleteHighlight: {
      type: Function,
      default: () => {}
    },
    sysEnv: {
      type: Object,
      default: () => {}
    },
    userType: {
      type: String,
      default: 'student'
    },
    pageType: {
      //页面类型：取值h5、pc、pad
      type: String,
      default: 'h5'
    },
    styleType: {
      //阅读风格
      type: String,
      default: 'A'
    },
    textBookId: {
      //数字教材Id
      type: String,
      default: ''
    },
    checkedId: {
      type: String,
      default: ''
    },
    looseLeafData: Object,
    //所有活页信息
    resourcesList: {
      type: Array,
      default: () => []
    },
    textBookName: {
      type: String,
      default: ''
    },
    notesList: {
      type: Array,
      default: () => []
    },
    highlightList: {
      type: Array,
      default: () => []
    },
    linkList: {
      type: Array,
      default: () => []
    },
    bookmarkList: {
      type: Array,
      default: () => []
    },
    tableList: {
      type: Array,
      default: () => []
    },
    componentList: {
      type: Array,
      default: () => []
    },
    isTrial: {
      type: Boolean,
      default: false
    },
    readableChapters: {
      //可以阅读的章节
      type: Array,
      default: () => []
    }
  },
  computed: {
    teacherResourcesList() {
      this.textBookResource.teachingResourceTotal = 0;
      let list = this.resourcesList;
      list.sort(this.sortBy('chapterOrderNum', 1));
      const map = [];
      list.forEach(e => {
        if (e.type == 'note__teacher') {
          this.teacherNoteList.push(e);
        }
        if (e.isStudentShow != 1 || this.userType == 'teacher') {
          this.textBookResource.teachingResourceTotal += 1;
          const findObj = map.find(innerTmp => innerTmp.firstLevelId === e.firstLevelId);
          if (findObj) {
            findObj.list.push(e);
          } else {
            map.push({
              firstLevelId: e.firstLevelId,
              firstLevelLabel: e.firstLevelLabel,
              chapterOrderNum: e.chapterOrderNum,
              list: [e]
            });
          }
        }
      });
      return map;
    }
  },
  watch: {
    catalogList: {
      handler(newValue) {
        if (this.catalogLists.length > 0) {
          this.currentNodeKey = this.catalogLists[0].id;
        }
      },
      immediate: true
    }
  },
  mounted() {
    const origin = this.catalogList;
    let _this = this;
    const filterMenu = menuList => {
      return menuList.filter(item => {
        return item.hiddenFlag !== '1';
      }).map(item => {
        item = Object.assign({}, item);
        if (item.children?.length) {
          item.children = filterMenu(item.children);
        }
        return item;
      });
    };
    this.catalogLists = filterMenu(origin), setTimeout(() => {
      if (this.catalogLists.length > 0) {
        this.currentNodeKey = this.catalogLists[0].id;
      }
    }, 500);
    this.$nextTick(() => {
      let height = document.getElementById('textBookName').clientHeight;
      let Dom = document.getElementById('preview-left-student').getElementsByClassName('el-tabs__header');
      if (Dom) {
        Dom[0].style.top = height + 'px';
      }
      this.$EventBus.$on('openStudentResourceList', function (data) {
        _this.GkActiveName = data.activeName;
        _this.refs.tableStudent.launchValue = data.firstLevelId;
      });
    });
  },
  methods: {
    // 目录跳转指定章节
    catalogClick(obj) {
      this.$emit('onNodeClick', obj);
    },
    resourceDetails(items, maxTop) {
      console.log('🚀 ~ resourceDetails ~ items:', items);
      let list = items.location.split('/');
      let selectorId = `${list[2]}_#_${items.markEfiCode}`;
      let data = {
        location: items.location,
        maxTop: maxTop ? maxTop : -30,
        type: 'marker',
        selectorType: 'id',
        selectorId,
        markTarget: items,
        classIndex: 0
      };
      this.$emit('resourceDetails', data);
    }
  }
};

/* script */
const __vue_script__$2Q = script$2Q;
/* template */
var __vue_render__$2Q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "preview-left-student",
      attrs: { id: "preview-left-student" },
    },
    [
      _vm.sysEnv.isGuoKai
        ? [
            _c("div", { staticClass: "xml-text-book-name" }, [
              _c(
                "div",
                {
                  staticClass: "text-book-name",
                  attrs: { id: "textBookName" },
                },
                [
                  _c("span", [
                    _vm._v(
                      _vm._s(_vm.textBookName ? _vm.textBookName : "未选择教材")
                    ),
                  ]),
                ]
              ),
            ]),
            _vm._v(" "),
            _c(
              "div",
              [
                _vm.userType == "student"
                  ? _c(
                      "el-tabs",
                      {
                        model: {
                          value: _vm.GkActiveName,
                          callback: function ($$v) {
                            _vm.GkActiveName = $$v;
                          },
                          expression: "GkActiveName",
                        },
                      },
                      [
                        _c(
                          "el-tab-pane",
                          { attrs: { label: "目录", name: "catalogue" } },
                          [
                            _vm.businessType === "textBook"
                              ? _c("xml-preview-catalog", {
                                  ref: "xmlPreviewCatalog",
                                  staticClass:
                                    "pc-catalog pc-catalog--render pc-student-catalog pc-student-left",
                                  attrs: {
                                    "page-type": _vm.pageType,
                                    "style-type": _vm.styleType,
                                    "text-book-id": _vm.textBookId,
                                    "catalog-list": _vm.catalogList,
                                    userType: _vm.userType,
                                    notesList: _vm.notesList,
                                    checkedId: _vm.checkedId,
                                    PreviewCatalog: _vm.PreviewCatalog,
                                    textBookName: _vm.textBookName,
                                    sysEnv: _vm.sysEnv,
                                    componentList: _vm.componentList,
                                    isTrial: _vm.isTrial,
                                    readableChapters: _vm.readableChapters,
                                  },
                                  on: { onNodeClick: _vm.catalogClick },
                                })
                              : _vm._e(),
                          ],
                          1
                        ),
                        _vm._v(" "),
                        _c(
                          "el-tab-pane",
                          { attrs: { label: "书签", name: "first" } },
                          [
                            _c("book-mark-student", {
                              attrs: { bookmarkList: _vm.bookmarkList },
                              on: {
                                deleteBookmark: _vm.deleteBookmark,
                                resourceDetails: function (e) {
                                  return _vm.resourceDetails(e, 0)
                                },
                              },
                            }),
                          ],
                          1
                        ),
                        _vm._v(" "),
                        _c(
                          "el-tab-pane",
                          { attrs: { label: "笔记", name: "second" } },
                          [
                            _c("node-student", {
                              attrs: { nodesList: _vm.notesList },
                              on: {
                                deleteNote: _vm.deleteNote,
                                editNote: function ($event) {
                                  _vm.$emit("editNote", function (e) {
                                    return e
                                  });
                                },
                                resourceDetails: _vm.resourceDetails,
                              },
                            }),
                          ],
                          1
                        ),
                        _vm._v(" "),
                        _c(
                          "el-tab-pane",
                          { attrs: { label: "划线", name: "four" } },
                          [
                            _c("highlight-student", {
                              attrs: {
                                type: "link",
                                highlightList: _vm.linkList,
                              },
                              on: {
                                deleteHighlight: _vm.deleteHighlight,
                                resourceDetails: _vm.resourceDetails,
                              },
                            }),
                          ],
                          1
                        ),
                        _vm._v(" "),
                        _c(
                          "el-tab-pane",
                          { attrs: { label: "高亮", name: "third" } },
                          [
                            _c("highlight-student", {
                              attrs: { highlightList: _vm.highlightList },
                              on: {
                                deleteHighlight: _vm.deleteHighlight,
                                resourceDetails: _vm.resourceDetails,
                              },
                            }),
                          ],
                          1
                        ),
                        _vm._v(" "),
                        _c(
                          "el-tab-pane",
                          { attrs: { label: "记录", name: "record" } },
                          [
                            _c("table-student", {
                              ref: "tableStudent",
                              attrs: { tableList: _vm.tableList },
                              on: { resourceDetails: _vm.resourceDetails },
                            }),
                          ],
                          1
                        ),
                      ],
                      1
                    )
                  : _vm._e(),
              ],
              1
            ),
          ]
        : [
            _c("div", { staticClass: "xml-text-book-name" }, [
              _c(
                "div",
                {
                  staticClass: "text-book-name",
                  attrs: { id: "textBookName" },
                },
                [
                  _c("span", [
                    _vm._v(
                      _vm._s(_vm.textBookName ? _vm.textBookName : "未选择教材")
                    ),
                  ]),
                ]
              ),
            ]),
            _vm._v(" "),
            _c(
              "el-tabs",
              {
                staticClass: "demo-tabs Preview-left-student",
                attrs: {
                  type: _vm.sysEnv.isHuaTeng ? "card" : "",
                  userType: _vm.userType,
                },
                model: {
                  value: _vm.activeName,
                  callback: function ($$v) {
                    _vm.activeName = $$v;
                  },
                  expression: "activeName",
                },
              },
              [
                _c(
                  "el-tab-pane",
                  { attrs: { label: "目录", name: "fourth" } },
                  [
                    _vm.businessType === "textBook"
                      ? _c("xml-preview-catalog", {
                          ref: "xmlPreviewCatalog",
                          staticClass:
                            "pc-catalog pc-catalog--render pc-student-catalog pc-student-left",
                          attrs: {
                            "page-type": _vm.pageType,
                            "style-type": _vm.styleType,
                            "text-book-id": _vm.textBookId,
                            "catalog-list": _vm.catalogList,
                            userType: _vm.userType,
                            notesList: _vm.notesList,
                            checkedId: _vm.checkedId,
                            PreviewCatalog: _vm.PreviewCatalog,
                            textBookName: _vm.textBookName,
                            sysEnv: _vm.sysEnv,
                            componentList: _vm.componentList,
                            isTrial: _vm.isTrial,
                            readableChapters: _vm.readableChapters,
                          },
                          on: { onNodeClick: _vm.catalogClick },
                        })
                      : _vm._e(),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "el-tab-pane",
                  { attrs: { label: "书签", name: "first" } },
                  [
                    _c("book-mark-student", {
                      attrs: { bookmarkList: _vm.bookmarkList },
                      on: {
                        deleteBookmark: _vm.deleteBookmark,
                        resourceDetails: function (e) {
                          return _vm.resourceDetails(e, 0)
                        },
                      },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "el-tab-pane",
                  { attrs: { label: "笔记", name: "second" } },
                  [
                    _c("node-student", {
                      attrs: { nodesList: _vm.notesList },
                      on: {
                        deleteNote: _vm.deleteNote,
                        editNote: function ($event) {
                          _vm.$emit("editNote", function (e) {
                            return e
                          });
                        },
                        resourceDetails: _vm.resourceDetails,
                      },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "el-tab-pane",
                  { attrs: { label: "高亮", name: "third" } },
                  [
                    _c("highlight-student", {
                      attrs: { highlightList: _vm.highlightList },
                      on: {
                        deleteHighlight: _vm.deleteHighlight,
                        resourceDetails: _vm.resourceDetails,
                      },
                    }),
                  ],
                  1
                ),
              ],
              1
            ),
          ],
    ],
    2
  )
};
var __vue_staticRenderFns__$2Q = [];
__vue_render__$2Q._withStripped = true;

  /* style */
  const __vue_inject_styles__$2Q = undefined;
  /* scoped */
  const __vue_scope_id__$2Q = undefined;
  /* module identifier */
  const __vue_module_identifier__$2Q = undefined;
  /* functional template */
  const __vue_is_functional_template__$2Q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2Q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2Q, staticRenderFns: __vue_staticRenderFns__$2Q },
    __vue_inject_styles__$2Q,
    __vue_script__$2Q,
    __vue_scope_id__$2Q,
    __vue_is_functional_template__$2Q,
    __vue_module_identifier__$2Q,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$2P = {
  name: 'xmlStatisticalChart',
  props: {
    pageType: {
      type: String,
      default: 'h5'
    },
    userType: {
      type: String,
      default: 'teacher'
      // default: 'student'
    },
    teacherDate: {
      type: Object,
      default: () => {
        return {
          nickname: '',
          //名字
          className: '',
          //默认班级
          img: '',
          //头像
          totalLearnTime: '3000',
          //授课时长
          learnNum: '6',
          //授课次数
          learningProgress: '30',
          //学习进度
          thisLearnTime: '10',
          //本次授课时长
          studentList: [{
            nickname: '1',
            //名字
            className: 'className',
            //默认班级
            img: 'https://img0.baidu.com/it/u=2191392668,814349101&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1399',
            //头像
            learnTime: '',
            //本次学习时长
            totalLearnTime: '1000',
            //学习总时长
            learnNum: '20',
            //学习次数
            learningProgress: '10',
            //学习进度
            chapterNum: '',
            //本次学习章节数量
            learnChapter: 0,
            //总学习章节
            noteNum: '',
            //笔记数量
            bookmarkNum: '',
            //书签数量
            lineationNum: '',
            //划线数量

            imgLearnNum: 10,
            //图片学习次数
            musicTime: 200,
            //音频学习时长
            videoTime: 30,
            //视频学习时长
            completionRate: 20,
            //试题完成率
            accuracy: 60,
            //试题正确率

            imageNum: 10,
            //学习图片个数
            testNum: 10,
            //试题学习个数
            musicNum: 10,
            //音频学习个数
            videoNum: 10 //视频学习个数
          }] //班级学员
        };
      }
    },
    studentDate: {
      type: Object,
      default: () => {
        return {
          nickname: '1',
          //名字
          className: 'className',
          //默认班级
          img: 'https://img0.baidu.com/it/u=2191392668,814349101&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1399',
          //头像
          learnTime: '600',
          //本次学习时长
          totalLearnTime: '1000',
          //学习总时长
          learnNum: '20',
          //学习次数
          learningProgress: '10',
          //学习进度
          chapterNum: '1',
          //本次学习章节数量
          learnChapter: 0,
          //总学习章节
          noteNum: '20',
          //笔记数量
          bookmarkNum: '10',
          //书签数量
          lineationNum: '22',
          //划线数量

          imgLearnNum: 10,
          //图片学习次数
          musicTime: 200,
          //音频学习时长
          videoTime: 30,
          //视频学习时长
          completionRate: 20,
          //试题完成率
          accuracy: 60,
          //试题正确率

          imageNum: 10,
          //学习图片个数
          testNum: 10,
          //试题学习个数
          musicNum: 10,
          //音频学习个数
          videoNum: 10 //视频学习个数
        };
      }
    },
    userInfoparms: {
      type: Object,
      default: () => {
        return {
          img: 'https://img0.baidu.com/it/u=2191392668,814349101&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1399',
          //头像
          nickname: 'nickname' //
        };
      }
    },
    teacherDateclass: {
      type: Array,
      default: () => [{
        title: '班级1',
        value: '班级1'
      }, {
        title: '班级2',
        value: '班级2'
      }, {
        title: '班级3',
        value: '班级3'
      }, {
        title: '班级4',
        value: '班级4'
      }]
    },
    textBookResource: {
      type: Object,
      default: () => {}
    },
    sysEnv: {
      type: Object,
      default: () => {}
    },
    isShowTeacherResource: {
      type: Boolean,
      default: false
    },
    learnTime: {
      type: Number,
      default: 0
    }
  },
  watch: {
    teacherDate() {
      // console.log('切换班级：teacherDate数据变动')
      if (this.teacherDate.studentList?.length > 0) {
        this.total = this.teacherDate.studentList.length;
        this.select_item = this.teacherDate.studentList[0] || {};
        // this.tableData = this.teacherDate.studentList.slice(this.page * 7, 7) || []
        // this.tableTemp = this.teacherDate.studentList
        // this.tableData = this.tableTemp.slice(this.currentPage * 5, 5) || []
        this.filterTable();
      } else {
        this.total = 0;
        this.select_item = {};
        this.tableData = [];
      }
    },
    teacherDateclass() {
      if (this.teacherDateclass.length > 0) {
        this.classValue = this.teacherDateclass[0].title;
      } else {
        this.classValue = '';
      }
    },
    textBookResource(newValue) {
      this.getToolbarList();
    }
  },
  mounted() {
    this.teacherDateclass = [{
      title: '班级1',
      value: '班级1'
    }, {
      title: '班级2',
      value: '班级2'
    }, {
      title: '班级3',
      value: '班级3'
    }, {
      title: '班级4',
      value: '班级4'
    }];
    // this.getToolbarList()
    if (this.teacherDate?.studentList?.length > 0) {
      this.total = this.teacherDate.studentList?.length;
      this.select_item = this.teacherDate.studentList[0] || {};
      // this.tableData = this.teacherDate.studentList.slice(this.page * 7, 7)
      // this.tableTemp = this.teacherDate.studentList
      // this.tableData = this.teacherDate.studentList.slice(this.currentPage * 5, 5)
      // this.tableTemp = this.teacherDate.studentList.sort((a, b) => {
      //   return b.totalLearnTime - a.totalLearnTime
      // })
      // this.tableData = this.tableTemp.slice((this.currentPage - 1) * 5, this.currentPage * 5)
      // console.log(this.teacherDate.studentList,'this.teacherDate.studentList mounted');
    }
    if (this.teacherDateclass.length > 0) {
      this.classValue = this.teacherDateclass[0].title;
    }
  },
  data() {
    return {
      toolbarList: [],
      totalList: [],
      musicAllNum: 0,
      //音频总数
      videoAllNum: 0,
      //视频总数
      imageAllNum: 0,
      //图片总数
      testAllNum: 0,
      //试题总数
      // studentDate: {
      //   nickname: '1', //名字
      //   className: 'className', //默认班级
      //   img: 'https://img0.baidu.com/it/u=2191392668,814349101&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1399', //头像
      //   learnTime: '600', //本次学习时长
      //   totalLearnTime: '1000', //学习总时长
      //   learnNum: '20', //学习次数
      //   learningProgress: '10', //学习进度
      //   chapterNum: '1', //本次学习章节数量
      //   learnChapter: 10, //总学习章节
      //   noteNum: '20', //笔记数量
      //   bookmarkNum: '10', //书签数量
      //   lineationNum: '22', //划线数量

      //   imgLearnNum: 10, //图片学习次数
      //   musicTime: 200, //音频学习时长
      //   videoTime: 300, //视频学习时长
      //   answersNum: 40, //试题完成个数
      //   completionRate: 20, //试题完成率
      //   accuracy: 60, //试题正确率

      //   imageNum: 10, //学习图片个数
      //   testNum: 10, //试题学习个数
      //   musicNum: 10, //音频学习个数
      //   videoNum: 10, //视频学习个数
      // },
      // teacherDate: {
      //   nickname: '', //名字
      //   className: '', //默认班级
      //   img: '', //头像
      //   totalLearnTime: '3000', //授课时长
      //   learnNum: '6', //授课次数
      //   learningProgress: '30', //学习进度
      //   thisLearnTime: '10', //本次授课时长
      //   studentList: [
      //     {
      //       nickname: '1', //名字
      //       className: 'className', //默认班级
      //       img: 'https://img0.baidu.com/it/u=2191392668,814349101&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1399', //头像
      //       learnTime: '500', //本次学习时长
      //       totalLearnTime: '1000', //学习总时长
      //       learnNum: '20', //学习次数
      //       learningProgress: '10', //学习进度
      //       chapterNum: '1', //本次学习章节数量
      //       learnChapter: 0, //总学习章节
      //       noteNum: '1', //笔记数量
      //       bookmarkNum: '2', //书签数量
      //       lineationNum: '3', //划线数量

      //       imgLearnNum: 10, //图片学习次数
      //       musicTime: 200, //音频学习时长
      //       videoTime: 30, //视频学习时长
      //       answersNum: 40, //试题完成个数
      //       completionRate: 20, //试题完成率
      //       accuracy: 60, //试题正确率

      //       imageNum: 10, //学习图片个数
      //       testNum: 10, //试题学习个数
      //       musicNum: 10, //音频学习个数
      //       videoNum: 10, //视频学习个数
      //     }
      //   ] //班级学员
      // },
      dialogVisible: false,
      select_index: '',
      select_item: {},
      visible: false,
      tableData: [],
      tableTemp: [],
      total: 0,
      page: 0,
      size: 7,
      classValue: '',
      showFilter: 0,
      //当前筛选 0时间,1进度
      showDesc: false,
      //false为降序，true为升序
      currentPage: 1 //分页器当前页码
    };
  },
  methods: {
    isType(type) {
      for (let i = 0; i < this.totalList.length; i++) {
        if (this.totalList[i].type == type) {
          return this.totalList[i].total;
        }
      }
    },
    getToolbarList() {
      this.toolbarList = [];
      this.sysEnv.toolbarList.map(item => {
        if (this.isShowTool(item.total)) {
          this.toolbarList.push(item);
        }
      });
      if (!this.isShowTeacherResource && this.userType != 'teacher') {
        this.toolbarList.splice(1, 1);
      }
      for (let i = 0; i < this.toolbarList.length; i++) {
        this.getResourceNum(this.toolbarList[i].total);
      }
    },
    getResourceNum(type) {
      let total = this.textBookResource[type];
      if (total == undefined) {
        total = type;
      }
      this.totalList.push({
        type: type,
        total: total
      });
      if (type == 'questionTotal') {
        this.testAllNum = total;
      } else if (type == 'audioTotal') {
        this.musicAllNum = total;
      } else if (type == 'videoTotal') {
        this.videoAllNum = total;
      } else if (type == 'imageTotal') {
        this.imageAllNum = total;
      }
      // console.log(type, total, this.totalList,this.textBookResource, '资源总数')
    },
    isShowTool(type) {
      let list = ['none', 'teachingResourceTotal'];
      let show = true;
      let total = this.textBookResource[type];
      if (total == undefined) {
        total = type;
      }
      if (Number(total) == 0 && this.sysEnv.dynamicToolbar && !list.includes(type)) {
        show = false;
      }
      return show;
    },
    changeTime(time) {
      let date = (time / 60 / 60).toFixed(1);
      if (date == '0.0') {
        return 0;
      } else {
        return Number(date);
      }
    },
    open() {
      this.dialogVisible = true;
      if (this.userType == 'teacher') {
        this.filterTable();
      }

      // this.tableData = this.tableTemp.slice((this.currentPage - 1) * 5, this.currentPage * 5)
    },
    getbox(item, index) {
      this.select_index = index;
      this.select_item = item || {};
    },
    //分页
    gettableData(type) {
      if (type == 'next' && this.total > this.page + 1) {
        this.page++;
      } else if (type == 'up' && this.page > 0) {
        this.page--;
      }
      this.tableData = this.teacherDate.studentList.slice(this.page * 7, (this.page + 1) * 7);
      this.select_item = this.tableData[0] || {};
      this.select_index = 0;
      // let data = JSON.parse(JSON.stringify(this.teacherDate.studentList))
      // this.tableData = data.splice((this.page - 1) * this.size, this.size)
      // this.total = this.teacherDate.studentList.length
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.tableData = this.tableTemp.slice((this.currentPage - 1) * 5, this.currentPage * 5);
    },
    handleSizeChange(val) {},
    // 计算百分比
    getNumber(val, num) {
      return val / num * 100 || 0;
    },
    getNumbers(val, num) {
      // console.log(val, num, '完成率')
      if (val && num && num != 0) {
        return (val / num * 100).toFixed(1) || 0;
      } else {
        return 0;
      }
    },
    // 更改筛选
    changeFilter(i) {
      if (this.showFilter == i) {
        this.showDesc = !this.showDesc;
      } else {
        this.showDesc = false;
      }
      this.showFilter = i;
      this.filterTable();
    },
    // 表格筛选
    filterTable() {
      this.tableTemp = [];
      this.tableData = [];
      console.log(this.showFilter, this.showDesc, this.teacherDate.studentList, 'this.showFilterthis.showFilter');
      if (this.showFilter == 0) {
        //时间排序
        if (this.showDesc) {
          this.tableTemp = this.teacherDate.studentList?.sort((a, b) => {
            return a.totalLearnTime - b.totalLearnTime;
          });
        } else {
          this.tableTemp = this.teacherDate.studentList?.sort((a, b) => {
            return b.totalLearnTime - a.totalLearnTime;
          });
        }
      } else {
        //进度排序
        if (this.showDesc) {
          this.tableTemp = this.teacherDate.studentList?.sort((a, b) => {
            return a.learningProgress - b.learningProgress;
          });
        } else {
          this.tableTemp = this.teacherDate.studentList?.sort((a, b) => {
            return b.learningProgress - a.learningProgress;
          });
        }
      }
      this.tableData = this.tableTemp.slice((this.currentPage - 1) * 5, this.currentPage * 5);
      // console.log(this.tableTemp, this.tableData, 'this.tableDatathis.tableDatathis.tableData')
    },
    changeClass(e) {
      this.page = 0;
      this.currentPage = 1;
      let data = this.teacherDateclass.find(item => item.title == e);
      this.tableData = this.teacherDate.studentList?.slice(this.page * 7, (this.page + 1) * 7);
      this.select_item = this.tableData[0] || {};
      this.select_index = 0;
      this.$emit('changeClass', data);
    }
  }
};

var __$_require_assets_images_condition_time_logo_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAlCAYAAADFniADAAAAAXNSR0IArs4c6QAAAyJJREFUWEfNmM9rE1EQx7/TJRUUJYJgyba4PQhCD20ObgkeTE4epYeerdi7bf8B239A612xXvXQXntqcordS3IpKAhdtVstCg2ChRq3Y9++3STbJtlfWeiDEELmzfu875udN7OECzgoDhPXslkcX5nDECYBngKQBUiTvtgEyHS+baoAdpkKP8wo60SC4upIEYryDEAxyiKn9mXYeEsFay3MvFBQCWD8DMwm/jVn6N7Pej+4QCg21BcAFsLsMLQN8zJN76/0su8JxdURDcrQOkAiZlIYXId9MtMt3rpCuUBb7eBNgcl5JtjE8FGe8o1G5wrdoYxcLT2Fzm6Q66Tv5/tCxYqhqwVAuQY0NmNKerJK+vdFb7JPKfcp24rkeXgMmKzKKQevgK/Lkaa3jG0qUWGvLH77oYzcbuQ4EirdeS99/64Cn2bjQQFl0q2SD4oNdQ7Am8geBweF0xvAUaulFBuqOLaomRoYJJSrlgMlU4CyG1klMWGwUEDmz3UJFffo0oACHkuo7dwGiB5eCKWANU+pePGUjlJ1TykTRLcuhlJsekpxLKB0lJLJkw11MFBHO8DOg9j7810zvJ2Lf3yXJ4CJjjtPZPXdReDvXky49vHVAMSvm9QlILfkh/j1DrCex4GruIGuroHwKObW5LRLY/IOHB5tuzn+Bhy8lhd1+OGmhA/qAoYgyt7kY2QeuDl/Hu7jbDjVbC951rQsms3D5ESuB6GaOM4bHRXD4Sbw+UnwEnZmPPmF3G8Z8RDcfi1VC1drVUi3im2o6mgRCkcr8IL3LS0EnEgXQUMcXcGSMeWN2OVL0GJh/meYNG2NC9Mz5XCKagWD5Um3nCb1XDfDxugqwE+DfQzQgmmFpvdaxX2PFktNlkyj8dZJt/q3WMIfyxQhwNw3KdFWCW3NMHGSKVHB9L2V6dO2axqU5nqi66c/XR2ZTInypq877hpTZ/2kFGMvSbd6vjQJfOviHKehTQGOakmPswKiZborm85eIxRURx4TvaH43A8dN9IwFIznMxJUC67qxFsRjCIIGpi1VjnN/AVEDTDqIJSRyWx0i5t+m/oPzSYyVZBWghoAAAAASUVORK5CYII=";

var __$_require_assets_images_condition_resource_title_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAZCAYAAAASTF8GAAAAAXNSR0IArs4c6QAAAURJREFUKFN1UUlOA0EQa9eSM7wA/hRCxD5AhDjzAcQRQhQiIGzibeSANFkgEz4wjaq6I+DAXFoqu1y2B+GfD83L9wNm7YtiRZiCCo9Y+AKtq/KNGOssHBtCYKHYYPpCs1vWwjAmRDgqAyIUsNEtowoFkxHhoAJ/0bouY2KSM1U5MlPAZm9cq2n7Yd8yBaDdG8fElGhEdTkKaPcndZJxZhCGg9jqT9JAOBtIcti+mdYulY8vZbEzmDkgBuivHLuDabSBAUtJP753O7OhJQ9501/s333UfpjMDQXfzoClDqJmIG8ZUNx/Jik1u6kn3yiG89obdQNeYgp4OJzngH8N4OjhBxARP2zSOH6qcldpYM6YOaDzWHlAr0TJX2KK6DwvfEPdLgX790wATl4Wc2VaTTaTXaIwwulrVTDruTKtiVhfXIHi2TfKUmGzLlRQNwAAAABJRU5ErkJggg==";

var __$_require_assets_images_condition_music_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAAB1CAYAAACiVKTkAAAAAXNSR0IArs4c6QAACOBJREFUeF7tm11sFFUUx88srW0FS0E+Sm2klRiTEgUikRIMhQeKmgA+FPpggglEDQ9qCUp8KpQXEyKh6IMJxIZoSBT7APhg3JhARUIxJC2SNkFTKVptoXyUCvTTjv6nvevtdGd37s7O7GX33Kdu996Zc/+/Oeeee+6sQdy0VsCwW9dtDqwxadqrIQptIjJLtLY+fYxrNchsHaN/6hYYeZ3ytCKArppmwXQa3TNGVJM+8374ZhIiqr9PWXWlhtEH6y1AgJNHo6eJaOnDN6W0tLh1gLLWApIF6IY5cpA9Ry/Q8KR5RvZOo9s0SwwavaqXeWwNFDCJ1hrd5vBRg4zXWRL9FBgj85Bx3RxpMXnt0Y+OZZHZafSYI6am1rFZyOIYkN7PQUoA/TY4QB2DD1KqTF5oGr2YX5BSG9zcPHBA4b7b9H3fLTe2+d7n+Rn5VD1nvu/38XKDwAF92HWV7oyOerE5qWN1hxQ4oN2dvyZV4GRcTGdIDGiCsK6QGJDkgjpCYkC2GKkbJAYUZRHTCRIDcsgydIHEgGKkgTpAYkBx8vRUQ2JALjZSqYTEgFwAQpdUQWJALgGlChIDUgCErvtLnlYc4a07A1LUjwEpCobuix+dTkWP5CiN/Gt4iNoe3Fcawx6kLNf4gC1z5tPyGflKoy/eu0vHb95QGsOAlOViQAlK5jzMj/Mg9qAkYmJAamKmRRYXzYMGx8YIiYBTa3twj872W++nKzXO4pTkcl6DEk0C4t2eAcVTKMr30TyIASUgJIYEtQYxIAaUoAJqw9I2SWAPUnsQIr29hrjcUMiqGjyVm0dPTJR3ckPTKC8UmmQRA0oBINTbts4rotlZWXHvzoDiShS9Q6IeNCsrm2qKnpziKU5mMKCAAX1QXOrKc4RZDChAQIty8+itwmKlOzIgJbn+75xIiNs4e67yb3kYUICAgqxWx5sWl3pclnLiCckeFE8hh+8TCXH4qSLCnEo7frOHLt77W2WIq77sQVFkwiYUWZx9MxpLUb9+yceAHFRfVzCb1hU87uop9/N3sAwoBoItcwpp+YzHYkJCWEN486sxoDjKwotQi5tlK/fgBDXcd4t+TOCUVAUmA3KpFjav4l04HG3/OTxEgOR3Y0B+K+zx+gzIo4B+D2dAfivs8foMyKOAfg9nQH4r7PH6DMijgH4PZ0B+K+zx+gzIo4B+D2dAfivs8foMyKOAfg9Pe0C1v3cEUpLxC1TaAzp5u5fO+VzQ9AtOIgeHXm0J/NVfGHy2/05CP+D1Olkv4/Ema6XL8ygv97GPTQmgZE4g3a/FgDQnzIAYkOYKaG4eexAD0lwBzc1jD2JAmiuguXnsQQxIcwU0N489iAFproDm5rEHMSDNFdDcPPYgBqSmQP/QEDV3dtEfff20uHAulS9U+3W3093ar/dS/+AQ5efmUNl8tV/rqc0gub218yCIuOrjBgIowPlqa1VSZlz9eSM1X+uiqufK6MCmysg1Aa6tp9f1PWbm5lDlM4tc9/faUTtAmNDBpmaq/6HZmhsAJeJFANw/MET5eTmUn5NDToDke7kRs7ggn869vc1N16T0CRzQ15fa6b1T4aQYLy7y0cZK2rykbNI1d50MU+PP7REvFIAAu2qiL7wBobThp5ZJY7v6+q3PAAvAciuemZ80r3YjQsYBmiS2gzfIMJMVYt3AiNYncEB4OvHUitZ1tz/iUTWryx3DmdyvtrJi0kKPZAKLv9ycPEj2CidveHb/p9YaiLXmyJYNiWqblHGBA4pmtRDEvoDLfUVoBIjL7++IO3knQNHugb54AERDMoGG9QYQ5XZgY6X1/6CaFoDEQh1L/FWfNBC8LxZENx4Ubby4thvRkSCkLSCRWdmFOH+tKxLmEFLs+xSkwm8c/8YahjXB/lRbC/pEtoa/4RHhXzom7XvEPsjuFfCI6i8aLfhIIKJljPCuxkvt1v3TGpBqSuvmiRZ9sH7trCi3Pqp6hAAkrgEgACY2tdg4ow8DUiFi6ysDgrdhw+umHaneQC8fPmYBEdewr18ZAwiiuRXOjbhyHzzt9kxO/v6zCy3WvVeWTA1jwuMyHpAsmNN6pAJGXneijUOoEuuVHYJYk7DmMKAo6slhQwWK3DdaBUF833a9l145fMxa9KOFMbEZ3bZiGYWvdHCIs0PwGxBC2r5wk+VB597ZNslLNi8tswqyaMga68JNDCgWIJXUFYs5QhJaLA+y75vkMIZUW9QDL+/eMSVJEN4lKgkZkyTIkBKdtBtAckH2y61VtFJaZ+SQJjat9jVIfEbfPZUV1vlURqTZToBUjhOQXLRPnN84eZDwABHe5L0RMj2RSQrPlQHJ4Q+bWFS+Mx5QspMEeBkg1a6voPUTh2vnO7us4wdREZBLPmLfJI4hRPgDQGSKKO7u+65pfM2q3mAdQwTVUlaLk5/K2nUVU85dnATA04/FP94aZB/fcKHFSgbQRBXbXlNDWg6wAIxyE2DgMzwc3pSKpgUgP5IEISZColWbu9Jh/QtP/7dvvjal4Ak48CQRPgEEniNOdssK51p1wCC9B/ZqAQiLsduJw4PECWisLA5g4DWigiA8xyrGFk5+aQRJBbxSrE0iOcAYuX6YCkhaAEo0dDgBgtgAIzcRpuSwBjDwEHHEjf5Yh+zhTIaUzBdZ3MxbC0DYb6h4EI4SYq1BEBwFUHgRnvrtLyyLvIcgiyL3w/1rKspp+4plUXXbdSpsJRjos3P1eNU8iJYyQIj5B8+Mv7mz56UKJUB1ExkVUmKnFB3egWQAxdFYDf0ACmBiFVsR/tDXCaBfsFIGyK8Jpdt1GZDmRBkQA9JcAc3NYw9iQJoroLl5Rrc53GmQsVBzOzPSPIOo1egxh+uJjHczUgHNJ22QedToNkfWGESnNbc1I80zabTUwMx7zJF6ImIv0ugxGCPzUJHxSI0F6I5pFgzT6GmTaKlGNmayKa0DlLW21DD6LEAC0hCN7mVPSu1zAc8Zouy9gANLIoCEWd2mWUI0stewvMlYklpzM+PuJpnX/oteJwwyTiwwss/Is/4XTIyO9qHy7y8AAAAASUVORK5CYII=";

var __$_require_assets_images_condition_video_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAAB1CAYAAACiVKTkAAAAAXNSR0IArs4c6QAAChxJREFUeF7tnVFsFMcZx/9LFYiDTYCHGEJJoDGprShgpOAHQyoj3Ci0jYpRgUhtcSBqH4qBtE+1q6qkbexITVsM5qVVGiDtg4OKLZVglDgCAUUqjoRDI5kkkJCYcHYfAgETY1J52/+s55g77+H1eXd2fDcjITjf7M4332/+33wzs2sc2GK0B5x069zriSp8xV0DZ8p3ASww2vpcMc5BN1ynGxh+3imYe1HtVhKQ6340E0PTfwV3+Llc6fek7Ic7ZScKbjzvOAuv0n4ByINTcBQuyidlp3LNaCpq2uBKQvIA3fzPH61yDKPsTtnp3HPfTx13MLEAcD4yzDxrDj3wX3el495I7MUUp9Z6xEAPuMPNjnuz/wxc1849BvIBcNFxB/tcM22zVokszgIyeyBYQGbzsQoynI8FZAGZ7gHD7YtnDhq6BvS/C7x/BLj5udkuuvte4OEngQcqY7FTP6BPTgH/2A583htLh7Nu9N75wA8OAvxbY9EL6MRLAP9M5vL9g8CD+tSkDxAVs2fZZEbj2c6Qt6ULmDZDS1/0AfrbWuDjU1o6FXkjFT8Gqn8deTP6dhKYCPzh61o6pKURquhn72lpSo+CmBj8da2WDmlrhGFOQ8KgB9DZVuDQdm2+09KQBaTFzdk3YgFl7zstV1pAGdws01vuRsRZLCAf7z+6AXiq2fvi+EvAyRgXvRaQD6Bn3wKKH7n9xdVeb2fi3636tWQB+fg8k1OYJRKUzv09C2gcgGRVnWHPAsoCEC/RFfYsoCwBycuiDnsW0AQBRR32LKCQAEUV9iygEAFFEfYsoAgAhRn2LKAIAcmw9+YvgQ+OZLfItYAiBsTb8yCRx/DZ7OtZQBoAsYnfP2wBIawDuzBHLVVz/HdA159tiDMOUBjP5oU5WO4wRCbXkfdEncLNVB69h/F00URtCajb/ADEcHb6T96fbBICP2daQCElCWGEMwsooN7HM2rDDGcWUIiAoghnFlBIgPg6C3cHdJysjkfNAbvnVy03koSow5lVUMAhlj5qZTiL45UWqyAfaBU/Aqp/432hM5xZBQVUEKvx5ambI69QjuOy0KtaBYXu0nBvaAGF68/Q72YBhe7ScG+YU4De6wD+vilcB8V9t5wClCsvEMtBkXOvQLJjfAWSG5e5UNS3LCLuj56dBHaCZzB80zsXyk+6gJl6fqGFPkAEo/Ph9qgGAhfKXDBrKnoBTWZIfLPvqV3e7+3RWPQDYuf4BsL7Hbd/mVJYp5xhO45Q+Ko9dy8WPw3cree3i6jdiAdQ2I7M4ftZQIbDtYAsIMM9YLh5VkEWkOEeMNw8qyALyHAPGG6eVZAFZLgHDDfPKsgCMtwDhptnFWQBGe4Bw82zCrKADPeA4eZZBVlAhnvAcPOsgiwgfw98OXAdfd2nUVg8D7MWlUbupivnz+HWwDVMLZyBWSXRtxdWh2JT0MH11bjR9ymKyyvwxK59Kf3hzwkvaJm/ohpTC4vuWP2N7bXoP3MaD61eg8r6pmTdK+d78Nn5c0GbEoDnr1gVuP5EK8YG6EJHG041NQj7Nxw+neJg9bsgHax5rROFc+alVKVCpWLuKixCJkDvvNKCs6/sCdKMqMN22J6uEhsgdrD1WxW4NXAdizdtwZJNdck+q4Cmz7nf1xe8jhBY/AD9s6keH3a0o7h8GZ7YtT8JqHhphVARC9UwkLiEngP70xR8WXwm2HRlEhDvp6toBdR7ohNdLS8m+/bl9WsCEJ1wV5H3zFnVb1vAsCPV5ed81lMhjgeQ6thMapBqk3B1wfBrRyugIKHrm837xNyUDqj3ZKeAObukFLNKyrIGpKoikxqksjnXVDW2xMlH7390e+WDHnxy8q1RHe4/04X+kaSgprVT/DsdkEwqZDjMVkHpSQKNYVsDfZ8m7WIyIeeb6XNT57bK+sZR812UBLUqKFNH2tZXCwd97ck1WN7Q5KuOKAHJewdxdKaQG+TabOrEDihFCa2dKJw7b8KAqAjOd978NkOss6hefmZYU1VBRbyxrTaZ8hcvHf0/Vd7ouyxsypSQZOP4oNfECohzDZ2jqidTAjAeBY1XERKQDJ+0izbJRS1DLuvkFSCmyIc21whHTGfq2rxPqCcMQMca6sQaKEipatwj7CAUCSg9Rc9LQMd+UYfeE17C8NjWepSt25j0p18CMB4F+YHpObBPhLg55RXgWkgt6ffOe0CcI2RMl47iQpUjOJOCXv1GWQrMsbI4VqYqqE6WdAhcaxEYt5osoBEKDGtdu70sza/QWcsbGtF3JjXNZl1meixcJ81ZWjHmOogADm1eK9RS9ULLqDAmF6Ol6zYKJdsQB4iJVq53OLLpFJavrliFSyPrI0LiWkVdB8lkgnW//XIbZi8qHRMQQ9rbu18UClr7WmeKSkpW14jPLITHQWMBKYC43qEKVAgXDrfh7N49YNrLkvJdR5vY0GRWteHwvzKGQVWV6WsrNYwx1VY3atOTBKkuuZOQN0kCR/VA4jKWbav3VQBDG8ENJLw0l4WfpcP4mWsYOrjy540pdVQ46vwkQ6IExGSEIU1N7dPnIAmX4W/Z1nqh+rxLs4NM8nKil+FIhsWxtvxlKJXhTU0SuDHL5ICF20pM7VVAavijmh9aXWMB3Wn7RM34GBo/PNI+5pkMFUjVMX1/4HHvcI3q5PHDhSNegiK3lfhvuW4ijJTw2tqJaUUzMNB3CV27vEM+rpvGOhz0zYCy/GFsOwlBFHTuwH4xgUuHcrRzLlIVxFD15rZazH98FRZvqsvoPPVe6Qtj6Tt1Z4PH4isbW0RoY+JS2eDNjbqLsYA42rlgFPPOyE4DR386oLHmB6b2vI9cFPO44TsvtyV3LVQ4xxq24rPzPeJHDG+EL09becTBo3md6qEdxgGiQ3kMrZ5yMhWmQuTxtJrNqcr44XHPuSy8D+8hdxAk6KoXdmP2Im/RKwvV/PbupuTcVPq9jSKRYXnnLy0iu2SJA5JRgOhsQpCTOEf78vomAYdFrm38wox6+klnpx9j83s+LCL3+3gPgqFC1LMgdW6S7aiQ/B5yiTLsGQVIfYDDz6HcAOXugFzgqo6RGRd/xiTh9WdrBGjOJUytZQKgXqPW42BY8kwdytbf3hNU655qbBAJxuJntmDJ5tvPT0QJJ9YQx1NLueXz2LYGEdsJgI6gYvwcKp3BjEwts0vKMLUo9bEr3ptzF9dRdyqsR1Bl62pH3UO9jrZdONyeEWBUoGJTUFQdyrX7WkCGE7WALCDDPWC4eVZBFpDhHjDcPMf9InERjvOg4Xbmp3mu0+24X/TthIPt+ekB03vt7HXcwUQV4Bw13dT8tM9d6LDjVkUG4neHm5177n/OA+RemYmhW0fhuuUGmpp/JjnoxrTBlY6z8KoAlIQ0OLTDzkcxjwd3uBkFQzsIh5YkASVBDSYWYBg74DjlcLAkZnPzo3nX/Rhw2//v83anYO4xtdP/AwNCvVbKoLZbAAAAAElFTkSuQmCC";

var __$_require_assets_images_condition_pic_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAAB1CAYAAACiVKTkAAAAAXNSR0IArs4c6QAACS1JREFUeF7tnU9sVNcVxr9nA9HYQIJbg4Lj1oZWMQKlVAlTJV0wLkZqAlINCxaRCo3UTROjplJlxdmANyEhkZookG4qhbhiw6L2IoRINbKJVKpMUmElRThRwC7EMbFbk2KPJzYwt/3e+Jnn8cz7NzNvLp5zJWTjue++c7/fO+eee+6zbECa1goYmdaNTqqYqkRrhYFfAGjQ2vqlYpyBAUNhIAV0Phgxhu3Tmgc0pNQD1TM4lFJ4fqnM+16cR4XC64kIOhsN4xvabwIinMgM+qCw9V6c1JKz2cBA8j40E5IJaOxb9QfxHL0w05PWVhm/M0aTqsEAhvQyT6yhAuo2mo3RhDphVOCASKKfAimFN4yvv1UXlKw9+tFJWzRsXE8qpat1YhcggDR/CgSQANJcAc3NEw8SQJoroLl5oXvQF/9R6L+SQvKW5spkMe/Jhyvwg+8sqi8XdSKhApqYBjp7bxd1QsUevH17JeruDw9SqIDOfJbC+5+liq1hUcffs6UCsQ0VRb2HfXAB5FPqnz9cAYa6sJoA8qm0APIpWNjdBVDYivu8nwDyKVg+3Wuq0tnYxLT3erEAykdxj9dyL0Ohf/jdu+nyh1dT6P5nCkmXXYAA8ihy0G7bN1Rg75bsWRg96Wj/HUdIAiio8h6uq4kAh3Yuc+x5ZjCF9z/PvVcTQB6EDtrFyXusMVmCeuFM7jgngIKq7+G6p39ciZ/Uu5dpOnvv5EwcBJAHoYN2EUAuypW6FuclxLkVdMWDgrqHh+siy4H27ctQU5W788kLKcSvSZLgQc7idOFRwa+3VWaFFL+awkm+wu7QxIOKw2XBqKwgsCJddz9QEzEwclPhw6vK0XOsAQRQCIDyuYUAylAvsgyIfs9AZLmBL/6twCPzUjYBZFM/Ws+yTBqO1fovp9B9sXSnsgJojkTdaqA9lr0s42UxL5aXCSAAhHPwp5ULPCdT8FJ5UtkD8gLHguVW2CyGF5U1IFab22POnpMpul9IPAties2iKJOOiaQ/jGUN6FALN5DuxcygkDLF5fnPn+Ipcx/ktZUtIIIhoKDNzZNyCUtPevNvdzxDEkBBCQHIBclNVD+Q3MbKw/ysl2rzXly+HmRPHFjs5NrCTS4FjW10f9HQKyQBVOhH0Md4XJMY7pwSBwHkQ9BidGVm9+b5OzmHFkDFUN3nmHLknUWwQq1BPllk7S6ABJDn52jJZXGeZ+7QUTwoizh8X+DlJ51fKiyE+F7GeOG92znfLi3bJIHC8ZVcvnlTyha/pnDygmRxWRnQi/ZuqUTUw8uFxYB47nIKZz5XSN7KXZsraw+yROcJKmGF2VhJcAJj2SKAwqQS4F4CKIBoYV4igMJUO8C9BFAA0cK8ZEkDKtWLHoUEuKQBjfxX4ei53HuMQgpZrLGCHssHtSfUUg+NZDmfv4ZyrzWm/dxE23/xOIw5hA4ojEktpXsIIM1pCiABpLkCmpsnHiSANFdAc/PEgwSQ5gpobp54kADSXAHNzRMPEkCaK6C5eeJBAkhzBTQ3TzxIAGmugObmiQcJIM0V0Nw88SABpLkCNvPiF7/GyPgU6mpXIrp5nRaGh+5BvfFrmJyeLejkV1evwI5t9TnHvJmYxctv/8P8vLV5I6Kb12bt23HsPHr6r2Db5nXo6txZUBuDDhY6oJZnuzEylghqb9br6tauRO9brTnHHBmbQsuzPebnL7U9gT2xDQIol1oWoFVVy7Fq5Yq8QE1OzWJy+hYEUF4yLrzYAvTcvkfQtu+RRSO3HT1n/oyfNTWscbzzsVOf4PipTwRQAfnACRDFpujpUPR49nBmW8AFUCHJzI2VC1BP3xV0HD/vesfW2EYcmYMngFzl8t8hG6Cudwdx5MTH5mCbGtfgl7uaFgzMRf74qU/TnvXc49jTvNH8PgigpsYarK7K/ut7l4ZvYDIxC2aF2cJrxzOPuYZd/4o4X1GyLI5r0IHdm8DU9mz8mmklEwcu+jui9aAYdbXVGBlP4MChv4KQNjWswV9e2zU/oyCA8hHwnc6doe+PSgpo/64m7P39aRPC/t1N2P9UUxrGeMJc+OlJfz49aMIhLArEn1stCCBuQNfX3h3DD7ADu5vKy4OYqV0auoGvxqdMr2EjjIOvfoBLQxPz2hFK96tPYVX1wrQ8CCCnfZAfWGH1LakHWWk2w1r84nXEL46hu++yuQ5kNkLi098a2zAfZgRQER4Te5KwumoFut67tKiywFILd/tMBgiM6TfDntXoSfyMa5aXfRAXf4ZStlKsI/nIWFIPokdwzWEjFP6f/yh6uma2zlx72FjIJKyPzIJmwszm+NULIF5r3YceaF/H3MTjg+Knv9t4fj8vKSCGOIrH7MxaX9peOYezH6WzOjZ6ij2s8Wdct5iOew1xLNAenKtQ+BWo1B5XckDZBLO8hZVlq9GbKJa9eQVk9eO169emPdKpWTU+HUKiNoAYrpgc2DeIzOi6+6+gp+/yohSb4nkFxPBG6By727aPygXJHhLFg+ZU4nEAgTDUMeT9LFpvfqXnEFxmiu0HUHT/KfMMiqHySNsTbg5kwrTWLAHEvc94wqwoDA5NmJUEeyOYlmi9mUTwKzM3q3nxILvYx9q3z++3nCgJoLEEch03MAEYHJ7A2fiX5t4oE5j9ifYC6MXjfzezP7Z41z6sqnI/gxJADoAyn2x7es3Pev+4x7MH0TNbftNt9vca3kyQEuISZqjZEX3IdT2wd+BReZ0tC6OXsdCa60TVWtdMsG+1et7PCKAQ3kk48vbH6Do9aPJlIbbjV495fhgEED2hthrrbZVpz+rZOn41NjVf+c58aWR+faqtXhAWvdynrAHxYO7m1C20RB/ylFE5Ccrw1hv/0jxg63jm0UVd33l30LyP31INa3f0QLYXS3BIZ59I6BtVL0+w9LmrgADS/GkQQAJIcwU0N088SABproDm5hmj02rYMPB9ze0sS/MMhQHj+rR6HQZ+W5YKaD5pAzhhjCZVzAD6NLe1LM1TQKP5Z3/Fi/Tjn1J4Y32V8bwJ6IZSD8zOoE8pbNXP1DK0yMBA8j40NxrGN/N/OJuQZpI4LOtRaR8Ies5MBIcJh5Ys+svmo0nVgBQOGwa2wsCPSmtuedxdKfxLAT3/17znwYjRb5/1/wCnyM9HMogVbQAAAABJRU5ErkJggg==";

var __$_require_assets_images_condition_test_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGgAAAB1CAYAAACiVKTkAAAAAXNSR0IArs4c6QAACRxJREFUeF7tnUlsFEcUhl8NYGyxDkiA2cIqYVAAhWCkwMEWKFGQUUwiJC7YNy5YQE4BLpgLyyk4ggsncC5IWUACJUoEMgeMwpaYAxgpbGGziRQPdkIMBqaTv6AmRWemu8YzPV0z/Uoagemq6qr31f/eq6oBBHGx2gLCPTqnK1FDDtVTTHxEJGZYPfqSGZzTQUJ0UDK5S1TG7+jTSgFybifG0ojYTkrS1pKZdzFOJEb76Ulyl5gZf4zhS0ASTkWsjYgWF+OcSnDMHdSfrAWkV4B+7/2clWMZ5hjtFxPGfCqcrsQMErHblg2PhyOVk6wFoMP/Ampki1hogWSyRTiPen8hh2OPhXgwpDvC6e51LB0cDwtZHAOyex0wILv5sIIs52MHIOdBH7288ihQW4mpY2jIwgmBviOIzkN3cU5PPw3sPUvO3y+CmN8bfQ5dPZeGrp4T+Hvy+YLQASV/7aGBlvP5nJNnX8UGKXKAQK+YIJU8IFExjKhiKMGV6qVYIJU+oPEVVLZ5mXSjxQgpEoCG76oh54/+ooQUGUDycLgIIUUKUDFCihygYoMUSUDFBCmygIoFUqQBFQOkyAPygjR82woSU0cV7Bgq3YsiAQgbVb+CTezzQ5fJ6f/v0LZsSzXF5o73axro85IHlIv1GBARFfo0OxtgDIgB+a4XdnEeJmIFsYJYQb4WYAV5m4iTBG/7cAxiBeWuoGEb3s7FU6Vti7uhF9/d8OyXkwTDJKH8wId5B4QOnzZ9z4D8LGsSgxiQnxUDfG4CCIeW+GZOXkv/c3q2t50V5GdUE0B+fQT1nGOQYQwKCoBfvwyIAfmtkfD/doOJi8OlmfyGqEFBf/kqrCBDBWWTxfmlztnAY0AMyHe9FMVRDyvIl2NwFUxiUGzuOKMB4PsEzv0+o7omldjFGbo4E2MGUYcBMSDfdVUUMch3FgFVYAWxgnyXFivIw0SsIFYQK8jXAqwgbxOZ7INyMXIubdnFsYvzXT+cJLCLYxfnKxOPCuEr6H4fDfh8NyCXCebSFv++ghhfkUsXObcNHRBm8PKn+/Ty/IOcJ5PPDoYsnEhDasP/h/etAJRPw5ZaXwzIcqIMiAFZbgHLh8cKYkCWW8Dy4bGCGJDlFrB8eKwgBmS5BSwfHiuIAVluAcuHxwpiQJZbwPLhsYIYkOUWsHx4rCAGZLkFLB8eK4gB5c8CN49dlp1NrJ5FI6fE6dGFW/L3pVxCUVBP50M6t+NrWti0iqavnG9s39Z522Td5XvW0b1TV+nu6Wu0dMcaqmpY/r8+8I57p6959l02ukK2vXLglPEYpq1aQOPmVRrXz7ViwQEN9PXTybVf0F8PEnLsi5pWyY9J0QHhf+c9t/0r2ez91o00yaUkqK399fNMfUOFH5/+jFS/JmPA4pi9dolJ1bzUKTggjBpwfmg4RE+yhKQDgpEu7j5Bna3t0t3B0HrRAbkN2nO9ixKdD1PtMBa9YBElrnel3Kn+DIvJvRjyQiJDJ6EASgep5mCDr7s7urSZBv58+obq2ja1yp/HVU3OCKjh+t43nsGl4ZMOLCp2HjlLF/eclPHtg9aNQdrft+/QAOmQEAtgiDObWlOuL93IlVssG1VOaKMXxJKqxhWpP9IVNMflkqAgxCgFCMmGSkDQQfeFW3IceK6rJV41OW2887VyDhVCBaQgwdgw+rcr93kC8pqnO5ZlE4NM6uLdYSgqdEC60eFa4MIyFfUchnLHAfef6UZHEuGOT3iuFKTqqqzO/X4oSqX0hXZ5BQWksi7dAGWjy+nd7WuMnIBSGFzZ0u11nm10QH4xSNVVwBSQEVPiBPeoYlbJKyhdOpspUKez/o8Nh2R8QFaGdNermLgtt4LUz24gkQGkp7MIwkizGZC38yioi9OHki7VhZ9370lUG7WXgTKwm689sMHILZpUcru4yCooX4D8YoE7bfaChNQZGSROHSLv4vwAYQeP87WBvqd0ac8JWR3K0Q9HvTaYqn+T+KPqom8kAjogdUKhFkJkYpAfIPUc8QkZG4p+9qV2+EiH11/YmVEYSCT0jafab0FZyMz0FB2qwUcHpJIRlS0yINc5WiZAOMFua/pSgll/sVm6pkwFasQ5HY6AoAS0BYR07lGPQdgzqcXx3p510Uqzc1WQDg6Ho1j5mUpPZxedXNsiH2MfpCDEqyqpWtt3IQahACgK6qnrh7rjW+jS7hOENlUNr46RvN5pkpBkW8eaLA53N9Ne3w1lUhAmpw5Maw5uoOkrF6SMisxOV5TKCJU7zBSXdNDKharYB2jqTqmqcTktNdxQZwvBq74VgJAIYNUqt+UFCGk4jK+fJpysb5FHRFjxCpKKGwBUd2yzbJPufgiAsB9DfcQuFMQpHOmo7E5BMtkg5xMO+godkD4hGBi3lTogrNyyURWpszAVW1Qswc9Hq3fJbnQ1qECv3JJaBO4YpLfX4eiuDGBV0pHNBWM+YIUGSKWyahKz1i6h+Q3L6ebxn+VlmlrN+iRhHBgYxkeB4lAXqsKq/+R1sqEDHjaqnJ5rB7DpkgSo59qRs1KV8xtXpE0+AAnXFEpZ+TC+SR+hAHJfe89rXEHV2+veUI4++Pi8Spq0bDbNrn9HZmUn6lvkjSdUoeKEvrL1eANV6be3cHloB6VCJfJeyXGIhJCQM2WGWAiog+eoV6gSCiBM7puV+6TvxxdHFmvfSYDxAQFQ8Cs+bqPdOHY59X0EZSjdvalTbxUzABE3pO690WCMjIxuzbEtg2k6qDahAbp2pJ1GTo37XnNnmpUeF3TIgAHFQGHuVBxuEwEft6nqsDZbq/kdM2Xbn1/90AD5Dczk+d1TV6XbcX91Sx0Zua+60/WJ7A/15cfjslC1VScPJuPLR52iBpQPA9jeBwOynBADYkCWW8Dy4bGCGJDlFrB8eMLpenyHhHjL8nFGc3iCOoTTndhPFCvc1jiaph7crIU4LJyuRA2JWNvgeuBWgVrASc4UeIHT3bufiFhFgVo7y86T1CImj9n6ClAiMZYGYm3k0OIsu+HqwVigg/qTtWJm/LEElIL0LNbMSgrG4sa9JqmFniWbAQdtUoBSoLoSM4hizSScxURikXHHXHHwFnCc38gRx0kkj4vK+Bm9o38ANV8bzyriYKwAAAAASUVORK5CYII=";

var __$_require_assets_images_condition_book_note_png__ = "data:image/png;base64,[encoded data, 8164 characters]";

var __$_require_assets_images_condition_book_mark_png__ = "data:image/png;base64,[encoded data, 7952 characters]";

var __$_require_assets_images_condition_line_height_png__ = "data:image/png;base64,[encoded data, 8112 characters]";

var __$_require_assets_images_condition_noselect_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAatJREFUSEvlllFOwkAQhmdU3jkCr4YSdm4gN8ATCDeAE4AnEE8gN9AbwA1m0Ta+9gg8a8KYxTY0dbe7W3wwsW/Nzs6Xmf79ZxBaPsyZAjh0iQbbmBQYE1zG7nbZQkSW5l0E5kTJKjRPNLAKKyEiMgqtNApo2ogobKlmL/JJRJT7Kg0GMnMPsbMBgJ4jaV5A903QICAzdxE7pjIXrGRslUpGZwO1zp4BZOxrlzlHhNVwmMxdsd4KbSLxgZuU2whkTmeI8OAD2M5dynUCGxQZyrcq1wnUOjWKvAnN7ohbK5VMq2cNFb4tEXFxDlAEp0T9dRDQBDG/jgEuu+2gh9zmPl6VtoO5b/0dYGFlTwDocxdHOWKsblr313+uUq1TY9iqjXBE5JFoMKvf9Vjbew/xsAGQyO+IuciHmY8/RpVXpYXFGdcJ/B8N7GJEdG0dxl7gtwFkE0R5CmmtCBJRX7ceT+VFZr/VhSxUQRWeoOkaEe4c4+ieaHDc5M6e+CfgcdUw37OmXHxRqn/rgx03gpCgagxzXbluRdpyRwMLEZmtu1h+ryYuRf4aMLYr1fgv6s/FHSSjkJ8AAAAASUVORK5CYII=";

var __$_require_assets_images_condition_up_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAgRJREFUSEutls1OAjEQgGdWjfHG1b8EjwZNdt5A3gAhJt6EN5CDGL2IB2P8SdQnkAdQ5A3wDbqJGI/uAfHqzfjDjqlKRGi33V24kc7263S+dooQ85c7aLvgcKqxM38bZQqMEtyLzZ887SFjVf7nz6Bc3507t50nMrAf1oNgt5u9ssw0EnDtuO0G4IjhbPil232nxs6Cb8rUGrh++Jz+cLgJCGnVpMzgB69v1KguvIRBrYC56mNqbGpS6GB9gNvrykw2MbBw3LkBgJxpu74lYjivb8+UdbHGDFWSmMBh5oYC80ftTUTnzARQjevM1QL1Rtri1eZqgYWTThMYVmynV5oLXKtXZkv9Y1pg/uipioh7yYBBqV6Zq1kBZVDhtJPjAFNxoA6Cf7U1PXTPGi2NA0t8DkcJ1WYohEgjTlwCoPIqMy+CfeaPEhH9u1+1QM9rNQGSWQoANdddsrNUiLvkljKWiDL2lnpeS7Yi17x9iobFfEG0vDk4EmqpEA9pxKAJwBHriD7zOxHRUKsyHgsh7l1ElvW0PI8S5mSJFpXN2AiUWyLEfRGRL222lhmJKOPFbk+9D20kYoYy0VLog8oqwz9oq4YIG+onBu8TLX+/5EZ20wghUogTsp4D5mLDdTOrJpgcj5ThTz0HzdUbqWzMNqsajJHmAgS/tRov6owcGTDOInvffAGi1ModdPVOEAAAAABJRU5ErkJggg==";

var __$_require_assets_images_condition_down_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAfNJREFUSEvNlr1OAkEQgGcgxpZaKLAWw+0byBugaGInvAE0qBVYGbRQn0B6QXkDfYM9FGqvAGytTAi5HbPES/S8/bnDwu3Izuw3s/uxewgJB+djB0BkGNt+irMExgkOYofDcYuI2vI3ETQYK1zbrhMb+B0WQIioZNtpLKDcRkTiEd28Ey0YY8wzdWoN5JznEdceASCvWNT7gr7roFZAznkGcU12poIFjCfHKZRWBrru+AGAyqbtkvOIcF0sFhqqWGOHUZKYwDpztUDOR3VEuDIBouZV5iqBGiNt+ZHmKoGuO5JG7tiurojrOk6h9n1O0+FLGxFbqwCJsMbYVtcKKIM4fy4DpDPJoMKLun2MliaDqbP+D/Dw/C2/SNOtxe2iasfz/XltcLr5435Vdli5nD0CrWYpAXXvm1k7S/c609UtBVG7b+bsLa1czOSF7SQSR4ib/kmuHs7VSvN1jronKbIWAvDEx5wN2pu/niqjpQcXE0dASkKt/o9LmD8vhWUJKjMCZeDe+aSK6ZQ01jhSINhdM+cmfp6CxP3OtE2Gqw5JNHrHOe0HlVWHAbTSmXUB4SiqevTprHeaXX7J6UYsYPnqNZNerMvzDJs76Dc3dk0wOR8LKBPC5uqMjNwJm6rCMdJcH1LLsxL+vKoy8s+ASYoMcj4BoLLOHQpm+zUAAAAASUVORK5CYII=";

var __$_require_assets_images_condition_music_logo_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAWxJREFUWEftlk1SwkAQhV8PlG5ceARG2JhYpdwgR4g7F6ByAuQGcAK5gSGhXHMDyxOgpbjxJzkCSxeQsRLNQio/NSFOrIKsskm/r990+g0BQNt9uSbgKngv8vEh+mOuD9Jq0g/AHQFGkeJRrSyIPwcIQNIglACkQSgDSIJQChAHoRxgFaIUgABC+H7PqR8NSwOAwL19oBm5AQQwIV88Ju0OweiYADNxt6wNsBQdp6FbSQLtt9klVehmMwBMd7q/t6ie/OqWMZMx6ipxINPuOIoiZ2BzAAhkETAC4AGfc4s352GcZ018IUfgi4Fd1/txtVQAeDbXeO5/fm0HUrpXcgRRcJTmQLD3Ha6dJgG0Pp4tRuxC6k4puwcWEM1brj+sipy509oOdl0p8TCP5dPQ85fojRvaJBJrvT4ZrFoJAqemAiDS8ATg0beovHBUJYcD0k2mfrAF2Drwrxw4f58NkXZ9Knb+w2pBtI/4YecLRsY7MEKYPe4AAAAASUVORK5CYII=";

var __$_require_assets_images_condition_line_music_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAYlJREFUWEftl0tSwkAQhrvbQCW6GW+AN/AIegM8gR5BFhblRjorCrQKbgA3kBtwBW4gN5CNiimYtiap8IgZSBYBFsl6Zv6v/37MBOHIHx5ZH04LwOH2DQGpgJujQzmzckBxT/3Q4tMIe9q5nHFjdgiIFYDL7ZqQ82FEUS+u5vw8LQFKB2wOVLh7jSC1LN2imNUXndcvdGWUVti5izAUJxwjgBIBDlpPvg00KuyzMQDWAHTj96XZT67NBbApHh9kg9gSF5igOHdzbvzrrMwA25FrnwSnQjgwIEmIpLgnzq1trmQCqHKnDkSDyHbtB60mG2GXuw9JiDzi4cyJrbQNItd/uxeUYRTpWny9bw0BGvpAUg9zLjDZFXm8fyeAiRyJ3m3iqRDh4mziex1w/VcWhFZa5MlqNunQhD1EmHpLe85zd4FJTdZ7wVxoRiDPRba3BooexyVA6UCqAwJi3oSFPMlIL/3NrkoFKLLykzNl61H6jcFjkeLmbJLqcPNWPK3/gqKjTzu/dKB04A8gdFMwgBhGNQAAAABJRU5ErkJggg==";

var __$_require_assets_images_condition_video_logo_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAUhJREFUWEfVl0FSwkAQRV+j7lzgDcIN8ATCSYQTyNIFlLGy8RbhCNyA8gQeAY6QfcCxZkJSQpnSycwwOMtUpf/r30l3jxD5SGR9LgdAPZNwTY4wBPqBnCmAFSWv8sZWaxgHjPgNHwGFT/PZUjLWEBXAgjUwCpR1W9ilZExrAHVmcS1XSMZdTAAkQ/4ZgGJsStUjR5G4ls3aAf1CLaoWTBBeXECcAMzfk5KwI0V47OKGM0Djhgb5ZG3rhjeArmXxDmBbliAAjRtzRojpsK0nLEA1XzZnB1Az+tzyhDD7bbh5d0BVtufwtyblDeDbLmE1UZ0BbOz+6VtwArC12wsAJQMTqFrdrOz2A9Cl4fvsA571oy8kRytZ5KU0ZXgYp6HuA8fVEwp63Et6WMubKbZnCTz4rvVJvHeumGhx/fxyrmaBs24fybGEa90vUoSPITQc1awAAAAASUVORK5CYII=";

var __$_require_assets_images_condition_line_video_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAWdJREFUWEftl81Vg0AURu8wDWAHWAHSgXaA+5xICVqBSQWmAznRfdJBSsBUIB1oAcLoEIgcDgPDgiQLWMP77vvezwyCMz/izPpcFkAy4xZwg3e2p3Lm6EAS4UrFlxbOBFdBzPcpIOoAnlR8lgDXQUw6AUwOmBxIIm74wbOZlqK5M8JMsm1r7MFNqMWlYqfHVSkW/pplB6jnKHYCPJXz5L+xar47CKAuXgUyQSQR/+LwkQvu2ybLGqAunoki61QqXjVIE6JF/M60V6wAkhmhlIWYq8WDmIUWTiKiJsQQcR2jF2A/50EI4nJBHcWrEtQh/gBXCsKi5gfbjZlX33cClJlvTOIGCGzFex3Yz1kIwXPd9o6O1+V4UZDaZG7lQFlnz/Zc0DOvvxlykPX2wNjreAKYHGh1AIo74ShXsnKkj7ctE8Boza8US399WOXNReQ6OY+jKZeBc4e4vlcu679g7Ozb4k8OTA78AkxBBzA3rcSzAAAAAElFTkSuQmCC";

var __$_require_assets_images_condition_pic_logo_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAaJJREFUWEftl8FRwkAUhv8XIOqNDqAES4AOdEZJ4kWpAOhAKxAqkJOw8aAdoB1YAnaQmzOE7HM2o5hAICGQhAN72tnZ3f/b/735Z5ZQ8KCC9XE4AIZwHwF0c3GE0Rdmpae0Fg4YwuVcxH9FhFHxtY8AmTjA4A9NYsgkq6ByB+D6cnkzK4EStw29ERQ0bHcCRmgtMwCSaI6tynsQoCXmFwR+Da7lCnA1+m6UtPIkFwCW8sG2Tu5DJYjImMwc8IU9ryduTvtq2hLzWwIPc2vChRDB8eeMalTAbeEAT0lSWzWWMZ51QaQie+eREECJe82xdTb9UzRHszvW6GlXggQAq+KJIZi/QFTbBBkLICW3Xyx9pXk2QhAc8nCpymWOuM6aN4lKQXVHLEBUoCy/KNQTBKcEbj639M9/yPUQewFQQtf27FyTskHMb8FeiYPYG0CSZkwVxUlKkERc7UkVxYUDBOM06UvX7YvKjtgeYMCBlAMGLUIoDQhpVCNCdzmSYwHSiG1z5giw6oDt9sHobGNj6r3MA2Hq/ifocL5mqV+z48HCHfgBfvwUMOW8BJ8AAAAASUVORK5CYII=";

var __$_require_assets_images_condition_line_pic_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAXtJREFUWEftl89Rg0AUh39gCsAOnh3IxIs37QAr0KOjOIMVCBWYA87kZjqQDlKA46wduB3o0QN/dBeSIWQ3LAdCDuTIhP2+99u3D7Aw8M8amI/DEiD//QKwHB6fJftKZp0ABcxBim8JnuCYz9yffUjUBQgpviQ0/T3h83M+CowJ6BKgO3YKOyOT0yKbO8s9HNmJqrE7N2EJxxKA8y8Y8tiNtKIBI2RYogChyB/5y3TW/G8ngQZ8tZZSgupw4BMprvjc3TpZxgINeAQLHAVeK4sNiS34BJe6uWIkQD7zAAkTsUc8dkMBpgd205ToAhdrtArQPbuGhUVV6Rq+yn9DwoLYY0/uuYh9R+Wr+3cKVJW/6eBKifKiEbw1AfI/QsB+qseu7fhyO54BcJPKjRKQ+3zLSNW9KhF55oVBhwdZaw/0PY5HgTEBdQJAggL9vJJliOqnSifQY/PnEY+ncpQ3B5GDNA96JJdLp/ZCmUDvYA3gsD5MhkhhTGDwBP4A1Z0sMFGdf4sAAAAASUVORK5CYII=";

var __$_require_assets_images_condition_test_logo_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAARxJREFUWEftl0EKwjAQRf+Im4qLegO9gUfQIwgVKm68gqeyYgVvIJ5Ab2CP4K5u6ki60jbUTIzUQrMMk8n7n8wkIdQ8qOb9oQVI59EVjKEYjpFknWzW3y0vpmv1AEHEpgmKcQzcHpRNTSGcARBwYYKvnJNAOANg8Im6WCGjowTCKUAvXkzScDOUQDgHUGdCAvETAAnEzwB0EL04HBSrxhlAnpiQlMqSySewr+a9OCzt5xbgQ/NoAZrrgOpyqslI7od7sD0zePy6xtoBG4A0iI4A3qCtASTKq2KbC5BfteC1Xh0pq42GtQNVZyAVPF6+AMCNGAetTMLKSH7bilsHWgdEDtj+jKrqkZF4+3Bk9CQzrWsXcf/5OXWhzDTHE6KZ5SFByHxlAAAAAElFTkSuQmCC";

var __$_require_assets_images_condition_line_test_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAaNJREFUWEftl01OwkAUx98b0J1J3ZkopN5AFgTZ6Q3wBHoEPQAy9SMu5QZyA7kBSyIhwRvYIAt3EtlBZ0YfX9JmCsOilEW7bDrz/73/+5gpQswPxqwP2wXQPOJnDMEqfPL6ppyZO9CxueXJ1DcJp3/Efq7P+5uAmAM0bW6nZeqDRD0mjosudxOAxIEwB1qHjyeKjWyTbulY3BrtsdLOQNZ1hb12EZI4pmQDACyQwPO9shMG2jl4ssWuaChQtgB1c9q9rQa/XQvAJz7bKQRiURwA3j0mLnSdZQwQiNxRqFxEfBlzBCCC4mkmznOufq4YAbQz9yWFQGJku5PvlTnptjJ3V0GIdcRpj5UA7ezD5V8Oa9NI5+KzDPgglKoishLlnGxfFvls/VKAaeSvYeJaiMlLI/GVDrxlHc6AVRZtD23NSTqeAcA1idzIAfqIzgjTc4EONFoTVnA6+JU1EPU4TgASB7QOgIK6QhXJlUwMpVP8+r9t6QEiLH0J0il0K+NR7htE1MNDidcRak8GKlO1xbmyXf8FUUe/dBLGIe6rgQQgLgd+AYGhVTAK4e9GAAAAAElFTkSuQmCC";

/* script */
const __vue_script__$2P = script$2P;
var __vue_render__$2P = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    [
      _c(
        "el-dialog",
        {
          staticClass: "xmlStatisticalCharts",
          attrs: {
            visible: _vm.dialogVisible,
            width: _vm.pageType == "pc" ? "737px" : "90%",
            "custom-class": "xml-epub-pdf-dialog",
            "destroy-on-close": true,
          },
          on: {
            "update:visible": function ($event) {
              _vm.dialogVisible = $event;
            },
          },
        },
        [
          _c(
            "div",
            {
              staticClass: "chart_title",
              attrs: { slot: "title" },
              slot: "title",
            },
            [_vm._v("学习情况")]
          ),
          _vm._v(" "),
          _vm.userType == "student"
            ? _c("div", { staticClass: "student_type" }, [
                _c("div", { staticClass: "student_top_new" }, [
                  _c("div", { staticClass: "top_time" }, [
                    _c("div", { staticClass: "thisTime" }, [
                      _c("img", {
                        staticClass: "time_logo",
                        attrs: {
                          src: __$_require_assets_images_condition_time_logo_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "font",
                          staticStyle: { "margin-right": "8px" },
                        },
                        [_vm._v("本次学习")]
                      ),
                      _vm._v(" "),
                      _c("div", { staticClass: "blod_font" }, [
                        _vm._v(_vm._s(_vm.changeTime(_vm.learnTime) || "0")),
                      ]),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "font",
                          staticStyle: { "margin-right": "16px" },
                        },
                        [_vm._v("小时")]
                      ),
                      _vm._v(" "),
                      _c("div", { staticClass: "blod_font" }, [
                        _vm._v(
                          _vm._s(
                            _vm.studentDate.chapterNum
                              ? _vm.studentDate.chapterNum
                              : "0"
                          )
                        ),
                      ]),
                      _vm._v(" "),
                      _c("div", { staticClass: "font" }, [_vm._v("章")]),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "allTime" }, [
                      _c("img", {
                        staticClass: "time_logo",
                        attrs: {
                          src: __$_require_assets_images_condition_time_logo_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "font",
                          staticStyle: { "margin-right": "8px" },
                        },
                        [_vm._v("累计学习")]
                      ),
                      _vm._v(" "),
                      _c("div", { staticClass: "blod_font" }, [
                        _vm._v(
                          _vm._s(
                            _vm.changeTime(_vm.studentDate.totalLearnTime) ||
                              "0"
                          )
                        ),
                      ]),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "font",
                          staticStyle: { "margin-right": "16px" },
                        },
                        [_vm._v("小时")]
                      ),
                      _vm._v(" "),
                      _c("div", { staticClass: "blod_font" }, [
                        _vm._v(
                          _vm._s(
                            _vm.studentDate.learnChapter
                              ? _vm.studentDate.learnChapter
                              : "0"
                          )
                        ),
                      ]),
                      _vm._v(" "),
                      _c("div", { staticClass: "font" }, [_vm._v("章")]),
                    ]),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "top_schedul" },
                    [
                      _c("div", { staticClass: "font" }, [
                        _vm._v("本书学习进度："),
                      ]),
                      _vm._v(" "),
                      _c("div", { staticClass: "percentage" }, [
                        _vm._v(
                          _vm._s(
                            _vm.studentDate.learningProgress
                              ? _vm.studentDate.learningProgress
                              : "0"
                          ) + "%"
                        ),
                      ]),
                      _vm._v(" "),
                      _c("el-progress", {
                        attrs: {
                          percentage: Number(_vm.studentDate.learningProgress),
                          "stroke-width": 10,
                          "define-back-color": "#ffffff",
                        },
                      }),
                    ],
                    1
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "resource_student" }, [
                  _c("div", { staticClass: "student_title_new" }, [
                    _c("img", {
                      attrs: {
                        src: __$_require_assets_images_condition_resource_title_png__,
                        alt: "",
                      },
                    }),
                    _vm._v("\n          资源学习\n        "),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "resource_list" }, [
                    _c("div", { staticClass: "resource_item" }, [
                      _c("img", {
                        attrs: {
                          src: __$_require_assets_images_condition_music_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c(
                        "div",
                        { staticClass: "item_right" },
                        [
                          _c("div", { staticClass: "item_time" }, [
                            _vm._v(
                              "\n                累计收听 \n                "
                            ),
                            _c("div", { staticClass: "music_color" }, [
                              _vm._v(
                                "\n                  " +
                                  _vm._s(
                                    _vm.studentDate.musicNum
                                      ? _vm.studentDate.musicNum
                                      : 0
                                  ) +
                                  "/" +
                                  _vm._s(_vm.musicAllNum || 0) +
                                  "\n                "
                              ),
                            ]),
                            _vm._v(
                              "\n                 个，收听 \n                "
                            ),
                            _c("div", { staticClass: "music_color" }, [
                              _vm._v(
                                _vm._s(
                                  _vm.changeTime(_vm.studentDate.musicTime) ||
                                    "0"
                                )
                              ),
                            ]),
                            _vm._v("\n                 小时\n              "),
                          ]),
                          _vm._v(" "),
                          _c("el-progress", {
                            attrs: {
                              percentage: _vm.getNumber(
                                _vm.studentDate.musicNum,
                                _vm.musicAllNum
                              ),
                              "stroke-width": 8,
                              color: "#33D1C9",
                              "define-back-color": "#EDEDED",
                            },
                          }),
                        ],
                        1
                      ),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "resource_item" }, [
                      _c("img", {
                        attrs: {
                          src: __$_require_assets_images_condition_video_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c(
                        "div",
                        { staticClass: "item_right" },
                        [
                          _c("div", { staticClass: "item_time" }, [
                            _vm._v(
                              "\n                累计播放 \n                "
                            ),
                            _c("div", { staticClass: "video_color" }, [
                              _vm._v(
                                "\n                  " +
                                  _vm._s(
                                    _vm.studentDate.videoNum
                                      ? _vm.studentDate.videoNum
                                      : 0
                                  ) +
                                  "/" +
                                  _vm._s(_vm.videoAllNum || 0) +
                                  "\n                "
                              ),
                            ]),
                            _vm._v(
                              "\n                  个，播放 \n                "
                            ),
                            _c("div", { staticClass: "video_color" }, [
                              _vm._v(
                                _vm._s(
                                  _vm.changeTime(_vm.studentDate.videoTime) ||
                                    "0"
                                )
                              ),
                            ]),
                            _vm._v("\n                 小时\n              "),
                          ]),
                          _vm._v(" "),
                          _c("el-progress", {
                            attrs: {
                              percentage: _vm.getNumber(
                                _vm.studentDate.videoNum,
                                _vm.videoAllNum
                              ),
                              "stroke-width": 8,
                              color: "#33D1C9",
                              "define-back-color": "#EDEDED",
                            },
                          }),
                        ],
                        1
                      ),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "resource_item" }, [
                      _c("img", {
                        attrs: {
                          src: __$_require_assets_images_condition_pic_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c(
                        "div",
                        { staticClass: "item_right" },
                        [
                          _c("div", { staticClass: "item_time" }, [
                            _vm._v(
                              "\n                累计查看 \n                "
                            ),
                            _c("div", { staticClass: "pic_color" }, [
                              _vm._v(
                                "\n                  " +
                                  _vm._s(
                                    _vm.studentDate.imageNum
                                      ? _vm.studentDate.imageNum
                                      : 0
                                  ) +
                                  "/" +
                                  _vm._s(_vm.imageAllNum || 0) +
                                  "\n                "
                              ),
                            ]),
                            _vm._v(
                              "\n                 个，查看 \n                "
                            ),
                            _c("div", { staticClass: "pic_color" }, [
                              _vm._v(
                                _vm._s(
                                  _vm.studentDate.imgLearnNum
                                    ? _vm.studentDate.imgLearnNum
                                    : "0"
                                )
                              ),
                            ]),
                            _vm._v("\n                 次\n              "),
                          ]),
                          _vm._v(" "),
                          _c("el-progress", {
                            attrs: {
                              percentage: _vm.getNumber(
                                _vm.studentDate.imageNum,
                                _vm.imageAllNum
                              ),
                              "stroke-width": 8,
                              color: "#33D1C9",
                              "define-back-color": "#EDEDED",
                            },
                          }),
                        ],
                        1
                      ),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "resource_item" }, [
                      _c("img", {
                        attrs: {
                          src: __$_require_assets_images_condition_test_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c(
                        "div",
                        { staticClass: "item_right" },
                        [
                          _c("div", { staticClass: "item_time" }, [
                            _vm._v(
                              "\n                累计完成  \n                "
                            ),
                            _c("div", { staticClass: "test_color" }, [
                              _vm._v(
                                "\n                  " +
                                  _vm._s(
                                    _vm.studentDate.testNum
                                      ? _vm.studentDate.testNum
                                      : 0
                                  ) +
                                  "/" +
                                  _vm._s(_vm.testAllNum || 0) +
                                  "\n                "
                              ),
                            ]),
                            _vm._v(
                              "\n                 道，完成率\n                "
                            ),
                            _c("div", { staticClass: "test_color" }, [
                              _vm._v(
                                _vm._s(
                                  _vm.getNumbers(
                                    _vm.studentDate.testNum,
                                    _vm.testAllNum
                                  )
                                ) + "%"
                              ),
                            ]),
                            _vm._v(
                              "\n                ，正确率 \n                "
                            ),
                            _c("div", { staticClass: "test_color" }, [
                              _vm._v(
                                _vm._s(
                                  _vm.studentDate.accuracy
                                    ? _vm.studentDate.accuracy
                                    : "0"
                                ) + "%"
                              ),
                            ]),
                          ]),
                          _vm._v(" "),
                          _c("el-progress", {
                            attrs: {
                              percentage: _vm.getNumber(
                                _vm.studentDate.testNum,
                                _vm.testAllNum
                              ),
                              "stroke-width": 8,
                              color: "#33D1C9",
                              "define-back-color": "#EDEDED",
                            },
                          }),
                        ],
                        1
                      ),
                    ]),
                  ]),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "study_mark" }, [
                  _c("div", { staticClass: "student_title_new" }, [
                    _c("img", {
                      attrs: {
                        src: __$_require_assets_images_condition_resource_title_png__,
                        alt: "",
                      },
                    }),
                    _vm._v("\n          学习标记\n        "),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "mark_list" }, [
                    _c("div", { staticClass: "mark_item" }, [
                      _c("img", {
                        staticClass: "mark_img",
                        attrs: {
                          src: __$_require_assets_images_condition_book_note_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c("div", { staticClass: "mark_right" }, [
                        _vm._v("\n              笔记\n              "),
                        _c("div", { staticClass: "color" }, [
                          _c("div", { staticClass: "blod" }, [
                            _vm._v(
                              _vm._s(
                                _vm.studentDate.noteNum
                                  ? _vm.studentDate.noteNum
                                  : "0"
                              ) + "  "
                            ),
                          ]),
                          _vm._v("\n                个\n              "),
                        ]),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "mark_item" }, [
                      _c("img", {
                        staticClass: "mark_img",
                        attrs: {
                          src: __$_require_assets_images_condition_book_mark_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c("div", { staticClass: "mark_right" }, [
                        _vm._v("\n              书签\n              "),
                        _c("div", { staticClass: "color" }, [
                          _c("div", { staticClass: "blod" }, [
                            _vm._v(
                              _vm._s(
                                _vm.studentDate.bookmarkNum
                                  ? _vm.studentDate.bookmarkNum
                                  : "0"
                              ) + "  "
                            ),
                          ]),
                          _vm._v("\n                个\n              "),
                        ]),
                      ]),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "mark_item" }, [
                      _c("img", {
                        staticClass: "mark_img",
                        attrs: {
                          src: __$_require_assets_images_condition_line_height_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c("div", { staticClass: "mark_right" }, [
                        _vm._v("\n              高亮\n              "),
                        _c("div", { staticClass: "color" }, [
                          _c("div", { staticClass: "blod" }, [
                            _vm._v(
                              _vm._s(
                                _vm.studentDate.lineationNum
                                  ? _vm.studentDate.lineationNum
                                  : "0"
                              ) + "  "
                            ),
                          ]),
                          _vm._v("\n                个\n              "),
                        ]),
                      ]),
                    ]),
                  ]),
                ]),
              ])
            : _vm._e(),
          _vm._v(" "),
          _vm.userType == "teacher"
            ? _c("div", { staticClass: "teacher_type" }, [
                _c("div", { staticClass: "student_top_new" }, [
                  _c("div", { staticClass: "student_title_new" }, [
                    _c("div", [
                      _c("img", {
                        attrs: {
                          src: __$_require_assets_images_condition_resource_title_png__,
                          alt: "",
                        },
                      }),
                      _vm._v("\n            概览\n          "),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "sleect" },
                      [
                        _c(
                          "el-select",
                          {
                            attrs: { placeholder: "请选择" },
                            on: { change: _vm.changeClass },
                            model: {
                              value: _vm.classValue,
                              callback: function ($$v) {
                                _vm.classValue = $$v;
                              },
                              expression: "classValue",
                            },
                          },
                          _vm._l(_vm.teacherDateclass, function (item) {
                            return _c("el-option", {
                              key: item.title,
                              attrs: { label: item.title, value: item.title },
                            })
                          }),
                          1
                        ),
                      ],
                      1
                    ),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "top_time" }, [
                    _c("div", { staticClass: "thisTime" }, [
                      _c("img", {
                        staticClass: "time_logo",
                        attrs: {
                          src: __$_require_assets_images_condition_time_logo_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "font",
                          staticStyle: { "margin-right": "8px" },
                        },
                        [_vm._v("本次授课")]
                      ),
                      _vm._v(" "),
                      _c("div", { staticClass: "blod_font" }, [
                        _vm._v(_vm._s(_vm.changeTime(_vm.learnTime) || "0")),
                      ]),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "font",
                          staticStyle: { "margin-right": "16px" },
                        },
                        [_vm._v("小时")]
                      ),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "allTime" }, [
                      _c("img", {
                        staticClass: "time_logo",
                        attrs: {
                          src: __$_require_assets_images_condition_time_logo_png__,
                          alt: "",
                        },
                      }),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "font",
                          staticStyle: { "margin-right": "8px" },
                        },
                        [_vm._v("累计授课")]
                      ),
                      _vm._v(" "),
                      _c("div", { staticClass: "blod_font" }, [
                        _vm._v(_vm._s(_vm.teacherDate.learnNum || "0")),
                      ]),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "font",
                          staticStyle: { "margin-right": "16px" },
                        },
                        [_vm._v("次")]
                      ),
                      _vm._v(" "),
                      _c("div", { staticClass: "blod_font" }, [
                        _vm._v(
                          _vm._s(
                            _vm.changeTime(_vm.teacherDate.totalLearnTime) ||
                              "0"
                          )
                        ),
                      ]),
                      _vm._v(" "),
                      _c("div", { staticClass: "font" }, [_vm._v("小时")]),
                    ]),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "top_schedul" },
                    [
                      _c("div", { staticClass: "font" }, [
                        _vm._v("本书教学进度："),
                      ]),
                      _vm._v(" "),
                      _c("div", { staticClass: "percentage" }, [
                        _vm._v(
                          _vm._s(
                            _vm.teacherDate.learningProgress
                              ? _vm.teacherDate.learningProgress
                              : "0"
                          ) + "%"
                        ),
                      ]),
                      _vm._v(" "),
                      _c("el-progress", {
                        attrs: {
                          percentage: Number(_vm.teacherDate.learningProgress),
                          "stroke-width": 10,
                          "define-back-color": "#ffffff",
                        },
                      }),
                    ],
                    1
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "students_list" }, [
                  _c("div", { staticClass: "student_title_new" }, [
                    _c("div", [
                      _c("img", {
                        attrs: {
                          src: __$_require_assets_images_condition_resource_title_png__,
                          alt: "",
                        },
                      }),
                      _vm._v("\n            学员学习情况\n          "),
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "filter" }, [
                      _c(
                        "div",
                        {
                          staticClass: "item",
                          on: {
                            click: function ($event) {
                              return _vm.changeFilter(0)
                            },
                          },
                        },
                        [
                          _vm._v("\n              学习时长\n              "),
                          _c("img", {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: _vm.showFilter == 1,
                                expression: "showFilter == 1",
                              },
                            ],
                            attrs: {
                              src: __$_require_assets_images_condition_noselect_png__,
                              alt: "",
                            },
                          }),
                          _vm._v(" "),
                          _c("img", {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: _vm.showFilter == 0 && _vm.showDesc,
                                expression: "showFilter == 0 && showDesc",
                              },
                            ],
                            attrs: {
                              src: __$_require_assets_images_condition_up_png__,
                              alt: "",
                            },
                          }),
                          _vm._v(" "),
                          _c("img", {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: _vm.showFilter == 0 && !_vm.showDesc,
                                expression: "showFilter == 0 && !showDesc",
                              },
                            ],
                            attrs: {
                              src: __$_require_assets_images_condition_down_png__,
                              alt: "",
                            },
                          }),
                        ]
                      ),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "item",
                          on: {
                            click: function ($event) {
                              return _vm.changeFilter(1)
                            },
                          },
                        },
                        [
                          _vm._v("\n              学习进度\n              "),
                          _c("img", {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: _vm.showFilter == 0,
                                expression: "showFilter == 0",
                              },
                            ],
                            attrs: {
                              src: __$_require_assets_images_condition_noselect_png__,
                              alt: "",
                            },
                          }),
                          _vm._v(" "),
                          _c("img", {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: _vm.showFilter == 1 && _vm.showDesc,
                                expression: "showFilter == 1 && showDesc",
                              },
                            ],
                            attrs: {
                              src: __$_require_assets_images_condition_up_png__,
                              alt: "",
                            },
                          }),
                          _vm._v(" "),
                          _c("img", {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: _vm.showFilter == 1 && !_vm.showDesc,
                                expression: "showFilter == 1 && !showDesc",
                              },
                            ],
                            attrs: {
                              src: __$_require_assets_images_condition_down_png__,
                              alt: "",
                            },
                          }),
                        ]
                      ),
                    ]),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "list" },
                    [
                      _vm._l(_vm.tableData, function (item, index) {
                        return _c("div", { key: index, staticClass: "item" }, [
                          _c("div", { staticClass: "student" }, [
                            _c("div", { staticClass: "student_img" }, [
                              _c("img", { attrs: { src: item.img, alt: "" } }),
                            ]),
                            _vm._v(" "),
                            _c("div", { staticClass: "student_content" }, [
                              _c("div", { staticClass: "student_name" }, [
                                _vm._v(_vm._s(item.nickname)),
                              ]),
                              _vm._v(" "),
                              _c("div", { staticClass: "student_learn" }, [
                                _vm._v(
                                  "\n                  累计学习\n                  "
                                ),
                                _c("div", { staticClass: "color" }, [
                                  _vm._v(
                                    _vm._s(_vm.changeTime(item.totalLearnTime))
                                  ),
                                ]),
                                _vm._v(
                                  "\n                  小时，\n                  "
                                ),
                                _c("div", { staticClass: "color" }, [
                                  _vm._v(_vm._s(item.learnChapter)),
                                ]),
                                _vm._v(
                                  "\n                  章\n                "
                                ),
                              ]),
                              _vm._v(" "),
                              _c(
                                "div",
                                { staticClass: "student_bar" },
                                [
                                  _c("el-progress", {
                                    attrs: {
                                      percentage:
                                        Number(item.learningProgress) || 0,
                                      "text-inside": true,
                                      "stroke-width": 8,
                                      "define-back-color": "#ffffff",
                                    },
                                  }),
                                ],
                                1
                              ),
                            ]),
                          ]),
                          _vm._v(" "),
                          _c("div", { staticClass: "student_card" }, [
                            _c("div", { staticClass: "card_item" }, [
                              _c("div", { staticClass: "card_back" }, [
                                _c("div", { staticClass: "logo" }, [
                                  _c("img", {
                                    attrs: {
                                      src: __$_require_assets_images_condition_music_logo_png__,
                                      alt: "",
                                    },
                                  }),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "title" }, [
                                  _vm._v("音频"),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "time" }, [
                                  _vm._v(
                                    "\n                    收听\n                    "
                                  ),
                                  _c("div", { staticClass: "color" }, [
                                    _vm._v(
                                      _vm._s(_vm.changeTime(item.musicTime))
                                    ),
                                  ]),
                                  _vm._v(
                                    "\n                    小时\n                  "
                                  ),
                                ]),
                              ]),
                              _vm._v(" "),
                              _c(
                                "div",
                                { staticClass: "line" },
                                [
                                  _c(
                                    "el-popover",
                                    {
                                      attrs: {
                                        placement: "top-start",
                                        width: "280",
                                        trigger: "hover",
                                        "popper-class":
                                          "xmlStatisticalCharts-custom-popover",
                                      },
                                    },
                                    [
                                      _c("div", { staticClass: "text" }, [
                                        _vm._v(
                                          "\n                      累计收听\n                      "
                                        ),
                                        _c("div", { staticClass: "color" }, [
                                          _vm._v(
                                            _vm._s(item.musicNum) +
                                              "/" +
                                              _vm._s(_vm.musicAllNum)
                                          ),
                                        ]),
                                        _vm._v(
                                          "\n                      个，收听\n                      "
                                        ),
                                        _c("div", { staticClass: "color" }, [
                                          _vm._v(
                                            _vm._s(
                                              _vm.changeTime(item.musicTime)
                                            )
                                          ),
                                        ]),
                                        _vm._v(
                                          "\n                      小时\n                    "
                                        ),
                                      ]),
                                      _vm._v(" "),
                                      _c("el-progress", {
                                        attrs: {
                                          percentage: _vm.getNumber(
                                            item.musicNum,
                                            _vm.musicAllNum
                                          ),
                                          "stroke-width": 8,
                                          "define-back-color": "#EDEDED",
                                          color: "#33D1C9",
                                        },
                                      }),
                                      _vm._v(" "),
                                      _c(
                                        "el-button",
                                        {
                                          attrs: {
                                            slot: "reference",
                                            type: "text",
                                          },
                                          slot: "reference",
                                        },
                                        [
                                          _c("img", {
                                            staticClass: "line_img",
                                            attrs: {
                                              src: __$_require_assets_images_condition_line_music_png__,
                                              alt: "",
                                            },
                                          }),
                                        ]
                                      ),
                                    ],
                                    1
                                  ),
                                ],
                                1
                              ),
                            ]),
                            _vm._v(" "),
                            _c("div", { staticClass: "card_item video" }, [
                              _c("div", { staticClass: "card_back" }, [
                                _c("div", { staticClass: "logo" }, [
                                  _c("img", {
                                    attrs: {
                                      src: __$_require_assets_images_condition_video_logo_png__,
                                      alt: "",
                                    },
                                  }),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "title" }, [
                                  _vm._v("视频"),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "time" }, [
                                  _vm._v(
                                    "\n                    播放\n                    "
                                  ),
                                  _c("div", { staticClass: "color" }, [
                                    _vm._v(
                                      _vm._s(_vm.changeTime(item.videoTime))
                                    ),
                                  ]),
                                  _vm._v(
                                    "\n                    小时\n                  "
                                  ),
                                ]),
                              ]),
                              _vm._v(" "),
                              _c(
                                "div",
                                { staticClass: "line" },
                                [
                                  _c(
                                    "el-popover",
                                    {
                                      attrs: {
                                        placement: "top-start",
                                        width: "280",
                                        trigger: "hover",
                                        "popper-class":
                                          "xmlStatisticalCharts-custom-popover",
                                      },
                                    },
                                    [
                                      _c("div", { staticClass: "text" }, [
                                        _vm._v(
                                          "\n                      累计播放\n                      "
                                        ),
                                        _c(
                                          "div",
                                          { staticClass: "video_color" },
                                          [
                                            _vm._v(
                                              _vm._s(item.videoNum) +
                                                "/" +
                                                _vm._s(_vm.videoAllNum)
                                            ),
                                          ]
                                        ),
                                        _vm._v(
                                          "\n                      个，播放\n                      "
                                        ),
                                        _c(
                                          "div",
                                          { staticClass: "video_color" },
                                          [
                                            _vm._v(
                                              _vm._s(
                                                _vm.changeTime(item.videoTime)
                                              )
                                            ),
                                          ]
                                        ),
                                        _vm._v(
                                          "\n                      小时\n                    "
                                        ),
                                      ]),
                                      _vm._v(" "),
                                      _c("el-progress", {
                                        attrs: {
                                          percentage: _vm.getNumber(
                                            item.videoNum,
                                            _vm.videoAllNum
                                          ),
                                          "stroke-width": 8,
                                          "define-back-color": "#EDEDED",
                                          color: "#CC5120",
                                        },
                                      }),
                                      _vm._v(" "),
                                      _c(
                                        "el-button",
                                        {
                                          attrs: {
                                            slot: "reference",
                                            type: "text",
                                          },
                                          slot: "reference",
                                        },
                                        [
                                          _c("img", {
                                            staticClass: "line_img",
                                            attrs: {
                                              src: __$_require_assets_images_condition_line_video_png__,
                                              alt: "",
                                            },
                                          }),
                                        ]
                                      ),
                                    ],
                                    1
                                  ),
                                ],
                                1
                              ),
                            ]),
                            _vm._v(" "),
                            _c("div", { staticClass: "card_item" }, [
                              _c("div", { staticClass: "card_back" }, [
                                _c("div", { staticClass: "logo" }, [
                                  _c("img", {
                                    attrs: {
                                      src: __$_require_assets_images_condition_pic_logo_png__,
                                      alt: "",
                                    },
                                  }),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "title" }, [
                                  _vm._v("图片"),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "time" }, [
                                  _vm._v(
                                    "\n                    查看\n                    "
                                  ),
                                  _c("div", { staticClass: "color" }, [
                                    _vm._v(_vm._s(item.imageNum)),
                                  ]),
                                  _vm._v(
                                    "\n                    个\n                  "
                                  ),
                                ]),
                              ]),
                              _vm._v(" "),
                              _c(
                                "div",
                                { staticClass: "line" },
                                [
                                  _c(
                                    "el-popover",
                                    {
                                      attrs: {
                                        placement: "top-start",
                                        width: "280",
                                        trigger: "hover",
                                        "popper-class":
                                          "xmlStatisticalCharts-custom-popover",
                                      },
                                    },
                                    [
                                      _c("div", { staticClass: "text" }, [
                                        _vm._v(
                                          "\n                      累计查看\n                      "
                                        ),
                                        _c(
                                          "div",
                                          { staticClass: "pic_color" },
                                          [
                                            _vm._v(
                                              _vm._s(item.imageNum) +
                                                "/" +
                                                _vm._s(_vm.imageAllNum)
                                            ),
                                          ]
                                        ),
                                        _vm._v(
                                          "\n                      个，共\n                      "
                                        ),
                                        _c(
                                          "div",
                                          { staticClass: "pic_color" },
                                          [_vm._v(_vm._s(item.imgLearnNum))]
                                        ),
                                        _vm._v(
                                          "\n                      次\n                    "
                                        ),
                                      ]),
                                      _vm._v(" "),
                                      _c("el-progress", {
                                        attrs: {
                                          percentage: _vm.getNumber(
                                            item.imageNum,
                                            _vm.imageAllNum
                                          ),
                                          "stroke-width": 8,
                                          "define-back-color": "#EDEDED",
                                          color: "#7BC0FC",
                                        },
                                      }),
                                      _vm._v(" "),
                                      _c(
                                        "el-button",
                                        {
                                          attrs: {
                                            slot: "reference",
                                            type: "text",
                                          },
                                          slot: "reference",
                                        },
                                        [
                                          _c("img", {
                                            staticClass: "line_img",
                                            attrs: {
                                              src: __$_require_assets_images_condition_line_pic_png__,
                                              alt: "",
                                            },
                                          }),
                                        ]
                                      ),
                                    ],
                                    1
                                  ),
                                ],
                                1
                              ),
                            ]),
                            _vm._v(" "),
                            _c("div", { staticClass: "card_item" }, [
                              _c("div", { staticClass: "card_back" }, [
                                _c("div", { staticClass: "logo" }, [
                                  _c("img", {
                                    attrs: {
                                      src: __$_require_assets_images_condition_test_logo_png__,
                                      alt: "",
                                    },
                                  }),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "title" }, [
                                  _vm._v("试题"),
                                ]),
                                _vm._v(" "),
                                _c("div", { staticClass: "time" }, [
                                  _vm._v(
                                    "\n                    完成\n                    "
                                  ),
                                  _c("div", { staticClass: "color" }, [
                                    _vm._v(_vm._s(item.testNum)),
                                  ]),
                                  _vm._v(
                                    "\n                    道题\n                  "
                                  ),
                                ]),
                              ]),
                              _vm._v(" "),
                              _c(
                                "div",
                                { staticClass: "line" },
                                [
                                  _c(
                                    "el-popover",
                                    {
                                      attrs: {
                                        placement: "top-start",
                                        width: "320",
                                        trigger: "hover",
                                        "popper-class":
                                          "xmlStatisticalCharts-custom-popover",
                                      },
                                    },
                                    [
                                      _c("div", { staticClass: "text" }, [
                                        _vm._v(
                                          "\n                      累计完成\n                      "
                                        ),
                                        _c(
                                          "div",
                                          { staticClass: "test_color" },
                                          [
                                            _vm._v(
                                              _vm._s(item.testNum) +
                                                "/" +
                                                _vm._s(_vm.testAllNum)
                                            ),
                                          ]
                                        ),
                                        _vm._v(
                                          "\n                      题，完成率\n                      "
                                        ),
                                        _c(
                                          "div",
                                          { staticClass: "test_color" },
                                          [
                                            _vm._v(
                                              _vm._s(
                                                _vm.getNumbers(
                                                  item.testNum,
                                                  _vm.testAllNum
                                                )
                                              ) + "%"
                                            ),
                                          ]
                                        ),
                                        _vm._v(
                                          "\n                      ，正确率 \n                      "
                                        ),
                                        _c(
                                          "div",
                                          { staticClass: "test_color" },
                                          [
                                            _vm._v(
                                              _vm._s(
                                                item.accuracy
                                                  ? item.accuracy
                                                  : "0"
                                              ) + "%"
                                            ),
                                          ]
                                        ),
                                      ]),
                                      _vm._v(" "),
                                      _c("el-progress", {
                                        attrs: {
                                          percentage: _vm.getNumber(
                                            item.testNum,
                                            _vm.testAllNum
                                          ),
                                          "stroke-width": 8,
                                          "define-back-color": "#EDEDED",
                                          color: "#F979B7",
                                        },
                                      }),
                                      _vm._v(" "),
                                      _c(
                                        "el-button",
                                        {
                                          attrs: {
                                            slot: "reference",
                                            type: "text",
                                          },
                                          slot: "reference",
                                        },
                                        [
                                          _c("img", {
                                            staticClass: "line_img",
                                            attrs: {
                                              src: __$_require_assets_images_condition_line_test_png__,
                                              alt: "",
                                            },
                                          }),
                                        ]
                                      ),
                                    ],
                                    1
                                  ),
                                ],
                                1
                              ),
                            ]),
                          ]),
                        ])
                      }),
                      _vm._v(" "),
                      _c("el-pagination", {
                        attrs: {
                          "current-page": _vm.currentPage,
                          "page-size": 5,
                          layout: "total, prev, pager, next",
                          total: _vm.teacherDate.studentList.length,
                        },
                        on: {
                          "size-change": _vm.handleSizeChange,
                          "current-change": _vm.handleCurrentChange,
                          "update:currentPage": function ($event) {
                            _vm.currentPage = $event;
                          },
                          "update:current-page": function ($event) {
                            _vm.currentPage = $event;
                          },
                        },
                      }),
                    ],
                    2
                  ),
                ]),
              ])
            : _vm._e(),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2P = [];
__vue_render__$2P._withStripped = true;

  /* style */
  const __vue_inject_styles__$2P = undefined;
  /* scoped */
  const __vue_scope_id__$2P = "data-v-7a034f98";
  /* module identifier */
  const __vue_module_identifier__$2P = undefined;
  /* functional template */
  const __vue_is_functional_template__$2P = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2P = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2P, staticRenderFns: __vue_staticRenderFns__$2P },
    __vue_inject_styles__$2P,
    __vue_script__$2P,
    __vue_scope_id__$2P,
    __vue_is_functional_template__$2P,
    __vue_module_identifier__$2P,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$2O = {
  name: 'LearningProgress',
  props: {
    progressData: {
      type: Object,
      default: () => {}
    },
    buttonText: {
      type: Object,
      default() {
        return {
          text: "",
          cancel: '取消',
          confirm: '确定'
        };
      }
    }
  },
  data() {
    return {
      dialogVisible: true,
      type: '1'
    };
  },
  computed: {},
  methods: {
    open(e) {
      this.type = e.type || '1';
      this.dialogVisible = true;
    },
    handleClose() {
      // this.$emit('update:visible', false)
      this.dialogVisible = false;
    },
    handleCancel() {
      this.dialogVisible = false;
      this.$emit('cancel');
    },
    handleConfirm() {
      this.dialogVisible = false;
      if (this.type == '1') {
        this.$emit('confirmContinueReading');
      } else if (this.type == '2') {
        this.$emit('confirmAnswerQuestions');
      }
    }
  }
};

/* script */
const __vue_script__$2O = script$2O;

/* template */
var __vue_render__$2O = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      staticClass: "xml-learning-progress-dialog",
      attrs: {
        visible: _vm.dialogVisible,
        "show-close": false,
        "close-on-click-modal": false,
        "close-on-press-escape": false,
        width: "340px",
      },
      on: {
        "update:visible": function ($event) {
          _vm.dialogVisible = $event;
        },
      },
    },
    [
      _c("div", { staticClass: "progress-modal" }, [
        _c("div", { staticClass: "modal-header" }),
        _vm._v(" "),
        _vm.type == 1
          ? _c("div", { staticClass: "modal-content" }, [
              _c("div", { staticClass: "greeting" }, [
                _vm._v(
                  "您好，" +
                    _vm._s(_vm.progressData.studentName || "") +
                    "同学~"
                ),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "reading-info" }, [
                _vm._v("\n        当前您已阅读"),
                _c("span", { staticClass: "highlight" }, [
                  _vm._v(" " + _vm._s(_vm.progressData.readingDays || 0)),
                ]),
                _vm._v(" 天 | 累计阅读"),
                _c("span", { staticClass: "highlight" }, [
                  _vm._v(
                    "\n          " + _vm._s(_vm.progressData.readingTime || 0)
                  ),
                ]),
                _vm._v("\n        min\n      "),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "progress-bar" }, [
                _vm._v("\n        当前刷书进度："),
                _c("span", { staticClass: "progress-value" }, [
                  _vm._v(" " + _vm._s(_vm.progressData.progress || 0) + "%"),
                ]),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "tips-box" }, [
                _c("div", { staticClass: "tips" }, [
                  _c("div", [_vm._v("每天翻几页，知识小金库+1%")]),
                  _vm._v(" "),
                  _c("div", [_vm._v("碎片时间翻几页，得概率石~")]),
                ]),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "question" }, [
                _vm._v("检测到上次阅读位置，是否继续阅读？"),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "modal-actions" }, [
                _c(
                  "button",
                  {
                    staticClass: "cancel-btn",
                    on: { click: _vm.handleCancel },
                  },
                  [_vm._v(_vm._s(_vm.buttonText.cancel))]
                ),
                _vm._v(" "),
                _c(
                  "button",
                  {
                    staticClass: "confirm-btn",
                    on: { click: _vm.handleConfirm },
                  },
                  [_vm._v(_vm._s(_vm.buttonText.confirm))]
                ),
              ]),
            ])
          : _vm.type == 2
          ? _c("div", { staticClass: "modal-content xml-text-center" }, [
              _c("div", { staticClass: "reading-info" }, [
                _vm._v("\n        您已完成"),
                _c("span", { staticClass: "highlight" }, [
                  _vm._v(" " + _vm._s(_vm.progressData.readingDays)),
                ]),
                _vm._v("的学习\n      "),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "reading-info" }, [
                _vm._v("发现章后练习还未完成，"),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "reading-info" }, [
                _vm._v("抽空完成一下吧！"),
              ]),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "modal-actions",
                  staticStyle: { "padding-top": "20px" },
                },
                [
                  _c(
                    "button",
                    {
                      staticClass: "cancel-btn",
                      on: { click: _vm.handleCancel },
                    },
                    [_vm._v(_vm._s(_vm.buttonText.cancel))]
                  ),
                  _vm._v(" "),
                  _c(
                    "button",
                    {
                      staticClass: "confirm-btn",
                      on: { click: _vm.handleConfirm },
                    },
                    [_vm._v(_vm._s(_vm.buttonText.confirm))]
                  ),
                ]
              ),
            ])
          : _c("div", { staticClass: "modal-content" }, [
              _c("div", { staticClass: "reading-info" }, [
                _vm._v(_vm._s(_vm.buttonText.text)),
              ]),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "modal-actions",
                  staticStyle: { "padding-top": "20px" },
                },
                [
                  _c(
                    "button",
                    {
                      staticClass: "cancel-btn",
                      on: { click: _vm.handleCancel },
                    },
                    [_vm._v(_vm._s(_vm.buttonText.cancel))]
                  ),
                  _vm._v(" "),
                  _c(
                    "button",
                    {
                      staticClass: "confirm-btn",
                      on: { click: _vm.handleConfirm },
                    },
                    [_vm._v(_vm._s(_vm.buttonText.confirm))]
                  ),
                ]
              ),
            ]),
        _vm._v(" "),
        _c("div", { staticClass: "modal-mascot modal-mascot2" }),
        _vm._v(" "),
        _c(
          "div",
          { staticClass: "close-btn", on: { click: _vm.handleClose } },
          [_c("i", { staticClass: "el-icon-close" })]
        ),
      ]),
    ]
  )
};
var __vue_staticRenderFns__$2O = [];
__vue_render__$2O._withStripped = true;

  /* style */
  const __vue_inject_styles__$2O = undefined;
  /* scoped */
  const __vue_scope_id__$2O = undefined;
  /* module identifier */
  const __vue_module_identifier__$2O = undefined;
  /* functional template */
  const __vue_is_functional_template__$2O = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2O = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2O, staticRenderFns: __vue_staticRenderFns__$2O },
    __vue_inject_styles__$2O,
    __vue_script__$2O,
    __vue_scope_id__$2O,
    __vue_is_functional_template__$2O,
    __vue_module_identifier__$2O,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$2N = {
  name: 'classGrade',
  props: {
    pageType: {
      type: String,
      default: 'h5'
    },
    userType: {
      type: String,
      default: 'teacher'
    },
    teacherDateclass: {
      type: Array,
      default: () => []
    },
    userInfoparms: {
      type: Object,
      default: () => {}
    }
  },
  mounted() {},
  data() {
    return {
      dialogVisible: false,
      select_index: '',
      select_item: '',
      visible: false,
      tableData: [],
      total: 0,
      page: 1,
      size: 7,
      colorData: ['#FC7293', '#9D91F3', '#47C8E8', '#64A4FC']
    };
  },
  methods: {
    open() {
      this.dialogVisible = true;
    },
    getbox(item, index) {
      this.select_index = index;
      this.select_item = item;
    },
    //分页
    gettableData() {
      let data = JSON.parse(JSON.stringify(this.teacherDate.classstudent));
      this.tableData = data.splice((this.page - 1) * this.size, this.size);
      this.total = this.teacherDate.classstudent.length;
    },
    openClass(item) {
      window.open(item.redirctUrl);
    }
  }
};

/* script */
const __vue_script__$2N = script$2N;
/* template */
var __vue_render__$2N = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    [
      _c(
        "el-dialog",
        {
          staticClass: "xmlStatisticalCharts",
          attrs: {
            visible: _vm.dialogVisible,
            width: _vm.pageType == "pc" ? "910px" : "90%",
            "destroy-on-close": true,
            "custom-class": "xml-epub-pdf-dialog",
          },
          on: {
            "update:visible": function ($event) {
              _vm.dialogVisible = $event;
            },
          },
        },
        [
          _vm.userType == "student"
            ? _c("div", [
                _c("div", { staticClass: "student_top" }, [
                  _c("img", {
                    staticClass: "student_img",
                    attrs: { src: _vm.userInfoparms.img },
                  }),
                  _vm._v(" "),
                  _c("div", { staticStyle: { "margin-left": "30px" } }, [
                    _c("div", { staticStyle: { "font-size": "20px" } }, [
                      _vm._v(
                        _vm._s(_vm.userInfoparms.nickname) +
                          _vm._s(
                            _vm.userType == "teacher" ? "(教师)" : "(学生)"
                          )
                      ),
                    ]),
                  ]),
                ]),
                _vm._v(" "),
                _c("div", { staticStyle: { padding: "10px 30px 50px 30px" } }, [
                  _c("div", { staticStyle: { "font-size": "16px" } }, [
                    _vm._v("班级列表"),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "student_bottom" },
                    _vm._l(_vm.teacherDateclass, function (item, index) {
                      return _c(
                        "div",
                        {
                          key: index,
                          staticClass: "student_bottom_box",
                          style: { background: _vm.colorData[index % 4] },
                          on: {
                            click: function ($event) {
                              return _vm.openClass(item)
                            },
                          },
                        },
                        [
                          _c(
                            "div",
                            {
                              staticStyle: {
                                display: "flex",
                                padding: "10px",
                                "align-items": "center",
                              },
                            },
                            [
                              _c("div", [
                                _c("img", {
                                  staticStyle: {
                                    width: "50px",
                                    height: "50px",
                                    "border-radius": "50px",
                                  },
                                  attrs: { src: item.litpic },
                                }),
                              ]),
                              _vm._v(" "),
                              _c(
                                "div",
                                { staticStyle: { "margin-left": "20px" } },
                                [
                                  _c("div", [
                                    _vm._v("班级名称： " + _vm._s(item.title)),
                                  ]),
                                  _vm._v(" "),
                                  _c("div", [
                                    _vm._v(
                                      "班级人数： " +
                                        _vm._s(item.classStudentNum) +
                                        " 人"
                                    ),
                                  ]),
                                ]
                              ),
                            ]
                          ),
                        ]
                      )
                    }),
                    0
                  ),
                ]),
              ])
            : _vm._e(),
          _vm._v(" "),
          _vm.userType == "teacher"
            ? _c("div", [
                _c("div", { staticClass: "student_top" }, [
                  _c("img", {
                    staticClass: "student_img",
                    attrs: { src: _vm.userInfoparms.img },
                  }),
                  _vm._v(" "),
                  _c("div", { staticStyle: { "margin-left": "30px" } }, [
                    _c("div", { staticStyle: { "font-size": "20px" } }, [
                      _vm._v(
                        _vm._s(_vm.userInfoparms.nickname) +
                          _vm._s(
                            _vm.userType == "teacher" ? "(教师)" : "(学生)"
                          )
                      ),
                    ]),
                  ]),
                ]),
                _vm._v(" "),
                _c("div", { staticStyle: { padding: "10px 30px 50px 30px" } }, [
                  _c("div", { staticStyle: { "font-size": "16px" } }, [
                    _vm._v("班级列表"),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "student_bottom" },
                    _vm._l(_vm.teacherDateclass, function (item, index) {
                      return _c(
                        "div",
                        {
                          key: index,
                          staticClass: "student_bottom_box",
                          style: { background: _vm.colorData[index % 4] },
                          on: {
                            click: function ($event) {
                              return _vm.openClass(item)
                            },
                          },
                        },
                        [
                          _c(
                            "div",
                            {
                              staticStyle: {
                                display: "flex",
                                padding: "10px",
                                "align-items": "center",
                              },
                            },
                            [
                              _c("div", [
                                _c("img", {
                                  staticStyle: {
                                    width: "50px",
                                    height: "50px",
                                    "border-radius": "50px",
                                  },
                                  attrs: { src: item.litpic },
                                }),
                              ]),
                              _vm._v(" "),
                              _c(
                                "div",
                                { staticStyle: { "margin-left": "20px" } },
                                [
                                  _c("div", [
                                    _vm._v(" 班级名称：" + _vm._s(item.title)),
                                  ]),
                                  _vm._v(" "),
                                  _c("div", [
                                    _vm._v(
                                      " 班级人数：" +
                                        _vm._s(item.classStudentNum) +
                                        " 人"
                                    ),
                                  ]),
                                ]
                              ),
                            ]
                          ),
                        ]
                      )
                    }),
                    0
                  ),
                ]),
              ])
            : _vm._e(),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2N = [];
__vue_render__$2N._withStripped = true;

  /* style */
  const __vue_inject_styles__$2N = undefined;
  /* scoped */
  const __vue_scope_id__$2N = "data-v-5eb5daa9";
  /* module identifier */
  const __vue_module_identifier__$2N = undefined;
  /* functional template */
  const __vue_is_functional_template__$2N = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2N = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2N, staticRenderFns: __vue_staticRenderFns__$2N },
    __vue_inject_styles__$2N,
    __vue_script__$2N,
    __vue_scope_id__$2N,
    __vue_is_functional_template__$2N,
    __vue_module_identifier__$2N,
    false,
    undefined,
    undefined,
    undefined
  );

var mark = createCommonjsModule(function (module, exports) {
/*!***************************************************
* mark.js v8.11.1
* https://markjs.io/
* Copyright (c) 2014–2018, Julian Kühnel
* Released under the MIT license https://git.io/vwTVl
*****************************************************/

(function (global, factory) {
  module.exports = factory() ;
})(commonjsGlobal, function () {

  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
    return typeof obj;
  } : function (obj) {
    return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  };
  var classCallCheck = function (instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  };
  var createClass = function () {
    function defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }
    return function (Constructor, protoProps, staticProps) {
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
      if (staticProps) defineProperties(Constructor, staticProps);
      return Constructor;
    };
  }();
  var _extends = Object.assign || function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
    return target;
  };
  var DOMIterator = function () {
    function DOMIterator(ctx) {
      var iframes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
      var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
      var iframesTimeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5000;
      classCallCheck(this, DOMIterator);
      this.ctx = ctx;
      this.iframes = iframes;
      this.exclude = exclude;
      this.iframesTimeout = iframesTimeout;
    }
    createClass(DOMIterator, [{
      key: 'getContexts',
      value: function getContexts() {
        var ctx = void 0,
          filteredCtx = [];
        if (typeof this.ctx === 'undefined' || !this.ctx) {
          ctx = [];
        } else if (NodeList.prototype.isPrototypeOf(this.ctx)) {
          ctx = Array.prototype.slice.call(this.ctx);
        } else if (Array.isArray(this.ctx)) {
          ctx = this.ctx;
        } else if (typeof this.ctx === 'string') {
          ctx = Array.prototype.slice.call(document.querySelectorAll(this.ctx));
        } else {
          ctx = [this.ctx];
        }
        ctx.forEach(function (ctx) {
          var isDescendant = filteredCtx.filter(function (contexts) {
            return contexts.contains(ctx);
          }).length > 0;
          if (filteredCtx.indexOf(ctx) === -1 && !isDescendant) {
            filteredCtx.push(ctx);
          }
        });
        return filteredCtx;
      }
    }, {
      key: 'getIframeContents',
      value: function getIframeContents(ifr, successFn) {
        var errorFn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
        var doc = void 0;
        try {
          var ifrWin = ifr.contentWindow;
          doc = ifrWin.document;
          if (!ifrWin || !doc) {
            throw new Error('iframe inaccessible');
          }
        } catch (e) {
          errorFn();
        }
        if (doc) {
          successFn(doc);
        }
      }
    }, {
      key: 'isIframeBlank',
      value: function isIframeBlank(ifr) {
        var bl = 'about:blank',
          src = ifr.getAttribute('src').trim(),
          href = ifr.contentWindow.location.href;
        return href === bl && src !== bl && src;
      }
    }, {
      key: 'observeIframeLoad',
      value: function observeIframeLoad(ifr, successFn, errorFn) {
        var _this = this;
        var called = false,
          tout = null;
        var listener = function listener() {
          if (called) {
            return;
          }
          called = true;
          clearTimeout(tout);
          try {
            if (!_this.isIframeBlank(ifr)) {
              ifr.removeEventListener('load', listener);
              _this.getIframeContents(ifr, successFn, errorFn);
            }
          } catch (e) {
            errorFn();
          }
        };
        ifr.addEventListener('load', listener);
        tout = setTimeout(listener, this.iframesTimeout);
      }
    }, {
      key: 'onIframeReady',
      value: function onIframeReady(ifr, successFn, errorFn) {
        try {
          if (ifr.contentWindow.document.readyState === 'complete') {
            if (this.isIframeBlank(ifr)) {
              this.observeIframeLoad(ifr, successFn, errorFn);
            } else {
              this.getIframeContents(ifr, successFn, errorFn);
            }
          } else {
            this.observeIframeLoad(ifr, successFn, errorFn);
          }
        } catch (e) {
          errorFn();
        }
      }
    }, {
      key: 'waitForIframes',
      value: function waitForIframes(ctx, done) {
        var _this2 = this;
        var eachCalled = 0;
        this.forEachIframe(ctx, function () {
          return true;
        }, function (ifr) {
          eachCalled++;
          _this2.waitForIframes(ifr.querySelector('html'), function () {
            if (! --eachCalled) {
              done();
            }
          });
        }, function (handled) {
          if (!handled) {
            done();
          }
        });
      }
    }, {
      key: 'forEachIframe',
      value: function forEachIframe(ctx, filter, each) {
        var _this3 = this;
        var end = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};
        var ifr = ctx.querySelectorAll('iframe'),
          open = ifr.length,
          handled = 0;
        ifr = Array.prototype.slice.call(ifr);
        var checkEnd = function checkEnd() {
          if (--open <= 0) {
            end(handled);
          }
        };
        if (!open) {
          checkEnd();
        }
        ifr.forEach(function (ifr) {
          if (DOMIterator.matches(ifr, _this3.exclude)) {
            checkEnd();
          } else {
            _this3.onIframeReady(ifr, function (con) {
              if (filter(ifr)) {
                handled++;
                each(con);
              }
              checkEnd();
            }, checkEnd);
          }
        });
      }
    }, {
      key: 'createIterator',
      value: function createIterator(ctx, whatToShow, filter) {
        return document.createNodeIterator(ctx, whatToShow, filter, false);
      }
    }, {
      key: 'createInstanceOnIframe',
      value: function createInstanceOnIframe(contents) {
        return new DOMIterator(contents.querySelector('html'), this.iframes);
      }
    }, {
      key: 'compareNodeIframe',
      value: function compareNodeIframe(node, prevNode, ifr) {
        var compCurr = node.compareDocumentPosition(ifr),
          prev = Node.DOCUMENT_POSITION_PRECEDING;
        if (compCurr & prev) {
          if (prevNode !== null) {
            var compPrev = prevNode.compareDocumentPosition(ifr),
              after = Node.DOCUMENT_POSITION_FOLLOWING;
            if (compPrev & after) {
              return true;
            }
          } else {
            return true;
          }
        }
        return false;
      }
    }, {
      key: 'getIteratorNode',
      value: function getIteratorNode(itr) {
        var prevNode = itr.previousNode();
        var node = void 0;
        if (prevNode === null) {
          node = itr.nextNode();
        } else {
          node = itr.nextNode() && itr.nextNode();
        }
        return {
          prevNode: prevNode,
          node: node
        };
      }
    }, {
      key: 'checkIframeFilter',
      value: function checkIframeFilter(node, prevNode, currIfr, ifr) {
        var key = false,
          handled = false;
        ifr.forEach(function (ifrDict, i) {
          if (ifrDict.val === currIfr) {
            key = i;
            handled = ifrDict.handled;
          }
        });
        if (this.compareNodeIframe(node, prevNode, currIfr)) {
          if (key === false && !handled) {
            ifr.push({
              val: currIfr,
              handled: true
            });
          } else if (key !== false && !handled) {
            ifr[key].handled = true;
          }
          return true;
        }
        if (key === false) {
          ifr.push({
            val: currIfr,
            handled: false
          });
        }
        return false;
      }
    }, {
      key: 'handleOpenIframes',
      value: function handleOpenIframes(ifr, whatToShow, eCb, fCb) {
        var _this4 = this;
        ifr.forEach(function (ifrDict) {
          if (!ifrDict.handled) {
            _this4.getIframeContents(ifrDict.val, function (con) {
              _this4.createInstanceOnIframe(con).forEachNode(whatToShow, eCb, fCb);
            });
          }
        });
      }
    }, {
      key: 'iterateThroughNodes',
      value: function iterateThroughNodes(whatToShow, ctx, eachCb, filterCb, doneCb) {
        var _this5 = this;
        var itr = this.createIterator(ctx, whatToShow, filterCb);
        var ifr = [],
          elements = [],
          node = void 0,
          prevNode = void 0,
          retrieveNodes = function retrieveNodes() {
            var _getIteratorNode = _this5.getIteratorNode(itr);
            prevNode = _getIteratorNode.prevNode;
            node = _getIteratorNode.node;
            return node;
          };
        while (retrieveNodes()) {
          if (this.iframes) {
            this.forEachIframe(ctx, function (currIfr) {
              return _this5.checkIframeFilter(node, prevNode, currIfr, ifr);
            }, function (con) {
              _this5.createInstanceOnIframe(con).forEachNode(whatToShow, function (ifrNode) {
                return elements.push(ifrNode);
              }, filterCb);
            });
          }
          elements.push(node);
        }
        elements.forEach(function (node) {
          eachCb(node);
        });
        if (this.iframes) {
          this.handleOpenIframes(ifr, whatToShow, eachCb, filterCb);
        }
        doneCb();
      }
    }, {
      key: 'forEachNode',
      value: function forEachNode(whatToShow, each, filter) {
        var _this6 = this;
        var done = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};
        var contexts = this.getContexts();
        var open = contexts.length;
        if (!open) {
          done();
        }
        contexts.forEach(function (ctx) {
          var ready = function ready() {
            _this6.iterateThroughNodes(whatToShow, ctx, each, filter, function () {
              if (--open <= 0) {
                done();
              }
            });
          };
          if (_this6.iframes) {
            _this6.waitForIframes(ctx, ready);
          } else {
            ready();
          }
        });
      }
    }], [{
      key: 'matches',
      value: function matches(element, selector) {
        var selectors = typeof selector === 'string' ? [selector] : selector,
          fn = element.matches || element.matchesSelector || element.msMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector || element.webkitMatchesSelector;
        if (fn) {
          var match = false;
          selectors.every(function (sel) {
            if (fn.call(element, sel)) {
              match = true;
              return false;
            }
            return true;
          });
          return match;
        } else {
          return false;
        }
      }
    }]);
    return DOMIterator;
  }();
  var Mark$1 = function () {
    function Mark(ctx) {
      classCallCheck(this, Mark);
      this.ctx = ctx;
      this.ie = false;
      var ua = window.navigator.userAgent;
      if (ua.indexOf('MSIE') > -1 || ua.indexOf('Trident') > -1) {
        this.ie = true;
      }
    }
    createClass(Mark, [{
      key: 'log',
      value: function log(msg) {
        var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'debug';
        var log = this.opt.log;
        if (!this.opt.debug) {
          return;
        }
        if ((typeof log === 'undefined' ? 'undefined' : _typeof(log)) === 'object' && typeof log[level] === 'function') {
          log[level]('mark.js: ' + msg);
        }
      }
    }, {
      key: 'escapeStr',
      value: function escapeStr(str) {
        return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
      }
    }, {
      key: 'createRegExp',
      value: function createRegExp(str) {
        if (this.opt.wildcards !== 'disabled') {
          str = this.setupWildcardsRegExp(str);
        }
        str = this.escapeStr(str);
        if (Object.keys(this.opt.synonyms).length) {
          str = this.createSynonymsRegExp(str);
        }
        if (this.opt.ignoreJoiners || this.opt.ignorePunctuation.length) {
          str = this.setupIgnoreJoinersRegExp(str);
        }
        if (this.opt.diacritics) {
          str = this.createDiacriticsRegExp(str);
        }
        str = this.createMergedBlanksRegExp(str);
        if (this.opt.ignoreJoiners || this.opt.ignorePunctuation.length) {
          str = this.createJoinersRegExp(str);
        }
        if (this.opt.wildcards !== 'disabled') {
          str = this.createWildcardsRegExp(str);
        }
        str = this.createAccuracyRegExp(str);
        return str;
      }
    }, {
      key: 'createSynonymsRegExp',
      value: function createSynonymsRegExp(str) {
        var syn = this.opt.synonyms,
          sens = this.opt.caseSensitive ? '' : 'i',
          joinerPlaceholder = this.opt.ignoreJoiners || this.opt.ignorePunctuation.length ? '\0' : '';
        for (var index in syn) {
          if (syn.hasOwnProperty(index)) {
            var value = syn[index],
              k1 = this.opt.wildcards !== 'disabled' ? this.setupWildcardsRegExp(index) : this.escapeStr(index),
              k2 = this.opt.wildcards !== 'disabled' ? this.setupWildcardsRegExp(value) : this.escapeStr(value);
            if (k1 !== '' && k2 !== '') {
              str = str.replace(new RegExp('(' + this.escapeStr(k1) + '|' + this.escapeStr(k2) + ')', 'gm' + sens), joinerPlaceholder + ('(' + this.processSynomyms(k1) + '|') + (this.processSynomyms(k2) + ')') + joinerPlaceholder);
            }
          }
        }
        return str;
      }
    }, {
      key: 'processSynomyms',
      value: function processSynomyms(str) {
        if (this.opt.ignoreJoiners || this.opt.ignorePunctuation.length) {
          str = this.setupIgnoreJoinersRegExp(str);
        }
        return str;
      }
    }, {
      key: 'setupWildcardsRegExp',
      value: function setupWildcardsRegExp(str) {
        str = str.replace(/(?:\\)*\?/g, function (val) {
          return val.charAt(0) === '\\' ? '?' : '\x01';
        });
        return str.replace(/(?:\\)*\*/g, function (val) {
          return val.charAt(0) === '\\' ? '*' : '\x02';
        });
      }
    }, {
      key: 'createWildcardsRegExp',
      value: function createWildcardsRegExp(str) {
        var spaces = this.opt.wildcards === 'withSpaces';
        return str.replace(/\u0001/g, spaces ? '[\\S\\s]?' : '\\S?').replace(/\u0002/g, spaces ? '[\\S\\s]*?' : '\\S*');
      }
    }, {
      key: 'setupIgnoreJoinersRegExp',
      value: function setupIgnoreJoinersRegExp(str) {
        return str.replace(/[^(|)\\]/g, function (val, indx, original) {
          var nextChar = original.charAt(indx + 1);
          if (/[(|)\\]/.test(nextChar) || nextChar === '') {
            return val;
          } else {
            return val + '\0';
          }
        });
      }
    }, {
      key: 'createJoinersRegExp',
      value: function createJoinersRegExp(str) {
        var joiner = [];
        var ignorePunctuation = this.opt.ignorePunctuation;
        if (Array.isArray(ignorePunctuation) && ignorePunctuation.length) {
          joiner.push(this.escapeStr(ignorePunctuation.join('')));
        }
        if (this.opt.ignoreJoiners) {
          joiner.push('\\u00ad\\u200b\\u200c\\u200d');
        }
        return joiner.length ? str.split(/\u0000+/).join('[' + joiner.join('') + ']*') : str;
      }
    }, {
      key: 'createDiacriticsRegExp',
      value: function createDiacriticsRegExp(str) {
        var sens = this.opt.caseSensitive ? '' : 'i',
          dct = this.opt.caseSensitive ? ['aàáảãạăằắẳẵặâầấẩẫậäåāą', 'AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ', 'cçćč', 'CÇĆČ', 'dđď', 'DĐĎ', 'eèéẻẽẹêềếểễệëěēę', 'EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ', 'iìíỉĩịîïī', 'IÌÍỈĨỊÎÏĪ', 'lł', 'LŁ', 'nñňń', 'NÑŇŃ', 'oòóỏõọôồốổỗộơởỡớờợöøō', 'OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ', 'rř', 'RŘ', 'sšśșş', 'SŠŚȘŞ', 'tťțţ', 'TŤȚŢ', 'uùúủũụưừứửữựûüůū', 'UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ', 'yýỳỷỹỵÿ', 'YÝỲỶỸỴŸ', 'zžżź', 'ZŽŻŹ'] : ['aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ', 'cçćčCÇĆČ', 'dđďDĐĎ', 'eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ', 'iìíỉĩịîïīIÌÍỈĨỊÎÏĪ', 'lłLŁ', 'nñňńNÑŇŃ', 'oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ', 'rřRŘ', 'sšśșşSŠŚȘŞ', 'tťțţTŤȚŢ', 'uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ', 'yýỳỷỹỵÿYÝỲỶỸỴŸ', 'zžżźZŽŻŹ'];
        var handled = [];
        str.split('').forEach(function (ch) {
          dct.every(function (dct) {
            if (dct.indexOf(ch) !== -1) {
              if (handled.indexOf(dct) > -1) {
                return false;
              }
              str = str.replace(new RegExp('[' + dct + ']', 'gm' + sens), '[' + dct + ']');
              handled.push(dct);
            }
            return true;
          });
        });
        return str;
      }
    }, {
      key: 'createMergedBlanksRegExp',
      value: function createMergedBlanksRegExp(str) {
        return str.replace(/[\s]+/gmi, '[\\s]+');
      }
    }, {
      key: 'createAccuracyRegExp',
      value: function createAccuracyRegExp(str) {
        var _this = this;
        var chars = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~¡¿';
        var acc = this.opt.accuracy,
          val = typeof acc === 'string' ? acc : acc.value,
          ls = typeof acc === 'string' ? [] : acc.limiters,
          lsJoin = '';
        ls.forEach(function (limiter) {
          lsJoin += '|' + _this.escapeStr(limiter);
        });
        switch (val) {
          case 'partially':
          default:
            return '()(' + str + ')';
          case 'complementary':
            lsJoin = '\\s' + (lsJoin ? lsJoin : this.escapeStr(chars));
            return '()([^' + lsJoin + ']*' + str + '[^' + lsJoin + ']*)';
          case 'exactly':
            return '(^|\\s' + lsJoin + ')(' + str + ')(?=$|\\s' + lsJoin + ')';
        }
      }
    }, {
      key: 'getSeparatedKeywords',
      value: function getSeparatedKeywords(sv) {
        var _this2 = this;
        var stack = [];
        sv.forEach(function (kw) {
          if (!_this2.opt.separateWordSearch) {
            if (kw.trim() && stack.indexOf(kw) === -1) {
              stack.push(kw);
            }
          } else {
            kw.split(' ').forEach(function (kwSplitted) {
              if (kwSplitted.trim() && stack.indexOf(kwSplitted) === -1) {
                stack.push(kwSplitted);
              }
            });
          }
        });
        return {
          'keywords': stack.sort(function (a, b) {
            return b.length - a.length;
          }),
          'length': stack.length
        };
      }
    }, {
      key: 'isNumeric',
      value: function isNumeric(value) {
        return Number(parseFloat(value)) == value;
      }
    }, {
      key: 'checkRanges',
      value: function checkRanges(array) {
        var _this3 = this;
        if (!Array.isArray(array) || Object.prototype.toString.call(array[0]) !== '[object Object]') {
          this.log('markRanges() will only accept an array of objects');
          this.opt.noMatch(array);
          return [];
        }
        var stack = [];
        var last = 0;
        array.sort(function (a, b) {
          return a.start - b.start;
        }).forEach(function (item) {
          var _callNoMatchOnInvalid = _this3.callNoMatchOnInvalidRanges(item, last),
            start = _callNoMatchOnInvalid.start,
            end = _callNoMatchOnInvalid.end,
            valid = _callNoMatchOnInvalid.valid;
          if (valid) {
            item.start = start;
            item.length = end - start;
            stack.push(item);
            last = end;
          }
        });
        return stack;
      }
    }, {
      key: 'callNoMatchOnInvalidRanges',
      value: function callNoMatchOnInvalidRanges(range, last) {
        var start = void 0,
          end = void 0,
          valid = false;
        if (range && typeof range.start !== 'undefined') {
          start = parseInt(range.start, 10);
          end = start + parseInt(range.length, 10);
          if (this.isNumeric(range.start) && this.isNumeric(range.length) && end - last > 0 && end - start > 0) {
            valid = true;
          } else {
            this.log('Ignoring invalid or overlapping range: ' + ('' + JSON.stringify(range)));
            this.opt.noMatch(range);
          }
        } else {
          this.log('Ignoring invalid range: ' + JSON.stringify(range));
          this.opt.noMatch(range);
        }
        return {
          start: start,
          end: end,
          valid: valid
        };
      }
    }, {
      key: 'checkWhitespaceRanges',
      value: function checkWhitespaceRanges(range, originalLength, string) {
        var end = void 0,
          valid = true,
          max = string.length,
          offset = originalLength - max,
          start = parseInt(range.start, 10) - offset;
        start = start > max ? max : start;
        end = start + parseInt(range.length, 10);
        if (end > max) {
          end = max;
          this.log('End range automatically set to the max value of ' + max);
        }
        if (start < 0 || end - start < 0 || start > max || end > max) {
          valid = false;
          this.log('Invalid range: ' + JSON.stringify(range));
          this.opt.noMatch(range);
        } else if (string.substring(start, end).replace(/\s+/g, '') === '') {
          valid = false;
          this.log('Skipping whitespace only range: ' + JSON.stringify(range));
          this.opt.noMatch(range);
        }
        return {
          start: start,
          end: end,
          valid: valid
        };
      }
    }, {
      key: 'getTextNodes',
      value: function getTextNodes(cb) {
        var _this4 = this;
        var val = '',
          nodes = [];
        this.iterator.forEachNode(NodeFilter.SHOW_TEXT, function (node) {
          nodes.push({
            start: val.length,
            end: (val += node.textContent).length,
            node: node
          });
        }, function (node) {
          if (_this4.matchesExclude(node.parentNode)) {
            return NodeFilter.FILTER_REJECT;
          } else {
            return NodeFilter.FILTER_ACCEPT;
          }
        }, function () {
          cb({
            value: val,
            nodes: nodes
          });
        });
      }
    }, {
      key: 'matchesExclude',
      value: function matchesExclude(el) {
        return DOMIterator.matches(el, this.opt.exclude.concat(['script', 'style', 'title', 'head', 'html']));
      }
    }, {
      key: 'wrapRangeInTextNode',
      value: function wrapRangeInTextNode(node, start, end) {
        var hEl = !this.opt.element ? 'mark' : this.opt.element,
          startNode = node.splitText(start),
          ret = startNode.splitText(end - start);
        var repl = document.createElement(hEl);
        repl.setAttribute('data-markjs', 'true');
        if (this.opt.className) {
          repl.setAttribute('class', this.opt.className);
        }
        repl.textContent = startNode.textContent;
        startNode.parentNode.replaceChild(repl, startNode);
        return ret;
      }
    }, {
      key: 'wrapRangeInMappedTextNode',
      value: function wrapRangeInMappedTextNode(dict, start, end, filterCb, eachCb) {
        var _this5 = this;
        dict.nodes.every(function (n, i) {
          var sibl = dict.nodes[i + 1];
          if (typeof sibl === 'undefined' || sibl.start > start) {
            if (!filterCb(n.node)) {
              return false;
            }
            var s = start - n.start,
              e = (end > n.end ? n.end : end) - n.start,
              startStr = dict.value.substr(0, n.start),
              endStr = dict.value.substr(e + n.start);
            n.node = _this5.wrapRangeInTextNode(n.node, s, e);
            dict.value = startStr + endStr;
            dict.nodes.forEach(function (k, j) {
              if (j >= i) {
                if (dict.nodes[j].start > 0 && j !== i) {
                  dict.nodes[j].start -= e;
                }
                dict.nodes[j].end -= e;
              }
            });
            end -= e;
            eachCb(n.node.previousSibling, n.start);
            if (end > n.end) {
              start = n.end;
            } else {
              return false;
            }
          }
          return true;
        });
      }
    }, {
      key: 'wrapMatches',
      value: function wrapMatches(regex, ignoreGroups, filterCb, eachCb, endCb) {
        var _this6 = this;
        var matchIdx = ignoreGroups === 0 ? 0 : ignoreGroups + 1;
        this.getTextNodes(function (dict) {
          dict.nodes.forEach(function (node) {
            node = node.node;
            var match = void 0;
            while ((match = regex.exec(node.textContent)) !== null && match[matchIdx] !== '') {
              if (!filterCb(match[matchIdx], node)) {
                continue;
              }
              var pos = match.index;
              if (matchIdx !== 0) {
                for (var i = 1; i < matchIdx; i++) {
                  pos += match[i].length;
                }
              }
              node = _this6.wrapRangeInTextNode(node, pos, pos + match[matchIdx].length);
              eachCb(node.previousSibling);
              regex.lastIndex = 0;
            }
          });
          endCb();
        });
      }
    }, {
      key: 'wrapMatchesAcrossElements',
      value: function wrapMatchesAcrossElements(regex, ignoreGroups, filterCb, eachCb, endCb) {
        var _this7 = this;
        var matchIdx = ignoreGroups === 0 ? 0 : ignoreGroups + 1;
        this.getTextNodes(function (dict) {
          var match = void 0;
          while ((match = regex.exec(dict.value)) !== null && match[matchIdx] !== '') {
            var start = match.index;
            if (matchIdx !== 0) {
              for (var i = 1; i < matchIdx; i++) {
                start += match[i].length;
              }
            }
            var end = start + match[matchIdx].length;
            _this7.wrapRangeInMappedTextNode(dict, start, end, function (node) {
              return filterCb(match[matchIdx], node);
            }, function (node, lastIndex) {
              regex.lastIndex = lastIndex;
              eachCb(node);
            });
          }
          endCb();
        });
      }
    }, {
      key: 'wrapRangeFromIndex',
      value: function wrapRangeFromIndex(ranges, filterCb, eachCb, endCb) {
        var _this8 = this;
        this.getTextNodes(function (dict) {
          var originalLength = dict.value.length;
          ranges.forEach(function (range, counter) {
            var _checkWhitespaceRange = _this8.checkWhitespaceRanges(range, originalLength, dict.value),
              start = _checkWhitespaceRange.start,
              end = _checkWhitespaceRange.end,
              valid = _checkWhitespaceRange.valid;
            if (valid) {
              _this8.wrapRangeInMappedTextNode(dict, start, end, function (node) {
                return filterCb(node, range, dict.value.substring(start, end), counter);
              }, function (node) {
                eachCb(node, range);
              });
            }
          });
          endCb();
        });
      }
    }, {
      key: 'unwrapMatches',
      value: function unwrapMatches(node) {
        var parent = node.parentNode;
        var docFrag = document.createDocumentFragment();
        while (node.firstChild) {
          docFrag.appendChild(node.removeChild(node.firstChild));
        }
        parent.replaceChild(docFrag, node);
        if (!this.ie) {
          parent.normalize();
        } else {
          this.normalizeTextNode(parent);
        }
      }
    }, {
      key: 'normalizeTextNode',
      value: function normalizeTextNode(node) {
        if (!node) {
          return;
        }
        if (node.nodeType === 3) {
          while (node.nextSibling && node.nextSibling.nodeType === 3) {
            node.nodeValue += node.nextSibling.nodeValue;
            node.parentNode.removeChild(node.nextSibling);
          }
        } else {
          this.normalizeTextNode(node.firstChild);
        }
        this.normalizeTextNode(node.nextSibling);
      }
    }, {
      key: 'markRegExp',
      value: function markRegExp(regexp, opt) {
        var _this9 = this;
        this.opt = opt;
        this.log('Searching with expression "' + regexp + '"');
        var totalMatches = 0,
          fn = 'wrapMatches';
        var eachCb = function eachCb(element) {
          totalMatches++;
          _this9.opt.each(element);
        };
        if (this.opt.acrossElements) {
          fn = 'wrapMatchesAcrossElements';
        }
        this[fn](regexp, this.opt.ignoreGroups, function (match, node) {
          return _this9.opt.filter(node, match, totalMatches);
        }, eachCb, function () {
          if (totalMatches === 0) {
            _this9.opt.noMatch(regexp);
          }
          _this9.opt.done(totalMatches);
        });
      }
    }, {
      key: 'mark',
      value: function mark(sv, opt) {
        var _this10 = this;
        this.opt = opt;
        var totalMatches = 0,
          fn = 'wrapMatches';
        var _getSeparatedKeywords = this.getSeparatedKeywords(typeof sv === 'string' ? [sv] : sv),
          kwArr = _getSeparatedKeywords.keywords,
          kwArrLen = _getSeparatedKeywords.length,
          sens = this.opt.caseSensitive ? '' : 'i',
          handler = function handler(kw) {
            var regex = new RegExp(_this10.createRegExp(kw), 'gm' + sens),
              matches = 0;
            _this10.log('Searching with expression "' + regex + '"');
            _this10[fn](regex, 1, function (term, node) {
              return _this10.opt.filter(node, kw, totalMatches, matches);
            }, function (element) {
              matches++;
              totalMatches++;
              _this10.opt.each(element);
            }, function () {
              if (matches === 0) {
                _this10.opt.noMatch(kw);
              }
              if (kwArr[kwArrLen - 1] === kw) {
                _this10.opt.done(totalMatches);
              } else {
                handler(kwArr[kwArr.indexOf(kw) + 1]);
              }
            });
          };
        if (this.opt.acrossElements) {
          fn = 'wrapMatchesAcrossElements';
        }
        if (kwArrLen === 0) {
          this.opt.done(totalMatches);
        } else {
          handler(kwArr[0]);
        }
      }
    }, {
      key: 'markRanges',
      value: function markRanges(rawRanges, opt) {
        var _this11 = this;
        this.opt = opt;
        var totalMatches = 0,
          ranges = this.checkRanges(rawRanges);
        if (ranges && ranges.length) {
          this.log('Starting to mark with the following ranges: ' + JSON.stringify(ranges));
          this.wrapRangeFromIndex(ranges, function (node, range, match, counter) {
            return _this11.opt.filter(node, range, match, counter);
          }, function (element, range) {
            totalMatches++;
            _this11.opt.each(element, range);
          }, function () {
            _this11.opt.done(totalMatches);
          });
        } else {
          this.opt.done(totalMatches);
        }
      }
    }, {
      key: 'unmark',
      value: function unmark(opt) {
        var _this12 = this;
        this.opt = opt;
        var sel = this.opt.element ? this.opt.element : '*';
        sel += '[data-markjs]';
        if (this.opt.className) {
          sel += '.' + this.opt.className;
        }
        this.log('Removal selector "' + sel + '"');
        this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT, function (node) {
          _this12.unwrapMatches(node);
        }, function (node) {
          var matchesSel = DOMIterator.matches(node, sel),
            matchesExclude = _this12.matchesExclude(node);
          if (!matchesSel || matchesExclude) {
            return NodeFilter.FILTER_REJECT;
          } else {
            return NodeFilter.FILTER_ACCEPT;
          }
        }, this.opt.done);
      }
    }, {
      key: 'opt',
      set: function set$$1(val) {
        this._opt = _extends({}, {
          'element': '',
          'className': '',
          'exclude': [],
          'iframes': false,
          'iframesTimeout': 5000,
          'separateWordSearch': true,
          'diacritics': true,
          'synonyms': {},
          'accuracy': 'partially',
          'acrossElements': false,
          'caseSensitive': false,
          'ignoreJoiners': false,
          'ignoreGroups': 0,
          'ignorePunctuation': [],
          'wildcards': 'disabled',
          'each': function each() {},
          'noMatch': function noMatch() {},
          'filter': function filter() {
            return true;
          },
          'done': function done() {},
          'debug': false,
          'log': window.console
        }, val);
      },
      get: function get$$1() {
        return this._opt;
      }
    }, {
      key: 'iterator',
      get: function get$$1() {
        return new DOMIterator(this.ctx, this.opt.iframes, this.opt.exclude, this.opt.iframesTimeout);
      }
    }]);
    return Mark;
  }();
  function Mark(ctx) {
    var _this = this;
    var instance = new Mark$1(ctx);
    this.mark = function (sv, opt) {
      instance.mark(sv, opt);
      return _this;
    };
    this.markRegExp = function (sv, opt) {
      instance.markRegExp(sv, opt);
      return _this;
    };
    this.markRanges = function (sv, opt) {
      instance.markRanges(sv, opt);
      return _this;
    };
    this.unmark = function (opt) {
      instance.unmark(opt);
      return _this;
    };
    return this;
  }
  return Mark;
});
});

//
let target$1;
var script$2M = {
  name: 'XmlDigitalTeaching',
  components: {
    xmlPreviewSearch: __vue_component__$3a,
    xmlToolbarPc: __vue_component__$39,
    xmlResourceListPc: __vue_component__$35,
    addFile: __vue_component__$66,
    setPop: __vue_component__$34,
    xmlToolbarPhone: __vue_component__$2Y,
    downFileUppop: __vue_component__$2$,
    PdfView: __vue_component__$5E,
    modifyNotes: __vue_component__$2X,
    resourceListPhone: __vue_component__$2_,
    PreviewLeftStudent: __vue_component__$2Q,
    highlight: __vue_component__$33,
    bookmark: __vue_component__$32,
    xmlRobotPhone: __vue_component__$31,
    xmlGeneralRobotPc: __vue_component__$30,
    xmlStatisticalChart: __vue_component__$2P,
    classGrade: __vue_component__$2N,
    learningProgress: __vue_component__$2O
  },
  props: {
    textBookData: Object,
    //数字教材信息
    catalogList: Array,
    //目录
    looseLeafData: Object,
    //所有活页信息
    bookGraphData: Object,
    //教材关联文稿图谱点边信息
    bookGraphIndexs: Array,
    //教材关联文稿图谱词条标记列表
    presetStyleList: {
      //预置样式列表
      type: Array,
      default: () => []
    },
    deleteNote: {
      type: Function,
      default: () => {}
    },
    editNote: {
      type: Function,
      default: () => {}
    },
    deleteHighlight: {
      type: Function,
      default: () => {}
    },
    isShowTeacherResource: {
      // 是否显示教师资源
      type: Boolean,
      default: false
    },
    notesList: {
      type: Array,
      default: () => []
    },
    //笔记列表
    bookmarkList: {
      type: Array,
      default: () => []
    },
    //书签列表
    resourcesList: {
      //教师资源列表
      type: Array,
      default: () => []
    },
    highlightList: {
      //高亮列表
      type: Array,
      default: () => []
    },
    linkList: {
      //划线列表
      type: Array,
      default: () => []
    },
    readerType: {
      //阅读器类型,reader:阅读器器模式可添加书签、笔记等，preview：预览模式不可添加书签、笔记等，loose-leaf:活页模式只显示教材内容
      type: String,
      default: 'reader'
    },
    pageType: {
      //页面类型：取值h5、pc、pad
      type: String,
      default: 'h5'
    },
    styleType: {
      //阅读风格
      type: String,
      default: 'A'
    },
    isTrial: {
      // 是否为试读模式
      type: Boolean,
      default: false
    },
    isTrialIndex: {
      // 是否为试读模式进度
      type: Number,
      default: 10
    },
    trialChapterList: {
      //试读章节列表
      type: Array,
      default: () => []
    },
    textBookId: {
      //数字教材Id
      type: String,
      default: ''
    },
    basisPath: {
      //资源文件基础路径
      type: String,
      default: ''
    },
    officePreviewPath: {
      //office 在线预览路径
      type: String,
      default: 'https://view.officeapps.live.com/op/view.aspx?src='
    },
    looseleafUrl: {
      //活页在线预览路径
      type: String,
      default: 'https://dcldbook.airlib.cn:90/'
    },
    location: {
      type: String,
      default: ''
    },
    releaseUrlList: {
      //需要放行的Url
      type: Array,
      default: () => []
    },
    continueReading: {
      // 是否显示继续阅读弹窗
      type: Boolean,
      default: false
    },
    downloadType: {
      // 下载方式弹窗
      type: String,
      default: 'pop-up'
    },
    testPaperPath: {
      //试题预览地址
      type: String,
      default: 'http://124.133.23.84:10014'
    },
    trialText: {
      // 试读结束提示语
      type: String,
      default: '<p>--- 试读结束 ---</p>'
    },
    trialPrompt: {
      // 试读模式弹窗提示语
      type: String,
      default: '该处已超出试读范围'
    },
    readOnly: {
      // 只读模式，只可阅读不能添加笔记书签
      type: Boolean,
      default: false
    },
    isShowAi: {
      //0:显示Ai，1不显示
      type: String,
      default: '1'
    },
    catalogLevel: {
      //目录显示的最小层级
      type: Number,
      default: 3
    },
    textBookMergeLevel: {
      //教材内容合并到几级目录下
      type: Number,
      default: 1
    },
    learningDuration: {
      //已学习总时长
      type: Number,
      default: 0
    },
    classId: {
      // 班级唯一标识
      type: String,
      default: ''
    },
    gradesName: {
      // 班级名称
      type: String,
      default: ''
    },
    userType: {
      // 用户类型，可选teacher、student
      type: String,
      default: 'teacher'
      // default: 'student'
    },
    action: {
      // 上传文件地址
      type: String,
      default: ''
    },
    headers: {
      // 上传文件头部
      type: Object,
      default: () => {}
    },
    data: {
      // 上传文件附带的额外参数
      type: Object,
      default: () => {}
    },
    setting: {
      // @pos 此参数留作外部使用, 内部临时使用data.persistentReaderSetting
      // 设置
      type: Object,
      default: () => {}
    },
    fileSize: {
      // 最大上传文件大小
      type: Number,
      default: 300
    },
    isOpenHyperlink: {
      // 移动端是否可以直接打开超链接
      type: Boolean,
      default: false
    },
    linkOpenLabel: {
      // pc端链接是否打开新标签
      type: Boolean,
      default: false
    },
    navBarHeight: {
      // 业务系统导航栏高度
      type: Number,
      default: 0
    },
    systemEnvId: {
      // 系统环境ID,用于区分不同出版社
      type: String,
      default: '885d44db-8f0f-41ff-b2af-7ec4a6844685'
    },
    chapterId: {
      // 跳转到章节ID
      type: String,
      default: ''
    },
    teacherData: {
      type: Object,
      default: () => {}
    },
    studentData: {
      type: Object,
      default: () => {}
    },
    teacherDateclass: {
      type: Array,
      default: () => []
    },
    userInfoparms: {
      type: Object,
      default: () => {}
    },
    updateFREQUENCY: {
      // 音视频更新频率，默认10s
      type: Number,
      default: 10000
    },
    isAddMark: {
      //是否可以添加标记
      type: Boolean,
      default: true
    },
    loadingMode: {
      // 加载模式，可选roll、page
      type: String,
      default: 'roll'
    },
    robotData: {
      // 机器人数据
      type: Object,
      default: () => {}
    },
    robotName: {
      type: String,
      default: '小智'
    },
    isOperation: {
      //是否可以操作
      type: Boolean,
      default: true
    },
    isOpenPaper: {
      //是否直接打开试卷
      type: Boolean,
      default: true
    },
    showoQuestionBank: {
      //是否显示打开题库按钮
      type: Boolean,
      default: false
    },
    generalAPI: {
      type: Object,
      default: {
        getCatalogStudent: e => {
          return new Promise((resolve, reject) => {
            resolve(e);
          });
        }
      }
    },
    progressData: {
      type: Object,
      default: () => {}
    },
    isOpenStudy: {
      //是否显示学习情况
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      pageTitle: '',
      businessType: 'textBook',
      //业务类型：looseLeaf，textBook,此组件只处理textBook
      showType: 'leaf',
      //显示的类型：leaf 活页，catalog
      contentList: [],
      //内容list，只有3个
      selectId: '',
      chapterIndex: 0,
      componentList: [],
      textCatalog: [],
      componentTotal: 0,
      scrollObserver: null,
      showPrompt: false,
      promptText: '',
      toastType: '',
      readLocation: '',
      //当前阅读的位置
      startIndex: 0,
      endIndex: 1,
      continueRead: false,
      isiOS: false,
      //是否是ios
      downloadFileLink: '',
      seachInput: '',
      videoDomId: '',
      videoDomList: [],
      audioDomId: '',
      audioDomList: [],
      scrollTimer: null,
      componentIndex: 0,
      xmlDigitalTeaching: '',
      scrollId: '',
      themeColor: '',
      currentLocation: '',
      //当前点击的组件id
      learningTime: 0,
      //本次学习时长
      thisLearnTime: 0,
      //教师端本次学习时长
      locationChapterId: '',
      //当前内容阅读所在目录id
      locationLabel: '',
      //当前内容阅读所在目录名称
      firstLevelLabel: '',
      //一级目录名称
      firstLevelChapterId: '',
      //一级目录id
      textBookResource: {
        imageList: [],
        audioList: [],
        videoList: [],
        animationList: [],
        curriculumList: [],
        resourceList: [],
        formulaList: [],
        interactionList: [],
        questionList: [],
        testPaperList: [],
        imageTotal: 0,
        audioTotal: 0,
        videoTotal: 0,
        animationTotal: 0,
        curriculumTotal: 0,
        resourceTotal: 0,
        formulaTotal: 0,
        interactionTotal: 0,
        questionTotal: 0,
        testPaperTotal: 0,
        teachingResourceTotal: 0,
        imageCurrent: 0,
        audioCurrent: 0,
        videoCurrent: 0,
        animationCurrent: 0,
        curriculumCurrent: 0,
        resourceCurrent: 0,
        formulaCurrent: 0,
        interactionCurrent: 0,
        questionCurrent: 0
      },
      resourceType: 'search',
      resourceIcon: 'icon_01',
      imageViewTitles: [],
      imageViewSrcs: [],
      playTimeMap: {},
      viewerVisible: false,
      hotzoneTarget: {
        type: '',
        value: '',
        label: '',
        desc: '',
        cover: ''
      },
      hotTargetViewerVisible: false,
      schedule: '0',
      currentGroupInfo: {},
      //当前阅读位置块信息
      showPdf: false,
      fileBaseUrl: '',
      fileBaseTitle: '',
      PreviewCatalog: false,
      currentIndex: 0,
      isBookmarkAddSuccess: false,
      keyboardShow: false,
      //移动端键盘是否弹出
      persistentReaderSetting: {},
      isBookmarked: false,
      // bookmarkIconSrc: '../../../static/images/icons/books/bookmark-top.png', // 原始图片路径
      // bookmarkedIconSrc: '../../../static/images/icons/books/bookmark-top-active.svg', // 激活图片路径
      isShowToolbarTip: false,
      tippyTplBarId: '',
      xmlReaderPageHeight: window.innerHeight,
      xmlReaderWidth: 0,
      env: {},
      immersiveReader: false,
      currentProgress: 0,
      activeInjectId: '',
      activeInjectedBoxId: '',
      readableChapters: [],
      dialogData: {},
      bookGraphModel: {},
      observationChapter: '',
      observationChapterList: [],
      chapterIo: null,
      chapterSchedule: 0,
      learningChapter: [],
      locationData: {},
      chapterData: {}
      // localIsShowTeacherResource:this.isShowTeacherResource
    };
  },
  computed: {
    teacherResourcesList() {
      this.textBookResource.teachingResourceTotal = 0;
      let list = this.resourcesList;
      list.sort(this.sortBy('chapterOrderNum', 1));
      let map = [];
      list.forEach(e => {
        if (e.type == 'note__teacher') ;
        if (e.isStudentShow != 1 || this.userType == 'teacher') {
          this.textBookResource.teachingResourceTotal += 1;
          let findObj = map.find(innerTmp => innerTmp.firstLevelId === e.firstLevelId);
          if (findObj) {
            findObj.list.push(e);
            findObj.list.sort(this.sortBy('textOrderNum', 1));
          } else {
            map.push({
              firstLevelId: e.firstLevelId,
              firstLevelLabel: e.firstLevelLabel,
              chapterOrderNum: e.chapterOrderNum,
              list: [e]
            });
          }
        }
      });
      return map;
    },
    teacherNoteList() {
      let list = this.resourcesList || [];
      let teacherNoteList = [];
      list.forEach(e => {
        if ((e.isStudentShow != 1 || this.userType == 'teacher') && this.isShowTeacherResource) {
          teacherNoteList.push(e);
        }
      });
      return teacherNoteList;
    },
    bookmarkData() {
      let list = this.bookmarkList;
      list.sort(this.sortBy('orderNum', 1));
      let map = [];
      list.forEach((e, index) => {
        let findObj = map.find(innerTmp => innerTmp.firstLevelId === e.firstLevelId);
        if (findObj) {
          findObj.list.push({
            ...e,
            bookmarkIndex: index + 1
          });
        } else {
          map.push({
            firstLevelId: e.firstLevelId,
            firstLevelLabel: e.firstLevelLabel,
            chapterOrderNum: e.chapterOrderNum,
            list: [{
              ...e,
              bookmarkIndex: index + 1
            }]
          });
        }
      });
      return map;
    },
    highlightData() {
      let list = this.highlightList;
      list.sort(this.sortBy('chapterOrderNum', 1));
      let map = [];
      list.forEach(e => {
        let findObj = map.find(innerTmp => innerTmp.topChapterId === e.topChapterId);
        if (findObj) {
          findObj.list.push(e);
          findObj.list.sort(this.sortBy('textOrderNum', 1));
        } else {
          map.push({
            topChapterId: e.topChapterId,
            firstLevelId: e.topChapterId,
            firstLevelLabel: e.topChapterLabel,
            chapterOrderNum: e.blockIndex,
            list: [e]
          });
        }
      });
      return map;
    },
    linkData() {
      let list = this.linkList;
      list.sort(this.sortBy('chapterOrderNum', 1));
      let map = [];
      list.forEach(e => {
        let findObj = map.find(innerTmp => innerTmp.topChapterId === e.topChapterId);
        if (findObj) {
          findObj.list.push(e);
          findObj.list.sort(this.sortBy('textOrderNum', 1));
        } else {
          map.push({
            topChapterId: e.topChapterId,
            firstLevelId: e.topChapterId,
            firstLevelLabel: e.topChapterLabel,
            chapterOrderNum: e.blockIndex,
            list: [e]
          });
        }
      });
      return map;
    },
    notesListData() {
      let list = this.notesList;
      list.sort(this.sortBy('chapterOrderNum', 1));
      let map = [];
      list.forEach(e => {
        let findObj = map.find(innerTmp => innerTmp.topChapterId === e.topChapterId);
        if (findObj) {
          findObj.list.push(e);
          findObj.list.sort(this.sortBy('textOrderNum', 1));
        } else {
          map.push({
            topChapterId: e.topChapterId,
            firstLevelId: e.topChapterId,
            firstLevelLabel: e.topChapterLabel,
            chapterOrderNum: e.blockIndex,
            list: [e]
          });
        }
      });
      return map;
    },
    useReaderSetting() {
      console.log('useReaderSetting', this.setting, 'aaa', this.persistentReaderSetting);
      if (this.setting) {
        return Object.keys(this.setting).length ? this.setting : this.persistentReaderSetting;
      } else {
        return this.persistentReaderSetting;
      }
    },
    graphStoreKeyPrefix() {
      return this.textBookData.id + '$$';
    },
    getStudentData() {
      return {
        ...this.studentData,
        learnTime: this.locationData.learningTime || 0,
        chapterNum: this.locationData.learningChapter || 0,
        learningProgress: this.locationData.schedule || 0
      };
    }
  },
  provide() {
    return {
      getToolbarVisible: () => this.$refs.xmlToolbarPhone?.isShowToolbar || false,
      getKeyboardShow: () => this.keyboardShow,
      getSysEnv: () => this.env,
      getActiveInjectId: () => this.activeInjectId,
      getActiveInjectedBoxId: () => this.activeInjectedBoxId,
      getIsShowAi: () => this.isShowAi == '0',
      getGeneralAPI: () => this.generalAPI
    };
  },
  watch: {
    setting: {
      handler: function (newSetting, oldSetting) {
        if (oldSetting) {
          let {
            themeBgColor,
            themeFontSize,
            themeFontFamily,
            themeLineHeight,
            themeLetterSpacing
          } = newSetting;
          if (themeBgColor !== undefined && themeBgColor !== oldSetting?.themeBgColor) {
            this.setThemeColor(themeBgColor);
          }
          if (themeFontSize !== undefined && themeFontSize !== oldSetting?.themeFontSize) {
            this.setThemeFontSize(themeFontSize);
          }
          if (themeFontFamily !== undefined && themeFontFamily !== oldSetting?.themeFontFamily) {
            this.setThemeFontFamily(themeFontFamily);
          }
          if (themeLineHeight !== undefined && themeLineHeight !== oldSetting?.themeLineHeight) {
            this.setThemeLineHeight(themeLineHeight);
          }
          if (themeLetterSpacing !== undefined && themeLetterSpacing !== oldSetting?.themeLetterSpacing) {
            this.setThemeLetterSpacing(themeLetterSpacing);
          }
        }
      },
      immediate: true,
      deep: true
    },
    persistentReaderSetting: {
      handler: function (newSetting, oldSetting) {
        let {
          themeBgColor,
          themeFontSize,
          themeFontFamily,
          themeLineHeight,
          themeLetterSpacing
        } = newSetting;
        if (oldSetting) {
          if (themeBgColor !== undefined && themeBgColor !== oldSetting?.themeBgColor) {
            this.setThemeColor(themeBgColor);
          }
          if (themeFontSize !== undefined && themeFontSize !== oldSetting?.themeFontSize) {
            this.setThemeFontSize(themeFontSize);
          }
          if (themeFontFamily !== undefined && themeFontFamily !== oldSetting?.themeFontFamily) {
            this.setThemeFontFamily(themeFontFamily);
          }
          if (themeLineHeight !== oldSetting?.themeLineHeight) {
            this.setThemeLineHeight(themeLineHeight);
          }
          if (themeLetterSpacing !== oldSetting?.themeLetterSpacing) {
            this.setThemeLetterSpacing(themeLetterSpacing);
          }
        }
      },
      immediate: true,
      deep: true
    },
    schedule: {
      handler: function (newSetting, oldSetting) {
        this.currentProgress = Number(newSetting);
      },
      immediate: true,
      deep: true
    },
    // isShowTeacherResource(newVal) {
    //   this.localIsShowTeacherResource = newVal;
    // }
    bookGraphData: {
      handler: function () {
        this.$nextTick(() => {
          localStorage.setItem(this.graphStoreKeyPrefix + 'g-nodes', JSON.stringify(this.bookGraphData?.nodes || []));
          localStorage.setItem(this.graphStoreKeyPrefix + 'g-relations', JSON.stringify(this.bookGraphData?.relationships || []));
        });
      },
      immediate: true,
      deep: true
    },
    bookGraphIndexs: {
      handler: function () {
        this.$nextTick(() => {
          localStorage.setItem(this.graphStoreKeyPrefix + 'g-indexs', JSON.stringify(this.bookGraphIndexs || []));
        });
      },
      immediate: true,
      deep: true
    }
  },
  beforeDestroy() {
    document.body.style.overflow = '';
    if (this.scrollObserver) {
      this.scrollObserver.disconnect();
      this.scrollObserver = null;
    }
    this.resetBookGraph();
    window.removeEventListener('beforeunload', this.resetBookGraph);
  },
  created() {
    this.env = new systemEnvironmentVariables(this.systemEnvId, {
      userType: this.userType,
      pageType: this.pageType,
      isAddMark: this.isAddMark,
      isiOS: this.isiOS
    }).data || {};
    this.getPersistentSetting();
    this.queryData();
    this.$nextTick(() => {
      window.showImageBYDate = () => {
        target$1 = window.event.target;
        if (target$1.isShow == true) return;
        target$1.isShow = true;
        $(target$1).find('img').click();
        setTimeout(() => {
          target$1.isShow = false;
        }, 1000);
        return false;
      };
      window.inlineAudioPlay = uuid => {
        target$1 = window.event.target;
        if (target$1.isShow == true) return;
        target$1.isShow = true;
        let audio = document.getElementById(`audio${uuid}`);
        if (audio.paused) {
          audio.play();
          document.getElementById(`icon${uuid}`).className = 'wifi-symbol playing';
        } else {
          audio.pause();
          audio.currentTime = 0; //音乐从头播放
          document.getElementById(`icon${uuid}`).className = 'wifi-symbol';
        }
        setTimeout(() => {
          target$1.isShow = false;
        }, 1000);
        return false;
      };
    });
    window.addEventListener('beforeunload', this.resetBookGraph);
  },
  mounted() {
    console.log(this.basisPath, 'this.basisPath');
    this.$nextTick(() => {
      document.body.style.overflow = 'hidden'; //禁用ios浏览器橡皮筋效果
      this.xmlReaderWidth = this.$refs.xmlPreviewDom?.offsetWidth;
      // console.log(this.$refs.xmlPreviewDom., '1111111111111')
      setTimeout(() => {
        this.initObserver();
      }, 1500);
      window.document.oncontextmenu = function (e) {
        e.preventDefault();
      };
      let u = navigator.userAgent;
      this.isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
      this.env = new systemEnvironmentVariables(this.systemEnvId, {
        userType: this.userType,
        pageType: this.pageType,
        isAddMark: this.isAddMark,
        isiOS: this.isiOS
      }).data || {};
      this.textBookData.themeColor ? this.themeColor = this.textBookData.themeColor : this.themeColor = '#6883FA';
      if (this.textBookData.captionText) {
        document.title = this.textBookData.captionText;
      } else if (this.textBookData.textBooksName) {
        document.title = this.textBookData.textBooksName;
      }
      let _this = this;
      this.$EventBus.$on('videoTimeUpdate', throttle$2(this.updateFREQUENCY, function (options) {
        // console.log('更新视频播放时长', options)
        let info = options.data || _this.currentGroupInfo;
        _this.$emit('learningStatistics', {
          type: 'video',
          // 多少视频的参数
          ...info,
          xmlCompRef: options.data.xmlCompRef
        });
      }));
      this.$EventBus.$on('audioTimeUpdate', throttle$2(this.updateFREQUENCY, function (options) {
        // console.log('更新音频播放时长', options)
        let info = options.data || _this.currentGroupInfo;
        _this.$emit('learningStatistics', {
          type: 'audio',
          ...info,
          xmlCompRef: options.data.xmlCompRef
        });
      }));
      this.$EventBus.$on('resetTimeUpdate', function (data) {
        const {
          statisticsId
        } = data;
        if (statisticsId) {
          _this.$set(_this.playTimeMap, statisticsId, undefined);
        }
      });
      this.$EventBus.$on('handleMagicLinkAudioPlay', function (data) {
        const {
          targetId,
          plaintext,
          title,
          content,
          type,
          isPlaying,
          callback
        } = data;
        const playerId = 'player__' + targetId.split('__')[1];
        if (!this.magicLinkAudio) {
          const audioElem = new Audio(content);
          audioElem.setAttribute('id', playerId);
          // audioElem.addEventListener("canplaythrough", event => {
          //     audioElem.play();
          //     typeof callback === 'function' && callback(audioElem)
          // });
          this.magicLinkAudio = audioElem;
          this.magicLinkAudio.play().then(() => $(`#${targetId}`).attr('data-isplaying', 'true'));
        } else {
          if (this.magicLinkAudio.id === playerId) {
            // 如果是同一个魔链音频, 仅切换播放状态
            if (this.magicLinkAudio.paused) {
              this.magicLinkAudio.play().then(() => $(`#${targetId}`).attr('data-isplaying', 'true'));
            } else {
              this.magicLinkAudio.pause();
            }
            $(`#${targetId}`).attr('data-isplaying', this.magicLinkAudio.paused ? 'false' : 'true');
          } else {
            const oldTarget = `#${this.magicLinkAudio.id.replace('player__', 'ml-audio__')}`;
            this.magicLinkAudio.pause();
            $(oldTarget).attr('data-isplaying', 'false');
            // 不是同一个魔链音频直接切换音频源
            this.magicLinkAudio.setAttribute('id', playerId);
            this.magicLinkAudio.setAttribute('src', content);
            this.magicLinkAudio.play().then(() => $(`#${targetId}`).attr('data-isplaying', 'true'));
          }
        }
      });
      this.$EventBus.$on('handleMagicLinkVideoPlay', function (data) {
        const {
          targetId,
          plaintext,
          title,
          content,
          type,
          isPlaying,
          callback
        } = data;
        _this.hotzoneTarget = {
          type: 'video',
          value: content,
          label: title,
          desc: '',
          cover: ''
        };
        _this.hotTargetViewerVisible = true;
      });
      this.$EventBus.$on('hotzoneClick', function (set) {
        console.log('热区点击', set, _this.basisPath);
        let {
          type = '',
          value,
          label,
          desc = '',
          cover = ''
        } = set || {};
        // console.log('热区点击', value,cover)
        if (value.indexOf('./') !== -1) {
          value = _this.basisPath + value.split('./')[1];
        }
        if (cover.indexOf('./') !== -1) {
          cover = _this.basisPath + cover.split('./')[1];
        }
        // console.log('热区点击后', value,cover)

        _this.hotzoneTarget = {
          type,
          value,
          label,
          desc,
          cover
        };
        if (!type || !value) {
          that.$message.error('当前热区绑定非有效目标');
          return;
        }
        const modalTypeDict = ['richtext', 'image', 'audio', 'video'];
        if (type === 'looseleaf') {
          _this.initializeTheLooseLeaf({
            looseLeafId: value,
            title: label
          });
          // 浏览活页
          // _this.viewerVisible = true
          // let fileBaseUrl =
          //   _this.looseleafUrl +
          //   'previewLooseLeaf?pageType=' +
          //   _this.pageType +
          //   '&businessType=looseLeaf' +
          //   '&looseLeafId=' +
          //   _this.hotzoneTarget.value +
          //   '&isTrial=' +
          //   true +
          //   '&uuid=' +
          //   uuidv4()
          // _this.openPage({
          //   url: fileBaseUrl,
          //   title: ''
          // })
        }
        if (type === 'chapter') {
          // 浏览章节
          // _this.$message.error('暂不支持热区跳转章节')
          // _this.JumpPosition('xml-digital-teaching/' + value + '/' + 'placeholders', 50)
          let obj = _this.looseLeafData[value];
          if (obj && obj.looseLeafInfo && JSON.parse(obj.looseLeafInfo).length > 0) {
            let xmlCompRef = JSON.parse(obj.looseLeafInfo)[0].xmlCompRef;
            _this.JumpPosition({
              location: 'xml-digital-teaching/' + value + '/' + xmlCompRef,
              maxTop: -30,
              type: 'catalog',
              selectorType: '',
              selectorId: '',
              markTarget: '',
              classIndex: 0
            });
          }
        }
        if (type === 'link') {
          const re = /((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?)/;
          const result = re.test(value);
          if (!result) {
            _this.$message.error('当前热区绑定非有效链接');
            return;
          }
          _this.openPage({
            url: value,
            title: ''
          });
          // _this
          //   .$confirm(`当前热区绑定外部链接地址为：${value} ，确认打开？`, '', {
          //     customClass: 'mobile-fix-msgbox'
          //   })
          //   .then((_) => {
          //     window.open(value, '_blank')
          //     done()
          //   })
          //   .catch((_) => {})
        }
        if (modalTypeDict.includes(type)) {
          _this.hotTargetViewerVisible = true;
        }
      });

      // window.showleafletDate = uuid => {
      //   window.open(ENV_CONFIG.VUE_APP_TEXTBOOK_WEB + 'previewLooseLeaf?pageType=h5' + '&businessType=looseLeaf' + '&looseLeafId=' + uuid + '&isTrial=' + this.isTrial + '&uuid=' + uuidv4())
      // }
      window.showImageBYDate = uuid => {
        target$1 = window.event.target;
        let imgs = $(target$1).find('img');
        if (!imgs.length) {
          imgs = $('#image__' + uuid) ? $('#image__' + uuid).find('img') : null;
        }
        let imgList = [];
        if (imgs) {
          imgs.each(function (img) {
            const title = $(this).attr('preview-text') || '';
            const src = $(this).prop('src') || '';
            imgList.push({
              url: src,
              title: title
            });
          });
        }
        this.$hevueImgPreview({
          multiple: true,
          nowImgIndex: 0,
          imgList
        });
      };
      window.inlineAudioPlay = uuid => {
        target$1 = window.event.target;
        if (target$1.isShow == true) return;
        target$1.isShow = true;
        const audio = document.getElementById('audio' + uuid);
        if (audio.paused) {
          audio.play();
          document.getElementById('icon' + uuid).className = 'wifi-symbol playing';
        } else {
          audio.pause();
          audio.currentTime = 0; // 音乐从头播放
          document.getElementById('icon' + uuid).className = 'wifi-symbol';
        }
        setTimeout(() => {
          target$1.isShow = false;
        }, 1000);
        return false;
      };
      this.$EventBus.$on('addTeacherResources', function (model, rollback) {
        _this.$refs.addTeacherResources.open({
          ...model,
          textBookId: _this.textBookData.id,
          isDownload: 0,
          resourcesName: '',
          fileUrl: '',
          location: _this.currentLocation,
          chapterId: _this.componentList[_this.currentIndex].chapterId,
          orderNum: 0,
          firstLevelId: _this.componentList[_this.currentIndex].firstLevelId,
          firstLevelLabel: _this.componentList[_this.currentIndex].firstLevelLabel,
          chapterOrderNum: _this.componentList[_this.currentIndex].chapterOrderNum,
          textOrderNum: _this.getTextOrderNum(model),
          locationChapterId: _this.componentList[_this.currentIndex].locationChapterId,
          id: '',
          resourcesType: '',
          fileExt: '',
          isStudentShow: 0
        });
      });
      this.$EventBus.$on('openTeacherResources', function (e, markEfiStr) {
        let itemResources = _this.resourcesList.find(item => item.markEfiCode === e.markEfiStr);
        _this.openTeacherResoucesList(itemResources);
      });
      // @pos 添加笔记
      this.$EventBus.$on('createNote', function (model, rollback) {
        if (!_this.currentLocation) {
          _this.$message.error('匹配笔记位置失败');
          return;
        }
        if (_this.userType) {
          _this.$emit('addNote', {
            ...model,
            location: _this.currentLocation,
            topChapterLabel: _this.componentList[_this.currentIndex].firstLevelLabel,
            topChapterId: _this.componentList[_this.currentIndex].firstLevelId,
            locationChapterId: _this.componentList[_this.currentIndex].locationChapterId,
            chapterOrderNum: _this.componentList[_this.currentIndex].chapterOrderNum,
            textOrderNum: _this.getTextOrderNum(model),
            id: new Date().getTime()
          }, () => rollback(model.markId));
        }
      });
      // 添加纠错
      this.$EventBus.$on('createError', function (model, rollback) {
        if (!_this.currentLocation) {
          _this.$message.error('匹配反馈位置失败');
          return;
        }
        if (_this.userType) {
          _this.$emit('addError', {
            ...model,
            location: _this.currentLocation,
            topChapterLabel: _this.componentList[_this.currentIndex].firstLevelLabel,
            topChapterId: _this.componentList[_this.currentIndex].firstLevelId,
            locationChapterId: _this.componentList[_this.currentIndex].locationChapterId,
            chapterOrderNum: _this.componentList[_this.currentIndex].chapterOrderNum,
            textOrderNum: _this.getTextOrderNum(model),
            id: new Date().getTime()
          }, () => rollback(model.markId));
        }
      });
      this.$EventBus.$on('editStudentNote', function (model) {
        _this.$refs.modifyNotes.open(model);
      });
      this.$EventBus.$on('editNote', function (model) {
        if (_this.userType) {
          _this.$emit('editNote', {
            ...model
          });
        }
      });

      //  删除笔记
      this.$EventBus.$on('deleteNote', function (model, feedback) {
        if (_this.userType) {
          _this.$emit('deleteNote', {
            ...model
          }, () => feedback(model.markId));
          _this.$EventBus.$emit(`underlineSign-${model.location}`, {
            ...model,
            signType: 'underline',
            operationType: 'remove'
          });
        }
      });

      // 删除高亮
      this.$EventBus.$on('deleteHighlight', function (model, feedback) {
        _this.$emit('deleteHighlight', {
          ...model
        }, () => feedback(model.markId));
        _this.$EventBus.$emit(`underlineSign-${model.location}`, {
          ...model,
          signType: 'highlight',
          operationType: 'remove'
        });
      });
      // 删除划线
      this.$EventBus.$on('deleteLink', function (model, feedback) {
        _this.$emit('deleteLink', {
          ...model
        }, () => feedback(model.markId));
        _this.$EventBus.$emit(`underlineSign-${model.location}`, {
          ...model,
          signType: 'underline',
          operationType: 'remove'
        });
      });
      // 是否显示移动端提示气泡
      this.$EventBus.$on('selectionTextChange', function (data) {
        // console.log('🚀 ~ data:', {
        //   location: _this.currentLocation,
        //   topChapterLabel: _this.componentList[_this.currentIndex].firstLevelLabel,
        //   topChapterId: _this.componentList[_this.currentIndex].firstLevelId,
        //   locationChapterId: _this.componentList[_this.currentIndex].locationChapterId,
        //   chapterOrderNum: _this.componentList[_this.currentIndex].chapterOrderNum,
        //   textOrderNum: _this.getTextOrderNum(data.noteModel),
        //   id: new Date().getTime(),
        //   ...data.noteModel
        // })
        if (data.state) {
          _this.$refs.xmlToolbarPhone.isShowToolbar = false;
        }
        _this.isShowToolbarTip = data.state;
        _this.tippyTplBarId = data.tippyTplBarId;
      });
      // 打开超链接
      this.$EventBus.$on('openTextHyperlink', function (data) {
        if (_this.pageType == 'pc' && _this.linkOpenLabel) {
          window.open(data.href, 'mozillaTab');
        } else {
          console.log(_this.pageType != 'pc' && !_this.isOpenHyperlink, _this.pageType, _this.isOpenHyperlink, 'dkdkdkd');
          if (_this.pageType != 'pc' && !_this.isOpenHyperlink) {
            _this.downloadFileLink = data.href;
            _this.$refs.downFileUppop.prompt = '受小程序限制该网址无法直接打开，请复制至手机浏览器观看';
            setTimeout(() => {
              _this.$refs.downFileUppop.isShow = true;
            }, 200);
          } else {
            _this.fileBaseUrl = data.href;
            _this.fileBaseTitle = '';
            _this.showPdf = true;
          }
        }
      });
      // 添加AI解析
      this.$EventBus.$on('openAiParsing', function (data) {
        _this.openAiParsing(data);
      });
      this.$EventBus.$on('showToastTippy', function (data) {
        _this.showToast(data.msg, 'warning');
      });
      this.$EventBus.$on('xmlOpenLink', function (data) {
        _this.openPage({
          url: data.url,
          title: data.title,
          width: data.width,
          height: data.height
        });
      });

      // 删除书签
      this.$EventBus.$on('deleteBookmark', function (model, feedback) {
        _this.$emit('deleteBookmark', {
          ...model
        }, () => feedback(model.markId));
      });
      this.$EventBus.$on('createHighlight', function (model, rollback) {
        if (!_this.currentLocation) {
          _this.$message.error('匹配高亮位置失败');
          rollback(model.markId);
          return;
        }
        _this.$emit('addHighlight', {
          ...model,
          location: _this.currentLocation,
          topChapterLabel: _this.componentList[_this.currentIndex].firstLevelLabel,
          topChapterId: _this.componentList[_this.currentIndex].firstLevelId,
          locationChapterId: _this.componentList[_this.currentIndex].locationChapterId,
          chapterOrderNum: _this.componentList[_this.currentIndex].chapterOrderNum,
          textOrderNum: _this.getTextOrderNum(model),
          id: new Date().getTime()
        }, () => rollback(model.markId));
      });
      this.$EventBus.$on('createLink', function (model, rollback) {
        if (!_this.currentLocation) {
          _this.$message.error('匹配划线位置失败');
          rollback(model.markId);
          return;
        }
        _this.$emit('addLink', {
          ...model,
          location: _this.currentLocation,
          topChapterLabel: _this.componentList[_this.currentIndex].firstLevelLabel,
          topChapterId: _this.componentList[_this.currentIndex].firstLevelId,
          locationChapterId: _this.componentList[_this.currentIndex].locationChapterId,
          chapterOrderNum: _this.componentList[_this.currentIndex].chapterOrderNum,
          textOrderNum: _this.getTextOrderNum(model),
          id: new Date().getTime()
        }, () => rollback(model.markId));
      });

      // 更新学习统计情况
      this.$EventBus.$on('learningStatistics', function (model) {
        let info = model.info || _this.currentGroupInfo;
        _this.$emit('learningStatistics', {
          type: model.type,
          ...info
        });
      });
      function isMobile() {
        return 'ontouchstart' in window || 'onmsgesturechange' in window;
      }
      const diffThreshold = 50;
      const originHeight = document.documentElement.clientHeight || document.body.clientHeight;
      function handleMobileKeyboard() {
        const resizeHeight = document.documentElement.clientHeight || document.body.clientHeight;
        if (Math.abs(originHeight - resizeHeight) > diffThreshold) {
          _this.keyboardShow = true;
        } else {
          _this.keyboardShow = false;
        }
      }
      if (isMobile()) {
        window.addEventListener('resize', handleMobileKeyboard);
      }
      this.$once('hook:beforeDestroy', () => {
        _this.$EventBus.$off('createNote');
        _this.$EventBus.$off('createHighlight');
        _this.$EventBus.$off('createLink');
        _this.$EventBus.$off('addTeacherResources');
        _this.$EventBus.$off('openTeacherResources');
        _this.$EventBus.$off('createError');
        isMobile() && window.removeEventListener('resize', handleMobileKeyboard);
      });

      // 监听键盘事件，选中内容大于200字符时禁止复制
      document.addEventListener('keydown', function (event) {
        let text = '';
        //ctrl + C || command + C
        if (event.ctrlKey === true && event.which === 67 || event.metaKey === true && event.which === 67) {
          if (document.Selection) {
            //ie浏览器
            text = document.selection.createRange().text || '';
          } else {
            //标准浏览器
            text = window.getSelection().toString() || '';
          }
          if (text.length > 200) {
            event.preventDefault();
          }
        }
      }, false);
      this.initMagicLinkPopover();
    });
    // try {
    //   // 将未标记图像路径转换为 base64
    //   this.bookmarkIconSrc = convertImageToBase64(bookmarkIconSrc);
    // } catch (error) {
    //   console.error('notbase64:', error);
    // }
    // if (this.pageType == 'h5') {
    //   window.addEventListener('scroll', this.updateScrollTop)
    // }

    // this.$EventBus.$on('addTeacherResources', function (model, rollback) {
    //   // this.$emit('addTeacherResources', model, rollback)
    //   console.log(addTeacherResources)
    // }),
  },
  methods: {
    initMagicLinkPopover() {
      // 初始化
      const container = document.documentElement;
      const popover = new MagicLinkPopover({
        parent: container,
        selector: 'magic-link[data-show-type="popover"]',
        // 目标元素选择器
        titleAttr: 'title',
        // 对应 data-popover-title 属性
        contentAttr: 'content',
        // 对应 data-popover-content 属性
        placement: 'top',
        theme: 'dark',
        showDelay: 100,
        hideDelay: 200,
        preview: this.$hevueImgPreview
      });
      this.$once('hook:beforeDestory', () => {
        popover.destroy();
      });
    },
    // @pos 过滤当前章节的教师笔记
    filterTeacherNoteList(targetChapterId) {
      if (this.isShowTeacherResource) {
        return this.resourcesList.filter(item => {
          // let chapterId = item.location.split('/')[1]
          return item.locationChapterId === targetChapterId;
        });
      }
    },
    filterStudentNoteList(targetChapterId) {
      // @todo locationChapterId数据不准确, 待修复后校验此处处理
      return this.notesList.filter(item => {
        // let chapterId = item.location.split('/')[1]
        return item.locationChapterId === targetChapterId;
      });
    },
    filterHighlightList(targetChapterId) {
      // @todo locationChapterId数据不准确, 待修复后校验此处处理
      return this.highlightList.filter(item => {
        // let chapterId = item.location.split('/')[1]
        return item.locationChapterId === targetChapterId;
      });
    },
    getPersistentSetting() {
      this.persistentReaderSetting = JSON.parse(localStorage.getItem('reader-setting_#_' + this.textBookData.id)) || {
        themeBgColor: '',
        themeFontFamily: '',
        themeFontSize: 2,
        themeLetterSpacing: 'null',
        themeLineHeight: 'null',
        readingMode: this.loadingMode
      };
      if (!this.env.isReadingMode) {
        this.persistentReaderSetting.readingMode = this.loadingMode;
      }
    },
    persistentSettingChange(key, value) {
      let newSetting = Object.assign({}, this.persistentReaderSetting, {
        [key]: value
      });
      localStorage.setItem('reader-setting_#_' + this.textBookData.id, JSON.stringify(newSetting));
      this.persistentReaderSetting = JSON.parse(localStorage.getItem('reader-setting_#_' + this.textBookData.id)) || {
        themeBgColor: '',
        themeFontFamily: '',
        themeFontSize: 2,
        themeLetterSpacing: 'null',
        themeLineHeight: 'null',
        readingMode: this.loadingMode
      };
      if (!this.env.isReadingMode) {
        this.persistentReaderSetting.readingMode = this.loadingMode;
      }
    },
    settingChange(key, value) {
      this.currentGroupInfo.readingMode = value;
      if (key == 'readingMode') {
        setTimeout(() => {
          this.$refs.xmlPreviewLooseLeaf.jumpTo({
            location: this.currentGroupInfo.location,
            maxTop: -30,
            type: 'catalog',
            selectorType: '',
            selectorId: '',
            markTarget: '',
            classIndex: 0,
            componentIndex: this.currentGroupInfo.componentIndex
          });
        }, 200);
      }
      this.$emit('settingChange', key, value);
      this.persistentSettingChange(key, value);
      setTimeout(() => {
        // @todo 处理样式变更引发的重排或重绘后笔记位置的同步更新
        this.$refs.xmlPreviewLooseLeaf.previewRepaint();
      }, 300);
    },
    clickToolbarPhone(e) {
      if (e.name == '设置') {
        this.$refs.xmlPreviewLooseLeaf.getPaddingTop();
      }
    },
    setThemeSecondaryColor(bgColor) {
      let color = tinycolor(bgColor);
      if (!color.isValid()) {
        document.getElementById('xmlPreviewDom').setAttribute('data-theme-secondary-color', '');
        document.getElementById('xmlPreviewDom').style.removeProperty('--reader-theme-secondary-color');
        return;
      }
      let secondaryColor = '';
      if (color.getLuminance() < 0.4) {
        secondaryColor = color.clone().lighten(15).toString();
      } else {
        secondaryColor = color.clone().darken(5).toString();
      }
      document.getElementById('xmlPreviewDom').setAttribute('data-theme-secondary-color', secondaryColor);
      document.getElementById('xmlPreviewDom').style.setProperty('--reader-theme-secondary-color', secondaryColor);
    },
    setThemeFontColor(darkColor) {
      document.getElementById('xmlPreviewDom').setAttribute('data-theme-font-color', darkColor);
      darkColor !== '' ? document.getElementById('xmlPreviewDom').style.setProperty('--reader-theme-font-color', '#FEFEFE') : document.getElementById('xmlPreviewDom').style.removeProperty('--reader-theme-font-color');
    },
    setThemeLinkColor(darkColor) {
      document.getElementById('xmlPreviewDom').setAttribute('data-theme-link-color', darkColor);
      darkColor !== '' ? document.getElementById('xmlPreviewDom').style.setProperty('--reader-theme-link-color', '#23ABF2') : document.getElementById('xmlPreviewDom').style.removeProperty('--reader-theme-link-color');
    },
    setThemeColor(bgColor) {
      document.getElementById('xmlPreviewDom').setAttribute('data-theme-bg-color', bgColor);
      let color = tinycolor(bgColor),
        darkThemeBgColor = '';
      color.isValid() ? document.getElementById('xmlPreviewDom').style.setProperty('--reader-theme-color', color.toString()) : document.getElementById('xmlPreviewDom').style.removeProperty('--reader-theme-color');
      this.setThemeSecondaryColor(bgColor);
      if (color.isValid() && color.getLuminance() < 0.25) {
        darkThemeBgColor = color.toString();
      }
      this.setThemeFontColor(darkThemeBgColor);
      this.setThemeLinkColor(darkThemeBgColor);
    },
    setThemeFontSize(size) {
      document.getElementById('xmlPreviewDom').setAttribute('data-theme-font-size', size == '2' ? '' : size);
      document.getElementById('xmlPreviewDom').style.setProperty('--reader-theme-font-size', fontSizeValueMap[size]);
      let moduleAttribute = this.textBookData.moduleAttributeInfo || '[]';
      let newValue = {};
      if (JSON.parse(moduleAttribute)?.length) {
        let i = JSON.parse(moduleAttribute).findIndex(item => item.type === 'freeOptions' && item.target === 'textbook');
        newValue = JSON.parse(moduleAttribute)[i]?.data || {};

        // console.log(containerDom.getElementsByTagName('p'))
        // JSON.parse(moduleAttribute).forEach((module) => {
        //   if (module.type === 'component' && module.target === 'xml-single-text-group') {
        //     if (module.data?.injectStyle) {
        //       injectStyle += module.data.injectStyle
        //     }
        //   }
        // })
      } else {
        newValue = {
          marginTop: 0,
          padding: 6,
          cjkFont: "微软雅黑,'Microsoft YaHei'",
          noncjkFont: "'times new roman'",
          fontColor: '#333333',
          fontSize: '16px',
          letterSpace: 0,
          lineHeight: 2,
          indent: '2em',
          textAlign: 'justify'
        };
      }
      let {
        marginTop,
        padding,
        cjkFont,
        noncjkFont,
        fontColor,
        fontSize,
        indent,
        letterSpace,
        lineHeight,
        textAlign
      } = newValue;
      let fontFamilyBase = "<NONCJK>, <CJK>, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'";
      let cjkHolder = cjkFont || "微软雅黑,'Mircosoft Yahei'";
      let noncjkHolder = noncjkFont || "'Times New Roman'";
      let fontFamilySetup = fontFamilyBase.replace('<CJK>', cjkHolder);
      fontFamilySetup = fontFamilySetup.replace('<NONCJK>', noncjkHolder);
      let containerDom = document.getElementById('xmlPreviewDom');
      document.getElementById('xmlPreviewDom').style.setProperty('--book-padding', (newValue.padding || newValue.padding == '0' ? newValue.padding : 6) + 'px');
      document.getElementById('xmlPreviewDom').style.setProperty('--book-marginTop', newValue.marginTop + 'px');
      containerDom.style.setProperty('--book-fontFamily', fontFamilySetup);
      containerDom.style.setProperty('--book-fontColor', fontColor);
      containerDom.style.setProperty('--book-fontSize', fontSize);
      containerDom.style.setProperty('--book-letterSpace', letterSpace + 'px');
      containerDom.style.setProperty('--book-lineHeight', lineHeight);
      containerDom.style.setProperty('--book-indent', indent);
      containerDom.style.setProperty('--book-textAlign', textAlign);
      // if(this.userType === 'student' && isMobile()) {
      // }
    },
    setThemeFontFamily(firstFamily) {
      document.getElementById('xmlPreviewDom').setAttribute('data-theme-font-family', firstFamily);
      firstFamily === '' ? document.getElementById('xmlPreviewDom').style.removeProperty('--reader-theme-font-family') : document.getElementById('xmlPreviewDom').style.setProperty('--reader-theme-font-family', firstFamily);
      // if(this.userType === 'student' && isMobile()) {
      // }
    },
    setThemeLineHeight(lineHeight) {
      if (lineHeight != 'null') {
        document.getElementById('xmlPreviewDom').classList.add('add-Line-Height');
      } else {
        document.getElementById('xmlPreviewDom').classList.remove('add-Line-Height');
      }
      document.getElementById('xmlPreviewDom').setAttribute('data-theme-line-height', lineHeight ? lineHeight + 'px' : '');
      lineHeight === undefined ? document.getElementById('xmlPreviewDom').style.removeProperty('--reader-theme-line-height') : document.getElementById('xmlPreviewDom').style.setProperty('--reader-theme-line-height', lineHeight);
    },
    setThemeLetterSpacing(letterSpacing) {
      document.getElementById('xmlPreviewDom').setAttribute('data-theme-letter-spacing', letterSpacing ? letterSpacing + 'px' : '');
      letterSpacing === undefined ? document.getElementById('xmlPreviewDom').style.removeProperty('--reader-theme-letter-spacing') : document.getElementById('xmlPreviewDom').style.setProperty('--reader-theme-letter-spacing', letterSpacing + 'px');
    },
    clickdigital(e) {
      let nodeName = 'IMG,A,Video';
      if (nodeName.indexOf(e.target.nodeName) == -1) {
        this.$refs.xmlToolbarPhone.isShowToolbar = !this.$refs.xmlToolbarPhone.isShowToolbar;
      }
    },
    // 通过目录列表和活页列表获取数据
    queryData() {
      this.learningTime = parseInt(new Date().getTime() / 1000);
      this.pageTitle = this.textBookData.textBooksName;
      const filterMenu = (menuList, level, id) => {
        return menuList.filter(item => {
          return level <= this.catalogLevel;
        }).map(item => {
          let xmlCompRef = '';
          if (this.looseLeafData[item.id] && this.looseLeafData[item.id].looseLeafInfo && JSON.parse(this.looseLeafData[item.id].looseLeafInfo).length > 0) {
            xmlCompRef = JSON.parse(this.looseLeafData[item.id].looseLeafInfo)[0].xmlCompRef;
          } else {
            xmlCompRef = item.xmlCompRef;
          }
          item = Object.assign({}, {
            ...item,
            locationChapterId: id ? id : item.id,
            xmlCompRef
          });
          if (item.children?.length) {
            let locationChapterId = id ? id : level == this.textBookMergeLevel ? item.id : '';
            item.children = filterMenu(item.children, level + 1, locationChapterId);
          }
          return item;
        });
      };
      this.contentList = [];
      this.componentTotal = 0;
      this.contentList = [];
      this.componentList = [];
      this.readableChapters = [];
      this.textBookResource = {};
      this.selectId = '';
      setTimeout(() => {
        formatTextBook({
          textBookData: this.textBookData,
          catalogList: this.catalogList,
          looseLeafData: this.looseLeafData,
          isTrial: this.isTrial,
          isTrialIndex: this.isTrialIndex,
          trialChapterList: this.trialChapterList,
          graphStoreKeyPrefix: this.graphStoreKeyPrefix
        }).then(res => {
          this.componentTotal = res.componentTotal;
          this.contentList = res.contentList;
          this.componentList = res.componentList;
          this.readableChapters = res.readableChapters;
          this.textBookResource = res.textBookResource;
          this.selectId = this.contentList[0].id;
          this.textCatalog = filterMenu(res.catalogList, 1);
          this.chapterData = res.chapterData;
          //数据遍历结束
          //设置预设样式
          let list = [];
          this.presetStyleList.forEach(item => {
            if (item.type == '6') {
              let styleInfo = JSON.parse(item.styleInfo);
              list.push(styleInfo);
            }
          });
          this.setStyle(list);
          let locationList = this.location ? this.location.split('/') : [];
          locationList.length > 3 ? this.scrollId = locationList[3] : this.scrollId = this.location;
          if (locationList.length > 0 && locationList[1] != this.contentList[0].id && this.chapterId == '') {
            if (this.continueReading && !this.readOnly && JSON.stringify(this.componentList).indexOf(this.location) !== -1) {
              //是否展示继续阅读弹窗
              if (this.env.isGuoKai) {
                this.$refs.learningProgress.open({
                  type: '1'
                });
              } else {
                this.continueRead = true;
              }
            }
          } else if (this.chapterId) {
            setTimeout(() => {
              for (let i = 0; i < this.componentList.length; i++) {
                if (this.componentList[i].chapterId == this.chapterId) {
                  let data = {
                    location: this.componentList[i].location,
                    maxTop: -30,
                    type: 'catalog',
                    selectorType: '',
                    selectorId: '',
                    markTarget: '',
                    classIndex: 0
                  };
                  this.$refs.xmlPreviewLooseLeaf.jumpTo({
                    componentIndex: i,
                    ...data
                  });
                  return;
                }
              }
            }, 500);
          }
        });
      }, 1000);
    },
    // 查询元素是否在可视窗口
    initObserver() {
      this.videoDomList = document.querySelectorAll('video') || [];
      this.audioDomList = document.querySelectorAll('aodio') || [];
      // let ADom = document.getElementById('xmlPreviewDom').getElementsByTagName('a')
      // if (ADom) {
      //   for (let i = 0; i < ADom.length; i++) {
      //     if (JSON.stringify(this.releaseUrlList).indexOf(ADom[i].href) == -1) {
      //       ADom[i].onclick = function (e) {
      //         if (_this.pageType == 'pc' && _this.linkOpenLabel) {
      //           window.open(ADom[i].href, 'mozillaTab')
      //         } else {
      //           if (_this.pageType != 'pc' && !_this.isOpenHyperlink) {
      //             _this.downloadFileLink = ADom[i].href
      //             _this.$refs.downFileUppop.prompt = '受小程序限制该网址无法直接打开，请复制至手机浏览器观看'
      //             setTimeout(() => {
      //               _this.$refs.downFileUppop.isShow = true
      //             }, 200)
      //           } else {
      //             _this.fileBaseUrl = ADom[i].href
      //             _this.fileBaseTitle = ''
      //             _this.showPdf = true
      //           }
      //         }

      //         return false
      //       }
      //     }
      //   }
      // }
      let elems = document.querySelectorAll('.xml-parent-group-block');
      let rootElem = document.querySelector('.preview-counter-main');
      let rootRect = rootElem.getBoundingClientRect();
      let options = {
        root: rootElem,
        rootMargin: `0px 0px ${0 - rootRect.height + 160}px 0px`,
        threshold: 0
      };
      this.scrollObserver = new IntersectionObserver(entries => {
        entries.forEach(entrie => {
          // 遍历entries数组
          if (entrie.isIntersecting) {
            // console.log(entrie)
            let pageNum = entrie.target.id.split('scroll-item-')[1] || '0';
            // 当前元素可见
            let boxId = entrie.target.classList[2];
            this.selectId = boxId.split('/').length > 2 ? boxId.split('/')[1] : this.selectId;
            if (boxId !== this.readLocation && boxId) {
              if (boxId.indexOf('xml-single-video-group') !== -1) {
                this.videoDomId = boxId;
              }
              if (boxId.indexOf('xml-single-audio-group') !== -1) {
                this.audioDomId = boxId;
              }
              if (boxId.indexOf('xml-digital-teaching') !== -1) {
                this.xmlDigitalTeaching = boxId;
              }
              if (boxId.indexOf('xml-single-image-group') !== -1) {
                //如果是图片
                let Dom = entrie.target.querySelector('.hua-lang-image-container');
                if (Dom) {
                  let scrollDom = Dom.querySelector('.hua-lang');
                  //如果是画廊
                  if (scrollDom) {
                    let time = parseInt((scrollDom.offsetWidth - this.xmlReaderWidth) / 50);
                    scrollDom.style.animation = `scroll ${time}s`;
                    Dom.classList.add('hua-lang-image-container-scroll');
                  }
                }
              }
              this.readLocation = boxId;
            }
            this.updateReadLocation(pageNum);
          }
        });
      }, this.pageType == 'pc' ? options : {
        threshold: 0.01,
        rootMargin: `0px 0px ${0 - window.innerHeight + 60}px 0px`
      });
      if (elems) {
        elems.forEach(elem => {
          this.scrollObserver.observe(elem);
        });
      }
    },
    findChild(data) {
      console.log(data, 'findChild');
      if (data?.children && data?.children.length > 0) {
        let length = data.children.length - 1;
        if (length >= 0) {
          return this.findChild(data.children[length]);
        }
      } else {
        // console.log(data.id,'data.id');
        return data.id;
      }
    },
    updateReadLocation(pageNum) {
      // observationChapter
      // this.chapterSchedule = 0
      let isUpdate = false;
      const observer = className => {
        let rootElem = document.querySelector('#xmlPreviewDom');
        let elems = rootElem.querySelectorAll('.chapter_' + className);
        // console.log('elems', elems, className)
        let targetId = 0;
        this.chapterIo = new IntersectionObserver(entries => {
          entries.forEach(entrie => {
            if (entrie.isIntersecting) {
              targetId = Number(entrie.target.id.split('scroll-item-')[1]);
              if (!this.observationChapterList.includes(entrie.target.className)) {
                this.observationChapterList.push(entrie.target.className);
              }
            }
            // console.log(entrie,'entrie.isIntersecting');
          });
          if (elems) {
            let startIndex = this.chapterData[className].startIndex;
            let endIndex = this.chapterData[className].endIndex;
            // console.log("targetId:", targetId, endIndex, startIndex);
            // this.chapterSchedule = (targetId / endIndex) * 100
            this.chapterSchedule = (targetId - startIndex) / (endIndex - startIndex) * 100;
            // console.log("this.chapterSchedule:", this.currentGroupInfo);
            if (this.currentGroupInfo.endLevelId?.children && this.currentGroupInfo.endLevelId?.children.length > 0) {
              let length = this.currentGroupInfo.endLevelId.children.length - 1;
              let id = this.findChild(this.currentGroupInfo.endLevelId.children[length]);
              console.log('this.currentGroupInfo:', this.currentGroupInfo, id);
              if (this.currentGroupInfo.chapterId == id && this.chapterSchedule > 90) {
                this.chapterSchedule = 100;
              }
            }
            // console.log("chapterSchedule:",this.chapterSchedule);
            // console.log('this.observationChapterList',this.observationChapterList.length ,elems.length,this.chapterSchedule,this.learningChapter.includes(className),this.learningChapter )
            if (this.chapterSchedule > 70 && !this.learningChapter.includes(className)) {
              if (this.learningChapter.indexOf(className) == -1) {
                this.learningChapter.push(className);
              }
              //  console.log('this.learningChapter',this.learningChapter)
              updateProgress();
            }
            // 封面前言短章节
            if (targetId == endIndex - 1) {
              if (this.learningChapter.indexOf(className) == -1) {
                this.learningChapter.push(className);
              }
              this.chapterSchedule = 100;
              //  console.log('this.learningChapter',this.learningChapter)
              updateProgress();
            }
          }
        }, {
          root: rootElem,
          threshold: 0.1
        });
        if (elems) {
          elems.forEach((elem, index) => {
            this.chapterIo.observe(elem);
          });
        }
      };
      clearTimeout(this.scrollTimer);
      let location = this.readLocation.indexOf('xml-digital-teaching') !== -1 ? this.readLocation : this.xmlDigitalTeaching + '/' + this.readLocation;
      let t1 = document.documentElement.scrollTop || document.body.scrollTop;
      let list = location.split('/');
      let locationId = list[0] + '/' + list[1] + '/' + list[2];
      let index = this.componentList.findIndex(value => value.location == locationId);
      this.currentGroupInfo = index !== -1 ? this.componentList[index] : this.currentGroupInfo;
      // console.log('this.currentGroupInfo', this.currentGroupInfo)

      if (this.observationChapter != this.currentGroupInfo.chapterId || this.chapterSchedule != 100) {
        // this.learningChapter=this.learningChapter.slice(0,-1)
        this.observationChapter = this.currentGroupInfo.chapterId;
        if (this.chapterIo) {
          this.chapterIo.disconnect();
        }
        this.observationChapterList = [];
        observer(this.currentGroupInfo.firstLevelId);
      }
      let num = (index + 1) / this.componentTotal * 100;
      // console.log('this.componentList', this.learningChapter)
      const updateProgress = () => {
        let learningTime = parseInt(new Date().getTime() / 1000) - this.learningTime;
        this.schedule = pageNum > this.componentList.length - 10 && this.chapterSchedule > 70 ? '100' : num.toFixed(1);
        this.locationData = {
          location: location,
          //当前阅读位置
          schedule: Number(this.schedule),
          //当前阅读进度
          chapterSchedule: Number(this.chapterSchedule.toFixed(1)),
          //当前章阅读进度
          learningTime: learningTime,
          //本次学习时长
          learningDuration: this.learningDuration + learningTime,
          //总学习时长
          chapterId: this.currentGroupInfo.chapterId,
          chaptName: this.currentGroupInfo.label,
          learningChapter: this.learningChapter.length,
          //本次阅读章数
          learningChapterList: this.learningChapter,
          //本次学习的章节id组
          firstLevelId: this.currentGroupInfo.firstLevelId //一级章节id
        };
        // console.log(this.locationData, '本地更新新的章节目录', this.learningChapter)
        this.$emit('updateReadLocation', this.locationData);
      };
      this.scrollTimer = setTimeout(() => {
        let t2 = document.documentElement.scrollTop || document.body.scrollTop;
        if (t2 == t1 || isUpdate) {
          updateProgress();
        }
      }, 1000);
    },
    // pc删除笔记
    deleteNotoPC(item, type) {
      if (type == 'notes') {
        this.$emit('deleteNotes', item);
      } else if (type == 'bookmark') {
        this.$emit('deleteBookmark', item);
      }
    },
    // 目录跳转指定章节
    catalogClick(obj) {
      this.showType = 'leaf';
      this.selectId = obj.id;
      this.JumpPosition({
        location: 'xml-digital-teaching/' + obj.id + '/' + obj.xmlCompRef,
        maxTop: -30,
        type: 'catalog',
        selectorType: '',
        selectorId: '',
        markTarget: '',
        classIndex: 0
      });
    },
    /**
     * 跳转到指定位置
     * @param {*} location 当前块的id
     * @param {*} maxTop 滚动距离后距离可视窗口顶部的距离
     * @param {*} type 跳转类型resource：资源，search：搜索，marker：标记
     * @param {*} selectorType 选择器selectorId的类型：id，class
     * @param {*} selectorId 选择器id或class值
     * @param {*} markTarget 笔记、高亮的item
     * @param {*} classIndex type为class时，用于滚动到第几个Dom
     */

    JumpPosition(data) {
      data.maxTop = -90;
      const {
        location,
        type,
        markTarget
      } = data;
      let list = location.split('/');
      let chapterId = list[1];
      if (this.isTrial) {
        if (!this.readableChapters.includes(chapterId)) {
          this.showToast(this.trialPrompt, 'warning');
          return;
        }
        // if (this.componentList.findIndex((item) => item.chapterId == chapterId) == -1) {
        //   this.showToast(this.trialPrompt, 'warning')
        //   return
        // }
      }
      // console.log(data,this.componentList,location)

      let index = this.componentList.findIndex(item => item.location == location);
      setTimeout(() => {
        this.$refs.xmlPreviewLooseLeaf.jumpTo({
          componentIndex: index,
          ...data
        }, () => {
          if (markTarget) {
            setTimeout(() => {
              this.$EventBus.$emit(`markJumpIn-${markTarget.location}`, markTarget);
            }, 500);
          }
          if (type === 'search') {
            let Dom = document.getElementById(location);
            if (Dom) {
              this.searchHighlight(Dom);
            }
          }
        });
        this.currentGroupInfo = index !== -1 ? this.componentList[index] : this.currentGroupInfo;
        this.selectId = this.currentGroupInfo.chapterId;
      }, 300);
    },
    prevPage() {
      // this.$refs.xmlPreviewLooseLeaf
      if (this.currentGroupInfo.startIndex > 0) {
        let i = this.currentGroupInfo.startIndex - 1;
        this.$refs.xmlPreviewLooseLeaf.jumpTo({
          componentIndex: this.componentList[i].startIndex,
          maxTop: 0
        });
      }
    },
    nextPage() {
      if (this.currentGroupInfo.endIndex < this.componentList.length) {
        let i = this.currentGroupInfo.endIndex + 1;
        this.$refs.xmlPreviewLooseLeaf.jumpTo({
          componentIndex: this.componentList[i].startIndex,
          maxTop: 0
        });
      }
    },
    // 搜索内容高亮
    searchHighlight(Dom) {
      const keyword = this.seachInput.replace(/\s+/g, '');
      let context = new mark(Dom);
      context.mark(keyword, {
        className: 'xml-search-highlight'
      });
      setTimeout(() => {
        context.unmark();
      }, 3000);
    },
    // 打开教师资源列表
    openTeacherResoucesList(item) {
      if (this.pageType == 'pc') {
        this.$refs.xmlToolBarPc.clickToolbar(1);
        setTimeout(() => {
          this.$refs.xmlResourceListPc.scrollFun(item.firstLevelId, item.location);
        }, 200);
      } else {
        this.$refs.xmlToolbarPhone.openTeacherResoucesList(item);
      }
    },
    // 跳转到资源所在位置
    resourceDetails(data) {
      this.seachInput = data.seachText;
      this.JumpPosition(data);
    },
    // 获取当前点击的块
    clickComp(item) {
      this.currentLocation = item.location;
      this.currentIndex = item.componentIndex;
    },
    // 资源类型文件下载
    downloadFile(e) {
      let url = e.item.uploadFileUrl;
      if (e.item.uploadFileUrl.indexOf('./') !== -1) {
        url = this.basisPath + e.item.uploadFileUrl.split('./')[1];
      }
      if (this.downloadType == 'pop-up') {
        if (this.pageType == 'pc') {
          window.open(url);
        } else {
          this.downloadFileLink = url;
          this.$refs.downFileUppop.isShow = true;
        }
      } else {
        this.$emit('downloadFile', e);
      }
    },
    // 编辑教师笔记
    handleUpdateTeacherNotes(e) {
      this.$refs.addTeacherResources.open({
        isEdit: true,
        ...e
      });
    },
    // 保存修改的笔记
    saveNote(data) {
      this.$emit('editNote', data);
    },
    // 确认添加教师资源
    addResources(e) {
      this.$emit('addResources', e);
      this.$EventBus.$emit(`underlineSign-${e.location}`, {
        ...e,
        signType: 'underline',
        operationType: 'add'
      });
    },
    // 确认添加教师笔记
    addTeacherNote(e) {
      this.$emit('addTeacherNote', e);
      this.$EventBus.$emit(`underlineSign-${e.location}`, {
        ...e,
        signType: 'underline',
        operationType: 'add'
      });
    },
    underlineSign(e) {
      this.$EventBus.$emit(`underlineSign-${e.location}`, {
        ...model,
        signType: 'underline',
        operationType: 'add'
      });
    },
    // 编辑教师资源
    editTeachingResource(e) {
      this.$refs.addTeacherResources.open({
        isEdit: true,
        ...e
      });
    },
    // 确认编辑教师资源
    editResources(e) {
      this.$emit('editResources', e);
    },
    // 确认删除教师笔记
    deleteTeacherNotes(e) {
      this.$EventBus.$emit(`underlineSign-${e.location}`, {
        ...e,
        signType: 'underline',
        operationType: 'remove'
      });
      this.$emit('deleteResource', e);
    },
    // 确认删除教师资源
    deleteTeachingResource(e) {
      this.$EventBus.$emit(`underlineSign-${e.location}`, {
        ...e,
        signType: 'underline',
        operationType: 'remove'
      });
      this.$emit('deleteResource', e);
    },
    // 教师资源预览
    resourceReader(e) {
      let url = '';
      if (e.fileUrl.indexOf('.epub') !== -1 || e.fileUrl.indexOf('.pdf') !== -1) {
        url = e.fileUrl;
      } else {
        url = this.officePreviewPath + e.fileUrl;
      }
      console.log('阅读地址', url);
      this.openPage({
        url: url,
        title: e.resourcesName
      });
      this.$refs.xmlToolbarPhone.isShowToolbar = false;
    },
    // 打开html包
    openHtml(data) {
      this.openPage({
        url: data.previewUrl,
        title: data.title
      });
      if (this.pageType !== 'pc') {
        this.$refs.xmlToolbarPhone.isShowToolbar = false;
      }
    },
    // 复制html链接
    copyHtmlUrl(data) {
      this.downloadFileLink = data.link;
      this.$refs.downFileUppop.isShow = true;
      this.$refs.downFileUppop.prompt = '受小程序限制该网址无法直接打开，请复制至手机浏览器观看';
    },
    // 打开教材整本知识图谱浏览弹窗
    openGrapgViewer() {
      if (!Object.keys(this.bookGraphModel).length) {
        let bookGraphModel = genBookGraphModel(this.textBookData.textBooksName, this.graphStoreKeyPrefix, 3);
        this.bookGraphModel = bookGraphModel;
      }
      this.$refs.graphViewer.open();
    },
    reGenBookGraph(level) {
      let bookGraphModel = genBookGraphModel(this.textBookData.textBooksName, this.graphStoreKeyPrefix, level);
      this.bookGraphModel = bookGraphModel;
    },
    // 添加书签
    addBookmark(location) {
      if (!this.isOperation) {
        return;
      }
      this.isBookmarked = !this.isBookmarked;
      this.isBookmarkAddSuccess = !this.isBookmarkAddSuccess;
      let bookmarkText = '';
      if (this.currentGroupInfo.textList && this.currentGroupInfo.textList.length > 0) {
        bookmarkText = this.currentGroupInfo.textList[0].title || this.currentGroupInfo.label;
      } else if (this.currentGroupInfo.Text) {
        bookmarkText = this.removeStyle(this.currentGroupInfo.Text) || this.currentGroupInfo.label;
      } else {
        bookmarkText = this.currentGroupInfo.label;
      }
      let data = {
        classId: this.classId,
        chapterId: this.currentGroupInfo.chapterId,
        firstLevelId: this.currentGroupInfo.firstLevelId,
        firstLevelLabel: this.currentGroupInfo.firstLevelLabel,
        orderNum: this.currentGroupInfo.componentIndex,
        locationChapterId: this.componentList[this.currentIndex].locationChapterId,
        chapterOrderNum: this.componentList[this.currentIndex].chapterOrderNum,
        type: 'bookmark',
        location: location,
        creationTime: new Date(),
        bookmarkId: new Date().getTime(),
        bookmarkText: bookmarkText,
        id: new Date().getTime()
      };
      this.$emit('addBookmark', data);
    },
    // 移除书签
    deleteBookmark(location) {
      if (!this.isOperation) {
        return;
      }
      let i = this.bookmarkList.findIndex(item => item.location === location);
      if (i !== -1) {
        this.$emit('deleteBookmark', this.bookmarkList[i]);
      }
    },
    // 资源阅读
    showFileReader(e) {
      // console.log('showFileReadersaddsdasa', e)
      let url = '';
      if (e.fileUrl.indexOf('.epub') !== -1 || e.fileUrl.indexOf('.pdf') !== -1) {
        url = e.fileUrl;
      } else {
        url = this.officePreviewPath + e.fileUrl;
      }
      console.log('阅读地址', url);
      this.openPage({
        url: url,
        title: e.title
      });
    },
    // 复制文本
    CopyFileLkin() {
      let oInput = document.createElement('input');
      oInput.value = this.downloadFileLink;
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand('Copy');
      oInput.remove();
      this.showToast('复制成功', 'success');
    },
    // 打开试卷
    openTestPaper({
      info,
      showRobot
    }) {
      if (!this.isOpenPaper) {
        this.$emit('openTestPaper', {
          info,
          showRobot
        });
        return;
      }
      if (this.pageType == 'pc') {
        const url = this.testPaperPath + `/answer?testPaperId=${info.id}&showRobot=${showRobot}&BookName=${this.pageTitle}`;
        this.openTestPaperPage(url);
      } else {
        const url = this.testPaperPath + `/mobile-answer?testPaperId=${info.id}&showRobot=${showRobot}&BookName=${this.pageTitle}`;
        this.openTestPaperPage(url);
      }
    },
    openTestPaperPage(url) {
      if (this.pageType == 'pc') {
        window.open(url);
      } else {
        this.fileBaseUrl = url;
        this.fileBaseTitle = '';
        this.showPdf = true;
      }
    },
    // 打开内容弹窗
    openPage(e) {
      if (this.pageType == 'pc' && this.linkOpenLabel) {
        window.open(e.url, 'mozillaTab');
      } else {
        this.fileBaseUrl = e.url;
        this.fileBaseTitle = e.title || '';
        this.pdfViewWidth = e.width;
        this.pdfViewHeight = e.height;
        this.showPdf = true;
      }
    },
    // 打开活页
    initializeTheLooseLeaf(e) {
      if (this.env.isGuoKai) {
        this.fileBaseUrl = 'https://looseleaf-v2.ysy.crtvup.com.cn/previewLooseLeaf?pageType=h5&businessType=looseLeaf&uuid=115cda4f-0403-4df0-9b70-2a4047644193&looseLeafId=' + e.looseLeafId;
      } else {
        let data = this.looseLeafData[e.looseLeafId];
        this.fileBaseTitle = data.looseLeafName;
        this.fileBaseUrl = '';
        this.dialogData = {
          id: e.looseLeafId,
          textBookData: data,
          catalogList: [{
            children: [],
            hiddenFlag: '0',
            id: e.looseLeafId,
            label: data.looseLeafName,
            level: null,
            orderNum: 0,
            parentId: null,
            uploadFileUrl: ''
          }],
          looseLeafData: data,
          systemEnvId: this.systemEnvId,
          testPaperPath: this.testPaperPath,
          basisPath: this.basisPath
        };
      }
      // this.dialogData.looseLeafData[e.looseLeafId] = data
      this.showPdf = true;
    },
    //AI解析
    setanalysis(e) {
      if (!this.$refs.xmlRobotRef) {
        this.$emit('setanalysis', e);
      } else {
        this.$refs.xmlRobotRef.openAiAnalysis(e.aiType, e.value);
      }
    },
    // 音视频移出窗口暂停
    moveWindowPause() {
      //如果当前窗口的是视频
      if (this.videoDomId) {
        let videoDom = document.getElementById(this.videoDomId);
        if (videoDom.getBoundingClientRect().top < -100 || videoDom.getBoundingClientRect().bottom > (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight + 100)) {
          this.videoDomId = '';
          this.videoDomList.forEach(i => {
            i.pause();
          });
        }
      } else if (this.audioDomId) {
        //如果当前窗口的是视频
        let audioDom = document.getElementById(this.audioDomId);
        if (audioDom.getBoundingClientRect().top < -100 || audioDom.getBoundingClientRect().bottom > (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight + 100)) {
          this.audioDomId = '';
          this.audioDomList.forEach(i => {
            i.pause();
          });
        }
      }
    },
    /**
     * 提示语
     * type
     * @param {*}  warning : 提示
     * @param {*}  error : 错误
     * @param {*}  success : 成功
     */
    showToast(text, type) {
      this.showPrompt = true;
      this.promptText = text;
      this.toastType = type ? type : 'warning';
      setTimeout(() => {
        this.showPrompt = false;
      }, 2000);
    },
    // pc端切换工具栏
    clickToolbar(item) {
      this.resourceType = item.type;
      this.resourceIcon = item.icon;
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      }
    },
    //计算文本在教材中的位置
    getTextOrderNum(e) {
      let paragraph = e.markEfiCode.split('mark(')[1].split('/')[0];
      let start = e.markEfiCode.split(':')[1].split(',')[0];
      let orderNum = e.blockIndex + paragraph.padStart(6, '0') + start.padStart(6, '0');
      return orderNum;
    },
    // 对象数组排序
    sortBy(attr, rev) {
      if (rev == undefined) {
        rev = 1;
      }
      return function (a, b) {
        a = a[attr];
        b = b[attr];
        if (a < b) {
          return rev * -1;
        }
        if (a > b) {
          return rev * 1;
        }
        return 0;
      };
    },
    bookmarkAddSuccess() {
      this.isBookmarkAddSuccess = !this.isBookmarkAddSuccess;
      if (this.isBookmarkAddSuccess) {
        this.$message.success('已添加书签');
      } else {
        this.$message.warning('书签已移除');
      }
    },
    openPcSet() {
      this.$refs.visible.visible = true;
      this.$refs.xmlPreviewLooseLeaf.getPaddingTop();
    },
    openStatistical() {
      this.clickToRespond(operationType[0].value, {
        ...operationType[0]
      });
      this.thisLearnTime = parseInt(new Date().getTime() / 1000) - this.learningTime;
      this.initObserver();
      setTimeout(() => {
        this.$refs.xmlStatisticalChart.open();
      }, 300);
    },
    openclassGrade() {
      this.$refs.classGrade.open();
    },
    joinClass() {
      this.$refs.classGrade.open();
      // if (this.gradesName == '') {
      //   this.$prompt(`邀请码：`, '加入班级', {
      //     confirmButtonText: '加入班级',
      //     showCancelButton:false,
      //     inputPlaceholder:'请输入班级邀请码',
      //     inputPattern: /^.+$/,
      //     inputErrorMessage: '请输入邀请码'
      //   })
      //     .then(({ value }) => {
      //       this.$emit('joinClass', { code: value })
      //     })
      //     .catch(() => {})
      // }
    },
    /**
     * 阅读模式
     * @param {string} type：
     *   - initial：初始值
     *   - immersive：沉浸式阅读，隐藏目录、资源列表
     */
    READER_MODE(type) {
      if (type == 'initial') {
        this.immersiveReader = false;
      } else if (type == 'immersive') {
        this.immersiveReader = true;
      }
    },
    submitAnswer(e) {
      console.log('submitAnswer', e, this.currentGroupInfo);
      this.$emit('learningStatistics', {
        type: 'question',
        ...this.currentGroupInfo,
        e,
        xmlCompRef: e.xmlCompRef
      });
    },
    /**
     * type:点击类型
     * data:点击响应的数据
     */
    clickToRespond(type, data) {
      this.$emit('clickToRespond', {
        type: type,
        data: data
      });
    },
    resetBookGraph() {
      localStorage.setItem(this.graphStoreKeyPrefix + 'g-nodes', JSON.stringify([]));
      localStorage.setItem(this.graphStoreKeyPrefix + 'g-relations', JSON.stringify([]));
    },
    // 打开Ai解析
    openAiParsing(data) {
      // this.$refs.xmlRobotRef
      if (data.isOpen) {
        this.$refs.xmlRobotRef.openAiAnalysis(data.aiType, data.text);
      } else {
        this.$emit('openAiParsing', data);
      }
    },
    // 设置加载预设样式
    setStyle(list) {
      let style = '<style>';
      list.forEach(item => {
        let newCssStr = '';
        item.css.replaceAll('\n', '').split(';').forEach(item2 => {
          newCssStr += item2 + ' !important;';
        });
        style += `.parent-group .optional-text .richtext-reset-container .${item.className} {${newCssStr}}\n`;
        style += `.${item.className} .optional-text .richtext-reset-container .richtext-reset-wrapper--view p{${newCssStr}}\n`;
        style += `.${item.className} .optional-text .richtext-reset-container .richtext-reset-wrapper--edit p{${newCssStr}}\n`;
      });
      style += '</style>';
      $('#xmlDigitalTeachingPreview>style').remove();
      $('#xmlDigitalTeachingPreview').prepend(style);
    }
  }
};

var __$_require_static_images_icons_books_highlight_ht_png__ = "data:image/png;base64,[encoded data, 16208 characters]";

var __$_require_static_images_icons_books_bookmark_ht_top_png__ = "data:image/png;base64,[encoded data, 16280 characters]";

var __$_require_static_images_icons_books_bookmark_ht_top_active_png__ = "data:image/png;base64,[encoded data, 15292 characters]";

var __$_require_static_images_icons_books_statistical_ht_png__ = "data:image/png;base64,[encoded data, 16516 characters]";

var __$_require_static_images_icons_books_grades_ht_02_png__ = "data:image/png;base64,[encoded data, 16252 characters]";

var __$_require_static_images_icons_books_set_ht_up_png__ = "data:image/png;base64,[encoded data, 16288 characters]";

var __$_require_static_images_icons_books_grades_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAgCAYAAAB3j6rJAAAAAXNSR0IArs4c6QAABDdJREFUWEftlnuIVHUUxz/n7qyvnTuD4R9poWX0gsJA2dW5Y5klIQgZRP0hFfTASkpq52pmj1F67dyRxOhBUPQihCKQkESKBnbuKEGBIpJgmEFh9HDbO0ttu3tP/sbZdVZnxru6S/3R76/L73fO+X3O+X1/53eF/8iQZhxJJ79M4dYQvVyUyXVthcOB795/vvnUBZna0XVxLGZ9CCyOsMG+wHevi2DX1OQMkGlO16wWrK+Ai0566s8gRaA8KpLQjnI1MDEgiVTucxW5CQhVeabc0+dxMPv36enEU7mtIrJ2QkDsxTmHsJI9qmTLJXdTo3pOLIjj5QAX6Ala+2ZSyP71b4F8cqLUtynsLvvuLc3U1bwiWSvh2O0h4TwLpp4Zx9rb63furZ0fJVY75RUQbgB2BL678lxAEou62tWy3gKuaeQvwqbeopttCBJ3crsFWRYFxHa8N4DVCl+XfXeBCZpIex2qfMmpKoRAULNh0nyfFcROee8h3BXlJtiO9wWwFGFnUHRXsCQbswfaDgBXntBZH8iaIDFpO5892j8MYjteD5A8K0jcyT8o6OvGMbSY19ft7q9X3uT13qXhEIeAVpCNgZ95IZ7ylopg4EzGq3qLrmmIo0ZkEHtJfgYDethQAwdolRuDQubX2mgXdGxLDMT6dwGLgP4YQ1cc95/4wXZyGRDPVCOYNSfJR3cMnTOIcYyn8w+L6qvVID8JvBgqBVokREmLsgH0kmqveapccp+v6iOryrPA0cB3K+vnBVIJ6nibFZ5udmsUeaXsd64FUWNnO/knQQ3Ub4HvzmgAYp6JNlTXB6V1pmeNjIavb1vau9lSNlePYMTB3BIjtqDoflobKO7k7hRku5mzLJ3/R/e6b2rXE86WhUq4pzKnrAxK7o5IIMNGbUtyF1r9LXOx1BoMrSN/7nn8x3rZTp//UnJwSsvRqr4OxhhabrRjbJPpl+eGOrgTuAo4PqV12uxfCmtGPaJN/0eaHU29tXgq95CIvFZd6xfoVrCANDCpMi96X1Bc9/bp/iMg9qItKaxwBchM0OiAyjG12FUuuoWTWvHMW2W00nraZgOiZHpL7rZ6SVQ2jDv5bYI+MtYKjLaXdwK/816TcjKVu0xF7tFqm1dlXywcfLdn74bvG+0hCSe/StEPqga9wJExAs0Gpp/00Q2hYnpMwzFJwt+HtTNKrCOtGg61tMYW9hQeM2048pjhdNn9Ij4q10Z2gv2Ctbr2BRbbyX0HMheRXFDMrB9DsBHTRNp7TpWNY/TtI5QFwZ7MtxUN245nzm1OvYcoauBE2hvuqsdC1eWN/GItWEOh1S7oVmAyyvtByb17IkAatvdaODvtvYnyAHAo8F3TW8a9IpFAaio4Yj/eR/M/SOXo65W6mdCbHk3UGzLOdmdqZJw3iBruFEg8lb9dCONRPcfTTrHK5VLmYxPzH7R7Aj+Ga+t2AAAAAElFTkSuQmCC";

var __$_require_static_images_icons_books_graph_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAAAAXNSR0IArs4c6QAAAOFQTFRFAAAA3+//3+//3+//4/P/3+//3/L/4vL/3+//3/L/4u//4vL/3+//4e//4fH/4fH/4fH/4fH/4fP/4fH/4vL/4fH/4fL/4vL/4fH/4vH/4vL/4vL/4vL/4fH/4fP/4vL/4fH/4fL/4vH/4vL/4fH/4vH/4vL/AIHODojRHI/UKpbXK5bXOJ3aOZ3aRqTdR6TdVKvgVavgYrLjY7LjcLnmcbnmcbrnfsDpf8Dpf8Dqjcfsjcjsjcjtm87vm8/wnM7vnM/wqdXyqdXzqdbzt931t932xeT5xuT4xuT51Ov84vL/13xWFwAAACd0Uk5TABAgQEBQUFBgYGBgcHBwf4CPj5CfoKCvsLCwv8DPz9Df39/f4O/vJ8fh3wAAAmBJREFUSMedl3t7mjAUxrk5d2kZm+4KdFZbuQjbkM1W1tnRVWfy/T9QkwDqwiEE3r94Aj9ycm5JFAWUOjgfu1NMNLU/WLqqSEt9bWNO9rkmheo1suT13ijVZCBENQFKNRYYf3aNWzR53sS+wRJ6C/vYxVJyAdO1KZbUROvPEprPGRd3kKt291WD117ijjrrt+BC86PT3uHOsit2wL9B+3a6KhPe6LXvBRvJqXVu+M6jQuRpu1hsW6bmKylh8CJOksDzIvHUGgbhm3+PeSSCMc0Ukx98oKxPfbaLvgpcZwFWY3wTeP5WKloq+CKSCBaxWwfH0yj+dtcGP1MsYBTFzGcJEsOm8gkY/e4VSlvaIeAvvPMqiae+UK7qg5sDnAnhmQIMZpIwhuCHA/xftJEUjKOSZWmG1n9YtgXeSgomH1IFt2Gy3/jkgdApGeAzB3IYoUmw/JR8m0c+/U2YxiH5R81hcM/dVdW0LxaQI5ylfL47YP9Cq7hKblQUNzjDx3pFEoVesU6qZXPIrHr3q5Kkys0sChM4zAZUkkWSHAkUNbYSuyFJstPIQSXikE5Sr0lEwxOGq7jMilsgxKwia61kl67DX49Zzlb+lw39hutLq7deklw/2cOWIPelE5Ictppr+vujn38ES1FJGUq96y8PERbrUoH2GyS3TQ6rbdLuvsWOj5v7vCt7eXIiMrvCL04PJaNu7KjX8a/qudzhcdZvwaXTZv1ZQktafgFfOKS8Nmq6rLxqNX1uCq4JLcc5R3zHGQomd4zW+43h9EaZ8WaNd6wulzrD+uywnejqy3tz2EA+AbSuAx/D06z3AAAAAElFTkSuQmCC";

var __$_require_static_images_icons_books_highlight_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAAXNSR0IArs4c6QAABd1JREFUWEfFmFtsXNUVhr+1zzlzBl8zcRJsQ0ABAklapFQQmgSlKqioFZeHCggIFIRUqgIVVUVV5bH0sVXphSBK1UoN5aVJ+lQFFB64qBJ2hKhUIIgQk5jg1g6+xh7f5lz2avYZj2uP7Xgc0rClIx179ln73//619prbaGGoare6cHJdbkwd20KO7H2FmAjxrRhtS4zYWQSa/uALox5R1OO2pzfdXUd/SKSLreMnG+CqsqZ8fE1VoPtVs2DqrpTRJoQ6lBCoPp7RSihTAqMKXQYsX81Eh9tbWgYFBFdar0lgXSphkExuclTfRLkdtA1QLDczqp+j0EGQd9IRV6IG/1/bhQpLWZjUSDdIyOrfK/+PlV+DFwvKwcwby2FGDghyu8SnTi0oVA4Ww1mAZB/j2mL1eRJER5HtX2FDJx/ukivKi/64v++vckx9b8xD4hjwpO6HxqRHymsu6ggZowJ9IPsi+3483OZmQXiNJEvxnvOCfTnglxcJqp2pGjvOeH+bLoxeLmimQyIi47/FJPtqvonYPMi0XCxyXHR85GIPHZFo3/URVMGpK+oaxONf63KA19UmLUidgIW4YAvwdNtjTIgBw+qd+t30jut6h9A22o15Oa5XYiUH9WZZyUG0D4j3g/ePuK9Kv3j2lpK418h7EZrzxOegdRClCiJdYkVQl/wPbAWlsxc84HGAgdyXvBT+Wx4apd4Zj/INbVspsLC6JRysj/l1GDKREnJ+7C+xeeGVsPqOpOZqg2MntLUPio9Z+O9KrpXoLAckAqInuGUw+9FfDKQ0pQ3NF8mTETK8ITS2mS4e2vADZd7iEjmsvMeIzAiIr+QnrH4kKre45hdDoij//Mxy186S4xOWr61JcdX2j1yPpl7ugcsR45FxFZ5ZEeea9Z6tQApichh6RmL3kO5cbGQ9TIKyvDc+1QMh9+P6DwZ88C2kK1XeeS88q7dNKvQ1Z9mQNcXDA9vD2m+zJC4H2Z85V6rSHIH5QfSMxr3g66tZsOqMh2XjbtFfAND45Y/d5S4omB48OaQhrxkTFSGE3CcKkeOxfzj45jHvhFyZcHLRO0WLwsaPPcyfwxKz2hUBBrm/t/NG5tSXvswYmRSMwPuKU4rx8+kfPdrOW7bHBAYyYBWf3u8L+H5N6YzwOuaysJ1YBpC4bZNQaajeZ8pE9JzNhpHqK825qLi1fcjhiZsliecaxyQkwOWe2/K8c1NSwP5+EzCc69Pc3mTYU1DefepQlNeuGNLjrbmxYCMRgOAqzXmDeeaqajsGjdcfhgqWvZ3lLh6tWH3tpD6cKFrEueaD2PeOh7xvV151he8Gfc5ZoV8sJRrahWrIQP2939FvNMd89DXQ2680sN3VM3h2YX0Sx0l2puFPTvy88XqBL0w2amqHnPh+zdVvbvW8D0zanmpY5rxEnz7qwGbWz0CX3BMnB4qh68DvGdnyHXrVhS+8V5U91JLQnPnisKnQ2nGzOnhlEK9YZVLaCUYKNpME/dsDdnUZjBILdl1BJVfymdj8S5R3Q/UnOJdPI9OKic+Tzk5UEnxwlUthi1tHi2ZQGsC4eR3SkUerRx6zyLcv9JDL0mhlGgWmlmOCCDwyiG9XGrPIkCIUQ6FXvCTrAzYfkfpLjHei5e+DJA+lfTxo0fCV2YLo8hGvxFk96UqjBwbVvVgPBU9fV1rY/9sqdhbTHZY1T9eylLRiHy/vdHvnC0Vnbu6uzXvt8R7ziWFZ9D/b/GMaO85gTyTDAUvb9gg02W5zBndI7rKM8lTgj4FLDgIq7PvBf49oMi+1Pr7NhRkttFacAz2jumaRJMnvtQGq7LD4WFtnjDxbpWs5dz4RQU803J2ifLbehscXL1aRqvZPG8TnhtJbjaePoHI7egFNOEuT7gmXPVNm8oLUcF/d0VNeAVt5Voi1mCHqHE9z05FmhStF8gtdi2hEAkygdoiIm+r2AOBhJ2tDVzYtcRc6qouam4FtoFuBJl/UYP2gXQB7yJ0psY/UetFzX8BFwjPnZn+MiMAAAAASUVORK5CYII=";

var __$_require_static_images_icons_books_bookmark_top_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAAAXNSR0IArs4c6QAABhlJREFUWEe1mGtsHFcVx3/nzsyusb1OncbGcZSGtHFTNxQ1TYA0bXkEKhAFKgENSKhShYpoiopQEcpHykcQTwU15SVVCh9IUgmQClRIOFC1jQVpEyjIIZYabAe7OH6v196dxz3kTrLuxt5dr0M70mhGuzP3/ubc/3ldoYFDVb2hiYXOTDZzUwJ7sfY9QA/GbMRqczqEkQWsHQMGMeYvmtBvM/7glmbGRSRZbRqp94Cqyuvz8xusBnusms+p6l4RaUNoRskCy99XhBLKgsCcwktG7C+NRP1dra0TIqK15qsJMqiaDfLxLk/1UZB9oBuAYLUvW/Z/BDIB2peIPBnl/Jd7RErVxqgKcn56+jrfa/mMKl8Fbpa1A1w1l0IEnBPlh7EWjm9tb59ZDrMC5MKcXm81flSER1DtXqMF6j8uMqrKU4uFxcPbu9smKh++CsRZwpPmLxuRryh0vqkQVwYTGLfoocQu/KjSMksgThNN+ejBSwL9piBvriWWfZGio5eE+41iLjhS1kwK4rzjP/l4j6r+DOit4g01jSMCnoC76hWfcBd3n57V33Q/D4jIw5tyfr/zphRkLK8dsUbfU+WzaxGmmzyxysyCEiXgG/DSU9L7bODCS3XHdAIW4agvweMbc3JRjh1T766PJh+zqj8G3dioLoxAlCinhxP+8M+QUqy0NQmtTUJLxqTXGzsMt3Z7BJ4sWevq8XXMiPelF5/zfifj89pVSqLvIOxHG4sTZYhTQzEnBiLetdnjli6fUgJzC5b5IlyYsYxMJRz4YBNvzxliW/UTI4GjGS/4ugxPLd4jnnka5MZGrFEJ0TcQsWuLz/u3B+lSFCPI+G6JhKHJhJ+/UOThu5u4qdOrBeLU9Jom9iEZmYkOquhBgfbVQKpBfGB7QBjDC4MR0wvKjm6PnVt8JueVnzxf5L7bMuzY5KW5oJpwFaZF5FsyMhcdV9VPCGnuqHlUhbglwBOh72zIwFhCR87w74mEL9zdxNsC4Rf9xdRiu9/h49fQiUJJRJ6Vkbnwbyi31XPZahDvuzlIxTm7qPz+1ZB8SdnW4dH3r4jPvzdL1zrDM6dK6dUtnQOz1X3ZJcpXZWQ2GgftqJcVY6u8PBTzxyuacBAtGcHpz6oy+HrCb86EFELo6fT49K5M6s7H/1qic53hw70Bze75mrmXCRmZDfNAa62M6CBeGY7pOxuxc7NPGSKpGNTFkqmCshAqnTmDs+CfzkW8MhTzydsz7Oj2a2oknVcpyMhMOI/QUg3EecJ43nL4RJFtnR7378zQmpUVHuCE6AKZMVAoKSfORqkFP9QbcMcN/uU4UrfwcSCz4UXA1RorDje4i5pHXioRWeWB3VluWG9I7EoPcGHeWeTP5y5D7OsN2L3lMkSdJSnPObGqWF2EHp1O+NXpMB3wU3dk2Lzew1bAOIhCqDx/bRCqqv9w7vuMqn68mvs6cxp3GhieTPj16RARSWE2tZsUxunh/4BwS1Z23+ggqgepE9CcBpZgzoQERrj/dmcZQ754zctRXpZpVL4tw3PRPaL6NFA3xC+HyXjCvbcGDP43weWcNWqiUo+vqchD5aT3XYQHVkt6SzBTCc+eCZksaKqbj7zzDe9oQJhvQAgRyvGsF3wtLQP23Fu6T4z3VCNlgINJBTyT8PcLlo3rDL3dBmehNUGkODKmkjzS/1z2t0uFUWjD7wuyv9HCyMGEsaY5xAm6bpyoHi0jq3osWgwf39aVG18qFUfz8Z1W9adrKRWdx9QpB+uHMBgwIl/szvknl0pF98b589rkXx89eOnbnkDf2uIZ0dFLTeIT8WRwZOtWKaaLVIl9flqv80z8mKCPATUT4Wp1yyr/X1TkUGL9Q1vbZanRWlHZjs7phljjA29lg+WLf7i7zbWilQ5UBX9qStcVTLRfJW05exoVcC1LXGk5B0X5QYsNjq1fL7PLn63bhGem493G0wOI7EOvoQl3ccI14aonbCJPhu3+qTU14WXa8rZEpMGdosb1PHsVaVO0RSBTbVtCIRSkgNo8Ii+q2KOBZE92tXJt2xKVplu2UXMX8G7QHpCrN2rQMZBB4BTCycT45xrdqPkf0cQOrNcuZKsAAAAASUVORK5CYII=";

var __$_require_static_images_icons_books_bookmark_top_active_svg__ = "data:image/svg+xml,%3Csvg%20width%3D%2234%22%20height%3D%2234%22%20viewBox%3D%220%200%2034%2034%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%2217%22%20cy%3D%2217%22%20r%3D%2217%22%20fill%3D%22%23E3F1FA%22%2F%3E%3Cg%20clip-path%3D%22url%28%23clip0_213_1676%29%22%3E%3Cpath%20d%3D%22M22.3333%209H11.6667C11.4309%209%2011.2048%209.09365%2011.0381%209.26035C10.8714%209.42705%2010.7778%209.65314%2010.7778%209.88889V24.1111C10.7782%2024.2626%2010.8174%2024.4115%2010.8916%2024.5436C10.9658%2024.6758%2011.0725%2024.7867%2011.2017%2024.866C11.3308%2024.9452%2011.4781%2024.9902%2011.6295%2024.9965C11.7808%2025.0029%2011.9313%2024.9704%2012.0667%2024.9022L17%2022.44L21.9333%2024.9022C22.0572%2024.9657%2022.1942%2024.9992%2022.3333%2025C22.4997%2025.0005%2022.663%2024.9543%2022.8044%2024.8667C22.9325%2024.7866%2023.0381%2024.6752%2023.1112%2024.543C23.1843%2024.4108%2023.2225%2024.2622%2023.2222%2024.1111V9.88889C23.2222%209.65314%2023.1286%209.42705%2022.9619%209.26035C22.7952%209.09365%2022.5691%209%2022.3333%209ZM20.2978%2014.9644L16.7422%2018.52C16.6596%2018.6033%2016.5613%2018.6694%2016.4529%2018.7146C16.3446%2018.7597%2016.2284%2018.7829%2016.1111%2018.7829C15.9938%2018.7829%2015.8776%2018.7597%2015.7693%2018.7146C15.6609%2018.6694%2015.5626%2018.6033%2015.48%2018.52L13.7022%2016.7422C13.5348%2016.5748%2013.4408%2016.3478%2013.4408%2016.1111C13.4408%2015.8744%2013.5348%2015.6474%2013.7022%2015.48C13.8696%2015.3126%2014.0966%2015.2186%2014.3333%2015.2186C14.57%2015.2186%2014.7971%2015.3126%2014.9644%2015.48L16.1111%2016.6356L19.0355%2013.7022C19.2029%2013.5348%2019.4299%2013.4408%2019.6667%2013.4408C19.9034%2013.4408%2020.1304%2013.5348%2020.2978%2013.7022C20.4651%2013.8696%2020.5592%2014.0966%2020.5592%2014.3333C20.5592%2014.57%2020.4651%2014.7971%2020.2978%2014.9644Z%22%20fill%3D%22%231681E5%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip0_213_1676%22%3E%3Crect%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22white%22%20transform%3D%22translate%289%209%29%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E";

var __$_require_static_images_icons_books_set_up_png__ = "data:image/png;base64,[encoded data, 6560 characters]";

/* script */
const __vue_script__$2M = script$2M;
var __vue_render__$2M = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-digital-teaching-preview",
      class: _vm.env.className,
      style: {
        "--preview-theme-color": _vm.themeColor,
        "--xml-reader-nav-bar-height": _vm.navBarHeight + "px",
        "--xml-reader-width": _vm.xmlReaderWidth + "px",
      },
      attrs: { id: "xmlDigitalTeachingPreview" },
    },
    [
      _vm.pageType == "pc" &&
      _vm.readerType !== "loose-leaf" &&
      _vm.env.theFirstLayout
        ? [
            _c(
              "div",
              {
                staticClass: "xml-digital-teaching-pc",
                class:
                  _vm.persistentReaderSetting.readingMode == "page"
                    ? "xml-reader-page-mode"
                    : "",
              },
              [
                _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: !_vm.immersiveReader,
                        expression: "!immersiveReader",
                      },
                    ],
                    staticClass: "preview-container-pc-left",
                  },
                  [
                    _vm.businessType === "textBook" && !_vm.env.isNoteHighlight
                      ? _c("xml-preview-catalog", {
                          ref: "xmlPreviewCatalog",
                          staticClass: "pc-catalog pc-catalog--render",
                          attrs: {
                            "page-type": _vm.pageType,
                            "style-type": _vm.styleType,
                            "text-book-id": _vm.textBookId,
                            "catalog-list": _vm.textCatalog,
                            userType: _vm.userType,
                            componentList: _vm.componentList,
                            notesList: _vm.notesList,
                            checkedId: _vm.selectId,
                            PreviewCatalog: _vm.PreviewCatalog,
                            textBookName: _vm.textBookData.textBooksName,
                            sysEnv: _vm.env,
                            isTrial: _vm.isTrial,
                            readableChapters: _vm.readableChapters,
                          },
                          on: {
                            onNodeClick: _vm.catalogClick,
                            deleteNotoPC: _vm.deleteNotoPC,
                          },
                        })
                      : _c("preview-left-student", {
                          ref: "xmlPreviewCatalog",
                          attrs: {
                            location: _vm.location,
                            userType: _vm.userType,
                            "page-type": _vm.pageType,
                            "style-type": _vm.styleType,
                            "text-book-id": _vm.textBookId,
                            "catalog-list": _vm.textCatalog,
                            bookmarkList: _vm.bookmarkData,
                            notesList: _vm.notesListData,
                            highlightList: _vm.highlightData,
                            linkList: _vm.linkData,
                            checkedId: _vm.selectId,
                            PreviewCatalog: _vm.PreviewCatalog,
                            looseLeaf: _vm.looseLeafData,
                            resourcesList: _vm.teacherResourcesList,
                            textBookName: _vm.textBookData.textBooksName,
                            textBookResource: _vm.textBookResource,
                            sysEnv: _vm.env,
                            isTrial: _vm.isTrial,
                            componentList: _vm.componentList,
                            readableChapters: _vm.readableChapters,
                          },
                          on: {
                            onNodeClick: _vm.catalogClick,
                            deleteNotoPC: _vm.deleteNotoPC,
                            addBookmark: _vm.addBookmark,
                            deleteNote: _vm.deleteNote,
                            deleteBookmark: _vm.deleteBookmark,
                            deleteHighlight: _vm.deleteHighlight,
                            resourceDetails: _vm.JumpPosition,
                          },
                        }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    ref: "rightContent",
                    staticClass: "preview-counter-main-pc",
                  },
                  [
                    _vm.env.isHuaTeng
                      ? _c("div", { staticClass: "preview-counter-header" }, [
                          _c("div", { staticClass: "text-book-title" }, [
                            _c(
                              "div",
                              { staticClass: "xml-progress" },
                              [
                                _c("el-progress", {
                                  attrs: {
                                    percentage: Number(_vm.schedule) || 0,
                                    "stroke-width": 20,
                                    color: "#4d90f9",
                                    "define-back-color": "#ffffff",
                                    "text-color": "#4d90f9",
                                  },
                                }),
                              ],
                              1
                            ),
                            _vm._v(" "),
                            _c("div", { staticClass: "title" }, [
                              _vm._v(
                                "\n              " +
                                  _vm._s(_vm.currentGroupInfo.locationLabel) +
                                  "\n            "
                              ),
                            ]),
                          ]),
                          _vm._v(" "),
                          _c("div", { staticClass: "header-right" }, [
                            _vm.isAddMark
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up",
                                    on: {
                                      click: function ($event) {
                                        _vm.$refs.visiblea.visiblea = true;
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_highlight_ht_png__,
                                        alt: "",
                                      },
                                    }),
                                    _vm._v(" "),
                                    _c("span", [_vm._v("图例")]),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.isAddMark
                              ? _c("div", { staticClass: "set-up bookmark" }, [
                                  JSON.stringify(_vm.bookmarkList).indexOf(
                                    _vm.currentGroupInfo.location
                                  ) == -1
                                    ? _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_books_bookmark_ht_top_png__,
                                          alt: "",
                                        },
                                        on: {
                                          click: function ($event) {
                                            return _vm.addBookmark(
                                              _vm.currentGroupInfo.location
                                            )
                                          },
                                        },
                                      })
                                    : _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_books_bookmark_ht_top_active_png__,
                                          alt: "",
                                        },
                                        on: {
                                          click: function ($event) {
                                            return _vm.deleteBookmark(
                                              _vm.currentGroupInfo.location
                                            )
                                          },
                                        },
                                      }),
                                  _vm._v(" "),
                                  _c("span", [_vm._v("书签")]),
                                ])
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.isAddMark && _vm.isOpenStudy
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up",
                                    on: {
                                      click: function ($event) {
                                        return _vm.openStatistical()
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_statistical_ht_png__,
                                        alt: "",
                                      },
                                    }),
                                    _vm._v(" "),
                                    _c("span", [_vm._v("学习情况")]),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.isAddMark && _vm.isOpenStudy
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up",
                                    attrs: {
                                      title: _vm.gradesName
                                        ? _vm.gradesName
                                        : "请点击加入班级",
                                    },
                                    on: {
                                      click: function ($event) {
                                        return _vm.joinClass()
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_grades_ht_02_png__,
                                        alt: "",
                                      },
                                    }),
                                    _vm._v(" "),
                                    _c("span", [_vm._v("班级")]),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "set-up",
                                on: {
                                  click: function ($event) {
                                    return _vm.openPcSet()
                                  },
                                },
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_books_set_ht_up_png__,
                                    alt: "",
                                  },
                                }),
                                _vm._v(" "),
                                _c("span", [_vm._v("设置")]),
                              ]
                            ),
                          ]),
                        ])
                      : _c("div", { staticClass: "preview-counter-header" }, [
                          _c("div", { staticClass: "text-book-title" }, [
                            _vm._v(_vm._s(_vm.currentGroupInfo.locationLabel)),
                          ]),
                          _vm._v(" "),
                          _c("div", { staticClass: "header-right" }, [
                            _c(
                              "div",
                              {
                                staticClass: "set-up",
                                staticStyle: { color: "#70acff" },
                              },
                              [_vm._v(_vm._s(_vm.schedule) + "%")]
                            ),
                            _vm._v(" "),
                            _vm.gradesName
                              ? _c("div", { staticClass: "grades" }, [
                                  _c("img", {
                                    attrs: {
                                      src: __$_require_static_images_icons_books_grades_png__,
                                      alt: "",
                                    },
                                  }),
                                  _vm._v(" "),
                                  _c(
                                    "span",
                                    { attrs: { title: _vm.gradesName } },
                                    [_vm._v(_vm._s(_vm.gradesName))]
                                  ),
                                ])
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.bookGraphData &&
                            _vm.bookGraphData.relationships &&
                            _vm.bookGraphData.relationships.length
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up graph",
                                    attrs: { title: "知识图谱" },
                                    on: { click: _vm.openGrapgViewer },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_graph_png__,
                                        alt: "图谱",
                                      },
                                    }),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.userType === "student"
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up highlight",
                                    attrs: { title: "图例" },
                                    on: {
                                      click: function ($event) {
                                        _vm.$refs.visiblea.visiblea = true;
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_highlight_png__,
                                        alt: "",
                                      },
                                    }),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.userType === "student" && _vm.isAddMark
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up bookmark",
                                    attrs: { title: "书签" },
                                  },
                                  [
                                    JSON.stringify(_vm.bookmarkList).indexOf(
                                      _vm.currentGroupInfo.location
                                    ) == -1
                                      ? _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_books_bookmark_top_png__,
                                            alt: "",
                                          },
                                          on: {
                                            click: function ($event) {
                                              return _vm.addBookmark(
                                                _vm.currentGroupInfo.location
                                              )
                                            },
                                          },
                                        })
                                      : _c("img", {
                                          attrs: {
                                            src: __$_require_static_images_icons_books_bookmark_top_active_svg__,
                                            alt: "",
                                          },
                                          on: {
                                            click: function ($event) {
                                              return _vm.deleteBookmark(
                                                _vm.currentGroupInfo.location
                                              )
                                            },
                                          },
                                        }),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "set-up",
                                attrs: { title: "设置" },
                                on: {
                                  click: function ($event) {
                                    return _vm.openPcSet()
                                  },
                                },
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_books_set_up_png__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                          ]),
                        ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        ref: "xmlPreviewDom",
                        staticClass: "preview-counter-main preview-list-pc",
                        attrs: { id: "xmlPreviewDom" },
                      },
                      [
                        _c("xml-preview-loose-leaf", {
                          ref: "xmlPreviewLooseLeaf",
                          class: "preview-screen-" + _vm.pageType,
                          attrs: {
                            "business-type": _vm.businessType,
                            looseLeaf: _vm.looseLeafData,
                            CompList: _vm.componentList,
                            "page-type": _vm.pageType,
                            resourceBasisPath: _vm.basisPath,
                            officePreviewPath: _vm.officePreviewPath,
                            endIndex: _vm.endIndex,
                            isTrial: _vm.isTrial,
                            trialText: _vm.trialText,
                            isShowAi: _vm.isShowAi,
                            resourcesList: _vm.teacherResourcesList,
                            highlightList: _vm.highlightList,
                            studentNoteList: _vm.notesList,
                            teacherNoteList: _vm.teacherNoteList,
                            userType: _vm.userType,
                            readerType: _vm.readerType,
                            loadingMode:
                              _vm.persistentReaderSetting.readingMode,
                            isShowTeacherResource: _vm.isShowTeacherResource,
                            navBarHeight: _vm.navBarHeight,
                            graphStoreKeyPrefix: _vm.graphStoreKeyPrefix,
                            isAddMark: _vm.isAddMark,
                          },
                          on: {
                            jumpToGraphIndex: _vm.JumpPosition,
                            downloadFile: _vm.downloadFile,
                            showFileReader: _vm.showFileReader,
                            openTestPaper: _vm.openTestPaper,
                            setanalysis: _vm.setanalysis,
                            clickComp: _vm.clickComp,
                            openTeacherResoucesList:
                              _vm.openTeacherResoucesList,
                            initObserver: _vm.initObserver,
                            openHtml: _vm.openHtml,
                            submitAnswer: _vm.submitAnswer,
                          },
                        }),
                        _vm._v(" "),
                        _vm.persistentReaderSetting.readingMode == "page"
                          ? _c(
                              "div",
                              { staticClass: "preview-counter-footer" },
                              [
                                _c(
                                  "div",
                                  { staticClass: "xml-progress" },
                                  [
                                    _c("el-slider", {
                                      attrs: { disabled: true },
                                      model: {
                                        value: _vm.currentProgress,
                                        callback: function ($$v) {
                                          _vm.currentProgress = $$v;
                                        },
                                        expression: "currentProgress",
                                      },
                                    }),
                                  ],
                                  1
                                ),
                                _vm._v(" "),
                                _c("div", { staticClass: "btn-list" }, [
                                  _c(
                                    "div",
                                    {
                                      staticClass: "btn-item",
                                      on: { click: _vm.prevPage },
                                    },
                                    [
                                      _c("i", {
                                        staticClass: "el-icon-arrow-left",
                                      }),
                                    ]
                                  ),
                                  _vm._v(" "),
                                  _c(
                                    "div",
                                    {
                                      staticClass: "btn-item",
                                      on: { click: _vm.nextPage },
                                    },
                                    [
                                      _c("i", {
                                        staticClass: "el-icon-arrow-right",
                                      }),
                                    ]
                                  ),
                                ]),
                              ]
                            )
                          : _vm._e(),
                      ],
                      1
                    ),
                  ]
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: !_vm.immersiveReader,
                        expression: "!immersiveReader",
                      },
                    ],
                    staticClass: "preview-container-pc-right",
                  },
                  [
                    _c(
                      "div",
                      { staticClass: "preview-toolbar-content" },
                      [
                        _c("xml-resource-list-pc", {
                          ref: "xmlResourceListPc",
                          attrs: {
                            textBookResource: _vm.textBookResource,
                            resourceType: _vm.resourceType,
                            resourceIcon: _vm.resourceIcon,
                            resourcesList: _vm.teacherResourcesList,
                            resourceBasisPath: _vm.basisPath,
                            isShowTeacherResource: _vm.isShowTeacherResource,
                            graphStoreKeyPrefix: _vm.graphStoreKeyPrefix,
                            componentList: _vm.componentList,
                            userType: _vm.userType,
                            sysEnv: _vm.env,
                          },
                          on: {
                            deleteTeachingResource: _vm.deleteTeachingResource,
                            deleteTeacherNotes: _vm.deleteTeacherNotes,
                            editTeachingResource: _vm.editTeachingResource,
                            resourceDetails: _vm.resourceDetails,
                            updateTeacherNotes: _vm.handleUpdateTeacherNotes,
                            PrewiewOff: _vm.resourceReader,
                          },
                        }),
                      ],
                      1
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticClass: "xml-toolbar-pc-content" },
                      [
                        _c("xml-toolbar-pc", {
                          ref: "xmlToolBarPc",
                          attrs: {
                            textBookResource: _vm.textBookResource,
                            isShowTeacherResource: _vm.isShowTeacherResource,
                            sysEnv: _vm.env,
                            showoQuestionBank: _vm.showoQuestionBank,
                          },
                          on: {
                            clickToolbar: _vm.clickToolbar,
                            openQuestionBank: function ($event) {
                              return _vm.$emit("openQuestionBank")
                            },
                            openStudyPlan: function ($event) {
                              return _vm.$emit("openStudyPlan")
                            },
                          },
                        }),
                      ],
                      1
                    ),
                  ]
                ),
                _vm._v(" "),
                _vm.isShowAi == 0 && _vm.env.isShowAi && _vm.env.isHuaTeng
                  ? _c("xml-robot-pc", {
                      ref: "xmlRobotRef",
                      attrs: {
                        robotData: _vm.robotData,
                        name: _vm.robotName,
                        sysEnv: _vm.env,
                      },
                    })
                  : _vm.isShowAi == 0 && _vm.env.isShowAi
                  ? _c("xml-general-robot-pc", {
                      ref: "xmlRobotRef",
                      attrs: {
                        robotData: _vm.robotData,
                        textBookId: _vm.textBookId,
                        name: _vm.robotName,
                        sysEnv: _vm.env,
                      },
                    })
                  : _vm._e(),
              ],
              1
            ),
          ]
        : _vm._e(),
      _vm._v(" "),
      _vm.pageType == "pc" &&
      _vm.readerType !== "loose-leaf" &&
      _vm.env.theSecondLayout
        ? [
            _c(
              "div",
              { staticClass: "xml-digital-teaching-pc" },
              [
                _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: !_vm.immersiveReader,
                        expression: "!immersiveReader",
                      },
                    ],
                    staticClass: "preview-container-pc-right",
                  },
                  [
                    _c(
                      "div",
                      { staticClass: "preview-toolbar-content" },
                      [
                        _c(
                          "div",
                          { staticClass: "xml-toolbar-pc-content" },
                          [
                            _c("xml-toolbar-pc", {
                              ref: "xmlToolBarPc",
                              attrs: {
                                textBookResource: _vm.textBookResource,
                                isShowTeacherResource:
                                  _vm.isShowTeacherResource,
                                sysEnv: _vm.env,
                                showoQuestionBank: _vm.showoQuestionBank,
                              },
                              on: {
                                clickToolbar: _vm.clickToolbar,
                                openQuestionBank: function ($event) {
                                  return _vm.$emit("openQuestionBank")
                                },
                                openStudyPlan: function ($event) {
                                  return _vm.$emit("openStudyPlan")
                                },
                              },
                            }),
                          ],
                          1
                        ),
                        _vm._v(" "),
                        _c("xml-resource-list-pc", {
                          ref: "xmlResourceListPc",
                          attrs: {
                            textBookResource: _vm.textBookResource,
                            resourceType: _vm.resourceType,
                            resourceIcon: _vm.resourceIcon,
                            resourcesList: _vm.teacherResourcesList,
                            resourceBasisPath: _vm.basisPath,
                            isShowTeacherResource: _vm.isShowTeacherResource,
                            graphStoreKeyPrefix: _vm.graphStoreKeyPrefix,
                            componentList: _vm.componentList,
                            userType: _vm.userType,
                            sysEnv: _vm.env,
                          },
                          on: {
                            deleteTeachingResource: _vm.deleteTeachingResource,
                            deleteTeacherNotes: _vm.deleteTeacherNotes,
                            editTeachingResource: _vm.editTeachingResource,
                            resourceDetails: _vm.resourceDetails,
                            updateTeacherNotes: _vm.handleUpdateTeacherNotes,
                            PrewiewOff: _vm.resourceReader,
                          },
                        }),
                      ],
                      1
                    ),
                  ]
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    ref: "rightContent",
                    staticClass: "preview-counter-main-pc",
                  },
                  [
                    _vm.env.isHuaTeng
                      ? _c("div", { staticClass: "preview-counter-header" }, [
                          _c("div", { staticClass: "text-book-title" }, [
                            _c(
                              "div",
                              { staticClass: "xml-progress" },
                              [
                                _c("el-progress", {
                                  attrs: {
                                    percentage: Number(_vm.schedule) || 0,
                                    "stroke-width": 20,
                                    color: "#4d90f9",
                                    "define-back-color": "#ffffff",
                                    "text-color": "#4d90f9",
                                  },
                                }),
                              ],
                              1
                            ),
                            _vm._v(" "),
                            _c("div", { staticClass: "title" }, [
                              _vm._v(
                                "\n              " +
                                  _vm._s(_vm.currentGroupInfo.locationLabel) +
                                  "\n            "
                              ),
                            ]),
                          ]),
                          _vm._v(" "),
                          _c("div", { staticClass: "header-right" }, [
                            _vm.userType === "student" && _vm.isAddMark
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up",
                                    on: {
                                      click: function ($event) {
                                        _vm.$refs.visiblea.visiblea = true;
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_highlight_ht_png__,
                                        alt: "",
                                      },
                                    }),
                                    _vm._v(" "),
                                    _c("span", [_vm._v("图例")]),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.userType === "student" && _vm.isAddMark
                              ? _c("div", { staticClass: "set-up bookmark" }, [
                                  JSON.stringify(_vm.bookmarkList).indexOf(
                                    _vm.currentGroupInfo.location
                                  ) == -1
                                    ? _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_books_bookmark_ht_top_png__,
                                          alt: "",
                                        },
                                        on: {
                                          click: function ($event) {
                                            return _vm.addBookmark(
                                              _vm.currentGroupInfo.location
                                            )
                                          },
                                        },
                                      })
                                    : _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_books_bookmark_ht_top_active_png__,
                                          alt: "",
                                        },
                                        on: {
                                          click: function ($event) {
                                            return _vm.deleteBookmark(
                                              _vm.currentGroupInfo.location
                                            )
                                          },
                                        },
                                      }),
                                  _vm._v(" "),
                                  _c("span", [_vm._v("书签")]),
                                ])
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.isAddMark && _vm.isOpenStudy
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up",
                                    on: {
                                      click: function ($event) {
                                        return _vm.openStatistical()
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_statistical_ht_png__,
                                        alt: "",
                                      },
                                    }),
                                    _vm._v(" "),
                                    _c("span", [_vm._v("学习情况")]),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.isAddMark && _vm.isOpenStudy
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up",
                                    attrs: {
                                      title: _vm.gradesName
                                        ? _vm.gradesName
                                        : "请点击加入班级",
                                    },
                                    on: {
                                      click: function ($event) {
                                        return _vm.joinClass()
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_grades_ht_02_png__,
                                        alt: "",
                                      },
                                    }),
                                    _vm._v(" "),
                                    _c("span", [_vm._v("班级")]),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "set-up",
                                on: {
                                  click: function ($event) {
                                    return _vm.openPcSet()
                                  },
                                },
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_books_set_ht_up_png__,
                                    alt: "",
                                  },
                                }),
                                _vm._v(" "),
                                _c("span", [_vm._v("设置")]),
                              ]
                            ),
                          ]),
                        ])
                      : _c("div", { staticClass: "preview-counter-header" }, [
                          _c("div", { staticClass: "text-book-title" }, [
                            _vm._v(_vm._s(_vm.currentGroupInfo.locationLabel)),
                          ]),
                          _vm._v(" "),
                          _c("div", { staticClass: "header-right" }, [
                            _c(
                              "div",
                              {
                                staticClass: "set-up",
                                staticStyle: { color: "#70acff" },
                              },
                              [_vm._v(_vm._s(_vm.schedule) + "%")]
                            ),
                            _vm._v(" "),
                            _vm.gradesName
                              ? _c("div", { staticClass: "grades" }, [
                                  _c("img", {
                                    attrs: {
                                      src: __$_require_static_images_icons_books_grades_png__,
                                      alt: "",
                                    },
                                  }),
                                  _vm._v(" "),
                                  _c(
                                    "span",
                                    { attrs: { title: _vm.gradesName } },
                                    [_vm._v(_vm._s(_vm.gradesName))]
                                  ),
                                ])
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.bookGraphData &&
                            _vm.bookGraphData.relationships &&
                            _vm.bookGraphData.relationships.length
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up graph",
                                    attrs: { title: "知识图谱" },
                                    on: { click: _vm.openGrapgViewer },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_graph_png__,
                                        alt: "图谱",
                                      },
                                    }),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.userType === "student"
                              ? _c(
                                  "div",
                                  {
                                    staticClass: "set-up highlight",
                                    on: {
                                      click: function ($event) {
                                        _vm.$refs.visiblea.visiblea = true;
                                      },
                                    },
                                  },
                                  [
                                    _c("img", {
                                      attrs: {
                                        src: __$_require_static_images_icons_books_highlight_png__,
                                        alt: "",
                                      },
                                    }),
                                  ]
                                )
                              : _vm._e(),
                            _vm._v(" "),
                            _vm.userType === "student"
                              ? _c("div", { staticClass: "set-up bookmark" }, [
                                  JSON.stringify(_vm.bookmarkList).indexOf(
                                    _vm.currentGroupInfo.location
                                  ) == -1
                                    ? _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_books_bookmark_top_png__,
                                          alt: "",
                                        },
                                        on: {
                                          click: function ($event) {
                                            return _vm.addBookmark(
                                              _vm.currentGroupInfo.location
                                            )
                                          },
                                        },
                                      })
                                    : _c("img", {
                                        attrs: {
                                          src: __$_require_static_images_icons_books_bookmark_top_active_svg__,
                                          alt: "",
                                        },
                                        on: {
                                          click: function ($event) {
                                            return _vm.deleteBookmark(
                                              _vm.currentGroupInfo.location
                                            )
                                          },
                                        },
                                      }),
                                ])
                              : _vm._e(),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "set-up",
                                on: {
                                  click: function ($event) {
                                    return _vm.openPcSet()
                                  },
                                },
                              },
                              [
                                _c("img", {
                                  attrs: {
                                    src: __$_require_static_images_icons_books_set_up_png__,
                                    alt: "",
                                  },
                                }),
                              ]
                            ),
                          ]),
                        ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        ref: "xmlPreviewDom",
                        staticClass: "preview-counter-main preview-list-pc",
                        attrs: { id: "xmlPreviewDom" },
                      },
                      [
                        _c("xml-preview-loose-leaf", {
                          ref: "xmlPreviewLooseLeaf",
                          class: "preview-screen-" + _vm.pageType,
                          attrs: {
                            "business-type": _vm.businessType,
                            looseLeaf: _vm.looseLeafData,
                            CompList: _vm.componentList,
                            "page-type": _vm.pageType,
                            resourceBasisPath: _vm.basisPath,
                            officePreviewPath: _vm.officePreviewPath,
                            endIndex: _vm.endIndex,
                            isTrial: _vm.isTrial,
                            trialText: _vm.trialText,
                            isShowAi: _vm.isShowAi,
                            resourcesList: _vm.teacherResourcesList,
                            highlightList: _vm.highlightList,
                            studentNoteList: _vm.notesList,
                            teacherNoteList: _vm.teacherNoteList,
                            userType: _vm.userType,
                            readerType: _vm.readerType,
                            loadingMode:
                              _vm.persistentReaderSetting.readingMode,
                            isShowTeacherResource: _vm.isShowTeacherResource,
                            navBarHeight: _vm.navBarHeight,
                            graphStoreKeyPrefix: _vm.graphStoreKeyPrefix,
                            isAddMark: _vm.isAddMark,
                          },
                          on: {
                            jumpToGraphIndex: _vm.JumpPosition,
                            downloadFile: _vm.downloadFile,
                            showFileReader: _vm.showFileReader,
                            openTestPaper: _vm.openTestPaper,
                            setanalysis: _vm.setanalysis,
                            clickComp: _vm.clickComp,
                            openTeacherResoucesList:
                              _vm.openTeacherResoucesList,
                            initObserver: _vm.initObserver,
                            openHtml: _vm.openHtml,
                            submitAnswer: _vm.submitAnswer,
                          },
                        }),
                      ],
                      1
                    ),
                  ]
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: !_vm.immersiveReader,
                        expression: "!immersiveReader",
                      },
                    ],
                    staticClass: "preview-container-pc-left",
                  },
                  [
                    _vm.businessType === "textBook" &&
                    _vm.userType === "teacher"
                      ? _c("xml-preview-catalog", {
                          ref: "xmlPreviewCatalog",
                          staticClass: "pc-catalog pc-catalog--render",
                          attrs: {
                            "page-type": _vm.pageType,
                            "style-type": _vm.styleType,
                            "text-book-id": _vm.textBookId,
                            "catalog-list": _vm.textCatalog,
                            userType: _vm.userType,
                            notesList: _vm.notesList,
                            checkedId: _vm.selectId,
                            PreviewCatalog: _vm.PreviewCatalog,
                            textBookName: _vm.textBookData.textBooksName,
                            sysEnv: _vm.env,
                            isTrial: _vm.isTrial,
                            readableChapters: _vm.readableChapters,
                          },
                          on: {
                            onNodeClick: _vm.catalogClick,
                            deleteNotoPC: _vm.deleteNotoPC,
                          },
                        })
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.userType === "student"
                      ? _c("preview-left-student", {
                          ref: "xmlPreviewCatalog",
                          attrs: {
                            location: _vm.location,
                            userType: _vm.userType,
                            "page-type": _vm.pageType,
                            "style-type": _vm.styleType,
                            "text-book-id": _vm.textBookId,
                            "catalog-list": _vm.textCatalog,
                            bookmarkList: _vm.bookmarkData,
                            notesList: _vm.notesListData,
                            highlightList: _vm.highlightData,
                            linkList: _vm.linkData,
                            checkedId: _vm.selectId,
                            PreviewCatalog: _vm.PreviewCatalog,
                            looseLeaf: _vm.looseLeafData,
                            resourcesList: _vm.teacherResourcesList,
                            textBookName: _vm.textBookData.textBooksName,
                            textBookResource: _vm.textBookResource,
                            readableChapters: _vm.readableChapters,
                            sysEnv: _vm.env,
                            isTrial: _vm.isTrial,
                          },
                          on: {
                            onNodeClick: _vm.catalogClick,
                            deleteNotoPC: _vm.deleteNotoPC,
                            addBookmark: _vm.addBookmark,
                            deleteNote: _vm.deleteNote,
                            deleteBookmark: _vm.deleteBookmark,
                            deleteHighlight: _vm.deleteHighlight,
                            resourceDetails: _vm.JumpPosition,
                          },
                        })
                      : _vm._e(),
                  ],
                  1
                ),
                _vm._v(" "),
                _vm.isShowAi == 0 && _vm.env.isShowAi && _vm.env.isHuaTeng
                  ? _c("xml-robot-pc", {
                      ref: "xmlRobotRef",
                      attrs: {
                        robotData: _vm.robotData,
                        name: _vm.robotName,
                        sysEnv: _vm.env,
                      },
                    })
                  : _vm.isShowAi == 0 && _vm.env.isShowAi
                  ? _c("xml-general-robot-pc", {
                      ref: "xmlRobotRef",
                      attrs: {
                        robotData: _vm.robotData,
                        textBookId: _vm.textBookId,
                        name: _vm.robotName,
                        sysEnv: _vm.env,
                      },
                    })
                  : _vm._e(),
              ],
              1
            ),
          ]
        : (_vm.pageType == "h5" || _vm.pageType == "pad") &&
          _vm.readerType !== "loose-leaf"
        ? [
            _c(
              "div",
              { staticClass: "xml-digital-teaching-phone" },
              [
                _c(
                  "div",
                  {
                    ref: "xmlPreviewDom",
                    staticClass: "preview-counter-main preview-list",
                    attrs: { id: "xmlPreviewDom" },
                    on: {
                      click: function ($event) {
                        $event.stopPropagation();
                        return _vm.clickdigital($event)
                      },
                    },
                  },
                  [
                    _c("xml-preview-loose-leaf", {
                      ref: "xmlPreviewLooseLeaf",
                      class: "preview-screen-" + _vm.pageType,
                      attrs: {
                        "business-type": _vm.businessType,
                        looseLeaf: _vm.looseLeafData,
                        CompList: _vm.componentList,
                        "page-type": _vm.pageType,
                        resourceBasisPath: _vm.basisPath,
                        officePreviewPath: _vm.officePreviewPath,
                        endIndex: _vm.endIndex,
                        isTrial: _vm.isTrial,
                        trialText: _vm.trialText,
                        isShowAi: _vm.isShowAi,
                        resourcesList: _vm.teacherResourcesList,
                        highlightList: _vm.highlightList,
                        studentNoteList: _vm.notesList,
                        teacherNoteList: _vm.teacherNoteList,
                        userType: _vm.userType,
                        readerType: _vm.readerType,
                        loadingMode: _vm.persistentReaderSetting.readingMode,
                        groupHeight: 1000,
                        isShowTeacherResource: _vm.isShowTeacherResource,
                        isCopyUrl:
                          !_vm.isOpenHyperlink && _vm.pageType !== "pc",
                        navBarHeight: _vm.navBarHeight,
                        isAddMark: _vm.isAddMark,
                      },
                      on: {
                        downloadFile: _vm.downloadFile,
                        showFileReader: _vm.showFileReader,
                        openTestPaper: _vm.openTestPaper,
                        setanalysis: _vm.setanalysis,
                        clickComp: _vm.clickComp,
                        openTeacherResoucesList: _vm.openTeacherResoucesList,
                        openHtml: _vm.openHtml,
                        copyHtmlUrl: _vm.copyHtmlUrl,
                        initObserver: _vm.initObserver,
                        submitAnswer: _vm.submitAnswer,
                      },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "toolbar-pop" },
                  [
                    _c("xml-toolbar-phone", {
                      ref: "xmlToolbarPhone",
                      attrs: {
                        textBookResource: _vm.textBookResource,
                        resourcesList: _vm.teacherResourcesList,
                        catalogList: _vm.textCatalog,
                        resourceBasisPath: _vm.basisPath,
                        componentList: _vm.componentList,
                        schedule: _vm.schedule,
                        showToast: _vm.showToast,
                        bookmarkList: _vm.bookmarkData,
                        notesList: _vm.notesListData,
                        highlightList: _vm.highlightData,
                        linkList: _vm.linkData,
                        location: _vm.currentGroupInfo.location,
                        title: _vm.currentGroupInfo.locationLabel,
                        checkedId: _vm.selectId,
                        isShowTeacherResource: _vm.isShowTeacherResource,
                        settingData: _vm.useReaderSetting,
                        sysEnv: _vm.env,
                        loadingMode: _vm.persistentReaderSetting.readingMode,
                        showoQuestionBank: _vm.showoQuestionBank,
                        userType: _vm.userType,
                        textBookName: _vm.textBookData.textBooksName,
                        showToolbar: _vm.env.isShowToolbar,
                        isAddMark: _vm.isAddMark,
                        readableChapters: _vm.readableChapters,
                      },
                      on: {
                        resourceDetails: _vm.resourceDetails,
                        resourceReader: _vm.resourceReader,
                        onNodeClick: _vm.catalogClick,
                        addBookmark: _vm.addBookmark,
                        deleteBookmark: _vm.deleteBookmark,
                        settingChange: _vm.settingChange,
                        clickToolbarPhone: _vm.clickToolbarPhone,
                        prevPage: _vm.prevPage,
                        nextPage: _vm.nextPage,
                        openQuestionBank: function ($event) {
                          return _vm.$emit("openQuestionBank")
                        },
                        openStudyPlan: function ($event) {
                          return _vm.$emit("openStudyPlan")
                        },
                      },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: _vm.isShowToolbarTip && _vm.env.fixedTippy,
                        expression: "isShowToolbarTip && env.fixedTippy",
                      },
                    ],
                    staticClass: "xml-mobile-toolbar-tip",
                  },
                  [
                    _vm.env.tippy.copy
                      ? _c(
                          "div",
                          {
                            staticClass: "tipbar-action",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.$EventBus.$emit(
                                  "clickToolbarTip-" + _vm.tippyTplBarId,
                                  {
                                    type: "copy",
                                    tippyTplBarId: _vm.tippyTplBarId,
                                  }
                                )
                              },
                            },
                          },
                          [
                            _c("i", { staticClass: "tipbar-icon copy" }),
                            _vm._v(" "),
                            _c("span", [_vm._v("复制")]),
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.env.tippy.link
                      ? _c(
                          "div",
                          {
                            staticClass: "tipbar-action",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.$EventBus.$emit(
                                  "clickToolbarTip-" + _vm.tippyTplBarId,
                                  {
                                    type: "link",
                                    tippyTplBarId: _vm.tippyTplBarId,
                                  }
                                )
                              },
                            },
                          },
                          [
                            _c("i", { staticClass: "tipbar-icon link" }),
                            _vm._v(" "),
                            _c("span", [_vm._v("划线")]),
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.env.tippy.note
                      ? _c(
                          "div",
                          {
                            staticClass: "tipbar-action",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.$EventBus.$emit(
                                  "clickToolbarTip-" + _vm.tippyTplBarId,
                                  {
                                    type: "note",
                                    tippyTplBarId: _vm.tippyTplBarId,
                                  }
                                )
                              },
                            },
                          },
                          [
                            _c("i", { staticClass: "tipbar-icon note" }),
                            _vm._v(" "),
                            _c("span", [_vm._v("笔记")]),
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.env.tippy.highlight
                      ? _c(
                          "div",
                          {
                            staticClass: "tipbar-action",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.$EventBus.$emit(
                                  "clickToolbarTip-" + _vm.tippyTplBarId,
                                  {
                                    type: "highlight",
                                    tippyTplBarId: _vm.tippyTplBarId,
                                  }
                                )
                              },
                            },
                          },
                          [
                            _c("i", { staticClass: "tipbar-icon highlight" }),
                            _vm._v(" "),
                            _c("span", [_vm._v("高亮")]),
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.env.tippy.Ai && _vm.isShowAi == "0"
                      ? _c(
                          "div",
                          {
                            staticClass: "tipbar-action",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.$EventBus.$emit(
                                  "clickToolbarTip-" + _vm.tippyTplBarId,
                                  {
                                    type: "Ai",
                                    tippyTplBarId: _vm.tippyTplBarId,
                                  }
                                )
                              },
                            },
                          },
                          [
                            _c("i", { staticClass: "tipbar-icon ai" }),
                            _vm._v(" "),
                            _c("span", [_vm._v(_vm._s(_vm.env.tippy.AiName))]),
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.env.tippy.dictionary
                      ? _c(
                          "div",
                          {
                            staticClass: "tipbar-action",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.$EventBus.$emit(
                                  "clickToolbarTip-" + _vm.tippyTplBarId,
                                  {
                                    type: "dictionary",
                                    tippyTplBarId: _vm.tippyTplBarId,
                                  }
                                )
                              },
                            },
                          },
                          [
                            _c("i", { staticClass: "tipbar-icon dictionary" }),
                            _vm._v(" "),
                            _c("span", [_vm._v("词典")]),
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.env.tippy.encyclopedias
                      ? _c(
                          "div",
                          {
                            staticClass: "tipbar-action",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.$EventBus.$emit(
                                  "clickToolbarTip-" + _vm.tippyTplBarId,
                                  {
                                    type: "encyclopedias",
                                    tippyTplBarId: _vm.tippyTplBarId,
                                  }
                                )
                              },
                            },
                          },
                          [
                            _c("i", {
                              staticClass: "tipbar-icon encyclopedias",
                            }),
                            _vm._v(" "),
                            _c("span", [_vm._v("百科")]),
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.env.tippy.maxWordCount && !_vm.env.isHuaTeng
                      ? _c("span", { staticClass: "tipbar-remark" }, [
                          _vm._v("均<=200字 "),
                        ])
                      : _vm._e(),
                  ]
                ),
                _vm._v(" "),
                _vm._m(0),
                _vm._v(" "),
                _vm.isShowAi == 0 && _vm.env.isShowAi && _vm.env.isHuaTeng
                  ? _c("xml-robot-phone", {
                      ref: "xmlRobotRef",
                      attrs: { robotData: _vm.robotData, name: _vm.robotName },
                    })
                  : _vm.isShowAi == 0 && _vm.env.isShowAi
                  ? _c("xml-general-robot-phone", {
                      ref: "xmlRobotRef",
                      attrs: {
                        robotData: _vm.robotData,
                        textBookId: _vm.textBookId,
                        name: _vm.robotName,
                        sysEnv: _vm.env,
                      },
                    })
                  : _vm._e(),
              ],
              1
            ),
          ]
        : _vm.readerType === "loose-leaf"
        ? [
            _c(
              "div",
              {
                ref: "xmlPreviewDom",
                staticClass: "preview-counter-main preview-list-pc",
                attrs: { id: "xmlPreviewDom" },
              },
              [
                _c("xml-preview-loose-leaf", {
                  ref: "xmlPreviewLooseLeaf",
                  class: "preview-screen-" + _vm.pageType,
                  attrs: {
                    "business-type": _vm.businessType,
                    looseLeaf: _vm.looseLeafData,
                    CompList: _vm.componentList,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.basisPath,
                    officePreviewPath: _vm.officePreviewPath,
                    endIndex: _vm.endIndex,
                    isTrial: _vm.isTrial,
                    trialText: _vm.trialText,
                    isShowAi: _vm.isShowAi,
                    resourcesList: _vm.teacherResourcesList,
                    highlightList: _vm.highlightList,
                    studentNoteList: _vm.notesList,
                    teacherNoteList: _vm.teacherNoteList,
                    userType: _vm.userType,
                    readerType: _vm.readerType,
                    loadingMode: _vm.persistentReaderSetting.readingMode,
                    isShowTeacherResource: _vm.isShowTeacherResource,
                    navBarHeight: _vm.navBarHeight,
                    isAddMark: _vm.isAddMark,
                  },
                  on: {
                    downloadFile: _vm.downloadFile,
                    showFileReader: _vm.showFileReader,
                    openTestPaper: _vm.openTestPaper,
                    setanalysis: _vm.setanalysis,
                    clickComp: _vm.clickComp,
                    openTeacherResoucesList: _vm.openTeacherResoucesList,
                    initObserver: _vm.initObserver,
                    openHtml: _vm.openHtml,
                    submitAnswer: _vm.submitAnswer,
                  },
                }),
              ],
              1
            ),
          ]
        : _vm._e(),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: _vm.continueRead,
              expression: "continueRead",
            },
          ],
          staticClass: "continue-read-box",
          class: _vm.pageType != "pc" ? "continue-read-h5" : "",
        },
        [
          _c("div", { staticClass: "notes-text-box" }, [
            _c("div", { staticClass: "title-box" }, [_vm._v("提示")]),
            _vm._v(" "),
            _c("div", { staticClass: "text" }, [
              _vm._v("检测到上次阅读位置,是否继续阅读."),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "add-notes-btn" }, [
              _c(
                "div",
                {
                  on: {
                    click: function ($event) {
                      _vm.continueRead = false;
                    },
                  },
                },
                [_vm._v("取消")]
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "confirm",
                  on: {
                    click: function ($event) {
                      _vm.JumpPosition({
                        location: _vm.location,
                        maxTop: -30,
                        type: "initial",
                        selectorType: "id",
                        selectorId: _vm.scrollId,
                        markTarget: "",
                        classIndex: 0,
                      }),
                        (_vm.continueRead = false);
                    },
                  },
                },
                [_vm._v("\n          确认\n        ")]
              ),
            ]),
          ]),
        ]
      ),
      _vm._v(" "),
      _c("down-file-uppop", {
        ref: "downFileUppop",
        attrs: {
          downloadFileLink: _vm.downloadFileLink,
          showToast: _vm.showToast,
        },
      }),
      _vm._v(" "),
      _c("XmlHotTargetModalViewer", {
        attrs: { visible: _vm.hotTargetViewerVisible, data: _vm.hotzoneTarget },
        on: {
          "update:visible": function ($event) {
            _vm.hotTargetViewerVisible = $event;
          },
        },
      }),
      _vm._v(" "),
      _c("add-file", {
        ref: "addTeacherResources",
        attrs: {
          actionUrl: _vm.action,
          headers: _vm.headers,
          fileSize: _vm.fileSize,
          data: _vm.data,
        },
        on: {
          addResources: _vm.addResources,
          editResources: _vm.editResources,
          addTeacherNote: _vm.addTeacherNote,
        },
      }),
      _vm._v(" "),
      _c("set-pop", {
        ref: "visible",
        attrs: { settingData: _vm.useReaderSetting, sysEnv: _vm.env },
        on: { settingChange: _vm.settingChange },
      }),
      _vm._v(" "),
      _c("XmlGraphViewer", {
        ref: "graphViewer",
        attrs: { model: _vm.bookGraphModel, mode: "book", withLevel: "" },
        on: { levelChange: _vm.reGenBookGraph },
      }),
      _vm._v(" "),
      _c("highlight", { ref: "visiblea", attrs: { sysEnv: _vm.env } }),
      _vm._v(" "),
      _c("bookmark", { ref: "visibleb" }),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: _vm.showPrompt,
              expression: "showPrompt",
            },
          ],
          staticClass: "xml-toast-prompt-box",
        },
        [
          _c("div", {
            staticClass: "prompt-text",
            class: _vm.toastType,
            domProps: { innerHTML: _vm._s(_vm.promptText) },
          }),
        ]
      ),
      _vm._v(" "),
      _c("modify-notes", {
        ref: "modifyNotes",
        on: { saveNote: _vm.saveNote },
      }),
      _vm._v(" "),
      _c("xml-dialog", {
        attrs: {
          dialogData: _vm.dialogData,
          pageType: _vm.pageType,
          show: _vm.showPdf,
          baseUrl: _vm.fileBaseUrl,
          textInfo: _vm.fileBaseTitle,
        },
        on: {
          handleClose: function ($event) {
            _vm.showPdf = false;
          },
        },
      }),
      _vm._v(" "),
      _c("xml-statistical-chart", {
        ref: "xmlStatisticalChart",
        attrs: {
          userType: _vm.userType,
          pageType: _vm.pageType,
          teacherDateclass: _vm.teacherDateclass,
          studentDate: _vm.getStudentData,
          teacherDate: _vm.teacherData,
          userInfoparms: _vm.userInfoparms,
          textBookResource: _vm.textBookResource,
          isShowTeacherResource: _vm.isShowTeacherResource,
          sysEnv: _vm.env,
          learnTime: _vm.thisLearnTime,
        },
        on: {
          changeClass: function ($event) {
            return _vm.$emit("changeClass", $event)
          },
        },
      }),
      _vm._v(" "),
      _c("classGrade", {
        ref: "classGrade",
        attrs: {
          userType: _vm.userType,
          pageType: _vm.pageType,
          teacherDateclass: _vm.teacherDateclass,
          userInfoparms: _vm.userInfoparms,
        },
      }),
      _vm._v(" "),
      _c("learningProgress", {
        ref: "learningProgress",
        attrs: { progressData: _vm.progressData },
        on: {
          confirmContinueReading: function ($event) {
            return _vm.JumpPosition({
              location: _vm.location,
              maxTop: -30,
              type: "initial",
              selectorType: "id",
              selectorId: _vm.scrollId,
              markTarget: "",
              classIndex: 0,
            })
          },
        },
      }),
    ],
    2
  )
};
var __vue_staticRenderFns__$2M = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "font-pre-loader" }, [
      _c("div", { attrs: { id: "sim-sun" } }, [_vm._v("宋体")]),
      _vm._v(" "),
      _c("div", { attrs: { id: "sim-hei" } }, [_vm._v("黑体")]),
      _vm._v(" "),
      _c("div", { attrs: { id: "sim-kai" } }, [_vm._v("楷体")]),
    ])
  },
];
__vue_render__$2M._withStripped = true;

  /* style */
  const __vue_inject_styles__$2M = undefined;
  /* scoped */
  const __vue_scope_id__$2M = undefined;
  /* module identifier */
  const __vue_module_identifier__$2M = undefined;
  /* functional template */
  const __vue_is_functional_template__$2M = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2M = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2M, staticRenderFns: __vue_staticRenderFns__$2M },
    __vue_inject_styles__$2M,
    __vue_script__$2M,
    __vue_scope_id__$2M,
    __vue_is_functional_template__$2M,
    __vue_module_identifier__$2M,
    false,
    undefined,
    undefined,
    undefined
  );

var hammer = createCommonjsModule(function (module) {
/*! Hammer.JS - v2.0.7 - 2016-04-22
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2016 Jorik Tangelder;
 * Licensed under the MIT license */
(function (window, document, exportName, undefined$1) {

  var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
  var TEST_ELEMENT = document.createElement('div');
  var TYPE_FUNCTION = 'function';
  var round = Math.round;
  var abs = Math.abs;
  var now = Date.now;

  /**
   * set a timeout with a given scope
   * @param {Function} fn
   * @param {Number} timeout
   * @param {Object} context
   * @returns {number}
   */
  function setTimeoutContext(fn, timeout, context) {
    return setTimeout(bindFn(fn, context), timeout);
  }

  /**
   * if the argument is an array, we want to execute the fn on each entry
   * if it aint an array we don't want to do a thing.
   * this is used by all the methods that accept a single and array argument.
   * @param {*|Array} arg
   * @param {String} fn
   * @param {Object} [context]
   * @returns {Boolean}
   */
  function invokeArrayArg(arg, fn, context) {
    if (Array.isArray(arg)) {
      each(arg, context[fn], context);
      return true;
    }
    return false;
  }

  /**
   * walk objects and arrays
   * @param {Object} obj
   * @param {Function} iterator
   * @param {Object} context
   */
  function each(obj, iterator, context) {
    var i;
    if (!obj) {
      return;
    }
    if (obj.forEach) {
      obj.forEach(iterator, context);
    } else if (obj.length !== undefined$1) {
      i = 0;
      while (i < obj.length) {
        iterator.call(context, obj[i], i, obj);
        i++;
      }
    } else {
      for (i in obj) {
        obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
      }
    }
  }

  /**
   * wrap a method with a deprecation warning and stack trace
   * @param {Function} method
   * @param {String} name
   * @param {String} message
   * @returns {Function} A new function wrapping the supplied method.
   */
  function deprecate(method, name, message) {
    var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
    return function () {
      var e = new Error('get-stack-trace');
      var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
      var log = window.console && (window.console.warn || window.console.log);
      if (log) {
        log.call(window.console, deprecationMessage, stack);
      }
      return method.apply(this, arguments);
    };
  }

  /**
   * extend object.
   * means that properties in dest will be overwritten by the ones in src.
   * @param {Object} target
   * @param {...Object} objects_to_assign
   * @returns {Object} target
   */
  var assign;
  if (typeof Object.assign !== 'function') {
    assign = function assign(target) {
      if (target === undefined$1 || target === null) {
        throw new TypeError('Cannot convert undefined or null to object');
      }
      var output = Object(target);
      for (var index = 1; index < arguments.length; index++) {
        var source = arguments[index];
        if (source !== undefined$1 && source !== null) {
          for (var nextKey in source) {
            if (source.hasOwnProperty(nextKey)) {
              output[nextKey] = source[nextKey];
            }
          }
        }
      }
      return output;
    };
  } else {
    assign = Object.assign;
  }

  /**
   * extend object.
   * means that properties in dest will be overwritten by the ones in src.
   * @param {Object} dest
   * @param {Object} src
   * @param {Boolean} [merge=false]
   * @returns {Object} dest
   */
  var extend = deprecate(function extend(dest, src, merge) {
    var keys = Object.keys(src);
    var i = 0;
    while (i < keys.length) {
      if (!merge || merge && dest[keys[i]] === undefined$1) {
        dest[keys[i]] = src[keys[i]];
      }
      i++;
    }
    return dest;
  }, 'extend', 'Use `assign`.');

  /**
   * merge the values from src in the dest.
   * means that properties that exist in dest will not be overwritten by src
   * @param {Object} dest
   * @param {Object} src
   * @returns {Object} dest
   */
  var merge = deprecate(function merge(dest, src) {
    return extend(dest, src, true);
  }, 'merge', 'Use `assign`.');

  /**
   * simple class inheritance
   * @param {Function} child
   * @param {Function} base
   * @param {Object} [properties]
   */
  function inherit(child, base, properties) {
    var baseP = base.prototype,
      childP;
    childP = child.prototype = Object.create(baseP);
    childP.constructor = child;
    childP._super = baseP;
    if (properties) {
      assign(childP, properties);
    }
  }

  /**
   * simple function bind
   * @param {Function} fn
   * @param {Object} context
   * @returns {Function}
   */
  function bindFn(fn, context) {
    return function boundFn() {
      return fn.apply(context, arguments);
    };
  }

  /**
   * let a boolean value also be a function that must return a boolean
   * this first item in args will be used as the context
   * @param {Boolean|Function} val
   * @param {Array} [args]
   * @returns {Boolean}
   */
  function boolOrFn(val, args) {
    if (typeof val == TYPE_FUNCTION) {
      return val.apply(args ? args[0] || undefined$1 : undefined$1, args);
    }
    return val;
  }

  /**
   * use the val2 when val1 is undefined
   * @param {*} val1
   * @param {*} val2
   * @returns {*}
   */
  function ifUndefined(val1, val2) {
    return val1 === undefined$1 ? val2 : val1;
  }

  /**
   * addEventListener with multiple events at once
   * @param {EventTarget} target
   * @param {String} types
   * @param {Function} handler
   */
  function addEventListeners(target, types, handler) {
    each(splitStr(types), function (type) {
      target.addEventListener(type, handler, false);
    });
  }

  /**
   * removeEventListener with multiple events at once
   * @param {EventTarget} target
   * @param {String} types
   * @param {Function} handler
   */
  function removeEventListeners(target, types, handler) {
    each(splitStr(types), function (type) {
      target.removeEventListener(type, handler, false);
    });
  }

  /**
   * find if a node is in the given parent
   * @method hasParent
   * @param {HTMLElement} node
   * @param {HTMLElement} parent
   * @return {Boolean} found
   */
  function hasParent(node, parent) {
    while (node) {
      if (node == parent) {
        return true;
      }
      node = node.parentNode;
    }
    return false;
  }

  /**
   * small indexOf wrapper
   * @param {String} str
   * @param {String} find
   * @returns {Boolean} found
   */
  function inStr(str, find) {
    return str.indexOf(find) > -1;
  }

  /**
   * split string on whitespace
   * @param {String} str
   * @returns {Array} words
   */
  function splitStr(str) {
    return str.trim().split(/\s+/g);
  }

  /**
   * find if a array contains the object using indexOf or a simple polyFill
   * @param {Array} src
   * @param {String} find
   * @param {String} [findByKey]
   * @return {Boolean|Number} false when not found, or the index
   */
  function inArray(src, find, findByKey) {
    if (src.indexOf && !findByKey) {
      return src.indexOf(find);
    } else {
      var i = 0;
      while (i < src.length) {
        if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {
          return i;
        }
        i++;
      }
      return -1;
    }
  }

  /**
   * convert array-like objects to real arrays
   * @param {Object} obj
   * @returns {Array}
   */
  function toArray(obj) {
    return Array.prototype.slice.call(obj, 0);
  }

  /**
   * unique array with objects based on a key (like 'id') or just by the array's value
   * @param {Array} src [{id:1},{id:2},{id:1}]
   * @param {String} [key]
   * @param {Boolean} [sort=False]
   * @returns {Array} [{id:1},{id:2}]
   */
  function uniqueArray(src, key, sort) {
    var results = [];
    var values = [];
    var i = 0;
    while (i < src.length) {
      var val = key ? src[i][key] : src[i];
      if (inArray(values, val) < 0) {
        results.push(src[i]);
      }
      values[i] = val;
      i++;
    }
    if (sort) {
      if (!key) {
        results = results.sort();
      } else {
        results = results.sort(function sortUniqueArray(a, b) {
          return a[key] > b[key];
        });
      }
    }
    return results;
  }

  /**
   * get the prefixed property
   * @param {Object} obj
   * @param {String} property
   * @returns {String|Undefined} prefixed
   */
  function prefixed(obj, property) {
    var prefix, prop;
    var camelProp = property[0].toUpperCase() + property.slice(1);
    var i = 0;
    while (i < VENDOR_PREFIXES.length) {
      prefix = VENDOR_PREFIXES[i];
      prop = prefix ? prefix + camelProp : property;
      if (prop in obj) {
        return prop;
      }
      i++;
    }
    return undefined$1;
  }

  /**
   * get a unique id
   * @returns {number} uniqueId
   */
  var _uniqueId = 1;
  function uniqueId() {
    return _uniqueId++;
  }

  /**
   * get the window object of an element
   * @param {HTMLElement} element
   * @returns {DocumentView|Window}
   */
  function getWindowForElement(element) {
    var doc = element.ownerDocument || element;
    return doc.defaultView || doc.parentWindow || window;
  }
  var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
  var SUPPORT_TOUCH = 'ontouchstart' in window;
  var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined$1;
  var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
  var INPUT_TYPE_TOUCH = 'touch';
  var INPUT_TYPE_PEN = 'pen';
  var INPUT_TYPE_MOUSE = 'mouse';
  var INPUT_TYPE_KINECT = 'kinect';
  var COMPUTE_INTERVAL = 25;
  var INPUT_START = 1;
  var INPUT_MOVE = 2;
  var INPUT_END = 4;
  var INPUT_CANCEL = 8;
  var DIRECTION_NONE = 1;
  var DIRECTION_LEFT = 2;
  var DIRECTION_RIGHT = 4;
  var DIRECTION_UP = 8;
  var DIRECTION_DOWN = 16;
  var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
  var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
  var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
  var PROPS_XY = ['x', 'y'];
  var PROPS_CLIENT_XY = ['clientX', 'clientY'];

  /**
   * create new input type manager
   * @param {Manager} manager
   * @param {Function} callback
   * @returns {Input}
   * @constructor
   */
  function Input(manager, callback) {
    var self = this;
    this.manager = manager;
    this.callback = callback;
    this.element = manager.element;
    this.target = manager.options.inputTarget;

    // smaller wrapper around the handler, for the scope and the enabled state of the manager,
    // so when disabled the input events are completely bypassed.
    this.domHandler = function (ev) {
      if (boolOrFn(manager.options.enable, [manager])) {
        self.handler(ev);
      }
    };
    this.init();
  }
  Input.prototype = {
    /**
     * should handle the inputEvent data and trigger the callback
     * @virtual
     */
    handler: function () {},
    /**
     * bind the events
     */
    init: function () {
      this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
      this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
      this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
    },
    /**
     * unbind the events
     */
    destroy: function () {
      this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
      this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
      this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
    }
  };

  /**
   * create new input type manager
   * called by the Manager constructor
   * @param {Hammer} manager
   * @returns {Input}
   */
  function createInputInstance(manager) {
    var Type;
    var inputClass = manager.options.inputClass;
    if (inputClass) {
      Type = inputClass;
    } else if (SUPPORT_POINTER_EVENTS) {
      Type = PointerEventInput;
    } else if (SUPPORT_ONLY_TOUCH) {
      Type = TouchInput;
    } else if (!SUPPORT_TOUCH) {
      Type = MouseInput;
    } else {
      Type = TouchMouseInput;
    }
    return new Type(manager, inputHandler);
  }

  /**
   * handle input events
   * @param {Manager} manager
   * @param {String} eventType
   * @param {Object} input
   */
  function inputHandler(manager, eventType, input) {
    var pointersLen = input.pointers.length;
    var changedPointersLen = input.changedPointers.length;
    var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
    var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
    input.isFirst = !!isFirst;
    input.isFinal = !!isFinal;
    if (isFirst) {
      manager.session = {};
    }

    // source event is the normalized value of the domEvents
    // like 'touchstart, mouseup, pointerdown'
    input.eventType = eventType;

    // compute scale, rotation etc
    computeInputData(manager, input);

    // emit secret event
    manager.emit('hammer.input', input);
    manager.recognize(input);
    manager.session.prevInput = input;
  }

  /**
   * extend the data with some usable properties like scale, rotate, velocity etc
   * @param {Object} manager
   * @param {Object} input
   */
  function computeInputData(manager, input) {
    var session = manager.session;
    var pointers = input.pointers;
    var pointersLength = pointers.length;

    // store the first input to calculate the distance and direction
    if (!session.firstInput) {
      session.firstInput = simpleCloneInputData(input);
    }

    // to compute scale and rotation we need to store the multiple touches
    if (pointersLength > 1 && !session.firstMultiple) {
      session.firstMultiple = simpleCloneInputData(input);
    } else if (pointersLength === 1) {
      session.firstMultiple = false;
    }
    var firstInput = session.firstInput;
    var firstMultiple = session.firstMultiple;
    var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
    var center = input.center = getCenter(pointers);
    input.timeStamp = now();
    input.deltaTime = input.timeStamp - firstInput.timeStamp;
    input.angle = getAngle(offsetCenter, center);
    input.distance = getDistance(offsetCenter, center);
    computeDeltaXY(session, input);
    input.offsetDirection = getDirection(input.deltaX, input.deltaY);
    var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
    input.overallVelocityX = overallVelocity.x;
    input.overallVelocityY = overallVelocity.y;
    input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;
    input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
    input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
    input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;
    computeIntervalInputData(session, input);

    // find the correct target
    var target = manager.element;
    if (hasParent(input.srcEvent.target, target)) {
      target = input.srcEvent.target;
    }
    input.target = target;
  }
  function computeDeltaXY(session, input) {
    var center = input.center;
    var offset = session.offsetDelta || {};
    var prevDelta = session.prevDelta || {};
    var prevInput = session.prevInput || {};
    if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
      prevDelta = session.prevDelta = {
        x: prevInput.deltaX || 0,
        y: prevInput.deltaY || 0
      };
      offset = session.offsetDelta = {
        x: center.x,
        y: center.y
      };
    }
    input.deltaX = prevDelta.x + (center.x - offset.x);
    input.deltaY = prevDelta.y + (center.y - offset.y);
  }

  /**
   * velocity is calculated every x ms
   * @param {Object} session
   * @param {Object} input
   */
  function computeIntervalInputData(session, input) {
    var last = session.lastInterval || input,
      deltaTime = input.timeStamp - last.timeStamp,
      velocity,
      velocityX,
      velocityY,
      direction;
    if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined$1)) {
      var deltaX = input.deltaX - last.deltaX;
      var deltaY = input.deltaY - last.deltaY;
      var v = getVelocity(deltaTime, deltaX, deltaY);
      velocityX = v.x;
      velocityY = v.y;
      velocity = abs(v.x) > abs(v.y) ? v.x : v.y;
      direction = getDirection(deltaX, deltaY);
      session.lastInterval = input;
    } else {
      // use latest velocity info if it doesn't overtake a minimum period
      velocity = last.velocity;
      velocityX = last.velocityX;
      velocityY = last.velocityY;
      direction = last.direction;
    }
    input.velocity = velocity;
    input.velocityX = velocityX;
    input.velocityY = velocityY;
    input.direction = direction;
  }

  /**
   * create a simple clone from the input used for storage of firstInput and firstMultiple
   * @param {Object} input
   * @returns {Object} clonedInputData
   */
  function simpleCloneInputData(input) {
    // make a simple copy of the pointers because we will get a reference if we don't
    // we only need clientXY for the calculations
    var pointers = [];
    var i = 0;
    while (i < input.pointers.length) {
      pointers[i] = {
        clientX: round(input.pointers[i].clientX),
        clientY: round(input.pointers[i].clientY)
      };
      i++;
    }
    return {
      timeStamp: now(),
      pointers: pointers,
      center: getCenter(pointers),
      deltaX: input.deltaX,
      deltaY: input.deltaY
    };
  }

  /**
   * get the center of all the pointers
   * @param {Array} pointers
   * @return {Object} center contains `x` and `y` properties
   */
  function getCenter(pointers) {
    var pointersLength = pointers.length;

    // no need to loop when only one touch
    if (pointersLength === 1) {
      return {
        x: round(pointers[0].clientX),
        y: round(pointers[0].clientY)
      };
    }
    var x = 0,
      y = 0,
      i = 0;
    while (i < pointersLength) {
      x += pointers[i].clientX;
      y += pointers[i].clientY;
      i++;
    }
    return {
      x: round(x / pointersLength),
      y: round(y / pointersLength)
    };
  }

  /**
   * calculate the velocity between two points. unit is in px per ms.
   * @param {Number} deltaTime
   * @param {Number} x
   * @param {Number} y
   * @return {Object} velocity `x` and `y`
   */
  function getVelocity(deltaTime, x, y) {
    return {
      x: x / deltaTime || 0,
      y: y / deltaTime || 0
    };
  }

  /**
   * get the direction between two points
   * @param {Number} x
   * @param {Number} y
   * @return {Number} direction
   */
  function getDirection(x, y) {
    if (x === y) {
      return DIRECTION_NONE;
    }
    if (abs(x) >= abs(y)) {
      return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
    }
    return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
  }

  /**
   * calculate the absolute distance between two points
   * @param {Object} p1 {x, y}
   * @param {Object} p2 {x, y}
   * @param {Array} [props] containing x and y keys
   * @return {Number} distance
   */
  function getDistance(p1, p2, props) {
    if (!props) {
      props = PROPS_XY;
    }
    var x = p2[props[0]] - p1[props[0]],
      y = p2[props[1]] - p1[props[1]];
    return Math.sqrt(x * x + y * y);
  }

  /**
   * calculate the angle between two coordinates
   * @param {Object} p1
   * @param {Object} p2
   * @param {Array} [props] containing x and y keys
   * @return {Number} angle
   */
  function getAngle(p1, p2, props) {
    if (!props) {
      props = PROPS_XY;
    }
    var x = p2[props[0]] - p1[props[0]],
      y = p2[props[1]] - p1[props[1]];
    return Math.atan2(y, x) * 180 / Math.PI;
  }

  /**
   * calculate the rotation degrees between two pointersets
   * @param {Array} start array of pointers
   * @param {Array} end array of pointers
   * @return {Number} rotation
   */
  function getRotation(start, end) {
    return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
  }

  /**
   * calculate the scale factor between two pointersets
   * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
   * @param {Array} start array of pointers
   * @param {Array} end array of pointers
   * @return {Number} scale
   */
  function getScale(start, end) {
    return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
  }
  var MOUSE_INPUT_MAP = {
    mousedown: INPUT_START,
    mousemove: INPUT_MOVE,
    mouseup: INPUT_END
  };
  var MOUSE_ELEMENT_EVENTS = 'mousedown';
  var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';

  /**
   * Mouse events input
   * @constructor
   * @extends Input
   */
  function MouseInput() {
    this.evEl = MOUSE_ELEMENT_EVENTS;
    this.evWin = MOUSE_WINDOW_EVENTS;
    this.pressed = false; // mousedown state

    Input.apply(this, arguments);
  }
  inherit(MouseInput, Input, {
    /**
     * handle mouse events
     * @param {Object} ev
     */
    handler: function MEhandler(ev) {
      var eventType = MOUSE_INPUT_MAP[ev.type];

      // on start we want to have the left mouse button down
      if (eventType & INPUT_START && ev.button === 0) {
        this.pressed = true;
      }
      if (eventType & INPUT_MOVE && ev.which !== 1) {
        eventType = INPUT_END;
      }

      // mouse must be down
      if (!this.pressed) {
        return;
      }
      if (eventType & INPUT_END) {
        this.pressed = false;
      }
      this.callback(this.manager, eventType, {
        pointers: [ev],
        changedPointers: [ev],
        pointerType: INPUT_TYPE_MOUSE,
        srcEvent: ev
      });
    }
  });
  var POINTER_INPUT_MAP = {
    pointerdown: INPUT_START,
    pointermove: INPUT_MOVE,
    pointerup: INPUT_END,
    pointercancel: INPUT_CANCEL,
    pointerout: INPUT_CANCEL
  };

  // in IE10 the pointer types is defined as an enum
  var IE10_POINTER_TYPE_ENUM = {
    2: INPUT_TYPE_TOUCH,
    3: INPUT_TYPE_PEN,
    4: INPUT_TYPE_MOUSE,
    5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
  };
  var POINTER_ELEMENT_EVENTS = 'pointerdown';
  var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';

  // IE10 has prefixed support, and case-sensitive
  if (window.MSPointerEvent && !window.PointerEvent) {
    POINTER_ELEMENT_EVENTS = 'MSPointerDown';
    POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
  }

  /**
   * Pointer events input
   * @constructor
   * @extends Input
   */
  function PointerEventInput() {
    this.evEl = POINTER_ELEMENT_EVENTS;
    this.evWin = POINTER_WINDOW_EVENTS;
    Input.apply(this, arguments);
    this.store = this.manager.session.pointerEvents = [];
  }
  inherit(PointerEventInput, Input, {
    /**
     * handle mouse events
     * @param {Object} ev
     */
    handler: function PEhandler(ev) {
      var store = this.store;
      var removePointer = false;
      var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
      var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
      var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
      var isTouch = pointerType == INPUT_TYPE_TOUCH;

      // get index of the event in the store
      var storeIndex = inArray(store, ev.pointerId, 'pointerId');

      // start and mouse must be down
      if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
        if (storeIndex < 0) {
          store.push(ev);
          storeIndex = store.length - 1;
        }
      } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
        removePointer = true;
      }

      // it not found, so the pointer hasn't been down (so it's probably a hover)
      if (storeIndex < 0) {
        return;
      }

      // update the event in the store
      store[storeIndex] = ev;
      this.callback(this.manager, eventType, {
        pointers: store,
        changedPointers: [ev],
        pointerType: pointerType,
        srcEvent: ev
      });
      if (removePointer) {
        // remove from the store
        store.splice(storeIndex, 1);
      }
    }
  });
  var SINGLE_TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: INPUT_MOVE,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL
  };
  var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
  var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';

  /**
   * Touch events input
   * @constructor
   * @extends Input
   */
  function SingleTouchInput() {
    this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
    this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
    this.started = false;
    Input.apply(this, arguments);
  }
  inherit(SingleTouchInput, Input, {
    handler: function TEhandler(ev) {
      var type = SINGLE_TOUCH_INPUT_MAP[ev.type];

      // should we handle the touch events?
      if (type === INPUT_START) {
        this.started = true;
      }
      if (!this.started) {
        return;
      }
      var touches = normalizeSingleTouches.call(this, ev, type);

      // when done, reset the started state
      if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
        this.started = false;
      }
      this.callback(this.manager, type, {
        pointers: touches[0],
        changedPointers: touches[1],
        pointerType: INPUT_TYPE_TOUCH,
        srcEvent: ev
      });
    }
  });

  /**
   * @this {TouchInput}
   * @param {Object} ev
   * @param {Number} type flag
   * @returns {undefined|Array} [all, changed]
   */
  function normalizeSingleTouches(ev, type) {
    var all = toArray(ev.touches);
    var changed = toArray(ev.changedTouches);
    if (type & (INPUT_END | INPUT_CANCEL)) {
      all = uniqueArray(all.concat(changed), 'identifier', true);
    }
    return [all, changed];
  }
  var TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: INPUT_MOVE,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL
  };
  var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';

  /**
   * Multi-user touch events input
   * @constructor
   * @extends Input
   */
  function TouchInput() {
    this.evTarget = TOUCH_TARGET_EVENTS;
    this.targetIds = {};
    Input.apply(this, arguments);
  }
  inherit(TouchInput, Input, {
    handler: function MTEhandler(ev) {
      var type = TOUCH_INPUT_MAP[ev.type];
      var touches = getTouches.call(this, ev, type);
      if (!touches) {
        return;
      }
      this.callback(this.manager, type, {
        pointers: touches[0],
        changedPointers: touches[1],
        pointerType: INPUT_TYPE_TOUCH,
        srcEvent: ev
      });
    }
  });

  /**
   * @this {TouchInput}
   * @param {Object} ev
   * @param {Number} type flag
   * @returns {undefined|Array} [all, changed]
   */
  function getTouches(ev, type) {
    var allTouches = toArray(ev.touches);
    var targetIds = this.targetIds;

    // when there is only one touch, the process can be simplified
    if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
      targetIds[allTouches[0].identifier] = true;
      return [allTouches, allTouches];
    }
    var i,
      targetTouches,
      changedTouches = toArray(ev.changedTouches),
      changedTargetTouches = [],
      target = this.target;

    // get target touches from touches
    targetTouches = allTouches.filter(function (touch) {
      return hasParent(touch.target, target);
    });

    // collect touches
    if (type === INPUT_START) {
      i = 0;
      while (i < targetTouches.length) {
        targetIds[targetTouches[i].identifier] = true;
        i++;
      }
    }

    // filter changed touches to only contain touches that exist in the collected target ids
    i = 0;
    while (i < changedTouches.length) {
      if (targetIds[changedTouches[i].identifier]) {
        changedTargetTouches.push(changedTouches[i]);
      }

      // cleanup removed touches
      if (type & (INPUT_END | INPUT_CANCEL)) {
        delete targetIds[changedTouches[i].identifier];
      }
      i++;
    }
    if (!changedTargetTouches.length) {
      return;
    }
    return [
    // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
    uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];
  }

  /**
   * Combined touch and mouse input
   *
   * Touch has a higher priority then mouse, and while touching no mouse events are allowed.
   * This because touch devices also emit mouse events while doing a touch.
   *
   * @constructor
   * @extends Input
   */

  var DEDUP_TIMEOUT = 2500;
  var DEDUP_DISTANCE = 25;
  function TouchMouseInput() {
    Input.apply(this, arguments);
    var handler = bindFn(this.handler, this);
    this.touch = new TouchInput(this.manager, handler);
    this.mouse = new MouseInput(this.manager, handler);
    this.primaryTouch = null;
    this.lastTouches = [];
  }
  inherit(TouchMouseInput, Input, {
    /**
     * handle mouse and touch events
     * @param {Hammer} manager
     * @param {String} inputEvent
     * @param {Object} inputData
     */
    handler: function TMEhandler(manager, inputEvent, inputData) {
      var isTouch = inputData.pointerType == INPUT_TYPE_TOUCH,
        isMouse = inputData.pointerType == INPUT_TYPE_MOUSE;
      if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
        return;
      }

      // when we're in a touch event, record touches to  de-dupe synthetic mouse event
      if (isTouch) {
        recordTouches.call(this, inputEvent, inputData);
      } else if (isMouse && isSyntheticEvent.call(this, inputData)) {
        return;
      }
      this.callback(manager, inputEvent, inputData);
    },
    /**
     * remove the event listeners
     */
    destroy: function destroy() {
      this.touch.destroy();
      this.mouse.destroy();
    }
  });
  function recordTouches(eventType, eventData) {
    if (eventType & INPUT_START) {
      this.primaryTouch = eventData.changedPointers[0].identifier;
      setLastTouch.call(this, eventData);
    } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
      setLastTouch.call(this, eventData);
    }
  }
  function setLastTouch(eventData) {
    var touch = eventData.changedPointers[0];
    if (touch.identifier === this.primaryTouch) {
      var lastTouch = {
        x: touch.clientX,
        y: touch.clientY
      };
      this.lastTouches.push(lastTouch);
      var lts = this.lastTouches;
      var removeLastTouch = function () {
        var i = lts.indexOf(lastTouch);
        if (i > -1) {
          lts.splice(i, 1);
        }
      };
      setTimeout(removeLastTouch, DEDUP_TIMEOUT);
    }
  }
  function isSyntheticEvent(eventData) {
    var x = eventData.srcEvent.clientX,
      y = eventData.srcEvent.clientY;
    for (var i = 0; i < this.lastTouches.length; i++) {
      var t = this.lastTouches[i];
      var dx = Math.abs(x - t.x),
        dy = Math.abs(y - t.y);
      if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
        return true;
      }
    }
    return false;
  }
  var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
  var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined$1;

  // magical touchAction value
  var TOUCH_ACTION_COMPUTE = 'compute';
  var TOUCH_ACTION_AUTO = 'auto';
  var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
  var TOUCH_ACTION_NONE = 'none';
  var TOUCH_ACTION_PAN_X = 'pan-x';
  var TOUCH_ACTION_PAN_Y = 'pan-y';
  var TOUCH_ACTION_MAP = getTouchActionProps();

  /**
   * Touch Action
   * sets the touchAction property or uses the js alternative
   * @param {Manager} manager
   * @param {String} value
   * @constructor
   */
  function TouchAction(manager, value) {
    this.manager = manager;
    this.set(value);
  }
  TouchAction.prototype = {
    /**
     * set the touchAction value on the element or enable the polyfill
     * @param {String} value
     */
    set: function (value) {
      // find out the touch-action by the event handlers
      if (value == TOUCH_ACTION_COMPUTE) {
        value = this.compute();
      }
      if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
        this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
      }
      this.actions = value.toLowerCase().trim();
    },
    /**
     * just re-set the touchAction value
     */
    update: function () {
      this.set(this.manager.options.touchAction);
    },
    /**
     * compute the value for the touchAction property based on the recognizer's settings
     * @returns {String} value
     */
    compute: function () {
      var actions = [];
      each(this.manager.recognizers, function (recognizer) {
        if (boolOrFn(recognizer.options.enable, [recognizer])) {
          actions = actions.concat(recognizer.getTouchAction());
        }
      });
      return cleanTouchActions(actions.join(' '));
    },
    /**
     * this method is called on each input cycle and provides the preventing of the browser behavior
     * @param {Object} input
     */
    preventDefaults: function (input) {
      var srcEvent = input.srcEvent;
      var direction = input.offsetDirection;

      // if the touch action did prevented once this session
      if (this.manager.session.prevented) {
        srcEvent.preventDefault();
        return;
      }
      var actions = this.actions;
      var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
      var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
      var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
      if (hasNone) {
        //do not prevent defaults if this is a tap gesture

        var isTapPointer = input.pointers.length === 1;
        var isTapMovement = input.distance < 2;
        var isTapTouchTime = input.deltaTime < 250;
        if (isTapPointer && isTapMovement && isTapTouchTime) {
          return;
        }
      }
      if (hasPanX && hasPanY) {
        // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
        return;
      }
      if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {
        return this.preventSrc(srcEvent);
      }
    },
    /**
     * call preventDefault to prevent the browser's default behavior (scrolling in most cases)
     * @param {Object} srcEvent
     */
    preventSrc: function (srcEvent) {
      this.manager.session.prevented = true;
      srcEvent.preventDefault();
    }
  };

  /**
   * when the touchActions are collected they are not a valid value, so we need to clean things up. *
   * @param {String} actions
   * @returns {*}
   */
  function cleanTouchActions(actions) {
    // none
    if (inStr(actions, TOUCH_ACTION_NONE)) {
      return TOUCH_ACTION_NONE;
    }
    var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
    var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);

    // if both pan-x and pan-y are set (different recognizers
    // for different directions, e.g. horizontal pan but vertical swipe?)
    // we need none (as otherwise with pan-x pan-y combined none of these
    // recognizers will work, since the browser would handle all panning
    if (hasPanX && hasPanY) {
      return TOUCH_ACTION_NONE;
    }

    // pan-x OR pan-y
    if (hasPanX || hasPanY) {
      return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
    }

    // manipulation
    if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
      return TOUCH_ACTION_MANIPULATION;
    }
    return TOUCH_ACTION_AUTO;
  }
  function getTouchActionProps() {
    if (!NATIVE_TOUCH_ACTION) {
      return false;
    }
    var touchMap = {};
    var cssSupports = window.CSS && window.CSS.supports;
    ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {
      // If css.supports is not supported but there is native touch-action assume it supports
      // all values. This is the case for IE 10 and 11.
      touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
    });
    return touchMap;
  }

  /**
   * Recognizer flow explained; *
   * All recognizers have the initial state of POSSIBLE when a input session starts.
   * The definition of a input session is from the first input until the last input, with all it's movement in it. *
   * Example session for mouse-input: mousedown -> mousemove -> mouseup
   *
   * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
   * which determines with state it should be.
   *
   * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
   * POSSIBLE to give it another change on the next cycle.
   *
   *               Possible
   *                  |
   *            +-----+---------------+
   *            |                     |
   *      +-----+-----+               |
   *      |           |               |
   *   Failed      Cancelled          |
   *                          +-------+------+
   *                          |              |
   *                      Recognized       Began
   *                                         |
   *                                      Changed
   *                                         |
   *                                  Ended/Recognized
   */
  var STATE_POSSIBLE = 1;
  var STATE_BEGAN = 2;
  var STATE_CHANGED = 4;
  var STATE_ENDED = 8;
  var STATE_RECOGNIZED = STATE_ENDED;
  var STATE_CANCELLED = 16;
  var STATE_FAILED = 32;

  /**
   * Recognizer
   * Every recognizer needs to extend from this class.
   * @constructor
   * @param {Object} options
   */
  function Recognizer(options) {
    this.options = assign({}, this.defaults, options || {});
    this.id = uniqueId();
    this.manager = null;

    // default is enable true
    this.options.enable = ifUndefined(this.options.enable, true);
    this.state = STATE_POSSIBLE;
    this.simultaneous = {};
    this.requireFail = [];
  }
  Recognizer.prototype = {
    /**
     * @virtual
     * @type {Object}
     */
    defaults: {},
    /**
     * set options
     * @param {Object} options
     * @return {Recognizer}
     */
    set: function (options) {
      assign(this.options, options);

      // also update the touchAction, in case something changed about the directions/enabled state
      this.manager && this.manager.touchAction.update();
      return this;
    },
    /**
     * recognize simultaneous with an other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    recognizeWith: function (otherRecognizer) {
      if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
        return this;
      }
      var simultaneous = this.simultaneous;
      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
      if (!simultaneous[otherRecognizer.id]) {
        simultaneous[otherRecognizer.id] = otherRecognizer;
        otherRecognizer.recognizeWith(this);
      }
      return this;
    },
    /**
     * drop the simultaneous link. it doesnt remove the link on the other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    dropRecognizeWith: function (otherRecognizer) {
      if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
        return this;
      }
      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
      delete this.simultaneous[otherRecognizer.id];
      return this;
    },
    /**
     * recognizer can only run when an other is failing
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    requireFailure: function (otherRecognizer) {
      if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
        return this;
      }
      var requireFail = this.requireFail;
      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
      if (inArray(requireFail, otherRecognizer) === -1) {
        requireFail.push(otherRecognizer);
        otherRecognizer.requireFailure(this);
      }
      return this;
    },
    /**
     * drop the requireFailure link. it does not remove the link on the other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    dropRequireFailure: function (otherRecognizer) {
      if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
        return this;
      }
      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
      var index = inArray(this.requireFail, otherRecognizer);
      if (index > -1) {
        this.requireFail.splice(index, 1);
      }
      return this;
    },
    /**
     * has require failures boolean
     * @returns {boolean}
     */
    hasRequireFailures: function () {
      return this.requireFail.length > 0;
    },
    /**
     * if the recognizer can recognize simultaneous with an other recognizer
     * @param {Recognizer} otherRecognizer
     * @returns {Boolean}
     */
    canRecognizeWith: function (otherRecognizer) {
      return !!this.simultaneous[otherRecognizer.id];
    },
    /**
     * You should use `tryEmit` instead of `emit` directly to check
     * that all the needed recognizers has failed before emitting.
     * @param {Object} input
     */
    emit: function (input) {
      var self = this;
      var state = this.state;
      function emit(event) {
        self.manager.emit(event, input);
      }

      // 'panstart' and 'panmove'
      if (state < STATE_ENDED) {
        emit(self.options.event + stateStr(state));
      }
      emit(self.options.event); // simple 'eventName' events

      if (input.additionalEvent) {
        // additional event(panleft, panright, pinchin, pinchout...)
        emit(input.additionalEvent);
      }

      // panend and pancancel
      if (state >= STATE_ENDED) {
        emit(self.options.event + stateStr(state));
      }
    },
    /**
     * Check that all the require failure recognizers has failed,
     * if true, it emits a gesture event,
     * otherwise, setup the state to FAILED.
     * @param {Object} input
     */
    tryEmit: function (input) {
      if (this.canEmit()) {
        return this.emit(input);
      }
      // it's failing anyway
      this.state = STATE_FAILED;
    },
    /**
     * can we emit?
     * @returns {boolean}
     */
    canEmit: function () {
      var i = 0;
      while (i < this.requireFail.length) {
        if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
          return false;
        }
        i++;
      }
      return true;
    },
    /**
     * update the recognizer
     * @param {Object} inputData
     */
    recognize: function (inputData) {
      // make a new copy of the inputData
      // so we can change the inputData without messing up the other recognizers
      var inputDataClone = assign({}, inputData);

      // is is enabled and allow recognizing?
      if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
        this.reset();
        this.state = STATE_FAILED;
        return;
      }

      // reset when we've reached the end
      if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
        this.state = STATE_POSSIBLE;
      }
      this.state = this.process(inputDataClone);

      // the recognizer has recognized a gesture
      // so trigger an event
      if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
        this.tryEmit(inputDataClone);
      }
    },
    /**
     * return the state of the recognizer
     * the actual recognizing happens in this method
     * @virtual
     * @param {Object} inputData
     * @returns {Const} STATE
     */
    process: function (inputData) {},
    // jshint ignore:line

    /**
     * return the preferred touch-action
     * @virtual
     * @returns {Array}
     */
    getTouchAction: function () {},
    /**
     * called when the gesture isn't allowed to recognize
     * like when another is being recognized or it is disabled
     * @virtual
     */
    reset: function () {}
  };

  /**
   * get a usable string, used as event postfix
   * @param {Const} state
   * @returns {String} state
   */
  function stateStr(state) {
    if (state & STATE_CANCELLED) {
      return 'cancel';
    } else if (state & STATE_ENDED) {
      return 'end';
    } else if (state & STATE_CHANGED) {
      return 'move';
    } else if (state & STATE_BEGAN) {
      return 'start';
    }
    return '';
  }

  /**
   * direction cons to string
   * @param {Const} direction
   * @returns {String}
   */
  function directionStr(direction) {
    if (direction == DIRECTION_DOWN) {
      return 'down';
    } else if (direction == DIRECTION_UP) {
      return 'up';
    } else if (direction == DIRECTION_LEFT) {
      return 'left';
    } else if (direction == DIRECTION_RIGHT) {
      return 'right';
    }
    return '';
  }

  /**
   * get a recognizer by name if it is bound to a manager
   * @param {Recognizer|String} otherRecognizer
   * @param {Recognizer} recognizer
   * @returns {Recognizer}
   */
  function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
    var manager = recognizer.manager;
    if (manager) {
      return manager.get(otherRecognizer);
    }
    return otherRecognizer;
  }

  /**
   * This recognizer is just used as a base for the simple attribute recognizers.
   * @constructor
   * @extends Recognizer
   */
  function AttrRecognizer() {
    Recognizer.apply(this, arguments);
  }
  inherit(AttrRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof AttrRecognizer
     */
    defaults: {
      /**
       * @type {Number}
       * @default 1
       */
      pointers: 1
    },
    /**
     * Used to check if it the recognizer receives valid input, like input.distance > 10.
     * @memberof AttrRecognizer
     * @param {Object} input
     * @returns {Boolean} recognized
     */
    attrTest: function (input) {
      var optionPointers = this.options.pointers;
      return optionPointers === 0 || input.pointers.length === optionPointers;
    },
    /**
     * Process the input and return the state for the recognizer
     * @memberof AttrRecognizer
     * @param {Object} input
     * @returns {*} State
     */
    process: function (input) {
      var state = this.state;
      var eventType = input.eventType;
      var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
      var isValid = this.attrTest(input);

      // on cancel input and we've recognized before, return STATE_CANCELLED
      if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
        return state | STATE_CANCELLED;
      } else if (isRecognized || isValid) {
        if (eventType & INPUT_END) {
          return state | STATE_ENDED;
        } else if (!(state & STATE_BEGAN)) {
          return STATE_BEGAN;
        }
        return state | STATE_CHANGED;
      }
      return STATE_FAILED;
    }
  });

  /**
   * Pan
   * Recognized when the pointer is down and moved in the allowed direction.
   * @constructor
   * @extends AttrRecognizer
   */
  function PanRecognizer() {
    AttrRecognizer.apply(this, arguments);
    this.pX = null;
    this.pY = null;
  }
  inherit(PanRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof PanRecognizer
     */
    defaults: {
      event: 'pan',
      threshold: 10,
      pointers: 1,
      direction: DIRECTION_ALL
    },
    getTouchAction: function () {
      var direction = this.options.direction;
      var actions = [];
      if (direction & DIRECTION_HORIZONTAL) {
        actions.push(TOUCH_ACTION_PAN_Y);
      }
      if (direction & DIRECTION_VERTICAL) {
        actions.push(TOUCH_ACTION_PAN_X);
      }
      return actions;
    },
    directionTest: function (input) {
      var options = this.options;
      var hasMoved = true;
      var distance = input.distance;
      var direction = input.direction;
      var x = input.deltaX;
      var y = input.deltaY;

      // lock to axis?
      if (!(direction & options.direction)) {
        if (options.direction & DIRECTION_HORIZONTAL) {
          direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
          hasMoved = x != this.pX;
          distance = Math.abs(input.deltaX);
        } else {
          direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
          hasMoved = y != this.pY;
          distance = Math.abs(input.deltaY);
        }
      }
      input.direction = direction;
      return hasMoved && distance > options.threshold && direction & options.direction;
    },
    attrTest: function (input) {
      return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));
    },
    emit: function (input) {
      this.pX = input.deltaX;
      this.pY = input.deltaY;
      var direction = directionStr(input.direction);
      if (direction) {
        input.additionalEvent = this.options.event + direction;
      }
      this._super.emit.call(this, input);
    }
  });

  /**
   * Pinch
   * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
   * @constructor
   * @extends AttrRecognizer
   */
  function PinchRecognizer() {
    AttrRecognizer.apply(this, arguments);
  }
  inherit(PinchRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof PinchRecognizer
     */
    defaults: {
      event: 'pinch',
      threshold: 0,
      pointers: 2
    },
    getTouchAction: function () {
      return [TOUCH_ACTION_NONE];
    },
    attrTest: function (input) {
      return this._super.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
    },
    emit: function (input) {
      if (input.scale !== 1) {
        var inOut = input.scale < 1 ? 'in' : 'out';
        input.additionalEvent = this.options.event + inOut;
      }
      this._super.emit.call(this, input);
    }
  });

  /**
   * Press
   * Recognized when the pointer is down for x ms without any movement.
   * @constructor
   * @extends Recognizer
   */
  function PressRecognizer() {
    Recognizer.apply(this, arguments);
    this._timer = null;
    this._input = null;
  }
  inherit(PressRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof PressRecognizer
     */
    defaults: {
      event: 'press',
      pointers: 1,
      time: 251,
      // minimal time of the pointer to be pressed
      threshold: 9 // a minimal movement is ok, but keep it low
    },
    getTouchAction: function () {
      return [TOUCH_ACTION_AUTO];
    },
    process: function (input) {
      var options = this.options;
      var validPointers = input.pointers.length === options.pointers;
      var validMovement = input.distance < options.threshold;
      var validTime = input.deltaTime > options.time;
      this._input = input;

      // we only allow little movement
      // and we've reached an end event, so a tap is possible
      if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {
        this.reset();
      } else if (input.eventType & INPUT_START) {
        this.reset();
        this._timer = setTimeoutContext(function () {
          this.state = STATE_RECOGNIZED;
          this.tryEmit();
        }, options.time, this);
      } else if (input.eventType & INPUT_END) {
        return STATE_RECOGNIZED;
      }
      return STATE_FAILED;
    },
    reset: function () {
      clearTimeout(this._timer);
    },
    emit: function (input) {
      if (this.state !== STATE_RECOGNIZED) {
        return;
      }
      if (input && input.eventType & INPUT_END) {
        this.manager.emit(this.options.event + 'up', input);
      } else {
        this._input.timeStamp = now();
        this.manager.emit(this.options.event, this._input);
      }
    }
  });

  /**
   * Rotate
   * Recognized when two or more pointer are moving in a circular motion.
   * @constructor
   * @extends AttrRecognizer
   */
  function RotateRecognizer() {
    AttrRecognizer.apply(this, arguments);
  }
  inherit(RotateRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof RotateRecognizer
     */
    defaults: {
      event: 'rotate',
      threshold: 0,
      pointers: 2
    },
    getTouchAction: function () {
      return [TOUCH_ACTION_NONE];
    },
    attrTest: function (input) {
      return this._super.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
    }
  });

  /**
   * Swipe
   * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
   * @constructor
   * @extends AttrRecognizer
   */
  function SwipeRecognizer() {
    AttrRecognizer.apply(this, arguments);
  }
  inherit(SwipeRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof SwipeRecognizer
     */
    defaults: {
      event: 'swipe',
      threshold: 10,
      velocity: 0.3,
      direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
      pointers: 1
    },
    getTouchAction: function () {
      return PanRecognizer.prototype.getTouchAction.call(this);
    },
    attrTest: function (input) {
      var direction = this.options.direction;
      var velocity;
      if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
        velocity = input.overallVelocity;
      } else if (direction & DIRECTION_HORIZONTAL) {
        velocity = input.overallVelocityX;
      } else if (direction & DIRECTION_VERTICAL) {
        velocity = input.overallVelocityY;
      }
      return this._super.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers == this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
    },
    emit: function (input) {
      var direction = directionStr(input.offsetDirection);
      if (direction) {
        this.manager.emit(this.options.event + direction, input);
      }
      this.manager.emit(this.options.event, input);
    }
  });

  /**
   * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
   * between the given interval and position. The delay option can be used to recognize multi-taps without firing
   * a single tap.
   *
   * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
   * multi-taps being recognized.
   * @constructor
   * @extends Recognizer
   */
  function TapRecognizer() {
    Recognizer.apply(this, arguments);

    // previous time and center,
    // used for tap counting
    this.pTime = false;
    this.pCenter = false;
    this._timer = null;
    this._input = null;
    this.count = 0;
  }
  inherit(TapRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof PinchRecognizer
     */
    defaults: {
      event: 'tap',
      pointers: 1,
      taps: 1,
      interval: 300,
      // max time between the multi-tap taps
      time: 250,
      // max time of the pointer to be down (like finger on the screen)
      threshold: 9,
      // a minimal movement is ok, but keep it low
      posThreshold: 10 // a multi-tap can be a bit off the initial position
    },
    getTouchAction: function () {
      return [TOUCH_ACTION_MANIPULATION];
    },
    process: function (input) {
      var options = this.options;
      var validPointers = input.pointers.length === options.pointers;
      var validMovement = input.distance < options.threshold;
      var validTouchTime = input.deltaTime < options.time;
      this.reset();
      if (input.eventType & INPUT_START && this.count === 0) {
        return this.failTimeout();
      }

      // we only allow little movement
      // and we've reached an end event, so a tap is possible
      if (validMovement && validTouchTime && validPointers) {
        if (input.eventType != INPUT_END) {
          return this.failTimeout();
        }
        var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;
        var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
        this.pTime = input.timeStamp;
        this.pCenter = input.center;
        if (!validMultiTap || !validInterval) {
          this.count = 1;
        } else {
          this.count += 1;
        }
        this._input = input;

        // if tap count matches we have recognized it,
        // else it has began recognizing...
        var tapCount = this.count % options.taps;
        if (tapCount === 0) {
          // no failing requirements, immediately trigger the tap event
          // or wait as long as the multitap interval to trigger
          if (!this.hasRequireFailures()) {
            return STATE_RECOGNIZED;
          } else {
            this._timer = setTimeoutContext(function () {
              this.state = STATE_RECOGNIZED;
              this.tryEmit();
            }, options.interval, this);
            return STATE_BEGAN;
          }
        }
      }
      return STATE_FAILED;
    },
    failTimeout: function () {
      this._timer = setTimeoutContext(function () {
        this.state = STATE_FAILED;
      }, this.options.interval, this);
      return STATE_FAILED;
    },
    reset: function () {
      clearTimeout(this._timer);
    },
    emit: function () {
      if (this.state == STATE_RECOGNIZED) {
        this._input.tapCount = this.count;
        this.manager.emit(this.options.event, this._input);
      }
    }
  });

  /**
   * Simple way to create a manager with a default set of recognizers.
   * @param {HTMLElement} element
   * @param {Object} [options]
   * @constructor
   */
  function Hammer(element, options) {
    options = options || {};
    options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
    return new Manager(element, options);
  }

  /**
   * @const {string}
   */
  Hammer.VERSION = '2.0.7';

  /**
   * default settings
   * @namespace
   */
  Hammer.defaults = {
    /**
     * set if DOM events are being triggered.
     * But this is slower and unused by simple implementations, so disabled by default.
     * @type {Boolean}
     * @default false
     */
    domEvents: false,
    /**
     * The value for the touchAction property/fallback.
     * When set to `compute` it will magically set the correct value based on the added recognizers.
     * @type {String}
     * @default compute
     */
    touchAction: TOUCH_ACTION_COMPUTE,
    /**
     * @type {Boolean}
     * @default true
     */
    enable: true,
    /**
     * EXPERIMENTAL FEATURE -- can be removed/changed
     * Change the parent input target element.
     * If Null, then it is being set the to main element.
     * @type {Null|EventTarget}
     * @default null
     */
    inputTarget: null,
    /**
     * force an input class
     * @type {Null|Function}
     * @default null
     */
    inputClass: null,
    /**
     * Default recognizer setup when calling `Hammer()`
     * When creating a new Manager these will be skipped.
     * @type {Array}
     */
    preset: [
    // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
    [RotateRecognizer, {
      enable: false
    }], [PinchRecognizer, {
      enable: false
    }, ['rotate']], [SwipeRecognizer, {
      direction: DIRECTION_HORIZONTAL
    }], [PanRecognizer, {
      direction: DIRECTION_HORIZONTAL
    }, ['swipe']], [TapRecognizer], [TapRecognizer, {
      event: 'doubletap',
      taps: 2
    }, ['tap']], [PressRecognizer]],
    /**
     * Some CSS properties can be used to improve the working of Hammer.
     * Add them to this method and they will be set when creating a new Manager.
     * @namespace
     */
    cssProps: {
      /**
       * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
       * @type {String}
       * @default 'none'
       */
      userSelect: 'none',
      /**
       * Disable the Windows Phone grippers when pressing an element.
       * @type {String}
       * @default 'none'
       */
      touchSelect: 'none',
      /**
       * Disables the default callout shown when you touch and hold a touch target.
       * On iOS, when you touch and hold a touch target such as a link, Safari displays
       * a callout containing information about the link. This property allows you to disable that callout.
       * @type {String}
       * @default 'none'
       */
      touchCallout: 'none',
      /**
       * Specifies whether zooming is enabled. Used by IE10>
       * @type {String}
       * @default 'none'
       */
      contentZooming: 'none',
      /**
       * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
       * @type {String}
       * @default 'none'
       */
      userDrag: 'none',
      /**
       * Overrides the highlight color shown when the user taps a link or a JavaScript
       * clickable element in iOS. This property obeys the alpha value, if specified.
       * @type {String}
       * @default 'rgba(0,0,0,0)'
       */
      tapHighlightColor: 'rgba(0,0,0,0)'
    }
  };
  var STOP = 1;
  var FORCED_STOP = 2;

  /**
   * Manager
   * @param {HTMLElement} element
   * @param {Object} [options]
   * @constructor
   */
  function Manager(element, options) {
    this.options = assign({}, Hammer.defaults, options || {});
    this.options.inputTarget = this.options.inputTarget || element;
    this.handlers = {};
    this.session = {};
    this.recognizers = [];
    this.oldCssProps = {};
    this.element = element;
    this.input = createInputInstance(this);
    this.touchAction = new TouchAction(this, this.options.touchAction);
    toggleCssProps(this, true);
    each(this.options.recognizers, function (item) {
      var recognizer = this.add(new item[0](item[1]));
      item[2] && recognizer.recognizeWith(item[2]);
      item[3] && recognizer.requireFailure(item[3]);
    }, this);
  }
  Manager.prototype = {
    /**
     * set options
     * @param {Object} options
     * @returns {Manager}
     */
    set: function (options) {
      assign(this.options, options);

      // Options that need a little more setup
      if (options.touchAction) {
        this.touchAction.update();
      }
      if (options.inputTarget) {
        // Clean up existing event listeners and reinitialize
        this.input.destroy();
        this.input.target = options.inputTarget;
        this.input.init();
      }
      return this;
    },
    /**
     * stop recognizing for this session.
     * This session will be discarded, when a new [input]start event is fired.
     * When forced, the recognizer cycle is stopped immediately.
     * @param {Boolean} [force]
     */
    stop: function (force) {
      this.session.stopped = force ? FORCED_STOP : STOP;
    },
    /**
     * run the recognizers!
     * called by the inputHandler function on every movement of the pointers (touches)
     * it walks through all the recognizers and tries to detect the gesture that is being made
     * @param {Object} inputData
     */
    recognize: function (inputData) {
      var session = this.session;
      if (session.stopped) {
        return;
      }

      // run the touch-action polyfill
      this.touchAction.preventDefaults(inputData);
      var recognizer;
      var recognizers = this.recognizers;

      // this holds the recognizer that is being recognized.
      // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
      // if no recognizer is detecting a thing, it is set to `null`
      var curRecognizer = session.curRecognizer;

      // reset when the last recognizer is recognized
      // or when we're in a new session
      if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {
        curRecognizer = session.curRecognizer = null;
      }
      var i = 0;
      while (i < recognizers.length) {
        recognizer = recognizers[i];

        // find out if we are allowed try to recognize the input for this one.
        // 1.   allow if the session is NOT forced stopped (see the .stop() method)
        // 2.   allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
        //      that is being recognized.
        // 3.   allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
        //      this can be setup with the `recognizeWith()` method on the recognizer.
        if (session.stopped !== FORCED_STOP && (
        // 1
        !curRecognizer || recognizer == curRecognizer ||
        // 2
        recognizer.canRecognizeWith(curRecognizer))) {
          // 3
          recognizer.recognize(inputData);
        } else {
          recognizer.reset();
        }

        // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
        // current active recognizer. but only if we don't already have an active recognizer
        if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
          curRecognizer = session.curRecognizer = recognizer;
        }
        i++;
      }
    },
    /**
     * get a recognizer by its event name.
     * @param {Recognizer|String} recognizer
     * @returns {Recognizer|Null}
     */
    get: function (recognizer) {
      if (recognizer instanceof Recognizer) {
        return recognizer;
      }
      var recognizers = this.recognizers;
      for (var i = 0; i < recognizers.length; i++) {
        if (recognizers[i].options.event == recognizer) {
          return recognizers[i];
        }
      }
      return null;
    },
    /**
     * add a recognizer to the manager
     * existing recognizers with the same event name will be removed
     * @param {Recognizer} recognizer
     * @returns {Recognizer|Manager}
     */
    add: function (recognizer) {
      if (invokeArrayArg(recognizer, 'add', this)) {
        return this;
      }

      // remove existing
      var existing = this.get(recognizer.options.event);
      if (existing) {
        this.remove(existing);
      }
      this.recognizers.push(recognizer);
      recognizer.manager = this;
      this.touchAction.update();
      return recognizer;
    },
    /**
     * remove a recognizer by name or instance
     * @param {Recognizer|String} recognizer
     * @returns {Manager}
     */
    remove: function (recognizer) {
      if (invokeArrayArg(recognizer, 'remove', this)) {
        return this;
      }
      recognizer = this.get(recognizer);

      // let's make sure this recognizer exists
      if (recognizer) {
        var recognizers = this.recognizers;
        var index = inArray(recognizers, recognizer);
        if (index !== -1) {
          recognizers.splice(index, 1);
          this.touchAction.update();
        }
      }
      return this;
    },
    /**
     * bind event
     * @param {String} events
     * @param {Function} handler
     * @returns {EventEmitter} this
     */
    on: function (events, handler) {
      if (events === undefined$1) {
        return;
      }
      if (handler === undefined$1) {
        return;
      }
      var handlers = this.handlers;
      each(splitStr(events), function (event) {
        handlers[event] = handlers[event] || [];
        handlers[event].push(handler);
      });
      return this;
    },
    /**
     * unbind event, leave emit blank to remove all handlers
     * @param {String} events
     * @param {Function} [handler]
     * @returns {EventEmitter} this
     */
    off: function (events, handler) {
      if (events === undefined$1) {
        return;
      }
      var handlers = this.handlers;
      each(splitStr(events), function (event) {
        if (!handler) {
          delete handlers[event];
        } else {
          handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
        }
      });
      return this;
    },
    /**
     * emit event to the listeners
     * @param {String} event
     * @param {Object} data
     */
    emit: function (event, data) {
      // we also want to trigger dom events
      if (this.options.domEvents) {
        triggerDomEvent(event, data);
      }

      // no handlers, so skip it all
      var handlers = this.handlers[event] && this.handlers[event].slice();
      if (!handlers || !handlers.length) {
        return;
      }
      data.type = event;
      data.preventDefault = function () {
        data.srcEvent.preventDefault();
      };
      var i = 0;
      while (i < handlers.length) {
        handlers[i](data);
        i++;
      }
    },
    /**
     * destroy the manager and unbinds all events
     * it doesn't unbind dom events, that is the user own responsibility
     */
    destroy: function () {
      this.element && toggleCssProps(this, false);
      this.handlers = {};
      this.session = {};
      this.input.destroy();
      this.element = null;
    }
  };

  /**
   * add/remove the css properties as defined in manager.options.cssProps
   * @param {Manager} manager
   * @param {Boolean} add
   */
  function toggleCssProps(manager, add) {
    var element = manager.element;
    if (!element.style) {
      return;
    }
    var prop;
    each(manager.options.cssProps, function (value, name) {
      prop = prefixed(element.style, name);
      if (add) {
        manager.oldCssProps[prop] = element.style[prop];
        element.style[prop] = value;
      } else {
        element.style[prop] = manager.oldCssProps[prop] || '';
      }
    });
    if (!add) {
      manager.oldCssProps = {};
    }
  }

  /**
   * trigger dom event
   * @param {String} event
   * @param {Object} data
   */
  function triggerDomEvent(event, data) {
    var gestureEvent = document.createEvent('Event');
    gestureEvent.initEvent(event, true, true);
    gestureEvent.gesture = data;
    data.target.dispatchEvent(gestureEvent);
  }
  assign(Hammer, {
    INPUT_START: INPUT_START,
    INPUT_MOVE: INPUT_MOVE,
    INPUT_END: INPUT_END,
    INPUT_CANCEL: INPUT_CANCEL,
    STATE_POSSIBLE: STATE_POSSIBLE,
    STATE_BEGAN: STATE_BEGAN,
    STATE_CHANGED: STATE_CHANGED,
    STATE_ENDED: STATE_ENDED,
    STATE_RECOGNIZED: STATE_RECOGNIZED,
    STATE_CANCELLED: STATE_CANCELLED,
    STATE_FAILED: STATE_FAILED,
    DIRECTION_NONE: DIRECTION_NONE,
    DIRECTION_LEFT: DIRECTION_LEFT,
    DIRECTION_RIGHT: DIRECTION_RIGHT,
    DIRECTION_UP: DIRECTION_UP,
    DIRECTION_DOWN: DIRECTION_DOWN,
    DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
    DIRECTION_VERTICAL: DIRECTION_VERTICAL,
    DIRECTION_ALL: DIRECTION_ALL,
    Manager: Manager,
    Input: Input,
    TouchAction: TouchAction,
    TouchInput: TouchInput,
    MouseInput: MouseInput,
    PointerEventInput: PointerEventInput,
    TouchMouseInput: TouchMouseInput,
    SingleTouchInput: SingleTouchInput,
    Recognizer: Recognizer,
    AttrRecognizer: AttrRecognizer,
    Tap: TapRecognizer,
    Pan: PanRecognizer,
    Swipe: SwipeRecognizer,
    Pinch: PinchRecognizer,
    Rotate: RotateRecognizer,
    Press: PressRecognizer,
    on: addEventListeners,
    off: removeEventListeners,
    each: each,
    merge: merge,
    extend: extend,
    assign: assign,
    inherit: inherit,
    bindFn: bindFn,
    prefixed: prefixed
  });

  // this prevents errors when Hammer is loaded in the presence of an AMD
  //  style loader but by script tag, not by the loader.
  var freeGlobal = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}; // jshint ignore:line
  freeGlobal.Hammer = Hammer;
  if (typeof undefined$1 === 'function' && undefined$1.amd) {
    undefined$1(function () {
      return Hammer;
    });
  } else if (module.exports) {
    module.exports = Hammer;
  } else {
    window[exportName] = Hammer;
  }
})(window, document, 'Hammer');
});

//
// import BScroll from 'better-scroll'
let trend = ''; //默认向下
let bottomLoadingDistance = 600; // 底部加载距离
let topLoadingDistance = 800; // 顶部加载距离

var script$2L = {
  name: 'PreviewLooseLeaf',
  props: {
    looseLeaf: Object,
    businessType: String,
    // 业务类型：looseLeaf，textBook
    looseLeafId: {
      type: String,
      default: ''
    },
    pTitle: {
      type: String,
      default: ''
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    officePreviewPath: {
      type: String,
      default: ''
    },
    readerType: {
      type: String,
      default: 'reader'
    },
    pageType: {
      type: String,
      default: 'h5'
    },
    // 页面类型：取值h5、pc、pad
    CompList: Array,
    textDomList: Array,
    textBookList: Array,
    isTrial: {
      // 是否为试读模式
      type: Boolean,
      default: false
    },
    trialText: {
      // 试读结束提示语
      type: String,
      default: '<p>--- 试读结束 ---</p>'
    },
    isShowAi: {
      type: Number | String,
      default: 1
    },
    userType: {
      // 用户类型，可选teacher、student
      type: String,
      default: 'teacher'
    },
    resourcesList: {
      //教师资源列表
      type: Array,
      default: () => []
    },
    teacherNoteList: {
      //本章节教师笔记列表
      type: Array,
      default: () => []
    },
    studentNoteList: {
      //本章节教师笔记列表
      type: Array,
      default: () => []
    },
    highlightList: {
      //本章节高亮列表
      type: Array,
      default: () => []
    },
    isShowTeacherResource: {
      // 是否显示教师资源
      type: Boolean,
      default: false
    },
    isCopyUrl: {
      type: Boolean,
      default: false
    },
    groupHeight: {
      //每个块的占位高度
      type: Number,
      default: 600
    },
    loadingMode: {
      // 加载模式，可选roll、page
      type: String,
      default: 'roll'
    },
    navBarHeight: {
      // 业务系统导航栏高度
      type: Number,
      default: 0
    },
    ccConfig: {
      // cc播放器配置
      type: Object,
      default: () => {}
    },
    graphStoreKeyPrefix: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      xmlCompList: [],
      looseLeafData: {},
      title: '',
      showEmpty: false,
      inlineWordsModal: {
        title: '',
        visible: false,
        content: ''
      },
      mouseOverGroupIndex: -1,
      readerBoxId: `readerbox_#_${new Date().getTime()}`,
      hammerManager: null,
      bscroll: null,
      startIndex: 0,
      endIndex: 20,
      isInitialLoad: true,
      //是否是初次加载
      isScrollMore: true,
      //是否可以加载更多
      isScrollDown: true,
      //是否向下滚动
      pageHeight: this.CompList.length * this.groupHeight,
      //页面总高度
      contnetHeight: 0,
      //当前加载教材内容的高度
      paddingTop: 0,
      //顶部占位高度
      paddingBottom: 0,
      //底部占位高度
      endTime: 0,
      pointerEvents: 'auto',
      scrollTop: 0,
      stopScroll: false,
      graphLink: {
        show: false,
        model: {}
      },
      graphIndexs: [],
      // ==================================
      // ==================================

      trend: ''
    };
  },
  provide() {
    return {
      getProviderUserType: () => this.userType,
      getProviderInsideIndex: () => this.mouseOverGroupIndex,
      getReaderBoxId: () => this.readerBoxId,
      getTeacherNoteList: () => this.teacherNoteList,
      getStudentNoteList: () => this.studentNoteList,
      getHighlightList: () => this.highlightList,
      getInitialLoad: () => this.isInitialLoad,
      getResourceBasisPath: () => this.resourceBasisPath
    };
  },
  watch: {
    looseLeafId: {
      handler(newValue) {
        // if (newValue) {
        //   this.queryData()
        // }
      },
      immediate: true,
      deep: true
    },
    pTitle: {
      handler(newValue) {
        this.title = newValue;
      },
      immediate: true,
      deep: true
    },
    CompList: {
      handler(newValue) {
        if (this.CompList.length < 20 && this.CompList.length > 0) {
          this.endIndex = this.CompList.length;
        }
      },
      immediate: true,
      deep: true
    }
  },
  computed: {
    xmlDomList() {
      return this.CompList.slice(this.startIndex, this.endIndex);
    }
  },
  created() {
    this.$EventBus.$on('mounted_success', () => {
      let parent = document.getElementById(this.readerBoxId);
      parent?.removeEventListener('click', this.handleGraphLinkClick, false);
      this.$nextTick(() => {
        parent?.addEventListener('click', this.handleGraphLinkClick, false);
      });
    });
    this.$EventBus.$on('graphPreview', graphModel => {
      if (!this.graphLink.show) {
        this.graphLink.model = graphModel;
        this.graphIndexs = queryGraphIndexs(graphModel.id, this.graphStoreKeyPrefix);
        this.$refs.graphViewer.open();
        this.graphLink.show = true;
      }
    });
    this.$once('hook:beforeDestory', () => {
      this.$EventBus.$off('mounted_success');
      this.$EventBus.$off('graphPreview');
    });
    // this.$nextTick(() => {
    //   setTimeout(() => {
    //     $('a').attr('target', '_self')
    //   }, 2000)
    //   window.inlineWordsShow = (uuid) => {
    //     const ele = document.getElementById(`words__${uuid}`)
    //     const { title = '', content = '' } = ele.dataset || {}
    //     this.inlineWordsModal = { title, content, visible: true }
    //   }
    // })
    // this.xmlCompList = this.CompList
    // setTimeout(() => {
    //   this.showDom = true
    // }, 1000)
  },
  mounted() {
    delete hammer.defaults.cssProps.userSelect;
    this.$nextTick(() => {
      let readerBox = document.getElementById(this.readerBoxId);
      let hammerManager = new hammer.Manager(readerBox, {
        touchAction: 'pan-y'
      });
      hammerManager.add(new hammer.Pan({
        event: 'panstart',
        pointers: 0,
        threshold: 0
      }));
      hammerManager.get('panstart').set({
        direction: hammer.DIRECTION_ALL
      });
      hammerManager.add(new hammer.Pan({
        event: 'panmove',
        pointers: 0,
        threshold: 5
      }).recognizeWith(hammerManager.get('panstart')));
      hammerManager.add(new hammer.Pan({
        event: 'panend',
        pointers: 1,
        threshold: 32
      }).recognizeWith(hammerManager.get('panstart')));
      hammerManager.on('panend', function (e) {
        // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'Panend~~~',e)
      });
      this.hammerManager = hammerManager;
      setTimeout(() => {
        if (this.readerType !== 'loose-leaf') {
          if (this.loadingMode == 'page') {
            this.endIndex = this.CompList[0].endIndex;
          }
          // this.initSlider()
          // this.getPageHeight()
        } else {
          this.endIndex = this.CompList.length;
        }
      }, 200);
      setTimeout(() => {
        this.isInitialLoad = false;
      }, 3000);

      // this.$EventBus.$on('tippyChange', (data) => {
      //   // tippy显示时禁止页面滚动
      //   if (data.state) {
      //     this.bscroll.disable() //禁用 BetterScroll
      //   } else {
      //     this.bscroll.enable() //启用 BetterScroll
      //   }
      // })
    });

    // window.addEventListener('scroll', this.handleScrollAndWheel)
    // window.addEventListener('wheel', this.handleScrollAndWheel)
    // window.addEventListener('touchmove', this.handleScrollAndWheel)
  },
  methods: {
    refetchIndexs(id) {
      this.graphIndexs = queryGraphIndexs(id, this.graphStoreKeyPrefix);
    },
    handleGraphLinkClick(e) {
      console.log('bbbbbbbbbbbbbbbbbbbbbb', e);
      if (e.target.className.includes('xml-graph-link') && e.target.dataset.graphLinkId) {
        let graphModel = findNodeTree({
          id: e.target.dataset.graphLinkId,
          name: e.target.textContent
        }, this.graphStoreKeyPrefix);
        console.log('kkkkkkkkkkkkkkk', graphModel);
        if (graphModel.links?.length) {
          this.graphIndexs = queryGraphIndexs(graphModel.id, this.graphStoreKeyPrefix);
          this.graphLink.model = graphModel;
          this.$refs.graphViewer.open();
          this.graphLink.show = true;
        }
      }
    },
    graphLinkModalClose() {
      this.graphLink.model = {};
      this.graphLink.show = false;
    },
    callNodeClickAndScroll(anchor) {
      let obj = this.looseLeaf[anchor.looseLeafId];
      let compList = obj?.looseLeafInfo ? JSON.parse(obj.looseLeafInfo) : [];
      if (compList.length > 0) {
        let gRef = null;
        for (let i = 0, len = compList.length; i < len; i++) {
          if (gRef !== null) {
            break;
          }
          let comp = compList[i];
          if (comp.data?.graphLinks?.length) {
            comp.data.graphLinks.forEach(link => {
              if (link.targets.includes(anchor.keys)) {
                gRef = comp.xmlCompRef;
              }
            });
          }
        }
        let jumpData = {
          location: 'xml-digital-teaching/' + anchor.looseLeafId + '/' + gRef,
          maxTop: -90,
          type: 'resource',
          selectorType: 'class',
          selectorId: 'xml-graph-link',
          markTarget: '',
          classIndex: 0
        };
        this.$emit('jumpToGraphIndex', jumpData);
      }
    },
    handleScrollAndWheel(isContinue) {
      if (this.loadingMode == 'page') {
        return;
      }
      if (isContinue != true) {
        let scrollDom = document.querySelector('.xml-reader-window-Preview-dom');
        if (scrollDom.scrollTop > this.scrollTop) {
          // 向下滚动
          trend = 'down';
        } else if (scrollDom.scrollTop < this.scrollTop) {
          // 向上滚动
          trend = 'up';
        }
        this.scrollTop = scrollDom.scrollTop;
      }
      let topReserveASeat = document.getElementById('topReserveASeat').getBoundingClientRect().top;
      let BottomReserveASeat = document.getElementById('BottomReserveASeat').getBoundingClientRect().top;
      if (trend == 'down') {
        // 向下滚动
        if (BottomReserveASeat - window.innerHeight < bottomLoadingDistance) {
          window.scrollY || document.documentElement.scrollTop;
          this.trend = 'down';
          this.$nextTick(() => {
            this._requestSection(-topReserveASeat);
          });
        }
      } else if (trend == 'up') {
        // 向上滚动
        if (topReserveASeat > -topLoadingDistance) {
          window.scrollY || document.documentElement.scrollTop;
          this.trend = 'up';
          this.$nextTick(() => {
            this._requestSection(BottomReserveASeat);
          });
        }
      }
    },
    _requestSection(distance) {
      let num = 0;
      if (this.trend == 'down' || this.trend == '') {
        //新id加到数组的后面
        // console.log('底部加载更多。。。。')
        num = this.CompList.length - this.endIndex > 10 ? 10 : this.CompList.length - this.endIndex;
        this.endIndex += num;
        if (this.CompList.length > this.endIndex) {
          this.destroyDom(distance);
        }
      } else if (this.trend == 'up') {
        let scrollTop = document.querySelector('.xml-reader-window-Preview-dom').scrollTop;
        num = this.startIndex > 10 ? 10 : this.startIndex;
        this.startIndex -= num;
        let heights = 0;
        this.$nextTick(() => {
          for (let i = 0; i < num; i++) {
            let element = document.getElementsByClassName(this.xmlDomList[i].location);
            if (element && element.length > 0) {
              let height = element[0].getBoundingClientRect().height;
              heights += height;
            }
          }
          this.scrollPageTo(scrollTop + heights);
        });
        if (this.startIndex > 0) {
          this.destroyDom(distance);
        }
        // console.log('顶部加载更多。。。。')
      }
    },
    // 销毁Dom
    destroyDom(distance) {
      let destroyHeight = 0;
      let blocks = 0;
      const getDestroyHeight = i => {
        if (i == undefined || i == null || i < 0 || i >= this.xmlDomList.length) {
          return;
        }
        let element = document.getElementsByClassName(this.xmlDomList[i].location);
        if (element && element.length > 0) {
          let height = element[0].getBoundingClientRect().height;
          if (this.trend == 'down' || this.trend == '') {
            if (destroyHeight + height < distance - 1000) {
              destroyHeight += height;
              blocks++;
              getDestroyHeight(i + 1);
            } else {
              let scrollDom = document.querySelector('.xml-reader-window-Preview-dom');
              this.startIndex += blocks;
              this.scrollPageTo(scrollDom.scrollTop - destroyHeight);
              setTimeout(() => {
                this.handleScrollAndWheel(true);
                this.$emit('initObserver');
              }, 500);
            }
          } else if (this.trend == 'up') {
            if (destroyHeight + height < distance - 1000 - window.innerHeight) {
              destroyHeight += blocks;
              blocks++;
              getDestroyHeight(i - 1);
            } else {
              this.endIndex -= blocks;
              setTimeout(() => {
                this.handleScrollAndWheel(true);
                this.$emit('initObserver');
              }, 500);
            }
          }
        }
      };
      if (this.trend == 'down' || this.trend == '') {
        getDestroyHeight(0);
      } else if (this.trend == 'up') {
        getDestroyHeight(this.xmlDomList.length - 1);
      }
    },
    goBack() {
      this.$emit('onGoBack');
    },
    handleMouseOver(e) {
      const path = e.composedPath();
      const groupTarget = path.find(item => item.classList && item.classList.contains('parent-group'));
      groupTarget?.getAttribute('id') || '';
      // this.mouseOverGroupIndex = id ? this.CompList.findIndex((item) => item.location === id) : -1
    },
    downloadFile(e) {
      this.$emit('downloadFile', e);
    },
    showFileReader(e) {
      this.$emit('showFileReader', e);
    },
    openTestPaper({
      info,
      showRobot
    }) {
      this.$emit('openTestPaper', {
        info: info,
        showRobot: showRobot
      });
    },
    openAIanalysis(e) {
      this.$emit('setanalysis', e);
    },
    clickComp(item) {
      this.mouseOverGroupIndex = item.componentIndex;
      this.$emit('clickComp', item);
    },
    // 驼峰命名
    allCapital(value) {
      const matched = value.match(/[A-Z]+/);
      return matched && matched[0] === value;
    },
    // 添加教师资源
    addTeacherResources(item) {
      this.$emit('addTeacherResources', item);
    },
    // 短横线命名
    toKebabCase(value) {
      if (this.allCapital(value)) {
        return value.toLocaleLowerCase();
      }
      return value.charAt(0).toLowerCase() + value.slice(1).replace(/([A-Z])/g, '-$1').toLowerCase();
    },
    // 计算某个块中的教师资源数量
    getResourcesNumber(f) {
      let s = JSON.stringify(this.resourcesList);
      let r = s.indexOf(f);
      let c = 0;
      while (r != -1) {
        c++;
        r = s.indexOf(f, r + 1);
      }
      return c;
    },
    // 打开教师资源列表
    openTeacherResoucesList(item) {
      this.getResourcesNumber(item.location);
      setTimeout(() => {
        // if (num > 0) {
        this.$emit('openTeacherResoucesList', item);
        // }
      }, 300);
    },
    openHtml(data) {
      this.$emit('openHtml', data);
    },
    copyHtmlUrl(data) {
      this.$emit('copyHtmlUrl', data);
    },
    /**
     * 跳转到指定位置
     * @param {*} componentIndex 要跳转到块的索引
     * @param {*} maxTop 滚动距离后距离可视窗口顶部的距离
     * @param {*} type 跳转类型resource：资源，search：搜索，marker：标记
     * @param {*} selectorType 选择器selectorId的类型：id，class
     * @param {*} selectorId 选择器id或class值
     * @param {*} markTarget 笔记、高亮的item
     * @param {*} classIndex type为class时，用于滚动到第几个Dom
     */
    jumpTo(data, callback) {
      // console.log('🚀 ~ jumpTo ~ data:', data, this.CompList.length)
      this.isScrollMore = false;
      const {
        componentIndex,
        maxTop,
        selectorType,
        selectorId,
        classIndex
      } = data;
      if (this.loadingMode == 'page') {
        this.startIndex = this.CompList[componentIndex].startIndex;
        this.endIndex = this.CompList[componentIndex].endIndex;
        console.log(this.startIndex, this.endIndex, 'aaaaaaaaaaaaaaaa');
      } else if (this.startIndex > componentIndex || this.endIndex < componentIndex) {
        if (componentIndex < 10) {
          this.startIndex = 0;
          this.endIndex = 20;
        } else if (this.CompList.length - componentIndex > 20 && componentIndex >= 10) {
          this.startIndex = componentIndex - 10;
          this.endIndex = componentIndex + 10;
        } else if (this.CompList.length - componentIndex <= 20) {
          this.endIndex = this.CompList.length;
          this.startIndex = this.CompList.length > 20 ? this.CompList.length - 20 : 0;
        }
        this.paddingTop = this.startIndex * this.groupHeight;
        this.paddingBottom = 0;
      }
      setTimeout(() => {
        this.$nextTick(() => {
          let scrollItem = document.getElementById('scroll-item-' + componentIndex);
          if (scrollItem) {
            let {
              height
            } = scrollItem.getBoundingClientRect(); //要跳转到块的高度
            let scrollTo = scrollItem.getBoundingClientRect().top + this.scrollTop;
            this.$nextTick(() => {
              this.$emit('initObserver');
              let top = 0;
              this.scrollPageTo(scrollTo + maxTop - 100 - this.navBarHeight);
              if (callback && typeof callback === 'function') {
                callback();
              }
              if (selectorType == 'id') {
                //跳转目标是笔记、高亮、等通过id获取位置的元素
                setTimeout(() => {
                  top = document.getElementById(selectorId) ? document.getElementById(selectorId)?.getBoundingClientRect().top : 0;
                  this.scrollPageTo(scrollTo + maxTop - 100 + top - 230 - this.navBarHeight);
                }, 200);
              } else if (selectorType == 'class') {
                //跳转目标是资源类型通过class获取位置的元素
                let typeList = ['xml-video-title', 'xml-image-title'];
                if (!typeList.includes(selectorId)) {
                  height = 0;
                }
                setTimeout(() => {
                  let Dom = scrollItem.querySelectorAll(`.${selectorId}`)[classIndex];
                  top = Dom ? Dom?.getBoundingClientRect().top : 0;
                  this.scrollPageTo(scrollTo + maxTop - 100 + top - height - 230 - this.navBarHeight);
                }, 200);
              }
            });
          }
        });
      }, 500);
    },
    scrollPageTo(top) {
      let scrollDom = document.querySelector('.xml-reader-window-Preview-dom');
      if (scrollDom) {
        scrollDom.scroll(0, top);
      }
    },
    // 处理样式变更引发的重排或重绘后笔记位置的同步更新
    previewRepaint() {
      this.xmlDomList.map(item => {
        this.$EventBus.$emit(`previewRepaint-${item.location}`);
      });
    }
  }
};

/* script */
const __vue_script__$2L = script$2L;
/* template */
var __vue_render__$2L = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-reader-window-box xml-reader-window-Preview-dom",
      style: {
        "--xml-iframe-pointer-events": _vm.pointerEvents,
      },
      attrs: { id: _vm.readerBoxId },
      on: { mouseover: _vm.handleMouseOver, scroll: _vm.handleScrollAndWheel },
    },
    [
      _c("div", { staticClass: "content reader-content" }, [
        _c(
          "div",
          { staticClass: "text-books-content" },
          [
            _c(
              "div",
              {
                class:
                  _vm.startIndex > 0 && _vm.loadingMode != "page"
                    ? "load-more"
                    : "",
                attrs: { id: "topReserveASeat" },
              },
              [_c("i", { staticClass: "el-icon-loading" })]
            ),
            _vm._v(" "),
            _vm._l(_vm.xmlDomList, function (item, index) {
              return _c(
                "div",
                {
                  key: item.componentIndex,
                  ref: "items",
                  refInFor: true,
                  staticClass: "xml-parent-group-block",
                  class: ["chapter_" + item.firstLevelId, item.location],
                  attrs: {
                    componentIndex: item.componentIndex,
                    id: "scroll-item-" + item.componentIndex,
                  },
                  on: {
                    mousedown: function ($event) {
                      return _vm.clickComp(item)
                    },
                    touchstart: function ($event) {
                      return _vm.clickComp(item)
                    },
                  },
                },
                [
                  _c(_vm.toKebabCase(item.componentsName) + "-render", {
                    ref: item.xmlCompRef,
                    refInFor: true,
                    tag: "component",
                    attrs: {
                      id: item.location,
                      location: item.location,
                      componentIndex: item.componentIndex,
                      mode: "reader",
                      "page-type": _vm.pageType,
                      "p-group-data": item.data.pGroupData,
                      "current-rule": item,
                      "rule-index": item.componentIndex,
                      "extend-params": item.data.extendParams,
                      resourceBasisPath: _vm.resourceBasisPath,
                      officePreviewPath: _vm.officePreviewPath,
                      isShowAi: _vm.isShowAi,
                      isCopyUrl: _vm.isCopyUrl,
                      isReader: true,
                      ccConfig: _vm.ccConfig,
                      islast: index === _vm.xmlDomList.length - 1,
                    },
                    on: {
                      setanalysis: _vm.openAIanalysis,
                      downloadFileUrl: _vm.downloadFile,
                      showFileReader: _vm.showFileReader,
                      openTestPaper: _vm.openTestPaper,
                      openHtml: _vm.openHtml,
                      copyHtmlUrl: _vm.copyHtmlUrl,
                      submitAnswer: function ($event) {
                        return _vm.$emit("submitAnswer", $event)
                      },
                    },
                  }),
                  _vm._v(" "),
                  _vm.getResourcesNumber(item.location) > 0 &&
                  _vm.isShowTeacherResource
                    ? [
                        _c(
                          "div",
                          {
                            staticClass: "teacher-resources-number-h5",
                            on: {
                              click: function ($event) {
                                return _vm.openTeacherResoucesList(item)
                              },
                            },
                          },
                          [
                            _c("span", { staticClass: "number" }, [
                              _vm._v(
                                _vm._s(_vm.getResourcesNumber(item.location))
                              ),
                            ]),
                          ]
                        ),
                      ]
                    : _vm._e(),
                ],
                2
              )
            }),
            _vm._v(" "),
            _c(
              "div",
              {
                class:
                  _vm.endIndex < _vm.CompList.length &&
                  _vm.loadingMode != "page"
                    ? "load-more"
                    : "",
                attrs: { id: "BottomReserveASeat" },
              },
              [_c("i", { staticClass: "el-icon-loading" })]
            ),
          ],
          2
        ),
        _vm._v(" "),
        _vm.isTrial && _vm.endIndex >= _vm.CompList.length
          ? _c("div", {
              staticClass: "the-end-of-the-trial",
              domProps: { innerHTML: _vm._s(_vm.trialText) },
            })
          : _vm._e(),
      ]),
      _vm._v(" "),
      _c("XmlGraphViewer", {
        ref: "graphViewer",
        attrs: { model: _vm.graphLink.model, indexs: _vm.graphIndexs },
        on: {
          jump: _vm.callNodeClickAndScroll,
          updateIndexs: _vm.refetchIndexs,
        },
      }),
    ],
    1
  )
};
var __vue_staticRenderFns__$2L = [];
__vue_render__$2L._withStripped = true;

  /* style */
  const __vue_inject_styles__$2L = undefined;
  /* scoped */
  const __vue_scope_id__$2L = "data-v-061fcb28";
  /* module identifier */
  const __vue_module_identifier__$2L = undefined;
  /* functional template */
  const __vue_is_functional_template__$2L = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2L = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2L, staticRenderFns: __vue_staticRenderFns__$2L },
    __vue_inject_styles__$2L,
    __vue_script__$2L,
    __vue_scope_id__$2L,
    __vue_is_functional_template__$2L,
    __vue_module_identifier__$2L,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2K = {
  name: 'xmlLooseLeafReader',
  props: {
    looseLeaf: Object,
    businessType: String,
    // 业务类型：looseLeaf，textBook
    looseLeafId: {
      type: String,
      default: ''
    },
    textBookData: Object,
    pTitle: {
      type: String,
      default: ''
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    officePreviewPath: {
      type: String,
      default: ''
    },
    readerType: {
      type: String,
      default: 'reader'
    },
    pageType: {
      type: String,
      default: 'h5'
    },
    // 页面类型：取值h5、pc、pad
    textDomList: Array,
    textBookList: Array,
    isTrial: {
      // 是否为试读模式
      type: Boolean,
      default: false
    },
    trialText: {
      // 试读结束提示语
      type: String,
      default: '<p>--- 试读结束 ---</p>'
    },
    isShowAi: {
      type: String,
      default: '1'
    },
    userType: {
      // 用户类型，可选teacher、student
      type: String,
      default: 'teacher'
    },
    resourcesList: {
      //教师资源列表
      type: Array,
      default: () => []
    },
    teacherNoteList: {
      //本章节教师笔记列表
      type: Array,
      default: () => []
    },
    studentNoteList: {
      //本章节教师笔记列表
      type: Array,
      default: () => []
    },
    highlightList: {
      //本章节高亮列表
      type: Array,
      default: () => []
    },
    isShowTeacherResource: {
      // 是否显示教师资源
      type: Boolean,
      default: false
    },
    isCopyUrl: {
      type: Boolean,
      default: false
    },
    groupHeight: {
      //每个块的占位高度
      type: Number,
      default: 600
    },
    loadingMode: {
      // 加载模式，可选roll、page
      type: String,
      default: 'roll'
    },
    navBarHeight: {
      // 业务系统导航栏高度
      type: Number,
      default: 0
    },
    linkOpenLabel: {
      // pc端链接是否打开新标签
      type: Boolean,
      default: false
    },
    updateFREQUENCY: {
      // 音视频更新频率，默认10s
      type: Number,
      default: 10000
    }
  },
  data() {
    return {
      CompList: [],
      showPdf: false,
      fileBaseUrl: '',
      fileBaseTitle: '',
      dialogData: {},
      playTimeMap: {},
      hotTargetViewerVisible: false,
      hotzoneTarget: {}
    };
  },
  provide() {
    return {
      getProviderUserType: () => this.userType,
      getProviderInsideIndex: () => this.mouseOverGroupIndex,
      getReaderBoxId: () => this.readerBoxId,
      getTeacherNoteList: () => this.teacherNoteList,
      getStudentNoteList: () => this.studentNoteList,
      getHighlightList: () => this.highlightList,
      getInitialLoad: () => this.isInitialLoad,
      getResourceBasisPath: () => this.resourceBasisPath
    };
  },
  watch: {
    looseLeaf: {
      handler(newValue) {
        this.formattedData();
      },
      immediate: true,
      deep: true
    },
    textBookData: {
      handler(newValue) {
        this.setTextBookStyle();
      },
      immediate: true,
      deep: true
    }
  },
  computed: {},
  mounted() {
    this.formattedData();
    this.setTextBookStyle();
    this.$nextTick(() => {
      window.document.oncontextmenu = function (e) {
        e.preventDefault();
      };
      this.textBookData.themeColor ? this.themeColor = this.textBookData.themeColor : this.themeColor = '#6883FA';
      if (this.textBookData.captionText) {
        document.title = this.textBookData.captionText;
      }
      let _this = this;
      this.$EventBus.$on('videoTimeUpdate', throttle$2(_this.updateFREQUENCY, function (options) {
        // console.log('更新视频播放时长', options)
        let info = options.data;
        if (info) {
          _this.$emit('learningStatistics', {
            type: 'video',
            ...info
          });
        }
      }));
      this.$EventBus.$on('audioTimeUpdate', throttle$2(_this.updateFREQUENCY, function (options) {
        // console.log('更新音频播放时长', options)
        let info = options.data;
        if (info) {
          _this.$emit('learningStatistics', {
            type: 'audio',
            ...info
          });
        }
      }));
      this.$EventBus.$on('resetTimeUpdate', function (data) {
        const {
          statisticsId
        } = data;
        if (statisticsId) {
          _this.$set(_this.playTimeMap, statisticsId, undefined);
        }
      });
      this.$EventBus.$on('handleMagicLinkAudioPlay', function (data) {
        const {
          targetId,
          plaintext,
          title,
          content,
          type,
          isPlaying,
          callback
        } = data;
        const playerId = 'player__' + targetId.split('__')[1];
        if (!this.magicLinkAudio) {
          const audioElem = new Audio(content);
          audioElem.setAttribute('id', playerId);
          // audioElem.addEventListener("canplaythrough", event => {
          //     audioElem.play();
          //     typeof callback === 'function' && callback(audioElem)
          // });
          this.magicLinkAudio = audioElem;
          this.magicLinkAudio.play().then(() => $(`#${targetId}`).attr('data-isplaying', 'true'));
        } else {
          if (this.magicLinkAudio.id === playerId) {
            // 如果是同一个魔链音频, 仅切换播放状态
            if (this.magicLinkAudio.paused) {
              this.magicLinkAudio.play().then(() => $(`#${targetId}`).attr('data-isplaying', 'true'));
            } else {
              this.magicLinkAudio.pause();
            }
            $(`#${targetId}`).attr('data-isplaying', this.magicLinkAudio.paused ? 'false' : 'true');
          } else {
            const oldTarget = `#${this.magicLinkAudio.id.replace('player__', 'ml-audio__')}`;
            this.magicLinkAudio.pause();
            $(oldTarget).attr('data-isplaying', 'false');
            // 不是同一个魔链音频直接切换音频源
            this.magicLinkAudio.setAttribute('id', playerId);
            this.magicLinkAudio.setAttribute('src', content);
            this.magicLinkAudio.play().then(() => $(`#${targetId}`).attr('data-isplaying', 'true'));
          }
        }
      });
      this.$EventBus.$on('hotzoneClick', function (set) {
        const {
          type = '',
          value,
          label,
          desc = '',
          cover = ''
        } = set || {};
        _this.hotzoneTarget = {
          type,
          value,
          label,
          desc,
          cover
        };
        if (!type || !value) {
          that.$message.error('当前热区绑定非有效目标');
          return;
        }
        const modalTypeDict = ['richtext', 'image', 'audio', 'video'];
        if (type === 'looseleaf') {
          //   _this.initializeTheLooseLeaf({ looseLeafId: value, title: label })
          _this.$set('initializeTheLooseLeaf', {
            looseLeafId: value,
            title: label
          });
        }
        if (type === 'chapter') {
          // 浏览章节
          _this.$set('JumpPosition', {
            chapterId: value,
            title: label
          });
          // _this.$message.error('暂不支持热区跳转章节')
          // _this.JumpPosition('xml-digital-teaching/' + value + '/' + 'placeholders', 50)
          //   let obj = _this.looseLeafData[value]
          //   if (obj && obj.looseLeafInfo && JSON.parse(obj.looseLeafInfo).length > 0) {
          //     let xmlCompRef = JSON.parse(obj.looseLeafInfo)[0].xmlCompRef
          //     _this.JumpPosition({
          //       location: 'xml-digital-teaching/' + value + '/' + xmlCompRef,
          //       maxTop: -30,
          //       type: 'catalog',
          //       selectorType: '',
          //       selectorId: '',
          //       markTarget: '',
          //       classIndex: 0
          //     })
          //   }
        }
        if (type === 'link') {
          const re = /((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?)/;
          const result = re.test(value);
          if (!result) {
            _this.$message.error('当前热区绑定非有效链接');
            return;
          }
          _this.openPage({
            url: value,
            title: ''
          });
          // _this
          //   .$confirm(`当前热区绑定外部链接地址为：${value} ，确认打开？`, '', {
          //     customClass: 'mobile-fix-msgbox'
          //   })
          //   .then((_) => {
          //     window.open(value, '_blank')
          //     done()
          //   })
          //   .catch((_) => {})
        }
        if (modalTypeDict.includes(type)) {
          _this.hotTargetViewerVisible = true;
        }
      });

      // window.showleafletDate = uuid => {
      //   window.open(ENV_CONFIG.VUE_APP_TEXTBOOK_WEB + 'previewLooseLeaf?pageType=h5' + '&businessType=looseLeaf' + '&looseLeafId=' + uuid + '&isTrial=' + this.isTrial + '&uuid=' + uuidv4())
      // }
      window.showImageBYDate = uuid => {
        target = window.event.target;
        let imgs = $(target).find('img');
        if (!imgs.length) {
          imgs = $('#image__' + uuid) ? $('#image__' + uuid).find('img') : null;
        }
        let imgList = [];
        if (imgs) {
          imgs.each(function (img) {
            const title = $(this).attr('preview-text') || '';
            const src = $(this).prop('src') || '';
            imgList.push({
              url: src,
              title: title
            });
          });
        }
        this.$hevueImgPreview({
          multiple: true,
          nowImgIndex: 0,
          imgList
        });
      };
      window.inlineAudioPlay = uuid => {
        target = window.event.target;
        if (target.isShow == true) return;
        target.isShow = true;
        const audio = document.getElementById('audio' + uuid);
        if (audio.paused) {
          audio.play();
          document.getElementById('icon' + uuid).className = 'wifi-symbol playing';
        } else {
          audio.pause();
          audio.currentTime = 0; // 音乐从头播放
          document.getElementById('icon' + uuid).className = 'wifi-symbol';
        }
        setTimeout(() => {
          target.isShow = false;
        }, 1000);
        return false;
      };

      // 更新学习统计情况
      this.$EventBus.$on('learningStatistics', function (model) {
        let info = model.info || _this.currentGroupInfo;
        _this.$emit('learningStatistics', {
          type: model.type,
          ...info
        });
      });
    });
  },
  created() {},
  methods: {
    formattedData() {
      let list = [];
      if (this.looseLeaf && this.looseLeaf.looseLeafInfo) {
        list = JSON.parse(this.looseLeaf.looseLeafInfo);
        list.map((element, index) => {
          this.$set(element, 'chapterId', this.looseLeaf.id);
        });
      }
      this.CompList = list;
    },
    setTextBookStyle() {
      let moduleAttribute = this.textBookData.moduleAttributeInfo || '[]';
      if (JSON.parse(moduleAttribute)?.length) {
        let i = JSON.parse(moduleAttribute).findIndex(item => item.type === 'freeOptions' && item.target === 'textbook');
        let newValue = JSON.parse(moduleAttribute)[i]?.data || {};
        let Dom = document.getElementById('xmlLooseLeafReader');
        if (Dom) {
          Dom.style.setProperty('--book-padding', (newValue.padding || newValue.padding == '0' ? newValue.padding : 6) + 'px');
          Dom.style.setProperty('--book-marginTop', newValue.marginTop + 'px');
        }
      }
    },
    downloadFile(e) {
      this.$emit('downloadFile', e);
    },
    showFileReader(e) {
      // console.log('showFileReader', e)
      // this.$emit('showFileReader', e)
      let url = '';
      if (e.fileUrl.indexOf('.epub') !== -1 || e.fileUrl.indexOf('.pdf') !== -1) {
        url = e.fileUrl;
      } else {
        url = this.officePreviewPath + e.fileUrl;
      }
      this.openPage({
        url: url,
        title: e.title
      });
    },
    // 打开内容弹窗
    openPage(e) {
      if (this.pageType == 'pc' && this.linkOpenLabel) {
        window.open(e.url, 'mozillaTab');
      } else {
        this.fileBaseUrl = e.url;
        this.fileBaseTitle = e.title || '';
        this.showPdf = true;
      }
    },
    openTestPaper({
      info,
      showRobot
    }) {
      this.$emit('openTestPaper', {
        info: info,
        showRobot: showRobot
      });
    },
    openAIanalysis(e) {
      this.$emit('setanalysis', e);
    },
    clickComp(item) {
      this.mouseOverGroupIndex = item.componentIndex;
      this.$emit('clickComp', item);
    },
    openHtml(data) {
      this.$emit('openHtml', data);
    },
    copyHtmlUrl(data) {
      this.$emit('copyHtmlUrl', data);
    },
    // 驼峰命名
    allCapital(value) {
      const matched = value.match(/[A-Z]+/);
      return matched && matched[0] === value;
    },
    // 短横线命名
    toKebabCase(value) {
      if (this.allCapital(value)) {
        return value.toLocaleLowerCase();
      }
      return value.charAt(0).toLowerCase() + value.slice(1).replace(/([A-Z])/g, '-$1').toLowerCase();
    }
  }
};

/* script */
const __vue_script__$2K = script$2K;

/* template */
var __vue_render__$2K = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "xml-digital-teaching-preview" },
    [
      _vm._l(_vm.CompList, function (item, index) {
        return _c(
          "div",
          { key: index, staticClass: "xml-parent-group-block" },
          [
            _c(_vm.toKebabCase(item.componentsName) + "-render", {
              ref: item.xmlCompRef,
              refInFor: true,
              tag: "component",
              attrs: {
                mode: "preview",
                "page-type": _vm.pageType,
                "p-group-data": item.data.pGroupData,
                "current-rule": item,
                "extend-params": item.data.extendParams,
                resourceBasisPath: _vm.resourceBasisPath,
                officePreviewPath: _vm.officePreviewPath,
                isShowAi: _vm.isShowAi,
                isCopyUrl: _vm.isCopyUrl,
                isReader: true,
              },
              on: {
                setanalysis: _vm.openAIanalysis,
                downloadFileUrl: _vm.downloadFile,
                showFileReader: _vm.showFileReader,
                openTestPaper: _vm.openTestPaper,
                openHtml: _vm.openHtml,
                copyHtmlUrl: _vm.copyHtmlUrl,
                submitAnswer: function ($event) {
                  return _vm.$emit("submitAnswer", $event)
                },
              },
            }),
          ],
          1
        )
      }),
      _vm._v(" "),
      _c("xml-dialog", {
        attrs: {
          dialogData: _vm.dialogData,
          pageType: _vm.pageType,
          show: _vm.showPdf,
          baseUrl: _vm.fileBaseUrl,
          textInfo: _vm.fileBaseTitle,
        },
        on: {
          handleClose: function ($event) {
            _vm.showPdf = false;
          },
        },
      }),
      _vm._v(" "),
      _c("XmlHotTargetModalViewer", {
        attrs: { visible: _vm.hotTargetViewerVisible, data: _vm.hotzoneTarget },
        on: {
          "update:visible": function ($event) {
            _vm.hotTargetViewerVisible = $event;
          },
        },
      }),
    ],
    2
  )
};
var __vue_staticRenderFns__$2K = [];
__vue_render__$2K._withStripped = true;

  /* style */
  const __vue_inject_styles__$2K = undefined;
  /* scoped */
  const __vue_scope_id__$2K = undefined;
  /* module identifier */
  const __vue_module_identifier__$2K = undefined;
  /* functional template */
  const __vue_is_functional_template__$2K = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2K = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2K, staticRenderFns: __vue_staticRenderFns__$2K },
    __vue_inject_styles__$2K,
    __vue_script__$2K,
    __vue_scope_id__$2K,
    __vue_is_functional_template__$2K,
    __vue_module_identifier__$2K,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2J = {
  name: 'xmlRobotPc',
  props: {
    bookName: {
      type: String,
      default: ''
    },
    goodsId: {
      type: String,
      default: ''
    },
    robotData: {
      type: Object,
      default: () => {}
    },
    name: {
      type: String,
      default: '小新'
    }
  },
  data() {
    return {
      list: [],
      robotShwo: false,
      timer: 0,
      textIndex: 1,
      Interval: null,
      robotWidth: 362,
      //400
      robotHeight: 500,
      //600
      left: 0,
      current: 0,
      screenX: 0,
      screenY: 0,
      correct: ['Hi', '，', '快', '来', '一', '起', '学', '习', '吧', '!'],
      elfinStatic: true,
      exportStatic: false,
      timeout: null,
      conversationId: ''
    };
  },
  directives: {
    drag: {
      bind: function (el, direction) {
        // console.log(el);
        let oDiv = el; // 获取当前元素
        oDiv.onmousedown = e => {
          // console.log(e);
          let dir = direction.value || {
            top: true,
            left: true,
            dragClass: ''
          };
          if (!dir.dragClass || e.target.className.indexOf(dir.dragClass) !== -1) {
            // 算出鼠标相对元素的位置
            let disX = e.clientX - oDiv.offsetLeft;
            let disY = e.clientY - oDiv.offsetTop;
            document.onmousemove = e => {
              // 用鼠标的位置减去鼠标相对元素的位置，得到元素的位置
              let left = e.clientX - disX;
              let top = e.clientY - disY;
              if (dir.top && top > 0) {
                oDiv.style.top = top + 'px';
              }
              if (dir.left) {
                oDiv.style.left = left + 'px';
              }
            };
            document.onmouseup = e => {
              document.onmousemove = null;
              document.onmouseup = null;
            };
          }
        };
      }
    }
  },
  mounted() {
    console.log(this.robotData, 'this.robotDatathis.robotDatathis.robotData');
    this.robotHeight = window.innerHeight - 300;
    this.createAConversation();
    // calc((100% - 220px) / 2)
    this.left = document.documentElement.clientWidth - this.robotWidth - 100 + 'px';
    setTimeout(() => {
      this.elfinStatic = false;
    }, 5000);
  },
  methods: {
    mousedown(event, axial, direction) {
      this.current = axial == 'X' ? event.screenX : event.screenY;
      let top = Number(this.$refs.robotView.style.top.split('px')[0]);
      let left = Number(this.$refs.robotView.style.left.split('px')[0]);
      document.onmousemove = e => {
        if (direction == 'right') {
          if (e.screenX - this.current < 0 && this.robotWidth + this.screenX > 300) {
            this.screenX = e.screenX - this.current;
          } else if (e.screenX - this.current > 0 && this.robotWidth + this.screenX < 1000) {
            this.screenX = e.screenX - this.current;
          }
        } else if (direction == 'bottom') {
          if (e.screenY - this.current < 0 && this.robotHeight + this.screenY > 500) {
            this.screenY = e.screenY - this.current;
          } else if (e.screenY - this.current > 0 && this.robotHeight + this.screenY < document.documentElement.clientHeight - 140) {
            this.screenY = e.screenY - this.current;
          }
        } else if (direction == 'top') {
          if (this.current - e.screenY < 0 && this.robotHeight + this.screenY > 500) {
            this.screenY = this.current - e.screenY;
          } else if (this.current - e.screenY > 0 && this.robotHeight + this.screenY < document.documentElement.clientHeight - 140 && top - this.screenY > 0) {
            this.screenY = this.current - e.screenY;
          }
          this.$refs.robotView.style.top = top - this.screenY + 'px';
        } else if (direction == 'left') {
          if (this.current - e.screenX < 0 && this.robotWidth + this.screenX > 300) {
            this.screenX = this.current - e.screenX;
          } else if (this.current - e.screenX > 0 && this.robotWidth + this.screenX < 1000) {
            this.screenX = this.current - e.screenX;
          }
          this.$refs.robotView.style.left = left - this.screenX + 'px';
        }
      };
      document.onmouseup = e => {
        this.robotWidth += this.screenX;
        this.robotHeight += this.screenY;
        this.screenX = 0;
        this.screenY = 0;
        document.onmousemove = null;
      };
    },
    // 打开Ai解析
    openAiAnalysis(type, question) {
      this.robotShwo = true;
      this.sending(question);
    },
    //   发送
    sending(Text) {
      if (Text.replace(/\s+/g, '') != '') {
        let rightData = {
          id: 'right_' + new Date().getTime(),
          direction: 'right',
          content: Text.replace(/\s+/g, ''),
          type: 'text',
          loading: false,
          time: this.getTime(),
          videoUrl: '',
          loadingCompleted: true
        };
        this.list.push(rightData);
        // 发送消息是创建一条内为空的回答
        let leftData = {
          id: 'left_' + new Date().getTime(),
          direction: 'left',
          content: '',
          type: 'text',
          loading: true,
          time: this.getTime(),
          videoUrl: '',
          loadingCompleted: false
        };
        this.list.push(leftData);
        // 获取回答内容
        this.loadData(Text.replace(/\s+/g, ''), this.list.length - 1);
        this.$refs.Input.innerHTML = '';
        setTimeout(() => {
          this.scrollToBottom();
        }, 200);
      }
    },
    // 获取当前时间
    getTime() {
      let date = new Date();
      let h = date.getHours();
      let m = date.getMinutes();
      return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m);
    },
    // 回车事件
    handlePushKeyword(event) {
      if (event.keyCode === 13) {
        event.preventDefault(); // 阻止浏览器默认换行操作
        this.sending(this.$refs.Input.innerText); // 发送文本
        return false;
      }
    },
    // 滚动内容
    scrollToBottom() {
      let Dom = this.$refs.scrollDiv;
      Dom.scrollTop = Dom.scrollHeight;
    },
    moveStart() {
      this.timer = new Date().getTime();
    },
    // 打开小智答疑窗口
    elfinClick() {
      let timer = new Date().getTime();
      if (timer - this.timer < 400) {
        // this.$message.warning("功能升级中..")
        this.robotShwo = true;
        if (this.list.length === 0) {
          //创建一条欢迎语

          this.printer(18);
        }
      }
    },
    // 创建消息
    async createAConversation() {
      fetch(this.robotData.baseUrl, {
        method: 'post',
        headers: {
          'Content-Type': 'application/json;charset=utf-8',
          Authorization: 'Bearer ' + this.robotData.token
        },
        body: JSON.stringify({
          token: 'Bearer ' + this.robotData.token,
          app_id: this.robotData.appId
        })
      }).then(response => response.json()).then(json => {
        this.conversationId = json.conversation_id || json.data.conversation_id;
      });
    },
    // 获取小智答疑答案
    async loadData(question, index) {
      this.$nextTick;
      let controller = new AbortController();
      try {
        const response = await fetch(this.robotData.conversationUrl, {
          method: 'post',
          headers: {
            'Content-Type': 'application/json;charset=utf-8',
            Authorization: 'Bearer ' + this.robotData.token
          },
          body: JSON.stringify({
            token: 'Bearer ' + this.robotData.token,
            app_id: this.robotData.appId,
            query: question,
            stream: true,
            conversation_id: this.conversationId,
            signal: controller.signal
          })
        });
        const reader = response.body.getReader();
        let data = '';
        let videoUrl = '';
        let content = '';
        while (true) {
          const {
            done,
            value
          } = await reader.read();
          console.log('🚀 ~ loadData ~ done:123', done);
          if (done) {
            this.list[index].loadingCompleted = true;
            this.list[index].content = this.list[index].content.replace(/<\/?code>/g, '').replace(/&lt;br\/&gt;/g, '<br/>');
            // setLoading(false);
            console.log(this.list[index].content, '完整文本213');
            break;
          }
          data = new TextDecoder().decode(value);
          let list = data.split('data: ') || [];
          list.map(item => {
            console.log(item, 'item');
            const regex = /"answer":\s*"([^"]+)"/;
            const match = regex.exec(item);
            if (match) {
              // const answer = match[1];
              // 格式化文本内容并转换为Markdown
              content += match[1].replace(/\\n/g, '<br/>');
              this.list[index].content = marked.parse(content);
              // console.log(`The answer is ${content}`);
              // this.saveData(index)
            } else {
              console.log('No answer found.');
            }
            // if (item && item != '\n\n') {
            //   let json = {}
            //   try {
            //     json = JSON.parse(item) || {}
            //   } catch (e) {
            //   }

            //   let text = json.answer || ''
            //   // 格式化文本内容并转换为Markdown
            //   content += text.replace(/\\n/g, '<br/>')
            //   this.list[index].content = marked.parse(content)
            //   // this.saveData(index)
            // }
          });

          // if (data.indexOf('answer')) {
          //   let textList = data.split('"answer": "') || []
          //   if (textList.length > 1) {
          //     let text = textList[1].split('", "conversation_id')[0] || ''
          //     if (text.replace(/\s+/g, '') != '') {
          //       // console.log(text,text.replace(/\n/g,'<br/>'));
          //      content += text.replace(/\\n/g,'<br/>')
          //       this.list[index].content =marked.parse(content)
          //       // console.log("🚀 ~ loadData ~ this.list[index].content:", this.list[index].content,this.list[index].content.replace(/\n/g,'<br/>'))
          //     }
          //   }
          // }

          // if (data.indexOf('DONE') !== -1) {
          //   this.list[index].loadingCompleted = true
          // }
          // content = ''
          // // 数据更新时销毁加载完成计时器
          // if (this.timeout) {
          //   clearTimeout(this.timeout)
          //   this.timeout = null
          // }
          // let eaderStream = data.split('\r\n\r\n')
          // eaderStream.map((item) => {
          //   if (item) {
          //     let textData = item.split('data:')

          //     textData.map((items) => {
          //       if (items && items.indexOf('{') !== -1) {
          //         let text = JSON.parse(items)
          //         if (text.content) {
          //           content += text.content
          //         }
          //       } else if (items.indexOf('.mp4') !== -1) {
          //         videoUrl = items.slice(1, items.length - 7)
          //       }
          //     })
          //   }
          // })
          this.list[index].loading = false;
          this.list[index].type = 'text';

          // this.list[index].videoUrl = videoUrl
          setTimeout(() => {
            // this.scrollToBottom();
            let itemDom = document.getElementById('robot-content-' + index);
            let Dom = this.$refs.scrollDiv;
            Dom.scrollTop = itemDom.offsetTop + itemDom.offsetHeight - 500;
            // console.log(DOM.offsetHeight);
            // console.log(DOM.offsetTop);
          }, 200);

          // // 防止加载完成还显示加载中进度条，5s后默认关闭
          // this.timeout = setTimeout(() => {
          //   this.list[index].loadingCompleted = true
          // }, 5000)
        }
      } catch {
        this.list[index].loading = false;
        this.list[index].loadingCompleted = true;
        this.list[index].content = '亲，我的知识库里无法找到答案，请您修改问题重新提问。';
        this.list[index].type = 'text';
      }
    },
    closeRobot() {
      this.robotShwo = false;
      let videoList = document.getElementById('robot-content-box').querySelectorAll('video') || [];
      videoList.forEach(i => {
        i.pause();
      });
    },
    /**
     *
     */
    // 文字打印机
    printer(num) {
      this.textIndex = 1;
      this.Interval = setInterval(() => {
        this.textIndex++;
        setTimeout(() => {
          this.scrollToBottom();
        }, 200);
        if (this.textIndex > num) {
          clearInterval(this.Interval);
          this.Interval = null;
        }
      }, 50);
    },
    // 删除消息
    removalMessage(item, index) {
      this.list.splice(index, 1);
      console.log(item, index);
    },
    // 刷新消息
    refreshMessage(item, index) {
      this.list[index].loadingCompleted = false;
      this.list[index].loading = true;
      this.list[index].content = '';
      this.list[index].type = '';
      this.list[index].videoUrl = '';
      this.loadData(this.list[index - 1].content, index);
      console.log(item, index);
    },
    /**
     * 将页面指定节点内容转为图片
     * 1.拿到想要转换为图片的内容节点DOM；
     * 2.转换，拿到转换后的canvas
     * 3.转换为图片
     */
    clickGeneratePicture() {
      const loading = this.$loading({
        lock: true,
        text: '正在生成图片',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      this.exportStatic = true;
      html2canvas(this.$refs.downloadDom, {
        allowTaint: true,
        // 允许渲染跨域图片
        scale: window.devicePixelRatio * 2,
        // 增加清晰度
        useCORS: true // 允许跨域
      }).then(canvas => {
        this.exportStatic = false;
        // 转成图片，生成图片地址
        let imgUrl = canvas.toDataURL('image/png');
        document.querySelector('#downimg').href = imgUrl;
        document.querySelector('#downimg').download = new Date().getTime() + '.png';
        document.querySelector('#downimg').click();
        loading.close();
      });
    }
  }
};

/* script */
const __vue_script__$2J = script$2J;
/* template */
var __vue_render__$2J = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-robot-content-pc",
      style: { pointerEvents: !_vm.robotShwo ? "none" : "none" },
      on: {
        click: function ($event) {
          if ($event.target !== $event.currentTarget) {
            return null
          }
          _vm.robotShwo = false;
        },
      },
    },
    [
      _c("transition", { attrs: { name: "Fade" } }, [
        _c(
          "div",
          {
            directives: [
              {
                name: "drag",
                rawName: "v-drag:{top:false,left:false,dragClass:null}",
                value: {
                  top: true,
                  left: true,
                  dragClass: "drag-box",
                },
                expression:
                  "{\n      top: true,\n      left: true,\n      dragClass: 'drag-box'\n    }",
                arg: "{top:false,left:false,dragClass:null}",
              },
              {
                name: "show",
                rawName: "v-show",
                value: _vm.robotShwo,
                expression: "robotShwo",
              },
            ],
            ref: "robotView",
            staticClass: "robot-view",
            style: {
              width: _vm.robotWidth + _vm.screenX + "px",
              top: "66px",
              left: _vm.left,
            },
          },
          [
            _c("div", { staticClass: "title-bar drag-box" }, [
              _c("div", { staticClass: "logo drag-box" }, [
                _c("span", { staticClass: "drag-box" }, [
                  _vm._v(_vm._s(_vm.name) + "AI"),
                ]),
              ]),
              _vm._v(" "),
              _c("i", {
                staticClass: "el-icon-close",
                on: { click: _vm.closeRobot },
              }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              {
                ref: "scrollDiv",
                staticClass: "content scroll",
                style: { height: _vm.robotHeight + _vm.screenY + "px" },
                attrs: { id: "robot-content-box" },
              },
              [
                _c("div", { staticClass: "xiaozhi-tips" }, [
                  _vm._v(
                    "\n          你好，我是你的学习助手“" +
                      _vm._s(_vm.name) +
                      "”\n          ，我可以为你解答此教材相关的内容，如章节摘要、段意总结、习题解析等，试试在下方输入问题吧\n        "
                  ),
                ]),
                _vm._v(" "),
                _vm._l(_vm.list, function (item, index) {
                  return _c("div", { key: item.id }, [
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value:
                              item.direction === "right" ||
                              item.id == "left_777",
                            expression:
                              "item.direction === 'right' || item.id == 'left_777'",
                          },
                        ],
                        staticClass: "timer",
                      },
                      [
                        _vm._v(
                          "\n            " + _vm._s(item.time) + "\n          "
                        ),
                      ]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: item.direction === "left",
                            expression: "item.direction === 'left'",
                          },
                        ],
                        staticClass: "item",
                        class: item.direction,
                        attrs: { id: "robot-content-" + index },
                      },
                      [
                        _c("div", { staticClass: "text" }, [
                          _c("div", {
                            domProps: { innerHTML: _vm._s(item.content) },
                          }),
                          _vm._v(" "),
                          _c(
                            "div",
                            {
                              directives: [
                                {
                                  name: "show",
                                  rawName: "v-show",
                                  value: item.videoUrl,
                                  expression: "item.videoUrl",
                                },
                              ],
                            },
                            [
                              _vm._v(
                                "\n                下面“" +
                                  _vm._s(_vm.name) +
                                  "”还为您推荐视频\n                "
                              ),
                              item.videoUrl
                                ? _c(
                                    "video",
                                    {
                                      staticStyle: { margin: "14px 0 0 0" },
                                      attrs: {
                                        width: "100%",
                                        controls: "",
                                        controlslist: "nodownload",
                                      },
                                    },
                                    [
                                      _c("source", {
                                        attrs: {
                                          src: item.videoUrl,
                                          type: "video/mp4",
                                        },
                                      }),
                                    ]
                                  )
                                : _vm._e(),
                            ]
                          ),
                          _vm._v(" "),
                          _c(
                            "div",
                            {
                              directives: [
                                {
                                  name: "show",
                                  rawName: "v-show",
                                  value: item.loading,
                                  expression: "item.loading",
                                },
                              ],
                              staticStyle: { "line-height": "24px" },
                            },
                            [_vm._v("正在生成. . .")]
                          ),
                          _vm._v(" "),
                          _c("span", {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: !item.loadingCompleted,
                                expression: "!item.loadingCompleted",
                              },
                            ],
                          }),
                        ]),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: item.loadingCompleted,
                                expression: "item.loadingCompleted",
                              },
                            ],
                            staticClass: "operating",
                          },
                          [
                            _c("div", {
                              staticClass: "delete",
                              on: {
                                click: function ($event) {
                                  return _vm.removalMessage(item, index)
                                },
                              },
                            }),
                            _vm._v(" "),
                            _c("div", {
                              directives: [
                                {
                                  name: "show",
                                  rawName: "v-show",
                                  value: item.id != "left_777",
                                  expression: "item.id != 'left_777'",
                                },
                              ],
                              staticClass: "refresh",
                              on: {
                                click: function ($event) {
                                  return _vm.refreshMessage(item, index)
                                },
                              },
                            }),
                          ]
                        ),
                      ]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: item.direction === "right",
                            expression: "item.direction === 'right'",
                          },
                        ],
                        staticClass: "item",
                        class: item.direction,
                      },
                      [
                        _c("div", { staticClass: "operating" }, [
                          _c("div", {
                            staticClass: "delete",
                            on: {
                              click: function ($event) {
                                return _vm.removalMessage(item, index)
                              },
                            },
                          }),
                        ]),
                        _vm._v(" "),
                        _c("div", { staticClass: "text" }, [
                          _c("div", {
                            domProps: { innerHTML: _vm._s(item.content) },
                          }),
                        ]),
                      ]
                    ),
                  ])
                }),
              ],
              2
            ),
            _vm._v(" "),
            _c(
              "div",
              {
                staticClass: "download-dom",
                style: {
                  width: _vm.robotWidth + _vm.screenX + "px",
                },
              },
              [
                _c(
                  "div",
                  { ref: "downloadDom", staticClass: "content" },
                  _vm._l(_vm.list, function (item) {
                    return _c("div", { key: item.id }, [
                      _c(
                        "div",
                        {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: item.direction === "left",
                              expression: "item.direction === 'left'",
                            },
                          ],
                          staticClass: "item",
                          class: item.direction,
                        },
                        [
                          _c("div", { staticClass: "text" }, [
                            _c("div", {
                              domProps: { innerHTML: _vm._s(item.content) },
                            }),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: item.videoUrl,
                                    expression: "item.videoUrl",
                                  },
                                ],
                              },
                              [
                                _vm._v(
                                  "\n                  下面“" +
                                    _vm._s(_vm.name) +
                                    "”还为您推荐视频\n                  "
                                ),
                                item.videoUrl
                                  ? _c(
                                      "video",
                                      {
                                        staticStyle: { margin: "14px 0 0 0" },
                                        attrs: {
                                          width: "100%",
                                          controls: "",
                                          controlslist: "nodownload",
                                        },
                                      },
                                      [
                                        _c("source", {
                                          attrs: {
                                            src: item.videoUrl,
                                            type: "video/mp4",
                                          },
                                        }),
                                      ]
                                    )
                                  : _vm._e(),
                              ]
                            ),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value: item.loading,
                                    expression: "item.loading",
                                  },
                                ],
                                staticStyle: { "line-height": "24px" },
                              },
                              [_vm._v("正在生成. . .")]
                            ),
                            _vm._v(" "),
                            _c("span", {
                              directives: [
                                {
                                  name: "show",
                                  rawName: "v-show",
                                  value: !item.loadingCompleted,
                                  expression: "!item.loadingCompleted",
                                },
                              ],
                            }),
                          ]),
                        ]
                      ),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: item.direction === "right",
                              expression: "item.direction === 'right'",
                            },
                          ],
                          staticClass: "item",
                          class: item.direction,
                        },
                        [
                          _c("div", { staticClass: "text" }, [
                            _c("div", {
                              domProps: { innerHTML: _vm._s(item.content) },
                            }),
                          ]),
                        ]
                      ),
                    ])
                  }),
                  0
                ),
              ]
            ),
            _vm._v(" "),
            _c("div", { staticClass: "input-box" }, [
              _c("div", { staticClass: "input-right" }, [
                _c("div", {
                  ref: "Input",
                  staticClass: "input-content",
                  attrs: {
                    contenteditable: "true",
                    placeholder: "请输入问题描述",
                  },
                  on: {
                    keydown: function ($event) {
                      return _vm.handlePushKeyword($event)
                    },
                  },
                }),
                _vm._v(" "),
                _c("div", {
                  staticClass: "sending",
                  on: {
                    click: function ($event) {
                      return _vm.sending(_vm.$refs.Input.innerText)
                    },
                  },
                }),
              ]),
            ]),
            _vm._v(" "),
            _c("div", {
              staticClass: "point point-right",
              on: {
                mousedown: function ($event) {
                  return _vm.mousedown($event, "X", "right")
                },
              },
            }),
            _vm._v(" "),
            _c("div", {
              staticClass: "point point-bottom",
              on: {
                mousedown: function ($event) {
                  return _vm.mousedown($event, "Y", "bottom")
                },
              },
            }),
          ]
        ),
      ]),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: !_vm.robotShwo,
              expression: "!robotShwo",
            },
            {
              name: "drag",
              rawName: "v-drag:{top:false,left:false}",
              value: { top: true, left: true },
              expression: "{ top: true, left: true }",
              arg: "{top:false,left:false}",
            },
          ],
          staticClass: "elfin-box",
          on: {
            mousedown: _vm.moveStart,
            click: function ($event) {
              $event.preventDefault();
              return _vm.elfinClick.apply(null, arguments)
            },
          },
        },
        [
          _c("transition", { attrs: { name: "Fade" } }, [
            _c(
              "div",
              {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: _vm.elfinStatic,
                    expression: "elfinStatic",
                  },
                ],
                staticClass: "dialog-box",
              },
              _vm._l(_vm.correct, function (item, index) {
                return _c(
                  "span",
                  {
                    key: index,
                    style: {
                      "animation-delay": 0.2 + index / _vm.correct.length + "s",
                    },
                  },
                  [_vm._v(_vm._s(item))]
                )
              }),
              0
            ),
          ]),
        ],
        1
      ),
      _vm._v(" "),
      _c("a", {
        staticStyle: { display: "none" },
        attrs: { id: "downimg", href: "" },
      }),
    ],
    1
  )
};
var __vue_staticRenderFns__$2J = [];
__vue_render__$2J._withStripped = true;

  /* style */
  const __vue_inject_styles__$2J = undefined;
  /* scoped */
  const __vue_scope_id__$2J = "data-v-91cd2a16";
  /* module identifier */
  const __vue_module_identifier__$2J = undefined;
  /* functional template */
  const __vue_is_functional_template__$2J = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2J = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2J, staticRenderFns: __vue_staticRenderFns__$2J },
    __vue_inject_styles__$2J,
    __vue_script__$2J,
    __vue_scope_id__$2J,
    __vue_is_functional_template__$2J,
    __vue_module_identifier__$2J,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2I = {
  mixins: [getRobotData],
  name: 'xmlGeneralRobotPhone',
  props: {
    bookName: {
      type: String,
      default: '建筑构造'
    },
    robotData: {
      type: Object,
      default: () => {}
    },
    textBookId: {
      type: String,
      default: ''
    },
    name: {
      type: String,
      default: '小新'
    },
    sysEnv: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      startTop: 0,
      startLeft: 0,
      top: 200,
      left: 0,
      width: 100,
      windowWidth: window.innerWidth,
      windowHeight: window.innerHeight,
      drag: false,
      show: false,
      question: '',
      //   list: [],
      minimize: true,
      //是否最小化
      click: false,
      exportStatic: false,
      conversationId: ''
    };
  },
  computed: {
    // 悬浮小智的宽度
    robotWidth() {
      this.windowWidth / 750 * Number(this.width);
      // return Math.floor(px)
      // 固定宽度
      return 60;
    },
    robotX() {
      this.windowWidth / 750 * Number(this.width);
      // return this.windowWidth - Math.floor(px)
      return this.windowWidth - 60;
    },
    scale() {
      let scale = this.windowWidth / 750;
      return scale;
    },
    list() {
      return this.answerData[this.elfinData.type];
    }
  },
  mounted() {
    this.left = this.robotX + this.robotWidth * 0.4;
    // this.createAConversation()
    this.initRobot();
    window.addEventListener('resize', this.handleResize);
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.handleResize); // 避免内存泄漏
  },
  methods: {
    handleResize() {
      console.log('变化');
      this.windowWidth = window.innerWidth;
      this.windowHeight = window.innerHeight;
      if (this.minimize) {
        this.left = this.robotX + this.robotWidth * 0.4;
        console.log(this.left, 'left');
      } else {
        this.left = this.robotX - 4;
      }
    },
    // 打开小智答疑窗口
    elfinClick() {
      // let timer = new Date().getTime()
      // if (timer - this.timer < 400) {
      //   // this.$message.warning("功能升级中..")
      //   // this.robotShwo = true
      //   if (this.answerData[this.elfinData.type].length === 0) {
      //     //创建一条欢迎语
      //     this.printer(18)
      //   }
      // }
    },
    moveStart() {
      this.timer = new Date().getTime();
    },
    // 发送消息
    sendingMsg(question) {
      if (question.replace(/\s+/g, '') != '') {
        let rightData = {
          id: 'right_' + new Date().getTime(),
          direction: 'right',
          content: question.replace(/\s+/g, ''),
          type: 'text',
          loading: false,
          time: this.getTime(),
          videoUrl: '',
          question: question.replace(/\s+/g, ''),
          loadingCompleted: true
        };
        this.list.push(rightData);
        // 发送消息是创建一条内为空的回答
        let leftData = {
          id: 'left_' + new Date().getTime(),
          direction: 'left',
          content: '',
          type: 'text',
          loading: true,
          time: this.getTime(),
          videoUrl: '',
          question: question.replace(/\s+/g, ''),
          loadingCompleted: false
        };
        this.list.push(leftData);
        // this.scrollPage()
        // 获取回答内容
        this.loadData(question.replace(/\s+/g, ''), this.list.length - 1);
        this.question = '';
        setTimeout(() => {
          this.scrollToBottom();
        }, 200);
      }
    },
    // 创建消息
    async createAConversation() {
      fetch(this.robotData.baseUrl, {
        method: 'post',
        headers: {
          'Content-Type': 'application/json;charset=utf-8',
          Authorization: 'Bearer ' + this.robotData.token
        },
        body: JSON.stringify({
          app_id: this.robotData.appId,
          client_id: this.robotData.client_id,
          client_secret: this.robotData.token,
          user_id: String(this.robotData.user_id)
        })
      }).then(response => response.json()).then(json => {
        this.conversationId = json.token.split('|')[0];
        this.tmpToken = json.token;
      });
    },
    // 获取小智答疑答案
    // async loadData(question, index) {
    // 暂时修改
    async loadData02(question, index) {
      this.$nextTick;
      new AbortController();
      try {
        fetch(this.robotData.conversationUrl, {
          method: 'post',
          headers: {
            'Content-Type': 'application/json',
            // Authorization: 'Bearer ' + this.robotData.token
            Authorization: 'Bearer ' + this.tmpToken
          },
          body: JSON.stringify({
            app_id: this.robotData.appId,
            query: question,
            // stream: true,
            conversation_id: this.conversationId,
            // signal: controller.signal,
            kb_id: 117,
            kb_type: 'book',
            message: question
          })
        }).then(response => response.json()).then(json => {
          // console.log(json, 'ajkjijjj')
          let list = json.data.conversation.completions || [];
          let content = '';
          list.map((item, index) => {
            content += item.content;
            this.list[this.list.length - 1].content = marked.parse(content).replace(`${question}`, '');
            this.list[this.list.length - 1].content = this.list[this.list.length - 1].content.replace(/##.*?\$\$/g, '');
            this.list[this.list.length - 1].loading = false;
            this.list[this.list.length - 1].loadingCompleted = true;
            this.list[this.list.length - 1].type = 'text';
            // setTimeout(() => {
            //   let itemDom = document.getElementById('robot-content-' + index)
            //   let Dom = this.$refs.scrollDiv
            //   Dom.scrollTop = itemDom.offsetTop + itemDom.offsetHeight - 500
            // }, 200)
          });
        });
        // const reader = response.body.getReader()
        // let data = ''
        // let videoUrl = ''
        // let content = ''
        // while (true) {
        //   const { done, value } = await reader.read()
        //   console.log('🚀 ~ loadData ~ done:', done)

        //   if (done) {
        //     this.list[index].loadingCompleted = true
        //     break
        //   }
        //   data = new TextDecoder().decode(value)
        //   if (data.indexOf('answer')) {
        //     let textList = data.split('"answer": "') || []
        //     if (textList.length > 1) {
        //       let text = textList[1].split('", "conversation_id')[0] || ''
        //       if (text.replace(/\s+/g, '') != '') {
        //         // this.list[index].content += text
        //         content += text.replace(/\\n/g,'<br/>')
        //         this.list[index].content =marked.parse(content)
        //       }
        //     }
        //   }

        //   this.list[index].loading = false

        //   this.list[index].type = 'text'

        //   setTimeout(() => {
        //     this.scrollToBottom()
        //   }, 200)
        // }
      } catch {
        this.list[index].loading = false;
        this.list[index].loadingCompleted = true;
        this.list[index].content = '亲，我的知识库里无法找到答案，请您修改问题重新提问。';
        this.list[index].type = 'text';
      }
    },
    // 滚动内容
    scrollToBottom() {
      let Dom = this.$refs.scrollDiv;
      Dom.scrollTop = Dom.scrollHeight;
    },
    // 删除消息
    removalMessage(item, index) {
      this.list.splice(index, 1);
    },
    // 刷新消息
    refreshMessage(item, index) {
      this.list[index].loadingCompleted = false;
      this.list[index].loading = true;
      this.list[index].content = '';
      this.list[index].type = '';
      this.list[index].videoUrl = '';
      this.loadData(item.question, index);
    },
    // 点击小智
    clickRobot() {
      if (this.minimize) {
        //    从最小化切换
        this.minimize = false;
        // this.width = 100
        this.width = 100;
        this.$nextTick(() => {
          this.left = this.robotX - 4;
          // this.left = this.robotX - 4
        });
      } else {
        this.show = true;
      }
    },
    clickGoRight() {
      // 关闭悬浮球
      this.minimize = true;
      this.width = 100;
      this.left = this.robotX + this.robotWidth * 0.4;
    },
    onTouchstart(e) {
      console.log('开始移动');
      this.drag = true;
      this.click = true;
      this.startTop = e.touches[0].radiusY;
      this.startLeft = e.touches[0].radiusX;
      setTimeout(() => {
        this.click = false;
      }, 200);
    },
    noTouchmove(e) {
      console.log();
      let top = e.changedTouches[0].clientY - this.startTop;
      let left = e.changedTouches[0].clientX - this.startLeft;
      if (left > -20 && top > -20 && left < this.robotX + 20 && top < this.windowHeight - 60) {
        this.top = e.changedTouches[0].clientY - this.startTop;
        this.left = e.changedTouches[0].clientX - this.startLeft;
      }
      // this.top = e.changedTouches[0].clientY - this.startTop
      // this.left = e.changedTouches[0].clientX - this.startLeft
      console.log('移动中', this.top, this.left);
    },
    // 手指松开
    onMouseup(e) {
      this.drag = false;
      if (!this.click) {
        let robotX = this.windowWidth - (e.changedTouches[0].clientX + (this.robotWidth - this.startLeft));
        if (robotX < -10) {
          this.minimize = true;
          this.width = 100;
        }
        this.$nextTick(() => {
          // 分辨是否处于缩小状态
          if (this.minimize) {
            this.left = this.robotX + this.robotWidth * 0.4;
          } else {
            this.left = this.robotX - 4;
          }
        });
      }
    },
    /**
     * 将页面指定节点内容转为图片
     * 1.拿到想要转换为图片的内容节点DOM；
     * 2.转换，拿到转换后的canvas
     * 3.转换为图片
     */
    clickGeneratePicture() {
      // const loading = this.$loading({
      //   lock: true,
      //   text: "正在生成图片",
      //   spinner: "el-icon-loading",
      //   background: "rgba(0, 0, 0, 0.7)",
      // });
      this.exportStatic = true;
      setTimeout(() => {
        html2canvas(this.$refs.downloadDom, {
          allowTaint: true,
          // 允许渲染跨域图片
          scale: window.devicePixelRatio * 2,
          // 增加清晰度
          useCORS: true // 允许跨域
        }).then(canvas => {
          this.exportStatic = false;
          // 转成图片，生成图片地址
          let imgUrl = canvas.toDataURL('image/png');
          console.log('🚀 ~ file: xmlRobot.vue:345 ~ clickGeneratePicture ~ imgUrl:', imgUrl);
          document.querySelector('#downimg').href = imgUrl;
          document.querySelector('#downimg').download = new Date().getTime() + '.png';
          document.querySelector('#downimg').click();
          // loading.close();
        });
      }, 1000);
    },
    // 获取当前时间
    getTime() {
      let date = new Date();
      let h = date.getHours();
      let m = date.getMinutes();
      return (h > 9 ? h : '0' + h) + ':' + (m > 9 ? m : '0' + m);
    }
  }
};

var __$_require_assets_images_icons_go_eft_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAOhJREFUOE9jZKAQMFKon4GgASzN5x3+1BoegFmEzsdrAGvz+VWM/xmv/6ozqAcZwNJ4toGBiVH3T61RMMxAnAaANTMwPPhVa1gG08zExGT6q9bQG9nbWA0AaWb4///l7zqjXJhmRmYmu981hk7oYYZhAFgzI8P73zWG6XDNTIzuv2uNLLEFOIoB2DUz+fyuNTTBFVtoBlxYzsD4/xOq7SQYALKFtfnCPAbG/7+JNQRHIJ6bxvCf4S9KIDJhdwnuaGw618vIyPgXORoZsRiCNyGxNZ1vZWBg/IOckNANoW1SJiajEXQBIUMA3x1wERnQPtIAAAAASUVORK5CYII=";

var __$_require_assets_images_icons_go_ight_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAPdJREFUOE+1k7FOwlAUhr+jvZ1dfQNHi4bNxEdwMXFywDDByEgTQnV0k8XJuGDwDZxMXJy4E6M7z0BbDimkLamQJt54ty+557u55/xHcDziWE8h8CJ7CamfhOcfmbTK+x4qBP69vVZlomgvCRuPVa4VZBdMZDvAEzCKw6BrItsGnnPeJfnVAz+yVwqvAl+LNL7zDs2JwIvALGMGzfm2aGcTzYM9JdUxIoosW/GB/JiUN5DjNffPvnPJ/ikM7JHxmKB6ISK3i37wboZ2hGgr50zyPwKnLzg10WmM/nB6oyLjIkgVrg3SJrqQhMFnGeWSawV/XSrnbVwB9GuaER7K2g4AAAAASUVORK5CYII=";

/* script */
const __vue_script__$2I = script$2I;
var __vue_render__$2I = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-robot-content-phone",
      class: _vm.show ? "pointer-events" : "",
    },
    [
      _c(
        "div",
        {
          staticClass: "levitated-sphere",
          class: {
            "min-robot": _vm.minimize,
            "drag-left": !_vm.drag,
          },
          style: {
            width: _vm.robotWidth + "px",
            top: _vm.top + "px",
            left: _vm.left + "px",
            height: "31px",
          },
          on: {
            touchstart: _vm.onTouchstart,
            touchmove: _vm.noTouchmove,
            touchend: _vm.onMouseup,
            click: _vm.clickRobot,
          },
        },
        [
          _vm.minimize
            ? _c("img", {
                staticStyle: { width: "20px", height: "20px" },
                attrs: {
                  src: __$_require_assets_images_icons_go_eft_png__,
                  alt: "",
                },
              })
            : _vm._e(),
          _vm._v(" "),
          _c(
            "div",
            {
              directives: [
                {
                  name: "show",
                  rawName: "v-show",
                  value: !_vm.minimize,
                  expression: "!minimize",
                },
              ],
              staticClass: "elfin-box",
            },
            [
              _vm._l(_vm.elfinList, function (item, index) {
                return _c("div", {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.robotData[item.type],
                      expression: "robotData[item.type]",
                    },
                  ],
                  key: index,
                  staticClass: "elfin-item",
                  class:
                    item.type +
                    (item.type == _vm.elfinData.type ? "-select" : ""),
                  attrs: { title: item.title },
                  on: {
                    click: function ($event) {
                      $event.stopPropagation();
                      return _vm.openRobot(item)
                    },
                  },
                })
              }),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "go-right",
                  on: {
                    click: function ($event) {
                      $event.stopPropagation();
                      return _vm.clickGoRight.apply(null, arguments)
                    },
                  },
                },
                [
                  _c("img", {
                    staticStyle: { width: "20px", height: "20px" },
                    attrs: {
                      src: __$_require_assets_images_icons_go_ight_png__,
                      alt: "",
                    },
                  }),
                ]
              ),
            ],
            2
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "van-popup",
        {
          attrs: { position: "bottom", round: "" },
          model: {
            value: _vm.show,
            callback: function ($$v) {
              _vm.show = $$v;
            },
            expression: "show",
          },
        },
        [
          _c("div", { staticClass: "xml-robot-content" }, [
            _c(
              "div",
              {
                staticClass: "navbar-box",
                style: {
                  width: 750 * _vm.scale + "px",
                  height: 80 * _vm.scale + "px",
                },
              },
              [
                _c("div", {
                  class: _vm.elfinData.type,
                  style: {
                    width: 60 * _vm.scale + "px",
                    height: 55 * _vm.scale + "px",
                    backgroundSize: "100%",
                  },
                }),
                _vm._v(" "),
                _c("span", { style: { fontSize: 34 * _vm.scale + "px" } }, [
                  _vm._v(_vm._s(_vm.elfinData.title)),
                ]),
              ]
            ),
            _vm._v(" "),
            _c(
              "div",
              {
                ref: "scrollDiv",
                staticClass: "robot-dialog-box",
                style: { height: "calc(80vh - " + 220 * _vm.scale + "px)" },
              },
              [
                _c(
                  "div",
                  {
                    staticClass: "xiaozhi-tips",
                    style: {
                      fontSize: 22 * _vm.scale + "px",
                      lineHeight: 48 * _vm.scale + "px",
                      padding: 26 * _vm.scale + "px",
                    },
                  },
                  [
                    _vm._v(
                      "\n          你好，我是你的学习助手“" +
                        _vm._s(_vm.elfinData.title) +
                        "”\n          ，我可以为你解答此教材相关的内容，如章节摘要、段意总结、习题解析等，试试在下方输入问题吧\n        "
                    ),
                  ]
                ),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    ref: "downloadDom",
                    staticClass: "robot-dialog-main",
                    style: { padding: "0 " + 32 * _vm.scale + "px" },
                  },
                  _vm._l(_vm.list, function (item, index) {
                    return _c(
                      "div",
                      {
                        key: index,
                        staticClass: "robot-item-box",
                        style: { paddingBottom: 56 * _vm.scale + "px" },
                      },
                      [
                        _c(
                          "div",
                          {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: item.direction === "right",
                                expression: "item.direction === 'right'",
                              },
                            ],
                            staticClass: "timer",
                            style: {
                              fontSize: 24 * _vm.scale + "px",
                              lineHeight: 30 * _vm.scale + "px",
                              paddingBottom: 34 * _vm.scale + "px",
                            },
                          },
                          [
                            _vm._v(
                              "\n              " +
                                _vm._s(item.time) +
                                "\n            "
                            ),
                          ]
                        ),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            staticClass: "item",
                            class: item.direction + "-item",
                          },
                          [
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value:
                                      item.direction === "right" &&
                                      !_vm.exportStatic,
                                    expression:
                                      "item.direction === 'right' && !exportStatic",
                                  },
                                ],
                                staticClass: "icon-box",
                                style: {
                                  width: 42 * _vm.scale + "px",
                                  paddingRight: 16 * _vm.scale + "px",
                                },
                              },
                              [
                                _c("div", {
                                  staticClass: "delete",
                                  style: {
                                    width: 26 * _vm.scale + "px",
                                    height: 30 * _vm.scale + "px",
                                    paddingRight: 16 * _vm.scale + "px",
                                  },
                                  on: {
                                    click: function ($event) {
                                      return _vm.removalMessage(item, index)
                                    },
                                  },
                                }),
                              ]
                            ),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                staticClass: "content-box",
                                class: item.direction,
                                style: {
                                  maxWidth:
                                    "calc(100% - " + 42 * _vm.scale + "px)",
                                  minHeight: 70 * _vm.scale + "px",
                                  padding:
                                    28 * _vm.scale +
                                    "px " +
                                    30 * _vm.scale +
                                    "px",
                                  fontSize: 28 * _vm.scale + "px",
                                  lineHeight: 34 * _vm.scale + "px",
                                },
                              },
                              [
                                _c("div", {
                                  domProps: {
                                    innerHTML: _vm._s(
                                      item.content
                                        ? item.content
                                        : "正在生成 . . ."
                                    ),
                                  },
                                }),
                                _vm._v(" "),
                                item.videoUrl
                                  ? _c("div", [
                                      _vm._v(
                                        "\n                  下面“" +
                                          _vm._s(_vm.name) +
                                          "”还为您推荐视频\n                  "
                                      ),
                                      _vm._v(" "),
                                      item.videoUrl
                                        ? _c(
                                            "video",
                                            {
                                              staticStyle: {
                                                margin: "14px 0 0 0",
                                              },
                                              attrs: {
                                                width: "100%",
                                                controls: "",
                                                controlslist: "nodownload",
                                              },
                                            },
                                            [
                                              _c("source", {
                                                attrs: {
                                                  src: item.videoUrl,
                                                  type: "video/mp4",
                                                },
                                              }),
                                            ]
                                          )
                                        : _vm._e(),
                                    ])
                                  : _vm._e(),
                                _vm._v(" "),
                                !item.loadingCompleted
                                  ? _c("div", {
                                      staticClass: "loading-box",
                                      style: {
                                        height: 12 * _vm.scale + "px",
                                        border:
                                          "0 0 " +
                                          16 * _vm.scale +
                                          "px " +
                                          16 * _vm.scale +
                                          "px",
                                      },
                                    })
                                  : _vm._e(),
                              ]
                            ),
                            _vm._v(" "),
                            _c(
                              "div",
                              {
                                directives: [
                                  {
                                    name: "show",
                                    rawName: "v-show",
                                    value:
                                      item.direction === "left" &&
                                      item.loadingCompleted &&
                                      !_vm.exportStatic,
                                    expression:
                                      "item.direction === 'left' && item.loadingCompleted && !exportStatic",
                                  },
                                ],
                                staticClass: "icon-box",
                                style: {
                                  width: 42 * _vm.scale + "px",
                                  paddingLeft: 16 * _vm.scale + "px",
                                },
                              },
                              [
                                _c("div", {
                                  staticClass: "delete",
                                  style: {
                                    width: 26 * _vm.scale + "px",
                                    height: 30 * _vm.scale + "px",
                                    paddingRight: 16 * _vm.scale + "px",
                                  },
                                  on: {
                                    click: function ($event) {
                                      return _vm.removalMessage(item, index)
                                    },
                                  },
                                }),
                                _vm._v(" "),
                                _c("div", {
                                  staticClass: "refresh",
                                  style: {
                                    width: 26 * _vm.scale + "px",
                                    height: 30 * _vm.scale + "px",
                                    marginTop: 14 * _vm.scale + "px",
                                  },
                                  on: {
                                    click: function ($event) {
                                      return _vm.refreshMessage(item, index)
                                    },
                                  },
                                }),
                              ]
                            ),
                          ]
                        ),
                      ]
                    )
                  }),
                  0
                ),
              ]
            ),
            _vm._v(" "),
            _c(
              "div",
              {
                staticClass: "bottom-box",
                style: {
                  bottom: 0,
                  height: 160 * _vm.scale + "px",
                  padding: 28 * _vm.scale + "px",
                },
              },
              [
                _c(
                  "div",
                  {
                    staticClass: "input-right",
                    style: {
                      width: 684 * _vm.scale + "px",
                      borderRadius: 10 * _vm.scale + "px",
                      padding:
                        4 * _vm.scale +
                        "px " +
                        20 * _vm.scale +
                        "px " +
                        4 * _vm.scale +
                        "px 0",
                    },
                  },
                  [
                    _c("textarea", {
                      directives: [
                        {
                          name: "model",
                          rawName: "v-model",
                          value: _vm.question,
                          expression: "question",
                        },
                      ],
                      ref: "Input",
                      staticClass: "input-content",
                      style: {
                        width: "calc(100% - " + 40 * _vm.scale + "px)",
                        maxHeight: 80 * _vm.scale + "px",
                        padding: 12 * _vm.scale + "px " + 20 * _vm.scale + "px",
                        fontSize: 28 * _vm.scale + "px",
                        borderRadius: 10 * _vm.scale + "px",
                      },
                      attrs: { placeholder: "请输入问题描述" },
                      domProps: { value: _vm.question },
                      on: {
                        input: function ($event) {
                          if ($event.target.composing) {
                            return
                          }
                          _vm.question = $event.target.value;
                        },
                      },
                    }),
                    _vm._v(" "),
                    _c("div", {
                      staticClass: "sending",
                      style: {
                        width: 24 * _vm.scale + "px",
                        height: 32 * _vm.scale + "px",
                      },
                      on: {
                        click: function ($event) {
                          return _vm.sending(_vm.question)
                        },
                      },
                    }),
                  ]
                ),
              ]
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2I = [];
__vue_render__$2I._withStripped = true;

  /* style */
  const __vue_inject_styles__$2I = undefined;
  /* scoped */
  const __vue_scope_id__$2I = "data-v-1a15dd20";
  /* module identifier */
  const __vue_module_identifier__$2I = undefined;
  /* functional template */
  const __vue_is_functional_template__$2I = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2I = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2I, staticRenderFns: __vue_staticRenderFns__$2I },
    __vue_inject_styles__$2I,
    __vue_script__$2I,
    __vue_scope_id__$2I,
    __vue_is_functional_template__$2I,
    __vue_module_identifier__$2I,
    false,
    undefined,
    undefined,
    undefined
  );

const ReaderComponents = [__vue_component__$2M, __vue_component__$2L, __vue_component__$2W, __vue_component__$2K, __vue_component__$2J, __vue_component__$30, __vue_component__$2I];
var XmlReader = {
  // install,
  ...ReaderComponents
};

//
var script$2H = {
  mixins: [singleGroupMixin],
  name: 'titleThirdLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
    console.log('此方法接收块儿点击事件，事件传递块相关参数=1111111=2=', this.groupData);
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    /**
     * 更新块数据
     * @param dataName  数据name
     * @param blockData 数据值
     */
    updateBlockData(dataName, blockData) {
      this.groupData[dataName] = blockData;
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2H = script$2H;
/* template */
var __vue_render__$2H = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-third-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-left" }, [
              _c(
                "span",
                { staticClass: "title-number" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.numberTextDataName],
                      "block-data-name": _vm.numberTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      "rule-index": _vm.ruleIndex,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2H = [];
__vue_render__$2H._withStripped = true;

  /* style */
  const __vue_inject_styles__$2H = undefined;
  /* scoped */
  const __vue_scope_id__$2H = "data-v-bad85026";
  /* module identifier */
  const __vue_module_identifier__$2H = undefined;
  /* functional template */
  const __vue_is_functional_template__$2H = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2H = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2H, staticRenderFns: __vue_staticRenderFns__$2H },
    __vue_inject_styles__$2H,
    __vue_script__$2H,
    __vue_scope_id__$2H,
    __vue_is_functional_template__$2H,
    __vue_module_identifier__$2H,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2G = {
  mixins: [singleGroupMixin],
  name: 'titleFirstLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
    console.log(this.groupData);
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2G = script$2G;
/* template */
var __vue_render__$2G = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-first-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2G = [];
__vue_render__$2G._withStripped = true;

  /* style */
  const __vue_inject_styles__$2G = undefined;
  /* scoped */
  const __vue_scope_id__$2G = "data-v-95101954";
  /* module identifier */
  const __vue_module_identifier__$2G = undefined;
  /* functional template */
  const __vue_is_functional_template__$2G = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2G = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2G, staticRenderFns: __vue_staticRenderFns__$2G },
    __vue_inject_styles__$2G,
    __vue_script__$2G,
    __vue_scope_id__$2G,
    __vue_is_functional_template__$2G,
    __vue_module_identifier__$2G,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2F = {
  mixins: [singleGroupMixin],
  name: 'titleSixthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2F = script$2F;
/* template */
var __vue_render__$2F = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-sixth-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-left-div" }, [
              _c(
                "div",
                { staticClass: "title-number" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.numberTextDataName],
                      "block-data-name": _vm.numberTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container-left",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "title-left-line" }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-right-div" },
              [
                _c("div", { staticClass: "title-right-line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "title-right-line2" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container-right",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
                _vm._v(" "),
                _c("div", { staticClass: "title-right-line3" }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2F = [];
__vue_render__$2F._withStripped = true;

  /* style */
  const __vue_inject_styles__$2F = undefined;
  /* scoped */
  const __vue_scope_id__$2F = "data-v-bcf30176";
  /* module identifier */
  const __vue_module_identifier__$2F = undefined;
  /* functional template */
  const __vue_is_functional_template__$2F = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2F = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2F, staticRenderFns: __vue_staticRenderFns__$2F },
    __vue_inject_styles__$2F,
    __vue_script__$2F,
    __vue_scope_id__$2F,
    __vue_is_functional_template__$2F,
    __vue_module_identifier__$2F,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2E = {
  mixins: [singleGroupMixin],
  name: 'titleSemicircleLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2E = script$2E;
/* template */
var __vue_render__$2E = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-semicircle-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2E = [];
__vue_render__$2E._withStripped = true;

  /* style */
  const __vue_inject_styles__$2E = undefined;
  /* scoped */
  const __vue_scope_id__$2E = "data-v-089ea77b";
  /* module identifier */
  const __vue_module_identifier__$2E = undefined;
  /* functional template */
  const __vue_is_functional_template__$2E = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2E = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2E, staticRenderFns: __vue_staticRenderFns__$2E },
    __vue_inject_styles__$2E,
    __vue_script__$2E,
    __vue_scope_id__$2E,
    __vue_is_functional_template__$2E,
    __vue_module_identifier__$2E,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2D = {
  mixins: [singleGroupMixin],
  name: 'titleRectangleLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2D = script$2D;
/* template */
var __vue_render__$2D = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-rectangle-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2D = [];
__vue_render__$2D._withStripped = true;

  /* style */
  const __vue_inject_styles__$2D = undefined;
  /* scoped */
  const __vue_scope_id__$2D = "data-v-1253777c";
  /* module identifier */
  const __vue_module_identifier__$2D = undefined;
  /* functional template */
  const __vue_is_functional_template__$2D = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2D = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2D, staticRenderFns: __vue_staticRenderFns__$2D },
    __vue_inject_styles__$2D,
    __vue_script__$2D,
    __vue_scope_id__$2D,
    __vue_is_functional_template__$2D,
    __vue_module_identifier__$2D,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2C = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2C = script$2C;
/* template */
var __vue_render__$2C = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme1-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    resourceBasisPath: _vm.resourceBasisPath,
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
                _vm._v(" "),
                _c("div", { staticClass: "jiantou1" }),
                _vm._v(" "),
                _c("div", { staticClass: "jiantou2" }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "zhuangshi" }, [
                _c("div", { staticClass: "line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line2" }),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2C = [];
__vue_render__$2C._withStripped = true;

  /* style */
  const __vue_inject_styles__$2C = undefined;
  /* scoped */
  const __vue_scope_id__$2C = "data-v-243927e8";
  /* module identifier */
  const __vue_module_identifier__$2C = undefined;
  /* functional template */
  const __vue_is_functional_template__$2C = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2C = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2C, staticRenderFns: __vue_staticRenderFns__$2C },
    __vue_inject_styles__$2C,
    __vue_script__$2C,
    __vue_scope_id__$2C,
    __vue_is_functional_template__$2C,
    __vue_module_identifier__$2C,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2B = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2B = script$2B;
/* template */
var __vue_render__$2B = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme2-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-icon" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2B = [];
__vue_render__$2B._withStripped = true;

  /* style */
  const __vue_inject_styles__$2B = undefined;
  /* scoped */
  const __vue_scope_id__$2B = "data-v-c5649e94";
  /* module identifier */
  const __vue_module_identifier__$2B = undefined;
  /* functional template */
  const __vue_is_functional_template__$2B = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2B = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2B, staticRenderFns: __vue_staticRenderFns__$2B },
    __vue_inject_styles__$2B,
    __vue_script__$2B,
    __vue_scope_id__$2B,
    __vue_is_functional_template__$2B,
    __vue_module_identifier__$2B,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2A = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme4LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2A = script$2A;
/* template */
var __vue_render__$2A = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme4-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2A = [];
__vue_render__$2A._withStripped = true;

  /* style */
  const __vue_inject_styles__$2A = undefined;
  /* scoped */
  const __vue_scope_id__$2A = "data-v-f1fc1c04";
  /* module identifier */
  const __vue_module_identifier__$2A = undefined;
  /* functional template */
  const __vue_is_functional_template__$2A = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2A = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2A, staticRenderFns: __vue_staticRenderFns__$2A },
    __vue_inject_styles__$2A,
    __vue_script__$2A,
    __vue_scope_id__$2A,
    __vue_is_functional_template__$2A,
    __vue_module_identifier__$2A,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2z = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme5LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2z = script$2z;
/* template */
var __vue_render__$2z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme5-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-img" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-img" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2z = [];
__vue_render__$2z._withStripped = true;

  /* style */
  const __vue_inject_styles__$2z = undefined;
  /* scoped */
  const __vue_scope_id__$2z = "data-v-0d6b5f56";
  /* module identifier */
  const __vue_module_identifier__$2z = undefined;
  /* functional template */
  const __vue_is_functional_template__$2z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2z, staticRenderFns: __vue_staticRenderFns__$2z },
    __vue_inject_styles__$2z,
    __vue_script__$2z,
    __vue_scope_id__$2z,
    __vue_is_functional_template__$2z,
    __vue_module_identifier__$2z,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2y = {
  mixins: [singleGroupMixin],
  name: 'titleYellowtheme6LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2y = script$2y;
/* template */
var __vue_render__$2y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Yellowtheme6-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "zhuangshi1" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "zhuangshi2" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2y = [];
__vue_render__$2y._withStripped = true;

  /* style */
  const __vue_inject_styles__$2y = undefined;
  /* scoped */
  const __vue_scope_id__$2y = "data-v-7850a580";
  /* module identifier */
  const __vue_module_identifier__$2y = undefined;
  /* functional template */
  const __vue_is_functional_template__$2y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2y, staticRenderFns: __vue_staticRenderFns__$2y },
    __vue_inject_styles__$2y,
    __vue_script__$2y,
    __vue_scope_id__$2y,
    __vue_is_functional_template__$2y,
    __vue_module_identifier__$2y,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2x = {
  mixins: [singleGroupMixin],
  name: 'titleFifteenLibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  isUnPrefix: true,
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2x = script$2x;
/* template */
var __vue_render__$2x = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-fifteen-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2x = [];
__vue_render__$2x._withStripped = true;

  /* style */
  const __vue_inject_styles__$2x = undefined;
  /* scoped */
  const __vue_scope_id__$2x = "data-v-51651688";
  /* module identifier */
  const __vue_module_identifier__$2x = undefined;
  /* functional template */
  const __vue_is_functional_template__$2x = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2x = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2x, staticRenderFns: __vue_staticRenderFns__$2x },
    __vue_inject_styles__$2x,
    __vue_script__$2x,
    __vue_scope_id__$2x,
    __vue_is_functional_template__$2x,
    __vue_module_identifier__$2x,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2w = {
  mixins: [singleGroupMixin],
  name: 'titleThirteenthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2w = script$2w;
/* template */
var __vue_render__$2w = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirteenth-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "topleft" }),
              _vm._v(" "),
              _c("div", { staticClass: "topborder" }, [
                _c("div", { staticClass: "topborder-left" }, [
                  _c("div", { staticClass: "Line1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "Line2" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "block" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "block" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "block" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "topborder-right" }, [
                  _c("div", { staticClass: "Line3" }),
                ]),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "bottomborder" }, [
                _c("div", { staticClass: "Line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "block" }),
                _vm._v(" "),
                _c("div", { staticClass: "block" }),
                _vm._v(" "),
                _c("div", { staticClass: "Line2" }),
                _vm._v(" "),
                _c("div", { staticClass: "Line3" }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "rightbottom" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2w = [];
__vue_render__$2w._withStripped = true;

  /* style */
  const __vue_inject_styles__$2w = undefined;
  /* scoped */
  const __vue_scope_id__$2w = "data-v-7295e742";
  /* module identifier */
  const __vue_module_identifier__$2w = undefined;
  /* functional template */
  const __vue_is_functional_template__$2w = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2w = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2w, staticRenderFns: __vue_staticRenderFns__$2w },
    __vue_inject_styles__$2w,
    __vue_script__$2w,
    __vue_scope_id__$2w,
    __vue_is_functional_template__$2w,
    __vue_module_identifier__$2w,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2v = {
  mixins: [singleGroupMixin],
  name: 'titleTwelfthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    /**
     * 更新块数据
     * @param dataName  数据name
     * @param blockData 数据值
     */
    updateBlockData(dataName, blockData) {
      this.groupData[dataName] = blockData;
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2v = script$2v;
/* template */
var __vue_render__$2v = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-twelfth-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-left" }, [
              _c(
                "span",
                { staticClass: "title-number" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.numberTextDataName],
                      "block-data-name": _vm.numberTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      "rule-index": _vm.ruleIndex,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2v = [];
__vue_render__$2v._withStripped = true;

  /* style */
  const __vue_inject_styles__$2v = undefined;
  /* scoped */
  const __vue_scope_id__$2v = "data-v-f540f03a";
  /* module identifier */
  const __vue_module_identifier__$2v = undefined;
  /* functional template */
  const __vue_is_functional_template__$2v = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2v = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2v, staticRenderFns: __vue_staticRenderFns__$2v },
    __vue_inject_styles__$2v,
    __vue_script__$2v,
    __vue_scope_id__$2v,
    __vue_is_functional_template__$2v,
    __vue_module_identifier__$2v,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2u = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2u = script$2u;
/* template */
var __vue_render__$2u = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme1-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "zhuangshi" }, [
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2u = [];
__vue_render__$2u._withStripped = true;

  /* style */
  const __vue_inject_styles__$2u = undefined;
  /* scoped */
  const __vue_scope_id__$2u = "data-v-7aaa1cba";
  /* module identifier */
  const __vue_module_identifier__$2u = undefined;
  /* functional template */
  const __vue_is_functional_template__$2u = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2u = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2u, staticRenderFns: __vue_staticRenderFns__$2u },
    __vue_inject_styles__$2u,
    __vue_script__$2u,
    __vue_scope_id__$2u,
    __vue_is_functional_template__$2u,
    __vue_module_identifier__$2u,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2t = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2t = script$2t;
/* template */
var __vue_render__$2t = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme2-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "top-zhuangshi" }, [
                _c("div", [
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                  _vm._v(" "),
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                ]),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "bottomzhuangshi" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2t = [];
__vue_render__$2t._withStripped = true;

  /* style */
  const __vue_inject_styles__$2t = undefined;
  /* scoped */
  const __vue_scope_id__$2t = "data-v-f37f936e";
  /* module identifier */
  const __vue_module_identifier__$2t = undefined;
  /* functional template */
  const __vue_is_functional_template__$2t = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2t = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2t, staticRenderFns: __vue_staticRenderFns__$2t },
    __vue_inject_styles__$2t,
    __vue_script__$2t,
    __vue_scope_id__$2t,
    __vue_is_functional_template__$2t,
    __vue_module_identifier__$2t,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2s = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme3LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2s = script$2s;
/* template */
var __vue_render__$2s = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme3-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
                _vm._v(" "),
                _c("div", { staticClass: "right-top-bg" }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2s = [];
__vue_render__$2s._withStripped = true;

  /* style */
  const __vue_inject_styles__$2s = undefined;
  /* scoped */
  const __vue_scope_id__$2s = "data-v-ffbbcdb6";
  /* module identifier */
  const __vue_module_identifier__$2s = undefined;
  /* functional template */
  const __vue_is_functional_template__$2s = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2s = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2s, staticRenderFns: __vue_staticRenderFns__$2s },
    __vue_inject_styles__$2s,
    __vue_script__$2s,
    __vue_scope_id__$2s,
    __vue_is_functional_template__$2s,
    __vue_module_identifier__$2s,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2r = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme4LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2r = script$2r;
/* template */
var __vue_render__$2r = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme4-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "cont-box" }, [
            _c("div", { staticClass: "title-container" }, [
              _c("div", { staticClass: "right-top-bg" }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2r = [];
__vue_render__$2r._withStripped = true;

  /* style */
  const __vue_inject_styles__$2r = undefined;
  /* scoped */
  const __vue_scope_id__$2r = "data-v-10cc2198";
  /* module identifier */
  const __vue_module_identifier__$2r = undefined;
  /* functional template */
  const __vue_is_functional_template__$2r = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2r = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2r, staticRenderFns: __vue_staticRenderFns__$2r },
    __vue_inject_styles__$2r,
    __vue_script__$2r,
    __vue_scope_id__$2r,
    __vue_is_functional_template__$2r,
    __vue_module_identifier__$2r,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2q = {
  mixins: [singleGroupMixin],
  name: 'titleGreentheme6LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2q = script$2q;
/* template */
var __vue_render__$2q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Greentheme6-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }, [
                _c("div", { staticClass: "line" }),
                _vm._v(" "),
                _c("div", { staticClass: "block1" }),
                _vm._v(" "),
                _c("div", { staticClass: "block1" }),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }, [
                _c("div", { staticClass: "block1" }),
                _vm._v(" "),
                _c("div", { staticClass: "block1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line" }),
              ]),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2q = [];
__vue_render__$2q._withStripped = true;

  /* style */
  const __vue_inject_styles__$2q = undefined;
  /* scoped */
  const __vue_scope_id__$2q = "data-v-0eb850e9";
  /* module identifier */
  const __vue_module_identifier__$2q = undefined;
  /* functional template */
  const __vue_is_functional_template__$2q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2q, staticRenderFns: __vue_staticRenderFns__$2q },
    __vue_inject_styles__$2q,
    __vue_script__$2q,
    __vue_scope_id__$2q,
    __vue_is_functional_template__$2q,
    __vue_module_identifier__$2q,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2p = {
  mixins: [singleGroupMixin],
  name: 'titleNineteenLibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2p = script$2p;
/* template */
var __vue_render__$2p = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-nineteen-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container-box" }, [
            _c(
              "div",
              { staticClass: "title-container" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2p = [];
__vue_render__$2p._withStripped = true;

  /* style */
  const __vue_inject_styles__$2p = undefined;
  /* scoped */
  const __vue_scope_id__$2p = "data-v-6165fa09";
  /* module identifier */
  const __vue_module_identifier__$2p = undefined;
  /* functional template */
  const __vue_is_functional_template__$2p = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2p = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2p, staticRenderFns: __vue_staticRenderFns__$2p },
    __vue_inject_styles__$2p,
    __vue_script__$2p,
    __vue_scope_id__$2p,
    __vue_is_functional_template__$2p,
    __vue_module_identifier__$2p,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2o = {
  mixins: [singleGroupMixin],
  name: 'titleHexagonLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2o = script$2o;
/* template */
var __vue_render__$2o = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-hexagon-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2o = [];
__vue_render__$2o._withStripped = true;

  /* style */
  const __vue_inject_styles__$2o = undefined;
  /* scoped */
  const __vue_scope_id__$2o = "data-v-6976253b";
  /* module identifier */
  const __vue_module_identifier__$2o = undefined;
  /* functional template */
  const __vue_is_functional_template__$2o = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2o = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2o, staticRenderFns: __vue_staticRenderFns__$2o },
    __vue_inject_styles__$2o,
    __vue_script__$2o,
    __vue_scope_id__$2o,
    __vue_is_functional_template__$2o,
    __vue_module_identifier__$2o,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2n = {
  mixins: [singleGroupMixin],
  name: 'titleFourteenLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2n = script$2n;
/* template */
var __vue_render__$2n = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-fourteen-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "cont-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2n = [];
__vue_render__$2n._withStripped = true;

  /* style */
  const __vue_inject_styles__$2n = undefined;
  /* scoped */
  const __vue_scope_id__$2n = "data-v-33b19230";
  /* module identifier */
  const __vue_module_identifier__$2n = undefined;
  /* functional template */
  const __vue_is_functional_template__$2n = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2n = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2n, staticRenderFns: __vue_staticRenderFns__$2n },
    __vue_inject_styles__$2n,
    __vue_script__$2n,
    __vue_scope_id__$2n,
    __vue_is_functional_template__$2n,
    __vue_module_identifier__$2n,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2m = {
  mixins: [singleGroupMixin],
  name: 'titleSeventeenLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2m = script$2m;
/* template */
var __vue_render__$2m = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-seventeen-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-image" },
              [
                _c("xml-image-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                    "block-data-name": _vm.imageBlockDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "show-title": false,
                    "container-class": "image-container",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                  },
                  on: { blockclick: _vm.handleBlockClick },
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("div", { staticClass: "zhuanshi" }, [
                  _c("div", { staticClass: "line1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "line2" }),
                ]),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2m = [];
__vue_render__$2m._withStripped = true;

  /* style */
  const __vue_inject_styles__$2m = undefined;
  /* scoped */
  const __vue_scope_id__$2m = "data-v-64cb37e2";
  /* module identifier */
  const __vue_module_identifier__$2m = undefined;
  /* functional template */
  const __vue_is_functional_template__$2m = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2m = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2m, staticRenderFns: __vue_staticRenderFns__$2m },
    __vue_inject_styles__$2m,
    __vue_script__$2m,
    __vue_scope_id__$2m,
    __vue_is_functional_template__$2m,
    __vue_module_identifier__$2m,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2l = {
  mixins: [singleGroupMixin],
  name: 'titleSixteenLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2l = script$2l;
/* template */
var __vue_render__$2l = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-sixteen-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "left-image" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "right-icon" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2l = [];
__vue_render__$2l._withStripped = true;

  /* style */
  const __vue_inject_styles__$2l = undefined;
  /* scoped */
  const __vue_scope_id__$2l = "data-v-31ad2ca0";
  /* module identifier */
  const __vue_module_identifier__$2l = undefined;
  /* functional template */
  const __vue_is_functional_template__$2l = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2l = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2l, staticRenderFns: __vue_staticRenderFns__$2l },
    __vue_inject_styles__$2l,
    __vue_script__$2l,
    __vue_scope_id__$2l,
    __vue_is_functional_template__$2l,
    __vue_module_identifier__$2l,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2k = {
  mixins: [singleGroupMixin],
  name: 'titleKnowledgeLibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      numberTextDataName: 'numberTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2k = script$2k;
/* template */
var __vue_render__$2k = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Knowledge-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "left-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.numberTextDataName],
                    "block-data-name": _vm.numberTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "rigth-titlebox" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2k = [];
__vue_render__$2k._withStripped = true;

  /* style */
  const __vue_inject_styles__$2k = undefined;
  /* scoped */
  const __vue_scope_id__$2k = "data-v-3e367eb6";
  /* module identifier */
  const __vue_module_identifier__$2k = undefined;
  /* functional template */
  const __vue_is_functional_template__$2k = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2k = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2k, staticRenderFns: __vue_staticRenderFns__$2k },
    __vue_inject_styles__$2k,
    __vue_script__$2k,
    __vue_scope_id__$2k,
    __vue_is_functional_template__$2k,
    __vue_module_identifier__$2k,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2j = {
  mixins: [singleGroupMixin],
  name: 'titleFifthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2j = script$2j;
/* template */
var __vue_render__$2j = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-fifth-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-bottom" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }, [
                _c("div"),
                _vm._v(" "),
                _c("div"),
              ]),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2j = [];
__vue_render__$2j._withStripped = true;

  /* style */
  const __vue_inject_styles__$2j = undefined;
  /* scoped */
  const __vue_scope_id__$2j = "data-v-a88b5610";
  /* module identifier */
  const __vue_module_identifier__$2j = undefined;
  /* functional template */
  const __vue_is_functional_template__$2j = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2j = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2j, staticRenderFns: __vue_staticRenderFns__$2j },
    __vue_inject_styles__$2j,
    __vue_script__$2j,
    __vue_scope_id__$2j,
    __vue_is_functional_template__$2j,
    __vue_module_identifier__$2j,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2i = {
  mixins: [singleGroupMixin],
  name: 'titleTriangleLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2i = script$2i;
/* template */
var __vue_render__$2i = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-triangle-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-left-img" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2i = [];
__vue_render__$2i._withStripped = true;

  /* style */
  const __vue_inject_styles__$2i = undefined;
  /* scoped */
  const __vue_scope_id__$2i = "data-v-793f6876";
  /* module identifier */
  const __vue_module_identifier__$2i = undefined;
  /* functional template */
  const __vue_is_functional_template__$2i = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2i = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2i, staticRenderFns: __vue_staticRenderFns__$2i },
    __vue_inject_styles__$2i,
    __vue_script__$2i,
    __vue_scope_id__$2i,
    __vue_is_functional_template__$2i,
    __vue_module_identifier__$2i,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2h = {
  mixins: [singleGroupMixin],
  name: 'titleRedtheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2h = script$2h;
/* template */
var __vue_render__$2h = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Redtheme1-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "title-bg" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2h = [];
__vue_render__$2h._withStripped = true;

  /* style */
  const __vue_inject_styles__$2h = undefined;
  /* scoped */
  const __vue_scope_id__$2h = "data-v-714917e1";
  /* module identifier */
  const __vue_module_identifier__$2h = undefined;
  /* functional template */
  const __vue_is_functional_template__$2h = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2h = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2h, staticRenderFns: __vue_staticRenderFns__$2h },
    __vue_inject_styles__$2h,
    __vue_script__$2h,
    __vue_scope_id__$2h,
    __vue_is_functional_template__$2h,
    __vue_module_identifier__$2h,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2g = {
  mixins: [singleGroupMixin],
  name: 'titleRedtheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2g = script$2g;
/* template */
var __vue_render__$2g = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Redtheme2-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2g = [];
__vue_render__$2g._withStripped = true;

  /* style */
  const __vue_inject_styles__$2g = undefined;
  /* scoped */
  const __vue_scope_id__$2g = "data-v-86aee6ca";
  /* module identifier */
  const __vue_module_identifier__$2g = undefined;
  /* functional template */
  const __vue_is_functional_template__$2g = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2g = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2g, staticRenderFns: __vue_staticRenderFns__$2g },
    __vue_inject_styles__$2g,
    __vue_script__$2g,
    __vue_scope_id__$2g,
    __vue_is_functional_template__$2g,
    __vue_module_identifier__$2g,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2f = {
  mixins: [singleGroupMixin],
  name: 'titleRedtheme3LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName1: 'titleTextData1',
      titleTextDataName2: 'titleTextData2',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2f = script$2f;
/* template */
var __vue_render__$2f = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Redtheme3-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "suptitle" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName1],
                  "block-data-name": _vm.titleTextDataName1,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                  "block-data-name": _vm.titleTextDataName2,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2f = [];
__vue_render__$2f._withStripped = true;

  /* style */
  const __vue_inject_styles__$2f = undefined;
  /* scoped */
  const __vue_scope_id__$2f = "data-v-2a57aa71";
  /* module identifier */
  const __vue_module_identifier__$2f = undefined;
  /* functional template */
  const __vue_is_functional_template__$2f = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2f = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2f, staticRenderFns: __vue_staticRenderFns__$2f },
    __vue_inject_styles__$2f,
    __vue_script__$2f,
    __vue_scope_id__$2f,
    __vue_is_functional_template__$2f,
    __vue_module_identifier__$2f,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2e = {
  mixins: [singleGroupMixin],
  name: 'titleRedtheme4LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$2e = script$2e;
/* template */
var __vue_render__$2e = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Redtheme4-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "left-icon" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "right-icon" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2e = [];
__vue_render__$2e._withStripped = true;

  /* style */
  const __vue_inject_styles__$2e = undefined;
  /* scoped */
  const __vue_scope_id__$2e = "data-v-2734a66e";
  /* module identifier */
  const __vue_module_identifier__$2e = undefined;
  /* functional template */
  const __vue_is_functional_template__$2e = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2e = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2e, staticRenderFns: __vue_staticRenderFns__$2e },
    __vue_inject_styles__$2e,
    __vue_script__$2e,
    __vue_scope_id__$2e,
    __vue_is_functional_template__$2e,
    __vue_module_identifier__$2e,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2d = {
  mixins: [singleGroupMixin],
  name: 'titleThirtyoneLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2d = script$2d;
/* template */
var __vue_render__$2d = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirtyone-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2d = [];
__vue_render__$2d._withStripped = true;

  /* style */
  const __vue_inject_styles__$2d = undefined;
  /* scoped */
  const __vue_scope_id__$2d = "data-v-f8b7f878";
  /* module identifier */
  const __vue_module_identifier__$2d = undefined;
  /* functional template */
  const __vue_is_functional_template__$2d = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2d = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2d, staticRenderFns: __vue_staticRenderFns__$2d },
    __vue_inject_styles__$2d,
    __vue_script__$2d,
    __vue_scope_id__$2d,
    __vue_is_functional_template__$2d,
    __vue_module_identifier__$2d,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2c = {
  mixins: [singleGroupMixin],
  name: 'titleThirtytwoLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2c = script$2c;
/* template */
var __vue_render__$2c = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirtytwo-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2c = [];
__vue_render__$2c._withStripped = true;

  /* style */
  const __vue_inject_styles__$2c = undefined;
  /* scoped */
  const __vue_scope_id__$2c = "data-v-80459744";
  /* module identifier */
  const __vue_module_identifier__$2c = undefined;
  /* functional template */
  const __vue_is_functional_template__$2c = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2c = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2c, staticRenderFns: __vue_staticRenderFns__$2c },
    __vue_inject_styles__$2c,
    __vue_script__$2c,
    __vue_scope_id__$2c,
    __vue_is_functional_template__$2c,
    __vue_module_identifier__$2c,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2b = {
  mixins: [singleGroupMixin],
  name: 'titleThirtythreeLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2b = script$2b;
/* template */
var __vue_render__$2b = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirtythree-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "main-con" }, [
            _c("div", { staticClass: "left-block" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-container" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2b = [];
__vue_render__$2b._withStripped = true;

  /* style */
  const __vue_inject_styles__$2b = undefined;
  /* scoped */
  const __vue_scope_id__$2b = "data-v-30c4d038";
  /* module identifier */
  const __vue_module_identifier__$2b = undefined;
  /* functional template */
  const __vue_is_functional_template__$2b = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2b = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2b, staticRenderFns: __vue_staticRenderFns__$2b },
    __vue_inject_styles__$2b,
    __vue_script__$2b,
    __vue_scope_id__$2b,
    __vue_is_functional_template__$2b,
    __vue_module_identifier__$2b,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$2a = {
  mixins: [singleGroupMixin],
  name: 'titleThirtyfourLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$2a = script$2a;
/* template */
var __vue_render__$2a = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirtyfour-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2a = [];
__vue_render__$2a._withStripped = true;

  /* style */
  const __vue_inject_styles__$2a = undefined;
  /* scoped */
  const __vue_scope_id__$2a = "data-v-11baadda";
  /* module identifier */
  const __vue_module_identifier__$2a = undefined;
  /* functional template */
  const __vue_is_functional_template__$2a = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2a = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2a, staticRenderFns: __vue_staticRenderFns__$2a },
    __vue_inject_styles__$2a,
    __vue_script__$2a,
    __vue_scope_id__$2a,
    __vue_is_functional_template__$2a,
    __vue_module_identifier__$2a,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$29 = {
  mixins: [singleGroupMixin],
  name: 'titleThirtyfiveLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$29 = script$29;
/* template */
var __vue_render__$29 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirtyfive-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c(
              "div",
              { staticClass: "suptitle-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", [
              _c(
                "div",
                { staticClass: "subtitle-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                      "block-data-name": _vm.titleTextDataName2,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$29 = [];
__vue_render__$29._withStripped = true;

  /* style */
  const __vue_inject_styles__$29 = undefined;
  /* scoped */
  const __vue_scope_id__$29 = "data-v-4f240486";
  /* module identifier */
  const __vue_module_identifier__$29 = undefined;
  /* functional template */
  const __vue_is_functional_template__$29 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$29 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$29, staticRenderFns: __vue_staticRenderFns__$29 },
    __vue_inject_styles__$29,
    __vue_script__$29,
    __vue_scope_id__$29,
    __vue_is_functional_template__$29,
    __vue_module_identifier__$29,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$28 = {
  mixins: [singleGroupMixin],
  name: 'titleThirtysixLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$28 = script$28;
/* template */
var __vue_render__$28 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirtysix-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "left-line" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "right-line" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$28 = [];
__vue_render__$28._withStripped = true;

  /* style */
  const __vue_inject_styles__$28 = undefined;
  /* scoped */
  const __vue_scope_id__$28 = "data-v-b2916eb2";
  /* module identifier */
  const __vue_module_identifier__$28 = undefined;
  /* functional template */
  const __vue_is_functional_template__$28 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$28 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$28, staticRenderFns: __vue_staticRenderFns__$28 },
    __vue_inject_styles__$28,
    __vue_script__$28,
    __vue_scope_id__$28,
    __vue_is_functional_template__$28,
    __vue_module_identifier__$28,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$27 = {
  mixins: [singleGroupMixin],
  name: 'titleThirtysevenLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$27 = script$27;
/* template */
var __vue_render__$27 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirtyseven-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("div", { staticClass: "left-line" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "right-line" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$27 = [];
__vue_render__$27._withStripped = true;

  /* style */
  const __vue_inject_styles__$27 = undefined;
  /* scoped */
  const __vue_scope_id__$27 = "data-v-b02f9330";
  /* module identifier */
  const __vue_module_identifier__$27 = undefined;
  /* functional template */
  const __vue_is_functional_template__$27 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$27 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$27, staticRenderFns: __vue_staticRenderFns__$27 },
    __vue_inject_styles__$27,
    __vue_script__$27,
    __vue_scope_id__$27,
    __vue_is_functional_template__$27,
    __vue_module_identifier__$27,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$26 = {
  mixins: [singleGroupMixin],
  name: 'titleThirtyeightLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$26 = script$26;
/* template */
var __vue_render__$26 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirtyeight-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "title-container" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$26 = [];
__vue_render__$26._withStripped = true;

  /* style */
  const __vue_inject_styles__$26 = undefined;
  /* scoped */
  const __vue_scope_id__$26 = "data-v-3627005b";
  /* module identifier */
  const __vue_module_identifier__$26 = undefined;
  /* functional template */
  const __vue_is_functional_template__$26 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$26 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$26, staticRenderFns: __vue_staticRenderFns__$26 },
    __vue_inject_styles__$26,
    __vue_script__$26,
    __vue_scope_id__$26,
    __vue_is_functional_template__$26,
    __vue_module_identifier__$26,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$25 = {
  mixins: [singleGroupMixin],
  name: 'titleThirtynineLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$25 = script$25;
/* template */
var __vue_render__$25 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-thirtynine-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "mask" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-number" },
              [
                _c("div", { staticClass: "line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line2" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.numberTextDataName],
                    "block-data-name": _vm.numberTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    "rule-index": _vm.ruleIndex,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "title-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$25 = [];
__vue_render__$25._withStripped = true;

  /* style */
  const __vue_inject_styles__$25 = undefined;
  /* scoped */
  const __vue_scope_id__$25 = "data-v-40db357e";
  /* module identifier */
  const __vue_module_identifier__$25 = undefined;
  /* functional template */
  const __vue_is_functional_template__$25 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$25 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$25, staticRenderFns: __vue_staticRenderFns__$25 },
    __vue_inject_styles__$25,
    __vue_script__$25,
    __vue_scope_id__$25,
    __vue_is_functional_template__$25,
    __vue_module_identifier__$25,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$24 = {
  mixins: [singleGroupMixin],
  name: 'titleBuleRectangleLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData1',
      titleTextDataName2: 'titleTextData2',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_style_title_ifting_achines_left_png__ = "data:image/png;base64,[encoded data, 8840 characters]";

var __$_require_style_title_bucket_right_png__ = "data:image/png;base64,[encoded data, 16096 characters]";

/* script */
const __vue_script__$24 = script$24;
var __vue_render__$24 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-BuleRectangle-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-image" }, [
              _c("img", {
                attrs: {
                  src: __$_require_style_title_ifting_achines_left_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-image" }, [
              _c("img", {
                attrs: {
                  src: __$_require_style_title_bucket_right_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "trapezoid-border" }, [
                _c("div", { staticClass: "rightTopround" }),
                _vm._v(" "),
                _c("div", { staticClass: "leftTopround" }),
                _vm._v(" "),
                _c("div", { staticClass: "trapezoid" }, [
                  _c(
                    "div",
                    { staticClass: "rigth-titlebox" },
                    [
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.titleTextDataName],
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                ]),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "rigth-titlebox-usb" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                        "block-data-name": _vm.titleTextDataName2,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c("div", { staticClass: "right-dot" }, [
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-rapezoid" }, [
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                ]),
              ]),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$24 = [];
__vue_render__$24._withStripped = true;

  /* style */
  const __vue_inject_styles__$24 = undefined;
  /* scoped */
  const __vue_scope_id__$24 = "data-v-1ef83723";
  /* module identifier */
  const __vue_module_identifier__$24 = undefined;
  /* functional template */
  const __vue_is_functional_template__$24 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$24 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$24, staticRenderFns: __vue_staticRenderFns__$24 },
    __vue_inject_styles__$24,
    __vue_script__$24,
    __vue_scope_id__$24,
    __vue_is_functional_template__$24,
    __vue_module_identifier__$24,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$23 = {
  mixins: [singleGroupMixin],
  name: 'titleBuleRectangleTwoLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$23 = script$23;
var __vue_render__$23 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-BuleRectangleTwo-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-image" }, [
              _c("img", {
                attrs: {
                  src: __$_require_style_title_ifting_achines_left_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "trapezoid-border" }, [
                _c("div", { staticClass: "right-image" }, [
                  _c("img", {
                    attrs: {
                      src: __$_require_style_title_bucket_right_png__,
                      alt: "",
                    },
                  }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "rightTopround" }),
                _vm._v(" "),
                _c("div", { staticClass: "leftTopround" }),
                _vm._v(" "),
                _c("div", { staticClass: "rapezoid" }, [
                  _c(
                    "div",
                    { staticClass: "rigth-titlebox" },
                    [
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.titleTextDataName],
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-dot" }, [
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-rapezoid" }, [
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "dot" }),
                ]),
              ]),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$23 = [];
__vue_render__$23._withStripped = true;

  /* style */
  const __vue_inject_styles__$23 = undefined;
  /* scoped */
  const __vue_scope_id__$23 = "data-v-7928436a";
  /* module identifier */
  const __vue_module_identifier__$23 = undefined;
  /* functional template */
  const __vue_is_functional_template__$23 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$23 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$23, staticRenderFns: __vue_staticRenderFns__$23 },
    __vue_inject_styles__$23,
    __vue_script__$23,
    __vue_scope_id__$23,
    __vue_is_functional_template__$23,
    __vue_module_identifier__$23,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$22 = {
  mixins: [singleGroupMixin],
  name: 'titleLoggingLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_style_title_text_left_png__ = "data:image/png;base64,[encoded data, 16916 characters]";

/* script */
const __vue_script__$22 = script$22;
var __vue_render__$22 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-titleLogging-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-image" }, [
              _c("img", {
                attrs: {
                  src: __$_require_style_title_text_left_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "zhuangshi" }, [
                _c("div", { staticClass: "line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line2" }),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$22 = [];
__vue_render__$22._withStripped = true;

  /* style */
  const __vue_inject_styles__$22 = undefined;
  /* scoped */
  const __vue_scope_id__$22 = "data-v-02d3d921";
  /* module identifier */
  const __vue_module_identifier__$22 = undefined;
  /* functional template */
  const __vue_is_functional_template__$22 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$22 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$22, staticRenderFns: __vue_staticRenderFns__$22 },
    __vue_inject_styles__$22,
    __vue_script__$22,
    __vue_scope_id__$22,
    __vue_is_functional_template__$22,
    __vue_module_identifier__$22,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$21 = {
  mixins: [singleGroupMixin],
  name: 'titleQuestionLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_style_title_question_left_png__ = "data:image/png;base64,[encoded data, 15164 characters]";

/* script */
const __vue_script__$21 = script$21;
var __vue_render__$21 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-titleQuestion-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-image" }, [
              _c("img", {
                attrs: {
                  src: __$_require_style_title_question_left_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "top-zhuangshi" }, [
                _c("div", [
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                  _vm._v(" "),
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                ]),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "bottomzhuangshi" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$21 = [];
__vue_render__$21._withStripped = true;

  /* style */
  const __vue_inject_styles__$21 = undefined;
  /* scoped */
  const __vue_scope_id__$21 = "data-v-07ca31fa";
  /* module identifier */
  const __vue_module_identifier__$21 = undefined;
  /* functional template */
  const __vue_is_functional_template__$21 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$21 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$21, staticRenderFns: __vue_staticRenderFns__$21 },
    __vue_inject_styles__$21,
    __vue_script__$21,
    __vue_scope_id__$21,
    __vue_is_functional_template__$21,
    __vue_module_identifier__$21,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$20 = {
  mixins: [singleGroupMixin],
  name: 'titleCraneLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_style_title_crane_eft_png__ = "data:image/png;base64,[encoded data, 15624 characters]";

/* script */
const __vue_script__$20 = script$20;
var __vue_render__$20 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-titleCrane-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-image" }, [
              _c("img", {
                attrs: {
                  src: __$_require_style_title_crane_eft_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "top-zhuangshi" }, [
                _c("div", [
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                  _vm._v(" "),
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                ]),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "bottomzhuangshi" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$20 = [];
__vue_render__$20._withStripped = true;

  /* style */
  const __vue_inject_styles__$20 = undefined;
  /* scoped */
  const __vue_scope_id__$20 = "data-v-505248ee";
  /* module identifier */
  const __vue_module_identifier__$20 = undefined;
  /* functional template */
  const __vue_is_functional_template__$20 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$20 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$20, staticRenderFns: __vue_staticRenderFns__$20 },
    __vue_inject_styles__$20,
    __vue_script__$20,
    __vue_scope_id__$20,
    __vue_is_functional_template__$20,
    __vue_module_identifier__$20,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1$ = {
  mixins: [singleGroupMixin],
  name: 'titleLightLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_style_title_light_left_png__ = "data:image/png;base64,[encoded data, 13812 characters]";

/* script */
const __vue_script__$1$ = script$1$;
var __vue_render__$1$ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-titleLight-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-image" }, [
              _c("img", {
                attrs: {
                  src: __$_require_style_title_light_left_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "top-zhuangshi" }, [
                _c("div", [
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                  _vm._v(" "),
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                ]),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "bottomzhuangshi" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1$ = [];
__vue_render__$1$._withStripped = true;

  /* style */
  const __vue_inject_styles__$1$ = undefined;
  /* scoped */
  const __vue_scope_id__$1$ = "data-v-535b940b";
  /* module identifier */
  const __vue_module_identifier__$1$ = undefined;
  /* functional template */
  const __vue_is_functional_template__$1$ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1$ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1$, staticRenderFns: __vue_staticRenderFns__$1$ },
    __vue_inject_styles__$1$,
    __vue_script__$1$,
    __vue_scope_id__$1$,
    __vue_is_functional_template__$1$,
    __vue_module_identifier__$1$,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1_ = {
  mixins: [singleGroupMixin],
  name: 'titleTearcherLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_style_title_tearcher_left_png__ = "data:image/png;base64,[encoded data, 14816 characters]";

/* script */
const __vue_script__$1_ = script$1_;
var __vue_render__$1_ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-titleTearcher-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-image" }, [
              _c("img", {
                attrs: {
                  src: __$_require_style_title_tearcher_left_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "top-zhuangshi" }, [
                _c("div", [
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                  _vm._v(" "),
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                ]),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "bottomzhuangshi" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1_ = [];
__vue_render__$1_._withStripped = true;

  /* style */
  const __vue_inject_styles__$1_ = undefined;
  /* scoped */
  const __vue_scope_id__$1_ = "data-v-2dcc08df";
  /* module identifier */
  const __vue_module_identifier__$1_ = undefined;
  /* functional template */
  const __vue_is_functional_template__$1_ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1_ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1_, staticRenderFns: __vue_staticRenderFns__$1_ },
    __vue_inject_styles__$1_,
    __vue_script__$1_,
    __vue_scope_id__$1_,
    __vue_is_functional_template__$1_,
    __vue_module_identifier__$1_,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1Z = {
  mixins: [singleGroupMixin],
  name: 'titleTextLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_style_title_logging_left_png__ = "data:image/png;base64,[encoded data, 19012 characters]";

/* script */
const __vue_script__$1Z = script$1Z;
var __vue_render__$1Z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-titleText-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-image" }, [
              _c("img", {
                attrs: {
                  src: __$_require_style_title_logging_left_png__,
                  alt: "",
                },
              }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "top-zhuangshi" }, [
                _c("div", [
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                  _vm._v(" "),
                  _c("div", [
                    _c("div", { staticClass: "top-jiantou" }),
                    _vm._v(" "),
                    _c("div", { staticClass: "bottom-jiantou" }),
                  ]),
                ]),
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "bottomzhuangshi" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1Z = [];
__vue_render__$1Z._withStripped = true;

  /* style */
  const __vue_inject_styles__$1Z = undefined;
  /* scoped */
  const __vue_scope_id__$1Z = "data-v-77bb917f";
  /* module identifier */
  const __vue_module_identifier__$1Z = undefined;
  /* functional template */
  const __vue_is_functional_template__$1Z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1Z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1Z, staticRenderFns: __vue_staticRenderFns__$1Z },
    __vue_inject_styles__$1Z,
    __vue_script__$1Z,
    __vue_scope_id__$1Z,
    __vue_is_functional_template__$1Z,
    __vue_module_identifier__$1Z,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1Y = {
  mixins: [singleGroupMixin],
  name: 'titleSevenpageoneLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData1',
      titleTextDataName2: 'titleTextData2',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1Y = script$1Y;
/* template */
var __vue_render__$1Y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Sevenpageone-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-bgimg" }, [
              _c(
                "div",
                { staticClass: "big-titlebox" },
                [
                  _c("div", { staticClass: "triangle_left" }),
                  _vm._v(" "),
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "triangle_right" }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "small-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                      "block-data-name": _vm.titleTextDataName2,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1Y = [];
__vue_render__$1Y._withStripped = true;

  /* style */
  const __vue_inject_styles__$1Y = undefined;
  /* scoped */
  const __vue_scope_id__$1Y = "data-v-4e87e799";
  /* module identifier */
  const __vue_module_identifier__$1Y = undefined;
  /* functional template */
  const __vue_is_functional_template__$1Y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1Y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1Y, staticRenderFns: __vue_staticRenderFns__$1Y },
    __vue_inject_styles__$1Y,
    __vue_script__$1Y,
    __vue_scope_id__$1Y,
    __vue_is_functional_template__$1Y,
    __vue_module_identifier__$1Y,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1X = {
  mixins: [singleGroupMixin],
  name: 'titleSevenpagetwoLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {},
      imgUrl: "title_icon_01.png"
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
    this.imgUrl = this.groupData.titleTextData.title_icon ? this.groupData.titleTextData.title_icon : "title_icon_01.png";
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_style_title_icon_01_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAA5CAYAAACfz8NxAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ppVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDkuMC1jMDAwIDc5LjE3MWMyN2ZhYiwgMjAyMi8wOC8xNi0yMjozNTo0MSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0iOEREMzIzRDRGRjEwMEMyRTZERDRDMjhCMkY3ODJFMEIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NDZFMzRDMEQxRTY3MTFFRjlCOTY4QTFDODY2QTMwMDgiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NDZFMzRDMEMxRTY3MTFFRjlCOTY4QTFDODY2QTMwMDgiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpkZDFiMjdkZS01OGQ4LTg1NGYtOGRhNy0yOWM0N2RjN2YzNzgiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDo5MjliNGNhMS03NDAxLWUyNGItYWMzMy02MTljNDM3OTlmZWYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4uvF5cAAAC6UlEQVR42uyaS2jUQBjHZ9NYX/hAKx56UXxUUPBkL4UKeorgpeDFg4iCOkV8QW2LFaEPbYsHD9JI8SDiA28qaE6+wQeIKJ5ERNRCQdRaaxUtRf+zmcVlSNZN2pnJ6Hzw/7JJ2DC/+Wbm+3ayORJlNHDhF0JTiFwbJr43NNGH5ITGr4LvgDZAlUSNXYS2AubnxCFosBH+EjSdqLerUANAxtND0GAp/DNoBtFnF6AtaUAcfmzTDMBsM3QWHVqRNhIf4ecVXb8HHYJGJDV4FnQ35t4ZaBsi8qt8CBrMxPGrcL0OD7kvrc9pMBe+1Kp0CmosF8SJWUa/KRxGryKu7YL6AJtLMid02jmoNQbkuCkQBMOmG/5IxJ0DiEa3GRAhSDt8T8Sd5r+BZAciBGkpAdJqBsQfkJMRd44CpMUMiND28GVWtGMAaTIDIswPjTEgvQCh+iF87zP8GD9bXgJkN6+pROsrBtEZiQf8uAkNWhcDMp4vCuNBtrMPrkYItgrV8zbcQINelqgU4orCfnzvkatx3F9HA1j13MmvLEvxFDaS6l3NE7gLILfwaSe0AppaxrdqoGlF55VuBlYiVi2XXzHT4Cn8ahPyRCJLFgkaMOg1kn+Hs6X1OSL0SQ4Ey5iEHFTQuYPosMUA+SGjFK9SNEJmJ+ngpJHYC90k8jfVHiMKo3IgfI/9Fj+ftYn9T6xOFsJCaEx2bB9opYLq9zUWkWFZSyzbkWhT0Lnv0GFLADImYzhVKxoh84VKdVIjsY8nO9nD6QmiMCIHwve+kHDb0a5OFsJC2GT3fya7t/k3uoYnuwUyk91+6CGR+7qYbRTckZns2Djtt6uThbAQFkIbhGNSmx3h/VnBGjLZfBqwkkd8GfO+8Feh2/BrhZsfoNGMRaA6IhKLCsnuRAREFVG3gZzWrmAkvXF4Jr4Mf9qw+TzAxpA4SXZAh6HvBgBcg2rR+YPsJBcxeebAr+fjryJjjR/KF6C+96L44m8BBgDkQbMRjBlYTAAAAABJRU5ErkJggg==";

var __$_require_style_title_icon_02_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADsAAAA9CAYAAAATfBGuAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ppVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDkuMC1jMDAwIDc5LjE3MWMyN2ZhYiwgMjAyMi8wOC8xNi0yMjozNTo0MSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0iOEREMzIzRDRGRjEwMEMyRTZERDRDMjhCMkY3ODJFMEIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6N0JEOTVBNjgxRTY3MTFFRkFBNzBERkFDMkNDNjg4NDYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6N0JEOTVBNjcxRTY3MTFFRkFBNzBERkFDMkNDNjg4NDYiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyN2EyNmJmNC0wOGQyLTliNDQtODc2Ny03Yzg2ZmMyNWNjY2YiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDo5MjliNGNhMS03NDAxLWUyNGItYWMzMy02MTljNDM3OTlmZWYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6j37FEAAAHR0lEQVR42tybC4hVRRjHZ2++y2f5wKQolcKMaCtXsyg1zJtpkBZWaJSSHstSIlx7aRmoGYYWe4WKpLKwFkPNjq6kxlKiWZRaUW5hpmmuD9x1i0zd/t8933Hnzp0597zuvWsffId7zjx/Z+ab+Wbm3BJRDLHsW3FdBq2BjhGp5HFDvGtxpbhXQ3tA20KPQfdCt0M/Q9oDfostKQJoGa6buOIk26DDzwJbNj1/BDoN2jtHbmegVdAFSL+5ecE6oFS5DkqIAyzEAOgb0EtD5L6SSgD0oeLDZoOuh/aHXsz3exgySp2oS98F4K+KB5sNugY6FnoJdLMEbJIT0H1srxdBL4eeZ4hbD70NwNsKD2sCTSVPcvhSXCdrUp7iQexd6JeIf0rK8wJcR0JnQMs0aWuhpUizr3CwuUHn4zpTk/I76H2I92OO/Kn+E6FLpAHPlY1IP6wwsOFBq6F3IN6JAGUNwnUD9Hwl5F7k85F7k8gTKM2L60KAkp2NCgRKkkpuwXW8JuTp/LasA7qRBxLBv5M+QYcbHQx/ZVemnZRMuR55fh1/y2aDbuKWckFnG0BJdkDrItZgrubZqPi7sR70ToD+xeHluM7xyGEStIIHnXCSStLA9rPydFC8sP5A5xm6Ltnav3w/JTKwEF8o933jg40GSjb6HjsYcQH/rtx3iQc2POgu6Iizg1EquVoDvChkrVqZAhIRQPvw3BYUlGQV4h1T7I2AH+CVDMl0HrmDSg/lvi4arGV3Yrjuyvzogs7wACV5hl+GOsCQAzBBAp4ZAvgm5b4masuSI95Lsb0GBrUMXZC67izpfp4BeHloYMvuh2sf5enWaLCp5DfsnSxWFt5WenDJlu+hQxGPKj1VAX4qRuByzbO18XtQZtBf0lsr8gokO+5UhKc0eZINvyM1ylzEe95Q/nBeI8uyG3oF0jTGOc/6B3VaLqW0cAXnoWvhidKT57Rd35kVVmjKX+CCxjXPBgPNBJ7mA3iZpuuXa6a/TkpKMrW341sIWPYk3jMKBpqZhzpFmbq0+lJpsKs07HTQYHkd8vkpHthsewoOGh2YBsaOSixyTEYj/bp4tmXMoLSfOzgQqBn4Ie7Cfs3GBR3LDkoMHpQZdD90WChQxzbnK/PwW1yWKuS1HdU8p2lqnAk0OKw3KHXdmkhjQCZwIl2WDGzZl7GNdtGATkD6lV7ZlzQbUHOXPsMOxucM2tsAujxXtiU+Cx+H6/KCgDaVSbsOz0pAB6E9w4L6g7Xs0TzEtywYaFPZ8z22cQKB5rZZM+hh6JC8gjryOk8vkUG9Yb1ByanfnVdMy+7FNtpREzolKKi5G1v2LTzEm0B3FghUd2SpdzhCwVo2uV7fSjsQ/wtQUzdeogF1vaO95ypodsta9gB5Ze+xI3g8D6BdeavnqnyA6lp2iibOizzNkNDLqELFOuYBdKMB9NE4QDNb1rLb4HoE2k4KJ9st5W5VLe3cbWP7bYgRtL8mdBa7kLFIC+l3qQLqzHPOSr+Gtz3cPWJq4TV41rR1WmhQy6ZecDeUyqd1Kx1YH/XbjQd4bVbxKDyUR2WRdiqE+ASFtitSi37MJvaKcI5EDyHP1dCBfmDV1f4RFHhQWZXEA2zZF8bQdfco9/SNBZ3YbUH+b+rqJMN2VcKOGZZh0YCdwe3TGGyUwG4W9DmCEAuhv0phE9NTmPNStQPUa7g+JoUdQME9PSqtO+cZiTR/5wCtMpjMC0g7J4L9J3gpuFCq0xZerJxUW/aIkrwbf5UiPFqYPtCok1p4BdK0CgG6IBKoU58zvI1TKnXxQWzXWd14p8YGBucoYIdwvkyrk7pWZRZwbtDy2ObsVJKOLEcI59spkif5EC4DlubRRiXpgz4y3+oJXEjQpjrRVPSSNL0+rsLWCunEi2UMn9iFBaa06wsKmunju/W5R4V9VUhH8izUOq19vk0dMNlOWRFABQ+Urp/Qg7pyQtpjekKTZCUS/RmgABVY50NX5B20SXZIv/u67uJsTUSaSsbzyyDfmA55fzB98SlJB4btoAlbqkxv+ZZa6XfrFgCh0/MrlUj0xYnj9zrbM3RC1obBCfZ9HtD281zdnUfu+6E3Ggpeyku1xgLCyuvyk9SybTWRPpRA1X2oG1iDSEW6RQsLKpQlY00JgFpzt2uluIo2j2ItIxR2WtAJfSr5sii0OFMf+fad2bXtlkBF/uFVgyyduUtGAaXuPrAooI5MZg53oG1MnHXAmzwOk9Dboa9Z6j3iUNgH7DqWoYDtRcG0bPpC3XU/yXQWqwuBIWlb1W+2UXe4Pe0eWnZLHtDIHtpz6x/mBfQuxDktiimWTbspG6RVVQp1mqrbcKNl3nRBHzc7WzB/sO0uyrUL0CzEssew5+Su1naxKTVkw5ozaS9y/8emGJJIr87okwJnML1GCtvN+2T7stezZtDuaWci+0y0Ocsq6MNqb2zhI2HPcwi0mv3utbpAv92Y/i7Wr5kC1vPgWA3I37wi/ifAAFRi7FmFO9i/AAAAAElFTkSuQmCC";

var __$_require_style_title_icon_03_png__ = "data:image/png;base64,[encoded data, 5136 characters]";

var __$_require_style_title_icon_04_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAAA1CAYAAAAXryboAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ppVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDkuMC1jMDAwIDc5LjE3MWMyN2ZhYiwgMjAyMi8wOC8xNi0yMjozNTo0MSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0iOEREMzIzRDRGRjEwMEMyRTZERDRDMjhCMkY3ODJFMEIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RUU5NEYzM0YxRTY3MTFFRkIyRDVCRTI4M0IzOTQyNzIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RUU5NEYzM0UxRTY3MTFFRkIyRDVCRTI4M0IzOTQyNzIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowOGQxM2FhOC05YmVjLTY4NDktYjNjMS1jNTY3OTQxMzA4OGIiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDo5MjliNGNhMS03NDAxLWUyNGItYWMzMy02MTljNDM3OTlmZWYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6OFFo0AAACnklEQVR42mJkwAcytwcBySggZmEYPuAJEDcwTPd8g0sBC54AMQWSaxmGJ1AHYldckkx4NDozDF/gCIx0dnIChWMYBwozEHOSEygjFpBSgF4EFk4GQ9KXmdsDgOR6YpWPppTRQBkNlNFAGQ2UQVT7DKbaRAPcVMfelnoAxKXAmvL3yAoUBoYaIA7HI38AiDeMtOzDQ0BeYCSXKV+A2BCKU0d2mYIAf4FlxwVoOSNALUNHa59Bn1Iyt4PGOYqBmA2L7B0gbgOmjH8jrUruAOIAPPJHgXj/SGu8CRKQ5x/JLdrnSLVK0WiLFgJ+IdUqCqN9nxFT+2Ru1wSSeQzYx0XPA1PFxJFYJfcDsTsOuXhgoJ0EBsyJkTZ0IEGh/LAuU14ygOZcILh2tEULAT+A2eQAtfsqo7XPoE8pkBGwZCBmxSJ7Cpgqlo3EKnkGENvjCbSzwIC5OdQChdLsQ6hckByKKYVaZcpdpFqlc7RFCwFfkGoVhaEeKKO1Dw1TCg8whThA2Rp41HEgqdOhgjoWJHUGgy1QlBmIGxETp7I6bgYajMRRmn2+EpB/jUYTUveOgLoPUPojAXVvBzKlZIOKViDGtn7sOLDwvQplFwBxLgP2aU7QYqCjUHYZA2TUjRuLuutAfBDKrgPizwzYJ8VuA/E2SjzFiKfh1QAk69EcP5xWMgkC/fOB0pTCPJg7cUSUPTTJPqBa4P1IqJJH2ykkBsqPYezvv0D8nZxA2QvE/4dpoOwHFrI/Sa99IKV2IJCMZhhhGxZGAc6UkrldFkjaMmCf7R8p4Bm4yJju+RfUoTIBcg4x4FnAP4LAJiD2BxW06aMBAgd+wESiNNpOwVElz8JXZ48wsBVYptyDFbTyQNKOAbI5aKQC0PDFTmCg/AEIMAB2YYxw08WmMgAAAABJRU5ErkJggg==";

/* script */
const __vue_script__$1X = script$1X;
var __vue_render__$1X = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Sevenpagetwo-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-box" }, [
              _c("div", { staticClass: "left-top" }, [
                _vm.imgUrl == "title_icon_01.png"
                  ? _c("img", {
                      attrs: {
                        src: __$_require_style_title_icon_01_png__,
                        alt: "",
                      },
                    })
                  : _vm.imgUrl == "title_icon_02.png"
                  ? _c("img", {
                      attrs: {
                        src: __$_require_style_title_icon_02_png__,
                        alt: "",
                      },
                    })
                  : _vm.imgUrl == "title_icon_03.png"
                  ? _c("img", {
                      attrs: {
                        src: __$_require_style_title_icon_03_png__,
                        alt: "",
                      },
                    })
                  : _vm.imgUrl == "title_icon_04.png"
                  ? _c("img", {
                      attrs: {
                        src: __$_require_style_title_icon_04_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "rigth-titlebox" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.titleTextDataName],
                        "block-data-name": _vm.titleTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "bottomzhuangshi" }),
              _vm._v(" "),
              _c("div", { staticClass: "left-tiao-bottom" }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-box" }, [
              _c("div", { staticClass: "xietiao" }),
              _vm._v(" "),
              _c("div", { staticClass: "right-top" }, [
                _c("div", { staticClass: "bottom-zhuangshi" }, [
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }, [
                    _vm._v("···················"),
                  ]),
                ]),
              ]),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1X = [];
__vue_render__$1X._withStripped = true;

  /* style */
  const __vue_inject_styles__$1X = undefined;
  /* scoped */
  const __vue_scope_id__$1X = "data-v-5153717d";
  /* module identifier */
  const __vue_module_identifier__$1X = undefined;
  /* functional template */
  const __vue_is_functional_template__$1X = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1X = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1X, staticRenderFns: __vue_staticRenderFns__$1X },
    __vue_inject_styles__$1X,
    __vue_script__$1X,
    __vue_scope_id__$1X,
    __vue_is_functional_template__$1X,
    __vue_module_identifier__$1X,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1W = {
  mixins: [singleGroupMixin],
  name: 'titleSevenpagethreeLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {},
      imgUrl: "title_icon_05.png"
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
    this.imgUrl = this.groupData.titleTextData.title_icon ? this.groupData.titleTextData.title_icon : "title_icon_05.png";
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

var __$_require_style_title_icon_05_png__ = "data:image/png;base64,[encoded data, 4200 characters]";

var __$_require_style_title_icon_06_png__ = "data:image/png;base64,[encoded data, 4940 characters]";

var __$_require_style_title_icon_07_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAABJCAYAAABl5pU9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ppVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDkuMC1jMDAwIDc5LjE3MWMyN2ZhYiwgMjAyMi8wOC8xNi0yMjozNTo0MSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0iOEREMzIzRDRGRjEwMEMyRTZERDRDMjhCMkY3ODJFMEIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0U0ODYxRjkxRTY4MTFFRjk5NUJCRTQ5NDM0Q0NGODkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0U0ODYxRjgxRTY4MTFFRjk5NUJCRTQ5NDM0Q0NGODkiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0OTY3M2NhZi1lYmNmLTA3NGUtYjVkNC0xMjg4NWJlMGQwYTgiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDo5MjliNGNhMS03NDAxLWUyNGItYWMzMy02MTljNDM3OTlmZWYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz72+xUNAAAFWUlEQVR42uyce2gcVRTG7242aUw0VWPro1ofVNrSguILKkhRbEBEqihUxAc+aPUfX6DofyqCgqIIvhCs0qr4RikFjbQqBt+P1mrVtqhVqdHG1NjUxE12x+9jv4HL7M66O+bO7mzmwI+2k83M/e7jnHPP3G3G8zwTo80AveAQ0AMmwRAYBn+CYlwNycUoeh44D5wDjgcdEjoCPgavgXfAX3E0JhPDiM8B14GrNdKVOpuNmACbwb1gPfjHaaso3CEng4+8chsHe8EomAz8LA8eBL0u2+ZyxE8Ba8BC69ov4HPwIdgJOsFisER/7m99djW4WUshMSN+JPggMIovgdNDPt8OVoFvA6N/K8i6aKML0WzoXVbjJ8BDoLOG3z0NbLJ+dwiclBThHO3f1fACWK0RrccvbLPEP+5CeL3h7HAr/obZhWCW/r5bHprevKvGZ/wE3lXIo50P1oJdIFslLP8M/p7qcJZTA26SgELY/cBRlvBRsF2hqq3GNuXBEWCu7kf7poqojDpkK7gTbJtK4QeAl0GfaW67BjxZb+bGkWyvkDayZ2aDmab57TAtxaI1W3xrU2j0/BGnqBsVS02IcMbbReBATfMXwDrl3pkGiZzQklpp5Qo7wI8hvoCDvA88BV6hh7tfIadW42dXyjtmGsxs8KZXnzHiLGMvnBths9JpzYZGWluEtnOWLOGU6I7wwEKTrOlCxM7vyUX8Rc/q8UaKjupfvLBp8jbYImGewlmfEhjOkuXgoAY6Nz5zTJFmnnX9ffCZ2ljUpqdPW+OyTcrOCg5gRSDF6wYDXvPbDYF27xfi/O4LSwE7KvTw7gTE8aHADOwKS3NzVbylbUwX7wG/aYpPNpFYP2XlFH8r4LOy9QoPWlF1sS8VBYpNONp7XBYbx0XiLWumqaXCU+Gp8FR4mM1RiSiRFuXdGfP2y8AF2ig8B16sEObalTm5iPkZ3Xc0LuGcIReDR6xrS03pTec6K2taAG5RJ7kUPgCeVmXFqfCZKlwEixJng36NOvP8y8FVMczYZab0onHA9RrPm8pl3lFrZDn9B2NaqnzO3jim+j5NraWWY2M9+1V1ii/8GVN6z83a+ISjkhM3Su+Br+NybhtM6W3JGRrl/goPH1YHdRh3dbmi+R8lsCjC+TC+5v1Uogr/sTRaJpz5NmkSbGnmlgqvL4lIrEVd46eaUtmWjo3vv7dMB+FngUfBfP17BbgSbArk8zzT1uswZWVEYR3wkziEd0vkfOvaieAiJTJ53fNSdY5rY2X1iihJTL1rfIZGM2g91r04GsfGNGN5XGRWHCM+okxtuXWNG5ONVrLC+M530IeCYxylrFk9Z71G3blwOrM1SkUv0cOfAG9Ya5lrj2dWrjfuavD+tnQ4asdGcW7ciT2sjYiflxdDZseIaVKLGs7849Zp5pYKT4W3ZsrKuH2CvPxmE6HYl0Thx5nS0Uk/V38d3GFK785tY8cc7Dic8fjmYBzCmbmtUkrq27VKGR9TR2TVKQ8oq3IlvKBk6jbwq2vhTFcXVbi+WEnNmO7JL9wsjGHGco+wNg7hrJx+Z8pr61sDKSszuTNN6diIizNx/hGPfmWJzqc6xfEtylz1No2nhZ+3BPqV1x0SXjRTX2n1c3Webf8jLuf2vSkdnL1bgn4w5UV9dsL2Vgxne0ydh23SBCYVngpPhafCGyg8M12Fj7eIvnxY5pirsu3s0s+TOvoU3GvKj6BXFX67KX3RPck+gFllu7bRNQs/WrT0Gm95RxYmfNc01D3Iqc7/kmCBnFnGNP5LdK4so63sF9w2UziPZI6pcJAzzfm1i6kwOjrW554FX/0rwABTF+N7BLI4ZAAAAABJRU5ErkJggg==";

var __$_require_style_title_icon_08_png__ = "data:image/png;base64,[encoded data, 4692 characters]";

var __$_require_style_title_icon_09_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA7CAYAAAAn+enKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ppVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDkuMC1jMDAwIDc5LjE3MWMyN2ZhYiwgMjAyMi8wOC8xNi0yMjozNTo0MSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0iOEREMzIzRDRGRjEwMEMyRTZERDRDMjhCMkY3ODJFMEIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzA3QUMyNzgxRTZBMTFFRjg3OThCOEI0OTc0MjkzQzMiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzA3QUMyNzcxRTZBMTFFRjg3OThCOEI0OTc0MjkzQzMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDphNjkzMzAzYS1mZmRkLTAxNGItYWZjMy05OTgxOWQ3NDBmZjkiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDo5MjliNGNhMS03NDAxLWUyNGItYWMzMy02MTljNDM3OTlmZWYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz59y/r3AAAF2UlEQVR42tSbW2wVRRjHT4/FiCQaQNQqFYtUsdLSgm2tVkEQAW8RSVQMlvZFTDSoGH3RF0wMMUHfTXzyEgLGS9TYUK3a2psVlErV2FagrdAqUERAJUqP/0m+k0wm8307s+fsnuMkvzTpzmX/5z+3/Xa2IJVKJfIszQLVoBzMBpNgBPSB3eD3jGpXgvOEc8Fm8F2KT7vBI6AgbDv5IrYI7Eq5p7fBzDBtFeRBl54DdoIaz3KtYB044lMo14LVGH2XxmyY9Dm4Hxz9PwguBdvBYsu1k+A10A7OA7eBBjDFkreNnB7L50mrBOxlxucQqLWUuR38xpT5ElySr5NWqSD2Z3CdUPZmMC6ILso3wSUBYisd6lCiDwuiL80XwZKzfeBaj7puAL8wdbVLTsfpbB9zg5Pg3hB11gqiOzin4xBbBvoDNhJqdzU/RN2S012gOG7BV4MfHXdP33t2a130IabOXjA7LsFlgth/mf8PgoosO90JZkUtWHL2W3AX+FoQXR6izRpB9OtRClbr6A/CWL2K8qm/e4TNRxinq8EBS31nwYooBM8XxO4j5/X8l4ODTP6BkE4vYpx+AxRmU2wlORPkrM5acFSYyFR9C0PcyxpyVU/D6gfOZjfmxPbTpsMssw6ccpi9h8g1n/s5n5kjyuNwdp6lzAPgtLF8rKCIhi0pd673uKckBQnMVJeNpWdIGLOljNhTxrZyLl2bK2w/1WS02PG+poIeSx1VUTmrnLqS6ca6s99Y8hUzN5t2utrh3u4E/xhlx1TdYcVWCGL3MGIbwV+GsyVM/cXCkhXk9AJm5t8BpiRCLvDDzM2oiWKOpcwG8LeW7ysmnym6m2nnIBMkqGTW4Una7Hivw1VgRHDWJqLJENtr29QzzKSHAFtS++ebDGf3M3m3h9lp1QhiOWcbDbHdtNlwbfMaYSOTokBADU2enNhu/VHRx9lhzzG7IQNnE/TkNOCwTg8LYntNI1z3pyPCbOzibI+nswsMsWo31gBaPIL11nki025sc3YjOGM8nhV7ru2DhtiVdO1i8IWDWHVvV/hGPOqFCGGH+WBNPGqsf210kz5DR++eE+AOy7axy9fZIMG1QhShi+meGw2xgRFEy9quLynqx15uyVdO0REvZyXBQc5eFpGz+mZBBdxv9XzI73FY2xM2Zw97OmuKbfd0dqHF2aXMc+5ImG7MCa6n/SbnLCdWj0+1ejq7yHD2CFjm6WybzwrgIpbbLGwynP1UD5Y5LnfDGTrbyQwxUfA8YYLqZMQ+RfvTdFIvs2d4BtEPOYitD3DWS2xa8HohpmR7y/6kET75JISzo1p5JajOkq9OmE86wohNC25iKj1J5ylMsbqzLZ5HD8yguRJ0I+Psr9l0VhfcKCziysnHKfMThrPN4KIM4saj9APYnB0ThlhRKoMoTZBglf4E7xsP7x+ACz0ausVwbExwdjwKZ30Emw/SSux0j0bMFWCUGbNLBGc/y9TZsIJVFHJaBs6OMDEptas6xrTpOymGEjzBNH6CNhuuzo4bsagqS76lwtmN1myKlQS/BF4QuvWmgIqXWJy1Bd6WCW8edmVbrCR4C2V4RXjd+RhT6XJD7AHmzUGszgYJ3qpl2iaM6WcsR4smHJxdJQyblqjEugpOCk6r7v000z0HmVM5KwWxrVGKdRWc5mVB9KvGDmo/8353NU18ttQctVhfwecITuvpJwrC2brxMUHs9KjFKpIeZyPPgs1gm5DnD7AW9Bv/Xw12gBmWMh+Bh8DxOA54JkOUeRZsZa4Vkjg93Q3eAhdY8jfTodHjsR1p9ejSJi8K3fp5ynOP8NL7w7i6sU4h8zuccfitnqPvD7aAqcY19b8ysApMY5x9OOPvF0IkTnAFuC+grPr4YgDss5xmT9IZ5gQzZhtyIVYSvIbIdvo4V87qTiRjausd8GAuxaYFn4ihnfdAEx3tT+RacAfYG2EbO2nM5lys/pFHMVhPX5lk46uPAqpHTWhvgtP58tnbfwIMAPV4SXCgNE/BAAAAAElFTkSuQmCC";

/* script */
const __vue_script__$1W = script$1W;
var __vue_render__$1W = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Sevenpagethree-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "bottomzhuangshi" }),
            _vm._v(" "),
            _c("div", { staticClass: "left-box" }, [
              _c("div", { staticClass: "toptiao" }),
              _vm._v(" "),
              _c("div", { staticClass: "tixing-bg" }),
              _vm._v(" "),
              _c("div", { staticClass: "left-content" }, [
                _vm.imgUrl == "title_icon_05.png"
                  ? _c("img", {
                      attrs: {
                        src: __$_require_style_title_icon_05_png__,
                        alt: "",
                      },
                    })
                  : _vm.imgUrl == "title_icon_06.png"
                  ? _c("img", {
                      attrs: {
                        src: __$_require_style_title_icon_06_png__,
                        alt: "",
                      },
                    })
                  : _vm.imgUrl == "title_icon_07.png"
                  ? _c("img", {
                      attrs: {
                        src: __$_require_style_title_icon_07_png__,
                        alt: "",
                      },
                    })
                  : _vm.imgUrl == "title_icon_08.png"
                  ? _c("img", {
                      attrs: {
                        src: __$_require_style_title_icon_08_png__,
                        alt: "",
                      },
                    })
                  : _vm.imgUrl == "title_icon_09.png"
                  ? _c("img", {
                      attrs: {
                        src: __$_require_style_title_icon_09_png__,
                        alt: "",
                      },
                    })
                  : _vm._e(),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "rigth-titlebox" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.titleTextDataName],
                        "block-data-name": _vm.titleTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "right-xietiao" }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-box" }, [
              _c("div", { staticClass: "right-bottom" }, [
                _c("div", { staticClass: "bottom-zhuangshi" }, [
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cuxietiao" }),
                ]),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "circle" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1W = [];
__vue_render__$1W._withStripped = true;

  /* style */
  const __vue_inject_styles__$1W = undefined;
  /* scoped */
  const __vue_scope_id__$1W = "data-v-ad5c1f5e";
  /* module identifier */
  const __vue_module_identifier__$1W = undefined;
  /* functional template */
  const __vue_is_functional_template__$1W = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1W = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1W, staticRenderFns: __vue_staticRenderFns__$1W },
    __vue_inject_styles__$1W,
    __vue_script__$1W,
    __vue_scope_id__$1W,
    __vue_is_functional_template__$1W,
    __vue_module_identifier__$1W,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1V = {
  mixins: [singleGroupMixin],
  name: 'titleSevenpagefourLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData1',
      titleTextDataName2: 'titleTextData2',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1V = script$1V;
/* template */
var __vue_render__$1V = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Sevenpagefour-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-box" }, [
              _c("div", { staticClass: "title-top" }, [
                _c(
                  "div",
                  { staticClass: "rigth-titlebox" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.titleTextDataName],
                        "block-data-name": _vm.titleTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c("div", { staticClass: "shutiao" }),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "rigth-titlebox" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                        "block-data-name": _vm.titleTextDataName2,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "title-bottom" }, [
                _c("div", { staticClass: "title-bottom-bg0" }),
                _vm._v(" "),
                _c("div", { staticClass: "left-xian" }, [
                  _c("div", { staticClass: "title-bottom-bg1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "title-bottom-bg2" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "title-bottom-bg3" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-xian" }, [
                  _c("div", { staticClass: "top-xian" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "right-xiexian" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "circle" }),
              ]),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1V = [];
__vue_render__$1V._withStripped = true;

  /* style */
  const __vue_inject_styles__$1V = undefined;
  /* scoped */
  const __vue_scope_id__$1V = "data-v-1cea4dcc";
  /* module identifier */
  const __vue_module_identifier__$1V = undefined;
  /* functional template */
  const __vue_is_functional_template__$1V = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1V = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1V, staticRenderFns: __vue_staticRenderFns__$1V },
    __vue_inject_styles__$1V,
    __vue_script__$1V,
    __vue_scope_id__$1V,
    __vue_is_functional_template__$1V,
    __vue_module_identifier__$1V,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1U = {
  mixins: [singleGroupMixin],
  name: 'titleSevenpagefiveLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData1',
      titleTextDataName2: 'titleTextData2',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1U = script$1U;
/* template */
var __vue_render__$1U = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Sevenpagefive-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-box" }, [
              _c("div", { staticClass: "title-bg" }),
              _vm._v(" "),
              _c("div", { staticClass: "title-content" }, [
                _c(
                  "div",
                  { staticClass: "small-titlebox" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.titleTextDataName],
                        "block-data-name": _vm.titleTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "big-titlebox" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                        "block-data-name": _vm.titleTextDataName2,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "right-jiao" }),
              _vm._v(" "),
              _c("div", { staticClass: "title-border" }, [
                _c("div", { staticClass: "border-top" }, [
                  _c("div", { staticClass: "border-left" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "border-right" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "xie-cutiao" }, [
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "xie-cutiao-item" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "sanjiao" }),
                _vm._v(" "),
                _c("div", { staticClass: "circle" }),
                _vm._v(" "),
                _c("div", { staticClass: "border-bottom" }, [
                  _c("div", { staticClass: "left-xiexian" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "cutiao" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "right-xiexian" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "point" }, [
                  _vm._v("· · · · · · · · · · · · · ·"),
                ]),
              ]),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1U = [];
__vue_render__$1U._withStripped = true;

  /* style */
  const __vue_inject_styles__$1U = undefined;
  /* scoped */
  const __vue_scope_id__$1U = "data-v-2d72bd44";
  /* module identifier */
  const __vue_module_identifier__$1U = undefined;
  /* functional template */
  const __vue_is_functional_template__$1U = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1U = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1U, staticRenderFns: __vue_staticRenderFns__$1U },
    __vue_inject_styles__$1U,
    __vue_script__$1U,
    __vue_scope_id__$1U,
    __vue_is_functional_template__$1U,
    __vue_module_identifier__$1U,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1T = {
  mixins: [singleGroupMixin],
  name: 'titleFortyLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1T = script$1T;
/* template */
var __vue_render__$1T = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Forty-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "left-image" }, [
              _c(
                "div",
                { staticClass: "image-box" },
                [
                  _c("xml-image-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                      "block-data-name": _vm.imageBlockDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "show-title": false,
                      "container-class": "image-container",
                      resourceBasisPath: _vm.resourceBasisPath,
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                    },
                    on: { blockclick: _vm.handleBlockClick },
                  }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "right-top-bg" }, [
              _c("div", { staticClass: "zhuangshi" }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "rigth-titlebox" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "right-block" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1T = [];
__vue_render__$1T._withStripped = true;

  /* style */
  const __vue_inject_styles__$1T = undefined;
  /* scoped */
  const __vue_scope_id__$1T = "data-v-cb4f9bd6";
  /* module identifier */
  const __vue_module_identifier__$1T = undefined;
  /* functional template */
  const __vue_is_functional_template__$1T = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1T = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1T, staticRenderFns: __vue_staticRenderFns__$1T },
    __vue_inject_styles__$1T,
    __vue_script__$1T,
    __vue_scope_id__$1T,
    __vue_is_functional_template__$1T,
    __vue_module_identifier__$1T,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1S = {
  mixins: [singleGroupMixin],
  name: 'titleFortyoneLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '标题',
      titleTextDataName: 'titleTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1S = script$1S;
/* template */
var __vue_render__$1S = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-title-Fortyone-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "title-container" }, [
            _c("div", { staticClass: "title-bg" }, [
              _c("div", { staticClass: "title-card" }, [
                _c(
                  "div",
                  { staticClass: "left-image" },
                  [
                    _c("xml-image-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                        "block-data-name": _vm.imageBlockDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "show-title": false,
                        "container-class": "image-container",
                        resourceBasisPath: _vm.resourceBasisPath,
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                      },
                      on: { blockclick: _vm.handleBlockClick },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "rigth-titlebox" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.titleTextDataName],
                        "block-data-name": _vm.titleTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
              ]),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1S = [];
__vue_render__$1S._withStripped = true;

  /* style */
  const __vue_inject_styles__$1S = undefined;
  /* scoped */
  const __vue_scope_id__$1S = "data-v-44168f1d";
  /* module identifier */
  const __vue_module_identifier__$1S = undefined;
  /* functional template */
  const __vue_is_functional_template__$1S = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1S = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1S, staticRenderFns: __vue_staticRenderFns__$1S },
    __vue_inject_styles__$1S,
    __vue_script__$1S,
    __vue_scope_id__$1S,
    __vue_is_functional_template__$1S,
    __vue_module_identifier__$1S,
    false,
    undefined,
    undefined,
    undefined
  );

const TitleComponents$3 = [__vue_component__$2H, __vue_component__$2G, __vue_component__$2F, __vue_component__$2D, __vue_component__$2E, __vue_component__$2C, __vue_component__$2B, __vue_component__$2A, __vue_component__$2z, __vue_component__$2y, __vue_component__$2x, __vue_component__$2w, __vue_component__$2v, __vue_component__$2u, __vue_component__$2t, __vue_component__$2s, __vue_component__$2r, __vue_component__$2q, __vue_component__$2p, __vue_component__$2o, __vue_component__$2n, __vue_component__$2m, __vue_component__$2l, __vue_component__$2k, __vue_component__$2j, __vue_component__$2i, __vue_component__$2h, __vue_component__$2g, __vue_component__$2f, __vue_component__$2e, __vue_component__$2d, __vue_component__$2c, __vue_component__$2b, __vue_component__$2a, __vue_component__$29, __vue_component__$28, __vue_component__$27, __vue_component__$26, __vue_component__$25, __vue_component__$24, __vue_component__$23, __vue_component__$22, __vue_component__$21, __vue_component__$20, __vue_component__$1$, __vue_component__$1_, __vue_component__$1Z, __vue_component__$1Y, __vue_component__$1X, __vue_component__$1W, __vue_component__$1V, __vue_component__$1U, __vue_component__$1T, __vue_component__$1S];
var XmlTitleLibrary = {
  // install,
  ...TitleComponents$3
};

//
/**
 * 单图片组合
 */
var script$1R = {
  name: 'paragraphFirstLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$1R = script$1R;
/* template */
var __vue_render__$1R = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-first-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "rotate-container" }, [
            _c(
              "div",
              { staticClass: "rotate-container-inner" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
          _vm._v(" "),
          _c("xml-text-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.bodyTextDataName],
              "block-data-name": _vm.bodyTextDataName,
              "extend-params": _vm.extendParams,
              "current-rule": _vm.currentRule,
              "rule-index": _vm.ruleIndex,
              "container-class": "text-body-container",
              "editor-class": "editor",
              mode: _vm.mode,
              "page-type": _vm.pageType,
              resourceBasisPath: _vm.resourceBasisPath,
              scopedSlots: { $scopedSlots: _vm.$scopedSlots },
            },
            on: {
              blockclick: _vm.handleBlockClick,
              groupDataChange: _vm.groupDataChange,
            },
            scopedSlots: _vm._u(
              [
                _vm._l(_vm.$scopedSlots, function (index, name) {
                  return {
                    key: name,
                    fn: function (deliver) {
                      return [_vm._t(name, null, null, deliver)]
                    },
                  }
                }),
              ],
              null,
              true
            ),
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1R = [];
__vue_render__$1R._withStripped = true;

  /* style */
  const __vue_inject_styles__$1R = undefined;
  /* scoped */
  const __vue_scope_id__$1R = "data-v-f655d706";
  /* module identifier */
  const __vue_module_identifier__$1R = undefined;
  /* functional template */
  const __vue_is_functional_template__$1R = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1R = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1R, staticRenderFns: __vue_staticRenderFns__$1R },
    __vue_inject_styles__$1R,
    __vue_script__$1R,
    __vue_scope_id__$1R,
    __vue_is_functional_template__$1R,
    __vue_module_identifier__$1R,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1Q = {
  name: 'paragraphSecondLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$1Q = script$1Q;
/* template */
var __vue_render__$1Q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-second-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-second-title" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-top-border" }),
              _vm._v(" "),
              _c("div", { staticClass: "title-left-border" }),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1Q = [];
__vue_render__$1Q._withStripped = true;

  /* style */
  const __vue_inject_styles__$1Q = undefined;
  /* scoped */
  const __vue_scope_id__$1Q = "data-v-1909ccec";
  /* module identifier */
  const __vue_module_identifier__$1Q = undefined;
  /* functional template */
  const __vue_is_functional_template__$1Q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1Q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1Q, staticRenderFns: __vue_staticRenderFns__$1Q },
    __vue_inject_styles__$1Q,
    __vue_script__$1Q,
    __vue_scope_id__$1Q,
    __vue_is_functional_template__$1Q,
    __vue_module_identifier__$1Q,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1P = {
  name: 'paragraphThirdLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$1P = script$1P;
/* template */
var __vue_render__$1P = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-third-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "body-text",
              class: _vm.groupData.diagonalLine != false ? "diagonal-line" : "",
            },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1P = [];
__vue_render__$1P._withStripped = true;

  /* style */
  const __vue_inject_styles__$1P = undefined;
  /* scoped */
  const __vue_scope_id__$1P = "data-v-ad88462a";
  /* module identifier */
  const __vue_module_identifier__$1P = undefined;
  /* functional template */
  const __vue_is_functional_template__$1P = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1P = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1P, staticRenderFns: __vue_staticRenderFns__$1P },
    __vue_inject_styles__$1P,
    __vue_script__$1P,
    __vue_scope_id__$1P,
    __vue_is_functional_template__$1P,
    __vue_module_identifier__$1P,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1O = {
  name: 'paragraphQuadrangleLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$1O = script$1O;
/* template */
var __vue_render__$1O = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-quadrangle-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin1" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin2" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin3" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin4" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin5" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin6" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin7" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-lin8" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1O = [];
__vue_render__$1O._withStripped = true;

  /* style */
  const __vue_inject_styles__$1O = undefined;
  /* scoped */
  const __vue_scope_id__$1O = "data-v-4e940f10";
  /* module identifier */
  const __vue_module_identifier__$1O = undefined;
  /* functional template */
  const __vue_is_functional_template__$1O = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1O = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1O, staticRenderFns: __vue_staticRenderFns__$1O },
    __vue_inject_styles__$1O,
    __vue_script__$1O,
    __vue_scope_id__$1O,
    __vue_is_functional_template__$1O,
    __vue_module_identifier__$1O,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1N = {
  name: 'paragraphIsoscelesLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$1N = script$1N;
/* template */
var __vue_render__$1N = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-isosceles-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "circle" }),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "shape" }, [
            _c("div", { staticClass: "triangle" }),
            _vm._v(" "),
            _c("div", { staticClass: "triangle2" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1N = [];
__vue_render__$1N._withStripped = true;

  /* style */
  const __vue_inject_styles__$1N = undefined;
  /* scoped */
  const __vue_scope_id__$1N = "data-v-a258c0e6";
  /* module identifier */
  const __vue_module_identifier__$1N = undefined;
  /* functional template */
  const __vue_is_functional_template__$1N = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1N = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1N, staticRenderFns: __vue_staticRenderFns__$1N },
    __vue_inject_styles__$1N,
    __vue_script__$1N,
    __vue_scope_id__$1N,
    __vue_is_functional_template__$1N,
    __vue_module_identifier__$1N,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1M = {
  name: 'paragraphNinthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。

      bodyTextDataName2: 'bodyTextData',
      titleTextDataName2: 'titleTextData2',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$1M = script$1M;
/* template */
var __vue_render__$1M = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-ninth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-row-box" },
            [
              _c(
                "div",
                { staticClass: "text-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName2],
                      "block-data-name": _vm.bodyTextDataName2,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle2" }),
                ],
                1
              ),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                  "block-data-name": _vm.titleTextDataName2,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1M = [];
__vue_render__$1M._withStripped = true;

  /* style */
  const __vue_inject_styles__$1M = undefined;
  /* scoped */
  const __vue_scope_id__$1M = "data-v-fbb9855a";
  /* module identifier */
  const __vue_module_identifier__$1M = undefined;
  /* functional template */
  const __vue_is_functional_template__$1M = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1M = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1M, staticRenderFns: __vue_staticRenderFns__$1M },
    __vue_inject_styles__$1M,
    __vue_script__$1M,
    __vue_scope_id__$1M,
    __vue_is_functional_template__$1M,
    __vue_module_identifier__$1M,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1L = {
  name: 'ParagraphEighthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$1L = script$1L;
/* template */
var __vue_render__$1L = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-eighth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-row-box" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "text-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                ],
                1
              ),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1L = [];
__vue_render__$1L._withStripped = true;

  /* style */
  const __vue_inject_styles__$1L = undefined;
  /* scoped */
  const __vue_scope_id__$1L = "data-v-13f19eb8";
  /* module identifier */
  const __vue_module_identifier__$1L = undefined;
  /* functional template */
  const __vue_is_functional_template__$1L = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1L = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1L, staticRenderFns: __vue_staticRenderFns__$1L },
    __vue_inject_styles__$1L,
    __vue_script__$1L,
    __vue_scope_id__$1L,
    __vue_is_functional_template__$1L,
    __vue_module_identifier__$1L,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1K = {
  name: 'paragraphTenthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      numberTextDataName: 'numberTextData',
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$1K = script$1K;
/* template */
var __vue_render__$1K = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-tenth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-suptitle-box" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.numberTextDataName],
                  "block-data-name": _vm.numberTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container-left",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "paragraph-row-box" }, [
            _c(
              "div",
              { staticClass: "paragraph-subtitle-box" },
              [
                _c("div", { staticClass: "subtitle-left-dec" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                    "block-data-name": _vm.titleTextDataName2,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-body-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1K = [];
__vue_render__$1K._withStripped = true;

  /* style */
  const __vue_inject_styles__$1K = undefined;
  /* scoped */
  const __vue_scope_id__$1K = "data-v-5d52f4fe";
  /* module identifier */
  const __vue_module_identifier__$1K = undefined;
  /* functional template */
  const __vue_is_functional_template__$1K = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1K = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1K, staticRenderFns: __vue_staticRenderFns__$1K },
    __vue_inject_styles__$1K,
    __vue_script__$1K,
    __vue_scope_id__$1K,
    __vue_is_functional_template__$1K,
    __vue_module_identifier__$1K,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1J = {
  name: 'paragraphSixteenLibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      numberTextDataName: 'numberTextData',
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1J = script$1J;
/* template */
var __vue_render__$1J = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-sixteen-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "paragraph-row-box" }, [
            _c(
              "div",
              { staticClass: "paragraph-subtitle-box" },
              [
                _c("div", { staticClass: "subtitle-left-dec" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName3],
                    "block-data-name": _vm.titleTextDataName3,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-body-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName2],
                    "block-data-name": _vm.bodyTextDataName2,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1J = [];
__vue_render__$1J._withStripped = true;

  /* style */
  const __vue_inject_styles__$1J = undefined;
  /* scoped */
  const __vue_scope_id__$1J = "data-v-31931f82";
  /* module identifier */
  const __vue_module_identifier__$1J = undefined;
  /* functional template */
  const __vue_is_functional_template__$1J = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1J = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1J, staticRenderFns: __vue_staticRenderFns__$1J },
    __vue_inject_styles__$1J,
    __vue_script__$1J,
    __vue_scope_id__$1J,
    __vue_is_functional_template__$1J,
    __vue_module_identifier__$1J,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1I = {
  name: 'paragraphSeventhLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      numberTextDataName: 'numberTextData',
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$1I = script$1I;
/* template */
var __vue_render__$1I = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-seventh-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "paragraph-suptitle-box" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.numberTextDataName],
                  "block-data-name": _vm.numberTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container-left",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "title-right-img" }),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "paragraph-row-box" }, [
            _c(
              "div",
              { staticClass: "paragraph-subtitle-box" },
              [
                _c("div", { staticClass: "subtitle-left-dec" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                    "block-data-name": _vm.titleTextDataName2,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-body-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "paragraph-subtitle-box" },
              [
                _c("div", { staticClass: "subtitle-left-dec" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName3],
                    "block-data-name": _vm.titleTextDataName3,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-body-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName2],
                    "block-data-name": _vm.bodyTextDataName2,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1I = [];
__vue_render__$1I._withStripped = true;

  /* style */
  const __vue_inject_styles__$1I = undefined;
  /* scoped */
  const __vue_scope_id__$1I = "data-v-33702f15";
  /* module identifier */
  const __vue_module_identifier__$1I = undefined;
  /* functional template */
  const __vue_is_functional_template__$1I = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1I = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1I, staticRenderFns: __vue_staticRenderFns__$1I },
    __vue_inject_styles__$1I,
    __vue_script__$1I,
    __vue_scope_id__$1I,
    __vue_is_functional_template__$1I,
    __vue_module_identifier__$1I,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1H = {
  name: 'paragraphElevenLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1H = script$1H;
/* template */
var __vue_render__$1H = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-eleven-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text" }, [
            _c("div", { staticClass: "boder-top" }, [
              _c("div", { staticClass: "boder-top-line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "boder-top-line2" }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "boder-bottom" }, [
              _c("div", { staticClass: "boder-bottom-line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "boder-bottom-line2" }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "boder-left" }, [
              _c("div", { staticClass: "boder-left-line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "boder-left-line2" }),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "boder-right" }, [
              _c("div", { staticClass: "boder-right-line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "boder-right-line2" }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-container" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1H = [];
__vue_render__$1H._withStripped = true;

  /* style */
  const __vue_inject_styles__$1H = undefined;
  /* scoped */
  const __vue_scope_id__$1H = "data-v-db9f93d2";
  /* module identifier */
  const __vue_module_identifier__$1H = undefined;
  /* functional template */
  const __vue_is_functional_template__$1H = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1H = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1H, staticRenderFns: __vue_staticRenderFns__$1H },
    __vue_inject_styles__$1H,
    __vue_script__$1H,
    __vue_scope_id__$1H,
    __vue_is_functional_template__$1H,
    __vue_module_identifier__$1H,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1G = {
  name: 'paragraphThirteenLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1G = script$1G;
/* template */
var __vue_render__$1G = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-thirteen-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "text-border-top" }),
              _vm._v(" "),
              _c("div", { staticClass: "text-border-bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "text-border-left" }),
              _vm._v(" "),
              _c("div", { staticClass: "text-border-right" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1G = [];
__vue_render__$1G._withStripped = true;

  /* style */
  const __vue_inject_styles__$1G = undefined;
  /* scoped */
  const __vue_scope_id__$1G = "data-v-28ba8376";
  /* module identifier */
  const __vue_module_identifier__$1G = undefined;
  /* functional template */
  const __vue_is_functional_template__$1G = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1G = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1G, staticRenderFns: __vue_staticRenderFns__$1G },
    __vue_inject_styles__$1G,
    __vue_script__$1G,
    __vue_scope_id__$1G,
    __vue_is_functional_template__$1G,
    __vue_module_identifier__$1G,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1F = {
  name: 'paragraphFourteenLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1F = script$1F;
/* template */
var __vue_render__$1F = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-fourteen-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "right-image" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1F = [];
__vue_render__$1F._withStripped = true;

  /* style */
  const __vue_inject_styles__$1F = undefined;
  /* scoped */
  const __vue_scope_id__$1F = "data-v-5c668ad2";
  /* module identifier */
  const __vue_module_identifier__$1F = undefined;
  /* functional template */
  const __vue_is_functional_template__$1F = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1F = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1F, staticRenderFns: __vue_staticRenderFns__$1F },
    __vue_inject_styles__$1F,
    __vue_script__$1F,
    __vue_scope_id__$1F,
    __vue_is_functional_template__$1F,
    __vue_module_identifier__$1F,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1E = {
  name: 'paragraphGreentheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1E = script$1E;
/* template */
var __vue_render__$1E = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Greentheme2-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "border-top" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-bg" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-right" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1E = [];
__vue_render__$1E._withStripped = true;

  /* style */
  const __vue_inject_styles__$1E = undefined;
  /* scoped */
  const __vue_scope_id__$1E = "data-v-6457038b";
  /* module identifier */
  const __vue_module_identifier__$1E = undefined;
  /* functional template */
  const __vue_is_functional_template__$1E = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1E = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1E, staticRenderFns: __vue_staticRenderFns__$1E },
    __vue_inject_styles__$1E,
    __vue_script__$1E,
    __vue_scope_id__$1E,
    __vue_is_functional_template__$1E,
    __vue_module_identifier__$1E,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1D = {
  name: 'paragraphGreentheme3LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1D = script$1D;
/* template */
var __vue_render__$1D = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Greentheme3-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-bg" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1D = [];
__vue_render__$1D._withStripped = true;

  /* style */
  const __vue_inject_styles__$1D = undefined;
  /* scoped */
  const __vue_scope_id__$1D = "data-v-1aa7cbac";
  /* module identifier */
  const __vue_module_identifier__$1D = undefined;
  /* functional template */
  const __vue_is_functional_template__$1D = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1D = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1D, staticRenderFns: __vue_staticRenderFns__$1D },
    __vue_inject_styles__$1D,
    __vue_script__$1D,
    __vue_scope_id__$1D,
    __vue_is_functional_template__$1D,
    __vue_module_identifier__$1D,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1C = {
  name: 'paragraphGreentheme4LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1C = script$1C;
/* template */
var __vue_render__$1C = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Greentheme4-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "body-text-bg1" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-bg2" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1C = [];
__vue_render__$1C._withStripped = true;

  /* style */
  const __vue_inject_styles__$1C = undefined;
  /* scoped */
  const __vue_scope_id__$1C = "data-v-68eef03d";
  /* module identifier */
  const __vue_module_identifier__$1C = undefined;
  /* functional template */
  const __vue_is_functional_template__$1C = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1C = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1C, staticRenderFns: __vue_staticRenderFns__$1C },
    __vue_inject_styles__$1C,
    __vue_script__$1C,
    __vue_scope_id__$1C,
    __vue_is_functional_template__$1C,
    __vue_module_identifier__$1C,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1B = {
  name: 'paragraphGreentheme5LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1B = script$1B;
/* template */
var __vue_render__$1B = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Greentheme5-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "body-text-bg1" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "border-top" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-bottom" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-left" }),
              _vm._v(" "),
              _c("div", { staticClass: "border-right" }),
              _vm._v(" "),
              _c("div", { staticClass: "body-text-bg2" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1B = [];
__vue_render__$1B._withStripped = true;

  /* style */
  const __vue_inject_styles__$1B = undefined;
  /* scoped */
  const __vue_scope_id__$1B = "data-v-797c3adf";
  /* module identifier */
  const __vue_module_identifier__$1B = undefined;
  /* functional template */
  const __vue_is_functional_template__$1B = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1B = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1B, staticRenderFns: __vue_staticRenderFns__$1B },
    __vue_inject_styles__$1B,
    __vue_script__$1B,
    __vue_scope_id__$1B,
    __vue_is_functional_template__$1B,
    __vue_module_identifier__$1B,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1A = {
  name: 'paragraphYellowtheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1A = script$1A;
/* template */
var __vue_render__$1A = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme1-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "border-top" }, [
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "border-bottom" }, [
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
            ]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1A = [];
__vue_render__$1A._withStripped = true;

  /* style */
  const __vue_inject_styles__$1A = undefined;
  /* scoped */
  const __vue_scope_id__$1A = "data-v-2cfe1e18";
  /* module identifier */
  const __vue_module_identifier__$1A = undefined;
  /* functional template */
  const __vue_is_functional_template__$1A = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1A = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1A, staticRenderFns: __vue_staticRenderFns__$1A },
    __vue_inject_styles__$1A,
    __vue_script__$1A,
    __vue_scope_id__$1A,
    __vue_is_functional_template__$1A,
    __vue_module_identifier__$1A,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1z = {
  name: 'paragraphYellowtheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1z = script$1z;
/* template */
var __vue_render__$1z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme2-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "block1" }),
            _vm._v(" "),
            _c("div", { staticClass: "block2" }),
            _vm._v(" "),
            _c("div", { staticClass: "block3" }),
            _vm._v(" "),
            _c("div", { staticClass: "block4" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1z = [];
__vue_render__$1z._withStripped = true;

  /* style */
  const __vue_inject_styles__$1z = undefined;
  /* scoped */
  const __vue_scope_id__$1z = "data-v-0be4cd63";
  /* module identifier */
  const __vue_module_identifier__$1z = undefined;
  /* functional template */
  const __vue_is_functional_template__$1z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1z, staticRenderFns: __vue_staticRenderFns__$1z },
    __vue_inject_styles__$1z,
    __vue_script__$1z,
    __vue_scope_id__$1z,
    __vue_is_functional_template__$1z,
    __vue_module_identifier__$1z,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1y = {
  name: 'paragraphYellowtheme3LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1y = script$1y;
/* template */
var __vue_render__$1y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme3-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "right-img" }, [_c("div")]),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1y = [];
__vue_render__$1y._withStripped = true;

  /* style */
  const __vue_inject_styles__$1y = undefined;
  /* scoped */
  const __vue_scope_id__$1y = "data-v-8a09b468";
  /* module identifier */
  const __vue_module_identifier__$1y = undefined;
  /* functional template */
  const __vue_is_functional_template__$1y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1y, staticRenderFns: __vue_staticRenderFns__$1y },
    __vue_inject_styles__$1y,
    __vue_script__$1y,
    __vue_scope_id__$1y,
    __vue_is_functional_template__$1y,
    __vue_module_identifier__$1y,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1x = {
  name: 'paragraphYellowtheme4LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1x = script$1x;
/* template */
var __vue_render__$1x = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme4-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "block1" }),
            _vm._v(" "),
            _c("div", { staticClass: "block2" }),
            _vm._v(" "),
            _c("div", { staticClass: "block3" }),
            _vm._v(" "),
            _c("div", { staticClass: "block4" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1x = [];
__vue_render__$1x._withStripped = true;

  /* style */
  const __vue_inject_styles__$1x = undefined;
  /* scoped */
  const __vue_scope_id__$1x = "data-v-d59f5cb6";
  /* module identifier */
  const __vue_module_identifier__$1x = undefined;
  /* functional template */
  const __vue_is_functional_template__$1x = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1x = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1x, staticRenderFns: __vue_staticRenderFns__$1x },
    __vue_inject_styles__$1x,
    __vue_script__$1x,
    __vue_scope_id__$1x,
    __vue_is_functional_template__$1x,
    __vue_module_identifier__$1x,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1w = {
  name: 'paragraphYellowtheme5LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1w = script$1w;
/* template */
var __vue_render__$1w = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Yellowtheme5-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "left-img" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-img" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1w = [];
__vue_render__$1w._withStripped = true;

  /* style */
  const __vue_inject_styles__$1w = undefined;
  /* scoped */
  const __vue_scope_id__$1w = "data-v-54976a2b";
  /* module identifier */
  const __vue_module_identifier__$1w = undefined;
  /* functional template */
  const __vue_is_functional_template__$1w = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1w = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1w, staticRenderFns: __vue_staticRenderFns__$1w },
    __vue_inject_styles__$1w,
    __vue_script__$1w,
    __vue_scope_id__$1w,
    __vue_is_functional_template__$1w,
    __vue_module_identifier__$1w,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1v = {
  name: 'paragraphRedtheme1LibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1v = script$1v;
/* template */
var __vue_render__$1v = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme1-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1v = [];
__vue_render__$1v._withStripped = true;

  /* style */
  const __vue_inject_styles__$1v = undefined;
  /* scoped */
  const __vue_scope_id__$1v = "data-v-0edc2afd";
  /* module identifier */
  const __vue_module_identifier__$1v = undefined;
  /* functional template */
  const __vue_is_functional_template__$1v = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1v = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1v, staticRenderFns: __vue_staticRenderFns__$1v },
    __vue_inject_styles__$1v,
    __vue_script__$1v,
    __vue_scope_id__$1v,
    __vue_is_functional_template__$1v,
    __vue_module_identifier__$1v,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1u = {
  name: 'paragraphRedtheme2LibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1u = script$1u;
/* template */
var __vue_render__$1u = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme2-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "left-line" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "right-line" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1u = [];
__vue_render__$1u._withStripped = true;

  /* style */
  const __vue_inject_styles__$1u = undefined;
  /* scoped */
  const __vue_scope_id__$1u = "data-v-093112db";
  /* module identifier */
  const __vue_module_identifier__$1u = undefined;
  /* functional template */
  const __vue_is_functional_template__$1u = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1u = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1u, staticRenderFns: __vue_staticRenderFns__$1u },
    __vue_inject_styles__$1u,
    __vue_script__$1u,
    __vue_scope_id__$1u,
    __vue_is_functional_template__$1u,
    __vue_module_identifier__$1u,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1t = {
  name: 'paragraphRedtheme3LibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1t = script$1t;
/* template */
var __vue_render__$1t = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme3-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "top-line" }),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "bottom-line" }),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1t = [];
__vue_render__$1t._withStripped = true;

  /* style */
  const __vue_inject_styles__$1t = undefined;
  /* scoped */
  const __vue_scope_id__$1t = "data-v-7125bb8a";
  /* module identifier */
  const __vue_module_identifier__$1t = undefined;
  /* functional template */
  const __vue_is_functional_template__$1t = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1t = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1t, staticRenderFns: __vue_staticRenderFns__$1t },
    __vue_inject_styles__$1t,
    __vue_script__$1t,
    __vue_scope_id__$1t,
    __vue_is_functional_template__$1t,
    __vue_module_identifier__$1t,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1s = {
  name: 'paragraphRedtheme4LibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1s = script$1s;
/* template */
var __vue_render__$1s = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme4-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-title" }, [
            _c("div", { staticClass: "body-title-box" }, [
              _c(
                "div",
                { staticClass: "body-title-con" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "triangle1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "triangle2" }),
                ],
                1
              ),
            ]),
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1s = [];
__vue_render__$1s._withStripped = true;

  /* style */
  const __vue_inject_styles__$1s = undefined;
  /* scoped */
  const __vue_scope_id__$1s = "data-v-66832f0e";
  /* module identifier */
  const __vue_module_identifier__$1s = undefined;
  /* functional template */
  const __vue_is_functional_template__$1s = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1s = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1s, staticRenderFns: __vue_staticRenderFns__$1s },
    __vue_inject_styles__$1s,
    __vue_script__$1s,
    __vue_scope_id__$1s,
    __vue_is_functional_template__$1s,
    __vue_module_identifier__$1s,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1r = {
  name: 'paragraphRedtheme5LibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1r = script$1r;
/* template */
var __vue_render__$1r = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme5-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-box" }, [
            _c(
              "div",
              { staticClass: "body-text-bg" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1r = [];
__vue_render__$1r._withStripped = true;

  /* style */
  const __vue_inject_styles__$1r = undefined;
  /* scoped */
  const __vue_scope_id__$1r = "data-v-5a9fe5c9";
  /* module identifier */
  const __vue_module_identifier__$1r = undefined;
  /* functional template */
  const __vue_is_functional_template__$1r = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1r = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1r, staticRenderFns: __vue_staticRenderFns__$1r },
    __vue_inject_styles__$1r,
    __vue_script__$1r,
    __vue_scope_id__$1r,
    __vue_is_functional_template__$1r,
    __vue_module_identifier__$1r,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1q = {
  name: 'paragraphRedtheme6LibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1q = script$1q;
/* template */
var __vue_render__$1q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme6-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-title" }, [
            _c("div", { staticClass: "body-title-box" }, [
              _c(
                "div",
                { staticClass: "body-title-con" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "triangle1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "triangle2" }),
                ],
                1
              ),
            ]),
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1q = [];
__vue_render__$1q._withStripped = true;

  /* style */
  const __vue_inject_styles__$1q = undefined;
  /* scoped */
  const __vue_scope_id__$1q = "data-v-76e3470c";
  /* module identifier */
  const __vue_module_identifier__$1q = undefined;
  /* functional template */
  const __vue_is_functional_template__$1q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1q, staticRenderFns: __vue_staticRenderFns__$1q },
    __vue_inject_styles__$1q,
    __vue_script__$1q,
    __vue_scope_id__$1q,
    __vue_is_functional_template__$1q,
    __vue_module_identifier__$1q,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1p = {
  name: 'paragraphRedtheme7LibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1p = script$1p;
/* template */
var __vue_render__$1p = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Redtheme7-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-title" }, [
            _c("div", { staticClass: "body-title-box" }, [
              _c(
                "div",
                { staticClass: "body-title-con" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "triangle1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "triangle2" }),
                ],
                1
              ),
            ]),
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1p = [];
__vue_render__$1p._withStripped = true;

  /* style */
  const __vue_inject_styles__$1p = undefined;
  /* scoped */
  const __vue_scope_id__$1p = "data-v-01d959ea";
  /* module identifier */
  const __vue_module_identifier__$1p = undefined;
  /* functional template */
  const __vue_is_functional_template__$1p = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1p = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1p, staticRenderFns: __vue_staticRenderFns__$1p },
    __vue_inject_styles__$1p,
    __vue_script__$1p,
    __vue_scope_id__$1p,
    __vue_is_functional_template__$1p,
    __vue_module_identifier__$1p,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1o = {
  name: 'paragraphFoldtheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    },
    getClassName() {
      return 'body-text-fold' + (this.groupData.hideTop || '');
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1o = script$1o;
/* template */
var __vue_render__$1o = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Foldtheme1-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _vm.groupData.hideTop != "-one"
              ? _c("div", { staticClass: "top-style" })
              : _vm._e(),
            _vm._v(" "),
            _c(
              "div",
              {
                staticClass: "body-text",
                class: !_vm.isFold ? _vm.getClassName() : "",
              },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "seemore", on: { click: _vm.changepanel } },
              [
                _c("span", [_vm._v(_vm._s(!_vm.isFold ? "查看更多" : "折叠"))]),
                _vm._v(" "),
                !_vm.isFold
                  ? _c("i", { staticClass: "el-icon-d-arrow-left down" })
                  : _c("i", { staticClass: "el-icon-d-arrow-left up" }),
              ]
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1o = [];
__vue_render__$1o._withStripped = true;

  /* style */
  const __vue_inject_styles__$1o = undefined;
  /* scoped */
  const __vue_scope_id__$1o = "data-v-e3fcb578";
  /* module identifier */
  const __vue_module_identifier__$1o = undefined;
  /* functional template */
  const __vue_is_functional_template__$1o = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1o = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1o, staticRenderFns: __vue_staticRenderFns__$1o },
    __vue_inject_styles__$1o,
    __vue_script__$1o,
    __vue_scope_id__$1o,
    __vue_is_functional_template__$1o,
    __vue_module_identifier__$1o,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1n = {
  name: 'paragraphFoldtheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    console.log(this.pGroupData, '组件内部');
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1n = script$1n;
/* template */
var __vue_render__$1n = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Foldtheme2-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "top-title-style" }, [
              _c(
                "div",
                { staticClass: "title-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "seemore", on: { click: _vm.changepanel } },
                [
                  _c("span", [_vm._v(_vm._s(!_vm.isFold ? "更多" : "收起"))]),
                  _vm._v(" "),
                  !_vm.isFold
                    ? _c("i", { staticClass: "el-icon-d-arrow-left down" })
                    : _c("i", { staticClass: "el-icon-d-arrow-left up" }),
                ]
              ),
            ]),
            _vm._v(" "),
            _c(
              "div",
              {
                staticClass: "body-text",
                class: !_vm.isFold ? "body-text-fold" : "",
              },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1n = [];
__vue_render__$1n._withStripped = true;

  /* style */
  const __vue_inject_styles__$1n = undefined;
  /* scoped */
  const __vue_scope_id__$1n = "data-v-f99a7e0e";
  /* module identifier */
  const __vue_module_identifier__$1n = undefined;
  /* functional template */
  const __vue_is_functional_template__$1n = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1n = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1n, staticRenderFns: __vue_staticRenderFns__$1n },
    __vue_inject_styles__$1n,
    __vue_script__$1n,
    __vue_scope_id__$1n,
    __vue_is_functional_template__$1n,
    __vue_module_identifier__$1n,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1m = {
  name: 'paragraphFoldtheme3LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    console.log(this.pGroupData, '组件内部');
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1m = script$1m;
/* template */
var __vue_render__$1m = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Foldtheme2-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "top-title-style" }, [
              _c(
                "div",
                { staticClass: "title-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "seemore", on: { click: _vm.changepanel } },
                [
                  _c("span", [_vm._v(_vm._s(!_vm.isFold ? "更多" : "收起"))]),
                  _vm._v(" "),
                  !_vm.isFold
                    ? _c("i", { staticClass: "el-icon-d-arrow-left down" })
                    : _c("i", { staticClass: "el-icon-d-arrow-left up" }),
                ]
              ),
            ]),
            _vm._v(" "),
            _c(
              "div",
              {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: _vm.isFold,
                    expression: "isFold",
                  },
                ],
                staticClass: "body-text",
                class: !_vm.isFold ? "body-text-fold" : "",
              },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1m = [];
__vue_render__$1m._withStripped = true;

  /* style */
  const __vue_inject_styles__$1m = undefined;
  /* scoped */
  const __vue_scope_id__$1m = "data-v-56315d43";
  /* module identifier */
  const __vue_module_identifier__$1m = undefined;
  /* functional template */
  const __vue_is_functional_template__$1m = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1m = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1m, staticRenderFns: __vue_staticRenderFns__$1m },
    __vue_inject_styles__$1m,
    __vue_script__$1m,
    __vue_scope_id__$1m,
    __vue_is_functional_template__$1m,
    __vue_module_identifier__$1m,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1l = {
  name: 'paragraphTabstheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      bodyTextDataName4: 'bodyTextData4',
      titleTextDataName1: 'titleTextData1',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      titleTextDataName4: 'titleTextData4',
      groupData: {},
      tabslist: [],
      chooseindex: 0
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    clicktabs(e) {
      this.chooseindex = e;
    },
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    },
    addtabs() {
      console.log(this.groupData);
      // {html: "<p style='font-size: 16px;font-family: PingFang SC;font-weight: bold;color: #fff;'>这是一个标题</p>"}
      this.tabslist.push({
        html: "<p style='font-size: 16px;font-family: PingFang SC;font-weight: bold;color: #000;'>选项一</p>"
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1l = script$1l;
/* template */
var __vue_render__$1l = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Tabstheme1-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "body-text" }, [
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.chooseindex == 0,
                      expression: "chooseindex==0",
                    },
                  ],
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.chooseindex == 1,
                      expression: "chooseindex==1",
                    },
                  ],
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName2],
                      "block-data-name": _vm.bodyTextDataName2,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.chooseindex == 2,
                      expression: "chooseindex==2",
                    },
                  ],
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName3],
                      "block-data-name": _vm.bodyTextDataName3,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.chooseindex == 3,
                      expression: "chooseindex==3",
                    },
                  ],
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName4],
                      "block-data-name": _vm.bodyTextDataName4,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "top-style" }, [
              _c(
                "div",
                {
                  class: _vm.chooseindex == 0 ? "active" : "",
                  on: {
                    click: function ($event) {
                      return _vm.clicktabs(0)
                    },
                  },
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName1],
                      "block-data-name": _vm.titleTextDataName1,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  class: _vm.chooseindex == 1 ? "active" : "",
                  on: {
                    click: function ($event) {
                      return _vm.clicktabs(1)
                    },
                  },
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                      "block-data-name": _vm.titleTextDataName2,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  class: _vm.chooseindex == 2 ? "active" : "",
                  on: {
                    click: function ($event) {
                      return _vm.clicktabs(2)
                    },
                  },
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName3],
                      "block-data-name": _vm.titleTextDataName3,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  class: _vm.chooseindex == 3 ? "active" : "",
                  on: {
                    click: function ($event) {
                      return _vm.clicktabs(3)
                    },
                  },
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName4],
                      "block-data-name": _vm.titleTextDataName4,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1l = [];
__vue_render__$1l._withStripped = true;

  /* style */
  const __vue_inject_styles__$1l = undefined;
  /* scoped */
  const __vue_scope_id__$1l = "data-v-8b81b2e6";
  /* module identifier */
  const __vue_module_identifier__$1l = undefined;
  /* functional template */
  const __vue_is_functional_template__$1l = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1l = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1l, staticRenderFns: __vue_staticRenderFns__$1l },
    __vue_inject_styles__$1l,
    __vue_script__$1l,
    __vue_scope_id__$1l,
    __vue_is_functional_template__$1l,
    __vue_module_identifier__$1l,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1k = {
  name: 'paragraphTabstheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      bodyTextDataName4: 'bodyTextData4',
      titleTextDataName: 'titleTextData',
      titleTextDataName1: 'titleTextData1',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      titleTextDataName4: 'titleTextData4',
      groupData: {},
      tabslist: [],
      chooseindex: 0
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    clicktabs(e) {
      this.chooseindex = e;
    },
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    },
    addtabs() {
      console.log(this.groupData);
      // {html: "<p style='font-size: 16px;font-family: PingFang SC;font-weight: bold;color: #fff;'>这是一个标题</p>"}
      this.tabslist.push({
        html: "<p style='font-size: 16px;font-family: PingFang SC;font-weight: bold;color: #000;'>选项一</p>"
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1k = script$1k;
/* template */
var __vue_render__$1k = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Tabstheme2-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "suptitle" },
            [
              _c("div", { staticClass: "block1" }),
              _vm._v(" "),
              _c("div", { staticClass: "block2" }),
              _vm._v(" "),
              _c("div", { staticClass: "block3" }),
              _vm._v(" "),
              _c("div", { staticClass: "block4" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName],
                  "block-data-name": _vm.titleTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "top-style" }, [
              _c(
                "div",
                {
                  class: _vm.chooseindex == 0 ? "active" : "",
                  on: {
                    click: function ($event) {
                      return _vm.clicktabs(0)
                    },
                  },
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName1],
                      "block-data-name": _vm.titleTextDataName1,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  class: _vm.chooseindex == 1 ? "active" : "",
                  on: {
                    click: function ($event) {
                      return _vm.clicktabs(1)
                    },
                  },
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName2],
                      "block-data-name": _vm.titleTextDataName2,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  class: _vm.chooseindex == 2 ? "active" : "",
                  on: {
                    click: function ($event) {
                      return _vm.clicktabs(2)
                    },
                  },
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName3],
                      "block-data-name": _vm.titleTextDataName3,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  class: _vm.chooseindex == 3 ? "active" : "",
                  on: {
                    click: function ($event) {
                      return _vm.clicktabs(3)
                    },
                  },
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName4],
                      "block-data-name": _vm.titleTextDataName4,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "body-text" }, [
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.chooseindex == 0,
                      expression: "chooseindex==0",
                    },
                  ],
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.chooseindex == 1,
                      expression: "chooseindex==1",
                    },
                  ],
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName2],
                      "block-data-name": _vm.bodyTextDataName2,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.chooseindex == 2,
                      expression: "chooseindex==2",
                    },
                  ],
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName3],
                      "block-data-name": _vm.bodyTextDataName3,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.chooseindex == 3,
                      expression: "chooseindex==3",
                    },
                  ],
                },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName4],
                      "block-data-name": _vm.bodyTextDataName4,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1k = [];
__vue_render__$1k._withStripped = true;

  /* style */
  const __vue_inject_styles__$1k = undefined;
  /* scoped */
  const __vue_scope_id__$1k = "data-v-5a943dc8";
  /* module identifier */
  const __vue_module_identifier__$1k = undefined;
  /* functional template */
  const __vue_is_functional_template__$1k = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1k = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1k, staticRenderFns: __vue_staticRenderFns__$1k },
    __vue_inject_styles__$1k,
    __vue_script__$1k,
    __vue_scope_id__$1k,
    __vue_is_functional_template__$1k,
    __vue_module_identifier__$1k,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1j = {
  name: 'paragraphTabstheme3LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      titleTextDataName1: 'titleTextData1',
      groupData: {},
      tabslist: [],
      chooseindex: 0,
      timer: ''
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  watch: {
    pGroupData: {
      handler(newValue, oldValue) {
        this.$set(this.groupData, 'titleTextData', newValue.titleTextData);
        this.$set(this.groupData, 'bodyTextData', newValue.bodyTextData);
        this.handleLoad();
      },
      deep: true
    }
  },
  methods: {
    handleLoad() {
      this.timer = new Date().getTime();
    },
    clicktabs(e) {
      this.chooseindex = e;
    },
    addtabs() {
      // this.groupData.titleTextData.push({
      //       html: '<p style="font-size: 16px;font-family: PingFang SC;font-weight: bold;color: #000;">选项一</p>',
      // })
      // this.groupData.bodyTextData.push({
      //     html: '<p style="font-size: 16px;font-family: Microsoft YaHei;font-weight: 400;color: #333333;">夏天的风是蓝色的温柔。我时常仰望夏日天空，蓝得清澈。夏日的风，漫过无边无垠的往事，送来对未来的美好希望。</p>',
      // })
      this.$emit('addtabs', {
        ruleIndex: this.ruleIndex
      });
    },
    deltabs(index) {
      this.$emit('deltabs', {
        ruleIndex: this.ruleIndex,
        dataIndex: index
      });
      if (this.groupData.titleTextData.length == 0) {
        this.chooseindex = 0;
      } else {
        this.chooseindex = this.groupData.titleTextData.length - 1;
      }
    },
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data,
      dataIndex
    }) {
      console.log(ruleIndex, dataName, data);
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data,
        dataIndex
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

var __$_require_assets_images_closeicon_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAbBJREFUOE99ks1qWkEUx//H61cWogvBRRaxCuqmbu4NClkJyaLrpts8QLtwH2mhD1Dool30CQLtE7RQhBDczBhfQMVFQUqSi+aKetF7T5mhN4yh6VnN+c/5zfmYQ3hkUspEGIaHlmU9Z+YUEf1i5kvHcW7NUDIdIcRLIvoA4GAniMhn5i+e53VardZC3T2AUsr3AN49rsD0U6kUlstlvtFo3GlQCHFKRN/UOR6PY7vd7vCxWEz7YRiCiH7atn1M3W43nslkJgD2FVSv1zEejzGbzXSw0qrVKlzXxXQ61RoRvaDBYHAUBMFVlCKbzaJcLmvY8zwNrddr7Rv2lvr9/htm/mSqCi4WiwiCAIvFApOJKmjHzklK2Qbw0ZQty0KtVkM6ncZwOMR8Pv8n+ArA1+hG9VSpVLBarXSfKrMq04SZuaMy5gH8BhBT01OZfN/HaDTSb+VyOZRKJe0bcFt/h5TyM4DXCiwUCg/TMwemzn/Bm0Qi8UyDvV5vL5lMXgOo/W8BALD6Ctu2v5ubk2fmCyI6fgJW7Zw5jvNjZ+WiYCHECRE5JkxE7mazuWg2m/eR/gfAL7CDWnQ6sgAAAABJRU5ErkJggg==";

var __$_require_assets_images_addtabicon_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAhCAYAAABX5MJvAAAAAXNSR0IArs4c6QAABcZJREFUWEfNl01sE0cUx2c/vP5YDKyDiTfQ4FQogIlTJeFQIQSC5tAqiEOqlI9QoRxAqqoeWvXWSk7EBalSD60qtVZFDi0oCeJEWilSE8ipORQcZMWgiiihtfAmRl5EYuz9mJ3qbRnLcfxJe2Ck0Xq9Mzu/fe/Nm/9j0GvQmEYZCCEV5zAMQxp9H4yvC4IuPDIyYo8PhUL2NZFI0Ht78UQiYV8jkYh9rReqKkTx4rCw3+9nZmdnWZ/Px+zduxetrKzY89fW1kggECCqqpL29naSTqcJANULUxECAODLYXFVVVlN01jTNFlRFBm4ulwuZseOHbb1NU0j+Xye5HI5IgiCJYqi5ff7rWKYalYpC0EBEEJsKBRis9ksy3Ecx7IsZxgGizFmDxw44N21a5dP0zTr0aNHK6lUSuc4zrIsC5umiQFG13WcSqXANRZYpRLIJggKcOzYMTYej3NOp5PjeZ5zuVz8iRMnOpuami7wPP8OwzBvFMWUaVlWXNf1yYcPH/40Pz+fFkXRRAhh6IlEwqoGsgGiFGD79u18Lpfjjxw54t+3b98VjuP6awUzIWRd07QrExMT33McZ2SzWVOSJLMayAaI4eFhlrpAVVUeIeTo6+sLtbS0TDAMs7uR7Wea5q+3b9++uLq6ui4IgqGqKsBYAwMDVqlbChBghRs3brAQhJIk8bquOw4fPhwMBoNTDMMEGgGgY03T/OX69esX3G63BhYJBoPm7OzspvgoQFAr+Hw+LhAIOHK5nHNwcHCS47i3KwHcvXsXybKMWlpaKjLm8/kvx8bGvtN1XQe3QIyUWsOGoLEgyzIHVlBVVTh//vwHHo8nWs0C0WgU9fT02L1Sgxi5f/9+97179xSWZQ1qjeHhYQhWuxUgwBWKovAcxzmcTqcwNDT0G8uyXf8VAubn8/nLY2NjX4M1EEJGKpXCZSFGRka4PXv28D6fz7F///4329vbY7V2Qj2WAAjLsmKjo6O9giBoLpfLKHVJwRLRaJTPZrP8zp07HadOnRrwer0/1grGeiEQQubU1FTr8+fP1xRFMQKBgFkcFzYEBCWNB4SQ0NfX94nH47lcDAFBCL2edunSpU3DlpaW3orH40uZTMZ4/PixGYlEMN2qlSA+9Xg8keI3ZTIZBL24zczMoLa2NrsXNzjcStvi4uKhhYWFPytCwO6g7hBFUTh37tyHW7Zs+bbWVzfgDhKLxdpisVhGlmV9fX19szteblE7MB0Oh9Db23uoubl5+v+CIIT8dfXq1S5N03SMcfmYoNmSbtHW1lbXyZMn4wihqpmyXksYhjF67dq1z2CLplIpSFgQE4VTdUOyQgjxsizzgiAIZ8+e/cLpdH5ezRrj4+Po4MGDqKOjo9owoijK8enp6djq6qrR1dVlQOrelCfoDoHje3l5mbcsy9HZ2env6emZYxjGX8st1Z5jjG+Oj49fxBjrz549M0u3ZyFjwg/qEoQQR0/QM2fOvLd169af4b9XASGEJB88eHB8bm5uBVL2S5GDSwXOhlMU5BwVM5C+PR4Pf/r06SG32/3VK4AoT548eX9ycnIBUnWlw2uDJYqtAce5IAicKIp2Fu3v73/X6/V+U69rMMa/Ly4ufnTnzp1lt9ttghsymQyorLIyr6y8o7oCQF68eMGDvOvu7m4Kh8MfC4IwyDBMcxn3EELIfDab/eHWrVs3LcvSQUNomobD4TAupyPoO8pCwEMKAiqb6kwQuqIoOo4ePRoWRbGD53kJDiPDMFJPnz79Y2Zm5m+MMZYkydaW0EF1VwPY5A5KRusNAIFaI51O24pb13Vb9m/btg3uGUkCBoR0XSder5ckk0ni9/uxoiiW0+m06lHaFSGKYWjtUVz4eL1eqEWY3bv/lZ3JZBJJkkSgCKKLh0KhQgFUqxKrWQaWKwGh/JNlecNc+Gq6MIBVqzNK46kmRPGE0mKY1qa03CsEWoOFcUMQr5Kw6pnzWkD8AxrTd08+b0laAAAAAElFTkSuQmCC";

/* script */
const __vue_script__$1j = script$1j;
var __vue_render__$1j = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Tabstheme3-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "suptitle" },
            [
              _c("div", { staticClass: "block1" }),
              _vm._v(" "),
              _c("div", { staticClass: "block2" }),
              _vm._v(" "),
              _c("div", { staticClass: "block3" }),
              _vm._v(" "),
              _c("div", { staticClass: "block4" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName1],
                  "block-data-name": _vm.titleTextDataName1,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "top-style" },
              [
                _vm._l(_vm.groupData.titleTextData, function (item, k) {
                  return _c(
                    "div",
                    {
                      key: k,
                      class: _vm.chooseindex == k ? "active" : "",
                      on: {
                        click: function ($event) {
                          return _vm.clicktabs(k)
                        },
                      },
                    },
                    [
                      _c("xml-text-render", {
                        key: _vm.timer,
                        attrs: {
                          "p-block-data": item,
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "data-index": k,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                      _vm._v(" "),
                      _vm.mode == "editor"
                        ? _c("img", {
                            staticClass: "deltabs",
                            attrs: {
                              src: __$_require_assets_images_closeicon_png__,
                            },
                            on: {
                              click: function ($event) {
                                return _vm.deltabs(k)
                              },
                            },
                          })
                        : _vm._e(),
                    ],
                    1
                  )
                }),
                _vm._v(" "),
                _vm.mode == "editor"
                  ? _c(
                      "span",
                      { staticClass: "addtabs", on: { click: _vm.addtabs } },
                      [
                        _c("img", {
                          attrs: {
                            src: __$_require_assets_images_addtabicon_png__,
                            alt: "",
                          },
                        }),
                      ]
                    )
                  : _vm._e(),
              ],
              2
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              _vm._l(_vm.groupData.bodyTextData, function (item, i) {
                return _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: _vm.chooseindex == i,
                        expression: "chooseindex==i",
                      },
                    ],
                    key: i,
                  },
                  [
                    _c("xml-text-render", {
                      key: _vm.timer,
                      attrs: {
                        "p-block-data": item,
                        "block-data-name": _vm.bodyTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "data-index": i,
                        "container-class": "text-body-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                )
              }),
              0
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1j = [];
__vue_render__$1j._withStripped = true;

  /* style */
  const __vue_inject_styles__$1j = undefined;
  /* scoped */
  const __vue_scope_id__$1j = "data-v-dbfd6912";
  /* module identifier */
  const __vue_module_identifier__$1j = undefined;
  /* functional template */
  const __vue_is_functional_template__$1j = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1j = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1j, staticRenderFns: __vue_staticRenderFns__$1j },
    __vue_inject_styles__$1j,
    __vue_script__$1j,
    __vue_scope_id__$1j,
    __vue_is_functional_template__$1j,
    __vue_module_identifier__$1j,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1i = {
  name: 'paragraphTabstheme4LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      titleTextDataName1: 'titleTextData1',
      groupData: {},
      tabslist: [],
      chooseindex: 0,
      timer: ''
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  watch: {
    pGroupData: {
      handler(newValue, oldValue) {
        this.$set(this.groupData, 'titleTextData', newValue.titleTextData);
        this.$set(this.groupData, 'bodyTextData', newValue.bodyTextData);
        this.handleLoad();
      },
      deep: true
    }
  },
  methods: {
    handleLoad() {
      this.timer = new Date().getTime();
    },
    clicktabs(e) {
      this.chooseindex = e;
    },
    addtabs() {
      // this.groupData.titleTextData.push({
      //       html: '<p style="font-size: 16px;font-family: PingFang SC;font-weight: bold;color: #000;">选项一</p>',
      // })
      // this.groupData.bodyTextData.push({
      //     html: '<p style="font-size: 16px;font-family: Microsoft YaHei;font-weight: 400;color: #333333;">夏天的风是蓝色的温柔。我时常仰望夏日天空，蓝得清澈。夏日的风，漫过无边无垠的往事，送来对未来的美好希望。</p>',
      // })
      this.$emit('addtabs', {
        ruleIndex: this.ruleIndex
      });
    },
    deltabs(index) {
      this.$emit('deltabs', {
        ruleIndex: this.ruleIndex,
        dataIndex: index
      });
      if (this.groupData.titleTextData.length == 0) {
        this.chooseindex = 0;
      } else {
        this.chooseindex = this.groupData.titleTextData.length - 1;
      }
    },
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data,
      dataIndex
    }) {
      console.log(ruleIndex, dataName, data);
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data,
        dataIndex
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1i = script$1i;
var __vue_render__$1i = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Tabstheme4-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-text" },
              _vm._l(_vm.groupData.bodyTextData, function (item, i) {
                return _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: _vm.chooseindex == i,
                        expression: "chooseindex==i",
                      },
                    ],
                    key: i,
                  },
                  [
                    _c("xml-text-render", {
                      key: _vm.timer,
                      attrs: {
                        "p-block-data": item,
                        "block-data-name": _vm.bodyTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "data-index": i,
                        "container-class": "text-body-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                )
              }),
              0
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "top-style" },
              [
                _vm._l(_vm.groupData.titleTextData, function (item, k) {
                  return _c(
                    "div",
                    {
                      key: k,
                      class: _vm.chooseindex == k ? "active" : "",
                      on: {
                        click: function ($event) {
                          return _vm.clicktabs(k)
                        },
                      },
                    },
                    [
                      _c("xml-text-render", {
                        key: _vm.timer,
                        attrs: {
                          "p-block-data": item,
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "data-index": k,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                      _vm._v(" "),
                      _vm.mode == "editor"
                        ? _c("img", {
                            staticClass: "deltabs",
                            attrs: {
                              src: __$_require_assets_images_closeicon_png__,
                            },
                            on: {
                              click: function ($event) {
                                return _vm.deltabs(k)
                              },
                            },
                          })
                        : _vm._e(),
                    ],
                    1
                  )
                }),
                _vm._v(" "),
                _vm.mode == "editor"
                  ? _c(
                      "span",
                      { staticClass: "addtabs", on: { click: _vm.addtabs } },
                      [
                        _c("img", {
                          attrs: {
                            src: __$_require_assets_images_addtabicon_png__,
                            alt: "",
                          },
                        }),
                      ]
                    )
                  : _vm._e(),
              ],
              2
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1i = [];
__vue_render__$1i._withStripped = true;

  /* style */
  const __vue_inject_styles__$1i = undefined;
  /* scoped */
  const __vue_scope_id__$1i = "data-v-40206aa4";
  /* module identifier */
  const __vue_module_identifier__$1i = undefined;
  /* functional template */
  const __vue_is_functional_template__$1i = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1i = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1i, staticRenderFns: __vue_staticRenderFns__$1i },
    __vue_inject_styles__$1i,
    __vue_script__$1i,
    __vue_scope_id__$1i,
    __vue_is_functional_template__$1i,
    __vue_module_identifier__$1i,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1h = {
  name: 'paragraphSanQintheme1LibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1h = script$1h;
/* template */
var __vue_render__$1h = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-SanQintheme1-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-text" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
                _vm._v(" "),
                _c("div", { staticClass: "left-top-image" }, [
                  _c("div", { staticClass: "left-bottom-block1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "left-bottom-block2" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "left-bottom-image" }, [
                  _c("div", { staticClass: "left-bottom-block1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "left-bottom-block2" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-top-image" }, [
                  _c("div", { staticClass: "left-bottom-block1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "left-bottom-block2" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-bottom-image" }, [
                  _c("div", { staticClass: "left-bottom-block1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "left-bottom-block2" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "top-line" }),
                _vm._v(" "),
                _c("div", { staticClass: "bottom-line" }),
                _vm._v(" "),
                _c("div", { staticClass: "left-line" }),
                _vm._v(" "),
                _c("div", { staticClass: "right-line" }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1h = [];
__vue_render__$1h._withStripped = true;

  /* style */
  const __vue_inject_styles__$1h = undefined;
  /* scoped */
  const __vue_scope_id__$1h = "data-v-611b2799";
  /* module identifier */
  const __vue_module_identifier__$1h = undefined;
  /* functional template */
  const __vue_is_functional_template__$1h = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1h = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1h, staticRenderFns: __vue_staticRenderFns__$1h },
    __vue_inject_styles__$1h,
    __vue_script__$1h,
    __vue_scope_id__$1h,
    __vue_is_functional_template__$1h,
    __vue_module_identifier__$1h,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$1g = {
  mixins: [singleGroupMixin],
  name: 'paragraphTwelveLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1g = script$1g;
/* template */
var __vue_render__$1g = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-twelve-library-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "left-top-img" }),
              _vm._v(" "),
              _c("div", { staticClass: "right-bottom-img" }),
              _vm._v(" "),
              _c("div", { staticClass: "left-top-clover" }, [
                _c(
                  "svg",
                  {
                    staticClass: "icon",
                    attrs: {
                      t: "1690358656753",
                      viewBox: "0 0 1024 1024",
                      version: "1.1",
                      xmlns: "http://www.w3.org/2000/svg",
                      "p-id": "8155",
                      width: "18",
                      height: "18",
                    },
                  },
                  [
                    _c("path", {
                      attrs: {
                        d: "M950.6 515.4c0.4-6 1.4-11.2 2.5-17.1 0 0 19.8-47.1-11.3-80.4-31.1-33.3-43.1-59.4-114.1-65-70.9-5.6-114-3-155 28.9-35.6 27.6-88.9 85.2-102.5 100.1-5-14.8-16.2-26.7-30.3-32.8 12.4-10.1 76.7-62.7 107.5-97.9 34.2-39.1 39.2-82 37.7-153.1s-26.9-84.6-58.3-117.6-79.6-15.9-79.6-15.9c-6.3 0.9-12 1.6-18.6 1.6v0.1c-6-0.4-11.3-1.3-17.1-2.3 0 0-47.4-19.1-80.2 12.5-32.8 31.6-58.8 44-63.3 115s-1.3 114 31.2 154.6c28.3 35.3 87.2 88.3 101.9 101.3-8.5 2.8-16.1 7.5-22.3 13.7-6.4 5.6-11.4 12.7-14.7 20.8-12-15.5-60.8-77.8-94.2-108.4-38.3-35.1-81-41.2-152.1-41.5-71.1-0.3-85.3 24.8-119 55.4-33.7 30.6-17.9 79.2-17.9 79.2 0.7 5.9 1.2 11.3 1.2 17.2H82c-0.5 6.5-1.6 12.1-2.9 18.4 0 0-20.2 46.9 10.5 80.5 30.8 33.6 42.5 59.8 113.4 66.1 70.9 6.3 114 4.1 155.3-27.3 37.2-28.3 94.1-88.9 105-100.6 5.2 14.5 16.3 26.4 30.7 32.4-15.8 12.6-76.8 61.9-106.8 95.5-34.6 38.8-40 81.6-39.3 152.7 0.8 71.1 26.1 84.9 57.2 118.2s79.4 16.7 79.4 16.7c5.9-0.7 11.2-1.4 17.2-1.4v0.1c6.5 0.4 12.1 1.4 18.4 2.6 0 0 47.2 19.6 80.3-11.7 33.1-31.3 59.2-43.4 64.4-114.4 5.2-71 2.4-114-29.6-154.9-28.1-35.8-87-89.8-101.1-102.5 7.7-2.8 14.7-7.3 20.4-13.1 5.9-5.2 10.6-11.6 13.8-18.9C580 537 629.9 599.5 663.8 630c38.6 34.8 81.4 40.4 152.5 40 71.1-0.4 85-25.7 118.5-56.6C968.3 582.5 952 534 952 534c-0.8-6.3-1.4-12-1.4-18.6z",
                        fill: _vm.groupData.themeColor,
                        "p-id": "8156",
                      },
                    }),
                  ]
                ),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "right-bottom-clover" }, [
                _c(
                  "svg",
                  {
                    staticClass: "icon",
                    attrs: {
                      t: "1690358656753",
                      viewBox: "0 0 1024 1024",
                      version: "1.1",
                      xmlns: "http://www.w3.org/2000/svg",
                      "p-id": "8155",
                      width: "18",
                      height: "18",
                    },
                  },
                  [
                    _c("path", {
                      attrs: {
                        d: "M950.6 515.4c0.4-6 1.4-11.2 2.5-17.1 0 0 19.8-47.1-11.3-80.4-31.1-33.3-43.1-59.4-114.1-65-70.9-5.6-114-3-155 28.9-35.6 27.6-88.9 85.2-102.5 100.1-5-14.8-16.2-26.7-30.3-32.8 12.4-10.1 76.7-62.7 107.5-97.9 34.2-39.1 39.2-82 37.7-153.1s-26.9-84.6-58.3-117.6-79.6-15.9-79.6-15.9c-6.3 0.9-12 1.6-18.6 1.6v0.1c-6-0.4-11.3-1.3-17.1-2.3 0 0-47.4-19.1-80.2 12.5-32.8 31.6-58.8 44-63.3 115s-1.3 114 31.2 154.6c28.3 35.3 87.2 88.3 101.9 101.3-8.5 2.8-16.1 7.5-22.3 13.7-6.4 5.6-11.4 12.7-14.7 20.8-12-15.5-60.8-77.8-94.2-108.4-38.3-35.1-81-41.2-152.1-41.5-71.1-0.3-85.3 24.8-119 55.4-33.7 30.6-17.9 79.2-17.9 79.2 0.7 5.9 1.2 11.3 1.2 17.2H82c-0.5 6.5-1.6 12.1-2.9 18.4 0 0-20.2 46.9 10.5 80.5 30.8 33.6 42.5 59.8 113.4 66.1 70.9 6.3 114 4.1 155.3-27.3 37.2-28.3 94.1-88.9 105-100.6 5.2 14.5 16.3 26.4 30.7 32.4-15.8 12.6-76.8 61.9-106.8 95.5-34.6 38.8-40 81.6-39.3 152.7 0.8 71.1 26.1 84.9 57.2 118.2s79.4 16.7 79.4 16.7c5.9-0.7 11.2-1.4 17.2-1.4v0.1c6.5 0.4 12.1 1.4 18.4 2.6 0 0 47.2 19.6 80.3-11.7 33.1-31.3 59.2-43.4 64.4-114.4 5.2-71 2.4-114-29.6-154.9-28.1-35.8-87-89.8-101.1-102.5 7.7-2.8 14.7-7.3 20.4-13.1 5.9-5.2 10.6-11.6 13.8-18.9C580 537 629.9 599.5 663.8 630c38.6 34.8 81.4 40.4 152.5 40 71.1-0.4 85-25.7 118.5-56.6C968.3 582.5 952 534 952 534c-0.8-6.3-1.4-12-1.4-18.6z",
                        fill: _vm.groupData.themeColor,
                        "p-id": "8156",
                      },
                    }),
                  ]
                ),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1g = [];
__vue_render__$1g._withStripped = true;

  /* style */
  const __vue_inject_styles__$1g = undefined;
  /* scoped */
  const __vue_scope_id__$1g = "data-v-071ca394";
  /* module identifier */
  const __vue_module_identifier__$1g = undefined;
  /* functional template */
  const __vue_is_functional_template__$1g = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1g = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1g, staticRenderFns: __vue_staticRenderFns__$1g },
    __vue_inject_styles__$1g,
    __vue_script__$1g,
    __vue_scope_id__$1g,
    __vue_is_functional_template__$1g,
    __vue_module_identifier__$1g,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1f = {
  name: 'paragraphFoldtheme4LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    console.log(this.pGroupData, '组件内部');
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1f = script$1f;
/* template */
var __vue_render__$1f = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Foldtheme4-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "top-title-style" }, [
              _c(
                "div",
                { staticClass: "title-body-box" },
                [
                  _c("div", { staticClass: "line" }),
                  _vm._v(" "),
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "line" }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "body-text" }, [
              _c(
                "div",
                { class: !_vm.isFold ? "body-text-fold" : "" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "seemore", on: { click: _vm.changepanel } },
                [
                  _c("span", [
                    _vm._v(_vm._s(!_vm.isFold ? "查看更多" : "收起")),
                  ]),
                ]
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1f = [];
__vue_render__$1f._withStripped = true;

  /* style */
  const __vue_inject_styles__$1f = undefined;
  /* scoped */
  const __vue_scope_id__$1f = "data-v-96798a4c";
  /* module identifier */
  const __vue_module_identifier__$1f = undefined;
  /* functional template */
  const __vue_is_functional_template__$1f = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1f = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1f, staticRenderFns: __vue_staticRenderFns__$1f },
    __vue_inject_styles__$1f,
    __vue_script__$1f,
    __vue_scope_id__$1f,
    __vue_is_functional_template__$1f,
    __vue_module_identifier__$1f,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1e = {
  name: 'paragraphFoldtheme5LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    console.log(this.pGroupData, '组件内部');
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1e = script$1e;
/* template */
var __vue_render__$1e = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Foldtheme5-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "top-title-style" }, [
              _c(
                "div",
                { staticClass: "title-body-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "body-text" }, [
              _c(
                "div",
                { class: !_vm.isFold ? "body-text-fold" : "" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "seemore", on: { click: _vm.changepanel } },
                [
                  _c("span", [
                    _vm._v(_vm._s(!_vm.isFold ? "查看更多" : "收起")),
                  ]),
                ]
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1e = [];
__vue_render__$1e._withStripped = true;

  /* style */
  const __vue_inject_styles__$1e = undefined;
  /* scoped */
  const __vue_scope_id__$1e = "data-v-3814d84a";
  /* module identifier */
  const __vue_module_identifier__$1e = undefined;
  /* functional template */
  const __vue_is_functional_template__$1e = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1e = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1e, staticRenderFns: __vue_staticRenderFns__$1e },
    __vue_inject_styles__$1e,
    __vue_script__$1e,
    __vue_scope_id__$1e,
    __vue_is_functional_template__$1e,
    __vue_module_identifier__$1e,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1d = {
  name: 'paragraphTabstheme5LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      titleTextDataName1: 'titleTextData1',
      groupData: {},
      tabslist: [],
      chooseindex: 0,
      timer: ''
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  watch: {
    pGroupData: {
      handler(newValue, oldValue) {
        this.$set(this.groupData, 'titleTextData', newValue.titleTextData);
        this.$set(this.groupData, 'bodyTextData', newValue.bodyTextData);
        this.handleLoad();
      },
      deep: true
    }
  },
  methods: {
    handleLoad() {
      this.timer = new Date().getTime();
    },
    clicktabs(e) {
      this.chooseindex = e;
    },
    addtabs() {
      // this.groupData.titleTextData.push({
      //       html: '<p style="font-size: 16px;font-family: PingFang SC;font-weight: bold;color: #000;">选项一</p>',
      // })
      // this.groupData.bodyTextData.push({
      //     html: '<p style="font-size: 16px;font-family: Microsoft YaHei;font-weight: 400;color: #333333;">夏天的风是蓝色的温柔。我时常仰望夏日天空，蓝得清澈。夏日的风，漫过无边无垠的往事，送来对未来的美好希望。</p>',
      // })
      this.$emit('addtabs', {
        ruleIndex: this.ruleIndex
      });
    },
    deltabs(index) {
      this.$emit('deltabs', {
        ruleIndex: this.ruleIndex,
        dataIndex: index
      });
      if (this.groupData.titleTextData.length == 0) {
        this.chooseindex = 0;
      } else {
        this.chooseindex = this.groupData.titleTextData.length - 1;
      }
    },
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data,
      dataIndex
    }) {
      console.log(ruleIndex, dataName, data);
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data,
        dataIndex
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1d = script$1d;
var __vue_render__$1d = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Tabstheme5-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "top-style" },
            [
              _vm._l(_vm.groupData.titleTextData, function (item, k) {
                return _c(
                  "div",
                  {
                    key: k,
                    on: {
                      click: function ($event) {
                        return _vm.clicktabs(k)
                      },
                    },
                  },
                  [
                    _c("xml-text-render", {
                      key: _vm.timer,
                      class: _vm.chooseindex == k ? "active" : "",
                      attrs: {
                        "p-block-data": item,
                        "block-data-name": _vm.titleTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "data-index": k,
                        "container-class": "text-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        resourceBasisPath: _vm.resourceBasisPath,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                    _vm._v(" "),
                    _vm.mode == "editor"
                      ? _c("img", {
                          staticClass: "deltabs",
                          attrs: {
                            src: __$_require_assets_images_closeicon_png__,
                          },
                          on: {
                            click: function ($event) {
                              return _vm.deltabs(k)
                            },
                          },
                        })
                      : _vm._e(),
                  ],
                  1
                )
              }),
              _vm._v(" "),
              _vm.mode == "editor"
                ? _c(
                    "span",
                    { staticClass: "addtabs", on: { click: _vm.addtabs } },
                    [
                      _c("img", {
                        attrs: {
                          src: __$_require_assets_images_addtabicon_png__,
                          alt: "",
                        },
                      }),
                    ]
                  )
                : _vm._e(),
            ],
            2
          ),
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "body-text" },
              _vm._l(_vm.groupData.bodyTextData, function (item, i) {
                return _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: _vm.chooseindex == i,
                        expression: "chooseindex==i",
                      },
                    ],
                    key: i,
                  },
                  [
                    _c("xml-text-render", {
                      key: _vm.timer,
                      attrs: {
                        "p-block-data": item,
                        "block-data-name": _vm.bodyTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "data-index": i,
                        "container-class": "text-body-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                )
              }),
              0
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1d = [];
__vue_render__$1d._withStripped = true;

  /* style */
  const __vue_inject_styles__$1d = undefined;
  /* scoped */
  const __vue_scope_id__$1d = "data-v-1578b545";
  /* module identifier */
  const __vue_module_identifier__$1d = undefined;
  /* functional template */
  const __vue_is_functional_template__$1d = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1d = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1d, staticRenderFns: __vue_staticRenderFns__$1d },
    __vue_inject_styles__$1d,
    __vue_script__$1d,
    __vue_scope_id__$1d,
    __vue_is_functional_template__$1d,
    __vue_module_identifier__$1d,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1c = {
  name: 'paragraphTabstheme6LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      titleTextDataName1: 'titleTextData1',
      groupData: {},
      tabslist: [],
      chooseindex: 0,
      timer: ''
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  watch: {
    pGroupData: {
      handler(newValue, oldValue) {
        this.$set(this.groupData, 'titleTextData', newValue.titleTextData);
        this.$set(this.groupData, 'bodyTextData', newValue.bodyTextData);
        this.handleLoad();
      },
      deep: true
    }
  },
  methods: {
    handleLoad() {
      this.timer = new Date().getTime();
    },
    clicktabs(e) {
      this.chooseindex = e;
    },
    addtabs() {
      // this.groupData.titleTextData.push({
      //       html: '<p style="font-size: 16px;font-family: PingFang SC;font-weight: bold;color: #000;">选项一</p>',
      // })
      // this.groupData.bodyTextData.push({
      //     html: '<p style="font-size: 16px;font-family: Microsoft YaHei;font-weight: 400;color: #333333;">夏天的风是蓝色的温柔。我时常仰望夏日天空，蓝得清澈。夏日的风，漫过无边无垠的往事，送来对未来的美好希望。</p>',
      // })
      this.$emit('addtabs', {
        ruleIndex: this.ruleIndex
      });
    },
    deltabs(index) {
      this.$emit('deltabs', {
        ruleIndex: this.ruleIndex,
        dataIndex: index
      });
      if (this.groupData.titleTextData.length == 0) {
        this.chooseindex = 0;
      } else {
        this.chooseindex = this.groupData.titleTextData.length - 1;
      }
    },
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data,
      dataIndex
    }) {
      console.log(ruleIndex, dataName, data);
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data,
        dataIndex
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1c = script$1c;
var __vue_render__$1c = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Tabstheme6-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "suptitle" },
            [
              _c("div", { staticClass: "block1" }),
              _vm._v(" "),
              _c("div", { staticClass: "block2" }),
              _vm._v(" "),
              _c("div", { staticClass: "block3" }),
              _vm._v(" "),
              _c("div", { staticClass: "block4" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.titleTextDataName1],
                  "block-data-name": _vm.titleTextDataName1,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  resourceBasisPath: _vm.resourceBasisPath,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c(
              "div",
              { staticClass: "top-style" },
              [
                _vm._l(_vm.groupData.titleTextData, function (item, k) {
                  return _c(
                    "div",
                    {
                      key: k,
                      class: _vm.chooseindex == k ? "active" : "",
                      on: {
                        click: function ($event) {
                          return _vm.clicktabs(k)
                        },
                      },
                    },
                    [
                      _c("xml-text-render", {
                        key: _vm.timer,
                        attrs: {
                          "p-block-data": item,
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "data-index": k,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                      _vm._v(" "),
                      _vm.mode == "editor"
                        ? _c("img", {
                            staticClass: "deltabs",
                            attrs: {
                              src: __$_require_assets_images_closeicon_png__,
                            },
                            on: {
                              click: function ($event) {
                                return _vm.deltabs(k)
                              },
                            },
                          })
                        : _vm._e(),
                    ],
                    1
                  )
                }),
                _vm._v(" "),
                _vm.mode == "editor"
                  ? _c(
                      "span",
                      { staticClass: "addtabs", on: { click: _vm.addtabs } },
                      [
                        _c("img", {
                          attrs: {
                            src: __$_require_assets_images_addtabicon_png__,
                            alt: "",
                          },
                        }),
                      ]
                    )
                  : _vm._e(),
              ],
              2
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "body-text" },
              _vm._l(_vm.groupData.bodyTextData, function (item, i) {
                return _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: _vm.chooseindex == i,
                        expression: "chooseindex==i",
                      },
                    ],
                    key: i,
                  },
                  [
                    _c("xml-text-render", {
                      key: _vm.timer,
                      attrs: {
                        "p-block-data": item,
                        "block-data-name": _vm.bodyTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "data-index": i,
                        "container-class": "text-body-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                )
              }),
              0
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1c = [];
__vue_render__$1c._withStripped = true;

  /* style */
  const __vue_inject_styles__$1c = undefined;
  /* scoped */
  const __vue_scope_id__$1c = "data-v-64298cd1";
  /* module identifier */
  const __vue_module_identifier__$1c = undefined;
  /* functional template */
  const __vue_is_functional_template__$1c = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1c = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1c, staticRenderFns: __vue_staticRenderFns__$1c },
    __vue_inject_styles__$1c,
    __vue_script__$1c,
    __vue_scope_id__$1c,
    __vue_is_functional_template__$1c,
    __vue_module_identifier__$1c,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1b = {
  name: 'paragraphFortytwoLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1b = script$1b;
/* template */
var __vue_render__$1b = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Fortytwo-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "top-line" }),
              _vm._v(" "),
              _c("div", { staticClass: "left-line" }),
              _vm._v(" "),
              _c("div", { staticClass: "bottom-line" }),
              _vm._v(" "),
              _c("div", { staticClass: "right-line" }),
              _vm._v(" "),
              _c("div", { staticClass: "right-bottom-triangle" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1b = [];
__vue_render__$1b._withStripped = true;

  /* style */
  const __vue_inject_styles__$1b = undefined;
  /* scoped */
  const __vue_scope_id__$1b = "data-v-19ee68e5";
  /* module identifier */
  const __vue_module_identifier__$1b = undefined;
  /* functional template */
  const __vue_is_functional_template__$1b = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1b = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1b, staticRenderFns: __vue_staticRenderFns__$1b },
    __vue_inject_styles__$1b,
    __vue_script__$1b,
    __vue_scope_id__$1b,
    __vue_is_functional_template__$1b,
    __vue_module_identifier__$1b,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$1a = {
  name: 'paragraphFortythreeLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$1a = script$1a;
/* template */
var __vue_render__$1a = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Fortythree-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "top-round" }),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "top-right-triangle" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$1a = [];
__vue_render__$1a._withStripped = true;

  /* style */
  const __vue_inject_styles__$1a = undefined;
  /* scoped */
  const __vue_scope_id__$1a = "data-v-b16f7aba";
  /* module identifier */
  const __vue_module_identifier__$1a = undefined;
  /* functional template */
  const __vue_is_functional_template__$1a = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1a = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1a, staticRenderFns: __vue_staticRenderFns__$1a },
    __vue_inject_styles__$1a,
    __vue_script__$1a,
    __vue_scope_id__$1a,
    __vue_is_functional_template__$1a,
    __vue_module_identifier__$1a,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$19 = {
  name: 'paragraphFortyfourLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$19 = script$19;
/* template */
var __vue_render__$19 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Fortyfour-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "body-text" },
            [
              _c("div", { staticClass: "top-round" }, [
                _c(
                  "svg",
                  {
                    staticClass: "icon",
                    attrs: {
                      t: "1691747531614",
                      viewBox: "0 0 1024 1024",
                      version: "1.1",
                      xmlns: "http://www.w3.org/2000/svg",
                      "p-id": "4801",
                      width: "32",
                      height: "32",
                    },
                  },
                  [
                    _c("path", {
                      attrs: {
                        d: "M470.72 140.032a259.584 259.584 0 0 1 377.216 356.352l-10.112 10.688-408.384 408.384a152 152 0 0 1-223.04-206.144l8.128-8.768 403.968-403.968a50.56 50.56 0 0 1 76.48 65.92l-4.928 5.632-403.968 404.032a50.752 50.752 0 0 0 66.112 76.672l5.632-4.928 408.384-408.32A158.336 158.336 0 0 0 551.04 203.52l-8.704 8.064L214.4 539.52A50.56 50.56 0 0 1 137.92 473.6l4.928-5.696 327.872-327.872z",
                        fill: _vm.groupData.themeColor,
                        "p-id": "4802",
                      },
                    }),
                  ]
                ),
              ]),
              _vm._v(" "),
              _c("xml-text-render", {
                attrs: {
                  "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                  "block-data-name": _vm.bodyTextDataName,
                  "extend-params": _vm.extendParams,
                  "current-rule": _vm.currentRule,
                  "rule-index": _vm.ruleIndex,
                  "container-class": "text-body-container",
                  "editor-class": "editor",
                  mode: _vm.mode,
                  "page-type": _vm.pageType,
                  scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                },
                on: {
                  blockclick: _vm.handleBlockClick,
                  groupDataChange: _vm.groupDataChange,
                },
                scopedSlots: _vm._u(
                  [
                    _vm._l(_vm.$scopedSlots, function (index, name) {
                      return {
                        key: name,
                        fn: function (deliver) {
                          return [_vm._t(name, null, null, deliver)]
                        },
                      }
                    }),
                  ],
                  null,
                  true
                ),
              }),
              _vm._v(" "),
              _c("div", { staticClass: "top-right-triangle" }),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$19 = [];
__vue_render__$19._withStripped = true;

  /* style */
  const __vue_inject_styles__$19 = undefined;
  /* scoped */
  const __vue_scope_id__$19 = "data-v-783c9a27";
  /* module identifier */
  const __vue_module_identifier__$19 = undefined;
  /* functional template */
  const __vue_is_functional_template__$19 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$19 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$19, staticRenderFns: __vue_staticRenderFns__$19 },
    __vue_inject_styles__$19,
    __vue_script__$19,
    __vue_scope_id__$19,
    __vue_is_functional_template__$19,
    __vue_module_identifier__$19,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$18 = {
  name: 'paragraphFortyfiveLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    console.log(this.pGroupData, '组件内部');
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$18 = script$18;
/* template */
var __vue_render__$18 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Fortyfive-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "top-title-style" }, [
              _c(
                "div",
                { staticClass: "title-body-box" },
                [
                  _c("div", { staticClass: "line" }),
                  _vm._v(" "),
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "line" }),
                ],
                1
              ),
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "body-text" }, [
              _c(
                "div",
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$18 = [];
__vue_render__$18._withStripped = true;

  /* style */
  const __vue_inject_styles__$18 = undefined;
  /* scoped */
  const __vue_scope_id__$18 = "data-v-5c95e048";
  /* module identifier */
  const __vue_module_identifier__$18 = undefined;
  /* functional template */
  const __vue_is_functional_template__$18 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$18 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$18, staticRenderFns: __vue_staticRenderFns__$18 },
    __vue_inject_styles__$18,
    __vue_script__$18,
    __vue_scope_id__$18,
    __vue_is_functional_template__$18,
    __vue_module_identifier__$18,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$17 = {
  name: 'paragraphFortysixLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：prediv 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    console.log(this.pGroupData, '组件内部');
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$17 = script$17;
/* template */
var __vue_render__$17 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Fortysix-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text" }, [
            _c("div", { staticClass: "custom-border left-border" }, [
              _c("div", { staticClass: "cir1" }),
              _vm._v(" "),
              _c("div", { staticClass: "cir2" }),
              _vm._v(" "),
              _c("div", { staticClass: "cir3" }),
              _vm._v(" "),
              _c("div", { staticClass: "cir4" }),
              _vm._v(" "),
              _c("div", { staticClass: "cir5" }),
            ]),
            _vm._v(" "),
            _c(
              "div",
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c("div", { staticClass: "custom-border right-border" }, [
              _c("div", { staticClass: "cir1" }),
              _vm._v(" "),
              _c("div", { staticClass: "cir2" }),
              _vm._v(" "),
              _c("div", { staticClass: "cir3" }),
              _vm._v(" "),
              _c("div", { staticClass: "cir4" }),
              _vm._v(" "),
              _c("div", { staticClass: "cir5" }),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$17 = [];
__vue_render__$17._withStripped = true;

  /* style */
  const __vue_inject_styles__$17 = undefined;
  /* scoped */
  const __vue_scope_id__$17 = "data-v-0eba7d14";
  /* module identifier */
  const __vue_module_identifier__$17 = undefined;
  /* functional template */
  const __vue_is_functional_template__$17 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$17 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$17, staticRenderFns: __vue_staticRenderFns__$17 },
    __vue_inject_styles__$17,
    __vue_script__$17,
    __vue_scope_id__$17,
    __vue_is_functional_template__$17,
    __vue_module_identifier__$17,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$16 = {
  name: 'paragraphFortysevenLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：prediv 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    console.log(this.pGroupData, '组件内部');
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$16 = script$16;
/* template */
var __vue_render__$16 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Fortyseven-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text" }, [
            _c(
              "div",
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$16 = [];
__vue_render__$16._withStripped = true;

  /* style */
  const __vue_inject_styles__$16 = undefined;
  /* scoped */
  const __vue_scope_id__$16 = "data-v-55630702";
  /* module identifier */
  const __vue_module_identifier__$16 = undefined;
  /* functional template */
  const __vue_is_functional_template__$16 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$16 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$16, staticRenderFns: __vue_staticRenderFns__$16 },
    __vue_inject_styles__$16,
    __vue_script__$16,
    __vue_scope_id__$16,
    __vue_is_functional_template__$16,
    __vue_module_identifier__$16,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$15 = {
  name: 'paragraphFortyeightLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      bodyTextDataName: 'bodyTextData',
      titleTextDataName: 'titleTextData',
      groupData: {},
      isFold: this.isExpand //是否折叠
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    isExpand: {
      //是否展开
      type: Boolean,
      default: false
    }
  },
  created() {
    console.log(this.pGroupData, '组件内部');
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    },
    changepanel() {
      this.isFold = !this.isFold;
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$15 = script$15;
/* template */
var __vue_render__$15 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-Fortyeight-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "body-text-bg" }, [
            _c("div", { staticClass: "body-text" }, [
              _c(
                "div",
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$15 = [];
__vue_render__$15._withStripped = true;

  /* style */
  const __vue_inject_styles__$15 = undefined;
  /* scoped */
  const __vue_scope_id__$15 = "data-v-61e12b8a";
  /* module identifier */
  const __vue_module_identifier__$15 = undefined;
  /* functional template */
  const __vue_is_functional_template__$15 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$15 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$15, staticRenderFns: __vue_staticRenderFns__$15 },
    __vue_inject_styles__$15,
    __vue_script__$15,
    __vue_scope_id__$15,
    __vue_is_functional_template__$15,
    __vue_module_identifier__$15,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$14 = {
  mixins: [singleGroupMixin],
  name: 'paragraphSixteenNewLibraryRender',
  components: {
    XmlTextRender: __vue_component__$65
  },
  data() {
    return {
      typeText: '段落',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      numberTextDataName: 'numberTextData',
      bodyTextDataName: 'bodyTextData',
      bodyTextDataName2: 'bodyTextData2',
      bodyTextDataName3: 'bodyTextData3',
      titleTextDataName: 'titleTextData',
      titleTextDataName2: 'titleTextData2',
      titleTextDataName3: 'titleTextData3',
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  },
  mounted() {}
};

/* script */
const __vue_script__$14 = script$14;
/* template */
var __vue_render__$14 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-paragraph-sixteennew-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("div", { staticClass: "paragraph-row-box" }, [
            _c(
              "div",
              { staticClass: "paragraph-subtitle-box" },
              [
                _c("div", { staticClass: "subtitle-left-dec" }),
                _vm._v(" "),
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.titleTextDataName],
                    "block-data-name": _vm.titleTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
            _vm._v(" "),
            _c(
              "div",
              { staticClass: "text-body-box" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$14 = [];
__vue_render__$14._withStripped = true;

  /* style */
  const __vue_inject_styles__$14 = undefined;
  /* scoped */
  const __vue_scope_id__$14 = "data-v-58c62fd2";
  /* module identifier */
  const __vue_module_identifier__$14 = undefined;
  /* functional template */
  const __vue_is_functional_template__$14 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$14 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$14, staticRenderFns: __vue_staticRenderFns__$14 },
    __vue_inject_styles__$14,
    __vue_script__$14,
    __vue_scope_id__$14,
    __vue_is_functional_template__$14,
    __vue_module_identifier__$14,
    false,
    undefined,
    undefined,
    undefined
  );

const TitleComponents$2 = [__vue_component__$1R, __vue_component__$1Q, __vue_component__$1P, __vue_component__$1O, __vue_component__$1N, __vue_component__$1M, __vue_component__$1L, __vue_component__$1K, __vue_component__$1J, __vue_component__$1I, __vue_component__$1H, __vue_component__$1G, __vue_component__$1F, __vue_component__$1E, __vue_component__$1D, __vue_component__$1C, __vue_component__$1B, __vue_component__$1A, __vue_component__$1z, __vue_component__$1y, __vue_component__$1x, __vue_component__$1w, __vue_component__$1v, __vue_component__$1u, __vue_component__$1t, __vue_component__$1s, __vue_component__$1r, __vue_component__$1q, __vue_component__$1p, __vue_component__$1o, __vue_component__$1n, __vue_component__$1m, __vue_component__$1l, __vue_component__$1k, __vue_component__$1j, __vue_component__$1i, __vue_component__$1h, __vue_component__$1g, __vue_component__$1f, __vue_component__$1e, __vue_component__$1d, __vue_component__$1c, __vue_component__$1b, __vue_component__$1a, __vue_component__$19, __vue_component__$18, __vue_component__$17, __vue_component__$16, __vue_component__$15, __vue_component__$14];
var xmlParagraphLibrary = {
  // install,
  ...TitleComponents$2
};

//
/**
 * 单图片组合
 */
var script$13 = {
  name: 'imageTextFirstLibraryRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$13 = script$13;
/* template */
var __vue_render__$13 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-first-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticStyle: {
                background: "var(--background-color)",
                "border-radius": "6px",
                padding: "9px 11px",
              },
            },
            [
              _c(
                "div",
                { staticStyle: { display: "flex", "flex-wrap": "nowrap" } },
                [
                  _c(
                    "div",
                    [
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.titleTextDataName],
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                      _vm._v(" "),
                      _c("xml-image-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                          "block-data-name": _vm.imageBlockDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "image-container",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                        },
                        on: { blockclick: _vm.handleBlockClick },
                      }),
                      _vm._v(" "),
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                          "block-data-name": _vm.bodyTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-body-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                ]
              ),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$13 = [];
__vue_render__$13._withStripped = true;

  /* style */
  const __vue_inject_styles__$13 = undefined;
  /* scoped */
  const __vue_scope_id__$13 = "data-v-6d554f28";
  /* module identifier */
  const __vue_module_identifier__$13 = undefined;
  /* functional template */
  const __vue_is_functional_template__$13 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$13 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$13, staticRenderFns: __vue_staticRenderFns__$13 },
    __vue_inject_styles__$13,
    __vue_script__$13,
    __vue_scope_id__$13,
    __vue_is_functional_template__$13,
    __vue_module_identifier__$13,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$12 = {
  name: 'imageTextSecondLibraryRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$12 = script$12;
/* template */
var __vue_render__$12 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-second-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticStyle: { display: "flex", "align-items": "center" } },
            [
              _c(
                "div",
                { staticClass: "image-box" },
                [
                  _c("xml-image-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                      "block-data-name": _vm.imageBlockDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "image-container",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "title-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.titleTextDataName],
                      "block-data-name": _vm.titleTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: { blockclick: _vm.handleBlockClick },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]
          ),
          _vm._v(" "),
          _c("div", { staticClass: "body-box" }, [
            _c(
              "div",
              { staticClass: "body-box-inner" },
              [
                _c("xml-text-render", {
                  attrs: {
                    "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                    "block-data-name": _vm.bodyTextDataName,
                    "extend-params": _vm.extendParams,
                    "current-rule": _vm.currentRule,
                    "rule-index": _vm.ruleIndex,
                    "container-class": "text-body-container",
                    "editor-class": "editor",
                    mode: _vm.mode,
                    "page-type": _vm.pageType,
                    resourceBasisPath: _vm.resourceBasisPath,
                    scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                  },
                  on: {
                    blockclick: _vm.handleBlockClick,
                    groupDataChange: _vm.groupDataChange,
                  },
                  scopedSlots: _vm._u(
                    [
                      _vm._l(_vm.$scopedSlots, function (index, name) {
                        return {
                          key: name,
                          fn: function (deliver) {
                            return [_vm._t(name, null, null, deliver)]
                          },
                        }
                      }),
                    ],
                    null,
                    true
                  ),
                }),
              ],
              1
            ),
          ]),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$12 = [];
__vue_render__$12._withStripped = true;

  /* style */
  const __vue_inject_styles__$12 = undefined;
  /* scoped */
  const __vue_scope_id__$12 = "data-v-ff178ba6";
  /* module identifier */
  const __vue_module_identifier__$12 = undefined;
  /* functional template */
  const __vue_is_functional_template__$12 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$12 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$12, staticRenderFns: __vue_staticRenderFns__$12 },
    __vue_inject_styles__$12,
    __vue_script__$12,
    __vue_scope_id__$12,
    __vue_is_functional_template__$12,
    __vue_module_identifier__$12,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$11 = {
  name: 'imageTextThirdLibraryRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$11 = script$11;
/* template */
var __vue_render__$11 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-third-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticStyle: {
                "border-radius": "6px",
                padding: "9px 11px",
                "background-color": "var(--background-color)",
              },
            },
            [
              _c(
                "div",
                {
                  staticStyle: {
                    display: "flex",
                    "flex-wrap": "nowrap",
                    "justify-content": "space-between",
                    "align-items": "center",
                  },
                },
                [
                  _c(
                    "div",
                    { staticStyle: { width: "48%" } },
                    [
                      _c("xml-image-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                          "block-data-name": _vm.imageBlockDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "image-container",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                        },
                        on: { blockclick: _vm.handleBlockClick },
                      }),
                    ],
                    1
                  ),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticStyle: { width: "48%" } },
                    [
                      _vm.groupData.showTitle != "0"
                        ? _c("xml-text-render", {
                            attrs: {
                              "p-block-data":
                                _vm.groupData[_vm.titleTextDataName],
                              "block-data-name": _vm.titleTextDataName,
                              "extend-params": _vm.extendParams,
                              "current-rule": _vm.currentRule,
                              "rule-index": _vm.ruleIndex,
                              "container-class": "text-container",
                              "editor-class": "editor",
                              mode: _vm.mode,
                              "page-type": _vm.pageType,
                              resourceBasisPath: _vm.resourceBasisPath,
                              scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                            },
                            on: {
                              blockclick: _vm.handleBlockClick,
                              groupDataChange: _vm.groupDataChange,
                            },
                            scopedSlots: _vm._u(
                              [
                                _vm._l(
                                  _vm.$scopedSlots,
                                  function (index, name) {
                                    return {
                                      key: name,
                                      fn: function (deliver) {
                                        return [
                                          _vm._t(name, null, null, deliver),
                                        ]
                                      },
                                    }
                                  }
                                ),
                              ],
                              null,
                              true
                            ),
                          })
                        : _vm._e(),
                      _vm._v(" "),
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                          "block-data-name": _vm.bodyTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-body-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                ]
              ),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$11 = [];
__vue_render__$11._withStripped = true;

  /* style */
  const __vue_inject_styles__$11 = undefined;
  /* scoped */
  const __vue_scope_id__$11 = "data-v-3413b0cc";
  /* module identifier */
  const __vue_module_identifier__$11 = undefined;
  /* functional template */
  const __vue_is_functional_template__$11 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$11 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$11, staticRenderFns: __vue_staticRenderFns__$11 },
    __vue_inject_styles__$11,
    __vue_script__$11,
    __vue_scope_id__$11,
    __vue_is_functional_template__$11,
    __vue_module_identifier__$11,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$10 = {
  name: 'imageTextFourthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$10 = script$10;
/* template */
var __vue_render__$10 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-fourth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticStyle: { "border-radius": "6px", padding: "9px 11px" } },
            [
              _c(
                "div",
                { staticClass: "iamge-bg-box" },
                [
                  _c("xml-image-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                      "block-data-name": _vm.imageBlockDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "image-container",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                    },
                    on: { blockclick: _vm.handleBlockClick },
                  }),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "image-text-box" },
                    [
                      _c(
                        "div",
                        { staticClass: "image-top-title" },
                        [
                          _c("xml-text-render", {
                            attrs: {
                              "p-block-data":
                                _vm.groupData[_vm.numberTextDataName],
                              "block-data-name": _vm.numberTextDataName,
                              "extend-params": _vm.extendParams,
                              "current-rule": _vm.currentRule,
                              "rule-index": _vm.ruleIndex,
                              "container-class": "text-container-number",
                              "editor-class": "editor",
                              mode: _vm.mode,
                              "page-type": _vm.pageType,
                              resourceBasisPath: _vm.resourceBasisPath,
                              scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                            },
                            on: {
                              blockclick: _vm.handleBlockClick,
                              groupDataChange: _vm.groupDataChange,
                            },
                            scopedSlots: _vm._u(
                              [
                                _vm._l(
                                  _vm.$scopedSlots,
                                  function (index, name) {
                                    return {
                                      key: name,
                                      fn: function (deliver) {
                                        return [
                                          _vm._t(name, null, null, deliver),
                                        ]
                                      },
                                    }
                                  }
                                ),
                              ],
                              null,
                              true
                            ),
                          }),
                          _vm._v(" "),
                          _c("xml-text-render", {
                            attrs: {
                              "p-block-data":
                                _vm.groupData[_vm.titleTextDataName],
                              "block-data-name": _vm.titleTextDataName,
                              "extend-params": _vm.extendParams,
                              "current-rule": _vm.currentRule,
                              "rule-index": _vm.ruleIndex,
                              "container-class": "text-container",
                              "editor-class": "editor",
                              mode: _vm.mode,
                              "page-type": _vm.pageType,
                              resourceBasisPath: _vm.resourceBasisPath,
                              scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                            },
                            on: {
                              blockclick: _vm.handleBlockClick,
                              groupDataChange: _vm.groupDataChange,
                            },
                            scopedSlots: _vm._u(
                              [
                                _vm._l(
                                  _vm.$scopedSlots,
                                  function (index, name) {
                                    return {
                                      key: name,
                                      fn: function (deliver) {
                                        return [
                                          _vm._t(name, null, null, deliver),
                                        ]
                                      },
                                    }
                                  }
                                ),
                              ],
                              null,
                              true
                            ),
                          }),
                        ],
                        1
                      ),
                      _vm._v(" "),
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                          "block-data-name": _vm.bodyTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-body-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                ],
                1
              ),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$10 = [];
__vue_render__$10._withStripped = true;

  /* style */
  const __vue_inject_styles__$10 = undefined;
  /* scoped */
  const __vue_scope_id__$10 = "data-v-0dbbaaae";
  /* module identifier */
  const __vue_module_identifier__$10 = undefined;
  /* functional template */
  const __vue_is_functional_template__$10 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$10 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$10, staticRenderFns: __vue_staticRenderFns__$10 },
    __vue_inject_styles__$10,
    __vue_script__$10,
    __vue_scope_id__$10,
    __vue_is_functional_template__$10,
    __vue_module_identifier__$10,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$$ = {
  name: 'imageTextFifthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$$ = script$$;
/* template */
var __vue_render__$$ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-fifth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticStyle: { "border-radius": "6px", padding: "9px 11px" } },
            [
              _c(
                "div",
                { staticClass: "iamge-bg-box" },
                [
                  _c(
                    "div",
                    { staticClass: "image-top-title" },
                    [
                      _c("xml-text-render", {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.titleTextDataName],
                          "block-data-name": _vm.titleTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      }),
                    ],
                    1
                  ),
                  _vm._v(" "),
                  _c("xml-image-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                      "block-data-name": _vm.imageBlockDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "image-container",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                    },
                    on: { blockclick: _vm.handleBlockClick },
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "image-text-box" },
                [
                  _c("xml-text-render", {
                    attrs: {
                      "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                      "block-data-name": _vm.bodyTextDataName,
                      "extend-params": _vm.extendParams,
                      "current-rule": _vm.currentRule,
                      "rule-index": _vm.ruleIndex,
                      "container-class": "text-body-container",
                      "editor-class": "editor",
                      mode: _vm.mode,
                      "page-type": _vm.pageType,
                      resourceBasisPath: _vm.resourceBasisPath,
                      scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                    },
                    on: {
                      blockclick: _vm.handleBlockClick,
                      groupDataChange: _vm.groupDataChange,
                    },
                    scopedSlots: _vm._u(
                      [
                        _vm._l(_vm.$scopedSlots, function (index, name) {
                          return {
                            key: name,
                            fn: function (deliver) {
                              return [_vm._t(name, null, null, deliver)]
                            },
                          }
                        }),
                      ],
                      null,
                      true
                    ),
                  }),
                ],
                1
              ),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$$ = [];
__vue_render__$$._withStripped = true;

  /* style */
  const __vue_inject_styles__$$ = undefined;
  /* scoped */
  const __vue_scope_id__$$ = "data-v-1e49aef4";
  /* module identifier */
  const __vue_module_identifier__$$ = undefined;
  /* functional template */
  const __vue_is_functional_template__$$ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$$ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$$, staticRenderFns: __vue_staticRenderFns__$$ },
    __vue_inject_styles__$$,
    __vue_script__$$,
    __vue_scope_id__$$,
    __vue_is_functional_template__$$,
    __vue_module_identifier__$$,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$_ = {
  name: 'imageTextSixthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$_ = script$_;
/* template */
var __vue_render__$_ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-sixth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticStyle: {
                "border-radius": "6px",
                padding: "9px 11px",
                display: "flex",
              },
            },
            [
              _c("div", { staticStyle: { display: "flex" } }, [
                _c(
                  "div",
                  { staticClass: "iamge-bg-box" },
                  [
                    _c(
                      "div",
                      { staticClass: "image-top-title" },
                      [
                        _c("xml-text-render", {
                          attrs: {
                            "p-block-data":
                              _vm.groupData[_vm.titleTextDataName],
                            "block-data-name": _vm.titleTextDataName,
                            "extend-params": _vm.extendParams,
                            "current-rule": _vm.currentRule,
                            "rule-index": _vm.ruleIndex,
                            "container-class": "text-container",
                            "editor-class": "editor",
                            mode: _vm.mode,
                            "page-type": _vm.pageType,
                            resourceBasisPath: _vm.resourceBasisPath,
                            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                          },
                          on: {
                            blockclick: _vm.handleBlockClick,
                            groupDataChange: _vm.groupDataChange,
                          },
                          scopedSlots: _vm._u(
                            [
                              _vm._l(_vm.$scopedSlots, function (index, name) {
                                return {
                                  key: name,
                                  fn: function (deliver) {
                                    return [_vm._t(name, null, null, deliver)]
                                  },
                                }
                              }),
                            ],
                            null,
                            true
                          ),
                        }),
                      ],
                      1
                    ),
                    _vm._v(" "),
                    _c("xml-image-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                        "block-data-name": _vm.imageBlockDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "image-container",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        resourceBasisPath: _vm.resourceBasisPath,
                      },
                      on: { blockclick: _vm.handleBlockClick },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "image-text-box" },
                  [
                    _c("xml-text-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                        "block-data-name": _vm.bodyTextDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "text-body-container",
                        "editor-class": "editor",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        resourceBasisPath: _vm.resourceBasisPath,
                        scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                      },
                      on: {
                        blockclick: _vm.handleBlockClick,
                        groupDataChange: _vm.groupDataChange,
                      },
                      scopedSlots: _vm._u(
                        [
                          _vm._l(_vm.$scopedSlots, function (index, name) {
                            return {
                              key: name,
                              fn: function (deliver) {
                                return [_vm._t(name, null, null, deliver)]
                              },
                            }
                          }),
                        ],
                        null,
                        true
                      ),
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c("div", { staticClass: "image-text-decorate" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$_ = [];
__vue_render__$_._withStripped = true;

  /* style */
  const __vue_inject_styles__$_ = undefined;
  /* scoped */
  const __vue_scope_id__$_ = "data-v-a84283ce";
  /* module identifier */
  const __vue_module_identifier__$_ = undefined;
  /* functional template */
  const __vue_is_functional_template__$_ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$_ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$_, staticRenderFns: __vue_staticRenderFns__$_ },
    __vue_inject_styles__$_,
    __vue_script__$_,
    __vue_scope_id__$_,
    __vue_is_functional_template__$_,
    __vue_module_identifier__$_,
    false,
    undefined,
    undefined,
    undefined
  );

//
/**
 * 单图片组合
 */
var script$Z = {
  name: 'imageTextSeventhLibraryRender',
  isUnPrefix: true,
  components: {
    XmlImageRender: __vue_component__$62,
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图文',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      titleTextDataName: 'titleTextData',
      bodyTextDataName: 'bodyTextData',
      imageBlockDataName: 'imageData',
      numberTextDataName: 'numberTextData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$Z = script$Z;
/* template */
var __vue_render__$Z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-text-image-seventh-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            { staticStyle: { "border-radius": "6px", padding: "9px 11px" } },
            [
              _c("div", {}, [
                _c("div", { staticClass: "image-text-decorate2" }),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "iamge-bg-box" },
                  [
                    _c("xml-image-render", {
                      attrs: {
                        "p-block-data": _vm.groupData[_vm.imageBlockDataName],
                        "block-data-name": _vm.imageBlockDataName,
                        "extend-params": _vm.extendParams,
                        "current-rule": _vm.currentRule,
                        "rule-index": _vm.ruleIndex,
                        "container-class": "image-container",
                        mode: _vm.mode,
                        "page-type": _vm.pageType,
                        resourceBasisPath: _vm.resourceBasisPath,
                      },
                      on: { blockclick: _vm.handleBlockClick },
                    }),
                  ],
                  1
                ),
                _vm._v(" "),
                _c(
                  "div",
                  { staticClass: "image-text-box" },
                  [
                    _c(
                      "xml-text-render",
                      {
                        attrs: {
                          "p-block-data": _vm.groupData[_vm.bodyTextDataName],
                          "block-data-name": _vm.bodyTextDataName,
                          "extend-params": _vm.extendParams,
                          "current-rule": _vm.currentRule,
                          "rule-index": _vm.ruleIndex,
                          "container-class": "text-body-container",
                          "editor-class": "editor",
                          mode: _vm.mode,
                          "page-type": _vm.pageType,
                          resourceBasisPath: _vm.resourceBasisPath,
                          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
                        },
                        on: {
                          blockclick: _vm.handleBlockClick,
                          groupDataChange: _vm.groupDataChange,
                        },
                        scopedSlots: _vm._u(
                          [
                            _vm._l(_vm.$scopedSlots, function (index, name) {
                              return {
                                key: name,
                                fn: function (deliver) {
                                  return [_vm._t(name, null, null, deliver)]
                                },
                              }
                            }),
                          ],
                          null,
                          true
                        ),
                      },
                      [_vm._v("s\n          ")]
                    ),
                  ],
                  1
                ),
                _vm._v(" "),
                _c("div", { staticClass: "image-text-decorate" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$Z = [];
__vue_render__$Z._withStripped = true;

  /* style */
  const __vue_inject_styles__$Z = undefined;
  /* scoped */
  const __vue_scope_id__$Z = "data-v-3fae213b";
  /* module identifier */
  const __vue_module_identifier__$Z = undefined;
  /* functional template */
  const __vue_is_functional_template__$Z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$Z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$Z, staticRenderFns: __vue_staticRenderFns__$Z },
    __vue_inject_styles__$Z,
    __vue_script__$Z,
    __vue_scope_id__$Z,
    __vue_is_functional_template__$Z,
    __vue_module_identifier__$Z,
    false,
    undefined,
    undefined,
    undefined
  );

const TitleComponents$1 = [__vue_component__$13, __vue_component__$12, __vue_component__$11, __vue_component__$10, __vue_component__$$, __vue_component__$_, __vue_component__$Z];
var xmlImageTextLibrary = {
  // install,
  ...TitleComponents$1
};

//
var script$Y = {
  name: 'splitlineFirstLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'SplitlineData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex: this.ruleIndex,
        dataName: this.titleTextDataName,
        data: this.pGroupData
      });
    }
  }
};

/* script */
const __vue_script__$Y = script$Y;
/* template */
var __vue_render__$Y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-first-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c("xml-group-render", {
        ref: "xmlGroup",
        attrs: {
          "page-type": _vm.pageType,
          mode: _vm.mode,
          "type-text": _vm.typeText,
          showLine: false,
          "rule-index": _vm.ruleIndex,
          scopedSlots: { $scopedSlots: _vm.$scopedSlots },
        },
        scopedSlots: _vm._u(
          [
            _vm._l(_vm.$scopedSlots, function (index, name) {
              return {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t(name)]
                },
                proxy: true,
              }
            }),
          ],
          null,
          true
        ),
      }),
      _vm._v(" "),
      _c(
        "div",
        {
          staticClass: "title-container",
          attrs: { id: _vm.blockId },
          on: { click: _vm.handleBlockClick },
        },
        [
          _c("div", { staticClass: "line" }),
          _vm._v(" "),
          _c("div", { staticClass: "centerimg" }),
          _vm._v(" "),
          _c("div", { staticClass: "line" }),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$Y = [];
__vue_render__$Y._withStripped = true;

  /* style */
  const __vue_inject_styles__$Y = undefined;
  /* scoped */
  const __vue_scope_id__$Y = "data-v-a2b24ba2";
  /* module identifier */
  const __vue_module_identifier__$Y = undefined;
  /* functional template */
  const __vue_is_functional_template__$Y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$Y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$Y, staticRenderFns: __vue_staticRenderFns__$Y },
    __vue_inject_styles__$Y,
    __vue_script__$Y,
    __vue_scope_id__$Y,
    __vue_is_functional_template__$Y,
    __vue_module_identifier__$Y,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$X = {
  name: 'splitlineSecondLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$X = script$X;
/* template */
var __vue_render__$X = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-second-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "line1" }, [_c("div")]),
              _vm._v(" "),
              _c("div", { staticClass: "line2" }, [_c("div")]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$X = [];
__vue_render__$X._withStripped = true;

  /* style */
  const __vue_inject_styles__$X = undefined;
  /* scoped */
  const __vue_scope_id__$X = "data-v-44733e66";
  /* module identifier */
  const __vue_module_identifier__$X = undefined;
  /* functional template */
  const __vue_is_functional_template__$X = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$X = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$X, staticRenderFns: __vue_staticRenderFns__$X },
    __vue_inject_styles__$X,
    __vue_script__$X,
    __vue_scope_id__$X,
    __vue_is_functional_template__$X,
    __vue_module_identifier__$X,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$W = {
  name: 'splitlineFourthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$W = script$W;
/* template */
var __vue_render__$W = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-fourth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "line" }),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }, [
                _c("div", { staticClass: "foldline1" }),
                _vm._v(" "),
                _c("div", { staticClass: "foldline2" }),
                _vm._v(" "),
                _c("div", { staticClass: "foldline3" }),
                _vm._v(" "),
                _c("div", { staticClass: "foldline4" }),
                _vm._v(" "),
                _c("div", { staticClass: "foldline5" }),
                _vm._v(" "),
                _c("div", { staticClass: "foldline6" }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "line" }),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$W = [];
__vue_render__$W._withStripped = true;

  /* style */
  const __vue_inject_styles__$W = undefined;
  /* scoped */
  const __vue_scope_id__$W = "data-v-6ae3d466";
  /* module identifier */
  const __vue_module_identifier__$W = undefined;
  /* functional template */
  const __vue_is_functional_template__$W = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$W = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$W, staticRenderFns: __vue_staticRenderFns__$W },
    __vue_inject_styles__$W,
    __vue_script__$W,
    __vue_scope_id__$W,
    __vue_is_functional_template__$W,
    __vue_module_identifier__$W,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$V = {
  name: 'splitlineFifthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$V = script$V;
/* template */
var __vue_render__$V = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-fifth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "line" }),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }, [_c("div")]),
              _vm._v(" "),
              _c("div", { staticClass: "line" }),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$V = [];
__vue_render__$V._withStripped = true;

  /* style */
  const __vue_inject_styles__$V = undefined;
  /* scoped */
  const __vue_scope_id__$V = "data-v-6b42b996";
  /* module identifier */
  const __vue_module_identifier__$V = undefined;
  /* functional template */
  const __vue_is_functional_template__$V = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$V = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$V, staticRenderFns: __vue_staticRenderFns__$V },
    __vue_inject_styles__$V,
    __vue_script__$V,
    __vue_scope_id__$V,
    __vue_is_functional_template__$V,
    __vue_module_identifier__$V,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$U = {
  name: 'splitlineSixthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$U = script$U;
/* template */
var __vue_render__$U = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-sixth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "line1" }),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }, [
                _c("div", { staticClass: "block1" }),
                _vm._v(" "),
                _c("div", { staticClass: "block2" }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "line2" }),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$U = [];
__vue_render__$U._withStripped = true;

  /* style */
  const __vue_inject_styles__$U = undefined;
  /* scoped */
  const __vue_scope_id__$U = "data-v-7d54be4a";
  /* module identifier */
  const __vue_module_identifier__$U = undefined;
  /* functional template */
  const __vue_is_functional_template__$U = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$U = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$U, staticRenderFns: __vue_staticRenderFns__$U },
    __vue_inject_styles__$U,
    __vue_script__$U,
    __vue_scope_id__$U,
    __vue_is_functional_template__$U,
    __vue_module_identifier__$U,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$T = {
  name: 'splitlineSeventhLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$T = script$T;
/* template */
var __vue_render__$T = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-seventh-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "dotted" }, [
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }),
              _vm._v(" "),
              _c("div", { staticClass: "dotted" }, [
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$T = [];
__vue_render__$T._withStripped = true;

  /* style */
  const __vue_inject_styles__$T = undefined;
  /* scoped */
  const __vue_scope_id__$T = "data-v-6faf896e";
  /* module identifier */
  const __vue_module_identifier__$T = undefined;
  /* functional template */
  const __vue_is_functional_template__$T = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$T = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$T, staticRenderFns: __vue_staticRenderFns__$T },
    __vue_inject_styles__$T,
    __vue_script__$T,
    __vue_scope_id__$T,
    __vue_is_functional_template__$T,
    __vue_module_identifier__$T,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$S = {
  name: 'splitlineEighthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$S = script$S;
/* template */
var __vue_render__$S = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-eighth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "centerimg" }, [
                _c("div", { staticClass: "line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line2" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$S = [];
__vue_render__$S._withStripped = true;

  /* style */
  const __vue_inject_styles__$S = undefined;
  /* scoped */
  const __vue_scope_id__$S = "data-v-e763b9f6";
  /* module identifier */
  const __vue_module_identifier__$S = undefined;
  /* functional template */
  const __vue_is_functional_template__$S = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$S = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$S, staticRenderFns: __vue_staticRenderFns__$S },
    __vue_inject_styles__$S,
    __vue_script__$S,
    __vue_scope_id__$S,
    __vue_is_functional_template__$S,
    __vue_module_identifier__$S,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$R = {
  name: 'splitlineTenthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$R = script$R;
/* template */
var __vue_render__$R = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-tenth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", [
                _c("div", { staticClass: "centerimg" }),
                _vm._v(" "),
                _c("div", { staticClass: "line" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$R = [];
__vue_render__$R._withStripped = true;

  /* style */
  const __vue_inject_styles__$R = undefined;
  /* scoped */
  const __vue_scope_id__$R = "data-v-1e877a09";
  /* module identifier */
  const __vue_module_identifier__$R = undefined;
  /* functional template */
  const __vue_is_functional_template__$R = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$R = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$R, staticRenderFns: __vue_staticRenderFns__$R },
    __vue_inject_styles__$R,
    __vue_script__$R,
    __vue_scope_id__$R,
    __vue_is_functional_template__$R,
    __vue_module_identifier__$R,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$Q = {
  name: 'splitlineEleventhLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$Q = script$Q;
/* template */
var __vue_render__$Q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-eleventh-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", [
                _c("div", { staticClass: "line1" }),
                _vm._v(" "),
                _c("div", { staticClass: "line2" }),
                _vm._v(" "),
                _c("div", { staticClass: "centerimg" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$Q = [];
__vue_render__$Q._withStripped = true;

  /* style */
  const __vue_inject_styles__$Q = undefined;
  /* scoped */
  const __vue_scope_id__$Q = "data-v-45960a1a";
  /* module identifier */
  const __vue_module_identifier__$Q = undefined;
  /* functional template */
  const __vue_is_functional_template__$Q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$Q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$Q, staticRenderFns: __vue_staticRenderFns__$Q },
    __vue_inject_styles__$Q,
    __vue_script__$Q,
    __vue_scope_id__$Q,
    __vue_is_functional_template__$Q,
    __vue_module_identifier__$Q,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$P = {
  name: 'splitlineNinthLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$P = script$P;
/* template */
var __vue_render__$P = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-ninth-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "centerimg" }, [
                _c("div", { staticClass: "skeybox" }),
                _vm._v(" "),
                _c("div", { staticClass: "line" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$P = [];
__vue_render__$P._withStripped = true;

  /* style */
  const __vue_inject_styles__$P = undefined;
  /* scoped */
  const __vue_scope_id__$P = "data-v-623502c5";
  /* module identifier */
  const __vue_module_identifier__$P = undefined;
  /* functional template */
  const __vue_is_functional_template__$P = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$P = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$P, staticRenderFns: __vue_staticRenderFns__$P },
    __vue_inject_styles__$P,
    __vue_script__$P,
    __vue_scope_id__$P,
    __vue_is_functional_template__$P,
    __vue_module_identifier__$P,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$O = {
  name: 'splitlineRedtheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$O = script$O;
/* template */
var __vue_render__$O = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Redtheme1-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-line" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(90deg)" },
                      attrs: {
                        t: "1684829468544",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "28595",
                        width: "20",
                        height: "20",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M533.504 268.288q33.792-41.984 71.68-75.776 32.768-27.648 74.24-50.176t86.528-19.456q63.488 5.12 105.984 30.208t67.584 63.488 34.304 87.04 6.144 99.84-17.92 97.792-36.864 87.04-48.64 74.752-53.248 61.952q-40.96 41.984-85.504 78.336t-84.992 62.464-73.728 41.472-51.712 15.36q-20.48 1.024-52.224-14.336t-69.632-41.472-79.872-61.952-82.944-75.776q-26.624-25.6-57.344-59.392t-57.856-74.24-46.592-87.552-21.504-100.352 11.264-99.84 39.936-83.456 65.536-61.952 88.064-35.328q24.576-5.12 49.152-1.536t48.128 12.288 45.056 22.016 40.96 27.648q45.056 33.792 86.016 80.896z",
                          "p-id": "28596",
                          fill: _vm.groupData.themeColor,
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("div", { staticClass: "line" }, [
                    _c("div", { staticClass: "circle" }),
                  ]),
                ]),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    staticClass: "left-line",
                    staticStyle: { transform: "rotate(180deg)" },
                  },
                  [
                    _c(
                      "svg",
                      {
                        staticClass: "icon",
                        staticStyle: { transform: "rotate(90deg)" },
                        attrs: {
                          t: "1684829468544",
                          viewBox: "0 0 1024 1024",
                          version: "1.1",
                          xmlns: "http://www.w3.org/2000/svg",
                          "p-id": "28595",
                          width: "20",
                          height: "20",
                        },
                      },
                      [
                        _c("path", {
                          attrs: {
                            d: "M533.504 268.288q33.792-41.984 71.68-75.776 32.768-27.648 74.24-50.176t86.528-19.456q63.488 5.12 105.984 30.208t67.584 63.488 34.304 87.04 6.144 99.84-17.92 97.792-36.864 87.04-48.64 74.752-53.248 61.952q-40.96 41.984-85.504 78.336t-84.992 62.464-73.728 41.472-51.712 15.36q-20.48 1.024-52.224-14.336t-69.632-41.472-79.872-61.952-82.944-75.776q-26.624-25.6-57.344-59.392t-57.856-74.24-46.592-87.552-21.504-100.352 11.264-99.84 39.936-83.456 65.536-61.952 88.064-35.328q24.576-5.12 49.152-1.536t48.128 12.288 45.056 22.016 40.96 27.648q45.056 33.792 86.016 80.896z",
                            "p-id": "28596",
                            fill: _vm.groupData.themeColor,
                          },
                        }),
                      ]
                    ),
                    _vm._v(" "),
                    _c("div", { staticClass: "line" }, [
                      _c("div", { staticClass: "circle" }),
                    ]),
                  ]
                ),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$O = [];
__vue_render__$O._withStripped = true;

  /* style */
  const __vue_inject_styles__$O = undefined;
  /* scoped */
  const __vue_scope_id__$O = "data-v-0e87c9a4";
  /* module identifier */
  const __vue_module_identifier__$O = undefined;
  /* functional template */
  const __vue_is_functional_template__$O = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$O = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$O, staticRenderFns: __vue_staticRenderFns__$O },
    __vue_inject_styles__$O,
    __vue_script__$O,
    __vue_scope_id__$O,
    __vue_is_functional_template__$O,
    __vue_module_identifier__$O,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$N = {
  name: 'splitlineGreytheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$N = script$N;
/* template */
var __vue_render__$N = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme2-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      attrs: {
                        t: "1684833198250",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "31621",
                        width: "25",
                        height: "31",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M288.105 122.229C174.047 122.21 64.691 231.687 64.691 388.095c0 176.07 156.747 241.891 261.855 312.283 101.962 68.266 174.057 161.602 185.453 201.393 9.743-38.936 91.03-135.019 185.448-203.373 103.196-74.727 261.861-136.19 261.861-312.262 0-152.117-109.34-260.294-222.908-260.294-86.792 0-167.781 15.754-224.419 128.441-65.593-111.977-138.495-132.042-223.876-132.054",
                          fill: _vm.groupData.themeColor,
                          "p-id": "31622",
                        },
                      }),
                    ]
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$N = [];
__vue_render__$N._withStripped = true;

  /* style */
  const __vue_inject_styles__$N = undefined;
  /* scoped */
  const __vue_scope_id__$N = "data-v-cdb29046";
  /* module identifier */
  const __vue_module_identifier__$N = undefined;
  /* functional template */
  const __vue_is_functional_template__$N = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$N = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$N, staticRenderFns: __vue_staticRenderFns__$N },
    __vue_inject_styles__$N,
    __vue_script__$N,
    __vue_scope_id__$N,
    __vue_is_functional_template__$N,
    __vue_module_identifier__$N,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$M = {
  name: 'splitlineGreytheme3LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$M = script$M;
/* template */
var __vue_render__$M = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme3-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      attrs: {
                        t: "1684833525217",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "32635",
                        width: "25",
                        height: "31",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M957.111079 403.480424c-3.927449-11.669784-14.447037-19.86442-26.723641-20.816095L647.68068 360.749204 540.183388 84.126003c-4.586458-11.803837-15.951297-19.579941-28.614711-19.579941s-24.02723 7.776104-28.614711 19.579941L375.458719 360.749204l-282.708803 21.915126c-12.276604 0.951675-22.796192 9.146311-26.723641 20.816095-3.927449 11.669784-0.50142 24.557302 8.701173 32.737612l217.547735 193.358823-67.980277 291.298436c-2.848884 12.20702 2.009773 24.919553 12.273535 32.114418 10.264784 7.195889 23.87271 7.42818 34.375925 0.586354l240.624313-156.709111 240.625336 156.709111c5.099135 3.320629 10.92891 4.974291 16.752546 4.974291 6.173606 0 12.342096-1.858324 17.623379-5.561669 10.263761-7.194866 15.122419-19.907399 12.273535-32.114418l-67.980277-291.299459L948.409906 436.218036C957.613522 428.037726 961.037505 415.150208 957.111079 403.480424z",
                          fill: _vm.groupData.themeColor,
                          "p-id": "32636",
                        },
                      }),
                    ]
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$M = [];
__vue_render__$M._withStripped = true;

  /* style */
  const __vue_inject_styles__$M = undefined;
  /* scoped */
  const __vue_scope_id__$M = "data-v-d8ccf46c";
  /* module identifier */
  const __vue_module_identifier__$M = undefined;
  /* functional template */
  const __vue_is_functional_template__$M = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$M = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$M, staticRenderFns: __vue_staticRenderFns__$M },
    __vue_inject_styles__$M,
    __vue_script__$M,
    __vue_scope_id__$M,
    __vue_is_functional_template__$M,
    __vue_module_identifier__$M,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$L = {
  name: 'splitlineGreytheme5LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$L = script$L;
/* template */
var __vue_render__$L = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme5-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      attrs: {
                        t: "1684834224886",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "42504",
                        width: "25",
                        height: "31",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M992 475.648h-73.088l36.32-62.848a32 32 0 0 0-55.392-32.032l-54.752 94.88H631.52l90.496-52.256a32 32 0 0 0 11.68-43.744 31.904 31.904 0 0 0-43.68-11.68l-90.592 52.288 106.848-185.04h109.536a31.84 31.84 0 0 0 31.904-31.968 31.824 31.824 0 0 0-31.872-32l-72.624 0.032 36.528-63.312a31.952 31.952 0 0 0-11.712-43.696 31.872 31.872 0 0 0-43.68 11.728l-36.56 63.344-36.256-62.944a31.984 31.984 0 0 0-43.776-11.696 31.84 31.84 0 0 0-11.68 43.632l54.816 94.928L544 388.304v-104.656a32 32 0 1 0-64 0v104.56l-106.816-184.992 54.752-94.88a31.904 31.904 0 0 0-11.712-43.632 31.856 31.856 0 0 0-43.664 11.632l-36.32 62.912-36.528-63.28A31.968 31.968 0 0 0 256 64.272a31.92 31.92 0 0 0-11.68 43.696l36.56 63.312-72.624-0.064c-17.712 0-32 14.32-32 32.064a31.84 31.84 0 0 0 31.936 31.936h109.6l106.848 185.056-90.624-52.304a31.888 31.888 0 0 0-43.68 11.712 32 32 0 0 0 11.648 43.728l90.496 52.256H178.944l-54.784-94.88a31.968 31.968 0 0 0-43.648-11.664 31.904 31.904 0 0 0-11.744 43.664l36.32 62.88H32a32 32 0 1 0 0 64h73.088l-36.336 62.848a32 32 0 0 0 55.392 32.032l54.784-94.88h213.68l-90.624 52.32a31.904 31.904 0 0 0-11.68 43.68 31.984 31.984 0 0 0 43.68 11.744l90.624-52.32-106.816 184.992H208.16c-17.632 0-31.936 14.32-31.936 32s14.288 32 31.936 32h72.656l-36.528 63.28a31.968 31.968 0 1 0 55.392 31.968l36.528-63.28 36.256 62.88a32 32 0 0 0 43.744 11.712 31.936 31.936 0 0 0 11.68-43.68l-54.752-94.88L480 627.056v104.592c0 17.696 14.32 32 32 32s32-14.304 32-32v-104.592l106.848 185.024-54.816 94.88a31.952 31.952 0 0 0 11.712 43.68c15.312 8.816 34.88 3.632 43.68-11.68l36.352-62.912 36.528 63.28a31.952 31.952 0 0 0 43.68 11.744 32.016 32.016 0 0 0 11.712-43.744l-36.528-63.28 72.56 0.032a32 32 0 0 0 0.032-64h-109.536l-106.752-184.944 90.464 52.256a32 32 0 0 0 43.728-11.744 31.872 31.872 0 0 0-11.728-43.68l-90.592-52.32h213.68l54.752 94.88a31.936 31.936 0 0 0 43.68 11.68 31.952 31.952 0 0 0 11.712-43.68l-36.288-62.88H992c17.68 0 32-14.304 32-32 0-17.696-14.32-32-32-32z m-480 96a64 64 0 1 1 0-128 64 64 0 0 1 0 128z",
                          fill: _vm.groupData.themeColor,
                          "p-id": "42505",
                        },
                      }),
                    ]
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$L = [];
__vue_render__$L._withStripped = true;

  /* style */
  const __vue_inject_styles__$L = undefined;
  /* scoped */
  const __vue_scope_id__$L = "data-v-1022258a";
  /* module identifier */
  const __vue_module_identifier__$L = undefined;
  /* functional template */
  const __vue_is_functional_template__$L = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$L = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$L, staticRenderFns: __vue_staticRenderFns__$L },
    __vue_inject_styles__$L,
    __vue_script__$L,
    __vue_scope_id__$L,
    __vue_is_functional_template__$L,
    __vue_module_identifier__$L,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$K = {
  name: 'splitlineYellowtheme3LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$K = script$K;
/* template */
var __vue_render__$K = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Yellowtheme3-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-block-box" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "line-con" }),
                _vm._v(" "),
                _c("div", { staticClass: "right-block-box" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$K = [];
__vue_render__$K._withStripped = true;

  /* style */
  const __vue_inject_styles__$K = undefined;
  /* scoped */
  const __vue_scope_id__$K = "data-v-efb0078a";
  /* module identifier */
  const __vue_module_identifier__$K = undefined;
  /* functional template */
  const __vue_is_functional_template__$K = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$K = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$K, staticRenderFns: __vue_staticRenderFns__$K },
    __vue_inject_styles__$K,
    __vue_script__$K,
    __vue_scope_id__$K,
    __vue_is_functional_template__$K,
    __vue_module_identifier__$K,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$J = {
  name: 'splitlineBluetheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$J = script$J;
/* template */
var __vue_render__$J = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Bluetheme1-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "iconbox" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(90deg)" },
                      attrs: {
                        t: "1684838451897",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "51769",
                        width: "10",
                        height: "10",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M525.873548 897.156129l-383.174193-761.723871 763.045161-1.981935-379.870968 763.705806z",
                          "p-id": "51770",
                          fill: _vm.groupData.themeColor,
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                  _vm._v(" "),
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(-90deg)" },
                      attrs: {
                        t: "1684838451897",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "51769",
                        width: "10",
                        height: "10",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M525.873548 897.156129l-383.174193-761.723871 763.045161-1.981935-379.870968 763.705806z",
                          "p-id": "51770",
                          fill: _vm.groupData.themeColor,
                        },
                      }),
                    ]
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "iconbox" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(90deg)" },
                      attrs: {
                        t: "1684838451897",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "51769",
                        width: "10",
                        height: "10",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M525.873548 897.156129l-383.174193-761.723871 763.045161-1.981935-379.870968 763.705806z",
                          "p-id": "51770",
                          fill: _vm.groupData.themeColor,
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                  _vm._v(" "),
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(-90deg)" },
                      attrs: {
                        t: "1684838451897",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "51769",
                        width: "10",
                        height: "10",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M525.873548 897.156129l-383.174193-761.723871 763.045161-1.981935-379.870968 763.705806z",
                          "p-id": "51770",
                          fill: _vm.groupData.themeColor,
                        },
                      }),
                    ]
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "iconbox" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(90deg)" },
                      attrs: {
                        t: "1684838451897",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "51769",
                        width: "10",
                        height: "10",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M525.873548 897.156129l-383.174193-761.723871 763.045161-1.981935-379.870968 763.705806z",
                          "p-id": "51770",
                          fill: _vm.groupData.themeColor,
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                  _vm._v(" "),
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(-90deg)" },
                      attrs: {
                        t: "1684838451897",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "51769",
                        width: "10",
                        height: "10",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M525.873548 897.156129l-383.174193-761.723871 763.045161-1.981935-379.870968 763.705806z",
                          "p-id": "51770",
                          fill: _vm.groupData.themeColor,
                        },
                      }),
                    ]
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "iconbox" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(90deg)" },
                      attrs: {
                        t: "1684838451897",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "51769",
                        width: "10",
                        height: "10",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M525.873548 897.156129l-383.174193-761.723871 763.045161-1.981935-379.870968 763.705806z",
                          "p-id": "51770",
                          fill: _vm.groupData.themeColor,
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                  _vm._v(" "),
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(-90deg)" },
                      attrs: {
                        t: "1684838451897",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "51769",
                        width: "10",
                        height: "10",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M525.873548 897.156129l-383.174193-761.723871 763.045161-1.981935-379.870968 763.705806z",
                          "p-id": "51770",
                          fill: _vm.groupData.themeColor,
                        },
                      }),
                    ]
                  ),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$J = [];
__vue_render__$J._withStripped = true;

  /* style */
  const __vue_inject_styles__$J = undefined;
  /* scoped */
  const __vue_scope_id__$J = "data-v-4dfe320f";
  /* module identifier */
  const __vue_module_identifier__$J = undefined;
  /* functional template */
  const __vue_is_functional_template__$J = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$J = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$J, staticRenderFns: __vue_staticRenderFns__$J },
    __vue_inject_styles__$J,
    __vue_script__$J,
    __vue_scope_id__$J,
    __vue_is_functional_template__$J,
    __vue_module_identifier__$J,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$I = {
  name: 'splitlineBluetheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$I = script$I;
/* template */
var __vue_render__$I = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Bluetheme2-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
                _vm._v(" "),
                _c("div"),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$I = [];
__vue_render__$I._withStripped = true;

  /* style */
  const __vue_inject_styles__$I = undefined;
  /* scoped */
  const __vue_scope_id__$I = "data-v-7750ab63";
  /* module identifier */
  const __vue_module_identifier__$I = undefined;
  /* functional template */
  const __vue_is_functional_template__$I = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$I = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$I, staticRenderFns: __vue_staticRenderFns__$I },
    __vue_inject_styles__$I,
    __vue_script__$I,
    __vue_scope_id__$I,
    __vue_is_functional_template__$I,
    __vue_module_identifier__$I,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$H = {
  name: 'splitlineYellowtheme2LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$H = script$H;
/* template */
var __vue_render__$H = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Yellowtheme2-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "linebox-circle" }),
                _vm._v(" "),
                _c("div", { staticClass: "iconbox" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { "margin-left": "-5px" },
                      attrs: {
                        t: "1684841153840",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "52311",
                        width: "35",
                        height: "35",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M960 512L512 769.9 64 512l448-257.9z",
                          fill: _vm.groupData.themeColor,
                          "p-id": "52312",
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                  _vm._v(" "),
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      attrs: {
                        t: "1684841153840",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "52311",
                        width: "20",
                        height: "20",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M960 512L512 769.9 64 512l448-257.9z",
                          fill: _vm.groupData.themeColor,
                          "p-id": "52312",
                        },
                      }),
                    ]
                  ),
                  _vm._v(" "),
                  _c("div", { staticClass: "circle" }),
                  _vm._v(" "),
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { "margin-right": "-5px" },
                      attrs: {
                        t: "1684841153840",
                        viewBox: "0 0 1024 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "52311",
                        width: "35",
                        height: "35",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M960 512L512 769.9 64 512l448-257.9z",
                          fill: _vm.groupData.themeColor,
                          "p-id": "52312",
                        },
                      }),
                    ]
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "linebox-circle" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$H = [];
__vue_render__$H._withStripped = true;

  /* style */
  const __vue_inject_styles__$H = undefined;
  /* scoped */
  const __vue_scope_id__$H = "data-v-22a6c19d";
  /* module identifier */
  const __vue_module_identifier__$H = undefined;
  /* functional template */
  const __vue_is_functional_template__$H = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$H = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$H, staticRenderFns: __vue_staticRenderFns__$H },
    __vue_inject_styles__$H,
    __vue_script__$H,
    __vue_scope_id__$H,
    __vue_is_functional_template__$H,
    __vue_module_identifier__$H,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$G = {
  name: 'splitlineRedtheme4LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$G = script$G;
/* template */
var __vue_render__$G = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Redtheme4-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "top-linecon" }),
                _vm._v(" "),
                _c("div", { staticClass: "bottom-linecon" }, [
                  _c("div", { staticClass: "left-trianglebox" }, [
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "line" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "right-trianglebox" }, [
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                    _vm._v(" "),
                    _c("div"),
                  ]),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$G = [];
__vue_render__$G._withStripped = true;

  /* style */
  const __vue_inject_styles__$G = undefined;
  /* scoped */
  const __vue_scope_id__$G = "data-v-9f1bac7a";
  /* module identifier */
  const __vue_module_identifier__$G = undefined;
  /* functional template */
  const __vue_is_functional_template__$G = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$G = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$G, staticRenderFns: __vue_staticRenderFns__$G },
    __vue_inject_styles__$G,
    __vue_script__$G,
    __vue_scope_id__$G,
    __vue_is_functional_template__$G,
    __vue_module_identifier__$G,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$F = {
  name: 'splitlineYellowtheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$F = script$F;
/* template */
var __vue_render__$F = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Yellowtheme1-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-block" }),
                _vm._v(" "),
                _c("div", { staticClass: "linecon" }),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c(
                    "svg",
                    {
                      staticClass: "icon",
                      staticStyle: { transform: "rotate(180deg)" },
                      attrs: {
                        t: "1684893686787",
                        viewBox: "0 0 1096 1024",
                        version: "1.1",
                        xmlns: "http://www.w3.org/2000/svg",
                        "p-id": "4676",
                        width: "32",
                        height: "32",
                      },
                    },
                    [
                      _c("path", {
                        attrs: {
                          d: "M29.125818 609.321374c0 63.550061 50.313051 113.859232 113.864404 113.859232 63.544889 0 113.857939-50.307879 113.85794-113.859232s-50.313051-113.863111-113.85794-113.863111c-63.551354 0-113.864404 50.313051-113.864404 113.863111z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4677",
                        },
                      }),
                      _vm._v(" "),
                      _c("path", {
                        attrs: {
                          d: "M516.342949 296.868202c0 45.014626 34.424242 79.433697 79.440162 79.433697 42.364121 0 79.43499-37.070869 79.43499-79.433697 0-45.015919-34.419071-79.440162-79.43499-79.440162s-79.440162 37.070869-79.440162 79.440162z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4678",
                        },
                      }),
                      _vm._v(" "),
                      _c("path", {
                        attrs: {
                          d: "M852.631273 675.519354c0 50.313051 39.717495 90.030545 90.030545 90.030545 50.307879 0 90.025374-39.717495 90.025374-90.030545 0-50.307879-39.717495-90.030545-90.025374-90.030546-50.313051-2.646626-90.030545 39.722667-90.030545 90.030546z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4679",
                        },
                      }),
                      _vm._v(" "),
                      _c("path", {
                        attrs: {
                          d: "M0 815.857778c0 26.479192 21.182061 47.661253 47.661253 47.661252 26.480485 0 47.662545-21.182061 47.662545-47.661252s-21.182061-47.65996-47.662545-47.65996c-26.479192-0.001293-47.661253 21.179475-47.661253 47.65996z m1048.576-373.35402a23.731717 23.731717 0 0 0 23.833859 23.828686 23.730424 23.730424 0 0 0 23.828686-23.828686 23.730424 23.730424 0 0 0-23.828686-23.832566 23.731717 23.731717 0 0 0-23.833859 23.832566z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4680",
                        },
                      }),
                      _vm._v(" "),
                      _c("path", {
                        attrs: {
                          d: "M887.050343 408.079515c0 15.888808 13.242182 26.480485 26.479192 26.480485 15.888808 0 26.479192-13.243475 26.479192-26.480485 0-15.888808-13.23701-26.479192-26.479192-26.479192-15.883636-2.646626-26.479192 10.590384-26.479192 26.479192z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4681",
                        },
                      }),
                      _vm._v(" "),
                      _c("path", {
                        attrs: {
                          d: "M296.565657 196.24598c0 18.535434 15.888808 34.424242 34.424242 34.424242s34.424242-15.888808 34.424242-34.424242-15.888808-34.424242-34.424242-34.424243c-18.535434-2.646626-34.424242 13.243475-34.424242 34.424243z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4682",
                        },
                      }),
                      _vm._v(" "),
                      _c("path", {
                        attrs: {
                          d: "M675.216808 511.347071c0 18.535434 13.242182 31.777616 31.777616 31.777616s31.772444-15.888808 31.772445-31.777616c0-18.535434-13.23701-31.772444-31.772445-31.772445s-31.777616 13.23701-31.777616 31.772445z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4683",
                        },
                      }),
                      _vm._v(" "),
                      _c("path", {
                        attrs: {
                          d: "M378.651152 508.700444c0 18.535434 13.242182 31.773737 31.777616 31.773738s31.773737-13.23701 31.773737-31.773738c0-18.535434-13.238303-31.777616-31.773737-31.777616s-31.777616 13.242182-31.777616 31.777616z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4684",
                        },
                      }),
                      _vm._v(" "),
                      _c("path", {
                        attrs: {
                          d: "M264.793212 352.473212c0 13.238303 10.590384 26.480485 23.827394 26.480485 13.243475 0 23.833859-10.591677 23.833859-26.480485 0-13.242182-10.590384-26.479192-23.833859-26.479192-13.23701 0-23.827394 13.23701-23.827394 26.479192z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4685",
                        },
                      }),
                      _vm._v(" "),
                      _c("path", {
                        attrs: {
                          d: "M526.934626 654.337293a23.731717 23.731717 0 0 0 23.833859 23.828687 23.730424 23.730424 0 0 0 23.828687-23.828687 23.731717 23.731717 0 0 0-23.828687-23.833859 23.73301 23.73301 0 0 0-23.833859 23.833859z m0 0",
                          fill: _vm.groupData.themeColor,
                          "p-id": "4686",
                        },
                      }),
                    ]
                  ),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$F = [];
__vue_render__$F._withStripped = true;

  /* style */
  const __vue_inject_styles__$F = undefined;
  /* scoped */
  const __vue_scope_id__$F = "data-v-287df9d0";
  /* module identifier */
  const __vue_module_identifier__$F = undefined;
  /* functional template */
  const __vue_is_functional_template__$F = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$F = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$F, staticRenderFns: __vue_staticRenderFns__$F },
    __vue_inject_styles__$F,
    __vue_script__$F,
    __vue_scope_id__$F,
    __vue_is_functional_template__$F,
    __vue_module_identifier__$F,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$E = {
  name: 'splitlineGreytheme1LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$E = script$E;
/* template */
var __vue_render__$E = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Greytheme1-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "left-icon" }, [
                  _c("div", { staticClass: "block" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "triangle" }),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-icon" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$E = [];
__vue_render__$E._withStripped = true;

  /* style */
  const __vue_inject_styles__$E = undefined;
  /* scoped */
  const __vue_scope_id__$E = "data-v-780d9fe5";
  /* module identifier */
  const __vue_module_identifier__$E = undefined;
  /* functional template */
  const __vue_is_functional_template__$E = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$E = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$E, staticRenderFns: __vue_staticRenderFns__$E },
    __vue_inject_styles__$E,
    __vue_script__$E,
    __vue_scope_id__$E,
    __vue_is_functional_template__$E,
    __vue_module_identifier__$E,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$D = {
  name: 'splitlineBluetheme4LibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$D = script$D;
/* template */
var __vue_render__$D = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Bluetheme4-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "linebox" }, [
                _c("div", { staticClass: "top-lineconbox" }),
                _vm._v(" "),
                _c("div", { staticClass: "bottom-lineconbox" }, [
                  _c("div", { staticClass: "linecon1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "bottom-block1" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "bottom-block2" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "linecon2" }),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$D = [];
__vue_render__$D._withStripped = true;

  /* style */
  const __vue_inject_styles__$D = undefined;
  /* scoped */
  const __vue_scope_id__$D = "data-v-6104f138";
  /* module identifier */
  const __vue_module_identifier__$D = undefined;
  /* functional template */
  const __vue_is_functional_template__$D = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$D = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$D, staticRenderFns: __vue_staticRenderFns__$D },
    __vue_inject_styles__$D,
    __vue_script__$D,
    __vue_scope_id__$D,
    __vue_is_functional_template__$D,
    __vue_module_identifier__$D,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$C = {
  name: 'splitlineTwentytwoLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$C = script$C;
/* template */
var __vue_render__$C = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Twentytwo-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "centerimg" }, [_c("div")])]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$C = [];
__vue_render__$C._withStripped = true;

  /* style */
  const __vue_inject_styles__$C = undefined;
  /* scoped */
  const __vue_scope_id__$C = "data-v-0547c888";
  /* module identifier */
  const __vue_module_identifier__$C = undefined;
  /* functional template */
  const __vue_is_functional_template__$C = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$C = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$C, staticRenderFns: __vue_staticRenderFns__$C },
    __vue_inject_styles__$C,
    __vue_script__$C,
    __vue_scope_id__$C,
    __vue_is_functional_template__$C,
    __vue_module_identifier__$C,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$B = {
  name: 'splitlineTwentythreeLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$B = script$B;
/* template */
var __vue_render__$B = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Twentythree-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", { staticClass: "centerimg" }, [_c("div")])]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$B = [];
__vue_render__$B._withStripped = true;

  /* style */
  const __vue_inject_styles__$B = undefined;
  /* scoped */
  const __vue_scope_id__$B = "data-v-74b79612";
  /* module identifier */
  const __vue_module_identifier__$B = undefined;
  /* functional template */
  const __vue_is_functional_template__$B = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$B = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$B, staticRenderFns: __vue_staticRenderFns__$B },
    __vue_inject_styles__$B,
    __vue_script__$B,
    __vue_scope_id__$B,
    __vue_is_functional_template__$B,
    __vue_module_identifier__$B,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$A = {
  name: 'splitlineTwentyfourLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$A = script$A;
/* template */
var __vue_render__$A = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Twentyfour-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [_c("div", [_c("div", { staticClass: "centerimg" }, [_c("div")])])]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$A = [];
__vue_render__$A._withStripped = true;

  /* style */
  const __vue_inject_styles__$A = undefined;
  /* scoped */
  const __vue_scope_id__$A = "data-v-424f5422";
  /* module identifier */
  const __vue_module_identifier__$A = undefined;
  /* functional template */
  const __vue_is_functional_template__$A = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$A = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$A, staticRenderFns: __vue_staticRenderFns__$A },
    __vue_inject_styles__$A,
    __vue_script__$A,
    __vue_scope_id__$A,
    __vue_is_functional_template__$A,
    __vue_module_identifier__$A,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$z = {
  name: 'splitlineTwentyfiveLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$z = script$z;
/* template */
var __vue_render__$z = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Twentyfive-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", [
                _c("div", { staticClass: "left-top-line" }),
                _vm._v(" "),
                _c("div", { staticClass: "left-bottom-line" }),
                _vm._v(" "),
                _c("div", { staticClass: "left-block-box" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "right-top-line" }),
                _vm._v(" "),
                _c("div", { staticClass: "right-bottom-line" }),
                _vm._v(" "),
                _c("div", { staticClass: "right-block-box" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "centerimg" }, [
                  _c("div"),
                  _vm._v(" "),
                  _c("div"),
                  _vm._v(" "),
                  _c("div", { staticClass: "left-line-box" }),
                  _vm._v(" "),
                  _c("div", { staticClass: "right-line-box" }),
                ]),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$z = [];
__vue_render__$z._withStripped = true;

  /* style */
  const __vue_inject_styles__$z = undefined;
  /* scoped */
  const __vue_scope_id__$z = "data-v-07ecc4ac";
  /* module identifier */
  const __vue_module_identifier__$z = undefined;
  /* functional template */
  const __vue_is_functional_template__$z = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$z = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$z, staticRenderFns: __vue_staticRenderFns__$z },
    __vue_inject_styles__$z,
    __vue_script__$z,
    __vue_scope_id__$z,
    __vue_is_functional_template__$z,
    __vue_module_identifier__$z,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$y = {
  name: 'splitlineTwentysixLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$y = script$y;
/* template */
var __vue_render__$y = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Twentysix-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "left-triangle" }),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }, [_c("div")]),
              _vm._v(" "),
              _c("div", { staticClass: "right-triangle" }),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$y = [];
__vue_render__$y._withStripped = true;

  /* style */
  const __vue_inject_styles__$y = undefined;
  /* scoped */
  const __vue_scope_id__$y = "data-v-72ab5bc7";
  /* module identifier */
  const __vue_module_identifier__$y = undefined;
  /* functional template */
  const __vue_is_functional_template__$y = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$y = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$y, staticRenderFns: __vue_staticRenderFns__$y },
    __vue_inject_styles__$y,
    __vue_script__$y,
    __vue_scope_id__$y,
    __vue_is_functional_template__$y,
    __vue_module_identifier__$y,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$x = {
  name: 'splitlineTwentysevenLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$x = script$x;
/* template */
var __vue_render__$x = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Twentyseven-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
              _vm._v(" "),
              _c("div"),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$x = [];
__vue_render__$x._withStripped = true;

  /* style */
  const __vue_inject_styles__$x = undefined;
  /* scoped */
  const __vue_scope_id__$x = "data-v-89cf019a";
  /* module identifier */
  const __vue_module_identifier__$x = undefined;
  /* functional template */
  const __vue_is_functional_template__$x = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$x = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$x, staticRenderFns: __vue_staticRenderFns__$x },
    __vue_inject_styles__$x,
    __vue_script__$x,
    __vue_scope_id__$x,
    __vue_is_functional_template__$x,
    __vue_module_identifier__$x,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$w = {
  name: 'splitlineTwentyeightLibraryRender',
  isUnPrefix: true,
  components: {
    XmlTextRender: __vue_component__$65
  },
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '分割线',
      titleTextDataName: 'titleTextData',
      groupData: {},
      blockId: `blockId${Math.random()}`,
      propertyComponentsName: 'XmlSplitlineProperty'
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName: this.titleTextDataName,
        propertyComponentsName: this.propertyComponentsName,
        currentRule: this.currentRule,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    groupDataChange({
      ruleIndex,
      dataName,
      data
    }) {
      this.$emit('groupDataChange', {
        ruleIndex,
        dataName,
        data
      });
    }
  }
};

/* script */
const __vue_script__$w = script$w;
/* template */
var __vue_render__$w = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-splitline-Twentyeight-library-" + _vm.pageType,
        "xml-single-ebook-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      style: { "--background-color": _vm.groupData.themeColor },
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            showLine: false,
            "rule-index": _vm.ruleIndex,
            scopedSlots: { $scopedSlots: _vm.$scopedSlots },
          },
          scopedSlots: _vm._u(
            [
              _vm._l(_vm.$scopedSlots, function (index, name) {
                return {
                  key: "action-buttons",
                  fn: function () {
                    return [_vm._t(name)]
                  },
                  proxy: true,
                }
              }),
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "title-container",
              attrs: { id: _vm.blockId },
              on: { click: _vm.handleBlockClick },
            },
            [
              _c("div", { staticClass: "side-block-box" }, [
                _c("div", { staticClass: "round" }),
                _vm._v(" "),
                _c("div", { staticClass: "icon" }),
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "left-line-box" }),
              _vm._v(" "),
              _c("div", { staticClass: "centerimg" }, [_c("div")]),
              _vm._v(" "),
              _c("div", { staticClass: "right-line-box" }),
              _vm._v(" "),
              _c("div", { staticClass: "side-block-box" }, [
                _c("div", { staticClass: "icon" }),
                _vm._v(" "),
                _c("div", { staticClass: "round" }),
              ]),
            ]
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$w = [];
__vue_render__$w._withStripped = true;

  /* style */
  const __vue_inject_styles__$w = undefined;
  /* scoped */
  const __vue_scope_id__$w = "data-v-16115db2";
  /* module identifier */
  const __vue_module_identifier__$w = undefined;
  /* functional template */
  const __vue_is_functional_template__$w = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$w = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$w, staticRenderFns: __vue_staticRenderFns__$w },
    __vue_inject_styles__$w,
    __vue_script__$w,
    __vue_scope_id__$w,
    __vue_is_functional_template__$w,
    __vue_module_identifier__$w,
    false,
    undefined,
    undefined,
    undefined
  );

const TitleComponents = [__vue_component__$Y, __vue_component__$X, __vue_component__$W, __vue_component__$V, __vue_component__$U, __vue_component__$T, __vue_component__$S, __vue_component__$R, __vue_component__$Q, __vue_component__$P, __vue_component__$O, __vue_component__$N, __vue_component__$M, __vue_component__$L, __vue_component__$K, __vue_component__$J, __vue_component__$I, __vue_component__$H, __vue_component__$G, __vue_component__$F, __vue_component__$E, __vue_component__$D, __vue_component__$C, __vue_component__$B, __vue_component__$A, __vue_component__$z, __vue_component__$y, __vue_component__$x, __vue_component__$w];
var xmlSplitlineLibrary = {
  // install,
  ...TitleComponents
};

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */

var extendStatics = function (d, b) {
  extendStatics = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (d, b) {
    d.__proto__ = b;
  } || function (d, b) {
    for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  };
  return extendStatics(d, b);
};
function __extends(d, b) {
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  extendStatics(d, b);
  function __() {
    this.constructor = d;
  }
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

var Browser = function () {
  function Browser() {
    this.firefox = false;
    this.ie = false;
    this.edge = false;
    this.newEdge = false;
    this.weChat = false;
  }
  return Browser;
}();
var Env = function () {
  function Env() {
    this.browser = new Browser();
    this.node = false;
    this.wxa = false;
    this.worker = false;
    this.svgSupported = false;
    this.touchEventsSupported = false;
    this.pointerEventsSupported = false;
    this.domSupported = false;
    this.transformSupported = false;
    this.transform3dSupported = false;
    this.hasGlobalWindow = typeof window !== 'undefined';
  }
  return Env;
}();
var env = new Env();
if (typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function') {
  env.wxa = true;
  env.touchEventsSupported = true;
} else if (typeof document === 'undefined' && typeof self !== 'undefined') {
  env.worker = true;
} else if (!env.hasGlobalWindow || 'Deno' in window) {
  env.node = true;
  env.svgSupported = true;
} else {
  detect(navigator.userAgent, env);
}
function detect(ua, env) {
  var browser = env.browser;
  var firefox = ua.match(/Firefox\/([\d.]+)/);
  var ie = ua.match(/MSIE\s([\d.]+)/) || ua.match(/Trident\/.+?rv:(([\d.]+))/);
  var edge = ua.match(/Edge?\/([\d.]+)/);
  var weChat = /micromessenger/i.test(ua);
  if (firefox) {
    browser.firefox = true;
    browser.version = firefox[1];
  }
  if (ie) {
    browser.ie = true;
    browser.version = ie[1];
  }
  if (edge) {
    browser.edge = true;
    browser.version = edge[1];
    browser.newEdge = +edge[1].split('.')[0] > 18;
  }
  if (weChat) {
    browser.weChat = true;
  }
  env.svgSupported = typeof SVGRect !== 'undefined';
  env.touchEventsSupported = 'ontouchstart' in window && !browser.ie && !browser.edge;
  env.pointerEventsSupported = 'onpointerdown' in window && (browser.edge || browser.ie && +browser.version >= 11);
  env.domSupported = typeof document !== 'undefined';
  var style = document.documentElement.style;
  env.transform3dSupported = (browser.ie && 'transition' in style || browser.edge || 'WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix() || 'MozPerspective' in style) && !('OTransition' in style);
  env.transformSupported = env.transform3dSupported || browser.ie && +browser.version >= 9;
}
var env$1 = env;

var DEFAULT_FONT_SIZE = 12;
var DEFAULT_FONT_FAMILY = 'sans-serif';
var DEFAULT_FONT = DEFAULT_FONT_SIZE + "px " + DEFAULT_FONT_FAMILY;
var OFFSET = 20;
var SCALE = 100;
var defaultWidthMapStr = "007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";
function getTextWidthMap(mapStr) {
  var map = {};
  if (typeof JSON === 'undefined') {
    return map;
  }
  for (var i = 0; i < mapStr.length; i++) {
    var char = String.fromCharCode(i + 32);
    var size = (mapStr.charCodeAt(i) - OFFSET) / SCALE;
    map[char] = size;
  }
  return map;
}
var DEFAULT_TEXT_WIDTH_MAP = getTextWidthMap(defaultWidthMapStr);
var platformApi = {
  createCanvas: function () {
    return typeof document !== 'undefined' && document.createElement('canvas');
  },
  measureText: function () {
    var _ctx;
    var _cachedFont;
    return function (text, font) {
      if (!_ctx) {
        var canvas = platformApi.createCanvas();
        _ctx = canvas && canvas.getContext('2d');
      }
      if (_ctx) {
        if (_cachedFont !== font) {
          _cachedFont = _ctx.font = font || DEFAULT_FONT;
        }
        return _ctx.measureText(text);
      } else {
        text = text || '';
        font = font || DEFAULT_FONT;
        var res = /((?:\d+)?\.?\d*)px/.exec(font);
        var fontSize = res && +res[1] || DEFAULT_FONT_SIZE;
        var width = 0;
        if (font.indexOf('mono') >= 0) {
          width = fontSize * text.length;
        } else {
          for (var i = 0; i < text.length; i++) {
            var preCalcWidth = DEFAULT_TEXT_WIDTH_MAP[text[i]];
            width += preCalcWidth == null ? fontSize : preCalcWidth * fontSize;
          }
        }
        return {
          width: width
        };
      }
    };
  }(),
  loadImage: function (src, onload, onerror) {
    var image = new Image();
    image.onload = onload;
    image.onerror = onerror;
    image.src = src;
    return image;
  }
};

var BUILTIN_OBJECT = reduce(['Function', 'RegExp', 'Date', 'Error', 'CanvasGradient', 'CanvasPattern', 'Image', 'Canvas'], function (obj, val) {
  obj['[object ' + val + ']'] = true;
  return obj;
}, {});
var TYPED_ARRAY = reduce(['Int8', 'Uint8', 'Uint8Clamped', 'Int16', 'Uint16', 'Int32', 'Uint32', 'Float32', 'Float64'], function (obj, val) {
  obj['[object ' + val + 'Array]'] = true;
  return obj;
}, {});
var objToString = Object.prototype.toString;
var arrayProto = Array.prototype;
var nativeForEach = arrayProto.forEach;
var nativeFilter = arrayProto.filter;
var nativeSlice = arrayProto.slice;
var nativeMap = arrayProto.map;
var ctorFunction = function () {}.constructor;
var protoFunction = ctorFunction ? ctorFunction.prototype : null;
var protoKey = '__proto__';
var idStart = 0x0907;
function guid() {
  return idStart++;
}
function logError() {
  var args = [];
  for (var _i = 0; _i < arguments.length; _i++) {
    args[_i] = arguments[_i];
  }
  if (typeof console !== 'undefined') {
    console.error.apply(console, args);
  }
}
function clone$4(source) {
  if (source == null || typeof source !== 'object') {
    return source;
  }
  var result = source;
  var typeStr = objToString.call(source);
  if (typeStr === '[object Array]') {
    if (!isPrimitive(source)) {
      result = [];
      for (var i = 0, len = source.length; i < len; i++) {
        result[i] = clone$4(source[i]);
      }
    }
  } else if (TYPED_ARRAY[typeStr]) {
    if (!isPrimitive(source)) {
      var Ctor = source.constructor;
      if (Ctor.from) {
        result = Ctor.from(source);
      } else {
        result = new Ctor(source.length);
        for (var i = 0, len = source.length; i < len; i++) {
          result[i] = source[i];
        }
      }
    }
  } else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {
    result = {};
    for (var key in source) {
      if (source.hasOwnProperty(key) && key !== protoKey) {
        result[key] = clone$4(source[key]);
      }
    }
  }
  return result;
}
function merge(target, source, overwrite) {
  if (!isObject$3(source) || !isObject$3(target)) {
    return overwrite ? clone$4(source) : target;
  }
  for (var key in source) {
    if (source.hasOwnProperty(key) && key !== protoKey) {
      var targetProp = target[key];
      var sourceProp = source[key];
      if (isObject$3(sourceProp) && isObject$3(targetProp) && !isArray$1(sourceProp) && !isArray$1(targetProp) && !isDom(sourceProp) && !isDom(targetProp) && !isBuiltInObject(sourceProp) && !isBuiltInObject(targetProp) && !isPrimitive(sourceProp) && !isPrimitive(targetProp)) {
        merge(targetProp, sourceProp, overwrite);
      } else if (overwrite || !(key in target)) {
        target[key] = clone$4(source[key]);
      }
    }
  }
  return target;
}
function mergeAll(targetAndSources, overwrite) {
  var result = targetAndSources[0];
  for (var i = 1, len = targetAndSources.length; i < len; i++) {
    result = merge(result, targetAndSources[i], overwrite);
  }
  return result;
}
function extend(target, source) {
  if (Object.assign) {
    Object.assign(target, source);
  } else {
    for (var key in source) {
      if (source.hasOwnProperty(key) && key !== protoKey) {
        target[key] = source[key];
      }
    }
  }
  return target;
}
function defaults(target, source, overlay) {
  var keysArr = keys(source);
  for (var i = 0, len = keysArr.length; i < len; i++) {
    var key = keysArr[i];
    if (overlay ? source[key] != null : target[key] == null) {
      target[key] = source[key];
    }
  }
  return target;
}
platformApi.createCanvas;
function indexOf(array, value) {
  if (array) {
    if (array.indexOf) {
      return array.indexOf(value);
    }
    for (var i = 0, len = array.length; i < len; i++) {
      if (array[i] === value) {
        return i;
      }
    }
  }
  return -1;
}
function inherits(clazz, baseClazz) {
  var clazzPrototype = clazz.prototype;
  function F() {}
  F.prototype = baseClazz.prototype;
  clazz.prototype = new F();
  for (var prop in clazzPrototype) {
    if (clazzPrototype.hasOwnProperty(prop)) {
      clazz.prototype[prop] = clazzPrototype[prop];
    }
  }
  clazz.prototype.constructor = clazz;
  clazz.superClass = baseClazz;
}
function mixin(target, source, override) {
  target = 'prototype' in target ? target.prototype : target;
  source = 'prototype' in source ? source.prototype : source;
  if (Object.getOwnPropertyNames) {
    var keyList = Object.getOwnPropertyNames(source);
    for (var i = 0; i < keyList.length; i++) {
      var key = keyList[i];
      if (key !== 'constructor') {
        if (override ? source[key] != null : target[key] == null) {
          target[key] = source[key];
        }
      }
    }
  } else {
    defaults(target, source, override);
  }
}
function isArrayLike(data) {
  if (!data) {
    return false;
  }
  if (typeof data === 'string') {
    return false;
  }
  return typeof data.length === 'number';
}
function each$f(arr, cb, context) {
  if (!(arr && cb)) {
    return;
  }
  if (arr.forEach && arr.forEach === nativeForEach) {
    arr.forEach(cb, context);
  } else if (arr.length === +arr.length) {
    for (var i = 0, len = arr.length; i < len; i++) {
      cb.call(context, arr[i], i, arr);
    }
  } else {
    for (var key in arr) {
      if (arr.hasOwnProperty(key)) {
        cb.call(context, arr[key], key, arr);
      }
    }
  }
}
function map$1(arr, cb, context) {
  if (!arr) {
    return [];
  }
  if (!cb) {
    return slice$1(arr);
  }
  if (arr.map && arr.map === nativeMap) {
    return arr.map(cb, context);
  } else {
    var result = [];
    for (var i = 0, len = arr.length; i < len; i++) {
      result.push(cb.call(context, arr[i], i, arr));
    }
    return result;
  }
}
function reduce(arr, cb, memo, context) {
  if (!(arr && cb)) {
    return;
  }
  for (var i = 0, len = arr.length; i < len; i++) {
    memo = cb.call(context, memo, arr[i], i, arr);
  }
  return memo;
}
function filter(arr, cb, context) {
  if (!arr) {
    return [];
  }
  if (!cb) {
    return slice$1(arr);
  }
  if (arr.filter && arr.filter === nativeFilter) {
    return arr.filter(cb, context);
  } else {
    var result = [];
    for (var i = 0, len = arr.length; i < len; i++) {
      if (cb.call(context, arr[i], i, arr)) {
        result.push(arr[i]);
      }
    }
    return result;
  }
}
function find(arr, cb, context) {
  if (!(arr && cb)) {
    return;
  }
  for (var i = 0, len = arr.length; i < len; i++) {
    if (cb.call(context, arr[i], i, arr)) {
      return arr[i];
    }
  }
}
function keys(obj) {
  if (!obj) {
    return [];
  }
  if (Object.keys) {
    return Object.keys(obj);
  }
  var keyList = [];
  for (var key in obj) {
    if (obj.hasOwnProperty(key)) {
      keyList.push(key);
    }
  }
  return keyList;
}
function bindPolyfill(func, context) {
  var args = [];
  for (var _i = 2; _i < arguments.length; _i++) {
    args[_i - 2] = arguments[_i];
  }
  return function () {
    return func.apply(context, args.concat(nativeSlice.call(arguments)));
  };
}
var bind$1 = protoFunction && isFunction(protoFunction.bind) ? protoFunction.call.bind(protoFunction.bind) : bindPolyfill;
function curry$1(func) {
  var args = [];
  for (var _i = 1; _i < arguments.length; _i++) {
    args[_i - 1] = arguments[_i];
  }
  return function () {
    return func.apply(this, args.concat(nativeSlice.call(arguments)));
  };
}
function isArray$1(value) {
  if (Array.isArray) {
    return Array.isArray(value);
  }
  return objToString.call(value) === '[object Array]';
}
function isFunction(value) {
  return typeof value === 'function';
}
function isString(value) {
  return typeof value === 'string';
}
function isStringSafe(value) {
  return objToString.call(value) === '[object String]';
}
function isNumber(value) {
  return typeof value === 'number';
}
function isObject$3(value) {
  var type = typeof value;
  return type === 'function' || !!value && type === 'object';
}
function isBuiltInObject(value) {
  return !!BUILTIN_OBJECT[objToString.call(value)];
}
function isTypedArray$1(value) {
  return !!TYPED_ARRAY[objToString.call(value)];
}
function isDom(value) {
  return typeof value === 'object' && typeof value.nodeType === 'number' && typeof value.ownerDocument === 'object';
}
function isGradientObject(value) {
  return value.colorStops != null;
}
function isImagePatternObject(value) {
  return value.image != null;
}
function isRegExp(value) {
  return objToString.call(value) === '[object RegExp]';
}
function eqNaN(value) {
  return value !== value;
}
function retrieve() {
  var args = [];
  for (var _i = 0; _i < arguments.length; _i++) {
    args[_i] = arguments[_i];
  }
  for (var i = 0, len = args.length; i < len; i++) {
    if (args[i] != null) {
      return args[i];
    }
  }
}
function retrieve2(value0, value1) {
  return value0 != null ? value0 : value1;
}
function retrieve3(value0, value1, value2) {
  return value0 != null ? value0 : value1 != null ? value1 : value2;
}
function slice$1(arr) {
  var args = [];
  for (var _i = 1; _i < arguments.length; _i++) {
    args[_i - 1] = arguments[_i];
  }
  return nativeSlice.apply(arr, args);
}
function normalizeCssArray$1(val) {
  if (typeof val === 'number') {
    return [val, val, val, val];
  }
  var len = val.length;
  if (len === 2) {
    return [val[0], val[1], val[0], val[1]];
  } else if (len === 3) {
    return [val[0], val[1], val[2], val[1]];
  }
  return val;
}
function assert(condition, message) {
  if (!condition) {
    throw new Error(message);
  }
}
function trim$1(str) {
  if (str == null) {
    return null;
  } else if (typeof str.trim === 'function') {
    return str.trim();
  } else {
    return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  }
}
var primitiveKey = '__ec_primitive__';
function setAsPrimitive(obj) {
  obj[primitiveKey] = true;
}
function isPrimitive(obj) {
  return obj[primitiveKey];
}
var MapPolyfill = function () {
  function MapPolyfill() {
    this.data = {};
  }
  MapPolyfill.prototype["delete"] = function (key) {
    var existed = this.has(key);
    if (existed) {
      delete this.data[key];
    }
    return existed;
  };
  MapPolyfill.prototype.has = function (key) {
    return this.data.hasOwnProperty(key);
  };
  MapPolyfill.prototype.get = function (key) {
    return this.data[key];
  };
  MapPolyfill.prototype.set = function (key, value) {
    this.data[key] = value;
    return this;
  };
  MapPolyfill.prototype.keys = function () {
    return keys(this.data);
  };
  MapPolyfill.prototype.forEach = function (callback) {
    var data = this.data;
    for (var key in data) {
      if (data.hasOwnProperty(key)) {
        callback(data[key], key);
      }
    }
  };
  return MapPolyfill;
}();
var isNativeMapSupported = typeof Map === 'function';
function maybeNativeMap() {
  return isNativeMapSupported ? new Map() : new MapPolyfill();
}
var HashMap = function () {
  function HashMap(obj) {
    var isArr = isArray$1(obj);
    this.data = maybeNativeMap();
    var thisMap = this;
    obj instanceof HashMap ? obj.each(visit) : obj && each$f(obj, visit);
    function visit(value, key) {
      isArr ? thisMap.set(value, key) : thisMap.set(key, value);
    }
  }
  HashMap.prototype.hasKey = function (key) {
    return this.data.has(key);
  };
  HashMap.prototype.get = function (key) {
    return this.data.get(key);
  };
  HashMap.prototype.set = function (key, value) {
    this.data.set(key, value);
    return value;
  };
  HashMap.prototype.each = function (cb, context) {
    this.data.forEach(function (value, key) {
      cb.call(context, value, key);
    });
  };
  HashMap.prototype.keys = function () {
    var keys = this.data.keys();
    return isNativeMapSupported ? Array.from(keys) : keys;
  };
  HashMap.prototype.removeKey = function (key) {
    this.data["delete"](key);
  };
  return HashMap;
}();
function createHashMap(obj) {
  return new HashMap(obj);
}
function concatArray(a, b) {
  var newArray = new a.constructor(a.length + b.length);
  for (var i = 0; i < a.length; i++) {
    newArray[i] = a[i];
  }
  var offset = a.length;
  for (var i = 0; i < b.length; i++) {
    newArray[i + offset] = b[i];
  }
  return newArray;
}
function createObject(proto, properties) {
  var obj;
  if (Object.create) {
    obj = Object.create(proto);
  } else {
    var StyleCtor = function () {};
    StyleCtor.prototype = proto;
    obj = new StyleCtor();
  }
  if (properties) {
    extend(obj, properties);
  }
  return obj;
}
function disableUserSelect(dom) {
  var domStyle = dom.style;
  domStyle.webkitUserSelect = 'none';
  domStyle.userSelect = 'none';
  domStyle.webkitTapHighlightColor = 'rgba(0,0,0,0)';
  domStyle['-webkit-touch-callout'] = 'none';
}
function hasOwn(own, prop) {
  return own.hasOwnProperty(prop);
}
function noop() {}
var RADIAN_TO_DEGREE = 180 / Math.PI;

function create$2(x, y) {
  if (x == null) {
    x = 0;
  }
  if (y == null) {
    y = 0;
  }
  return [x, y];
}
function copy$1(out, v) {
  out[0] = v[0];
  out[1] = v[1];
  return out;
}
function clone$3(v) {
  return [v[0], v[1]];
}
function set$1(out, a, b) {
  out[0] = a;
  out[1] = b;
  return out;
}
function add$1(out, v1, v2) {
  out[0] = v1[0] + v2[0];
  out[1] = v1[1] + v2[1];
  return out;
}
function scaleAndAdd$1(out, v1, v2, a) {
  out[0] = v1[0] + v2[0] * a;
  out[1] = v1[1] + v2[1] * a;
  return out;
}
function sub$1(out, v1, v2) {
  out[0] = v1[0] - v2[0];
  out[1] = v1[1] - v2[1];
  return out;
}
function len(v) {
  return Math.sqrt(lenSquare(v));
}
function lenSquare(v) {
  return v[0] * v[0] + v[1] * v[1];
}
function scale$2(out, v, s) {
  out[0] = v[0] * s;
  out[1] = v[1] * s;
  return out;
}
function normalize$6(out, v) {
  var d = len(v);
  if (d === 0) {
    out[0] = 0;
    out[1] = 0;
  } else {
    out[0] = v[0] / d;
    out[1] = v[1] / d;
  }
  return out;
}
function distance$1(v1, v2) {
  return Math.sqrt((v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]));
}
var dist$1 = distance$1;
function distanceSquare(v1, v2) {
  return (v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]);
}
var distSquare = distanceSquare;
function lerp$3(out, v1, v2, t) {
  out[0] = v1[0] + t * (v2[0] - v1[0]);
  out[1] = v1[1] + t * (v2[1] - v1[1]);
  return out;
}
function applyTransform$1(out, v, m) {
  var x = v[0];
  var y = v[1];
  out[0] = m[0] * x + m[2] * y + m[4];
  out[1] = m[1] * x + m[3] * y + m[5];
  return out;
}
function min$3(out, v1, v2) {
  out[0] = Math.min(v1[0], v2[0]);
  out[1] = Math.min(v1[1], v2[1]);
  return out;
}
function max$4(out, v1, v2) {
  out[0] = Math.max(v1[0], v2[0]);
  out[1] = Math.max(v1[1], v2[1]);
  return out;
}

var Param = function () {
  function Param(target, e) {
    this.target = target;
    this.topTarget = e && e.topTarget;
  }
  return Param;
}();
var Draggable = function () {
  function Draggable(handler) {
    this.handler = handler;
    handler.on('mousedown', this._dragStart, this);
    handler.on('mousemove', this._drag, this);
    handler.on('mouseup', this._dragEnd, this);
  }
  Draggable.prototype._dragStart = function (e) {
    var draggingTarget = e.target;
    while (draggingTarget && !draggingTarget.draggable) {
      draggingTarget = draggingTarget.parent || draggingTarget.__hostTarget;
    }
    if (draggingTarget) {
      this._draggingTarget = draggingTarget;
      draggingTarget.dragging = true;
      this._x = e.offsetX;
      this._y = e.offsetY;
      this.handler.dispatchToElement(new Param(draggingTarget, e), 'dragstart', e.event);
    }
  };
  Draggable.prototype._drag = function (e) {
    var draggingTarget = this._draggingTarget;
    if (draggingTarget) {
      var x = e.offsetX;
      var y = e.offsetY;
      var dx = x - this._x;
      var dy = y - this._y;
      this._x = x;
      this._y = y;
      draggingTarget.drift(dx, dy, e);
      this.handler.dispatchToElement(new Param(draggingTarget, e), 'drag', e.event);
      var dropTarget = this.handler.findHover(x, y, draggingTarget).target;
      var lastDropTarget = this._dropTarget;
      this._dropTarget = dropTarget;
      if (draggingTarget !== dropTarget) {
        if (lastDropTarget && dropTarget !== lastDropTarget) {
          this.handler.dispatchToElement(new Param(lastDropTarget, e), 'dragleave', e.event);
        }
        if (dropTarget && dropTarget !== lastDropTarget) {
          this.handler.dispatchToElement(new Param(dropTarget, e), 'dragenter', e.event);
        }
      }
    }
  };
  Draggable.prototype._dragEnd = function (e) {
    var draggingTarget = this._draggingTarget;
    if (draggingTarget) {
      draggingTarget.dragging = false;
    }
    this.handler.dispatchToElement(new Param(draggingTarget, e), 'dragend', e.event);
    if (this._dropTarget) {
      this.handler.dispatchToElement(new Param(this._dropTarget, e), 'drop', e.event);
    }
    this._draggingTarget = null;
    this._dropTarget = null;
  };
  return Draggable;
}();
var Draggable$1 = Draggable;

var Eventful = function () {
  function Eventful(eventProcessors) {
    if (eventProcessors) {
      this._$eventProcessor = eventProcessors;
    }
  }
  Eventful.prototype.on = function (event, query, handler, context) {
    if (!this._$handlers) {
      this._$handlers = {};
    }
    var _h = this._$handlers;
    if (typeof query === 'function') {
      context = handler;
      handler = query;
      query = null;
    }
    if (!handler || !event) {
      return this;
    }
    var eventProcessor = this._$eventProcessor;
    if (query != null && eventProcessor && eventProcessor.normalizeQuery) {
      query = eventProcessor.normalizeQuery(query);
    }
    if (!_h[event]) {
      _h[event] = [];
    }
    for (var i = 0; i < _h[event].length; i++) {
      if (_h[event][i].h === handler) {
        return this;
      }
    }
    var wrap = {
      h: handler,
      query: query,
      ctx: context || this,
      callAtLast: handler.zrEventfulCallAtLast
    };
    var lastIndex = _h[event].length - 1;
    var lastWrap = _h[event][lastIndex];
    lastWrap && lastWrap.callAtLast ? _h[event].splice(lastIndex, 0, wrap) : _h[event].push(wrap);
    return this;
  };
  Eventful.prototype.isSilent = function (eventName) {
    var _h = this._$handlers;
    return !_h || !_h[eventName] || !_h[eventName].length;
  };
  Eventful.prototype.off = function (eventType, handler) {
    var _h = this._$handlers;
    if (!_h) {
      return this;
    }
    if (!eventType) {
      this._$handlers = {};
      return this;
    }
    if (handler) {
      if (_h[eventType]) {
        var newList = [];
        for (var i = 0, l = _h[eventType].length; i < l; i++) {
          if (_h[eventType][i].h !== handler) {
            newList.push(_h[eventType][i]);
          }
        }
        _h[eventType] = newList;
      }
      if (_h[eventType] && _h[eventType].length === 0) {
        delete _h[eventType];
      }
    } else {
      delete _h[eventType];
    }
    return this;
  };
  Eventful.prototype.trigger = function (eventType) {
    var args = [];
    for (var _i = 1; _i < arguments.length; _i++) {
      args[_i - 1] = arguments[_i];
    }
    if (!this._$handlers) {
      return this;
    }
    var _h = this._$handlers[eventType];
    var eventProcessor = this._$eventProcessor;
    if (_h) {
      var argLen = args.length;
      var len = _h.length;
      for (var i = 0; i < len; i++) {
        var hItem = _h[i];
        if (eventProcessor && eventProcessor.filter && hItem.query != null && !eventProcessor.filter(eventType, hItem.query)) {
          continue;
        }
        switch (argLen) {
          case 0:
            hItem.h.call(hItem.ctx);
            break;
          case 1:
            hItem.h.call(hItem.ctx, args[0]);
            break;
          case 2:
            hItem.h.call(hItem.ctx, args[0], args[1]);
            break;
          default:
            hItem.h.apply(hItem.ctx, args);
            break;
        }
      }
    }
    eventProcessor && eventProcessor.afterTrigger && eventProcessor.afterTrigger(eventType);
    return this;
  };
  Eventful.prototype.triggerWithContext = function (type) {
    var args = [];
    for (var _i = 1; _i < arguments.length; _i++) {
      args[_i - 1] = arguments[_i];
    }
    if (!this._$handlers) {
      return this;
    }
    var _h = this._$handlers[type];
    var eventProcessor = this._$eventProcessor;
    if (_h) {
      var argLen = args.length;
      var ctx = args[argLen - 1];
      var len = _h.length;
      for (var i = 0; i < len; i++) {
        var hItem = _h[i];
        if (eventProcessor && eventProcessor.filter && hItem.query != null && !eventProcessor.filter(type, hItem.query)) {
          continue;
        }
        switch (argLen) {
          case 0:
            hItem.h.call(ctx);
            break;
          case 1:
            hItem.h.call(ctx, args[0]);
            break;
          case 2:
            hItem.h.call(ctx, args[0], args[1]);
            break;
          default:
            hItem.h.apply(ctx, args.slice(1, argLen - 1));
            break;
        }
      }
    }
    eventProcessor && eventProcessor.afterTrigger && eventProcessor.afterTrigger(type);
    return this;
  };
  return Eventful;
}();
var Eventful$1 = Eventful;

var LN2 = Math.log(2);
function determinant(rows, rank, rowStart, rowMask, colMask, detCache) {
  var cacheKey = rowMask + '-' + colMask;
  var fullRank = rows.length;
  if (detCache.hasOwnProperty(cacheKey)) {
    return detCache[cacheKey];
  }
  if (rank === 1) {
    var colStart = Math.round(Math.log((1 << fullRank) - 1 & ~colMask) / LN2);
    return rows[rowStart][colStart];
  }
  var subRowMask = rowMask | 1 << rowStart;
  var subRowStart = rowStart + 1;
  while (rowMask & 1 << subRowStart) {
    subRowStart++;
  }
  var sum = 0;
  for (var j = 0, colLocalIdx = 0; j < fullRank; j++) {
    var colTag = 1 << j;
    if (!(colTag & colMask)) {
      sum += (colLocalIdx % 2 ? -1 : 1) * rows[rowStart][j] * determinant(rows, rank - 1, subRowStart, subRowMask, colMask | colTag, detCache);
      colLocalIdx++;
    }
  }
  detCache[cacheKey] = sum;
  return sum;
}
function buildTransformer(src, dest) {
  var mA = [[src[0], src[1], 1, 0, 0, 0, -dest[0] * src[0], -dest[0] * src[1]], [0, 0, 0, src[0], src[1], 1, -dest[1] * src[0], -dest[1] * src[1]], [src[2], src[3], 1, 0, 0, 0, -dest[2] * src[2], -dest[2] * src[3]], [0, 0, 0, src[2], src[3], 1, -dest[3] * src[2], -dest[3] * src[3]], [src[4], src[5], 1, 0, 0, 0, -dest[4] * src[4], -dest[4] * src[5]], [0, 0, 0, src[4], src[5], 1, -dest[5] * src[4], -dest[5] * src[5]], [src[6], src[7], 1, 0, 0, 0, -dest[6] * src[6], -dest[6] * src[7]], [0, 0, 0, src[6], src[7], 1, -dest[7] * src[6], -dest[7] * src[7]]];
  var detCache = {};
  var det = determinant(mA, 8, 0, 0, 0, detCache);
  if (det === 0) {
    return;
  }
  var vh = [];
  for (var i = 0; i < 8; i++) {
    for (var j = 0; j < 8; j++) {
      vh[j] == null && (vh[j] = 0);
      vh[j] += ((i + j) % 2 ? -1 : 1) * determinant(mA, 7, i === 0 ? 1 : 0, 1 << i, 1 << j, detCache) / det * dest[i];
    }
  }
  return function (out, srcPointX, srcPointY) {
    var pk = srcPointX * vh[6] + srcPointY * vh[7] + 1;
    out[0] = (srcPointX * vh[0] + srcPointY * vh[1] + vh[2]) / pk;
    out[1] = (srcPointX * vh[3] + srcPointY * vh[4] + vh[5]) / pk;
  };
}

var EVENT_SAVED_PROP = '___zrEVENTSAVED';
var _calcOut$1 = [];
function transformLocalCoord(out, elFrom, elTarget, inX, inY) {
  return transformCoordWithViewport(_calcOut$1, elFrom, inX, inY, true) && transformCoordWithViewport(out, elTarget, _calcOut$1[0], _calcOut$1[1]);
}
function transformCoordWithViewport(out, el, inX, inY, inverse) {
  if (el.getBoundingClientRect && env$1.domSupported && !isCanvasEl(el)) {
    var saved = el[EVENT_SAVED_PROP] || (el[EVENT_SAVED_PROP] = {});
    var markers = prepareCoordMarkers(el, saved);
    var transformer = preparePointerTransformer(markers, saved, inverse);
    if (transformer) {
      transformer(out, inX, inY);
      return true;
    }
  }
  return false;
}
function prepareCoordMarkers(el, saved) {
  var markers = saved.markers;
  if (markers) {
    return markers;
  }
  markers = saved.markers = [];
  var propLR = ['left', 'right'];
  var propTB = ['top', 'bottom'];
  for (var i = 0; i < 4; i++) {
    var marker = document.createElement('div');
    var stl = marker.style;
    var idxLR = i % 2;
    var idxTB = (i >> 1) % 2;
    stl.cssText = ['position: absolute', 'visibility: hidden', 'padding: 0', 'margin: 0', 'border-width: 0', 'user-select: none', 'width:0', 'height:0', propLR[idxLR] + ':0', propTB[idxTB] + ':0', propLR[1 - idxLR] + ':auto', propTB[1 - idxTB] + ':auto', ''].join('!important;');
    el.appendChild(marker);
    markers.push(marker);
  }
  return markers;
}
function preparePointerTransformer(markers, saved, inverse) {
  var transformerName = inverse ? 'invTrans' : 'trans';
  var transformer = saved[transformerName];
  var oldSrcCoords = saved.srcCoords;
  var srcCoords = [];
  var destCoords = [];
  var oldCoordTheSame = true;
  for (var i = 0; i < 4; i++) {
    var rect = markers[i].getBoundingClientRect();
    var ii = 2 * i;
    var x = rect.left;
    var y = rect.top;
    srcCoords.push(x, y);
    oldCoordTheSame = oldCoordTheSame && oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
    destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
  }
  return oldCoordTheSame && transformer ? transformer : (saved.srcCoords = srcCoords, saved[transformerName] = inverse ? buildTransformer(destCoords, srcCoords) : buildTransformer(srcCoords, destCoords));
}
function isCanvasEl(el) {
  return el.nodeName.toUpperCase() === 'CANVAS';
}
var replaceReg = /([&<>"'])/g;
var replaceMap = {
  '&': '&amp;',
  '<': '&lt;',
  '>': '&gt;',
  '"': '&quot;',
  '\'': '&#39;'
};
function encodeHTML(source) {
  return source == null ? '' : (source + '').replace(replaceReg, function (str, c) {
    return replaceMap[c];
  });
}

var MOUSE_EVENT_REG = /^(?:mouse|pointer|contextmenu|drag|drop)|click/;
var _calcOut = [];
var firefoxNotSupportOffsetXY = env$1.browser.firefox && +env$1.browser.version.split('.')[0] < 39;
function clientToLocal(el, e, out, calculate) {
  out = out || {};
  if (calculate) {
    calculateZrXY(el, e, out);
  } else if (firefoxNotSupportOffsetXY && e.layerX != null && e.layerX !== e.offsetX) {
    out.zrX = e.layerX;
    out.zrY = e.layerY;
  } else if (e.offsetX != null) {
    out.zrX = e.offsetX;
    out.zrY = e.offsetY;
  } else {
    calculateZrXY(el, e, out);
  }
  return out;
}
function calculateZrXY(el, e, out) {
  if (env$1.domSupported && el.getBoundingClientRect) {
    var ex = e.clientX;
    var ey = e.clientY;
    if (isCanvasEl(el)) {
      var box = el.getBoundingClientRect();
      out.zrX = ex - box.left;
      out.zrY = ey - box.top;
      return;
    } else {
      if (transformCoordWithViewport(_calcOut, el, ex, ey)) {
        out.zrX = _calcOut[0];
        out.zrY = _calcOut[1];
        return;
      }
    }
  }
  out.zrX = out.zrY = 0;
}
function getNativeEvent(e) {
  return e || window.event;
}
function normalizeEvent(el, e, calculate) {
  e = getNativeEvent(e);
  if (e.zrX != null) {
    return e;
  }
  var eventType = e.type;
  var isTouch = eventType && eventType.indexOf('touch') >= 0;
  if (!isTouch) {
    clientToLocal(el, e, e, calculate);
    var wheelDelta = getWheelDeltaMayPolyfill(e);
    e.zrDelta = wheelDelta ? wheelDelta / 120 : -(e.detail || 0) / 3;
  } else {
    var touch = eventType !== 'touchend' ? e.targetTouches[0] : e.changedTouches[0];
    touch && clientToLocal(el, touch, e, calculate);
  }
  var button = e.button;
  if (e.which == null && button !== undefined && MOUSE_EVENT_REG.test(e.type)) {
    e.which = button & 1 ? 1 : button & 2 ? 3 : button & 4 ? 2 : 0;
  }
  return e;
}
function getWheelDeltaMayPolyfill(e) {
  var rawWheelDelta = e.wheelDelta;
  if (rawWheelDelta) {
    return rawWheelDelta;
  }
  var deltaX = e.deltaX;
  var deltaY = e.deltaY;
  if (deltaX == null || deltaY == null) {
    return rawWheelDelta;
  }
  var delta = deltaY !== 0 ? Math.abs(deltaY) : Math.abs(deltaX);
  var sign = deltaY > 0 ? -1 : deltaY < 0 ? 1 : deltaX > 0 ? -1 : 1;
  return 3 * delta * sign;
}
function addEventListener(el, name, handler, opt) {
  el.addEventListener(name, handler, opt);
}
function removeEventListener(el, name, handler, opt) {
  el.removeEventListener(name, handler, opt);
}
var stop = function (e) {
  e.preventDefault();
  e.stopPropagation();
  e.cancelBubble = true;
};
function isMiddleOrRightButtonOnMouseUpDown(e) {
  return e.which === 2 || e.which === 3;
}

var GestureMgr = function () {
  function GestureMgr() {
    this._track = [];
  }
  GestureMgr.prototype.recognize = function (event, target, root) {
    this._doTrack(event, target, root);
    return this._recognize(event);
  };
  GestureMgr.prototype.clear = function () {
    this._track.length = 0;
    return this;
  };
  GestureMgr.prototype._doTrack = function (event, target, root) {
    var touches = event.touches;
    if (!touches) {
      return;
    }
    var trackItem = {
      points: [],
      touches: [],
      target: target,
      event: event
    };
    for (var i = 0, len = touches.length; i < len; i++) {
      var touch = touches[i];
      var pos = clientToLocal(root, touch, {});
      trackItem.points.push([pos.zrX, pos.zrY]);
      trackItem.touches.push(touch);
    }
    this._track.push(trackItem);
  };
  GestureMgr.prototype._recognize = function (event) {
    for (var eventName in recognizers) {
      if (recognizers.hasOwnProperty(eventName)) {
        var gestureInfo = recognizers[eventName](this._track, event);
        if (gestureInfo) {
          return gestureInfo;
        }
      }
    }
  };
  return GestureMgr;
}();
function dist(pointPair) {
  var dx = pointPair[1][0] - pointPair[0][0];
  var dy = pointPair[1][1] - pointPair[0][1];
  return Math.sqrt(dx * dx + dy * dy);
}
function center$1(pointPair) {
  return [(pointPair[0][0] + pointPair[1][0]) / 2, (pointPair[0][1] + pointPair[1][1]) / 2];
}
var recognizers = {
  pinch: function (tracks, event) {
    var trackLen = tracks.length;
    if (!trackLen) {
      return;
    }
    var pinchEnd = (tracks[trackLen - 1] || {}).points;
    var pinchPre = (tracks[trackLen - 2] || {}).points || pinchEnd;
    if (pinchPre && pinchPre.length > 1 && pinchEnd && pinchEnd.length > 1) {
      var pinchScale = dist(pinchEnd) / dist(pinchPre);
      !isFinite(pinchScale) && (pinchScale = 1);
      event.pinchScale = pinchScale;
      var pinchCenter = center$1(pinchEnd);
      event.pinchX = pinchCenter[0];
      event.pinchY = pinchCenter[1];
      return {
        type: 'pinch',
        target: tracks[0].target,
        event: event
      };
    }
  }
};

function create$1() {
  return [1, 0, 0, 1, 0, 0];
}
function identity(out) {
  out[0] = 1;
  out[1] = 0;
  out[2] = 0;
  out[3] = 1;
  out[4] = 0;
  out[5] = 0;
  return out;
}
function copy(out, m) {
  out[0] = m[0];
  out[1] = m[1];
  out[2] = m[2];
  out[3] = m[3];
  out[4] = m[4];
  out[5] = m[5];
  return out;
}
function mul$1(out, m1, m2) {
  var out0 = m1[0] * m2[0] + m1[2] * m2[1];
  var out1 = m1[1] * m2[0] + m1[3] * m2[1];
  var out2 = m1[0] * m2[2] + m1[2] * m2[3];
  var out3 = m1[1] * m2[2] + m1[3] * m2[3];
  var out4 = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
  var out5 = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
  out[0] = out0;
  out[1] = out1;
  out[2] = out2;
  out[3] = out3;
  out[4] = out4;
  out[5] = out5;
  return out;
}
function translate(out, a, v) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  out[4] = a[4] + v[0];
  out[5] = a[5] + v[1];
  return out;
}
function rotate(out, a, rad, pivot) {
  if (pivot === void 0) {
    pivot = [0, 0];
  }
  var aa = a[0];
  var ac = a[2];
  var atx = a[4];
  var ab = a[1];
  var ad = a[3];
  var aty = a[5];
  var st = Math.sin(rad);
  var ct = Math.cos(rad);
  out[0] = aa * ct + ab * st;
  out[1] = -aa * st + ab * ct;
  out[2] = ac * ct + ad * st;
  out[3] = -ac * st + ct * ad;
  out[4] = ct * (atx - pivot[0]) + st * (aty - pivot[1]) + pivot[0];
  out[5] = ct * (aty - pivot[1]) - st * (atx - pivot[0]) + pivot[1];
  return out;
}
function scale$1(out, a, v) {
  var vx = v[0];
  var vy = v[1];
  out[0] = a[0] * vx;
  out[1] = a[1] * vy;
  out[2] = a[2] * vx;
  out[3] = a[3] * vy;
  out[4] = a[4] * vx;
  out[5] = a[5] * vy;
  return out;
}
function invert(out, a) {
  var aa = a[0];
  var ac = a[2];
  var atx = a[4];
  var ab = a[1];
  var ad = a[3];
  var aty = a[5];
  var det = aa * ad - ab * ac;
  if (!det) {
    return null;
  }
  det = 1.0 / det;
  out[0] = ad * det;
  out[1] = -ab * det;
  out[2] = -ac * det;
  out[3] = aa * det;
  out[4] = (ac * aty - ad * atx) * det;
  out[5] = (ab * atx - aa * aty) * det;
  return out;
}
function clone$2(a) {
  var b = create$1();
  copy(b, a);
  return b;
}

var Point = function () {
  function Point(x, y) {
    this.x = x || 0;
    this.y = y || 0;
  }
  Point.prototype.copy = function (other) {
    this.x = other.x;
    this.y = other.y;
    return this;
  };
  Point.prototype.clone = function () {
    return new Point(this.x, this.y);
  };
  Point.prototype.set = function (x, y) {
    this.x = x;
    this.y = y;
    return this;
  };
  Point.prototype.equal = function (other) {
    return other.x === this.x && other.y === this.y;
  };
  Point.prototype.add = function (other) {
    this.x += other.x;
    this.y += other.y;
    return this;
  };
  Point.prototype.scale = function (scalar) {
    this.x *= scalar;
    this.y *= scalar;
  };
  Point.prototype.scaleAndAdd = function (other, scalar) {
    this.x += other.x * scalar;
    this.y += other.y * scalar;
  };
  Point.prototype.sub = function (other) {
    this.x -= other.x;
    this.y -= other.y;
    return this;
  };
  Point.prototype.dot = function (other) {
    return this.x * other.x + this.y * other.y;
  };
  Point.prototype.len = function () {
    return Math.sqrt(this.x * this.x + this.y * this.y);
  };
  Point.prototype.lenSquare = function () {
    return this.x * this.x + this.y * this.y;
  };
  Point.prototype.normalize = function () {
    var len = this.len();
    this.x /= len;
    this.y /= len;
    return this;
  };
  Point.prototype.distance = function (other) {
    var dx = this.x - other.x;
    var dy = this.y - other.y;
    return Math.sqrt(dx * dx + dy * dy);
  };
  Point.prototype.distanceSquare = function (other) {
    var dx = this.x - other.x;
    var dy = this.y - other.y;
    return dx * dx + dy * dy;
  };
  Point.prototype.negate = function () {
    this.x = -this.x;
    this.y = -this.y;
    return this;
  };
  Point.prototype.transform = function (m) {
    if (!m) {
      return;
    }
    var x = this.x;
    var y = this.y;
    this.x = m[0] * x + m[2] * y + m[4];
    this.y = m[1] * x + m[3] * y + m[5];
    return this;
  };
  Point.prototype.toArray = function (out) {
    out[0] = this.x;
    out[1] = this.y;
    return out;
  };
  Point.prototype.fromArray = function (input) {
    this.x = input[0];
    this.y = input[1];
  };
  Point.set = function (p, x, y) {
    p.x = x;
    p.y = y;
  };
  Point.copy = function (p, p2) {
    p.x = p2.x;
    p.y = p2.y;
  };
  Point.len = function (p) {
    return Math.sqrt(p.x * p.x + p.y * p.y);
  };
  Point.lenSquare = function (p) {
    return p.x * p.x + p.y * p.y;
  };
  Point.dot = function (p0, p1) {
    return p0.x * p1.x + p0.y * p1.y;
  };
  Point.add = function (out, p0, p1) {
    out.x = p0.x + p1.x;
    out.y = p0.y + p1.y;
  };
  Point.sub = function (out, p0, p1) {
    out.x = p0.x - p1.x;
    out.y = p0.y - p1.y;
  };
  Point.scale = function (out, p0, scalar) {
    out.x = p0.x * scalar;
    out.y = p0.y * scalar;
  };
  Point.scaleAndAdd = function (out, p0, p1, scalar) {
    out.x = p0.x + p1.x * scalar;
    out.y = p0.y + p1.y * scalar;
  };
  Point.lerp = function (out, p0, p1, t) {
    var onet = 1 - t;
    out.x = onet * p0.x + t * p1.x;
    out.y = onet * p0.y + t * p1.y;
  };
  return Point;
}();
var Point$1 = Point;

var mathMin$a = Math.min;
var mathMax$a = Math.max;
var lt = new Point$1();
var rb = new Point$1();
var lb = new Point$1();
var rt = new Point$1();
var minTv$1 = new Point$1();
var maxTv$1 = new Point$1();
var BoundingRect = function () {
  function BoundingRect(x, y, width, height) {
    if (width < 0) {
      x = x + width;
      width = -width;
    }
    if (height < 0) {
      y = y + height;
      height = -height;
    }
    this.x = x;
    this.y = y;
    this.width = width;
    this.height = height;
  }
  BoundingRect.prototype.union = function (other) {
    var x = mathMin$a(other.x, this.x);
    var y = mathMin$a(other.y, this.y);
    if (isFinite(this.x) && isFinite(this.width)) {
      this.width = mathMax$a(other.x + other.width, this.x + this.width) - x;
    } else {
      this.width = other.width;
    }
    if (isFinite(this.y) && isFinite(this.height)) {
      this.height = mathMax$a(other.y + other.height, this.y + this.height) - y;
    } else {
      this.height = other.height;
    }
    this.x = x;
    this.y = y;
  };
  BoundingRect.prototype.applyTransform = function (m) {
    BoundingRect.applyTransform(this, this, m);
  };
  BoundingRect.prototype.calculateTransform = function (b) {
    var a = this;
    var sx = b.width / a.width;
    var sy = b.height / a.height;
    var m = create$1();
    translate(m, m, [-a.x, -a.y]);
    scale$1(m, m, [sx, sy]);
    translate(m, m, [b.x, b.y]);
    return m;
  };
  BoundingRect.prototype.intersect = function (b, mtv) {
    if (!b) {
      return false;
    }
    if (!(b instanceof BoundingRect)) {
      b = BoundingRect.create(b);
    }
    var a = this;
    var ax0 = a.x;
    var ax1 = a.x + a.width;
    var ay0 = a.y;
    var ay1 = a.y + a.height;
    var bx0 = b.x;
    var bx1 = b.x + b.width;
    var by0 = b.y;
    var by1 = b.y + b.height;
    var overlap = !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);
    if (mtv) {
      var dMin = Infinity;
      var dMax = 0;
      var d0 = Math.abs(ax1 - bx0);
      var d1 = Math.abs(bx1 - ax0);
      var d2 = Math.abs(ay1 - by0);
      var d3 = Math.abs(by1 - ay0);
      var dx = Math.min(d0, d1);
      var dy = Math.min(d2, d3);
      if (ax1 < bx0 || bx1 < ax0) {
        if (dx > dMax) {
          dMax = dx;
          if (d0 < d1) {
            Point$1.set(maxTv$1, -d0, 0);
          } else {
            Point$1.set(maxTv$1, d1, 0);
          }
        }
      } else {
        if (dx < dMin) {
          dMin = dx;
          if (d0 < d1) {
            Point$1.set(minTv$1, d0, 0);
          } else {
            Point$1.set(minTv$1, -d1, 0);
          }
        }
      }
      if (ay1 < by0 || by1 < ay0) {
        if (dy > dMax) {
          dMax = dy;
          if (d2 < d3) {
            Point$1.set(maxTv$1, 0, -d2);
          } else {
            Point$1.set(maxTv$1, 0, d3);
          }
        }
      } else {
        if (dx < dMin) {
          dMin = dx;
          if (d2 < d3) {
            Point$1.set(minTv$1, 0, d2);
          } else {
            Point$1.set(minTv$1, 0, -d3);
          }
        }
      }
    }
    if (mtv) {
      Point$1.copy(mtv, overlap ? minTv$1 : maxTv$1);
    }
    return overlap;
  };
  BoundingRect.prototype.contain = function (x, y) {
    var rect = this;
    return x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height;
  };
  BoundingRect.prototype.clone = function () {
    return new BoundingRect(this.x, this.y, this.width, this.height);
  };
  BoundingRect.prototype.copy = function (other) {
    BoundingRect.copy(this, other);
  };
  BoundingRect.prototype.plain = function () {
    return {
      x: this.x,
      y: this.y,
      width: this.width,
      height: this.height
    };
  };
  BoundingRect.prototype.isFinite = function () {
    return isFinite(this.x) && isFinite(this.y) && isFinite(this.width) && isFinite(this.height);
  };
  BoundingRect.prototype.isZero = function () {
    return this.width === 0 || this.height === 0;
  };
  BoundingRect.create = function (rect) {
    return new BoundingRect(rect.x, rect.y, rect.width, rect.height);
  };
  BoundingRect.copy = function (target, source) {
    target.x = source.x;
    target.y = source.y;
    target.width = source.width;
    target.height = source.height;
  };
  BoundingRect.applyTransform = function (target, source, m) {
    if (!m) {
      if (target !== source) {
        BoundingRect.copy(target, source);
      }
      return;
    }
    if (m[1] < 1e-5 && m[1] > -1e-5 && m[2] < 1e-5 && m[2] > -1e-5) {
      var sx = m[0];
      var sy = m[3];
      var tx = m[4];
      var ty = m[5];
      target.x = source.x * sx + tx;
      target.y = source.y * sy + ty;
      target.width = source.width * sx;
      target.height = source.height * sy;
      if (target.width < 0) {
        target.x += target.width;
        target.width = -target.width;
      }
      if (target.height < 0) {
        target.y += target.height;
        target.height = -target.height;
      }
      return;
    }
    lt.x = lb.x = source.x;
    lt.y = rt.y = source.y;
    rb.x = rt.x = source.x + source.width;
    rb.y = lb.y = source.y + source.height;
    lt.transform(m);
    rt.transform(m);
    rb.transform(m);
    lb.transform(m);
    target.x = mathMin$a(lt.x, rb.x, lb.x, rt.x);
    target.y = mathMin$a(lt.y, rb.y, lb.y, rt.y);
    var maxX = mathMax$a(lt.x, rb.x, lb.x, rt.x);
    var maxY = mathMax$a(lt.y, rb.y, lb.y, rt.y);
    target.width = maxX - target.x;
    target.height = maxY - target.y;
  };
  return BoundingRect;
}();
var BoundingRect$1 = BoundingRect;

var SILENT = 'silent';
function makeEventPacket(eveType, targetInfo, event) {
  return {
    type: eveType,
    event: event,
    target: targetInfo.target,
    topTarget: targetInfo.topTarget,
    cancelBubble: false,
    offsetX: event.zrX,
    offsetY: event.zrY,
    gestureEvent: event.gestureEvent,
    pinchX: event.pinchX,
    pinchY: event.pinchY,
    pinchScale: event.pinchScale,
    wheelDelta: event.zrDelta,
    zrByTouch: event.zrByTouch,
    which: event.which,
    stop: stopEvent
  };
}
function stopEvent() {
  stop(this.event);
}
var EmptyProxy = function (_super) {
  __extends(EmptyProxy, _super);
  function EmptyProxy() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.handler = null;
    return _this;
  }
  EmptyProxy.prototype.dispose = function () {};
  EmptyProxy.prototype.setCursor = function () {};
  return EmptyProxy;
}(Eventful$1);
var HoveredResult = function () {
  function HoveredResult(x, y) {
    this.x = x;
    this.y = y;
  }
  return HoveredResult;
}();
var handlerNames = ['click', 'dblclick', 'mousewheel', 'mouseout', 'mouseup', 'mousedown', 'mousemove', 'contextmenu'];
var tmpRect$1 = new BoundingRect$1(0, 0, 0, 0);
var Handler = function (_super) {
  __extends(Handler, _super);
  function Handler(storage, painter, proxy, painterRoot, pointerSize) {
    var _this = _super.call(this) || this;
    _this._hovered = new HoveredResult(0, 0);
    _this.storage = storage;
    _this.painter = painter;
    _this.painterRoot = painterRoot;
    _this._pointerSize = pointerSize;
    proxy = proxy || new EmptyProxy();
    _this.proxy = null;
    _this.setHandlerProxy(proxy);
    _this._draggingMgr = new Draggable$1(_this);
    return _this;
  }
  Handler.prototype.setHandlerProxy = function (proxy) {
    if (this.proxy) {
      this.proxy.dispose();
    }
    if (proxy) {
      each$f(handlerNames, function (name) {
        proxy.on && proxy.on(name, this[name], this);
      }, this);
      proxy.handler = this;
    }
    this.proxy = proxy;
  };
  Handler.prototype.mousemove = function (event) {
    var x = event.zrX;
    var y = event.zrY;
    var isOutside = isOutsideBoundary(this, x, y);
    var lastHovered = this._hovered;
    var lastHoveredTarget = lastHovered.target;
    if (lastHoveredTarget && !lastHoveredTarget.__zr) {
      lastHovered = this.findHover(lastHovered.x, lastHovered.y);
      lastHoveredTarget = lastHovered.target;
    }
    var hovered = this._hovered = isOutside ? new HoveredResult(x, y) : this.findHover(x, y);
    var hoveredTarget = hovered.target;
    var proxy = this.proxy;
    proxy.setCursor && proxy.setCursor(hoveredTarget ? hoveredTarget.cursor : 'default');
    if (lastHoveredTarget && hoveredTarget !== lastHoveredTarget) {
      this.dispatchToElement(lastHovered, 'mouseout', event);
    }
    this.dispatchToElement(hovered, 'mousemove', event);
    if (hoveredTarget && hoveredTarget !== lastHoveredTarget) {
      this.dispatchToElement(hovered, 'mouseover', event);
    }
  };
  Handler.prototype.mouseout = function (event) {
    var eventControl = event.zrEventControl;
    if (eventControl !== 'only_globalout') {
      this.dispatchToElement(this._hovered, 'mouseout', event);
    }
    if (eventControl !== 'no_globalout') {
      this.trigger('globalout', {
        type: 'globalout',
        event: event
      });
    }
  };
  Handler.prototype.resize = function () {
    this._hovered = new HoveredResult(0, 0);
  };
  Handler.prototype.dispatch = function (eventName, eventArgs) {
    var handler = this[eventName];
    handler && handler.call(this, eventArgs);
  };
  Handler.prototype.dispose = function () {
    this.proxy.dispose();
    this.storage = null;
    this.proxy = null;
    this.painter = null;
  };
  Handler.prototype.setCursorStyle = function (cursorStyle) {
    var proxy = this.proxy;
    proxy.setCursor && proxy.setCursor(cursorStyle);
  };
  Handler.prototype.dispatchToElement = function (targetInfo, eventName, event) {
    targetInfo = targetInfo || {};
    var el = targetInfo.target;
    if (el && el.silent) {
      return;
    }
    var eventKey = 'on' + eventName;
    var eventPacket = makeEventPacket(eventName, targetInfo, event);
    while (el) {
      el[eventKey] && (eventPacket.cancelBubble = !!el[eventKey].call(el, eventPacket));
      el.trigger(eventName, eventPacket);
      el = el.__hostTarget ? el.__hostTarget : el.parent;
      if (eventPacket.cancelBubble) {
        break;
      }
    }
    if (!eventPacket.cancelBubble) {
      this.trigger(eventName, eventPacket);
      if (this.painter && this.painter.eachOtherLayer) {
        this.painter.eachOtherLayer(function (layer) {
          if (typeof layer[eventKey] === 'function') {
            layer[eventKey].call(layer, eventPacket);
          }
          if (layer.trigger) {
            layer.trigger(eventName, eventPacket);
          }
        });
      }
    }
  };
  Handler.prototype.findHover = function (x, y, exclude) {
    var list = this.storage.getDisplayList();
    var out = new HoveredResult(x, y);
    setHoverTarget(list, out, x, y, exclude);
    if (this._pointerSize && !out.target) {
      var candidates = [];
      var pointerSize = this._pointerSize;
      var targetSizeHalf = pointerSize / 2;
      var pointerRect = new BoundingRect$1(x - targetSizeHalf, y - targetSizeHalf, pointerSize, pointerSize);
      for (var i = list.length - 1; i >= 0; i--) {
        var el = list[i];
        if (el !== exclude && !el.ignore && !el.ignoreCoarsePointer && (!el.parent || !el.parent.ignoreCoarsePointer)) {
          tmpRect$1.copy(el.getBoundingRect());
          if (el.transform) {
            tmpRect$1.applyTransform(el.transform);
          }
          if (tmpRect$1.intersect(pointerRect)) {
            candidates.push(el);
          }
        }
      }
      if (candidates.length) {
        var rStep = 4;
        var thetaStep = Math.PI / 12;
        var PI2 = Math.PI * 2;
        for (var r = 0; r < targetSizeHalf; r += rStep) {
          for (var theta = 0; theta < PI2; theta += thetaStep) {
            var x1 = x + r * Math.cos(theta);
            var y1 = y + r * Math.sin(theta);
            setHoverTarget(candidates, out, x1, y1, exclude);
            if (out.target) {
              return out;
            }
          }
        }
      }
    }
    return out;
  };
  Handler.prototype.processGesture = function (event, stage) {
    if (!this._gestureMgr) {
      this._gestureMgr = new GestureMgr();
    }
    var gestureMgr = this._gestureMgr;
    stage === 'start' && gestureMgr.clear();
    var gestureInfo = gestureMgr.recognize(event, this.findHover(event.zrX, event.zrY, null).target, this.proxy.dom);
    stage === 'end' && gestureMgr.clear();
    if (gestureInfo) {
      var type = gestureInfo.type;
      event.gestureEvent = type;
      var res = new HoveredResult();
      res.target = gestureInfo.target;
      this.dispatchToElement(res, type, gestureInfo.event);
    }
  };
  return Handler;
}(Eventful$1);
each$f(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick', 'contextmenu'], function (name) {
  Handler.prototype[name] = function (event) {
    var x = event.zrX;
    var y = event.zrY;
    var isOutside = isOutsideBoundary(this, x, y);
    var hovered;
    var hoveredTarget;
    if (name !== 'mouseup' || !isOutside) {
      hovered = this.findHover(x, y);
      hoveredTarget = hovered.target;
    }
    if (name === 'mousedown') {
      this._downEl = hoveredTarget;
      this._downPoint = [event.zrX, event.zrY];
      this._upEl = hoveredTarget;
    } else if (name === 'mouseup') {
      this._upEl = hoveredTarget;
    } else if (name === 'click') {
      if (this._downEl !== this._upEl || !this._downPoint || dist$1(this._downPoint, [event.zrX, event.zrY]) > 4) {
        return;
      }
      this._downPoint = null;
    }
    this.dispatchToElement(hovered, name, event);
  };
});
function isHover(displayable, x, y) {
  if (displayable[displayable.rectHover ? 'rectContain' : 'contain'](x, y)) {
    var el = displayable;
    var isSilent = void 0;
    var ignoreClip = false;
    while (el) {
      if (el.ignoreClip) {
        ignoreClip = true;
      }
      if (!ignoreClip) {
        var clipPath = el.getClipPath();
        if (clipPath && !clipPath.contain(x, y)) {
          return false;
        }
      }
      if (el.silent) {
        isSilent = true;
      }
      var hostEl = el.__hostTarget;
      el = hostEl ? hostEl : el.parent;
    }
    return isSilent ? SILENT : true;
  }
  return false;
}
function setHoverTarget(list, out, x, y, exclude) {
  for (var i = list.length - 1; i >= 0; i--) {
    var el = list[i];
    var hoverCheckResult = void 0;
    if (el !== exclude && !el.ignore && (hoverCheckResult = isHover(el, x, y))) {
      !out.topTarget && (out.topTarget = el);
      if (hoverCheckResult !== SILENT) {
        out.target = el;
        break;
      }
    }
  }
}
function isOutsideBoundary(handlerInstance, x, y) {
  var painter = handlerInstance.painter;
  return x < 0 || x > painter.getWidth() || y < 0 || y > painter.getHeight();
}
var Handler$1 = Handler;

var DEFAULT_MIN_MERGE = 32;
var DEFAULT_MIN_GALLOPING = 7;
function minRunLength(n) {
  var r = 0;
  while (n >= DEFAULT_MIN_MERGE) {
    r |= n & 1;
    n >>= 1;
  }
  return n + r;
}
function makeAscendingRun(array, lo, hi, compare) {
  var runHi = lo + 1;
  if (runHi === hi) {
    return 1;
  }
  if (compare(array[runHi++], array[lo]) < 0) {
    while (runHi < hi && compare(array[runHi], array[runHi - 1]) < 0) {
      runHi++;
    }
    reverseRun(array, lo, runHi);
  } else {
    while (runHi < hi && compare(array[runHi], array[runHi - 1]) >= 0) {
      runHi++;
    }
  }
  return runHi - lo;
}
function reverseRun(array, lo, hi) {
  hi--;
  while (lo < hi) {
    var t = array[lo];
    array[lo++] = array[hi];
    array[hi--] = t;
  }
}
function binaryInsertionSort(array, lo, hi, start, compare) {
  if (start === lo) {
    start++;
  }
  for (; start < hi; start++) {
    var pivot = array[start];
    var left = lo;
    var right = start;
    var mid;
    while (left < right) {
      mid = left + right >>> 1;
      if (compare(pivot, array[mid]) < 0) {
        right = mid;
      } else {
        left = mid + 1;
      }
    }
    var n = start - left;
    switch (n) {
      case 3:
        array[left + 3] = array[left + 2];
      case 2:
        array[left + 2] = array[left + 1];
      case 1:
        array[left + 1] = array[left];
        break;
      default:
        while (n > 0) {
          array[left + n] = array[left + n - 1];
          n--;
        }
    }
    array[left] = pivot;
  }
}
function gallopLeft(value, array, start, length, hint, compare) {
  var lastOffset = 0;
  var maxOffset = 0;
  var offset = 1;
  if (compare(value, array[start + hint]) > 0) {
    maxOffset = length - hint;
    while (offset < maxOffset && compare(value, array[start + hint + offset]) > 0) {
      lastOffset = offset;
      offset = (offset << 1) + 1;
      if (offset <= 0) {
        offset = maxOffset;
      }
    }
    if (offset > maxOffset) {
      offset = maxOffset;
    }
    lastOffset += hint;
    offset += hint;
  } else {
    maxOffset = hint + 1;
    while (offset < maxOffset && compare(value, array[start + hint - offset]) <= 0) {
      lastOffset = offset;
      offset = (offset << 1) + 1;
      if (offset <= 0) {
        offset = maxOffset;
      }
    }
    if (offset > maxOffset) {
      offset = maxOffset;
    }
    var tmp = lastOffset;
    lastOffset = hint - offset;
    offset = hint - tmp;
  }
  lastOffset++;
  while (lastOffset < offset) {
    var m = lastOffset + (offset - lastOffset >>> 1);
    if (compare(value, array[start + m]) > 0) {
      lastOffset = m + 1;
    } else {
      offset = m;
    }
  }
  return offset;
}
function gallopRight(value, array, start, length, hint, compare) {
  var lastOffset = 0;
  var maxOffset = 0;
  var offset = 1;
  if (compare(value, array[start + hint]) < 0) {
    maxOffset = hint + 1;
    while (offset < maxOffset && compare(value, array[start + hint - offset]) < 0) {
      lastOffset = offset;
      offset = (offset << 1) + 1;
      if (offset <= 0) {
        offset = maxOffset;
      }
    }
    if (offset > maxOffset) {
      offset = maxOffset;
    }
    var tmp = lastOffset;
    lastOffset = hint - offset;
    offset = hint - tmp;
  } else {
    maxOffset = length - hint;
    while (offset < maxOffset && compare(value, array[start + hint + offset]) >= 0) {
      lastOffset = offset;
      offset = (offset << 1) + 1;
      if (offset <= 0) {
        offset = maxOffset;
      }
    }
    if (offset > maxOffset) {
      offset = maxOffset;
    }
    lastOffset += hint;
    offset += hint;
  }
  lastOffset++;
  while (lastOffset < offset) {
    var m = lastOffset + (offset - lastOffset >>> 1);
    if (compare(value, array[start + m]) < 0) {
      offset = m;
    } else {
      lastOffset = m + 1;
    }
  }
  return offset;
}
function TimSort(array, compare) {
  var minGallop = DEFAULT_MIN_GALLOPING;
  var runStart;
  var runLength;
  var stackSize = 0;
  var tmp = [];
  runStart = [];
  runLength = [];
  function pushRun(_runStart, _runLength) {
    runStart[stackSize] = _runStart;
    runLength[stackSize] = _runLength;
    stackSize += 1;
  }
  function mergeRuns() {
    while (stackSize > 1) {
      var n = stackSize - 2;
      if (n >= 1 && runLength[n - 1] <= runLength[n] + runLength[n + 1] || n >= 2 && runLength[n - 2] <= runLength[n] + runLength[n - 1]) {
        if (runLength[n - 1] < runLength[n + 1]) {
          n--;
        }
      } else if (runLength[n] > runLength[n + 1]) {
        break;
      }
      mergeAt(n);
    }
  }
  function forceMergeRuns() {
    while (stackSize > 1) {
      var n = stackSize - 2;
      if (n > 0 && runLength[n - 1] < runLength[n + 1]) {
        n--;
      }
      mergeAt(n);
    }
  }
  function mergeAt(i) {
    var start1 = runStart[i];
    var length1 = runLength[i];
    var start2 = runStart[i + 1];
    var length2 = runLength[i + 1];
    runLength[i] = length1 + length2;
    if (i === stackSize - 3) {
      runStart[i + 1] = runStart[i + 2];
      runLength[i + 1] = runLength[i + 2];
    }
    stackSize--;
    var k = gallopRight(array[start2], array, start1, length1, 0, compare);
    start1 += k;
    length1 -= k;
    if (length1 === 0) {
      return;
    }
    length2 = gallopLeft(array[start1 + length1 - 1], array, start2, length2, length2 - 1, compare);
    if (length2 === 0) {
      return;
    }
    if (length1 <= length2) {
      mergeLow(start1, length1, start2, length2);
    } else {
      mergeHigh(start1, length1, start2, length2);
    }
  }
  function mergeLow(start1, length1, start2, length2) {
    var i = 0;
    for (i = 0; i < length1; i++) {
      tmp[i] = array[start1 + i];
    }
    var cursor1 = 0;
    var cursor2 = start2;
    var dest = start1;
    array[dest++] = array[cursor2++];
    if (--length2 === 0) {
      for (i = 0; i < length1; i++) {
        array[dest + i] = tmp[cursor1 + i];
      }
      return;
    }
    if (length1 === 1) {
      for (i = 0; i < length2; i++) {
        array[dest + i] = array[cursor2 + i];
      }
      array[dest + length2] = tmp[cursor1];
      return;
    }
    var _minGallop = minGallop;
    var count1;
    var count2;
    var exit;
    while (1) {
      count1 = 0;
      count2 = 0;
      exit = false;
      do {
        if (compare(array[cursor2], tmp[cursor1]) < 0) {
          array[dest++] = array[cursor2++];
          count2++;
          count1 = 0;
          if (--length2 === 0) {
            exit = true;
            break;
          }
        } else {
          array[dest++] = tmp[cursor1++];
          count1++;
          count2 = 0;
          if (--length1 === 1) {
            exit = true;
            break;
          }
        }
      } while ((count1 | count2) < _minGallop);
      if (exit) {
        break;
      }
      do {
        count1 = gallopRight(array[cursor2], tmp, cursor1, length1, 0, compare);
        if (count1 !== 0) {
          for (i = 0; i < count1; i++) {
            array[dest + i] = tmp[cursor1 + i];
          }
          dest += count1;
          cursor1 += count1;
          length1 -= count1;
          if (length1 <= 1) {
            exit = true;
            break;
          }
        }
        array[dest++] = array[cursor2++];
        if (--length2 === 0) {
          exit = true;
          break;
        }
        count2 = gallopLeft(tmp[cursor1], array, cursor2, length2, 0, compare);
        if (count2 !== 0) {
          for (i = 0; i < count2; i++) {
            array[dest + i] = array[cursor2 + i];
          }
          dest += count2;
          cursor2 += count2;
          length2 -= count2;
          if (length2 === 0) {
            exit = true;
            break;
          }
        }
        array[dest++] = tmp[cursor1++];
        if (--length1 === 1) {
          exit = true;
          break;
        }
        _minGallop--;
      } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
      if (exit) {
        break;
      }
      if (_minGallop < 0) {
        _minGallop = 0;
      }
      _minGallop += 2;
    }
    minGallop = _minGallop;
    minGallop < 1 && (minGallop = 1);
    if (length1 === 1) {
      for (i = 0; i < length2; i++) {
        array[dest + i] = array[cursor2 + i];
      }
      array[dest + length2] = tmp[cursor1];
    } else if (length1 === 0) {
      throw new Error();
    } else {
      for (i = 0; i < length1; i++) {
        array[dest + i] = tmp[cursor1 + i];
      }
    }
  }
  function mergeHigh(start1, length1, start2, length2) {
    var i = 0;
    for (i = 0; i < length2; i++) {
      tmp[i] = array[start2 + i];
    }
    var cursor1 = start1 + length1 - 1;
    var cursor2 = length2 - 1;
    var dest = start2 + length2 - 1;
    var customCursor = 0;
    var customDest = 0;
    array[dest--] = array[cursor1--];
    if (--length1 === 0) {
      customCursor = dest - (length2 - 1);
      for (i = 0; i < length2; i++) {
        array[customCursor + i] = tmp[i];
      }
      return;
    }
    if (length2 === 1) {
      dest -= length1;
      cursor1 -= length1;
      customDest = dest + 1;
      customCursor = cursor1 + 1;
      for (i = length1 - 1; i >= 0; i--) {
        array[customDest + i] = array[customCursor + i];
      }
      array[dest] = tmp[cursor2];
      return;
    }
    var _minGallop = minGallop;
    while (true) {
      var count1 = 0;
      var count2 = 0;
      var exit = false;
      do {
        if (compare(tmp[cursor2], array[cursor1]) < 0) {
          array[dest--] = array[cursor1--];
          count1++;
          count2 = 0;
          if (--length1 === 0) {
            exit = true;
            break;
          }
        } else {
          array[dest--] = tmp[cursor2--];
          count2++;
          count1 = 0;
          if (--length2 === 1) {
            exit = true;
            break;
          }
        }
      } while ((count1 | count2) < _minGallop);
      if (exit) {
        break;
      }
      do {
        count1 = length1 - gallopRight(tmp[cursor2], array, start1, length1, length1 - 1, compare);
        if (count1 !== 0) {
          dest -= count1;
          cursor1 -= count1;
          length1 -= count1;
          customDest = dest + 1;
          customCursor = cursor1 + 1;
          for (i = count1 - 1; i >= 0; i--) {
            array[customDest + i] = array[customCursor + i];
          }
          if (length1 === 0) {
            exit = true;
            break;
          }
        }
        array[dest--] = tmp[cursor2--];
        if (--length2 === 1) {
          exit = true;
          break;
        }
        count2 = length2 - gallopLeft(array[cursor1], tmp, 0, length2, length2 - 1, compare);
        if (count2 !== 0) {
          dest -= count2;
          cursor2 -= count2;
          length2 -= count2;
          customDest = dest + 1;
          customCursor = cursor2 + 1;
          for (i = 0; i < count2; i++) {
            array[customDest + i] = tmp[customCursor + i];
          }
          if (length2 <= 1) {
            exit = true;
            break;
          }
        }
        array[dest--] = array[cursor1--];
        if (--length1 === 0) {
          exit = true;
          break;
        }
        _minGallop--;
      } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
      if (exit) {
        break;
      }
      if (_minGallop < 0) {
        _minGallop = 0;
      }
      _minGallop += 2;
    }
    minGallop = _minGallop;
    if (minGallop < 1) {
      minGallop = 1;
    }
    if (length2 === 1) {
      dest -= length1;
      cursor1 -= length1;
      customDest = dest + 1;
      customCursor = cursor1 + 1;
      for (i = length1 - 1; i >= 0; i--) {
        array[customDest + i] = array[customCursor + i];
      }
      array[dest] = tmp[cursor2];
    } else if (length2 === 0) {
      throw new Error();
    } else {
      customCursor = dest - (length2 - 1);
      for (i = 0; i < length2; i++) {
        array[customCursor + i] = tmp[i];
      }
    }
  }
  return {
    mergeRuns: mergeRuns,
    forceMergeRuns: forceMergeRuns,
    pushRun: pushRun
  };
}
function sort$2(array, compare, lo, hi) {
  if (!lo) {
    lo = 0;
  }
  if (!hi) {
    hi = array.length;
  }
  var remaining = hi - lo;
  if (remaining < 2) {
    return;
  }
  var runLength = 0;
  if (remaining < DEFAULT_MIN_MERGE) {
    runLength = makeAscendingRun(array, lo, hi, compare);
    binaryInsertionSort(array, lo, hi, lo + runLength, compare);
    return;
  }
  var ts = TimSort(array, compare);
  var minRun = minRunLength(remaining);
  do {
    runLength = makeAscendingRun(array, lo, hi, compare);
    if (runLength < minRun) {
      var force = remaining;
      if (force > minRun) {
        force = minRun;
      }
      binaryInsertionSort(array, lo, lo + force, lo + runLength, compare);
      runLength = force;
    }
    ts.pushRun(lo, runLength);
    ts.mergeRuns();
    remaining -= runLength;
    lo += runLength;
  } while (remaining !== 0);
  ts.forceMergeRuns();
}

var REDRAW_BIT = 1;
var STYLE_CHANGED_BIT = 2;
var SHAPE_CHANGED_BIT = 4;

var invalidZErrorLogged = false;
function logInvalidZError() {
  if (invalidZErrorLogged) {
    return;
  }
  invalidZErrorLogged = true;
  console.warn('z / z2 / zlevel of displayable is invalid, which may cause unexpected errors');
}
function shapeCompareFunc(a, b) {
  if (a.zlevel === b.zlevel) {
    if (a.z === b.z) {
      return a.z2 - b.z2;
    }
    return a.z - b.z;
  }
  return a.zlevel - b.zlevel;
}
var Storage = function () {
  function Storage() {
    this._roots = [];
    this._displayList = [];
    this._displayListLen = 0;
    this.displayableSortFunc = shapeCompareFunc;
  }
  Storage.prototype.traverse = function (cb, context) {
    for (var i = 0; i < this._roots.length; i++) {
      this._roots[i].traverse(cb, context);
    }
  };
  Storage.prototype.getDisplayList = function (update, includeIgnore) {
    includeIgnore = includeIgnore || false;
    var displayList = this._displayList;
    if (update || !displayList.length) {
      this.updateDisplayList(includeIgnore);
    }
    return displayList;
  };
  Storage.prototype.updateDisplayList = function (includeIgnore) {
    this._displayListLen = 0;
    var roots = this._roots;
    var displayList = this._displayList;
    for (var i = 0, len = roots.length; i < len; i++) {
      this._updateAndAddDisplayable(roots[i], null, includeIgnore);
    }
    displayList.length = this._displayListLen;
    sort$2(displayList, shapeCompareFunc);
  };
  Storage.prototype._updateAndAddDisplayable = function (el, clipPaths, includeIgnore) {
    if (el.ignore && !includeIgnore) {
      return;
    }
    el.beforeUpdate();
    el.update();
    el.afterUpdate();
    var userSetClipPath = el.getClipPath();
    if (el.ignoreClip) {
      clipPaths = null;
    } else if (userSetClipPath) {
      if (clipPaths) {
        clipPaths = clipPaths.slice();
      } else {
        clipPaths = [];
      }
      var currentClipPath = userSetClipPath;
      var parentClipPath = el;
      while (currentClipPath) {
        currentClipPath.parent = parentClipPath;
        currentClipPath.updateTransform();
        clipPaths.push(currentClipPath);
        parentClipPath = currentClipPath;
        currentClipPath = currentClipPath.getClipPath();
      }
    }
    if (el.childrenRef) {
      var children = el.childrenRef();
      for (var i = 0; i < children.length; i++) {
        var child = children[i];
        if (el.__dirty) {
          child.__dirty |= REDRAW_BIT;
        }
        this._updateAndAddDisplayable(child, clipPaths, includeIgnore);
      }
      el.__dirty = 0;
    } else {
      var disp = el;
      if (clipPaths && clipPaths.length) {
        disp.__clipPaths = clipPaths;
      } else if (disp.__clipPaths && disp.__clipPaths.length > 0) {
        disp.__clipPaths = [];
      }
      if (isNaN(disp.z)) {
        logInvalidZError();
        disp.z = 0;
      }
      if (isNaN(disp.z2)) {
        logInvalidZError();
        disp.z2 = 0;
      }
      if (isNaN(disp.zlevel)) {
        logInvalidZError();
        disp.zlevel = 0;
      }
      this._displayList[this._displayListLen++] = disp;
    }
    var decalEl = el.getDecalElement && el.getDecalElement();
    if (decalEl) {
      this._updateAndAddDisplayable(decalEl, clipPaths, includeIgnore);
    }
    var textGuide = el.getTextGuideLine();
    if (textGuide) {
      this._updateAndAddDisplayable(textGuide, clipPaths, includeIgnore);
    }
    var textEl = el.getTextContent();
    if (textEl) {
      this._updateAndAddDisplayable(textEl, clipPaths, includeIgnore);
    }
  };
  Storage.prototype.addRoot = function (el) {
    if (el.__zr && el.__zr.storage === this) {
      return;
    }
    this._roots.push(el);
  };
  Storage.prototype.delRoot = function (el) {
    if (el instanceof Array) {
      for (var i = 0, l = el.length; i < l; i++) {
        this.delRoot(el[i]);
      }
      return;
    }
    var idx = indexOf(this._roots, el);
    if (idx >= 0) {
      this._roots.splice(idx, 1);
    }
  };
  Storage.prototype.delAllRoots = function () {
    this._roots = [];
    this._displayList = [];
    this._displayListLen = 0;
    return;
  };
  Storage.prototype.getRoots = function () {
    return this._roots;
  };
  Storage.prototype.dispose = function () {
    this._displayList = null;
    this._roots = null;
  };
  return Storage;
}();
var Storage$1 = Storage;

var requestAnimationFrame$1;
requestAnimationFrame$1 = env$1.hasGlobalWindow && (window.requestAnimationFrame && window.requestAnimationFrame.bind(window) || window.msRequestAnimationFrame && window.msRequestAnimationFrame.bind(window) || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame) || function (func) {
  return setTimeout(func, 16);
};
var requestAnimationFrame$2 = requestAnimationFrame$1;

var easingFuncs = {
  linear: function (k) {
    return k;
  },
  quadraticIn: function (k) {
    return k * k;
  },
  quadraticOut: function (k) {
    return k * (2 - k);
  },
  quadraticInOut: function (k) {
    if ((k *= 2) < 1) {
      return 0.5 * k * k;
    }
    return -0.5 * (--k * (k - 2) - 1);
  },
  cubicIn: function (k) {
    return k * k * k;
  },
  cubicOut: function (k) {
    return --k * k * k + 1;
  },
  cubicInOut: function (k) {
    if ((k *= 2) < 1) {
      return 0.5 * k * k * k;
    }
    return 0.5 * ((k -= 2) * k * k + 2);
  },
  quarticIn: function (k) {
    return k * k * k * k;
  },
  quarticOut: function (k) {
    return 1 - --k * k * k * k;
  },
  quarticInOut: function (k) {
    if ((k *= 2) < 1) {
      return 0.5 * k * k * k * k;
    }
    return -0.5 * ((k -= 2) * k * k * k - 2);
  },
  quinticIn: function (k) {
    return k * k * k * k * k;
  },
  quinticOut: function (k) {
    return --k * k * k * k * k + 1;
  },
  quinticInOut: function (k) {
    if ((k *= 2) < 1) {
      return 0.5 * k * k * k * k * k;
    }
    return 0.5 * ((k -= 2) * k * k * k * k + 2);
  },
  sinusoidalIn: function (k) {
    return 1 - Math.cos(k * Math.PI / 2);
  },
  sinusoidalOut: function (k) {
    return Math.sin(k * Math.PI / 2);
  },
  sinusoidalInOut: function (k) {
    return 0.5 * (1 - Math.cos(Math.PI * k));
  },
  exponentialIn: function (k) {
    return k === 0 ? 0 : Math.pow(1024, k - 1);
  },
  exponentialOut: function (k) {
    return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  },
  exponentialInOut: function (k) {
    if (k === 0) {
      return 0;
    }
    if (k === 1) {
      return 1;
    }
    if ((k *= 2) < 1) {
      return 0.5 * Math.pow(1024, k - 1);
    }
    return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  },
  circularIn: function (k) {
    return 1 - Math.sqrt(1 - k * k);
  },
  circularOut: function (k) {
    return Math.sqrt(1 - --k * k);
  },
  circularInOut: function (k) {
    if ((k *= 2) < 1) {
      return -0.5 * (Math.sqrt(1 - k * k) - 1);
    }
    return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  },
  elasticIn: function (k) {
    var s;
    var a = 0.1;
    var p = 0.4;
    if (k === 0) {
      return 0;
    }
    if (k === 1) {
      return 1;
    }
    if (!a || a < 1) {
      a = 1;
      s = p / 4;
    } else {
      s = p * Math.asin(1 / a) / (2 * Math.PI);
    }
    return -(a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p));
  },
  elasticOut: function (k) {
    var s;
    var a = 0.1;
    var p = 0.4;
    if (k === 0) {
      return 0;
    }
    if (k === 1) {
      return 1;
    }
    if (!a || a < 1) {
      a = 1;
      s = p / 4;
    } else {
      s = p * Math.asin(1 / a) / (2 * Math.PI);
    }
    return a * Math.pow(2, -10 * k) * Math.sin((k - s) * (2 * Math.PI) / p) + 1;
  },
  elasticInOut: function (k) {
    var s;
    var a = 0.1;
    var p = 0.4;
    if (k === 0) {
      return 0;
    }
    if (k === 1) {
      return 1;
    }
    if (!a || a < 1) {
      a = 1;
      s = p / 4;
    } else {
      s = p * Math.asin(1 / a) / (2 * Math.PI);
    }
    if ((k *= 2) < 1) {
      return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p));
    }
    return a * Math.pow(2, -10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
  },
  backIn: function (k) {
    var s = 1.70158;
    return k * k * ((s + 1) * k - s);
  },
  backOut: function (k) {
    var s = 1.70158;
    return --k * k * ((s + 1) * k + s) + 1;
  },
  backInOut: function (k) {
    var s = 1.70158 * 1.525;
    if ((k *= 2) < 1) {
      return 0.5 * (k * k * ((s + 1) * k - s));
    }
    return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
  },
  bounceIn: function (k) {
    return 1 - easingFuncs.bounceOut(1 - k);
  },
  bounceOut: function (k) {
    if (k < 1 / 2.75) {
      return 7.5625 * k * k;
    } else if (k < 2 / 2.75) {
      return 7.5625 * (k -= 1.5 / 2.75) * k + 0.75;
    } else if (k < 2.5 / 2.75) {
      return 7.5625 * (k -= 2.25 / 2.75) * k + 0.9375;
    } else {
      return 7.5625 * (k -= 2.625 / 2.75) * k + 0.984375;
    }
  },
  bounceInOut: function (k) {
    if (k < 0.5) {
      return easingFuncs.bounceIn(k * 2) * 0.5;
    }
    return easingFuncs.bounceOut(k * 2 - 1) * 0.5 + 0.5;
  }
};
var easingFuncs$1 = easingFuncs;

var mathPow$2 = Math.pow;
var mathSqrt$3 = Math.sqrt;
var EPSILON$4 = 1e-8;
var EPSILON_NUMERIC = 1e-4;
var THREE_SQRT = mathSqrt$3(3);
var ONE_THIRD = 1 / 3;
var _v0$4 = create$2();
var _v1$8 = create$2();
var _v2$5 = create$2();
function isAroundZero$1(val) {
  return val > -EPSILON$4 && val < EPSILON$4;
}
function isNotAroundZero$1(val) {
  return val > EPSILON$4 || val < -EPSILON$4;
}
function cubicAt(p0, p1, p2, p3, t) {
  var onet = 1 - t;
  return onet * onet * (onet * p0 + 3 * t * p1) + t * t * (t * p3 + 3 * onet * p2);
}
function cubicDerivativeAt(p0, p1, p2, p3, t) {
  var onet = 1 - t;
  return 3 * (((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet + (p3 - p2) * t * t);
}
function cubicRootAt(p0, p1, p2, p3, val, roots) {
  var a = p3 + 3 * (p1 - p2) - p0;
  var b = 3 * (p2 - p1 * 2 + p0);
  var c = 3 * (p1 - p0);
  var d = p0 - val;
  var A = b * b - 3 * a * c;
  var B = b * c - 9 * a * d;
  var C = c * c - 3 * b * d;
  var n = 0;
  if (isAroundZero$1(A) && isAroundZero$1(B)) {
    if (isAroundZero$1(b)) {
      roots[0] = 0;
    } else {
      var t1 = -c / b;
      if (t1 >= 0 && t1 <= 1) {
        roots[n++] = t1;
      }
    }
  } else {
    var disc = B * B - 4 * A * C;
    if (isAroundZero$1(disc)) {
      var K = B / A;
      var t1 = -b / a + K;
      var t2 = -K / 2;
      if (t1 >= 0 && t1 <= 1) {
        roots[n++] = t1;
      }
      if (t2 >= 0 && t2 <= 1) {
        roots[n++] = t2;
      }
    } else if (disc > 0) {
      var discSqrt = mathSqrt$3(disc);
      var Y1 = A * b + 1.5 * a * (-B + discSqrt);
      var Y2 = A * b + 1.5 * a * (-B - discSqrt);
      if (Y1 < 0) {
        Y1 = -mathPow$2(-Y1, ONE_THIRD);
      } else {
        Y1 = mathPow$2(Y1, ONE_THIRD);
      }
      if (Y2 < 0) {
        Y2 = -mathPow$2(-Y2, ONE_THIRD);
      } else {
        Y2 = mathPow$2(Y2, ONE_THIRD);
      }
      var t1 = (-b - (Y1 + Y2)) / (3 * a);
      if (t1 >= 0 && t1 <= 1) {
        roots[n++] = t1;
      }
    } else {
      var T = (2 * A * b - 3 * a * B) / (2 * mathSqrt$3(A * A * A));
      var theta = Math.acos(T) / 3;
      var ASqrt = mathSqrt$3(A);
      var tmp = Math.cos(theta);
      var t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
      var t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a);
      var t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);
      if (t1 >= 0 && t1 <= 1) {
        roots[n++] = t1;
      }
      if (t2 >= 0 && t2 <= 1) {
        roots[n++] = t2;
      }
      if (t3 >= 0 && t3 <= 1) {
        roots[n++] = t3;
      }
    }
  }
  return n;
}
function cubicExtrema(p0, p1, p2, p3, extrema) {
  var b = 6 * p2 - 12 * p1 + 6 * p0;
  var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
  var c = 3 * p1 - 3 * p0;
  var n = 0;
  if (isAroundZero$1(a)) {
    if (isNotAroundZero$1(b)) {
      var t1 = -c / b;
      if (t1 >= 0 && t1 <= 1) {
        extrema[n++] = t1;
      }
    }
  } else {
    var disc = b * b - 4 * a * c;
    if (isAroundZero$1(disc)) {
      extrema[0] = -b / (2 * a);
    } else if (disc > 0) {
      var discSqrt = mathSqrt$3(disc);
      var t1 = (-b + discSqrt) / (2 * a);
      var t2 = (-b - discSqrt) / (2 * a);
      if (t1 >= 0 && t1 <= 1) {
        extrema[n++] = t1;
      }
      if (t2 >= 0 && t2 <= 1) {
        extrema[n++] = t2;
      }
    }
  }
  return n;
}
function cubicSubdivide(p0, p1, p2, p3, t, out) {
  var p01 = (p1 - p0) * t + p0;
  var p12 = (p2 - p1) * t + p1;
  var p23 = (p3 - p2) * t + p2;
  var p012 = (p12 - p01) * t + p01;
  var p123 = (p23 - p12) * t + p12;
  var p0123 = (p123 - p012) * t + p012;
  out[0] = p0;
  out[1] = p01;
  out[2] = p012;
  out[3] = p0123;
  out[4] = p0123;
  out[5] = p123;
  out[6] = p23;
  out[7] = p3;
}
function cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
  var t;
  var interval = 0.005;
  var d = Infinity;
  var prev;
  var next;
  var d1;
  var d2;
  _v0$4[0] = x;
  _v0$4[1] = y;
  for (var _t = 0; _t < 1; _t += 0.05) {
    _v1$8[0] = cubicAt(x0, x1, x2, x3, _t);
    _v1$8[1] = cubicAt(y0, y1, y2, y3, _t);
    d1 = distSquare(_v0$4, _v1$8);
    if (d1 < d) {
      t = _t;
      d = d1;
    }
  }
  d = Infinity;
  for (var i = 0; i < 32; i++) {
    if (interval < EPSILON_NUMERIC) {
      break;
    }
    prev = t - interval;
    next = t + interval;
    _v1$8[0] = cubicAt(x0, x1, x2, x3, prev);
    _v1$8[1] = cubicAt(y0, y1, y2, y3, prev);
    d1 = distSquare(_v1$8, _v0$4);
    if (prev >= 0 && d1 < d) {
      t = prev;
      d = d1;
    } else {
      _v2$5[0] = cubicAt(x0, x1, x2, x3, next);
      _v2$5[1] = cubicAt(y0, y1, y2, y3, next);
      d2 = distSquare(_v2$5, _v0$4);
      if (next <= 1 && d2 < d) {
        t = next;
        d = d2;
      } else {
        interval *= 0.5;
      }
    }
  }
  if (out) {
    out[0] = cubicAt(x0, x1, x2, x3, t);
    out[1] = cubicAt(y0, y1, y2, y3, t);
  }
  return mathSqrt$3(d);
}
function cubicLength(x0, y0, x1, y1, x2, y2, x3, y3, iteration) {
  var px = x0;
  var py = y0;
  var d = 0;
  var step = 1 / iteration;
  for (var i = 1; i <= iteration; i++) {
    var t = i * step;
    var x = cubicAt(x0, x1, x2, x3, t);
    var y = cubicAt(y0, y1, y2, y3, t);
    var dx = x - px;
    var dy = y - py;
    d += Math.sqrt(dx * dx + dy * dy);
    px = x;
    py = y;
  }
  return d;
}
function quadraticAt$1(p0, p1, p2, t) {
  var onet = 1 - t;
  return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
}
function quadraticDerivativeAt(p0, p1, p2, t) {
  return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
}
function quadraticRootAt(p0, p1, p2, val, roots) {
  var a = p0 - 2 * p1 + p2;
  var b = 2 * (p1 - p0);
  var c = p0 - val;
  var n = 0;
  if (isAroundZero$1(a)) {
    if (isNotAroundZero$1(b)) {
      var t1 = -c / b;
      if (t1 >= 0 && t1 <= 1) {
        roots[n++] = t1;
      }
    }
  } else {
    var disc = b * b - 4 * a * c;
    if (isAroundZero$1(disc)) {
      var t1 = -b / (2 * a);
      if (t1 >= 0 && t1 <= 1) {
        roots[n++] = t1;
      }
    } else if (disc > 0) {
      var discSqrt = mathSqrt$3(disc);
      var t1 = (-b + discSqrt) / (2 * a);
      var t2 = (-b - discSqrt) / (2 * a);
      if (t1 >= 0 && t1 <= 1) {
        roots[n++] = t1;
      }
      if (t2 >= 0 && t2 <= 1) {
        roots[n++] = t2;
      }
    }
  }
  return n;
}
function quadraticExtremum(p0, p1, p2) {
  var divider = p0 + p2 - 2 * p1;
  if (divider === 0) {
    return 0.5;
  } else {
    return (p0 - p1) / divider;
  }
}
function quadraticSubdivide(p0, p1, p2, t, out) {
  var p01 = (p1 - p0) * t + p0;
  var p12 = (p2 - p1) * t + p1;
  var p012 = (p12 - p01) * t + p01;
  out[0] = p0;
  out[1] = p01;
  out[2] = p012;
  out[3] = p012;
  out[4] = p12;
  out[5] = p2;
}
function quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
  var t;
  var interval = 0.005;
  var d = Infinity;
  _v0$4[0] = x;
  _v0$4[1] = y;
  for (var _t = 0; _t < 1; _t += 0.05) {
    _v1$8[0] = quadraticAt$1(x0, x1, x2, _t);
    _v1$8[1] = quadraticAt$1(y0, y1, y2, _t);
    var d1 = distSquare(_v0$4, _v1$8);
    if (d1 < d) {
      t = _t;
      d = d1;
    }
  }
  d = Infinity;
  for (var i = 0; i < 32; i++) {
    if (interval < EPSILON_NUMERIC) {
      break;
    }
    var prev = t - interval;
    var next = t + interval;
    _v1$8[0] = quadraticAt$1(x0, x1, x2, prev);
    _v1$8[1] = quadraticAt$1(y0, y1, y2, prev);
    var d1 = distSquare(_v1$8, _v0$4);
    if (prev >= 0 && d1 < d) {
      t = prev;
      d = d1;
    } else {
      _v2$5[0] = quadraticAt$1(x0, x1, x2, next);
      _v2$5[1] = quadraticAt$1(y0, y1, y2, next);
      var d2 = distSquare(_v2$5, _v0$4);
      if (next <= 1 && d2 < d) {
        t = next;
        d = d2;
      } else {
        interval *= 0.5;
      }
    }
  }
  if (out) {
    out[0] = quadraticAt$1(x0, x1, x2, t);
    out[1] = quadraticAt$1(y0, y1, y2, t);
  }
  return mathSqrt$3(d);
}
function quadraticLength(x0, y0, x1, y1, x2, y2, iteration) {
  var px = x0;
  var py = y0;
  var d = 0;
  var step = 1 / iteration;
  for (var i = 1; i <= iteration; i++) {
    var t = i * step;
    var x = quadraticAt$1(x0, x1, x2, t);
    var y = quadraticAt$1(y0, y1, y2, t);
    var dx = x - px;
    var dy = y - py;
    d += Math.sqrt(dx * dx + dy * dy);
    px = x;
    py = y;
  }
  return d;
}

var regexp = /cubic-bezier\(([0-9,\.e ]+)\)/;
function createCubicEasingFunc(cubicEasingStr) {
  var cubic = cubicEasingStr && regexp.exec(cubicEasingStr);
  if (cubic) {
    var points = cubic[1].split(',');
    var a_1 = +trim$1(points[0]);
    var b_1 = +trim$1(points[1]);
    var c_1 = +trim$1(points[2]);
    var d_1 = +trim$1(points[3]);
    if (isNaN(a_1 + b_1 + c_1 + d_1)) {
      return;
    }
    var roots_1 = [];
    return function (p) {
      return p <= 0 ? 0 : p >= 1 ? 1 : cubicRootAt(0, a_1, c_1, 1, p, roots_1) && cubicAt(0, b_1, d_1, 1, roots_1[0]);
    };
  }
}

var Clip = function () {
  function Clip(opts) {
    this._inited = false;
    this._startTime = 0;
    this._pausedTime = 0;
    this._paused = false;
    this._life = opts.life || 1000;
    this._delay = opts.delay || 0;
    this.loop = opts.loop || false;
    this.onframe = opts.onframe || noop;
    this.ondestroy = opts.ondestroy || noop;
    this.onrestart = opts.onrestart || noop;
    opts.easing && this.setEasing(opts.easing);
  }
  Clip.prototype.step = function (globalTime, deltaTime) {
    if (!this._inited) {
      this._startTime = globalTime + this._delay;
      this._inited = true;
    }
    if (this._paused) {
      this._pausedTime += deltaTime;
      return;
    }
    var life = this._life;
    var elapsedTime = globalTime - this._startTime - this._pausedTime;
    var percent = elapsedTime / life;
    if (percent < 0) {
      percent = 0;
    }
    percent = Math.min(percent, 1);
    var easingFunc = this.easingFunc;
    var schedule = easingFunc ? easingFunc(percent) : percent;
    this.onframe(schedule);
    if (percent === 1) {
      if (this.loop) {
        var remainder = elapsedTime % life;
        this._startTime = globalTime - remainder;
        this._pausedTime = 0;
        this.onrestart();
      } else {
        return true;
      }
    }
    return false;
  };
  Clip.prototype.pause = function () {
    this._paused = true;
  };
  Clip.prototype.resume = function () {
    this._paused = false;
  };
  Clip.prototype.setEasing = function (easing) {
    this.easing = easing;
    this.easingFunc = isFunction(easing) ? easing : easingFuncs$1[easing] || createCubicEasingFunc(easing);
  };
  return Clip;
}();
var Clip$1 = Clip;

var Entry = function () {
  function Entry(val) {
    this.value = val;
  }
  return Entry;
}();
var LinkedList = function () {
  function LinkedList() {
    this._len = 0;
  }
  LinkedList.prototype.insert = function (val) {
    var entry = new Entry(val);
    this.insertEntry(entry);
    return entry;
  };
  LinkedList.prototype.insertEntry = function (entry) {
    if (!this.head) {
      this.head = this.tail = entry;
    } else {
      this.tail.next = entry;
      entry.prev = this.tail;
      entry.next = null;
      this.tail = entry;
    }
    this._len++;
  };
  LinkedList.prototype.remove = function (entry) {
    var prev = entry.prev;
    var next = entry.next;
    if (prev) {
      prev.next = next;
    } else {
      this.head = next;
    }
    if (next) {
      next.prev = prev;
    } else {
      this.tail = prev;
    }
    entry.next = entry.prev = null;
    this._len--;
  };
  LinkedList.prototype.len = function () {
    return this._len;
  };
  LinkedList.prototype.clear = function () {
    this.head = this.tail = null;
    this._len = 0;
  };
  return LinkedList;
}();
var LRU = function () {
  function LRU(maxSize) {
    this._list = new LinkedList();
    this._maxSize = 10;
    this._map = {};
    this._maxSize = maxSize;
  }
  LRU.prototype.put = function (key, value) {
    var list = this._list;
    var map = this._map;
    var removed = null;
    if (map[key] == null) {
      var len = list.len();
      var entry = this._lastRemovedEntry;
      if (len >= this._maxSize && len > 0) {
        var leastUsedEntry = list.head;
        list.remove(leastUsedEntry);
        delete map[leastUsedEntry.key];
        removed = leastUsedEntry.value;
        this._lastRemovedEntry = leastUsedEntry;
      }
      if (entry) {
        entry.value = value;
      } else {
        entry = new Entry(value);
      }
      entry.key = key;
      list.insertEntry(entry);
      map[key] = entry;
    }
    return removed;
  };
  LRU.prototype.get = function (key) {
    var entry = this._map[key];
    var list = this._list;
    if (entry != null) {
      if (entry !== list.tail) {
        list.remove(entry);
        list.insertEntry(entry);
      }
      return entry.value;
    }
  };
  LRU.prototype.clear = function () {
    this._list.clear();
    this._map = {};
  };
  LRU.prototype.len = function () {
    return this._list.len();
  };
  return LRU;
}();
var LRU$1 = LRU;

var kCSSColorTable = {
  'transparent': [0, 0, 0, 0],
  'aliceblue': [240, 248, 255, 1],
  'antiquewhite': [250, 235, 215, 1],
  'aqua': [0, 255, 255, 1],
  'aquamarine': [127, 255, 212, 1],
  'azure': [240, 255, 255, 1],
  'beige': [245, 245, 220, 1],
  'bisque': [255, 228, 196, 1],
  'black': [0, 0, 0, 1],
  'blanchedalmond': [255, 235, 205, 1],
  'blue': [0, 0, 255, 1],
  'blueviolet': [138, 43, 226, 1],
  'brown': [165, 42, 42, 1],
  'burlywood': [222, 184, 135, 1],
  'cadetblue': [95, 158, 160, 1],
  'chartreuse': [127, 255, 0, 1],
  'chocolate': [210, 105, 30, 1],
  'coral': [255, 127, 80, 1],
  'cornflowerblue': [100, 149, 237, 1],
  'cornsilk': [255, 248, 220, 1],
  'crimson': [220, 20, 60, 1],
  'cyan': [0, 255, 255, 1],
  'darkblue': [0, 0, 139, 1],
  'darkcyan': [0, 139, 139, 1],
  'darkgoldenrod': [184, 134, 11, 1],
  'darkgray': [169, 169, 169, 1],
  'darkgreen': [0, 100, 0, 1],
  'darkgrey': [169, 169, 169, 1],
  'darkkhaki': [189, 183, 107, 1],
  'darkmagenta': [139, 0, 139, 1],
  'darkolivegreen': [85, 107, 47, 1],
  'darkorange': [255, 140, 0, 1],
  'darkorchid': [153, 50, 204, 1],
  'darkred': [139, 0, 0, 1],
  'darksalmon': [233, 150, 122, 1],
  'darkseagreen': [143, 188, 143, 1],
  'darkslateblue': [72, 61, 139, 1],
  'darkslategray': [47, 79, 79, 1],
  'darkslategrey': [47, 79, 79, 1],
  'darkturquoise': [0, 206, 209, 1],
  'darkviolet': [148, 0, 211, 1],
  'deeppink': [255, 20, 147, 1],
  'deepskyblue': [0, 191, 255, 1],
  'dimgray': [105, 105, 105, 1],
  'dimgrey': [105, 105, 105, 1],
  'dodgerblue': [30, 144, 255, 1],
  'firebrick': [178, 34, 34, 1],
  'floralwhite': [255, 250, 240, 1],
  'forestgreen': [34, 139, 34, 1],
  'fuchsia': [255, 0, 255, 1],
  'gainsboro': [220, 220, 220, 1],
  'ghostwhite': [248, 248, 255, 1],
  'gold': [255, 215, 0, 1],
  'goldenrod': [218, 165, 32, 1],
  'gray': [128, 128, 128, 1],
  'green': [0, 128, 0, 1],
  'greenyellow': [173, 255, 47, 1],
  'grey': [128, 128, 128, 1],
  'honeydew': [240, 255, 240, 1],
  'hotpink': [255, 105, 180, 1],
  'indianred': [205, 92, 92, 1],
  'indigo': [75, 0, 130, 1],
  'ivory': [255, 255, 240, 1],
  'khaki': [240, 230, 140, 1],
  'lavender': [230, 230, 250, 1],
  'lavenderblush': [255, 240, 245, 1],
  'lawngreen': [124, 252, 0, 1],
  'lemonchiffon': [255, 250, 205, 1],
  'lightblue': [173, 216, 230, 1],
  'lightcoral': [240, 128, 128, 1],
  'lightcyan': [224, 255, 255, 1],
  'lightgoldenrodyellow': [250, 250, 210, 1],
  'lightgray': [211, 211, 211, 1],
  'lightgreen': [144, 238, 144, 1],
  'lightgrey': [211, 211, 211, 1],
  'lightpink': [255, 182, 193, 1],
  'lightsalmon': [255, 160, 122, 1],
  'lightseagreen': [32, 178, 170, 1],
  'lightskyblue': [135, 206, 250, 1],
  'lightslategray': [119, 136, 153, 1],
  'lightslategrey': [119, 136, 153, 1],
  'lightsteelblue': [176, 196, 222, 1],
  'lightyellow': [255, 255, 224, 1],
  'lime': [0, 255, 0, 1],
  'limegreen': [50, 205, 50, 1],
  'linen': [250, 240, 230, 1],
  'magenta': [255, 0, 255, 1],
  'maroon': [128, 0, 0, 1],
  'mediumaquamarine': [102, 205, 170, 1],
  'mediumblue': [0, 0, 205, 1],
  'mediumorchid': [186, 85, 211, 1],
  'mediumpurple': [147, 112, 219, 1],
  'mediumseagreen': [60, 179, 113, 1],
  'mediumslateblue': [123, 104, 238, 1],
  'mediumspringgreen': [0, 250, 154, 1],
  'mediumturquoise': [72, 209, 204, 1],
  'mediumvioletred': [199, 21, 133, 1],
  'midnightblue': [25, 25, 112, 1],
  'mintcream': [245, 255, 250, 1],
  'mistyrose': [255, 228, 225, 1],
  'moccasin': [255, 228, 181, 1],
  'navajowhite': [255, 222, 173, 1],
  'navy': [0, 0, 128, 1],
  'oldlace': [253, 245, 230, 1],
  'olive': [128, 128, 0, 1],
  'olivedrab': [107, 142, 35, 1],
  'orange': [255, 165, 0, 1],
  'orangered': [255, 69, 0, 1],
  'orchid': [218, 112, 214, 1],
  'palegoldenrod': [238, 232, 170, 1],
  'palegreen': [152, 251, 152, 1],
  'paleturquoise': [175, 238, 238, 1],
  'palevioletred': [219, 112, 147, 1],
  'papayawhip': [255, 239, 213, 1],
  'peachpuff': [255, 218, 185, 1],
  'peru': [205, 133, 63, 1],
  'pink': [255, 192, 203, 1],
  'plum': [221, 160, 221, 1],
  'powderblue': [176, 224, 230, 1],
  'purple': [128, 0, 128, 1],
  'red': [255, 0, 0, 1],
  'rosybrown': [188, 143, 143, 1],
  'royalblue': [65, 105, 225, 1],
  'saddlebrown': [139, 69, 19, 1],
  'salmon': [250, 128, 114, 1],
  'sandybrown': [244, 164, 96, 1],
  'seagreen': [46, 139, 87, 1],
  'seashell': [255, 245, 238, 1],
  'sienna': [160, 82, 45, 1],
  'silver': [192, 192, 192, 1],
  'skyblue': [135, 206, 235, 1],
  'slateblue': [106, 90, 205, 1],
  'slategray': [112, 128, 144, 1],
  'slategrey': [112, 128, 144, 1],
  'snow': [255, 250, 250, 1],
  'springgreen': [0, 255, 127, 1],
  'steelblue': [70, 130, 180, 1],
  'tan': [210, 180, 140, 1],
  'teal': [0, 128, 128, 1],
  'thistle': [216, 191, 216, 1],
  'tomato': [255, 99, 71, 1],
  'turquoise': [64, 224, 208, 1],
  'violet': [238, 130, 238, 1],
  'wheat': [245, 222, 179, 1],
  'white': [255, 255, 255, 1],
  'whitesmoke': [245, 245, 245, 1],
  'yellow': [255, 255, 0, 1],
  'yellowgreen': [154, 205, 50, 1]
};
function clampCssByte(i) {
  i = Math.round(i);
  return i < 0 ? 0 : i > 255 ? 255 : i;
}
function clampCssAngle(i) {
  i = Math.round(i);
  return i < 0 ? 0 : i > 360 ? 360 : i;
}
function clampCssFloat(f) {
  return f < 0 ? 0 : f > 1 ? 1 : f;
}
function parseCssInt(val) {
  var str = val;
  if (str.length && str.charAt(str.length - 1) === '%') {
    return clampCssByte(parseFloat(str) / 100 * 255);
  }
  return clampCssByte(parseInt(str, 10));
}
function parseCssFloat(val) {
  var str = val;
  if (str.length && str.charAt(str.length - 1) === '%') {
    return clampCssFloat(parseFloat(str) / 100);
  }
  return clampCssFloat(parseFloat(str));
}
function cssHueToRgb(m1, m2, h) {
  if (h < 0) {
    h += 1;
  } else if (h > 1) {
    h -= 1;
  }
  if (h * 6 < 1) {
    return m1 + (m2 - m1) * h * 6;
  }
  if (h * 2 < 1) {
    return m2;
  }
  if (h * 3 < 2) {
    return m1 + (m2 - m1) * (2 / 3 - h) * 6;
  }
  return m1;
}
function lerpNumber(a, b, p) {
  return a + (b - a) * p;
}
function setRgba(out, r, g, b, a) {
  out[0] = r;
  out[1] = g;
  out[2] = b;
  out[3] = a;
  return out;
}
function copyRgba(out, a) {
  out[0] = a[0];
  out[1] = a[1];
  out[2] = a[2];
  out[3] = a[3];
  return out;
}
var colorCache = new LRU$1(20);
var lastRemovedArr = null;
function putToCache(colorStr, rgbaArr) {
  if (lastRemovedArr) {
    copyRgba(lastRemovedArr, rgbaArr);
  }
  lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || rgbaArr.slice());
}
function parse(colorStr, rgbaArr) {
  if (!colorStr) {
    return;
  }
  rgbaArr = rgbaArr || [];
  var cached = colorCache.get(colorStr);
  if (cached) {
    return copyRgba(rgbaArr, cached);
  }
  colorStr = colorStr + '';
  var str = colorStr.replace(/ /g, '').toLowerCase();
  if (str in kCSSColorTable) {
    copyRgba(rgbaArr, kCSSColorTable[str]);
    putToCache(colorStr, rgbaArr);
    return rgbaArr;
  }
  var strLen = str.length;
  if (str.charAt(0) === '#') {
    if (strLen === 4 || strLen === 5) {
      var iv = parseInt(str.slice(1, 4), 16);
      if (!(iv >= 0 && iv <= 0xfff)) {
        setRgba(rgbaArr, 0, 0, 0, 1);
        return;
      }
      setRgba(rgbaArr, (iv & 0xf00) >> 4 | (iv & 0xf00) >> 8, iv & 0xf0 | (iv & 0xf0) >> 4, iv & 0xf | (iv & 0xf) << 4, strLen === 5 ? parseInt(str.slice(4), 16) / 0xf : 1);
      putToCache(colorStr, rgbaArr);
      return rgbaArr;
    } else if (strLen === 7 || strLen === 9) {
      var iv = parseInt(str.slice(1, 7), 16);
      if (!(iv >= 0 && iv <= 0xffffff)) {
        setRgba(rgbaArr, 0, 0, 0, 1);
        return;
      }
      setRgba(rgbaArr, (iv & 0xff0000) >> 16, (iv & 0xff00) >> 8, iv & 0xff, strLen === 9 ? parseInt(str.slice(7), 16) / 0xff : 1);
      putToCache(colorStr, rgbaArr);
      return rgbaArr;
    }
    return;
  }
  var op = str.indexOf('(');
  var ep = str.indexOf(')');
  if (op !== -1 && ep + 1 === strLen) {
    var fname = str.substr(0, op);
    var params = str.substr(op + 1, ep - (op + 1)).split(',');
    var alpha = 1;
    switch (fname) {
      case 'rgba':
        if (params.length !== 4) {
          return params.length === 3 ? setRgba(rgbaArr, +params[0], +params[1], +params[2], 1) : setRgba(rgbaArr, 0, 0, 0, 1);
        }
        alpha = parseCssFloat(params.pop());
      case 'rgb':
        if (params.length >= 3) {
          setRgba(rgbaArr, parseCssInt(params[0]), parseCssInt(params[1]), parseCssInt(params[2]), params.length === 3 ? alpha : parseCssFloat(params[3]));
          putToCache(colorStr, rgbaArr);
          return rgbaArr;
        } else {
          setRgba(rgbaArr, 0, 0, 0, 1);
          return;
        }
      case 'hsla':
        if (params.length !== 4) {
          setRgba(rgbaArr, 0, 0, 0, 1);
          return;
        }
        params[3] = parseCssFloat(params[3]);
        hsla2rgba(params, rgbaArr);
        putToCache(colorStr, rgbaArr);
        return rgbaArr;
      case 'hsl':
        if (params.length !== 3) {
          setRgba(rgbaArr, 0, 0, 0, 1);
          return;
        }
        hsla2rgba(params, rgbaArr);
        putToCache(colorStr, rgbaArr);
        return rgbaArr;
      default:
        return;
    }
  }
  setRgba(rgbaArr, 0, 0, 0, 1);
  return;
}
function hsla2rgba(hsla, rgba) {
  var h = (parseFloat(hsla[0]) % 360 + 360) % 360 / 360;
  var s = parseCssFloat(hsla[1]);
  var l = parseCssFloat(hsla[2]);
  var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
  var m1 = l * 2 - m2;
  rgba = rgba || [];
  setRgba(rgba, clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), clampCssByte(cssHueToRgb(m1, m2, h) * 255), clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), 1);
  if (hsla.length === 4) {
    rgba[3] = hsla[3];
  }
  return rgba;
}
function rgba2hsla(rgba) {
  if (!rgba) {
    return;
  }
  var R = rgba[0] / 255;
  var G = rgba[1] / 255;
  var B = rgba[2] / 255;
  var vMin = Math.min(R, G, B);
  var vMax = Math.max(R, G, B);
  var delta = vMax - vMin;
  var L = (vMax + vMin) / 2;
  var H;
  var S;
  if (delta === 0) {
    H = 0;
    S = 0;
  } else {
    if (L < 0.5) {
      S = delta / (vMax + vMin);
    } else {
      S = delta / (2 - vMax - vMin);
    }
    var deltaR = ((vMax - R) / 6 + delta / 2) / delta;
    var deltaG = ((vMax - G) / 6 + delta / 2) / delta;
    var deltaB = ((vMax - B) / 6 + delta / 2) / delta;
    if (R === vMax) {
      H = deltaB - deltaG;
    } else if (G === vMax) {
      H = 1 / 3 + deltaR - deltaB;
    } else if (B === vMax) {
      H = 2 / 3 + deltaG - deltaR;
    }
    if (H < 0) {
      H += 1;
    }
    if (H > 1) {
      H -= 1;
    }
  }
  var hsla = [H * 360, S, L];
  if (rgba[3] != null) {
    hsla.push(rgba[3]);
  }
  return hsla;
}
function lift(color, level) {
  var colorArr = parse(color);
  if (colorArr) {
    for (var i = 0; i < 3; i++) {
      if (level < 0) {
        colorArr[i] = colorArr[i] * (1 - level) | 0;
      } else {
        colorArr[i] = (255 - colorArr[i]) * level + colorArr[i] | 0;
      }
      if (colorArr[i] > 255) {
        colorArr[i] = 255;
      } else if (colorArr[i] < 0) {
        colorArr[i] = 0;
      }
    }
    return stringify(colorArr, colorArr.length === 4 ? 'rgba' : 'rgb');
  }
}
function fastLerp(normalizedValue, colors, out) {
  if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1)) {
    return;
  }
  out = out || [];
  var value = normalizedValue * (colors.length - 1);
  var leftIndex = Math.floor(value);
  var rightIndex = Math.ceil(value);
  var leftColor = colors[leftIndex];
  var rightColor = colors[rightIndex];
  var dv = value - leftIndex;
  out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));
  out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));
  out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));
  out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));
  return out;
}
function lerp$2(normalizedValue, colors, fullOutput) {
  if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1)) {
    return;
  }
  var value = normalizedValue * (colors.length - 1);
  var leftIndex = Math.floor(value);
  var rightIndex = Math.ceil(value);
  var leftColor = parse(colors[leftIndex]);
  var rightColor = parse(colors[rightIndex]);
  var dv = value - leftIndex;
  var color = stringify([clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)), clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)), clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)), clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))], 'rgba');
  return fullOutput ? {
    color: color,
    leftIndex: leftIndex,
    rightIndex: rightIndex,
    value: value
  } : color;
}
function modifyHSL(color, h, s, l) {
  var colorArr = parse(color);
  if (color) {
    colorArr = rgba2hsla(colorArr);
    h != null && (colorArr[0] = clampCssAngle(h));
    s != null && (colorArr[1] = parseCssFloat(s));
    l != null && (colorArr[2] = parseCssFloat(l));
    return stringify(hsla2rgba(colorArr), 'rgba');
  }
}
function modifyAlpha(color, alpha) {
  var colorArr = parse(color);
  if (colorArr && alpha != null) {
    colorArr[3] = clampCssFloat(alpha);
    return stringify(colorArr, 'rgba');
  }
}
function stringify(arrColor, type) {
  if (!arrColor || !arrColor.length) {
    return;
  }
  var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2];
  if (type === 'rgba' || type === 'hsva' || type === 'hsla') {
    colorStr += ',' + arrColor[3];
  }
  return type + '(' + colorStr + ')';
}
function lum(color, backgroundLum) {
  var arr = parse(color);
  return arr ? (0.299 * arr[0] + 0.587 * arr[1] + 0.114 * arr[2]) * arr[3] / 255 + (1 - arr[3]) * backgroundLum : 0;
}
var liftedColorCache = new LRU$1(100);
function liftColor(color) {
  if (isString(color)) {
    var liftedColor = liftedColorCache.get(color);
    if (!liftedColor) {
      liftedColor = lift(color, -0.1);
      liftedColorCache.put(color, liftedColor);
    }
    return liftedColor;
  } else if (isGradientObject(color)) {
    var ret = extend({}, color);
    ret.colorStops = map$1(color.colorStops, function (stop) {
      return {
        offset: stop.offset,
        color: lift(stop.color, -0.1)
      };
    });
    return ret;
  }
  return color;
}

var mathRound$1 = Math.round;
function normalizeColor(color) {
  var opacity;
  if (!color || color === 'transparent') {
    color = 'none';
  } else if (typeof color === 'string' && color.indexOf('rgba') > -1) {
    var arr = parse(color);
    if (arr) {
      color = 'rgb(' + arr[0] + ',' + arr[1] + ',' + arr[2] + ')';
      opacity = arr[3];
    }
  }
  return {
    color: color,
    opacity: opacity == null ? 1 : opacity
  };
}
var EPSILON$3 = 1e-4;
function isAroundZero(transform) {
  return transform < EPSILON$3 && transform > -EPSILON$3;
}
function round3(transform) {
  return mathRound$1(transform * 1e3) / 1e3;
}
function round4(transform) {
  return mathRound$1(transform * 1e4) / 1e4;
}
function getMatrixStr(m) {
  return 'matrix(' + round3(m[0]) + ',' + round3(m[1]) + ',' + round3(m[2]) + ',' + round3(m[3]) + ',' + round4(m[4]) + ',' + round4(m[5]) + ')';
}
var TEXT_ALIGN_TO_ANCHOR = {
  left: 'start',
  right: 'end',
  center: 'middle',
  middle: 'middle'
};
function adjustTextY$1(y, lineHeight, textBaseline) {
  if (textBaseline === 'top') {
    y += lineHeight / 2;
  } else if (textBaseline === 'bottom') {
    y -= lineHeight / 2;
  }
  return y;
}
function hasShadow(style) {
  return style && (style.shadowBlur || style.shadowOffsetX || style.shadowOffsetY);
}
function getShadowKey(displayable) {
  var style = displayable.style;
  var globalScale = displayable.getGlobalScale();
  return [style.shadowColor, (style.shadowBlur || 0).toFixed(2), (style.shadowOffsetX || 0).toFixed(2), (style.shadowOffsetY || 0).toFixed(2), globalScale[0], globalScale[1]].join(',');
}
function isImagePattern(val) {
  return val && !!val.image;
}
function isSVGPattern(val) {
  return val && !!val.svgElement;
}
function isPattern(val) {
  return isImagePattern(val) || isSVGPattern(val);
}
function isLinearGradient(val) {
  return val.type === 'linear';
}
function isRadialGradient(val) {
  return val.type === 'radial';
}
function isGradient(val) {
  return val && (val.type === 'linear' || val.type === 'radial');
}
function getIdURL(id) {
  return "url(#" + id + ")";
}
function getPathPrecision(el) {
  var scale = el.getGlobalScale();
  var size = Math.max(scale[0], scale[1]);
  return Math.max(Math.ceil(Math.log(size) / Math.log(10)), 1);
}
function getSRTTransformString(transform) {
  var x = transform.x || 0;
  var y = transform.y || 0;
  var rotation = (transform.rotation || 0) * RADIAN_TO_DEGREE;
  var scaleX = retrieve2(transform.scaleX, 1);
  var scaleY = retrieve2(transform.scaleY, 1);
  var skewX = transform.skewX || 0;
  var skewY = transform.skewY || 0;
  var res = [];
  if (x || y) {
    res.push("translate(" + x + "px," + y + "px)");
  }
  if (rotation) {
    res.push("rotate(" + rotation + ")");
  }
  if (scaleX !== 1 || scaleY !== 1) {
    res.push("scale(" + scaleX + "," + scaleY + ")");
  }
  if (skewX || skewY) {
    res.push("skew(" + mathRound$1(skewX * RADIAN_TO_DEGREE) + "deg, " + mathRound$1(skewY * RADIAN_TO_DEGREE) + "deg)");
  }
  return res.join(' ');
}
var encodeBase64 = function () {
  if (env$1.hasGlobalWindow && isFunction(window.btoa)) {
    return function (str) {
      return window.btoa(unescape(encodeURIComponent(str)));
    };
  }
  if (typeof Buffer !== 'undefined') {
    return function (str) {
      return Buffer.from(str).toString('base64');
    };
  }
  return function (str) {
    {
      logError('Base64 isn\'t natively supported in the current environment.');
    }
    return null;
  };
}();

var arraySlice = Array.prototype.slice;
function interpolateNumber$1(p0, p1, percent) {
  return (p1 - p0) * percent + p0;
}
function interpolate1DArray(out, p0, p1, percent) {
  var len = p0.length;
  for (var i = 0; i < len; i++) {
    out[i] = interpolateNumber$1(p0[i], p1[i], percent);
  }
  return out;
}
function interpolate2DArray(out, p0, p1, percent) {
  var len = p0.length;
  var len2 = len && p0[0].length;
  for (var i = 0; i < len; i++) {
    if (!out[i]) {
      out[i] = [];
    }
    for (var j = 0; j < len2; j++) {
      out[i][j] = interpolateNumber$1(p0[i][j], p1[i][j], percent);
    }
  }
  return out;
}
function add1DArray(out, p0, p1, sign) {
  var len = p0.length;
  for (var i = 0; i < len; i++) {
    out[i] = p0[i] + p1[i] * sign;
  }
  return out;
}
function add2DArray(out, p0, p1, sign) {
  var len = p0.length;
  var len2 = len && p0[0].length;
  for (var i = 0; i < len; i++) {
    if (!out[i]) {
      out[i] = [];
    }
    for (var j = 0; j < len2; j++) {
      out[i][j] = p0[i][j] + p1[i][j] * sign;
    }
  }
  return out;
}
function fillColorStops(val0, val1) {
  var len0 = val0.length;
  var len1 = val1.length;
  var shorterArr = len0 > len1 ? val1 : val0;
  var shorterLen = Math.min(len0, len1);
  var last = shorterArr[shorterLen - 1] || {
    color: [0, 0, 0, 0],
    offset: 0
  };
  for (var i = shorterLen; i < Math.max(len0, len1); i++) {
    shorterArr.push({
      offset: last.offset,
      color: last.color.slice()
    });
  }
}
function fillArray(val0, val1, arrDim) {
  var arr0 = val0;
  var arr1 = val1;
  if (!arr0.push || !arr1.push) {
    return;
  }
  var arr0Len = arr0.length;
  var arr1Len = arr1.length;
  if (arr0Len !== arr1Len) {
    var isPreviousLarger = arr0Len > arr1Len;
    if (isPreviousLarger) {
      arr0.length = arr1Len;
    } else {
      for (var i = arr0Len; i < arr1Len; i++) {
        arr0.push(arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i]));
      }
    }
  }
  var len2 = arr0[0] && arr0[0].length;
  for (var i = 0; i < arr0.length; i++) {
    if (arrDim === 1) {
      if (isNaN(arr0[i])) {
        arr0[i] = arr1[i];
      }
    } else {
      for (var j = 0; j < len2; j++) {
        if (isNaN(arr0[i][j])) {
          arr0[i][j] = arr1[i][j];
        }
      }
    }
  }
}
function cloneValue(value) {
  if (isArrayLike(value)) {
    var len = value.length;
    if (isArrayLike(value[0])) {
      var ret = [];
      for (var i = 0; i < len; i++) {
        ret.push(arraySlice.call(value[i]));
      }
      return ret;
    }
    return arraySlice.call(value);
  }
  return value;
}
function rgba2String(rgba) {
  rgba[0] = Math.floor(rgba[0]) || 0;
  rgba[1] = Math.floor(rgba[1]) || 0;
  rgba[2] = Math.floor(rgba[2]) || 0;
  rgba[3] = rgba[3] == null ? 1 : rgba[3];
  return 'rgba(' + rgba.join(',') + ')';
}
function guessArrayDim(value) {
  return isArrayLike(value && value[0]) ? 2 : 1;
}
var VALUE_TYPE_NUMBER = 0;
var VALUE_TYPE_1D_ARRAY = 1;
var VALUE_TYPE_2D_ARRAY = 2;
var VALUE_TYPE_COLOR = 3;
var VALUE_TYPE_LINEAR_GRADIENT = 4;
var VALUE_TYPE_RADIAL_GRADIENT = 5;
var VALUE_TYPE_UNKOWN = 6;
function isGradientValueType(valType) {
  return valType === VALUE_TYPE_LINEAR_GRADIENT || valType === VALUE_TYPE_RADIAL_GRADIENT;
}
function isArrayValueType(valType) {
  return valType === VALUE_TYPE_1D_ARRAY || valType === VALUE_TYPE_2D_ARRAY;
}
var tmpRgba = [0, 0, 0, 0];
var Track = function () {
  function Track(propName) {
    this.keyframes = [];
    this.discrete = false;
    this._invalid = false;
    this._needsSort = false;
    this._lastFr = 0;
    this._lastFrP = 0;
    this.propName = propName;
  }
  Track.prototype.isFinished = function () {
    return this._finished;
  };
  Track.prototype.setFinished = function () {
    this._finished = true;
    if (this._additiveTrack) {
      this._additiveTrack.setFinished();
    }
  };
  Track.prototype.needsAnimate = function () {
    return this.keyframes.length >= 1;
  };
  Track.prototype.getAdditiveTrack = function () {
    return this._additiveTrack;
  };
  Track.prototype.addKeyframe = function (time, rawValue, easing) {
    this._needsSort = true;
    var keyframes = this.keyframes;
    var len = keyframes.length;
    var discrete = false;
    var valType = VALUE_TYPE_UNKOWN;
    var value = rawValue;
    if (isArrayLike(rawValue)) {
      var arrayDim = guessArrayDim(rawValue);
      valType = arrayDim;
      if (arrayDim === 1 && !isNumber(rawValue[0]) || arrayDim === 2 && !isNumber(rawValue[0][0])) {
        discrete = true;
      }
    } else {
      if (isNumber(rawValue) && !eqNaN(rawValue)) {
        valType = VALUE_TYPE_NUMBER;
      } else if (isString(rawValue)) {
        if (!isNaN(+rawValue)) {
          valType = VALUE_TYPE_NUMBER;
        } else {
          var colorArray = parse(rawValue);
          if (colorArray) {
            value = colorArray;
            valType = VALUE_TYPE_COLOR;
          }
        }
      } else if (isGradientObject(rawValue)) {
        var parsedGradient = extend({}, value);
        parsedGradient.colorStops = map$1(rawValue.colorStops, function (colorStop) {
          return {
            offset: colorStop.offset,
            color: parse(colorStop.color)
          };
        });
        if (isLinearGradient(rawValue)) {
          valType = VALUE_TYPE_LINEAR_GRADIENT;
        } else if (isRadialGradient(rawValue)) {
          valType = VALUE_TYPE_RADIAL_GRADIENT;
        }
        value = parsedGradient;
      }
    }
    if (len === 0) {
      this.valType = valType;
    } else if (valType !== this.valType || valType === VALUE_TYPE_UNKOWN) {
      discrete = true;
    }
    this.discrete = this.discrete || discrete;
    var kf = {
      time: time,
      value: value,
      rawValue: rawValue,
      percent: 0
    };
    if (easing) {
      kf.easing = easing;
      kf.easingFunc = isFunction(easing) ? easing : easingFuncs$1[easing] || createCubicEasingFunc(easing);
    }
    keyframes.push(kf);
    return kf;
  };
  Track.prototype.prepare = function (maxTime, additiveTrack) {
    var kfs = this.keyframes;
    if (this._needsSort) {
      kfs.sort(function (a, b) {
        return a.time - b.time;
      });
    }
    var valType = this.valType;
    var kfsLen = kfs.length;
    var lastKf = kfs[kfsLen - 1];
    var isDiscrete = this.discrete;
    var isArr = isArrayValueType(valType);
    var isGradient = isGradientValueType(valType);
    for (var i = 0; i < kfsLen; i++) {
      var kf = kfs[i];
      var value = kf.value;
      var lastValue = lastKf.value;
      kf.percent = kf.time / maxTime;
      if (!isDiscrete) {
        if (isArr && i !== kfsLen - 1) {
          fillArray(value, lastValue, valType);
        } else if (isGradient) {
          fillColorStops(value.colorStops, lastValue.colorStops);
        }
      }
    }
    if (!isDiscrete && valType !== VALUE_TYPE_RADIAL_GRADIENT && additiveTrack && this.needsAnimate() && additiveTrack.needsAnimate() && valType === additiveTrack.valType && !additiveTrack._finished) {
      this._additiveTrack = additiveTrack;
      var startValue = kfs[0].value;
      for (var i = 0; i < kfsLen; i++) {
        if (valType === VALUE_TYPE_NUMBER) {
          kfs[i].additiveValue = kfs[i].value - startValue;
        } else if (valType === VALUE_TYPE_COLOR) {
          kfs[i].additiveValue = add1DArray([], kfs[i].value, startValue, -1);
        } else if (isArrayValueType(valType)) {
          kfs[i].additiveValue = valType === VALUE_TYPE_1D_ARRAY ? add1DArray([], kfs[i].value, startValue, -1) : add2DArray([], kfs[i].value, startValue, -1);
        }
      }
    }
  };
  Track.prototype.step = function (target, percent) {
    if (this._finished) {
      return;
    }
    if (this._additiveTrack && this._additiveTrack._finished) {
      this._additiveTrack = null;
    }
    var isAdditive = this._additiveTrack != null;
    var valueKey = isAdditive ? 'additiveValue' : 'value';
    var valType = this.valType;
    var keyframes = this.keyframes;
    var kfsNum = keyframes.length;
    var propName = this.propName;
    var isValueColor = valType === VALUE_TYPE_COLOR;
    var frameIdx;
    var lastFrame = this._lastFr;
    var mathMin = Math.min;
    var frame;
    var nextFrame;
    if (kfsNum === 1) {
      frame = nextFrame = keyframes[0];
    } else {
      if (percent < 0) {
        frameIdx = 0;
      } else if (percent < this._lastFrP) {
        var start = mathMin(lastFrame + 1, kfsNum - 1);
        for (frameIdx = start; frameIdx >= 0; frameIdx--) {
          if (keyframes[frameIdx].percent <= percent) {
            break;
          }
        }
        frameIdx = mathMin(frameIdx, kfsNum - 2);
      } else {
        for (frameIdx = lastFrame; frameIdx < kfsNum; frameIdx++) {
          if (keyframes[frameIdx].percent > percent) {
            break;
          }
        }
        frameIdx = mathMin(frameIdx - 1, kfsNum - 2);
      }
      nextFrame = keyframes[frameIdx + 1];
      frame = keyframes[frameIdx];
    }
    if (!(frame && nextFrame)) {
      return;
    }
    this._lastFr = frameIdx;
    this._lastFrP = percent;
    var interval = nextFrame.percent - frame.percent;
    var w = interval === 0 ? 1 : mathMin((percent - frame.percent) / interval, 1);
    if (nextFrame.easingFunc) {
      w = nextFrame.easingFunc(w);
    }
    var targetArr = isAdditive ? this._additiveValue : isValueColor ? tmpRgba : target[propName];
    if ((isArrayValueType(valType) || isValueColor) && !targetArr) {
      targetArr = this._additiveValue = [];
    }
    if (this.discrete) {
      target[propName] = w < 1 ? frame.rawValue : nextFrame.rawValue;
    } else if (isArrayValueType(valType)) {
      valType === VALUE_TYPE_1D_ARRAY ? interpolate1DArray(targetArr, frame[valueKey], nextFrame[valueKey], w) : interpolate2DArray(targetArr, frame[valueKey], nextFrame[valueKey], w);
    } else if (isGradientValueType(valType)) {
      var val = frame[valueKey];
      var nextVal_1 = nextFrame[valueKey];
      var isLinearGradient_1 = valType === VALUE_TYPE_LINEAR_GRADIENT;
      target[propName] = {
        type: isLinearGradient_1 ? 'linear' : 'radial',
        x: interpolateNumber$1(val.x, nextVal_1.x, w),
        y: interpolateNumber$1(val.y, nextVal_1.y, w),
        colorStops: map$1(val.colorStops, function (colorStop, idx) {
          var nextColorStop = nextVal_1.colorStops[idx];
          return {
            offset: interpolateNumber$1(colorStop.offset, nextColorStop.offset, w),
            color: rgba2String(interpolate1DArray([], colorStop.color, nextColorStop.color, w))
          };
        }),
        global: nextVal_1.global
      };
      if (isLinearGradient_1) {
        target[propName].x2 = interpolateNumber$1(val.x2, nextVal_1.x2, w);
        target[propName].y2 = interpolateNumber$1(val.y2, nextVal_1.y2, w);
      } else {
        target[propName].r = interpolateNumber$1(val.r, nextVal_1.r, w);
      }
    } else if (isValueColor) {
      interpolate1DArray(targetArr, frame[valueKey], nextFrame[valueKey], w);
      if (!isAdditive) {
        target[propName] = rgba2String(targetArr);
      }
    } else {
      var value = interpolateNumber$1(frame[valueKey], nextFrame[valueKey], w);
      if (isAdditive) {
        this._additiveValue = value;
      } else {
        target[propName] = value;
      }
    }
    if (isAdditive) {
      this._addToTarget(target);
    }
  };
  Track.prototype._addToTarget = function (target) {
    var valType = this.valType;
    var propName = this.propName;
    var additiveValue = this._additiveValue;
    if (valType === VALUE_TYPE_NUMBER) {
      target[propName] = target[propName] + additiveValue;
    } else if (valType === VALUE_TYPE_COLOR) {
      parse(target[propName], tmpRgba);
      add1DArray(tmpRgba, tmpRgba, additiveValue, 1);
      target[propName] = rgba2String(tmpRgba);
    } else if (valType === VALUE_TYPE_1D_ARRAY) {
      add1DArray(target[propName], target[propName], additiveValue, 1);
    } else if (valType === VALUE_TYPE_2D_ARRAY) {
      add2DArray(target[propName], target[propName], additiveValue, 1);
    }
  };
  return Track;
}();
var Animator = function () {
  function Animator(target, loop, allowDiscreteAnimation, additiveTo) {
    this._tracks = {};
    this._trackKeys = [];
    this._maxTime = 0;
    this._started = 0;
    this._clip = null;
    this._target = target;
    this._loop = loop;
    if (loop && additiveTo) {
      logError('Can\' use additive animation on looped animation.');
      return;
    }
    this._additiveAnimators = additiveTo;
    this._allowDiscrete = allowDiscreteAnimation;
  }
  Animator.prototype.getMaxTime = function () {
    return this._maxTime;
  };
  Animator.prototype.getDelay = function () {
    return this._delay;
  };
  Animator.prototype.getLoop = function () {
    return this._loop;
  };
  Animator.prototype.getTarget = function () {
    return this._target;
  };
  Animator.prototype.changeTarget = function (target) {
    this._target = target;
  };
  Animator.prototype.when = function (time, props, easing) {
    return this.whenWithKeys(time, props, keys(props), easing);
  };
  Animator.prototype.whenWithKeys = function (time, props, propNames, easing) {
    var tracks = this._tracks;
    for (var i = 0; i < propNames.length; i++) {
      var propName = propNames[i];
      var track = tracks[propName];
      if (!track) {
        track = tracks[propName] = new Track(propName);
        var initialValue = void 0;
        var additiveTrack = this._getAdditiveTrack(propName);
        if (additiveTrack) {
          var addtiveTrackKfs = additiveTrack.keyframes;
          var lastFinalKf = addtiveTrackKfs[addtiveTrackKfs.length - 1];
          initialValue = lastFinalKf && lastFinalKf.value;
          if (additiveTrack.valType === VALUE_TYPE_COLOR && initialValue) {
            initialValue = rgba2String(initialValue);
          }
        } else {
          initialValue = this._target[propName];
        }
        if (initialValue == null) {
          continue;
        }
        if (time > 0) {
          track.addKeyframe(0, cloneValue(initialValue), easing);
        }
        this._trackKeys.push(propName);
      }
      track.addKeyframe(time, cloneValue(props[propName]), easing);
    }
    this._maxTime = Math.max(this._maxTime, time);
    return this;
  };
  Animator.prototype.pause = function () {
    this._clip.pause();
    this._paused = true;
  };
  Animator.prototype.resume = function () {
    this._clip.resume();
    this._paused = false;
  };
  Animator.prototype.isPaused = function () {
    return !!this._paused;
  };
  Animator.prototype.duration = function (duration) {
    this._maxTime = duration;
    this._force = true;
    return this;
  };
  Animator.prototype._doneCallback = function () {
    this._setTracksFinished();
    this._clip = null;
    var doneList = this._doneCbs;
    if (doneList) {
      var len = doneList.length;
      for (var i = 0; i < len; i++) {
        doneList[i].call(this);
      }
    }
  };
  Animator.prototype._abortedCallback = function () {
    this._setTracksFinished();
    var animation = this.animation;
    var abortedList = this._abortedCbs;
    if (animation) {
      animation.removeClip(this._clip);
    }
    this._clip = null;
    if (abortedList) {
      for (var i = 0; i < abortedList.length; i++) {
        abortedList[i].call(this);
      }
    }
  };
  Animator.prototype._setTracksFinished = function () {
    var tracks = this._tracks;
    var tracksKeys = this._trackKeys;
    for (var i = 0; i < tracksKeys.length; i++) {
      tracks[tracksKeys[i]].setFinished();
    }
  };
  Animator.prototype._getAdditiveTrack = function (trackName) {
    var additiveTrack;
    var additiveAnimators = this._additiveAnimators;
    if (additiveAnimators) {
      for (var i = 0; i < additiveAnimators.length; i++) {
        var track = additiveAnimators[i].getTrack(trackName);
        if (track) {
          additiveTrack = track;
        }
      }
    }
    return additiveTrack;
  };
  Animator.prototype.start = function (easing) {
    if (this._started > 0) {
      return;
    }
    this._started = 1;
    var self = this;
    var tracks = [];
    var maxTime = this._maxTime || 0;
    for (var i = 0; i < this._trackKeys.length; i++) {
      var propName = this._trackKeys[i];
      var track = this._tracks[propName];
      var additiveTrack = this._getAdditiveTrack(propName);
      var kfs = track.keyframes;
      var kfsNum = kfs.length;
      track.prepare(maxTime, additiveTrack);
      if (track.needsAnimate()) {
        if (!this._allowDiscrete && track.discrete) {
          var lastKf = kfs[kfsNum - 1];
          if (lastKf) {
            self._target[track.propName] = lastKf.rawValue;
          }
          track.setFinished();
        } else {
          tracks.push(track);
        }
      }
    }
    if (tracks.length || this._force) {
      var clip = new Clip$1({
        life: maxTime,
        loop: this._loop,
        delay: this._delay || 0,
        onframe: function (percent) {
          self._started = 2;
          var additiveAnimators = self._additiveAnimators;
          if (additiveAnimators) {
            var stillHasAdditiveAnimator = false;
            for (var i = 0; i < additiveAnimators.length; i++) {
              if (additiveAnimators[i]._clip) {
                stillHasAdditiveAnimator = true;
                break;
              }
            }
            if (!stillHasAdditiveAnimator) {
              self._additiveAnimators = null;
            }
          }
          for (var i = 0; i < tracks.length; i++) {
            tracks[i].step(self._target, percent);
          }
          var onframeList = self._onframeCbs;
          if (onframeList) {
            for (var i = 0; i < onframeList.length; i++) {
              onframeList[i](self._target, percent);
            }
          }
        },
        ondestroy: function () {
          self._doneCallback();
        }
      });
      this._clip = clip;
      if (this.animation) {
        this.animation.addClip(clip);
      }
      if (easing) {
        clip.setEasing(easing);
      }
    } else {
      this._doneCallback();
    }
    return this;
  };
  Animator.prototype.stop = function (forwardToLast) {
    if (!this._clip) {
      return;
    }
    var clip = this._clip;
    if (forwardToLast) {
      clip.onframe(1);
    }
    this._abortedCallback();
  };
  Animator.prototype.delay = function (time) {
    this._delay = time;
    return this;
  };
  Animator.prototype.during = function (cb) {
    if (cb) {
      if (!this._onframeCbs) {
        this._onframeCbs = [];
      }
      this._onframeCbs.push(cb);
    }
    return this;
  };
  Animator.prototype.done = function (cb) {
    if (cb) {
      if (!this._doneCbs) {
        this._doneCbs = [];
      }
      this._doneCbs.push(cb);
    }
    return this;
  };
  Animator.prototype.aborted = function (cb) {
    if (cb) {
      if (!this._abortedCbs) {
        this._abortedCbs = [];
      }
      this._abortedCbs.push(cb);
    }
    return this;
  };
  Animator.prototype.getClip = function () {
    return this._clip;
  };
  Animator.prototype.getTrack = function (propName) {
    return this._tracks[propName];
  };
  Animator.prototype.getTracks = function () {
    var _this = this;
    return map$1(this._trackKeys, function (key) {
      return _this._tracks[key];
    });
  };
  Animator.prototype.stopTracks = function (propNames, forwardToLast) {
    if (!propNames.length || !this._clip) {
      return true;
    }
    var tracks = this._tracks;
    var tracksKeys = this._trackKeys;
    for (var i = 0; i < propNames.length; i++) {
      var track = tracks[propNames[i]];
      if (track && !track.isFinished()) {
        if (forwardToLast) {
          track.step(this._target, 1);
        } else if (this._started === 1) {
          track.step(this._target, 0);
        }
        track.setFinished();
      }
    }
    var allAborted = true;
    for (var i = 0; i < tracksKeys.length; i++) {
      if (!tracks[tracksKeys[i]].isFinished()) {
        allAborted = false;
        break;
      }
    }
    if (allAborted) {
      this._abortedCallback();
    }
    return allAborted;
  };
  Animator.prototype.saveTo = function (target, trackKeys, firstOrLast) {
    if (!target) {
      return;
    }
    trackKeys = trackKeys || this._trackKeys;
    for (var i = 0; i < trackKeys.length; i++) {
      var propName = trackKeys[i];
      var track = this._tracks[propName];
      if (!track || track.isFinished()) {
        continue;
      }
      var kfs = track.keyframes;
      var kf = kfs[firstOrLast ? 0 : kfs.length - 1];
      if (kf) {
        target[propName] = cloneValue(kf.rawValue);
      }
    }
  };
  Animator.prototype.__changeFinalValue = function (finalProps, trackKeys) {
    trackKeys = trackKeys || keys(finalProps);
    for (var i = 0; i < trackKeys.length; i++) {
      var propName = trackKeys[i];
      var track = this._tracks[propName];
      if (!track) {
        continue;
      }
      var kfs = track.keyframes;
      if (kfs.length > 1) {
        var lastKf = kfs.pop();
        track.addKeyframe(lastKf.time, finalProps[propName]);
        track.prepare(this._maxTime, track.getAdditiveTrack());
      }
    }
  };
  return Animator;
}();

function getTime() {
  return new Date().getTime();
}
var Animation = function (_super) {
  __extends(Animation, _super);
  function Animation(opts) {
    var _this = _super.call(this) || this;
    _this._running = false;
    _this._time = 0;
    _this._pausedTime = 0;
    _this._pauseStart = 0;
    _this._paused = false;
    opts = opts || {};
    _this.stage = opts.stage || {};
    return _this;
  }
  Animation.prototype.addClip = function (clip) {
    if (clip.animation) {
      this.removeClip(clip);
    }
    if (!this._head) {
      this._head = this._tail = clip;
    } else {
      this._tail.next = clip;
      clip.prev = this._tail;
      clip.next = null;
      this._tail = clip;
    }
    clip.animation = this;
  };
  Animation.prototype.addAnimator = function (animator) {
    animator.animation = this;
    var clip = animator.getClip();
    if (clip) {
      this.addClip(clip);
    }
  };
  Animation.prototype.removeClip = function (clip) {
    if (!clip.animation) {
      return;
    }
    var prev = clip.prev;
    var next = clip.next;
    if (prev) {
      prev.next = next;
    } else {
      this._head = next;
    }
    if (next) {
      next.prev = prev;
    } else {
      this._tail = prev;
    }
    clip.next = clip.prev = clip.animation = null;
  };
  Animation.prototype.removeAnimator = function (animator) {
    var clip = animator.getClip();
    if (clip) {
      this.removeClip(clip);
    }
    animator.animation = null;
  };
  Animation.prototype.update = function (notTriggerFrameAndStageUpdate) {
    var time = getTime() - this._pausedTime;
    var delta = time - this._time;
    var clip = this._head;
    while (clip) {
      var nextClip = clip.next;
      var finished = clip.step(time, delta);
      if (finished) {
        clip.ondestroy();
        this.removeClip(clip);
        clip = nextClip;
      } else {
        clip = nextClip;
      }
    }
    this._time = time;
    if (!notTriggerFrameAndStageUpdate) {
      this.trigger('frame', delta);
      this.stage.update && this.stage.update();
    }
  };
  Animation.prototype._startLoop = function () {
    var self = this;
    this._running = true;
    function step() {
      if (self._running) {
        requestAnimationFrame$2(step);
        !self._paused && self.update();
      }
    }
    requestAnimationFrame$2(step);
  };
  Animation.prototype.start = function () {
    if (this._running) {
      return;
    }
    this._time = getTime();
    this._pausedTime = 0;
    this._startLoop();
  };
  Animation.prototype.stop = function () {
    this._running = false;
  };
  Animation.prototype.pause = function () {
    if (!this._paused) {
      this._pauseStart = getTime();
      this._paused = true;
    }
  };
  Animation.prototype.resume = function () {
    if (this._paused) {
      this._pausedTime += getTime() - this._pauseStart;
      this._paused = false;
    }
  };
  Animation.prototype.clear = function () {
    var clip = this._head;
    while (clip) {
      var nextClip = clip.next;
      clip.prev = clip.next = clip.animation = null;
      clip = nextClip;
    }
    this._head = this._tail = null;
  };
  Animation.prototype.isFinished = function () {
    return this._head == null;
  };
  Animation.prototype.animate = function (target, options) {
    options = options || {};
    this.start();
    var animator = new Animator(target, options.loop);
    this.addAnimator(animator);
    return animator;
  };
  return Animation;
}(Eventful$1);
var Animation$1 = Animation;

var TOUCH_CLICK_DELAY = 300;
var globalEventSupported = env$1.domSupported;
var localNativeListenerNames = function () {
  var mouseHandlerNames = ['click', 'dblclick', 'mousewheel', 'wheel', 'mouseout', 'mouseup', 'mousedown', 'mousemove', 'contextmenu'];
  var touchHandlerNames = ['touchstart', 'touchend', 'touchmove'];
  var pointerEventNameMap = {
    pointerdown: 1,
    pointerup: 1,
    pointermove: 1,
    pointerout: 1
  };
  var pointerHandlerNames = map$1(mouseHandlerNames, function (name) {
    var nm = name.replace('mouse', 'pointer');
    return pointerEventNameMap.hasOwnProperty(nm) ? nm : name;
  });
  return {
    mouse: mouseHandlerNames,
    touch: touchHandlerNames,
    pointer: pointerHandlerNames
  };
}();
var globalNativeListenerNames = {
  mouse: ['mousemove', 'mouseup'],
  pointer: ['pointermove', 'pointerup']
};
var wheelEventSupported = false;
function isPointerFromTouch(event) {
  var pointerType = event.pointerType;
  return pointerType === 'pen' || pointerType === 'touch';
}
function setTouchTimer(scope) {
  scope.touching = true;
  if (scope.touchTimer != null) {
    clearTimeout(scope.touchTimer);
    scope.touchTimer = null;
  }
  scope.touchTimer = setTimeout(function () {
    scope.touching = false;
    scope.touchTimer = null;
  }, 700);
}
function markTouch(event) {
  event && (event.zrByTouch = true);
}
function normalizeGlobalEvent(instance, event) {
  return normalizeEvent(instance.dom, new FakeGlobalEvent(instance, event), true);
}
function isLocalEl(instance, el) {
  var elTmp = el;
  var isLocal = false;
  while (elTmp && elTmp.nodeType !== 9 && !(isLocal = elTmp.domBelongToZr || elTmp !== el && elTmp === instance.painterRoot)) {
    elTmp = elTmp.parentNode;
  }
  return isLocal;
}
var FakeGlobalEvent = function () {
  function FakeGlobalEvent(instance, event) {
    this.stopPropagation = noop;
    this.stopImmediatePropagation = noop;
    this.preventDefault = noop;
    this.type = event.type;
    this.target = this.currentTarget = instance.dom;
    this.pointerType = event.pointerType;
    this.clientX = event.clientX;
    this.clientY = event.clientY;
  }
  return FakeGlobalEvent;
}();
var localDOMHandlers = {
  mousedown: function (event) {
    event = normalizeEvent(this.dom, event);
    this.__mayPointerCapture = [event.zrX, event.zrY];
    this.trigger('mousedown', event);
  },
  mousemove: function (event) {
    event = normalizeEvent(this.dom, event);
    var downPoint = this.__mayPointerCapture;
    if (downPoint && (event.zrX !== downPoint[0] || event.zrY !== downPoint[1])) {
      this.__togglePointerCapture(true);
    }
    this.trigger('mousemove', event);
  },
  mouseup: function (event) {
    event = normalizeEvent(this.dom, event);
    this.__togglePointerCapture(false);
    this.trigger('mouseup', event);
  },
  mouseout: function (event) {
    event = normalizeEvent(this.dom, event);
    var element = event.toElement || event.relatedTarget;
    if (!isLocalEl(this, element)) {
      if (this.__pointerCapturing) {
        event.zrEventControl = 'no_globalout';
      }
      this.trigger('mouseout', event);
    }
  },
  wheel: function (event) {
    wheelEventSupported = true;
    event = normalizeEvent(this.dom, event);
    this.trigger('mousewheel', event);
  },
  mousewheel: function (event) {
    if (wheelEventSupported) {
      return;
    }
    event = normalizeEvent(this.dom, event);
    this.trigger('mousewheel', event);
  },
  touchstart: function (event) {
    event = normalizeEvent(this.dom, event);
    markTouch(event);
    this.__lastTouchMoment = new Date();
    this.handler.processGesture(event, 'start');
    localDOMHandlers.mousemove.call(this, event);
    localDOMHandlers.mousedown.call(this, event);
  },
  touchmove: function (event) {
    event = normalizeEvent(this.dom, event);
    markTouch(event);
    this.handler.processGesture(event, 'change');
    localDOMHandlers.mousemove.call(this, event);
  },
  touchend: function (event) {
    event = normalizeEvent(this.dom, event);
    markTouch(event);
    this.handler.processGesture(event, 'end');
    localDOMHandlers.mouseup.call(this, event);
    if (+new Date() - +this.__lastTouchMoment < TOUCH_CLICK_DELAY) {
      localDOMHandlers.click.call(this, event);
    }
  },
  pointerdown: function (event) {
    localDOMHandlers.mousedown.call(this, event);
  },
  pointermove: function (event) {
    if (!isPointerFromTouch(event)) {
      localDOMHandlers.mousemove.call(this, event);
    }
  },
  pointerup: function (event) {
    localDOMHandlers.mouseup.call(this, event);
  },
  pointerout: function (event) {
    if (!isPointerFromTouch(event)) {
      localDOMHandlers.mouseout.call(this, event);
    }
  }
};
each$f(['click', 'dblclick', 'contextmenu'], function (name) {
  localDOMHandlers[name] = function (event) {
    event = normalizeEvent(this.dom, event);
    this.trigger(name, event);
  };
});
var globalDOMHandlers = {
  pointermove: function (event) {
    if (!isPointerFromTouch(event)) {
      globalDOMHandlers.mousemove.call(this, event);
    }
  },
  pointerup: function (event) {
    globalDOMHandlers.mouseup.call(this, event);
  },
  mousemove: function (event) {
    this.trigger('mousemove', event);
  },
  mouseup: function (event) {
    var pointerCaptureReleasing = this.__pointerCapturing;
    this.__togglePointerCapture(false);
    this.trigger('mouseup', event);
    if (pointerCaptureReleasing) {
      event.zrEventControl = 'only_globalout';
      this.trigger('mouseout', event);
    }
  }
};
function mountLocalDOMEventListeners(instance, scope) {
  var domHandlers = scope.domHandlers;
  if (env$1.pointerEventsSupported) {
    each$f(localNativeListenerNames.pointer, function (nativeEventName) {
      mountSingleDOMEventListener(scope, nativeEventName, function (event) {
        domHandlers[nativeEventName].call(instance, event);
      });
    });
  } else {
    if (env$1.touchEventsSupported) {
      each$f(localNativeListenerNames.touch, function (nativeEventName) {
        mountSingleDOMEventListener(scope, nativeEventName, function (event) {
          domHandlers[nativeEventName].call(instance, event);
          setTouchTimer(scope);
        });
      });
    }
    each$f(localNativeListenerNames.mouse, function (nativeEventName) {
      mountSingleDOMEventListener(scope, nativeEventName, function (event) {
        event = getNativeEvent(event);
        if (!scope.touching) {
          domHandlers[nativeEventName].call(instance, event);
        }
      });
    });
  }
}
function mountGlobalDOMEventListeners(instance, scope) {
  if (env$1.pointerEventsSupported) {
    each$f(globalNativeListenerNames.pointer, mount);
  } else if (!env$1.touchEventsSupported) {
    each$f(globalNativeListenerNames.mouse, mount);
  }
  function mount(nativeEventName) {
    function nativeEventListener(event) {
      event = getNativeEvent(event);
      if (!isLocalEl(instance, event.target)) {
        event = normalizeGlobalEvent(instance, event);
        scope.domHandlers[nativeEventName].call(instance, event);
      }
    }
    mountSingleDOMEventListener(scope, nativeEventName, nativeEventListener, {
      capture: true
    });
  }
}
function mountSingleDOMEventListener(scope, nativeEventName, listener, opt) {
  scope.mounted[nativeEventName] = listener;
  scope.listenerOpts[nativeEventName] = opt;
  addEventListener(scope.domTarget, nativeEventName, listener, opt);
}
function unmountDOMEventListeners(scope) {
  var mounted = scope.mounted;
  for (var nativeEventName in mounted) {
    if (mounted.hasOwnProperty(nativeEventName)) {
      removeEventListener(scope.domTarget, nativeEventName, mounted[nativeEventName], scope.listenerOpts[nativeEventName]);
    }
  }
  scope.mounted = {};
}
var DOMHandlerScope = function () {
  function DOMHandlerScope(domTarget, domHandlers) {
    this.mounted = {};
    this.listenerOpts = {};
    this.touching = false;
    this.domTarget = domTarget;
    this.domHandlers = domHandlers;
  }
  return DOMHandlerScope;
}();
var HandlerDomProxy = function (_super) {
  __extends(HandlerDomProxy, _super);
  function HandlerDomProxy(dom, painterRoot) {
    var _this = _super.call(this) || this;
    _this.__pointerCapturing = false;
    _this.dom = dom;
    _this.painterRoot = painterRoot;
    _this._localHandlerScope = new DOMHandlerScope(dom, localDOMHandlers);
    if (globalEventSupported) {
      _this._globalHandlerScope = new DOMHandlerScope(document, globalDOMHandlers);
    }
    mountLocalDOMEventListeners(_this, _this._localHandlerScope);
    return _this;
  }
  HandlerDomProxy.prototype.dispose = function () {
    unmountDOMEventListeners(this._localHandlerScope);
    if (globalEventSupported) {
      unmountDOMEventListeners(this._globalHandlerScope);
    }
  };
  HandlerDomProxy.prototype.setCursor = function (cursorStyle) {
    this.dom.style && (this.dom.style.cursor = cursorStyle || 'default');
  };
  HandlerDomProxy.prototype.__togglePointerCapture = function (isPointerCapturing) {
    this.__mayPointerCapture = null;
    if (globalEventSupported && +this.__pointerCapturing ^ +isPointerCapturing) {
      this.__pointerCapturing = isPointerCapturing;
      var globalHandlerScope = this._globalHandlerScope;
      isPointerCapturing ? mountGlobalDOMEventListeners(this, globalHandlerScope) : unmountDOMEventListeners(globalHandlerScope);
    }
  };
  return HandlerDomProxy;
}(Eventful$1);
var HandlerProxy = HandlerDomProxy;

var dpr = 1;
if (env$1.hasGlobalWindow) {
  dpr = Math.max(window.devicePixelRatio || window.screen && window.screen.deviceXDPI / window.screen.logicalXDPI || 1, 1);
}
var devicePixelRatio = dpr;
var DARK_MODE_THRESHOLD = 0.4;
var DARK_LABEL_COLOR = '#333';
var LIGHT_LABEL_COLOR = '#ccc';
var LIGHTER_LABEL_COLOR = '#eee';

var mIdentity = identity;
var EPSILON$2 = 5e-5;
function isNotAroundZero(val) {
  return val > EPSILON$2 || val < -EPSILON$2;
}
var scaleTmp = [];
var tmpTransform = [];
var originTransform = create$1();
var abs$1 = Math.abs;
var Transformable = function () {
  function Transformable() {}
  Transformable.prototype.getLocalTransform = function (m) {
    return Transformable.getLocalTransform(this, m);
  };
  Transformable.prototype.setPosition = function (arr) {
    this.x = arr[0];
    this.y = arr[1];
  };
  Transformable.prototype.setScale = function (arr) {
    this.scaleX = arr[0];
    this.scaleY = arr[1];
  };
  Transformable.prototype.setSkew = function (arr) {
    this.skewX = arr[0];
    this.skewY = arr[1];
  };
  Transformable.prototype.setOrigin = function (arr) {
    this.originX = arr[0];
    this.originY = arr[1];
  };
  Transformable.prototype.needLocalTransform = function () {
    return isNotAroundZero(this.rotation) || isNotAroundZero(this.x) || isNotAroundZero(this.y) || isNotAroundZero(this.scaleX - 1) || isNotAroundZero(this.scaleY - 1) || isNotAroundZero(this.skewX) || isNotAroundZero(this.skewY);
  };
  Transformable.prototype.updateTransform = function () {
    var parentTransform = this.parent && this.parent.transform;
    var needLocalTransform = this.needLocalTransform();
    var m = this.transform;
    if (!(needLocalTransform || parentTransform)) {
      if (m) {
        mIdentity(m);
        this.invTransform = null;
      }
      return;
    }
    m = m || create$1();
    if (needLocalTransform) {
      this.getLocalTransform(m);
    } else {
      mIdentity(m);
    }
    if (parentTransform) {
      if (needLocalTransform) {
        mul$1(m, parentTransform, m);
      } else {
        copy(m, parentTransform);
      }
    }
    this.transform = m;
    this._resolveGlobalScaleRatio(m);
  };
  Transformable.prototype._resolveGlobalScaleRatio = function (m) {
    var globalScaleRatio = this.globalScaleRatio;
    if (globalScaleRatio != null && globalScaleRatio !== 1) {
      this.getGlobalScale(scaleTmp);
      var relX = scaleTmp[0] < 0 ? -1 : 1;
      var relY = scaleTmp[1] < 0 ? -1 : 1;
      var sx = ((scaleTmp[0] - relX) * globalScaleRatio + relX) / scaleTmp[0] || 0;
      var sy = ((scaleTmp[1] - relY) * globalScaleRatio + relY) / scaleTmp[1] || 0;
      m[0] *= sx;
      m[1] *= sx;
      m[2] *= sy;
      m[3] *= sy;
    }
    this.invTransform = this.invTransform || create$1();
    invert(this.invTransform, m);
  };
  Transformable.prototype.getComputedTransform = function () {
    var transformNode = this;
    var ancestors = [];
    while (transformNode) {
      ancestors.push(transformNode);
      transformNode = transformNode.parent;
    }
    while (transformNode = ancestors.pop()) {
      transformNode.updateTransform();
    }
    return this.transform;
  };
  Transformable.prototype.setLocalTransform = function (m) {
    if (!m) {
      return;
    }
    var sx = m[0] * m[0] + m[1] * m[1];
    var sy = m[2] * m[2] + m[3] * m[3];
    var rotation = Math.atan2(m[1], m[0]);
    var shearX = Math.PI / 2 + rotation - Math.atan2(m[3], m[2]);
    sy = Math.sqrt(sy) * Math.cos(shearX);
    sx = Math.sqrt(sx);
    this.skewX = shearX;
    this.skewY = 0;
    this.rotation = -rotation;
    this.x = +m[4];
    this.y = +m[5];
    this.scaleX = sx;
    this.scaleY = sy;
    this.originX = 0;
    this.originY = 0;
  };
  Transformable.prototype.decomposeTransform = function () {
    if (!this.transform) {
      return;
    }
    var parent = this.parent;
    var m = this.transform;
    if (parent && parent.transform) {
      parent.invTransform = parent.invTransform || create$1();
      mul$1(tmpTransform, parent.invTransform, m);
      m = tmpTransform;
    }
    var ox = this.originX;
    var oy = this.originY;
    if (ox || oy) {
      originTransform[4] = ox;
      originTransform[5] = oy;
      mul$1(tmpTransform, m, originTransform);
      tmpTransform[4] -= ox;
      tmpTransform[5] -= oy;
      m = tmpTransform;
    }
    this.setLocalTransform(m);
  };
  Transformable.prototype.getGlobalScale = function (out) {
    var m = this.transform;
    out = out || [];
    if (!m) {
      out[0] = 1;
      out[1] = 1;
      return out;
    }
    out[0] = Math.sqrt(m[0] * m[0] + m[1] * m[1]);
    out[1] = Math.sqrt(m[2] * m[2] + m[3] * m[3]);
    if (m[0] < 0) {
      out[0] = -out[0];
    }
    if (m[3] < 0) {
      out[1] = -out[1];
    }
    return out;
  };
  Transformable.prototype.transformCoordToLocal = function (x, y) {
    var v2 = [x, y];
    var invTransform = this.invTransform;
    if (invTransform) {
      applyTransform$1(v2, v2, invTransform);
    }
    return v2;
  };
  Transformable.prototype.transformCoordToGlobal = function (x, y) {
    var v2 = [x, y];
    var transform = this.transform;
    if (transform) {
      applyTransform$1(v2, v2, transform);
    }
    return v2;
  };
  Transformable.prototype.getLineScale = function () {
    var m = this.transform;
    return m && abs$1(m[0] - 1) > 1e-10 && abs$1(m[3] - 1) > 1e-10 ? Math.sqrt(abs$1(m[0] * m[3] - m[2] * m[1])) : 1;
  };
  Transformable.prototype.copyTransform = function (source) {
    copyTransform(this, source);
  };
  Transformable.getLocalTransform = function (target, m) {
    m = m || [];
    var ox = target.originX || 0;
    var oy = target.originY || 0;
    var sx = target.scaleX;
    var sy = target.scaleY;
    var ax = target.anchorX;
    var ay = target.anchorY;
    var rotation = target.rotation || 0;
    var x = target.x;
    var y = target.y;
    var skewX = target.skewX ? Math.tan(target.skewX) : 0;
    var skewY = target.skewY ? Math.tan(-target.skewY) : 0;
    if (ox || oy || ax || ay) {
      var dx = ox + ax;
      var dy = oy + ay;
      m[4] = -dx * sx - skewX * dy * sy;
      m[5] = -dy * sy - skewY * dx * sx;
    } else {
      m[4] = m[5] = 0;
    }
    m[0] = sx;
    m[3] = sy;
    m[1] = skewY * sx;
    m[2] = skewX * sy;
    rotation && rotate(m, m, rotation);
    m[4] += ox + x;
    m[5] += oy + y;
    return m;
  };
  Transformable.initDefaultProps = function () {
    var proto = Transformable.prototype;
    proto.scaleX = proto.scaleY = proto.globalScaleRatio = 1;
    proto.x = proto.y = proto.originX = proto.originY = proto.skewX = proto.skewY = proto.rotation = proto.anchorX = proto.anchorY = 0;
  }();
  return Transformable;
}();
var TRANSFORMABLE_PROPS = ['x', 'y', 'originX', 'originY', 'anchorX', 'anchorY', 'rotation', 'scaleX', 'scaleY', 'skewX', 'skewY'];
function copyTransform(target, source) {
  for (var i = 0; i < TRANSFORMABLE_PROPS.length; i++) {
    var propName = TRANSFORMABLE_PROPS[i];
    target[propName] = source[propName];
  }
}
var Transformable$1 = Transformable;

var textWidthCache = {};
function getWidth(text, font) {
  font = font || DEFAULT_FONT;
  var cacheOfFont = textWidthCache[font];
  if (!cacheOfFont) {
    cacheOfFont = textWidthCache[font] = new LRU$1(500);
  }
  var width = cacheOfFont.get(text);
  if (width == null) {
    width = platformApi.measureText(text, font).width;
    cacheOfFont.put(text, width);
  }
  return width;
}
function innerGetBoundingRect(text, font, textAlign, textBaseline) {
  var width = getWidth(text, font);
  var height = getLineHeight(font);
  var x = adjustTextX(0, width, textAlign);
  var y = adjustTextY(0, height, textBaseline);
  var rect = new BoundingRect$1(x, y, width, height);
  return rect;
}
function getBoundingRect(text, font, textAlign, textBaseline) {
  var textLines = ((text || '') + '').split('\n');
  var len = textLines.length;
  if (len === 1) {
    return innerGetBoundingRect(textLines[0], font, textAlign, textBaseline);
  } else {
    var uniondRect = new BoundingRect$1(0, 0, 0, 0);
    for (var i = 0; i < textLines.length; i++) {
      var rect = innerGetBoundingRect(textLines[i], font, textAlign, textBaseline);
      i === 0 ? uniondRect.copy(rect) : uniondRect.union(rect);
    }
    return uniondRect;
  }
}
function adjustTextX(x, width, textAlign) {
  if (textAlign === 'right') {
    x -= width;
  } else if (textAlign === 'center') {
    x -= width / 2;
  }
  return x;
}
function adjustTextY(y, height, verticalAlign) {
  if (verticalAlign === 'middle') {
    y -= height / 2;
  } else if (verticalAlign === 'bottom') {
    y -= height;
  }
  return y;
}
function getLineHeight(font) {
  return getWidth('国', font);
}
function parsePercent$1(value, maxValue) {
  if (typeof value === 'string') {
    if (value.lastIndexOf('%') >= 0) {
      return parseFloat(value) / 100 * maxValue;
    }
    return parseFloat(value);
  }
  return value;
}
function calculateTextPosition(out, opts, rect) {
  var textPosition = opts.position || 'inside';
  var distance = opts.distance != null ? opts.distance : 5;
  var height = rect.height;
  var width = rect.width;
  var halfHeight = height / 2;
  var x = rect.x;
  var y = rect.y;
  var textAlign = 'left';
  var textVerticalAlign = 'top';
  if (textPosition instanceof Array) {
    x += parsePercent$1(textPosition[0], rect.width);
    y += parsePercent$1(textPosition[1], rect.height);
    textAlign = null;
    textVerticalAlign = null;
  } else {
    switch (textPosition) {
      case 'left':
        x -= distance;
        y += halfHeight;
        textAlign = 'right';
        textVerticalAlign = 'middle';
        break;
      case 'right':
        x += distance + width;
        y += halfHeight;
        textVerticalAlign = 'middle';
        break;
      case 'top':
        x += width / 2;
        y -= distance;
        textAlign = 'center';
        textVerticalAlign = 'bottom';
        break;
      case 'bottom':
        x += width / 2;
        y += height + distance;
        textAlign = 'center';
        break;
      case 'inside':
        x += width / 2;
        y += halfHeight;
        textAlign = 'center';
        textVerticalAlign = 'middle';
        break;
      case 'insideLeft':
        x += distance;
        y += halfHeight;
        textVerticalAlign = 'middle';
        break;
      case 'insideRight':
        x += width - distance;
        y += halfHeight;
        textAlign = 'right';
        textVerticalAlign = 'middle';
        break;
      case 'insideTop':
        x += width / 2;
        y += distance;
        textAlign = 'center';
        break;
      case 'insideBottom':
        x += width / 2;
        y += height - distance;
        textAlign = 'center';
        textVerticalAlign = 'bottom';
        break;
      case 'insideTopLeft':
        x += distance;
        y += distance;
        break;
      case 'insideTopRight':
        x += width - distance;
        y += distance;
        textAlign = 'right';
        break;
      case 'insideBottomLeft':
        x += distance;
        y += height - distance;
        textVerticalAlign = 'bottom';
        break;
      case 'insideBottomRight':
        x += width - distance;
        y += height - distance;
        textAlign = 'right';
        textVerticalAlign = 'bottom';
        break;
    }
  }
  out = out || {};
  out.x = x;
  out.y = y;
  out.align = textAlign;
  out.verticalAlign = textVerticalAlign;
  return out;
}

var PRESERVED_NORMAL_STATE = '__zr_normal__';
var PRIMARY_STATES_KEYS$1 = TRANSFORMABLE_PROPS.concat(['ignore']);
var DEFAULT_ANIMATABLE_MAP = reduce(TRANSFORMABLE_PROPS, function (obj, key) {
  obj[key] = true;
  return obj;
}, {
  ignore: false
});
var tmpTextPosCalcRes = {};
var tmpBoundingRect = new BoundingRect$1(0, 0, 0, 0);
var Element$1 = function () {
  function Element(props) {
    this.id = guid();
    this.animators = [];
    this.currentStates = [];
    this.states = {};
    this._init(props);
  }
  Element.prototype._init = function (props) {
    this.attr(props);
  };
  Element.prototype.drift = function (dx, dy, e) {
    switch (this.draggable) {
      case 'horizontal':
        dy = 0;
        break;
      case 'vertical':
        dx = 0;
        break;
    }
    var m = this.transform;
    if (!m) {
      m = this.transform = [1, 0, 0, 1, 0, 0];
    }
    m[4] += dx;
    m[5] += dy;
    this.decomposeTransform();
    this.markRedraw();
  };
  Element.prototype.beforeUpdate = function () {};
  Element.prototype.afterUpdate = function () {};
  Element.prototype.update = function () {
    this.updateTransform();
    if (this.__dirty) {
      this.updateInnerText();
    }
  };
  Element.prototype.updateInnerText = function (forceUpdate) {
    var textEl = this._textContent;
    if (textEl && (!textEl.ignore || forceUpdate)) {
      if (!this.textConfig) {
        this.textConfig = {};
      }
      var textConfig = this.textConfig;
      var isLocal = textConfig.local;
      var innerTransformable = textEl.innerTransformable;
      var textAlign = void 0;
      var textVerticalAlign = void 0;
      var textStyleChanged = false;
      innerTransformable.parent = isLocal ? this : null;
      var innerOrigin = false;
      innerTransformable.copyTransform(textEl);
      if (textConfig.position != null) {
        var layoutRect = tmpBoundingRect;
        if (textConfig.layoutRect) {
          layoutRect.copy(textConfig.layoutRect);
        } else {
          layoutRect.copy(this.getBoundingRect());
        }
        if (!isLocal) {
          layoutRect.applyTransform(this.transform);
        }
        if (this.calculateTextPosition) {
          this.calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);
        } else {
          calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);
        }
        innerTransformable.x = tmpTextPosCalcRes.x;
        innerTransformable.y = tmpTextPosCalcRes.y;
        textAlign = tmpTextPosCalcRes.align;
        textVerticalAlign = tmpTextPosCalcRes.verticalAlign;
        var textOrigin = textConfig.origin;
        if (textOrigin && textConfig.rotation != null) {
          var relOriginX = void 0;
          var relOriginY = void 0;
          if (textOrigin === 'center') {
            relOriginX = layoutRect.width * 0.5;
            relOriginY = layoutRect.height * 0.5;
          } else {
            relOriginX = parsePercent$1(textOrigin[0], layoutRect.width);
            relOriginY = parsePercent$1(textOrigin[1], layoutRect.height);
          }
          innerOrigin = true;
          innerTransformable.originX = -innerTransformable.x + relOriginX + (isLocal ? 0 : layoutRect.x);
          innerTransformable.originY = -innerTransformable.y + relOriginY + (isLocal ? 0 : layoutRect.y);
        }
      }
      if (textConfig.rotation != null) {
        innerTransformable.rotation = textConfig.rotation;
      }
      var textOffset = textConfig.offset;
      if (textOffset) {
        innerTransformable.x += textOffset[0];
        innerTransformable.y += textOffset[1];
        if (!innerOrigin) {
          innerTransformable.originX = -textOffset[0];
          innerTransformable.originY = -textOffset[1];
        }
      }
      var isInside = textConfig.inside == null ? typeof textConfig.position === 'string' && textConfig.position.indexOf('inside') >= 0 : textConfig.inside;
      var innerTextDefaultStyle = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {});
      var textFill = void 0;
      var textStroke = void 0;
      var autoStroke = void 0;
      if (isInside && this.canBeInsideText()) {
        textFill = textConfig.insideFill;
        textStroke = textConfig.insideStroke;
        if (textFill == null || textFill === 'auto') {
          textFill = this.getInsideTextFill();
        }
        if (textStroke == null || textStroke === 'auto') {
          textStroke = this.getInsideTextStroke(textFill);
          autoStroke = true;
        }
      } else {
        textFill = textConfig.outsideFill;
        textStroke = textConfig.outsideStroke;
        if (textFill == null || textFill === 'auto') {
          textFill = this.getOutsideFill();
        }
        if (textStroke == null || textStroke === 'auto') {
          textStroke = this.getOutsideStroke(textFill);
          autoStroke = true;
        }
      }
      textFill = textFill || '#000';
      if (textFill !== innerTextDefaultStyle.fill || textStroke !== innerTextDefaultStyle.stroke || autoStroke !== innerTextDefaultStyle.autoStroke || textAlign !== innerTextDefaultStyle.align || textVerticalAlign !== innerTextDefaultStyle.verticalAlign) {
        textStyleChanged = true;
        innerTextDefaultStyle.fill = textFill;
        innerTextDefaultStyle.stroke = textStroke;
        innerTextDefaultStyle.autoStroke = autoStroke;
        innerTextDefaultStyle.align = textAlign;
        innerTextDefaultStyle.verticalAlign = textVerticalAlign;
        textEl.setDefaultTextStyle(innerTextDefaultStyle);
      }
      textEl.__dirty |= REDRAW_BIT;
      if (textStyleChanged) {
        textEl.dirtyStyle(true);
      }
    }
  };
  Element.prototype.canBeInsideText = function () {
    return true;
  };
  Element.prototype.getInsideTextFill = function () {
    return '#fff';
  };
  Element.prototype.getInsideTextStroke = function (textFill) {
    return '#000';
  };
  Element.prototype.getOutsideFill = function () {
    return this.__zr && this.__zr.isDarkMode() ? LIGHT_LABEL_COLOR : DARK_LABEL_COLOR;
  };
  Element.prototype.getOutsideStroke = function (textFill) {
    var backgroundColor = this.__zr && this.__zr.getBackgroundColor();
    var colorArr = typeof backgroundColor === 'string' && parse(backgroundColor);
    if (!colorArr) {
      colorArr = [255, 255, 255, 1];
    }
    var alpha = colorArr[3];
    var isDark = this.__zr.isDarkMode();
    for (var i = 0; i < 3; i++) {
      colorArr[i] = colorArr[i] * alpha + (isDark ? 0 : 255) * (1 - alpha);
    }
    colorArr[3] = 1;
    return stringify(colorArr, 'rgba');
  };
  Element.prototype.traverse = function (cb, context) {};
  Element.prototype.attrKV = function (key, value) {
    if (key === 'textConfig') {
      this.setTextConfig(value);
    } else if (key === 'textContent') {
      this.setTextContent(value);
    } else if (key === 'clipPath') {
      this.setClipPath(value);
    } else if (key === 'extra') {
      this.extra = this.extra || {};
      extend(this.extra, value);
    } else {
      this[key] = value;
    }
  };
  Element.prototype.hide = function () {
    this.ignore = true;
    this.markRedraw();
  };
  Element.prototype.show = function () {
    this.ignore = false;
    this.markRedraw();
  };
  Element.prototype.attr = function (keyOrObj, value) {
    if (typeof keyOrObj === 'string') {
      this.attrKV(keyOrObj, value);
    } else if (isObject$3(keyOrObj)) {
      var obj = keyOrObj;
      var keysArr = keys(obj);
      for (var i = 0; i < keysArr.length; i++) {
        var key = keysArr[i];
        this.attrKV(key, keyOrObj[key]);
      }
    }
    this.markRedraw();
    return this;
  };
  Element.prototype.saveCurrentToNormalState = function (toState) {
    this._innerSaveToNormal(toState);
    var normalState = this._normalState;
    for (var i = 0; i < this.animators.length; i++) {
      var animator = this.animators[i];
      var fromStateTransition = animator.__fromStateTransition;
      if (animator.getLoop() || fromStateTransition && fromStateTransition !== PRESERVED_NORMAL_STATE) {
        continue;
      }
      var targetName = animator.targetName;
      var target = targetName ? normalState[targetName] : normalState;
      animator.saveTo(target);
    }
  };
  Element.prototype._innerSaveToNormal = function (toState) {
    var normalState = this._normalState;
    if (!normalState) {
      normalState = this._normalState = {};
    }
    if (toState.textConfig && !normalState.textConfig) {
      normalState.textConfig = this.textConfig;
    }
    this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS$1);
  };
  Element.prototype._savePrimaryToNormal = function (toState, normalState, primaryKeys) {
    for (var i = 0; i < primaryKeys.length; i++) {
      var key = primaryKeys[i];
      if (toState[key] != null && !(key in normalState)) {
        normalState[key] = this[key];
      }
    }
  };
  Element.prototype.hasState = function () {
    return this.currentStates.length > 0;
  };
  Element.prototype.getState = function (name) {
    return this.states[name];
  };
  Element.prototype.ensureState = function (name) {
    var states = this.states;
    if (!states[name]) {
      states[name] = {};
    }
    return states[name];
  };
  Element.prototype.clearStates = function (noAnimation) {
    this.useState(PRESERVED_NORMAL_STATE, false, noAnimation);
  };
  Element.prototype.useState = function (stateName, keepCurrentStates, noAnimation, forceUseHoverLayer) {
    var toNormalState = stateName === PRESERVED_NORMAL_STATE;
    var hasStates = this.hasState();
    if (!hasStates && toNormalState) {
      return;
    }
    var currentStates = this.currentStates;
    var animationCfg = this.stateTransition;
    if (indexOf(currentStates, stateName) >= 0 && (keepCurrentStates || currentStates.length === 1)) {
      return;
    }
    var state;
    if (this.stateProxy && !toNormalState) {
      state = this.stateProxy(stateName);
    }
    if (!state) {
      state = this.states && this.states[stateName];
    }
    if (!state && !toNormalState) {
      logError("State " + stateName + " not exists.");
      return;
    }
    if (!toNormalState) {
      this.saveCurrentToNormalState(state);
    }
    var useHoverLayer = !!(state && state.hoverLayer || forceUseHoverLayer);
    if (useHoverLayer) {
      this._toggleHoverLayerFlag(true);
    }
    this._applyStateObj(stateName, state, this._normalState, keepCurrentStates, !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0, animationCfg);
    var textContent = this._textContent;
    var textGuide = this._textGuide;
    if (textContent) {
      textContent.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);
    }
    if (textGuide) {
      textGuide.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);
    }
    if (toNormalState) {
      this.currentStates = [];
      this._normalState = {};
    } else {
      if (!keepCurrentStates) {
        this.currentStates = [stateName];
      } else {
        this.currentStates.push(stateName);
      }
    }
    this._updateAnimationTargets();
    this.markRedraw();
    if (!useHoverLayer && this.__inHover) {
      this._toggleHoverLayerFlag(false);
      this.__dirty &= ~REDRAW_BIT;
    }
    return state;
  };
  Element.prototype.useStates = function (states, noAnimation, forceUseHoverLayer) {
    if (!states.length) {
      this.clearStates();
    } else {
      var stateObjects = [];
      var currentStates = this.currentStates;
      var len = states.length;
      var notChange = len === currentStates.length;
      if (notChange) {
        for (var i = 0; i < len; i++) {
          if (states[i] !== currentStates[i]) {
            notChange = false;
            break;
          }
        }
      }
      if (notChange) {
        return;
      }
      for (var i = 0; i < len; i++) {
        var stateName = states[i];
        var stateObj = void 0;
        if (this.stateProxy) {
          stateObj = this.stateProxy(stateName, states);
        }
        if (!stateObj) {
          stateObj = this.states[stateName];
        }
        if (stateObj) {
          stateObjects.push(stateObj);
        }
      }
      var lastStateObj = stateObjects[len - 1];
      var useHoverLayer = !!(lastStateObj && lastStateObj.hoverLayer || forceUseHoverLayer);
      if (useHoverLayer) {
        this._toggleHoverLayerFlag(true);
      }
      var mergedState = this._mergeStates(stateObjects);
      var animationCfg = this.stateTransition;
      this.saveCurrentToNormalState(mergedState);
      this._applyStateObj(states.join(','), mergedState, this._normalState, false, !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0, animationCfg);
      var textContent = this._textContent;
      var textGuide = this._textGuide;
      if (textContent) {
        textContent.useStates(states, noAnimation, useHoverLayer);
      }
      if (textGuide) {
        textGuide.useStates(states, noAnimation, useHoverLayer);
      }
      this._updateAnimationTargets();
      this.currentStates = states.slice();
      this.markRedraw();
      if (!useHoverLayer && this.__inHover) {
        this._toggleHoverLayerFlag(false);
        this.__dirty &= ~REDRAW_BIT;
      }
    }
  };
  Element.prototype.isSilent = function () {
    var isSilent = this.silent;
    var ancestor = this.parent;
    while (!isSilent && ancestor) {
      if (ancestor.silent) {
        isSilent = true;
        break;
      }
      ancestor = ancestor.parent;
    }
    return isSilent;
  };
  Element.prototype._updateAnimationTargets = function () {
    for (var i = 0; i < this.animators.length; i++) {
      var animator = this.animators[i];
      if (animator.targetName) {
        animator.changeTarget(this[animator.targetName]);
      }
    }
  };
  Element.prototype.removeState = function (state) {
    var idx = indexOf(this.currentStates, state);
    if (idx >= 0) {
      var currentStates = this.currentStates.slice();
      currentStates.splice(idx, 1);
      this.useStates(currentStates);
    }
  };
  Element.prototype.replaceState = function (oldState, newState, forceAdd) {
    var currentStates = this.currentStates.slice();
    var idx = indexOf(currentStates, oldState);
    var newStateExists = indexOf(currentStates, newState) >= 0;
    if (idx >= 0) {
      if (!newStateExists) {
        currentStates[idx] = newState;
      } else {
        currentStates.splice(idx, 1);
      }
    } else if (forceAdd && !newStateExists) {
      currentStates.push(newState);
    }
    this.useStates(currentStates);
  };
  Element.prototype.toggleState = function (state, enable) {
    if (enable) {
      this.useState(state, true);
    } else {
      this.removeState(state);
    }
  };
  Element.prototype._mergeStates = function (states) {
    var mergedState = {};
    var mergedTextConfig;
    for (var i = 0; i < states.length; i++) {
      var state = states[i];
      extend(mergedState, state);
      if (state.textConfig) {
        mergedTextConfig = mergedTextConfig || {};
        extend(mergedTextConfig, state.textConfig);
      }
    }
    if (mergedTextConfig) {
      mergedState.textConfig = mergedTextConfig;
    }
    return mergedState;
  };
  Element.prototype._applyStateObj = function (stateName, state, normalState, keepCurrentStates, transition, animationCfg) {
    var needsRestoreToNormal = !(state && keepCurrentStates);
    if (state && state.textConfig) {
      this.textConfig = extend({}, keepCurrentStates ? this.textConfig : normalState.textConfig);
      extend(this.textConfig, state.textConfig);
    } else if (needsRestoreToNormal) {
      if (normalState.textConfig) {
        this.textConfig = normalState.textConfig;
      }
    }
    var transitionTarget = {};
    var hasTransition = false;
    for (var i = 0; i < PRIMARY_STATES_KEYS$1.length; i++) {
      var key = PRIMARY_STATES_KEYS$1[i];
      var propNeedsTransition = transition && DEFAULT_ANIMATABLE_MAP[key];
      if (state && state[key] != null) {
        if (propNeedsTransition) {
          hasTransition = true;
          transitionTarget[key] = state[key];
        } else {
          this[key] = state[key];
        }
      } else if (needsRestoreToNormal) {
        if (normalState[key] != null) {
          if (propNeedsTransition) {
            hasTransition = true;
            transitionTarget[key] = normalState[key];
          } else {
            this[key] = normalState[key];
          }
        }
      }
    }
    if (!transition) {
      for (var i = 0; i < this.animators.length; i++) {
        var animator = this.animators[i];
        var targetName = animator.targetName;
        if (!animator.getLoop()) {
          animator.__changeFinalValue(targetName ? (state || normalState)[targetName] : state || normalState);
        }
      }
    }
    if (hasTransition) {
      this._transitionState(stateName, transitionTarget, animationCfg);
    }
  };
  Element.prototype._attachComponent = function (componentEl) {
    if (componentEl.__zr && !componentEl.__hostTarget) {
      {
        throw new Error('Text element has been added to zrender.');
      }
    }
    if (componentEl === this) {
      {
        throw new Error('Recursive component attachment.');
      }
    }
    var zr = this.__zr;
    if (zr) {
      componentEl.addSelfToZr(zr);
    }
    componentEl.__zr = zr;
    componentEl.__hostTarget = this;
  };
  Element.prototype._detachComponent = function (componentEl) {
    if (componentEl.__zr) {
      componentEl.removeSelfFromZr(componentEl.__zr);
    }
    componentEl.__zr = null;
    componentEl.__hostTarget = null;
  };
  Element.prototype.getClipPath = function () {
    return this._clipPath;
  };
  Element.prototype.setClipPath = function (clipPath) {
    if (this._clipPath && this._clipPath !== clipPath) {
      this.removeClipPath();
    }
    this._attachComponent(clipPath);
    this._clipPath = clipPath;
    this.markRedraw();
  };
  Element.prototype.removeClipPath = function () {
    var clipPath = this._clipPath;
    if (clipPath) {
      this._detachComponent(clipPath);
      this._clipPath = null;
      this.markRedraw();
    }
  };
  Element.prototype.getTextContent = function () {
    return this._textContent;
  };
  Element.prototype.setTextContent = function (textEl) {
    var previousTextContent = this._textContent;
    if (previousTextContent === textEl) {
      return;
    }
    if (previousTextContent && previousTextContent !== textEl) {
      this.removeTextContent();
    }
    {
      if (textEl.__zr && !textEl.__hostTarget) {
        throw new Error('Text element has been added to zrender.');
      }
    }
    textEl.innerTransformable = new Transformable$1();
    this._attachComponent(textEl);
    this._textContent = textEl;
    this.markRedraw();
  };
  Element.prototype.setTextConfig = function (cfg) {
    if (!this.textConfig) {
      this.textConfig = {};
    }
    extend(this.textConfig, cfg);
    this.markRedraw();
  };
  Element.prototype.removeTextConfig = function () {
    this.textConfig = null;
    this.markRedraw();
  };
  Element.prototype.removeTextContent = function () {
    var textEl = this._textContent;
    if (textEl) {
      textEl.innerTransformable = null;
      this._detachComponent(textEl);
      this._textContent = null;
      this._innerTextDefaultStyle = null;
      this.markRedraw();
    }
  };
  Element.prototype.getTextGuideLine = function () {
    return this._textGuide;
  };
  Element.prototype.setTextGuideLine = function (guideLine) {
    if (this._textGuide && this._textGuide !== guideLine) {
      this.removeTextGuideLine();
    }
    this._attachComponent(guideLine);
    this._textGuide = guideLine;
    this.markRedraw();
  };
  Element.prototype.removeTextGuideLine = function () {
    var textGuide = this._textGuide;
    if (textGuide) {
      this._detachComponent(textGuide);
      this._textGuide = null;
      this.markRedraw();
    }
  };
  Element.prototype.markRedraw = function () {
    this.__dirty |= REDRAW_BIT;
    var zr = this.__zr;
    if (zr) {
      if (this.__inHover) {
        zr.refreshHover();
      } else {
        zr.refresh();
      }
    }
    if (this.__hostTarget) {
      this.__hostTarget.markRedraw();
    }
  };
  Element.prototype.dirty = function () {
    this.markRedraw();
  };
  Element.prototype._toggleHoverLayerFlag = function (inHover) {
    this.__inHover = inHover;
    var textContent = this._textContent;
    var textGuide = this._textGuide;
    if (textContent) {
      textContent.__inHover = inHover;
    }
    if (textGuide) {
      textGuide.__inHover = inHover;
    }
  };
  Element.prototype.addSelfToZr = function (zr) {
    if (this.__zr === zr) {
      return;
    }
    this.__zr = zr;
    var animators = this.animators;
    if (animators) {
      for (var i = 0; i < animators.length; i++) {
        zr.animation.addAnimator(animators[i]);
      }
    }
    if (this._clipPath) {
      this._clipPath.addSelfToZr(zr);
    }
    if (this._textContent) {
      this._textContent.addSelfToZr(zr);
    }
    if (this._textGuide) {
      this._textGuide.addSelfToZr(zr);
    }
  };
  Element.prototype.removeSelfFromZr = function (zr) {
    if (!this.__zr) {
      return;
    }
    this.__zr = null;
    var animators = this.animators;
    if (animators) {
      for (var i = 0; i < animators.length; i++) {
        zr.animation.removeAnimator(animators[i]);
      }
    }
    if (this._clipPath) {
      this._clipPath.removeSelfFromZr(zr);
    }
    if (this._textContent) {
      this._textContent.removeSelfFromZr(zr);
    }
    if (this._textGuide) {
      this._textGuide.removeSelfFromZr(zr);
    }
  };
  Element.prototype.animate = function (key, loop, allowDiscreteAnimation) {
    var target = key ? this[key] : this;
    {
      if (!target) {
        logError('Property "' + key + '" is not existed in element ' + this.id);
        return;
      }
    }
    var animator = new Animator(target, loop, allowDiscreteAnimation);
    key && (animator.targetName = key);
    this.addAnimator(animator, key);
    return animator;
  };
  Element.prototype.addAnimator = function (animator, key) {
    var zr = this.__zr;
    var el = this;
    animator.during(function () {
      el.updateDuringAnimation(key);
    }).done(function () {
      var animators = el.animators;
      var idx = indexOf(animators, animator);
      if (idx >= 0) {
        animators.splice(idx, 1);
      }
    });
    this.animators.push(animator);
    if (zr) {
      zr.animation.addAnimator(animator);
    }
    zr && zr.wakeUp();
  };
  Element.prototype.updateDuringAnimation = function (key) {
    this.markRedraw();
  };
  Element.prototype.stopAnimation = function (scope, forwardToLast) {
    var animators = this.animators;
    var len = animators.length;
    var leftAnimators = [];
    for (var i = 0; i < len; i++) {
      var animator = animators[i];
      if (!scope || scope === animator.scope) {
        animator.stop(forwardToLast);
      } else {
        leftAnimators.push(animator);
      }
    }
    this.animators = leftAnimators;
    return this;
  };
  Element.prototype.animateTo = function (target, cfg, animationProps) {
    animateTo(this, target, cfg, animationProps);
  };
  Element.prototype.animateFrom = function (target, cfg, animationProps) {
    animateTo(this, target, cfg, animationProps, true);
  };
  Element.prototype._transitionState = function (stateName, target, cfg, animationProps) {
    var animators = animateTo(this, target, cfg, animationProps);
    for (var i = 0; i < animators.length; i++) {
      animators[i].__fromStateTransition = stateName;
    }
  };
  Element.prototype.getBoundingRect = function () {
    return null;
  };
  Element.prototype.getPaintRect = function () {
    return null;
  };
  Element.initDefaultProps = function () {
    var elProto = Element.prototype;
    elProto.type = 'element';
    elProto.name = '';
    elProto.ignore = elProto.silent = elProto.isGroup = elProto.draggable = elProto.dragging = elProto.ignoreClip = elProto.__inHover = false;
    elProto.__dirty = REDRAW_BIT;
    var logs = {};
    function logDeprecatedError(key, xKey, yKey) {
      if (!logs[key + xKey + yKey]) {
        console.warn("DEPRECATED: '" + key + "' has been deprecated. use '" + xKey + "', '" + yKey + "' instead");
        logs[key + xKey + yKey] = true;
      }
    }
    function createLegacyProperty(key, privateKey, xKey, yKey) {
      Object.defineProperty(elProto, key, {
        get: function () {
          {
            logDeprecatedError(key, xKey, yKey);
          }
          if (!this[privateKey]) {
            var pos = this[privateKey] = [];
            enhanceArray(this, pos);
          }
          return this[privateKey];
        },
        set: function (pos) {
          {
            logDeprecatedError(key, xKey, yKey);
          }
          this[xKey] = pos[0];
          this[yKey] = pos[1];
          this[privateKey] = pos;
          enhanceArray(this, pos);
        }
      });
      function enhanceArray(self, pos) {
        Object.defineProperty(pos, 0, {
          get: function () {
            return self[xKey];
          },
          set: function (val) {
            self[xKey] = val;
          }
        });
        Object.defineProperty(pos, 1, {
          get: function () {
            return self[yKey];
          },
          set: function (val) {
            self[yKey] = val;
          }
        });
      }
    }
    if (Object.defineProperty) {
      createLegacyProperty('position', '_legacyPos', 'x', 'y');
      createLegacyProperty('scale', '_legacyScale', 'scaleX', 'scaleY');
      createLegacyProperty('origin', '_legacyOrigin', 'originX', 'originY');
    }
  }();
  return Element;
}();
mixin(Element$1, Eventful$1);
mixin(Element$1, Transformable$1);
function animateTo(animatable, target, cfg, animationProps, reverse) {
  cfg = cfg || {};
  var animators = [];
  animateToShallow(animatable, '', animatable, target, cfg, animationProps, animators, reverse);
  var finishCount = animators.length;
  var doneHappened = false;
  var cfgDone = cfg.done;
  var cfgAborted = cfg.aborted;
  var doneCb = function () {
    doneHappened = true;
    finishCount--;
    if (finishCount <= 0) {
      doneHappened ? cfgDone && cfgDone() : cfgAborted && cfgAborted();
    }
  };
  var abortedCb = function () {
    finishCount--;
    if (finishCount <= 0) {
      doneHappened ? cfgDone && cfgDone() : cfgAborted && cfgAborted();
    }
  };
  if (!finishCount) {
    cfgDone && cfgDone();
  }
  if (animators.length > 0 && cfg.during) {
    animators[0].during(function (target, percent) {
      cfg.during(percent);
    });
  }
  for (var i = 0; i < animators.length; i++) {
    var animator = animators[i];
    if (doneCb) {
      animator.done(doneCb);
    }
    if (abortedCb) {
      animator.aborted(abortedCb);
    }
    if (cfg.force) {
      animator.duration(cfg.duration);
    }
    animator.start(cfg.easing);
  }
  return animators;
}
function copyArrShallow(source, target, len) {
  for (var i = 0; i < len; i++) {
    source[i] = target[i];
  }
}
function is2DArray(value) {
  return isArrayLike(value[0]);
}
function copyValue(target, source, key) {
  if (isArrayLike(source[key])) {
    if (!isArrayLike(target[key])) {
      target[key] = [];
    }
    if (isTypedArray$1(source[key])) {
      var len = source[key].length;
      if (target[key].length !== len) {
        target[key] = new source[key].constructor(len);
        copyArrShallow(target[key], source[key], len);
      }
    } else {
      var sourceArr = source[key];
      var targetArr = target[key];
      var len0 = sourceArr.length;
      if (is2DArray(sourceArr)) {
        var len1 = sourceArr[0].length;
        for (var i = 0; i < len0; i++) {
          if (!targetArr[i]) {
            targetArr[i] = Array.prototype.slice.call(sourceArr[i]);
          } else {
            copyArrShallow(targetArr[i], sourceArr[i], len1);
          }
        }
      } else {
        copyArrShallow(targetArr, sourceArr, len0);
      }
      targetArr.length = sourceArr.length;
    }
  } else {
    target[key] = source[key];
  }
}
function isValueSame(val1, val2) {
  return val1 === val2 || isArrayLike(val1) && isArrayLike(val2) && is1DArraySame(val1, val2);
}
function is1DArraySame(arr0, arr1) {
  var len = arr0.length;
  if (len !== arr1.length) {
    return false;
  }
  for (var i = 0; i < len; i++) {
    if (arr0[i] !== arr1[i]) {
      return false;
    }
  }
  return true;
}
function animateToShallow(animatable, topKey, animateObj, target, cfg, animationProps, animators, reverse) {
  var targetKeys = keys(target);
  var duration = cfg.duration;
  var delay = cfg.delay;
  var additive = cfg.additive;
  var setToFinal = cfg.setToFinal;
  var animateAll = !isObject$3(animationProps);
  var existsAnimators = animatable.animators;
  var animationKeys = [];
  for (var k = 0; k < targetKeys.length; k++) {
    var innerKey = targetKeys[k];
    var targetVal = target[innerKey];
    if (targetVal != null && animateObj[innerKey] != null && (animateAll || animationProps[innerKey])) {
      if (isObject$3(targetVal) && !isArrayLike(targetVal) && !isGradientObject(targetVal)) {
        if (topKey) {
          if (!reverse) {
            animateObj[innerKey] = targetVal;
            animatable.updateDuringAnimation(topKey);
          }
          continue;
        }
        animateToShallow(animatable, innerKey, animateObj[innerKey], targetVal, cfg, animationProps && animationProps[innerKey], animators, reverse);
      } else {
        animationKeys.push(innerKey);
      }
    } else if (!reverse) {
      animateObj[innerKey] = targetVal;
      animatable.updateDuringAnimation(topKey);
      animationKeys.push(innerKey);
    }
  }
  var keyLen = animationKeys.length;
  if (!additive && keyLen) {
    for (var i = 0; i < existsAnimators.length; i++) {
      var animator = existsAnimators[i];
      if (animator.targetName === topKey) {
        var allAborted = animator.stopTracks(animationKeys);
        if (allAborted) {
          var idx = indexOf(existsAnimators, animator);
          existsAnimators.splice(idx, 1);
        }
      }
    }
  }
  if (!cfg.force) {
    animationKeys = filter(animationKeys, function (key) {
      return !isValueSame(target[key], animateObj[key]);
    });
    keyLen = animationKeys.length;
  }
  if (keyLen > 0 || cfg.force && !animators.length) {
    var revertedSource = void 0;
    var reversedTarget = void 0;
    var sourceClone = void 0;
    if (reverse) {
      reversedTarget = {};
      if (setToFinal) {
        revertedSource = {};
      }
      for (var i = 0; i < keyLen; i++) {
        var innerKey = animationKeys[i];
        reversedTarget[innerKey] = animateObj[innerKey];
        if (setToFinal) {
          revertedSource[innerKey] = target[innerKey];
        } else {
          animateObj[innerKey] = target[innerKey];
        }
      }
    } else if (setToFinal) {
      sourceClone = {};
      for (var i = 0; i < keyLen; i++) {
        var innerKey = animationKeys[i];
        sourceClone[innerKey] = cloneValue(animateObj[innerKey]);
        copyValue(animateObj, target, innerKey);
      }
    }
    var animator = new Animator(animateObj, false, false, additive ? filter(existsAnimators, function (animator) {
      return animator.targetName === topKey;
    }) : null);
    animator.targetName = topKey;
    if (cfg.scope) {
      animator.scope = cfg.scope;
    }
    if (setToFinal && revertedSource) {
      animator.whenWithKeys(0, revertedSource, animationKeys);
    }
    if (sourceClone) {
      animator.whenWithKeys(0, sourceClone, animationKeys);
    }
    animator.whenWithKeys(duration == null ? 500 : duration, reverse ? reversedTarget : target, animationKeys).delay(delay || 0);
    animatable.addAnimator(animator, topKey);
    animators.push(animator);
  }
}
var Element$2 = Element$1;

var Group$4 = function (_super) {
  __extends(Group, _super);
  function Group(opts) {
    var _this = _super.call(this) || this;
    _this.isGroup = true;
    _this._children = [];
    _this.attr(opts);
    return _this;
  }
  Group.prototype.childrenRef = function () {
    return this._children;
  };
  Group.prototype.children = function () {
    return this._children.slice();
  };
  Group.prototype.childAt = function (idx) {
    return this._children[idx];
  };
  Group.prototype.childOfName = function (name) {
    var children = this._children;
    for (var i = 0; i < children.length; i++) {
      if (children[i].name === name) {
        return children[i];
      }
    }
  };
  Group.prototype.childCount = function () {
    return this._children.length;
  };
  Group.prototype.add = function (child) {
    if (child) {
      if (child !== this && child.parent !== this) {
        this._children.push(child);
        this._doAdd(child);
      }
      {
        if (child.__hostTarget) {
          throw 'This elemenet has been used as an attachment';
        }
      }
    }
    return this;
  };
  Group.prototype.addBefore = function (child, nextSibling) {
    if (child && child !== this && child.parent !== this && nextSibling && nextSibling.parent === this) {
      var children = this._children;
      var idx = children.indexOf(nextSibling);
      if (idx >= 0) {
        children.splice(idx, 0, child);
        this._doAdd(child);
      }
    }
    return this;
  };
  Group.prototype.replace = function (oldChild, newChild) {
    var idx = indexOf(this._children, oldChild);
    if (idx >= 0) {
      this.replaceAt(newChild, idx);
    }
    return this;
  };
  Group.prototype.replaceAt = function (child, index) {
    var children = this._children;
    var old = children[index];
    if (child && child !== this && child.parent !== this && child !== old) {
      children[index] = child;
      old.parent = null;
      var zr = this.__zr;
      if (zr) {
        old.removeSelfFromZr(zr);
      }
      this._doAdd(child);
    }
    return this;
  };
  Group.prototype._doAdd = function (child) {
    if (child.parent) {
      child.parent.remove(child);
    }
    child.parent = this;
    var zr = this.__zr;
    if (zr && zr !== child.__zr) {
      child.addSelfToZr(zr);
    }
    zr && zr.refresh();
  };
  Group.prototype.remove = function (child) {
    var zr = this.__zr;
    var children = this._children;
    var idx = indexOf(children, child);
    if (idx < 0) {
      return this;
    }
    children.splice(idx, 1);
    child.parent = null;
    if (zr) {
      child.removeSelfFromZr(zr);
    }
    zr && zr.refresh();
    return this;
  };
  Group.prototype.removeAll = function () {
    var children = this._children;
    var zr = this.__zr;
    for (var i = 0; i < children.length; i++) {
      var child = children[i];
      if (zr) {
        child.removeSelfFromZr(zr);
      }
      child.parent = null;
    }
    children.length = 0;
    return this;
  };
  Group.prototype.eachChild = function (cb, context) {
    var children = this._children;
    for (var i = 0; i < children.length; i++) {
      var child = children[i];
      cb.call(context, child, i);
    }
    return this;
  };
  Group.prototype.traverse = function (cb, context) {
    for (var i = 0; i < this._children.length; i++) {
      var child = this._children[i];
      var stopped = cb.call(context, child);
      if (child.isGroup && !stopped) {
        child.traverse(cb, context);
      }
    }
    return this;
  };
  Group.prototype.addSelfToZr = function (zr) {
    _super.prototype.addSelfToZr.call(this, zr);
    for (var i = 0; i < this._children.length; i++) {
      var child = this._children[i];
      child.addSelfToZr(zr);
    }
  };
  Group.prototype.removeSelfFromZr = function (zr) {
    _super.prototype.removeSelfFromZr.call(this, zr);
    for (var i = 0; i < this._children.length; i++) {
      var child = this._children[i];
      child.removeSelfFromZr(zr);
    }
  };
  Group.prototype.getBoundingRect = function (includeChildren) {
    var tmpRect = new BoundingRect$1(0, 0, 0, 0);
    var children = includeChildren || this._children;
    var tmpMat = [];
    var rect = null;
    for (var i = 0; i < children.length; i++) {
      var child = children[i];
      if (child.ignore || child.invisible) {
        continue;
      }
      var childRect = child.getBoundingRect();
      var transform = child.getLocalTransform(tmpMat);
      if (transform) {
        BoundingRect$1.applyTransform(tmpRect, childRect, transform);
        rect = rect || tmpRect.clone();
        rect.union(tmpRect);
      } else {
        rect = rect || childRect.clone();
        rect.union(childRect);
      }
    }
    return rect || tmpRect;
  };
  return Group;
}(Element$2);
Group$4.prototype.type = 'group';
var Group$5 = Group$4;

/*!
* ZRender, a high performance 2d drawing library.
*
* Copyright (c) 2013, Baidu Inc.
* All rights reserved.
*
* LICENSE
* https://github.com/ecomfe/zrender/blob/master/LICENSE.txt
*/
var painterCtors = {};
var instances$1 = {};
function delInstance(id) {
  delete instances$1[id];
}
function isDarkMode(backgroundColor) {
  if (!backgroundColor) {
    return false;
  }
  if (typeof backgroundColor === 'string') {
    return lum(backgroundColor, 1) < DARK_MODE_THRESHOLD;
  } else if (backgroundColor.colorStops) {
    var colorStops = backgroundColor.colorStops;
    var totalLum = 0;
    var len = colorStops.length;
    for (var i = 0; i < len; i++) {
      totalLum += lum(colorStops[i].color, 1);
    }
    totalLum /= len;
    return totalLum < DARK_MODE_THRESHOLD;
  }
  return false;
}
var ZRender = function () {
  function ZRender(id, dom, opts) {
    var _this = this;
    this._sleepAfterStill = 10;
    this._stillFrameAccum = 0;
    this._needsRefresh = true;
    this._needsRefreshHover = true;
    this._darkMode = false;
    opts = opts || {};
    this.dom = dom;
    this.id = id;
    var storage = new Storage$1();
    var rendererType = opts.renderer || 'canvas';
    if (!painterCtors[rendererType]) {
      rendererType = keys(painterCtors)[0];
    }
    {
      if (!painterCtors[rendererType]) {
        throw new Error("Renderer '" + rendererType + "' is not imported. Please import it first.");
      }
    }
    opts.useDirtyRect = opts.useDirtyRect == null ? false : opts.useDirtyRect;
    var painter = new painterCtors[rendererType](dom, storage, opts, id);
    var ssrMode = opts.ssr || painter.ssrOnly;
    this.storage = storage;
    this.painter = painter;
    var handlerProxy = !env$1.node && !env$1.worker && !ssrMode ? new HandlerProxy(painter.getViewportRoot(), painter.root) : null;
    var useCoarsePointer = opts.useCoarsePointer;
    var usePointerSize = useCoarsePointer == null || useCoarsePointer === 'auto' ? env$1.touchEventsSupported : !!useCoarsePointer;
    var defaultPointerSize = 44;
    var pointerSize;
    if (usePointerSize) {
      pointerSize = retrieve2(opts.pointerSize, defaultPointerSize);
    }
    this.handler = new Handler$1(storage, painter, handlerProxy, painter.root, pointerSize);
    this.animation = new Animation$1({
      stage: {
        update: ssrMode ? null : function () {
          return _this._flush(true);
        }
      }
    });
    if (!ssrMode) {
      this.animation.start();
    }
  }
  ZRender.prototype.add = function (el) {
    if (this._disposed || !el) {
      return;
    }
    this.storage.addRoot(el);
    el.addSelfToZr(this);
    this.refresh();
  };
  ZRender.prototype.remove = function (el) {
    if (this._disposed || !el) {
      return;
    }
    this.storage.delRoot(el);
    el.removeSelfFromZr(this);
    this.refresh();
  };
  ZRender.prototype.configLayer = function (zLevel, config) {
    if (this._disposed) {
      return;
    }
    if (this.painter.configLayer) {
      this.painter.configLayer(zLevel, config);
    }
    this.refresh();
  };
  ZRender.prototype.setBackgroundColor = function (backgroundColor) {
    if (this._disposed) {
      return;
    }
    if (this.painter.setBackgroundColor) {
      this.painter.setBackgroundColor(backgroundColor);
    }
    this.refresh();
    this._backgroundColor = backgroundColor;
    this._darkMode = isDarkMode(backgroundColor);
  };
  ZRender.prototype.getBackgroundColor = function () {
    return this._backgroundColor;
  };
  ZRender.prototype.setDarkMode = function (darkMode) {
    this._darkMode = darkMode;
  };
  ZRender.prototype.isDarkMode = function () {
    return this._darkMode;
  };
  ZRender.prototype.refreshImmediately = function (fromInside) {
    if (this._disposed) {
      return;
    }
    if (!fromInside) {
      this.animation.update(true);
    }
    this._needsRefresh = false;
    this.painter.refresh();
    this._needsRefresh = false;
  };
  ZRender.prototype.refresh = function () {
    if (this._disposed) {
      return;
    }
    this._needsRefresh = true;
    this.animation.start();
  };
  ZRender.prototype.flush = function () {
    if (this._disposed) {
      return;
    }
    this._flush(false);
  };
  ZRender.prototype._flush = function (fromInside) {
    var triggerRendered;
    var start = getTime();
    if (this._needsRefresh) {
      triggerRendered = true;
      this.refreshImmediately(fromInside);
    }
    if (this._needsRefreshHover) {
      triggerRendered = true;
      this.refreshHoverImmediately();
    }
    var end = getTime();
    if (triggerRendered) {
      this._stillFrameAccum = 0;
      this.trigger('rendered', {
        elapsedTime: end - start
      });
    } else if (this._sleepAfterStill > 0) {
      this._stillFrameAccum++;
      if (this._stillFrameAccum > this._sleepAfterStill) {
        this.animation.stop();
      }
    }
  };
  ZRender.prototype.setSleepAfterStill = function (stillFramesCount) {
    this._sleepAfterStill = stillFramesCount;
  };
  ZRender.prototype.wakeUp = function () {
    if (this._disposed) {
      return;
    }
    this.animation.start();
    this._stillFrameAccum = 0;
  };
  ZRender.prototype.refreshHover = function () {
    this._needsRefreshHover = true;
  };
  ZRender.prototype.refreshHoverImmediately = function () {
    if (this._disposed) {
      return;
    }
    this._needsRefreshHover = false;
    if (this.painter.refreshHover && this.painter.getType() === 'canvas') {
      this.painter.refreshHover();
    }
  };
  ZRender.prototype.resize = function (opts) {
    if (this._disposed) {
      return;
    }
    opts = opts || {};
    this.painter.resize(opts.width, opts.height);
    this.handler.resize();
  };
  ZRender.prototype.clearAnimation = function () {
    if (this._disposed) {
      return;
    }
    this.animation.clear();
  };
  ZRender.prototype.getWidth = function () {
    if (this._disposed) {
      return;
    }
    return this.painter.getWidth();
  };
  ZRender.prototype.getHeight = function () {
    if (this._disposed) {
      return;
    }
    return this.painter.getHeight();
  };
  ZRender.prototype.setCursorStyle = function (cursorStyle) {
    if (this._disposed) {
      return;
    }
    this.handler.setCursorStyle(cursorStyle);
  };
  ZRender.prototype.findHover = function (x, y) {
    if (this._disposed) {
      return;
    }
    return this.handler.findHover(x, y);
  };
  ZRender.prototype.on = function (eventName, eventHandler, context) {
    if (!this._disposed) {
      this.handler.on(eventName, eventHandler, context);
    }
    return this;
  };
  ZRender.prototype.off = function (eventName, eventHandler) {
    if (this._disposed) {
      return;
    }
    this.handler.off(eventName, eventHandler);
  };
  ZRender.prototype.trigger = function (eventName, event) {
    if (this._disposed) {
      return;
    }
    this.handler.trigger(eventName, event);
  };
  ZRender.prototype.clear = function () {
    if (this._disposed) {
      return;
    }
    var roots = this.storage.getRoots();
    for (var i = 0; i < roots.length; i++) {
      if (roots[i] instanceof Group$5) {
        roots[i].removeSelfFromZr(this);
      }
    }
    this.storage.delAllRoots();
    this.painter.clear();
  };
  ZRender.prototype.dispose = function () {
    if (this._disposed) {
      return;
    }
    this.animation.stop();
    this.clear();
    this.storage.dispose();
    this.painter.dispose();
    this.handler.dispose();
    this.animation = this.storage = this.painter = this.handler = null;
    this._disposed = true;
    delInstance(this.id);
  };
  return ZRender;
}();
function init$2(dom, opts) {
  var zr = new ZRender(guid(), dom, opts);
  instances$1[zr.id] = zr;
  return zr;
}
function registerPainter(name, Ctor) {
  painterCtors[name] = Ctor;
}
var ssrDataGetter;
function getElementSSRData(el) {
  if (typeof ssrDataGetter === 'function') {
    return ssrDataGetter(el);
  }
}
function registerSSRDataGetter(getter) {
  ssrDataGetter = getter;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var RADIAN_EPSILON = 1e-4;
// Although chrome already enlarge this number to 100 for `toFixed`, but
// we sill follow the spec for compatibility.
var ROUND_SUPPORTED_PRECISION_MAX = 20;
function _trim(str) {
  return str.replace(/^\s+|\s+$/g, '');
}
/**
 * Linear mapping a value from domain to range
 * @param  val
 * @param  domain Domain extent domain[0] can be bigger than domain[1]
 * @param  range  Range extent range[0] can be bigger than range[1]
 * @param  clamp Default to be false
 */
function linearMap$2(val, domain, range, clamp) {
  var d0 = domain[0];
  var d1 = domain[1];
  var r0 = range[0];
  var r1 = range[1];
  var subDomain = d1 - d0;
  var subRange = r1 - r0;
  if (subDomain === 0) {
    return subRange === 0 ? r0 : (r0 + r1) / 2;
  }
  // Avoid accuracy problem in edge, such as
  // 146.39 - 62.83 === 83.55999999999999.
  // See echarts/test/ut/spec/util/number.js#linearMap#accuracyError
  // It is a little verbose for efficiency considering this method
  // is a hotspot.
  if (clamp) {
    if (subDomain > 0) {
      if (val <= d0) {
        return r0;
      } else if (val >= d1) {
        return r1;
      }
    } else {
      if (val >= d0) {
        return r0;
      } else if (val <= d1) {
        return r1;
      }
    }
  } else {
    if (val === d0) {
      return r0;
    }
    if (val === d1) {
      return r1;
    }
  }
  return (val - d0) / subDomain * subRange + r0;
}
/**
 * Convert a percent string to absolute number.
 * Returns NaN if percent is not a valid string or number
 */
function parsePercent(percent, all) {
  switch (percent) {
    case 'center':
    case 'middle':
      percent = '50%';
      break;
    case 'left':
    case 'top':
      percent = '0%';
      break;
    case 'right':
    case 'bottom':
      percent = '100%';
      break;
  }
  if (isString(percent)) {
    if (_trim(percent).match(/%$/)) {
      return parseFloat(percent) / 100 * all;
    }
    return parseFloat(percent);
  }
  return percent == null ? NaN : +percent;
}
function round$4(x, precision, returnStr) {
  if (precision == null) {
    precision = 10;
  }
  // Avoid range error
  precision = Math.min(Math.max(0, precision), ROUND_SUPPORTED_PRECISION_MAX);
  // PENDING: 1.005.toFixed(2) is '1.00' rather than '1.01'
  x = (+x).toFixed(precision);
  return returnStr ? x : +x;
}
/**
 * Inplacd asc sort arr.
 * The input arr will be modified.
 */
function asc$2(arr) {
  arr.sort(function (a, b) {
    return a - b;
  });
  return arr;
}
/**
 * Get precision.
 */
function getPrecision(val) {
  val = +val;
  if (isNaN(val)) {
    return 0;
  }
  // It is much faster than methods converting number to string as follows
  //      let tmp = val.toString();
  //      return tmp.length - 1 - tmp.indexOf('.');
  // especially when precision is low
  // Notice:
  // (1) If the loop count is over about 20, it is slower than `getPrecisionSafe`.
  //     (see https://jsbench.me/2vkpcekkvw/1)
  // (2) If the val is less than for example 1e-15, the result may be incorrect.
  //     (see test/ut/spec/util/number.test.ts `getPrecision_equal_random`)
  if (val > 1e-14) {
    var e = 1;
    for (var i = 0; i < 15; i++, e *= 10) {
      if (Math.round(val * e) / e === val) {
        return i;
      }
    }
  }
  return getPrecisionSafe(val);
}
/**
 * Get precision with slow but safe method
 */
function getPrecisionSafe(val) {
  // toLowerCase for: '3.4E-12'
  var str = val.toString().toLowerCase();
  // Consider scientific notation: '3.4e-12' '3.4e+12'
  var eIndex = str.indexOf('e');
  var exp = eIndex > 0 ? +str.slice(eIndex + 1) : 0;
  var significandPartLen = eIndex > 0 ? eIndex : str.length;
  var dotIndex = str.indexOf('.');
  var decimalPartLen = dotIndex < 0 ? 0 : significandPartLen - 1 - dotIndex;
  return Math.max(0, decimalPartLen - exp);
}
/**
 * Minimal dicernible data precisioin according to a single pixel.
 */
function getPixelPrecision(dataExtent, pixelExtent) {
  var log = Math.log;
  var LN10 = Math.LN10;
  var dataQuantity = Math.floor(log(dataExtent[1] - dataExtent[0]) / LN10);
  var sizeQuantity = Math.round(log(Math.abs(pixelExtent[1] - pixelExtent[0])) / LN10);
  // toFixed() digits argument must be between 0 and 20.
  var precision = Math.min(Math.max(-dataQuantity + sizeQuantity, 0), 20);
  return !isFinite(precision) ? 20 : precision;
}
/**
 * Get a data of given precision, assuring the sum of percentages
 * in valueList is 1.
 * The largest remainder method is used.
 * https://en.wikipedia.org/wiki/Largest_remainder_method
 *
 * @param valueList a list of all data
 * @param precision integer number showing digits of precision
 * @return {Array<number>}
 */
function getPercentSeats(valueList, precision) {
  var sum = reduce(valueList, function (acc, val) {
    return acc + (isNaN(val) ? 0 : val);
  }, 0);
  if (sum === 0) {
    return [];
  }
  var digits = Math.pow(10, precision);
  var votesPerQuota = map$1(valueList, function (val) {
    return (isNaN(val) ? 0 : val) / sum * digits * 100;
  });
  var targetSeats = digits * 100;
  var seats = map$1(votesPerQuota, function (votes) {
    // Assign automatic seats.
    return Math.floor(votes);
  });
  var currentSum = reduce(seats, function (acc, val) {
    return acc + val;
  }, 0);
  var remainder = map$1(votesPerQuota, function (votes, idx) {
    return votes - seats[idx];
  });
  // Has remainding votes.
  while (currentSum < targetSeats) {
    // Find next largest remainder.
    var max = Number.NEGATIVE_INFINITY;
    var maxId = null;
    for (var i = 0, len = remainder.length; i < len; ++i) {
      if (remainder[i] > max) {
        max = remainder[i];
        maxId = i;
      }
    }
    // Add a vote to max remainder.
    ++seats[maxId];
    remainder[maxId] = 0;
    ++currentSum;
  }
  return map$1(seats, function (seat) {
    return seat / digits;
  });
}
/**
 * Solve the floating point adding problem like 0.1 + 0.2 === 0.30000000000000004
 * See <http://0.30000000000000004.com/>
 */
function addSafe(val0, val1) {
  var maxPrecision = Math.max(getPrecision(val0), getPrecision(val1));
  // const multiplier = Math.pow(10, maxPrecision);
  // return (Math.round(val0 * multiplier) + Math.round(val1 * multiplier)) / multiplier;
  var sum = val0 + val1;
  // // PENDING: support more?
  return maxPrecision > ROUND_SUPPORTED_PRECISION_MAX ? sum : round$4(sum, maxPrecision);
}
// Number.MAX_SAFE_INTEGER, ie do not support.
var MAX_SAFE_INTEGER = 9007199254740991;
/**
 * To 0 - 2 * PI, considering negative radian.
 */
function remRadian(radian) {
  var pi2 = Math.PI * 2;
  return (radian % pi2 + pi2) % pi2;
}
/**
 * @param {type} radian
 * @return {boolean}
 */
function isRadianAroundZero(val) {
  return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;
}
// eslint-disable-next-line
var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/; // jshint ignore:line
/**
 * @param value valid type: number | string | Date, otherwise return `new Date(NaN)`
 *   These values can be accepted:
 *   + An instance of Date, represent a time in its own time zone.
 *   + Or string in a subset of ISO 8601, only including:
 *     + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06',
 *     + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123',
 *     + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00',
 *     all of which will be treated as local time if time zone is not specified
 *     (see <https://momentjs.com/>).
 *   + Or other string format, including (all of which will be treated as local time):
 *     '2012', '2012-3-1', '2012/3/1', '2012/03/01',
 *     '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123'
 *   + a timestamp, which represent a time in UTC.
 * @return date Never be null/undefined. If invalid, return `new Date(NaN)`.
 */
function parseDate(value) {
  if (value instanceof Date) {
    return value;
  } else if (isString(value)) {
    // Different browsers parse date in different way, so we parse it manually.
    // Some other issues:
    // new Date('1970-01-01') is UTC,
    // new Date('1970/01/01') and new Date('1970-1-01') is local.
    // See issue #3623
    var match = TIME_REG.exec(value);
    if (!match) {
      // return Invalid Date.
      return new Date(NaN);
    }
    // Use local time when no timezone offset is specified.
    if (!match[8]) {
      // match[n] can only be string or undefined.
      // But take care of '12' + 1 => '121'.
      return new Date(+match[1], +(match[2] || 1) - 1, +match[3] || 1, +match[4] || 0, +(match[5] || 0), +match[6] || 0, match[7] ? +match[7].substring(0, 3) : 0);
    }
    // Timezoneoffset of Javascript Date has considered DST (Daylight Saving Time,
    // https://tc39.github.io/ecma262/#sec-daylight-saving-time-adjustment).
    // For example, system timezone is set as "Time Zone: America/Toronto",
    // then these code will get different result:
    // `new Date(1478411999999).getTimezoneOffset();  // get 240`
    // `new Date(1478412000000).getTimezoneOffset();  // get 300`
    // So we should not use `new Date`, but use `Date.UTC`.
    else {
      var hour = +match[4] || 0;
      if (match[8].toUpperCase() !== 'Z') {
        hour -= +match[8].slice(0, 3);
      }
      return new Date(Date.UTC(+match[1], +(match[2] || 1) - 1, +match[3] || 1, hour, +(match[5] || 0), +match[6] || 0, match[7] ? +match[7].substring(0, 3) : 0));
    }
  } else if (value == null) {
    return new Date(NaN);
  }
  return new Date(Math.round(value));
}
/**
 * Quantity of a number. e.g. 0.1, 1, 10, 100
 *
 * @param val
 * @return
 */
function quantity(val) {
  return Math.pow(10, quantityExponent(val));
}
/**
 * Exponent of the quantity of a number
 * e.g., 1234 equals to 1.234*10^3, so quantityExponent(1234) is 3
 *
 * @param val non-negative value
 * @return
 */
function quantityExponent(val) {
  if (val === 0) {
    return 0;
  }
  var exp = Math.floor(Math.log(val) / Math.LN10);
  /**
   * exp is expected to be the rounded-down result of the base-10 log of val.
   * But due to the precision loss with Math.log(val), we need to restore it
   * using 10^exp to make sure we can get val back from exp. #11249
   */
  if (val / Math.pow(10, exp) >= 10) {
    exp++;
  }
  return exp;
}
/**
 * find a “nice” number approximately equal to x. Round the number if round = true,
 * take ceiling if round = false. The primary observation is that the “nicest”
 * numbers in decimal are 1, 2, and 5, and all power-of-ten multiples of these numbers.
 *
 * See "Nice Numbers for Graph Labels" of Graphic Gems.
 *
 * @param  val Non-negative value.
 * @param  round
 * @return Niced number
 */
function nice(val, round) {
  var exponent = quantityExponent(val);
  var exp10 = Math.pow(10, exponent);
  var f = val / exp10; // 1 <= f < 10
  var nf;
  if (round) {
    if (f < 1.5) {
      nf = 1;
    } else if (f < 2.5) {
      nf = 2;
    } else if (f < 4) {
      nf = 3;
    } else if (f < 7) {
      nf = 5;
    } else {
      nf = 10;
    }
  } else {
    if (f < 1) {
      nf = 1;
    } else if (f < 2) {
      nf = 2;
    } else if (f < 3) {
      nf = 3;
    } else if (f < 5) {
      nf = 5;
    } else {
      nf = 10;
    }
  }
  val = nf * exp10;
  // Fix 3 * 0.1 === 0.30000000000000004 issue (see IEEE 754).
  // 20 is the uppper bound of toFixed.
  return exponent >= -20 ? +val.toFixed(exponent < 0 ? -exponent : 0) : val;
}
/**
 * This code was copied from "d3.js"
 * <https://github.com/d3/d3/blob/9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74/src/arrays/quantile.js>.
 * See the license statement at the head of this file.
 * @param ascArr
 */
function quantile(ascArr, p) {
  var H = (ascArr.length - 1) * p + 1;
  var h = Math.floor(H);
  var v = +ascArr[h - 1];
  var e = H - h;
  return e ? v + e * (ascArr[h] - v) : v;
}
/**
 * Order intervals asc, and split them when overlap.
 * expect(numberUtil.reformIntervals([
 *     {interval: [18, 62], close: [1, 1]},
 *     {interval: [-Infinity, -70], close: [0, 0]},
 *     {interval: [-70, -26], close: [1, 1]},
 *     {interval: [-26, 18], close: [1, 1]},
 *     {interval: [62, 150], close: [1, 1]},
 *     {interval: [106, 150], close: [1, 1]},
 *     {interval: [150, Infinity], close: [0, 0]}
 * ])).toEqual([
 *     {interval: [-Infinity, -70], close: [0, 0]},
 *     {interval: [-70, -26], close: [1, 1]},
 *     {interval: [-26, 18], close: [0, 1]},
 *     {interval: [18, 62], close: [0, 1]},
 *     {interval: [62, 150], close: [0, 1]},
 *     {interval: [150, Infinity], close: [0, 0]}
 * ]);
 * @param list, where `close` mean open or close
 *        of the interval, and Infinity can be used.
 * @return The origin list, which has been reformed.
 */
function reformIntervals(list) {
  list.sort(function (a, b) {
    return littleThan(a, b, 0) ? -1 : 1;
  });
  var curr = -Infinity;
  var currClose = 1;
  for (var i = 0; i < list.length;) {
    var interval = list[i].interval;
    var close_1 = list[i].close;
    for (var lg = 0; lg < 2; lg++) {
      if (interval[lg] <= curr) {
        interval[lg] = curr;
        close_1[lg] = !lg ? 1 - currClose : 1;
      }
      curr = interval[lg];
      currClose = close_1[lg];
    }
    if (interval[0] === interval[1] && close_1[0] * close_1[1] !== 1) {
      list.splice(i, 1);
    } else {
      i++;
    }
  }
  return list;
  function littleThan(a, b, lg) {
    return a.interval[lg] < b.interval[lg] || a.interval[lg] === b.interval[lg] && (a.close[lg] - b.close[lg] === (!lg ? 1 : -1) || !lg && littleThan(a, b, 1));
  }
}
/**
 * [Numeric is defined as]:
 *     `parseFloat(val) == val`
 * For example:
 * numeric:
 *     typeof number except NaN, '-123', '123', '2e3', '-2e3', '011', 'Infinity', Infinity,
 *     and they rounded by white-spaces or line-terminal like ' -123 \n ' (see es spec)
 * not-numeric:
 *     null, undefined, [], {}, true, false, 'NaN', NaN, '123ab',
 *     empty string, string with only white-spaces or line-terminal (see es spec),
 *     0x12, '0x12', '-0x12', 012, '012', '-012',
 *     non-string, ...
 *
 * @test See full test cases in `test/ut/spec/util/number.js`.
 * @return Must be a typeof number. If not numeric, return NaN.
 */
function numericToNumber(val) {
  var valFloat = parseFloat(val);
  return valFloat == val // eslint-disable-line eqeqeq
  && (valFloat !== 0 || !isString(val) || val.indexOf('x') <= 0) // For case ' 0x0 '.
  ? valFloat : NaN;
}
/**
 * Definition of "numeric": see `numericToNumber`.
 */
function isNumeric(val) {
  return !isNaN(numericToNumber(val));
}
/**
 * Use random base to prevent users hard code depending on
 * this auto generated marker id.
 * @return An positive integer.
 */
function getRandomIdBase() {
  return Math.round(Math.random() * 9);
}
/**
 * Get the greatest common divisor.
 *
 * @param {number} a one number
 * @param {number} b the other number
 */
function getGreatestCommonDividor(a, b) {
  if (b === 0) {
    return a;
  }
  return getGreatestCommonDividor(b, a % b);
}
/**
 * Get the least common multiple.
 *
 * @param {number} a one number
 * @param {number} b the other number
 */
function getLeastCommonMultiple(a, b) {
  if (a == null) {
    return b;
  }
  if (b == null) {
    return a;
  }
  return a * b / getGreatestCommonDividor(a, b);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ECHARTS_PREFIX = '[ECharts] ';
var storedLogs = {};
var hasConsole = typeof console !== 'undefined'
// eslint-disable-next-line
&& console.warn && console.log;
function outputLog(type, str, onlyOnce) {
  if (hasConsole) {
    if (onlyOnce) {
      if (storedLogs[str]) {
        return;
      }
      storedLogs[str] = true;
    }
    // eslint-disable-next-line
    console[type](ECHARTS_PREFIX + str);
  }
}
function log$1(str, onlyOnce) {
  outputLog('log', str, onlyOnce);
}
function warn(str, onlyOnce) {
  outputLog('warn', str, onlyOnce);
}
function error(str, onlyOnce) {
  outputLog('error', str, onlyOnce);
}
function deprecateLog(str) {
  {
    // Not display duplicate message.
    outputLog('warn', 'DEPRECATED: ' + str, true);
  }
}
function deprecateReplaceLog(oldOpt, newOpt, scope) {
  {
    deprecateLog((scope ? "[" + scope + "]" : '') + (oldOpt + " is deprecated, use " + newOpt + " instead."));
  }
}
/**
 * If in __DEV__ environment, get console printable message for users hint.
 * Parameters are separated by ' '.
 * @usage
 * makePrintable('This is an error on', someVar, someObj);
 *
 * @param hintInfo anything about the current execution context to hint users.
 * @throws Error
 */
function makePrintable() {
  var hintInfo = [];
  for (var _i = 0; _i < arguments.length; _i++) {
    hintInfo[_i] = arguments[_i];
  }
  var msg = '';
  {
    // Fuzzy stringify for print.
    // This code only exist in dev environment.
    var makePrintableStringIfPossible_1 = function (val) {
      return val === void 0 ? 'undefined' : val === Infinity ? 'Infinity' : val === -Infinity ? '-Infinity' : eqNaN(val) ? 'NaN' : val instanceof Date ? 'Date(' + val.toISOString() + ')' : isFunction(val) ? 'function () { ... }' : isRegExp(val) ? val + '' : null;
    };
    msg = map$1(hintInfo, function (arg) {
      if (isString(arg)) {
        // Print without quotation mark for some statement.
        return arg;
      } else {
        var printableStr = makePrintableStringIfPossible_1(arg);
        if (printableStr != null) {
          return printableStr;
        } else if (typeof JSON !== 'undefined' && JSON.stringify) {
          try {
            return JSON.stringify(arg, function (n, val) {
              var printableStr = makePrintableStringIfPossible_1(val);
              return printableStr == null ? val : printableStr;
            });
            // In most cases the info object is small, so do not line break.
          } catch (err) {
            return '?';
          }
        } else {
          return '?';
        }
      }
    }).join(' ');
  }
  return msg;
}
/**
 * @throws Error
 */
function throwError(msg) {
  throw new Error(msg);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function interpolateNumber(p0, p1, percent) {
  return (p1 - p0) * percent + p0;
}
/**
 * Make the name displayable. But we should
 * make sure it is not duplicated with user
 * specified name, so use '\0';
 */
var DUMMY_COMPONENT_NAME_PREFIX = 'series\0';
var INTERNAL_COMPONENT_ID_PREFIX = '\0_ec_\0';
/**
 * If value is not array, then translate it to array.
 * @param  {*} value
 * @return {Array} [value] or value
 */
function normalizeToArray(value) {
  return value instanceof Array ? value : value == null ? [] : [value];
}
/**
 * Sync default option between normal and emphasis like `position` and `show`
 * In case some one will write code like
 *     label: {
 *          show: false,
 *          position: 'outside',
 *          fontSize: 18
 *     },
 *     emphasis: {
 *          label: { show: true }
 *     }
 */
function defaultEmphasis(opt, key, subOpts) {
  // Caution: performance sensitive.
  if (opt) {
    opt[key] = opt[key] || {};
    opt.emphasis = opt.emphasis || {};
    opt.emphasis[key] = opt.emphasis[key] || {};
    // Default emphasis option from normal
    for (var i = 0, len = subOpts.length; i < len; i++) {
      var subOptName = subOpts[i];
      if (!opt.emphasis[key].hasOwnProperty(subOptName) && opt[key].hasOwnProperty(subOptName)) {
        opt.emphasis[key][subOptName] = opt[key][subOptName];
      }
    }
  }
}
var TEXT_STYLE_OPTIONS = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'rich', 'tag', 'color', 'textBorderColor', 'textBorderWidth', 'width', 'height', 'lineHeight', 'align', 'verticalAlign', 'baseline', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY', 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY', 'backgroundColor', 'borderColor', 'borderWidth', 'borderRadius', 'padding'];
// modelUtil.LABEL_OPTIONS = modelUtil.TEXT_STYLE_OPTIONS.concat([
//     'position', 'offset', 'rotate', 'origin', 'show', 'distance', 'formatter',
//     'fontStyle', 'fontWeight', 'fontSize', 'fontFamily',
//     // FIXME: deprecated, check and remove it.
//     'textStyle'
// ]);
/**
 * The method does not ensure performance.
 * data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]
 * This helper method retrieves value from data.
 */
function getDataItemValue(dataItem) {
  return isObject$3(dataItem) && !isArray$1(dataItem) && !(dataItem instanceof Date) ? dataItem.value : dataItem;
}
/**
 * data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]
 * This helper method determine if dataItem has extra option besides value
 */
function isDataItemOption(dataItem) {
  return isObject$3(dataItem) && !(dataItem instanceof Array);
  // // markLine data can be array
  // && !(dataItem[0] && isObject(dataItem[0]) && !(dataItem[0] instanceof Array));
}
/**
 * Mapping to existings for merge.
 *
 * Mode "normalMege":
 *     The mapping result (merge result) will keep the order of the existing
 *     component, rather than the order of new option. Because we should ensure
 *     some specified index reference (like xAxisIndex) keep work.
 *     And in most cases, "merge option" is used to update partial option but not
 *     be expected to change the order.
 *
 * Mode "replaceMege":
 *     (1) Only the id mapped components will be merged.
 *     (2) Other existing components (except internal components) will be removed.
 *     (3) Other new options will be used to create new component.
 *     (4) The index of the existing components will not be modified.
 *     That means their might be "hole" after the removal.
 *     The new components are created first at those available index.
 *
 * Mode "replaceAll":
 *     This mode try to support that reproduce an echarts instance from another
 *     echarts instance (via `getOption`) in some simple cases.
 *     In this scenario, the `result` index are exactly the consistent with the `newCmptOptions`,
 *     which ensures the component index referring (like `xAxisIndex: ?`) corrent. That is,
 *     the "hole" in `newCmptOptions` will also be kept.
 *     On the contrary, other modes try best to eliminate holes.
 *     PENDING: This is an experimental mode yet.
 *
 * @return See the comment of <MappingResult>.
 */
function mappingToExists(existings, newCmptOptions, mode) {
  var isNormalMergeMode = mode === 'normalMerge';
  var isReplaceMergeMode = mode === 'replaceMerge';
  var isReplaceAllMode = mode === 'replaceAll';
  existings = existings || [];
  newCmptOptions = (newCmptOptions || []).slice();
  var existingIdIdxMap = createHashMap();
  // Validate id and name on user input option.
  each$f(newCmptOptions, function (cmptOption, index) {
    if (!isObject$3(cmptOption)) {
      newCmptOptions[index] = null;
      return;
    }
    {
      // There is some legacy case that name is set as `false`.
      // But should work normally rather than throw error.
      if (cmptOption.id != null && !isValidIdOrName(cmptOption.id)) {
        warnInvalidateIdOrName(cmptOption.id);
      }
      if (cmptOption.name != null && !isValidIdOrName(cmptOption.name)) {
        warnInvalidateIdOrName(cmptOption.name);
      }
    }
  });
  var result = prepareResult(existings, existingIdIdxMap, mode);
  if (isNormalMergeMode || isReplaceMergeMode) {
    mappingById(result, existings, existingIdIdxMap, newCmptOptions);
  }
  if (isNormalMergeMode) {
    mappingByName(result, newCmptOptions);
  }
  if (isNormalMergeMode || isReplaceMergeMode) {
    mappingByIndex(result, newCmptOptions, isReplaceMergeMode);
  } else if (isReplaceAllMode) {
    mappingInReplaceAllMode(result, newCmptOptions);
  }
  makeIdAndName(result);
  // The array `result` MUST NOT contain elided items, otherwise the
  // forEach will omit those items and result in incorrect result.
  return result;
}
function prepareResult(existings, existingIdIdxMap, mode) {
  var result = [];
  if (mode === 'replaceAll') {
    return result;
  }
  // Do not use native `map` to in case that the array `existings`
  // contains elided items, which will be omitted.
  for (var index = 0; index < existings.length; index++) {
    var existing = existings[index];
    // Because of replaceMerge, `existing` may be null/undefined.
    if (existing && existing.id != null) {
      existingIdIdxMap.set(existing.id, index);
    }
    // For non-internal-componnets:
    //     Mode "normalMerge": all existings kept.
    //     Mode "replaceMerge": all existing removed unless mapped by id.
    // For internal-components:
    //     go with "replaceMerge" approach in both mode.
    result.push({
      existing: mode === 'replaceMerge' || isComponentIdInternal(existing) ? null : existing,
      newOption: null,
      keyInfo: null,
      brandNew: null
    });
  }
  return result;
}
function mappingById(result, existings, existingIdIdxMap, newCmptOptions) {
  // Mapping by id if specified.
  each$f(newCmptOptions, function (cmptOption, index) {
    if (!cmptOption || cmptOption.id == null) {
      return;
    }
    var optionId = makeComparableKey(cmptOption.id);
    var existingIdx = existingIdIdxMap.get(optionId);
    if (existingIdx != null) {
      var resultItem = result[existingIdx];
      assert(!resultItem.newOption, 'Duplicated option on id "' + optionId + '".');
      resultItem.newOption = cmptOption;
      // In both mode, if id matched, new option will be merged to
      // the existings rather than creating new component model.
      resultItem.existing = existings[existingIdx];
      newCmptOptions[index] = null;
    }
  });
}
function mappingByName(result, newCmptOptions) {
  // Mapping by name if specified.
  each$f(newCmptOptions, function (cmptOption, index) {
    if (!cmptOption || cmptOption.name == null) {
      return;
    }
    for (var i = 0; i < result.length; i++) {
      var existing = result[i].existing;
      if (!result[i].newOption // Consider name: two map to one.
      // Can not match when both ids existing but different.
      && existing && (existing.id == null || cmptOption.id == null) && !isComponentIdInternal(cmptOption) && !isComponentIdInternal(existing) && keyExistAndEqual('name', existing, cmptOption)) {
        result[i].newOption = cmptOption;
        newCmptOptions[index] = null;
        return;
      }
    }
  });
}
function mappingByIndex(result, newCmptOptions, brandNew) {
  each$f(newCmptOptions, function (cmptOption) {
    if (!cmptOption) {
      return;
    }
    // Find the first place that not mapped by id and not internal component (consider the "hole").
    var resultItem;
    var nextIdx = 0;
    while (
    // Be `!resultItem` only when `nextIdx >= result.length`.
    (resultItem = result[nextIdx]
    // (1) Existing models that already have id should be able to mapped to. Because
    // after mapping performed, model will always be assigned with an id if user not given.
    // After that all models have id.
    // (2) If new option has id, it can only set to a hole or append to the last. It should
    // not be merged to the existings with different id. Because id should not be overwritten.
    // (3) Name can be overwritten, because axis use name as 'show label text'.
    ) && (resultItem.newOption || isComponentIdInternal(resultItem.existing) ||
    // In mode "replaceMerge", here no not-mapped-non-internal-existing.
    resultItem.existing && cmptOption.id != null && !keyExistAndEqual('id', cmptOption, resultItem.existing))) {
      nextIdx++;
    }
    if (resultItem) {
      resultItem.newOption = cmptOption;
      resultItem.brandNew = brandNew;
    } else {
      result.push({
        newOption: cmptOption,
        brandNew: brandNew,
        existing: null,
        keyInfo: null
      });
    }
    nextIdx++;
  });
}
function mappingInReplaceAllMode(result, newCmptOptions) {
  each$f(newCmptOptions, function (cmptOption) {
    // The feature "reproduce" requires "hole" will also reproduced
    // in case that component index referring are broken.
    result.push({
      newOption: cmptOption,
      brandNew: true,
      existing: null,
      keyInfo: null
    });
  });
}
/**
 * Make id and name for mapping result (result of mappingToExists)
 * into `keyInfo` field.
 */
function makeIdAndName(mapResult) {
  // We use this id to hash component models and view instances
  // in echarts. id can be specified by user, or auto generated.
  // The id generation rule ensures new view instance are able
  // to mapped to old instance when setOption are called in
  // no-merge mode. So we generate model id by name and plus
  // type in view id.
  // name can be duplicated among components, which is convenient
  // to specify multi components (like series) by one name.
  // Ensure that each id is distinct.
  var idMap = createHashMap();
  each$f(mapResult, function (item) {
    var existing = item.existing;
    existing && idMap.set(existing.id, item);
  });
  each$f(mapResult, function (item) {
    var opt = item.newOption;
    // Force ensure id not duplicated.
    assert(!opt || opt.id == null || !idMap.get(opt.id) || idMap.get(opt.id) === item, 'id duplicates: ' + (opt && opt.id));
    opt && opt.id != null && idMap.set(opt.id, item);
    !item.keyInfo && (item.keyInfo = {});
  });
  // Make name and id.
  each$f(mapResult, function (item, index) {
    var existing = item.existing;
    var opt = item.newOption;
    var keyInfo = item.keyInfo;
    if (!isObject$3(opt)) {
      return;
    }
    // Name can be overwritten. Consider case: axis.name = '20km'.
    // But id generated by name will not be changed, which affect
    // only in that case: setOption with 'not merge mode' and view
    // instance will be recreated, which can be accepted.
    keyInfo.name = opt.name != null ? makeComparableKey(opt.name) : existing ? existing.name
    // Avoid that different series has the same name,
    // because name may be used like in color pallet.
    : DUMMY_COMPONENT_NAME_PREFIX + index;
    if (existing) {
      keyInfo.id = makeComparableKey(existing.id);
    } else if (opt.id != null) {
      keyInfo.id = makeComparableKey(opt.id);
    } else {
      // Consider this situatoin:
      //  optionA: [{name: 'a'}, {name: 'a'}, {..}]
      //  optionB [{..}, {name: 'a'}, {name: 'a'}]
      // Series with the same name between optionA and optionB
      // should be mapped.
      var idNum = 0;
      do {
        keyInfo.id = '\0' + keyInfo.name + '\0' + idNum++;
      } while (idMap.get(keyInfo.id));
    }
    idMap.set(keyInfo.id, item);
  });
}
function keyExistAndEqual(attr, obj1, obj2) {
  var key1 = convertOptionIdName(obj1[attr], null);
  var key2 = convertOptionIdName(obj2[attr], null);
  // See `MappingExistingItem`. `id` and `name` trade string equals to number.
  return key1 != null && key2 != null && key1 === key2;
}
/**
 * @return return null if not exist.
 */
function makeComparableKey(val) {
  {
    if (val == null) {
      throw new Error();
    }
  }
  return convertOptionIdName(val, '');
}
function convertOptionIdName(idOrName, defaultValue) {
  if (idOrName == null) {
    return defaultValue;
  }
  return isString(idOrName) ? idOrName : isNumber(idOrName) || isStringSafe(idOrName) ? idOrName + '' : defaultValue;
}
function warnInvalidateIdOrName(idOrName) {
  {
    warn('`' + idOrName + '` is invalid id or name. Must be a string or number.');
  }
}
function isValidIdOrName(idOrName) {
  return isStringSafe(idOrName) || isNumeric(idOrName);
}
function isNameSpecified(componentModel) {
  var name = componentModel.name;
  // Is specified when `indexOf` get -1 or > 0.
  return !!(name && name.indexOf(DUMMY_COMPONENT_NAME_PREFIX));
}
/**
 * @public
 * @param {Object} cmptOption
 * @return {boolean}
 */
function isComponentIdInternal(cmptOption) {
  return cmptOption && cmptOption.id != null && makeComparableKey(cmptOption.id).indexOf(INTERNAL_COMPONENT_ID_PREFIX) === 0;
}
function makeInternalComponentId(idSuffix) {
  return INTERNAL_COMPONENT_ID_PREFIX + idSuffix;
}
function setComponentTypeToKeyInfo(mappingResult, mainType, componentModelCtor) {
  // Set mainType and complete subType.
  each$f(mappingResult, function (item) {
    var newOption = item.newOption;
    if (isObject$3(newOption)) {
      item.keyInfo.mainType = mainType;
      item.keyInfo.subType = determineSubType(mainType, newOption, item.existing, componentModelCtor);
    }
  });
}
function determineSubType(mainType, newCmptOption, existComponent, componentModelCtor) {
  var subType = newCmptOption.type ? newCmptOption.type : existComponent ? existComponent.subType
  // Use determineSubType only when there is no existComponent.
  : componentModelCtor.determineSubType(mainType, newCmptOption);
  // tooltip, markline, markpoint may always has no subType
  return subType;
}
/**
 * A helper for removing duplicate items between batchA and batchB,
 * and in themselves, and categorize by series.
 *
 * @param batchA Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...]
 * @param batchB Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...]
 * @return result: [resultBatchA, resultBatchB]
 */
function compressBatches(batchA, batchB) {
  var mapA = {};
  var mapB = {};
  makeMap(batchA || [], mapA);
  makeMap(batchB || [], mapB, mapA);
  return [mapToArray(mapA), mapToArray(mapB)];
  function makeMap(sourceBatch, map, otherMap) {
    for (var i = 0, len = sourceBatch.length; i < len; i++) {
      var seriesId = convertOptionIdName(sourceBatch[i].seriesId, null);
      if (seriesId == null) {
        return;
      }
      var dataIndices = normalizeToArray(sourceBatch[i].dataIndex);
      var otherDataIndices = otherMap && otherMap[seriesId];
      for (var j = 0, lenj = dataIndices.length; j < lenj; j++) {
        var dataIndex = dataIndices[j];
        if (otherDataIndices && otherDataIndices[dataIndex]) {
          otherDataIndices[dataIndex] = null;
        } else {
          (map[seriesId] || (map[seriesId] = {}))[dataIndex] = 1;
        }
      }
    }
  }
  function mapToArray(map, isData) {
    var result = [];
    for (var i in map) {
      if (map.hasOwnProperty(i) && map[i] != null) {
        if (isData) {
          result.push(+i);
        } else {
          var dataIndices = mapToArray(map[i], true);
          dataIndices.length && result.push({
            seriesId: i,
            dataIndex: dataIndices
          });
        }
      }
    }
    return result;
  }
}
/**
 * @param payload Contains dataIndex (means rawIndex) / dataIndexInside / name
 *                         each of which can be Array or primary type.
 * @return dataIndex If not found, return undefined/null.
 */
function queryDataIndex(data, payload) {
  if (payload.dataIndexInside != null) {
    return payload.dataIndexInside;
  } else if (payload.dataIndex != null) {
    return isArray$1(payload.dataIndex) ? map$1(payload.dataIndex, function (value) {
      return data.indexOfRawIndex(value);
    }) : data.indexOfRawIndex(payload.dataIndex);
  } else if (payload.name != null) {
    return isArray$1(payload.name) ? map$1(payload.name, function (value) {
      return data.indexOfName(value);
    }) : data.indexOfName(payload.name);
  }
}
/**
 * Enable property storage to any host object.
 * Notice: Serialization is not supported.
 *
 * For example:
 * let inner = zrUitl.makeInner();
 *
 * function some1(hostObj) {
 *      inner(hostObj).someProperty = 1212;
 *      ...
 * }
 * function some2() {
 *      let fields = inner(this);
 *      fields.someProperty1 = 1212;
 *      fields.someProperty2 = 'xx';
 *      ...
 * }
 *
 * @return {Function}
 */
function makeInner() {
  var key = '__ec_inner_' + innerUniqueIndex++;
  return function (hostObj) {
    return hostObj[key] || (hostObj[key] = {});
  };
}
var innerUniqueIndex = getRandomIdBase();
/**
 * The same behavior as `component.getReferringComponents`.
 */
function parseFinder$1(ecModel, finderInput, opt) {
  var _a = preParseFinder(finderInput, opt),
    mainTypeSpecified = _a.mainTypeSpecified,
    queryOptionMap = _a.queryOptionMap,
    others = _a.others;
  var result = others;
  var defaultMainType = opt ? opt.defaultMainType : null;
  if (!mainTypeSpecified && defaultMainType) {
    queryOptionMap.set(defaultMainType, {});
  }
  queryOptionMap.each(function (queryOption, mainType) {
    var queryResult = queryReferringComponents(ecModel, mainType, queryOption, {
      useDefault: defaultMainType === mainType,
      enableAll: opt && opt.enableAll != null ? opt.enableAll : true,
      enableNone: opt && opt.enableNone != null ? opt.enableNone : true
    });
    result[mainType + 'Models'] = queryResult.models;
    result[mainType + 'Model'] = queryResult.models[0];
  });
  return result;
}
function preParseFinder(finderInput, opt) {
  var finder;
  if (isString(finderInput)) {
    var obj = {};
    obj[finderInput + 'Index'] = 0;
    finder = obj;
  } else {
    finder = finderInput;
  }
  var queryOptionMap = createHashMap();
  var others = {};
  var mainTypeSpecified = false;
  each$f(finder, function (value, key) {
    // Exclude 'dataIndex' and other illgal keys.
    if (key === 'dataIndex' || key === 'dataIndexInside') {
      others[key] = value;
      return;
    }
    var parsedKey = key.match(/^(\w+)(Index|Id|Name)$/) || [];
    var mainType = parsedKey[1];
    var queryType = (parsedKey[2] || '').toLowerCase();
    if (!mainType || !queryType || opt && opt.includeMainTypes && indexOf(opt.includeMainTypes, mainType) < 0) {
      return;
    }
    mainTypeSpecified = mainTypeSpecified || !!mainType;
    var queryOption = queryOptionMap.get(mainType) || queryOptionMap.set(mainType, {});
    queryOption[queryType] = value;
  });
  return {
    mainTypeSpecified: mainTypeSpecified,
    queryOptionMap: queryOptionMap,
    others: others
  };
}
var SINGLE_REFERRING = {
  useDefault: true,
  enableAll: false,
  enableNone: false
};
var MULTIPLE_REFERRING = {
  useDefault: false,
  enableAll: true,
  enableNone: true
};
function queryReferringComponents(ecModel, mainType, userOption, opt) {
  opt = opt || SINGLE_REFERRING;
  var indexOption = userOption.index;
  var idOption = userOption.id;
  var nameOption = userOption.name;
  var result = {
    models: null,
    specified: indexOption != null || idOption != null || nameOption != null
  };
  if (!result.specified) {
    // Use the first as default if `useDefault`.
    var firstCmpt = void 0;
    result.models = opt.useDefault && (firstCmpt = ecModel.getComponent(mainType)) ? [firstCmpt] : [];
    return result;
  }
  if (indexOption === 'none' || indexOption === false) {
    assert(opt.enableNone, '`"none"` or `false` is not a valid value on index option.');
    result.models = [];
    return result;
  }
  // `queryComponents` will return all components if
  // both all of index/id/name are null/undefined.
  if (indexOption === 'all') {
    assert(opt.enableAll, '`"all"` is not a valid value on index option.');
    indexOption = idOption = nameOption = null;
  }
  result.models = ecModel.queryComponents({
    mainType: mainType,
    index: indexOption,
    id: idOption,
    name: nameOption
  });
  return result;
}
function setAttribute(dom, key, value) {
  dom.setAttribute ? dom.setAttribute(key, value) : dom[key] = value;
}
function getAttribute(dom, key) {
  return dom.getAttribute ? dom.getAttribute(key) : dom[key];
}
function getTooltipRenderMode(renderModeOption) {
  if (renderModeOption === 'auto') {
    // Using html when `document` exists, use richText otherwise
    return env$1.domSupported ? 'html' : 'richText';
  } else {
    return renderModeOption || 'html';
  }
}
/**
 * Group a list by key.
 */
function groupData(array, getKey // return key
) {
  var buckets = createHashMap();
  var keys = [];
  each$f(array, function (item) {
    var key = getKey(item);
    (buckets.get(key) || (keys.push(key), buckets.set(key, []))).push(item);
  });
  return {
    keys: keys,
    buckets: buckets
  };
}
/**
 * Interpolate raw values of a series with percent
 *
 * @param data         data
 * @param labelModel   label model of the text element
 * @param sourceValue  start value. May be null/undefined when init.
 * @param targetValue  end value
 * @param percent      0~1 percentage; 0 uses start value while 1 uses end value
 * @return             interpolated values
 *                     If `sourceValue` and `targetValue` are `number`, return `number`.
 *                     If `sourceValue` and `targetValue` are `string`, return `string`.
 *                     If `sourceValue` and `targetValue` are `(string | number)[]`, return `(string | number)[]`.
 *                     Other cases do not supported.
 */
function interpolateRawValues(data, precision, sourceValue, targetValue, percent) {
  var isAutoPrecision = precision == null || precision === 'auto';
  if (targetValue == null) {
    return targetValue;
  }
  if (isNumber(targetValue)) {
    var value = interpolateNumber(sourceValue || 0, targetValue, percent);
    return round$4(value, isAutoPrecision ? Math.max(getPrecision(sourceValue || 0), getPrecision(targetValue)) : precision);
  } else if (isString(targetValue)) {
    return percent < 1 ? sourceValue : targetValue;
  } else {
    var interpolated = [];
    var leftArr = sourceValue;
    var rightArr = targetValue;
    var length_1 = Math.max(leftArr ? leftArr.length : 0, rightArr.length);
    for (var i = 0; i < length_1; ++i) {
      var info = data.getDimensionInfo(i);
      // Don't interpolate ordinal dims
      if (info && info.type === 'ordinal') {
        // In init, there is no `sourceValue`, but should better not to get undefined result.
        interpolated[i] = (percent < 1 && leftArr ? leftArr : rightArr)[i];
      } else {
        var leftVal = leftArr && leftArr[i] ? leftArr[i] : 0;
        var rightVal = rightArr[i];
        var value = interpolateNumber(leftVal, rightVal, percent);
        interpolated[i] = round$4(value, isAutoPrecision ? Math.max(getPrecision(leftVal), getPrecision(rightVal)) : precision);
      }
    }
    return interpolated;
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TYPE_DELIMITER = '.';
var IS_CONTAINER = '___EC__COMPONENT__CONTAINER___';
var IS_EXTENDED_CLASS = '___EC__EXTENDED_CLASS___';
/**
 * Notice, parseClassType('') should returns {main: '', sub: ''}
 * @public
 */
function parseClassType(componentType) {
  var ret = {
    main: '',
    sub: ''
  };
  if (componentType) {
    var typeArr = componentType.split(TYPE_DELIMITER);
    ret.main = typeArr[0] || '';
    ret.sub = typeArr[1] || '';
  }
  return ret;
}
/**
 * @public
 */
function checkClassType(componentType) {
  assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(componentType), 'componentType "' + componentType + '" illegal');
}
function isExtendedClass(clz) {
  return !!(clz && clz[IS_EXTENDED_CLASS]);
}
/**
 * Implements `ExtendableConstructor` for `rootClz`.
 *
 * @usage
 * ```ts
 * class Xxx {}
 * type XxxConstructor = typeof Xxx & ExtendableConstructor
 * enableClassExtend(Xxx as XxxConstructor);
 * ```
 */
function enableClassExtend(rootClz, mandatoryMethods) {
  rootClz.$constructor = rootClz; // FIXME: not necessary?
  rootClz.extend = function (proto) {
    {
      each$f(mandatoryMethods, function (method) {
        if (!proto[method]) {
          console.warn('Method `' + method + '` should be implemented' + (proto.type ? ' in ' + proto.type : '') + '.');
        }
      });
    }
    var superClass = this;
    var ExtendedClass;
    if (isESClass(superClass)) {
      ExtendedClass = /** @class */function (_super) {
        __extends(class_1, _super);
        function class_1() {
          return _super.apply(this, arguments) || this;
        }
        return class_1;
      }(superClass);
    } else {
      // For backward compat, we both support ts class inheritance and this
      // "extend" approach.
      // The constructor should keep the same behavior as ts class inheritance:
      // If this constructor/$constructor is not declared, auto invoke the super
      // constructor.
      // If this constructor/$constructor is declared, it is responsible for
      // calling the super constructor.
      ExtendedClass = function () {
        (proto.$constructor || superClass).apply(this, arguments);
      };
      inherits(ExtendedClass, this);
    }
    extend(ExtendedClass.prototype, proto);
    ExtendedClass[IS_EXTENDED_CLASS] = true;
    ExtendedClass.extend = this.extend;
    ExtendedClass.superCall = superCall;
    ExtendedClass.superApply = superApply;
    ExtendedClass.superClass = superClass;
    return ExtendedClass;
  };
}
function isESClass(fn) {
  return isFunction(fn) && /^class\s/.test(Function.prototype.toString.call(fn));
}
/**
 * A work around to both support ts extend and this extend mechanism.
 * on sub-class.
 * @usage
 * ```ts
 * class Component { ... }
 * classUtil.enableClassExtend(Component);
 * classUtil.enableClassManagement(Component, {registerWhenExtend: true});
 *
 * class Series extends Component { ... }
 * // Without calling `markExtend`, `registerWhenExtend` will not work.
 * Component.markExtend(Series);
 * ```
 */
function mountExtend(SubClz, SupperClz) {
  SubClz.extend = SupperClz.extend;
}
// A random offset.
var classBase = Math.round(Math.random() * 10);
/**
 * Implements `CheckableConstructor` for `target`.
 * Can not use instanceof, consider different scope by
 * cross domain or es module import in ec extensions.
 * Mount a method "isInstance()" to Clz.
 *
 * @usage
 * ```ts
 * class Xxx {}
 * type XxxConstructor = typeof Xxx & CheckableConstructor;
 * enableClassCheck(Xxx as XxxConstructor)
 * ```
 */
function enableClassCheck(target) {
  var classAttr = ['__\0is_clz', classBase++].join('_');
  target.prototype[classAttr] = true;
  {
    assert(!target.isInstance, 'The method "is" can not be defined.');
  }
  target.isInstance = function (obj) {
    return !!(obj && obj[classAttr]);
  };
}
// superCall should have class info, which can not be fetched from 'this'.
// Consider this case:
// class A has method f,
// class B inherits class A, overrides method f, f call superApply('f'),
// class C inherits class B, does not override method f,
// then when method of class C is called, dead loop occurred.
function superCall(context, methodName) {
  var args = [];
  for (var _i = 2; _i < arguments.length; _i++) {
    args[_i - 2] = arguments[_i];
  }
  return this.superClass.prototype[methodName].apply(context, args);
}
function superApply(context, methodName, args) {
  return this.superClass.prototype[methodName].apply(context, args);
}
/**
 * Implements `ClassManager` for `target`
 *
 * @usage
 * ```ts
 * class Xxx {}
 * type XxxConstructor = typeof Xxx & ClassManager
 * enableClassManagement(Xxx as XxxConstructor);
 * ```
 */
function enableClassManagement(target) {
  /**
   * Component model classes
   * key: componentType,
   * value:
   *     componentClass, when componentType is 'a'
   *     or Object.<subKey, componentClass>, when componentType is 'a.b'
   */
  var storage = {};
  target.registerClass = function (clz) {
    // `type` should not be a "instance member".
    // If using TS class, should better declared as `static type = 'series.pie'`.
    // otherwise users have to mount `type` on prototype manually.
    // For backward compat and enable instance visit type via `this.type`,
    // we still support fetch `type` from prototype.
    var componentFullType = clz.type || clz.prototype.type;
    if (componentFullType) {
      checkClassType(componentFullType);
      // If only static type declared, we assign it to prototype mandatorily.
      clz.prototype.type = componentFullType;
      var componentTypeInfo = parseClassType(componentFullType);
      if (!componentTypeInfo.sub) {
        {
          if (storage[componentTypeInfo.main]) {
            console.warn(componentTypeInfo.main + ' exists.');
          }
        }
        storage[componentTypeInfo.main] = clz;
      } else if (componentTypeInfo.sub !== IS_CONTAINER) {
        var container = makeContainer(componentTypeInfo);
        container[componentTypeInfo.sub] = clz;
      }
    }
    return clz;
  };
  target.getClass = function (mainType, subType, throwWhenNotFound) {
    var clz = storage[mainType];
    if (clz && clz[IS_CONTAINER]) {
      clz = subType ? clz[subType] : null;
    }
    if (throwWhenNotFound && !clz) {
      throw new Error(!subType ? mainType + '.' + 'type should be specified.' : 'Component ' + mainType + '.' + (subType || '') + ' is used but not imported.');
    }
    return clz;
  };
  target.getClassesByMainType = function (componentType) {
    var componentTypeInfo = parseClassType(componentType);
    var result = [];
    var obj = storage[componentTypeInfo.main];
    if (obj && obj[IS_CONTAINER]) {
      each$f(obj, function (o, type) {
        type !== IS_CONTAINER && result.push(o);
      });
    } else {
      result.push(obj);
    }
    return result;
  };
  target.hasClass = function (componentType) {
    // Just consider componentType.main.
    var componentTypeInfo = parseClassType(componentType);
    return !!storage[componentTypeInfo.main];
  };
  /**
   * @return Like ['aa', 'bb'], but can not be ['aa.xx']
   */
  target.getAllClassMainTypes = function () {
    var types = [];
    each$f(storage, function (obj, type) {
      types.push(type);
    });
    return types;
  };
  /**
   * If a main type is container and has sub types
   */
  target.hasSubTypes = function (componentType) {
    var componentTypeInfo = parseClassType(componentType);
    var obj = storage[componentTypeInfo.main];
    return obj && obj[IS_CONTAINER];
  };
  function makeContainer(componentTypeInfo) {
    var container = storage[componentTypeInfo.main];
    if (!container || !container[IS_CONTAINER]) {
      container = storage[componentTypeInfo.main] = {};
      container[IS_CONTAINER] = true;
    }
    return container;
  }
}
// /**
//  * @param {string|Array.<string>} properties
//  */
// export function setReadOnly(obj, properties) {
// FIXME It seems broken in IE8 simulation of IE11
// if (!zrUtil.isArray(properties)) {
//     properties = properties != null ? [properties] : [];
// }
// zrUtil.each(properties, function (prop) {
//     let value = obj[prop];
//     Object.defineProperty
//         && Object.defineProperty(obj, prop, {
//             value: value, writable: false
//         });
//     zrUtil.isArray(obj[prop])
//         && Object.freeze
//         && Object.freeze(obj[prop]);
// });
// }

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function makeStyleMapper(properties, ignoreParent) {
  // Normalize
  for (var i = 0; i < properties.length; i++) {
    if (!properties[i][1]) {
      properties[i][1] = properties[i][0];
    }
  }
  ignoreParent = ignoreParent || false;
  return function (model, excludes, includes) {
    var style = {};
    for (var i = 0; i < properties.length; i++) {
      var propName = properties[i][1];
      if (excludes && indexOf(excludes, propName) >= 0 || includes && indexOf(includes, propName) < 0) {
        continue;
      }
      var val = model.getShallow(propName, ignoreParent);
      if (val != null) {
        style[properties[i][0]] = val;
      }
    }
    // TODO Text or image?
    return style;
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var AREA_STYLE_KEY_MAP = [['fill', 'color'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['opacity'], ['shadowColor']
// Option decal is in `DecalObject` but style.decal is in `PatternObject`.
// So do not transfer decal directly.
];
var getAreaStyle = makeStyleMapper(AREA_STYLE_KEY_MAP);
var AreaStyleMixin = /** @class */function () {
  function AreaStyleMixin() {}
  AreaStyleMixin.prototype.getAreaStyle = function (excludes, includes) {
    return getAreaStyle(this, excludes, includes);
  };
  return AreaStyleMixin;
}();

var globalImageCache = new LRU$1(50);
function findExistImage(newImageOrSrc) {
  if (typeof newImageOrSrc === 'string') {
    var cachedImgObj = globalImageCache.get(newImageOrSrc);
    return cachedImgObj && cachedImgObj.image;
  } else {
    return newImageOrSrc;
  }
}
function createOrUpdateImage(newImageOrSrc, image, hostEl, onload, cbPayload) {
  if (!newImageOrSrc) {
    return image;
  } else if (typeof newImageOrSrc === 'string') {
    if (image && image.__zrImageSrc === newImageOrSrc || !hostEl) {
      return image;
    }
    var cachedImgObj = globalImageCache.get(newImageOrSrc);
    var pendingWrap = {
      hostEl: hostEl,
      cb: onload,
      cbPayload: cbPayload
    };
    if (cachedImgObj) {
      image = cachedImgObj.image;
      !isImageReady(image) && cachedImgObj.pending.push(pendingWrap);
    } else {
      image = platformApi.loadImage(newImageOrSrc, imageOnLoad, imageOnLoad);
      image.__zrImageSrc = newImageOrSrc;
      globalImageCache.put(newImageOrSrc, image.__cachedImgObj = {
        image: image,
        pending: [pendingWrap]
      });
    }
    return image;
  } else {
    return newImageOrSrc;
  }
}
function imageOnLoad() {
  var cachedImgObj = this.__cachedImgObj;
  this.onload = this.onerror = this.__cachedImgObj = null;
  for (var i = 0; i < cachedImgObj.pending.length; i++) {
    var pendingWrap = cachedImgObj.pending[i];
    var cb = pendingWrap.cb;
    cb && cb(this, pendingWrap.cbPayload);
    pendingWrap.hostEl.dirty();
  }
  cachedImgObj.pending.length = 0;
}
function isImageReady(image) {
  return image && image.width && image.height;
}

var STYLE_REG = /\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;
function truncateText2(out, text, containerWidth, font, ellipsis, options) {
  if (!containerWidth) {
    out.text = '';
    out.isTruncated = false;
    return;
  }
  var textLines = (text + '').split('\n');
  options = prepareTruncateOptions(containerWidth, font, ellipsis, options);
  var isTruncated = false;
  var truncateOut = {};
  for (var i = 0, len = textLines.length; i < len; i++) {
    truncateSingleLine(truncateOut, textLines[i], options);
    textLines[i] = truncateOut.textLine;
    isTruncated = isTruncated || truncateOut.isTruncated;
  }
  out.text = textLines.join('\n');
  out.isTruncated = isTruncated;
}
function prepareTruncateOptions(containerWidth, font, ellipsis, options) {
  options = options || {};
  var preparedOpts = extend({}, options);
  preparedOpts.font = font;
  ellipsis = retrieve2(ellipsis, '...');
  preparedOpts.maxIterations = retrieve2(options.maxIterations, 2);
  var minChar = preparedOpts.minChar = retrieve2(options.minChar, 0);
  preparedOpts.cnCharWidth = getWidth('国', font);
  var ascCharWidth = preparedOpts.ascCharWidth = getWidth('a', font);
  preparedOpts.placeholder = retrieve2(options.placeholder, '');
  var contentWidth = containerWidth = Math.max(0, containerWidth - 1);
  for (var i = 0; i < minChar && contentWidth >= ascCharWidth; i++) {
    contentWidth -= ascCharWidth;
  }
  var ellipsisWidth = getWidth(ellipsis, font);
  if (ellipsisWidth > contentWidth) {
    ellipsis = '';
    ellipsisWidth = 0;
  }
  contentWidth = containerWidth - ellipsisWidth;
  preparedOpts.ellipsis = ellipsis;
  preparedOpts.ellipsisWidth = ellipsisWidth;
  preparedOpts.contentWidth = contentWidth;
  preparedOpts.containerWidth = containerWidth;
  return preparedOpts;
}
function truncateSingleLine(out, textLine, options) {
  var containerWidth = options.containerWidth;
  var font = options.font;
  var contentWidth = options.contentWidth;
  if (!containerWidth) {
    out.textLine = '';
    out.isTruncated = false;
    return;
  }
  var lineWidth = getWidth(textLine, font);
  if (lineWidth <= containerWidth) {
    out.textLine = textLine;
    out.isTruncated = false;
    return;
  }
  for (var j = 0;; j++) {
    if (lineWidth <= contentWidth || j >= options.maxIterations) {
      textLine += options.ellipsis;
      break;
    }
    var subLength = j === 0 ? estimateLength(textLine, contentWidth, options.ascCharWidth, options.cnCharWidth) : lineWidth > 0 ? Math.floor(textLine.length * contentWidth / lineWidth) : 0;
    textLine = textLine.substr(0, subLength);
    lineWidth = getWidth(textLine, font);
  }
  if (textLine === '') {
    textLine = options.placeholder;
  }
  out.textLine = textLine;
  out.isTruncated = true;
}
function estimateLength(text, contentWidth, ascCharWidth, cnCharWidth) {
  var width = 0;
  var i = 0;
  for (var len = text.length; i < len && width < contentWidth; i++) {
    var charCode = text.charCodeAt(i);
    width += 0 <= charCode && charCode <= 127 ? ascCharWidth : cnCharWidth;
  }
  return i;
}
function parsePlainText(text, style) {
  text != null && (text += '');
  var overflow = style.overflow;
  var padding = style.padding;
  var font = style.font;
  var truncate = overflow === 'truncate';
  var calculatedLineHeight = getLineHeight(font);
  var lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);
  var bgColorDrawn = !!style.backgroundColor;
  var truncateLineOverflow = style.lineOverflow === 'truncate';
  var isTruncated = false;
  var width = style.width;
  var lines;
  if (width != null && (overflow === 'break' || overflow === 'breakAll')) {
    lines = text ? wrapText(text, style.font, width, overflow === 'breakAll', 0).lines : [];
  } else {
    lines = text ? text.split('\n') : [];
  }
  var contentHeight = lines.length * lineHeight;
  var height = retrieve2(style.height, contentHeight);
  if (contentHeight > height && truncateLineOverflow) {
    var lineCount = Math.floor(height / lineHeight);
    isTruncated = isTruncated || lines.length > lineCount;
    lines = lines.slice(0, lineCount);
  }
  if (text && truncate && width != null) {
    var options = prepareTruncateOptions(width, font, style.ellipsis, {
      minChar: style.truncateMinChar,
      placeholder: style.placeholder
    });
    var singleOut = {};
    for (var i = 0; i < lines.length; i++) {
      truncateSingleLine(singleOut, lines[i], options);
      lines[i] = singleOut.textLine;
      isTruncated = isTruncated || singleOut.isTruncated;
    }
  }
  var outerHeight = height;
  var contentWidth = 0;
  for (var i = 0; i < lines.length; i++) {
    contentWidth = Math.max(getWidth(lines[i], font), contentWidth);
  }
  if (width == null) {
    width = contentWidth;
  }
  var outerWidth = contentWidth;
  if (padding) {
    outerHeight += padding[0] + padding[2];
    outerWidth += padding[1] + padding[3];
    width += padding[1] + padding[3];
  }
  if (bgColorDrawn) {
    outerWidth = width;
  }
  return {
    lines: lines,
    height: height,
    outerWidth: outerWidth,
    outerHeight: outerHeight,
    lineHeight: lineHeight,
    calculatedLineHeight: calculatedLineHeight,
    contentWidth: contentWidth,
    contentHeight: contentHeight,
    width: width,
    isTruncated: isTruncated
  };
}
var RichTextToken = function () {
  function RichTextToken() {}
  return RichTextToken;
}();
var RichTextLine = function () {
  function RichTextLine(tokens) {
    this.tokens = [];
    if (tokens) {
      this.tokens = tokens;
    }
  }
  return RichTextLine;
}();
var RichTextContentBlock = function () {
  function RichTextContentBlock() {
    this.width = 0;
    this.height = 0;
    this.contentWidth = 0;
    this.contentHeight = 0;
    this.outerWidth = 0;
    this.outerHeight = 0;
    this.lines = [];
    this.isTruncated = false;
  }
  return RichTextContentBlock;
}();
function parseRichText(text, style) {
  var contentBlock = new RichTextContentBlock();
  text != null && (text += '');
  if (!text) {
    return contentBlock;
  }
  var topWidth = style.width;
  var topHeight = style.height;
  var overflow = style.overflow;
  var wrapInfo = (overflow === 'break' || overflow === 'breakAll') && topWidth != null ? {
    width: topWidth,
    accumWidth: 0,
    breakAll: overflow === 'breakAll'
  } : null;
  var lastIndex = STYLE_REG.lastIndex = 0;
  var result;
  while ((result = STYLE_REG.exec(text)) != null) {
    var matchedIndex = result.index;
    if (matchedIndex > lastIndex) {
      pushTokens(contentBlock, text.substring(lastIndex, matchedIndex), style, wrapInfo);
    }
    pushTokens(contentBlock, result[2], style, wrapInfo, result[1]);
    lastIndex = STYLE_REG.lastIndex;
  }
  if (lastIndex < text.length) {
    pushTokens(contentBlock, text.substring(lastIndex, text.length), style, wrapInfo);
  }
  var pendingList = [];
  var calculatedHeight = 0;
  var calculatedWidth = 0;
  var stlPadding = style.padding;
  var truncate = overflow === 'truncate';
  var truncateLine = style.lineOverflow === 'truncate';
  var tmpTruncateOut = {};
  function finishLine(line, lineWidth, lineHeight) {
    line.width = lineWidth;
    line.lineHeight = lineHeight;
    calculatedHeight += lineHeight;
    calculatedWidth = Math.max(calculatedWidth, lineWidth);
  }
  outer: for (var i = 0; i < contentBlock.lines.length; i++) {
    var line = contentBlock.lines[i];
    var lineHeight = 0;
    var lineWidth = 0;
    for (var j = 0; j < line.tokens.length; j++) {
      var token = line.tokens[j];
      var tokenStyle = token.styleName && style.rich[token.styleName] || {};
      var textPadding = token.textPadding = tokenStyle.padding;
      var paddingH = textPadding ? textPadding[1] + textPadding[3] : 0;
      var font = token.font = tokenStyle.font || style.font;
      token.contentHeight = getLineHeight(font);
      var tokenHeight = retrieve2(tokenStyle.height, token.contentHeight);
      token.innerHeight = tokenHeight;
      textPadding && (tokenHeight += textPadding[0] + textPadding[2]);
      token.height = tokenHeight;
      token.lineHeight = retrieve3(tokenStyle.lineHeight, style.lineHeight, tokenHeight);
      token.align = tokenStyle && tokenStyle.align || style.align;
      token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || 'middle';
      if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {
        var originalLength = contentBlock.lines.length;
        if (j > 0) {
          line.tokens = line.tokens.slice(0, j);
          finishLine(line, lineWidth, lineHeight);
          contentBlock.lines = contentBlock.lines.slice(0, i + 1);
        } else {
          contentBlock.lines = contentBlock.lines.slice(0, i);
        }
        contentBlock.isTruncated = contentBlock.isTruncated || contentBlock.lines.length < originalLength;
        break outer;
      }
      var styleTokenWidth = tokenStyle.width;
      var tokenWidthNotSpecified = styleTokenWidth == null || styleTokenWidth === 'auto';
      if (typeof styleTokenWidth === 'string' && styleTokenWidth.charAt(styleTokenWidth.length - 1) === '%') {
        token.percentWidth = styleTokenWidth;
        pendingList.push(token);
        token.contentWidth = getWidth(token.text, font);
      } else {
        if (tokenWidthNotSpecified) {
          var textBackgroundColor = tokenStyle.backgroundColor;
          var bgImg = textBackgroundColor && textBackgroundColor.image;
          if (bgImg) {
            bgImg = findExistImage(bgImg);
            if (isImageReady(bgImg)) {
              token.width = Math.max(token.width, bgImg.width * tokenHeight / bgImg.height);
            }
          }
        }
        var remainTruncWidth = truncate && topWidth != null ? topWidth - lineWidth : null;
        if (remainTruncWidth != null && remainTruncWidth < token.width) {
          if (!tokenWidthNotSpecified || remainTruncWidth < paddingH) {
            token.text = '';
            token.width = token.contentWidth = 0;
          } else {
            truncateText2(tmpTruncateOut, token.text, remainTruncWidth - paddingH, font, style.ellipsis, {
              minChar: style.truncateMinChar
            });
            token.text = tmpTruncateOut.text;
            contentBlock.isTruncated = contentBlock.isTruncated || tmpTruncateOut.isTruncated;
            token.width = token.contentWidth = getWidth(token.text, font);
          }
        } else {
          token.contentWidth = getWidth(token.text, font);
        }
      }
      token.width += paddingH;
      lineWidth += token.width;
      tokenStyle && (lineHeight = Math.max(lineHeight, token.lineHeight));
    }
    finishLine(line, lineWidth, lineHeight);
  }
  contentBlock.outerWidth = contentBlock.width = retrieve2(topWidth, calculatedWidth);
  contentBlock.outerHeight = contentBlock.height = retrieve2(topHeight, calculatedHeight);
  contentBlock.contentHeight = calculatedHeight;
  contentBlock.contentWidth = calculatedWidth;
  if (stlPadding) {
    contentBlock.outerWidth += stlPadding[1] + stlPadding[3];
    contentBlock.outerHeight += stlPadding[0] + stlPadding[2];
  }
  for (var i = 0; i < pendingList.length; i++) {
    var token = pendingList[i];
    var percentWidth = token.percentWidth;
    token.width = parseInt(percentWidth, 10) / 100 * contentBlock.width;
  }
  return contentBlock;
}
function pushTokens(block, str, style, wrapInfo, styleName) {
  var isEmptyStr = str === '';
  var tokenStyle = styleName && style.rich[styleName] || {};
  var lines = block.lines;
  var font = tokenStyle.font || style.font;
  var newLine = false;
  var strLines;
  var linesWidths;
  if (wrapInfo) {
    var tokenPadding = tokenStyle.padding;
    var tokenPaddingH = tokenPadding ? tokenPadding[1] + tokenPadding[3] : 0;
    if (tokenStyle.width != null && tokenStyle.width !== 'auto') {
      var outerWidth_1 = parsePercent$1(tokenStyle.width, wrapInfo.width) + tokenPaddingH;
      if (lines.length > 0) {
        if (outerWidth_1 + wrapInfo.accumWidth > wrapInfo.width) {
          strLines = str.split('\n');
          newLine = true;
        }
      }
      wrapInfo.accumWidth = outerWidth_1;
    } else {
      var res = wrapText(str, font, wrapInfo.width, wrapInfo.breakAll, wrapInfo.accumWidth);
      wrapInfo.accumWidth = res.accumWidth + tokenPaddingH;
      linesWidths = res.linesWidths;
      strLines = res.lines;
    }
  } else {
    strLines = str.split('\n');
  }
  for (var i = 0; i < strLines.length; i++) {
    var text = strLines[i];
    var token = new RichTextToken();
    token.styleName = styleName;
    token.text = text;
    token.isLineHolder = !text && !isEmptyStr;
    if (typeof tokenStyle.width === 'number') {
      token.width = tokenStyle.width;
    } else {
      token.width = linesWidths ? linesWidths[i] : getWidth(text, font);
    }
    if (!i && !newLine) {
      var tokens = (lines[lines.length - 1] || (lines[0] = new RichTextLine())).tokens;
      var tokensLen = tokens.length;
      tokensLen === 1 && tokens[0].isLineHolder ? tokens[0] = token : (text || !tokensLen || isEmptyStr) && tokens.push(token);
    } else {
      lines.push(new RichTextLine([token]));
    }
  }
}
function isAlphabeticLetter(ch) {
  var code = ch.charCodeAt(0);
  return code >= 0x20 && code <= 0x24F || code >= 0x370 && code <= 0x10FF || code >= 0x1200 && code <= 0x13FF || code >= 0x1E00 && code <= 0x206F;
}
var breakCharMap = reduce(',&?/;] '.split(''), function (obj, ch) {
  obj[ch] = true;
  return obj;
}, {});
function isWordBreakChar(ch) {
  if (isAlphabeticLetter(ch)) {
    if (breakCharMap[ch]) {
      return true;
    }
    return false;
  }
  return true;
}
function wrapText(text, font, lineWidth, isBreakAll, lastAccumWidth) {
  var lines = [];
  var linesWidths = [];
  var line = '';
  var currentWord = '';
  var currentWordWidth = 0;
  var accumWidth = 0;
  for (var i = 0; i < text.length; i++) {
    var ch = text.charAt(i);
    if (ch === '\n') {
      if (currentWord) {
        line += currentWord;
        accumWidth += currentWordWidth;
      }
      lines.push(line);
      linesWidths.push(accumWidth);
      line = '';
      currentWord = '';
      currentWordWidth = 0;
      accumWidth = 0;
      continue;
    }
    var chWidth = getWidth(ch, font);
    var inWord = isBreakAll ? false : !isWordBreakChar(ch);
    if (!lines.length ? lastAccumWidth + accumWidth + chWidth > lineWidth : accumWidth + chWidth > lineWidth) {
      if (!accumWidth) {
        if (inWord) {
          lines.push(currentWord);
          linesWidths.push(currentWordWidth);
          currentWord = ch;
          currentWordWidth = chWidth;
        } else {
          lines.push(ch);
          linesWidths.push(chWidth);
        }
      } else if (line || currentWord) {
        if (inWord) {
          if (!line) {
            line = currentWord;
            currentWord = '';
            currentWordWidth = 0;
            accumWidth = currentWordWidth;
          }
          lines.push(line);
          linesWidths.push(accumWidth - currentWordWidth);
          currentWord += ch;
          currentWordWidth += chWidth;
          line = '';
          accumWidth = currentWordWidth;
        } else {
          if (currentWord) {
            line += currentWord;
            currentWord = '';
            currentWordWidth = 0;
          }
          lines.push(line);
          linesWidths.push(accumWidth);
          line = ch;
          accumWidth = chWidth;
        }
      }
      continue;
    }
    accumWidth += chWidth;
    if (inWord) {
      currentWord += ch;
      currentWordWidth += chWidth;
    } else {
      if (currentWord) {
        line += currentWord;
        currentWord = '';
        currentWordWidth = 0;
      }
      line += ch;
    }
  }
  if (!lines.length && !line) {
    line = text;
    currentWord = '';
    currentWordWidth = 0;
  }
  if (currentWord) {
    line += currentWord;
  }
  if (line) {
    lines.push(line);
    linesWidths.push(accumWidth);
  }
  if (lines.length === 1) {
    accumWidth += lastAccumWidth;
  }
  return {
    accumWidth: accumWidth,
    lines: lines,
    linesWidths: linesWidths
  };
}

var STYLE_MAGIC_KEY = '__zr_style_' + Math.round(Math.random() * 10);
var DEFAULT_COMMON_STYLE = {
  shadowBlur: 0,
  shadowOffsetX: 0,
  shadowOffsetY: 0,
  shadowColor: '#000',
  opacity: 1,
  blend: 'source-over'
};
var DEFAULT_COMMON_ANIMATION_PROPS = {
  style: {
    shadowBlur: true,
    shadowOffsetX: true,
    shadowOffsetY: true,
    shadowColor: true,
    opacity: true
  }
};
DEFAULT_COMMON_STYLE[STYLE_MAGIC_KEY] = true;
var PRIMARY_STATES_KEYS = ['z', 'z2', 'invisible'];
var PRIMARY_STATES_KEYS_IN_HOVER_LAYER = ['invisible'];
var Displayable = function (_super) {
  __extends(Displayable, _super);
  function Displayable(props) {
    return _super.call(this, props) || this;
  }
  Displayable.prototype._init = function (props) {
    var keysArr = keys(props);
    for (var i = 0; i < keysArr.length; i++) {
      var key = keysArr[i];
      if (key === 'style') {
        this.useStyle(props[key]);
      } else {
        _super.prototype.attrKV.call(this, key, props[key]);
      }
    }
    if (!this.style) {
      this.useStyle({});
    }
  };
  Displayable.prototype.beforeBrush = function () {};
  Displayable.prototype.afterBrush = function () {};
  Displayable.prototype.innerBeforeBrush = function () {};
  Displayable.prototype.innerAfterBrush = function () {};
  Displayable.prototype.shouldBePainted = function (viewWidth, viewHeight, considerClipPath, considerAncestors) {
    var m = this.transform;
    if (this.ignore || this.invisible || this.style.opacity === 0 || this.culling && isDisplayableCulled(this, viewWidth, viewHeight) || m && !m[0] && !m[3]) {
      return false;
    }
    if (considerClipPath && this.__clipPaths) {
      for (var i = 0; i < this.__clipPaths.length; ++i) {
        if (this.__clipPaths[i].isZeroArea()) {
          return false;
        }
      }
    }
    if (considerAncestors && this.parent) {
      var parent_1 = this.parent;
      while (parent_1) {
        if (parent_1.ignore) {
          return false;
        }
        parent_1 = parent_1.parent;
      }
    }
    return true;
  };
  Displayable.prototype.contain = function (x, y) {
    return this.rectContain(x, y);
  };
  Displayable.prototype.traverse = function (cb, context) {
    cb.call(context, this);
  };
  Displayable.prototype.rectContain = function (x, y) {
    var coord = this.transformCoordToLocal(x, y);
    var rect = this.getBoundingRect();
    return rect.contain(coord[0], coord[1]);
  };
  Displayable.prototype.getPaintRect = function () {
    var rect = this._paintRect;
    if (!this._paintRect || this.__dirty) {
      var transform = this.transform;
      var elRect = this.getBoundingRect();
      var style = this.style;
      var shadowSize = style.shadowBlur || 0;
      var shadowOffsetX = style.shadowOffsetX || 0;
      var shadowOffsetY = style.shadowOffsetY || 0;
      rect = this._paintRect || (this._paintRect = new BoundingRect$1(0, 0, 0, 0));
      if (transform) {
        BoundingRect$1.applyTransform(rect, elRect, transform);
      } else {
        rect.copy(elRect);
      }
      if (shadowSize || shadowOffsetX || shadowOffsetY) {
        rect.width += shadowSize * 2 + Math.abs(shadowOffsetX);
        rect.height += shadowSize * 2 + Math.abs(shadowOffsetY);
        rect.x = Math.min(rect.x, rect.x + shadowOffsetX - shadowSize);
        rect.y = Math.min(rect.y, rect.y + shadowOffsetY - shadowSize);
      }
      var tolerance = this.dirtyRectTolerance;
      if (!rect.isZero()) {
        rect.x = Math.floor(rect.x - tolerance);
        rect.y = Math.floor(rect.y - tolerance);
        rect.width = Math.ceil(rect.width + 1 + tolerance * 2);
        rect.height = Math.ceil(rect.height + 1 + tolerance * 2);
      }
    }
    return rect;
  };
  Displayable.prototype.setPrevPaintRect = function (paintRect) {
    if (paintRect) {
      this._prevPaintRect = this._prevPaintRect || new BoundingRect$1(0, 0, 0, 0);
      this._prevPaintRect.copy(paintRect);
    } else {
      this._prevPaintRect = null;
    }
  };
  Displayable.prototype.getPrevPaintRect = function () {
    return this._prevPaintRect;
  };
  Displayable.prototype.animateStyle = function (loop) {
    return this.animate('style', loop);
  };
  Displayable.prototype.updateDuringAnimation = function (targetKey) {
    if (targetKey === 'style') {
      this.dirtyStyle();
    } else {
      this.markRedraw();
    }
  };
  Displayable.prototype.attrKV = function (key, value) {
    if (key !== 'style') {
      _super.prototype.attrKV.call(this, key, value);
    } else {
      if (!this.style) {
        this.useStyle(value);
      } else {
        this.setStyle(value);
      }
    }
  };
  Displayable.prototype.setStyle = function (keyOrObj, value) {
    if (typeof keyOrObj === 'string') {
      this.style[keyOrObj] = value;
    } else {
      extend(this.style, keyOrObj);
    }
    this.dirtyStyle();
    return this;
  };
  Displayable.prototype.dirtyStyle = function (notRedraw) {
    if (!notRedraw) {
      this.markRedraw();
    }
    this.__dirty |= STYLE_CHANGED_BIT;
    if (this._rect) {
      this._rect = null;
    }
  };
  Displayable.prototype.dirty = function () {
    this.dirtyStyle();
  };
  Displayable.prototype.styleChanged = function () {
    return !!(this.__dirty & STYLE_CHANGED_BIT);
  };
  Displayable.prototype.styleUpdated = function () {
    this.__dirty &= ~STYLE_CHANGED_BIT;
  };
  Displayable.prototype.createStyle = function (obj) {
    return createObject(DEFAULT_COMMON_STYLE, obj);
  };
  Displayable.prototype.useStyle = function (obj) {
    if (!obj[STYLE_MAGIC_KEY]) {
      obj = this.createStyle(obj);
    }
    if (this.__inHover) {
      this.__hoverStyle = obj;
    } else {
      this.style = obj;
    }
    this.dirtyStyle();
  };
  Displayable.prototype.isStyleObject = function (obj) {
    return obj[STYLE_MAGIC_KEY];
  };
  Displayable.prototype._innerSaveToNormal = function (toState) {
    _super.prototype._innerSaveToNormal.call(this, toState);
    var normalState = this._normalState;
    if (toState.style && !normalState.style) {
      normalState.style = this._mergeStyle(this.createStyle(), this.style);
    }
    this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);
  };
  Displayable.prototype._applyStateObj = function (stateName, state, normalState, keepCurrentStates, transition, animationCfg) {
    _super.prototype._applyStateObj.call(this, stateName, state, normalState, keepCurrentStates, transition, animationCfg);
    var needsRestoreToNormal = !(state && keepCurrentStates);
    var targetStyle;
    if (state && state.style) {
      if (transition) {
        if (keepCurrentStates) {
          targetStyle = state.style;
        } else {
          targetStyle = this._mergeStyle(this.createStyle(), normalState.style);
          this._mergeStyle(targetStyle, state.style);
        }
      } else {
        targetStyle = this._mergeStyle(this.createStyle(), keepCurrentStates ? this.style : normalState.style);
        this._mergeStyle(targetStyle, state.style);
      }
    } else if (needsRestoreToNormal) {
      targetStyle = normalState.style;
    }
    if (targetStyle) {
      if (transition) {
        var sourceStyle = this.style;
        this.style = this.createStyle(needsRestoreToNormal ? {} : sourceStyle);
        if (needsRestoreToNormal) {
          var changedKeys = keys(sourceStyle);
          for (var i = 0; i < changedKeys.length; i++) {
            var key = changedKeys[i];
            if (key in targetStyle) {
              targetStyle[key] = targetStyle[key];
              this.style[key] = sourceStyle[key];
            }
          }
        }
        var targetKeys = keys(targetStyle);
        for (var i = 0; i < targetKeys.length; i++) {
          var key = targetKeys[i];
          this.style[key] = this.style[key];
        }
        this._transitionState(stateName, {
          style: targetStyle
        }, animationCfg, this.getAnimationStyleProps());
      } else {
        this.useStyle(targetStyle);
      }
    }
    var statesKeys = this.__inHover ? PRIMARY_STATES_KEYS_IN_HOVER_LAYER : PRIMARY_STATES_KEYS;
    for (var i = 0; i < statesKeys.length; i++) {
      var key = statesKeys[i];
      if (state && state[key] != null) {
        this[key] = state[key];
      } else if (needsRestoreToNormal) {
        if (normalState[key] != null) {
          this[key] = normalState[key];
        }
      }
    }
  };
  Displayable.prototype._mergeStates = function (states) {
    var mergedState = _super.prototype._mergeStates.call(this, states);
    var mergedStyle;
    for (var i = 0; i < states.length; i++) {
      var state = states[i];
      if (state.style) {
        mergedStyle = mergedStyle || {};
        this._mergeStyle(mergedStyle, state.style);
      }
    }
    if (mergedStyle) {
      mergedState.style = mergedStyle;
    }
    return mergedState;
  };
  Displayable.prototype._mergeStyle = function (targetStyle, sourceStyle) {
    extend(targetStyle, sourceStyle);
    return targetStyle;
  };
  Displayable.prototype.getAnimationStyleProps = function () {
    return DEFAULT_COMMON_ANIMATION_PROPS;
  };
  Displayable.initDefaultProps = function () {
    var dispProto = Displayable.prototype;
    dispProto.type = 'displayable';
    dispProto.invisible = false;
    dispProto.z = 0;
    dispProto.z2 = 0;
    dispProto.zlevel = 0;
    dispProto.culling = false;
    dispProto.cursor = 'pointer';
    dispProto.rectHover = false;
    dispProto.incremental = false;
    dispProto._rect = null;
    dispProto.dirtyRectTolerance = 0;
    dispProto.__dirty = REDRAW_BIT | STYLE_CHANGED_BIT;
  }();
  return Displayable;
}(Element$2);
var tmpRect = new BoundingRect$1(0, 0, 0, 0);
var viewRect = new BoundingRect$1(0, 0, 0, 0);
function isDisplayableCulled(el, width, height) {
  tmpRect.copy(el.getBoundingRect());
  if (el.transform) {
    tmpRect.applyTransform(el.transform);
  }
  viewRect.width = width;
  viewRect.height = height;
  return !tmpRect.intersect(viewRect);
}
var Displayable$1 = Displayable;

var mathMin$9 = Math.min;
var mathMax$9 = Math.max;
var mathSin$4 = Math.sin;
var mathCos$4 = Math.cos;
var PI2$8 = Math.PI * 2;
var start = create$2();
var end = create$2();
var extremity = create$2();
function fromPoints(points, min, max) {
  if (points.length === 0) {
    return;
  }
  var p = points[0];
  var left = p[0];
  var right = p[0];
  var top = p[1];
  var bottom = p[1];
  for (var i = 1; i < points.length; i++) {
    p = points[i];
    left = mathMin$9(left, p[0]);
    right = mathMax$9(right, p[0]);
    top = mathMin$9(top, p[1]);
    bottom = mathMax$9(bottom, p[1]);
  }
  min[0] = left;
  min[1] = top;
  max[0] = right;
  max[1] = bottom;
}
function fromLine(x0, y0, x1, y1, min, max) {
  min[0] = mathMin$9(x0, x1);
  min[1] = mathMin$9(y0, y1);
  max[0] = mathMax$9(x0, x1);
  max[1] = mathMax$9(y0, y1);
}
var xDim = [];
var yDim = [];
function fromCubic(x0, y0, x1, y1, x2, y2, x3, y3, min, max) {
  var cubicExtrema$1 = cubicExtrema;
  var cubicAt$1 = cubicAt;
  var n = cubicExtrema$1(x0, x1, x2, x3, xDim);
  min[0] = Infinity;
  min[1] = Infinity;
  max[0] = -Infinity;
  max[1] = -Infinity;
  for (var i = 0; i < n; i++) {
    var x = cubicAt$1(x0, x1, x2, x3, xDim[i]);
    min[0] = mathMin$9(x, min[0]);
    max[0] = mathMax$9(x, max[0]);
  }
  n = cubicExtrema$1(y0, y1, y2, y3, yDim);
  for (var i = 0; i < n; i++) {
    var y = cubicAt$1(y0, y1, y2, y3, yDim[i]);
    min[1] = mathMin$9(y, min[1]);
    max[1] = mathMax$9(y, max[1]);
  }
  min[0] = mathMin$9(x0, min[0]);
  max[0] = mathMax$9(x0, max[0]);
  min[0] = mathMin$9(x3, min[0]);
  max[0] = mathMax$9(x3, max[0]);
  min[1] = mathMin$9(y0, min[1]);
  max[1] = mathMax$9(y0, max[1]);
  min[1] = mathMin$9(y3, min[1]);
  max[1] = mathMax$9(y3, max[1]);
}
function fromQuadratic(x0, y0, x1, y1, x2, y2, min, max) {
  var quadraticExtremum$1 = quadraticExtremum;
  var quadraticAt = quadraticAt$1;
  var tx = mathMax$9(mathMin$9(quadraticExtremum$1(x0, x1, x2), 1), 0);
  var ty = mathMax$9(mathMin$9(quadraticExtremum$1(y0, y1, y2), 1), 0);
  var x = quadraticAt(x0, x1, x2, tx);
  var y = quadraticAt(y0, y1, y2, ty);
  min[0] = mathMin$9(x0, x2, x);
  min[1] = mathMin$9(y0, y2, y);
  max[0] = mathMax$9(x0, x2, x);
  max[1] = mathMax$9(y0, y2, y);
}
function fromArc(x, y, rx, ry, startAngle, endAngle, anticlockwise, min, max) {
  var vec2Min = min$3;
  var vec2Max = max$4;
  var diff = Math.abs(startAngle - endAngle);
  if (diff % PI2$8 < 1e-4 && diff > 1e-4) {
    min[0] = x - rx;
    min[1] = y - ry;
    max[0] = x + rx;
    max[1] = y + ry;
    return;
  }
  start[0] = mathCos$4(startAngle) * rx + x;
  start[1] = mathSin$4(startAngle) * ry + y;
  end[0] = mathCos$4(endAngle) * rx + x;
  end[1] = mathSin$4(endAngle) * ry + y;
  vec2Min(min, start, end);
  vec2Max(max, start, end);
  startAngle = startAngle % PI2$8;
  if (startAngle < 0) {
    startAngle = startAngle + PI2$8;
  }
  endAngle = endAngle % PI2$8;
  if (endAngle < 0) {
    endAngle = endAngle + PI2$8;
  }
  if (startAngle > endAngle && !anticlockwise) {
    endAngle += PI2$8;
  } else if (startAngle < endAngle && anticlockwise) {
    startAngle += PI2$8;
  }
  if (anticlockwise) {
    var tmp = endAngle;
    endAngle = startAngle;
    startAngle = tmp;
  }
  for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
    if (angle > startAngle) {
      extremity[0] = mathCos$4(angle) * rx + x;
      extremity[1] = mathSin$4(angle) * ry + y;
      vec2Min(min, extremity, min);
      vec2Max(max, extremity, max);
    }
  }
}

var CMD$4 = {
  M: 1,
  L: 2,
  C: 3,
  Q: 4,
  A: 5,
  Z: 6,
  R: 7
};
var tmpOutX = [];
var tmpOutY = [];
var min$2 = [];
var max$3 = [];
var min2 = [];
var max2 = [];
var mathMin$8 = Math.min;
var mathMax$8 = Math.max;
var mathCos$3 = Math.cos;
var mathSin$3 = Math.sin;
var mathAbs$2 = Math.abs;
var PI$9 = Math.PI;
var PI2$7 = PI$9 * 2;
var hasTypedArray = typeof Float32Array !== 'undefined';
var tmpAngles = [];
function modPI2(radian) {
  var n = Math.round(radian / PI$9 * 1e8) / 1e8;
  return n % 2 * PI$9;
}
function normalizeArcAngles(angles, anticlockwise) {
  var newStartAngle = modPI2(angles[0]);
  if (newStartAngle < 0) {
    newStartAngle += PI2$7;
  }
  var delta = newStartAngle - angles[0];
  var newEndAngle = angles[1];
  newEndAngle += delta;
  if (!anticlockwise && newEndAngle - newStartAngle >= PI2$7) {
    newEndAngle = newStartAngle + PI2$7;
  } else if (anticlockwise && newStartAngle - newEndAngle >= PI2$7) {
    newEndAngle = newStartAngle - PI2$7;
  } else if (!anticlockwise && newStartAngle > newEndAngle) {
    newEndAngle = newStartAngle + (PI2$7 - modPI2(newStartAngle - newEndAngle));
  } else if (anticlockwise && newStartAngle < newEndAngle) {
    newEndAngle = newStartAngle - (PI2$7 - modPI2(newEndAngle - newStartAngle));
  }
  angles[0] = newStartAngle;
  angles[1] = newEndAngle;
}
var PathProxy = function () {
  function PathProxy(notSaveData) {
    this.dpr = 1;
    this._xi = 0;
    this._yi = 0;
    this._x0 = 0;
    this._y0 = 0;
    this._len = 0;
    if (notSaveData) {
      this._saveData = false;
    }
    if (this._saveData) {
      this.data = [];
    }
  }
  PathProxy.prototype.increaseVersion = function () {
    this._version++;
  };
  PathProxy.prototype.getVersion = function () {
    return this._version;
  };
  PathProxy.prototype.setScale = function (sx, sy, segmentIgnoreThreshold) {
    segmentIgnoreThreshold = segmentIgnoreThreshold || 0;
    if (segmentIgnoreThreshold > 0) {
      this._ux = mathAbs$2(segmentIgnoreThreshold / devicePixelRatio / sx) || 0;
      this._uy = mathAbs$2(segmentIgnoreThreshold / devicePixelRatio / sy) || 0;
    }
  };
  PathProxy.prototype.setDPR = function (dpr) {
    this.dpr = dpr;
  };
  PathProxy.prototype.setContext = function (ctx) {
    this._ctx = ctx;
  };
  PathProxy.prototype.getContext = function () {
    return this._ctx;
  };
  PathProxy.prototype.beginPath = function () {
    this._ctx && this._ctx.beginPath();
    this.reset();
    return this;
  };
  PathProxy.prototype.reset = function () {
    if (this._saveData) {
      this._len = 0;
    }
    if (this._pathSegLen) {
      this._pathSegLen = null;
      this._pathLen = 0;
    }
    this._version++;
  };
  PathProxy.prototype.moveTo = function (x, y) {
    this._drawPendingPt();
    this.addData(CMD$4.M, x, y);
    this._ctx && this._ctx.moveTo(x, y);
    this._x0 = x;
    this._y0 = y;
    this._xi = x;
    this._yi = y;
    return this;
  };
  PathProxy.prototype.lineTo = function (x, y) {
    var dx = mathAbs$2(x - this._xi);
    var dy = mathAbs$2(y - this._yi);
    var exceedUnit = dx > this._ux || dy > this._uy;
    this.addData(CMD$4.L, x, y);
    if (this._ctx && exceedUnit) {
      this._ctx.lineTo(x, y);
    }
    if (exceedUnit) {
      this._xi = x;
      this._yi = y;
      this._pendingPtDist = 0;
    } else {
      var d2 = dx * dx + dy * dy;
      if (d2 > this._pendingPtDist) {
        this._pendingPtX = x;
        this._pendingPtY = y;
        this._pendingPtDist = d2;
      }
    }
    return this;
  };
  PathProxy.prototype.bezierCurveTo = function (x1, y1, x2, y2, x3, y3) {
    this._drawPendingPt();
    this.addData(CMD$4.C, x1, y1, x2, y2, x3, y3);
    if (this._ctx) {
      this._ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);
    }
    this._xi = x3;
    this._yi = y3;
    return this;
  };
  PathProxy.prototype.quadraticCurveTo = function (x1, y1, x2, y2) {
    this._drawPendingPt();
    this.addData(CMD$4.Q, x1, y1, x2, y2);
    if (this._ctx) {
      this._ctx.quadraticCurveTo(x1, y1, x2, y2);
    }
    this._xi = x2;
    this._yi = y2;
    return this;
  };
  PathProxy.prototype.arc = function (cx, cy, r, startAngle, endAngle, anticlockwise) {
    this._drawPendingPt();
    tmpAngles[0] = startAngle;
    tmpAngles[1] = endAngle;
    normalizeArcAngles(tmpAngles, anticlockwise);
    startAngle = tmpAngles[0];
    endAngle = tmpAngles[1];
    var delta = endAngle - startAngle;
    this.addData(CMD$4.A, cx, cy, r, r, startAngle, delta, 0, anticlockwise ? 0 : 1);
    this._ctx && this._ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);
    this._xi = mathCos$3(endAngle) * r + cx;
    this._yi = mathSin$3(endAngle) * r + cy;
    return this;
  };
  PathProxy.prototype.arcTo = function (x1, y1, x2, y2, radius) {
    this._drawPendingPt();
    if (this._ctx) {
      this._ctx.arcTo(x1, y1, x2, y2, radius);
    }
    return this;
  };
  PathProxy.prototype.rect = function (x, y, w, h) {
    this._drawPendingPt();
    this._ctx && this._ctx.rect(x, y, w, h);
    this.addData(CMD$4.R, x, y, w, h);
    return this;
  };
  PathProxy.prototype.closePath = function () {
    this._drawPendingPt();
    this.addData(CMD$4.Z);
    var ctx = this._ctx;
    var x0 = this._x0;
    var y0 = this._y0;
    if (ctx) {
      ctx.closePath();
    }
    this._xi = x0;
    this._yi = y0;
    return this;
  };
  PathProxy.prototype.fill = function (ctx) {
    ctx && ctx.fill();
    this.toStatic();
  };
  PathProxy.prototype.stroke = function (ctx) {
    ctx && ctx.stroke();
    this.toStatic();
  };
  PathProxy.prototype.len = function () {
    return this._len;
  };
  PathProxy.prototype.setData = function (data) {
    var len = data.length;
    if (!(this.data && this.data.length === len) && hasTypedArray) {
      this.data = new Float32Array(len);
    }
    for (var i = 0; i < len; i++) {
      this.data[i] = data[i];
    }
    this._len = len;
  };
  PathProxy.prototype.appendPath = function (path) {
    if (!(path instanceof Array)) {
      path = [path];
    }
    var len = path.length;
    var appendSize = 0;
    var offset = this._len;
    for (var i = 0; i < len; i++) {
      appendSize += path[i].len();
    }
    if (hasTypedArray && this.data instanceof Float32Array) {
      this.data = new Float32Array(offset + appendSize);
    }
    for (var i = 0; i < len; i++) {
      var appendPathData = path[i].data;
      for (var k = 0; k < appendPathData.length; k++) {
        this.data[offset++] = appendPathData[k];
      }
    }
    this._len = offset;
  };
  PathProxy.prototype.addData = function (cmd, a, b, c, d, e, f, g, h) {
    if (!this._saveData) {
      return;
    }
    var data = this.data;
    if (this._len + arguments.length > data.length) {
      this._expandData();
      data = this.data;
    }
    for (var i = 0; i < arguments.length; i++) {
      data[this._len++] = arguments[i];
    }
  };
  PathProxy.prototype._drawPendingPt = function () {
    if (this._pendingPtDist > 0) {
      this._ctx && this._ctx.lineTo(this._pendingPtX, this._pendingPtY);
      this._pendingPtDist = 0;
    }
  };
  PathProxy.prototype._expandData = function () {
    if (!(this.data instanceof Array)) {
      var newData = [];
      for (var i = 0; i < this._len; i++) {
        newData[i] = this.data[i];
      }
      this.data = newData;
    }
  };
  PathProxy.prototype.toStatic = function () {
    if (!this._saveData) {
      return;
    }
    this._drawPendingPt();
    var data = this.data;
    if (data instanceof Array) {
      data.length = this._len;
      if (hasTypedArray && this._len > 11) {
        this.data = new Float32Array(data);
      }
    }
  };
  PathProxy.prototype.getBoundingRect = function () {
    min$2[0] = min$2[1] = min2[0] = min2[1] = Number.MAX_VALUE;
    max$3[0] = max$3[1] = max2[0] = max2[1] = -Number.MAX_VALUE;
    var data = this.data;
    var xi = 0;
    var yi = 0;
    var x0 = 0;
    var y0 = 0;
    var i;
    for (i = 0; i < this._len;) {
      var cmd = data[i++];
      var isFirst = i === 1;
      if (isFirst) {
        xi = data[i];
        yi = data[i + 1];
        x0 = xi;
        y0 = yi;
      }
      switch (cmd) {
        case CMD$4.M:
          xi = x0 = data[i++];
          yi = y0 = data[i++];
          min2[0] = x0;
          min2[1] = y0;
          max2[0] = x0;
          max2[1] = y0;
          break;
        case CMD$4.L:
          fromLine(xi, yi, data[i], data[i + 1], min2, max2);
          xi = data[i++];
          yi = data[i++];
          break;
        case CMD$4.C:
          fromCubic(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], min2, max2);
          xi = data[i++];
          yi = data[i++];
          break;
        case CMD$4.Q:
          fromQuadratic(xi, yi, data[i++], data[i++], data[i], data[i + 1], min2, max2);
          xi = data[i++];
          yi = data[i++];
          break;
        case CMD$4.A:
          var cx = data[i++];
          var cy = data[i++];
          var rx = data[i++];
          var ry = data[i++];
          var startAngle = data[i++];
          var endAngle = data[i++] + startAngle;
          i += 1;
          var anticlockwise = !data[i++];
          if (isFirst) {
            x0 = mathCos$3(startAngle) * rx + cx;
            y0 = mathSin$3(startAngle) * ry + cy;
          }
          fromArc(cx, cy, rx, ry, startAngle, endAngle, anticlockwise, min2, max2);
          xi = mathCos$3(endAngle) * rx + cx;
          yi = mathSin$3(endAngle) * ry + cy;
          break;
        case CMD$4.R:
          x0 = xi = data[i++];
          y0 = yi = data[i++];
          var width = data[i++];
          var height = data[i++];
          fromLine(x0, y0, x0 + width, y0 + height, min2, max2);
          break;
        case CMD$4.Z:
          xi = x0;
          yi = y0;
          break;
      }
      min$3(min$2, min$2, min2);
      max$4(max$3, max$3, max2);
    }
    if (i === 0) {
      min$2[0] = min$2[1] = max$3[0] = max$3[1] = 0;
    }
    return new BoundingRect$1(min$2[0], min$2[1], max$3[0] - min$2[0], max$3[1] - min$2[1]);
  };
  PathProxy.prototype._calculateLength = function () {
    var data = this.data;
    var len = this._len;
    var ux = this._ux;
    var uy = this._uy;
    var xi = 0;
    var yi = 0;
    var x0 = 0;
    var y0 = 0;
    if (!this._pathSegLen) {
      this._pathSegLen = [];
    }
    var pathSegLen = this._pathSegLen;
    var pathTotalLen = 0;
    var segCount = 0;
    for (var i = 0; i < len;) {
      var cmd = data[i++];
      var isFirst = i === 1;
      if (isFirst) {
        xi = data[i];
        yi = data[i + 1];
        x0 = xi;
        y0 = yi;
      }
      var l = -1;
      switch (cmd) {
        case CMD$4.M:
          xi = x0 = data[i++];
          yi = y0 = data[i++];
          break;
        case CMD$4.L:
          {
            var x2 = data[i++];
            var y2 = data[i++];
            var dx = x2 - xi;
            var dy = y2 - yi;
            if (mathAbs$2(dx) > ux || mathAbs$2(dy) > uy || i === len - 1) {
              l = Math.sqrt(dx * dx + dy * dy);
              xi = x2;
              yi = y2;
            }
            break;
          }
        case CMD$4.C:
          {
            var x1 = data[i++];
            var y1 = data[i++];
            var x2 = data[i++];
            var y2 = data[i++];
            var x3 = data[i++];
            var y3 = data[i++];
            l = cubicLength(xi, yi, x1, y1, x2, y2, x3, y3, 10);
            xi = x3;
            yi = y3;
            break;
          }
        case CMD$4.Q:
          {
            var x1 = data[i++];
            var y1 = data[i++];
            var x2 = data[i++];
            var y2 = data[i++];
            l = quadraticLength(xi, yi, x1, y1, x2, y2, 10);
            xi = x2;
            yi = y2;
            break;
          }
        case CMD$4.A:
          var cx = data[i++];
          var cy = data[i++];
          var rx = data[i++];
          var ry = data[i++];
          var startAngle = data[i++];
          var delta = data[i++];
          var endAngle = delta + startAngle;
          i += 1;
          if (isFirst) {
            x0 = mathCos$3(startAngle) * rx + cx;
            y0 = mathSin$3(startAngle) * ry + cy;
          }
          l = mathMax$8(rx, ry) * mathMin$8(PI2$7, Math.abs(delta));
          xi = mathCos$3(endAngle) * rx + cx;
          yi = mathSin$3(endAngle) * ry + cy;
          break;
        case CMD$4.R:
          {
            x0 = xi = data[i++];
            y0 = yi = data[i++];
            var width = data[i++];
            var height = data[i++];
            l = width * 2 + height * 2;
            break;
          }
        case CMD$4.Z:
          {
            var dx = x0 - xi;
            var dy = y0 - yi;
            l = Math.sqrt(dx * dx + dy * dy);
            xi = x0;
            yi = y0;
            break;
          }
      }
      if (l >= 0) {
        pathSegLen[segCount++] = l;
        pathTotalLen += l;
      }
    }
    this._pathLen = pathTotalLen;
    return pathTotalLen;
  };
  PathProxy.prototype.rebuildPath = function (ctx, percent) {
    var d = this.data;
    var ux = this._ux;
    var uy = this._uy;
    var len = this._len;
    var x0;
    var y0;
    var xi;
    var yi;
    var x;
    var y;
    var drawPart = percent < 1;
    var pathSegLen;
    var pathTotalLen;
    var accumLength = 0;
    var segCount = 0;
    var displayedLength;
    var pendingPtDist = 0;
    var pendingPtX;
    var pendingPtY;
    if (drawPart) {
      if (!this._pathSegLen) {
        this._calculateLength();
      }
      pathSegLen = this._pathSegLen;
      pathTotalLen = this._pathLen;
      displayedLength = percent * pathTotalLen;
      if (!displayedLength) {
        return;
      }
    }
    lo: for (var i = 0; i < len;) {
      var cmd = d[i++];
      var isFirst = i === 1;
      if (isFirst) {
        xi = d[i];
        yi = d[i + 1];
        x0 = xi;
        y0 = yi;
      }
      if (cmd !== CMD$4.L && pendingPtDist > 0) {
        ctx.lineTo(pendingPtX, pendingPtY);
        pendingPtDist = 0;
      }
      switch (cmd) {
        case CMD$4.M:
          x0 = xi = d[i++];
          y0 = yi = d[i++];
          ctx.moveTo(xi, yi);
          break;
        case CMD$4.L:
          {
            x = d[i++];
            y = d[i++];
            var dx = mathAbs$2(x - xi);
            var dy = mathAbs$2(y - yi);
            if (dx > ux || dy > uy) {
              if (drawPart) {
                var l = pathSegLen[segCount++];
                if (accumLength + l > displayedLength) {
                  var t = (displayedLength - accumLength) / l;
                  ctx.lineTo(xi * (1 - t) + x * t, yi * (1 - t) + y * t);
                  break lo;
                }
                accumLength += l;
              }
              ctx.lineTo(x, y);
              xi = x;
              yi = y;
              pendingPtDist = 0;
            } else {
              var d2 = dx * dx + dy * dy;
              if (d2 > pendingPtDist) {
                pendingPtX = x;
                pendingPtY = y;
                pendingPtDist = d2;
              }
            }
            break;
          }
        case CMD$4.C:
          {
            var x1 = d[i++];
            var y1 = d[i++];
            var x2 = d[i++];
            var y2 = d[i++];
            var x3 = d[i++];
            var y3 = d[i++];
            if (drawPart) {
              var l = pathSegLen[segCount++];
              if (accumLength + l > displayedLength) {
                var t = (displayedLength - accumLength) / l;
                cubicSubdivide(xi, x1, x2, x3, t, tmpOutX);
                cubicSubdivide(yi, y1, y2, y3, t, tmpOutY);
                ctx.bezierCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2], tmpOutX[3], tmpOutY[3]);
                break lo;
              }
              accumLength += l;
            }
            ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);
            xi = x3;
            yi = y3;
            break;
          }
        case CMD$4.Q:
          {
            var x1 = d[i++];
            var y1 = d[i++];
            var x2 = d[i++];
            var y2 = d[i++];
            if (drawPart) {
              var l = pathSegLen[segCount++];
              if (accumLength + l > displayedLength) {
                var t = (displayedLength - accumLength) / l;
                quadraticSubdivide(xi, x1, x2, t, tmpOutX);
                quadraticSubdivide(yi, y1, y2, t, tmpOutY);
                ctx.quadraticCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2]);
                break lo;
              }
              accumLength += l;
            }
            ctx.quadraticCurveTo(x1, y1, x2, y2);
            xi = x2;
            yi = y2;
            break;
          }
        case CMD$4.A:
          var cx = d[i++];
          var cy = d[i++];
          var rx = d[i++];
          var ry = d[i++];
          var startAngle = d[i++];
          var delta = d[i++];
          var psi = d[i++];
          var anticlockwise = !d[i++];
          var r = rx > ry ? rx : ry;
          var isEllipse = mathAbs$2(rx - ry) > 1e-3;
          var endAngle = startAngle + delta;
          var breakBuild = false;
          if (drawPart) {
            var l = pathSegLen[segCount++];
            if (accumLength + l > displayedLength) {
              endAngle = startAngle + delta * (displayedLength - accumLength) / l;
              breakBuild = true;
            }
            accumLength += l;
          }
          if (isEllipse && ctx.ellipse) {
            ctx.ellipse(cx, cy, rx, ry, psi, startAngle, endAngle, anticlockwise);
          } else {
            ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);
          }
          if (breakBuild) {
            break lo;
          }
          if (isFirst) {
            x0 = mathCos$3(startAngle) * rx + cx;
            y0 = mathSin$3(startAngle) * ry + cy;
          }
          xi = mathCos$3(endAngle) * rx + cx;
          yi = mathSin$3(endAngle) * ry + cy;
          break;
        case CMD$4.R:
          x0 = xi = d[i];
          y0 = yi = d[i + 1];
          x = d[i++];
          y = d[i++];
          var width = d[i++];
          var height = d[i++];
          if (drawPart) {
            var l = pathSegLen[segCount++];
            if (accumLength + l > displayedLength) {
              var d_1 = displayedLength - accumLength;
              ctx.moveTo(x, y);
              ctx.lineTo(x + mathMin$8(d_1, width), y);
              d_1 -= width;
              if (d_1 > 0) {
                ctx.lineTo(x + width, y + mathMin$8(d_1, height));
              }
              d_1 -= height;
              if (d_1 > 0) {
                ctx.lineTo(x + mathMax$8(width - d_1, 0), y + height);
              }
              d_1 -= width;
              if (d_1 > 0) {
                ctx.lineTo(x, y + mathMax$8(height - d_1, 0));
              }
              break lo;
            }
            accumLength += l;
          }
          ctx.rect(x, y, width, height);
          break;
        case CMD$4.Z:
          if (drawPart) {
            var l = pathSegLen[segCount++];
            if (accumLength + l > displayedLength) {
              var t = (displayedLength - accumLength) / l;
              ctx.lineTo(xi * (1 - t) + x0 * t, yi * (1 - t) + y0 * t);
              break lo;
            }
            accumLength += l;
          }
          ctx.closePath();
          xi = x0;
          yi = y0;
      }
    }
  };
  PathProxy.prototype.clone = function () {
    var newProxy = new PathProxy();
    var data = this.data;
    newProxy.data = data.slice ? data.slice() : Array.prototype.slice.call(data);
    newProxy._len = this._len;
    return newProxy;
  };
  PathProxy.CMD = CMD$4;
  PathProxy.initDefaultProps = function () {
    var proto = PathProxy.prototype;
    proto._saveData = true;
    proto._ux = 0;
    proto._uy = 0;
    proto._pendingPtDist = 0;
    proto._version = 0;
  }();
  return PathProxy;
}();

function containStroke$4(x0, y0, x1, y1, lineWidth, x, y) {
  if (lineWidth === 0) {
    return false;
  }
  var _l = lineWidth;
  var _a = 0;
  var _b = x0;
  if (y > y0 + _l && y > y1 + _l || y < y0 - _l && y < y1 - _l || x > x0 + _l && x > x1 + _l || x < x0 - _l && x < x1 - _l) {
    return false;
  }
  if (x0 !== x1) {
    _a = (y0 - y1) / (x0 - x1);
    _b = (x0 * y1 - x1 * y0) / (x0 - x1);
  } else {
    return Math.abs(x - x0) <= _l / 2;
  }
  var tmp = _a * x - y + _b;
  var _s = tmp * tmp / (_a * _a + 1);
  return _s <= _l / 2 * _l / 2;
}

function containStroke$3(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
  if (lineWidth === 0) {
    return false;
  }
  var _l = lineWidth;
  if (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l || y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l || x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l || x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l) {
    return false;
  }
  var d = cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, null);
  return d <= _l / 2;
}

function containStroke$2(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
  if (lineWidth === 0) {
    return false;
  }
  var _l = lineWidth;
  if (y > y0 + _l && y > y1 + _l && y > y2 + _l || y < y0 - _l && y < y1 - _l && y < y2 - _l || x > x0 + _l && x > x1 + _l && x > x2 + _l || x < x0 - _l && x < x1 - _l && x < x2 - _l) {
    return false;
  }
  var d = quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, null);
  return d <= _l / 2;
}

var PI2$6 = Math.PI * 2;
function normalizeRadian(angle) {
  angle %= PI2$6;
  if (angle < 0) {
    angle += PI2$6;
  }
  return angle;
}

var PI2$5 = Math.PI * 2;
function containStroke$1(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
  if (lineWidth === 0) {
    return false;
  }
  var _l = lineWidth;
  x -= cx;
  y -= cy;
  var d = Math.sqrt(x * x + y * y);
  if (d - _l > r || d + _l < r) {
    return false;
  }
  if (Math.abs(startAngle - endAngle) % PI2$5 < 1e-4) {
    return true;
  }
  if (anticlockwise) {
    var tmp = startAngle;
    startAngle = normalizeRadian(endAngle);
    endAngle = normalizeRadian(tmp);
  } else {
    startAngle = normalizeRadian(startAngle);
    endAngle = normalizeRadian(endAngle);
  }
  if (startAngle > endAngle) {
    endAngle += PI2$5;
  }
  var angle = Math.atan2(y, x);
  if (angle < 0) {
    angle += PI2$5;
  }
  return angle >= startAngle && angle <= endAngle || angle + PI2$5 >= startAngle && angle + PI2$5 <= endAngle;
}

function windingLine(x0, y0, x1, y1, x, y) {
  if (y > y0 && y > y1 || y < y0 && y < y1) {
    return 0;
  }
  if (y1 === y0) {
    return 0;
  }
  var t = (y - y0) / (y1 - y0);
  var dir = y1 < y0 ? 1 : -1;
  if (t === 1 || t === 0) {
    dir = y1 < y0 ? 0.5 : -0.5;
  }
  var x_ = t * (x1 - x0) + x0;
  return x_ === x ? Infinity : x_ > x ? dir : 0;
}

var CMD$3 = PathProxy.CMD;
var PI2$4 = Math.PI * 2;
var EPSILON$1 = 1e-4;
function isAroundEqual$1(a, b) {
  return Math.abs(a - b) < EPSILON$1;
}
var roots = [-1, -1, -1];
var extrema = [-1, -1];
function swapExtrema() {
  var tmp = extrema[0];
  extrema[0] = extrema[1];
  extrema[1] = tmp;
}
function windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
  if (y > y0 && y > y1 && y > y2 && y > y3 || y < y0 && y < y1 && y < y2 && y < y3) {
    return 0;
  }
  var nRoots = cubicRootAt(y0, y1, y2, y3, y, roots);
  if (nRoots === 0) {
    return 0;
  } else {
    var w = 0;
    var nExtrema = -1;
    var y0_ = void 0;
    var y1_ = void 0;
    for (var i = 0; i < nRoots; i++) {
      var t = roots[i];
      var unit = t === 0 || t === 1 ? 0.5 : 1;
      var x_ = cubicAt(x0, x1, x2, x3, t);
      if (x_ < x) {
        continue;
      }
      if (nExtrema < 0) {
        nExtrema = cubicExtrema(y0, y1, y2, y3, extrema);
        if (extrema[1] < extrema[0] && nExtrema > 1) {
          swapExtrema();
        }
        y0_ = cubicAt(y0, y1, y2, y3, extrema[0]);
        if (nExtrema > 1) {
          y1_ = cubicAt(y0, y1, y2, y3, extrema[1]);
        }
      }
      if (nExtrema === 2) {
        if (t < extrema[0]) {
          w += y0_ < y0 ? unit : -unit;
        } else if (t < extrema[1]) {
          w += y1_ < y0_ ? unit : -unit;
        } else {
          w += y3 < y1_ ? unit : -unit;
        }
      } else {
        if (t < extrema[0]) {
          w += y0_ < y0 ? unit : -unit;
        } else {
          w += y3 < y0_ ? unit : -unit;
        }
      }
    }
    return w;
  }
}
function windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
  if (y > y0 && y > y1 && y > y2 || y < y0 && y < y1 && y < y2) {
    return 0;
  }
  var nRoots = quadraticRootAt(y0, y1, y2, y, roots);
  if (nRoots === 0) {
    return 0;
  } else {
    var t = quadraticExtremum(y0, y1, y2);
    if (t >= 0 && t <= 1) {
      var w = 0;
      var y_ = quadraticAt$1(y0, y1, y2, t);
      for (var i = 0; i < nRoots; i++) {
        var unit = roots[i] === 0 || roots[i] === 1 ? 0.5 : 1;
        var x_ = quadraticAt$1(x0, x1, x2, roots[i]);
        if (x_ < x) {
          continue;
        }
        if (roots[i] < t) {
          w += y_ < y0 ? unit : -unit;
        } else {
          w += y2 < y_ ? unit : -unit;
        }
      }
      return w;
    } else {
      var unit = roots[0] === 0 || roots[0] === 1 ? 0.5 : 1;
      var x_ = quadraticAt$1(x0, x1, x2, roots[0]);
      if (x_ < x) {
        return 0;
      }
      return y2 < y0 ? unit : -unit;
    }
  }
}
function windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
  y -= cy;
  if (y > r || y < -r) {
    return 0;
  }
  var tmp = Math.sqrt(r * r - y * y);
  roots[0] = -tmp;
  roots[1] = tmp;
  var dTheta = Math.abs(startAngle - endAngle);
  if (dTheta < 1e-4) {
    return 0;
  }
  if (dTheta >= PI2$4 - 1e-4) {
    startAngle = 0;
    endAngle = PI2$4;
    var dir = anticlockwise ? 1 : -1;
    if (x >= roots[0] + cx && x <= roots[1] + cx) {
      return dir;
    } else {
      return 0;
    }
  }
  if (startAngle > endAngle) {
    var tmp_1 = startAngle;
    startAngle = endAngle;
    endAngle = tmp_1;
  }
  if (startAngle < 0) {
    startAngle += PI2$4;
    endAngle += PI2$4;
  }
  var w = 0;
  for (var i = 0; i < 2; i++) {
    var x_ = roots[i];
    if (x_ + cx > x) {
      var angle = Math.atan2(y, x_);
      var dir = anticlockwise ? 1 : -1;
      if (angle < 0) {
        angle = PI2$4 + angle;
      }
      if (angle >= startAngle && angle <= endAngle || angle + PI2$4 >= startAngle && angle + PI2$4 <= endAngle) {
        if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
          dir = -dir;
        }
        w += dir;
      }
    }
  }
  return w;
}
function containPath(path, lineWidth, isStroke, x, y) {
  var data = path.data;
  var len = path.len();
  var w = 0;
  var xi = 0;
  var yi = 0;
  var x0 = 0;
  var y0 = 0;
  var x1;
  var y1;
  for (var i = 0; i < len;) {
    var cmd = data[i++];
    var isFirst = i === 1;
    if (cmd === CMD$3.M && i > 1) {
      if (!isStroke) {
        w += windingLine(xi, yi, x0, y0, x, y);
      }
    }
    if (isFirst) {
      xi = data[i];
      yi = data[i + 1];
      x0 = xi;
      y0 = yi;
    }
    switch (cmd) {
      case CMD$3.M:
        x0 = data[i++];
        y0 = data[i++];
        xi = x0;
        yi = y0;
        break;
      case CMD$3.L:
        if (isStroke) {
          if (containStroke$4(xi, yi, data[i], data[i + 1], lineWidth, x, y)) {
            return true;
          }
        } else {
          w += windingLine(xi, yi, data[i], data[i + 1], x, y) || 0;
        }
        xi = data[i++];
        yi = data[i++];
        break;
      case CMD$3.C:
        if (isStroke) {
          if (containStroke$3(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], lineWidth, x, y)) {
            return true;
          }
        } else {
          w += windingCubic(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], x, y) || 0;
        }
        xi = data[i++];
        yi = data[i++];
        break;
      case CMD$3.Q:
        if (isStroke) {
          if (containStroke$2(xi, yi, data[i++], data[i++], data[i], data[i + 1], lineWidth, x, y)) {
            return true;
          }
        } else {
          w += windingQuadratic(xi, yi, data[i++], data[i++], data[i], data[i + 1], x, y) || 0;
        }
        xi = data[i++];
        yi = data[i++];
        break;
      case CMD$3.A:
        var cx = data[i++];
        var cy = data[i++];
        var rx = data[i++];
        var ry = data[i++];
        var theta = data[i++];
        var dTheta = data[i++];
        i += 1;
        var anticlockwise = !!(1 - data[i++]);
        x1 = Math.cos(theta) * rx + cx;
        y1 = Math.sin(theta) * ry + cy;
        if (!isFirst) {
          w += windingLine(xi, yi, x1, y1, x, y);
        } else {
          x0 = x1;
          y0 = y1;
        }
        var _x = (x - cx) * ry / rx + cx;
        if (isStroke) {
          if (containStroke$1(cx, cy, ry, theta, theta + dTheta, anticlockwise, lineWidth, _x, y)) {
            return true;
          }
        } else {
          w += windingArc(cx, cy, ry, theta, theta + dTheta, anticlockwise, _x, y);
        }
        xi = Math.cos(theta + dTheta) * rx + cx;
        yi = Math.sin(theta + dTheta) * ry + cy;
        break;
      case CMD$3.R:
        x0 = xi = data[i++];
        y0 = yi = data[i++];
        var width = data[i++];
        var height = data[i++];
        x1 = x0 + width;
        y1 = y0 + height;
        if (isStroke) {
          if (containStroke$4(x0, y0, x1, y0, lineWidth, x, y) || containStroke$4(x1, y0, x1, y1, lineWidth, x, y) || containStroke$4(x1, y1, x0, y1, lineWidth, x, y) || containStroke$4(x0, y1, x0, y0, lineWidth, x, y)) {
            return true;
          }
        } else {
          w += windingLine(x1, y0, x1, y1, x, y);
          w += windingLine(x0, y1, x0, y0, x, y);
        }
        break;
      case CMD$3.Z:
        if (isStroke) {
          if (containStroke$4(xi, yi, x0, y0, lineWidth, x, y)) {
            return true;
          }
        } else {
          w += windingLine(xi, yi, x0, y0, x, y);
        }
        xi = x0;
        yi = y0;
        break;
    }
  }
  if (!isStroke && !isAroundEqual$1(yi, y0)) {
    w += windingLine(xi, yi, x0, y0, x, y) || 0;
  }
  return w !== 0;
}
function contain$2(pathProxy, x, y) {
  return containPath(pathProxy, 0, false, x, y);
}
function containStroke(pathProxy, lineWidth, x, y) {
  return containPath(pathProxy, lineWidth, true, x, y);
}

var DEFAULT_PATH_STYLE = defaults({
  fill: '#000',
  stroke: null,
  strokePercent: 1,
  fillOpacity: 1,
  strokeOpacity: 1,
  lineDashOffset: 0,
  lineWidth: 1,
  lineCap: 'butt',
  miterLimit: 10,
  strokeNoScale: false,
  strokeFirst: false
}, DEFAULT_COMMON_STYLE);
var DEFAULT_PATH_ANIMATION_PROPS = {
  style: defaults({
    fill: true,
    stroke: true,
    strokePercent: true,
    fillOpacity: true,
    strokeOpacity: true,
    lineDashOffset: true,
    lineWidth: true,
    miterLimit: true
  }, DEFAULT_COMMON_ANIMATION_PROPS.style)
};
var pathCopyParams = TRANSFORMABLE_PROPS.concat(['invisible', 'culling', 'z', 'z2', 'zlevel', 'parent']);
var Path = function (_super) {
  __extends(Path, _super);
  function Path(opts) {
    return _super.call(this, opts) || this;
  }
  Path.prototype.update = function () {
    var _this = this;
    _super.prototype.update.call(this);
    var style = this.style;
    if (style.decal) {
      var decalEl = this._decalEl = this._decalEl || new Path();
      if (decalEl.buildPath === Path.prototype.buildPath) {
        decalEl.buildPath = function (ctx) {
          _this.buildPath(ctx, _this.shape);
        };
      }
      decalEl.silent = true;
      var decalElStyle = decalEl.style;
      for (var key in style) {
        if (decalElStyle[key] !== style[key]) {
          decalElStyle[key] = style[key];
        }
      }
      decalElStyle.fill = style.fill ? style.decal : null;
      decalElStyle.decal = null;
      decalElStyle.shadowColor = null;
      style.strokeFirst && (decalElStyle.stroke = null);
      for (var i = 0; i < pathCopyParams.length; ++i) {
        decalEl[pathCopyParams[i]] = this[pathCopyParams[i]];
      }
      decalEl.__dirty |= REDRAW_BIT;
    } else if (this._decalEl) {
      this._decalEl = null;
    }
  };
  Path.prototype.getDecalElement = function () {
    return this._decalEl;
  };
  Path.prototype._init = function (props) {
    var keysArr = keys(props);
    this.shape = this.getDefaultShape();
    var defaultStyle = this.getDefaultStyle();
    if (defaultStyle) {
      this.useStyle(defaultStyle);
    }
    for (var i = 0; i < keysArr.length; i++) {
      var key = keysArr[i];
      var value = props[key];
      if (key === 'style') {
        if (!this.style) {
          this.useStyle(value);
        } else {
          extend(this.style, value);
        }
      } else if (key === 'shape') {
        extend(this.shape, value);
      } else {
        _super.prototype.attrKV.call(this, key, value);
      }
    }
    if (!this.style) {
      this.useStyle({});
    }
  };
  Path.prototype.getDefaultStyle = function () {
    return null;
  };
  Path.prototype.getDefaultShape = function () {
    return {};
  };
  Path.prototype.canBeInsideText = function () {
    return this.hasFill();
  };
  Path.prototype.getInsideTextFill = function () {
    var pathFill = this.style.fill;
    if (pathFill !== 'none') {
      if (isString(pathFill)) {
        var fillLum = lum(pathFill, 0);
        if (fillLum > 0.5) {
          return DARK_LABEL_COLOR;
        } else if (fillLum > 0.2) {
          return LIGHTER_LABEL_COLOR;
        }
        return LIGHT_LABEL_COLOR;
      } else if (pathFill) {
        return LIGHT_LABEL_COLOR;
      }
    }
    return DARK_LABEL_COLOR;
  };
  Path.prototype.getInsideTextStroke = function (textFill) {
    var pathFill = this.style.fill;
    if (isString(pathFill)) {
      var zr = this.__zr;
      var isDarkMode = !!(zr && zr.isDarkMode());
      var isDarkLabel = lum(textFill, 0) < DARK_MODE_THRESHOLD;
      if (isDarkMode === isDarkLabel) {
        return pathFill;
      }
    }
  };
  Path.prototype.buildPath = function (ctx, shapeCfg, inBatch) {};
  Path.prototype.pathUpdated = function () {
    this.__dirty &= ~SHAPE_CHANGED_BIT;
  };
  Path.prototype.getUpdatedPathProxy = function (inBatch) {
    !this.path && this.createPathProxy();
    this.path.beginPath();
    this.buildPath(this.path, this.shape, inBatch);
    return this.path;
  };
  Path.prototype.createPathProxy = function () {
    this.path = new PathProxy(false);
  };
  Path.prototype.hasStroke = function () {
    var style = this.style;
    var stroke = style.stroke;
    return !(stroke == null || stroke === 'none' || !(style.lineWidth > 0));
  };
  Path.prototype.hasFill = function () {
    var style = this.style;
    var fill = style.fill;
    return fill != null && fill !== 'none';
  };
  Path.prototype.getBoundingRect = function () {
    var rect = this._rect;
    var style = this.style;
    var needsUpdateRect = !rect;
    if (needsUpdateRect) {
      var firstInvoke = false;
      if (!this.path) {
        firstInvoke = true;
        this.createPathProxy();
      }
      var path = this.path;
      if (firstInvoke || this.__dirty & SHAPE_CHANGED_BIT) {
        path.beginPath();
        this.buildPath(path, this.shape, false);
        this.pathUpdated();
      }
      rect = path.getBoundingRect();
    }
    this._rect = rect;
    if (this.hasStroke() && this.path && this.path.len() > 0) {
      var rectStroke = this._rectStroke || (this._rectStroke = rect.clone());
      if (this.__dirty || needsUpdateRect) {
        rectStroke.copy(rect);
        var lineScale = style.strokeNoScale ? this.getLineScale() : 1;
        var w = style.lineWidth;
        if (!this.hasFill()) {
          var strokeContainThreshold = this.strokeContainThreshold;
          w = Math.max(w, strokeContainThreshold == null ? 4 : strokeContainThreshold);
        }
        if (lineScale > 1e-10) {
          rectStroke.width += w / lineScale;
          rectStroke.height += w / lineScale;
          rectStroke.x -= w / lineScale / 2;
          rectStroke.y -= w / lineScale / 2;
        }
      }
      return rectStroke;
    }
    return rect;
  };
  Path.prototype.contain = function (x, y) {
    var localPos = this.transformCoordToLocal(x, y);
    var rect = this.getBoundingRect();
    var style = this.style;
    x = localPos[0];
    y = localPos[1];
    if (rect.contain(x, y)) {
      var pathProxy = this.path;
      if (this.hasStroke()) {
        var lineWidth = style.lineWidth;
        var lineScale = style.strokeNoScale ? this.getLineScale() : 1;
        if (lineScale > 1e-10) {
          if (!this.hasFill()) {
            lineWidth = Math.max(lineWidth, this.strokeContainThreshold);
          }
          if (containStroke(pathProxy, lineWidth / lineScale, x, y)) {
            return true;
          }
        }
      }
      if (this.hasFill()) {
        return contain$2(pathProxy, x, y);
      }
    }
    return false;
  };
  Path.prototype.dirtyShape = function () {
    this.__dirty |= SHAPE_CHANGED_BIT;
    if (this._rect) {
      this._rect = null;
    }
    if (this._decalEl) {
      this._decalEl.dirtyShape();
    }
    this.markRedraw();
  };
  Path.prototype.dirty = function () {
    this.dirtyStyle();
    this.dirtyShape();
  };
  Path.prototype.animateShape = function (loop) {
    return this.animate('shape', loop);
  };
  Path.prototype.updateDuringAnimation = function (targetKey) {
    if (targetKey === 'style') {
      this.dirtyStyle();
    } else if (targetKey === 'shape') {
      this.dirtyShape();
    } else {
      this.markRedraw();
    }
  };
  Path.prototype.attrKV = function (key, value) {
    if (key === 'shape') {
      this.setShape(value);
    } else {
      _super.prototype.attrKV.call(this, key, value);
    }
  };
  Path.prototype.setShape = function (keyOrObj, value) {
    var shape = this.shape;
    if (!shape) {
      shape = this.shape = {};
    }
    if (typeof keyOrObj === 'string') {
      shape[keyOrObj] = value;
    } else {
      extend(shape, keyOrObj);
    }
    this.dirtyShape();
    return this;
  };
  Path.prototype.shapeChanged = function () {
    return !!(this.__dirty & SHAPE_CHANGED_BIT);
  };
  Path.prototype.createStyle = function (obj) {
    return createObject(DEFAULT_PATH_STYLE, obj);
  };
  Path.prototype._innerSaveToNormal = function (toState) {
    _super.prototype._innerSaveToNormal.call(this, toState);
    var normalState = this._normalState;
    if (toState.shape && !normalState.shape) {
      normalState.shape = extend({}, this.shape);
    }
  };
  Path.prototype._applyStateObj = function (stateName, state, normalState, keepCurrentStates, transition, animationCfg) {
    _super.prototype._applyStateObj.call(this, stateName, state, normalState, keepCurrentStates, transition, animationCfg);
    var needsRestoreToNormal = !(state && keepCurrentStates);
    var targetShape;
    if (state && state.shape) {
      if (transition) {
        if (keepCurrentStates) {
          targetShape = state.shape;
        } else {
          targetShape = extend({}, normalState.shape);
          extend(targetShape, state.shape);
        }
      } else {
        targetShape = extend({}, keepCurrentStates ? this.shape : normalState.shape);
        extend(targetShape, state.shape);
      }
    } else if (needsRestoreToNormal) {
      targetShape = normalState.shape;
    }
    if (targetShape) {
      if (transition) {
        this.shape = extend({}, this.shape);
        var targetShapePrimaryProps = {};
        var shapeKeys = keys(targetShape);
        for (var i = 0; i < shapeKeys.length; i++) {
          var key = shapeKeys[i];
          if (typeof targetShape[key] === 'object') {
            this.shape[key] = targetShape[key];
          } else {
            targetShapePrimaryProps[key] = targetShape[key];
          }
        }
        this._transitionState(stateName, {
          shape: targetShapePrimaryProps
        }, animationCfg);
      } else {
        this.shape = targetShape;
        this.dirtyShape();
      }
    }
  };
  Path.prototype._mergeStates = function (states) {
    var mergedState = _super.prototype._mergeStates.call(this, states);
    var mergedShape;
    for (var i = 0; i < states.length; i++) {
      var state = states[i];
      if (state.shape) {
        mergedShape = mergedShape || {};
        this._mergeStyle(mergedShape, state.shape);
      }
    }
    if (mergedShape) {
      mergedState.shape = mergedShape;
    }
    return mergedState;
  };
  Path.prototype.getAnimationStyleProps = function () {
    return DEFAULT_PATH_ANIMATION_PROPS;
  };
  Path.prototype.isZeroArea = function () {
    return false;
  };
  Path.extend = function (defaultProps) {
    var Sub = function (_super) {
      __extends(Sub, _super);
      function Sub(opts) {
        var _this = _super.call(this, opts) || this;
        defaultProps.init && defaultProps.init.call(_this, opts);
        return _this;
      }
      Sub.prototype.getDefaultStyle = function () {
        return clone$4(defaultProps.style);
      };
      Sub.prototype.getDefaultShape = function () {
        return clone$4(defaultProps.shape);
      };
      return Sub;
    }(Path);
    for (var key in defaultProps) {
      if (typeof defaultProps[key] === 'function') {
        Sub.prototype[key] = defaultProps[key];
      }
    }
    return Sub;
  };
  Path.initDefaultProps = function () {
    var pathProto = Path.prototype;
    pathProto.type = 'path';
    pathProto.strokeContainThreshold = 5;
    pathProto.segmentIgnoreThreshold = 0;
    pathProto.subPixelOptimize = false;
    pathProto.autoBatch = false;
    pathProto.__dirty = REDRAW_BIT | STYLE_CHANGED_BIT | SHAPE_CHANGED_BIT;
  }();
  return Path;
}(Displayable$1);
var Path$1 = Path;

var DEFAULT_TSPAN_STYLE = defaults({
  strokeFirst: true,
  font: DEFAULT_FONT,
  x: 0,
  y: 0,
  textAlign: 'left',
  textBaseline: 'top',
  miterLimit: 2
}, DEFAULT_PATH_STYLE);
var TSpan = function (_super) {
  __extends(TSpan, _super);
  function TSpan() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  TSpan.prototype.hasStroke = function () {
    var style = this.style;
    var stroke = style.stroke;
    return stroke != null && stroke !== 'none' && style.lineWidth > 0;
  };
  TSpan.prototype.hasFill = function () {
    var style = this.style;
    var fill = style.fill;
    return fill != null && fill !== 'none';
  };
  TSpan.prototype.createStyle = function (obj) {
    return createObject(DEFAULT_TSPAN_STYLE, obj);
  };
  TSpan.prototype.setBoundingRect = function (rect) {
    this._rect = rect;
  };
  TSpan.prototype.getBoundingRect = function () {
    var style = this.style;
    if (!this._rect) {
      var text = style.text;
      text != null ? text += '' : text = '';
      var rect = getBoundingRect(text, style.font, style.textAlign, style.textBaseline);
      rect.x += style.x || 0;
      rect.y += style.y || 0;
      if (this.hasStroke()) {
        var w = style.lineWidth;
        rect.x -= w / 2;
        rect.y -= w / 2;
        rect.width += w;
        rect.height += w;
      }
      this._rect = rect;
    }
    return this._rect;
  };
  TSpan.initDefaultProps = function () {
    var tspanProto = TSpan.prototype;
    tspanProto.dirtyRectTolerance = 10;
  }();
  return TSpan;
}(Displayable$1);
TSpan.prototype.type = 'tspan';
var TSpan$1 = TSpan;

var DEFAULT_IMAGE_STYLE = defaults({
  x: 0,
  y: 0
}, DEFAULT_COMMON_STYLE);
var DEFAULT_IMAGE_ANIMATION_PROPS = {
  style: defaults({
    x: true,
    y: true,
    width: true,
    height: true,
    sx: true,
    sy: true,
    sWidth: true,
    sHeight: true
  }, DEFAULT_COMMON_ANIMATION_PROPS.style)
};
function isImageLike$1(source) {
  return !!(source && typeof source !== 'string' && source.width && source.height);
}
var ZRImage = function (_super) {
  __extends(ZRImage, _super);
  function ZRImage() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  ZRImage.prototype.createStyle = function (obj) {
    return createObject(DEFAULT_IMAGE_STYLE, obj);
  };
  ZRImage.prototype._getSize = function (dim) {
    var style = this.style;
    var size = style[dim];
    if (size != null) {
      return size;
    }
    var imageSource = isImageLike$1(style.image) ? style.image : this.__image;
    if (!imageSource) {
      return 0;
    }
    var otherDim = dim === 'width' ? 'height' : 'width';
    var otherDimSize = style[otherDim];
    if (otherDimSize == null) {
      return imageSource[dim];
    } else {
      return imageSource[dim] / imageSource[otherDim] * otherDimSize;
    }
  };
  ZRImage.prototype.getWidth = function () {
    return this._getSize('width');
  };
  ZRImage.prototype.getHeight = function () {
    return this._getSize('height');
  };
  ZRImage.prototype.getAnimationStyleProps = function () {
    return DEFAULT_IMAGE_ANIMATION_PROPS;
  };
  ZRImage.prototype.getBoundingRect = function () {
    var style = this.style;
    if (!this._rect) {
      this._rect = new BoundingRect$1(style.x || 0, style.y || 0, this.getWidth(), this.getHeight());
    }
    return this._rect;
  };
  return ZRImage;
}(Displayable$1);
ZRImage.prototype.type = 'image';
var ZRImage$1 = ZRImage;

function buildPath$2(ctx, shape) {
  var x = shape.x;
  var y = shape.y;
  var width = shape.width;
  var height = shape.height;
  var r = shape.r;
  var r1;
  var r2;
  var r3;
  var r4;
  if (width < 0) {
    x = x + width;
    width = -width;
  }
  if (height < 0) {
    y = y + height;
    height = -height;
  }
  if (typeof r === 'number') {
    r1 = r2 = r3 = r4 = r;
  } else if (r instanceof Array) {
    if (r.length === 1) {
      r1 = r2 = r3 = r4 = r[0];
    } else if (r.length === 2) {
      r1 = r3 = r[0];
      r2 = r4 = r[1];
    } else if (r.length === 3) {
      r1 = r[0];
      r2 = r4 = r[1];
      r3 = r[2];
    } else {
      r1 = r[0];
      r2 = r[1];
      r3 = r[2];
      r4 = r[3];
    }
  } else {
    r1 = r2 = r3 = r4 = 0;
  }
  var total;
  if (r1 + r2 > width) {
    total = r1 + r2;
    r1 *= width / total;
    r2 *= width / total;
  }
  if (r3 + r4 > width) {
    total = r3 + r4;
    r3 *= width / total;
    r4 *= width / total;
  }
  if (r2 + r3 > height) {
    total = r2 + r3;
    r2 *= height / total;
    r3 *= height / total;
  }
  if (r1 + r4 > height) {
    total = r1 + r4;
    r1 *= height / total;
    r4 *= height / total;
  }
  ctx.moveTo(x + r1, y);
  ctx.lineTo(x + width - r2, y);
  r2 !== 0 && ctx.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0);
  ctx.lineTo(x + width, y + height - r3);
  r3 !== 0 && ctx.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2);
  ctx.lineTo(x + r4, y + height);
  r4 !== 0 && ctx.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI);
  ctx.lineTo(x, y + r1);
  r1 !== 0 && ctx.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);
}

var round$3 = Math.round;
function subPixelOptimizeLine$1(outputShape, inputShape, style) {
  if (!inputShape) {
    return;
  }
  var x1 = inputShape.x1;
  var x2 = inputShape.x2;
  var y1 = inputShape.y1;
  var y2 = inputShape.y2;
  outputShape.x1 = x1;
  outputShape.x2 = x2;
  outputShape.y1 = y1;
  outputShape.y2 = y2;
  var lineWidth = style && style.lineWidth;
  if (!lineWidth) {
    return outputShape;
  }
  if (round$3(x1 * 2) === round$3(x2 * 2)) {
    outputShape.x1 = outputShape.x2 = subPixelOptimize$1(x1, lineWidth, true);
  }
  if (round$3(y1 * 2) === round$3(y2 * 2)) {
    outputShape.y1 = outputShape.y2 = subPixelOptimize$1(y1, lineWidth, true);
  }
  return outputShape;
}
function subPixelOptimizeRect$1(outputShape, inputShape, style) {
  if (!inputShape) {
    return;
  }
  var originX = inputShape.x;
  var originY = inputShape.y;
  var originWidth = inputShape.width;
  var originHeight = inputShape.height;
  outputShape.x = originX;
  outputShape.y = originY;
  outputShape.width = originWidth;
  outputShape.height = originHeight;
  var lineWidth = style && style.lineWidth;
  if (!lineWidth) {
    return outputShape;
  }
  outputShape.x = subPixelOptimize$1(originX, lineWidth, true);
  outputShape.y = subPixelOptimize$1(originY, lineWidth, true);
  outputShape.width = Math.max(subPixelOptimize$1(originX + originWidth, lineWidth, false) - outputShape.x, originWidth === 0 ? 0 : 1);
  outputShape.height = Math.max(subPixelOptimize$1(originY + originHeight, lineWidth, false) - outputShape.y, originHeight === 0 ? 0 : 1);
  return outputShape;
}
function subPixelOptimize$1(position, lineWidth, positiveOrNegative) {
  if (!lineWidth) {
    return position;
  }
  var doubledPosition = round$3(position * 2);
  return (doubledPosition + round$3(lineWidth)) % 2 === 0 ? doubledPosition / 2 : (doubledPosition + (positiveOrNegative ? 1 : -1)) / 2;
}

var RectShape = function () {
  function RectShape() {
    this.x = 0;
    this.y = 0;
    this.width = 0;
    this.height = 0;
  }
  return RectShape;
}();
var subPixelOptimizeOutputShape$1 = {};
var Rect$2 = function (_super) {
  __extends(Rect, _super);
  function Rect(opts) {
    return _super.call(this, opts) || this;
  }
  Rect.prototype.getDefaultShape = function () {
    return new RectShape();
  };
  Rect.prototype.buildPath = function (ctx, shape) {
    var x;
    var y;
    var width;
    var height;
    if (this.subPixelOptimize) {
      var optimizedShape = subPixelOptimizeRect$1(subPixelOptimizeOutputShape$1, shape, this.style);
      x = optimizedShape.x;
      y = optimizedShape.y;
      width = optimizedShape.width;
      height = optimizedShape.height;
      optimizedShape.r = shape.r;
      shape = optimizedShape;
    } else {
      x = shape.x;
      y = shape.y;
      width = shape.width;
      height = shape.height;
    }
    if (!shape.r) {
      ctx.rect(x, y, width, height);
    } else {
      buildPath$2(ctx, shape);
    }
  };
  Rect.prototype.isZeroArea = function () {
    return !this.shape.width || !this.shape.height;
  };
  return Rect;
}(Path$1);
Rect$2.prototype.type = 'rect';
var Rect$3 = Rect$2;

var DEFAULT_RICH_TEXT_COLOR = {
  fill: '#000'
};
var DEFAULT_STROKE_LINE_WIDTH = 2;
var DEFAULT_TEXT_ANIMATION_PROPS = {
  style: defaults({
    fill: true,
    stroke: true,
    fillOpacity: true,
    strokeOpacity: true,
    lineWidth: true,
    fontSize: true,
    lineHeight: true,
    width: true,
    height: true,
    textShadowColor: true,
    textShadowBlur: true,
    textShadowOffsetX: true,
    textShadowOffsetY: true,
    backgroundColor: true,
    padding: true,
    borderColor: true,
    borderWidth: true,
    borderRadius: true
  }, DEFAULT_COMMON_ANIMATION_PROPS.style)
};
var ZRText = function (_super) {
  __extends(ZRText, _super);
  function ZRText(opts) {
    var _this = _super.call(this) || this;
    _this.type = 'text';
    _this._children = [];
    _this._defaultStyle = DEFAULT_RICH_TEXT_COLOR;
    _this.attr(opts);
    return _this;
  }
  ZRText.prototype.childrenRef = function () {
    return this._children;
  };
  ZRText.prototype.update = function () {
    _super.prototype.update.call(this);
    if (this.styleChanged()) {
      this._updateSubTexts();
    }
    for (var i = 0; i < this._children.length; i++) {
      var child = this._children[i];
      child.zlevel = this.zlevel;
      child.z = this.z;
      child.z2 = this.z2;
      child.culling = this.culling;
      child.cursor = this.cursor;
      child.invisible = this.invisible;
    }
  };
  ZRText.prototype.updateTransform = function () {
    var innerTransformable = this.innerTransformable;
    if (innerTransformable) {
      innerTransformable.updateTransform();
      if (innerTransformable.transform) {
        this.transform = innerTransformable.transform;
      }
    } else {
      _super.prototype.updateTransform.call(this);
    }
  };
  ZRText.prototype.getLocalTransform = function (m) {
    var innerTransformable = this.innerTransformable;
    return innerTransformable ? innerTransformable.getLocalTransform(m) : _super.prototype.getLocalTransform.call(this, m);
  };
  ZRText.prototype.getComputedTransform = function () {
    if (this.__hostTarget) {
      this.__hostTarget.getComputedTransform();
      this.__hostTarget.updateInnerText(true);
    }
    return _super.prototype.getComputedTransform.call(this);
  };
  ZRText.prototype._updateSubTexts = function () {
    this._childCursor = 0;
    normalizeTextStyle(this.style);
    this.style.rich ? this._updateRichTexts() : this._updatePlainTexts();
    this._children.length = this._childCursor;
    this.styleUpdated();
  };
  ZRText.prototype.addSelfToZr = function (zr) {
    _super.prototype.addSelfToZr.call(this, zr);
    for (var i = 0; i < this._children.length; i++) {
      this._children[i].__zr = zr;
    }
  };
  ZRText.prototype.removeSelfFromZr = function (zr) {
    _super.prototype.removeSelfFromZr.call(this, zr);
    for (var i = 0; i < this._children.length; i++) {
      this._children[i].__zr = null;
    }
  };
  ZRText.prototype.getBoundingRect = function () {
    if (this.styleChanged()) {
      this._updateSubTexts();
    }
    if (!this._rect) {
      var tmpRect = new BoundingRect$1(0, 0, 0, 0);
      var children = this._children;
      var tmpMat = [];
      var rect = null;
      for (var i = 0; i < children.length; i++) {
        var child = children[i];
        var childRect = child.getBoundingRect();
        var transform = child.getLocalTransform(tmpMat);
        if (transform) {
          tmpRect.copy(childRect);
          tmpRect.applyTransform(transform);
          rect = rect || tmpRect.clone();
          rect.union(tmpRect);
        } else {
          rect = rect || childRect.clone();
          rect.union(childRect);
        }
      }
      this._rect = rect || tmpRect;
    }
    return this._rect;
  };
  ZRText.prototype.setDefaultTextStyle = function (defaultTextStyle) {
    this._defaultStyle = defaultTextStyle || DEFAULT_RICH_TEXT_COLOR;
  };
  ZRText.prototype.setTextContent = function (textContent) {
    {
      throw new Error('Can\'t attach text on another text');
    }
  };
  ZRText.prototype._mergeStyle = function (targetStyle, sourceStyle) {
    if (!sourceStyle) {
      return targetStyle;
    }
    var sourceRich = sourceStyle.rich;
    var targetRich = targetStyle.rich || sourceRich && {};
    extend(targetStyle, sourceStyle);
    if (sourceRich && targetRich) {
      this._mergeRich(targetRich, sourceRich);
      targetStyle.rich = targetRich;
    } else if (targetRich) {
      targetStyle.rich = targetRich;
    }
    return targetStyle;
  };
  ZRText.prototype._mergeRich = function (targetRich, sourceRich) {
    var richNames = keys(sourceRich);
    for (var i = 0; i < richNames.length; i++) {
      var richName = richNames[i];
      targetRich[richName] = targetRich[richName] || {};
      extend(targetRich[richName], sourceRich[richName]);
    }
  };
  ZRText.prototype.getAnimationStyleProps = function () {
    return DEFAULT_TEXT_ANIMATION_PROPS;
  };
  ZRText.prototype._getOrCreateChild = function (Ctor) {
    var child = this._children[this._childCursor];
    if (!child || !(child instanceof Ctor)) {
      child = new Ctor();
    }
    this._children[this._childCursor++] = child;
    child.__zr = this.__zr;
    child.parent = this;
    return child;
  };
  ZRText.prototype._updatePlainTexts = function () {
    var style = this.style;
    var textFont = style.font || DEFAULT_FONT;
    var textPadding = style.padding;
    var text = getStyleText(style);
    var contentBlock = parsePlainText(text, style);
    var needDrawBg = needDrawBackground(style);
    var bgColorDrawn = !!style.backgroundColor;
    var outerHeight = contentBlock.outerHeight;
    var outerWidth = contentBlock.outerWidth;
    var contentWidth = contentBlock.contentWidth;
    var textLines = contentBlock.lines;
    var lineHeight = contentBlock.lineHeight;
    var defaultStyle = this._defaultStyle;
    this.isTruncated = !!contentBlock.isTruncated;
    var baseX = style.x || 0;
    var baseY = style.y || 0;
    var textAlign = style.align || defaultStyle.align || 'left';
    var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign || 'top';
    var textX = baseX;
    var textY = adjustTextY(baseY, contentBlock.contentHeight, verticalAlign);
    if (needDrawBg || textPadding) {
      var boxX = adjustTextX(baseX, outerWidth, textAlign);
      var boxY = adjustTextY(baseY, outerHeight, verticalAlign);
      needDrawBg && this._renderBackground(style, style, boxX, boxY, outerWidth, outerHeight);
    }
    textY += lineHeight / 2;
    if (textPadding) {
      textX = getTextXForPadding(baseX, textAlign, textPadding);
      if (verticalAlign === 'top') {
        textY += textPadding[0];
      } else if (verticalAlign === 'bottom') {
        textY -= textPadding[2];
      }
    }
    var defaultLineWidth = 0;
    var useDefaultFill = false;
    var textFill = getFill('fill' in style ? style.fill : (useDefaultFill = true, defaultStyle.fill));
    var textStroke = getStroke('stroke' in style ? style.stroke : !bgColorDrawn && (!defaultStyle.autoStroke || useDefaultFill) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke) : null);
    var hasShadow = style.textShadowBlur > 0;
    var fixedBoundingRect = style.width != null && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');
    var calculatedLineHeight = contentBlock.calculatedLineHeight;
    for (var i = 0; i < textLines.length; i++) {
      var el = this._getOrCreateChild(TSpan$1);
      var subElStyle = el.createStyle();
      el.useStyle(subElStyle);
      subElStyle.text = textLines[i];
      subElStyle.x = textX;
      subElStyle.y = textY;
      if (textAlign) {
        subElStyle.textAlign = textAlign;
      }
      subElStyle.textBaseline = 'middle';
      subElStyle.opacity = style.opacity;
      subElStyle.strokeFirst = true;
      if (hasShadow) {
        subElStyle.shadowBlur = style.textShadowBlur || 0;
        subElStyle.shadowColor = style.textShadowColor || 'transparent';
        subElStyle.shadowOffsetX = style.textShadowOffsetX || 0;
        subElStyle.shadowOffsetY = style.textShadowOffsetY || 0;
      }
      subElStyle.stroke = textStroke;
      subElStyle.fill = textFill;
      if (textStroke) {
        subElStyle.lineWidth = style.lineWidth || defaultLineWidth;
        subElStyle.lineDash = style.lineDash;
        subElStyle.lineDashOffset = style.lineDashOffset || 0;
      }
      subElStyle.font = textFont;
      setSeparateFont(subElStyle, style);
      textY += lineHeight;
      if (fixedBoundingRect) {
        el.setBoundingRect(new BoundingRect$1(adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign), adjustTextY(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), contentWidth, calculatedLineHeight));
      }
    }
  };
  ZRText.prototype._updateRichTexts = function () {
    var style = this.style;
    var text = getStyleText(style);
    var contentBlock = parseRichText(text, style);
    var contentWidth = contentBlock.width;
    var outerWidth = contentBlock.outerWidth;
    var outerHeight = contentBlock.outerHeight;
    var textPadding = style.padding;
    var baseX = style.x || 0;
    var baseY = style.y || 0;
    var defaultStyle = this._defaultStyle;
    var textAlign = style.align || defaultStyle.align;
    var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;
    this.isTruncated = !!contentBlock.isTruncated;
    var boxX = adjustTextX(baseX, outerWidth, textAlign);
    var boxY = adjustTextY(baseY, outerHeight, verticalAlign);
    var xLeft = boxX;
    var lineTop = boxY;
    if (textPadding) {
      xLeft += textPadding[3];
      lineTop += textPadding[0];
    }
    var xRight = xLeft + contentWidth;
    if (needDrawBackground(style)) {
      this._renderBackground(style, style, boxX, boxY, outerWidth, outerHeight);
    }
    var bgColorDrawn = !!style.backgroundColor;
    for (var i = 0; i < contentBlock.lines.length; i++) {
      var line = contentBlock.lines[i];
      var tokens = line.tokens;
      var tokenCount = tokens.length;
      var lineHeight = line.lineHeight;
      var remainedWidth = line.width;
      var leftIndex = 0;
      var lineXLeft = xLeft;
      var lineXRight = xRight;
      var rightIndex = tokenCount - 1;
      var token = void 0;
      while (leftIndex < tokenCount && (token = tokens[leftIndex], !token.align || token.align === 'left')) {
        this._placeToken(token, style, lineHeight, lineTop, lineXLeft, 'left', bgColorDrawn);
        remainedWidth -= token.width;
        lineXLeft += token.width;
        leftIndex++;
      }
      while (rightIndex >= 0 && (token = tokens[rightIndex], token.align === 'right')) {
        this._placeToken(token, style, lineHeight, lineTop, lineXRight, 'right', bgColorDrawn);
        remainedWidth -= token.width;
        lineXRight -= token.width;
        rightIndex--;
      }
      lineXLeft += (contentWidth - (lineXLeft - xLeft) - (xRight - lineXRight) - remainedWidth) / 2;
      while (leftIndex <= rightIndex) {
        token = tokens[leftIndex];
        this._placeToken(token, style, lineHeight, lineTop, lineXLeft + token.width / 2, 'center', bgColorDrawn);
        lineXLeft += token.width;
        leftIndex++;
      }
      lineTop += lineHeight;
    }
  };
  ZRText.prototype._placeToken = function (token, style, lineHeight, lineTop, x, textAlign, parentBgColorDrawn) {
    var tokenStyle = style.rich[token.styleName] || {};
    tokenStyle.text = token.text;
    var verticalAlign = token.verticalAlign;
    var y = lineTop + lineHeight / 2;
    if (verticalAlign === 'top') {
      y = lineTop + token.height / 2;
    } else if (verticalAlign === 'bottom') {
      y = lineTop + lineHeight - token.height / 2;
    }
    var needDrawBg = !token.isLineHolder && needDrawBackground(tokenStyle);
    needDrawBg && this._renderBackground(tokenStyle, style, textAlign === 'right' ? x - token.width : textAlign === 'center' ? x - token.width / 2 : x, y - token.height / 2, token.width, token.height);
    var bgColorDrawn = !!tokenStyle.backgroundColor;
    var textPadding = token.textPadding;
    if (textPadding) {
      x = getTextXForPadding(x, textAlign, textPadding);
      y -= token.height / 2 - textPadding[0] - token.innerHeight / 2;
    }
    var el = this._getOrCreateChild(TSpan$1);
    var subElStyle = el.createStyle();
    el.useStyle(subElStyle);
    var defaultStyle = this._defaultStyle;
    var useDefaultFill = false;
    var defaultLineWidth = 0;
    var textFill = getFill('fill' in tokenStyle ? tokenStyle.fill : 'fill' in style ? style.fill : (useDefaultFill = true, defaultStyle.fill));
    var textStroke = getStroke('stroke' in tokenStyle ? tokenStyle.stroke : 'stroke' in style ? style.stroke : !bgColorDrawn && !parentBgColorDrawn && (!defaultStyle.autoStroke || useDefaultFill) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke) : null);
    var hasShadow = tokenStyle.textShadowBlur > 0 || style.textShadowBlur > 0;
    subElStyle.text = token.text;
    subElStyle.x = x;
    subElStyle.y = y;
    if (hasShadow) {
      subElStyle.shadowBlur = tokenStyle.textShadowBlur || style.textShadowBlur || 0;
      subElStyle.shadowColor = tokenStyle.textShadowColor || style.textShadowColor || 'transparent';
      subElStyle.shadowOffsetX = tokenStyle.textShadowOffsetX || style.textShadowOffsetX || 0;
      subElStyle.shadowOffsetY = tokenStyle.textShadowOffsetY || style.textShadowOffsetY || 0;
    }
    subElStyle.textAlign = textAlign;
    subElStyle.textBaseline = 'middle';
    subElStyle.font = token.font || DEFAULT_FONT;
    subElStyle.opacity = retrieve3(tokenStyle.opacity, style.opacity, 1);
    setSeparateFont(subElStyle, tokenStyle);
    if (textStroke) {
      subElStyle.lineWidth = retrieve3(tokenStyle.lineWidth, style.lineWidth, defaultLineWidth);
      subElStyle.lineDash = retrieve2(tokenStyle.lineDash, style.lineDash);
      subElStyle.lineDashOffset = style.lineDashOffset || 0;
      subElStyle.stroke = textStroke;
    }
    if (textFill) {
      subElStyle.fill = textFill;
    }
    var textWidth = token.contentWidth;
    var textHeight = token.contentHeight;
    el.setBoundingRect(new BoundingRect$1(adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign), adjustTextY(subElStyle.y, textHeight, subElStyle.textBaseline), textWidth, textHeight));
  };
  ZRText.prototype._renderBackground = function (style, topStyle, x, y, width, height) {
    var textBackgroundColor = style.backgroundColor;
    var textBorderWidth = style.borderWidth;
    var textBorderColor = style.borderColor;
    var isImageBg = textBackgroundColor && textBackgroundColor.image;
    var isPlainOrGradientBg = textBackgroundColor && !isImageBg;
    var textBorderRadius = style.borderRadius;
    var self = this;
    var rectEl;
    var imgEl;
    if (isPlainOrGradientBg || style.lineHeight || textBorderWidth && textBorderColor) {
      rectEl = this._getOrCreateChild(Rect$3);
      rectEl.useStyle(rectEl.createStyle());
      rectEl.style.fill = null;
      var rectShape = rectEl.shape;
      rectShape.x = x;
      rectShape.y = y;
      rectShape.width = width;
      rectShape.height = height;
      rectShape.r = textBorderRadius;
      rectEl.dirtyShape();
    }
    if (isPlainOrGradientBg) {
      var rectStyle = rectEl.style;
      rectStyle.fill = textBackgroundColor || null;
      rectStyle.fillOpacity = retrieve2(style.fillOpacity, 1);
    } else if (isImageBg) {
      imgEl = this._getOrCreateChild(ZRImage$1);
      imgEl.onload = function () {
        self.dirtyStyle();
      };
      var imgStyle = imgEl.style;
      imgStyle.image = textBackgroundColor.image;
      imgStyle.x = x;
      imgStyle.y = y;
      imgStyle.width = width;
      imgStyle.height = height;
    }
    if (textBorderWidth && textBorderColor) {
      var rectStyle = rectEl.style;
      rectStyle.lineWidth = textBorderWidth;
      rectStyle.stroke = textBorderColor;
      rectStyle.strokeOpacity = retrieve2(style.strokeOpacity, 1);
      rectStyle.lineDash = style.borderDash;
      rectStyle.lineDashOffset = style.borderDashOffset || 0;
      rectEl.strokeContainThreshold = 0;
      if (rectEl.hasFill() && rectEl.hasStroke()) {
        rectStyle.strokeFirst = true;
        rectStyle.lineWidth *= 2;
      }
    }
    var commonStyle = (rectEl || imgEl).style;
    commonStyle.shadowBlur = style.shadowBlur || 0;
    commonStyle.shadowColor = style.shadowColor || 'transparent';
    commonStyle.shadowOffsetX = style.shadowOffsetX || 0;
    commonStyle.shadowOffsetY = style.shadowOffsetY || 0;
    commonStyle.opacity = retrieve3(style.opacity, topStyle.opacity, 1);
  };
  ZRText.makeFont = function (style) {
    var font = '';
    if (hasSeparateFont(style)) {
      font = [style.fontStyle, style.fontWeight, parseFontSize(style.fontSize), style.fontFamily || 'sans-serif'].join(' ');
    }
    return font && trim$1(font) || style.textFont || style.font;
  };
  return ZRText;
}(Displayable$1);
var VALID_TEXT_ALIGN = {
  left: true,
  right: 1,
  center: 1
};
var VALID_TEXT_VERTICAL_ALIGN = {
  top: 1,
  bottom: 1,
  middle: 1
};
var FONT_PARTS = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily'];
function parseFontSize(fontSize) {
  if (typeof fontSize === 'string' && (fontSize.indexOf('px') !== -1 || fontSize.indexOf('rem') !== -1 || fontSize.indexOf('em') !== -1)) {
    return fontSize;
  } else if (!isNaN(+fontSize)) {
    return fontSize + 'px';
  } else {
    return DEFAULT_FONT_SIZE + 'px';
  }
}
function setSeparateFont(targetStyle, sourceStyle) {
  for (var i = 0; i < FONT_PARTS.length; i++) {
    var fontProp = FONT_PARTS[i];
    var val = sourceStyle[fontProp];
    if (val != null) {
      targetStyle[fontProp] = val;
    }
  }
}
function hasSeparateFont(style) {
  return style.fontSize != null || style.fontFamily || style.fontWeight;
}
function normalizeTextStyle(style) {
  normalizeStyle(style);
  each$f(style.rich, normalizeStyle);
  return style;
}
function normalizeStyle(style) {
  if (style) {
    style.font = ZRText.makeFont(style);
    var textAlign = style.align;
    textAlign === 'middle' && (textAlign = 'center');
    style.align = textAlign == null || VALID_TEXT_ALIGN[textAlign] ? textAlign : 'left';
    var verticalAlign = style.verticalAlign;
    verticalAlign === 'center' && (verticalAlign = 'middle');
    style.verticalAlign = verticalAlign == null || VALID_TEXT_VERTICAL_ALIGN[verticalAlign] ? verticalAlign : 'top';
    var textPadding = style.padding;
    if (textPadding) {
      style.padding = normalizeCssArray$1(style.padding);
    }
  }
}
function getStroke(stroke, lineWidth) {
  return stroke == null || lineWidth <= 0 || stroke === 'transparent' || stroke === 'none' ? null : stroke.image || stroke.colorStops ? '#000' : stroke;
}
function getFill(fill) {
  return fill == null || fill === 'none' ? null : fill.image || fill.colorStops ? '#000' : fill;
}
function getTextXForPadding(x, textAlign, textPadding) {
  return textAlign === 'right' ? x - textPadding[1] : textAlign === 'center' ? x + textPadding[3] / 2 - textPadding[1] / 2 : x + textPadding[3];
}
function getStyleText(style) {
  var text = style.text;
  text != null && (text += '');
  return text;
}
function needDrawBackground(style) {
  return !!(style.backgroundColor || style.lineHeight || style.borderWidth && style.borderColor);
}
var ZRText$1 = ZRText;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var getECData = makeInner();
var setCommonECData = function (seriesIndex, dataType, dataIdx, el) {
  if (el) {
    var ecData = getECData(el);
    // Add data index and series index for indexing the data by element
    // Useful in tooltip
    ecData.dataIndex = dataIdx;
    ecData.dataType = dataType;
    ecData.seriesIndex = seriesIndex;
    ecData.ssrType = 'chart';
    // TODO: not store dataIndex on children.
    if (el.type === 'group') {
      el.traverse(function (child) {
        var childECData = getECData(child);
        childECData.seriesIndex = seriesIndex;
        childECData.dataIndex = dataIdx;
        childECData.dataType = dataType;
        childECData.ssrType = 'chart';
      });
    }
  }
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Reserve 0 as default.
var _highlightNextDigit = 1;
var _highlightKeyMap = {};
var getSavedStates = makeInner();
var getComponentStates = makeInner();
var HOVER_STATE_NORMAL = 0;
var HOVER_STATE_BLUR = 1;
var HOVER_STATE_EMPHASIS = 2;
var SPECIAL_STATES = ['emphasis', 'blur', 'select'];
var DISPLAY_STATES = ['normal', 'emphasis', 'blur', 'select'];
var Z2_EMPHASIS_LIFT = 10;
var Z2_SELECT_LIFT = 9;
var HIGHLIGHT_ACTION_TYPE = 'highlight';
var DOWNPLAY_ACTION_TYPE = 'downplay';
var SELECT_ACTION_TYPE = 'select';
var UNSELECT_ACTION_TYPE = 'unselect';
var TOGGLE_SELECT_ACTION_TYPE = 'toggleSelect';
function hasFillOrStroke(fillOrStroke) {
  return fillOrStroke != null && fillOrStroke !== 'none';
}
function doChangeHoverState(el, stateName, hoverStateEnum) {
  if (el.onHoverStateChange && (el.hoverState || 0) !== hoverStateEnum) {
    el.onHoverStateChange(stateName);
  }
  el.hoverState = hoverStateEnum;
}
function singleEnterEmphasis(el) {
  // Only mark the flag.
  // States will be applied in the echarts.ts in next frame.
  doChangeHoverState(el, 'emphasis', HOVER_STATE_EMPHASIS);
}
function singleLeaveEmphasis(el) {
  // Only mark the flag.
  // States will be applied in the echarts.ts in next frame.
  if (el.hoverState === HOVER_STATE_EMPHASIS) {
    doChangeHoverState(el, 'normal', HOVER_STATE_NORMAL);
  }
}
function singleEnterBlur(el) {
  doChangeHoverState(el, 'blur', HOVER_STATE_BLUR);
}
function singleLeaveBlur(el) {
  if (el.hoverState === HOVER_STATE_BLUR) {
    doChangeHoverState(el, 'normal', HOVER_STATE_NORMAL);
  }
}
function singleEnterSelect(el) {
  el.selected = true;
}
function singleLeaveSelect(el) {
  el.selected = false;
}
function updateElementState(el, updater, commonParam) {
  updater(el, commonParam);
}
function traverseUpdateState(el, updater, commonParam) {
  updateElementState(el, updater, commonParam);
  el.isGroup && el.traverse(function (child) {
    updateElementState(child, updater, commonParam);
  });
}
function setStatesFlag(el, stateName) {
  switch (stateName) {
    case 'emphasis':
      el.hoverState = HOVER_STATE_EMPHASIS;
      break;
    case 'normal':
      el.hoverState = HOVER_STATE_NORMAL;
      break;
    case 'blur':
      el.hoverState = HOVER_STATE_BLUR;
      break;
    case 'select':
      el.selected = true;
  }
}
function getFromStateStyle(el, props, toStateName, defaultValue) {
  var style = el.style;
  var fromState = {};
  for (var i = 0; i < props.length; i++) {
    var propName = props[i];
    var val = style[propName];
    fromState[propName] = val == null ? defaultValue && defaultValue[propName] : val;
  }
  for (var i = 0; i < el.animators.length; i++) {
    var animator = el.animators[i];
    if (animator.__fromStateTransition
    // Don't consider the animation to emphasis state.
    && animator.__fromStateTransition.indexOf(toStateName) < 0 && animator.targetName === 'style') {
      animator.saveTo(fromState, props);
    }
  }
  return fromState;
}
function createEmphasisDefaultState(el, stateName, targetStates, state) {
  var hasSelect = targetStates && indexOf(targetStates, 'select') >= 0;
  var cloned = false;
  if (el instanceof Path$1) {
    var store = getSavedStates(el);
    var fromFill = hasSelect ? store.selectFill || store.normalFill : store.normalFill;
    var fromStroke = hasSelect ? store.selectStroke || store.normalStroke : store.normalStroke;
    if (hasFillOrStroke(fromFill) || hasFillOrStroke(fromStroke)) {
      state = state || {};
      var emphasisStyle = state.style || {};
      // inherit case
      if (emphasisStyle.fill === 'inherit') {
        cloned = true;
        state = extend({}, state);
        emphasisStyle = extend({}, emphasisStyle);
        emphasisStyle.fill = fromFill;
      }
      // Apply default color lift
      else if (!hasFillOrStroke(emphasisStyle.fill) && hasFillOrStroke(fromFill)) {
        cloned = true;
        // Not modify the original value.
        state = extend({}, state);
        emphasisStyle = extend({}, emphasisStyle);
        // Already being applied 'emphasis'. DON'T lift color multiple times.
        emphasisStyle.fill = liftColor(fromFill);
      }
      // Not highlight stroke if fill has been highlighted.
      else if (!hasFillOrStroke(emphasisStyle.stroke) && hasFillOrStroke(fromStroke)) {
        if (!cloned) {
          state = extend({}, state);
          emphasisStyle = extend({}, emphasisStyle);
        }
        emphasisStyle.stroke = liftColor(fromStroke);
      }
      state.style = emphasisStyle;
    }
  }
  if (state) {
    // TODO Share with textContent?
    if (state.z2 == null) {
      if (!cloned) {
        state = extend({}, state);
      }
      var z2EmphasisLift = el.z2EmphasisLift;
      state.z2 = el.z2 + (z2EmphasisLift != null ? z2EmphasisLift : Z2_EMPHASIS_LIFT);
    }
  }
  return state;
}
function createSelectDefaultState(el, stateName, state) {
  // const hasSelect = indexOf(el.currentStates, stateName) >= 0;
  if (state) {
    // TODO Share with textContent?
    if (state.z2 == null) {
      state = extend({}, state);
      var z2SelectLift = el.z2SelectLift;
      state.z2 = el.z2 + (z2SelectLift != null ? z2SelectLift : Z2_SELECT_LIFT);
    }
  }
  return state;
}
function createBlurDefaultState(el, stateName, state) {
  var hasBlur = indexOf(el.currentStates, stateName) >= 0;
  var currentOpacity = el.style.opacity;
  var fromState = !hasBlur ? getFromStateStyle(el, ['opacity'], stateName, {
    opacity: 1
  }) : null;
  state = state || {};
  var blurStyle = state.style || {};
  if (blurStyle.opacity == null) {
    // clone state
    state = extend({}, state);
    blurStyle = extend({
      // Already being applied 'emphasis'. DON'T mul opacity multiple times.
      opacity: hasBlur ? currentOpacity : fromState.opacity * 0.1
    }, blurStyle);
    state.style = blurStyle;
  }
  return state;
}
function elementStateProxy(stateName, targetStates) {
  var state = this.states[stateName];
  if (this.style) {
    if (stateName === 'emphasis') {
      return createEmphasisDefaultState(this, stateName, targetStates, state);
    } else if (stateName === 'blur') {
      return createBlurDefaultState(this, stateName, state);
    } else if (stateName === 'select') {
      return createSelectDefaultState(this, stateName, state);
    }
  }
  return state;
}
/**
 * Set hover style (namely "emphasis style") of element.
 * @param el Should not be `zrender/graphic/Group`.
 * @param focus 'self' | 'selfInSeries' | 'series'
 */
function setDefaultStateProxy(el) {
  el.stateProxy = elementStateProxy;
  var textContent = el.getTextContent();
  var textGuide = el.getTextGuideLine();
  if (textContent) {
    textContent.stateProxy = elementStateProxy;
  }
  if (textGuide) {
    textGuide.stateProxy = elementStateProxy;
  }
}
function enterEmphasisWhenMouseOver(el, e) {
  !shouldSilent(el, e)
  // "emphasis" event highlight has higher priority than mouse highlight.
  && !el.__highByOuter && traverseUpdateState(el, singleEnterEmphasis);
}
function leaveEmphasisWhenMouseOut(el, e) {
  !shouldSilent(el, e)
  // "emphasis" event highlight has higher priority than mouse highlight.
  && !el.__highByOuter && traverseUpdateState(el, singleLeaveEmphasis);
}
function enterEmphasis(el, highlightDigit) {
  el.__highByOuter |= 1 << (highlightDigit || 0);
  traverseUpdateState(el, singleEnterEmphasis);
}
function leaveEmphasis(el, highlightDigit) {
  !(el.__highByOuter &= ~(1 << (highlightDigit || 0))) && traverseUpdateState(el, singleLeaveEmphasis);
}
function enterBlur(el) {
  traverseUpdateState(el, singleEnterBlur);
}
function leaveBlur(el) {
  traverseUpdateState(el, singleLeaveBlur);
}
function enterSelect(el) {
  traverseUpdateState(el, singleEnterSelect);
}
function leaveSelect(el) {
  traverseUpdateState(el, singleLeaveSelect);
}
function shouldSilent(el, e) {
  return el.__highDownSilentOnTouch && e.zrByTouch;
}
function allLeaveBlur(api) {
  var model = api.getModel();
  var leaveBlurredSeries = [];
  var allComponentViews = [];
  model.eachComponent(function (componentType, componentModel) {
    var componentStates = getComponentStates(componentModel);
    var isSeries = componentType === 'series';
    var view = isSeries ? api.getViewOfSeriesModel(componentModel) : api.getViewOfComponentModel(componentModel);
    !isSeries && allComponentViews.push(view);
    if (componentStates.isBlured) {
      // Leave blur anyway
      view.group.traverse(function (child) {
        singleLeaveBlur(child);
      });
      isSeries && leaveBlurredSeries.push(componentModel);
    }
    componentStates.isBlured = false;
  });
  each$f(allComponentViews, function (view) {
    if (view && view.toggleBlurSeries) {
      view.toggleBlurSeries(leaveBlurredSeries, false, model);
    }
  });
}
function blurSeries(targetSeriesIndex, focus, blurScope, api) {
  var ecModel = api.getModel();
  blurScope = blurScope || 'coordinateSystem';
  function leaveBlurOfIndices(data, dataIndices) {
    for (var i = 0; i < dataIndices.length; i++) {
      var itemEl = data.getItemGraphicEl(dataIndices[i]);
      itemEl && leaveBlur(itemEl);
    }
  }
  if (targetSeriesIndex == null) {
    return;
  }
  if (!focus || focus === 'none') {
    return;
  }
  var targetSeriesModel = ecModel.getSeriesByIndex(targetSeriesIndex);
  var targetCoordSys = targetSeriesModel.coordinateSystem;
  if (targetCoordSys && targetCoordSys.master) {
    targetCoordSys = targetCoordSys.master;
  }
  var blurredSeries = [];
  ecModel.eachSeries(function (seriesModel) {
    var sameSeries = targetSeriesModel === seriesModel;
    var coordSys = seriesModel.coordinateSystem;
    if (coordSys && coordSys.master) {
      coordSys = coordSys.master;
    }
    var sameCoordSys = coordSys && targetCoordSys ? coordSys === targetCoordSys : sameSeries; // If there is no coordinate system. use sameSeries instead.
    if (!(
    // Not blur other series if blurScope series
    blurScope === 'series' && !sameSeries
    // Not blur other coordinate system if blurScope is coordinateSystem
    || blurScope === 'coordinateSystem' && !sameCoordSys
    // Not blur self series if focus is series.
    || focus === 'series' && sameSeries
    // TODO blurScope: coordinate system
    )) {
      var view = api.getViewOfSeriesModel(seriesModel);
      view.group.traverse(function (child) {
        // For the elements that have been triggered by other components,
        // and are still required to be highlighted,
        // because the current is directly forced to blur the element,
        // it will cause the focus self to be unable to highlight, so skip the blur of this element.
        if (child.__highByOuter && sameSeries && focus === 'self') {
          return;
        }
        singleEnterBlur(child);
      });
      if (isArrayLike(focus)) {
        leaveBlurOfIndices(seriesModel.getData(), focus);
      } else if (isObject$3(focus)) {
        var dataTypes = keys(focus);
        for (var d = 0; d < dataTypes.length; d++) {
          leaveBlurOfIndices(seriesModel.getData(dataTypes[d]), focus[dataTypes[d]]);
        }
      }
      blurredSeries.push(seriesModel);
      getComponentStates(seriesModel).isBlured = true;
    }
  });
  ecModel.eachComponent(function (componentType, componentModel) {
    if (componentType === 'series') {
      return;
    }
    var view = api.getViewOfComponentModel(componentModel);
    if (view && view.toggleBlurSeries) {
      view.toggleBlurSeries(blurredSeries, true, ecModel);
    }
  });
}
function blurComponent(componentMainType, componentIndex, api) {
  if (componentMainType == null || componentIndex == null) {
    return;
  }
  var componentModel = api.getModel().getComponent(componentMainType, componentIndex);
  if (!componentModel) {
    return;
  }
  getComponentStates(componentModel).isBlured = true;
  var view = api.getViewOfComponentModel(componentModel);
  if (!view || !view.focusBlurEnabled) {
    return;
  }
  view.group.traverse(function (child) {
    singleEnterBlur(child);
  });
}
function blurSeriesFromHighlightPayload(seriesModel, payload, api) {
  var seriesIndex = seriesModel.seriesIndex;
  var data = seriesModel.getData(payload.dataType);
  if (!data) {
    {
      error("Unknown dataType " + payload.dataType);
    }
    return;
  }
  var dataIndex = queryDataIndex(data, payload);
  // Pick the first one if there is multiple/none exists.
  dataIndex = (isArray$1(dataIndex) ? dataIndex[0] : dataIndex) || 0;
  var el = data.getItemGraphicEl(dataIndex);
  if (!el) {
    var count = data.count();
    var current = 0;
    // If data on dataIndex is NaN.
    while (!el && current < count) {
      el = data.getItemGraphicEl(current++);
    }
  }
  if (el) {
    var ecData = getECData(el);
    blurSeries(seriesIndex, ecData.focus, ecData.blurScope, api);
  } else {
    // If there is no element put on the data. Try getting it from raw option
    // TODO Should put it on seriesModel?
    var focus_1 = seriesModel.get(['emphasis', 'focus']);
    var blurScope = seriesModel.get(['emphasis', 'blurScope']);
    if (focus_1 != null) {
      blurSeries(seriesIndex, focus_1, blurScope, api);
    }
  }
}
function findComponentHighDownDispatchers(componentMainType, componentIndex, name, api) {
  var ret = {
    focusSelf: false,
    dispatchers: null
  };
  if (componentMainType == null || componentMainType === 'series' || componentIndex == null || name == null) {
    return ret;
  }
  var componentModel = api.getModel().getComponent(componentMainType, componentIndex);
  if (!componentModel) {
    return ret;
  }
  var view = api.getViewOfComponentModel(componentModel);
  if (!view || !view.findHighDownDispatchers) {
    return ret;
  }
  var dispatchers = view.findHighDownDispatchers(name);
  // At presnet, the component (like Geo) only blur inside itself.
  // So we do not use `blurScope` in component.
  var focusSelf;
  for (var i = 0; i < dispatchers.length; i++) {
    if (!isHighDownDispatcher(dispatchers[i])) {
      error('param should be highDownDispatcher');
    }
    if (getECData(dispatchers[i]).focus === 'self') {
      focusSelf = true;
      break;
    }
  }
  return {
    focusSelf: focusSelf,
    dispatchers: dispatchers
  };
}
function handleGlobalMouseOverForHighDown(dispatcher, e, api) {
  if (!isHighDownDispatcher(dispatcher)) {
    error('param should be highDownDispatcher');
  }
  var ecData = getECData(dispatcher);
  var _a = findComponentHighDownDispatchers(ecData.componentMainType, ecData.componentIndex, ecData.componentHighDownName, api),
    dispatchers = _a.dispatchers,
    focusSelf = _a.focusSelf;
  // If `findHighDownDispatchers` is supported on the component,
  // highlight/downplay elements with the same name.
  if (dispatchers) {
    if (focusSelf) {
      blurComponent(ecData.componentMainType, ecData.componentIndex, api);
    }
    each$f(dispatchers, function (dispatcher) {
      return enterEmphasisWhenMouseOver(dispatcher, e);
    });
  } else {
    // Try blur all in the related series. Then emphasis the hoverred.
    // TODO. progressive mode.
    blurSeries(ecData.seriesIndex, ecData.focus, ecData.blurScope, api);
    if (ecData.focus === 'self') {
      blurComponent(ecData.componentMainType, ecData.componentIndex, api);
    }
    // Other than series, component that not support `findHighDownDispatcher` will
    // also use it. But in this case, highlight/downplay are only supported in
    // mouse hover but not in dispatchAction.
    enterEmphasisWhenMouseOver(dispatcher, e);
  }
}
function handleGlobalMouseOutForHighDown(dispatcher, e, api) {
  if (!isHighDownDispatcher(dispatcher)) {
    error('param should be highDownDispatcher');
  }
  allLeaveBlur(api);
  var ecData = getECData(dispatcher);
  var dispatchers = findComponentHighDownDispatchers(ecData.componentMainType, ecData.componentIndex, ecData.componentHighDownName, api).dispatchers;
  if (dispatchers) {
    each$f(dispatchers, function (dispatcher) {
      return leaveEmphasisWhenMouseOut(dispatcher, e);
    });
  } else {
    leaveEmphasisWhenMouseOut(dispatcher, e);
  }
}
function toggleSelectionFromPayload(seriesModel, payload, api) {
  if (!isSelectChangePayload(payload)) {
    return;
  }
  var dataType = payload.dataType;
  var data = seriesModel.getData(dataType);
  var dataIndex = queryDataIndex(data, payload);
  if (!isArray$1(dataIndex)) {
    dataIndex = [dataIndex];
  }
  seriesModel[payload.type === TOGGLE_SELECT_ACTION_TYPE ? 'toggleSelect' : payload.type === SELECT_ACTION_TYPE ? 'select' : 'unselect'](dataIndex, dataType);
}
function updateSeriesElementSelection(seriesModel) {
  var allData = seriesModel.getAllData();
  each$f(allData, function (_a) {
    var data = _a.data,
      type = _a.type;
    data.eachItemGraphicEl(function (el, idx) {
      seriesModel.isSelected(idx, type) ? enterSelect(el) : leaveSelect(el);
    });
  });
}
function getAllSelectedIndices(ecModel) {
  var ret = [];
  ecModel.eachSeries(function (seriesModel) {
    var allData = seriesModel.getAllData();
    each$f(allData, function (_a) {
      _a.data;
        var type = _a.type;
      var dataIndices = seriesModel.getSelectedDataIndices();
      if (dataIndices.length > 0) {
        var item = {
          dataIndex: dataIndices,
          seriesIndex: seriesModel.seriesIndex
        };
        if (type != null) {
          item.dataType = type;
        }
        ret.push(item);
      }
    });
  });
  return ret;
}
/**
 * Enable the function that mouseover will trigger the emphasis state.
 *
 * NOTE:
 * This function should be used on the element with dataIndex, seriesIndex.
 *
 */
function enableHoverEmphasis(el, focus, blurScope) {
  setAsHighDownDispatcher(el, true);
  traverseUpdateState(el, setDefaultStateProxy);
  enableHoverFocus(el, focus, blurScope);
}
function disableHoverEmphasis(el) {
  setAsHighDownDispatcher(el, false);
}
function toggleHoverEmphasis(el, focus, blurScope, isDisabled) {
  isDisabled ? disableHoverEmphasis(el) : enableHoverEmphasis(el, focus, blurScope);
}
function enableHoverFocus(el, focus, blurScope) {
  var ecData = getECData(el);
  if (focus != null) {
    // TODO dataIndex may be set after this function. This check is not useful.
    // if (ecData.dataIndex == null) {
    //     if (__DEV__) {
    //         console.warn('focus can only been set on element with dataIndex');
    //     }
    // }
    // else {
    ecData.focus = focus;
    ecData.blurScope = blurScope;
    // }
  } else if (ecData.focus) {
    ecData.focus = null;
  }
}
var OTHER_STATES = ['emphasis', 'blur', 'select'];
var defaultStyleGetterMap = {
  itemStyle: 'getItemStyle',
  lineStyle: 'getLineStyle',
  areaStyle: 'getAreaStyle'
};
/**
 * Set emphasis/blur/selected states of element.
 */
function setStatesStylesFromModel(el, itemModel, styleType,
// default itemStyle
getter) {
  styleType = styleType || 'itemStyle';
  for (var i = 0; i < OTHER_STATES.length; i++) {
    var stateName = OTHER_STATES[i];
    var model = itemModel.getModel([stateName, styleType]);
    var state = el.ensureState(stateName);
    // Let it throw error if getterType is not found.
    state.style = getter ? getter(model) : model[defaultStyleGetterMap[styleType]]();
  }
}
/**
 *
 * Set element as highlight / downplay dispatcher.
 * It will be checked when element received mouseover event or from highlight action.
 * It's in change of all highlight/downplay behavior of it's children.
 *
 * @param el
 * @param el.highDownSilentOnTouch
 *        In touch device, mouseover event will be trigger on touchstart event
 *        (see module:zrender/dom/HandlerProxy). By this mechanism, we can
 *        conveniently use hoverStyle when tap on touch screen without additional
 *        code for compatibility.
 *        But if the chart/component has select feature, which usually also use
 *        hoverStyle, there might be conflict between 'select-highlight' and
 *        'hover-highlight' especially when roam is enabled (see geo for example).
 *        In this case, `highDownSilentOnTouch` should be used to disable
 *        hover-highlight on touch device.
 * @param asDispatcher If `false`, do not set as "highDownDispatcher".
 */
function setAsHighDownDispatcher(el, asDispatcher) {
  var disable = asDispatcher === false;
  var extendedEl = el;
  // Make `highDownSilentOnTouch` and `onStateChange` only work after
  // `setAsHighDownDispatcher` called. Avoid it is modified by user unexpectedly.
  if (el.highDownSilentOnTouch) {
    extendedEl.__highDownSilentOnTouch = el.highDownSilentOnTouch;
  }
  // Simple optimize, since this method might be
  // called for each elements of a group in some cases.
  if (!disable || extendedEl.__highDownDispatcher) {
    // Emphasis, normal can be triggered manually by API or other components like hover link.
    // el[method]('emphasis', onElementEmphasisEvent)[method]('normal', onElementNormalEvent);
    // Also keep previous record.
    extendedEl.__highByOuter = extendedEl.__highByOuter || 0;
    extendedEl.__highDownDispatcher = !disable;
  }
}
function isHighDownDispatcher(el) {
  return !!(el && el.__highDownDispatcher);
}
/**
 * Enable component highlight/downplay features:
 * + hover link (within the same name)
 * + focus blur in component
 */
function enableComponentHighDownFeatures(el, componentModel, componentHighDownName) {
  var ecData = getECData(el);
  ecData.componentMainType = componentModel.mainType;
  ecData.componentIndex = componentModel.componentIndex;
  ecData.componentHighDownName = componentHighDownName;
}
/**
 * Support highlight/downplay record on each elements.
 * For the case: hover highlight/downplay (legend, visualMap, ...) and
 * user triggered highlight/downplay should not conflict.
 * Only all of the highlightDigit cleared, return to normal.
 * @param {string} highlightKey
 * @return {number} highlightDigit
 */
function getHighlightDigit(highlightKey) {
  var highlightDigit = _highlightKeyMap[highlightKey];
  if (highlightDigit == null && _highlightNextDigit <= 32) {
    highlightDigit = _highlightKeyMap[highlightKey] = _highlightNextDigit++;
  }
  return highlightDigit;
}
function isSelectChangePayload(payload) {
  var payloadType = payload.type;
  return payloadType === SELECT_ACTION_TYPE || payloadType === UNSELECT_ACTION_TYPE || payloadType === TOGGLE_SELECT_ACTION_TYPE;
}
function isHighDownPayload(payload) {
  var payloadType = payload.type;
  return payloadType === HIGHLIGHT_ACTION_TYPE || payloadType === DOWNPLAY_ACTION_TYPE;
}
function savePathStates(el) {
  var store = getSavedStates(el);
  store.normalFill = el.style.fill;
  store.normalStroke = el.style.stroke;
  var selectState = el.states.select || {};
  store.selectFill = selectState.style && selectState.style.fill || null;
  store.selectStroke = selectState.style && selectState.style.stroke || null;
}

var CMD$2 = PathProxy.CMD;
var points$2 = [[], [], []];
var mathSqrt$2 = Math.sqrt;
var mathAtan2 = Math.atan2;
function transformPath(path, m) {
  if (!m) {
    return;
  }
  var data = path.data;
  var len = path.len();
  var cmd;
  var nPoint;
  var i;
  var j;
  var k;
  var p;
  var M = CMD$2.M;
  var C = CMD$2.C;
  var L = CMD$2.L;
  var R = CMD$2.R;
  var A = CMD$2.A;
  var Q = CMD$2.Q;
  for (i = 0, j = 0; i < len;) {
    cmd = data[i++];
    j = i;
    nPoint = 0;
    switch (cmd) {
      case M:
        nPoint = 1;
        break;
      case L:
        nPoint = 1;
        break;
      case C:
        nPoint = 3;
        break;
      case Q:
        nPoint = 2;
        break;
      case A:
        var x = m[4];
        var y = m[5];
        var sx = mathSqrt$2(m[0] * m[0] + m[1] * m[1]);
        var sy = mathSqrt$2(m[2] * m[2] + m[3] * m[3]);
        var angle = mathAtan2(-m[1] / sy, m[0] / sx);
        data[i] *= sx;
        data[i++] += x;
        data[i] *= sy;
        data[i++] += y;
        data[i++] *= sx;
        data[i++] *= sy;
        data[i++] += angle;
        data[i++] += angle;
        i += 2;
        j = i;
        break;
      case R:
        p[0] = data[i++];
        p[1] = data[i++];
        applyTransform$1(p, p, m);
        data[j++] = p[0];
        data[j++] = p[1];
        p[0] += data[i++];
        p[1] += data[i++];
        applyTransform$1(p, p, m);
        data[j++] = p[0];
        data[j++] = p[1];
    }
    for (k = 0; k < nPoint; k++) {
      var p_1 = points$2[k];
      p_1[0] = data[i++];
      p_1[1] = data[i++];
      applyTransform$1(p_1, p_1, m);
      data[j++] = p_1[0];
      data[j++] = p_1[1];
    }
  }
  path.increaseVersion();
}

var mathSqrt$1 = Math.sqrt;
var mathSin$2 = Math.sin;
var mathCos$2 = Math.cos;
var PI$8 = Math.PI;
function vMag(v) {
  return Math.sqrt(v[0] * v[0] + v[1] * v[1]);
}
function vRatio(u, v) {
  return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));
}
function vAngle(u, v) {
  return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v));
}
function processArc(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg, cmd, path) {
  var psi = psiDeg * (PI$8 / 180.0);
  var xp = mathCos$2(psi) * (x1 - x2) / 2.0 + mathSin$2(psi) * (y1 - y2) / 2.0;
  var yp = -1 * mathSin$2(psi) * (x1 - x2) / 2.0 + mathCos$2(psi) * (y1 - y2) / 2.0;
  var lambda = xp * xp / (rx * rx) + yp * yp / (ry * ry);
  if (lambda > 1) {
    rx *= mathSqrt$1(lambda);
    ry *= mathSqrt$1(lambda);
  }
  var f = (fa === fs ? -1 : 1) * mathSqrt$1((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) / (rx * rx * (yp * yp) + ry * ry * (xp * xp))) || 0;
  var cxp = f * rx * yp / ry;
  var cyp = f * -ry * xp / rx;
  var cx = (x1 + x2) / 2.0 + mathCos$2(psi) * cxp - mathSin$2(psi) * cyp;
  var cy = (y1 + y2) / 2.0 + mathSin$2(psi) * cxp + mathCos$2(psi) * cyp;
  var theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);
  var u = [(xp - cxp) / rx, (yp - cyp) / ry];
  var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
  var dTheta = vAngle(u, v);
  if (vRatio(u, v) <= -1) {
    dTheta = PI$8;
  }
  if (vRatio(u, v) >= 1) {
    dTheta = 0;
  }
  if (dTheta < 0) {
    var n = Math.round(dTheta / PI$8 * 1e6) / 1e6;
    dTheta = PI$8 * 2 + n % 2 * PI$8;
  }
  path.addData(cmd, cx, cy, rx, ry, theta, dTheta, psi, fs);
}
var commandReg = /([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig;
var numberReg$1 = /-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;
function createPathProxyFromString(data) {
  var path = new PathProxy();
  if (!data) {
    return path;
  }
  var cpx = 0;
  var cpy = 0;
  var subpathX = cpx;
  var subpathY = cpy;
  var prevCmd;
  var CMD = PathProxy.CMD;
  var cmdList = data.match(commandReg);
  if (!cmdList) {
    return path;
  }
  for (var l = 0; l < cmdList.length; l++) {
    var cmdText = cmdList[l];
    var cmdStr = cmdText.charAt(0);
    var cmd = void 0;
    var p = cmdText.match(numberReg$1) || [];
    var pLen = p.length;
    for (var i = 0; i < pLen; i++) {
      p[i] = parseFloat(p[i]);
    }
    var off = 0;
    while (off < pLen) {
      var ctlPtx = void 0;
      var ctlPty = void 0;
      var rx = void 0;
      var ry = void 0;
      var psi = void 0;
      var fa = void 0;
      var fs = void 0;
      var x1 = cpx;
      var y1 = cpy;
      var len = void 0;
      var pathData = void 0;
      switch (cmdStr) {
        case 'l':
          cpx += p[off++];
          cpy += p[off++];
          cmd = CMD.L;
          path.addData(cmd, cpx, cpy);
          break;
        case 'L':
          cpx = p[off++];
          cpy = p[off++];
          cmd = CMD.L;
          path.addData(cmd, cpx, cpy);
          break;
        case 'm':
          cpx += p[off++];
          cpy += p[off++];
          cmd = CMD.M;
          path.addData(cmd, cpx, cpy);
          subpathX = cpx;
          subpathY = cpy;
          cmdStr = 'l';
          break;
        case 'M':
          cpx = p[off++];
          cpy = p[off++];
          cmd = CMD.M;
          path.addData(cmd, cpx, cpy);
          subpathX = cpx;
          subpathY = cpy;
          cmdStr = 'L';
          break;
        case 'h':
          cpx += p[off++];
          cmd = CMD.L;
          path.addData(cmd, cpx, cpy);
          break;
        case 'H':
          cpx = p[off++];
          cmd = CMD.L;
          path.addData(cmd, cpx, cpy);
          break;
        case 'v':
          cpy += p[off++];
          cmd = CMD.L;
          path.addData(cmd, cpx, cpy);
          break;
        case 'V':
          cpy = p[off++];
          cmd = CMD.L;
          path.addData(cmd, cpx, cpy);
          break;
        case 'C':
          cmd = CMD.C;
          path.addData(cmd, p[off++], p[off++], p[off++], p[off++], p[off++], p[off++]);
          cpx = p[off - 2];
          cpy = p[off - 1];
          break;
        case 'c':
          cmd = CMD.C;
          path.addData(cmd, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy);
          cpx += p[off - 2];
          cpy += p[off - 1];
          break;
        case 'S':
          ctlPtx = cpx;
          ctlPty = cpy;
          len = path.len();
          pathData = path.data;
          if (prevCmd === CMD.C) {
            ctlPtx += cpx - pathData[len - 4];
            ctlPty += cpy - pathData[len - 3];
          }
          cmd = CMD.C;
          x1 = p[off++];
          y1 = p[off++];
          cpx = p[off++];
          cpy = p[off++];
          path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);
          break;
        case 's':
          ctlPtx = cpx;
          ctlPty = cpy;
          len = path.len();
          pathData = path.data;
          if (prevCmd === CMD.C) {
            ctlPtx += cpx - pathData[len - 4];
            ctlPty += cpy - pathData[len - 3];
          }
          cmd = CMD.C;
          x1 = cpx + p[off++];
          y1 = cpy + p[off++];
          cpx += p[off++];
          cpy += p[off++];
          path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);
          break;
        case 'Q':
          x1 = p[off++];
          y1 = p[off++];
          cpx = p[off++];
          cpy = p[off++];
          cmd = CMD.Q;
          path.addData(cmd, x1, y1, cpx, cpy);
          break;
        case 'q':
          x1 = p[off++] + cpx;
          y1 = p[off++] + cpy;
          cpx += p[off++];
          cpy += p[off++];
          cmd = CMD.Q;
          path.addData(cmd, x1, y1, cpx, cpy);
          break;
        case 'T':
          ctlPtx = cpx;
          ctlPty = cpy;
          len = path.len();
          pathData = path.data;
          if (prevCmd === CMD.Q) {
            ctlPtx += cpx - pathData[len - 4];
            ctlPty += cpy - pathData[len - 3];
          }
          cpx = p[off++];
          cpy = p[off++];
          cmd = CMD.Q;
          path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);
          break;
        case 't':
          ctlPtx = cpx;
          ctlPty = cpy;
          len = path.len();
          pathData = path.data;
          if (prevCmd === CMD.Q) {
            ctlPtx += cpx - pathData[len - 4];
            ctlPty += cpy - pathData[len - 3];
          }
          cpx += p[off++];
          cpy += p[off++];
          cmd = CMD.Q;
          path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);
          break;
        case 'A':
          rx = p[off++];
          ry = p[off++];
          psi = p[off++];
          fa = p[off++];
          fs = p[off++];
          x1 = cpx, y1 = cpy;
          cpx = p[off++];
          cpy = p[off++];
          cmd = CMD.A;
          processArc(x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path);
          break;
        case 'a':
          rx = p[off++];
          ry = p[off++];
          psi = p[off++];
          fa = p[off++];
          fs = p[off++];
          x1 = cpx, y1 = cpy;
          cpx += p[off++];
          cpy += p[off++];
          cmd = CMD.A;
          processArc(x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path);
          break;
      }
    }
    if (cmdStr === 'z' || cmdStr === 'Z') {
      cmd = CMD.Z;
      path.addData(cmd);
      cpx = subpathX;
      cpy = subpathY;
    }
    prevCmd = cmd;
  }
  path.toStatic();
  return path;
}
var SVGPath = function (_super) {
  __extends(SVGPath, _super);
  function SVGPath() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  SVGPath.prototype.applyTransform = function (m) {};
  return SVGPath;
}(Path$1);
function isPathProxy(path) {
  return path.setData != null;
}
function createPathOptions(str, opts) {
  var pathProxy = createPathProxyFromString(str);
  var innerOpts = extend({}, opts);
  innerOpts.buildPath = function (path) {
    if (isPathProxy(path)) {
      path.setData(pathProxy.data);
      var ctx = path.getContext();
      if (ctx) {
        path.rebuildPath(ctx, 1);
      }
    } else {
      var ctx = path;
      pathProxy.rebuildPath(ctx, 1);
    }
  };
  innerOpts.applyTransform = function (m) {
    transformPath(pathProxy, m);
    this.dirtyShape();
  };
  return innerOpts;
}
function createFromString(str, opts) {
  return new SVGPath(createPathOptions(str, opts));
}
function extendFromString(str, defaultOpts) {
  var innerOpts = createPathOptions(str, defaultOpts);
  var Sub = function (_super) {
    __extends(Sub, _super);
    function Sub(opts) {
      var _this = _super.call(this, opts) || this;
      _this.applyTransform = innerOpts.applyTransform;
      _this.buildPath = innerOpts.buildPath;
      return _this;
    }
    return Sub;
  }(SVGPath);
  return Sub;
}
function mergePath$1(pathEls, opts) {
  var pathList = [];
  var len = pathEls.length;
  for (var i = 0; i < len; i++) {
    var pathEl = pathEls[i];
    pathList.push(pathEl.getUpdatedPathProxy(true));
  }
  var pathBundle = new Path$1(opts);
  pathBundle.createPathProxy();
  pathBundle.buildPath = function (path) {
    if (isPathProxy(path)) {
      path.appendPath(pathList);
      var ctx = path.getContext();
      if (ctx) {
        path.rebuildPath(ctx, 1);
      }
    }
  };
  return pathBundle;
}
function clonePath(sourcePath, opts) {
  opts = opts || {};
  var path = new Path$1();
  if (sourcePath.shape) {
    path.setShape(sourcePath.shape);
  }
  path.setStyle(sourcePath.style);
  if (opts.bakeTransform) {
    transformPath(path.path, sourcePath.getComputedTransform());
  } else {
    if (opts.toLocal) {
      path.setLocalTransform(sourcePath.getComputedTransform());
    } else {
      path.copyTransform(sourcePath);
    }
  }
  path.buildPath = sourcePath.buildPath;
  path.applyTransform = path.applyTransform;
  path.z = sourcePath.z;
  path.z2 = sourcePath.z2;
  path.zlevel = sourcePath.zlevel;
  return path;
}

var CircleShape = function () {
  function CircleShape() {
    this.cx = 0;
    this.cy = 0;
    this.r = 0;
  }
  return CircleShape;
}();
var Circle = function (_super) {
  __extends(Circle, _super);
  function Circle(opts) {
    return _super.call(this, opts) || this;
  }
  Circle.prototype.getDefaultShape = function () {
    return new CircleShape();
  };
  Circle.prototype.buildPath = function (ctx, shape) {
    ctx.moveTo(shape.cx + shape.r, shape.cy);
    ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2);
  };
  return Circle;
}(Path$1);
Circle.prototype.type = 'circle';
var Circle$1 = Circle;

var EllipseShape = function () {
  function EllipseShape() {
    this.cx = 0;
    this.cy = 0;
    this.rx = 0;
    this.ry = 0;
  }
  return EllipseShape;
}();
var Ellipse = function (_super) {
  __extends(Ellipse, _super);
  function Ellipse(opts) {
    return _super.call(this, opts) || this;
  }
  Ellipse.prototype.getDefaultShape = function () {
    return new EllipseShape();
  };
  Ellipse.prototype.buildPath = function (ctx, shape) {
    var k = 0.5522848;
    var x = shape.cx;
    var y = shape.cy;
    var a = shape.rx;
    var b = shape.ry;
    var ox = a * k;
    var oy = b * k;
    ctx.moveTo(x - a, y);
    ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
    ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
    ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
    ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
    ctx.closePath();
  };
  return Ellipse;
}(Path$1);
Ellipse.prototype.type = 'ellipse';
var Ellipse$1 = Ellipse;

var PI$7 = Math.PI;
var PI2$3 = PI$7 * 2;
var mathSin$1 = Math.sin;
var mathCos$1 = Math.cos;
var mathACos = Math.acos;
var mathATan2 = Math.atan2;
var mathAbs$1 = Math.abs;
var mathSqrt = Math.sqrt;
var mathMax$7 = Math.max;
var mathMin$7 = Math.min;
var e = 1e-4;
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
  var dx10 = x1 - x0;
  var dy10 = y1 - y0;
  var dx32 = x3 - x2;
  var dy32 = y3 - y2;
  var t = dy32 * dx10 - dx32 * dy10;
  if (t * t < e) {
    return;
  }
  t = (dx32 * (y0 - y2) - dy32 * (x0 - x2)) / t;
  return [x0 + t * dx10, y0 + t * dy10];
}
function computeCornerTangents(x0, y0, x1, y1, radius, cr, clockwise) {
  var x01 = x0 - x1;
  var y01 = y0 - y1;
  var lo = (clockwise ? cr : -cr) / mathSqrt(x01 * x01 + y01 * y01);
  var ox = lo * y01;
  var oy = -lo * x01;
  var x11 = x0 + ox;
  var y11 = y0 + oy;
  var x10 = x1 + ox;
  var y10 = y1 + oy;
  var x00 = (x11 + x10) / 2;
  var y00 = (y11 + y10) / 2;
  var dx = x10 - x11;
  var dy = y10 - y11;
  var d2 = dx * dx + dy * dy;
  var r = radius - cr;
  var s = x11 * y10 - x10 * y11;
  var d = (dy < 0 ? -1 : 1) * mathSqrt(mathMax$7(0, r * r * d2 - s * s));
  var cx0 = (s * dy - dx * d) / d2;
  var cy0 = (-s * dx - dy * d) / d2;
  var cx1 = (s * dy + dx * d) / d2;
  var cy1 = (-s * dx + dy * d) / d2;
  var dx0 = cx0 - x00;
  var dy0 = cy0 - y00;
  var dx1 = cx1 - x00;
  var dy1 = cy1 - y00;
  if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {
    cx0 = cx1;
    cy0 = cy1;
  }
  return {
    cx: cx0,
    cy: cy0,
    x0: -ox,
    y0: -oy,
    x1: cx0 * (radius / r - 1),
    y1: cy0 * (radius / r - 1)
  };
}
function normalizeCornerRadius(cr) {
  var arr;
  if (isArray$1(cr)) {
    var len = cr.length;
    if (!len) {
      return cr;
    }
    if (len === 1) {
      arr = [cr[0], cr[0], 0, 0];
    } else if (len === 2) {
      arr = [cr[0], cr[0], cr[1], cr[1]];
    } else if (len === 3) {
      arr = cr.concat(cr[2]);
    } else {
      arr = cr;
    }
  } else {
    arr = [cr, cr, cr, cr];
  }
  return arr;
}
function buildPath$1(ctx, shape) {
  var _a;
  var radius = mathMax$7(shape.r, 0);
  var innerRadius = mathMax$7(shape.r0 || 0, 0);
  var hasRadius = radius > 0;
  var hasInnerRadius = innerRadius > 0;
  if (!hasRadius && !hasInnerRadius) {
    return;
  }
  if (!hasRadius) {
    radius = innerRadius;
    innerRadius = 0;
  }
  if (innerRadius > radius) {
    var tmp = radius;
    radius = innerRadius;
    innerRadius = tmp;
  }
  var startAngle = shape.startAngle,
    endAngle = shape.endAngle;
  if (isNaN(startAngle) || isNaN(endAngle)) {
    return;
  }
  var cx = shape.cx,
    cy = shape.cy;
  var clockwise = !!shape.clockwise;
  var arc = mathAbs$1(endAngle - startAngle);
  var mod = arc > PI2$3 && arc % PI2$3;
  mod > e && (arc = mod);
  if (!(radius > e)) {
    ctx.moveTo(cx, cy);
  } else if (arc > PI2$3 - e) {
    ctx.moveTo(cx + radius * mathCos$1(startAngle), cy + radius * mathSin$1(startAngle));
    ctx.arc(cx, cy, radius, startAngle, endAngle, !clockwise);
    if (innerRadius > e) {
      ctx.moveTo(cx + innerRadius * mathCos$1(endAngle), cy + innerRadius * mathSin$1(endAngle));
      ctx.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);
    }
  } else {
    var icrStart = void 0;
    var icrEnd = void 0;
    var ocrStart = void 0;
    var ocrEnd = void 0;
    var ocrs = void 0;
    var ocre = void 0;
    var icrs = void 0;
    var icre = void 0;
    var ocrMax = void 0;
    var icrMax = void 0;
    var limitedOcrMax = void 0;
    var limitedIcrMax = void 0;
    var xre = void 0;
    var yre = void 0;
    var xirs = void 0;
    var yirs = void 0;
    var xrs = radius * mathCos$1(startAngle);
    var yrs = radius * mathSin$1(startAngle);
    var xire = innerRadius * mathCos$1(endAngle);
    var yire = innerRadius * mathSin$1(endAngle);
    var hasArc = arc > e;
    if (hasArc) {
      var cornerRadius = shape.cornerRadius;
      if (cornerRadius) {
        _a = normalizeCornerRadius(cornerRadius), icrStart = _a[0], icrEnd = _a[1], ocrStart = _a[2], ocrEnd = _a[3];
      }
      var halfRd = mathAbs$1(radius - innerRadius) / 2;
      ocrs = mathMin$7(halfRd, ocrStart);
      ocre = mathMin$7(halfRd, ocrEnd);
      icrs = mathMin$7(halfRd, icrStart);
      icre = mathMin$7(halfRd, icrEnd);
      limitedOcrMax = ocrMax = mathMax$7(ocrs, ocre);
      limitedIcrMax = icrMax = mathMax$7(icrs, icre);
      if (ocrMax > e || icrMax > e) {
        xre = radius * mathCos$1(endAngle);
        yre = radius * mathSin$1(endAngle);
        xirs = innerRadius * mathCos$1(startAngle);
        yirs = innerRadius * mathSin$1(startAngle);
        if (arc < PI$7) {
          var it_1 = intersect(xrs, yrs, xirs, yirs, xre, yre, xire, yire);
          if (it_1) {
            var x0 = xrs - it_1[0];
            var y0 = yrs - it_1[1];
            var x1 = xre - it_1[0];
            var y1 = yre - it_1[1];
            var a = 1 / mathSin$1(mathACos((x0 * x1 + y0 * y1) / (mathSqrt(x0 * x0 + y0 * y0) * mathSqrt(x1 * x1 + y1 * y1))) / 2);
            var b = mathSqrt(it_1[0] * it_1[0] + it_1[1] * it_1[1]);
            limitedOcrMax = mathMin$7(ocrMax, (radius - b) / (a + 1));
            limitedIcrMax = mathMin$7(icrMax, (innerRadius - b) / (a - 1));
          }
        }
      }
    }
    if (!hasArc) {
      ctx.moveTo(cx + xrs, cy + yrs);
    } else if (limitedOcrMax > e) {
      var crStart = mathMin$7(ocrStart, limitedOcrMax);
      var crEnd = mathMin$7(ocrEnd, limitedOcrMax);
      var ct0 = computeCornerTangents(xirs, yirs, xrs, yrs, radius, crStart, clockwise);
      var ct1 = computeCornerTangents(xre, yre, xire, yire, radius, crEnd, clockwise);
      ctx.moveTo(cx + ct0.cx + ct0.x0, cy + ct0.cy + ct0.y0);
      if (limitedOcrMax < ocrMax && crStart === crEnd) {
        ctx.arc(cx + ct0.cx, cy + ct0.cy, limitedOcrMax, mathATan2(ct0.y0, ct0.x0), mathATan2(ct1.y0, ct1.x0), !clockwise);
      } else {
        crStart > 0 && ctx.arc(cx + ct0.cx, cy + ct0.cy, crStart, mathATan2(ct0.y0, ct0.x0), mathATan2(ct0.y1, ct0.x1), !clockwise);
        ctx.arc(cx, cy, radius, mathATan2(ct0.cy + ct0.y1, ct0.cx + ct0.x1), mathATan2(ct1.cy + ct1.y1, ct1.cx + ct1.x1), !clockwise);
        crEnd > 0 && ctx.arc(cx + ct1.cx, cy + ct1.cy, crEnd, mathATan2(ct1.y1, ct1.x1), mathATan2(ct1.y0, ct1.x0), !clockwise);
      }
    } else {
      ctx.moveTo(cx + xrs, cy + yrs);
      ctx.arc(cx, cy, radius, startAngle, endAngle, !clockwise);
    }
    if (!(innerRadius > e) || !hasArc) {
      ctx.lineTo(cx + xire, cy + yire);
    } else if (limitedIcrMax > e) {
      var crStart = mathMin$7(icrStart, limitedIcrMax);
      var crEnd = mathMin$7(icrEnd, limitedIcrMax);
      var ct0 = computeCornerTangents(xire, yire, xre, yre, innerRadius, -crEnd, clockwise);
      var ct1 = computeCornerTangents(xrs, yrs, xirs, yirs, innerRadius, -crStart, clockwise);
      ctx.lineTo(cx + ct0.cx + ct0.x0, cy + ct0.cy + ct0.y0);
      if (limitedIcrMax < icrMax && crStart === crEnd) {
        ctx.arc(cx + ct0.cx, cy + ct0.cy, limitedIcrMax, mathATan2(ct0.y0, ct0.x0), mathATan2(ct1.y0, ct1.x0), !clockwise);
      } else {
        crEnd > 0 && ctx.arc(cx + ct0.cx, cy + ct0.cy, crEnd, mathATan2(ct0.y0, ct0.x0), mathATan2(ct0.y1, ct0.x1), !clockwise);
        ctx.arc(cx, cy, innerRadius, mathATan2(ct0.cy + ct0.y1, ct0.cx + ct0.x1), mathATan2(ct1.cy + ct1.y1, ct1.cx + ct1.x1), clockwise);
        crStart > 0 && ctx.arc(cx + ct1.cx, cy + ct1.cy, crStart, mathATan2(ct1.y1, ct1.x1), mathATan2(ct1.y0, ct1.x0), !clockwise);
      }
    } else {
      ctx.lineTo(cx + xire, cy + yire);
      ctx.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);
    }
  }
  ctx.closePath();
}

var SectorShape = function () {
  function SectorShape() {
    this.cx = 0;
    this.cy = 0;
    this.r0 = 0;
    this.r = 0;
    this.startAngle = 0;
    this.endAngle = Math.PI * 2;
    this.clockwise = true;
    this.cornerRadius = 0;
  }
  return SectorShape;
}();
var Sector = function (_super) {
  __extends(Sector, _super);
  function Sector(opts) {
    return _super.call(this, opts) || this;
  }
  Sector.prototype.getDefaultShape = function () {
    return new SectorShape();
  };
  Sector.prototype.buildPath = function (ctx, shape) {
    buildPath$1(ctx, shape);
  };
  Sector.prototype.isZeroArea = function () {
    return this.shape.startAngle === this.shape.endAngle || this.shape.r === this.shape.r0;
  };
  return Sector;
}(Path$1);
Sector.prototype.type = 'sector';
var Sector$1 = Sector;

var RingShape = function () {
  function RingShape() {
    this.cx = 0;
    this.cy = 0;
    this.r = 0;
    this.r0 = 0;
  }
  return RingShape;
}();
var Ring = function (_super) {
  __extends(Ring, _super);
  function Ring(opts) {
    return _super.call(this, opts) || this;
  }
  Ring.prototype.getDefaultShape = function () {
    return new RingShape();
  };
  Ring.prototype.buildPath = function (ctx, shape) {
    var x = shape.cx;
    var y = shape.cy;
    var PI2 = Math.PI * 2;
    ctx.moveTo(x + shape.r, y);
    ctx.arc(x, y, shape.r, 0, PI2, false);
    ctx.moveTo(x + shape.r0, y);
    ctx.arc(x, y, shape.r0, 0, PI2, true);
  };
  return Ring;
}(Path$1);
Ring.prototype.type = 'ring';
var Ring$1 = Ring;

function smoothBezier(points, smooth, isLoop, constraint) {
  var cps = [];
  var v = [];
  var v1 = [];
  var v2 = [];
  var prevPoint;
  var nextPoint;
  var min;
  var max;
  if (constraint) {
    min = [Infinity, Infinity];
    max = [-Infinity, -Infinity];
    for (var i = 0, len = points.length; i < len; i++) {
      min$3(min, min, points[i]);
      max$4(max, max, points[i]);
    }
    min$3(min, min, constraint[0]);
    max$4(max, max, constraint[1]);
  }
  for (var i = 0, len = points.length; i < len; i++) {
    var point = points[i];
    if (isLoop) {
      prevPoint = points[i ? i - 1 : len - 1];
      nextPoint = points[(i + 1) % len];
    } else {
      if (i === 0 || i === len - 1) {
        cps.push(clone$3(points[i]));
        continue;
      } else {
        prevPoint = points[i - 1];
        nextPoint = points[i + 1];
      }
    }
    sub$1(v, nextPoint, prevPoint);
    scale$2(v, v, smooth);
    var d0 = distance$1(point, prevPoint);
    var d1 = distance$1(point, nextPoint);
    var sum = d0 + d1;
    if (sum !== 0) {
      d0 /= sum;
      d1 /= sum;
    }
    scale$2(v1, v, -d0);
    scale$2(v2, v, d1);
    var cp0 = add$1([], point, v1);
    var cp1 = add$1([], point, v2);
    if (constraint) {
      max$4(cp0, cp0, min);
      min$3(cp0, cp0, max);
      max$4(cp1, cp1, min);
      min$3(cp1, cp1, max);
    }
    cps.push(cp0);
    cps.push(cp1);
  }
  if (isLoop) {
    cps.push(cps.shift());
  }
  return cps;
}

function buildPath(ctx, shape, closePath) {
  var smooth = shape.smooth;
  var points = shape.points;
  if (points && points.length >= 2) {
    if (smooth) {
      var controlPoints = smoothBezier(points, smooth, closePath, shape.smoothConstraint);
      ctx.moveTo(points[0][0], points[0][1]);
      var len = points.length;
      for (var i = 0; i < (closePath ? len : len - 1); i++) {
        var cp1 = controlPoints[i * 2];
        var cp2 = controlPoints[i * 2 + 1];
        var p = points[(i + 1) % len];
        ctx.bezierCurveTo(cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]);
      }
    } else {
      ctx.moveTo(points[0][0], points[0][1]);
      for (var i = 1, l = points.length; i < l; i++) {
        ctx.lineTo(points[i][0], points[i][1]);
      }
    }
    closePath && ctx.closePath();
  }
}

var PolygonShape = function () {
  function PolygonShape() {
    this.points = null;
    this.smooth = 0;
    this.smoothConstraint = null;
  }
  return PolygonShape;
}();
var Polygon = function (_super) {
  __extends(Polygon, _super);
  function Polygon(opts) {
    return _super.call(this, opts) || this;
  }
  Polygon.prototype.getDefaultShape = function () {
    return new PolygonShape();
  };
  Polygon.prototype.buildPath = function (ctx, shape) {
    buildPath(ctx, shape, true);
  };
  return Polygon;
}(Path$1);
Polygon.prototype.type = 'polygon';
var Polygon$1 = Polygon;

var PolylineShape = function () {
  function PolylineShape() {
    this.points = null;
    this.percent = 1;
    this.smooth = 0;
    this.smoothConstraint = null;
  }
  return PolylineShape;
}();
var Polyline$2 = function (_super) {
  __extends(Polyline, _super);
  function Polyline(opts) {
    return _super.call(this, opts) || this;
  }
  Polyline.prototype.getDefaultStyle = function () {
    return {
      stroke: '#000',
      fill: null
    };
  };
  Polyline.prototype.getDefaultShape = function () {
    return new PolylineShape();
  };
  Polyline.prototype.buildPath = function (ctx, shape) {
    buildPath(ctx, shape, false);
  };
  return Polyline;
}(Path$1);
Polyline$2.prototype.type = 'polyline';
var Polyline$3 = Polyline$2;

var subPixelOptimizeOutputShape = {};
var LineShape = function () {
  function LineShape() {
    this.x1 = 0;
    this.y1 = 0;
    this.x2 = 0;
    this.y2 = 0;
    this.percent = 1;
  }
  return LineShape;
}();
var Line$3 = function (_super) {
  __extends(Line, _super);
  function Line(opts) {
    return _super.call(this, opts) || this;
  }
  Line.prototype.getDefaultStyle = function () {
    return {
      stroke: '#000',
      fill: null
    };
  };
  Line.prototype.getDefaultShape = function () {
    return new LineShape();
  };
  Line.prototype.buildPath = function (ctx, shape) {
    var x1;
    var y1;
    var x2;
    var y2;
    if (this.subPixelOptimize) {
      var optimizedShape = subPixelOptimizeLine$1(subPixelOptimizeOutputShape, shape, this.style);
      x1 = optimizedShape.x1;
      y1 = optimizedShape.y1;
      x2 = optimizedShape.x2;
      y2 = optimizedShape.y2;
    } else {
      x1 = shape.x1;
      y1 = shape.y1;
      x2 = shape.x2;
      y2 = shape.y2;
    }
    var percent = shape.percent;
    if (percent === 0) {
      return;
    }
    ctx.moveTo(x1, y1);
    if (percent < 1) {
      x2 = x1 * (1 - percent) + x2 * percent;
      y2 = y1 * (1 - percent) + y2 * percent;
    }
    ctx.lineTo(x2, y2);
  };
  Line.prototype.pointAt = function (p) {
    var shape = this.shape;
    return [shape.x1 * (1 - p) + shape.x2 * p, shape.y1 * (1 - p) + shape.y2 * p];
  };
  return Line;
}(Path$1);
Line$3.prototype.type = 'line';
var Line$4 = Line$3;

var out = [];
var BezierCurveShape = function () {
  function BezierCurveShape() {
    this.x1 = 0;
    this.y1 = 0;
    this.x2 = 0;
    this.y2 = 0;
    this.cpx1 = 0;
    this.cpy1 = 0;
    this.percent = 1;
  }
  return BezierCurveShape;
}();
function someVectorAt(shape, t, isTangent) {
  var cpx2 = shape.cpx2;
  var cpy2 = shape.cpy2;
  if (cpx2 != null || cpy2 != null) {
    return [(isTangent ? cubicDerivativeAt : cubicAt)(shape.x1, shape.cpx1, shape.cpx2, shape.x2, t), (isTangent ? cubicDerivativeAt : cubicAt)(shape.y1, shape.cpy1, shape.cpy2, shape.y2, t)];
  } else {
    return [(isTangent ? quadraticDerivativeAt : quadraticAt$1)(shape.x1, shape.cpx1, shape.x2, t), (isTangent ? quadraticDerivativeAt : quadraticAt$1)(shape.y1, shape.cpy1, shape.y2, t)];
  }
}
var BezierCurve = function (_super) {
  __extends(BezierCurve, _super);
  function BezierCurve(opts) {
    return _super.call(this, opts) || this;
  }
  BezierCurve.prototype.getDefaultStyle = function () {
    return {
      stroke: '#000',
      fill: null
    };
  };
  BezierCurve.prototype.getDefaultShape = function () {
    return new BezierCurveShape();
  };
  BezierCurve.prototype.buildPath = function (ctx, shape) {
    var x1 = shape.x1;
    var y1 = shape.y1;
    var x2 = shape.x2;
    var y2 = shape.y2;
    var cpx1 = shape.cpx1;
    var cpy1 = shape.cpy1;
    var cpx2 = shape.cpx2;
    var cpy2 = shape.cpy2;
    var percent = shape.percent;
    if (percent === 0) {
      return;
    }
    ctx.moveTo(x1, y1);
    if (cpx2 == null || cpy2 == null) {
      if (percent < 1) {
        quadraticSubdivide(x1, cpx1, x2, percent, out);
        cpx1 = out[1];
        x2 = out[2];
        quadraticSubdivide(y1, cpy1, y2, percent, out);
        cpy1 = out[1];
        y2 = out[2];
      }
      ctx.quadraticCurveTo(cpx1, cpy1, x2, y2);
    } else {
      if (percent < 1) {
        cubicSubdivide(x1, cpx1, cpx2, x2, percent, out);
        cpx1 = out[1];
        cpx2 = out[2];
        x2 = out[3];
        cubicSubdivide(y1, cpy1, cpy2, y2, percent, out);
        cpy1 = out[1];
        cpy2 = out[2];
        y2 = out[3];
      }
      ctx.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x2, y2);
    }
  };
  BezierCurve.prototype.pointAt = function (t) {
    return someVectorAt(this.shape, t, false);
  };
  BezierCurve.prototype.tangentAt = function (t) {
    var p = someVectorAt(this.shape, t, true);
    return normalize$6(p, p);
  };
  return BezierCurve;
}(Path$1);
BezierCurve.prototype.type = 'bezier-curve';
var BezierCurve$1 = BezierCurve;

var ArcShape = function () {
  function ArcShape() {
    this.cx = 0;
    this.cy = 0;
    this.r = 0;
    this.startAngle = 0;
    this.endAngle = Math.PI * 2;
    this.clockwise = true;
  }
  return ArcShape;
}();
var Arc = function (_super) {
  __extends(Arc, _super);
  function Arc(opts) {
    return _super.call(this, opts) || this;
  }
  Arc.prototype.getDefaultStyle = function () {
    return {
      stroke: '#000',
      fill: null
    };
  };
  Arc.prototype.getDefaultShape = function () {
    return new ArcShape();
  };
  Arc.prototype.buildPath = function (ctx, shape) {
    var x = shape.cx;
    var y = shape.cy;
    var r = Math.max(shape.r, 0);
    var startAngle = shape.startAngle;
    var endAngle = shape.endAngle;
    var clockwise = shape.clockwise;
    var unitX = Math.cos(startAngle);
    var unitY = Math.sin(startAngle);
    ctx.moveTo(unitX * r + x, unitY * r + y);
    ctx.arc(x, y, r, startAngle, endAngle, !clockwise);
  };
  return Arc;
}(Path$1);
Arc.prototype.type = 'arc';
var Arc$1 = Arc;

var CompoundPath = function (_super) {
  __extends(CompoundPath, _super);
  function CompoundPath() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = 'compound';
    return _this;
  }
  CompoundPath.prototype._updatePathDirty = function () {
    var paths = this.shape.paths;
    var dirtyPath = this.shapeChanged();
    for (var i = 0; i < paths.length; i++) {
      dirtyPath = dirtyPath || paths[i].shapeChanged();
    }
    if (dirtyPath) {
      this.dirtyShape();
    }
  };
  CompoundPath.prototype.beforeBrush = function () {
    this._updatePathDirty();
    var paths = this.shape.paths || [];
    var scale = this.getGlobalScale();
    for (var i = 0; i < paths.length; i++) {
      if (!paths[i].path) {
        paths[i].createPathProxy();
      }
      paths[i].path.setScale(scale[0], scale[1], paths[i].segmentIgnoreThreshold);
    }
  };
  CompoundPath.prototype.buildPath = function (ctx, shape) {
    var paths = shape.paths || [];
    for (var i = 0; i < paths.length; i++) {
      paths[i].buildPath(ctx, paths[i].shape, true);
    }
  };
  CompoundPath.prototype.afterBrush = function () {
    var paths = this.shape.paths || [];
    for (var i = 0; i < paths.length; i++) {
      paths[i].pathUpdated();
    }
  };
  CompoundPath.prototype.getBoundingRect = function () {
    this._updatePathDirty.call(this);
    return Path$1.prototype.getBoundingRect.call(this);
  };
  return CompoundPath;
}(Path$1);
var CompoundPath$1 = CompoundPath;

var Gradient = function () {
  function Gradient(colorStops) {
    this.colorStops = colorStops || [];
  }
  Gradient.prototype.addColorStop = function (offset, color) {
    this.colorStops.push({
      offset: offset,
      color: color
    });
  };
  return Gradient;
}();
var Gradient$1 = Gradient;

var LinearGradient = function (_super) {
  __extends(LinearGradient, _super);
  function LinearGradient(x, y, x2, y2, colorStops, globalCoord) {
    var _this = _super.call(this, colorStops) || this;
    _this.x = x == null ? 0 : x;
    _this.y = y == null ? 0 : y;
    _this.x2 = x2 == null ? 1 : x2;
    _this.y2 = y2 == null ? 0 : y2;
    _this.type = 'linear';
    _this.global = globalCoord || false;
    return _this;
  }
  return LinearGradient;
}(Gradient$1);
var LinearGradient$1 = LinearGradient;

var RadialGradient = function (_super) {
  __extends(RadialGradient, _super);
  function RadialGradient(x, y, r, colorStops, globalCoord) {
    var _this = _super.call(this, colorStops) || this;
    _this.x = x == null ? 0.5 : x;
    _this.y = y == null ? 0.5 : y;
    _this.r = r == null ? 0.5 : r;
    _this.type = 'radial';
    _this.global = globalCoord || false;
    return _this;
  }
  return RadialGradient;
}(Gradient$1);
var RadialGradient$1 = RadialGradient;

var extent = [0, 0];
var extent2 = [0, 0];
var minTv = new Point$1();
var maxTv = new Point$1();
var OrientedBoundingRect = function () {
  function OrientedBoundingRect(rect, transform) {
    this._corners = [];
    this._axes = [];
    this._origin = [0, 0];
    for (var i = 0; i < 4; i++) {
      this._corners[i] = new Point$1();
    }
    for (var i = 0; i < 2; i++) {
      this._axes[i] = new Point$1();
    }
    if (rect) {
      this.fromBoundingRect(rect, transform);
    }
  }
  OrientedBoundingRect.prototype.fromBoundingRect = function (rect, transform) {
    var corners = this._corners;
    var axes = this._axes;
    var x = rect.x;
    var y = rect.y;
    var x2 = x + rect.width;
    var y2 = y + rect.height;
    corners[0].set(x, y);
    corners[1].set(x2, y);
    corners[2].set(x2, y2);
    corners[3].set(x, y2);
    if (transform) {
      for (var i = 0; i < 4; i++) {
        corners[i].transform(transform);
      }
    }
    Point$1.sub(axes[0], corners[1], corners[0]);
    Point$1.sub(axes[1], corners[3], corners[0]);
    axes[0].normalize();
    axes[1].normalize();
    for (var i = 0; i < 2; i++) {
      this._origin[i] = axes[i].dot(corners[0]);
    }
  };
  OrientedBoundingRect.prototype.intersect = function (other, mtv) {
    var overlapped = true;
    var noMtv = !mtv;
    minTv.set(Infinity, Infinity);
    maxTv.set(0, 0);
    if (!this._intersectCheckOneSide(this, other, minTv, maxTv, noMtv, 1)) {
      overlapped = false;
      if (noMtv) {
        return overlapped;
      }
    }
    if (!this._intersectCheckOneSide(other, this, minTv, maxTv, noMtv, -1)) {
      overlapped = false;
      if (noMtv) {
        return overlapped;
      }
    }
    if (!noMtv) {
      Point$1.copy(mtv, overlapped ? minTv : maxTv);
    }
    return overlapped;
  };
  OrientedBoundingRect.prototype._intersectCheckOneSide = function (self, other, minTv, maxTv, noMtv, inverse) {
    var overlapped = true;
    for (var i = 0; i < 2; i++) {
      var axis = this._axes[i];
      this._getProjMinMaxOnAxis(i, self._corners, extent);
      this._getProjMinMaxOnAxis(i, other._corners, extent2);
      if (extent[1] < extent2[0] || extent[0] > extent2[1]) {
        overlapped = false;
        if (noMtv) {
          return overlapped;
        }
        var dist0 = Math.abs(extent2[0] - extent[1]);
        var dist1 = Math.abs(extent[0] - extent2[1]);
        if (Math.min(dist0, dist1) > maxTv.len()) {
          if (dist0 < dist1) {
            Point$1.scale(maxTv, axis, -dist0 * inverse);
          } else {
            Point$1.scale(maxTv, axis, dist1 * inverse);
          }
        }
      } else if (minTv) {
        var dist0 = Math.abs(extent2[0] - extent[1]);
        var dist1 = Math.abs(extent[0] - extent2[1]);
        if (Math.min(dist0, dist1) < minTv.len()) {
          if (dist0 < dist1) {
            Point$1.scale(minTv, axis, dist0 * inverse);
          } else {
            Point$1.scale(minTv, axis, -dist1 * inverse);
          }
        }
      }
    }
    return overlapped;
  };
  OrientedBoundingRect.prototype._getProjMinMaxOnAxis = function (dim, corners, out) {
    var axis = this._axes[dim];
    var origin = this._origin;
    var proj = corners[0].dot(axis) + origin[dim];
    var min = proj;
    var max = proj;
    for (var i = 1; i < corners.length; i++) {
      var proj_1 = corners[i].dot(axis) + origin[dim];
      min = Math.min(proj_1, min);
      max = Math.max(proj_1, max);
    }
    out[0] = min;
    out[1] = max;
  };
  return OrientedBoundingRect;
}();
var OrientedBoundingRect$1 = OrientedBoundingRect;

var m = [];
var IncrementalDisplayable = function (_super) {
  __extends(IncrementalDisplayable, _super);
  function IncrementalDisplayable() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.notClear = true;
    _this.incremental = true;
    _this._displayables = [];
    _this._temporaryDisplayables = [];
    _this._cursor = 0;
    return _this;
  }
  IncrementalDisplayable.prototype.traverse = function (cb, context) {
    cb.call(context, this);
  };
  IncrementalDisplayable.prototype.useStyle = function () {
    this.style = {};
  };
  IncrementalDisplayable.prototype.getCursor = function () {
    return this._cursor;
  };
  IncrementalDisplayable.prototype.innerAfterBrush = function () {
    this._cursor = this._displayables.length;
  };
  IncrementalDisplayable.prototype.clearDisplaybles = function () {
    this._displayables = [];
    this._temporaryDisplayables = [];
    this._cursor = 0;
    this.markRedraw();
    this.notClear = false;
  };
  IncrementalDisplayable.prototype.clearTemporalDisplayables = function () {
    this._temporaryDisplayables = [];
  };
  IncrementalDisplayable.prototype.addDisplayable = function (displayable, notPersistent) {
    if (notPersistent) {
      this._temporaryDisplayables.push(displayable);
    } else {
      this._displayables.push(displayable);
    }
    this.markRedraw();
  };
  IncrementalDisplayable.prototype.addDisplayables = function (displayables, notPersistent) {
    notPersistent = notPersistent || false;
    for (var i = 0; i < displayables.length; i++) {
      this.addDisplayable(displayables[i], notPersistent);
    }
  };
  IncrementalDisplayable.prototype.getDisplayables = function () {
    return this._displayables;
  };
  IncrementalDisplayable.prototype.getTemporalDisplayables = function () {
    return this._temporaryDisplayables;
  };
  IncrementalDisplayable.prototype.eachPendingDisplayable = function (cb) {
    for (var i = this._cursor; i < this._displayables.length; i++) {
      cb && cb(this._displayables[i]);
    }
    for (var i = 0; i < this._temporaryDisplayables.length; i++) {
      cb && cb(this._temporaryDisplayables[i]);
    }
  };
  IncrementalDisplayable.prototype.update = function () {
    this.updateTransform();
    for (var i = this._cursor; i < this._displayables.length; i++) {
      var displayable = this._displayables[i];
      displayable.parent = this;
      displayable.update();
      displayable.parent = null;
    }
    for (var i = 0; i < this._temporaryDisplayables.length; i++) {
      var displayable = this._temporaryDisplayables[i];
      displayable.parent = this;
      displayable.update();
      displayable.parent = null;
    }
  };
  IncrementalDisplayable.prototype.getBoundingRect = function () {
    if (!this._rect) {
      var rect = new BoundingRect$1(Infinity, Infinity, -Infinity, -Infinity);
      for (var i = 0; i < this._displayables.length; i++) {
        var displayable = this._displayables[i];
        var childRect = displayable.getBoundingRect().clone();
        if (displayable.needLocalTransform()) {
          childRect.applyTransform(displayable.getLocalTransform(m));
        }
        rect.union(childRect);
      }
      this._rect = rect;
    }
    return this._rect;
  };
  IncrementalDisplayable.prototype.contain = function (x, y) {
    var localPos = this.transformCoordToLocal(x, y);
    var rect = this.getBoundingRect();
    if (rect.contain(localPos[0], localPos[1])) {
      for (var i = 0; i < this._displayables.length; i++) {
        var displayable = this._displayables[i];
        if (displayable.contain(x, y)) {
          return true;
        }
      }
    }
    return false;
  };
  return IncrementalDisplayable;
}(Displayable$1);
var IncrementalDisplayable$1 = IncrementalDisplayable;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Stored properties for further transition.
var transitionStore = makeInner();
/**
 * Return null if animation is disabled.
 */
function getAnimationConfig(animationType, animatableModel, dataIndex,
// Extra opts can override the option in animatable model.
extraOpts,
// TODO It's only for pictorial bar now.
extraDelayParams) {
  var animationPayload;
  // Check if there is global animation configuration from dataZoom/resize can override the config in option.
  // If animation is enabled. Will use this animation config in payload.
  // If animation is disabled. Just ignore it.
  if (animatableModel && animatableModel.ecModel) {
    var updatePayload = animatableModel.ecModel.getUpdatePayload();
    animationPayload = updatePayload && updatePayload.animation;
  }
  var animationEnabled = animatableModel && animatableModel.isAnimationEnabled();
  var isUpdate = animationType === 'update';
  if (animationEnabled) {
    var duration = void 0;
    var easing = void 0;
    var delay = void 0;
    if (extraOpts) {
      duration = retrieve2(extraOpts.duration, 200);
      easing = retrieve2(extraOpts.easing, 'cubicOut');
      delay = 0;
    } else {
      duration = animatableModel.getShallow(isUpdate ? 'animationDurationUpdate' : 'animationDuration');
      easing = animatableModel.getShallow(isUpdate ? 'animationEasingUpdate' : 'animationEasing');
      delay = animatableModel.getShallow(isUpdate ? 'animationDelayUpdate' : 'animationDelay');
    }
    // animation from payload has highest priority.
    if (animationPayload) {
      animationPayload.duration != null && (duration = animationPayload.duration);
      animationPayload.easing != null && (easing = animationPayload.easing);
      animationPayload.delay != null && (delay = animationPayload.delay);
    }
    if (isFunction(delay)) {
      delay = delay(dataIndex, extraDelayParams);
    }
    if (isFunction(duration)) {
      duration = duration(dataIndex);
    }
    var config = {
      duration: duration || 0,
      delay: delay,
      easing: easing
    };
    return config;
  } else {
    return null;
  }
}
function animateOrSetProps(animationType, el, props, animatableModel, dataIndex, cb, during) {
  var isFrom = false;
  var removeOpt;
  if (isFunction(dataIndex)) {
    during = cb;
    cb = dataIndex;
    dataIndex = null;
  } else if (isObject$3(dataIndex)) {
    cb = dataIndex.cb;
    during = dataIndex.during;
    isFrom = dataIndex.isFrom;
    removeOpt = dataIndex.removeOpt;
    dataIndex = dataIndex.dataIndex;
  }
  var isRemove = animationType === 'leave';
  if (!isRemove) {
    // Must stop the remove animation.
    el.stopAnimation('leave');
  }
  var animationConfig = getAnimationConfig(animationType, animatableModel, dataIndex, isRemove ? removeOpt || {} : null, animatableModel && animatableModel.getAnimationDelayParams ? animatableModel.getAnimationDelayParams(el, dataIndex) : null);
  if (animationConfig && animationConfig.duration > 0) {
    var duration = animationConfig.duration;
    var animationDelay = animationConfig.delay;
    var animationEasing = animationConfig.easing;
    var animateConfig = {
      duration: duration,
      delay: animationDelay || 0,
      easing: animationEasing,
      done: cb,
      force: !!cb || !!during,
      // Set to final state in update/init animation.
      // So the post processing based on the path shape can be done correctly.
      setToFinal: !isRemove,
      scope: animationType,
      during: during
    };
    isFrom ? el.animateFrom(props, animateConfig) : el.animateTo(props, animateConfig);
  } else {
    el.stopAnimation();
    // If `isFrom`, the props is the "from" props.
    !isFrom && el.attr(props);
    // Call during at least once.
    during && during(1);
    cb && cb();
  }
}
/**
 * Update graphic element properties with or without animation according to the
 * configuration in series.
 *
 * Caution: this method will stop previous animation.
 * So do not use this method to one element twice before
 * animation starts, unless you know what you are doing.
 * @example
 *     graphic.updateProps(el, {
 *         position: [100, 100]
 *     }, seriesModel, dataIndex, function () { console.log('Animation done!'); });
 *     // Or
 *     graphic.updateProps(el, {
 *         position: [100, 100]
 *     }, seriesModel, function () { console.log('Animation done!'); });
 */
function updateProps$1(el, props,
// TODO: TYPE AnimatableModel
animatableModel, dataIndex, cb, during) {
  animateOrSetProps('update', el, props, animatableModel, dataIndex, cb, during);
}
/**
 * Init graphic element properties with or without animation according to the
 * configuration in series.
 *
 * Caution: this method will stop previous animation.
 * So do not use this method to one element twice before
 * animation starts, unless you know what you are doing.
 */
function initProps(el, props, animatableModel, dataIndex, cb, during) {
  animateOrSetProps('enter', el, props, animatableModel, dataIndex, cb, during);
}
/**
 * If element is removed.
 * It can determine if element is having remove animation.
 */
function isElementRemoved(el) {
  if (!el.__zr) {
    return true;
  }
  for (var i = 0; i < el.animators.length; i++) {
    var animator = el.animators[i];
    if (animator.scope === 'leave') {
      return true;
    }
  }
  return false;
}
/**
 * Remove graphic element
 */
function removeElement(el, props, animatableModel, dataIndex, cb, during) {
  // Don't do remove animation twice.
  if (isElementRemoved(el)) {
    return;
  }
  animateOrSetProps('leave', el, props, animatableModel, dataIndex, cb, during);
}
function fadeOutDisplayable(el, animatableModel, dataIndex, done) {
  el.removeTextContent();
  el.removeTextGuideLine();
  removeElement(el, {
    style: {
      opacity: 0
    }
  }, animatableModel, dataIndex, done);
}
function removeElementWithFadeOut(el, animatableModel, dataIndex) {
  function doRemove() {
    el.parent && el.parent.remove(el);
  }
  // Hide label and labelLine first
  // TODO Also use fade out animation?
  if (!el.isGroup) {
    fadeOutDisplayable(el, animatableModel, dataIndex, doRemove);
  } else {
    el.traverse(function (disp) {
      if (!disp.isGroup) {
        // Can invoke doRemove multiple times.
        fadeOutDisplayable(disp, animatableModel, dataIndex, doRemove);
      }
    });
  }
}
/**
 * Save old style for style transition in universalTransition module.
 * It's used when element will be reused in each render.
 * For chart like map, heatmap, which will always create new element.
 * We don't need to save this because universalTransition can get old style from the old element
 */
function saveOldStyle(el) {
  transitionStore(el).oldStyle = el.style;
}
function getOldStyle(el) {
  return transitionStore(el).oldStyle;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var mathMax$6 = Math.max;
var mathMin$6 = Math.min;
var _customShapeMap = {};
/**
 * Extend shape with parameters
 */
function extendShape(opts) {
  return Path$1.extend(opts);
}
var extendPathFromString = extendFromString;
/**
 * Extend path
 */
function extendPath(pathData, opts) {
  return extendPathFromString(pathData, opts);
}
/**
 * Register a user defined shape.
 * The shape class can be fetched by `getShapeClass`
 * This method will overwrite the registered shapes, including
 * the registered built-in shapes, if using the same `name`.
 * The shape can be used in `custom series` and
 * `graphic component` by declaring `{type: name}`.
 *
 * @param name
 * @param ShapeClass Can be generated by `extendShape`.
 */
function registerShape(name, ShapeClass) {
  _customShapeMap[name] = ShapeClass;
}
/**
 * Find shape class registered by `registerShape`. Usually used in
 * fetching user defined shape.
 *
 * [Caution]:
 * (1) This method **MUST NOT be used inside echarts !!!**, unless it is prepared
 * to use user registered shapes.
 * Because the built-in shape (see `getBuiltInShape`) will be registered by
 * `registerShape` by default. That enables users to get both built-in
 * shapes as well as the shapes belonging to themsleves. But users can overwrite
 * the built-in shapes by using names like 'circle', 'rect' via calling
 * `registerShape`. So the echarts inner featrues should not fetch shapes from here
 * in case that it is overwritten by users, except that some features, like
 * `custom series`, `graphic component`, do it deliberately.
 *
 * (2) In the features like `custom series`, `graphic component`, the user input
 * `{tpye: 'xxx'}` does not only specify shapes but also specify other graphic
 * elements like `'group'`, `'text'`, `'image'` or event `'path'`. Those names
 * are reserved names, that is, if some user registers a shape named `'image'`,
 * the shape will not be used. If we intending to add some more reserved names
 * in feature, that might bring break changes (disable some existing user shape
 * names). But that case probably rarely happens. So we don't make more mechanism
 * to resolve this issue here.
 *
 * @param name
 * @return The shape class. If not found, return nothing.
 */
function getShapeClass(name) {
  if (_customShapeMap.hasOwnProperty(name)) {
    return _customShapeMap[name];
  }
}
/**
 * Create a path element from path data string
 * @param pathData
 * @param opts
 * @param rect
 * @param layout 'center' or 'cover' default to be cover
 */
function makePath(pathData, opts, rect, layout) {
  var path = createFromString(pathData, opts);
  if (rect) {
    if (layout === 'center') {
      rect = centerGraphic(rect, path.getBoundingRect());
    }
    resizePath(path, rect);
  }
  return path;
}
/**
 * Create a image element from image url
 * @param imageUrl image url
 * @param opts options
 * @param rect constrain rect
 * @param layout 'center' or 'cover'. Default to be 'cover'
 */
function makeImage(imageUrl, rect, layout) {
  var zrImg = new ZRImage$1({
    style: {
      image: imageUrl,
      x: rect.x,
      y: rect.y,
      width: rect.width,
      height: rect.height
    },
    onload: function (img) {
      if (layout === 'center') {
        var boundingRect = {
          width: img.width,
          height: img.height
        };
        zrImg.setStyle(centerGraphic(rect, boundingRect));
      }
    }
  });
  return zrImg;
}
/**
 * Get position of centered element in bounding box.
 *
 * @param  rect         element local bounding box
 * @param  boundingRect constraint bounding box
 * @return element position containing x, y, width, and height
 */
function centerGraphic(rect, boundingRect) {
  // Set rect to center, keep width / height ratio.
  var aspect = boundingRect.width / boundingRect.height;
  var width = rect.height * aspect;
  var height;
  if (width <= rect.width) {
    height = rect.height;
  } else {
    width = rect.width;
    height = width / aspect;
  }
  var cx = rect.x + rect.width / 2;
  var cy = rect.y + rect.height / 2;
  return {
    x: cx - width / 2,
    y: cy - height / 2,
    width: width,
    height: height
  };
}
var mergePath = mergePath$1;
/**
 * Resize a path to fit the rect
 * @param path
 * @param rect
 */
function resizePath(path, rect) {
  if (!path.applyTransform) {
    return;
  }
  var pathRect = path.getBoundingRect();
  var m = pathRect.calculateTransform(rect);
  path.applyTransform(m);
}
/**
 * Sub pixel optimize line for canvas
 */
function subPixelOptimizeLine(shape, lineWidth) {
  subPixelOptimizeLine$1(shape, shape, {
    lineWidth: lineWidth
  });
  return shape;
}
/**
 * Sub pixel optimize rect for canvas
 */
function subPixelOptimizeRect(param) {
  subPixelOptimizeRect$1(param.shape, param.shape, param.style);
  return param;
}
/**
 * Sub pixel optimize for canvas
 *
 * @param position Coordinate, such as x, y
 * @param lineWidth Should be nonnegative integer.
 * @param positiveOrNegative Default false (negative).
 * @return Optimized position.
 */
var subPixelOptimize = subPixelOptimize$1;
/**
 * Get transform matrix of target (param target),
 * in coordinate of its ancestor (param ancestor)
 *
 * @param target
 * @param [ancestor]
 */
function getTransform$1(target, ancestor) {
  var mat = identity([]);
  while (target && target !== ancestor) {
    mul$1(mat, target.getLocalTransform(), mat);
    target = target.parent;
  }
  return mat;
}
/**
 * Apply transform to an vertex.
 * @param target [x, y]
 * @param transform Can be:
 *      + Transform matrix: like [1, 0, 0, 1, 0, 0]
 *      + {position, rotation, scale}, the same as `zrender/Transformable`.
 * @param invert Whether use invert matrix.
 * @return [x, y]
 */
function applyTransform(target, transform, invert$1) {
  if (transform && !isArrayLike(transform)) {
    transform = Transformable$1.getLocalTransform(transform);
  }
  if (invert$1) {
    transform = invert([], transform);
  }
  return applyTransform$1([], target, transform);
}
/**
 * @param direction 'left' 'right' 'top' 'bottom'
 * @param transform Transform matrix: like [1, 0, 0, 1, 0, 0]
 * @param invert Whether use invert matrix.
 * @return Transformed direction. 'left' 'right' 'top' 'bottom'
 */
function transformDirection$1(direction, transform, invert) {
  // Pick a base, ensure that transform result will not be (0, 0).
  var hBase = transform[4] === 0 || transform[5] === 0 || transform[0] === 0 ? 1 : Math.abs(2 * transform[4] / transform[0]);
  var vBase = transform[4] === 0 || transform[5] === 0 || transform[2] === 0 ? 1 : Math.abs(2 * transform[4] / transform[2]);
  var vertex = [direction === 'left' ? -hBase : direction === 'right' ? hBase : 0, direction === 'top' ? -vBase : direction === 'bottom' ? vBase : 0];
  vertex = applyTransform(vertex, transform, invert);
  return Math.abs(vertex[0]) > Math.abs(vertex[1]) ? vertex[0] > 0 ? 'right' : 'left' : vertex[1] > 0 ? 'bottom' : 'top';
}
function isNotGroup(el) {
  return !el.isGroup;
}
function isPath$1(el) {
  return el.shape != null;
}
/**
 * Apply group transition animation from g1 to g2.
 * If no animatableModel, no animation.
 */
function groupTransition(g1, g2, animatableModel) {
  if (!g1 || !g2) {
    return;
  }
  function getElMap(g) {
    var elMap = {};
    g.traverse(function (el) {
      if (isNotGroup(el) && el.anid) {
        elMap[el.anid] = el;
      }
    });
    return elMap;
  }
  function getAnimatableProps(el) {
    var obj = {
      x: el.x,
      y: el.y,
      rotation: el.rotation
    };
    if (isPath$1(el)) {
      obj.shape = extend({}, el.shape);
    }
    return obj;
  }
  var elMap1 = getElMap(g1);
  g2.traverse(function (el) {
    if (isNotGroup(el) && el.anid) {
      var oldEl = elMap1[el.anid];
      if (oldEl) {
        var newProp = getAnimatableProps(el);
        el.attr(getAnimatableProps(oldEl));
        updateProps$1(el, newProp, animatableModel, getECData(el).dataIndex);
      }
    }
  });
}
function clipPointsByRect(points, rect) {
  // FIXME: This way might be incorrect when graphic clipped by a corner
  // and when element has a border.
  return map$1(points, function (point) {
    var x = point[0];
    x = mathMax$6(x, rect.x);
    x = mathMin$6(x, rect.x + rect.width);
    var y = point[1];
    y = mathMax$6(y, rect.y);
    y = mathMin$6(y, rect.y + rect.height);
    return [x, y];
  });
}
/**
 * Return a new clipped rect. If rect size are negative, return undefined.
 */
function clipRectByRect(targetRect, rect) {
  var x = mathMax$6(targetRect.x, rect.x);
  var x2 = mathMin$6(targetRect.x + targetRect.width, rect.x + rect.width);
  var y = mathMax$6(targetRect.y, rect.y);
  var y2 = mathMin$6(targetRect.y + targetRect.height, rect.y + rect.height);
  // If the total rect is cliped, nothing, including the border,
  // should be painted. So return undefined.
  if (x2 >= x && y2 >= y) {
    return {
      x: x,
      y: y,
      width: x2 - x,
      height: y2 - y
    };
  }
}
function createIcon(iconStr,
// Support 'image://' or 'path://' or direct svg path.
opt, rect) {
  var innerOpts = extend({
    rectHover: true
  }, opt);
  var style = innerOpts.style = {
    strokeNoScale: true
  };
  rect = rect || {
    x: -1,
    y: -1,
    width: 2,
    height: 2
  };
  if (iconStr) {
    return iconStr.indexOf('image://') === 0 ? (style.image = iconStr.slice(8), defaults(style, rect), new ZRImage$1(innerOpts)) : makePath(iconStr.replace('path://', ''), innerOpts, rect, 'center');
  }
}
/**
 * Return `true` if the given line (line `a`) and the given polygon
 * are intersect.
 * Note that we do not count colinear as intersect here because no
 * requirement for that. We could do that if required in future.
 */
function linePolygonIntersect(a1x, a1y, a2x, a2y, points) {
  for (var i = 0, p2 = points[points.length - 1]; i < points.length; i++) {
    var p = points[i];
    if (lineLineIntersect$1(a1x, a1y, a2x, a2y, p[0], p[1], p2[0], p2[1])) {
      return true;
    }
    p2 = p;
  }
}
/**
 * Return `true` if the given two lines (line `a` and line `b`)
 * are intersect.
 * Note that we do not count colinear as intersect here because no
 * requirement for that. We could do that if required in future.
 */
function lineLineIntersect$1(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) {
  // let `vec_m` to be `vec_a2 - vec_a1` and `vec_n` to be `vec_b2 - vec_b1`.
  var mx = a2x - a1x;
  var my = a2y - a1y;
  var nx = b2x - b1x;
  var ny = b2y - b1y;
  // `vec_m` and `vec_n` are parallel iff
  //     existing `k` such that `vec_m = k · vec_n`, equivalent to `vec_m X vec_n = 0`.
  var nmCrossProduct = crossProduct2d$1(nx, ny, mx, my);
  if (nearZero(nmCrossProduct)) {
    return false;
  }
  // `vec_m` and `vec_n` are intersect iff
  //     existing `p` and `q` in [0, 1] such that `vec_a1 + p * vec_m = vec_b1 + q * vec_n`,
  //     such that `q = ((vec_a1 - vec_b1) X vec_m) / (vec_n X vec_m)`
  //           and `p = ((vec_a1 - vec_b1) X vec_n) / (vec_n X vec_m)`.
  var b1a1x = a1x - b1x;
  var b1a1y = a1y - b1y;
  var q = crossProduct2d$1(b1a1x, b1a1y, mx, my) / nmCrossProduct;
  if (q < 0 || q > 1) {
    return false;
  }
  var p = crossProduct2d$1(b1a1x, b1a1y, nx, ny) / nmCrossProduct;
  if (p < 0 || p > 1) {
    return false;
  }
  return true;
}
/**
 * Cross product of 2-dimension vector.
 */
function crossProduct2d$1(x1, y1, x2, y2) {
  return x1 * y2 - x2 * y1;
}
function nearZero(val) {
  return val <= 1e-6 && val >= -1e-6;
}
function setTooltipConfig(opt) {
  var itemTooltipOption = opt.itemTooltipOption;
  var componentModel = opt.componentModel;
  var itemName = opt.itemName;
  var itemTooltipOptionObj = isString(itemTooltipOption) ? {
    formatter: itemTooltipOption
  } : itemTooltipOption;
  var mainType = componentModel.mainType;
  var componentIndex = componentModel.componentIndex;
  var formatterParams = {
    componentType: mainType,
    name: itemName,
    $vars: ['name']
  };
  formatterParams[mainType + 'Index'] = componentIndex;
  var formatterParamsExtra = opt.formatterParamsExtra;
  if (formatterParamsExtra) {
    each$f(keys(formatterParamsExtra), function (key) {
      if (!hasOwn(formatterParams, key)) {
        formatterParams[key] = formatterParamsExtra[key];
        formatterParams.$vars.push(key);
      }
    });
  }
  var ecData = getECData(opt.el);
  ecData.componentMainType = mainType;
  ecData.componentIndex = componentIndex;
  ecData.tooltipConfig = {
    name: itemName,
    option: defaults({
      content: itemName,
      encodeHTMLContent: true,
      formatterParams: formatterParams
    }, itemTooltipOptionObj)
  };
}
function traverseElement(el, cb) {
  var stopped;
  // TODO
  // Polyfill for fixing zrender group traverse don't visit it's root issue.
  if (el.isGroup) {
    stopped = cb(el);
  }
  if (!stopped) {
    el.traverse(cb);
  }
}
function traverseElements(els, cb) {
  if (els) {
    if (isArray$1(els)) {
      for (var i = 0; i < els.length; i++) {
        traverseElement(els[i], cb);
      }
    } else {
      traverseElement(els, cb);
    }
  }
}
// Register built-in shapes. These shapes might be overwritten
// by users, although we do not recommend that.
registerShape('circle', Circle$1);
registerShape('ellipse', Ellipse$1);
registerShape('sector', Sector$1);
registerShape('ring', Ring$1);
registerShape('polygon', Polygon$1);
registerShape('polyline', Polyline$3);
registerShape('rect', Rect$3);
registerShape('line', Line$4);
registerShape('bezierCurve', BezierCurve$1);
registerShape('arc', Arc$1);

var graphic = /*#__PURE__*/Object.freeze({
  __proto__: null,
  updateProps: updateProps$1,
  initProps: initProps,
  removeElement: removeElement,
  removeElementWithFadeOut: removeElementWithFadeOut,
  isElementRemoved: isElementRemoved,
  extendShape: extendShape,
  extendPath: extendPath,
  registerShape: registerShape,
  getShapeClass: getShapeClass,
  makePath: makePath,
  makeImage: makeImage,
  mergePath: mergePath,
  resizePath: resizePath,
  subPixelOptimizeLine: subPixelOptimizeLine,
  subPixelOptimizeRect: subPixelOptimizeRect,
  subPixelOptimize: subPixelOptimize,
  getTransform: getTransform$1,
  applyTransform: applyTransform,
  transformDirection: transformDirection$1,
  groupTransition: groupTransition,
  clipPointsByRect: clipPointsByRect,
  clipRectByRect: clipRectByRect,
  createIcon: createIcon,
  linePolygonIntersect: linePolygonIntersect,
  lineLineIntersect: lineLineIntersect$1,
  setTooltipConfig: setTooltipConfig,
  traverseElements: traverseElements,
  Group: Group$5,
  Image: ZRImage$1,
  Text: ZRText$1,
  Circle: Circle$1,
  Ellipse: Ellipse$1,
  Sector: Sector$1,
  Ring: Ring$1,
  Polygon: Polygon$1,
  Polyline: Polyline$3,
  Rect: Rect$3,
  Line: Line$4,
  BezierCurve: BezierCurve$1,
  Arc: Arc$1,
  IncrementalDisplayable: IncrementalDisplayable$1,
  CompoundPath: CompoundPath$1,
  LinearGradient: LinearGradient$1,
  RadialGradient: RadialGradient$1,
  BoundingRect: BoundingRect$1,
  OrientedBoundingRect: OrientedBoundingRect$1,
  Point: Point$1,
  Path: Path$1
});

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var EMPTY_OBJ = {};
function setLabelText(label, labelTexts) {
  for (var i = 0; i < SPECIAL_STATES.length; i++) {
    var stateName = SPECIAL_STATES[i];
    var text = labelTexts[stateName];
    var state = label.ensureState(stateName);
    state.style = state.style || {};
    state.style.text = text;
  }
  var oldStates = label.currentStates.slice();
  label.clearStates(true);
  label.setStyle({
    text: labelTexts.normal
  });
  label.useStates(oldStates, true);
}
function getLabelText(opt, stateModels, interpolatedValue) {
  var labelFetcher = opt.labelFetcher;
  var labelDataIndex = opt.labelDataIndex;
  var labelDimIndex = opt.labelDimIndex;
  var normalModel = stateModels.normal;
  var baseText;
  if (labelFetcher) {
    baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, normalModel && normalModel.get('formatter'), interpolatedValue != null ? {
      interpolatedValue: interpolatedValue
    } : null);
  }
  if (baseText == null) {
    baseText = isFunction(opt.defaultText) ? opt.defaultText(labelDataIndex, opt, interpolatedValue) : opt.defaultText;
  }
  var statesText = {
    normal: baseText
  };
  for (var i = 0; i < SPECIAL_STATES.length; i++) {
    var stateName = SPECIAL_STATES[i];
    var stateModel = stateModels[stateName];
    statesText[stateName] = retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, stateName, null, labelDimIndex, stateModel && stateModel.get('formatter')) : null, baseText);
  }
  return statesText;
}
function setLabelStyle(targetEl, labelStatesModels, opt, stateSpecified
// TODO specified position?
) {
  opt = opt || EMPTY_OBJ;
  var isSetOnText = targetEl instanceof ZRText$1;
  var needsCreateText = false;
  for (var i = 0; i < DISPLAY_STATES.length; i++) {
    var stateModel = labelStatesModels[DISPLAY_STATES[i]];
    if (stateModel && stateModel.getShallow('show')) {
      needsCreateText = true;
      break;
    }
  }
  var textContent = isSetOnText ? targetEl : targetEl.getTextContent();
  if (needsCreateText) {
    if (!isSetOnText) {
      // Reuse the previous
      if (!textContent) {
        textContent = new ZRText$1();
        targetEl.setTextContent(textContent);
      }
      // Use same state proxy
      if (targetEl.stateProxy) {
        textContent.stateProxy = targetEl.stateProxy;
      }
    }
    var labelStatesTexts = getLabelText(opt, labelStatesModels);
    var normalModel = labelStatesModels.normal;
    var showNormal = !!normalModel.getShallow('show');
    var normalStyle = createTextStyle(normalModel, stateSpecified && stateSpecified.normal, opt, false, !isSetOnText);
    normalStyle.text = labelStatesTexts.normal;
    if (!isSetOnText) {
      // Always create new
      targetEl.setTextConfig(createTextConfig(normalModel, opt, false));
    }
    for (var i = 0; i < SPECIAL_STATES.length; i++) {
      var stateName = SPECIAL_STATES[i];
      var stateModel = labelStatesModels[stateName];
      if (stateModel) {
        var stateObj = textContent.ensureState(stateName);
        var stateShow = !!retrieve2(stateModel.getShallow('show'), showNormal);
        if (stateShow !== showNormal) {
          stateObj.ignore = !stateShow;
        }
        stateObj.style = createTextStyle(stateModel, stateSpecified && stateSpecified[stateName], opt, true, !isSetOnText);
        stateObj.style.text = labelStatesTexts[stateName];
        if (!isSetOnText) {
          var targetElEmphasisState = targetEl.ensureState(stateName);
          targetElEmphasisState.textConfig = createTextConfig(stateModel, opt, true);
        }
      }
    }
    // PENDING: if there is many requirements that emphasis position
    // need to be different from normal position, we might consider
    // auto silent is those cases.
    textContent.silent = !!normalModel.getShallow('silent');
    // Keep x and y
    if (textContent.style.x != null) {
      normalStyle.x = textContent.style.x;
    }
    if (textContent.style.y != null) {
      normalStyle.y = textContent.style.y;
    }
    textContent.ignore = !showNormal;
    // Always create new style.
    textContent.useStyle(normalStyle);
    textContent.dirty();
    if (opt.enableTextSetter) {
      labelInner(textContent).setLabelText = function (interpolatedValue) {
        var labelStatesTexts = getLabelText(opt, labelStatesModels, interpolatedValue);
        setLabelText(textContent, labelStatesTexts);
      };
    }
  } else if (textContent) {
    // Not display rich text.
    textContent.ignore = true;
  }
  targetEl.dirty();
}
function getLabelStatesModels(itemModel, labelName) {
  labelName = labelName || 'label';
  var statesModels = {
    normal: itemModel.getModel(labelName)
  };
  for (var i = 0; i < SPECIAL_STATES.length; i++) {
    var stateName = SPECIAL_STATES[i];
    statesModels[stateName] = itemModel.getModel([stateName, labelName]);
  }
  return statesModels;
}
/**
 * Set basic textStyle properties.
 */
function createTextStyle(textStyleModel, specifiedTextStyle,
// Fixed style in the code. Can't be set by model.
opt, isNotNormal, isAttached // If text is attached on an element. If so, auto color will handling in zrender.
) {
  var textStyle = {};
  setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttached);
  specifiedTextStyle && extend(textStyle, specifiedTextStyle);
  // textStyle.host && textStyle.host.dirty && textStyle.host.dirty(false);
  return textStyle;
}
function createTextConfig(textStyleModel, opt, isNotNormal) {
  opt = opt || {};
  var textConfig = {};
  var labelPosition;
  var labelRotate = textStyleModel.getShallow('rotate');
  var labelDistance = retrieve2(textStyleModel.getShallow('distance'), isNotNormal ? null : 5);
  var labelOffset = textStyleModel.getShallow('offset');
  labelPosition = textStyleModel.getShallow('position') || (isNotNormal ? null : 'inside');
  // 'outside' is not a valid zr textPostion value, but used
  // in bar series, and magric type should be considered.
  labelPosition === 'outside' && (labelPosition = opt.defaultOutsidePosition || 'top');
  if (labelPosition != null) {
    textConfig.position = labelPosition;
  }
  if (labelOffset != null) {
    textConfig.offset = labelOffset;
  }
  if (labelRotate != null) {
    labelRotate *= Math.PI / 180;
    textConfig.rotation = labelRotate;
  }
  if (labelDistance != null) {
    textConfig.distance = labelDistance;
  }
  // fill and auto is determined by the color of path fill if it's not specified by developers.
  textConfig.outsideFill = textStyleModel.get('color') === 'inherit' ? opt.inheritColor || null : 'auto';
  return textConfig;
}
/**
 * The uniform entry of set text style, that is, retrieve style definitions
 * from `model` and set to `textStyle` object.
 *
 * Never in merge mode, but in overwrite mode, that is, all of the text style
 * properties will be set. (Consider the states of normal and emphasis and
 * default value can be adopted, merge would make the logic too complicated
 * to manage.)
 */
function setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttached) {
  // Consider there will be abnormal when merge hover style to normal style if given default value.
  opt = opt || EMPTY_OBJ;
  var ecModel = textStyleModel.ecModel;
  var globalTextStyle = ecModel && ecModel.option.textStyle;
  // Consider case:
  // {
  //     data: [{
  //         value: 12,
  //         label: {
  //             rich: {
  //                 // no 'a' here but using parent 'a'.
  //             }
  //         }
  //     }],
  //     rich: {
  //         a: { ... }
  //     }
  // }
  var richItemNames = getRichItemNames(textStyleModel);
  var richResult;
  if (richItemNames) {
    richResult = {};
    for (var name_1 in richItemNames) {
      if (richItemNames.hasOwnProperty(name_1)) {
        // Cascade is supported in rich.
        var richTextStyle = textStyleModel.getModel(['rich', name_1]);
        // In rich, never `disableBox`.
        // FIXME: consider `label: {formatter: '{a|xx}', color: 'blue', rich: {a: {}}}`,
        // the default color `'blue'` will not be adopted if no color declared in `rich`.
        // That might confuses users. So probably we should put `textStyleModel` as the
        // root ancestor of the `richTextStyle`. But that would be a break change.
        setTokenTextStyle(richResult[name_1] = {}, richTextStyle, globalTextStyle, opt, isNotNormal, isAttached, false, true);
      }
    }
  }
  if (richResult) {
    textStyle.rich = richResult;
  }
  var overflow = textStyleModel.get('overflow');
  if (overflow) {
    textStyle.overflow = overflow;
  }
  var margin = textStyleModel.get('minMargin');
  if (margin != null) {
    textStyle.margin = margin;
  }
  setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isNotNormal, isAttached, true, false);
}
// Consider case:
// {
//     data: [{
//         value: 12,
//         label: {
//             rich: {
//                 // no 'a' here but using parent 'a'.
//             }
//         }
//     }],
//     rich: {
//         a: { ... }
//     }
// }
// TODO TextStyleModel
function getRichItemNames(textStyleModel) {
  // Use object to remove duplicated names.
  var richItemNameMap;
  while (textStyleModel && textStyleModel !== textStyleModel.ecModel) {
    var rich = (textStyleModel.option || EMPTY_OBJ).rich;
    if (rich) {
      richItemNameMap = richItemNameMap || {};
      var richKeys = keys(rich);
      for (var i = 0; i < richKeys.length; i++) {
        var richKey = richKeys[i];
        richItemNameMap[richKey] = 1;
      }
    }
    textStyleModel = textStyleModel.parentModel;
  }
  return richItemNameMap;
}
var TEXT_PROPS_WITH_GLOBAL = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'];
var TEXT_PROPS_SELF = ['align', 'lineHeight', 'width', 'height', 'tag', 'verticalAlign', 'ellipsis'];
var TEXT_PROPS_BOX = ['padding', 'borderWidth', 'borderRadius', 'borderDashOffset', 'backgroundColor', 'borderColor', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'];
function setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isNotNormal, isAttached, isBlock, inRich) {
  // In merge mode, default value should not be given.
  globalTextStyle = !isNotNormal && globalTextStyle || EMPTY_OBJ;
  var inheritColor = opt && opt.inheritColor;
  var fillColor = textStyleModel.getShallow('color');
  var strokeColor = textStyleModel.getShallow('textBorderColor');
  var opacity = retrieve2(textStyleModel.getShallow('opacity'), globalTextStyle.opacity);
  if (fillColor === 'inherit' || fillColor === 'auto') {
    {
      if (fillColor === 'auto') {
        deprecateReplaceLog('color: \'auto\'', 'color: \'inherit\'');
      }
    }
    if (inheritColor) {
      fillColor = inheritColor;
    } else {
      fillColor = null;
    }
  }
  if (strokeColor === 'inherit' || strokeColor === 'auto') {
    {
      if (strokeColor === 'auto') {
        deprecateReplaceLog('color: \'auto\'', 'color: \'inherit\'');
      }
    }
    if (inheritColor) {
      strokeColor = inheritColor;
    } else {
      strokeColor = null;
    }
  }
  if (!isAttached) {
    // Only use default global textStyle.color if text is individual.
    // Otherwise it will use the strategy of attached text color because text may be on a path.
    fillColor = fillColor || globalTextStyle.color;
    strokeColor = strokeColor || globalTextStyle.textBorderColor;
  }
  if (fillColor != null) {
    textStyle.fill = fillColor;
  }
  if (strokeColor != null) {
    textStyle.stroke = strokeColor;
  }
  var textBorderWidth = retrieve2(textStyleModel.getShallow('textBorderWidth'), globalTextStyle.textBorderWidth);
  if (textBorderWidth != null) {
    textStyle.lineWidth = textBorderWidth;
  }
  var textBorderType = retrieve2(textStyleModel.getShallow('textBorderType'), globalTextStyle.textBorderType);
  if (textBorderType != null) {
    textStyle.lineDash = textBorderType;
  }
  var textBorderDashOffset = retrieve2(textStyleModel.getShallow('textBorderDashOffset'), globalTextStyle.textBorderDashOffset);
  if (textBorderDashOffset != null) {
    textStyle.lineDashOffset = textBorderDashOffset;
  }
  if (!isNotNormal && opacity == null && !inRich) {
    opacity = opt && opt.defaultOpacity;
  }
  if (opacity != null) {
    textStyle.opacity = opacity;
  }
  // TODO
  if (!isNotNormal && !isAttached) {
    // Set default finally.
    if (textStyle.fill == null && opt.inheritColor) {
      textStyle.fill = opt.inheritColor;
    }
  }
  // Do not use `getFont` here, because merge should be supported, where
  // part of these properties may be changed in emphasis style, and the
  // others should remain their original value got from normal style.
  for (var i = 0; i < TEXT_PROPS_WITH_GLOBAL.length; i++) {
    var key = TEXT_PROPS_WITH_GLOBAL[i];
    var val = retrieve2(textStyleModel.getShallow(key), globalTextStyle[key]);
    if (val != null) {
      textStyle[key] = val;
    }
  }
  for (var i = 0; i < TEXT_PROPS_SELF.length; i++) {
    var key = TEXT_PROPS_SELF[i];
    var val = textStyleModel.getShallow(key);
    if (val != null) {
      textStyle[key] = val;
    }
  }
  if (textStyle.verticalAlign == null) {
    var baseline = textStyleModel.getShallow('baseline');
    if (baseline != null) {
      textStyle.verticalAlign = baseline;
    }
  }
  if (!isBlock || !opt.disableBox) {
    for (var i = 0; i < TEXT_PROPS_BOX.length; i++) {
      var key = TEXT_PROPS_BOX[i];
      var val = textStyleModel.getShallow(key);
      if (val != null) {
        textStyle[key] = val;
      }
    }
    var borderType = textStyleModel.getShallow('borderType');
    if (borderType != null) {
      textStyle.borderDash = borderType;
    }
    if ((textStyle.backgroundColor === 'auto' || textStyle.backgroundColor === 'inherit') && inheritColor) {
      {
        if (textStyle.backgroundColor === 'auto') {
          deprecateReplaceLog('backgroundColor: \'auto\'', 'backgroundColor: \'inherit\'');
        }
      }
      textStyle.backgroundColor = inheritColor;
    }
    if ((textStyle.borderColor === 'auto' || textStyle.borderColor === 'inherit') && inheritColor) {
      {
        if (textStyle.borderColor === 'auto') {
          deprecateReplaceLog('borderColor: \'auto\'', 'borderColor: \'inherit\'');
        }
      }
      textStyle.borderColor = inheritColor;
    }
  }
}
function getFont(opt, ecModel) {
  var gTextStyleModel = ecModel && ecModel.getModel('textStyle');
  return trim$1([
  // FIXME in node-canvas fontWeight is before fontStyle
  opt.fontStyle || gTextStyleModel && gTextStyleModel.getShallow('fontStyle') || '', opt.fontWeight || gTextStyleModel && gTextStyleModel.getShallow('fontWeight') || '', (opt.fontSize || gTextStyleModel && gTextStyleModel.getShallow('fontSize') || 12) + 'px', opt.fontFamily || gTextStyleModel && gTextStyleModel.getShallow('fontFamily') || 'sans-serif'].join(' '));
}
var labelInner = makeInner();
function setLabelValueAnimation(label, labelStatesModels, value, getDefaultText) {
  if (!label) {
    return;
  }
  var obj = labelInner(label);
  obj.prevValue = obj.value;
  obj.value = value;
  var normalLabelModel = labelStatesModels.normal;
  obj.valueAnimation = normalLabelModel.get('valueAnimation');
  if (obj.valueAnimation) {
    obj.precision = normalLabelModel.get('precision');
    obj.defaultInterpolatedText = getDefaultText;
    obj.statesModels = labelStatesModels;
  }
}
function animateLabelValue(textEl, dataIndex, data, animatableModel, labelFetcher) {
  var labelInnerStore = labelInner(textEl);
  if (!labelInnerStore.valueAnimation || labelInnerStore.prevValue === labelInnerStore.value) {
    // Value not changed, no new label animation
    return;
  }
  var defaultInterpolatedText = labelInnerStore.defaultInterpolatedText;
  // Consider the case that being animating, do not use the `obj.value`,
  // Otherwise it will jump to the `obj.value` when this new animation started.
  var currValue = retrieve2(labelInnerStore.interpolatedValue, labelInnerStore.prevValue);
  var targetValue = labelInnerStore.value;
  function during(percent) {
    var interpolated = interpolateRawValues(data, labelInnerStore.precision, currValue, targetValue, percent);
    labelInnerStore.interpolatedValue = percent === 1 ? null : interpolated;
    var labelText = getLabelText({
      labelDataIndex: dataIndex,
      labelFetcher: labelFetcher,
      defaultText: defaultInterpolatedText ? defaultInterpolatedText(interpolated) : interpolated + ''
    }, labelInnerStore.statesModels, interpolated);
    setLabelText(textEl, labelText);
  }
  textEl.percent = 0;
  (labelInnerStore.prevValue == null ? initProps : updateProps$1)(textEl, {
    // percent is used to prevent animation from being aborted #15916
    percent: 1
  }, animatableModel, dataIndex, null, during);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PATH_COLOR = ['textStyle', 'color'];
var textStyleParams = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'padding', 'lineHeight', 'rich', 'width', 'height', 'overflow'];
// TODO Performance improvement?
var tmpText = new ZRText$1();
var TextStyleMixin = /** @class */function () {
  function TextStyleMixin() {}
  /**
   * Get color property or get color from option.textStyle.color
   */
  // TODO Callback
  TextStyleMixin.prototype.getTextColor = function (isEmphasis) {
    var ecModel = this.ecModel;
    return this.getShallow('color') || (!isEmphasis && ecModel ? ecModel.get(PATH_COLOR) : null);
  };
  /**
   * Create font string from fontStyle, fontWeight, fontSize, fontFamily
   * @return {string}
   */
  TextStyleMixin.prototype.getFont = function () {
    return getFont({
      fontStyle: this.getShallow('fontStyle'),
      fontWeight: this.getShallow('fontWeight'),
      fontSize: this.getShallow('fontSize'),
      fontFamily: this.getShallow('fontFamily')
    }, this.ecModel);
  };
  TextStyleMixin.prototype.getTextRect = function (text) {
    var style = {
      text: text,
      verticalAlign: this.getShallow('verticalAlign') || this.getShallow('baseline')
    };
    for (var i = 0; i < textStyleParams.length; i++) {
      style[textStyleParams[i]] = this.getShallow(textStyleParams[i]);
    }
    tmpText.useStyle(style);
    tmpText.update();
    return tmpText.getBoundingRect();
  };
  return TextStyleMixin;
}();
var TextStyleMixin$1 = TextStyleMixin;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var LINE_STYLE_KEY_MAP = [['lineWidth', 'width'], ['stroke', 'color'], ['opacity'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor'], ['lineDash', 'type'], ['lineDashOffset', 'dashOffset'], ['lineCap', 'cap'], ['lineJoin', 'join'], ['miterLimit']
// Option decal is in `DecalObject` but style.decal is in `PatternObject`.
// So do not transfer decal directly.
];
var getLineStyle = makeStyleMapper(LINE_STYLE_KEY_MAP);
var LineStyleMixin = /** @class */function () {
  function LineStyleMixin() {}
  LineStyleMixin.prototype.getLineStyle = function (excludes) {
    return getLineStyle(this, excludes);
  };
  return LineStyleMixin;
}();

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ITEM_STYLE_KEY_MAP = [['fill', 'color'], ['stroke', 'borderColor'], ['lineWidth', 'borderWidth'], ['opacity'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor'], ['lineDash', 'borderType'], ['lineDashOffset', 'borderDashOffset'], ['lineCap', 'borderCap'], ['lineJoin', 'borderJoin'], ['miterLimit', 'borderMiterLimit']
// Option decal is in `DecalObject` but style.decal is in `PatternObject`.
// So do not transfer decal directly.
];
var getItemStyle = makeStyleMapper(ITEM_STYLE_KEY_MAP);
var ItemStyleMixin = /** @class */function () {
  function ItemStyleMixin() {}
  ItemStyleMixin.prototype.getItemStyle = function (excludes, includes) {
    return getItemStyle(this, excludes, includes);
  };
  return ItemStyleMixin;
}();

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Model = /** @class */function () {
  function Model(option, parentModel, ecModel) {
    this.parentModel = parentModel;
    this.ecModel = ecModel;
    this.option = option;
    // Simple optimization
    // if (this.init) {
    //     if (arguments.length <= 4) {
    //         this.init(option, parentModel, ecModel, extraOpt);
    //     }
    //     else {
    //         this.init.apply(this, arguments);
    //     }
    // }
  }
  Model.prototype.init = function (option, parentModel, ecModel) {
  };
  /**
   * Merge the input option to me.
   */
  Model.prototype.mergeOption = function (option, ecModel) {
    merge(this.option, option, true);
  };
  // `path` can be 'a.b.c', so the return value type have to be `ModelOption`
  // TODO: TYPE strict key check?
  // get(path: string | string[], ignoreParent?: boolean): ModelOption;
  Model.prototype.get = function (path, ignoreParent) {
    if (path == null) {
      return this.option;
    }
    return this._doGet(this.parsePath(path), !ignoreParent && this.parentModel);
  };
  Model.prototype.getShallow = function (key, ignoreParent) {
    var option = this.option;
    var val = option == null ? option : option[key];
    if (val == null && !ignoreParent) {
      var parentModel = this.parentModel;
      if (parentModel) {
        // FIXME:TS do not know how to make it works
        val = parentModel.getShallow(key);
      }
    }
    return val;
  };
  // `path` can be 'a.b.c', so the return value type have to be `Model<ModelOption>`
  // getModel(path: string | string[], parentModel?: Model): Model;
  // TODO 'a.b.c' is deprecated
  Model.prototype.getModel = function (path, parentModel) {
    var hasPath = path != null;
    var pathFinal = hasPath ? this.parsePath(path) : null;
    var obj = hasPath ? this._doGet(pathFinal) : this.option;
    parentModel = parentModel || this.parentModel && this.parentModel.getModel(this.resolveParentPath(pathFinal));
    return new Model(obj, parentModel, this.ecModel);
  };
  /**
   * If model has option
   */
  Model.prototype.isEmpty = function () {
    return this.option == null;
  };
  Model.prototype.restoreData = function () {};
  // Pending
  Model.prototype.clone = function () {
    var Ctor = this.constructor;
    return new Ctor(clone$4(this.option));
  };
  // setReadOnly(properties): void {
  // clazzUtil.setReadOnly(this, properties);
  // }
  // If path is null/undefined, return null/undefined.
  Model.prototype.parsePath = function (path) {
    if (typeof path === 'string') {
      return path.split('.');
    }
    return path;
  };
  // Resolve path for parent. Perhaps useful when parent use a different property.
  // Default to be a identity resolver.
  // Can be modified to a different resolver.
  Model.prototype.resolveParentPath = function (path) {
    return path;
  };
  // FIXME:TS check whether put this method here
  Model.prototype.isAnimationEnabled = function () {
    if (!env$1.node && this.option) {
      if (this.option.animation != null) {
        return !!this.option.animation;
      } else if (this.parentModel) {
        return this.parentModel.isAnimationEnabled();
      }
    }
  };
  Model.prototype._doGet = function (pathArr, parentModel) {
    var obj = this.option;
    if (!pathArr) {
      return obj;
    }
    for (var i = 0; i < pathArr.length; i++) {
      // Ignore empty
      if (!pathArr[i]) {
        continue;
      }
      // obj could be number/string/... (like 0)
      obj = obj && typeof obj === 'object' ? obj[pathArr[i]] : null;
      if (obj == null) {
        break;
      }
    }
    if (obj == null && parentModel) {
      obj = parentModel._doGet(this.resolveParentPath(pathArr), parentModel.parentModel);
    }
    return obj;
  };
  return Model;
}();
// Enable Model.extend.
enableClassExtend(Model);
enableClassCheck(Model);
mixin(Model, LineStyleMixin);
mixin(Model, ItemStyleMixin);
mixin(Model, AreaStyleMixin);
mixin(Model, TextStyleMixin$1);
var Model$1 = Model;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// A random offset
var base = Math.round(Math.random() * 10);
/**
 * @public
 * @param {string} type
 * @return {string}
 */
function getUID(type) {
  // Considering the case of crossing js context,
  // use Math.random to make id as unique as possible.
  return [type || '', base++].join('_');
}
/**
 * Implements `SubTypeDefaulterManager` for `target`.
 */
function enableSubTypeDefaulter(target) {
  var subTypeDefaulters = {};
  target.registerSubTypeDefaulter = function (componentType, defaulter) {
    var componentTypeInfo = parseClassType(componentType);
    subTypeDefaulters[componentTypeInfo.main] = defaulter;
  };
  target.determineSubType = function (componentType, option) {
    var type = option.type;
    if (!type) {
      var componentTypeMain = parseClassType(componentType).main;
      if (target.hasSubTypes(componentType) && subTypeDefaulters[componentTypeMain]) {
        type = subTypeDefaulters[componentTypeMain](option);
      }
    }
    return type;
  };
}
/**
 * Implements `TopologicalTravelable<any>` for `entity`.
 *
 * Topological travel on Activity Network (Activity On Vertices).
 * Dependencies is defined in Model.prototype.dependencies, like ['xAxis', 'yAxis'].
 * If 'xAxis' or 'yAxis' is absent in componentTypeList, just ignore it in topology.
 * If there is circular dependencey, Error will be thrown.
 */
function enableTopologicalTravel(entity, dependencyGetter) {
  /**
   * @param targetNameList Target Component type list.
   *                       Can be ['aa', 'bb', 'aa.xx']
   * @param fullNameList By which we can build dependency graph.
   * @param callback Params: componentType, dependencies.
   * @param context Scope of callback.
   */
  entity.topologicalTravel = function (targetNameList, fullNameList, callback, context) {
    if (!targetNameList.length) {
      return;
    }
    var result = makeDepndencyGraph(fullNameList);
    var graph = result.graph;
    var noEntryList = result.noEntryList;
    var targetNameSet = {};
    each$f(targetNameList, function (name) {
      targetNameSet[name] = true;
    });
    while (noEntryList.length) {
      var currComponentType = noEntryList.pop();
      var currVertex = graph[currComponentType];
      var isInTargetNameSet = !!targetNameSet[currComponentType];
      if (isInTargetNameSet) {
        callback.call(context, currComponentType, currVertex.originalDeps.slice());
        delete targetNameSet[currComponentType];
      }
      each$f(currVertex.successor, isInTargetNameSet ? removeEdgeAndAdd : removeEdge);
    }
    each$f(targetNameSet, function () {
      var errMsg = '';
      {
        errMsg = makePrintable('Circular dependency may exists: ', targetNameSet, targetNameList, fullNameList);
      }
      throw new Error(errMsg);
    });
    function removeEdge(succComponentType) {
      graph[succComponentType].entryCount--;
      if (graph[succComponentType].entryCount === 0) {
        noEntryList.push(succComponentType);
      }
    }
    // Consider this case: legend depends on series, and we call
    // chart.setOption({series: [...]}), where only series is in option.
    // If we do not have 'removeEdgeAndAdd', legendModel.mergeOption will
    // not be called, but only sereis.mergeOption is called. Thus legend
    // have no chance to update its local record about series (like which
    // name of series is available in legend).
    function removeEdgeAndAdd(succComponentType) {
      targetNameSet[succComponentType] = true;
      removeEdge(succComponentType);
    }
  };
  function makeDepndencyGraph(fullNameList) {
    var graph = {};
    var noEntryList = [];
    each$f(fullNameList, function (name) {
      var thisItem = createDependencyGraphItem(graph, name);
      var originalDeps = thisItem.originalDeps = dependencyGetter(name);
      var availableDeps = getAvailableDependencies(originalDeps, fullNameList);
      thisItem.entryCount = availableDeps.length;
      if (thisItem.entryCount === 0) {
        noEntryList.push(name);
      }
      each$f(availableDeps, function (dependentName) {
        if (indexOf(thisItem.predecessor, dependentName) < 0) {
          thisItem.predecessor.push(dependentName);
        }
        var thatItem = createDependencyGraphItem(graph, dependentName);
        if (indexOf(thatItem.successor, dependentName) < 0) {
          thatItem.successor.push(name);
        }
      });
    });
    return {
      graph: graph,
      noEntryList: noEntryList
    };
  }
  function createDependencyGraphItem(graph, name) {
    if (!graph[name]) {
      graph[name] = {
        predecessor: [],
        successor: []
      };
    }
    return graph[name];
  }
  function getAvailableDependencies(originalDeps, fullNameList) {
    var availableDeps = [];
    each$f(originalDeps, function (dep) {
      indexOf(fullNameList, dep) >= 0 && availableDeps.push(dep);
    });
    return availableDeps;
  }
}
function inheritDefaultOption(superOption, subOption) {
  // See also `model/Component.ts#getDefaultOption`
  return merge(merge({}, superOption, true), subOption, true);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
/**
 * Language: English.
 */
var langEN = {
  time: {
    month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
    monthAbbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    dayOfWeek: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
    dayOfWeekAbbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
  },
  legend: {
    selector: {
      all: 'All',
      inverse: 'Inv'
    }
  },
  toolbox: {
    brush: {
      title: {
        rect: 'Box Select',
        polygon: 'Lasso Select',
        lineX: 'Horizontally Select',
        lineY: 'Vertically Select',
        keep: 'Keep Selections',
        clear: 'Clear Selections'
      }
    },
    dataView: {
      title: 'Data View',
      lang: ['Data View', 'Close', 'Refresh']
    },
    dataZoom: {
      title: {
        zoom: 'Zoom',
        back: 'Zoom Reset'
      }
    },
    magicType: {
      title: {
        line: 'Switch to Line Chart',
        bar: 'Switch to Bar Chart',
        stack: 'Stack',
        tiled: 'Tile'
      }
    },
    restore: {
      title: 'Restore'
    },
    saveAsImage: {
      title: 'Save as Image',
      lang: ['Right Click to Save Image']
    }
  },
  series: {
    typeNames: {
      pie: 'Pie chart',
      bar: 'Bar chart',
      line: 'Line chart',
      scatter: 'Scatter plot',
      effectScatter: 'Ripple scatter plot',
      radar: 'Radar chart',
      tree: 'Tree',
      treemap: 'Treemap',
      boxplot: 'Boxplot',
      candlestick: 'Candlestick',
      k: 'K line chart',
      heatmap: 'Heat map',
      map: 'Map',
      parallel: 'Parallel coordinate map',
      lines: 'Line graph',
      graph: 'Relationship graph',
      sankey: 'Sankey diagram',
      funnel: 'Funnel chart',
      gauge: 'Gauge',
      pictorialBar: 'Pictorial bar',
      themeRiver: 'Theme River Map',
      sunburst: 'Sunburst',
      custom: 'Custom chart',
      chart: 'Chart'
    }
  },
  aria: {
    general: {
      withTitle: 'This is a chart about "{title}"',
      withoutTitle: 'This is a chart'
    },
    series: {
      single: {
        prefix: '',
        withName: ' with type {seriesType} named {seriesName}.',
        withoutName: ' with type {seriesType}.'
      },
      multiple: {
        prefix: '. It consists of {seriesCount} series count.',
        withName: ' The {seriesId} series is a {seriesType} representing {seriesName}.',
        withoutName: ' The {seriesId} series is a {seriesType}.',
        separator: {
          middle: '',
          end: ''
        }
      }
    },
    data: {
      allData: 'The data is as follows: ',
      partialData: 'The first {displayCnt} items are: ',
      withName: 'the data for {name} is {value}',
      withoutName: '{value}',
      separator: {
        middle: ', ',
        end: '. '
      }
    }
  }
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
var langZH = {
  time: {
    month: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
    monthAbbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
    dayOfWeek: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
    dayOfWeekAbbr: ['日', '一', '二', '三', '四', '五', '六']
  },
  legend: {
    selector: {
      all: '全选',
      inverse: '反选'
    }
  },
  toolbox: {
    brush: {
      title: {
        rect: '矩形选择',
        polygon: '圈选',
        lineX: '横向选择',
        lineY: '纵向选择',
        keep: '保持选择',
        clear: '清除选择'
      }
    },
    dataView: {
      title: '数据视图',
      lang: ['数据视图', '关闭', '刷新']
    },
    dataZoom: {
      title: {
        zoom: '区域缩放',
        back: '区域缩放还原'
      }
    },
    magicType: {
      title: {
        line: '切换为折线图',
        bar: '切换为柱状图',
        stack: '切换为堆叠',
        tiled: '切换为平铺'
      }
    },
    restore: {
      title: '还原'
    },
    saveAsImage: {
      title: '保存为图片',
      lang: ['右键另存为图片']
    }
  },
  series: {
    typeNames: {
      pie: '饼图',
      bar: '柱状图',
      line: '折线图',
      scatter: '散点图',
      effectScatter: '涟漪散点图',
      radar: '雷达图',
      tree: '树图',
      treemap: '矩形树图',
      boxplot: '箱型图',
      candlestick: 'K线图',
      k: 'K线图',
      heatmap: '热力图',
      map: '地图',
      parallel: '平行坐标图',
      lines: '线图',
      graph: '关系图',
      sankey: '桑基图',
      funnel: '漏斗图',
      gauge: '仪表盘图',
      pictorialBar: '象形柱图',
      themeRiver: '主题河流图',
      sunburst: '旭日图',
      custom: '自定义图表',
      chart: '图表'
    }
  },
  aria: {
    general: {
      withTitle: '这是一个关于“{title}”的图表。',
      withoutTitle: '这是一个图表，'
    },
    series: {
      single: {
        prefix: '',
        withName: '图表类型是{seriesType}，表示{seriesName}。',
        withoutName: '图表类型是{seriesType}。'
      },
      multiple: {
        prefix: '它由{seriesCount}个图表系列组成。',
        withName: '第{seriesId}个系列是一个表示{seriesName}的{seriesType}，',
        withoutName: '第{seriesId}个系列是一个{seriesType}，',
        separator: {
          middle: '；',
          end: '。'
        }
      }
    },
    data: {
      allData: '其数据是——',
      partialData: '其中，前{displayCnt}项是——',
      withName: '{name}的数据是{value}',
      withoutName: '{value}',
      separator: {
        middle: '，',
        end: ''
      }
    }
  }
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var LOCALE_ZH = 'ZH';
var LOCALE_EN = 'EN';
var DEFAULT_LOCALE = LOCALE_EN;
var localeStorage = {};
var localeModels = {};
var SYSTEM_LANG = !env$1.domSupported ? DEFAULT_LOCALE : function () {
  var langStr = (/* eslint-disable-next-line */
  document.documentElement.lang || navigator.language || navigator.browserLanguage || DEFAULT_LOCALE).toUpperCase();
  return langStr.indexOf(LOCALE_ZH) > -1 ? LOCALE_ZH : DEFAULT_LOCALE;
}();
function registerLocale(locale, localeObj) {
  locale = locale.toUpperCase();
  localeModels[locale] = new Model$1(localeObj);
  localeStorage[locale] = localeObj;
}
// export function getLocale(locale: string) {
//     return localeStorage[locale];
// }
function createLocaleObject(locale) {
  if (isString(locale)) {
    var localeObj = localeStorage[locale.toUpperCase()] || {};
    if (locale === LOCALE_ZH || locale === LOCALE_EN) {
      return clone$4(localeObj);
    } else {
      return merge(clone$4(localeObj), clone$4(localeStorage[DEFAULT_LOCALE]), false);
    }
  } else {
    return merge(clone$4(locale), clone$4(localeStorage[DEFAULT_LOCALE]), false);
  }
}
function getLocaleModel(lang) {
  return localeModels[lang];
}
function getDefaultLocaleModel() {
  return localeModels[DEFAULT_LOCALE];
}
// Default locale
registerLocale(LOCALE_EN, langEN);
registerLocale(LOCALE_ZH, langZH);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ONE_SECOND = 1000;
var ONE_MINUTE = ONE_SECOND * 60;
var ONE_HOUR = ONE_MINUTE * 60;
var ONE_DAY = ONE_HOUR * 24;
var ONE_YEAR = ONE_DAY * 365;
var defaultLeveledFormatter = {
  year: '{yyyy}',
  month: '{MMM}',
  day: '{d}',
  hour: '{HH}:{mm}',
  minute: '{HH}:{mm}',
  second: '{HH}:{mm}:{ss}',
  millisecond: '{HH}:{mm}:{ss} {SSS}',
  none: '{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}'
};
var fullDayFormatter = '{yyyy}-{MM}-{dd}';
var fullLeveledFormatter = {
  year: '{yyyy}',
  month: '{yyyy}-{MM}',
  day: fullDayFormatter,
  hour: fullDayFormatter + ' ' + defaultLeveledFormatter.hour,
  minute: fullDayFormatter + ' ' + defaultLeveledFormatter.minute,
  second: fullDayFormatter + ' ' + defaultLeveledFormatter.second,
  millisecond: defaultLeveledFormatter.none
};
var primaryTimeUnits = ['year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond'];
var timeUnits = ['year', 'half-year', 'quarter', 'month', 'week', 'half-week', 'day', 'half-day', 'quarter-day', 'hour', 'minute', 'second', 'millisecond'];
function pad(str, len) {
  str += '';
  return '0000'.substr(0, len - str.length) + str;
}
function getPrimaryTimeUnit(timeUnit) {
  switch (timeUnit) {
    case 'half-year':
    case 'quarter':
      return 'month';
    case 'week':
    case 'half-week':
      return 'day';
    case 'half-day':
    case 'quarter-day':
      return 'hour';
    default:
      // year, minutes, second, milliseconds
      return timeUnit;
  }
}
function isPrimaryTimeUnit(timeUnit) {
  return timeUnit === getPrimaryTimeUnit(timeUnit);
}
function getDefaultFormatPrecisionOfInterval(timeUnit) {
  switch (timeUnit) {
    case 'year':
    case 'month':
      return 'day';
    case 'millisecond':
      return 'millisecond';
    default:
      // Also for day, hour, minute, second
      return 'second';
  }
}
function format(
// Note: The result based on `isUTC` are totally different, which can not be just simply
// substituted by the result without `isUTC`. So we make the param `isUTC` mandatory.
time, template, isUTC, lang) {
  var date = parseDate(time);
  var y = date[fullYearGetterName(isUTC)]();
  var M = date[monthGetterName(isUTC)]() + 1;
  var q = Math.floor((M - 1) / 3) + 1;
  var d = date[dateGetterName(isUTC)]();
  var e = date['get' + (isUTC ? 'UTC' : '') + 'Day']();
  var H = date[hoursGetterName(isUTC)]();
  var h = (H - 1) % 12 + 1;
  var m = date[minutesGetterName(isUTC)]();
  var s = date[secondsGetterName(isUTC)]();
  var S = date[millisecondsGetterName(isUTC)]();
  var a = H >= 12 ? 'pm' : 'am';
  var A = a.toUpperCase();
  var localeModel = lang instanceof Model$1 ? lang : getLocaleModel(lang || SYSTEM_LANG) || getDefaultLocaleModel();
  var timeModel = localeModel.getModel('time');
  var month = timeModel.get('month');
  var monthAbbr = timeModel.get('monthAbbr');
  var dayOfWeek = timeModel.get('dayOfWeek');
  var dayOfWeekAbbr = timeModel.get('dayOfWeekAbbr');
  return (template || '').replace(/{a}/g, a + '').replace(/{A}/g, A + '').replace(/{yyyy}/g, y + '').replace(/{yy}/g, pad(y % 100 + '', 2)).replace(/{Q}/g, q + '').replace(/{MMMM}/g, month[M - 1]).replace(/{MMM}/g, monthAbbr[M - 1]).replace(/{MM}/g, pad(M, 2)).replace(/{M}/g, M + '').replace(/{dd}/g, pad(d, 2)).replace(/{d}/g, d + '').replace(/{eeee}/g, dayOfWeek[e]).replace(/{ee}/g, dayOfWeekAbbr[e]).replace(/{e}/g, e + '').replace(/{HH}/g, pad(H, 2)).replace(/{H}/g, H + '').replace(/{hh}/g, pad(h + '', 2)).replace(/{h}/g, h + '').replace(/{mm}/g, pad(m, 2)).replace(/{m}/g, m + '').replace(/{ss}/g, pad(s, 2)).replace(/{s}/g, s + '').replace(/{SSS}/g, pad(S, 3)).replace(/{S}/g, S + '');
}
function leveledFormat(tick, idx, formatter, lang, isUTC) {
  var template = null;
  if (isString(formatter)) {
    // Single formatter for all units at all levels
    template = formatter;
  } else if (isFunction(formatter)) {
    // Callback formatter
    template = formatter(tick.value, idx, {
      level: tick.level
    });
  } else {
    var defaults$1 = extend({}, defaultLeveledFormatter);
    if (tick.level > 0) {
      for (var i = 0; i < primaryTimeUnits.length; ++i) {
        defaults$1[primaryTimeUnits[i]] = "{primary|" + defaults$1[primaryTimeUnits[i]] + "}";
      }
    }
    var mergedFormatter = formatter ? formatter.inherit === false ? formatter // Use formatter with bigger units
    : defaults(formatter, defaults$1) : defaults$1;
    var unit = getUnitFromValue(tick.value, isUTC);
    if (mergedFormatter[unit]) {
      template = mergedFormatter[unit];
    } else if (mergedFormatter.inherit) {
      // Unit formatter is not defined and should inherit from bigger units
      var targetId = timeUnits.indexOf(unit);
      for (var i = targetId - 1; i >= 0; --i) {
        if (mergedFormatter[unit]) {
          template = mergedFormatter[unit];
          break;
        }
      }
      template = template || defaults$1.none;
    }
    if (isArray$1(template)) {
      var levelId = tick.level == null ? 0 : tick.level >= 0 ? tick.level : template.length + tick.level;
      levelId = Math.min(levelId, template.length - 1);
      template = template[levelId];
    }
  }
  return format(new Date(tick.value), template, isUTC, lang);
}
function getUnitFromValue(value, isUTC) {
  var date = parseDate(value);
  var M = date[monthGetterName(isUTC)]() + 1;
  var d = date[dateGetterName(isUTC)]();
  var h = date[hoursGetterName(isUTC)]();
  var m = date[minutesGetterName(isUTC)]();
  var s = date[secondsGetterName(isUTC)]();
  var S = date[millisecondsGetterName(isUTC)]();
  var isSecond = S === 0;
  var isMinute = isSecond && s === 0;
  var isHour = isMinute && m === 0;
  var isDay = isHour && h === 0;
  var isMonth = isDay && d === 1;
  var isYear = isMonth && M === 1;
  if (isYear) {
    return 'year';
  } else if (isMonth) {
    return 'month';
  } else if (isDay) {
    return 'day';
  } else if (isHour) {
    return 'hour';
  } else if (isMinute) {
    return 'minute';
  } else if (isSecond) {
    return 'second';
  } else {
    return 'millisecond';
  }
}
function getUnitValue(value, unit, isUTC) {
  var date = isNumber(value) ? parseDate(value) : value;
  unit = unit || getUnitFromValue(value, isUTC);
  switch (unit) {
    case 'year':
      return date[fullYearGetterName(isUTC)]();
    case 'half-year':
      return date[monthGetterName(isUTC)]() >= 6 ? 1 : 0;
    case 'quarter':
      return Math.floor((date[monthGetterName(isUTC)]() + 1) / 4);
    case 'month':
      return date[monthGetterName(isUTC)]();
    case 'day':
      return date[dateGetterName(isUTC)]();
    case 'half-day':
      return date[hoursGetterName(isUTC)]() / 24;
    case 'hour':
      return date[hoursGetterName(isUTC)]();
    case 'minute':
      return date[minutesGetterName(isUTC)]();
    case 'second':
      return date[secondsGetterName(isUTC)]();
    case 'millisecond':
      return date[millisecondsGetterName(isUTC)]();
  }
}
function fullYearGetterName(isUTC) {
  return isUTC ? 'getUTCFullYear' : 'getFullYear';
}
function monthGetterName(isUTC) {
  return isUTC ? 'getUTCMonth' : 'getMonth';
}
function dateGetterName(isUTC) {
  return isUTC ? 'getUTCDate' : 'getDate';
}
function hoursGetterName(isUTC) {
  return isUTC ? 'getUTCHours' : 'getHours';
}
function minutesGetterName(isUTC) {
  return isUTC ? 'getUTCMinutes' : 'getMinutes';
}
function secondsGetterName(isUTC) {
  return isUTC ? 'getUTCSeconds' : 'getSeconds';
}
function millisecondsGetterName(isUTC) {
  return isUTC ? 'getUTCMilliseconds' : 'getMilliseconds';
}
function fullYearSetterName(isUTC) {
  return isUTC ? 'setUTCFullYear' : 'setFullYear';
}
function monthSetterName(isUTC) {
  return isUTC ? 'setUTCMonth' : 'setMonth';
}
function dateSetterName(isUTC) {
  return isUTC ? 'setUTCDate' : 'setDate';
}
function hoursSetterName(isUTC) {
  return isUTC ? 'setUTCHours' : 'setHours';
}
function minutesSetterName(isUTC) {
  return isUTC ? 'setUTCMinutes' : 'setMinutes';
}
function secondsSetterName(isUTC) {
  return isUTC ? 'setUTCSeconds' : 'setSeconds';
}
function millisecondsSetterName(isUTC) {
  return isUTC ? 'setUTCMilliseconds' : 'setMilliseconds';
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Add a comma each three digit.
 */
function addCommas(x) {
  if (!isNumeric(x)) {
    return isString(x) ? x : '-';
  }
  var parts = (x + '').split('.');
  return parts[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,') + (parts.length > 1 ? '.' + parts[1] : '');
}
function toCamelCase(str, upperCaseFirst) {
  str = (str || '').toLowerCase().replace(/-(.)/g, function (match, group1) {
    return group1.toUpperCase();
  });
  if (upperCaseFirst && str) {
    str = str.charAt(0).toUpperCase() + str.slice(1);
  }
  return str;
}
var normalizeCssArray = normalizeCssArray$1;
/**
 * Make value user readable for tooltip and label.
 * "User readable":
 *     Try to not print programmer-specific text like NaN, Infinity, null, undefined.
 *     Avoid to display an empty string, which users can not recognize there is
 *     a value and it might look like a bug.
 */
function makeValueReadable(value, valueType, useUTC) {
  var USER_READABLE_DEFUALT_TIME_PATTERN = '{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}';
  function stringToUserReadable(str) {
    return str && trim$1(str) ? str : '-';
  }
  function isNumberUserReadable(num) {
    return !!(num != null && !isNaN(num) && isFinite(num));
  }
  var isTypeTime = valueType === 'time';
  var isValueDate = value instanceof Date;
  if (isTypeTime || isValueDate) {
    var date = isTypeTime ? parseDate(value) : value;
    if (!isNaN(+date)) {
      return format(date, USER_READABLE_DEFUALT_TIME_PATTERN, useUTC);
    } else if (isValueDate) {
      return '-';
    }
    // In other cases, continue to try to display the value in the following code.
  }
  if (valueType === 'ordinal') {
    return isStringSafe(value) ? stringToUserReadable(value) : isNumber(value) ? isNumberUserReadable(value) ? value + '' : '-' : '-';
  }
  // By default.
  var numericResult = numericToNumber(value);
  return isNumberUserReadable(numericResult) ? addCommas(numericResult) : isStringSafe(value) ? stringToUserReadable(value) : typeof value === 'boolean' ? value + '' : '-';
}
var TPL_VAR_ALIAS = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
var wrapVar = function (varName, seriesIdx) {
  return '{' + varName + (seriesIdx == null ? '' : seriesIdx) + '}';
};
/**
 * Template formatter
 * @param {Array.<Object>|Object} paramsList
 */
function formatTpl(tpl, paramsList, encode) {
  if (!isArray$1(paramsList)) {
    paramsList = [paramsList];
  }
  var seriesLen = paramsList.length;
  if (!seriesLen) {
    return '';
  }
  var $vars = paramsList[0].$vars || [];
  for (var i = 0; i < $vars.length; i++) {
    var alias = TPL_VAR_ALIAS[i];
    tpl = tpl.replace(wrapVar(alias), wrapVar(alias, 0));
  }
  for (var seriesIdx = 0; seriesIdx < seriesLen; seriesIdx++) {
    for (var k = 0; k < $vars.length; k++) {
      var val = paramsList[seriesIdx][$vars[k]];
      tpl = tpl.replace(wrapVar(TPL_VAR_ALIAS[k], seriesIdx), encode ? encodeHTML(val) : val);
    }
  }
  return tpl;
}
/**
 * simple Template formatter
 */
function formatTplSimple(tpl, param, encode) {
  each$f(param, function (value, key) {
    tpl = tpl.replace('{' + key + '}', encode ? encodeHTML(value) : value);
  });
  return tpl;
}
function getTooltipMarker(inOpt, extraCssText) {
  var opt = isString(inOpt) ? {
    color: inOpt,
    extraCssText: extraCssText
  } : inOpt || {};
  var color = opt.color;
  var type = opt.type;
  extraCssText = opt.extraCssText;
  var renderMode = opt.renderMode || 'html';
  if (!color) {
    return '';
  }
  if (renderMode === 'html') {
    return type === 'subItem' ? '<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;' + 'border-radius:4px;width:4px;height:4px;background-color:'
    // Only support string
    + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>' : '<span style="display:inline-block;margin-right:4px;' + 'border-radius:10px;width:10px;height:10px;background-color:' + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>';
  } else {
    // Should better not to auto generate style name by auto-increment number here.
    // Because this util is usually called in tooltip formatter, which is probably
    // called repeatedly when mouse move and the auto-increment number increases fast.
    // Users can make their own style name by theirselves, make it unique and readable.
    var markerId = opt.markerId || 'markerX';
    return {
      renderMode: renderMode,
      content: '{' + markerId + '|}  ',
      style: type === 'subItem' ? {
        width: 4,
        height: 4,
        borderRadius: 2,
        backgroundColor: color
      } : {
        width: 10,
        height: 10,
        borderRadius: 5,
        backgroundColor: color
      }
    };
  }
}
/**
 * @return Never be null/undefined.
 */
function convertToColorString(color, defaultColor) {
  defaultColor = defaultColor || 'transparent';
  return isString(color) ? color : isObject$3(color) ? color.colorStops && (color.colorStops[0] || {}).color || defaultColor : defaultColor;
}
/**
 * open new tab
 * @param link url
 * @param target blank or self
 */
function windowOpen(link, target) {
  /* global window */
  if (target === '_blank' || target === 'blank') {
    var blank = window.open();
    blank.opener = null;
    blank.location.href = link;
  } else {
    window.open(link, target);
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each$e = each$f;
/**
 * @public
 */
var LOCATION_PARAMS = ['left', 'right', 'top', 'bottom', 'width', 'height'];
/**
 * @public
 */
var HV_NAMES = [['width', 'left', 'right'], ['height', 'top', 'bottom']];
function boxLayout(orient, group, gap, maxWidth, maxHeight) {
  var x = 0;
  var y = 0;
  if (maxWidth == null) {
    maxWidth = Infinity;
  }
  if (maxHeight == null) {
    maxHeight = Infinity;
  }
  var currentLineMaxSize = 0;
  group.eachChild(function (child, idx) {
    var rect = child.getBoundingRect();
    var nextChild = group.childAt(idx + 1);
    var nextChildRect = nextChild && nextChild.getBoundingRect();
    var nextX;
    var nextY;
    if (orient === 'horizontal') {
      var moveX = rect.width + (nextChildRect ? -nextChildRect.x + rect.x : 0);
      nextX = x + moveX;
      // Wrap when width exceeds maxWidth or meet a `newline` group
      // FIXME compare before adding gap?
      if (nextX > maxWidth || child.newline) {
        x = 0;
        nextX = moveX;
        y += currentLineMaxSize + gap;
        currentLineMaxSize = rect.height;
      } else {
        // FIXME: consider rect.y is not `0`?
        currentLineMaxSize = Math.max(currentLineMaxSize, rect.height);
      }
    } else {
      var moveY = rect.height + (nextChildRect ? -nextChildRect.y + rect.y : 0);
      nextY = y + moveY;
      // Wrap when width exceeds maxHeight or meet a `newline` group
      if (nextY > maxHeight || child.newline) {
        x += currentLineMaxSize + gap;
        y = 0;
        nextY = moveY;
        currentLineMaxSize = rect.width;
      } else {
        currentLineMaxSize = Math.max(currentLineMaxSize, rect.width);
      }
    }
    if (child.newline) {
      return;
    }
    child.x = x;
    child.y = y;
    child.markRedraw();
    orient === 'horizontal' ? x = nextX + gap : y = nextY + gap;
  });
}
/**
 * VBox or HBox layouting
 * @param {string} orient
 * @param {module:zrender/graphic/Group} group
 * @param {number} gap
 * @param {number} [width=Infinity]
 * @param {number} [height=Infinity]
 */
var box = boxLayout;
/**
 * VBox layouting
 * @param {module:zrender/graphic/Group} group
 * @param {number} gap
 * @param {number} [width=Infinity]
 * @param {number} [height=Infinity]
 */
curry$1(boxLayout, 'vertical');
/**
 * HBox layouting
 * @param {module:zrender/graphic/Group} group
 * @param {number} gap
 * @param {number} [width=Infinity]
 * @param {number} [height=Infinity]
 */
curry$1(boxLayout, 'horizontal');
/**
 * If x or x2 is not specified or 'center' 'left' 'right',
 * the width would be as long as possible.
 * If y or y2 is not specified or 'middle' 'top' 'bottom',
 * the height would be as long as possible.
 */
function getAvailableSize(positionInfo, containerRect, margin) {
  var containerWidth = containerRect.width;
  var containerHeight = containerRect.height;
  var x = parsePercent(positionInfo.left, containerWidth);
  var y = parsePercent(positionInfo.top, containerHeight);
  var x2 = parsePercent(positionInfo.right, containerWidth);
  var y2 = parsePercent(positionInfo.bottom, containerHeight);
  (isNaN(x) || isNaN(parseFloat(positionInfo.left))) && (x = 0);
  (isNaN(x2) || isNaN(parseFloat(positionInfo.right))) && (x2 = containerWidth);
  (isNaN(y) || isNaN(parseFloat(positionInfo.top))) && (y = 0);
  (isNaN(y2) || isNaN(parseFloat(positionInfo.bottom))) && (y2 = containerHeight);
  margin = normalizeCssArray(margin || 0);
  return {
    width: Math.max(x2 - x - margin[1] - margin[3], 0),
    height: Math.max(y2 - y - margin[0] - margin[2], 0)
  };
}
/**
 * Parse position info.
 */
function getLayoutRect(positionInfo, containerRect, margin) {
  margin = normalizeCssArray(margin || 0);
  var containerWidth = containerRect.width;
  var containerHeight = containerRect.height;
  var left = parsePercent(positionInfo.left, containerWidth);
  var top = parsePercent(positionInfo.top, containerHeight);
  var right = parsePercent(positionInfo.right, containerWidth);
  var bottom = parsePercent(positionInfo.bottom, containerHeight);
  var width = parsePercent(positionInfo.width, containerWidth);
  var height = parsePercent(positionInfo.height, containerHeight);
  var verticalMargin = margin[2] + margin[0];
  var horizontalMargin = margin[1] + margin[3];
  var aspect = positionInfo.aspect;
  // If width is not specified, calculate width from left and right
  if (isNaN(width)) {
    width = containerWidth - right - horizontalMargin - left;
  }
  if (isNaN(height)) {
    height = containerHeight - bottom - verticalMargin - top;
  }
  if (aspect != null) {
    // If width and height are not given
    // 1. Graph should not exceeds the container
    // 2. Aspect must be keeped
    // 3. Graph should take the space as more as possible
    // FIXME
    // Margin is not considered, because there is no case that both
    // using margin and aspect so far.
    if (isNaN(width) && isNaN(height)) {
      if (aspect > containerWidth / containerHeight) {
        width = containerWidth * 0.8;
      } else {
        height = containerHeight * 0.8;
      }
    }
    // Calculate width or height with given aspect
    if (isNaN(width)) {
      width = aspect * height;
    }
    if (isNaN(height)) {
      height = width / aspect;
    }
  }
  // If left is not specified, calculate left from right and width
  if (isNaN(left)) {
    left = containerWidth - right - width - horizontalMargin;
  }
  if (isNaN(top)) {
    top = containerHeight - bottom - height - verticalMargin;
  }
  // Align left and top
  switch (positionInfo.left || positionInfo.right) {
    case 'center':
      left = containerWidth / 2 - width / 2 - margin[3];
      break;
    case 'right':
      left = containerWidth - width - horizontalMargin;
      break;
  }
  switch (positionInfo.top || positionInfo.bottom) {
    case 'middle':
    case 'center':
      top = containerHeight / 2 - height / 2 - margin[0];
      break;
    case 'bottom':
      top = containerHeight - height - verticalMargin;
      break;
  }
  // If something is wrong and left, top, width, height are calculated as NaN
  left = left || 0;
  top = top || 0;
  if (isNaN(width)) {
    // Width may be NaN if only one value is given except width
    width = containerWidth - horizontalMargin - left - (right || 0);
  }
  if (isNaN(height)) {
    // Height may be NaN if only one value is given except height
    height = containerHeight - verticalMargin - top - (bottom || 0);
  }
  var rect = new BoundingRect$1(left + margin[3], top + margin[0], width, height);
  rect.margin = margin;
  return rect;
}
/**
 * Position a zr element in viewport
 *  Group position is specified by either
 *  {left, top}, {right, bottom}
 *  If all properties exists, right and bottom will be igonred.
 *
 * Logic:
 *     1. Scale (against origin point in parent coord)
 *     2. Rotate (against origin point in parent coord)
 *     3. Translate (with el.position by this method)
 * So this method only fixes the last step 'Translate', which does not affect
 * scaling and rotating.
 *
 * If be called repeatedly with the same input el, the same result will be gotten.
 *
 * Return true if the layout happened.
 *
 * @param el Should have `getBoundingRect` method.
 * @param positionInfo
 * @param positionInfo.left
 * @param positionInfo.top
 * @param positionInfo.right
 * @param positionInfo.bottom
 * @param positionInfo.width Only for opt.boundingModel: 'raw'
 * @param positionInfo.height Only for opt.boundingModel: 'raw'
 * @param containerRect
 * @param margin
 * @param opt
 * @param opt.hv Only horizontal or only vertical. Default to be [1, 1]
 * @param opt.boundingMode
 *        Specify how to calculate boundingRect when locating.
 *        'all': Position the boundingRect that is transformed and uioned
 *               both itself and its descendants.
 *               This mode simplies confine the elements in the bounding
 *               of their container (e.g., using 'right: 0').
 *        'raw': Position the boundingRect that is not transformed and only itself.
 *               This mode is useful when you want a element can overflow its
 *               container. (Consider a rotated circle needs to be located in a corner.)
 *               In this mode positionInfo.width/height can only be number.
 */
function positionElement(el, positionInfo, containerRect, margin, opt, out) {
  var h = !opt || !opt.hv || opt.hv[0];
  var v = !opt || !opt.hv || opt.hv[1];
  var boundingMode = opt && opt.boundingMode || 'all';
  out = out || el;
  out.x = el.x;
  out.y = el.y;
  if (!h && !v) {
    return false;
  }
  var rect;
  if (boundingMode === 'raw') {
    rect = el.type === 'group' ? new BoundingRect$1(0, 0, +positionInfo.width || 0, +positionInfo.height || 0) : el.getBoundingRect();
  } else {
    rect = el.getBoundingRect();
    if (el.needLocalTransform()) {
      var transform = el.getLocalTransform();
      // Notice: raw rect may be inner object of el,
      // which should not be modified.
      rect = rect.clone();
      rect.applyTransform(transform);
    }
  }
  // The real width and height can not be specified but calculated by the given el.
  var layoutRect = getLayoutRect(defaults({
    width: rect.width,
    height: rect.height
  }, positionInfo), containerRect, margin);
  // Because 'tranlate' is the last step in transform
  // (see zrender/core/Transformable#getLocalTransform),
  // we can just only modify el.position to get final result.
  var dx = h ? layoutRect.x - rect.x : 0;
  var dy = v ? layoutRect.y - rect.y : 0;
  if (boundingMode === 'raw') {
    out.x = dx;
    out.y = dy;
  } else {
    out.x += dx;
    out.y += dy;
  }
  if (out === el) {
    el.markRedraw();
  }
  return true;
}
/**
 * @param option Contains some of the properties in HV_NAMES.
 * @param hvIdx 0: horizontal; 1: vertical.
 */
function sizeCalculable(option, hvIdx) {
  return option[HV_NAMES[hvIdx][0]] != null || option[HV_NAMES[hvIdx][1]] != null && option[HV_NAMES[hvIdx][2]] != null;
}
function fetchLayoutMode(ins) {
  var layoutMode = ins.layoutMode || ins.constructor.layoutMode;
  return isObject$3(layoutMode) ? layoutMode : layoutMode ? {
    type: layoutMode
  } : null;
}
/**
 * Consider Case:
 * When default option has {left: 0, width: 100}, and we set {right: 0}
 * through setOption or media query, using normal zrUtil.merge will cause
 * {right: 0} does not take effect.
 *
 * @example
 * ComponentModel.extend({
 *     init: function () {
 *         ...
 *         let inputPositionParams = layout.getLayoutParams(option);
 *         this.mergeOption(inputPositionParams);
 *     },
 *     mergeOption: function (newOption) {
 *         newOption && zrUtil.merge(thisOption, newOption, true);
 *         layout.mergeLayoutParam(thisOption, newOption);
 *     }
 * });
 *
 * @param targetOption
 * @param newOption
 * @param opt
 */
function mergeLayoutParam(targetOption, newOption, opt) {
  var ignoreSize = opt && opt.ignoreSize;
  !isArray$1(ignoreSize) && (ignoreSize = [ignoreSize, ignoreSize]);
  var hResult = merge(HV_NAMES[0], 0);
  var vResult = merge(HV_NAMES[1], 1);
  copy(HV_NAMES[0], targetOption, hResult);
  copy(HV_NAMES[1], targetOption, vResult);
  function merge(names, hvIdx) {
    var newParams = {};
    var newValueCount = 0;
    var merged = {};
    var mergedValueCount = 0;
    var enoughParamNumber = 2;
    each$e(names, function (name) {
      merged[name] = targetOption[name];
    });
    each$e(names, function (name) {
      // Consider case: newOption.width is null, which is
      // set by user for removing width setting.
      hasProp(newOption, name) && (newParams[name] = merged[name] = newOption[name]);
      hasValue(newParams, name) && newValueCount++;
      hasValue(merged, name) && mergedValueCount++;
    });
    if (ignoreSize[hvIdx]) {
      // Only one of left/right is premitted to exist.
      if (hasValue(newOption, names[1])) {
        merged[names[2]] = null;
      } else if (hasValue(newOption, names[2])) {
        merged[names[1]] = null;
      }
      return merged;
    }
    // Case: newOption: {width: ..., right: ...},
    // or targetOption: {right: ...} and newOption: {width: ...},
    // There is no conflict when merged only has params count
    // little than enoughParamNumber.
    if (mergedValueCount === enoughParamNumber || !newValueCount) {
      return merged;
    }
    // Case: newOption: {width: ..., right: ...},
    // Than we can make sure user only want those two, and ignore
    // all origin params in targetOption.
    else if (newValueCount >= enoughParamNumber) {
      return newParams;
    } else {
      // Chose another param from targetOption by priority.
      for (var i = 0; i < names.length; i++) {
        var name_1 = names[i];
        if (!hasProp(newParams, name_1) && hasProp(targetOption, name_1)) {
          newParams[name_1] = targetOption[name_1];
          break;
        }
      }
      return newParams;
    }
  }
  function hasProp(obj, name) {
    return obj.hasOwnProperty(name);
  }
  function hasValue(obj, name) {
    return obj[name] != null && obj[name] !== 'auto';
  }
  function copy(names, target, source) {
    each$e(names, function (name) {
      target[name] = source[name];
    });
  }
}
/**
 * Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object.
 */
function getLayoutParams(source) {
  return copyLayoutParams({}, source);
}
/**
 * Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object.
 * @param {Object} source
 * @return {Object} Result contains those props.
 */
function copyLayoutParams(target, source) {
  source && target && each$e(LOCATION_PARAMS, function (name) {
    source.hasOwnProperty(name) && (target[name] = source[name]);
  });
  return target;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$l = makeInner();
var ComponentModel = /** @class */function (_super) {
  __extends(ComponentModel, _super);
  function ComponentModel(option, parentModel, ecModel) {
    var _this = _super.call(this, option, parentModel, ecModel) || this;
    _this.uid = getUID('ec_cpt_model');
    return _this;
  }
  ComponentModel.prototype.init = function (option, parentModel, ecModel) {
    this.mergeDefaultAndTheme(option, ecModel);
  };
  ComponentModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {
    var layoutMode = fetchLayoutMode(this);
    var inputPositionParams = layoutMode ? getLayoutParams(option) : {};
    var themeModel = ecModel.getTheme();
    merge(option, themeModel.get(this.mainType));
    merge(option, this.getDefaultOption());
    if (layoutMode) {
      mergeLayoutParam(option, inputPositionParams, layoutMode);
    }
  };
  ComponentModel.prototype.mergeOption = function (option, ecModel) {
    merge(this.option, option, true);
    var layoutMode = fetchLayoutMode(this);
    if (layoutMode) {
      mergeLayoutParam(this.option, option, layoutMode);
    }
  };
  /**
   * Called immediately after `init` or `mergeOption` of this instance called.
   */
  ComponentModel.prototype.optionUpdated = function (newCptOption, isInit) {};
  /**
   * [How to declare defaultOption]:
   *
   * (A) If using class declaration in typescript (since echarts 5):
   * ```ts
   * import {ComponentOption} from '../model/option.js';
   * export interface XxxOption extends ComponentOption {
   *     aaa: number
   * }
   * export class XxxModel extends Component {
   *     static type = 'xxx';
   *     static defaultOption: XxxOption = {
   *         aaa: 123
   *     }
   * }
   * Component.registerClass(XxxModel);
   * ```
   * ```ts
   * import {inheritDefaultOption} from '../util/component.js';
   * import {XxxModel, XxxOption} from './XxxModel.js';
   * export interface XxxSubOption extends XxxOption {
   *     bbb: number
   * }
   * class XxxSubModel extends XxxModel {
   *     static defaultOption: XxxSubOption = inheritDefaultOption(XxxModel.defaultOption, {
   *         bbb: 456
   *     })
   *     fn() {
   *         let opt = this.getDefaultOption();
   *         // opt is {aaa: 123, bbb: 456}
   *     }
   * }
   * ```
   *
   * (B) If using class extend (previous approach in echarts 3 & 4):
   * ```js
   * let XxxComponent = Component.extend({
   *     defaultOption: {
   *         xx: 123
   *     }
   * })
   * ```
   * ```js
   * let XxxSubComponent = XxxComponent.extend({
   *     defaultOption: {
   *         yy: 456
   *     },
   *     fn: function () {
   *         let opt = this.getDefaultOption();
   *         // opt is {xx: 123, yy: 456}
   *     }
   * })
   * ```
   */
  ComponentModel.prototype.getDefaultOption = function () {
    var ctor = this.constructor;
    // If using class declaration, it is different to travel super class
    // in legacy env and auto merge defaultOption. So if using class
    // declaration, defaultOption should be merged manually.
    if (!isExtendedClass(ctor)) {
      // When using ts class, defaultOption must be declared as static.
      return ctor.defaultOption;
    }
    // FIXME: remove this approach?
    var fields = inner$l(this);
    if (!fields.defaultOption) {
      var optList = [];
      var clz = ctor;
      while (clz) {
        var opt = clz.prototype.defaultOption;
        opt && optList.push(opt);
        clz = clz.superClass;
      }
      var defaultOption = {};
      for (var i = optList.length - 1; i >= 0; i--) {
        defaultOption = merge(defaultOption, optList[i], true);
      }
      fields.defaultOption = defaultOption;
    }
    return fields.defaultOption;
  };
  /**
   * Notice: always force to input param `useDefault` in case that forget to consider it.
   * The same behavior as `modelUtil.parseFinder`.
   *
   * @param useDefault In many cases like series refer axis and axis refer grid,
   *        If axis index / axis id not specified, use the first target as default.
   *        In other cases like dataZoom refer axis, if not specified, measn no refer.
   */
  ComponentModel.prototype.getReferringComponents = function (mainType, opt) {
    var indexKey = mainType + 'Index';
    var idKey = mainType + 'Id';
    return queryReferringComponents(this.ecModel, mainType, {
      index: this.get(indexKey, true),
      id: this.get(idKey, true)
    }, opt);
  };
  ComponentModel.prototype.getBoxLayoutParams = function () {
    // Consider itself having box layout configs.
    var boxLayoutModel = this;
    return {
      left: boxLayoutModel.get('left'),
      top: boxLayoutModel.get('top'),
      right: boxLayoutModel.get('right'),
      bottom: boxLayoutModel.get('bottom'),
      width: boxLayoutModel.get('width'),
      height: boxLayoutModel.get('height')
    };
  };
  /**
   * Get key for zlevel.
   * If developers don't configure zlevel. We will assign zlevel to series based on the key.
   * For example, lines with trail effect and progressive series will in an individual zlevel.
   */
  ComponentModel.prototype.getZLevelKey = function () {
    return '';
  };
  ComponentModel.prototype.setZLevel = function (zlevel) {
    this.option.zlevel = zlevel;
  };
  ComponentModel.protoInitialize = function () {
    var proto = ComponentModel.prototype;
    proto.type = 'component';
    proto.id = '';
    proto.name = '';
    proto.mainType = '';
    proto.subType = '';
    proto.componentIndex = 0;
  }();
  return ComponentModel;
}(Model$1);
mountExtend(ComponentModel, Model$1);
enableClassManagement(ComponentModel);
enableSubTypeDefaulter(ComponentModel);
enableTopologicalTravel(ComponentModel, getDependencies);
function getDependencies(componentType) {
  var deps = [];
  each$f(ComponentModel.getClassesByMainType(componentType), function (clz) {
    deps = deps.concat(clz.dependencies || clz.prototype.dependencies || []);
  });
  // Ensure main type.
  deps = map$1(deps, function (type) {
    return parseClassType(type).main;
  });
  // Hack dataset for convenience.
  if (componentType !== 'dataset' && indexOf(deps, 'dataset') <= 0) {
    deps.unshift('dataset');
  }
  return deps;
}
var ComponentModel$1 = ComponentModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var platform = '';
// Navigator not exists in node
if (typeof navigator !== 'undefined') {
  /* global navigator */
  platform = navigator.platform || '';
}
var decalColor = 'rgba(0, 0, 0, 0.2)';
var globalDefault = {
  darkMode: 'auto',
  // backgroundColor: 'rgba(0,0,0,0)',
  colorBy: 'series',
  color: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],
  gradientColor: ['#f6efa6', '#d88273', '#bf444c'],
  aria: {
    decal: {
      decals: [{
        color: decalColor,
        dashArrayX: [1, 0],
        dashArrayY: [2, 5],
        symbolSize: 1,
        rotation: Math.PI / 6
      }, {
        color: decalColor,
        symbol: 'circle',
        dashArrayX: [[8, 8], [0, 8, 8, 0]],
        dashArrayY: [6, 0],
        symbolSize: 0.8
      }, {
        color: decalColor,
        dashArrayX: [1, 0],
        dashArrayY: [4, 3],
        rotation: -Math.PI / 4
      }, {
        color: decalColor,
        dashArrayX: [[6, 6], [0, 6, 6, 0]],
        dashArrayY: [6, 0]
      }, {
        color: decalColor,
        dashArrayX: [[1, 0], [1, 6]],
        dashArrayY: [1, 0, 6, 0],
        rotation: Math.PI / 4
      }, {
        color: decalColor,
        symbol: 'triangle',
        dashArrayX: [[9, 9], [0, 9, 9, 0]],
        dashArrayY: [7, 2],
        symbolSize: 0.75
      }]
    }
  },
  // If xAxis and yAxis declared, grid is created by default.
  // grid: {},
  textStyle: {
    // color: '#000',
    // decoration: 'none',
    // PENDING
    fontFamily: platform.match(/^Win/) ? 'Microsoft YaHei' : 'sans-serif',
    // fontFamily: 'Arial, Verdana, sans-serif',
    fontSize: 12,
    fontStyle: 'normal',
    fontWeight: 'normal'
  },
  // http://blogs.adobe.com/webplatform/2014/02/24/using-blend-modes-in-html-canvas/
  // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
  // Default is source-over
  blendMode: null,
  stateAnimation: {
    duration: 300,
    easing: 'cubicOut'
  },
  animation: 'auto',
  animationDuration: 1000,
  animationDurationUpdate: 500,
  animationEasing: 'cubicInOut',
  animationEasingUpdate: 'cubicInOut',
  animationThreshold: 2000,
  // Configuration for progressive/incremental rendering
  progressiveThreshold: 3000,
  progressive: 400,
  // Threshold of if use single hover layer to optimize.
  // It is recommended that `hoverLayerThreshold` is equivalent to or less than
  // `progressiveThreshold`, otherwise hover will cause restart of progressive,
  // which is unexpected.
  // see example <echarts/test/heatmap-large.html>.
  hoverLayerThreshold: 3000,
  // See: module:echarts/scale/Time
  useUTC: false
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var VISUAL_DIMENSIONS = createHashMap(['tooltip', 'label', 'itemName', 'itemId', 'itemGroupId', 'itemChildGroupId', 'seriesName']);
var SOURCE_FORMAT_ORIGINAL = 'original';
var SOURCE_FORMAT_ARRAY_ROWS = 'arrayRows';
var SOURCE_FORMAT_OBJECT_ROWS = 'objectRows';
var SOURCE_FORMAT_KEYED_COLUMNS = 'keyedColumns';
var SOURCE_FORMAT_TYPED_ARRAY = 'typedArray';
var SOURCE_FORMAT_UNKNOWN = 'unknown';
var SERIES_LAYOUT_BY_COLUMN = 'column';
var SERIES_LAYOUT_BY_ROW = 'row';

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// The result of `guessOrdinal`.
var BE_ORDINAL = {
  Must: 1,
  Might: 2,
  Not: 3 // Other cases
};
var innerGlobalModel = makeInner();
/**
 * MUST be called before mergeOption of all series.
 */
function resetSourceDefaulter(ecModel) {
  // `datasetMap` is used to make default encode.
  innerGlobalModel(ecModel).datasetMap = createHashMap();
}
/**
 * [The strategy of the arrengment of data dimensions for dataset]:
 * "value way": all axes are non-category axes. So series one by one take
 *     several (the number is coordSysDims.length) dimensions from dataset.
 *     The result of data arrengment of data dimensions like:
 *     | ser0_x | ser0_y | ser1_x | ser1_y | ser2_x | ser2_y |
 * "category way": at least one axis is category axis. So the the first data
 *     dimension is always mapped to the first category axis and shared by
 *     all of the series. The other data dimensions are taken by series like
 *     "value way" does.
 *     The result of data arrengment of data dimensions like:
 *     | ser_shared_x | ser0_y | ser1_y | ser2_y |
 *
 * @return encode Never be `null/undefined`.
 */
function makeSeriesEncodeForAxisCoordSys(coordDimensions, seriesModel, source) {
  var encode = {};
  var datasetModel = querySeriesUpstreamDatasetModel(seriesModel);
  // Currently only make default when using dataset, util more reqirements occur.
  if (!datasetModel || !coordDimensions) {
    return encode;
  }
  var encodeItemName = [];
  var encodeSeriesName = [];
  var ecModel = seriesModel.ecModel;
  var datasetMap = innerGlobalModel(ecModel).datasetMap;
  var key = datasetModel.uid + '_' + source.seriesLayoutBy;
  var baseCategoryDimIndex;
  var categoryWayValueDimStart;
  coordDimensions = coordDimensions.slice();
  each$f(coordDimensions, function (coordDimInfoLoose, coordDimIdx) {
    var coordDimInfo = isObject$3(coordDimInfoLoose) ? coordDimInfoLoose : coordDimensions[coordDimIdx] = {
      name: coordDimInfoLoose
    };
    if (coordDimInfo.type === 'ordinal' && baseCategoryDimIndex == null) {
      baseCategoryDimIndex = coordDimIdx;
      categoryWayValueDimStart = getDataDimCountOnCoordDim(coordDimInfo);
    }
    encode[coordDimInfo.name] = [];
  });
  var datasetRecord = datasetMap.get(key) || datasetMap.set(key, {
    categoryWayDim: categoryWayValueDimStart,
    valueWayDim: 0
  });
  // TODO
  // Auto detect first time axis and do arrangement.
  each$f(coordDimensions, function (coordDimInfo, coordDimIdx) {
    var coordDimName = coordDimInfo.name;
    var count = getDataDimCountOnCoordDim(coordDimInfo);
    // In value way.
    if (baseCategoryDimIndex == null) {
      var start = datasetRecord.valueWayDim;
      pushDim(encode[coordDimName], start, count);
      pushDim(encodeSeriesName, start, count);
      datasetRecord.valueWayDim += count;
      // ??? TODO give a better default series name rule?
      // especially when encode x y specified.
      // consider: when multiple series share one dimension
      // category axis, series name should better use
      // the other dimension name. On the other hand, use
      // both dimensions name.
    }
    // In category way, the first category axis.
    else if (baseCategoryDimIndex === coordDimIdx) {
      pushDim(encode[coordDimName], 0, count);
      pushDim(encodeItemName, 0, count);
    }
    // In category way, the other axis.
    else {
      var start = datasetRecord.categoryWayDim;
      pushDim(encode[coordDimName], start, count);
      pushDim(encodeSeriesName, start, count);
      datasetRecord.categoryWayDim += count;
    }
  });
  function pushDim(dimIdxArr, idxFrom, idxCount) {
    for (var i = 0; i < idxCount; i++) {
      dimIdxArr.push(idxFrom + i);
    }
  }
  function getDataDimCountOnCoordDim(coordDimInfo) {
    var dimsDef = coordDimInfo.dimsDef;
    return dimsDef ? dimsDef.length : 1;
  }
  encodeItemName.length && (encode.itemName = encodeItemName);
  encodeSeriesName.length && (encode.seriesName = encodeSeriesName);
  return encode;
}
/**
 * Work for data like [{name: ..., value: ...}, ...].
 *
 * @return encode Never be `null/undefined`.
 */
function makeSeriesEncodeForNameBased(seriesModel, source, dimCount) {
  var encode = {};
  var datasetModel = querySeriesUpstreamDatasetModel(seriesModel);
  // Currently only make default when using dataset, util more reqirements occur.
  if (!datasetModel) {
    return encode;
  }
  var sourceFormat = source.sourceFormat;
  var dimensionsDefine = source.dimensionsDefine;
  var potentialNameDimIndex;
  if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS || sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS) {
    each$f(dimensionsDefine, function (dim, idx) {
      if ((isObject$3(dim) ? dim.name : dim) === 'name') {
        potentialNameDimIndex = idx;
      }
    });
  }
  var idxResult = function () {
    var idxRes0 = {};
    var idxRes1 = {};
    var guessRecords = [];
    // 5 is an experience value.
    for (var i = 0, len = Math.min(5, dimCount); i < len; i++) {
      var guessResult = doGuessOrdinal(source.data, sourceFormat, source.seriesLayoutBy, dimensionsDefine, source.startIndex, i);
      guessRecords.push(guessResult);
      var isPureNumber = guessResult === BE_ORDINAL.Not;
      // [Strategy of idxRes0]: find the first BE_ORDINAL.Not as the value dim,
      // and then find a name dim with the priority:
      // "BE_ORDINAL.Might|BE_ORDINAL.Must" > "other dim" > "the value dim itself".
      if (isPureNumber && idxRes0.v == null && i !== potentialNameDimIndex) {
        idxRes0.v = i;
      }
      if (idxRes0.n == null || idxRes0.n === idxRes0.v || !isPureNumber && guessRecords[idxRes0.n] === BE_ORDINAL.Not) {
        idxRes0.n = i;
      }
      if (fulfilled(idxRes0) && guessRecords[idxRes0.n] !== BE_ORDINAL.Not) {
        return idxRes0;
      }
      // [Strategy of idxRes1]: if idxRes0 not satisfied (that is, no BE_ORDINAL.Not),
      // find the first BE_ORDINAL.Might as the value dim,
      // and then find a name dim with the priority:
      // "other dim" > "the value dim itself".
      // That is for backward compat: number-like (e.g., `'3'`, `'55'`) can be
      // treated as number.
      if (!isPureNumber) {
        if (guessResult === BE_ORDINAL.Might && idxRes1.v == null && i !== potentialNameDimIndex) {
          idxRes1.v = i;
        }
        if (idxRes1.n == null || idxRes1.n === idxRes1.v) {
          idxRes1.n = i;
        }
      }
    }
    function fulfilled(idxResult) {
      return idxResult.v != null && idxResult.n != null;
    }
    return fulfilled(idxRes0) ? idxRes0 : fulfilled(idxRes1) ? idxRes1 : null;
  }();
  if (idxResult) {
    encode.value = [idxResult.v];
    // `potentialNameDimIndex` has highest priority.
    var nameDimIndex = potentialNameDimIndex != null ? potentialNameDimIndex : idxResult.n;
    // By default, label uses itemName in charts.
    // So we don't set encodeLabel here.
    encode.itemName = [nameDimIndex];
    encode.seriesName = [nameDimIndex];
  }
  return encode;
}
/**
 * @return If return null/undefined, indicate that should not use datasetModel.
 */
function querySeriesUpstreamDatasetModel(seriesModel) {
  // Caution: consider the scenario:
  // A dataset is declared and a series is not expected to use the dataset,
  // and at the beginning `setOption({series: { noData })` (just prepare other
  // option but no data), then `setOption({series: {data: [...]}); In this case,
  // the user should set an empty array to avoid that dataset is used by default.
  var thisData = seriesModel.get('data', true);
  if (!thisData) {
    return queryReferringComponents(seriesModel.ecModel, 'dataset', {
      index: seriesModel.get('datasetIndex', true),
      id: seriesModel.get('datasetId', true)
    }, SINGLE_REFERRING).models[0];
  }
}
/**
 * @return Always return an array event empty.
 */
function queryDatasetUpstreamDatasetModels(datasetModel) {
  // Only these attributes declared, we by default reference to `datasetIndex: 0`.
  // Otherwise, no reference.
  if (!datasetModel.get('transform', true) && !datasetModel.get('fromTransformResult', true)) {
    return [];
  }
  return queryReferringComponents(datasetModel.ecModel, 'dataset', {
    index: datasetModel.get('fromDatasetIndex', true),
    id: datasetModel.get('fromDatasetId', true)
  }, SINGLE_REFERRING).models;
}
/**
 * The rule should not be complex, otherwise user might not
 * be able to known where the data is wrong.
 * The code is ugly, but how to make it neat?
 */
function guessOrdinal(source, dimIndex) {
  return doGuessOrdinal(source.data, source.sourceFormat, source.seriesLayoutBy, source.dimensionsDefine, source.startIndex, dimIndex);
}
// dimIndex may be overflow source data.
// return {BE_ORDINAL}
function doGuessOrdinal(data, sourceFormat, seriesLayoutBy, dimensionsDefine, startIndex, dimIndex) {
  var result;
  // Experience value.
  var maxLoop = 5;
  if (isTypedArray$1(data)) {
    return BE_ORDINAL.Not;
  }
  // When sourceType is 'objectRows' or 'keyedColumns', dimensionsDefine
  // always exists in source.
  var dimName;
  var dimType;
  if (dimensionsDefine) {
    var dimDefItem = dimensionsDefine[dimIndex];
    if (isObject$3(dimDefItem)) {
      dimName = dimDefItem.name;
      dimType = dimDefItem.type;
    } else if (isString(dimDefItem)) {
      dimName = dimDefItem;
    }
  }
  if (dimType != null) {
    return dimType === 'ordinal' ? BE_ORDINAL.Must : BE_ORDINAL.Not;
  }
  if (sourceFormat === SOURCE_FORMAT_ARRAY_ROWS) {
    var dataArrayRows = data;
    if (seriesLayoutBy === SERIES_LAYOUT_BY_ROW) {
      var sample = dataArrayRows[dimIndex];
      for (var i = 0; i < (sample || []).length && i < maxLoop; i++) {
        if ((result = detectValue(sample[startIndex + i])) != null) {
          return result;
        }
      }
    } else {
      for (var i = 0; i < dataArrayRows.length && i < maxLoop; i++) {
        var row = dataArrayRows[startIndex + i];
        if (row && (result = detectValue(row[dimIndex])) != null) {
          return result;
        }
      }
    }
  } else if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS) {
    var dataObjectRows = data;
    if (!dimName) {
      return BE_ORDINAL.Not;
    }
    for (var i = 0; i < dataObjectRows.length && i < maxLoop; i++) {
      var item = dataObjectRows[i];
      if (item && (result = detectValue(item[dimName])) != null) {
        return result;
      }
    }
  } else if (sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS) {
    var dataKeyedColumns = data;
    if (!dimName) {
      return BE_ORDINAL.Not;
    }
    var sample = dataKeyedColumns[dimName];
    if (!sample || isTypedArray$1(sample)) {
      return BE_ORDINAL.Not;
    }
    for (var i = 0; i < sample.length && i < maxLoop; i++) {
      if ((result = detectValue(sample[i])) != null) {
        return result;
      }
    }
  } else if (sourceFormat === SOURCE_FORMAT_ORIGINAL) {
    var dataOriginal = data;
    for (var i = 0; i < dataOriginal.length && i < maxLoop; i++) {
      var item = dataOriginal[i];
      var val = getDataItemValue(item);
      if (!isArray$1(val)) {
        return BE_ORDINAL.Not;
      }
      if ((result = detectValue(val[dimIndex])) != null) {
        return result;
      }
    }
  }
  function detectValue(val) {
    var beStr = isString(val);
    // Consider usage convenience, '1', '2' will be treated as "number".
    // `Number('')` (or any whitespace) is `0`.
    if (val != null && Number.isFinite(Number(val)) && val !== '') {
      return beStr ? BE_ORDINAL.Might : BE_ORDINAL.Not;
    } else if (beStr && val !== '-') {
      return BE_ORDINAL.Must;
    }
  }
  return BE_ORDINAL.Not;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var internalOptionCreatorMap = createHashMap();
function registerInternalOptionCreator(mainType, creator) {
  assert(internalOptionCreatorMap.get(mainType) == null && creator);
  internalOptionCreatorMap.set(mainType, creator);
}
function concatInternalOptions(ecModel, mainType, newCmptOptionList) {
  var internalOptionCreator = internalOptionCreatorMap.get(mainType);
  if (!internalOptionCreator) {
    return newCmptOptionList;
  }
  var internalOptions = internalOptionCreator(ecModel);
  if (!internalOptions) {
    return newCmptOptionList;
  }
  {
    for (var i = 0; i < internalOptions.length; i++) {
      assert(isComponentIdInternal(internalOptions[i]));
    }
  }
  return newCmptOptionList.concat(internalOptions);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var innerColor = makeInner();
var innerDecal = makeInner();
var PaletteMixin = /** @class */function () {
  function PaletteMixin() {}
  PaletteMixin.prototype.getColorFromPalette = function (name, scope, requestNum) {
    var defaultPalette = normalizeToArray(this.get('color', true));
    var layeredPalette = this.get('colorLayer', true);
    return getFromPalette(this, innerColor, defaultPalette, layeredPalette, name, scope, requestNum);
  };
  PaletteMixin.prototype.clearColorPalette = function () {
    clearPalette(this, innerColor);
  };
  return PaletteMixin;
}();
function getDecalFromPalette(ecModel, name, scope, requestNum) {
  var defaultDecals = normalizeToArray(ecModel.get(['aria', 'decal', 'decals']));
  return getFromPalette(ecModel, innerDecal, defaultDecals, null, name, scope, requestNum);
}
function getNearestPalette(palettes, requestColorNum) {
  var paletteNum = palettes.length;
  // TODO palettes must be in order
  for (var i = 0; i < paletteNum; i++) {
    if (palettes[i].length > requestColorNum) {
      return palettes[i];
    }
  }
  return palettes[paletteNum - 1];
}
/**
 * @param name MUST NOT be null/undefined. Otherwise call this function
 *             twise with the same parameters will get different result.
 * @param scope default this.
 * @return Can be null/undefined
 */
function getFromPalette(that, inner, defaultPalette, layeredPalette, name, scope, requestNum) {
  scope = scope || that;
  var scopeFields = inner(scope);
  var paletteIdx = scopeFields.paletteIdx || 0;
  var paletteNameMap = scopeFields.paletteNameMap = scopeFields.paletteNameMap || {};
  // Use `hasOwnProperty` to avoid conflict with Object.prototype.
  if (paletteNameMap.hasOwnProperty(name)) {
    return paletteNameMap[name];
  }
  var palette = requestNum == null || !layeredPalette ? defaultPalette : getNearestPalette(layeredPalette, requestNum);
  // In case can't find in layered color palette.
  palette = palette || defaultPalette;
  if (!palette || !palette.length) {
    return;
  }
  var pickedPaletteItem = palette[paletteIdx];
  if (name) {
    paletteNameMap[name] = pickedPaletteItem;
  }
  scopeFields.paletteIdx = (paletteIdx + 1) % palette.length;
  return pickedPaletteItem;
}
function clearPalette(that, inner) {
  inner(that).paletteIdx = 0;
  inner(that).paletteNameMap = {};
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// -----------------------
// Internal method names:
// -----------------------
var reCreateSeriesIndices;
var assertSeriesInitialized;
var initBase;
var OPTION_INNER_KEY = '\0_ec_inner';
var OPTION_INNER_VALUE = 1;
var BUITIN_COMPONENTS_MAP = {
  grid: 'GridComponent',
  polar: 'PolarComponent',
  geo: 'GeoComponent',
  singleAxis: 'SingleAxisComponent',
  parallel: 'ParallelComponent',
  calendar: 'CalendarComponent',
  graphic: 'GraphicComponent',
  toolbox: 'ToolboxComponent',
  tooltip: 'TooltipComponent',
  axisPointer: 'AxisPointerComponent',
  brush: 'BrushComponent',
  title: 'TitleComponent',
  timeline: 'TimelineComponent',
  markPoint: 'MarkPointComponent',
  markLine: 'MarkLineComponent',
  markArea: 'MarkAreaComponent',
  legend: 'LegendComponent',
  dataZoom: 'DataZoomComponent',
  visualMap: 'VisualMapComponent',
  // aria: 'AriaComponent',
  // dataset: 'DatasetComponent',
  // Dependencies
  xAxis: 'GridComponent',
  yAxis: 'GridComponent',
  angleAxis: 'PolarComponent',
  radiusAxis: 'PolarComponent'
};
var BUILTIN_CHARTS_MAP = {
  line: 'LineChart',
  bar: 'BarChart',
  pie: 'PieChart',
  scatter: 'ScatterChart',
  radar: 'RadarChart',
  map: 'MapChart',
  tree: 'TreeChart',
  treemap: 'TreemapChart',
  graph: 'GraphChart',
  gauge: 'GaugeChart',
  funnel: 'FunnelChart',
  parallel: 'ParallelChart',
  sankey: 'SankeyChart',
  boxplot: 'BoxplotChart',
  candlestick: 'CandlestickChart',
  effectScatter: 'EffectScatterChart',
  lines: 'LinesChart',
  heatmap: 'HeatmapChart',
  pictorialBar: 'PictorialBarChart',
  themeRiver: 'ThemeRiverChart',
  sunburst: 'SunburstChart',
  custom: 'CustomChart'
};
var componetsMissingLogPrinted = {};
function checkMissingComponents(option) {
  each$f(option, function (componentOption, mainType) {
    if (!ComponentModel$1.hasClass(mainType)) {
      var componentImportName = BUITIN_COMPONENTS_MAP[mainType];
      if (componentImportName && !componetsMissingLogPrinted[componentImportName]) {
        error("Component " + mainType + " is used but not imported.\nimport { " + componentImportName + " } from 'echarts/components';\necharts.use([" + componentImportName + "]);");
        componetsMissingLogPrinted[componentImportName] = true;
      }
    }
  });
}
var GlobalModel = /** @class */function (_super) {
  __extends(GlobalModel, _super);
  function GlobalModel() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  GlobalModel.prototype.init = function (option, parentModel, ecModel, theme, locale, optionManager) {
    theme = theme || {};
    this.option = null; // Mark as not initialized.
    this._theme = new Model$1(theme);
    this._locale = new Model$1(locale);
    this._optionManager = optionManager;
  };
  GlobalModel.prototype.setOption = function (option, opts, optionPreprocessorFuncs) {
    {
      assert(option != null, 'option is null/undefined');
      assert(option[OPTION_INNER_KEY] !== OPTION_INNER_VALUE, 'please use chart.getOption()');
    }
    var innerOpt = normalizeSetOptionInput(opts);
    this._optionManager.setOption(option, optionPreprocessorFuncs, innerOpt);
    this._resetOption(null, innerOpt);
  };
  /**
   * @param type null/undefined: reset all.
   *        'recreate': force recreate all.
   *        'timeline': only reset timeline option
   *        'media': only reset media query option
   * @return Whether option changed.
   */
  GlobalModel.prototype.resetOption = function (type, opt) {
    return this._resetOption(type, normalizeSetOptionInput(opt));
  };
  GlobalModel.prototype._resetOption = function (type, opt) {
    var optionChanged = false;
    var optionManager = this._optionManager;
    if (!type || type === 'recreate') {
      var baseOption = optionManager.mountOption(type === 'recreate');
      {
        checkMissingComponents(baseOption);
      }
      if (!this.option || type === 'recreate') {
        initBase(this, baseOption);
      } else {
        this.restoreData();
        this._mergeOption(baseOption, opt);
      }
      optionChanged = true;
    }
    if (type === 'timeline' || type === 'media') {
      this.restoreData();
    }
    // By design, if `setOption(option2)` at the second time, and `option2` is a `ECUnitOption`,
    // it should better not have the same props with `MediaUnit['option']`.
    // Because either `option2` or `MediaUnit['option']` will be always merged to "current option"
    // rather than original "baseOption". If they both override a prop, the result might be
    // unexpected when media state changed after `setOption` called.
    // If we really need to modify a props in each `MediaUnit['option']`, use the full version
    // (`{baseOption, media}`) in `setOption`.
    // For `timeline`, the case is the same.
    if (!type || type === 'recreate' || type === 'timeline') {
      var timelineOption = optionManager.getTimelineOption(this);
      if (timelineOption) {
        optionChanged = true;
        this._mergeOption(timelineOption, opt);
      }
    }
    if (!type || type === 'recreate' || type === 'media') {
      var mediaOptions = optionManager.getMediaOption(this);
      if (mediaOptions.length) {
        each$f(mediaOptions, function (mediaOption) {
          optionChanged = true;
          this._mergeOption(mediaOption, opt);
        }, this);
      }
    }
    return optionChanged;
  };
  GlobalModel.prototype.mergeOption = function (option) {
    this._mergeOption(option, null);
  };
  GlobalModel.prototype._mergeOption = function (newOption, opt) {
    var option = this.option;
    var componentsMap = this._componentsMap;
    var componentsCount = this._componentsCount;
    var newCmptTypes = [];
    var newCmptTypeMap = createHashMap();
    var replaceMergeMainTypeMap = opt && opt.replaceMergeMainTypeMap;
    resetSourceDefaulter(this);
    // If no component class, merge directly.
    // For example: color, animaiton options, etc.
    each$f(newOption, function (componentOption, mainType) {
      if (componentOption == null) {
        return;
      }
      if (!ComponentModel$1.hasClass(mainType)) {
        // globalSettingTask.dirty();
        option[mainType] = option[mainType] == null ? clone$4(componentOption) : merge(option[mainType], componentOption, true);
      } else if (mainType) {
        newCmptTypes.push(mainType);
        newCmptTypeMap.set(mainType, true);
      }
    });
    if (replaceMergeMainTypeMap) {
      // If there is a mainType `xxx` in `replaceMerge` but not declared in option,
      // we trade it as it is declared in option as `{xxx: []}`. Because:
      // (1) for normal merge, `{xxx: null/undefined}` are the same meaning as `{xxx: []}`.
      // (2) some preprocessor may convert some of `{xxx: null/undefined}` to `{xxx: []}`.
      replaceMergeMainTypeMap.each(function (val, mainTypeInReplaceMerge) {
        if (ComponentModel$1.hasClass(mainTypeInReplaceMerge) && !newCmptTypeMap.get(mainTypeInReplaceMerge)) {
          newCmptTypes.push(mainTypeInReplaceMerge);
          newCmptTypeMap.set(mainTypeInReplaceMerge, true);
        }
      });
    }
    ComponentModel$1.topologicalTravel(newCmptTypes, ComponentModel$1.getAllClassMainTypes(), visitComponent, this);
    function visitComponent(mainType) {
      var newCmptOptionList = concatInternalOptions(this, mainType, normalizeToArray(newOption[mainType]));
      var oldCmptList = componentsMap.get(mainType);
      var mergeMode =
      // `!oldCmptList` means init. See the comment in `mappingToExists`
      !oldCmptList ? 'replaceAll' : replaceMergeMainTypeMap && replaceMergeMainTypeMap.get(mainType) ? 'replaceMerge' : 'normalMerge';
      var mappingResult = mappingToExists(oldCmptList, newCmptOptionList, mergeMode);
      // Set mainType and complete subType.
      setComponentTypeToKeyInfo(mappingResult, mainType, ComponentModel$1);
      // Empty it before the travel, in order to prevent `this._componentsMap`
      // from being used in the `init`/`mergeOption`/`optionUpdated` of some
      // components, which is probably incorrect logic.
      option[mainType] = null;
      componentsMap.set(mainType, null);
      componentsCount.set(mainType, 0);
      var optionsByMainType = [];
      var cmptsByMainType = [];
      var cmptsCountByMainType = 0;
      var tooltipExists;
      var tooltipWarningLogged;
      each$f(mappingResult, function (resultItem, index) {
        var componentModel = resultItem.existing;
        var newCmptOption = resultItem.newOption;
        if (!newCmptOption) {
          if (componentModel) {
            // Consider where is no new option and should be merged using {},
            // see removeEdgeAndAdd in topologicalTravel and
            // ComponentModel.getAllClassMainTypes.
            componentModel.mergeOption({}, this);
            componentModel.optionUpdated({}, false);
          }
          // If no both `resultItem.exist` and `resultItem.option`,
          // either it is in `replaceMerge` and not matched by any id,
          // or it has been removed in previous `replaceMerge` and left a "hole" in this component index.
        } else {
          var isSeriesType = mainType === 'series';
          var ComponentModelClass = ComponentModel$1.getClass(mainType, resultItem.keyInfo.subType, !isSeriesType // Give a more detailed warn later if series don't exists
          );
          if (!ComponentModelClass) {
            {
              var subType = resultItem.keyInfo.subType;
              var seriesImportName = BUILTIN_CHARTS_MAP[subType];
              if (!componetsMissingLogPrinted[subType]) {
                componetsMissingLogPrinted[subType] = true;
                if (seriesImportName) {
                  error("Series " + subType + " is used but not imported.\nimport { " + seriesImportName + " } from 'echarts/charts';\necharts.use([" + seriesImportName + "]);");
                } else {
                  error("Unknown series " + subType);
                }
              }
            }
            return;
          }
          // TODO Before multiple tooltips get supported, we do this check to avoid unexpected exception.
          if (mainType === 'tooltip') {
            if (tooltipExists) {
              {
                if (!tooltipWarningLogged) {
                  warn('Currently only one tooltip component is allowed.');
                  tooltipWarningLogged = true;
                }
              }
              return;
            }
            tooltipExists = true;
          }
          if (componentModel && componentModel.constructor === ComponentModelClass) {
            componentModel.name = resultItem.keyInfo.name;
            // componentModel.settingTask && componentModel.settingTask.dirty();
            componentModel.mergeOption(newCmptOption, this);
            componentModel.optionUpdated(newCmptOption, false);
          } else {
            // PENDING Global as parent ?
            var extraOpt = extend({
              componentIndex: index
            }, resultItem.keyInfo);
            componentModel = new ComponentModelClass(newCmptOption, this, this, extraOpt);
            // Assign `keyInfo`
            extend(componentModel, extraOpt);
            if (resultItem.brandNew) {
              componentModel.__requireNewView = true;
            }
            componentModel.init(newCmptOption, this, this);
            // Call optionUpdated after init.
            // newCmptOption has been used as componentModel.option
            // and may be merged with theme and default, so pass null
            // to avoid confusion.
            componentModel.optionUpdated(null, true);
          }
        }
        if (componentModel) {
          optionsByMainType.push(componentModel.option);
          cmptsByMainType.push(componentModel);
          cmptsCountByMainType++;
        } else {
          // Always do assign to avoid elided item in array.
          optionsByMainType.push(void 0);
          cmptsByMainType.push(void 0);
        }
      }, this);
      option[mainType] = optionsByMainType;
      componentsMap.set(mainType, cmptsByMainType);
      componentsCount.set(mainType, cmptsCountByMainType);
      // Backup series for filtering.
      if (mainType === 'series') {
        reCreateSeriesIndices(this);
      }
    }
    // If no series declared, ensure `_seriesIndices` initialized.
    if (!this._seriesIndices) {
      reCreateSeriesIndices(this);
    }
  };
  /**
   * Get option for output (cloned option and inner info removed)
   */
  GlobalModel.prototype.getOption = function () {
    var option = clone$4(this.option);
    each$f(option, function (optInMainType, mainType) {
      if (ComponentModel$1.hasClass(mainType)) {
        var opts = normalizeToArray(optInMainType);
        // Inner cmpts need to be removed.
        // Inner cmpts might not be at last since ec5.0, but still
        // compatible for users: if inner cmpt at last, splice the returned array.
        var realLen = opts.length;
        var metNonInner = false;
        for (var i = realLen - 1; i >= 0; i--) {
          // Remove options with inner id.
          if (opts[i] && !isComponentIdInternal(opts[i])) {
            metNonInner = true;
          } else {
            opts[i] = null;
            !metNonInner && realLen--;
          }
        }
        opts.length = realLen;
        option[mainType] = opts;
      }
    });
    delete option[OPTION_INNER_KEY];
    return option;
  };
  GlobalModel.prototype.getTheme = function () {
    return this._theme;
  };
  GlobalModel.prototype.getLocaleModel = function () {
    return this._locale;
  };
  GlobalModel.prototype.setUpdatePayload = function (payload) {
    this._payload = payload;
  };
  GlobalModel.prototype.getUpdatePayload = function () {
    return this._payload;
  };
  /**
   * @param idx If not specified, return the first one.
   */
  GlobalModel.prototype.getComponent = function (mainType, idx) {
    var list = this._componentsMap.get(mainType);
    if (list) {
      var cmpt = list[idx || 0];
      if (cmpt) {
        return cmpt;
      } else if (idx == null) {
        for (var i = 0; i < list.length; i++) {
          if (list[i]) {
            return list[i];
          }
        }
      }
    }
  };
  /**
   * @return Never be null/undefined.
   */
  GlobalModel.prototype.queryComponents = function (condition) {
    var mainType = condition.mainType;
    if (!mainType) {
      return [];
    }
    var index = condition.index;
    var id = condition.id;
    var name = condition.name;
    var cmpts = this._componentsMap.get(mainType);
    if (!cmpts || !cmpts.length) {
      return [];
    }
    var result;
    if (index != null) {
      result = [];
      each$f(normalizeToArray(index), function (idx) {
        cmpts[idx] && result.push(cmpts[idx]);
      });
    } else if (id != null) {
      result = queryByIdOrName('id', id, cmpts);
    } else if (name != null) {
      result = queryByIdOrName('name', name, cmpts);
    } else {
      // Return all non-empty components in that mainType
      result = filter(cmpts, function (cmpt) {
        return !!cmpt;
      });
    }
    return filterBySubType(result, condition);
  };
  /**
   * The interface is different from queryComponents,
   * which is convenient for inner usage.
   *
   * @usage
   * let result = findComponents(
   *     {mainType: 'dataZoom', query: {dataZoomId: 'abc'}}
   * );
   * let result = findComponents(
   *     {mainType: 'series', subType: 'pie', query: {seriesName: 'uio'}}
   * );
   * let result = findComponents(
   *     {mainType: 'series',
   *     filter: function (model, index) {...}}
   * );
   * // result like [component0, componnet1, ...]
   */
  GlobalModel.prototype.findComponents = function (condition) {
    var query = condition.query;
    var mainType = condition.mainType;
    var queryCond = getQueryCond(query);
    var result = queryCond ? this.queryComponents(queryCond)
    // Retrieve all non-empty components.
    : filter(this._componentsMap.get(mainType), function (cmpt) {
      return !!cmpt;
    });
    return doFilter(filterBySubType(result, condition));
    function getQueryCond(q) {
      var indexAttr = mainType + 'Index';
      var idAttr = mainType + 'Id';
      var nameAttr = mainType + 'Name';
      return q && (q[indexAttr] != null || q[idAttr] != null || q[nameAttr] != null) ? {
        mainType: mainType,
        // subType will be filtered finally.
        index: q[indexAttr],
        id: q[idAttr],
        name: q[nameAttr]
      } : null;
    }
    function doFilter(res) {
      return condition.filter ? filter(res, condition.filter) : res;
    }
  };
  GlobalModel.prototype.eachComponent = function (mainType, cb, context) {
    var componentsMap = this._componentsMap;
    if (isFunction(mainType)) {
      var ctxForAll_1 = cb;
      var cbForAll_1 = mainType;
      componentsMap.each(function (cmpts, componentType) {
        for (var i = 0; cmpts && i < cmpts.length; i++) {
          var cmpt = cmpts[i];
          cmpt && cbForAll_1.call(ctxForAll_1, componentType, cmpt, cmpt.componentIndex);
        }
      });
    } else {
      var cmpts = isString(mainType) ? componentsMap.get(mainType) : isObject$3(mainType) ? this.findComponents(mainType) : null;
      for (var i = 0; cmpts && i < cmpts.length; i++) {
        var cmpt = cmpts[i];
        cmpt && cb.call(context, cmpt, cmpt.componentIndex);
      }
    }
  };
  /**
   * Get series list before filtered by name.
   */
  GlobalModel.prototype.getSeriesByName = function (name) {
    var nameStr = convertOptionIdName(name, null);
    return filter(this._componentsMap.get('series'), function (oneSeries) {
      return !!oneSeries && nameStr != null && oneSeries.name === nameStr;
    });
  };
  /**
   * Get series list before filtered by index.
   */
  GlobalModel.prototype.getSeriesByIndex = function (seriesIndex) {
    return this._componentsMap.get('series')[seriesIndex];
  };
  /**
   * Get series list before filtered by type.
   * FIXME: rename to getRawSeriesByType?
   */
  GlobalModel.prototype.getSeriesByType = function (subType) {
    return filter(this._componentsMap.get('series'), function (oneSeries) {
      return !!oneSeries && oneSeries.subType === subType;
    });
  };
  /**
   * Get all series before filtered.
   */
  GlobalModel.prototype.getSeries = function () {
    return filter(this._componentsMap.get('series'), function (oneSeries) {
      return !!oneSeries;
    });
  };
  /**
   * Count series before filtered.
   */
  GlobalModel.prototype.getSeriesCount = function () {
    return this._componentsCount.get('series');
  };
  /**
   * After filtering, series may be different
   * from raw series.
   */
  GlobalModel.prototype.eachSeries = function (cb, context) {
    assertSeriesInitialized(this);
    each$f(this._seriesIndices, function (rawSeriesIndex) {
      var series = this._componentsMap.get('series')[rawSeriesIndex];
      cb.call(context, series, rawSeriesIndex);
    }, this);
  };
  /**
   * Iterate raw series before filtered.
   *
   * @param {Function} cb
   * @param {*} context
   */
  GlobalModel.prototype.eachRawSeries = function (cb, context) {
    each$f(this._componentsMap.get('series'), function (series) {
      series && cb.call(context, series, series.componentIndex);
    });
  };
  /**
   * After filtering, series may be different.
   * from raw series.
   */
  GlobalModel.prototype.eachSeriesByType = function (subType, cb, context) {
    assertSeriesInitialized(this);
    each$f(this._seriesIndices, function (rawSeriesIndex) {
      var series = this._componentsMap.get('series')[rawSeriesIndex];
      if (series.subType === subType) {
        cb.call(context, series, rawSeriesIndex);
      }
    }, this);
  };
  /**
   * Iterate raw series before filtered of given type.
   */
  GlobalModel.prototype.eachRawSeriesByType = function (subType, cb, context) {
    return each$f(this.getSeriesByType(subType), cb, context);
  };
  GlobalModel.prototype.isSeriesFiltered = function (seriesModel) {
    assertSeriesInitialized(this);
    return this._seriesIndicesMap.get(seriesModel.componentIndex) == null;
  };
  GlobalModel.prototype.getCurrentSeriesIndices = function () {
    return (this._seriesIndices || []).slice();
  };
  GlobalModel.prototype.filterSeries = function (cb, context) {
    assertSeriesInitialized(this);
    var newSeriesIndices = [];
    each$f(this._seriesIndices, function (seriesRawIdx) {
      var series = this._componentsMap.get('series')[seriesRawIdx];
      cb.call(context, series, seriesRawIdx) && newSeriesIndices.push(seriesRawIdx);
    }, this);
    this._seriesIndices = newSeriesIndices;
    this._seriesIndicesMap = createHashMap(newSeriesIndices);
  };
  GlobalModel.prototype.restoreData = function (payload) {
    reCreateSeriesIndices(this);
    var componentsMap = this._componentsMap;
    var componentTypes = [];
    componentsMap.each(function (components, componentType) {
      if (ComponentModel$1.hasClass(componentType)) {
        componentTypes.push(componentType);
      }
    });
    ComponentModel$1.topologicalTravel(componentTypes, ComponentModel$1.getAllClassMainTypes(), function (componentType) {
      each$f(componentsMap.get(componentType), function (component) {
        if (component && (componentType !== 'series' || !isNotTargetSeries(component, payload))) {
          component.restoreData();
        }
      });
    });
  };
  GlobalModel.internalField = function () {
    reCreateSeriesIndices = function (ecModel) {
      var seriesIndices = ecModel._seriesIndices = [];
      each$f(ecModel._componentsMap.get('series'), function (series) {
        // series may have been removed by `replaceMerge`.
        series && seriesIndices.push(series.componentIndex);
      });
      ecModel._seriesIndicesMap = createHashMap(seriesIndices);
    };
    assertSeriesInitialized = function (ecModel) {
      // Components that use _seriesIndices should depends on series component,
      // which make sure that their initialization is after series.
      {
        if (!ecModel._seriesIndices) {
          throw new Error('Option should contains series.');
        }
      }
    };
    initBase = function (ecModel, baseOption) {
      // Using OPTION_INNER_KEY to mark that this option cannot be used outside,
      // i.e. `chart.setOption(chart.getModel().option);` is forbidden.
      ecModel.option = {};
      ecModel.option[OPTION_INNER_KEY] = OPTION_INNER_VALUE;
      // Init with series: [], in case of calling findSeries method
      // before series initialized.
      ecModel._componentsMap = createHashMap({
        series: []
      });
      ecModel._componentsCount = createHashMap();
      // If user spefied `option.aria`, aria will be enable. This detection should be
      // performed before theme and globalDefault merge.
      var airaOption = baseOption.aria;
      if (isObject$3(airaOption) && airaOption.enabled == null) {
        airaOption.enabled = true;
      }
      mergeTheme(baseOption, ecModel._theme.option);
      // TODO Needs clone when merging to the unexisted property
      merge(baseOption, globalDefault, false);
      ecModel._mergeOption(baseOption, null);
    };
  }();
  return GlobalModel;
}(Model$1);
function isNotTargetSeries(seriesModel, payload) {
  if (payload) {
    var index = payload.seriesIndex;
    var id = payload.seriesId;
    var name_1 = payload.seriesName;
    return index != null && seriesModel.componentIndex !== index || id != null && seriesModel.id !== id || name_1 != null && seriesModel.name !== name_1;
  }
}
function mergeTheme(option, theme) {
  // PENDING
  // NOT use `colorLayer` in theme if option has `color`
  var notMergeColorLayer = option.color && !option.colorLayer;
  each$f(theme, function (themeItem, name) {
    if (name === 'colorLayer' && notMergeColorLayer) {
      return;
    }
    // If it is component model mainType, the model handles that merge later.
    // otherwise, merge them here.
    if (!ComponentModel$1.hasClass(name)) {
      if (typeof themeItem === 'object') {
        option[name] = !option[name] ? clone$4(themeItem) : merge(option[name], themeItem, false);
      } else {
        if (option[name] == null) {
          option[name] = themeItem;
        }
      }
    }
  });
}
function queryByIdOrName(attr, idOrName, cmpts) {
  // Here is a break from echarts4: string and number are
  // treated as equal.
  if (isArray$1(idOrName)) {
    var keyMap_1 = createHashMap();
    each$f(idOrName, function (idOrNameItem) {
      if (idOrNameItem != null) {
        var idName = convertOptionIdName(idOrNameItem, null);
        idName != null && keyMap_1.set(idOrNameItem, true);
      }
    });
    return filter(cmpts, function (cmpt) {
      return cmpt && keyMap_1.get(cmpt[attr]);
    });
  } else {
    var idName_1 = convertOptionIdName(idOrName, null);
    return filter(cmpts, function (cmpt) {
      return cmpt && idName_1 != null && cmpt[attr] === idName_1;
    });
  }
}
function filterBySubType(components, condition) {
  // Using hasOwnProperty for restrict. Consider
  // subType is undefined in user payload.
  return condition.hasOwnProperty('subType') ? filter(components, function (cmpt) {
    return cmpt && cmpt.subType === condition.subType;
  }) : components;
}
function normalizeSetOptionInput(opts) {
  var replaceMergeMainTypeMap = createHashMap();
  opts && each$f(normalizeToArray(opts.replaceMerge), function (mainType) {
    {
      assert(ComponentModel$1.hasClass(mainType), '"' + mainType + '" is not valid component main type in "replaceMerge"');
    }
    replaceMergeMainTypeMap.set(mainType, true);
  });
  return {
    replaceMergeMainTypeMap: replaceMergeMainTypeMap
  };
}
mixin(GlobalModel, PaletteMixin);
var GlobalModel$1 = GlobalModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var availableMethods = ['getDom', 'getZr', 'getWidth', 'getHeight', 'getDevicePixelRatio', 'dispatchAction', 'isSSR', 'isDisposed', 'on', 'off', 'getDataURL', 'getConnectedDataURL',
// 'getModel',
'getOption',
// 'getViewOfComponentModel',
// 'getViewOfSeriesModel',
'getId', 'updateLabelLayout'];
var ExtensionAPI = /** @class */function () {
  function ExtensionAPI(ecInstance) {
    each$f(availableMethods, function (methodName) {
      this[methodName] = bind$1(ecInstance[methodName], ecInstance);
    }, this);
  }
  return ExtensionAPI;
}();
var ExtensionAPI$1 = ExtensionAPI;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var coordinateSystemCreators = {};
var CoordinateSystemManager = /** @class */function () {
  function CoordinateSystemManager() {
    this._coordinateSystems = [];
  }
  CoordinateSystemManager.prototype.create = function (ecModel, api) {
    var coordinateSystems = [];
    each$f(coordinateSystemCreators, function (creator, type) {
      var list = creator.create(ecModel, api);
      coordinateSystems = coordinateSystems.concat(list || []);
    });
    this._coordinateSystems = coordinateSystems;
  };
  CoordinateSystemManager.prototype.update = function (ecModel, api) {
    each$f(this._coordinateSystems, function (coordSys) {
      coordSys.update && coordSys.update(ecModel, api);
    });
  };
  CoordinateSystemManager.prototype.getCoordinateSystems = function () {
    return this._coordinateSystems.slice();
  };
  CoordinateSystemManager.register = function (type, creator) {
    coordinateSystemCreators[type] = creator;
  };
  CoordinateSystemManager.get = function (type) {
    return coordinateSystemCreators[type];
  };
  return CoordinateSystemManager;
}();
var CoordinateSystem = CoordinateSystemManager;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var QUERY_REG = /^(min|max)?(.+)$/;
// Key: mainType
// type FakeComponentsMap = HashMap<(MappingExistingItem & { subType: string })[]>;
/**
 * TERM EXPLANATIONS:
 * See `ECOption` and `ECUnitOption` in `src/util/types.ts`.
 */
var OptionManager = /** @class */function () {
  // timeline.notMerge is not supported in ec3. Firstly there is rearly
  // case that notMerge is needed. Secondly supporting 'notMerge' requires
  // rawOption cloned and backuped when timeline changed, which does no
  // good to performance. What's more, that both timeline and setOption
  // method supply 'notMerge' brings complex and some problems.
  // Consider this case:
  // (step1) chart.setOption({timeline: {notMerge: false}, ...}, false);
  // (step2) chart.setOption({timeline: {notMerge: true}, ...}, false);
  function OptionManager(api) {
    this._timelineOptions = [];
    this._mediaList = [];
    /**
     * -1, means default.
     * empty means no media.
     */
    this._currentMediaIndices = [];
    this._api = api;
  }
  OptionManager.prototype.setOption = function (rawOption, optionPreprocessorFuncs, opt) {
    if (rawOption) {
      // That set dat primitive is dangerous if user reuse the data when setOption again.
      each$f(normalizeToArray(rawOption.series), function (series) {
        series && series.data && isTypedArray$1(series.data) && setAsPrimitive(series.data);
      });
      each$f(normalizeToArray(rawOption.dataset), function (dataset) {
        dataset && dataset.source && isTypedArray$1(dataset.source) && setAsPrimitive(dataset.source);
      });
    }
    // Caution: some series modify option data, if do not clone,
    // it should ensure that the repeat modify correctly
    // (create a new object when modify itself).
    rawOption = clone$4(rawOption);
    // FIXME
    // If some property is set in timeline options or media option but
    // not set in baseOption, a warning should be given.
    var optionBackup = this._optionBackup;
    var newParsedOption = parseRawOption(rawOption, optionPreprocessorFuncs, !optionBackup);
    this._newBaseOption = newParsedOption.baseOption;
    // For setOption at second time (using merge mode);
    if (optionBackup) {
      // FIXME
      // the restore merge solution is essentially incorrect.
      // the mapping can not be 100% consistent with ecModel, which probably brings
      // potential bug!
      // The first merge is delayed, because in most cases, users do not call `setOption` twice.
      // let fakeCmptsMap = this._fakeCmptsMap;
      // if (!fakeCmptsMap) {
      //     fakeCmptsMap = this._fakeCmptsMap = createHashMap();
      //     mergeToBackupOption(fakeCmptsMap, null, optionBackup.baseOption, null);
      // }
      // mergeToBackupOption(
      //     fakeCmptsMap, optionBackup.baseOption, newParsedOption.baseOption, opt
      // );
      // For simplicity, timeline options and media options do not support merge,
      // that is, if you `setOption` twice and both has timeline options, the latter
      // timeline options will not be merged to the former, but just substitute them.
      if (newParsedOption.timelineOptions.length) {
        optionBackup.timelineOptions = newParsedOption.timelineOptions;
      }
      if (newParsedOption.mediaList.length) {
        optionBackup.mediaList = newParsedOption.mediaList;
      }
      if (newParsedOption.mediaDefault) {
        optionBackup.mediaDefault = newParsedOption.mediaDefault;
      }
    } else {
      this._optionBackup = newParsedOption;
    }
  };
  OptionManager.prototype.mountOption = function (isRecreate) {
    var optionBackup = this._optionBackup;
    this._timelineOptions = optionBackup.timelineOptions;
    this._mediaList = optionBackup.mediaList;
    this._mediaDefault = optionBackup.mediaDefault;
    this._currentMediaIndices = [];
    return clone$4(isRecreate
    // this._optionBackup.baseOption, which is created at the first `setOption`
    // called, and is merged into every new option by inner method `mergeToBackupOption`
    // each time `setOption` called, can be only used in `isRecreate`, because
    // its reliability is under suspicion. In other cases option merge is
    // performed by `model.mergeOption`.
    ? optionBackup.baseOption : this._newBaseOption);
  };
  OptionManager.prototype.getTimelineOption = function (ecModel) {
    var option;
    var timelineOptions = this._timelineOptions;
    if (timelineOptions.length) {
      // getTimelineOption can only be called after ecModel inited,
      // so we can get currentIndex from timelineModel.
      var timelineModel = ecModel.getComponent('timeline');
      if (timelineModel) {
        option = clone$4(
        // FIXME:TS as TimelineModel or quivlant interface
        timelineOptions[timelineModel.getCurrentIndex()]);
      }
    }
    return option;
  };
  OptionManager.prototype.getMediaOption = function (ecModel) {
    var ecWidth = this._api.getWidth();
    var ecHeight = this._api.getHeight();
    var mediaList = this._mediaList;
    var mediaDefault = this._mediaDefault;
    var indices = [];
    var result = [];
    // No media defined.
    if (!mediaList.length && !mediaDefault) {
      return result;
    }
    // Multi media may be applied, the latter defined media has higher priority.
    for (var i = 0, len = mediaList.length; i < len; i++) {
      if (applyMediaQuery(mediaList[i].query, ecWidth, ecHeight)) {
        indices.push(i);
      }
    }
    // FIXME
    // Whether mediaDefault should force users to provide? Otherwise
    // the change by media query can not be recorvered.
    if (!indices.length && mediaDefault) {
      indices = [-1];
    }
    if (indices.length && !indicesEquals(indices, this._currentMediaIndices)) {
      result = map$1(indices, function (index) {
        return clone$4(index === -1 ? mediaDefault.option : mediaList[index].option);
      });
    }
    // Otherwise return nothing.
    this._currentMediaIndices = indices;
    return result;
  };
  return OptionManager;
}();
/**
 * [RAW_OPTION_PATTERNS]
 * (Note: "series: []" represents all other props in `ECUnitOption`)
 *
 * (1) No prop "baseOption" declared:
 * Root option is used as "baseOption" (except prop "options" and "media").
 * ```js
 * option = {
 *     series: [],
 *     timeline: {},
 *     options: [],
 * };
 * option = {
 *     series: [],
 *     media: {},
 * };
 * option = {
 *     series: [],
 *     timeline: {},
 *     options: [],
 *     media: {},
 * }
 * ```
 *
 * (2) Prop "baseOption" declared:
 * If "baseOption" declared, `ECUnitOption` props can only be declared
 * inside "baseOption" except prop "timeline" (compat ec2).
 * ```js
 * option = {
 *     baseOption: {
 *         timeline: {},
 *         series: [],
 *     },
 *     options: []
 * };
 * option = {
 *     baseOption: {
 *         series: [],
 *     },
 *     media: []
 * };
 * option = {
 *     baseOption: {
 *         timeline: {},
 *         series: [],
 *     },
 *     options: []
 *     media: []
 * };
 * option = {
 *     // ec3 compat ec2: allow (only) `timeline` declared
 *     // outside baseOption. Keep this setting for compat.
 *     timeline: {},
 *     baseOption: {
 *         series: [],
 *     },
 *     options: [],
 *     media: []
 * };
 * ```
 */
function parseRawOption(
// `rawOption` May be modified
rawOption, optionPreprocessorFuncs, isNew) {
  var mediaList = [];
  var mediaDefault;
  var baseOption;
  var declaredBaseOption = rawOption.baseOption;
  // Compatible with ec2, [RAW_OPTION_PATTERNS] above.
  var timelineOnRoot = rawOption.timeline;
  var timelineOptionsOnRoot = rawOption.options;
  var mediaOnRoot = rawOption.media;
  var hasMedia = !!rawOption.media;
  var hasTimeline = !!(timelineOptionsOnRoot || timelineOnRoot || declaredBaseOption && declaredBaseOption.timeline);
  if (declaredBaseOption) {
    baseOption = declaredBaseOption;
    // For merge option.
    if (!baseOption.timeline) {
      baseOption.timeline = timelineOnRoot;
    }
  }
  // For convenience, enable to use the root option as the `baseOption`:
  // `{ ...normalOptionProps, media: [{ ... }, { ... }] }`
  else {
    if (hasTimeline || hasMedia) {
      rawOption.options = rawOption.media = null;
    }
    baseOption = rawOption;
  }
  if (hasMedia) {
    if (isArray$1(mediaOnRoot)) {
      each$f(mediaOnRoot, function (singleMedia) {
        {
          // Real case of wrong config.
          if (singleMedia && !singleMedia.option && isObject$3(singleMedia.query) && isObject$3(singleMedia.query.option)) {
            error('Illegal media option. Must be like { media: [ { query: {}, option: {} } ] }');
          }
        }
        if (singleMedia && singleMedia.option) {
          if (singleMedia.query) {
            mediaList.push(singleMedia);
          } else if (!mediaDefault) {
            // Use the first media default.
            mediaDefault = singleMedia;
          }
        }
      });
    } else {
      {
        // Real case of wrong config.
        error('Illegal media option. Must be an array. Like { media: [ {...}, {...} ] }');
      }
    }
  }
  doPreprocess(baseOption);
  each$f(timelineOptionsOnRoot, function (option) {
    return doPreprocess(option);
  });
  each$f(mediaList, function (media) {
    return doPreprocess(media.option);
  });
  function doPreprocess(option) {
    each$f(optionPreprocessorFuncs, function (preProcess) {
      preProcess(option, isNew);
    });
  }
  return {
    baseOption: baseOption,
    timelineOptions: timelineOptionsOnRoot || [],
    mediaDefault: mediaDefault,
    mediaList: mediaList
  };
}
/**
 * @see <http://www.w3.org/TR/css3-mediaqueries/#media1>
 * Support: width, height, aspectRatio
 * Can use max or min as prefix.
 */
function applyMediaQuery(query, ecWidth, ecHeight) {
  var realMap = {
    width: ecWidth,
    height: ecHeight,
    aspectratio: ecWidth / ecHeight // lower case for convenience.
  };
  var applicable = true;
  each$f(query, function (value, attr) {
    var matched = attr.match(QUERY_REG);
    if (!matched || !matched[1] || !matched[2]) {
      return;
    }
    var operator = matched[1];
    var realAttr = matched[2].toLowerCase();
    if (!compare(realMap[realAttr], value, operator)) {
      applicable = false;
    }
  });
  return applicable;
}
function compare(real, expect, operator) {
  if (operator === 'min') {
    return real >= expect;
  } else if (operator === 'max') {
    return real <= expect;
  } else {
    // Equals
    return real === expect;
  }
}
function indicesEquals(indices1, indices2) {
  // indices is always order by asc and has only finite number.
  return indices1.join(',') === indices2.join(',');
}
/**
 * Consider case:
 * `chart.setOption(opt1);`
 * Then user do some interaction like dataZoom, dataView changing.
 * `chart.setOption(opt2);`
 * Then user press 'reset button' in toolbox.
 *
 * After doing that all of the interaction effects should be reset, the
 * chart should be the same as the result of invoke
 * `chart.setOption(opt1); chart.setOption(opt2);`.
 *
 * Although it is not able ensure that
 * `chart.setOption(opt1); chart.setOption(opt2);` is equivalents to
 * `chart.setOption(merge(opt1, opt2));` exactly,
 * this might be the only simple way to implement that feature.
 *
 * MEMO: We've considered some other approaches:
 * 1. Each model handles its self restoration but not uniform treatment.
 *     (Too complex in logic and error-prone)
 * 2. Use a shadow ecModel. (Performance expensive)
 *
 * FIXME: A possible solution:
 * Add a extra level of model for each component model. The inheritance chain would be:
 * ecModel <- componentModel <- componentActionModel <- dataItemModel
 * And all of the actions can only modify the `componentActionModel` rather than
 * `componentModel`. `setOption` will only modify the `ecModel` and `componentModel`.
 * When "resotre" action triggered, model from `componentActionModel` will be discarded
 * instead of recreating the "ecModel" from the "_optionBackup".
 */
// function mergeToBackupOption(
//     fakeCmptsMap: FakeComponentsMap,
//     // `tarOption` Can be null/undefined, means init
//     tarOption: ECUnitOption,
//     newOption: ECUnitOption,
//     // Can be null/undefined
//     opt: InnerSetOptionOpts
// ): void {
//     newOption = newOption || {} as ECUnitOption;
//     const notInit = !!tarOption;
//     each(newOption, function (newOptsInMainType, mainType) {
//         if (newOptsInMainType == null) {
//             return;
//         }
//         if (!ComponentModel.hasClass(mainType)) {
//             if (tarOption) {
//                 tarOption[mainType] = merge(tarOption[mainType], newOptsInMainType, true);
//             }
//         }
//         else {
//             const oldTarOptsInMainType = notInit ? normalizeToArray(tarOption[mainType]) : null;
//             const oldFakeCmptsInMainType = fakeCmptsMap.get(mainType) || [];
//             const resultTarOptsInMainType = notInit ? (tarOption[mainType] = [] as ComponentOption[]) : null;
//             const resultFakeCmptsInMainType = fakeCmptsMap.set(mainType, []);
//             const mappingResult = mappingToExists(
//                 oldFakeCmptsInMainType,
//                 normalizeToArray(newOptsInMainType),
//                 (opt && opt.replaceMergeMainTypeMap.get(mainType)) ? 'replaceMerge' : 'normalMerge'
//             );
//             setComponentTypeToKeyInfo(mappingResult, mainType, ComponentModel as ComponentModelConstructor);
//             each(mappingResult, function (resultItem, index) {
//                 // The same logic as `Global.ts#_mergeOption`.
//                 let fakeCmpt = resultItem.existing;
//                 const newOption = resultItem.newOption;
//                 const keyInfo = resultItem.keyInfo;
//                 let fakeCmptOpt;
//                 if (!newOption) {
//                     fakeCmptOpt = oldTarOptsInMainType[index];
//                 }
//                 else {
//                     if (fakeCmpt && fakeCmpt.subType === keyInfo.subType) {
//                         fakeCmpt.name = keyInfo.name;
//                         if (notInit) {
//                             fakeCmptOpt = merge(oldTarOptsInMainType[index], newOption, true);
//                         }
//                     }
//                     else {
//                         fakeCmpt = extend({}, keyInfo);
//                         if (notInit) {
//                             fakeCmptOpt = clone(newOption);
//                         }
//                     }
//                 }
//                 if (fakeCmpt) {
//                     notInit && resultTarOptsInMainType.push(fakeCmptOpt);
//                     resultFakeCmptsInMainType.push(fakeCmpt);
//                 }
//                 else {
//                     notInit && resultTarOptsInMainType.push(void 0);
//                     resultFakeCmptsInMainType.push(void 0);
//                 }
//             });
//         }
//     });
// }
var OptionManager$1 = OptionManager;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each$d = each$f;
var isObject$2 = isObject$3;
var POSSIBLE_STYLES = ['areaStyle', 'lineStyle', 'nodeStyle', 'linkStyle', 'chordStyle', 'label', 'labelLine'];
function compatEC2ItemStyle(opt) {
  var itemStyleOpt = opt && opt.itemStyle;
  if (!itemStyleOpt) {
    return;
  }
  for (var i = 0, len = POSSIBLE_STYLES.length; i < len; i++) {
    var styleName = POSSIBLE_STYLES[i];
    var normalItemStyleOpt = itemStyleOpt.normal;
    var emphasisItemStyleOpt = itemStyleOpt.emphasis;
    if (normalItemStyleOpt && normalItemStyleOpt[styleName]) {
      {
        deprecateReplaceLog("itemStyle.normal." + styleName, styleName);
      }
      opt[styleName] = opt[styleName] || {};
      if (!opt[styleName].normal) {
        opt[styleName].normal = normalItemStyleOpt[styleName];
      } else {
        merge(opt[styleName].normal, normalItemStyleOpt[styleName]);
      }
      normalItemStyleOpt[styleName] = null;
    }
    if (emphasisItemStyleOpt && emphasisItemStyleOpt[styleName]) {
      {
        deprecateReplaceLog("itemStyle.emphasis." + styleName, "emphasis." + styleName);
      }
      opt[styleName] = opt[styleName] || {};
      if (!opt[styleName].emphasis) {
        opt[styleName].emphasis = emphasisItemStyleOpt[styleName];
      } else {
        merge(opt[styleName].emphasis, emphasisItemStyleOpt[styleName]);
      }
      emphasisItemStyleOpt[styleName] = null;
    }
  }
}
function convertNormalEmphasis(opt, optType, useExtend) {
  if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) {
    var normalOpt = opt[optType].normal;
    var emphasisOpt = opt[optType].emphasis;
    if (normalOpt) {
      {
        // eslint-disable-next-line max-len
        deprecateLog("'normal' hierarchy in " + optType + " has been removed since 4.0. All style properties are configured in " + optType + " directly now.");
      }
      // Timeline controlStyle has other properties besides normal and emphasis
      if (useExtend) {
        opt[optType].normal = opt[optType].emphasis = null;
        defaults(opt[optType], normalOpt);
      } else {
        opt[optType] = normalOpt;
      }
    }
    if (emphasisOpt) {
      {
        deprecateLog(optType + ".emphasis has been changed to emphasis." + optType + " since 4.0");
      }
      opt.emphasis = opt.emphasis || {};
      opt.emphasis[optType] = emphasisOpt;
      // Also compat the case user mix the style and focus together in ec3 style
      // for example: { itemStyle: { normal: {}, emphasis: {focus, shadowBlur} } }
      if (emphasisOpt.focus) {
        opt.emphasis.focus = emphasisOpt.focus;
      }
      if (emphasisOpt.blurScope) {
        opt.emphasis.blurScope = emphasisOpt.blurScope;
      }
    }
  }
}
function removeEC3NormalStatus(opt) {
  convertNormalEmphasis(opt, 'itemStyle');
  convertNormalEmphasis(opt, 'lineStyle');
  convertNormalEmphasis(opt, 'areaStyle');
  convertNormalEmphasis(opt, 'label');
  convertNormalEmphasis(opt, 'labelLine');
  // treemap
  convertNormalEmphasis(opt, 'upperLabel');
  // graph
  convertNormalEmphasis(opt, 'edgeLabel');
}
function compatTextStyle(opt, propName) {
  // Check whether is not object (string\null\undefined ...)
  var labelOptSingle = isObject$2(opt) && opt[propName];
  var textStyle = isObject$2(labelOptSingle) && labelOptSingle.textStyle;
  if (textStyle) {
    {
      // eslint-disable-next-line max-len
      deprecateLog("textStyle hierarchy in " + propName + " has been removed since 4.0. All textStyle properties are configured in " + propName + " directly now.");
    }
    for (var i = 0, len = TEXT_STYLE_OPTIONS.length; i < len; i++) {
      var textPropName = TEXT_STYLE_OPTIONS[i];
      if (textStyle.hasOwnProperty(textPropName)) {
        labelOptSingle[textPropName] = textStyle[textPropName];
      }
    }
  }
}
function compatEC3CommonStyles(opt) {
  if (opt) {
    removeEC3NormalStatus(opt);
    compatTextStyle(opt, 'label');
    opt.emphasis && compatTextStyle(opt.emphasis, 'label');
  }
}
function processSeries(seriesOpt) {
  if (!isObject$2(seriesOpt)) {
    return;
  }
  compatEC2ItemStyle(seriesOpt);
  removeEC3NormalStatus(seriesOpt);
  compatTextStyle(seriesOpt, 'label');
  // treemap
  compatTextStyle(seriesOpt, 'upperLabel');
  // graph
  compatTextStyle(seriesOpt, 'edgeLabel');
  if (seriesOpt.emphasis) {
    compatTextStyle(seriesOpt.emphasis, 'label');
    // treemap
    compatTextStyle(seriesOpt.emphasis, 'upperLabel');
    // graph
    compatTextStyle(seriesOpt.emphasis, 'edgeLabel');
  }
  var markPoint = seriesOpt.markPoint;
  if (markPoint) {
    compatEC2ItemStyle(markPoint);
    compatEC3CommonStyles(markPoint);
  }
  var markLine = seriesOpt.markLine;
  if (markLine) {
    compatEC2ItemStyle(markLine);
    compatEC3CommonStyles(markLine);
  }
  var markArea = seriesOpt.markArea;
  if (markArea) {
    compatEC3CommonStyles(markArea);
  }
  var data = seriesOpt.data;
  // Break with ec3: if `setOption` again, there may be no `type` in option,
  // then the backward compat based on option type will not be performed.
  if (seriesOpt.type === 'graph') {
    data = data || seriesOpt.nodes;
    var edgeData = seriesOpt.links || seriesOpt.edges;
    if (edgeData && !isTypedArray$1(edgeData)) {
      for (var i = 0; i < edgeData.length; i++) {
        compatEC3CommonStyles(edgeData[i]);
      }
    }
    each$f(seriesOpt.categories, function (opt) {
      removeEC3NormalStatus(opt);
    });
  }
  if (data && !isTypedArray$1(data)) {
    for (var i = 0; i < data.length; i++) {
      compatEC3CommonStyles(data[i]);
    }
  }
  // mark point data
  markPoint = seriesOpt.markPoint;
  if (markPoint && markPoint.data) {
    var mpData = markPoint.data;
    for (var i = 0; i < mpData.length; i++) {
      compatEC3CommonStyles(mpData[i]);
    }
  }
  // mark line data
  markLine = seriesOpt.markLine;
  if (markLine && markLine.data) {
    var mlData = markLine.data;
    for (var i = 0; i < mlData.length; i++) {
      if (isArray$1(mlData[i])) {
        compatEC3CommonStyles(mlData[i][0]);
        compatEC3CommonStyles(mlData[i][1]);
      } else {
        compatEC3CommonStyles(mlData[i]);
      }
    }
  }
  // Series
  if (seriesOpt.type === 'gauge') {
    compatTextStyle(seriesOpt, 'axisLabel');
    compatTextStyle(seriesOpt, 'title');
    compatTextStyle(seriesOpt, 'detail');
  } else if (seriesOpt.type === 'treemap') {
    convertNormalEmphasis(seriesOpt.breadcrumb, 'itemStyle');
    each$f(seriesOpt.levels, function (opt) {
      removeEC3NormalStatus(opt);
    });
  } else if (seriesOpt.type === 'tree') {
    removeEC3NormalStatus(seriesOpt.leaves);
  }
  // sunburst starts from ec4, so it does not need to compat levels.
}
function toArr(o) {
  return isArray$1(o) ? o : o ? [o] : [];
}
function toObj(o) {
  return (isArray$1(o) ? o[0] : o) || {};
}
function globalCompatStyle(option, isTheme) {
  each$d(toArr(option.series), function (seriesOpt) {
    isObject$2(seriesOpt) && processSeries(seriesOpt);
  });
  var axes = ['xAxis', 'yAxis', 'radiusAxis', 'angleAxis', 'singleAxis', 'parallelAxis', 'radar'];
  isTheme && axes.push('valueAxis', 'categoryAxis', 'logAxis', 'timeAxis');
  each$d(axes, function (axisName) {
    each$d(toArr(option[axisName]), function (axisOpt) {
      if (axisOpt) {
        compatTextStyle(axisOpt, 'axisLabel');
        compatTextStyle(axisOpt.axisPointer, 'label');
      }
    });
  });
  each$d(toArr(option.parallel), function (parallelOpt) {
    var parallelAxisDefault = parallelOpt && parallelOpt.parallelAxisDefault;
    compatTextStyle(parallelAxisDefault, 'axisLabel');
    compatTextStyle(parallelAxisDefault && parallelAxisDefault.axisPointer, 'label');
  });
  each$d(toArr(option.calendar), function (calendarOpt) {
    convertNormalEmphasis(calendarOpt, 'itemStyle');
    compatTextStyle(calendarOpt, 'dayLabel');
    compatTextStyle(calendarOpt, 'monthLabel');
    compatTextStyle(calendarOpt, 'yearLabel');
  });
  // radar.name.textStyle
  each$d(toArr(option.radar), function (radarOpt) {
    compatTextStyle(radarOpt, 'name');
    // Use axisName instead of name because component has name property
    if (radarOpt.name && radarOpt.axisName == null) {
      radarOpt.axisName = radarOpt.name;
      delete radarOpt.name;
      {
        deprecateLog('name property in radar component has been changed to axisName');
      }
    }
    if (radarOpt.nameGap != null && radarOpt.axisNameGap == null) {
      radarOpt.axisNameGap = radarOpt.nameGap;
      delete radarOpt.nameGap;
      {
        deprecateLog('nameGap property in radar component has been changed to axisNameGap');
      }
    }
    {
      each$d(radarOpt.indicator, function (indicatorOpt) {
        if (indicatorOpt.text) {
          deprecateReplaceLog('text', 'name', 'radar.indicator');
        }
      });
    }
  });
  each$d(toArr(option.geo), function (geoOpt) {
    if (isObject$2(geoOpt)) {
      compatEC3CommonStyles(geoOpt);
      each$d(toArr(geoOpt.regions), function (regionObj) {
        compatEC3CommonStyles(regionObj);
      });
    }
  });
  each$d(toArr(option.timeline), function (timelineOpt) {
    compatEC3CommonStyles(timelineOpt);
    convertNormalEmphasis(timelineOpt, 'label');
    convertNormalEmphasis(timelineOpt, 'itemStyle');
    convertNormalEmphasis(timelineOpt, 'controlStyle', true);
    var data = timelineOpt.data;
    isArray$1(data) && each$f(data, function (item) {
      if (isObject$3(item)) {
        convertNormalEmphasis(item, 'label');
        convertNormalEmphasis(item, 'itemStyle');
      }
    });
  });
  each$d(toArr(option.toolbox), function (toolboxOpt) {
    convertNormalEmphasis(toolboxOpt, 'iconStyle');
    each$d(toolboxOpt.feature, function (featureOpt) {
      convertNormalEmphasis(featureOpt, 'iconStyle');
    });
  });
  compatTextStyle(toObj(option.axisPointer), 'label');
  compatTextStyle(toObj(option.tooltip).axisPointer, 'label');
  // Clean logs
  // storedLogs = {};
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function get(opt, path) {
  var pathArr = path.split(',');
  var obj = opt;
  for (var i = 0; i < pathArr.length; i++) {
    obj = obj && obj[pathArr[i]];
    if (obj == null) {
      break;
    }
  }
  return obj;
}
function set(opt, path, val, overwrite) {
  var pathArr = path.split(',');
  var obj = opt;
  var key;
  var i = 0;
  for (; i < pathArr.length - 1; i++) {
    key = pathArr[i];
    if (obj[key] == null) {
      obj[key] = {};
    }
    obj = obj[key];
  }
  if (overwrite || obj[pathArr[i]] == null) {
    obj[pathArr[i]] = val;
  }
}
function compatLayoutProperties(option) {
  option && each$f(LAYOUT_PROPERTIES, function (prop) {
    if (prop[0] in option && !(prop[1] in option)) {
      option[prop[1]] = option[prop[0]];
    }
  });
}
var LAYOUT_PROPERTIES = [['x', 'left'], ['y', 'top'], ['x2', 'right'], ['y2', 'bottom']];
var COMPATITABLE_COMPONENTS = ['grid', 'geo', 'parallel', 'legend', 'toolbox', 'title', 'visualMap', 'dataZoom', 'timeline'];
var BAR_ITEM_STYLE_MAP = [['borderRadius', 'barBorderRadius'], ['borderColor', 'barBorderColor'], ['borderWidth', 'barBorderWidth']];
function compatBarItemStyle(option) {
  var itemStyle = option && option.itemStyle;
  if (itemStyle) {
    for (var i = 0; i < BAR_ITEM_STYLE_MAP.length; i++) {
      var oldName = BAR_ITEM_STYLE_MAP[i][1];
      var newName = BAR_ITEM_STYLE_MAP[i][0];
      if (itemStyle[oldName] != null) {
        itemStyle[newName] = itemStyle[oldName];
        {
          deprecateReplaceLog(oldName, newName);
        }
      }
    }
  }
}
function compatPieLabel(option) {
  if (!option) {
    return;
  }
  if (option.alignTo === 'edge' && option.margin != null && option.edgeDistance == null) {
    {
      deprecateReplaceLog('label.margin', 'label.edgeDistance', 'pie');
    }
    option.edgeDistance = option.margin;
  }
}
function compatSunburstState(option) {
  if (!option) {
    return;
  }
  if (option.downplay && !option.blur) {
    option.blur = option.downplay;
    {
      deprecateReplaceLog('downplay', 'blur', 'sunburst');
    }
  }
}
function compatGraphFocus(option) {
  if (!option) {
    return;
  }
  if (option.focusNodeAdjacency != null) {
    option.emphasis = option.emphasis || {};
    if (option.emphasis.focus == null) {
      {
        deprecateReplaceLog('focusNodeAdjacency', 'emphasis: { focus: \'adjacency\'}', 'graph/sankey');
      }
      option.emphasis.focus = 'adjacency';
    }
  }
}
function traverseTree(data, cb) {
  if (data) {
    for (var i = 0; i < data.length; i++) {
      cb(data[i]);
      data[i] && traverseTree(data[i].children, cb);
    }
  }
}
function globalBackwardCompat(option, isTheme) {
  globalCompatStyle(option, isTheme);
  // Make sure series array for model initialization.
  option.series = normalizeToArray(option.series);
  each$f(option.series, function (seriesOpt) {
    if (!isObject$3(seriesOpt)) {
      return;
    }
    var seriesType = seriesOpt.type;
    if (seriesType === 'line') {
      if (seriesOpt.clipOverflow != null) {
        seriesOpt.clip = seriesOpt.clipOverflow;
        {
          deprecateReplaceLog('clipOverflow', 'clip', 'line');
        }
      }
    } else if (seriesType === 'pie' || seriesType === 'gauge') {
      if (seriesOpt.clockWise != null) {
        seriesOpt.clockwise = seriesOpt.clockWise;
        {
          deprecateReplaceLog('clockWise', 'clockwise');
        }
      }
      compatPieLabel(seriesOpt.label);
      var data = seriesOpt.data;
      if (data && !isTypedArray$1(data)) {
        for (var i = 0; i < data.length; i++) {
          compatPieLabel(data[i]);
        }
      }
      if (seriesOpt.hoverOffset != null) {
        seriesOpt.emphasis = seriesOpt.emphasis || {};
        if (seriesOpt.emphasis.scaleSize = null) {
          {
            deprecateReplaceLog('hoverOffset', 'emphasis.scaleSize');
          }
          seriesOpt.emphasis.scaleSize = seriesOpt.hoverOffset;
        }
      }
    } else if (seriesType === 'gauge') {
      var pointerColor = get(seriesOpt, 'pointer.color');
      pointerColor != null && set(seriesOpt, 'itemStyle.color', pointerColor);
    } else if (seriesType === 'bar') {
      compatBarItemStyle(seriesOpt);
      compatBarItemStyle(seriesOpt.backgroundStyle);
      compatBarItemStyle(seriesOpt.emphasis);
      var data = seriesOpt.data;
      if (data && !isTypedArray$1(data)) {
        for (var i = 0; i < data.length; i++) {
          if (typeof data[i] === 'object') {
            compatBarItemStyle(data[i]);
            compatBarItemStyle(data[i] && data[i].emphasis);
          }
        }
      }
    } else if (seriesType === 'sunburst') {
      var highlightPolicy = seriesOpt.highlightPolicy;
      if (highlightPolicy) {
        seriesOpt.emphasis = seriesOpt.emphasis || {};
        if (!seriesOpt.emphasis.focus) {
          seriesOpt.emphasis.focus = highlightPolicy;
          {
            deprecateReplaceLog('highlightPolicy', 'emphasis.focus', 'sunburst');
          }
        }
      }
      compatSunburstState(seriesOpt);
      traverseTree(seriesOpt.data, compatSunburstState);
    } else if (seriesType === 'graph' || seriesType === 'sankey') {
      compatGraphFocus(seriesOpt);
      // TODO nodes, edges?
    } else if (seriesType === 'map') {
      if (seriesOpt.mapType && !seriesOpt.map) {
        {
          deprecateReplaceLog('mapType', 'map', 'map');
        }
        seriesOpt.map = seriesOpt.mapType;
      }
      if (seriesOpt.mapLocation) {
        {
          deprecateLog('`mapLocation` is not used anymore.');
        }
        defaults(seriesOpt, seriesOpt.mapLocation);
      }
    }
    if (seriesOpt.hoverAnimation != null) {
      seriesOpt.emphasis = seriesOpt.emphasis || {};
      if (seriesOpt.emphasis && seriesOpt.emphasis.scale == null) {
        {
          deprecateReplaceLog('hoverAnimation', 'emphasis.scale');
        }
        seriesOpt.emphasis.scale = seriesOpt.hoverAnimation;
      }
    }
    compatLayoutProperties(seriesOpt);
  });
  // dataRange has changed to visualMap
  if (option.dataRange) {
    option.visualMap = option.dataRange;
  }
  each$f(COMPATITABLE_COMPONENTS, function (componentName) {
    var options = option[componentName];
    if (options) {
      if (!isArray$1(options)) {
        options = [options];
      }
      each$f(options, function (option) {
        compatLayoutProperties(option);
      });
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// (1) [Caution]: the logic is correct based on the premises:
//     data processing stage is blocked in stream.
//     See <module:echarts/stream/Scheduler#performDataProcessorTasks>
// (2) Only register once when import repeatedly.
//     Should be executed after series is filtered and before stack calculation.
function dataStack(ecModel) {
  var stackInfoMap = createHashMap();
  ecModel.eachSeries(function (seriesModel) {
    var stack = seriesModel.get('stack');
    // Compatible: when `stack` is set as '', do not stack.
    if (stack) {
      var stackInfoList = stackInfoMap.get(stack) || stackInfoMap.set(stack, []);
      var data = seriesModel.getData();
      var stackInfo = {
        // Used for calculate axis extent automatically.
        // TODO: Type getCalculationInfo return more specific type?
        stackResultDimension: data.getCalculationInfo('stackResultDimension'),
        stackedOverDimension: data.getCalculationInfo('stackedOverDimension'),
        stackedDimension: data.getCalculationInfo('stackedDimension'),
        stackedByDimension: data.getCalculationInfo('stackedByDimension'),
        isStackedByIndex: data.getCalculationInfo('isStackedByIndex'),
        data: data,
        seriesModel: seriesModel
      };
      // If stacked on axis that do not support data stack.
      if (!stackInfo.stackedDimension || !(stackInfo.isStackedByIndex || stackInfo.stackedByDimension)) {
        return;
      }
      stackInfoList.length && data.setCalculationInfo('stackedOnSeries', stackInfoList[stackInfoList.length - 1].seriesModel);
      stackInfoList.push(stackInfo);
    }
  });
  stackInfoMap.each(calculateStack);
}
function calculateStack(stackInfoList) {
  each$f(stackInfoList, function (targetStackInfo, idxInStack) {
    var resultVal = [];
    var resultNaN = [NaN, NaN];
    var dims = [targetStackInfo.stackResultDimension, targetStackInfo.stackedOverDimension];
    var targetData = targetStackInfo.data;
    var isStackedByIndex = targetStackInfo.isStackedByIndex;
    var stackStrategy = targetStackInfo.seriesModel.get('stackStrategy') || 'samesign';
    // Should not write on raw data, because stack series model list changes
    // depending on legend selection.
    targetData.modify(dims, function (v0, v1, dataIndex) {
      var sum = targetData.get(targetStackInfo.stackedDimension, dataIndex);
      // Consider `connectNulls` of line area, if value is NaN, stackedOver
      // should also be NaN, to draw a appropriate belt area.
      if (isNaN(sum)) {
        return resultNaN;
      }
      var byValue;
      var stackedDataRawIndex;
      if (isStackedByIndex) {
        stackedDataRawIndex = targetData.getRawIndex(dataIndex);
      } else {
        byValue = targetData.get(targetStackInfo.stackedByDimension, dataIndex);
      }
      // If stackOver is NaN, chart view will render point on value start.
      var stackedOver = NaN;
      for (var j = idxInStack - 1; j >= 0; j--) {
        var stackInfo = stackInfoList[j];
        // Has been optimized by inverted indices on `stackedByDimension`.
        if (!isStackedByIndex) {
          stackedDataRawIndex = stackInfo.data.rawIndexOf(stackInfo.stackedByDimension, byValue);
        }
        if (stackedDataRawIndex >= 0) {
          var val = stackInfo.data.getByRawIndex(stackInfo.stackResultDimension, stackedDataRawIndex);
          // Considering positive stack, negative stack and empty data
          if (stackStrategy === 'all' // single stack group
          || stackStrategy === 'positive' && val > 0 || stackStrategy === 'negative' && val < 0 || stackStrategy === 'samesign' && sum >= 0 && val > 0 // All positive stack
          || stackStrategy === 'samesign' && sum <= 0 && val < 0 // All negative stack
          ) {
            // The sum has to be very small to be affected by the
            // floating arithmetic problem. An incorrect result will probably
            // cause axis min/max to be filtered incorrectly.
            sum = addSafe(sum, val);
            stackedOver = val;
            break;
          }
        }
      }
      resultVal[0] = sum;
      resultVal[1] = stackedOver;
      return resultVal;
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// @inner
var SourceImpl = /** @class */function () {
  function SourceImpl(fields) {
    this.data = fields.data || (fields.sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS ? {} : []);
    this.sourceFormat = fields.sourceFormat || SOURCE_FORMAT_UNKNOWN;
    // Visit config
    this.seriesLayoutBy = fields.seriesLayoutBy || SERIES_LAYOUT_BY_COLUMN;
    this.startIndex = fields.startIndex || 0;
    this.dimensionsDetectedCount = fields.dimensionsDetectedCount;
    this.metaRawOption = fields.metaRawOption;
    var dimensionsDefine = this.dimensionsDefine = fields.dimensionsDefine;
    if (dimensionsDefine) {
      for (var i = 0; i < dimensionsDefine.length; i++) {
        var dim = dimensionsDefine[i];
        if (dim.type == null) {
          if (guessOrdinal(this, i) === BE_ORDINAL.Must) {
            dim.type = 'ordinal';
          }
        }
      }
    }
  }
  return SourceImpl;
}();
function isSourceInstance(val) {
  return val instanceof SourceImpl;
}
/**
 * Create a source from option.
 * NOTE: Created source is immutable. Don't change any properties in it.
 */
function createSource(sourceData, thisMetaRawOption,
// can be null. If not provided, auto detect it from `sourceData`.
sourceFormat) {
  sourceFormat = sourceFormat || detectSourceFormat(sourceData);
  var seriesLayoutBy = thisMetaRawOption.seriesLayoutBy;
  var determined = determineSourceDimensions(sourceData, sourceFormat, seriesLayoutBy, thisMetaRawOption.sourceHeader, thisMetaRawOption.dimensions);
  var source = new SourceImpl({
    data: sourceData,
    sourceFormat: sourceFormat,
    seriesLayoutBy: seriesLayoutBy,
    dimensionsDefine: determined.dimensionsDefine,
    startIndex: determined.startIndex,
    dimensionsDetectedCount: determined.dimensionsDetectedCount,
    metaRawOption: clone$4(thisMetaRawOption)
  });
  return source;
}
/**
 * Wrap original series data for some compatibility cases.
 */
function createSourceFromSeriesDataOption(data) {
  return new SourceImpl({
    data: data,
    sourceFormat: isTypedArray$1(data) ? SOURCE_FORMAT_TYPED_ARRAY : SOURCE_FORMAT_ORIGINAL
  });
}
/**
 * Clone source but excludes source data.
 */
function cloneSourceShallow(source) {
  return new SourceImpl({
    data: source.data,
    sourceFormat: source.sourceFormat,
    seriesLayoutBy: source.seriesLayoutBy,
    dimensionsDefine: clone$4(source.dimensionsDefine),
    startIndex: source.startIndex,
    dimensionsDetectedCount: source.dimensionsDetectedCount
  });
}
/**
 * Note: An empty array will be detected as `SOURCE_FORMAT_ARRAY_ROWS`.
 */
function detectSourceFormat(data) {
  var sourceFormat = SOURCE_FORMAT_UNKNOWN;
  if (isTypedArray$1(data)) {
    sourceFormat = SOURCE_FORMAT_TYPED_ARRAY;
  } else if (isArray$1(data)) {
    // FIXME Whether tolerate null in top level array?
    if (data.length === 0) {
      sourceFormat = SOURCE_FORMAT_ARRAY_ROWS;
    }
    for (var i = 0, len = data.length; i < len; i++) {
      var item = data[i];
      if (item == null) {
        continue;
      } else if (isArray$1(item) || isTypedArray$1(item)) {
        sourceFormat = SOURCE_FORMAT_ARRAY_ROWS;
        break;
      } else if (isObject$3(item)) {
        sourceFormat = SOURCE_FORMAT_OBJECT_ROWS;
        break;
      }
    }
  } else if (isObject$3(data)) {
    for (var key in data) {
      if (hasOwn(data, key) && isArrayLike(data[key])) {
        sourceFormat = SOURCE_FORMAT_KEYED_COLUMNS;
        break;
      }
    }
  }
  return sourceFormat;
}
/**
 * Determine the source definitions from data standalone dimensions definitions
 * are not specified.
 */
function determineSourceDimensions(data, sourceFormat, seriesLayoutBy, sourceHeader,
// standalone raw dimensions definition, like:
// {
//     dimensions: ['aa', 'bb', { name: 'cc', type: 'time' }]
// }
// in `dataset` or `series`
dimensionsDefine) {
  var dimensionsDetectedCount;
  var startIndex;
  // PENDING: Could data be null/undefined here?
  // currently, if `dataset.source` not specified, error thrown.
  // if `series.data` not specified, nothing rendered without error thrown.
  // Should test these cases.
  if (!data) {
    return {
      dimensionsDefine: normalizeDimensionsOption(dimensionsDefine),
      startIndex: startIndex,
      dimensionsDetectedCount: dimensionsDetectedCount
    };
  }
  if (sourceFormat === SOURCE_FORMAT_ARRAY_ROWS) {
    var dataArrayRows = data;
    // Rule: Most of the first line are string: it is header.
    // Caution: consider a line with 5 string and 1 number,
    // it still can not be sure it is a head, because the
    // 5 string may be 5 values of category columns.
    if (sourceHeader === 'auto' || sourceHeader == null) {
      arrayRowsTravelFirst(function (val) {
        // '-' is regarded as null/undefined.
        if (val != null && val !== '-') {
          if (isString(val)) {
            startIndex == null && (startIndex = 1);
          } else {
            startIndex = 0;
          }
        }
        // 10 is an experience number, avoid long loop.
      }, seriesLayoutBy, dataArrayRows, 10);
    } else {
      startIndex = isNumber(sourceHeader) ? sourceHeader : sourceHeader ? 1 : 0;
    }
    if (!dimensionsDefine && startIndex === 1) {
      dimensionsDefine = [];
      arrayRowsTravelFirst(function (val, index) {
        dimensionsDefine[index] = val != null ? val + '' : '';
      }, seriesLayoutBy, dataArrayRows, Infinity);
    }
    dimensionsDetectedCount = dimensionsDefine ? dimensionsDefine.length : seriesLayoutBy === SERIES_LAYOUT_BY_ROW ? dataArrayRows.length : dataArrayRows[0] ? dataArrayRows[0].length : null;
  } else if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS) {
    if (!dimensionsDefine) {
      dimensionsDefine = objectRowsCollectDimensions(data);
    }
  } else if (sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS) {
    if (!dimensionsDefine) {
      dimensionsDefine = [];
      each$f(data, function (colArr, key) {
        dimensionsDefine.push(key);
      });
    }
  } else if (sourceFormat === SOURCE_FORMAT_ORIGINAL) {
    var value0 = getDataItemValue(data[0]);
    dimensionsDetectedCount = isArray$1(value0) && value0.length || 1;
  } else if (sourceFormat === SOURCE_FORMAT_TYPED_ARRAY) {
    {
      assert(!!dimensionsDefine, 'dimensions must be given if data is TypedArray.');
    }
  }
  return {
    startIndex: startIndex,
    dimensionsDefine: normalizeDimensionsOption(dimensionsDefine),
    dimensionsDetectedCount: dimensionsDetectedCount
  };
}
function objectRowsCollectDimensions(data) {
  var firstIndex = 0;
  var obj;
  while (firstIndex < data.length && !(obj = data[firstIndex++])) {} // jshint ignore: line
  if (obj) {
    return keys(obj);
  }
}
// Consider dimensions defined like ['A', 'price', 'B', 'price', 'C', 'price'],
// which is reasonable. But dimension name is duplicated.
// Returns undefined or an array contains only object without null/undefined or string.
function normalizeDimensionsOption(dimensionsDefine) {
  if (!dimensionsDefine) {
    // The meaning of null/undefined is different from empty array.
    return;
  }
  var nameMap = createHashMap();
  return map$1(dimensionsDefine, function (rawItem, index) {
    rawItem = isObject$3(rawItem) ? rawItem : {
      name: rawItem
    };
    // Other fields will be discarded.
    var item = {
      name: rawItem.name,
      displayName: rawItem.displayName,
      type: rawItem.type
    };
    // User can set null in dimensions.
    // We don't auto specify name, otherwise a given name may
    // cause it to be referred unexpectedly.
    if (item.name == null) {
      return item;
    }
    // Also consider number form like 2012.
    item.name += '';
    // User may also specify displayName.
    // displayName will always exists except user not
    // specified or dim name is not specified or detected.
    // (A auto generated dim name will not be used as
    // displayName).
    if (item.displayName == null) {
      item.displayName = item.name;
    }
    var exist = nameMap.get(item.name);
    if (!exist) {
      nameMap.set(item.name, {
        count: 1
      });
    } else {
      item.name += '-' + exist.count++;
    }
    return item;
  });
}
function arrayRowsTravelFirst(cb, seriesLayoutBy, data, maxLoop) {
  if (seriesLayoutBy === SERIES_LAYOUT_BY_ROW) {
    for (var i = 0; i < data.length && i < maxLoop; i++) {
      cb(data[i] ? data[i][0] : null, i);
    }
  } else {
    var value0 = data[0] || [];
    for (var i = 0; i < value0.length && i < maxLoop; i++) {
      cb(value0[i], i);
    }
  }
}
function shouldRetrieveDataByName(source) {
  var sourceFormat = source.sourceFormat;
  return sourceFormat === SOURCE_FORMAT_OBJECT_ROWS || sourceFormat === SOURCE_FORMAT_KEYED_COLUMNS;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var _a$1, _b$1, _c;
var providerMethods;
var mountMethods;
/**
 * If normal array used, mutable chunk size is supported.
 * If typed array used, chunk size must be fixed.
 */
var DefaultDataProvider = /** @class */function () {
  function DefaultDataProvider(sourceParam, dimSize) {
    // let source: Source;
    var source = !isSourceInstance(sourceParam) ? createSourceFromSeriesDataOption(sourceParam) : sourceParam;
    // declare source is Source;
    this._source = source;
    var data = this._data = source.data;
    // Typed array. TODO IE10+?
    if (source.sourceFormat === SOURCE_FORMAT_TYPED_ARRAY) {
      {
        if (dimSize == null) {
          throw new Error('Typed array data must specify dimension size');
        }
      }
      this._offset = 0;
      this._dimSize = dimSize;
      this._data = data;
    }
    mountMethods(this, data, source);
  }
  DefaultDataProvider.prototype.getSource = function () {
    return this._source;
  };
  DefaultDataProvider.prototype.count = function () {
    return 0;
  };
  DefaultDataProvider.prototype.getItem = function (idx, out) {
    return;
  };
  DefaultDataProvider.prototype.appendData = function (newData) {};
  DefaultDataProvider.prototype.clean = function () {};
  DefaultDataProvider.protoInitialize = function () {
    // PENDING: To avoid potential incompat (e.g., prototype
    // is visited somewhere), still init them on prototype.
    var proto = DefaultDataProvider.prototype;
    proto.pure = false;
    proto.persistent = true;
  }();
  DefaultDataProvider.internalField = function () {
    var _a;
    mountMethods = function (provider, data, source) {
      var sourceFormat = source.sourceFormat;
      var seriesLayoutBy = source.seriesLayoutBy;
      var startIndex = source.startIndex;
      var dimsDef = source.dimensionsDefine;
      var methods = providerMethods[getMethodMapKey(sourceFormat, seriesLayoutBy)];
      {
        assert(methods, 'Invalide sourceFormat: ' + sourceFormat);
      }
      extend(provider, methods);
      if (sourceFormat === SOURCE_FORMAT_TYPED_ARRAY) {
        provider.getItem = getItemForTypedArray;
        provider.count = countForTypedArray;
        provider.fillStorage = fillStorageForTypedArray;
      } else {
        var rawItemGetter = getRawSourceItemGetter(sourceFormat, seriesLayoutBy);
        provider.getItem = bind$1(rawItemGetter, null, data, startIndex, dimsDef);
        var rawCounter = getRawSourceDataCounter(sourceFormat, seriesLayoutBy);
        provider.count = bind$1(rawCounter, null, data, startIndex, dimsDef);
      }
    };
    var getItemForTypedArray = function (idx, out) {
      idx = idx - this._offset;
      out = out || [];
      var data = this._data;
      var dimSize = this._dimSize;
      var offset = dimSize * idx;
      for (var i = 0; i < dimSize; i++) {
        out[i] = data[offset + i];
      }
      return out;
    };
    var fillStorageForTypedArray = function (start, end, storage, extent) {
      var data = this._data;
      var dimSize = this._dimSize;
      for (var dim = 0; dim < dimSize; dim++) {
        var dimExtent = extent[dim];
        var min = dimExtent[0] == null ? Infinity : dimExtent[0];
        var max = dimExtent[1] == null ? -Infinity : dimExtent[1];
        var count = end - start;
        var arr = storage[dim];
        for (var i = 0; i < count; i++) {
          // appendData with TypedArray will always do replace in provider.
          var val = data[i * dimSize + dim];
          arr[start + i] = val;
          val < min && (min = val);
          val > max && (max = val);
        }
        dimExtent[0] = min;
        dimExtent[1] = max;
      }
    };
    var countForTypedArray = function () {
      return this._data ? this._data.length / this._dimSize : 0;
    };
    providerMethods = (_a = {}, _a[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_COLUMN] = {
      pure: true,
      appendData: appendDataSimply
    }, _a[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_ROW] = {
      pure: true,
      appendData: function () {
        throw new Error('Do not support appendData when set seriesLayoutBy: "row".');
      }
    }, _a[SOURCE_FORMAT_OBJECT_ROWS] = {
      pure: true,
      appendData: appendDataSimply
    }, _a[SOURCE_FORMAT_KEYED_COLUMNS] = {
      pure: true,
      appendData: function (newData) {
        var data = this._data;
        each$f(newData, function (newCol, key) {
          var oldCol = data[key] || (data[key] = []);
          for (var i = 0; i < (newCol || []).length; i++) {
            oldCol.push(newCol[i]);
          }
        });
      }
    }, _a[SOURCE_FORMAT_ORIGINAL] = {
      appendData: appendDataSimply
    }, _a[SOURCE_FORMAT_TYPED_ARRAY] = {
      persistent: false,
      pure: true,
      appendData: function (newData) {
        {
          assert(isTypedArray$1(newData), 'Added data must be TypedArray if data in initialization is TypedArray');
        }
        this._data = newData;
      },
      // Clean self if data is already used.
      clean: function () {
        // PENDING
        this._offset += this.count();
        this._data = null;
      }
    }, _a);
    function appendDataSimply(newData) {
      for (var i = 0; i < newData.length; i++) {
        this._data.push(newData[i]);
      }
    }
  }();
  return DefaultDataProvider;
}();
var getItemSimply = function (rawData, startIndex, dimsDef, idx) {
  return rawData[idx];
};
var rawSourceItemGetterMap = (_a$1 = {}, _a$1[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_COLUMN] = function (rawData, startIndex, dimsDef, idx) {
  return rawData[idx + startIndex];
}, _a$1[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_ROW] = function (rawData, startIndex, dimsDef, idx, out) {
  idx += startIndex;
  var item = out || [];
  var data = rawData;
  for (var i = 0; i < data.length; i++) {
    var row = data[i];
    item[i] = row ? row[idx] : null;
  }
  return item;
}, _a$1[SOURCE_FORMAT_OBJECT_ROWS] = getItemSimply, _a$1[SOURCE_FORMAT_KEYED_COLUMNS] = function (rawData, startIndex, dimsDef, idx, out) {
  var item = out || [];
  for (var i = 0; i < dimsDef.length; i++) {
    var dimName = dimsDef[i].name;
    {
      if (dimName == null) {
        throw new Error();
      }
    }
    var col = rawData[dimName];
    item[i] = col ? col[idx] : null;
  }
  return item;
}, _a$1[SOURCE_FORMAT_ORIGINAL] = getItemSimply, _a$1);
function getRawSourceItemGetter(sourceFormat, seriesLayoutBy) {
  var method = rawSourceItemGetterMap[getMethodMapKey(sourceFormat, seriesLayoutBy)];
  {
    assert(method, 'Do not support get item on "' + sourceFormat + '", "' + seriesLayoutBy + '".');
  }
  return method;
}
var countSimply = function (rawData, startIndex, dimsDef) {
  return rawData.length;
};
var rawSourceDataCounterMap = (_b$1 = {}, _b$1[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_COLUMN] = function (rawData, startIndex, dimsDef) {
  return Math.max(0, rawData.length - startIndex);
}, _b$1[SOURCE_FORMAT_ARRAY_ROWS + '_' + SERIES_LAYOUT_BY_ROW] = function (rawData, startIndex, dimsDef) {
  var row = rawData[0];
  return row ? Math.max(0, row.length - startIndex) : 0;
}, _b$1[SOURCE_FORMAT_OBJECT_ROWS] = countSimply, _b$1[SOURCE_FORMAT_KEYED_COLUMNS] = function (rawData, startIndex, dimsDef) {
  var dimName = dimsDef[0].name;
  {
    if (dimName == null) {
      throw new Error();
    }
  }
  var col = rawData[dimName];
  return col ? col.length : 0;
}, _b$1[SOURCE_FORMAT_ORIGINAL] = countSimply, _b$1);
function getRawSourceDataCounter(sourceFormat, seriesLayoutBy) {
  var method = rawSourceDataCounterMap[getMethodMapKey(sourceFormat, seriesLayoutBy)];
  {
    assert(method, 'Do not support count on "' + sourceFormat + '", "' + seriesLayoutBy + '".');
  }
  return method;
}
var getRawValueSimply = function (dataItem, dimIndex, property) {
  return dataItem[dimIndex];
};
var rawSourceValueGetterMap = (_c = {}, _c[SOURCE_FORMAT_ARRAY_ROWS] = getRawValueSimply, _c[SOURCE_FORMAT_OBJECT_ROWS] = function (dataItem, dimIndex, property) {
  return dataItem[property];
}, _c[SOURCE_FORMAT_KEYED_COLUMNS] = getRawValueSimply, _c[SOURCE_FORMAT_ORIGINAL] = function (dataItem, dimIndex, property) {
  // FIXME: In some case (markpoint in geo (geo-map.html)),
  // dataItem is {coord: [...]}
  var value = getDataItemValue(dataItem);
  return !(value instanceof Array) ? value : value[dimIndex];
}, _c[SOURCE_FORMAT_TYPED_ARRAY] = getRawValueSimply, _c);
function getRawSourceValueGetter(sourceFormat) {
  var method = rawSourceValueGetterMap[sourceFormat];
  {
    assert(method, 'Do not support get value on "' + sourceFormat + '".');
  }
  return method;
}
function getMethodMapKey(sourceFormat, seriesLayoutBy) {
  return sourceFormat === SOURCE_FORMAT_ARRAY_ROWS ? sourceFormat + '_' + seriesLayoutBy : sourceFormat;
}
// ??? FIXME can these logic be more neat: getRawValue, getRawDataItem,
// Consider persistent.
// Caution: why use raw value to display on label or tooltip?
// A reason is to avoid format. For example time value we do not know
// how to format is expected. More over, if stack is used, calculated
// value may be 0.91000000001, which have brings trouble to display.
// TODO: consider how to treat null/undefined/NaN when display?
function retrieveRawValue(data, dataIndex,
// If dimIndex is null/undefined, return OptionDataItem.
// Otherwise, return OptionDataValue.
dim) {
  if (!data) {
    return;
  }
  // Consider data may be not persistent.
  var dataItem = data.getRawDataItem(dataIndex);
  if (dataItem == null) {
    return;
  }
  var store = data.getStore();
  var sourceFormat = store.getSource().sourceFormat;
  if (dim != null) {
    var dimIndex = data.getDimensionIndex(dim);
    var property = store.getDimensionProperty(dimIndex);
    return getRawSourceValueGetter(sourceFormat)(dataItem, dimIndex, property);
  } else {
    var result = dataItem;
    if (sourceFormat === SOURCE_FORMAT_ORIGINAL) {
      result = getDataItemValue(dataItem);
    }
    return result;
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DIMENSION_LABEL_REG = /\{@(.+?)\}/g;
var DataFormatMixin = /** @class */function () {
  function DataFormatMixin() {}
  /**
   * Get params for formatter
   */
  DataFormatMixin.prototype.getDataParams = function (dataIndex, dataType) {
    var data = this.getData(dataType);
    var rawValue = this.getRawValue(dataIndex, dataType);
    var rawDataIndex = data.getRawIndex(dataIndex);
    var name = data.getName(dataIndex);
    var itemOpt = data.getRawDataItem(dataIndex);
    var style = data.getItemVisual(dataIndex, 'style');
    var color = style && style[data.getItemVisual(dataIndex, 'drawType') || 'fill'];
    var borderColor = style && style.stroke;
    var mainType = this.mainType;
    var isSeries = mainType === 'series';
    var userOutput = data.userOutput && data.userOutput.get();
    return {
      componentType: mainType,
      componentSubType: this.subType,
      componentIndex: this.componentIndex,
      seriesType: isSeries ? this.subType : null,
      seriesIndex: this.seriesIndex,
      seriesId: isSeries ? this.id : null,
      seriesName: isSeries ? this.name : null,
      name: name,
      dataIndex: rawDataIndex,
      data: itemOpt,
      dataType: dataType,
      value: rawValue,
      color: color,
      borderColor: borderColor,
      dimensionNames: userOutput ? userOutput.fullDimensions : null,
      encode: userOutput ? userOutput.encode : null,
      // Param name list for mapping `a`, `b`, `c`, `d`, `e`
      $vars: ['seriesName', 'name', 'value']
    };
  };
  /**
   * Format label
   * @param dataIndex
   * @param status 'normal' by default
   * @param dataType
   * @param labelDimIndex Only used in some chart that
   *        use formatter in different dimensions, like radar.
   * @param formatter Formatter given outside.
   * @return return null/undefined if no formatter
   */
  DataFormatMixin.prototype.getFormattedLabel = function (dataIndex, status, dataType, labelDimIndex, formatter, extendParams) {
    status = status || 'normal';
    var data = this.getData(dataType);
    var params = this.getDataParams(dataIndex, dataType);
    if (extendParams) {
      params.value = extendParams.interpolatedValue;
    }
    if (labelDimIndex != null && isArray$1(params.value)) {
      params.value = params.value[labelDimIndex];
    }
    if (!formatter) {
      var itemModel = data.getItemModel(dataIndex);
      // @ts-ignore
      formatter = itemModel.get(status === 'normal' ? ['label', 'formatter'] : [status, 'label', 'formatter']);
    }
    if (isFunction(formatter)) {
      params.status = status;
      params.dimensionIndex = labelDimIndex;
      return formatter(params);
    } else if (isString(formatter)) {
      var str = formatTpl(formatter, params);
      // Support 'aaa{@[3]}bbb{@product}ccc'.
      // Do not support '}' in dim name util have to.
      return str.replace(DIMENSION_LABEL_REG, function (origin, dimStr) {
        var len = dimStr.length;
        var dimLoose = dimStr;
        if (dimLoose.charAt(0) === '[' && dimLoose.charAt(len - 1) === ']') {
          dimLoose = +dimLoose.slice(1, len - 1); // Also support: '[]' => 0
          {
            if (isNaN(dimLoose)) {
              error("Invalide label formatter: @" + dimStr + ", only support @[0], @[1], @[2], ...");
            }
          }
        }
        var val = retrieveRawValue(data, dataIndex, dimLoose);
        if (extendParams && isArray$1(extendParams.interpolatedValue)) {
          var dimIndex = data.getDimensionIndex(dimLoose);
          if (dimIndex >= 0) {
            val = extendParams.interpolatedValue[dimIndex];
          }
        }
        return val != null ? val + '' : '';
      });
    }
  };
  /**
   * Get raw value in option
   */
  DataFormatMixin.prototype.getRawValue = function (idx, dataType) {
    return retrieveRawValue(this.getData(dataType), idx);
  };
  /**
   * Should be implemented.
   * @param {number} dataIndex
   * @param {boolean} [multipleSeries=false]
   * @param {string} [dataType]
   */
  DataFormatMixin.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    // Empty function
    return;
  };
  return DataFormatMixin;
}();
// PENDING: previously we accept this type when calling `formatTooltip`,
// but guess little chance has been used outside. Do we need to backward
// compat it?
// type TooltipFormatResultLegacyObject = {
//     // `html` means the markup language text, either in 'html' or 'richText'.
//     // The name `html` is not appropriate because in 'richText' it is not a HTML
//     // string. But still support it for backward compatibility.
//     html: string;
//     markers: Dictionary<ColorString>;
// };
/**
 * For backward compat, normalize the return from `formatTooltip`.
 */
function normalizeTooltipFormatResult(result) {
  var markupText;
  // let markers: Dictionary<ColorString>;
  var markupFragment;
  if (isObject$3(result)) {
    if (result.type) {
      markupFragment = result;
    } else {
      {
        console.warn('The return type of `formatTooltip` is not supported: ' + makePrintable(result));
      }
    }
    // else {
    //     markupText = (result as TooltipFormatResultLegacyObject).html;
    //     markers = (result as TooltipFormatResultLegacyObject).markers;
    //     if (markersExisting) {
    //         markers = zrUtil.merge(markersExisting, markers);
    //     }
    // }
  } else {
    markupText = result;
  }
  return {
    text: markupText,
    // markers: markers || markersExisting,
    frag: markupFragment
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * @param {Object} define
 * @return See the return of `createTask`.
 */
function createTask(define) {
  return new Task(define);
}
var Task = /** @class */function () {
  function Task(define) {
    define = define || {};
    this._reset = define.reset;
    this._plan = define.plan;
    this._count = define.count;
    this._onDirty = define.onDirty;
    this._dirty = true;
  }
  /**
   * @param step Specified step.
   * @param skip Skip customer perform call.
   * @param modBy Sampling window size.
   * @param modDataCount Sampling count.
   * @return whether unfinished.
   */
  Task.prototype.perform = function (performArgs) {
    var upTask = this._upstream;
    var skip = performArgs && performArgs.skip;
    // TODO some refactor.
    // Pull data. Must pull data each time, because context.data
    // may be updated by Series.setData.
    if (this._dirty && upTask) {
      var context = this.context;
      context.data = context.outputData = upTask.context.outputData;
    }
    if (this.__pipeline) {
      this.__pipeline.currentTask = this;
    }
    var planResult;
    if (this._plan && !skip) {
      planResult = this._plan(this.context);
    }
    // Support sharding by mod, which changes the render sequence and makes the rendered graphic
    // elements uniformed distributed when progress, especially when moving or zooming.
    var lastModBy = normalizeModBy(this._modBy);
    var lastModDataCount = this._modDataCount || 0;
    var modBy = normalizeModBy(performArgs && performArgs.modBy);
    var modDataCount = performArgs && performArgs.modDataCount || 0;
    if (lastModBy !== modBy || lastModDataCount !== modDataCount) {
      planResult = 'reset';
    }
    function normalizeModBy(val) {
      !(val >= 1) && (val = 1); // jshint ignore:line
      return val;
    }
    var forceFirstProgress;
    if (this._dirty || planResult === 'reset') {
      this._dirty = false;
      forceFirstProgress = this._doReset(skip);
    }
    this._modBy = modBy;
    this._modDataCount = modDataCount;
    var step = performArgs && performArgs.step;
    if (upTask) {
      {
        assert(upTask._outputDueEnd != null);
      }
      this._dueEnd = upTask._outputDueEnd;
    }
    // DataTask or overallTask
    else {
      {
        assert(!this._progress || this._count);
      }
      this._dueEnd = this._count ? this._count(this.context) : Infinity;
    }
    // Note: Stubs, that its host overall task let it has progress, has progress.
    // If no progress, pass index from upstream to downstream each time plan called.
    if (this._progress) {
      var start = this._dueIndex;
      var end = Math.min(step != null ? this._dueIndex + step : Infinity, this._dueEnd);
      if (!skip && (forceFirstProgress || start < end)) {
        var progress = this._progress;
        if (isArray$1(progress)) {
          for (var i = 0; i < progress.length; i++) {
            this._doProgress(progress[i], start, end, modBy, modDataCount);
          }
        } else {
          this._doProgress(progress, start, end, modBy, modDataCount);
        }
      }
      this._dueIndex = end;
      // If no `outputDueEnd`, assume that output data and
      // input data is the same, so use `dueIndex` as `outputDueEnd`.
      var outputDueEnd = this._settedOutputEnd != null ? this._settedOutputEnd : end;
      {
        // ??? Can not rollback.
        assert(outputDueEnd >= this._outputDueEnd);
      }
      this._outputDueEnd = outputDueEnd;
    } else {
      // (1) Some overall task has no progress.
      // (2) Stubs, that its host overall task do not let it has progress, has no progress.
      // This should always be performed so it can be passed to downstream.
      this._dueIndex = this._outputDueEnd = this._settedOutputEnd != null ? this._settedOutputEnd : this._dueEnd;
    }
    return this.unfinished();
  };
  Task.prototype.dirty = function () {
    this._dirty = true;
    this._onDirty && this._onDirty(this.context);
  };
  Task.prototype._doProgress = function (progress, start, end, modBy, modDataCount) {
    iterator.reset(start, end, modBy, modDataCount);
    this._callingProgress = progress;
    this._callingProgress({
      start: start,
      end: end,
      count: end - start,
      next: iterator.next
    }, this.context);
  };
  Task.prototype._doReset = function (skip) {
    this._dueIndex = this._outputDueEnd = this._dueEnd = 0;
    this._settedOutputEnd = null;
    var progress;
    var forceFirstProgress;
    if (!skip && this._reset) {
      progress = this._reset(this.context);
      if (progress && progress.progress) {
        forceFirstProgress = progress.forceFirstProgress;
        progress = progress.progress;
      }
      // To simplify no progress checking, array must has item.
      if (isArray$1(progress) && !progress.length) {
        progress = null;
      }
    }
    this._progress = progress;
    this._modBy = this._modDataCount = null;
    var downstream = this._downstream;
    downstream && downstream.dirty();
    return forceFirstProgress;
  };
  Task.prototype.unfinished = function () {
    return this._progress && this._dueIndex < this._dueEnd;
  };
  /**
   * @param downTask The downstream task.
   * @return The downstream task.
   */
  Task.prototype.pipe = function (downTask) {
    {
      assert(downTask && !downTask._disposed && downTask !== this);
    }
    // If already downstream, do not dirty downTask.
    if (this._downstream !== downTask || this._dirty) {
      this._downstream = downTask;
      downTask._upstream = this;
      downTask.dirty();
    }
  };
  Task.prototype.dispose = function () {
    if (this._disposed) {
      return;
    }
    this._upstream && (this._upstream._downstream = null);
    this._downstream && (this._downstream._upstream = null);
    this._dirty = false;
    this._disposed = true;
  };
  Task.prototype.getUpstream = function () {
    return this._upstream;
  };
  Task.prototype.getDownstream = function () {
    return this._downstream;
  };
  Task.prototype.setOutputEnd = function (end) {
    // This only happens in dataTask, dataZoom, map, currently.
    // where dataZoom do not set end each time, but only set
    // when reset. So we should record the set end, in case
    // that the stub of dataZoom perform again and earse the
    // set end by upstream.
    this._outputDueEnd = this._settedOutputEnd = end;
  };
  return Task;
}();
var iterator = function () {
  var end;
  var current;
  var modBy;
  var modDataCount;
  var winCount;
  var it = {
    reset: function (s, e, sStep, sCount) {
      current = s;
      end = e;
      modBy = sStep;
      modDataCount = sCount;
      winCount = Math.ceil(modDataCount / modBy);
      it.next = modBy > 1 && modDataCount > 0 ? modNext : sequentialNext;
    }
  };
  return it;
  function sequentialNext() {
    return current < end ? current++ : null;
  }
  function modNext() {
    var dataIndex = current % winCount * modBy + Math.ceil(current / winCount);
    var result = current >= end ? null : dataIndex < modDataCount ? dataIndex
    // If modDataCount is smaller than data.count() (consider `appendData` case),
    // Use normal linear rendering mode.
    : current;
    current++;
    return result;
  }
}();
// -----------------------------------------------------------------------------
// For stream debug (Should be commented out after used!)
// @usage: printTask(this, 'begin');
// @usage: printTask(this, null, {someExtraProp});
// @usage: Use `__idxInPipeline` as conditional breakpiont.
//
// window.printTask = function (task: any, prefix: string, extra: { [key: string]: unknown }): void {
//     window.ecTaskUID == null && (window.ecTaskUID = 0);
//     task.uidDebug == null && (task.uidDebug = `task_${window.ecTaskUID++}`);
//     task.agent && task.agent.uidDebug == null && (task.agent.uidDebug = `task_${window.ecTaskUID++}`);
//     let props = [];
//     if (task.__pipeline) {
//         let val = `${task.__idxInPipeline}/${task.__pipeline.tail.__idxInPipeline} ${task.agent ? '(stub)' : ''}`;
//         props.push({text: '__idxInPipeline/total', value: val});
//     } else {
//         let stubCount = 0;
//         task.agentStubMap.each(() => stubCount++);
//         props.push({text: 'idx', value: `overall (stubs: ${stubCount})`});
//     }
//     props.push({text: 'uid', value: task.uidDebug});
//     if (task.__pipeline) {
//         props.push({text: 'pipelineId', value: task.__pipeline.id});
//         task.agent && props.push(
//             {text: 'stubFor', value: task.agent.uidDebug}
//         );
//     }
//     props.push(
//         {text: 'dirty', value: task._dirty},
//         {text: 'dueIndex', value: task._dueIndex},
//         {text: 'dueEnd', value: task._dueEnd},
//         {text: 'outputDueEnd', value: task._outputDueEnd}
//     );
//     if (extra) {
//         Object.keys(extra).forEach(key => {
//             props.push({text: key, value: extra[key]});
//         });
//     }
//     let args = ['color: blue'];
//     let msg = `%c[${prefix || 'T'}] %c` + props.map(item => (
//         args.push('color: green', 'color: red'),
//         `${item.text}: %c${item.value}`
//     )).join('%c, ');
//     console.log.apply(console, [msg].concat(args));
//     // console.log(this);
// };
// window.printPipeline = function (task: any, prefix: string) {
//     const pipeline = task.__pipeline;
//     let currTask = pipeline.head;
//     while (currTask) {
//         window.printTask(currTask, prefix);
//         currTask = currTask._downstream;
//     }
// };
// window.showChain = function (chainHeadTask) {
//     var chain = [];
//     var task = chainHeadTask;
//     while (task) {
//         chain.push({
//             task: task,
//             up: task._upstream,
//             down: task._downstream,
//             idxInPipeline: task.__idxInPipeline
//         });
//         task = task._downstream;
//     }
//     return chain;
// };
// window.findTaskInChain = function (task, chainHeadTask) {
//     let chain = window.showChain(chainHeadTask);
//     let result = [];
//     for (let i = 0; i < chain.length; i++) {
//         let chainItem = chain[i];
//         if (chainItem.task === task) {
//             result.push(i);
//         }
//     }
//     return result;
// };
// window.printChainAEachInChainB = function (chainHeadTaskA, chainHeadTaskB) {
//     let chainA = window.showChain(chainHeadTaskA);
//     for (let i = 0; i < chainA.length; i++) {
//         console.log('chainAIdx:', i, 'inChainB:', window.findTaskInChain(chainA[i].task, chainHeadTaskB));
//     }
// };

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Convert raw the value in to inner value in List.
 *
 * [Performance sensitive]
 *
 * [Caution]: this is the key logic of user value parser.
 * For backward compatibility, do not modify it until you have to!
 */
function parseDataValue(value,
// For high performance, do not omit the second param.
opt) {
  // Performance sensitive.
  var dimType = opt && opt.type;
  if (dimType === 'ordinal') {
    // If given value is a category string
    return value;
  }
  if (dimType === 'time'
  // spead up when using timestamp
  && !isNumber(value) && value != null && value !== '-') {
    value = +parseDate(value);
  }
  // dimType defaults 'number'.
  // If dimType is not ordinal and value is null or undefined or NaN or '-',
  // parse to NaN.
  // number-like string (like ' 123 ') can be converted to a number.
  // where null/undefined or other string will be converted to NaN.
  return value == null || value === '' ? NaN
  // If string (like '-'), using '+' parse to NaN
  // If object, also parse to NaN
  : Number(value);
}
var valueParserMap = createHashMap({
  'number': function (val) {
    // Do not use `numericToNumber` here. We have `numericToNumber` by default.
    // Here the number parser can have loose rule:
    // enable to cut suffix: "120px" => 120, "14%" => 14.
    return parseFloat(val);
  },
  'time': function (val) {
    // return timestamp.
    return +parseDate(val);
  },
  'trim': function (val) {
    return isString(val) ? trim$1(val) : val;
  }
});
function getRawValueParser(type) {
  return valueParserMap.get(type);
}
var ORDER_COMPARISON_OP_MAP = {
  lt: function (lval, rval) {
    return lval < rval;
  },
  lte: function (lval, rval) {
    return lval <= rval;
  },
  gt: function (lval, rval) {
    return lval > rval;
  },
  gte: function (lval, rval) {
    return lval >= rval;
  }
};
var FilterOrderComparator = /** @class */function () {
  function FilterOrderComparator(op, rval) {
    if (!isNumber(rval)) {
      var errMsg = '';
      {
        errMsg = 'rvalue of "<", ">", "<=", ">=" can only be number in filter.';
      }
      throwError(errMsg);
    }
    this._opFn = ORDER_COMPARISON_OP_MAP[op];
    this._rvalFloat = numericToNumber(rval);
  }
  // Performance sensitive.
  FilterOrderComparator.prototype.evaluate = function (lval) {
    // Most cases is 'number', and typeof maybe 10 times faseter than parseFloat.
    return isNumber(lval) ? this._opFn(lval, this._rvalFloat) : this._opFn(numericToNumber(lval), this._rvalFloat);
  };
  return FilterOrderComparator;
}();
var SortOrderComparator = /** @class */function () {
  /**
   * @param order by default: 'asc'
   * @param incomparable by default: Always on the tail.
   *        That is, if 'asc' => 'max', if 'desc' => 'min'
   *        See the definition of "incomparable" in [SORT_COMPARISON_RULE].
   */
  function SortOrderComparator(order, incomparable) {
    var isDesc = order === 'desc';
    this._resultLT = isDesc ? 1 : -1;
    if (incomparable == null) {
      incomparable = isDesc ? 'min' : 'max';
    }
    this._incomparable = incomparable === 'min' ? -Infinity : Infinity;
  }
  // See [SORT_COMPARISON_RULE].
  // Performance sensitive.
  SortOrderComparator.prototype.evaluate = function (lval, rval) {
    // Most cases is 'number', and typeof maybe 10 times faseter than parseFloat.
    var lvalFloat = isNumber(lval) ? lval : numericToNumber(lval);
    var rvalFloat = isNumber(rval) ? rval : numericToNumber(rval);
    var lvalNotNumeric = isNaN(lvalFloat);
    var rvalNotNumeric = isNaN(rvalFloat);
    if (lvalNotNumeric) {
      lvalFloat = this._incomparable;
    }
    if (rvalNotNumeric) {
      rvalFloat = this._incomparable;
    }
    if (lvalNotNumeric && rvalNotNumeric) {
      var lvalIsStr = isString(lval);
      var rvalIsStr = isString(rval);
      if (lvalIsStr) {
        lvalFloat = rvalIsStr ? lval : 0;
      }
      if (rvalIsStr) {
        rvalFloat = lvalIsStr ? rval : 0;
      }
    }
    return lvalFloat < rvalFloat ? this._resultLT : lvalFloat > rvalFloat ? -this._resultLT : 0;
  };
  return SortOrderComparator;
}();
var FilterEqualityComparator = /** @class */function () {
  function FilterEqualityComparator(isEq, rval) {
    this._rval = rval;
    this._isEQ = isEq;
    this._rvalTypeof = typeof rval;
    this._rvalFloat = numericToNumber(rval);
  }
  // Performance sensitive.
  FilterEqualityComparator.prototype.evaluate = function (lval) {
    var eqResult = lval === this._rval;
    if (!eqResult) {
      var lvalTypeof = typeof lval;
      if (lvalTypeof !== this._rvalTypeof && (lvalTypeof === 'number' || this._rvalTypeof === 'number')) {
        eqResult = numericToNumber(lval) === this._rvalFloat;
      }
    }
    return this._isEQ ? eqResult : !eqResult;
  };
  return FilterEqualityComparator;
}();
/**
 * [FILTER_COMPARISON_RULE]
 * `lt`|`lte`|`gt`|`gte`:
 * + rval must be a number. And lval will be converted to number (`numericToNumber`) to compare.
 * `eq`:
 * + If same type, compare with `===`.
 * + If there is one number, convert to number (`numericToNumber`) to compare.
 * + Else return `false`.
 * `ne`:
 * + Not `eq`.
 *
 *
 * [SORT_COMPARISON_RULE]
 * All the values are grouped into three categories:
 * + "numeric" (number and numeric string)
 * + "non-numeric-string" (string that excluding numeric string)
 * + "others"
 * "numeric" vs "numeric": values are ordered by number order.
 * "non-numeric-string" vs "non-numeric-string": values are ordered by ES spec (#sec-abstract-relational-comparison).
 * "others" vs "others": do not change order (always return 0).
 * "numeric" vs "non-numeric-string": "non-numeric-string" is treated as "incomparable".
 * "number" vs "others": "others" is treated as "incomparable".
 * "non-numeric-string" vs "others": "others" is treated as "incomparable".
 * "incomparable" will be seen as -Infinity or Infinity (depends on the settings).
 * MEMO:
 *   Non-numeric string sort makes sense when we need to put the items with the same tag together.
 *   But if we support string sort, we still need to avoid the misleading like `'2' > '12'`,
 *   So we treat "numeric-string" sorted by number order rather than string comparison.
 *
 *
 * [CHECK_LIST_OF_THE_RULE_DESIGN]
 * + Do not support string comparison until required. And also need to
 *   avoid the misleading of "2" > "12".
 * + Should avoid the misleading case:
 *   `" 22 " gte "22"` is `true` but `" 22 " eq "22"` is `false`.
 * + JS bad case should be avoided: null <= 0, [] <= 0, ' ' <= 0, ...
 * + Only "numeric" can be converted to comparable number, otherwise converted to NaN.
 *   See `util/number.ts#numericToNumber`.
 *
 * @return If `op` is not `RelationalOperator`, return null;
 */
function createFilterComparator(op, rval) {
  return op === 'eq' || op === 'ne' ? new FilterEqualityComparator(op === 'eq', rval) : hasOwn(ORDER_COMPARISON_OP_MAP, op) ? new FilterOrderComparator(op, rval) : null;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * TODO: disable writable.
 * This structure will be exposed to users.
 */
var ExternalSource = /** @class */function () {
  function ExternalSource() {}
  ExternalSource.prototype.getRawData = function () {
    // Only built-in transform available.
    throw new Error('not supported');
  };
  ExternalSource.prototype.getRawDataItem = function (dataIndex) {
    // Only built-in transform available.
    throw new Error('not supported');
  };
  ExternalSource.prototype.cloneRawData = function () {
    return;
  };
  /**
   * @return If dimension not found, return null/undefined.
   */
  ExternalSource.prototype.getDimensionInfo = function (dim) {
    return;
  };
  /**
   * dimensions defined if and only if either:
   * (a) dataset.dimensions are declared.
   * (b) dataset data include dimensions definitions in data (detected or via specified `sourceHeader`).
   * If dimensions are defined, `dimensionInfoAll` is corresponding to
   * the defined dimensions.
   * Otherwise, `dimensionInfoAll` is determined by data columns.
   * @return Always return an array (even empty array).
   */
  ExternalSource.prototype.cloneAllDimensionInfo = function () {
    return;
  };
  ExternalSource.prototype.count = function () {
    return;
  };
  /**
   * Only support by dimension index.
   * No need to support by dimension name in transform function,
   * because transform function is not case-specific, no need to use name literally.
   */
  ExternalSource.prototype.retrieveValue = function (dataIndex, dimIndex) {
    return;
  };
  ExternalSource.prototype.retrieveValueFromItem = function (dataItem, dimIndex) {
    return;
  };
  ExternalSource.prototype.convertValue = function (rawVal, dimInfo) {
    return parseDataValue(rawVal, dimInfo);
  };
  return ExternalSource;
}();
function createExternalSource(internalSource, externalTransform) {
  var extSource = new ExternalSource();
  var data = internalSource.data;
  var sourceFormat = extSource.sourceFormat = internalSource.sourceFormat;
  var sourceHeaderCount = internalSource.startIndex;
  var errMsg = '';
  if (internalSource.seriesLayoutBy !== SERIES_LAYOUT_BY_COLUMN) {
    // For the logic simplicity in transformer, only 'culumn' is
    // supported in data transform. Otherwise, the `dimensionsDefine`
    // might be detected by 'row', which probably confuses users.
    {
      errMsg = '`seriesLayoutBy` of upstream dataset can only be "column" in data transform.';
    }
    throwError(errMsg);
  }
  // [MEMO]
  // Create a new dimensions structure for exposing.
  // Do not expose all dimension info to users directly.
  // Because the dimension is probably auto detected from data and not might reliable.
  // Should not lead the transformers to think that is reliable and return it.
  // See [DIMENSION_INHERIT_RULE] in `sourceManager.ts`.
  var dimensions = [];
  var dimsByName = {};
  var dimsDef = internalSource.dimensionsDefine;
  if (dimsDef) {
    each$f(dimsDef, function (dimDef, idx) {
      var name = dimDef.name;
      var dimDefExt = {
        index: idx,
        name: name,
        displayName: dimDef.displayName
      };
      dimensions.push(dimDefExt);
      // Users probably do not specify dimension name. For simplicity, data transform
      // does not generate dimension name.
      if (name != null) {
        // Dimension name should not be duplicated.
        // For simplicity, data transform forbids name duplication, do not generate
        // new name like module `completeDimensions.ts` did, but just tell users.
        var errMsg_1 = '';
        if (hasOwn(dimsByName, name)) {
          {
            errMsg_1 = 'dimension name "' + name + '" duplicated.';
          }
          throwError(errMsg_1);
        }
        dimsByName[name] = dimDefExt;
      }
    });
  }
  // If dimension definitions are not defined and can not be detected.
  // e.g., pure data `[[11, 22], ...]`.
  else {
    for (var i = 0; i < internalSource.dimensionsDetectedCount || 0; i++) {
      // Do not generete name or anything others. The consequence process in
      // `transform` or `series` probably have there own name generation strategry.
      dimensions.push({
        index: i
      });
    }
  }
  // Implement public methods:
  var rawItemGetter = getRawSourceItemGetter(sourceFormat, SERIES_LAYOUT_BY_COLUMN);
  if (externalTransform.__isBuiltIn) {
    extSource.getRawDataItem = function (dataIndex) {
      return rawItemGetter(data, sourceHeaderCount, dimensions, dataIndex);
    };
    extSource.getRawData = bind$1(getRawData, null, internalSource);
  }
  extSource.cloneRawData = bind$1(cloneRawData, null, internalSource);
  var rawCounter = getRawSourceDataCounter(sourceFormat, SERIES_LAYOUT_BY_COLUMN);
  extSource.count = bind$1(rawCounter, null, data, sourceHeaderCount, dimensions);
  var rawValueGetter = getRawSourceValueGetter(sourceFormat);
  extSource.retrieveValue = function (dataIndex, dimIndex) {
    var rawItem = rawItemGetter(data, sourceHeaderCount, dimensions, dataIndex);
    return retrieveValueFromItem(rawItem, dimIndex);
  };
  var retrieveValueFromItem = extSource.retrieveValueFromItem = function (dataItem, dimIndex) {
    if (dataItem == null) {
      return;
    }
    var dimDef = dimensions[dimIndex];
    // When `dimIndex` is `null`, `rawValueGetter` return the whole item.
    if (dimDef) {
      return rawValueGetter(dataItem, dimIndex, dimDef.name);
    }
  };
  extSource.getDimensionInfo = bind$1(getDimensionInfo, null, dimensions, dimsByName);
  extSource.cloneAllDimensionInfo = bind$1(cloneAllDimensionInfo, null, dimensions);
  return extSource;
}
function getRawData(upstream) {
  var sourceFormat = upstream.sourceFormat;
  if (!isSupportedSourceFormat(sourceFormat)) {
    var errMsg = '';
    {
      errMsg = '`getRawData` is not supported in source format ' + sourceFormat;
    }
    throwError(errMsg);
  }
  return upstream.data;
}
function cloneRawData(upstream) {
  var sourceFormat = upstream.sourceFormat;
  var data = upstream.data;
  if (!isSupportedSourceFormat(sourceFormat)) {
    var errMsg = '';
    {
      errMsg = '`cloneRawData` is not supported in source format ' + sourceFormat;
    }
    throwError(errMsg);
  }
  if (sourceFormat === SOURCE_FORMAT_ARRAY_ROWS) {
    var result = [];
    for (var i = 0, len = data.length; i < len; i++) {
      // Not strictly clone for performance
      result.push(data[i].slice());
    }
    return result;
  } else if (sourceFormat === SOURCE_FORMAT_OBJECT_ROWS) {
    var result = [];
    for (var i = 0, len = data.length; i < len; i++) {
      // Not strictly clone for performance
      result.push(extend({}, data[i]));
    }
    return result;
  }
}
function getDimensionInfo(dimensions, dimsByName, dim) {
  if (dim == null) {
    return;
  }
  // Keep the same logic as `List::getDimension` did.
  if (isNumber(dim)
  // If being a number-like string but not being defined a dimension name.
  || !isNaN(dim) && !hasOwn(dimsByName, dim)) {
    return dimensions[dim];
  } else if (hasOwn(dimsByName, dim)) {
    return dimsByName[dim];
  }
}
function cloneAllDimensionInfo(dimensions) {
  return clone$4(dimensions);
}
var externalTransformMap = createHashMap();
function registerExternalTransform(externalTransform) {
  externalTransform = clone$4(externalTransform);
  var type = externalTransform.type;
  var errMsg = '';
  if (!type) {
    {
      errMsg = 'Must have a `type` when `registerTransform`.';
    }
    throwError(errMsg);
  }
  var typeParsed = type.split(':');
  if (typeParsed.length !== 2) {
    {
      errMsg = 'Name must include namespace like "ns:regression".';
    }
    throwError(errMsg);
  }
  // Namespace 'echarts:xxx' is official namespace, where the transforms should
  // be called directly via 'xxx' rather than 'echarts:xxx'.
  var isBuiltIn = false;
  if (typeParsed[0] === 'echarts') {
    type = typeParsed[1];
    isBuiltIn = true;
  }
  externalTransform.__isBuiltIn = isBuiltIn;
  externalTransformMap.set(type, externalTransform);
}
function applyDataTransform(rawTransOption, sourceList, infoForPrint) {
  var pipedTransOption = normalizeToArray(rawTransOption);
  var pipeLen = pipedTransOption.length;
  var errMsg = '';
  if (!pipeLen) {
    {
      errMsg = 'If `transform` declared, it should at least contain one transform.';
    }
    throwError(errMsg);
  }
  for (var i = 0, len = pipeLen; i < len; i++) {
    var transOption = pipedTransOption[i];
    sourceList = applySingleDataTransform(transOption, sourceList, infoForPrint, pipeLen === 1 ? null : i);
    // piped transform only support single input, except the fist one.
    // piped transform only support single output, except the last one.
    if (i !== len - 1) {
      sourceList.length = Math.max(sourceList.length, 1);
    }
  }
  return sourceList;
}
function applySingleDataTransform(transOption, upSourceList, infoForPrint,
// If `pipeIndex` is null/undefined, no piped transform.
pipeIndex) {
  var errMsg = '';
  if (!upSourceList.length) {
    {
      errMsg = 'Must have at least one upstream dataset.';
    }
    throwError(errMsg);
  }
  if (!isObject$3(transOption)) {
    {
      errMsg = 'transform declaration must be an object rather than ' + typeof transOption + '.';
    }
    throwError(errMsg);
  }
  var transType = transOption.type;
  var externalTransform = externalTransformMap.get(transType);
  if (!externalTransform) {
    {
      errMsg = 'Can not find transform on type "' + transType + '".';
    }
    throwError(errMsg);
  }
  // Prepare source
  var extUpSourceList = map$1(upSourceList, function (upSource) {
    return createExternalSource(upSource, externalTransform);
  });
  var resultList = normalizeToArray(externalTransform.transform({
    upstream: extUpSourceList[0],
    upstreamList: extUpSourceList,
    config: clone$4(transOption.config)
  }));
  {
    if (transOption.print) {
      var printStrArr = map$1(resultList, function (extSource) {
        var pipeIndexStr = pipeIndex != null ? ' === pipe index: ' + pipeIndex : '';
        return ['=== dataset index: ' + infoForPrint.datasetIndex + pipeIndexStr + ' ===', '- transform result data:', makePrintable(extSource.data), '- transform result dimensions:', makePrintable(extSource.dimensions)].join('\n');
      }).join('\n');
      log$1(printStrArr);
    }
  }
  return map$1(resultList, function (result, resultIndex) {
    var errMsg = '';
    if (!isObject$3(result)) {
      {
        errMsg = 'A transform should not return some empty results.';
      }
      throwError(errMsg);
    }
    if (!result.data) {
      {
        errMsg = 'Transform result data should be not be null or undefined';
      }
      throwError(errMsg);
    }
    var sourceFormat = detectSourceFormat(result.data);
    if (!isSupportedSourceFormat(sourceFormat)) {
      {
        errMsg = 'Transform result data should be array rows or object rows.';
      }
      throwError(errMsg);
    }
    var resultMetaRawOption;
    var firstUpSource = upSourceList[0];
    /**
     * Intuitively, the end users known the content of the original `dataset.source`,
     * calucating the transform result in mind.
     * Suppose the original `dataset.source` is:
     * ```js
     * [
     *     ['product', '2012', '2013', '2014', '2015'],
     *     ['AAA', 41.1, 30.4, 65.1, 53.3],
     *     ['BBB', 86.5, 92.1, 85.7, 83.1],
     *     ['CCC', 24.1, 67.2, 79.5, 86.4]
     * ]
     * ```
     * The dimension info have to be detected from the source data.
     * Some of the transformers (like filter, sort) will follow the dimension info
     * of upstream, while others use new dimensions (like aggregate).
     * Transformer can output a field `dimensions` to define the its own output dimensions.
     * We also allow transformers to ignore the output `dimensions` field, and
     * inherit the upstream dimensions definition. It can reduce the burden of handling
     * dimensions in transformers.
     *
     * See also [DIMENSION_INHERIT_RULE] in `sourceManager.ts`.
     */
    if (firstUpSource && resultIndex === 0
    // If transformer returns `dimensions`, it means that the transformer has different
    // dimensions definitions. We do not inherit anything from upstream.
    && !result.dimensions) {
      var startIndex = firstUpSource.startIndex;
      // We copy the header of upstream to the result, because:
      // (1) The returned data always does not contain header line and can not be used
      // as dimension-detection. In this case we can not use "detected dimensions" of
      // upstream directly, because it might be detected based on different `seriesLayoutBy`.
      // (2) We should support that the series read the upstream source in `seriesLayoutBy: 'row'`.
      // So the original detected header should be add to the result, otherwise they can not be read.
      if (startIndex) {
        result.data = firstUpSource.data.slice(0, startIndex).concat(result.data);
      }
      resultMetaRawOption = {
        seriesLayoutBy: SERIES_LAYOUT_BY_COLUMN,
        sourceHeader: startIndex,
        dimensions: firstUpSource.metaRawOption.dimensions
      };
    } else {
      resultMetaRawOption = {
        seriesLayoutBy: SERIES_LAYOUT_BY_COLUMN,
        sourceHeader: 0,
        dimensions: result.dimensions
      };
    }
    return createSource(result.data, resultMetaRawOption, null);
  });
}
function isSupportedSourceFormat(sourceFormat) {
  return sourceFormat === SOURCE_FORMAT_ARRAY_ROWS || sourceFormat === SOURCE_FORMAT_OBJECT_ROWS;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var UNDEFINED = 'undefined';
/* global Float64Array, Int32Array, Uint32Array, Uint16Array */
// Caution: MUST not use `new CtorUint32Array(arr, 0, len)`, because the Ctor of array is
// different from the Ctor of typed array.
var CtorUint32Array = typeof Uint32Array === UNDEFINED ? Array : Uint32Array;
var CtorUint16Array = typeof Uint16Array === UNDEFINED ? Array : Uint16Array;
var CtorInt32Array$1 = typeof Int32Array === UNDEFINED ? Array : Int32Array;
var CtorFloat64Array = typeof Float64Array === UNDEFINED ? Array : Float64Array;
/**
 * Multi dimensional data store
 */
var dataCtors = {
  'float': CtorFloat64Array,
  'int': CtorInt32Array$1,
  // Ordinal data type can be string or int
  'ordinal': Array,
  'number': Array,
  'time': CtorFloat64Array
};
var defaultDimValueGetters;
function getIndicesCtor(rawCount) {
  // The possible max value in this._indicies is always this._rawCount despite of filtering.
  return rawCount > 65535 ? CtorUint32Array : CtorUint16Array;
}
function getInitialExtent() {
  return [Infinity, -Infinity];
}
function cloneChunk(originalChunk) {
  var Ctor = originalChunk.constructor;
  // Only shallow clone is enough when Array.
  return Ctor === Array ? originalChunk.slice() : new Ctor(originalChunk);
}
function prepareStore(store, dimIdx, dimType, end, append) {
  var DataCtor = dataCtors[dimType || 'float'];
  if (append) {
    var oldStore = store[dimIdx];
    var oldLen = oldStore && oldStore.length;
    if (!(oldLen === end)) {
      var newStore = new DataCtor(end);
      // The cost of the copy is probably inconsiderable
      // within the initial chunkSize.
      for (var j = 0; j < oldLen; j++) {
        newStore[j] = oldStore[j];
      }
      store[dimIdx] = newStore;
    }
  } else {
    store[dimIdx] = new DataCtor(end);
  }
}
/**
 * Basically, DataStore API keep immutable.
 */
var DataStore = /** @class */function () {
  function DataStore() {
    this._chunks = [];
    // It will not be calculated until needed.
    this._rawExtent = [];
    this._extent = [];
    this._count = 0;
    this._rawCount = 0;
    this._calcDimNameToIdx = createHashMap();
  }
  /**
   * Initialize from data
   */
  DataStore.prototype.initData = function (provider, inputDimensions, dimValueGetter) {
    {
      assert(isFunction(provider.getItem) && isFunction(provider.count), 'Invalid data provider.');
    }
    this._provider = provider;
    // Clear
    this._chunks = [];
    this._indices = null;
    this.getRawIndex = this._getRawIdxIdentity;
    var source = provider.getSource();
    var defaultGetter = this.defaultDimValueGetter = defaultDimValueGetters[source.sourceFormat];
    // Default dim value getter
    this._dimValueGetter = dimValueGetter || defaultGetter;
    // Reset raw extent.
    this._rawExtent = [];
    var willRetrieveDataByName = shouldRetrieveDataByName(source);
    this._dimensions = map$1(inputDimensions, function (dim) {
      {
        if (willRetrieveDataByName) {
          assert(dim.property != null);
        }
      }
      return {
        // Only pick these two props. Not leak other properties like orderMeta.
        type: dim.type,
        property: dim.property
      };
    });
    this._initDataFromProvider(0, provider.count());
  };
  DataStore.prototype.getProvider = function () {
    return this._provider;
  };
  /**
   * Caution: even when a `source` instance owned by a series, the created data store
   * may still be shared by different sereis (the source hash does not use all `source`
   * props, see `sourceManager`). In this case, the `source` props that are not used in
   * hash (like `source.dimensionDefine`) probably only belongs to a certain series and
   * thus should not be fetch here.
   */
  DataStore.prototype.getSource = function () {
    return this._provider.getSource();
  };
  /**
   * @caution Only used in dataStack.
   */
  DataStore.prototype.ensureCalculationDimension = function (dimName, type) {
    var calcDimNameToIdx = this._calcDimNameToIdx;
    var dimensions = this._dimensions;
    var calcDimIdx = calcDimNameToIdx.get(dimName);
    if (calcDimIdx != null) {
      if (dimensions[calcDimIdx].type === type) {
        return calcDimIdx;
      }
    } else {
      calcDimIdx = dimensions.length;
    }
    dimensions[calcDimIdx] = {
      type: type
    };
    calcDimNameToIdx.set(dimName, calcDimIdx);
    this._chunks[calcDimIdx] = new dataCtors[type || 'float'](this._rawCount);
    this._rawExtent[calcDimIdx] = getInitialExtent();
    return calcDimIdx;
  };
  DataStore.prototype.collectOrdinalMeta = function (dimIdx, ordinalMeta) {
    var chunk = this._chunks[dimIdx];
    var dim = this._dimensions[dimIdx];
    var rawExtents = this._rawExtent;
    var offset = dim.ordinalOffset || 0;
    var len = chunk.length;
    if (offset === 0) {
      // We need to reset the rawExtent if collect is from start.
      // Because this dimension may be guessed as number and calcuating a wrong extent.
      rawExtents[dimIdx] = getInitialExtent();
    }
    var dimRawExtent = rawExtents[dimIdx];
    // Parse from previous data offset. len may be changed after appendData
    for (var i = offset; i < len; i++) {
      var val = chunk[i] = ordinalMeta.parseAndCollect(chunk[i]);
      if (!isNaN(val)) {
        dimRawExtent[0] = Math.min(val, dimRawExtent[0]);
        dimRawExtent[1] = Math.max(val, dimRawExtent[1]);
      }
    }
    dim.ordinalMeta = ordinalMeta;
    dim.ordinalOffset = len;
    dim.type = 'ordinal'; // Force to be ordinal
  };
  DataStore.prototype.getOrdinalMeta = function (dimIdx) {
    var dimInfo = this._dimensions[dimIdx];
    var ordinalMeta = dimInfo.ordinalMeta;
    return ordinalMeta;
  };
  DataStore.prototype.getDimensionProperty = function (dimIndex) {
    var item = this._dimensions[dimIndex];
    return item && item.property;
  };
  /**
   * Caution: Can be only called on raw data (before `this._indices` created).
   */
  DataStore.prototype.appendData = function (data) {
    {
      assert(!this._indices, 'appendData can only be called on raw data.');
    }
    var provider = this._provider;
    var start = this.count();
    provider.appendData(data);
    var end = provider.count();
    if (!provider.persistent) {
      end += start;
    }
    if (start < end) {
      this._initDataFromProvider(start, end, true);
    }
    return [start, end];
  };
  DataStore.prototype.appendValues = function (values, minFillLen) {
    var chunks = this._chunks;
    var dimensions = this._dimensions;
    var dimLen = dimensions.length;
    var rawExtent = this._rawExtent;
    var start = this.count();
    var end = start + Math.max(values.length, minFillLen || 0);
    for (var i = 0; i < dimLen; i++) {
      var dim = dimensions[i];
      prepareStore(chunks, i, dim.type, end, true);
    }
    var emptyDataItem = [];
    for (var idx = start; idx < end; idx++) {
      var sourceIdx = idx - start;
      // Store the data by dimensions
      for (var dimIdx = 0; dimIdx < dimLen; dimIdx++) {
        var dim = dimensions[dimIdx];
        var val = defaultDimValueGetters.arrayRows.call(this, values[sourceIdx] || emptyDataItem, dim.property, sourceIdx, dimIdx);
        chunks[dimIdx][idx] = val;
        var dimRawExtent = rawExtent[dimIdx];
        val < dimRawExtent[0] && (dimRawExtent[0] = val);
        val > dimRawExtent[1] && (dimRawExtent[1] = val);
      }
    }
    this._rawCount = this._count = end;
    return {
      start: start,
      end: end
    };
  };
  DataStore.prototype._initDataFromProvider = function (start, end, append) {
    var provider = this._provider;
    var chunks = this._chunks;
    var dimensions = this._dimensions;
    var dimLen = dimensions.length;
    var rawExtent = this._rawExtent;
    var dimNames = map$1(dimensions, function (dim) {
      return dim.property;
    });
    for (var i = 0; i < dimLen; i++) {
      var dim = dimensions[i];
      if (!rawExtent[i]) {
        rawExtent[i] = getInitialExtent();
      }
      prepareStore(chunks, i, dim.type, end, append);
    }
    if (provider.fillStorage) {
      provider.fillStorage(start, end, chunks, rawExtent);
    } else {
      var dataItem = [];
      for (var idx = start; idx < end; idx++) {
        // NOTICE: Try not to write things into dataItem
        dataItem = provider.getItem(idx, dataItem);
        // Each data item is value
        // [1, 2]
        // 2
        // Bar chart, line chart which uses category axis
        // only gives the 'y' value. 'x' value is the indices of category
        // Use a tempValue to normalize the value to be a (x, y) value
        // Store the data by dimensions
        for (var dimIdx = 0; dimIdx < dimLen; dimIdx++) {
          var dimStorage = chunks[dimIdx];
          // PENDING NULL is empty or zero
          var val = this._dimValueGetter(dataItem, dimNames[dimIdx], idx, dimIdx);
          dimStorage[idx] = val;
          var dimRawExtent = rawExtent[dimIdx];
          val < dimRawExtent[0] && (dimRawExtent[0] = val);
          val > dimRawExtent[1] && (dimRawExtent[1] = val);
        }
      }
    }
    if (!provider.persistent && provider.clean) {
      // Clean unused data if data source is typed array.
      provider.clean();
    }
    this._rawCount = this._count = end;
    // Reset data extent
    this._extent = [];
  };
  DataStore.prototype.count = function () {
    return this._count;
  };
  /**
   * Get value. Return NaN if idx is out of range.
   */
  DataStore.prototype.get = function (dim, idx) {
    if (!(idx >= 0 && idx < this._count)) {
      return NaN;
    }
    var dimStore = this._chunks[dim];
    return dimStore ? dimStore[this.getRawIndex(idx)] : NaN;
  };
  DataStore.prototype.getValues = function (dimensions, idx) {
    var values = [];
    var dimArr = [];
    if (idx == null) {
      idx = dimensions;
      // TODO get all from store?
      dimensions = [];
      // All dimensions
      for (var i = 0; i < this._dimensions.length; i++) {
        dimArr.push(i);
      }
    } else {
      dimArr = dimensions;
    }
    for (var i = 0, len = dimArr.length; i < len; i++) {
      values.push(this.get(dimArr[i], idx));
    }
    return values;
  };
  /**
   * @param dim concrete dim
   */
  DataStore.prototype.getByRawIndex = function (dim, rawIdx) {
    if (!(rawIdx >= 0 && rawIdx < this._rawCount)) {
      return NaN;
    }
    var dimStore = this._chunks[dim];
    return dimStore ? dimStore[rawIdx] : NaN;
  };
  /**
   * Get sum of data in one dimension
   */
  DataStore.prototype.getSum = function (dim) {
    var dimData = this._chunks[dim];
    var sum = 0;
    if (dimData) {
      for (var i = 0, len = this.count(); i < len; i++) {
        var value = this.get(dim, i);
        if (!isNaN(value)) {
          sum += value;
        }
      }
    }
    return sum;
  };
  /**
   * Get median of data in one dimension
   */
  DataStore.prototype.getMedian = function (dim) {
    var dimDataArray = [];
    // map all data of one dimension
    this.each([dim], function (val) {
      if (!isNaN(val)) {
        dimDataArray.push(val);
      }
    });
    // TODO
    // Use quick select?
    var sortedDimDataArray = dimDataArray.sort(function (a, b) {
      return a - b;
    });
    var len = this.count();
    // calculate median
    return len === 0 ? 0 : len % 2 === 1 ? sortedDimDataArray[(len - 1) / 2] : (sortedDimDataArray[len / 2] + sortedDimDataArray[len / 2 - 1]) / 2;
  };
  /**
   * Retrieve the index with given raw data index.
   */
  DataStore.prototype.indexOfRawIndex = function (rawIndex) {
    if (rawIndex >= this._rawCount || rawIndex < 0) {
      return -1;
    }
    if (!this._indices) {
      return rawIndex;
    }
    // Indices are ascending
    var indices = this._indices;
    // If rawIndex === dataIndex
    var rawDataIndex = indices[rawIndex];
    if (rawDataIndex != null && rawDataIndex < this._count && rawDataIndex === rawIndex) {
      return rawIndex;
    }
    var left = 0;
    var right = this._count - 1;
    while (left <= right) {
      var mid = (left + right) / 2 | 0;
      if (indices[mid] < rawIndex) {
        left = mid + 1;
      } else if (indices[mid] > rawIndex) {
        right = mid - 1;
      } else {
        return mid;
      }
    }
    return -1;
  };
  /**
   * Retrieve the index of nearest value.
   * @param dim
   * @param value
   * @param [maxDistance=Infinity]
   * @return If and only if multiple indices have
   *         the same value, they are put to the result.
   */
  DataStore.prototype.indicesOfNearest = function (dim, value, maxDistance) {
    var chunks = this._chunks;
    var dimData = chunks[dim];
    var nearestIndices = [];
    if (!dimData) {
      return nearestIndices;
    }
    if (maxDistance == null) {
      maxDistance = Infinity;
    }
    var minDist = Infinity;
    var minDiff = -1;
    var nearestIndicesLen = 0;
    // Check the test case of `test/ut/spec/data/SeriesData.js`.
    for (var i = 0, len = this.count(); i < len; i++) {
      var dataIndex = this.getRawIndex(i);
      var diff = value - dimData[dataIndex];
      var dist = Math.abs(diff);
      if (dist <= maxDistance) {
        // When the `value` is at the middle of `this.get(dim, i)` and `this.get(dim, i+1)`,
        // we'd better not push both of them to `nearestIndices`, otherwise it is easy to
        // get more than one item in `nearestIndices` (more specifically, in `tooltip`).
        // So we choose the one that `diff >= 0` in this case.
        // But if `this.get(dim, i)` and `this.get(dim, j)` get the same value, both of them
        // should be push to `nearestIndices`.
        if (dist < minDist || dist === minDist && diff >= 0 && minDiff < 0) {
          minDist = dist;
          minDiff = diff;
          nearestIndicesLen = 0;
        }
        if (diff === minDiff) {
          nearestIndices[nearestIndicesLen++] = i;
        }
      }
    }
    nearestIndices.length = nearestIndicesLen;
    return nearestIndices;
  };
  DataStore.prototype.getIndices = function () {
    var newIndices;
    var indices = this._indices;
    if (indices) {
      var Ctor = indices.constructor;
      var thisCount = this._count;
      // `new Array(a, b, c)` is different from `new Uint32Array(a, b, c)`.
      if (Ctor === Array) {
        newIndices = new Ctor(thisCount);
        for (var i = 0; i < thisCount; i++) {
          newIndices[i] = indices[i];
        }
      } else {
        newIndices = new Ctor(indices.buffer, 0, thisCount);
      }
    } else {
      var Ctor = getIndicesCtor(this._rawCount);
      newIndices = new Ctor(this.count());
      for (var i = 0; i < newIndices.length; i++) {
        newIndices[i] = i;
      }
    }
    return newIndices;
  };
  /**
   * Data filter.
   */
  DataStore.prototype.filter = function (dims, cb) {
    if (!this._count) {
      return this;
    }
    var newStore = this.clone();
    var count = newStore.count();
    var Ctor = getIndicesCtor(newStore._rawCount);
    var newIndices = new Ctor(count);
    var value = [];
    var dimSize = dims.length;
    var offset = 0;
    var dim0 = dims[0];
    var chunks = newStore._chunks;
    for (var i = 0; i < count; i++) {
      var keep = void 0;
      var rawIdx = newStore.getRawIndex(i);
      // Simple optimization
      if (dimSize === 0) {
        keep = cb(i);
      } else if (dimSize === 1) {
        var val = chunks[dim0][rawIdx];
        keep = cb(val, i);
      } else {
        var k = 0;
        for (; k < dimSize; k++) {
          value[k] = chunks[dims[k]][rawIdx];
        }
        value[k] = i;
        keep = cb.apply(null, value);
      }
      if (keep) {
        newIndices[offset++] = rawIdx;
      }
    }
    // Set indices after filtered.
    if (offset < count) {
      newStore._indices = newIndices;
    }
    newStore._count = offset;
    // Reset data extent
    newStore._extent = [];
    newStore._updateGetRawIdx();
    return newStore;
  };
  /**
   * Select data in range. (For optimization of filter)
   * (Manually inline code, support 5 million data filtering in data zoom.)
   */
  DataStore.prototype.selectRange = function (range) {
    var newStore = this.clone();
    var len = newStore._count;
    if (!len) {
      return this;
    }
    var dims = keys(range);
    var dimSize = dims.length;
    if (!dimSize) {
      return this;
    }
    var originalCount = newStore.count();
    var Ctor = getIndicesCtor(newStore._rawCount);
    var newIndices = new Ctor(originalCount);
    var offset = 0;
    var dim0 = dims[0];
    var min = range[dim0][0];
    var max = range[dim0][1];
    var storeArr = newStore._chunks;
    var quickFinished = false;
    if (!newStore._indices) {
      // Extreme optimization for common case. About 2x faster in chrome.
      var idx = 0;
      if (dimSize === 1) {
        var dimStorage = storeArr[dims[0]];
        for (var i = 0; i < len; i++) {
          var val = dimStorage[i];
          // NaN will not be filtered. Consider the case, in line chart, empty
          // value indicates the line should be broken. But for the case like
          // scatter plot, a data item with empty value will not be rendered,
          // but the axis extent may be effected if some other dim of the data
          // item has value. Fortunately it is not a significant negative effect.
          if (val >= min && val <= max || isNaN(val)) {
            newIndices[offset++] = idx;
          }
          idx++;
        }
        quickFinished = true;
      } else if (dimSize === 2) {
        var dimStorage = storeArr[dims[0]];
        var dimStorage2 = storeArr[dims[1]];
        var min2 = range[dims[1]][0];
        var max2 = range[dims[1]][1];
        for (var i = 0; i < len; i++) {
          var val = dimStorage[i];
          var val2 = dimStorage2[i];
          // Do not filter NaN, see comment above.
          if ((val >= min && val <= max || isNaN(val)) && (val2 >= min2 && val2 <= max2 || isNaN(val2))) {
            newIndices[offset++] = idx;
          }
          idx++;
        }
        quickFinished = true;
      }
    }
    if (!quickFinished) {
      if (dimSize === 1) {
        for (var i = 0; i < originalCount; i++) {
          var rawIndex = newStore.getRawIndex(i);
          var val = storeArr[dims[0]][rawIndex];
          // Do not filter NaN, see comment above.
          if (val >= min && val <= max || isNaN(val)) {
            newIndices[offset++] = rawIndex;
          }
        }
      } else {
        for (var i = 0; i < originalCount; i++) {
          var keep = true;
          var rawIndex = newStore.getRawIndex(i);
          for (var k = 0; k < dimSize; k++) {
            var dimk = dims[k];
            var val = storeArr[dimk][rawIndex];
            // Do not filter NaN, see comment above.
            if (val < range[dimk][0] || val > range[dimk][1]) {
              keep = false;
            }
          }
          if (keep) {
            newIndices[offset++] = newStore.getRawIndex(i);
          }
        }
      }
    }
    // Set indices after filtered.
    if (offset < originalCount) {
      newStore._indices = newIndices;
    }
    newStore._count = offset;
    // Reset data extent
    newStore._extent = [];
    newStore._updateGetRawIdx();
    return newStore;
  };
  // /**
  //  * Data mapping to a plain array
  //  */
  // mapArray(dims: DimensionIndex[], cb: MapArrayCb): any[] {
  //     const result: any[] = [];
  //     this.each(dims, function () {
  //         result.push(cb && (cb as MapArrayCb).apply(null, arguments));
  //     });
  //     return result;
  // }
  /**
   * Data mapping to a new List with given dimensions
   */
  DataStore.prototype.map = function (dims, cb) {
    // TODO only clone picked chunks.
    var target = this.clone(dims);
    this._updateDims(target, dims, cb);
    return target;
  };
  /**
   * @caution Danger!! Only used in dataStack.
   */
  DataStore.prototype.modify = function (dims, cb) {
    this._updateDims(this, dims, cb);
  };
  DataStore.prototype._updateDims = function (target, dims, cb) {
    var targetChunks = target._chunks;
    var tmpRetValue = [];
    var dimSize = dims.length;
    var dataCount = target.count();
    var values = [];
    var rawExtent = target._rawExtent;
    for (var i = 0; i < dims.length; i++) {
      rawExtent[dims[i]] = getInitialExtent();
    }
    for (var dataIndex = 0; dataIndex < dataCount; dataIndex++) {
      var rawIndex = target.getRawIndex(dataIndex);
      for (var k = 0; k < dimSize; k++) {
        values[k] = targetChunks[dims[k]][rawIndex];
      }
      values[dimSize] = dataIndex;
      var retValue = cb && cb.apply(null, values);
      if (retValue != null) {
        // a number or string (in oridinal dimension)?
        if (typeof retValue !== 'object') {
          tmpRetValue[0] = retValue;
          retValue = tmpRetValue;
        }
        for (var i = 0; i < retValue.length; i++) {
          var dim = dims[i];
          var val = retValue[i];
          var rawExtentOnDim = rawExtent[dim];
          var dimStore = targetChunks[dim];
          if (dimStore) {
            dimStore[rawIndex] = val;
          }
          if (val < rawExtentOnDim[0]) {
            rawExtentOnDim[0] = val;
          }
          if (val > rawExtentOnDim[1]) {
            rawExtentOnDim[1] = val;
          }
        }
      }
    }
  };
  /**
   * Large data down sampling using largest-triangle-three-buckets
   * @param {string} valueDimension
   * @param {number} targetCount
   */
  DataStore.prototype.lttbDownSample = function (valueDimension, rate) {
    var target = this.clone([valueDimension], true);
    var targetStorage = target._chunks;
    var dimStore = targetStorage[valueDimension];
    var len = this.count();
    var sampledIndex = 0;
    var frameSize = Math.floor(1 / rate);
    var currentRawIndex = this.getRawIndex(0);
    var maxArea;
    var area;
    var nextRawIndex;
    var newIndices = new (getIndicesCtor(this._rawCount))(Math.min((Math.ceil(len / frameSize) + 2) * 2, len));
    // First frame use the first data.
    newIndices[sampledIndex++] = currentRawIndex;
    for (var i = 1; i < len - 1; i += frameSize) {
      var nextFrameStart = Math.min(i + frameSize, len - 1);
      var nextFrameEnd = Math.min(i + frameSize * 2, len);
      var avgX = (nextFrameEnd + nextFrameStart) / 2;
      var avgY = 0;
      for (var idx = nextFrameStart; idx < nextFrameEnd; idx++) {
        var rawIndex = this.getRawIndex(idx);
        var y = dimStore[rawIndex];
        if (isNaN(y)) {
          continue;
        }
        avgY += y;
      }
      avgY /= nextFrameEnd - nextFrameStart;
      var frameStart = i;
      var frameEnd = Math.min(i + frameSize, len);
      var pointAX = i - 1;
      var pointAY = dimStore[currentRawIndex];
      maxArea = -1;
      nextRawIndex = frameStart;
      var firstNaNIndex = -1;
      var countNaN = 0;
      // Find a point from current frame that construct a triangle with largest area with previous selected point
      // And the average of next frame.
      for (var idx = frameStart; idx < frameEnd; idx++) {
        var rawIndex = this.getRawIndex(idx);
        var y = dimStore[rawIndex];
        if (isNaN(y)) {
          countNaN++;
          if (firstNaNIndex < 0) {
            firstNaNIndex = rawIndex;
          }
          continue;
        }
        // Calculate triangle area over three buckets
        area = Math.abs((pointAX - avgX) * (y - pointAY) - (pointAX - idx) * (avgY - pointAY));
        if (area > maxArea) {
          maxArea = area;
          nextRawIndex = rawIndex; // Next a is this b
        }
      }
      if (countNaN > 0 && countNaN < frameEnd - frameStart) {
        // Append first NaN point in every bucket.
        // It is necessary to ensure the correct order of indices.
        newIndices[sampledIndex++] = Math.min(firstNaNIndex, nextRawIndex);
        nextRawIndex = Math.max(firstNaNIndex, nextRawIndex);
      }
      newIndices[sampledIndex++] = nextRawIndex;
      currentRawIndex = nextRawIndex; // This a is the next a (chosen b)
    }
    // First frame use the last data.
    newIndices[sampledIndex++] = this.getRawIndex(len - 1);
    target._count = sampledIndex;
    target._indices = newIndices;
    target.getRawIndex = this._getRawIdx;
    return target;
  };
  /**
   * Large data down sampling using min-max
   * @param {string} valueDimension
   * @param {number} rate
   */
  DataStore.prototype.minmaxDownSample = function (valueDimension, rate) {
    var target = this.clone([valueDimension], true);
    var targetStorage = target._chunks;
    var frameSize = Math.floor(1 / rate);
    var dimStore = targetStorage[valueDimension];
    var len = this.count();
    // Each frame results in 2 data points, one for min and one for max
    var newIndices = new (getIndicesCtor(this._rawCount))(Math.ceil(len / frameSize) * 2);
    var offset = 0;
    for (var i = 0; i < len; i += frameSize) {
      var minIndex = i;
      var minValue = dimStore[this.getRawIndex(minIndex)];
      var maxIndex = i;
      var maxValue = dimStore[this.getRawIndex(maxIndex)];
      var thisFrameSize = frameSize;
      // Handle final smaller frame
      if (i + frameSize > len) {
        thisFrameSize = len - i;
      }
      // Determine min and max within the current frame
      for (var k = 0; k < thisFrameSize; k++) {
        var rawIndex = this.getRawIndex(i + k);
        var value = dimStore[rawIndex];
        if (value < minValue) {
          minValue = value;
          minIndex = i + k;
        }
        if (value > maxValue) {
          maxValue = value;
          maxIndex = i + k;
        }
      }
      var rawMinIndex = this.getRawIndex(minIndex);
      var rawMaxIndex = this.getRawIndex(maxIndex);
      // Set the order of the min and max values, based on their ordering in the frame
      if (minIndex < maxIndex) {
        newIndices[offset++] = rawMinIndex;
        newIndices[offset++] = rawMaxIndex;
      } else {
        newIndices[offset++] = rawMaxIndex;
        newIndices[offset++] = rawMinIndex;
      }
    }
    target._count = offset;
    target._indices = newIndices;
    target._updateGetRawIdx();
    return target;
  };
  /**
   * Large data down sampling on given dimension
   * @param sampleIndex Sample index for name and id
   */
  DataStore.prototype.downSample = function (dimension, rate, sampleValue, sampleIndex) {
    var target = this.clone([dimension], true);
    var targetStorage = target._chunks;
    var frameValues = [];
    var frameSize = Math.floor(1 / rate);
    var dimStore = targetStorage[dimension];
    var len = this.count();
    var rawExtentOnDim = target._rawExtent[dimension] = getInitialExtent();
    var newIndices = new (getIndicesCtor(this._rawCount))(Math.ceil(len / frameSize));
    var offset = 0;
    for (var i = 0; i < len; i += frameSize) {
      // Last frame
      if (frameSize > len - i) {
        frameSize = len - i;
        frameValues.length = frameSize;
      }
      for (var k = 0; k < frameSize; k++) {
        var dataIdx = this.getRawIndex(i + k);
        frameValues[k] = dimStore[dataIdx];
      }
      var value = sampleValue(frameValues);
      var sampleFrameIdx = this.getRawIndex(Math.min(i + sampleIndex(frameValues, value) || 0, len - 1));
      // Only write value on the filtered data
      dimStore[sampleFrameIdx] = value;
      if (value < rawExtentOnDim[0]) {
        rawExtentOnDim[0] = value;
      }
      if (value > rawExtentOnDim[1]) {
        rawExtentOnDim[1] = value;
      }
      newIndices[offset++] = sampleFrameIdx;
    }
    target._count = offset;
    target._indices = newIndices;
    target._updateGetRawIdx();
    return target;
  };
  /**
   * Data iteration
   * @param ctx default this
   * @example
   *  list.each('x', function (x, idx) {});
   *  list.each(['x', 'y'], function (x, y, idx) {});
   *  list.each(function (idx) {})
   */
  DataStore.prototype.each = function (dims, cb) {
    if (!this._count) {
      return;
    }
    var dimSize = dims.length;
    var chunks = this._chunks;
    for (var i = 0, len = this.count(); i < len; i++) {
      var rawIdx = this.getRawIndex(i);
      // Simple optimization
      switch (dimSize) {
        case 0:
          cb(i);
          break;
        case 1:
          cb(chunks[dims[0]][rawIdx], i);
          break;
        case 2:
          cb(chunks[dims[0]][rawIdx], chunks[dims[1]][rawIdx], i);
          break;
        default:
          var k = 0;
          var value = [];
          for (; k < dimSize; k++) {
            value[k] = chunks[dims[k]][rawIdx];
          }
          // Index
          value[k] = i;
          cb.apply(null, value);
      }
    }
  };
  /**
   * Get extent of data in one dimension
   */
  DataStore.prototype.getDataExtent = function (dim) {
    // Make sure use concrete dim as cache name.
    var dimData = this._chunks[dim];
    var initialExtent = getInitialExtent();
    if (!dimData) {
      return initialExtent;
    }
    // Make more strict checkings to ensure hitting cache.
    var currEnd = this.count();
    // Consider the most cases when using data zoom, `getDataExtent`
    // happened before filtering. We cache raw extent, which is not
    // necessary to be cleared and recalculated when restore data.
    var useRaw = !this._indices;
    var dimExtent;
    if (useRaw) {
      return this._rawExtent[dim].slice();
    }
    dimExtent = this._extent[dim];
    if (dimExtent) {
      return dimExtent.slice();
    }
    dimExtent = initialExtent;
    var min = dimExtent[0];
    var max = dimExtent[1];
    for (var i = 0; i < currEnd; i++) {
      var rawIdx = this.getRawIndex(i);
      var value = dimData[rawIdx];
      value < min && (min = value);
      value > max && (max = value);
    }
    dimExtent = [min, max];
    this._extent[dim] = dimExtent;
    return dimExtent;
  };
  /**
   * Get raw data item
   */
  DataStore.prototype.getRawDataItem = function (idx) {
    var rawIdx = this.getRawIndex(idx);
    if (!this._provider.persistent) {
      var val = [];
      var chunks = this._chunks;
      for (var i = 0; i < chunks.length; i++) {
        val.push(chunks[i][rawIdx]);
      }
      return val;
    } else {
      return this._provider.getItem(rawIdx);
    }
  };
  /**
   * Clone shallow.
   *
   * @param clonedDims Determine which dims to clone. Will share the data if not specified.
   */
  DataStore.prototype.clone = function (clonedDims, ignoreIndices) {
    var target = new DataStore();
    var chunks = this._chunks;
    var clonedDimsMap = clonedDims && reduce(clonedDims, function (obj, dimIdx) {
      obj[dimIdx] = true;
      return obj;
    }, {});
    if (clonedDimsMap) {
      for (var i = 0; i < chunks.length; i++) {
        // Not clone if dim is not picked.
        target._chunks[i] = !clonedDimsMap[i] ? chunks[i] : cloneChunk(chunks[i]);
      }
    } else {
      target._chunks = chunks;
    }
    this._copyCommonProps(target);
    if (!ignoreIndices) {
      target._indices = this._cloneIndices();
    }
    target._updateGetRawIdx();
    return target;
  };
  DataStore.prototype._copyCommonProps = function (target) {
    target._count = this._count;
    target._rawCount = this._rawCount;
    target._provider = this._provider;
    target._dimensions = this._dimensions;
    target._extent = clone$4(this._extent);
    target._rawExtent = clone$4(this._rawExtent);
  };
  DataStore.prototype._cloneIndices = function () {
    if (this._indices) {
      var Ctor = this._indices.constructor;
      var indices = void 0;
      if (Ctor === Array) {
        var thisCount = this._indices.length;
        indices = new Ctor(thisCount);
        for (var i = 0; i < thisCount; i++) {
          indices[i] = this._indices[i];
        }
      } else {
        indices = new Ctor(this._indices);
      }
      return indices;
    }
    return null;
  };
  DataStore.prototype._getRawIdxIdentity = function (idx) {
    return idx;
  };
  DataStore.prototype._getRawIdx = function (idx) {
    if (idx < this._count && idx >= 0) {
      return this._indices[idx];
    }
    return -1;
  };
  DataStore.prototype._updateGetRawIdx = function () {
    this.getRawIndex = this._indices ? this._getRawIdx : this._getRawIdxIdentity;
  };
  DataStore.internalField = function () {
    function getDimValueSimply(dataItem, property, dataIndex, dimIndex) {
      return parseDataValue(dataItem[dimIndex], this._dimensions[dimIndex]);
    }
    defaultDimValueGetters = {
      arrayRows: getDimValueSimply,
      objectRows: function (dataItem, property, dataIndex, dimIndex) {
        return parseDataValue(dataItem[property], this._dimensions[dimIndex]);
      },
      keyedColumns: getDimValueSimply,
      original: function (dataItem, property, dataIndex, dimIndex) {
        // Performance sensitive, do not use modelUtil.getDataItemValue.
        // If dataItem is an plain object with no value field, the let `value`
        // will be assigned with the object, but it will be tread correctly
        // in the `convertValue`.
        var value = dataItem && (dataItem.value == null ? dataItem : dataItem.value);
        return parseDataValue(value instanceof Array ? value[dimIndex]
        // If value is a single number or something else not array.
        : value, this._dimensions[dimIndex]);
      },
      typedArray: function (dataItem, property, dataIndex, dimIndex) {
        return dataItem[dimIndex];
      }
    };
  }();
  return DataStore;
}();

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * [REQUIREMENT_MEMO]:
 * (0) `metaRawOption` means `dimensions`/`sourceHeader`/`seriesLayoutBy` in raw option.
 * (1) Keep support the feature: `metaRawOption` can be specified both on `series` and
 * `root-dataset`. Them on `series` has higher priority.
 * (2) Do not support to set `metaRawOption` on a `non-root-dataset`, because it might
 * confuse users: whether those props indicate how to visit the upstream source or visit
 * the transform result source, and some transforms has nothing to do with these props,
 * and some transforms might have multiple upstream.
 * (3) Transforms should specify `metaRawOption` in each output, just like they can be
 * declared in `root-dataset`.
 * (4) At present only support visit source in `SERIES_LAYOUT_BY_COLUMN` in transforms.
 * That is for reducing complexity in transforms.
 * PENDING: Whether to provide transposition transform?
 *
 * [IMPLEMENTAION_MEMO]:
 * "sourceVisitConfig" are calculated from `metaRawOption` and `data`.
 * They will not be calculated until `source` is about to be visited (to prevent from
 * duplicate calcuation). `source` is visited only in series and input to transforms.
 *
 * [DIMENSION_INHERIT_RULE]:
 * By default the dimensions are inherited from ancestors, unless a transform return
 * a new dimensions definition.
 * Consider the case:
 * ```js
 * dataset: [{
 *     source: [ ['Product', 'Sales', 'Prise'], ['Cookies', 321, 44.21], ...]
 * }, {
 *     transform: { type: 'filter', ... }
 * }]
 * dataset: [{
 *     dimension: ['Product', 'Sales', 'Prise'],
 *     source: [ ['Cookies', 321, 44.21], ...]
 * }, {
 *     transform: { type: 'filter', ... }
 * }]
 * ```
 * The two types of option should have the same behavior after transform.
 *
 *
 * [SCENARIO]:
 * (1) Provide source data directly:
 * ```js
 * series: {
 *     encode: {...},
 *     dimensions: [...]
 *     seriesLayoutBy: 'row',
 *     data: [[...]]
 * }
 * ```
 * (2) Series refer to dataset.
 * ```js
 * series: [{
 *     encode: {...}
 *     // Ignore datasetIndex means `datasetIndex: 0`
 *     // and the dimensions defination in dataset is used
 * }, {
 *     encode: {...},
 *     seriesLayoutBy: 'column',
 *     datasetIndex: 1
 * }]
 * ```
 * (3) dataset transform
 * ```js
 * dataset: [{
 *     source: [...]
 * }, {
 *     source: [...]
 * }, {
 *     // By default from 0.
 *     transform: { type: 'filter', config: {...} }
 * }, {
 *     // Piped.
 *     transform: [
 *         { type: 'filter', config: {...} },
 *         { type: 'sort', config: {...} }
 *     ]
 * }, {
 *     id: 'regressionData',
 *     fromDatasetIndex: 1,
 *     // Third-party transform
 *     transform: { type: 'ecStat:regression', config: {...} }
 * }, {
 *     // retrieve the extra result.
 *     id: 'regressionFormula',
 *     fromDatasetId: 'regressionData',
 *     fromTransformResult: 1
 * }]
 * ```
 */
var SourceManager = /** @class */function () {
  function SourceManager(sourceHost) {
    // Cached source. Do not repeat calculating if not dirty.
    this._sourceList = [];
    this._storeList = [];
    // version sign of each upstream source manager.
    this._upstreamSignList = [];
    this._versionSignBase = 0;
    this._dirty = true;
    this._sourceHost = sourceHost;
  }
  /**
   * Mark dirty.
   */
  SourceManager.prototype.dirty = function () {
    this._setLocalSource([], []);
    this._storeList = [];
    this._dirty = true;
  };
  SourceManager.prototype._setLocalSource = function (sourceList, upstreamSignList) {
    this._sourceList = sourceList;
    this._upstreamSignList = upstreamSignList;
    this._versionSignBase++;
    if (this._versionSignBase > 9e10) {
      this._versionSignBase = 0;
    }
  };
  /**
   * For detecting whether the upstream source is dirty, so that
   * the local cached source (in `_sourceList`) should be discarded.
   */
  SourceManager.prototype._getVersionSign = function () {
    return this._sourceHost.uid + '_' + this._versionSignBase;
  };
  /**
   * Always return a source instance. Otherwise throw error.
   */
  SourceManager.prototype.prepareSource = function () {
    // For the case that call `setOption` multiple time but no data changed,
    // cache the result source to prevent from repeating transform.
    if (this._isDirty()) {
      this._createSource();
      this._dirty = false;
    }
  };
  SourceManager.prototype._createSource = function () {
    this._setLocalSource([], []);
    var sourceHost = this._sourceHost;
    var upSourceMgrList = this._getUpstreamSourceManagers();
    var hasUpstream = !!upSourceMgrList.length;
    var resultSourceList;
    var upstreamSignList;
    if (isSeries(sourceHost)) {
      var seriesModel = sourceHost;
      var data = void 0;
      var sourceFormat = void 0;
      var upSource = void 0;
      // Has upstream dataset
      if (hasUpstream) {
        var upSourceMgr = upSourceMgrList[0];
        upSourceMgr.prepareSource();
        upSource = upSourceMgr.getSource();
        data = upSource.data;
        sourceFormat = upSource.sourceFormat;
        upstreamSignList = [upSourceMgr._getVersionSign()];
      }
      // Series data is from own.
      else {
        data = seriesModel.get('data', true);
        sourceFormat = isTypedArray$1(data) ? SOURCE_FORMAT_TYPED_ARRAY : SOURCE_FORMAT_ORIGINAL;
        upstreamSignList = [];
      }
      // See [REQUIREMENT_MEMO], merge settings on series and parent dataset if it is root.
      var newMetaRawOption = this._getSourceMetaRawOption() || {};
      var upMetaRawOption = upSource && upSource.metaRawOption || {};
      var seriesLayoutBy = retrieve2(newMetaRawOption.seriesLayoutBy, upMetaRawOption.seriesLayoutBy) || null;
      var sourceHeader = retrieve2(newMetaRawOption.sourceHeader, upMetaRawOption.sourceHeader);
      // Note here we should not use `upSource.dimensionsDefine`. Consider the case:
      // `upSource.dimensionsDefine` is detected by `seriesLayoutBy: 'column'`,
      // but series need `seriesLayoutBy: 'row'`.
      var dimensions = retrieve2(newMetaRawOption.dimensions, upMetaRawOption.dimensions);
      // We share source with dataset as much as possible
      // to avoid extra memory cost of high dimensional data.
      var needsCreateSource = seriesLayoutBy !== upMetaRawOption.seriesLayoutBy || !!sourceHeader !== !!upMetaRawOption.sourceHeader || dimensions;
      resultSourceList = needsCreateSource ? [createSource(data, {
        seriesLayoutBy: seriesLayoutBy,
        sourceHeader: sourceHeader,
        dimensions: dimensions
      }, sourceFormat)] : [];
    } else {
      var datasetModel = sourceHost;
      // Has upstream dataset.
      if (hasUpstream) {
        var result = this._applyTransform(upSourceMgrList);
        resultSourceList = result.sourceList;
        upstreamSignList = result.upstreamSignList;
      }
      // Is root dataset.
      else {
        var sourceData = datasetModel.get('source', true);
        resultSourceList = [createSource(sourceData, this._getSourceMetaRawOption(), null)];
        upstreamSignList = [];
      }
    }
    {
      assert(resultSourceList && upstreamSignList);
    }
    this._setLocalSource(resultSourceList, upstreamSignList);
  };
  SourceManager.prototype._applyTransform = function (upMgrList) {
    var datasetModel = this._sourceHost;
    var transformOption = datasetModel.get('transform', true);
    var fromTransformResult = datasetModel.get('fromTransformResult', true);
    {
      assert(fromTransformResult != null || transformOption != null);
    }
    if (fromTransformResult != null) {
      var errMsg = '';
      if (upMgrList.length !== 1) {
        {
          errMsg = 'When using `fromTransformResult`, there should be only one upstream dataset';
        }
        doThrow(errMsg);
      }
    }
    var sourceList;
    var upSourceList = [];
    var upstreamSignList = [];
    each$f(upMgrList, function (upMgr) {
      upMgr.prepareSource();
      var upSource = upMgr.getSource(fromTransformResult || 0);
      var errMsg = '';
      if (fromTransformResult != null && !upSource) {
        {
          errMsg = 'Can not retrieve result by `fromTransformResult`: ' + fromTransformResult;
        }
        doThrow(errMsg);
      }
      upSourceList.push(upSource);
      upstreamSignList.push(upMgr._getVersionSign());
    });
    if (transformOption) {
      sourceList = applyDataTransform(transformOption, upSourceList, {
        datasetIndex: datasetModel.componentIndex
      });
    } else if (fromTransformResult != null) {
      sourceList = [cloneSourceShallow(upSourceList[0])];
    }
    return {
      sourceList: sourceList,
      upstreamSignList: upstreamSignList
    };
  };
  SourceManager.prototype._isDirty = function () {
    if (this._dirty) {
      return true;
    }
    // All sourceList is from the some upstream.
    var upSourceMgrList = this._getUpstreamSourceManagers();
    for (var i = 0; i < upSourceMgrList.length; i++) {
      var upSrcMgr = upSourceMgrList[i];
      if (
      // Consider the case that there is ancestor diry, call it recursively.
      // The performance is probably not an issue because usually the chain is not long.
      upSrcMgr._isDirty() || this._upstreamSignList[i] !== upSrcMgr._getVersionSign()) {
        return true;
      }
    }
  };
  /**
   * @param sourceIndex By default 0, means "main source".
   *                    In most cases there is only one source.
   */
  SourceManager.prototype.getSource = function (sourceIndex) {
    sourceIndex = sourceIndex || 0;
    var source = this._sourceList[sourceIndex];
    if (!source) {
      // Series may share source instance with dataset.
      var upSourceMgrList = this._getUpstreamSourceManagers();
      return upSourceMgrList[0] && upSourceMgrList[0].getSource(sourceIndex);
    }
    return source;
  };
  /**
   *
   * Get a data store which can be shared across series.
   * Only available for series.
   *
   * @param seriesDimRequest Dimensions that are generated in series.
   *        Should have been sorted by `storeDimIndex` asc.
   */
  SourceManager.prototype.getSharedDataStore = function (seriesDimRequest) {
    {
      assert(isSeries(this._sourceHost), 'Can only call getDataStore on series source manager.');
    }
    var schema = seriesDimRequest.makeStoreSchema();
    return this._innerGetDataStore(schema.dimensions, seriesDimRequest.source, schema.hash);
  };
  SourceManager.prototype._innerGetDataStore = function (storeDims, seriesSource, sourceReadKey) {
    // TODO Can use other sourceIndex?
    var sourceIndex = 0;
    var storeList = this._storeList;
    var cachedStoreMap = storeList[sourceIndex];
    if (!cachedStoreMap) {
      cachedStoreMap = storeList[sourceIndex] = {};
    }
    var cachedStore = cachedStoreMap[sourceReadKey];
    if (!cachedStore) {
      var upSourceMgr = this._getUpstreamSourceManagers()[0];
      if (isSeries(this._sourceHost) && upSourceMgr) {
        cachedStore = upSourceMgr._innerGetDataStore(storeDims, seriesSource, sourceReadKey);
      } else {
        cachedStore = new DataStore();
        // Always create store from source of series.
        cachedStore.initData(new DefaultDataProvider(seriesSource, storeDims.length), storeDims);
      }
      cachedStoreMap[sourceReadKey] = cachedStore;
    }
    return cachedStore;
  };
  /**
   * PENDING: Is it fast enough?
   * If no upstream, return empty array.
   */
  SourceManager.prototype._getUpstreamSourceManagers = function () {
    // Always get the relationship from the raw option.
    // Do not cache the link of the dependency graph, so that
    // there is no need to update them when change happens.
    var sourceHost = this._sourceHost;
    if (isSeries(sourceHost)) {
      var datasetModel = querySeriesUpstreamDatasetModel(sourceHost);
      return !datasetModel ? [] : [datasetModel.getSourceManager()];
    } else {
      return map$1(queryDatasetUpstreamDatasetModels(sourceHost), function (datasetModel) {
        return datasetModel.getSourceManager();
      });
    }
  };
  SourceManager.prototype._getSourceMetaRawOption = function () {
    var sourceHost = this._sourceHost;
    var seriesLayoutBy;
    var sourceHeader;
    var dimensions;
    if (isSeries(sourceHost)) {
      seriesLayoutBy = sourceHost.get('seriesLayoutBy', true);
      sourceHeader = sourceHost.get('sourceHeader', true);
      dimensions = sourceHost.get('dimensions', true);
    }
    // See [REQUIREMENT_MEMO], `non-root-dataset` do not support them.
    else if (!this._getUpstreamSourceManagers().length) {
      var model = sourceHost;
      seriesLayoutBy = model.get('seriesLayoutBy', true);
      sourceHeader = model.get('sourceHeader', true);
      dimensions = model.get('dimensions', true);
    }
    return {
      seriesLayoutBy: seriesLayoutBy,
      sourceHeader: sourceHeader,
      dimensions: dimensions
    };
  };
  return SourceManager;
}();
// Call this method after `super.init` and `super.mergeOption` to
// disable the transform merge, but do not disable transform clone from rawOption.
function disableTransformOptionMerge(datasetModel) {
  var transformOption = datasetModel.option.transform;
  transformOption && setAsPrimitive(datasetModel.option.transform);
}
function isSeries(sourceHost) {
  // Avoid circular dependency with Series.ts
  return sourceHost.mainType === 'series';
}
function doThrow(errMsg) {
  throw new Error(errMsg);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TOOLTIP_LINE_HEIGHT_CSS = 'line-height:1';
function getTooltipLineHeight(textStyle) {
  var lineHeight = textStyle.lineHeight;
  if (lineHeight == null) {
    return TOOLTIP_LINE_HEIGHT_CSS;
  } else {
    return "line-height:" + encodeHTML(lineHeight + '') + "px";
  }
}
// TODO: more textStyle option
function getTooltipTextStyle(textStyle, renderMode) {
  var nameFontColor = textStyle.color || '#6e7079';
  var nameFontSize = textStyle.fontSize || 12;
  var nameFontWeight = textStyle.fontWeight || '400';
  var valueFontColor = textStyle.color || '#464646';
  var valueFontSize = textStyle.fontSize || 14;
  var valueFontWeight = textStyle.fontWeight || '900';
  if (renderMode === 'html') {
    // `textStyle` is probably from user input, should be encoded to reduce security risk.
    return {
      // eslint-disable-next-line max-len
      nameStyle: "font-size:" + encodeHTML(nameFontSize + '') + "px;color:" + encodeHTML(nameFontColor) + ";font-weight:" + encodeHTML(nameFontWeight + ''),
      // eslint-disable-next-line max-len
      valueStyle: "font-size:" + encodeHTML(valueFontSize + '') + "px;color:" + encodeHTML(valueFontColor) + ";font-weight:" + encodeHTML(valueFontWeight + '')
    };
  } else {
    return {
      nameStyle: {
        fontSize: nameFontSize,
        fill: nameFontColor,
        fontWeight: nameFontWeight
      },
      valueStyle: {
        fontSize: valueFontSize,
        fill: valueFontColor,
        fontWeight: valueFontWeight
      }
    };
  }
}
// See `TooltipMarkupLayoutIntent['innerGapLevel']`.
// (value from UI design)
var HTML_GAPS = [0, 10, 20, 30];
var RICH_TEXT_GAPS = ['', '\n', '\n\n', '\n\n\n'];
// eslint-disable-next-line max-len
function createTooltipMarkup(type, option) {
  option.type = type;
  return option;
}
function isSectionFragment(frag) {
  return frag.type === 'section';
}
function getBuilder(frag) {
  return isSectionFragment(frag) ? buildSection : buildNameValue;
}
function getBlockGapLevel(frag) {
  if (isSectionFragment(frag)) {
    var gapLevel_1 = 0;
    var subBlockLen = frag.blocks.length;
    var hasInnerGap_1 = subBlockLen > 1 || subBlockLen > 0 && !frag.noHeader;
    each$f(frag.blocks, function (subBlock) {
      var subGapLevel = getBlockGapLevel(subBlock);
      // If the some of the sub-blocks have some gaps (like 10px) inside, this block
      // should use a larger gap (like 20px) to distinguish those sub-blocks.
      if (subGapLevel >= gapLevel_1) {
        gapLevel_1 = subGapLevel + +(hasInnerGap_1 && (
        // 0 always can not be readable gap level.
        !subGapLevel
        // If no header, always keep the sub gap level. Otherwise
        // look weird in case `multipleSeries`.
        || isSectionFragment(subBlock) && !subBlock.noHeader));
      }
    });
    return gapLevel_1;
  }
  return 0;
}
function buildSection(ctx, fragment, topMarginForOuterGap, toolTipTextStyle) {
  var noHeader = fragment.noHeader;
  var gaps = getGap(getBlockGapLevel(fragment));
  var subMarkupTextList = [];
  var subBlocks = fragment.blocks || [];
  assert(!subBlocks || isArray$1(subBlocks));
  subBlocks = subBlocks || [];
  var orderMode = ctx.orderMode;
  if (fragment.sortBlocks && orderMode) {
    subBlocks = subBlocks.slice();
    var orderMap = {
      valueAsc: 'asc',
      valueDesc: 'desc'
    };
    if (hasOwn(orderMap, orderMode)) {
      var comparator_1 = new SortOrderComparator(orderMap[orderMode], null);
      subBlocks.sort(function (a, b) {
        return comparator_1.evaluate(a.sortParam, b.sortParam);
      });
    }
    // FIXME 'seriesDesc' necessary?
    else if (orderMode === 'seriesDesc') {
      subBlocks.reverse();
    }
  }
  each$f(subBlocks, function (subBlock, idx) {
    var valueFormatter = fragment.valueFormatter;
    var subMarkupText = getBuilder(subBlock)(
    // Inherit valueFormatter
    valueFormatter ? extend(extend({}, ctx), {
      valueFormatter: valueFormatter
    }) : ctx, subBlock, idx > 0 ? gaps.html : 0, toolTipTextStyle);
    subMarkupText != null && subMarkupTextList.push(subMarkupText);
  });
  var subMarkupText = ctx.renderMode === 'richText' ? subMarkupTextList.join(gaps.richText) : wrapBlockHTML(toolTipTextStyle, subMarkupTextList.join(''), noHeader ? topMarginForOuterGap : gaps.html);
  if (noHeader) {
    return subMarkupText;
  }
  var displayableHeader = makeValueReadable(fragment.header, 'ordinal', ctx.useUTC);
  var nameStyle = getTooltipTextStyle(toolTipTextStyle, ctx.renderMode).nameStyle;
  var tooltipLineHeight = getTooltipLineHeight(toolTipTextStyle);
  if (ctx.renderMode === 'richText') {
    return wrapInlineNameRichText(ctx, displayableHeader, nameStyle) + gaps.richText + subMarkupText;
  } else {
    return wrapBlockHTML(toolTipTextStyle, "<div style=\"" + nameStyle + ";" + tooltipLineHeight + ";\">" + encodeHTML(displayableHeader) + '</div>' + subMarkupText, topMarginForOuterGap);
  }
}
function buildNameValue(ctx, fragment, topMarginForOuterGap, toolTipTextStyle) {
  var renderMode = ctx.renderMode;
  var noName = fragment.noName;
  var noValue = fragment.noValue;
  var noMarker = !fragment.markerType;
  var name = fragment.name;
  var useUTC = ctx.useUTC;
  var valueFormatter = fragment.valueFormatter || ctx.valueFormatter || function (value) {
    value = isArray$1(value) ? value : [value];
    return map$1(value, function (val, idx) {
      return makeValueReadable(val, isArray$1(valueTypeOption) ? valueTypeOption[idx] : valueTypeOption, useUTC);
    });
  };
  if (noName && noValue) {
    return;
  }
  var markerStr = noMarker ? '' : ctx.markupStyleCreator.makeTooltipMarker(fragment.markerType, fragment.markerColor || '#333', renderMode);
  var readableName = noName ? '' : makeValueReadable(name, 'ordinal', useUTC);
  var valueTypeOption = fragment.valueType;
  var readableValueList = noValue ? [] : valueFormatter(fragment.value, fragment.dataIndex);
  var valueAlignRight = !noMarker || !noName;
  // It little weird if only value next to marker but far from marker.
  var valueCloseToMarker = !noMarker && noName;
  var _a = getTooltipTextStyle(toolTipTextStyle, renderMode),
    nameStyle = _a.nameStyle,
    valueStyle = _a.valueStyle;
  return renderMode === 'richText' ? (noMarker ? '' : markerStr) + (noName ? '' : wrapInlineNameRichText(ctx, readableName, nameStyle))
  // Value has commas inside, so use ' ' as delimiter for multiple values.
  + (noValue ? '' : wrapInlineValueRichText(ctx, readableValueList, valueAlignRight, valueCloseToMarker, valueStyle)) : wrapBlockHTML(toolTipTextStyle, (noMarker ? '' : markerStr) + (noName ? '' : wrapInlineNameHTML(readableName, !noMarker, nameStyle)) + (noValue ? '' : wrapInlineValueHTML(readableValueList, valueAlignRight, valueCloseToMarker, valueStyle)), topMarginForOuterGap);
}
/**
 * @return markupText. null/undefined means no content.
 */
function buildTooltipMarkup(fragment, markupStyleCreator, renderMode, orderMode, useUTC, toolTipTextStyle) {
  if (!fragment) {
    return;
  }
  var builder = getBuilder(fragment);
  var ctx = {
    useUTC: useUTC,
    renderMode: renderMode,
    orderMode: orderMode,
    markupStyleCreator: markupStyleCreator,
    valueFormatter: fragment.valueFormatter
  };
  return builder(ctx, fragment, 0, toolTipTextStyle);
}
function getGap(gapLevel) {
  return {
    html: HTML_GAPS[gapLevel],
    richText: RICH_TEXT_GAPS[gapLevel]
  };
}
function wrapBlockHTML(textStyle, encodedContent, topGap) {
  var clearfix = '<div style="clear:both"></div>';
  var marginCSS = "margin: " + topGap + "px 0 0";
  var tooltipLineHeight = getTooltipLineHeight(textStyle);
  return "<div style=\"" + marginCSS + ";" + tooltipLineHeight + ";\">" + encodedContent + clearfix + '</div>';
}
function wrapInlineNameHTML(name, leftHasMarker, style) {
  var marginCss = leftHasMarker ? 'margin-left:2px' : '';
  return "<span style=\"" + style + ";" + marginCss + "\">" + encodeHTML(name) + '</span>';
}
function wrapInlineValueHTML(valueList, alignRight, valueCloseToMarker, style) {
  // Do not too close to marker, considering there are multiple values separated by spaces.
  var paddingStr = valueCloseToMarker ? '10px' : '20px';
  var alignCSS = alignRight ? "float:right;margin-left:" + paddingStr : '';
  valueList = isArray$1(valueList) ? valueList : [valueList];
  return "<span style=\"" + alignCSS + ";" + style + "\">"
  // Value has commas inside, so use '  ' as delimiter for multiple values.
  + map$1(valueList, function (value) {
    return encodeHTML(value);
  }).join('&nbsp;&nbsp;') + '</span>';
}
function wrapInlineNameRichText(ctx, name, style) {
  return ctx.markupStyleCreator.wrapRichTextStyle(name, style);
}
function wrapInlineValueRichText(ctx, values, alignRight, valueCloseToMarker, style) {
  var styles = [style];
  var paddingLeft = valueCloseToMarker ? 10 : 20;
  alignRight && styles.push({
    padding: [0, 0, 0, paddingLeft],
    align: 'right'
  });
  // Value has commas inside, so use '  ' as delimiter for multiple values.
  return ctx.markupStyleCreator.wrapRichTextStyle(isArray$1(values) ? values.join('  ') : values, styles);
}
function retrieveVisualColorForTooltipMarker(series, dataIndex) {
  var style = series.getData().getItemVisual(dataIndex, 'style');
  var color = style[series.visualDrawType];
  return convertToColorString(color);
}
function getPaddingFromTooltipModel(model, renderMode) {
  var padding = model.get('padding');
  return padding != null ? padding
  // We give slightly different to look pretty.
  : renderMode === 'richText' ? [8, 10] : 10;
}
/**
 * The major feature is generate styles for `renderMode: 'richText'`.
 * But it also serves `renderMode: 'html'` to provide
 * "renderMode-independent" API.
 */
var TooltipMarkupStyleCreator = /** @class */function () {
  function TooltipMarkupStyleCreator() {
    this.richTextStyles = {};
    // Notice that "generate a style name" usually happens repeatedly when mouse is moving and
    // a tooltip is displayed. So we put the `_nextStyleNameId` as a member of each creator
    // rather than static shared by all creators (which will cause it increase to fast).
    this._nextStyleNameId = getRandomIdBase();
  }
  TooltipMarkupStyleCreator.prototype._generateStyleName = function () {
    return '__EC_aUTo_' + this._nextStyleNameId++;
  };
  TooltipMarkupStyleCreator.prototype.makeTooltipMarker = function (markerType, colorStr, renderMode) {
    var markerId = renderMode === 'richText' ? this._generateStyleName() : null;
    var marker = getTooltipMarker({
      color: colorStr,
      type: markerType,
      renderMode: renderMode,
      markerId: markerId
    });
    if (isString(marker)) {
      return marker;
    } else {
      {
        assert(markerId);
      }
      this.richTextStyles[markerId] = marker.style;
      return marker.content;
    }
  };
  /**
   * @usage
   * ```ts
   * const styledText = markupStyleCreator.wrapRichTextStyle([
   *     // The styles will be auto merged.
   *     {
   *         fontSize: 12,
   *         color: 'blue'
   *     },
   *     {
   *         padding: 20
   *     }
   * ]);
   * ```
   */
  TooltipMarkupStyleCreator.prototype.wrapRichTextStyle = function (text, styles) {
    var finalStl = {};
    if (isArray$1(styles)) {
      each$f(styles, function (stl) {
        return extend(finalStl, stl);
      });
    } else {
      extend(finalStl, styles);
    }
    var styleName = this._generateStyleName();
    this.richTextStyles[styleName] = finalStl;
    return "{" + styleName + "|" + text + "}";
  };
  return TooltipMarkupStyleCreator;
}();

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function defaultSeriesFormatTooltip(opt) {
  var series = opt.series;
  var dataIndex = opt.dataIndex;
  var multipleSeries = opt.multipleSeries;
  var data = series.getData();
  var tooltipDims = data.mapDimensionsAll('defaultedTooltip');
  var tooltipDimLen = tooltipDims.length;
  var value = series.getRawValue(dataIndex);
  var isValueArr = isArray$1(value);
  var markerColor = retrieveVisualColorForTooltipMarker(series, dataIndex);
  // Complicated rule for pretty tooltip.
  var inlineValue;
  var inlineValueType;
  var subBlocks;
  var sortParam;
  if (tooltipDimLen > 1 || isValueArr && !tooltipDimLen) {
    var formatArrResult = formatTooltipArrayValue(value, series, dataIndex, tooltipDims, markerColor);
    inlineValue = formatArrResult.inlineValues;
    inlineValueType = formatArrResult.inlineValueTypes;
    subBlocks = formatArrResult.blocks;
    // Only support tooltip sort by the first inline value. It's enough in most cases.
    sortParam = formatArrResult.inlineValues[0];
  } else if (tooltipDimLen) {
    var dimInfo = data.getDimensionInfo(tooltipDims[0]);
    sortParam = inlineValue = retrieveRawValue(data, dataIndex, tooltipDims[0]);
    inlineValueType = dimInfo.type;
  } else {
    sortParam = inlineValue = isValueArr ? value[0] : value;
  }
  // Do not show generated series name. It might not be readable.
  var seriesNameSpecified = isNameSpecified(series);
  var seriesName = seriesNameSpecified && series.name || '';
  var itemName = data.getName(dataIndex);
  var inlineName = multipleSeries ? seriesName : itemName;
  return createTooltipMarkup('section', {
    header: seriesName,
    // When series name is not specified, do not show a header line with only '-'.
    // This case always happens in tooltip.trigger: 'item'.
    noHeader: multipleSeries || !seriesNameSpecified,
    sortParam: sortParam,
    blocks: [createTooltipMarkup('nameValue', {
      markerType: 'item',
      markerColor: markerColor,
      // Do not mix display seriesName and itemName in one tooltip,
      // which might confuses users.
      name: inlineName,
      // name dimension might be auto assigned, where the name might
      // be not readable. So we check trim here.
      noName: !trim$1(inlineName),
      value: inlineValue,
      valueType: inlineValueType,
      dataIndex: dataIndex
    })].concat(subBlocks || [])
  });
}
function formatTooltipArrayValue(value, series, dataIndex, tooltipDims, colorStr) {
  // check: category-no-encode-has-axis-data in dataset.html
  var data = series.getData();
  var isValueMultipleLine = reduce(value, function (isValueMultipleLine, val, idx) {
    var dimItem = data.getDimensionInfo(idx);
    return isValueMultipleLine = isValueMultipleLine || dimItem && dimItem.tooltip !== false && dimItem.displayName != null;
  }, false);
  var inlineValues = [];
  var inlineValueTypes = [];
  var blocks = [];
  tooltipDims.length ? each$f(tooltipDims, function (dim) {
    setEachItem(retrieveRawValue(data, dataIndex, dim), dim);
  })
  // By default, all dims is used on tooltip.
  : each$f(value, setEachItem);
  function setEachItem(val, dim) {
    var dimInfo = data.getDimensionInfo(dim);
    // If `dimInfo.tooltip` is not set, show tooltip.
    if (!dimInfo || dimInfo.otherDims.tooltip === false) {
      return;
    }
    if (isValueMultipleLine) {
      blocks.push(createTooltipMarkup('nameValue', {
        markerType: 'subItem',
        markerColor: colorStr,
        name: dimInfo.displayName,
        value: val,
        valueType: dimInfo.type
      }));
    } else {
      inlineValues.push(val);
      inlineValueTypes.push(dimInfo.type);
    }
  }
  return {
    inlineValues: inlineValues,
    inlineValueTypes: inlineValueTypes,
    blocks: blocks
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$k = makeInner();
function getSelectionKey(data, dataIndex) {
  return data.getName(dataIndex) || data.getId(dataIndex);
}
var SERIES_UNIVERSAL_TRANSITION_PROP = '__universalTransitionEnabled';
var SeriesModel = /** @class */function (_super) {
  __extends(SeriesModel, _super);
  function SeriesModel() {
    // [Caution]: Because this class or desecendants can be used as `XXX.extend(subProto)`,
    // the class members must not be initialized in constructor or declaration place.
    // Otherwise there is bad case:
    //   class A {xxx = 1;}
    //   enableClassExtend(A);
    //   class B extends A {}
    //   var C = B.extend({xxx: 5});
    //   var c = new C();
    //   console.log(c.xxx); // expect 5 but always 1.
    var _this = _super !== null && _super.apply(this, arguments) || this;
    // ---------------------------------------
    // Props about data selection
    // ---------------------------------------
    _this._selectedDataIndicesMap = {};
    return _this;
  }
  SeriesModel.prototype.init = function (option, parentModel, ecModel) {
    this.seriesIndex = this.componentIndex;
    this.dataTask = createTask({
      count: dataTaskCount,
      reset: dataTaskReset
    });
    this.dataTask.context = {
      model: this
    };
    this.mergeDefaultAndTheme(option, ecModel);
    var sourceManager = inner$k(this).sourceManager = new SourceManager(this);
    sourceManager.prepareSource();
    var data = this.getInitialData(option, ecModel);
    wrapData(data, this);
    this.dataTask.context.data = data;
    {
      assert(data, 'getInitialData returned invalid data.');
    }
    inner$k(this).dataBeforeProcessed = data;
    // If we reverse the order (make data firstly, and then make
    // dataBeforeProcessed by cloneShallow), cloneShallow will
    // cause data.graph.data !== data when using
    // module:echarts/data/Graph or module:echarts/data/Tree.
    // See module:echarts/data/helper/linkSeriesData
    // Theoretically, it is unreasonable to call `seriesModel.getData()` in the model
    // init or merge stage, because the data can be restored. So we do not `restoreData`
    // and `setData` here, which forbids calling `seriesModel.getData()` in this stage.
    // Call `seriesModel.getRawData()` instead.
    // this.restoreData();
    autoSeriesName(this);
    this._initSelectedMapFromData(data);
  };
  /**
   * Util for merge default and theme to option
   */
  SeriesModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {
    var layoutMode = fetchLayoutMode(this);
    var inputPositionParams = layoutMode ? getLayoutParams(option) : {};
    // Backward compat: using subType on theme.
    // But if name duplicate between series subType
    // (for example: parallel) add component mainType,
    // add suffix 'Series'.
    var themeSubType = this.subType;
    if (ComponentModel$1.hasClass(themeSubType)) {
      themeSubType += 'Series';
    }
    merge(option, ecModel.getTheme().get(this.subType));
    merge(option, this.getDefaultOption());
    // Default label emphasis `show`
    defaultEmphasis(option, 'label', ['show']);
    this.fillDataTextStyle(option.data);
    if (layoutMode) {
      mergeLayoutParam(option, inputPositionParams, layoutMode);
    }
  };
  SeriesModel.prototype.mergeOption = function (newSeriesOption, ecModel) {
    // this.settingTask.dirty();
    newSeriesOption = merge(this.option, newSeriesOption, true);
    this.fillDataTextStyle(newSeriesOption.data);
    var layoutMode = fetchLayoutMode(this);
    if (layoutMode) {
      mergeLayoutParam(this.option, newSeriesOption, layoutMode);
    }
    var sourceManager = inner$k(this).sourceManager;
    sourceManager.dirty();
    sourceManager.prepareSource();
    var data = this.getInitialData(newSeriesOption, ecModel);
    wrapData(data, this);
    this.dataTask.dirty();
    this.dataTask.context.data = data;
    inner$k(this).dataBeforeProcessed = data;
    autoSeriesName(this);
    this._initSelectedMapFromData(data);
  };
  SeriesModel.prototype.fillDataTextStyle = function (data) {
    // Default data label emphasis `show`
    // FIXME Tree structure data ?
    // FIXME Performance ?
    if (data && !isTypedArray$1(data)) {
      var props = ['show'];
      for (var i = 0; i < data.length; i++) {
        if (data[i] && data[i].label) {
          defaultEmphasis(data[i], 'label', props);
        }
      }
    }
  };
  /**
   * Init a data structure from data related option in series
   * Must be overridden.
   */
  SeriesModel.prototype.getInitialData = function (option, ecModel) {
    return;
  };
  /**
   * Append data to list
   */
  SeriesModel.prototype.appendData = function (params) {
    // FIXME ???
    // (1) If data from dataset, forbidden append.
    // (2) support append data of dataset.
    var data = this.getRawData();
    data.appendData(params.data);
  };
  /**
   * Consider some method like `filter`, `map` need make new data,
   * We should make sure that `seriesModel.getData()` get correct
   * data in the stream procedure. So we fetch data from upstream
   * each time `task.perform` called.
   */
  SeriesModel.prototype.getData = function (dataType) {
    var task = getCurrentTask(this);
    if (task) {
      var data = task.context.data;
      return dataType == null || !data.getLinkedData ? data : data.getLinkedData(dataType);
    } else {
      // When series is not alive (that may happen when click toolbox
      // restore or setOption with not merge mode), series data may
      // be still need to judge animation or something when graphic
      // elements want to know whether fade out.
      return inner$k(this).data;
    }
  };
  SeriesModel.prototype.getAllData = function () {
    var mainData = this.getData();
    return mainData && mainData.getLinkedDataAll ? mainData.getLinkedDataAll() : [{
      data: mainData
    }];
  };
  SeriesModel.prototype.setData = function (data) {
    var task = getCurrentTask(this);
    if (task) {
      var context = task.context;
      // Consider case: filter, data sample.
      // FIXME:TS never used, so comment it
      // if (context.data !== data && task.modifyOutputEnd) {
      //     task.setOutputEnd(data.count());
      // }
      context.outputData = data;
      // Caution: setData should update context.data,
      // Because getData may be called multiply in a
      // single stage and expect to get the data just
      // set. (For example, AxisProxy, x y both call
      // getData and setDate sequentially).
      // So the context.data should be fetched from
      // upstream each time when a stage starts to be
      // performed.
      if (task !== this.dataTask) {
        context.data = data;
      }
    }
    inner$k(this).data = data;
  };
  SeriesModel.prototype.getEncode = function () {
    var encode = this.get('encode', true);
    if (encode) {
      return createHashMap(encode);
    }
  };
  SeriesModel.prototype.getSourceManager = function () {
    return inner$k(this).sourceManager;
  };
  SeriesModel.prototype.getSource = function () {
    return this.getSourceManager().getSource();
  };
  /**
   * Get data before processed
   */
  SeriesModel.prototype.getRawData = function () {
    return inner$k(this).dataBeforeProcessed;
  };
  SeriesModel.prototype.getColorBy = function () {
    var colorBy = this.get('colorBy');
    return colorBy || 'series';
  };
  SeriesModel.prototype.isColorBySeries = function () {
    return this.getColorBy() === 'series';
  };
  /**
   * Get base axis if has coordinate system and has axis.
   * By default use coordSys.getBaseAxis();
   * Can be overridden for some chart.
   * @return {type} description
   */
  SeriesModel.prototype.getBaseAxis = function () {
    var coordSys = this.coordinateSystem;
    // @ts-ignore
    return coordSys && coordSys.getBaseAxis && coordSys.getBaseAxis();
  };
  /**
   * Default tooltip formatter
   *
   * @param dataIndex
   * @param multipleSeries
   * @param dataType
   * @param renderMode valid values: 'html'(by default) and 'richText'.
   *        'html' is used for rendering tooltip in extra DOM form, and the result
   *        string is used as DOM HTML content.
   *        'richText' is used for rendering tooltip in rich text form, for those where
   *        DOM operation is not supported.
   * @return formatted tooltip with `html` and `markers`
   *        Notice: The override method can also return string
   */
  SeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    return defaultSeriesFormatTooltip({
      series: this,
      dataIndex: dataIndex,
      multipleSeries: multipleSeries
    });
  };
  SeriesModel.prototype.isAnimationEnabled = function () {
    var ecModel = this.ecModel;
    // Disable animation if using echarts in node but not give ssr flag.
    // In ssr mode, renderToString will generate svg with css animation.
    if (env$1.node && !(ecModel && ecModel.ssr)) {
      return false;
    }
    var animationEnabled = this.getShallow('animation');
    if (animationEnabled) {
      if (this.getData().count() > this.getShallow('animationThreshold')) {
        animationEnabled = false;
      }
    }
    return !!animationEnabled;
  };
  SeriesModel.prototype.restoreData = function () {
    this.dataTask.dirty();
  };
  SeriesModel.prototype.getColorFromPalette = function (name, scope, requestColorNum) {
    var ecModel = this.ecModel;
    // PENDING
    var color = PaletteMixin.prototype.getColorFromPalette.call(this, name, scope, requestColorNum);
    if (!color) {
      color = ecModel.getColorFromPalette(name, scope, requestColorNum);
    }
    return color;
  };
  /**
   * Use `data.mapDimensionsAll(coordDim)` instead.
   * @deprecated
   */
  SeriesModel.prototype.coordDimToDataDim = function (coordDim) {
    return this.getRawData().mapDimensionsAll(coordDim);
  };
  /**
   * Get progressive rendering count each step
   */
  SeriesModel.prototype.getProgressive = function () {
    return this.get('progressive');
  };
  /**
   * Get progressive rendering count each step
   */
  SeriesModel.prototype.getProgressiveThreshold = function () {
    return this.get('progressiveThreshold');
  };
  // PENGING If selectedMode is null ?
  SeriesModel.prototype.select = function (innerDataIndices, dataType) {
    this._innerSelect(this.getData(dataType), innerDataIndices);
  };
  SeriesModel.prototype.unselect = function (innerDataIndices, dataType) {
    var selectedMap = this.option.selectedMap;
    if (!selectedMap) {
      return;
    }
    var selectedMode = this.option.selectedMode;
    var data = this.getData(dataType);
    if (selectedMode === 'series' || selectedMap === 'all') {
      this.option.selectedMap = {};
      this._selectedDataIndicesMap = {};
      return;
    }
    for (var i = 0; i < innerDataIndices.length; i++) {
      var dataIndex = innerDataIndices[i];
      var nameOrId = getSelectionKey(data, dataIndex);
      selectedMap[nameOrId] = false;
      this._selectedDataIndicesMap[nameOrId] = -1;
    }
  };
  SeriesModel.prototype.toggleSelect = function (innerDataIndices, dataType) {
    var tmpArr = [];
    for (var i = 0; i < innerDataIndices.length; i++) {
      tmpArr[0] = innerDataIndices[i];
      this.isSelected(innerDataIndices[i], dataType) ? this.unselect(tmpArr, dataType) : this.select(tmpArr, dataType);
    }
  };
  SeriesModel.prototype.getSelectedDataIndices = function () {
    if (this.option.selectedMap === 'all') {
      return [].slice.call(this.getData().getIndices());
    }
    var selectedDataIndicesMap = this._selectedDataIndicesMap;
    var nameOrIds = keys(selectedDataIndicesMap);
    var dataIndices = [];
    for (var i = 0; i < nameOrIds.length; i++) {
      var dataIndex = selectedDataIndicesMap[nameOrIds[i]];
      if (dataIndex >= 0) {
        dataIndices.push(dataIndex);
      }
    }
    return dataIndices;
  };
  SeriesModel.prototype.isSelected = function (dataIndex, dataType) {
    var selectedMap = this.option.selectedMap;
    if (!selectedMap) {
      return false;
    }
    var data = this.getData(dataType);
    return (selectedMap === 'all' || selectedMap[getSelectionKey(data, dataIndex)]) && !data.getItemModel(dataIndex).get(['select', 'disabled']);
  };
  SeriesModel.prototype.isUniversalTransitionEnabled = function () {
    if (this[SERIES_UNIVERSAL_TRANSITION_PROP]) {
      return true;
    }
    var universalTransitionOpt = this.option.universalTransition;
    // Quick reject
    if (!universalTransitionOpt) {
      return false;
    }
    if (universalTransitionOpt === true) {
      return true;
    }
    // Can be simply 'universalTransition: true'
    return universalTransitionOpt && universalTransitionOpt.enabled;
  };
  SeriesModel.prototype._innerSelect = function (data, innerDataIndices) {
    var _a, _b;
    var option = this.option;
    var selectedMode = option.selectedMode;
    var len = innerDataIndices.length;
    if (!selectedMode || !len) {
      return;
    }
    if (selectedMode === 'series') {
      option.selectedMap = 'all';
    } else if (selectedMode === 'multiple') {
      if (!isObject$3(option.selectedMap)) {
        option.selectedMap = {};
      }
      var selectedMap = option.selectedMap;
      for (var i = 0; i < len; i++) {
        var dataIndex = innerDataIndices[i];
        // TODO different types of data share same object.
        var nameOrId = getSelectionKey(data, dataIndex);
        selectedMap[nameOrId] = true;
        this._selectedDataIndicesMap[nameOrId] = data.getRawIndex(dataIndex);
      }
    } else if (selectedMode === 'single' || selectedMode === true) {
      var lastDataIndex = innerDataIndices[len - 1];
      var nameOrId = getSelectionKey(data, lastDataIndex);
      option.selectedMap = (_a = {}, _a[nameOrId] = true, _a);
      this._selectedDataIndicesMap = (_b = {}, _b[nameOrId] = data.getRawIndex(lastDataIndex), _b);
    }
  };
  SeriesModel.prototype._initSelectedMapFromData = function (data) {
    // Ignore select info in data if selectedMap exists.
    // NOTE It's only for legacy usage. edge data is not supported.
    if (this.option.selectedMap) {
      return;
    }
    var dataIndices = [];
    if (data.hasItemOption) {
      data.each(function (idx) {
        var rawItem = data.getRawDataItem(idx);
        if (rawItem && rawItem.selected) {
          dataIndices.push(idx);
        }
      });
    }
    if (dataIndices.length > 0) {
      this._innerSelect(data, dataIndices);
    }
  };
  // /**
  //  * @see {module:echarts/stream/Scheduler}
  //  */
  // abstract pipeTask: null
  SeriesModel.registerClass = function (clz) {
    return ComponentModel$1.registerClass(clz);
  };
  SeriesModel.protoInitialize = function () {
    var proto = SeriesModel.prototype;
    proto.type = 'series.__base__';
    proto.seriesIndex = 0;
    proto.ignoreStyleOnData = false;
    proto.hasSymbolVisual = false;
    proto.defaultSymbol = 'circle';
    // Make sure the values can be accessed!
    proto.visualStyleAccessPath = 'itemStyle';
    proto.visualDrawType = 'fill';
  }();
  return SeriesModel;
}(ComponentModel$1);
mixin(SeriesModel, DataFormatMixin);
mixin(SeriesModel, PaletteMixin);
mountExtend(SeriesModel, ComponentModel$1);
/**
 * MUST be called after `prepareSource` called
 * Here we need to make auto series, especially for auto legend. But we
 * do not modify series.name in option to avoid side effects.
 */
function autoSeriesName(seriesModel) {
  // User specified name has higher priority, otherwise it may cause
  // series can not be queried unexpectedly.
  var name = seriesModel.name;
  if (!isNameSpecified(seriesModel)) {
    seriesModel.name = getSeriesAutoName(seriesModel) || name;
  }
}
function getSeriesAutoName(seriesModel) {
  var data = seriesModel.getRawData();
  var dataDims = data.mapDimensionsAll('seriesName');
  var nameArr = [];
  each$f(dataDims, function (dataDim) {
    var dimInfo = data.getDimensionInfo(dataDim);
    dimInfo.displayName && nameArr.push(dimInfo.displayName);
  });
  return nameArr.join(' ');
}
function dataTaskCount(context) {
  return context.model.getRawData().count();
}
function dataTaskReset(context) {
  var seriesModel = context.model;
  seriesModel.setData(seriesModel.getRawData().cloneShallow());
  return dataTaskProgress;
}
function dataTaskProgress(param, context) {
  // Avoid repeat cloneShallow when data just created in reset.
  if (context.outputData && param.end > context.outputData.count()) {
    context.model.getRawData().cloneShallow(context.outputData);
  }
}
// TODO refactor
function wrapData(data, seriesModel) {
  each$f(concatArray(data.CHANGABLE_METHODS, data.DOWNSAMPLE_METHODS), function (methodName) {
    data.wrapMethod(methodName, curry$1(onDataChange, seriesModel));
  });
}
function onDataChange(seriesModel, newList) {
  var task = getCurrentTask(seriesModel);
  if (task) {
    // Consider case: filter, selectRange
    task.setOutputEnd((newList || this).count());
  }
  return newList;
}
function getCurrentTask(seriesModel) {
  var scheduler = (seriesModel.ecModel || {}).scheduler;
  var pipeline = scheduler && scheduler.getPipeline(seriesModel.uid);
  if (pipeline) {
    // When pipline finished, the currrentTask keep the last
    // task (renderTask).
    var task = pipeline.currentTask;
    if (task) {
      var agentStubMap = task.agentStubMap;
      if (agentStubMap) {
        task = agentStubMap.get(seriesModel.uid);
      }
    }
    return task;
  }
}
var SeriesModel$1 = SeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ComponentView = /** @class */function () {
  function ComponentView() {
    this.group = new Group$5();
    this.uid = getUID('viewComponent');
  }
  ComponentView.prototype.init = function (ecModel, api) {};
  ComponentView.prototype.render = function (model, ecModel, api, payload) {};
  ComponentView.prototype.dispose = function (ecModel, api) {};
  ComponentView.prototype.updateView = function (model, ecModel, api, payload) {
    // Do nothing;
  };
  ComponentView.prototype.updateLayout = function (model, ecModel, api, payload) {
    // Do nothing;
  };
  ComponentView.prototype.updateVisual = function (model, ecModel, api, payload) {
    // Do nothing;
  };
  /**
   * Hook for toggle blur target series.
   * Can be used in marker for blur or leave blur the markers
   */
  ComponentView.prototype.toggleBlurSeries = function (seriesModels, isBlur, ecModel) {
    // Do nothing;
  };
  /**
   * Traverse the new rendered elements.
   *
   * It will traverse the new added element in progressive rendering.
   * And traverse all in normal rendering.
   */
  ComponentView.prototype.eachRendered = function (cb) {
    var group = this.group;
    if (group) {
      group.traverse(cb);
    }
  };
  return ComponentView;
}();
enableClassExtend(ComponentView);
enableClassManagement(ComponentView);
var ComponentView$1 = ComponentView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * @return {string} If large mode changed, return string 'reset';
 */
function createRenderPlanner() {
  var inner = makeInner();
  return function (seriesModel) {
    var fields = inner(seriesModel);
    var pipelineContext = seriesModel.pipelineContext;
    var originalLarge = !!fields.large;
    var originalProgressive = !!fields.progressiveRender;
    // FIXME: if the planner works on a filtered series, `pipelineContext` does not
    // exists. See #11611 . Probably we need to modify this structure, see the comment
    // on `performRawSeries` in `Schedular.js`.
    var large = fields.large = !!(pipelineContext && pipelineContext.large);
    var progressive = fields.progressiveRender = !!(pipelineContext && pipelineContext.progressiveRender);
    return !!(originalLarge !== large || originalProgressive !== progressive) && 'reset';
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$j = makeInner();
var renderPlanner = createRenderPlanner();
var ChartView = /** @class */function () {
  function ChartView() {
    this.group = new Group$5();
    this.uid = getUID('viewChart');
    this.renderTask = createTask({
      plan: renderTaskPlan,
      reset: renderTaskReset
    });
    this.renderTask.context = {
      view: this
    };
  }
  ChartView.prototype.init = function (ecModel, api) {};
  ChartView.prototype.render = function (seriesModel, ecModel, api, payload) {
    {
      throw new Error('render method must been implemented');
    }
  };
  /**
   * Highlight series or specified data item.
   */
  ChartView.prototype.highlight = function (seriesModel, ecModel, api, payload) {
    var data = seriesModel.getData(payload && payload.dataType);
    if (!data) {
      {
        error("Unknown dataType " + payload.dataType);
      }
      return;
    }
    toggleHighlight(data, payload, 'emphasis');
  };
  /**
   * Downplay series or specified data item.
   */
  ChartView.prototype.downplay = function (seriesModel, ecModel, api, payload) {
    var data = seriesModel.getData(payload && payload.dataType);
    if (!data) {
      {
        error("Unknown dataType " + payload.dataType);
      }
      return;
    }
    toggleHighlight(data, payload, 'normal');
  };
  /**
   * Remove self.
   */
  ChartView.prototype.remove = function (ecModel, api) {
    this.group.removeAll();
  };
  /**
   * Dispose self.
   */
  ChartView.prototype.dispose = function (ecModel, api) {};
  ChartView.prototype.updateView = function (seriesModel, ecModel, api, payload) {
    this.render(seriesModel, ecModel, api, payload);
  };
  // FIXME never used?
  ChartView.prototype.updateLayout = function (seriesModel, ecModel, api, payload) {
    this.render(seriesModel, ecModel, api, payload);
  };
  // FIXME never used?
  ChartView.prototype.updateVisual = function (seriesModel, ecModel, api, payload) {
    this.render(seriesModel, ecModel, api, payload);
  };
  /**
   * Traverse the new rendered elements.
   *
   * It will traverse the new added element in progressive rendering.
   * And traverse all in normal rendering.
   */
  ChartView.prototype.eachRendered = function (cb) {
    traverseElements(this.group, cb);
  };
  ChartView.markUpdateMethod = function (payload, methodName) {
    inner$j(payload).updateMethod = methodName;
  };
  ChartView.protoInitialize = function () {
    var proto = ChartView.prototype;
    proto.type = 'chart';
  }();
  return ChartView;
}();
/**
 * Set state of single element
 */
function elSetState(el, state, highlightDigit) {
  if (el && isHighDownDispatcher(el)) {
    (state === 'emphasis' ? enterEmphasis : leaveEmphasis)(el, highlightDigit);
  }
}
function toggleHighlight(data, payload, state) {
  var dataIndex = queryDataIndex(data, payload);
  var highlightDigit = payload && payload.highlightKey != null ? getHighlightDigit(payload.highlightKey) : null;
  if (dataIndex != null) {
    each$f(normalizeToArray(dataIndex), function (dataIdx) {
      elSetState(data.getItemGraphicEl(dataIdx), state, highlightDigit);
    });
  } else {
    data.eachItemGraphicEl(function (el) {
      elSetState(el, state, highlightDigit);
    });
  }
}
enableClassExtend(ChartView, ['dispose']);
enableClassManagement(ChartView);
function renderTaskPlan(context) {
  return renderPlanner(context.model);
}
function renderTaskReset(context) {
  var seriesModel = context.model;
  var ecModel = context.ecModel;
  var api = context.api;
  var payload = context.payload;
  // FIXME: remove updateView updateVisual
  var progressiveRender = seriesModel.pipelineContext.progressiveRender;
  var view = context.view;
  var updateMethod = payload && inner$j(payload).updateMethod;
  var methodName = progressiveRender ? 'incrementalPrepareRender' : updateMethod && view[updateMethod] ? updateMethod
  // `appendData` is also supported when data amount
  // is less than progressive threshold.
  : 'render';
  if (methodName !== 'render') {
    view[methodName](seriesModel, ecModel, api, payload);
  }
  return progressMethodMap[methodName];
}
var progressMethodMap = {
  incrementalPrepareRender: {
    progress: function (params, context) {
      context.view.incrementalRender(params, context.model, context.ecModel, context.api, context.payload);
    }
  },
  render: {
    // Put view.render in `progress` to support appendData. But in this case
    // view.render should not be called in reset, otherwise it will be called
    // twise. Use `forceFirstProgress` to make sure that view.render is called
    // in any cases.
    forceFirstProgress: true,
    progress: function (params, context) {
      context.view.render(context.model, context.ecModel, context.api, context.payload);
    }
  }
};
var ChartView$1 = ChartView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ORIGIN_METHOD = '\0__throttleOriginMethod';
var RATE = '\0__throttleRate';
var THROTTLE_TYPE = '\0__throttleType';
/**
 * @public
 * @param {(Function)} fn
 * @param {number} [delay=0] Unit: ms.
 * @param {boolean} [debounce=false]
 *        true: If call interval less than `delay`, only the last call works.
 *        false: If call interval less than `delay, call works on fixed rate.
 * @return {(Function)} throttled fn.
 */
function throttle(fn, delay, debounce) {
  var currCall;
  var lastCall = 0;
  var lastExec = 0;
  var timer = null;
  var diff;
  var scope;
  var args;
  var debounceNextCall;
  delay = delay || 0;
  function exec() {
    lastExec = new Date().getTime();
    timer = null;
    fn.apply(scope, args || []);
  }
  var cb = function () {
    var cbArgs = [];
    for (var _i = 0; _i < arguments.length; _i++) {
      cbArgs[_i] = arguments[_i];
    }
    currCall = new Date().getTime();
    scope = this;
    args = cbArgs;
    var thisDelay = debounceNextCall || delay;
    var thisDebounce = debounceNextCall || debounce;
    debounceNextCall = null;
    diff = currCall - (thisDebounce ? lastCall : lastExec) - thisDelay;
    clearTimeout(timer);
    // Here we should make sure that: the `exec` SHOULD NOT be called later
    // than a new call of `cb`, that is, preserving the command order. Consider
    // calculating "scale rate" when roaming as an example. When a call of `cb`
    // happens, either the `exec` is called dierectly, or the call is delayed.
    // But the delayed call should never be later than next call of `cb`. Under
    // this assurance, we can simply update view state each time `dispatchAction`
    // triggered by user roaming, but not need to add extra code to avoid the
    // state being "rolled-back".
    if (thisDebounce) {
      timer = setTimeout(exec, thisDelay);
    } else {
      if (diff >= 0) {
        exec();
      } else {
        timer = setTimeout(exec, -diff);
      }
    }
    lastCall = currCall;
  };
  /**
   * Clear throttle.
   * @public
   */
  cb.clear = function () {
    if (timer) {
      clearTimeout(timer);
      timer = null;
    }
  };
  /**
   * Enable debounce once.
   */
  cb.debounceNextCall = function (debounceDelay) {
    debounceNextCall = debounceDelay;
  };
  return cb;
}
/**
 * Create throttle method or update throttle rate.
 *
 * @example
 * ComponentView.prototype.render = function () {
 *     ...
 *     throttle.createOrUpdate(
 *         this,
 *         '_dispatchAction',
 *         this.model.get('throttle'),
 *         'fixRate'
 *     );
 * };
 * ComponentView.prototype.remove = function () {
 *     throttle.clear(this, '_dispatchAction');
 * };
 * ComponentView.prototype.dispose = function () {
 *     throttle.clear(this, '_dispatchAction');
 * };
 *
 */
function createOrUpdate(obj, fnAttr, rate, throttleType) {
  var fn = obj[fnAttr];
  if (!fn) {
    return;
  }
  var originFn = fn[ORIGIN_METHOD] || fn;
  var lastThrottleType = fn[THROTTLE_TYPE];
  var lastRate = fn[RATE];
  if (lastRate !== rate || lastThrottleType !== throttleType) {
    if (rate == null || !throttleType) {
      return obj[fnAttr] = originFn;
    }
    fn = obj[fnAttr] = throttle(originFn, rate, throttleType === 'debounce');
    fn[ORIGIN_METHOD] = originFn;
    fn[THROTTLE_TYPE] = throttleType;
    fn[RATE] = rate;
  }
  return fn;
}
/**
 * Clear throttle. Example see throttle.createOrUpdate.
 */
function clear$1(obj, fnAttr) {
  var fn = obj[fnAttr];
  if (fn && fn[ORIGIN_METHOD]) {
    // Clear throttle
    fn.clear && fn.clear();
    obj[fnAttr] = fn[ORIGIN_METHOD];
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$i = makeInner();
var defaultStyleMappers = {
  itemStyle: makeStyleMapper(ITEM_STYLE_KEY_MAP, true),
  lineStyle: makeStyleMapper(LINE_STYLE_KEY_MAP, true)
};
var defaultColorKey = {
  lineStyle: 'stroke',
  itemStyle: 'fill'
};
function getStyleMapper(seriesModel, stylePath) {
  var styleMapper = seriesModel.visualStyleMapper || defaultStyleMappers[stylePath];
  if (!styleMapper) {
    console.warn("Unknown style type '" + stylePath + "'.");
    return defaultStyleMappers.itemStyle;
  }
  return styleMapper;
}
function getDefaultColorKey(seriesModel, stylePath) {
  // return defaultColorKey[stylePath] ||
  var colorKey = seriesModel.visualDrawType || defaultColorKey[stylePath];
  if (!colorKey) {
    console.warn("Unknown style type '" + stylePath + "'.");
    return 'fill';
  }
  return colorKey;
}
var seriesStyleTask = {
  createOnAllSeries: true,
  performRawSeries: true,
  reset: function (seriesModel, ecModel) {
    var data = seriesModel.getData();
    var stylePath = seriesModel.visualStyleAccessPath || 'itemStyle';
    // Set in itemStyle
    var styleModel = seriesModel.getModel(stylePath);
    var getStyle = getStyleMapper(seriesModel, stylePath);
    var globalStyle = getStyle(styleModel);
    var decalOption = styleModel.getShallow('decal');
    if (decalOption) {
      data.setVisual('decal', decalOption);
      decalOption.dirty = true;
    }
    // TODO
    var colorKey = getDefaultColorKey(seriesModel, stylePath);
    var color = globalStyle[colorKey];
    // TODO style callback
    var colorCallback = isFunction(color) ? color : null;
    var hasAutoColor = globalStyle.fill === 'auto' || globalStyle.stroke === 'auto';
    // Get from color palette by default.
    if (!globalStyle[colorKey] || colorCallback || hasAutoColor) {
      // Note: If some series has color specified (e.g., by itemStyle.color), we DO NOT
      // make it effect palette. Because some scenarios users need to make some series
      // transparent or as background, which should better not effect the palette.
      var colorPalette = seriesModel.getColorFromPalette(
      // TODO series count changed.
      seriesModel.name, null, ecModel.getSeriesCount());
      if (!globalStyle[colorKey]) {
        globalStyle[colorKey] = colorPalette;
        data.setVisual('colorFromPalette', true);
      }
      globalStyle.fill = globalStyle.fill === 'auto' || isFunction(globalStyle.fill) ? colorPalette : globalStyle.fill;
      globalStyle.stroke = globalStyle.stroke === 'auto' || isFunction(globalStyle.stroke) ? colorPalette : globalStyle.stroke;
    }
    data.setVisual('style', globalStyle);
    data.setVisual('drawType', colorKey);
    // Only visible series has each data be visual encoded
    if (!ecModel.isSeriesFiltered(seriesModel) && colorCallback) {
      data.setVisual('colorFromPalette', false);
      return {
        dataEach: function (data, idx) {
          var dataParams = seriesModel.getDataParams(idx);
          var itemStyle = extend({}, globalStyle);
          itemStyle[colorKey] = colorCallback(dataParams);
          data.setItemVisual(idx, 'style', itemStyle);
        }
      };
    }
  }
};
var sharedModel = new Model$1();
var dataStyleTask = {
  createOnAllSeries: true,
  performRawSeries: true,
  reset: function (seriesModel, ecModel) {
    if (seriesModel.ignoreStyleOnData || ecModel.isSeriesFiltered(seriesModel)) {
      return;
    }
    var data = seriesModel.getData();
    var stylePath = seriesModel.visualStyleAccessPath || 'itemStyle';
    // Set in itemStyle
    var getStyle = getStyleMapper(seriesModel, stylePath);
    var colorKey = data.getVisual('drawType');
    return {
      dataEach: data.hasItemOption ? function (data, idx) {
        // Not use getItemModel for performance considuration
        var rawItem = data.getRawDataItem(idx);
        if (rawItem && rawItem[stylePath]) {
          sharedModel.option = rawItem[stylePath];
          var style = getStyle(sharedModel);
          var existsStyle = data.ensureUniqueItemVisual(idx, 'style');
          extend(existsStyle, style);
          if (sharedModel.option.decal) {
            data.setItemVisual(idx, 'decal', sharedModel.option.decal);
            sharedModel.option.decal.dirty = true;
          }
          if (colorKey in style) {
            data.setItemVisual(idx, 'colorFromPalette', false);
          }
        }
      } : null
    };
  }
};
// Pick color from palette for the data which has not been set with color yet.
// Note: do not support stream rendering. No such cases yet.
var dataColorPaletteTask = {
  performRawSeries: true,
  overallReset: function (ecModel) {
    // Each type of series uses one scope.
    // Pie and funnel are using different scopes.
    var paletteScopeGroupByType = createHashMap();
    ecModel.eachSeries(function (seriesModel) {
      var colorBy = seriesModel.getColorBy();
      if (seriesModel.isColorBySeries()) {
        return;
      }
      var key = seriesModel.type + '-' + colorBy;
      var colorScope = paletteScopeGroupByType.get(key);
      if (!colorScope) {
        colorScope = {};
        paletteScopeGroupByType.set(key, colorScope);
      }
      inner$i(seriesModel).scope = colorScope;
    });
    ecModel.eachSeries(function (seriesModel) {
      if (seriesModel.isColorBySeries() || ecModel.isSeriesFiltered(seriesModel)) {
        return;
      }
      var dataAll = seriesModel.getRawData();
      var idxMap = {};
      var data = seriesModel.getData();
      var colorScope = inner$i(seriesModel).scope;
      var stylePath = seriesModel.visualStyleAccessPath || 'itemStyle';
      var colorKey = getDefaultColorKey(seriesModel, stylePath);
      data.each(function (idx) {
        var rawIdx = data.getRawIndex(idx);
        idxMap[rawIdx] = idx;
      });
      // Iterate on data before filtered. To make sure color from palette can be
      // Consistent when toggling legend.
      dataAll.each(function (rawIdx) {
        var idx = idxMap[rawIdx];
        var fromPalette = data.getItemVisual(idx, 'colorFromPalette');
        // Get color from palette for each data only when the color is inherited from series color, which is
        // also picked from color palette. So following situation is not in the case:
        // 1. series.itemStyle.color is set
        // 2. color is encoded by visualMap
        if (fromPalette) {
          var itemStyle = data.ensureUniqueItemVisual(idx, 'style');
          var name_1 = dataAll.getName(rawIdx) || rawIdx + '';
          var dataCount = dataAll.count();
          itemStyle[colorKey] = seriesModel.getColorFromPalette(name_1, colorScope, dataCount);
        }
      });
    });
  }
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PI$6 = Math.PI;
/**
 * @param {module:echarts/ExtensionAPI} api
 * @param {Object} [opts]
 * @param {string} [opts.text]
 * @param {string} [opts.color]
 * @param {string} [opts.textColor]
 * @return {module:zrender/Element}
 */
function defaultLoading(api, opts) {
  opts = opts || {};
  defaults(opts, {
    text: 'loading',
    textColor: '#000',
    fontSize: 12,
    fontWeight: 'normal',
    fontStyle: 'normal',
    fontFamily: 'sans-serif',
    maskColor: 'rgba(255, 255, 255, 0.8)',
    showSpinner: true,
    color: '#5470c6',
    spinnerRadius: 10,
    lineWidth: 5,
    zlevel: 0
  });
  var group = new Group$5();
  var mask = new Rect$3({
    style: {
      fill: opts.maskColor
    },
    zlevel: opts.zlevel,
    z: 10000
  });
  group.add(mask);
  var textContent = new ZRText$1({
    style: {
      text: opts.text,
      fill: opts.textColor,
      fontSize: opts.fontSize,
      fontWeight: opts.fontWeight,
      fontStyle: opts.fontStyle,
      fontFamily: opts.fontFamily
    },
    zlevel: opts.zlevel,
    z: 10001
  });
  var labelRect = new Rect$3({
    style: {
      fill: 'none'
    },
    textContent: textContent,
    textConfig: {
      position: 'right',
      distance: 10
    },
    zlevel: opts.zlevel,
    z: 10001
  });
  group.add(labelRect);
  var arc;
  if (opts.showSpinner) {
    arc = new Arc$1({
      shape: {
        startAngle: -PI$6 / 2,
        endAngle: -PI$6 / 2 + 0.1,
        r: opts.spinnerRadius
      },
      style: {
        stroke: opts.color,
        lineCap: 'round',
        lineWidth: opts.lineWidth
      },
      zlevel: opts.zlevel,
      z: 10001
    });
    arc.animateShape(true).when(1000, {
      endAngle: PI$6 * 3 / 2
    }).start('circularInOut');
    arc.animateShape(true).when(1000, {
      startAngle: PI$6 * 3 / 2
    }).delay(300).start('circularInOut');
    group.add(arc);
  }
  // Inject resize
  group.resize = function () {
    var textWidth = textContent.getBoundingRect().width;
    var r = opts.showSpinner ? opts.spinnerRadius : 0;
    // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
    // textDistance needs to be calculated when both animation and text exist
    var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2 - (opts.showSpinner && textWidth ? 0 : 5 + textWidth / 2)
    // only show the text
    + (opts.showSpinner ? 0 : textWidth / 2)
    // only show the spinner
    + (textWidth ? 0 : r);
    var cy = api.getHeight() / 2;
    opts.showSpinner && arc.setShape({
      cx: cx,
      cy: cy
    });
    labelRect.setShape({
      x: cx - r,
      y: cy - r,
      width: r * 2,
      height: r * 2
    });
    mask.setShape({
      x: 0,
      y: 0,
      width: api.getWidth(),
      height: api.getHeight()
    });
  };
  group.resize();
  return group;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Scheduler = /** @class */function () {
  function Scheduler(ecInstance, api, dataProcessorHandlers, visualHandlers) {
    // key: handlerUID
    this._stageTaskMap = createHashMap();
    this.ecInstance = ecInstance;
    this.api = api;
    // Fix current processors in case that in some rear cases that
    // processors might be registered after echarts instance created.
    // Register processors incrementally for a echarts instance is
    // not supported by this stream architecture.
    dataProcessorHandlers = this._dataProcessorHandlers = dataProcessorHandlers.slice();
    visualHandlers = this._visualHandlers = visualHandlers.slice();
    this._allHandlers = dataProcessorHandlers.concat(visualHandlers);
  }
  Scheduler.prototype.restoreData = function (ecModel, payload) {
    // TODO: Only restore needed series and components, but not all components.
    // Currently `restoreData` of all of the series and component will be called.
    // But some independent components like `title`, `legend`, `graphic`, `toolbox`,
    // `tooltip`, `axisPointer`, etc, do not need series refresh when `setOption`,
    // and some components like coordinate system, axes, dataZoom, visualMap only
    // need their target series refresh.
    // (1) If we are implementing this feature some day, we should consider these cases:
    // if a data processor depends on a component (e.g., dataZoomProcessor depends
    // on the settings of `dataZoom`), it should be re-performed if the component
    // is modified by `setOption`.
    // (2) If a processor depends on sevral series, speicified by its `getTargetSeries`,
    // it should be re-performed when the result array of `getTargetSeries` changed.
    // We use `dependencies` to cover these issues.
    // (3) How to update target series when coordinate system related components modified.
    // TODO: simply the dirty mechanism? Check whether only the case here can set tasks dirty,
    // and this case all of the tasks will be set as dirty.
    ecModel.restoreData(payload);
    // Theoretically an overall task not only depends on each of its target series, but also
    // depends on all of the series.
    // The overall task is not in pipeline, and `ecModel.restoreData` only set pipeline tasks
    // dirty. If `getTargetSeries` of an overall task returns nothing, we should also ensure
    // that the overall task is set as dirty and to be performed, otherwise it probably cause
    // state chaos. So we have to set dirty of all of the overall tasks manually, otherwise it
    // probably cause state chaos (consider `dataZoomProcessor`).
    this._stageTaskMap.each(function (taskRecord) {
      var overallTask = taskRecord.overallTask;
      overallTask && overallTask.dirty();
    });
  };
  // If seriesModel provided, incremental threshold is check by series data.
  Scheduler.prototype.getPerformArgs = function (task, isBlock) {
    // For overall task
    if (!task.__pipeline) {
      return;
    }
    var pipeline = this._pipelineMap.get(task.__pipeline.id);
    var pCtx = pipeline.context;
    var incremental = !isBlock && pipeline.progressiveEnabled && (!pCtx || pCtx.progressiveRender) && task.__idxInPipeline > pipeline.blockIndex;
    var step = incremental ? pipeline.step : null;
    var modDataCount = pCtx && pCtx.modDataCount;
    var modBy = modDataCount != null ? Math.ceil(modDataCount / step) : null;
    return {
      step: step,
      modBy: modBy,
      modDataCount: modDataCount
    };
  };
  Scheduler.prototype.getPipeline = function (pipelineId) {
    return this._pipelineMap.get(pipelineId);
  };
  /**
   * Current, progressive rendering starts from visual and layout.
   * Always detect render mode in the same stage, avoiding that incorrect
   * detection caused by data filtering.
   * Caution:
   * `updateStreamModes` use `seriesModel.getData()`.
   */
  Scheduler.prototype.updateStreamModes = function (seriesModel, view) {
    var pipeline = this._pipelineMap.get(seriesModel.uid);
    var data = seriesModel.getData();
    var dataLen = data.count();
    // `progressiveRender` means that can render progressively in each
    // animation frame. Note that some types of series do not provide
    // `view.incrementalPrepareRender` but support `chart.appendData`. We
    // use the term `incremental` but not `progressive` to describe the
    // case that `chart.appendData`.
    var progressiveRender = pipeline.progressiveEnabled && view.incrementalPrepareRender && dataLen >= pipeline.threshold;
    var large = seriesModel.get('large') && dataLen >= seriesModel.get('largeThreshold');
    // TODO: modDataCount should not updated if `appendData`, otherwise cause whole repaint.
    // see `test/candlestick-large3.html`
    var modDataCount = seriesModel.get('progressiveChunkMode') === 'mod' ? dataLen : null;
    seriesModel.pipelineContext = pipeline.context = {
      progressiveRender: progressiveRender,
      modDataCount: modDataCount,
      large: large
    };
  };
  Scheduler.prototype.restorePipelines = function (ecModel) {
    var scheduler = this;
    var pipelineMap = scheduler._pipelineMap = createHashMap();
    ecModel.eachSeries(function (seriesModel) {
      var progressive = seriesModel.getProgressive();
      var pipelineId = seriesModel.uid;
      pipelineMap.set(pipelineId, {
        id: pipelineId,
        head: null,
        tail: null,
        threshold: seriesModel.getProgressiveThreshold(),
        progressiveEnabled: progressive && !(seriesModel.preventIncremental && seriesModel.preventIncremental()),
        blockIndex: -1,
        step: Math.round(progressive || 700),
        count: 0
      });
      scheduler._pipe(seriesModel, seriesModel.dataTask);
    });
  };
  Scheduler.prototype.prepareStageTasks = function () {
    var stageTaskMap = this._stageTaskMap;
    var ecModel = this.api.getModel();
    var api = this.api;
    each$f(this._allHandlers, function (handler) {
      var record = stageTaskMap.get(handler.uid) || stageTaskMap.set(handler.uid, {});
      var errMsg = '';
      {
        // Currently do not need to support to sepecify them both.
        errMsg = '"reset" and "overallReset" must not be both specified.';
      }
      assert(!(handler.reset && handler.overallReset), errMsg);
      handler.reset && this._createSeriesStageTask(handler, record, ecModel, api);
      handler.overallReset && this._createOverallStageTask(handler, record, ecModel, api);
    }, this);
  };
  Scheduler.prototype.prepareView = function (view, model, ecModel, api) {
    var renderTask = view.renderTask;
    var context = renderTask.context;
    context.model = model;
    context.ecModel = ecModel;
    context.api = api;
    renderTask.__block = !view.incrementalPrepareRender;
    this._pipe(model, renderTask);
  };
  Scheduler.prototype.performDataProcessorTasks = function (ecModel, payload) {
    // If we do not use `block` here, it should be considered when to update modes.
    this._performStageTasks(this._dataProcessorHandlers, ecModel, payload, {
      block: true
    });
  };
  Scheduler.prototype.performVisualTasks = function (ecModel, payload, opt) {
    this._performStageTasks(this._visualHandlers, ecModel, payload, opt);
  };
  Scheduler.prototype._performStageTasks = function (stageHandlers, ecModel, payload, opt) {
    opt = opt || {};
    var unfinished = false;
    var scheduler = this;
    each$f(stageHandlers, function (stageHandler, idx) {
      if (opt.visualType && opt.visualType !== stageHandler.visualType) {
        return;
      }
      var stageHandlerRecord = scheduler._stageTaskMap.get(stageHandler.uid);
      var seriesTaskMap = stageHandlerRecord.seriesTaskMap;
      var overallTask = stageHandlerRecord.overallTask;
      if (overallTask) {
        var overallNeedDirty_1;
        var agentStubMap = overallTask.agentStubMap;
        agentStubMap.each(function (stub) {
          if (needSetDirty(opt, stub)) {
            stub.dirty();
            overallNeedDirty_1 = true;
          }
        });
        overallNeedDirty_1 && overallTask.dirty();
        scheduler.updatePayload(overallTask, payload);
        var performArgs_1 = scheduler.getPerformArgs(overallTask, opt.block);
        // Execute stubs firstly, which may set the overall task dirty,
        // then execute the overall task. And stub will call seriesModel.setData,
        // which ensures that in the overallTask seriesModel.getData() will not
        // return incorrect data.
        agentStubMap.each(function (stub) {
          stub.perform(performArgs_1);
        });
        if (overallTask.perform(performArgs_1)) {
          unfinished = true;
        }
      } else if (seriesTaskMap) {
        seriesTaskMap.each(function (task, pipelineId) {
          if (needSetDirty(opt, task)) {
            task.dirty();
          }
          var performArgs = scheduler.getPerformArgs(task, opt.block);
          // FIXME
          // if intending to declare `performRawSeries` in handlers, only
          // stream-independent (specifically, data item independent) operations can be
          // performed. Because if a series is filtered, most of the tasks will not
          // be performed. A stream-dependent operation probably cause wrong biz logic.
          // Perhaps we should not provide a separate callback for this case instead
          // of providing the config `performRawSeries`. The stream-dependent operations
          // and stream-independent operations should better not be mixed.
          performArgs.skip = !stageHandler.performRawSeries && ecModel.isSeriesFiltered(task.context.model);
          scheduler.updatePayload(task, payload);
          if (task.perform(performArgs)) {
            unfinished = true;
          }
        });
      }
    });
    function needSetDirty(opt, task) {
      return opt.setDirty && (!opt.dirtyMap || opt.dirtyMap.get(task.__pipeline.id));
    }
    this.unfinished = unfinished || this.unfinished;
  };
  Scheduler.prototype.performSeriesTasks = function (ecModel) {
    var unfinished;
    ecModel.eachSeries(function (seriesModel) {
      // Progress to the end for dataInit and dataRestore.
      unfinished = seriesModel.dataTask.perform() || unfinished;
    });
    this.unfinished = unfinished || this.unfinished;
  };
  Scheduler.prototype.plan = function () {
    // Travel pipelines, check block.
    this._pipelineMap.each(function (pipeline) {
      var task = pipeline.tail;
      do {
        if (task.__block) {
          pipeline.blockIndex = task.__idxInPipeline;
          break;
        }
        task = task.getUpstream();
      } while (task);
    });
  };
  Scheduler.prototype.updatePayload = function (task, payload) {
    payload !== 'remain' && (task.context.payload = payload);
  };
  Scheduler.prototype._createSeriesStageTask = function (stageHandler, stageHandlerRecord, ecModel, api) {
    var scheduler = this;
    var oldSeriesTaskMap = stageHandlerRecord.seriesTaskMap;
    // The count of stages are totally about only several dozen, so
    // do not need to reuse the map.
    var newSeriesTaskMap = stageHandlerRecord.seriesTaskMap = createHashMap();
    var seriesType = stageHandler.seriesType;
    var getTargetSeries = stageHandler.getTargetSeries;
    // If a stageHandler should cover all series, `createOnAllSeries` should be declared mandatorily,
    // to avoid some typo or abuse. Otherwise if an extension do not specify a `seriesType`,
    // it works but it may cause other irrelevant charts blocked.
    if (stageHandler.createOnAllSeries) {
      ecModel.eachRawSeries(create);
    } else if (seriesType) {
      ecModel.eachRawSeriesByType(seriesType, create);
    } else if (getTargetSeries) {
      getTargetSeries(ecModel, api).each(create);
    }
    function create(seriesModel) {
      var pipelineId = seriesModel.uid;
      // Init tasks for each seriesModel only once.
      // Reuse original task instance.
      var task = newSeriesTaskMap.set(pipelineId, oldSeriesTaskMap && oldSeriesTaskMap.get(pipelineId) || createTask({
        plan: seriesTaskPlan,
        reset: seriesTaskReset,
        count: seriesTaskCount
      }));
      task.context = {
        model: seriesModel,
        ecModel: ecModel,
        api: api,
        // PENDING: `useClearVisual` not used?
        useClearVisual: stageHandler.isVisual && !stageHandler.isLayout,
        plan: stageHandler.plan,
        reset: stageHandler.reset,
        scheduler: scheduler
      };
      scheduler._pipe(seriesModel, task);
    }
  };
  Scheduler.prototype._createOverallStageTask = function (stageHandler, stageHandlerRecord, ecModel, api) {
    var scheduler = this;
    var overallTask = stageHandlerRecord.overallTask = stageHandlerRecord.overallTask
    // For overall task, the function only be called on reset stage.
    || createTask({
      reset: overallTaskReset
    });
    overallTask.context = {
      ecModel: ecModel,
      api: api,
      overallReset: stageHandler.overallReset,
      scheduler: scheduler
    };
    var oldAgentStubMap = overallTask.agentStubMap;
    // The count of stages are totally about only several dozen, so
    // do not need to reuse the map.
    var newAgentStubMap = overallTask.agentStubMap = createHashMap();
    var seriesType = stageHandler.seriesType;
    var getTargetSeries = stageHandler.getTargetSeries;
    var overallProgress = true;
    var shouldOverallTaskDirty = false;
    // FIXME:TS never used, so comment it
    // let modifyOutputEnd = stageHandler.modifyOutputEnd;
    // An overall task with seriesType detected or has `getTargetSeries`, we add
    // stub in each pipelines, it will set the overall task dirty when the pipeline
    // progress. Moreover, to avoid call the overall task each frame (too frequent),
    // we set the pipeline block.
    var errMsg = '';
    {
      errMsg = '"createOnAllSeries" is not supported for "overallReset", ' + 'because it will block all streams.';
    }
    assert(!stageHandler.createOnAllSeries, errMsg);
    if (seriesType) {
      ecModel.eachRawSeriesByType(seriesType, createStub);
    } else if (getTargetSeries) {
      getTargetSeries(ecModel, api).each(createStub);
    }
    // Otherwise, (usually it is legacy case), the overall task will only be
    // executed when upstream is dirty. Otherwise the progressive rendering of all
    // pipelines will be disabled unexpectedly. But it still needs stubs to receive
    // dirty info from upstream.
    else {
      overallProgress = false;
      each$f(ecModel.getSeries(), createStub);
    }
    function createStub(seriesModel) {
      var pipelineId = seriesModel.uid;
      var stub = newAgentStubMap.set(pipelineId, oldAgentStubMap && oldAgentStubMap.get(pipelineId) || (
      // When the result of `getTargetSeries` changed, the overallTask
      // should be set as dirty and re-performed.
      shouldOverallTaskDirty = true, createTask({
        reset: stubReset,
        onDirty: stubOnDirty
      })));
      stub.context = {
        model: seriesModel,
        overallProgress: overallProgress
        // FIXME:TS never used, so comment it
        // modifyOutputEnd: modifyOutputEnd
      };
      stub.agent = overallTask;
      stub.__block = overallProgress;
      scheduler._pipe(seriesModel, stub);
    }
    if (shouldOverallTaskDirty) {
      overallTask.dirty();
    }
  };
  Scheduler.prototype._pipe = function (seriesModel, task) {
    var pipelineId = seriesModel.uid;
    var pipeline = this._pipelineMap.get(pipelineId);
    !pipeline.head && (pipeline.head = task);
    pipeline.tail && pipeline.tail.pipe(task);
    pipeline.tail = task;
    task.__idxInPipeline = pipeline.count++;
    task.__pipeline = pipeline;
  };
  Scheduler.wrapStageHandler = function (stageHandler, visualType) {
    if (isFunction(stageHandler)) {
      stageHandler = {
        overallReset: stageHandler,
        seriesType: detectSeriseType(stageHandler)
      };
    }
    stageHandler.uid = getUID('stageHandler');
    visualType && (stageHandler.visualType = visualType);
    return stageHandler;
  };
  return Scheduler;
}();
function overallTaskReset(context) {
  context.overallReset(context.ecModel, context.api, context.payload);
}
function stubReset(context) {
  return context.overallProgress && stubProgress;
}
function stubProgress() {
  this.agent.dirty();
  this.getDownstream().dirty();
}
function stubOnDirty() {
  this.agent && this.agent.dirty();
}
function seriesTaskPlan(context) {
  return context.plan ? context.plan(context.model, context.ecModel, context.api, context.payload) : null;
}
function seriesTaskReset(context) {
  if (context.useClearVisual) {
    context.data.clearAllVisual();
  }
  var resetDefines = context.resetDefines = normalizeToArray(context.reset(context.model, context.ecModel, context.api, context.payload));
  return resetDefines.length > 1 ? map$1(resetDefines, function (v, idx) {
    return makeSeriesTaskProgress(idx);
  }) : singleSeriesTaskProgress;
}
var singleSeriesTaskProgress = makeSeriesTaskProgress(0);
function makeSeriesTaskProgress(resetDefineIdx) {
  return function (params, context) {
    var data = context.data;
    var resetDefine = context.resetDefines[resetDefineIdx];
    if (resetDefine && resetDefine.dataEach) {
      for (var i = params.start; i < params.end; i++) {
        resetDefine.dataEach(data, i);
      }
    } else if (resetDefine && resetDefine.progress) {
      resetDefine.progress(params, data);
    }
  };
}
function seriesTaskCount(context) {
  return context.data.count();
}
/**
 * Only some legacy stage handlers (usually in echarts extensions) are pure function.
 * To ensure that they can work normally, they should work in block mode, that is,
 * they should not be started util the previous tasks finished. So they cause the
 * progressive rendering disabled. We try to detect the series type, to narrow down
 * the block range to only the series type they concern, but not all series.
 */
function detectSeriseType(legacyFunc) {
  seriesType = null;
  try {
    // Assume there is no async when calling `eachSeriesByType`.
    legacyFunc(ecModelMock, apiMock);
  } catch (e) {}
  return seriesType;
}
var ecModelMock = {};
var apiMock = {};
var seriesType;
mockMethods(ecModelMock, GlobalModel$1);
mockMethods(apiMock, ExtensionAPI$1);
ecModelMock.eachSeriesByType = ecModelMock.eachRawSeriesByType = function (type) {
  seriesType = type;
};
ecModelMock.eachComponent = function (cond) {
  if (cond.mainType === 'series' && cond.subType) {
    seriesType = cond.subType;
  }
};
function mockMethods(target, Clz) {
  /* eslint-disable */
  for (var name_1 in Clz.prototype) {
    // Do not use hasOwnProperty
    target[name_1] = noop;
  }
  /* eslint-enable */
}
var Scheduler$1 = Scheduler;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var colorAll = ['#37A2DA', '#32C5E9', '#67E0E3', '#9FE6B8', '#FFDB5C', '#ff9f7f', '#fb7293', '#E062AE', '#E690D1', '#e7bcf3', '#9d96f5', '#8378EA', '#96BFFF'];
var lightTheme = {
  color: colorAll,
  colorLayer: [['#37A2DA', '#ffd85c', '#fd7b5f'], ['#37A2DA', '#67E0E3', '#FFDB5C', '#ff9f7f', '#E062AE', '#9d96f5'], ['#37A2DA', '#32C5E9', '#9FE6B8', '#FFDB5C', '#ff9f7f', '#fb7293', '#e7bcf3', '#8378EA', '#96BFFF'], colorAll]
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var contrastColor = '#B9B8CE';
var backgroundColor = '#100C2A';
var axisCommon = function () {
  return {
    axisLine: {
      lineStyle: {
        color: contrastColor
      }
    },
    splitLine: {
      lineStyle: {
        color: '#484753'
      }
    },
    splitArea: {
      areaStyle: {
        color: ['rgba(255,255,255,0.02)', 'rgba(255,255,255,0.05)']
      }
    },
    minorSplitLine: {
      lineStyle: {
        color: '#20203B'
      }
    }
  };
};
var colorPalette = ['#4992ff', '#7cffb2', '#fddd60', '#ff6e76', '#58d9f9', '#05c091', '#ff8a45', '#8d48e3', '#dd79ff'];
var theme = {
  darkMode: true,
  color: colorPalette,
  backgroundColor: backgroundColor,
  axisPointer: {
    lineStyle: {
      color: '#817f91'
    },
    crossStyle: {
      color: '#817f91'
    },
    label: {
      // TODO Contrast of label backgorundColor
      color: '#fff'
    }
  },
  legend: {
    textStyle: {
      color: contrastColor
    },
    pageTextStyle: {
      color: contrastColor
    }
  },
  textStyle: {
    color: contrastColor
  },
  title: {
    textStyle: {
      color: '#EEF1FA'
    },
    subtextStyle: {
      color: '#B9B8CE'
    }
  },
  toolbox: {
    iconStyle: {
      borderColor: contrastColor
    }
  },
  dataZoom: {
    borderColor: '#71708A',
    textStyle: {
      color: contrastColor
    },
    brushStyle: {
      color: 'rgba(135,163,206,0.3)'
    },
    handleStyle: {
      color: '#353450',
      borderColor: '#C5CBE3'
    },
    moveHandleStyle: {
      color: '#B0B6C3',
      opacity: 0.3
    },
    fillerColor: 'rgba(135,163,206,0.2)',
    emphasis: {
      handleStyle: {
        borderColor: '#91B7F2',
        color: '#4D587D'
      },
      moveHandleStyle: {
        color: '#636D9A',
        opacity: 0.7
      }
    },
    dataBackground: {
      lineStyle: {
        color: '#71708A',
        width: 1
      },
      areaStyle: {
        color: '#71708A'
      }
    },
    selectedDataBackground: {
      lineStyle: {
        color: '#87A3CE'
      },
      areaStyle: {
        color: '#87A3CE'
      }
    }
  },
  visualMap: {
    textStyle: {
      color: contrastColor
    }
  },
  timeline: {
    lineStyle: {
      color: contrastColor
    },
    label: {
      color: contrastColor
    },
    controlStyle: {
      color: contrastColor,
      borderColor: contrastColor
    }
  },
  calendar: {
    itemStyle: {
      color: backgroundColor
    },
    dayLabel: {
      color: contrastColor
    },
    monthLabel: {
      color: contrastColor
    },
    yearLabel: {
      color: contrastColor
    }
  },
  timeAxis: axisCommon(),
  logAxis: axisCommon(),
  valueAxis: axisCommon(),
  categoryAxis: axisCommon(),
  line: {
    symbol: 'circle'
  },
  graph: {
    color: colorPalette
  },
  gauge: {
    title: {
      color: contrastColor
    },
    axisLine: {
      lineStyle: {
        color: [[1, 'rgba(207,212,219,0.2)']]
      }
    },
    axisLabel: {
      color: contrastColor
    },
    detail: {
      color: '#EEF1FA'
    }
  },
  candlestick: {
    itemStyle: {
      color: '#f64e56',
      color0: '#54ea92',
      borderColor: '#f64e56',
      borderColor0: '#54ea92'
      // borderColor: '#ca2824',
      // borderColor0: '#09a443'
    }
  }
};
theme.categoryAxis.splitLine.show = false;
var darkTheme = theme;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Usage of query:
 * `chart.on('click', query, handler);`
 * The `query` can be:
 * + The component type query string, only `mainType` or `mainType.subType`,
 *   like: 'xAxis', 'series', 'xAxis.category' or 'series.line'.
 * + The component query object, like:
 *   `{seriesIndex: 2}`, `{seriesName: 'xx'}`, `{seriesId: 'some'}`,
 *   `{xAxisIndex: 2}`, `{xAxisName: 'xx'}`, `{xAxisId: 'some'}`.
 * + The data query object, like:
 *   `{dataIndex: 123}`, `{dataType: 'link'}`, `{name: 'some'}`.
 * + The other query object (cmponent customized query), like:
 *   `{element: 'some'}` (only available in custom series).
 *
 * Caveat: If a prop in the `query` object is `null/undefined`, it is the
 * same as there is no such prop in the `query` object.
 */
var ECEventProcessor = /** @class */function () {
  function ECEventProcessor() {}
  ECEventProcessor.prototype.normalizeQuery = function (query) {
    var cptQuery = {};
    var dataQuery = {};
    var otherQuery = {};
    // `query` is `mainType` or `mainType.subType` of component.
    if (isString(query)) {
      var condCptType = parseClassType(query);
      // `.main` and `.sub` may be ''.
      cptQuery.mainType = condCptType.main || null;
      cptQuery.subType = condCptType.sub || null;
    }
    // `query` is an object, convert to {mainType, index, name, id}.
    else {
      // `xxxIndex`, `xxxName`, `xxxId`, `name`, `dataIndex`, `dataType` is reserved,
      // can not be used in `compomentModel.filterForExposedEvent`.
      var suffixes_1 = ['Index', 'Name', 'Id'];
      var dataKeys_1 = {
        name: 1,
        dataIndex: 1,
        dataType: 1
      };
      each$f(query, function (val, key) {
        var reserved = false;
        for (var i = 0; i < suffixes_1.length; i++) {
          var propSuffix = suffixes_1[i];
          var suffixPos = key.lastIndexOf(propSuffix);
          if (suffixPos > 0 && suffixPos === key.length - propSuffix.length) {
            var mainType = key.slice(0, suffixPos);
            // Consider `dataIndex`.
            if (mainType !== 'data') {
              cptQuery.mainType = mainType;
              cptQuery[propSuffix.toLowerCase()] = val;
              reserved = true;
            }
          }
        }
        if (dataKeys_1.hasOwnProperty(key)) {
          dataQuery[key] = val;
          reserved = true;
        }
        if (!reserved) {
          otherQuery[key] = val;
        }
      });
    }
    return {
      cptQuery: cptQuery,
      dataQuery: dataQuery,
      otherQuery: otherQuery
    };
  };
  ECEventProcessor.prototype.filter = function (eventType, query) {
    // They should be assigned before each trigger call.
    var eventInfo = this.eventInfo;
    if (!eventInfo) {
      return true;
    }
    var targetEl = eventInfo.targetEl;
    var packedEvent = eventInfo.packedEvent;
    var model = eventInfo.model;
    var view = eventInfo.view;
    // For event like 'globalout'.
    if (!model || !view) {
      return true;
    }
    var cptQuery = query.cptQuery;
    var dataQuery = query.dataQuery;
    return check(cptQuery, model, 'mainType') && check(cptQuery, model, 'subType') && check(cptQuery, model, 'index', 'componentIndex') && check(cptQuery, model, 'name') && check(cptQuery, model, 'id') && check(dataQuery, packedEvent, 'name') && check(dataQuery, packedEvent, 'dataIndex') && check(dataQuery, packedEvent, 'dataType') && (!view.filterForExposedEvent || view.filterForExposedEvent(eventType, query.otherQuery, targetEl, packedEvent));
    function check(query, host, prop, propOnHost) {
      return query[prop] == null || host[propOnHost || prop] === query[prop];
    }
  };
  ECEventProcessor.prototype.afterTrigger = function () {
    // Make sure the eventInfo won't be used in next trigger.
    this.eventInfo = null;
  };
  return ECEventProcessor;
}();

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SYMBOL_PROPS_WITH_CB = ['symbol', 'symbolSize', 'symbolRotate', 'symbolOffset'];
var SYMBOL_PROPS = SYMBOL_PROPS_WITH_CB.concat(['symbolKeepAspect']);
// Encoding visual for all series include which is filtered for legend drawing
var seriesSymbolTask = {
  createOnAllSeries: true,
  // For legend.
  performRawSeries: true,
  reset: function (seriesModel, ecModel) {
    var data = seriesModel.getData();
    if (seriesModel.legendIcon) {
      data.setVisual('legendIcon', seriesModel.legendIcon);
    }
    if (!seriesModel.hasSymbolVisual) {
      return;
    }
    var symbolOptions = {};
    var symbolOptionsCb = {};
    var hasCallback = false;
    for (var i = 0; i < SYMBOL_PROPS_WITH_CB.length; i++) {
      var symbolPropName = SYMBOL_PROPS_WITH_CB[i];
      var val = seriesModel.get(symbolPropName);
      if (isFunction(val)) {
        hasCallback = true;
        symbolOptionsCb[symbolPropName] = val;
      } else {
        symbolOptions[symbolPropName] = val;
      }
    }
    symbolOptions.symbol = symbolOptions.symbol || seriesModel.defaultSymbol;
    data.setVisual(extend({
      legendIcon: seriesModel.legendIcon || symbolOptions.symbol,
      symbolKeepAspect: seriesModel.get('symbolKeepAspect')
    }, symbolOptions));
    // Only visible series has each data be visual encoded
    if (ecModel.isSeriesFiltered(seriesModel)) {
      return;
    }
    var symbolPropsCb = keys(symbolOptionsCb);
    function dataEach(data, idx) {
      var rawValue = seriesModel.getRawValue(idx);
      var params = seriesModel.getDataParams(idx);
      for (var i = 0; i < symbolPropsCb.length; i++) {
        var symbolPropName = symbolPropsCb[i];
        data.setItemVisual(idx, symbolPropName, symbolOptionsCb[symbolPropName](rawValue, params));
      }
    }
    return {
      dataEach: hasCallback ? dataEach : null
    };
  }
};
var dataSymbolTask = {
  createOnAllSeries: true,
  // For legend.
  performRawSeries: true,
  reset: function (seriesModel, ecModel) {
    if (!seriesModel.hasSymbolVisual) {
      return;
    }
    // Only visible series has each data be visual encoded
    if (ecModel.isSeriesFiltered(seriesModel)) {
      return;
    }
    var data = seriesModel.getData();
    function dataEach(data, idx) {
      var itemModel = data.getItemModel(idx);
      for (var i = 0; i < SYMBOL_PROPS.length; i++) {
        var symbolPropName = SYMBOL_PROPS[i];
        var val = itemModel.getShallow(symbolPropName, true);
        if (val != null) {
          data.setItemVisual(idx, symbolPropName, val);
        }
      }
    }
    return {
      dataEach: data.hasItemOption ? dataEach : null
    };
  }
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function getItemVisualFromData(data, dataIndex, key) {
  switch (key) {
    case 'color':
      var style = data.getItemVisual(dataIndex, 'style');
      return style[data.getVisual('drawType')];
    case 'opacity':
      return data.getItemVisual(dataIndex, 'style').opacity;
    case 'symbol':
    case 'symbolSize':
    case 'liftZ':
      return data.getItemVisual(dataIndex, key);
    default:
      {
        console.warn("Unknown visual type " + key);
      }
  }
}
function getVisualFromData(data, key) {
  switch (key) {
    case 'color':
      var style = data.getVisual('style');
      return style[data.getVisual('drawType')];
    case 'opacity':
      return data.getVisual('style').opacity;
    case 'symbol':
    case 'symbolSize':
    case 'liftZ':
      return data.getVisual(key);
    default:
      {
        console.warn("Unknown visual type " + key);
      }
  }
}
function setItemVisualFromData(data, dataIndex, key, value) {
  switch (key) {
    case 'color':
      // Make sure not sharing style object.
      var style = data.ensureUniqueItemVisual(dataIndex, 'style');
      style[data.getVisual('drawType')] = value;
      // Mark the color has been changed, not from palette anymore
      data.setItemVisual(dataIndex, 'colorFromPalette', false);
      break;
    case 'opacity':
      data.ensureUniqueItemVisual(dataIndex, 'style').opacity = value;
      break;
    case 'symbol':
    case 'symbolSize':
    case 'liftZ':
      data.setItemVisual(dataIndex, key, value);
      break;
    default:
      {
        console.warn("Unknown visual type " + key);
      }
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Legacy data selection action.
// Includes: pieSelect, pieUnSelect, pieToggleSelect, mapSelect, mapUnSelect, mapToggleSelect
function createLegacyDataSelectAction(seriesType, ecRegisterAction) {
  function getSeriesIndices(ecModel, payload) {
    var seriesIndices = [];
    ecModel.eachComponent({
      mainType: 'series',
      subType: seriesType,
      query: payload
    }, function (seriesModel) {
      seriesIndices.push(seriesModel.seriesIndex);
    });
    return seriesIndices;
  }
  each$f([[seriesType + 'ToggleSelect', 'toggleSelect'], [seriesType + 'Select', 'select'], [seriesType + 'UnSelect', 'unselect']], function (eventsMap) {
    ecRegisterAction(eventsMap[0], function (payload, ecModel, api) {
      payload = extend({}, payload);
      {
        deprecateReplaceLog(payload.type, eventsMap[1]);
      }
      api.dispatchAction(extend(payload, {
        type: eventsMap[1],
        seriesIndex: getSeriesIndices(ecModel, payload)
      }));
    });
  });
}
function handleSeriesLegacySelectEvents(type, eventPostfix, ecIns, ecModel, payload) {
  var legacyEventName = type + eventPostfix;
  if (!ecIns.isSilent(legacyEventName)) {
    {
      deprecateLog("event " + legacyEventName + " is deprecated.");
    }
    ecModel.eachComponent({
      mainType: 'series',
      subType: 'pie'
    }, function (seriesModel) {
      var seriesIndex = seriesModel.seriesIndex;
      var selectedMap = seriesModel.option.selectedMap;
      var selected = payload.selected;
      for (var i = 0; i < selected.length; i++) {
        if (selected[i].seriesIndex === seriesIndex) {
          var data = seriesModel.getData();
          var dataIndex = queryDataIndex(data, payload.fromActionPayload);
          ecIns.trigger(legacyEventName, {
            type: legacyEventName,
            seriesId: seriesModel.id,
            name: isArray$1(dataIndex) ? data.getName(dataIndex[0]) : data.getName(dataIndex),
            selected: isString(selectedMap) ? selectedMap : extend({}, selectedMap)
          });
        }
      }
    });
  }
}
function handleLegacySelectEvents(messageCenter, ecIns, api) {
  messageCenter.on('selectchanged', function (params) {
    var ecModel = api.getModel();
    if (params.isFromClick) {
      handleSeriesLegacySelectEvents('map', 'selectchanged', ecIns, ecModel, params);
      handleSeriesLegacySelectEvents('pie', 'selectchanged', ecIns, ecModel, params);
    } else if (params.fromAction === 'select') {
      handleSeriesLegacySelectEvents('map', 'selected', ecIns, ecModel, params);
      handleSeriesLegacySelectEvents('pie', 'selected', ecIns, ecModel, params);
    } else if (params.fromAction === 'unselect') {
      handleSeriesLegacySelectEvents('map', 'unselected', ecIns, ecModel, params);
      handleSeriesLegacySelectEvents('pie', 'unselected', ecIns, ecModel, params);
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function findEventDispatcher(target, det, returnFirstMatch) {
  var found;
  while (target) {
    if (det(target)) {
      found = target;
      if (returnFirstMatch) {
        break;
      }
    }
    target = target.__hostTarget || target.parent;
  }
  return found;
}

var wmUniqueIndex = Math.round(Math.random() * 9);
var supportDefineProperty = typeof Object.defineProperty === 'function';
var WeakMap$1 = function () {
  function WeakMap() {
    this._id = '__ec_inner_' + wmUniqueIndex++;
  }
  WeakMap.prototype.get = function (key) {
    return this._guard(key)[this._id];
  };
  WeakMap.prototype.set = function (key, value) {
    var target = this._guard(key);
    if (supportDefineProperty) {
      Object.defineProperty(target, this._id, {
        value: value,
        enumerable: false,
        configurable: true
      });
    } else {
      target[this._id] = value;
    }
    return this;
  };
  WeakMap.prototype["delete"] = function (key) {
    if (this.has(key)) {
      delete this._guard(key)[this._id];
      return true;
    }
    return false;
  };
  WeakMap.prototype.has = function (key) {
    return !!this._guard(key)[this._id];
  };
  WeakMap.prototype._guard = function (key) {
    if (key !== Object(key)) {
      throw TypeError('Value of WeakMap is not a non-null object.');
    }
    return key;
  };
  return WeakMap;
}();
var WeakMap$2 = WeakMap$1;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Triangle shape
 * @inner
 */
var Triangle$2 = Path$1.extend({
  type: 'triangle',
  shape: {
    cx: 0,
    cy: 0,
    width: 0,
    height: 0
  },
  buildPath: function (path, shape) {
    var cx = shape.cx;
    var cy = shape.cy;
    var width = shape.width / 2;
    var height = shape.height / 2;
    path.moveTo(cx, cy - height);
    path.lineTo(cx + width, cy + height);
    path.lineTo(cx - width, cy + height);
    path.closePath();
  }
});
/**
 * Diamond shape
 * @inner
 */
var Diamond = Path$1.extend({
  type: 'diamond',
  shape: {
    cx: 0,
    cy: 0,
    width: 0,
    height: 0
  },
  buildPath: function (path, shape) {
    var cx = shape.cx;
    var cy = shape.cy;
    var width = shape.width / 2;
    var height = shape.height / 2;
    path.moveTo(cx, cy - height);
    path.lineTo(cx + width, cy);
    path.lineTo(cx, cy + height);
    path.lineTo(cx - width, cy);
    path.closePath();
  }
});
/**
 * Pin shape
 * @inner
 */
var Pin = Path$1.extend({
  type: 'pin',
  shape: {
    // x, y on the cusp
    x: 0,
    y: 0,
    width: 0,
    height: 0
  },
  buildPath: function (path, shape) {
    var x = shape.x;
    var y = shape.y;
    var w = shape.width / 5 * 3;
    // Height must be larger than width
    var h = Math.max(w, shape.height);
    var r = w / 2;
    // Dist on y with tangent point and circle center
    var dy = r * r / (h - r);
    var cy = y - h + r + dy;
    var angle = Math.asin(dy / r);
    // Dist on x with tangent point and circle center
    var dx = Math.cos(angle) * r;
    var tanX = Math.sin(angle);
    var tanY = Math.cos(angle);
    var cpLen = r * 0.6;
    var cpLen2 = r * 0.7;
    path.moveTo(x - dx, cy + dy);
    path.arc(x, cy, r, Math.PI - angle, Math.PI * 2 + angle);
    path.bezierCurveTo(x + dx - tanX * cpLen, cy + dy + tanY * cpLen, x, y - cpLen2, x, y);
    path.bezierCurveTo(x, y - cpLen2, x - dx + tanX * cpLen, cy + dy + tanY * cpLen, x - dx, cy + dy);
    path.closePath();
  }
});
/**
 * Arrow shape
 * @inner
 */
var Arrow = Path$1.extend({
  type: 'arrow',
  shape: {
    x: 0,
    y: 0,
    width: 0,
    height: 0
  },
  buildPath: function (ctx, shape) {
    var height = shape.height;
    var width = shape.width;
    var x = shape.x;
    var y = shape.y;
    var dx = width / 3 * 2;
    ctx.moveTo(x, y);
    ctx.lineTo(x + dx, y + height);
    ctx.lineTo(x, y + height / 4 * 3);
    ctx.lineTo(x - dx, y + height);
    ctx.lineTo(x, y);
    ctx.closePath();
  }
});
/**
 * Map of path constructors
 */
// TODO Use function to build symbol path.
var symbolCtors = {
  line: Line$4,
  rect: Rect$3,
  roundRect: Rect$3,
  square: Rect$3,
  circle: Circle$1,
  diamond: Diamond,
  pin: Pin,
  arrow: Arrow,
  triangle: Triangle$2
};
var symbolShapeMakers = {
  line: function (x, y, w, h, shape) {
    shape.x1 = x;
    shape.y1 = y + h / 2;
    shape.x2 = x + w;
    shape.y2 = y + h / 2;
  },
  rect: function (x, y, w, h, shape) {
    shape.x = x;
    shape.y = y;
    shape.width = w;
    shape.height = h;
  },
  roundRect: function (x, y, w, h, shape) {
    shape.x = x;
    shape.y = y;
    shape.width = w;
    shape.height = h;
    shape.r = Math.min(w, h) / 4;
  },
  square: function (x, y, w, h, shape) {
    var size = Math.min(w, h);
    shape.x = x;
    shape.y = y;
    shape.width = size;
    shape.height = size;
  },
  circle: function (x, y, w, h, shape) {
    // Put circle in the center of square
    shape.cx = x + w / 2;
    shape.cy = y + h / 2;
    shape.r = Math.min(w, h) / 2;
  },
  diamond: function (x, y, w, h, shape) {
    shape.cx = x + w / 2;
    shape.cy = y + h / 2;
    shape.width = w;
    shape.height = h;
  },
  pin: function (x, y, w, h, shape) {
    shape.x = x + w / 2;
    shape.y = y + h / 2;
    shape.width = w;
    shape.height = h;
  },
  arrow: function (x, y, w, h, shape) {
    shape.x = x + w / 2;
    shape.y = y + h / 2;
    shape.width = w;
    shape.height = h;
  },
  triangle: function (x, y, w, h, shape) {
    shape.cx = x + w / 2;
    shape.cy = y + h / 2;
    shape.width = w;
    shape.height = h;
  }
};
var symbolBuildProxies = {};
each$f(symbolCtors, function (Ctor, name) {
  symbolBuildProxies[name] = new Ctor();
});
var SymbolClz$1 = Path$1.extend({
  type: 'symbol',
  shape: {
    symbolType: '',
    x: 0,
    y: 0,
    width: 0,
    height: 0
  },
  calculateTextPosition: function (out, config, rect) {
    var res = calculateTextPosition(out, config, rect);
    var shape = this.shape;
    if (shape && shape.symbolType === 'pin' && config.position === 'inside') {
      res.y = rect.y + rect.height * 0.4;
    }
    return res;
  },
  buildPath: function (ctx, shape, inBundle) {
    var symbolType = shape.symbolType;
    if (symbolType !== 'none') {
      var proxySymbol = symbolBuildProxies[symbolType];
      if (!proxySymbol) {
        // Default rect
        symbolType = 'rect';
        proxySymbol = symbolBuildProxies[symbolType];
      }
      symbolShapeMakers[symbolType](shape.x, shape.y, shape.width, shape.height, proxySymbol.shape);
      proxySymbol.buildPath(ctx, proxySymbol.shape, inBundle);
    }
  }
});
// Provide setColor helper method to avoid determine if set the fill or stroke outside
function symbolPathSetColor(color, innerColor) {
  if (this.type !== 'image') {
    var symbolStyle = this.style;
    if (this.__isEmptyBrush) {
      symbolStyle.stroke = color;
      symbolStyle.fill = innerColor || '#fff';
      // TODO Same width with lineStyle in LineView
      symbolStyle.lineWidth = 2;
    } else if (this.shape.symbolType === 'line') {
      symbolStyle.stroke = color;
    } else {
      symbolStyle.fill = color;
    }
    this.markRedraw();
  }
}
/**
 * Create a symbol element with given symbol configuration: shape, x, y, width, height, color
 */
function createSymbol$1(symbolType, x, y, w, h, color,
// whether to keep the ratio of w/h,
keepAspect) {
  // TODO Support image object, DynamicImage.
  var isEmpty = symbolType.indexOf('empty') === 0;
  if (isEmpty) {
    symbolType = symbolType.substr(5, 1).toLowerCase() + symbolType.substr(6);
  }
  var symbolPath;
  if (symbolType.indexOf('image://') === 0) {
    symbolPath = makeImage(symbolType.slice(8), new BoundingRect$1(x, y, w, h), keepAspect ? 'center' : 'cover');
  } else if (symbolType.indexOf('path://') === 0) {
    symbolPath = makePath(symbolType.slice(7), {}, new BoundingRect$1(x, y, w, h), keepAspect ? 'center' : 'cover');
  } else {
    symbolPath = new SymbolClz$1({
      shape: {
        symbolType: symbolType,
        x: x,
        y: y,
        width: w,
        height: h
      }
    });
  }
  symbolPath.__isEmptyBrush = isEmpty;
  // TODO Should deprecate setColor
  symbolPath.setColor = symbolPathSetColor;
  if (color) {
    symbolPath.setColor(color);
  }
  return symbolPath;
}
function normalizeSymbolSize(symbolSize) {
  if (!isArray$1(symbolSize)) {
    symbolSize = [+symbolSize, +symbolSize];
  }
  return [symbolSize[0] || 0, symbolSize[1] || 0];
}
function normalizeSymbolOffset(symbolOffset, symbolSize) {
  if (symbolOffset == null) {
    return;
  }
  if (!isArray$1(symbolOffset)) {
    symbolOffset = [symbolOffset, symbolOffset];
  }
  return [parsePercent(symbolOffset[0], symbolSize[0]) || 0, parsePercent(retrieve2(symbolOffset[1], symbolOffset[0]), symbolSize[1]) || 0];
}

function isSafeNum(num) {
  return isFinite(num);
}
function createLinearGradient(ctx, obj, rect) {
  var x = obj.x == null ? 0 : obj.x;
  var x2 = obj.x2 == null ? 1 : obj.x2;
  var y = obj.y == null ? 0 : obj.y;
  var y2 = obj.y2 == null ? 0 : obj.y2;
  if (!obj.global) {
    x = x * rect.width + rect.x;
    x2 = x2 * rect.width + rect.x;
    y = y * rect.height + rect.y;
    y2 = y2 * rect.height + rect.y;
  }
  x = isSafeNum(x) ? x : 0;
  x2 = isSafeNum(x2) ? x2 : 1;
  y = isSafeNum(y) ? y : 0;
  y2 = isSafeNum(y2) ? y2 : 0;
  var canvasGradient = ctx.createLinearGradient(x, y, x2, y2);
  return canvasGradient;
}
function createRadialGradient(ctx, obj, rect) {
  var width = rect.width;
  var height = rect.height;
  var min = Math.min(width, height);
  var x = obj.x == null ? 0.5 : obj.x;
  var y = obj.y == null ? 0.5 : obj.y;
  var r = obj.r == null ? 0.5 : obj.r;
  if (!obj.global) {
    x = x * width + rect.x;
    y = y * height + rect.y;
    r = r * min;
  }
  x = isSafeNum(x) ? x : 0.5;
  y = isSafeNum(y) ? y : 0.5;
  r = r >= 0 && isSafeNum(r) ? r : 0.5;
  var canvasGradient = ctx.createRadialGradient(x, y, 0, x, y, r);
  return canvasGradient;
}
function getCanvasGradient(ctx, obj, rect) {
  var canvasGradient = obj.type === 'radial' ? createRadialGradient(ctx, obj, rect) : createLinearGradient(ctx, obj, rect);
  var colorStops = obj.colorStops;
  for (var i = 0; i < colorStops.length; i++) {
    canvasGradient.addColorStop(colorStops[i].offset, colorStops[i].color);
  }
  return canvasGradient;
}
function isClipPathChanged(clipPaths, prevClipPaths) {
  if (clipPaths === prevClipPaths || !clipPaths && !prevClipPaths) {
    return false;
  }
  if (!clipPaths || !prevClipPaths || clipPaths.length !== prevClipPaths.length) {
    return true;
  }
  for (var i = 0; i < clipPaths.length; i++) {
    if (clipPaths[i] !== prevClipPaths[i]) {
      return true;
    }
  }
  return false;
}
function parseInt10(val) {
  return parseInt(val, 10);
}
function getSize$1(root, whIdx, opts) {
  var wh = ['width', 'height'][whIdx];
  var cwh = ['clientWidth', 'clientHeight'][whIdx];
  var plt = ['paddingLeft', 'paddingTop'][whIdx];
  var prb = ['paddingRight', 'paddingBottom'][whIdx];
  if (opts[wh] != null && opts[wh] !== 'auto') {
    return parseFloat(opts[wh]);
  }
  var stl = document.defaultView.getComputedStyle(root);
  return (root[cwh] || parseInt10(stl[wh]) || parseInt10(root.style[wh])) - (parseInt10(stl[plt]) || 0) - (parseInt10(stl[prb]) || 0) | 0;
}

function normalizeLineDash(lineType, lineWidth) {
  if (!lineType || lineType === 'solid' || !(lineWidth > 0)) {
    return null;
  }
  return lineType === 'dashed' ? [4 * lineWidth, 2 * lineWidth] : lineType === 'dotted' ? [lineWidth] : isNumber(lineType) ? [lineType] : isArray$1(lineType) ? lineType : null;
}
function getLineDash(el) {
  var style = el.style;
  var lineDash = style.lineDash && style.lineWidth > 0 && normalizeLineDash(style.lineDash, style.lineWidth);
  var lineDashOffset = style.lineDashOffset;
  if (lineDash) {
    var lineScale_1 = style.strokeNoScale && el.getLineScale ? el.getLineScale() : 1;
    if (lineScale_1 && lineScale_1 !== 1) {
      lineDash = map$1(lineDash, function (rawVal) {
        return rawVal / lineScale_1;
      });
      lineDashOffset /= lineScale_1;
    }
  }
  return [lineDash, lineDashOffset];
}

var pathProxyForDraw = new PathProxy(true);
function styleHasStroke(style) {
  var stroke = style.stroke;
  return !(stroke == null || stroke === 'none' || !(style.lineWidth > 0));
}
function isValidStrokeFillStyle(strokeOrFill) {
  return typeof strokeOrFill === 'string' && strokeOrFill !== 'none';
}
function styleHasFill(style) {
  var fill = style.fill;
  return fill != null && fill !== 'none';
}
function doFillPath(ctx, style) {
  if (style.fillOpacity != null && style.fillOpacity !== 1) {
    var originalGlobalAlpha = ctx.globalAlpha;
    ctx.globalAlpha = style.fillOpacity * style.opacity;
    ctx.fill();
    ctx.globalAlpha = originalGlobalAlpha;
  } else {
    ctx.fill();
  }
}
function doStrokePath(ctx, style) {
  if (style.strokeOpacity != null && style.strokeOpacity !== 1) {
    var originalGlobalAlpha = ctx.globalAlpha;
    ctx.globalAlpha = style.strokeOpacity * style.opacity;
    ctx.stroke();
    ctx.globalAlpha = originalGlobalAlpha;
  } else {
    ctx.stroke();
  }
}
function createCanvasPattern(ctx, pattern, el) {
  var image = createOrUpdateImage(pattern.image, pattern.__image, el);
  if (isImageReady(image)) {
    var canvasPattern = ctx.createPattern(image, pattern.repeat || 'repeat');
    if (typeof DOMMatrix === 'function' && canvasPattern && canvasPattern.setTransform) {
      var matrix = new DOMMatrix();
      matrix.translateSelf(pattern.x || 0, pattern.y || 0);
      matrix.rotateSelf(0, 0, (pattern.rotation || 0) * RADIAN_TO_DEGREE);
      matrix.scaleSelf(pattern.scaleX || 1, pattern.scaleY || 1);
      canvasPattern.setTransform(matrix);
    }
    return canvasPattern;
  }
}
function brushPath(ctx, el, style, inBatch) {
  var _a;
  var hasStroke = styleHasStroke(style);
  var hasFill = styleHasFill(style);
  var strokePercent = style.strokePercent;
  var strokePart = strokePercent < 1;
  var firstDraw = !el.path;
  if ((!el.silent || strokePart) && firstDraw) {
    el.createPathProxy();
  }
  var path = el.path || pathProxyForDraw;
  var dirtyFlag = el.__dirty;
  if (!inBatch) {
    var fill = style.fill;
    var stroke = style.stroke;
    var hasFillGradient = hasFill && !!fill.colorStops;
    var hasStrokeGradient = hasStroke && !!stroke.colorStops;
    var hasFillPattern = hasFill && !!fill.image;
    var hasStrokePattern = hasStroke && !!stroke.image;
    var fillGradient = void 0;
    var strokeGradient = void 0;
    var fillPattern = void 0;
    var strokePattern = void 0;
    var rect = void 0;
    if (hasFillGradient || hasStrokeGradient) {
      rect = el.getBoundingRect();
    }
    if (hasFillGradient) {
      fillGradient = dirtyFlag ? getCanvasGradient(ctx, fill, rect) : el.__canvasFillGradient;
      el.__canvasFillGradient = fillGradient;
    }
    if (hasStrokeGradient) {
      strokeGradient = dirtyFlag ? getCanvasGradient(ctx, stroke, rect) : el.__canvasStrokeGradient;
      el.__canvasStrokeGradient = strokeGradient;
    }
    if (hasFillPattern) {
      fillPattern = dirtyFlag || !el.__canvasFillPattern ? createCanvasPattern(ctx, fill, el) : el.__canvasFillPattern;
      el.__canvasFillPattern = fillPattern;
    }
    if (hasStrokePattern) {
      strokePattern = dirtyFlag || !el.__canvasStrokePattern ? createCanvasPattern(ctx, stroke, el) : el.__canvasStrokePattern;
      el.__canvasStrokePattern = fillPattern;
    }
    if (hasFillGradient) {
      ctx.fillStyle = fillGradient;
    } else if (hasFillPattern) {
      if (fillPattern) {
        ctx.fillStyle = fillPattern;
      } else {
        hasFill = false;
      }
    }
    if (hasStrokeGradient) {
      ctx.strokeStyle = strokeGradient;
    } else if (hasStrokePattern) {
      if (strokePattern) {
        ctx.strokeStyle = strokePattern;
      } else {
        hasStroke = false;
      }
    }
  }
  var scale = el.getGlobalScale();
  path.setScale(scale[0], scale[1], el.segmentIgnoreThreshold);
  var lineDash;
  var lineDashOffset;
  if (ctx.setLineDash && style.lineDash) {
    _a = getLineDash(el), lineDash = _a[0], lineDashOffset = _a[1];
  }
  var needsRebuild = true;
  if (firstDraw || dirtyFlag & SHAPE_CHANGED_BIT) {
    path.setDPR(ctx.dpr);
    if (strokePart) {
      path.setContext(null);
    } else {
      path.setContext(ctx);
      needsRebuild = false;
    }
    path.reset();
    el.buildPath(path, el.shape, inBatch);
    path.toStatic();
    el.pathUpdated();
  }
  if (needsRebuild) {
    path.rebuildPath(ctx, strokePart ? strokePercent : 1);
  }
  if (lineDash) {
    ctx.setLineDash(lineDash);
    ctx.lineDashOffset = lineDashOffset;
  }
  if (!inBatch) {
    if (style.strokeFirst) {
      if (hasStroke) {
        doStrokePath(ctx, style);
      }
      if (hasFill) {
        doFillPath(ctx, style);
      }
    } else {
      if (hasFill) {
        doFillPath(ctx, style);
      }
      if (hasStroke) {
        doStrokePath(ctx, style);
      }
    }
  }
  if (lineDash) {
    ctx.setLineDash([]);
  }
}
function brushImage(ctx, el, style) {
  var image = el.__image = createOrUpdateImage(style.image, el.__image, el, el.onload);
  if (!image || !isImageReady(image)) {
    return;
  }
  var x = style.x || 0;
  var y = style.y || 0;
  var width = el.getWidth();
  var height = el.getHeight();
  var aspect = image.width / image.height;
  if (width == null && height != null) {
    width = height * aspect;
  } else if (height == null && width != null) {
    height = width / aspect;
  } else if (width == null && height == null) {
    width = image.width;
    height = image.height;
  }
  if (style.sWidth && style.sHeight) {
    var sx = style.sx || 0;
    var sy = style.sy || 0;
    ctx.drawImage(image, sx, sy, style.sWidth, style.sHeight, x, y, width, height);
  } else if (style.sx && style.sy) {
    var sx = style.sx;
    var sy = style.sy;
    var sWidth = width - sx;
    var sHeight = height - sy;
    ctx.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height);
  } else {
    ctx.drawImage(image, x, y, width, height);
  }
}
function brushText(ctx, el, style) {
  var _a;
  var text = style.text;
  text != null && (text += '');
  if (text) {
    ctx.font = style.font || DEFAULT_FONT;
    ctx.textAlign = style.textAlign;
    ctx.textBaseline = style.textBaseline;
    var lineDash = void 0;
    var lineDashOffset = void 0;
    if (ctx.setLineDash && style.lineDash) {
      _a = getLineDash(el), lineDash = _a[0], lineDashOffset = _a[1];
    }
    if (lineDash) {
      ctx.setLineDash(lineDash);
      ctx.lineDashOffset = lineDashOffset;
    }
    if (style.strokeFirst) {
      if (styleHasStroke(style)) {
        ctx.strokeText(text, style.x, style.y);
      }
      if (styleHasFill(style)) {
        ctx.fillText(text, style.x, style.y);
      }
    } else {
      if (styleHasFill(style)) {
        ctx.fillText(text, style.x, style.y);
      }
      if (styleHasStroke(style)) {
        ctx.strokeText(text, style.x, style.y);
      }
    }
    if (lineDash) {
      ctx.setLineDash([]);
    }
  }
}
var SHADOW_NUMBER_PROPS = ['shadowBlur', 'shadowOffsetX', 'shadowOffsetY'];
var STROKE_PROPS = [['lineCap', 'butt'], ['lineJoin', 'miter'], ['miterLimit', 10]];
function bindCommonProps(ctx, style, prevStyle, forceSetAll, scope) {
  var styleChanged = false;
  if (!forceSetAll) {
    prevStyle = prevStyle || {};
    if (style === prevStyle) {
      return false;
    }
  }
  if (forceSetAll || style.opacity !== prevStyle.opacity) {
    flushPathDrawn(ctx, scope);
    styleChanged = true;
    var opacity = Math.max(Math.min(style.opacity, 1), 0);
    ctx.globalAlpha = isNaN(opacity) ? DEFAULT_COMMON_STYLE.opacity : opacity;
  }
  if (forceSetAll || style.blend !== prevStyle.blend) {
    if (!styleChanged) {
      flushPathDrawn(ctx, scope);
      styleChanged = true;
    }
    ctx.globalCompositeOperation = style.blend || DEFAULT_COMMON_STYLE.blend;
  }
  for (var i = 0; i < SHADOW_NUMBER_PROPS.length; i++) {
    var propName = SHADOW_NUMBER_PROPS[i];
    if (forceSetAll || style[propName] !== prevStyle[propName]) {
      if (!styleChanged) {
        flushPathDrawn(ctx, scope);
        styleChanged = true;
      }
      ctx[propName] = ctx.dpr * (style[propName] || 0);
    }
  }
  if (forceSetAll || style.shadowColor !== prevStyle.shadowColor) {
    if (!styleChanged) {
      flushPathDrawn(ctx, scope);
      styleChanged = true;
    }
    ctx.shadowColor = style.shadowColor || DEFAULT_COMMON_STYLE.shadowColor;
  }
  return styleChanged;
}
function bindPathAndTextCommonStyle(ctx, el, prevEl, forceSetAll, scope) {
  var style = getStyle(el, scope.inHover);
  var prevStyle = forceSetAll ? null : prevEl && getStyle(prevEl, scope.inHover) || {};
  if (style === prevStyle) {
    return false;
  }
  var styleChanged = bindCommonProps(ctx, style, prevStyle, forceSetAll, scope);
  if (forceSetAll || style.fill !== prevStyle.fill) {
    if (!styleChanged) {
      flushPathDrawn(ctx, scope);
      styleChanged = true;
    }
    isValidStrokeFillStyle(style.fill) && (ctx.fillStyle = style.fill);
  }
  if (forceSetAll || style.stroke !== prevStyle.stroke) {
    if (!styleChanged) {
      flushPathDrawn(ctx, scope);
      styleChanged = true;
    }
    isValidStrokeFillStyle(style.stroke) && (ctx.strokeStyle = style.stroke);
  }
  if (forceSetAll || style.opacity !== prevStyle.opacity) {
    if (!styleChanged) {
      flushPathDrawn(ctx, scope);
      styleChanged = true;
    }
    ctx.globalAlpha = style.opacity == null ? 1 : style.opacity;
  }
  if (el.hasStroke()) {
    var lineWidth = style.lineWidth;
    var newLineWidth = lineWidth / (style.strokeNoScale && el.getLineScale ? el.getLineScale() : 1);
    if (ctx.lineWidth !== newLineWidth) {
      if (!styleChanged) {
        flushPathDrawn(ctx, scope);
        styleChanged = true;
      }
      ctx.lineWidth = newLineWidth;
    }
  }
  for (var i = 0; i < STROKE_PROPS.length; i++) {
    var prop = STROKE_PROPS[i];
    var propName = prop[0];
    if (forceSetAll || style[propName] !== prevStyle[propName]) {
      if (!styleChanged) {
        flushPathDrawn(ctx, scope);
        styleChanged = true;
      }
      ctx[propName] = style[propName] || prop[1];
    }
  }
  return styleChanged;
}
function bindImageStyle(ctx, el, prevEl, forceSetAll, scope) {
  return bindCommonProps(ctx, getStyle(el, scope.inHover), prevEl && getStyle(prevEl, scope.inHover), forceSetAll, scope);
}
function setContextTransform(ctx, el) {
  var m = el.transform;
  var dpr = ctx.dpr || 1;
  if (m) {
    ctx.setTransform(dpr * m[0], dpr * m[1], dpr * m[2], dpr * m[3], dpr * m[4], dpr * m[5]);
  } else {
    ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
  }
}
function updateClipStatus(clipPaths, ctx, scope) {
  var allClipped = false;
  for (var i = 0; i < clipPaths.length; i++) {
    var clipPath = clipPaths[i];
    allClipped = allClipped || clipPath.isZeroArea();
    setContextTransform(ctx, clipPath);
    ctx.beginPath();
    clipPath.buildPath(ctx, clipPath.shape);
    ctx.clip();
  }
  scope.allClipped = allClipped;
}
function isTransformChanged(m0, m1) {
  if (m0 && m1) {
    return m0[0] !== m1[0] || m0[1] !== m1[1] || m0[2] !== m1[2] || m0[3] !== m1[3] || m0[4] !== m1[4] || m0[5] !== m1[5];
  } else if (!m0 && !m1) {
    return false;
  }
  return true;
}
var DRAW_TYPE_PATH = 1;
var DRAW_TYPE_IMAGE = 2;
var DRAW_TYPE_TEXT = 3;
var DRAW_TYPE_INCREMENTAL = 4;
function canPathBatch(style) {
  var hasFill = styleHasFill(style);
  var hasStroke = styleHasStroke(style);
  return !(style.lineDash || !(+hasFill ^ +hasStroke) || hasFill && typeof style.fill !== 'string' || hasStroke && typeof style.stroke !== 'string' || style.strokePercent < 1 || style.strokeOpacity < 1 || style.fillOpacity < 1);
}
function flushPathDrawn(ctx, scope) {
  scope.batchFill && ctx.fill();
  scope.batchStroke && ctx.stroke();
  scope.batchFill = '';
  scope.batchStroke = '';
}
function getStyle(el, inHover) {
  return inHover ? el.__hoverStyle || el.style : el.style;
}
function brushSingle(ctx, el) {
  brush$1(ctx, el, {
    inHover: false,
    viewWidth: 0,
    viewHeight: 0
  }, true);
}
function brush$1(ctx, el, scope, isLast) {
  var m = el.transform;
  if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {
    el.__dirty &= ~REDRAW_BIT;
    el.__isRendered = false;
    return;
  }
  var clipPaths = el.__clipPaths;
  var prevElClipPaths = scope.prevElClipPaths;
  var forceSetTransform = false;
  var forceSetStyle = false;
  if (!prevElClipPaths || isClipPathChanged(clipPaths, prevElClipPaths)) {
    if (prevElClipPaths && prevElClipPaths.length) {
      flushPathDrawn(ctx, scope);
      ctx.restore();
      forceSetStyle = forceSetTransform = true;
      scope.prevElClipPaths = null;
      scope.allClipped = false;
      scope.prevEl = null;
    }
    if (clipPaths && clipPaths.length) {
      flushPathDrawn(ctx, scope);
      ctx.save();
      updateClipStatus(clipPaths, ctx, scope);
      forceSetTransform = true;
    }
    scope.prevElClipPaths = clipPaths;
  }
  if (scope.allClipped) {
    el.__isRendered = false;
    return;
  }
  el.beforeBrush && el.beforeBrush();
  el.innerBeforeBrush();
  var prevEl = scope.prevEl;
  if (!prevEl) {
    forceSetStyle = forceSetTransform = true;
  }
  var canBatchPath = el instanceof Path$1 && el.autoBatch && canPathBatch(el.style);
  if (forceSetTransform || isTransformChanged(m, prevEl.transform)) {
    flushPathDrawn(ctx, scope);
    setContextTransform(ctx, el);
  } else if (!canBatchPath) {
    flushPathDrawn(ctx, scope);
  }
  var style = getStyle(el, scope.inHover);
  if (el instanceof Path$1) {
    if (scope.lastDrawType !== DRAW_TYPE_PATH) {
      forceSetStyle = true;
      scope.lastDrawType = DRAW_TYPE_PATH;
    }
    bindPathAndTextCommonStyle(ctx, el, prevEl, forceSetStyle, scope);
    if (!canBatchPath || !scope.batchFill && !scope.batchStroke) {
      ctx.beginPath();
    }
    brushPath(ctx, el, style, canBatchPath);
    if (canBatchPath) {
      scope.batchFill = style.fill || '';
      scope.batchStroke = style.stroke || '';
    }
  } else {
    if (el instanceof TSpan$1) {
      if (scope.lastDrawType !== DRAW_TYPE_TEXT) {
        forceSetStyle = true;
        scope.lastDrawType = DRAW_TYPE_TEXT;
      }
      bindPathAndTextCommonStyle(ctx, el, prevEl, forceSetStyle, scope);
      brushText(ctx, el, style);
    } else if (el instanceof ZRImage$1) {
      if (scope.lastDrawType !== DRAW_TYPE_IMAGE) {
        forceSetStyle = true;
        scope.lastDrawType = DRAW_TYPE_IMAGE;
      }
      bindImageStyle(ctx, el, prevEl, forceSetStyle, scope);
      brushImage(ctx, el, style);
    } else if (el.getTemporalDisplayables) {
      if (scope.lastDrawType !== DRAW_TYPE_INCREMENTAL) {
        forceSetStyle = true;
        scope.lastDrawType = DRAW_TYPE_INCREMENTAL;
      }
      brushIncremental(ctx, el, scope);
    }
  }
  if (canBatchPath && isLast) {
    flushPathDrawn(ctx, scope);
  }
  el.innerAfterBrush();
  el.afterBrush && el.afterBrush();
  scope.prevEl = el;
  el.__dirty = 0;
  el.__isRendered = true;
}
function brushIncremental(ctx, el, scope) {
  var displayables = el.getDisplayables();
  var temporalDisplayables = el.getTemporalDisplayables();
  ctx.save();
  var innerScope = {
    prevElClipPaths: null,
    prevEl: null,
    allClipped: false,
    viewWidth: scope.viewWidth,
    viewHeight: scope.viewHeight,
    inHover: scope.inHover
  };
  var i;
  var len;
  for (i = el.getCursor(), len = displayables.length; i < len; i++) {
    var displayable = displayables[i];
    displayable.beforeBrush && displayable.beforeBrush();
    displayable.innerBeforeBrush();
    brush$1(ctx, displayable, innerScope, i === len - 1);
    displayable.innerAfterBrush();
    displayable.afterBrush && displayable.afterBrush();
    innerScope.prevEl = displayable;
  }
  for (var i_1 = 0, len_1 = temporalDisplayables.length; i_1 < len_1; i_1++) {
    var displayable = temporalDisplayables[i_1];
    displayable.beforeBrush && displayable.beforeBrush();
    displayable.innerBeforeBrush();
    brush$1(ctx, displayable, innerScope, i_1 === len_1 - 1);
    displayable.innerAfterBrush();
    displayable.afterBrush && displayable.afterBrush();
    innerScope.prevEl = displayable;
  }
  el.clearTemporalDisplayables();
  el.notClear = true;
  ctx.restore();
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var decalMap = new WeakMap$2();
var decalCache = new LRU$1(100);
var decalKeys = ['symbol', 'symbolSize', 'symbolKeepAspect', 'color', 'backgroundColor', 'dashArrayX', 'dashArrayY', 'maxTileWidth', 'maxTileHeight'];
/**
 * Create or update pattern image from decal options
 *
 * @param {InnerDecalObject | 'none'} decalObject decal options, 'none' if no decal
 * @return {Pattern} pattern with generated image, null if no decal
 */
function createOrUpdatePatternFromDecal(decalObject, api) {
  if (decalObject === 'none') {
    return null;
  }
  var dpr = api.getDevicePixelRatio();
  var zr = api.getZr();
  var isSVG = zr.painter.type === 'svg';
  if (decalObject.dirty) {
    decalMap["delete"](decalObject);
  }
  var oldPattern = decalMap.get(decalObject);
  if (oldPattern) {
    return oldPattern;
  }
  var decalOpt = defaults(decalObject, {
    symbol: 'rect',
    symbolSize: 1,
    symbolKeepAspect: true,
    color: 'rgba(0, 0, 0, 0.2)',
    backgroundColor: null,
    dashArrayX: 5,
    dashArrayY: 5,
    rotation: 0,
    maxTileWidth: 512,
    maxTileHeight: 512
  });
  if (decalOpt.backgroundColor === 'none') {
    decalOpt.backgroundColor = null;
  }
  var pattern = {
    repeat: 'repeat'
  };
  setPatternnSource(pattern);
  pattern.rotation = decalOpt.rotation;
  pattern.scaleX = pattern.scaleY = isSVG ? 1 : 1 / dpr;
  decalMap.set(decalObject, pattern);
  decalObject.dirty = false;
  return pattern;
  function setPatternnSource(pattern) {
    var keys = [dpr];
    var isValidKey = true;
    for (var i = 0; i < decalKeys.length; ++i) {
      var value = decalOpt[decalKeys[i]];
      if (value != null && !isArray$1(value) && !isString(value) && !isNumber(value) && typeof value !== 'boolean') {
        isValidKey = false;
        break;
      }
      keys.push(value);
    }
    var cacheKey;
    if (isValidKey) {
      cacheKey = keys.join(',') + (isSVG ? '-svg' : '');
      var cache = decalCache.get(cacheKey);
      if (cache) {
        isSVG ? pattern.svgElement = cache : pattern.image = cache;
      }
    }
    var dashArrayX = normalizeDashArrayX(decalOpt.dashArrayX);
    var dashArrayY = normalizeDashArrayY(decalOpt.dashArrayY);
    var symbolArray = normalizeSymbolArray(decalOpt.symbol);
    var lineBlockLengthsX = getLineBlockLengthX(dashArrayX);
    var lineBlockLengthY = getLineBlockLengthY(dashArrayY);
    var canvas = !isSVG && platformApi.createCanvas();
    var svgRoot = isSVG && {
      tag: 'g',
      attrs: {},
      key: 'dcl',
      children: []
    };
    var pSize = getPatternSize();
    var ctx;
    if (canvas) {
      canvas.width = pSize.width * dpr;
      canvas.height = pSize.height * dpr;
      ctx = canvas.getContext('2d');
    }
    brushDecal();
    if (isValidKey) {
      decalCache.put(cacheKey, canvas || svgRoot);
    }
    pattern.image = canvas;
    pattern.svgElement = svgRoot;
    pattern.svgWidth = pSize.width;
    pattern.svgHeight = pSize.height;
    /**
     * Get minimum length that can make a repeatable pattern.
     *
     * @return {Object} pattern width and height
     */
    function getPatternSize() {
      /**
       * For example, if dash is [[3, 2], [2, 1]] for X, it looks like
       * |---  ---  ---  ---  --- ...
       * |-- -- -- -- -- -- -- -- ...
       * |---  ---  ---  ---  --- ...
       * |-- -- -- -- -- -- -- -- ...
       * So the minimum length of X is 15,
       * which is the least common multiple of `3 + 2` and `2 + 1`
       * |---  ---  ---  |---  --- ...
       * |-- -- -- -- -- |-- -- -- ...
       */
      var width = 1;
      for (var i = 0, xlen = lineBlockLengthsX.length; i < xlen; ++i) {
        width = getLeastCommonMultiple(width, lineBlockLengthsX[i]);
      }
      var symbolRepeats = 1;
      for (var i = 0, xlen = symbolArray.length; i < xlen; ++i) {
        symbolRepeats = getLeastCommonMultiple(symbolRepeats, symbolArray[i].length);
      }
      width *= symbolRepeats;
      var height = lineBlockLengthY * lineBlockLengthsX.length * symbolArray.length;
      {
        var warn = function (attrName) {
          /* eslint-disable-next-line */
          console.warn("Calculated decal size is greater than " + attrName + " due to decal option settings so " + attrName + " is used for the decal size. Please consider changing the decal option to make a smaller decal or set " + attrName + " to be larger to avoid incontinuity.");
        };
        if (width > decalOpt.maxTileWidth) {
          warn('maxTileWidth');
        }
        if (height > decalOpt.maxTileHeight) {
          warn('maxTileHeight');
        }
      }
      return {
        width: Math.max(1, Math.min(width, decalOpt.maxTileWidth)),
        height: Math.max(1, Math.min(height, decalOpt.maxTileHeight))
      };
    }
    function brushDecal() {
      if (ctx) {
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        if (decalOpt.backgroundColor) {
          ctx.fillStyle = decalOpt.backgroundColor;
          ctx.fillRect(0, 0, canvas.width, canvas.height);
        }
      }
      var ySum = 0;
      for (var i = 0; i < dashArrayY.length; ++i) {
        ySum += dashArrayY[i];
      }
      if (ySum <= 0) {
        // dashArrayY is 0, draw nothing
        return;
      }
      var y = -lineBlockLengthY;
      var yId = 0;
      var yIdTotal = 0;
      var xId0 = 0;
      while (y < pSize.height) {
        if (yId % 2 === 0) {
          var symbolYId = yIdTotal / 2 % symbolArray.length;
          var x = 0;
          var xId1 = 0;
          var xId1Total = 0;
          while (x < pSize.width * 2) {
            var xSum = 0;
            for (var i = 0; i < dashArrayX[xId0].length; ++i) {
              xSum += dashArrayX[xId0][i];
            }
            if (xSum <= 0) {
              // Skip empty line
              break;
            }
            // E.g., [15, 5, 20, 5] draws only for 15 and 20
            if (xId1 % 2 === 0) {
              var size = (1 - decalOpt.symbolSize) * 0.5;
              var left = x + dashArrayX[xId0][xId1] * size;
              var top_1 = y + dashArrayY[yId] * size;
              var width = dashArrayX[xId0][xId1] * decalOpt.symbolSize;
              var height = dashArrayY[yId] * decalOpt.symbolSize;
              var symbolXId = xId1Total / 2 % symbolArray[symbolYId].length;
              brushSymbol(left, top_1, width, height, symbolArray[symbolYId][symbolXId]);
            }
            x += dashArrayX[xId0][xId1];
            ++xId1Total;
            ++xId1;
            if (xId1 === dashArrayX[xId0].length) {
              xId1 = 0;
            }
          }
          ++xId0;
          if (xId0 === dashArrayX.length) {
            xId0 = 0;
          }
        }
        y += dashArrayY[yId];
        ++yIdTotal;
        ++yId;
        if (yId === dashArrayY.length) {
          yId = 0;
        }
      }
      function brushSymbol(x, y, width, height, symbolType) {
        var scale = isSVG ? 1 : dpr;
        var symbol = createSymbol$1(symbolType, x * scale, y * scale, width * scale, height * scale, decalOpt.color, decalOpt.symbolKeepAspect);
        if (isSVG) {
          var symbolVNode = zr.painter.renderOneToVNode(symbol);
          if (symbolVNode) {
            svgRoot.children.push(symbolVNode);
          }
        } else {
          // Paint to canvas for all other renderers.
          brushSingle(ctx, symbol);
        }
      }
    }
  }
}
/**
 * Convert symbol array into normalized array
 *
 * @param {string | (string | string[])[]} symbol symbol input
 * @return {string[][]} normolized symbol array
 */
function normalizeSymbolArray(symbol) {
  if (!symbol || symbol.length === 0) {
    return [['rect']];
  }
  if (isString(symbol)) {
    return [[symbol]];
  }
  var isAllString = true;
  for (var i = 0; i < symbol.length; ++i) {
    if (!isString(symbol[i])) {
      isAllString = false;
      break;
    }
  }
  if (isAllString) {
    return normalizeSymbolArray([symbol]);
  }
  var result = [];
  for (var i = 0; i < symbol.length; ++i) {
    if (isString(symbol[i])) {
      result.push([symbol[i]]);
    } else {
      result.push(symbol[i]);
    }
  }
  return result;
}
/**
 * Convert dash input into dashArray
 *
 * @param {DecalDashArrayX} dash dash input
 * @return {number[][]} normolized dash array
 */
function normalizeDashArrayX(dash) {
  if (!dash || dash.length === 0) {
    return [[0, 0]];
  }
  if (isNumber(dash)) {
    var dashValue = Math.ceil(dash);
    return [[dashValue, dashValue]];
  }
  /**
   * [20, 5] should be normalized into [[20, 5]],
   * while [20, [5, 10]] should be normalized into [[20, 20], [5, 10]]
   */
  var isAllNumber = true;
  for (var i = 0; i < dash.length; ++i) {
    if (!isNumber(dash[i])) {
      isAllNumber = false;
      break;
    }
  }
  if (isAllNumber) {
    return normalizeDashArrayX([dash]);
  }
  var result = [];
  for (var i = 0; i < dash.length; ++i) {
    if (isNumber(dash[i])) {
      var dashValue = Math.ceil(dash[i]);
      result.push([dashValue, dashValue]);
    } else {
      var dashValue = map$1(dash[i], function (n) {
        return Math.ceil(n);
      });
      if (dashValue.length % 2 === 1) {
        // [4, 2, 1] means |----  -    -- |----  -    -- |
        // so normalize it to be [4, 2, 1, 4, 2, 1]
        result.push(dashValue.concat(dashValue));
      } else {
        result.push(dashValue);
      }
    }
  }
  return result;
}
/**
 * Convert dash input into dashArray
 *
 * @param {DecalDashArrayY} dash dash input
 * @return {number[]} normolized dash array
 */
function normalizeDashArrayY(dash) {
  if (!dash || typeof dash === 'object' && dash.length === 0) {
    return [0, 0];
  }
  if (isNumber(dash)) {
    var dashValue_1 = Math.ceil(dash);
    return [dashValue_1, dashValue_1];
  }
  var dashValue = map$1(dash, function (n) {
    return Math.ceil(n);
  });
  return dash.length % 2 ? dashValue.concat(dashValue) : dashValue;
}
/**
 * Get block length of each line. A block is the length of dash line and space.
 * For example, a line with [4, 1] has a dash line of 4 and a space of 1 after
 * that, so the block length of this line is 5.
 *
 * @param {number[][]} dash dash array of X or Y
 * @return {number[]} block length of each line
 */
function getLineBlockLengthX(dash) {
  return map$1(dash, function (line) {
    return getLineBlockLengthY(line);
  });
}
function getLineBlockLengthY(dash) {
  var blockLength = 0;
  for (var i = 0; i < dash.length; ++i) {
    blockLength += dash[i];
  }
  if (dash.length % 2 === 1) {
    // [4, 2, 1] means |----  -    -- |----  -    -- |
    // So total length is (4 + 2 + 1) * 2
    return blockLength * 2;
  }
  return blockLength;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function decalVisual(ecModel, api) {
  ecModel.eachRawSeries(function (seriesModel) {
    if (ecModel.isSeriesFiltered(seriesModel)) {
      return;
    }
    var data = seriesModel.getData();
    if (data.hasItemVisual()) {
      data.each(function (idx) {
        var decal = data.getItemVisual(idx, 'decal');
        if (decal) {
          var itemStyle = data.ensureUniqueItemVisual(idx, 'style');
          itemStyle.decal = createOrUpdatePatternFromDecal(decal, api);
        }
      });
    }
    var decal = data.getVisual('decal');
    if (decal) {
      var style = data.getVisual('style');
      style.decal = createOrUpdatePatternFromDecal(decal, api);
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var lifecycle = new Eventful$1();
var lifecycle$1 = lifecycle;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Implementation of exported APIs. For example registerMap, getMap.
// The implementations will be registered when installing the component.
// Avoid these code being bundled to the core module.
var implsStore = {};
// TODO Type
function registerImpl(name, impl) {
  {
    if (implsStore[name]) {
      error("Already has an implementation of " + name + ".");
    }
  }
  implsStore[name] = impl;
}
function getImpl(name) {
  {
    if (!implsStore[name]) {
      error("Implementation of " + name + " doesn't exists.");
    }
  }
  return implsStore[name];
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TEST_FRAME_REMAIN_TIME = 1;
var PRIORITY_PROCESSOR_SERIES_FILTER = 800;
// Some data processors depends on the stack result dimension (to calculate data extent).
// So data stack stage should be in front of data processing stage.
var PRIORITY_PROCESSOR_DATASTACK = 900;
// "Data filter" will block the stream, so it should be
// put at the beginning of data processing.
var PRIORITY_PROCESSOR_FILTER = 1000;
var PRIORITY_PROCESSOR_DEFAULT = 2000;
var PRIORITY_PROCESSOR_STATISTIC = 5000;
var PRIORITY_VISUAL_LAYOUT = 1000;
var PRIORITY_VISUAL_PROGRESSIVE_LAYOUT = 1100;
var PRIORITY_VISUAL_GLOBAL = 2000;
var PRIORITY_VISUAL_CHART = 3000;
var PRIORITY_VISUAL_COMPONENT = 4000;
// Visual property in data. Greater than `PRIORITY_VISUAL_COMPONENT` to enable to
// overwrite the viusal result of component (like `visualMap`)
// using data item specific setting (like itemStyle.xxx on data item)
var PRIORITY_VISUAL_CHART_DATA_CUSTOM = 4500;
// Greater than `PRIORITY_VISUAL_CHART_DATA_CUSTOM` to enable to layout based on
// visual result like `symbolSize`.
var PRIORITY_VISUAL_POST_CHART_LAYOUT = 4600;
var PRIORITY_VISUAL_BRUSH = 5000;
var PRIORITY_VISUAL_ARIA = 6000;
var PRIORITY_VISUAL_DECAL = 7000;
var PRIORITY = {
  PROCESSOR: {
    FILTER: PRIORITY_PROCESSOR_FILTER,
    SERIES_FILTER: PRIORITY_PROCESSOR_SERIES_FILTER,
    STATISTIC: PRIORITY_PROCESSOR_STATISTIC
  },
  VISUAL: {
    LAYOUT: PRIORITY_VISUAL_LAYOUT,
    PROGRESSIVE_LAYOUT: PRIORITY_VISUAL_PROGRESSIVE_LAYOUT,
    GLOBAL: PRIORITY_VISUAL_GLOBAL,
    CHART: PRIORITY_VISUAL_CHART,
    POST_CHART_LAYOUT: PRIORITY_VISUAL_POST_CHART_LAYOUT,
    COMPONENT: PRIORITY_VISUAL_COMPONENT,
    BRUSH: PRIORITY_VISUAL_BRUSH,
    CHART_ITEM: PRIORITY_VISUAL_CHART_DATA_CUSTOM,
    ARIA: PRIORITY_VISUAL_ARIA,
    DECAL: PRIORITY_VISUAL_DECAL
  }
};
// Main process have three entries: `setOption`, `dispatchAction` and `resize`,
// where they must not be invoked nestedly, except the only case: invoke
// dispatchAction with updateMethod "none" in main process.
// This flag is used to carry out this rule.
// All events will be triggered out side main process (i.e. when !this[IN_MAIN_PROCESS]).
var IN_MAIN_PROCESS_KEY = '__flagInMainProcess';
var PENDING_UPDATE = '__pendingUpdate';
var STATUS_NEEDS_UPDATE_KEY = '__needsUpdateStatus';
var ACTION_REG = /^[a-zA-Z0-9_]+$/;
var CONNECT_STATUS_KEY = '__connectUpdateStatus';
var CONNECT_STATUS_PENDING = 0;
var CONNECT_STATUS_UPDATING = 1;
var CONNECT_STATUS_UPDATED = 2;
function createRegisterEventWithLowercaseECharts(method) {
  return function () {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
      args[_i] = arguments[_i];
    }
    if (this.isDisposed()) {
      disposedWarning(this.id);
      return;
    }
    return toLowercaseNameAndCallEventful(this, method, args);
  };
}
function createRegisterEventWithLowercaseMessageCenter(method) {
  return function () {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
      args[_i] = arguments[_i];
    }
    return toLowercaseNameAndCallEventful(this, method, args);
  };
}
function toLowercaseNameAndCallEventful(host, method, args) {
  // `args[0]` is event name. Event name is all lowercase.
  args[0] = args[0] && args[0].toLowerCase();
  return Eventful$1.prototype[method].apply(host, args);
}
var MessageCenter = /** @class */function (_super) {
  __extends(MessageCenter, _super);
  function MessageCenter() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  return MessageCenter;
}(Eventful$1);
var messageCenterProto = MessageCenter.prototype;
messageCenterProto.on = createRegisterEventWithLowercaseMessageCenter('on');
messageCenterProto.off = createRegisterEventWithLowercaseMessageCenter('off');
// ---------------------------------------
// Internal method names for class ECharts
// ---------------------------------------
var prepare;
var prepareView;
var updateDirectly;
var updateMethods;
var doConvertPixel;
var updateStreamModes;
var doDispatchAction;
var flushPendingActions;
var triggerUpdatedEvent;
var bindRenderedEvent;
var bindMouseEvent;
var render;
var renderComponents;
var renderSeries;
var createExtensionAPI;
var enableConnect;
var markStatusToUpdate;
var applyChangedStates;
var ECharts = /** @class */function (_super) {
  __extends(ECharts, _super);
  function ECharts(dom,
  // Theme name or themeOption.
  theme, opts) {
    var _this = _super.call(this, new ECEventProcessor()) || this;
    _this._chartsViews = [];
    _this._chartsMap = {};
    _this._componentsViews = [];
    _this._componentsMap = {};
    // Can't dispatch action during rendering procedure
    _this._pendingActions = [];
    opts = opts || {};
    // Get theme by name
    if (isString(theme)) {
      theme = themeStorage[theme];
    }
    _this._dom = dom;
    var defaultRenderer = 'canvas';
    var defaultCoarsePointer = 'auto';
    var defaultUseDirtyRect = false;
    {
      var root = /* eslint-disable-next-line */
      env$1.hasGlobalWindow ? window : global;
      if (root) {
        defaultRenderer = retrieve2(root.__ECHARTS__DEFAULT__RENDERER__, defaultRenderer);
        defaultCoarsePointer = retrieve2(root.__ECHARTS__DEFAULT__COARSE_POINTER, defaultCoarsePointer);
        defaultUseDirtyRect = retrieve2(root.__ECHARTS__DEFAULT__USE_DIRTY_RECT__, defaultUseDirtyRect);
      }
    }
    if (opts.ssr) {
      registerSSRDataGetter(function (el) {
        var ecData = getECData(el);
        var dataIndex = ecData.dataIndex;
        if (dataIndex == null) {
          return;
        }
        var hashMap = createHashMap();
        hashMap.set('series_index', ecData.seriesIndex);
        hashMap.set('data_index', dataIndex);
        ecData.ssrType && hashMap.set('ssr_type', ecData.ssrType);
        return hashMap;
      });
    }
    var zr = _this._zr = init$2(dom, {
      renderer: opts.renderer || defaultRenderer,
      devicePixelRatio: opts.devicePixelRatio,
      width: opts.width,
      height: opts.height,
      ssr: opts.ssr,
      useDirtyRect: retrieve2(opts.useDirtyRect, defaultUseDirtyRect),
      useCoarsePointer: retrieve2(opts.useCoarsePointer, defaultCoarsePointer),
      pointerSize: opts.pointerSize
    });
    _this._ssr = opts.ssr;
    // Expect 60 fps.
    _this._throttledZrFlush = throttle(bind$1(zr.flush, zr), 17);
    theme = clone$4(theme);
    theme && globalBackwardCompat(theme, true);
    _this._theme = theme;
    _this._locale = createLocaleObject(opts.locale || SYSTEM_LANG);
    _this._coordSysMgr = new CoordinateSystem();
    var api = _this._api = createExtensionAPI(_this);
    // Sort on demand
    function prioritySortFunc(a, b) {
      return a.__prio - b.__prio;
    }
    sort$2(visualFuncs, prioritySortFunc);
    sort$2(dataProcessorFuncs, prioritySortFunc);
    _this._scheduler = new Scheduler$1(_this, api, dataProcessorFuncs, visualFuncs);
    _this._messageCenter = new MessageCenter();
    // Init mouse events
    _this._initEvents();
    // In case some people write `window.onresize = chart.resize`
    _this.resize = bind$1(_this.resize, _this);
    zr.animation.on('frame', _this._onframe, _this);
    bindRenderedEvent(zr, _this);
    bindMouseEvent(zr, _this);
    // ECharts instance can be used as value.
    setAsPrimitive(_this);
    return _this;
  }
  ECharts.prototype._onframe = function () {
    if (this._disposed) {
      return;
    }
    applyChangedStates(this);
    var scheduler = this._scheduler;
    // Lazy update
    if (this[PENDING_UPDATE]) {
      var silent = this[PENDING_UPDATE].silent;
      this[IN_MAIN_PROCESS_KEY] = true;
      try {
        prepare(this);
        updateMethods.update.call(this, null, this[PENDING_UPDATE].updateParams);
      } catch (e) {
        this[IN_MAIN_PROCESS_KEY] = false;
        this[PENDING_UPDATE] = null;
        throw e;
      }
      // At present, in each frame, zrender performs:
      //   (1) animation step forward.
      //   (2) trigger('frame') (where this `_onframe` is called)
      //   (3) zrender flush (render).
      // If we do nothing here, since we use `setToFinal: true`, the step (3) above
      // will render the final state of the elements before the real animation started.
      this._zr.flush();
      this[IN_MAIN_PROCESS_KEY] = false;
      this[PENDING_UPDATE] = null;
      flushPendingActions.call(this, silent);
      triggerUpdatedEvent.call(this, silent);
    }
    // Avoid do both lazy update and progress in one frame.
    else if (scheduler.unfinished) {
      // Stream progress.
      var remainTime = TEST_FRAME_REMAIN_TIME;
      var ecModel = this._model;
      var api = this._api;
      scheduler.unfinished = false;
      do {
        var startTime = +new Date();
        scheduler.performSeriesTasks(ecModel);
        // Currently dataProcessorFuncs do not check threshold.
        scheduler.performDataProcessorTasks(ecModel);
        updateStreamModes(this, ecModel);
        // Do not update coordinate system here. Because that coord system update in
        // each frame is not a good user experience. So we follow the rule that
        // the extent of the coordinate system is determined in the first frame (the
        // frame is executed immediately after task reset.
        // this._coordSysMgr.update(ecModel, api);
        // console.log('--- ec frame visual ---', remainTime);
        scheduler.performVisualTasks(ecModel);
        renderSeries(this, this._model, api, 'remain', {});
        remainTime -= +new Date() - startTime;
      } while (remainTime > 0 && scheduler.unfinished);
      // Call flush explicitly for trigger finished event.
      if (!scheduler.unfinished) {
        this._zr.flush();
      }
      // Else, zr flushing be ensue within the same frame,
      // because zr flushing is after onframe event.
    }
  };
  ECharts.prototype.getDom = function () {
    return this._dom;
  };
  ECharts.prototype.getId = function () {
    return this.id;
  };
  ECharts.prototype.getZr = function () {
    return this._zr;
  };
  ECharts.prototype.isSSR = function () {
    return this._ssr;
  };
  /* eslint-disable-next-line */
  ECharts.prototype.setOption = function (option, notMerge, lazyUpdate) {
    if (this[IN_MAIN_PROCESS_KEY]) {
      {
        error('`setOption` should not be called during main process.');
      }
      return;
    }
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    var silent;
    var replaceMerge;
    var transitionOpt;
    if (isObject$3(notMerge)) {
      lazyUpdate = notMerge.lazyUpdate;
      silent = notMerge.silent;
      replaceMerge = notMerge.replaceMerge;
      transitionOpt = notMerge.transition;
      notMerge = notMerge.notMerge;
    }
    this[IN_MAIN_PROCESS_KEY] = true;
    if (!this._model || notMerge) {
      var optionManager = new OptionManager$1(this._api);
      var theme = this._theme;
      var ecModel = this._model = new GlobalModel$1();
      ecModel.scheduler = this._scheduler;
      ecModel.ssr = this._ssr;
      ecModel.init(null, null, null, theme, this._locale, optionManager);
    }
    this._model.setOption(option, {
      replaceMerge: replaceMerge
    }, optionPreprocessorFuncs);
    var updateParams = {
      seriesTransition: transitionOpt,
      optionChanged: true
    };
    if (lazyUpdate) {
      this[PENDING_UPDATE] = {
        silent: silent,
        updateParams: updateParams
      };
      this[IN_MAIN_PROCESS_KEY] = false;
      // `setOption(option, {lazyMode: true})` may be called when zrender has been slept.
      // It should wake it up to make sure zrender start to render at the next frame.
      this.getZr().wakeUp();
    } else {
      try {
        prepare(this);
        updateMethods.update.call(this, null, updateParams);
      } catch (e) {
        this[PENDING_UPDATE] = null;
        this[IN_MAIN_PROCESS_KEY] = false;
        throw e;
      }
      // Ensure zr refresh sychronously, and then pixel in canvas can be
      // fetched after `setOption`.
      if (!this._ssr) {
        // not use flush when using ssr mode.
        this._zr.flush();
      }
      this[PENDING_UPDATE] = null;
      this[IN_MAIN_PROCESS_KEY] = false;
      flushPendingActions.call(this, silent);
      triggerUpdatedEvent.call(this, silent);
    }
  };
  /**
   * @deprecated
   */
  ECharts.prototype.setTheme = function () {
    deprecateLog('ECharts#setTheme() is DEPRECATED in ECharts 3.0');
  };
  // We don't want developers to use getModel directly.
  ECharts.prototype.getModel = function () {
    return this._model;
  };
  ECharts.prototype.getOption = function () {
    return this._model && this._model.getOption();
  };
  ECharts.prototype.getWidth = function () {
    return this._zr.getWidth();
  };
  ECharts.prototype.getHeight = function () {
    return this._zr.getHeight();
  };
  ECharts.prototype.getDevicePixelRatio = function () {
    return this._zr.painter.dpr
    /* eslint-disable-next-line */ || env$1.hasGlobalWindow && window.devicePixelRatio || 1;
  };
  /**
   * Get canvas which has all thing rendered
   * @deprecated Use renderToCanvas instead.
   */
  ECharts.prototype.getRenderedCanvas = function (opts) {
    {
      deprecateReplaceLog('getRenderedCanvas', 'renderToCanvas');
    }
    return this.renderToCanvas(opts);
  };
  ECharts.prototype.renderToCanvas = function (opts) {
    opts = opts || {};
    var painter = this._zr.painter;
    {
      if (painter.type !== 'canvas') {
        throw new Error('renderToCanvas can only be used in the canvas renderer.');
      }
    }
    return painter.getRenderedCanvas({
      backgroundColor: opts.backgroundColor || this._model.get('backgroundColor'),
      pixelRatio: opts.pixelRatio || this.getDevicePixelRatio()
    });
  };
  ECharts.prototype.renderToSVGString = function (opts) {
    opts = opts || {};
    var painter = this._zr.painter;
    {
      if (painter.type !== 'svg') {
        throw new Error('renderToSVGString can only be used in the svg renderer.');
      }
    }
    return painter.renderToString({
      useViewBox: opts.useViewBox
    });
  };
  /**
   * Get svg data url
   */
  ECharts.prototype.getSvgDataURL = function () {
    if (!env$1.svgSupported) {
      return;
    }
    var zr = this._zr;
    var list = zr.storage.getDisplayList();
    // Stop animations
    each$f(list, function (el) {
      el.stopAnimation(null, true);
    });
    return zr.painter.toDataURL();
  };
  ECharts.prototype.getDataURL = function (opts) {
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    opts = opts || {};
    var excludeComponents = opts.excludeComponents;
    var ecModel = this._model;
    var excludesComponentViews = [];
    var self = this;
    each$f(excludeComponents, function (componentType) {
      ecModel.eachComponent({
        mainType: componentType
      }, function (component) {
        var view = self._componentsMap[component.__viewId];
        if (!view.group.ignore) {
          excludesComponentViews.push(view);
          view.group.ignore = true;
        }
      });
    });
    var url = this._zr.painter.getType() === 'svg' ? this.getSvgDataURL() : this.renderToCanvas(opts).toDataURL('image/' + (opts && opts.type || 'png'));
    each$f(excludesComponentViews, function (view) {
      view.group.ignore = false;
    });
    return url;
  };
  ECharts.prototype.getConnectedDataURL = function (opts) {
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    var isSvg = opts.type === 'svg';
    var groupId = this.group;
    var mathMin = Math.min;
    var mathMax = Math.max;
    var MAX_NUMBER = Infinity;
    if (connectedGroups[groupId]) {
      var left_1 = MAX_NUMBER;
      var top_1 = MAX_NUMBER;
      var right_1 = -MAX_NUMBER;
      var bottom_1 = -MAX_NUMBER;
      var canvasList_1 = [];
      var dpr_1 = opts && opts.pixelRatio || this.getDevicePixelRatio();
      each$f(instances, function (chart, id) {
        if (chart.group === groupId) {
          var canvas = isSvg ? chart.getZr().painter.getSvgDom().innerHTML : chart.renderToCanvas(clone$4(opts));
          var boundingRect = chart.getDom().getBoundingClientRect();
          left_1 = mathMin(boundingRect.left, left_1);
          top_1 = mathMin(boundingRect.top, top_1);
          right_1 = mathMax(boundingRect.right, right_1);
          bottom_1 = mathMax(boundingRect.bottom, bottom_1);
          canvasList_1.push({
            dom: canvas,
            left: boundingRect.left,
            top: boundingRect.top
          });
        }
      });
      left_1 *= dpr_1;
      top_1 *= dpr_1;
      right_1 *= dpr_1;
      bottom_1 *= dpr_1;
      var width = right_1 - left_1;
      var height = bottom_1 - top_1;
      var targetCanvas = platformApi.createCanvas();
      var zr_1 = init$2(targetCanvas, {
        renderer: isSvg ? 'svg' : 'canvas'
      });
      zr_1.resize({
        width: width,
        height: height
      });
      if (isSvg) {
        var content_1 = '';
        each$f(canvasList_1, function (item) {
          var x = item.left - left_1;
          var y = item.top - top_1;
          content_1 += '<g transform="translate(' + x + ',' + y + ')">' + item.dom + '</g>';
        });
        zr_1.painter.getSvgRoot().innerHTML = content_1;
        if (opts.connectedBackgroundColor) {
          zr_1.painter.setBackgroundColor(opts.connectedBackgroundColor);
        }
        zr_1.refreshImmediately();
        return zr_1.painter.toDataURL();
      } else {
        // Background between the charts
        if (opts.connectedBackgroundColor) {
          zr_1.add(new Rect$3({
            shape: {
              x: 0,
              y: 0,
              width: width,
              height: height
            },
            style: {
              fill: opts.connectedBackgroundColor
            }
          }));
        }
        each$f(canvasList_1, function (item) {
          var img = new ZRImage$1({
            style: {
              x: item.left * dpr_1 - left_1,
              y: item.top * dpr_1 - top_1,
              image: item.dom
            }
          });
          zr_1.add(img);
        });
        zr_1.refreshImmediately();
        return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
      }
    } else {
      return this.getDataURL(opts);
    }
  };
  ECharts.prototype.convertToPixel = function (finder, value) {
    return doConvertPixel(this, 'convertToPixel', finder, value);
  };
  ECharts.prototype.convertFromPixel = function (finder, value) {
    return doConvertPixel(this, 'convertFromPixel', finder, value);
  };
  /**
   * Is the specified coordinate systems or components contain the given pixel point.
   * @param {Array|number} value
   * @return {boolean} result
   */
  ECharts.prototype.containPixel = function (finder, value) {
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    var ecModel = this._model;
    var result;
    var findResult = parseFinder$1(ecModel, finder);
    each$f(findResult, function (models, key) {
      key.indexOf('Models') >= 0 && each$f(models, function (model) {
        var coordSys = model.coordinateSystem;
        if (coordSys && coordSys.containPoint) {
          result = result || !!coordSys.containPoint(value);
        } else if (key === 'seriesModels') {
          var view = this._chartsMap[model.__viewId];
          if (view && view.containPoint) {
            result = result || view.containPoint(value, model);
          } else {
            {
              warn(key + ': ' + (view ? 'The found component do not support containPoint.' : 'No view mapping to the found component.'));
            }
          }
        } else {
          {
            warn(key + ': containPoint is not supported');
          }
        }
      }, this);
    }, this);
    return !!result;
  };
  /**
   * Get visual from series or data.
   * @param finder
   *        If string, e.g., 'series', means {seriesIndex: 0}.
   *        If Object, could contain some of these properties below:
   *        {
   *            seriesIndex / seriesId / seriesName,
   *            dataIndex / dataIndexInside
   *        }
   *        If dataIndex is not specified, series visual will be fetched,
   *        but not data item visual.
   *        If all of seriesIndex, seriesId, seriesName are not specified,
   *        visual will be fetched from first series.
   * @param visualType 'color', 'symbol', 'symbolSize'
   */
  ECharts.prototype.getVisual = function (finder, visualType) {
    var ecModel = this._model;
    var parsedFinder = parseFinder$1(ecModel, finder, {
      defaultMainType: 'series'
    });
    var seriesModel = parsedFinder.seriesModel;
    {
      if (!seriesModel) {
        warn('There is no specified series model');
      }
    }
    var data = seriesModel.getData();
    var dataIndexInside = parsedFinder.hasOwnProperty('dataIndexInside') ? parsedFinder.dataIndexInside : parsedFinder.hasOwnProperty('dataIndex') ? data.indexOfRawIndex(parsedFinder.dataIndex) : null;
    return dataIndexInside != null ? getItemVisualFromData(data, dataIndexInside, visualType) : getVisualFromData(data, visualType);
  };
  /**
   * Get view of corresponding component model
   */
  ECharts.prototype.getViewOfComponentModel = function (componentModel) {
    return this._componentsMap[componentModel.__viewId];
  };
  /**
   * Get view of corresponding series model
   */
  ECharts.prototype.getViewOfSeriesModel = function (seriesModel) {
    return this._chartsMap[seriesModel.__viewId];
  };
  ECharts.prototype._initEvents = function () {
    var _this = this;
    each$f(MOUSE_EVENT_NAMES, function (eveName) {
      var handler = function (e) {
        var ecModel = _this.getModel();
        var el = e.target;
        var params;
        var isGlobalOut = eveName === 'globalout';
        // no e.target when 'globalout'.
        if (isGlobalOut) {
          params = {};
        } else {
          el && findEventDispatcher(el, function (parent) {
            var ecData = getECData(parent);
            if (ecData && ecData.dataIndex != null) {
              var dataModel = ecData.dataModel || ecModel.getSeriesByIndex(ecData.seriesIndex);
              params = dataModel && dataModel.getDataParams(ecData.dataIndex, ecData.dataType, el) || {};
              return true;
            }
            // If element has custom eventData of components
            else if (ecData.eventData) {
              params = extend({}, ecData.eventData);
              return true;
            }
          }, true);
        }
        // Contract: if params prepared in mouse event,
        // these properties must be specified:
        // {
        //    componentType: string (component main type)
        //    componentIndex: number
        // }
        // Otherwise event query can not work.
        if (params) {
          var componentType = params.componentType;
          var componentIndex = params.componentIndex;
          // Special handling for historic reason: when trigger by
          // markLine/markPoint/markArea, the componentType is
          // 'markLine'/'markPoint'/'markArea', but we should better
          // enable them to be queried by seriesIndex, since their
          // option is set in each series.
          if (componentType === 'markLine' || componentType === 'markPoint' || componentType === 'markArea') {
            componentType = 'series';
            componentIndex = params.seriesIndex;
          }
          var model = componentType && componentIndex != null && ecModel.getComponent(componentType, componentIndex);
          var view = model && _this[model.mainType === 'series' ? '_chartsMap' : '_componentsMap'][model.__viewId];
          {
            // `event.componentType` and `event[componentTpype + 'Index']` must not
            // be missed, otherwise there is no way to distinguish source component.
            // See `dataFormat.getDataParams`.
            if (!isGlobalOut && !(model && view)) {
              warn('model or view can not be found by params');
            }
          }
          params.event = e;
          params.type = eveName;
          _this._$eventProcessor.eventInfo = {
            targetEl: el,
            packedEvent: params,
            model: model,
            view: view
          };
          _this.trigger(eveName, params);
        }
      };
      // Consider that some component (like tooltip, brush, ...)
      // register zr event handler, but user event handler might
      // do anything, such as call `setOption` or `dispatchAction`,
      // which probably update any of the content and probably
      // cause problem if it is called previous other inner handlers.
      handler.zrEventfulCallAtLast = true;
      _this._zr.on(eveName, handler, _this);
    });
    each$f(eventActionMap, function (actionType, eventType) {
      _this._messageCenter.on(eventType, function (event) {
        this.trigger(eventType, event);
      }, _this);
    });
    // Extra events
    // TODO register?
    each$f(['selectchanged'], function (eventType) {
      _this._messageCenter.on(eventType, function (event) {
        this.trigger(eventType, event);
      }, _this);
    });
    handleLegacySelectEvents(this._messageCenter, this, this._api);
  };
  ECharts.prototype.isDisposed = function () {
    return this._disposed;
  };
  ECharts.prototype.clear = function () {
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    this.setOption({
      series: []
    }, true);
  };
  ECharts.prototype.dispose = function () {
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    this._disposed = true;
    var dom = this.getDom();
    if (dom) {
      setAttribute(this.getDom(), DOM_ATTRIBUTE_KEY, '');
    }
    var chart = this;
    var api = chart._api;
    var ecModel = chart._model;
    each$f(chart._componentsViews, function (component) {
      component.dispose(ecModel, api);
    });
    each$f(chart._chartsViews, function (chart) {
      chart.dispose(ecModel, api);
    });
    // Dispose after all views disposed
    chart._zr.dispose();
    // Set properties to null.
    // To reduce the memory cost in case the top code still holds this instance unexpectedly.
    chart._dom = chart._model = chart._chartsMap = chart._componentsMap = chart._chartsViews = chart._componentsViews = chart._scheduler = chart._api = chart._zr = chart._throttledZrFlush = chart._theme = chart._coordSysMgr = chart._messageCenter = null;
    delete instances[chart.id];
  };
  /**
   * Resize the chart
   */
  ECharts.prototype.resize = function (opts) {
    if (this[IN_MAIN_PROCESS_KEY]) {
      {
        error('`resize` should not be called during main process.');
      }
      return;
    }
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    this._zr.resize(opts);
    var ecModel = this._model;
    // Resize loading effect
    this._loadingFX && this._loadingFX.resize();
    if (!ecModel) {
      return;
    }
    var needPrepare = ecModel.resetOption('media');
    var silent = opts && opts.silent;
    // There is some real cases that:
    // chart.setOption(option, { lazyUpdate: true });
    // chart.resize();
    if (this[PENDING_UPDATE]) {
      if (silent == null) {
        silent = this[PENDING_UPDATE].silent;
      }
      needPrepare = true;
      this[PENDING_UPDATE] = null;
    }
    this[IN_MAIN_PROCESS_KEY] = true;
    try {
      needPrepare && prepare(this);
      updateMethods.update.call(this, {
        type: 'resize',
        animation: extend({
          // Disable animation
          duration: 0
        }, opts && opts.animation)
      });
    } catch (e) {
      this[IN_MAIN_PROCESS_KEY] = false;
      throw e;
    }
    this[IN_MAIN_PROCESS_KEY] = false;
    flushPendingActions.call(this, silent);
    triggerUpdatedEvent.call(this, silent);
  };
  ECharts.prototype.showLoading = function (name, cfg) {
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    if (isObject$3(name)) {
      cfg = name;
      name = '';
    }
    name = name || 'default';
    this.hideLoading();
    if (!loadingEffects[name]) {
      {
        warn('Loading effects ' + name + ' not exists.');
      }
      return;
    }
    var el = loadingEffects[name](this._api, cfg);
    var zr = this._zr;
    this._loadingFX = el;
    zr.add(el);
  };
  /**
   * Hide loading effect
   */
  ECharts.prototype.hideLoading = function () {
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    this._loadingFX && this._zr.remove(this._loadingFX);
    this._loadingFX = null;
  };
  ECharts.prototype.makeActionFromEvent = function (eventObj) {
    var payload = extend({}, eventObj);
    payload.type = eventActionMap[eventObj.type];
    return payload;
  };
  /**
   * @param opt If pass boolean, means opt.silent
   * @param opt.silent Default `false`. Whether trigger events.
   * @param opt.flush Default `undefined`.
   *        true: Flush immediately, and then pixel in canvas can be fetched
   *            immediately. Caution: it might affect performance.
   *        false: Not flush.
   *        undefined: Auto decide whether perform flush.
   */
  ECharts.prototype.dispatchAction = function (payload, opt) {
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    if (!isObject$3(opt)) {
      opt = {
        silent: !!opt
      };
    }
    if (!actions[payload.type]) {
      return;
    }
    // Avoid dispatch action before setOption. Especially in `connect`.
    if (!this._model) {
      return;
    }
    // May dispatchAction in rendering procedure
    if (this[IN_MAIN_PROCESS_KEY]) {
      this._pendingActions.push(payload);
      return;
    }
    var silent = opt.silent;
    doDispatchAction.call(this, payload, silent);
    var flush = opt.flush;
    if (flush) {
      this._zr.flush();
    } else if (flush !== false && env$1.browser.weChat) {
      // In WeChat embedded browser, `requestAnimationFrame` and `setInterval`
      // hang when sliding page (on touch event), which cause that zr does not
      // refresh until user interaction finished, which is not expected.
      // But `dispatchAction` may be called too frequently when pan on touch
      // screen, which impacts performance if do not throttle them.
      this._throttledZrFlush();
    }
    flushPendingActions.call(this, silent);
    triggerUpdatedEvent.call(this, silent);
  };
  ECharts.prototype.updateLabelLayout = function () {
    lifecycle$1.trigger('series:layoutlabels', this._model, this._api, {
      // Not adding series labels.
      // TODO
      updatedSeries: []
    });
  };
  ECharts.prototype.appendData = function (params) {
    if (this._disposed) {
      disposedWarning(this.id);
      return;
    }
    var seriesIndex = params.seriesIndex;
    var ecModel = this.getModel();
    var seriesModel = ecModel.getSeriesByIndex(seriesIndex);
    {
      assert(params.data && seriesModel);
    }
    seriesModel.appendData(params);
    // Note: `appendData` does not support that update extent of coordinate
    // system, util some scenario require that. In the expected usage of
    // `appendData`, the initial extent of coordinate system should better
    // be fixed by axis `min`/`max` setting or initial data, otherwise if
    // the extent changed while `appendData`, the location of the painted
    // graphic elements have to be changed, which make the usage of
    // `appendData` meaningless.
    this._scheduler.unfinished = true;
    this.getZr().wakeUp();
  };
  // A work around for no `internal` modifier in ts yet but
  // need to strictly hide private methods to JS users.
  ECharts.internalField = function () {
    prepare = function (ecIns) {
      var scheduler = ecIns._scheduler;
      scheduler.restorePipelines(ecIns._model);
      scheduler.prepareStageTasks();
      prepareView(ecIns, true);
      prepareView(ecIns, false);
      scheduler.plan();
    };
    /**
     * Prepare view instances of charts and components
     */
    prepareView = function (ecIns, isComponent) {
      var ecModel = ecIns._model;
      var scheduler = ecIns._scheduler;
      var viewList = isComponent ? ecIns._componentsViews : ecIns._chartsViews;
      var viewMap = isComponent ? ecIns._componentsMap : ecIns._chartsMap;
      var zr = ecIns._zr;
      var api = ecIns._api;
      for (var i = 0; i < viewList.length; i++) {
        viewList[i].__alive = false;
      }
      isComponent ? ecModel.eachComponent(function (componentType, model) {
        componentType !== 'series' && doPrepare(model);
      }) : ecModel.eachSeries(doPrepare);
      function doPrepare(model) {
        // By default view will be reused if possible for the case that `setOption` with "notMerge"
        // mode and need to enable transition animation. (Usually, when they have the same id, or
        // especially no id but have the same type & name & index. See the `model.id` generation
        // rule in `makeIdAndName` and `viewId` generation rule here).
        // But in `replaceMerge` mode, this feature should be able to disabled when it is clear that
        // the new model has nothing to do with the old model.
        var requireNewView = model.__requireNewView;
        // This command should not work twice.
        model.__requireNewView = false;
        // Consider: id same and type changed.
        var viewId = '_ec_' + model.id + '_' + model.type;
        var view = !requireNewView && viewMap[viewId];
        if (!view) {
          var classType = parseClassType(model.type);
          var Clazz = isComponent ? ComponentView$1.getClass(classType.main, classType.sub) :
          // FIXME:TS
          // (ChartView as ChartViewConstructor).getClass('series', classType.sub)
          // For backward compat, still support a chart type declared as only subType
          // like "liquidfill", but recommend "series.liquidfill"
          // But need a base class to make a type series.
          ChartView$1.getClass(classType.sub);
          {
            assert(Clazz, classType.sub + ' does not exist.');
          }
          view = new Clazz();
          view.init(ecModel, api);
          viewMap[viewId] = view;
          viewList.push(view);
          zr.add(view.group);
        }
        model.__viewId = view.__id = viewId;
        view.__alive = true;
        view.__model = model;
        view.group.__ecComponentInfo = {
          mainType: model.mainType,
          index: model.componentIndex
        };
        !isComponent && scheduler.prepareView(view, model, ecModel, api);
      }
      for (var i = 0; i < viewList.length;) {
        var view = viewList[i];
        if (!view.__alive) {
          !isComponent && view.renderTask.dispose();
          zr.remove(view.group);
          view.dispose(ecModel, api);
          viewList.splice(i, 1);
          if (viewMap[view.__id] === view) {
            delete viewMap[view.__id];
          }
          view.__id = view.group.__ecComponentInfo = null;
        } else {
          i++;
        }
      }
    };
    updateDirectly = function (ecIns, method, payload, mainType, subType) {
      var ecModel = ecIns._model;
      ecModel.setUpdatePayload(payload);
      // broadcast
      if (!mainType) {
        // FIXME
        // Chart will not be update directly here, except set dirty.
        // But there is no such scenario now.
        each$f([].concat(ecIns._componentsViews).concat(ecIns._chartsViews), callView);
        return;
      }
      var query = {};
      query[mainType + 'Id'] = payload[mainType + 'Id'];
      query[mainType + 'Index'] = payload[mainType + 'Index'];
      query[mainType + 'Name'] = payload[mainType + 'Name'];
      var condition = {
        mainType: mainType,
        query: query
      };
      subType && (condition.subType = subType); // subType may be '' by parseClassType;
      var excludeSeriesId = payload.excludeSeriesId;
      var excludeSeriesIdMap;
      if (excludeSeriesId != null) {
        excludeSeriesIdMap = createHashMap();
        each$f(normalizeToArray(excludeSeriesId), function (id) {
          var modelId = convertOptionIdName(id, null);
          if (modelId != null) {
            excludeSeriesIdMap.set(modelId, true);
          }
        });
      }
      // If dispatchAction before setOption, do nothing.
      ecModel && ecModel.eachComponent(condition, function (model) {
        var isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) != null;
        if (isExcluded) {
          return;
        }
        if (isHighDownPayload(payload)) {
          if (model instanceof SeriesModel$1) {
            if (payload.type === HIGHLIGHT_ACTION_TYPE && !payload.notBlur && !model.get(['emphasis', 'disabled'])) {
              blurSeriesFromHighlightPayload(model, payload, ecIns._api);
            }
          } else {
            var _a = findComponentHighDownDispatchers(model.mainType, model.componentIndex, payload.name, ecIns._api),
              focusSelf = _a.focusSelf,
              dispatchers = _a.dispatchers;
            if (payload.type === HIGHLIGHT_ACTION_TYPE && focusSelf && !payload.notBlur) {
              blurComponent(model.mainType, model.componentIndex, ecIns._api);
            }
            // PENDING:
            // Whether to put this "enter emphasis" code in `ComponentView`,
            // which will be the same as `ChartView` but might be not necessary
            // and will be far from this logic.
            if (dispatchers) {
              each$f(dispatchers, function (dispatcher) {
                payload.type === HIGHLIGHT_ACTION_TYPE ? enterEmphasis(dispatcher) : leaveEmphasis(dispatcher);
              });
            }
          }
        } else if (isSelectChangePayload(payload)) {
          // TODO geo
          if (model instanceof SeriesModel$1) {
            toggleSelectionFromPayload(model, payload, ecIns._api);
            updateSeriesElementSelection(model);
            markStatusToUpdate(ecIns);
          }
        }
      }, ecIns);
      ecModel && ecModel.eachComponent(condition, function (model) {
        var isExcluded = excludeSeriesIdMap && excludeSeriesIdMap.get(model.id) != null;
        if (isExcluded) {
          return;
        }
        callView(ecIns[mainType === 'series' ? '_chartsMap' : '_componentsMap'][model.__viewId]);
      }, ecIns);
      function callView(view) {
        view && view.__alive && view[method] && view[method](view.__model, ecModel, ecIns._api, payload);
      }
    };
    updateMethods = {
      prepareAndUpdate: function (payload) {
        prepare(this);
        updateMethods.update.call(this, payload, {
          // Needs to mark option changed if newOption is given.
          // It's from MagicType.
          // TODO If use a separate flag optionChanged in payload?
          optionChanged: payload.newOption != null
        });
      },
      update: function (payload, updateParams) {
        var ecModel = this._model;
        var api = this._api;
        var zr = this._zr;
        var coordSysMgr = this._coordSysMgr;
        var scheduler = this._scheduler;
        // update before setOption
        if (!ecModel) {
          return;
        }
        ecModel.setUpdatePayload(payload);
        scheduler.restoreData(ecModel, payload);
        scheduler.performSeriesTasks(ecModel);
        // TODO
        // Save total ecModel here for undo/redo (after restoring data and before processing data).
        // Undo (restoration of total ecModel) can be carried out in 'action' or outside API call.
        // Create new coordinate system each update
        // In LineView may save the old coordinate system and use it to get the original point.
        coordSysMgr.create(ecModel, api);
        scheduler.performDataProcessorTasks(ecModel, payload);
        // Current stream render is not supported in data process. So we can update
        // stream modes after data processing, where the filtered data is used to
        // determine whether to use progressive rendering.
        updateStreamModes(this, ecModel);
        // We update stream modes before coordinate system updated, then the modes info
        // can be fetched when coord sys updating (consider the barGrid extent fix). But
        // the drawback is the full coord info can not be fetched. Fortunately this full
        // coord is not required in stream mode updater currently.
        coordSysMgr.update(ecModel, api);
        clearColorPalette(ecModel);
        scheduler.performVisualTasks(ecModel, payload);
        render(this, ecModel, api, payload, updateParams);
        // Set background
        var backgroundColor = ecModel.get('backgroundColor') || 'transparent';
        var darkMode = ecModel.get('darkMode');
        zr.setBackgroundColor(backgroundColor);
        // Force set dark mode.
        if (darkMode != null && darkMode !== 'auto') {
          zr.setDarkMode(darkMode);
        }
        lifecycle$1.trigger('afterupdate', ecModel, api);
      },
      updateTransform: function (payload) {
        var _this = this;
        var ecModel = this._model;
        var api = this._api;
        // update before setOption
        if (!ecModel) {
          return;
        }
        ecModel.setUpdatePayload(payload);
        // ChartView.markUpdateMethod(payload, 'updateTransform');
        var componentDirtyList = [];
        ecModel.eachComponent(function (componentType, componentModel) {
          if (componentType === 'series') {
            return;
          }
          var componentView = _this.getViewOfComponentModel(componentModel);
          if (componentView && componentView.__alive) {
            if (componentView.updateTransform) {
              var result = componentView.updateTransform(componentModel, ecModel, api, payload);
              result && result.update && componentDirtyList.push(componentView);
            } else {
              componentDirtyList.push(componentView);
            }
          }
        });
        var seriesDirtyMap = createHashMap();
        ecModel.eachSeries(function (seriesModel) {
          var chartView = _this._chartsMap[seriesModel.__viewId];
          if (chartView.updateTransform) {
            var result = chartView.updateTransform(seriesModel, ecModel, api, payload);
            result && result.update && seriesDirtyMap.set(seriesModel.uid, 1);
          } else {
            seriesDirtyMap.set(seriesModel.uid, 1);
          }
        });
        clearColorPalette(ecModel);
        // Keep pipe to the exist pipeline because it depends on the render task of the full pipeline.
        // this._scheduler.performVisualTasks(ecModel, payload, 'layout', true);
        this._scheduler.performVisualTasks(ecModel, payload, {
          setDirty: true,
          dirtyMap: seriesDirtyMap
        });
        // Currently, not call render of components. Geo render cost a lot.
        // renderComponents(ecIns, ecModel, api, payload, componentDirtyList);
        renderSeries(this, ecModel, api, payload, {}, seriesDirtyMap);
        lifecycle$1.trigger('afterupdate', ecModel, api);
      },
      updateView: function (payload) {
        var ecModel = this._model;
        // update before setOption
        if (!ecModel) {
          return;
        }
        ecModel.setUpdatePayload(payload);
        ChartView$1.markUpdateMethod(payload, 'updateView');
        clearColorPalette(ecModel);
        // Keep pipe to the exist pipeline because it depends on the render task of the full pipeline.
        this._scheduler.performVisualTasks(ecModel, payload, {
          setDirty: true
        });
        render(this, ecModel, this._api, payload, {});
        lifecycle$1.trigger('afterupdate', ecModel, this._api);
      },
      updateVisual: function (payload) {
        // updateMethods.update.call(this, payload);
        var _this = this;
        var ecModel = this._model;
        // update before setOption
        if (!ecModel) {
          return;
        }
        ecModel.setUpdatePayload(payload);
        // clear all visual
        ecModel.eachSeries(function (seriesModel) {
          seriesModel.getData().clearAllVisual();
        });
        // Perform visual
        ChartView$1.markUpdateMethod(payload, 'updateVisual');
        clearColorPalette(ecModel);
        // Keep pipe to the exist pipeline because it depends on the render task of the full pipeline.
        this._scheduler.performVisualTasks(ecModel, payload, {
          visualType: 'visual',
          setDirty: true
        });
        ecModel.eachComponent(function (componentType, componentModel) {
          if (componentType !== 'series') {
            var componentView = _this.getViewOfComponentModel(componentModel);
            componentView && componentView.__alive && componentView.updateVisual(componentModel, ecModel, _this._api, payload);
          }
        });
        ecModel.eachSeries(function (seriesModel) {
          var chartView = _this._chartsMap[seriesModel.__viewId];
          chartView.updateVisual(seriesModel, ecModel, _this._api, payload);
        });
        lifecycle$1.trigger('afterupdate', ecModel, this._api);
      },
      updateLayout: function (payload) {
        updateMethods.update.call(this, payload);
      }
    };
    doConvertPixel = function (ecIns, methodName, finder, value) {
      if (ecIns._disposed) {
        disposedWarning(ecIns.id);
        return;
      }
      var ecModel = ecIns._model;
      var coordSysList = ecIns._coordSysMgr.getCoordinateSystems();
      var result;
      var parsedFinder = parseFinder$1(ecModel, finder);
      for (var i = 0; i < coordSysList.length; i++) {
        var coordSys = coordSysList[i];
        if (coordSys[methodName] && (result = coordSys[methodName](ecModel, parsedFinder, value)) != null) {
          return result;
        }
      }
      {
        warn('No coordinate system that supports ' + methodName + ' found by the given finder.');
      }
    };
    updateStreamModes = function (ecIns, ecModel) {
      var chartsMap = ecIns._chartsMap;
      var scheduler = ecIns._scheduler;
      ecModel.eachSeries(function (seriesModel) {
        scheduler.updateStreamModes(seriesModel, chartsMap[seriesModel.__viewId]);
      });
    };
    doDispatchAction = function (payload, silent) {
      var _this = this;
      var ecModel = this.getModel();
      var payloadType = payload.type;
      var escapeConnect = payload.escapeConnect;
      var actionWrap = actions[payloadType];
      var actionInfo = actionWrap.actionInfo;
      var cptTypeTmp = (actionInfo.update || 'update').split(':');
      var updateMethod = cptTypeTmp.pop();
      var cptType = cptTypeTmp[0] != null && parseClassType(cptTypeTmp[0]);
      this[IN_MAIN_PROCESS_KEY] = true;
      var payloads = [payload];
      var batched = false;
      // Batch action
      if (payload.batch) {
        batched = true;
        payloads = map$1(payload.batch, function (item) {
          item = defaults(extend({}, item), payload);
          item.batch = null;
          return item;
        });
      }
      var eventObjBatch = [];
      var eventObj;
      var isSelectChange = isSelectChangePayload(payload);
      var isHighDown = isHighDownPayload(payload);
      // Only leave blur once if there are multiple batches.
      if (isHighDown) {
        allLeaveBlur(this._api);
      }
      each$f(payloads, function (batchItem) {
        // Action can specify the event by return it.
        eventObj = actionWrap.action(batchItem, _this._model, _this._api);
        // Emit event outside
        eventObj = eventObj || extend({}, batchItem);
        // Convert type to eventType
        eventObj.type = actionInfo.event || eventObj.type;
        eventObjBatch.push(eventObj);
        // light update does not perform data process, layout and visual.
        if (isHighDown) {
          var _a = preParseFinder(payload),
            queryOptionMap = _a.queryOptionMap,
            mainTypeSpecified = _a.mainTypeSpecified;
          var componentMainType = mainTypeSpecified ? queryOptionMap.keys()[0] : 'series';
          updateDirectly(_this, updateMethod, batchItem, componentMainType);
          markStatusToUpdate(_this);
        } else if (isSelectChange) {
          // At present `dispatchAction({ type: 'select', ... })` is not supported on components.
          // geo still use 'geoselect'.
          updateDirectly(_this, updateMethod, batchItem, 'series');
          markStatusToUpdate(_this);
        } else if (cptType) {
          updateDirectly(_this, updateMethod, batchItem, cptType.main, cptType.sub);
        }
      });
      if (updateMethod !== 'none' && !isHighDown && !isSelectChange && !cptType) {
        try {
          // Still dirty
          if (this[PENDING_UPDATE]) {
            prepare(this);
            updateMethods.update.call(this, payload);
            this[PENDING_UPDATE] = null;
          } else {
            updateMethods[updateMethod].call(this, payload);
          }
        } catch (e) {
          this[IN_MAIN_PROCESS_KEY] = false;
          throw e;
        }
      }
      // Follow the rule of action batch
      if (batched) {
        eventObj = {
          type: actionInfo.event || payloadType,
          escapeConnect: escapeConnect,
          batch: eventObjBatch
        };
      } else {
        eventObj = eventObjBatch[0];
      }
      this[IN_MAIN_PROCESS_KEY] = false;
      if (!silent) {
        var messageCenter = this._messageCenter;
        messageCenter.trigger(eventObj.type, eventObj);
        // Extra triggered 'selectchanged' event
        if (isSelectChange) {
          var newObj = {
            type: 'selectchanged',
            escapeConnect: escapeConnect,
            selected: getAllSelectedIndices(ecModel),
            isFromClick: payload.isFromClick || false,
            fromAction: payload.type,
            fromActionPayload: payload
          };
          messageCenter.trigger(newObj.type, newObj);
        }
      }
    };
    flushPendingActions = function (silent) {
      var pendingActions = this._pendingActions;
      while (pendingActions.length) {
        var payload = pendingActions.shift();
        doDispatchAction.call(this, payload, silent);
      }
    };
    triggerUpdatedEvent = function (silent) {
      !silent && this.trigger('updated');
    };
    /**
     * Event `rendered` is triggered when zr
     * rendered. It is useful for realtime
     * snapshot (reflect animation).
     *
     * Event `finished` is triggered when:
     * (1) zrender rendering finished.
     * (2) initial animation finished.
     * (3) progressive rendering finished.
     * (4) no pending action.
     * (5) no delayed setOption needs to be processed.
     */
    bindRenderedEvent = function (zr, ecIns) {
      zr.on('rendered', function (params) {
        ecIns.trigger('rendered', params);
        // The `finished` event should not be triggered repeatedly,
        // so it should only be triggered when rendering indeed happens
        // in zrender. (Consider the case that dipatchAction is keep
        // triggering when mouse move).
        if (
        // Although zr is dirty if initial animation is not finished
        // and this checking is called on frame, we also check
        // animation finished for robustness.
        zr.animation.isFinished() && !ecIns[PENDING_UPDATE] && !ecIns._scheduler.unfinished && !ecIns._pendingActions.length) {
          ecIns.trigger('finished');
        }
      });
    };
    bindMouseEvent = function (zr, ecIns) {
      zr.on('mouseover', function (e) {
        var el = e.target;
        var dispatcher = findEventDispatcher(el, isHighDownDispatcher);
        if (dispatcher) {
          handleGlobalMouseOverForHighDown(dispatcher, e, ecIns._api);
          markStatusToUpdate(ecIns);
        }
      }).on('mouseout', function (e) {
        var el = e.target;
        var dispatcher = findEventDispatcher(el, isHighDownDispatcher);
        if (dispatcher) {
          handleGlobalMouseOutForHighDown(dispatcher, e, ecIns._api);
          markStatusToUpdate(ecIns);
        }
      }).on('click', function (e) {
        var el = e.target;
        var dispatcher = findEventDispatcher(el, function (target) {
          return getECData(target).dataIndex != null;
        }, true);
        if (dispatcher) {
          var actionType = dispatcher.selected ? 'unselect' : 'select';
          var ecData = getECData(dispatcher);
          ecIns._api.dispatchAction({
            type: actionType,
            dataType: ecData.dataType,
            dataIndexInside: ecData.dataIndex,
            seriesIndex: ecData.seriesIndex,
            isFromClick: true
          });
        }
      });
    };
    function clearColorPalette(ecModel) {
      ecModel.clearColorPalette();
      ecModel.eachSeries(function (seriesModel) {
        seriesModel.clearColorPalette();
      });
    }
    // Allocate zlevels for series and components
    function allocateZlevels(ecModel) {
      var componentZLevels = [];
      var seriesZLevels = [];
      var hasSeparateZLevel = false;
      ecModel.eachComponent(function (componentType, componentModel) {
        var zlevel = componentModel.get('zlevel') || 0;
        var z = componentModel.get('z') || 0;
        var zlevelKey = componentModel.getZLevelKey();
        hasSeparateZLevel = hasSeparateZLevel || !!zlevelKey;
        (componentType === 'series' ? seriesZLevels : componentZLevels).push({
          zlevel: zlevel,
          z: z,
          idx: componentModel.componentIndex,
          type: componentType,
          key: zlevelKey
        });
      });
      if (hasSeparateZLevel) {
        // Series after component
        var zLevels = componentZLevels.concat(seriesZLevels);
        var lastSeriesZLevel_1;
        var lastSeriesKey_1;
        sort$2(zLevels, function (a, b) {
          if (a.zlevel === b.zlevel) {
            return a.z - b.z;
          }
          return a.zlevel - b.zlevel;
        });
        each$f(zLevels, function (item) {
          var componentModel = ecModel.getComponent(item.type, item.idx);
          var zlevel = item.zlevel;
          var key = item.key;
          if (lastSeriesZLevel_1 != null) {
            zlevel = Math.max(lastSeriesZLevel_1, zlevel);
          }
          if (key) {
            if (zlevel === lastSeriesZLevel_1 && key !== lastSeriesKey_1) {
              zlevel++;
            }
            lastSeriesKey_1 = key;
          } else if (lastSeriesKey_1) {
            if (zlevel === lastSeriesZLevel_1) {
              zlevel++;
            }
            lastSeriesKey_1 = '';
          }
          lastSeriesZLevel_1 = zlevel;
          componentModel.setZLevel(zlevel);
        });
      }
    }
    render = function (ecIns, ecModel, api, payload, updateParams) {
      allocateZlevels(ecModel);
      renderComponents(ecIns, ecModel, api, payload, updateParams);
      each$f(ecIns._chartsViews, function (chart) {
        chart.__alive = false;
      });
      renderSeries(ecIns, ecModel, api, payload, updateParams);
      // Remove groups of unrendered charts
      each$f(ecIns._chartsViews, function (chart) {
        if (!chart.__alive) {
          chart.remove(ecModel, api);
        }
      });
    };
    renderComponents = function (ecIns, ecModel, api, payload, updateParams, dirtyList) {
      each$f(dirtyList || ecIns._componentsViews, function (componentView) {
        var componentModel = componentView.__model;
        clearStates(componentModel, componentView);
        componentView.render(componentModel, ecModel, api, payload);
        updateZ(componentModel, componentView);
        updateStates(componentModel, componentView);
      });
    };
    /**
     * Render each chart and component
     */
    renderSeries = function (ecIns, ecModel, api, payload, updateParams, dirtyMap) {
      // Render all charts
      var scheduler = ecIns._scheduler;
      updateParams = extend(updateParams || {}, {
        updatedSeries: ecModel.getSeries()
      });
      // TODO progressive?
      lifecycle$1.trigger('series:beforeupdate', ecModel, api, updateParams);
      var unfinished = false;
      ecModel.eachSeries(function (seriesModel) {
        var chartView = ecIns._chartsMap[seriesModel.__viewId];
        chartView.__alive = true;
        var renderTask = chartView.renderTask;
        scheduler.updatePayload(renderTask, payload);
        // TODO states on marker.
        clearStates(seriesModel, chartView);
        if (dirtyMap && dirtyMap.get(seriesModel.uid)) {
          renderTask.dirty();
        }
        if (renderTask.perform(scheduler.getPerformArgs(renderTask))) {
          unfinished = true;
        }
        chartView.group.silent = !!seriesModel.get('silent');
        // Should not call markRedraw on group, because it will disable zrender
        // incremental render (always render from the __startIndex each frame)
        // chartView.group.markRedraw();
        updateBlend(seriesModel, chartView);
        updateSeriesElementSelection(seriesModel);
      });
      scheduler.unfinished = unfinished || scheduler.unfinished;
      lifecycle$1.trigger('series:layoutlabels', ecModel, api, updateParams);
      // transition after label is layouted.
      lifecycle$1.trigger('series:transition', ecModel, api, updateParams);
      ecModel.eachSeries(function (seriesModel) {
        var chartView = ecIns._chartsMap[seriesModel.__viewId];
        // Update Z after labels updated. Before applying states.
        updateZ(seriesModel, chartView);
        // NOTE: Update states after label is updated.
        // label should be in normal status when layouting.
        updateStates(seriesModel, chartView);
      });
      // If use hover layer
      updateHoverLayerStatus(ecIns, ecModel);
      lifecycle$1.trigger('series:afterupdate', ecModel, api, updateParams);
    };
    markStatusToUpdate = function (ecIns) {
      ecIns[STATUS_NEEDS_UPDATE_KEY] = true;
      // Wake up zrender if it's sleep. Let it update states in the next frame.
      ecIns.getZr().wakeUp();
    };
    applyChangedStates = function (ecIns) {
      if (!ecIns[STATUS_NEEDS_UPDATE_KEY]) {
        return;
      }
      ecIns.getZr().storage.traverse(function (el) {
        // Not applied on removed elements, it may still in fading.
        if (isElementRemoved(el)) {
          return;
        }
        applyElementStates(el);
      });
      ecIns[STATUS_NEEDS_UPDATE_KEY] = false;
    };
    function applyElementStates(el) {
      var newStates = [];
      var oldStates = el.currentStates;
      // Keep other states.
      for (var i = 0; i < oldStates.length; i++) {
        var stateName = oldStates[i];
        if (!(stateName === 'emphasis' || stateName === 'blur' || stateName === 'select')) {
          newStates.push(stateName);
        }
      }
      // Only use states when it's exists.
      if (el.selected && el.states.select) {
        newStates.push('select');
      }
      if (el.hoverState === HOVER_STATE_EMPHASIS && el.states.emphasis) {
        newStates.push('emphasis');
      } else if (el.hoverState === HOVER_STATE_BLUR && el.states.blur) {
        newStates.push('blur');
      }
      el.useStates(newStates);
    }
    function updateHoverLayerStatus(ecIns, ecModel) {
      var zr = ecIns._zr;
      var storage = zr.storage;
      var elCount = 0;
      storage.traverse(function (el) {
        if (!el.isGroup) {
          elCount++;
        }
      });
      if (elCount > ecModel.get('hoverLayerThreshold') && !env$1.node && !env$1.worker) {
        ecModel.eachSeries(function (seriesModel) {
          if (seriesModel.preventUsingHoverLayer) {
            return;
          }
          var chartView = ecIns._chartsMap[seriesModel.__viewId];
          if (chartView.__alive) {
            chartView.eachRendered(function (el) {
              if (el.states.emphasis) {
                el.states.emphasis.hoverLayer = true;
              }
            });
          }
        });
      }
    }
    /**
     * Update chart and blend.
     */
    function updateBlend(seriesModel, chartView) {
      var blendMode = seriesModel.get('blendMode') || null;
      chartView.eachRendered(function (el) {
        // FIXME marker and other components
        if (!el.isGroup) {
          // DON'T mark the element dirty. In case element is incremental and don't want to rerender.
          el.style.blend = blendMode;
        }
      });
    }
    function updateZ(model, view) {
      if (model.preventAutoZ) {
        return;
      }
      var z = model.get('z') || 0;
      var zlevel = model.get('zlevel') || 0;
      // Set z and zlevel
      view.eachRendered(function (el) {
        doUpdateZ(el, z, zlevel, -Infinity);
        // Don't traverse the children because it has been traversed in _updateZ.
        return true;
      });
    }
    function doUpdateZ(el, z, zlevel, maxZ2) {
      // Group may also have textContent
      var label = el.getTextContent();
      var labelLine = el.getTextGuideLine();
      var isGroup = el.isGroup;
      if (isGroup) {
        // set z & zlevel of children elements of Group
        var children = el.childrenRef();
        for (var i = 0; i < children.length; i++) {
          maxZ2 = Math.max(doUpdateZ(children[i], z, zlevel, maxZ2), maxZ2);
        }
      } else {
        // not Group
        el.z = z;
        el.zlevel = zlevel;
        maxZ2 = Math.max(el.z2, maxZ2);
      }
      // always set z and zlevel if label/labelLine exists
      if (label) {
        label.z = z;
        label.zlevel = zlevel;
        // lift z2 of text content
        // TODO if el.emphasis.z2 is spcefied, what about textContent.
        isFinite(maxZ2) && (label.z2 = maxZ2 + 2);
      }
      if (labelLine) {
        var textGuideLineConfig = el.textGuideLineConfig;
        labelLine.z = z;
        labelLine.zlevel = zlevel;
        isFinite(maxZ2) && (labelLine.z2 = maxZ2 + (textGuideLineConfig && textGuideLineConfig.showAbove ? 1 : -1));
      }
      return maxZ2;
    }
    // Clear states without animation.
    // TODO States on component.
    function clearStates(model, view) {
      view.eachRendered(function (el) {
        // Not applied on removed elements, it may still in fading.
        if (isElementRemoved(el)) {
          return;
        }
        var textContent = el.getTextContent();
        var textGuide = el.getTextGuideLine();
        if (el.stateTransition) {
          el.stateTransition = null;
        }
        if (textContent && textContent.stateTransition) {
          textContent.stateTransition = null;
        }
        if (textGuide && textGuide.stateTransition) {
          textGuide.stateTransition = null;
        }
        // TODO If el is incremental.
        if (el.hasState()) {
          el.prevStates = el.currentStates;
          el.clearStates();
        } else if (el.prevStates) {
          el.prevStates = null;
        }
      });
    }
    function updateStates(model, view) {
      var stateAnimationModel = model.getModel('stateAnimation');
      var enableAnimation = model.isAnimationEnabled();
      var duration = stateAnimationModel.get('duration');
      var stateTransition = duration > 0 ? {
        duration: duration,
        delay: stateAnimationModel.get('delay'),
        easing: stateAnimationModel.get('easing')
        // additive: stateAnimationModel.get('additive')
      } : null;
      view.eachRendered(function (el) {
        if (el.states && el.states.emphasis) {
          // Not applied on removed elements, it may still in fading.
          if (isElementRemoved(el)) {
            return;
          }
          if (el instanceof Path$1) {
            savePathStates(el);
          }
          // Only updated on changed element. In case element is incremental and don't want to rerender.
          // TODO, a more proper way?
          if (el.__dirty) {
            var prevStates = el.prevStates;
            // Restore states without animation
            if (prevStates) {
              el.useStates(prevStates);
            }
          }
          // Update state transition and enable animation again.
          if (enableAnimation) {
            el.stateTransition = stateTransition;
            var textContent = el.getTextContent();
            var textGuide = el.getTextGuideLine();
            // TODO Is it necessary to animate label?
            if (textContent) {
              textContent.stateTransition = stateTransition;
            }
            if (textGuide) {
              textGuide.stateTransition = stateTransition;
            }
          }
          // Use highlighted and selected flag to toggle states.
          if (el.__dirty) {
            applyElementStates(el);
          }
        }
      });
    }
    createExtensionAPI = function (ecIns) {
      return new (/** @class */function (_super) {
        __extends(class_1, _super);
        function class_1() {
          return _super !== null && _super.apply(this, arguments) || this;
        }
        class_1.prototype.getCoordinateSystems = function () {
          return ecIns._coordSysMgr.getCoordinateSystems();
        };
        class_1.prototype.getComponentByElement = function (el) {
          while (el) {
            var modelInfo = el.__ecComponentInfo;
            if (modelInfo != null) {
              return ecIns._model.getComponent(modelInfo.mainType, modelInfo.index);
            }
            el = el.parent;
          }
        };
        class_1.prototype.enterEmphasis = function (el, highlightDigit) {
          enterEmphasis(el, highlightDigit);
          markStatusToUpdate(ecIns);
        };
        class_1.prototype.leaveEmphasis = function (el, highlightDigit) {
          leaveEmphasis(el, highlightDigit);
          markStatusToUpdate(ecIns);
        };
        class_1.prototype.enterBlur = function (el) {
          enterBlur(el);
          markStatusToUpdate(ecIns);
        };
        class_1.prototype.leaveBlur = function (el) {
          leaveBlur(el);
          markStatusToUpdate(ecIns);
        };
        class_1.prototype.enterSelect = function (el) {
          enterSelect(el);
          markStatusToUpdate(ecIns);
        };
        class_1.prototype.leaveSelect = function (el) {
          leaveSelect(el);
          markStatusToUpdate(ecIns);
        };
        class_1.prototype.getModel = function () {
          return ecIns.getModel();
        };
        class_1.prototype.getViewOfComponentModel = function (componentModel) {
          return ecIns.getViewOfComponentModel(componentModel);
        };
        class_1.prototype.getViewOfSeriesModel = function (seriesModel) {
          return ecIns.getViewOfSeriesModel(seriesModel);
        };
        return class_1;
      }(ExtensionAPI$1))(ecIns);
    };
    enableConnect = function (chart) {
      function updateConnectedChartsStatus(charts, status) {
        for (var i = 0; i < charts.length; i++) {
          var otherChart = charts[i];
          otherChart[CONNECT_STATUS_KEY] = status;
        }
      }
      each$f(eventActionMap, function (actionType, eventType) {
        chart._messageCenter.on(eventType, function (event) {
          if (connectedGroups[chart.group] && chart[CONNECT_STATUS_KEY] !== CONNECT_STATUS_PENDING) {
            if (event && event.escapeConnect) {
              return;
            }
            var action_1 = chart.makeActionFromEvent(event);
            var otherCharts_1 = [];
            each$f(instances, function (otherChart) {
              if (otherChart !== chart && otherChart.group === chart.group) {
                otherCharts_1.push(otherChart);
              }
            });
            updateConnectedChartsStatus(otherCharts_1, CONNECT_STATUS_PENDING);
            each$f(otherCharts_1, function (otherChart) {
              if (otherChart[CONNECT_STATUS_KEY] !== CONNECT_STATUS_UPDATING) {
                otherChart.dispatchAction(action_1);
              }
            });
            updateConnectedChartsStatus(otherCharts_1, CONNECT_STATUS_UPDATED);
          }
        });
      });
    };
  }();
  return ECharts;
}(Eventful$1);
var echartsProto = ECharts.prototype;
echartsProto.on = createRegisterEventWithLowercaseECharts('on');
echartsProto.off = createRegisterEventWithLowercaseECharts('off');
/**
 * @deprecated
 */
// @ts-ignore
echartsProto.one = function (eventName, cb, ctx) {
  var self = this;
  deprecateLog('ECharts#one is deprecated.');
  function wrapped() {
    var args2 = [];
    for (var _i = 0; _i < arguments.length; _i++) {
      args2[_i] = arguments[_i];
    }
    cb && cb.apply && cb.apply(this, args2);
    // @ts-ignore
    self.off(eventName, wrapped);
  }
  // @ts-ignore
  this.on.call(this, eventName, wrapped, ctx);
};
var MOUSE_EVENT_NAMES = ['click', 'dblclick', 'mouseover', 'mouseout', 'mousemove', 'mousedown', 'mouseup', 'globalout', 'contextmenu'];
function disposedWarning(id) {
  {
    warn('Instance ' + id + ' has been disposed');
  }
}
var actions = {};
/**
 * Map eventType to actionType
 */
var eventActionMap = {};
var dataProcessorFuncs = [];
var optionPreprocessorFuncs = [];
var visualFuncs = [];
var themeStorage = {};
var loadingEffects = {};
var instances = {};
var connectedGroups = {};
var idBase = +new Date() - 0;
var DOM_ATTRIBUTE_KEY = '_echarts_instance_';
/**
 * @param opts.devicePixelRatio Use window.devicePixelRatio by default
 * @param opts.renderer Can choose 'canvas' or 'svg' to render the chart.
 * @param opts.width Use clientWidth of the input `dom` by default.
 *        Can be 'auto' (the same as null/undefined)
 * @param opts.height Use clientHeight of the input `dom` by default.
 *        Can be 'auto' (the same as null/undefined)
 * @param opts.locale Specify the locale.
 * @param opts.useDirtyRect Enable dirty rectangle rendering or not.
 */
function init$1(dom, theme, opts) {
  var isClient = !(opts && opts.ssr);
  if (isClient) {
    {
      if (!dom) {
        throw new Error('Initialize failed: invalid dom.');
      }
    }
    var existInstance = getInstanceByDom(dom);
    if (existInstance) {
      {
        warn('There is a chart instance already initialized on the dom.');
      }
      return existInstance;
    }
    {
      if (isDom(dom) && dom.nodeName.toUpperCase() !== 'CANVAS' && (!dom.clientWidth && (!opts || opts.width == null) || !dom.clientHeight && (!opts || opts.height == null))) {
        warn('Can\'t get DOM width or height. Please check ' + 'dom.clientWidth and dom.clientHeight. They should not be 0.' + 'For example, you may need to call this in the callback ' + 'of window.onload.');
      }
    }
  }
  var chart = new ECharts(dom, theme, opts);
  chart.id = 'ec_' + idBase++;
  instances[chart.id] = chart;
  isClient && setAttribute(dom, DOM_ATTRIBUTE_KEY, chart.id);
  enableConnect(chart);
  lifecycle$1.trigger('afterinit', chart);
  return chart;
}
function getInstanceByDom(dom) {
  return instances[getAttribute(dom, DOM_ATTRIBUTE_KEY)];
}
/**
 * Register theme
 */
function registerTheme(name, theme) {
  themeStorage[name] = theme;
}
/**
 * Register option preprocessor
 */
function registerPreprocessor(preprocessorFunc) {
  if (indexOf(optionPreprocessorFuncs, preprocessorFunc) < 0) {
    optionPreprocessorFuncs.push(preprocessorFunc);
  }
}
function registerProcessor(priority, processor) {
  normalizeRegister(dataProcessorFuncs, priority, processor, PRIORITY_PROCESSOR_DEFAULT);
}
/**
 * Register postIniter
 * @param {Function} postInitFunc
 */
function registerPostInit(postInitFunc) {
  registerUpdateLifecycle('afterinit', postInitFunc);
}
/**
 * Register postUpdater
 * @param {Function} postUpdateFunc
 */
function registerPostUpdate(postUpdateFunc) {
  registerUpdateLifecycle('afterupdate', postUpdateFunc);
}
function registerUpdateLifecycle(name, cb) {
  lifecycle$1.on(name, cb);
}
function registerAction(actionInfo, eventName, action) {
  if (isFunction(eventName)) {
    action = eventName;
    eventName = '';
  }
  var actionType = isObject$3(actionInfo) ? actionInfo.type : [actionInfo, actionInfo = {
    event: eventName
  }][0];
  // Event name is all lowercase
  actionInfo.event = (actionInfo.event || actionType).toLowerCase();
  eventName = actionInfo.event;
  if (eventActionMap[eventName]) {
    // Already registered.
    return;
  }
  // Validate action type and event name.
  assert(ACTION_REG.test(actionType) && ACTION_REG.test(eventName));
  if (!actions[actionType]) {
    actions[actionType] = {
      action: action,
      actionInfo: actionInfo
    };
  }
  eventActionMap[eventName] = actionType;
}
function registerCoordinateSystem(type, coordSysCreator) {
  CoordinateSystem.register(type, coordSysCreator);
}
function registerLayout(priority, layoutTask) {
  normalizeRegister(visualFuncs, priority, layoutTask, PRIORITY_VISUAL_LAYOUT, 'layout');
}
function registerVisual(priority, visualTask) {
  normalizeRegister(visualFuncs, priority, visualTask, PRIORITY_VISUAL_CHART, 'visual');
}
var registeredTasks = [];
function normalizeRegister(targetList, priority, fn, defaultPriority, visualType) {
  if (isFunction(priority) || isObject$3(priority)) {
    fn = priority;
    priority = defaultPriority;
  }
  {
    if (isNaN(priority) || priority == null) {
      throw new Error('Illegal priority');
    }
    // Check duplicate
    each$f(targetList, function (wrap) {
      assert(wrap.__raw !== fn);
    });
  }
  // Already registered
  if (indexOf(registeredTasks, fn) >= 0) {
    return;
  }
  registeredTasks.push(fn);
  var stageHandler = Scheduler$1.wrapStageHandler(fn, visualType);
  stageHandler.__prio = priority;
  stageHandler.__raw = fn;
  targetList.push(stageHandler);
}
function registerLoading(name, loadingFx) {
  loadingEffects[name] = loadingFx;
}
/**
 * The parameters and usage: see `geoSourceManager.registerMap`.
 * Compatible with previous `echarts.registerMap`.
 */
function registerMap$1(mapName, geoJson, specialAreas) {
  var registerMap = getImpl('registerMap');
  registerMap && registerMap(mapName, geoJson, specialAreas);
}
var registerTransform = registerExternalTransform;
/**
 * Globa dispatchAction to a specified chart instance.
 */
// export function dispatchAction(payload: { chartId: string } & Payload, opt?: Parameters<ECharts['dispatchAction']>[1]) {
//     if (!payload || !payload.chartId) {
//         // Must have chartId to find chart
//         return;
//     }
//     const chart = instances[payload.chartId];
//     if (chart) {
//         chart.dispatchAction(payload, opt);
//     }
// }
// Builtin global visual
registerVisual(PRIORITY_VISUAL_GLOBAL, seriesStyleTask);
registerVisual(PRIORITY_VISUAL_CHART_DATA_CUSTOM, dataStyleTask);
registerVisual(PRIORITY_VISUAL_CHART_DATA_CUSTOM, dataColorPaletteTask);
registerVisual(PRIORITY_VISUAL_GLOBAL, seriesSymbolTask);
registerVisual(PRIORITY_VISUAL_CHART_DATA_CUSTOM, dataSymbolTask);
registerVisual(PRIORITY_VISUAL_DECAL, decalVisual);
registerPreprocessor(globalBackwardCompat);
registerProcessor(PRIORITY_PROCESSOR_DATASTACK, dataStack);
registerLoading('default', defaultLoading);
// Default actions
registerAction({
  type: HIGHLIGHT_ACTION_TYPE,
  event: HIGHLIGHT_ACTION_TYPE,
  update: HIGHLIGHT_ACTION_TYPE
}, noop);
registerAction({
  type: DOWNPLAY_ACTION_TYPE,
  event: DOWNPLAY_ACTION_TYPE,
  update: DOWNPLAY_ACTION_TYPE
}, noop);
registerAction({
  type: SELECT_ACTION_TYPE,
  event: SELECT_ACTION_TYPE,
  update: SELECT_ACTION_TYPE
}, noop);
registerAction({
  type: UNSELECT_ACTION_TYPE,
  event: UNSELECT_ACTION_TYPE,
  update: UNSELECT_ACTION_TYPE
}, noop);
registerAction({
  type: TOGGLE_SELECT_ACTION_TYPE,
  event: TOGGLE_SELECT_ACTION_TYPE,
  update: TOGGLE_SELECT_ACTION_TYPE
}, noop);
// Default theme
registerTheme('light', lightTheme);
registerTheme('dark', darkTheme);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var extensions = [];
var extensionRegisters = {
  registerPreprocessor: registerPreprocessor,
  registerProcessor: registerProcessor,
  registerPostInit: registerPostInit,
  registerPostUpdate: registerPostUpdate,
  registerUpdateLifecycle: registerUpdateLifecycle,
  registerAction: registerAction,
  registerCoordinateSystem: registerCoordinateSystem,
  registerLayout: registerLayout,
  registerVisual: registerVisual,
  registerTransform: registerTransform,
  registerLoading: registerLoading,
  registerMap: registerMap$1,
  registerImpl: registerImpl,
  PRIORITY: PRIORITY,
  ComponentModel: ComponentModel$1,
  ComponentView: ComponentView$1,
  SeriesModel: SeriesModel$1,
  ChartView: ChartView$1,
  // TODO Use ComponentModel and SeriesModel instead of Constructor
  registerComponentModel: function (ComponentModelClass) {
    ComponentModel$1.registerClass(ComponentModelClass);
  },
  registerComponentView: function (ComponentViewClass) {
    ComponentView$1.registerClass(ComponentViewClass);
  },
  registerSeriesModel: function (SeriesModelClass) {
    SeriesModel$1.registerClass(SeriesModelClass);
  },
  registerChartView: function (ChartViewClass) {
    ChartView$1.registerClass(ChartViewClass);
  },
  registerSubTypeDefaulter: function (componentType, defaulter) {
    ComponentModel$1.registerSubTypeDefaulter(componentType, defaulter);
  },
  registerPainter: function (painterType, PainterCtor) {
    registerPainter(painterType, PainterCtor);
  }
};
function use(ext) {
  if (isArray$1(ext)) {
    // use([ChartLine, ChartBar]);
    each$f(ext, function (singleExt) {
      use(singleExt);
    });
    return;
  }
  if (indexOf(extensions, ext) >= 0) {
    return;
  }
  extensions.push(ext);
  if (isFunction(ext)) {
    ext = {
      install: ext
    };
  }
  ext.install(extensionRegisters);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function dataIndexMapValueLength(valNumOrArrLengthMoreThan2) {
  return valNumOrArrLengthMoreThan2 == null ? 0 : valNumOrArrLengthMoreThan2.length || 1;
}
function defaultKeyGetter(item) {
  return item;
}
var DataDiffer = /** @class */function () {
  /**
   * @param context Can be visited by this.context in callback.
   */
  function DataDiffer(oldArr, newArr, oldKeyGetter, newKeyGetter, context,
  // By default: 'oneToOne'.
  diffMode) {
    this._old = oldArr;
    this._new = newArr;
    this._oldKeyGetter = oldKeyGetter || defaultKeyGetter;
    this._newKeyGetter = newKeyGetter || defaultKeyGetter;
    // Visible in callback via `this.context`;
    this.context = context;
    this._diffModeMultiple = diffMode === 'multiple';
  }
  /**
   * Callback function when add a data
   */
  DataDiffer.prototype.add = function (func) {
    this._add = func;
    return this;
  };
  /**
   * Callback function when update a data
   */
  DataDiffer.prototype.update = function (func) {
    this._update = func;
    return this;
  };
  /**
   * Callback function when update a data and only work in `cbMode: 'byKey'`.
   */
  DataDiffer.prototype.updateManyToOne = function (func) {
    this._updateManyToOne = func;
    return this;
  };
  /**
   * Callback function when update a data and only work in `cbMode: 'byKey'`.
   */
  DataDiffer.prototype.updateOneToMany = function (func) {
    this._updateOneToMany = func;
    return this;
  };
  /**
   * Callback function when update a data and only work in `cbMode: 'byKey'`.
   */
  DataDiffer.prototype.updateManyToMany = function (func) {
    this._updateManyToMany = func;
    return this;
  };
  /**
   * Callback function when remove a data
   */
  DataDiffer.prototype.remove = function (func) {
    this._remove = func;
    return this;
  };
  DataDiffer.prototype.execute = function () {
    this[this._diffModeMultiple ? '_executeMultiple' : '_executeOneToOne']();
  };
  DataDiffer.prototype._executeOneToOne = function () {
    var oldArr = this._old;
    var newArr = this._new;
    var newDataIndexMap = {};
    var oldDataKeyArr = new Array(oldArr.length);
    var newDataKeyArr = new Array(newArr.length);
    this._initIndexMap(oldArr, null, oldDataKeyArr, '_oldKeyGetter');
    this._initIndexMap(newArr, newDataIndexMap, newDataKeyArr, '_newKeyGetter');
    for (var i = 0; i < oldArr.length; i++) {
      var oldKey = oldDataKeyArr[i];
      var newIdxMapVal = newDataIndexMap[oldKey];
      var newIdxMapValLen = dataIndexMapValueLength(newIdxMapVal);
      // idx can never be empty array here. see 'set null' logic below.
      if (newIdxMapValLen > 1) {
        // Consider there is duplicate key (for example, use dataItem.name as key).
        // We should make sure every item in newArr and oldArr can be visited.
        var newIdx = newIdxMapVal.shift();
        if (newIdxMapVal.length === 1) {
          newDataIndexMap[oldKey] = newIdxMapVal[0];
        }
        this._update && this._update(newIdx, i);
      } else if (newIdxMapValLen === 1) {
        newDataIndexMap[oldKey] = null;
        this._update && this._update(newIdxMapVal, i);
      } else {
        this._remove && this._remove(i);
      }
    }
    this._performRestAdd(newDataKeyArr, newDataIndexMap);
  };
  /**
   * For example, consider the case:
   * oldData: [o0, o1, o2, o3, o4, o5, o6, o7],
   * newData: [n0, n1, n2, n3, n4, n5, n6, n7, n8],
   * Where:
   *     o0, o1, n0 has key 'a' (many to one)
   *     o5, n4, n5, n6 has key 'b' (one to many)
   *     o2, n1 has key 'c' (one to one)
   *     n2, n3 has key 'd' (add)
   *     o3, o4 has key 'e' (remove)
   *     o6, o7, n7, n8 has key 'f' (many to many, treated as add and remove)
   * Then:
   *     (The order of the following directives are not ensured.)
   *     this._updateManyToOne(n0, [o0, o1]);
   *     this._updateOneToMany([n4, n5, n6], o5);
   *     this._update(n1, o2);
   *     this._remove(o3);
   *     this._remove(o4);
   *     this._remove(o6);
   *     this._remove(o7);
   *     this._add(n2);
   *     this._add(n3);
   *     this._add(n7);
   *     this._add(n8);
   */
  DataDiffer.prototype._executeMultiple = function () {
    var oldArr = this._old;
    var newArr = this._new;
    var oldDataIndexMap = {};
    var newDataIndexMap = {};
    var oldDataKeyArr = [];
    var newDataKeyArr = [];
    this._initIndexMap(oldArr, oldDataIndexMap, oldDataKeyArr, '_oldKeyGetter');
    this._initIndexMap(newArr, newDataIndexMap, newDataKeyArr, '_newKeyGetter');
    for (var i = 0; i < oldDataKeyArr.length; i++) {
      var oldKey = oldDataKeyArr[i];
      var oldIdxMapVal = oldDataIndexMap[oldKey];
      var newIdxMapVal = newDataIndexMap[oldKey];
      var oldIdxMapValLen = dataIndexMapValueLength(oldIdxMapVal);
      var newIdxMapValLen = dataIndexMapValueLength(newIdxMapVal);
      if (oldIdxMapValLen > 1 && newIdxMapValLen === 1) {
        this._updateManyToOne && this._updateManyToOne(newIdxMapVal, oldIdxMapVal);
        newDataIndexMap[oldKey] = null;
      } else if (oldIdxMapValLen === 1 && newIdxMapValLen > 1) {
        this._updateOneToMany && this._updateOneToMany(newIdxMapVal, oldIdxMapVal);
        newDataIndexMap[oldKey] = null;
      } else if (oldIdxMapValLen === 1 && newIdxMapValLen === 1) {
        this._update && this._update(newIdxMapVal, oldIdxMapVal);
        newDataIndexMap[oldKey] = null;
      } else if (oldIdxMapValLen > 1 && newIdxMapValLen > 1) {
        this._updateManyToMany && this._updateManyToMany(newIdxMapVal, oldIdxMapVal);
        newDataIndexMap[oldKey] = null;
      } else if (oldIdxMapValLen > 1) {
        for (var i_1 = 0; i_1 < oldIdxMapValLen; i_1++) {
          this._remove && this._remove(oldIdxMapVal[i_1]);
        }
      } else {
        this._remove && this._remove(oldIdxMapVal);
      }
    }
    this._performRestAdd(newDataKeyArr, newDataIndexMap);
  };
  DataDiffer.prototype._performRestAdd = function (newDataKeyArr, newDataIndexMap) {
    for (var i = 0; i < newDataKeyArr.length; i++) {
      var newKey = newDataKeyArr[i];
      var newIdxMapVal = newDataIndexMap[newKey];
      var idxMapValLen = dataIndexMapValueLength(newIdxMapVal);
      if (idxMapValLen > 1) {
        for (var j = 0; j < idxMapValLen; j++) {
          this._add && this._add(newIdxMapVal[j]);
        }
      } else if (idxMapValLen === 1) {
        this._add && this._add(newIdxMapVal);
      }
      // Support both `newDataKeyArr` are duplication removed or not removed.
      newDataIndexMap[newKey] = null;
    }
  };
  DataDiffer.prototype._initIndexMap = function (arr,
  // Can be null.
  map,
  // In 'byKey', the output `keyArr` is duplication removed.
  // In 'byIndex', the output `keyArr` is not duplication removed and
  //     its indices are accurately corresponding to `arr`.
  keyArr, keyGetterName) {
    var cbModeMultiple = this._diffModeMultiple;
    for (var i = 0; i < arr.length; i++) {
      // Add prefix to avoid conflict with Object.prototype.
      var key = '_ec_' + this[keyGetterName](arr[i], i);
      if (!cbModeMultiple) {
        keyArr[i] = key;
      }
      if (!map) {
        continue;
      }
      var idxMapVal = map[key];
      var idxMapValLen = dataIndexMapValueLength(idxMapVal);
      if (idxMapValLen === 0) {
        // Simple optimize: in most cases, one index has one key,
        // do not need array.
        map[key] = i;
        if (cbModeMultiple) {
          keyArr.push(key);
        }
      } else if (idxMapValLen === 1) {
        map[key] = [idxMapVal, i];
      } else {
        idxMapVal.push(i);
      }
    }
  };
  return DataDiffer;
}();
var DataDiffer$1 = DataDiffer;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DimensionUserOuput = /** @class */function () {
  function DimensionUserOuput(encode, dimRequest) {
    this._encode = encode;
    this._schema = dimRequest;
  }
  DimensionUserOuput.prototype.get = function () {
    return {
      // Do not generate full dimension name until fist used.
      fullDimensions: this._getFullDimensionNames(),
      encode: this._encode
    };
  };
  /**
   * Get all data store dimension names.
   * Theoretically a series data store is defined both by series and used dataset (if any).
   * If some dimensions are omitted for performance reason in `this.dimensions`,
   * the dimension name may not be auto-generated if user does not specify a dimension name.
   * In this case, the dimension name is `null`/`undefined`.
   */
  DimensionUserOuput.prototype._getFullDimensionNames = function () {
    if (!this._cachedDimNames) {
      this._cachedDimNames = this._schema ? this._schema.makeOutputDimensionNames() : [];
    }
    return this._cachedDimNames;
  };
  return DimensionUserOuput;
}();
function summarizeDimensions(data, schema) {
  var summary = {};
  var encode = summary.encode = {};
  var notExtraCoordDimMap = createHashMap();
  var defaultedLabel = [];
  var defaultedTooltip = [];
  var userOutputEncode = {};
  each$f(data.dimensions, function (dimName) {
    var dimItem = data.getDimensionInfo(dimName);
    var coordDim = dimItem.coordDim;
    if (coordDim) {
      {
        assert(VISUAL_DIMENSIONS.get(coordDim) == null);
      }
      var coordDimIndex = dimItem.coordDimIndex;
      getOrCreateEncodeArr(encode, coordDim)[coordDimIndex] = dimName;
      if (!dimItem.isExtraCoord) {
        notExtraCoordDimMap.set(coordDim, 1);
        // Use the last coord dim (and label friendly) as default label,
        // because when dataset is used, it is hard to guess which dimension
        // can be value dimension. If both show x, y on label is not look good,
        // and conventionally y axis is focused more.
        if (mayLabelDimType(dimItem.type)) {
          defaultedLabel[0] = dimName;
        }
        // User output encode do not contain generated coords.
        // And it only has index. User can use index to retrieve value from the raw item array.
        getOrCreateEncodeArr(userOutputEncode, coordDim)[coordDimIndex] = data.getDimensionIndex(dimItem.name);
      }
      if (dimItem.defaultTooltip) {
        defaultedTooltip.push(dimName);
      }
    }
    VISUAL_DIMENSIONS.each(function (v, otherDim) {
      var encodeArr = getOrCreateEncodeArr(encode, otherDim);
      var dimIndex = dimItem.otherDims[otherDim];
      if (dimIndex != null && dimIndex !== false) {
        encodeArr[dimIndex] = dimItem.name;
      }
    });
  });
  var dataDimsOnCoord = [];
  var encodeFirstDimNotExtra = {};
  notExtraCoordDimMap.each(function (v, coordDim) {
    var dimArr = encode[coordDim];
    encodeFirstDimNotExtra[coordDim] = dimArr[0];
    // Not necessary to remove duplicate, because a data
    // dim canot on more than one coordDim.
    dataDimsOnCoord = dataDimsOnCoord.concat(dimArr);
  });
  summary.dataDimsOnCoord = dataDimsOnCoord;
  summary.dataDimIndicesOnCoord = map$1(dataDimsOnCoord, function (dimName) {
    return data.getDimensionInfo(dimName).storeDimIndex;
  });
  summary.encodeFirstDimNotExtra = encodeFirstDimNotExtra;
  var encodeLabel = encode.label;
  // FIXME `encode.label` is not recommended, because formatter cannot be set
  // in this way. Use label.formatter instead. Maybe remove this approach someday.
  if (encodeLabel && encodeLabel.length) {
    defaultedLabel = encodeLabel.slice();
  }
  var encodeTooltip = encode.tooltip;
  if (encodeTooltip && encodeTooltip.length) {
    defaultedTooltip = encodeTooltip.slice();
  } else if (!defaultedTooltip.length) {
    defaultedTooltip = defaultedLabel.slice();
  }
  encode.defaultedLabel = defaultedLabel;
  encode.defaultedTooltip = defaultedTooltip;
  summary.userOutput = new DimensionUserOuput(userOutputEncode, schema);
  return summary;
}
function getOrCreateEncodeArr(encode, dim) {
  if (!encode.hasOwnProperty(dim)) {
    encode[dim] = [];
  }
  return encode[dim];
}
// FIXME:TS should be type `AxisType`
function getDimensionTypeByAxis(axisType) {
  return axisType === 'category' ? 'ordinal' : axisType === 'time' ? 'time' : 'float';
}
function mayLabelDimType(dimType) {
  // In most cases, ordinal and time do not suitable for label.
  // Ordinal info can be displayed on axis. Time is too long.
  return !(dimType === 'ordinal' || dimType === 'time');
}
// function findTheLastDimMayLabel(data) {
//     // Get last value dim
//     let dimensions = data.dimensions.slice();
//     let valueType;
//     let valueDim;
//     while (dimensions.length && (
//         valueDim = dimensions.pop(),
//         valueType = data.getDimensionInfo(valueDim).type,
//         valueType === 'ordinal' || valueType === 'time'
//     )) {} // jshint ignore:line
//     return valueDim;
// }

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SeriesDimensionDefine = /** @class */function () {
  /**
   * @param opt All of the fields will be shallow copied.
   */
  function SeriesDimensionDefine(opt) {
    /**
     * The format of `otherDims` is:
     * ```js
     * {
     *     tooltip?: number
     *     label?: number
     *     itemName?: number
     *     seriesName?: number
     * }
     * ```
     *
     * A `series.encode` can specified these fields:
     * ```js
     * encode: {
     *     // "3, 1, 5" is the index of data dimension.
     *     tooltip: [3, 1, 5],
     *     label: [0, 3],
     *     ...
     * }
     * ```
     * `otherDims` is the parse result of the `series.encode` above, like:
     * ```js
     * // Suppose the index of this data dimension is `3`.
     * this.otherDims = {
     *     // `3` is at the index `0` of the `encode.tooltip`
     *     tooltip: 0,
     *     // `3` is at the index `1` of the `encode.label`
     *     label: 1
     * };
     * ```
     *
     * This prop should never be `null`/`undefined` after initialized.
     */
    this.otherDims = {};
    if (opt != null) {
      extend(this, opt);
    }
  }
  return SeriesDimensionDefine;
}();
var SeriesDimensionDefine$1 = SeriesDimensionDefine;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$h = makeInner();
var dimTypeShort = {
  float: 'f',
  int: 'i',
  ordinal: 'o',
  number: 'n',
  time: 't'
};
/**
 * Represents the dimension requirement of a series.
 *
 * NOTICE:
 * When there are too many dimensions in dataset and many series, only the used dimensions
 * (i.e., used by coord sys and declared in `series.encode`) are add to `dimensionDefineList`.
 * But users may query data by other unused dimension names.
 * In this case, users can only query data if and only if they have defined dimension names
 * via ec option, so we provide `getDimensionIndexFromSource`, which only query them from
 * `source` dimensions.
 */
var SeriesDataSchema = /** @class */function () {
  function SeriesDataSchema(opt) {
    this.dimensions = opt.dimensions;
    this._dimOmitted = opt.dimensionOmitted;
    this.source = opt.source;
    this._fullDimCount = opt.fullDimensionCount;
    this._updateDimOmitted(opt.dimensionOmitted);
  }
  SeriesDataSchema.prototype.isDimensionOmitted = function () {
    return this._dimOmitted;
  };
  SeriesDataSchema.prototype._updateDimOmitted = function (dimensionOmitted) {
    this._dimOmitted = dimensionOmitted;
    if (!dimensionOmitted) {
      return;
    }
    if (!this._dimNameMap) {
      this._dimNameMap = ensureSourceDimNameMap(this.source);
    }
  };
  /**
   * @caution Can only be used when `dimensionOmitted: true`.
   *
   * Get index by user defined dimension name (i.e., not internal generate name).
   * That is, get index from `dimensionsDefine`.
   * If no `dimensionsDefine`, or no name get, return -1.
   */
  SeriesDataSchema.prototype.getSourceDimensionIndex = function (dimName) {
    return retrieve2(this._dimNameMap.get(dimName), -1);
  };
  /**
   * @caution Can only be used when `dimensionOmitted: true`.
   *
   * Notice: may return `null`/`undefined` if user not specify dimension names.
   */
  SeriesDataSchema.prototype.getSourceDimension = function (dimIndex) {
    var dimensionsDefine = this.source.dimensionsDefine;
    if (dimensionsDefine) {
      return dimensionsDefine[dimIndex];
    }
  };
  SeriesDataSchema.prototype.makeStoreSchema = function () {
    var dimCount = this._fullDimCount;
    var willRetrieveDataByName = shouldRetrieveDataByName(this.source);
    var makeHashStrict = !shouldOmitUnusedDimensions(dimCount);
    // If source don't have dimensions or series don't omit unsed dimensions.
    // Generate from seriesDimList directly
    var dimHash = '';
    var dims = [];
    for (var fullDimIdx = 0, seriesDimIdx = 0; fullDimIdx < dimCount; fullDimIdx++) {
      var property = void 0;
      var type = void 0;
      var ordinalMeta = void 0;
      var seriesDimDef = this.dimensions[seriesDimIdx];
      // The list has been sorted by `storeDimIndex` asc.
      if (seriesDimDef && seriesDimDef.storeDimIndex === fullDimIdx) {
        property = willRetrieveDataByName ? seriesDimDef.name : null;
        type = seriesDimDef.type;
        ordinalMeta = seriesDimDef.ordinalMeta;
        seriesDimIdx++;
      } else {
        var sourceDimDef = this.getSourceDimension(fullDimIdx);
        if (sourceDimDef) {
          property = willRetrieveDataByName ? sourceDimDef.name : null;
          type = sourceDimDef.type;
        }
      }
      dims.push({
        property: property,
        type: type,
        ordinalMeta: ordinalMeta
      });
      // If retrieving data by index,
      //   use <index, type, ordinalMeta> to determine whether data can be shared.
      //   (Because in this case there might be no dimension name defined in dataset, but indices always exists).
      //   (Indices are always 0, 1, 2, ..., so we can ignore them to shorten the hash).
      // Otherwise if retrieving data by property name (like `data: [{aa: 123, bb: 765}, ...]`),
      //   use <property, type, ordinalMeta> in hash.
      if (willRetrieveDataByName && property != null
      // For data stack, we have make sure each series has its own dim on this store.
      // So we do not add property to hash to make sure they can share this store.
      && (!seriesDimDef || !seriesDimDef.isCalculationCoord)) {
        dimHash += makeHashStrict
        // Use escape character '`' in case that property name contains '$'.
        ? property.replace(/\`/g, '`1').replace(/\$/g, '`2')
        // For better performance, when there are large dimensions, tolerant this defects that hardly meet.
        : property;
      }
      dimHash += '$';
      dimHash += dimTypeShort[type] || 'f';
      if (ordinalMeta) {
        dimHash += ordinalMeta.uid;
      }
      dimHash += '$';
    }
    // Source from endpoint(usually series) will be read differently
    // when seriesLayoutBy or startIndex(which is affected by sourceHeader) are different.
    // So we use this three props as key.
    var source = this.source;
    var hash = [source.seriesLayoutBy, source.startIndex, dimHash].join('$$');
    return {
      dimensions: dims,
      hash: hash
    };
  };
  SeriesDataSchema.prototype.makeOutputDimensionNames = function () {
    var result = [];
    for (var fullDimIdx = 0, seriesDimIdx = 0; fullDimIdx < this._fullDimCount; fullDimIdx++) {
      var name_1 = void 0;
      var seriesDimDef = this.dimensions[seriesDimIdx];
      // The list has been sorted by `storeDimIndex` asc.
      if (seriesDimDef && seriesDimDef.storeDimIndex === fullDimIdx) {
        if (!seriesDimDef.isCalculationCoord) {
          name_1 = seriesDimDef.name;
        }
        seriesDimIdx++;
      } else {
        var sourceDimDef = this.getSourceDimension(fullDimIdx);
        if (sourceDimDef) {
          name_1 = sourceDimDef.name;
        }
      }
      result.push(name_1);
    }
    return result;
  };
  SeriesDataSchema.prototype.appendCalculationDimension = function (dimDef) {
    this.dimensions.push(dimDef);
    dimDef.isCalculationCoord = true;
    this._fullDimCount++;
    // If append dimension on a data store, consider the store
    // might be shared by different series, series dimensions not
    // really map to store dimensions.
    this._updateDimOmitted(true);
  };
  return SeriesDataSchema;
}();
function isSeriesDataSchema(schema) {
  return schema instanceof SeriesDataSchema;
}
function createDimNameMap(dimsDef) {
  var dataDimNameMap = createHashMap();
  for (var i = 0; i < (dimsDef || []).length; i++) {
    var dimDefItemRaw = dimsDef[i];
    var userDimName = isObject$3(dimDefItemRaw) ? dimDefItemRaw.name : dimDefItemRaw;
    if (userDimName != null && dataDimNameMap.get(userDimName) == null) {
      dataDimNameMap.set(userDimName, i);
    }
  }
  return dataDimNameMap;
}
function ensureSourceDimNameMap(source) {
  var innerSource = inner$h(source);
  return innerSource.dimNameMap || (innerSource.dimNameMap = createDimNameMap(source.dimensionsDefine));
}
function shouldOmitUnusedDimensions(dimCount) {
  return dimCount > 30;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var isObject$1 = isObject$3;
var map = map$1;
var CtorInt32Array = typeof Int32Array === 'undefined' ? Array : Int32Array;
// Use prefix to avoid index to be the same as otherIdList[idx],
// which will cause weird update animation.
var ID_PREFIX = 'e\0\0';
var INDEX_NOT_FOUND = -1;
// type SeriesDimensionIndex = DimensionIndex;
var TRANSFERABLE_PROPERTIES = ['hasItemOption', '_nameList', '_idList', '_invertedIndicesMap', '_dimSummary', 'userOutput', '_rawData', '_dimValueGetter', '_nameDimIdx', '_idDimIdx', '_nameRepeatCount'];
var CLONE_PROPERTIES = ['_approximateExtent'];
// -----------------------------
// Internal method declarations:
// -----------------------------
var prepareInvertedIndex;
var getId;
var getIdNameFromStore;
var normalizeDimensions;
var transferProperties;
var cloneListForMapAndSample;
var makeIdFromName;
var SeriesData = /** @class */function () {
  /**
   * @param dimensionsInput.dimensions
   *        For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...].
   *        Dimensions should be concrete names like x, y, z, lng, lat, angle, radius
   */
  function SeriesData(dimensionsInput, hostModel) {
    this.type = 'list';
    this._dimOmitted = false;
    this._nameList = [];
    this._idList = [];
    // Models of data option is stored sparse for optimizing memory cost
    // Never used yet (not used yet).
    // private _optionModels: Model[] = [];
    // Global visual properties after visual coding
    this._visual = {};
    // Global layout properties.
    this._layout = {};
    // Item visual properties after visual coding
    this._itemVisuals = [];
    // Item layout properties after layout
    this._itemLayouts = [];
    // Graphic elements
    this._graphicEls = [];
    // key: dim, value: extent
    this._approximateExtent = {};
    this._calculationInfo = {};
    // Having detected that there is data item is non primitive type
    // (in type `OptionDataItemObject`).
    // Like `data: [ { value: xx, itemStyle: {...} }, ...]`
    // At present it only happen in `SOURCE_FORMAT_ORIGINAL`.
    this.hasItemOption = false;
    // Methods that create a new list based on this list should be listed here.
    // Notice that those method should `RETURN` the new list.
    this.TRANSFERABLE_METHODS = ['cloneShallow', 'downSample', 'minmaxDownSample', 'lttbDownSample', 'map'];
    // Methods that change indices of this list should be listed here.
    this.CHANGABLE_METHODS = ['filterSelf', 'selectRange'];
    this.DOWNSAMPLE_METHODS = ['downSample', 'minmaxDownSample', 'lttbDownSample'];
    var dimensions;
    var assignStoreDimIdx = false;
    if (isSeriesDataSchema(dimensionsInput)) {
      dimensions = dimensionsInput.dimensions;
      this._dimOmitted = dimensionsInput.isDimensionOmitted();
      this._schema = dimensionsInput;
    } else {
      assignStoreDimIdx = true;
      dimensions = dimensionsInput;
    }
    dimensions = dimensions || ['x', 'y'];
    var dimensionInfos = {};
    var dimensionNames = [];
    var invertedIndicesMap = {};
    var needsHasOwn = false;
    var emptyObj = {};
    for (var i = 0; i < dimensions.length; i++) {
      // Use the original dimensions[i], where other flag props may exists.
      var dimInfoInput = dimensions[i];
      var dimensionInfo = isString(dimInfoInput) ? new SeriesDimensionDefine$1({
        name: dimInfoInput
      }) : !(dimInfoInput instanceof SeriesDimensionDefine$1) ? new SeriesDimensionDefine$1(dimInfoInput) : dimInfoInput;
      var dimensionName = dimensionInfo.name;
      dimensionInfo.type = dimensionInfo.type || 'float';
      if (!dimensionInfo.coordDim) {
        dimensionInfo.coordDim = dimensionName;
        dimensionInfo.coordDimIndex = 0;
      }
      var otherDims = dimensionInfo.otherDims = dimensionInfo.otherDims || {};
      dimensionNames.push(dimensionName);
      dimensionInfos[dimensionName] = dimensionInfo;
      if (emptyObj[dimensionName] != null) {
        needsHasOwn = true;
      }
      if (dimensionInfo.createInvertedIndices) {
        invertedIndicesMap[dimensionName] = [];
      }
      if (otherDims.itemName === 0) {
        this._nameDimIdx = i;
      }
      if (otherDims.itemId === 0) {
        this._idDimIdx = i;
      }
      {
        assert(assignStoreDimIdx || dimensionInfo.storeDimIndex >= 0);
      }
      if (assignStoreDimIdx) {
        dimensionInfo.storeDimIndex = i;
      }
    }
    this.dimensions = dimensionNames;
    this._dimInfos = dimensionInfos;
    this._initGetDimensionInfo(needsHasOwn);
    this.hostModel = hostModel;
    this._invertedIndicesMap = invertedIndicesMap;
    if (this._dimOmitted) {
      var dimIdxToName_1 = this._dimIdxToName = createHashMap();
      each$f(dimensionNames, function (dimName) {
        dimIdxToName_1.set(dimensionInfos[dimName].storeDimIndex, dimName);
      });
    }
  }
  /**
   *
   * Get concrete dimension name by dimension name or dimension index.
   * If input a dimension name, do not validate whether the dimension name exits.
   *
   * @caution
   * @param dim Must make sure the dimension is `SeriesDimensionLoose`.
   * Because only those dimensions will have auto-generated dimension names if not
   * have a user-specified name, and other dimensions will get a return of null/undefined.
   *
   * @notice Because of this reason, should better use `getDimensionIndex` instead, for examples:
   * ```js
   * const val = data.getStore().get(data.getDimensionIndex(dim), dataIdx);
   * ```
   *
   * @return Concrete dim name.
   */
  SeriesData.prototype.getDimension = function (dim) {
    var dimIdx = this._recognizeDimIndex(dim);
    if (dimIdx == null) {
      return dim;
    }
    dimIdx = dim;
    if (!this._dimOmitted) {
      return this.dimensions[dimIdx];
    }
    // Retrieve from series dimension definition because it probably contains
    // generated dimension name (like 'x', 'y').
    var dimName = this._dimIdxToName.get(dimIdx);
    if (dimName != null) {
      return dimName;
    }
    var sourceDimDef = this._schema.getSourceDimension(dimIdx);
    if (sourceDimDef) {
      return sourceDimDef.name;
    }
  };
  /**
   * Get dimension index in data store. Return -1 if not found.
   * Can be used to index value from getRawValue.
   */
  SeriesData.prototype.getDimensionIndex = function (dim) {
    var dimIdx = this._recognizeDimIndex(dim);
    if (dimIdx != null) {
      return dimIdx;
    }
    if (dim == null) {
      return -1;
    }
    var dimInfo = this._getDimInfo(dim);
    return dimInfo ? dimInfo.storeDimIndex : this._dimOmitted ? this._schema.getSourceDimensionIndex(dim) : -1;
  };
  /**
   * The meanings of the input parameter `dim`:
   *
   * + If dim is a number (e.g., `1`), it means the index of the dimension.
   *   For example, `getDimension(0)` will return 'x' or 'lng' or 'radius'.
   * + If dim is a number-like string (e.g., `"1"`):
   *     + If there is the same concrete dim name defined in `series.dimensions` or `dataset.dimensions`,
   *        it means that concrete name.
   *     + If not, it will be converted to a number, which means the index of the dimension.
   *        (why? because of the backward compatibility. We have been tolerating number-like string in
   *        dimension setting, although now it seems that it is not a good idea.)
   *     For example, `visualMap[i].dimension: "1"` is the same meaning as `visualMap[i].dimension: 1`,
   *     if no dimension name is defined as `"1"`.
   * + If dim is a not-number-like string, it means the concrete dim name.
   *   For example, it can be be default name `"x"`, `"y"`, `"z"`, `"lng"`, `"lat"`, `"angle"`, `"radius"`,
   *   or customized in `dimensions` property of option like `"age"`.
   *
   * @return recognized `DimensionIndex`. Otherwise return null/undefined (means that dim is `DimensionName`).
   */
  SeriesData.prototype._recognizeDimIndex = function (dim) {
    if (isNumber(dim)
    // If being a number-like string but not being defined as a dimension name.
    || dim != null && !isNaN(dim) && !this._getDimInfo(dim) && (!this._dimOmitted || this._schema.getSourceDimensionIndex(dim) < 0)) {
      return +dim;
    }
  };
  SeriesData.prototype._getStoreDimIndex = function (dim) {
    var dimIdx = this.getDimensionIndex(dim);
    {
      if (dimIdx == null) {
        throw new Error('Unknown dimension ' + dim);
      }
    }
    return dimIdx;
  };
  /**
   * Get type and calculation info of particular dimension
   * @param dim
   *        Dimension can be concrete names like x, y, z, lng, lat, angle, radius
   *        Or a ordinal number. For example getDimensionInfo(0) will return 'x' or 'lng' or 'radius'
   */
  SeriesData.prototype.getDimensionInfo = function (dim) {
    // Do not clone, because there may be categories in dimInfo.
    return this._getDimInfo(this.getDimension(dim));
  };
  SeriesData.prototype._initGetDimensionInfo = function (needsHasOwn) {
    var dimensionInfos = this._dimInfos;
    this._getDimInfo = needsHasOwn ? function (dimName) {
      return dimensionInfos.hasOwnProperty(dimName) ? dimensionInfos[dimName] : undefined;
    } : function (dimName) {
      return dimensionInfos[dimName];
    };
  };
  /**
   * concrete dimension name list on coord.
   */
  SeriesData.prototype.getDimensionsOnCoord = function () {
    return this._dimSummary.dataDimsOnCoord.slice();
  };
  SeriesData.prototype.mapDimension = function (coordDim, idx) {
    var dimensionsSummary = this._dimSummary;
    if (idx == null) {
      return dimensionsSummary.encodeFirstDimNotExtra[coordDim];
    }
    var dims = dimensionsSummary.encode[coordDim];
    return dims ? dims[idx] : null;
  };
  SeriesData.prototype.mapDimensionsAll = function (coordDim) {
    var dimensionsSummary = this._dimSummary;
    var dims = dimensionsSummary.encode[coordDim];
    return (dims || []).slice();
  };
  SeriesData.prototype.getStore = function () {
    return this._store;
  };
  /**
   * Initialize from data
   * @param data source or data or data store.
   * @param nameList The name of a datum is used on data diff and
   *        default label/tooltip.
   *        A name can be specified in encode.itemName,
   *        or dataItem.name (only for series option data),
   *        or provided in nameList from outside.
   */
  SeriesData.prototype.initData = function (data, nameList, dimValueGetter) {
    var _this = this;
    var store;
    if (data instanceof DataStore) {
      store = data;
    }
    if (!store) {
      var dimensions = this.dimensions;
      var provider = isSourceInstance(data) || isArrayLike(data) ? new DefaultDataProvider(data, dimensions.length) : data;
      store = new DataStore();
      var dimensionInfos = map(dimensions, function (dimName) {
        return {
          type: _this._dimInfos[dimName].type,
          property: dimName
        };
      });
      store.initData(provider, dimensionInfos, dimValueGetter);
    }
    this._store = store;
    // Reset
    this._nameList = (nameList || []).slice();
    this._idList = [];
    this._nameRepeatCount = {};
    this._doInit(0, store.count());
    // Cache summary info for fast visit. See "dimensionHelper".
    // Needs to be initialized after store is prepared.
    this._dimSummary = summarizeDimensions(this, this._schema);
    this.userOutput = this._dimSummary.userOutput;
  };
  /**
   * Caution: Can be only called on raw data (before `this._indices` created).
   */
  SeriesData.prototype.appendData = function (data) {
    var range = this._store.appendData(data);
    this._doInit(range[0], range[1]);
  };
  /**
   * Caution: Can be only called on raw data (before `this._indices` created).
   * This method does not modify `rawData` (`dataProvider`), but only
   * add values to store.
   *
   * The final count will be increased by `Math.max(values.length, names.length)`.
   *
   * @param values That is the SourceType: 'arrayRows', like
   *        [
   *            [12, 33, 44],
   *            [NaN, 43, 1],
   *            ['-', 'asdf', 0]
   *        ]
   *        Each item is exactly corresponding to a dimension.
   */
  SeriesData.prototype.appendValues = function (values, names) {
    var _a = this._store.appendValues(values, names && names.length),
      start = _a.start,
      end = _a.end;
    var shouldMakeIdFromName = this._shouldMakeIdFromName();
    this._updateOrdinalMeta();
    if (names) {
      for (var idx = start; idx < end; idx++) {
        var sourceIdx = idx - start;
        this._nameList[idx] = names[sourceIdx];
        if (shouldMakeIdFromName) {
          makeIdFromName(this, idx);
        }
      }
    }
  };
  SeriesData.prototype._updateOrdinalMeta = function () {
    var store = this._store;
    var dimensions = this.dimensions;
    for (var i = 0; i < dimensions.length; i++) {
      var dimInfo = this._dimInfos[dimensions[i]];
      if (dimInfo.ordinalMeta) {
        store.collectOrdinalMeta(dimInfo.storeDimIndex, dimInfo.ordinalMeta);
      }
    }
  };
  SeriesData.prototype._shouldMakeIdFromName = function () {
    var provider = this._store.getProvider();
    return this._idDimIdx == null && provider.getSource().sourceFormat !== SOURCE_FORMAT_TYPED_ARRAY && !provider.fillStorage;
  };
  SeriesData.prototype._doInit = function (start, end) {
    if (start >= end) {
      return;
    }
    var store = this._store;
    var provider = store.getProvider();
    this._updateOrdinalMeta();
    var nameList = this._nameList;
    var idList = this._idList;
    var sourceFormat = provider.getSource().sourceFormat;
    var isFormatOriginal = sourceFormat === SOURCE_FORMAT_ORIGINAL;
    // Each data item is value
    // [1, 2]
    // 2
    // Bar chart, line chart which uses category axis
    // only gives the 'y' value. 'x' value is the indices of category
    // Use a tempValue to normalize the value to be a (x, y) value
    // If dataItem is {name: ...} or {id: ...}, it has highest priority.
    // This kind of ids and names are always stored `_nameList` and `_idList`.
    if (isFormatOriginal && !provider.pure) {
      var sharedDataItem = [];
      for (var idx = start; idx < end; idx++) {
        // NOTICE: Try not to write things into dataItem
        var dataItem = provider.getItem(idx, sharedDataItem);
        if (!this.hasItemOption && isDataItemOption(dataItem)) {
          this.hasItemOption = true;
        }
        if (dataItem) {
          var itemName = dataItem.name;
          if (nameList[idx] == null && itemName != null) {
            nameList[idx] = convertOptionIdName(itemName, null);
          }
          var itemId = dataItem.id;
          if (idList[idx] == null && itemId != null) {
            idList[idx] = convertOptionIdName(itemId, null);
          }
        }
      }
    }
    if (this._shouldMakeIdFromName()) {
      for (var idx = start; idx < end; idx++) {
        makeIdFromName(this, idx);
      }
    }
    prepareInvertedIndex(this);
  };
  /**
   * PENDING: In fact currently this function is only used to short-circuit
   * the calling of `scale.unionExtentFromData` when data have been filtered by modules
   * like "dataZoom". `scale.unionExtentFromData` is used to calculate data extent for series on
   * an axis, but if a "axis related data filter module" is used, the extent of the axis have
   * been fixed and no need to calling `scale.unionExtentFromData` actually.
   * But if we add "custom data filter" in future, which is not "axis related", this method may
   * be still needed.
   *
   * Optimize for the scenario that data is filtered by a given extent.
   * Consider that if data amount is more than hundreds of thousand,
   * extent calculation will cost more than 10ms and the cache will
   * be erased because of the filtering.
   */
  SeriesData.prototype.getApproximateExtent = function (dim) {
    return this._approximateExtent[dim] || this._store.getDataExtent(this._getStoreDimIndex(dim));
  };
  /**
   * Calculate extent on a filtered data might be time consuming.
   * Approximate extent is only used for: calculate extent of filtered data outside.
   */
  SeriesData.prototype.setApproximateExtent = function (extent, dim) {
    dim = this.getDimension(dim);
    this._approximateExtent[dim] = extent.slice();
  };
  SeriesData.prototype.getCalculationInfo = function (key) {
    return this._calculationInfo[key];
  };
  SeriesData.prototype.setCalculationInfo = function (key, value) {
    isObject$1(key) ? extend(this._calculationInfo, key) : this._calculationInfo[key] = value;
  };
  /**
   * @return Never be null/undefined. `number` will be converted to string. Because:
   * In most cases, name is used in display, where returning a string is more convenient.
   * In other cases, name is used in query (see `indexOfName`), where we can keep the
   * rule that name `2` equals to name `'2'`.
   */
  SeriesData.prototype.getName = function (idx) {
    var rawIndex = this.getRawIndex(idx);
    var name = this._nameList[rawIndex];
    if (name == null && this._nameDimIdx != null) {
      name = getIdNameFromStore(this, this._nameDimIdx, rawIndex);
    }
    if (name == null) {
      name = '';
    }
    return name;
  };
  SeriesData.prototype._getCategory = function (dimIdx, idx) {
    var ordinal = this._store.get(dimIdx, idx);
    var ordinalMeta = this._store.getOrdinalMeta(dimIdx);
    if (ordinalMeta) {
      return ordinalMeta.categories[ordinal];
    }
    return ordinal;
  };
  /**
   * @return Never null/undefined. `number` will be converted to string. Because:
   * In all cases having encountered at present, id is used in making diff comparison, which
   * are usually based on hash map. We can keep the rule that the internal id are always string
   * (treat `2` is the same as `'2'`) to make the related logic simple.
   */
  SeriesData.prototype.getId = function (idx) {
    return getId(this, this.getRawIndex(idx));
  };
  SeriesData.prototype.count = function () {
    return this._store.count();
  };
  /**
   * Get value. Return NaN if idx is out of range.
   *
   * @notice Should better to use `data.getStore().get(dimIndex, dataIdx)` instead.
   */
  SeriesData.prototype.get = function (dim, idx) {
    var store = this._store;
    var dimInfo = this._dimInfos[dim];
    if (dimInfo) {
      return store.get(dimInfo.storeDimIndex, idx);
    }
  };
  /**
   * @notice Should better to use `data.getStore().getByRawIndex(dimIndex, dataIdx)` instead.
   */
  SeriesData.prototype.getByRawIndex = function (dim, rawIdx) {
    var store = this._store;
    var dimInfo = this._dimInfos[dim];
    if (dimInfo) {
      return store.getByRawIndex(dimInfo.storeDimIndex, rawIdx);
    }
  };
  SeriesData.prototype.getIndices = function () {
    return this._store.getIndices();
  };
  SeriesData.prototype.getDataExtent = function (dim) {
    return this._store.getDataExtent(this._getStoreDimIndex(dim));
  };
  SeriesData.prototype.getSum = function (dim) {
    return this._store.getSum(this._getStoreDimIndex(dim));
  };
  SeriesData.prototype.getMedian = function (dim) {
    return this._store.getMedian(this._getStoreDimIndex(dim));
  };
  SeriesData.prototype.getValues = function (dimensions, idx) {
    var _this = this;
    var store = this._store;
    return isArray$1(dimensions) ? store.getValues(map(dimensions, function (dim) {
      return _this._getStoreDimIndex(dim);
    }), idx) : store.getValues(dimensions);
  };
  /**
   * If value is NaN. Including '-'
   * Only check the coord dimensions.
   */
  SeriesData.prototype.hasValue = function (idx) {
    var dataDimIndicesOnCoord = this._dimSummary.dataDimIndicesOnCoord;
    for (var i = 0, len = dataDimIndicesOnCoord.length; i < len; i++) {
      // Ordinal type originally can be string or number.
      // But when an ordinal type is used on coord, it can
      // not be string but only number. So we can also use isNaN.
      if (isNaN(this._store.get(dataDimIndicesOnCoord[i], idx))) {
        return false;
      }
    }
    return true;
  };
  /**
   * Retrieve the index with given name
   */
  SeriesData.prototype.indexOfName = function (name) {
    for (var i = 0, len = this._store.count(); i < len; i++) {
      if (this.getName(i) === name) {
        return i;
      }
    }
    return -1;
  };
  SeriesData.prototype.getRawIndex = function (idx) {
    return this._store.getRawIndex(idx);
  };
  SeriesData.prototype.indexOfRawIndex = function (rawIndex) {
    return this._store.indexOfRawIndex(rawIndex);
  };
  /**
   * Only support the dimension which inverted index created.
   * Do not support other cases until required.
   * @param dim concrete dim
   * @param value ordinal index
   * @return rawIndex
   */
  SeriesData.prototype.rawIndexOf = function (dim, value) {
    var invertedIndices = dim && this._invertedIndicesMap[dim];
    {
      if (!invertedIndices) {
        throw new Error('Do not supported yet');
      }
    }
    var rawIndex = invertedIndices && invertedIndices[value];
    if (rawIndex == null || isNaN(rawIndex)) {
      return INDEX_NOT_FOUND;
    }
    return rawIndex;
  };
  /**
   * Retrieve the index of nearest value
   * @param dim
   * @param value
   * @param [maxDistance=Infinity]
   * @return If and only if multiple indices has
   *         the same value, they are put to the result.
   */
  SeriesData.prototype.indicesOfNearest = function (dim, value, maxDistance) {
    return this._store.indicesOfNearest(this._getStoreDimIndex(dim), value, maxDistance);
  };
  SeriesData.prototype.each = function (dims, cb, ctx) {

    if (isFunction(dims)) {
      ctx = cb;
      cb = dims;
      dims = [];
    }
    // ctxCompat just for compat echarts3
    var fCtx = ctx || this;
    var dimIndices = map(normalizeDimensions(dims), this._getStoreDimIndex, this);
    this._store.each(dimIndices, fCtx ? bind$1(cb, fCtx) : cb);
  };
  SeriesData.prototype.filterSelf = function (dims, cb, ctx) {

    if (isFunction(dims)) {
      ctx = cb;
      cb = dims;
      dims = [];
    }
    // ctxCompat just for compat echarts3
    var fCtx = ctx || this;
    var dimIndices = map(normalizeDimensions(dims), this._getStoreDimIndex, this);
    this._store = this._store.filter(dimIndices, fCtx ? bind$1(cb, fCtx) : cb);
    return this;
  };
  /**
   * Select data in range. (For optimization of filter)
   * (Manually inline code, support 5 million data filtering in data zoom.)
   */
  SeriesData.prototype.selectRange = function (range) {

    var _this = this;
    var innerRange = {};
    var dims = keys(range);
    each$f(dims, function (dim) {
      var dimIdx = _this._getStoreDimIndex(dim);
      innerRange[dimIdx] = range[dim];
    });
    this._store = this._store.selectRange(innerRange);
    return this;
  };
  /* eslint-enable max-len */
  SeriesData.prototype.mapArray = function (dims, cb, ctx) {

    if (isFunction(dims)) {
      ctx = cb;
      cb = dims;
      dims = [];
    }
    // ctxCompat just for compat echarts3
    ctx = ctx || this;
    var result = [];
    this.each(dims, function () {
      result.push(cb && cb.apply(this, arguments));
    }, ctx);
    return result;
  };
  SeriesData.prototype.map = function (dims, cb, ctx, ctxCompat) {

    // ctxCompat just for compat echarts3
    var fCtx = ctx || ctxCompat || this;
    var dimIndices = map(normalizeDimensions(dims), this._getStoreDimIndex, this);
    var list = cloneListForMapAndSample(this);
    list._store = this._store.map(dimIndices, fCtx ? bind$1(cb, fCtx) : cb);
    return list;
  };
  SeriesData.prototype.modify = function (dims, cb, ctx, ctxCompat) {
    var _this = this;
    // ctxCompat just for compat echarts3
    var fCtx = ctx || ctxCompat || this;
    {
      each$f(normalizeDimensions(dims), function (dim) {
        var dimInfo = _this.getDimensionInfo(dim);
        if (!dimInfo.isCalculationCoord) {
          console.error('Danger: only stack dimension can be modified');
        }
      });
    }
    var dimIndices = map(normalizeDimensions(dims), this._getStoreDimIndex, this);
    // If do shallow clone here, if there are too many stacked series,
    // it still cost lots of memory, because `_store.dimensions` are not shared.
    // We should consider there probably be shallow clone happen in each series
    // in consequent filter/map.
    this._store.modify(dimIndices, fCtx ? bind$1(cb, fCtx) : cb);
  };
  /**
   * Large data down sampling on given dimension
   * @param sampleIndex Sample index for name and id
   */
  SeriesData.prototype.downSample = function (dimension, rate, sampleValue, sampleIndex) {
    var list = cloneListForMapAndSample(this);
    list._store = this._store.downSample(this._getStoreDimIndex(dimension), rate, sampleValue, sampleIndex);
    return list;
  };
  /**
   * Large data down sampling using min-max
   * @param {string} valueDimension
   * @param {number} rate
   */
  SeriesData.prototype.minmaxDownSample = function (valueDimension, rate) {
    var list = cloneListForMapAndSample(this);
    list._store = this._store.minmaxDownSample(this._getStoreDimIndex(valueDimension), rate);
    return list;
  };
  /**
   * Large data down sampling using largest-triangle-three-buckets
   * @param {string} valueDimension
   * @param {number} targetCount
   */
  SeriesData.prototype.lttbDownSample = function (valueDimension, rate) {
    var list = cloneListForMapAndSample(this);
    list._store = this._store.lttbDownSample(this._getStoreDimIndex(valueDimension), rate);
    return list;
  };
  SeriesData.prototype.getRawDataItem = function (idx) {
    return this._store.getRawDataItem(idx);
  };
  /**
   * Get model of one data item.
   */
  // TODO: Type of data item
  SeriesData.prototype.getItemModel = function (idx) {
    var hostModel = this.hostModel;
    var dataItem = this.getRawDataItem(idx);
    return new Model$1(dataItem, hostModel, hostModel && hostModel.ecModel);
  };
  /**
   * Create a data differ
   */
  SeriesData.prototype.diff = function (otherList) {
    var thisList = this;
    return new DataDiffer$1(otherList ? otherList.getStore().getIndices() : [], this.getStore().getIndices(), function (idx) {
      return getId(otherList, idx);
    }, function (idx) {
      return getId(thisList, idx);
    });
  };
  /**
   * Get visual property.
   */
  SeriesData.prototype.getVisual = function (key) {
    var visual = this._visual;
    return visual && visual[key];
  };
  SeriesData.prototype.setVisual = function (kvObj, val) {
    this._visual = this._visual || {};
    if (isObject$1(kvObj)) {
      extend(this._visual, kvObj);
    } else {
      this._visual[kvObj] = val;
    }
  };
  /**
   * Get visual property of single data item
   */
  // eslint-disable-next-line
  SeriesData.prototype.getItemVisual = function (idx, key) {
    var itemVisual = this._itemVisuals[idx];
    var val = itemVisual && itemVisual[key];
    if (val == null) {
      // Use global visual property
      return this.getVisual(key);
    }
    return val;
  };
  /**
   * If exists visual property of single data item
   */
  SeriesData.prototype.hasItemVisual = function () {
    return this._itemVisuals.length > 0;
  };
  /**
   * Make sure itemVisual property is unique
   */
  // TODO: use key to save visual to reduce memory.
  SeriesData.prototype.ensureUniqueItemVisual = function (idx, key) {
    var itemVisuals = this._itemVisuals;
    var itemVisual = itemVisuals[idx];
    if (!itemVisual) {
      itemVisual = itemVisuals[idx] = {};
    }
    var val = itemVisual[key];
    if (val == null) {
      val = this.getVisual(key);
      // TODO Performance?
      if (isArray$1(val)) {
        val = val.slice();
      } else if (isObject$1(val)) {
        val = extend({}, val);
      }
      itemVisual[key] = val;
    }
    return val;
  };
  // eslint-disable-next-line
  SeriesData.prototype.setItemVisual = function (idx, key, value) {
    var itemVisual = this._itemVisuals[idx] || {};
    this._itemVisuals[idx] = itemVisual;
    if (isObject$1(key)) {
      extend(itemVisual, key);
    } else {
      itemVisual[key] = value;
    }
  };
  /**
   * Clear itemVisuals and list visual.
   */
  SeriesData.prototype.clearAllVisual = function () {
    this._visual = {};
    this._itemVisuals = [];
  };
  SeriesData.prototype.setLayout = function (key, val) {
    isObject$1(key) ? extend(this._layout, key) : this._layout[key] = val;
  };
  /**
   * Get layout property.
   */
  SeriesData.prototype.getLayout = function (key) {
    return this._layout[key];
  };
  /**
   * Get layout of single data item
   */
  SeriesData.prototype.getItemLayout = function (idx) {
    return this._itemLayouts[idx];
  };
  /**
   * Set layout of single data item
   */
  SeriesData.prototype.setItemLayout = function (idx, layout, merge) {
    this._itemLayouts[idx] = merge ? extend(this._itemLayouts[idx] || {}, layout) : layout;
  };
  /**
   * Clear all layout of single data item
   */
  SeriesData.prototype.clearItemLayouts = function () {
    this._itemLayouts.length = 0;
  };
  /**
   * Set graphic element relative to data. It can be set as null
   */
  SeriesData.prototype.setItemGraphicEl = function (idx, el) {
    var seriesIndex = this.hostModel && this.hostModel.seriesIndex;
    setCommonECData(seriesIndex, this.dataType, idx, el);
    this._graphicEls[idx] = el;
  };
  SeriesData.prototype.getItemGraphicEl = function (idx) {
    return this._graphicEls[idx];
  };
  SeriesData.prototype.eachItemGraphicEl = function (cb, context) {
    each$f(this._graphicEls, function (el, idx) {
      if (el) {
        cb && cb.call(context, el, idx);
      }
    });
  };
  /**
   * Shallow clone a new list except visual and layout properties, and graph elements.
   * New list only change the indices.
   */
  SeriesData.prototype.cloneShallow = function (list) {
    if (!list) {
      list = new SeriesData(this._schema ? this._schema : map(this.dimensions, this._getDimInfo, this), this.hostModel);
    }
    transferProperties(list, this);
    list._store = this._store;
    return list;
  };
  /**
   * Wrap some method to add more feature
   */
  SeriesData.prototype.wrapMethod = function (methodName, injectFunction) {
    var originalMethod = this[methodName];
    if (!isFunction(originalMethod)) {
      return;
    }
    this.__wrappedMethods = this.__wrappedMethods || [];
    this.__wrappedMethods.push(methodName);
    this[methodName] = function () {
      var res = originalMethod.apply(this, arguments);
      return injectFunction.apply(this, [res].concat(slice$1(arguments)));
    };
  };
  // ----------------------------------------------------------
  // A work around for internal method visiting private member.
  // ----------------------------------------------------------
  SeriesData.internalField = function () {
    prepareInvertedIndex = function (data) {
      var invertedIndicesMap = data._invertedIndicesMap;
      each$f(invertedIndicesMap, function (invertedIndices, dim) {
        var dimInfo = data._dimInfos[dim];
        // Currently, only dimensions that has ordinalMeta can create inverted indices.
        var ordinalMeta = dimInfo.ordinalMeta;
        var store = data._store;
        if (ordinalMeta) {
          invertedIndices = invertedIndicesMap[dim] = new CtorInt32Array(ordinalMeta.categories.length);
          // The default value of TypedArray is 0. To avoid miss
          // mapping to 0, we should set it as INDEX_NOT_FOUND.
          for (var i = 0; i < invertedIndices.length; i++) {
            invertedIndices[i] = INDEX_NOT_FOUND;
          }
          for (var i = 0; i < store.count(); i++) {
            // Only support the case that all values are distinct.
            invertedIndices[store.get(dimInfo.storeDimIndex, i)] = i;
          }
        }
      });
    };
    getIdNameFromStore = function (data, dimIdx, idx) {
      return convertOptionIdName(data._getCategory(dimIdx, idx), null);
    };
    /**
     * @see the comment of `List['getId']`.
     */
    getId = function (data, rawIndex) {
      var id = data._idList[rawIndex];
      if (id == null && data._idDimIdx != null) {
        id = getIdNameFromStore(data, data._idDimIdx, rawIndex);
      }
      if (id == null) {
        id = ID_PREFIX + rawIndex;
      }
      return id;
    };
    normalizeDimensions = function (dimensions) {
      if (!isArray$1(dimensions)) {
        dimensions = dimensions != null ? [dimensions] : [];
      }
      return dimensions;
    };
    /**
     * Data in excludeDimensions is copied, otherwise transferred.
     */
    cloneListForMapAndSample = function (original) {
      var list = new SeriesData(original._schema ? original._schema : map(original.dimensions, original._getDimInfo, original), original.hostModel);
      // FIXME If needs stackedOn, value may already been stacked
      transferProperties(list, original);
      return list;
    };
    transferProperties = function (target, source) {
      each$f(TRANSFERABLE_PROPERTIES.concat(source.__wrappedMethods || []), function (propName) {
        if (source.hasOwnProperty(propName)) {
          target[propName] = source[propName];
        }
      });
      target.__wrappedMethods = source.__wrappedMethods;
      each$f(CLONE_PROPERTIES, function (propName) {
        target[propName] = clone$4(source[propName]);
      });
      target._calculationInfo = extend({}, source._calculationInfo);
    };
    makeIdFromName = function (data, idx) {
      var nameList = data._nameList;
      var idList = data._idList;
      var nameDimIdx = data._nameDimIdx;
      var idDimIdx = data._idDimIdx;
      var name = nameList[idx];
      var id = idList[idx];
      if (name == null && nameDimIdx != null) {
        nameList[idx] = name = getIdNameFromStore(data, nameDimIdx, idx);
      }
      if (id == null && idDimIdx != null) {
        idList[idx] = id = getIdNameFromStore(data, idDimIdx, idx);
      }
      if (id == null && name != null) {
        var nameRepeatCount = data._nameRepeatCount;
        var nmCnt = nameRepeatCount[name] = (nameRepeatCount[name] || 0) + 1;
        id = name;
        if (nmCnt > 1) {
          id += '__ec__' + nmCnt;
        }
        idList[idx] = id;
      }
    };
  }();
  return SeriesData;
}();
var SeriesData$1 = SeriesData;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * This method builds the relationship between:
 * + "what the coord sys or series requires (see `coordDimensions`)",
 * + "what the user defines (in `encode` and `dimensions`, see `opt.dimensionsDefine` and `opt.encodeDefine`)"
 * + "what the data source provids (see `source`)".
 *
 * Some guess strategy will be adapted if user does not define something.
 * If no 'value' dimension specified, the first no-named dimension will be
 * named as 'value'.
 *
 * @return The results are always sorted by `storeDimIndex` asc.
 */
function prepareSeriesDataSchema(
// TODO: TYPE completeDimensions type
source, opt) {
  if (!isSourceInstance(source)) {
    source = createSourceFromSeriesDataOption(source);
  }
  opt = opt || {};
  var sysDims = opt.coordDimensions || [];
  var dimsDef = opt.dimensionsDefine || source.dimensionsDefine || [];
  var coordDimNameMap = createHashMap();
  var resultList = [];
  var dimCount = getDimCount(source, sysDims, dimsDef, opt.dimensionsCount);
  // Try to ignore unused dimensions if sharing a high dimension datastore
  // 30 is an experience value.
  var omitUnusedDimensions = opt.canOmitUnusedDimensions && shouldOmitUnusedDimensions(dimCount);
  var isUsingSourceDimensionsDef = dimsDef === source.dimensionsDefine;
  var dataDimNameMap = isUsingSourceDimensionsDef ? ensureSourceDimNameMap(source) : createDimNameMap(dimsDef);
  var encodeDef = opt.encodeDefine;
  if (!encodeDef && opt.encodeDefaulter) {
    encodeDef = opt.encodeDefaulter(source, dimCount);
  }
  var encodeDefMap = createHashMap(encodeDef);
  var indicesMap = new CtorInt32Array$1(dimCount);
  for (var i = 0; i < indicesMap.length; i++) {
    indicesMap[i] = -1;
  }
  function getResultItem(dimIdx) {
    var idx = indicesMap[dimIdx];
    if (idx < 0) {
      var dimDefItemRaw = dimsDef[dimIdx];
      var dimDefItem = isObject$3(dimDefItemRaw) ? dimDefItemRaw : {
        name: dimDefItemRaw
      };
      var resultItem = new SeriesDimensionDefine$1();
      var userDimName = dimDefItem.name;
      if (userDimName != null && dataDimNameMap.get(userDimName) != null) {
        // Only if `series.dimensions` is defined in option
        // displayName, will be set, and dimension will be displayed vertically in
        // tooltip by default.
        resultItem.name = resultItem.displayName = userDimName;
      }
      dimDefItem.type != null && (resultItem.type = dimDefItem.type);
      dimDefItem.displayName != null && (resultItem.displayName = dimDefItem.displayName);
      var newIdx = resultList.length;
      indicesMap[dimIdx] = newIdx;
      resultItem.storeDimIndex = dimIdx;
      resultList.push(resultItem);
      return resultItem;
    }
    return resultList[idx];
  }
  if (!omitUnusedDimensions) {
    for (var i = 0; i < dimCount; i++) {
      getResultItem(i);
    }
  }
  // Set `coordDim` and `coordDimIndex` by `encodeDefMap` and normalize `encodeDefMap`.
  encodeDefMap.each(function (dataDimsRaw, coordDim) {
    var dataDims = normalizeToArray(dataDimsRaw).slice();
    // Note: It is allowed that `dataDims.length` is `0`, e.g., options is
    // `{encode: {x: -1, y: 1}}`. Should not filter anything in
    // this case.
    if (dataDims.length === 1 && !isString(dataDims[0]) && dataDims[0] < 0) {
      encodeDefMap.set(coordDim, false);
      return;
    }
    var validDataDims = encodeDefMap.set(coordDim, []);
    each$f(dataDims, function (resultDimIdxOrName, idx) {
      // The input resultDimIdx can be dim name or index.
      var resultDimIdx = isString(resultDimIdxOrName) ? dataDimNameMap.get(resultDimIdxOrName) : resultDimIdxOrName;
      if (resultDimIdx != null && resultDimIdx < dimCount) {
        validDataDims[idx] = resultDimIdx;
        applyDim(getResultItem(resultDimIdx), coordDim, idx);
      }
    });
  });
  // Apply templates and default order from `sysDims`.
  var availDimIdx = 0;
  each$f(sysDims, function (sysDimItemRaw) {
    var coordDim;
    var sysDimItemDimsDef;
    var sysDimItemOtherDims;
    var sysDimItem;
    if (isString(sysDimItemRaw)) {
      coordDim = sysDimItemRaw;
      sysDimItem = {};
    } else {
      sysDimItem = sysDimItemRaw;
      coordDim = sysDimItem.name;
      var ordinalMeta = sysDimItem.ordinalMeta;
      sysDimItem.ordinalMeta = null;
      sysDimItem = extend({}, sysDimItem);
      sysDimItem.ordinalMeta = ordinalMeta;
      // `coordDimIndex` should not be set directly.
      sysDimItemDimsDef = sysDimItem.dimsDef;
      sysDimItemOtherDims = sysDimItem.otherDims;
      sysDimItem.name = sysDimItem.coordDim = sysDimItem.coordDimIndex = sysDimItem.dimsDef = sysDimItem.otherDims = null;
    }
    var dataDims = encodeDefMap.get(coordDim);
    // negative resultDimIdx means no need to mapping.
    if (dataDims === false) {
      return;
    }
    dataDims = normalizeToArray(dataDims);
    // dimensions provides default dim sequences.
    if (!dataDims.length) {
      for (var i = 0; i < (sysDimItemDimsDef && sysDimItemDimsDef.length || 1); i++) {
        while (availDimIdx < dimCount && getResultItem(availDimIdx).coordDim != null) {
          availDimIdx++;
        }
        availDimIdx < dimCount && dataDims.push(availDimIdx++);
      }
    }
    // Apply templates.
    each$f(dataDims, function (resultDimIdx, coordDimIndex) {
      var resultItem = getResultItem(resultDimIdx);
      // Coordinate system has a higher priority on dim type than source.
      if (isUsingSourceDimensionsDef && sysDimItem.type != null) {
        resultItem.type = sysDimItem.type;
      }
      applyDim(defaults(resultItem, sysDimItem), coordDim, coordDimIndex);
      if (resultItem.name == null && sysDimItemDimsDef) {
        var sysDimItemDimsDefItem = sysDimItemDimsDef[coordDimIndex];
        !isObject$3(sysDimItemDimsDefItem) && (sysDimItemDimsDefItem = {
          name: sysDimItemDimsDefItem
        });
        resultItem.name = resultItem.displayName = sysDimItemDimsDefItem.name;
        resultItem.defaultTooltip = sysDimItemDimsDefItem.defaultTooltip;
      }
      // FIXME refactor, currently only used in case: {otherDims: {tooltip: false}}
      sysDimItemOtherDims && defaults(resultItem.otherDims, sysDimItemOtherDims);
    });
  });
  function applyDim(resultItem, coordDim, coordDimIndex) {
    if (VISUAL_DIMENSIONS.get(coordDim) != null) {
      resultItem.otherDims[coordDim] = coordDimIndex;
    } else {
      resultItem.coordDim = coordDim;
      resultItem.coordDimIndex = coordDimIndex;
      coordDimNameMap.set(coordDim, true);
    }
  }
  // Make sure the first extra dim is 'value'.
  var generateCoord = opt.generateCoord;
  var generateCoordCount = opt.generateCoordCount;
  var fromZero = generateCoordCount != null;
  generateCoordCount = generateCoord ? generateCoordCount || 1 : 0;
  var extra = generateCoord || 'value';
  function ifNoNameFillWithCoordName(resultItem) {
    if (resultItem.name == null) {
      // Duplication will be removed in the next step.
      resultItem.name = resultItem.coordDim;
    }
  }
  // Set dim `name` and other `coordDim` and other props.
  if (!omitUnusedDimensions) {
    for (var resultDimIdx = 0; resultDimIdx < dimCount; resultDimIdx++) {
      var resultItem = getResultItem(resultDimIdx);
      var coordDim = resultItem.coordDim;
      if (coordDim == null) {
        // TODO no need to generate coordDim for isExtraCoord?
        resultItem.coordDim = genCoordDimName(extra, coordDimNameMap, fromZero);
        resultItem.coordDimIndex = 0;
        // Series specified generateCoord is using out.
        if (!generateCoord || generateCoordCount <= 0) {
          resultItem.isExtraCoord = true;
        }
        generateCoordCount--;
      }
      ifNoNameFillWithCoordName(resultItem);
      if (resultItem.type == null && (guessOrdinal(source, resultDimIdx) === BE_ORDINAL.Must
      // Consider the case:
      // {
      //    dataset: {source: [
      //        ['2001', 123],
      //        ['2002', 456],
      //        ...
      //        ['The others', 987],
      //    ]},
      //    series: {type: 'pie'}
      // }
      // The first column should better be treated as a "ordinal" although it
      // might not be detected as an "ordinal" by `guessOrdinal`.
      || resultItem.isExtraCoord && (resultItem.otherDims.itemName != null || resultItem.otherDims.seriesName != null))) {
        resultItem.type = 'ordinal';
      }
    }
  } else {
    each$f(resultList, function (resultItem) {
      // PENDING: guessOrdinal or let user specify type: 'ordinal' manually?
      ifNoNameFillWithCoordName(resultItem);
    });
    // Sort dimensions: there are some rule that use the last dim as label,
    // and for some latter travel process easier.
    resultList.sort(function (item0, item1) {
      return item0.storeDimIndex - item1.storeDimIndex;
    });
  }
  removeDuplication(resultList);
  return new SeriesDataSchema({
    source: source,
    dimensions: resultList,
    fullDimensionCount: dimCount,
    dimensionOmitted: omitUnusedDimensions
  });
}
function removeDuplication(result) {
  var duplicationMap = createHashMap();
  for (var i = 0; i < result.length; i++) {
    var dim = result[i];
    var dimOriginalName = dim.name;
    var count = duplicationMap.get(dimOriginalName) || 0;
    if (count > 0) {
      // Starts from 0.
      dim.name = dimOriginalName + (count - 1);
    }
    count++;
    duplicationMap.set(dimOriginalName, count);
  }
}
// ??? TODO
// Originally detect dimCount by data[0]. Should we
// optimize it to only by sysDims and dimensions and encode.
// So only necessary dims will be initialized.
// But
// (1) custom series should be considered. where other dims
// may be visited.
// (2) sometimes user need to calculate bubble size or use visualMap
// on other dimensions besides coordSys needed.
// So, dims that is not used by system, should be shared in data store?
function getDimCount(source, sysDims, dimsDef, optDimCount) {
  // Note that the result dimCount should not small than columns count
  // of data, otherwise `dataDimNameMap` checking will be incorrect.
  var dimCount = Math.max(source.dimensionsDetectedCount || 1, sysDims.length, dimsDef.length, optDimCount || 0);
  each$f(sysDims, function (sysDimItem) {
    var sysDimItemDimsDef;
    if (isObject$3(sysDimItem) && (sysDimItemDimsDef = sysDimItem.dimsDef)) {
      dimCount = Math.max(dimCount, sysDimItemDimsDef.length);
    }
  });
  return dimCount;
}
function genCoordDimName(name, map, fromZero) {
  if (fromZero || map.hasKey(name)) {
    var i = 0;
    while (map.hasKey(name + i)) {
      i++;
    }
    name += i;
  }
  map.set(name, true);
  return name;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * @class
 * For example:
 * {
 *     coordSysName: 'cartesian2d',
 *     coordSysDims: ['x', 'y', ...],
 *     axisMap: HashMap({
 *         x: xAxisModel,
 *         y: yAxisModel
 *     }),
 *     categoryAxisMap: HashMap({
 *         x: xAxisModel,
 *         y: undefined
 *     }),
 *     // The index of the first category axis in `coordSysDims`.
 *     // `null/undefined` means no category axis exists.
 *     firstCategoryDimIndex: 1,
 *     // To replace user specified encode.
 * }
 */
var CoordSysInfo = /** @class */function () {
  function CoordSysInfo(coordSysName) {
    this.coordSysDims = [];
    this.axisMap = createHashMap();
    this.categoryAxisMap = createHashMap();
    this.coordSysName = coordSysName;
  }
  return CoordSysInfo;
}();
function getCoordSysInfoBySeries(seriesModel) {
  var coordSysName = seriesModel.get('coordinateSystem');
  var result = new CoordSysInfo(coordSysName);
  var fetch = fetchers[coordSysName];
  if (fetch) {
    fetch(seriesModel, result, result.axisMap, result.categoryAxisMap);
    return result;
  }
}
var fetchers = {
  cartesian2d: function (seriesModel, result, axisMap, categoryAxisMap) {
    var xAxisModel = seriesModel.getReferringComponents('xAxis', SINGLE_REFERRING).models[0];
    var yAxisModel = seriesModel.getReferringComponents('yAxis', SINGLE_REFERRING).models[0];
    {
      if (!xAxisModel) {
        throw new Error('xAxis "' + retrieve(seriesModel.get('xAxisIndex'), seriesModel.get('xAxisId'), 0) + '" not found');
      }
      if (!yAxisModel) {
        throw new Error('yAxis "' + retrieve(seriesModel.get('xAxisIndex'), seriesModel.get('yAxisId'), 0) + '" not found');
      }
    }
    result.coordSysDims = ['x', 'y'];
    axisMap.set('x', xAxisModel);
    axisMap.set('y', yAxisModel);
    if (isCategory(xAxisModel)) {
      categoryAxisMap.set('x', xAxisModel);
      result.firstCategoryDimIndex = 0;
    }
    if (isCategory(yAxisModel)) {
      categoryAxisMap.set('y', yAxisModel);
      result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);
    }
  },
  singleAxis: function (seriesModel, result, axisMap, categoryAxisMap) {
    var singleAxisModel = seriesModel.getReferringComponents('singleAxis', SINGLE_REFERRING).models[0];
    {
      if (!singleAxisModel) {
        throw new Error('singleAxis should be specified.');
      }
    }
    result.coordSysDims = ['single'];
    axisMap.set('single', singleAxisModel);
    if (isCategory(singleAxisModel)) {
      categoryAxisMap.set('single', singleAxisModel);
      result.firstCategoryDimIndex = 0;
    }
  },
  polar: function (seriesModel, result, axisMap, categoryAxisMap) {
    var polarModel = seriesModel.getReferringComponents('polar', SINGLE_REFERRING).models[0];
    var radiusAxisModel = polarModel.findAxisModel('radiusAxis');
    var angleAxisModel = polarModel.findAxisModel('angleAxis');
    {
      if (!angleAxisModel) {
        throw new Error('angleAxis option not found');
      }
      if (!radiusAxisModel) {
        throw new Error('radiusAxis option not found');
      }
    }
    result.coordSysDims = ['radius', 'angle'];
    axisMap.set('radius', radiusAxisModel);
    axisMap.set('angle', angleAxisModel);
    if (isCategory(radiusAxisModel)) {
      categoryAxisMap.set('radius', radiusAxisModel);
      result.firstCategoryDimIndex = 0;
    }
    if (isCategory(angleAxisModel)) {
      categoryAxisMap.set('angle', angleAxisModel);
      result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);
    }
  },
  geo: function (seriesModel, result, axisMap, categoryAxisMap) {
    result.coordSysDims = ['lng', 'lat'];
  },
  parallel: function (seriesModel, result, axisMap, categoryAxisMap) {
    var ecModel = seriesModel.ecModel;
    var parallelModel = ecModel.getComponent('parallel', seriesModel.get('parallelIndex'));
    var coordSysDims = result.coordSysDims = parallelModel.dimensions.slice();
    each$f(parallelModel.parallelAxisIndex, function (axisIndex, index) {
      var axisModel = ecModel.getComponent('parallelAxis', axisIndex);
      var axisDim = coordSysDims[index];
      axisMap.set(axisDim, axisModel);
      if (isCategory(axisModel)) {
        categoryAxisMap.set(axisDim, axisModel);
        if (result.firstCategoryDimIndex == null) {
          result.firstCategoryDimIndex = index;
        }
      }
    });
  }
};
function isCategory(axisModel) {
  return axisModel.get('type') === 'category';
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Note that it is too complicated to support 3d stack by value
 * (have to create two-dimension inverted index), so in 3d case
 * we just support that stacked by index.
 *
 * @param seriesModel
 * @param dimensionsInput The same as the input of <module:echarts/data/SeriesData>.
 *        The input will be modified.
 * @param opt
 * @param opt.stackedCoordDimension Specify a coord dimension if needed.
 * @param opt.byIndex=false
 * @return calculationInfo
 * {
 *     stackedDimension: string
 *     stackedByDimension: string
 *     isStackedByIndex: boolean
 *     stackedOverDimension: string
 *     stackResultDimension: string
 * }
 */
function enableDataStack(seriesModel, dimensionsInput, opt) {
  opt = opt || {};
  var byIndex = opt.byIndex;
  var stackedCoordDimension = opt.stackedCoordDimension;
  var dimensionDefineList;
  var schema;
  var store;
  if (isLegacyDimensionsInput(dimensionsInput)) {
    dimensionDefineList = dimensionsInput;
  } else {
    schema = dimensionsInput.schema;
    dimensionDefineList = schema.dimensions;
    store = dimensionsInput.store;
  }
  // Compatibal: when `stack` is set as '', do not stack.
  var mayStack = !!(seriesModel && seriesModel.get('stack'));
  var stackedByDimInfo;
  var stackedDimInfo;
  var stackResultDimension;
  var stackedOverDimension;
  each$f(dimensionDefineList, function (dimensionInfo, index) {
    if (isString(dimensionInfo)) {
      dimensionDefineList[index] = dimensionInfo = {
        name: dimensionInfo
      };
    }
    if (mayStack && !dimensionInfo.isExtraCoord) {
      // Find the first ordinal dimension as the stackedByDimInfo.
      if (!byIndex && !stackedByDimInfo && dimensionInfo.ordinalMeta) {
        stackedByDimInfo = dimensionInfo;
      }
      // Find the first stackable dimension as the stackedDimInfo.
      if (!stackedDimInfo && dimensionInfo.type !== 'ordinal' && dimensionInfo.type !== 'time' && (!stackedCoordDimension || stackedCoordDimension === dimensionInfo.coordDim)) {
        stackedDimInfo = dimensionInfo;
      }
    }
  });
  if (stackedDimInfo && !byIndex && !stackedByDimInfo) {
    // Compatible with previous design, value axis (time axis) only stack by index.
    // It may make sense if the user provides elaborately constructed data.
    byIndex = true;
  }
  // Add stack dimension, they can be both calculated by coordinate system in `unionExtent`.
  // That put stack logic in List is for using conveniently in echarts extensions, but it
  // might not be a good way.
  if (stackedDimInfo) {
    // Use a weird name that not duplicated with other names.
    // Also need to use seriesModel.id as postfix because different
    // series may share same data store. The stack dimension needs to be distinguished.
    stackResultDimension = '__\0ecstackresult_' + seriesModel.id;
    stackedOverDimension = '__\0ecstackedover_' + seriesModel.id;
    // Create inverted index to fast query index by value.
    if (stackedByDimInfo) {
      stackedByDimInfo.createInvertedIndices = true;
    }
    var stackedDimCoordDim_1 = stackedDimInfo.coordDim;
    var stackedDimType = stackedDimInfo.type;
    var stackedDimCoordIndex_1 = 0;
    each$f(dimensionDefineList, function (dimensionInfo) {
      if (dimensionInfo.coordDim === stackedDimCoordDim_1) {
        stackedDimCoordIndex_1++;
      }
    });
    var stackedOverDimensionDefine = {
      name: stackResultDimension,
      coordDim: stackedDimCoordDim_1,
      coordDimIndex: stackedDimCoordIndex_1,
      type: stackedDimType,
      isExtraCoord: true,
      isCalculationCoord: true,
      storeDimIndex: dimensionDefineList.length
    };
    var stackResultDimensionDefine = {
      name: stackedOverDimension,
      // This dimension contains stack base (generally, 0), so do not set it as
      // `stackedDimCoordDim` to avoid extent calculation, consider log scale.
      coordDim: stackedOverDimension,
      coordDimIndex: stackedDimCoordIndex_1 + 1,
      type: stackedDimType,
      isExtraCoord: true,
      isCalculationCoord: true,
      storeDimIndex: dimensionDefineList.length + 1
    };
    if (schema) {
      if (store) {
        stackedOverDimensionDefine.storeDimIndex = store.ensureCalculationDimension(stackedOverDimension, stackedDimType);
        stackResultDimensionDefine.storeDimIndex = store.ensureCalculationDimension(stackResultDimension, stackedDimType);
      }
      schema.appendCalculationDimension(stackedOverDimensionDefine);
      schema.appendCalculationDimension(stackResultDimensionDefine);
    } else {
      dimensionDefineList.push(stackedOverDimensionDefine);
      dimensionDefineList.push(stackResultDimensionDefine);
    }
  }
  return {
    stackedDimension: stackedDimInfo && stackedDimInfo.name,
    stackedByDimension: stackedByDimInfo && stackedByDimInfo.name,
    isStackedByIndex: byIndex,
    stackedOverDimension: stackedOverDimension,
    stackResultDimension: stackResultDimension
  };
}
function isLegacyDimensionsInput(dimensionsInput) {
  return !isSeriesDataSchema(dimensionsInput.schema);
}
function isDimensionStacked(data, stackedDim) {
  // Each single series only maps to one pair of axis. So we do not need to
  // check stackByDim, whatever stacked by a dimension or stacked by index.
  return !!stackedDim && stackedDim === data.getCalculationInfo('stackedDimension');
}
function getStackedDimension(data, targetDim) {
  return isDimensionStacked(data, targetDim) ? data.getCalculationInfo('stackResultDimension') : targetDim;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function getCoordSysDimDefs(seriesModel, coordSysInfo) {
  var coordSysName = seriesModel.get('coordinateSystem');
  var registeredCoordSys = CoordinateSystem.get(coordSysName);
  var coordSysDimDefs;
  if (coordSysInfo && coordSysInfo.coordSysDims) {
    coordSysDimDefs = map$1(coordSysInfo.coordSysDims, function (dim) {
      var dimInfo = {
        name: dim
      };
      var axisModel = coordSysInfo.axisMap.get(dim);
      if (axisModel) {
        var axisType = axisModel.get('type');
        dimInfo.type = getDimensionTypeByAxis(axisType);
      }
      return dimInfo;
    });
  }
  if (!coordSysDimDefs) {
    // Get dimensions from registered coordinate system
    coordSysDimDefs = registeredCoordSys && (registeredCoordSys.getDimensionsInfo ? registeredCoordSys.getDimensionsInfo() : registeredCoordSys.dimensions.slice()) || ['x', 'y'];
  }
  return coordSysDimDefs;
}
function injectOrdinalMeta(dimInfoList, createInvertedIndices, coordSysInfo) {
  var firstCategoryDimIndex;
  var hasNameEncode;
  coordSysInfo && each$f(dimInfoList, function (dimInfo, dimIndex) {
    var coordDim = dimInfo.coordDim;
    var categoryAxisModel = coordSysInfo.categoryAxisMap.get(coordDim);
    if (categoryAxisModel) {
      if (firstCategoryDimIndex == null) {
        firstCategoryDimIndex = dimIndex;
      }
      dimInfo.ordinalMeta = categoryAxisModel.getOrdinalMeta();
      if (createInvertedIndices) {
        dimInfo.createInvertedIndices = true;
      }
    }
    if (dimInfo.otherDims.itemName != null) {
      hasNameEncode = true;
    }
  });
  if (!hasNameEncode && firstCategoryDimIndex != null) {
    dimInfoList[firstCategoryDimIndex].otherDims.itemName = 0;
  }
  return firstCategoryDimIndex;
}
/**
 * Caution: there are side effects to `sourceManager` in this method.
 * Should better only be called in `Series['getInitialData']`.
 */
function createSeriesData(sourceRaw, seriesModel, opt) {
  opt = opt || {};
  var sourceManager = seriesModel.getSourceManager();
  var source;
  var isOriginalSource = false;
  if (sourceRaw) {
    isOriginalSource = true;
    source = createSourceFromSeriesDataOption(sourceRaw);
  } else {
    source = sourceManager.getSource();
    // Is series.data. not dataset.
    isOriginalSource = source.sourceFormat === SOURCE_FORMAT_ORIGINAL;
  }
  var coordSysInfo = getCoordSysInfoBySeries(seriesModel);
  var coordSysDimDefs = getCoordSysDimDefs(seriesModel, coordSysInfo);
  var useEncodeDefaulter = opt.useEncodeDefaulter;
  var encodeDefaulter = isFunction(useEncodeDefaulter) ? useEncodeDefaulter : useEncodeDefaulter ? curry$1(makeSeriesEncodeForAxisCoordSys, coordSysDimDefs, seriesModel) : null;
  var createDimensionOptions = {
    coordDimensions: coordSysDimDefs,
    generateCoord: opt.generateCoord,
    encodeDefine: seriesModel.getEncode(),
    encodeDefaulter: encodeDefaulter,
    canOmitUnusedDimensions: !isOriginalSource
  };
  var schema = prepareSeriesDataSchema(source, createDimensionOptions);
  var firstCategoryDimIndex = injectOrdinalMeta(schema.dimensions, opt.createInvertedIndices, coordSysInfo);
  var store = !isOriginalSource ? sourceManager.getSharedDataStore(schema) : null;
  var stackCalculationInfo = enableDataStack(seriesModel, {
    schema: schema,
    store: store
  });
  var data = new SeriesData$1(schema, seriesModel);
  data.setCalculationInfo(stackCalculationInfo);
  var dimValueGetter = firstCategoryDimIndex != null && isNeedCompleteOrdinalData(source) ? function (itemOpt, dimName, dataIndex, dimIndex) {
    // Use dataIndex as ordinal value in categoryAxis
    return dimIndex === firstCategoryDimIndex ? dataIndex : this.defaultDimValueGetter(itemOpt, dimName, dataIndex, dimIndex);
  } : null;
  data.hasItemOption = false;
  data.initData(
  // Try to reuse the data store in sourceManager if using dataset.
  isOriginalSource ? source : store, null, dimValueGetter);
  return data;
}
function isNeedCompleteOrdinalData(source) {
  if (source.sourceFormat === SOURCE_FORMAT_ORIGINAL) {
    var sampleItem = firstDataNotNull(source.data || []);
    return !isArray$1(getDataItemValue(sampleItem));
  }
}
function firstDataNotNull(arr) {
  var i = 0;
  while (i < arr.length && arr[i] == null) {
    i++;
  }
  return arr[i];
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Scale = /** @class */function () {
  function Scale(setting) {
    this._setting = setting || {};
    this._extent = [Infinity, -Infinity];
  }
  Scale.prototype.getSetting = function (name) {
    return this._setting[name];
  };
  /**
   * Set extent from data
   */
  Scale.prototype.unionExtent = function (other) {
    var extent = this._extent;
    other[0] < extent[0] && (extent[0] = other[0]);
    other[1] > extent[1] && (extent[1] = other[1]);
    // not setExtent because in log axis it may transformed to power
    // this.setExtent(extent[0], extent[1]);
  };
  /**
   * Set extent from data
   */
  Scale.prototype.unionExtentFromData = function (data, dim) {
    this.unionExtent(data.getApproximateExtent(dim));
  };
  /**
   * Get extent
   *
   * Extent is always in increase order.
   */
  Scale.prototype.getExtent = function () {
    return this._extent.slice();
  };
  /**
   * Set extent
   */
  Scale.prototype.setExtent = function (start, end) {
    var thisExtent = this._extent;
    if (!isNaN(start)) {
      thisExtent[0] = start;
    }
    if (!isNaN(end)) {
      thisExtent[1] = end;
    }
  };
  /**
   * If value is in extent range
   */
  Scale.prototype.isInExtentRange = function (value) {
    return this._extent[0] <= value && this._extent[1] >= value;
  };
  /**
   * When axis extent depends on data and no data exists,
   * axis ticks should not be drawn, which is named 'blank'.
   */
  Scale.prototype.isBlank = function () {
    return this._isBlank;
  };
  /**
   * When axis extent depends on data and no data exists,
   * axis ticks should not be drawn, which is named 'blank'.
   */
  Scale.prototype.setBlank = function (isBlank) {
    this._isBlank = isBlank;
  };
  return Scale;
}();
enableClassManagement(Scale);
var Scale$1 = Scale;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var uidBase = 0;
var OrdinalMeta = /** @class */function () {
  function OrdinalMeta(opt) {
    this.categories = opt.categories || [];
    this._needCollect = opt.needCollect;
    this._deduplication = opt.deduplication;
    this.uid = ++uidBase;
  }
  OrdinalMeta.createByAxisModel = function (axisModel) {
    var option = axisModel.option;
    var data = option.data;
    var categories = data && map$1(data, getName);
    return new OrdinalMeta({
      categories: categories,
      needCollect: !categories,
      // deduplication is default in axis.
      deduplication: option.dedplication !== false
    });
  };
  OrdinalMeta.prototype.getOrdinal = function (category) {
    // @ts-ignore
    return this._getOrCreateMap().get(category);
  };
  /**
   * @return The ordinal. If not found, return NaN.
   */
  OrdinalMeta.prototype.parseAndCollect = function (category) {
    var index;
    var needCollect = this._needCollect;
    // The value of category dim can be the index of the given category set.
    // This feature is only supported when !needCollect, because we should
    // consider a common case: a value is 2017, which is a number but is
    // expected to be tread as a category. This case usually happen in dataset,
    // where it happent to be no need of the index feature.
    if (!isString(category) && !needCollect) {
      return category;
    }
    // Optimize for the scenario:
    // category is ['2012-01-01', '2012-01-02', ...], where the input
    // data has been ensured not duplicate and is large data.
    // Notice, if a dataset dimension provide categroies, usually echarts
    // should remove duplication except user tell echarts dont do that
    // (set axis.deduplication = false), because echarts do not know whether
    // the values in the category dimension has duplication (consider the
    // parallel-aqi example)
    if (needCollect && !this._deduplication) {
      index = this.categories.length;
      this.categories[index] = category;
      return index;
    }
    var map = this._getOrCreateMap();
    // @ts-ignore
    index = map.get(category);
    if (index == null) {
      if (needCollect) {
        index = this.categories.length;
        this.categories[index] = category;
        // @ts-ignore
        map.set(category, index);
      } else {
        index = NaN;
      }
    }
    return index;
  };
  // Consider big data, do not create map until needed.
  OrdinalMeta.prototype._getOrCreateMap = function () {
    return this._map || (this._map = createHashMap(this.categories));
  };
  return OrdinalMeta;
}();
function getName(obj) {
  if (isObject$3(obj) && obj.value != null) {
    return obj.value;
  } else {
    return obj + '';
  }
}
var OrdinalMeta$1 = OrdinalMeta;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function isValueNice(val) {
  var exp10 = Math.pow(10, quantityExponent(Math.abs(val)));
  var f = Math.abs(val / exp10);
  return f === 0 || f === 1 || f === 2 || f === 3 || f === 5;
}
function isIntervalOrLogScale(scale) {
  return scale.type === 'interval' || scale.type === 'log';
}
/**
 * @param extent Both extent[0] and extent[1] should be valid number.
 *               Should be extent[0] < extent[1].
 * @param splitNumber splitNumber should be >= 1.
 */
function intervalScaleNiceTicks(extent, splitNumber, minInterval, maxInterval) {
  var result = {};
  var span = extent[1] - extent[0];
  var interval = result.interval = nice(span / splitNumber, true);
  if (minInterval != null && interval < minInterval) {
    interval = result.interval = minInterval;
  }
  if (maxInterval != null && interval > maxInterval) {
    interval = result.interval = maxInterval;
  }
  // Tow more digital for tick.
  var precision = result.intervalPrecision = getIntervalPrecision(interval);
  // Niced extent inside original extent
  var niceTickExtent = result.niceTickExtent = [round$4(Math.ceil(extent[0] / interval) * interval, precision), round$4(Math.floor(extent[1] / interval) * interval, precision)];
  fixExtent(niceTickExtent, extent);
  return result;
}
function increaseInterval(interval) {
  var exp10 = Math.pow(10, quantityExponent(interval));
  // Increase interval
  var f = interval / exp10;
  if (!f) {
    f = 1;
  } else if (f === 2) {
    f = 3;
  } else if (f === 3) {
    f = 5;
  } else {
    // f is 1 or 5
    f *= 2;
  }
  return round$4(f * exp10);
}
/**
 * @return interval precision
 */
function getIntervalPrecision(interval) {
  // Tow more digital for tick.
  return getPrecision(interval) + 2;
}
function clamp$3(niceTickExtent, idx, extent) {
  niceTickExtent[idx] = Math.max(Math.min(niceTickExtent[idx], extent[1]), extent[0]);
}
// In some cases (e.g., splitNumber is 1), niceTickExtent may be out of extent.
function fixExtent(niceTickExtent, extent) {
  !isFinite(niceTickExtent[0]) && (niceTickExtent[0] = extent[0]);
  !isFinite(niceTickExtent[1]) && (niceTickExtent[1] = extent[1]);
  clamp$3(niceTickExtent, 0, extent);
  clamp$3(niceTickExtent, 1, extent);
  if (niceTickExtent[0] > niceTickExtent[1]) {
    niceTickExtent[0] = niceTickExtent[1];
  }
}
function contain$1(val, extent) {
  return val >= extent[0] && val <= extent[1];
}
function normalize$5(val, extent) {
  if (extent[1] === extent[0]) {
    return 0.5;
  }
  return (val - extent[0]) / (extent[1] - extent[0]);
}
function scale(val, extent) {
  return val * (extent[1] - extent[0]) + extent[0];
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var OrdinalScale = /** @class */function (_super) {
  __extends(OrdinalScale, _super);
  function OrdinalScale(setting) {
    var _this = _super.call(this, setting) || this;
    _this.type = 'ordinal';
    var ordinalMeta = _this.getSetting('ordinalMeta');
    // Caution: Should not use instanceof, consider ec-extensions using
    // import approach to get OrdinalMeta class.
    if (!ordinalMeta) {
      ordinalMeta = new OrdinalMeta$1({});
    }
    if (isArray$1(ordinalMeta)) {
      ordinalMeta = new OrdinalMeta$1({
        categories: map$1(ordinalMeta, function (item) {
          return isObject$3(item) ? item.value : item;
        })
      });
    }
    _this._ordinalMeta = ordinalMeta;
    _this._extent = _this.getSetting('extent') || [0, ordinalMeta.categories.length - 1];
    return _this;
  }
  OrdinalScale.prototype.parse = function (val) {
    // Caution: Math.round(null) will return `0` rather than `NaN`
    if (val == null) {
      return NaN;
    }
    return isString(val) ? this._ordinalMeta.getOrdinal(val)
    // val might be float.
    : Math.round(val);
  };
  OrdinalScale.prototype.contain = function (rank) {
    rank = this.parse(rank);
    return contain$1(rank, this._extent) && this._ordinalMeta.categories[rank] != null;
  };
  /**
   * Normalize given rank or name to linear [0, 1]
   * @param val raw ordinal number.
   * @return normalized value in [0, 1].
   */
  OrdinalScale.prototype.normalize = function (val) {
    val = this._getTickNumber(this.parse(val));
    return normalize$5(val, this._extent);
  };
  /**
   * @param val normalized value in [0, 1].
   * @return raw ordinal number.
   */
  OrdinalScale.prototype.scale = function (val) {
    val = Math.round(scale(val, this._extent));
    return this.getRawOrdinalNumber(val);
  };
  OrdinalScale.prototype.getTicks = function () {
    var ticks = [];
    var extent = this._extent;
    var rank = extent[0];
    while (rank <= extent[1]) {
      ticks.push({
        value: rank
      });
      rank++;
    }
    return ticks;
  };
  OrdinalScale.prototype.getMinorTicks = function (splitNumber) {
    // Not support.
    return;
  };
  /**
   * @see `Ordinal['_ordinalNumbersByTick']`
   */
  OrdinalScale.prototype.setSortInfo = function (info) {
    if (info == null) {
      this._ordinalNumbersByTick = this._ticksByOrdinalNumber = null;
      return;
    }
    var infoOrdinalNumbers = info.ordinalNumbers;
    var ordinalsByTick = this._ordinalNumbersByTick = [];
    var ticksByOrdinal = this._ticksByOrdinalNumber = [];
    // Unnecessary support negative tick in `realtimeSort`.
    var tickNum = 0;
    var allCategoryLen = this._ordinalMeta.categories.length;
    for (var len = Math.min(allCategoryLen, infoOrdinalNumbers.length); tickNum < len; ++tickNum) {
      var ordinalNumber = infoOrdinalNumbers[tickNum];
      ordinalsByTick[tickNum] = ordinalNumber;
      ticksByOrdinal[ordinalNumber] = tickNum;
    }
    // Handle that `series.data` only covers part of the `axis.category.data`.
    var unusedOrdinal = 0;
    for (; tickNum < allCategoryLen; ++tickNum) {
      while (ticksByOrdinal[unusedOrdinal] != null) {
        unusedOrdinal++;
      }
      ordinalsByTick.push(unusedOrdinal);
      ticksByOrdinal[unusedOrdinal] = tickNum;
    }
  };
  OrdinalScale.prototype._getTickNumber = function (ordinal) {
    var ticksByOrdinalNumber = this._ticksByOrdinalNumber;
    // also support ordinal out of range of `ordinalMeta.categories.length`,
    // where ordinal numbers are used as tick value directly.
    return ticksByOrdinalNumber && ordinal >= 0 && ordinal < ticksByOrdinalNumber.length ? ticksByOrdinalNumber[ordinal] : ordinal;
  };
  /**
   * @usage
   * ```js
   * const ordinalNumber = ordinalScale.getRawOrdinalNumber(tickVal);
   *
   * // case0
   * const rawOrdinalValue = axisModel.getCategories()[ordinalNumber];
   * // case1
   * const rawOrdinalValue = this._ordinalMeta.categories[ordinalNumber];
   * // case2
   * const coord = axis.dataToCoord(ordinalNumber);
   * ```
   *
   * @param {OrdinalNumber} tickNumber index of display
   */
  OrdinalScale.prototype.getRawOrdinalNumber = function (tickNumber) {
    var ordinalNumbersByTick = this._ordinalNumbersByTick;
    // tickNumber may be out of range, e.g., when axis max is larger than `ordinalMeta.categories.length`.,
    // where ordinal numbers are used as tick value directly.
    return ordinalNumbersByTick && tickNumber >= 0 && tickNumber < ordinalNumbersByTick.length ? ordinalNumbersByTick[tickNumber] : tickNumber;
  };
  /**
   * Get item on tick
   */
  OrdinalScale.prototype.getLabel = function (tick) {
    if (!this.isBlank()) {
      var ordinalNumber = this.getRawOrdinalNumber(tick.value);
      var cateogry = this._ordinalMeta.categories[ordinalNumber];
      // Note that if no data, ordinalMeta.categories is an empty array.
      // Return empty if it's not exist.
      return cateogry == null ? '' : cateogry + '';
    }
  };
  OrdinalScale.prototype.count = function () {
    return this._extent[1] - this._extent[0] + 1;
  };
  OrdinalScale.prototype.unionExtentFromData = function (data, dim) {
    this.unionExtent(data.getApproximateExtent(dim));
  };
  /**
   * @override
   * If value is in extent range
   */
  OrdinalScale.prototype.isInExtentRange = function (value) {
    value = this._getTickNumber(value);
    return this._extent[0] <= value && this._extent[1] >= value;
  };
  OrdinalScale.prototype.getOrdinalMeta = function () {
    return this._ordinalMeta;
  };
  OrdinalScale.prototype.calcNiceTicks = function () {};
  OrdinalScale.prototype.calcNiceExtent = function () {};
  OrdinalScale.type = 'ordinal';
  return OrdinalScale;
}(Scale$1);
Scale$1.registerClass(OrdinalScale);
var OrdinalScale$1 = OrdinalScale;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var roundNumber = round$4;
var IntervalScale = /** @class */function (_super) {
  __extends(IntervalScale, _super);
  function IntervalScale() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = 'interval';
    // Step is calculated in adjustExtent.
    _this._interval = 0;
    _this._intervalPrecision = 2;
    return _this;
  }
  IntervalScale.prototype.parse = function (val) {
    return val;
  };
  IntervalScale.prototype.contain = function (val) {
    return contain$1(val, this._extent);
  };
  IntervalScale.prototype.normalize = function (val) {
    return normalize$5(val, this._extent);
  };
  IntervalScale.prototype.scale = function (val) {
    return scale(val, this._extent);
  };
  IntervalScale.prototype.setExtent = function (start, end) {
    var thisExtent = this._extent;
    // start,end may be a Number like '25',so...
    if (!isNaN(start)) {
      thisExtent[0] = parseFloat(start);
    }
    if (!isNaN(end)) {
      thisExtent[1] = parseFloat(end);
    }
  };
  IntervalScale.prototype.unionExtent = function (other) {
    var extent = this._extent;
    other[0] < extent[0] && (extent[0] = other[0]);
    other[1] > extent[1] && (extent[1] = other[1]);
    // unionExtent may called by it's sub classes
    this.setExtent(extent[0], extent[1]);
  };
  IntervalScale.prototype.getInterval = function () {
    return this._interval;
  };
  IntervalScale.prototype.setInterval = function (interval) {
    this._interval = interval;
    // Dropped auto calculated niceExtent and use user-set extent.
    // We assume user wants to set both interval, min, max to get a better result.
    this._niceExtent = this._extent.slice();
    this._intervalPrecision = getIntervalPrecision(interval);
  };
  /**
   * @param expandToNicedExtent Whether expand the ticks to niced extent.
   */
  IntervalScale.prototype.getTicks = function (expandToNicedExtent) {
    var interval = this._interval;
    var extent = this._extent;
    var niceTickExtent = this._niceExtent;
    var intervalPrecision = this._intervalPrecision;
    var ticks = [];
    // If interval is 0, return [];
    if (!interval) {
      return ticks;
    }
    // Consider this case: using dataZoom toolbox, zoom and zoom.
    var safeLimit = 10000;
    if (extent[0] < niceTickExtent[0]) {
      if (expandToNicedExtent) {
        ticks.push({
          value: roundNumber(niceTickExtent[0] - interval, intervalPrecision)
        });
      } else {
        ticks.push({
          value: extent[0]
        });
      }
    }
    var tick = niceTickExtent[0];
    while (tick <= niceTickExtent[1]) {
      ticks.push({
        value: tick
      });
      // Avoid rounding error
      tick = roundNumber(tick + interval, intervalPrecision);
      if (tick === ticks[ticks.length - 1].value) {
        // Consider out of safe float point, e.g.,
        // -3711126.9907707 + 2e-10 === -3711126.9907707
        break;
      }
      if (ticks.length > safeLimit) {
        return [];
      }
    }
    // Consider this case: the last item of ticks is smaller
    // than niceTickExtent[1] and niceTickExtent[1] === extent[1].
    var lastNiceTick = ticks.length ? ticks[ticks.length - 1].value : niceTickExtent[1];
    if (extent[1] > lastNiceTick) {
      if (expandToNicedExtent) {
        ticks.push({
          value: roundNumber(lastNiceTick + interval, intervalPrecision)
        });
      } else {
        ticks.push({
          value: extent[1]
        });
      }
    }
    return ticks;
  };
  IntervalScale.prototype.getMinorTicks = function (splitNumber) {
    var ticks = this.getTicks(true);
    var minorTicks = [];
    var extent = this.getExtent();
    for (var i = 1; i < ticks.length; i++) {
      var nextTick = ticks[i];
      var prevTick = ticks[i - 1];
      var count = 0;
      var minorTicksGroup = [];
      var interval = nextTick.value - prevTick.value;
      var minorInterval = interval / splitNumber;
      while (count < splitNumber - 1) {
        var minorTick = roundNumber(prevTick.value + (count + 1) * minorInterval);
        // For the first and last interval. The count may be less than splitNumber.
        if (minorTick > extent[0] && minorTick < extent[1]) {
          minorTicksGroup.push(minorTick);
        }
        count++;
      }
      minorTicks.push(minorTicksGroup);
    }
    return minorTicks;
  };
  /**
   * @param opt.precision If 'auto', use nice presision.
   * @param opt.pad returns 1.50 but not 1.5 if precision is 2.
   */
  IntervalScale.prototype.getLabel = function (data, opt) {
    if (data == null) {
      return '';
    }
    var precision = opt && opt.precision;
    if (precision == null) {
      precision = getPrecision(data.value) || 0;
    } else if (precision === 'auto') {
      // Should be more precise then tick.
      precision = this._intervalPrecision;
    }
    // (1) If `precision` is set, 12.005 should be display as '12.00500'.
    // (2) Use roundNumber (toFixed) to avoid scientific notation like '3.5e-7'.
    var dataNum = roundNumber(data.value, precision, true);
    return addCommas(dataNum);
  };
  /**
   * @param splitNumber By default `5`.
   */
  IntervalScale.prototype.calcNiceTicks = function (splitNumber, minInterval, maxInterval) {
    splitNumber = splitNumber || 5;
    var extent = this._extent;
    var span = extent[1] - extent[0];
    if (!isFinite(span)) {
      return;
    }
    // User may set axis min 0 and data are all negative
    // FIXME If it needs to reverse ?
    if (span < 0) {
      span = -span;
      extent.reverse();
    }
    var result = intervalScaleNiceTicks(extent, splitNumber, minInterval, maxInterval);
    this._intervalPrecision = result.intervalPrecision;
    this._interval = result.interval;
    this._niceExtent = result.niceTickExtent;
  };
  IntervalScale.prototype.calcNiceExtent = function (opt) {
    var extent = this._extent;
    // If extent start and end are same, expand them
    if (extent[0] === extent[1]) {
      if (extent[0] !== 0) {
        // Expand extent
        // Note that extents can be both negative. See #13154
        var expandSize = Math.abs(extent[0]);
        // In the fowllowing case
        //      Axis has been fixed max 100
        //      Plus data are all 100 and axis extent are [100, 100].
        // Extend to the both side will cause expanded max is larger than fixed max.
        // So only expand to the smaller side.
        if (!opt.fixMax) {
          extent[1] += expandSize / 2;
          extent[0] -= expandSize / 2;
        } else {
          extent[0] -= expandSize / 2;
        }
      } else {
        extent[1] = 1;
      }
    }
    var span = extent[1] - extent[0];
    // If there are no data and extent are [Infinity, -Infinity]
    if (!isFinite(span)) {
      extent[0] = 0;
      extent[1] = 1;
    }
    this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
    // let extent = this._extent;
    var interval = this._interval;
    if (!opt.fixMin) {
      extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval);
    }
    if (!opt.fixMax) {
      extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval);
    }
  };
  IntervalScale.prototype.setNiceExtent = function (min, max) {
    this._niceExtent = [min, max];
  };
  IntervalScale.type = 'interval';
  return IntervalScale;
}(Scale$1);
Scale$1.registerClass(IntervalScale);
var IntervalScale$1 = IntervalScale;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* global Float32Array */
var supportFloat32Array = typeof Float32Array !== 'undefined';
var Float32ArrayCtor = !supportFloat32Array ? Array : Float32Array;
function createFloat32Array(arg) {
  if (isArray$1(arg)) {
    // Return self directly if don't support TypedArray.
    return supportFloat32Array ? new Float32Array(arg) : arg;
  }
  // Else is number
  return new Float32ArrayCtor(arg);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var STACK_PREFIX = '__ec_stack_';
function getSeriesStackId$1(seriesModel) {
  return seriesModel.get('stack') || STACK_PREFIX + seriesModel.seriesIndex;
}
function getAxisKey$1(axis) {
  return axis.dim + axis.index;
}
/**
 * @return {Object} {width, offset, offsetCenter} If axis.type is not 'category', return undefined.
 */
function getLayoutOnAxis(opt) {
  var params = [];
  var baseAxis = opt.axis;
  var axisKey = 'axis0';
  if (baseAxis.type !== 'category') {
    return;
  }
  var bandWidth = baseAxis.getBandWidth();
  for (var i = 0; i < opt.count || 0; i++) {
    params.push(defaults({
      bandWidth: bandWidth,
      axisKey: axisKey,
      stackId: STACK_PREFIX + i
    }, opt));
  }
  var widthAndOffsets = doCalBarWidthAndOffset(params);
  var result = [];
  for (var i = 0; i < opt.count; i++) {
    var item = widthAndOffsets[axisKey][STACK_PREFIX + i];
    item.offsetCenter = item.offset + item.width / 2;
    result.push(item);
  }
  return result;
}
function prepareLayoutBarSeries(seriesType, ecModel) {
  var seriesModels = [];
  ecModel.eachSeriesByType(seriesType, function (seriesModel) {
    // Check series coordinate, do layout for cartesian2d only
    if (isOnCartesian(seriesModel)) {
      seriesModels.push(seriesModel);
    }
  });
  return seriesModels;
}
/**
 * Map from (baseAxis.dim + '_' + baseAxis.index) to min gap of two adjacent
 * values.
 * This works for time axes, value axes, and log axes.
 * For a single time axis, return value is in the form like
 * {'x_0': [1000000]}.
 * The value of 1000000 is in milliseconds.
 */
function getValueAxesMinGaps(barSeries) {
  /**
   * Map from axis.index to values.
   * For a single time axis, axisValues is in the form like
   * {'x_0': [1495555200000, 1495641600000, 1495728000000]}.
   * Items in axisValues[x], e.g. 1495555200000, are time values of all
   * series.
   */
  var axisValues = {};
  each$f(barSeries, function (seriesModel) {
    var cartesian = seriesModel.coordinateSystem;
    var baseAxis = cartesian.getBaseAxis();
    if (baseAxis.type !== 'time' && baseAxis.type !== 'value') {
      return;
    }
    var data = seriesModel.getData();
    var key = baseAxis.dim + '_' + baseAxis.index;
    var dimIdx = data.getDimensionIndex(data.mapDimension(baseAxis.dim));
    var store = data.getStore();
    for (var i = 0, cnt = store.count(); i < cnt; ++i) {
      var value = store.get(dimIdx, i);
      if (!axisValues[key]) {
        // No previous data for the axis
        axisValues[key] = [value];
      } else {
        // No value in previous series
        axisValues[key].push(value);
      }
      // Ignore duplicated time values in the same axis
    }
  });
  var axisMinGaps = {};
  for (var key in axisValues) {
    if (axisValues.hasOwnProperty(key)) {
      var valuesInAxis = axisValues[key];
      if (valuesInAxis) {
        // Sort axis values into ascending order to calculate gaps
        valuesInAxis.sort(function (a, b) {
          return a - b;
        });
        var min = null;
        for (var j = 1; j < valuesInAxis.length; ++j) {
          var delta = valuesInAxis[j] - valuesInAxis[j - 1];
          if (delta > 0) {
            // Ignore 0 delta because they are of the same axis value
            min = min === null ? delta : Math.min(min, delta);
          }
        }
        // Set to null if only have one data
        axisMinGaps[key] = min;
      }
    }
  }
  return axisMinGaps;
}
function makeColumnLayout(barSeries) {
  var axisMinGaps = getValueAxesMinGaps(barSeries);
  var seriesInfoList = [];
  each$f(barSeries, function (seriesModel) {
    var cartesian = seriesModel.coordinateSystem;
    var baseAxis = cartesian.getBaseAxis();
    var axisExtent = baseAxis.getExtent();
    var bandWidth;
    if (baseAxis.type === 'category') {
      bandWidth = baseAxis.getBandWidth();
    } else if (baseAxis.type === 'value' || baseAxis.type === 'time') {
      var key = baseAxis.dim + '_' + baseAxis.index;
      var minGap = axisMinGaps[key];
      var extentSpan = Math.abs(axisExtent[1] - axisExtent[0]);
      var scale = baseAxis.scale.getExtent();
      var scaleSpan = Math.abs(scale[1] - scale[0]);
      bandWidth = minGap ? extentSpan / scaleSpan * minGap : extentSpan; // When there is only one data value
    } else {
      var data = seriesModel.getData();
      bandWidth = Math.abs(axisExtent[1] - axisExtent[0]) / data.count();
    }
    var barWidth = parsePercent(seriesModel.get('barWidth'), bandWidth);
    var barMaxWidth = parsePercent(seriesModel.get('barMaxWidth'), bandWidth);
    var barMinWidth = parsePercent(
    // barMinWidth by default is 0.5 / 1 in cartesian. Because in value axis,
    // the auto-calculated bar width might be less than 0.5 / 1.
    seriesModel.get('barMinWidth') || (isInLargeMode(seriesModel) ? 0.5 : 1), bandWidth);
    var barGap = seriesModel.get('barGap');
    var barCategoryGap = seriesModel.get('barCategoryGap');
    seriesInfoList.push({
      bandWidth: bandWidth,
      barWidth: barWidth,
      barMaxWidth: barMaxWidth,
      barMinWidth: barMinWidth,
      barGap: barGap,
      barCategoryGap: barCategoryGap,
      axisKey: getAxisKey$1(baseAxis),
      stackId: getSeriesStackId$1(seriesModel)
    });
  });
  return doCalBarWidthAndOffset(seriesInfoList);
}
function doCalBarWidthAndOffset(seriesInfoList) {
  // Columns info on each category axis. Key is cartesian name
  var columnsMap = {};
  each$f(seriesInfoList, function (seriesInfo, idx) {
    var axisKey = seriesInfo.axisKey;
    var bandWidth = seriesInfo.bandWidth;
    var columnsOnAxis = columnsMap[axisKey] || {
      bandWidth: bandWidth,
      remainedWidth: bandWidth,
      autoWidthCount: 0,
      categoryGap: null,
      gap: '20%',
      stacks: {}
    };
    var stacks = columnsOnAxis.stacks;
    columnsMap[axisKey] = columnsOnAxis;
    var stackId = seriesInfo.stackId;
    if (!stacks[stackId]) {
      columnsOnAxis.autoWidthCount++;
    }
    stacks[stackId] = stacks[stackId] || {
      width: 0,
      maxWidth: 0
    };
    // Caution: In a single coordinate system, these barGrid attributes
    // will be shared by series. Consider that they have default values,
    // only the attributes set on the last series will work.
    // Do not change this fact unless there will be a break change.
    var barWidth = seriesInfo.barWidth;
    if (barWidth && !stacks[stackId].width) {
      // See #6312, do not restrict width.
      stacks[stackId].width = barWidth;
      barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth);
      columnsOnAxis.remainedWidth -= barWidth;
    }
    var barMaxWidth = seriesInfo.barMaxWidth;
    barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth);
    var barMinWidth = seriesInfo.barMinWidth;
    barMinWidth && (stacks[stackId].minWidth = barMinWidth);
    var barGap = seriesInfo.barGap;
    barGap != null && (columnsOnAxis.gap = barGap);
    var barCategoryGap = seriesInfo.barCategoryGap;
    barCategoryGap != null && (columnsOnAxis.categoryGap = barCategoryGap);
  });
  var result = {};
  each$f(columnsMap, function (columnsOnAxis, coordSysName) {
    result[coordSysName] = {};
    var stacks = columnsOnAxis.stacks;
    var bandWidth = columnsOnAxis.bandWidth;
    var categoryGapPercent = columnsOnAxis.categoryGap;
    if (categoryGapPercent == null) {
      var columnCount = keys(stacks).length;
      // More columns in one group
      // the spaces between group is smaller. Or the column will be too thin.
      categoryGapPercent = Math.max(35 - columnCount * 4, 15) + '%';
    }
    var categoryGap = parsePercent(categoryGapPercent, bandWidth);
    var barGapPercent = parsePercent(columnsOnAxis.gap, 1);
    var remainedWidth = columnsOnAxis.remainedWidth;
    var autoWidthCount = columnsOnAxis.autoWidthCount;
    var autoWidth = (remainedWidth - categoryGap) / (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
    autoWidth = Math.max(autoWidth, 0);
    // Find if any auto calculated bar exceeded maxBarWidth
    each$f(stacks, function (column) {
      var maxWidth = column.maxWidth;
      var minWidth = column.minWidth;
      if (!column.width) {
        var finalWidth = autoWidth;
        if (maxWidth && maxWidth < finalWidth) {
          finalWidth = Math.min(maxWidth, remainedWidth);
        }
        // `minWidth` has higher priority. `minWidth` decide that whether the
        // bar is able to be visible. So `minWidth` should not be restricted
        // by `maxWidth` or `remainedWidth` (which is from `bandWidth`). In
        // the extreme cases for `value` axis, bars are allowed to overlap
        // with each other if `minWidth` specified.
        if (minWidth && minWidth > finalWidth) {
          finalWidth = minWidth;
        }
        if (finalWidth !== autoWidth) {
          column.width = finalWidth;
          remainedWidth -= finalWidth + barGapPercent * finalWidth;
          autoWidthCount--;
        }
      } else {
        // `barMinWidth/barMaxWidth` has higher priority than `barWidth`, as
        // CSS does. Because barWidth can be a percent value, where
        // `barMaxWidth` can be used to restrict the final width.
        var finalWidth = column.width;
        if (maxWidth) {
          finalWidth = Math.min(finalWidth, maxWidth);
        }
        // `minWidth` has higher priority, as described above
        if (minWidth) {
          finalWidth = Math.max(finalWidth, minWidth);
        }
        column.width = finalWidth;
        remainedWidth -= finalWidth + barGapPercent * finalWidth;
        autoWidthCount--;
      }
    });
    // Recalculate width again
    autoWidth = (remainedWidth - categoryGap) / (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
    autoWidth = Math.max(autoWidth, 0);
    var widthSum = 0;
    var lastColumn;
    each$f(stacks, function (column, idx) {
      if (!column.width) {
        column.width = autoWidth;
      }
      lastColumn = column;
      widthSum += column.width * (1 + barGapPercent);
    });
    if (lastColumn) {
      widthSum -= lastColumn.width * barGapPercent;
    }
    var offset = -widthSum / 2;
    each$f(stacks, function (column, stackId) {
      result[coordSysName][stackId] = result[coordSysName][stackId] || {
        bandWidth: bandWidth,
        offset: offset,
        width: column.width
      };
      offset += column.width * (1 + barGapPercent);
    });
  });
  return result;
}
function retrieveColumnLayout(barWidthAndOffset, axis, seriesModel) {
  if (barWidthAndOffset && axis) {
    var result = barWidthAndOffset[getAxisKey$1(axis)];
    if (result != null && seriesModel != null) {
      return result[getSeriesStackId$1(seriesModel)];
    }
    return result;
  }
}
function layout$3(seriesType, ecModel) {
  var seriesModels = prepareLayoutBarSeries(seriesType, ecModel);
  var barWidthAndOffset = makeColumnLayout(seriesModels);
  each$f(seriesModels, function (seriesModel) {
    var data = seriesModel.getData();
    var cartesian = seriesModel.coordinateSystem;
    var baseAxis = cartesian.getBaseAxis();
    var stackId = getSeriesStackId$1(seriesModel);
    var columnLayoutInfo = barWidthAndOffset[getAxisKey$1(baseAxis)][stackId];
    var columnOffset = columnLayoutInfo.offset;
    var columnWidth = columnLayoutInfo.width;
    data.setLayout({
      bandWidth: columnLayoutInfo.bandWidth,
      offset: columnOffset,
      size: columnWidth
    });
  });
}
// TODO: Do not support stack in large mode yet.
function createProgressiveLayout(seriesType) {
  return {
    seriesType: seriesType,
    plan: createRenderPlanner(),
    reset: function (seriesModel) {
      if (!isOnCartesian(seriesModel)) {
        return;
      }
      var data = seriesModel.getData();
      var cartesian = seriesModel.coordinateSystem;
      var baseAxis = cartesian.getBaseAxis();
      var valueAxis = cartesian.getOtherAxis(baseAxis);
      var valueDimIdx = data.getDimensionIndex(data.mapDimension(valueAxis.dim));
      var baseDimIdx = data.getDimensionIndex(data.mapDimension(baseAxis.dim));
      var drawBackground = seriesModel.get('showBackground', true);
      var valueDim = data.mapDimension(valueAxis.dim);
      var stackResultDim = data.getCalculationInfo('stackResultDimension');
      var stacked = isDimensionStacked(data, valueDim) && !!data.getCalculationInfo('stackedOnSeries');
      var isValueAxisH = valueAxis.isHorizontal();
      var valueAxisStart = getValueAxisStart(baseAxis, valueAxis);
      var isLarge = isInLargeMode(seriesModel);
      var barMinHeight = seriesModel.get('barMinHeight') || 0;
      var stackedDimIdx = stackResultDim && data.getDimensionIndex(stackResultDim);
      // Layout info.
      var columnWidth = data.getLayout('size');
      var columnOffset = data.getLayout('offset');
      return {
        progress: function (params, data) {
          var count = params.count;
          var largePoints = isLarge && createFloat32Array(count * 3);
          var largeBackgroundPoints = isLarge && drawBackground && createFloat32Array(count * 3);
          var largeDataIndices = isLarge && createFloat32Array(count);
          var coordLayout = cartesian.master.getRect();
          var bgSize = isValueAxisH ? coordLayout.width : coordLayout.height;
          var dataIndex;
          var store = data.getStore();
          var idxOffset = 0;
          while ((dataIndex = params.next()) != null) {
            var value = store.get(stacked ? stackedDimIdx : valueDimIdx, dataIndex);
            var baseValue = store.get(baseDimIdx, dataIndex);
            var baseCoord = valueAxisStart;
            var stackStartValue = void 0;
            // Because of the barMinHeight, we can not use the value in
            // stackResultDimension directly.
            if (stacked) {
              stackStartValue = +value - store.get(valueDimIdx, dataIndex);
            }
            var x = void 0;
            var y = void 0;
            var width = void 0;
            var height = void 0;
            if (isValueAxisH) {
              var coord = cartesian.dataToPoint([value, baseValue]);
              if (stacked) {
                var startCoord = cartesian.dataToPoint([stackStartValue, baseValue]);
                baseCoord = startCoord[0];
              }
              x = baseCoord;
              y = coord[1] + columnOffset;
              width = coord[0] - baseCoord;
              height = columnWidth;
              if (Math.abs(width) < barMinHeight) {
                width = (width < 0 ? -1 : 1) * barMinHeight;
              }
            } else {
              var coord = cartesian.dataToPoint([baseValue, value]);
              if (stacked) {
                var startCoord = cartesian.dataToPoint([baseValue, stackStartValue]);
                baseCoord = startCoord[1];
              }
              x = coord[0] + columnOffset;
              y = baseCoord;
              width = columnWidth;
              height = coord[1] - baseCoord;
              if (Math.abs(height) < barMinHeight) {
                // Include zero to has a positive bar
                height = (height <= 0 ? -1 : 1) * barMinHeight;
              }
            }
            if (!isLarge) {
              data.setItemLayout(dataIndex, {
                x: x,
                y: y,
                width: width,
                height: height
              });
            } else {
              largePoints[idxOffset] = x;
              largePoints[idxOffset + 1] = y;
              largePoints[idxOffset + 2] = isValueAxisH ? width : height;
              if (largeBackgroundPoints) {
                largeBackgroundPoints[idxOffset] = isValueAxisH ? coordLayout.x : x;
                largeBackgroundPoints[idxOffset + 1] = isValueAxisH ? y : coordLayout.y;
                largeBackgroundPoints[idxOffset + 2] = bgSize;
              }
              largeDataIndices[dataIndex] = dataIndex;
            }
            idxOffset += 3;
          }
          if (isLarge) {
            data.setLayout({
              largePoints: largePoints,
              largeDataIndices: largeDataIndices,
              largeBackgroundPoints: largeBackgroundPoints,
              valueAxisHorizontal: isValueAxisH
            });
          }
        }
      };
    }
  };
}
function isOnCartesian(seriesModel) {
  return seriesModel.coordinateSystem && seriesModel.coordinateSystem.type === 'cartesian2d';
}
function isInLargeMode(seriesModel) {
  return seriesModel.pipelineContext && seriesModel.pipelineContext.large;
}
// See cases in `test/bar-start.html` and `#7412`, `#8747`.
function getValueAxisStart(baseAxis, valueAxis) {
  var startValue = valueAxis.model.get('startValue');
  if (!startValue) {
    startValue = 0;
  }
  return valueAxis.toGlobalCoord(valueAxis.dataToCoord(valueAxis.type === 'log' ? startValue > 0 ? startValue : 1 : startValue));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// FIXME 公用？
var bisect = function (a, x, lo, hi) {
  while (lo < hi) {
    var mid = lo + hi >>> 1;
    if (a[mid][1] < x) {
      lo = mid + 1;
    } else {
      hi = mid;
    }
  }
  return lo;
};
var TimeScale = /** @class */function (_super) {
  __extends(TimeScale, _super);
  function TimeScale(settings) {
    var _this = _super.call(this, settings) || this;
    _this.type = 'time';
    return _this;
  }
  /**
   * Get label is mainly for other components like dataZoom, tooltip.
   */
  TimeScale.prototype.getLabel = function (tick) {
    var useUTC = this.getSetting('useUTC');
    return format(tick.value, fullLeveledFormatter[getDefaultFormatPrecisionOfInterval(getPrimaryTimeUnit(this._minLevelUnit))] || fullLeveledFormatter.second, useUTC, this.getSetting('locale'));
  };
  TimeScale.prototype.getFormattedLabel = function (tick, idx, labelFormatter) {
    var isUTC = this.getSetting('useUTC');
    var lang = this.getSetting('locale');
    return leveledFormat(tick, idx, labelFormatter, lang, isUTC);
  };
  /**
   * @override
   */
  TimeScale.prototype.getTicks = function () {
    var interval = this._interval;
    var extent = this._extent;
    var ticks = [];
    // If interval is 0, return [];
    if (!interval) {
      return ticks;
    }
    ticks.push({
      value: extent[0],
      level: 0
    });
    var useUTC = this.getSetting('useUTC');
    var innerTicks = getIntervalTicks(this._minLevelUnit, this._approxInterval, useUTC, extent);
    ticks = ticks.concat(innerTicks);
    ticks.push({
      value: extent[1],
      level: 0
    });
    return ticks;
  };
  TimeScale.prototype.calcNiceExtent = function (opt) {
    var extent = this._extent;
    // If extent start and end are same, expand them
    if (extent[0] === extent[1]) {
      // Expand extent
      extent[0] -= ONE_DAY;
      extent[1] += ONE_DAY;
    }
    // If there are no data and extent are [Infinity, -Infinity]
    if (extent[1] === -Infinity && extent[0] === Infinity) {
      var d = new Date();
      extent[1] = +new Date(d.getFullYear(), d.getMonth(), d.getDate());
      extent[0] = extent[1] - ONE_DAY;
    }
    this.calcNiceTicks(opt.splitNumber, opt.minInterval, opt.maxInterval);
  };
  TimeScale.prototype.calcNiceTicks = function (approxTickNum, minInterval, maxInterval) {
    approxTickNum = approxTickNum || 10;
    var extent = this._extent;
    var span = extent[1] - extent[0];
    this._approxInterval = span / approxTickNum;
    if (minInterval != null && this._approxInterval < minInterval) {
      this._approxInterval = minInterval;
    }
    if (maxInterval != null && this._approxInterval > maxInterval) {
      this._approxInterval = maxInterval;
    }
    var scaleIntervalsLen = scaleIntervals.length;
    var idx = Math.min(bisect(scaleIntervals, this._approxInterval, 0, scaleIntervalsLen), scaleIntervalsLen - 1);
    // Interval that can be used to calculate ticks
    this._interval = scaleIntervals[idx][1];
    // Min level used when picking ticks from top down.
    // We check one more level to avoid the ticks are to sparse in some case.
    this._minLevelUnit = scaleIntervals[Math.max(idx - 1, 0)][0];
  };
  TimeScale.prototype.parse = function (val) {
    // val might be float.
    return isNumber(val) ? val : +parseDate(val);
  };
  TimeScale.prototype.contain = function (val) {
    return contain$1(this.parse(val), this._extent);
  };
  TimeScale.prototype.normalize = function (val) {
    return normalize$5(this.parse(val), this._extent);
  };
  TimeScale.prototype.scale = function (val) {
    return scale(val, this._extent);
  };
  TimeScale.type = 'time';
  return TimeScale;
}(IntervalScale$1);
/**
 * This implementation was originally copied from "d3.js"
 * <https://github.com/d3/d3/blob/b516d77fb8566b576088e73410437494717ada26/src/time/scale.js>
 * with some modifications made for this program.
 * See the license statement at the head of this file.
 */
var scaleIntervals = [
// Format                           interval
['second', ONE_SECOND], ['minute', ONE_MINUTE], ['hour', ONE_HOUR], ['quarter-day', ONE_HOUR * 6], ['half-day', ONE_HOUR * 12], ['day', ONE_DAY * 1.2], ['half-week', ONE_DAY * 3.5], ['week', ONE_DAY * 7], ['month', ONE_DAY * 31], ['quarter', ONE_DAY * 95], ['half-year', ONE_YEAR / 2], ['year', ONE_YEAR] // 1Y
];
function isUnitValueSame(unit, valueA, valueB, isUTC) {
  var dateA = parseDate(valueA);
  var dateB = parseDate(valueB);
  var isSame = function (unit) {
    return getUnitValue(dateA, unit, isUTC) === getUnitValue(dateB, unit, isUTC);
  };
  var isSameYear = function () {
    return isSame('year');
  };
  // const isSameHalfYear = () => isSameYear() && isSame('half-year');
  // const isSameQuater = () => isSameYear() && isSame('quarter');
  var isSameMonth = function () {
    return isSameYear() && isSame('month');
  };
  var isSameDay = function () {
    return isSameMonth() && isSame('day');
  };
  // const isSameHalfDay = () => isSameDay() && isSame('half-day');
  var isSameHour = function () {
    return isSameDay() && isSame('hour');
  };
  var isSameMinute = function () {
    return isSameHour() && isSame('minute');
  };
  var isSameSecond = function () {
    return isSameMinute() && isSame('second');
  };
  var isSameMilliSecond = function () {
    return isSameSecond() && isSame('millisecond');
  };
  switch (unit) {
    case 'year':
      return isSameYear();
    case 'month':
      return isSameMonth();
    case 'day':
      return isSameDay();
    case 'hour':
      return isSameHour();
    case 'minute':
      return isSameMinute();
    case 'second':
      return isSameSecond();
    case 'millisecond':
      return isSameMilliSecond();
  }
}
// const primaryUnitGetters = {
//     year: fullYearGetterName(),
//     month: monthGetterName(),
//     day: dateGetterName(),
//     hour: hoursGetterName(),
//     minute: minutesGetterName(),
//     second: secondsGetterName(),
//     millisecond: millisecondsGetterName()
// };
// const primaryUnitUTCGetters = {
//     year: fullYearGetterName(true),
//     month: monthGetterName(true),
//     day: dateGetterName(true),
//     hour: hoursGetterName(true),
//     minute: minutesGetterName(true),
//     second: secondsGetterName(true),
//     millisecond: millisecondsGetterName(true)
// };
// function moveTick(date: Date, unitName: TimeUnit, step: number, isUTC: boolean) {
//     step = step || 1;
//     switch (getPrimaryTimeUnit(unitName)) {
//         case 'year':
//             date[fullYearSetterName(isUTC)](date[fullYearGetterName(isUTC)]() + step);
//             break;
//         case 'month':
//             date[monthSetterName(isUTC)](date[monthGetterName(isUTC)]() + step);
//             break;
//         case 'day':
//             date[dateSetterName(isUTC)](date[dateGetterName(isUTC)]() + step);
//             break;
//         case 'hour':
//             date[hoursSetterName(isUTC)](date[hoursGetterName(isUTC)]() + step);
//             break;
//         case 'minute':
//             date[minutesSetterName(isUTC)](date[minutesGetterName(isUTC)]() + step);
//             break;
//         case 'second':
//             date[secondsSetterName(isUTC)](date[secondsGetterName(isUTC)]() + step);
//             break;
//         case 'millisecond':
//             date[millisecondsSetterName(isUTC)](date[millisecondsGetterName(isUTC)]() + step);
//             break;
//     }
//     return date.getTime();
// }
// const DATE_INTERVALS = [[8, 7.5], [4, 3.5], [2, 1.5]];
// const MONTH_INTERVALS = [[6, 5.5], [3, 2.5], [2, 1.5]];
// const MINUTES_SECONDS_INTERVALS = [[30, 30], [20, 20], [15, 15], [10, 10], [5, 5], [2, 2]];
function getDateInterval(approxInterval, daysInMonth) {
  approxInterval /= ONE_DAY;
  return approxInterval > 16 ? 16
  // Math.floor(daysInMonth / 2) + 1  // In this case we only want one tick between two months.
  : approxInterval > 7.5 ? 7 // TODO week 7 or day 8?
  : approxInterval > 3.5 ? 4 : approxInterval > 1.5 ? 2 : 1;
}
function getMonthInterval(approxInterval) {
  var APPROX_ONE_MONTH = 30 * ONE_DAY;
  approxInterval /= APPROX_ONE_MONTH;
  return approxInterval > 6 ? 6 : approxInterval > 3 ? 3 : approxInterval > 2 ? 2 : 1;
}
function getHourInterval(approxInterval) {
  approxInterval /= ONE_HOUR;
  return approxInterval > 12 ? 12 : approxInterval > 6 ? 6 : approxInterval > 3.5 ? 4 : approxInterval > 2 ? 2 : 1;
}
function getMinutesAndSecondsInterval(approxInterval, isMinutes) {
  approxInterval /= isMinutes ? ONE_MINUTE : ONE_SECOND;
  return approxInterval > 30 ? 30 : approxInterval > 20 ? 20 : approxInterval > 15 ? 15 : approxInterval > 10 ? 10 : approxInterval > 5 ? 5 : approxInterval > 2 ? 2 : 1;
}
function getMillisecondsInterval(approxInterval) {
  return nice(approxInterval, true);
}
function getFirstTimestampOfUnit(date, unitName, isUTC) {
  var outDate = new Date(date);
  switch (getPrimaryTimeUnit(unitName)) {
    case 'year':
    case 'month':
      outDate[monthSetterName(isUTC)](0);
    case 'day':
      outDate[dateSetterName(isUTC)](1);
    case 'hour':
      outDate[hoursSetterName(isUTC)](0);
    case 'minute':
      outDate[minutesSetterName(isUTC)](0);
    case 'second':
      outDate[secondsSetterName(isUTC)](0);
      outDate[millisecondsSetterName(isUTC)](0);
  }
  return outDate.getTime();
}
function getIntervalTicks(bottomUnitName, approxInterval, isUTC, extent) {
  var safeLimit = 10000;
  var unitNames = timeUnits;
  var iter = 0;
  function addTicksInSpan(interval, minTimestamp, maxTimestamp, getMethodName, setMethodName, isDate, out) {
    var date = new Date(minTimestamp);
    var dateTime = minTimestamp;
    var d = date[getMethodName]();
    // if (isDate) {
    //     d -= 1; // Starts with 0;   PENDING
    // }
    while (dateTime < maxTimestamp && dateTime <= extent[1]) {
      out.push({
        value: dateTime
      });
      d += interval;
      date[setMethodName](d);
      dateTime = date.getTime();
    }
    // This extra tick is for calcuating ticks of next level. Will not been added to the final result
    out.push({
      value: dateTime,
      notAdd: true
    });
  }
  function addLevelTicks(unitName, lastLevelTicks, levelTicks) {
    var newAddedTicks = [];
    var isFirstLevel = !lastLevelTicks.length;
    if (isUnitValueSame(getPrimaryTimeUnit(unitName), extent[0], extent[1], isUTC)) {
      return;
    }
    if (isFirstLevel) {
      lastLevelTicks = [{
        // TODO Optimize. Not include so may ticks.
        value: getFirstTimestampOfUnit(new Date(extent[0]), unitName, isUTC)
      }, {
        value: extent[1]
      }];
    }
    for (var i = 0; i < lastLevelTicks.length - 1; i++) {
      var startTick = lastLevelTicks[i].value;
      var endTick = lastLevelTicks[i + 1].value;
      if (startTick === endTick) {
        continue;
      }
      var interval = void 0;
      var getterName = void 0;
      var setterName = void 0;
      var isDate = false;
      switch (unitName) {
        case 'year':
          interval = Math.max(1, Math.round(approxInterval / ONE_DAY / 365));
          getterName = fullYearGetterName(isUTC);
          setterName = fullYearSetterName(isUTC);
          break;
        case 'half-year':
        case 'quarter':
        case 'month':
          interval = getMonthInterval(approxInterval);
          getterName = monthGetterName(isUTC);
          setterName = monthSetterName(isUTC);
          break;
        case 'week': // PENDING If week is added. Ignore day.
        case 'half-week':
        case 'day':
          interval = getDateInterval(approxInterval); // Use 32 days and let interval been 16
          getterName = dateGetterName(isUTC);
          setterName = dateSetterName(isUTC);
          isDate = true;
          break;
        case 'half-day':
        case 'quarter-day':
        case 'hour':
          interval = getHourInterval(approxInterval);
          getterName = hoursGetterName(isUTC);
          setterName = hoursSetterName(isUTC);
          break;
        case 'minute':
          interval = getMinutesAndSecondsInterval(approxInterval, true);
          getterName = minutesGetterName(isUTC);
          setterName = minutesSetterName(isUTC);
          break;
        case 'second':
          interval = getMinutesAndSecondsInterval(approxInterval, false);
          getterName = secondsGetterName(isUTC);
          setterName = secondsSetterName(isUTC);
          break;
        case 'millisecond':
          interval = getMillisecondsInterval(approxInterval);
          getterName = millisecondsGetterName(isUTC);
          setterName = millisecondsSetterName(isUTC);
          break;
      }
      addTicksInSpan(interval, startTick, endTick, getterName, setterName, isDate, newAddedTicks);
      if (unitName === 'year' && levelTicks.length > 1 && i === 0) {
        // Add nearest years to the left extent.
        levelTicks.unshift({
          value: levelTicks[0].value - interval
        });
      }
    }
    for (var i = 0; i < newAddedTicks.length; i++) {
      levelTicks.push(newAddedTicks[i]);
    }
    // newAddedTicks.length && console.log(unitName, newAddedTicks);
    return newAddedTicks;
  }
  var levelsTicks = [];
  var currentLevelTicks = [];
  var tickCount = 0;
  var lastLevelTickCount = 0;
  for (var i = 0; i < unitNames.length && iter++ < safeLimit; ++i) {
    var primaryTimeUnit = getPrimaryTimeUnit(unitNames[i]);
    if (!isPrimaryTimeUnit(unitNames[i])) {
      // TODO
      continue;
    }
    addLevelTicks(unitNames[i], levelsTicks[levelsTicks.length - 1] || [], currentLevelTicks);
    var nextPrimaryTimeUnit = unitNames[i + 1] ? getPrimaryTimeUnit(unitNames[i + 1]) : null;
    if (primaryTimeUnit !== nextPrimaryTimeUnit) {
      if (currentLevelTicks.length) {
        lastLevelTickCount = tickCount;
        // Remove the duplicate so the tick count can be precisely.
        currentLevelTicks.sort(function (a, b) {
          return a.value - b.value;
        });
        var levelTicksRemoveDuplicated = [];
        for (var i_1 = 0; i_1 < currentLevelTicks.length; ++i_1) {
          var tickValue = currentLevelTicks[i_1].value;
          if (i_1 === 0 || currentLevelTicks[i_1 - 1].value !== tickValue) {
            levelTicksRemoveDuplicated.push(currentLevelTicks[i_1]);
            if (tickValue >= extent[0] && tickValue <= extent[1]) {
              tickCount++;
            }
          }
        }
        var targetTickNum = (extent[1] - extent[0]) / approxInterval;
        // Added too much in this level and not too less in last level
        if (tickCount > targetTickNum * 1.5 && lastLevelTickCount > targetTickNum / 1.5) {
          break;
        }
        // Only treat primary time unit as one level.
        levelsTicks.push(levelTicksRemoveDuplicated);
        if (tickCount > targetTickNum || bottomUnitName === unitNames[i]) {
          break;
        }
      }
      // Reset if next unitName is primary
      currentLevelTicks = [];
    }
  }
  {
    if (iter >= safeLimit) {
      warn('Exceed safe limit.');
    }
  }
  var levelsTicksInExtent = filter(map$1(levelsTicks, function (levelTicks) {
    return filter(levelTicks, function (tick) {
      return tick.value >= extent[0] && tick.value <= extent[1] && !tick.notAdd;
    });
  }), function (levelTicks) {
    return levelTicks.length > 0;
  });
  var ticks = [];
  var maxLevel = levelsTicksInExtent.length - 1;
  for (var i = 0; i < levelsTicksInExtent.length; ++i) {
    var levelTicks = levelsTicksInExtent[i];
    for (var k = 0; k < levelTicks.length; ++k) {
      ticks.push({
        value: levelTicks[k].value,
        level: maxLevel - i
      });
    }
  }
  ticks.sort(function (a, b) {
    return a.value - b.value;
  });
  // Remove duplicates
  var result = [];
  for (var i = 0; i < ticks.length; ++i) {
    if (i === 0 || ticks[i].value !== ticks[i - 1].value) {
      result.push(ticks[i]);
    }
  }
  return result;
}
Scale$1.registerClass(TimeScale);
var TimeScale$1 = TimeScale;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var scaleProto = Scale$1.prototype;
// FIXME:TS refactor: not good to call it directly with `this`?
var intervalScaleProto = IntervalScale$1.prototype;
var roundingErrorFix = round$4;
var mathFloor$1 = Math.floor;
var mathCeil$1 = Math.ceil;
var mathPow$1 = Math.pow;
var mathLog$1 = Math.log;
var LogScale = /** @class */function (_super) {
  __extends(LogScale, _super);
  function LogScale() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = 'log';
    _this.base = 10;
    _this._originalScale = new IntervalScale$1();
    // FIXME:TS actually used by `IntervalScale`
    _this._interval = 0;
    return _this;
  }
  /**
   * @param Whether expand the ticks to niced extent.
   */
  LogScale.prototype.getTicks = function (expandToNicedExtent) {
    var originalScale = this._originalScale;
    var extent = this._extent;
    var originalExtent = originalScale.getExtent();
    var ticks = intervalScaleProto.getTicks.call(this, expandToNicedExtent);
    return map$1(ticks, function (tick) {
      var val = tick.value;
      var powVal = round$4(mathPow$1(this.base, val));
      // Fix #4158
      powVal = val === extent[0] && this._fixMin ? fixRoundingError(powVal, originalExtent[0]) : powVal;
      powVal = val === extent[1] && this._fixMax ? fixRoundingError(powVal, originalExtent[1]) : powVal;
      return {
        value: powVal
      };
    }, this);
  };
  LogScale.prototype.setExtent = function (start, end) {
    var base = mathLog$1(this.base);
    // log(-Infinity) is NaN, so safe guard here
    start = mathLog$1(Math.max(0, start)) / base;
    end = mathLog$1(Math.max(0, end)) / base;
    intervalScaleProto.setExtent.call(this, start, end);
  };
  /**
   * @return {number} end
   */
  LogScale.prototype.getExtent = function () {
    var base = this.base;
    var extent = scaleProto.getExtent.call(this);
    extent[0] = mathPow$1(base, extent[0]);
    extent[1] = mathPow$1(base, extent[1]);
    // Fix #4158
    var originalScale = this._originalScale;
    var originalExtent = originalScale.getExtent();
    this._fixMin && (extent[0] = fixRoundingError(extent[0], originalExtent[0]));
    this._fixMax && (extent[1] = fixRoundingError(extent[1], originalExtent[1]));
    return extent;
  };
  LogScale.prototype.unionExtent = function (extent) {
    this._originalScale.unionExtent(extent);
    var base = this.base;
    extent[0] = mathLog$1(extent[0]) / mathLog$1(base);
    extent[1] = mathLog$1(extent[1]) / mathLog$1(base);
    scaleProto.unionExtent.call(this, extent);
  };
  LogScale.prototype.unionExtentFromData = function (data, dim) {
    // TODO
    // filter value that <= 0
    this.unionExtent(data.getApproximateExtent(dim));
  };
  /**
   * Update interval and extent of intervals for nice ticks
   * @param approxTickNum default 10 Given approx tick number
   */
  LogScale.prototype.calcNiceTicks = function (approxTickNum) {
    approxTickNum = approxTickNum || 10;
    var extent = this._extent;
    var span = extent[1] - extent[0];
    if (span === Infinity || span <= 0) {
      return;
    }
    var interval = quantity(span);
    var err = approxTickNum / span * interval;
    // Filter ticks to get closer to the desired count.
    if (err <= 0.5) {
      interval *= 10;
    }
    // Interval should be integer
    while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) {
      interval *= 10;
    }
    var niceExtent = [round$4(mathCeil$1(extent[0] / interval) * interval), round$4(mathFloor$1(extent[1] / interval) * interval)];
    this._interval = interval;
    this._niceExtent = niceExtent;
  };
  LogScale.prototype.calcNiceExtent = function (opt) {
    intervalScaleProto.calcNiceExtent.call(this, opt);
    this._fixMin = opt.fixMin;
    this._fixMax = opt.fixMax;
  };
  LogScale.prototype.parse = function (val) {
    return val;
  };
  LogScale.prototype.contain = function (val) {
    val = mathLog$1(val) / mathLog$1(this.base);
    return contain$1(val, this._extent);
  };
  LogScale.prototype.normalize = function (val) {
    val = mathLog$1(val) / mathLog$1(this.base);
    return normalize$5(val, this._extent);
  };
  LogScale.prototype.scale = function (val) {
    val = scale(val, this._extent);
    return mathPow$1(this.base, val);
  };
  LogScale.type = 'log';
  return LogScale;
}(Scale$1);
var proto = LogScale.prototype;
proto.getMinorTicks = intervalScaleProto.getMinorTicks;
proto.getLabel = intervalScaleProto.getLabel;
function fixRoundingError(val, originalVal) {
  return roundingErrorFix(val, getPrecision(originalVal));
}
Scale$1.registerClass(LogScale);
var LogScale$1 = LogScale;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ScaleRawExtentInfo = /** @class */function () {
  function ScaleRawExtentInfo(scale, model,
  // Usually: data extent from all series on this axis.
  originalExtent) {
    this._prepareParams(scale, model, originalExtent);
  }
  /**
   * Parameters depending on outside (like model, user callback)
   * are prepared and fixed here.
   */
  ScaleRawExtentInfo.prototype._prepareParams = function (scale, model,
  // Usually: data extent from all series on this axis.
  dataExtent) {
    if (dataExtent[1] < dataExtent[0]) {
      dataExtent = [NaN, NaN];
    }
    this._dataMin = dataExtent[0];
    this._dataMax = dataExtent[1];
    var isOrdinal = this._isOrdinal = scale.type === 'ordinal';
    this._needCrossZero = scale.type === 'interval' && model.getNeedCrossZero && model.getNeedCrossZero();
    var axisMinValue = model.get('min', true);
    if (axisMinValue == null) {
      axisMinValue = model.get('startValue', true);
    }
    var modelMinRaw = this._modelMinRaw = axisMinValue;
    if (isFunction(modelMinRaw)) {
      // This callback always provides users the full data extent (before data is filtered).
      this._modelMinNum = parseAxisModelMinMax(scale, modelMinRaw({
        min: dataExtent[0],
        max: dataExtent[1]
      }));
    } else if (modelMinRaw !== 'dataMin') {
      this._modelMinNum = parseAxisModelMinMax(scale, modelMinRaw);
    }
    var modelMaxRaw = this._modelMaxRaw = model.get('max', true);
    if (isFunction(modelMaxRaw)) {
      // This callback always provides users the full data extent (before data is filtered).
      this._modelMaxNum = parseAxisModelMinMax(scale, modelMaxRaw({
        min: dataExtent[0],
        max: dataExtent[1]
      }));
    } else if (modelMaxRaw !== 'dataMax') {
      this._modelMaxNum = parseAxisModelMinMax(scale, modelMaxRaw);
    }
    if (isOrdinal) {
      // FIXME: there is a flaw here: if there is no "block" data processor like `dataZoom`,
      // and progressive rendering is using, here the category result might just only contain
      // the processed chunk rather than the entire result.
      this._axisDataLen = model.getCategories().length;
    } else {
      var boundaryGap = model.get('boundaryGap');
      var boundaryGapArr = isArray$1(boundaryGap) ? boundaryGap : [boundaryGap || 0, boundaryGap || 0];
      if (typeof boundaryGapArr[0] === 'boolean' || typeof boundaryGapArr[1] === 'boolean') {
        {
          console.warn('Boolean type for boundaryGap is only ' + 'allowed for ordinal axis. Please use string in ' + 'percentage instead, e.g., "20%". Currently, ' + 'boundaryGap is set to be 0.');
        }
        this._boundaryGapInner = [0, 0];
      } else {
        this._boundaryGapInner = [parsePercent$1(boundaryGapArr[0], 1), parsePercent$1(boundaryGapArr[1], 1)];
      }
    }
  };
  /**
   * Calculate extent by prepared parameters.
   * This method has no external dependency and can be called duplicatedly,
   * getting the same result.
   * If parameters changed, should call this method to recalcuate.
   */
  ScaleRawExtentInfo.prototype.calculate = function () {
    // Notice: When min/max is not set (that is, when there are null/undefined,
    // which is the most common case), these cases should be ensured:
    // (1) For 'ordinal', show all axis.data.
    // (2) For others:
    //      + `boundaryGap` is applied (if min/max set, boundaryGap is
    //      disabled).
    //      + If `needCrossZero`, min/max should be zero, otherwise, min/max should
    //      be the result that originalExtent enlarged by boundaryGap.
    // (3) If no data, it should be ensured that `scale.setBlank` is set.
    var isOrdinal = this._isOrdinal;
    var dataMin = this._dataMin;
    var dataMax = this._dataMax;
    var axisDataLen = this._axisDataLen;
    var boundaryGapInner = this._boundaryGapInner;
    var span = !isOrdinal ? dataMax - dataMin || Math.abs(dataMin) : null;
    // Currently if a `'value'` axis model min is specified as 'dataMin'/'dataMax',
    // `boundaryGap` will not be used. It's the different from specifying as `null`/`undefined`.
    var min = this._modelMinRaw === 'dataMin' ? dataMin : this._modelMinNum;
    var max = this._modelMaxRaw === 'dataMax' ? dataMax : this._modelMaxNum;
    // If `_modelMinNum`/`_modelMaxNum` is `null`/`undefined`, should not be fixed.
    var minFixed = min != null;
    var maxFixed = max != null;
    if (min == null) {
      min = isOrdinal ? axisDataLen ? 0 : NaN : dataMin - boundaryGapInner[0] * span;
    }
    if (max == null) {
      max = isOrdinal ? axisDataLen ? axisDataLen - 1 : NaN : dataMax + boundaryGapInner[1] * span;
    }
    (min == null || !isFinite(min)) && (min = NaN);
    (max == null || !isFinite(max)) && (max = NaN);
    var isBlank = eqNaN(min) || eqNaN(max) || isOrdinal && !axisDataLen;
    // If data extent modified, need to recalculated to ensure cross zero.
    if (this._needCrossZero) {
      // Axis is over zero and min is not set
      if (min > 0 && max > 0 && !minFixed) {
        min = 0;
        // minFixed = true;
      }
      // Axis is under zero and max is not set
      if (min < 0 && max < 0 && !maxFixed) {
        max = 0;
        // maxFixed = true;
      }
      // PENDING:
      // When `needCrossZero` and all data is positive/negative, should it be ensured
      // that the results processed by boundaryGap are positive/negative?
      // If so, here `minFixed`/`maxFixed` need to be set.
    }
    var determinedMin = this._determinedMin;
    var determinedMax = this._determinedMax;
    if (determinedMin != null) {
      min = determinedMin;
      minFixed = true;
    }
    if (determinedMax != null) {
      max = determinedMax;
      maxFixed = true;
    }
    // Ensure min/max be finite number or NaN here. (not to be null/undefined)
    // `NaN` means min/max axis is blank.
    return {
      min: min,
      max: max,
      minFixed: minFixed,
      maxFixed: maxFixed,
      isBlank: isBlank
    };
  };
  ScaleRawExtentInfo.prototype.modifyDataMinMax = function (minMaxName, val) {
    {
      assert(!this.frozen);
    }
    this[DATA_MIN_MAX_ATTR[minMaxName]] = val;
  };
  ScaleRawExtentInfo.prototype.setDeterminedMinMax = function (minMaxName, val) {
    var attr = DETERMINED_MIN_MAX_ATTR[minMaxName];
    {
      assert(!this.frozen
      // Earse them usually means logic flaw.
      && this[attr] == null);
    }
    this[attr] = val;
  };
  ScaleRawExtentInfo.prototype.freeze = function () {
    // @ts-ignore
    this.frozen = true;
  };
  return ScaleRawExtentInfo;
}();
var DETERMINED_MIN_MAX_ATTR = {
  min: '_determinedMin',
  max: '_determinedMax'
};
var DATA_MIN_MAX_ATTR = {
  min: '_dataMin',
  max: '_dataMax'
};
/**
 * Get scale min max and related info only depends on model settings.
 * This method can be called after coordinate system created.
 * For example, in data processing stage.
 *
 * Scale extent info probably be required multiple times during a workflow.
 * For example:
 * (1) `dataZoom` depends it to get the axis extent in "100%" state.
 * (2) `processor/extentCalculator` depends it to make sure whether axis extent is specified.
 * (3) `coordSys.update` use it to finally decide the scale extent.
 * But the callback of `min`/`max` should not be called multiple times.
 * The code below should not be implemented repeatedly either.
 * So we cache the result in the scale instance, which will be recreated at the beginning
 * of the workflow (because `scale` instance will be recreated each round of the workflow).
 */
function ensureScaleRawExtentInfo(scale, model,
// Usually: data extent from all series on this axis.
originalExtent) {
  // Do not permit to recreate.
  var rawExtentInfo = scale.rawExtentInfo;
  if (rawExtentInfo) {
    return rawExtentInfo;
  }
  rawExtentInfo = new ScaleRawExtentInfo(scale, model, originalExtent);
  // @ts-ignore
  scale.rawExtentInfo = rawExtentInfo;
  return rawExtentInfo;
}
function parseAxisModelMinMax(scale, minMax) {
  return minMax == null ? null : eqNaN(minMax) ? NaN : scale.parse(minMax);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Get axis scale extent before niced.
 * Item of returned array can only be number (including Infinity and NaN).
 *
 * Caution:
 * Precondition of calling this method:
 * The scale extent has been initialized using series data extent via
 * `scale.setExtent` or `scale.unionExtentFromData`;
 */
function getScaleExtent(scale, model) {
  var scaleType = scale.type;
  var rawExtentResult = ensureScaleRawExtentInfo(scale, model, scale.getExtent()).calculate();
  scale.setBlank(rawExtentResult.isBlank);
  var min = rawExtentResult.min;
  var max = rawExtentResult.max;
  // If bars are placed on a base axis of type time or interval account for axis boundary overflow and current axis
  // is base axis
  // FIXME
  // (1) Consider support value axis, where below zero and axis `onZero` should be handled properly.
  // (2) Refactor the logic with `barGrid`. Is it not need to `makeBarWidthAndOffsetInfo` twice with different extent?
  //     Should not depend on series type `bar`?
  // (3) Fix that might overlap when using dataZoom.
  // (4) Consider other chart types using `barGrid`?
  // See #6728, #4862, `test/bar-overflow-time-plot.html`
  var ecModel = model.ecModel;
  if (ecModel && scaleType === 'time' /* || scaleType === 'interval' */) {
    var barSeriesModels = prepareLayoutBarSeries('bar', ecModel);
    var isBaseAxisAndHasBarSeries_1 = false;
    each$f(barSeriesModels, function (seriesModel) {
      isBaseAxisAndHasBarSeries_1 = isBaseAxisAndHasBarSeries_1 || seriesModel.getBaseAxis() === model.axis;
    });
    if (isBaseAxisAndHasBarSeries_1) {
      // Calculate placement of bars on axis. TODO should be decoupled
      // with barLayout
      var barWidthAndOffset = makeColumnLayout(barSeriesModels);
      // Adjust axis min and max to account for overflow
      var adjustedScale = adjustScaleForOverflow(min, max, model, barWidthAndOffset);
      min = adjustedScale.min;
      max = adjustedScale.max;
    }
  }
  return {
    extent: [min, max],
    // "fix" means "fixed", the value should not be
    // changed in the subsequent steps.
    fixMin: rawExtentResult.minFixed,
    fixMax: rawExtentResult.maxFixed
  };
}
function adjustScaleForOverflow(min, max, model,
// Only support cartesian coord yet.
barWidthAndOffset) {
  // Get Axis Length
  var axisExtent = model.axis.getExtent();
  var axisLength = Math.abs(axisExtent[1] - axisExtent[0]);
  // Get bars on current base axis and calculate min and max overflow
  var barsOnCurrentAxis = retrieveColumnLayout(barWidthAndOffset, model.axis);
  if (barsOnCurrentAxis === undefined) {
    return {
      min: min,
      max: max
    };
  }
  var minOverflow = Infinity;
  each$f(barsOnCurrentAxis, function (item) {
    minOverflow = Math.min(item.offset, minOverflow);
  });
  var maxOverflow = -Infinity;
  each$f(barsOnCurrentAxis, function (item) {
    maxOverflow = Math.max(item.offset + item.width, maxOverflow);
  });
  minOverflow = Math.abs(minOverflow);
  maxOverflow = Math.abs(maxOverflow);
  var totalOverFlow = minOverflow + maxOverflow;
  // Calculate required buffer based on old range and overflow
  var oldRange = max - min;
  var oldRangePercentOfNew = 1 - (minOverflow + maxOverflow) / axisLength;
  var overflowBuffer = oldRange / oldRangePercentOfNew - oldRange;
  max += overflowBuffer * (maxOverflow / totalOverFlow);
  min -= overflowBuffer * (minOverflow / totalOverFlow);
  return {
    min: min,
    max: max
  };
}
// Precondition of calling this method:
// The scale extent has been initialized using series data extent via
// `scale.setExtent` or `scale.unionExtentFromData`;
function niceScaleExtent(scale, inModel) {
  var model = inModel;
  var extentInfo = getScaleExtent(scale, model);
  var extent = extentInfo.extent;
  var splitNumber = model.get('splitNumber');
  if (scale instanceof LogScale$1) {
    scale.base = model.get('logBase');
  }
  var scaleType = scale.type;
  var interval = model.get('interval');
  var isIntervalOrTime = scaleType === 'interval' || scaleType === 'time';
  scale.setExtent(extent[0], extent[1]);
  scale.calcNiceExtent({
    splitNumber: splitNumber,
    fixMin: extentInfo.fixMin,
    fixMax: extentInfo.fixMax,
    minInterval: isIntervalOrTime ? model.get('minInterval') : null,
    maxInterval: isIntervalOrTime ? model.get('maxInterval') : null
  });
  // If some one specified the min, max. And the default calculated interval
  // is not good enough. He can specify the interval. It is often appeared
  // in angle axis with angle 0 - 360. Interval calculated in interval scale is hard
  // to be 60.
  // FIXME
  if (interval != null) {
    scale.setInterval && scale.setInterval(interval);
  }
}
/**
 * @param axisType Default retrieve from model.type
 */
function createScaleByModel$1(model, axisType) {
  axisType = axisType || model.get('type');
  if (axisType) {
    switch (axisType) {
      // Buildin scale
      case 'category':
        return new OrdinalScale$1({
          ordinalMeta: model.getOrdinalMeta ? model.getOrdinalMeta() : model.getCategories(),
          extent: [Infinity, -Infinity]
        });
      case 'time':
        return new TimeScale$1({
          locale: model.ecModel.getLocaleModel(),
          useUTC: model.ecModel.get('useUTC')
        });
      default:
        // case 'value'/'interval', 'log', or others.
        return new (Scale$1.getClass(axisType) || IntervalScale$1)();
    }
  }
}
/**
 * Check if the axis cross 0
 */
function ifAxisCrossZero(axis) {
  var dataExtent = axis.scale.getExtent();
  var min = dataExtent[0];
  var max = dataExtent[1];
  return !(min > 0 && max > 0 || min < 0 && max < 0);
}
/**
 * @param axis
 * @return Label formatter function.
 *         param: {number} tickValue,
 *         param: {number} idx, the index in all ticks.
 *                         If category axis, this param is not required.
 *         return: {string} label string.
 */
function makeLabelFormatter(axis) {
  var labelFormatter = axis.getLabelModel().get('formatter');
  var categoryTickStart = axis.type === 'category' ? axis.scale.getExtent()[0] : null;
  if (axis.scale.type === 'time') {
    return function (tpl) {
      return function (tick, idx) {
        return axis.scale.getFormattedLabel(tick, idx, tpl);
      };
    }(labelFormatter);
  } else if (isString(labelFormatter)) {
    return function (tpl) {
      return function (tick) {
        // For category axis, get raw value; for numeric axis,
        // get formatted label like '1,333,444'.
        var label = axis.scale.getLabel(tick);
        var text = tpl.replace('{value}', label != null ? label : '');
        return text;
      };
    }(labelFormatter);
  } else if (isFunction(labelFormatter)) {
    return function (cb) {
      return function (tick, idx) {
        // The original intention of `idx` is "the index of the tick in all ticks".
        // But the previous implementation of category axis do not consider the
        // `axisLabel.interval`, which cause that, for example, the `interval` is
        // `1`, then the ticks "name5", "name7", "name9" are displayed, where the
        // corresponding `idx` are `0`, `2`, `4`, but not `0`, `1`, `2`. So we keep
        // the definition here for back compatibility.
        if (categoryTickStart != null) {
          idx = tick.value - categoryTickStart;
        }
        return cb(getAxisRawValue(axis, tick), idx, tick.level != null ? {
          level: tick.level
        } : null);
      };
    }(labelFormatter);
  } else {
    return function (tick) {
      return axis.scale.getLabel(tick);
    };
  }
}
function getAxisRawValue(axis, tick) {
  // In category axis with data zoom, tick is not the original
  // index of axis.data. So tick should not be exposed to user
  // in category axis.
  return axis.type === 'category' ? axis.scale.getLabel(tick) : tick.value;
}
/**
 * @param axis
 * @return Be null/undefined if no labels.
 */
function estimateLabelUnionRect(axis) {
  var axisModel = axis.model;
  var scale = axis.scale;
  if (!axisModel.get(['axisLabel', 'show']) || scale.isBlank()) {
    return;
  }
  var realNumberScaleTicks;
  var tickCount;
  var categoryScaleExtent = scale.getExtent();
  // Optimize for large category data, avoid call `getTicks()`.
  if (scale instanceof OrdinalScale$1) {
    tickCount = scale.count();
  } else {
    realNumberScaleTicks = scale.getTicks();
    tickCount = realNumberScaleTicks.length;
  }
  var axisLabelModel = axis.getLabelModel();
  var labelFormatter = makeLabelFormatter(axis);
  var rect;
  var step = 1;
  // Simple optimization for large amount of labels
  if (tickCount > 40) {
    step = Math.ceil(tickCount / 40);
  }
  for (var i = 0; i < tickCount; i += step) {
    var tick = realNumberScaleTicks ? realNumberScaleTicks[i] : {
      value: categoryScaleExtent[0] + i
    };
    var label = labelFormatter(tick, i);
    var unrotatedSingleRect = axisLabelModel.getTextRect(label);
    var singleRect = rotateTextRect(unrotatedSingleRect, axisLabelModel.get('rotate') || 0);
    rect ? rect.union(singleRect) : rect = singleRect;
  }
  return rect;
}
function rotateTextRect(textRect, rotate) {
  var rotateRadians = rotate * Math.PI / 180;
  var beforeWidth = textRect.width;
  var beforeHeight = textRect.height;
  var afterWidth = beforeWidth * Math.abs(Math.cos(rotateRadians)) + Math.abs(beforeHeight * Math.sin(rotateRadians));
  var afterHeight = beforeWidth * Math.abs(Math.sin(rotateRadians)) + Math.abs(beforeHeight * Math.cos(rotateRadians));
  var rotatedRect = new BoundingRect$1(textRect.x, textRect.y, afterWidth, afterHeight);
  return rotatedRect;
}
/**
 * @param model axisLabelModel or axisTickModel
 * @return {number|String} Can be null|'auto'|number|function
 */
function getOptionCategoryInterval(model) {
  var interval = model.get('interval');
  return interval == null ? 'auto' : interval;
}
/**
 * Set `categoryInterval` as 0 implicitly indicates that
 * show all labels regardless of overlap.
 * @param {Object} axis axisModel.axis
 */
function shouldShowAllLabels(axis) {
  return axis.type === 'category' && getOptionCategoryInterval(axis.getLabelModel()) === 0;
}
function getDataDimensionsOnAxis(data, axisDim) {
  // Remove duplicated dat dimensions caused by `getStackedDimension`.
  var dataDimMap = {};
  // Currently `mapDimensionsAll` will contain stack result dimension ('__\0ecstackresult').
  // PENDING: is it reasonable? Do we need to remove the original dim from "coord dim" since
  // there has been stacked result dim?
  each$f(data.mapDimensionsAll(axisDim), function (dataDim) {
    // For example, the extent of the original dimension
    // is [0.1, 0.5], the extent of the `stackResultDimension`
    // is [7, 9], the final extent should NOT include [0.1, 0.5],
    // because there is no graphic corresponding to [0.1, 0.5].
    // See the case in `test/area-stack.html` `main1`, where area line
    // stack needs `yAxis` not start from 0.
    dataDimMap[getStackedDimension(data, dataDim)] = true;
  });
  return keys(dataDimMap);
}
function unionAxisExtentFromData(dataExtent, data, axisDim) {
  if (data) {
    each$f(getDataDimensionsOnAxis(data, axisDim), function (dim) {
      var seriesExtent = data.getApproximateExtent(dim);
      seriesExtent[0] < dataExtent[0] && (dataExtent[0] = seriesExtent[0]);
      seriesExtent[1] > dataExtent[1] && (dataExtent[1] = seriesExtent[1]);
    });
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var AxisModelCommonMixin = /** @class */function () {
  function AxisModelCommonMixin() {}
  AxisModelCommonMixin.prototype.getNeedCrossZero = function () {
    var option = this.option;
    return !option.scale;
  };
  /**
   * Should be implemented by each axis model if necessary.
   * @return coordinate system model
   */
  AxisModelCommonMixin.prototype.getCoordSysModel = function () {
    return;
  };
  return AxisModelCommonMixin;
}();

var EPSILON = 1e-8;
function isAroundEqual(a, b) {
  return Math.abs(a - b) < EPSILON;
}
function contain(points, x, y) {
  var w = 0;
  var p = points[0];
  if (!p) {
    return false;
  }
  for (var i = 1; i < points.length; i++) {
    var p2 = points[i];
    w += windingLine(p[0], p[1], p2[0], p2[1], x, y);
    p = p2;
  }
  var p0 = points[0];
  if (!isAroundEqual(p[0], p0[0]) || !isAroundEqual(p[1], p0[1])) {
    w += windingLine(p[0], p[1], p0[0], p0[1], x, y);
  }
  return w !== 0;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TMP_TRANSFORM = [];
function transformPoints(points, transform) {
  for (var p = 0; p < points.length; p++) {
    applyTransform$1(points[p], points[p], transform);
  }
}
function updateBBoxFromPoints(points, min, max, projection) {
  for (var i = 0; i < points.length; i++) {
    var p = points[i];
    if (projection) {
      // projection may return null point.
      p = projection.project(p);
    }
    if (p && isFinite(p[0]) && isFinite(p[1])) {
      min$3(min, min, p);
      max$4(max, max, p);
    }
  }
}
function centroid$1(points) {
  var signedArea = 0;
  var cx = 0;
  var cy = 0;
  var len = points.length;
  var x0 = points[len - 1][0];
  var y0 = points[len - 1][1];
  // Polygon should been closed.
  for (var i = 0; i < len; i++) {
    var x1 = points[i][0];
    var y1 = points[i][1];
    var a = x0 * y1 - x1 * y0;
    signedArea += a;
    cx += (x0 + x1) * a;
    cy += (y0 + y1) * a;
    x0 = x1;
    y0 = y1;
  }
  return signedArea ? [cx / signedArea / 3, cy / signedArea / 3, signedArea] : [points[0][0] || 0, points[0][1] || 0];
}
var Region = /** @class */function () {
  function Region(name) {
    this.name = name;
  }
  Region.prototype.setCenter = function (center) {
    this._center = center;
  };
  /**
   * Get center point in data unit. That is,
   * for GeoJSONRegion, the unit is lat/lng,
   * for GeoSVGRegion, the unit is SVG local coord.
   */
  Region.prototype.getCenter = function () {
    var center = this._center;
    if (!center) {
      // In most cases there are no need to calculate this center.
      // So calculate only when called.
      center = this._center = this.calcCenter();
    }
    return center;
  };
  return Region;
}();
var GeoJSONPolygonGeometry = /** @class */function () {
  function GeoJSONPolygonGeometry(exterior, interiors) {
    this.type = 'polygon';
    this.exterior = exterior;
    this.interiors = interiors;
  }
  return GeoJSONPolygonGeometry;
}();
var GeoJSONLineStringGeometry = /** @class */function () {
  function GeoJSONLineStringGeometry(points) {
    this.type = 'linestring';
    this.points = points;
  }
  return GeoJSONLineStringGeometry;
}();
var GeoJSONRegion = /** @class */function (_super) {
  __extends(GeoJSONRegion, _super);
  function GeoJSONRegion(name, geometries, cp) {
    var _this = _super.call(this, name) || this;
    _this.type = 'geoJSON';
    _this.geometries = geometries;
    _this._center = cp && [cp[0], cp[1]];
    return _this;
  }
  GeoJSONRegion.prototype.calcCenter = function () {
    var geometries = this.geometries;
    var largestGeo;
    var largestGeoSize = 0;
    for (var i = 0; i < geometries.length; i++) {
      var geo = geometries[i];
      var exterior = geo.exterior;
      // Simple trick to use points count instead of polygon area as region size.
      // Ignore linestring
      var size = exterior && exterior.length;
      if (size > largestGeoSize) {
        largestGeo = geo;
        largestGeoSize = size;
      }
    }
    if (largestGeo) {
      return centroid$1(largestGeo.exterior);
    }
    // from bounding rect by default.
    var rect = this.getBoundingRect();
    return [rect.x + rect.width / 2, rect.y + rect.height / 2];
  };
  GeoJSONRegion.prototype.getBoundingRect = function (projection) {
    var rect = this._rect;
    // Always recalculate if using projection.
    if (rect && !projection) {
      return rect;
    }
    var min = [Infinity, Infinity];
    var max = [-Infinity, -Infinity];
    var geometries = this.geometries;
    each$f(geometries, function (geo) {
      if (geo.type === 'polygon') {
        // Doesn't consider hole
        updateBBoxFromPoints(geo.exterior, min, max, projection);
      } else {
        each$f(geo.points, function (points) {
          updateBBoxFromPoints(points, min, max, projection);
        });
      }
    });
    // Normalie invalid bounding.
    if (!(isFinite(min[0]) && isFinite(min[1]) && isFinite(max[0]) && isFinite(max[1]))) {
      min[0] = min[1] = max[0] = max[1] = 0;
    }
    rect = new BoundingRect$1(min[0], min[1], max[0] - min[0], max[1] - min[1]);
    if (!projection) {
      this._rect = rect;
    }
    return rect;
  };
  GeoJSONRegion.prototype.contain = function (coord) {
    var rect = this.getBoundingRect();
    var geometries = this.geometries;
    if (!rect.contain(coord[0], coord[1])) {
      return false;
    }
    loopGeo: for (var i = 0, len = geometries.length; i < len; i++) {
      var geo = geometries[i];
      // Only support polygon.
      if (geo.type !== 'polygon') {
        continue;
      }
      var exterior = geo.exterior;
      var interiors = geo.interiors;
      if (contain(exterior, coord[0], coord[1])) {
        // Not in the region if point is in the hole.
        for (var k = 0; k < (interiors ? interiors.length : 0); k++) {
          if (contain(interiors[k], coord[0], coord[1])) {
            continue loopGeo;
          }
        }
        return true;
      }
    }
    return false;
  };
  /**
   * Transform the raw coords to target bounding.
   * @param x
   * @param y
   * @param width
   * @param height
   */
  GeoJSONRegion.prototype.transformTo = function (x, y, width, height) {
    var rect = this.getBoundingRect();
    var aspect = rect.width / rect.height;
    if (!width) {
      width = aspect * height;
    } else if (!height) {
      height = width / aspect;
    }
    var target = new BoundingRect$1(x, y, width, height);
    var transform = rect.calculateTransform(target);
    var geometries = this.geometries;
    for (var i = 0; i < geometries.length; i++) {
      var geo = geometries[i];
      if (geo.type === 'polygon') {
        transformPoints(geo.exterior, transform);
        each$f(geo.interiors, function (interior) {
          transformPoints(interior, transform);
        });
      } else {
        each$f(geo.points, function (points) {
          transformPoints(points, transform);
        });
      }
    }
    rect = this._rect;
    rect.copy(target);
    // Update center
    this._center = [rect.x + rect.width / 2, rect.y + rect.height / 2];
  };
  GeoJSONRegion.prototype.cloneShallow = function (name) {
    name == null && (name = this.name);
    var newRegion = new GeoJSONRegion(name, this.geometries, this._center);
    newRegion._rect = this._rect;
    newRegion.transformTo = null; // Simply avoid to be called.
    return newRegion;
  };
  return GeoJSONRegion;
}(Region);
var GeoSVGRegion = /** @class */function (_super) {
  __extends(GeoSVGRegion, _super);
  function GeoSVGRegion(name, elOnlyForCalculate) {
    var _this = _super.call(this, name) || this;
    _this.type = 'geoSVG';
    _this._elOnlyForCalculate = elOnlyForCalculate;
    return _this;
  }
  GeoSVGRegion.prototype.calcCenter = function () {
    var el = this._elOnlyForCalculate;
    var rect = el.getBoundingRect();
    var center = [rect.x + rect.width / 2, rect.y + rect.height / 2];
    var mat = identity(TMP_TRANSFORM);
    var target = el;
    while (target && !target.isGeoSVGGraphicRoot) {
      mul$1(mat, target.getLocalTransform(), mat);
      target = target.parent;
    }
    invert(mat, mat);
    applyTransform$1(center, center, mat);
    return center;
  };
  return GeoSVGRegion;
}(Region);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function decode(json) {
  if (!json.UTF8Encoding) {
    return json;
  }
  var jsonCompressed = json;
  var encodeScale = jsonCompressed.UTF8Scale;
  if (encodeScale == null) {
    encodeScale = 1024;
  }
  var features = jsonCompressed.features;
  each$f(features, function (feature) {
    var geometry = feature.geometry;
    var encodeOffsets = geometry.encodeOffsets;
    var coordinates = geometry.coordinates;
    // Geometry may be appeded manually in the script after json loaded.
    // In this case this geometry is usually not encoded.
    if (!encodeOffsets) {
      return;
    }
    switch (geometry.type) {
      case 'LineString':
        geometry.coordinates = decodeRing(coordinates, encodeOffsets, encodeScale);
        break;
      case 'Polygon':
        decodeRings(coordinates, encodeOffsets, encodeScale);
        break;
      case 'MultiLineString':
        decodeRings(coordinates, encodeOffsets, encodeScale);
        break;
      case 'MultiPolygon':
        each$f(coordinates, function (rings, idx) {
          return decodeRings(rings, encodeOffsets[idx], encodeScale);
        });
    }
  });
  // Has been decoded
  jsonCompressed.UTF8Encoding = false;
  return jsonCompressed;
}
function decodeRings(rings, encodeOffsets, encodeScale) {
  for (var c = 0; c < rings.length; c++) {
    rings[c] = decodeRing(rings[c], encodeOffsets[c], encodeScale);
  }
}
function decodeRing(coordinate, encodeOffsets, encodeScale) {
  var result = [];
  var prevX = encodeOffsets[0];
  var prevY = encodeOffsets[1];
  for (var i = 0; i < coordinate.length; i += 2) {
    var x = coordinate.charCodeAt(i) - 64;
    var y = coordinate.charCodeAt(i + 1) - 64;
    // ZigZag decoding
    x = x >> 1 ^ -(x & 1);
    y = y >> 1 ^ -(y & 1);
    // Delta deocding
    x += prevX;
    y += prevY;
    prevX = x;
    prevY = y;
    // Dequantize
    result.push([x / encodeScale, y / encodeScale]);
  }
  return result;
}
function parseGeoJSON(geoJson, nameProperty) {
  geoJson = decode(geoJson);
  return map$1(filter(geoJson.features, function (featureObj) {
    // Output of mapshaper may have geometry null
    return featureObj.geometry && featureObj.properties && featureObj.geometry.coordinates.length > 0;
  }), function (featureObj) {
    var properties = featureObj.properties;
    var geo = featureObj.geometry;
    var geometries = [];
    switch (geo.type) {
      case 'Polygon':
        var coordinates = geo.coordinates;
        // According to the GeoJSON specification.
        // First must be exterior, and the rest are all interior(holes).
        geometries.push(new GeoJSONPolygonGeometry(coordinates[0], coordinates.slice(1)));
        break;
      case 'MultiPolygon':
        each$f(geo.coordinates, function (item) {
          if (item[0]) {
            geometries.push(new GeoJSONPolygonGeometry(item[0], item.slice(1)));
          }
        });
        break;
      case 'LineString':
        geometries.push(new GeoJSONLineStringGeometry([geo.coordinates]));
        break;
      case 'MultiLineString':
        geometries.push(new GeoJSONLineStringGeometry(geo.coordinates));
    }
    var region = new GeoJSONRegion(properties[nameProperty || 'name'], geometries, properties.cp);
    region.properties = properties;
    return region;
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$g = makeInner();
function tickValuesToNumbers(axis, values) {
  var nums = map$1(values, function (val) {
    return axis.scale.parse(val);
  });
  if (axis.type === 'time' && nums.length > 0) {
    // Time axis needs duplicate first/last tick (see TimeScale.getTicks())
    // The first and last tick/label don't get drawn
    nums.sort();
    nums.unshift(nums[0]);
    nums.push(nums[nums.length - 1]);
  }
  return nums;
}
function createAxisLabels(axis) {
  var custom = axis.getLabelModel().get('customValues');
  if (custom) {
    var labelFormatter_1 = makeLabelFormatter(axis);
    var extent_1 = axis.scale.getExtent();
    var tickNumbers = tickValuesToNumbers(axis, custom);
    var ticks = filter(tickNumbers, function (val) {
      return val >= extent_1[0] && val <= extent_1[1];
    });
    return {
      labels: map$1(ticks, function (numval) {
        var tick = {
          value: numval
        };
        return {
          formattedLabel: labelFormatter_1(tick),
          rawLabel: axis.scale.getLabel(tick),
          tickValue: numval
        };
      })
    };
  }
  // Only ordinal scale support tick interval
  return axis.type === 'category' ? makeCategoryLabels(axis) : makeRealNumberLabels(axis);
}
/**
 * @param {module:echats/coord/Axis} axis
 * @param {module:echarts/model/Model} tickModel For example, can be axisTick, splitLine, splitArea.
 * @return {Object} {
 *     ticks: Array.<number>
 *     tickCategoryInterval: number
 * }
 */
function createAxisTicks(axis, tickModel) {
  var custom = axis.getTickModel().get('customValues');
  if (custom) {
    var extent_2 = axis.scale.getExtent();
    var tickNumbers = tickValuesToNumbers(axis, custom);
    return {
      ticks: filter(tickNumbers, function (val) {
        return val >= extent_2[0] && val <= extent_2[1];
      })
    };
  }
  // Only ordinal scale support tick interval
  return axis.type === 'category' ? makeCategoryTicks(axis, tickModel) : {
    ticks: map$1(axis.scale.getTicks(), function (tick) {
      return tick.value;
    })
  };
}
function makeCategoryLabels(axis) {
  var labelModel = axis.getLabelModel();
  var result = makeCategoryLabelsActually(axis, labelModel);
  return !labelModel.get('show') || axis.scale.isBlank() ? {
    labels: [],
    labelCategoryInterval: result.labelCategoryInterval
  } : result;
}
function makeCategoryLabelsActually(axis, labelModel) {
  var labelsCache = getListCache(axis, 'labels');
  var optionLabelInterval = getOptionCategoryInterval(labelModel);
  var result = listCacheGet(labelsCache, optionLabelInterval);
  if (result) {
    return result;
  }
  var labels;
  var numericLabelInterval;
  if (isFunction(optionLabelInterval)) {
    labels = makeLabelsByCustomizedCategoryInterval(axis, optionLabelInterval);
  } else {
    numericLabelInterval = optionLabelInterval === 'auto' ? makeAutoCategoryInterval(axis) : optionLabelInterval;
    labels = makeLabelsByNumericCategoryInterval(axis, numericLabelInterval);
  }
  // Cache to avoid calling interval function repeatedly.
  return listCacheSet(labelsCache, optionLabelInterval, {
    labels: labels,
    labelCategoryInterval: numericLabelInterval
  });
}
function makeCategoryTicks(axis, tickModel) {
  var ticksCache = getListCache(axis, 'ticks');
  var optionTickInterval = getOptionCategoryInterval(tickModel);
  var result = listCacheGet(ticksCache, optionTickInterval);
  if (result) {
    return result;
  }
  var ticks;
  var tickCategoryInterval;
  // Optimize for the case that large category data and no label displayed,
  // we should not return all ticks.
  if (!tickModel.get('show') || axis.scale.isBlank()) {
    ticks = [];
  }
  if (isFunction(optionTickInterval)) {
    ticks = makeLabelsByCustomizedCategoryInterval(axis, optionTickInterval, true);
  }
  // Always use label interval by default despite label show. Consider this
  // scenario, Use multiple grid with the xAxis sync, and only one xAxis shows
  // labels. `splitLine` and `axisTick` should be consistent in this case.
  else if (optionTickInterval === 'auto') {
    var labelsResult = makeCategoryLabelsActually(axis, axis.getLabelModel());
    tickCategoryInterval = labelsResult.labelCategoryInterval;
    ticks = map$1(labelsResult.labels, function (labelItem) {
      return labelItem.tickValue;
    });
  } else {
    tickCategoryInterval = optionTickInterval;
    ticks = makeLabelsByNumericCategoryInterval(axis, tickCategoryInterval, true);
  }
  // Cache to avoid calling interval function repeatedly.
  return listCacheSet(ticksCache, optionTickInterval, {
    ticks: ticks,
    tickCategoryInterval: tickCategoryInterval
  });
}
function makeRealNumberLabels(axis) {
  var ticks = axis.scale.getTicks();
  var labelFormatter = makeLabelFormatter(axis);
  return {
    labels: map$1(ticks, function (tick, idx) {
      return {
        level: tick.level,
        formattedLabel: labelFormatter(tick, idx),
        rawLabel: axis.scale.getLabel(tick),
        tickValue: tick.value
      };
    })
  };
}
function getListCache(axis, prop) {
  // Because key can be a function, and cache size always is small, we use array cache.
  return inner$g(axis)[prop] || (inner$g(axis)[prop] = []);
}
function listCacheGet(cache, key) {
  for (var i = 0; i < cache.length; i++) {
    if (cache[i].key === key) {
      return cache[i].value;
    }
  }
}
function listCacheSet(cache, key, value) {
  cache.push({
    key: key,
    value: value
  });
  return value;
}
function makeAutoCategoryInterval(axis) {
  var result = inner$g(axis).autoInterval;
  return result != null ? result : inner$g(axis).autoInterval = axis.calculateCategoryInterval();
}
/**
 * Calculate interval for category axis ticks and labels.
 * To get precise result, at least one of `getRotate` and `isHorizontal`
 * should be implemented in axis.
 */
function calculateCategoryInterval(axis) {
  var params = fetchAutoCategoryIntervalCalculationParams(axis);
  var labelFormatter = makeLabelFormatter(axis);
  var rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;
  var ordinalScale = axis.scale;
  var ordinalExtent = ordinalScale.getExtent();
  // Providing this method is for optimization:
  // avoid generating a long array by `getTicks`
  // in large category data case.
  var tickCount = ordinalScale.count();
  if (ordinalExtent[1] - ordinalExtent[0] < 1) {
    return 0;
  }
  var step = 1;
  // Simple optimization. Empirical value: tick count should less than 40.
  if (tickCount > 40) {
    step = Math.max(1, Math.floor(tickCount / 40));
  }
  var tickValue = ordinalExtent[0];
  var unitSpan = axis.dataToCoord(tickValue + 1) - axis.dataToCoord(tickValue);
  var unitW = Math.abs(unitSpan * Math.cos(rotation));
  var unitH = Math.abs(unitSpan * Math.sin(rotation));
  var maxW = 0;
  var maxH = 0;
  // Caution: Performance sensitive for large category data.
  // Consider dataZoom, we should make appropriate step to avoid O(n) loop.
  for (; tickValue <= ordinalExtent[1]; tickValue += step) {
    var width = 0;
    var height = 0;
    // Not precise, do not consider align and vertical align
    // and each distance from axis line yet.
    var rect = getBoundingRect(labelFormatter({
      value: tickValue
    }), params.font, 'center', 'top');
    // Magic number
    width = rect.width * 1.3;
    height = rect.height * 1.3;
    // Min size, void long loop.
    maxW = Math.max(maxW, width, 7);
    maxH = Math.max(maxH, height, 7);
  }
  var dw = maxW / unitW;
  var dh = maxH / unitH;
  // 0/0 is NaN, 1/0 is Infinity.
  isNaN(dw) && (dw = Infinity);
  isNaN(dh) && (dh = Infinity);
  var interval = Math.max(0, Math.floor(Math.min(dw, dh)));
  var cache = inner$g(axis.model);
  var axisExtent = axis.getExtent();
  var lastAutoInterval = cache.lastAutoInterval;
  var lastTickCount = cache.lastTickCount;
  // Use cache to keep interval stable while moving zoom window,
  // otherwise the calculated interval might jitter when the zoom
  // window size is close to the interval-changing size.
  // For example, if all of the axis labels are `a, b, c, d, e, f, g`.
  // The jitter will cause that sometimes the displayed labels are
  // `a, d, g` (interval: 2) sometimes `a, c, e`(interval: 1).
  if (lastAutoInterval != null && lastTickCount != null && Math.abs(lastAutoInterval - interval) <= 1 && Math.abs(lastTickCount - tickCount) <= 1
  // Always choose the bigger one, otherwise the critical
  // point is not the same when zooming in or zooming out.
  && lastAutoInterval > interval
  // If the axis change is caused by chart resize, the cache should not
  // be used. Otherwise some hidden labels might not be shown again.
  && cache.axisExtent0 === axisExtent[0] && cache.axisExtent1 === axisExtent[1]) {
    interval = lastAutoInterval;
  }
  // Only update cache if cache not used, otherwise the
  // changing of interval is too insensitive.
  else {
    cache.lastTickCount = tickCount;
    cache.lastAutoInterval = interval;
    cache.axisExtent0 = axisExtent[0];
    cache.axisExtent1 = axisExtent[1];
  }
  return interval;
}
function fetchAutoCategoryIntervalCalculationParams(axis) {
  var labelModel = axis.getLabelModel();
  return {
    axisRotate: axis.getRotate ? axis.getRotate() : axis.isHorizontal && !axis.isHorizontal() ? 90 : 0,
    labelRotate: labelModel.get('rotate') || 0,
    font: labelModel.getFont()
  };
}
function makeLabelsByNumericCategoryInterval(axis, categoryInterval, onlyTick) {
  var labelFormatter = makeLabelFormatter(axis);
  var ordinalScale = axis.scale;
  var ordinalExtent = ordinalScale.getExtent();
  var labelModel = axis.getLabelModel();
  var result = [];
  // TODO: axisType: ordinalTime, pick the tick from each month/day/year/...
  var step = Math.max((categoryInterval || 0) + 1, 1);
  var startTick = ordinalExtent[0];
  var tickCount = ordinalScale.count();
  // Calculate start tick based on zero if possible to keep label consistent
  // while zooming and moving while interval > 0. Otherwise the selection
  // of displayable ticks and symbols probably keep changing.
  // 3 is empirical value.
  if (startTick !== 0 && step > 1 && tickCount / step > 2) {
    startTick = Math.round(Math.ceil(startTick / step) * step);
  }
  // (1) Only add min max label here but leave overlap checking
  // to render stage, which also ensure the returned list
  // suitable for splitLine and splitArea rendering.
  // (2) Scales except category always contain min max label so
  // do not need to perform this process.
  var showAllLabel = shouldShowAllLabels(axis);
  var includeMinLabel = labelModel.get('showMinLabel') || showAllLabel;
  var includeMaxLabel = labelModel.get('showMaxLabel') || showAllLabel;
  if (includeMinLabel && startTick !== ordinalExtent[0]) {
    addItem(ordinalExtent[0]);
  }
  // Optimize: avoid generating large array by `ordinalScale.getTicks()`.
  var tickValue = startTick;
  for (; tickValue <= ordinalExtent[1]; tickValue += step) {
    addItem(tickValue);
  }
  if (includeMaxLabel && tickValue - step !== ordinalExtent[1]) {
    addItem(ordinalExtent[1]);
  }
  function addItem(tickValue) {
    var tickObj = {
      value: tickValue
    };
    result.push(onlyTick ? tickValue : {
      formattedLabel: labelFormatter(tickObj),
      rawLabel: ordinalScale.getLabel(tickObj),
      tickValue: tickValue
    });
  }
  return result;
}
function makeLabelsByCustomizedCategoryInterval(axis, categoryInterval, onlyTick) {
  var ordinalScale = axis.scale;
  var labelFormatter = makeLabelFormatter(axis);
  var result = [];
  each$f(ordinalScale.getTicks(), function (tick) {
    var rawLabel = ordinalScale.getLabel(tick);
    var tickValue = tick.value;
    if (categoryInterval(tick.value, rawLabel)) {
      result.push(onlyTick ? tickValue : {
        formattedLabel: labelFormatter(tick),
        rawLabel: rawLabel,
        tickValue: tickValue
      });
    }
  });
  return result;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var NORMALIZED_EXTENT = [0, 1];
/**
 * Base class of Axis.
 */
var Axis = /** @class */function () {
  function Axis(dim, scale, extent) {
    this.onBand = false;
    this.inverse = false;
    this.dim = dim;
    this.scale = scale;
    this._extent = extent || [0, 0];
  }
  /**
   * If axis extent contain given coord
   */
  Axis.prototype.contain = function (coord) {
    var extent = this._extent;
    var min = Math.min(extent[0], extent[1]);
    var max = Math.max(extent[0], extent[1]);
    return coord >= min && coord <= max;
  };
  /**
   * If axis extent contain given data
   */
  Axis.prototype.containData = function (data) {
    return this.scale.contain(data);
  };
  /**
   * Get coord extent.
   */
  Axis.prototype.getExtent = function () {
    return this._extent.slice();
  };
  /**
   * Get precision used for formatting
   */
  Axis.prototype.getPixelPrecision = function (dataExtent) {
    return getPixelPrecision(dataExtent || this.scale.getExtent(), this._extent);
  };
  /**
   * Set coord extent
   */
  Axis.prototype.setExtent = function (start, end) {
    var extent = this._extent;
    extent[0] = start;
    extent[1] = end;
  };
  /**
   * Convert data to coord. Data is the rank if it has an ordinal scale
   */
  Axis.prototype.dataToCoord = function (data, clamp) {
    var extent = this._extent;
    var scale = this.scale;
    data = scale.normalize(data);
    if (this.onBand && scale.type === 'ordinal') {
      extent = extent.slice();
      fixExtentWithBands(extent, scale.count());
    }
    return linearMap$2(data, NORMALIZED_EXTENT, extent, clamp);
  };
  /**
   * Convert coord to data. Data is the rank if it has an ordinal scale
   */
  Axis.prototype.coordToData = function (coord, clamp) {
    var extent = this._extent;
    var scale = this.scale;
    if (this.onBand && scale.type === 'ordinal') {
      extent = extent.slice();
      fixExtentWithBands(extent, scale.count());
    }
    var t = linearMap$2(coord, extent, NORMALIZED_EXTENT, clamp);
    return this.scale.scale(t);
  };
  /**
   * Convert pixel point to data in axis
   */
  Axis.prototype.pointToData = function (point, clamp) {
    // Should be implemented in derived class if necessary.
    return;
  };
  /**
   * Different from `zrUtil.map(axis.getTicks(), axis.dataToCoord, axis)`,
   * `axis.getTicksCoords` considers `onBand`, which is used by
   * `boundaryGap:true` of category axis and splitLine and splitArea.
   * @param opt.tickModel default: axis.model.getModel('axisTick')
   * @param opt.clamp If `true`, the first and the last
   *        tick must be at the axis end points. Otherwise, clip ticks
   *        that outside the axis extent.
   */
  Axis.prototype.getTicksCoords = function (opt) {
    opt = opt || {};
    var tickModel = opt.tickModel || this.getTickModel();
    var result = createAxisTicks(this, tickModel);
    var ticks = result.ticks;
    var ticksCoords = map$1(ticks, function (tickVal) {
      return {
        coord: this.dataToCoord(this.scale.type === 'ordinal' ? this.scale.getRawOrdinalNumber(tickVal) : tickVal),
        tickValue: tickVal
      };
    }, this);
    var alignWithLabel = tickModel.get('alignWithLabel');
    fixOnBandTicksCoords(this, ticksCoords, alignWithLabel, opt.clamp);
    return ticksCoords;
  };
  Axis.prototype.getMinorTicksCoords = function () {
    if (this.scale.type === 'ordinal') {
      // Category axis doesn't support minor ticks
      return [];
    }
    var minorTickModel = this.model.getModel('minorTick');
    var splitNumber = minorTickModel.get('splitNumber');
    // Protection.
    if (!(splitNumber > 0 && splitNumber < 100)) {
      splitNumber = 5;
    }
    var minorTicks = this.scale.getMinorTicks(splitNumber);
    var minorTicksCoords = map$1(minorTicks, function (minorTicksGroup) {
      return map$1(minorTicksGroup, function (minorTick) {
        return {
          coord: this.dataToCoord(minorTick),
          tickValue: minorTick
        };
      }, this);
    }, this);
    return minorTicksCoords;
  };
  Axis.prototype.getViewLabels = function () {
    return createAxisLabels(this).labels;
  };
  Axis.prototype.getLabelModel = function () {
    return this.model.getModel('axisLabel');
  };
  /**
   * Notice here we only get the default tick model. For splitLine
   * or splitArea, we should pass the splitLineModel or splitAreaModel
   * manually when calling `getTicksCoords`.
   * In GL, this method may be overridden to:
   * `axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));`
   */
  Axis.prototype.getTickModel = function () {
    return this.model.getModel('axisTick');
  };
  /**
   * Get width of band
   */
  Axis.prototype.getBandWidth = function () {
    var axisExtent = this._extent;
    var dataExtent = this.scale.getExtent();
    var len = dataExtent[1] - dataExtent[0] + (this.onBand ? 1 : 0);
    // Fix #2728, avoid NaN when only one data.
    len === 0 && (len = 1);
    var size = Math.abs(axisExtent[1] - axisExtent[0]);
    return Math.abs(size) / len;
  };
  /**
   * Only be called in category axis.
   * Can be overridden, consider other axes like in 3D.
   * @return Auto interval for cateogry axis tick and label
   */
  Axis.prototype.calculateCategoryInterval = function () {
    return calculateCategoryInterval(this);
  };
  return Axis;
}();
function fixExtentWithBands(extent, nTick) {
  var size = extent[1] - extent[0];
  var len = nTick;
  var margin = size / len / 2;
  extent[0] += margin;
  extent[1] -= margin;
}
// If axis has labels [1, 2, 3, 4]. Bands on the axis are
// |---1---|---2---|---3---|---4---|.
// So the displayed ticks and splitLine/splitArea should between
// each data item, otherwise cause misleading (e.g., split tow bars
// of a single data item when there are two bar series).
// Also consider if tickCategoryInterval > 0 and onBand, ticks and
// splitLine/spliteArea should layout appropriately corresponding
// to displayed labels. (So we should not use `getBandWidth` in this
// case).
function fixOnBandTicksCoords(axis, ticksCoords, alignWithLabel, clamp) {
  var ticksLen = ticksCoords.length;
  if (!axis.onBand || alignWithLabel || !ticksLen) {
    return;
  }
  var axisExtent = axis.getExtent();
  var last;
  var diffSize;
  if (ticksLen === 1) {
    ticksCoords[0].coord = axisExtent[0];
    last = ticksCoords[1] = {
      coord: axisExtent[1],
      tickValue: ticksCoords[0].tickValue
    };
  } else {
    var crossLen = ticksCoords[ticksLen - 1].tickValue - ticksCoords[0].tickValue;
    var shift_1 = (ticksCoords[ticksLen - 1].coord - ticksCoords[0].coord) / crossLen;
    each$f(ticksCoords, function (ticksItem) {
      ticksItem.coord -= shift_1 / 2;
    });
    var dataExtent = axis.scale.getExtent();
    diffSize = 1 + dataExtent[1] - ticksCoords[ticksLen - 1].tickValue;
    last = {
      coord: ticksCoords[ticksLen - 1].coord + shift_1 * diffSize,
      tickValue: dataExtent[1] + 1
    };
    ticksCoords.push(last);
  }
  var inverse = axisExtent[0] > axisExtent[1];
  // Handling clamp.
  if (littleThan(ticksCoords[0].coord, axisExtent[0])) {
    clamp ? ticksCoords[0].coord = axisExtent[0] : ticksCoords.shift();
  }
  if (clamp && littleThan(axisExtent[0], ticksCoords[0].coord)) {
    ticksCoords.unshift({
      coord: axisExtent[0]
    });
  }
  if (littleThan(axisExtent[1], last.coord)) {
    clamp ? last.coord = axisExtent[1] : ticksCoords.pop();
  }
  if (clamp && littleThan(last.coord, axisExtent[1])) {
    ticksCoords.push({
      coord: axisExtent[1]
    });
  }
  function littleThan(a, b) {
    // Avoid rounding error cause calculated tick coord different with extent.
    // It may cause an extra unnecessary tick added.
    a = round$4(a);
    b = round$4(b);
    return inverse ? a > b : a < b;
  }
}
var Axis$1 = Axis;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PI2$2 = Math.PI * 2;
var CMD$1 = PathProxy.CMD;
var DEFAULT_SEARCH_SPACE = ['top', 'right', 'bottom', 'left'];
function getCandidateAnchor(pos, distance, rect, outPt, outDir) {
  var width = rect.width;
  var height = rect.height;
  switch (pos) {
    case 'top':
      outPt.set(rect.x + width / 2, rect.y - distance);
      outDir.set(0, -1);
      break;
    case 'bottom':
      outPt.set(rect.x + width / 2, rect.y + height + distance);
      outDir.set(0, 1);
      break;
    case 'left':
      outPt.set(rect.x - distance, rect.y + height / 2);
      outDir.set(-1, 0);
      break;
    case 'right':
      outPt.set(rect.x + width + distance, rect.y + height / 2);
      outDir.set(1, 0);
      break;
  }
}
function projectPointToArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y, out) {
  x -= cx;
  y -= cy;
  var d = Math.sqrt(x * x + y * y);
  x /= d;
  y /= d;
  // Intersect point.
  var ox = x * r + cx;
  var oy = y * r + cy;
  if (Math.abs(startAngle - endAngle) % PI2$2 < 1e-4) {
    // Is a circle
    out[0] = ox;
    out[1] = oy;
    return d - r;
  }
  if (anticlockwise) {
    var tmp = startAngle;
    startAngle = normalizeRadian(endAngle);
    endAngle = normalizeRadian(tmp);
  } else {
    startAngle = normalizeRadian(startAngle);
    endAngle = normalizeRadian(endAngle);
  }
  if (startAngle > endAngle) {
    endAngle += PI2$2;
  }
  var angle = Math.atan2(y, x);
  if (angle < 0) {
    angle += PI2$2;
  }
  if (angle >= startAngle && angle <= endAngle || angle + PI2$2 >= startAngle && angle + PI2$2 <= endAngle) {
    // Project point is on the arc.
    out[0] = ox;
    out[1] = oy;
    return d - r;
  }
  var x1 = r * Math.cos(startAngle) + cx;
  var y1 = r * Math.sin(startAngle) + cy;
  var x2 = r * Math.cos(endAngle) + cx;
  var y2 = r * Math.sin(endAngle) + cy;
  var d1 = (x1 - x) * (x1 - x) + (y1 - y) * (y1 - y);
  var d2 = (x2 - x) * (x2 - x) + (y2 - y) * (y2 - y);
  if (d1 < d2) {
    out[0] = x1;
    out[1] = y1;
    return Math.sqrt(d1);
  } else {
    out[0] = x2;
    out[1] = y2;
    return Math.sqrt(d2);
  }
}
function projectPointToLine(x1, y1, x2, y2, x, y, out, limitToEnds) {
  var dx = x - x1;
  var dy = y - y1;
  var dx1 = x2 - x1;
  var dy1 = y2 - y1;
  var lineLen = Math.sqrt(dx1 * dx1 + dy1 * dy1);
  dx1 /= lineLen;
  dy1 /= lineLen;
  // dot product
  var projectedLen = dx * dx1 + dy * dy1;
  var t = projectedLen / lineLen;
  if (limitToEnds) {
    t = Math.min(Math.max(t, 0), 1);
  }
  t *= lineLen;
  var ox = out[0] = x1 + t * dx1;
  var oy = out[1] = y1 + t * dy1;
  return Math.sqrt((ox - x) * (ox - x) + (oy - y) * (oy - y));
}
function projectPointToRect(x1, y1, width, height, x, y, out) {
  if (width < 0) {
    x1 = x1 + width;
    width = -width;
  }
  if (height < 0) {
    y1 = y1 + height;
    height = -height;
  }
  var x2 = x1 + width;
  var y2 = y1 + height;
  var ox = out[0] = Math.min(Math.max(x, x1), x2);
  var oy = out[1] = Math.min(Math.max(y, y1), y2);
  return Math.sqrt((ox - x) * (ox - x) + (oy - y) * (oy - y));
}
var tmpPt = [];
function nearestPointOnRect(pt, rect, out) {
  var dist = projectPointToRect(rect.x, rect.y, rect.width, rect.height, pt.x, pt.y, tmpPt);
  out.set(tmpPt[0], tmpPt[1]);
  return dist;
}
/**
 * Calculate min distance corresponding point.
 * This method won't evaluate if point is in the path.
 */
function nearestPointOnPath(pt, path, out) {
  var xi = 0;
  var yi = 0;
  var x0 = 0;
  var y0 = 0;
  var x1;
  var y1;
  var minDist = Infinity;
  var data = path.data;
  var x = pt.x;
  var y = pt.y;
  for (var i = 0; i < data.length;) {
    var cmd = data[i++];
    if (i === 1) {
      xi = data[i];
      yi = data[i + 1];
      x0 = xi;
      y0 = yi;
    }
    var d = minDist;
    switch (cmd) {
      case CMD$1.M:
        // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点
        // 在 closePath 的时候使用
        x0 = data[i++];
        y0 = data[i++];
        xi = x0;
        yi = y0;
        break;
      case CMD$1.L:
        d = projectPointToLine(xi, yi, data[i], data[i + 1], x, y, tmpPt, true);
        xi = data[i++];
        yi = data[i++];
        break;
      case CMD$1.C:
        d = cubicProjectPoint(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], x, y, tmpPt);
        xi = data[i++];
        yi = data[i++];
        break;
      case CMD$1.Q:
        d = quadraticProjectPoint(xi, yi, data[i++], data[i++], data[i], data[i + 1], x, y, tmpPt);
        xi = data[i++];
        yi = data[i++];
        break;
      case CMD$1.A:
        // TODO Arc 判断的开销比较大
        var cx = data[i++];
        var cy = data[i++];
        var rx = data[i++];
        var ry = data[i++];
        var theta = data[i++];
        var dTheta = data[i++];
        // TODO Arc 旋转
        i += 1;
        var anticlockwise = !!(1 - data[i++]);
        x1 = Math.cos(theta) * rx + cx;
        y1 = Math.sin(theta) * ry + cy;
        // 不是直接使用 arc 命令
        if (i <= 1) {
          // 第一个命令起点还未定义
          x0 = x1;
          y0 = y1;
        }
        // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
        var _x = (x - cx) * ry / rx + cx;
        d = projectPointToArc(cx, cy, ry, theta, theta + dTheta, anticlockwise, _x, y, tmpPt);
        xi = Math.cos(theta + dTheta) * rx + cx;
        yi = Math.sin(theta + dTheta) * ry + cy;
        break;
      case CMD$1.R:
        x0 = xi = data[i++];
        y0 = yi = data[i++];
        var width = data[i++];
        var height = data[i++];
        d = projectPointToRect(x0, y0, width, height, x, y, tmpPt);
        break;
      case CMD$1.Z:
        d = projectPointToLine(xi, yi, x0, y0, x, y, tmpPt, true);
        xi = x0;
        yi = y0;
        break;
    }
    if (d < minDist) {
      minDist = d;
      out.set(tmpPt[0], tmpPt[1]);
    }
  }
  return minDist;
}
// Temporal variable for intermediate usage.
var pt0 = new Point$1();
var pt1 = new Point$1();
var pt2 = new Point$1();
var dir = new Point$1();
var dir2 = new Point$1();
/**
 * Calculate a proper guide line based on the label position and graphic element definition
 * @param label
 * @param labelRect
 * @param target
 * @param targetRect
 */
function updateLabelLinePoints(target, labelLineModel) {
  if (!target) {
    return;
  }
  var labelLine = target.getTextGuideLine();
  var label = target.getTextContent();
  // Needs to create text guide in each charts.
  if (!(label && labelLine)) {
    return;
  }
  var labelGuideConfig = target.textGuideLineConfig || {};
  var points = [[0, 0], [0, 0], [0, 0]];
  var searchSpace = labelGuideConfig.candidates || DEFAULT_SEARCH_SPACE;
  var labelRect = label.getBoundingRect().clone();
  labelRect.applyTransform(label.getComputedTransform());
  var minDist = Infinity;
  var anchorPoint = labelGuideConfig.anchor;
  var targetTransform = target.getComputedTransform();
  var targetInversedTransform = targetTransform && invert([], targetTransform);
  var len = labelLineModel.get('length2') || 0;
  if (anchorPoint) {
    pt2.copy(anchorPoint);
  }
  for (var i = 0; i < searchSpace.length; i++) {
    var candidate = searchSpace[i];
    getCandidateAnchor(candidate, 0, labelRect, pt0, dir);
    Point$1.scaleAndAdd(pt1, pt0, dir, len);
    // Transform to target coord space.
    pt1.transform(targetInversedTransform);
    // Note: getBoundingRect will ensure the `path` being created.
    var boundingRect = target.getBoundingRect();
    var dist = anchorPoint ? anchorPoint.distance(pt1) : target instanceof Path$1 ? nearestPointOnPath(pt1, target.path, pt2) : nearestPointOnRect(pt1, boundingRect, pt2);
    // TODO pt2 is in the path
    if (dist < minDist) {
      minDist = dist;
      // Transform back to global space.
      pt1.transform(targetTransform);
      pt2.transform(targetTransform);
      pt2.toArray(points[0]);
      pt1.toArray(points[1]);
      pt0.toArray(points[2]);
    }
  }
  limitTurnAngle(points, labelLineModel.get('minTurnAngle'));
  labelLine.setShape({
    points: points
  });
}
// Temporal variable for the limitTurnAngle function
var tmpArr = [];
var tmpProjPoint = new Point$1();
/**
 * Reduce the line segment attached to the label to limit the turn angle between two segments.
 * @param linePoints
 * @param minTurnAngle Radian of minimum turn angle. 0 - 180
 */
function limitTurnAngle(linePoints, minTurnAngle) {
  if (!(minTurnAngle <= 180 && minTurnAngle > 0)) {
    return;
  }
  minTurnAngle = minTurnAngle / 180 * Math.PI;
  // The line points can be
  //      /pt1----pt2 (label)
  //     /
  // pt0/
  pt0.fromArray(linePoints[0]);
  pt1.fromArray(linePoints[1]);
  pt2.fromArray(linePoints[2]);
  Point$1.sub(dir, pt0, pt1);
  Point$1.sub(dir2, pt2, pt1);
  var len1 = dir.len();
  var len2 = dir2.len();
  if (len1 < 1e-3 || len2 < 1e-3) {
    return;
  }
  dir.scale(1 / len1);
  dir2.scale(1 / len2);
  var angleCos = dir.dot(dir2);
  var minTurnAngleCos = Math.cos(minTurnAngle);
  if (minTurnAngleCos < angleCos) {
    // Smaller than minTurnAngle
    // Calculate project point of pt0 on pt1-pt2
    var d = projectPointToLine(pt1.x, pt1.y, pt2.x, pt2.y, pt0.x, pt0.y, tmpArr, false);
    tmpProjPoint.fromArray(tmpArr);
    // Calculate new projected length with limited minTurnAngle and get the new connect point
    tmpProjPoint.scaleAndAdd(dir2, d / Math.tan(Math.PI - minTurnAngle));
    // Limit the new calculated connect point between pt1 and pt2.
    var t = pt2.x !== pt1.x ? (tmpProjPoint.x - pt1.x) / (pt2.x - pt1.x) : (tmpProjPoint.y - pt1.y) / (pt2.y - pt1.y);
    if (isNaN(t)) {
      return;
    }
    if (t < 0) {
      Point$1.copy(tmpProjPoint, pt1);
    } else if (t > 1) {
      Point$1.copy(tmpProjPoint, pt2);
    }
    tmpProjPoint.toArray(linePoints[1]);
  }
}
/**
 * Limit the angle of line and the surface
 * @param maxSurfaceAngle Radian of minimum turn angle. 0 - 180. 0 is same direction to normal. 180 is opposite
 */
function limitSurfaceAngle(linePoints, surfaceNormal, maxSurfaceAngle) {
  if (!(maxSurfaceAngle <= 180 && maxSurfaceAngle > 0)) {
    return;
  }
  maxSurfaceAngle = maxSurfaceAngle / 180 * Math.PI;
  pt0.fromArray(linePoints[0]);
  pt1.fromArray(linePoints[1]);
  pt2.fromArray(linePoints[2]);
  Point$1.sub(dir, pt1, pt0);
  Point$1.sub(dir2, pt2, pt1);
  var len1 = dir.len();
  var len2 = dir2.len();
  if (len1 < 1e-3 || len2 < 1e-3) {
    return;
  }
  dir.scale(1 / len1);
  dir2.scale(1 / len2);
  var angleCos = dir.dot(surfaceNormal);
  var maxSurfaceAngleCos = Math.cos(maxSurfaceAngle);
  if (angleCos < maxSurfaceAngleCos) {
    // Calculate project point of pt0 on pt1-pt2
    var d = projectPointToLine(pt1.x, pt1.y, pt2.x, pt2.y, pt0.x, pt0.y, tmpArr, false);
    tmpProjPoint.fromArray(tmpArr);
    var HALF_PI = Math.PI / 2;
    var angle2 = Math.acos(dir2.dot(surfaceNormal));
    var newAngle = HALF_PI + angle2 - maxSurfaceAngle;
    if (newAngle >= HALF_PI) {
      // parallel
      Point$1.copy(tmpProjPoint, pt2);
    } else {
      // Calculate new projected length with limited minTurnAngle and get the new connect point
      tmpProjPoint.scaleAndAdd(dir2, d / Math.tan(Math.PI / 2 - newAngle));
      // Limit the new calculated connect point between pt1 and pt2.
      var t = pt2.x !== pt1.x ? (tmpProjPoint.x - pt1.x) / (pt2.x - pt1.x) : (tmpProjPoint.y - pt1.y) / (pt2.y - pt1.y);
      if (isNaN(t)) {
        return;
      }
      if (t < 0) {
        Point$1.copy(tmpProjPoint, pt1);
      } else if (t > 1) {
        Point$1.copy(tmpProjPoint, pt2);
      }
    }
    tmpProjPoint.toArray(linePoints[1]);
  }
}
function setLabelLineState(labelLine, ignore, stateName, stateModel) {
  var isNormal = stateName === 'normal';
  var stateObj = isNormal ? labelLine : labelLine.ensureState(stateName);
  // Make sure display.
  stateObj.ignore = ignore;
  // Set smooth
  var smooth = stateModel.get('smooth');
  if (smooth && smooth === true) {
    smooth = 0.3;
  }
  stateObj.shape = stateObj.shape || {};
  if (smooth > 0) {
    stateObj.shape.smooth = smooth;
  }
  var styleObj = stateModel.getModel('lineStyle').getLineStyle();
  isNormal ? labelLine.useStyle(styleObj) : stateObj.style = styleObj;
}
function buildLabelLinePath(path, shape) {
  var smooth = shape.smooth;
  var points = shape.points;
  if (!points) {
    return;
  }
  path.moveTo(points[0][0], points[0][1]);
  if (smooth > 0 && points.length >= 3) {
    var len1 = dist$1(points[0], points[1]);
    var len2 = dist$1(points[1], points[2]);
    if (!len1 || !len2) {
      path.lineTo(points[1][0], points[1][1]);
      path.lineTo(points[2][0], points[2][1]);
      return;
    }
    var moveLen = Math.min(len1, len2) * smooth;
    var midPoint0 = lerp$3([], points[1], points[0], moveLen / len1);
    var midPoint2 = lerp$3([], points[1], points[2], moveLen / len2);
    var midPoint1 = lerp$3([], midPoint0, midPoint2, 0.5);
    path.bezierCurveTo(midPoint0[0], midPoint0[1], midPoint0[0], midPoint0[1], midPoint1[0], midPoint1[1]);
    path.bezierCurveTo(midPoint2[0], midPoint2[1], midPoint2[0], midPoint2[1], points[2][0], points[2][1]);
  } else {
    for (var i = 1; i < points.length; i++) {
      path.lineTo(points[i][0], points[i][1]);
    }
  }
}
/**
 * Create a label line if necessary and set it's style.
 */
function setLabelLineStyle(targetEl, statesModels, defaultStyle) {
  var labelLine = targetEl.getTextGuideLine();
  var label = targetEl.getTextContent();
  if (!label) {
    // Not show label line if there is no label.
    if (labelLine) {
      targetEl.removeTextGuideLine();
    }
    return;
  }
  var normalModel = statesModels.normal;
  var showNormal = normalModel.get('show');
  var labelIgnoreNormal = label.ignore;
  for (var i = 0; i < DISPLAY_STATES.length; i++) {
    var stateName = DISPLAY_STATES[i];
    var stateModel = statesModels[stateName];
    var isNormal = stateName === 'normal';
    if (stateModel) {
      var stateShow = stateModel.get('show');
      var isLabelIgnored = isNormal ? labelIgnoreNormal : retrieve2(label.states[stateName] && label.states[stateName].ignore, labelIgnoreNormal);
      if (isLabelIgnored // Not show when label is not shown in this state.
      || !retrieve2(stateShow, showNormal) // Use normal state by default if not set.
      ) {
        var stateObj = isNormal ? labelLine : labelLine && labelLine.states[stateName];
        if (stateObj) {
          stateObj.ignore = true;
        }
        if (!!labelLine) {
          setLabelLineState(labelLine, true, stateName, stateModel);
        }
        continue;
      }
      // Create labelLine if not exists
      if (!labelLine) {
        labelLine = new Polyline$3();
        targetEl.setTextGuideLine(labelLine);
        // Reset state of normal because it's new created.
        // NOTE: NORMAL should always been the first!
        if (!isNormal && (labelIgnoreNormal || !showNormal)) {
          setLabelLineState(labelLine, true, 'normal', statesModels.normal);
        }
        // Use same state proxy.
        if (targetEl.stateProxy) {
          labelLine.stateProxy = targetEl.stateProxy;
        }
      }
      setLabelLineState(labelLine, false, stateName, stateModel);
    }
  }
  if (labelLine) {
    defaults(labelLine.style, defaultStyle);
    // Not fill.
    labelLine.style.fill = null;
    var showAbove = normalModel.get('showAbove');
    var labelLineConfig = targetEl.textGuideLineConfig = targetEl.textGuideLineConfig || {};
    labelLineConfig.showAbove = showAbove || false;
    // Custom the buildPath.
    labelLine.buildPath = buildLabelLinePath;
  }
}
function getLabelLineStatesModels(itemModel, labelLineName) {
  labelLineName = labelLineName || 'labelLine';
  var statesModels = {
    normal: itemModel.getModel(labelLineName)
  };
  for (var i = 0; i < SPECIAL_STATES.length; i++) {
    var stateName = SPECIAL_STATES[i];
    statesModels[stateName] = itemModel.getModel([stateName, labelLineName]);
  }
  return statesModels;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function prepareLayoutList(input) {
  var list = [];
  for (var i = 0; i < input.length; i++) {
    var rawItem = input[i];
    if (rawItem.defaultAttr.ignore) {
      continue;
    }
    var label = rawItem.label;
    var transform = label.getComputedTransform();
    // NOTE: Get bounding rect after getComputedTransform, or label may not been updated by the host el.
    var localRect = label.getBoundingRect();
    var isAxisAligned = !transform || transform[1] < 1e-5 && transform[2] < 1e-5;
    var minMargin = label.style.margin || 0;
    var globalRect = localRect.clone();
    globalRect.applyTransform(transform);
    globalRect.x -= minMargin / 2;
    globalRect.y -= minMargin / 2;
    globalRect.width += minMargin;
    globalRect.height += minMargin;
    var obb = isAxisAligned ? new OrientedBoundingRect$1(localRect, transform) : null;
    list.push({
      label: label,
      labelLine: rawItem.labelLine,
      rect: globalRect,
      localRect: localRect,
      obb: obb,
      priority: rawItem.priority,
      defaultAttr: rawItem.defaultAttr,
      layoutOption: rawItem.computedLayoutOption,
      axisAligned: isAxisAligned,
      transform: transform
    });
  }
  return list;
}
function shiftLayout(list, xyDim, sizeDim, minBound, maxBound, balanceShift) {
  var len = list.length;
  if (len < 2) {
    return;
  }
  list.sort(function (a, b) {
    return a.rect[xyDim] - b.rect[xyDim];
  });
  var lastPos = 0;
  var delta;
  var adjusted = false;
  var totalShifts = 0;
  for (var i = 0; i < len; i++) {
    var item = list[i];
    var rect = item.rect;
    delta = rect[xyDim] - lastPos;
    if (delta < 0) {
      // shiftForward(i, len, -delta);
      rect[xyDim] -= delta;
      item.label[xyDim] -= delta;
      adjusted = true;
    }
    var shift = Math.max(-delta, 0);
    totalShifts += shift;
    lastPos = rect[xyDim] + rect[sizeDim];
  }
  if (totalShifts > 0 && balanceShift) {
    // Shift back to make the distribution more equally.
    shiftList(-totalShifts / len, 0, len);
  }
  // TODO bleedMargin?
  var first = list[0];
  var last = list[len - 1];
  var minGap;
  var maxGap;
  updateMinMaxGap();
  // If ends exceed two bounds, squeeze at most 80%, then take the gap of two bounds.
  minGap < 0 && squeezeGaps(-minGap, 0.8);
  maxGap < 0 && squeezeGaps(maxGap, 0.8);
  updateMinMaxGap();
  takeBoundsGap(minGap, maxGap, 1);
  takeBoundsGap(maxGap, minGap, -1);
  // Handle bailout when there is not enough space.
  updateMinMaxGap();
  if (minGap < 0) {
    squeezeWhenBailout(-minGap);
  }
  if (maxGap < 0) {
    squeezeWhenBailout(maxGap);
  }
  function updateMinMaxGap() {
    minGap = first.rect[xyDim] - minBound;
    maxGap = maxBound - last.rect[xyDim] - last.rect[sizeDim];
  }
  function takeBoundsGap(gapThisBound, gapOtherBound, moveDir) {
    if (gapThisBound < 0) {
      // Move from other gap if can.
      var moveFromMaxGap = Math.min(gapOtherBound, -gapThisBound);
      if (moveFromMaxGap > 0) {
        shiftList(moveFromMaxGap * moveDir, 0, len);
        var remained = moveFromMaxGap + gapThisBound;
        if (remained < 0) {
          squeezeGaps(-remained * moveDir, 1);
        }
      } else {
        squeezeGaps(-gapThisBound * moveDir, 1);
      }
    }
  }
  function shiftList(delta, start, end) {
    if (delta !== 0) {
      adjusted = true;
    }
    for (var i = start; i < end; i++) {
      var item = list[i];
      var rect = item.rect;
      rect[xyDim] += delta;
      item.label[xyDim] += delta;
    }
  }
  // Squeeze gaps if the labels exceed margin.
  function squeezeGaps(delta, maxSqeezePercent) {
    var gaps = [];
    var totalGaps = 0;
    for (var i = 1; i < len; i++) {
      var prevItemRect = list[i - 1].rect;
      var gap = Math.max(list[i].rect[xyDim] - prevItemRect[xyDim] - prevItemRect[sizeDim], 0);
      gaps.push(gap);
      totalGaps += gap;
    }
    if (!totalGaps) {
      return;
    }
    var squeezePercent = Math.min(Math.abs(delta) / totalGaps, maxSqeezePercent);
    if (delta > 0) {
      for (var i = 0; i < len - 1; i++) {
        // Distribute the shift delta to all gaps.
        var movement = gaps[i] * squeezePercent;
        // Forward
        shiftList(movement, 0, i + 1);
      }
    } else {
      // Backward
      for (var i = len - 1; i > 0; i--) {
        // Distribute the shift delta to all gaps.
        var movement = gaps[i - 1] * squeezePercent;
        shiftList(-movement, i, len);
      }
    }
  }
  /**
   * Squeeze to allow overlap if there is no more space available.
   * Let other overlapping strategy like hideOverlap do the job instead of keep exceeding the bounds.
   */
  function squeezeWhenBailout(delta) {
    var dir = delta < 0 ? -1 : 1;
    delta = Math.abs(delta);
    var moveForEachLabel = Math.ceil(delta / (len - 1));
    for (var i = 0; i < len - 1; i++) {
      if (dir > 0) {
        // Forward
        shiftList(moveForEachLabel, 0, i + 1);
      } else {
        // Backward
        shiftList(-moveForEachLabel, len - i - 1, len);
      }
      delta -= moveForEachLabel;
      if (delta <= 0) {
        return;
      }
    }
  }
  return adjusted;
}
/**
 * Adjust labels on x direction to avoid overlap.
 */
function shiftLayoutOnX(list, leftBound, rightBound,
// If average the shifts on all labels and add them to 0
// TODO: Not sure if should enable it.
// Pros: The angle of lines will distribute more equally
// Cons: In some layout. It may not what user wanted. like in pie. the label of last sector is usually changed unexpectedly.
balanceShift) {
  return shiftLayout(list, 'x', 'width', leftBound, rightBound, balanceShift);
}
/**
 * Adjust labels on y direction to avoid overlap.
 */
function shiftLayoutOnY(list, topBound, bottomBound,
// If average the shifts on all labels and add them to 0
balanceShift) {
  return shiftLayout(list, 'y', 'height', topBound, bottomBound, balanceShift);
}
function hideOverlap(labelList) {
  var displayedLabels = [];
  // TODO, render overflow visible first, put in the displayedLabels.
  labelList.sort(function (a, b) {
    return b.priority - a.priority;
  });
  var globalRect = new BoundingRect$1(0, 0, 0, 0);
  function hideEl(el) {
    if (!el.ignore) {
      // Show on emphasis.
      var emphasisState = el.ensureState('emphasis');
      if (emphasisState.ignore == null) {
        emphasisState.ignore = false;
      }
    }
    el.ignore = true;
  }
  for (var i = 0; i < labelList.length; i++) {
    var labelItem = labelList[i];
    var isAxisAligned = labelItem.axisAligned;
    var localRect = labelItem.localRect;
    var transform = labelItem.transform;
    var label = labelItem.label;
    var labelLine = labelItem.labelLine;
    globalRect.copy(labelItem.rect);
    // Add a threshold because layout may be aligned precisely.
    globalRect.width -= 0.1;
    globalRect.height -= 0.1;
    globalRect.x += 0.05;
    globalRect.y += 0.05;
    var obb = labelItem.obb;
    var overlapped = false;
    for (var j = 0; j < displayedLabels.length; j++) {
      var existsTextCfg = displayedLabels[j];
      // Fast rejection.
      if (!globalRect.intersect(existsTextCfg.rect)) {
        continue;
      }
      if (isAxisAligned && existsTextCfg.axisAligned) {
        // Is overlapped
        overlapped = true;
        break;
      }
      if (!existsTextCfg.obb) {
        // If self is not axis aligned. But other is.
        existsTextCfg.obb = new OrientedBoundingRect$1(existsTextCfg.localRect, existsTextCfg.transform);
      }
      if (!obb) {
        // If self is axis aligned. But other is not.
        obb = new OrientedBoundingRect$1(localRect, transform);
      }
      if (obb.intersect(existsTextCfg.obb)) {
        overlapped = true;
        break;
      }
    }
    // TODO Callback to determine if this overlap should be handled?
    if (overlapped) {
      hideEl(label);
      labelLine && hideEl(labelLine);
    } else {
      label.attr('ignore', labelItem.defaultAttr.ignore);
      labelLine && labelLine.attr('ignore', labelItem.defaultAttr.labelGuideIgnore);
      displayedLabels.push(labelItem);
    }
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function cloneArr(points) {
  if (points) {
    var newPoints = [];
    for (var i = 0; i < points.length; i++) {
      newPoints.push(points[i].slice());
    }
    return newPoints;
  }
}
function prepareLayoutCallbackParams(labelItem, hostEl) {
  var label = labelItem.label;
  var labelLine = hostEl && hostEl.getTextGuideLine();
  return {
    dataIndex: labelItem.dataIndex,
    dataType: labelItem.dataType,
    seriesIndex: labelItem.seriesModel.seriesIndex,
    text: labelItem.label.style.text,
    rect: labelItem.hostRect,
    labelRect: labelItem.rect,
    // x: labelAttr.x,
    // y: labelAttr.y,
    align: label.style.align,
    verticalAlign: label.style.verticalAlign,
    labelLinePoints: cloneArr(labelLine && labelLine.shape.points)
  };
}
var LABEL_OPTION_TO_STYLE_KEYS = ['align', 'verticalAlign', 'width', 'height', 'fontSize'];
var dummyTransformable = new Transformable$1();
var labelLayoutInnerStore = makeInner();
var labelLineAnimationStore = makeInner();
function extendWithKeys(target, source, keys) {
  for (var i = 0; i < keys.length; i++) {
    var key = keys[i];
    if (source[key] != null) {
      target[key] = source[key];
    }
  }
}
var LABEL_LAYOUT_PROPS = ['x', 'y', 'rotation'];
var LabelManager = /** @class */function () {
  function LabelManager() {
    this._labelList = [];
    this._chartViewList = [];
  }
  LabelManager.prototype.clearLabels = function () {
    this._labelList = [];
    this._chartViewList = [];
  };
  /**
   * Add label to manager
   */
  LabelManager.prototype._addLabel = function (dataIndex, dataType, seriesModel, label, layoutOption) {
    var labelStyle = label.style;
    var hostEl = label.__hostTarget;
    var textConfig = hostEl.textConfig || {};
    // TODO: If label is in other state.
    var labelTransform = label.getComputedTransform();
    var labelRect = label.getBoundingRect().plain();
    BoundingRect$1.applyTransform(labelRect, labelRect, labelTransform);
    if (labelTransform) {
      dummyTransformable.setLocalTransform(labelTransform);
    } else {
      // Identity transform.
      dummyTransformable.x = dummyTransformable.y = dummyTransformable.rotation = dummyTransformable.originX = dummyTransformable.originY = 0;
      dummyTransformable.scaleX = dummyTransformable.scaleY = 1;
    }
    dummyTransformable.rotation = normalizeRadian(dummyTransformable.rotation);
    var host = label.__hostTarget;
    var hostRect;
    if (host) {
      hostRect = host.getBoundingRect().plain();
      var transform = host.getComputedTransform();
      BoundingRect$1.applyTransform(hostRect, hostRect, transform);
    }
    var labelGuide = hostRect && host.getTextGuideLine();
    this._labelList.push({
      label: label,
      labelLine: labelGuide,
      seriesModel: seriesModel,
      dataIndex: dataIndex,
      dataType: dataType,
      layoutOption: layoutOption,
      computedLayoutOption: null,
      rect: labelRect,
      hostRect: hostRect,
      // Label with lower priority will be hidden when overlapped
      // Use rect size as default priority
      priority: hostRect ? hostRect.width * hostRect.height : 0,
      // Save default label attributes.
      // For restore if developers want get back to default value in callback.
      defaultAttr: {
        ignore: label.ignore,
        labelGuideIgnore: labelGuide && labelGuide.ignore,
        x: dummyTransformable.x,
        y: dummyTransformable.y,
        scaleX: dummyTransformable.scaleX,
        scaleY: dummyTransformable.scaleY,
        rotation: dummyTransformable.rotation,
        style: {
          x: labelStyle.x,
          y: labelStyle.y,
          align: labelStyle.align,
          verticalAlign: labelStyle.verticalAlign,
          width: labelStyle.width,
          height: labelStyle.height,
          fontSize: labelStyle.fontSize
        },
        cursor: label.cursor,
        attachedPos: textConfig.position,
        attachedRot: textConfig.rotation
      }
    });
  };
  LabelManager.prototype.addLabelsOfSeries = function (chartView) {
    var _this = this;
    this._chartViewList.push(chartView);
    var seriesModel = chartView.__model;
    var layoutOption = seriesModel.get('labelLayout');
    /**
     * Ignore layouting if it's not specified anything.
     */
    if (!(isFunction(layoutOption) || keys(layoutOption).length)) {
      return;
    }
    chartView.group.traverse(function (child) {
      if (child.ignore) {
        return true; // Stop traverse descendants.
      }
      // Only support label being hosted on graphic elements.
      var textEl = child.getTextContent();
      var ecData = getECData(child);
      // Can only attach the text on the element with dataIndex
      if (textEl && !textEl.disableLabelLayout) {
        _this._addLabel(ecData.dataIndex, ecData.dataType, seriesModel, textEl, layoutOption);
      }
    });
  };
  LabelManager.prototype.updateLayoutConfig = function (api) {
    var width = api.getWidth();
    var height = api.getHeight();
    function createDragHandler(el, labelLineModel) {
      return function () {
        updateLabelLinePoints(el, labelLineModel);
      };
    }
    for (var i = 0; i < this._labelList.length; i++) {
      var labelItem = this._labelList[i];
      var label = labelItem.label;
      var hostEl = label.__hostTarget;
      var defaultLabelAttr = labelItem.defaultAttr;
      var layoutOption = void 0;
      // TODO A global layout option?
      if (isFunction(labelItem.layoutOption)) {
        layoutOption = labelItem.layoutOption(prepareLayoutCallbackParams(labelItem, hostEl));
      } else {
        layoutOption = labelItem.layoutOption;
      }
      layoutOption = layoutOption || {};
      labelItem.computedLayoutOption = layoutOption;
      var degreeToRadian = Math.PI / 180;
      // TODO hostEl should always exists.
      // Or label should not have parent because the x, y is all in global space.
      if (hostEl) {
        hostEl.setTextConfig({
          // Force to set local false.
          local: false,
          // Ignore position and rotation config on the host el if x or y is changed.
          position: layoutOption.x != null || layoutOption.y != null ? null : defaultLabelAttr.attachedPos,
          // Ignore rotation config on the host el if rotation is changed.
          rotation: layoutOption.rotate != null ? layoutOption.rotate * degreeToRadian : defaultLabelAttr.attachedRot,
          offset: [layoutOption.dx || 0, layoutOption.dy || 0]
        });
      }
      var needsUpdateLabelLine = false;
      if (layoutOption.x != null) {
        // TODO width of chart view.
        label.x = parsePercent(layoutOption.x, width);
        label.setStyle('x', 0); // Ignore movement in style. TODO: origin.
        needsUpdateLabelLine = true;
      } else {
        label.x = defaultLabelAttr.x;
        label.setStyle('x', defaultLabelAttr.style.x);
      }
      if (layoutOption.y != null) {
        // TODO height of chart view.
        label.y = parsePercent(layoutOption.y, height);
        label.setStyle('y', 0); // Ignore movement in style.
        needsUpdateLabelLine = true;
      } else {
        label.y = defaultLabelAttr.y;
        label.setStyle('y', defaultLabelAttr.style.y);
      }
      if (layoutOption.labelLinePoints) {
        var guideLine = hostEl.getTextGuideLine();
        if (guideLine) {
          guideLine.setShape({
            points: layoutOption.labelLinePoints
          });
          // Not update
          needsUpdateLabelLine = false;
        }
      }
      var labelLayoutStore = labelLayoutInnerStore(label);
      labelLayoutStore.needsUpdateLabelLine = needsUpdateLabelLine;
      label.rotation = layoutOption.rotate != null ? layoutOption.rotate * degreeToRadian : defaultLabelAttr.rotation;
      label.scaleX = defaultLabelAttr.scaleX;
      label.scaleY = defaultLabelAttr.scaleY;
      for (var k = 0; k < LABEL_OPTION_TO_STYLE_KEYS.length; k++) {
        var key = LABEL_OPTION_TO_STYLE_KEYS[k];
        label.setStyle(key, layoutOption[key] != null ? layoutOption[key] : defaultLabelAttr.style[key]);
      }
      if (layoutOption.draggable) {
        label.draggable = true;
        label.cursor = 'move';
        if (hostEl) {
          var hostModel = labelItem.seriesModel;
          if (labelItem.dataIndex != null) {
            var data = labelItem.seriesModel.getData(labelItem.dataType);
            hostModel = data.getItemModel(labelItem.dataIndex);
          }
          label.on('drag', createDragHandler(hostEl, hostModel.getModel('labelLine')));
        }
      } else {
        // TODO Other drag functions?
        label.off('drag');
        label.cursor = defaultLabelAttr.cursor;
      }
    }
  };
  LabelManager.prototype.layout = function (api) {
    var width = api.getWidth();
    var height = api.getHeight();
    var labelList = prepareLayoutList(this._labelList);
    var labelsNeedsAdjustOnX = filter(labelList, function (item) {
      return item.layoutOption.moveOverlap === 'shiftX';
    });
    var labelsNeedsAdjustOnY = filter(labelList, function (item) {
      return item.layoutOption.moveOverlap === 'shiftY';
    });
    shiftLayoutOnX(labelsNeedsAdjustOnX, 0, width);
    shiftLayoutOnY(labelsNeedsAdjustOnY, 0, height);
    var labelsNeedsHideOverlap = filter(labelList, function (item) {
      return item.layoutOption.hideOverlap;
    });
    hideOverlap(labelsNeedsHideOverlap);
  };
  /**
   * Process all labels. Not only labels with layoutOption.
   */
  LabelManager.prototype.processLabelsOverall = function () {
    var _this = this;
    each$f(this._chartViewList, function (chartView) {
      var seriesModel = chartView.__model;
      var ignoreLabelLineUpdate = chartView.ignoreLabelLineUpdate;
      var animationEnabled = seriesModel.isAnimationEnabled();
      chartView.group.traverse(function (child) {
        if (child.ignore && !child.forceLabelAnimation) {
          return true; // Stop traverse descendants.
        }
        var needsUpdateLabelLine = !ignoreLabelLineUpdate;
        var label = child.getTextContent();
        if (!needsUpdateLabelLine && label) {
          needsUpdateLabelLine = labelLayoutInnerStore(label).needsUpdateLabelLine;
        }
        if (needsUpdateLabelLine) {
          _this._updateLabelLine(child, seriesModel);
        }
        if (animationEnabled) {
          _this._animateLabels(child, seriesModel);
        }
      });
    });
  };
  LabelManager.prototype._updateLabelLine = function (el, seriesModel) {
    // Only support label being hosted on graphic elements.
    var textEl = el.getTextContent();
    // Update label line style.
    var ecData = getECData(el);
    var dataIndex = ecData.dataIndex;
    // Only support labelLine on the labels represent data.
    if (textEl && dataIndex != null) {
      var data = seriesModel.getData(ecData.dataType);
      var itemModel = data.getItemModel(dataIndex);
      var defaultStyle = {};
      var visualStyle = data.getItemVisual(dataIndex, 'style');
      if (visualStyle) {
        var visualType = data.getVisual('drawType');
        // Default to be same with main color
        defaultStyle.stroke = visualStyle[visualType];
      }
      var labelLineModel = itemModel.getModel('labelLine');
      setLabelLineStyle(el, getLabelLineStatesModels(itemModel), defaultStyle);
      updateLabelLinePoints(el, labelLineModel);
    }
  };
  LabelManager.prototype._animateLabels = function (el, seriesModel) {
    var textEl = el.getTextContent();
    var guideLine = el.getTextGuideLine();
    // Animate
    if (textEl
    // `forceLabelAnimation` has the highest priority
    && (el.forceLabelAnimation || !textEl.ignore && !textEl.invisible && !el.disableLabelAnimation && !isElementRemoved(el))) {
      var layoutStore = labelLayoutInnerStore(textEl);
      var oldLayout = layoutStore.oldLayout;
      var ecData = getECData(el);
      var dataIndex = ecData.dataIndex;
      var newProps = {
        x: textEl.x,
        y: textEl.y,
        rotation: textEl.rotation
      };
      var data = seriesModel.getData(ecData.dataType);
      if (!oldLayout) {
        textEl.attr(newProps);
        // Disable fade in animation if value animation is enabled.
        if (!labelInner(textEl).valueAnimation) {
          var oldOpacity = retrieve2(textEl.style.opacity, 1);
          // Fade in animation
          textEl.style.opacity = 0;
          initProps(textEl, {
            style: {
              opacity: oldOpacity
            }
          }, seriesModel, dataIndex);
        }
      } else {
        textEl.attr(oldLayout);
        // Make sure the animation from is in the right status.
        var prevStates = el.prevStates;
        if (prevStates) {
          if (indexOf(prevStates, 'select') >= 0) {
            textEl.attr(layoutStore.oldLayoutSelect);
          }
          if (indexOf(prevStates, 'emphasis') >= 0) {
            textEl.attr(layoutStore.oldLayoutEmphasis);
          }
        }
        updateProps$1(textEl, newProps, seriesModel, dataIndex);
      }
      layoutStore.oldLayout = newProps;
      if (textEl.states.select) {
        var layoutSelect = layoutStore.oldLayoutSelect = {};
        extendWithKeys(layoutSelect, newProps, LABEL_LAYOUT_PROPS);
        extendWithKeys(layoutSelect, textEl.states.select, LABEL_LAYOUT_PROPS);
      }
      if (textEl.states.emphasis) {
        var layoutEmphasis = layoutStore.oldLayoutEmphasis = {};
        extendWithKeys(layoutEmphasis, newProps, LABEL_LAYOUT_PROPS);
        extendWithKeys(layoutEmphasis, textEl.states.emphasis, LABEL_LAYOUT_PROPS);
      }
      animateLabelValue(textEl, dataIndex, data, seriesModel, seriesModel);
    }
    if (guideLine && !guideLine.ignore && !guideLine.invisible) {
      var layoutStore = labelLineAnimationStore(guideLine);
      var oldLayout = layoutStore.oldLayout;
      var newLayout = {
        points: guideLine.shape.points
      };
      if (!oldLayout) {
        guideLine.setShape(newLayout);
        guideLine.style.strokePercent = 0;
        initProps(guideLine, {
          style: {
            strokePercent: 1
          }
        }, seriesModel);
      } else {
        guideLine.attr({
          shape: oldLayout
        });
        updateProps$1(guideLine, {
          shape: newLayout
        }, seriesModel);
      }
      layoutStore.oldLayout = newLayout;
    }
  };
  return LabelManager;
}();
var LabelManager$1 = LabelManager;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var getLabelManager = makeInner();
function installLabelLayout(registers) {
  registers.registerUpdateLifecycle('series:beforeupdate', function (ecModel, api, params) {
    // TODO api provide an namespace that can save stuff per instance
    var labelManager = getLabelManager(api).labelManager;
    if (!labelManager) {
      labelManager = getLabelManager(api).labelManager = new LabelManager$1();
    }
    labelManager.clearLabels();
  });
  registers.registerUpdateLifecycle('series:layoutlabels', function (ecModel, api, params) {
    var labelManager = getLabelManager(api).labelManager;
    params.updatedSeries.forEach(function (series) {
      labelManager.addLabelsOfSeries(api.getViewOfSeriesModel(series));
    });
    labelManager.updateLayoutConfig(api);
    labelManager.layout(api);
    labelManager.processLabelsOverall();
  });
}

var mathSin = Math.sin;
var mathCos = Math.cos;
var PI$5 = Math.PI;
var PI2$1 = Math.PI * 2;
var degree = 180 / PI$5;
var SVGPathRebuilder = function () {
  function SVGPathRebuilder() {}
  SVGPathRebuilder.prototype.reset = function (precision) {
    this._start = true;
    this._d = [];
    this._str = '';
    this._p = Math.pow(10, precision || 4);
  };
  SVGPathRebuilder.prototype.moveTo = function (x, y) {
    this._add('M', x, y);
  };
  SVGPathRebuilder.prototype.lineTo = function (x, y) {
    this._add('L', x, y);
  };
  SVGPathRebuilder.prototype.bezierCurveTo = function (x, y, x2, y2, x3, y3) {
    this._add('C', x, y, x2, y2, x3, y3);
  };
  SVGPathRebuilder.prototype.quadraticCurveTo = function (x, y, x2, y2) {
    this._add('Q', x, y, x2, y2);
  };
  SVGPathRebuilder.prototype.arc = function (cx, cy, r, startAngle, endAngle, anticlockwise) {
    this.ellipse(cx, cy, r, r, 0, startAngle, endAngle, anticlockwise);
  };
  SVGPathRebuilder.prototype.ellipse = function (cx, cy, rx, ry, psi, startAngle, endAngle, anticlockwise) {
    var dTheta = endAngle - startAngle;
    var clockwise = !anticlockwise;
    var dThetaPositive = Math.abs(dTheta);
    var isCircle = isAroundZero(dThetaPositive - PI2$1) || (clockwise ? dTheta >= PI2$1 : -dTheta >= PI2$1);
    var unifiedTheta = dTheta > 0 ? dTheta % PI2$1 : dTheta % PI2$1 + PI2$1;
    var large = false;
    if (isCircle) {
      large = true;
    } else if (isAroundZero(dThetaPositive)) {
      large = false;
    } else {
      large = unifiedTheta >= PI$5 === !!clockwise;
    }
    var x0 = cx + rx * mathCos(startAngle);
    var y0 = cy + ry * mathSin(startAngle);
    if (this._start) {
      this._add('M', x0, y0);
    }
    var xRot = Math.round(psi * degree);
    if (isCircle) {
      var p = 1 / this._p;
      var dTheta_1 = (clockwise ? 1 : -1) * (PI2$1 - p);
      this._add('A', rx, ry, xRot, 1, +clockwise, cx + rx * mathCos(startAngle + dTheta_1), cy + ry * mathSin(startAngle + dTheta_1));
      if (p > 1e-2) {
        this._add('A', rx, ry, xRot, 0, +clockwise, x0, y0);
      }
    } else {
      var x = cx + rx * mathCos(endAngle);
      var y = cy + ry * mathSin(endAngle);
      this._add('A', rx, ry, xRot, +large, +clockwise, x, y);
    }
  };
  SVGPathRebuilder.prototype.rect = function (x, y, w, h) {
    this._add('M', x, y);
    this._add('l', w, 0);
    this._add('l', 0, h);
    this._add('l', -w, 0);
    this._add('Z');
  };
  SVGPathRebuilder.prototype.closePath = function () {
    if (this._d.length > 0) {
      this._add('Z');
    }
  };
  SVGPathRebuilder.prototype._add = function (cmd, a, b, c, d, e, f, g, h) {
    var vals = [];
    var p = this._p;
    for (var i = 1; i < arguments.length; i++) {
      var val = arguments[i];
      if (isNaN(val)) {
        this._invalid = true;
        return;
      }
      vals.push(Math.round(val * p) / p);
    }
    this._d.push(cmd + vals.join(' '));
    this._start = cmd === 'Z';
  };
  SVGPathRebuilder.prototype.generateStr = function () {
    this._str = this._invalid ? '' : this._d.join('');
    this._d = [];
  };
  SVGPathRebuilder.prototype.getStr = function () {
    return this._str;
  };
  return SVGPathRebuilder;
}();
var SVGPathRebuilder$1 = SVGPathRebuilder;

var NONE = 'none';
var mathRound = Math.round;
function pathHasFill(style) {
  var fill = style.fill;
  return fill != null && fill !== NONE;
}
function pathHasStroke(style) {
  var stroke = style.stroke;
  return stroke != null && stroke !== NONE;
}
var strokeProps = ['lineCap', 'miterLimit', 'lineJoin'];
var svgStrokeProps = map$1(strokeProps, function (prop) {
  return "stroke-" + prop.toLowerCase();
});
function mapStyleToAttrs(updateAttr, style, el, forceUpdate) {
  var opacity = style.opacity == null ? 1 : style.opacity;
  if (el instanceof ZRImage$1) {
    updateAttr('opacity', opacity);
    return;
  }
  if (pathHasFill(style)) {
    var fill = normalizeColor(style.fill);
    updateAttr('fill', fill.color);
    var fillOpacity = style.fillOpacity != null ? style.fillOpacity * fill.opacity * opacity : fill.opacity * opacity;
    if (forceUpdate || fillOpacity < 1) {
      updateAttr('fill-opacity', fillOpacity);
    }
  } else {
    updateAttr('fill', NONE);
  }
  if (pathHasStroke(style)) {
    var stroke = normalizeColor(style.stroke);
    updateAttr('stroke', stroke.color);
    var strokeScale = style.strokeNoScale ? el.getLineScale() : 1;
    var strokeWidth = strokeScale ? (style.lineWidth || 0) / strokeScale : 0;
    var strokeOpacity = style.strokeOpacity != null ? style.strokeOpacity * stroke.opacity * opacity : stroke.opacity * opacity;
    var strokeFirst = style.strokeFirst;
    if (forceUpdate || strokeWidth !== 1) {
      updateAttr('stroke-width', strokeWidth);
    }
    if (forceUpdate || strokeFirst) {
      updateAttr('paint-order', strokeFirst ? 'stroke' : 'fill');
    }
    if (forceUpdate || strokeOpacity < 1) {
      updateAttr('stroke-opacity', strokeOpacity);
    }
    if (style.lineDash) {
      var _a = getLineDash(el),
        lineDash = _a[0],
        lineDashOffset = _a[1];
      if (lineDash) {
        lineDashOffset = mathRound(lineDashOffset || 0);
        updateAttr('stroke-dasharray', lineDash.join(','));
        if (lineDashOffset || forceUpdate) {
          updateAttr('stroke-dashoffset', lineDashOffset);
        }
      }
    } else if (forceUpdate) {
      updateAttr('stroke-dasharray', NONE);
    }
    for (var i = 0; i < strokeProps.length; i++) {
      var propName = strokeProps[i];
      if (forceUpdate || style[propName] !== DEFAULT_PATH_STYLE[propName]) {
        var val = style[propName] || DEFAULT_PATH_STYLE[propName];
        val && updateAttr(svgStrokeProps[i], val);
      }
    }
  } else if (forceUpdate) {
    updateAttr('stroke', NONE);
  }
}

var SVGNS = 'http://www.w3.org/2000/svg';
var XLINKNS = 'http://www.w3.org/1999/xlink';
var XMLNS = 'http://www.w3.org/2000/xmlns/';
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
var META_DATA_PREFIX = 'ecmeta_';
function createElement(name) {
  return document.createElementNS(SVGNS, name);
}
function createVNode(tag, key, attrs, children, text) {
  return {
    tag: tag,
    attrs: attrs || {},
    children: children,
    text: text,
    key: key
  };
}
function createElementOpen(name, attrs) {
  var attrsStr = [];
  if (attrs) {
    for (var key in attrs) {
      var val = attrs[key];
      var part = key;
      if (val === false) {
        continue;
      } else if (val !== true && val != null) {
        part += "=\"" + val + "\"";
      }
      attrsStr.push(part);
    }
  }
  return "<" + name + " " + attrsStr.join(' ') + ">";
}
function createElementClose(name) {
  return "</" + name + ">";
}
function vNodeToString(el, opts) {
  opts = opts || {};
  var S = opts.newline ? '\n' : '';
  function convertElToString(el) {
    var children = el.children,
      tag = el.tag,
      attrs = el.attrs,
      text = el.text;
    return createElementOpen(tag, attrs) + (tag !== 'style' ? encodeHTML(text) : text || '') + (children ? "" + S + map$1(children, function (child) {
      return convertElToString(child);
    }).join(S) + S : '') + createElementClose(tag);
  }
  return convertElToString(el);
}
function getCssString(selectorNodes, animationNodes, opts) {
  opts = opts || {};
  var S = opts.newline ? '\n' : '';
  var bracketBegin = " {" + S;
  var bracketEnd = S + "}";
  var selectors = map$1(keys(selectorNodes), function (className) {
    return className + bracketBegin + map$1(keys(selectorNodes[className]), function (attrName) {
      return attrName + ":" + selectorNodes[className][attrName] + ";";
    }).join(S) + bracketEnd;
  }).join(S);
  var animations = map$1(keys(animationNodes), function (animationName) {
    return "@keyframes " + animationName + bracketBegin + map$1(keys(animationNodes[animationName]), function (percent) {
      return percent + bracketBegin + map$1(keys(animationNodes[animationName][percent]), function (attrName) {
        var val = animationNodes[animationName][percent][attrName];
        if (attrName === 'd') {
          val = "path(\"" + val + "\")";
        }
        return attrName + ":" + val + ";";
      }).join(S) + bracketEnd;
    }).join(S) + bracketEnd;
  }).join(S);
  if (!selectors && !animations) {
    return '';
  }
  return ['<![CDATA[', selectors, animations, ']]>'].join(S);
}
function createBrushScope(zrId) {
  return {
    zrId: zrId,
    shadowCache: {},
    patternCache: {},
    gradientCache: {},
    clipPathCache: {},
    defs: {},
    cssNodes: {},
    cssAnims: {},
    cssStyleCache: {},
    cssAnimIdx: 0,
    shadowIdx: 0,
    gradientIdx: 0,
    patternIdx: 0,
    clipPathIdx: 0
  };
}
function createSVGVNode(width, height, children, useViewBox) {
  return createVNode('svg', 'root', {
    'width': width,
    'height': height,
    'xmlns': SVGNS,
    'xmlns:xlink': XLINKNS,
    'version': '1.1',
    'baseProfile': 'full',
    'viewBox': useViewBox ? "0 0 " + width + " " + height : false
  }, children);
}

var cssClassIdx = 0;
function getClassId() {
  return cssClassIdx++;
}

var EASING_MAP = {
  cubicIn: '0.32,0,0.67,0',
  cubicOut: '0.33,1,0.68,1',
  cubicInOut: '0.65,0,0.35,1',
  quadraticIn: '0.11,0,0.5,0',
  quadraticOut: '0.5,1,0.89,1',
  quadraticInOut: '0.45,0,0.55,1',
  quarticIn: '0.5,0,0.75,0',
  quarticOut: '0.25,1,0.5,1',
  quarticInOut: '0.76,0,0.24,1',
  quinticIn: '0.64,0,0.78,0',
  quinticOut: '0.22,1,0.36,1',
  quinticInOut: '0.83,0,0.17,1',
  sinusoidalIn: '0.12,0,0.39,0',
  sinusoidalOut: '0.61,1,0.88,1',
  sinusoidalInOut: '0.37,0,0.63,1',
  exponentialIn: '0.7,0,0.84,0',
  exponentialOut: '0.16,1,0.3,1',
  exponentialInOut: '0.87,0,0.13,1',
  circularIn: '0.55,0,1,0.45',
  circularOut: '0,0.55,0.45,1',
  circularInOut: '0.85,0,0.15,1'
};
var transformOriginKey = 'transform-origin';
function buildPathString(el, kfShape, path) {
  var shape = extend({}, el.shape);
  extend(shape, kfShape);
  el.buildPath(path, shape);
  var svgPathBuilder = new SVGPathRebuilder$1();
  svgPathBuilder.reset(getPathPrecision(el));
  path.rebuildPath(svgPathBuilder, 1);
  svgPathBuilder.generateStr();
  return svgPathBuilder.getStr();
}
function setTransformOrigin(target, transform) {
  var originX = transform.originX,
    originY = transform.originY;
  if (originX || originY) {
    target[transformOriginKey] = originX + "px " + originY + "px";
  }
}
var ANIMATE_STYLE_MAP = {
  fill: 'fill',
  opacity: 'opacity',
  lineWidth: 'stroke-width',
  lineDashOffset: 'stroke-dashoffset'
};
function addAnimation(cssAnim, scope) {
  var animationName = scope.zrId + '-ani-' + scope.cssAnimIdx++;
  scope.cssAnims[animationName] = cssAnim;
  return animationName;
}
function createCompoundPathCSSAnimation(el, attrs, scope) {
  var paths = el.shape.paths;
  var composedAnim = {};
  var cssAnimationCfg;
  var cssAnimationName;
  each$f(paths, function (path) {
    var subScope = createBrushScope(scope.zrId);
    subScope.animation = true;
    createCSSAnimation(path, {}, subScope, true);
    var cssAnims = subScope.cssAnims;
    var cssNodes = subScope.cssNodes;
    var animNames = keys(cssAnims);
    var len = animNames.length;
    if (!len) {
      return;
    }
    cssAnimationName = animNames[len - 1];
    var lastAnim = cssAnims[cssAnimationName];
    for (var percent in lastAnim) {
      var kf = lastAnim[percent];
      composedAnim[percent] = composedAnim[percent] || {
        d: ''
      };
      composedAnim[percent].d += kf.d || '';
    }
    for (var className in cssNodes) {
      var val = cssNodes[className].animation;
      if (val.indexOf(cssAnimationName) >= 0) {
        cssAnimationCfg = val;
      }
    }
  });
  if (!cssAnimationCfg) {
    return;
  }
  attrs.d = false;
  var animationName = addAnimation(composedAnim, scope);
  return cssAnimationCfg.replace(cssAnimationName, animationName);
}
function getEasingFunc(easing) {
  return isString(easing) ? EASING_MAP[easing] ? "cubic-bezier(" + EASING_MAP[easing] + ")" : createCubicEasingFunc(easing) ? easing : '' : '';
}
function createCSSAnimation(el, attrs, scope, onlyShape) {
  var animators = el.animators;
  var len = animators.length;
  var cssAnimations = [];
  if (el instanceof CompoundPath$1) {
    var animationCfg = createCompoundPathCSSAnimation(el, attrs, scope);
    if (animationCfg) {
      cssAnimations.push(animationCfg);
    } else if (!len) {
      return;
    }
  } else if (!len) {
    return;
  }
  var groupAnimators = {};
  for (var i = 0; i < len; i++) {
    var animator = animators[i];
    var cfgArr = [animator.getMaxTime() / 1000 + 's'];
    var easing = getEasingFunc(animator.getClip().easing);
    var delay = animator.getDelay();
    if (easing) {
      cfgArr.push(easing);
    } else {
      cfgArr.push('linear');
    }
    if (delay) {
      cfgArr.push(delay / 1000 + 's');
    }
    if (animator.getLoop()) {
      cfgArr.push('infinite');
    }
    var cfg = cfgArr.join(' ');
    groupAnimators[cfg] = groupAnimators[cfg] || [cfg, []];
    groupAnimators[cfg][1].push(animator);
  }
  function createSingleCSSAnimation(groupAnimator) {
    var animators = groupAnimator[1];
    var len = animators.length;
    var transformKfs = {};
    var shapeKfs = {};
    var finalKfs = {};
    var animationTimingFunctionAttrName = 'animation-timing-function';
    function saveAnimatorTrackToCssKfs(animator, cssKfs, toCssAttrName) {
      var tracks = animator.getTracks();
      var maxTime = animator.getMaxTime();
      for (var k = 0; k < tracks.length; k++) {
        var track = tracks[k];
        if (track.needsAnimate()) {
          var kfs = track.keyframes;
          var attrName = track.propName;
          toCssAttrName && (attrName = toCssAttrName(attrName));
          if (attrName) {
            for (var i = 0; i < kfs.length; i++) {
              var kf = kfs[i];
              var percent = Math.round(kf.time / maxTime * 100) + '%';
              var kfEasing = getEasingFunc(kf.easing);
              var rawValue = kf.rawValue;
              if (isString(rawValue) || isNumber(rawValue)) {
                cssKfs[percent] = cssKfs[percent] || {};
                cssKfs[percent][attrName] = kf.rawValue;
                if (kfEasing) {
                  cssKfs[percent][animationTimingFunctionAttrName] = kfEasing;
                }
              }
            }
          }
        }
      }
    }
    for (var i = 0; i < len; i++) {
      var animator = animators[i];
      var targetProp = animator.targetName;
      if (!targetProp) {
        !onlyShape && saveAnimatorTrackToCssKfs(animator, transformKfs);
      } else if (targetProp === 'shape') {
        saveAnimatorTrackToCssKfs(animator, shapeKfs);
      }
    }
    for (var percent in transformKfs) {
      var transform = {};
      copyTransform(transform, el);
      extend(transform, transformKfs[percent]);
      var str = getSRTTransformString(transform);
      var timingFunction = transformKfs[percent][animationTimingFunctionAttrName];
      finalKfs[percent] = str ? {
        transform: str
      } : {};
      setTransformOrigin(finalKfs[percent], transform);
      if (timingFunction) {
        finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;
      }
    }
    var path;
    var canAnimateShape = true;
    for (var percent in shapeKfs) {
      finalKfs[percent] = finalKfs[percent] || {};
      var isFirst = !path;
      var timingFunction = shapeKfs[percent][animationTimingFunctionAttrName];
      if (isFirst) {
        path = new PathProxy();
      }
      var len_1 = path.len();
      path.reset();
      finalKfs[percent].d = buildPathString(el, shapeKfs[percent], path);
      var newLen = path.len();
      if (!isFirst && len_1 !== newLen) {
        canAnimateShape = false;
        break;
      }
      if (timingFunction) {
        finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;
      }
    }
    if (!canAnimateShape) {
      for (var percent in finalKfs) {
        delete finalKfs[percent].d;
      }
    }
    if (!onlyShape) {
      for (var i = 0; i < len; i++) {
        var animator = animators[i];
        var targetProp = animator.targetName;
        if (targetProp === 'style') {
          saveAnimatorTrackToCssKfs(animator, finalKfs, function (propName) {
            return ANIMATE_STYLE_MAP[propName];
          });
        }
      }
    }
    var percents = keys(finalKfs);
    var allTransformOriginSame = true;
    var transformOrigin;
    for (var i = 1; i < percents.length; i++) {
      var p0 = percents[i - 1];
      var p1 = percents[i];
      if (finalKfs[p0][transformOriginKey] !== finalKfs[p1][transformOriginKey]) {
        allTransformOriginSame = false;
        break;
      }
      transformOrigin = finalKfs[p0][transformOriginKey];
    }
    if (allTransformOriginSame && transformOrigin) {
      for (var percent in finalKfs) {
        if (finalKfs[percent][transformOriginKey]) {
          delete finalKfs[percent][transformOriginKey];
        }
      }
      attrs[transformOriginKey] = transformOrigin;
    }
    if (filter(percents, function (percent) {
      return keys(finalKfs[percent]).length > 0;
    }).length) {
      var animationName = addAnimation(finalKfs, scope);
      return animationName + " " + groupAnimator[0] + " both";
    }
  }
  for (var key in groupAnimators) {
    var animationCfg = createSingleCSSAnimation(groupAnimators[key]);
    if (animationCfg) {
      cssAnimations.push(animationCfg);
    }
  }
  if (cssAnimations.length) {
    var className = scope.zrId + '-cls-' + getClassId();
    scope.cssNodes['.' + className] = {
      animation: cssAnimations.join(',')
    };
    attrs["class"] = className;
  }
}

function createCSSEmphasis(el, attrs, scope) {
  if (!el.ignore) {
    if (el.isSilent()) {
      var style = {
        'pointer-events': 'none'
      };
      setClassAttribute(style, attrs, scope, true);
    } else {
      var emphasisStyle = el.states.emphasis && el.states.emphasis.style ? el.states.emphasis.style : {};
      var fill = emphasisStyle.fill;
      if (!fill) {
        var normalFill = el.style && el.style.fill;
        var selectFill = el.states.select && el.states.select.style && el.states.select.style.fill;
        var fromFill = el.currentStates.indexOf('select') >= 0 ? selectFill || normalFill : normalFill;
        if (fromFill) {
          fill = liftColor(fromFill);
        }
      }
      var lineWidth = emphasisStyle.lineWidth;
      if (lineWidth) {
        var scaleX = !emphasisStyle.strokeNoScale && el.transform ? el.transform[0] : 1;
        lineWidth = lineWidth / scaleX;
      }
      var style = {
        cursor: 'pointer'
      };
      if (fill) {
        style.fill = fill;
      }
      if (emphasisStyle.stroke) {
        style.stroke = emphasisStyle.stroke;
      }
      if (lineWidth) {
        style['stroke-width'] = lineWidth;
      }
      setClassAttribute(style, attrs, scope, true);
    }
  }
}
function setClassAttribute(style, attrs, scope, withHover) {
  var styleKey = JSON.stringify(style);
  var className = scope.cssStyleCache[styleKey];
  if (!className) {
    className = scope.zrId + '-cls-' + getClassId();
    scope.cssStyleCache[styleKey] = className;
    scope.cssNodes['.' + className + (withHover ? ':hover' : '')] = style;
  }
  attrs["class"] = attrs["class"] ? attrs["class"] + ' ' + className : className;
}

var round$2 = Math.round;
function isImageLike(val) {
  return val && isString(val.src);
}
function isCanvasLike(val) {
  return val && isFunction(val.toDataURL);
}
function setStyleAttrs(attrs, style, el, scope) {
  mapStyleToAttrs(function (key, val) {
    var isFillStroke = key === 'fill' || key === 'stroke';
    if (isFillStroke && isGradient(val)) {
      setGradient(style, attrs, key, scope);
    } else if (isFillStroke && isPattern(val)) {
      setPattern(el, attrs, key, scope);
    } else {
      attrs[key] = val;
    }
    if (isFillStroke && scope.ssr && val === 'none') {
      attrs['pointer-events'] = 'visible';
    }
  }, style, el, false);
  setShadow(el, attrs, scope);
}
function setMetaData(attrs, el) {
  var metaData = getElementSSRData(el);
  if (metaData) {
    metaData.each(function (val, key) {
      val != null && (attrs[(META_DATA_PREFIX + key).toLowerCase()] = val + '');
    });
    if (el.isSilent()) {
      attrs[META_DATA_PREFIX + 'silent'] = 'true';
    }
  }
}
function noRotateScale(m) {
  return isAroundZero(m[0] - 1) && isAroundZero(m[1]) && isAroundZero(m[2]) && isAroundZero(m[3] - 1);
}
function noTranslate(m) {
  return isAroundZero(m[4]) && isAroundZero(m[5]);
}
function setTransform(attrs, m, compress) {
  if (m && !(noTranslate(m) && noRotateScale(m))) {
    var mul = compress ? 10 : 1e4;
    attrs.transform = noRotateScale(m) ? "translate(" + round$2(m[4] * mul) / mul + " " + round$2(m[5] * mul) / mul + ")" : getMatrixStr(m);
  }
}
function convertPolyShape(shape, attrs, mul) {
  var points = shape.points;
  var strArr = [];
  for (var i = 0; i < points.length; i++) {
    strArr.push(round$2(points[i][0] * mul) / mul);
    strArr.push(round$2(points[i][1] * mul) / mul);
  }
  attrs.points = strArr.join(' ');
}
function validatePolyShape(shape) {
  return !shape.smooth;
}
function createAttrsConvert(desc) {
  var normalizedDesc = map$1(desc, function (item) {
    return typeof item === 'string' ? [item, item] : item;
  });
  return function (shape, attrs, mul) {
    for (var i = 0; i < normalizedDesc.length; i++) {
      var item = normalizedDesc[i];
      var val = shape[item[0]];
      if (val != null) {
        attrs[item[1]] = round$2(val * mul) / mul;
      }
    }
  };
}
var builtinShapesDef = {
  circle: [createAttrsConvert(['cx', 'cy', 'r'])],
  polyline: [convertPolyShape, validatePolyShape],
  polygon: [convertPolyShape, validatePolyShape]
};
function hasShapeAnimation(el) {
  var animators = el.animators;
  for (var i = 0; i < animators.length; i++) {
    if (animators[i].targetName === 'shape') {
      return true;
    }
  }
  return false;
}
function brushSVGPath(el, scope) {
  var style = el.style;
  var shape = el.shape;
  var builtinShpDef = builtinShapesDef[el.type];
  var attrs = {};
  var needsAnimate = scope.animation;
  var svgElType = 'path';
  var strokePercent = el.style.strokePercent;
  var precision = scope.compress && getPathPrecision(el) || 4;
  if (builtinShpDef && !scope.willUpdate && !(builtinShpDef[1] && !builtinShpDef[1](shape)) && !(needsAnimate && hasShapeAnimation(el)) && !(strokePercent < 1)) {
    svgElType = el.type;
    var mul = Math.pow(10, precision);
    builtinShpDef[0](shape, attrs, mul);
  } else {
    var needBuildPath = !el.path || el.shapeChanged();
    if (!el.path) {
      el.createPathProxy();
    }
    var path = el.path;
    if (needBuildPath) {
      path.beginPath();
      el.buildPath(path, el.shape);
      el.pathUpdated();
    }
    var pathVersion = path.getVersion();
    var elExt = el;
    var svgPathBuilder = elExt.__svgPathBuilder;
    if (elExt.__svgPathVersion !== pathVersion || !svgPathBuilder || strokePercent !== elExt.__svgPathStrokePercent) {
      if (!svgPathBuilder) {
        svgPathBuilder = elExt.__svgPathBuilder = new SVGPathRebuilder$1();
      }
      svgPathBuilder.reset(precision);
      path.rebuildPath(svgPathBuilder, strokePercent);
      svgPathBuilder.generateStr();
      elExt.__svgPathVersion = pathVersion;
      elExt.__svgPathStrokePercent = strokePercent;
    }
    attrs.d = svgPathBuilder.getStr();
  }
  setTransform(attrs, el.transform);
  setStyleAttrs(attrs, style, el, scope);
  setMetaData(attrs, el);
  scope.animation && createCSSAnimation(el, attrs, scope);
  scope.emphasis && createCSSEmphasis(el, attrs, scope);
  return createVNode(svgElType, el.id + '', attrs);
}
function brushSVGImage(el, scope) {
  var style = el.style;
  var image = style.image;
  if (image && !isString(image)) {
    if (isImageLike(image)) {
      image = image.src;
    } else if (isCanvasLike(image)) {
      image = image.toDataURL();
    }
  }
  if (!image) {
    return;
  }
  var x = style.x || 0;
  var y = style.y || 0;
  var dw = style.width;
  var dh = style.height;
  var attrs = {
    href: image,
    width: dw,
    height: dh
  };
  if (x) {
    attrs.x = x;
  }
  if (y) {
    attrs.y = y;
  }
  setTransform(attrs, el.transform);
  setStyleAttrs(attrs, style, el, scope);
  setMetaData(attrs, el);
  scope.animation && createCSSAnimation(el, attrs, scope);
  return createVNode('image', el.id + '', attrs);
}
function brushSVGTSpan(el, scope) {
  var style = el.style;
  var text = style.text;
  text != null && (text += '');
  if (!text || isNaN(style.x) || isNaN(style.y)) {
    return;
  }
  var font = style.font || DEFAULT_FONT;
  var x = style.x || 0;
  var y = adjustTextY$1(style.y || 0, getLineHeight(font), style.textBaseline);
  var textAlign = TEXT_ALIGN_TO_ANCHOR[style.textAlign] || style.textAlign;
  var attrs = {
    'dominant-baseline': 'central',
    'text-anchor': textAlign
  };
  if (hasSeparateFont(style)) {
    var separatedFontStr = '';
    var fontStyle = style.fontStyle;
    var fontSize = parseFontSize(style.fontSize);
    if (!parseFloat(fontSize)) {
      return;
    }
    var fontFamily = style.fontFamily || DEFAULT_FONT_FAMILY;
    var fontWeight = style.fontWeight;
    separatedFontStr += "font-size:" + fontSize + ";font-family:" + fontFamily + ";";
    if (fontStyle && fontStyle !== 'normal') {
      separatedFontStr += "font-style:" + fontStyle + ";";
    }
    if (fontWeight && fontWeight !== 'normal') {
      separatedFontStr += "font-weight:" + fontWeight + ";";
    }
    attrs.style = separatedFontStr;
  } else {
    attrs.style = "font: " + font;
  }
  if (text.match(/\s/)) {
    attrs['xml:space'] = 'preserve';
  }
  if (x) {
    attrs.x = x;
  }
  if (y) {
    attrs.y = y;
  }
  setTransform(attrs, el.transform);
  setStyleAttrs(attrs, style, el, scope);
  setMetaData(attrs, el);
  scope.animation && createCSSAnimation(el, attrs, scope);
  return createVNode('text', el.id + '', attrs, undefined, text);
}
function brush(el, scope) {
  if (el instanceof Path$1) {
    return brushSVGPath(el, scope);
  } else if (el instanceof ZRImage$1) {
    return brushSVGImage(el, scope);
  } else if (el instanceof TSpan$1) {
    return brushSVGTSpan(el, scope);
  }
}
function setShadow(el, attrs, scope) {
  var style = el.style;
  if (hasShadow(style)) {
    var shadowKey = getShadowKey(el);
    var shadowCache = scope.shadowCache;
    var shadowId = shadowCache[shadowKey];
    if (!shadowId) {
      var globalScale = el.getGlobalScale();
      var scaleX = globalScale[0];
      var scaleY = globalScale[1];
      if (!scaleX || !scaleY) {
        return;
      }
      var offsetX = style.shadowOffsetX || 0;
      var offsetY = style.shadowOffsetY || 0;
      var blur_1 = style.shadowBlur;
      var _a = normalizeColor(style.shadowColor),
        opacity = _a.opacity,
        color = _a.color;
      var stdDx = blur_1 / 2 / scaleX;
      var stdDy = blur_1 / 2 / scaleY;
      var stdDeviation = stdDx + ' ' + stdDy;
      shadowId = scope.zrId + '-s' + scope.shadowIdx++;
      scope.defs[shadowId] = createVNode('filter', shadowId, {
        'id': shadowId,
        'x': '-100%',
        'y': '-100%',
        'width': '300%',
        'height': '300%'
      }, [createVNode('feDropShadow', '', {
        'dx': offsetX / scaleX,
        'dy': offsetY / scaleY,
        'stdDeviation': stdDeviation,
        'flood-color': color,
        'flood-opacity': opacity
      })]);
      shadowCache[shadowKey] = shadowId;
    }
    attrs.filter = getIdURL(shadowId);
  }
}
function setGradient(style, attrs, target, scope) {
  var val = style[target];
  var gradientTag;
  var gradientAttrs = {
    'gradientUnits': val.global ? 'userSpaceOnUse' : 'objectBoundingBox'
  };
  if (isLinearGradient(val)) {
    gradientTag = 'linearGradient';
    gradientAttrs.x1 = val.x;
    gradientAttrs.y1 = val.y;
    gradientAttrs.x2 = val.x2;
    gradientAttrs.y2 = val.y2;
  } else if (isRadialGradient(val)) {
    gradientTag = 'radialGradient';
    gradientAttrs.cx = retrieve2(val.x, 0.5);
    gradientAttrs.cy = retrieve2(val.y, 0.5);
    gradientAttrs.r = retrieve2(val.r, 0.5);
  } else {
    {
      logError('Illegal gradient type.');
    }
    return;
  }
  var colors = val.colorStops;
  var colorStops = [];
  for (var i = 0, len = colors.length; i < len; ++i) {
    var offset = round4(colors[i].offset) * 100 + '%';
    var stopColor = colors[i].color;
    var _a = normalizeColor(stopColor),
      color = _a.color,
      opacity = _a.opacity;
    var stopsAttrs = {
      'offset': offset
    };
    stopsAttrs['stop-color'] = color;
    if (opacity < 1) {
      stopsAttrs['stop-opacity'] = opacity;
    }
    colorStops.push(createVNode('stop', i + '', stopsAttrs));
  }
  var gradientVNode = createVNode(gradientTag, '', gradientAttrs, colorStops);
  var gradientKey = vNodeToString(gradientVNode);
  var gradientCache = scope.gradientCache;
  var gradientId = gradientCache[gradientKey];
  if (!gradientId) {
    gradientId = scope.zrId + '-g' + scope.gradientIdx++;
    gradientCache[gradientKey] = gradientId;
    gradientAttrs.id = gradientId;
    scope.defs[gradientId] = createVNode(gradientTag, gradientId, gradientAttrs, colorStops);
  }
  attrs[target] = getIdURL(gradientId);
}
function setPattern(el, attrs, target, scope) {
  var val = el.style[target];
  var boundingRect = el.getBoundingRect();
  var patternAttrs = {};
  var repeat = val.repeat;
  var noRepeat = repeat === 'no-repeat';
  var repeatX = repeat === 'repeat-x';
  var repeatY = repeat === 'repeat-y';
  var child;
  if (isImagePattern(val)) {
    var imageWidth_1 = val.imageWidth;
    var imageHeight_1 = val.imageHeight;
    var imageSrc = void 0;
    var patternImage = val.image;
    if (isString(patternImage)) {
      imageSrc = patternImage;
    } else if (isImageLike(patternImage)) {
      imageSrc = patternImage.src;
    } else if (isCanvasLike(patternImage)) {
      imageSrc = patternImage.toDataURL();
    }
    if (typeof Image === 'undefined') {
      var errMsg = 'Image width/height must been given explictly in svg-ssr renderer.';
      assert(imageWidth_1, errMsg);
      assert(imageHeight_1, errMsg);
    } else if (imageWidth_1 == null || imageHeight_1 == null) {
      var setSizeToVNode_1 = function (vNode, img) {
        if (vNode) {
          var svgEl = vNode.elm;
          var width = imageWidth_1 || img.width;
          var height = imageHeight_1 || img.height;
          if (vNode.tag === 'pattern') {
            if (repeatX) {
              height = 1;
              width /= boundingRect.width;
            } else if (repeatY) {
              width = 1;
              height /= boundingRect.height;
            }
          }
          vNode.attrs.width = width;
          vNode.attrs.height = height;
          if (svgEl) {
            svgEl.setAttribute('width', width);
            svgEl.setAttribute('height', height);
          }
        }
      };
      var createdImage = createOrUpdateImage(imageSrc, null, el, function (img) {
        noRepeat || setSizeToVNode_1(patternVNode, img);
        setSizeToVNode_1(child, img);
      });
      if (createdImage && createdImage.width && createdImage.height) {
        imageWidth_1 = imageWidth_1 || createdImage.width;
        imageHeight_1 = imageHeight_1 || createdImage.height;
      }
    }
    child = createVNode('image', 'img', {
      href: imageSrc,
      width: imageWidth_1,
      height: imageHeight_1
    });
    patternAttrs.width = imageWidth_1;
    patternAttrs.height = imageHeight_1;
  } else if (val.svgElement) {
    child = clone$4(val.svgElement);
    patternAttrs.width = val.svgWidth;
    patternAttrs.height = val.svgHeight;
  }
  if (!child) {
    return;
  }
  var patternWidth;
  var patternHeight;
  if (noRepeat) {
    patternWidth = patternHeight = 1;
  } else if (repeatX) {
    patternHeight = 1;
    patternWidth = patternAttrs.width / boundingRect.width;
  } else if (repeatY) {
    patternWidth = 1;
    patternHeight = patternAttrs.height / boundingRect.height;
  } else {
    patternAttrs.patternUnits = 'userSpaceOnUse';
  }
  if (patternWidth != null && !isNaN(patternWidth)) {
    patternAttrs.width = patternWidth;
  }
  if (patternHeight != null && !isNaN(patternHeight)) {
    patternAttrs.height = patternHeight;
  }
  var patternTransform = getSRTTransformString(val);
  patternTransform && (patternAttrs.patternTransform = patternTransform);
  var patternVNode = createVNode('pattern', '', patternAttrs, [child]);
  var patternKey = vNodeToString(patternVNode);
  var patternCache = scope.patternCache;
  var patternId = patternCache[patternKey];
  if (!patternId) {
    patternId = scope.zrId + '-p' + scope.patternIdx++;
    patternCache[patternKey] = patternId;
    patternAttrs.id = patternId;
    patternVNode = scope.defs[patternId] = createVNode('pattern', patternId, patternAttrs, [child]);
  }
  attrs[target] = getIdURL(patternId);
}
function setClipPath(clipPath, attrs, scope) {
  var clipPathCache = scope.clipPathCache,
    defs = scope.defs;
  var clipPathId = clipPathCache[clipPath.id];
  if (!clipPathId) {
    clipPathId = scope.zrId + '-c' + scope.clipPathIdx++;
    var clipPathAttrs = {
      id: clipPathId
    };
    clipPathCache[clipPath.id] = clipPathId;
    defs[clipPathId] = createVNode('clipPath', clipPathId, clipPathAttrs, [brushSVGPath(clipPath, scope)]);
  }
  attrs['clip-path'] = getIdURL(clipPathId);
}

function createTextNode(text) {
  return document.createTextNode(text);
}
function insertBefore(parentNode, newNode, referenceNode) {
  parentNode.insertBefore(newNode, referenceNode);
}
function removeChild(node, child) {
  node.removeChild(child);
}
function appendChild(node, child) {
  node.appendChild(child);
}
function parentNode(node) {
  return node.parentNode;
}
function nextSibling(node) {
  return node.nextSibling;
}
function setTextContent(node, text) {
  node.textContent = text;
}

var colonChar = 58;
var xChar = 120;
var emptyNode = createVNode('', '');
function isUndef(s) {
  return s === undefined;
}
function isDef(s) {
  return s !== undefined;
}
function createKeyToOldIdx(children, beginIdx, endIdx) {
  var map = {};
  for (var i = beginIdx; i <= endIdx; ++i) {
    var key = children[i].key;
    if (key !== undefined) {
      {
        if (map[key] != null) {
          console.error("Duplicate key " + key);
        }
      }
      map[key] = i;
    }
  }
  return map;
}
function sameVnode(vnode1, vnode2) {
  var isSameKey = vnode1.key === vnode2.key;
  var isSameTag = vnode1.tag === vnode2.tag;
  return isSameTag && isSameKey;
}
function createElm(vnode) {
  var i;
  var children = vnode.children;
  var tag = vnode.tag;
  if (isDef(tag)) {
    var elm = vnode.elm = createElement(tag);
    updateAttrs(emptyNode, vnode);
    if (isArray$1(children)) {
      for (i = 0; i < children.length; ++i) {
        var ch = children[i];
        if (ch != null) {
          appendChild(elm, createElm(ch));
        }
      }
    } else if (isDef(vnode.text) && !isObject$3(vnode.text)) {
      appendChild(elm, createTextNode(vnode.text));
    }
  } else {
    vnode.elm = createTextNode(vnode.text);
  }
  return vnode.elm;
}
function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
  for (; startIdx <= endIdx; ++startIdx) {
    var ch = vnodes[startIdx];
    if (ch != null) {
      insertBefore(parentElm, createElm(ch), before);
    }
  }
}
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
  for (; startIdx <= endIdx; ++startIdx) {
    var ch = vnodes[startIdx];
    if (ch != null) {
      if (isDef(ch.tag)) {
        var parent_1 = parentNode(ch.elm);
        removeChild(parent_1, ch.elm);
      } else {
        removeChild(parentElm, ch.elm);
      }
    }
  }
}
function updateAttrs(oldVnode, vnode) {
  var key;
  var elm = vnode.elm;
  var oldAttrs = oldVnode && oldVnode.attrs || {};
  var attrs = vnode.attrs || {};
  if (oldAttrs === attrs) {
    return;
  }
  for (key in attrs) {
    var cur = attrs[key];
    var old = oldAttrs[key];
    if (old !== cur) {
      if (cur === true) {
        elm.setAttribute(key, '');
      } else if (cur === false) {
        elm.removeAttribute(key);
      } else {
        if (key === 'style') {
          elm.style.cssText = cur;
        } else if (key.charCodeAt(0) !== xChar) {
          elm.setAttribute(key, cur);
        } else if (key === 'xmlns:xlink' || key === 'xmlns') {
          elm.setAttributeNS(XMLNS, key, cur);
        } else if (key.charCodeAt(3) === colonChar) {
          elm.setAttributeNS(XML_NAMESPACE, key, cur);
        } else if (key.charCodeAt(5) === colonChar) {
          elm.setAttributeNS(XLINKNS, key, cur);
        } else {
          elm.setAttribute(key, cur);
        }
      }
    }
  }
  for (key in oldAttrs) {
    if (!(key in attrs)) {
      elm.removeAttribute(key);
    }
  }
}
function updateChildren(parentElm, oldCh, newCh) {
  var oldStartIdx = 0;
  var newStartIdx = 0;
  var oldEndIdx = oldCh.length - 1;
  var oldStartVnode = oldCh[0];
  var oldEndVnode = oldCh[oldEndIdx];
  var newEndIdx = newCh.length - 1;
  var newStartVnode = newCh[0];
  var newEndVnode = newCh[newEndIdx];
  var oldKeyToIdx;
  var idxInOld;
  var elmToMove;
  var before;
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
    if (oldStartVnode == null) {
      oldStartVnode = oldCh[++oldStartIdx];
    } else if (oldEndVnode == null) {
      oldEndVnode = oldCh[--oldEndIdx];
    } else if (newStartVnode == null) {
      newStartVnode = newCh[++newStartIdx];
    } else if (newEndVnode == null) {
      newEndVnode = newCh[--newEndIdx];
    } else if (sameVnode(oldStartVnode, newStartVnode)) {
      patchVnode(oldStartVnode, newStartVnode);
      oldStartVnode = oldCh[++oldStartIdx];
      newStartVnode = newCh[++newStartIdx];
    } else if (sameVnode(oldEndVnode, newEndVnode)) {
      patchVnode(oldEndVnode, newEndVnode);
      oldEndVnode = oldCh[--oldEndIdx];
      newEndVnode = newCh[--newEndIdx];
    } else if (sameVnode(oldStartVnode, newEndVnode)) {
      patchVnode(oldStartVnode, newEndVnode);
      insertBefore(parentElm, oldStartVnode.elm, nextSibling(oldEndVnode.elm));
      oldStartVnode = oldCh[++oldStartIdx];
      newEndVnode = newCh[--newEndIdx];
    } else if (sameVnode(oldEndVnode, newStartVnode)) {
      patchVnode(oldEndVnode, newStartVnode);
      insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
      oldEndVnode = oldCh[--oldEndIdx];
      newStartVnode = newCh[++newStartIdx];
    } else {
      if (isUndef(oldKeyToIdx)) {
        oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
      }
      idxInOld = oldKeyToIdx[newStartVnode.key];
      if (isUndef(idxInOld)) {
        insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm);
      } else {
        elmToMove = oldCh[idxInOld];
        if (elmToMove.tag !== newStartVnode.tag) {
          insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm);
        } else {
          patchVnode(elmToMove, newStartVnode);
          oldCh[idxInOld] = undefined;
          insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
        }
      }
      newStartVnode = newCh[++newStartIdx];
    }
  }
  if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
    if (oldStartIdx > oldEndIdx) {
      before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;
      addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
    } else {
      removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
    }
  }
}
function patchVnode(oldVnode, vnode) {
  var elm = vnode.elm = oldVnode.elm;
  var oldCh = oldVnode.children;
  var ch = vnode.children;
  if (oldVnode === vnode) {
    return;
  }
  updateAttrs(oldVnode, vnode);
  if (isUndef(vnode.text)) {
    if (isDef(oldCh) && isDef(ch)) {
      if (oldCh !== ch) {
        updateChildren(elm, oldCh, ch);
      }
    } else if (isDef(ch)) {
      if (isDef(oldVnode.text)) {
        setTextContent(elm, '');
      }
      addVnodes(elm, null, ch, 0, ch.length - 1);
    } else if (isDef(oldCh)) {
      removeVnodes(elm, oldCh, 0, oldCh.length - 1);
    } else if (isDef(oldVnode.text)) {
      setTextContent(elm, '');
    }
  } else if (oldVnode.text !== vnode.text) {
    if (isDef(oldCh)) {
      removeVnodes(elm, oldCh, 0, oldCh.length - 1);
    }
    setTextContent(elm, vnode.text);
  }
}
function patch(oldVnode, vnode) {
  if (sameVnode(oldVnode, vnode)) {
    patchVnode(oldVnode, vnode);
  } else {
    var elm = oldVnode.elm;
    var parent_2 = parentNode(elm);
    createElm(vnode);
    if (parent_2 !== null) {
      insertBefore(parent_2, vnode.elm, nextSibling(elm));
      removeVnodes(parent_2, [oldVnode], 0, 0);
    }
  }
  return vnode;
}

var svgId = 0;
var SVGPainter = function () {
  function SVGPainter(root, storage, opts) {
    this.type = 'svg';
    this.refreshHover = createMethodNotSupport('refreshHover');
    this.configLayer = createMethodNotSupport('configLayer');
    this.storage = storage;
    this._opts = opts = extend({}, opts);
    this.root = root;
    this._id = 'zr' + svgId++;
    this._oldVNode = createSVGVNode(opts.width, opts.height);
    if (root && !opts.ssr) {
      var viewport = this._viewport = document.createElement('div');
      viewport.style.cssText = 'position:relative;overflow:hidden';
      var svgDom = this._svgDom = this._oldVNode.elm = createElement('svg');
      updateAttrs(null, this._oldVNode);
      viewport.appendChild(svgDom);
      root.appendChild(viewport);
    }
    this.resize(opts.width, opts.height);
  }
  SVGPainter.prototype.getType = function () {
    return this.type;
  };
  SVGPainter.prototype.getViewportRoot = function () {
    return this._viewport;
  };
  SVGPainter.prototype.getViewportRootOffset = function () {
    var viewportRoot = this.getViewportRoot();
    if (viewportRoot) {
      return {
        offsetLeft: viewportRoot.offsetLeft || 0,
        offsetTop: viewportRoot.offsetTop || 0
      };
    }
  };
  SVGPainter.prototype.getSvgDom = function () {
    return this._svgDom;
  };
  SVGPainter.prototype.refresh = function () {
    if (this.root) {
      var vnode = this.renderToVNode({
        willUpdate: true
      });
      vnode.attrs.style = 'position:absolute;left:0;top:0;user-select:none';
      patch(this._oldVNode, vnode);
      this._oldVNode = vnode;
    }
  };
  SVGPainter.prototype.renderOneToVNode = function (el) {
    return brush(el, createBrushScope(this._id));
  };
  SVGPainter.prototype.renderToVNode = function (opts) {
    opts = opts || {};
    var list = this.storage.getDisplayList(true);
    var width = this._width;
    var height = this._height;
    var scope = createBrushScope(this._id);
    scope.animation = opts.animation;
    scope.willUpdate = opts.willUpdate;
    scope.compress = opts.compress;
    scope.emphasis = opts.emphasis;
    scope.ssr = this._opts.ssr;
    var children = [];
    var bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);
    bgVNode && children.push(bgVNode);
    var mainVNode = !opts.compress ? this._mainVNode = createVNode('g', 'main', {}, []) : null;
    this._paintList(list, scope, mainVNode ? mainVNode.children : children);
    mainVNode && children.push(mainVNode);
    var defs = map$1(keys(scope.defs), function (id) {
      return scope.defs[id];
    });
    if (defs.length) {
      children.push(createVNode('defs', 'defs', {}, defs));
    }
    if (opts.animation) {
      var animationCssStr = getCssString(scope.cssNodes, scope.cssAnims, {
        newline: true
      });
      if (animationCssStr) {
        var styleNode = createVNode('style', 'stl', {}, [], animationCssStr);
        children.push(styleNode);
      }
    }
    return createSVGVNode(width, height, children, opts.useViewBox);
  };
  SVGPainter.prototype.renderToString = function (opts) {
    opts = opts || {};
    return vNodeToString(this.renderToVNode({
      animation: retrieve2(opts.cssAnimation, true),
      emphasis: retrieve2(opts.cssEmphasis, true),
      willUpdate: false,
      compress: true,
      useViewBox: retrieve2(opts.useViewBox, true)
    }), {
      newline: true
    });
  };
  SVGPainter.prototype.setBackgroundColor = function (backgroundColor) {
    this._backgroundColor = backgroundColor;
  };
  SVGPainter.prototype.getSvgRoot = function () {
    return this._mainVNode && this._mainVNode.elm;
  };
  SVGPainter.prototype._paintList = function (list, scope, out) {
    var listLen = list.length;
    var clipPathsGroupsStack = [];
    var clipPathsGroupsStackDepth = 0;
    var currentClipPathGroup;
    var prevClipPaths;
    var clipGroupNodeIdx = 0;
    for (var i = 0; i < listLen; i++) {
      var displayable = list[i];
      if (!displayable.invisible) {
        var clipPaths = displayable.__clipPaths;
        var len = clipPaths && clipPaths.length || 0;
        var prevLen = prevClipPaths && prevClipPaths.length || 0;
        var lca = void 0;
        for (lca = Math.max(len - 1, prevLen - 1); lca >= 0; lca--) {
          if (clipPaths && prevClipPaths && clipPaths[lca] === prevClipPaths[lca]) {
            break;
          }
        }
        for (var i_1 = prevLen - 1; i_1 > lca; i_1--) {
          clipPathsGroupsStackDepth--;
          currentClipPathGroup = clipPathsGroupsStack[clipPathsGroupsStackDepth - 1];
        }
        for (var i_2 = lca + 1; i_2 < len; i_2++) {
          var groupAttrs = {};
          setClipPath(clipPaths[i_2], groupAttrs, scope);
          var g = createVNode('g', 'clip-g-' + clipGroupNodeIdx++, groupAttrs, []);
          (currentClipPathGroup ? currentClipPathGroup.children : out).push(g);
          clipPathsGroupsStack[clipPathsGroupsStackDepth++] = g;
          currentClipPathGroup = g;
        }
        prevClipPaths = clipPaths;
        var ret = brush(displayable, scope);
        if (ret) {
          (currentClipPathGroup ? currentClipPathGroup.children : out).push(ret);
        }
      }
    }
  };
  SVGPainter.prototype.resize = function (width, height) {
    var opts = this._opts;
    var root = this.root;
    var viewport = this._viewport;
    width != null && (opts.width = width);
    height != null && (opts.height = height);
    if (root && viewport) {
      viewport.style.display = 'none';
      width = getSize$1(root, 0, opts);
      height = getSize$1(root, 1, opts);
      viewport.style.display = '';
    }
    if (this._width !== width || this._height !== height) {
      this._width = width;
      this._height = height;
      if (viewport) {
        var viewportStyle = viewport.style;
        viewportStyle.width = width + 'px';
        viewportStyle.height = height + 'px';
      }
      if (!isPattern(this._backgroundColor)) {
        var svgDom = this._svgDom;
        if (svgDom) {
          svgDom.setAttribute('width', width);
          svgDom.setAttribute('height', height);
        }
        var bgEl = this._bgVNode && this._bgVNode.elm;
        if (bgEl) {
          bgEl.setAttribute('width', width);
          bgEl.setAttribute('height', height);
        }
      } else {
        this.refresh();
      }
    }
  };
  SVGPainter.prototype.getWidth = function () {
    return this._width;
  };
  SVGPainter.prototype.getHeight = function () {
    return this._height;
  };
  SVGPainter.prototype.dispose = function () {
    if (this.root) {
      this.root.innerHTML = '';
    }
    this._svgDom = this._viewport = this.storage = this._oldVNode = this._bgVNode = this._mainVNode = null;
  };
  SVGPainter.prototype.clear = function () {
    if (this._svgDom) {
      this._svgDom.innerHTML = null;
    }
    this._oldVNode = null;
  };
  SVGPainter.prototype.toDataURL = function (base64) {
    var str = this.renderToString();
    var prefix = 'data:image/svg+xml;';
    if (base64) {
      str = encodeBase64(str);
      return str && prefix + 'base64,' + str;
    }
    return prefix + 'charset=UTF-8,' + encodeURIComponent(str);
  };
  return SVGPainter;
}();
function createMethodNotSupport(method) {
  return function () {
    {
      logError('In SVG mode painter not support method "' + method + '"');
    }
  };
}
function createBackgroundVNode(width, height, backgroundColor, scope) {
  var bgVNode;
  if (backgroundColor && backgroundColor !== 'none') {
    bgVNode = createVNode('rect', 'bg', {
      width: width,
      height: height,
      x: '0',
      y: '0'
    });
    if (isGradient(backgroundColor)) {
      setGradient({
        fill: backgroundColor
      }, bgVNode.attrs, 'fill', scope);
    } else if (isPattern(backgroundColor)) {
      setPattern({
        style: {
          fill: backgroundColor
        },
        dirty: noop,
        getBoundingRect: function () {
          return {
            width: width,
            height: height
          };
        }
      }, bgVNode.attrs, 'fill', scope);
    } else {
      var _a = normalizeColor(backgroundColor),
        color = _a.color,
        opacity = _a.opacity;
      bgVNode.attrs.fill = color;
      opacity < 1 && (bgVNode.attrs['fill-opacity'] = opacity);
    }
  }
  return bgVNode;
}
var SVGPainter$1 = SVGPainter;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$U(registers) {
  registers.registerPainter('svg', SVGPainter$1);
}

function createDom(id, painter, dpr) {
  var newDom = platformApi.createCanvas();
  var width = painter.getWidth();
  var height = painter.getHeight();
  var newDomStyle = newDom.style;
  if (newDomStyle) {
    newDomStyle.position = 'absolute';
    newDomStyle.left = '0';
    newDomStyle.top = '0';
    newDomStyle.width = width + 'px';
    newDomStyle.height = height + 'px';
    newDom.setAttribute('data-zr-dom-id', id);
  }
  newDom.width = width * dpr;
  newDom.height = height * dpr;
  return newDom;
}
var Layer = function (_super) {
  __extends(Layer, _super);
  function Layer(id, painter, dpr) {
    var _this = _super.call(this) || this;
    _this.motionBlur = false;
    _this.lastFrameAlpha = 0.7;
    _this.dpr = 1;
    _this.virtual = false;
    _this.config = {};
    _this.incremental = false;
    _this.zlevel = 0;
    _this.maxRepaintRectCount = 5;
    _this.__dirty = true;
    _this.__firstTimePaint = true;
    _this.__used = false;
    _this.__drawIndex = 0;
    _this.__startIndex = 0;
    _this.__endIndex = 0;
    _this.__prevStartIndex = null;
    _this.__prevEndIndex = null;
    var dom;
    dpr = dpr || devicePixelRatio;
    if (typeof id === 'string') {
      dom = createDom(id, painter, dpr);
    } else if (isObject$3(id)) {
      dom = id;
      id = dom.id;
    }
    _this.id = id;
    _this.dom = dom;
    var domStyle = dom.style;
    if (domStyle) {
      disableUserSelect(dom);
      dom.onselectstart = function () {
        return false;
      };
      domStyle.padding = '0';
      domStyle.margin = '0';
      domStyle.borderWidth = '0';
    }
    _this.painter = painter;
    _this.dpr = dpr;
    return _this;
  }
  Layer.prototype.getElementCount = function () {
    return this.__endIndex - this.__startIndex;
  };
  Layer.prototype.afterBrush = function () {
    this.__prevStartIndex = this.__startIndex;
    this.__prevEndIndex = this.__endIndex;
  };
  Layer.prototype.initContext = function () {
    this.ctx = this.dom.getContext('2d');
    this.ctx.dpr = this.dpr;
  };
  Layer.prototype.setUnpainted = function () {
    this.__firstTimePaint = true;
  };
  Layer.prototype.createBackBuffer = function () {
    var dpr = this.dpr;
    this.domBack = createDom('back-' + this.id, this.painter, dpr);
    this.ctxBack = this.domBack.getContext('2d');
    if (dpr !== 1) {
      this.ctxBack.scale(dpr, dpr);
    }
  };
  Layer.prototype.createRepaintRects = function (displayList, prevList, viewWidth, viewHeight) {
    if (this.__firstTimePaint) {
      this.__firstTimePaint = false;
      return null;
    }
    var mergedRepaintRects = [];
    var maxRepaintRectCount = this.maxRepaintRectCount;
    var full = false;
    var pendingRect = new BoundingRect$1(0, 0, 0, 0);
    function addRectToMergePool(rect) {
      if (!rect.isFinite() || rect.isZero()) {
        return;
      }
      if (mergedRepaintRects.length === 0) {
        var boundingRect = new BoundingRect$1(0, 0, 0, 0);
        boundingRect.copy(rect);
        mergedRepaintRects.push(boundingRect);
      } else {
        var isMerged = false;
        var minDeltaArea = Infinity;
        var bestRectToMergeIdx = 0;
        for (var i = 0; i < mergedRepaintRects.length; ++i) {
          var mergedRect = mergedRepaintRects[i];
          if (mergedRect.intersect(rect)) {
            var pendingRect_1 = new BoundingRect$1(0, 0, 0, 0);
            pendingRect_1.copy(mergedRect);
            pendingRect_1.union(rect);
            mergedRepaintRects[i] = pendingRect_1;
            isMerged = true;
            break;
          } else if (full) {
            pendingRect.copy(rect);
            pendingRect.union(mergedRect);
            var aArea = rect.width * rect.height;
            var bArea = mergedRect.width * mergedRect.height;
            var pendingArea = pendingRect.width * pendingRect.height;
            var deltaArea = pendingArea - aArea - bArea;
            if (deltaArea < minDeltaArea) {
              minDeltaArea = deltaArea;
              bestRectToMergeIdx = i;
            }
          }
        }
        if (full) {
          mergedRepaintRects[bestRectToMergeIdx].union(rect);
          isMerged = true;
        }
        if (!isMerged) {
          var boundingRect = new BoundingRect$1(0, 0, 0, 0);
          boundingRect.copy(rect);
          mergedRepaintRects.push(boundingRect);
        }
        if (!full) {
          full = mergedRepaintRects.length >= maxRepaintRectCount;
        }
      }
    }
    for (var i = this.__startIndex; i < this.__endIndex; ++i) {
      var el = displayList[i];
      if (el) {
        var shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);
        var prevRect = el.__isRendered && (el.__dirty & REDRAW_BIT || !shouldPaint) ? el.getPrevPaintRect() : null;
        if (prevRect) {
          addRectToMergePool(prevRect);
        }
        var curRect = shouldPaint && (el.__dirty & REDRAW_BIT || !el.__isRendered) ? el.getPaintRect() : null;
        if (curRect) {
          addRectToMergePool(curRect);
        }
      }
    }
    for (var i = this.__prevStartIndex; i < this.__prevEndIndex; ++i) {
      var el = prevList[i];
      var shouldPaint = el && el.shouldBePainted(viewWidth, viewHeight, true, true);
      if (el && (!shouldPaint || !el.__zr) && el.__isRendered) {
        var prevRect = el.getPrevPaintRect();
        if (prevRect) {
          addRectToMergePool(prevRect);
        }
      }
    }
    var hasIntersections;
    do {
      hasIntersections = false;
      for (var i = 0; i < mergedRepaintRects.length;) {
        if (mergedRepaintRects[i].isZero()) {
          mergedRepaintRects.splice(i, 1);
          continue;
        }
        for (var j = i + 1; j < mergedRepaintRects.length;) {
          if (mergedRepaintRects[i].intersect(mergedRepaintRects[j])) {
            hasIntersections = true;
            mergedRepaintRects[i].union(mergedRepaintRects[j]);
            mergedRepaintRects.splice(j, 1);
          } else {
            j++;
          }
        }
        i++;
      }
    } while (hasIntersections);
    this._paintRects = mergedRepaintRects;
    return mergedRepaintRects;
  };
  Layer.prototype.debugGetPaintRects = function () {
    return (this._paintRects || []).slice();
  };
  Layer.prototype.resize = function (width, height) {
    var dpr = this.dpr;
    var dom = this.dom;
    var domStyle = dom.style;
    var domBack = this.domBack;
    if (domStyle) {
      domStyle.width = width + 'px';
      domStyle.height = height + 'px';
    }
    dom.width = width * dpr;
    dom.height = height * dpr;
    if (domBack) {
      domBack.width = width * dpr;
      domBack.height = height * dpr;
      if (dpr !== 1) {
        this.ctxBack.scale(dpr, dpr);
      }
    }
  };
  Layer.prototype.clear = function (clearAll, clearColor, repaintRects) {
    var dom = this.dom;
    var ctx = this.ctx;
    var width = dom.width;
    var height = dom.height;
    clearColor = clearColor || this.clearColor;
    var haveMotionBLur = this.motionBlur && !clearAll;
    var lastFrameAlpha = this.lastFrameAlpha;
    var dpr = this.dpr;
    var self = this;
    if (haveMotionBLur) {
      if (!this.domBack) {
        this.createBackBuffer();
      }
      this.ctxBack.globalCompositeOperation = 'copy';
      this.ctxBack.drawImage(dom, 0, 0, width / dpr, height / dpr);
    }
    var domBack = this.domBack;
    function doClear(x, y, width, height) {
      ctx.clearRect(x, y, width, height);
      if (clearColor && clearColor !== 'transparent') {
        var clearColorGradientOrPattern = void 0;
        if (isGradientObject(clearColor)) {
          var shouldCache = clearColor.global || clearColor.__width === width && clearColor.__height === height;
          clearColorGradientOrPattern = shouldCache && clearColor.__canvasGradient || getCanvasGradient(ctx, clearColor, {
            x: 0,
            y: 0,
            width: width,
            height: height
          });
          clearColor.__canvasGradient = clearColorGradientOrPattern;
          clearColor.__width = width;
          clearColor.__height = height;
        } else if (isImagePatternObject(clearColor)) {
          clearColor.scaleX = clearColor.scaleX || dpr;
          clearColor.scaleY = clearColor.scaleY || dpr;
          clearColorGradientOrPattern = createCanvasPattern(ctx, clearColor, {
            dirty: function () {
              self.setUnpainted();
              self.painter.refresh();
            }
          });
        }
        ctx.save();
        ctx.fillStyle = clearColorGradientOrPattern || clearColor;
        ctx.fillRect(x, y, width, height);
        ctx.restore();
      }
      if (haveMotionBLur) {
        ctx.save();
        ctx.globalAlpha = lastFrameAlpha;
        ctx.drawImage(domBack, x, y, width, height);
        ctx.restore();
      }
    }
    if (!repaintRects || haveMotionBLur) {
      doClear(0, 0, width, height);
    } else if (repaintRects.length) {
      each$f(repaintRects, function (rect) {
        doClear(rect.x * dpr, rect.y * dpr, rect.width * dpr, rect.height * dpr);
      });
    }
  };
  return Layer;
}(Eventful$1);
var Layer$1 = Layer;

var HOVER_LAYER_ZLEVEL = 1e5;
var CANVAS_ZLEVEL = 314159;
var EL_AFTER_INCREMENTAL_INC = 0.01;
var INCREMENTAL_INC = 0.001;
function isLayerValid(layer) {
  if (!layer) {
    return false;
  }
  if (layer.__builtin__) {
    return true;
  }
  if (typeof layer.resize !== 'function' || typeof layer.refresh !== 'function') {
    return false;
  }
  return true;
}
function createRoot(width, height) {
  var domRoot = document.createElement('div');
  domRoot.style.cssText = ['position:relative', 'width:' + width + 'px', 'height:' + height + 'px', 'padding:0', 'margin:0', 'border-width:0'].join(';') + ';';
  return domRoot;
}
var CanvasPainter = function () {
  function CanvasPainter(root, storage, opts, id) {
    this.type = 'canvas';
    this._zlevelList = [];
    this._prevDisplayList = [];
    this._layers = {};
    this._layerConfig = {};
    this._needsManuallyCompositing = false;
    this.type = 'canvas';
    var singleCanvas = !root.nodeName || root.nodeName.toUpperCase() === 'CANVAS';
    this._opts = opts = extend({}, opts || {});
    this.dpr = opts.devicePixelRatio || devicePixelRatio;
    this._singleCanvas = singleCanvas;
    this.root = root;
    var rootStyle = root.style;
    if (rootStyle) {
      disableUserSelect(root);
      root.innerHTML = '';
    }
    this.storage = storage;
    var zlevelList = this._zlevelList;
    this._prevDisplayList = [];
    var layers = this._layers;
    if (!singleCanvas) {
      this._width = getSize$1(root, 0, opts);
      this._height = getSize$1(root, 1, opts);
      var domRoot = this._domRoot = createRoot(this._width, this._height);
      root.appendChild(domRoot);
    } else {
      var rootCanvas = root;
      var width = rootCanvas.width;
      var height = rootCanvas.height;
      if (opts.width != null) {
        width = opts.width;
      }
      if (opts.height != null) {
        height = opts.height;
      }
      this.dpr = opts.devicePixelRatio || 1;
      rootCanvas.width = width * this.dpr;
      rootCanvas.height = height * this.dpr;
      this._width = width;
      this._height = height;
      var mainLayer = new Layer$1(rootCanvas, this, this.dpr);
      mainLayer.__builtin__ = true;
      mainLayer.initContext();
      layers[CANVAS_ZLEVEL] = mainLayer;
      mainLayer.zlevel = CANVAS_ZLEVEL;
      zlevelList.push(CANVAS_ZLEVEL);
      this._domRoot = root;
    }
  }
  CanvasPainter.prototype.getType = function () {
    return 'canvas';
  };
  CanvasPainter.prototype.isSingleCanvas = function () {
    return this._singleCanvas;
  };
  CanvasPainter.prototype.getViewportRoot = function () {
    return this._domRoot;
  };
  CanvasPainter.prototype.getViewportRootOffset = function () {
    var viewportRoot = this.getViewportRoot();
    if (viewportRoot) {
      return {
        offsetLeft: viewportRoot.offsetLeft || 0,
        offsetTop: viewportRoot.offsetTop || 0
      };
    }
  };
  CanvasPainter.prototype.refresh = function (paintAll) {
    var list = this.storage.getDisplayList(true);
    var prevList = this._prevDisplayList;
    var zlevelList = this._zlevelList;
    this._redrawId = Math.random();
    this._paintList(list, prevList, paintAll, this._redrawId);
    for (var i = 0; i < zlevelList.length; i++) {
      var z = zlevelList[i];
      var layer = this._layers[z];
      if (!layer.__builtin__ && layer.refresh) {
        var clearColor = i === 0 ? this._backgroundColor : null;
        layer.refresh(clearColor);
      }
    }
    if (this._opts.useDirtyRect) {
      this._prevDisplayList = list.slice();
    }
    return this;
  };
  CanvasPainter.prototype.refreshHover = function () {
    this._paintHoverList(this.storage.getDisplayList(false));
  };
  CanvasPainter.prototype._paintHoverList = function (list) {
    var len = list.length;
    var hoverLayer = this._hoverlayer;
    hoverLayer && hoverLayer.clear();
    if (!len) {
      return;
    }
    var scope = {
      inHover: true,
      viewWidth: this._width,
      viewHeight: this._height
    };
    var ctx;
    for (var i = 0; i < len; i++) {
      var el = list[i];
      if (el.__inHover) {
        if (!hoverLayer) {
          hoverLayer = this._hoverlayer = this.getLayer(HOVER_LAYER_ZLEVEL);
        }
        if (!ctx) {
          ctx = hoverLayer.ctx;
          ctx.save();
        }
        brush$1(ctx, el, scope, i === len - 1);
      }
    }
    if (ctx) {
      ctx.restore();
    }
  };
  CanvasPainter.prototype.getHoverLayer = function () {
    return this.getLayer(HOVER_LAYER_ZLEVEL);
  };
  CanvasPainter.prototype.paintOne = function (ctx, el) {
    brushSingle(ctx, el);
  };
  CanvasPainter.prototype._paintList = function (list, prevList, paintAll, redrawId) {
    if (this._redrawId !== redrawId) {
      return;
    }
    paintAll = paintAll || false;
    this._updateLayerStatus(list);
    var _a = this._doPaintList(list, prevList, paintAll),
      finished = _a.finished,
      needsRefreshHover = _a.needsRefreshHover;
    if (this._needsManuallyCompositing) {
      this._compositeManually();
    }
    if (needsRefreshHover) {
      this._paintHoverList(list);
    }
    if (!finished) {
      var self_1 = this;
      requestAnimationFrame$2(function () {
        self_1._paintList(list, prevList, paintAll, redrawId);
      });
    } else {
      this.eachLayer(function (layer) {
        layer.afterBrush && layer.afterBrush();
      });
    }
  };
  CanvasPainter.prototype._compositeManually = function () {
    var ctx = this.getLayer(CANVAS_ZLEVEL).ctx;
    var width = this._domRoot.width;
    var height = this._domRoot.height;
    ctx.clearRect(0, 0, width, height);
    this.eachBuiltinLayer(function (layer) {
      if (layer.virtual) {
        ctx.drawImage(layer.dom, 0, 0, width, height);
      }
    });
  };
  CanvasPainter.prototype._doPaintList = function (list, prevList, paintAll) {
    var _this = this;
    var layerList = [];
    var useDirtyRect = this._opts.useDirtyRect;
    for (var zi = 0; zi < this._zlevelList.length; zi++) {
      var zlevel = this._zlevelList[zi];
      var layer = this._layers[zlevel];
      if (layer.__builtin__ && layer !== this._hoverlayer && (layer.__dirty || paintAll)) {
        layerList.push(layer);
      }
    }
    var finished = true;
    var needsRefreshHover = false;
    var _loop_1 = function (k) {
      var layer = layerList[k];
      var ctx = layer.ctx;
      var repaintRects = useDirtyRect && layer.createRepaintRects(list, prevList, this_1._width, this_1._height);
      var start = paintAll ? layer.__startIndex : layer.__drawIndex;
      var useTimer = !paintAll && layer.incremental && Date.now;
      var startTime = useTimer && Date.now();
      var clearColor = layer.zlevel === this_1._zlevelList[0] ? this_1._backgroundColor : null;
      if (layer.__startIndex === layer.__endIndex) {
        layer.clear(false, clearColor, repaintRects);
      } else if (start === layer.__startIndex) {
        var firstEl = list[start];
        if (!firstEl.incremental || !firstEl.notClear || paintAll) {
          layer.clear(false, clearColor, repaintRects);
        }
      }
      if (start === -1) {
        console.error('For some unknown reason. drawIndex is -1');
        start = layer.__startIndex;
      }
      var i;
      var repaint = function (repaintRect) {
        var scope = {
          inHover: false,
          allClipped: false,
          prevEl: null,
          viewWidth: _this._width,
          viewHeight: _this._height
        };
        for (i = start; i < layer.__endIndex; i++) {
          var el = list[i];
          if (el.__inHover) {
            needsRefreshHover = true;
          }
          _this._doPaintEl(el, layer, useDirtyRect, repaintRect, scope, i === layer.__endIndex - 1);
          if (useTimer) {
            var dTime = Date.now() - startTime;
            if (dTime > 15) {
              break;
            }
          }
        }
        if (scope.prevElClipPaths) {
          ctx.restore();
        }
      };
      if (repaintRects) {
        if (repaintRects.length === 0) {
          i = layer.__endIndex;
        } else {
          var dpr = this_1.dpr;
          for (var r = 0; r < repaintRects.length; ++r) {
            var rect = repaintRects[r];
            ctx.save();
            ctx.beginPath();
            ctx.rect(rect.x * dpr, rect.y * dpr, rect.width * dpr, rect.height * dpr);
            ctx.clip();
            repaint(rect);
            ctx.restore();
          }
        }
      } else {
        ctx.save();
        repaint();
        ctx.restore();
      }
      layer.__drawIndex = i;
      if (layer.__drawIndex < layer.__endIndex) {
        finished = false;
      }
    };
    var this_1 = this;
    for (var k = 0; k < layerList.length; k++) {
      _loop_1(k);
    }
    if (env$1.wxa) {
      each$f(this._layers, function (layer) {
        if (layer && layer.ctx && layer.ctx.draw) {
          layer.ctx.draw();
        }
      });
    }
    return {
      finished: finished,
      needsRefreshHover: needsRefreshHover
    };
  };
  CanvasPainter.prototype._doPaintEl = function (el, currentLayer, useDirtyRect, repaintRect, scope, isLast) {
    var ctx = currentLayer.ctx;
    if (useDirtyRect) {
      var paintRect = el.getPaintRect();
      if (!repaintRect || paintRect && paintRect.intersect(repaintRect)) {
        brush$1(ctx, el, scope, isLast);
        el.setPrevPaintRect(paintRect);
      }
    } else {
      brush$1(ctx, el, scope, isLast);
    }
  };
  CanvasPainter.prototype.getLayer = function (zlevel, virtual) {
    if (this._singleCanvas && !this._needsManuallyCompositing) {
      zlevel = CANVAS_ZLEVEL;
    }
    var layer = this._layers[zlevel];
    if (!layer) {
      layer = new Layer$1('zr_' + zlevel, this, this.dpr);
      layer.zlevel = zlevel;
      layer.__builtin__ = true;
      if (this._layerConfig[zlevel]) {
        merge(layer, this._layerConfig[zlevel], true);
      } else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {
        merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);
      }
      if (virtual) {
        layer.virtual = virtual;
      }
      this.insertLayer(zlevel, layer);
      layer.initContext();
    }
    return layer;
  };
  CanvasPainter.prototype.insertLayer = function (zlevel, layer) {
    var layersMap = this._layers;
    var zlevelList = this._zlevelList;
    var len = zlevelList.length;
    var domRoot = this._domRoot;
    var prevLayer = null;
    var i = -1;
    if (layersMap[zlevel]) {
      {
        logError('ZLevel ' + zlevel + ' has been used already');
      }
      return;
    }
    if (!isLayerValid(layer)) {
      {
        logError('Layer of zlevel ' + zlevel + ' is not valid');
      }
      return;
    }
    if (len > 0 && zlevel > zlevelList[0]) {
      for (i = 0; i < len - 1; i++) {
        if (zlevelList[i] < zlevel && zlevelList[i + 1] > zlevel) {
          break;
        }
      }
      prevLayer = layersMap[zlevelList[i]];
    }
    zlevelList.splice(i + 1, 0, zlevel);
    layersMap[zlevel] = layer;
    if (!layer.virtual) {
      if (prevLayer) {
        var prevDom = prevLayer.dom;
        if (prevDom.nextSibling) {
          domRoot.insertBefore(layer.dom, prevDom.nextSibling);
        } else {
          domRoot.appendChild(layer.dom);
        }
      } else {
        if (domRoot.firstChild) {
          domRoot.insertBefore(layer.dom, domRoot.firstChild);
        } else {
          domRoot.appendChild(layer.dom);
        }
      }
    }
    layer.painter || (layer.painter = this);
  };
  CanvasPainter.prototype.eachLayer = function (cb, context) {
    var zlevelList = this._zlevelList;
    for (var i = 0; i < zlevelList.length; i++) {
      var z = zlevelList[i];
      cb.call(context, this._layers[z], z);
    }
  };
  CanvasPainter.prototype.eachBuiltinLayer = function (cb, context) {
    var zlevelList = this._zlevelList;
    for (var i = 0; i < zlevelList.length; i++) {
      var z = zlevelList[i];
      var layer = this._layers[z];
      if (layer.__builtin__) {
        cb.call(context, layer, z);
      }
    }
  };
  CanvasPainter.prototype.eachOtherLayer = function (cb, context) {
    var zlevelList = this._zlevelList;
    for (var i = 0; i < zlevelList.length; i++) {
      var z = zlevelList[i];
      var layer = this._layers[z];
      if (!layer.__builtin__) {
        cb.call(context, layer, z);
      }
    }
  };
  CanvasPainter.prototype.getLayers = function () {
    return this._layers;
  };
  CanvasPainter.prototype._updateLayerStatus = function (list) {
    this.eachBuiltinLayer(function (layer, z) {
      layer.__dirty = layer.__used = false;
    });
    function updatePrevLayer(idx) {
      if (prevLayer) {
        if (prevLayer.__endIndex !== idx) {
          prevLayer.__dirty = true;
        }
        prevLayer.__endIndex = idx;
      }
    }
    if (this._singleCanvas) {
      for (var i_1 = 1; i_1 < list.length; i_1++) {
        var el = list[i_1];
        if (el.zlevel !== list[i_1 - 1].zlevel || el.incremental) {
          this._needsManuallyCompositing = true;
          break;
        }
      }
    }
    var prevLayer = null;
    var incrementalLayerCount = 0;
    var prevZlevel;
    var i;
    for (i = 0; i < list.length; i++) {
      var el = list[i];
      var zlevel = el.zlevel;
      var layer = void 0;
      if (prevZlevel !== zlevel) {
        prevZlevel = zlevel;
        incrementalLayerCount = 0;
      }
      if (el.incremental) {
        layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);
        layer.incremental = true;
        incrementalLayerCount = 1;
      } else {
        layer = this.getLayer(zlevel + (incrementalLayerCount > 0 ? EL_AFTER_INCREMENTAL_INC : 0), this._needsManuallyCompositing);
      }
      if (!layer.__builtin__) {
        logError('ZLevel ' + zlevel + ' has been used by unkown layer ' + layer.id);
      }
      if (layer !== prevLayer) {
        layer.__used = true;
        if (layer.__startIndex !== i) {
          layer.__dirty = true;
        }
        layer.__startIndex = i;
        if (!layer.incremental) {
          layer.__drawIndex = i;
        } else {
          layer.__drawIndex = -1;
        }
        updatePrevLayer(i);
        prevLayer = layer;
      }
      if (el.__dirty & REDRAW_BIT && !el.__inHover) {
        layer.__dirty = true;
        if (layer.incremental && layer.__drawIndex < 0) {
          layer.__drawIndex = i;
        }
      }
    }
    updatePrevLayer(i);
    this.eachBuiltinLayer(function (layer, z) {
      if (!layer.__used && layer.getElementCount() > 0) {
        layer.__dirty = true;
        layer.__startIndex = layer.__endIndex = layer.__drawIndex = 0;
      }
      if (layer.__dirty && layer.__drawIndex < 0) {
        layer.__drawIndex = layer.__startIndex;
      }
    });
  };
  CanvasPainter.prototype.clear = function () {
    this.eachBuiltinLayer(this._clearLayer);
    return this;
  };
  CanvasPainter.prototype._clearLayer = function (layer) {
    layer.clear();
  };
  CanvasPainter.prototype.setBackgroundColor = function (backgroundColor) {
    this._backgroundColor = backgroundColor;
    each$f(this._layers, function (layer) {
      layer.setUnpainted();
    });
  };
  CanvasPainter.prototype.configLayer = function (zlevel, config) {
    if (config) {
      var layerConfig = this._layerConfig;
      if (!layerConfig[zlevel]) {
        layerConfig[zlevel] = config;
      } else {
        merge(layerConfig[zlevel], config, true);
      }
      for (var i = 0; i < this._zlevelList.length; i++) {
        var _zlevel = this._zlevelList[i];
        if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {
          var layer = this._layers[_zlevel];
          merge(layer, layerConfig[zlevel], true);
        }
      }
    }
  };
  CanvasPainter.prototype.delLayer = function (zlevel) {
    var layers = this._layers;
    var zlevelList = this._zlevelList;
    var layer = layers[zlevel];
    if (!layer) {
      return;
    }
    layer.dom.parentNode.removeChild(layer.dom);
    delete layers[zlevel];
    zlevelList.splice(indexOf(zlevelList, zlevel), 1);
  };
  CanvasPainter.prototype.resize = function (width, height) {
    if (!this._domRoot.style) {
      if (width == null || height == null) {
        return;
      }
      this._width = width;
      this._height = height;
      this.getLayer(CANVAS_ZLEVEL).resize(width, height);
    } else {
      var domRoot = this._domRoot;
      domRoot.style.display = 'none';
      var opts = this._opts;
      var root = this.root;
      width != null && (opts.width = width);
      height != null && (opts.height = height);
      width = getSize$1(root, 0, opts);
      height = getSize$1(root, 1, opts);
      domRoot.style.display = '';
      if (this._width !== width || height !== this._height) {
        domRoot.style.width = width + 'px';
        domRoot.style.height = height + 'px';
        for (var id in this._layers) {
          if (this._layers.hasOwnProperty(id)) {
            this._layers[id].resize(width, height);
          }
        }
        this.refresh(true);
      }
      this._width = width;
      this._height = height;
    }
    return this;
  };
  CanvasPainter.prototype.clearLayer = function (zlevel) {
    var layer = this._layers[zlevel];
    if (layer) {
      layer.clear();
    }
  };
  CanvasPainter.prototype.dispose = function () {
    this.root.innerHTML = '';
    this.root = this.storage = this._domRoot = this._layers = null;
  };
  CanvasPainter.prototype.getRenderedCanvas = function (opts) {
    opts = opts || {};
    if (this._singleCanvas && !this._compositeManually) {
      return this._layers[CANVAS_ZLEVEL].dom;
    }
    var imageLayer = new Layer$1('image', this, opts.pixelRatio || this.dpr);
    imageLayer.initContext();
    imageLayer.clear(false, opts.backgroundColor || this._backgroundColor);
    var ctx = imageLayer.ctx;
    if (opts.pixelRatio <= this.dpr) {
      this.refresh();
      var width_1 = imageLayer.dom.width;
      var height_1 = imageLayer.dom.height;
      this.eachLayer(function (layer) {
        if (layer.__builtin__) {
          ctx.drawImage(layer.dom, 0, 0, width_1, height_1);
        } else if (layer.renderToCanvas) {
          ctx.save();
          layer.renderToCanvas(ctx);
          ctx.restore();
        }
      });
    } else {
      var scope = {
        inHover: false,
        viewWidth: this._width,
        viewHeight: this._height
      };
      var displayList = this.storage.getDisplayList(true);
      for (var i = 0, len = displayList.length; i < len; i++) {
        var el = displayList[i];
        brush$1(ctx, el, scope, i === len - 1);
      }
    }
    return imageLayer.dom;
  };
  CanvasPainter.prototype.getWidth = function () {
    return this._width;
  };
  CanvasPainter.prototype.getHeight = function () {
    return this._height;
  };
  return CanvasPainter;
}();
var CanvasPainter$1 = CanvasPainter;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$T(registers) {
  registers.registerPainter('canvas', CanvasPainter$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var LineSeriesModel = /** @class */function (_super) {
  __extends(LineSeriesModel, _super);
  function LineSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = LineSeriesModel.type;
    _this.hasSymbolVisual = true;
    return _this;
  }
  LineSeriesModel.prototype.getInitialData = function (option) {
    {
      var coordSys = option.coordinateSystem;
      if (coordSys !== 'polar' && coordSys !== 'cartesian2d') {
        throw new Error('Line not support coordinateSystem besides cartesian and polar');
      }
    }
    return createSeriesData(null, this, {
      useEncodeDefaulter: true
    });
  };
  LineSeriesModel.prototype.getLegendIcon = function (opt) {
    var group = new Group$5();
    var line = createSymbol$1('line', 0, opt.itemHeight / 2, opt.itemWidth, 0, opt.lineStyle.stroke, false);
    group.add(line);
    line.setStyle(opt.lineStyle);
    var visualType = this.getData().getVisual('symbol');
    var visualRotate = this.getData().getVisual('symbolRotate');
    var symbolType = visualType === 'none' ? 'circle' : visualType;
    // Symbol size is 80% when there is a line
    var size = opt.itemHeight * 0.8;
    var symbol = createSymbol$1(symbolType, (opt.itemWidth - size) / 2, (opt.itemHeight - size) / 2, size, size, opt.itemStyle.fill);
    group.add(symbol);
    symbol.setStyle(opt.itemStyle);
    var symbolRotate = opt.iconRotate === 'inherit' ? visualRotate : opt.iconRotate || 0;
    symbol.rotation = symbolRotate * Math.PI / 180;
    symbol.setOrigin([opt.itemWidth / 2, opt.itemHeight / 2]);
    if (symbolType.indexOf('empty') > -1) {
      symbol.style.stroke = symbol.style.fill;
      symbol.style.fill = '#fff';
      symbol.style.lineWidth = 2;
    }
    return group;
  };
  LineSeriesModel.type = 'series.line';
  LineSeriesModel.dependencies = ['grid', 'polar'];
  LineSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 3,
    coordinateSystem: 'cartesian2d',
    legendHoverLink: true,
    clip: true,
    label: {
      position: 'top'
    },
    // itemStyle: {
    // },
    endLabel: {
      show: false,
      valueAnimation: true,
      distance: 8
    },
    lineStyle: {
      width: 2,
      type: 'solid'
    },
    emphasis: {
      scale: true
    },
    // areaStyle: {
    // origin of areaStyle. Valid values:
    // `'auto'/null/undefined`: from axisLine to data
    // `'start'`: from min to data
    // `'end'`: from data to max
    // origin: 'auto'
    // },
    // false, 'start', 'end', 'middle'
    step: false,
    // Disabled if step is true
    smooth: false,
    smoothMonotone: null,
    symbol: 'emptyCircle',
    symbolSize: 4,
    symbolRotate: null,
    showSymbol: true,
    // `false`: follow the label interval strategy.
    // `true`: show all symbols.
    // `'auto'`: If possible, show all symbols, otherwise
    //           follow the label interval strategy.
    showAllSymbol: 'auto',
    // Whether to connect break point.
    connectNulls: false,
    // Sampling for large data. Can be: 'average', 'max', 'min', 'sum', 'lttb'.
    sampling: 'none',
    animationEasing: 'linear',
    // Disable progressive
    progressive: 0,
    hoverLayerThreshold: Infinity,
    universalTransition: {
      divideShape: 'clone'
    },
    triggerLineEvent: false
  };
  return LineSeriesModel;
}(SeriesModel$1);
var LineSeries = LineSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * @return label string. Not null/undefined
 */
function getDefaultLabel(data, dataIndex) {
  var labelDims = data.mapDimensionsAll('defaultedLabel');
  var len = labelDims.length;
  // Simple optimization (in lots of cases, label dims length is 1)
  if (len === 1) {
    var rawVal = retrieveRawValue(data, dataIndex, labelDims[0]);
    return rawVal != null ? rawVal + '' : null;
  } else if (len) {
    var vals = [];
    for (var i = 0; i < labelDims.length; i++) {
      vals.push(retrieveRawValue(data, dataIndex, labelDims[i]));
    }
    return vals.join(' ');
  }
}
function getDefaultInterpolatedLabel(data, interpolatedValue) {
  var labelDims = data.mapDimensionsAll('defaultedLabel');
  if (!isArray$1(interpolatedValue)) {
    return interpolatedValue + '';
  }
  var vals = [];
  for (var i = 0; i < labelDims.length; i++) {
    var dimIndex = data.getDimensionIndex(labelDims[i]);
    if (dimIndex >= 0) {
      vals.push(interpolatedValue[dimIndex]);
    }
  }
  return vals.join(' ');
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Symbol$1 = /** @class */function (_super) {
  __extends(Symbol, _super);
  function Symbol(data, idx, seriesScope, opts) {
    var _this = _super.call(this) || this;
    _this.updateData(data, idx, seriesScope, opts);
    return _this;
  }
  Symbol.prototype._createSymbol = function (symbolType, data, idx, symbolSize, keepAspect) {
    // Remove paths created before
    this.removeAll();
    // let symbolPath = createSymbol(
    //     symbolType, -0.5, -0.5, 1, 1, color
    // );
    // If width/height are set too small (e.g., set to 1) on ios10
    // and macOS Sierra, a circle stroke become a rect, no matter what
    // the scale is set. So we set width/height as 2. See #4150.
    var symbolPath = createSymbol$1(symbolType, -1, -1, 2, 2, null, keepAspect);
    symbolPath.attr({
      z2: 100,
      culling: true,
      scaleX: symbolSize[0] / 2,
      scaleY: symbolSize[1] / 2
    });
    // Rewrite drift method
    symbolPath.drift = driftSymbol;
    this._symbolType = symbolType;
    this.add(symbolPath);
  };
  /**
   * Stop animation
   * @param {boolean} toLastFrame
   */
  Symbol.prototype.stopSymbolAnimation = function (toLastFrame) {
    this.childAt(0).stopAnimation(null, toLastFrame);
  };
  Symbol.prototype.getSymbolType = function () {
    return this._symbolType;
  };
  /**
   * FIXME:
   * Caution: This method breaks the encapsulation of this module,
   * but it indeed brings convenience. So do not use the method
   * unless you detailedly know all the implements of `Symbol`,
   * especially animation.
   *
   * Get symbol path element.
   */
  Symbol.prototype.getSymbolPath = function () {
    return this.childAt(0);
  };
  /**
   * Highlight symbol
   */
  Symbol.prototype.highlight = function () {
    enterEmphasis(this.childAt(0));
  };
  /**
   * Downplay symbol
   */
  Symbol.prototype.downplay = function () {
    leaveEmphasis(this.childAt(0));
  };
  /**
   * @param {number} zlevel
   * @param {number} z
   */
  Symbol.prototype.setZ = function (zlevel, z) {
    var symbolPath = this.childAt(0);
    symbolPath.zlevel = zlevel;
    symbolPath.z = z;
  };
  Symbol.prototype.setDraggable = function (draggable, hasCursorOption) {
    var symbolPath = this.childAt(0);
    symbolPath.draggable = draggable;
    symbolPath.cursor = !hasCursorOption && draggable ? 'move' : symbolPath.cursor;
  };
  /**
   * Update symbol properties
   */
  Symbol.prototype.updateData = function (data, idx, seriesScope, opts) {
    this.silent = false;
    var symbolType = data.getItemVisual(idx, 'symbol') || 'circle';
    var seriesModel = data.hostModel;
    var symbolSize = Symbol.getSymbolSize(data, idx);
    var isInit = symbolType !== this._symbolType;
    var disableAnimation = opts && opts.disableAnimation;
    if (isInit) {
      var keepAspect = data.getItemVisual(idx, 'symbolKeepAspect');
      this._createSymbol(symbolType, data, idx, symbolSize, keepAspect);
    } else {
      var symbolPath = this.childAt(0);
      symbolPath.silent = false;
      var target = {
        scaleX: symbolSize[0] / 2,
        scaleY: symbolSize[1] / 2
      };
      disableAnimation ? symbolPath.attr(target) : updateProps$1(symbolPath, target, seriesModel, idx);
      saveOldStyle(symbolPath);
    }
    this._updateCommon(data, idx, symbolSize, seriesScope, opts);
    if (isInit) {
      var symbolPath = this.childAt(0);
      if (!disableAnimation) {
        var target = {
          scaleX: this._sizeX,
          scaleY: this._sizeY,
          style: {
            // Always fadeIn. Because it has fadeOut animation when symbol is removed..
            opacity: symbolPath.style.opacity
          }
        };
        symbolPath.scaleX = symbolPath.scaleY = 0;
        symbolPath.style.opacity = 0;
        initProps(symbolPath, target, seriesModel, idx);
      }
    }
    if (disableAnimation) {
      // Must stop leave transition manually if don't call initProps or updateProps.
      this.childAt(0).stopAnimation('leave');
    }
  };
  Symbol.prototype._updateCommon = function (data, idx, symbolSize, seriesScope, opts) {
    var symbolPath = this.childAt(0);
    var seriesModel = data.hostModel;
    var emphasisItemStyle;
    var blurItemStyle;
    var selectItemStyle;
    var focus;
    var blurScope;
    var emphasisDisabled;
    var labelStatesModels;
    var hoverScale;
    var cursorStyle;
    if (seriesScope) {
      emphasisItemStyle = seriesScope.emphasisItemStyle;
      blurItemStyle = seriesScope.blurItemStyle;
      selectItemStyle = seriesScope.selectItemStyle;
      focus = seriesScope.focus;
      blurScope = seriesScope.blurScope;
      labelStatesModels = seriesScope.labelStatesModels;
      hoverScale = seriesScope.hoverScale;
      cursorStyle = seriesScope.cursorStyle;
      emphasisDisabled = seriesScope.emphasisDisabled;
    }
    if (!seriesScope || data.hasItemOption) {
      var itemModel = seriesScope && seriesScope.itemModel ? seriesScope.itemModel : data.getItemModel(idx);
      var emphasisModel = itemModel.getModel('emphasis');
      emphasisItemStyle = emphasisModel.getModel('itemStyle').getItemStyle();
      selectItemStyle = itemModel.getModel(['select', 'itemStyle']).getItemStyle();
      blurItemStyle = itemModel.getModel(['blur', 'itemStyle']).getItemStyle();
      focus = emphasisModel.get('focus');
      blurScope = emphasisModel.get('blurScope');
      emphasisDisabled = emphasisModel.get('disabled');
      labelStatesModels = getLabelStatesModels(itemModel);
      hoverScale = emphasisModel.getShallow('scale');
      cursorStyle = itemModel.getShallow('cursor');
    }
    var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
    symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
    var symbolOffset = normalizeSymbolOffset(data.getItemVisual(idx, 'symbolOffset'), symbolSize);
    if (symbolOffset) {
      symbolPath.x = symbolOffset[0];
      symbolPath.y = symbolOffset[1];
    }
    cursorStyle && symbolPath.attr('cursor', cursorStyle);
    var symbolStyle = data.getItemVisual(idx, 'style');
    var visualColor = symbolStyle.fill;
    if (symbolPath instanceof ZRImage$1) {
      var pathStyle = symbolPath.style;
      symbolPath.useStyle(extend({
        // TODO other properties like x, y ?
        image: pathStyle.image,
        x: pathStyle.x,
        y: pathStyle.y,
        width: pathStyle.width,
        height: pathStyle.height
      }, symbolStyle));
    } else {
      if (symbolPath.__isEmptyBrush) {
        // fill and stroke will be swapped if it's empty.
        // So we cloned a new style to avoid it affecting the original style in visual storage.
        // TODO Better implementation. No empty logic!
        symbolPath.useStyle(extend({}, symbolStyle));
      } else {
        symbolPath.useStyle(symbolStyle);
      }
      // Disable decal because symbol scale will been applied on the decal.
      symbolPath.style.decal = null;
      symbolPath.setColor(visualColor, opts && opts.symbolInnerColor);
      symbolPath.style.strokeNoScale = true;
    }
    var liftZ = data.getItemVisual(idx, 'liftZ');
    var z2Origin = this._z2;
    if (liftZ != null) {
      if (z2Origin == null) {
        this._z2 = symbolPath.z2;
        symbolPath.z2 += liftZ;
      }
    } else if (z2Origin != null) {
      symbolPath.z2 = z2Origin;
      this._z2 = null;
    }
    var useNameLabel = opts && opts.useNameLabel;
    setLabelStyle(symbolPath, labelStatesModels, {
      labelFetcher: seriesModel,
      labelDataIndex: idx,
      defaultText: getLabelDefaultText,
      inheritColor: visualColor,
      defaultOpacity: symbolStyle.opacity
    });
    // Do not execute util needed.
    function getLabelDefaultText(idx) {
      return useNameLabel ? data.getName(idx) : getDefaultLabel(data, idx);
    }
    this._sizeX = symbolSize[0] / 2;
    this._sizeY = symbolSize[1] / 2;
    var emphasisState = symbolPath.ensureState('emphasis');
    emphasisState.style = emphasisItemStyle;
    symbolPath.ensureState('select').style = selectItemStyle;
    symbolPath.ensureState('blur').style = blurItemStyle;
    // null / undefined / true means to use default strategy.
    // 0 / false / negative number / NaN / Infinity means no scale.
    var scaleRatio = hoverScale == null || hoverScale === true ? Math.max(1.1, 3 / this._sizeY)
    // PENDING: restrict hoverScale > 1? It seems unreasonable to scale down
    : isFinite(hoverScale) && hoverScale > 0 ? +hoverScale : 1;
    // always set scale to allow resetting
    emphasisState.scaleX = this._sizeX * scaleRatio;
    emphasisState.scaleY = this._sizeY * scaleRatio;
    this.setSymbolScale(1);
    toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);
  };
  Symbol.prototype.setSymbolScale = function (scale) {
    this.scaleX = this.scaleY = scale;
  };
  Symbol.prototype.fadeOut = function (cb, seriesModel, opt) {
    var symbolPath = this.childAt(0);
    var dataIndex = getECData(this).dataIndex;
    var animationOpt = opt && opt.animation;
    // Avoid mistaken hover when fading out
    this.silent = symbolPath.silent = true;
    // Not show text when animating
    if (opt && opt.fadeLabel) {
      var textContent = symbolPath.getTextContent();
      if (textContent) {
        removeElement(textContent, {
          style: {
            opacity: 0
          }
        }, seriesModel, {
          dataIndex: dataIndex,
          removeOpt: animationOpt,
          cb: function () {
            symbolPath.removeTextContent();
          }
        });
      }
    } else {
      symbolPath.removeTextContent();
    }
    removeElement(symbolPath, {
      style: {
        opacity: 0
      },
      scaleX: 0,
      scaleY: 0
    }, seriesModel, {
      dataIndex: dataIndex,
      cb: cb,
      removeOpt: animationOpt
    });
  };
  Symbol.getSymbolSize = function (data, idx) {
    return normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));
  };
  return Symbol;
}(Group$5);
function driftSymbol(dx, dy) {
  this.parent.drift(dx, dy);
}
var SymbolClz = Symbol$1;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function symbolNeedsDraw$1(data, point, idx, opt) {
  return point && !isNaN(point[0]) && !isNaN(point[1]) && !(opt.isIgnore && opt.isIgnore(idx))
  // We do not set clipShape on group, because it will cut part of
  // the symbol element shape. We use the same clip shape here as
  // the line clip.
  && !(opt.clipShape && !opt.clipShape.contain(point[0], point[1])) && data.getItemVisual(idx, 'symbol') !== 'none';
}
function normalizeUpdateOpt(opt) {
  if (opt != null && !isObject$3(opt)) {
    opt = {
      isIgnore: opt
    };
  }
  return opt || {};
}
function makeSeriesScope$2(data) {
  var seriesModel = data.hostModel;
  var emphasisModel = seriesModel.getModel('emphasis');
  return {
    emphasisItemStyle: emphasisModel.getModel('itemStyle').getItemStyle(),
    blurItemStyle: seriesModel.getModel(['blur', 'itemStyle']).getItemStyle(),
    selectItemStyle: seriesModel.getModel(['select', 'itemStyle']).getItemStyle(),
    focus: emphasisModel.get('focus'),
    blurScope: emphasisModel.get('blurScope'),
    emphasisDisabled: emphasisModel.get('disabled'),
    hoverScale: emphasisModel.get('scale'),
    labelStatesModels: getLabelStatesModels(seriesModel),
    cursorStyle: seriesModel.get('cursor')
  };
}
var SymbolDraw = /** @class */function () {
  function SymbolDraw(SymbolCtor) {
    this.group = new Group$5();
    this._SymbolCtor = SymbolCtor || SymbolClz;
  }
  /**
   * Update symbols draw by new data
   */
  SymbolDraw.prototype.updateData = function (data, opt) {
    // Remove progressive els.
    this._progressiveEls = null;
    opt = normalizeUpdateOpt(opt);
    var group = this.group;
    var seriesModel = data.hostModel;
    var oldData = this._data;
    var SymbolCtor = this._SymbolCtor;
    var disableAnimation = opt.disableAnimation;
    var seriesScope = makeSeriesScope$2(data);
    var symbolUpdateOpt = {
      disableAnimation: disableAnimation
    };
    var getSymbolPoint = opt.getSymbolPoint || function (idx) {
      return data.getItemLayout(idx);
    };
    // There is no oldLineData only when first rendering or switching from
    // stream mode to normal mode, where previous elements should be removed.
    if (!oldData) {
      group.removeAll();
    }
    data.diff(oldData).add(function (newIdx) {
      var point = getSymbolPoint(newIdx);
      if (symbolNeedsDraw$1(data, point, newIdx, opt)) {
        var symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt);
        symbolEl.setPosition(point);
        data.setItemGraphicEl(newIdx, symbolEl);
        group.add(symbolEl);
      }
    }).update(function (newIdx, oldIdx) {
      var symbolEl = oldData.getItemGraphicEl(oldIdx);
      var point = getSymbolPoint(newIdx);
      if (!symbolNeedsDraw$1(data, point, newIdx, opt)) {
        group.remove(symbolEl);
        return;
      }
      var newSymbolType = data.getItemVisual(newIdx, 'symbol') || 'circle';
      var oldSymbolType = symbolEl && symbolEl.getSymbolType && symbolEl.getSymbolType();
      if (!symbolEl
      // Create a new if symbol type changed.
      || oldSymbolType && oldSymbolType !== newSymbolType) {
        group.remove(symbolEl);
        symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt);
        symbolEl.setPosition(point);
      } else {
        symbolEl.updateData(data, newIdx, seriesScope, symbolUpdateOpt);
        var target = {
          x: point[0],
          y: point[1]
        };
        disableAnimation ? symbolEl.attr(target) : updateProps$1(symbolEl, target, seriesModel);
      }
      // Add back
      group.add(symbolEl);
      data.setItemGraphicEl(newIdx, symbolEl);
    }).remove(function (oldIdx) {
      var el = oldData.getItemGraphicEl(oldIdx);
      el && el.fadeOut(function () {
        group.remove(el);
      }, seriesModel);
    }).execute();
    this._getSymbolPoint = getSymbolPoint;
    this._data = data;
  };
  SymbolDraw.prototype.updateLayout = function () {
    var _this = this;
    var data = this._data;
    if (data) {
      // Not use animation
      data.eachItemGraphicEl(function (el, idx) {
        var point = _this._getSymbolPoint(idx);
        el.setPosition(point);
        el.markRedraw();
      });
    }
  };
  SymbolDraw.prototype.incrementalPrepareUpdate = function (data) {
    this._seriesScope = makeSeriesScope$2(data);
    this._data = null;
    this.group.removeAll();
  };
  /**
   * Update symbols draw by new data
   */
  SymbolDraw.prototype.incrementalUpdate = function (taskParams, data, opt) {
    // Clear
    this._progressiveEls = [];
    opt = normalizeUpdateOpt(opt);
    function updateIncrementalAndHover(el) {
      if (!el.isGroup) {
        el.incremental = true;
        el.ensureState('emphasis').hoverLayer = true;
      }
    }
    for (var idx = taskParams.start; idx < taskParams.end; idx++) {
      var point = data.getItemLayout(idx);
      if (symbolNeedsDraw$1(data, point, idx, opt)) {
        var el = new this._SymbolCtor(data, idx, this._seriesScope);
        el.traverse(updateIncrementalAndHover);
        el.setPosition(point);
        this.group.add(el);
        data.setItemGraphicEl(idx, el);
        this._progressiveEls.push(el);
      }
    }
  };
  SymbolDraw.prototype.eachRendered = function (cb) {
    traverseElements(this._progressiveEls || this.group, cb);
  };
  SymbolDraw.prototype.remove = function (enableAnimation) {
    var group = this.group;
    var data = this._data;
    // Incremental model do not have this._data.
    if (data && enableAnimation) {
      data.eachItemGraphicEl(function (el) {
        el.fadeOut(function () {
          group.remove(el);
        }, data.hostModel);
      });
    } else {
      group.removeAll();
    }
  };
  return SymbolDraw;
}();
var SymbolDraw$1 = SymbolDraw;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function prepareDataCoordInfo(coordSys, data, valueOrigin) {
  var baseAxis = coordSys.getBaseAxis();
  var valueAxis = coordSys.getOtherAxis(baseAxis);
  var valueStart = getValueStart(valueAxis, valueOrigin);
  var baseAxisDim = baseAxis.dim;
  var valueAxisDim = valueAxis.dim;
  var valueDim = data.mapDimension(valueAxisDim);
  var baseDim = data.mapDimension(baseAxisDim);
  var baseDataOffset = valueAxisDim === 'x' || valueAxisDim === 'radius' ? 1 : 0;
  var dims = map$1(coordSys.dimensions, function (coordDim) {
    return data.mapDimension(coordDim);
  });
  var stacked = false;
  var stackResultDim = data.getCalculationInfo('stackResultDimension');
  if (isDimensionStacked(data, dims[0] /* , dims[1] */)) {
    // jshint ignore:line
    stacked = true;
    dims[0] = stackResultDim;
  }
  if (isDimensionStacked(data, dims[1] /* , dims[0] */)) {
    // jshint ignore:line
    stacked = true;
    dims[1] = stackResultDim;
  }
  return {
    dataDimsForPoint: dims,
    valueStart: valueStart,
    valueAxisDim: valueAxisDim,
    baseAxisDim: baseAxisDim,
    stacked: !!stacked,
    valueDim: valueDim,
    baseDim: baseDim,
    baseDataOffset: baseDataOffset,
    stackedOverDimension: data.getCalculationInfo('stackedOverDimension')
  };
}
function getValueStart(valueAxis, valueOrigin) {
  var valueStart = 0;
  var extent = valueAxis.scale.getExtent();
  if (valueOrigin === 'start') {
    valueStart = extent[0];
  } else if (valueOrigin === 'end') {
    valueStart = extent[1];
  }
  // If origin is specified as a number, use it as
  // valueStart directly
  else if (isNumber(valueOrigin) && !isNaN(valueOrigin)) {
    valueStart = valueOrigin;
  }
  // auto
  else {
    // Both positive
    if (extent[0] > 0) {
      valueStart = extent[0];
    }
    // Both negative
    else if (extent[1] < 0) {
      valueStart = extent[1];
    }
    // If is one positive, and one negative, onZero shall be true
  }
  return valueStart;
}
function getStackedOnPoint(dataCoordInfo, coordSys, data, idx) {
  var value = NaN;
  if (dataCoordInfo.stacked) {
    value = data.get(data.getCalculationInfo('stackedOverDimension'), idx);
  }
  if (isNaN(value)) {
    value = dataCoordInfo.valueStart;
  }
  var baseDataOffset = dataCoordInfo.baseDataOffset;
  var stackedData = [];
  stackedData[baseDataOffset] = data.get(dataCoordInfo.baseDim, idx);
  stackedData[1 - baseDataOffset] = value;
  return coordSys.dataToPoint(stackedData);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function diffData(oldData, newData) {
  var diffResult = [];
  newData.diff(oldData).add(function (idx) {
    diffResult.push({
      cmd: '+',
      idx: idx
    });
  }).update(function (newIdx, oldIdx) {
    diffResult.push({
      cmd: '=',
      idx: oldIdx,
      idx1: newIdx
    });
  }).remove(function (idx) {
    diffResult.push({
      cmd: '-',
      idx: idx
    });
  }).execute();
  return diffResult;
}
function lineAnimationDiff(oldData, newData, oldStackedOnPoints, newStackedOnPoints, oldCoordSys, newCoordSys, oldValueOrigin, newValueOrigin) {
  var diff = diffData(oldData, newData);
  // let newIdList = newData.mapArray(newData.getId);
  // let oldIdList = oldData.mapArray(oldData.getId);
  // convertToIntId(newIdList, oldIdList);
  // // FIXME One data ?
  // diff = arrayDiff(oldIdList, newIdList);
  var currPoints = [];
  var nextPoints = [];
  // Points for stacking base line
  var currStackedPoints = [];
  var nextStackedPoints = [];
  var status = [];
  var sortedIndices = [];
  var rawIndices = [];
  var newDataOldCoordInfo = prepareDataCoordInfo(oldCoordSys, newData, oldValueOrigin);
  // const oldDataNewCoordInfo = prepareDataCoordInfo(newCoordSys, oldData, newValueOrigin);
  var oldPoints = oldData.getLayout('points') || [];
  var newPoints = newData.getLayout('points') || [];
  for (var i = 0; i < diff.length; i++) {
    var diffItem = diff[i];
    var pointAdded = true;
    var oldIdx2 = void 0;
    var newIdx2 = void 0;
    // FIXME, animation is not so perfect when dataZoom window moves fast
    // Which is in case remvoing or add more than one data in the tail or head
    switch (diffItem.cmd) {
      case '=':
        oldIdx2 = diffItem.idx * 2;
        newIdx2 = diffItem.idx1 * 2;
        var currentX = oldPoints[oldIdx2];
        var currentY = oldPoints[oldIdx2 + 1];
        var nextX = newPoints[newIdx2];
        var nextY = newPoints[newIdx2 + 1];
        // If previous data is NaN, use next point directly
        if (isNaN(currentX) || isNaN(currentY)) {
          currentX = nextX;
          currentY = nextY;
        }
        currPoints.push(currentX, currentY);
        nextPoints.push(nextX, nextY);
        currStackedPoints.push(oldStackedOnPoints[oldIdx2], oldStackedOnPoints[oldIdx2 + 1]);
        nextStackedPoints.push(newStackedOnPoints[newIdx2], newStackedOnPoints[newIdx2 + 1]);
        rawIndices.push(newData.getRawIndex(diffItem.idx1));
        break;
      case '+':
        var newIdx = diffItem.idx;
        var newDataDimsForPoint = newDataOldCoordInfo.dataDimsForPoint;
        var oldPt = oldCoordSys.dataToPoint([newData.get(newDataDimsForPoint[0], newIdx), newData.get(newDataDimsForPoint[1], newIdx)]);
        newIdx2 = newIdx * 2;
        currPoints.push(oldPt[0], oldPt[1]);
        nextPoints.push(newPoints[newIdx2], newPoints[newIdx2 + 1]);
        var stackedOnPoint = getStackedOnPoint(newDataOldCoordInfo, oldCoordSys, newData, newIdx);
        currStackedPoints.push(stackedOnPoint[0], stackedOnPoint[1]);
        nextStackedPoints.push(newStackedOnPoints[newIdx2], newStackedOnPoints[newIdx2 + 1]);
        rawIndices.push(newData.getRawIndex(newIdx));
        break;
      case '-':
        pointAdded = false;
    }
    // Original indices
    if (pointAdded) {
      status.push(diffItem);
      sortedIndices.push(sortedIndices.length);
    }
  }
  // Diff result may be crossed if all items are changed
  // Sort by data index
  sortedIndices.sort(function (a, b) {
    return rawIndices[a] - rawIndices[b];
  });
  var len = currPoints.length;
  var sortedCurrPoints = createFloat32Array(len);
  var sortedNextPoints = createFloat32Array(len);
  var sortedCurrStackedPoints = createFloat32Array(len);
  var sortedNextStackedPoints = createFloat32Array(len);
  var sortedStatus = [];
  for (var i = 0; i < sortedIndices.length; i++) {
    var idx = sortedIndices[i];
    var i2 = i * 2;
    var idx2 = idx * 2;
    sortedCurrPoints[i2] = currPoints[idx2];
    sortedCurrPoints[i2 + 1] = currPoints[idx2 + 1];
    sortedNextPoints[i2] = nextPoints[idx2];
    sortedNextPoints[i2 + 1] = nextPoints[idx2 + 1];
    sortedCurrStackedPoints[i2] = currStackedPoints[idx2];
    sortedCurrStackedPoints[i2 + 1] = currStackedPoints[idx2 + 1];
    sortedNextStackedPoints[i2] = nextStackedPoints[idx2];
    sortedNextStackedPoints[i2 + 1] = nextStackedPoints[idx2 + 1];
    sortedStatus[i] = status[idx];
  }
  return {
    current: sortedCurrPoints,
    next: sortedNextPoints,
    stackedOnCurrent: sortedCurrStackedPoints,
    stackedOnNext: sortedNextStackedPoints,
    status: sortedStatus
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var mathMin$5 = Math.min;
var mathMax$5 = Math.max;
function isPointNull$1(x, y) {
  return isNaN(x) || isNaN(y);
}
/**
 * Draw smoothed line in non-monotone, in may cause undesired curve in extreme
 * situations. This should be used when points are non-monotone neither in x or
 * y dimension.
 */
function drawSegment(ctx, points, start, segLen, allLen, dir, smooth, smoothMonotone, connectNulls) {
  var prevX;
  var prevY;
  var cpx0;
  var cpy0;
  var cpx1;
  var cpy1;
  var idx = start;
  var k = 0;
  for (; k < segLen; k++) {
    var x = points[idx * 2];
    var y = points[idx * 2 + 1];
    if (idx >= allLen || idx < 0) {
      break;
    }
    if (isPointNull$1(x, y)) {
      if (connectNulls) {
        idx += dir;
        continue;
      }
      break;
    }
    if (idx === start) {
      ctx[dir > 0 ? 'moveTo' : 'lineTo'](x, y);
      cpx0 = x;
      cpy0 = y;
    } else {
      var dx = x - prevX;
      var dy = y - prevY;
      // Ignore tiny segment.
      if (dx * dx + dy * dy < 0.5) {
        idx += dir;
        continue;
      }
      if (smooth > 0) {
        var nextIdx = idx + dir;
        var nextX = points[nextIdx * 2];
        var nextY = points[nextIdx * 2 + 1];
        // Ignore duplicate point
        while (nextX === x && nextY === y && k < segLen) {
          k++;
          nextIdx += dir;
          idx += dir;
          nextX = points[nextIdx * 2];
          nextY = points[nextIdx * 2 + 1];
          x = points[idx * 2];
          y = points[idx * 2 + 1];
          dx = x - prevX;
          dy = y - prevY;
        }
        var tmpK = k + 1;
        if (connectNulls) {
          // Find next point not null
          while (isPointNull$1(nextX, nextY) && tmpK < segLen) {
            tmpK++;
            nextIdx += dir;
            nextX = points[nextIdx * 2];
            nextY = points[nextIdx * 2 + 1];
          }
        }
        var ratioNextSeg = 0.5;
        var vx = 0;
        var vy = 0;
        var nextCpx0 = void 0;
        var nextCpy0 = void 0;
        // Is last point
        if (tmpK >= segLen || isPointNull$1(nextX, nextY)) {
          cpx1 = x;
          cpy1 = y;
        } else {
          vx = nextX - prevX;
          vy = nextY - prevY;
          var dx0 = x - prevX;
          var dx1 = nextX - x;
          var dy0 = y - prevY;
          var dy1 = nextY - y;
          var lenPrevSeg = void 0;
          var lenNextSeg = void 0;
          if (smoothMonotone === 'x') {
            lenPrevSeg = Math.abs(dx0);
            lenNextSeg = Math.abs(dx1);
            var dir_1 = vx > 0 ? 1 : -1;
            cpx1 = x - dir_1 * lenPrevSeg * smooth;
            cpy1 = y;
            nextCpx0 = x + dir_1 * lenNextSeg * smooth;
            nextCpy0 = y;
          } else if (smoothMonotone === 'y') {
            lenPrevSeg = Math.abs(dy0);
            lenNextSeg = Math.abs(dy1);
            var dir_2 = vy > 0 ? 1 : -1;
            cpx1 = x;
            cpy1 = y - dir_2 * lenPrevSeg * smooth;
            nextCpx0 = x;
            nextCpy0 = y + dir_2 * lenNextSeg * smooth;
          } else {
            lenPrevSeg = Math.sqrt(dx0 * dx0 + dy0 * dy0);
            lenNextSeg = Math.sqrt(dx1 * dx1 + dy1 * dy1);
            // Use ratio of seg length
            ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg);
            cpx1 = x - vx * smooth * (1 - ratioNextSeg);
            cpy1 = y - vy * smooth * (1 - ratioNextSeg);
            // cp0 of next segment
            nextCpx0 = x + vx * smooth * ratioNextSeg;
            nextCpy0 = y + vy * smooth * ratioNextSeg;
            // Smooth constraint between point and next point.
            // Avoid exceeding extreme after smoothing.
            nextCpx0 = mathMin$5(nextCpx0, mathMax$5(nextX, x));
            nextCpy0 = mathMin$5(nextCpy0, mathMax$5(nextY, y));
            nextCpx0 = mathMax$5(nextCpx0, mathMin$5(nextX, x));
            nextCpy0 = mathMax$5(nextCpy0, mathMin$5(nextY, y));
            // Reclaculate cp1 based on the adjusted cp0 of next seg.
            vx = nextCpx0 - x;
            vy = nextCpy0 - y;
            cpx1 = x - vx * lenPrevSeg / lenNextSeg;
            cpy1 = y - vy * lenPrevSeg / lenNextSeg;
            // Smooth constraint between point and prev point.
            // Avoid exceeding extreme after smoothing.
            cpx1 = mathMin$5(cpx1, mathMax$5(prevX, x));
            cpy1 = mathMin$5(cpy1, mathMax$5(prevY, y));
            cpx1 = mathMax$5(cpx1, mathMin$5(prevX, x));
            cpy1 = mathMax$5(cpy1, mathMin$5(prevY, y));
            // Adjust next cp0 again.
            vx = x - cpx1;
            vy = y - cpy1;
            nextCpx0 = x + vx * lenNextSeg / lenPrevSeg;
            nextCpy0 = y + vy * lenNextSeg / lenPrevSeg;
          }
        }
        ctx.bezierCurveTo(cpx0, cpy0, cpx1, cpy1, x, y);
        cpx0 = nextCpx0;
        cpy0 = nextCpy0;
      } else {
        ctx.lineTo(x, y);
      }
    }
    prevX = x;
    prevY = y;
    idx += dir;
  }
  return k;
}
var ECPolylineShape = /** @class */function () {
  function ECPolylineShape() {
    this.smooth = 0;
    this.smoothConstraint = true;
  }
  return ECPolylineShape;
}();
var ECPolyline = /** @class */function (_super) {
  __extends(ECPolyline, _super);
  function ECPolyline(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'ec-polyline';
    return _this;
  }
  ECPolyline.prototype.getDefaultStyle = function () {
    return {
      stroke: '#000',
      fill: null
    };
  };
  ECPolyline.prototype.getDefaultShape = function () {
    return new ECPolylineShape();
  };
  ECPolyline.prototype.buildPath = function (ctx, shape) {
    var points = shape.points;
    var i = 0;
    var len = points.length / 2;
    // const result = getBoundingBox(points, shape.smoothConstraint);
    if (shape.connectNulls) {
      // Must remove first and last null values avoid draw error in polygon
      for (; len > 0; len--) {
        if (!isPointNull$1(points[len * 2 - 2], points[len * 2 - 1])) {
          break;
        }
      }
      for (; i < len; i++) {
        if (!isPointNull$1(points[i * 2], points[i * 2 + 1])) {
          break;
        }
      }
    }
    while (i < len) {
      i += drawSegment(ctx, points, i, len, len, 1, shape.smooth, shape.smoothMonotone, shape.connectNulls) + 1;
    }
  };
  ECPolyline.prototype.getPointOn = function (xOrY, dim) {
    if (!this.path) {
      this.createPathProxy();
      this.buildPath(this.path, this.shape);
    }
    var path = this.path;
    var data = path.data;
    var CMD = PathProxy.CMD;
    var x0;
    var y0;
    var isDimX = dim === 'x';
    var roots = [];
    for (var i = 0; i < data.length;) {
      var cmd = data[i++];
      var x = void 0;
      var y = void 0;
      var x2 = void 0;
      var y2 = void 0;
      var x3 = void 0;
      var y3 = void 0;
      var t = void 0;
      switch (cmd) {
        case CMD.M:
          x0 = data[i++];
          y0 = data[i++];
          break;
        case CMD.L:
          x = data[i++];
          y = data[i++];
          t = isDimX ? (xOrY - x0) / (x - x0) : (xOrY - y0) / (y - y0);
          if (t <= 1 && t >= 0) {
            var val = isDimX ? (y - y0) * t + y0 : (x - x0) * t + x0;
            return isDimX ? [xOrY, val] : [val, xOrY];
          }
          x0 = x;
          y0 = y;
          break;
        case CMD.C:
          x = data[i++];
          y = data[i++];
          x2 = data[i++];
          y2 = data[i++];
          x3 = data[i++];
          y3 = data[i++];
          var nRoot = isDimX ? cubicRootAt(x0, x, x2, x3, xOrY, roots) : cubicRootAt(y0, y, y2, y3, xOrY, roots);
          if (nRoot > 0) {
            for (var i_1 = 0; i_1 < nRoot; i_1++) {
              var t_1 = roots[i_1];
              if (t_1 <= 1 && t_1 >= 0) {
                var val = isDimX ? cubicAt(y0, y, y2, y3, t_1) : cubicAt(x0, x, x2, x3, t_1);
                return isDimX ? [xOrY, val] : [val, xOrY];
              }
            }
          }
          x0 = x3;
          y0 = y3;
          break;
      }
    }
  };
  return ECPolyline;
}(Path$1);
var ECPolygonShape = /** @class */function (_super) {
  __extends(ECPolygonShape, _super);
  function ECPolygonShape() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  return ECPolygonShape;
}(ECPolylineShape);
var ECPolygon = /** @class */function (_super) {
  __extends(ECPolygon, _super);
  function ECPolygon(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'ec-polygon';
    return _this;
  }
  ECPolygon.prototype.getDefaultShape = function () {
    return new ECPolygonShape();
  };
  ECPolygon.prototype.buildPath = function (ctx, shape) {
    var points = shape.points;
    var stackedOnPoints = shape.stackedOnPoints;
    var i = 0;
    var len = points.length / 2;
    var smoothMonotone = shape.smoothMonotone;
    if (shape.connectNulls) {
      // Must remove first and last null values avoid draw error in polygon
      for (; len > 0; len--) {
        if (!isPointNull$1(points[len * 2 - 2], points[len * 2 - 1])) {
          break;
        }
      }
      for (; i < len; i++) {
        if (!isPointNull$1(points[i * 2], points[i * 2 + 1])) {
          break;
        }
      }
    }
    while (i < len) {
      var k = drawSegment(ctx, points, i, len, len, 1, shape.smooth, smoothMonotone, shape.connectNulls);
      drawSegment(ctx, stackedOnPoints, i + k - 1, k, len, -1, shape.stackedOnSmooth, smoothMonotone, shape.connectNulls);
      i += k + 1;
      ctx.closePath();
    }
  };
  return ECPolygon;
}(Path$1);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function createGridClipPath(cartesian, hasAnimation, seriesModel, done, during) {
  var rect = cartesian.getArea();
  var x = rect.x;
  var y = rect.y;
  var width = rect.width;
  var height = rect.height;
  var lineWidth = seriesModel.get(['lineStyle', 'width']) || 0;
  // Expand the clip path a bit to avoid the border is clipped and looks thinner
  x -= lineWidth / 2;
  y -= lineWidth / 2;
  width += lineWidth;
  height += lineWidth;
  // fix: https://github.com/apache/incubator-echarts/issues/11369
  width = Math.ceil(width);
  if (x !== Math.floor(x)) {
    x = Math.floor(x);
    // if no extra 1px on `width`, it will still be clipped since `x` is floored
    width++;
  }
  var clipPath = new Rect$3({
    shape: {
      x: x,
      y: y,
      width: width,
      height: height
    }
  });
  if (hasAnimation) {
    var baseAxis = cartesian.getBaseAxis();
    var isHorizontal = baseAxis.isHorizontal();
    var isAxisInversed = baseAxis.inverse;
    if (isHorizontal) {
      if (isAxisInversed) {
        clipPath.shape.x += width;
      }
      clipPath.shape.width = 0;
    } else {
      if (!isAxisInversed) {
        clipPath.shape.y += height;
      }
      clipPath.shape.height = 0;
    }
    var duringCb = isFunction(during) ? function (percent) {
      during(percent, clipPath);
    } : null;
    initProps(clipPath, {
      shape: {
        width: width,
        height: height,
        x: x,
        y: y
      }
    }, seriesModel, null, done, duringCb);
  }
  return clipPath;
}
function createPolarClipPath(polar, hasAnimation, seriesModel) {
  var sectorArea = polar.getArea();
  // Avoid float number rounding error for symbol on the edge of axis extent.
  var r0 = round$4(sectorArea.r0, 1);
  var r = round$4(sectorArea.r, 1);
  var clipPath = new Sector$1({
    shape: {
      cx: round$4(polar.cx, 1),
      cy: round$4(polar.cy, 1),
      r0: r0,
      r: r,
      startAngle: sectorArea.startAngle,
      endAngle: sectorArea.endAngle,
      clockwise: sectorArea.clockwise
    }
  });
  if (hasAnimation) {
    var isRadial = polar.getBaseAxis().dim === 'angle';
    if (isRadial) {
      clipPath.shape.endAngle = sectorArea.startAngle;
    } else {
      clipPath.shape.r = r0;
    }
    initProps(clipPath, {
      shape: {
        endAngle: sectorArea.endAngle,
        r: r
      }
    }, seriesModel);
  }
  return clipPath;
}
function createClipPath(coordSys, hasAnimation, seriesModel, done, during) {
  if (!coordSys) {
    return null;
  } else if (coordSys.type === 'polar') {
    return createPolarClipPath(coordSys, hasAnimation, seriesModel);
  } else if (coordSys.type === 'cartesian2d') {
    return createGridClipPath(coordSys, hasAnimation, seriesModel, done, during);
  }
  return null;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function isCoordinateSystemType(coordSys, type) {
  return coordSys.type === type;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function isPointsSame(points1, points2) {
  if (points1.length !== points2.length) {
    return;
  }
  for (var i = 0; i < points1.length; i++) {
    if (points1[i] !== points2[i]) {
      return;
    }
  }
  return true;
}
function bboxFromPoints(points) {
  var minX = Infinity;
  var minY = Infinity;
  var maxX = -Infinity;
  var maxY = -Infinity;
  for (var i = 0; i < points.length;) {
    var x = points[i++];
    var y = points[i++];
    if (!isNaN(x)) {
      minX = Math.min(x, minX);
      maxX = Math.max(x, maxX);
    }
    if (!isNaN(y)) {
      minY = Math.min(y, minY);
      maxY = Math.max(y, maxY);
    }
  }
  return [[minX, minY], [maxX, maxY]];
}
function getBoundingDiff(points1, points2) {
  var _a = bboxFromPoints(points1),
    min1 = _a[0],
    max1 = _a[1];
  var _b = bboxFromPoints(points2),
    min2 = _b[0],
    max2 = _b[1];
  // Get a max value from each corner of two boundings.
  return Math.max(Math.abs(min1[0] - min2[0]), Math.abs(min1[1] - min2[1]), Math.abs(max1[0] - max2[0]), Math.abs(max1[1] - max2[1]));
}
function getSmooth(smooth) {
  return isNumber(smooth) ? smooth : smooth ? 0.5 : 0;
}
function getStackedOnPoints(coordSys, data, dataCoordInfo) {
  if (!dataCoordInfo.valueDim) {
    return [];
  }
  var len = data.count();
  var points = createFloat32Array(len * 2);
  for (var idx = 0; idx < len; idx++) {
    var pt = getStackedOnPoint(dataCoordInfo, coordSys, data, idx);
    points[idx * 2] = pt[0];
    points[idx * 2 + 1] = pt[1];
  }
  return points;
}
/**
 * Filter the null data and extend data for step considering `stepTurnAt`
 *
 * @param points data to convert, that may containing null
 * @param basePoints base data to reference, used only for areaStyle points
 * @param coordSys coordinate system
 * @param stepTurnAt 'start' | 'end' | 'middle' | true
 * @param connectNulls whether to connect nulls
 * @returns converted point positions
 */
function turnPointsIntoStep(points, basePoints, coordSys, stepTurnAt, connectNulls) {
  var baseAxis = coordSys.getBaseAxis();
  var baseIndex = baseAxis.dim === 'x' || baseAxis.dim === 'radius' ? 0 : 1;
  var stepPoints = [];
  var i = 0;
  var stepPt = [];
  var pt = [];
  var nextPt = [];
  var filteredPoints = [];
  if (connectNulls) {
    for (i = 0; i < points.length; i += 2) {
      /**
       * For areaStyle of stepped lines, `stackedOnPoints` should be
       * filtered the same as `points` so that the base axis values
       * should stay the same as the lines above. See #20021
       */
      var reference = basePoints || points;
      if (!isNaN(reference[i]) && !isNaN(reference[i + 1])) {
        filteredPoints.push(points[i], points[i + 1]);
      }
    }
    points = filteredPoints;
  }
  for (i = 0; i < points.length - 2; i += 2) {
    nextPt[0] = points[i + 2];
    nextPt[1] = points[i + 3];
    pt[0] = points[i];
    pt[1] = points[i + 1];
    stepPoints.push(pt[0], pt[1]);
    switch (stepTurnAt) {
      case 'end':
        stepPt[baseIndex] = nextPt[baseIndex];
        stepPt[1 - baseIndex] = pt[1 - baseIndex];
        stepPoints.push(stepPt[0], stepPt[1]);
        break;
      case 'middle':
        var middle = (pt[baseIndex] + nextPt[baseIndex]) / 2;
        var stepPt2 = [];
        stepPt[baseIndex] = stepPt2[baseIndex] = middle;
        stepPt[1 - baseIndex] = pt[1 - baseIndex];
        stepPt2[1 - baseIndex] = nextPt[1 - baseIndex];
        stepPoints.push(stepPt[0], stepPt[1]);
        stepPoints.push(stepPt2[0], stepPt2[1]);
        break;
      default:
        // default is start
        stepPt[baseIndex] = pt[baseIndex];
        stepPt[1 - baseIndex] = nextPt[1 - baseIndex];
        stepPoints.push(stepPt[0], stepPt[1]);
    }
  }
  // Last points
  stepPoints.push(points[i++], points[i++]);
  return stepPoints;
}
/**
 * Clip color stops to edge. Avoid creating too large gradients.
 * Which may lead to blurry when GPU acceleration is enabled. See #15680
 *
 * The stops has been sorted from small to large.
 */
function clipColorStops(colorStops, maxSize) {
  var newColorStops = [];
  var len = colorStops.length;
  // coord will always < 0 in prevOutOfRangeColorStop.
  var prevOutOfRangeColorStop;
  var prevInRangeColorStop;
  function lerpStop(stop0, stop1, clippedCoord) {
    var coord0 = stop0.coord;
    var p = (clippedCoord - coord0) / (stop1.coord - coord0);
    var color = lerp$2(p, [stop0.color, stop1.color]);
    return {
      coord: clippedCoord,
      color: color
    };
  }
  for (var i = 0; i < len; i++) {
    var stop_1 = colorStops[i];
    var coord = stop_1.coord;
    if (coord < 0) {
      prevOutOfRangeColorStop = stop_1;
    } else if (coord > maxSize) {
      if (prevInRangeColorStop) {
        newColorStops.push(lerpStop(prevInRangeColorStop, stop_1, maxSize));
      } else if (prevOutOfRangeColorStop) {
        // If there are two stops and coord range is between these two stops
        newColorStops.push(lerpStop(prevOutOfRangeColorStop, stop_1, 0), lerpStop(prevOutOfRangeColorStop, stop_1, maxSize));
      }
      // All following stop will be out of range. So just ignore them.
      break;
    } else {
      if (prevOutOfRangeColorStop) {
        newColorStops.push(lerpStop(prevOutOfRangeColorStop, stop_1, 0));
        // Reset
        prevOutOfRangeColorStop = null;
      }
      newColorStops.push(stop_1);
      prevInRangeColorStop = stop_1;
    }
  }
  return newColorStops;
}
function getVisualGradient(data, coordSys, api) {
  var visualMetaList = data.getVisual('visualMeta');
  if (!visualMetaList || !visualMetaList.length || !data.count()) {
    // When data.count() is 0, gradient range can not be calculated.
    return;
  }
  if (coordSys.type !== 'cartesian2d') {
    {
      console.warn('Visual map on line style is only supported on cartesian2d.');
    }
    return;
  }
  var coordDim;
  var visualMeta;
  for (var i = visualMetaList.length - 1; i >= 0; i--) {
    var dimInfo = data.getDimensionInfo(visualMetaList[i].dimension);
    coordDim = dimInfo && dimInfo.coordDim;
    // Can only be x or y
    if (coordDim === 'x' || coordDim === 'y') {
      visualMeta = visualMetaList[i];
      break;
    }
  }
  if (!visualMeta) {
    {
      console.warn('Visual map on line style only support x or y dimension.');
    }
    return;
  }
  // If the area to be rendered is bigger than area defined by LinearGradient,
  // the canvas spec prescribes that the color of the first stop and the last
  // stop should be used. But if two stops are added at offset 0, in effect
  // browsers use the color of the second stop to render area outside
  // LinearGradient. So we can only infinitesimally extend area defined in
  // LinearGradient to render `outerColors`.
  var axis = coordSys.getAxis(coordDim);
  // dataToCoord mapping may not be linear, but must be monotonic.
  var colorStops = map$1(visualMeta.stops, function (stop) {
    // offset will be calculated later.
    return {
      coord: axis.toGlobalCoord(axis.dataToCoord(stop.value)),
      color: stop.color
    };
  });
  var stopLen = colorStops.length;
  var outerColors = visualMeta.outerColors.slice();
  if (stopLen && colorStops[0].coord > colorStops[stopLen - 1].coord) {
    colorStops.reverse();
    outerColors.reverse();
  }
  var colorStopsInRange = clipColorStops(colorStops, coordDim === 'x' ? api.getWidth() : api.getHeight());
  var inRangeStopLen = colorStopsInRange.length;
  if (!inRangeStopLen && stopLen) {
    // All stops are out of range. All will be the same color.
    return colorStops[0].coord < 0 ? outerColors[1] ? outerColors[1] : colorStops[stopLen - 1].color : outerColors[0] ? outerColors[0] : colorStops[0].color;
  }
  var tinyExtent = 10; // Arbitrary value: 10px
  var minCoord = colorStopsInRange[0].coord - tinyExtent;
  var maxCoord = colorStopsInRange[inRangeStopLen - 1].coord + tinyExtent;
  var coordSpan = maxCoord - minCoord;
  if (coordSpan < 1e-3) {
    return 'transparent';
  }
  each$f(colorStopsInRange, function (stop) {
    stop.offset = (stop.coord - minCoord) / coordSpan;
  });
  colorStopsInRange.push({
    // NOTE: inRangeStopLen may still be 0 if stoplen is zero.
    offset: inRangeStopLen ? colorStopsInRange[inRangeStopLen - 1].offset : 0.5,
    color: outerColors[1] || 'transparent'
  });
  colorStopsInRange.unshift({
    offset: inRangeStopLen ? colorStopsInRange[0].offset : 0.5,
    color: outerColors[0] || 'transparent'
  });
  var gradient = new LinearGradient$1(0, 0, 0, 0, colorStopsInRange, true);
  gradient[coordDim] = minCoord;
  gradient[coordDim + '2'] = maxCoord;
  return gradient;
}
function getIsIgnoreFunc(seriesModel, data, coordSys) {
  var showAllSymbol = seriesModel.get('showAllSymbol');
  var isAuto = showAllSymbol === 'auto';
  if (showAllSymbol && !isAuto) {
    return;
  }
  var categoryAxis = coordSys.getAxesByScale('ordinal')[0];
  if (!categoryAxis) {
    return;
  }
  // Note that category label interval strategy might bring some weird effect
  // in some scenario: users may wonder why some of the symbols are not
  // displayed. So we show all symbols as possible as we can.
  if (isAuto
  // Simplify the logic, do not determine label overlap here.
  && canShowAllSymbolForCategory(categoryAxis, data)) {
    return;
  }
  // Otherwise follow the label interval strategy on category axis.
  var categoryDataDim = data.mapDimension(categoryAxis.dim);
  var labelMap = {};
  each$f(categoryAxis.getViewLabels(), function (labelItem) {
    var ordinalNumber = categoryAxis.scale.getRawOrdinalNumber(labelItem.tickValue);
    labelMap[ordinalNumber] = 1;
  });
  return function (dataIndex) {
    return !labelMap.hasOwnProperty(data.get(categoryDataDim, dataIndex));
  };
}
function canShowAllSymbolForCategory(categoryAxis, data) {
  // In most cases, line is monotonous on category axis, and the label size
  // is close with each other. So we check the symbol size and some of the
  // label size alone with the category axis to estimate whether all symbol
  // can be shown without overlap.
  var axisExtent = categoryAxis.getExtent();
  var availSize = Math.abs(axisExtent[1] - axisExtent[0]) / categoryAxis.scale.count();
  isNaN(availSize) && (availSize = 0); // 0/0 is NaN.
  // Sampling some points, max 5.
  var dataLen = data.count();
  var step = Math.max(1, Math.round(dataLen / 5));
  for (var dataIndex = 0; dataIndex < dataLen; dataIndex += step) {
    if (SymbolClz.getSymbolSize(data, dataIndex
    // Only for cartesian, where `isHorizontal` exists.
    )[categoryAxis.isHorizontal() ? 1 : 0]
    // Empirical number
    * 1.5 > availSize) {
      return false;
    }
  }
  return true;
}
function isPointNull(x, y) {
  return isNaN(x) || isNaN(y);
}
function getLastIndexNotNull(points) {
  var len = points.length / 2;
  for (; len > 0; len--) {
    if (!isPointNull(points[len * 2 - 2], points[len * 2 - 1])) {
      break;
    }
  }
  return len - 1;
}
function getPointAtIndex(points, idx) {
  return [points[idx * 2], points[idx * 2 + 1]];
}
function getIndexRange(points, xOrY, dim) {
  var len = points.length / 2;
  var dimIdx = dim === 'x' ? 0 : 1;
  var a;
  var b;
  var prevIndex = 0;
  var nextIndex = -1;
  for (var i = 0; i < len; i++) {
    b = points[i * 2 + dimIdx];
    if (isNaN(b) || isNaN(points[i * 2 + 1 - dimIdx])) {
      continue;
    }
    if (i === 0) {
      a = b;
      continue;
    }
    if (a <= xOrY && b >= xOrY || a >= xOrY && b <= xOrY) {
      nextIndex = i;
      break;
    }
    prevIndex = i;
    a = b;
  }
  return {
    range: [prevIndex, nextIndex],
    t: (xOrY - a) / (b - a)
  };
}
function anyStateShowEndLabel(seriesModel) {
  if (seriesModel.get(['endLabel', 'show'])) {
    return true;
  }
  for (var i = 0; i < SPECIAL_STATES.length; i++) {
    if (seriesModel.get([SPECIAL_STATES[i], 'endLabel', 'show'])) {
      return true;
    }
  }
  return false;
}
function createLineClipPath(lineView, coordSys, hasAnimation, seriesModel) {
  if (isCoordinateSystemType(coordSys, 'cartesian2d')) {
    var endLabelModel_1 = seriesModel.getModel('endLabel');
    var valueAnimation_1 = endLabelModel_1.get('valueAnimation');
    var data_1 = seriesModel.getData();
    var labelAnimationRecord_1 = {
      lastFrameIndex: 0
    };
    var during = anyStateShowEndLabel(seriesModel) ? function (percent, clipRect) {
      lineView._endLabelOnDuring(percent, clipRect, data_1, labelAnimationRecord_1, valueAnimation_1, endLabelModel_1, coordSys);
    } : null;
    var isHorizontal = coordSys.getBaseAxis().isHorizontal();
    var clipPath = createGridClipPath(coordSys, hasAnimation, seriesModel, function () {
      var endLabel = lineView._endLabel;
      if (endLabel && hasAnimation) {
        if (labelAnimationRecord_1.originalX != null) {
          endLabel.attr({
            x: labelAnimationRecord_1.originalX,
            y: labelAnimationRecord_1.originalY
          });
        }
      }
    }, during);
    // Expand clip shape to avoid clipping when line value exceeds axis
    if (!seriesModel.get('clip', true)) {
      var rectShape = clipPath.shape;
      var expandSize = Math.max(rectShape.width, rectShape.height);
      if (isHorizontal) {
        rectShape.y -= expandSize;
        rectShape.height += expandSize * 2;
      } else {
        rectShape.x -= expandSize;
        rectShape.width += expandSize * 2;
      }
    }
    // Set to the final frame. To make sure label layout is right.
    if (during) {
      during(1, clipPath);
    }
    return clipPath;
  } else {
    {
      if (seriesModel.get(['endLabel', 'show'])) {
        console.warn('endLabel is not supported for lines in polar systems.');
      }
    }
    return createPolarClipPath(coordSys, hasAnimation, seriesModel);
  }
}
function getEndLabelStateSpecified(endLabelModel, coordSys) {
  var baseAxis = coordSys.getBaseAxis();
  var isHorizontal = baseAxis.isHorizontal();
  var isBaseInversed = baseAxis.inverse;
  var align = isHorizontal ? isBaseInversed ? 'right' : 'left' : 'center';
  var verticalAlign = isHorizontal ? 'middle' : isBaseInversed ? 'top' : 'bottom';
  return {
    normal: {
      align: endLabelModel.get('align') || align,
      verticalAlign: endLabelModel.get('verticalAlign') || verticalAlign
    }
  };
}
var LineView = /** @class */function (_super) {
  __extends(LineView, _super);
  function LineView() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  LineView.prototype.init = function () {
    var lineGroup = new Group$5();
    var symbolDraw = new SymbolDraw$1();
    this.group.add(symbolDraw.group);
    this._symbolDraw = symbolDraw;
    this._lineGroup = lineGroup;
    this._changePolyState = bind$1(this._changePolyState, this);
  };
  LineView.prototype.render = function (seriesModel, ecModel, api) {
    var coordSys = seriesModel.coordinateSystem;
    var group = this.group;
    var data = seriesModel.getData();
    var lineStyleModel = seriesModel.getModel('lineStyle');
    var areaStyleModel = seriesModel.getModel('areaStyle');
    var points = data.getLayout('points') || [];
    var isCoordSysPolar = coordSys.type === 'polar';
    var prevCoordSys = this._coordSys;
    var symbolDraw = this._symbolDraw;
    var polyline = this._polyline;
    var polygon = this._polygon;
    var lineGroup = this._lineGroup;
    var hasAnimation = !ecModel.ssr && seriesModel.get('animation');
    var isAreaChart = !areaStyleModel.isEmpty();
    var valueOrigin = areaStyleModel.get('origin');
    var dataCoordInfo = prepareDataCoordInfo(coordSys, data, valueOrigin);
    var stackedOnPoints = isAreaChart && getStackedOnPoints(coordSys, data, dataCoordInfo);
    var showSymbol = seriesModel.get('showSymbol');
    var connectNulls = seriesModel.get('connectNulls');
    var isIgnoreFunc = showSymbol && !isCoordSysPolar && getIsIgnoreFunc(seriesModel, data, coordSys);
    // Remove temporary symbols
    var oldData = this._data;
    oldData && oldData.eachItemGraphicEl(function (el, idx) {
      if (el.__temp) {
        group.remove(el);
        oldData.setItemGraphicEl(idx, null);
      }
    });
    // Remove previous created symbols if showSymbol changed to false
    if (!showSymbol) {
      symbolDraw.remove();
    }
    group.add(lineGroup);
    // FIXME step not support polar
    var step = !isCoordSysPolar ? seriesModel.get('step') : false;
    var clipShapeForSymbol;
    if (coordSys && coordSys.getArea && seriesModel.get('clip', true)) {
      clipShapeForSymbol = coordSys.getArea();
      // Avoid float number rounding error for symbol on the edge of axis extent.
      // See #7913 and `test/dataZoom-clip.html`.
      if (clipShapeForSymbol.width != null) {
        clipShapeForSymbol.x -= 0.1;
        clipShapeForSymbol.y -= 0.1;
        clipShapeForSymbol.width += 0.2;
        clipShapeForSymbol.height += 0.2;
      } else if (clipShapeForSymbol.r0) {
        clipShapeForSymbol.r0 -= 0.5;
        clipShapeForSymbol.r += 0.5;
      }
    }
    this._clipShapeForSymbol = clipShapeForSymbol;
    var visualColor = getVisualGradient(data, coordSys, api) || data.getVisual('style')[data.getVisual('drawType')];
    // Initialization animation or coordinate system changed
    if (!(polyline && prevCoordSys.type === coordSys.type && step === this._step)) {
      showSymbol && symbolDraw.updateData(data, {
        isIgnore: isIgnoreFunc,
        clipShape: clipShapeForSymbol,
        disableAnimation: true,
        getSymbolPoint: function (idx) {
          return [points[idx * 2], points[idx * 2 + 1]];
        }
      });
      hasAnimation && this._initSymbolLabelAnimation(data, coordSys, clipShapeForSymbol);
      if (step) {
        if (stackedOnPoints) {
          stackedOnPoints = turnPointsIntoStep(stackedOnPoints, points, coordSys, step, connectNulls);
        }
        // TODO If stacked series is not step
        points = turnPointsIntoStep(points, null, coordSys, step, connectNulls);
      }
      polyline = this._newPolyline(points);
      if (isAreaChart) {
        polygon = this._newPolygon(points, stackedOnPoints);
      } // If areaStyle is removed
      else if (polygon) {
        lineGroup.remove(polygon);
        polygon = this._polygon = null;
      }
      // NOTE: Must update _endLabel before setClipPath.
      if (!isCoordSysPolar) {
        this._initOrUpdateEndLabel(seriesModel, coordSys, convertToColorString(visualColor));
      }
      lineGroup.setClipPath(createLineClipPath(this, coordSys, true, seriesModel));
    } else {
      if (isAreaChart && !polygon) {
        // If areaStyle is added
        polygon = this._newPolygon(points, stackedOnPoints);
      } else if (polygon && !isAreaChart) {
        // If areaStyle is removed
        lineGroup.remove(polygon);
        polygon = this._polygon = null;
      }
      // NOTE: Must update _endLabel before setClipPath.
      if (!isCoordSysPolar) {
        this._initOrUpdateEndLabel(seriesModel, coordSys, convertToColorString(visualColor));
      }
      // Update clipPath
      var oldClipPath = lineGroup.getClipPath();
      if (oldClipPath) {
        var newClipPath = createLineClipPath(this, coordSys, false, seriesModel);
        initProps(oldClipPath, {
          shape: newClipPath.shape
        }, seriesModel);
      } else {
        lineGroup.setClipPath(createLineClipPath(this, coordSys, true, seriesModel));
      }
      // Always update, or it is wrong in the case turning on legend
      // because points are not changed.
      showSymbol && symbolDraw.updateData(data, {
        isIgnore: isIgnoreFunc,
        clipShape: clipShapeForSymbol,
        disableAnimation: true,
        getSymbolPoint: function (idx) {
          return [points[idx * 2], points[idx * 2 + 1]];
        }
      });
      // In the case data zoom triggered refreshing frequently
      // Data may not change if line has a category axis. So it should animate nothing.
      if (!isPointsSame(this._stackedOnPoints, stackedOnPoints) || !isPointsSame(this._points, points)) {
        if (hasAnimation) {
          this._doUpdateAnimation(data, stackedOnPoints, coordSys, api, step, valueOrigin, connectNulls);
        } else {
          // Not do it in update with animation
          if (step) {
            if (stackedOnPoints) {
              stackedOnPoints = turnPointsIntoStep(stackedOnPoints, points, coordSys, step, connectNulls);
            }
            // TODO If stacked series is not step
            points = turnPointsIntoStep(points, null, coordSys, step, connectNulls);
          }
          polyline.setShape({
            points: points
          });
          polygon && polygon.setShape({
            points: points,
            stackedOnPoints: stackedOnPoints
          });
        }
      }
    }
    var emphasisModel = seriesModel.getModel('emphasis');
    var focus = emphasisModel.get('focus');
    var blurScope = emphasisModel.get('blurScope');
    var emphasisDisabled = emphasisModel.get('disabled');
    polyline.useStyle(defaults(
    // Use color in lineStyle first
    lineStyleModel.getLineStyle(), {
      fill: 'none',
      stroke: visualColor,
      lineJoin: 'bevel'
    }));
    setStatesStylesFromModel(polyline, seriesModel, 'lineStyle');
    if (polyline.style.lineWidth > 0 && seriesModel.get(['emphasis', 'lineStyle', 'width']) === 'bolder') {
      var emphasisLineStyle = polyline.getState('emphasis').style;
      emphasisLineStyle.lineWidth = +polyline.style.lineWidth + 1;
    }
    // Needs seriesIndex for focus
    getECData(polyline).seriesIndex = seriesModel.seriesIndex;
    toggleHoverEmphasis(polyline, focus, blurScope, emphasisDisabled);
    var smooth = getSmooth(seriesModel.get('smooth'));
    var smoothMonotone = seriesModel.get('smoothMonotone');
    polyline.setShape({
      smooth: smooth,
      smoothMonotone: smoothMonotone,
      connectNulls: connectNulls
    });
    if (polygon) {
      var stackedOnSeries = data.getCalculationInfo('stackedOnSeries');
      var stackedOnSmooth = 0;
      polygon.useStyle(defaults(areaStyleModel.getAreaStyle(), {
        fill: visualColor,
        opacity: 0.7,
        lineJoin: 'bevel',
        decal: data.getVisual('style').decal
      }));
      if (stackedOnSeries) {
        stackedOnSmooth = getSmooth(stackedOnSeries.get('smooth'));
      }
      polygon.setShape({
        smooth: smooth,
        stackedOnSmooth: stackedOnSmooth,
        smoothMonotone: smoothMonotone,
        connectNulls: connectNulls
      });
      setStatesStylesFromModel(polygon, seriesModel, 'areaStyle');
      // Needs seriesIndex for focus
      getECData(polygon).seriesIndex = seriesModel.seriesIndex;
      toggleHoverEmphasis(polygon, focus, blurScope, emphasisDisabled);
    }
    var changePolyState = this._changePolyState;
    data.eachItemGraphicEl(function (el) {
      // Switch polyline / polygon state if element changed its state.
      el && (el.onHoverStateChange = changePolyState);
    });
    this._polyline.onHoverStateChange = changePolyState;
    this._data = data;
    // Save the coordinate system for transition animation when data changed
    this._coordSys = coordSys;
    this._stackedOnPoints = stackedOnPoints;
    this._points = points;
    this._step = step;
    this._valueOrigin = valueOrigin;
    if (seriesModel.get('triggerLineEvent')) {
      this.packEventData(seriesModel, polyline);
      polygon && this.packEventData(seriesModel, polygon);
    }
  };
  LineView.prototype.packEventData = function (seriesModel, el) {
    getECData(el).eventData = {
      componentType: 'series',
      componentSubType: 'line',
      componentIndex: seriesModel.componentIndex,
      seriesIndex: seriesModel.seriesIndex,
      seriesName: seriesModel.name,
      seriesType: 'line'
    };
  };
  LineView.prototype.highlight = function (seriesModel, ecModel, api, payload) {
    var data = seriesModel.getData();
    var dataIndex = queryDataIndex(data, payload);
    this._changePolyState('emphasis');
    if (!(dataIndex instanceof Array) && dataIndex != null && dataIndex >= 0) {
      var points = data.getLayout('points');
      var symbol = data.getItemGraphicEl(dataIndex);
      if (!symbol) {
        // Create a temporary symbol if it is not exists
        var x = points[dataIndex * 2];
        var y = points[dataIndex * 2 + 1];
        if (isNaN(x) || isNaN(y)) {
          // Null data
          return;
        }
        // fix #11360: shouldn't draw symbol outside clipShapeForSymbol
        if (this._clipShapeForSymbol && !this._clipShapeForSymbol.contain(x, y)) {
          return;
        }
        var zlevel = seriesModel.get('zlevel') || 0;
        var z = seriesModel.get('z') || 0;
        symbol = new SymbolClz(data, dataIndex);
        symbol.x = x;
        symbol.y = y;
        symbol.setZ(zlevel, z);
        // ensure label text of the temporary symbol is in front of line and area polygon
        var symbolLabel = symbol.getSymbolPath().getTextContent();
        if (symbolLabel) {
          symbolLabel.zlevel = zlevel;
          symbolLabel.z = z;
          symbolLabel.z2 = this._polyline.z2 + 1;
        }
        symbol.__temp = true;
        data.setItemGraphicEl(dataIndex, symbol);
        // Stop scale animation
        symbol.stopSymbolAnimation(true);
        this.group.add(symbol);
      }
      symbol.highlight();
    } else {
      // Highlight whole series
      ChartView$1.prototype.highlight.call(this, seriesModel, ecModel, api, payload);
    }
  };
  LineView.prototype.downplay = function (seriesModel, ecModel, api, payload) {
    var data = seriesModel.getData();
    var dataIndex = queryDataIndex(data, payload);
    this._changePolyState('normal');
    if (dataIndex != null && dataIndex >= 0) {
      var symbol = data.getItemGraphicEl(dataIndex);
      if (symbol) {
        if (symbol.__temp) {
          data.setItemGraphicEl(dataIndex, null);
          this.group.remove(symbol);
        } else {
          symbol.downplay();
        }
      }
    } else {
      // FIXME
      // can not downplay completely.
      // Downplay whole series
      ChartView$1.prototype.downplay.call(this, seriesModel, ecModel, api, payload);
    }
  };
  LineView.prototype._changePolyState = function (toState) {
    var polygon = this._polygon;
    setStatesFlag(this._polyline, toState);
    polygon && setStatesFlag(polygon, toState);
  };
  LineView.prototype._newPolyline = function (points) {
    var polyline = this._polyline;
    // Remove previous created polyline
    if (polyline) {
      this._lineGroup.remove(polyline);
    }
    polyline = new ECPolyline({
      shape: {
        points: points
      },
      segmentIgnoreThreshold: 2,
      z2: 10
    });
    this._lineGroup.add(polyline);
    this._polyline = polyline;
    return polyline;
  };
  LineView.prototype._newPolygon = function (points, stackedOnPoints) {
    var polygon = this._polygon;
    // Remove previous created polygon
    if (polygon) {
      this._lineGroup.remove(polygon);
    }
    polygon = new ECPolygon({
      shape: {
        points: points,
        stackedOnPoints: stackedOnPoints
      },
      segmentIgnoreThreshold: 2
    });
    this._lineGroup.add(polygon);
    this._polygon = polygon;
    return polygon;
  };
  LineView.prototype._initSymbolLabelAnimation = function (data, coordSys, clipShape) {
    var isHorizontalOrRadial;
    var isCoordSysPolar;
    var baseAxis = coordSys.getBaseAxis();
    var isAxisInverse = baseAxis.inverse;
    if (coordSys.type === 'cartesian2d') {
      isHorizontalOrRadial = baseAxis.isHorizontal();
      isCoordSysPolar = false;
    } else if (coordSys.type === 'polar') {
      isHorizontalOrRadial = baseAxis.dim === 'angle';
      isCoordSysPolar = true;
    }
    var seriesModel = data.hostModel;
    var seriesDuration = seriesModel.get('animationDuration');
    if (isFunction(seriesDuration)) {
      seriesDuration = seriesDuration(null);
    }
    var seriesDelay = seriesModel.get('animationDelay') || 0;
    var seriesDelayValue = isFunction(seriesDelay) ? seriesDelay(null) : seriesDelay;
    data.eachItemGraphicEl(function (symbol, idx) {
      var el = symbol;
      if (el) {
        var point = [symbol.x, symbol.y];
        var start = void 0;
        var end = void 0;
        var current = void 0;
        if (clipShape) {
          if (isCoordSysPolar) {
            var polarClip = clipShape;
            var coord = coordSys.pointToCoord(point);
            if (isHorizontalOrRadial) {
              start = polarClip.startAngle;
              end = polarClip.endAngle;
              current = -coord[1] / 180 * Math.PI;
            } else {
              start = polarClip.r0;
              end = polarClip.r;
              current = coord[0];
            }
          } else {
            var gridClip = clipShape;
            if (isHorizontalOrRadial) {
              start = gridClip.x;
              end = gridClip.x + gridClip.width;
              current = symbol.x;
            } else {
              start = gridClip.y + gridClip.height;
              end = gridClip.y;
              current = symbol.y;
            }
          }
        }
        var ratio = end === start ? 0 : (current - start) / (end - start);
        if (isAxisInverse) {
          ratio = 1 - ratio;
        }
        var delay = isFunction(seriesDelay) ? seriesDelay(idx) : seriesDuration * ratio + seriesDelayValue;
        var symbolPath = el.getSymbolPath();
        var text = symbolPath.getTextContent();
        el.attr({
          scaleX: 0,
          scaleY: 0
        });
        el.animateTo({
          scaleX: 1,
          scaleY: 1
        }, {
          duration: 200,
          setToFinal: true,
          delay: delay
        });
        if (text) {
          text.animateFrom({
            style: {
              opacity: 0
            }
          }, {
            duration: 300,
            delay: delay
          });
        }
        symbolPath.disableLabelAnimation = true;
      }
    });
  };
  LineView.prototype._initOrUpdateEndLabel = function (seriesModel, coordSys, inheritColor) {
    var endLabelModel = seriesModel.getModel('endLabel');
    if (anyStateShowEndLabel(seriesModel)) {
      var data_2 = seriesModel.getData();
      var polyline = this._polyline;
      // series may be filtered.
      var points = data_2.getLayout('points');
      if (!points) {
        polyline.removeTextContent();
        this._endLabel = null;
        return;
      }
      var endLabel = this._endLabel;
      if (!endLabel) {
        endLabel = this._endLabel = new ZRText$1({
          z2: 200 // should be higher than item symbol
        });
        endLabel.ignoreClip = true;
        polyline.setTextContent(this._endLabel);
        polyline.disableLabelAnimation = true;
      }
      // Find last non-NaN data to display data
      var dataIndex = getLastIndexNotNull(points);
      if (dataIndex >= 0) {
        setLabelStyle(polyline, getLabelStatesModels(seriesModel, 'endLabel'), {
          inheritColor: inheritColor,
          labelFetcher: seriesModel,
          labelDataIndex: dataIndex,
          defaultText: function (dataIndex, opt, interpolatedValue) {
            return interpolatedValue != null ? getDefaultInterpolatedLabel(data_2, interpolatedValue) : getDefaultLabel(data_2, dataIndex);
          },
          enableTextSetter: true
        }, getEndLabelStateSpecified(endLabelModel, coordSys));
        polyline.textConfig.position = null;
      }
    } else if (this._endLabel) {
      this._polyline.removeTextContent();
      this._endLabel = null;
    }
  };
  LineView.prototype._endLabelOnDuring = function (percent, clipRect, data, animationRecord, valueAnimation, endLabelModel, coordSys) {
    var endLabel = this._endLabel;
    var polyline = this._polyline;
    if (endLabel) {
      // NOTE: Don't remove percent < 1. percent === 1 means the first frame during render.
      // The label is not prepared at this time.
      if (percent < 1 && animationRecord.originalX == null) {
        animationRecord.originalX = endLabel.x;
        animationRecord.originalY = endLabel.y;
      }
      var points = data.getLayout('points');
      var seriesModel = data.hostModel;
      var connectNulls = seriesModel.get('connectNulls');
      var precision = endLabelModel.get('precision');
      var distance = endLabelModel.get('distance') || 0;
      var baseAxis = coordSys.getBaseAxis();
      var isHorizontal = baseAxis.isHorizontal();
      var isBaseInversed = baseAxis.inverse;
      var clipShape = clipRect.shape;
      var xOrY = isBaseInversed ? isHorizontal ? clipShape.x : clipShape.y + clipShape.height : isHorizontal ? clipShape.x + clipShape.width : clipShape.y;
      var distanceX = (isHorizontal ? distance : 0) * (isBaseInversed ? -1 : 1);
      var distanceY = (isHorizontal ? 0 : -distance) * (isBaseInversed ? -1 : 1);
      var dim = isHorizontal ? 'x' : 'y';
      var dataIndexRange = getIndexRange(points, xOrY, dim);
      var indices = dataIndexRange.range;
      var diff = indices[1] - indices[0];
      var value = void 0;
      if (diff >= 1) {
        // diff > 1 && connectNulls, which is on the null data.
        if (diff > 1 && !connectNulls) {
          var pt = getPointAtIndex(points, indices[0]);
          endLabel.attr({
            x: pt[0] + distanceX,
            y: pt[1] + distanceY
          });
          valueAnimation && (value = seriesModel.getRawValue(indices[0]));
        } else {
          var pt = polyline.getPointOn(xOrY, dim);
          pt && endLabel.attr({
            x: pt[0] + distanceX,
            y: pt[1] + distanceY
          });
          var startValue = seriesModel.getRawValue(indices[0]);
          var endValue = seriesModel.getRawValue(indices[1]);
          valueAnimation && (value = interpolateRawValues(data, precision, startValue, endValue, dataIndexRange.t));
        }
        animationRecord.lastFrameIndex = indices[0];
      } else {
        // If diff <= 0, which is the range is not found(Include NaN)
        // Choose the first point or last point.
        var idx = percent === 1 || animationRecord.lastFrameIndex > 0 ? indices[0] : 0;
        var pt = getPointAtIndex(points, idx);
        valueAnimation && (value = seriesModel.getRawValue(idx));
        endLabel.attr({
          x: pt[0] + distanceX,
          y: pt[1] + distanceY
        });
      }
      if (valueAnimation) {
        var inner = labelInner(endLabel);
        if (typeof inner.setLabelText === 'function') {
          inner.setLabelText(value);
        }
      }
    }
  };
  /**
   * @private
   */
  // FIXME Two value axis
  LineView.prototype._doUpdateAnimation = function (data, stackedOnPoints, coordSys, api, step, valueOrigin, connectNulls) {
    var polyline = this._polyline;
    var polygon = this._polygon;
    var seriesModel = data.hostModel;
    var diff = lineAnimationDiff(this._data, data, this._stackedOnPoints, stackedOnPoints, this._coordSys, coordSys, this._valueOrigin);
    var current = diff.current;
    var stackedOnCurrent = diff.stackedOnCurrent;
    var next = diff.next;
    var stackedOnNext = diff.stackedOnNext;
    if (step) {
      // TODO If stacked series is not step
      stackedOnCurrent = turnPointsIntoStep(diff.stackedOnCurrent, diff.current, coordSys, step, connectNulls);
      current = turnPointsIntoStep(diff.current, null, coordSys, step, connectNulls);
      stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, diff.next, coordSys, step, connectNulls);
      next = turnPointsIntoStep(diff.next, null, coordSys, step, connectNulls);
    }
    // Don't apply animation if diff is large.
    // For better result and avoid memory explosion problems like
    // https://github.com/apache/incubator-echarts/issues/12229
    if (getBoundingDiff(current, next) > 3000 || polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000) {
      polyline.stopAnimation();
      polyline.setShape({
        points: next
      });
      if (polygon) {
        polygon.stopAnimation();
        polygon.setShape({
          points: next,
          stackedOnPoints: stackedOnNext
        });
      }
      return;
    }
    polyline.shape.__points = diff.current;
    polyline.shape.points = current;
    var target = {
      shape: {
        points: next
      }
    };
    // Also animate the original points.
    // If points reference is changed when turning into step line.
    if (diff.current !== current) {
      target.shape.__points = diff.next;
    }
    // Stop previous animation.
    polyline.stopAnimation();
    updateProps$1(polyline, target, seriesModel);
    if (polygon) {
      polygon.setShape({
        // Reuse the points with polyline.
        points: current,
        stackedOnPoints: stackedOnCurrent
      });
      polygon.stopAnimation();
      updateProps$1(polygon, {
        shape: {
          stackedOnPoints: stackedOnNext
        }
      }, seriesModel);
      // If use attr directly in updateProps.
      if (polyline.shape.points !== polygon.shape.points) {
        polygon.shape.points = polyline.shape.points;
      }
    }
    var updatedDataInfo = [];
    var diffStatus = diff.status;
    for (var i = 0; i < diffStatus.length; i++) {
      var cmd = diffStatus[i].cmd;
      if (cmd === '=') {
        var el = data.getItemGraphicEl(diffStatus[i].idx1);
        if (el) {
          updatedDataInfo.push({
            el: el,
            ptIdx: i // Index of points
          });
        }
      }
    }
    if (polyline.animators && polyline.animators.length) {
      polyline.animators[0].during(function () {
        polygon && polygon.dirtyShape();
        var points = polyline.shape.__points;
        for (var i = 0; i < updatedDataInfo.length; i++) {
          var el = updatedDataInfo[i].el;
          var offset = updatedDataInfo[i].ptIdx * 2;
          el.x = points[offset];
          el.y = points[offset + 1];
          el.markRedraw();
        }
      });
    }
  };
  LineView.prototype.remove = function (ecModel) {
    var group = this.group;
    var oldData = this._data;
    this._lineGroup.removeAll();
    this._symbolDraw.remove(true);
    // Remove temporary created elements when highlighting
    oldData && oldData.eachItemGraphicEl(function (el, idx) {
      if (el.__temp) {
        group.remove(el);
        oldData.setItemGraphicEl(idx, null);
      }
    });
    this._polyline = this._polygon = this._coordSys = this._points = this._stackedOnPoints = this._endLabel = this._data = null;
  };
  LineView.type = 'line';
  return LineView;
}(ChartView$1);
var LineView$1 = LineView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function pointsLayout(seriesType, forceStoreInTypedArray) {
  return {
    seriesType: seriesType,
    plan: createRenderPlanner(),
    reset: function (seriesModel) {
      var data = seriesModel.getData();
      var coordSys = seriesModel.coordinateSystem;
      var pipelineContext = seriesModel.pipelineContext;
      var useTypedArray = forceStoreInTypedArray || pipelineContext.large;
      if (!coordSys) {
        return;
      }
      var dims = map$1(coordSys.dimensions, function (dim) {
        return data.mapDimension(dim);
      }).slice(0, 2);
      var dimLen = dims.length;
      var stackResultDim = data.getCalculationInfo('stackResultDimension');
      if (isDimensionStacked(data, dims[0])) {
        dims[0] = stackResultDim;
      }
      if (isDimensionStacked(data, dims[1])) {
        dims[1] = stackResultDim;
      }
      var store = data.getStore();
      var dimIdx0 = data.getDimensionIndex(dims[0]);
      var dimIdx1 = data.getDimensionIndex(dims[1]);
      return dimLen && {
        progress: function (params, data) {
          var segCount = params.end - params.start;
          var points = useTypedArray && createFloat32Array(segCount * dimLen);
          var tmpIn = [];
          var tmpOut = [];
          for (var i = params.start, offset = 0; i < params.end; i++) {
            var point = void 0;
            if (dimLen === 1) {
              var x = store.get(dimIdx0, i);
              // NOTE: Make sure the second parameter is null to use default strategy.
              point = coordSys.dataToPoint(x, null, tmpOut);
            } else {
              tmpIn[0] = store.get(dimIdx0, i);
              tmpIn[1] = store.get(dimIdx1, i);
              // Let coordinate system to handle the NaN data.
              point = coordSys.dataToPoint(tmpIn, null, tmpOut);
            }
            if (useTypedArray) {
              points[offset++] = point[0];
              points[offset++] = point[1];
            } else {
              data.setItemLayout(i, point.slice());
            }
          }
          useTypedArray && data.setLayout('points', points);
        }
      };
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var samplers = {
  average: function (frame) {
    var sum = 0;
    var count = 0;
    for (var i = 0; i < frame.length; i++) {
      if (!isNaN(frame[i])) {
        sum += frame[i];
        count++;
      }
    }
    // Return NaN if count is 0
    return count === 0 ? NaN : sum / count;
  },
  sum: function (frame) {
    var sum = 0;
    for (var i = 0; i < frame.length; i++) {
      // Ignore NaN
      sum += frame[i] || 0;
    }
    return sum;
  },
  max: function (frame) {
    var max = -Infinity;
    for (var i = 0; i < frame.length; i++) {
      frame[i] > max && (max = frame[i]);
    }
    // NaN will cause illegal axis extent.
    return isFinite(max) ? max : NaN;
  },
  min: function (frame) {
    var min = Infinity;
    for (var i = 0; i < frame.length; i++) {
      frame[i] < min && (min = frame[i]);
    }
    // NaN will cause illegal axis extent.
    return isFinite(min) ? min : NaN;
  },
  // TODO
  // Median
  nearest: function (frame) {
    return frame[0];
  }
};
var indexSampler = function (frame) {
  return Math.round(frame.length / 2);
};
function dataSample(seriesType) {
  return {
    seriesType: seriesType,
    // FIXME:TS never used, so comment it
    // modifyOutputEnd: true,
    reset: function (seriesModel, ecModel, api) {
      var data = seriesModel.getData();
      var sampling = seriesModel.get('sampling');
      var coordSys = seriesModel.coordinateSystem;
      var count = data.count();
      // Only cartesian2d support down sampling. Disable it when there is few data.
      if (count > 10 && coordSys.type === 'cartesian2d' && sampling) {
        var baseAxis = coordSys.getBaseAxis();
        var valueAxis = coordSys.getOtherAxis(baseAxis);
        var extent = baseAxis.getExtent();
        var dpr = api.getDevicePixelRatio();
        // Coordinste system has been resized
        var size = Math.abs(extent[1] - extent[0]) * (dpr || 1);
        var rate = Math.round(count / size);
        if (isFinite(rate) && rate > 1) {
          if (sampling === 'lttb') {
            seriesModel.setData(data.lttbDownSample(data.mapDimension(valueAxis.dim), 1 / rate));
          } else if (sampling === 'minmax') {
            seriesModel.setData(data.minmaxDownSample(data.mapDimension(valueAxis.dim), 1 / rate));
          }
          var sampler = void 0;
          if (isString(sampling)) {
            sampler = samplers[sampling];
          } else if (isFunction(sampling)) {
            sampler = sampling;
          }
          if (sampler) {
            // Only support sample the first dim mapped from value axis.
            seriesModel.setData(data.downSample(data.mapDimension(valueAxis.dim), 1 / rate, sampler, indexSampler));
          }
        }
      }
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$S(registers) {
  registers.registerChartView(LineView$1);
  registers.registerSeriesModel(LineSeries);
  registers.registerLayout(pointsLayout('line', true));
  registers.registerVisual({
    seriesType: 'line',
    reset: function (seriesModel) {
      var data = seriesModel.getData();
      // Visual coding for legend
      var lineStyle = seriesModel.getModel('lineStyle').getLineStyle();
      if (lineStyle && !lineStyle.stroke) {
        // Fill in visual should be palette color if
        // has color callback
        lineStyle.stroke = data.getVisual('style').fill;
      }
      data.setVisual('legendLineStyle', lineStyle);
    }
  });
  // Down sample after filter
  registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, dataSample('line'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var BaseBarSeriesModel = /** @class */function (_super) {
  __extends(BaseBarSeriesModel, _super);
  function BaseBarSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = BaseBarSeriesModel.type;
    return _this;
  }
  BaseBarSeriesModel.prototype.getInitialData = function (option, ecModel) {
    return createSeriesData(null, this, {
      useEncodeDefaulter: true
    });
  };
  BaseBarSeriesModel.prototype.getMarkerPosition = function (value, dims, startingAtTick) {
    var coordSys = this.coordinateSystem;
    if (coordSys && coordSys.clampData) {
      // PENDING if clamp ?
      var clampData_1 = coordSys.clampData(value);
      var pt_1 = coordSys.dataToPoint(clampData_1);
      if (startingAtTick) {
        each$f(coordSys.getAxes(), function (axis, idx) {
          // If axis type is category, use tick coords instead
          if (axis.type === 'category' && dims != null) {
            var tickCoords = axis.getTicksCoords();
            var alignTicksWithLabel = axis.getTickModel().get('alignWithLabel');
            var targetTickId = clampData_1[idx];
            // The index of rightmost tick of markArea is 1 larger than x1/y1 index
            var isEnd = dims[idx] === 'x1' || dims[idx] === 'y1';
            if (isEnd && !alignTicksWithLabel) {
              targetTickId += 1;
            }
            // The only contains one tick, tickCoords is
            // like [{coord: 0, tickValue: 0}, {coord: 0}]
            // to the length should always be larger than 1
            if (tickCoords.length < 2) {
              return;
            } else if (tickCoords.length === 2) {
              // The left value and right value of the axis are
              // the same. coord is 0 in both items. Use the max
              // value of the axis as the coord
              pt_1[idx] = axis.toGlobalCoord(axis.getExtent()[isEnd ? 1 : 0]);
              return;
            }
            var leftCoord = void 0;
            var coord = void 0;
            var stepTickValue = 1;
            for (var i = 0; i < tickCoords.length; i++) {
              var tickCoord = tickCoords[i].coord;
              // The last item of tickCoords doesn't contain
              // tickValue
              var tickValue = i === tickCoords.length - 1 ? tickCoords[i - 1].tickValue + stepTickValue : tickCoords[i].tickValue;
              if (tickValue === targetTickId) {
                coord = tickCoord;
                break;
              } else if (tickValue < targetTickId) {
                leftCoord = tickCoord;
              } else if (leftCoord != null && tickValue > targetTickId) {
                coord = (tickCoord + leftCoord) / 2;
                break;
              }
              if (i === 1) {
                // Here we assume the step of category axes is
                // the same
                stepTickValue = tickValue - tickCoords[0].tickValue;
              }
            }
            if (coord == null) {
              if (!leftCoord) {
                // targetTickId is smaller than all tick ids in the
                // visible area, use the leftmost tick coord
                coord = tickCoords[0].coord;
              } else if (leftCoord) {
                // targetTickId is larger than all tick ids in the
                // visible area, use the rightmost tick coord
                coord = tickCoords[tickCoords.length - 1].coord;
              }
            }
            pt_1[idx] = axis.toGlobalCoord(coord);
          }
        });
      } else {
        var data = this.getData();
        var offset = data.getLayout('offset');
        var size = data.getLayout('size');
        var offsetIndex = coordSys.getBaseAxis().isHorizontal() ? 0 : 1;
        pt_1[offsetIndex] += offset + size / 2;
      }
      return pt_1;
    }
    return [NaN, NaN];
  };
  BaseBarSeriesModel.type = 'series.__base_bar__';
  BaseBarSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    coordinateSystem: 'cartesian2d',
    legendHoverLink: true,
    // stack: null
    // Cartesian coordinate system
    // xAxisIndex: 0,
    // yAxisIndex: 0,
    barMinHeight: 0,
    barMinAngle: 0,
    // cursor: null,
    large: false,
    largeThreshold: 400,
    progressive: 3e3,
    progressiveChunkMode: 'mod'
  };
  return BaseBarSeriesModel;
}(SeriesModel$1);
SeriesModel$1.registerClass(BaseBarSeriesModel);
var BaseBarSeriesModel$1 = BaseBarSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var BarSeriesModel = /** @class */function (_super) {
  __extends(BarSeriesModel, _super);
  function BarSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = BarSeriesModel.type;
    return _this;
  }
  BarSeriesModel.prototype.getInitialData = function () {
    return createSeriesData(null, this, {
      useEncodeDefaulter: true,
      createInvertedIndices: !!this.get('realtimeSort', true) || null
    });
  };
  /**
   * @override
   */
  BarSeriesModel.prototype.getProgressive = function () {
    // Do not support progressive in normal mode.
    return this.get('large') ? this.get('progressive') : false;
  };
  /**
   * @override
   */
  BarSeriesModel.prototype.getProgressiveThreshold = function () {
    // Do not support progressive in normal mode.
    var progressiveThreshold = this.get('progressiveThreshold');
    var largeThreshold = this.get('largeThreshold');
    if (largeThreshold > progressiveThreshold) {
      progressiveThreshold = largeThreshold;
    }
    return progressiveThreshold;
  };
  BarSeriesModel.prototype.brushSelector = function (dataIndex, data, selectors) {
    return selectors.rect(data.getItemLayout(dataIndex));
  };
  BarSeriesModel.type = 'series.bar';
  BarSeriesModel.dependencies = ['grid', 'polar'];
  BarSeriesModel.defaultOption = inheritDefaultOption(BaseBarSeriesModel$1.defaultOption, {
    // If clipped
    // Only available on cartesian2d
    clip: true,
    roundCap: false,
    showBackground: false,
    backgroundStyle: {
      color: 'rgba(180, 180, 180, 0.2)',
      borderColor: null,
      borderWidth: 0,
      borderType: 'solid',
      borderRadius: 0,
      shadowBlur: 0,
      shadowColor: null,
      shadowOffsetX: 0,
      shadowOffsetY: 0,
      opacity: 1
    },
    select: {
      itemStyle: {
        borderColor: '#212121'
      }
    },
    realtimeSort: false
  });
  return BarSeriesModel;
}(BaseBarSeriesModel$1);
var BarSeries = BarSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Sausage: similar to sector, but have half circle on both sides
 */
var SausageShape = /** @class */function () {
  function SausageShape() {
    this.cx = 0;
    this.cy = 0;
    this.r0 = 0;
    this.r = 0;
    this.startAngle = 0;
    this.endAngle = Math.PI * 2;
    this.clockwise = true;
  }
  return SausageShape;
}();
var SausagePath = /** @class */function (_super) {
  __extends(SausagePath, _super);
  function SausagePath(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'sausage';
    return _this;
  }
  SausagePath.prototype.getDefaultShape = function () {
    return new SausageShape();
  };
  SausagePath.prototype.buildPath = function (ctx, shape) {
    var cx = shape.cx;
    var cy = shape.cy;
    var r0 = Math.max(shape.r0 || 0, 0);
    var r = Math.max(shape.r, 0);
    var dr = (r - r0) * 0.5;
    var rCenter = r0 + dr;
    var startAngle = shape.startAngle;
    var endAngle = shape.endAngle;
    var clockwise = shape.clockwise;
    var PI2 = Math.PI * 2;
    var lessThanCircle = clockwise ? endAngle - startAngle < PI2 : startAngle - endAngle < PI2;
    if (!lessThanCircle) {
      // Normalize angles
      startAngle = endAngle - (clockwise ? PI2 : -PI2);
    }
    var unitStartX = Math.cos(startAngle);
    var unitStartY = Math.sin(startAngle);
    var unitEndX = Math.cos(endAngle);
    var unitEndY = Math.sin(endAngle);
    if (lessThanCircle) {
      ctx.moveTo(unitStartX * r0 + cx, unitStartY * r0 + cy);
      ctx.arc(unitStartX * rCenter + cx, unitStartY * rCenter + cy, dr, -Math.PI + startAngle, startAngle, !clockwise);
    } else {
      ctx.moveTo(unitStartX * r + cx, unitStartY * r + cy);
    }
    ctx.arc(cx, cy, r, startAngle, endAngle, !clockwise);
    ctx.arc(unitEndX * rCenter + cx, unitEndY * rCenter + cy, dr, endAngle - Math.PI * 2, endAngle - Math.PI, !clockwise);
    if (r0 !== 0) {
      ctx.arc(cx, cy, r0, endAngle, startAngle, clockwise);
    }
    // ctx.closePath();
  };
  return SausagePath;
}(Path$1);
var Sausage = SausagePath;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function createSectorCalculateTextPosition(positionMapping, opts) {
  opts = opts || {};
  var isRoundCap = opts.isRoundCap;
  return function (out, opts, boundingRect) {
    var textPosition = opts.position;
    if (!textPosition || textPosition instanceof Array) {
      return calculateTextPosition(out, opts, boundingRect);
    }
    var mappedSectorPosition = positionMapping(textPosition);
    var distance = opts.distance != null ? opts.distance : 5;
    var sector = this.shape;
    var cx = sector.cx;
    var cy = sector.cy;
    var r = sector.r;
    var r0 = sector.r0;
    var middleR = (r + r0) / 2;
    var startAngle = sector.startAngle;
    var endAngle = sector.endAngle;
    var middleAngle = (startAngle + endAngle) / 2;
    var extraDist = isRoundCap ? Math.abs(r - r0) / 2 : 0;
    var mathCos = Math.cos;
    var mathSin = Math.sin;
    // base position: top-left
    var x = cx + r * mathCos(startAngle);
    var y = cy + r * mathSin(startAngle);
    var textAlign = 'left';
    var textVerticalAlign = 'top';
    switch (mappedSectorPosition) {
      case 'startArc':
        x = cx + (r0 - distance) * mathCos(middleAngle);
        y = cy + (r0 - distance) * mathSin(middleAngle);
        textAlign = 'center';
        textVerticalAlign = 'top';
        break;
      case 'insideStartArc':
        x = cx + (r0 + distance) * mathCos(middleAngle);
        y = cy + (r0 + distance) * mathSin(middleAngle);
        textAlign = 'center';
        textVerticalAlign = 'bottom';
        break;
      case 'startAngle':
        x = cx + middleR * mathCos(startAngle) + adjustAngleDistanceX(startAngle, distance + extraDist, false);
        y = cy + middleR * mathSin(startAngle) + adjustAngleDistanceY(startAngle, distance + extraDist, false);
        textAlign = 'right';
        textVerticalAlign = 'middle';
        break;
      case 'insideStartAngle':
        x = cx + middleR * mathCos(startAngle) + adjustAngleDistanceX(startAngle, -distance + extraDist, false);
        y = cy + middleR * mathSin(startAngle) + adjustAngleDistanceY(startAngle, -distance + extraDist, false);
        textAlign = 'left';
        textVerticalAlign = 'middle';
        break;
      case 'middle':
        x = cx + middleR * mathCos(middleAngle);
        y = cy + middleR * mathSin(middleAngle);
        textAlign = 'center';
        textVerticalAlign = 'middle';
        break;
      case 'endArc':
        x = cx + (r + distance) * mathCos(middleAngle);
        y = cy + (r + distance) * mathSin(middleAngle);
        textAlign = 'center';
        textVerticalAlign = 'bottom';
        break;
      case 'insideEndArc':
        x = cx + (r - distance) * mathCos(middleAngle);
        y = cy + (r - distance) * mathSin(middleAngle);
        textAlign = 'center';
        textVerticalAlign = 'top';
        break;
      case 'endAngle':
        x = cx + middleR * mathCos(endAngle) + adjustAngleDistanceX(endAngle, distance + extraDist, true);
        y = cy + middleR * mathSin(endAngle) + adjustAngleDistanceY(endAngle, distance + extraDist, true);
        textAlign = 'left';
        textVerticalAlign = 'middle';
        break;
      case 'insideEndAngle':
        x = cx + middleR * mathCos(endAngle) + adjustAngleDistanceX(endAngle, -distance + extraDist, true);
        y = cy + middleR * mathSin(endAngle) + adjustAngleDistanceY(endAngle, -distance + extraDist, true);
        textAlign = 'right';
        textVerticalAlign = 'middle';
        break;
      default:
        return calculateTextPosition(out, opts, boundingRect);
    }
    out = out || {};
    out.x = x;
    out.y = y;
    out.align = textAlign;
    out.verticalAlign = textVerticalAlign;
    return out;
  };
}
function setSectorTextRotation(sector, textPosition, positionMapping, rotateType) {
  if (isNumber(rotateType)) {
    // user-set rotation
    sector.setTextConfig({
      rotation: rotateType
    });
    return;
  } else if (isArray$1(textPosition)) {
    // user-set position, use 0 as auto rotation
    sector.setTextConfig({
      rotation: 0
    });
    return;
  }
  var shape = sector.shape;
  var startAngle = shape.clockwise ? shape.startAngle : shape.endAngle;
  var endAngle = shape.clockwise ? shape.endAngle : shape.startAngle;
  var middleAngle = (startAngle + endAngle) / 2;
  var anchorAngle;
  var mappedSectorPosition = positionMapping(textPosition);
  switch (mappedSectorPosition) {
    case 'startArc':
    case 'insideStartArc':
    case 'middle':
    case 'insideEndArc':
    case 'endArc':
      anchorAngle = middleAngle;
      break;
    case 'startAngle':
    case 'insideStartAngle':
      anchorAngle = startAngle;
      break;
    case 'endAngle':
    case 'insideEndAngle':
      anchorAngle = endAngle;
      break;
    default:
      sector.setTextConfig({
        rotation: 0
      });
      return;
  }
  var rotate = Math.PI * 1.5 - anchorAngle;
  /**
   * TODO: labels with rotate > Math.PI / 2 should be rotate another
   * half round flipped to increase readability. However, only middle
   * position supports this for now, because in other positions, the
   * anchor point is not at the center of the text, so the positions
   * after rotating is not as expected.
   */
  if (mappedSectorPosition === 'middle' && rotate > Math.PI / 2 && rotate < Math.PI * 1.5) {
    rotate -= Math.PI;
  }
  sector.setTextConfig({
    rotation: rotate
  });
}
function adjustAngleDistanceX(angle, distance, isEnd) {
  return distance * Math.sin(angle) * (isEnd ? -1 : 1);
}
function adjustAngleDistanceY(angle, distance, isEnd) {
  return distance * Math.cos(angle) * (isEnd ? 1 : -1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function getSectorCornerRadius(model, shape, zeroIfNull) {
  var cornerRadius = model.get('borderRadius');
  if (cornerRadius == null) {
    return zeroIfNull ? {
      cornerRadius: 0
    } : null;
  }
  if (!isArray$1(cornerRadius)) {
    cornerRadius = [cornerRadius, cornerRadius, cornerRadius, cornerRadius];
  }
  var dr = Math.abs(shape.r || 0 - shape.r0 || 0);
  return {
    cornerRadius: map$1(cornerRadius, function (cr) {
      return parsePercent$1(cr, dr);
    })
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var mathMax$4 = Math.max;
var mathMin$4 = Math.min;
function getClipArea(coord, data) {
  var coordSysClipArea = coord.getArea && coord.getArea();
  if (isCoordinateSystemType(coord, 'cartesian2d')) {
    var baseAxis = coord.getBaseAxis();
    // When boundaryGap is false or using time axis. bar may exceed the grid.
    // We should not clip this part.
    // See test/bar2.html
    if (baseAxis.type !== 'category' || !baseAxis.onBand) {
      var expandWidth = data.getLayout('bandWidth');
      if (baseAxis.isHorizontal()) {
        coordSysClipArea.x -= expandWidth;
        coordSysClipArea.width += expandWidth * 2;
      } else {
        coordSysClipArea.y -= expandWidth;
        coordSysClipArea.height += expandWidth * 2;
      }
    }
  }
  return coordSysClipArea;
}
var BarView = /** @class */function (_super) {
  __extends(BarView, _super);
  function BarView() {
    var _this = _super.call(this) || this;
    _this.type = BarView.type;
    _this._isFirstFrame = true;
    return _this;
  }
  BarView.prototype.render = function (seriesModel, ecModel, api, payload) {
    this._model = seriesModel;
    this._removeOnRenderedListener(api);
    this._updateDrawMode(seriesModel);
    var coordinateSystemType = seriesModel.get('coordinateSystem');
    if (coordinateSystemType === 'cartesian2d' || coordinateSystemType === 'polar') {
      // Clear previously rendered progressive elements.
      this._progressiveEls = null;
      this._isLargeDraw ? this._renderLarge(seriesModel, ecModel, api) : this._renderNormal(seriesModel, ecModel, api, payload);
    } else {
      warn('Only cartesian2d and polar supported for bar.');
    }
  };
  BarView.prototype.incrementalPrepareRender = function (seriesModel) {
    this._clear();
    this._updateDrawMode(seriesModel);
    // incremental also need to clip, otherwise might be overlow.
    // But must not set clip in each frame, otherwise all of the children will be marked redraw.
    this._updateLargeClip(seriesModel);
  };
  BarView.prototype.incrementalRender = function (params, seriesModel) {
    // Reset
    this._progressiveEls = [];
    // Do not support progressive in normal mode.
    this._incrementalRenderLarge(params, seriesModel);
  };
  BarView.prototype.eachRendered = function (cb) {
    traverseElements(this._progressiveEls || this.group, cb);
  };
  BarView.prototype._updateDrawMode = function (seriesModel) {
    var isLargeDraw = seriesModel.pipelineContext.large;
    if (this._isLargeDraw == null || isLargeDraw !== this._isLargeDraw) {
      this._isLargeDraw = isLargeDraw;
      this._clear();
    }
  };
  BarView.prototype._renderNormal = function (seriesModel, ecModel, api, payload) {
    var group = this.group;
    var data = seriesModel.getData();
    var oldData = this._data;
    var coord = seriesModel.coordinateSystem;
    var baseAxis = coord.getBaseAxis();
    var isHorizontalOrRadial;
    if (coord.type === 'cartesian2d') {
      isHorizontalOrRadial = baseAxis.isHorizontal();
    } else if (coord.type === 'polar') {
      isHorizontalOrRadial = baseAxis.dim === 'angle';
    }
    var animationModel = seriesModel.isAnimationEnabled() ? seriesModel : null;
    var realtimeSortCfg = shouldRealtimeSort(seriesModel, coord);
    if (realtimeSortCfg) {
      this._enableRealtimeSort(realtimeSortCfg, data, api);
    }
    var needsClip = seriesModel.get('clip', true) || realtimeSortCfg;
    var coordSysClipArea = getClipArea(coord, data);
    // If there is clipPath created in large mode. Remove it.
    group.removeClipPath();
    // We don't use clipPath in normal mode because we needs a perfect animation
    // And don't want the label are clipped.
    var roundCap = seriesModel.get('roundCap', true);
    var drawBackground = seriesModel.get('showBackground', true);
    var backgroundModel = seriesModel.getModel('backgroundStyle');
    var barBorderRadius = backgroundModel.get('borderRadius') || 0;
    var bgEls = [];
    var oldBgEls = this._backgroundEls;
    var isInitSort = payload && payload.isInitSort;
    var isChangeOrder = payload && payload.type === 'changeAxisOrder';
    function createBackground(dataIndex) {
      var bgLayout = getLayout[coord.type](data, dataIndex);
      var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
      bgEl.useStyle(backgroundModel.getItemStyle());
      // Only cartesian2d support borderRadius.
      if (coord.type === 'cartesian2d') {
        bgEl.setShape('r', barBorderRadius);
      } else {
        bgEl.setShape('cornerRadius', barBorderRadius);
      }
      bgEls[dataIndex] = bgEl;
      return bgEl;
    }
    data.diff(oldData).add(function (dataIndex) {
      var itemModel = data.getItemModel(dataIndex);
      var layout = getLayout[coord.type](data, dataIndex, itemModel);
      if (drawBackground) {
        createBackground(dataIndex);
      }
      // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
      if (!data.hasValue(dataIndex) || !isValidLayout[coord.type](layout)) {
        return;
      }
      var isClipped = false;
      if (needsClip) {
        // Clip will modify the layout params.
        // And return a boolean to determine if the shape are fully clipped.
        isClipped = clip[coord.type](coordSysClipArea, layout);
      }
      var el = elementCreator[coord.type](seriesModel, data, dataIndex, layout, isHorizontalOrRadial, animationModel, baseAxis.model, false, roundCap);
      if (realtimeSortCfg) {
        /**
         * Force label animation because even if the element is
         * ignored because it's clipped, it may not be clipped after
         * changing order. Then, if not using forceLabelAnimation,
         * the label animation was never started, in which case,
         * the label will be the final value and doesn't have label
         * animation.
         */
        el.forceLabelAnimation = true;
      }
      updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontalOrRadial, coord.type === 'polar');
      if (isInitSort) {
        el.attr({
          shape: layout
        });
      } else if (realtimeSortCfg) {
        updateRealtimeAnimation(realtimeSortCfg, animationModel, el, layout, dataIndex, isHorizontalOrRadial, false, false);
      } else {
        initProps(el, {
          shape: layout
        }, seriesModel, dataIndex);
      }
      data.setItemGraphicEl(dataIndex, el);
      group.add(el);
      el.ignore = isClipped;
    }).update(function (newIndex, oldIndex) {
      var itemModel = data.getItemModel(newIndex);
      var layout = getLayout[coord.type](data, newIndex, itemModel);
      if (drawBackground) {
        var bgEl = void 0;
        if (oldBgEls.length === 0) {
          bgEl = createBackground(oldIndex);
        } else {
          bgEl = oldBgEls[oldIndex];
          bgEl.useStyle(backgroundModel.getItemStyle());
          // Only cartesian2d support borderRadius.
          if (coord.type === 'cartesian2d') {
            bgEl.setShape('r', barBorderRadius);
          } else {
            bgEl.setShape('cornerRadius', barBorderRadius);
          }
          bgEls[newIndex] = bgEl;
        }
        var bgLayout = getLayout[coord.type](data, newIndex);
        var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
        updateProps$1(bgEl, {
          shape: shape
        }, animationModel, newIndex);
      }
      var el = oldData.getItemGraphicEl(oldIndex);
      if (!data.hasValue(newIndex) || !isValidLayout[coord.type](layout)) {
        group.remove(el);
        return;
      }
      var isClipped = false;
      if (needsClip) {
        isClipped = clip[coord.type](coordSysClipArea, layout);
        if (isClipped) {
          group.remove(el);
        }
      }
      if (!el) {
        el = elementCreator[coord.type](seriesModel, data, newIndex, layout, isHorizontalOrRadial, animationModel, baseAxis.model, !!el, roundCap);
      } else {
        saveOldStyle(el);
      }
      if (realtimeSortCfg) {
        el.forceLabelAnimation = true;
      }
      if (isChangeOrder) {
        var textEl = el.getTextContent();
        if (textEl) {
          var labelInnerStore = labelInner(textEl);
          if (labelInnerStore.prevValue != null) {
            /**
             * Set preValue to be value so that no new label
             * should be started, otherwise, it will take a full
             * `animationDurationUpdate` time to finish the
             * animation, which is not expected.
             */
            labelInnerStore.prevValue = labelInnerStore.value;
          }
        }
      }
      // Not change anything if only order changed.
      // Especially not change label.
      else {
        updateStyle(el, data, newIndex, itemModel, layout, seriesModel, isHorizontalOrRadial, coord.type === 'polar');
      }
      if (isInitSort) {
        el.attr({
          shape: layout
        });
      } else if (realtimeSortCfg) {
        updateRealtimeAnimation(realtimeSortCfg, animationModel, el, layout, newIndex, isHorizontalOrRadial, true, isChangeOrder);
      } else {
        updateProps$1(el, {
          shape: layout
        }, seriesModel, newIndex, null);
      }
      data.setItemGraphicEl(newIndex, el);
      el.ignore = isClipped;
      group.add(el);
    }).remove(function (dataIndex) {
      var el = oldData.getItemGraphicEl(dataIndex);
      el && removeElementWithFadeOut(el, seriesModel, dataIndex);
    }).execute();
    var bgGroup = this._backgroundGroup || (this._backgroundGroup = new Group$5());
    bgGroup.removeAll();
    for (var i = 0; i < bgEls.length; ++i) {
      bgGroup.add(bgEls[i]);
    }
    group.add(bgGroup);
    this._backgroundEls = bgEls;
    this._data = data;
  };
  BarView.prototype._renderLarge = function (seriesModel, ecModel, api) {
    this._clear();
    createLarge$1(seriesModel, this.group);
    this._updateLargeClip(seriesModel);
  };
  BarView.prototype._incrementalRenderLarge = function (params, seriesModel) {
    this._removeBackground();
    createLarge$1(seriesModel, this.group, this._progressiveEls, true);
  };
  BarView.prototype._updateLargeClip = function (seriesModel) {
    // Use clipPath in large mode.
    var clipPath = seriesModel.get('clip', true) && createClipPath(seriesModel.coordinateSystem, false, seriesModel);
    var group = this.group;
    if (clipPath) {
      group.setClipPath(clipPath);
    } else {
      group.removeClipPath();
    }
  };
  BarView.prototype._enableRealtimeSort = function (realtimeSortCfg, data, api) {
    var _this = this;
    // If no data in the first frame, wait for data to initSort
    if (!data.count()) {
      return;
    }
    var baseAxis = realtimeSortCfg.baseAxis;
    if (this._isFirstFrame) {
      this._dispatchInitSort(data, realtimeSortCfg, api);
      this._isFirstFrame = false;
    } else {
      var orderMapping_1 = function (idx) {
        var el = data.getItemGraphicEl(idx);
        var shape = el && el.shape;
        return shape &&
        // The result should be consistent with the initial sort by data value.
        // Do not support the case that both positive and negative exist.
        Math.abs(baseAxis.isHorizontal() ? shape.height : shape.width)
        // If data is NaN, shape.xxx may be NaN, so use || 0 here in case
        || 0;
      };
      this._onRendered = function () {
        _this._updateSortWithinSameData(data, orderMapping_1, baseAxis, api);
      };
      api.getZr().on('rendered', this._onRendered);
    }
  };
  BarView.prototype._dataSort = function (data, baseAxis, orderMapping) {
    var info = [];
    data.each(data.mapDimension(baseAxis.dim), function (ordinalNumber, dataIdx) {
      var mappedValue = orderMapping(dataIdx);
      mappedValue = mappedValue == null ? NaN : mappedValue;
      info.push({
        dataIndex: dataIdx,
        mappedValue: mappedValue,
        ordinalNumber: ordinalNumber
      });
    });
    info.sort(function (a, b) {
      // If NaN, it will be treated as min val.
      return b.mappedValue - a.mappedValue;
    });
    return {
      ordinalNumbers: map$1(info, function (item) {
        return item.ordinalNumber;
      })
    };
  };
  BarView.prototype._isOrderChangedWithinSameData = function (data, orderMapping, baseAxis) {
    var scale = baseAxis.scale;
    var ordinalDataDim = data.mapDimension(baseAxis.dim);
    var lastValue = Number.MAX_VALUE;
    for (var tickNum = 0, len = scale.getOrdinalMeta().categories.length; tickNum < len; ++tickNum) {
      var rawIdx = data.rawIndexOf(ordinalDataDim, scale.getRawOrdinalNumber(tickNum));
      var value = rawIdx < 0
      // If some tick have no bar, the tick will be treated as min.
      ? Number.MIN_VALUE
      // PENDING: if dataZoom on baseAxis exits, is it a performance issue?
      : orderMapping(data.indexOfRawIndex(rawIdx));
      if (value > lastValue) {
        return true;
      }
      lastValue = value;
    }
    return false;
  };
  /*
   * Consider the case when A and B changed order, whose representing
   * bars are both out of sight, we don't wish to trigger reorder action
   * as long as the order in the view doesn't change.
   */
  BarView.prototype._isOrderDifferentInView = function (orderInfo, baseAxis) {
    var scale = baseAxis.scale;
    var extent = scale.getExtent();
    var tickNum = Math.max(0, extent[0]);
    var tickMax = Math.min(extent[1], scale.getOrdinalMeta().categories.length - 1);
    for (; tickNum <= tickMax; ++tickNum) {
      if (orderInfo.ordinalNumbers[tickNum] !== scale.getRawOrdinalNumber(tickNum)) {
        return true;
      }
    }
  };
  BarView.prototype._updateSortWithinSameData = function (data, orderMapping, baseAxis, api) {
    if (!this._isOrderChangedWithinSameData(data, orderMapping, baseAxis)) {
      return;
    }
    var sortInfo = this._dataSort(data, baseAxis, orderMapping);
    if (this._isOrderDifferentInView(sortInfo, baseAxis)) {
      this._removeOnRenderedListener(api);
      api.dispatchAction({
        type: 'changeAxisOrder',
        componentType: baseAxis.dim + 'Axis',
        axisId: baseAxis.index,
        sortInfo: sortInfo
      });
    }
  };
  BarView.prototype._dispatchInitSort = function (data, realtimeSortCfg, api) {
    var baseAxis = realtimeSortCfg.baseAxis;
    var sortResult = this._dataSort(data, baseAxis, function (dataIdx) {
      return data.get(data.mapDimension(realtimeSortCfg.otherAxis.dim), dataIdx);
    });
    api.dispatchAction({
      type: 'changeAxisOrder',
      componentType: baseAxis.dim + 'Axis',
      isInitSort: true,
      axisId: baseAxis.index,
      sortInfo: sortResult
    });
  };
  BarView.prototype.remove = function (ecModel, api) {
    this._clear(this._model);
    this._removeOnRenderedListener(api);
  };
  BarView.prototype.dispose = function (ecModel, api) {
    this._removeOnRenderedListener(api);
  };
  BarView.prototype._removeOnRenderedListener = function (api) {
    if (this._onRendered) {
      api.getZr().off('rendered', this._onRendered);
      this._onRendered = null;
    }
  };
  BarView.prototype._clear = function (model) {
    var group = this.group;
    var data = this._data;
    if (model && model.isAnimationEnabled() && data && !this._isLargeDraw) {
      this._removeBackground();
      this._backgroundEls = [];
      data.eachItemGraphicEl(function (el) {
        removeElementWithFadeOut(el, model, getECData(el).dataIndex);
      });
    } else {
      group.removeAll();
    }
    this._data = null;
    this._isFirstFrame = true;
  };
  BarView.prototype._removeBackground = function () {
    this.group.remove(this._backgroundGroup);
    this._backgroundGroup = null;
  };
  BarView.type = 'bar';
  return BarView;
}(ChartView$1);
var clip = {
  cartesian2d: function (coordSysBoundingRect, layout) {
    var signWidth = layout.width < 0 ? -1 : 1;
    var signHeight = layout.height < 0 ? -1 : 1;
    // Needs positive width and height
    if (signWidth < 0) {
      layout.x += layout.width;
      layout.width = -layout.width;
    }
    if (signHeight < 0) {
      layout.y += layout.height;
      layout.height = -layout.height;
    }
    var coordSysX2 = coordSysBoundingRect.x + coordSysBoundingRect.width;
    var coordSysY2 = coordSysBoundingRect.y + coordSysBoundingRect.height;
    var x = mathMax$4(layout.x, coordSysBoundingRect.x);
    var x2 = mathMin$4(layout.x + layout.width, coordSysX2);
    var y = mathMax$4(layout.y, coordSysBoundingRect.y);
    var y2 = mathMin$4(layout.y + layout.height, coordSysY2);
    var xClipped = x2 < x;
    var yClipped = y2 < y;
    // When xClipped or yClipped, the element will be marked as `ignore`.
    // But we should also place the element at the edge of the coord sys bounding rect.
    // Because if data changed and the bar shows again, its transition animation
    // will begin at this place.
    layout.x = xClipped && x > coordSysX2 ? x2 : x;
    layout.y = yClipped && y > coordSysY2 ? y2 : y;
    layout.width = xClipped ? 0 : x2 - x;
    layout.height = yClipped ? 0 : y2 - y;
    // Reverse back
    if (signWidth < 0) {
      layout.x += layout.width;
      layout.width = -layout.width;
    }
    if (signHeight < 0) {
      layout.y += layout.height;
      layout.height = -layout.height;
    }
    return xClipped || yClipped;
  },
  polar: function (coordSysClipArea, layout) {
    var signR = layout.r0 <= layout.r ? 1 : -1;
    // Make sure r is larger than r0
    if (signR < 0) {
      var tmp = layout.r;
      layout.r = layout.r0;
      layout.r0 = tmp;
    }
    var r = mathMin$4(layout.r, coordSysClipArea.r);
    var r0 = mathMax$4(layout.r0, coordSysClipArea.r0);
    layout.r = r;
    layout.r0 = r0;
    var clipped = r - r0 < 0;
    // Reverse back
    if (signR < 0) {
      var tmp = layout.r;
      layout.r = layout.r0;
      layout.r0 = tmp;
    }
    return clipped;
  }
};
var elementCreator = {
  cartesian2d: function (seriesModel, data, newIndex, layout, isHorizontal, animationModel, axisModel, isUpdate, roundCap) {
    var rect = new Rect$3({
      shape: extend({}, layout),
      z2: 1
    });
    rect.__dataIndex = newIndex;
    rect.name = 'item';
    if (animationModel) {
      var rectShape = rect.shape;
      var animateProperty = isHorizontal ? 'height' : 'width';
      rectShape[animateProperty] = 0;
    }
    return rect;
  },
  polar: function (seriesModel, data, newIndex, layout, isRadial, animationModel, axisModel, isUpdate, roundCap) {
    var ShapeClass = !isRadial && roundCap ? Sausage : Sector$1;
    var sector = new ShapeClass({
      shape: layout,
      z2: 1
    });
    sector.name = 'item';
    var positionMap = createPolarPositionMapping(isRadial);
    sector.calculateTextPosition = createSectorCalculateTextPosition(positionMap, {
      isRoundCap: ShapeClass === Sausage
    });
    // Animation
    if (animationModel) {
      var sectorShape = sector.shape;
      var animateProperty = isRadial ? 'r' : 'endAngle';
      var animateTarget = {};
      sectorShape[animateProperty] = isRadial ? layout.r0 : layout.startAngle;
      animateTarget[animateProperty] = layout[animateProperty];
      (isUpdate ? updateProps$1 : initProps)(sector, {
        shape: animateTarget
        // __value: typeof dataValue === 'string' ? parseInt(dataValue, 10) : dataValue
      }, animationModel);
    }
    return sector;
  }
};
function shouldRealtimeSort(seriesModel, coordSys) {
  var realtimeSortOption = seriesModel.get('realtimeSort', true);
  var baseAxis = coordSys.getBaseAxis();
  {
    if (realtimeSortOption) {
      if (baseAxis.type !== 'category') {
        warn('`realtimeSort` will not work because this bar series is not based on a category axis.');
      }
      if (coordSys.type !== 'cartesian2d') {
        warn('`realtimeSort` will not work because this bar series is not on cartesian2d.');
      }
    }
  }
  if (realtimeSortOption && baseAxis.type === 'category' && coordSys.type === 'cartesian2d') {
    return {
      baseAxis: baseAxis,
      otherAxis: coordSys.getOtherAxis(baseAxis)
    };
  }
}
function updateRealtimeAnimation(realtimeSortCfg, seriesAnimationModel, el, layout, newIndex, isHorizontal, isUpdate, isChangeOrder) {
  var seriesTarget;
  var axisTarget;
  if (isHorizontal) {
    axisTarget = {
      x: layout.x,
      width: layout.width
    };
    seriesTarget = {
      y: layout.y,
      height: layout.height
    };
  } else {
    axisTarget = {
      y: layout.y,
      height: layout.height
    };
    seriesTarget = {
      x: layout.x,
      width: layout.width
    };
  }
  if (!isChangeOrder) {
    // Keep the original growth animation if only axis order changed.
    // Not start a new animation.
    (isUpdate ? updateProps$1 : initProps)(el, {
      shape: seriesTarget
    }, seriesAnimationModel, newIndex, null);
  }
  var axisAnimationModel = seriesAnimationModel ? realtimeSortCfg.baseAxis.model : null;
  (isUpdate ? updateProps$1 : initProps)(el, {
    shape: axisTarget
  }, axisAnimationModel, newIndex);
}
function checkPropertiesNotValid(obj, props) {
  for (var i = 0; i < props.length; i++) {
    if (!isFinite(obj[props[i]])) {
      return true;
    }
  }
  return false;
}
var rectPropties = ['x', 'y', 'width', 'height'];
var polarPropties = ['cx', 'cy', 'r', 'startAngle', 'endAngle'];
var isValidLayout = {
  cartesian2d: function (layout) {
    return !checkPropertiesNotValid(layout, rectPropties);
  },
  polar: function (layout) {
    return !checkPropertiesNotValid(layout, polarPropties);
  }
};
var getLayout = {
  // itemModel is only used to get borderWidth, which is not needed
  // when calculating bar background layout.
  cartesian2d: function (data, dataIndex, itemModel) {
    var layout = data.getItemLayout(dataIndex);
    var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
    // fix layout with lineWidth
    var signX = layout.width > 0 ? 1 : -1;
    var signY = layout.height > 0 ? 1 : -1;
    return {
      x: layout.x + signX * fixedLineWidth / 2,
      y: layout.y + signY * fixedLineWidth / 2,
      width: layout.width - signX * fixedLineWidth,
      height: layout.height - signY * fixedLineWidth
    };
  },
  polar: function (data, dataIndex, itemModel) {
    var layout = data.getItemLayout(dataIndex);
    return {
      cx: layout.cx,
      cy: layout.cy,
      r0: layout.r0,
      r: layout.r,
      startAngle: layout.startAngle,
      endAngle: layout.endAngle,
      clockwise: layout.clockwise
    };
  }
};
function isZeroOnPolar(layout) {
  return layout.startAngle != null && layout.endAngle != null && layout.startAngle === layout.endAngle;
}
function createPolarPositionMapping(isRadial) {
  return function (isRadial) {
    var arcOrAngle = isRadial ? 'Arc' : 'Angle';
    return function (position) {
      switch (position) {
        case 'start':
        case 'insideStart':
        case 'end':
        case 'insideEnd':
          return position + arcOrAngle;
        default:
          return position;
      }
    };
  }(isRadial);
}
function updateStyle(el, data, dataIndex, itemModel, layout, seriesModel, isHorizontalOrRadial, isPolar) {
  var style = data.getItemVisual(dataIndex, 'style');
  if (!isPolar) {
    var borderRadius = itemModel.get(['itemStyle', 'borderRadius']) || 0;
    el.setShape('r', borderRadius);
  } else if (!seriesModel.get('roundCap')) {
    var sectorShape = el.shape;
    var cornerRadius = getSectorCornerRadius(itemModel.getModel('itemStyle'), sectorShape, true);
    extend(sectorShape, cornerRadius);
    el.setShape(sectorShape);
  }
  el.useStyle(style);
  var cursorStyle = itemModel.getShallow('cursor');
  cursorStyle && el.attr('cursor', cursorStyle);
  var labelPositionOutside = isPolar ? isHorizontalOrRadial ? layout.r >= layout.r0 ? 'endArc' : 'startArc' : layout.endAngle >= layout.startAngle ? 'endAngle' : 'startAngle' : isHorizontalOrRadial ? layout.height >= 0 ? 'bottom' : 'top' : layout.width >= 0 ? 'right' : 'left';
  var labelStatesModels = getLabelStatesModels(itemModel);
  setLabelStyle(el, labelStatesModels, {
    labelFetcher: seriesModel,
    labelDataIndex: dataIndex,
    defaultText: getDefaultLabel(seriesModel.getData(), dataIndex),
    inheritColor: style.fill,
    defaultOpacity: style.opacity,
    defaultOutsidePosition: labelPositionOutside
  });
  var label = el.getTextContent();
  if (isPolar && label) {
    var position = itemModel.get(['label', 'position']);
    el.textConfig.inside = position === 'middle' ? true : null;
    setSectorTextRotation(el, position === 'outside' ? labelPositionOutside : position, createPolarPositionMapping(isHorizontalOrRadial), itemModel.get(['label', 'rotate']));
  }
  setLabelValueAnimation(label, labelStatesModels, seriesModel.getRawValue(dataIndex), function (value) {
    return getDefaultInterpolatedLabel(data, value);
  });
  var emphasisModel = itemModel.getModel(['emphasis']);
  toggleHoverEmphasis(el, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
  setStatesStylesFromModel(el, itemModel);
  if (isZeroOnPolar(layout)) {
    el.style.fill = 'none';
    el.style.stroke = 'none';
    each$f(el.states, function (state) {
      if (state.style) {
        state.style.fill = state.style.stroke = 'none';
      }
    });
  }
}
// In case width or height are too small.
function getLineWidth(itemModel, rawLayout) {
  // Has no border.
  var borderColor = itemModel.get(['itemStyle', 'borderColor']);
  if (!borderColor || borderColor === 'none') {
    return 0;
  }
  var lineWidth = itemModel.get(['itemStyle', 'borderWidth']) || 0;
  // width or height may be NaN for empty data
  var width = isNaN(rawLayout.width) ? Number.MAX_VALUE : Math.abs(rawLayout.width);
  var height = isNaN(rawLayout.height) ? Number.MAX_VALUE : Math.abs(rawLayout.height);
  return Math.min(lineWidth, width, height);
}
var LagePathShape = /** @class */function () {
  function LagePathShape() {}
  return LagePathShape;
}();
var LargePath = /** @class */function (_super) {
  __extends(LargePath, _super);
  function LargePath(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'largeBar';
    return _this;
  }
  LargePath.prototype.getDefaultShape = function () {
    return new LagePathShape();
  };
  LargePath.prototype.buildPath = function (ctx, shape) {
    // Drawing lines is more efficient than drawing
    // a whole line or drawing rects.
    var points = shape.points;
    var baseDimIdx = this.baseDimIdx;
    var valueDimIdx = 1 - this.baseDimIdx;
    var startPoint = [];
    var size = [];
    var barWidth = this.barWidth;
    for (var i = 0; i < points.length; i += 3) {
      size[baseDimIdx] = barWidth;
      size[valueDimIdx] = points[i + 2];
      startPoint[baseDimIdx] = points[i + baseDimIdx];
      startPoint[valueDimIdx] = points[i + valueDimIdx];
      ctx.rect(startPoint[0], startPoint[1], size[0], size[1]);
    }
  };
  return LargePath;
}(Path$1);
function createLarge$1(seriesModel, group, progressiveEls, incremental) {
  // TODO support polar
  var data = seriesModel.getData();
  var baseDimIdx = data.getLayout('valueAxisHorizontal') ? 1 : 0;
  var largeDataIndices = data.getLayout('largeDataIndices');
  var barWidth = data.getLayout('size');
  var backgroundModel = seriesModel.getModel('backgroundStyle');
  var bgPoints = data.getLayout('largeBackgroundPoints');
  if (bgPoints) {
    var bgEl = new LargePath({
      shape: {
        points: bgPoints
      },
      incremental: !!incremental,
      silent: true,
      z2: 0
    });
    bgEl.baseDimIdx = baseDimIdx;
    bgEl.largeDataIndices = largeDataIndices;
    bgEl.barWidth = barWidth;
    bgEl.useStyle(backgroundModel.getItemStyle());
    group.add(bgEl);
    progressiveEls && progressiveEls.push(bgEl);
  }
  var el = new LargePath({
    shape: {
      points: data.getLayout('largePoints')
    },
    incremental: !!incremental,
    ignoreCoarsePointer: true,
    z2: 1
  });
  el.baseDimIdx = baseDimIdx;
  el.largeDataIndices = largeDataIndices;
  el.barWidth = barWidth;
  group.add(el);
  el.useStyle(data.getVisual('style'));
  // Stroke is rendered first to avoid overlapping with fill
  el.style.stroke = null;
  // Enable tooltip and user mouse/touch event handlers.
  getECData(el).seriesIndex = seriesModel.seriesIndex;
  if (!seriesModel.get('silent')) {
    el.on('mousedown', largePathUpdateDataIndex);
    el.on('mousemove', largePathUpdateDataIndex);
  }
  progressiveEls && progressiveEls.push(el);
}
// Use throttle to avoid frequently traverse to find dataIndex.
var largePathUpdateDataIndex = throttle(function (event) {
  var largePath = this;
  var dataIndex = largePathFindDataIndex(largePath, event.offsetX, event.offsetY);
  getECData(largePath).dataIndex = dataIndex >= 0 ? dataIndex : null;
}, 30, false);
function largePathFindDataIndex(largePath, x, y) {
  var baseDimIdx = largePath.baseDimIdx;
  var valueDimIdx = 1 - baseDimIdx;
  var points = largePath.shape.points;
  var largeDataIndices = largePath.largeDataIndices;
  var startPoint = [];
  var size = [];
  var barWidth = largePath.barWidth;
  for (var i = 0, len = points.length / 3; i < len; i++) {
    var ii = i * 3;
    size[baseDimIdx] = barWidth;
    size[valueDimIdx] = points[ii + 2];
    startPoint[baseDimIdx] = points[ii + baseDimIdx];
    startPoint[valueDimIdx] = points[ii + valueDimIdx];
    if (size[valueDimIdx] < 0) {
      startPoint[valueDimIdx] += size[valueDimIdx];
      size[valueDimIdx] = -size[valueDimIdx];
    }
    if (x >= startPoint[0] && x <= startPoint[0] + size[0] && y >= startPoint[1] && y <= startPoint[1] + size[1]) {
      return largeDataIndices[i];
    }
  }
  return -1;
}
function createBackgroundShape(isHorizontalOrRadial, layout, coord) {
  if (isCoordinateSystemType(coord, 'cartesian2d')) {
    var rectShape = layout;
    var coordLayout = coord.getArea();
    return {
      x: isHorizontalOrRadial ? rectShape.x : coordLayout.x,
      y: isHorizontalOrRadial ? coordLayout.y : rectShape.y,
      width: isHorizontalOrRadial ? rectShape.width : coordLayout.width,
      height: isHorizontalOrRadial ? coordLayout.height : rectShape.height
    };
  } else {
    var coordLayout = coord.getArea();
    var sectorShape = layout;
    return {
      cx: coordLayout.cx,
      cy: coordLayout.cy,
      r0: isHorizontalOrRadial ? coordLayout.r0 : sectorShape.r0,
      r: isHorizontalOrRadial ? coordLayout.r : sectorShape.r,
      startAngle: isHorizontalOrRadial ? sectorShape.startAngle : 0,
      endAngle: isHorizontalOrRadial ? sectorShape.endAngle : Math.PI * 2
    };
  }
}
function createBackgroundEl(coord, isHorizontalOrRadial, layout) {
  var ElementClz = coord.type === 'polar' ? Sector$1 : Rect$3;
  return new ElementClz({
    shape: createBackgroundShape(isHorizontalOrRadial, layout, coord),
    silent: true,
    z2: 0
  });
}
var BarView$1 = BarView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$R(registers) {
  registers.registerChartView(BarView$1);
  registers.registerSeriesModel(BarSeries);
  registers.registerLayout(registers.PRIORITY.VISUAL.LAYOUT, curry$1(layout$3, 'bar'));
  // Do layout after other overall layout, which can prepare some information.
  registers.registerLayout(registers.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT, createProgressiveLayout('bar'));
  // Down sample after filter
  registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, dataSample('bar'));
  /**
   * @payload
   * @property {string} [componentType=series]
   * @property {number} [dx]
   * @property {number} [dy]
   * @property {number} [zoom]
   * @property {number} [originX]
   * @property {number} [originY]
   */
  registers.registerAction({
    type: 'changeAxisOrder',
    event: 'changeAxisOrder',
    update: 'update'
  }, function (payload, ecModel) {
    var componentType = payload.componentType || 'series';
    ecModel.eachComponent({
      mainType: componentType,
      query: payload
    }, function (componentModel) {
      if (payload.sortInfo) {
        componentModel.axis.setCategorySortInfo(payload.sortInfo);
      }
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PI2 = Math.PI * 2;
var RADIAN$2 = Math.PI / 180;
function getViewRect$5(seriesModel, api) {
  return getLayoutRect(seriesModel.getBoxLayoutParams(), {
    width: api.getWidth(),
    height: api.getHeight()
  });
}
function getBasicPieLayout(seriesModel, api) {
  var viewRect = getViewRect$5(seriesModel, api);
  // center can be string or number when coordinateSystem is specified
  var center = seriesModel.get('center');
  var radius = seriesModel.get('radius');
  if (!isArray$1(radius)) {
    radius = [0, radius];
  }
  var width = parsePercent(viewRect.width, api.getWidth());
  var height = parsePercent(viewRect.height, api.getHeight());
  var size = Math.min(width, height);
  var r0 = parsePercent(radius[0], size / 2);
  var r = parsePercent(radius[1], size / 2);
  var cx;
  var cy;
  var coordSys = seriesModel.coordinateSystem;
  if (coordSys) {
    // percentage is not allowed when coordinate system is specified
    var point = coordSys.dataToPoint(center);
    cx = point[0] || 0;
    cy = point[1] || 0;
  } else {
    if (!isArray$1(center)) {
      center = [center, center];
    }
    cx = parsePercent(center[0], width) + viewRect.x;
    cy = parsePercent(center[1], height) + viewRect.y;
  }
  return {
    cx: cx,
    cy: cy,
    r0: r0,
    r: r
  };
}
function pieLayout(seriesType, ecModel, api) {
  ecModel.eachSeriesByType(seriesType, function (seriesModel) {
    var data = seriesModel.getData();
    var valueDim = data.mapDimension('value');
    var viewRect = getViewRect$5(seriesModel, api);
    var _a = getBasicPieLayout(seriesModel, api),
      cx = _a.cx,
      cy = _a.cy,
      r = _a.r,
      r0 = _a.r0;
    var startAngle = -seriesModel.get('startAngle') * RADIAN$2;
    var endAngle = seriesModel.get('endAngle');
    var padAngle = seriesModel.get('padAngle') * RADIAN$2;
    endAngle = endAngle === 'auto' ? startAngle - PI2 : -endAngle * RADIAN$2;
    var minAngle = seriesModel.get('minAngle') * RADIAN$2;
    var minAndPadAngle = minAngle + padAngle;
    var validDataCount = 0;
    data.each(valueDim, function (value) {
      !isNaN(value) && validDataCount++;
    });
    var sum = data.getSum(valueDim);
    // Sum may be 0
    var unitRadian = Math.PI / (sum || validDataCount) * 2;
    var clockwise = seriesModel.get('clockwise');
    var roseType = seriesModel.get('roseType');
    var stillShowZeroSum = seriesModel.get('stillShowZeroSum');
    // [0...max]
    var extent = data.getDataExtent(valueDim);
    extent[0] = 0;
    var dir = clockwise ? 1 : -1;
    var angles = [startAngle, endAngle];
    var halfPadAngle = dir * padAngle / 2;
    normalizeArcAngles(angles, !clockwise);
    startAngle = angles[0], endAngle = angles[1];
    var layoutData = getSeriesLayoutData(seriesModel);
    layoutData.startAngle = startAngle;
    layoutData.endAngle = endAngle;
    layoutData.clockwise = clockwise;
    var angleRange = Math.abs(endAngle - startAngle);
    // In the case some sector angle is smaller than minAngle
    var restAngle = angleRange;
    var valueSumLargerThanMinAngle = 0;
    var currentAngle = startAngle;
    data.setLayout({
      viewRect: viewRect,
      r: r
    });
    data.each(valueDim, function (value, idx) {
      var angle;
      if (isNaN(value)) {
        data.setItemLayout(idx, {
          angle: NaN,
          startAngle: NaN,
          endAngle: NaN,
          clockwise: clockwise,
          cx: cx,
          cy: cy,
          r0: r0,
          r: roseType ? NaN : r
        });
        return;
      }
      // FIXME 兼容 2.0 但是 roseType 是 area 的时候才是这样？
      if (roseType !== 'area') {
        angle = sum === 0 && stillShowZeroSum ? unitRadian : value * unitRadian;
      } else {
        angle = angleRange / validDataCount;
      }
      if (angle < minAndPadAngle) {
        angle = minAndPadAngle;
        restAngle -= minAndPadAngle;
      } else {
        valueSumLargerThanMinAngle += value;
      }
      var endAngle = currentAngle + dir * angle;
      // calculate display angle
      var actualStartAngle = 0;
      var actualEndAngle = 0;
      if (padAngle > angle) {
        actualStartAngle = currentAngle + dir * angle / 2;
        actualEndAngle = actualStartAngle;
      } else {
        actualStartAngle = currentAngle + halfPadAngle;
        actualEndAngle = endAngle - halfPadAngle;
      }
      data.setItemLayout(idx, {
        angle: angle,
        startAngle: actualStartAngle,
        endAngle: actualEndAngle,
        clockwise: clockwise,
        cx: cx,
        cy: cy,
        r0: r0,
        r: roseType ? linearMap$2(value, extent, [r0, r]) : r
      });
      currentAngle = endAngle;
    });
    // Some sector is constrained by minAngle and padAngle
    // Rest sectors needs recalculate angle
    if (restAngle < PI2 && validDataCount) {
      // Average the angle if rest angle is not enough after all angles is
      // Constrained by minAngle and padAngle
      if (restAngle <= 1e-3) {
        var angle_1 = angleRange / validDataCount;
        data.each(valueDim, function (value, idx) {
          if (!isNaN(value)) {
            var layout_1 = data.getItemLayout(idx);
            layout_1.angle = angle_1;
            var actualStartAngle = 0;
            var actualEndAngle = 0;
            if (angle_1 < padAngle) {
              actualStartAngle = startAngle + dir * (idx + 1 / 2) * angle_1;
              actualEndAngle = actualStartAngle;
            } else {
              actualStartAngle = startAngle + dir * idx * angle_1 + halfPadAngle;
              actualEndAngle = startAngle + dir * (idx + 1) * angle_1 - halfPadAngle;
            }
            layout_1.startAngle = actualStartAngle;
            layout_1.endAngle = actualEndAngle;
          }
        });
      } else {
        unitRadian = restAngle / valueSumLargerThanMinAngle;
        currentAngle = startAngle;
        data.each(valueDim, function (value, idx) {
          if (!isNaN(value)) {
            var layout_2 = data.getItemLayout(idx);
            var angle = layout_2.angle === minAndPadAngle ? minAndPadAngle : value * unitRadian;
            var actualStartAngle = 0;
            var actualEndAngle = 0;
            if (angle < padAngle) {
              actualStartAngle = currentAngle + dir * angle / 2;
              actualEndAngle = actualStartAngle;
            } else {
              actualStartAngle = currentAngle + halfPadAngle;
              actualEndAngle = currentAngle + dir * angle - halfPadAngle;
            }
            layout_2.startAngle = actualStartAngle;
            layout_2.endAngle = actualEndAngle;
            currentAngle += dir * angle;
          }
        });
      }
    }
  });
}
var getSeriesLayoutData = makeInner();

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function dataFilter$1(seriesType) {
  return {
    seriesType: seriesType,
    reset: function (seriesModel, ecModel) {
      var legendModels = ecModel.findComponents({
        mainType: 'legend'
      });
      if (!legendModels || !legendModels.length) {
        return;
      }
      var data = seriesModel.getData();
      data.filterSelf(function (idx) {
        var name = data.getName(idx);
        // If in any legend component the status is not selected.
        for (var i = 0; i < legendModels.length; i++) {
          // @ts-ignore FIXME: LegendModel
          if (!legendModels[i].isSelected(name)) {
            return false;
          }
        }
        return true;
      });
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var RADIAN$1 = Math.PI / 180;
function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight, viewLeft, viewTop, farthestX) {
  if (list.length < 2) {
    return;
  }
  function recalculateXOnSemiToAlignOnEllipseCurve(semi) {
    var rB = semi.rB;
    var rB2 = rB * rB;
    for (var i = 0; i < semi.list.length; i++) {
      var item = semi.list[i];
      var dy = Math.abs(item.label.y - cy);
      // horizontal r is always same with original r because x is not changed.
      var rA = r + item.len;
      var rA2 = rA * rA;
      // Use ellipse implicit function to calculate x
      var dx = Math.sqrt(Math.abs((1 - dy * dy / rB2) * rA2));
      var newX = cx + (dx + item.len2) * dir;
      var deltaX = newX - item.label.x;
      var newTargetWidth = item.targetTextWidth - deltaX * dir;
      // text x is changed, so need to recalculate width.
      constrainTextWidth(item, newTargetWidth, true);
      item.label.x = newX;
    }
  }
  // Adjust X based on the shifted y. Make tight labels aligned on an ellipse curve.
  function recalculateX(items) {
    // Extremes of
    var topSemi = {
      list: [],
      maxY: 0
    };
    var bottomSemi = {
      list: [],
      maxY: 0
    };
    for (var i = 0; i < items.length; i++) {
      if (items[i].labelAlignTo !== 'none') {
        continue;
      }
      var item = items[i];
      var semi = item.label.y > cy ? bottomSemi : topSemi;
      var dy = Math.abs(item.label.y - cy);
      if (dy >= semi.maxY) {
        var dx = item.label.x - cx - item.len2 * dir;
        // horizontal r is always same with original r because x is not changed.
        var rA = r + item.len;
        // Canculate rB based on the topest / bottemest label.
        var rB = Math.abs(dx) < rA ? Math.sqrt(dy * dy / (1 - dx * dx / rA / rA)) : rA;
        semi.rB = rB;
        semi.maxY = dy;
      }
      semi.list.push(item);
    }
    recalculateXOnSemiToAlignOnEllipseCurve(topSemi);
    recalculateXOnSemiToAlignOnEllipseCurve(bottomSemi);
  }
  var len = list.length;
  for (var i = 0; i < len; i++) {
    if (list[i].position === 'outer' && list[i].labelAlignTo === 'labelLine') {
      var dx = list[i].label.x - farthestX;
      list[i].linePoints[1][0] += dx;
      list[i].label.x = farthestX;
    }
  }
  if (shiftLayoutOnY(list, viewTop, viewTop + viewHeight)) {
    recalculateX(list);
  }
}
function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLeft, viewTop) {
  var leftList = [];
  var rightList = [];
  var leftmostX = Number.MAX_VALUE;
  var rightmostX = -Number.MAX_VALUE;
  for (var i = 0; i < labelLayoutList.length; i++) {
    var label = labelLayoutList[i].label;
    if (isPositionCenter(labelLayoutList[i])) {
      continue;
    }
    if (label.x < cx) {
      leftmostX = Math.min(leftmostX, label.x);
      leftList.push(labelLayoutList[i]);
    } else {
      rightmostX = Math.max(rightmostX, label.x);
      rightList.push(labelLayoutList[i]);
    }
  }
  for (var i = 0; i < labelLayoutList.length; i++) {
    var layout = labelLayoutList[i];
    if (!isPositionCenter(layout) && layout.linePoints) {
      if (layout.labelStyleWidth != null) {
        continue;
      }
      var label = layout.label;
      var linePoints = layout.linePoints;
      var targetTextWidth = void 0;
      if (layout.labelAlignTo === 'edge') {
        if (label.x < cx) {
          targetTextWidth = linePoints[2][0] - layout.labelDistance - viewLeft - layout.edgeDistance;
        } else {
          targetTextWidth = viewLeft + viewWidth - layout.edgeDistance - linePoints[2][0] - layout.labelDistance;
        }
      } else if (layout.labelAlignTo === 'labelLine') {
        if (label.x < cx) {
          targetTextWidth = leftmostX - viewLeft - layout.bleedMargin;
        } else {
          targetTextWidth = viewLeft + viewWidth - rightmostX - layout.bleedMargin;
        }
      } else {
        if (label.x < cx) {
          targetTextWidth = label.x - viewLeft - layout.bleedMargin;
        } else {
          targetTextWidth = viewLeft + viewWidth - label.x - layout.bleedMargin;
        }
      }
      layout.targetTextWidth = targetTextWidth;
      constrainTextWidth(layout, targetTextWidth);
    }
  }
  adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight, viewLeft, viewTop, rightmostX);
  adjustSingleSide(leftList, cx, cy, r, -1, viewWidth, viewHeight, viewLeft, viewTop, leftmostX);
  for (var i = 0; i < labelLayoutList.length; i++) {
    var layout = labelLayoutList[i];
    if (!isPositionCenter(layout) && layout.linePoints) {
      var label = layout.label;
      var linePoints = layout.linePoints;
      var isAlignToEdge = layout.labelAlignTo === 'edge';
      var padding = label.style.padding;
      var paddingH = padding ? padding[1] + padding[3] : 0;
      // textRect.width already contains paddingH if bgColor is set
      var extraPaddingH = label.style.backgroundColor ? 0 : paddingH;
      var realTextWidth = layout.rect.width + extraPaddingH;
      var dist = linePoints[1][0] - linePoints[2][0];
      if (isAlignToEdge) {
        if (label.x < cx) {
          linePoints[2][0] = viewLeft + layout.edgeDistance + realTextWidth + layout.labelDistance;
        } else {
          linePoints[2][0] = viewLeft + viewWidth - layout.edgeDistance - realTextWidth - layout.labelDistance;
        }
      } else {
        if (label.x < cx) {
          linePoints[2][0] = label.x + layout.labelDistance;
        } else {
          linePoints[2][0] = label.x - layout.labelDistance;
        }
        linePoints[1][0] = linePoints[2][0] + dist;
      }
      linePoints[1][1] = linePoints[2][1] = label.y;
    }
  }
}
/**
 * Set max width of each label, and then wrap each label to the max width.
 *
 * @param layout label layout
 * @param availableWidth max width for the label to display
 * @param forceRecalculate recaculate the text layout even if the current width
 * is smaller than `availableWidth`. This is useful when the text was previously
 * wrapped by calling `constrainTextWidth` but now `availableWidth` changed, in
 * which case, previous wrapping should be redo.
 */
function constrainTextWidth(layout, availableWidth, forceRecalculate) {
  if (forceRecalculate === void 0) {
    forceRecalculate = false;
  }
  if (layout.labelStyleWidth != null) {
    // User-defined style.width has the highest priority.
    return;
  }
  var label = layout.label;
  var style = label.style;
  var textRect = layout.rect;
  var bgColor = style.backgroundColor;
  var padding = style.padding;
  var paddingH = padding ? padding[1] + padding[3] : 0;
  var overflow = style.overflow;
  // textRect.width already contains paddingH if bgColor is set
  var oldOuterWidth = textRect.width + (bgColor ? 0 : paddingH);
  if (availableWidth < oldOuterWidth || forceRecalculate) {
    var oldHeight = textRect.height;
    if (overflow && overflow.match('break')) {
      // Temporarily set background to be null to calculate
      // the bounding box without background.
      label.setStyle('backgroundColor', null);
      // Set constraining width
      label.setStyle('width', availableWidth - paddingH);
      // This is the real bounding box of the text without padding.
      var innerRect = label.getBoundingRect();
      label.setStyle('width', Math.ceil(innerRect.width));
      label.setStyle('backgroundColor', bgColor);
    } else {
      var availableInnerWidth = availableWidth - paddingH;
      var newWidth = availableWidth < oldOuterWidth
      // Current text is too wide, use `availableWidth` as max width.
      ? availableInnerWidth :
      // Current available width is enough, but the text may have
      // already been wrapped with a smaller available width.
      forceRecalculate ? availableInnerWidth > layout.unconstrainedWidth
      // Current available is larger than text width,
      // so don't constrain width (otherwise it may have
      // empty space in the background).
      ? null
      // Current available is smaller than text width, so
      // use the current available width as constraining
      // width.
      : availableInnerWidth
      // Current available width is enough, so no need to
      // constrain.
      : null;
      label.setStyle('width', newWidth);
    }
    var newRect = label.getBoundingRect();
    textRect.width = newRect.width;
    var margin = (label.style.margin || 0) + 2.1;
    textRect.height = newRect.height + margin;
    textRect.y -= (textRect.height - oldHeight) / 2;
  }
}
function isPositionCenter(sectorShape) {
  // Not change x for center label
  return sectorShape.position === 'center';
}
function pieLabelLayout(seriesModel) {
  var data = seriesModel.getData();
  var labelLayoutList = [];
  var cx;
  var cy;
  var hasLabelRotate = false;
  var minShowLabelRadian = (seriesModel.get('minShowLabelAngle') || 0) * RADIAN$1;
  var viewRect = data.getLayout('viewRect');
  var r = data.getLayout('r');
  var viewWidth = viewRect.width;
  var viewLeft = viewRect.x;
  var viewTop = viewRect.y;
  var viewHeight = viewRect.height;
  function setNotShow(el) {
    el.ignore = true;
  }
  function isLabelShown(label) {
    if (!label.ignore) {
      return true;
    }
    for (var key in label.states) {
      if (label.states[key].ignore === false) {
        return true;
      }
    }
    return false;
  }
  data.each(function (idx) {
    var sector = data.getItemGraphicEl(idx);
    var sectorShape = sector.shape;
    var label = sector.getTextContent();
    var labelLine = sector.getTextGuideLine();
    var itemModel = data.getItemModel(idx);
    var labelModel = itemModel.getModel('label');
    // Use position in normal or emphasis
    var labelPosition = labelModel.get('position') || itemModel.get(['emphasis', 'label', 'position']);
    var labelDistance = labelModel.get('distanceToLabelLine');
    var labelAlignTo = labelModel.get('alignTo');
    var edgeDistance = parsePercent(labelModel.get('edgeDistance'), viewWidth);
    var bleedMargin = labelModel.get('bleedMargin');
    var labelLineModel = itemModel.getModel('labelLine');
    var labelLineLen = labelLineModel.get('length');
    labelLineLen = parsePercent(labelLineLen, viewWidth);
    var labelLineLen2 = labelLineModel.get('length2');
    labelLineLen2 = parsePercent(labelLineLen2, viewWidth);
    if (Math.abs(sectorShape.endAngle - sectorShape.startAngle) < minShowLabelRadian) {
      each$f(label.states, setNotShow);
      label.ignore = true;
      if (labelLine) {
        each$f(labelLine.states, setNotShow);
        labelLine.ignore = true;
      }
      return;
    }
    if (!isLabelShown(label)) {
      return;
    }
    var midAngle = (sectorShape.startAngle + sectorShape.endAngle) / 2;
    var nx = Math.cos(midAngle);
    var ny = Math.sin(midAngle);
    var textX;
    var textY;
    var linePoints;
    var textAlign;
    cx = sectorShape.cx;
    cy = sectorShape.cy;
    var isLabelInside = labelPosition === 'inside' || labelPosition === 'inner';
    if (labelPosition === 'center') {
      textX = sectorShape.cx;
      textY = sectorShape.cy;
      textAlign = 'center';
    } else {
      var x1 = (isLabelInside ? (sectorShape.r + sectorShape.r0) / 2 * nx : sectorShape.r * nx) + cx;
      var y1 = (isLabelInside ? (sectorShape.r + sectorShape.r0) / 2 * ny : sectorShape.r * ny) + cy;
      textX = x1 + nx * 3;
      textY = y1 + ny * 3;
      if (!isLabelInside) {
        // For roseType
        var x2 = x1 + nx * (labelLineLen + r - sectorShape.r);
        var y2 = y1 + ny * (labelLineLen + r - sectorShape.r);
        var x3 = x2 + (nx < 0 ? -1 : 1) * labelLineLen2;
        var y3 = y2;
        if (labelAlignTo === 'edge') {
          // Adjust textX because text align of edge is opposite
          textX = nx < 0 ? viewLeft + edgeDistance : viewLeft + viewWidth - edgeDistance;
        } else {
          textX = x3 + (nx < 0 ? -labelDistance : labelDistance);
        }
        textY = y3;
        linePoints = [[x1, y1], [x2, y2], [x3, y3]];
      }
      textAlign = isLabelInside ? 'center' : labelAlignTo === 'edge' ? nx > 0 ? 'right' : 'left' : nx > 0 ? 'left' : 'right';
    }
    var PI = Math.PI;
    var labelRotate = 0;
    var rotate = labelModel.get('rotate');
    if (isNumber(rotate)) {
      labelRotate = rotate * (PI / 180);
    } else if (labelPosition === 'center') {
      labelRotate = 0;
    } else if (rotate === 'radial' || rotate === true) {
      var radialAngle = nx < 0 ? -midAngle + PI : -midAngle;
      labelRotate = radialAngle;
    } else if (rotate === 'tangential' && labelPosition !== 'outside' && labelPosition !== 'outer') {
      var rad = Math.atan2(nx, ny);
      if (rad < 0) {
        rad = PI * 2 + rad;
      }
      var isDown = ny > 0;
      if (isDown) {
        rad = PI + rad;
      }
      labelRotate = rad - PI;
    }
    hasLabelRotate = !!labelRotate;
    label.x = textX;
    label.y = textY;
    label.rotation = labelRotate;
    label.setStyle({
      verticalAlign: 'middle'
    });
    // Not sectorShape the inside label
    if (!isLabelInside) {
      var textRect = label.getBoundingRect().clone();
      textRect.applyTransform(label.getComputedTransform());
      // Text has a default 1px stroke. Exclude this.
      var margin = (label.style.margin || 0) + 2.1;
      textRect.y -= margin / 2;
      textRect.height += margin;
      labelLayoutList.push({
        label: label,
        labelLine: labelLine,
        position: labelPosition,
        len: labelLineLen,
        len2: labelLineLen2,
        minTurnAngle: labelLineModel.get('minTurnAngle'),
        maxSurfaceAngle: labelLineModel.get('maxSurfaceAngle'),
        surfaceNormal: new Point$1(nx, ny),
        linePoints: linePoints,
        textAlign: textAlign,
        labelDistance: labelDistance,
        labelAlignTo: labelAlignTo,
        edgeDistance: edgeDistance,
        bleedMargin: bleedMargin,
        rect: textRect,
        unconstrainedWidth: textRect.width,
        labelStyleWidth: label.style.width
      });
    } else {
      label.setStyle({
        align: textAlign
      });
      var selectState = label.states.select;
      if (selectState) {
        selectState.x += label.x;
        selectState.y += label.y;
      }
    }
    sector.setTextConfig({
      inside: isLabelInside
    });
  });
  if (!hasLabelRotate && seriesModel.get('avoidLabelOverlap')) {
    avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLeft, viewTop);
  }
  for (var i = 0; i < labelLayoutList.length; i++) {
    var layout = labelLayoutList[i];
    var label = layout.label;
    var labelLine = layout.labelLine;
    var notShowLabel = isNaN(label.x) || isNaN(label.y);
    if (label) {
      label.setStyle({
        align: layout.textAlign
      });
      if (notShowLabel) {
        each$f(label.states, setNotShow);
        label.ignore = true;
      }
      var selectState = label.states.select;
      if (selectState) {
        selectState.x += label.x;
        selectState.y += label.y;
      }
    }
    if (labelLine) {
      var linePoints = layout.linePoints;
      if (notShowLabel || !linePoints) {
        each$f(labelLine.states, setNotShow);
        labelLine.ignore = true;
      } else {
        limitTurnAngle(linePoints, layout.minTurnAngle);
        limitSurfaceAngle(linePoints, layout.surfaceNormal, layout.maxSurfaceAngle);
        labelLine.setShape({
          points: linePoints
        });
        // Set the anchor to the midpoint of sector
        label.__hostTarget.textGuideLineConfig = {
          anchor: new Point$1(linePoints[0][0], linePoints[0][1])
        };
      }
    }
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Piece of pie including Sector, Label, LabelLine
 */
var PiePiece = /** @class */function (_super) {
  __extends(PiePiece, _super);
  function PiePiece(data, idx, startAngle) {
    var _this = _super.call(this) || this;
    _this.z2 = 2;
    var text = new ZRText$1();
    _this.setTextContent(text);
    _this.updateData(data, idx, startAngle, true);
    return _this;
  }
  PiePiece.prototype.updateData = function (data, idx, startAngle, firstCreate) {
    var sector = this;
    var seriesModel = data.hostModel;
    var itemModel = data.getItemModel(idx);
    var emphasisModel = itemModel.getModel('emphasis');
    var layout = data.getItemLayout(idx);
    // cornerRadius & innerCornerRadius doesn't exist in the item layout. Use `0` if null value is specified.
    // see `setItemLayout` in `pieLayout.ts`.
    var sectorShape = extend(getSectorCornerRadius(itemModel.getModel('itemStyle'), layout, true), layout);
    // Ignore NaN data.
    if (isNaN(sectorShape.startAngle)) {
      // Use NaN shape to avoid drawing shape.
      sector.setShape(sectorShape);
      return;
    }
    if (firstCreate) {
      sector.setShape(sectorShape);
      var animationType = seriesModel.getShallow('animationType');
      if (seriesModel.ecModel.ssr) {
        // Use scale animation in SSR mode(opacity?)
        // Because CSS SVG animation doesn't support very customized shape animation.
        initProps(sector, {
          scaleX: 0,
          scaleY: 0
        }, seriesModel, {
          dataIndex: idx,
          isFrom: true
        });
        sector.originX = sectorShape.cx;
        sector.originY = sectorShape.cy;
      } else if (animationType === 'scale') {
        sector.shape.r = layout.r0;
        initProps(sector, {
          shape: {
            r: layout.r
          }
        }, seriesModel, idx);
      }
      // Expansion
      else {
        if (startAngle != null) {
          sector.setShape({
            startAngle: startAngle,
            endAngle: startAngle
          });
          initProps(sector, {
            shape: {
              startAngle: layout.startAngle,
              endAngle: layout.endAngle
            }
          }, seriesModel, idx);
        } else {
          sector.shape.endAngle = layout.startAngle;
          updateProps$1(sector, {
            shape: {
              endAngle: layout.endAngle
            }
          }, seriesModel, idx);
        }
      }
    } else {
      saveOldStyle(sector);
      // Transition animation from the old shape
      updateProps$1(sector, {
        shape: sectorShape
      }, seriesModel, idx);
    }
    sector.useStyle(data.getItemVisual(idx, 'style'));
    setStatesStylesFromModel(sector, itemModel);
    var midAngle = (layout.startAngle + layout.endAngle) / 2;
    var offset = seriesModel.get('selectedOffset');
    var dx = Math.cos(midAngle) * offset;
    var dy = Math.sin(midAngle) * offset;
    var cursorStyle = itemModel.getShallow('cursor');
    cursorStyle && sector.attr('cursor', cursorStyle);
    this._updateLabel(seriesModel, data, idx);
    sector.ensureState('emphasis').shape = extend({
      r: layout.r + (emphasisModel.get('scale') ? emphasisModel.get('scaleSize') || 0 : 0)
    }, getSectorCornerRadius(emphasisModel.getModel('itemStyle'), layout));
    extend(sector.ensureState('select'), {
      x: dx,
      y: dy,
      shape: getSectorCornerRadius(itemModel.getModel(['select', 'itemStyle']), layout)
    });
    extend(sector.ensureState('blur'), {
      shape: getSectorCornerRadius(itemModel.getModel(['blur', 'itemStyle']), layout)
    });
    var labelLine = sector.getTextGuideLine();
    var labelText = sector.getTextContent();
    labelLine && extend(labelLine.ensureState('select'), {
      x: dx,
      y: dy
    });
    // TODO: needs dx, dy in zrender?
    extend(labelText.ensureState('select'), {
      x: dx,
      y: dy
    });
    toggleHoverEmphasis(this, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
  };
  PiePiece.prototype._updateLabel = function (seriesModel, data, idx) {
    var sector = this;
    var itemModel = data.getItemModel(idx);
    var labelLineModel = itemModel.getModel('labelLine');
    var style = data.getItemVisual(idx, 'style');
    var visualColor = style && style.fill;
    var visualOpacity = style && style.opacity;
    setLabelStyle(sector, getLabelStatesModels(itemModel), {
      labelFetcher: data.hostModel,
      labelDataIndex: idx,
      inheritColor: visualColor,
      defaultOpacity: visualOpacity,
      defaultText: seriesModel.getFormattedLabel(idx, 'normal') || data.getName(idx)
    });
    var labelText = sector.getTextContent();
    // Set textConfig on sector.
    sector.setTextConfig({
      // reset position, rotation
      position: null,
      rotation: null
    });
    // Make sure update style on labelText after setLabelStyle.
    // Because setLabelStyle will replace a new style on it.
    labelText.attr({
      z2: 10
    });
    var labelPosition = seriesModel.get(['label', 'position']);
    if (labelPosition !== 'outside' && labelPosition !== 'outer') {
      sector.removeTextGuideLine();
    } else {
      var polyline = this.getTextGuideLine();
      if (!polyline) {
        polyline = new Polyline$3();
        this.setTextGuideLine(polyline);
      }
      // Default use item visual color
      setLabelLineStyle(this, getLabelLineStatesModels(itemModel), {
        stroke: visualColor,
        opacity: retrieve3(labelLineModel.get(['lineStyle', 'opacity']), visualOpacity, 1)
      });
    }
  };
  return PiePiece;
}(Sector$1);
// Pie view
var PieView = /** @class */function (_super) {
  __extends(PieView, _super);
  function PieView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.ignoreLabelLineUpdate = true;
    return _this;
  }
  PieView.prototype.render = function (seriesModel, ecModel, api, payload) {
    var data = seriesModel.getData();
    var oldData = this._data;
    var group = this.group;
    var startAngle;
    // First render
    if (!oldData && data.count() > 0) {
      var shape = data.getItemLayout(0);
      for (var s = 1; isNaN(shape && shape.startAngle) && s < data.count(); ++s) {
        shape = data.getItemLayout(s);
      }
      if (shape) {
        startAngle = shape.startAngle;
      }
    }
    // remove empty-circle if it exists
    if (this._emptyCircleSector) {
      group.remove(this._emptyCircleSector);
    }
    // when all data are filtered, show lightgray empty circle
    if (data.count() === 0 && seriesModel.get('showEmptyCircle')) {
      var layoutData = getSeriesLayoutData(seriesModel);
      var sector = new Sector$1({
        shape: extend(getBasicPieLayout(seriesModel, api), layoutData)
      });
      sector.useStyle(seriesModel.getModel('emptyCircleStyle').getItemStyle());
      this._emptyCircleSector = sector;
      group.add(sector);
    }
    data.diff(oldData).add(function (idx) {
      var piePiece = new PiePiece(data, idx, startAngle);
      data.setItemGraphicEl(idx, piePiece);
      group.add(piePiece);
    }).update(function (newIdx, oldIdx) {
      var piePiece = oldData.getItemGraphicEl(oldIdx);
      piePiece.updateData(data, newIdx, startAngle);
      piePiece.off('click');
      group.add(piePiece);
      data.setItemGraphicEl(newIdx, piePiece);
    }).remove(function (idx) {
      var piePiece = oldData.getItemGraphicEl(idx);
      removeElementWithFadeOut(piePiece, seriesModel, idx);
    }).execute();
    pieLabelLayout(seriesModel);
    // Always use initial animation.
    if (seriesModel.get('animationTypeUpdate') !== 'expansion') {
      this._data = data;
    }
  };
  PieView.prototype.dispose = function () {};
  PieView.prototype.containPoint = function (point, seriesModel) {
    var data = seriesModel.getData();
    var itemLayout = data.getItemLayout(0);
    if (itemLayout) {
      var dx = point[0] - itemLayout.cx;
      var dy = point[1] - itemLayout.cy;
      var radius = Math.sqrt(dx * dx + dy * dy);
      return radius <= itemLayout.r && radius >= itemLayout.r0;
    }
  };
  PieView.type = 'pie';
  return PieView;
}(ChartView$1);
var PieView$1 = PieView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * [Usage]:
 * (1)
 * createListSimply(seriesModel, ['value']);
 * (2)
 * createListSimply(seriesModel, {
 *     coordDimensions: ['value'],
 *     dimensionsCount: 5
 * });
 */
function createSeriesDataSimply(seriesModel, opt, nameList) {
  opt = isArray$1(opt) && {
    coordDimensions: opt
  } || extend({
    encodeDefine: seriesModel.getEncode()
  }, opt);
  var source = seriesModel.getSource();
  var dimensions = prepareSeriesDataSchema(source, opt).dimensions;
  var list = new SeriesData$1(dimensions, seriesModel);
  list.initData(source, nameList);
  return list;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * LegendVisualProvider is an bridge that pick encoded color from data and
 * provide to the legend component.
 */
var LegendVisualProvider = /** @class */function () {
  function LegendVisualProvider(
  // Function to get data after filtered. It stores all the encoding info
  getDataWithEncodedVisual,
  // Function to get raw data before filtered.
  getRawData) {
    this._getDataWithEncodedVisual = getDataWithEncodedVisual;
    this._getRawData = getRawData;
  }
  LegendVisualProvider.prototype.getAllNames = function () {
    var rawData = this._getRawData();
    // We find the name from the raw data. In case it's filtered by the legend component.
    // Normally, the name can be found in rawData, but can't be found in filtered data will display as gray.
    return rawData.mapArray(rawData.getName);
  };
  LegendVisualProvider.prototype.containName = function (name) {
    var rawData = this._getRawData();
    return rawData.indexOfName(name) >= 0;
  };
  LegendVisualProvider.prototype.indexOfName = function (name) {
    // Only get data when necessary.
    // Because LegendVisualProvider constructor may be new in the stage that data is not prepared yet.
    // Invoking Series#getData immediately will throw an error.
    var dataWithEncodedVisual = this._getDataWithEncodedVisual();
    return dataWithEncodedVisual.indexOfName(name);
  };
  LegendVisualProvider.prototype.getItemVisual = function (dataIndex, key) {
    // Get encoded visual properties from final filtered data.
    var dataWithEncodedVisual = this._getDataWithEncodedVisual();
    return dataWithEncodedVisual.getItemVisual(dataIndex, key);
  };
  return LegendVisualProvider;
}();
var LegendVisualProvider$1 = LegendVisualProvider;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var innerData = makeInner();
var PieSeriesModel = /** @class */function (_super) {
  __extends(PieSeriesModel, _super);
  function PieSeriesModel() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  /**
   * @overwrite
   */
  PieSeriesModel.prototype.init = function (option) {
    _super.prototype.init.apply(this, arguments);
    // Enable legend selection for each data item
    // Use a function instead of direct access because data reference may changed
    this.legendVisualProvider = new LegendVisualProvider$1(bind$1(this.getData, this), bind$1(this.getRawData, this));
    this._defaultLabelLine(option);
  };
  /**
   * @overwrite
   */
  PieSeriesModel.prototype.mergeOption = function () {
    _super.prototype.mergeOption.apply(this, arguments);
  };
  /**
   * @overwrite
   */
  PieSeriesModel.prototype.getInitialData = function () {
    return createSeriesDataSimply(this, {
      coordDimensions: ['value'],
      encodeDefaulter: curry$1(makeSeriesEncodeForNameBased, this)
    });
  };
  /**
   * @overwrite
   */
  PieSeriesModel.prototype.getDataParams = function (dataIndex) {
    var data = this.getData();
    // update seats when data is changed
    var dataInner = innerData(data);
    var seats = dataInner.seats;
    if (!seats) {
      var valueList_1 = [];
      data.each(data.mapDimension('value'), function (value) {
        valueList_1.push(value);
      });
      seats = dataInner.seats = getPercentSeats(valueList_1, data.hostModel.get('percentPrecision'));
    }
    var params = _super.prototype.getDataParams.call(this, dataIndex);
    // seats may be empty when sum is 0
    params.percent = seats[dataIndex] || 0;
    params.$vars.push('percent');
    return params;
  };
  PieSeriesModel.prototype._defaultLabelLine = function (option) {
    // Extend labelLine emphasis
    defaultEmphasis(option, 'labelLine', ['show']);
    var labelLineNormalOpt = option.labelLine;
    var labelLineEmphasisOpt = option.emphasis.labelLine;
    // Not show label line if `label.normal.show = false`
    labelLineNormalOpt.show = labelLineNormalOpt.show && option.label.show;
    labelLineEmphasisOpt.show = labelLineEmphasisOpt.show && option.emphasis.label.show;
  };
  PieSeriesModel.type = 'series.pie';
  PieSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    legendHoverLink: true,
    colorBy: 'data',
    // 默认全局居中
    center: ['50%', '50%'],
    radius: [0, '75%'],
    // 默认顺时针
    clockwise: true,
    startAngle: 90,
    endAngle: 'auto',
    padAngle: 0,
    // 最小角度改为0
    minAngle: 0,
    // If the angle of a sector less than `minShowLabelAngle`,
    // the label will not be displayed.
    minShowLabelAngle: 0,
    // 选中时扇区偏移量
    selectedOffset: 10,
    // 选择模式，默认关闭，可选single，multiple
    // selectedMode: false,
    // 南丁格尔玫瑰图模式，'radius'（半径） | 'area'（面积）
    // roseType: null,
    percentPrecision: 2,
    // If still show when all data zero.
    stillShowZeroSum: true,
    // cursor: null,
    left: 0,
    top: 0,
    right: 0,
    bottom: 0,
    width: null,
    height: null,
    label: {
      // color: 'inherit',
      // If rotate around circle
      rotate: 0,
      show: true,
      overflow: 'truncate',
      // 'outer', 'inside', 'center'
      position: 'outer',
      // 'none', 'labelLine', 'edge'. Works only when position is 'outer'
      alignTo: 'none',
      // Closest distance between label and chart edge.
      // Works only position is 'outer' and alignTo is 'edge'.
      edgeDistance: '25%',
      // Works only position is 'outer' and alignTo is not 'edge'.
      bleedMargin: 10,
      // Distance between text and label line.
      distanceToLabelLine: 5
      // formatter: 标签文本格式器，同 tooltip.formatter，不支持异步回调
      // 默认使用全局文本样式，详见 textStyle
      // distance: 当position为inner时有效，为label位置到圆心的距离与圆半径(环状图为内外半径和)的比例系数
    },
    // Enabled when label.normal.position is 'outer'
    labelLine: {
      show: true,
      // 引导线两段中的第一段长度
      length: 15,
      // 引导线两段中的第二段长度
      length2: 15,
      smooth: false,
      minTurnAngle: 90,
      maxSurfaceAngle: 90,
      lineStyle: {
        // color: 各异,
        width: 1,
        type: 'solid'
      }
    },
    itemStyle: {
      borderWidth: 1,
      borderJoin: 'round'
    },
    showEmptyCircle: true,
    emptyCircleStyle: {
      color: 'lightgray',
      opacity: 1
    },
    labelLayout: {
      // Hide the overlapped label.
      hideOverlap: true
    },
    emphasis: {
      scale: true,
      scaleSize: 5
    },
    // If use strategy to avoid label overlapping
    avoidLabelOverlap: true,
    // Animation type. Valid values: expansion, scale
    animationType: 'expansion',
    animationDuration: 1000,
    // Animation type when update. Valid values: transition, expansion
    animationTypeUpdate: 'transition',
    animationEasingUpdate: 'cubicInOut',
    animationDurationUpdate: 500,
    animationEasing: 'cubicInOut'
  };
  return PieSeriesModel;
}(SeriesModel$1);
var PieSeriesModel$1 = PieSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function negativeDataFilter(seriesType) {
  return {
    seriesType: seriesType,
    reset: function (seriesModel, ecModel) {
      var data = seriesModel.getData();
      data.filterSelf(function (idx) {
        // handle negative value condition
        var valueDim = data.mapDimension('value');
        var curValue = data.get(valueDim, idx);
        if (isNumber(curValue) && !isNaN(curValue) && curValue < 0) {
          return false;
        }
        return true;
      });
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$Q(registers) {
  registers.registerChartView(PieView$1);
  registers.registerSeriesModel(PieSeriesModel$1);
  createLegacyDataSelectAction('pie', registers.registerAction);
  registers.registerLayout(curry$1(pieLayout, 'pie'));
  registers.registerProcessor(dataFilter$1('pie'));
  registers.registerProcessor(negativeDataFilter('pie'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ScatterSeriesModel = /** @class */function (_super) {
  __extends(ScatterSeriesModel, _super);
  function ScatterSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ScatterSeriesModel.type;
    _this.hasSymbolVisual = true;
    return _this;
  }
  ScatterSeriesModel.prototype.getInitialData = function (option, ecModel) {
    return createSeriesData(null, this, {
      useEncodeDefaulter: true
    });
  };
  ScatterSeriesModel.prototype.getProgressive = function () {
    var progressive = this.option.progressive;
    if (progressive == null) {
      // PENDING
      return this.option.large ? 5e3 : this.get('progressive');
    }
    return progressive;
  };
  ScatterSeriesModel.prototype.getProgressiveThreshold = function () {
    var progressiveThreshold = this.option.progressiveThreshold;
    if (progressiveThreshold == null) {
      // PENDING
      return this.option.large ? 1e4 : this.get('progressiveThreshold');
    }
    return progressiveThreshold;
  };
  ScatterSeriesModel.prototype.brushSelector = function (dataIndex, data, selectors) {
    return selectors.point(data.getItemLayout(dataIndex));
  };
  ScatterSeriesModel.prototype.getZLevelKey = function () {
    // Each progressive series has individual key.
    return this.getData().count() > this.getProgressiveThreshold() ? this.id : '';
  };
  ScatterSeriesModel.type = 'series.scatter';
  ScatterSeriesModel.dependencies = ['grid', 'polar', 'geo', 'singleAxis', 'calendar'];
  ScatterSeriesModel.defaultOption = {
    coordinateSystem: 'cartesian2d',
    // zlevel: 0,
    z: 2,
    legendHoverLink: true,
    symbolSize: 10,
    // symbolRotate: null,  // 图形旋转控制
    large: false,
    // Available when large is true
    largeThreshold: 2000,
    // cursor: null,
    itemStyle: {
      opacity: 0.8
      // color: 各异
    },
    emphasis: {
      scale: true
    },
    // If clip the overflow graphics
    // Works on cartesian / polar series
    clip: true,
    select: {
      itemStyle: {
        borderColor: '#212121'
      }
    },
    universalTransition: {
      divideShape: 'clone'
    }
    // progressive: null
  };
  return ScatterSeriesModel;
}(SeriesModel$1);
var ScatterSeriesModel$1 = ScatterSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var BOOST_SIZE_THRESHOLD = 4;
var LargeSymbolPathShape = /** @class */function () {
  function LargeSymbolPathShape() {}
  return LargeSymbolPathShape;
}();
var LargeSymbolPath = /** @class */function (_super) {
  __extends(LargeSymbolPath, _super);
  function LargeSymbolPath(opts) {
    var _this = _super.call(this, opts) || this;
    _this._off = 0;
    _this.hoverDataIdx = -1;
    return _this;
  }
  LargeSymbolPath.prototype.getDefaultShape = function () {
    return new LargeSymbolPathShape();
  };
  LargeSymbolPath.prototype.reset = function () {
    this.notClear = false;
    this._off = 0;
  };
  LargeSymbolPath.prototype.buildPath = function (path, shape) {
    var points = shape.points;
    var size = shape.size;
    var symbolProxy = this.symbolProxy;
    var symbolProxyShape = symbolProxy.shape;
    var ctx = path.getContext ? path.getContext() : path;
    var canBoost = ctx && size[0] < BOOST_SIZE_THRESHOLD;
    var softClipShape = this.softClipShape;
    var i;
    // Do draw in afterBrush.
    if (canBoost) {
      this._ctx = ctx;
      return;
    }
    this._ctx = null;
    for (i = this._off; i < points.length;) {
      var x = points[i++];
      var y = points[i++];
      if (isNaN(x) || isNaN(y)) {
        continue;
      }
      if (softClipShape && !softClipShape.contain(x, y)) {
        continue;
      }
      symbolProxyShape.x = x - size[0] / 2;
      symbolProxyShape.y = y - size[1] / 2;
      symbolProxyShape.width = size[0];
      symbolProxyShape.height = size[1];
      symbolProxy.buildPath(path, symbolProxyShape, true);
    }
    if (this.incremental) {
      this._off = i;
      this.notClear = true;
    }
  };
  LargeSymbolPath.prototype.afterBrush = function () {
    var shape = this.shape;
    var points = shape.points;
    var size = shape.size;
    var ctx = this._ctx;
    var softClipShape = this.softClipShape;
    var i;
    if (!ctx) {
      return;
    }
    // PENDING If style or other canvas status changed?
    for (i = this._off; i < points.length;) {
      var x = points[i++];
      var y = points[i++];
      if (isNaN(x) || isNaN(y)) {
        continue;
      }
      if (softClipShape && !softClipShape.contain(x, y)) {
        continue;
      }
      // fillRect is faster than building a rect path and draw.
      // And it support light globalCompositeOperation.
      ctx.fillRect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]);
    }
    if (this.incremental) {
      this._off = i;
      this.notClear = true;
    }
  };
  LargeSymbolPath.prototype.findDataIndex = function (x, y) {
    // TODO ???
    // Consider transform
    var shape = this.shape;
    var points = shape.points;
    var size = shape.size;
    var w = Math.max(size[0], 4);
    var h = Math.max(size[1], 4);
    // Not consider transform
    // Treat each element as a rect
    // top down traverse
    for (var idx = points.length / 2 - 1; idx >= 0; idx--) {
      var i = idx * 2;
      var x0 = points[i] - w / 2;
      var y0 = points[i + 1] - h / 2;
      if (x >= x0 && y >= y0 && x <= x0 + w && y <= y0 + h) {
        return idx;
      }
    }
    return -1;
  };
  LargeSymbolPath.prototype.contain = function (x, y) {
    var localPos = this.transformCoordToLocal(x, y);
    var rect = this.getBoundingRect();
    x = localPos[0];
    y = localPos[1];
    if (rect.contain(x, y)) {
      // Cache found data index.
      var dataIdx = this.hoverDataIdx = this.findDataIndex(x, y);
      return dataIdx >= 0;
    }
    this.hoverDataIdx = -1;
    return false;
  };
  LargeSymbolPath.prototype.getBoundingRect = function () {
    // Ignore stroke for large symbol draw.
    var rect = this._rect;
    if (!rect) {
      var shape = this.shape;
      var points = shape.points;
      var size = shape.size;
      var w = size[0];
      var h = size[1];
      var minX = Infinity;
      var minY = Infinity;
      var maxX = -Infinity;
      var maxY = -Infinity;
      for (var i = 0; i < points.length;) {
        var x = points[i++];
        var y = points[i++];
        minX = Math.min(x, minX);
        maxX = Math.max(x, maxX);
        minY = Math.min(y, minY);
        maxY = Math.max(y, maxY);
      }
      rect = this._rect = new BoundingRect$1(minX - w / 2, minY - h / 2, maxX - minX + w, maxY - minY + h);
    }
    return rect;
  };
  return LargeSymbolPath;
}(Path$1);
var LargeSymbolDraw = /** @class */function () {
  function LargeSymbolDraw() {
    this.group = new Group$5();
  }
  /**
   * Update symbols draw by new data
   */
  LargeSymbolDraw.prototype.updateData = function (data, opt) {
    this._clear();
    var symbolEl = this._create();
    symbolEl.setShape({
      points: data.getLayout('points')
    });
    this._setCommon(symbolEl, data, opt);
  };
  LargeSymbolDraw.prototype.updateLayout = function (data) {
    var points = data.getLayout('points');
    this.group.eachChild(function (child) {
      if (child.startIndex != null) {
        var len = (child.endIndex - child.startIndex) * 2;
        var byteOffset = child.startIndex * 4 * 2;
        points = new Float32Array(points.buffer, byteOffset, len);
      }
      child.setShape('points', points);
      // Reset draw cursor.
      child.reset();
    });
  };
  LargeSymbolDraw.prototype.incrementalPrepareUpdate = function (data) {
    this._clear();
  };
  LargeSymbolDraw.prototype.incrementalUpdate = function (taskParams, data, opt) {
    var lastAdded = this._newAdded[0];
    var points = data.getLayout('points');
    var oldPoints = lastAdded && lastAdded.shape.points;
    // Merging the exists. Each element has 1e4 points.
    // Consider the performance balance between too much elements and too much points in one shape(may affect hover optimization)
    if (oldPoints && oldPoints.length < 2e4) {
      var oldLen = oldPoints.length;
      var newPoints = new Float32Array(oldLen + points.length);
      // Concat two array
      newPoints.set(oldPoints);
      newPoints.set(points, oldLen);
      // Update endIndex
      lastAdded.endIndex = taskParams.end;
      lastAdded.setShape({
        points: newPoints
      });
    } else {
      // Clear
      this._newAdded = [];
      var symbolEl = this._create();
      symbolEl.startIndex = taskParams.start;
      symbolEl.endIndex = taskParams.end;
      symbolEl.incremental = true;
      symbolEl.setShape({
        points: points
      });
      this._setCommon(symbolEl, data, opt);
    }
  };
  LargeSymbolDraw.prototype.eachRendered = function (cb) {
    this._newAdded[0] && cb(this._newAdded[0]);
  };
  LargeSymbolDraw.prototype._create = function () {
    var symbolEl = new LargeSymbolPath({
      cursor: 'default'
    });
    symbolEl.ignoreCoarsePointer = true;
    this.group.add(symbolEl);
    this._newAdded.push(symbolEl);
    return symbolEl;
  };
  LargeSymbolDraw.prototype._setCommon = function (symbolEl, data, opt) {
    var hostModel = data.hostModel;
    opt = opt || {};
    var size = data.getVisual('symbolSize');
    symbolEl.setShape('size', size instanceof Array ? size : [size, size]);
    symbolEl.softClipShape = opt.clipShape || null;
    // Create symbolProxy to build path for each data
    symbolEl.symbolProxy = createSymbol$1(data.getVisual('symbol'), 0, 0, 0, 0);
    // Use symbolProxy setColor method
    symbolEl.setColor = symbolEl.symbolProxy.setColor;
    var extrudeShadow = symbolEl.shape.size[0] < BOOST_SIZE_THRESHOLD;
    symbolEl.useStyle(
    // Draw shadow when doing fillRect is extremely slow.
    hostModel.getModel('itemStyle').getItemStyle(extrudeShadow ? ['color', 'shadowBlur', 'shadowColor'] : ['color']));
    var globalStyle = data.getVisual('style');
    var visualColor = globalStyle && globalStyle.fill;
    if (visualColor) {
      symbolEl.setColor(visualColor);
    }
    var ecData = getECData(symbolEl);
    // Enable tooltip
    // PENDING May have performance issue when path is extremely large
    ecData.seriesIndex = hostModel.seriesIndex;
    symbolEl.on('mousemove', function (e) {
      ecData.dataIndex = null;
      var dataIndex = symbolEl.hoverDataIdx;
      if (dataIndex >= 0) {
        // Provide dataIndex for tooltip
        ecData.dataIndex = dataIndex + (symbolEl.startIndex || 0);
      }
    });
  };
  LargeSymbolDraw.prototype.remove = function () {
    this._clear();
  };
  LargeSymbolDraw.prototype._clear = function () {
    this._newAdded = [];
    this.group.removeAll();
  };
  return LargeSymbolDraw;
}();
var LargeSymbolDraw$1 = LargeSymbolDraw;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ScatterView = /** @class */function (_super) {
  __extends(ScatterView, _super);
  function ScatterView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ScatterView.type;
    return _this;
  }
  ScatterView.prototype.render = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var symbolDraw = this._updateSymbolDraw(data, seriesModel);
    symbolDraw.updateData(data, {
      // TODO
      // If this parameter should be a shape or a bounding volume
      // shape will be more general.
      // But bounding volume like bounding rect will be much faster in the contain calculation
      clipShape: this._getClipShape(seriesModel)
    });
    this._finished = true;
  };
  ScatterView.prototype.incrementalPrepareRender = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var symbolDraw = this._updateSymbolDraw(data, seriesModel);
    symbolDraw.incrementalPrepareUpdate(data);
    this._finished = false;
  };
  ScatterView.prototype.incrementalRender = function (taskParams, seriesModel, ecModel) {
    this._symbolDraw.incrementalUpdate(taskParams, seriesModel.getData(), {
      clipShape: this._getClipShape(seriesModel)
    });
    this._finished = taskParams.end === seriesModel.getData().count();
  };
  ScatterView.prototype.updateTransform = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    // Must mark group dirty and make sure the incremental layer will be cleared
    // PENDING
    this.group.dirty();
    if (!this._finished || data.count() > 1e4) {
      return {
        update: true
      };
    } else {
      var res = pointsLayout('').reset(seriesModel, ecModel, api);
      if (res.progress) {
        res.progress({
          start: 0,
          end: data.count(),
          count: data.count()
        }, data);
      }
      this._symbolDraw.updateLayout(data);
    }
  };
  ScatterView.prototype.eachRendered = function (cb) {
    this._symbolDraw && this._symbolDraw.eachRendered(cb);
  };
  ScatterView.prototype._getClipShape = function (seriesModel) {
    if (!seriesModel.get('clip', true)) {
      return;
    }
    var coordSys = seriesModel.coordinateSystem;
    // PENDING make `0.1` configurable, for example, `clipTolerance`?
    return coordSys && coordSys.getArea && coordSys.getArea(.1);
  };
  ScatterView.prototype._updateSymbolDraw = function (data, seriesModel) {
    var symbolDraw = this._symbolDraw;
    var pipelineContext = seriesModel.pipelineContext;
    var isLargeDraw = pipelineContext.large;
    if (!symbolDraw || isLargeDraw !== this._isLargeDraw) {
      symbolDraw && symbolDraw.remove();
      symbolDraw = this._symbolDraw = isLargeDraw ? new LargeSymbolDraw$1() : new SymbolDraw$1();
      this._isLargeDraw = isLargeDraw;
      this.group.removeAll();
    }
    this.group.add(symbolDraw.group);
    return symbolDraw;
  };
  ScatterView.prototype.remove = function (ecModel, api) {
    this._symbolDraw && this._symbolDraw.remove(true);
    this._symbolDraw = null;
  };
  ScatterView.prototype.dispose = function () {};
  ScatterView.type = 'scatter';
  return ScatterView;
}(ChartView$1);
var ScatterView$1 = ScatterView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var GridModel = /** @class */function (_super) {
  __extends(GridModel, _super);
  function GridModel() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  GridModel.type = 'grid';
  GridModel.dependencies = ['xAxis', 'yAxis'];
  GridModel.layoutMode = 'box';
  GridModel.defaultOption = {
    show: false,
    // zlevel: 0,
    z: 0,
    left: '10%',
    top: 60,
    right: '10%',
    bottom: 70,
    // If grid size contain label
    containLabel: false,
    // width: {totalWidth} - left - right,
    // height: {totalHeight} - top - bottom,
    backgroundColor: 'rgba(0,0,0,0)',
    borderWidth: 1,
    borderColor: '#ccc'
  };
  return GridModel;
}(ComponentModel$1);
var GridModel$1 = GridModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var CartesianAxisModel = /** @class */function (_super) {
  __extends(CartesianAxisModel, _super);
  function CartesianAxisModel() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  CartesianAxisModel.prototype.getCoordSysModel = function () {
    return this.getReferringComponents('grid', SINGLE_REFERRING).models[0];
  };
  CartesianAxisModel.type = 'cartesian2dAxis';
  return CartesianAxisModel;
}(ComponentModel$1);
mixin(CartesianAxisModel, AxisModelCommonMixin);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var defaultOption$1 = {
  show: true,
  // zlevel: 0,
  z: 0,
  // Inverse the axis.
  inverse: false,
  // Axis name displayed.
  name: '',
  // 'start' | 'middle' | 'end'
  nameLocation: 'end',
  // By degree. By default auto rotate by nameLocation.
  nameRotate: null,
  nameTruncate: {
    maxWidth: null,
    ellipsis: '...',
    placeholder: '.'
  },
  // Use global text style by default.
  nameTextStyle: {},
  // The gap between axisName and axisLine.
  nameGap: 15,
  // Default `false` to support tooltip.
  silent: false,
  // Default `false` to avoid legacy user event listener fail.
  triggerEvent: false,
  tooltip: {
    show: false
  },
  axisPointer: {},
  axisLine: {
    show: true,
    onZero: true,
    onZeroAxisIndex: null,
    lineStyle: {
      color: '#6E7079',
      width: 1,
      type: 'solid'
    },
    // The arrow at both ends the the axis.
    symbol: ['none', 'none'],
    symbolSize: [10, 15]
  },
  axisTick: {
    show: true,
    // Whether axisTick is inside the grid or outside the grid.
    inside: false,
    // The length of axisTick.
    length: 5,
    lineStyle: {
      width: 1
    }
  },
  axisLabel: {
    show: true,
    // Whether axisLabel is inside the grid or outside the grid.
    inside: false,
    rotate: 0,
    // true | false | null/undefined (auto)
    showMinLabel: null,
    // true | false | null/undefined (auto)
    showMaxLabel: null,
    margin: 8,
    // formatter: null,
    fontSize: 12
  },
  splitLine: {
    show: true,
    showMinLine: true,
    showMaxLine: true,
    lineStyle: {
      color: ['#E0E6F1'],
      width: 1,
      type: 'solid'
    }
  },
  splitArea: {
    show: false,
    areaStyle: {
      color: ['rgba(250,250,250,0.2)', 'rgba(210,219,238,0.2)']
    }
  }
};
var categoryAxis = merge({
  // The gap at both ends of the axis. For categoryAxis, boolean.
  boundaryGap: true,
  // Set false to faster category collection.
  deduplication: null,
  // splitArea: {
  // show: false
  // },
  splitLine: {
    show: false
  },
  axisTick: {
    // If tick is align with label when boundaryGap is true
    alignWithLabel: false,
    interval: 'auto'
  },
  axisLabel: {
    interval: 'auto'
  }
}, defaultOption$1);
var valueAxis = merge({
  boundaryGap: [0, 0],
  axisLine: {
    // Not shown when other axis is categoryAxis in cartesian
    show: 'auto'
  },
  axisTick: {
    // Not shown when other axis is categoryAxis in cartesian
    show: 'auto'
  },
  // TODO
  // min/max: [30, datamin, 60] or [20, datamin] or [datamin, 60]
  splitNumber: 5,
  minorTick: {
    // Minor tick, not available for cateogry axis.
    show: false,
    // Split number of minor ticks. The value should be in range of (0, 100)
    splitNumber: 5,
    // Length of minor tick
    length: 3,
    // Line style
    lineStyle: {
      // Default to be same with axisTick
    }
  },
  minorSplitLine: {
    show: false,
    lineStyle: {
      color: '#F4F7FD',
      width: 1
    }
  }
}, defaultOption$1);
var timeAxis = merge({
  splitNumber: 6,
  axisLabel: {
    // To eliminate labels that are not nice
    showMinLabel: false,
    showMaxLabel: false,
    rich: {
      primary: {
        fontWeight: 'bold'
      }
    }
  },
  splitLine: {
    show: false
  }
}, valueAxis);
var logAxis = defaults({
  logBase: 10
}, valueAxis);
var axisDefault = {
  category: categoryAxis,
  value: valueAxis,
  time: timeAxis,
  log: logAxis
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var AXIS_TYPES = {
  value: 1,
  category: 1,
  time: 1,
  log: 1
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Generate sub axis model class
 * @param axisName 'x' 'y' 'radius' 'angle' 'parallel' ...
 */
function axisModelCreator(registers, axisName, BaseAxisModelClass, extraDefaultOption) {
  each$f(AXIS_TYPES, function (v, axisType) {
    var defaultOption = merge(merge({}, axisDefault[axisType], true), extraDefaultOption, true);
    var AxisModel = /** @class */function (_super) {
      __extends(AxisModel, _super);
      function AxisModel() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.type = axisName + 'Axis.' + axisType;
        return _this;
      }
      AxisModel.prototype.mergeDefaultAndTheme = function (option, ecModel) {
        var layoutMode = fetchLayoutMode(this);
        var inputPositionParams = layoutMode ? getLayoutParams(option) : {};
        var themeModel = ecModel.getTheme();
        merge(option, themeModel.get(axisType + 'Axis'));
        merge(option, this.getDefaultOption());
        option.type = getAxisType(option);
        if (layoutMode) {
          mergeLayoutParam(option, inputPositionParams, layoutMode);
        }
      };
      AxisModel.prototype.optionUpdated = function () {
        var thisOption = this.option;
        if (thisOption.type === 'category') {
          this.__ordinalMeta = OrdinalMeta$1.createByAxisModel(this);
        }
      };
      /**
       * Should not be called before all of 'getInitailData' finished.
       * Because categories are collected during initializing data.
       */
      AxisModel.prototype.getCategories = function (rawData) {
        var option = this.option;
        // FIXME
        // warning if called before all of 'getInitailData' finished.
        if (option.type === 'category') {
          if (rawData) {
            return option.data;
          }
          return this.__ordinalMeta.categories;
        }
      };
      AxisModel.prototype.getOrdinalMeta = function () {
        return this.__ordinalMeta;
      };
      AxisModel.type = axisName + 'Axis.' + axisType;
      AxisModel.defaultOption = defaultOption;
      return AxisModel;
    }(BaseAxisModelClass);
    registers.registerComponentModel(AxisModel);
  });
  registers.registerSubTypeDefaulter(axisName + 'Axis', getAxisType);
}
function getAxisType(option) {
  // Default axis with data is category axis
  return option.type || (option.data ? 'category' : 'value');
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Cartesian = /** @class */function () {
  function Cartesian(name) {
    this.type = 'cartesian';
    this._dimList = [];
    this._axes = {};
    this.name = name || '';
  }
  Cartesian.prototype.getAxis = function (dim) {
    return this._axes[dim];
  };
  Cartesian.prototype.getAxes = function () {
    return map$1(this._dimList, function (dim) {
      return this._axes[dim];
    }, this);
  };
  Cartesian.prototype.getAxesByScale = function (scaleType) {
    scaleType = scaleType.toLowerCase();
    return filter(this.getAxes(), function (axis) {
      return axis.scale.type === scaleType;
    });
  };
  Cartesian.prototype.addAxis = function (axis) {
    var dim = axis.dim;
    this._axes[dim] = axis;
    this._dimList.push(dim);
  };
  return Cartesian;
}();
var Cartesian$1 = Cartesian;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var cartesian2DDimensions = ['x', 'y'];
function canCalculateAffineTransform(scale) {
  return scale.type === 'interval' || scale.type === 'time';
}
var Cartesian2D = /** @class */function (_super) {
  __extends(Cartesian2D, _super);
  function Cartesian2D() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = 'cartesian2d';
    _this.dimensions = cartesian2DDimensions;
    return _this;
  }
  /**
   * Calculate an affine transform matrix if two axes are time or value.
   * It's mainly for accelartion on the large time series data.
   */
  Cartesian2D.prototype.calcAffineTransform = function () {
    this._transform = this._invTransform = null;
    var xAxisScale = this.getAxis('x').scale;
    var yAxisScale = this.getAxis('y').scale;
    if (!canCalculateAffineTransform(xAxisScale) || !canCalculateAffineTransform(yAxisScale)) {
      return;
    }
    var xScaleExtent = xAxisScale.getExtent();
    var yScaleExtent = yAxisScale.getExtent();
    var start = this.dataToPoint([xScaleExtent[0], yScaleExtent[0]]);
    var end = this.dataToPoint([xScaleExtent[1], yScaleExtent[1]]);
    var xScaleSpan = xScaleExtent[1] - xScaleExtent[0];
    var yScaleSpan = yScaleExtent[1] - yScaleExtent[0];
    if (!xScaleSpan || !yScaleSpan) {
      return;
    }
    // Accelerate data to point calculation on the special large time series data.
    var scaleX = (end[0] - start[0]) / xScaleSpan;
    var scaleY = (end[1] - start[1]) / yScaleSpan;
    var translateX = start[0] - xScaleExtent[0] * scaleX;
    var translateY = start[1] - yScaleExtent[0] * scaleY;
    var m = this._transform = [scaleX, 0, 0, scaleY, translateX, translateY];
    this._invTransform = invert([], m);
  };
  /**
   * Base axis will be used on stacking.
   */
  Cartesian2D.prototype.getBaseAxis = function () {
    return this.getAxesByScale('ordinal')[0] || this.getAxesByScale('time')[0] || this.getAxis('x');
  };
  Cartesian2D.prototype.containPoint = function (point) {
    var axisX = this.getAxis('x');
    var axisY = this.getAxis('y');
    return axisX.contain(axisX.toLocalCoord(point[0])) && axisY.contain(axisY.toLocalCoord(point[1]));
  };
  Cartesian2D.prototype.containData = function (data) {
    return this.getAxis('x').containData(data[0]) && this.getAxis('y').containData(data[1]);
  };
  Cartesian2D.prototype.containZone = function (data1, data2) {
    var zoneDiag1 = this.dataToPoint(data1);
    var zoneDiag2 = this.dataToPoint(data2);
    var area = this.getArea();
    var zone = new BoundingRect$1(zoneDiag1[0], zoneDiag1[1], zoneDiag2[0] - zoneDiag1[0], zoneDiag2[1] - zoneDiag1[1]);
    return area.intersect(zone);
  };
  Cartesian2D.prototype.dataToPoint = function (data, clamp, out) {
    out = out || [];
    var xVal = data[0];
    var yVal = data[1];
    // Fast path
    if (this._transform
    // It's supported that if data is like `[Inifity, 123]`, where only Y pixel calculated.
    && xVal != null && isFinite(xVal) && yVal != null && isFinite(yVal)) {
      return applyTransform$1(out, data, this._transform);
    }
    var xAxis = this.getAxis('x');
    var yAxis = this.getAxis('y');
    out[0] = xAxis.toGlobalCoord(xAxis.dataToCoord(xVal, clamp));
    out[1] = yAxis.toGlobalCoord(yAxis.dataToCoord(yVal, clamp));
    return out;
  };
  Cartesian2D.prototype.clampData = function (data, out) {
    var xScale = this.getAxis('x').scale;
    var yScale = this.getAxis('y').scale;
    var xAxisExtent = xScale.getExtent();
    var yAxisExtent = yScale.getExtent();
    var x = xScale.parse(data[0]);
    var y = yScale.parse(data[1]);
    out = out || [];
    out[0] = Math.min(Math.max(Math.min(xAxisExtent[0], xAxisExtent[1]), x), Math.max(xAxisExtent[0], xAxisExtent[1]));
    out[1] = Math.min(Math.max(Math.min(yAxisExtent[0], yAxisExtent[1]), y), Math.max(yAxisExtent[0], yAxisExtent[1]));
    return out;
  };
  Cartesian2D.prototype.pointToData = function (point, clamp) {
    var out = [];
    if (this._invTransform) {
      return applyTransform$1(out, point, this._invTransform);
    }
    var xAxis = this.getAxis('x');
    var yAxis = this.getAxis('y');
    out[0] = xAxis.coordToData(xAxis.toLocalCoord(point[0]), clamp);
    out[1] = yAxis.coordToData(yAxis.toLocalCoord(point[1]), clamp);
    return out;
  };
  Cartesian2D.prototype.getOtherAxis = function (axis) {
    return this.getAxis(axis.dim === 'x' ? 'y' : 'x');
  };
  /**
   * Get rect area of cartesian.
   * Area will have a contain function to determine if a point is in the coordinate system.
   */
  Cartesian2D.prototype.getArea = function (tolerance) {
    tolerance = tolerance || 0;
    var xExtent = this.getAxis('x').getGlobalExtent();
    var yExtent = this.getAxis('y').getGlobalExtent();
    var x = Math.min(xExtent[0], xExtent[1]) - tolerance;
    var y = Math.min(yExtent[0], yExtent[1]) - tolerance;
    var width = Math.max(xExtent[0], xExtent[1]) - x + tolerance;
    var height = Math.max(yExtent[0], yExtent[1]) - y + tolerance;
    return new BoundingRect$1(x, y, width, height);
  };
  return Cartesian2D;
}(Cartesian$1);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Axis2D = /** @class */function (_super) {
  __extends(Axis2D, _super);
  function Axis2D(dim, scale, coordExtent, axisType, position) {
    var _this = _super.call(this, dim, scale, coordExtent) || this;
    /**
     * Index of axis, can be used as key
     * Injected outside.
     */
    _this.index = 0;
    _this.type = axisType || 'value';
    _this.position = position || 'bottom';
    return _this;
  }
  Axis2D.prototype.isHorizontal = function () {
    var position = this.position;
    return position === 'top' || position === 'bottom';
  };
  /**
   * Each item cooresponds to this.getExtent(), which
   * means globalExtent[0] may greater than globalExtent[1],
   * unless `asc` is input.
   *
   * @param {boolean} [asc]
   * @return {Array.<number>}
   */
  Axis2D.prototype.getGlobalExtent = function (asc) {
    var ret = this.getExtent();
    ret[0] = this.toGlobalCoord(ret[0]);
    ret[1] = this.toGlobalCoord(ret[1]);
    asc && ret[0] > ret[1] && ret.reverse();
    return ret;
  };
  Axis2D.prototype.pointToData = function (point, clamp) {
    return this.coordToData(this.toLocalCoord(point[this.dim === 'x' ? 0 : 1]), clamp);
  };
  /**
   * Set ordinalSortInfo
   * @param info new OrdinalSortInfo
   */
  Axis2D.prototype.setCategorySortInfo = function (info) {
    if (this.type !== 'category') {
      return false;
    }
    this.model.option.categorySortInfo = info;
    this.scale.setSortInfo(info);
  };
  return Axis2D;
}(Axis$1);
var Axis2D$1 = Axis2D;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Can only be called after coordinate system creation stage.
 * (Can be called before coordinate system update stage).
 */
function layout$2(gridModel, axisModel, opt) {
  opt = opt || {};
  var grid = gridModel.coordinateSystem;
  var axis = axisModel.axis;
  var layout = {};
  var otherAxisOnZeroOf = axis.getAxesOnZeroOf()[0];
  var rawAxisPosition = axis.position;
  var axisPosition = otherAxisOnZeroOf ? 'onZero' : rawAxisPosition;
  var axisDim = axis.dim;
  var rect = grid.getRect();
  var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height];
  var idx = {
    left: 0,
    right: 1,
    top: 0,
    bottom: 1,
    onZero: 2
  };
  var axisOffset = axisModel.get('offset') || 0;
  var posBound = axisDim === 'x' ? [rectBound[2] - axisOffset, rectBound[3] + axisOffset] : [rectBound[0] - axisOffset, rectBound[1] + axisOffset];
  if (otherAxisOnZeroOf) {
    var onZeroCoord = otherAxisOnZeroOf.toGlobalCoord(otherAxisOnZeroOf.dataToCoord(0));
    posBound[idx.onZero] = Math.max(Math.min(onZeroCoord, posBound[1]), posBound[0]);
  }
  // Axis position
  layout.position = [axisDim === 'y' ? posBound[idx[axisPosition]] : rectBound[0], axisDim === 'x' ? posBound[idx[axisPosition]] : rectBound[3]];
  // Axis rotation
  layout.rotation = Math.PI / 2 * (axisDim === 'x' ? 0 : 1);
  // Tick and label direction, x y is axisDim
  var dirMap = {
    top: -1,
    bottom: 1,
    left: -1,
    right: 1
  };
  layout.labelDirection = layout.tickDirection = layout.nameDirection = dirMap[rawAxisPosition];
  layout.labelOffset = otherAxisOnZeroOf ? posBound[idx[rawAxisPosition]] - posBound[idx.onZero] : 0;
  if (axisModel.get(['axisTick', 'inside'])) {
    layout.tickDirection = -layout.tickDirection;
  }
  if (retrieve(opt.labelInside, axisModel.get(['axisLabel', 'inside']))) {
    layout.labelDirection = -layout.labelDirection;
  }
  // Special label rotation
  var labelRotate = axisModel.get(['axisLabel', 'rotate']);
  layout.labelRotate = axisPosition === 'top' ? -labelRotate : labelRotate;
  // Over splitLine and splitArea
  layout.z2 = 1;
  return layout;
}
function isCartesian2DSeries(seriesModel) {
  return seriesModel.get('coordinateSystem') === 'cartesian2d';
}
function findAxisModels(seriesModel) {
  var axisModelMap = {
    xAxisModel: null,
    yAxisModel: null
  };
  each$f(axisModelMap, function (v, key) {
    var axisType = key.replace(/Model$/, '');
    var axisModel = seriesModel.getReferringComponents(axisType, SINGLE_REFERRING).models[0];
    {
      if (!axisModel) {
        throw new Error(axisType + ' "' + retrieve3(seriesModel.get(axisType + 'Index'), seriesModel.get(axisType + 'Id'), 0) + '" not found');
      }
    }
    axisModelMap[key] = axisModel;
  });
  return axisModelMap;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var mathLog = Math.log;
function alignScaleTicks(scale, axisModel, alignToScale) {
  var intervalScaleProto = IntervalScale$1.prototype;
  // NOTE: There is a precondition for log scale  here:
  // In log scale we store _interval and _extent of exponent value.
  // So if we use the method of InternalScale to set/get these data.
  // It process the exponent value, which is linear and what we want here.
  var alignToTicks = intervalScaleProto.getTicks.call(alignToScale);
  var alignToNicedTicks = intervalScaleProto.getTicks.call(alignToScale, true);
  var alignToSplitNumber = alignToTicks.length - 1;
  var alignToInterval = intervalScaleProto.getInterval.call(alignToScale);
  var scaleExtent = getScaleExtent(scale, axisModel);
  var rawExtent = scaleExtent.extent;
  var isMinFixed = scaleExtent.fixMin;
  var isMaxFixed = scaleExtent.fixMax;
  if (scale.type === 'log') {
    var logBase = mathLog(scale.base);
    rawExtent = [mathLog(rawExtent[0]) / logBase, mathLog(rawExtent[1]) / logBase];
  }
  scale.setExtent(rawExtent[0], rawExtent[1]);
  scale.calcNiceExtent({
    splitNumber: alignToSplitNumber,
    fixMin: isMinFixed,
    fixMax: isMaxFixed
  });
  var extent = intervalScaleProto.getExtent.call(scale);
  // Need to update the rawExtent.
  // Because value in rawExtent may be not parsed. e.g. 'dataMin', 'dataMax'
  if (isMinFixed) {
    rawExtent[0] = extent[0];
  }
  if (isMaxFixed) {
    rawExtent[1] = extent[1];
  }
  var interval = intervalScaleProto.getInterval.call(scale);
  var min = rawExtent[0];
  var max = rawExtent[1];
  if (isMinFixed && isMaxFixed) {
    // User set min, max, divide to get new interval
    interval = (max - min) / alignToSplitNumber;
  } else if (isMinFixed) {
    max = rawExtent[0] + interval * alignToSplitNumber;
    // User set min, expand extent on the other side
    while (max < rawExtent[1] && isFinite(max) && isFinite(rawExtent[1])) {
      interval = increaseInterval(interval);
      max = rawExtent[0] + interval * alignToSplitNumber;
    }
  } else if (isMaxFixed) {
    // User set max, expand extent on the other side
    min = rawExtent[1] - interval * alignToSplitNumber;
    while (min > rawExtent[0] && isFinite(min) && isFinite(rawExtent[0])) {
      interval = increaseInterval(interval);
      min = rawExtent[1] - interval * alignToSplitNumber;
    }
  } else {
    var nicedSplitNumber = scale.getTicks().length - 1;
    if (nicedSplitNumber > alignToSplitNumber) {
      interval = increaseInterval(interval);
    }
    var range = interval * alignToSplitNumber;
    max = Math.ceil(rawExtent[1] / interval) * interval;
    min = round$4(max - range);
    // Not change the result that crossing zero.
    if (min < 0 && rawExtent[0] >= 0) {
      min = 0;
      max = round$4(range);
    } else if (max > 0 && rawExtent[1] <= 0) {
      max = 0;
      min = -round$4(range);
    }
  }
  // Adjust min, max based on the extent of alignTo. When min or max is set in alignTo scale
  var t0 = (alignToTicks[0].value - alignToNicedTicks[0].value) / alignToInterval;
  var t1 = (alignToTicks[alignToSplitNumber].value - alignToNicedTicks[alignToSplitNumber].value) / alignToInterval;
  // NOTE: Must in setExtent -> setInterval -> setNiceExtent order.
  intervalScaleProto.setExtent.call(scale, min + interval * t0, max + interval * t1);
  intervalScaleProto.setInterval.call(scale, interval);
  if (t0 || t1) {
    intervalScaleProto.setNiceExtent.call(scale, min + interval, max - interval);
  }
  {
    var ticks = intervalScaleProto.getTicks.call(scale);
    if (ticks[1] && (!isValueNice(interval) || getPrecisionSafe(ticks[1].value) > getPrecisionSafe(interval))) {
      warn(
      // eslint-disable-next-line
      "The ticks may be not readable when set min: " + axisModel.get('min') + ", max: " + axisModel.get('max') + " and alignTicks: true");
    }
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Grid = /** @class */function () {
  function Grid(gridModel, ecModel, api) {
    // FIXME:TS where used (different from registered type 'cartesian2d')?
    this.type = 'grid';
    this._coordsMap = {};
    this._coordsList = [];
    this._axesMap = {};
    this._axesList = [];
    this.axisPointerEnabled = true;
    this.dimensions = cartesian2DDimensions;
    this._initCartesian(gridModel, ecModel, api);
    this.model = gridModel;
  }
  Grid.prototype.getRect = function () {
    return this._rect;
  };
  Grid.prototype.update = function (ecModel, api) {
    var axesMap = this._axesMap;
    this._updateScale(ecModel, this.model);
    function updateAxisTicks(axes) {
      var alignTo;
      // Axis is added in order of axisIndex.
      var axesIndices = keys(axes);
      var len = axesIndices.length;
      if (!len) {
        return;
      }
      var axisNeedsAlign = [];
      // Process once and calculate the ticks for those don't use alignTicks.
      for (var i = len - 1; i >= 0; i--) {
        var idx = +axesIndices[i]; // Convert to number.
        var axis = axes[idx];
        var model = axis.model;
        var scale = axis.scale;
        if (
        // Only value and log axis without interval support alignTicks.
        isIntervalOrLogScale(scale) && model.get('alignTicks') && model.get('interval') == null) {
          axisNeedsAlign.push(axis);
        } else {
          niceScaleExtent(scale, model);
          if (isIntervalOrLogScale(scale)) {
            // Can only align to interval or log axis.
            alignTo = axis;
          }
        }
      }
      // All axes has set alignTicks. Pick the first one.
      // PENDING. Should we find the axis that both set interval, min, max and align to this one?
      if (axisNeedsAlign.length) {
        if (!alignTo) {
          alignTo = axisNeedsAlign.pop();
          niceScaleExtent(alignTo.scale, alignTo.model);
        }
        each$f(axisNeedsAlign, function (axis) {
          alignScaleTicks(axis.scale, axis.model, alignTo.scale);
        });
      }
    }
    updateAxisTicks(axesMap.x);
    updateAxisTicks(axesMap.y);
    // Key: axisDim_axisIndex, value: boolean, whether onZero target.
    var onZeroRecords = {};
    each$f(axesMap.x, function (xAxis) {
      fixAxisOnZero(axesMap, 'y', xAxis, onZeroRecords);
    });
    each$f(axesMap.y, function (yAxis) {
      fixAxisOnZero(axesMap, 'x', yAxis, onZeroRecords);
    });
    // Resize again if containLabel is enabled
    // FIXME It may cause getting wrong grid size in data processing stage
    this.resize(this.model, api);
  };
  /**
   * Resize the grid
   */
  Grid.prototype.resize = function (gridModel, api, ignoreContainLabel) {
    var boxLayoutParams = gridModel.getBoxLayoutParams();
    var isContainLabel = !ignoreContainLabel && gridModel.get('containLabel');
    var gridRect = getLayoutRect(boxLayoutParams, {
      width: api.getWidth(),
      height: api.getHeight()
    });
    this._rect = gridRect;
    var axesList = this._axesList;
    adjustAxes();
    // Minus label size
    if (isContainLabel) {
      each$f(axesList, function (axis) {
        if (!axis.model.get(['axisLabel', 'inside'])) {
          var labelUnionRect = estimateLabelUnionRect(axis);
          if (labelUnionRect) {
            var dim = axis.isHorizontal() ? 'height' : 'width';
            var margin = axis.model.get(['axisLabel', 'margin']);
            gridRect[dim] -= labelUnionRect[dim] + margin;
            if (axis.position === 'top') {
              gridRect.y += labelUnionRect.height + margin;
            } else if (axis.position === 'left') {
              gridRect.x += labelUnionRect.width + margin;
            }
          }
        }
      });
      adjustAxes();
    }
    each$f(this._coordsList, function (coord) {
      // Calculate affine matrix to accelerate the data to point transform.
      // If all the axes scales are time or value.
      coord.calcAffineTransform();
    });
    function adjustAxes() {
      each$f(axesList, function (axis) {
        var isHorizontal = axis.isHorizontal();
        var extent = isHorizontal ? [0, gridRect.width] : [0, gridRect.height];
        var idx = axis.inverse ? 1 : 0;
        axis.setExtent(extent[idx], extent[1 - idx]);
        updateAxisTransform(axis, isHorizontal ? gridRect.x : gridRect.y);
      });
    }
  };
  Grid.prototype.getAxis = function (dim, axisIndex) {
    var axesMapOnDim = this._axesMap[dim];
    if (axesMapOnDim != null) {
      return axesMapOnDim[axisIndex || 0];
    }
  };
  Grid.prototype.getAxes = function () {
    return this._axesList.slice();
  };
  Grid.prototype.getCartesian = function (xAxisIndex, yAxisIndex) {
    if (xAxisIndex != null && yAxisIndex != null) {
      var key = 'x' + xAxisIndex + 'y' + yAxisIndex;
      return this._coordsMap[key];
    }
    if (isObject$3(xAxisIndex)) {
      yAxisIndex = xAxisIndex.yAxisIndex;
      xAxisIndex = xAxisIndex.xAxisIndex;
    }
    for (var i = 0, coordList = this._coordsList; i < coordList.length; i++) {
      if (coordList[i].getAxis('x').index === xAxisIndex || coordList[i].getAxis('y').index === yAxisIndex) {
        return coordList[i];
      }
    }
  };
  Grid.prototype.getCartesians = function () {
    return this._coordsList.slice();
  };
  /**
   * @implements
   */
  Grid.prototype.convertToPixel = function (ecModel, finder, value) {
    var target = this._findConvertTarget(finder);
    return target.cartesian ? target.cartesian.dataToPoint(value) : target.axis ? target.axis.toGlobalCoord(target.axis.dataToCoord(value)) : null;
  };
  /**
   * @implements
   */
  Grid.prototype.convertFromPixel = function (ecModel, finder, value) {
    var target = this._findConvertTarget(finder);
    return target.cartesian ? target.cartesian.pointToData(value) : target.axis ? target.axis.coordToData(target.axis.toLocalCoord(value)) : null;
  };
  Grid.prototype._findConvertTarget = function (finder) {
    var seriesModel = finder.seriesModel;
    var xAxisModel = finder.xAxisModel || seriesModel && seriesModel.getReferringComponents('xAxis', SINGLE_REFERRING).models[0];
    var yAxisModel = finder.yAxisModel || seriesModel && seriesModel.getReferringComponents('yAxis', SINGLE_REFERRING).models[0];
    var gridModel = finder.gridModel;
    var coordsList = this._coordsList;
    var cartesian;
    var axis;
    if (seriesModel) {
      cartesian = seriesModel.coordinateSystem;
      indexOf(coordsList, cartesian) < 0 && (cartesian = null);
    } else if (xAxisModel && yAxisModel) {
      cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);
    } else if (xAxisModel) {
      axis = this.getAxis('x', xAxisModel.componentIndex);
    } else if (yAxisModel) {
      axis = this.getAxis('y', yAxisModel.componentIndex);
    }
    // Lowest priority.
    else if (gridModel) {
      var grid = gridModel.coordinateSystem;
      if (grid === this) {
        cartesian = this._coordsList[0];
      }
    }
    return {
      cartesian: cartesian,
      axis: axis
    };
  };
  /**
   * @implements
   */
  Grid.prototype.containPoint = function (point) {
    var coord = this._coordsList[0];
    if (coord) {
      return coord.containPoint(point);
    }
  };
  /**
   * Initialize cartesian coordinate systems
   */
  Grid.prototype._initCartesian = function (gridModel, ecModel, api) {
    var _this = this;
    var grid = this;
    var axisPositionUsed = {
      left: false,
      right: false,
      top: false,
      bottom: false
    };
    var axesMap = {
      x: {},
      y: {}
    };
    var axesCount = {
      x: 0,
      y: 0
    };
    // Create axis
    ecModel.eachComponent('xAxis', createAxisCreator('x'), this);
    ecModel.eachComponent('yAxis', createAxisCreator('y'), this);
    if (!axesCount.x || !axesCount.y) {
      // Roll back when there no either x or y axis
      this._axesMap = {};
      this._axesList = [];
      return;
    }
    this._axesMap = axesMap;
    // Create cartesian2d
    each$f(axesMap.x, function (xAxis, xAxisIndex) {
      each$f(axesMap.y, function (yAxis, yAxisIndex) {
        var key = 'x' + xAxisIndex + 'y' + yAxisIndex;
        var cartesian = new Cartesian2D(key);
        cartesian.master = _this;
        cartesian.model = gridModel;
        _this._coordsMap[key] = cartesian;
        _this._coordsList.push(cartesian);
        cartesian.addAxis(xAxis);
        cartesian.addAxis(yAxis);
      });
    });
    function createAxisCreator(dimName) {
      return function (axisModel, idx) {
        if (!isAxisUsedInTheGrid(axisModel, gridModel)) {
          return;
        }
        var axisPosition = axisModel.get('position');
        if (dimName === 'x') {
          // Fix position
          if (axisPosition !== 'top' && axisPosition !== 'bottom') {
            // Default bottom of X
            axisPosition = axisPositionUsed.bottom ? 'top' : 'bottom';
          }
        } else {
          // Fix position
          if (axisPosition !== 'left' && axisPosition !== 'right') {
            // Default left of Y
            axisPosition = axisPositionUsed.left ? 'right' : 'left';
          }
        }
        axisPositionUsed[axisPosition] = true;
        var axis = new Axis2D$1(dimName, createScaleByModel$1(axisModel), [0, 0], axisModel.get('type'), axisPosition);
        var isCategory = axis.type === 'category';
        axis.onBand = isCategory && axisModel.get('boundaryGap');
        axis.inverse = axisModel.get('inverse');
        // Inject axis into axisModel
        axisModel.axis = axis;
        // Inject axisModel into axis
        axis.model = axisModel;
        // Inject grid info axis
        axis.grid = grid;
        // Index of axis, can be used as key
        axis.index = idx;
        grid._axesList.push(axis);
        axesMap[dimName][idx] = axis;
        axesCount[dimName]++;
      };
    }
  };
  /**
   * Update cartesian properties from series.
   */
  Grid.prototype._updateScale = function (ecModel, gridModel) {
    // Reset scale
    each$f(this._axesList, function (axis) {
      axis.scale.setExtent(Infinity, -Infinity);
      if (axis.type === 'category') {
        var categorySortInfo = axis.model.get('categorySortInfo');
        axis.scale.setSortInfo(categorySortInfo);
      }
    });
    ecModel.eachSeries(function (seriesModel) {
      if (isCartesian2DSeries(seriesModel)) {
        var axesModelMap = findAxisModels(seriesModel);
        var xAxisModel = axesModelMap.xAxisModel;
        var yAxisModel = axesModelMap.yAxisModel;
        if (!isAxisUsedInTheGrid(xAxisModel, gridModel) || !isAxisUsedInTheGrid(yAxisModel, gridModel)) {
          return;
        }
        var cartesian = this.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);
        var data = seriesModel.getData();
        var xAxis = cartesian.getAxis('x');
        var yAxis = cartesian.getAxis('y');
        unionExtent(data, xAxis);
        unionExtent(data, yAxis);
      }
    }, this);
    function unionExtent(data, axis) {
      each$f(getDataDimensionsOnAxis(data, axis.dim), function (dim) {
        axis.scale.unionExtentFromData(data, dim);
      });
    }
  };
  /**
   * @param dim 'x' or 'y' or 'auto' or null/undefined
   */
  Grid.prototype.getTooltipAxes = function (dim) {
    var baseAxes = [];
    var otherAxes = [];
    each$f(this.getCartesians(), function (cartesian) {
      var baseAxis = dim != null && dim !== 'auto' ? cartesian.getAxis(dim) : cartesian.getBaseAxis();
      var otherAxis = cartesian.getOtherAxis(baseAxis);
      indexOf(baseAxes, baseAxis) < 0 && baseAxes.push(baseAxis);
      indexOf(otherAxes, otherAxis) < 0 && otherAxes.push(otherAxis);
    });
    return {
      baseAxes: baseAxes,
      otherAxes: otherAxes
    };
  };
  Grid.create = function (ecModel, api) {
    var grids = [];
    ecModel.eachComponent('grid', function (gridModel, idx) {
      var grid = new Grid(gridModel, ecModel, api);
      grid.name = 'grid_' + idx;
      // dataSampling requires axis extent, so resize
      // should be performed in create stage.
      grid.resize(gridModel, api, true);
      gridModel.coordinateSystem = grid;
      grids.push(grid);
    });
    // Inject the coordinateSystems into seriesModel
    ecModel.eachSeries(function (seriesModel) {
      if (!isCartesian2DSeries(seriesModel)) {
        return;
      }
      var axesModelMap = findAxisModels(seriesModel);
      var xAxisModel = axesModelMap.xAxisModel;
      var yAxisModel = axesModelMap.yAxisModel;
      var gridModel = xAxisModel.getCoordSysModel();
      {
        if (!gridModel) {
          throw new Error('Grid "' + retrieve3(xAxisModel.get('gridIndex'), xAxisModel.get('gridId'), 0) + '" not found');
        }
        if (xAxisModel.getCoordSysModel() !== yAxisModel.getCoordSysModel()) {
          throw new Error('xAxis and yAxis must use the same grid');
        }
      }
      var grid = gridModel.coordinateSystem;
      seriesModel.coordinateSystem = grid.getCartesian(xAxisModel.componentIndex, yAxisModel.componentIndex);
    });
    return grids;
  };
  // For deciding which dimensions to use when creating list data
  Grid.dimensions = cartesian2DDimensions;
  return Grid;
}();
/**
 * Check if the axis is used in the specified grid.
 */
function isAxisUsedInTheGrid(axisModel, gridModel) {
  return axisModel.getCoordSysModel() === gridModel;
}
function fixAxisOnZero(axesMap, otherAxisDim, axis,
// Key: see `getOnZeroRecordKey`
onZeroRecords) {
  axis.getAxesOnZeroOf = function () {
    // TODO: onZero of multiple axes.
    return otherAxisOnZeroOf ? [otherAxisOnZeroOf] : [];
  };
  // onZero can not be enabled in these two situations:
  // 1. When any other axis is a category axis.
  // 2. When no axis is cross 0 point.
  var otherAxes = axesMap[otherAxisDim];
  var otherAxisOnZeroOf;
  var axisModel = axis.model;
  var onZero = axisModel.get(['axisLine', 'onZero']);
  var onZeroAxisIndex = axisModel.get(['axisLine', 'onZeroAxisIndex']);
  if (!onZero) {
    return;
  }
  // If target axis is specified.
  if (onZeroAxisIndex != null) {
    if (canOnZeroToAxis(otherAxes[onZeroAxisIndex])) {
      otherAxisOnZeroOf = otherAxes[onZeroAxisIndex];
    }
  } else {
    // Find the first available other axis.
    for (var idx in otherAxes) {
      if (otherAxes.hasOwnProperty(idx) && canOnZeroToAxis(otherAxes[idx])
      // Consider that two Y axes on one value axis,
      // if both onZero, the two Y axes overlap.
      && !onZeroRecords[getOnZeroRecordKey(otherAxes[idx])]) {
        otherAxisOnZeroOf = otherAxes[idx];
        break;
      }
    }
  }
  if (otherAxisOnZeroOf) {
    onZeroRecords[getOnZeroRecordKey(otherAxisOnZeroOf)] = true;
  }
  function getOnZeroRecordKey(axis) {
    return axis.dim + '_' + axis.index;
  }
}
function canOnZeroToAxis(axis) {
  return axis && axis.type !== 'category' && axis.type !== 'time' && ifAxisCrossZero(axis);
}
function updateAxisTransform(axis, coordBase) {
  var axisExtent = axis.getExtent();
  var axisExtentSum = axisExtent[0] + axisExtent[1];
  // Fast transform
  axis.toGlobalCoord = axis.dim === 'x' ? function (coord) {
    return coord + coordBase;
  } : function (coord) {
    return axisExtentSum - coord + coordBase;
  };
  axis.toLocalCoord = axis.dim === 'x' ? function (coord) {
    return coord - coordBase;
  } : function (coord) {
    return axisExtentSum - coord + coordBase;
  };
}
var Grid$1 = Grid;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PI$4 = Math.PI;
/**
 * A final axis is translated and rotated from a "standard axis".
 * So opt.position and opt.rotation is required.
 *
 * A standard axis is and axis from [0, 0] to [0, axisExtent[1]],
 * for example: (0, 0) ------------> (0, 50)
 *
 * nameDirection or tickDirection or labelDirection is 1 means tick
 * or label is below the standard axis, whereas is -1 means above
 * the standard axis. labelOffset means offset between label and axis,
 * which is useful when 'onZero', where axisLabel is in the grid and
 * label in outside grid.
 *
 * Tips: like always,
 * positive rotation represents anticlockwise, and negative rotation
 * represents clockwise.
 * The direction of position coordinate is the same as the direction
 * of screen coordinate.
 *
 * Do not need to consider axis 'inverse', which is auto processed by
 * axis extent.
 */
var AxisBuilder = /** @class */function () {
  function AxisBuilder(axisModel, opt) {
    this.group = new Group$5();
    this.opt = opt;
    this.axisModel = axisModel;
    // Default value
    defaults(opt, {
      labelOffset: 0,
      nameDirection: 1,
      tickDirection: 1,
      labelDirection: 1,
      silent: true,
      handleAutoShown: function () {
        return true;
      }
    });
    // FIXME Not use a separate text group?
    var transformGroup = new Group$5({
      x: opt.position[0],
      y: opt.position[1],
      rotation: opt.rotation
    });
    // this.group.add(transformGroup);
    // this._transformGroup = transformGroup;
    transformGroup.updateTransform();
    this._transformGroup = transformGroup;
  }
  AxisBuilder.prototype.hasBuilder = function (name) {
    return !!builders[name];
  };
  AxisBuilder.prototype.add = function (name) {
    builders[name](this.opt, this.axisModel, this.group, this._transformGroup);
  };
  AxisBuilder.prototype.getGroup = function () {
    return this.group;
  };
  AxisBuilder.innerTextLayout = function (axisRotation, textRotation, direction) {
    var rotationDiff = remRadian(textRotation - axisRotation);
    var textAlign;
    var textVerticalAlign;
    if (isRadianAroundZero(rotationDiff)) {
      // Label is parallel with axis line.
      textVerticalAlign = direction > 0 ? 'top' : 'bottom';
      textAlign = 'center';
    } else if (isRadianAroundZero(rotationDiff - PI$4)) {
      // Label is inverse parallel with axis line.
      textVerticalAlign = direction > 0 ? 'bottom' : 'top';
      textAlign = 'center';
    } else {
      textVerticalAlign = 'middle';
      if (rotationDiff > 0 && rotationDiff < PI$4) {
        textAlign = direction > 0 ? 'right' : 'left';
      } else {
        textAlign = direction > 0 ? 'left' : 'right';
      }
    }
    return {
      rotation: rotationDiff,
      textAlign: textAlign,
      textVerticalAlign: textVerticalAlign
    };
  };
  AxisBuilder.makeAxisEventDataBase = function (axisModel) {
    var eventData = {
      componentType: axisModel.mainType,
      componentIndex: axisModel.componentIndex
    };
    eventData[axisModel.mainType + 'Index'] = axisModel.componentIndex;
    return eventData;
  };
  AxisBuilder.isLabelSilent = function (axisModel) {
    var tooltipOpt = axisModel.get('tooltip');
    return axisModel.get('silent')
    // Consider mouse cursor, add these restrictions.
    || !(axisModel.get('triggerEvent') || tooltipOpt && tooltipOpt.show);
  };
  return AxisBuilder;
}();
var builders = {
  axisLine: function (opt, axisModel, group, transformGroup) {
    var shown = axisModel.get(['axisLine', 'show']);
    if (shown === 'auto' && opt.handleAutoShown) {
      shown = opt.handleAutoShown('axisLine');
    }
    if (!shown) {
      return;
    }
    var extent = axisModel.axis.getExtent();
    var matrix = transformGroup.transform;
    var pt1 = [extent[0], 0];
    var pt2 = [extent[1], 0];
    var inverse = pt1[0] > pt2[0];
    if (matrix) {
      applyTransform$1(pt1, pt1, matrix);
      applyTransform$1(pt2, pt2, matrix);
    }
    var lineStyle = extend({
      lineCap: 'round'
    }, axisModel.getModel(['axisLine', 'lineStyle']).getLineStyle());
    var line = new Line$4({
      shape: {
        x1: pt1[0],
        y1: pt1[1],
        x2: pt2[0],
        y2: pt2[1]
      },
      style: lineStyle,
      strokeContainThreshold: opt.strokeContainThreshold || 5,
      silent: true,
      z2: 1
    });
    subPixelOptimizeLine(line.shape, line.style.lineWidth);
    line.anid = 'line';
    group.add(line);
    var arrows = axisModel.get(['axisLine', 'symbol']);
    if (arrows != null) {
      var arrowSize = axisModel.get(['axisLine', 'symbolSize']);
      if (isString(arrows)) {
        // Use the same arrow for start and end point
        arrows = [arrows, arrows];
      }
      if (isString(arrowSize) || isNumber(arrowSize)) {
        // Use the same size for width and height
        arrowSize = [arrowSize, arrowSize];
      }
      var arrowOffset = normalizeSymbolOffset(axisModel.get(['axisLine', 'symbolOffset']) || 0, arrowSize);
      var symbolWidth_1 = arrowSize[0];
      var symbolHeight_1 = arrowSize[1];
      each$f([{
        rotate: opt.rotation + Math.PI / 2,
        offset: arrowOffset[0],
        r: 0
      }, {
        rotate: opt.rotation - Math.PI / 2,
        offset: arrowOffset[1],
        r: Math.sqrt((pt1[0] - pt2[0]) * (pt1[0] - pt2[0]) + (pt1[1] - pt2[1]) * (pt1[1] - pt2[1]))
      }], function (point, index) {
        if (arrows[index] !== 'none' && arrows[index] != null) {
          var symbol = createSymbol$1(arrows[index], -symbolWidth_1 / 2, -symbolHeight_1 / 2, symbolWidth_1, symbolHeight_1, lineStyle.stroke, true);
          // Calculate arrow position with offset
          var r = point.r + point.offset;
          var pt = inverse ? pt2 : pt1;
          symbol.attr({
            rotation: point.rotate,
            x: pt[0] + r * Math.cos(opt.rotation),
            y: pt[1] - r * Math.sin(opt.rotation),
            silent: true,
            z2: 11
          });
          group.add(symbol);
        }
      });
    }
  },
  axisTickLabel: function (opt, axisModel, group, transformGroup) {
    var ticksEls = buildAxisMajorTicks(group, transformGroup, axisModel, opt);
    var labelEls = buildAxisLabel(group, transformGroup, axisModel, opt);
    fixMinMaxLabelShow(axisModel, labelEls, ticksEls);
    buildAxisMinorTicks(group, transformGroup, axisModel, opt.tickDirection);
    // This bit fixes the label overlap issue for the time chart.
    // See https://github.com/apache/echarts/issues/14266 for more.
    if (axisModel.get(['axisLabel', 'hideOverlap'])) {
      var labelList = prepareLayoutList(map$1(labelEls, function (label) {
        return {
          label: label,
          priority: label.z2,
          defaultAttr: {
            ignore: label.ignore
          }
        };
      }));
      hideOverlap(labelList);
    }
  },
  axisName: function (opt, axisModel, group, transformGroup) {
    var name = retrieve(opt.axisName, axisModel.get('name'));
    if (!name) {
      return;
    }
    var nameLocation = axisModel.get('nameLocation');
    var nameDirection = opt.nameDirection;
    var textStyleModel = axisModel.getModel('nameTextStyle');
    var gap = axisModel.get('nameGap') || 0;
    var extent = axisModel.axis.getExtent();
    var gapSignal = extent[0] > extent[1] ? -1 : 1;
    var pos = [nameLocation === 'start' ? extent[0] - gapSignal * gap : nameLocation === 'end' ? extent[1] + gapSignal * gap : (extent[0] + extent[1]) / 2,
    // Reuse labelOffset.
    isNameLocationCenter(nameLocation) ? opt.labelOffset + nameDirection * gap : 0];
    var labelLayout;
    var nameRotation = axisModel.get('nameRotate');
    if (nameRotation != null) {
      nameRotation = nameRotation * PI$4 / 180; // To radian.
    }
    var axisNameAvailableWidth;
    if (isNameLocationCenter(nameLocation)) {
      labelLayout = AxisBuilder.innerTextLayout(opt.rotation, nameRotation != null ? nameRotation : opt.rotation,
      // Adapt to axis.
      nameDirection);
    } else {
      labelLayout = endTextLayout(opt.rotation, nameLocation, nameRotation || 0, extent);
      axisNameAvailableWidth = opt.axisNameAvailableWidth;
      if (axisNameAvailableWidth != null) {
        axisNameAvailableWidth = Math.abs(axisNameAvailableWidth / Math.sin(labelLayout.rotation));
        !isFinite(axisNameAvailableWidth) && (axisNameAvailableWidth = null);
      }
    }
    var textFont = textStyleModel.getFont();
    var truncateOpt = axisModel.get('nameTruncate', true) || {};
    var ellipsis = truncateOpt.ellipsis;
    var maxWidth = retrieve(opt.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth);
    var textEl = new ZRText$1({
      x: pos[0],
      y: pos[1],
      rotation: labelLayout.rotation,
      silent: AxisBuilder.isLabelSilent(axisModel),
      style: createTextStyle(textStyleModel, {
        text: name,
        font: textFont,
        overflow: 'truncate',
        width: maxWidth,
        ellipsis: ellipsis,
        fill: textStyleModel.getTextColor() || axisModel.get(['axisLine', 'lineStyle', 'color']),
        align: textStyleModel.get('align') || labelLayout.textAlign,
        verticalAlign: textStyleModel.get('verticalAlign') || labelLayout.textVerticalAlign
      }),
      z2: 1
    });
    setTooltipConfig({
      el: textEl,
      componentModel: axisModel,
      itemName: name
    });
    textEl.__fullText = name;
    // Id for animation
    textEl.anid = 'name';
    if (axisModel.get('triggerEvent')) {
      var eventData = AxisBuilder.makeAxisEventDataBase(axisModel);
      eventData.targetType = 'axisName';
      eventData.name = name;
      getECData(textEl).eventData = eventData;
    }
    // FIXME
    transformGroup.add(textEl);
    textEl.updateTransform();
    group.add(textEl);
    textEl.decomposeTransform();
  }
};
function endTextLayout(rotation, textPosition, textRotate, extent) {
  var rotationDiff = remRadian(textRotate - rotation);
  var textAlign;
  var textVerticalAlign;
  var inverse = extent[0] > extent[1];
  var onLeft = textPosition === 'start' && !inverse || textPosition !== 'start' && inverse;
  if (isRadianAroundZero(rotationDiff - PI$4 / 2)) {
    textVerticalAlign = onLeft ? 'bottom' : 'top';
    textAlign = 'center';
  } else if (isRadianAroundZero(rotationDiff - PI$4 * 1.5)) {
    textVerticalAlign = onLeft ? 'top' : 'bottom';
    textAlign = 'center';
  } else {
    textVerticalAlign = 'middle';
    if (rotationDiff < PI$4 * 1.5 && rotationDiff > PI$4 / 2) {
      textAlign = onLeft ? 'left' : 'right';
    } else {
      textAlign = onLeft ? 'right' : 'left';
    }
  }
  return {
    rotation: rotationDiff,
    textAlign: textAlign,
    textVerticalAlign: textVerticalAlign
  };
}
function fixMinMaxLabelShow(axisModel, labelEls, tickEls) {
  if (shouldShowAllLabels(axisModel.axis)) {
    return;
  }
  // If min or max are user set, we need to check
  // If the tick on min(max) are overlap on their neighbour tick
  // If they are overlapped, we need to hide the min(max) tick label
  var showMinLabel = axisModel.get(['axisLabel', 'showMinLabel']);
  var showMaxLabel = axisModel.get(['axisLabel', 'showMaxLabel']);
  // FIXME
  // Have not consider onBand yet, where tick els is more than label els.
  labelEls = labelEls || [];
  tickEls = tickEls || [];
  var firstLabel = labelEls[0];
  var nextLabel = labelEls[1];
  var lastLabel = labelEls[labelEls.length - 1];
  var prevLabel = labelEls[labelEls.length - 2];
  var firstTick = tickEls[0];
  var nextTick = tickEls[1];
  var lastTick = tickEls[tickEls.length - 1];
  var prevTick = tickEls[tickEls.length - 2];
  if (showMinLabel === false) {
    ignoreEl(firstLabel);
    ignoreEl(firstTick);
  } else if (isTwoLabelOverlapped(firstLabel, nextLabel)) {
    if (showMinLabel) {
      ignoreEl(nextLabel);
      ignoreEl(nextTick);
    } else {
      ignoreEl(firstLabel);
      ignoreEl(firstTick);
    }
  }
  if (showMaxLabel === false) {
    ignoreEl(lastLabel);
    ignoreEl(lastTick);
  } else if (isTwoLabelOverlapped(prevLabel, lastLabel)) {
    if (showMaxLabel) {
      ignoreEl(prevLabel);
      ignoreEl(prevTick);
    } else {
      ignoreEl(lastLabel);
      ignoreEl(lastTick);
    }
  }
}
function ignoreEl(el) {
  el && (el.ignore = true);
}
function isTwoLabelOverlapped(current, next) {
  // current and next has the same rotation.
  var firstRect = current && current.getBoundingRect().clone();
  var nextRect = next && next.getBoundingRect().clone();
  if (!firstRect || !nextRect) {
    return;
  }
  // When checking intersect of two rotated labels, we use mRotationBack
  // to avoid that boundingRect is enlarge when using `boundingRect.applyTransform`.
  var mRotationBack = identity([]);
  rotate(mRotationBack, mRotationBack, -current.rotation);
  firstRect.applyTransform(mul$1([], mRotationBack, current.getLocalTransform()));
  nextRect.applyTransform(mul$1([], mRotationBack, next.getLocalTransform()));
  return firstRect.intersect(nextRect);
}
function isNameLocationCenter(nameLocation) {
  return nameLocation === 'middle' || nameLocation === 'center';
}
function createTicks(ticksCoords, tickTransform, tickEndCoord, tickLineStyle, anidPrefix) {
  var tickEls = [];
  var pt1 = [];
  var pt2 = [];
  for (var i = 0; i < ticksCoords.length; i++) {
    var tickCoord = ticksCoords[i].coord;
    pt1[0] = tickCoord;
    pt1[1] = 0;
    pt2[0] = tickCoord;
    pt2[1] = tickEndCoord;
    if (tickTransform) {
      applyTransform$1(pt1, pt1, tickTransform);
      applyTransform$1(pt2, pt2, tickTransform);
    }
    // Tick line, Not use group transform to have better line draw
    var tickEl = new Line$4({
      shape: {
        x1: pt1[0],
        y1: pt1[1],
        x2: pt2[0],
        y2: pt2[1]
      },
      style: tickLineStyle,
      z2: 2,
      autoBatch: true,
      silent: true
    });
    subPixelOptimizeLine(tickEl.shape, tickEl.style.lineWidth);
    tickEl.anid = anidPrefix + '_' + ticksCoords[i].tickValue;
    tickEls.push(tickEl);
  }
  return tickEls;
}
function buildAxisMajorTicks(group, transformGroup, axisModel, opt) {
  var axis = axisModel.axis;
  var tickModel = axisModel.getModel('axisTick');
  var shown = tickModel.get('show');
  if (shown === 'auto' && opt.handleAutoShown) {
    shown = opt.handleAutoShown('axisTick');
  }
  if (!shown || axis.scale.isBlank()) {
    return;
  }
  var lineStyleModel = tickModel.getModel('lineStyle');
  var tickEndCoord = opt.tickDirection * tickModel.get('length');
  var ticksCoords = axis.getTicksCoords();
  var ticksEls = createTicks(ticksCoords, transformGroup.transform, tickEndCoord, defaults(lineStyleModel.getLineStyle(), {
    stroke: axisModel.get(['axisLine', 'lineStyle', 'color'])
  }), 'ticks');
  for (var i = 0; i < ticksEls.length; i++) {
    group.add(ticksEls[i]);
  }
  return ticksEls;
}
function buildAxisMinorTicks(group, transformGroup, axisModel, tickDirection) {
  var axis = axisModel.axis;
  var minorTickModel = axisModel.getModel('minorTick');
  if (!minorTickModel.get('show') || axis.scale.isBlank()) {
    return;
  }
  var minorTicksCoords = axis.getMinorTicksCoords();
  if (!minorTicksCoords.length) {
    return;
  }
  var lineStyleModel = minorTickModel.getModel('lineStyle');
  var tickEndCoord = tickDirection * minorTickModel.get('length');
  var minorTickLineStyle = defaults(lineStyleModel.getLineStyle(), defaults(axisModel.getModel('axisTick').getLineStyle(), {
    stroke: axisModel.get(['axisLine', 'lineStyle', 'color'])
  }));
  for (var i = 0; i < minorTicksCoords.length; i++) {
    var minorTicksEls = createTicks(minorTicksCoords[i], transformGroup.transform, tickEndCoord, minorTickLineStyle, 'minorticks_' + i);
    for (var k = 0; k < minorTicksEls.length; k++) {
      group.add(minorTicksEls[k]);
    }
  }
}
function buildAxisLabel(group, transformGroup, axisModel, opt) {
  var axis = axisModel.axis;
  var show = retrieve(opt.axisLabelShow, axisModel.get(['axisLabel', 'show']));
  if (!show || axis.scale.isBlank()) {
    return;
  }
  var labelModel = axisModel.getModel('axisLabel');
  var labelMargin = labelModel.get('margin');
  var labels = axis.getViewLabels();
  // Special label rotate.
  var labelRotation = (retrieve(opt.labelRotate, labelModel.get('rotate')) || 0) * PI$4 / 180;
  var labelLayout = AxisBuilder.innerTextLayout(opt.rotation, labelRotation, opt.labelDirection);
  var rawCategoryData = axisModel.getCategories && axisModel.getCategories(true);
  var labelEls = [];
  var silent = AxisBuilder.isLabelSilent(axisModel);
  var triggerEvent = axisModel.get('triggerEvent');
  each$f(labels, function (labelItem, index) {
    var tickValue = axis.scale.type === 'ordinal' ? axis.scale.getRawOrdinalNumber(labelItem.tickValue) : labelItem.tickValue;
    var formattedLabel = labelItem.formattedLabel;
    var rawLabel = labelItem.rawLabel;
    var itemLabelModel = labelModel;
    if (rawCategoryData && rawCategoryData[tickValue]) {
      var rawCategoryItem = rawCategoryData[tickValue];
      if (isObject$3(rawCategoryItem) && rawCategoryItem.textStyle) {
        itemLabelModel = new Model$1(rawCategoryItem.textStyle, labelModel, axisModel.ecModel);
      }
    }
    var textColor = itemLabelModel.getTextColor() || axisModel.get(['axisLine', 'lineStyle', 'color']);
    var tickCoord = axis.dataToCoord(tickValue);
    var align = itemLabelModel.getShallow('align', true) || labelLayout.textAlign;
    var alignMin = retrieve2(itemLabelModel.getShallow('alignMinLabel', true), align);
    var alignMax = retrieve2(itemLabelModel.getShallow('alignMaxLabel', true), align);
    var verticalAlign = itemLabelModel.getShallow('verticalAlign', true) || itemLabelModel.getShallow('baseline', true) || labelLayout.textVerticalAlign;
    var verticalAlignMin = retrieve2(itemLabelModel.getShallow('verticalAlignMinLabel', true), verticalAlign);
    var verticalAlignMax = retrieve2(itemLabelModel.getShallow('verticalAlignMaxLabel', true), verticalAlign);
    var textEl = new ZRText$1({
      x: tickCoord,
      y: opt.labelOffset + opt.labelDirection * labelMargin,
      rotation: labelLayout.rotation,
      silent: silent,
      z2: 10 + (labelItem.level || 0),
      style: createTextStyle(itemLabelModel, {
        text: formattedLabel,
        align: index === 0 ? alignMin : index === labels.length - 1 ? alignMax : align,
        verticalAlign: index === 0 ? verticalAlignMin : index === labels.length - 1 ? verticalAlignMax : verticalAlign,
        fill: isFunction(textColor) ? textColor(
        // (1) In category axis with data zoom, tick is not the original
        // index of axis.data. So tick should not be exposed to user
        // in category axis.
        // (2) Compatible with previous version, which always use formatted label as
        // input. But in interval scale the formatted label is like '223,445', which
        // maked user replace ','. So we modify it to return original val but remain
        // it as 'string' to avoid error in replacing.
        axis.type === 'category' ? rawLabel : axis.type === 'value' ? tickValue + '' : tickValue, index) : textColor
      })
    });
    textEl.anid = 'label_' + tickValue;
    setTooltipConfig({
      el: textEl,
      componentModel: axisModel,
      itemName: formattedLabel,
      formatterParamsExtra: {
        isTruncated: function () {
          return textEl.isTruncated;
        },
        value: rawLabel,
        tickIndex: index
      }
    });
    // Pack data for mouse event
    if (triggerEvent) {
      var eventData = AxisBuilder.makeAxisEventDataBase(axisModel);
      eventData.targetType = 'axisLabel';
      eventData.value = rawLabel;
      eventData.tickIndex = index;
      if (axis.type === 'category') {
        eventData.dataIndex = tickValue;
      }
      getECData(textEl).eventData = eventData;
    }
    // FIXME
    transformGroup.add(textEl);
    textEl.updateTransform();
    labelEls.push(textEl);
    group.add(textEl);
    textEl.decomposeTransform();
  });
  return labelEls;
}
var AxisBuilder$1 = AxisBuilder;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Build axisPointerModel, mergin tooltip.axisPointer model for each axis.
// allAxesInfo should be updated when setOption performed.
function collect(ecModel, api) {
  var result = {
    /**
     * key: makeKey(axis.model)
     * value: {
     *      axis,
     *      coordSys,
     *      axisPointerModel,
     *      triggerTooltip,
     *      triggerEmphasis,
     *      involveSeries,
     *      snap,
     *      seriesModels,
     *      seriesDataCount
     * }
     */
    axesInfo: {},
    seriesInvolved: false,
    /**
     * key: makeKey(coordSys.model)
     * value: Object: key makeKey(axis.model), value: axisInfo
     */
    coordSysAxesInfo: {},
    coordSysMap: {}
  };
  collectAxesInfo(result, ecModel, api);
  // Check seriesInvolved for performance, in case too many series in some chart.
  result.seriesInvolved && collectSeriesInfo(result, ecModel);
  return result;
}
function collectAxesInfo(result, ecModel, api) {
  var globalTooltipModel = ecModel.getComponent('tooltip');
  var globalAxisPointerModel = ecModel.getComponent('axisPointer');
  // links can only be set on global.
  var linksOption = globalAxisPointerModel.get('link', true) || [];
  var linkGroups = [];
  // Collect axes info.
  each$f(api.getCoordinateSystems(), function (coordSys) {
    // Some coordinate system do not support axes, like geo.
    if (!coordSys.axisPointerEnabled) {
      return;
    }
    var coordSysKey = makeKey(coordSys.model);
    var axesInfoInCoordSys = result.coordSysAxesInfo[coordSysKey] = {};
    result.coordSysMap[coordSysKey] = coordSys;
    // Set tooltip (like 'cross') is a convenient way to show axisPointer
    // for user. So we enable setting tooltip on coordSys model.
    var coordSysModel = coordSys.model;
    var baseTooltipModel = coordSysModel.getModel('tooltip', globalTooltipModel);
    each$f(coordSys.getAxes(), curry$1(saveTooltipAxisInfo, false, null));
    // If axis tooltip used, choose tooltip axis for each coordSys.
    // Notice this case: coordSys is `grid` but not `cartesian2D` here.
    if (coordSys.getTooltipAxes && globalTooltipModel
    // If tooltip.showContent is set as false, tooltip will not
    // show but axisPointer will show as normal.
    && baseTooltipModel.get('show')) {
      // Compatible with previous logic. But series.tooltip.trigger: 'axis'
      // or series.data[n].tooltip.trigger: 'axis' are not support any more.
      var triggerAxis = baseTooltipModel.get('trigger') === 'axis';
      var cross = baseTooltipModel.get(['axisPointer', 'type']) === 'cross';
      var tooltipAxes = coordSys.getTooltipAxes(baseTooltipModel.get(['axisPointer', 'axis']));
      if (triggerAxis || cross) {
        each$f(tooltipAxes.baseAxes, curry$1(saveTooltipAxisInfo, cross ? 'cross' : true, triggerAxis));
      }
      if (cross) {
        each$f(tooltipAxes.otherAxes, curry$1(saveTooltipAxisInfo, 'cross', false));
      }
    }
    // fromTooltip: true | false | 'cross'
    // triggerTooltip: true | false | null
    function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) {
      var axisPointerModel = axis.model.getModel('axisPointer', globalAxisPointerModel);
      var axisPointerShow = axisPointerModel.get('show');
      if (!axisPointerShow || axisPointerShow === 'auto' && !fromTooltip && !isHandleTrigger(axisPointerModel)) {
        return;
      }
      if (triggerTooltip == null) {
        triggerTooltip = axisPointerModel.get('triggerTooltip');
      }
      axisPointerModel = fromTooltip ? makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) : axisPointerModel;
      var snap = axisPointerModel.get('snap');
      var triggerEmphasis = axisPointerModel.get('triggerEmphasis');
      var axisKey = makeKey(axis.model);
      var involveSeries = triggerTooltip || snap || axis.type === 'category';
      // If result.axesInfo[key] exist, override it (tooltip has higher priority).
      var axisInfo = result.axesInfo[axisKey] = {
        key: axisKey,
        axis: axis,
        coordSys: coordSys,
        axisPointerModel: axisPointerModel,
        triggerTooltip: triggerTooltip,
        triggerEmphasis: triggerEmphasis,
        involveSeries: involveSeries,
        snap: snap,
        useHandle: isHandleTrigger(axisPointerModel),
        seriesModels: [],
        linkGroup: null
      };
      axesInfoInCoordSys[axisKey] = axisInfo;
      result.seriesInvolved = result.seriesInvolved || involveSeries;
      var groupIndex = getLinkGroupIndex(linksOption, axis);
      if (groupIndex != null) {
        var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = {
          axesInfo: {}
        });
        linkGroup.axesInfo[axisKey] = axisInfo;
        linkGroup.mapper = linksOption[groupIndex].mapper;
        axisInfo.linkGroup = linkGroup;
      }
    }
  });
}
function makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) {
  var tooltipAxisPointerModel = baseTooltipModel.getModel('axisPointer');
  var fields = ['type', 'snap', 'lineStyle', 'shadowStyle', 'label', 'animation', 'animationDurationUpdate', 'animationEasingUpdate', 'z'];
  var volatileOption = {};
  each$f(fields, function (field) {
    volatileOption[field] = clone$4(tooltipAxisPointerModel.get(field));
  });
  // category axis do not auto snap, otherwise some tick that do not
  // has value can not be hovered. value/time/log axis default snap if
  // triggered from tooltip and trigger tooltip.
  volatileOption.snap = axis.type !== 'category' && !!triggerTooltip;
  // Compatible with previous behavior, tooltip axis does not show label by default.
  // Only these properties can be overridden from tooltip to axisPointer.
  if (tooltipAxisPointerModel.get('type') === 'cross') {
    volatileOption.type = 'line';
  }
  var labelOption = volatileOption.label || (volatileOption.label = {});
  // Follow the convention, do not show label when triggered by tooltip by default.
  labelOption.show == null && (labelOption.show = false);
  if (fromTooltip === 'cross') {
    // When 'cross', both axes show labels.
    var tooltipAxisPointerLabelShow = tooltipAxisPointerModel.get(['label', 'show']);
    labelOption.show = tooltipAxisPointerLabelShow != null ? tooltipAxisPointerLabelShow : true;
    // If triggerTooltip, this is a base axis, which should better not use cross style
    // (cross style is dashed by default)
    if (!triggerTooltip) {
      var crossStyle = volatileOption.lineStyle = tooltipAxisPointerModel.get('crossStyle');
      crossStyle && defaults(labelOption, crossStyle.textStyle);
    }
  }
  return axis.model.getModel('axisPointer', new Model$1(volatileOption, globalAxisPointerModel, ecModel));
}
function collectSeriesInfo(result, ecModel) {
  // Prepare data for axis trigger
  ecModel.eachSeries(function (seriesModel) {
    // Notice this case: this coordSys is `cartesian2D` but not `grid`.
    var coordSys = seriesModel.coordinateSystem;
    var seriesTooltipTrigger = seriesModel.get(['tooltip', 'trigger'], true);
    var seriesTooltipShow = seriesModel.get(['tooltip', 'show'], true);
    if (!coordSys || seriesTooltipTrigger === 'none' || seriesTooltipTrigger === false || seriesTooltipTrigger === 'item' || seriesTooltipShow === false || seriesModel.get(['axisPointer', 'show'], true) === false) {
      return;
    }
    each$f(result.coordSysAxesInfo[makeKey(coordSys.model)], function (axisInfo) {
      var axis = axisInfo.axis;
      if (coordSys.getAxis(axis.dim) === axis) {
        axisInfo.seriesModels.push(seriesModel);
        axisInfo.seriesDataCount == null && (axisInfo.seriesDataCount = 0);
        axisInfo.seriesDataCount += seriesModel.getData().count();
      }
    });
  });
}
/**
 * For example:
 * {
 *     axisPointer: {
 *         links: [{
 *             xAxisIndex: [2, 4],
 *             yAxisIndex: 'all'
 *         }, {
 *             xAxisId: ['a5', 'a7'],
 *             xAxisName: 'xxx'
 *         }]
 *     }
 * }
 */
function getLinkGroupIndex(linksOption, axis) {
  var axisModel = axis.model;
  var dim = axis.dim;
  for (var i = 0; i < linksOption.length; i++) {
    var linkOption = linksOption[i] || {};
    if (checkPropInLink(linkOption[dim + 'AxisId'], axisModel.id) || checkPropInLink(linkOption[dim + 'AxisIndex'], axisModel.componentIndex) || checkPropInLink(linkOption[dim + 'AxisName'], axisModel.name)) {
      return i;
    }
  }
}
function checkPropInLink(linkPropValue, axisPropValue) {
  return linkPropValue === 'all' || isArray$1(linkPropValue) && indexOf(linkPropValue, axisPropValue) >= 0 || linkPropValue === axisPropValue;
}
function fixValue(axisModel) {
  var axisInfo = getAxisInfo$1(axisModel);
  if (!axisInfo) {
    return;
  }
  var axisPointerModel = axisInfo.axisPointerModel;
  var scale = axisInfo.axis.scale;
  var option = axisPointerModel.option;
  var status = axisPointerModel.get('status');
  var value = axisPointerModel.get('value');
  // Parse init value for category and time axis.
  if (value != null) {
    value = scale.parse(value);
  }
  var useHandle = isHandleTrigger(axisPointerModel);
  // If `handle` used, `axisPointer` will always be displayed, so value
  // and status should be initialized.
  if (status == null) {
    option.status = useHandle ? 'show' : 'hide';
  }
  var extent = scale.getExtent().slice();
  extent[0] > extent[1] && extent.reverse();
  if (
  // Pick a value on axis when initializing.
  value == null
  // If both `handle` and `dataZoom` are used, value may be out of axis extent,
  // where we should re-pick a value to keep `handle` displaying normally.
  || value > extent[1]) {
    // Make handle displayed on the end of the axis when init, which looks better.
    value = extent[1];
  }
  if (value < extent[0]) {
    value = extent[0];
  }
  option.value = value;
  if (useHandle) {
    option.status = axisInfo.axis.scale.isBlank() ? 'hide' : 'show';
  }
}
function getAxisInfo$1(axisModel) {
  var coordSysAxesInfo = (axisModel.ecModel.getComponent('axisPointer') || {}).coordSysAxesInfo;
  return coordSysAxesInfo && coordSysAxesInfo.axesInfo[makeKey(axisModel)];
}
function getAxisPointerModel(axisModel) {
  var axisInfo = getAxisInfo$1(axisModel);
  return axisInfo && axisInfo.axisPointerModel;
}
function isHandleTrigger(axisPointerModel) {
  return !!axisPointerModel.get(['handle', 'show']);
}
/**
 * @param {module:echarts/model/Model} model
 * @return {string} unique key
 */
function makeKey(model) {
  return model.type + '||' + model.id;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var axisPointerClazz = {};
/**
 * Base class of AxisView.
 */
var AxisView = /** @class */function (_super) {
  __extends(AxisView, _super);
  function AxisView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = AxisView.type;
    return _this;
  }
  /**
   * @override
   */
  AxisView.prototype.render = function (axisModel, ecModel, api, payload) {
    // FIXME
    // This process should proformed after coordinate systems updated
    // (axis scale updated), and should be performed each time update.
    // So put it here temporarily, although it is not appropriate to
    // put a model-writing procedure in `view`.
    this.axisPointerClass && fixValue(axisModel);
    _super.prototype.render.apply(this, arguments);
    this._doUpdateAxisPointerClass(axisModel, api, true);
  };
  /**
   * Action handler.
   */
  AxisView.prototype.updateAxisPointer = function (axisModel, ecModel, api, payload) {
    this._doUpdateAxisPointerClass(axisModel, api, false);
  };
  /**
   * @override
   */
  AxisView.prototype.remove = function (ecModel, api) {
    var axisPointer = this._axisPointer;
    axisPointer && axisPointer.remove(api);
  };
  /**
   * @override
   */
  AxisView.prototype.dispose = function (ecModel, api) {
    this._disposeAxisPointer(api);
    _super.prototype.dispose.apply(this, arguments);
  };
  AxisView.prototype._doUpdateAxisPointerClass = function (axisModel, api, forceRender) {
    var Clazz = AxisView.getAxisPointerClass(this.axisPointerClass);
    if (!Clazz) {
      return;
    }
    var axisPointerModel = getAxisPointerModel(axisModel);
    axisPointerModel ? (this._axisPointer || (this._axisPointer = new Clazz())).render(axisModel, axisPointerModel, api, forceRender) : this._disposeAxisPointer(api);
  };
  AxisView.prototype._disposeAxisPointer = function (api) {
    this._axisPointer && this._axisPointer.dispose(api);
    this._axisPointer = null;
  };
  AxisView.registerAxisPointerClass = function (type, clazz) {
    {
      if (axisPointerClazz[type]) {
        throw new Error('axisPointer ' + type + ' exists');
      }
    }
    axisPointerClazz[type] = clazz;
  };
  AxisView.getAxisPointerClass = function (type) {
    return type && axisPointerClazz[type];
  };
  AxisView.type = 'axis';
  return AxisView;
}(ComponentView$1);
var AxisView$1 = AxisView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$f = makeInner();
function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
  var axis = axisModel.axis;
  if (axis.scale.isBlank()) {
    return;
  }
  // TODO: TYPE
  var splitAreaModel = axisModel.getModel('splitArea');
  var areaStyleModel = splitAreaModel.getModel('areaStyle');
  var areaColors = areaStyleModel.get('color');
  var gridRect = gridModel.coordinateSystem.getRect();
  var ticksCoords = axis.getTicksCoords({
    tickModel: splitAreaModel,
    clamp: true
  });
  if (!ticksCoords.length) {
    return;
  }
  // For Making appropriate splitArea animation, the color and anid
  // should be corresponding to previous one if possible.
  var areaColorsLen = areaColors.length;
  var lastSplitAreaColors = inner$f(axisView).splitAreaColors;
  var newSplitAreaColors = createHashMap();
  var colorIndex = 0;
  if (lastSplitAreaColors) {
    for (var i = 0; i < ticksCoords.length; i++) {
      var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
      if (cIndex != null) {
        colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
        break;
      }
    }
  }
  var prev = axis.toGlobalCoord(ticksCoords[0].coord);
  var areaStyle = areaStyleModel.getAreaStyle();
  areaColors = isArray$1(areaColors) ? areaColors : [areaColors];
  for (var i = 1; i < ticksCoords.length; i++) {
    var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
    var x = void 0;
    var y = void 0;
    var width = void 0;
    var height = void 0;
    if (axis.isHorizontal()) {
      x = prev;
      y = gridRect.y;
      width = tickCoord - x;
      height = gridRect.height;
      prev = x + width;
    } else {
      x = gridRect.x;
      y = prev;
      width = gridRect.width;
      height = tickCoord - y;
      prev = y + height;
    }
    var tickValue = ticksCoords[i - 1].tickValue;
    tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
    axisGroup.add(new Rect$3({
      anid: tickValue != null ? 'area_' + tickValue : null,
      shape: {
        x: x,
        y: y,
        width: width,
        height: height
      },
      style: defaults({
        fill: areaColors[colorIndex]
      }, areaStyle),
      autoBatch: true,
      silent: true
    }));
    colorIndex = (colorIndex + 1) % areaColorsLen;
  }
  inner$f(axisView).splitAreaColors = newSplitAreaColors;
}
function rectCoordAxisHandleRemove(axisView) {
  inner$f(axisView).splitAreaColors = null;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var axisBuilderAttrs$3 = ['axisLine', 'axisTickLabel', 'axisName'];
var selfBuilderAttrs$2 = ['splitArea', 'splitLine', 'minorSplitLine'];
var CartesianAxisView = /** @class */function (_super) {
  __extends(CartesianAxisView, _super);
  function CartesianAxisView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = CartesianAxisView.type;
    _this.axisPointerClass = 'CartesianAxisPointer';
    return _this;
  }
  /**
   * @override
   */
  CartesianAxisView.prototype.render = function (axisModel, ecModel, api, payload) {
    this.group.removeAll();
    var oldAxisGroup = this._axisGroup;
    this._axisGroup = new Group$5();
    this.group.add(this._axisGroup);
    if (!axisModel.get('show')) {
      return;
    }
    var gridModel = axisModel.getCoordSysModel();
    var layout = layout$2(gridModel, axisModel);
    var axisBuilder = new AxisBuilder$1(axisModel, extend({
      handleAutoShown: function (elementType) {
        var cartesians = gridModel.coordinateSystem.getCartesians();
        for (var i = 0; i < cartesians.length; i++) {
          if (isIntervalOrLogScale(cartesians[i].getOtherAxis(axisModel.axis).scale)) {
            // Still show axis tick or axisLine if other axis is value / log
            return true;
          }
        }
        // Not show axisTick or axisLine if other axis is category / time
        return false;
      }
    }, layout));
    each$f(axisBuilderAttrs$3, axisBuilder.add, axisBuilder);
    this._axisGroup.add(axisBuilder.getGroup());
    each$f(selfBuilderAttrs$2, function (name) {
      if (axisModel.get([name, 'show'])) {
        axisElementBuilders$2[name](this, this._axisGroup, axisModel, gridModel);
      }
    }, this);
    // THIS is a special case for bar racing chart.
    // Update the axis label from the natural initial layout to
    // sorted layout should has no animation.
    var isInitialSortFromBarRacing = payload && payload.type === 'changeAxisOrder' && payload.isInitSort;
    if (!isInitialSortFromBarRacing) {
      groupTransition(oldAxisGroup, this._axisGroup, axisModel);
    }
    _super.prototype.render.call(this, axisModel, ecModel, api, payload);
  };
  CartesianAxisView.prototype.remove = function () {
    rectCoordAxisHandleRemove(this);
  };
  CartesianAxisView.type = 'cartesianAxis';
  return CartesianAxisView;
}(AxisView$1);
var axisElementBuilders$2 = {
  splitLine: function (axisView, axisGroup, axisModel, gridModel) {
    var axis = axisModel.axis;
    if (axis.scale.isBlank()) {
      return;
    }
    var splitLineModel = axisModel.getModel('splitLine');
    var lineStyleModel = splitLineModel.getModel('lineStyle');
    var lineColors = lineStyleModel.get('color');
    var showMinLine = splitLineModel.get('showMinLine') !== false;
    var showMaxLine = splitLineModel.get('showMaxLine') !== false;
    lineColors = isArray$1(lineColors) ? lineColors : [lineColors];
    var gridRect = gridModel.coordinateSystem.getRect();
    var isHorizontal = axis.isHorizontal();
    var lineCount = 0;
    var ticksCoords = axis.getTicksCoords({
      tickModel: splitLineModel
    });
    var p1 = [];
    var p2 = [];
    var lineStyle = lineStyleModel.getLineStyle();
    for (var i = 0; i < ticksCoords.length; i++) {
      var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
      if (i === 0 && !showMinLine || i === ticksCoords.length - 1 && !showMaxLine) {
        continue;
      }
      var tickValue = ticksCoords[i].tickValue;
      if (isHorizontal) {
        p1[0] = tickCoord;
        p1[1] = gridRect.y;
        p2[0] = tickCoord;
        p2[1] = gridRect.y + gridRect.height;
      } else {
        p1[0] = gridRect.x;
        p1[1] = tickCoord;
        p2[0] = gridRect.x + gridRect.width;
        p2[1] = tickCoord;
      }
      var colorIndex = lineCount++ % lineColors.length;
      var line = new Line$4({
        anid: tickValue != null ? 'line_' + tickValue : null,
        autoBatch: true,
        shape: {
          x1: p1[0],
          y1: p1[1],
          x2: p2[0],
          y2: p2[1]
        },
        style: defaults({
          stroke: lineColors[colorIndex]
        }, lineStyle),
        silent: true
      });
      subPixelOptimizeLine(line.shape, lineStyle.lineWidth);
      axisGroup.add(line);
    }
  },
  minorSplitLine: function (axisView, axisGroup, axisModel, gridModel) {
    var axis = axisModel.axis;
    var minorSplitLineModel = axisModel.getModel('minorSplitLine');
    var lineStyleModel = minorSplitLineModel.getModel('lineStyle');
    var gridRect = gridModel.coordinateSystem.getRect();
    var isHorizontal = axis.isHorizontal();
    var minorTicksCoords = axis.getMinorTicksCoords();
    if (!minorTicksCoords.length) {
      return;
    }
    var p1 = [];
    var p2 = [];
    var lineStyle = lineStyleModel.getLineStyle();
    for (var i = 0; i < minorTicksCoords.length; i++) {
      for (var k = 0; k < minorTicksCoords[i].length; k++) {
        var tickCoord = axis.toGlobalCoord(minorTicksCoords[i][k].coord);
        if (isHorizontal) {
          p1[0] = tickCoord;
          p1[1] = gridRect.y;
          p2[0] = tickCoord;
          p2[1] = gridRect.y + gridRect.height;
        } else {
          p1[0] = gridRect.x;
          p1[1] = tickCoord;
          p2[0] = gridRect.x + gridRect.width;
          p2[1] = tickCoord;
        }
        var line = new Line$4({
          anid: 'minor_line_' + minorTicksCoords[i][k].tickValue,
          autoBatch: true,
          shape: {
            x1: p1[0],
            y1: p1[1],
            x2: p2[0],
            y2: p2[1]
          },
          style: lineStyle,
          silent: true
        });
        subPixelOptimizeLine(line.shape, lineStyle.lineWidth);
        axisGroup.add(line);
      }
    }
  },
  splitArea: function (axisView, axisGroup, axisModel, gridModel) {
    rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel);
  }
};
var CartesianXAxisView = /** @class */function (_super) {
  __extends(CartesianXAxisView, _super);
  function CartesianXAxisView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = CartesianXAxisView.type;
    return _this;
  }
  CartesianXAxisView.type = 'xAxis';
  return CartesianXAxisView;
}(CartesianAxisView);
var CartesianYAxisView = /** @class */function (_super) {
  __extends(CartesianYAxisView, _super);
  function CartesianYAxisView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = CartesianXAxisView.type;
    return _this;
  }
  CartesianYAxisView.type = 'yAxis';
  return CartesianYAxisView;
}(CartesianAxisView);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Grid view
var GridView = /** @class */function (_super) {
  __extends(GridView, _super);
  function GridView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = 'grid';
    return _this;
  }
  GridView.prototype.render = function (gridModel, ecModel) {
    this.group.removeAll();
    if (gridModel.get('show')) {
      this.group.add(new Rect$3({
        shape: gridModel.coordinateSystem.getRect(),
        style: defaults({
          fill: gridModel.get('backgroundColor')
        }, gridModel.getItemStyle()),
        silent: true,
        z2: -1
      }));
    }
  };
  GridView.type = 'grid';
  return GridView;
}(ComponentView$1);
var extraOption = {
  // gridIndex: 0,
  // gridId: '',
  offset: 0
};
function install$P(registers) {
  registers.registerComponentView(GridView);
  registers.registerComponentModel(GridModel$1);
  registers.registerCoordinateSystem('cartesian2d', Grid$1);
  axisModelCreator(registers, 'x', CartesianAxisModel, extraOption);
  axisModelCreator(registers, 'y', CartesianAxisModel, extraOption);
  registers.registerComponentView(CartesianXAxisView);
  registers.registerComponentView(CartesianYAxisView);
  registers.registerPreprocessor(function (option) {
    // Only create grid when need
    if (option.xAxis && option.yAxis && !option.grid) {
      option.grid = {};
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$O(registers) {
  // In case developer forget to include grid component
  use(install$P);
  registers.registerSeriesModel(ScatterSeriesModel$1);
  registers.registerChartView(ScatterView$1);
  registers.registerLayout(pointsLayout('scatter'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function radarLayout(ecModel) {
  ecModel.eachSeriesByType('radar', function (seriesModel) {
    var data = seriesModel.getData();
    var points = [];
    var coordSys = seriesModel.coordinateSystem;
    if (!coordSys) {
      return;
    }
    var axes = coordSys.getIndicatorAxes();
    each$f(axes, function (axis, axisIndex) {
      data.each(data.mapDimension(axes[axisIndex].dim), function (val, dataIndex) {
        points[dataIndex] = points[dataIndex] || [];
        var point = coordSys.dataToPoint(val, axisIndex);
        points[dataIndex][axisIndex] = isValidPoint(point) ? point : getValueMissingPoint(coordSys);
      });
    });
    // Close polygon
    data.each(function (idx) {
      // TODO
      // Is it appropriate to connect to the next data when some data is missing?
      // Or, should trade it like `connectNull` in line chart?
      var firstPoint = find(points[idx], function (point) {
        return isValidPoint(point);
      }) || getValueMissingPoint(coordSys);
      // Copy the first actual point to the end of the array
      points[idx].push(firstPoint.slice());
      data.setItemLayout(idx, points[idx]);
    });
  });
}
function isValidPoint(point) {
  return !isNaN(point[0]) && !isNaN(point[1]);
}
function getValueMissingPoint(coordSys) {
  // It is error-prone to input [NaN, NaN] into polygon, polygon.
  // (probably cause problem when refreshing or animating)
  return [coordSys.cx, coordSys.cy];
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function radarBackwardCompat(option) {
  var polarOptArr = option.polar;
  if (polarOptArr) {
    if (!isArray$1(polarOptArr)) {
      polarOptArr = [polarOptArr];
    }
    var polarNotRadar_1 = [];
    each$f(polarOptArr, function (polarOpt, idx) {
      if (polarOpt.indicator) {
        if (polarOpt.type && !polarOpt.shape) {
          polarOpt.shape = polarOpt.type;
        }
        option.radar = option.radar || [];
        if (!isArray$1(option.radar)) {
          option.radar = [option.radar];
        }
        option.radar.push(polarOpt);
      } else {
        polarNotRadar_1.push(polarOpt);
      }
    });
    option.polar = polarNotRadar_1;
  }
  each$f(option.series, function (seriesOpt) {
    if (seriesOpt && seriesOpt.type === 'radar' && seriesOpt.polarIndex) {
      seriesOpt.radarIndex = seriesOpt.polarIndex;
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var RadarView$2 = /** @class */function (_super) {
  __extends(RadarView, _super);
  function RadarView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = RadarView.type;
    return _this;
  }
  RadarView.prototype.render = function (seriesModel, ecModel, api) {
    var polar = seriesModel.coordinateSystem;
    var group = this.group;
    var data = seriesModel.getData();
    var oldData = this._data;
    function createSymbol(data, idx) {
      var symbolType = data.getItemVisual(idx, 'symbol') || 'circle';
      if (symbolType === 'none') {
        return;
      }
      var symbolSize = normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));
      var symbolPath = createSymbol$1(symbolType, -1, -1, 2, 2);
      var symbolRotate = data.getItemVisual(idx, 'symbolRotate') || 0;
      symbolPath.attr({
        style: {
          strokeNoScale: true
        },
        z2: 100,
        scaleX: symbolSize[0] / 2,
        scaleY: symbolSize[1] / 2,
        rotation: symbolRotate * Math.PI / 180 || 0
      });
      return symbolPath;
    }
    function updateSymbols(oldPoints, newPoints, symbolGroup, data, idx, isInit) {
      // Simply rerender all
      symbolGroup.removeAll();
      for (var i = 0; i < newPoints.length - 1; i++) {
        var symbolPath = createSymbol(data, idx);
        if (symbolPath) {
          symbolPath.__dimIdx = i;
          if (oldPoints[i]) {
            symbolPath.setPosition(oldPoints[i]);
            graphic[isInit ? 'initProps' : 'updateProps'](symbolPath, {
              x: newPoints[i][0],
              y: newPoints[i][1]
            }, seriesModel, idx);
          } else {
            symbolPath.setPosition(newPoints[i]);
          }
          symbolGroup.add(symbolPath);
        }
      }
    }
    function getInitialPoints(points) {
      return map$1(points, function (pt) {
        return [polar.cx, polar.cy];
      });
    }
    data.diff(oldData).add(function (idx) {
      var points = data.getItemLayout(idx);
      if (!points) {
        return;
      }
      var polygon = new Polygon$1();
      var polyline = new Polyline$3();
      var target = {
        shape: {
          points: points
        }
      };
      polygon.shape.points = getInitialPoints(points);
      polyline.shape.points = getInitialPoints(points);
      initProps(polygon, target, seriesModel, idx);
      initProps(polyline, target, seriesModel, idx);
      var itemGroup = new Group$5();
      var symbolGroup = new Group$5();
      itemGroup.add(polyline);
      itemGroup.add(polygon);
      itemGroup.add(symbolGroup);
      updateSymbols(polyline.shape.points, points, symbolGroup, data, idx, true);
      data.setItemGraphicEl(idx, itemGroup);
    }).update(function (newIdx, oldIdx) {
      var itemGroup = oldData.getItemGraphicEl(oldIdx);
      var polyline = itemGroup.childAt(0);
      var polygon = itemGroup.childAt(1);
      var symbolGroup = itemGroup.childAt(2);
      var target = {
        shape: {
          points: data.getItemLayout(newIdx)
        }
      };
      if (!target.shape.points) {
        return;
      }
      updateSymbols(polyline.shape.points, target.shape.points, symbolGroup, data, newIdx, false);
      saveOldStyle(polygon);
      saveOldStyle(polyline);
      updateProps$1(polyline, target, seriesModel);
      updateProps$1(polygon, target, seriesModel);
      data.setItemGraphicEl(newIdx, itemGroup);
    }).remove(function (idx) {
      group.remove(oldData.getItemGraphicEl(idx));
    }).execute();
    data.eachItemGraphicEl(function (itemGroup, idx) {
      var itemModel = data.getItemModel(idx);
      var polyline = itemGroup.childAt(0);
      var polygon = itemGroup.childAt(1);
      var symbolGroup = itemGroup.childAt(2);
      // Radar uses the visual encoded from itemStyle.
      var itemStyle = data.getItemVisual(idx, 'style');
      var color = itemStyle.fill;
      group.add(itemGroup);
      polyline.useStyle(defaults(itemModel.getModel('lineStyle').getLineStyle(), {
        fill: 'none',
        stroke: color
      }));
      setStatesStylesFromModel(polyline, itemModel, 'lineStyle');
      setStatesStylesFromModel(polygon, itemModel, 'areaStyle');
      var areaStyleModel = itemModel.getModel('areaStyle');
      var polygonIgnore = areaStyleModel.isEmpty() && areaStyleModel.parentModel.isEmpty();
      polygon.ignore = polygonIgnore;
      each$f(['emphasis', 'select', 'blur'], function (stateName) {
        var stateModel = itemModel.getModel([stateName, 'areaStyle']);
        var stateIgnore = stateModel.isEmpty() && stateModel.parentModel.isEmpty();
        // Won't be ignore if normal state is not ignore.
        polygon.ensureState(stateName).ignore = stateIgnore && polygonIgnore;
      });
      polygon.useStyle(defaults(areaStyleModel.getAreaStyle(), {
        fill: color,
        opacity: 0.7,
        decal: itemStyle.decal
      }));
      var emphasisModel = itemModel.getModel('emphasis');
      var itemHoverStyle = emphasisModel.getModel('itemStyle').getItemStyle();
      symbolGroup.eachChild(function (symbolPath) {
        if (symbolPath instanceof ZRImage$1) {
          var pathStyle = symbolPath.style;
          symbolPath.useStyle(extend({
            // TODO other properties like x, y ?
            image: pathStyle.image,
            x: pathStyle.x,
            y: pathStyle.y,
            width: pathStyle.width,
            height: pathStyle.height
          }, itemStyle));
        } else {
          symbolPath.useStyle(itemStyle);
          symbolPath.setColor(color);
          symbolPath.style.strokeNoScale = true;
        }
        var pathEmphasisState = symbolPath.ensureState('emphasis');
        pathEmphasisState.style = clone$4(itemHoverStyle);
        var defaultText = data.getStore().get(data.getDimensionIndex(symbolPath.__dimIdx), idx);
        (defaultText == null || isNaN(defaultText)) && (defaultText = '');
        setLabelStyle(symbolPath, getLabelStatesModels(itemModel), {
          labelFetcher: data.hostModel,
          labelDataIndex: idx,
          labelDimIndex: symbolPath.__dimIdx,
          defaultText: defaultText,
          inheritColor: color,
          defaultOpacity: itemStyle.opacity
        });
      });
      toggleHoverEmphasis(itemGroup, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
    });
    this._data = data;
  };
  RadarView.prototype.remove = function () {
    this.group.removeAll();
    this._data = null;
  };
  RadarView.type = 'radar';
  return RadarView;
}(ChartView$1);
var RadarView$3 = RadarView$2;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var RadarSeriesModel = /** @class */function (_super) {
  __extends(RadarSeriesModel, _super);
  function RadarSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = RadarSeriesModel.type;
    _this.hasSymbolVisual = true;
    return _this;
  }
  // Overwrite
  RadarSeriesModel.prototype.init = function (option) {
    _super.prototype.init.apply(this, arguments);
    // Enable legend selection for each data item
    // Use a function instead of direct access because data reference may changed
    this.legendVisualProvider = new LegendVisualProvider$1(bind$1(this.getData, this), bind$1(this.getRawData, this));
  };
  RadarSeriesModel.prototype.getInitialData = function (option, ecModel) {
    return createSeriesDataSimply(this, {
      generateCoord: 'indicator_',
      generateCoordCount: Infinity
    });
  };
  RadarSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    var data = this.getData();
    var coordSys = this.coordinateSystem;
    var indicatorAxes = coordSys.getIndicatorAxes();
    var name = this.getData().getName(dataIndex);
    var nameToDisplay = name === '' ? this.name : name;
    var markerColor = retrieveVisualColorForTooltipMarker(this, dataIndex);
    return createTooltipMarkup('section', {
      header: nameToDisplay,
      sortBlocks: true,
      blocks: map$1(indicatorAxes, function (axis) {
        var val = data.get(data.mapDimension(axis.dim), dataIndex);
        return createTooltipMarkup('nameValue', {
          markerType: 'subItem',
          markerColor: markerColor,
          name: axis.name,
          value: val,
          sortParam: val
        });
      })
    });
  };
  RadarSeriesModel.prototype.getTooltipPosition = function (dataIndex) {
    if (dataIndex != null) {
      var data_1 = this.getData();
      var coordSys = this.coordinateSystem;
      var values = data_1.getValues(map$1(coordSys.dimensions, function (dim) {
        return data_1.mapDimension(dim);
      }), dataIndex);
      for (var i = 0, len = values.length; i < len; i++) {
        if (!isNaN(values[i])) {
          var indicatorAxes = coordSys.getIndicatorAxes();
          return coordSys.coordToPoint(indicatorAxes[i].dataToCoord(values[i]), i);
        }
      }
    }
  };
  RadarSeriesModel.type = 'series.radar';
  RadarSeriesModel.dependencies = ['radar'];
  RadarSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    colorBy: 'data',
    coordinateSystem: 'radar',
    legendHoverLink: true,
    radarIndex: 0,
    lineStyle: {
      width: 2,
      type: 'solid',
      join: 'round'
    },
    label: {
      position: 'top'
    },
    // areaStyle: {
    // },
    // itemStyle: {}
    symbolSize: 8
    // symbolRotate: null
  };
  return RadarSeriesModel;
}(SeriesModel$1);
var RadarSeriesModel$1 = RadarSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var valueAxisDefault = axisDefault.value;
function defaultsShow(opt, show) {
  return defaults({
    show: show
  }, opt);
}
var RadarModel = /** @class */function (_super) {
  __extends(RadarModel, _super);
  function RadarModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = RadarModel.type;
    return _this;
  }
  RadarModel.prototype.optionUpdated = function () {
    var boundaryGap = this.get('boundaryGap');
    var splitNumber = this.get('splitNumber');
    var scale = this.get('scale');
    var axisLine = this.get('axisLine');
    var axisTick = this.get('axisTick');
    // let axisType = this.get('axisType');
    var axisLabel = this.get('axisLabel');
    var nameTextStyle = this.get('axisName');
    var showName = this.get(['axisName', 'show']);
    var nameFormatter = this.get(['axisName', 'formatter']);
    var nameGap = this.get('axisNameGap');
    var triggerEvent = this.get('triggerEvent');
    var indicatorModels = map$1(this.get('indicator') || [], function (indicatorOpt) {
      // PENDING
      if (indicatorOpt.max != null && indicatorOpt.max > 0 && !indicatorOpt.min) {
        indicatorOpt.min = 0;
      } else if (indicatorOpt.min != null && indicatorOpt.min < 0 && !indicatorOpt.max) {
        indicatorOpt.max = 0;
      }
      var iNameTextStyle = nameTextStyle;
      if (indicatorOpt.color != null) {
        iNameTextStyle = defaults({
          color: indicatorOpt.color
        }, nameTextStyle);
      }
      // Use same configuration
      var innerIndicatorOpt = merge(clone$4(indicatorOpt), {
        boundaryGap: boundaryGap,
        splitNumber: splitNumber,
        scale: scale,
        axisLine: axisLine,
        axisTick: axisTick,
        // axisType: axisType,
        axisLabel: axisLabel,
        // Compatible with 2 and use text
        name: indicatorOpt.text,
        showName: showName,
        nameLocation: 'end',
        nameGap: nameGap,
        // min: 0,
        nameTextStyle: iNameTextStyle,
        triggerEvent: triggerEvent
      }, false);
      if (isString(nameFormatter)) {
        var indName = innerIndicatorOpt.name;
        innerIndicatorOpt.name = nameFormatter.replace('{value}', indName != null ? indName : '');
      } else if (isFunction(nameFormatter)) {
        innerIndicatorOpt.name = nameFormatter(innerIndicatorOpt.name, innerIndicatorOpt);
      }
      var model = new Model$1(innerIndicatorOpt, null, this.ecModel);
      mixin(model, AxisModelCommonMixin.prototype);
      // For triggerEvent.
      model.mainType = 'radar';
      model.componentIndex = this.componentIndex;
      return model;
    }, this);
    this._indicatorModels = indicatorModels;
  };
  RadarModel.prototype.getIndicatorModels = function () {
    return this._indicatorModels;
  };
  RadarModel.type = 'radar';
  RadarModel.defaultOption = {
    // zlevel: 0,
    z: 0,
    center: ['50%', '50%'],
    radius: '75%',
    startAngle: 90,
    axisName: {
      show: true
      // formatter: null
      // textStyle: {}
    },
    boundaryGap: [0, 0],
    splitNumber: 5,
    axisNameGap: 15,
    scale: false,
    // Polygon or circle
    shape: 'polygon',
    axisLine: merge({
      lineStyle: {
        color: '#bbb'
      }
    }, valueAxisDefault.axisLine),
    axisLabel: defaultsShow(valueAxisDefault.axisLabel, false),
    axisTick: defaultsShow(valueAxisDefault.axisTick, false),
    // axisType: 'value',
    splitLine: defaultsShow(valueAxisDefault.splitLine, true),
    splitArea: defaultsShow(valueAxisDefault.splitArea, true),
    // {text, min, max}
    indicator: []
  };
  return RadarModel;
}(ComponentModel$1);
var RadarModel$1 = RadarModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var axisBuilderAttrs$2 = ['axisLine', 'axisTickLabel', 'axisName'];
var RadarView = /** @class */function (_super) {
  __extends(RadarView, _super);
  function RadarView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = RadarView.type;
    return _this;
  }
  RadarView.prototype.render = function (radarModel, ecModel, api) {
    var group = this.group;
    group.removeAll();
    this._buildAxes(radarModel);
    this._buildSplitLineAndArea(radarModel);
  };
  RadarView.prototype._buildAxes = function (radarModel) {
    var radar = radarModel.coordinateSystem;
    var indicatorAxes = radar.getIndicatorAxes();
    var axisBuilders = map$1(indicatorAxes, function (indicatorAxis) {
      var axisName = indicatorAxis.model.get('showName') ? indicatorAxis.name : ''; // hide name
      var axisBuilder = new AxisBuilder$1(indicatorAxis.model, {
        axisName: axisName,
        position: [radar.cx, radar.cy],
        rotation: indicatorAxis.angle,
        labelDirection: -1,
        tickDirection: -1,
        nameDirection: 1
      });
      return axisBuilder;
    });
    each$f(axisBuilders, function (axisBuilder) {
      each$f(axisBuilderAttrs$2, axisBuilder.add, axisBuilder);
      this.group.add(axisBuilder.getGroup());
    }, this);
  };
  RadarView.prototype._buildSplitLineAndArea = function (radarModel) {
    var radar = radarModel.coordinateSystem;
    var indicatorAxes = radar.getIndicatorAxes();
    if (!indicatorAxes.length) {
      return;
    }
    var shape = radarModel.get('shape');
    var splitLineModel = radarModel.getModel('splitLine');
    var splitAreaModel = radarModel.getModel('splitArea');
    var lineStyleModel = splitLineModel.getModel('lineStyle');
    var areaStyleModel = splitAreaModel.getModel('areaStyle');
    var showSplitLine = splitLineModel.get('show');
    var showSplitArea = splitAreaModel.get('show');
    var splitLineColors = lineStyleModel.get('color');
    var splitAreaColors = areaStyleModel.get('color');
    var splitLineColorsArr = isArray$1(splitLineColors) ? splitLineColors : [splitLineColors];
    var splitAreaColorsArr = isArray$1(splitAreaColors) ? splitAreaColors : [splitAreaColors];
    var splitLines = [];
    var splitAreas = [];
    function getColorIndex(areaOrLine, areaOrLineColorList, idx) {
      var colorIndex = idx % areaOrLineColorList.length;
      areaOrLine[colorIndex] = areaOrLine[colorIndex] || [];
      return colorIndex;
    }
    if (shape === 'circle') {
      var ticksRadius = indicatorAxes[0].getTicksCoords();
      var cx = radar.cx;
      var cy = radar.cy;
      for (var i = 0; i < ticksRadius.length; i++) {
        if (showSplitLine) {
          var colorIndex = getColorIndex(splitLines, splitLineColorsArr, i);
          splitLines[colorIndex].push(new Circle$1({
            shape: {
              cx: cx,
              cy: cy,
              r: ticksRadius[i].coord
            }
          }));
        }
        if (showSplitArea && i < ticksRadius.length - 1) {
          var colorIndex = getColorIndex(splitAreas, splitAreaColorsArr, i);
          splitAreas[colorIndex].push(new Ring$1({
            shape: {
              cx: cx,
              cy: cy,
              r0: ticksRadius[i].coord,
              r: ticksRadius[i + 1].coord
            }
          }));
        }
      }
    }
    // Polyyon
    else {
      var realSplitNumber_1;
      var axesTicksPoints = map$1(indicatorAxes, function (indicatorAxis, idx) {
        var ticksCoords = indicatorAxis.getTicksCoords();
        realSplitNumber_1 = realSplitNumber_1 == null ? ticksCoords.length - 1 : Math.min(ticksCoords.length - 1, realSplitNumber_1);
        return map$1(ticksCoords, function (tickCoord) {
          return radar.coordToPoint(tickCoord.coord, idx);
        });
      });
      var prevPoints = [];
      for (var i = 0; i <= realSplitNumber_1; i++) {
        var points = [];
        for (var j = 0; j < indicatorAxes.length; j++) {
          points.push(axesTicksPoints[j][i]);
        }
        // Close
        if (points[0]) {
          points.push(points[0].slice());
        } else {
          {
            console.error('Can\'t draw value axis ' + i);
          }
        }
        if (showSplitLine) {
          var colorIndex = getColorIndex(splitLines, splitLineColorsArr, i);
          splitLines[colorIndex].push(new Polyline$3({
            shape: {
              points: points
            }
          }));
        }
        if (showSplitArea && prevPoints) {
          var colorIndex = getColorIndex(splitAreas, splitAreaColorsArr, i - 1);
          splitAreas[colorIndex].push(new Polygon$1({
            shape: {
              points: points.concat(prevPoints)
            }
          }));
        }
        prevPoints = points.slice().reverse();
      }
    }
    var lineStyle = lineStyleModel.getLineStyle();
    var areaStyle = areaStyleModel.getAreaStyle();
    // Add splitArea before splitLine
    each$f(splitAreas, function (splitAreas, idx) {
      this.group.add(mergePath(splitAreas, {
        style: defaults({
          stroke: 'none',
          fill: splitAreaColorsArr[idx % splitAreaColorsArr.length]
        }, areaStyle),
        silent: true
      }));
    }, this);
    each$f(splitLines, function (splitLines, idx) {
      this.group.add(mergePath(splitLines, {
        style: defaults({
          fill: 'none',
          stroke: splitLineColorsArr[idx % splitLineColorsArr.length]
        }, lineStyle),
        silent: true
      }));
    }, this);
  };
  RadarView.type = 'radar';
  return RadarView;
}(ComponentView$1);
var RadarView$1 = RadarView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var IndicatorAxis = /** @class */function (_super) {
  __extends(IndicatorAxis, _super);
  function IndicatorAxis(dim, scale, radiusExtent) {
    var _this = _super.call(this, dim, scale, radiusExtent) || this;
    _this.type = 'value';
    _this.angle = 0;
    _this.name = '';
    return _this;
  }
  return IndicatorAxis;
}(Axis$1);
var IndicatorAxis$1 = IndicatorAxis;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Radar = /** @class */function () {
  function Radar(radarModel, ecModel, api) {
    /**
     *
     * Radar dimensions
     */
    this.dimensions = [];
    this._model = radarModel;
    this._indicatorAxes = map$1(radarModel.getIndicatorModels(), function (indicatorModel, idx) {
      var dim = 'indicator_' + idx;
      var indicatorAxis = new IndicatorAxis$1(dim, new IntervalScale$1()
      // (indicatorModel.get('axisType') === 'log') ? new LogScale() : new IntervalScale()
      );
      indicatorAxis.name = indicatorModel.get('name');
      // Inject model and axis
      indicatorAxis.model = indicatorModel;
      indicatorModel.axis = indicatorAxis;
      this.dimensions.push(dim);
      return indicatorAxis;
    }, this);
    this.resize(radarModel, api);
  }
  Radar.prototype.getIndicatorAxes = function () {
    return this._indicatorAxes;
  };
  Radar.prototype.dataToPoint = function (value, indicatorIndex) {
    var indicatorAxis = this._indicatorAxes[indicatorIndex];
    return this.coordToPoint(indicatorAxis.dataToCoord(value), indicatorIndex);
  };
  // TODO: API should be coordToPoint([coord, indicatorIndex])
  Radar.prototype.coordToPoint = function (coord, indicatorIndex) {
    var indicatorAxis = this._indicatorAxes[indicatorIndex];
    var angle = indicatorAxis.angle;
    var x = this.cx + coord * Math.cos(angle);
    var y = this.cy - coord * Math.sin(angle);
    return [x, y];
  };
  Radar.prototype.pointToData = function (pt) {
    var dx = pt[0] - this.cx;
    var dy = pt[1] - this.cy;
    var radius = Math.sqrt(dx * dx + dy * dy);
    dx /= radius;
    dy /= radius;
    var radian = Math.atan2(-dy, dx);
    // Find the closest angle
    // FIXME index can calculated directly
    var minRadianDiff = Infinity;
    var closestAxis;
    var closestAxisIdx = -1;
    for (var i = 0; i < this._indicatorAxes.length; i++) {
      var indicatorAxis = this._indicatorAxes[i];
      var diff = Math.abs(radian - indicatorAxis.angle);
      if (diff < minRadianDiff) {
        closestAxis = indicatorAxis;
        closestAxisIdx = i;
        minRadianDiff = diff;
      }
    }
    return [closestAxisIdx, +(closestAxis && closestAxis.coordToData(radius))];
  };
  Radar.prototype.resize = function (radarModel, api) {
    var center = radarModel.get('center');
    var viewWidth = api.getWidth();
    var viewHeight = api.getHeight();
    var viewSize = Math.min(viewWidth, viewHeight) / 2;
    this.cx = parsePercent(center[0], viewWidth);
    this.cy = parsePercent(center[1], viewHeight);
    this.startAngle = radarModel.get('startAngle') * Math.PI / 180;
    // radius may be single value like `20`, `'80%'`, or array like `[10, '80%']`
    var radius = radarModel.get('radius');
    if (isString(radius) || isNumber(radius)) {
      radius = [0, radius];
    }
    this.r0 = parsePercent(radius[0], viewSize);
    this.r = parsePercent(radius[1], viewSize);
    each$f(this._indicatorAxes, function (indicatorAxis, idx) {
      indicatorAxis.setExtent(this.r0, this.r);
      var angle = this.startAngle + idx * Math.PI * 2 / this._indicatorAxes.length;
      // Normalize to [-PI, PI]
      angle = Math.atan2(Math.sin(angle), Math.cos(angle));
      indicatorAxis.angle = angle;
    }, this);
  };
  Radar.prototype.update = function (ecModel, api) {
    var indicatorAxes = this._indicatorAxes;
    var radarModel = this._model;
    each$f(indicatorAxes, function (indicatorAxis) {
      indicatorAxis.scale.setExtent(Infinity, -Infinity);
    });
    ecModel.eachSeriesByType('radar', function (radarSeries, idx) {
      if (radarSeries.get('coordinateSystem') !== 'radar'
      // @ts-ignore
      || ecModel.getComponent('radar', radarSeries.get('radarIndex')) !== radarModel) {
        return;
      }
      var data = radarSeries.getData();
      each$f(indicatorAxes, function (indicatorAxis) {
        indicatorAxis.scale.unionExtentFromData(data, data.mapDimension(indicatorAxis.dim));
      });
    }, this);
    var splitNumber = radarModel.get('splitNumber');
    var dummyScale = new IntervalScale$1();
    dummyScale.setExtent(0, splitNumber);
    dummyScale.setInterval(1);
    // Force all the axis fixing the maxSplitNumber.
    each$f(indicatorAxes, function (indicatorAxis, idx) {
      alignScaleTicks(indicatorAxis.scale, indicatorAxis.model, dummyScale);
    });
  };
  Radar.prototype.convertToPixel = function (ecModel, finder, value) {
    console.warn('Not implemented.');
    return null;
  };
  Radar.prototype.convertFromPixel = function (ecModel, finder, pixel) {
    console.warn('Not implemented.');
    return null;
  };
  Radar.prototype.containPoint = function (point) {
    console.warn('Not implemented.');
    return false;
  };
  Radar.create = function (ecModel, api) {
    var radarList = [];
    ecModel.eachComponent('radar', function (radarModel) {
      var radar = new Radar(radarModel, ecModel, api);
      radarList.push(radar);
      radarModel.coordinateSystem = radar;
    });
    ecModel.eachSeriesByType('radar', function (radarSeries) {
      if (radarSeries.get('coordinateSystem') === 'radar') {
        // Inject coordinate system
        // @ts-ignore
        radarSeries.coordinateSystem = radarList[radarSeries.get('radarIndex') || 0];
      }
    });
    return radarList;
  };
  /**
   * Radar dimensions is based on the data
   */
  Radar.dimensions = [];
  return Radar;
}();
var Radar$1 = Radar;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$N(registers) {
  registers.registerCoordinateSystem('radar', Radar$1);
  registers.registerComponentModel(RadarModel$1);
  registers.registerComponentView(RadarView$1);
  registers.registerVisual({
    seriesType: 'radar',
    reset: function (seriesModel) {
      var data = seriesModel.getData();
      // itemVisual symbol is for selected data
      data.each(function (idx) {
        data.setItemVisual(idx, 'legendIcon', 'roundRect');
      });
      // visual is for unselected data
      data.setVisual('legendIcon', 'roundRect');
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$M(registers) {
  use(install$N);
  registers.registerChartView(RadarView$3);
  registers.registerSeriesModel(RadarSeriesModel$1);
  registers.registerLayout(radarLayout);
  registers.registerProcessor(dataFilter$1('radar'));
  registers.registerPreprocessor(radarBackwardCompat);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ATTR = '\0_ec_interaction_mutex';
function take(zr, resourceKey, userKey) {
  var store = getStore(zr);
  store[resourceKey] = userKey;
}
function release(zr, resourceKey, userKey) {
  var store = getStore(zr);
  var uKey = store[resourceKey];
  if (uKey === userKey) {
    store[resourceKey] = null;
  }
}
function isTaken(zr, resourceKey) {
  return !!getStore(zr)[resourceKey];
}
function getStore(zr) {
  return zr[ATTR] || (zr[ATTR] = {});
}
/**
 * payload: {
 *     type: 'takeGlobalCursor',
 *     key: 'dataZoomSelect', or 'brush', or ...,
 *         If no userKey, release global cursor.
 * }
 */
// TODO: SELF REGISTERED.
registerAction({
  type: 'takeGlobalCursor',
  event: 'globalCursorTaken',
  update: 'update'
}, noop);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var RoamController = /** @class */function (_super) {
  __extends(RoamController, _super);
  function RoamController(zr) {
    var _this = _super.call(this) || this;
    _this._zr = zr;
    // Avoid two roamController bind the same handler
    var mousedownHandler = bind$1(_this._mousedownHandler, _this);
    var mousemoveHandler = bind$1(_this._mousemoveHandler, _this);
    var mouseupHandler = bind$1(_this._mouseupHandler, _this);
    var mousewheelHandler = bind$1(_this._mousewheelHandler, _this);
    var pinchHandler = bind$1(_this._pinchHandler, _this);
    /**
     * Notice: only enable needed types. For example, if 'zoom'
     * is not needed, 'zoom' should not be enabled, otherwise
     * default mousewheel behaviour (scroll page) will be disabled.
     */
    _this.enable = function (controlType, opt) {
      // Disable previous first
      this.disable();
      this._opt = defaults(clone$4(opt) || {}, {
        zoomOnMouseWheel: true,
        moveOnMouseMove: true,
        // By default, wheel do not trigger move.
        moveOnMouseWheel: false,
        preventDefaultMouseMove: true
      });
      if (controlType == null) {
        controlType = true;
      }
      if (controlType === true || controlType === 'move' || controlType === 'pan') {
        zr.on('mousedown', mousedownHandler);
        zr.on('mousemove', mousemoveHandler);
        zr.on('mouseup', mouseupHandler);
      }
      if (controlType === true || controlType === 'scale' || controlType === 'zoom') {
        zr.on('mousewheel', mousewheelHandler);
        zr.on('pinch', pinchHandler);
      }
    };
    _this.disable = function () {
      zr.off('mousedown', mousedownHandler);
      zr.off('mousemove', mousemoveHandler);
      zr.off('mouseup', mouseupHandler);
      zr.off('mousewheel', mousewheelHandler);
      zr.off('pinch', pinchHandler);
    };
    return _this;
  }
  RoamController.prototype.isDragging = function () {
    return this._dragging;
  };
  RoamController.prototype.isPinching = function () {
    return this._pinching;
  };
  RoamController.prototype.setPointerChecker = function (pointerChecker) {
    this.pointerChecker = pointerChecker;
  };
  RoamController.prototype.dispose = function () {
    this.disable();
  };
  RoamController.prototype._mousedownHandler = function (e) {
    if (isMiddleOrRightButtonOnMouseUpDown(e)) {
      return;
    }
    var el = e.target;
    while (el) {
      if (el.draggable) {
        return;
      }
      // check if host is draggable
      el = el.__hostTarget || el.parent;
    }
    var x = e.offsetX;
    var y = e.offsetY;
    // Only check on mosedown, but not mousemove.
    // Mouse can be out of target when mouse moving.
    if (this.pointerChecker && this.pointerChecker(e, x, y)) {
      this._x = x;
      this._y = y;
      this._dragging = true;
    }
  };
  RoamController.prototype._mousemoveHandler = function (e) {
    if (!this._dragging || !isAvailableBehavior('moveOnMouseMove', e, this._opt) || e.gestureEvent === 'pinch' || isTaken(this._zr, 'globalPan')) {
      return;
    }
    var x = e.offsetX;
    var y = e.offsetY;
    var oldX = this._x;
    var oldY = this._y;
    var dx = x - oldX;
    var dy = y - oldY;
    this._x = x;
    this._y = y;
    this._opt.preventDefaultMouseMove && stop(e.event);
    trigger$1(this, 'pan', 'moveOnMouseMove', e, {
      dx: dx,
      dy: dy,
      oldX: oldX,
      oldY: oldY,
      newX: x,
      newY: y,
      isAvailableBehavior: null
    });
  };
  RoamController.prototype._mouseupHandler = function (e) {
    if (!isMiddleOrRightButtonOnMouseUpDown(e)) {
      this._dragging = false;
    }
  };
  RoamController.prototype._mousewheelHandler = function (e) {
    var shouldZoom = isAvailableBehavior('zoomOnMouseWheel', e, this._opt);
    var shouldMove = isAvailableBehavior('moveOnMouseWheel', e, this._opt);
    var wheelDelta = e.wheelDelta;
    var absWheelDeltaDelta = Math.abs(wheelDelta);
    var originX = e.offsetX;
    var originY = e.offsetY;
    // wheelDelta maybe -0 in chrome mac.
    if (wheelDelta === 0 || !shouldZoom && !shouldMove) {
      return;
    }
    // If both `shouldZoom` and `shouldMove` is true, trigger
    // their event both, and the final behavior is determined
    // by event listener themselves.
    if (shouldZoom) {
      // Convenience:
      // Mac and VM Windows on Mac: scroll up: zoom out.
      // Windows: scroll up: zoom in.
      // FIXME: Should do more test in different environment.
      // wheelDelta is too complicated in difference nvironment
      // (https://developer.mozilla.org/en-US/docs/Web/Events/mousewheel),
      // although it has been normallized by zrender.
      // wheelDelta of mouse wheel is bigger than touch pad.
      var factor = absWheelDeltaDelta > 3 ? 1.4 : absWheelDeltaDelta > 1 ? 1.2 : 1.1;
      var scale = wheelDelta > 0 ? factor : 1 / factor;
      checkPointerAndTrigger(this, 'zoom', 'zoomOnMouseWheel', e, {
        scale: scale,
        originX: originX,
        originY: originY,
        isAvailableBehavior: null
      });
    }
    if (shouldMove) {
      // FIXME: Should do more test in different environment.
      var absDelta = Math.abs(wheelDelta);
      // wheelDelta of mouse wheel is bigger than touch pad.
      var scrollDelta = (wheelDelta > 0 ? 1 : -1) * (absDelta > 3 ? 0.4 : absDelta > 1 ? 0.15 : 0.05);
      checkPointerAndTrigger(this, 'scrollMove', 'moveOnMouseWheel', e, {
        scrollDelta: scrollDelta,
        originX: originX,
        originY: originY,
        isAvailableBehavior: null
      });
    }
  };
  RoamController.prototype._pinchHandler = function (e) {
    if (isTaken(this._zr, 'globalPan')) {
      return;
    }
    var scale = e.pinchScale > 1 ? 1.1 : 1 / 1.1;
    checkPointerAndTrigger(this, 'zoom', null, e, {
      scale: scale,
      originX: e.pinchX,
      originY: e.pinchY,
      isAvailableBehavior: null
    });
  };
  return RoamController;
}(Eventful$1);
function checkPointerAndTrigger(controller, eventName, behaviorToCheck, e, contollerEvent) {
  if (controller.pointerChecker && controller.pointerChecker(e, contollerEvent.originX, contollerEvent.originY)) {
    // When mouse is out of roamController rect,
    // default befavoius should not be be disabled, otherwise
    // page sliding is disabled, contrary to expectation.
    stop(e.event);
    trigger$1(controller, eventName, behaviorToCheck, e, contollerEvent);
  }
}
function trigger$1(controller, eventName, behaviorToCheck, e, contollerEvent) {
  // Also provide behavior checker for event listener, for some case that
  // multiple components share one listener.
  contollerEvent.isAvailableBehavior = bind$1(isAvailableBehavior, null, behaviorToCheck, e);
  // TODO should not have type issue.
  controller.trigger(eventName, contollerEvent);
}
// settings: {
//     zoomOnMouseWheel
//     moveOnMouseMove
//     moveOnMouseWheel
// }
// The value can be: true / false / 'shift' / 'ctrl' / 'alt'.
function isAvailableBehavior(behaviorToCheck, e, settings) {
  var setting = settings[behaviorToCheck];
  return !behaviorToCheck || setting && (!isString(setting) || e.event[setting + 'Key']);
}
var RoamController$1 = RoamController;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * For geo and graph.
 */
function updateViewOnPan(controllerHost, dx, dy) {
  var target = controllerHost.target;
  target.x += dx;
  target.y += dy;
  target.dirty();
}
/**
 * For geo and graph.
 */
function updateViewOnZoom(controllerHost, zoomDelta, zoomX, zoomY) {
  var target = controllerHost.target;
  var zoomLimit = controllerHost.zoomLimit;
  var newZoom = controllerHost.zoom = controllerHost.zoom || 1;
  newZoom *= zoomDelta;
  if (zoomLimit) {
    var zoomMin = zoomLimit.min || 0;
    var zoomMax = zoomLimit.max || Infinity;
    newZoom = Math.max(Math.min(zoomMax, newZoom), zoomMin);
  }
  var zoomScale = newZoom / controllerHost.zoom;
  controllerHost.zoom = newZoom;
  // Keep the mouse center when scaling
  target.x -= (zoomX - target.x) * (zoomScale - 1);
  target.y -= (zoomY - target.y) * (zoomScale - 1);
  target.scaleX *= zoomScale;
  target.scaleY *= zoomScale;
  target.dirty();
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var IRRELEVANT_EXCLUDES = {
  'axisPointer': 1,
  'tooltip': 1,
  'brush': 1
};
/**
 * Avoid that: mouse click on a elements that is over geo or graph,
 * but roam is triggered.
 */
function onIrrelevantElement(e, api, targetCoordSysModel) {
  var model = api.getComponentByElement(e.topTarget);
  // If model is axisModel, it works only if it is injected with coordinateSystem.
  var coordSys = model && model.coordinateSystem;
  return model && model !== targetCoordSysModel && !IRRELEVANT_EXCLUDES.hasOwnProperty(model.mainType) && coordSys && coordSys.model !== targetCoordSysModel;
}

function parseXML(svg) {
  if (isString(svg)) {
    var parser = new DOMParser();
    svg = parser.parseFromString(svg, 'text/xml');
  }
  var svgNode = svg;
  if (svgNode.nodeType === 9) {
    svgNode = svgNode.firstChild;
  }
  while (svgNode.nodeName.toLowerCase() !== 'svg' || svgNode.nodeType !== 1) {
    svgNode = svgNode.nextSibling;
  }
  return svgNode;
}

var nodeParsers;
var INHERITABLE_STYLE_ATTRIBUTES_MAP = {
  'fill': 'fill',
  'stroke': 'stroke',
  'stroke-width': 'lineWidth',
  'opacity': 'opacity',
  'fill-opacity': 'fillOpacity',
  'stroke-opacity': 'strokeOpacity',
  'stroke-dasharray': 'lineDash',
  'stroke-dashoffset': 'lineDashOffset',
  'stroke-linecap': 'lineCap',
  'stroke-linejoin': 'lineJoin',
  'stroke-miterlimit': 'miterLimit',
  'font-family': 'fontFamily',
  'font-size': 'fontSize',
  'font-style': 'fontStyle',
  'font-weight': 'fontWeight',
  'text-anchor': 'textAlign',
  'visibility': 'visibility',
  'display': 'display'
};
var INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS = keys(INHERITABLE_STYLE_ATTRIBUTES_MAP);
var SELF_STYLE_ATTRIBUTES_MAP = {
  'alignment-baseline': 'textBaseline',
  'stop-color': 'stopColor'
};
var SELF_STYLE_ATTRIBUTES_MAP_KEYS = keys(SELF_STYLE_ATTRIBUTES_MAP);
var SVGParser = function () {
  function SVGParser() {
    this._defs = {};
    this._root = null;
  }
  SVGParser.prototype.parse = function (xml, opt) {
    opt = opt || {};
    var svg = parseXML(xml);
    {
      if (!svg) {
        throw new Error('Illegal svg');
      }
    }
    this._defsUsePending = [];
    var root = new Group$5();
    this._root = root;
    var named = [];
    var viewBox = svg.getAttribute('viewBox') || '';
    var width = parseFloat(svg.getAttribute('width') || opt.width);
    var height = parseFloat(svg.getAttribute('height') || opt.height);
    isNaN(width) && (width = null);
    isNaN(height) && (height = null);
    parseAttributes(svg, root, null, true, false);
    var child = svg.firstChild;
    while (child) {
      this._parseNode(child, root, named, null, false, false);
      child = child.nextSibling;
    }
    applyDefs(this._defs, this._defsUsePending);
    this._defsUsePending = [];
    var viewBoxRect;
    var viewBoxTransform;
    if (viewBox) {
      var viewBoxArr = splitNumberSequence(viewBox);
      if (viewBoxArr.length >= 4) {
        viewBoxRect = {
          x: parseFloat(viewBoxArr[0] || 0),
          y: parseFloat(viewBoxArr[1] || 0),
          width: parseFloat(viewBoxArr[2]),
          height: parseFloat(viewBoxArr[3])
        };
      }
    }
    if (viewBoxRect && width != null && height != null) {
      viewBoxTransform = makeViewBoxTransform(viewBoxRect, {
        x: 0,
        y: 0,
        width: width,
        height: height
      });
      if (!opt.ignoreViewBox) {
        var elRoot = root;
        root = new Group$5();
        root.add(elRoot);
        elRoot.scaleX = elRoot.scaleY = viewBoxTransform.scale;
        elRoot.x = viewBoxTransform.x;
        elRoot.y = viewBoxTransform.y;
      }
    }
    if (!opt.ignoreRootClip && width != null && height != null) {
      root.setClipPath(new Rect$3({
        shape: {
          x: 0,
          y: 0,
          width: width,
          height: height
        }
      }));
    }
    return {
      root: root,
      width: width,
      height: height,
      viewBoxRect: viewBoxRect,
      viewBoxTransform: viewBoxTransform,
      named: named
    };
  };
  SVGParser.prototype._parseNode = function (xmlNode, parentGroup, named, namedFrom, isInDefs, isInText) {
    var nodeName = xmlNode.nodeName.toLowerCase();
    var el;
    var namedFromForSub = namedFrom;
    if (nodeName === 'defs') {
      isInDefs = true;
    }
    if (nodeName === 'text') {
      isInText = true;
    }
    if (nodeName === 'defs' || nodeName === 'switch') {
      el = parentGroup;
    } else {
      if (!isInDefs) {
        var parser_1 = nodeParsers[nodeName];
        if (parser_1 && hasOwn(nodeParsers, nodeName)) {
          el = parser_1.call(this, xmlNode, parentGroup);
          var nameAttr = xmlNode.getAttribute('name');
          if (nameAttr) {
            var newNamed = {
              name: nameAttr,
              namedFrom: null,
              svgNodeTagLower: nodeName,
              el: el
            };
            named.push(newNamed);
            if (nodeName === 'g') {
              namedFromForSub = newNamed;
            }
          } else if (namedFrom) {
            named.push({
              name: namedFrom.name,
              namedFrom: namedFrom,
              svgNodeTagLower: nodeName,
              el: el
            });
          }
          parentGroup.add(el);
        }
      }
      var parser = paintServerParsers[nodeName];
      if (parser && hasOwn(paintServerParsers, nodeName)) {
        var def = parser.call(this, xmlNode);
        var id = xmlNode.getAttribute('id');
        if (id) {
          this._defs[id] = def;
        }
      }
    }
    if (el && el.isGroup) {
      var child = xmlNode.firstChild;
      while (child) {
        if (child.nodeType === 1) {
          this._parseNode(child, el, named, namedFromForSub, isInDefs, isInText);
        } else if (child.nodeType === 3 && isInText) {
          this._parseText(child, el);
        }
        child = child.nextSibling;
      }
    }
  };
  SVGParser.prototype._parseText = function (xmlNode, parentGroup) {
    var text = new TSpan$1({
      style: {
        text: xmlNode.textContent
      },
      silent: true,
      x: this._textX || 0,
      y: this._textY || 0
    });
    inheritStyle(parentGroup, text);
    parseAttributes(xmlNode, text, this._defsUsePending, false, false);
    applyTextAlignment(text, parentGroup);
    var textStyle = text.style;
    var fontSize = textStyle.fontSize;
    if (fontSize && fontSize < 9) {
      textStyle.fontSize = 9;
      text.scaleX *= fontSize / 9;
      text.scaleY *= fontSize / 9;
    }
    var font = (textStyle.fontSize || textStyle.fontFamily) && [textStyle.fontStyle, textStyle.fontWeight, (textStyle.fontSize || 12) + 'px', textStyle.fontFamily || 'sans-serif'].join(' ');
    textStyle.font = font;
    var rect = text.getBoundingRect();
    this._textX += rect.width;
    parentGroup.add(text);
    return text;
  };
  SVGParser.internalField = function () {
    nodeParsers = {
      'g': function (xmlNode, parentGroup) {
        var g = new Group$5();
        inheritStyle(parentGroup, g);
        parseAttributes(xmlNode, g, this._defsUsePending, false, false);
        return g;
      },
      'rect': function (xmlNode, parentGroup) {
        var rect = new Rect$3();
        inheritStyle(parentGroup, rect);
        parseAttributes(xmlNode, rect, this._defsUsePending, false, false);
        rect.setShape({
          x: parseFloat(xmlNode.getAttribute('x') || '0'),
          y: parseFloat(xmlNode.getAttribute('y') || '0'),
          width: parseFloat(xmlNode.getAttribute('width') || '0'),
          height: parseFloat(xmlNode.getAttribute('height') || '0')
        });
        rect.silent = true;
        return rect;
      },
      'circle': function (xmlNode, parentGroup) {
        var circle = new Circle$1();
        inheritStyle(parentGroup, circle);
        parseAttributes(xmlNode, circle, this._defsUsePending, false, false);
        circle.setShape({
          cx: parseFloat(xmlNode.getAttribute('cx') || '0'),
          cy: parseFloat(xmlNode.getAttribute('cy') || '0'),
          r: parseFloat(xmlNode.getAttribute('r') || '0')
        });
        circle.silent = true;
        return circle;
      },
      'line': function (xmlNode, parentGroup) {
        var line = new Line$4();
        inheritStyle(parentGroup, line);
        parseAttributes(xmlNode, line, this._defsUsePending, false, false);
        line.setShape({
          x1: parseFloat(xmlNode.getAttribute('x1') || '0'),
          y1: parseFloat(xmlNode.getAttribute('y1') || '0'),
          x2: parseFloat(xmlNode.getAttribute('x2') || '0'),
          y2: parseFloat(xmlNode.getAttribute('y2') || '0')
        });
        line.silent = true;
        return line;
      },
      'ellipse': function (xmlNode, parentGroup) {
        var ellipse = new Ellipse$1();
        inheritStyle(parentGroup, ellipse);
        parseAttributes(xmlNode, ellipse, this._defsUsePending, false, false);
        ellipse.setShape({
          cx: parseFloat(xmlNode.getAttribute('cx') || '0'),
          cy: parseFloat(xmlNode.getAttribute('cy') || '0'),
          rx: parseFloat(xmlNode.getAttribute('rx') || '0'),
          ry: parseFloat(xmlNode.getAttribute('ry') || '0')
        });
        ellipse.silent = true;
        return ellipse;
      },
      'polygon': function (xmlNode, parentGroup) {
        var pointsStr = xmlNode.getAttribute('points');
        var pointsArr;
        if (pointsStr) {
          pointsArr = parsePoints(pointsStr);
        }
        var polygon = new Polygon$1({
          shape: {
            points: pointsArr || []
          },
          silent: true
        });
        inheritStyle(parentGroup, polygon);
        parseAttributes(xmlNode, polygon, this._defsUsePending, false, false);
        return polygon;
      },
      'polyline': function (xmlNode, parentGroup) {
        var pointsStr = xmlNode.getAttribute('points');
        var pointsArr;
        if (pointsStr) {
          pointsArr = parsePoints(pointsStr);
        }
        var polyline = new Polyline$3({
          shape: {
            points: pointsArr || []
          },
          silent: true
        });
        inheritStyle(parentGroup, polyline);
        parseAttributes(xmlNode, polyline, this._defsUsePending, false, false);
        return polyline;
      },
      'image': function (xmlNode, parentGroup) {
        var img = new ZRImage$1();
        inheritStyle(parentGroup, img);
        parseAttributes(xmlNode, img, this._defsUsePending, false, false);
        img.setStyle({
          image: xmlNode.getAttribute('xlink:href') || xmlNode.getAttribute('href'),
          x: +xmlNode.getAttribute('x'),
          y: +xmlNode.getAttribute('y'),
          width: +xmlNode.getAttribute('width'),
          height: +xmlNode.getAttribute('height')
        });
        img.silent = true;
        return img;
      },
      'text': function (xmlNode, parentGroup) {
        var x = xmlNode.getAttribute('x') || '0';
        var y = xmlNode.getAttribute('y') || '0';
        var dx = xmlNode.getAttribute('dx') || '0';
        var dy = xmlNode.getAttribute('dy') || '0';
        this._textX = parseFloat(x) + parseFloat(dx);
        this._textY = parseFloat(y) + parseFloat(dy);
        var g = new Group$5();
        inheritStyle(parentGroup, g);
        parseAttributes(xmlNode, g, this._defsUsePending, false, true);
        return g;
      },
      'tspan': function (xmlNode, parentGroup) {
        var x = xmlNode.getAttribute('x');
        var y = xmlNode.getAttribute('y');
        if (x != null) {
          this._textX = parseFloat(x);
        }
        if (y != null) {
          this._textY = parseFloat(y);
        }
        var dx = xmlNode.getAttribute('dx') || '0';
        var dy = xmlNode.getAttribute('dy') || '0';
        var g = new Group$5();
        inheritStyle(parentGroup, g);
        parseAttributes(xmlNode, g, this._defsUsePending, false, true);
        this._textX += parseFloat(dx);
        this._textY += parseFloat(dy);
        return g;
      },
      'path': function (xmlNode, parentGroup) {
        var d = xmlNode.getAttribute('d') || '';
        var path = createFromString(d);
        inheritStyle(parentGroup, path);
        parseAttributes(xmlNode, path, this._defsUsePending, false, false);
        path.silent = true;
        return path;
      }
    };
  }();
  return SVGParser;
}();
var paintServerParsers = {
  'lineargradient': function (xmlNode) {
    var x1 = parseInt(xmlNode.getAttribute('x1') || '0', 10);
    var y1 = parseInt(xmlNode.getAttribute('y1') || '0', 10);
    var x2 = parseInt(xmlNode.getAttribute('x2') || '10', 10);
    var y2 = parseInt(xmlNode.getAttribute('y2') || '0', 10);
    var gradient = new LinearGradient$1(x1, y1, x2, y2);
    parsePaintServerUnit(xmlNode, gradient);
    parseGradientColorStops(xmlNode, gradient);
    return gradient;
  },
  'radialgradient': function (xmlNode) {
    var cx = parseInt(xmlNode.getAttribute('cx') || '0', 10);
    var cy = parseInt(xmlNode.getAttribute('cy') || '0', 10);
    var r = parseInt(xmlNode.getAttribute('r') || '0', 10);
    var gradient = new RadialGradient$1(cx, cy, r);
    parsePaintServerUnit(xmlNode, gradient);
    parseGradientColorStops(xmlNode, gradient);
    return gradient;
  }
};
function parsePaintServerUnit(xmlNode, gradient) {
  var gradientUnits = xmlNode.getAttribute('gradientUnits');
  if (gradientUnits === 'userSpaceOnUse') {
    gradient.global = true;
  }
}
function parseGradientColorStops(xmlNode, gradient) {
  var stop = xmlNode.firstChild;
  while (stop) {
    if (stop.nodeType === 1 && stop.nodeName.toLocaleLowerCase() === 'stop') {
      var offsetStr = stop.getAttribute('offset');
      var offset = void 0;
      if (offsetStr && offsetStr.indexOf('%') > 0) {
        offset = parseInt(offsetStr, 10) / 100;
      } else if (offsetStr) {
        offset = parseFloat(offsetStr);
      } else {
        offset = 0;
      }
      var styleVals = {};
      parseInlineStyle(stop, styleVals, styleVals);
      var stopColor = styleVals.stopColor || stop.getAttribute('stop-color') || '#000000';
      gradient.colorStops.push({
        offset: offset,
        color: stopColor
      });
    }
    stop = stop.nextSibling;
  }
}
function inheritStyle(parent, child) {
  if (parent && parent.__inheritedStyle) {
    if (!child.__inheritedStyle) {
      child.__inheritedStyle = {};
    }
    defaults(child.__inheritedStyle, parent.__inheritedStyle);
  }
}
function parsePoints(pointsString) {
  var list = splitNumberSequence(pointsString);
  var points = [];
  for (var i = 0; i < list.length; i += 2) {
    var x = parseFloat(list[i]);
    var y = parseFloat(list[i + 1]);
    points.push([x, y]);
  }
  return points;
}
function parseAttributes(xmlNode, el, defsUsePending, onlyInlineStyle, isTextGroup) {
  var disp = el;
  var inheritedStyle = disp.__inheritedStyle = disp.__inheritedStyle || {};
  var selfStyle = {};
  if (xmlNode.nodeType === 1) {
    parseTransformAttribute(xmlNode, el);
    parseInlineStyle(xmlNode, inheritedStyle, selfStyle);
    if (!onlyInlineStyle) {
      parseAttributeStyle(xmlNode, inheritedStyle, selfStyle);
    }
  }
  disp.style = disp.style || {};
  if (inheritedStyle.fill != null) {
    disp.style.fill = getFillStrokeStyle(disp, 'fill', inheritedStyle.fill, defsUsePending);
  }
  if (inheritedStyle.stroke != null) {
    disp.style.stroke = getFillStrokeStyle(disp, 'stroke', inheritedStyle.stroke, defsUsePending);
  }
  each$f(['lineWidth', 'opacity', 'fillOpacity', 'strokeOpacity', 'miterLimit', 'fontSize'], function (propName) {
    if (inheritedStyle[propName] != null) {
      disp.style[propName] = parseFloat(inheritedStyle[propName]);
    }
  });
  each$f(['lineDashOffset', 'lineCap', 'lineJoin', 'fontWeight', 'fontFamily', 'fontStyle', 'textAlign'], function (propName) {
    if (inheritedStyle[propName] != null) {
      disp.style[propName] = inheritedStyle[propName];
    }
  });
  if (isTextGroup) {
    disp.__selfStyle = selfStyle;
  }
  if (inheritedStyle.lineDash) {
    disp.style.lineDash = map$1(splitNumberSequence(inheritedStyle.lineDash), function (str) {
      return parseFloat(str);
    });
  }
  if (inheritedStyle.visibility === 'hidden' || inheritedStyle.visibility === 'collapse') {
    disp.invisible = true;
  }
  if (inheritedStyle.display === 'none') {
    disp.ignore = true;
  }
}
function applyTextAlignment(text, parentGroup) {
  var parentSelfStyle = parentGroup.__selfStyle;
  if (parentSelfStyle) {
    var textBaseline = parentSelfStyle.textBaseline;
    var zrTextBaseline = textBaseline;
    if (!textBaseline || textBaseline === 'auto') {
      zrTextBaseline = 'alphabetic';
    } else if (textBaseline === 'baseline') {
      zrTextBaseline = 'alphabetic';
    } else if (textBaseline === 'before-edge' || textBaseline === 'text-before-edge') {
      zrTextBaseline = 'top';
    } else if (textBaseline === 'after-edge' || textBaseline === 'text-after-edge') {
      zrTextBaseline = 'bottom';
    } else if (textBaseline === 'central' || textBaseline === 'mathematical') {
      zrTextBaseline = 'middle';
    }
    text.style.textBaseline = zrTextBaseline;
  }
  var parentInheritedStyle = parentGroup.__inheritedStyle;
  if (parentInheritedStyle) {
    var textAlign = parentInheritedStyle.textAlign;
    var zrTextAlign = textAlign;
    if (textAlign) {
      if (textAlign === 'middle') {
        zrTextAlign = 'center';
      }
      text.style.textAlign = zrTextAlign;
    }
  }
}
var urlRegex = /^url\(\s*#(.*?)\)/;
function getFillStrokeStyle(el, method, str, defsUsePending) {
  var urlMatch = str && str.match(urlRegex);
  if (urlMatch) {
    var url = trim$1(urlMatch[1]);
    defsUsePending.push([el, method, url]);
    return;
  }
  if (str === 'none') {
    str = null;
  }
  return str;
}
function applyDefs(defs, defsUsePending) {
  for (var i = 0; i < defsUsePending.length; i++) {
    var item = defsUsePending[i];
    item[0].style[item[1]] = defs[item[2]];
  }
}
var numberReg = /-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;
function splitNumberSequence(rawStr) {
  return rawStr.match(numberReg) || [];
}
var transformRegex = /(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.eE,]*)\)/g;
var DEGREE_TO_ANGLE = Math.PI / 180;
function parseTransformAttribute(xmlNode, node) {
  var transform = xmlNode.getAttribute('transform');
  if (transform) {
    transform = transform.replace(/,/g, ' ');
    var transformOps_1 = [];
    var mt = null;
    transform.replace(transformRegex, function (str, type, value) {
      transformOps_1.push(type, value);
      return '';
    });
    for (var i = transformOps_1.length - 1; i > 0; i -= 2) {
      var value = transformOps_1[i];
      var type = transformOps_1[i - 1];
      var valueArr = splitNumberSequence(value);
      mt = mt || create$1();
      switch (type) {
        case 'translate':
          translate(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || '0')]);
          break;
        case 'scale':
          scale$1(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || valueArr[0])]);
          break;
        case 'rotate':
          rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE, [parseFloat(valueArr[1] || '0'), parseFloat(valueArr[2] || '0')]);
          break;
        case 'skewX':
          var sx = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
          mul$1(mt, [1, 0, sx, 1, 0, 0], mt);
          break;
        case 'skewY':
          var sy = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);
          mul$1(mt, [1, sy, 0, 1, 0, 0], mt);
          break;
        case 'matrix':
          mt[0] = parseFloat(valueArr[0]);
          mt[1] = parseFloat(valueArr[1]);
          mt[2] = parseFloat(valueArr[2]);
          mt[3] = parseFloat(valueArr[3]);
          mt[4] = parseFloat(valueArr[4]);
          mt[5] = parseFloat(valueArr[5]);
          break;
      }
    }
    node.setLocalTransform(mt);
  }
}
var styleRegex = /([^\s:;]+)\s*:\s*([^:;]+)/g;
function parseInlineStyle(xmlNode, inheritableStyleResult, selfStyleResult) {
  var style = xmlNode.getAttribute('style');
  if (!style) {
    return;
  }
  styleRegex.lastIndex = 0;
  var styleRegResult;
  while ((styleRegResult = styleRegex.exec(style)) != null) {
    var svgStlAttr = styleRegResult[1];
    var zrInheritableStlAttr = hasOwn(INHERITABLE_STYLE_ATTRIBUTES_MAP, svgStlAttr) ? INHERITABLE_STYLE_ATTRIBUTES_MAP[svgStlAttr] : null;
    if (zrInheritableStlAttr) {
      inheritableStyleResult[zrInheritableStlAttr] = styleRegResult[2];
    }
    var zrSelfStlAttr = hasOwn(SELF_STYLE_ATTRIBUTES_MAP, svgStlAttr) ? SELF_STYLE_ATTRIBUTES_MAP[svgStlAttr] : null;
    if (zrSelfStlAttr) {
      selfStyleResult[zrSelfStlAttr] = styleRegResult[2];
    }
  }
}
function parseAttributeStyle(xmlNode, inheritableStyleResult, selfStyleResult) {
  for (var i = 0; i < INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {
    var svgAttrName = INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS[i];
    var attrValue = xmlNode.getAttribute(svgAttrName);
    if (attrValue != null) {
      inheritableStyleResult[INHERITABLE_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;
    }
  }
  for (var i = 0; i < SELF_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {
    var svgAttrName = SELF_STYLE_ATTRIBUTES_MAP_KEYS[i];
    var attrValue = xmlNode.getAttribute(svgAttrName);
    if (attrValue != null) {
      selfStyleResult[SELF_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;
    }
  }
}
function makeViewBoxTransform(viewBoxRect, boundingRect) {
  var scaleX = boundingRect.width / viewBoxRect.width;
  var scaleY = boundingRect.height / viewBoxRect.height;
  var scale = Math.min(scaleX, scaleY);
  return {
    scale: scale,
    x: -(viewBoxRect.x + viewBoxRect.width / 2) * scale + (boundingRect.x + boundingRect.width / 2),
    y: -(viewBoxRect.y + viewBoxRect.height / 2) * scale + (boundingRect.y + boundingRect.height / 2)
  };
}
function parseSVG(xml, opt) {
  var parser = new SVGParser();
  return parser.parse(xml, opt);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * "region available" means that: enable users to set attribute `name="xxx"` on those tags
 * to make it be a region.
 * 1. region styles and its label styles can be defined in echarts opton:
 * ```js
 * geo: {
 *     regions: [{
 *         name: 'xxx',
 *         itemStyle: { ... },
 *         label: { ... }
 *     }, {
 *         ...
 *     },
 *     ...]
 * };
 * ```
 * 2. name can be duplicated in different SVG tag. All of the tags with the same name share
 * a region option. For exampel if there are two <path> representing two lung lobes. They have
 * no common parents but both of them need to display label "lung" inside.
 */
var REGION_AVAILABLE_SVG_TAG_MAP = createHashMap(['rect', 'circle', 'line', 'ellipse', 'polygon', 'polyline', 'path',
// <text> <tspan> are also enabled because some SVG might paint text itself,
// but still need to trigger events or tooltip.
'text', 'tspan',
// <g> is also enabled because this case: if multiple tags share one name
// and need label displayed, every tags will display the name, which is not
// expected. So we can put them into a <g name="xxx">. Thereby only one label
// displayed and located based on the bounding rect of the <g>.
'g']);
var GeoSVGResource = /** @class */function () {
  function GeoSVGResource(mapName, svg) {
    this.type = 'geoSVG';
    // All used graphics. key: hostKey, value: root
    this._usedGraphicMap = createHashMap();
    // All unused graphics.
    this._freedGraphics = [];
    this._mapName = mapName;
    // Only perform parse to XML object here, which might be time
    // consiming for large SVG.
    // Although convert XML to zrender element is also time consiming,
    // if we do it here, the clone of zrender elements has to be
    // required. So we do it once for each geo instance, util real
    // performance issues call for optimizing it.
    this._parsedXML = parseXML(svg);
  }
  GeoSVGResource.prototype.load = function /* nameMap: NameMap */
  () {
    // In the "load" stage, graphic need to be built to
    // get boundingRect for geo coordinate system.
    var firstGraphic = this._firstGraphic;
    // Create the return data structure only when first graphic created.
    // Because they will be used in geo coordinate system update stage,
    // and `regions` will be mounted at `geo` coordinate system,
    // in which there is no "view" info, so that it should better not to
    // make references to graphic elements.
    if (!firstGraphic) {
      firstGraphic = this._firstGraphic = this._buildGraphic(this._parsedXML);
      this._freedGraphics.push(firstGraphic);
      this._boundingRect = this._firstGraphic.boundingRect.clone();
      // PENDING: `nameMap` will not be supported until some real requirement come.
      // if (nameMap) {
      //     named = applyNameMap(named, nameMap);
      // }
      var _a = createRegions(firstGraphic.named),
        regions = _a.regions,
        regionsMap = _a.regionsMap;
      this._regions = regions;
      this._regionsMap = regionsMap;
    }
    return {
      boundingRect: this._boundingRect,
      regions: this._regions,
      regionsMap: this._regionsMap
    };
  };
  GeoSVGResource.prototype._buildGraphic = function (svgXML) {
    var result;
    var rootFromParse;
    try {
      result = svgXML && parseSVG(svgXML, {
        ignoreViewBox: true,
        ignoreRootClip: true
      }) || {};
      rootFromParse = result.root;
      assert(rootFromParse != null);
    } catch (e) {
      throw new Error('Invalid svg format\n' + e.message);
    }
    // Note: we keep the covenant that the root has no transform. So always add an extra root.
    var root = new Group$5();
    root.add(rootFromParse);
    root.isGeoSVGGraphicRoot = true;
    // [THE_RULE_OF_VIEWPORT_AND_VIEWBOX]
    //
    // Consider: `<svg width="..." height="..." viewBox="...">`
    // - the `width/height` we call it `svgWidth/svgHeight` for short.
    // - `(0, 0, svgWidth, svgHeight)` defines the viewport of the SVG, or say,
    //   "viewport boundingRect", or `boundingRect` for short.
    // - `viewBox` defines the transform from the real content ot the viewport.
    //   `viewBox` has the same unit as the content of SVG.
    //   If `viewBox` exists, a transform is defined, so the unit of `svgWidth/svgHeight` become
    //   different from the content of SVG. Otherwise, they are the same.
    //
    // If both `svgWidth/svgHeight/viewBox` are specified in a SVG file, the transform rule will be:
    // 0. `boundingRect` is `(0, 0, svgWidth, svgHeight)`. Set it to Geo['_rect'] (View['_rect']).
    // 1. Make a transform from `viewBox` to `boundingRect`.
    //    Note: only support `preserveAspectRatio 'xMidYMid'` here. That is, this transform will preserve
    //    the aspect ratio.
    // 2. Make a transform from boundingRect to Geo['_viewRect'] (View['_viewRect'])
    //    (`Geo`/`View` will do this job).
    //    Note: this transform might not preserve aspect radio, which depending on how users specify
    //    viewRect in echarts option (e.g., `geo.left/top/width/height` will not preserve aspect ratio,
    //    but `geo.layoutCenter/layoutSize` will preserve aspect ratio).
    //
    // If `svgWidth/svgHeight` not specified, we use `viewBox` as the `boundingRect` to make the SVG
    // layout look good.
    //
    // If neither `svgWidth/svgHeight` nor `viewBox` are not specified, we calculate the boundingRect
    // of the SVG content and use them to make SVG layout look good.
    var svgWidth = result.width;
    var svgHeight = result.height;
    var viewBoxRect = result.viewBoxRect;
    var boundingRect = this._boundingRect;
    if (!boundingRect) {
      var bRectX = void 0;
      var bRectY = void 0;
      var bRectWidth = void 0;
      var bRectHeight = void 0;
      if (svgWidth != null) {
        bRectX = 0;
        bRectWidth = svgWidth;
      } else if (viewBoxRect) {
        bRectX = viewBoxRect.x;
        bRectWidth = viewBoxRect.width;
      }
      if (svgHeight != null) {
        bRectY = 0;
        bRectHeight = svgHeight;
      } else if (viewBoxRect) {
        bRectY = viewBoxRect.y;
        bRectHeight = viewBoxRect.height;
      }
      // If both viewBox and svgWidth/svgHeight not specified,
      // we have to determine how to layout those element to make them look good.
      if (bRectX == null || bRectY == null) {
        var calculatedBoundingRect = rootFromParse.getBoundingRect();
        if (bRectX == null) {
          bRectX = calculatedBoundingRect.x;
          bRectWidth = calculatedBoundingRect.width;
        }
        if (bRectY == null) {
          bRectY = calculatedBoundingRect.y;
          bRectHeight = calculatedBoundingRect.height;
        }
      }
      boundingRect = this._boundingRect = new BoundingRect$1(bRectX, bRectY, bRectWidth, bRectHeight);
    }
    if (viewBoxRect) {
      var viewBoxTransform = makeViewBoxTransform(viewBoxRect, boundingRect);
      // Only support `preserveAspectRatio 'xMidYMid'`
      rootFromParse.scaleX = rootFromParse.scaleY = viewBoxTransform.scale;
      rootFromParse.x = viewBoxTransform.x;
      rootFromParse.y = viewBoxTransform.y;
    }
    // SVG needs to clip based on `viewBox`. And some SVG files really rely on this feature.
    // They do not strictly confine all of the content inside a display rect, but deliberately
    // use a `viewBox` to define a displayable rect.
    // PENDING:
    // The drawback of the `setClipPath` here is: the region label (genereted by echarts) near the
    // edge might also be clipped, because region labels are put as `textContent` of the SVG path.
    root.setClipPath(new Rect$3({
      shape: boundingRect.plain()
    }));
    var named = [];
    each$f(result.named, function (namedItem) {
      if (REGION_AVAILABLE_SVG_TAG_MAP.get(namedItem.svgNodeTagLower) != null) {
        named.push(namedItem);
        setSilent(namedItem.el);
      }
    });
    return {
      root: root,
      boundingRect: boundingRect,
      named: named
    };
  };
  /**
   * Consider:
   * (1) One graphic element can not be shared by different `geoView` running simultaneously.
   *     Notice, also need to consider multiple echarts instances share a `mapRecord`.
   * (2) Converting SVG to graphic elements is time consuming.
   * (3) In the current architecture, `load` should be called frequently to get boundingRect,
   *     and it is called without view info.
   * So we maintain graphic elements in this module, and enables `view` to use/return these
   * graphics from/to the pool with it's uid.
   */
  GeoSVGResource.prototype.useGraphic = function (hostKey /* , nameMap: NameMap */) {
    var usedRootMap = this._usedGraphicMap;
    var svgGraphic = usedRootMap.get(hostKey);
    if (svgGraphic) {
      return svgGraphic;
    }
    svgGraphic = this._freedGraphics.pop()
    // use the first boundingRect to avoid duplicated boundingRect calculation.
    || this._buildGraphic(this._parsedXML);
    usedRootMap.set(hostKey, svgGraphic);
    // PENDING: `nameMap` will not be supported until some real requirement come.
    // `nameMap` can only be obtained from echarts option.
    // The original `named` must not be modified.
    // if (nameMap) {
    //     svgGraphic = extend({}, svgGraphic);
    //     svgGraphic.named = applyNameMap(svgGraphic.named, nameMap);
    // }
    return svgGraphic;
  };
  GeoSVGResource.prototype.freeGraphic = function (hostKey) {
    var usedRootMap = this._usedGraphicMap;
    var svgGraphic = usedRootMap.get(hostKey);
    if (svgGraphic) {
      usedRootMap.removeKey(hostKey);
      this._freedGraphics.push(svgGraphic);
    }
  };
  return GeoSVGResource;
}();
function setSilent(el) {
  // Only named element has silent: false, other elements should
  // act as background and has no user interaction.
  el.silent = false;
  // text|tspan will be converted to group.
  if (el.isGroup) {
    el.traverse(function (child) {
      child.silent = false;
    });
  }
}
function createRegions(named) {
  var regions = [];
  var regionsMap = createHashMap();
  // Create resions only for the first graphic.
  each$f(named, function (namedItem) {
    // Region has feature to calculate center for tooltip or other features.
    // If there is a <g name="xxx">, the center should be the center of the
    // bounding rect of the g.
    if (namedItem.namedFrom != null) {
      return;
    }
    var region = new GeoSVGRegion(namedItem.name, namedItem.el);
    // PENDING: if `nameMap` supported, this region can not be mounted on
    // `this`, but can only be created each time `load()` called.
    regions.push(region);
    // PENDING: if multiple tag named with the same name, only one will be
    // found by `_regionsMap`. `_regionsMap` is used to find a coordinate
    // by name. We use `region.getCenter()` as the coordinate.
    regionsMap.set(namedItem.name, region);
  });
  return {
    regions: regions,
    regionsMap: regionsMap
  };
}
// PENDING: `nameMap` will not be supported until some real requirement come.
// /**
//  * Use the alias in geoNameMap.
//  * The input `named` must not be modified.
//  */
// function applyNameMap(
//     named: GeoSVGGraphicRecord['named'],
//     nameMap: NameMap
// ): GeoSVGGraphicRecord['named'] {
//     const result = [] as GeoSVGGraphicRecord['named'];
//     for (let i = 0; i < named.length; i++) {
//         let regionGraphic = named[i];
//         const name = regionGraphic.name;
//         if (nameMap && nameMap.hasOwnProperty(name)) {
//             regionGraphic = extend({}, regionGraphic);
//             regionGraphic.name = name;
//         }
//         result.push(regionGraphic);
//     }
//     return result;
// }

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var geoCoord = [126, 25];
var nanhaiName = '南海诸岛';
var points$1 = [[[0, 3.5], [7, 11.2], [15, 11.9], [30, 7], [42, 0.7], [52, 0.7], [56, 7.7], [59, 0.7], [64, 0.7], [64, 0], [5, 0], [0, 3.5]], [[13, 16.1], [19, 14.7], [16, 21.7], [11, 23.1], [13, 16.1]], [[12, 32.2], [14, 38.5], [15, 38.5], [13, 32.2], [12, 32.2]], [[16, 47.6], [12, 53.2], [13, 53.2], [18, 47.6], [16, 47.6]], [[6, 64.4], [8, 70], [9, 70], [8, 64.4], [6, 64.4]], [[23, 82.6], [29, 79.8], [30, 79.8], [25, 82.6], [23, 82.6]], [[37, 70.7], [43, 62.3], [44, 62.3], [39, 70.7], [37, 70.7]], [[48, 51.1], [51, 45.5], [53, 45.5], [50, 51.1], [48, 51.1]], [[51, 35], [51, 28.7], [53, 28.7], [53, 35], [51, 35]], [[52, 22.4], [55, 17.5], [56, 17.5], [53, 22.4], [52, 22.4]], [[58, 12.6], [62, 7], [63, 7], [60, 12.6], [58, 12.6]], [[0, 3.5], [0, 93.1], [64, 93.1], [64, 0], [63, 0], [63, 92.4], [1, 92.4], [1, 3.5], [0, 3.5]]];
for (var i$1 = 0; i$1 < points$1.length; i$1++) {
  for (var k = 0; k < points$1[i$1].length; k++) {
    points$1[i$1][k][0] /= 10.5;
    points$1[i$1][k][1] /= -10.5 / 0.75;
    points$1[i$1][k][0] += geoCoord[0];
    points$1[i$1][k][1] += geoCoord[1];
  }
}
function fixNanhai(mapType, regions) {
  if (mapType === 'china') {
    for (var i = 0; i < regions.length; i++) {
      // Already exists.
      if (regions[i].name === nanhaiName) {
        return;
      }
    }
    regions.push(new GeoJSONRegion(nanhaiName, map$1(points$1, function (exterior) {
      return {
        type: 'polygon',
        exterior: exterior
      };
    }), geoCoord));
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var coordsOffsetMap = {
  '南海诸岛': [32, 80],
  // 全国
  '广东': [0, -10],
  '香港': [10, 5],
  '澳门': [-10, 10],
  // '北京': [-10, 0],
  '天津': [5, 5]
};
function fixTextCoords(mapType, region) {
  if (mapType === 'china') {
    var coordFix = coordsOffsetMap[region.name];
    if (coordFix) {
      var cp = region.getCenter();
      cp[0] += coordFix[0] / 10.5;
      cp[1] += -coordFix[1] / (10.5 / 0.75);
      region.setCenter(cp);
    }
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Fix for 钓鱼岛
// let Region = require('../Region');
// let zrUtil = require('zrender/lib/core/util');
// let geoCoord = [126, 25];
var points = [[[123.45165252685547, 25.73527164402261], [123.49731445312499, 25.73527164402261], [123.49731445312499, 25.750734064600884], [123.45165252685547, 25.750734064600884], [123.45165252685547, 25.73527164402261]]];
function fixDiaoyuIsland(mapType, region) {
  if (mapType === 'china' && region.name === '台湾') {
    region.geometries.push({
      type: 'polygon',
      exterior: points[0]
    });
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DEFAULT_NAME_PROPERTY = 'name';
var GeoJSONResource = /** @class */function () {
  function GeoJSONResource(mapName, geoJSON, specialAreas) {
    this.type = 'geoJSON';
    this._parsedMap = createHashMap();
    this._mapName = mapName;
    this._specialAreas = specialAreas;
    // PENDING: delay the parse to the first usage to rapid up the FMP?
    this._geoJSON = parseInput(geoJSON);
  }
  /**
   * @param nameMap can be null/undefined
   * @param nameProperty can be null/undefined
   */
  GeoJSONResource.prototype.load = function (nameMap, nameProperty) {
    nameProperty = nameProperty || DEFAULT_NAME_PROPERTY;
    var parsed = this._parsedMap.get(nameProperty);
    if (!parsed) {
      var rawRegions = this._parseToRegions(nameProperty);
      parsed = this._parsedMap.set(nameProperty, {
        regions: rawRegions,
        boundingRect: calculateBoundingRect(rawRegions)
      });
    }
    var regionsMap = createHashMap();
    var finalRegions = [];
    each$f(parsed.regions, function (region) {
      var regionName = region.name;
      // Try use the alias in geoNameMap
      if (nameMap && hasOwn(nameMap, regionName)) {
        region = region.cloneShallow(regionName = nameMap[regionName]);
      }
      finalRegions.push(region);
      regionsMap.set(regionName, region);
    });
    return {
      regions: finalRegions,
      boundingRect: parsed.boundingRect || new BoundingRect$1(0, 0, 0, 0),
      regionsMap: regionsMap
    };
  };
  GeoJSONResource.prototype._parseToRegions = function (nameProperty) {
    var mapName = this._mapName;
    var geoJSON = this._geoJSON;
    var rawRegions;
    // https://jsperf.com/try-catch-performance-overhead
    try {
      rawRegions = geoJSON ? parseGeoJSON(geoJSON, nameProperty) : [];
    } catch (e) {
      throw new Error('Invalid geoJson format\n' + e.message);
    }
    fixNanhai(mapName, rawRegions);
    each$f(rawRegions, function (region) {
      var regionName = region.name;
      fixTextCoords(mapName, region);
      fixDiaoyuIsland(mapName, region);
      // Some area like Alaska in USA map needs to be tansformed
      // to look better
      var specialArea = this._specialAreas && this._specialAreas[regionName];
      if (specialArea) {
        region.transformTo(specialArea.left, specialArea.top, specialArea.width, specialArea.height);
      }
    }, this);
    return rawRegions;
  };
  /**
   * Only for exporting to users.
   * **MUST NOT** used internally.
   */
  GeoJSONResource.prototype.getMapForUser = function () {
    return {
      // For backward compatibility, use geoJson
      // PENDING: it has been returning them without clone.
      // do we need to avoid outsite modification?
      geoJson: this._geoJSON,
      geoJSON: this._geoJSON,
      specialAreas: this._specialAreas
    };
  };
  return GeoJSONResource;
}();
function calculateBoundingRect(regions) {
  var rect;
  for (var i = 0; i < regions.length; i++) {
    var regionRect = regions[i].getBoundingRect();
    rect = rect || regionRect.clone();
    rect.union(regionRect);
  }
  return rect;
}
function parseInput(source) {
  return !isString(source) ? source : typeof JSON !== 'undefined' && JSON.parse ? JSON.parse(source) : new Function('return (' + source + ');')();
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var storage = createHashMap();
var geoSourceManager = {
  /**
   * Compatible with previous `echarts.registerMap`.
   *
   * @usage
   * ```js
   *
   * echarts.registerMap('USA', geoJson, specialAreas);
   *
   * echarts.registerMap('USA', {
   *     geoJson: geoJson,
   *     specialAreas: {...}
   * });
   * echarts.registerMap('USA', {
   *     geoJSON: geoJson,
   *     specialAreas: {...}
   * });
   *
   * echarts.registerMap('airport', {
   *     svg: svg
   * }
   * ```
   *
   * Note:
   * Do not support that register multiple geoJSON or SVG
   * one map name. Because different geoJSON and SVG have
   * different unit. It's not easy to make sure how those
   * units are mapping/normalize.
   * If intending to use multiple geoJSON or SVG, we can
   * use multiple geo coordinate system.
   */
  registerMap: function (mapName, rawDef, rawSpecialAreas) {
    if (rawDef.svg) {
      var resource = new GeoSVGResource(mapName, rawDef.svg);
      storage.set(mapName, resource);
    } else {
      // Recommend:
      //     echarts.registerMap('eu', { geoJSON: xxx, specialAreas: xxx });
      // Backward compatibility:
      //     echarts.registerMap('eu', geoJSON, specialAreas);
      //     echarts.registerMap('eu', { geoJson: xxx, specialAreas: xxx });
      var geoJSON = rawDef.geoJson || rawDef.geoJSON;
      if (geoJSON && !rawDef.features) {
        rawSpecialAreas = rawDef.specialAreas;
      } else {
        geoJSON = rawDef;
      }
      var resource = new GeoJSONResource(mapName, geoJSON, rawSpecialAreas);
      storage.set(mapName, resource);
    }
  },
  getGeoResource: function (mapName) {
    return storage.get(mapName);
  },
  /**
   * Only for exporting to users.
   * **MUST NOT** used internally.
   */
  getMapForUser: function (mapName) {
    var resource = storage.get(mapName);
    // Do not support return SVG until some real requirement come.
    return resource && resource.type === 'geoJSON' && resource.getMapForUser();
  },
  load: function (mapName, nameMap, nameProperty) {
    var resource = storage.get(mapName);
    if (!resource) {
      {
        console.error('Map ' + mapName + ' not exists. The GeoJSON of the map must be provided.');
      }
      return;
    }
    return resource.load(nameMap, nameProperty);
  }
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Only these tags enable use `itemStyle` if they are named in SVG.
 * Other tags like <text> <tspan> <image> might not suitable for `itemStyle`.
 * They will not be considered to be styled until some requirements come.
 */
var OPTION_STYLE_ENABLED_TAGS = ['rect', 'circle', 'line', 'ellipse', 'polygon', 'polyline', 'path'];
var OPTION_STYLE_ENABLED_TAG_MAP = createHashMap(OPTION_STYLE_ENABLED_TAGS);
var STATE_TRIGGER_TAG_MAP = createHashMap(OPTION_STYLE_ENABLED_TAGS.concat(['g']));
var LABEL_HOST_MAP = createHashMap(OPTION_STYLE_ENABLED_TAGS.concat(['g']));
var mapLabelRaw = makeInner();
function getFixedItemStyle(model) {
  var itemStyle = model.getItemStyle();
  var areaColor = model.get('areaColor');
  // If user want the color not to be changed when hover,
  // they should both set areaColor and color to be null.
  if (areaColor != null) {
    itemStyle.fill = areaColor;
  }
  return itemStyle;
}
// Only stroke can be used for line.
// Using fill in style if stroke not exits.
// TODO Not sure yet. Perhaps a separate `lineStyle`?
function fixLineStyle(styleHost) {
  var style = styleHost.style;
  if (style) {
    style.stroke = style.stroke || style.fill;
    style.fill = null;
  }
}
var MapDraw = /** @class */function () {
  function MapDraw(api) {
    var group = new Group$5();
    this.uid = getUID('ec_map_draw');
    this._controller = new RoamController$1(api.getZr());
    this._controllerHost = {
      target: group
    };
    this.group = group;
    group.add(this._regionsGroup = new Group$5());
    group.add(this._svgGroup = new Group$5());
  }
  MapDraw.prototype.draw = function (mapOrGeoModel, ecModel, api, fromView, payload) {
    var isGeo = mapOrGeoModel.mainType === 'geo';
    // Map series has data. GEO model that controlled by map series
    // will be assigned with map data. Other GEO model has no data.
    var data = mapOrGeoModel.getData && mapOrGeoModel.getData();
    isGeo && ecModel.eachComponent({
      mainType: 'series',
      subType: 'map'
    }, function (mapSeries) {
      if (!data && mapSeries.getHostGeoModel() === mapOrGeoModel) {
        data = mapSeries.getData();
      }
    });
    var geo = mapOrGeoModel.coordinateSystem;
    var regionsGroup = this._regionsGroup;
    var group = this.group;
    var transformInfo = geo.getTransformInfo();
    var transformInfoRaw = transformInfo.raw;
    var transformInfoRoam = transformInfo.roam;
    // No animation when first draw or in action
    var isFirstDraw = !regionsGroup.childAt(0) || payload;
    if (isFirstDraw) {
      group.x = transformInfoRoam.x;
      group.y = transformInfoRoam.y;
      group.scaleX = transformInfoRoam.scaleX;
      group.scaleY = transformInfoRoam.scaleY;
      group.dirty();
    } else {
      updateProps$1(group, transformInfoRoam, mapOrGeoModel);
    }
    var isVisualEncodedByVisualMap = data && data.getVisual('visualMeta') && data.getVisual('visualMeta').length > 0;
    var viewBuildCtx = {
      api: api,
      geo: geo,
      mapOrGeoModel: mapOrGeoModel,
      data: data,
      isVisualEncodedByVisualMap: isVisualEncodedByVisualMap,
      isGeo: isGeo,
      transformInfoRaw: transformInfoRaw
    };
    if (geo.resourceType === 'geoJSON') {
      this._buildGeoJSON(viewBuildCtx);
    } else if (geo.resourceType === 'geoSVG') {
      this._buildSVG(viewBuildCtx);
    }
    this._updateController(mapOrGeoModel, ecModel, api);
    this._updateMapSelectHandler(mapOrGeoModel, regionsGroup, api, fromView);
  };
  MapDraw.prototype._buildGeoJSON = function (viewBuildCtx) {
    var regionsGroupByName = this._regionsGroupByName = createHashMap();
    var regionsInfoByName = createHashMap();
    var regionsGroup = this._regionsGroup;
    var transformInfoRaw = viewBuildCtx.transformInfoRaw;
    var mapOrGeoModel = viewBuildCtx.mapOrGeoModel;
    var data = viewBuildCtx.data;
    var projection = viewBuildCtx.geo.projection;
    var projectionStream = projection && projection.stream;
    function transformPoint(point, project) {
      if (project) {
        // projection may return null point.
        point = project(point);
      }
      return point && [point[0] * transformInfoRaw.scaleX + transformInfoRaw.x, point[1] * transformInfoRaw.scaleY + transformInfoRaw.y];
    }
    function transformPolygonPoints(inPoints) {
      var outPoints = [];
      // If projectionStream is provided. Use it instead of single point project.
      var project = !projectionStream && projection && projection.project;
      for (var i = 0; i < inPoints.length; ++i) {
        var newPt = transformPoint(inPoints[i], project);
        newPt && outPoints.push(newPt);
      }
      return outPoints;
    }
    function getPolyShape(points) {
      return {
        shape: {
          points: transformPolygonPoints(points)
        }
      };
    }
    regionsGroup.removeAll();
    // Only when the resource is GeoJSON, there is `geo.regions`.
    each$f(viewBuildCtx.geo.regions, function (region) {
      var regionName = region.name;
      // Consider in GeoJson properties.name may be duplicated, for example,
      // there is multiple region named "United Kindom" or "France" (so many
      // colonies). And it is not appropriate to merge them in geo, which
      // will make them share the same label and bring trouble in label
      // location calculation.
      var regionGroup = regionsGroupByName.get(regionName);
      var _a = regionsInfoByName.get(regionName) || {},
        dataIdx = _a.dataIdx,
        regionModel = _a.regionModel;
      if (!regionGroup) {
        regionGroup = regionsGroupByName.set(regionName, new Group$5());
        regionsGroup.add(regionGroup);
        dataIdx = data ? data.indexOfName(regionName) : null;
        regionModel = viewBuildCtx.isGeo ? mapOrGeoModel.getRegionModel(regionName) : data ? data.getItemModel(dataIdx) : null;
        var silent = regionModel.get('silent', true);
        silent != null && (regionGroup.silent = silent);
        regionsInfoByName.set(regionName, {
          dataIdx: dataIdx,
          regionModel: regionModel
        });
      }
      var polygonSubpaths = [];
      var polylineSubpaths = [];
      each$f(region.geometries, function (geometry) {
        // Polygon and MultiPolygon
        if (geometry.type === 'polygon') {
          var polys = [geometry.exterior].concat(geometry.interiors || []);
          if (projectionStream) {
            polys = projectPolys(polys, projectionStream);
          }
          each$f(polys, function (poly) {
            polygonSubpaths.push(new Polygon$1(getPolyShape(poly)));
          });
        }
        // LineString and MultiLineString
        else {
          var points = geometry.points;
          if (projectionStream) {
            points = projectPolys(points, projectionStream, true);
          }
          each$f(points, function (points) {
            polylineSubpaths.push(new Polyline$3(getPolyShape(points)));
          });
        }
      });
      var centerPt = transformPoint(region.getCenter(), projection && projection.project);
      function createCompoundPath(subpaths, isLine) {
        if (!subpaths.length) {
          return;
        }
        var compoundPath = new CompoundPath$1({
          culling: true,
          segmentIgnoreThreshold: 1,
          shape: {
            paths: subpaths
          }
        });
        regionGroup.add(compoundPath);
        applyOptionStyleForRegion(viewBuildCtx, compoundPath, dataIdx, regionModel);
        resetLabelForRegion(viewBuildCtx, compoundPath, regionName, regionModel, mapOrGeoModel, dataIdx, centerPt);
        if (isLine) {
          fixLineStyle(compoundPath);
          each$f(compoundPath.states, fixLineStyle);
        }
      }
      createCompoundPath(polygonSubpaths);
      createCompoundPath(polylineSubpaths, true);
    });
    // Ensure children have been added to `regionGroup` before calling them.
    regionsGroupByName.each(function (regionGroup, regionName) {
      var _a = regionsInfoByName.get(regionName),
        dataIdx = _a.dataIdx,
        regionModel = _a.regionModel;
      resetEventTriggerForRegion(viewBuildCtx, regionGroup, regionName, regionModel, mapOrGeoModel, dataIdx);
      resetTooltipForRegion(viewBuildCtx, regionGroup, regionName, regionModel, mapOrGeoModel);
      resetStateTriggerForRegion(viewBuildCtx, regionGroup, regionName, regionModel, mapOrGeoModel);
    }, this);
  };
  MapDraw.prototype._buildSVG = function (viewBuildCtx) {
    var mapName = viewBuildCtx.geo.map;
    var transformInfoRaw = viewBuildCtx.transformInfoRaw;
    this._svgGroup.x = transformInfoRaw.x;
    this._svgGroup.y = transformInfoRaw.y;
    this._svgGroup.scaleX = transformInfoRaw.scaleX;
    this._svgGroup.scaleY = transformInfoRaw.scaleY;
    if (this._svgResourceChanged(mapName)) {
      this._freeSVG();
      this._useSVG(mapName);
    }
    var svgDispatcherMap = this._svgDispatcherMap = createHashMap();
    var focusSelf = false;
    each$f(this._svgGraphicRecord.named, function (namedItem) {
      // Note that we also allow different elements have the same name.
      // For example, a glyph of a city and the label of the city have
      // the same name and their tooltip info can be defined in a single
      // region option.
      var regionName = namedItem.name;
      var mapOrGeoModel = viewBuildCtx.mapOrGeoModel;
      var data = viewBuildCtx.data;
      var svgNodeTagLower = namedItem.svgNodeTagLower;
      var el = namedItem.el;
      var dataIdx = data ? data.indexOfName(regionName) : null;
      var regionModel = mapOrGeoModel.getRegionModel(regionName);
      if (OPTION_STYLE_ENABLED_TAG_MAP.get(svgNodeTagLower) != null && el instanceof Displayable$1) {
        applyOptionStyleForRegion(viewBuildCtx, el, dataIdx, regionModel);
      }
      if (el instanceof Displayable$1) {
        el.culling = true;
      }
      var silent = regionModel.get('silent', true);
      silent != null && (el.silent = silent);
      // We do not know how the SVG like so we'd better not to change z2.
      // Otherwise it might bring some unexpected result. For example,
      // an area hovered that make some inner city can not be clicked.
      el.z2EmphasisLift = 0;
      // If self named:
      if (!namedItem.namedFrom) {
        // label should batter to be displayed based on the center of <g>
        // if it is named rather than displayed on each child.
        if (LABEL_HOST_MAP.get(svgNodeTagLower) != null) {
          resetLabelForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel, dataIdx, null);
        }
        resetEventTriggerForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel, dataIdx);
        resetTooltipForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel);
        if (STATE_TRIGGER_TAG_MAP.get(svgNodeTagLower) != null) {
          var focus_1 = resetStateTriggerForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel);
          if (focus_1 === 'self') {
            focusSelf = true;
          }
          var els = svgDispatcherMap.get(regionName) || svgDispatcherMap.set(regionName, []);
          els.push(el);
        }
      }
    }, this);
    this._enableBlurEntireSVG(focusSelf, viewBuildCtx);
  };
  MapDraw.prototype._enableBlurEntireSVG = function (focusSelf, viewBuildCtx) {
    // It's a little complicated to support blurring the entire geoSVG in series-map.
    // So do not support it until some requirements come.
    // At present, in series-map, only regions can be blurred.
    if (focusSelf && viewBuildCtx.isGeo) {
      var blurStyle = viewBuildCtx.mapOrGeoModel.getModel(['blur', 'itemStyle']).getItemStyle();
      // Only support `opacity` here. Because not sure that other props are suitable for
      // all of the elements generated by SVG (especially for Text/TSpan/Image/... ).
      var opacity_1 = blurStyle.opacity;
      this._svgGraphicRecord.root.traverse(function (el) {
        if (!el.isGroup) {
          // PENDING: clear those settings to SVG elements when `_freeSVG`.
          // (Currently it happen not to be needed.)
          setDefaultStateProxy(el);
          var style = el.ensureState('blur').style || {};
          // Do not overwrite the region style that already set from region option.
          if (style.opacity == null && opacity_1 != null) {
            style.opacity = opacity_1;
          }
          // If `ensureState('blur').style = {}`, there will be default opacity.
          // Enable `stateTransition` (animation).
          el.ensureState('emphasis');
        }
      });
    }
  };
  MapDraw.prototype.remove = function () {
    this._regionsGroup.removeAll();
    this._regionsGroupByName = null;
    this._svgGroup.removeAll();
    this._freeSVG();
    this._controller.dispose();
    this._controllerHost = null;
  };
  MapDraw.prototype.findHighDownDispatchers = function (name, geoModel) {
    if (name == null) {
      return [];
    }
    var geo = geoModel.coordinateSystem;
    if (geo.resourceType === 'geoJSON') {
      var regionsGroupByName = this._regionsGroupByName;
      if (regionsGroupByName) {
        var regionGroup = regionsGroupByName.get(name);
        return regionGroup ? [regionGroup] : [];
      }
    } else if (geo.resourceType === 'geoSVG') {
      return this._svgDispatcherMap && this._svgDispatcherMap.get(name) || [];
    }
  };
  MapDraw.prototype._svgResourceChanged = function (mapName) {
    return this._svgMapName !== mapName;
  };
  MapDraw.prototype._useSVG = function (mapName) {
    var resource = geoSourceManager.getGeoResource(mapName);
    if (resource && resource.type === 'geoSVG') {
      var svgGraphic = resource.useGraphic(this.uid);
      this._svgGroup.add(svgGraphic.root);
      this._svgGraphicRecord = svgGraphic;
      this._svgMapName = mapName;
    }
  };
  MapDraw.prototype._freeSVG = function () {
    var mapName = this._svgMapName;
    if (mapName == null) {
      return;
    }
    var resource = geoSourceManager.getGeoResource(mapName);
    if (resource && resource.type === 'geoSVG') {
      resource.freeGraphic(this.uid);
    }
    this._svgGraphicRecord = null;
    this._svgDispatcherMap = null;
    this._svgGroup.removeAll();
    this._svgMapName = null;
  };
  MapDraw.prototype._updateController = function (mapOrGeoModel, ecModel, api) {
    var geo = mapOrGeoModel.coordinateSystem;
    var controller = this._controller;
    var controllerHost = this._controllerHost;
    // @ts-ignore FIXME:TS
    controllerHost.zoomLimit = mapOrGeoModel.get('scaleLimit');
    controllerHost.zoom = geo.getZoom();
    // roamType is will be set default true if it is null
    // @ts-ignore FIXME:TS
    controller.enable(mapOrGeoModel.get('roam') || false);
    var mainType = mapOrGeoModel.mainType;
    function makeActionBase() {
      var action = {
        type: 'geoRoam',
        componentType: mainType
      };
      action[mainType + 'Id'] = mapOrGeoModel.id;
      return action;
    }
    controller.off('pan').on('pan', function (e) {
      this._mouseDownFlag = false;
      updateViewOnPan(controllerHost, e.dx, e.dy);
      api.dispatchAction(extend(makeActionBase(), {
        dx: e.dx,
        dy: e.dy,
        animation: {
          duration: 0
        }
      }));
    }, this);
    controller.off('zoom').on('zoom', function (e) {
      this._mouseDownFlag = false;
      updateViewOnZoom(controllerHost, e.scale, e.originX, e.originY);
      api.dispatchAction(extend(makeActionBase(), {
        totalZoom: controllerHost.zoom,
        zoom: e.scale,
        originX: e.originX,
        originY: e.originY,
        animation: {
          duration: 0
        }
      }));
    }, this);
    controller.setPointerChecker(function (e, x, y) {
      return geo.containPoint([x, y]) && !onIrrelevantElement(e, api, mapOrGeoModel);
    });
  };
  /**
   * FIXME: this is a temporarily workaround.
   * When `geoRoam` the elements need to be reset in `MapView['render']`, because the props like
   * `ignore` might have been modified by `LabelManager`, and `LabelManager#addLabelsOfSeries`
   * will subsequently cache `defaultAttr` like `ignore`. If do not do this reset, the modified
   * props will have no chance to be restored.
   * Note: This reset should be after `clearStates` in `renderSeries` because `useStates` in
   * `renderSeries` will cache the modified `ignore` to `el._normalState`.
   * TODO:
   * Use clone/immutable in `LabelManager`?
   */
  MapDraw.prototype.resetForLabelLayout = function () {
    this.group.traverse(function (el) {
      var label = el.getTextContent();
      if (label) {
        label.ignore = mapLabelRaw(label).ignore;
      }
    });
  };
  MapDraw.prototype._updateMapSelectHandler = function (mapOrGeoModel, regionsGroup, api, fromView) {
    var mapDraw = this;
    regionsGroup.off('mousedown');
    regionsGroup.off('click');
    // @ts-ignore FIXME:TS resolve type conflict
    if (mapOrGeoModel.get('selectedMode')) {
      regionsGroup.on('mousedown', function () {
        mapDraw._mouseDownFlag = true;
      });
      regionsGroup.on('click', function (e) {
        if (!mapDraw._mouseDownFlag) {
          return;
        }
        mapDraw._mouseDownFlag = false;
      });
    }
  };
  return MapDraw;
}();
function applyOptionStyleForRegion(viewBuildCtx, el, dataIndex, regionModel) {
  // All of the path are using `itemStyle`, because
  // (1) Some SVG also use fill on polyline (The different between
  // polyline and polygon is "open" or "close" but not fill or not).
  // (2) For the common props like opacity, if some use itemStyle
  // and some use `lineStyle`, it might confuse users.
  // (3) Most SVG use <path>, where can not detect whether to draw a "line"
  // or a filled shape, so use `itemStyle` for <path>.
  var normalStyleModel = regionModel.getModel('itemStyle');
  var emphasisStyleModel = regionModel.getModel(['emphasis', 'itemStyle']);
  var blurStyleModel = regionModel.getModel(['blur', 'itemStyle']);
  var selectStyleModel = regionModel.getModel(['select', 'itemStyle']);
  // NOTE: DON'T use 'style' in visual when drawing map.
  // This component is used for drawing underlying map for both geo component and map series.
  var normalStyle = getFixedItemStyle(normalStyleModel);
  var emphasisStyle = getFixedItemStyle(emphasisStyleModel);
  var selectStyle = getFixedItemStyle(selectStyleModel);
  var blurStyle = getFixedItemStyle(blurStyleModel);
  // Update the itemStyle if has data visual
  var data = viewBuildCtx.data;
  if (data) {
    // Only visual color of each item will be used. It can be encoded by visualMap
    // But visual color of series is used in symbol drawing
    // Visual color for each series is for the symbol draw
    var style = data.getItemVisual(dataIndex, 'style');
    var decal = data.getItemVisual(dataIndex, 'decal');
    if (viewBuildCtx.isVisualEncodedByVisualMap && style.fill) {
      normalStyle.fill = style.fill;
    }
    if (decal) {
      normalStyle.decal = createOrUpdatePatternFromDecal(decal, viewBuildCtx.api);
    }
  }
  // SVG text, tspan and image can be named but not supporeted
  // to be styled by region option yet.
  el.setStyle(normalStyle);
  el.style.strokeNoScale = true;
  el.ensureState('emphasis').style = emphasisStyle;
  el.ensureState('select').style = selectStyle;
  el.ensureState('blur').style = blurStyle;
  // Enable blur
  setDefaultStateProxy(el);
}
function resetLabelForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel,
// Exist only if `viewBuildCtx.data` exists.
dataIdx,
// If labelXY not provided, use `textConfig.position: 'inside'`
labelXY) {
  var data = viewBuildCtx.data;
  var isGeo = viewBuildCtx.isGeo;
  var isDataNaN = data && isNaN(data.get(data.mapDimension('value'), dataIdx));
  var itemLayout = data && data.getItemLayout(dataIdx);
  // In the following cases label will be drawn
  // 1. In map series and data value is NaN
  // 2. In geo component
  // 3. Region has no series legendIcon, which will be add a showLabel flag in mapSymbolLayout
  if (isGeo || isDataNaN || itemLayout && itemLayout.showLabel) {
    var query = !isGeo ? dataIdx : regionName;
    var labelFetcher = void 0;
    // Consider dataIdx not found.
    if (!data || dataIdx >= 0) {
      labelFetcher = mapOrGeoModel;
    }
    var specifiedTextOpt = labelXY ? {
      normal: {
        align: 'center',
        verticalAlign: 'middle'
      }
    } : null;
    // Caveat: must be called after `setDefaultStateProxy(el);` called.
    // because textContent will be assign with `el.stateProxy` inside.
    setLabelStyle(el, getLabelStatesModels(regionModel), {
      labelFetcher: labelFetcher,
      labelDataIndex: query,
      defaultText: regionName
    }, specifiedTextOpt);
    var textEl = el.getTextContent();
    if (textEl) {
      mapLabelRaw(textEl).ignore = textEl.ignore;
      if (el.textConfig && labelXY) {
        // Compute a relative offset based on the el bounding rect.
        var rect = el.getBoundingRect().clone();
        // Need to make sure the percent position base on the same rect in normal and
        // emphasis state. Otherwise if using boundingRect of el, but the emphasis state
        // has borderWidth (even 0.5px), the text position will be changed obviously
        // if the position is very big like ['1234%', '1345%'].
        el.textConfig.layoutRect = rect;
        el.textConfig.position = [(labelXY[0] - rect.x) / rect.width * 100 + '%', (labelXY[1] - rect.y) / rect.height * 100 + '%'];
      }
    }
    // PENDING:
    // If labelLayout is enabled (test/label-layout.html), el.dataIndex should be specified.
    // But el.dataIndex is also used to determine whether user event should be triggered,
    // where el.seriesIndex or el.dataModel must be specified. At present for a single el
    // there is not case that "only label layout enabled but user event disabled", so here
    // we depends `resetEventTriggerForRegion` to do the job of setting `el.dataIndex`.
    el.disableLabelAnimation = true;
  } else {
    el.removeTextContent();
    el.removeTextConfig();
    el.disableLabelAnimation = null;
  }
}
function resetEventTriggerForRegion(viewBuildCtx, eventTrigger, regionName, regionModel, mapOrGeoModel,
// Exist only if `viewBuildCtx.data` exists.
dataIdx) {
  // setItemGraphicEl, setHoverStyle after all polygons and labels
  // are added to the regionGroup
  if (viewBuildCtx.data) {
    // FIXME: when series-map use a SVG map, and there are duplicated name specified
    // on different SVG elements, after `data.setItemGraphicEl(...)`:
    // (1) all of them will be mounted with `dataIndex`, `seriesIndex`, so that tooltip
    // can be triggered only mouse hover. That's correct.
    // (2) only the last element will be kept in `data`, so that if trigger tooltip
    // by `dispatchAction`, only the last one can be found and triggered. That might be
    // not correct. We will fix it in future if anyone demanding that.
    viewBuildCtx.data.setItemGraphicEl(dataIdx, eventTrigger);
  }
  // series-map will not trigger "geoselectchange" no matter it is
  // based on a declared geo component. Because series-map will
  // trigger "selectchange". If it trigger both the two events,
  // If users call `chart.dispatchAction({type: 'toggleSelect'})`,
  // it not easy to also fire event "geoselectchanged".
  else {
    // Package custom mouse event for geo component
    getECData(eventTrigger).eventData = {
      componentType: 'geo',
      componentIndex: mapOrGeoModel.componentIndex,
      geoIndex: mapOrGeoModel.componentIndex,
      name: regionName,
      region: regionModel && regionModel.option || {}
    };
  }
}
function resetTooltipForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel) {
  if (!viewBuildCtx.data) {
    setTooltipConfig({
      el: el,
      componentModel: mapOrGeoModel,
      itemName: regionName,
      // @ts-ignore FIXME:TS fix the "compatible with each other"?
      itemTooltipOption: regionModel.get('tooltip')
    });
  }
}
function resetStateTriggerForRegion(viewBuildCtx, el, regionName, regionModel, mapOrGeoModel) {
  // @ts-ignore FIXME:TS fix the "compatible with each other"?
  el.highDownSilentOnTouch = !!mapOrGeoModel.get('selectedMode');
  // @ts-ignore FIXME:TS fix the "compatible with each other"?
  var emphasisModel = regionModel.getModel('emphasis');
  var focus = emphasisModel.get('focus');
  toggleHoverEmphasis(el, focus, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
  if (viewBuildCtx.isGeo) {
    enableComponentHighDownFeatures(el, mapOrGeoModel, regionName);
  }
  return focus;
}
function projectPolys(rings,
// Polygons include exterior and interiors. Or polylines.
createStream, isLine) {
  var polygons = [];
  var curPoly;
  function startPolygon() {
    curPoly = [];
  }
  function endPolygon() {
    if (curPoly.length) {
      polygons.push(curPoly);
      curPoly = [];
    }
  }
  var stream = createStream({
    polygonStart: startPolygon,
    polygonEnd: endPolygon,
    lineStart: startPolygon,
    lineEnd: endPolygon,
    point: function (x, y) {
      // May have NaN values from stream.
      if (isFinite(x) && isFinite(y)) {
        curPoly.push([x, y]);
      }
    },
    sphere: function () {}
  });
  !isLine && stream.polygonStart();
  each$f(rings, function (ring) {
    stream.lineStart();
    for (var i = 0; i < ring.length; i++) {
      stream.point(ring[i][0], ring[i][1]);
    }
    stream.lineEnd();
  });
  !isLine && stream.polygonEnd();
  return polygons;
}
var MapDraw$1 = MapDraw;
// @ts-ignore FIXME:TS fix the "compatible with each other"?

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var MapView = /** @class */function (_super) {
  __extends(MapView, _super);
  function MapView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MapView.type;
    return _this;
  }
  MapView.prototype.render = function (mapModel, ecModel, api, payload) {
    // Not render if it is an toggleSelect action from self
    if (payload && payload.type === 'mapToggleSelect' && payload.from === this.uid) {
      return;
    }
    var group = this.group;
    group.removeAll();
    if (mapModel.getHostGeoModel()) {
      return;
    }
    if (this._mapDraw && payload && payload.type === 'geoRoam') {
      this._mapDraw.resetForLabelLayout();
    }
    // Not update map if it is an roam action from self
    if (!(payload && payload.type === 'geoRoam' && payload.componentType === 'series' && payload.seriesId === mapModel.id)) {
      if (mapModel.needsDrawMap) {
        var mapDraw = this._mapDraw || new MapDraw$1(api);
        group.add(mapDraw.group);
        mapDraw.draw(mapModel, ecModel, api, this, payload);
        this._mapDraw = mapDraw;
      } else {
        // Remove drawn map
        this._mapDraw && this._mapDraw.remove();
        this._mapDraw = null;
      }
    } else {
      var mapDraw = this._mapDraw;
      mapDraw && group.add(mapDraw.group);
    }
    mapModel.get('showLegendSymbol') && ecModel.getComponent('legend') && this._renderSymbols(mapModel, ecModel, api);
  };
  MapView.prototype.remove = function () {
    this._mapDraw && this._mapDraw.remove();
    this._mapDraw = null;
    this.group.removeAll();
  };
  MapView.prototype.dispose = function () {
    this._mapDraw && this._mapDraw.remove();
    this._mapDraw = null;
  };
  MapView.prototype._renderSymbols = function (mapModel, ecModel, api) {
    var originalData = mapModel.originalData;
    var group = this.group;
    originalData.each(originalData.mapDimension('value'), function (value, originalDataIndex) {
      if (isNaN(value)) {
        return;
      }
      var layout = originalData.getItemLayout(originalDataIndex);
      if (!layout || !layout.point) {
        // Not exists in map
        return;
      }
      var point = layout.point;
      var offset = layout.offset;
      var circle = new Circle$1({
        style: {
          // Because the special of map draw.
          // Which needs statistic of multiple series and draw on one map.
          // And each series also need a symbol with legend color
          //
          // Layout and visual are put one the different data
          // TODO
          fill: mapModel.getData().getVisual('style').fill
        },
        shape: {
          cx: point[0] + offset * 9,
          cy: point[1],
          r: 3
        },
        silent: true,
        // Do not overlap the first series, on which labels are displayed.
        z2: 8 + (!offset ? Z2_EMPHASIS_LIFT + 1 : 0)
      });
      // Only the series that has the first value on the same region is in charge of rendering the label.
      // But consider the case:
      // series: [
      //     {id: 'X', type: 'map', map: 'm', {data: [{name: 'A', value: 11}, {name: 'B', {value: 22}]},
      //     {id: 'Y', type: 'map', map: 'm', {data: [{name: 'A', value: 21}, {name: 'C', {value: 33}]}
      // ]
      // The offset `0` of item `A` is at series `X`, but of item `C` is at series `Y`.
      // For backward compatibility, we follow the rule that render label `A` by the
      // settings on series `X` but render label `C` by the settings on series `Y`.
      if (!offset) {
        var fullData = mapModel.mainSeries.getData();
        var name_1 = originalData.getName(originalDataIndex);
        var fullIndex_1 = fullData.indexOfName(name_1);
        var itemModel = originalData.getItemModel(originalDataIndex);
        var labelModel = itemModel.getModel('label');
        var regionGroup = fullData.getItemGraphicEl(fullIndex_1);
        // `getFormattedLabel` needs to use `getData` inside. Here
        // `mapModel.getData()` is shallow cloned from `mainSeries.getData()`.
        // FIXME
        // If this is not the `mainSeries`, the item model (like label formatter)
        // set on original data item will never get. But it has been working
        // like that from the beginning, and this scenario is rarely encountered.
        // So it won't be fixed until we have to.
        setLabelStyle(circle, getLabelStatesModels(itemModel), {
          labelFetcher: {
            getFormattedLabel: function (idx, state) {
              return mapModel.getFormattedLabel(fullIndex_1, state);
            }
          },
          defaultText: name_1
        });
        circle.disableLabelAnimation = true;
        if (!labelModel.get('position')) {
          circle.setTextConfig({
            position: 'bottom'
          });
        }
        regionGroup.onHoverStateChange = function (toState) {
          setStatesFlag(circle, toState);
        };
      }
      group.add(circle);
    });
  };
  MapView.type = 'map';
  return MapView;
}(ChartView$1);
var MapView$1 = MapView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var MapSeries = /** @class */function (_super) {
  __extends(MapSeries, _super);
  function MapSeries() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MapSeries.type;
    // Only first map series of same mapType will drawMap.
    _this.needsDrawMap = false;
    // Group of all map series with same mapType
    _this.seriesGroup = [];
    _this.getTooltipPosition = function (dataIndex) {
      if (dataIndex != null) {
        var name_1 = this.getData().getName(dataIndex);
        var geo = this.coordinateSystem;
        var region = geo.getRegion(name_1);
        return region && geo.dataToPoint(region.getCenter());
      }
    };
    return _this;
  }
  MapSeries.prototype.getInitialData = function (option) {
    var data = createSeriesDataSimply(this, {
      coordDimensions: ['value'],
      encodeDefaulter: curry$1(makeSeriesEncodeForNameBased, this)
    });
    var dataNameIndexMap = createHashMap();
    var toAppendItems = [];
    for (var i = 0, len = data.count(); i < len; i++) {
      var name_2 = data.getName(i);
      dataNameIndexMap.set(name_2, i);
    }
    var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty);
    each$f(geoSource.regions, function (region) {
      var name = region.name;
      var dataNameIdx = dataNameIndexMap.get(name);
      // apply specified echarts style in GeoJSON data
      var specifiedGeoJSONRegionStyle = region.properties && region.properties.echartsStyle;
      var dataItem;
      if (dataNameIdx == null) {
        dataItem = {
          name: name
        };
        toAppendItems.push(dataItem);
      } else {
        dataItem = data.getRawDataItem(dataNameIdx);
      }
      specifiedGeoJSONRegionStyle && merge(dataItem, specifiedGeoJSONRegionStyle);
    });
    // Complete data with missing regions. The consequent processes (like visual
    // map and render) can not be performed without a "full data". For example,
    // find `dataIndex` by name.
    data.appendData(toAppendItems);
    return data;
  };
  /**
   * If no host geo model, return null, which means using a
   * inner exclusive geo model.
   */
  MapSeries.prototype.getHostGeoModel = function () {
    var geoIndex = this.option.geoIndex;
    return geoIndex != null ? this.ecModel.getComponent('geo', geoIndex) : null;
  };
  MapSeries.prototype.getMapType = function () {
    return (this.getHostGeoModel() || this).option.map;
  };
  // _fillOption(option, mapName) {
  // Shallow clone
  // option = zrUtil.extend({}, option);
  // option.data = geoCreator.getFilledRegions(option.data, mapName, option.nameMap);
  // return option;
  // }
  MapSeries.prototype.getRawValue = function (dataIndex) {
    // Use value stored in data instead because it is calculated from multiple series
    // FIXME Provide all value of multiple series ?
    var data = this.getData();
    return data.get(data.mapDimension('value'), dataIndex);
  };
  /**
   * Get model of region
   */
  MapSeries.prototype.getRegionModel = function (regionName) {
    var data = this.getData();
    return data.getItemModel(data.indexOfName(regionName));
  };
  /**
   * Map tooltip formatter
   */
  MapSeries.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    // FIXME orignalData and data is a bit confusing
    var data = this.getData();
    var value = this.getRawValue(dataIndex);
    var name = data.getName(dataIndex);
    var seriesGroup = this.seriesGroup;
    var seriesNames = [];
    for (var i = 0; i < seriesGroup.length; i++) {
      var otherIndex = seriesGroup[i].originalData.indexOfName(name);
      var valueDim = data.mapDimension('value');
      if (!isNaN(seriesGroup[i].originalData.get(valueDim, otherIndex))) {
        seriesNames.push(seriesGroup[i].name);
      }
    }
    return createTooltipMarkup('section', {
      header: seriesNames.join(', '),
      noHeader: !seriesNames.length,
      blocks: [createTooltipMarkup('nameValue', {
        name: name,
        value: value
      })]
    });
  };
  MapSeries.prototype.setZoom = function (zoom) {
    this.option.zoom = zoom;
  };
  MapSeries.prototype.setCenter = function (center) {
    this.option.center = center;
  };
  MapSeries.prototype.getLegendIcon = function (opt) {
    var iconType = opt.icon || 'roundRect';
    var icon = createSymbol$1(iconType, 0, 0, opt.itemWidth, opt.itemHeight, opt.itemStyle.fill);
    icon.setStyle(opt.itemStyle);
    // Map do not use itemStyle.borderWidth as border width
    icon.style.stroke = 'none';
    // No rotation because no series visual symbol for map
    if (iconType.indexOf('empty') > -1) {
      icon.style.stroke = icon.style.fill;
      icon.style.fill = '#fff';
      icon.style.lineWidth = 2;
    }
    return icon;
  };
  MapSeries.type = 'series.map';
  MapSeries.dependencies = ['geo'];
  MapSeries.layoutMode = 'box';
  MapSeries.defaultOption = {
    // 一级层叠
    // zlevel: 0,
    // 二级层叠
    z: 2,
    coordinateSystem: 'geo',
    // map should be explicitly specified since ec3.
    map: '',
    // If `geoIndex` is not specified, a exclusive geo will be
    // created. Otherwise use the specified geo component, and
    // `map` and `mapType` are ignored.
    // geoIndex: 0,
    // 'center' | 'left' | 'right' | 'x%' | {number}
    left: 'center',
    // 'center' | 'top' | 'bottom' | 'x%' | {number}
    top: 'center',
    // right
    // bottom
    // width:
    // height
    // Aspect is width / height. Inited to be geoJson bbox aspect
    // This parameter is used for scale this aspect
    // Default value:
    // for geoSVG source: 1,
    // for geoJSON source: 0.75.
    aspectScale: null,
    // Layout with center and size
    // If you want to put map in a fixed size box with right aspect ratio
    // This two properties may be more convenient.
    // layoutCenter: [50%, 50%]
    // layoutSize: 100
    showLegendSymbol: true,
    // Define left-top, right-bottom coords to control view
    // For example, [ [180, 90], [-180, -90] ],
    // higher priority than center and zoom
    boundingCoords: null,
    // Default on center of map
    center: null,
    zoom: 1,
    scaleLimit: null,
    selectedMode: true,
    label: {
      show: false,
      color: '#000'
    },
    // scaleLimit: null,
    itemStyle: {
      borderWidth: 0.5,
      borderColor: '#444',
      areaColor: '#eee'
    },
    emphasis: {
      label: {
        show: true,
        color: 'rgb(100,0,0)'
      },
      itemStyle: {
        areaColor: 'rgba(255,215,0,0.8)'
      }
    },
    select: {
      label: {
        show: true,
        color: 'rgb(100,0,0)'
      },
      itemStyle: {
        color: 'rgba(255,215,0,0.8)'
      }
    },
    nameProperty: 'name'
  };
  return MapSeries;
}(SeriesModel$1);
var MapSeries$1 = MapSeries;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// FIXME 公用？
function dataStatistics(datas, statisticType) {
  var dataNameMap = {};
  each$f(datas, function (data) {
    data.each(data.mapDimension('value'), function (value, idx) {
      // Add prefix to avoid conflict with Object.prototype.
      var mapKey = 'ec-' + data.getName(idx);
      dataNameMap[mapKey] = dataNameMap[mapKey] || [];
      if (!isNaN(value)) {
        dataNameMap[mapKey].push(value);
      }
    });
  });
  return datas[0].map(datas[0].mapDimension('value'), function (value, idx) {
    var mapKey = 'ec-' + datas[0].getName(idx);
    var sum = 0;
    var min = Infinity;
    var max = -Infinity;
    var len = dataNameMap[mapKey].length;
    for (var i = 0; i < len; i++) {
      min = Math.min(min, dataNameMap[mapKey][i]);
      max = Math.max(max, dataNameMap[mapKey][i]);
      sum += dataNameMap[mapKey][i];
    }
    var result;
    if (statisticType === 'min') {
      result = min;
    } else if (statisticType === 'max') {
      result = max;
    } else if (statisticType === 'average') {
      result = sum / len;
    } else {
      result = sum;
    }
    return len === 0 ? NaN : result;
  });
}
function mapDataStatistic(ecModel) {
  var seriesGroups = {};
  ecModel.eachSeriesByType('map', function (seriesModel) {
    var hostGeoModel = seriesModel.getHostGeoModel();
    var key = hostGeoModel ? 'o' + hostGeoModel.id : 'i' + seriesModel.getMapType();
    (seriesGroups[key] = seriesGroups[key] || []).push(seriesModel);
  });
  each$f(seriesGroups, function (seriesList, key) {
    var data = dataStatistics(map$1(seriesList, function (seriesModel) {
      return seriesModel.getData();
    }), seriesList[0].get('mapValueCalculation'));
    for (var i = 0; i < seriesList.length; i++) {
      seriesList[i].originalData = seriesList[i].getData();
    }
    // FIXME Put where?
    for (var i = 0; i < seriesList.length; i++) {
      seriesList[i].seriesGroup = seriesList;
      seriesList[i].needsDrawMap = i === 0 && !seriesList[i].getHostGeoModel();
      seriesList[i].setData(data.cloneShallow());
      seriesList[i].mainSeries = seriesList[0];
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function mapSymbolLayout(ecModel) {
  var processedMapType = {};
  ecModel.eachSeriesByType('map', function (mapSeries) {
    var mapType = mapSeries.getMapType();
    if (mapSeries.getHostGeoModel() || processedMapType[mapType]) {
      return;
    }
    var mapSymbolOffsets = {};
    each$f(mapSeries.seriesGroup, function (subMapSeries) {
      var geo = subMapSeries.coordinateSystem;
      var data = subMapSeries.originalData;
      if (subMapSeries.get('showLegendSymbol') && ecModel.getComponent('legend')) {
        data.each(data.mapDimension('value'), function (value, idx) {
          var name = data.getName(idx);
          var region = geo.getRegion(name);
          // If input series.data is [11, 22, '-'/null/undefined, 44],
          // it will be filled with NaN: [11, 22, NaN, 44] and NaN will
          // not be drawn. So here must validate if value is NaN.
          if (!region || isNaN(value)) {
            return;
          }
          var offset = mapSymbolOffsets[name] || 0;
          var point = geo.dataToPoint(region.getCenter());
          mapSymbolOffsets[name] = offset + 1;
          data.setItemLayout(idx, {
            point: point,
            offset: offset
          });
        });
      }
    });
    // Show label of those region not has legendIcon (which is offset 0)
    var data = mapSeries.getData();
    data.each(function (idx) {
      var name = data.getName(idx);
      var layout = data.getItemLayout(idx) || {};
      layout.showLabel = !mapSymbolOffsets[name];
      data.setItemLayout(idx, layout);
    });
    processedMapType[mapType] = true;
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var v2ApplyTransform = applyTransform$1;
var View = /** @class */function (_super) {
  __extends(View, _super);
  function View(name) {
    var _this = _super.call(this) || this;
    _this.type = 'view';
    _this.dimensions = ['x', 'y'];
    /**
     * Represents the transform brought by roam/zoom.
     * If `View['_viewRect']` applies roam transform,
     * we can get the final displayed rect.
     */
    _this._roamTransformable = new Transformable$1();
    /**
     * Represents the transform from `View['_rect']` to `View['_viewRect']`.
     */
    _this._rawTransformable = new Transformable$1();
    _this.name = name;
    return _this;
  }
  View.prototype.setBoundingRect = function (x, y, width, height) {
    this._rect = new BoundingRect$1(x, y, width, height);
    return this._rect;
  };
  /**
   * @return {module:zrender/core/BoundingRect}
   */
  View.prototype.getBoundingRect = function () {
    return this._rect;
  };
  View.prototype.setViewRect = function (x, y, width, height) {
    this._transformTo(x, y, width, height);
    this._viewRect = new BoundingRect$1(x, y, width, height);
  };
  /**
   * Transformed to particular position and size
   */
  View.prototype._transformTo = function (x, y, width, height) {
    var rect = this.getBoundingRect();
    var rawTransform = this._rawTransformable;
    rawTransform.transform = rect.calculateTransform(new BoundingRect$1(x, y, width, height));
    var rawParent = rawTransform.parent;
    rawTransform.parent = null;
    rawTransform.decomposeTransform();
    rawTransform.parent = rawParent;
    this._updateTransform();
  };
  /**
   * Set center of view
   */
  View.prototype.setCenter = function (centerCoord, api) {
    if (!centerCoord) {
      return;
    }
    this._center = [parsePercent(centerCoord[0], api.getWidth()), parsePercent(centerCoord[1], api.getHeight())];
    this._updateCenterAndZoom();
  };
  View.prototype.setZoom = function (zoom) {
    zoom = zoom || 1;
    var zoomLimit = this.zoomLimit;
    if (zoomLimit) {
      if (zoomLimit.max != null) {
        zoom = Math.min(zoomLimit.max, zoom);
      }
      if (zoomLimit.min != null) {
        zoom = Math.max(zoomLimit.min, zoom);
      }
    }
    this._zoom = zoom;
    this._updateCenterAndZoom();
  };
  /**
   * Get default center without roam
   */
  View.prototype.getDefaultCenter = function () {
    // Rect before any transform
    var rawRect = this.getBoundingRect();
    var cx = rawRect.x + rawRect.width / 2;
    var cy = rawRect.y + rawRect.height / 2;
    return [cx, cy];
  };
  View.prototype.getCenter = function () {
    return this._center || this.getDefaultCenter();
  };
  View.prototype.getZoom = function () {
    return this._zoom || 1;
  };
  View.prototype.getRoamTransform = function () {
    return this._roamTransformable.getLocalTransform();
  };
  /**
   * Remove roam
   */
  View.prototype._updateCenterAndZoom = function () {
    // Must update after view transform updated
    var rawTransformMatrix = this._rawTransformable.getLocalTransform();
    var roamTransform = this._roamTransformable;
    var defaultCenter = this.getDefaultCenter();
    var center = this.getCenter();
    var zoom = this.getZoom();
    center = applyTransform$1([], center, rawTransformMatrix);
    defaultCenter = applyTransform$1([], defaultCenter, rawTransformMatrix);
    roamTransform.originX = center[0];
    roamTransform.originY = center[1];
    roamTransform.x = defaultCenter[0] - center[0];
    roamTransform.y = defaultCenter[1] - center[1];
    roamTransform.scaleX = roamTransform.scaleY = zoom;
    this._updateTransform();
  };
  /**
   * Update transform props on `this` based on the current
   * `this._roamTransformable` and `this._rawTransformable`.
   */
  View.prototype._updateTransform = function () {
    var roamTransformable = this._roamTransformable;
    var rawTransformable = this._rawTransformable;
    rawTransformable.parent = roamTransformable;
    roamTransformable.updateTransform();
    rawTransformable.updateTransform();
    copy(this.transform || (this.transform = []), rawTransformable.transform || create$1());
    this._rawTransform = rawTransformable.getLocalTransform();
    this.invTransform = this.invTransform || [];
    invert(this.invTransform, this.transform);
    this.decomposeTransform();
  };
  View.prototype.getTransformInfo = function () {
    var rawTransformable = this._rawTransformable;
    var roamTransformable = this._roamTransformable;
    // Because roamTransformabel has `originX/originY` modified,
    // but the caller of `getTransformInfo` can not handle `originX/originY`,
    // so need to recalculate them.
    var dummyTransformable = new Transformable$1();
    dummyTransformable.transform = roamTransformable.transform;
    dummyTransformable.decomposeTransform();
    return {
      roam: {
        x: dummyTransformable.x,
        y: dummyTransformable.y,
        scaleX: dummyTransformable.scaleX,
        scaleY: dummyTransformable.scaleY
      },
      raw: {
        x: rawTransformable.x,
        y: rawTransformable.y,
        scaleX: rawTransformable.scaleX,
        scaleY: rawTransformable.scaleY
      }
    };
  };
  View.prototype.getViewRect = function () {
    return this._viewRect;
  };
  /**
   * Get view rect after roam transform
   */
  View.prototype.getViewRectAfterRoam = function () {
    var rect = this.getBoundingRect().clone();
    rect.applyTransform(this.transform);
    return rect;
  };
  /**
   * Convert a single (lon, lat) data item to (x, y) point.
   */
  View.prototype.dataToPoint = function (data, noRoam, out) {
    var transform = noRoam ? this._rawTransform : this.transform;
    out = out || [];
    return transform ? v2ApplyTransform(out, data, transform) : copy$1(out, data);
  };
  /**
   * Convert a (x, y) point to (lon, lat) data
   */
  View.prototype.pointToData = function (point) {
    var invTransform = this.invTransform;
    return invTransform ? v2ApplyTransform([], point, invTransform) : [point[0], point[1]];
  };
  View.prototype.convertToPixel = function (ecModel, finder, value) {
    var coordSys = getCoordSys$4(finder);
    return coordSys === this ? coordSys.dataToPoint(value) : null;
  };
  View.prototype.convertFromPixel = function (ecModel, finder, pixel) {
    var coordSys = getCoordSys$4(finder);
    return coordSys === this ? coordSys.pointToData(pixel) : null;
  };
  /**
   * @implements
   */
  View.prototype.containPoint = function (point) {
    return this.getViewRectAfterRoam().contain(point[0], point[1]);
  };
  View.dimensions = ['x', 'y'];
  return View;
}(Transformable$1);
function getCoordSys$4(finder) {
  var seriesModel = finder.seriesModel;
  return seriesModel ? seriesModel.coordinateSystem : null; // e.g., graph.
}
var View$1 = View;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var GEO_DEFAULT_PARAMS = {
  'geoJSON': {
    aspectScale: 0.75,
    invertLongitute: true
  },
  'geoSVG': {
    aspectScale: 1,
    invertLongitute: false
  }
};
var geo2DDimensions = ['lng', 'lat'];
var Geo = /** @class */function (_super) {
  __extends(Geo, _super);
  function Geo(name, map, opt) {
    var _this = _super.call(this, name) || this;
    _this.dimensions = geo2DDimensions;
    _this.type = 'geo';
    // Only store specified name coord via `addGeoCoord`.
    _this._nameCoordMap = createHashMap();
    _this.map = map;
    var projection = opt.projection;
    var source = geoSourceManager.load(map, opt.nameMap, opt.nameProperty);
    var resource = geoSourceManager.getGeoResource(map);
    var resourceType = _this.resourceType = resource ? resource.type : null;
    var regions = _this.regions = source.regions;
    var defaultParams = GEO_DEFAULT_PARAMS[resource.type];
    _this._regionsMap = source.regionsMap;
    _this.regions = source.regions;
    if (projection) {
      // Do some check
      if (resourceType === 'geoSVG') {
        {
          warn("Map " + map + " with SVG source can't use projection. Only GeoJSON source supports projection.");
        }
        projection = null;
      }
      if (!(projection.project && projection.unproject)) {
        {
          warn('project and unproject must be both provided in the projeciton.');
        }
        projection = null;
      }
    }
    _this.projection = projection;
    var boundingRect;
    if (projection) {
      // Can't reuse the raw bounding rect
      for (var i = 0; i < regions.length; i++) {
        var regionRect = regions[i].getBoundingRect(projection);
        boundingRect = boundingRect || regionRect.clone();
        boundingRect.union(regionRect);
      }
    } else {
      boundingRect = source.boundingRect;
    }
    _this.setBoundingRect(boundingRect.x, boundingRect.y, boundingRect.width, boundingRect.height);
    // aspectScale and invertLongitute actually is the parameters default raw projection.
    // So we ignore them if projection is given.
    // Ignore default aspect scale if projection exits.
    _this.aspectScale = projection ? 1 : retrieve2(opt.aspectScale, defaultParams.aspectScale);
    // Not invert longitude if projection exits.
    _this._invertLongitute = projection ? false : defaultParams.invertLongitute;
    return _this;
  }
  Geo.prototype._transformTo = function (x, y, width, height) {
    var rect = this.getBoundingRect();
    var invertLongitute = this._invertLongitute;
    rect = rect.clone();
    if (invertLongitute) {
      // Longitude is inverted.
      rect.y = -rect.y - rect.height;
    }
    var rawTransformable = this._rawTransformable;
    rawTransformable.transform = rect.calculateTransform(new BoundingRect$1(x, y, width, height));
    var rawParent = rawTransformable.parent;
    rawTransformable.parent = null;
    rawTransformable.decomposeTransform();
    rawTransformable.parent = rawParent;
    if (invertLongitute) {
      rawTransformable.scaleY = -rawTransformable.scaleY;
    }
    this._updateTransform();
  };
  Geo.prototype.getRegion = function (name) {
    return this._regionsMap.get(name);
  };
  Geo.prototype.getRegionByCoord = function (coord) {
    var regions = this.regions;
    for (var i = 0; i < regions.length; i++) {
      var region = regions[i];
      if (region.type === 'geoJSON' && region.contain(coord)) {
        return regions[i];
      }
    }
  };
  /**
   * Add geoCoord for indexing by name
   */
  Geo.prototype.addGeoCoord = function (name, geoCoord) {
    this._nameCoordMap.set(name, geoCoord);
  };
  /**
   * Get geoCoord by name
   */
  Geo.prototype.getGeoCoord = function (name) {
    var region = this._regionsMap.get(name);
    // Calculate center only on demand.
    return this._nameCoordMap.get(name) || region && region.getCenter();
  };
  Geo.prototype.dataToPoint = function (data, noRoam, out) {
    if (isString(data)) {
      // Map area name to geoCoord
      data = this.getGeoCoord(data);
    }
    if (data) {
      var projection = this.projection;
      if (projection) {
        // projection may return null point.
        data = projection.project(data);
      }
      return data && this.projectedToPoint(data, noRoam, out);
    }
  };
  Geo.prototype.pointToData = function (point) {
    var projection = this.projection;
    if (projection) {
      // projection may return null point.
      point = projection.unproject(point);
    }
    return point && this.pointToProjected(point);
  };
  /**
   * Point to projected data. Same with pointToData when projection is used.
   */
  Geo.prototype.pointToProjected = function (point) {
    return _super.prototype.pointToData.call(this, point);
  };
  Geo.prototype.projectedToPoint = function (projected, noRoam, out) {
    return _super.prototype.dataToPoint.call(this, projected, noRoam, out);
  };
  Geo.prototype.convertToPixel = function (ecModel, finder, value) {
    var coordSys = getCoordSys$3(finder);
    return coordSys === this ? coordSys.dataToPoint(value) : null;
  };
  Geo.prototype.convertFromPixel = function (ecModel, finder, pixel) {
    var coordSys = getCoordSys$3(finder);
    return coordSys === this ? coordSys.pointToData(pixel) : null;
  };
  return Geo;
}(View$1);
mixin(Geo, View$1);
function getCoordSys$3(finder) {
  var geoModel = finder.geoModel;
  var seriesModel = finder.seriesModel;
  return geoModel ? geoModel.coordinateSystem : seriesModel ? seriesModel.coordinateSystem // For map series.
  || (seriesModel.getReferringComponents('geo', SINGLE_REFERRING).models[0] || {}).coordinateSystem : null;
}
var Geo$1 = Geo;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Resize method bound to the geo
 */
function resizeGeo(geoModel, api) {
  var boundingCoords = geoModel.get('boundingCoords');
  if (boundingCoords != null) {
    var leftTop_1 = boundingCoords[0];
    var rightBottom_1 = boundingCoords[1];
    if (!(isFinite(leftTop_1[0]) && isFinite(leftTop_1[1]) && isFinite(rightBottom_1[0]) && isFinite(rightBottom_1[1]))) {
      {
        console.error('Invalid boundingCoords');
      }
    } else {
      // Sample around the lng/lat rect and use projection to calculate actual bounding rect.
      var projection_1 = this.projection;
      if (projection_1) {
        var xMin = leftTop_1[0];
        var yMin = leftTop_1[1];
        var xMax = rightBottom_1[0];
        var yMax = rightBottom_1[1];
        leftTop_1 = [Infinity, Infinity];
        rightBottom_1 = [-Infinity, -Infinity];
        // TODO better way?
        var sampleLine = function (x0, y0, x1, y1) {
          var dx = x1 - x0;
          var dy = y1 - y0;
          for (var i = 0; i <= 100; i++) {
            var p = i / 100;
            var pt = projection_1.project([x0 + dx * p, y0 + dy * p]);
            min$3(leftTop_1, leftTop_1, pt);
            max$4(rightBottom_1, rightBottom_1, pt);
          }
        };
        // Top
        sampleLine(xMin, yMin, xMax, yMin);
        // Right
        sampleLine(xMax, yMin, xMax, yMax);
        // Bottom
        sampleLine(xMax, yMax, xMin, yMax);
        // Left
        sampleLine(xMin, yMax, xMax, yMin);
      }
      this.setBoundingRect(leftTop_1[0], leftTop_1[1], rightBottom_1[0] - leftTop_1[0], rightBottom_1[1] - leftTop_1[1]);
    }
  }
  var rect = this.getBoundingRect();
  var centerOption = geoModel.get('layoutCenter');
  var sizeOption = geoModel.get('layoutSize');
  var viewWidth = api.getWidth();
  var viewHeight = api.getHeight();
  var aspect = rect.width / rect.height * this.aspectScale;
  var useCenterAndSize = false;
  var center;
  var size;
  if (centerOption && sizeOption) {
    center = [parsePercent(centerOption[0], viewWidth), parsePercent(centerOption[1], viewHeight)];
    size = parsePercent(sizeOption, Math.min(viewWidth, viewHeight));
    if (!isNaN(center[0]) && !isNaN(center[1]) && !isNaN(size)) {
      useCenterAndSize = true;
    } else {
      {
        console.warn('Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.');
      }
    }
  }
  var viewRect;
  if (useCenterAndSize) {
    viewRect = {};
    if (aspect > 1) {
      // Width is same with size
      viewRect.width = size;
      viewRect.height = size / aspect;
    } else {
      viewRect.height = size;
      viewRect.width = size * aspect;
    }
    viewRect.y = center[1] - viewRect.height / 2;
    viewRect.x = center[0] - viewRect.width / 2;
  } else {
    // Use left/top/width/height
    var boxLayoutOption = geoModel.getBoxLayoutParams();
    boxLayoutOption.aspect = aspect;
    viewRect = getLayoutRect(boxLayoutOption, {
      width: viewWidth,
      height: viewHeight
    });
  }
  this.setViewRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height);
  this.setCenter(geoModel.get('center'), api);
  this.setZoom(geoModel.get('zoom'));
}
// Back compat for ECharts2, where the coord map is set on map series:
// {type: 'map', geoCoord: {'cityA': [116.46,39.92], 'cityA': [119.12,24.61]}},
function setGeoCoords(geo, model) {
  each$f(model.get('geoCoord'), function (geoCoord, name) {
    geo.addGeoCoord(name, geoCoord);
  });
}
var GeoCreator = /** @class */function () {
  function GeoCreator() {
    // For deciding which dimensions to use when creating list data
    this.dimensions = geo2DDimensions;
  }
  GeoCreator.prototype.create = function (ecModel, api) {
    var geoList = [];
    function getCommonGeoProperties(model) {
      return {
        nameProperty: model.get('nameProperty'),
        aspectScale: model.get('aspectScale'),
        projection: model.get('projection')
      };
    }
    // FIXME Create each time may be slow
    ecModel.eachComponent('geo', function (geoModel, idx) {
      var mapName = geoModel.get('map');
      var geo = new Geo$1(mapName + idx, mapName, extend({
        nameMap: geoModel.get('nameMap')
      }, getCommonGeoProperties(geoModel)));
      geo.zoomLimit = geoModel.get('scaleLimit');
      geoList.push(geo);
      // setGeoCoords(geo, geoModel);
      geoModel.coordinateSystem = geo;
      geo.model = geoModel;
      // Inject resize method
      geo.resize = resizeGeo;
      geo.resize(geoModel, api);
    });
    ecModel.eachSeries(function (seriesModel) {
      var coordSys = seriesModel.get('coordinateSystem');
      if (coordSys === 'geo') {
        var geoIndex = seriesModel.get('geoIndex') || 0;
        seriesModel.coordinateSystem = geoList[geoIndex];
      }
    });
    // If has map series
    var mapModelGroupBySeries = {};
    ecModel.eachSeriesByType('map', function (seriesModel) {
      if (!seriesModel.getHostGeoModel()) {
        var mapType = seriesModel.getMapType();
        mapModelGroupBySeries[mapType] = mapModelGroupBySeries[mapType] || [];
        mapModelGroupBySeries[mapType].push(seriesModel);
      }
    });
    each$f(mapModelGroupBySeries, function (mapSeries, mapType) {
      var nameMapList = map$1(mapSeries, function (singleMapSeries) {
        return singleMapSeries.get('nameMap');
      });
      var geo = new Geo$1(mapType, mapType, extend({
        nameMap: mergeAll(nameMapList)
      }, getCommonGeoProperties(mapSeries[0])));
      geo.zoomLimit = retrieve.apply(null, map$1(mapSeries, function (singleMapSeries) {
        return singleMapSeries.get('scaleLimit');
      }));
      geoList.push(geo);
      // Inject resize method
      geo.resize = resizeGeo;
      geo.resize(mapSeries[0], api);
      each$f(mapSeries, function (singleMapSeries) {
        singleMapSeries.coordinateSystem = geo;
        setGeoCoords(geo, singleMapSeries);
      });
    });
    return geoList;
  };
  /**
   * Fill given regions array
   */
  GeoCreator.prototype.getFilledRegions = function (originRegionArr, mapName, nameMap, nameProperty) {
    // Not use the original
    var regionsArr = (originRegionArr || []).slice();
    var dataNameMap = createHashMap();
    for (var i = 0; i < regionsArr.length; i++) {
      dataNameMap.set(regionsArr[i].name, regionsArr[i]);
    }
    var source = geoSourceManager.load(mapName, nameMap, nameProperty);
    each$f(source.regions, function (region) {
      var name = region.name;
      var regionOption = dataNameMap.get(name);
      // apply specified echarts style in GeoJSON data
      var specifiedGeoJSONRegionStyle = region.properties && region.properties.echartsStyle;
      if (!regionOption) {
        regionOption = {
          name: name
        };
        regionsArr.push(regionOption);
      }
      specifiedGeoJSONRegionStyle && merge(regionOption, specifiedGeoJSONRegionStyle);
    });
    return regionsArr;
  };
  return GeoCreator;
}();
var geoCreator = new GeoCreator();
var geoCreator$1 = geoCreator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var GeoModel = /** @class */function (_super) {
  __extends(GeoModel, _super);
  function GeoModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = GeoModel.type;
    return _this;
  }
  GeoModel.prototype.init = function (option, parentModel, ecModel) {
    var source = geoSourceManager.getGeoResource(option.map);
    if (source && source.type === 'geoJSON') {
      var itemStyle = option.itemStyle = option.itemStyle || {};
      if (!('color' in itemStyle)) {
        itemStyle.color = '#eee';
      }
    }
    this.mergeDefaultAndTheme(option, ecModel);
    // Default label emphasis `show`
    defaultEmphasis(option, 'label', ['show']);
  };
  GeoModel.prototype.optionUpdated = function () {
    var _this = this;
    var option = this.option;
    option.regions = geoCreator$1.getFilledRegions(option.regions, option.map, option.nameMap, option.nameProperty);
    var selectedMap = {};
    this._optionModelMap = reduce(option.regions || [], function (optionModelMap, regionOpt) {
      var regionName = regionOpt.name;
      if (regionName) {
        optionModelMap.set(regionName, new Model$1(regionOpt, _this, _this.ecModel));
        if (regionOpt.selected) {
          selectedMap[regionName] = true;
        }
      }
      return optionModelMap;
    }, createHashMap());
    if (!option.selectedMap) {
      option.selectedMap = selectedMap;
    }
  };
  /**
   * Get model of region.
   */
  GeoModel.prototype.getRegionModel = function (name) {
    return this._optionModelMap.get(name) || new Model$1(null, this, this.ecModel);
  };
  /**
   * Format label
   * @param name Region name
   */
  GeoModel.prototype.getFormattedLabel = function (name, status) {
    var regionModel = this.getRegionModel(name);
    var formatter = status === 'normal' ? regionModel.get(['label', 'formatter']) : regionModel.get(['emphasis', 'label', 'formatter']);
    var params = {
      name: name
    };
    if (isFunction(formatter)) {
      params.status = status;
      return formatter(params);
    } else if (isString(formatter)) {
      return formatter.replace('{a}', name != null ? name : '');
    }
  };
  GeoModel.prototype.setZoom = function (zoom) {
    this.option.zoom = zoom;
  };
  GeoModel.prototype.setCenter = function (center) {
    this.option.center = center;
  };
  // PENGING If selectedMode is null ?
  GeoModel.prototype.select = function (name) {
    var option = this.option;
    var selectedMode = option.selectedMode;
    if (!selectedMode) {
      return;
    }
    if (selectedMode !== 'multiple') {
      option.selectedMap = null;
    }
    var selectedMap = option.selectedMap || (option.selectedMap = {});
    selectedMap[name] = true;
  };
  GeoModel.prototype.unSelect = function (name) {
    var selectedMap = this.option.selectedMap;
    if (selectedMap) {
      selectedMap[name] = false;
    }
  };
  GeoModel.prototype.toggleSelected = function (name) {
    this[this.isSelected(name) ? 'unSelect' : 'select'](name);
  };
  GeoModel.prototype.isSelected = function (name) {
    var selectedMap = this.option.selectedMap;
    return !!(selectedMap && selectedMap[name]);
  };
  GeoModel.type = 'geo';
  GeoModel.layoutMode = 'box';
  GeoModel.defaultOption = {
    // zlevel: 0,
    z: 0,
    show: true,
    left: 'center',
    top: 'center',
    // Default value:
    // for geoSVG source: 1,
    // for geoJSON source: 0.75.
    aspectScale: null,
    // /// Layout with center and size
    // If you want to put map in a fixed size box with right aspect ratio
    // This two properties may be more convenient
    // layoutCenter: [50%, 50%]
    // layoutSize: 100
    silent: false,
    // Map type
    map: '',
    // Define left-top, right-bottom coords to control view
    // For example, [ [180, 90], [-180, -90] ]
    boundingCoords: null,
    // Default on center of map
    center: null,
    zoom: 1,
    scaleLimit: null,
    // selectedMode: false
    label: {
      show: false,
      color: '#000'
    },
    itemStyle: {
      borderWidth: 0.5,
      borderColor: '#444'
      // Default color:
      // + geoJSON: #eee
      // + geoSVG: null (use SVG original `fill`)
      // color: '#eee'
    },
    emphasis: {
      label: {
        show: true,
        color: 'rgb(100,0,0)'
      },
      itemStyle: {
        color: 'rgba(255,215,0,0.8)'
      }
    },
    select: {
      label: {
        show: true,
        color: 'rgb(100,0,0)'
      },
      itemStyle: {
        color: 'rgba(255,215,0,0.8)'
      }
    },
    regions: []
    // tooltip: {
    //     show: false
    // }
  };
  return GeoModel;
}(ComponentModel$1);
var GeoModel$1 = GeoModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function getCenterCoord(view, point) {
  // Use projected coord as center because it's linear.
  return view.pointToProjected ? view.pointToProjected(point) : view.pointToData(point);
}
function updateCenterAndZoom(view, payload, zoomLimit, api) {
  var previousZoom = view.getZoom();
  var center = view.getCenter();
  var zoom = payload.zoom;
  var point = view.projectedToPoint ? view.projectedToPoint(center) : view.dataToPoint(center);
  if (payload.dx != null && payload.dy != null) {
    point[0] -= payload.dx;
    point[1] -= payload.dy;
    view.setCenter(getCenterCoord(view, point), api);
  }
  if (zoom != null) {
    if (zoomLimit) {
      var zoomMin = zoomLimit.min || 0;
      var zoomMax = zoomLimit.max || Infinity;
      zoom = Math.max(Math.min(previousZoom * zoom, zoomMax), zoomMin) / previousZoom;
    }
    // Zoom on given point(originX, originY)
    view.scaleX *= zoom;
    view.scaleY *= zoom;
    var fixX = (payload.originX - view.x) * (zoom - 1);
    var fixY = (payload.originY - view.y) * (zoom - 1);
    view.x -= fixX;
    view.y -= fixY;
    view.updateTransform();
    // Get the new center
    view.setCenter(getCenterCoord(view, point), api);
    view.setZoom(zoom * previousZoom);
  }
  return {
    center: view.getCenter(),
    zoom: view.getZoom()
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var GeoView = /** @class */function (_super) {
  __extends(GeoView, _super);
  function GeoView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = GeoView.type;
    _this.focusBlurEnabled = true;
    return _this;
  }
  GeoView.prototype.init = function (ecModel, api) {
    this._api = api;
  };
  GeoView.prototype.render = function (geoModel, ecModel, api, payload) {
    this._model = geoModel;
    if (!geoModel.get('show')) {
      this._mapDraw && this._mapDraw.remove();
      this._mapDraw = null;
      return;
    }
    if (!this._mapDraw) {
      this._mapDraw = new MapDraw$1(api);
    }
    var mapDraw = this._mapDraw;
    mapDraw.draw(geoModel, ecModel, api, this, payload);
    mapDraw.group.on('click', this._handleRegionClick, this);
    mapDraw.group.silent = geoModel.get('silent');
    this.group.add(mapDraw.group);
    this.updateSelectStatus(geoModel, ecModel, api);
  };
  GeoView.prototype._handleRegionClick = function (e) {
    var eventData;
    findEventDispatcher(e.target, function (current) {
      return (eventData = getECData(current).eventData) != null;
    }, true);
    if (eventData) {
      this._api.dispatchAction({
        type: 'geoToggleSelect',
        geoId: this._model.id,
        name: eventData.name
      });
    }
  };
  GeoView.prototype.updateSelectStatus = function (model, ecModel, api) {
    var _this = this;
    this._mapDraw.group.traverse(function (node) {
      var eventData = getECData(node).eventData;
      if (eventData) {
        _this._model.isSelected(eventData.name) ? api.enterSelect(node) : api.leaveSelect(node);
        // No need to traverse children.
        return true;
      }
    });
  };
  GeoView.prototype.findHighDownDispatchers = function (name) {
    return this._mapDraw && this._mapDraw.findHighDownDispatchers(name, this._model);
  };
  GeoView.prototype.dispose = function () {
    this._mapDraw && this._mapDraw.remove();
  };
  GeoView.type = 'geo';
  return GeoView;
}(ComponentView$1);
var GeoView$1 = GeoView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function registerMap(mapName, geoJson, specialAreas) {
  geoSourceManager.registerMap(mapName, geoJson, specialAreas);
}
function install$L(registers) {
  registers.registerCoordinateSystem('geo', geoCreator$1);
  registers.registerComponentModel(GeoModel$1);
  registers.registerComponentView(GeoView$1);
  registers.registerImpl('registerMap', registerMap);
  registers.registerImpl('getMap', function (mapName) {
    return geoSourceManager.getMapForUser(mapName);
  });
  function makeAction(method, actionInfo) {
    actionInfo.update = 'geo:updateSelectStatus';
    registers.registerAction(actionInfo, function (payload, ecModel) {
      var selected = {};
      var allSelected = [];
      ecModel.eachComponent({
        mainType: 'geo',
        query: payload
      }, function (geoModel) {
        geoModel[method](payload.name);
        var geo = geoModel.coordinateSystem;
        each$f(geo.regions, function (region) {
          selected[region.name] = geoModel.isSelected(region.name) || false;
        });
        // Notice: there might be duplicated name in different regions.
        var names = [];
        each$f(selected, function (v, name) {
          selected[name] && names.push(name);
        });
        allSelected.push({
          geoIndex: geoModel.componentIndex,
          // Use singular, the same naming convention as the event `selectchanged`.
          name: names
        });
      });
      return {
        selected: selected,
        allSelected: allSelected,
        name: payload.name
      };
    });
  }
  makeAction('toggleSelected', {
    type: 'geoToggleSelect',
    event: 'geoselectchanged'
  });
  makeAction('select', {
    type: 'geoSelect',
    event: 'geoselected'
  });
  makeAction('unSelect', {
    type: 'geoUnSelect',
    event: 'geounselected'
  });
  /**
   * @payload
   * @property {string} [componentType=series]
   * @property {number} [dx]
   * @property {number} [dy]
   * @property {number} [zoom]
   * @property {number} [originX]
   * @property {number} [originY]
   */
  registers.registerAction({
    type: 'geoRoam',
    event: 'geoRoam',
    update: 'updateTransform'
  }, function (payload, ecModel, api) {
    var componentType = payload.componentType || 'series';
    ecModel.eachComponent({
      mainType: componentType,
      query: payload
    }, function (componentModel) {
      var geo = componentModel.coordinateSystem;
      if (geo.type !== 'geo') {
        return;
      }
      var res = updateCenterAndZoom(geo, payload, componentModel.get('scaleLimit'), api);
      componentModel.setCenter && componentModel.setCenter(res.center);
      componentModel.setZoom && componentModel.setZoom(res.zoom);
      // All map series with same `map` use the same geo coordinate system
      // So the center and zoom must be in sync. Include the series not selected by legend
      if (componentType === 'series') {
        each$f(componentModel.seriesGroup, function (seriesModel) {
          seriesModel.setCenter(res.center);
          seriesModel.setZoom(res.zoom);
        });
      }
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$K(registers) {
  use(install$L);
  registers.registerChartView(MapView$1);
  registers.registerSeriesModel(MapSeries$1);
  registers.registerLayout(mapSymbolLayout);
  registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, mapDataStatistic);
  createLegacyDataSelectAction('map', registers.registerAction);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Initialize all computational message for following algorithm.
 */
function init(inRoot) {
  var root = inRoot;
  root.hierNode = {
    defaultAncestor: null,
    ancestor: root,
    prelim: 0,
    modifier: 0,
    change: 0,
    shift: 0,
    i: 0,
    thread: null
  };
  var nodes = [root];
  var node;
  var children;
  while (node = nodes.pop()) {
    // jshint ignore:line
    children = node.children;
    if (node.isExpand && children.length) {
      var n = children.length;
      for (var i = n - 1; i >= 0; i--) {
        var child = children[i];
        child.hierNode = {
          defaultAncestor: null,
          ancestor: child,
          prelim: 0,
          modifier: 0,
          change: 0,
          shift: 0,
          i: i,
          thread: null
        };
        nodes.push(child);
      }
    }
  }
}
/**
 * The implementation of this function was originally copied from "d3.js"
 * <https://github.com/d3/d3-hierarchy/blob/4c1f038f2725d6eae2e49b61d01456400694bac4/src/tree.js>
 * with some modifications made for this program.
 * See the license statement at the head of this file.
 *
 * Computes a preliminary x coordinate for node. Before that, this function is
 * applied recursively to the children of node, as well as the function
 * apportion(). After spacing out the children by calling executeShifts(), the
 * node is placed to the midpoint of its outermost children.
 */
function firstWalk(node, separation) {
  var children = node.isExpand ? node.children : [];
  var siblings = node.parentNode.children;
  var subtreeW = node.hierNode.i ? siblings[node.hierNode.i - 1] : null;
  if (children.length) {
    executeShifts(node);
    var midPoint = (children[0].hierNode.prelim + children[children.length - 1].hierNode.prelim) / 2;
    if (subtreeW) {
      node.hierNode.prelim = subtreeW.hierNode.prelim + separation(node, subtreeW);
      node.hierNode.modifier = node.hierNode.prelim - midPoint;
    } else {
      node.hierNode.prelim = midPoint;
    }
  } else if (subtreeW) {
    node.hierNode.prelim = subtreeW.hierNode.prelim + separation(node, subtreeW);
  }
  node.parentNode.hierNode.defaultAncestor = apportion(node, subtreeW, node.parentNode.hierNode.defaultAncestor || siblings[0], separation);
}
/**
 * The implementation of this function was originally copied from "d3.js"
 * <https://github.com/d3/d3-hierarchy/blob/4c1f038f2725d6eae2e49b61d01456400694bac4/src/tree.js>
 * with some modifications made for this program.
 * See the license statement at the head of this file.
 *
 * Computes all real x-coordinates by summing up the modifiers recursively.
 */
function secondWalk(node) {
  var nodeX = node.hierNode.prelim + node.parentNode.hierNode.modifier;
  node.setLayout({
    x: nodeX
  }, true);
  node.hierNode.modifier += node.parentNode.hierNode.modifier;
}
function separation(cb) {
  return arguments.length ? cb : defaultSeparation;
}
/**
 * Transform the common coordinate to radial coordinate.
 */
function radialCoordinate(rad, r) {
  rad -= Math.PI / 2;
  return {
    x: r * Math.cos(rad),
    y: r * Math.sin(rad)
  };
}
/**
 * Get the layout position of the whole view.
 */
function getViewRect$4(seriesModel, api) {
  return getLayoutRect(seriesModel.getBoxLayoutParams(), {
    width: api.getWidth(),
    height: api.getHeight()
  });
}
/**
 * All other shifts, applied to the smaller subtrees between w- and w+, are
 * performed by this function.
 *
 * The implementation of this function was originally copied from "d3.js"
 * <https://github.com/d3/d3-hierarchy/blob/4c1f038f2725d6eae2e49b61d01456400694bac4/src/tree.js>
 * with some modifications made for this program.
 * See the license statement at the head of this file.
 */
function executeShifts(node) {
  var children = node.children;
  var n = children.length;
  var shift = 0;
  var change = 0;
  while (--n >= 0) {
    var child = children[n];
    child.hierNode.prelim += shift;
    child.hierNode.modifier += shift;
    change += child.hierNode.change;
    shift += child.hierNode.shift + change;
  }
}
/**
 * The implementation of this function was originally copied from "d3.js"
 * <https://github.com/d3/d3-hierarchy/blob/4c1f038f2725d6eae2e49b61d01456400694bac4/src/tree.js>
 * with some modifications made for this program.
 * See the license statement at the head of this file.
 *
 * The core of the algorithm. Here, a new subtree is combined with the
 * previous subtrees. Threads are used to traverse the inside and outside
 * contours of the left and right subtree up to the highest common level.
 * Whenever two nodes of the inside contours conflict, we compute the left
 * one of the greatest uncommon ancestors using the function nextAncestor()
 * and call moveSubtree() to shift the subtree and prepare the shifts of
 * smaller subtrees. Finally, we add a new thread (if necessary).
 */
function apportion(subtreeV, subtreeW, ancestor, separation) {
  if (subtreeW) {
    var nodeOutRight = subtreeV;
    var nodeInRight = subtreeV;
    var nodeOutLeft = nodeInRight.parentNode.children[0];
    var nodeInLeft = subtreeW;
    var sumOutRight = nodeOutRight.hierNode.modifier;
    var sumInRight = nodeInRight.hierNode.modifier;
    var sumOutLeft = nodeOutLeft.hierNode.modifier;
    var sumInLeft = nodeInLeft.hierNode.modifier;
    while (nodeInLeft = nextRight(nodeInLeft), nodeInRight = nextLeft(nodeInRight), nodeInLeft && nodeInRight) {
      nodeOutRight = nextRight(nodeOutRight);
      nodeOutLeft = nextLeft(nodeOutLeft);
      nodeOutRight.hierNode.ancestor = subtreeV;
      var shift = nodeInLeft.hierNode.prelim + sumInLeft - nodeInRight.hierNode.prelim - sumInRight + separation(nodeInLeft, nodeInRight);
      if (shift > 0) {
        moveSubtree(nextAncestor(nodeInLeft, subtreeV, ancestor), subtreeV, shift);
        sumInRight += shift;
        sumOutRight += shift;
      }
      sumInLeft += nodeInLeft.hierNode.modifier;
      sumInRight += nodeInRight.hierNode.modifier;
      sumOutRight += nodeOutRight.hierNode.modifier;
      sumOutLeft += nodeOutLeft.hierNode.modifier;
    }
    if (nodeInLeft && !nextRight(nodeOutRight)) {
      nodeOutRight.hierNode.thread = nodeInLeft;
      nodeOutRight.hierNode.modifier += sumInLeft - sumOutRight;
    }
    if (nodeInRight && !nextLeft(nodeOutLeft)) {
      nodeOutLeft.hierNode.thread = nodeInRight;
      nodeOutLeft.hierNode.modifier += sumInRight - sumOutLeft;
      ancestor = subtreeV;
    }
  }
  return ancestor;
}
/**
 * This function is used to traverse the right contour of a subtree.
 * It returns the rightmost child of node or the thread of node. The function
 * returns null if and only if node is on the highest depth of its subtree.
 */
function nextRight(node) {
  var children = node.children;
  return children.length && node.isExpand ? children[children.length - 1] : node.hierNode.thread;
}
/**
 * This function is used to traverse the left contour of a subtree (or a subforest).
 * It returns the leftmost child of node or the thread of node. The function
 * returns null if and only if node is on the highest depth of its subtree.
 */
function nextLeft(node) {
  var children = node.children;
  return children.length && node.isExpand ? children[0] : node.hierNode.thread;
}
/**
 * If nodeInLeft’s ancestor is a sibling of node, returns nodeInLeft’s ancestor.
 * Otherwise, returns the specified ancestor.
 */
function nextAncestor(nodeInLeft, node, ancestor) {
  return nodeInLeft.hierNode.ancestor.parentNode === node.parentNode ? nodeInLeft.hierNode.ancestor : ancestor;
}
/**
 * The implementation of this function was originally copied from "d3.js"
 * <https://github.com/d3/d3-hierarchy/blob/4c1f038f2725d6eae2e49b61d01456400694bac4/src/tree.js>
 * with some modifications made for this program.
 * See the license statement at the head of this file.
 *
 * Shifts the current subtree rooted at wr.
 * This is done by increasing prelim(w+) and modifier(w+) by shift.
 */
function moveSubtree(wl, wr, shift) {
  var change = shift / (wr.hierNode.i - wl.hierNode.i);
  wr.hierNode.change -= change;
  wr.hierNode.shift += shift;
  wr.hierNode.modifier += shift;
  wr.hierNode.prelim += shift;
  wl.hierNode.change += change;
}
/**
 * The implementation of this function was originally copied from "d3.js"
 * <https://github.com/d3/d3-hierarchy/blob/4c1f038f2725d6eae2e49b61d01456400694bac4/src/tree.js>
 * with some modifications made for this program.
 * See the license statement at the head of this file.
 */
function defaultSeparation(node1, node2) {
  return node1.parentNode === node2.parentNode ? 1 : 2;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TreeEdgeShape = /** @class */function () {
  function TreeEdgeShape() {
    this.parentPoint = [];
    this.childPoints = [];
  }
  return TreeEdgeShape;
}();
var TreePath = /** @class */function (_super) {
  __extends(TreePath, _super);
  function TreePath(opts) {
    return _super.call(this, opts) || this;
  }
  TreePath.prototype.getDefaultStyle = function () {
    return {
      stroke: '#000',
      fill: null
    };
  };
  TreePath.prototype.getDefaultShape = function () {
    return new TreeEdgeShape();
  };
  TreePath.prototype.buildPath = function (ctx, shape) {
    var childPoints = shape.childPoints;
    var childLen = childPoints.length;
    var parentPoint = shape.parentPoint;
    var firstChildPos = childPoints[0];
    var lastChildPos = childPoints[childLen - 1];
    if (childLen === 1) {
      ctx.moveTo(parentPoint[0], parentPoint[1]);
      ctx.lineTo(firstChildPos[0], firstChildPos[1]);
      return;
    }
    var orient = shape.orient;
    var forkDim = orient === 'TB' || orient === 'BT' ? 0 : 1;
    var otherDim = 1 - forkDim;
    var forkPosition = parsePercent(shape.forkPosition, 1);
    var tmpPoint = [];
    tmpPoint[forkDim] = parentPoint[forkDim];
    tmpPoint[otherDim] = parentPoint[otherDim] + (lastChildPos[otherDim] - parentPoint[otherDim]) * forkPosition;
    ctx.moveTo(parentPoint[0], parentPoint[1]);
    ctx.lineTo(tmpPoint[0], tmpPoint[1]);
    ctx.moveTo(firstChildPos[0], firstChildPos[1]);
    tmpPoint[forkDim] = firstChildPos[forkDim];
    ctx.lineTo(tmpPoint[0], tmpPoint[1]);
    tmpPoint[forkDim] = lastChildPos[forkDim];
    ctx.lineTo(tmpPoint[0], tmpPoint[1]);
    ctx.lineTo(lastChildPos[0], lastChildPos[1]);
    for (var i = 1; i < childLen - 1; i++) {
      var point = childPoints[i];
      ctx.moveTo(point[0], point[1]);
      tmpPoint[forkDim] = point[forkDim];
      ctx.lineTo(tmpPoint[0], tmpPoint[1]);
    }
  };
  return TreePath;
}(Path$1);
var TreeView = /** @class */function (_super) {
  __extends(TreeView, _super);
  function TreeView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = TreeView.type;
    _this._mainGroup = new Group$5();
    return _this;
  }
  TreeView.prototype.init = function (ecModel, api) {
    this._controller = new RoamController$1(api.getZr());
    this._controllerHost = {
      target: this.group
    };
    this.group.add(this._mainGroup);
  };
  TreeView.prototype.render = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var layoutInfo = seriesModel.layoutInfo;
    var group = this._mainGroup;
    var layout = seriesModel.get('layout');
    if (layout === 'radial') {
      group.x = layoutInfo.x + layoutInfo.width / 2;
      group.y = layoutInfo.y + layoutInfo.height / 2;
    } else {
      group.x = layoutInfo.x;
      group.y = layoutInfo.y;
    }
    this._updateViewCoordSys(seriesModel, api);
    this._updateController(seriesModel, ecModel, api);
    var oldData = this._data;
    data.diff(oldData).add(function (newIdx) {
      if (symbolNeedsDraw(data, newIdx)) {
        // Create node and edge
        updateNode(data, newIdx, null, group, seriesModel);
      }
    }).update(function (newIdx, oldIdx) {
      var symbolEl = oldData.getItemGraphicEl(oldIdx);
      if (!symbolNeedsDraw(data, newIdx)) {
        symbolEl && removeNode$1(oldData, oldIdx, symbolEl, group, seriesModel);
        return;
      }
      // Update node and edge
      updateNode(data, newIdx, symbolEl, group, seriesModel);
    }).remove(function (oldIdx) {
      var symbolEl = oldData.getItemGraphicEl(oldIdx);
      // When remove a collapsed node of subtree, since the collapsed
      // node haven't been initialized with a symbol element,
      // you can't found it's symbol element through index.
      // so if we want to remove the symbol element we should insure
      // that the symbol element is not null.
      if (symbolEl) {
        removeNode$1(oldData, oldIdx, symbolEl, group, seriesModel);
      }
    }).execute();
    this._nodeScaleRatio = seriesModel.get('nodeScaleRatio');
    this._updateNodeAndLinkScale(seriesModel);
    if (seriesModel.get('expandAndCollapse') === true) {
      data.eachItemGraphicEl(function (el, dataIndex) {
        el.off('click').on('click', function () {
          api.dispatchAction({
            type: 'treeExpandAndCollapse',
            seriesId: seriesModel.id,
            dataIndex: dataIndex
          });
        });
      });
    }
    this._data = data;
  };
  TreeView.prototype._updateViewCoordSys = function (seriesModel, api) {
    var data = seriesModel.getData();
    var points = [];
    data.each(function (idx) {
      var layout = data.getItemLayout(idx);
      if (layout && !isNaN(layout.x) && !isNaN(layout.y)) {
        points.push([+layout.x, +layout.y]);
      }
    });
    var min = [];
    var max = [];
    fromPoints(points, min, max);
    // If don't Store min max when collapse the root node after roam,
    // the root node will disappear.
    var oldMin = this._min;
    var oldMax = this._max;
    // If width or height is 0
    if (max[0] - min[0] === 0) {
      min[0] = oldMin ? oldMin[0] : min[0] - 1;
      max[0] = oldMax ? oldMax[0] : max[0] + 1;
    }
    if (max[1] - min[1] === 0) {
      min[1] = oldMin ? oldMin[1] : min[1] - 1;
      max[1] = oldMax ? oldMax[1] : max[1] + 1;
    }
    var viewCoordSys = seriesModel.coordinateSystem = new View$1();
    viewCoordSys.zoomLimit = seriesModel.get('scaleLimit');
    viewCoordSys.setBoundingRect(min[0], min[1], max[0] - min[0], max[1] - min[1]);
    viewCoordSys.setCenter(seriesModel.get('center'), api);
    viewCoordSys.setZoom(seriesModel.get('zoom'));
    // Here we use viewCoordSys just for computing the 'position' and 'scale' of the group
    this.group.attr({
      x: viewCoordSys.x,
      y: viewCoordSys.y,
      scaleX: viewCoordSys.scaleX,
      scaleY: viewCoordSys.scaleY
    });
    this._min = min;
    this._max = max;
  };
  TreeView.prototype._updateController = function (seriesModel, ecModel, api) {
    var _this = this;
    var controller = this._controller;
    var controllerHost = this._controllerHost;
    var group = this.group;
    controller.setPointerChecker(function (e, x, y) {
      var rect = group.getBoundingRect();
      rect.applyTransform(group.transform);
      return rect.contain(x, y) && !onIrrelevantElement(e, api, seriesModel);
    });
    controller.enable(seriesModel.get('roam'));
    controllerHost.zoomLimit = seriesModel.get('scaleLimit');
    controllerHost.zoom = seriesModel.coordinateSystem.getZoom();
    controller.off('pan').off('zoom').on('pan', function (e) {
      updateViewOnPan(controllerHost, e.dx, e.dy);
      api.dispatchAction({
        seriesId: seriesModel.id,
        type: 'treeRoam',
        dx: e.dx,
        dy: e.dy
      });
    }).on('zoom', function (e) {
      updateViewOnZoom(controllerHost, e.scale, e.originX, e.originY);
      api.dispatchAction({
        seriesId: seriesModel.id,
        type: 'treeRoam',
        zoom: e.scale,
        originX: e.originX,
        originY: e.originY
      });
      _this._updateNodeAndLinkScale(seriesModel);
      // Only update label layout on zoom
      api.updateLabelLayout();
    });
  };
  TreeView.prototype._updateNodeAndLinkScale = function (seriesModel) {
    var data = seriesModel.getData();
    var nodeScale = this._getNodeGlobalScale(seriesModel);
    data.eachItemGraphicEl(function (el, idx) {
      el.setSymbolScale(nodeScale);
    });
  };
  TreeView.prototype._getNodeGlobalScale = function (seriesModel) {
    var coordSys = seriesModel.coordinateSystem;
    if (coordSys.type !== 'view') {
      return 1;
    }
    var nodeScaleRatio = this._nodeScaleRatio;
    var groupZoom = coordSys.scaleX || 1;
    // Scale node when zoom changes
    var roamZoom = coordSys.getZoom();
    var nodeScale = (roamZoom - 1) * nodeScaleRatio + 1;
    return nodeScale / groupZoom;
  };
  TreeView.prototype.dispose = function () {
    this._controller && this._controller.dispose();
    this._controllerHost = null;
  };
  TreeView.prototype.remove = function () {
    this._mainGroup.removeAll();
    this._data = null;
  };
  TreeView.type = 'tree';
  return TreeView;
}(ChartView$1);
function symbolNeedsDraw(data, dataIndex) {
  var layout = data.getItemLayout(dataIndex);
  return layout && !isNaN(layout.x) && !isNaN(layout.y);
}
function updateNode(data, dataIndex, symbolEl, group, seriesModel) {
  var isInit = !symbolEl;
  var node = data.tree.getNodeByDataIndex(dataIndex);
  var itemModel = node.getModel();
  var visualColor = node.getVisual('style').fill;
  var symbolInnerColor = node.isExpand === false && node.children.length !== 0 ? visualColor : '#fff';
  var virtualRoot = data.tree.root;
  var source = node.parentNode === virtualRoot ? node : node.parentNode || node;
  var sourceSymbolEl = data.getItemGraphicEl(source.dataIndex);
  var sourceLayout = source.getLayout();
  var sourceOldLayout = sourceSymbolEl ? {
    x: sourceSymbolEl.__oldX,
    y: sourceSymbolEl.__oldY,
    rawX: sourceSymbolEl.__radialOldRawX,
    rawY: sourceSymbolEl.__radialOldRawY
  } : sourceLayout;
  var targetLayout = node.getLayout();
  if (isInit) {
    symbolEl = new SymbolClz(data, dataIndex, null, {
      symbolInnerColor: symbolInnerColor,
      useNameLabel: true
    });
    symbolEl.x = sourceOldLayout.x;
    symbolEl.y = sourceOldLayout.y;
  } else {
    symbolEl.updateData(data, dataIndex, null, {
      symbolInnerColor: symbolInnerColor,
      useNameLabel: true
    });
  }
  symbolEl.__radialOldRawX = symbolEl.__radialRawX;
  symbolEl.__radialOldRawY = symbolEl.__radialRawY;
  symbolEl.__radialRawX = targetLayout.rawX;
  symbolEl.__radialRawY = targetLayout.rawY;
  group.add(symbolEl);
  data.setItemGraphicEl(dataIndex, symbolEl);
  symbolEl.__oldX = symbolEl.x;
  symbolEl.__oldY = symbolEl.y;
  updateProps$1(symbolEl, {
    x: targetLayout.x,
    y: targetLayout.y
  }, seriesModel);
  var symbolPath = symbolEl.getSymbolPath();
  if (seriesModel.get('layout') === 'radial') {
    var realRoot = virtualRoot.children[0];
    var rootLayout = realRoot.getLayout();
    var length_1 = realRoot.children.length;
    var rad = void 0;
    var isLeft = void 0;
    if (targetLayout.x === rootLayout.x && node.isExpand === true && realRoot.children.length) {
      var center = {
        x: (realRoot.children[0].getLayout().x + realRoot.children[length_1 - 1].getLayout().x) / 2,
        y: (realRoot.children[0].getLayout().y + realRoot.children[length_1 - 1].getLayout().y) / 2
      };
      rad = Math.atan2(center.y - rootLayout.y, center.x - rootLayout.x);
      if (rad < 0) {
        rad = Math.PI * 2 + rad;
      }
      isLeft = center.x < rootLayout.x;
      if (isLeft) {
        rad = rad - Math.PI;
      }
    } else {
      rad = Math.atan2(targetLayout.y - rootLayout.y, targetLayout.x - rootLayout.x);
      if (rad < 0) {
        rad = Math.PI * 2 + rad;
      }
      if (node.children.length === 0 || node.children.length !== 0 && node.isExpand === false) {
        isLeft = targetLayout.x < rootLayout.x;
        if (isLeft) {
          rad = rad - Math.PI;
        }
      } else {
        isLeft = targetLayout.x > rootLayout.x;
        if (!isLeft) {
          rad = rad - Math.PI;
        }
      }
    }
    var textPosition = isLeft ? 'left' : 'right';
    var normalLabelModel = itemModel.getModel('label');
    var rotate = normalLabelModel.get('rotate');
    var labelRotateRadian = rotate * (Math.PI / 180);
    var textContent = symbolPath.getTextContent();
    if (textContent) {
      symbolPath.setTextConfig({
        position: normalLabelModel.get('position') || textPosition,
        rotation: rotate == null ? -rad : labelRotateRadian,
        origin: 'center'
      });
      textContent.setStyle('verticalAlign', 'middle');
    }
  }
  // Handle status
  var focus = itemModel.get(['emphasis', 'focus']);
  var focusDataIndices = focus === 'relative' ? concatArray(node.getAncestorsIndices(), node.getDescendantIndices()) : focus === 'ancestor' ? node.getAncestorsIndices() : focus === 'descendant' ? node.getDescendantIndices() : null;
  if (focusDataIndices) {
    // Modify the focus to data indices.
    getECData(symbolEl).focus = focusDataIndices;
  }
  drawEdge(seriesModel, node, virtualRoot, symbolEl, sourceOldLayout, sourceLayout, targetLayout, group);
  if (symbolEl.__edge) {
    symbolEl.onHoverStateChange = function (toState) {
      if (toState !== 'blur') {
        // NOTE: Ensure the parent elements will been blurred firstly.
        // According to the return of getAncestorsIndices and getDescendantIndices
        // TODO: A bit tricky.
        var parentEl = node.parentNode && data.getItemGraphicEl(node.parentNode.dataIndex);
        if (!(parentEl && parentEl.hoverState === HOVER_STATE_BLUR)) {
          setStatesFlag(symbolEl.__edge, toState);
        }
      }
    };
  }
}
function drawEdge(seriesModel, node, virtualRoot, symbolEl, sourceOldLayout, sourceLayout, targetLayout, group) {
  var itemModel = node.getModel();
  var edgeShape = seriesModel.get('edgeShape');
  var layout = seriesModel.get('layout');
  var orient = seriesModel.getOrient();
  var curvature = seriesModel.get(['lineStyle', 'curveness']);
  var edgeForkPosition = seriesModel.get('edgeForkPosition');
  var lineStyle = itemModel.getModel('lineStyle').getLineStyle();
  var edge = symbolEl.__edge;
  // curve edge from node -> parent
  // polyline edge from node -> children
  if (edgeShape === 'curve') {
    if (node.parentNode && node.parentNode !== virtualRoot) {
      if (!edge) {
        edge = symbolEl.__edge = new BezierCurve$1({
          shape: getEdgeShape(layout, orient, curvature, sourceOldLayout, sourceOldLayout)
        });
      }
      updateProps$1(edge, {
        shape: getEdgeShape(layout, orient, curvature, sourceLayout, targetLayout)
      }, seriesModel);
    }
  } else if (edgeShape === 'polyline') {
    if (layout === 'orthogonal') {
      if (node !== virtualRoot && node.children && node.children.length !== 0 && node.isExpand === true) {
        var children = node.children;
        var childPoints = [];
        for (var i = 0; i < children.length; i++) {
          var childLayout = children[i].getLayout();
          childPoints.push([childLayout.x, childLayout.y]);
        }
        if (!edge) {
          edge = symbolEl.__edge = new TreePath({
            shape: {
              parentPoint: [targetLayout.x, targetLayout.y],
              childPoints: [[targetLayout.x, targetLayout.y]],
              orient: orient,
              forkPosition: edgeForkPosition
            }
          });
        }
        updateProps$1(edge, {
          shape: {
            parentPoint: [targetLayout.x, targetLayout.y],
            childPoints: childPoints
          }
        }, seriesModel);
      }
    } else {
      {
        throw new Error('The polyline edgeShape can only be used in orthogonal layout');
      }
    }
  }
  // show all edge when edgeShape is 'curve', filter node `isExpand` is false when edgeShape is 'polyline'
  if (edge && !(edgeShape === 'polyline' && !node.isExpand)) {
    edge.useStyle(defaults({
      strokeNoScale: true,
      fill: null
    }, lineStyle));
    setStatesStylesFromModel(edge, itemModel, 'lineStyle');
    setDefaultStateProxy(edge);
    group.add(edge);
  }
}
function removeNodeEdge(node, data, group, seriesModel, removeAnimationOpt) {
  var virtualRoot = data.tree.root;
  var _a = getSourceNode(virtualRoot, node),
    source = _a.source,
    sourceLayout = _a.sourceLayout;
  var symbolEl = data.getItemGraphicEl(node.dataIndex);
  if (!symbolEl) {
    return;
  }
  var sourceSymbolEl = data.getItemGraphicEl(source.dataIndex);
  var sourceEdge = sourceSymbolEl.__edge;
  // 1. when expand the sub tree, delete the children node should delete the edge of
  // the source at the same time. because the polyline edge shape is only owned by the source.
  // 2.when the node is the only children of the source, delete the node should delete the edge of
  // the source at the same time. the same reason as above.
  var edge = symbolEl.__edge || (source.isExpand === false || source.children.length === 1 ? sourceEdge : undefined);
  var edgeShape = seriesModel.get('edgeShape');
  var layoutOpt = seriesModel.get('layout');
  var orient = seriesModel.get('orient');
  var curvature = seriesModel.get(['lineStyle', 'curveness']);
  if (edge) {
    if (edgeShape === 'curve') {
      removeElement(edge, {
        shape: getEdgeShape(layoutOpt, orient, curvature, sourceLayout, sourceLayout),
        style: {
          opacity: 0
        }
      }, seriesModel, {
        cb: function () {
          group.remove(edge);
        },
        removeOpt: removeAnimationOpt
      });
    } else if (edgeShape === 'polyline' && seriesModel.get('layout') === 'orthogonal') {
      removeElement(edge, {
        shape: {
          parentPoint: [sourceLayout.x, sourceLayout.y],
          childPoints: [[sourceLayout.x, sourceLayout.y]]
        },
        style: {
          opacity: 0
        }
      }, seriesModel, {
        cb: function () {
          group.remove(edge);
        },
        removeOpt: removeAnimationOpt
      });
    }
  }
}
function getSourceNode(virtualRoot, node) {
  var source = node.parentNode === virtualRoot ? node : node.parentNode || node;
  var sourceLayout;
  while (sourceLayout = source.getLayout(), sourceLayout == null) {
    source = source.parentNode === virtualRoot ? source : source.parentNode || source;
  }
  return {
    source: source,
    sourceLayout: sourceLayout
  };
}
function removeNode$1(data, dataIndex, symbolEl, group, seriesModel) {
  var node = data.tree.getNodeByDataIndex(dataIndex);
  var virtualRoot = data.tree.root;
  var sourceLayout = getSourceNode(virtualRoot, node).sourceLayout;
  // Use same duration and easing with update to have more consistent animation.
  var removeAnimationOpt = {
    duration: seriesModel.get('animationDurationUpdate'),
    easing: seriesModel.get('animationEasingUpdate')
  };
  removeElement(symbolEl, {
    x: sourceLayout.x + 1,
    y: sourceLayout.y + 1
  }, seriesModel, {
    cb: function () {
      group.remove(symbolEl);
      data.setItemGraphicEl(dataIndex, null);
    },
    removeOpt: removeAnimationOpt
  });
  symbolEl.fadeOut(null, data.hostModel, {
    fadeLabel: true,
    animation: removeAnimationOpt
  });
  // remove edge as parent node
  node.children.forEach(function (childNode) {
    removeNodeEdge(childNode, data, group, seriesModel, removeAnimationOpt);
  });
  // remove edge as child node
  removeNodeEdge(node, data, group, seriesModel, removeAnimationOpt);
}
function getEdgeShape(layoutOpt, orient, curvature, sourceLayout, targetLayout) {
  var cpx1;
  var cpy1;
  var cpx2;
  var cpy2;
  var x1;
  var x2;
  var y1;
  var y2;
  if (layoutOpt === 'radial') {
    x1 = sourceLayout.rawX;
    y1 = sourceLayout.rawY;
    x2 = targetLayout.rawX;
    y2 = targetLayout.rawY;
    var radialCoor1 = radialCoordinate(x1, y1);
    var radialCoor2 = radialCoordinate(x1, y1 + (y2 - y1) * curvature);
    var radialCoor3 = radialCoordinate(x2, y2 + (y1 - y2) * curvature);
    var radialCoor4 = radialCoordinate(x2, y2);
    return {
      x1: radialCoor1.x || 0,
      y1: radialCoor1.y || 0,
      x2: radialCoor4.x || 0,
      y2: radialCoor4.y || 0,
      cpx1: radialCoor2.x || 0,
      cpy1: radialCoor2.y || 0,
      cpx2: radialCoor3.x || 0,
      cpy2: radialCoor3.y || 0
    };
  } else {
    x1 = sourceLayout.x;
    y1 = sourceLayout.y;
    x2 = targetLayout.x;
    y2 = targetLayout.y;
    if (orient === 'LR' || orient === 'RL') {
      cpx1 = x1 + (x2 - x1) * curvature;
      cpy1 = y1;
      cpx2 = x2 + (x1 - x2) * curvature;
      cpy2 = y2;
    }
    if (orient === 'TB' || orient === 'BT') {
      cpx1 = x1;
      cpy1 = y1 + (y2 - y1) * curvature;
      cpx2 = x2;
      cpy2 = y2 + (y1 - y2) * curvature;
    }
  }
  return {
    x1: x1,
    y1: y1,
    x2: x2,
    y2: y2,
    cpx1: cpx1,
    cpy1: cpy1,
    cpx2: cpx2,
    cpy2: cpy2
  };
}
var TreeView$1 = TreeView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$e = makeInner();
function linkSeriesData(opt) {
  var mainData = opt.mainData;
  var datas = opt.datas;
  if (!datas) {
    datas = {
      main: mainData
    };
    opt.datasAttr = {
      main: 'data'
    };
  }
  opt.datas = opt.mainData = null;
  linkAll(mainData, datas, opt);
  // Porxy data original methods.
  each$f(datas, function (data) {
    each$f(mainData.TRANSFERABLE_METHODS, function (methodName) {
      data.wrapMethod(methodName, curry$1(transferInjection, opt));
    });
  });
  // Beyond transfer, additional features should be added to `cloneShallow`.
  mainData.wrapMethod('cloneShallow', curry$1(cloneShallowInjection, opt));
  // Only mainData trigger change, because struct.update may trigger
  // another changable methods, which may bring about dead lock.
  each$f(mainData.CHANGABLE_METHODS, function (methodName) {
    mainData.wrapMethod(methodName, curry$1(changeInjection, opt));
  });
  // Make sure datas contains mainData.
  assert(datas[mainData.dataType] === mainData);
}
function transferInjection(opt, res) {
  if (isMainData(this)) {
    // Transfer datas to new main data.
    var datas = extend({}, inner$e(this).datas);
    datas[this.dataType] = res;
    linkAll(res, datas, opt);
  } else {
    // Modify the reference in main data to point newData.
    linkSingle(res, this.dataType, inner$e(this).mainData, opt);
  }
  return res;
}
function changeInjection(opt, res) {
  opt.struct && opt.struct.update();
  return res;
}
function cloneShallowInjection(opt, res) {
  // cloneShallow, which brings about some fragilities, may be inappropriate
  // to be exposed as an API. So for implementation simplicity we can make
  // the restriction that cloneShallow of not-mainData should not be invoked
  // outside, but only be invoked here.
  each$f(inner$e(res).datas, function (data, dataType) {
    data !== res && linkSingle(data.cloneShallow(), dataType, res, opt);
  });
  return res;
}
/**
 * Supplement method to List.
 *
 * @public
 * @param [dataType] If not specified, return mainData.
 */
function getLinkedData(dataType) {
  var mainData = inner$e(this).mainData;
  return dataType == null || mainData == null ? mainData : inner$e(mainData).datas[dataType];
}
/**
 * Get list of all linked data
 */
function getLinkedDataAll() {
  var mainData = inner$e(this).mainData;
  return mainData == null ? [{
    data: mainData
  }] : map$1(keys(inner$e(mainData).datas), function (type) {
    return {
      type: type,
      data: inner$e(mainData).datas[type]
    };
  });
}
function isMainData(data) {
  return inner$e(data).mainData === data;
}
function linkAll(mainData, datas, opt) {
  inner$e(mainData).datas = {};
  each$f(datas, function (data, dataType) {
    linkSingle(data, dataType, mainData, opt);
  });
}
function linkSingle(data, dataType, mainData, opt) {
  inner$e(mainData).datas[dataType] = data;
  inner$e(data).mainData = mainData;
  data.dataType = dataType;
  if (opt.struct) {
    data[opt.structAttr] = opt.struct;
    opt.struct[opt.datasAttr[dataType]] = data;
  }
  // Supplement method.
  data.getLinkedData = getLinkedData;
  data.getLinkedDataAll = getLinkedDataAll;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TreeNode = /** @class */function () {
  function TreeNode(name, hostTree) {
    this.depth = 0;
    this.height = 0;
    /**
     * Reference to list item.
     * Do not persistent dataIndex outside,
     * besause it may be changed by list.
     * If dataIndex -1,
     * this node is logical deleted (filtered) in list.
     */
    this.dataIndex = -1;
    this.children = [];
    this.viewChildren = [];
    this.isExpand = false;
    this.name = name || '';
    this.hostTree = hostTree;
  }
  /**
   * The node is removed.
   */
  TreeNode.prototype.isRemoved = function () {
    return this.dataIndex < 0;
  };
  TreeNode.prototype.eachNode = function (options, cb, context) {
    if (isFunction(options)) {
      context = cb;
      cb = options;
      options = null;
    }
    options = options || {};
    if (isString(options)) {
      options = {
        order: options
      };
    }
    var order = options.order || 'preorder';
    var children = this[options.attr || 'children'];
    var suppressVisitSub;
    order === 'preorder' && (suppressVisitSub = cb.call(context, this));
    for (var i = 0; !suppressVisitSub && i < children.length; i++) {
      children[i].eachNode(options, cb, context);
    }
    order === 'postorder' && cb.call(context, this);
  };
  /**
   * Update depth and height of this subtree.
   */
  TreeNode.prototype.updateDepthAndHeight = function (depth) {
    var height = 0;
    this.depth = depth;
    for (var i = 0; i < this.children.length; i++) {
      var child = this.children[i];
      child.updateDepthAndHeight(depth + 1);
      if (child.height > height) {
        height = child.height;
      }
    }
    this.height = height + 1;
  };
  TreeNode.prototype.getNodeById = function (id) {
    if (this.getId() === id) {
      return this;
    }
    for (var i = 0, children = this.children, len = children.length; i < len; i++) {
      var res = children[i].getNodeById(id);
      if (res) {
        return res;
      }
    }
  };
  TreeNode.prototype.contains = function (node) {
    if (node === this) {
      return true;
    }
    for (var i = 0, children = this.children, len = children.length; i < len; i++) {
      var res = children[i].contains(node);
      if (res) {
        return res;
      }
    }
  };
  /**
   * @param includeSelf Default false.
   * @return order: [root, child, grandchild, ...]
   */
  TreeNode.prototype.getAncestors = function (includeSelf) {
    var ancestors = [];
    var node = includeSelf ? this : this.parentNode;
    while (node) {
      ancestors.push(node);
      node = node.parentNode;
    }
    ancestors.reverse();
    return ancestors;
  };
  TreeNode.prototype.getAncestorsIndices = function () {
    var indices = [];
    var currNode = this;
    while (currNode) {
      indices.push(currNode.dataIndex);
      currNode = currNode.parentNode;
    }
    indices.reverse();
    return indices;
  };
  TreeNode.prototype.getDescendantIndices = function () {
    var indices = [];
    this.eachNode(function (childNode) {
      indices.push(childNode.dataIndex);
    });
    return indices;
  };
  TreeNode.prototype.getValue = function (dimension) {
    var data = this.hostTree.data;
    return data.getStore().get(data.getDimensionIndex(dimension || 'value'), this.dataIndex);
  };
  TreeNode.prototype.setLayout = function (layout, merge) {
    this.dataIndex >= 0 && this.hostTree.data.setItemLayout(this.dataIndex, layout, merge);
  };
  /**
   * @return {Object} layout
   */
  TreeNode.prototype.getLayout = function () {
    return this.hostTree.data.getItemLayout(this.dataIndex);
  };
  // @depcrecated
  // getModel<T = unknown, S extends keyof T = keyof T>(path: S): Model<T[S]>
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  TreeNode.prototype.getModel = function (path) {
    if (this.dataIndex < 0) {
      return;
    }
    var hostTree = this.hostTree;
    var itemModel = hostTree.data.getItemModel(this.dataIndex);
    return itemModel.getModel(path);
  };
  // TODO: TYPE More specific model
  TreeNode.prototype.getLevelModel = function () {
    return (this.hostTree.levelModels || [])[this.depth];
  };
  TreeNode.prototype.setVisual = function (key, value) {
    this.dataIndex >= 0 && this.hostTree.data.setItemVisual(this.dataIndex, key, value);
  };
  /**
   * Get item visual
   * FIXME: make return type better
   */
  TreeNode.prototype.getVisual = function (key) {
    return this.hostTree.data.getItemVisual(this.dataIndex, key);
  };
  TreeNode.prototype.getRawIndex = function () {
    return this.hostTree.data.getRawIndex(this.dataIndex);
  };
  TreeNode.prototype.getId = function () {
    return this.hostTree.data.getId(this.dataIndex);
  };
  /**
   * index in parent's children
   */
  TreeNode.prototype.getChildIndex = function () {
    if (this.parentNode) {
      var children = this.parentNode.children;
      for (var i = 0; i < children.length; ++i) {
        if (children[i] === this) {
          return i;
        }
      }
      return -1;
    }
    return -1;
  };
  /**
   * if this is an ancestor of another node
   *
   * @param node another node
   * @return if is ancestor
   */
  TreeNode.prototype.isAncestorOf = function (node) {
    var parent = node.parentNode;
    while (parent) {
      if (parent === this) {
        return true;
      }
      parent = parent.parentNode;
    }
    return false;
  };
  /**
   * if this is an descendant of another node
   *
   * @param node another node
   * @return if is descendant
   */
  TreeNode.prototype.isDescendantOf = function (node) {
    return node !== this && node.isAncestorOf(this);
  };
  return TreeNode;
}();
var Tree = /** @class */function () {
  function Tree(hostModel) {
    this.type = 'tree';
    this._nodes = [];
    this.hostModel = hostModel;
  }
  Tree.prototype.eachNode = function (options, cb, context) {
    this.root.eachNode(options, cb, context);
  };
  Tree.prototype.getNodeByDataIndex = function (dataIndex) {
    var rawIndex = this.data.getRawIndex(dataIndex);
    return this._nodes[rawIndex];
  };
  Tree.prototype.getNodeById = function (name) {
    return this.root.getNodeById(name);
  };
  /**
   * Update item available by list,
   * when list has been performed options like 'filterSelf' or 'map'.
   */
  Tree.prototype.update = function () {
    var data = this.data;
    var nodes = this._nodes;
    for (var i = 0, len = nodes.length; i < len; i++) {
      nodes[i].dataIndex = -1;
    }
    for (var i = 0, len = data.count(); i < len; i++) {
      nodes[data.getRawIndex(i)].dataIndex = i;
    }
  };
  /**
   * Clear all layouts
   */
  Tree.prototype.clearLayouts = function () {
    this.data.clearItemLayouts();
  };
  /**
   * data node format:
   * {
   *     name: ...
   *     value: ...
   *     children: [
   *         {
   *             name: ...
   *             value: ...
   *             children: ...
   *         },
   *         ...
   *     ]
   * }
   */
  Tree.createTree = function (dataRoot, hostModel, beforeLink) {
    var tree = new Tree(hostModel);
    var listData = [];
    var dimMax = 1;
    buildHierarchy(dataRoot);
    function buildHierarchy(dataNode, parentNode) {
      var value = dataNode.value;
      dimMax = Math.max(dimMax, isArray$1(value) ? value.length : 1);
      listData.push(dataNode);
      var node = new TreeNode(convertOptionIdName(dataNode.name, ''), tree);
      parentNode ? addChild(node, parentNode) : tree.root = node;
      tree._nodes.push(node);
      var children = dataNode.children;
      if (children) {
        for (var i = 0; i < children.length; i++) {
          buildHierarchy(children[i], node);
        }
      }
    }
    tree.root.updateDepthAndHeight(0);
    var dimensions = prepareSeriesDataSchema(listData, {
      coordDimensions: ['value'],
      dimensionsCount: dimMax
    }).dimensions;
    var list = new SeriesData$1(dimensions, hostModel);
    list.initData(listData);
    beforeLink && beforeLink(list);
    linkSeriesData({
      mainData: list,
      struct: tree,
      structAttr: 'tree'
    });
    tree.update();
    return tree;
  };
  return Tree;
}();
/**
 * It is needed to consider the mess of 'list', 'hostModel' when creating a TreeNote,
 * so this function is not ready and not necessary to be public.
 */
function addChild(child, node) {
  var children = node.children;
  if (child.parentNode === node) {
    return;
  }
  children.push(child);
  child.parentNode = node;
}
var Tree$1 = Tree;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function retrieveTargetInfo(payload, validPayloadTypes, seriesModel) {
  if (payload && indexOf(validPayloadTypes, payload.type) >= 0) {
    var root = seriesModel.getData().tree.root;
    var targetNode = payload.targetNode;
    if (isString(targetNode)) {
      targetNode = root.getNodeById(targetNode);
    }
    if (targetNode && root.contains(targetNode)) {
      return {
        node: targetNode
      };
    }
    var targetNodeId = payload.targetNodeId;
    if (targetNodeId != null && (targetNode = root.getNodeById(targetNodeId))) {
      return {
        node: targetNode
      };
    }
  }
}
// Not includes the given node at the last item.
function getPathToRoot(node) {
  var path = [];
  while (node) {
    node = node.parentNode;
    node && path.push(node);
  }
  return path.reverse();
}
function aboveViewRoot(viewRoot, node) {
  var viewPath = getPathToRoot(viewRoot);
  return indexOf(viewPath, node) >= 0;
}
// From root to the input node (the input node will be included).
function wrapTreePathInfo(node, seriesModel) {
  var treePathInfo = [];
  while (node) {
    var nodeDataIndex = node.dataIndex;
    treePathInfo.push({
      name: node.name,
      dataIndex: nodeDataIndex,
      value: seriesModel.getRawValue(nodeDataIndex)
    });
    node = node.parentNode;
  }
  treePathInfo.reverse();
  return treePathInfo;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TreeSeriesModel = /** @class */function (_super) {
  __extends(TreeSeriesModel, _super);
  function TreeSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.hasSymbolVisual = true;
    // Do it self.
    _this.ignoreStyleOnData = true;
    return _this;
  }
  /**
   * Init a tree data structure from data in option series
   */
  TreeSeriesModel.prototype.getInitialData = function (option) {
    // create a virtual root
    var root = {
      name: option.name,
      children: option.data
    };
    var leaves = option.leaves || {};
    var leavesModel = new Model$1(leaves, this, this.ecModel);
    var tree = Tree$1.createTree(root, this, beforeLink);
    function beforeLink(nodeData) {
      nodeData.wrapMethod('getItemModel', function (model, idx) {
        var node = tree.getNodeByDataIndex(idx);
        if (!(node && node.children.length && node.isExpand)) {
          model.parentModel = leavesModel;
        }
        return model;
      });
    }
    var treeDepth = 0;
    tree.eachNode('preorder', function (node) {
      if (node.depth > treeDepth) {
        treeDepth = node.depth;
      }
    });
    var expandAndCollapse = option.expandAndCollapse;
    var expandTreeDepth = expandAndCollapse && option.initialTreeDepth >= 0 ? option.initialTreeDepth : treeDepth;
    tree.root.eachNode('preorder', function (node) {
      var item = node.hostTree.data.getRawDataItem(node.dataIndex);
      // Add item.collapsed != null, because users can collapse node original in the series.data.
      node.isExpand = item && item.collapsed != null ? !item.collapsed : node.depth <= expandTreeDepth;
    });
    return tree.data;
  };
  /**
   * Make the configuration 'orient' backward compatibly, with 'horizontal = LR', 'vertical = TB'.
   * @returns {string} orient
   */
  TreeSeriesModel.prototype.getOrient = function () {
    var orient = this.get('orient');
    if (orient === 'horizontal') {
      orient = 'LR';
    } else if (orient === 'vertical') {
      orient = 'TB';
    }
    return orient;
  };
  TreeSeriesModel.prototype.setZoom = function (zoom) {
    this.option.zoom = zoom;
  };
  TreeSeriesModel.prototype.setCenter = function (center) {
    this.option.center = center;
  };
  TreeSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    var tree = this.getData().tree;
    var realRoot = tree.root.children[0];
    var node = tree.getNodeByDataIndex(dataIndex);
    var value = node.getValue();
    var name = node.name;
    while (node && node !== realRoot) {
      name = node.parentNode.name + '.' + name;
      node = node.parentNode;
    }
    return createTooltipMarkup('nameValue', {
      name: name,
      value: value,
      noValue: isNaN(value) || value == null
    });
  };
  // Add tree path to tooltip param
  TreeSeriesModel.prototype.getDataParams = function (dataIndex) {
    var params = _super.prototype.getDataParams.apply(this, arguments);
    var node = this.getData().tree.getNodeByDataIndex(dataIndex);
    params.treeAncestors = wrapTreePathInfo(node, this);
    params.collapsed = !node.isExpand;
    return params;
  };
  TreeSeriesModel.type = 'series.tree';
  // can support the position parameters 'left', 'top','right','bottom', 'width',
  // 'height' in the setOption() with 'merge' mode normal.
  TreeSeriesModel.layoutMode = 'box';
  TreeSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    coordinateSystem: 'view',
    // the position of the whole view
    left: '12%',
    top: '12%',
    right: '12%',
    bottom: '12%',
    // the layout of the tree, two value can be selected, 'orthogonal' or 'radial'
    layout: 'orthogonal',
    // value can be 'polyline'
    edgeShape: 'curve',
    edgeForkPosition: '50%',
    // true | false | 'move' | 'scale', see module:component/helper/RoamController.
    roam: false,
    // Symbol size scale ratio in roam
    nodeScaleRatio: 0.4,
    // Default on center of graph
    center: null,
    zoom: 1,
    orient: 'LR',
    symbol: 'emptyCircle',
    symbolSize: 7,
    expandAndCollapse: true,
    initialTreeDepth: 2,
    lineStyle: {
      color: '#ccc',
      width: 1.5,
      curveness: 0.5
    },
    itemStyle: {
      color: 'lightsteelblue',
      // borderColor: '#c23531',
      borderWidth: 1.5
    },
    label: {
      show: true
    },
    animationEasing: 'linear',
    animationDuration: 700,
    animationDurationUpdate: 500
  };
  return TreeSeriesModel;
}(SeriesModel$1);
var TreeSeriesModel$1 = TreeSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Traverse the tree from bottom to top and do something
 */
function eachAfter(root, callback, separation) {
  var nodes = [root];
  var next = [];
  var node;
  while (node = nodes.pop()) {
    // jshint ignore:line
    next.push(node);
    if (node.isExpand) {
      var children = node.children;
      if (children.length) {
        for (var i = 0; i < children.length; i++) {
          nodes.push(children[i]);
        }
      }
    }
  }
  while (node = next.pop()) {
    // jshint ignore:line
    callback(node, separation);
  }
}
/**
 * Traverse the tree from top to bottom and do something
 */
function eachBefore(root, callback) {
  var nodes = [root];
  var node;
  while (node = nodes.pop()) {
    // jshint ignore:line
    callback(node);
    if (node.isExpand) {
      var children = node.children;
      if (children.length) {
        for (var i = children.length - 1; i >= 0; i--) {
          nodes.push(children[i]);
        }
      }
    }
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function treeLayout(ecModel, api) {
  ecModel.eachSeriesByType('tree', function (seriesModel) {
    commonLayout(seriesModel, api);
  });
}
function commonLayout(seriesModel, api) {
  var layoutInfo = getViewRect$4(seriesModel, api);
  seriesModel.layoutInfo = layoutInfo;
  var layout = seriesModel.get('layout');
  var width = 0;
  var height = 0;
  var separation$1 = null;
  if (layout === 'radial') {
    width = 2 * Math.PI;
    height = Math.min(layoutInfo.height, layoutInfo.width) / 2;
    separation$1 = separation(function (node1, node2) {
      return (node1.parentNode === node2.parentNode ? 1 : 2) / node1.depth;
    });
  } else {
    width = layoutInfo.width;
    height = layoutInfo.height;
    separation$1 = separation();
  }
  var virtualRoot = seriesModel.getData().tree.root;
  var realRoot = virtualRoot.children[0];
  if (realRoot) {
    init(virtualRoot);
    eachAfter(realRoot, firstWalk, separation$1);
    virtualRoot.hierNode.modifier = -realRoot.hierNode.prelim;
    eachBefore(realRoot, secondWalk);
    var left_1 = realRoot;
    var right_1 = realRoot;
    var bottom_1 = realRoot;
    eachBefore(realRoot, function (node) {
      var x = node.getLayout().x;
      if (x < left_1.getLayout().x) {
        left_1 = node;
      }
      if (x > right_1.getLayout().x) {
        right_1 = node;
      }
      if (node.depth > bottom_1.depth) {
        bottom_1 = node;
      }
    });
    var delta = left_1 === right_1 ? 1 : separation$1(left_1, right_1) / 2;
    var tx_1 = delta - left_1.getLayout().x;
    var kx_1 = 0;
    var ky_1 = 0;
    var coorX_1 = 0;
    var coorY_1 = 0;
    if (layout === 'radial') {
      kx_1 = width / (right_1.getLayout().x + delta + tx_1);
      // here we use (node.depth - 1), bucause the real root's depth is 1
      ky_1 = height / (bottom_1.depth - 1 || 1);
      eachBefore(realRoot, function (node) {
        coorX_1 = (node.getLayout().x + tx_1) * kx_1;
        coorY_1 = (node.depth - 1) * ky_1;
        var finalCoor = radialCoordinate(coorX_1, coorY_1);
        node.setLayout({
          x: finalCoor.x,
          y: finalCoor.y,
          rawX: coorX_1,
          rawY: coorY_1
        }, true);
      });
    } else {
      var orient_1 = seriesModel.getOrient();
      if (orient_1 === 'RL' || orient_1 === 'LR') {
        ky_1 = height / (right_1.getLayout().x + delta + tx_1);
        kx_1 = width / (bottom_1.depth - 1 || 1);
        eachBefore(realRoot, function (node) {
          coorY_1 = (node.getLayout().x + tx_1) * ky_1;
          coorX_1 = orient_1 === 'LR' ? (node.depth - 1) * kx_1 : width - (node.depth - 1) * kx_1;
          node.setLayout({
            x: coorX_1,
            y: coorY_1
          }, true);
        });
      } else if (orient_1 === 'TB' || orient_1 === 'BT') {
        kx_1 = width / (right_1.getLayout().x + delta + tx_1);
        ky_1 = height / (bottom_1.depth - 1 || 1);
        eachBefore(realRoot, function (node) {
          coorX_1 = (node.getLayout().x + tx_1) * kx_1;
          coorY_1 = orient_1 === 'TB' ? (node.depth - 1) * ky_1 : height - (node.depth - 1) * ky_1;
          node.setLayout({
            x: coorX_1,
            y: coorY_1
          }, true);
        });
      }
    }
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function treeVisual(ecModel) {
  ecModel.eachSeriesByType('tree', function (seriesModel) {
    var data = seriesModel.getData();
    var tree = data.tree;
    tree.eachNode(function (node) {
      var model = node.getModel();
      // TODO Optimize
      var style = model.getModel('itemStyle').getItemStyle();
      var existsStyle = data.ensureUniqueItemVisual(node.dataIndex, 'style');
      extend(existsStyle, style);
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function installTreeAction(registers) {
  registers.registerAction({
    type: 'treeExpandAndCollapse',
    event: 'treeExpandAndCollapse',
    update: 'update'
  }, function (payload, ecModel) {
    ecModel.eachComponent({
      mainType: 'series',
      subType: 'tree',
      query: payload
    }, function (seriesModel) {
      var dataIndex = payload.dataIndex;
      var tree = seriesModel.getData().tree;
      var node = tree.getNodeByDataIndex(dataIndex);
      node.isExpand = !node.isExpand;
    });
  });
  registers.registerAction({
    type: 'treeRoam',
    event: 'treeRoam',
    // Here we set 'none' instead of 'update', because roam action
    // just need to update the transform matrix without having to recalculate
    // the layout. So don't need to go through the whole update process, such
    // as 'dataPrcocess', 'coordSystemUpdate', 'layout' and so on.
    update: 'none'
  }, function (payload, ecModel, api) {
    ecModel.eachComponent({
      mainType: 'series',
      subType: 'tree',
      query: payload
    }, function (seriesModel) {
      var coordSys = seriesModel.coordinateSystem;
      var res = updateCenterAndZoom(coordSys, payload, undefined, api);
      seriesModel.setCenter && seriesModel.setCenter(res.center);
      seriesModel.setZoom && seriesModel.setZoom(res.zoom);
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$J(registers) {
  registers.registerChartView(TreeView$1);
  registers.registerSeriesModel(TreeSeriesModel$1);
  registers.registerLayout(treeLayout);
  registers.registerVisual(treeVisual);
  installTreeAction(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var actionTypes = ['treemapZoomToNode', 'treemapRender', 'treemapMove'];
function installTreemapAction(registers) {
  for (var i = 0; i < actionTypes.length; i++) {
    registers.registerAction({
      type: actionTypes[i],
      update: 'updateView'
    }, noop);
  }
  registers.registerAction({
    type: 'treemapRootToNode',
    update: 'updateView'
  }, function (payload, ecModel) {
    ecModel.eachComponent({
      mainType: 'series',
      subType: 'treemap',
      query: payload
    }, handleRootToNode);
    function handleRootToNode(model, index) {
      var types = ['treemapZoomToNode', 'treemapRootToNode'];
      var targetInfo = retrieveTargetInfo(payload, types, model);
      if (targetInfo) {
        var originViewRoot = model.getViewRoot();
        if (originViewRoot) {
          payload.direction = aboveViewRoot(originViewRoot, targetInfo.node) ? 'rollUp' : 'drillDown';
        }
        model.resetViewRoot(targetInfo.node);
      }
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function enableAriaDecalForTree(seriesModel) {
  var data = seriesModel.getData();
  var tree = data.tree;
  var decalPaletteScope = {};
  tree.eachNode(function (node) {
    // Use decal of level 1 node
    var current = node;
    while (current && current.depth > 1) {
      current = current.parentNode;
    }
    var decal = getDecalFromPalette(seriesModel.ecModel, current.name || current.dataIndex + '', decalPaletteScope);
    node.setVisual('decal', decal);
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TreemapSeriesModel = /** @class */function (_super) {
  __extends(TreemapSeriesModel, _super);
  function TreemapSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = TreemapSeriesModel.type;
    _this.preventUsingHoverLayer = true;
    return _this;
  }
  /**
   * @override
   */
  TreemapSeriesModel.prototype.getInitialData = function (option, ecModel) {
    // Create a virtual root.
    var root = {
      name: option.name,
      children: option.data
    };
    completeTreeValue$1(root);
    var levels = option.levels || [];
    // Used in "visual priority" in `treemapVisual.js`.
    // This way is a little tricky, must satisfy the precondition:
    //   1. There is no `treeNode.getModel('itemStyle.xxx')` used.
    //   2. The `Model.prototype.getModel()` will not use any clone-like way.
    var designatedVisualItemStyle = this.designatedVisualItemStyle = {};
    var designatedVisualModel = new Model$1({
      itemStyle: designatedVisualItemStyle
    }, this, ecModel);
    levels = option.levels = setDefault(levels, ecModel);
    var levelModels = map$1(levels || [], function (levelDefine) {
      return new Model$1(levelDefine, designatedVisualModel, ecModel);
    }, this);
    // Make sure always a new tree is created when setOption,
    // in TreemapView, we check whether oldTree === newTree
    // to choose mappings approach among old shapes and new shapes.
    var tree = Tree$1.createTree(root, this, beforeLink);
    function beforeLink(nodeData) {
      nodeData.wrapMethod('getItemModel', function (model, idx) {
        var node = tree.getNodeByDataIndex(idx);
        var levelModel = node ? levelModels[node.depth] : null;
        // If no levelModel, we also need `designatedVisualModel`.
        model.parentModel = levelModel || designatedVisualModel;
        return model;
      });
    }
    return tree.data;
  };
  TreemapSeriesModel.prototype.optionUpdated = function () {
    this.resetViewRoot();
  };
  /**
   * @override
   * @param {number} dataIndex
   * @param {boolean} [mutipleSeries=false]
   */
  TreemapSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    var data = this.getData();
    var value = this.getRawValue(dataIndex);
    var name = data.getName(dataIndex);
    return createTooltipMarkup('nameValue', {
      name: name,
      value: value
    });
  };
  /**
   * Add tree path to tooltip param
   *
   * @override
   * @param {number} dataIndex
   * @return {Object}
   */
  TreemapSeriesModel.prototype.getDataParams = function (dataIndex) {
    var params = _super.prototype.getDataParams.apply(this, arguments);
    var node = this.getData().tree.getNodeByDataIndex(dataIndex);
    params.treeAncestors = wrapTreePathInfo(node, this);
    // compatitable the previous code.
    params.treePathInfo = params.treeAncestors;
    return params;
  };
  /**
   * @public
   * @param {Object} layoutInfo {
   *                                x: containerGroup x
   *                                y: containerGroup y
   *                                width: containerGroup width
   *                                height: containerGroup height
   *                            }
   */
  TreemapSeriesModel.prototype.setLayoutInfo = function (layoutInfo) {
    /**
     * @readOnly
     * @type {Object}
     */
    this.layoutInfo = this.layoutInfo || {};
    extend(this.layoutInfo, layoutInfo);
  };
  /**
   * @param  {string} id
   * @return {number} index
   */
  TreemapSeriesModel.prototype.mapIdToIndex = function (id) {
    // A feature is implemented:
    // index is monotone increasing with the sequence of
    // input id at the first time.
    // This feature can make sure that each data item and its
    // mapped color have the same index between data list and
    // color list at the beginning, which is useful for user
    // to adjust data-color mapping.
    /**
     * @private
     * @type {Object}
     */
    var idIndexMap = this._idIndexMap;
    if (!idIndexMap) {
      idIndexMap = this._idIndexMap = createHashMap();
      /**
       * @private
       * @type {number}
       */
      this._idIndexMapCount = 0;
    }
    var index = idIndexMap.get(id);
    if (index == null) {
      idIndexMap.set(id, index = this._idIndexMapCount++);
    }
    return index;
  };
  TreemapSeriesModel.prototype.getViewRoot = function () {
    return this._viewRoot;
  };
  TreemapSeriesModel.prototype.resetViewRoot = function (viewRoot) {
    viewRoot ? this._viewRoot = viewRoot : viewRoot = this._viewRoot;
    var root = this.getRawData().tree.root;
    if (!viewRoot || viewRoot !== root && !root.contains(viewRoot)) {
      this._viewRoot = root;
    }
  };
  TreemapSeriesModel.prototype.enableAriaDecal = function () {
    enableAriaDecalForTree(this);
  };
  TreemapSeriesModel.type = 'series.treemap';
  TreemapSeriesModel.layoutMode = 'box';
  TreemapSeriesModel.defaultOption = {
    // Disable progressive rendering
    progressive: 0,
    // size: ['80%', '80%'],            // deprecated, compatible with ec2.
    left: 'center',
    top: 'middle',
    width: '80%',
    height: '80%',
    sort: true,
    clipWindow: 'origin',
    squareRatio: 0.5 * (1 + Math.sqrt(5)),
    leafDepth: null,
    drillDownIcon: '▶',
    // to align specialized icon. ▷▶❒❐▼✚
    zoomToNodeRatio: 0.32 * 0.32,
    scaleLimit: null,
    roam: true,
    nodeClick: 'zoomToNode',
    animation: true,
    animationDurationUpdate: 900,
    animationEasing: 'quinticInOut',
    breadcrumb: {
      show: true,
      height: 22,
      left: 'center',
      top: 'bottom',
      // right
      // bottom
      emptyItemWidth: 25,
      itemStyle: {
        color: 'rgba(0,0,0,0.7)',
        textStyle: {
          color: '#fff'
        }
      },
      emphasis: {
        itemStyle: {
          color: 'rgba(0,0,0,0.9)' // '#5793f3',
        }
      }
    },
    label: {
      show: true,
      // Do not use textDistance, for ellipsis rect just the same as treemap node rect.
      distance: 0,
      padding: 5,
      position: 'inside',
      // formatter: null,
      color: '#fff',
      overflow: 'truncate'
      // align
      // verticalAlign
    },
    upperLabel: {
      show: false,
      position: [0, '50%'],
      height: 20,
      // formatter: null,
      // color: '#fff',
      overflow: 'truncate',
      // align: null,
      verticalAlign: 'middle'
    },
    itemStyle: {
      color: null,
      colorAlpha: null,
      colorSaturation: null,
      borderWidth: 0,
      gapWidth: 0,
      borderColor: '#fff',
      borderColorSaturation: null // If specified, borderColor will be ineffective, and the
      // border color is evaluated by color of current node and
      // borderColorSaturation.
    },
    emphasis: {
      upperLabel: {
        show: true,
        position: [0, '50%'],
        overflow: 'truncate',
        verticalAlign: 'middle'
      }
    },
    visualDimension: 0,
    visualMin: null,
    visualMax: null,
    color: [],
    // level[n].color (if necessary).
    // + Specify color list of each level. level[0].color would be global
    // color list if not specified. (see method `setDefault`).
    // + But set as a empty array to forbid fetch color from global palette
    // when using nodeModel.get('color'), otherwise nodes on deep level
    // will always has color palette set and are not able to inherit color
    // from parent node.
    // + TreemapSeries.color can not be set as 'none', otherwise effect
    // legend color fetching (see seriesColor.js).
    colorAlpha: null,
    colorSaturation: null,
    colorMappingBy: 'index',
    visibleMin: 10,
    // be rendered. Only works when sort is 'asc' or 'desc'.
    childrenVisibleMin: null,
    // grandchildren will not show.
    // Why grandchildren? If not grandchildren but children,
    // some siblings show children and some not,
    // the appearance may be mess and not consistent,
    levels: [] // Each item: {
    //     visibleMin, itemStyle, visualDimension, label
    // }
  };
  return TreemapSeriesModel;
}(SeriesModel$1);
/**
 * @param {Object} dataNode
 */
function completeTreeValue$1(dataNode) {
  // Postorder travel tree.
  // If value of none-leaf node is not set,
  // calculate it by suming up the value of all children.
  var sum = 0;
  each$f(dataNode.children, function (child) {
    completeTreeValue$1(child);
    var childValue = child.value;
    isArray$1(childValue) && (childValue = childValue[0]);
    sum += childValue;
  });
  var thisValue = dataNode.value;
  if (isArray$1(thisValue)) {
    thisValue = thisValue[0];
  }
  if (thisValue == null || isNaN(thisValue)) {
    thisValue = sum;
  }
  // Value should not less than 0.
  if (thisValue < 0) {
    thisValue = 0;
  }
  isArray$1(dataNode.value) ? dataNode.value[0] = thisValue : dataNode.value = thisValue;
}
/**
 * set default to level configuration
 */
function setDefault(levels, ecModel) {
  var globalColorList = normalizeToArray(ecModel.get('color'));
  var globalDecalList = normalizeToArray(ecModel.get(['aria', 'decal', 'decals']));
  if (!globalColorList) {
    return;
  }
  levels = levels || [];
  var hasColorDefine;
  var hasDecalDefine;
  each$f(levels, function (levelDefine) {
    var model = new Model$1(levelDefine);
    var modelColor = model.get('color');
    var modelDecal = model.get('decal');
    if (model.get(['itemStyle', 'color']) || modelColor && modelColor !== 'none') {
      hasColorDefine = true;
    }
    if (model.get(['itemStyle', 'decal']) || modelDecal && modelDecal !== 'none') {
      hasDecalDefine = true;
    }
  });
  var level0 = levels[0] || (levels[0] = {});
  if (!hasColorDefine) {
    level0.color = globalColorList.slice();
  }
  if (!hasDecalDefine && globalDecalList) {
    level0.decal = globalDecalList.slice();
  }
  return levels;
}
var TreemapSeriesModel$1 = TreemapSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TEXT_PADDING = 8;
var ITEM_GAP = 8;
var ARRAY_LENGTH = 5;
var Breadcrumb = /** @class */function () {
  function Breadcrumb(containerGroup) {
    this.group = new Group$5();
    containerGroup.add(this.group);
  }
  Breadcrumb.prototype.render = function (seriesModel, api, targetNode, onSelect) {
    var model = seriesModel.getModel('breadcrumb');
    var thisGroup = this.group;
    thisGroup.removeAll();
    if (!model.get('show') || !targetNode) {
      return;
    }
    var normalStyleModel = model.getModel('itemStyle');
    var emphasisModel = model.getModel('emphasis');
    var textStyleModel = normalStyleModel.getModel('textStyle');
    var emphasisTextStyleModel = emphasisModel.getModel(['itemStyle', 'textStyle']);
    var layoutParam = {
      pos: {
        left: model.get('left'),
        right: model.get('right'),
        top: model.get('top'),
        bottom: model.get('bottom')
      },
      box: {
        width: api.getWidth(),
        height: api.getHeight()
      },
      emptyItemWidth: model.get('emptyItemWidth'),
      totalWidth: 0,
      renderList: []
    };
    this._prepare(targetNode, layoutParam, textStyleModel);
    this._renderContent(seriesModel, layoutParam, normalStyleModel, emphasisModel, textStyleModel, emphasisTextStyleModel, onSelect);
    positionElement(thisGroup, layoutParam.pos, layoutParam.box);
  };
  /**
   * Prepare render list and total width
   * @private
   */
  Breadcrumb.prototype._prepare = function (targetNode, layoutParam, textStyleModel) {
    for (var node = targetNode; node; node = node.parentNode) {
      var text = convertOptionIdName(node.getModel().get('name'), '');
      var textRect = textStyleModel.getTextRect(text);
      var itemWidth = Math.max(textRect.width + TEXT_PADDING * 2, layoutParam.emptyItemWidth);
      layoutParam.totalWidth += itemWidth + ITEM_GAP;
      layoutParam.renderList.push({
        node: node,
        text: text,
        width: itemWidth
      });
    }
  };
  /**
   * @private
   */
  Breadcrumb.prototype._renderContent = function (seriesModel, layoutParam, normalStyleModel, emphasisModel, textStyleModel, emphasisTextStyleModel, onSelect) {
    // Start rendering.
    var lastX = 0;
    var emptyItemWidth = layoutParam.emptyItemWidth;
    var height = seriesModel.get(['breadcrumb', 'height']);
    var availableSize = getAvailableSize(layoutParam.pos, layoutParam.box);
    var totalWidth = layoutParam.totalWidth;
    var renderList = layoutParam.renderList;
    var emphasisItemStyle = emphasisModel.getModel('itemStyle').getItemStyle();
    for (var i = renderList.length - 1; i >= 0; i--) {
      var item = renderList[i];
      var itemNode = item.node;
      var itemWidth = item.width;
      var text = item.text;
      // Hdie text and shorten width if necessary.
      if (totalWidth > availableSize.width) {
        totalWidth -= itemWidth - emptyItemWidth;
        itemWidth = emptyItemWidth;
        text = null;
      }
      var el = new Polygon$1({
        shape: {
          points: makeItemPoints(lastX, 0, itemWidth, height, i === renderList.length - 1, i === 0)
        },
        style: defaults(normalStyleModel.getItemStyle(), {
          lineJoin: 'bevel'
        }),
        textContent: new ZRText$1({
          style: createTextStyle(textStyleModel, {
            text: text
          })
        }),
        textConfig: {
          position: 'inside'
        },
        z2: Z2_EMPHASIS_LIFT * 1e4,
        onclick: curry$1(onSelect, itemNode)
      });
      el.disableLabelAnimation = true;
      el.getTextContent().ensureState('emphasis').style = createTextStyle(emphasisTextStyleModel, {
        text: text
      });
      el.ensureState('emphasis').style = emphasisItemStyle;
      toggleHoverEmphasis(el, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
      this.group.add(el);
      packEventData(el, seriesModel, itemNode);
      lastX += itemWidth + ITEM_GAP;
    }
  };
  Breadcrumb.prototype.remove = function () {
    this.group.removeAll();
  };
  return Breadcrumb;
}();
function makeItemPoints(x, y, itemWidth, itemHeight, head, tail) {
  var points = [[head ? x : x - ARRAY_LENGTH, y], [x + itemWidth, y], [x + itemWidth, y + itemHeight], [head ? x : x - ARRAY_LENGTH, y + itemHeight]];
  !tail && points.splice(2, 0, [x + itemWidth + ARRAY_LENGTH, y + itemHeight / 2]);
  !head && points.push([x, y + itemHeight / 2]);
  return points;
}
// Package custom mouse event.
function packEventData(el, seriesModel, itemNode) {
  getECData(el).eventData = {
    componentType: 'series',
    componentSubType: 'treemap',
    componentIndex: seriesModel.componentIndex,
    seriesIndex: seriesModel.seriesIndex,
    seriesName: seriesModel.name,
    seriesType: 'treemap',
    selfType: 'breadcrumb',
    nodeData: {
      dataIndex: itemNode && itemNode.dataIndex,
      name: itemNode && itemNode.name
    },
    treePathInfo: itemNode && wrapTreePathInfo(itemNode, seriesModel)
  };
}
var Breadcrumb$1 = Breadcrumb;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Animate multiple elements with a single done-callback.
 *
 * @example
 *  animation
 *      .createWrap()
 *      .add(el1, {x: 10, y: 10})
 *      .add(el2, {shape: {width: 500}, style: {fill: 'red'}}, 400)
 *      .done(function () { // done })
 *      .start('cubicOut');
 */
var AnimationWrap = /** @class */function () {
  function AnimationWrap() {
    this._storage = [];
    this._elExistsMap = {};
  }
  /**
   * Caution: a el can only be added once, otherwise 'done'
   * might not be called. This method checks this (by el.id),
   * suppresses adding and returns false when existing el found.
   *
   * @return Whether adding succeeded.
   */
  AnimationWrap.prototype.add = function (el, target, duration, delay, easing) {
    if (this._elExistsMap[el.id]) {
      return false;
    }
    this._elExistsMap[el.id] = true;
    this._storage.push({
      el: el,
      target: target,
      duration: duration,
      delay: delay,
      easing: easing
    });
    return true;
  };
  /**
   * Only execute when animation done/aborted.
   */
  AnimationWrap.prototype.finished = function (callback) {
    this._finishedCallback = callback;
    return this;
  };
  /**
   * Will stop exist animation firstly.
   */
  AnimationWrap.prototype.start = function () {
    var _this = this;
    var count = this._storage.length;
    var checkTerminate = function () {
      count--;
      if (count <= 0) {
        // Guard.
        _this._storage.length = 0;
        _this._elExistsMap = {};
        _this._finishedCallback && _this._finishedCallback();
      }
    };
    for (var i = 0, len = this._storage.length; i < len; i++) {
      var item = this._storage[i];
      item.el.animateTo(item.target, {
        duration: item.duration,
        delay: item.delay,
        easing: item.easing,
        setToFinal: true,
        done: checkTerminate,
        aborted: checkTerminate
      });
    }
    return this;
  };
  return AnimationWrap;
}();
function createWrap() {
  return new AnimationWrap();
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Group$3 = Group$5;
var Rect$1 = Rect$3;
var DRAG_THRESHOLD = 3;
var PATH_LABEL_NOAMAL = 'label';
var PATH_UPPERLABEL_NORMAL = 'upperLabel';
// Should larger than emphasis states lift z
var Z2_BASE = Z2_EMPHASIS_LIFT * 10; // Should bigger than every z2.
var Z2_BG = Z2_EMPHASIS_LIFT * 2;
var Z2_CONTENT = Z2_EMPHASIS_LIFT * 3;
var getStateItemStyle = makeStyleMapper([['fill', 'color'],
// `borderColor` and `borderWidth` has been occupied,
// so use `stroke` to indicate the stroke of the rect.
['stroke', 'strokeColor'], ['lineWidth', 'strokeWidth'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor']
// Option decal is in `DecalObject` but style.decal is in `PatternObject`.
// So do not transfer decal directly.
]);
var getItemStyleNormal = function (model) {
  // Normal style props should include emphasis style props.
  var itemStyle = getStateItemStyle(model);
  // Clear styles set by emphasis.
  itemStyle.stroke = itemStyle.fill = itemStyle.lineWidth = null;
  return itemStyle;
};
var inner$d = makeInner();
var TreemapView = /** @class */function (_super) {
  __extends(TreemapView, _super);
  function TreemapView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = TreemapView.type;
    _this._state = 'ready';
    _this._storage = createStorage();
    return _this;
  }
  /**
   * @override
   */
  TreemapView.prototype.render = function (seriesModel, ecModel, api, payload) {
    var models = ecModel.findComponents({
      mainType: 'series',
      subType: 'treemap',
      query: payload
    });
    if (indexOf(models, seriesModel) < 0) {
      return;
    }
    this.seriesModel = seriesModel;
    this.api = api;
    this.ecModel = ecModel;
    var types = ['treemapZoomToNode', 'treemapRootToNode'];
    var targetInfo = retrieveTargetInfo(payload, types, seriesModel);
    var payloadType = payload && payload.type;
    var layoutInfo = seriesModel.layoutInfo;
    var isInit = !this._oldTree;
    var thisStorage = this._storage;
    // Mark new root when action is treemapRootToNode.
    var reRoot = payloadType === 'treemapRootToNode' && targetInfo && thisStorage ? {
      rootNodeGroup: thisStorage.nodeGroup[targetInfo.node.getRawIndex()],
      direction: payload.direction
    } : null;
    var containerGroup = this._giveContainerGroup(layoutInfo);
    var hasAnimation = seriesModel.get('animation');
    var renderResult = this._doRender(containerGroup, seriesModel, reRoot);
    hasAnimation && !isInit && (!payloadType || payloadType === 'treemapZoomToNode' || payloadType === 'treemapRootToNode') ? this._doAnimation(containerGroup, renderResult, seriesModel, reRoot) : renderResult.renderFinally();
    this._resetController(api);
    this._renderBreadcrumb(seriesModel, api, targetInfo);
  };
  TreemapView.prototype._giveContainerGroup = function (layoutInfo) {
    var containerGroup = this._containerGroup;
    if (!containerGroup) {
      // FIXME
      // 加一层containerGroup是为了clip，但是现在clip功能并没有实现。
      containerGroup = this._containerGroup = new Group$3();
      this._initEvents(containerGroup);
      this.group.add(containerGroup);
    }
    containerGroup.x = layoutInfo.x;
    containerGroup.y = layoutInfo.y;
    return containerGroup;
  };
  TreemapView.prototype._doRender = function (containerGroup, seriesModel, reRoot) {
    var thisTree = seriesModel.getData().tree;
    var oldTree = this._oldTree;
    // Clear last shape records.
    var lastsForAnimation = createStorage();
    var thisStorage = createStorage();
    var oldStorage = this._storage;
    var willInvisibleEls = [];
    function doRenderNode(thisNode, oldNode, parentGroup, depth) {
      return renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimation, willInvisibleEls, thisNode, oldNode, parentGroup, depth);
    }
    // Notice: When thisTree and oldTree are the same tree (see list.cloneShallow),
    // the oldTree is actually losted, so we cannot find all of the old graphic
    // elements from tree. So we use this strategy: make element storage, move
    // from old storage to new storage, clear old storage.
    dualTravel(thisTree.root ? [thisTree.root] : [], oldTree && oldTree.root ? [oldTree.root] : [], containerGroup, thisTree === oldTree || !oldTree, 0);
    // Process all removing.
    var willDeleteEls = clearStorage(oldStorage);
    this._oldTree = thisTree;
    this._storage = thisStorage;
    if (this._controllerHost) {
      var _oldRootLayout = this.seriesModel.layoutInfo;
      var rootLayout = thisTree.root.getLayout();
      if (rootLayout.width === _oldRootLayout.width && rootLayout.height === _oldRootLayout.height) {
        this._controllerHost.zoom = 1;
      }
    }
    return {
      lastsForAnimation: lastsForAnimation,
      willDeleteEls: willDeleteEls,
      renderFinally: renderFinally
    };
    function dualTravel(thisViewChildren, oldViewChildren, parentGroup, sameTree, depth) {
      // When 'render' is triggered by action,
      // 'this' and 'old' may be the same tree,
      // we use rawIndex in that case.
      if (sameTree) {
        oldViewChildren = thisViewChildren;
        each$f(thisViewChildren, function (child, index) {
          !child.isRemoved() && processNode(index, index);
        });
      }
      // Diff hierarchically (diff only in each subtree, but not whole).
      // because, consistency of view is important.
      else {
        new DataDiffer$1(oldViewChildren, thisViewChildren, getKey, getKey).add(processNode).update(processNode).remove(curry$1(processNode, null)).execute();
      }
      function getKey(node) {
        // Identify by name or raw index.
        return node.getId();
      }
      function processNode(newIndex, oldIndex) {
        var thisNode = newIndex != null ? thisViewChildren[newIndex] : null;
        var oldNode = oldIndex != null ? oldViewChildren[oldIndex] : null;
        var group = doRenderNode(thisNode, oldNode, parentGroup, depth);
        group && dualTravel(thisNode && thisNode.viewChildren || [], oldNode && oldNode.viewChildren || [], group, sameTree, depth + 1);
      }
    }
    function clearStorage(storage) {
      var willDeleteEls = createStorage();
      storage && each$f(storage, function (store, storageName) {
        var delEls = willDeleteEls[storageName];
        each$f(store, function (el) {
          el && (delEls.push(el), inner$d(el).willDelete = true);
        });
      });
      return willDeleteEls;
    }
    function renderFinally() {
      each$f(willDeleteEls, function (els) {
        each$f(els, function (el) {
          el.parent && el.parent.remove(el);
        });
      });
      each$f(willInvisibleEls, function (el) {
        el.invisible = true;
        // Setting invisible is for optimizing, so no need to set dirty,
        // just mark as invisible.
        el.dirty();
      });
    }
  };
  TreemapView.prototype._doAnimation = function (containerGroup, renderResult, seriesModel, reRoot) {
    var durationOption = seriesModel.get('animationDurationUpdate');
    var easingOption = seriesModel.get('animationEasing');
    // TODO: do not support function until necessary.
    var duration = (isFunction(durationOption) ? 0 : durationOption) || 0;
    var easing = (isFunction(easingOption) ? null : easingOption) || 'cubicOut';
    var animationWrap = createWrap();
    // Make delete animations.
    each$f(renderResult.willDeleteEls, function (store, storageName) {
      each$f(store, function (el, rawIndex) {
        if (el.invisible) {
          return;
        }
        var parent = el.parent; // Always has parent, and parent is nodeGroup.
        var target;
        var innerStore = inner$d(parent);
        if (reRoot && reRoot.direction === 'drillDown') {
          target = parent === reRoot.rootNodeGroup
          // This is the content element of view root.
          // Only `content` will enter this branch, because
          // `background` and `nodeGroup` will not be deleted.
          ? {
            shape: {
              x: 0,
              y: 0,
              width: innerStore.nodeWidth,
              height: innerStore.nodeHeight
            },
            style: {
              opacity: 0
            }
          }
          // Others.
          : {
            style: {
              opacity: 0
            }
          };
        } else {
          var targetX = 0;
          var targetY = 0;
          if (!innerStore.willDelete) {
            // Let node animate to right-bottom corner, cooperating with fadeout,
            // which is appropriate for user understanding.
            // Divided by 2 for reRoot rolling up effect.
            targetX = innerStore.nodeWidth / 2;
            targetY = innerStore.nodeHeight / 2;
          }
          target = storageName === 'nodeGroup' ? {
            x: targetX,
            y: targetY,
            style: {
              opacity: 0
            }
          } : {
            shape: {
              x: targetX,
              y: targetY,
              width: 0,
              height: 0
            },
            style: {
              opacity: 0
            }
          };
        }
        // TODO: do not support delay until necessary.
        target && animationWrap.add(el, target, duration, 0, easing);
      });
    });
    // Make other animations
    each$f(this._storage, function (store, storageName) {
      each$f(store, function (el, rawIndex) {
        var last = renderResult.lastsForAnimation[storageName][rawIndex];
        var target = {};
        if (!last) {
          return;
        }
        if (el instanceof Group$5) {
          if (last.oldX != null) {
            target.x = el.x;
            target.y = el.y;
            el.x = last.oldX;
            el.y = last.oldY;
          }
        } else {
          if (last.oldShape) {
            target.shape = extend({}, el.shape);
            el.setShape(last.oldShape);
          }
          if (last.fadein) {
            el.setStyle('opacity', 0);
            target.style = {
              opacity: 1
            };
          }
          // When animation is stopped for succedent animation starting,
          // el.style.opacity might not be 1
          else if (el.style.opacity !== 1) {
            target.style = {
              opacity: 1
            };
          }
        }
        animationWrap.add(el, target, duration, 0, easing);
      });
    }, this);
    this._state = 'animating';
    animationWrap.finished(bind$1(function () {
      this._state = 'ready';
      renderResult.renderFinally();
    }, this)).start();
  };
  TreemapView.prototype._resetController = function (api) {
    var controller = this._controller;
    var controllerHost = this._controllerHost;
    if (!controllerHost) {
      this._controllerHost = {
        target: this.group
      };
      controllerHost = this._controllerHost;
    }
    // Init controller.
    if (!controller) {
      controller = this._controller = new RoamController$1(api.getZr());
      controller.enable(this.seriesModel.get('roam'));
      controllerHost.zoomLimit = this.seriesModel.get('scaleLimit');
      controllerHost.zoom = this.seriesModel.get('zoom');
      controller.on('pan', bind$1(this._onPan, this));
      controller.on('zoom', bind$1(this._onZoom, this));
    }
    var rect = new BoundingRect$1(0, 0, api.getWidth(), api.getHeight());
    controller.setPointerChecker(function (e, x, y) {
      return rect.contain(x, y);
    });
  };
  TreemapView.prototype._clearController = function () {
    var controller = this._controller;
    this._controllerHost = null;
    if (controller) {
      controller.dispose();
      controller = null;
    }
  };
  TreemapView.prototype._onPan = function (e) {
    if (this._state !== 'animating' && (Math.abs(e.dx) > DRAG_THRESHOLD || Math.abs(e.dy) > DRAG_THRESHOLD)) {
      // These param must not be cached.
      var root = this.seriesModel.getData().tree.root;
      if (!root) {
        return;
      }
      var rootLayout = root.getLayout();
      if (!rootLayout) {
        return;
      }
      this.api.dispatchAction({
        type: 'treemapMove',
        from: this.uid,
        seriesId: this.seriesModel.id,
        rootRect: {
          x: rootLayout.x + e.dx,
          y: rootLayout.y + e.dy,
          width: rootLayout.width,
          height: rootLayout.height
        }
      });
    }
  };
  TreemapView.prototype._onZoom = function (e) {
    var mouseX = e.originX;
    var mouseY = e.originY;
    var zoomDelta = e.scale;
    if (this._state !== 'animating') {
      // These param must not be cached.
      var root = this.seriesModel.getData().tree.root;
      if (!root) {
        return;
      }
      var rootLayout = root.getLayout();
      if (!rootLayout) {
        return;
      }
      var rect = new BoundingRect$1(rootLayout.x, rootLayout.y, rootLayout.width, rootLayout.height);
      // scaleLimit
      var zoomLimit = null;
      var _controllerHost = this._controllerHost;
      zoomLimit = _controllerHost.zoomLimit;
      var newZoom = _controllerHost.zoom = _controllerHost.zoom || 1;
      newZoom *= zoomDelta;
      if (zoomLimit) {
        var zoomMin = zoomLimit.min || 0;
        var zoomMax = zoomLimit.max || Infinity;
        newZoom = Math.max(Math.min(zoomMax, newZoom), zoomMin);
      }
      var zoomScale = newZoom / _controllerHost.zoom;
      _controllerHost.zoom = newZoom;
      var layoutInfo = this.seriesModel.layoutInfo;
      // Transform mouse coord from global to containerGroup.
      mouseX -= layoutInfo.x;
      mouseY -= layoutInfo.y;
      // Scale root bounding rect.
      var m = create$1();
      translate(m, m, [-mouseX, -mouseY]);
      scale$1(m, m, [zoomScale, zoomScale]);
      translate(m, m, [mouseX, mouseY]);
      rect.applyTransform(m);
      this.api.dispatchAction({
        type: 'treemapRender',
        from: this.uid,
        seriesId: this.seriesModel.id,
        rootRect: {
          x: rect.x,
          y: rect.y,
          width: rect.width,
          height: rect.height
        }
      });
    }
  };
  TreemapView.prototype._initEvents = function (containerGroup) {
    var _this = this;
    containerGroup.on('click', function (e) {
      if (_this._state !== 'ready') {
        return;
      }
      var nodeClick = _this.seriesModel.get('nodeClick', true);
      if (!nodeClick) {
        return;
      }
      var targetInfo = _this.findTarget(e.offsetX, e.offsetY);
      if (!targetInfo) {
        return;
      }
      var node = targetInfo.node;
      if (node.getLayout().isLeafRoot) {
        _this._rootToNode(targetInfo);
      } else {
        if (nodeClick === 'zoomToNode') {
          _this._zoomToNode(targetInfo);
        } else if (nodeClick === 'link') {
          var itemModel = node.hostTree.data.getItemModel(node.dataIndex);
          var link = itemModel.get('link', true);
          var linkTarget = itemModel.get('target', true) || 'blank';
          link && windowOpen(link, linkTarget);
        }
      }
    }, this);
  };
  TreemapView.prototype._renderBreadcrumb = function (seriesModel, api, targetInfo) {
    var _this = this;
    if (!targetInfo) {
      targetInfo = seriesModel.get('leafDepth', true) != null ? {
        node: seriesModel.getViewRoot()
      }
      // FIXME
      // better way?
      // Find breadcrumb tail on center of containerGroup.
      : this.findTarget(api.getWidth() / 2, api.getHeight() / 2);
      if (!targetInfo) {
        targetInfo = {
          node: seriesModel.getData().tree.root
        };
      }
    }
    (this._breadcrumb || (this._breadcrumb = new Breadcrumb$1(this.group))).render(seriesModel, api, targetInfo.node, function (node) {
      if (_this._state !== 'animating') {
        aboveViewRoot(seriesModel.getViewRoot(), node) ? _this._rootToNode({
          node: node
        }) : _this._zoomToNode({
          node: node
        });
      }
    });
  };
  /**
   * @override
   */
  TreemapView.prototype.remove = function () {
    this._clearController();
    this._containerGroup && this._containerGroup.removeAll();
    this._storage = createStorage();
    this._state = 'ready';
    this._breadcrumb && this._breadcrumb.remove();
  };
  TreemapView.prototype.dispose = function () {
    this._clearController();
  };
  TreemapView.prototype._zoomToNode = function (targetInfo) {
    this.api.dispatchAction({
      type: 'treemapZoomToNode',
      from: this.uid,
      seriesId: this.seriesModel.id,
      targetNode: targetInfo.node
    });
  };
  TreemapView.prototype._rootToNode = function (targetInfo) {
    this.api.dispatchAction({
      type: 'treemapRootToNode',
      from: this.uid,
      seriesId: this.seriesModel.id,
      targetNode: targetInfo.node
    });
  };
  /**
   * @public
   * @param {number} x Global coord x.
   * @param {number} y Global coord y.
   * @return {Object} info If not found, return undefined;
   * @return {number} info.node Target node.
   * @return {number} info.offsetX x refer to target node.
   * @return {number} info.offsetY y refer to target node.
   */
  TreemapView.prototype.findTarget = function (x, y) {
    var targetInfo;
    var viewRoot = this.seriesModel.getViewRoot();
    viewRoot.eachNode({
      attr: 'viewChildren',
      order: 'preorder'
    }, function (node) {
      var bgEl = this._storage.background[node.getRawIndex()];
      // If invisible, there might be no element.
      if (bgEl) {
        var point = bgEl.transformCoordToLocal(x, y);
        var shape = bgEl.shape;
        // For performance consideration, don't use 'getBoundingRect'.
        if (shape.x <= point[0] && point[0] <= shape.x + shape.width && shape.y <= point[1] && point[1] <= shape.y + shape.height) {
          targetInfo = {
            node: node,
            offsetX: point[0],
            offsetY: point[1]
          };
        } else {
          return false; // Suppress visit subtree.
        }
      }
    }, this);
    return targetInfo;
  };
  TreemapView.type = 'treemap';
  return TreemapView;
}(ChartView$1);
/**
 * @inner
 */
function createStorage() {
  return {
    nodeGroup: [],
    background: [],
    content: []
  };
}
/**
 * @inner
 * @return Return undefined means do not travel further.
 */
function renderNode(seriesModel, thisStorage, oldStorage, reRoot, lastsForAnimation, willInvisibleEls, thisNode, oldNode, parentGroup, depth) {
  // Whether under viewRoot.
  if (!thisNode) {
    // Deleting nodes will be performed finally. This method just find
    // element from old storage, or create new element, set them to new
    // storage, and set styles.
    return;
  }
  // -------------------------------------------------------------------
  // Start of closure variables available in "Procedures in renderNode".
  var thisLayout = thisNode.getLayout();
  var data = seriesModel.getData();
  var nodeModel = thisNode.getModel();
  // Only for enabling highlight/downplay. Clear firstly.
  // Because some node will not be rendered.
  data.setItemGraphicEl(thisNode.dataIndex, null);
  if (!thisLayout || !thisLayout.isInView) {
    return;
  }
  var thisWidth = thisLayout.width;
  var thisHeight = thisLayout.height;
  var borderWidth = thisLayout.borderWidth;
  var thisInvisible = thisLayout.invisible;
  var thisRawIndex = thisNode.getRawIndex();
  var oldRawIndex = oldNode && oldNode.getRawIndex();
  var thisViewChildren = thisNode.viewChildren;
  var upperHeight = thisLayout.upperHeight;
  var isParent = thisViewChildren && thisViewChildren.length;
  var itemStyleNormalModel = nodeModel.getModel('itemStyle');
  var itemStyleEmphasisModel = nodeModel.getModel(['emphasis', 'itemStyle']);
  var itemStyleBlurModel = nodeModel.getModel(['blur', 'itemStyle']);
  var itemStyleSelectModel = nodeModel.getModel(['select', 'itemStyle']);
  var borderRadius = itemStyleNormalModel.get('borderRadius') || 0;
  // End of closure ariables available in "Procedures in renderNode".
  // -----------------------------------------------------------------
  // Node group
  var group = giveGraphic('nodeGroup', Group$3);
  if (!group) {
    return;
  }
  parentGroup.add(group);
  // x,y are not set when el is above view root.
  group.x = thisLayout.x || 0;
  group.y = thisLayout.y || 0;
  group.markRedraw();
  inner$d(group).nodeWidth = thisWidth;
  inner$d(group).nodeHeight = thisHeight;
  if (thisLayout.isAboveViewRoot) {
    return group;
  }
  // Background
  var bg = giveGraphic('background', Rect$1, depth, Z2_BG);
  bg && renderBackground(group, bg, isParent && thisLayout.upperLabelHeight);
  var emphasisModel = nodeModel.getModel('emphasis');
  var focus = emphasisModel.get('focus');
  var blurScope = emphasisModel.get('blurScope');
  var isDisabled = emphasisModel.get('disabled');
  var focusOrIndices = focus === 'ancestor' ? thisNode.getAncestorsIndices() : focus === 'descendant' ? thisNode.getDescendantIndices() : focus;
  // No children, render content.
  if (isParent) {
    // Because of the implementation about "traverse" in graphic hover style, we
    // can not set hover listener on the "group" of non-leaf node. Otherwise the
    // hover event from the descendents will be listenered.
    if (isHighDownDispatcher(group)) {
      setAsHighDownDispatcher(group, false);
    }
    if (bg) {
      setAsHighDownDispatcher(bg, !isDisabled);
      // Only for enabling highlight/downplay.
      data.setItemGraphicEl(thisNode.dataIndex, bg);
      enableHoverFocus(bg, focusOrIndices, blurScope);
    }
  } else {
    var content = giveGraphic('content', Rect$1, depth, Z2_CONTENT);
    content && renderContent(group, content);
    bg.disableMorphing = true;
    if (bg && isHighDownDispatcher(bg)) {
      setAsHighDownDispatcher(bg, false);
    }
    setAsHighDownDispatcher(group, !isDisabled);
    // Only for enabling highlight/downplay.
    data.setItemGraphicEl(thisNode.dataIndex, group);
    var cursorStyle = nodeModel.getShallow('cursor');
    cursorStyle && content.attr('cursor', cursorStyle);
    enableHoverFocus(group, focusOrIndices, blurScope);
  }
  return group;
  // ----------------------------
  // | Procedures in renderNode |
  // ----------------------------
  function renderBackground(group, bg, useUpperLabel) {
    var ecData = getECData(bg);
    // For tooltip.
    ecData.dataIndex = thisNode.dataIndex;
    ecData.seriesIndex = seriesModel.seriesIndex;
    bg.setShape({
      x: 0,
      y: 0,
      width: thisWidth,
      height: thisHeight,
      r: borderRadius
    });
    if (thisInvisible) {
      // If invisible, do not set visual, otherwise the element will
      // change immediately before animation. We think it is OK to
      // remain its origin color when moving out of the view window.
      processInvisible(bg);
    } else {
      bg.invisible = false;
      var style = thisNode.getVisual('style');
      var visualBorderColor = style.stroke;
      var normalStyle = getItemStyleNormal(itemStyleNormalModel);
      normalStyle.fill = visualBorderColor;
      var emphasisStyle = getStateItemStyle(itemStyleEmphasisModel);
      emphasisStyle.fill = itemStyleEmphasisModel.get('borderColor');
      var blurStyle = getStateItemStyle(itemStyleBlurModel);
      blurStyle.fill = itemStyleBlurModel.get('borderColor');
      var selectStyle = getStateItemStyle(itemStyleSelectModel);
      selectStyle.fill = itemStyleSelectModel.get('borderColor');
      if (useUpperLabel) {
        var upperLabelWidth = thisWidth - 2 * borderWidth;
        prepareText(
        // PENDING: convert ZRColor to ColorString for text.
        bg, visualBorderColor, style.opacity, {
          x: borderWidth,
          y: 0,
          width: upperLabelWidth,
          height: upperHeight
        });
      }
      // For old bg.
      else {
        bg.removeTextContent();
      }
      bg.setStyle(normalStyle);
      bg.ensureState('emphasis').style = emphasisStyle;
      bg.ensureState('blur').style = blurStyle;
      bg.ensureState('select').style = selectStyle;
      setDefaultStateProxy(bg);
    }
    group.add(bg);
  }
  function renderContent(group, content) {
    var ecData = getECData(content);
    // For tooltip.
    ecData.dataIndex = thisNode.dataIndex;
    ecData.seriesIndex = seriesModel.seriesIndex;
    var contentWidth = Math.max(thisWidth - 2 * borderWidth, 0);
    var contentHeight = Math.max(thisHeight - 2 * borderWidth, 0);
    content.culling = true;
    content.setShape({
      x: borderWidth,
      y: borderWidth,
      width: contentWidth,
      height: contentHeight,
      r: borderRadius
    });
    if (thisInvisible) {
      // If invisible, do not set visual, otherwise the element will
      // change immediately before animation. We think it is OK to
      // remain its origin color when moving out of the view window.
      processInvisible(content);
    } else {
      content.invisible = false;
      var nodeStyle = thisNode.getVisual('style');
      var visualColor = nodeStyle.fill;
      var normalStyle = getItemStyleNormal(itemStyleNormalModel);
      normalStyle.fill = visualColor;
      normalStyle.decal = nodeStyle.decal;
      var emphasisStyle = getStateItemStyle(itemStyleEmphasisModel);
      var blurStyle = getStateItemStyle(itemStyleBlurModel);
      var selectStyle = getStateItemStyle(itemStyleSelectModel);
      // PENDING: convert ZRColor to ColorString for text.
      prepareText(content, visualColor, nodeStyle.opacity, null);
      content.setStyle(normalStyle);
      content.ensureState('emphasis').style = emphasisStyle;
      content.ensureState('blur').style = blurStyle;
      content.ensureState('select').style = selectStyle;
      setDefaultStateProxy(content);
    }
    group.add(content);
  }
  function processInvisible(element) {
    // Delay invisible setting utill animation finished,
    // avoid element vanish suddenly before animation.
    !element.invisible && willInvisibleEls.push(element);
  }
  function prepareText(rectEl, visualColor, visualOpacity,
  // Can be null/undefined
  upperLabelRect) {
    var normalLabelModel = nodeModel.getModel(upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL);
    var defaultText = convertOptionIdName(nodeModel.get('name'), null);
    var isShow = normalLabelModel.getShallow('show');
    setLabelStyle(rectEl, getLabelStatesModels(nodeModel, upperLabelRect ? PATH_UPPERLABEL_NORMAL : PATH_LABEL_NOAMAL), {
      defaultText: isShow ? defaultText : null,
      inheritColor: visualColor,
      defaultOpacity: visualOpacity,
      labelFetcher: seriesModel,
      labelDataIndex: thisNode.dataIndex
    });
    var textEl = rectEl.getTextContent();
    if (!textEl) {
      return;
    }
    var textStyle = textEl.style;
    var textPadding = normalizeCssArray$1(textStyle.padding || 0);
    if (upperLabelRect) {
      rectEl.setTextConfig({
        layoutRect: upperLabelRect
      });
      textEl.disableLabelLayout = true;
    }
    textEl.beforeUpdate = function () {
      var width = Math.max((upperLabelRect ? upperLabelRect.width : rectEl.shape.width) - textPadding[1] - textPadding[3], 0);
      var height = Math.max((upperLabelRect ? upperLabelRect.height : rectEl.shape.height) - textPadding[0] - textPadding[2], 0);
      if (textStyle.width !== width || textStyle.height !== height) {
        textEl.setStyle({
          width: width,
          height: height
        });
      }
    };
    textStyle.truncateMinChar = 2;
    textStyle.lineOverflow = 'truncate';
    addDrillDownIcon(textStyle, upperLabelRect, thisLayout);
    var textEmphasisState = textEl.getState('emphasis');
    addDrillDownIcon(textEmphasisState ? textEmphasisState.style : null, upperLabelRect, thisLayout);
  }
  function addDrillDownIcon(style, upperLabelRect, thisLayout) {
    var text = style ? style.text : null;
    if (!upperLabelRect && thisLayout.isLeafRoot && text != null) {
      var iconChar = seriesModel.get('drillDownIcon', true);
      style.text = iconChar ? iconChar + ' ' + text : text;
    }
  }
  function giveGraphic(storageName, Ctor, depth, z) {
    var element = oldRawIndex != null && oldStorage[storageName][oldRawIndex];
    var lasts = lastsForAnimation[storageName];
    if (element) {
      // Remove from oldStorage
      oldStorage[storageName][oldRawIndex] = null;
      prepareAnimationWhenHasOld(lasts, element);
    }
    // If invisible and no old element, do not create new element (for optimizing).
    else if (!thisInvisible) {
      element = new Ctor();
      if (element instanceof Displayable$1) {
        element.z2 = calculateZ2(depth, z);
      }
      prepareAnimationWhenNoOld(lasts, element);
    }
    // Set to thisStorage
    return thisStorage[storageName][thisRawIndex] = element;
  }
  function prepareAnimationWhenHasOld(lasts, element) {
    var lastCfg = lasts[thisRawIndex] = {};
    if (element instanceof Group$3) {
      lastCfg.oldX = element.x;
      lastCfg.oldY = element.y;
    } else {
      lastCfg.oldShape = extend({}, element.shape);
    }
  }
  // If a element is new, we need to find the animation start point carefully,
  // otherwise it will looks strange when 'zoomToNode'.
  function prepareAnimationWhenNoOld(lasts, element) {
    var lastCfg = lasts[thisRawIndex] = {};
    var parentNode = thisNode.parentNode;
    var isGroup = element instanceof Group$5;
    if (parentNode && (!reRoot || reRoot.direction === 'drillDown')) {
      var parentOldX = 0;
      var parentOldY = 0;
      // New nodes appear from right-bottom corner in 'zoomToNode' animation.
      // For convenience, get old bounding rect from background.
      var parentOldBg = lastsForAnimation.background[parentNode.getRawIndex()];
      if (!reRoot && parentOldBg && parentOldBg.oldShape) {
        parentOldX = parentOldBg.oldShape.width;
        parentOldY = parentOldBg.oldShape.height;
      }
      // When no parent old shape found, its parent is new too,
      // so we can just use {x:0, y:0}.
      if (isGroup) {
        lastCfg.oldX = 0;
        lastCfg.oldY = parentOldY;
      } else {
        lastCfg.oldShape = {
          x: parentOldX,
          y: parentOldY,
          width: 0,
          height: 0
        };
      }
    }
    // Fade in, user can be aware that these nodes are new.
    lastCfg.fadein = !isGroup;
  }
}
// We cannot set all background with the same z, because the behaviour of
// drill down and roll up differ background creation sequence from tree
// hierarchy sequence, which cause lower background elements to overlap
// upper ones. So we calculate z based on depth.
// Moreover, we try to shrink down z interval to [0, 1] to avoid that
// treemap with large z overlaps other components.
function calculateZ2(depth, z2InLevel) {
  return depth * Z2_BASE + z2InLevel;
}
var TreemapView$1 = TreemapView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each$c = each$f;
var isObject = isObject$3;
var CATEGORY_DEFAULT_VISUAL_INDEX = -1;
var VisualMapping = /** @class */function () {
  function VisualMapping(option) {
    var mappingMethod = option.mappingMethod;
    var visualType = option.type;
    var thisOption = this.option = clone$4(option);
    this.type = visualType;
    this.mappingMethod = mappingMethod;
    this._normalizeData = normalizers[mappingMethod];
    var visualHandler = VisualMapping.visualHandlers[visualType];
    this.applyVisual = visualHandler.applyVisual;
    this.getColorMapper = visualHandler.getColorMapper;
    this._normalizedToVisual = visualHandler._normalizedToVisual[mappingMethod];
    if (mappingMethod === 'piecewise') {
      normalizeVisualRange(thisOption);
      preprocessForPiecewise(thisOption);
    } else if (mappingMethod === 'category') {
      thisOption.categories ? preprocessForSpecifiedCategory(thisOption)
      // categories is ordinal when thisOption.categories not specified,
      // which need no more preprocess except normalize visual.
      : normalizeVisualRange(thisOption, true);
    } else {
      // mappingMethod === 'linear' or 'fixed'
      assert(mappingMethod !== 'linear' || thisOption.dataExtent);
      normalizeVisualRange(thisOption);
    }
  }
  VisualMapping.prototype.mapValueToVisual = function (value) {
    var normalized = this._normalizeData(value);
    return this._normalizedToVisual(normalized, value);
  };
  VisualMapping.prototype.getNormalizer = function () {
    return bind$1(this._normalizeData, this);
  };
  /**
   * List available visual types.
   *
   * @public
   * @return {Array.<string>}
   */
  VisualMapping.listVisualTypes = function () {
    return keys(VisualMapping.visualHandlers);
  };
  // /**
  //  * @public
  //  */
  // static addVisualHandler(name, handler) {
  //     visualHandlers[name] = handler;
  // }
  /**
   * @public
   */
  VisualMapping.isValidType = function (visualType) {
    return VisualMapping.visualHandlers.hasOwnProperty(visualType);
  };
  /**
   * Convenient method.
   * Visual can be Object or Array or primary type.
   */
  VisualMapping.eachVisual = function (visual, callback, context) {
    if (isObject$3(visual)) {
      each$f(visual, callback, context);
    } else {
      callback.call(context, visual);
    }
  };
  VisualMapping.mapVisual = function (visual, callback, context) {
    var isPrimary;
    var newVisual = isArray$1(visual) ? [] : isObject$3(visual) ? {} : (isPrimary = true, null);
    VisualMapping.eachVisual(visual, function (v, key) {
      var newVal = callback.call(context, v, key);
      isPrimary ? newVisual = newVal : newVisual[key] = newVal;
    });
    return newVisual;
  };
  /**
   * Retrieve visual properties from given object.
   */
  VisualMapping.retrieveVisuals = function (obj) {
    var ret = {};
    var hasVisual;
    obj && each$c(VisualMapping.visualHandlers, function (h, visualType) {
      if (obj.hasOwnProperty(visualType)) {
        ret[visualType] = obj[visualType];
        hasVisual = true;
      }
    });
    return hasVisual ? ret : null;
  };
  /**
   * Give order to visual types, considering colorSaturation, colorAlpha depends on color.
   *
   * @public
   * @param {(Object|Array)} visualTypes If Object, like: {color: ..., colorSaturation: ...}
   *                                     IF Array, like: ['color', 'symbol', 'colorSaturation']
   * @return {Array.<string>} Sorted visual types.
   */
  VisualMapping.prepareVisualTypes = function (visualTypes) {
    if (isArray$1(visualTypes)) {
      visualTypes = visualTypes.slice();
    } else if (isObject(visualTypes)) {
      var types_1 = [];
      each$c(visualTypes, function (item, type) {
        types_1.push(type);
      });
      visualTypes = types_1;
    } else {
      return [];
    }
    visualTypes.sort(function (type1, type2) {
      // color should be front of colorSaturation, colorAlpha, ...
      // symbol and symbolSize do not matter.
      return type2 === 'color' && type1 !== 'color' && type1.indexOf('color') === 0 ? 1 : -1;
    });
    return visualTypes;
  };
  /**
   * 'color', 'colorSaturation', 'colorAlpha', ... are depends on 'color'.
   * Other visuals are only depends on themself.
   */
  VisualMapping.dependsOn = function (visualType1, visualType2) {
    return visualType2 === 'color' ? !!(visualType1 && visualType1.indexOf(visualType2) === 0) : visualType1 === visualType2;
  };
  /**
   * @param value
   * @param pieceList [{value: ..., interval: [min, max]}, ...]
   *                         Always from small to big.
   * @param findClosestWhenOutside Default to be false
   * @return index
   */
  VisualMapping.findPieceIndex = function (value, pieceList, findClosestWhenOutside) {
    var possibleI;
    var abs = Infinity;
    // value has the higher priority.
    for (var i = 0, len = pieceList.length; i < len; i++) {
      var pieceValue = pieceList[i].value;
      if (pieceValue != null) {
        if (pieceValue === value
        // FIXME
        // It is supposed to compare value according to value type of dimension,
        // but currently value type can exactly be string or number.
        // Compromise for numeric-like string (like '12'), especially
        // in the case that visualMap.categories is ['22', '33'].
        || isString(pieceValue) && pieceValue === value + '') {
          return i;
        }
        findClosestWhenOutside && updatePossible(pieceValue, i);
      }
    }
    for (var i = 0, len = pieceList.length; i < len; i++) {
      var piece = pieceList[i];
      var interval = piece.interval;
      var close_1 = piece.close;
      if (interval) {
        if (interval[0] === -Infinity) {
          if (littleThan(close_1[1], value, interval[1])) {
            return i;
          }
        } else if (interval[1] === Infinity) {
          if (littleThan(close_1[0], interval[0], value)) {
            return i;
          }
        } else if (littleThan(close_1[0], interval[0], value) && littleThan(close_1[1], value, interval[1])) {
          return i;
        }
        findClosestWhenOutside && updatePossible(interval[0], i);
        findClosestWhenOutside && updatePossible(interval[1], i);
      }
    }
    if (findClosestWhenOutside) {
      return value === Infinity ? pieceList.length - 1 : value === -Infinity ? 0 : possibleI;
    }
    function updatePossible(val, index) {
      var newAbs = Math.abs(val - value);
      if (newAbs < abs) {
        abs = newAbs;
        possibleI = index;
      }
    }
  };
  VisualMapping.visualHandlers = {
    color: {
      applyVisual: makeApplyVisual('color'),
      getColorMapper: function () {
        var thisOption = this.option;
        return bind$1(thisOption.mappingMethod === 'category' ? function (value, isNormalized) {
          !isNormalized && (value = this._normalizeData(value));
          return doMapCategory.call(this, value);
        } : function (value, isNormalized, out) {
          // If output rgb array
          // which will be much faster and useful in pixel manipulation
          var returnRGBArray = !!out;
          !isNormalized && (value = this._normalizeData(value));
          out = fastLerp(value, thisOption.parsedVisual, out);
          return returnRGBArray ? out : stringify(out, 'rgba');
        }, this);
      },
      _normalizedToVisual: {
        linear: function (normalized) {
          return stringify(fastLerp(normalized, this.option.parsedVisual), 'rgba');
        },
        category: doMapCategory,
        piecewise: function (normalized, value) {
          var result = getSpecifiedVisual.call(this, value);
          if (result == null) {
            result = stringify(fastLerp(normalized, this.option.parsedVisual), 'rgba');
          }
          return result;
        },
        fixed: doMapFixed
      }
    },
    colorHue: makePartialColorVisualHandler(function (color, value) {
      return modifyHSL(color, value);
    }),
    colorSaturation: makePartialColorVisualHandler(function (color, value) {
      return modifyHSL(color, null, value);
    }),
    colorLightness: makePartialColorVisualHandler(function (color, value) {
      return modifyHSL(color, null, null, value);
    }),
    colorAlpha: makePartialColorVisualHandler(function (color, value) {
      return modifyAlpha(color, value);
    }),
    decal: {
      applyVisual: makeApplyVisual('decal'),
      _normalizedToVisual: {
        linear: null,
        category: doMapCategory,
        piecewise: null,
        fixed: null
      }
    },
    opacity: {
      applyVisual: makeApplyVisual('opacity'),
      _normalizedToVisual: createNormalizedToNumericVisual([0, 1])
    },
    liftZ: {
      applyVisual: makeApplyVisual('liftZ'),
      _normalizedToVisual: {
        linear: doMapFixed,
        category: doMapFixed,
        piecewise: doMapFixed,
        fixed: doMapFixed
      }
    },
    symbol: {
      applyVisual: function (value, getter, setter) {
        var symbolCfg = this.mapValueToVisual(value);
        setter('symbol', symbolCfg);
      },
      _normalizedToVisual: {
        linear: doMapToArray,
        category: doMapCategory,
        piecewise: function (normalized, value) {
          var result = getSpecifiedVisual.call(this, value);
          if (result == null) {
            result = doMapToArray.call(this, normalized);
          }
          return result;
        },
        fixed: doMapFixed
      }
    },
    symbolSize: {
      applyVisual: makeApplyVisual('symbolSize'),
      _normalizedToVisual: createNormalizedToNumericVisual([0, 1])
    }
  };
  return VisualMapping;
}();
function preprocessForPiecewise(thisOption) {
  var pieceList = thisOption.pieceList;
  thisOption.hasSpecialVisual = false;
  each$f(pieceList, function (piece, index) {
    piece.originIndex = index;
    // piece.visual is "result visual value" but not
    // a visual range, so it does not need to be normalized.
    if (piece.visual != null) {
      thisOption.hasSpecialVisual = true;
    }
  });
}
function preprocessForSpecifiedCategory(thisOption) {
  // Hash categories.
  var categories = thisOption.categories;
  var categoryMap = thisOption.categoryMap = {};
  var visual = thisOption.visual;
  each$c(categories, function (cate, index) {
    categoryMap[cate] = index;
  });
  // Process visual map input.
  if (!isArray$1(visual)) {
    var visualArr_1 = [];
    if (isObject$3(visual)) {
      each$c(visual, function (v, cate) {
        var index = categoryMap[cate];
        visualArr_1[index != null ? index : CATEGORY_DEFAULT_VISUAL_INDEX] = v;
      });
    } else {
      // Is primary type, represents default visual.
      visualArr_1[CATEGORY_DEFAULT_VISUAL_INDEX] = visual;
    }
    visual = setVisualToOption(thisOption, visualArr_1);
  }
  // Remove categories that has no visual,
  // then we can mapping them to CATEGORY_DEFAULT_VISUAL_INDEX.
  for (var i = categories.length - 1; i >= 0; i--) {
    if (visual[i] == null) {
      delete categoryMap[categories[i]];
      categories.pop();
    }
  }
}
function normalizeVisualRange(thisOption, isCategory) {
  var visual = thisOption.visual;
  var visualArr = [];
  if (isObject$3(visual)) {
    each$c(visual, function (v) {
      visualArr.push(v);
    });
  } else if (visual != null) {
    visualArr.push(visual);
  }
  var doNotNeedPair = {
    color: 1,
    symbol: 1
  };
  if (!isCategory && visualArr.length === 1 && !doNotNeedPair.hasOwnProperty(thisOption.type)) {
    // Do not care visualArr.length === 0, which is illegal.
    visualArr[1] = visualArr[0];
  }
  setVisualToOption(thisOption, visualArr);
}
function makePartialColorVisualHandler(applyValue) {
  return {
    applyVisual: function (value, getter, setter) {
      // Only used in HSL
      var colorChannel = this.mapValueToVisual(value);
      // Must not be array value
      setter('color', applyValue(getter('color'), colorChannel));
    },
    _normalizedToVisual: createNormalizedToNumericVisual([0, 1])
  };
}
function doMapToArray(normalized) {
  var visual = this.option.visual;
  return visual[Math.round(linearMap$2(normalized, [0, 1], [0, visual.length - 1], true))] || {}; // TODO {}?
}
function makeApplyVisual(visualType) {
  return function (value, getter, setter) {
    setter(visualType, this.mapValueToVisual(value));
  };
}
function doMapCategory(normalized) {
  var visual = this.option.visual;
  return visual[this.option.loop && normalized !== CATEGORY_DEFAULT_VISUAL_INDEX ? normalized % visual.length : normalized];
}
function doMapFixed() {
  // visual will be convert to array.
  return this.option.visual[0];
}
/**
 * Create mapped to numeric visual
 */
function createNormalizedToNumericVisual(sourceExtent) {
  return {
    linear: function (normalized) {
      return linearMap$2(normalized, sourceExtent, this.option.visual, true);
    },
    category: doMapCategory,
    piecewise: function (normalized, value) {
      var result = getSpecifiedVisual.call(this, value);
      if (result == null) {
        result = linearMap$2(normalized, sourceExtent, this.option.visual, true);
      }
      return result;
    },
    fixed: doMapFixed
  };
}
function getSpecifiedVisual(value) {
  var thisOption = this.option;
  var pieceList = thisOption.pieceList;
  if (thisOption.hasSpecialVisual) {
    var pieceIndex = VisualMapping.findPieceIndex(value, pieceList);
    var piece = pieceList[pieceIndex];
    if (piece && piece.visual) {
      return piece.visual[this.type];
    }
  }
}
function setVisualToOption(thisOption, visualArr) {
  thisOption.visual = visualArr;
  if (thisOption.type === 'color') {
    thisOption.parsedVisual = map$1(visualArr, function (item) {
      var color = parse(item);
      if (!color && undefined !== 'production') {
        warn("'" + item + "' is an illegal color, fallback to '#000000'", true);
      }
      return color || [0, 0, 0, 1];
    });
  }
  return visualArr;
}
/**
 * Normalizers by mapping methods.
 */
var normalizers = {
  linear: function (value) {
    return linearMap$2(value, this.option.dataExtent, [0, 1], true);
  },
  piecewise: function (value) {
    var pieceList = this.option.pieceList;
    var pieceIndex = VisualMapping.findPieceIndex(value, pieceList, true);
    if (pieceIndex != null) {
      return linearMap$2(pieceIndex, [0, pieceList.length - 1], [0, 1], true);
    }
  },
  category: function (value) {
    var index = this.option.categories ? this.option.categoryMap[value] : value; // ordinal value
    return index == null ? CATEGORY_DEFAULT_VISUAL_INDEX : index;
  },
  fixed: noop
};
function littleThan(close, a, b) {
  return close ? a <= b : a < b;
}
var VisualMapping$1 = VisualMapping;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ITEM_STYLE_NORMAL = 'itemStyle';
var inner$c = makeInner();
var treemapVisual = {
  seriesType: 'treemap',
  reset: function (seriesModel) {
    var tree = seriesModel.getData().tree;
    var root = tree.root;
    if (root.isRemoved()) {
      return;
    }
    travelTree(root,
    // Visual should calculate from tree root but not view root.
    {}, seriesModel.getViewRoot().getAncestors(), seriesModel);
  }
};
function travelTree(node, designatedVisual, viewRootAncestors, seriesModel) {
  var nodeModel = node.getModel();
  var nodeLayout = node.getLayout();
  var data = node.hostTree.data;
  // Optimize
  if (!nodeLayout || nodeLayout.invisible || !nodeLayout.isInView) {
    return;
  }
  var nodeItemStyleModel = nodeModel.getModel(ITEM_STYLE_NORMAL);
  var visuals = buildVisuals(nodeItemStyleModel, designatedVisual, seriesModel);
  var existsStyle = data.ensureUniqueItemVisual(node.dataIndex, 'style');
  // calculate border color
  var borderColor = nodeItemStyleModel.get('borderColor');
  var borderColorSaturation = nodeItemStyleModel.get('borderColorSaturation');
  var thisNodeColor;
  if (borderColorSaturation != null) {
    // For performance, do not always execute 'calculateColor'.
    thisNodeColor = calculateColor(visuals);
    borderColor = calculateBorderColor(borderColorSaturation, thisNodeColor);
  }
  existsStyle.stroke = borderColor;
  var viewChildren = node.viewChildren;
  if (!viewChildren || !viewChildren.length) {
    thisNodeColor = calculateColor(visuals);
    // Apply visual to this node.
    existsStyle.fill = thisNodeColor;
  } else {
    var mapping_1 = buildVisualMapping(node, nodeModel, nodeLayout, nodeItemStyleModel, visuals, viewChildren);
    // Designate visual to children.
    each$f(viewChildren, function (child, index) {
      // If higher than viewRoot, only ancestors of viewRoot is needed to visit.
      if (child.depth >= viewRootAncestors.length || child === viewRootAncestors[child.depth]) {
        var childVisual = mapVisual$1(nodeModel, visuals, child, index, mapping_1, seriesModel);
        travelTree(child, childVisual, viewRootAncestors, seriesModel);
      }
    });
  }
}
function buildVisuals(nodeItemStyleModel, designatedVisual, seriesModel) {
  var visuals = extend({}, designatedVisual);
  var designatedVisualItemStyle = seriesModel.designatedVisualItemStyle;
  each$f(['color', 'colorAlpha', 'colorSaturation'], function (visualName) {
    // Priority: thisNode > thisLevel > parentNodeDesignated > seriesModel
    designatedVisualItemStyle[visualName] = designatedVisual[visualName];
    var val = nodeItemStyleModel.get(visualName);
    designatedVisualItemStyle[visualName] = null;
    val != null && (visuals[visualName] = val);
  });
  return visuals;
}
function calculateColor(visuals) {
  var color = getValueVisualDefine(visuals, 'color');
  if (color) {
    var colorAlpha = getValueVisualDefine(visuals, 'colorAlpha');
    var colorSaturation = getValueVisualDefine(visuals, 'colorSaturation');
    if (colorSaturation) {
      color = modifyHSL(color, null, null, colorSaturation);
    }
    if (colorAlpha) {
      color = modifyAlpha(color, colorAlpha);
    }
    return color;
  }
}
function calculateBorderColor(borderColorSaturation, thisNodeColor) {
  return thisNodeColor != null
  // Can only be string
  ? modifyHSL(thisNodeColor, null, null, borderColorSaturation) : null;
}
function getValueVisualDefine(visuals, name) {
  var value = visuals[name];
  if (value != null && value !== 'none') {
    return value;
  }
}
function buildVisualMapping(node, nodeModel, nodeLayout, nodeItemStyleModel, visuals, viewChildren) {
  if (!viewChildren || !viewChildren.length) {
    return;
  }
  var rangeVisual = getRangeVisual(nodeModel, 'color') || visuals.color != null && visuals.color !== 'none' && (getRangeVisual(nodeModel, 'colorAlpha') || getRangeVisual(nodeModel, 'colorSaturation'));
  if (!rangeVisual) {
    return;
  }
  var visualMin = nodeModel.get('visualMin');
  var visualMax = nodeModel.get('visualMax');
  var dataExtent = nodeLayout.dataExtent.slice();
  visualMin != null && visualMin < dataExtent[0] && (dataExtent[0] = visualMin);
  visualMax != null && visualMax > dataExtent[1] && (dataExtent[1] = visualMax);
  var colorMappingBy = nodeModel.get('colorMappingBy');
  var opt = {
    type: rangeVisual.name,
    dataExtent: dataExtent,
    visual: rangeVisual.range
  };
  if (opt.type === 'color' && (colorMappingBy === 'index' || colorMappingBy === 'id')) {
    opt.mappingMethod = 'category';
    opt.loop = true;
    // categories is ordinal, so do not set opt.categories.
  } else {
    opt.mappingMethod = 'linear';
  }
  var mapping = new VisualMapping$1(opt);
  inner$c(mapping).drColorMappingBy = colorMappingBy;
  return mapping;
}
// Notice: If we don't have the attribute 'colorRange', but only use
// attribute 'color' to represent both concepts of 'colorRange' and 'color',
// (It means 'colorRange' when 'color' is Array, means 'color' when not array),
// this problem will be encountered:
// If a level-1 node doesn't have children, and its siblings have children,
// and colorRange is set on level-1, then the node cannot be colored.
// So we separate 'colorRange' and 'color' to different attributes.
function getRangeVisual(nodeModel, name) {
  // 'colorRange', 'colorARange', 'colorSRange'.
  // If not exists on this node, fetch from levels and series.
  var range = nodeModel.get(name);
  return isArray$1(range) && range.length ? {
    name: name,
    range: range
  } : null;
}
function mapVisual$1(nodeModel, visuals, child, index, mapping, seriesModel) {
  var childVisuals = extend({}, visuals);
  if (mapping) {
    // Only support color, colorAlpha, colorSaturation.
    var mappingType = mapping.type;
    var colorMappingBy = mappingType === 'color' && inner$c(mapping).drColorMappingBy;
    var value = colorMappingBy === 'index' ? index : colorMappingBy === 'id' ? seriesModel.mapIdToIndex(child.getId()) : child.getValue(nodeModel.get('visualDimension'));
    childVisuals[mappingType] = mapping.mapValueToVisual(value);
  }
  return childVisuals;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var mathMax$3 = Math.max;
var mathMin$3 = Math.min;
var retrieveValue = retrieve;
var each$b = each$f;
var PATH_BORDER_WIDTH = ['itemStyle', 'borderWidth'];
var PATH_GAP_WIDTH = ['itemStyle', 'gapWidth'];
var PATH_UPPER_LABEL_SHOW = ['upperLabel', 'show'];
var PATH_UPPER_LABEL_HEIGHT = ['upperLabel', 'height'];
/**
 * @public
 */
var treemapLayout = {
  seriesType: 'treemap',
  reset: function (seriesModel, ecModel, api, payload) {
    // Layout result in each node:
    // {x, y, width, height, area, borderWidth}
    var ecWidth = api.getWidth();
    var ecHeight = api.getHeight();
    var seriesOption = seriesModel.option;
    var layoutInfo = getLayoutRect(seriesModel.getBoxLayoutParams(), {
      width: api.getWidth(),
      height: api.getHeight()
    });
    var size = seriesOption.size || []; // Compatible with ec2.
    var containerWidth = parsePercent(retrieveValue(layoutInfo.width, size[0]), ecWidth);
    var containerHeight = parsePercent(retrieveValue(layoutInfo.height, size[1]), ecHeight);
    // Fetch payload info.
    var payloadType = payload && payload.type;
    var types = ['treemapZoomToNode', 'treemapRootToNode'];
    var targetInfo = retrieveTargetInfo(payload, types, seriesModel);
    var rootRect = payloadType === 'treemapRender' || payloadType === 'treemapMove' ? payload.rootRect : null;
    var viewRoot = seriesModel.getViewRoot();
    var viewAbovePath = getPathToRoot(viewRoot);
    if (payloadType !== 'treemapMove') {
      var rootSize = payloadType === 'treemapZoomToNode' ? estimateRootSize(seriesModel, targetInfo, viewRoot, containerWidth, containerHeight) : rootRect ? [rootRect.width, rootRect.height] : [containerWidth, containerHeight];
      var sort_1 = seriesOption.sort;
      if (sort_1 && sort_1 !== 'asc' && sort_1 !== 'desc') {
        // Default to be desc order.
        sort_1 = 'desc';
      }
      var options = {
        squareRatio: seriesOption.squareRatio,
        sort: sort_1,
        leafDepth: seriesOption.leafDepth
      };
      // layout should be cleared because using updateView but not update.
      viewRoot.hostTree.clearLayouts();
      // TODO
      // optimize: if out of view clip, do not layout.
      // But take care that if do not render node out of view clip,
      // how to calculate start po
      var viewRootLayout_1 = {
        x: 0,
        y: 0,
        width: rootSize[0],
        height: rootSize[1],
        area: rootSize[0] * rootSize[1]
      };
      viewRoot.setLayout(viewRootLayout_1);
      squarify(viewRoot, options, false, 0);
      // Supplement layout.
      viewRootLayout_1 = viewRoot.getLayout();
      each$b(viewAbovePath, function (node, index) {
        var childValue = (viewAbovePath[index + 1] || viewRoot).getValue();
        node.setLayout(extend({
          dataExtent: [childValue, childValue],
          borderWidth: 0,
          upperHeight: 0
        }, viewRootLayout_1));
      });
    }
    var treeRoot = seriesModel.getData().tree.root;
    treeRoot.setLayout(calculateRootPosition(layoutInfo, rootRect, targetInfo), true);
    seriesModel.setLayoutInfo(layoutInfo);
    // FIXME
    // 现在没有clip功能，暂时取ec高宽。
    prunning(treeRoot,
    // Transform to base element coordinate system.
    new BoundingRect$1(-layoutInfo.x, -layoutInfo.y, ecWidth, ecHeight), viewAbovePath, viewRoot, 0);
  }
};
/**
 * Layout treemap with squarify algorithm.
 * The original presentation of this algorithm
 * was made by Mark Bruls, Kees Huizing, and Jarke J. van Wijk
 * <https://graphics.ethz.ch/teaching/scivis_common/Literature/squarifiedTreeMaps.pdf>.
 * The implementation of this algorithm was originally copied from "d3.js"
 * <https://github.com/d3/d3/blob/9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74/src/layout/treemap.js>
 * with some modifications made for this program.
 * See the license statement at the head of this file.
 *
 * @protected
 * @param {module:echarts/data/Tree~TreeNode} node
 * @param {Object} options
 * @param {string} options.sort 'asc' or 'desc'
 * @param {number} options.squareRatio
 * @param {boolean} hideChildren
 * @param {number} depth
 */
function squarify(node, options, hideChildren, depth) {
  var width;
  var height;
  if (node.isRemoved()) {
    return;
  }
  var thisLayout = node.getLayout();
  width = thisLayout.width;
  height = thisLayout.height;
  // Considering border and gap
  var nodeModel = node.getModel();
  var borderWidth = nodeModel.get(PATH_BORDER_WIDTH);
  var halfGapWidth = nodeModel.get(PATH_GAP_WIDTH) / 2;
  var upperLabelHeight = getUpperLabelHeight(nodeModel);
  var upperHeight = Math.max(borderWidth, upperLabelHeight);
  var layoutOffset = borderWidth - halfGapWidth;
  var layoutOffsetUpper = upperHeight - halfGapWidth;
  node.setLayout({
    borderWidth: borderWidth,
    upperHeight: upperHeight,
    upperLabelHeight: upperLabelHeight
  }, true);
  width = mathMax$3(width - 2 * layoutOffset, 0);
  height = mathMax$3(height - layoutOffset - layoutOffsetUpper, 0);
  var totalArea = width * height;
  var viewChildren = initChildren$1(node, nodeModel, totalArea, options, hideChildren, depth);
  if (!viewChildren.length) {
    return;
  }
  var rect = {
    x: layoutOffset,
    y: layoutOffsetUpper,
    width: width,
    height: height
  };
  var rowFixedLength = mathMin$3(width, height);
  var best = Infinity; // the best row score so far
  var row = [];
  row.area = 0;
  for (var i = 0, len = viewChildren.length; i < len;) {
    var child = viewChildren[i];
    row.push(child);
    row.area += child.getLayout().area;
    var score = worst(row, rowFixedLength, options.squareRatio);
    // continue with this orientation
    if (score <= best) {
      i++;
      best = score;
    }
    // abort, and try a different orientation
    else {
      row.area -= row.pop().getLayout().area;
      position(row, rowFixedLength, rect, halfGapWidth, false);
      rowFixedLength = mathMin$3(rect.width, rect.height);
      row.length = row.area = 0;
      best = Infinity;
    }
  }
  if (row.length) {
    position(row, rowFixedLength, rect, halfGapWidth, true);
  }
  if (!hideChildren) {
    var childrenVisibleMin = nodeModel.get('childrenVisibleMin');
    if (childrenVisibleMin != null && totalArea < childrenVisibleMin) {
      hideChildren = true;
    }
  }
  for (var i = 0, len = viewChildren.length; i < len; i++) {
    squarify(viewChildren[i], options, hideChildren, depth + 1);
  }
}
/**
 * Set area to each child, and calculate data extent for visual coding.
 */
function initChildren$1(node, nodeModel, totalArea, options, hideChildren, depth) {
  var viewChildren = node.children || [];
  var orderBy = options.sort;
  orderBy !== 'asc' && orderBy !== 'desc' && (orderBy = null);
  var overLeafDepth = options.leafDepth != null && options.leafDepth <= depth;
  // leafDepth has higher priority.
  if (hideChildren && !overLeafDepth) {
    return node.viewChildren = [];
  }
  // Sort children, order by desc.
  viewChildren = filter(viewChildren, function (child) {
    return !child.isRemoved();
  });
  sort$1(viewChildren, orderBy);
  var info = statistic(nodeModel, viewChildren, orderBy);
  if (info.sum === 0) {
    return node.viewChildren = [];
  }
  info.sum = filterByThreshold(nodeModel, totalArea, info.sum, orderBy, viewChildren);
  if (info.sum === 0) {
    return node.viewChildren = [];
  }
  // Set area to each child.
  for (var i = 0, len = viewChildren.length; i < len; i++) {
    var area = viewChildren[i].getValue() / info.sum * totalArea;
    // Do not use setLayout({...}, true), because it is needed to clear last layout.
    viewChildren[i].setLayout({
      area: area
    });
  }
  if (overLeafDepth) {
    viewChildren.length && node.setLayout({
      isLeafRoot: true
    }, true);
    viewChildren.length = 0;
  }
  node.viewChildren = viewChildren;
  node.setLayout({
    dataExtent: info.dataExtent
  }, true);
  return viewChildren;
}
/**
 * Consider 'visibleMin'. Modify viewChildren and get new sum.
 */
function filterByThreshold(nodeModel, totalArea, sum, orderBy, orderedChildren) {
  // visibleMin is not supported yet when no option.sort.
  if (!orderBy) {
    return sum;
  }
  var visibleMin = nodeModel.get('visibleMin');
  var len = orderedChildren.length;
  var deletePoint = len;
  // Always travel from little value to big value.
  for (var i = len - 1; i >= 0; i--) {
    var value = orderedChildren[orderBy === 'asc' ? len - i - 1 : i].getValue();
    if (value / sum * totalArea < visibleMin) {
      deletePoint = i;
      sum -= value;
    }
  }
  orderBy === 'asc' ? orderedChildren.splice(0, len - deletePoint) : orderedChildren.splice(deletePoint, len - deletePoint);
  return sum;
}
/**
 * Sort
 */
function sort$1(viewChildren, orderBy) {
  if (orderBy) {
    viewChildren.sort(function (a, b) {
      var diff = orderBy === 'asc' ? a.getValue() - b.getValue() : b.getValue() - a.getValue();
      return diff === 0 ? orderBy === 'asc' ? a.dataIndex - b.dataIndex : b.dataIndex - a.dataIndex : diff;
    });
  }
  return viewChildren;
}
/**
 * Statistic
 */
function statistic(nodeModel, children, orderBy) {
  // Calculate sum.
  var sum = 0;
  for (var i = 0, len = children.length; i < len; i++) {
    sum += children[i].getValue();
  }
  // Statistic data extent for latter visual coding.
  // Notice: data extent should be calculate based on raw children
  // but not filtered view children, otherwise visual mapping will not
  // be stable when zoom (where children is filtered by visibleMin).
  var dimension = nodeModel.get('visualDimension');
  var dataExtent;
  // The same as area dimension.
  if (!children || !children.length) {
    dataExtent = [NaN, NaN];
  } else if (dimension === 'value' && orderBy) {
    dataExtent = [children[children.length - 1].getValue(), children[0].getValue()];
    orderBy === 'asc' && dataExtent.reverse();
  }
  // Other dimension.
  else {
    dataExtent = [Infinity, -Infinity];
    each$b(children, function (child) {
      var value = child.getValue(dimension);
      value < dataExtent[0] && (dataExtent[0] = value);
      value > dataExtent[1] && (dataExtent[1] = value);
    });
  }
  return {
    sum: sum,
    dataExtent: dataExtent
  };
}
/**
 * Computes the score for the specified row,
 * as the worst aspect ratio.
 */
function worst(row, rowFixedLength, ratio) {
  var areaMax = 0;
  var areaMin = Infinity;
  for (var i = 0, area = void 0, len = row.length; i < len; i++) {
    area = row[i].getLayout().area;
    if (area) {
      area < areaMin && (areaMin = area);
      area > areaMax && (areaMax = area);
    }
  }
  var squareArea = row.area * row.area;
  var f = rowFixedLength * rowFixedLength * ratio;
  return squareArea ? mathMax$3(f * areaMax / squareArea, squareArea / (f * areaMin)) : Infinity;
}
/**
 * Positions the specified row of nodes. Modifies `rect`.
 */
function position(row, rowFixedLength, rect, halfGapWidth, flush) {
  // When rowFixedLength === rect.width,
  // it is horizontal subdivision,
  // rowFixedLength is the width of the subdivision,
  // rowOtherLength is the height of the subdivision,
  // and nodes will be positioned from left to right.
  // wh[idx0WhenH] means: when horizontal,
  //      wh[idx0WhenH] => wh[0] => 'width'.
  //      xy[idx1WhenH] => xy[1] => 'y'.
  var idx0WhenH = rowFixedLength === rect.width ? 0 : 1;
  var idx1WhenH = 1 - idx0WhenH;
  var xy = ['x', 'y'];
  var wh = ['width', 'height'];
  var last = rect[xy[idx0WhenH]];
  var rowOtherLength = rowFixedLength ? row.area / rowFixedLength : 0;
  if (flush || rowOtherLength > rect[wh[idx1WhenH]]) {
    rowOtherLength = rect[wh[idx1WhenH]]; // over+underflow
  }
  for (var i = 0, rowLen = row.length; i < rowLen; i++) {
    var node = row[i];
    var nodeLayout = {};
    var step = rowOtherLength ? node.getLayout().area / rowOtherLength : 0;
    var wh1 = nodeLayout[wh[idx1WhenH]] = mathMax$3(rowOtherLength - 2 * halfGapWidth, 0);
    // We use Math.max/min to avoid negative width/height when considering gap width.
    var remain = rect[xy[idx0WhenH]] + rect[wh[idx0WhenH]] - last;
    var modWH = i === rowLen - 1 || remain < step ? remain : step;
    var wh0 = nodeLayout[wh[idx0WhenH]] = mathMax$3(modWH - 2 * halfGapWidth, 0);
    nodeLayout[xy[idx1WhenH]] = rect[xy[idx1WhenH]] + mathMin$3(halfGapWidth, wh1 / 2);
    nodeLayout[xy[idx0WhenH]] = last + mathMin$3(halfGapWidth, wh0 / 2);
    last += modWH;
    node.setLayout(nodeLayout, true);
  }
  rect[xy[idx1WhenH]] += rowOtherLength;
  rect[wh[idx1WhenH]] -= rowOtherLength;
}
// Return [containerWidth, containerHeight] as default.
function estimateRootSize(seriesModel, targetInfo, viewRoot, containerWidth, containerHeight) {
  // If targetInfo.node exists, we zoom to the node,
  // so estimate whole width and height by target node.
  var currNode = (targetInfo || {}).node;
  var defaultSize = [containerWidth, containerHeight];
  if (!currNode || currNode === viewRoot) {
    return defaultSize;
  }
  var parent;
  var viewArea = containerWidth * containerHeight;
  var area = viewArea * seriesModel.option.zoomToNodeRatio;
  while (parent = currNode.parentNode) {
    // jshint ignore:line
    var sum = 0;
    var siblings = parent.children;
    for (var i = 0, len = siblings.length; i < len; i++) {
      sum += siblings[i].getValue();
    }
    var currNodeValue = currNode.getValue();
    if (currNodeValue === 0) {
      return defaultSize;
    }
    area *= sum / currNodeValue;
    // Considering border, suppose aspect ratio is 1.
    var parentModel = parent.getModel();
    var borderWidth = parentModel.get(PATH_BORDER_WIDTH);
    var upperHeight = Math.max(borderWidth, getUpperLabelHeight(parentModel));
    area += 4 * borderWidth * borderWidth + (3 * borderWidth + upperHeight) * Math.pow(area, 0.5);
    area > MAX_SAFE_INTEGER && (area = MAX_SAFE_INTEGER);
    currNode = parent;
  }
  area < viewArea && (area = viewArea);
  var scale = Math.pow(area / viewArea, 0.5);
  return [containerWidth * scale, containerHeight * scale];
}
// Root position based on coord of containerGroup
function calculateRootPosition(layoutInfo, rootRect, targetInfo) {
  if (rootRect) {
    return {
      x: rootRect.x,
      y: rootRect.y
    };
  }
  var defaultPosition = {
    x: 0,
    y: 0
  };
  if (!targetInfo) {
    return defaultPosition;
  }
  // If targetInfo is fetched by 'retrieveTargetInfo',
  // old tree and new tree are the same tree,
  // so the node still exists and we can visit it.
  var targetNode = targetInfo.node;
  var layout = targetNode.getLayout();
  if (!layout) {
    return defaultPosition;
  }
  // Transform coord from local to container.
  var targetCenter = [layout.width / 2, layout.height / 2];
  var node = targetNode;
  while (node) {
    var nodeLayout = node.getLayout();
    targetCenter[0] += nodeLayout.x;
    targetCenter[1] += nodeLayout.y;
    node = node.parentNode;
  }
  return {
    x: layoutInfo.width / 2 - targetCenter[0],
    y: layoutInfo.height / 2 - targetCenter[1]
  };
}
// Mark nodes visible for prunning when visual coding and rendering.
// Prunning depends on layout and root position, so we have to do it after layout.
function prunning(node, clipRect, viewAbovePath, viewRoot, depth) {
  var nodeLayout = node.getLayout();
  var nodeInViewAbovePath = viewAbovePath[depth];
  var isAboveViewRoot = nodeInViewAbovePath && nodeInViewAbovePath === node;
  if (nodeInViewAbovePath && !isAboveViewRoot || depth === viewAbovePath.length && node !== viewRoot) {
    return;
  }
  node.setLayout({
    // isInView means: viewRoot sub tree + viewAbovePath
    isInView: true,
    // invisible only means: outside view clip so that the node can not
    // see but still layout for animation preparation but not render.
    invisible: !isAboveViewRoot && !clipRect.intersect(nodeLayout),
    isAboveViewRoot: isAboveViewRoot
  }, true);
  // Transform to child coordinate.
  var childClipRect = new BoundingRect$1(clipRect.x - nodeLayout.x, clipRect.y - nodeLayout.y, clipRect.width, clipRect.height);
  each$b(node.viewChildren || [], function (child) {
    prunning(child, childClipRect, viewAbovePath, viewRoot, depth + 1);
  });
}
function getUpperLabelHeight(model) {
  return model.get(PATH_UPPER_LABEL_SHOW) ? model.get(PATH_UPPER_LABEL_HEIGHT) : 0;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$I(registers) {
  registers.registerSeriesModel(TreemapSeriesModel$1);
  registers.registerChartView(TreemapView$1);
  registers.registerVisual(treemapVisual);
  registers.registerLayout(treemapLayout);
  installTreemapAction(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function categoryFilter(ecModel) {
  var legendModels = ecModel.findComponents({
    mainType: 'legend'
  });
  if (!legendModels || !legendModels.length) {
    return;
  }
  ecModel.eachSeriesByType('graph', function (graphSeries) {
    var categoriesData = graphSeries.getCategoriesData();
    var graph = graphSeries.getGraph();
    var data = graph.data;
    var categoryNames = categoriesData.mapArray(categoriesData.getName);
    data.filterSelf(function (idx) {
      var model = data.getItemModel(idx);
      var category = model.getShallow('category');
      if (category != null) {
        if (isNumber(category)) {
          category = categoryNames[category];
        }
        // If in any legend component the status is not selected.
        for (var i = 0; i < legendModels.length; i++) {
          if (!legendModels[i].isSelected(category)) {
            return false;
          }
        }
      }
      return true;
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function categoryVisual(ecModel) {
  var paletteScope = {};
  ecModel.eachSeriesByType('graph', function (seriesModel) {
    var categoriesData = seriesModel.getCategoriesData();
    var data = seriesModel.getData();
    var categoryNameIdxMap = {};
    categoriesData.each(function (idx) {
      var name = categoriesData.getName(idx);
      // Add prefix to avoid conflict with Object.prototype.
      categoryNameIdxMap['ec-' + name] = idx;
      var itemModel = categoriesData.getItemModel(idx);
      var style = itemModel.getModel('itemStyle').getItemStyle();
      if (!style.fill) {
        // Get color from palette.
        style.fill = seriesModel.getColorFromPalette(name, paletteScope);
      }
      categoriesData.setItemVisual(idx, 'style', style);
      var symbolVisualList = ['symbol', 'symbolSize', 'symbolKeepAspect'];
      for (var i = 0; i < symbolVisualList.length; i++) {
        var symbolVisual = itemModel.getShallow(symbolVisualList[i], true);
        if (symbolVisual != null) {
          categoriesData.setItemVisual(idx, symbolVisualList[i], symbolVisual);
        }
      }
    });
    // Assign category color to visual
    if (categoriesData.count()) {
      data.each(function (idx) {
        var model = data.getItemModel(idx);
        var categoryIdx = model.getShallow('category');
        if (categoryIdx != null) {
          if (isString(categoryIdx)) {
            categoryIdx = categoryNameIdxMap['ec-' + categoryIdx];
          }
          var categoryStyle = categoriesData.getItemVisual(categoryIdx, 'style');
          var style = data.ensureUniqueItemVisual(idx, 'style');
          extend(style, categoryStyle);
          var visualList = ['symbol', 'symbolSize', 'symbolKeepAspect'];
          for (var i = 0; i < visualList.length; i++) {
            data.setItemVisual(idx, visualList[i], categoriesData.getItemVisual(categoryIdx, visualList[i]));
          }
        }
      });
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function normalize$4(a) {
  if (!(a instanceof Array)) {
    a = [a, a];
  }
  return a;
}
function graphEdgeVisual(ecModel) {
  ecModel.eachSeriesByType('graph', function (seriesModel) {
    var graph = seriesModel.getGraph();
    var edgeData = seriesModel.getEdgeData();
    var symbolType = normalize$4(seriesModel.get('edgeSymbol'));
    var symbolSize = normalize$4(seriesModel.get('edgeSymbolSize'));
    // const colorQuery = ['lineStyle', 'color'] as const;
    // const opacityQuery = ['lineStyle', 'opacity'] as const;
    edgeData.setVisual('fromSymbol', symbolType && symbolType[0]);
    edgeData.setVisual('toSymbol', symbolType && symbolType[1]);
    edgeData.setVisual('fromSymbolSize', symbolSize && symbolSize[0]);
    edgeData.setVisual('toSymbolSize', symbolSize && symbolSize[1]);
    edgeData.setVisual('style', seriesModel.getModel('lineStyle').getLineStyle());
    edgeData.each(function (idx) {
      var itemModel = edgeData.getItemModel(idx);
      var edge = graph.getEdgeByIndex(idx);
      var symbolType = normalize$4(itemModel.getShallow('symbol', true));
      var symbolSize = normalize$4(itemModel.getShallow('symbolSize', true));
      // Edge visual must after node visual
      var style = itemModel.getModel('lineStyle').getLineStyle();
      var existsStyle = edgeData.ensureUniqueItemVisual(idx, 'style');
      extend(existsStyle, style);
      switch (existsStyle.stroke) {
        case 'source':
          {
            var nodeStyle = edge.node1.getVisual('style');
            existsStyle.stroke = nodeStyle && nodeStyle.fill;
            break;
          }
        case 'target':
          {
            var nodeStyle = edge.node2.getVisual('style');
            existsStyle.stroke = nodeStyle && nodeStyle.fill;
            break;
          }
      }
      symbolType[0] && edge.setVisual('fromSymbol', symbolType[0]);
      symbolType[1] && edge.setVisual('toSymbol', symbolType[1]);
      symbolSize[0] && edge.setVisual('fromSymbolSize', symbolSize[0]);
      symbolSize[1] && edge.setVisual('toSymbolSize', symbolSize[1]);
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var KEY_DELIMITER = '-->';
/**
 * params handler
 * @param {module:echarts/model/SeriesModel} seriesModel
 * @returns {*}
 */
var getAutoCurvenessParams = function (seriesModel) {
  return seriesModel.get('autoCurveness') || null;
};
/**
 * Generate a list of edge curvatures, 20 is the default
 * @param {module:echarts/model/SeriesModel} seriesModel
 * @param {number} appendLength
 * @return  20 => [0, -0.2, 0.2, -0.4, 0.4, -0.6, 0.6, -0.8, 0.8, -1, 1, -1.2, 1.2, -1.4, 1.4, -1.6, 1.6, -1.8, 1.8, -2]
 */
var createCurveness = function (seriesModel, appendLength) {
  var autoCurvenessParmas = getAutoCurvenessParams(seriesModel);
  var length = 20;
  var curvenessList = [];
  // handler the function set
  if (isNumber(autoCurvenessParmas)) {
    length = autoCurvenessParmas;
  } else if (isArray$1(autoCurvenessParmas)) {
    seriesModel.__curvenessList = autoCurvenessParmas;
    return;
  }
  // append length
  if (appendLength > length) {
    length = appendLength;
  }
  // make sure the length is even
  var len = length % 2 ? length + 2 : length + 3;
  curvenessList = [];
  for (var i = 0; i < len; i++) {
    curvenessList.push((i % 2 ? i + 1 : i) / 10 * (i % 2 ? -1 : 1));
  }
  seriesModel.__curvenessList = curvenessList;
};
/**
 * Create different cache key data in the positive and negative directions, in order to set the curvature later
 * @param {number|string|module:echarts/data/Graph.Node} n1
 * @param {number|string|module:echarts/data/Graph.Node} n2
 * @param {module:echarts/model/SeriesModel} seriesModel
 * @returns {string} key
 */
var getKeyOfEdges = function (n1, n2, seriesModel) {
  var source = [n1.id, n1.dataIndex].join('.');
  var target = [n2.id, n2.dataIndex].join('.');
  return [seriesModel.uid, source, target].join(KEY_DELIMITER);
};
/**
 * get opposite key
 * @param {string} key
 * @returns {string}
 */
var getOppositeKey = function (key) {
  var keys = key.split(KEY_DELIMITER);
  return [keys[0], keys[2], keys[1]].join(KEY_DELIMITER);
};
/**
 * get edgeMap with key
 * @param edge
 * @param {module:echarts/model/SeriesModel} seriesModel
 */
var getEdgeFromMap = function (edge, seriesModel) {
  var key = getKeyOfEdges(edge.node1, edge.node2, seriesModel);
  return seriesModel.__edgeMap[key];
};
/**
 * calculate all cases total length
 * @param edge
 * @param seriesModel
 * @returns {number}
 */
var getTotalLengthBetweenNodes = function (edge, seriesModel) {
  var len = getEdgeMapLengthWithKey(getKeyOfEdges(edge.node1, edge.node2, seriesModel), seriesModel);
  var lenV = getEdgeMapLengthWithKey(getKeyOfEdges(edge.node2, edge.node1, seriesModel), seriesModel);
  return len + lenV;
};
/**
 *
 * @param key
 */
var getEdgeMapLengthWithKey = function (key, seriesModel) {
  var edgeMap = seriesModel.__edgeMap;
  return edgeMap[key] ? edgeMap[key].length : 0;
};
/**
 * Count the number of edges between the same two points, used to obtain the curvature table and the parity of the edge
 * @see /graph/GraphSeries.js@getInitialData
 * @param {module:echarts/model/SeriesModel} seriesModel
 */
function initCurvenessList(seriesModel) {
  if (!getAutoCurvenessParams(seriesModel)) {
    return;
  }
  seriesModel.__curvenessList = [];
  seriesModel.__edgeMap = {};
  // calc the array of curveness List
  createCurveness(seriesModel);
}
/**
 * set edgeMap with key
 * @param {number|string|module:echarts/data/Graph.Node} n1
 * @param {number|string|module:echarts/data/Graph.Node} n2
 * @param {module:echarts/model/SeriesModel} seriesModel
 * @param {number} index
 */
function createEdgeMapForCurveness(n1, n2, seriesModel, index) {
  if (!getAutoCurvenessParams(seriesModel)) {
    return;
  }
  var key = getKeyOfEdges(n1, n2, seriesModel);
  var edgeMap = seriesModel.__edgeMap;
  var oppositeEdges = edgeMap[getOppositeKey(key)];
  // set direction
  if (edgeMap[key] && !oppositeEdges) {
    edgeMap[key].isForward = true;
  } else if (oppositeEdges && edgeMap[key]) {
    oppositeEdges.isForward = true;
    edgeMap[key].isForward = false;
  }
  edgeMap[key] = edgeMap[key] || [];
  edgeMap[key].push(index);
}
/**
 * get curvature for edge
 * @param edge
 * @param {module:echarts/model/SeriesModel} seriesModel
 * @param index
 */
function getCurvenessForEdge(edge, seriesModel, index, needReverse) {
  var autoCurvenessParams = getAutoCurvenessParams(seriesModel);
  var isArrayParam = isArray$1(autoCurvenessParams);
  if (!autoCurvenessParams) {
    return null;
  }
  var edgeArray = getEdgeFromMap(edge, seriesModel);
  if (!edgeArray) {
    return null;
  }
  var edgeIndex = -1;
  for (var i = 0; i < edgeArray.length; i++) {
    if (edgeArray[i] === index) {
      edgeIndex = i;
      break;
    }
  }
  // if totalLen is Longer createCurveness
  var totalLen = getTotalLengthBetweenNodes(edge, seriesModel);
  createCurveness(seriesModel, totalLen);
  edge.lineStyle = edge.lineStyle || {};
  // if is opposite edge, must set curvenss to opposite number
  var curKey = getKeyOfEdges(edge.node1, edge.node2, seriesModel);
  var curvenessList = seriesModel.__curvenessList;
  // if pass array no need parity
  var parityCorrection = isArrayParam ? 0 : totalLen % 2 ? 0 : 1;
  if (!edgeArray.isForward) {
    // the opposite edge show outside
    var oppositeKey = getOppositeKey(curKey);
    var len = getEdgeMapLengthWithKey(oppositeKey, seriesModel);
    var resValue = curvenessList[edgeIndex + len + parityCorrection];
    // isNeedReverse, simple, force type need reverse the curveness in the junction of the forword and the opposite
    if (needReverse) {
      // set as array may make the parity handle with the len of opposite
      if (isArrayParam) {
        if (autoCurvenessParams && autoCurvenessParams[0] === 0) {
          return (len + parityCorrection) % 2 ? resValue : -resValue;
        } else {
          return ((len % 2 ? 0 : 1) + parityCorrection) % 2 ? resValue : -resValue;
        }
      } else {
        return (len + parityCorrection) % 2 ? resValue : -resValue;
      }
    } else {
      return curvenessList[edgeIndex + len + parityCorrection];
    }
  } else {
    return curvenessList[parityCorrection + edgeIndex];
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function simpleLayout(seriesModel) {
  var coordSys = seriesModel.coordinateSystem;
  if (coordSys && coordSys.type !== 'view') {
    return;
  }
  var graph = seriesModel.getGraph();
  graph.eachNode(function (node) {
    var model = node.getModel();
    node.setLayout([+model.get('x'), +model.get('y')]);
  });
  simpleLayoutEdge(graph, seriesModel);
}
function simpleLayoutEdge(graph, seriesModel) {
  graph.eachEdge(function (edge, index) {
    var curveness = retrieve3(edge.getModel().get(['lineStyle', 'curveness']), -getCurvenessForEdge(edge, seriesModel, index, true), 0);
    var p1 = clone$3(edge.node1.getLayout());
    var p2 = clone$3(edge.node2.getLayout());
    var points = [p1, p2];
    if (+curveness) {
      points.push([(p1[0] + p2[0]) / 2 - (p1[1] - p2[1]) * curveness, (p1[1] + p2[1]) / 2 - (p2[0] - p1[0]) * curveness]);
    }
    edge.setLayout(points);
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function graphSimpleLayout(ecModel, api) {
  ecModel.eachSeriesByType('graph', function (seriesModel) {
    var layout = seriesModel.get('layout');
    var coordSys = seriesModel.coordinateSystem;
    if (coordSys && coordSys.type !== 'view') {
      var data_1 = seriesModel.getData();
      var dimensions_1 = [];
      each$f(coordSys.dimensions, function (coordDim) {
        dimensions_1 = dimensions_1.concat(data_1.mapDimensionsAll(coordDim));
      });
      for (var dataIndex = 0; dataIndex < data_1.count(); dataIndex++) {
        var value = [];
        var hasValue = false;
        for (var i = 0; i < dimensions_1.length; i++) {
          var val = data_1.get(dimensions_1[i], dataIndex);
          if (!isNaN(val)) {
            hasValue = true;
          }
          value.push(val);
        }
        if (hasValue) {
          data_1.setItemLayout(dataIndex, coordSys.dataToPoint(value));
        } else {
          // Also {Array.<number>}, not undefined to avoid if...else... statement
          data_1.setItemLayout(dataIndex, [NaN, NaN]);
        }
      }
      simpleLayoutEdge(data_1.graph, seriesModel);
    } else if (!layout || layout === 'none') {
      simpleLayout(seriesModel);
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function getNodeGlobalScale(seriesModel) {
  var coordSys = seriesModel.coordinateSystem;
  if (coordSys.type !== 'view') {
    return 1;
  }
  var nodeScaleRatio = seriesModel.option.nodeScaleRatio;
  var groupZoom = coordSys.scaleX;
  // Scale node when zoom changes
  var roamZoom = coordSys.getZoom();
  var nodeScale = (roamZoom - 1) * nodeScaleRatio + 1;
  return nodeScale / groupZoom;
}
function getSymbolSize(node) {
  var symbolSize = node.getVisual('symbolSize');
  if (symbolSize instanceof Array) {
    symbolSize = (symbolSize[0] + symbolSize[1]) / 2;
  }
  return +symbolSize;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PI$3 = Math.PI;
var _symbolRadiansHalf = [];
/**
 * `basedOn` can be:
 * 'value':
 *     This layout is not accurate and have same bad case. For example,
 *     if the min value is very smaller than the max value, the nodes
 *     with the min value probably overlap even though there is enough
 *     space to layout them. So we only use this approach in the as the
 *     init layout of the force layout.
 *     FIXME
 *     Probably we do not need this method any more but use
 *     `basedOn: 'symbolSize'` in force layout if
 *     delay its init operations to GraphView.
 * 'symbolSize':
 *     This approach work only if all of the symbol size calculated.
 *     That is, the progressive rendering is not applied to graph.
 *     FIXME
 *     If progressive rendering is applied to graph some day,
 *     probably we have to use `basedOn: 'value'`.
 */
function circularLayout(seriesModel, basedOn, draggingNode, pointer) {
  var coordSys = seriesModel.coordinateSystem;
  if (coordSys && coordSys.type !== 'view') {
    return;
  }
  var rect = coordSys.getBoundingRect();
  var nodeData = seriesModel.getData();
  var graph = nodeData.graph;
  var cx = rect.width / 2 + rect.x;
  var cy = rect.height / 2 + rect.y;
  var r = Math.min(rect.width, rect.height) / 2;
  var count = nodeData.count();
  nodeData.setLayout({
    cx: cx,
    cy: cy
  });
  if (!count) {
    return;
  }
  if (draggingNode) {
    var _a = coordSys.pointToData(pointer),
      tempX = _a[0],
      tempY = _a[1];
    var v = [tempX - cx, tempY - cy];
    normalize$6(v, v);
    scale$2(v, v, r);
    draggingNode.setLayout([cx + v[0], cy + v[1]], true);
    var circularRotateLabel = seriesModel.get(['circular', 'rotateLabel']);
    rotateNodeLabel(draggingNode, circularRotateLabel, cx, cy);
  }
  _layoutNodesBasedOn[basedOn](seriesModel, graph, nodeData, r, cx, cy, count);
  graph.eachEdge(function (edge, index) {
    var curveness = retrieve3(edge.getModel().get(['lineStyle', 'curveness']), getCurvenessForEdge(edge, seriesModel, index), 0);
    var p1 = clone$3(edge.node1.getLayout());
    var p2 = clone$3(edge.node2.getLayout());
    var cp1;
    var x12 = (p1[0] + p2[0]) / 2;
    var y12 = (p1[1] + p2[1]) / 2;
    if (+curveness) {
      curveness *= 3;
      cp1 = [cx * curveness + x12 * (1 - curveness), cy * curveness + y12 * (1 - curveness)];
    }
    edge.setLayout([p1, p2, cp1]);
  });
}
var _layoutNodesBasedOn = {
  value: function (seriesModel, graph, nodeData, r, cx, cy, count) {
    var angle = 0;
    var sum = nodeData.getSum('value');
    var unitAngle = Math.PI * 2 / (sum || count);
    graph.eachNode(function (node) {
      var value = node.getValue('value');
      var radianHalf = unitAngle * (sum ? value : 1) / 2;
      angle += radianHalf;
      node.setLayout([r * Math.cos(angle) + cx, r * Math.sin(angle) + cy]);
      angle += radianHalf;
    });
  },
  symbolSize: function (seriesModel, graph, nodeData, r, cx, cy, count) {
    var sumRadian = 0;
    _symbolRadiansHalf.length = count;
    var nodeScale = getNodeGlobalScale(seriesModel);
    graph.eachNode(function (node) {
      var symbolSize = getSymbolSize(node);
      // Normally this case will not happen, but we still add
      // some the defensive code (2px is an arbitrary value).
      isNaN(symbolSize) && (symbolSize = 2);
      symbolSize < 0 && (symbolSize = 0);
      symbolSize *= nodeScale;
      var symbolRadianHalf = Math.asin(symbolSize / 2 / r);
      // when `symbolSize / 2` is bigger than `r`.
      isNaN(symbolRadianHalf) && (symbolRadianHalf = PI$3 / 2);
      _symbolRadiansHalf[node.dataIndex] = symbolRadianHalf;
      sumRadian += symbolRadianHalf * 2;
    });
    var halfRemainRadian = (2 * PI$3 - sumRadian) / count / 2;
    var angle = 0;
    graph.eachNode(function (node) {
      var radianHalf = halfRemainRadian + _symbolRadiansHalf[node.dataIndex];
      angle += radianHalf;
      // init circular layout for
      // 1. layout undefined node
      // 2. not fixed node
      (!node.getLayout() || !node.getLayout().fixed) && node.setLayout([r * Math.cos(angle) + cx, r * Math.sin(angle) + cy]);
      angle += radianHalf;
    });
  }
};
function rotateNodeLabel(node, circularRotateLabel, cx, cy) {
  var el = node.getGraphicEl();
  // need to check if el exists. '-' value may not create node element.
  if (!el) {
    return;
  }
  var nodeModel = node.getModel();
  var labelRotate = nodeModel.get(['label', 'rotate']) || 0;
  var symbolPath = el.getSymbolPath();
  if (circularRotateLabel) {
    var pos = node.getLayout();
    var rad = Math.atan2(pos[1] - cy, pos[0] - cx);
    if (rad < 0) {
      rad = Math.PI * 2 + rad;
    }
    var isLeft = pos[0] < cx;
    if (isLeft) {
      rad = rad - Math.PI;
    }
    var textPosition = isLeft ? 'left' : 'right';
    symbolPath.setTextConfig({
      rotation: -rad,
      position: textPosition,
      origin: 'center'
    });
    var emphasisState = symbolPath.ensureState('emphasis');
    extend(emphasisState.textConfig || (emphasisState.textConfig = {}), {
      position: textPosition
    });
  } else {
    symbolPath.setTextConfig({
      rotation: labelRotate *= Math.PI / 180
    });
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function graphCircularLayout(ecModel) {
  ecModel.eachSeriesByType('graph', function (seriesModel) {
    if (seriesModel.get('layout') === 'circular') {
      circularLayout(seriesModel, 'symbolSize');
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var scaleAndAdd = scaleAndAdd$1;
// function adjacentNode(n, e) {
//     return e.n1 === n ? e.n2 : e.n1;
// }
function forceLayout(inNodes, inEdges, opts) {
  var nodes = inNodes;
  var edges = inEdges;
  var rect = opts.rect;
  var width = rect.width;
  var height = rect.height;
  var center = [rect.x + width / 2, rect.y + height / 2];
  // let scale = opts.scale || 1;
  var gravity = opts.gravity == null ? 0.1 : opts.gravity;
  // for (let i = 0; i < edges.length; i++) {
  //     let e = edges[i];
  //     let n1 = e.n1;
  //     let n2 = e.n2;
  //     n1.edges = n1.edges || [];
  //     n2.edges = n2.edges || [];
  //     n1.edges.push(e);
  //     n2.edges.push(e);
  // }
  // Init position
  for (var i = 0; i < nodes.length; i++) {
    var n = nodes[i];
    if (!n.p) {
      n.p = create$2(width * (Math.random() - 0.5) + center[0], height * (Math.random() - 0.5) + center[1]);
    }
    n.pp = clone$3(n.p);
    n.edges = null;
  }
  // Formula in 'Graph Drawing by Force-directed Placement'
  // let k = scale * Math.sqrt(width * height / nodes.length);
  // let k2 = k * k;
  var initialFriction = opts.friction == null ? 0.6 : opts.friction;
  var friction = initialFriction;
  var beforeStepCallback;
  var afterStepCallback;
  return {
    warmUp: function () {
      friction = initialFriction * 0.8;
    },
    setFixed: function (idx) {
      nodes[idx].fixed = true;
    },
    setUnfixed: function (idx) {
      nodes[idx].fixed = false;
    },
    /**
     * Before step hook
     */
    beforeStep: function (cb) {
      beforeStepCallback = cb;
    },
    /**
     * After step hook
     */
    afterStep: function (cb) {
      afterStepCallback = cb;
    },
    /**
     * Some formulas were originally copied from "d3.js"
     * https://github.com/d3/d3/blob/b516d77fb8566b576088e73410437494717ada26/src/layout/force.js
     * with some modifications made for this project.
     * See the license statement at the head of this file.
     */
    step: function (cb) {
      beforeStepCallback && beforeStepCallback(nodes, edges);
      var v12 = [];
      var nLen = nodes.length;
      for (var i = 0; i < edges.length; i++) {
        var e = edges[i];
        if (e.ignoreForceLayout) {
          continue;
        }
        var n1 = e.n1;
        var n2 = e.n2;
        sub$1(v12, n2.p, n1.p);
        var d = len(v12) - e.d;
        var w = n2.w / (n1.w + n2.w);
        if (isNaN(w)) {
          w = 0;
        }
        normalize$6(v12, v12);
        !n1.fixed && scaleAndAdd(n1.p, n1.p, v12, w * d * friction);
        !n2.fixed && scaleAndAdd(n2.p, n2.p, v12, -(1 - w) * d * friction);
      }
      // Gravity
      for (var i = 0; i < nLen; i++) {
        var n = nodes[i];
        if (!n.fixed) {
          sub$1(v12, center, n.p);
          // let d = vec2.len(v12);
          // vec2.scale(v12, v12, 1 / d);
          // let gravityFactor = gravity;
          scaleAndAdd(n.p, n.p, v12, gravity * friction);
        }
      }
      // Repulsive
      // PENDING
      for (var i = 0; i < nLen; i++) {
        var n1 = nodes[i];
        for (var j = i + 1; j < nLen; j++) {
          var n2 = nodes[j];
          sub$1(v12, n2.p, n1.p);
          var d = len(v12);
          if (d === 0) {
            // Random repulse
            set$1(v12, Math.random() - 0.5, Math.random() - 0.5);
            d = 1;
          }
          var repFact = (n1.rep + n2.rep) / d / d;
          !n1.fixed && scaleAndAdd(n1.pp, n1.pp, v12, repFact);
          !n2.fixed && scaleAndAdd(n2.pp, n2.pp, v12, -repFact);
        }
      }
      var v = [];
      for (var i = 0; i < nLen; i++) {
        var n = nodes[i];
        if (!n.fixed) {
          sub$1(v, n.p, n.pp);
          scaleAndAdd(n.p, n.p, v, friction);
          copy$1(n.pp, n.p);
        }
      }
      friction = friction * 0.992;
      var finished = friction < 0.01;
      afterStepCallback && afterStepCallback(nodes, edges, finished);
      cb && cb(finished);
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function graphForceLayout(ecModel) {
  ecModel.eachSeriesByType('graph', function (graphSeries) {
    var coordSys = graphSeries.coordinateSystem;
    if (coordSys && coordSys.type !== 'view') {
      return;
    }
    if (graphSeries.get('layout') === 'force') {
      var preservedPoints_1 = graphSeries.preservedPoints || {};
      var graph_1 = graphSeries.getGraph();
      var nodeData_1 = graph_1.data;
      var edgeData = graph_1.edgeData;
      var forceModel = graphSeries.getModel('force');
      var initLayout = forceModel.get('initLayout');
      if (graphSeries.preservedPoints) {
        nodeData_1.each(function (idx) {
          var id = nodeData_1.getId(idx);
          nodeData_1.setItemLayout(idx, preservedPoints_1[id] || [NaN, NaN]);
        });
      } else if (!initLayout || initLayout === 'none') {
        simpleLayout(graphSeries);
      } else if (initLayout === 'circular') {
        circularLayout(graphSeries, 'value');
      }
      var nodeDataExtent_1 = nodeData_1.getDataExtent('value');
      var edgeDataExtent_1 = edgeData.getDataExtent('value');
      // let edgeDataExtent = edgeData.getDataExtent('value');
      var repulsion = forceModel.get('repulsion');
      var edgeLength = forceModel.get('edgeLength');
      var repulsionArr_1 = isArray$1(repulsion) ? repulsion : [repulsion, repulsion];
      var edgeLengthArr_1 = isArray$1(edgeLength) ? edgeLength : [edgeLength, edgeLength];
      // Larger value has smaller length
      edgeLengthArr_1 = [edgeLengthArr_1[1], edgeLengthArr_1[0]];
      var nodes_1 = nodeData_1.mapArray('value', function (value, idx) {
        var point = nodeData_1.getItemLayout(idx);
        var rep = linearMap$2(value, nodeDataExtent_1, repulsionArr_1);
        if (isNaN(rep)) {
          rep = (repulsionArr_1[0] + repulsionArr_1[1]) / 2;
        }
        return {
          w: rep,
          rep: rep,
          fixed: nodeData_1.getItemModel(idx).get('fixed'),
          p: !point || isNaN(point[0]) || isNaN(point[1]) ? null : point
        };
      });
      var edges = edgeData.mapArray('value', function (value, idx) {
        var edge = graph_1.getEdgeByIndex(idx);
        var d = linearMap$2(value, edgeDataExtent_1, edgeLengthArr_1);
        if (isNaN(d)) {
          d = (edgeLengthArr_1[0] + edgeLengthArr_1[1]) / 2;
        }
        var edgeModel = edge.getModel();
        var curveness = retrieve3(edge.getModel().get(['lineStyle', 'curveness']), -getCurvenessForEdge(edge, graphSeries, idx, true), 0);
        return {
          n1: nodes_1[edge.node1.dataIndex],
          n2: nodes_1[edge.node2.dataIndex],
          d: d,
          curveness: curveness,
          ignoreForceLayout: edgeModel.get('ignoreForceLayout')
        };
      });
      // let coordSys = graphSeries.coordinateSystem;
      var rect = coordSys.getBoundingRect();
      var forceInstance = forceLayout(nodes_1, edges, {
        rect: rect,
        gravity: forceModel.get('gravity'),
        friction: forceModel.get('friction')
      });
      forceInstance.beforeStep(function (nodes, edges) {
        for (var i = 0, l = nodes.length; i < l; i++) {
          if (nodes[i].fixed) {
            // Write back to layout instance
            copy$1(nodes[i].p, graph_1.getNodeByIndex(i).getLayout());
          }
        }
      });
      forceInstance.afterStep(function (nodes, edges, stopped) {
        for (var i = 0, l = nodes.length; i < l; i++) {
          if (!nodes[i].fixed) {
            graph_1.getNodeByIndex(i).setLayout(nodes[i].p);
          }
          preservedPoints_1[nodeData_1.getId(i)] = nodes[i].p;
        }
        for (var i = 0, l = edges.length; i < l; i++) {
          var e = edges[i];
          var edge = graph_1.getEdgeByIndex(i);
          var p1 = e.n1.p;
          var p2 = e.n2.p;
          var points = edge.getLayout();
          points = points ? points.slice() : [];
          points[0] = points[0] || [];
          points[1] = points[1] || [];
          copy$1(points[0], p1);
          copy$1(points[1], p2);
          if (+e.curveness) {
            points[2] = [(p1[0] + p2[0]) / 2 - (p1[1] - p2[1]) * e.curveness, (p1[1] + p2[1]) / 2 - (p2[0] - p1[0]) * e.curveness];
          }
          edge.setLayout(points);
        }
      });
      graphSeries.forceLayout = forceInstance;
      graphSeries.preservedPoints = preservedPoints_1;
      // Step to get the layout
      forceInstance.step();
    } else {
      // Remove prev injected forceLayout instance
      graphSeries.forceLayout = null;
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function getViewRect$3(seriesModel, api, aspect) {
  var option = extend(seriesModel.getBoxLayoutParams(), {
    aspect: aspect
  });
  return getLayoutRect(option, {
    width: api.getWidth(),
    height: api.getHeight()
  });
}
function createViewCoordSys(ecModel, api) {
  var viewList = [];
  ecModel.eachSeriesByType('graph', function (seriesModel) {
    var coordSysType = seriesModel.get('coordinateSystem');
    if (!coordSysType || coordSysType === 'view') {
      var data_1 = seriesModel.getData();
      var positions = data_1.mapArray(function (idx) {
        var itemModel = data_1.getItemModel(idx);
        return [+itemModel.get('x'), +itemModel.get('y')];
      });
      var min = [];
      var max = [];
      fromPoints(positions, min, max);
      // If width or height is 0
      if (max[0] - min[0] === 0) {
        max[0] += 1;
        min[0] -= 1;
      }
      if (max[1] - min[1] === 0) {
        max[1] += 1;
        min[1] -= 1;
      }
      var aspect = (max[0] - min[0]) / (max[1] - min[1]);
      // FIXME If get view rect after data processed?
      var viewRect = getViewRect$3(seriesModel, api, aspect);
      // Position may be NaN, use view rect instead
      if (isNaN(aspect)) {
        min = [viewRect.x, viewRect.y];
        max = [viewRect.x + viewRect.width, viewRect.y + viewRect.height];
      }
      var bbWidth = max[0] - min[0];
      var bbHeight = max[1] - min[1];
      var viewWidth = viewRect.width;
      var viewHeight = viewRect.height;
      var viewCoordSys = seriesModel.coordinateSystem = new View$1();
      viewCoordSys.zoomLimit = seriesModel.get('scaleLimit');
      viewCoordSys.setBoundingRect(min[0], min[1], bbWidth, bbHeight);
      viewCoordSys.setViewRect(viewRect.x, viewRect.y, viewWidth, viewHeight);
      // Update roam info
      viewCoordSys.setCenter(seriesModel.get('center'), api);
      viewCoordSys.setZoom(seriesModel.get('zoom'));
      viewList.push(viewCoordSys);
    }
  });
  return viewList;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var straightLineProto = Line$4.prototype;
var bezierCurveProto = BezierCurve$1.prototype;
var StraightLineShape = /** @class */function () {
  function StraightLineShape() {
    // Start point
    this.x1 = 0;
    this.y1 = 0;
    // End point
    this.x2 = 0;
    this.y2 = 0;
    this.percent = 1;
  }
  return StraightLineShape;
}();
/** @class */(function (_super) {
  __extends(CurveShape, _super);
  function CurveShape() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  return CurveShape;
})(StraightLineShape);
function isStraightLine(shape) {
  return isNaN(+shape.cpx1) || isNaN(+shape.cpy1);
}
var ECLinePath = /** @class */function (_super) {
  __extends(ECLinePath, _super);
  function ECLinePath(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'ec-line';
    return _this;
  }
  ECLinePath.prototype.getDefaultStyle = function () {
    return {
      stroke: '#000',
      fill: null
    };
  };
  ECLinePath.prototype.getDefaultShape = function () {
    return new StraightLineShape();
  };
  ECLinePath.prototype.buildPath = function (ctx, shape) {
    if (isStraightLine(shape)) {
      straightLineProto.buildPath.call(this, ctx, shape);
    } else {
      bezierCurveProto.buildPath.call(this, ctx, shape);
    }
  };
  ECLinePath.prototype.pointAt = function (t) {
    if (isStraightLine(this.shape)) {
      return straightLineProto.pointAt.call(this, t);
    } else {
      return bezierCurveProto.pointAt.call(this, t);
    }
  };
  ECLinePath.prototype.tangentAt = function (t) {
    var shape = this.shape;
    var p = isStraightLine(shape) ? [shape.x2 - shape.x1, shape.y2 - shape.y1] : bezierCurveProto.tangentAt.call(this, t);
    return normalize$6(p, p);
  };
  return ECLinePath;
}(Path$1);
var ECLinePath$1 = ECLinePath;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SYMBOL_CATEGORIES = ['fromSymbol', 'toSymbol'];
function makeSymbolTypeKey(symbolCategory) {
  return '_' + symbolCategory + 'Type';
}
function makeSymbolTypeValue(name, lineData, idx) {
  var symbolType = lineData.getItemVisual(idx, name);
  if (!symbolType || symbolType === 'none') {
    return symbolType;
  }
  var symbolSize = lineData.getItemVisual(idx, name + 'Size');
  var symbolRotate = lineData.getItemVisual(idx, name + 'Rotate');
  var symbolOffset = lineData.getItemVisual(idx, name + 'Offset');
  var symbolKeepAspect = lineData.getItemVisual(idx, name + 'KeepAspect');
  var symbolSizeArr = normalizeSymbolSize(symbolSize);
  var symbolOffsetArr = normalizeSymbolOffset(symbolOffset || 0, symbolSizeArr);
  return symbolType + symbolSizeArr + symbolOffsetArr + (symbolRotate || '') + (symbolKeepAspect || '');
}
/**
 * @inner
 */
function createSymbol(name, lineData, idx) {
  var symbolType = lineData.getItemVisual(idx, name);
  if (!symbolType || symbolType === 'none') {
    return;
  }
  var symbolSize = lineData.getItemVisual(idx, name + 'Size');
  var symbolRotate = lineData.getItemVisual(idx, name + 'Rotate');
  var symbolOffset = lineData.getItemVisual(idx, name + 'Offset');
  var symbolKeepAspect = lineData.getItemVisual(idx, name + 'KeepAspect');
  var symbolSizeArr = normalizeSymbolSize(symbolSize);
  var symbolOffsetArr = normalizeSymbolOffset(symbolOffset || 0, symbolSizeArr);
  var symbolPath = createSymbol$1(symbolType, -symbolSizeArr[0] / 2 + symbolOffsetArr[0], -symbolSizeArr[1] / 2 + symbolOffsetArr[1], symbolSizeArr[0], symbolSizeArr[1], null, symbolKeepAspect);
  symbolPath.__specifiedRotation = symbolRotate == null || isNaN(symbolRotate) ? void 0 : +symbolRotate * Math.PI / 180 || 0;
  symbolPath.name = name;
  return symbolPath;
}
function createLine(points) {
  var line = new ECLinePath$1({
    name: 'line',
    subPixelOptimize: true
  });
  setLinePoints(line.shape, points);
  return line;
}
function setLinePoints(targetShape, points) {
  targetShape.x1 = points[0][0];
  targetShape.y1 = points[0][1];
  targetShape.x2 = points[1][0];
  targetShape.y2 = points[1][1];
  targetShape.percent = 1;
  var cp1 = points[2];
  if (cp1) {
    targetShape.cpx1 = cp1[0];
    targetShape.cpy1 = cp1[1];
  } else {
    targetShape.cpx1 = NaN;
    targetShape.cpy1 = NaN;
  }
}
var Line$1 = /** @class */function (_super) {
  __extends(Line, _super);
  function Line(lineData, idx, seriesScope) {
    var _this = _super.call(this) || this;
    _this._createLine(lineData, idx, seriesScope);
    return _this;
  }
  Line.prototype._createLine = function (lineData, idx, seriesScope) {
    var seriesModel = lineData.hostModel;
    var linePoints = lineData.getItemLayout(idx);
    var line = createLine(linePoints);
    line.shape.percent = 0;
    initProps(line, {
      shape: {
        percent: 1
      }
    }, seriesModel, idx);
    this.add(line);
    each$f(SYMBOL_CATEGORIES, function (symbolCategory) {
      var symbol = createSymbol(symbolCategory, lineData, idx);
      // symbols must added after line to make sure
      // it will be updated after line#update.
      // Or symbol position and rotation update in line#beforeUpdate will be one frame slow
      this.add(symbol);
      this[makeSymbolTypeKey(symbolCategory)] = makeSymbolTypeValue(symbolCategory, lineData, idx);
    }, this);
    this._updateCommonStl(lineData, idx, seriesScope);
  };
  // TODO More strict on the List type in parameters?
  Line.prototype.updateData = function (lineData, idx, seriesScope) {
    var seriesModel = lineData.hostModel;
    var line = this.childOfName('line');
    var linePoints = lineData.getItemLayout(idx);
    var target = {
      shape: {}
    };
    setLinePoints(target.shape, linePoints);
    updateProps$1(line, target, seriesModel, idx);
    each$f(SYMBOL_CATEGORIES, function (symbolCategory) {
      var symbolType = makeSymbolTypeValue(symbolCategory, lineData, idx);
      var key = makeSymbolTypeKey(symbolCategory);
      // Symbol changed
      if (this[key] !== symbolType) {
        this.remove(this.childOfName(symbolCategory));
        var symbol = createSymbol(symbolCategory, lineData, idx);
        this.add(symbol);
      }
      this[key] = symbolType;
    }, this);
    this._updateCommonStl(lineData, idx, seriesScope);
  };
  Line.prototype.getLinePath = function () {
    return this.childAt(0);
  };
  Line.prototype._updateCommonStl = function (lineData, idx, seriesScope) {
    var seriesModel = lineData.hostModel;
    var line = this.childOfName('line');
    var emphasisLineStyle = seriesScope && seriesScope.emphasisLineStyle;
    var blurLineStyle = seriesScope && seriesScope.blurLineStyle;
    var selectLineStyle = seriesScope && seriesScope.selectLineStyle;
    var labelStatesModels = seriesScope && seriesScope.labelStatesModels;
    var emphasisDisabled = seriesScope && seriesScope.emphasisDisabled;
    var focus = seriesScope && seriesScope.focus;
    var blurScope = seriesScope && seriesScope.blurScope;
    // Optimization for large dataset
    if (!seriesScope || lineData.hasItemOption) {
      var itemModel = lineData.getItemModel(idx);
      var emphasisModel = itemModel.getModel('emphasis');
      emphasisLineStyle = emphasisModel.getModel('lineStyle').getLineStyle();
      blurLineStyle = itemModel.getModel(['blur', 'lineStyle']).getLineStyle();
      selectLineStyle = itemModel.getModel(['select', 'lineStyle']).getLineStyle();
      emphasisDisabled = emphasisModel.get('disabled');
      focus = emphasisModel.get('focus');
      blurScope = emphasisModel.get('blurScope');
      labelStatesModels = getLabelStatesModels(itemModel);
    }
    var lineStyle = lineData.getItemVisual(idx, 'style');
    var visualColor = lineStyle.stroke;
    line.useStyle(lineStyle);
    line.style.fill = null;
    line.style.strokeNoScale = true;
    line.ensureState('emphasis').style = emphasisLineStyle;
    line.ensureState('blur').style = blurLineStyle;
    line.ensureState('select').style = selectLineStyle;
    // Update symbol
    each$f(SYMBOL_CATEGORIES, function (symbolCategory) {
      var symbol = this.childOfName(symbolCategory);
      if (symbol) {
        // Share opacity and color with line.
        symbol.setColor(visualColor);
        symbol.style.opacity = lineStyle.opacity;
        for (var i = 0; i < SPECIAL_STATES.length; i++) {
          var stateName = SPECIAL_STATES[i];
          var lineState = line.getState(stateName);
          if (lineState) {
            var lineStateStyle = lineState.style || {};
            var state = symbol.ensureState(stateName);
            var stateStyle = state.style || (state.style = {});
            if (lineStateStyle.stroke != null) {
              stateStyle[symbol.__isEmptyBrush ? 'stroke' : 'fill'] = lineStateStyle.stroke;
            }
            if (lineStateStyle.opacity != null) {
              stateStyle.opacity = lineStateStyle.opacity;
            }
          }
        }
        symbol.markRedraw();
      }
    }, this);
    var rawVal = seriesModel.getRawValue(idx);
    setLabelStyle(this, labelStatesModels, {
      labelDataIndex: idx,
      labelFetcher: {
        getFormattedLabel: function (dataIndex, stateName) {
          return seriesModel.getFormattedLabel(dataIndex, stateName, lineData.dataType);
        }
      },
      inheritColor: visualColor || '#000',
      defaultOpacity: lineStyle.opacity,
      defaultText: (rawVal == null ? lineData.getName(idx) : isFinite(rawVal) ? round$4(rawVal) : rawVal) + ''
    });
    var label = this.getTextContent();
    // Always set `textStyle` even if `normalStyle.text` is null, because default
    // values have to be set on `normalStyle`.
    if (label) {
      var labelNormalModel = labelStatesModels.normal;
      label.__align = label.style.align;
      label.__verticalAlign = label.style.verticalAlign;
      // 'start', 'middle', 'end'
      label.__position = labelNormalModel.get('position') || 'middle';
      var distance = labelNormalModel.get('distance');
      if (!isArray$1(distance)) {
        distance = [distance, distance];
      }
      label.__labelDistance = distance;
    }
    this.setTextConfig({
      position: null,
      local: true,
      inside: false // Can't be inside for stroke element.
    });
    toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);
  };
  Line.prototype.highlight = function () {
    enterEmphasis(this);
  };
  Line.prototype.downplay = function () {
    leaveEmphasis(this);
  };
  Line.prototype.updateLayout = function (lineData, idx) {
    this.setLinePoints(lineData.getItemLayout(idx));
  };
  Line.prototype.setLinePoints = function (points) {
    var linePath = this.childOfName('line');
    setLinePoints(linePath.shape, points);
    linePath.dirty();
  };
  Line.prototype.beforeUpdate = function () {
    var lineGroup = this;
    var symbolFrom = lineGroup.childOfName('fromSymbol');
    var symbolTo = lineGroup.childOfName('toSymbol');
    var label = lineGroup.getTextContent();
    // Quick reject
    if (!symbolFrom && !symbolTo && (!label || label.ignore)) {
      return;
    }
    var invScale = 1;
    var parentNode = this.parent;
    while (parentNode) {
      if (parentNode.scaleX) {
        invScale /= parentNode.scaleX;
      }
      parentNode = parentNode.parent;
    }
    var line = lineGroup.childOfName('line');
    // If line not changed
    // FIXME Parent scale changed
    if (!this.__dirty && !line.__dirty) {
      return;
    }
    var percent = line.shape.percent;
    var fromPos = line.pointAt(0);
    var toPos = line.pointAt(percent);
    var d = sub$1([], toPos, fromPos);
    normalize$6(d, d);
    function setSymbolRotation(symbol, percent) {
      // Fix #12388
      // when symbol is set to be 'arrow' in markLine,
      // symbolRotate value will be ignored, and compulsively use tangent angle.
      // rotate by default if symbol rotation is not specified
      var specifiedRotation = symbol.__specifiedRotation;
      if (specifiedRotation == null) {
        var tangent = line.tangentAt(percent);
        symbol.attr('rotation', (percent === 1 ? -1 : 1) * Math.PI / 2 - Math.atan2(tangent[1], tangent[0]));
      } else {
        symbol.attr('rotation', specifiedRotation);
      }
    }
    if (symbolFrom) {
      symbolFrom.setPosition(fromPos);
      setSymbolRotation(symbolFrom, 0);
      symbolFrom.scaleX = symbolFrom.scaleY = invScale * percent;
      symbolFrom.markRedraw();
    }
    if (symbolTo) {
      symbolTo.setPosition(toPos);
      setSymbolRotation(symbolTo, 1);
      symbolTo.scaleX = symbolTo.scaleY = invScale * percent;
      symbolTo.markRedraw();
    }
    if (label && !label.ignore) {
      label.x = label.y = 0;
      label.originX = label.originY = 0;
      var textAlign = void 0;
      var textVerticalAlign = void 0;
      var distance = label.__labelDistance;
      var distanceX = distance[0] * invScale;
      var distanceY = distance[1] * invScale;
      var halfPercent = percent / 2;
      var tangent = line.tangentAt(halfPercent);
      var n = [tangent[1], -tangent[0]];
      var cp = line.pointAt(halfPercent);
      if (n[1] > 0) {
        n[0] = -n[0];
        n[1] = -n[1];
      }
      var dir = tangent[0] < 0 ? -1 : 1;
      if (label.__position !== 'start' && label.__position !== 'end') {
        var rotation = -Math.atan2(tangent[1], tangent[0]);
        if (toPos[0] < fromPos[0]) {
          rotation = Math.PI + rotation;
        }
        label.rotation = rotation;
      }
      var dy = void 0;
      switch (label.__position) {
        case 'insideStartTop':
        case 'insideMiddleTop':
        case 'insideEndTop':
        case 'middle':
          dy = -distanceY;
          textVerticalAlign = 'bottom';
          break;
        case 'insideStartBottom':
        case 'insideMiddleBottom':
        case 'insideEndBottom':
          dy = distanceY;
          textVerticalAlign = 'top';
          break;
        default:
          dy = 0;
          textVerticalAlign = 'middle';
      }
      switch (label.__position) {
        case 'end':
          label.x = d[0] * distanceX + toPos[0];
          label.y = d[1] * distanceY + toPos[1];
          textAlign = d[0] > 0.8 ? 'left' : d[0] < -0.8 ? 'right' : 'center';
          textVerticalAlign = d[1] > 0.8 ? 'top' : d[1] < -0.8 ? 'bottom' : 'middle';
          break;
        case 'start':
          label.x = -d[0] * distanceX + fromPos[0];
          label.y = -d[1] * distanceY + fromPos[1];
          textAlign = d[0] > 0.8 ? 'right' : d[0] < -0.8 ? 'left' : 'center';
          textVerticalAlign = d[1] > 0.8 ? 'bottom' : d[1] < -0.8 ? 'top' : 'middle';
          break;
        case 'insideStartTop':
        case 'insideStart':
        case 'insideStartBottom':
          label.x = distanceX * dir + fromPos[0];
          label.y = fromPos[1] + dy;
          textAlign = tangent[0] < 0 ? 'right' : 'left';
          label.originX = -distanceX * dir;
          label.originY = -dy;
          break;
        case 'insideMiddleTop':
        case 'insideMiddle':
        case 'insideMiddleBottom':
        case 'middle':
          label.x = cp[0];
          label.y = cp[1] + dy;
          textAlign = 'center';
          label.originY = -dy;
          break;
        case 'insideEndTop':
        case 'insideEnd':
        case 'insideEndBottom':
          label.x = -distanceX * dir + toPos[0];
          label.y = toPos[1] + dy;
          textAlign = tangent[0] >= 0 ? 'right' : 'left';
          label.originX = distanceX * dir;
          label.originY = -dy;
          break;
      }
      label.scaleX = label.scaleY = invScale;
      label.setStyle({
        // Use the user specified text align and baseline first
        verticalAlign: label.__verticalAlign || textVerticalAlign,
        align: label.__align || textAlign
      });
    }
  };
  return Line;
}(Group$5);
var Line$2 = Line$1;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var LineDraw = /** @class */function () {
  function LineDraw(LineCtor) {
    this.group = new Group$5();
    this._LineCtor = LineCtor || Line$2;
  }
  LineDraw.prototype.updateData = function (lineData) {
    var _this = this;
    // Remove progressive els.
    this._progressiveEls = null;
    var lineDraw = this;
    var group = lineDraw.group;
    var oldLineData = lineDraw._lineData;
    lineDraw._lineData = lineData;
    // There is no oldLineData only when first rendering or switching from
    // stream mode to normal mode, where previous elements should be removed.
    if (!oldLineData) {
      group.removeAll();
    }
    var seriesScope = makeSeriesScope$1(lineData);
    lineData.diff(oldLineData).add(function (idx) {
      _this._doAdd(lineData, idx, seriesScope);
    }).update(function (newIdx, oldIdx) {
      _this._doUpdate(oldLineData, lineData, oldIdx, newIdx, seriesScope);
    }).remove(function (idx) {
      group.remove(oldLineData.getItemGraphicEl(idx));
    }).execute();
  };
  LineDraw.prototype.updateLayout = function () {
    var lineData = this._lineData;
    // Do not support update layout in incremental mode.
    if (!lineData) {
      return;
    }
    lineData.eachItemGraphicEl(function (el, idx) {
      el.updateLayout(lineData, idx);
    }, this);
  };
  LineDraw.prototype.incrementalPrepareUpdate = function (lineData) {
    this._seriesScope = makeSeriesScope$1(lineData);
    this._lineData = null;
    this.group.removeAll();
  };
  LineDraw.prototype.incrementalUpdate = function (taskParams, lineData) {
    this._progressiveEls = [];
    function updateIncrementalAndHover(el) {
      if (!el.isGroup && !isEffectObject(el)) {
        el.incremental = true;
        el.ensureState('emphasis').hoverLayer = true;
      }
    }
    for (var idx = taskParams.start; idx < taskParams.end; idx++) {
      var itemLayout = lineData.getItemLayout(idx);
      if (lineNeedsDraw(itemLayout)) {
        var el = new this._LineCtor(lineData, idx, this._seriesScope);
        el.traverse(updateIncrementalAndHover);
        this.group.add(el);
        lineData.setItemGraphicEl(idx, el);
        this._progressiveEls.push(el);
      }
    }
  };
  LineDraw.prototype.remove = function () {
    this.group.removeAll();
  };
  LineDraw.prototype.eachRendered = function (cb) {
    traverseElements(this._progressiveEls || this.group, cb);
  };
  LineDraw.prototype._doAdd = function (lineData, idx, seriesScope) {
    var itemLayout = lineData.getItemLayout(idx);
    if (!lineNeedsDraw(itemLayout)) {
      return;
    }
    var el = new this._LineCtor(lineData, idx, seriesScope);
    lineData.setItemGraphicEl(idx, el);
    this.group.add(el);
  };
  LineDraw.prototype._doUpdate = function (oldLineData, newLineData, oldIdx, newIdx, seriesScope) {
    var itemEl = oldLineData.getItemGraphicEl(oldIdx);
    if (!lineNeedsDraw(newLineData.getItemLayout(newIdx))) {
      this.group.remove(itemEl);
      return;
    }
    if (!itemEl) {
      itemEl = new this._LineCtor(newLineData, newIdx, seriesScope);
    } else {
      itemEl.updateData(newLineData, newIdx, seriesScope);
    }
    newLineData.setItemGraphicEl(newIdx, itemEl);
    this.group.add(itemEl);
  };
  return LineDraw;
}();
function isEffectObject(el) {
  return el.animators && el.animators.length > 0;
}
function makeSeriesScope$1(lineData) {
  var hostModel = lineData.hostModel;
  var emphasisModel = hostModel.getModel('emphasis');
  return {
    lineStyle: hostModel.getModel('lineStyle').getLineStyle(),
    emphasisLineStyle: emphasisModel.getModel(['lineStyle']).getLineStyle(),
    blurLineStyle: hostModel.getModel(['blur', 'lineStyle']).getLineStyle(),
    selectLineStyle: hostModel.getModel(['select', 'lineStyle']).getLineStyle(),
    emphasisDisabled: emphasisModel.get('disabled'),
    blurScope: emphasisModel.get('blurScope'),
    focus: emphasisModel.get('focus'),
    labelStatesModels: getLabelStatesModels(hostModel)
  };
}
function isPointNaN(pt) {
  return isNaN(pt[0]) || isNaN(pt[1]);
}
function lineNeedsDraw(pts) {
  return pts && !isPointNaN(pts[0]) && !isPointNaN(pts[1]);
}
var LineDraw$1 = LineDraw;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var v1 = [];
var v2 = [];
var v3 = [];
var quadraticAt = quadraticAt$1;
var v2DistSquare = distSquare;
var mathAbs = Math.abs;
function intersectCurveCircle(curvePoints, center, radius) {
  var p0 = curvePoints[0];
  var p1 = curvePoints[1];
  var p2 = curvePoints[2];
  var d = Infinity;
  var t;
  var radiusSquare = radius * radius;
  var interval = 0.1;
  for (var _t = 0.1; _t <= 0.9; _t += 0.1) {
    v1[0] = quadraticAt(p0[0], p1[0], p2[0], _t);
    v1[1] = quadraticAt(p0[1], p1[1], p2[1], _t);
    var diff = mathAbs(v2DistSquare(v1, center) - radiusSquare);
    if (diff < d) {
      d = diff;
      t = _t;
    }
  }
  // Assume the segment is monotone，Find root through Bisection method
  // At most 32 iteration
  for (var i = 0; i < 32; i++) {
    // let prev = t - interval;
    var next = t + interval;
    // v1[0] = quadraticAt(p0[0], p1[0], p2[0], prev);
    // v1[1] = quadraticAt(p0[1], p1[1], p2[1], prev);
    v2[0] = quadraticAt(p0[0], p1[0], p2[0], t);
    v2[1] = quadraticAt(p0[1], p1[1], p2[1], t);
    v3[0] = quadraticAt(p0[0], p1[0], p2[0], next);
    v3[1] = quadraticAt(p0[1], p1[1], p2[1], next);
    var diff = v2DistSquare(v2, center) - radiusSquare;
    if (mathAbs(diff) < 1e-2) {
      break;
    }
    // let prevDiff = v2DistSquare(v1, center) - radiusSquare;
    var nextDiff = v2DistSquare(v3, center) - radiusSquare;
    interval /= 2;
    if (diff < 0) {
      if (nextDiff >= 0) {
        t = t + interval;
      } else {
        t = t - interval;
      }
    } else {
      if (nextDiff >= 0) {
        t = t - interval;
      } else {
        t = t + interval;
      }
    }
  }
  return t;
}
// Adjust edge to avoid
function adjustEdge(graph, scale) {
  var tmp0 = [];
  var quadraticSubdivide$1 = quadraticSubdivide;
  var pts = [[], [], []];
  var pts2 = [[], []];
  var v = [];
  scale /= 2;
  graph.eachEdge(function (edge, idx) {
    var linePoints = edge.getLayout();
    var fromSymbol = edge.getVisual('fromSymbol');
    var toSymbol = edge.getVisual('toSymbol');
    if (!linePoints.__original) {
      linePoints.__original = [clone$3(linePoints[0]), clone$3(linePoints[1])];
      if (linePoints[2]) {
        linePoints.__original.push(clone$3(linePoints[2]));
      }
    }
    var originalPoints = linePoints.__original;
    // Quadratic curve
    if (linePoints[2] != null) {
      copy$1(pts[0], originalPoints[0]);
      copy$1(pts[1], originalPoints[2]);
      copy$1(pts[2], originalPoints[1]);
      if (fromSymbol && fromSymbol !== 'none') {
        var symbolSize = getSymbolSize(edge.node1);
        var t = intersectCurveCircle(pts, originalPoints[0], symbolSize * scale);
        // Subdivide and get the second
        quadraticSubdivide$1(pts[0][0], pts[1][0], pts[2][0], t, tmp0);
        pts[0][0] = tmp0[3];
        pts[1][0] = tmp0[4];
        quadraticSubdivide$1(pts[0][1], pts[1][1], pts[2][1], t, tmp0);
        pts[0][1] = tmp0[3];
        pts[1][1] = tmp0[4];
      }
      if (toSymbol && toSymbol !== 'none') {
        var symbolSize = getSymbolSize(edge.node2);
        var t = intersectCurveCircle(pts, originalPoints[1], symbolSize * scale);
        // Subdivide and get the first
        quadraticSubdivide$1(pts[0][0], pts[1][0], pts[2][0], t, tmp0);
        pts[1][0] = tmp0[1];
        pts[2][0] = tmp0[2];
        quadraticSubdivide$1(pts[0][1], pts[1][1], pts[2][1], t, tmp0);
        pts[1][1] = tmp0[1];
        pts[2][1] = tmp0[2];
      }
      // Copy back to layout
      copy$1(linePoints[0], pts[0]);
      copy$1(linePoints[1], pts[2]);
      copy$1(linePoints[2], pts[1]);
    }
    // Line
    else {
      copy$1(pts2[0], originalPoints[0]);
      copy$1(pts2[1], originalPoints[1]);
      sub$1(v, pts2[1], pts2[0]);
      normalize$6(v, v);
      if (fromSymbol && fromSymbol !== 'none') {
        var symbolSize = getSymbolSize(edge.node1);
        scaleAndAdd$1(pts2[0], pts2[0], v, symbolSize * scale);
      }
      if (toSymbol && toSymbol !== 'none') {
        var symbolSize = getSymbolSize(edge.node2);
        scaleAndAdd$1(pts2[1], pts2[1], v, -symbolSize * scale);
      }
      copy$1(linePoints[0], pts2[0]);
      copy$1(linePoints[1], pts2[1]);
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function isViewCoordSys(coordSys) {
  return coordSys.type === 'view';
}
var GraphView = /** @class */function (_super) {
  __extends(GraphView, _super);
  function GraphView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = GraphView.type;
    return _this;
  }
  GraphView.prototype.init = function (ecModel, api) {
    var symbolDraw = new SymbolDraw$1();
    var lineDraw = new LineDraw$1();
    var group = this.group;
    this._controller = new RoamController$1(api.getZr());
    this._controllerHost = {
      target: group
    };
    group.add(symbolDraw.group);
    group.add(lineDraw.group);
    this._symbolDraw = symbolDraw;
    this._lineDraw = lineDraw;
    this._firstRender = true;
  };
  GraphView.prototype.render = function (seriesModel, ecModel, api) {
    var _this = this;
    var coordSys = seriesModel.coordinateSystem;
    this._model = seriesModel;
    var symbolDraw = this._symbolDraw;
    var lineDraw = this._lineDraw;
    var group = this.group;
    if (isViewCoordSys(coordSys)) {
      var groupNewProp = {
        x: coordSys.x,
        y: coordSys.y,
        scaleX: coordSys.scaleX,
        scaleY: coordSys.scaleY
      };
      if (this._firstRender) {
        group.attr(groupNewProp);
      } else {
        updateProps$1(group, groupNewProp, seriesModel);
      }
    }
    // Fix edge contact point with node
    adjustEdge(seriesModel.getGraph(), getNodeGlobalScale(seriesModel));
    var data = seriesModel.getData();
    symbolDraw.updateData(data);
    var edgeData = seriesModel.getEdgeData();
    // TODO: TYPE
    lineDraw.updateData(edgeData);
    this._updateNodeAndLinkScale();
    this._updateController(seriesModel, ecModel, api);
    clearTimeout(this._layoutTimeout);
    var forceLayout = seriesModel.forceLayout;
    var layoutAnimation = seriesModel.get(['force', 'layoutAnimation']);
    if (forceLayout) {
      this._startForceLayoutIteration(forceLayout, layoutAnimation);
    }
    var layout = seriesModel.get('layout');
    data.graph.eachNode(function (node) {
      var idx = node.dataIndex;
      var el = node.getGraphicEl();
      var itemModel = node.getModel();
      if (!el) {
        return;
      }
      // Update draggable
      el.off('drag').off('dragend');
      var draggable = itemModel.get('draggable');
      if (draggable) {
        el.on('drag', function (e) {
          switch (layout) {
            case 'force':
              forceLayout.warmUp();
              !_this._layouting && _this._startForceLayoutIteration(forceLayout, layoutAnimation);
              forceLayout.setFixed(idx);
              // Write position back to layout
              data.setItemLayout(idx, [el.x, el.y]);
              break;
            case 'circular':
              data.setItemLayout(idx, [el.x, el.y]);
              // mark node fixed
              node.setLayout({
                fixed: true
              }, true);
              // recalculate circular layout
              circularLayout(seriesModel, 'symbolSize', node, [e.offsetX, e.offsetY]);
              _this.updateLayout(seriesModel);
              break;
            case 'none':
            default:
              data.setItemLayout(idx, [el.x, el.y]);
              // update edge
              simpleLayoutEdge(seriesModel.getGraph(), seriesModel);
              _this.updateLayout(seriesModel);
              break;
          }
        }).on('dragend', function () {
          if (forceLayout) {
            forceLayout.setUnfixed(idx);
          }
        });
      }
      el.setDraggable(draggable, !!itemModel.get('cursor'));
      var focus = itemModel.get(['emphasis', 'focus']);
      if (focus === 'adjacency') {
        getECData(el).focus = node.getAdjacentDataIndices();
      }
    });
    data.graph.eachEdge(function (edge) {
      var el = edge.getGraphicEl();
      var focus = edge.getModel().get(['emphasis', 'focus']);
      if (!el) {
        return;
      }
      if (focus === 'adjacency') {
        getECData(el).focus = {
          edge: [edge.dataIndex],
          node: [edge.node1.dataIndex, edge.node2.dataIndex]
        };
      }
    });
    var circularRotateLabel = seriesModel.get('layout') === 'circular' && seriesModel.get(['circular', 'rotateLabel']);
    var cx = data.getLayout('cx');
    var cy = data.getLayout('cy');
    data.graph.eachNode(function (node) {
      rotateNodeLabel(node, circularRotateLabel, cx, cy);
    });
    this._firstRender = false;
  };
  GraphView.prototype.dispose = function () {
    this.remove();
    this._controller && this._controller.dispose();
    this._controllerHost = null;
  };
  GraphView.prototype._startForceLayoutIteration = function (forceLayout, layoutAnimation) {
    var self = this;
    (function step() {
      forceLayout.step(function (stopped) {
        self.updateLayout(self._model);
        (self._layouting = !stopped) && (layoutAnimation ? self._layoutTimeout = setTimeout(step, 16) : step());
      });
    })();
  };
  GraphView.prototype._updateController = function (seriesModel, ecModel, api) {
    var _this = this;
    var controller = this._controller;
    var controllerHost = this._controllerHost;
    var group = this.group;
    controller.setPointerChecker(function (e, x, y) {
      var rect = group.getBoundingRect();
      rect.applyTransform(group.transform);
      return rect.contain(x, y) && !onIrrelevantElement(e, api, seriesModel);
    });
    if (!isViewCoordSys(seriesModel.coordinateSystem)) {
      controller.disable();
      return;
    }
    controller.enable(seriesModel.get('roam'));
    controllerHost.zoomLimit = seriesModel.get('scaleLimit');
    controllerHost.zoom = seriesModel.coordinateSystem.getZoom();
    controller.off('pan').off('zoom').on('pan', function (e) {
      updateViewOnPan(controllerHost, e.dx, e.dy);
      api.dispatchAction({
        seriesId: seriesModel.id,
        type: 'graphRoam',
        dx: e.dx,
        dy: e.dy
      });
    }).on('zoom', function (e) {
      updateViewOnZoom(controllerHost, e.scale, e.originX, e.originY);
      api.dispatchAction({
        seriesId: seriesModel.id,
        type: 'graphRoam',
        zoom: e.scale,
        originX: e.originX,
        originY: e.originY
      });
      _this._updateNodeAndLinkScale();
      adjustEdge(seriesModel.getGraph(), getNodeGlobalScale(seriesModel));
      _this._lineDraw.updateLayout();
      // Only update label layout on zoom
      api.updateLabelLayout();
    });
  };
  GraphView.prototype._updateNodeAndLinkScale = function () {
    var seriesModel = this._model;
    var data = seriesModel.getData();
    var nodeScale = getNodeGlobalScale(seriesModel);
    data.eachItemGraphicEl(function (el, idx) {
      el && el.setSymbolScale(nodeScale);
    });
  };
  GraphView.prototype.updateLayout = function (seriesModel) {
    adjustEdge(seriesModel.getGraph(), getNodeGlobalScale(seriesModel));
    this._symbolDraw.updateLayout();
    this._lineDraw.updateLayout();
  };
  GraphView.prototype.remove = function () {
    clearTimeout(this._layoutTimeout);
    this._layouting = false;
    this._layoutTimeout = null;
    this._symbolDraw && this._symbolDraw.remove();
    this._lineDraw && this._lineDraw.remove();
  };
  GraphView.type = 'graph';
  return GraphView;
}(ChartView$1);
var GraphView$1 = GraphView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// id may be function name of Object, add a prefix to avoid this problem.
function generateNodeKey(id) {
  return '_EC_' + id;
}
var Graph = /** @class */function () {
  function Graph(directed) {
    this.type = 'graph';
    this.nodes = [];
    this.edges = [];
    this._nodesMap = {};
    /**
     * @type {Object.<string, module:echarts/data/Graph.Edge>}
     * @private
     */
    this._edgesMap = {};
    this._directed = directed || false;
  }
  /**
   * If is directed graph
   */
  Graph.prototype.isDirected = function () {
    return this._directed;
  };
  /**
   * Add a new node
   */
  Graph.prototype.addNode = function (id, dataIndex) {
    id = id == null ? '' + dataIndex : '' + id;
    var nodesMap = this._nodesMap;
    if (nodesMap[generateNodeKey(id)]) {
      {
        console.error('Graph nodes have duplicate name or id');
      }
      return;
    }
    var node = new GraphNode(id, dataIndex);
    node.hostGraph = this;
    this.nodes.push(node);
    nodesMap[generateNodeKey(id)] = node;
    return node;
  };
  /**
   * Get node by data index
   */
  Graph.prototype.getNodeByIndex = function (dataIndex) {
    var rawIdx = this.data.getRawIndex(dataIndex);
    return this.nodes[rawIdx];
  };
  /**
   * Get node by id
   */
  Graph.prototype.getNodeById = function (id) {
    return this._nodesMap[generateNodeKey(id)];
  };
  /**
   * Add a new edge
   */
  Graph.prototype.addEdge = function (n1, n2, dataIndex) {
    var nodesMap = this._nodesMap;
    var edgesMap = this._edgesMap;
    // PENDING
    if (isNumber(n1)) {
      n1 = this.nodes[n1];
    }
    if (isNumber(n2)) {
      n2 = this.nodes[n2];
    }
    if (!(n1 instanceof GraphNode)) {
      n1 = nodesMap[generateNodeKey(n1)];
    }
    if (!(n2 instanceof GraphNode)) {
      n2 = nodesMap[generateNodeKey(n2)];
    }
    if (!n1 || !n2) {
      return;
    }
    var key = n1.id + '-' + n2.id;
    var edge = new GraphEdge(n1, n2, dataIndex);
    edge.hostGraph = this;
    if (this._directed) {
      n1.outEdges.push(edge);
      n2.inEdges.push(edge);
    }
    n1.edges.push(edge);
    if (n1 !== n2) {
      n2.edges.push(edge);
    }
    this.edges.push(edge);
    edgesMap[key] = edge;
    return edge;
  };
  /**
   * Get edge by data index
   */
  Graph.prototype.getEdgeByIndex = function (dataIndex) {
    var rawIdx = this.edgeData.getRawIndex(dataIndex);
    return this.edges[rawIdx];
  };
  /**
   * Get edge by two linked nodes
   */
  Graph.prototype.getEdge = function (n1, n2) {
    if (n1 instanceof GraphNode) {
      n1 = n1.id;
    }
    if (n2 instanceof GraphNode) {
      n2 = n2.id;
    }
    var edgesMap = this._edgesMap;
    if (this._directed) {
      return edgesMap[n1 + '-' + n2];
    } else {
      return edgesMap[n1 + '-' + n2] || edgesMap[n2 + '-' + n1];
    }
  };
  /**
   * Iterate all nodes
   */
  Graph.prototype.eachNode = function (cb, context) {
    var nodes = this.nodes;
    var len = nodes.length;
    for (var i = 0; i < len; i++) {
      if (nodes[i].dataIndex >= 0) {
        cb.call(context, nodes[i], i);
      }
    }
  };
  /**
   * Iterate all edges
   */
  Graph.prototype.eachEdge = function (cb, context) {
    var edges = this.edges;
    var len = edges.length;
    for (var i = 0; i < len; i++) {
      if (edges[i].dataIndex >= 0 && edges[i].node1.dataIndex >= 0 && edges[i].node2.dataIndex >= 0) {
        cb.call(context, edges[i], i);
      }
    }
  };
  /**
   * Breadth first traverse
   * Return true to stop traversing
   */
  Graph.prototype.breadthFirstTraverse = function (cb, startNode, direction, context) {
    if (!(startNode instanceof GraphNode)) {
      startNode = this._nodesMap[generateNodeKey(startNode)];
    }
    if (!startNode) {
      return;
    }
    var edgeType = direction === 'out' ? 'outEdges' : direction === 'in' ? 'inEdges' : 'edges';
    for (var i = 0; i < this.nodes.length; i++) {
      this.nodes[i].__visited = false;
    }
    if (cb.call(context, startNode, null)) {
      return;
    }
    var queue = [startNode];
    while (queue.length) {
      var currentNode = queue.shift();
      var edges = currentNode[edgeType];
      for (var i = 0; i < edges.length; i++) {
        var e = edges[i];
        var otherNode = e.node1 === currentNode ? e.node2 : e.node1;
        if (!otherNode.__visited) {
          if (cb.call(context, otherNode, currentNode)) {
            // Stop traversing
            return;
          }
          queue.push(otherNode);
          otherNode.__visited = true;
        }
      }
    }
  };
  // TODO
  // depthFirstTraverse(
  //     cb, startNode, direction, context
  // ) {
  // };
  // Filter update
  Graph.prototype.update = function () {
    var data = this.data;
    var edgeData = this.edgeData;
    var nodes = this.nodes;
    var edges = this.edges;
    for (var i = 0, len = nodes.length; i < len; i++) {
      nodes[i].dataIndex = -1;
    }
    for (var i = 0, len = data.count(); i < len; i++) {
      nodes[data.getRawIndex(i)].dataIndex = i;
    }
    edgeData.filterSelf(function (idx) {
      var edge = edges[edgeData.getRawIndex(idx)];
      return edge.node1.dataIndex >= 0 && edge.node2.dataIndex >= 0;
    });
    // Update edge
    for (var i = 0, len = edges.length; i < len; i++) {
      edges[i].dataIndex = -1;
    }
    for (var i = 0, len = edgeData.count(); i < len; i++) {
      edges[edgeData.getRawIndex(i)].dataIndex = i;
    }
  };
  /**
   * @return {module:echarts/data/Graph}
   */
  Graph.prototype.clone = function () {
    var graph = new Graph(this._directed);
    var nodes = this.nodes;
    var edges = this.edges;
    for (var i = 0; i < nodes.length; i++) {
      graph.addNode(nodes[i].id, nodes[i].dataIndex);
    }
    for (var i = 0; i < edges.length; i++) {
      var e = edges[i];
      graph.addEdge(e.node1.id, e.node2.id, e.dataIndex);
    }
    return graph;
  };
  return Graph;
}();
var GraphNode = /** @class */function () {
  function GraphNode(id, dataIndex) {
    this.inEdges = [];
    this.outEdges = [];
    this.edges = [];
    this.dataIndex = -1;
    this.id = id == null ? '' : id;
    this.dataIndex = dataIndex == null ? -1 : dataIndex;
  }
  /**
   * @return {number}
   */
  GraphNode.prototype.degree = function () {
    return this.edges.length;
  };
  /**
   * @return {number}
   */
  GraphNode.prototype.inDegree = function () {
    return this.inEdges.length;
  };
  /**
  * @return {number}
  */
  GraphNode.prototype.outDegree = function () {
    return this.outEdges.length;
  };
  GraphNode.prototype.getModel = function (path) {
    if (this.dataIndex < 0) {
      return;
    }
    var graph = this.hostGraph;
    var itemModel = graph.data.getItemModel(this.dataIndex);
    return itemModel.getModel(path);
  };
  GraphNode.prototype.getAdjacentDataIndices = function () {
    var dataIndices = {
      edge: [],
      node: []
    };
    for (var i = 0; i < this.edges.length; i++) {
      var adjacentEdge = this.edges[i];
      if (adjacentEdge.dataIndex < 0) {
        continue;
      }
      dataIndices.edge.push(adjacentEdge.dataIndex);
      dataIndices.node.push(adjacentEdge.node1.dataIndex, adjacentEdge.node2.dataIndex);
    }
    return dataIndices;
  };
  GraphNode.prototype.getTrajectoryDataIndices = function () {
    var connectedEdgesMap = createHashMap();
    var connectedNodesMap = createHashMap();
    for (var i = 0; i < this.edges.length; i++) {
      var adjacentEdge = this.edges[i];
      if (adjacentEdge.dataIndex < 0) {
        continue;
      }
      connectedEdgesMap.set(adjacentEdge.dataIndex, true);
      var sourceNodesQueue = [adjacentEdge.node1];
      var targetNodesQueue = [adjacentEdge.node2];
      var nodeIteratorIndex = 0;
      while (nodeIteratorIndex < sourceNodesQueue.length) {
        var sourceNode = sourceNodesQueue[nodeIteratorIndex];
        nodeIteratorIndex++;
        connectedNodesMap.set(sourceNode.dataIndex, true);
        for (var j = 0; j < sourceNode.inEdges.length; j++) {
          connectedEdgesMap.set(sourceNode.inEdges[j].dataIndex, true);
          sourceNodesQueue.push(sourceNode.inEdges[j].node1);
        }
      }
      nodeIteratorIndex = 0;
      while (nodeIteratorIndex < targetNodesQueue.length) {
        var targetNode = targetNodesQueue[nodeIteratorIndex];
        nodeIteratorIndex++;
        connectedNodesMap.set(targetNode.dataIndex, true);
        for (var j = 0; j < targetNode.outEdges.length; j++) {
          connectedEdgesMap.set(targetNode.outEdges[j].dataIndex, true);
          targetNodesQueue.push(targetNode.outEdges[j].node2);
        }
      }
    }
    return {
      edge: connectedEdgesMap.keys(),
      node: connectedNodesMap.keys()
    };
  };
  return GraphNode;
}();
var GraphEdge = /** @class */function () {
  function GraphEdge(n1, n2, dataIndex) {
    this.dataIndex = -1;
    this.node1 = n1;
    this.node2 = n2;
    this.dataIndex = dataIndex == null ? -1 : dataIndex;
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  GraphEdge.prototype.getModel = function (path) {
    if (this.dataIndex < 0) {
      return;
    }
    var graph = this.hostGraph;
    var itemModel = graph.edgeData.getItemModel(this.dataIndex);
    return itemModel.getModel(path);
  };
  GraphEdge.prototype.getAdjacentDataIndices = function () {
    return {
      edge: [this.dataIndex],
      node: [this.node1.dataIndex, this.node2.dataIndex]
    };
  };
  GraphEdge.prototype.getTrajectoryDataIndices = function () {
    var connectedEdgesMap = createHashMap();
    var connectedNodesMap = createHashMap();
    connectedEdgesMap.set(this.dataIndex, true);
    var sourceNodes = [this.node1];
    var targetNodes = [this.node2];
    var nodeIteratorIndex = 0;
    while (nodeIteratorIndex < sourceNodes.length) {
      var sourceNode = sourceNodes[nodeIteratorIndex];
      nodeIteratorIndex++;
      connectedNodesMap.set(sourceNode.dataIndex, true);
      for (var j = 0; j < sourceNode.inEdges.length; j++) {
        connectedEdgesMap.set(sourceNode.inEdges[j].dataIndex, true);
        sourceNodes.push(sourceNode.inEdges[j].node1);
      }
    }
    nodeIteratorIndex = 0;
    while (nodeIteratorIndex < targetNodes.length) {
      var targetNode = targetNodes[nodeIteratorIndex];
      nodeIteratorIndex++;
      connectedNodesMap.set(targetNode.dataIndex, true);
      for (var j = 0; j < targetNode.outEdges.length; j++) {
        connectedEdgesMap.set(targetNode.outEdges[j].dataIndex, true);
        targetNodes.push(targetNode.outEdges[j].node2);
      }
    }
    return {
      edge: connectedEdgesMap.keys(),
      node: connectedNodesMap.keys()
    };
  };
  return GraphEdge;
}();
function createGraphDataProxyMixin(hostName, dataName) {
  return {
    /**
     * @param Default 'value'. can be 'a', 'b', 'c', 'd', 'e'.
     */
    getValue: function (dimension) {
      var data = this[hostName][dataName];
      return data.getStore().get(data.getDimensionIndex(dimension || 'value'), this.dataIndex);
    },
    // TODO: TYPE stricter type.
    setVisual: function (key, value) {
      this.dataIndex >= 0 && this[hostName][dataName].setItemVisual(this.dataIndex, key, value);
    },
    getVisual: function (key) {
      return this[hostName][dataName].getItemVisual(this.dataIndex, key);
    },
    setLayout: function (layout, merge) {
      this.dataIndex >= 0 && this[hostName][dataName].setItemLayout(this.dataIndex, layout, merge);
    },
    getLayout: function () {
      return this[hostName][dataName].getItemLayout(this.dataIndex);
    },
    getGraphicEl: function () {
      return this[hostName][dataName].getItemGraphicEl(this.dataIndex);
    },
    getRawIndex: function () {
      return this[hostName][dataName].getRawIndex(this.dataIndex);
    }
  };
}
mixin(GraphNode, createGraphDataProxyMixin('hostGraph', 'data'));
mixin(GraphEdge, createGraphDataProxyMixin('hostGraph', 'edgeData'));
var Graph$1 = Graph;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function createGraphFromNodeEdge(nodes, edges, seriesModel, directed, beforeLink) {
  // ??? TODO
  // support dataset?
  var graph = new Graph$1(directed);
  for (var i = 0; i < nodes.length; i++) {
    graph.addNode(retrieve(
    // Id, name, dataIndex
    nodes[i].id, nodes[i].name, i), i);
  }
  var linkNameList = [];
  var validEdges = [];
  var linkCount = 0;
  for (var i = 0; i < edges.length; i++) {
    var link = edges[i];
    var source = link.source;
    var target = link.target;
    // addEdge may fail when source or target not exists
    if (graph.addEdge(source, target, linkCount)) {
      validEdges.push(link);
      linkNameList.push(retrieve(convertOptionIdName(link.id, null), source + ' > ' + target));
      linkCount++;
    }
  }
  var coordSys = seriesModel.get('coordinateSystem');
  var nodeData;
  if (coordSys === 'cartesian2d' || coordSys === 'polar') {
    nodeData = createSeriesData(nodes, seriesModel);
  } else {
    var coordSysCtor = CoordinateSystem.get(coordSys);
    var coordDimensions = coordSysCtor ? coordSysCtor.dimensions || [] : [];
    // FIXME: Some geo do not need `value` dimenson, whereas `calendar` needs
    // `value` dimension, but graph need `value` dimension. It's better to
    // uniform this behavior.
    if (indexOf(coordDimensions, 'value') < 0) {
      coordDimensions.concat(['value']);
    }
    var dimensions = prepareSeriesDataSchema(nodes, {
      coordDimensions: coordDimensions,
      encodeDefine: seriesModel.getEncode()
    }).dimensions;
    nodeData = new SeriesData$1(dimensions, seriesModel);
    nodeData.initData(nodes);
  }
  var edgeData = new SeriesData$1(['value'], seriesModel);
  edgeData.initData(validEdges, linkNameList);
  beforeLink && beforeLink(nodeData, edgeData);
  linkSeriesData({
    mainData: nodeData,
    struct: graph,
    structAttr: 'graph',
    datas: {
      node: nodeData,
      edge: edgeData
    },
    datasAttr: {
      node: 'data',
      edge: 'edgeData'
    }
  });
  // Update dataIndex of nodes and edges because invalid edge may be removed
  graph.update();
  return graph;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var GraphSeriesModel = /** @class */function (_super) {
  __extends(GraphSeriesModel, _super);
  function GraphSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = GraphSeriesModel.type;
    _this.hasSymbolVisual = true;
    return _this;
  }
  GraphSeriesModel.prototype.init = function (option) {
    _super.prototype.init.apply(this, arguments);
    var self = this;
    function getCategoriesData() {
      return self._categoriesData;
    }
    // Provide data for legend select
    this.legendVisualProvider = new LegendVisualProvider$1(getCategoriesData, getCategoriesData);
    this.fillDataTextStyle(option.edges || option.links);
    this._updateCategoriesData();
  };
  GraphSeriesModel.prototype.mergeOption = function (option) {
    _super.prototype.mergeOption.apply(this, arguments);
    this.fillDataTextStyle(option.edges || option.links);
    this._updateCategoriesData();
  };
  GraphSeriesModel.prototype.mergeDefaultAndTheme = function (option) {
    _super.prototype.mergeDefaultAndTheme.apply(this, arguments);
    defaultEmphasis(option, 'edgeLabel', ['show']);
  };
  GraphSeriesModel.prototype.getInitialData = function (option, ecModel) {
    var edges = option.edges || option.links || [];
    var nodes = option.data || option.nodes || [];
    var self = this;
    if (nodes && edges) {
      // auto curveness
      initCurvenessList(this);
      var graph = createGraphFromNodeEdge(nodes, edges, this, true, beforeLink);
      each$f(graph.edges, function (edge) {
        createEdgeMapForCurveness(edge.node1, edge.node2, this, edge.dataIndex);
      }, this);
      return graph.data;
    }
    function beforeLink(nodeData, edgeData) {
      // Overwrite nodeData.getItemModel to
      nodeData.wrapMethod('getItemModel', function (model) {
        var categoriesModels = self._categoriesModels;
        var categoryIdx = model.getShallow('category');
        var categoryModel = categoriesModels[categoryIdx];
        if (categoryModel) {
          categoryModel.parentModel = model.parentModel;
          model.parentModel = categoryModel;
        }
        return model;
      });
      // TODO Inherit resolveParentPath by default in Model#getModel?
      var oldGetModel = Model$1.prototype.getModel;
      function newGetModel(path, parentModel) {
        var model = oldGetModel.call(this, path, parentModel);
        model.resolveParentPath = resolveParentPath;
        return model;
      }
      edgeData.wrapMethod('getItemModel', function (model) {
        model.resolveParentPath = resolveParentPath;
        model.getModel = newGetModel;
        return model;
      });
      function resolveParentPath(pathArr) {
        if (pathArr && (pathArr[0] === 'label' || pathArr[1] === 'label')) {
          var newPathArr = pathArr.slice();
          if (pathArr[0] === 'label') {
            newPathArr[0] = 'edgeLabel';
          } else if (pathArr[1] === 'label') {
            newPathArr[1] = 'edgeLabel';
          }
          return newPathArr;
        }
        return pathArr;
      }
    }
  };
  GraphSeriesModel.prototype.getGraph = function () {
    return this.getData().graph;
  };
  GraphSeriesModel.prototype.getEdgeData = function () {
    return this.getGraph().edgeData;
  };
  GraphSeriesModel.prototype.getCategoriesData = function () {
    return this._categoriesData;
  };
  GraphSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    if (dataType === 'edge') {
      var nodeData = this.getData();
      var params = this.getDataParams(dataIndex, dataType);
      var edge = nodeData.graph.getEdgeByIndex(dataIndex);
      var sourceName = nodeData.getName(edge.node1.dataIndex);
      var targetName = nodeData.getName(edge.node2.dataIndex);
      var nameArr = [];
      sourceName != null && nameArr.push(sourceName);
      targetName != null && nameArr.push(targetName);
      return createTooltipMarkup('nameValue', {
        name: nameArr.join(' > '),
        value: params.value,
        noValue: params.value == null
      });
    }
    // dataType === 'node' or empty
    var nodeMarkup = defaultSeriesFormatTooltip({
      series: this,
      dataIndex: dataIndex,
      multipleSeries: multipleSeries
    });
    return nodeMarkup;
  };
  GraphSeriesModel.prototype._updateCategoriesData = function () {
    var categories = map$1(this.option.categories || [], function (category) {
      // Data must has value
      return category.value != null ? category : extend({
        value: 0
      }, category);
    });
    var categoriesData = new SeriesData$1(['value'], this);
    categoriesData.initData(categories);
    this._categoriesData = categoriesData;
    this._categoriesModels = categoriesData.mapArray(function (idx) {
      return categoriesData.getItemModel(idx);
    });
  };
  GraphSeriesModel.prototype.setZoom = function (zoom) {
    this.option.zoom = zoom;
  };
  GraphSeriesModel.prototype.setCenter = function (center) {
    this.option.center = center;
  };
  GraphSeriesModel.prototype.isAnimationEnabled = function () {
    return _super.prototype.isAnimationEnabled.call(this)
    // Not enable animation when do force layout
    && !(this.get('layout') === 'force' && this.get(['force', 'layoutAnimation']));
  };
  GraphSeriesModel.type = 'series.graph';
  GraphSeriesModel.dependencies = ['grid', 'polar', 'geo', 'singleAxis', 'calendar'];
  GraphSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    coordinateSystem: 'view',
    // Default option for all coordinate systems
    // xAxisIndex: 0,
    // yAxisIndex: 0,
    // polarIndex: 0,
    // geoIndex: 0,
    legendHoverLink: true,
    layout: null,
    // Configuration of circular layout
    circular: {
      rotateLabel: false
    },
    // Configuration of force directed layout
    force: {
      initLayout: null,
      // Node repulsion. Can be an array to represent range.
      repulsion: [0, 50],
      gravity: 0.1,
      // Initial friction
      friction: 0.6,
      // Edge length. Can be an array to represent range.
      edgeLength: 30,
      layoutAnimation: true
    },
    left: 'center',
    top: 'center',
    // right: null,
    // bottom: null,
    // width: '80%',
    // height: '80%',
    symbol: 'circle',
    symbolSize: 10,
    edgeSymbol: ['none', 'none'],
    edgeSymbolSize: 10,
    edgeLabel: {
      position: 'middle',
      distance: 5
    },
    draggable: false,
    roam: false,
    // Default on center of graph
    center: null,
    zoom: 1,
    // Symbol size scale ratio in roam
    nodeScaleRatio: 0.6,
    // cursor: null,
    // categories: [],
    // data: []
    // Or
    // nodes: []
    //
    // links: []
    // Or
    // edges: []
    label: {
      show: false,
      formatter: '{b}'
    },
    itemStyle: {},
    lineStyle: {
      color: '#aaa',
      width: 1,
      opacity: 0.5
    },
    emphasis: {
      scale: true,
      label: {
        show: true
      }
    },
    select: {
      itemStyle: {
        borderColor: '#212121'
      }
    }
  };
  return GraphSeriesModel;
}(SeriesModel$1);
var GraphSeriesModel$1 = GraphSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var actionInfo$1 = {
  type: 'graphRoam',
  event: 'graphRoam',
  update: 'none'
};
function install$H(registers) {
  registers.registerChartView(GraphView$1);
  registers.registerSeriesModel(GraphSeriesModel$1);
  registers.registerProcessor(categoryFilter);
  registers.registerVisual(categoryVisual);
  registers.registerVisual(graphEdgeVisual);
  registers.registerLayout(graphSimpleLayout);
  registers.registerLayout(registers.PRIORITY.VISUAL.POST_CHART_LAYOUT, graphCircularLayout);
  registers.registerLayout(graphForceLayout);
  registers.registerCoordinateSystem('graphView', {
    dimensions: View$1.dimensions,
    create: createViewCoordSys
  });
  // Register legacy focus actions
  registers.registerAction({
    type: 'focusNodeAdjacency',
    event: 'focusNodeAdjacency',
    update: 'series:focusNodeAdjacency'
  }, noop);
  registers.registerAction({
    type: 'unfocusNodeAdjacency',
    event: 'unfocusNodeAdjacency',
    update: 'series:unfocusNodeAdjacency'
  }, noop);
  // Register roam action.
  registers.registerAction(actionInfo$1, function (payload, ecModel, api) {
    ecModel.eachComponent({
      mainType: 'series',
      query: payload
    }, function (seriesModel) {
      var coordSys = seriesModel.coordinateSystem;
      var res = updateCenterAndZoom(coordSys, payload, undefined, api);
      seriesModel.setCenter && seriesModel.setCenter(res.center);
      seriesModel.setZoom && seriesModel.setZoom(res.zoom);
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PointerShape = /** @class */function () {
  function PointerShape() {
    this.angle = 0;
    this.width = 10;
    this.r = 10;
    this.x = 0;
    this.y = 0;
  }
  return PointerShape;
}();
var PointerPath = /** @class */function (_super) {
  __extends(PointerPath, _super);
  function PointerPath(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'pointer';
    return _this;
  }
  PointerPath.prototype.getDefaultShape = function () {
    return new PointerShape();
  };
  PointerPath.prototype.buildPath = function (ctx, shape) {
    var mathCos = Math.cos;
    var mathSin = Math.sin;
    var r = shape.r;
    var width = shape.width;
    var angle = shape.angle;
    var x = shape.x - mathCos(angle) * width * (width >= r / 3 ? 1 : 2);
    var y = shape.y - mathSin(angle) * width * (width >= r / 3 ? 1 : 2);
    angle = shape.angle - Math.PI / 2;
    ctx.moveTo(x, y);
    ctx.lineTo(shape.x + mathCos(angle) * width, shape.y + mathSin(angle) * width);
    ctx.lineTo(shape.x + mathCos(shape.angle) * r, shape.y + mathSin(shape.angle) * r);
    ctx.lineTo(shape.x - mathCos(angle) * width, shape.y - mathSin(angle) * width);
    ctx.lineTo(x, y);
  };
  return PointerPath;
}(Path$1);
var PointerPath$1 = PointerPath;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function parsePosition(seriesModel, api) {
  var center = seriesModel.get('center');
  var width = api.getWidth();
  var height = api.getHeight();
  var size = Math.min(width, height);
  var cx = parsePercent(center[0], api.getWidth());
  var cy = parsePercent(center[1], api.getHeight());
  var r = parsePercent(seriesModel.get('radius'), size / 2);
  return {
    cx: cx,
    cy: cy,
    r: r
  };
}
function formatLabel(value, labelFormatter) {
  var label = value == null ? '' : value + '';
  if (labelFormatter) {
    if (isString(labelFormatter)) {
      label = labelFormatter.replace('{value}', label);
    } else if (isFunction(labelFormatter)) {
      label = labelFormatter(value);
    }
  }
  return label;
}
var GaugeView = /** @class */function (_super) {
  __extends(GaugeView, _super);
  function GaugeView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = GaugeView.type;
    return _this;
  }
  GaugeView.prototype.render = function (seriesModel, ecModel, api) {
    this.group.removeAll();
    var colorList = seriesModel.get(['axisLine', 'lineStyle', 'color']);
    var posInfo = parsePosition(seriesModel, api);
    this._renderMain(seriesModel, ecModel, api, colorList, posInfo);
    this._data = seriesModel.getData();
  };
  GaugeView.prototype.dispose = function () {};
  GaugeView.prototype._renderMain = function (seriesModel, ecModel, api, colorList, posInfo) {
    var group = this.group;
    var clockwise = seriesModel.get('clockwise');
    var startAngle = -seriesModel.get('startAngle') / 180 * Math.PI;
    var endAngle = -seriesModel.get('endAngle') / 180 * Math.PI;
    var axisLineModel = seriesModel.getModel('axisLine');
    var roundCap = axisLineModel.get('roundCap');
    var MainPath = roundCap ? Sausage : Sector$1;
    var showAxis = axisLineModel.get('show');
    var lineStyleModel = axisLineModel.getModel('lineStyle');
    var axisLineWidth = lineStyleModel.get('width');
    var angles = [startAngle, endAngle];
    normalizeArcAngles(angles, !clockwise);
    startAngle = angles[0];
    endAngle = angles[1];
    var angleRangeSpan = endAngle - startAngle;
    var prevEndAngle = startAngle;
    var sectors = [];
    for (var i = 0; showAxis && i < colorList.length; i++) {
      // Clamp
      var percent = Math.min(Math.max(colorList[i][0], 0), 1);
      endAngle = startAngle + angleRangeSpan * percent;
      var sector = new MainPath({
        shape: {
          startAngle: prevEndAngle,
          endAngle: endAngle,
          cx: posInfo.cx,
          cy: posInfo.cy,
          clockwise: clockwise,
          r0: posInfo.r - axisLineWidth,
          r: posInfo.r
        },
        silent: true
      });
      sector.setStyle({
        fill: colorList[i][1]
      });
      sector.setStyle(lineStyleModel.getLineStyle(
      // Because we use sector to simulate arc
      // so the properties for stroking are useless
      ['color', 'width']));
      sectors.push(sector);
      prevEndAngle = endAngle;
    }
    sectors.reverse();
    each$f(sectors, function (sector) {
      return group.add(sector);
    });
    var getColor = function (percent) {
      // Less than 0
      if (percent <= 0) {
        return colorList[0][1];
      }
      var i;
      for (i = 0; i < colorList.length; i++) {
        if (colorList[i][0] >= percent && (i === 0 ? 0 : colorList[i - 1][0]) < percent) {
          return colorList[i][1];
        }
      }
      // More than 1
      return colorList[i - 1][1];
    };
    this._renderTicks(seriesModel, ecModel, api, getColor, posInfo, startAngle, endAngle, clockwise, axisLineWidth);
    this._renderTitleAndDetail(seriesModel, ecModel, api, getColor, posInfo);
    this._renderAnchor(seriesModel, posInfo);
    this._renderPointer(seriesModel, ecModel, api, getColor, posInfo, startAngle, endAngle, clockwise, axisLineWidth);
  };
  GaugeView.prototype._renderTicks = function (seriesModel, ecModel, api, getColor, posInfo, startAngle, endAngle, clockwise, axisLineWidth) {
    var group = this.group;
    var cx = posInfo.cx;
    var cy = posInfo.cy;
    var r = posInfo.r;
    var minVal = +seriesModel.get('min');
    var maxVal = +seriesModel.get('max');
    var splitLineModel = seriesModel.getModel('splitLine');
    var tickModel = seriesModel.getModel('axisTick');
    var labelModel = seriesModel.getModel('axisLabel');
    var splitNumber = seriesModel.get('splitNumber');
    var subSplitNumber = tickModel.get('splitNumber');
    var splitLineLen = parsePercent(splitLineModel.get('length'), r);
    var tickLen = parsePercent(tickModel.get('length'), r);
    var angle = startAngle;
    var step = (endAngle - startAngle) / splitNumber;
    var subStep = step / subSplitNumber;
    var splitLineStyle = splitLineModel.getModel('lineStyle').getLineStyle();
    var tickLineStyle = tickModel.getModel('lineStyle').getLineStyle();
    var splitLineDistance = splitLineModel.get('distance');
    var unitX;
    var unitY;
    for (var i = 0; i <= splitNumber; i++) {
      unitX = Math.cos(angle);
      unitY = Math.sin(angle);
      // Split line
      if (splitLineModel.get('show')) {
        var distance = splitLineDistance ? splitLineDistance + axisLineWidth : axisLineWidth;
        var splitLine = new Line$4({
          shape: {
            x1: unitX * (r - distance) + cx,
            y1: unitY * (r - distance) + cy,
            x2: unitX * (r - splitLineLen - distance) + cx,
            y2: unitY * (r - splitLineLen - distance) + cy
          },
          style: splitLineStyle,
          silent: true
        });
        if (splitLineStyle.stroke === 'auto') {
          splitLine.setStyle({
            stroke: getColor(i / splitNumber)
          });
        }
        group.add(splitLine);
      }
      // Label
      if (labelModel.get('show')) {
        var distance = labelModel.get('distance') + splitLineDistance;
        var label = formatLabel(round$4(i / splitNumber * (maxVal - minVal) + minVal), labelModel.get('formatter'));
        var autoColor = getColor(i / splitNumber);
        var textStyleX = unitX * (r - splitLineLen - distance) + cx;
        var textStyleY = unitY * (r - splitLineLen - distance) + cy;
        var rotateType = labelModel.get('rotate');
        var rotate = 0;
        if (rotateType === 'radial') {
          rotate = -angle + 2 * Math.PI;
          if (rotate > Math.PI / 2) {
            rotate += Math.PI;
          }
        } else if (rotateType === 'tangential') {
          rotate = -angle - Math.PI / 2;
        } else if (isNumber(rotateType)) {
          rotate = rotateType * Math.PI / 180;
        }
        if (rotate === 0) {
          group.add(new ZRText$1({
            style: createTextStyle(labelModel, {
              text: label,
              x: textStyleX,
              y: textStyleY,
              verticalAlign: unitY < -0.8 ? 'top' : unitY > 0.8 ? 'bottom' : 'middle',
              align: unitX < -0.4 ? 'left' : unitX > 0.4 ? 'right' : 'center'
            }, {
              inheritColor: autoColor
            }),
            silent: true
          }));
        } else {
          group.add(new ZRText$1({
            style: createTextStyle(labelModel, {
              text: label,
              x: textStyleX,
              y: textStyleY,
              verticalAlign: 'middle',
              align: 'center'
            }, {
              inheritColor: autoColor
            }),
            silent: true,
            originX: textStyleX,
            originY: textStyleY,
            rotation: rotate
          }));
        }
      }
      // Axis tick
      if (tickModel.get('show') && i !== splitNumber) {
        var distance = tickModel.get('distance');
        distance = distance ? distance + axisLineWidth : axisLineWidth;
        for (var j = 0; j <= subSplitNumber; j++) {
          unitX = Math.cos(angle);
          unitY = Math.sin(angle);
          var tickLine = new Line$4({
            shape: {
              x1: unitX * (r - distance) + cx,
              y1: unitY * (r - distance) + cy,
              x2: unitX * (r - tickLen - distance) + cx,
              y2: unitY * (r - tickLen - distance) + cy
            },
            silent: true,
            style: tickLineStyle
          });
          if (tickLineStyle.stroke === 'auto') {
            tickLine.setStyle({
              stroke: getColor((i + j / subSplitNumber) / splitNumber)
            });
          }
          group.add(tickLine);
          angle += subStep;
        }
        angle -= subStep;
      } else {
        angle += step;
      }
    }
  };
  GaugeView.prototype._renderPointer = function (seriesModel, ecModel, api, getColor, posInfo, startAngle, endAngle, clockwise, axisLineWidth) {
    var group = this.group;
    var oldData = this._data;
    var oldProgressData = this._progressEls;
    var progressList = [];
    var showPointer = seriesModel.get(['pointer', 'show']);
    var progressModel = seriesModel.getModel('progress');
    var showProgress = progressModel.get('show');
    var data = seriesModel.getData();
    var valueDim = data.mapDimension('value');
    var minVal = +seriesModel.get('min');
    var maxVal = +seriesModel.get('max');
    var valueExtent = [minVal, maxVal];
    var angleExtent = [startAngle, endAngle];
    function createPointer(idx, angle) {
      var itemModel = data.getItemModel(idx);
      var pointerModel = itemModel.getModel('pointer');
      var pointerWidth = parsePercent(pointerModel.get('width'), posInfo.r);
      var pointerLength = parsePercent(pointerModel.get('length'), posInfo.r);
      var pointerStr = seriesModel.get(['pointer', 'icon']);
      var pointerOffset = pointerModel.get('offsetCenter');
      var pointerOffsetX = parsePercent(pointerOffset[0], posInfo.r);
      var pointerOffsetY = parsePercent(pointerOffset[1], posInfo.r);
      var pointerKeepAspect = pointerModel.get('keepAspect');
      var pointer;
      // not exist icon type will be set 'rect'
      if (pointerStr) {
        pointer = createSymbol$1(pointerStr, pointerOffsetX - pointerWidth / 2, pointerOffsetY - pointerLength, pointerWidth, pointerLength, null, pointerKeepAspect);
      } else {
        pointer = new PointerPath$1({
          shape: {
            angle: -Math.PI / 2,
            width: pointerWidth,
            r: pointerLength,
            x: pointerOffsetX,
            y: pointerOffsetY
          }
        });
      }
      pointer.rotation = -(angle + Math.PI / 2);
      pointer.x = posInfo.cx;
      pointer.y = posInfo.cy;
      return pointer;
    }
    function createProgress(idx, endAngle) {
      var roundCap = progressModel.get('roundCap');
      var ProgressPath = roundCap ? Sausage : Sector$1;
      var isOverlap = progressModel.get('overlap');
      var progressWidth = isOverlap ? progressModel.get('width') : axisLineWidth / data.count();
      var r0 = isOverlap ? posInfo.r - progressWidth : posInfo.r - (idx + 1) * progressWidth;
      var r = isOverlap ? posInfo.r : posInfo.r - idx * progressWidth;
      var progress = new ProgressPath({
        shape: {
          startAngle: startAngle,
          endAngle: endAngle,
          cx: posInfo.cx,
          cy: posInfo.cy,
          clockwise: clockwise,
          r0: r0,
          r: r
        }
      });
      isOverlap && (progress.z2 = linearMap$2(data.get(valueDim, idx), [minVal, maxVal], [100, 0], true));
      return progress;
    }
    if (showProgress || showPointer) {
      data.diff(oldData).add(function (idx) {
        var val = data.get(valueDim, idx);
        if (showPointer) {
          var pointer = createPointer(idx, startAngle);
          // TODO hide pointer on NaN value?
          initProps(pointer, {
            rotation: -((isNaN(+val) ? angleExtent[0] : linearMap$2(val, valueExtent, angleExtent, true)) + Math.PI / 2)
          }, seriesModel);
          group.add(pointer);
          data.setItemGraphicEl(idx, pointer);
        }
        if (showProgress) {
          var progress = createProgress(idx, startAngle);
          var isClip = progressModel.get('clip');
          initProps(progress, {
            shape: {
              endAngle: linearMap$2(val, valueExtent, angleExtent, isClip)
            }
          }, seriesModel);
          group.add(progress);
          // Add data index and series index for indexing the data by element
          // Useful in tooltip
          setCommonECData(seriesModel.seriesIndex, data.dataType, idx, progress);
          progressList[idx] = progress;
        }
      }).update(function (newIdx, oldIdx) {
        var val = data.get(valueDim, newIdx);
        if (showPointer) {
          var previousPointer = oldData.getItemGraphicEl(oldIdx);
          var previousRotate = previousPointer ? previousPointer.rotation : startAngle;
          var pointer = createPointer(newIdx, previousRotate);
          pointer.rotation = previousRotate;
          updateProps$1(pointer, {
            rotation: -((isNaN(+val) ? angleExtent[0] : linearMap$2(val, valueExtent, angleExtent, true)) + Math.PI / 2)
          }, seriesModel);
          group.add(pointer);
          data.setItemGraphicEl(newIdx, pointer);
        }
        if (showProgress) {
          var previousProgress = oldProgressData[oldIdx];
          var previousEndAngle = previousProgress ? previousProgress.shape.endAngle : startAngle;
          var progress = createProgress(newIdx, previousEndAngle);
          var isClip = progressModel.get('clip');
          updateProps$1(progress, {
            shape: {
              endAngle: linearMap$2(val, valueExtent, angleExtent, isClip)
            }
          }, seriesModel);
          group.add(progress);
          // Add data index and series index for indexing the data by element
          // Useful in tooltip
          setCommonECData(seriesModel.seriesIndex, data.dataType, newIdx, progress);
          progressList[newIdx] = progress;
        }
      }).execute();
      data.each(function (idx) {
        var itemModel = data.getItemModel(idx);
        var emphasisModel = itemModel.getModel('emphasis');
        var focus = emphasisModel.get('focus');
        var blurScope = emphasisModel.get('blurScope');
        var emphasisDisabled = emphasisModel.get('disabled');
        if (showPointer) {
          var pointer = data.getItemGraphicEl(idx);
          var symbolStyle = data.getItemVisual(idx, 'style');
          var visualColor = symbolStyle.fill;
          if (pointer instanceof ZRImage$1) {
            var pathStyle = pointer.style;
            pointer.useStyle(extend({
              image: pathStyle.image,
              x: pathStyle.x,
              y: pathStyle.y,
              width: pathStyle.width,
              height: pathStyle.height
            }, symbolStyle));
          } else {
            pointer.useStyle(symbolStyle);
            pointer.type !== 'pointer' && pointer.setColor(visualColor);
          }
          pointer.setStyle(itemModel.getModel(['pointer', 'itemStyle']).getItemStyle());
          if (pointer.style.fill === 'auto') {
            pointer.setStyle('fill', getColor(linearMap$2(data.get(valueDim, idx), valueExtent, [0, 1], true)));
          }
          pointer.z2EmphasisLift = 0;
          setStatesStylesFromModel(pointer, itemModel);
          toggleHoverEmphasis(pointer, focus, blurScope, emphasisDisabled);
        }
        if (showProgress) {
          var progress = progressList[idx];
          progress.useStyle(data.getItemVisual(idx, 'style'));
          progress.setStyle(itemModel.getModel(['progress', 'itemStyle']).getItemStyle());
          progress.z2EmphasisLift = 0;
          setStatesStylesFromModel(progress, itemModel);
          toggleHoverEmphasis(progress, focus, blurScope, emphasisDisabled);
        }
      });
      this._progressEls = progressList;
    }
  };
  GaugeView.prototype._renderAnchor = function (seriesModel, posInfo) {
    var anchorModel = seriesModel.getModel('anchor');
    var showAnchor = anchorModel.get('show');
    if (showAnchor) {
      var anchorSize = anchorModel.get('size');
      var anchorType = anchorModel.get('icon');
      var offsetCenter = anchorModel.get('offsetCenter');
      var anchorKeepAspect = anchorModel.get('keepAspect');
      var anchor = createSymbol$1(anchorType, posInfo.cx - anchorSize / 2 + parsePercent(offsetCenter[0], posInfo.r), posInfo.cy - anchorSize / 2 + parsePercent(offsetCenter[1], posInfo.r), anchorSize, anchorSize, null, anchorKeepAspect);
      anchor.z2 = anchorModel.get('showAbove') ? 1 : 0;
      anchor.setStyle(anchorModel.getModel('itemStyle').getItemStyle());
      this.group.add(anchor);
    }
  };
  GaugeView.prototype._renderTitleAndDetail = function (seriesModel, ecModel, api, getColor, posInfo) {
    var _this = this;
    var data = seriesModel.getData();
    var valueDim = data.mapDimension('value');
    var minVal = +seriesModel.get('min');
    var maxVal = +seriesModel.get('max');
    var contentGroup = new Group$5();
    var newTitleEls = [];
    var newDetailEls = [];
    var hasAnimation = seriesModel.isAnimationEnabled();
    var showPointerAbove = seriesModel.get(['pointer', 'showAbove']);
    data.diff(this._data).add(function (idx) {
      newTitleEls[idx] = new ZRText$1({
        silent: true
      });
      newDetailEls[idx] = new ZRText$1({
        silent: true
      });
    }).update(function (idx, oldIdx) {
      newTitleEls[idx] = _this._titleEls[oldIdx];
      newDetailEls[idx] = _this._detailEls[oldIdx];
    }).execute();
    data.each(function (idx) {
      var itemModel = data.getItemModel(idx);
      var value = data.get(valueDim, idx);
      var itemGroup = new Group$5();
      var autoColor = getColor(linearMap$2(value, [minVal, maxVal], [0, 1], true));
      var itemTitleModel = itemModel.getModel('title');
      if (itemTitleModel.get('show')) {
        var titleOffsetCenter = itemTitleModel.get('offsetCenter');
        var titleX = posInfo.cx + parsePercent(titleOffsetCenter[0], posInfo.r);
        var titleY = posInfo.cy + parsePercent(titleOffsetCenter[1], posInfo.r);
        var labelEl = newTitleEls[idx];
        labelEl.attr({
          z2: showPointerAbove ? 0 : 2,
          style: createTextStyle(itemTitleModel, {
            x: titleX,
            y: titleY,
            text: data.getName(idx),
            align: 'center',
            verticalAlign: 'middle'
          }, {
            inheritColor: autoColor
          })
        });
        itemGroup.add(labelEl);
      }
      var itemDetailModel = itemModel.getModel('detail');
      if (itemDetailModel.get('show')) {
        var detailOffsetCenter = itemDetailModel.get('offsetCenter');
        var detailX = posInfo.cx + parsePercent(detailOffsetCenter[0], posInfo.r);
        var detailY = posInfo.cy + parsePercent(detailOffsetCenter[1], posInfo.r);
        var width = parsePercent(itemDetailModel.get('width'), posInfo.r);
        var height = parsePercent(itemDetailModel.get('height'), posInfo.r);
        var detailColor = seriesModel.get(['progress', 'show']) ? data.getItemVisual(idx, 'style').fill : autoColor;
        var labelEl = newDetailEls[idx];
        var formatter_1 = itemDetailModel.get('formatter');
        labelEl.attr({
          z2: showPointerAbove ? 0 : 2,
          style: createTextStyle(itemDetailModel, {
            x: detailX,
            y: detailY,
            text: formatLabel(value, formatter_1),
            width: isNaN(width) ? null : width,
            height: isNaN(height) ? null : height,
            align: 'center',
            verticalAlign: 'middle'
          }, {
            inheritColor: detailColor
          })
        });
        setLabelValueAnimation(labelEl, {
          normal: itemDetailModel
        }, value, function (value) {
          return formatLabel(value, formatter_1);
        });
        hasAnimation && animateLabelValue(labelEl, idx, data, seriesModel, {
          getFormattedLabel: function (labelDataIndex, status, dataType, labelDimIndex, fmt, extendParams) {
            return formatLabel(extendParams ? extendParams.interpolatedValue : value, formatter_1);
          }
        });
        itemGroup.add(labelEl);
      }
      contentGroup.add(itemGroup);
    });
    this.group.add(contentGroup);
    this._titleEls = newTitleEls;
    this._detailEls = newDetailEls;
  };
  GaugeView.type = 'gauge';
  return GaugeView;
}(ChartView$1);
var GaugeView$1 = GaugeView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var GaugeSeriesModel = /** @class */function (_super) {
  __extends(GaugeSeriesModel, _super);
  function GaugeSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = GaugeSeriesModel.type;
    _this.visualStyleAccessPath = 'itemStyle';
    return _this;
  }
  GaugeSeriesModel.prototype.getInitialData = function (option, ecModel) {
    return createSeriesDataSimply(this, ['value']);
  };
  GaugeSeriesModel.type = 'series.gauge';
  GaugeSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    colorBy: 'data',
    // 默认全局居中
    center: ['50%', '50%'],
    legendHoverLink: true,
    radius: '75%',
    startAngle: 225,
    endAngle: -45,
    clockwise: true,
    // 最小值
    min: 0,
    // 最大值
    max: 100,
    // 分割段数，默认为10
    splitNumber: 10,
    // 坐标轴线
    axisLine: {
      // 默认显示，属性show控制显示与否
      show: true,
      roundCap: false,
      lineStyle: {
        color: [[1, '#E6EBF8']],
        width: 10
      }
    },
    // 坐标轴线
    progress: {
      // 默认显示，属性show控制显示与否
      show: false,
      overlap: true,
      width: 10,
      roundCap: false,
      clip: true
    },
    // 分隔线
    splitLine: {
      // 默认显示，属性show控制显示与否
      show: true,
      // 属性length控制线长
      length: 10,
      distance: 10,
      // 属性lineStyle（详见lineStyle）控制线条样式
      lineStyle: {
        color: '#63677A',
        width: 3,
        type: 'solid'
      }
    },
    // 坐标轴小标记
    axisTick: {
      // 属性show控制显示与否，默认不显示
      show: true,
      // 每份split细分多少段
      splitNumber: 5,
      // 属性length控制线长
      length: 6,
      distance: 10,
      // 属性lineStyle控制线条样式
      lineStyle: {
        color: '#63677A',
        width: 1,
        type: 'solid'
      }
    },
    axisLabel: {
      show: true,
      distance: 15,
      // formatter: null,
      color: '#464646',
      fontSize: 12,
      rotate: 0
    },
    pointer: {
      icon: null,
      offsetCenter: [0, 0],
      show: true,
      showAbove: true,
      length: '60%',
      width: 6,
      keepAspect: false
    },
    anchor: {
      show: false,
      showAbove: false,
      size: 6,
      icon: 'circle',
      offsetCenter: [0, 0],
      keepAspect: false,
      itemStyle: {
        color: '#fff',
        borderWidth: 0,
        borderColor: '#5470c6'
      }
    },
    title: {
      show: true,
      // x, y，单位px
      offsetCenter: [0, '20%'],
      // 其余属性默认使用全局文本样式，详见TEXTSTYLE
      color: '#464646',
      fontSize: 16,
      valueAnimation: false
    },
    detail: {
      show: true,
      backgroundColor: 'rgba(0,0,0,0)',
      borderWidth: 0,
      borderColor: '#ccc',
      width: 100,
      height: null,
      padding: [5, 10],
      // x, y，单位px
      offsetCenter: [0, '40%'],
      // formatter: null,
      // 其余属性默认使用全局文本样式，详见TEXTSTYLE
      color: '#464646',
      fontSize: 30,
      fontWeight: 'bold',
      lineHeight: 30,
      valueAnimation: false
    }
  };
  return GaugeSeriesModel;
}(SeriesModel$1);
var GaugeSeriesModel$1 = GaugeSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$G(registers) {
  registers.registerChartView(GaugeView$1);
  registers.registerSeriesModel(GaugeSeriesModel$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var opacityAccessPath$1 = ['itemStyle', 'opacity'];
/**
 * Piece of pie including Sector, Label, LabelLine
 */
var FunnelPiece = /** @class */function (_super) {
  __extends(FunnelPiece, _super);
  function FunnelPiece(data, idx) {
    var _this = _super.call(this) || this;
    var polygon = _this;
    var labelLine = new Polyline$3();
    var text = new ZRText$1();
    polygon.setTextContent(text);
    _this.setTextGuideLine(labelLine);
    _this.updateData(data, idx, true);
    return _this;
  }
  FunnelPiece.prototype.updateData = function (data, idx, firstCreate) {
    var polygon = this;
    var seriesModel = data.hostModel;
    var itemModel = data.getItemModel(idx);
    var layout = data.getItemLayout(idx);
    var emphasisModel = itemModel.getModel('emphasis');
    var opacity = itemModel.get(opacityAccessPath$1);
    opacity = opacity == null ? 1 : opacity;
    if (!firstCreate) {
      saveOldStyle(polygon);
    }
    // Update common style
    polygon.useStyle(data.getItemVisual(idx, 'style'));
    polygon.style.lineJoin = 'round';
    if (firstCreate) {
      polygon.setShape({
        points: layout.points
      });
      polygon.style.opacity = 0;
      initProps(polygon, {
        style: {
          opacity: opacity
        }
      }, seriesModel, idx);
    } else {
      updateProps$1(polygon, {
        style: {
          opacity: opacity
        },
        shape: {
          points: layout.points
        }
      }, seriesModel, idx);
    }
    setStatesStylesFromModel(polygon, itemModel);
    this._updateLabel(data, idx);
    toggleHoverEmphasis(this, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
  };
  FunnelPiece.prototype._updateLabel = function (data, idx) {
    var polygon = this;
    var labelLine = this.getTextGuideLine();
    var labelText = polygon.getTextContent();
    var seriesModel = data.hostModel;
    var itemModel = data.getItemModel(idx);
    var layout = data.getItemLayout(idx);
    var labelLayout = layout.label;
    var style = data.getItemVisual(idx, 'style');
    var visualColor = style.fill;
    setLabelStyle(
    // position will not be used in setLabelStyle
    labelText, getLabelStatesModels(itemModel), {
      labelFetcher: data.hostModel,
      labelDataIndex: idx,
      defaultOpacity: style.opacity,
      defaultText: data.getName(idx)
    }, {
      normal: {
        align: labelLayout.textAlign,
        verticalAlign: labelLayout.verticalAlign
      }
    });
    polygon.setTextConfig({
      local: true,
      inside: !!labelLayout.inside,
      insideStroke: visualColor,
      // insideFill: 'auto',
      outsideFill: visualColor
    });
    var linePoints = labelLayout.linePoints;
    labelLine.setShape({
      points: linePoints
    });
    polygon.textGuideLineConfig = {
      anchor: linePoints ? new Point$1(linePoints[0][0], linePoints[0][1]) : null
    };
    // Make sure update style on labelText after setLabelStyle.
    // Because setLabelStyle will replace a new style on it.
    updateProps$1(labelText, {
      style: {
        x: labelLayout.x,
        y: labelLayout.y
      }
    }, seriesModel, idx);
    labelText.attr({
      rotation: labelLayout.rotation,
      originX: labelLayout.x,
      originY: labelLayout.y,
      z2: 10
    });
    setLabelLineStyle(polygon, getLabelLineStatesModels(itemModel), {
      // Default use item visual color
      stroke: visualColor
    });
  };
  return FunnelPiece;
}(Polygon$1);
var FunnelView = /** @class */function (_super) {
  __extends(FunnelView, _super);
  function FunnelView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = FunnelView.type;
    _this.ignoreLabelLineUpdate = true;
    return _this;
  }
  FunnelView.prototype.render = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var oldData = this._data;
    var group = this.group;
    data.diff(oldData).add(function (idx) {
      var funnelPiece = new FunnelPiece(data, idx);
      data.setItemGraphicEl(idx, funnelPiece);
      group.add(funnelPiece);
    }).update(function (newIdx, oldIdx) {
      var piece = oldData.getItemGraphicEl(oldIdx);
      piece.updateData(data, newIdx);
      group.add(piece);
      data.setItemGraphicEl(newIdx, piece);
    }).remove(function (idx) {
      var piece = oldData.getItemGraphicEl(idx);
      removeElementWithFadeOut(piece, seriesModel, idx);
    }).execute();
    this._data = data;
  };
  FunnelView.prototype.remove = function () {
    this.group.removeAll();
    this._data = null;
  };
  FunnelView.prototype.dispose = function () {};
  FunnelView.type = 'funnel';
  return FunnelView;
}(ChartView$1);
var FunnelView$1 = FunnelView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var FunnelSeriesModel = /** @class */function (_super) {
  __extends(FunnelSeriesModel, _super);
  function FunnelSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = FunnelSeriesModel.type;
    return _this;
  }
  FunnelSeriesModel.prototype.init = function (option) {
    _super.prototype.init.apply(this, arguments);
    // Enable legend selection for each data item
    // Use a function instead of direct access because data reference may changed
    this.legendVisualProvider = new LegendVisualProvider$1(bind$1(this.getData, this), bind$1(this.getRawData, this));
    // Extend labelLine emphasis
    this._defaultLabelLine(option);
  };
  FunnelSeriesModel.prototype.getInitialData = function (option, ecModel) {
    return createSeriesDataSimply(this, {
      coordDimensions: ['value'],
      encodeDefaulter: curry$1(makeSeriesEncodeForNameBased, this)
    });
  };
  FunnelSeriesModel.prototype._defaultLabelLine = function (option) {
    // Extend labelLine emphasis
    defaultEmphasis(option, 'labelLine', ['show']);
    var labelLineNormalOpt = option.labelLine;
    var labelLineEmphasisOpt = option.emphasis.labelLine;
    // Not show label line if `label.normal.show = false`
    labelLineNormalOpt.show = labelLineNormalOpt.show && option.label.show;
    labelLineEmphasisOpt.show = labelLineEmphasisOpt.show && option.emphasis.label.show;
  };
  // Overwrite
  FunnelSeriesModel.prototype.getDataParams = function (dataIndex) {
    var data = this.getData();
    var params = _super.prototype.getDataParams.call(this, dataIndex);
    var valueDim = data.mapDimension('value');
    var sum = data.getSum(valueDim);
    // Percent is 0 if sum is 0
    params.percent = !sum ? 0 : +(data.get(valueDim, dataIndex) / sum * 100).toFixed(2);
    params.$vars.push('percent');
    return params;
  };
  FunnelSeriesModel.type = 'series.funnel';
  FunnelSeriesModel.defaultOption = {
    // zlevel: 0,                  // 一级层叠
    z: 2,
    legendHoverLink: true,
    colorBy: 'data',
    left: 80,
    top: 60,
    right: 80,
    bottom: 60,
    // width: {totalWidth} - left - right,
    // height: {totalHeight} - top - bottom,
    // 默认取数据最小最大值
    // min: 0,
    // max: 100,
    minSize: '0%',
    maxSize: '100%',
    sort: 'descending',
    orient: 'vertical',
    gap: 0,
    funnelAlign: 'center',
    label: {
      show: true,
      position: 'outer'
      // formatter: 标签文本格式器，同Tooltip.formatter，不支持异步回调
    },
    labelLine: {
      show: true,
      length: 20,
      lineStyle: {
        // color: 各异,
        width: 1
      }
    },
    itemStyle: {
      // color: 各异,
      borderColor: '#fff',
      borderWidth: 1
    },
    emphasis: {
      label: {
        show: true
      }
    },
    select: {
      itemStyle: {
        borderColor: '#212121'
      }
    }
  };
  return FunnelSeriesModel;
}(SeriesModel$1);
var FunnelSeriesModel$1 = FunnelSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function getViewRect$2(seriesModel, api) {
  return getLayoutRect(seriesModel.getBoxLayoutParams(), {
    width: api.getWidth(),
    height: api.getHeight()
  });
}
function getSortedIndices(data, sort) {
  var valueDim = data.mapDimension('value');
  var valueArr = data.mapArray(valueDim, function (val) {
    return val;
  });
  var indices = [];
  var isAscending = sort === 'ascending';
  for (var i = 0, len = data.count(); i < len; i++) {
    indices[i] = i;
  }
  // Add custom sortable function & none sortable opetion by "options.sort"
  if (isFunction(sort)) {
    indices.sort(sort);
  } else if (sort !== 'none') {
    indices.sort(function (a, b) {
      return isAscending ? valueArr[a] - valueArr[b] : valueArr[b] - valueArr[a];
    });
  }
  return indices;
}
function labelLayout(data) {
  var seriesModel = data.hostModel;
  var orient = seriesModel.get('orient');
  data.each(function (idx) {
    var itemModel = data.getItemModel(idx);
    var labelModel = itemModel.getModel('label');
    var labelPosition = labelModel.get('position');
    var labelLineModel = itemModel.getModel('labelLine');
    var layout = data.getItemLayout(idx);
    var points = layout.points;
    var isLabelInside = labelPosition === 'inner' || labelPosition === 'inside' || labelPosition === 'center' || labelPosition === 'insideLeft' || labelPosition === 'insideRight';
    var textAlign;
    var textX;
    var textY;
    var linePoints;
    if (isLabelInside) {
      if (labelPosition === 'insideLeft') {
        textX = (points[0][0] + points[3][0]) / 2 + 5;
        textY = (points[0][1] + points[3][1]) / 2;
        textAlign = 'left';
      } else if (labelPosition === 'insideRight') {
        textX = (points[1][0] + points[2][0]) / 2 - 5;
        textY = (points[1][1] + points[2][1]) / 2;
        textAlign = 'right';
      } else {
        textX = (points[0][0] + points[1][0] + points[2][0] + points[3][0]) / 4;
        textY = (points[0][1] + points[1][1] + points[2][1] + points[3][1]) / 4;
        textAlign = 'center';
      }
      linePoints = [[textX, textY], [textX, textY]];
    } else {
      var x1 = void 0;
      var y1 = void 0;
      var x2 = void 0;
      var y2 = void 0;
      var labelLineLen = labelLineModel.get('length');
      {
        if (orient === 'vertical' && ['top', 'bottom'].indexOf(labelPosition) > -1) {
          labelPosition = 'left';
          console.warn('Position error: Funnel chart on vertical orient dose not support top and bottom.');
        }
        if (orient === 'horizontal' && ['left', 'right'].indexOf(labelPosition) > -1) {
          labelPosition = 'bottom';
          console.warn('Position error: Funnel chart on horizontal orient dose not support left and right.');
        }
      }
      if (labelPosition === 'left') {
        // Left side
        x1 = (points[3][0] + points[0][0]) / 2;
        y1 = (points[3][1] + points[0][1]) / 2;
        x2 = x1 - labelLineLen;
        textX = x2 - 5;
        textAlign = 'right';
      } else if (labelPosition === 'right') {
        // Right side
        x1 = (points[1][0] + points[2][0]) / 2;
        y1 = (points[1][1] + points[2][1]) / 2;
        x2 = x1 + labelLineLen;
        textX = x2 + 5;
        textAlign = 'left';
      } else if (labelPosition === 'top') {
        // Top side
        x1 = (points[3][0] + points[0][0]) / 2;
        y1 = (points[3][1] + points[0][1]) / 2;
        y2 = y1 - labelLineLen;
        textY = y2 - 5;
        textAlign = 'center';
      } else if (labelPosition === 'bottom') {
        // Bottom side
        x1 = (points[1][0] + points[2][0]) / 2;
        y1 = (points[1][1] + points[2][1]) / 2;
        y2 = y1 + labelLineLen;
        textY = y2 + 5;
        textAlign = 'center';
      } else if (labelPosition === 'rightTop') {
        // RightTop side
        x1 = orient === 'horizontal' ? points[3][0] : points[1][0];
        y1 = orient === 'horizontal' ? points[3][1] : points[1][1];
        if (orient === 'horizontal') {
          y2 = y1 - labelLineLen;
          textY = y2 - 5;
          textAlign = 'center';
        } else {
          x2 = x1 + labelLineLen;
          textX = x2 + 5;
          textAlign = 'top';
        }
      } else if (labelPosition === 'rightBottom') {
        // RightBottom side
        x1 = points[2][0];
        y1 = points[2][1];
        if (orient === 'horizontal') {
          y2 = y1 + labelLineLen;
          textY = y2 + 5;
          textAlign = 'center';
        } else {
          x2 = x1 + labelLineLen;
          textX = x2 + 5;
          textAlign = 'bottom';
        }
      } else if (labelPosition === 'leftTop') {
        // LeftTop side
        x1 = points[0][0];
        y1 = orient === 'horizontal' ? points[0][1] : points[1][1];
        if (orient === 'horizontal') {
          y2 = y1 - labelLineLen;
          textY = y2 - 5;
          textAlign = 'center';
        } else {
          x2 = x1 - labelLineLen;
          textX = x2 - 5;
          textAlign = 'right';
        }
      } else if (labelPosition === 'leftBottom') {
        // LeftBottom side
        x1 = orient === 'horizontal' ? points[1][0] : points[3][0];
        y1 = orient === 'horizontal' ? points[1][1] : points[2][1];
        if (orient === 'horizontal') {
          y2 = y1 + labelLineLen;
          textY = y2 + 5;
          textAlign = 'center';
        } else {
          x2 = x1 - labelLineLen;
          textX = x2 - 5;
          textAlign = 'right';
        }
      } else {
        // Right side or Bottom side
        x1 = (points[1][0] + points[2][0]) / 2;
        y1 = (points[1][1] + points[2][1]) / 2;
        if (orient === 'horizontal') {
          y2 = y1 + labelLineLen;
          textY = y2 + 5;
          textAlign = 'center';
        } else {
          x2 = x1 + labelLineLen;
          textX = x2 + 5;
          textAlign = 'left';
        }
      }
      if (orient === 'horizontal') {
        x2 = x1;
        textX = x2;
      } else {
        y2 = y1;
        textY = y2;
      }
      linePoints = [[x1, y1], [x2, y2]];
    }
    layout.label = {
      linePoints: linePoints,
      x: textX,
      y: textY,
      verticalAlign: 'middle',
      textAlign: textAlign,
      inside: isLabelInside
    };
  });
}
function funnelLayout(ecModel, api) {
  ecModel.eachSeriesByType('funnel', function (seriesModel) {
    var data = seriesModel.getData();
    var valueDim = data.mapDimension('value');
    var sort = seriesModel.get('sort');
    var viewRect = getViewRect$2(seriesModel, api);
    var orient = seriesModel.get('orient');
    var viewWidth = viewRect.width;
    var viewHeight = viewRect.height;
    var indices = getSortedIndices(data, sort);
    var x = viewRect.x;
    var y = viewRect.y;
    var sizeExtent = orient === 'horizontal' ? [parsePercent(seriesModel.get('minSize'), viewHeight), parsePercent(seriesModel.get('maxSize'), viewHeight)] : [parsePercent(seriesModel.get('minSize'), viewWidth), parsePercent(seriesModel.get('maxSize'), viewWidth)];
    var dataExtent = data.getDataExtent(valueDim);
    var min = seriesModel.get('min');
    var max = seriesModel.get('max');
    if (min == null) {
      min = Math.min(dataExtent[0], 0);
    }
    if (max == null) {
      max = dataExtent[1];
    }
    var funnelAlign = seriesModel.get('funnelAlign');
    var gap = seriesModel.get('gap');
    var viewSize = orient === 'horizontal' ? viewWidth : viewHeight;
    var itemSize = (viewSize - gap * (data.count() - 1)) / data.count();
    var getLinePoints = function (idx, offset) {
      // End point index is data.count() and we assign it 0
      if (orient === 'horizontal') {
        var val_1 = data.get(valueDim, idx) || 0;
        var itemHeight = linearMap$2(val_1, [min, max], sizeExtent, true);
        var y0 = void 0;
        switch (funnelAlign) {
          case 'top':
            y0 = y;
            break;
          case 'center':
            y0 = y + (viewHeight - itemHeight) / 2;
            break;
          case 'bottom':
            y0 = y + (viewHeight - itemHeight);
            break;
        }
        return [[offset, y0], [offset, y0 + itemHeight]];
      }
      var val = data.get(valueDim, idx) || 0;
      var itemWidth = linearMap$2(val, [min, max], sizeExtent, true);
      var x0;
      switch (funnelAlign) {
        case 'left':
          x0 = x;
          break;
        case 'center':
          x0 = x + (viewWidth - itemWidth) / 2;
          break;
        case 'right':
          x0 = x + viewWidth - itemWidth;
          break;
      }
      return [[x0, offset], [x0 + itemWidth, offset]];
    };
    if (sort === 'ascending') {
      // From bottom to top
      itemSize = -itemSize;
      gap = -gap;
      if (orient === 'horizontal') {
        x += viewWidth;
      } else {
        y += viewHeight;
      }
      indices = indices.reverse();
    }
    for (var i = 0; i < indices.length; i++) {
      var idx = indices[i];
      var nextIdx = indices[i + 1];
      var itemModel = data.getItemModel(idx);
      if (orient === 'horizontal') {
        var width = itemModel.get(['itemStyle', 'width']);
        if (width == null) {
          width = itemSize;
        } else {
          width = parsePercent(width, viewWidth);
          if (sort === 'ascending') {
            width = -width;
          }
        }
        var start = getLinePoints(idx, x);
        var end = getLinePoints(nextIdx, x + width);
        x += width + gap;
        data.setItemLayout(idx, {
          points: start.concat(end.slice().reverse())
        });
      } else {
        var height = itemModel.get(['itemStyle', 'height']);
        if (height == null) {
          height = itemSize;
        } else {
          height = parsePercent(height, viewHeight);
          if (sort === 'ascending') {
            height = -height;
          }
        }
        var start = getLinePoints(idx, y);
        var end = getLinePoints(nextIdx, y + height);
        y += height + gap;
        data.setItemLayout(idx, {
          points: start.concat(end.slice().reverse())
        });
      }
    }
    labelLayout(data);
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$F(registers) {
  registers.registerChartView(FunnelView$1);
  registers.registerSeriesModel(FunnelSeriesModel$1);
  registers.registerLayout(funnelLayout);
  registers.registerProcessor(dataFilter$1('funnel'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DEFAULT_SMOOTH = 0.3;
var ParallelView$2 = /** @class */function (_super) {
  __extends(ParallelView, _super);
  function ParallelView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ParallelView.type;
    _this._dataGroup = new Group$5();
    _this._initialized = false;
    return _this;
  }
  ParallelView.prototype.init = function () {
    this.group.add(this._dataGroup);
  };
  /**
   * @override
   */
  ParallelView.prototype.render = function (seriesModel, ecModel, api, payload) {
    // Clear previously rendered progressive elements.
    this._progressiveEls = null;
    var dataGroup = this._dataGroup;
    var data = seriesModel.getData();
    var oldData = this._data;
    var coordSys = seriesModel.coordinateSystem;
    var dimensions = coordSys.dimensions;
    var seriesScope = makeSeriesScope(seriesModel);
    data.diff(oldData).add(add).update(update).remove(remove).execute();
    function add(newDataIndex) {
      var line = addEl(data, dataGroup, newDataIndex, dimensions, coordSys);
      updateElCommon(line, data, newDataIndex, seriesScope);
    }
    function update(newDataIndex, oldDataIndex) {
      var line = oldData.getItemGraphicEl(oldDataIndex);
      var points = createLinePoints(data, newDataIndex, dimensions, coordSys);
      data.setItemGraphicEl(newDataIndex, line);
      updateProps$1(line, {
        shape: {
          points: points
        }
      }, seriesModel, newDataIndex);
      saveOldStyle(line);
      updateElCommon(line, data, newDataIndex, seriesScope);
    }
    function remove(oldDataIndex) {
      var line = oldData.getItemGraphicEl(oldDataIndex);
      dataGroup.remove(line);
    }
    // First create
    if (!this._initialized) {
      this._initialized = true;
      var clipPath = createGridClipShape$2(coordSys, seriesModel, function () {
        // Callback will be invoked immediately if there is no animation
        setTimeout(function () {
          dataGroup.removeClipPath();
        });
      });
      dataGroup.setClipPath(clipPath);
    }
    this._data = data;
  };
  ParallelView.prototype.incrementalPrepareRender = function (seriesModel, ecModel, api) {
    this._initialized = true;
    this._data = null;
    this._dataGroup.removeAll();
  };
  ParallelView.prototype.incrementalRender = function (taskParams, seriesModel, ecModel) {
    var data = seriesModel.getData();
    var coordSys = seriesModel.coordinateSystem;
    var dimensions = coordSys.dimensions;
    var seriesScope = makeSeriesScope(seriesModel);
    var progressiveEls = this._progressiveEls = [];
    for (var dataIndex = taskParams.start; dataIndex < taskParams.end; dataIndex++) {
      var line = addEl(data, this._dataGroup, dataIndex, dimensions, coordSys);
      line.incremental = true;
      updateElCommon(line, data, dataIndex, seriesScope);
      progressiveEls.push(line);
    }
  };
  ParallelView.prototype.remove = function () {
    this._dataGroup && this._dataGroup.removeAll();
    this._data = null;
  };
  ParallelView.type = 'parallel';
  return ParallelView;
}(ChartView$1);
function createGridClipShape$2(coordSys, seriesModel, cb) {
  var parallelModel = coordSys.model;
  var rect = coordSys.getRect();
  var rectEl = new Rect$3({
    shape: {
      x: rect.x,
      y: rect.y,
      width: rect.width,
      height: rect.height
    }
  });
  var dim = parallelModel.get('layout') === 'horizontal' ? 'width' : 'height';
  rectEl.setShape(dim, 0);
  initProps(rectEl, {
    shape: {
      width: rect.width,
      height: rect.height
    }
  }, seriesModel, cb);
  return rectEl;
}
function createLinePoints(data, dataIndex, dimensions, coordSys) {
  var points = [];
  for (var i = 0; i < dimensions.length; i++) {
    var dimName = dimensions[i];
    var value = data.get(data.mapDimension(dimName), dataIndex);
    if (!isEmptyValue(value, coordSys.getAxis(dimName).type)) {
      points.push(coordSys.dataToPoint(value, dimName));
    }
  }
  return points;
}
function addEl(data, dataGroup, dataIndex, dimensions, coordSys) {
  var points = createLinePoints(data, dataIndex, dimensions, coordSys);
  var line = new Polyline$3({
    shape: {
      points: points
    },
    // silent: true,
    z2: 10
  });
  dataGroup.add(line);
  data.setItemGraphicEl(dataIndex, line);
  return line;
}
function makeSeriesScope(seriesModel) {
  var smooth = seriesModel.get('smooth', true);
  smooth === true && (smooth = DEFAULT_SMOOTH);
  smooth = numericToNumber(smooth);
  eqNaN(smooth) && (smooth = 0);
  return {
    smooth: smooth
  };
}
function updateElCommon(el, data, dataIndex, seriesScope) {
  el.useStyle(data.getItemVisual(dataIndex, 'style'));
  el.style.fill = null;
  el.setShape('smooth', seriesScope.smooth);
  var itemModel = data.getItemModel(dataIndex);
  var emphasisModel = itemModel.getModel('emphasis');
  setStatesStylesFromModel(el, itemModel, 'lineStyle');
  toggleHoverEmphasis(el, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
}
// function simpleDiff(oldData, newData, dimensions) {
//     let oldLen;
//     if (!oldData
//         || !oldData.__plProgressive
//         || (oldLen = oldData.count()) !== newData.count()
//     ) {
//         return true;
//     }
//     let dimLen = dimensions.length;
//     for (let i = 0; i < oldLen; i++) {
//         for (let j = 0; j < dimLen; j++) {
//             if (oldData.get(dimensions[j], i) !== newData.get(dimensions[j], i)) {
//                 return true;
//             }
//         }
//     }
//     return false;
// }
// FIXME put in common util?
function isEmptyValue(val, axisType) {
  return axisType === 'category' ? val == null : val == null || isNaN(val); // axisType === 'value'
}
var ParallelView$3 = ParallelView$2;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ParallelSeriesModel = /** @class */function (_super) {
  __extends(ParallelSeriesModel, _super);
  function ParallelSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ParallelSeriesModel.type;
    _this.visualStyleAccessPath = 'lineStyle';
    _this.visualDrawType = 'stroke';
    return _this;
  }
  ParallelSeriesModel.prototype.getInitialData = function (option, ecModel) {
    return createSeriesData(null, this, {
      useEncodeDefaulter: bind$1(makeDefaultEncode, null, this)
    });
  };
  /**
   * User can get data raw indices on 'axisAreaSelected' event received.
   *
   * @return Raw indices
   */
  ParallelSeriesModel.prototype.getRawIndicesByActiveState = function (activeState) {
    var coordSys = this.coordinateSystem;
    var data = this.getData();
    var indices = [];
    coordSys.eachActiveState(data, function (theActiveState, dataIndex) {
      if (activeState === theActiveState) {
        indices.push(data.getRawIndex(dataIndex));
      }
    });
    return indices;
  };
  ParallelSeriesModel.type = 'series.parallel';
  ParallelSeriesModel.dependencies = ['parallel'];
  ParallelSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    coordinateSystem: 'parallel',
    parallelIndex: 0,
    label: {
      show: false
    },
    inactiveOpacity: 0.05,
    activeOpacity: 1,
    lineStyle: {
      width: 1,
      opacity: 0.45,
      type: 'solid'
    },
    emphasis: {
      label: {
        show: false
      }
    },
    progressive: 500,
    smooth: false,
    animationEasing: 'linear'
  };
  return ParallelSeriesModel;
}(SeriesModel$1);
function makeDefaultEncode(seriesModel) {
  // The mapping of parallelAxis dimension to data dimension can
  // be specified in parallelAxis.option.dim. For example, if
  // parallelAxis.option.dim is 'dim3', it mapping to the third
  // dimension of data. But `data.encode` has higher priority.
  // Moreover, parallelModel.dimension should not be regarded as data
  // dimensions. Consider dimensions = ['dim4', 'dim2', 'dim6'];
  var parallelModel = seriesModel.ecModel.getComponent('parallel', seriesModel.get('parallelIndex'));
  if (!parallelModel) {
    return;
  }
  var encodeDefine = {};
  each$f(parallelModel.dimensions, function (axisDim) {
    var dataDimIndex = convertDimNameToNumber(axisDim);
    encodeDefine[axisDim] = dataDimIndex;
  });
  return encodeDefine;
}
function convertDimNameToNumber(dimName) {
  return +dimName.replace('dim', '');
}
var ParallelSeriesModel$1 = ParallelSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var opacityAccessPath = ['lineStyle', 'opacity'];
var parallelVisual = {
  seriesType: 'parallel',
  reset: function (seriesModel, ecModel) {
    var coordSys = seriesModel.coordinateSystem;
    var opacityMap = {
      normal: seriesModel.get(['lineStyle', 'opacity']),
      active: seriesModel.get('activeOpacity'),
      inactive: seriesModel.get('inactiveOpacity')
    };
    return {
      progress: function (params, data) {
        coordSys.eachActiveState(data, function (activeState, dataIndex) {
          var opacity = opacityMap[activeState];
          if (activeState === 'normal' && data.hasItemOption) {
            var itemOpacity = data.getItemModel(dataIndex).get(opacityAccessPath, true);
            itemOpacity != null && (opacity = itemOpacity);
          }
          var existsStyle = data.ensureUniqueItemVisual(dataIndex, 'style');
          existsStyle.opacity = opacity;
        }, params.start, params.end);
      }
    };
  }
};
var parallelVisual$1 = parallelVisual;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function parallelPreprocessor(option) {
  createParallelIfNeeded(option);
  mergeAxisOptionFromParallel(option);
}
/**
 * Create a parallel coordinate if not exists.
 * @inner
 */
function createParallelIfNeeded(option) {
  if (option.parallel) {
    return;
  }
  var hasParallelSeries = false;
  each$f(option.series, function (seriesOpt) {
    if (seriesOpt && seriesOpt.type === 'parallel') {
      hasParallelSeries = true;
    }
  });
  if (hasParallelSeries) {
    option.parallel = [{}];
  }
}
/**
 * Merge aixs definition from parallel option (if exists) to axis option.
 * @inner
 */
function mergeAxisOptionFromParallel(option) {
  var axes = normalizeToArray(option.parallelAxis);
  each$f(axes, function (axisOption) {
    if (!isObject$3(axisOption)) {
      return;
    }
    var parallelIndex = axisOption.parallelIndex || 0;
    var parallelOption = normalizeToArray(option.parallel)[parallelIndex];
    if (parallelOption && parallelOption.parallelAxisDefault) {
      merge(axisOption, parallelOption.parallelAxisDefault, false);
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var CLICK_THRESHOLD = 5; // > 4
var ParallelView = /** @class */function (_super) {
  __extends(ParallelView, _super);
  function ParallelView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ParallelView.type;
    return _this;
  }
  ParallelView.prototype.render = function (parallelModel, ecModel, api) {
    this._model = parallelModel;
    this._api = api;
    if (!this._handlers) {
      this._handlers = {};
      each$f(handlers$1, function (handler, eventName) {
        api.getZr().on(eventName, this._handlers[eventName] = bind$1(handler, this));
      }, this);
    }
    createOrUpdate(this, '_throttledDispatchExpand', parallelModel.get('axisExpandRate'), 'fixRate');
  };
  ParallelView.prototype.dispose = function (ecModel, api) {
    clear$1(this, '_throttledDispatchExpand');
    each$f(this._handlers, function (handler, eventName) {
      api.getZr().off(eventName, handler);
    });
    this._handlers = null;
  };
  /**
   * @internal
   * @param {Object} [opt] If null, cancel the last action triggering for debounce.
   */
  ParallelView.prototype._throttledDispatchExpand = function (opt) {
    this._dispatchExpand(opt);
  };
  /**
   * @internal
   */
  ParallelView.prototype._dispatchExpand = function (opt) {
    opt && this._api.dispatchAction(extend({
      type: 'parallelAxisExpand'
    }, opt));
  };
  ParallelView.type = 'parallel';
  return ParallelView;
}(ComponentView$1);
var handlers$1 = {
  mousedown: function (e) {
    if (checkTrigger(this, 'click')) {
      this._mouseDownPoint = [e.offsetX, e.offsetY];
    }
  },
  mouseup: function (e) {
    var mouseDownPoint = this._mouseDownPoint;
    if (checkTrigger(this, 'click') && mouseDownPoint) {
      var point = [e.offsetX, e.offsetY];
      var dist = Math.pow(mouseDownPoint[0] - point[0], 2) + Math.pow(mouseDownPoint[1] - point[1], 2);
      if (dist > CLICK_THRESHOLD) {
        return;
      }
      var result = this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX, e.offsetY]);
      result.behavior !== 'none' && this._dispatchExpand({
        axisExpandWindow: result.axisExpandWindow
      });
    }
    this._mouseDownPoint = null;
  },
  mousemove: function (e) {
    // Should do nothing when brushing.
    if (this._mouseDownPoint || !checkTrigger(this, 'mousemove')) {
      return;
    }
    var model = this._model;
    var result = model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX, e.offsetY]);
    var behavior = result.behavior;
    behavior === 'jump' && this._throttledDispatchExpand.debounceNextCall(model.get('axisExpandDebounce'));
    this._throttledDispatchExpand(behavior === 'none' ? null // Cancel the last trigger, in case that mouse slide out of the area quickly.
    : {
      axisExpandWindow: result.axisExpandWindow,
      // Jumping uses animation, and sliding suppresses animation.
      animation: behavior === 'jump' ? null : {
        duration: 0 // Disable animation.
      }
    });
  }
};
function checkTrigger(view, triggerOn) {
  var model = view._model;
  return model.get('axisExpandable') && model.get('axisExpandTriggerOn') === triggerOn;
}
var ParallelView$1 = ParallelView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ParallelModel = /** @class */function (_super) {
  __extends(ParallelModel, _super);
  function ParallelModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ParallelModel.type;
    return _this;
  }
  ParallelModel.prototype.init = function () {
    _super.prototype.init.apply(this, arguments);
    this.mergeOption({});
  };
  ParallelModel.prototype.mergeOption = function (newOption) {
    var thisOption = this.option;
    newOption && merge(thisOption, newOption, true);
    this._initDimensions();
  };
  /**
   * Whether series or axis is in this coordinate system.
   */
  ParallelModel.prototype.contains = function (model, ecModel) {
    var parallelIndex = model.get('parallelIndex');
    return parallelIndex != null && ecModel.getComponent('parallel', parallelIndex) === this;
  };
  ParallelModel.prototype.setAxisExpand = function (opt) {
    each$f(['axisExpandable', 'axisExpandCenter', 'axisExpandCount', 'axisExpandWidth', 'axisExpandWindow'], function (name) {
      if (opt.hasOwnProperty(name)) {
        // @ts-ignore FIXME: why "never" inferred in this.option[name]?
        this.option[name] = opt[name];
      }
    }, this);
  };
  ParallelModel.prototype._initDimensions = function () {
    var dimensions = this.dimensions = [];
    var parallelAxisIndex = this.parallelAxisIndex = [];
    var axisModels = filter(this.ecModel.queryComponents({
      mainType: 'parallelAxis'
    }), function (axisModel) {
      // Can not use this.contains here, because
      // initialization has not been completed yet.
      return (axisModel.get('parallelIndex') || 0) === this.componentIndex;
    }, this);
    each$f(axisModels, function (axisModel) {
      dimensions.push('dim' + axisModel.get('dim'));
      parallelAxisIndex.push(axisModel.componentIndex);
    });
  };
  ParallelModel.type = 'parallel';
  ParallelModel.dependencies = ['parallelAxis'];
  ParallelModel.layoutMode = 'box';
  ParallelModel.defaultOption = {
    // zlevel: 0,
    z: 0,
    left: 80,
    top: 60,
    right: 80,
    bottom: 60,
    // width: {totalWidth} - left - right,
    // height: {totalHeight} - top - bottom,
    layout: 'horizontal',
    // FIXME
    // naming?
    axisExpandable: false,
    axisExpandCenter: null,
    axisExpandCount: 0,
    axisExpandWidth: 50,
    axisExpandRate: 17,
    axisExpandDebounce: 50,
    // [out, in, jumpTarget]. In percentage. If use [null, 0.05], null means full.
    // Do not doc to user until necessary.
    axisExpandSlideTriggerArea: [-0.15, 0.05, 0.4],
    axisExpandTriggerOn: 'click',
    parallelAxisDefault: null
  };
  return ParallelModel;
}(ComponentModel$1);
var ParallelModel$1 = ParallelModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ParallelAxis = /** @class */function (_super) {
  __extends(ParallelAxis, _super);
  function ParallelAxis(dim, scale, coordExtent, axisType, axisIndex) {
    var _this = _super.call(this, dim, scale, coordExtent) || this;
    _this.type = axisType || 'value';
    _this.axisIndex = axisIndex;
    return _this;
  }
  ParallelAxis.prototype.isHorizontal = function () {
    return this.coordinateSystem.getModel().get('layout') !== 'horizontal';
  };
  return ParallelAxis;
}(Axis$1);
var ParallelAxis$1 = ParallelAxis;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Calculate slider move result.
 * Usage:
 * (1) If both handle0 and handle1 are needed to be moved, set minSpan the same as
 * maxSpan and the same as `Math.abs(handleEnd[1] - handleEnds[0])`.
 * (2) If handle0 is forbidden to cross handle1, set minSpan as `0`.
 *
 * @param delta Move length.
 * @param handleEnds handleEnds[0] can be bigger then handleEnds[1].
 *              handleEnds will be modified in this method.
 * @param extent handleEnds is restricted by extent.
 *              extent[0] should less or equals than extent[1].
 * @param handleIndex Can be 'all', means that both move the two handleEnds.
 * @param minSpan The range of dataZoom can not be smaller than that.
 *              If not set, handle0 and cross handle1. If set as a non-negative
 *              number (including `0`), handles will push each other when reaching
 *              the minSpan.
 * @param maxSpan The range of dataZoom can not be larger than that.
 * @return The input handleEnds.
 */
function sliderMove(delta, handleEnds, extent, handleIndex, minSpan, maxSpan) {
  delta = delta || 0;
  var extentSpan = extent[1] - extent[0];
  // Notice maxSpan and minSpan can be null/undefined.
  if (minSpan != null) {
    minSpan = restrict$1(minSpan, [0, extentSpan]);
  }
  if (maxSpan != null) {
    maxSpan = Math.max(maxSpan, minSpan != null ? minSpan : 0);
  }
  if (handleIndex === 'all') {
    var handleSpan = Math.abs(handleEnds[1] - handleEnds[0]);
    handleSpan = restrict$1(handleSpan, [0, extentSpan]);
    minSpan = maxSpan = restrict$1(handleSpan, [minSpan, maxSpan]);
    handleIndex = 0;
  }
  handleEnds[0] = restrict$1(handleEnds[0], extent);
  handleEnds[1] = restrict$1(handleEnds[1], extent);
  var originalDistSign = getSpanSign(handleEnds, handleIndex);
  handleEnds[handleIndex] += delta;
  // Restrict in extent.
  var extentMinSpan = minSpan || 0;
  var realExtent = extent.slice();
  originalDistSign.sign < 0 ? realExtent[0] += extentMinSpan : realExtent[1] -= extentMinSpan;
  handleEnds[handleIndex] = restrict$1(handleEnds[handleIndex], realExtent);
  // Expand span.
  var currDistSign;
  currDistSign = getSpanSign(handleEnds, handleIndex);
  if (minSpan != null && (currDistSign.sign !== originalDistSign.sign || currDistSign.span < minSpan)) {
    // If minSpan exists, 'cross' is forbidden.
    handleEnds[1 - handleIndex] = handleEnds[handleIndex] + originalDistSign.sign * minSpan;
  }
  // Shrink span.
  currDistSign = getSpanSign(handleEnds, handleIndex);
  if (maxSpan != null && currDistSign.span > maxSpan) {
    handleEnds[1 - handleIndex] = handleEnds[handleIndex] + currDistSign.sign * maxSpan;
  }
  return handleEnds;
}
function getSpanSign(handleEnds, handleIndex) {
  var dist = handleEnds[handleIndex] - handleEnds[1 - handleIndex];
  // If `handleEnds[0] === handleEnds[1]`, always believe that handleEnd[0]
  // is at left of handleEnds[1] for non-cross case.
  return {
    span: Math.abs(dist),
    sign: dist > 0 ? -1 : dist < 0 ? 1 : handleIndex ? -1 : 1
  };
}
function restrict$1(value, extend) {
  return Math.min(extend[1] != null ? extend[1] : Infinity, Math.max(extend[0] != null ? extend[0] : -Infinity, value));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each$a = each$f;
var mathMin$2 = Math.min;
var mathMax$2 = Math.max;
var mathFloor = Math.floor;
var mathCeil = Math.ceil;
var round$1 = round$4;
var PI$2 = Math.PI;
var Parallel = /** @class */function () {
  function Parallel(parallelModel, ecModel, api) {
    this.type = 'parallel';
    /**
     * key: dimension
     */
    this._axesMap = createHashMap();
    /**
     * key: dimension
     * value: {position: [], rotation, }
     */
    this._axesLayout = {};
    this.dimensions = parallelModel.dimensions;
    this._model = parallelModel;
    this._init(parallelModel, ecModel, api);
  }
  Parallel.prototype._init = function (parallelModel, ecModel, api) {
    var dimensions = parallelModel.dimensions;
    var parallelAxisIndex = parallelModel.parallelAxisIndex;
    each$a(dimensions, function (dim, idx) {
      var axisIndex = parallelAxisIndex[idx];
      var axisModel = ecModel.getComponent('parallelAxis', axisIndex);
      var axis = this._axesMap.set(dim, new ParallelAxis$1(dim, createScaleByModel$1(axisModel), [0, 0], axisModel.get('type'), axisIndex));
      var isCategory = axis.type === 'category';
      axis.onBand = isCategory && axisModel.get('boundaryGap');
      axis.inverse = axisModel.get('inverse');
      // Injection
      axisModel.axis = axis;
      axis.model = axisModel;
      axis.coordinateSystem = axisModel.coordinateSystem = this;
    }, this);
  };
  /**
   * Update axis scale after data processed
   */
  Parallel.prototype.update = function (ecModel, api) {
    this._updateAxesFromSeries(this._model, ecModel);
  };
  Parallel.prototype.containPoint = function (point) {
    var layoutInfo = this._makeLayoutInfo();
    var axisBase = layoutInfo.axisBase;
    var layoutBase = layoutInfo.layoutBase;
    var pixelDimIndex = layoutInfo.pixelDimIndex;
    var pAxis = point[1 - pixelDimIndex];
    var pLayout = point[pixelDimIndex];
    return pAxis >= axisBase && pAxis <= axisBase + layoutInfo.axisLength && pLayout >= layoutBase && pLayout <= layoutBase + layoutInfo.layoutLength;
  };
  Parallel.prototype.getModel = function () {
    return this._model;
  };
  /**
   * Update properties from series
   */
  Parallel.prototype._updateAxesFromSeries = function (parallelModel, ecModel) {
    ecModel.eachSeries(function (seriesModel) {
      if (!parallelModel.contains(seriesModel, ecModel)) {
        return;
      }
      var data = seriesModel.getData();
      each$a(this.dimensions, function (dim) {
        var axis = this._axesMap.get(dim);
        axis.scale.unionExtentFromData(data, data.mapDimension(dim));
        niceScaleExtent(axis.scale, axis.model);
      }, this);
    }, this);
  };
  /**
   * Resize the parallel coordinate system.
   */
  Parallel.prototype.resize = function (parallelModel, api) {
    this._rect = getLayoutRect(parallelModel.getBoxLayoutParams(), {
      width: api.getWidth(),
      height: api.getHeight()
    });
    this._layoutAxes();
  };
  Parallel.prototype.getRect = function () {
    return this._rect;
  };
  Parallel.prototype._makeLayoutInfo = function () {
    var parallelModel = this._model;
    var rect = this._rect;
    var xy = ['x', 'y'];
    var wh = ['width', 'height'];
    var layout = parallelModel.get('layout');
    var pixelDimIndex = layout === 'horizontal' ? 0 : 1;
    var layoutLength = rect[wh[pixelDimIndex]];
    var layoutExtent = [0, layoutLength];
    var axisCount = this.dimensions.length;
    var axisExpandWidth = restrict(parallelModel.get('axisExpandWidth'), layoutExtent);
    var axisExpandCount = restrict(parallelModel.get('axisExpandCount') || 0, [0, axisCount]);
    var axisExpandable = parallelModel.get('axisExpandable') && axisCount > 3 && axisCount > axisExpandCount && axisExpandCount > 1 && axisExpandWidth > 0 && layoutLength > 0;
    // `axisExpandWindow` is According to the coordinates of [0, axisExpandLength],
    // for sake of consider the case that axisCollapseWidth is 0 (when screen is narrow),
    // where collapsed axes should be overlapped.
    var axisExpandWindow = parallelModel.get('axisExpandWindow');
    var winSize;
    if (!axisExpandWindow) {
      winSize = restrict(axisExpandWidth * (axisExpandCount - 1), layoutExtent);
      var axisExpandCenter = parallelModel.get('axisExpandCenter') || mathFloor(axisCount / 2);
      axisExpandWindow = [axisExpandWidth * axisExpandCenter - winSize / 2];
      axisExpandWindow[1] = axisExpandWindow[0] + winSize;
    } else {
      winSize = restrict(axisExpandWindow[1] - axisExpandWindow[0], layoutExtent);
      axisExpandWindow[1] = axisExpandWindow[0] + winSize;
    }
    var axisCollapseWidth = (layoutLength - winSize) / (axisCount - axisExpandCount);
    // Avoid axisCollapseWidth is too small.
    axisCollapseWidth < 3 && (axisCollapseWidth = 0);
    // Find the first and last indices > ewin[0] and < ewin[1].
    var winInnerIndices = [mathFloor(round$1(axisExpandWindow[0] / axisExpandWidth, 1)) + 1, mathCeil(round$1(axisExpandWindow[1] / axisExpandWidth, 1)) - 1];
    // Pos in ec coordinates.
    var axisExpandWindow0Pos = axisCollapseWidth / axisExpandWidth * axisExpandWindow[0];
    return {
      layout: layout,
      pixelDimIndex: pixelDimIndex,
      layoutBase: rect[xy[pixelDimIndex]],
      layoutLength: layoutLength,
      axisBase: rect[xy[1 - pixelDimIndex]],
      axisLength: rect[wh[1 - pixelDimIndex]],
      axisExpandable: axisExpandable,
      axisExpandWidth: axisExpandWidth,
      axisCollapseWidth: axisCollapseWidth,
      axisExpandWindow: axisExpandWindow,
      axisCount: axisCount,
      winInnerIndices: winInnerIndices,
      axisExpandWindow0Pos: axisExpandWindow0Pos
    };
  };
  Parallel.prototype._layoutAxes = function () {
    var rect = this._rect;
    var axes = this._axesMap;
    var dimensions = this.dimensions;
    var layoutInfo = this._makeLayoutInfo();
    var layout = layoutInfo.layout;
    axes.each(function (axis) {
      var axisExtent = [0, layoutInfo.axisLength];
      var idx = axis.inverse ? 1 : 0;
      axis.setExtent(axisExtent[idx], axisExtent[1 - idx]);
    });
    each$a(dimensions, function (dim, idx) {
      var posInfo = (layoutInfo.axisExpandable ? layoutAxisWithExpand : layoutAxisWithoutExpand)(idx, layoutInfo);
      var positionTable = {
        horizontal: {
          x: posInfo.position,
          y: layoutInfo.axisLength
        },
        vertical: {
          x: 0,
          y: posInfo.position
        }
      };
      var rotationTable = {
        horizontal: PI$2 / 2,
        vertical: 0
      };
      var position = [positionTable[layout].x + rect.x, positionTable[layout].y + rect.y];
      var rotation = rotationTable[layout];
      var transform = create$1();
      rotate(transform, transform, rotation);
      translate(transform, transform, position);
      // TODO
      // tick layout info
      // TODO
      // update dimensions info based on axis order.
      this._axesLayout[dim] = {
        position: position,
        rotation: rotation,
        transform: transform,
        axisNameAvailableWidth: posInfo.axisNameAvailableWidth,
        axisLabelShow: posInfo.axisLabelShow,
        nameTruncateMaxWidth: posInfo.nameTruncateMaxWidth,
        tickDirection: 1,
        labelDirection: 1
      };
    }, this);
  };
  /**
   * Get axis by dim.
   */
  Parallel.prototype.getAxis = function (dim) {
    return this._axesMap.get(dim);
  };
  /**
   * Convert a dim value of a single item of series data to Point.
   */
  Parallel.prototype.dataToPoint = function (value, dim) {
    return this.axisCoordToPoint(this._axesMap.get(dim).dataToCoord(value), dim);
  };
  /**
   * Travel data for one time, get activeState of each data item.
   * @param start the start dataIndex that travel from.
   * @param end the next dataIndex of the last dataIndex will be travel.
   */
  Parallel.prototype.eachActiveState = function (data, callback, start, end) {
    start == null && (start = 0);
    end == null && (end = data.count());
    var axesMap = this._axesMap;
    var dimensions = this.dimensions;
    var dataDimensions = [];
    var axisModels = [];
    each$f(dimensions, function (axisDim) {
      dataDimensions.push(data.mapDimension(axisDim));
      axisModels.push(axesMap.get(axisDim).model);
    });
    var hasActiveSet = this.hasAxisBrushed();
    for (var dataIndex = start; dataIndex < end; dataIndex++) {
      var activeState = void 0;
      if (!hasActiveSet) {
        activeState = 'normal';
      } else {
        activeState = 'active';
        var values = data.getValues(dataDimensions, dataIndex);
        for (var j = 0, lenj = dimensions.length; j < lenj; j++) {
          var state = axisModels[j].getActiveState(values[j]);
          if (state === 'inactive') {
            activeState = 'inactive';
            break;
          }
        }
      }
      callback(activeState, dataIndex);
    }
  };
  /**
   * Whether has any activeSet.
   */
  Parallel.prototype.hasAxisBrushed = function () {
    var dimensions = this.dimensions;
    var axesMap = this._axesMap;
    var hasActiveSet = false;
    for (var j = 0, lenj = dimensions.length; j < lenj; j++) {
      if (axesMap.get(dimensions[j]).model.getActiveState() !== 'normal') {
        hasActiveSet = true;
      }
    }
    return hasActiveSet;
  };
  /**
   * Convert coords of each axis to Point.
   *  Return point. For example: [10, 20]
   */
  Parallel.prototype.axisCoordToPoint = function (coord, dim) {
    var axisLayout = this._axesLayout[dim];
    return applyTransform([coord, 0], axisLayout.transform);
  };
  /**
   * Get axis layout.
   */
  Parallel.prototype.getAxisLayout = function (dim) {
    return clone$4(this._axesLayout[dim]);
  };
  /**
   * @return {Object} {axisExpandWindow, delta, behavior: 'jump' | 'slide' | 'none'}.
   */
  Parallel.prototype.getSlidedAxisExpandWindow = function (point) {
    var layoutInfo = this._makeLayoutInfo();
    var pixelDimIndex = layoutInfo.pixelDimIndex;
    var axisExpandWindow = layoutInfo.axisExpandWindow.slice();
    var winSize = axisExpandWindow[1] - axisExpandWindow[0];
    var extent = [0, layoutInfo.axisExpandWidth * (layoutInfo.axisCount - 1)];
    // Out of the area of coordinate system.
    if (!this.containPoint(point)) {
      return {
        behavior: 'none',
        axisExpandWindow: axisExpandWindow
      };
    }
    // Convert the point from global to expand coordinates.
    var pointCoord = point[pixelDimIndex] - layoutInfo.layoutBase - layoutInfo.axisExpandWindow0Pos;
    // For dragging operation convenience, the window should not be
    // slided when mouse is the center area of the window.
    var delta;
    var behavior = 'slide';
    var axisCollapseWidth = layoutInfo.axisCollapseWidth;
    var triggerArea = this._model.get('axisExpandSlideTriggerArea');
    // But consider touch device, jump is necessary.
    var useJump = triggerArea[0] != null;
    if (axisCollapseWidth) {
      if (useJump && axisCollapseWidth && pointCoord < winSize * triggerArea[0]) {
        behavior = 'jump';
        delta = pointCoord - winSize * triggerArea[2];
      } else if (useJump && axisCollapseWidth && pointCoord > winSize * (1 - triggerArea[0])) {
        behavior = 'jump';
        delta = pointCoord - winSize * (1 - triggerArea[2]);
      } else {
        (delta = pointCoord - winSize * triggerArea[1]) >= 0 && (delta = pointCoord - winSize * (1 - triggerArea[1])) <= 0 && (delta = 0);
      }
      delta *= layoutInfo.axisExpandWidth / axisCollapseWidth;
      delta ? sliderMove(delta, axisExpandWindow, extent, 'all')
      // Avoid nonsense triger on mousemove.
      : behavior = 'none';
    }
    // When screen is too narrow, make it visible and slidable, although it is hard to interact.
    else {
      var winSize2 = axisExpandWindow[1] - axisExpandWindow[0];
      var pos = extent[1] * pointCoord / winSize2;
      axisExpandWindow = [mathMax$2(0, pos - winSize2 / 2)];
      axisExpandWindow[1] = mathMin$2(extent[1], axisExpandWindow[0] + winSize2);
      axisExpandWindow[0] = axisExpandWindow[1] - winSize2;
    }
    return {
      axisExpandWindow: axisExpandWindow,
      behavior: behavior
    };
  };
  return Parallel;
}();
function restrict(len, extent) {
  return mathMin$2(mathMax$2(len, extent[0]), extent[1]);
}
function layoutAxisWithoutExpand(axisIndex, layoutInfo) {
  var step = layoutInfo.layoutLength / (layoutInfo.axisCount - 1);
  return {
    position: step * axisIndex,
    axisNameAvailableWidth: step,
    axisLabelShow: true
  };
}
function layoutAxisWithExpand(axisIndex, layoutInfo) {
  var layoutLength = layoutInfo.layoutLength;
  var axisExpandWidth = layoutInfo.axisExpandWidth;
  var axisCount = layoutInfo.axisCount;
  var axisCollapseWidth = layoutInfo.axisCollapseWidth;
  var winInnerIndices = layoutInfo.winInnerIndices;
  var position;
  var axisNameAvailableWidth = axisCollapseWidth;
  var axisLabelShow = false;
  var nameTruncateMaxWidth;
  if (axisIndex < winInnerIndices[0]) {
    position = axisIndex * axisCollapseWidth;
    nameTruncateMaxWidth = axisCollapseWidth;
  } else if (axisIndex <= winInnerIndices[1]) {
    position = layoutInfo.axisExpandWindow0Pos + axisIndex * axisExpandWidth - layoutInfo.axisExpandWindow[0];
    axisNameAvailableWidth = axisExpandWidth;
    axisLabelShow = true;
  } else {
    position = layoutLength - (axisCount - 1 - axisIndex) * axisCollapseWidth;
    nameTruncateMaxWidth = axisCollapseWidth;
  }
  return {
    position: position,
    axisNameAvailableWidth: axisNameAvailableWidth,
    axisLabelShow: axisLabelShow,
    nameTruncateMaxWidth: nameTruncateMaxWidth
  };
}
var Parallel$1 = Parallel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function createParallelCoordSys(ecModel, api) {
  var coordSysList = [];
  ecModel.eachComponent('parallel', function (parallelModel, idx) {
    var coordSys = new Parallel$1(parallelModel, ecModel, api);
    coordSys.name = 'parallel_' + idx;
    coordSys.resize(parallelModel, api);
    parallelModel.coordinateSystem = coordSys;
    coordSys.model = parallelModel;
    coordSysList.push(coordSys);
  });
  // Inject the coordinateSystems into seriesModel
  ecModel.eachSeries(function (seriesModel) {
    if (seriesModel.get('coordinateSystem') === 'parallel') {
      var parallelModel = seriesModel.getReferringComponents('parallel', SINGLE_REFERRING).models[0];
      seriesModel.coordinateSystem = parallelModel.coordinateSystem;
    }
  });
  return coordSysList;
}
var parallelCoordSysCreator = {
  create: createParallelCoordSys
};
var parallelCoordSysCreator$1 = parallelCoordSysCreator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ParallelAxisModel = /** @class */function (_super) {
  __extends(ParallelAxisModel, _super);
  function ParallelAxisModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ParallelAxisModel.type;
    /**
     * @readOnly
     */
    _this.activeIntervals = [];
    return _this;
  }
  ParallelAxisModel.prototype.getAreaSelectStyle = function () {
    return makeStyleMapper([['fill', 'color'], ['lineWidth', 'borderWidth'], ['stroke', 'borderColor'], ['width', 'width'], ['opacity', 'opacity']
    // Option decal is in `DecalObject` but style.decal is in `PatternObject`.
    // So do not transfer decal directly.
    ])(this.getModel('areaSelectStyle'));
  };
  /**
   * The code of this feature is put on AxisModel but not ParallelAxis,
   * because axisModel can be alive after echarts updating but instance of
   * ParallelAxis having been disposed. this._activeInterval should be kept
   * when action dispatched (i.e. legend click).
   *
   * @param intervals `interval.length === 0` means set all active.
   */
  ParallelAxisModel.prototype.setActiveIntervals = function (intervals) {
    var activeIntervals = this.activeIntervals = clone$4(intervals);
    // Normalize
    if (activeIntervals) {
      for (var i = activeIntervals.length - 1; i >= 0; i--) {
        asc$2(activeIntervals[i]);
      }
    }
  };
  /**
   * @param value When only attempting detect whether 'no activeIntervals set',
   *        `value` is not needed to be input.
   */
  ParallelAxisModel.prototype.getActiveState = function (value) {
    var activeIntervals = this.activeIntervals;
    if (!activeIntervals.length) {
      return 'normal';
    }
    if (value == null || isNaN(+value)) {
      return 'inactive';
    }
    // Simple optimization
    if (activeIntervals.length === 1) {
      var interval = activeIntervals[0];
      if (interval[0] <= value && value <= interval[1]) {
        return 'active';
      }
    } else {
      for (var i = 0, len = activeIntervals.length; i < len; i++) {
        if (activeIntervals[i][0] <= value && value <= activeIntervals[i][1]) {
          return 'active';
        }
      }
    }
    return 'inactive';
  };
  return ParallelAxisModel;
}(ComponentModel$1);
mixin(ParallelAxisModel, AxisModelCommonMixin);
var ParallelAxisModel$1 = ParallelAxisModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var BRUSH_PANEL_GLOBAL = true;
var mathMin$1 = Math.min;
var mathMax$1 = Math.max;
var mathPow = Math.pow;
var COVER_Z = 10000;
var UNSELECT_THRESHOLD = 6;
var MIN_RESIZE_LINE_WIDTH = 6;
var MUTEX_RESOURCE_KEY = 'globalPan';
var DIRECTION_MAP = {
  w: [0, 0],
  e: [0, 1],
  n: [1, 0],
  s: [1, 1]
};
var CURSOR_MAP = {
  w: 'ew',
  e: 'ew',
  n: 'ns',
  s: 'ns',
  ne: 'nesw',
  sw: 'nesw',
  nw: 'nwse',
  se: 'nwse'
};
var DEFAULT_BRUSH_OPT = {
  brushStyle: {
    lineWidth: 2,
    stroke: 'rgba(210,219,238,0.3)',
    fill: '#D2DBEE'
  },
  transformable: true,
  brushMode: 'single',
  removeOnClick: false
};
var baseUID = 0;
/**
 * params:
 *     areas: Array.<Array>, coord relates to container group,
 *                             If no container specified, to global.
 *     opt {
 *         isEnd: boolean,
 *         removeOnClick: boolean
 *     }
 */
var BrushController = /** @class */function (_super) {
  __extends(BrushController, _super);
  function BrushController(zr) {
    var _this = _super.call(this) || this;
    /**
     * @internal
     */
    _this._track = [];
    /**
     * @internal
     */
    _this._covers = [];
    _this._handlers = {};
    {
      assert(zr);
    }
    _this._zr = zr;
    _this.group = new Group$5();
    _this._uid = 'brushController_' + baseUID++;
    each$f(pointerHandlers, function (handler, eventName) {
      this._handlers[eventName] = bind$1(handler, this);
    }, _this);
    return _this;
  }
  /**
   * If set to `false`, select disabled.
   */
  BrushController.prototype.enableBrush = function (brushOption) {
    {
      assert(this._mounted);
    }
    this._brushType && this._doDisableBrush();
    brushOption.brushType && this._doEnableBrush(brushOption);
    return this;
  };
  BrushController.prototype._doEnableBrush = function (brushOption) {
    var zr = this._zr;
    // Consider roam, which takes globalPan too.
    if (!this._enableGlobalPan) {
      take(zr, MUTEX_RESOURCE_KEY, this._uid);
    }
    each$f(this._handlers, function (handler, eventName) {
      zr.on(eventName, handler);
    });
    this._brushType = brushOption.brushType;
    this._brushOption = merge(clone$4(DEFAULT_BRUSH_OPT), brushOption, true);
  };
  BrushController.prototype._doDisableBrush = function () {
    var zr = this._zr;
    release(zr, MUTEX_RESOURCE_KEY, this._uid);
    each$f(this._handlers, function (handler, eventName) {
      zr.off(eventName, handler);
    });
    this._brushType = this._brushOption = null;
  };
  /**
   * @param panelOpts If not pass, it is global brush.
   */
  BrushController.prototype.setPanels = function (panelOpts) {
    if (panelOpts && panelOpts.length) {
      var panels_1 = this._panels = {};
      each$f(panelOpts, function (panelOpts) {
        panels_1[panelOpts.panelId] = clone$4(panelOpts);
      });
    } else {
      this._panels = null;
    }
    return this;
  };
  BrushController.prototype.mount = function (opt) {
    opt = opt || {};
    {
      this._mounted = true; // should be at first.
    }
    this._enableGlobalPan = opt.enableGlobalPan;
    var thisGroup = this.group;
    this._zr.add(thisGroup);
    thisGroup.attr({
      x: opt.x || 0,
      y: opt.y || 0,
      rotation: opt.rotation || 0,
      scaleX: opt.scaleX || 1,
      scaleY: opt.scaleY || 1
    });
    this._transform = thisGroup.getLocalTransform();
    return this;
  };
  // eachCover(cb, context): void {
  //     each(this._covers, cb, context);
  // }
  /**
   * Update covers.
   * @param coverConfigList
   *        If coverConfigList is null/undefined, all covers removed.
   */
  BrushController.prototype.updateCovers = function (coverConfigList) {
    {
      assert(this._mounted);
    }
    coverConfigList = map$1(coverConfigList, function (coverConfig) {
      return merge(clone$4(DEFAULT_BRUSH_OPT), coverConfig, true);
    });
    var tmpIdPrefix = '\0-brush-index-';
    var oldCovers = this._covers;
    var newCovers = this._covers = [];
    var controller = this;
    var creatingCover = this._creatingCover;
    new DataDiffer$1(oldCovers, coverConfigList, oldGetKey, getKey).add(addOrUpdate).update(addOrUpdate).remove(remove).execute();
    return this;
    function getKey(brushOption, index) {
      return (brushOption.id != null ? brushOption.id : tmpIdPrefix + index) + '-' + brushOption.brushType;
    }
    function oldGetKey(cover, index) {
      return getKey(cover.__brushOption, index);
    }
    function addOrUpdate(newIndex, oldIndex) {
      var newBrushInternal = coverConfigList[newIndex];
      // Consider setOption in event listener of brushSelect,
      // where updating cover when creating should be forbidden.
      if (oldIndex != null && oldCovers[oldIndex] === creatingCover) {
        newCovers[newIndex] = oldCovers[oldIndex];
      } else {
        var cover = newCovers[newIndex] = oldIndex != null ? (oldCovers[oldIndex].__brushOption = newBrushInternal, oldCovers[oldIndex]) : endCreating(controller, createCover(controller, newBrushInternal));
        updateCoverAfterCreation(controller, cover);
      }
    }
    function remove(oldIndex) {
      if (oldCovers[oldIndex] !== creatingCover) {
        controller.group.remove(oldCovers[oldIndex]);
      }
    }
  };
  BrushController.prototype.unmount = function () {
    {
      if (!this._mounted) {
        return;
      }
    }
    this.enableBrush(false);
    // container may 'removeAll' outside.
    clearCovers(this);
    this._zr.remove(this.group);
    {
      this._mounted = false; // should be at last.
    }
    return this;
  };
  BrushController.prototype.dispose = function () {
    this.unmount();
    this.off();
  };
  return BrushController;
}(Eventful$1);
function createCover(controller, brushOption) {
  var cover = coverRenderers[brushOption.brushType].createCover(controller, brushOption);
  cover.__brushOption = brushOption;
  updateZ$1(cover, brushOption);
  controller.group.add(cover);
  return cover;
}
function endCreating(controller, creatingCover) {
  var coverRenderer = getCoverRenderer(creatingCover);
  if (coverRenderer.endCreating) {
    coverRenderer.endCreating(controller, creatingCover);
    updateZ$1(creatingCover, creatingCover.__brushOption);
  }
  return creatingCover;
}
function updateCoverShape(controller, cover) {
  var brushOption = cover.__brushOption;
  getCoverRenderer(cover).updateCoverShape(controller, cover, brushOption.range, brushOption);
}
function updateZ$1(cover, brushOption) {
  var z = brushOption.z;
  z == null && (z = COVER_Z);
  cover.traverse(function (el) {
    el.z = z;
    el.z2 = z; // Consider in given container.
  });
}
function updateCoverAfterCreation(controller, cover) {
  getCoverRenderer(cover).updateCommon(controller, cover);
  updateCoverShape(controller, cover);
}
function getCoverRenderer(cover) {
  return coverRenderers[cover.__brushOption.brushType];
}
// return target panel or `true` (means global panel)
function getPanelByPoint(controller, e, localCursorPoint) {
  var panels = controller._panels;
  if (!panels) {
    return BRUSH_PANEL_GLOBAL; // Global panel
  }
  var panel;
  var transform = controller._transform;
  each$f(panels, function (pn) {
    pn.isTargetByCursor(e, localCursorPoint, transform) && (panel = pn);
  });
  return panel;
}
// Return a panel or true
function getPanelByCover(controller, cover) {
  var panels = controller._panels;
  if (!panels) {
    return BRUSH_PANEL_GLOBAL; // Global panel
  }
  var panelId = cover.__brushOption.panelId;
  // User may give cover without coord sys info,
  // which is then treated as global panel.
  return panelId != null ? panels[panelId] : BRUSH_PANEL_GLOBAL;
}
function clearCovers(controller) {
  var covers = controller._covers;
  var originalLength = covers.length;
  each$f(covers, function (cover) {
    controller.group.remove(cover);
  }, controller);
  covers.length = 0;
  return !!originalLength;
}
function trigger(controller, opt) {
  var areas = map$1(controller._covers, function (cover) {
    var brushOption = cover.__brushOption;
    var range = clone$4(brushOption.range);
    return {
      brushType: brushOption.brushType,
      panelId: brushOption.panelId,
      range: range
    };
  });
  controller.trigger('brush', {
    areas: areas,
    isEnd: !!opt.isEnd,
    removeOnClick: !!opt.removeOnClick
  });
}
function shouldShowCover(controller) {
  var track = controller._track;
  if (!track.length) {
    return false;
  }
  var p2 = track[track.length - 1];
  var p1 = track[0];
  var dx = p2[0] - p1[0];
  var dy = p2[1] - p1[1];
  var dist = mathPow(dx * dx + dy * dy, 0.5);
  return dist > UNSELECT_THRESHOLD;
}
function getTrackEnds(track) {
  var tail = track.length - 1;
  tail < 0 && (tail = 0);
  return [track[0], track[tail]];
}
function createBaseRectCover(rectRangeConverter, controller, brushOption, edgeNameSequences) {
  var cover = new Group$5();
  cover.add(new Rect$3({
    name: 'main',
    style: makeStyle(brushOption),
    silent: true,
    draggable: true,
    cursor: 'move',
    drift: curry$1(driftRect, rectRangeConverter, controller, cover, ['n', 's', 'w', 'e']),
    ondragend: curry$1(trigger, controller, {
      isEnd: true
    })
  }));
  each$f(edgeNameSequences, function (nameSequence) {
    cover.add(new Rect$3({
      name: nameSequence.join(''),
      style: {
        opacity: 0
      },
      draggable: true,
      silent: true,
      invisible: true,
      drift: curry$1(driftRect, rectRangeConverter, controller, cover, nameSequence),
      ondragend: curry$1(trigger, controller, {
        isEnd: true
      })
    }));
  });
  return cover;
}
function updateBaseRect(controller, cover, localRange, brushOption) {
  var lineWidth = brushOption.brushStyle.lineWidth || 0;
  var handleSize = mathMax$1(lineWidth, MIN_RESIZE_LINE_WIDTH);
  var x = localRange[0][0];
  var y = localRange[1][0];
  var xa = x - lineWidth / 2;
  var ya = y - lineWidth / 2;
  var x2 = localRange[0][1];
  var y2 = localRange[1][1];
  var x2a = x2 - handleSize + lineWidth / 2;
  var y2a = y2 - handleSize + lineWidth / 2;
  var width = x2 - x;
  var height = y2 - y;
  var widtha = width + lineWidth;
  var heighta = height + lineWidth;
  updateRectShape(controller, cover, 'main', x, y, width, height);
  if (brushOption.transformable) {
    updateRectShape(controller, cover, 'w', xa, ya, handleSize, heighta);
    updateRectShape(controller, cover, 'e', x2a, ya, handleSize, heighta);
    updateRectShape(controller, cover, 'n', xa, ya, widtha, handleSize);
    updateRectShape(controller, cover, 's', xa, y2a, widtha, handleSize);
    updateRectShape(controller, cover, 'nw', xa, ya, handleSize, handleSize);
    updateRectShape(controller, cover, 'ne', x2a, ya, handleSize, handleSize);
    updateRectShape(controller, cover, 'sw', xa, y2a, handleSize, handleSize);
    updateRectShape(controller, cover, 'se', x2a, y2a, handleSize, handleSize);
  }
}
function updateCommon$1(controller, cover) {
  var brushOption = cover.__brushOption;
  var transformable = brushOption.transformable;
  var mainEl = cover.childAt(0);
  mainEl.useStyle(makeStyle(brushOption));
  mainEl.attr({
    silent: !transformable,
    cursor: transformable ? 'move' : 'default'
  });
  each$f([['w'], ['e'], ['n'], ['s'], ['s', 'e'], ['s', 'w'], ['n', 'e'], ['n', 'w']], function (nameSequence) {
    var el = cover.childOfName(nameSequence.join(''));
    var globalDir = nameSequence.length === 1 ? getGlobalDirection1(controller, nameSequence[0]) : getGlobalDirection2(controller, nameSequence);
    el && el.attr({
      silent: !transformable,
      invisible: !transformable,
      cursor: transformable ? CURSOR_MAP[globalDir] + '-resize' : null
    });
  });
}
function updateRectShape(controller, cover, name, x, y, w, h) {
  var el = cover.childOfName(name);
  el && el.setShape(pointsToRect(clipByPanel(controller, cover, [[x, y], [x + w, y + h]])));
}
function makeStyle(brushOption) {
  return defaults({
    strokeNoScale: true
  }, brushOption.brushStyle);
}
function formatRectRange(x, y, x2, y2) {
  var min = [mathMin$1(x, x2), mathMin$1(y, y2)];
  var max = [mathMax$1(x, x2), mathMax$1(y, y2)];
  return [[min[0], max[0]], [min[1], max[1]] // y range
  ];
}
function getTransform(controller) {
  return getTransform$1(controller.group);
}
function getGlobalDirection1(controller, localDirName) {
  var map = {
    w: 'left',
    e: 'right',
    n: 'top',
    s: 'bottom'
  };
  var inverseMap = {
    left: 'w',
    right: 'e',
    top: 'n',
    bottom: 's'
  };
  var dir = transformDirection$1(map[localDirName], getTransform(controller));
  return inverseMap[dir];
}
function getGlobalDirection2(controller, localDirNameSeq) {
  var globalDir = [getGlobalDirection1(controller, localDirNameSeq[0]), getGlobalDirection1(controller, localDirNameSeq[1])];
  (globalDir[0] === 'e' || globalDir[0] === 'w') && globalDir.reverse();
  return globalDir.join('');
}
function driftRect(rectRangeConverter, controller, cover, dirNameSequence, dx, dy) {
  var brushOption = cover.__brushOption;
  var rectRange = rectRangeConverter.toRectRange(brushOption.range);
  var localDelta = toLocalDelta(controller, dx, dy);
  each$f(dirNameSequence, function (dirName) {
    var ind = DIRECTION_MAP[dirName];
    rectRange[ind[0]][ind[1]] += localDelta[ind[0]];
  });
  brushOption.range = rectRangeConverter.fromRectRange(formatRectRange(rectRange[0][0], rectRange[1][0], rectRange[0][1], rectRange[1][1]));
  updateCoverAfterCreation(controller, cover);
  trigger(controller, {
    isEnd: false
  });
}
function driftPolygon(controller, cover, dx, dy) {
  var range = cover.__brushOption.range;
  var localDelta = toLocalDelta(controller, dx, dy);
  each$f(range, function (point) {
    point[0] += localDelta[0];
    point[1] += localDelta[1];
  });
  updateCoverAfterCreation(controller, cover);
  trigger(controller, {
    isEnd: false
  });
}
function toLocalDelta(controller, dx, dy) {
  var thisGroup = controller.group;
  var localD = thisGroup.transformCoordToLocal(dx, dy);
  var localZero = thisGroup.transformCoordToLocal(0, 0);
  return [localD[0] - localZero[0], localD[1] - localZero[1]];
}
function clipByPanel(controller, cover, data) {
  var panel = getPanelByCover(controller, cover);
  return panel && panel !== BRUSH_PANEL_GLOBAL ? panel.clipPath(data, controller._transform) : clone$4(data);
}
function pointsToRect(points) {
  var xmin = mathMin$1(points[0][0], points[1][0]);
  var ymin = mathMin$1(points[0][1], points[1][1]);
  var xmax = mathMax$1(points[0][0], points[1][0]);
  var ymax = mathMax$1(points[0][1], points[1][1]);
  return {
    x: xmin,
    y: ymin,
    width: xmax - xmin,
    height: ymax - ymin
  };
}
function resetCursor(controller, e, localCursorPoint) {
  if (
  // Check active
  !controller._brushType
  // resetCursor should be always called when mouse is in zr area,
  // but not called when mouse is out of zr area to avoid bad influence
  // if `mousemove`, `mouseup` are triggered from `document` event.
  || isOutsideZrArea(controller, e.offsetX, e.offsetY)) {
    return;
  }
  var zr = controller._zr;
  var covers = controller._covers;
  var currPanel = getPanelByPoint(controller, e, localCursorPoint);
  // Check whether in covers.
  if (!controller._dragging) {
    for (var i = 0; i < covers.length; i++) {
      var brushOption = covers[i].__brushOption;
      if (currPanel && (currPanel === BRUSH_PANEL_GLOBAL || brushOption.panelId === currPanel.panelId) && coverRenderers[brushOption.brushType].contain(covers[i], localCursorPoint[0], localCursorPoint[1])) {
        // Use cursor style set on cover.
        return;
      }
    }
  }
  currPanel && zr.setCursorStyle('crosshair');
}
function preventDefault(e) {
  var rawE = e.event;
  rawE.preventDefault && rawE.preventDefault();
}
function mainShapeContain(cover, x, y) {
  return cover.childOfName('main').contain(x, y);
}
function updateCoverByMouse(controller, e, localCursorPoint, isEnd) {
  var creatingCover = controller._creatingCover;
  var panel = controller._creatingPanel;
  var thisBrushOption = controller._brushOption;
  var eventParams;
  controller._track.push(localCursorPoint.slice());
  if (shouldShowCover(controller) || creatingCover) {
    if (panel && !creatingCover) {
      thisBrushOption.brushMode === 'single' && clearCovers(controller);
      var brushOption = clone$4(thisBrushOption);
      brushOption.brushType = determineBrushType(brushOption.brushType, panel);
      brushOption.panelId = panel === BRUSH_PANEL_GLOBAL ? null : panel.panelId;
      creatingCover = controller._creatingCover = createCover(controller, brushOption);
      controller._covers.push(creatingCover);
    }
    if (creatingCover) {
      var coverRenderer = coverRenderers[determineBrushType(controller._brushType, panel)];
      var coverBrushOption = creatingCover.__brushOption;
      coverBrushOption.range = coverRenderer.getCreatingRange(clipByPanel(controller, creatingCover, controller._track));
      if (isEnd) {
        endCreating(controller, creatingCover);
        coverRenderer.updateCommon(controller, creatingCover);
      }
      updateCoverShape(controller, creatingCover);
      eventParams = {
        isEnd: isEnd
      };
    }
  } else if (isEnd && thisBrushOption.brushMode === 'single' && thisBrushOption.removeOnClick) {
    // Help user to remove covers easily, only by a tiny drag, in 'single' mode.
    // But a single click do not clear covers, because user may have casual
    // clicks (for example, click on other component and do not expect covers
    // disappear).
    // Only some cover removed, trigger action, but not every click trigger action.
    if (getPanelByPoint(controller, e, localCursorPoint) && clearCovers(controller)) {
      eventParams = {
        isEnd: isEnd,
        removeOnClick: true
      };
    }
  }
  return eventParams;
}
function determineBrushType(brushType, panel) {
  if (brushType === 'auto') {
    {
      assert(panel && panel.defaultBrushType, 'MUST have defaultBrushType when brushType is "atuo"');
    }
    return panel.defaultBrushType;
  }
  return brushType;
}
var pointerHandlers = {
  mousedown: function (e) {
    if (this._dragging) {
      // In case some browser do not support globalOut,
      // and release mouse out side the browser.
      handleDragEnd(this, e);
    } else if (!e.target || !e.target.draggable) {
      preventDefault(e);
      var localCursorPoint = this.group.transformCoordToLocal(e.offsetX, e.offsetY);
      this._creatingCover = null;
      var panel = this._creatingPanel = getPanelByPoint(this, e, localCursorPoint);
      if (panel) {
        this._dragging = true;
        this._track = [localCursorPoint.slice()];
      }
    }
  },
  mousemove: function (e) {
    var x = e.offsetX;
    var y = e.offsetY;
    var localCursorPoint = this.group.transformCoordToLocal(x, y);
    resetCursor(this, e, localCursorPoint);
    if (this._dragging) {
      preventDefault(e);
      var eventParams = updateCoverByMouse(this, e, localCursorPoint, false);
      eventParams && trigger(this, eventParams);
    }
  },
  mouseup: function (e) {
    handleDragEnd(this, e);
  }
};
function handleDragEnd(controller, e) {
  if (controller._dragging) {
    preventDefault(e);
    var x = e.offsetX;
    var y = e.offsetY;
    var localCursorPoint = controller.group.transformCoordToLocal(x, y);
    var eventParams = updateCoverByMouse(controller, e, localCursorPoint, true);
    controller._dragging = false;
    controller._track = [];
    controller._creatingCover = null;
    // trigger event should be at final, after procedure will be nested.
    eventParams && trigger(controller, eventParams);
  }
}
function isOutsideZrArea(controller, x, y) {
  var zr = controller._zr;
  return x < 0 || x > zr.getWidth() || y < 0 || y > zr.getHeight();
}
/**
 * key: brushType
 */
var coverRenderers = {
  lineX: getLineRenderer(0),
  lineY: getLineRenderer(1),
  rect: {
    createCover: function (controller, brushOption) {
      function returnInput(range) {
        return range;
      }
      return createBaseRectCover({
        toRectRange: returnInput,
        fromRectRange: returnInput
      }, controller, brushOption, [['w'], ['e'], ['n'], ['s'], ['s', 'e'], ['s', 'w'], ['n', 'e'], ['n', 'w']]);
    },
    getCreatingRange: function (localTrack) {
      var ends = getTrackEnds(localTrack);
      return formatRectRange(ends[1][0], ends[1][1], ends[0][0], ends[0][1]);
    },
    updateCoverShape: function (controller, cover, localRange, brushOption) {
      updateBaseRect(controller, cover, localRange, brushOption);
    },
    updateCommon: updateCommon$1,
    contain: mainShapeContain
  },
  polygon: {
    createCover: function (controller, brushOption) {
      var cover = new Group$5();
      // Do not use graphic.Polygon because graphic.Polyline do not close the
      // border of the shape when drawing, which is a better experience for user.
      cover.add(new Polyline$3({
        name: 'main',
        style: makeStyle(brushOption),
        silent: true
      }));
      return cover;
    },
    getCreatingRange: function (localTrack) {
      return localTrack;
    },
    endCreating: function (controller, cover) {
      cover.remove(cover.childAt(0));
      // Use graphic.Polygon close the shape.
      cover.add(new Polygon$1({
        name: 'main',
        draggable: true,
        drift: curry$1(driftPolygon, controller, cover),
        ondragend: curry$1(trigger, controller, {
          isEnd: true
        })
      }));
    },
    updateCoverShape: function (controller, cover, localRange, brushOption) {
      cover.childAt(0).setShape({
        points: clipByPanel(controller, cover, localRange)
      });
    },
    updateCommon: updateCommon$1,
    contain: mainShapeContain
  }
};
function getLineRenderer(xyIndex) {
  return {
    createCover: function (controller, brushOption) {
      return createBaseRectCover({
        toRectRange: function (range) {
          var rectRange = [range, [0, 100]];
          xyIndex && rectRange.reverse();
          return rectRange;
        },
        fromRectRange: function (rectRange) {
          return rectRange[xyIndex];
        }
      }, controller, brushOption, [[['w'], ['e']], [['n'], ['s']]][xyIndex]);
    },
    getCreatingRange: function (localTrack) {
      var ends = getTrackEnds(localTrack);
      var min = mathMin$1(ends[0][xyIndex], ends[1][xyIndex]);
      var max = mathMax$1(ends[0][xyIndex], ends[1][xyIndex]);
      return [min, max];
    },
    updateCoverShape: function (controller, cover, localRange, brushOption) {
      var otherExtent;
      // If brushWidth not specified, fit the panel.
      var panel = getPanelByCover(controller, cover);
      if (panel !== BRUSH_PANEL_GLOBAL && panel.getLinearBrushOtherExtent) {
        otherExtent = panel.getLinearBrushOtherExtent(xyIndex);
      } else {
        var zr = controller._zr;
        otherExtent = [0, [zr.getWidth(), zr.getHeight()][1 - xyIndex]];
      }
      var rectRange = [localRange, otherExtent];
      xyIndex && rectRange.reverse();
      updateBaseRect(controller, cover, rectRange, brushOption);
    },
    updateCommon: updateCommon$1,
    contain: mainShapeContain
  };
}
var BrushController$1 = BrushController;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function makeRectPanelClipPath(rect) {
  rect = normalizeRect(rect);
  return function (localPoints) {
    return clipPointsByRect(localPoints, rect);
  };
}
function makeLinearBrushOtherExtent(rect, specifiedXYIndex) {
  rect = normalizeRect(rect);
  return function (xyIndex) {
    var idx = specifiedXYIndex != null ? specifiedXYIndex : xyIndex;
    var brushWidth = idx ? rect.width : rect.height;
    var base = idx ? rect.x : rect.y;
    return [base, base + (brushWidth || 0)];
  };
}
function makeRectIsTargetByCursor(rect, api, targetModel) {
  var boundingRect = normalizeRect(rect);
  return function (e, localCursorPoint) {
    return boundingRect.contain(localCursorPoint[0], localCursorPoint[1]) && !onIrrelevantElement(e, api, targetModel);
  };
}
// Consider width/height is negative.
function normalizeRect(rect) {
  return BoundingRect$1.create(rect);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var elementList$1 = ['axisLine', 'axisTickLabel', 'axisName'];
var ParallelAxisView = /** @class */function (_super) {
  __extends(ParallelAxisView, _super);
  function ParallelAxisView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ParallelAxisView.type;
    return _this;
  }
  ParallelAxisView.prototype.init = function (ecModel, api) {
    _super.prototype.init.apply(this, arguments);
    (this._brushController = new BrushController$1(api.getZr())).on('brush', bind$1(this._onBrush, this));
  };
  ParallelAxisView.prototype.render = function (axisModel, ecModel, api, payload) {
    if (fromAxisAreaSelect(axisModel, ecModel, payload)) {
      return;
    }
    this.axisModel = axisModel;
    this.api = api;
    this.group.removeAll();
    var oldAxisGroup = this._axisGroup;
    this._axisGroup = new Group$5();
    this.group.add(this._axisGroup);
    if (!axisModel.get('show')) {
      return;
    }
    var coordSysModel = getCoordSysModel(axisModel, ecModel);
    var coordSys = coordSysModel.coordinateSystem;
    var areaSelectStyle = axisModel.getAreaSelectStyle();
    var areaWidth = areaSelectStyle.width;
    var dim = axisModel.axis.dim;
    var axisLayout = coordSys.getAxisLayout(dim);
    var builderOpt = extend({
      strokeContainThreshold: areaWidth
    }, axisLayout);
    var axisBuilder = new AxisBuilder$1(axisModel, builderOpt);
    each$f(elementList$1, axisBuilder.add, axisBuilder);
    this._axisGroup.add(axisBuilder.getGroup());
    this._refreshBrushController(builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api);
    groupTransition(oldAxisGroup, this._axisGroup, axisModel);
  };
  // /**
  //  * @override
  //  */
  // updateVisual(axisModel, ecModel, api, payload) {
  //     this._brushController && this._brushController
  //         .updateCovers(getCoverInfoList(axisModel));
  // }
  ParallelAxisView.prototype._refreshBrushController = function (builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api) {
    // After filtering, axis may change, select area needs to be update.
    var extent = axisModel.axis.getExtent();
    var extentLen = extent[1] - extent[0];
    var extra = Math.min(30, Math.abs(extentLen) * 0.1); // Arbitrary value.
    // width/height might be negative, which will be
    // normalized in BoundingRect.
    var rect = BoundingRect$1.create({
      x: extent[0],
      y: -areaWidth / 2,
      width: extentLen,
      height: areaWidth
    });
    rect.x -= extra;
    rect.width += 2 * extra;
    this._brushController.mount({
      enableGlobalPan: true,
      rotation: builderOpt.rotation,
      x: builderOpt.position[0],
      y: builderOpt.position[1]
    }).setPanels([{
      panelId: 'pl',
      clipPath: makeRectPanelClipPath(rect),
      isTargetByCursor: makeRectIsTargetByCursor(rect, api, coordSysModel),
      getLinearBrushOtherExtent: makeLinearBrushOtherExtent(rect, 0)
    }]).enableBrush({
      brushType: 'lineX',
      brushStyle: areaSelectStyle,
      removeOnClick: true
    }).updateCovers(getCoverInfoList(axisModel));
  };
  ParallelAxisView.prototype._onBrush = function (eventParam) {
    var coverInfoList = eventParam.areas;
    // Do not cache these object, because the mey be changed.
    var axisModel = this.axisModel;
    var axis = axisModel.axis;
    var intervals = map$1(coverInfoList, function (coverInfo) {
      return [axis.coordToData(coverInfo.range[0], true), axis.coordToData(coverInfo.range[1], true)];
    });
    // If realtime is true, action is not dispatched on drag end, because
    // the drag end emits the same params with the last drag move event,
    // and may have some delay when using touch pad.
    if (!axisModel.option.realtime === eventParam.isEnd || eventParam.removeOnClick) {
      // jshint ignore:line
      this.api.dispatchAction({
        type: 'axisAreaSelect',
        parallelAxisId: axisModel.id,
        intervals: intervals
      });
    }
  };
  ParallelAxisView.prototype.dispose = function () {
    this._brushController.dispose();
  };
  ParallelAxisView.type = 'parallelAxis';
  return ParallelAxisView;
}(ComponentView$1);
function fromAxisAreaSelect(axisModel, ecModel, payload) {
  return payload && payload.type === 'axisAreaSelect' && ecModel.findComponents({
    mainType: 'parallelAxis',
    query: payload
  })[0] === axisModel;
}
function getCoverInfoList(axisModel) {
  var axis = axisModel.axis;
  return map$1(axisModel.activeIntervals, function (interval) {
    return {
      brushType: 'lineX',
      panelId: 'pl',
      range: [axis.dataToCoord(interval[0], true), axis.dataToCoord(interval[1], true)]
    };
  });
}
function getCoordSysModel(axisModel, ecModel) {
  return ecModel.getComponent('parallel', axisModel.get('parallelIndex'));
}
var ParallelAxisView$1 = ParallelAxisView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var actionInfo = {
  type: 'axisAreaSelect',
  event: 'axisAreaSelected'
  // update: 'updateVisual'
};
function installParallelActions(registers) {
  registers.registerAction(actionInfo, function (payload, ecModel) {
    ecModel.eachComponent({
      mainType: 'parallelAxis',
      query: payload
    }, function (parallelAxisModel) {
      parallelAxisModel.axis.model.setActiveIntervals(payload.intervals);
    });
  });
  /**
   * @payload
   */
  registers.registerAction('parallelAxisExpand', function (payload, ecModel) {
    ecModel.eachComponent({
      mainType: 'parallel',
      query: payload
    }, function (parallelModel) {
      parallelModel.setAxisExpand(payload);
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var defaultAxisOption = {
  type: 'value',
  areaSelectStyle: {
    width: 20,
    borderWidth: 1,
    borderColor: 'rgba(160,197,232)',
    color: 'rgba(160,197,232)',
    opacity: 0.3
  },
  realtime: true,
  z: 10
};
function install$E(registers) {
  registers.registerComponentView(ParallelView$1);
  registers.registerComponentModel(ParallelModel$1);
  registers.registerCoordinateSystem('parallel', parallelCoordSysCreator$1);
  registers.registerPreprocessor(parallelPreprocessor);
  registers.registerComponentModel(ParallelAxisModel$1);
  registers.registerComponentView(ParallelAxisView$1);
  axisModelCreator(registers, 'parallel', ParallelAxisModel$1, defaultAxisOption);
  installParallelActions(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$D(registers) {
  use(install$E);
  registers.registerChartView(ParallelView$3);
  registers.registerSeriesModel(ParallelSeriesModel$1);
  registers.registerVisual(registers.PRIORITY.VISUAL.BRUSH, parallelVisual$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SankeyPathShape = /** @class */function () {
  function SankeyPathShape() {
    this.x1 = 0;
    this.y1 = 0;
    this.x2 = 0;
    this.y2 = 0;
    this.cpx1 = 0;
    this.cpy1 = 0;
    this.cpx2 = 0;
    this.cpy2 = 0;
    this.extent = 0;
  }
  return SankeyPathShape;
}();
var SankeyPath = /** @class */function (_super) {
  __extends(SankeyPath, _super);
  function SankeyPath(opts) {
    return _super.call(this, opts) || this;
  }
  SankeyPath.prototype.getDefaultShape = function () {
    return new SankeyPathShape();
  };
  SankeyPath.prototype.buildPath = function (ctx, shape) {
    var extent = shape.extent;
    ctx.moveTo(shape.x1, shape.y1);
    ctx.bezierCurveTo(shape.cpx1, shape.cpy1, shape.cpx2, shape.cpy2, shape.x2, shape.y2);
    if (shape.orient === 'vertical') {
      ctx.lineTo(shape.x2 + extent, shape.y2);
      ctx.bezierCurveTo(shape.cpx2 + extent, shape.cpy2, shape.cpx1 + extent, shape.cpy1, shape.x1 + extent, shape.y1);
    } else {
      ctx.lineTo(shape.x2, shape.y2 + extent);
      ctx.bezierCurveTo(shape.cpx2, shape.cpy2 + extent, shape.cpx1, shape.cpy1 + extent, shape.x1, shape.y1 + extent);
    }
    ctx.closePath();
  };
  SankeyPath.prototype.highlight = function () {
    enterEmphasis(this);
  };
  SankeyPath.prototype.downplay = function () {
    leaveEmphasis(this);
  };
  return SankeyPath;
}(Path$1);
var SankeyView = /** @class */function (_super) {
  __extends(SankeyView, _super);
  function SankeyView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SankeyView.type;
    _this._focusAdjacencyDisabled = false;
    return _this;
  }
  SankeyView.prototype.render = function (seriesModel, ecModel, api) {
    var sankeyView = this;
    var graph = seriesModel.getGraph();
    var group = this.group;
    var layoutInfo = seriesModel.layoutInfo;
    // view width
    var width = layoutInfo.width;
    // view height
    var height = layoutInfo.height;
    var nodeData = seriesModel.getData();
    var edgeData = seriesModel.getData('edge');
    var orient = seriesModel.get('orient');
    this._model = seriesModel;
    group.removeAll();
    group.x = layoutInfo.x;
    group.y = layoutInfo.y;
    // generate a bezire Curve for each edge
    graph.eachEdge(function (edge) {
      var curve = new SankeyPath();
      var ecData = getECData(curve);
      ecData.dataIndex = edge.dataIndex;
      ecData.seriesIndex = seriesModel.seriesIndex;
      ecData.dataType = 'edge';
      var edgeModel = edge.getModel();
      var lineStyleModel = edgeModel.getModel('lineStyle');
      var curvature = lineStyleModel.get('curveness');
      var n1Layout = edge.node1.getLayout();
      var node1Model = edge.node1.getModel();
      var dragX1 = node1Model.get('localX');
      var dragY1 = node1Model.get('localY');
      var n2Layout = edge.node2.getLayout();
      var node2Model = edge.node2.getModel();
      var dragX2 = node2Model.get('localX');
      var dragY2 = node2Model.get('localY');
      var edgeLayout = edge.getLayout();
      var x1;
      var y1;
      var x2;
      var y2;
      var cpx1;
      var cpy1;
      var cpx2;
      var cpy2;
      curve.shape.extent = Math.max(1, edgeLayout.dy);
      curve.shape.orient = orient;
      if (orient === 'vertical') {
        x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + edgeLayout.sy;
        y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + n1Layout.dy;
        x2 = (dragX2 != null ? dragX2 * width : n2Layout.x) + edgeLayout.ty;
        y2 = dragY2 != null ? dragY2 * height : n2Layout.y;
        cpx1 = x1;
        cpy1 = y1 * (1 - curvature) + y2 * curvature;
        cpx2 = x2;
        cpy2 = y1 * curvature + y2 * (1 - curvature);
      } else {
        x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + n1Layout.dx;
        y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + edgeLayout.sy;
        x2 = dragX2 != null ? dragX2 * width : n2Layout.x;
        y2 = (dragY2 != null ? dragY2 * height : n2Layout.y) + edgeLayout.ty;
        cpx1 = x1 * (1 - curvature) + x2 * curvature;
        cpy1 = y1;
        cpx2 = x1 * curvature + x2 * (1 - curvature);
        cpy2 = y2;
      }
      curve.setShape({
        x1: x1,
        y1: y1,
        x2: x2,
        y2: y2,
        cpx1: cpx1,
        cpy1: cpy1,
        cpx2: cpx2,
        cpy2: cpy2
      });
      curve.useStyle(lineStyleModel.getItemStyle());
      // Special color, use source node color or target node color
      applyCurveStyle(curve.style, orient, edge);
      var defaultEdgeLabelText = "" + edgeModel.get('value');
      var edgeLabelStateModels = getLabelStatesModels(edgeModel, 'edgeLabel');
      setLabelStyle(curve, edgeLabelStateModels, {
        labelFetcher: {
          getFormattedLabel: function (dataIndex, stateName, dataType, labelDimIndex, formatter, extendParams) {
            return seriesModel.getFormattedLabel(dataIndex, stateName, 'edge', labelDimIndex,
            // ensure edgeLabel formatter is provided
            // to prevent the inheritance from `label.formatter` of the series
            retrieve3(formatter, edgeLabelStateModels.normal && edgeLabelStateModels.normal.get('formatter'), defaultEdgeLabelText), extendParams);
          }
        },
        labelDataIndex: edge.dataIndex,
        defaultText: defaultEdgeLabelText
      });
      curve.setTextConfig({
        position: 'inside'
      });
      var emphasisModel = edgeModel.getModel('emphasis');
      setStatesStylesFromModel(curve, edgeModel, 'lineStyle', function (model) {
        var style = model.getItemStyle();
        applyCurveStyle(style, orient, edge);
        return style;
      });
      group.add(curve);
      edgeData.setItemGraphicEl(edge.dataIndex, curve);
      var focus = emphasisModel.get('focus');
      toggleHoverEmphasis(curve, focus === 'adjacency' ? edge.getAdjacentDataIndices() : focus === 'trajectory' ? edge.getTrajectoryDataIndices() : focus, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
    });
    // Generate a rect for each node
    graph.eachNode(function (node) {
      var layout = node.getLayout();
      var itemModel = node.getModel();
      var dragX = itemModel.get('localX');
      var dragY = itemModel.get('localY');
      var emphasisModel = itemModel.getModel('emphasis');
      var borderRadius = itemModel.get(['itemStyle', 'borderRadius']) || 0;
      var rect = new Rect$3({
        shape: {
          x: dragX != null ? dragX * width : layout.x,
          y: dragY != null ? dragY * height : layout.y,
          width: layout.dx,
          height: layout.dy,
          r: borderRadius
        },
        style: itemModel.getModel('itemStyle').getItemStyle(),
        z2: 10
      });
      setLabelStyle(rect, getLabelStatesModels(itemModel), {
        labelFetcher: {
          getFormattedLabel: function (dataIndex, stateName) {
            return seriesModel.getFormattedLabel(dataIndex, stateName, 'node');
          }
        },
        labelDataIndex: node.dataIndex,
        defaultText: node.id
      });
      rect.disableLabelAnimation = true;
      rect.setStyle('fill', node.getVisual('color'));
      rect.setStyle('decal', node.getVisual('style').decal);
      setStatesStylesFromModel(rect, itemModel);
      group.add(rect);
      nodeData.setItemGraphicEl(node.dataIndex, rect);
      getECData(rect).dataType = 'node';
      var focus = emphasisModel.get('focus');
      toggleHoverEmphasis(rect, focus === 'adjacency' ? node.getAdjacentDataIndices() : focus === 'trajectory' ? node.getTrajectoryDataIndices() : focus, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
    });
    nodeData.eachItemGraphicEl(function (el, dataIndex) {
      var itemModel = nodeData.getItemModel(dataIndex);
      if (itemModel.get('draggable')) {
        el.drift = function (dx, dy) {
          sankeyView._focusAdjacencyDisabled = true;
          this.shape.x += dx;
          this.shape.y += dy;
          this.dirty();
          api.dispatchAction({
            type: 'dragNode',
            seriesId: seriesModel.id,
            dataIndex: nodeData.getRawIndex(dataIndex),
            localX: this.shape.x / width,
            localY: this.shape.y / height
          });
        };
        el.ondragend = function () {
          sankeyView._focusAdjacencyDisabled = false;
        };
        el.draggable = true;
        el.cursor = 'move';
      }
    });
    if (!this._data && seriesModel.isAnimationEnabled()) {
      group.setClipPath(createGridClipShape$1(group.getBoundingRect(), seriesModel, function () {
        group.removeClipPath();
      }));
    }
    this._data = seriesModel.getData();
  };
  SankeyView.prototype.dispose = function () {};
  SankeyView.type = 'sankey';
  return SankeyView;
}(ChartView$1);
/**
 * Special color, use source node color or target node color
 * @param curveProps curve's style to parse
 * @param orient direction
 * @param edge current curve data
 */
function applyCurveStyle(curveProps, orient, edge) {
  switch (curveProps.fill) {
    case 'source':
      curveProps.fill = edge.node1.getVisual('color');
      curveProps.decal = edge.node1.getVisual('style').decal;
      break;
    case 'target':
      curveProps.fill = edge.node2.getVisual('color');
      curveProps.decal = edge.node2.getVisual('style').decal;
      break;
    case 'gradient':
      var sourceColor = edge.node1.getVisual('color');
      var targetColor = edge.node2.getVisual('color');
      if (isString(sourceColor) && isString(targetColor)) {
        curveProps.fill = new LinearGradient$1(0, 0, +(orient === 'horizontal'), +(orient === 'vertical'), [{
          color: sourceColor,
          offset: 0
        }, {
          color: targetColor,
          offset: 1
        }]);
      }
  }
}
// Add animation to the view
function createGridClipShape$1(rect, seriesModel, cb) {
  var rectEl = new Rect$3({
    shape: {
      x: rect.x - 10,
      y: rect.y - 10,
      width: 0,
      height: rect.height + 20
    }
  });
  initProps(rectEl, {
    shape: {
      width: rect.width + 20
    }
  }, seriesModel, cb);
  return rectEl;
}
var SankeyView$1 = SankeyView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SankeySeriesModel = /** @class */function (_super) {
  __extends(SankeySeriesModel, _super);
  function SankeySeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SankeySeriesModel.type;
    return _this;
  }
  /**
   * Init a graph data structure from data in option series
   */
  SankeySeriesModel.prototype.getInitialData = function (option, ecModel) {
    var links = option.edges || option.links || [];
    var nodes = option.data || option.nodes || [];
    var levels = option.levels || [];
    this.levelModels = [];
    var levelModels = this.levelModels;
    for (var i = 0; i < levels.length; i++) {
      if (levels[i].depth != null && levels[i].depth >= 0) {
        levelModels[levels[i].depth] = new Model$1(levels[i], this, ecModel);
      } else {
        {
          throw new Error('levels[i].depth is mandatory and should be natural number');
        }
      }
    }
    var graph = createGraphFromNodeEdge(nodes, links, this, true, beforeLink);
    return graph.data;
    function beforeLink(nodeData, edgeData) {
      nodeData.wrapMethod('getItemModel', function (model, idx) {
        var seriesModel = model.parentModel;
        var layout = seriesModel.getData().getItemLayout(idx);
        if (layout) {
          var nodeDepth = layout.depth;
          var levelModel = seriesModel.levelModels[nodeDepth];
          if (levelModel) {
            model.parentModel = levelModel;
          }
        }
        return model;
      });
      edgeData.wrapMethod('getItemModel', function (model, idx) {
        var seriesModel = model.parentModel;
        var edge = seriesModel.getGraph().getEdgeByIndex(idx);
        var layout = edge.node1.getLayout();
        if (layout) {
          var depth = layout.depth;
          var levelModel = seriesModel.levelModels[depth];
          if (levelModel) {
            model.parentModel = levelModel;
          }
        }
        return model;
      });
    }
  };
  SankeySeriesModel.prototype.setNodePosition = function (dataIndex, localPosition) {
    var nodes = this.option.data || this.option.nodes;
    var dataItem = nodes[dataIndex];
    dataItem.localX = localPosition[0];
    dataItem.localY = localPosition[1];
  };
  /**
   * Return the graphic data structure
   *
   * @return graphic data structure
   */
  SankeySeriesModel.prototype.getGraph = function () {
    return this.getData().graph;
  };
  /**
   * Get edge data of graphic data structure
   *
   * @return data structure of list
   */
  SankeySeriesModel.prototype.getEdgeData = function () {
    return this.getGraph().edgeData;
  };
  SankeySeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    function noValue(val) {
      return isNaN(val) || val == null;
    }
    // dataType === 'node' or empty do not show tooltip by default
    if (dataType === 'edge') {
      var params = this.getDataParams(dataIndex, dataType);
      var rawDataOpt = params.data;
      var edgeValue = params.value;
      var edgeName = rawDataOpt.source + ' -- ' + rawDataOpt.target;
      return createTooltipMarkup('nameValue', {
        name: edgeName,
        value: edgeValue,
        noValue: noValue(edgeValue)
      });
    }
    // dataType === 'node'
    else {
      var node = this.getGraph().getNodeByIndex(dataIndex);
      var value = node.getLayout().value;
      var name_1 = this.getDataParams(dataIndex, dataType).data.name;
      return createTooltipMarkup('nameValue', {
        name: name_1 != null ? name_1 + '' : null,
        value: value,
        noValue: noValue(value)
      });
    }
  };
  SankeySeriesModel.prototype.optionUpdated = function () {};
  // Override Series.getDataParams()
  SankeySeriesModel.prototype.getDataParams = function (dataIndex, dataType) {
    var params = _super.prototype.getDataParams.call(this, dataIndex, dataType);
    if (params.value == null && dataType === 'node') {
      var node = this.getGraph().getNodeByIndex(dataIndex);
      var nodeValue = node.getLayout().value;
      params.value = nodeValue;
    }
    return params;
  };
  SankeySeriesModel.type = 'series.sankey';
  SankeySeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    coordinateSystem: 'view',
    left: '5%',
    top: '5%',
    right: '20%',
    bottom: '5%',
    orient: 'horizontal',
    nodeWidth: 20,
    nodeGap: 8,
    draggable: true,
    layoutIterations: 32,
    label: {
      show: true,
      position: 'right',
      fontSize: 12
    },
    edgeLabel: {
      show: false,
      fontSize: 12
    },
    levels: [],
    nodeAlign: 'justify',
    lineStyle: {
      color: '#314656',
      opacity: 0.2,
      curveness: 0.5
    },
    emphasis: {
      label: {
        show: true
      },
      lineStyle: {
        opacity: 0.5
      }
    },
    select: {
      itemStyle: {
        borderColor: '#212121'
      }
    },
    animationEasing: 'linear',
    animationDuration: 1000
  };
  return SankeySeriesModel;
}(SeriesModel$1);
var SankeySeriesModel$1 = SankeySeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function sankeyLayout(ecModel, api) {
  ecModel.eachSeriesByType('sankey', function (seriesModel) {
    var nodeWidth = seriesModel.get('nodeWidth');
    var nodeGap = seriesModel.get('nodeGap');
    var layoutInfo = getViewRect$1(seriesModel, api);
    seriesModel.layoutInfo = layoutInfo;
    var width = layoutInfo.width;
    var height = layoutInfo.height;
    var graph = seriesModel.getGraph();
    var nodes = graph.nodes;
    var edges = graph.edges;
    computeNodeValues(nodes);
    var filteredNodes = filter(nodes, function (node) {
      return node.getLayout().value === 0;
    });
    var iterations = filteredNodes.length !== 0 ? 0 : seriesModel.get('layoutIterations');
    var orient = seriesModel.get('orient');
    var nodeAlign = seriesModel.get('nodeAlign');
    layoutSankey(nodes, edges, nodeWidth, nodeGap, width, height, iterations, orient, nodeAlign);
  });
}
/**
 * Get the layout position of the whole view
 */
function getViewRect$1(seriesModel, api) {
  return getLayoutRect(seriesModel.getBoxLayoutParams(), {
    width: api.getWidth(),
    height: api.getHeight()
  });
}
function layoutSankey(nodes, edges, nodeWidth, nodeGap, width, height, iterations, orient, nodeAlign) {
  computeNodeBreadths(nodes, edges, nodeWidth, width, height, orient, nodeAlign);
  computeNodeDepths(nodes, edges, height, width, nodeGap, iterations, orient);
  computeEdgeDepths(nodes, orient);
}
/**
 * Compute the value of each node by summing the associated edge's value
 */
function computeNodeValues(nodes) {
  each$f(nodes, function (node) {
    var value1 = sum(node.outEdges, getEdgeValue);
    var value2 = sum(node.inEdges, getEdgeValue);
    var nodeRawValue = node.getValue() || 0;
    var value = Math.max(value1, value2, nodeRawValue);
    node.setLayout({
      value: value
    }, true);
  });
}
/**
 * Compute the x-position for each node.
 *
 * Here we use Kahn algorithm to detect cycle when we traverse
 * the node to computer the initial x position.
 */
function computeNodeBreadths(nodes, edges, nodeWidth, width, height, orient, nodeAlign) {
  // Used to mark whether the edge is deleted. if it is deleted,
  // the value is 0, otherwise it is 1.
  var remainEdges = [];
  // Storage each node's indegree.
  var indegreeArr = [];
  // Used to storage the node with indegree is equal to 0.
  var zeroIndegrees = [];
  var nextTargetNode = [];
  var x = 0;
  // let kx = 0;
  for (var i = 0; i < edges.length; i++) {
    remainEdges[i] = 1;
  }
  for (var i = 0; i < nodes.length; i++) {
    indegreeArr[i] = nodes[i].inEdges.length;
    if (indegreeArr[i] === 0) {
      zeroIndegrees.push(nodes[i]);
    }
  }
  var maxNodeDepth = -1;
  // Traversing nodes using topological sorting to calculate the
  // horizontal(if orient === 'horizontal') or vertical(if orient === 'vertical')
  // position of the nodes.
  while (zeroIndegrees.length) {
    for (var idx = 0; idx < zeroIndegrees.length; idx++) {
      var node = zeroIndegrees[idx];
      var item = node.hostGraph.data.getRawDataItem(node.dataIndex);
      var isItemDepth = item.depth != null && item.depth >= 0;
      if (isItemDepth && item.depth > maxNodeDepth) {
        maxNodeDepth = item.depth;
      }
      node.setLayout({
        depth: isItemDepth ? item.depth : x
      }, true);
      orient === 'vertical' ? node.setLayout({
        dy: nodeWidth
      }, true) : node.setLayout({
        dx: nodeWidth
      }, true);
      for (var edgeIdx = 0; edgeIdx < node.outEdges.length; edgeIdx++) {
        var edge = node.outEdges[edgeIdx];
        var indexEdge = edges.indexOf(edge);
        remainEdges[indexEdge] = 0;
        var targetNode = edge.node2;
        var nodeIndex = nodes.indexOf(targetNode);
        if (--indegreeArr[nodeIndex] === 0 && nextTargetNode.indexOf(targetNode) < 0) {
          nextTargetNode.push(targetNode);
        }
      }
    }
    ++x;
    zeroIndegrees = nextTargetNode;
    nextTargetNode = [];
  }
  for (var i = 0; i < remainEdges.length; i++) {
    if (remainEdges[i] === 1) {
      throw new Error('Sankey is a DAG, the original data has cycle!');
    }
  }
  var maxDepth = maxNodeDepth > x - 1 ? maxNodeDepth : x - 1;
  if (nodeAlign && nodeAlign !== 'left') {
    adjustNodeWithNodeAlign(nodes, nodeAlign, orient, maxDepth);
  }
  var kx = orient === 'vertical' ? (height - nodeWidth) / maxDepth : (width - nodeWidth) / maxDepth;
  scaleNodeBreadths(nodes, kx, orient);
}
function isNodeDepth(node) {
  var item = node.hostGraph.data.getRawDataItem(node.dataIndex);
  return item.depth != null && item.depth >= 0;
}
function adjustNodeWithNodeAlign(nodes, nodeAlign, orient, maxDepth) {
  if (nodeAlign === 'right') {
    var nextSourceNode = [];
    var remainNodes = nodes;
    var nodeHeight = 0;
    while (remainNodes.length) {
      for (var i = 0; i < remainNodes.length; i++) {
        var node = remainNodes[i];
        node.setLayout({
          skNodeHeight: nodeHeight
        }, true);
        for (var j = 0; j < node.inEdges.length; j++) {
          var edge = node.inEdges[j];
          if (nextSourceNode.indexOf(edge.node1) < 0) {
            nextSourceNode.push(edge.node1);
          }
        }
      }
      remainNodes = nextSourceNode;
      nextSourceNode = [];
      ++nodeHeight;
    }
    each$f(nodes, function (node) {
      if (!isNodeDepth(node)) {
        node.setLayout({
          depth: Math.max(0, maxDepth - node.getLayout().skNodeHeight)
        }, true);
      }
    });
  } else if (nodeAlign === 'justify') {
    moveSinksRight(nodes, maxDepth);
  }
}
/**
 * All the node without outEgdes are assigned maximum x-position and
 *     be aligned in the last column.
 *
 * @param nodes.  node of sankey view.
 * @param maxDepth.  use to assign to node without outEdges as x-position.
 */
function moveSinksRight(nodes, maxDepth) {
  each$f(nodes, function (node) {
    if (!isNodeDepth(node) && !node.outEdges.length) {
      node.setLayout({
        depth: maxDepth
      }, true);
    }
  });
}
/**
 * Scale node x-position to the width
 *
 * @param nodes  node of sankey view
 * @param kx   multiple used to scale nodes
 */
function scaleNodeBreadths(nodes, kx, orient) {
  each$f(nodes, function (node) {
    var nodeDepth = node.getLayout().depth * kx;
    orient === 'vertical' ? node.setLayout({
      y: nodeDepth
    }, true) : node.setLayout({
      x: nodeDepth
    }, true);
  });
}
/**
 * Using Gauss-Seidel iterations method to compute the node depth(y-position)
 *
 * @param nodes  node of sankey view
 * @param edges  edge of sankey view
 * @param height  the whole height of the area to draw the view
 * @param nodeGap  the vertical distance between two nodes
 *     in the same column.
 * @param iterations  the number of iterations for the algorithm
 */
function computeNodeDepths(nodes, edges, height, width, nodeGap, iterations, orient) {
  var nodesByBreadth = prepareNodesByBreadth(nodes, orient);
  initializeNodeDepth(nodesByBreadth, edges, height, width, nodeGap, orient);
  resolveCollisions(nodesByBreadth, nodeGap, height, width, orient);
  for (var alpha = 1; iterations > 0; iterations--) {
    // 0.99 is a experience parameter, ensure that each iterations of
    // changes as small as possible.
    alpha *= 0.99;
    relaxRightToLeft(nodesByBreadth, alpha, orient);
    resolveCollisions(nodesByBreadth, nodeGap, height, width, orient);
    relaxLeftToRight(nodesByBreadth, alpha, orient);
    resolveCollisions(nodesByBreadth, nodeGap, height, width, orient);
  }
}
function prepareNodesByBreadth(nodes, orient) {
  var nodesByBreadth = [];
  var keyAttr = orient === 'vertical' ? 'y' : 'x';
  var groupResult = groupData(nodes, function (node) {
    return node.getLayout()[keyAttr];
  });
  groupResult.keys.sort(function (a, b) {
    return a - b;
  });
  each$f(groupResult.keys, function (key) {
    nodesByBreadth.push(groupResult.buckets.get(key));
  });
  return nodesByBreadth;
}
/**
 * Compute the original y-position for each node
 */
function initializeNodeDepth(nodesByBreadth, edges, height, width, nodeGap, orient) {
  var minKy = Infinity;
  each$f(nodesByBreadth, function (nodes) {
    var n = nodes.length;
    var sum = 0;
    each$f(nodes, function (node) {
      sum += node.getLayout().value;
    });
    var ky = orient === 'vertical' ? (width - (n - 1) * nodeGap) / sum : (height - (n - 1) * nodeGap) / sum;
    if (ky < minKy) {
      minKy = ky;
    }
  });
  each$f(nodesByBreadth, function (nodes) {
    each$f(nodes, function (node, i) {
      var nodeDy = node.getLayout().value * minKy;
      if (orient === 'vertical') {
        node.setLayout({
          x: i
        }, true);
        node.setLayout({
          dx: nodeDy
        }, true);
      } else {
        node.setLayout({
          y: i
        }, true);
        node.setLayout({
          dy: nodeDy
        }, true);
      }
    });
  });
  each$f(edges, function (edge) {
    var edgeDy = +edge.getValue() * minKy;
    edge.setLayout({
      dy: edgeDy
    }, true);
  });
}
/**
 * Resolve the collision of initialized depth (y-position)
 */
function resolveCollisions(nodesByBreadth, nodeGap, height, width, orient) {
  var keyAttr = orient === 'vertical' ? 'x' : 'y';
  each$f(nodesByBreadth, function (nodes) {
    nodes.sort(function (a, b) {
      return a.getLayout()[keyAttr] - b.getLayout()[keyAttr];
    });
    var nodeX;
    var node;
    var dy;
    var y0 = 0;
    var n = nodes.length;
    var nodeDyAttr = orient === 'vertical' ? 'dx' : 'dy';
    for (var i = 0; i < n; i++) {
      node = nodes[i];
      dy = y0 - node.getLayout()[keyAttr];
      if (dy > 0) {
        nodeX = node.getLayout()[keyAttr] + dy;
        orient === 'vertical' ? node.setLayout({
          x: nodeX
        }, true) : node.setLayout({
          y: nodeX
        }, true);
      }
      y0 = node.getLayout()[keyAttr] + node.getLayout()[nodeDyAttr] + nodeGap;
    }
    var viewWidth = orient === 'vertical' ? width : height;
    // If the bottommost node goes outside the bounds, push it back up
    dy = y0 - nodeGap - viewWidth;
    if (dy > 0) {
      nodeX = node.getLayout()[keyAttr] - dy;
      orient === 'vertical' ? node.setLayout({
        x: nodeX
      }, true) : node.setLayout({
        y: nodeX
      }, true);
      y0 = nodeX;
      for (var i = n - 2; i >= 0; --i) {
        node = nodes[i];
        dy = node.getLayout()[keyAttr] + node.getLayout()[nodeDyAttr] + nodeGap - y0;
        if (dy > 0) {
          nodeX = node.getLayout()[keyAttr] - dy;
          orient === 'vertical' ? node.setLayout({
            x: nodeX
          }, true) : node.setLayout({
            y: nodeX
          }, true);
        }
        y0 = node.getLayout()[keyAttr];
      }
    }
  });
}
/**
 * Change the y-position of the nodes, except most the right side nodes
 * @param nodesByBreadth
 * @param alpha  parameter used to adjust the nodes y-position
 */
function relaxRightToLeft(nodesByBreadth, alpha, orient) {
  each$f(nodesByBreadth.slice().reverse(), function (nodes) {
    each$f(nodes, function (node) {
      if (node.outEdges.length) {
        var y = sum(node.outEdges, weightedTarget, orient) / sum(node.outEdges, getEdgeValue);
        if (isNaN(y)) {
          var len = node.outEdges.length;
          y = len ? sum(node.outEdges, centerTarget, orient) / len : 0;
        }
        if (orient === 'vertical') {
          var nodeX = node.getLayout().x + (y - center(node, orient)) * alpha;
          node.setLayout({
            x: nodeX
          }, true);
        } else {
          var nodeY = node.getLayout().y + (y - center(node, orient)) * alpha;
          node.setLayout({
            y: nodeY
          }, true);
        }
      }
    });
  });
}
function weightedTarget(edge, orient) {
  return center(edge.node2, orient) * edge.getValue();
}
function centerTarget(edge, orient) {
  return center(edge.node2, orient);
}
function weightedSource(edge, orient) {
  return center(edge.node1, orient) * edge.getValue();
}
function centerSource(edge, orient) {
  return center(edge.node1, orient);
}
function center(node, orient) {
  return orient === 'vertical' ? node.getLayout().x + node.getLayout().dx / 2 : node.getLayout().y + node.getLayout().dy / 2;
}
function getEdgeValue(edge) {
  return edge.getValue();
}
function sum(array, cb, orient) {
  var sum = 0;
  var len = array.length;
  var i = -1;
  while (++i < len) {
    var value = +cb(array[i], orient);
    if (!isNaN(value)) {
      sum += value;
    }
  }
  return sum;
}
/**
 * Change the y-position of the nodes, except most the left side nodes
 */
function relaxLeftToRight(nodesByBreadth, alpha, orient) {
  each$f(nodesByBreadth, function (nodes) {
    each$f(nodes, function (node) {
      if (node.inEdges.length) {
        var y = sum(node.inEdges, weightedSource, orient) / sum(node.inEdges, getEdgeValue);
        if (isNaN(y)) {
          var len = node.inEdges.length;
          y = len ? sum(node.inEdges, centerSource, orient) / len : 0;
        }
        if (orient === 'vertical') {
          var nodeX = node.getLayout().x + (y - center(node, orient)) * alpha;
          node.setLayout({
            x: nodeX
          }, true);
        } else {
          var nodeY = node.getLayout().y + (y - center(node, orient)) * alpha;
          node.setLayout({
            y: nodeY
          }, true);
        }
      }
    });
  });
}
/**
 * Compute the depth(y-position) of each edge
 */
function computeEdgeDepths(nodes, orient) {
  var keyAttr = orient === 'vertical' ? 'x' : 'y';
  each$f(nodes, function (node) {
    node.outEdges.sort(function (a, b) {
      return a.node2.getLayout()[keyAttr] - b.node2.getLayout()[keyAttr];
    });
    node.inEdges.sort(function (a, b) {
      return a.node1.getLayout()[keyAttr] - b.node1.getLayout()[keyAttr];
    });
  });
  each$f(nodes, function (node) {
    var sy = 0;
    var ty = 0;
    each$f(node.outEdges, function (edge) {
      edge.setLayout({
        sy: sy
      }, true);
      sy += edge.getLayout().dy;
    });
    each$f(node.inEdges, function (edge) {
      edge.setLayout({
        ty: ty
      }, true);
      ty += edge.getLayout().dy;
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function sankeyVisual(ecModel) {
  ecModel.eachSeriesByType('sankey', function (seriesModel) {
    var graph = seriesModel.getGraph();
    var nodes = graph.nodes;
    var edges = graph.edges;
    if (nodes.length) {
      var minValue_1 = Infinity;
      var maxValue_1 = -Infinity;
      each$f(nodes, function (node) {
        var nodeValue = node.getLayout().value;
        if (nodeValue < minValue_1) {
          minValue_1 = nodeValue;
        }
        if (nodeValue > maxValue_1) {
          maxValue_1 = nodeValue;
        }
      });
      each$f(nodes, function (node) {
        var mapping = new VisualMapping$1({
          type: 'color',
          mappingMethod: 'linear',
          dataExtent: [minValue_1, maxValue_1],
          visual: seriesModel.get('color')
        });
        var mapValueToColor = mapping.mapValueToVisual(node.getLayout().value);
        var customColor = node.getModel().get(['itemStyle', 'color']);
        if (customColor != null) {
          node.setVisual('color', customColor);
          node.setVisual('style', {
            fill: customColor
          });
        } else {
          node.setVisual('color', mapValueToColor);
          node.setVisual('style', {
            fill: mapValueToColor
          });
        }
      });
    }
    if (edges.length) {
      each$f(edges, function (edge) {
        var edgeStyle = edge.getModel().get('lineStyle');
        edge.setVisual('style', edgeStyle);
      });
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$C(registers) {
  registers.registerChartView(SankeyView$1);
  registers.registerSeriesModel(SankeySeriesModel$1);
  registers.registerLayout(sankeyLayout);
  registers.registerVisual(sankeyVisual);
  registers.registerAction({
    type: 'dragNode',
    event: 'dragnode',
    // here can only use 'update' now, other value is not support in echarts.
    update: 'update'
  }, function (payload, ecModel) {
    ecModel.eachComponent({
      mainType: 'series',
      subType: 'sankey',
      query: payload
    }, function (seriesModel) {
      seriesModel.setNodePosition(payload.dataIndex, [payload.localX, payload.localY]);
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var WhiskerBoxCommonMixin = /** @class */function () {
  function WhiskerBoxCommonMixin() {}
  /**
   * @private
   */
  WhiskerBoxCommonMixin.prototype._hasEncodeRule = function (key) {
    var encodeRules = this.getEncode();
    return encodeRules && encodeRules.get(key) != null;
  };
  /**
   * @override
   */
  WhiskerBoxCommonMixin.prototype.getInitialData = function (option, ecModel) {
    // When both types of xAxis and yAxis are 'value', layout is
    // needed to be specified by user. Otherwise, layout can be
    // judged by which axis is category.
    var ordinalMeta;
    var xAxisModel = ecModel.getComponent('xAxis', this.get('xAxisIndex'));
    var yAxisModel = ecModel.getComponent('yAxis', this.get('yAxisIndex'));
    var xAxisType = xAxisModel.get('type');
    var yAxisType = yAxisModel.get('type');
    var addOrdinal;
    // FIXME
    // Consider time axis.
    if (xAxisType === 'category') {
      option.layout = 'horizontal';
      ordinalMeta = xAxisModel.getOrdinalMeta();
      addOrdinal = !this._hasEncodeRule('x');
    } else if (yAxisType === 'category') {
      option.layout = 'vertical';
      ordinalMeta = yAxisModel.getOrdinalMeta();
      addOrdinal = !this._hasEncodeRule('y');
    } else {
      option.layout = option.layout || 'horizontal';
    }
    var coordDims = ['x', 'y'];
    var baseAxisDimIndex = option.layout === 'horizontal' ? 0 : 1;
    var baseAxisDim = this._baseAxisDim = coordDims[baseAxisDimIndex];
    var otherAxisDim = coordDims[1 - baseAxisDimIndex];
    var axisModels = [xAxisModel, yAxisModel];
    var baseAxisType = axisModels[baseAxisDimIndex].get('type');
    var otherAxisType = axisModels[1 - baseAxisDimIndex].get('type');
    var data = option.data;
    // Clone a new data for next setOption({}) usage.
    // Avoid modifying current data will affect further update.
    if (data && addOrdinal) {
      var newOptionData_1 = [];
      each$f(data, function (item, index) {
        var newItem;
        if (isArray$1(item)) {
          newItem = item.slice();
          // Modify current using data.
          item.unshift(index);
        } else if (isArray$1(item.value)) {
          newItem = extend({}, item);
          newItem.value = newItem.value.slice();
          // Modify current using data.
          item.value.unshift(index);
        } else {
          newItem = item;
        }
        newOptionData_1.push(newItem);
      });
      option.data = newOptionData_1;
    }
    var defaultValueDimensions = this.defaultValueDimensions;
    var coordDimensions = [{
      name: baseAxisDim,
      type: getDimensionTypeByAxis(baseAxisType),
      ordinalMeta: ordinalMeta,
      otherDims: {
        tooltip: false,
        itemName: 0
      },
      dimsDef: ['base']
    }, {
      name: otherAxisDim,
      type: getDimensionTypeByAxis(otherAxisType),
      dimsDef: defaultValueDimensions.slice()
    }];
    return createSeriesDataSimply(this, {
      coordDimensions: coordDimensions,
      dimensionsCount: defaultValueDimensions.length + 1,
      encodeDefaulter: curry$1(makeSeriesEncodeForAxisCoordSys, coordDimensions, this)
    });
  };
  /**
   * If horizontal, base axis is x, otherwise y.
   * @override
   */
  WhiskerBoxCommonMixin.prototype.getBaseAxis = function () {
    var dim = this._baseAxisDim;
    return this.ecModel.getComponent(dim + 'Axis', this.get(dim + 'AxisIndex')).axis;
  };
  return WhiskerBoxCommonMixin;
}();

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var BoxplotSeriesModel = /** @class */function (_super) {
  __extends(BoxplotSeriesModel, _super);
  function BoxplotSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = BoxplotSeriesModel.type;
    // TODO
    // box width represents group size, so dimension should have 'size'.
    /**
     * @see <https://en.wikipedia.org/wiki/Box_plot>
     * The meanings of 'min' and 'max' depend on user,
     * and echarts do not need to know it.
     * @readOnly
     */
    _this.defaultValueDimensions = [{
      name: 'min',
      defaultTooltip: true
    }, {
      name: 'Q1',
      defaultTooltip: true
    }, {
      name: 'median',
      defaultTooltip: true
    }, {
      name: 'Q3',
      defaultTooltip: true
    }, {
      name: 'max',
      defaultTooltip: true
    }];
    _this.visualDrawType = 'stroke';
    return _this;
  }
  BoxplotSeriesModel.type = 'series.boxplot';
  BoxplotSeriesModel.dependencies = ['xAxis', 'yAxis', 'grid'];
  BoxplotSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    coordinateSystem: 'cartesian2d',
    legendHoverLink: true,
    layout: null,
    boxWidth: [7, 50],
    itemStyle: {
      color: '#fff',
      borderWidth: 1
    },
    emphasis: {
      scale: true,
      itemStyle: {
        borderWidth: 2,
        shadowBlur: 5,
        shadowOffsetX: 1,
        shadowOffsetY: 1,
        shadowColor: 'rgba(0,0,0,0.2)'
      }
    },
    animationDuration: 800
  };
  return BoxplotSeriesModel;
}(SeriesModel$1);
mixin(BoxplotSeriesModel, WhiskerBoxCommonMixin, true);
var BoxplotSeriesModel$1 = BoxplotSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var BoxplotView = /** @class */function (_super) {
  __extends(BoxplotView, _super);
  function BoxplotView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = BoxplotView.type;
    return _this;
  }
  BoxplotView.prototype.render = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var group = this.group;
    var oldData = this._data;
    // There is no old data only when first rendering or switching from
    // stream mode to normal mode, where previous elements should be removed.
    if (!this._data) {
      group.removeAll();
    }
    var constDim = seriesModel.get('layout') === 'horizontal' ? 1 : 0;
    data.diff(oldData).add(function (newIdx) {
      if (data.hasValue(newIdx)) {
        var itemLayout = data.getItemLayout(newIdx);
        var symbolEl = createNormalBox$1(itemLayout, data, newIdx, constDim, true);
        data.setItemGraphicEl(newIdx, symbolEl);
        group.add(symbolEl);
      }
    }).update(function (newIdx, oldIdx) {
      var symbolEl = oldData.getItemGraphicEl(oldIdx);
      // Empty data
      if (!data.hasValue(newIdx)) {
        group.remove(symbolEl);
        return;
      }
      var itemLayout = data.getItemLayout(newIdx);
      if (!symbolEl) {
        symbolEl = createNormalBox$1(itemLayout, data, newIdx, constDim);
      } else {
        saveOldStyle(symbolEl);
        updateNormalBoxData(itemLayout, symbolEl, data, newIdx);
      }
      group.add(symbolEl);
      data.setItemGraphicEl(newIdx, symbolEl);
    }).remove(function (oldIdx) {
      var el = oldData.getItemGraphicEl(oldIdx);
      el && group.remove(el);
    }).execute();
    this._data = data;
  };
  BoxplotView.prototype.remove = function (ecModel) {
    var group = this.group;
    var data = this._data;
    this._data = null;
    data && data.eachItemGraphicEl(function (el) {
      el && group.remove(el);
    });
  };
  BoxplotView.type = 'boxplot';
  return BoxplotView;
}(ChartView$1);
var BoxPathShape = /** @class */function () {
  function BoxPathShape() {}
  return BoxPathShape;
}();
var BoxPath = /** @class */function (_super) {
  __extends(BoxPath, _super);
  function BoxPath(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'boxplotBoxPath';
    return _this;
  }
  BoxPath.prototype.getDefaultShape = function () {
    return new BoxPathShape();
  };
  BoxPath.prototype.buildPath = function (ctx, shape) {
    var ends = shape.points;
    var i = 0;
    ctx.moveTo(ends[i][0], ends[i][1]);
    i++;
    for (; i < 4; i++) {
      ctx.lineTo(ends[i][0], ends[i][1]);
    }
    ctx.closePath();
    for (; i < ends.length; i++) {
      ctx.moveTo(ends[i][0], ends[i][1]);
      i++;
      ctx.lineTo(ends[i][0], ends[i][1]);
    }
  };
  return BoxPath;
}(Path$1);
function createNormalBox$1(itemLayout, data, dataIndex, constDim, isInit) {
  var ends = itemLayout.ends;
  var el = new BoxPath({
    shape: {
      points: isInit ? transInit$1(ends, constDim, itemLayout) : ends
    }
  });
  updateNormalBoxData(itemLayout, el, data, dataIndex, isInit);
  return el;
}
function updateNormalBoxData(itemLayout, el, data, dataIndex, isInit) {
  var seriesModel = data.hostModel;
  var updateMethod = graphic[isInit ? 'initProps' : 'updateProps'];
  updateMethod(el, {
    shape: {
      points: itemLayout.ends
    }
  }, seriesModel, dataIndex);
  el.useStyle(data.getItemVisual(dataIndex, 'style'));
  el.style.strokeNoScale = true;
  el.z2 = 100;
  var itemModel = data.getItemModel(dataIndex);
  var emphasisModel = itemModel.getModel('emphasis');
  setStatesStylesFromModel(el, itemModel);
  toggleHoverEmphasis(el, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
}
function transInit$1(points, dim, itemLayout) {
  return map$1(points, function (point) {
    point = point.slice();
    point[dim] = itemLayout.initBaseline;
    return point;
  });
}
var BoxplotView$1 = BoxplotView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each$9 = each$f;
function boxplotLayout(ecModel) {
  var groupResult = groupSeriesByAxis(ecModel);
  each$9(groupResult, function (groupItem) {
    var seriesModels = groupItem.seriesModels;
    if (!seriesModels.length) {
      return;
    }
    calculateBase(groupItem);
    each$9(seriesModels, function (seriesModel, idx) {
      layoutSingleSeries(seriesModel, groupItem.boxOffsetList[idx], groupItem.boxWidthList[idx]);
    });
  });
}
/**
 * Group series by axis.
 */
function groupSeriesByAxis(ecModel) {
  var result = [];
  var axisList = [];
  ecModel.eachSeriesByType('boxplot', function (seriesModel) {
    var baseAxis = seriesModel.getBaseAxis();
    var idx = indexOf(axisList, baseAxis);
    if (idx < 0) {
      idx = axisList.length;
      axisList[idx] = baseAxis;
      result[idx] = {
        axis: baseAxis,
        seriesModels: []
      };
    }
    result[idx].seriesModels.push(seriesModel);
  });
  return result;
}
/**
 * Calculate offset and box width for each series.
 */
function calculateBase(groupItem) {
  var baseAxis = groupItem.axis;
  var seriesModels = groupItem.seriesModels;
  var seriesCount = seriesModels.length;
  var boxWidthList = groupItem.boxWidthList = [];
  var boxOffsetList = groupItem.boxOffsetList = [];
  var boundList = [];
  var bandWidth;
  if (baseAxis.type === 'category') {
    bandWidth = baseAxis.getBandWidth();
  } else {
    var maxDataCount_1 = 0;
    each$9(seriesModels, function (seriesModel) {
      maxDataCount_1 = Math.max(maxDataCount_1, seriesModel.getData().count());
    });
    var extent = baseAxis.getExtent();
    bandWidth = Math.abs(extent[1] - extent[0]) / maxDataCount_1;
  }
  each$9(seriesModels, function (seriesModel) {
    var boxWidthBound = seriesModel.get('boxWidth');
    if (!isArray$1(boxWidthBound)) {
      boxWidthBound = [boxWidthBound, boxWidthBound];
    }
    boundList.push([parsePercent(boxWidthBound[0], bandWidth) || 0, parsePercent(boxWidthBound[1], bandWidth) || 0]);
  });
  var availableWidth = bandWidth * 0.8 - 2;
  var boxGap = availableWidth / seriesCount * 0.3;
  var boxWidth = (availableWidth - boxGap * (seriesCount - 1)) / seriesCount;
  var base = boxWidth / 2 - availableWidth / 2;
  each$9(seriesModels, function (seriesModel, idx) {
    boxOffsetList.push(base);
    base += boxGap + boxWidth;
    boxWidthList.push(Math.min(Math.max(boxWidth, boundList[idx][0]), boundList[idx][1]));
  });
}
/**
 * Calculate points location for each series.
 */
function layoutSingleSeries(seriesModel, offset, boxWidth) {
  var coordSys = seriesModel.coordinateSystem;
  var data = seriesModel.getData();
  var halfWidth = boxWidth / 2;
  var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;
  var vDimIdx = 1 - cDimIdx;
  var coordDims = ['x', 'y'];
  var cDim = data.mapDimension(coordDims[cDimIdx]);
  var vDims = data.mapDimensionsAll(coordDims[vDimIdx]);
  if (cDim == null || vDims.length < 5) {
    return;
  }
  for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {
    var axisDimVal = data.get(cDim, dataIndex);
    var median = getPoint(axisDimVal, vDims[2], dataIndex);
    var end1 = getPoint(axisDimVal, vDims[0], dataIndex);
    var end2 = getPoint(axisDimVal, vDims[1], dataIndex);
    var end4 = getPoint(axisDimVal, vDims[3], dataIndex);
    var end5 = getPoint(axisDimVal, vDims[4], dataIndex);
    var ends = [];
    addBodyEnd(ends, end2, false);
    addBodyEnd(ends, end4, true);
    ends.push(end1, end2, end5, end4);
    layEndLine(ends, end1);
    layEndLine(ends, end5);
    layEndLine(ends, median);
    data.setItemLayout(dataIndex, {
      initBaseline: median[vDimIdx],
      ends: ends
    });
  }
  function getPoint(axisDimVal, dim, dataIndex) {
    var val = data.get(dim, dataIndex);
    var p = [];
    p[cDimIdx] = axisDimVal;
    p[vDimIdx] = val;
    var point;
    if (isNaN(axisDimVal) || isNaN(val)) {
      point = [NaN, NaN];
    } else {
      point = coordSys.dataToPoint(p);
      point[cDimIdx] += offset;
    }
    return point;
  }
  function addBodyEnd(ends, point, start) {
    var point1 = point.slice();
    var point2 = point.slice();
    point1[cDimIdx] += halfWidth;
    point2[cDimIdx] -= halfWidth;
    start ? ends.push(point1, point2) : ends.push(point2, point1);
  }
  function layEndLine(ends, endCenter) {
    var from = endCenter.slice();
    var to = endCenter.slice();
    from[cDimIdx] -= halfWidth;
    to[cDimIdx] += halfWidth;
    ends.push(from, to);
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * See:
 *  <https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2>
 *  <http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html>
 *
 * Helper method for preparing data.
 *
 * @param rawData like
 *        [
 *            [12,232,443], (raw data set for the first box)
 *            [3843,5545,1232], (raw data set for the second box)
 *            ...
 *        ]
 * @param opt.boundIQR=1.5 Data less than min bound is outlier.
 *      default 1.5, means Q1 - 1.5 * (Q3 - Q1).
 *      If 'none'/0 passed, min bound will not be used.
 */
function prepareBoxplotData(rawData, opt) {
  opt = opt || {};
  var boxData = [];
  var outliers = [];
  var boundIQR = opt.boundIQR;
  var useExtreme = boundIQR === 'none' || boundIQR === 0;
  for (var i = 0; i < rawData.length; i++) {
    var ascList = asc$2(rawData[i].slice());
    var Q1 = quantile(ascList, 0.25);
    var Q2 = quantile(ascList, 0.5);
    var Q3 = quantile(ascList, 0.75);
    var min = ascList[0];
    var max = ascList[ascList.length - 1];
    var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);
    var low = useExtreme ? min : Math.max(min, Q1 - bound);
    var high = useExtreme ? max : Math.min(max, Q3 + bound);
    var itemNameFormatter = opt.itemNameFormatter;
    var itemName = isFunction(itemNameFormatter) ? itemNameFormatter({
      value: i
    }) : isString(itemNameFormatter) ? itemNameFormatter.replace('{value}', i + '') : i + '';
    boxData.push([itemName, low, Q1, Q2, Q3, high]);
    for (var j = 0; j < ascList.length; j++) {
      var dataItem = ascList[j];
      if (dataItem < low || dataItem > high) {
        var outlier = [itemName, dataItem];
        outliers.push(outlier);
      }
    }
  }
  return {
    boxData: boxData,
    outliers: outliers
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var boxplotTransform = {
  type: 'echarts:boxplot',
  transform: function transform(params) {
    var upstream = params.upstream;
    if (upstream.sourceFormat !== SOURCE_FORMAT_ARRAY_ROWS) {
      var errMsg = '';
      {
        errMsg = makePrintable('source data is not applicable for this boxplot transform. Expect number[][].');
      }
      throwError(errMsg);
    }
    var result = prepareBoxplotData(upstream.getRawData(), params.config);
    return [{
      dimensions: ['ItemName', 'Low', 'Q1', 'Q2', 'Q3', 'High'],
      data: result.boxData
    }, {
      data: result.outliers
    }];
  }
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$B(registers) {
  registers.registerSeriesModel(BoxplotSeriesModel$1);
  registers.registerChartView(BoxplotView$1);
  registers.registerLayout(boxplotLayout);
  registers.registerTransform(boxplotTransform);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var positiveBorderColorQuery = ['itemStyle', 'borderColor'];
var negativeBorderColorQuery = ['itemStyle', 'borderColor0'];
var dojiBorderColorQuery = ['itemStyle', 'borderColorDoji'];
var positiveColorQuery = ['itemStyle', 'color'];
var negativeColorQuery = ['itemStyle', 'color0'];
function getColor(sign, model) {
  return model.get(sign > 0 ? positiveColorQuery : negativeColorQuery);
}
function getBorderColor(sign, model) {
  return model.get(sign === 0 ? dojiBorderColorQuery : sign > 0 ? positiveBorderColorQuery : negativeBorderColorQuery);
}
var candlestickVisual = {
  seriesType: 'candlestick',
  plan: createRenderPlanner(),
  // For legend.
  performRawSeries: true,
  reset: function (seriesModel, ecModel) {
    // Only visible series has each data be visual encoded
    if (ecModel.isSeriesFiltered(seriesModel)) {
      return;
    }
    var isLargeRender = seriesModel.pipelineContext.large;
    return !isLargeRender && {
      progress: function (params, data) {
        var dataIndex;
        while ((dataIndex = params.next()) != null) {
          var itemModel = data.getItemModel(dataIndex);
          var sign = data.getItemLayout(dataIndex).sign;
          var style = itemModel.getItemStyle();
          style.fill = getColor(sign, itemModel);
          style.stroke = getBorderColor(sign, itemModel) || style.fill;
          var existsStyle = data.ensureUniqueItemVisual(dataIndex, 'style');
          extend(existsStyle, style);
        }
      }
    };
  }
};
var candlestickVisual$1 = candlestickVisual;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SKIP_PROPS = ['color', 'borderColor'];
var CandlestickView = /** @class */function (_super) {
  __extends(CandlestickView, _super);
  function CandlestickView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = CandlestickView.type;
    return _this;
  }
  CandlestickView.prototype.render = function (seriesModel, ecModel, api) {
    // If there is clipPath created in large mode. Remove it.
    this.group.removeClipPath();
    // Clear previously rendered progressive elements.
    this._progressiveEls = null;
    this._updateDrawMode(seriesModel);
    this._isLargeDraw ? this._renderLarge(seriesModel) : this._renderNormal(seriesModel);
  };
  CandlestickView.prototype.incrementalPrepareRender = function (seriesModel, ecModel, api) {
    this._clear();
    this._updateDrawMode(seriesModel);
  };
  CandlestickView.prototype.incrementalRender = function (params, seriesModel, ecModel, api) {
    this._progressiveEls = [];
    this._isLargeDraw ? this._incrementalRenderLarge(params, seriesModel) : this._incrementalRenderNormal(params, seriesModel);
  };
  CandlestickView.prototype.eachRendered = function (cb) {
    traverseElements(this._progressiveEls || this.group, cb);
  };
  CandlestickView.prototype._updateDrawMode = function (seriesModel) {
    var isLargeDraw = seriesModel.pipelineContext.large;
    if (this._isLargeDraw == null || isLargeDraw !== this._isLargeDraw) {
      this._isLargeDraw = isLargeDraw;
      this._clear();
    }
  };
  CandlestickView.prototype._renderNormal = function (seriesModel) {
    var data = seriesModel.getData();
    var oldData = this._data;
    var group = this.group;
    var isSimpleBox = data.getLayout('isSimpleBox');
    var needsClip = seriesModel.get('clip', true);
    var coord = seriesModel.coordinateSystem;
    var clipArea = coord.getArea && coord.getArea();
    // There is no old data only when first rendering or switching from
    // stream mode to normal mode, where previous elements should be removed.
    if (!this._data) {
      group.removeAll();
    }
    data.diff(oldData).add(function (newIdx) {
      if (data.hasValue(newIdx)) {
        var itemLayout = data.getItemLayout(newIdx);
        if (needsClip && isNormalBoxClipped(clipArea, itemLayout)) {
          return;
        }
        var el = createNormalBox(itemLayout, newIdx, true);
        initProps(el, {
          shape: {
            points: itemLayout.ends
          }
        }, seriesModel, newIdx);
        setBoxCommon(el, data, newIdx, isSimpleBox);
        group.add(el);
        data.setItemGraphicEl(newIdx, el);
      }
    }).update(function (newIdx, oldIdx) {
      var el = oldData.getItemGraphicEl(oldIdx);
      // Empty data
      if (!data.hasValue(newIdx)) {
        group.remove(el);
        return;
      }
      var itemLayout = data.getItemLayout(newIdx);
      if (needsClip && isNormalBoxClipped(clipArea, itemLayout)) {
        group.remove(el);
        return;
      }
      if (!el) {
        el = createNormalBox(itemLayout);
      } else {
        updateProps$1(el, {
          shape: {
            points: itemLayout.ends
          }
        }, seriesModel, newIdx);
        saveOldStyle(el);
      }
      setBoxCommon(el, data, newIdx, isSimpleBox);
      group.add(el);
      data.setItemGraphicEl(newIdx, el);
    }).remove(function (oldIdx) {
      var el = oldData.getItemGraphicEl(oldIdx);
      el && group.remove(el);
    }).execute();
    this._data = data;
  };
  CandlestickView.prototype._renderLarge = function (seriesModel) {
    this._clear();
    createLarge(seriesModel, this.group);
    var clipPath = seriesModel.get('clip', true) ? createClipPath(seriesModel.coordinateSystem, false, seriesModel) : null;
    if (clipPath) {
      this.group.setClipPath(clipPath);
    } else {
      this.group.removeClipPath();
    }
  };
  CandlestickView.prototype._incrementalRenderNormal = function (params, seriesModel) {
    var data = seriesModel.getData();
    var isSimpleBox = data.getLayout('isSimpleBox');
    var dataIndex;
    while ((dataIndex = params.next()) != null) {
      var itemLayout = data.getItemLayout(dataIndex);
      var el = createNormalBox(itemLayout);
      setBoxCommon(el, data, dataIndex, isSimpleBox);
      el.incremental = true;
      this.group.add(el);
      this._progressiveEls.push(el);
    }
  };
  CandlestickView.prototype._incrementalRenderLarge = function (params, seriesModel) {
    createLarge(seriesModel, this.group, this._progressiveEls, true);
  };
  CandlestickView.prototype.remove = function (ecModel) {
    this._clear();
  };
  CandlestickView.prototype._clear = function () {
    this.group.removeAll();
    this._data = null;
  };
  CandlestickView.type = 'candlestick';
  return CandlestickView;
}(ChartView$1);
var NormalBoxPathShape = /** @class */function () {
  function NormalBoxPathShape() {}
  return NormalBoxPathShape;
}();
var NormalBoxPath = /** @class */function (_super) {
  __extends(NormalBoxPath, _super);
  function NormalBoxPath(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'normalCandlestickBox';
    return _this;
  }
  NormalBoxPath.prototype.getDefaultShape = function () {
    return new NormalBoxPathShape();
  };
  NormalBoxPath.prototype.buildPath = function (ctx, shape) {
    var ends = shape.points;
    if (this.__simpleBox) {
      ctx.moveTo(ends[4][0], ends[4][1]);
      ctx.lineTo(ends[6][0], ends[6][1]);
    } else {
      ctx.moveTo(ends[0][0], ends[0][1]);
      ctx.lineTo(ends[1][0], ends[1][1]);
      ctx.lineTo(ends[2][0], ends[2][1]);
      ctx.lineTo(ends[3][0], ends[3][1]);
      ctx.closePath();
      ctx.moveTo(ends[4][0], ends[4][1]);
      ctx.lineTo(ends[5][0], ends[5][1]);
      ctx.moveTo(ends[6][0], ends[6][1]);
      ctx.lineTo(ends[7][0], ends[7][1]);
    }
  };
  return NormalBoxPath;
}(Path$1);
function createNormalBox(itemLayout, dataIndex, isInit) {
  var ends = itemLayout.ends;
  return new NormalBoxPath({
    shape: {
      points: isInit ? transInit(ends, itemLayout) : ends
    },
    z2: 100
  });
}
function isNormalBoxClipped(clipArea, itemLayout) {
  var clipped = true;
  for (var i = 0; i < itemLayout.ends.length; i++) {
    // If any point are in the region.
    if (clipArea.contain(itemLayout.ends[i][0], itemLayout.ends[i][1])) {
      clipped = false;
      break;
    }
  }
  return clipped;
}
function setBoxCommon(el, data, dataIndex, isSimpleBox) {
  var itemModel = data.getItemModel(dataIndex);
  el.useStyle(data.getItemVisual(dataIndex, 'style'));
  el.style.strokeNoScale = true;
  el.__simpleBox = isSimpleBox;
  setStatesStylesFromModel(el, itemModel);
  var sign = data.getItemLayout(dataIndex).sign;
  each$f(el.states, function (state, stateName) {
    var stateModel = itemModel.getModel(stateName);
    var color = getColor(sign, stateModel);
    var borderColor = getBorderColor(sign, stateModel) || color;
    var stateStyle = state.style || (state.style = {});
    color && (stateStyle.fill = color);
    borderColor && (stateStyle.stroke = borderColor);
  });
  var emphasisModel = itemModel.getModel('emphasis');
  toggleHoverEmphasis(el, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
}
function transInit(points, itemLayout) {
  return map$1(points, function (point) {
    point = point.slice();
    point[1] = itemLayout.initBaseline;
    return point;
  });
}
var LargeBoxPathShape = /** @class */function () {
  function LargeBoxPathShape() {}
  return LargeBoxPathShape;
}();
var LargeBoxPath = /** @class */function (_super) {
  __extends(LargeBoxPath, _super);
  function LargeBoxPath(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'largeCandlestickBox';
    return _this;
  }
  LargeBoxPath.prototype.getDefaultShape = function () {
    return new LargeBoxPathShape();
  };
  LargeBoxPath.prototype.buildPath = function (ctx, shape) {
    // Drawing lines is more efficient than drawing
    // a whole line or drawing rects.
    var points = shape.points;
    for (var i = 0; i < points.length;) {
      if (this.__sign === points[i++]) {
        var x = points[i++];
        ctx.moveTo(x, points[i++]);
        ctx.lineTo(x, points[i++]);
      } else {
        i += 3;
      }
    }
  };
  return LargeBoxPath;
}(Path$1);
function createLarge(seriesModel, group, progressiveEls, incremental) {
  var data = seriesModel.getData();
  var largePoints = data.getLayout('largePoints');
  var elP = new LargeBoxPath({
    shape: {
      points: largePoints
    },
    __sign: 1,
    ignoreCoarsePointer: true
  });
  group.add(elP);
  var elN = new LargeBoxPath({
    shape: {
      points: largePoints
    },
    __sign: -1,
    ignoreCoarsePointer: true
  });
  group.add(elN);
  var elDoji = new LargeBoxPath({
    shape: {
      points: largePoints
    },
    __sign: 0,
    ignoreCoarsePointer: true
  });
  group.add(elDoji);
  setLargeStyle(1, elP, seriesModel);
  setLargeStyle(-1, elN, seriesModel);
  setLargeStyle(0, elDoji, seriesModel);
  if (incremental) {
    elP.incremental = true;
    elN.incremental = true;
  }
  if (progressiveEls) {
    progressiveEls.push(elP, elN);
  }
}
function setLargeStyle(sign, el, seriesModel, data) {
  // TODO put in visual?
  var borderColor = getBorderColor(sign, seriesModel)
  // Use color for border color by default.
  || getColor(sign, seriesModel);
  // Color must be excluded.
  // Because symbol provide setColor individually to set fill and stroke
  var itemStyle = seriesModel.getModel('itemStyle').getItemStyle(SKIP_PROPS);
  el.useStyle(itemStyle);
  el.style.fill = null;
  el.style.stroke = borderColor;
}
var CandlestickView$1 = CandlestickView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var CandlestickSeriesModel = /** @class */function (_super) {
  __extends(CandlestickSeriesModel, _super);
  function CandlestickSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = CandlestickSeriesModel.type;
    _this.defaultValueDimensions = [{
      name: 'open',
      defaultTooltip: true
    }, {
      name: 'close',
      defaultTooltip: true
    }, {
      name: 'lowest',
      defaultTooltip: true
    }, {
      name: 'highest',
      defaultTooltip: true
    }];
    return _this;
  }
  /**
   * Get dimension for shadow in dataZoom
   * @return dimension name
   */
  CandlestickSeriesModel.prototype.getShadowDim = function () {
    return 'open';
  };
  CandlestickSeriesModel.prototype.brushSelector = function (dataIndex, data, selectors) {
    var itemLayout = data.getItemLayout(dataIndex);
    return itemLayout && selectors.rect(itemLayout.brushRect);
  };
  CandlestickSeriesModel.type = 'series.candlestick';
  CandlestickSeriesModel.dependencies = ['xAxis', 'yAxis', 'grid'];
  CandlestickSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    coordinateSystem: 'cartesian2d',
    legendHoverLink: true,
    // xAxisIndex: 0,
    // yAxisIndex: 0,
    layout: null,
    clip: true,
    itemStyle: {
      color: '#eb5454',
      color0: '#47b262',
      borderColor: '#eb5454',
      borderColor0: '#47b262',
      borderColorDoji: null,
      // borderColor: '#d24040',
      // borderColor0: '#398f4f',
      borderWidth: 1
    },
    emphasis: {
      itemStyle: {
        borderWidth: 2
      }
    },
    barMaxWidth: null,
    barMinWidth: null,
    barWidth: null,
    large: true,
    largeThreshold: 600,
    progressive: 3e3,
    progressiveThreshold: 1e4,
    progressiveChunkMode: 'mod',
    animationEasing: 'linear',
    animationDuration: 300
  };
  return CandlestickSeriesModel;
}(SeriesModel$1);
mixin(CandlestickSeriesModel, WhiskerBoxCommonMixin, true);
var CandlestickSeriesModel$1 = CandlestickSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function candlestickPreprocessor(option) {
  if (!option || !isArray$1(option.series)) {
    return;
  }
  // Translate 'k' to 'candlestick'.
  each$f(option.series, function (seriesItem) {
    if (isObject$3(seriesItem) && seriesItem.type === 'k') {
      seriesItem.type = 'candlestick';
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var candlestickLayout = {
  seriesType: 'candlestick',
  plan: createRenderPlanner(),
  reset: function (seriesModel) {
    var coordSys = seriesModel.coordinateSystem;
    var data = seriesModel.getData();
    var candleWidth = calculateCandleWidth(seriesModel, data);
    var cDimIdx = 0;
    var vDimIdx = 1;
    var coordDims = ['x', 'y'];
    var cDimI = data.getDimensionIndex(data.mapDimension(coordDims[cDimIdx]));
    var vDimsI = map$1(data.mapDimensionsAll(coordDims[vDimIdx]), data.getDimensionIndex, data);
    var openDimI = vDimsI[0];
    var closeDimI = vDimsI[1];
    var lowestDimI = vDimsI[2];
    var highestDimI = vDimsI[3];
    data.setLayout({
      candleWidth: candleWidth,
      // The value is experimented visually.
      isSimpleBox: candleWidth <= 1.3
    });
    if (cDimI < 0 || vDimsI.length < 4) {
      return;
    }
    return {
      progress: seriesModel.pipelineContext.large ? largeProgress : normalProgress
    };
    function normalProgress(params, data) {
      var dataIndex;
      var store = data.getStore();
      while ((dataIndex = params.next()) != null) {
        var axisDimVal = store.get(cDimI, dataIndex);
        var openVal = store.get(openDimI, dataIndex);
        var closeVal = store.get(closeDimI, dataIndex);
        var lowestVal = store.get(lowestDimI, dataIndex);
        var highestVal = store.get(highestDimI, dataIndex);
        var ocLow = Math.min(openVal, closeVal);
        var ocHigh = Math.max(openVal, closeVal);
        var ocLowPoint = getPoint(ocLow, axisDimVal);
        var ocHighPoint = getPoint(ocHigh, axisDimVal);
        var lowestPoint = getPoint(lowestVal, axisDimVal);
        var highestPoint = getPoint(highestVal, axisDimVal);
        var ends = [];
        addBodyEnd(ends, ocHighPoint, 0);
        addBodyEnd(ends, ocLowPoint, 1);
        ends.push(subPixelOptimizePoint(highestPoint), subPixelOptimizePoint(ocHighPoint), subPixelOptimizePoint(lowestPoint), subPixelOptimizePoint(ocLowPoint));
        var itemModel = data.getItemModel(dataIndex);
        var hasDojiColor = !!itemModel.get(['itemStyle', 'borderColorDoji']);
        data.setItemLayout(dataIndex, {
          sign: getSign(store, dataIndex, openVal, closeVal, closeDimI, hasDojiColor),
          initBaseline: openVal > closeVal ? ocHighPoint[vDimIdx] : ocLowPoint[vDimIdx],
          ends: ends,
          brushRect: makeBrushRect(lowestVal, highestVal, axisDimVal)
        });
      }
      function getPoint(val, axisDimVal) {
        var p = [];
        p[cDimIdx] = axisDimVal;
        p[vDimIdx] = val;
        return isNaN(axisDimVal) || isNaN(val) ? [NaN, NaN] : coordSys.dataToPoint(p);
      }
      function addBodyEnd(ends, point, start) {
        var point1 = point.slice();
        var point2 = point.slice();
        point1[cDimIdx] = subPixelOptimize(point1[cDimIdx] + candleWidth / 2, 1, false);
        point2[cDimIdx] = subPixelOptimize(point2[cDimIdx] - candleWidth / 2, 1, true);
        start ? ends.push(point1, point2) : ends.push(point2, point1);
      }
      function makeBrushRect(lowestVal, highestVal, axisDimVal) {
        var pmin = getPoint(lowestVal, axisDimVal);
        var pmax = getPoint(highestVal, axisDimVal);
        pmin[cDimIdx] -= candleWidth / 2;
        pmax[cDimIdx] -= candleWidth / 2;
        return {
          x: pmin[0],
          y: pmin[1],
          width: candleWidth ,
          height: pmax[1] - pmin[1] 
        };
      }
      function subPixelOptimizePoint(point) {
        point[cDimIdx] = subPixelOptimize(point[cDimIdx], 1);
        return point;
      }
    }
    function largeProgress(params, data) {
      // Structure: [sign, x, yhigh, ylow, sign, x, yhigh, ylow, ...]
      var points = createFloat32Array(params.count * 4);
      var offset = 0;
      var point;
      var tmpIn = [];
      var tmpOut = [];
      var dataIndex;
      var store = data.getStore();
      var hasDojiColor = !!seriesModel.get(['itemStyle', 'borderColorDoji']);
      while ((dataIndex = params.next()) != null) {
        var axisDimVal = store.get(cDimI, dataIndex);
        var openVal = store.get(openDimI, dataIndex);
        var closeVal = store.get(closeDimI, dataIndex);
        var lowestVal = store.get(lowestDimI, dataIndex);
        var highestVal = store.get(highestDimI, dataIndex);
        if (isNaN(axisDimVal) || isNaN(lowestVal) || isNaN(highestVal)) {
          points[offset++] = NaN;
          offset += 3;
          continue;
        }
        points[offset++] = getSign(store, dataIndex, openVal, closeVal, closeDimI, hasDojiColor);
        tmpIn[cDimIdx] = axisDimVal;
        tmpIn[vDimIdx] = lowestVal;
        point = coordSys.dataToPoint(tmpIn, null, tmpOut);
        points[offset++] = point ? point[0] : NaN;
        points[offset++] = point ? point[1] : NaN;
        tmpIn[vDimIdx] = highestVal;
        point = coordSys.dataToPoint(tmpIn, null, tmpOut);
        points[offset++] = point ? point[1] : NaN;
      }
      data.setLayout('largePoints', points);
    }
  }
};
/**
 * Get the sign of a single data.
 *
 * @returns 0 for doji with hasDojiColor: true,
 *          1 for positive,
 *          -1 for negative.
 */
function getSign(store, dataIndex, openVal, closeVal, closeDimI, hasDojiColor) {
  var sign;
  if (openVal > closeVal) {
    sign = -1;
  } else if (openVal < closeVal) {
    sign = 1;
  } else {
    sign = hasDojiColor
    // When doji color is set, use it instead of color/color0.
    ? 0 : dataIndex > 0
    // If close === open, compare with close of last record
    ? store.get(closeDimI, dataIndex - 1) <= closeVal ? 1 : -1
    // No record of previous, set to be positive
    : 1;
  }
  return sign;
}
function calculateCandleWidth(seriesModel, data) {
  var baseAxis = seriesModel.getBaseAxis();
  var extent;
  var bandWidth = baseAxis.type === 'category' ? baseAxis.getBandWidth() : (extent = baseAxis.getExtent(), Math.abs(extent[1] - extent[0]) / data.count());
  var barMaxWidth = parsePercent(retrieve2(seriesModel.get('barMaxWidth'), bandWidth), bandWidth);
  var barMinWidth = parsePercent(retrieve2(seriesModel.get('barMinWidth'), 1), bandWidth);
  var barWidth = seriesModel.get('barWidth');
  return barWidth != null ? parsePercent(barWidth, bandWidth)
  // Put max outer to ensure bar visible in spite of overlap.
  : Math.max(Math.min(bandWidth / 2, barMaxWidth), barMinWidth);
}
var candlestickLayout$1 = candlestickLayout;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$A(registers) {
  registers.registerChartView(CandlestickView$1);
  registers.registerSeriesModel(CandlestickSeriesModel$1);
  registers.registerPreprocessor(candlestickPreprocessor);
  registers.registerVisual(candlestickVisual$1);
  registers.registerLayout(candlestickLayout$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function updateRipplePath(rippleGroup, effectCfg) {
  var color = effectCfg.rippleEffectColor || effectCfg.color;
  rippleGroup.eachChild(function (ripplePath) {
    ripplePath.attr({
      z: effectCfg.z,
      zlevel: effectCfg.zlevel,
      style: {
        stroke: effectCfg.brushType === 'stroke' ? color : null,
        fill: effectCfg.brushType === 'fill' ? color : null
      }
    });
  });
}
var EffectSymbol = /** @class */function (_super) {
  __extends(EffectSymbol, _super);
  function EffectSymbol(data, idx) {
    var _this = _super.call(this) || this;
    var symbol = new SymbolClz(data, idx);
    var rippleGroup = new Group$5();
    _this.add(symbol);
    _this.add(rippleGroup);
    _this.updateData(data, idx);
    return _this;
  }
  EffectSymbol.prototype.stopEffectAnimation = function () {
    this.childAt(1).removeAll();
  };
  EffectSymbol.prototype.startEffectAnimation = function (effectCfg) {
    var symbolType = effectCfg.symbolType;
    var color = effectCfg.color;
    var rippleNumber = effectCfg.rippleNumber;
    var rippleGroup = this.childAt(1);
    for (var i = 0; i < rippleNumber; i++) {
      // If width/height are set too small (e.g., set to 1) on ios10
      // and macOS Sierra, a circle stroke become a rect, no matter what
      // the scale is set. So we set width/height as 2. See #4136.
      var ripplePath = createSymbol$1(symbolType, -1, -1, 2, 2, color);
      ripplePath.attr({
        style: {
          strokeNoScale: true
        },
        z2: 99,
        silent: true,
        scaleX: 0.5,
        scaleY: 0.5
      });
      var delay = -i / rippleNumber * effectCfg.period + effectCfg.effectOffset;
      ripplePath.animate('', true).when(effectCfg.period, {
        scaleX: effectCfg.rippleScale / 2,
        scaleY: effectCfg.rippleScale / 2
      }).delay(delay).start();
      ripplePath.animateStyle(true).when(effectCfg.period, {
        opacity: 0
      }).delay(delay).start();
      rippleGroup.add(ripplePath);
    }
    updateRipplePath(rippleGroup, effectCfg);
  };
  /**
   * Update effect symbol
   */
  EffectSymbol.prototype.updateEffectAnimation = function (effectCfg) {
    var oldEffectCfg = this._effectCfg;
    var rippleGroup = this.childAt(1);
    // Must reinitialize effect if following configuration changed
    var DIFFICULT_PROPS = ['symbolType', 'period', 'rippleScale', 'rippleNumber'];
    for (var i = 0; i < DIFFICULT_PROPS.length; i++) {
      var propName = DIFFICULT_PROPS[i];
      if (oldEffectCfg[propName] !== effectCfg[propName]) {
        this.stopEffectAnimation();
        this.startEffectAnimation(effectCfg);
        return;
      }
    }
    updateRipplePath(rippleGroup, effectCfg);
  };
  /**
   * Highlight symbol
   */
  EffectSymbol.prototype.highlight = function () {
    enterEmphasis(this);
  };
  /**
   * Downplay symbol
   */
  EffectSymbol.prototype.downplay = function () {
    leaveEmphasis(this);
  };
  EffectSymbol.prototype.getSymbolType = function () {
    var symbol = this.childAt(0);
    return symbol && symbol.getSymbolType();
  };
  /**
   * Update symbol properties
   */
  EffectSymbol.prototype.updateData = function (data, idx) {
    var _this = this;
    var seriesModel = data.hostModel;
    this.childAt(0).updateData(data, idx);
    var rippleGroup = this.childAt(1);
    var itemModel = data.getItemModel(idx);
    var symbolType = data.getItemVisual(idx, 'symbol');
    var symbolSize = normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));
    var symbolStyle = data.getItemVisual(idx, 'style');
    var color = symbolStyle && symbolStyle.fill;
    var emphasisModel = itemModel.getModel('emphasis');
    rippleGroup.setScale(symbolSize);
    rippleGroup.traverse(function (ripplePath) {
      ripplePath.setStyle('fill', color);
    });
    var symbolOffset = normalizeSymbolOffset(data.getItemVisual(idx, 'symbolOffset'), symbolSize);
    if (symbolOffset) {
      rippleGroup.x = symbolOffset[0];
      rippleGroup.y = symbolOffset[1];
    }
    var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
    rippleGroup.rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
    var effectCfg = {};
    effectCfg.showEffectOn = seriesModel.get('showEffectOn');
    effectCfg.rippleScale = itemModel.get(['rippleEffect', 'scale']);
    effectCfg.brushType = itemModel.get(['rippleEffect', 'brushType']);
    effectCfg.period = itemModel.get(['rippleEffect', 'period']) * 1000;
    effectCfg.effectOffset = idx / data.count();
    effectCfg.z = seriesModel.getShallow('z') || 0;
    effectCfg.zlevel = seriesModel.getShallow('zlevel') || 0;
    effectCfg.symbolType = symbolType;
    effectCfg.color = color;
    effectCfg.rippleEffectColor = itemModel.get(['rippleEffect', 'color']);
    effectCfg.rippleNumber = itemModel.get(['rippleEffect', 'number']);
    if (effectCfg.showEffectOn === 'render') {
      this._effectCfg ? this.updateEffectAnimation(effectCfg) : this.startEffectAnimation(effectCfg);
      this._effectCfg = effectCfg;
    } else {
      // Not keep old effect config
      this._effectCfg = null;
      this.stopEffectAnimation();
      this.onHoverStateChange = function (toState) {
        if (toState === 'emphasis') {
          if (effectCfg.showEffectOn !== 'render') {
            _this.startEffectAnimation(effectCfg);
          }
        } else if (toState === 'normal') {
          if (effectCfg.showEffectOn !== 'render') {
            _this.stopEffectAnimation();
          }
        }
      };
    }
    this._effectCfg = effectCfg;
    toggleHoverEmphasis(this, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
  };
  EffectSymbol.prototype.fadeOut = function (cb) {
    cb && cb();
  };
  return EffectSymbol;
}(Group$5);
var EffectSymbol$1 = EffectSymbol;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var EffectScatterView = /** @class */function (_super) {
  __extends(EffectScatterView, _super);
  function EffectScatterView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = EffectScatterView.type;
    return _this;
  }
  EffectScatterView.prototype.init = function () {
    this._symbolDraw = new SymbolDraw$1(EffectSymbol$1);
  };
  EffectScatterView.prototype.render = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var effectSymbolDraw = this._symbolDraw;
    effectSymbolDraw.updateData(data, {
      clipShape: this._getClipShape(seriesModel)
    });
    this.group.add(effectSymbolDraw.group);
  };
  EffectScatterView.prototype._getClipShape = function (seriesModel) {
    var coordSys = seriesModel.coordinateSystem;
    var clipArea = coordSys && coordSys.getArea && coordSys.getArea();
    return seriesModel.get('clip', true) ? clipArea : null;
  };
  EffectScatterView.prototype.updateTransform = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    this.group.dirty();
    var res = pointsLayout('').reset(seriesModel, ecModel, api);
    if (res.progress) {
      res.progress({
        start: 0,
        end: data.count(),
        count: data.count()
      }, data);
    }
    this._symbolDraw.updateLayout();
  };
  EffectScatterView.prototype._updateGroupTransform = function (seriesModel) {
    var coordSys = seriesModel.coordinateSystem;
    if (coordSys && coordSys.getRoamTransform) {
      this.group.transform = clone$2(coordSys.getRoamTransform());
      this.group.decomposeTransform();
    }
  };
  EffectScatterView.prototype.remove = function (ecModel, api) {
    this._symbolDraw && this._symbolDraw.remove(true);
  };
  EffectScatterView.type = 'effectScatter';
  return EffectScatterView;
}(ChartView$1);
var EffectScatterView$1 = EffectScatterView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var EffectScatterSeriesModel = /** @class */function (_super) {
  __extends(EffectScatterSeriesModel, _super);
  function EffectScatterSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = EffectScatterSeriesModel.type;
    _this.hasSymbolVisual = true;
    return _this;
  }
  EffectScatterSeriesModel.prototype.getInitialData = function (option, ecModel) {
    return createSeriesData(null, this, {
      useEncodeDefaulter: true
    });
  };
  EffectScatterSeriesModel.prototype.brushSelector = function (dataIndex, data, selectors) {
    return selectors.point(data.getItemLayout(dataIndex));
  };
  EffectScatterSeriesModel.type = 'series.effectScatter';
  EffectScatterSeriesModel.dependencies = ['grid', 'polar'];
  EffectScatterSeriesModel.defaultOption = {
    coordinateSystem: 'cartesian2d',
    // zlevel: 0,
    z: 2,
    legendHoverLink: true,
    effectType: 'ripple',
    progressive: 0,
    // When to show the effect, option: 'render'|'emphasis'
    showEffectOn: 'render',
    clip: true,
    // Ripple effect config
    rippleEffect: {
      period: 4,
      // Scale of ripple
      scale: 2.5,
      // Brush type can be fill or stroke
      brushType: 'fill',
      // Ripple number
      number: 3
    },
    universalTransition: {
      divideShape: 'clone'
    },
    // Cartesian coordinate system
    // xAxisIndex: 0,
    // yAxisIndex: 0,
    // Polar coordinate system
    // polarIndex: 0,
    // Geo coordinate system
    // geoIndex: 0,
    // symbol: null,        // 图形类型
    symbolSize: 10 // 图形大小，半宽（半径）参数，当图形为方向或菱形则总宽度为symbolSize * 2
    // symbolRotate: null,  // 图形旋转控制
    // itemStyle: {
    //     opacity: 1
    // }
  };
  return EffectScatterSeriesModel;
}(SeriesModel$1);
var EffectScatterSeriesModel$1 = EffectScatterSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$z(registers) {
  registers.registerChartView(EffectScatterView$1);
  registers.registerSeriesModel(EffectScatterSeriesModel$1);
  registers.registerLayout(pointsLayout('effectScatter'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var EffectLine = /** @class */function (_super) {
  __extends(EffectLine, _super);
  function EffectLine(lineData, idx, seriesScope) {
    var _this = _super.call(this) || this;
    _this.add(_this.createLine(lineData, idx, seriesScope));
    _this._updateEffectSymbol(lineData, idx);
    return _this;
  }
  EffectLine.prototype.createLine = function (lineData, idx, seriesScope) {
    return new Line$2(lineData, idx, seriesScope);
  };
  EffectLine.prototype._updateEffectSymbol = function (lineData, idx) {
    var itemModel = lineData.getItemModel(idx);
    var effectModel = itemModel.getModel('effect');
    var size = effectModel.get('symbolSize');
    var symbolType = effectModel.get('symbol');
    if (!isArray$1(size)) {
      size = [size, size];
    }
    var lineStyle = lineData.getItemVisual(idx, 'style');
    var color = effectModel.get('color') || lineStyle && lineStyle.stroke;
    var symbol = this.childAt(1);
    if (this._symbolType !== symbolType) {
      // Remove previous
      this.remove(symbol);
      symbol = createSymbol$1(symbolType, -0.5, -0.5, 1, 1, color);
      symbol.z2 = 100;
      symbol.culling = true;
      this.add(symbol);
    }
    // Symbol may be removed if loop is false
    if (!symbol) {
      return;
    }
    // Shadow color is same with color in default
    symbol.setStyle('shadowColor', color);
    symbol.setStyle(effectModel.getItemStyle(['color']));
    symbol.scaleX = size[0];
    symbol.scaleY = size[1];
    symbol.setColor(color);
    this._symbolType = symbolType;
    this._symbolScale = size;
    this._updateEffectAnimation(lineData, effectModel, idx);
  };
  EffectLine.prototype._updateEffectAnimation = function (lineData, effectModel, idx) {
    var symbol = this.childAt(1);
    if (!symbol) {
      return;
    }
    var points = lineData.getItemLayout(idx);
    var period = effectModel.get('period') * 1000;
    var loop = effectModel.get('loop');
    var roundTrip = effectModel.get('roundTrip');
    var constantSpeed = effectModel.get('constantSpeed');
    var delayExpr = retrieve(effectModel.get('delay'), function (idx) {
      return idx / lineData.count() * period / 3;
    });
    // Ignore when updating
    symbol.ignore = true;
    this._updateAnimationPoints(symbol, points);
    if (constantSpeed > 0) {
      period = this._getLineLength(symbol) / constantSpeed * 1000;
    }
    if (period !== this._period || loop !== this._loop || roundTrip !== this._roundTrip) {
      symbol.stopAnimation();
      var delayNum = void 0;
      if (isFunction(delayExpr)) {
        delayNum = delayExpr(idx);
      } else {
        delayNum = delayExpr;
      }
      if (symbol.__t > 0) {
        delayNum = -period * symbol.__t;
      }
      this._animateSymbol(symbol, period, delayNum, loop, roundTrip);
    }
    this._period = period;
    this._loop = loop;
    this._roundTrip = roundTrip;
  };
  EffectLine.prototype._animateSymbol = function (symbol, period, delayNum, loop, roundTrip) {
    if (period > 0) {
      symbol.__t = 0;
      var self_1 = this;
      var animator = symbol.animate('', loop).when(roundTrip ? period * 2 : period, {
        __t: roundTrip ? 2 : 1
      }).delay(delayNum).during(function () {
        self_1._updateSymbolPosition(symbol);
      });
      if (!loop) {
        animator.done(function () {
          self_1.remove(symbol);
        });
      }
      animator.start();
    }
  };
  EffectLine.prototype._getLineLength = function (symbol) {
    // Not so accurate
    return dist$1(symbol.__p1, symbol.__cp1) + dist$1(symbol.__cp1, symbol.__p2);
  };
  EffectLine.prototype._updateAnimationPoints = function (symbol, points) {
    symbol.__p1 = points[0];
    symbol.__p2 = points[1];
    symbol.__cp1 = points[2] || [(points[0][0] + points[1][0]) / 2, (points[0][1] + points[1][1]) / 2];
  };
  EffectLine.prototype.updateData = function (lineData, idx, seriesScope) {
    this.childAt(0).updateData(lineData, idx, seriesScope);
    this._updateEffectSymbol(lineData, idx);
  };
  EffectLine.prototype._updateSymbolPosition = function (symbol) {
    var p1 = symbol.__p1;
    var p2 = symbol.__p2;
    var cp1 = symbol.__cp1;
    var t = symbol.__t < 1 ? symbol.__t : 2 - symbol.__t;
    var pos = [symbol.x, symbol.y];
    var lastPos = pos.slice();
    var quadraticAt = quadraticAt$1;
    var quadraticDerivativeAt$1 = quadraticDerivativeAt;
    pos[0] = quadraticAt(p1[0], cp1[0], p2[0], t);
    pos[1] = quadraticAt(p1[1], cp1[1], p2[1], t);
    // Tangent
    var tx = symbol.__t < 1 ? quadraticDerivativeAt$1(p1[0], cp1[0], p2[0], t) : quadraticDerivativeAt$1(p2[0], cp1[0], p1[0], 1 - t);
    var ty = symbol.__t < 1 ? quadraticDerivativeAt$1(p1[1], cp1[1], p2[1], t) : quadraticDerivativeAt$1(p2[1], cp1[1], p1[1], 1 - t);
    symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2;
    // enable continuity trail for 'line', 'rect', 'roundRect' symbolType
    if (this._symbolType === 'line' || this._symbolType === 'rect' || this._symbolType === 'roundRect') {
      if (symbol.__lastT !== undefined && symbol.__lastT < symbol.__t) {
        symbol.scaleY = dist$1(lastPos, pos) * 1.05;
        // make sure the last segment render within endPoint
        if (t === 1) {
          pos[0] = lastPos[0] + (pos[0] - lastPos[0]) / 2;
          pos[1] = lastPos[1] + (pos[1] - lastPos[1]) / 2;
        }
      } else if (symbol.__lastT === 1) {
        // After first loop, symbol.__t does NOT start with 0, so connect p1 to pos directly.
        symbol.scaleY = 2 * dist$1(p1, pos);
      } else {
        symbol.scaleY = this._symbolScale[1];
      }
    }
    symbol.__lastT = symbol.__t;
    symbol.ignore = false;
    symbol.x = pos[0];
    symbol.y = pos[1];
  };
  EffectLine.prototype.updateLayout = function (lineData, idx) {
    this.childAt(0).updateLayout(lineData, idx);
    var effectModel = lineData.getItemModel(idx).getModel('effect');
    this._updateEffectAnimation(lineData, effectModel, idx);
  };
  return EffectLine;
}(Group$5);
var EffectLine$1 = EffectLine;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Polyline = /** @class */function (_super) {
  __extends(Polyline, _super);
  function Polyline(lineData, idx, seriesScope) {
    var _this = _super.call(this) || this;
    _this._createPolyline(lineData, idx, seriesScope);
    return _this;
  }
  Polyline.prototype._createPolyline = function (lineData, idx, seriesScope) {
    // let seriesModel = lineData.hostModel;
    var points = lineData.getItemLayout(idx);
    var line = new Polyline$3({
      shape: {
        points: points
      }
    });
    this.add(line);
    this._updateCommonStl(lineData, idx, seriesScope);
  };
  Polyline.prototype.updateData = function (lineData, idx, seriesScope) {
    var seriesModel = lineData.hostModel;
    var line = this.childAt(0);
    var target = {
      shape: {
        points: lineData.getItemLayout(idx)
      }
    };
    updateProps$1(line, target, seriesModel, idx);
    this._updateCommonStl(lineData, idx, seriesScope);
  };
  Polyline.prototype._updateCommonStl = function (lineData, idx, seriesScope) {
    var line = this.childAt(0);
    var itemModel = lineData.getItemModel(idx);
    var emphasisLineStyle = seriesScope && seriesScope.emphasisLineStyle;
    var focus = seriesScope && seriesScope.focus;
    var blurScope = seriesScope && seriesScope.blurScope;
    var emphasisDisabled = seriesScope && seriesScope.emphasisDisabled;
    if (!seriesScope || lineData.hasItemOption) {
      var emphasisModel = itemModel.getModel('emphasis');
      emphasisLineStyle = emphasisModel.getModel('lineStyle').getLineStyle();
      emphasisDisabled = emphasisModel.get('disabled');
      focus = emphasisModel.get('focus');
      blurScope = emphasisModel.get('blurScope');
    }
    line.useStyle(lineData.getItemVisual(idx, 'style'));
    line.style.fill = null;
    line.style.strokeNoScale = true;
    var lineEmphasisState = line.ensureState('emphasis');
    lineEmphasisState.style = emphasisLineStyle;
    toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);
  };
  Polyline.prototype.updateLayout = function (lineData, idx) {
    var polyline = this.childAt(0);
    polyline.setShape('points', lineData.getItemLayout(idx));
  };
  return Polyline;
}(Group$5);
var Polyline$1 = Polyline;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var EffectPolyline = /** @class */function (_super) {
  __extends(EffectPolyline, _super);
  function EffectPolyline() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this._lastFrame = 0;
    _this._lastFramePercent = 0;
    return _this;
  }
  // Override
  EffectPolyline.prototype.createLine = function (lineData, idx, seriesScope) {
    return new Polyline$1(lineData, idx, seriesScope);
  };
  // Override
  EffectPolyline.prototype._updateAnimationPoints = function (symbol, points) {
    this._points = points;
    var accLenArr = [0];
    var len = 0;
    for (var i = 1; i < points.length; i++) {
      var p1 = points[i - 1];
      var p2 = points[i];
      len += dist$1(p1, p2);
      accLenArr.push(len);
    }
    if (len === 0) {
      this._length = 0;
      return;
    }
    for (var i = 0; i < accLenArr.length; i++) {
      accLenArr[i] /= len;
    }
    this._offsets = accLenArr;
    this._length = len;
  };
  // Override
  EffectPolyline.prototype._getLineLength = function () {
    return this._length;
  };
  // Override
  EffectPolyline.prototype._updateSymbolPosition = function (symbol) {
    var t = symbol.__t < 1 ? symbol.__t : 2 - symbol.__t;
    var points = this._points;
    var offsets = this._offsets;
    var len = points.length;
    if (!offsets) {
      // Has length 0
      return;
    }
    var lastFrame = this._lastFrame;
    var frame;
    if (t < this._lastFramePercent) {
      // Start from the next frame
      // PENDING start from lastFrame ?
      var start = Math.min(lastFrame + 1, len - 1);
      for (frame = start; frame >= 0; frame--) {
        if (offsets[frame] <= t) {
          break;
        }
      }
      // PENDING really need to do this ?
      frame = Math.min(frame, len - 2);
    } else {
      for (frame = lastFrame; frame < len; frame++) {
        if (offsets[frame] > t) {
          break;
        }
      }
      frame = Math.min(frame - 1, len - 2);
    }
    var p = (t - offsets[frame]) / (offsets[frame + 1] - offsets[frame]);
    var p0 = points[frame];
    var p1 = points[frame + 1];
    symbol.x = p0[0] * (1 - p) + p * p1[0];
    symbol.y = p0[1] * (1 - p) + p * p1[1];
    var tx = symbol.__t < 1 ? p1[0] - p0[0] : p0[0] - p1[0];
    var ty = symbol.__t < 1 ? p1[1] - p0[1] : p0[1] - p1[1];
    symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2;
    this._lastFrame = frame;
    this._lastFramePercent = t;
    symbol.ignore = false;
  };
  return EffectPolyline;
}(EffectLine$1);
var EffectPolyline$1 = EffectPolyline;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var LargeLinesPathShape = /** @class */function () {
  function LargeLinesPathShape() {
    this.polyline = false;
    this.curveness = 0;
    this.segs = [];
  }
  return LargeLinesPathShape;
}();
var LargeLinesPath = /** @class */function (_super) {
  __extends(LargeLinesPath, _super);
  function LargeLinesPath(opts) {
    var _this = _super.call(this, opts) || this;
    _this._off = 0;
    _this.hoverDataIdx = -1;
    return _this;
  }
  LargeLinesPath.prototype.reset = function () {
    this.notClear = false;
    this._off = 0;
  };
  LargeLinesPath.prototype.getDefaultStyle = function () {
    return {
      stroke: '#000',
      fill: null
    };
  };
  LargeLinesPath.prototype.getDefaultShape = function () {
    return new LargeLinesPathShape();
  };
  LargeLinesPath.prototype.buildPath = function (ctx, shape) {
    var segs = shape.segs;
    var curveness = shape.curveness;
    var i;
    if (shape.polyline) {
      for (i = this._off; i < segs.length;) {
        var count = segs[i++];
        if (count > 0) {
          ctx.moveTo(segs[i++], segs[i++]);
          for (var k = 1; k < count; k++) {
            ctx.lineTo(segs[i++], segs[i++]);
          }
        }
      }
    } else {
      for (i = this._off; i < segs.length;) {
        var x0 = segs[i++];
        var y0 = segs[i++];
        var x1 = segs[i++];
        var y1 = segs[i++];
        ctx.moveTo(x0, y0);
        if (curveness > 0) {
          var x2 = (x0 + x1) / 2 - (y0 - y1) * curveness;
          var y2 = (y0 + y1) / 2 - (x1 - x0) * curveness;
          ctx.quadraticCurveTo(x2, y2, x1, y1);
        } else {
          ctx.lineTo(x1, y1);
        }
      }
    }
    if (this.incremental) {
      this._off = i;
      this.notClear = true;
    }
  };
  LargeLinesPath.prototype.findDataIndex = function (x, y) {
    var shape = this.shape;
    var segs = shape.segs;
    var curveness = shape.curveness;
    var lineWidth = this.style.lineWidth;
    if (shape.polyline) {
      var dataIndex = 0;
      for (var i = 0; i < segs.length;) {
        var count = segs[i++];
        if (count > 0) {
          var x0 = segs[i++];
          var y0 = segs[i++];
          for (var k = 1; k < count; k++) {
            var x1 = segs[i++];
            var y1 = segs[i++];
            if (containStroke$4(x0, y0, x1, y1, lineWidth, x, y)) {
              return dataIndex;
            }
          }
        }
        dataIndex++;
      }
    } else {
      var dataIndex = 0;
      for (var i = 0; i < segs.length;) {
        var x0 = segs[i++];
        var y0 = segs[i++];
        var x1 = segs[i++];
        var y1 = segs[i++];
        if (curveness > 0) {
          var x2 = (x0 + x1) / 2 - (y0 - y1) * curveness;
          var y2 = (y0 + y1) / 2 - (x1 - x0) * curveness;
          if (containStroke$2(x0, y0, x2, y2, x1, y1, lineWidth, x, y)) {
            return dataIndex;
          }
        } else {
          if (containStroke$4(x0, y0, x1, y1, lineWidth, x, y)) {
            return dataIndex;
          }
        }
        dataIndex++;
      }
    }
    return -1;
  };
  LargeLinesPath.prototype.contain = function (x, y) {
    var localPos = this.transformCoordToLocal(x, y);
    var rect = this.getBoundingRect();
    x = localPos[0];
    y = localPos[1];
    if (rect.contain(x, y)) {
      // Cache found data index.
      var dataIdx = this.hoverDataIdx = this.findDataIndex(x, y);
      return dataIdx >= 0;
    }
    this.hoverDataIdx = -1;
    return false;
  };
  LargeLinesPath.prototype.getBoundingRect = function () {
    // Ignore stroke for large symbol draw.
    var rect = this._rect;
    if (!rect) {
      var shape = this.shape;
      var points = shape.segs;
      var minX = Infinity;
      var minY = Infinity;
      var maxX = -Infinity;
      var maxY = -Infinity;
      for (var i = 0; i < points.length;) {
        var x = points[i++];
        var y = points[i++];
        minX = Math.min(x, minX);
        maxX = Math.max(x, maxX);
        minY = Math.min(y, minY);
        maxY = Math.max(y, maxY);
      }
      rect = this._rect = new BoundingRect$1(minX, minY, maxX, maxY);
    }
    return rect;
  };
  return LargeLinesPath;
}(Path$1);
var LargeLineDraw = /** @class */function () {
  function LargeLineDraw() {
    this.group = new Group$5();
  }
  /**
   * Update symbols draw by new data
   */
  LargeLineDraw.prototype.updateData = function (data) {
    this._clear();
    var lineEl = this._create();
    lineEl.setShape({
      segs: data.getLayout('linesPoints')
    });
    this._setCommon(lineEl, data);
  };
  /**
   * @override
   */
  LargeLineDraw.prototype.incrementalPrepareUpdate = function (data) {
    this.group.removeAll();
    this._clear();
  };
  /**
   * @override
   */
  LargeLineDraw.prototype.incrementalUpdate = function (taskParams, data) {
    var lastAdded = this._newAdded[0];
    var linePoints = data.getLayout('linesPoints');
    var oldSegs = lastAdded && lastAdded.shape.segs;
    // Merging the exists. Each element has 1e4 points.
    // Consider the performance balance between too much elements and too much points in one shape(may affect hover optimization)
    if (oldSegs && oldSegs.length < 2e4) {
      var oldLen = oldSegs.length;
      var newSegs = new Float32Array(oldLen + linePoints.length);
      // Concat two array
      newSegs.set(oldSegs);
      newSegs.set(linePoints, oldLen);
      lastAdded.setShape({
        segs: newSegs
      });
    } else {
      // Clear
      this._newAdded = [];
      var lineEl = this._create();
      lineEl.incremental = true;
      lineEl.setShape({
        segs: linePoints
      });
      this._setCommon(lineEl, data);
      lineEl.__startIndex = taskParams.start;
    }
  };
  /**
   * @override
   */
  LargeLineDraw.prototype.remove = function () {
    this._clear();
  };
  LargeLineDraw.prototype.eachRendered = function (cb) {
    this._newAdded[0] && cb(this._newAdded[0]);
  };
  LargeLineDraw.prototype._create = function () {
    var lineEl = new LargeLinesPath({
      cursor: 'default',
      ignoreCoarsePointer: true
    });
    this._newAdded.push(lineEl);
    this.group.add(lineEl);
    return lineEl;
  };
  LargeLineDraw.prototype._setCommon = function (lineEl, data, isIncremental) {
    var hostModel = data.hostModel;
    lineEl.setShape({
      polyline: hostModel.get('polyline'),
      curveness: hostModel.get(['lineStyle', 'curveness'])
    });
    lineEl.useStyle(hostModel.getModel('lineStyle').getLineStyle());
    lineEl.style.strokeNoScale = true;
    var style = data.getVisual('style');
    if (style && style.stroke) {
      lineEl.setStyle('stroke', style.stroke);
    }
    lineEl.setStyle('fill', null);
    var ecData = getECData(lineEl);
    // Enable tooltip
    // PENDING May have performance issue when path is extremely large
    ecData.seriesIndex = hostModel.seriesIndex;
    lineEl.on('mousemove', function (e) {
      ecData.dataIndex = null;
      var dataIndex = lineEl.hoverDataIdx;
      if (dataIndex > 0) {
        // Provide dataIndex for tooltip
        ecData.dataIndex = dataIndex + lineEl.__startIndex;
      }
    });
  };
  LargeLineDraw.prototype._clear = function () {
    this._newAdded = [];
    this.group.removeAll();
  };
  return LargeLineDraw;
}();
var LargeLineDraw$1 = LargeLineDraw;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var linesLayout = {
  seriesType: 'lines',
  plan: createRenderPlanner(),
  reset: function (seriesModel) {
    var coordSys = seriesModel.coordinateSystem;
    if (!coordSys) {
      {
        error('The lines series must have a coordinate system.');
      }
      return;
    }
    var isPolyline = seriesModel.get('polyline');
    var isLarge = seriesModel.pipelineContext.large;
    return {
      progress: function (params, lineData) {
        var lineCoords = [];
        if (isLarge) {
          var points = void 0;
          var segCount = params.end - params.start;
          if (isPolyline) {
            var totalCoordsCount = 0;
            for (var i = params.start; i < params.end; i++) {
              totalCoordsCount += seriesModel.getLineCoordsCount(i);
            }
            points = new Float32Array(segCount + totalCoordsCount * 2);
          } else {
            points = new Float32Array(segCount * 4);
          }
          var offset = 0;
          var pt = [];
          for (var i = params.start; i < params.end; i++) {
            var len = seriesModel.getLineCoords(i, lineCoords);
            if (isPolyline) {
              points[offset++] = len;
            }
            for (var k = 0; k < len; k++) {
              pt = coordSys.dataToPoint(lineCoords[k], false, pt);
              points[offset++] = pt[0];
              points[offset++] = pt[1];
            }
          }
          lineData.setLayout('linesPoints', points);
        } else {
          for (var i = params.start; i < params.end; i++) {
            var itemModel = lineData.getItemModel(i);
            var len = seriesModel.getLineCoords(i, lineCoords);
            var pts = [];
            if (isPolyline) {
              for (var j = 0; j < len; j++) {
                pts.push(coordSys.dataToPoint(lineCoords[j]));
              }
            } else {
              pts[0] = coordSys.dataToPoint(lineCoords[0]);
              pts[1] = coordSys.dataToPoint(lineCoords[1]);
              var curveness = itemModel.get(['lineStyle', 'curveness']);
              if (+curveness) {
                pts[2] = [(pts[0][0] + pts[1][0]) / 2 - (pts[0][1] - pts[1][1]) * curveness, (pts[0][1] + pts[1][1]) / 2 - (pts[1][0] - pts[0][0]) * curveness];
              }
            }
            lineData.setItemLayout(i, pts);
          }
        }
      }
    };
  }
};
var linesLayout$1 = linesLayout;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var LinesView = /** @class */function (_super) {
  __extends(LinesView, _super);
  function LinesView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = LinesView.type;
    return _this;
  }
  LinesView.prototype.render = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var lineDraw = this._updateLineDraw(data, seriesModel);
    var zlevel = seriesModel.get('zlevel');
    var trailLength = seriesModel.get(['effect', 'trailLength']);
    var zr = api.getZr();
    // Avoid the drag cause ghost shadow
    // FIXME Better way ?
    // SVG doesn't support
    var isSvg = zr.painter.getType() === 'svg';
    if (!isSvg) {
      zr.painter.getLayer(zlevel).clear(true);
    }
    // Config layer with motion blur
    if (this._lastZlevel != null && !isSvg) {
      zr.configLayer(this._lastZlevel, {
        motionBlur: false
      });
    }
    if (this._showEffect(seriesModel) && trailLength > 0) {
      if (!isSvg) {
        zr.configLayer(zlevel, {
          motionBlur: true,
          lastFrameAlpha: Math.max(Math.min(trailLength / 10 + 0.9, 1), 0)
        });
      } else {
        console.warn('SVG render mode doesn\'t support lines with trail effect');
      }
    }
    lineDraw.updateData(data);
    var clipPath = seriesModel.get('clip', true) && createClipPath(seriesModel.coordinateSystem, false, seriesModel);
    if (clipPath) {
      this.group.setClipPath(clipPath);
    } else {
      this.group.removeClipPath();
    }
    this._lastZlevel = zlevel;
    this._finished = true;
  };
  LinesView.prototype.incrementalPrepareRender = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var lineDraw = this._updateLineDraw(data, seriesModel);
    lineDraw.incrementalPrepareUpdate(data);
    this._clearLayer(api);
    this._finished = false;
  };
  LinesView.prototype.incrementalRender = function (taskParams, seriesModel, ecModel) {
    this._lineDraw.incrementalUpdate(taskParams, seriesModel.getData());
    this._finished = taskParams.end === seriesModel.getData().count();
  };
  LinesView.prototype.eachRendered = function (cb) {
    this._lineDraw && this._lineDraw.eachRendered(cb);
  };
  LinesView.prototype.updateTransform = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var pipelineContext = seriesModel.pipelineContext;
    if (!this._finished || pipelineContext.large || pipelineContext.progressiveRender) {
      // TODO Don't have to do update in large mode. Only do it when there are millions of data.
      return {
        update: true
      };
    } else {
      // TODO Use same logic with ScatterView.
      // Manually update layout
      var res = linesLayout$1.reset(seriesModel, ecModel, api);
      if (res.progress) {
        res.progress({
          start: 0,
          end: data.count(),
          count: data.count()
        }, data);
      }
      // Not in large mode
      this._lineDraw.updateLayout();
      this._clearLayer(api);
    }
  };
  LinesView.prototype._updateLineDraw = function (data, seriesModel) {
    var lineDraw = this._lineDraw;
    var hasEffect = this._showEffect(seriesModel);
    var isPolyline = !!seriesModel.get('polyline');
    var pipelineContext = seriesModel.pipelineContext;
    var isLargeDraw = pipelineContext.large;
    {
      if (hasEffect && isLargeDraw) {
        console.warn('Large lines not support effect');
      }
    }
    if (!lineDraw || hasEffect !== this._hasEffet || isPolyline !== this._isPolyline || isLargeDraw !== this._isLargeDraw) {
      if (lineDraw) {
        lineDraw.remove();
      }
      lineDraw = this._lineDraw = isLargeDraw ? new LargeLineDraw$1() : new LineDraw$1(isPolyline ? hasEffect ? EffectPolyline$1 : Polyline$1 : hasEffect ? EffectLine$1 : Line$2);
      this._hasEffet = hasEffect;
      this._isPolyline = isPolyline;
      this._isLargeDraw = isLargeDraw;
    }
    this.group.add(lineDraw.group);
    return lineDraw;
  };
  LinesView.prototype._showEffect = function (seriesModel) {
    return !!seriesModel.get(['effect', 'show']);
  };
  LinesView.prototype._clearLayer = function (api) {
    // Not use motion when dragging or zooming
    var zr = api.getZr();
    var isSvg = zr.painter.getType() === 'svg';
    if (!isSvg && this._lastZlevel != null) {
      zr.painter.getLayer(this._lastZlevel).clear(true);
    }
  };
  LinesView.prototype.remove = function (ecModel, api) {
    this._lineDraw && this._lineDraw.remove();
    this._lineDraw = null;
    // Clear motion when lineDraw is removed
    this._clearLayer(api);
  };
  LinesView.prototype.dispose = function (ecModel, api) {
    this.remove(ecModel, api);
  };
  LinesView.type = 'lines';
  return LinesView;
}(ChartView$1);
var LinesView$1 = LinesView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Uint32Arr = typeof Uint32Array === 'undefined' ? Array : Uint32Array;
var Float64Arr = typeof Float64Array === 'undefined' ? Array : Float64Array;
function compatEc2(seriesOpt) {
  var data = seriesOpt.data;
  if (data && data[0] && data[0][0] && data[0][0].coord) {
    {
      console.warn('Lines data configuration has been changed to' + ' { coords:[[1,2],[2,3]] }');
    }
    seriesOpt.data = map$1(data, function (itemOpt) {
      var coords = [itemOpt[0].coord, itemOpt[1].coord];
      var target = {
        coords: coords
      };
      if (itemOpt[0].name) {
        target.fromName = itemOpt[0].name;
      }
      if (itemOpt[1].name) {
        target.toName = itemOpt[1].name;
      }
      return mergeAll([target, itemOpt[0], itemOpt[1]]);
    });
  }
}
var LinesSeriesModel = /** @class */function (_super) {
  __extends(LinesSeriesModel, _super);
  function LinesSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = LinesSeriesModel.type;
    _this.visualStyleAccessPath = 'lineStyle';
    _this.visualDrawType = 'stroke';
    return _this;
  }
  LinesSeriesModel.prototype.init = function (option) {
    // The input data may be null/undefined.
    option.data = option.data || [];
    // Not using preprocessor because mergeOption may not have series.type
    compatEc2(option);
    var result = this._processFlatCoordsArray(option.data);
    this._flatCoords = result.flatCoords;
    this._flatCoordsOffset = result.flatCoordsOffset;
    if (result.flatCoords) {
      option.data = new Float32Array(result.count);
    }
    _super.prototype.init.apply(this, arguments);
  };
  LinesSeriesModel.prototype.mergeOption = function (option) {
    compatEc2(option);
    if (option.data) {
      // Only update when have option data to merge.
      var result = this._processFlatCoordsArray(option.data);
      this._flatCoords = result.flatCoords;
      this._flatCoordsOffset = result.flatCoordsOffset;
      if (result.flatCoords) {
        option.data = new Float32Array(result.count);
      }
    }
    _super.prototype.mergeOption.apply(this, arguments);
  };
  LinesSeriesModel.prototype.appendData = function (params) {
    var result = this._processFlatCoordsArray(params.data);
    if (result.flatCoords) {
      if (!this._flatCoords) {
        this._flatCoords = result.flatCoords;
        this._flatCoordsOffset = result.flatCoordsOffset;
      } else {
        this._flatCoords = concatArray(this._flatCoords, result.flatCoords);
        this._flatCoordsOffset = concatArray(this._flatCoordsOffset, result.flatCoordsOffset);
      }
      params.data = new Float32Array(result.count);
    }
    this.getRawData().appendData(params.data);
  };
  LinesSeriesModel.prototype._getCoordsFromItemModel = function (idx) {
    var itemModel = this.getData().getItemModel(idx);
    var coords = itemModel.option instanceof Array ? itemModel.option : itemModel.getShallow('coords');
    {
      if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) {
        throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.');
      }
    }
    return coords;
  };
  LinesSeriesModel.prototype.getLineCoordsCount = function (idx) {
    if (this._flatCoordsOffset) {
      return this._flatCoordsOffset[idx * 2 + 1];
    } else {
      return this._getCoordsFromItemModel(idx).length;
    }
  };
  LinesSeriesModel.prototype.getLineCoords = function (idx, out) {
    if (this._flatCoordsOffset) {
      var offset = this._flatCoordsOffset[idx * 2];
      var len = this._flatCoordsOffset[idx * 2 + 1];
      for (var i = 0; i < len; i++) {
        out[i] = out[i] || [];
        out[i][0] = this._flatCoords[offset + i * 2];
        out[i][1] = this._flatCoords[offset + i * 2 + 1];
      }
      return len;
    } else {
      var coords = this._getCoordsFromItemModel(idx);
      for (var i = 0; i < coords.length; i++) {
        out[i] = out[i] || [];
        out[i][0] = coords[i][0];
        out[i][1] = coords[i][1];
      }
      return coords.length;
    }
  };
  LinesSeriesModel.prototype._processFlatCoordsArray = function (data) {
    var startOffset = 0;
    if (this._flatCoords) {
      startOffset = this._flatCoords.length;
    }
    // Stored as a typed array. In format
    // Points Count(2) | x | y | x | y | Points Count(3) | x |  y | x | y | x | y |
    if (isNumber(data[0])) {
      var len = data.length;
      // Store offset and len of each segment
      var coordsOffsetAndLenStorage = new Uint32Arr(len);
      var coordsStorage = new Float64Arr(len);
      var coordsCursor = 0;
      var offsetCursor = 0;
      var dataCount = 0;
      for (var i = 0; i < len;) {
        dataCount++;
        var count = data[i++];
        // Offset
        coordsOffsetAndLenStorage[offsetCursor++] = coordsCursor + startOffset;
        // Len
        coordsOffsetAndLenStorage[offsetCursor++] = count;
        for (var k = 0; k < count; k++) {
          var x = data[i++];
          var y = data[i++];
          coordsStorage[coordsCursor++] = x;
          coordsStorage[coordsCursor++] = y;
          if (i > len) {
            {
              throw new Error('Invalid data format.');
            }
          }
        }
      }
      return {
        flatCoordsOffset: new Uint32Array(coordsOffsetAndLenStorage.buffer, 0, offsetCursor),
        flatCoords: coordsStorage,
        count: dataCount
      };
    }
    return {
      flatCoordsOffset: null,
      flatCoords: null,
      count: data.length
    };
  };
  LinesSeriesModel.prototype.getInitialData = function (option, ecModel) {
    {
      var CoordSys = CoordinateSystem.get(option.coordinateSystem);
      if (!CoordSys) {
        throw new Error('Unknown coordinate system ' + option.coordinateSystem);
      }
    }
    var lineData = new SeriesData$1(['value'], this);
    lineData.hasItemOption = false;
    lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {
      // dataItem is simply coords
      if (dataItem instanceof Array) {
        return NaN;
      } else {
        lineData.hasItemOption = true;
        var value = dataItem.value;
        if (value != null) {
          return value instanceof Array ? value[dimIndex] : value;
        }
      }
    });
    return lineData;
  };
  LinesSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    var data = this.getData();
    var itemModel = data.getItemModel(dataIndex);
    var name = itemModel.get('name');
    if (name) {
      return name;
    }
    var fromName = itemModel.get('fromName');
    var toName = itemModel.get('toName');
    var nameArr = [];
    fromName != null && nameArr.push(fromName);
    toName != null && nameArr.push(toName);
    return createTooltipMarkup('nameValue', {
      name: nameArr.join(' > ')
    });
  };
  LinesSeriesModel.prototype.preventIncremental = function () {
    return !!this.get(['effect', 'show']);
  };
  LinesSeriesModel.prototype.getProgressive = function () {
    var progressive = this.option.progressive;
    if (progressive == null) {
      return this.option.large ? 1e4 : this.get('progressive');
    }
    return progressive;
  };
  LinesSeriesModel.prototype.getProgressiveThreshold = function () {
    var progressiveThreshold = this.option.progressiveThreshold;
    if (progressiveThreshold == null) {
      return this.option.large ? 2e4 : this.get('progressiveThreshold');
    }
    return progressiveThreshold;
  };
  LinesSeriesModel.prototype.getZLevelKey = function () {
    var effectModel = this.getModel('effect');
    var trailLength = effectModel.get('trailLength');
    return this.getData().count() > this.getProgressiveThreshold()
    // Each progressive series has individual key.
    ? this.id : effectModel.get('show') && trailLength > 0 ? trailLength + '' : '';
  };
  LinesSeriesModel.type = 'series.lines';
  LinesSeriesModel.dependencies = ['grid', 'polar', 'geo', 'calendar'];
  LinesSeriesModel.defaultOption = {
    coordinateSystem: 'geo',
    // zlevel: 0,
    z: 2,
    legendHoverLink: true,
    // Cartesian coordinate system
    xAxisIndex: 0,
    yAxisIndex: 0,
    symbol: ['none', 'none'],
    symbolSize: [10, 10],
    // Geo coordinate system
    geoIndex: 0,
    effect: {
      show: false,
      period: 4,
      constantSpeed: 0,
      symbol: 'circle',
      symbolSize: 3,
      loop: true,
      trailLength: 0.2
    },
    large: false,
    // Available when large is true
    largeThreshold: 2000,
    polyline: false,
    clip: true,
    label: {
      show: false,
      position: 'end'
      // distance: 5,
      // formatter: 标签文本格式器，同Tooltip.formatter，不支持异步回调
    },
    lineStyle: {
      opacity: 0.5
    }
  };
  return LinesSeriesModel;
}(SeriesModel$1);
var LinesSeriesModel$1 = LinesSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function normalize$3(a) {
  if (!(a instanceof Array)) {
    a = [a, a];
  }
  return a;
}
var linesVisual = {
  seriesType: 'lines',
  reset: function (seriesModel) {
    var symbolType = normalize$3(seriesModel.get('symbol'));
    var symbolSize = normalize$3(seriesModel.get('symbolSize'));
    var data = seriesModel.getData();
    data.setVisual('fromSymbol', symbolType && symbolType[0]);
    data.setVisual('toSymbol', symbolType && symbolType[1]);
    data.setVisual('fromSymbolSize', symbolSize && symbolSize[0]);
    data.setVisual('toSymbolSize', symbolSize && symbolSize[1]);
    function dataEach(data, idx) {
      var itemModel = data.getItemModel(idx);
      var symbolType = normalize$3(itemModel.getShallow('symbol', true));
      var symbolSize = normalize$3(itemModel.getShallow('symbolSize', true));
      symbolType[0] && data.setItemVisual(idx, 'fromSymbol', symbolType[0]);
      symbolType[1] && data.setItemVisual(idx, 'toSymbol', symbolType[1]);
      symbolSize[0] && data.setItemVisual(idx, 'fromSymbolSize', symbolSize[0]);
      symbolSize[1] && data.setItemVisual(idx, 'toSymbolSize', symbolSize[1]);
    }
    return {
      dataEach: data.hasItemOption ? dataEach : null
    };
  }
};
var linesVisual$1 = linesVisual;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$y(registers) {
  registers.registerChartView(LinesView$1);
  registers.registerSeriesModel(LinesSeriesModel$1);
  registers.registerLayout(linesLayout$1);
  registers.registerVisual(linesVisual$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var GRADIENT_LEVELS = 256;
var HeatmapLayer = /** @class */function () {
  function HeatmapLayer() {
    this.blurSize = 30;
    this.pointSize = 20;
    this.maxOpacity = 1;
    this.minOpacity = 0;
    this._gradientPixels = {
      inRange: null,
      outOfRange: null
    };
    var canvas = platformApi.createCanvas();
    this.canvas = canvas;
  }
  /**
   * Renders Heatmap and returns the rendered canvas
   * @param data array of data, each has x, y, value
   * @param width canvas width
   * @param height canvas height
   */
  HeatmapLayer.prototype.update = function (data, width, height, normalize, colorFunc, isInRange) {
    var brush = this._getBrush();
    var gradientInRange = this._getGradient(colorFunc, 'inRange');
    var gradientOutOfRange = this._getGradient(colorFunc, 'outOfRange');
    var r = this.pointSize + this.blurSize;
    var canvas = this.canvas;
    var ctx = canvas.getContext('2d');
    var len = data.length;
    canvas.width = width;
    canvas.height = height;
    for (var i = 0; i < len; ++i) {
      var p = data[i];
      var x = p[0];
      var y = p[1];
      var value = p[2];
      // calculate alpha using value
      var alpha = normalize(value);
      // draw with the circle brush with alpha
      ctx.globalAlpha = alpha;
      ctx.drawImage(brush, x - r, y - r);
    }
    if (!canvas.width || !canvas.height) {
      // Avoid "Uncaught DOMException: Failed to execute 'getImageData' on
      // 'CanvasRenderingContext2D': The source height is 0."
      return canvas;
    }
    // colorize the canvas using alpha value and set with gradient
    var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    var pixels = imageData.data;
    var offset = 0;
    var pixelLen = pixels.length;
    var minOpacity = this.minOpacity;
    var maxOpacity = this.maxOpacity;
    var diffOpacity = maxOpacity - minOpacity;
    while (offset < pixelLen) {
      var alpha = pixels[offset + 3] / 256;
      var gradientOffset = Math.floor(alpha * (GRADIENT_LEVELS - 1)) * 4;
      // Simple optimize to ignore the empty data
      if (alpha > 0) {
        var gradient = isInRange(alpha) ? gradientInRange : gradientOutOfRange;
        // Any alpha > 0 will be mapped to [minOpacity, maxOpacity]
        alpha > 0 && (alpha = alpha * diffOpacity + minOpacity);
        pixels[offset++] = gradient[gradientOffset];
        pixels[offset++] = gradient[gradientOffset + 1];
        pixels[offset++] = gradient[gradientOffset + 2];
        pixels[offset++] = gradient[gradientOffset + 3] * alpha * 256;
      } else {
        offset += 4;
      }
    }
    ctx.putImageData(imageData, 0, 0);
    return canvas;
  };
  /**
   * get canvas of a black circle brush used for canvas to draw later
   */
  HeatmapLayer.prototype._getBrush = function () {
    var brushCanvas = this._brushCanvas || (this._brushCanvas = platformApi.createCanvas());
    // set brush size
    var r = this.pointSize + this.blurSize;
    var d = r * 2;
    brushCanvas.width = d;
    brushCanvas.height = d;
    var ctx = brushCanvas.getContext('2d');
    ctx.clearRect(0, 0, d, d);
    // in order to render shadow without the distinct circle,
    // draw the distinct circle in an invisible place,
    // and use shadowOffset to draw shadow in the center of the canvas
    ctx.shadowOffsetX = d;
    ctx.shadowBlur = this.blurSize;
    // draw the shadow in black, and use alpha and shadow blur to generate
    // color in color map
    ctx.shadowColor = '#000';
    // draw circle in the left to the canvas
    ctx.beginPath();
    ctx.arc(-r, r, this.pointSize, 0, Math.PI * 2, true);
    ctx.closePath();
    ctx.fill();
    return brushCanvas;
  };
  /**
   * get gradient color map
   * @private
   */
  HeatmapLayer.prototype._getGradient = function (colorFunc, state) {
    var gradientPixels = this._gradientPixels;
    var pixelsSingleState = gradientPixels[state] || (gradientPixels[state] = new Uint8ClampedArray(256 * 4));
    var color = [0, 0, 0, 0];
    var off = 0;
    for (var i = 0; i < 256; i++) {
      colorFunc[state](i / 255, true, color);
      pixelsSingleState[off++] = color[0];
      pixelsSingleState[off++] = color[1];
      pixelsSingleState[off++] = color[2];
      pixelsSingleState[off++] = color[3];
    }
    return pixelsSingleState;
  };
  return HeatmapLayer;
}();
var HeatmapLayer$1 = HeatmapLayer;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function getIsInPiecewiseRange(dataExtent, pieceList, selected) {
  var dataSpan = dataExtent[1] - dataExtent[0];
  pieceList = map$1(pieceList, function (piece) {
    return {
      interval: [(piece.interval[0] - dataExtent[0]) / dataSpan, (piece.interval[1] - dataExtent[0]) / dataSpan]
    };
  });
  var len = pieceList.length;
  var lastIndex = 0;
  return function (val) {
    var i;
    // Try to find in the location of the last found
    for (i = lastIndex; i < len; i++) {
      var interval = pieceList[i].interval;
      if (interval[0] <= val && val <= interval[1]) {
        lastIndex = i;
        break;
      }
    }
    if (i === len) {
      // Not found, back interation
      for (i = lastIndex - 1; i >= 0; i--) {
        var interval = pieceList[i].interval;
        if (interval[0] <= val && val <= interval[1]) {
          lastIndex = i;
          break;
        }
      }
    }
    return i >= 0 && i < len && selected[i];
  };
}
function getIsInContinuousRange(dataExtent, range) {
  var dataSpan = dataExtent[1] - dataExtent[0];
  range = [(range[0] - dataExtent[0]) / dataSpan, (range[1] - dataExtent[0]) / dataSpan];
  return function (val) {
    return val >= range[0] && val <= range[1];
  };
}
function isGeoCoordSys(coordSys) {
  var dimensions = coordSys.dimensions;
  // Not use coordSys.type === 'geo' because coordSys maybe extended
  return dimensions[0] === 'lng' && dimensions[1] === 'lat';
}
var HeatmapView = /** @class */function (_super) {
  __extends(HeatmapView, _super);
  function HeatmapView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = HeatmapView.type;
    return _this;
  }
  HeatmapView.prototype.render = function (seriesModel, ecModel, api) {
    var visualMapOfThisSeries;
    ecModel.eachComponent('visualMap', function (visualMap) {
      visualMap.eachTargetSeries(function (targetSeries) {
        if (targetSeries === seriesModel) {
          visualMapOfThisSeries = visualMap;
        }
      });
    });
    {
      if (!visualMapOfThisSeries) {
        throw new Error('Heatmap must use with visualMap');
      }
    }
    // Clear previously rendered progressive elements.
    this._progressiveEls = null;
    this.group.removeAll();
    var coordSys = seriesModel.coordinateSystem;
    if (coordSys.type === 'cartesian2d' || coordSys.type === 'calendar') {
      this._renderOnCartesianAndCalendar(seriesModel, api, 0, seriesModel.getData().count());
    } else if (isGeoCoordSys(coordSys)) {
      this._renderOnGeo(coordSys, seriesModel, visualMapOfThisSeries, api);
    }
  };
  HeatmapView.prototype.incrementalPrepareRender = function (seriesModel, ecModel, api) {
    this.group.removeAll();
  };
  HeatmapView.prototype.incrementalRender = function (params, seriesModel, ecModel, api) {
    var coordSys = seriesModel.coordinateSystem;
    if (coordSys) {
      // geo does not support incremental rendering?
      if (isGeoCoordSys(coordSys)) {
        this.render(seriesModel, ecModel, api);
      } else {
        this._progressiveEls = [];
        this._renderOnCartesianAndCalendar(seriesModel, api, params.start, params.end, true);
      }
    }
  };
  HeatmapView.prototype.eachRendered = function (cb) {
    traverseElements(this._progressiveEls || this.group, cb);
  };
  HeatmapView.prototype._renderOnCartesianAndCalendar = function (seriesModel, api, start, end, incremental) {
    var coordSys = seriesModel.coordinateSystem;
    var isCartesian2d = isCoordinateSystemType(coordSys, 'cartesian2d');
    var width;
    var height;
    var xAxisExtent;
    var yAxisExtent;
    if (isCartesian2d) {
      var xAxis = coordSys.getAxis('x');
      var yAxis = coordSys.getAxis('y');
      {
        if (!(xAxis.type === 'category' && yAxis.type === 'category')) {
          throw new Error('Heatmap on cartesian must have two category axes');
        }
        if (!(xAxis.onBand && yAxis.onBand)) {
          throw new Error('Heatmap on cartesian must have two axes with boundaryGap true');
        }
      }
      // add 0.5px to avoid the gaps
      width = xAxis.getBandWidth() + .5;
      height = yAxis.getBandWidth() + .5;
      xAxisExtent = xAxis.scale.getExtent();
      yAxisExtent = yAxis.scale.getExtent();
    }
    var group = this.group;
    var data = seriesModel.getData();
    var emphasisStyle = seriesModel.getModel(['emphasis', 'itemStyle']).getItemStyle();
    var blurStyle = seriesModel.getModel(['blur', 'itemStyle']).getItemStyle();
    var selectStyle = seriesModel.getModel(['select', 'itemStyle']).getItemStyle();
    var borderRadius = seriesModel.get(['itemStyle', 'borderRadius']);
    var labelStatesModels = getLabelStatesModels(seriesModel);
    var emphasisModel = seriesModel.getModel('emphasis');
    var focus = emphasisModel.get('focus');
    var blurScope = emphasisModel.get('blurScope');
    var emphasisDisabled = emphasisModel.get('disabled');
    var dataDims = isCartesian2d ? [data.mapDimension('x'), data.mapDimension('y'), data.mapDimension('value')] : [data.mapDimension('time'), data.mapDimension('value')];
    for (var idx = start; idx < end; idx++) {
      var rect = void 0;
      var style = data.getItemVisual(idx, 'style');
      if (isCartesian2d) {
        var dataDimX = data.get(dataDims[0], idx);
        var dataDimY = data.get(dataDims[1], idx);
        // Ignore empty data and out of extent data
        if (isNaN(data.get(dataDims[2], idx)) || isNaN(dataDimX) || isNaN(dataDimY) || dataDimX < xAxisExtent[0] || dataDimX > xAxisExtent[1] || dataDimY < yAxisExtent[0] || dataDimY > yAxisExtent[1]) {
          continue;
        }
        var point = coordSys.dataToPoint([dataDimX, dataDimY]);
        rect = new Rect$3({
          shape: {
            x: point[0] - width / 2,
            y: point[1] - height / 2,
            width: width,
            height: height
          },
          style: style
        });
      } else {
        // Ignore empty data
        if (isNaN(data.get(dataDims[1], idx))) {
          continue;
        }
        rect = new Rect$3({
          z2: 1,
          shape: coordSys.dataToRect([data.get(dataDims[0], idx)]).contentShape,
          style: style
        });
      }
      // Optimization for large dataset
      if (data.hasItemOption) {
        var itemModel = data.getItemModel(idx);
        var emphasisModel_1 = itemModel.getModel('emphasis');
        emphasisStyle = emphasisModel_1.getModel('itemStyle').getItemStyle();
        blurStyle = itemModel.getModel(['blur', 'itemStyle']).getItemStyle();
        selectStyle = itemModel.getModel(['select', 'itemStyle']).getItemStyle();
        // Each item value struct in the data would be firstly
        // {
        //     itemStyle: { borderRadius: [30, 30] },
        //     value: [2022, 02, 22]
        // }
        borderRadius = itemModel.get(['itemStyle', 'borderRadius']);
        focus = emphasisModel_1.get('focus');
        blurScope = emphasisModel_1.get('blurScope');
        emphasisDisabled = emphasisModel_1.get('disabled');
        labelStatesModels = getLabelStatesModels(itemModel);
      }
      rect.shape.r = borderRadius;
      var rawValue = seriesModel.getRawValue(idx);
      var defaultText = '-';
      if (rawValue && rawValue[2] != null) {
        defaultText = rawValue[2] + '';
      }
      setLabelStyle(rect, labelStatesModels, {
        labelFetcher: seriesModel,
        labelDataIndex: idx,
        defaultOpacity: style.opacity,
        defaultText: defaultText
      });
      rect.ensureState('emphasis').style = emphasisStyle;
      rect.ensureState('blur').style = blurStyle;
      rect.ensureState('select').style = selectStyle;
      toggleHoverEmphasis(rect, focus, blurScope, emphasisDisabled);
      rect.incremental = incremental;
      // PENDING
      if (incremental) {
        // Rect must use hover layer if it's incremental.
        rect.states.emphasis.hoverLayer = true;
      }
      group.add(rect);
      data.setItemGraphicEl(idx, rect);
      if (this._progressiveEls) {
        this._progressiveEls.push(rect);
      }
    }
  };
  HeatmapView.prototype._renderOnGeo = function (geo, seriesModel, visualMapModel, api) {
    var inRangeVisuals = visualMapModel.targetVisuals.inRange;
    var outOfRangeVisuals = visualMapModel.targetVisuals.outOfRange;
    // if (!visualMapping) {
    //     throw new Error('Data range must have color visuals');
    // }
    var data = seriesModel.getData();
    var hmLayer = this._hmLayer || this._hmLayer || new HeatmapLayer$1();
    hmLayer.blurSize = seriesModel.get('blurSize');
    hmLayer.pointSize = seriesModel.get('pointSize');
    hmLayer.minOpacity = seriesModel.get('minOpacity');
    hmLayer.maxOpacity = seriesModel.get('maxOpacity');
    var rect = geo.getViewRect().clone();
    var roamTransform = geo.getRoamTransform();
    rect.applyTransform(roamTransform);
    // Clamp on viewport
    var x = Math.max(rect.x, 0);
    var y = Math.max(rect.y, 0);
    var x2 = Math.min(rect.width + rect.x, api.getWidth());
    var y2 = Math.min(rect.height + rect.y, api.getHeight());
    var width = x2 - x;
    var height = y2 - y;
    var dims = [data.mapDimension('lng'), data.mapDimension('lat'), data.mapDimension('value')];
    var points = data.mapArray(dims, function (lng, lat, value) {
      var pt = geo.dataToPoint([lng, lat]);
      pt[0] -= x;
      pt[1] -= y;
      pt.push(value);
      return pt;
    });
    var dataExtent = visualMapModel.getExtent();
    var isInRange = visualMapModel.type === 'visualMap.continuous' ? getIsInContinuousRange(dataExtent, visualMapModel.option.range) : getIsInPiecewiseRange(dataExtent, visualMapModel.getPieceList(), visualMapModel.option.selected);
    hmLayer.update(points, width, height, inRangeVisuals.color.getNormalizer(), {
      inRange: inRangeVisuals.color.getColorMapper(),
      outOfRange: outOfRangeVisuals.color.getColorMapper()
    }, isInRange);
    var img = new ZRImage$1({
      style: {
        width: width,
        height: height,
        x: x,
        y: y,
        image: hmLayer.canvas
      },
      silent: true
    });
    this.group.add(img);
  };
  HeatmapView.type = 'heatmap';
  return HeatmapView;
}(ChartView$1);
var HeatmapView$1 = HeatmapView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var HeatmapSeriesModel = /** @class */function (_super) {
  __extends(HeatmapSeriesModel, _super);
  function HeatmapSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = HeatmapSeriesModel.type;
    return _this;
  }
  HeatmapSeriesModel.prototype.getInitialData = function (option, ecModel) {
    return createSeriesData(null, this, {
      generateCoord: 'value'
    });
  };
  HeatmapSeriesModel.prototype.preventIncremental = function () {
    var coordSysCreator = CoordinateSystem.get(this.get('coordinateSystem'));
    if (coordSysCreator && coordSysCreator.dimensions) {
      return coordSysCreator.dimensions[0] === 'lng' && coordSysCreator.dimensions[1] === 'lat';
    }
  };
  HeatmapSeriesModel.type = 'series.heatmap';
  HeatmapSeriesModel.dependencies = ['grid', 'geo', 'calendar'];
  HeatmapSeriesModel.defaultOption = {
    coordinateSystem: 'cartesian2d',
    // zlevel: 0,
    z: 2,
    // Cartesian coordinate system
    // xAxisIndex: 0,
    // yAxisIndex: 0,
    // Geo coordinate system
    geoIndex: 0,
    blurSize: 30,
    pointSize: 20,
    maxOpacity: 1,
    minOpacity: 0,
    select: {
      itemStyle: {
        borderColor: '#212121'
      }
    }
  };
  return HeatmapSeriesModel;
}(SeriesModel$1);
var HeatmapSeriesModel$1 = HeatmapSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$x(registers) {
  registers.registerChartView(HeatmapView$1);
  registers.registerSeriesModel(HeatmapSeriesModel$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var BAR_BORDER_WIDTH_QUERY = ['itemStyle', 'borderWidth'];
// index: +isHorizontal
var LAYOUT_ATTRS = [{
  xy: 'x',
  wh: 'width',
  index: 0,
  posDesc: ['left', 'right']
}, {
  xy: 'y',
  wh: 'height',
  index: 1,
  posDesc: ['top', 'bottom']
}];
var pathForLineWidth = new Circle$1();
var PictorialBarView = /** @class */function (_super) {
  __extends(PictorialBarView, _super);
  function PictorialBarView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = PictorialBarView.type;
    return _this;
  }
  PictorialBarView.prototype.render = function (seriesModel, ecModel, api) {
    var group = this.group;
    var data = seriesModel.getData();
    var oldData = this._data;
    var cartesian = seriesModel.coordinateSystem;
    var baseAxis = cartesian.getBaseAxis();
    var isHorizontal = baseAxis.isHorizontal();
    var coordSysRect = cartesian.master.getRect();
    var opt = {
      ecSize: {
        width: api.getWidth(),
        height: api.getHeight()
      },
      seriesModel: seriesModel,
      coordSys: cartesian,
      coordSysExtent: [[coordSysRect.x, coordSysRect.x + coordSysRect.width], [coordSysRect.y, coordSysRect.y + coordSysRect.height]],
      isHorizontal: isHorizontal,
      valueDim: LAYOUT_ATTRS[+isHorizontal],
      categoryDim: LAYOUT_ATTRS[1 - +isHorizontal]
    };
    data.diff(oldData).add(function (dataIndex) {
      if (!data.hasValue(dataIndex)) {
        return;
      }
      var itemModel = getItemModel(data, dataIndex);
      var symbolMeta = getSymbolMeta(data, dataIndex, itemModel, opt);
      var bar = createBar(data, opt, symbolMeta);
      data.setItemGraphicEl(dataIndex, bar);
      group.add(bar);
      updateCommon(bar, opt, symbolMeta);
    }).update(function (newIndex, oldIndex) {
      var bar = oldData.getItemGraphicEl(oldIndex);
      if (!data.hasValue(newIndex)) {
        group.remove(bar);
        return;
      }
      var itemModel = getItemModel(data, newIndex);
      var symbolMeta = getSymbolMeta(data, newIndex, itemModel, opt);
      var pictorialShapeStr = getShapeStr(data, symbolMeta);
      if (bar && pictorialShapeStr !== bar.__pictorialShapeStr) {
        group.remove(bar);
        data.setItemGraphicEl(newIndex, null);
        bar = null;
      }
      if (bar) {
        updateBar(bar, opt, symbolMeta);
      } else {
        bar = createBar(data, opt, symbolMeta, true);
      }
      data.setItemGraphicEl(newIndex, bar);
      bar.__pictorialSymbolMeta = symbolMeta;
      // Add back
      group.add(bar);
      updateCommon(bar, opt, symbolMeta);
    }).remove(function (dataIndex) {
      var bar = oldData.getItemGraphicEl(dataIndex);
      bar && removeBar(oldData, dataIndex, bar.__pictorialSymbolMeta.animationModel, bar);
    }).execute();
    // Do clipping
    var clipPath = seriesModel.get('clip', true) ? createClipPath(seriesModel.coordinateSystem, false, seriesModel) : null;
    if (clipPath) {
      group.setClipPath(clipPath);
    } else {
      group.removeClipPath();
    }
    this._data = data;
    return this.group;
  };
  PictorialBarView.prototype.remove = function (ecModel, api) {
    var group = this.group;
    var data = this._data;
    if (ecModel.get('animation')) {
      if (data) {
        data.eachItemGraphicEl(function (bar) {
          removeBar(data, getECData(bar).dataIndex, ecModel, bar);
        });
      }
    } else {
      group.removeAll();
    }
  };
  PictorialBarView.type = 'pictorialBar';
  return PictorialBarView;
}(ChartView$1);
// Set or calculate default value about symbol, and calculate layout info.
function getSymbolMeta(data, dataIndex, itemModel, opt) {
  var layout = data.getItemLayout(dataIndex);
  var symbolRepeat = itemModel.get('symbolRepeat');
  var symbolClip = itemModel.get('symbolClip');
  var symbolPosition = itemModel.get('symbolPosition') || 'start';
  var symbolRotate = itemModel.get('symbolRotate');
  var rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
  var symbolPatternSize = itemModel.get('symbolPatternSize') || 2;
  var isAnimationEnabled = itemModel.isAnimationEnabled();
  var symbolMeta = {
    dataIndex: dataIndex,
    layout: layout,
    itemModel: itemModel,
    symbolType: data.getItemVisual(dataIndex, 'symbol') || 'circle',
    style: data.getItemVisual(dataIndex, 'style'),
    symbolClip: symbolClip,
    symbolRepeat: symbolRepeat,
    symbolRepeatDirection: itemModel.get('symbolRepeatDirection'),
    symbolPatternSize: symbolPatternSize,
    rotation: rotation,
    animationModel: isAnimationEnabled ? itemModel : null,
    hoverScale: isAnimationEnabled && itemModel.get(['emphasis', 'scale']),
    z2: itemModel.getShallow('z', true) || 0
  };
  prepareBarLength(itemModel, symbolRepeat, layout, opt, symbolMeta);
  prepareSymbolSize(data, dataIndex, layout, symbolRepeat, symbolClip, symbolMeta.boundingLength, symbolMeta.pxSign, symbolPatternSize, opt, symbolMeta);
  prepareLineWidth(itemModel, symbolMeta.symbolScale, rotation, opt, symbolMeta);
  var symbolSize = symbolMeta.symbolSize;
  var symbolOffset = normalizeSymbolOffset(itemModel.get('symbolOffset'), symbolSize);
  prepareLayoutInfo(itemModel, symbolSize, layout, symbolRepeat, symbolClip, symbolOffset, symbolPosition, symbolMeta.valueLineWidth, symbolMeta.boundingLength, symbolMeta.repeatCutLength, opt, symbolMeta);
  return symbolMeta;
}
// bar length can be negative.
function prepareBarLength(itemModel, symbolRepeat, layout, opt, outputSymbolMeta) {
  var valueDim = opt.valueDim;
  var symbolBoundingData = itemModel.get('symbolBoundingData');
  var valueAxis = opt.coordSys.getOtherAxis(opt.coordSys.getBaseAxis());
  var zeroPx = valueAxis.toGlobalCoord(valueAxis.dataToCoord(0));
  var pxSignIdx = 1 - +(layout[valueDim.wh] <= 0);
  var boundingLength;
  if (isArray$1(symbolBoundingData)) {
    var symbolBoundingExtent = [convertToCoordOnAxis(valueAxis, symbolBoundingData[0]) - zeroPx, convertToCoordOnAxis(valueAxis, symbolBoundingData[1]) - zeroPx];
    symbolBoundingExtent[1] < symbolBoundingExtent[0] && symbolBoundingExtent.reverse();
    boundingLength = symbolBoundingExtent[pxSignIdx];
  } else if (symbolBoundingData != null) {
    boundingLength = convertToCoordOnAxis(valueAxis, symbolBoundingData) - zeroPx;
  } else if (symbolRepeat) {
    boundingLength = opt.coordSysExtent[valueDim.index][pxSignIdx] - zeroPx;
  } else {
    boundingLength = layout[valueDim.wh];
  }
  outputSymbolMeta.boundingLength = boundingLength;
  if (symbolRepeat) {
    outputSymbolMeta.repeatCutLength = layout[valueDim.wh];
  }
  // if 'pxSign' means sign of pixel,  it can't be zero, or symbolScale will be zero
  // and when borderWidth be settled, the actual linewidth will be NaN
  var isXAxis = valueDim.xy === 'x';
  var isInverse = valueAxis.inverse;
  outputSymbolMeta.pxSign = isXAxis && !isInverse || !isXAxis && isInverse ? boundingLength >= 0 ? 1 : -1 : boundingLength > 0 ? 1 : -1;
}
function convertToCoordOnAxis(axis, value) {
  return axis.toGlobalCoord(axis.dataToCoord(axis.scale.parse(value)));
}
// Support ['100%', '100%']
function prepareSymbolSize(data, dataIndex, layout, symbolRepeat, symbolClip, boundingLength, pxSign, symbolPatternSize, opt, outputSymbolMeta) {
  var valueDim = opt.valueDim;
  var categoryDim = opt.categoryDim;
  var categorySize = Math.abs(layout[categoryDim.wh]);
  var symbolSize = data.getItemVisual(dataIndex, 'symbolSize');
  var parsedSymbolSize;
  if (isArray$1(symbolSize)) {
    parsedSymbolSize = symbolSize.slice();
  } else {
    if (symbolSize == null) {
      // will parse to number below
      parsedSymbolSize = ['100%', '100%'];
    } else {
      parsedSymbolSize = [symbolSize, symbolSize];
    }
  }
  // Note: percentage symbolSize (like '100%') do not consider lineWidth, because it is
  // to complicated to calculate real percent value if considering scaled lineWidth.
  // So the actual size will bigger than layout size if lineWidth is bigger than zero,
  // which can be tolerated in pictorial chart.
  parsedSymbolSize[categoryDim.index] = parsePercent(parsedSymbolSize[categoryDim.index], categorySize);
  parsedSymbolSize[valueDim.index] = parsePercent(parsedSymbolSize[valueDim.index], symbolRepeat ? categorySize : Math.abs(boundingLength));
  outputSymbolMeta.symbolSize = parsedSymbolSize;
  // If x or y is less than zero, show reversed shape.
  var symbolScale = outputSymbolMeta.symbolScale = [parsedSymbolSize[0] / symbolPatternSize, parsedSymbolSize[1] / symbolPatternSize];
  // Follow convention, 'right' and 'top' is the normal scale.
  symbolScale[valueDim.index] *= (opt.isHorizontal ? -1 : 1) * pxSign;
}
function prepareLineWidth(itemModel, symbolScale, rotation, opt, outputSymbolMeta) {
  // In symbols are drawn with scale, so do not need to care about the case that width
  // or height are too small. But symbol use strokeNoScale, where acture lineWidth should
  // be calculated.
  var valueLineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
  if (valueLineWidth) {
    pathForLineWidth.attr({
      scaleX: symbolScale[0],
      scaleY: symbolScale[1],
      rotation: rotation
    });
    pathForLineWidth.updateTransform();
    valueLineWidth /= pathForLineWidth.getLineScale();
    valueLineWidth *= symbolScale[opt.valueDim.index];
  }
  outputSymbolMeta.valueLineWidth = valueLineWidth || 0;
}
function prepareLayoutInfo(itemModel, symbolSize, layout, symbolRepeat, symbolClip, symbolOffset, symbolPosition, valueLineWidth, boundingLength, repeatCutLength, opt, outputSymbolMeta) {
  var categoryDim = opt.categoryDim;
  var valueDim = opt.valueDim;
  var pxSign = outputSymbolMeta.pxSign;
  var unitLength = Math.max(symbolSize[valueDim.index] + valueLineWidth, 0);
  var pathLen = unitLength;
  // Note: rotation will not effect the layout of symbols, because user may
  // want symbols to rotate on its center, which should not be translated
  // when rotating.
  if (symbolRepeat) {
    var absBoundingLength = Math.abs(boundingLength);
    var symbolMargin = retrieve(itemModel.get('symbolMargin'), '15%') + '';
    var hasEndGap = false;
    if (symbolMargin.lastIndexOf('!') === symbolMargin.length - 1) {
      hasEndGap = true;
      symbolMargin = symbolMargin.slice(0, symbolMargin.length - 1);
    }
    var symbolMarginNumeric = parsePercent(symbolMargin, symbolSize[valueDim.index]);
    var uLenWithMargin = Math.max(unitLength + symbolMarginNumeric * 2, 0);
    // When symbol margin is less than 0, margin at both ends will be subtracted
    // to ensure that all of the symbols will not be overflow the given area.
    var endFix = hasEndGap ? 0 : symbolMarginNumeric * 2;
    // Both final repeatTimes and final symbolMarginNumeric area calculated based on
    // boundingLength.
    var repeatSpecified = isNumeric(symbolRepeat);
    var repeatTimes = repeatSpecified ? symbolRepeat : toIntTimes((absBoundingLength + endFix) / uLenWithMargin);
    // Adjust calculate margin, to ensure each symbol is displayed
    // entirely in the given layout area.
    var mDiff = absBoundingLength - repeatTimes * unitLength;
    symbolMarginNumeric = mDiff / 2 / (hasEndGap ? repeatTimes : Math.max(repeatTimes - 1, 1));
    uLenWithMargin = unitLength + symbolMarginNumeric * 2;
    endFix = hasEndGap ? 0 : symbolMarginNumeric * 2;
    // Update repeatTimes when not all symbol will be shown.
    if (!repeatSpecified && symbolRepeat !== 'fixed') {
      repeatTimes = repeatCutLength ? toIntTimes((Math.abs(repeatCutLength) + endFix) / uLenWithMargin) : 0;
    }
    pathLen = repeatTimes * uLenWithMargin - endFix;
    outputSymbolMeta.repeatTimes = repeatTimes;
    outputSymbolMeta.symbolMargin = symbolMarginNumeric;
  }
  var sizeFix = pxSign * (pathLen / 2);
  var pathPosition = outputSymbolMeta.pathPosition = [];
  pathPosition[categoryDim.index] = layout[categoryDim.wh] / 2;
  pathPosition[valueDim.index] = symbolPosition === 'start' ? sizeFix : symbolPosition === 'end' ? boundingLength - sizeFix : boundingLength / 2; // 'center'
  if (symbolOffset) {
    pathPosition[0] += symbolOffset[0];
    pathPosition[1] += symbolOffset[1];
  }
  var bundlePosition = outputSymbolMeta.bundlePosition = [];
  bundlePosition[categoryDim.index] = layout[categoryDim.xy];
  bundlePosition[valueDim.index] = layout[valueDim.xy];
  var barRectShape = outputSymbolMeta.barRectShape = extend({}, layout);
  barRectShape[valueDim.wh] = pxSign * Math.max(Math.abs(layout[valueDim.wh]), Math.abs(pathPosition[valueDim.index] + sizeFix));
  barRectShape[categoryDim.wh] = layout[categoryDim.wh];
  var clipShape = outputSymbolMeta.clipShape = {};
  // Consider that symbol may be overflow layout rect.
  clipShape[categoryDim.xy] = -layout[categoryDim.xy];
  clipShape[categoryDim.wh] = opt.ecSize[categoryDim.wh];
  clipShape[valueDim.xy] = 0;
  clipShape[valueDim.wh] = layout[valueDim.wh];
}
function createPath(symbolMeta) {
  var symbolPatternSize = symbolMeta.symbolPatternSize;
  var path = createSymbol$1(
  // Consider texture img, make a big size.
  symbolMeta.symbolType, -symbolPatternSize / 2, -symbolPatternSize / 2, symbolPatternSize, symbolPatternSize);
  path.attr({
    culling: true
  });
  path.type !== 'image' && path.setStyle({
    strokeNoScale: true
  });
  return path;
}
function createOrUpdateRepeatSymbols(bar, opt, symbolMeta, isUpdate) {
  var bundle = bar.__pictorialBundle;
  var symbolSize = symbolMeta.symbolSize;
  var valueLineWidth = symbolMeta.valueLineWidth;
  var pathPosition = symbolMeta.pathPosition;
  var valueDim = opt.valueDim;
  var repeatTimes = symbolMeta.repeatTimes || 0;
  var index = 0;
  var unit = symbolSize[opt.valueDim.index] + valueLineWidth + symbolMeta.symbolMargin * 2;
  eachPath(bar, function (path) {
    path.__pictorialAnimationIndex = index;
    path.__pictorialRepeatTimes = repeatTimes;
    if (index < repeatTimes) {
      updateAttr(path, null, makeTarget(index), symbolMeta, isUpdate);
    } else {
      updateAttr(path, null, {
        scaleX: 0,
        scaleY: 0
      }, symbolMeta, isUpdate, function () {
        bundle.remove(path);
      });
    }
    // updateHoverAnimation(path, symbolMeta);
    index++;
  });
  for (; index < repeatTimes; index++) {
    var path = createPath(symbolMeta);
    path.__pictorialAnimationIndex = index;
    path.__pictorialRepeatTimes = repeatTimes;
    bundle.add(path);
    var target = makeTarget(index);
    updateAttr(path, {
      x: target.x,
      y: target.y,
      scaleX: 0,
      scaleY: 0
    }, {
      scaleX: target.scaleX,
      scaleY: target.scaleY,
      rotation: target.rotation
    }, symbolMeta, isUpdate);
  }
  function makeTarget(index) {
    var position = pathPosition.slice();
    // (start && pxSign > 0) || (end && pxSign < 0): i = repeatTimes - index
    // Otherwise: i = index;
    var pxSign = symbolMeta.pxSign;
    var i = index;
    if (symbolMeta.symbolRepeatDirection === 'start' ? pxSign > 0 : pxSign < 0) {
      i = repeatTimes - 1 - index;
    }
    position[valueDim.index] = unit * (i - repeatTimes / 2 + 0.5) + pathPosition[valueDim.index];
    return {
      x: position[0],
      y: position[1],
      scaleX: symbolMeta.symbolScale[0],
      scaleY: symbolMeta.symbolScale[1],
      rotation: symbolMeta.rotation
    };
  }
}
function createOrUpdateSingleSymbol(bar, opt, symbolMeta, isUpdate) {
  var bundle = bar.__pictorialBundle;
  var mainPath = bar.__pictorialMainPath;
  if (!mainPath) {
    mainPath = bar.__pictorialMainPath = createPath(symbolMeta);
    bundle.add(mainPath);
    updateAttr(mainPath, {
      x: symbolMeta.pathPosition[0],
      y: symbolMeta.pathPosition[1],
      scaleX: 0,
      scaleY: 0,
      rotation: symbolMeta.rotation
    }, {
      scaleX: symbolMeta.symbolScale[0],
      scaleY: symbolMeta.symbolScale[1]
    }, symbolMeta, isUpdate);
  } else {
    updateAttr(mainPath, null, {
      x: symbolMeta.pathPosition[0],
      y: symbolMeta.pathPosition[1],
      scaleX: symbolMeta.symbolScale[0],
      scaleY: symbolMeta.symbolScale[1],
      rotation: symbolMeta.rotation
    }, symbolMeta, isUpdate);
  }
}
// bar rect is used for label.
function createOrUpdateBarRect(bar, symbolMeta, isUpdate) {
  var rectShape = extend({}, symbolMeta.barRectShape);
  var barRect = bar.__pictorialBarRect;
  if (!barRect) {
    barRect = bar.__pictorialBarRect = new Rect$3({
      z2: 2,
      shape: rectShape,
      silent: true,
      style: {
        stroke: 'transparent',
        fill: 'transparent',
        lineWidth: 0
      }
    });
    barRect.disableMorphing = true;
    bar.add(barRect);
  } else {
    updateAttr(barRect, null, {
      shape: rectShape
    }, symbolMeta, isUpdate);
  }
}
function createOrUpdateClip(bar, opt, symbolMeta, isUpdate) {
  // If not clip, symbol will be remove and rebuilt.
  if (symbolMeta.symbolClip) {
    var clipPath = bar.__pictorialClipPath;
    var clipShape = extend({}, symbolMeta.clipShape);
    var valueDim = opt.valueDim;
    var animationModel = symbolMeta.animationModel;
    var dataIndex = symbolMeta.dataIndex;
    if (clipPath) {
      updateProps$1(clipPath, {
        shape: clipShape
      }, animationModel, dataIndex);
    } else {
      clipShape[valueDim.wh] = 0;
      clipPath = new Rect$3({
        shape: clipShape
      });
      bar.__pictorialBundle.setClipPath(clipPath);
      bar.__pictorialClipPath = clipPath;
      var target = {};
      target[valueDim.wh] = symbolMeta.clipShape[valueDim.wh];
      graphic[isUpdate ? 'updateProps' : 'initProps'](clipPath, {
        shape: target
      }, animationModel, dataIndex);
    }
  }
}
function getItemModel(data, dataIndex) {
  var itemModel = data.getItemModel(dataIndex);
  itemModel.getAnimationDelayParams = getAnimationDelayParams;
  itemModel.isAnimationEnabled = isAnimationEnabled;
  return itemModel;
}
function getAnimationDelayParams(path) {
  // The order is the same as the z-order, see `symbolRepeatDiretion`.
  return {
    index: path.__pictorialAnimationIndex,
    count: path.__pictorialRepeatTimes
  };
}
function isAnimationEnabled() {
  // `animation` prop can be set on itemModel in pictorial bar chart.
  return this.parentModel.isAnimationEnabled() && !!this.getShallow('animation');
}
function createBar(data, opt, symbolMeta, isUpdate) {
  // bar is the main element for each data.
  var bar = new Group$5();
  // bundle is used for location and clip.
  var bundle = new Group$5();
  bar.add(bundle);
  bar.__pictorialBundle = bundle;
  bundle.x = symbolMeta.bundlePosition[0];
  bundle.y = symbolMeta.bundlePosition[1];
  if (symbolMeta.symbolRepeat) {
    createOrUpdateRepeatSymbols(bar, opt, symbolMeta);
  } else {
    createOrUpdateSingleSymbol(bar, opt, symbolMeta);
  }
  createOrUpdateBarRect(bar, symbolMeta, isUpdate);
  createOrUpdateClip(bar, opt, symbolMeta, isUpdate);
  bar.__pictorialShapeStr = getShapeStr(data, symbolMeta);
  bar.__pictorialSymbolMeta = symbolMeta;
  return bar;
}
function updateBar(bar, opt, symbolMeta) {
  var animationModel = symbolMeta.animationModel;
  var dataIndex = symbolMeta.dataIndex;
  var bundle = bar.__pictorialBundle;
  updateProps$1(bundle, {
    x: symbolMeta.bundlePosition[0],
    y: symbolMeta.bundlePosition[1]
  }, animationModel, dataIndex);
  if (symbolMeta.symbolRepeat) {
    createOrUpdateRepeatSymbols(bar, opt, symbolMeta, true);
  } else {
    createOrUpdateSingleSymbol(bar, opt, symbolMeta, true);
  }
  createOrUpdateBarRect(bar, symbolMeta, true);
  createOrUpdateClip(bar, opt, symbolMeta, true);
}
function removeBar(data, dataIndex, animationModel, bar) {
  // Not show text when animating
  var labelRect = bar.__pictorialBarRect;
  labelRect && labelRect.removeTextContent();
  var paths = [];
  eachPath(bar, function (path) {
    paths.push(path);
  });
  bar.__pictorialMainPath && paths.push(bar.__pictorialMainPath);
  // I do not find proper remove animation for clip yet.
  bar.__pictorialClipPath && (animationModel = null);
  each$f(paths, function (path) {
    removeElement(path, {
      scaleX: 0,
      scaleY: 0
    }, animationModel, dataIndex, function () {
      bar.parent && bar.parent.remove(bar);
    });
  });
  data.setItemGraphicEl(dataIndex, null);
}
function getShapeStr(data, symbolMeta) {
  return [data.getItemVisual(symbolMeta.dataIndex, 'symbol') || 'none', !!symbolMeta.symbolRepeat, !!symbolMeta.symbolClip].join(':');
}
function eachPath(bar, cb, context) {
  // Do not use Group#eachChild, because it do not support remove.
  each$f(bar.__pictorialBundle.children(), function (el) {
    el !== bar.__pictorialBarRect && cb.call(context, el);
  });
}
function updateAttr(el, immediateAttrs, animationAttrs, symbolMeta, isUpdate, cb) {
  immediateAttrs && el.attr(immediateAttrs);
  // when symbolCip used, only clip path has init animation, otherwise it would be weird effect.
  if (symbolMeta.symbolClip && !isUpdate) {
    animationAttrs && el.attr(animationAttrs);
  } else {
    animationAttrs && graphic[isUpdate ? 'updateProps' : 'initProps'](el, animationAttrs, symbolMeta.animationModel, symbolMeta.dataIndex, cb);
  }
}
function updateCommon(bar, opt, symbolMeta) {
  var dataIndex = symbolMeta.dataIndex;
  var itemModel = symbolMeta.itemModel;
  // Color must be excluded.
  // Because symbol provide setColor individually to set fill and stroke
  var emphasisModel = itemModel.getModel('emphasis');
  var emphasisStyle = emphasisModel.getModel('itemStyle').getItemStyle();
  var blurStyle = itemModel.getModel(['blur', 'itemStyle']).getItemStyle();
  var selectStyle = itemModel.getModel(['select', 'itemStyle']).getItemStyle();
  var cursorStyle = itemModel.getShallow('cursor');
  var focus = emphasisModel.get('focus');
  var blurScope = emphasisModel.get('blurScope');
  var hoverScale = emphasisModel.get('scale');
  eachPath(bar, function (path) {
    if (path instanceof ZRImage$1) {
      var pathStyle = path.style;
      path.useStyle(extend({
        // TODO other properties like dx, dy ?
        image: pathStyle.image,
        x: pathStyle.x,
        y: pathStyle.y,
        width: pathStyle.width,
        height: pathStyle.height
      }, symbolMeta.style));
    } else {
      path.useStyle(symbolMeta.style);
    }
    var emphasisState = path.ensureState('emphasis');
    emphasisState.style = emphasisStyle;
    if (hoverScale) {
      // NOTE: Must after scale is set after updateAttr
      emphasisState.scaleX = path.scaleX * 1.1;
      emphasisState.scaleY = path.scaleY * 1.1;
    }
    path.ensureState('blur').style = blurStyle;
    path.ensureState('select').style = selectStyle;
    cursorStyle && (path.cursor = cursorStyle);
    path.z2 = symbolMeta.z2;
  });
  var barPositionOutside = opt.valueDim.posDesc[+(symbolMeta.boundingLength > 0)];
  var barRect = bar.__pictorialBarRect;
  barRect.ignoreClip = true;
  setLabelStyle(barRect, getLabelStatesModels(itemModel), {
    labelFetcher: opt.seriesModel,
    labelDataIndex: dataIndex,
    defaultText: getDefaultLabel(opt.seriesModel.getData(), dataIndex),
    inheritColor: symbolMeta.style.fill,
    defaultOpacity: symbolMeta.style.opacity,
    defaultOutsidePosition: barPositionOutside
  });
  toggleHoverEmphasis(bar, focus, blurScope, emphasisModel.get('disabled'));
}
function toIntTimes(times) {
  var roundedTimes = Math.round(times);
  // Escapse accurate error
  return Math.abs(times - roundedTimes) < 1e-4 ? roundedTimes : Math.ceil(times);
}
var PictorialBarView$1 = PictorialBarView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PictorialBarSeriesModel = /** @class */function (_super) {
  __extends(PictorialBarSeriesModel, _super);
  function PictorialBarSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = PictorialBarSeriesModel.type;
    _this.hasSymbolVisual = true;
    _this.defaultSymbol = 'roundRect';
    return _this;
  }
  PictorialBarSeriesModel.prototype.getInitialData = function (option) {
    // Disable stack.
    option.stack = null;
    return _super.prototype.getInitialData.apply(this, arguments);
  };
  PictorialBarSeriesModel.type = 'series.pictorialBar';
  PictorialBarSeriesModel.dependencies = ['grid'];
  PictorialBarSeriesModel.defaultOption = inheritDefaultOption(BaseBarSeriesModel$1.defaultOption, {
    symbol: 'circle',
    symbolSize: null,
    symbolRotate: null,
    symbolPosition: null,
    symbolOffset: null,
    symbolMargin: null,
    symbolRepeat: false,
    symbolRepeatDirection: 'end',
    symbolClip: false,
    symbolBoundingData: null,
    symbolPatternSize: 400,
    barGap: '-100%',
    // Pictorial bar do not clip by default because in many cases
    // xAxis and yAxis are not displayed and it's expected not to clip
    clip: false,
    // z can be set in data item, which is z2 actually.
    // Disable progressive
    progressive: 0,
    emphasis: {
      // By default pictorialBar do not hover scale. Hover scale is not suitable
      // for the case that both has foreground and background.
      scale: false
    },
    select: {
      itemStyle: {
        borderColor: '#212121'
      }
    }
  });
  return PictorialBarSeriesModel;
}(BaseBarSeriesModel$1);
var PictorialBarSeriesModel$1 = PictorialBarSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$w(registers) {
  registers.registerChartView(PictorialBarView$1);
  registers.registerSeriesModel(PictorialBarSeriesModel$1);
  registers.registerLayout(registers.PRIORITY.VISUAL.LAYOUT, curry$1(layout$3, 'pictorialBar'));
  // Do layout after other overall layout, which can prepare some information.
  registers.registerLayout(registers.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT, createProgressiveLayout('pictorialBar'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ThemeRiverView = /** @class */function (_super) {
  __extends(ThemeRiverView, _super);
  function ThemeRiverView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ThemeRiverView.type;
    _this._layers = [];
    return _this;
  }
  ThemeRiverView.prototype.render = function (seriesModel, ecModel, api) {
    var data = seriesModel.getData();
    var self = this;
    var group = this.group;
    var layersSeries = seriesModel.getLayerSeries();
    var layoutInfo = data.getLayout('layoutInfo');
    var rect = layoutInfo.rect;
    var boundaryGap = layoutInfo.boundaryGap;
    group.x = 0;
    group.y = rect.y + boundaryGap[0];
    function keyGetter(item) {
      return item.name;
    }
    var dataDiffer = new DataDiffer$1(this._layersSeries || [], layersSeries, keyGetter, keyGetter);
    var newLayersGroups = [];
    dataDiffer.add(bind$1(process, this, 'add')).update(bind$1(process, this, 'update')).remove(bind$1(process, this, 'remove')).execute();
    function process(status, idx, oldIdx) {
      var oldLayersGroups = self._layers;
      if (status === 'remove') {
        group.remove(oldLayersGroups[idx]);
        return;
      }
      var points0 = [];
      var points1 = [];
      var style;
      var indices = layersSeries[idx].indices;
      var j = 0;
      for (; j < indices.length; j++) {
        var layout = data.getItemLayout(indices[j]);
        var x = layout.x;
        var y0 = layout.y0;
        var y = layout.y;
        points0.push(x, y0);
        points1.push(x, y0 + y);
        style = data.getItemVisual(indices[j], 'style');
      }
      var polygon;
      var textLayout = data.getItemLayout(indices[0]);
      var labelModel = seriesModel.getModel('label');
      var margin = labelModel.get('margin');
      var emphasisModel = seriesModel.getModel('emphasis');
      if (status === 'add') {
        var layerGroup = newLayersGroups[idx] = new Group$5();
        polygon = new ECPolygon({
          shape: {
            points: points0,
            stackedOnPoints: points1,
            smooth: 0.4,
            stackedOnSmooth: 0.4,
            smoothConstraint: false
          },
          z2: 0
        });
        layerGroup.add(polygon);
        group.add(layerGroup);
        if (seriesModel.isAnimationEnabled()) {
          polygon.setClipPath(createGridClipShape(polygon.getBoundingRect(), seriesModel, function () {
            polygon.removeClipPath();
          }));
        }
      } else {
        var layerGroup = oldLayersGroups[oldIdx];
        polygon = layerGroup.childAt(0);
        group.add(layerGroup);
        newLayersGroups[idx] = layerGroup;
        updateProps$1(polygon, {
          shape: {
            points: points0,
            stackedOnPoints: points1
          }
        }, seriesModel);
        saveOldStyle(polygon);
      }
      setLabelStyle(polygon, getLabelStatesModels(seriesModel), {
        labelDataIndex: indices[j - 1],
        defaultText: data.getName(indices[j - 1]),
        inheritColor: style.fill
      }, {
        normal: {
          verticalAlign: 'middle'
          // align: 'right'
        }
      });
      polygon.setTextConfig({
        position: null,
        local: true
      });
      var labelEl = polygon.getTextContent();
      // TODO More label position options.
      if (labelEl) {
        labelEl.x = textLayout.x - margin;
        labelEl.y = textLayout.y0 + textLayout.y / 2;
      }
      polygon.useStyle(style);
      data.setItemGraphicEl(idx, polygon);
      setStatesStylesFromModel(polygon, seriesModel);
      toggleHoverEmphasis(polygon, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
    }
    this._layersSeries = layersSeries;
    this._layers = newLayersGroups;
  };
  ThemeRiverView.type = 'themeRiver';
  return ThemeRiverView;
}(ChartView$1);
// add animation to the view
function createGridClipShape(rect, seriesModel, cb) {
  var rectEl = new Rect$3({
    shape: {
      x: rect.x - 10,
      y: rect.y - 10,
      width: 0,
      height: rect.height + 20
    }
  });
  initProps(rectEl, {
    shape: {
      x: rect.x - 50,
      width: rect.width + 100,
      height: rect.height + 20
    }
  }, seriesModel, cb);
  return rectEl;
}
var ThemeRiverView$1 = ThemeRiverView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DATA_NAME_INDEX = 2;
var ThemeRiverSeriesModel = /** @class */function (_super) {
  __extends(ThemeRiverSeriesModel, _super);
  function ThemeRiverSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ThemeRiverSeriesModel.type;
    return _this;
  }
  /**
   * @override
   */
  ThemeRiverSeriesModel.prototype.init = function (option) {
    // eslint-disable-next-line
    _super.prototype.init.apply(this, arguments);
    // Put this function here is for the sake of consistency of code style.
    // Enable legend selection for each data item
    // Use a function instead of direct access because data reference may changed
    this.legendVisualProvider = new LegendVisualProvider$1(bind$1(this.getData, this), bind$1(this.getRawData, this));
  };
  /**
   * If there is no value of a certain point in the time for some event,set it value to 0.
   *
   * @param {Array} data  initial data in the option
   * @return {Array}
   */
  ThemeRiverSeriesModel.prototype.fixData = function (data) {
    var rawDataLength = data.length;
    /**
     * Make sure every layer data get the same keys.
     * The value index tells which layer has visited.
     * {
     *  2014/01/01: -1
     * }
     */
    var timeValueKeys = {};
    // grouped data by name
    var groupResult = groupData(data, function (item) {
      if (!timeValueKeys.hasOwnProperty(item[0] + '')) {
        timeValueKeys[item[0] + ''] = -1;
      }
      return item[2];
    });
    var layerData = [];
    groupResult.buckets.each(function (items, key) {
      layerData.push({
        name: key,
        dataList: items
      });
    });
    var layerNum = layerData.length;
    for (var k = 0; k < layerNum; ++k) {
      var name_1 = layerData[k].name;
      for (var j = 0; j < layerData[k].dataList.length; ++j) {
        var timeValue = layerData[k].dataList[j][0] + '';
        timeValueKeys[timeValue] = k;
      }
      for (var timeValue in timeValueKeys) {
        if (timeValueKeys.hasOwnProperty(timeValue) && timeValueKeys[timeValue] !== k) {
          timeValueKeys[timeValue] = k;
          data[rawDataLength] = [timeValue, 0, name_1];
          rawDataLength++;
        }
      }
    }
    return data;
  };
  /**
   * @override
   * @param  option  the initial option that user gave
   * @param  ecModel  the model object for themeRiver option
   */
  ThemeRiverSeriesModel.prototype.getInitialData = function (option, ecModel) {
    var singleAxisModel = this.getReferringComponents('singleAxis', SINGLE_REFERRING).models[0];
    var axisType = singleAxisModel.get('type');
    // filter the data item with the value of label is undefined
    var filterData = filter(option.data, function (dataItem) {
      return dataItem[2] !== undefined;
    });
    // ??? TODO design a stage to transfer data for themeRiver and lines?
    var data = this.fixData(filterData || []);
    var nameList = [];
    var nameMap = this.nameMap = createHashMap();
    var count = 0;
    for (var i = 0; i < data.length; ++i) {
      nameList.push(data[i][DATA_NAME_INDEX]);
      if (!nameMap.get(data[i][DATA_NAME_INDEX])) {
        nameMap.set(data[i][DATA_NAME_INDEX], count);
        count++;
      }
    }
    var dimensions = prepareSeriesDataSchema(data, {
      coordDimensions: ['single'],
      dimensionsDefine: [{
        name: 'time',
        type: getDimensionTypeByAxis(axisType)
      }, {
        name: 'value',
        type: 'float'
      }, {
        name: 'name',
        type: 'ordinal'
      }],
      encodeDefine: {
        single: 0,
        value: 1,
        itemName: 2
      }
    }).dimensions;
    var list = new SeriesData$1(dimensions, this);
    list.initData(data);
    return list;
  };
  /**
   * The raw data is divided into multiple layers and each layer
   *     has same name.
   */
  ThemeRiverSeriesModel.prototype.getLayerSeries = function () {
    var data = this.getData();
    var lenCount = data.count();
    var indexArr = [];
    for (var i = 0; i < lenCount; ++i) {
      indexArr[i] = i;
    }
    var timeDim = data.mapDimension('single');
    // data group by name
    var groupResult = groupData(indexArr, function (index) {
      return data.get('name', index);
    });
    var layerSeries = [];
    groupResult.buckets.each(function (items, key) {
      items.sort(function (index1, index2) {
        return data.get(timeDim, index1) - data.get(timeDim, index2);
      });
      layerSeries.push({
        name: key,
        indices: items
      });
    });
    return layerSeries;
  };
  /**
   * Get data indices for show tooltip content
   */
  ThemeRiverSeriesModel.prototype.getAxisTooltipData = function (dim, value, baseAxis) {
    if (!isArray$1(dim)) {
      dim = dim ? [dim] : [];
    }
    var data = this.getData();
    var layerSeries = this.getLayerSeries();
    var indices = [];
    var layerNum = layerSeries.length;
    var nestestValue;
    for (var i = 0; i < layerNum; ++i) {
      var minDist = Number.MAX_VALUE;
      var nearestIdx = -1;
      var pointNum = layerSeries[i].indices.length;
      for (var j = 0; j < pointNum; ++j) {
        var theValue = data.get(dim[0], layerSeries[i].indices[j]);
        var dist = Math.abs(theValue - value);
        if (dist <= minDist) {
          nestestValue = theValue;
          minDist = dist;
          nearestIdx = layerSeries[i].indices[j];
        }
      }
      indices.push(nearestIdx);
    }
    return {
      dataIndices: indices,
      nestestValue: nestestValue
    };
  };
  ThemeRiverSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    var data = this.getData();
    var name = data.getName(dataIndex);
    var value = data.get(data.mapDimension('value'), dataIndex);
    return createTooltipMarkup('nameValue', {
      name: name,
      value: value
    });
  };
  ThemeRiverSeriesModel.type = 'series.themeRiver';
  ThemeRiverSeriesModel.dependencies = ['singleAxis'];
  ThemeRiverSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    colorBy: 'data',
    coordinateSystem: 'singleAxis',
    // gap in axis's orthogonal orientation
    boundaryGap: ['10%', '10%'],
    // legendHoverLink: true,
    singleAxisIndex: 0,
    animationEasing: 'linear',
    label: {
      margin: 4,
      show: true,
      position: 'left',
      fontSize: 11
    },
    emphasis: {
      label: {
        show: true
      }
    }
  };
  return ThemeRiverSeriesModel;
}(SeriesModel$1);
var ThemeRiverSeriesModel$1 = ThemeRiverSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function themeRiverLayout(ecModel, api) {
  ecModel.eachSeriesByType('themeRiver', function (seriesModel) {
    var data = seriesModel.getData();
    var single = seriesModel.coordinateSystem;
    var layoutInfo = {};
    // use the axis boundingRect for view
    var rect = single.getRect();
    layoutInfo.rect = rect;
    var boundaryGap = seriesModel.get('boundaryGap');
    var axis = single.getAxis();
    layoutInfo.boundaryGap = boundaryGap;
    if (axis.orient === 'horizontal') {
      boundaryGap[0] = parsePercent(boundaryGap[0], rect.height);
      boundaryGap[1] = parsePercent(boundaryGap[1], rect.height);
      var height = rect.height - boundaryGap[0] - boundaryGap[1];
      doThemeRiverLayout(data, seriesModel, height);
    } else {
      boundaryGap[0] = parsePercent(boundaryGap[0], rect.width);
      boundaryGap[1] = parsePercent(boundaryGap[1], rect.width);
      var width = rect.width - boundaryGap[0] - boundaryGap[1];
      doThemeRiverLayout(data, seriesModel, width);
    }
    data.setLayout('layoutInfo', layoutInfo);
  });
}
/**
 * The layout information about themeriver
 *
 * @param data  data in the series
 * @param seriesModel  the model object of themeRiver series
 * @param height  value used to compute every series height
 */
function doThemeRiverLayout(data, seriesModel, height) {
  if (!data.count()) {
    return;
  }
  var coordSys = seriesModel.coordinateSystem;
  // the data in each layer are organized into a series.
  var layerSeries = seriesModel.getLayerSeries();
  // the points in each layer.
  var timeDim = data.mapDimension('single');
  var valueDim = data.mapDimension('value');
  var layerPoints = map$1(layerSeries, function (singleLayer) {
    return map$1(singleLayer.indices, function (idx) {
      var pt = coordSys.dataToPoint(data.get(timeDim, idx));
      pt[1] = data.get(valueDim, idx);
      return pt;
    });
  });
  var base = computeBaseline(layerPoints);
  var baseLine = base.y0;
  var ky = height / base.max;
  // set layout information for each item.
  var n = layerSeries.length;
  var m = layerSeries[0].indices.length;
  var baseY0;
  for (var j = 0; j < m; ++j) {
    baseY0 = baseLine[j] * ky;
    data.setItemLayout(layerSeries[0].indices[j], {
      layerIndex: 0,
      x: layerPoints[0][j][0],
      y0: baseY0,
      y: layerPoints[0][j][1] * ky
    });
    for (var i = 1; i < n; ++i) {
      baseY0 += layerPoints[i - 1][j][1] * ky;
      data.setItemLayout(layerSeries[i].indices[j], {
        layerIndex: i,
        x: layerPoints[i][j][0],
        y0: baseY0,
        y: layerPoints[i][j][1] * ky
      });
    }
  }
}
/**
 * Compute the baseLine of the rawdata
 * Inspired by Lee Byron's paper Stacked Graphs - Geometry & Aesthetics
 *
 * @param  data  the points in each layer
 */
function computeBaseline(data) {
  var layerNum = data.length;
  var pointNum = data[0].length;
  var sums = [];
  var y0 = [];
  var max = 0;
  for (var i = 0; i < pointNum; ++i) {
    var temp = 0;
    for (var j = 0; j < layerNum; ++j) {
      temp += data[j][i][1];
    }
    if (temp > max) {
      max = temp;
    }
    sums.push(temp);
  }
  for (var k = 0; k < pointNum; ++k) {
    y0[k] = (max - sums[k]) / 2;
  }
  max = 0;
  for (var l = 0; l < pointNum; ++l) {
    var sum = sums[l] + y0[l];
    if (sum > max) {
      max = sum;
    }
  }
  return {
    y0: y0,
    max: max
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$v(registers) {
  registers.registerChartView(ThemeRiverView$1);
  registers.registerSeriesModel(ThemeRiverSeriesModel$1);
  registers.registerLayout(themeRiverLayout);
  registers.registerProcessor(dataFilter$1('themeRiver'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DEFAULT_SECTOR_Z = 2;
var DEFAULT_TEXT_Z = 4;
/**
 * Sunburstce of Sunburst including Sector, Label, LabelLine
 */
var SunburstPiece = /** @class */function (_super) {
  __extends(SunburstPiece, _super);
  function SunburstPiece(node, seriesModel, ecModel, api) {
    var _this = _super.call(this) || this;
    _this.z2 = DEFAULT_SECTOR_Z;
    _this.textConfig = {
      inside: true
    };
    getECData(_this).seriesIndex = seriesModel.seriesIndex;
    var text = new ZRText$1({
      z2: DEFAULT_TEXT_Z,
      silent: node.getModel().get(['label', 'silent'])
    });
    _this.setTextContent(text);
    _this.updateData(true, node, seriesModel, ecModel, api);
    return _this;
  }
  SunburstPiece.prototype.updateData = function (firstCreate, node,
  // state: 'emphasis' | 'normal' | 'highlight' | 'downplay',
  seriesModel, ecModel, api) {
    this.node = node;
    node.piece = this;
    seriesModel = seriesModel || this._seriesModel;
    ecModel = ecModel || this._ecModel;
    var sector = this;
    getECData(sector).dataIndex = node.dataIndex;
    var itemModel = node.getModel();
    var emphasisModel = itemModel.getModel('emphasis');
    var layout = node.getLayout();
    var sectorShape = extend({}, layout);
    sectorShape.label = null;
    var normalStyle = node.getVisual('style');
    normalStyle.lineJoin = 'bevel';
    var decal = node.getVisual('decal');
    if (decal) {
      normalStyle.decal = createOrUpdatePatternFromDecal(decal, api);
    }
    var cornerRadius = getSectorCornerRadius(itemModel.getModel('itemStyle'), sectorShape, true);
    extend(sectorShape, cornerRadius);
    each$f(SPECIAL_STATES, function (stateName) {
      var state = sector.ensureState(stateName);
      var itemStyleModel = itemModel.getModel([stateName, 'itemStyle']);
      state.style = itemStyleModel.getItemStyle();
      // border radius
      var cornerRadius = getSectorCornerRadius(itemStyleModel, sectorShape);
      if (cornerRadius) {
        state.shape = cornerRadius;
      }
    });
    if (firstCreate) {
      sector.setShape(sectorShape);
      sector.shape.r = layout.r0;
      initProps(sector, {
        shape: {
          r: layout.r
        }
      }, seriesModel, node.dataIndex);
    } else {
      // Disable animation for gradient since no interpolation method
      // is supported for gradient
      updateProps$1(sector, {
        shape: sectorShape
      }, seriesModel);
      saveOldStyle(sector);
    }
    sector.useStyle(normalStyle);
    this._updateLabel(seriesModel);
    var cursorStyle = itemModel.getShallow('cursor');
    cursorStyle && sector.attr('cursor', cursorStyle);
    this._seriesModel = seriesModel || this._seriesModel;
    this._ecModel = ecModel || this._ecModel;
    var focus = emphasisModel.get('focus');
    var focusOrIndices = focus === 'relative' ? concatArray(node.getAncestorsIndices(), node.getDescendantIndices()) : focus === 'ancestor' ? node.getAncestorsIndices() : focus === 'descendant' ? node.getDescendantIndices() : focus;
    toggleHoverEmphasis(this, focusOrIndices, emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
  };
  SunburstPiece.prototype._updateLabel = function (seriesModel) {
    var _this = this;
    var itemModel = this.node.getModel();
    var normalLabelModel = itemModel.getModel('label');
    var layout = this.node.getLayout();
    var angle = layout.endAngle - layout.startAngle;
    var midAngle = (layout.startAngle + layout.endAngle) / 2;
    var dx = Math.cos(midAngle);
    var dy = Math.sin(midAngle);
    var sector = this;
    var label = sector.getTextContent();
    var dataIndex = this.node.dataIndex;
    var labelMinAngle = normalLabelModel.get('minAngle') / 180 * Math.PI;
    var isNormalShown = normalLabelModel.get('show') && !(labelMinAngle != null && Math.abs(angle) < labelMinAngle);
    label.ignore = !isNormalShown;
    // TODO use setLabelStyle
    each$f(DISPLAY_STATES, function (stateName) {
      var labelStateModel = stateName === 'normal' ? itemModel.getModel('label') : itemModel.getModel([stateName, 'label']);
      var isNormal = stateName === 'normal';
      var state = isNormal ? label : label.ensureState(stateName);
      var text = seriesModel.getFormattedLabel(dataIndex, stateName);
      if (isNormal) {
        text = text || _this.node.name;
      }
      state.style = createTextStyle(labelStateModel, {}, null, stateName !== 'normal', true);
      if (text) {
        state.style.text = text;
      }
      // Not displaying text when angle is too small
      var isShown = labelStateModel.get('show');
      if (isShown != null && !isNormal) {
        state.ignore = !isShown;
      }
      var labelPosition = getLabelAttr(labelStateModel, 'position');
      var sectorState = isNormal ? sector : sector.states[stateName];
      var labelColor = sectorState.style.fill;
      sectorState.textConfig = {
        outsideFill: labelStateModel.get('color') === 'inherit' ? labelColor : null,
        inside: labelPosition !== 'outside'
      };
      var r;
      var labelPadding = getLabelAttr(labelStateModel, 'distance') || 0;
      var textAlign = getLabelAttr(labelStateModel, 'align');
      var rotateType = getLabelAttr(labelStateModel, 'rotate');
      var flipStartAngle = Math.PI * 0.5;
      var flipEndAngle = Math.PI * 1.5;
      var midAngleNormal = normalizeRadian(rotateType === 'tangential' ? Math.PI / 2 - midAngle : midAngle);
      // For text that is up-side down, rotate 180 degrees to make sure
      // it's readable
      var needsFlip = midAngleNormal > flipStartAngle && !isRadianAroundZero(midAngleNormal - flipStartAngle) && midAngleNormal < flipEndAngle;
      if (labelPosition === 'outside') {
        r = layout.r + labelPadding;
        textAlign = needsFlip ? 'right' : 'left';
      } else {
        if (!textAlign || textAlign === 'center') {
          // Put label in the center if it's a circle
          if (angle === 2 * Math.PI && layout.r0 === 0) {
            r = 0;
          } else {
            r = (layout.r + layout.r0) / 2;
          }
          textAlign = 'center';
        } else if (textAlign === 'left') {
          r = layout.r0 + labelPadding;
          textAlign = needsFlip ? 'right' : 'left';
        } else if (textAlign === 'right') {
          r = layout.r - labelPadding;
          textAlign = needsFlip ? 'left' : 'right';
        }
      }
      state.style.align = textAlign;
      state.style.verticalAlign = getLabelAttr(labelStateModel, 'verticalAlign') || 'middle';
      state.x = r * dx + layout.cx;
      state.y = r * dy + layout.cy;
      var rotate = 0;
      if (rotateType === 'radial') {
        rotate = normalizeRadian(-midAngle) + (needsFlip ? Math.PI : 0);
      } else if (rotateType === 'tangential') {
        rotate = normalizeRadian(Math.PI / 2 - midAngle) + (needsFlip ? Math.PI : 0);
      } else if (isNumber(rotateType)) {
        rotate = rotateType * Math.PI / 180;
      }
      state.rotation = normalizeRadian(rotate);
    });
    function getLabelAttr(model, name) {
      var stateAttr = model.get(name);
      if (stateAttr == null) {
        return normalLabelModel.get(name);
      }
      return stateAttr;
    }
    label.dirtyStyle();
  };
  return SunburstPiece;
}(Sector$1);
var SunburstPiece$1 = SunburstPiece;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ROOT_TO_NODE_ACTION = 'sunburstRootToNode';
var HIGHLIGHT_ACTION = 'sunburstHighlight';
var UNHIGHLIGHT_ACTION = 'sunburstUnhighlight';
function installSunburstAction(registers) {
  registers.registerAction({
    type: ROOT_TO_NODE_ACTION,
    update: 'updateView'
  }, function (payload, ecModel) {
    ecModel.eachComponent({
      mainType: 'series',
      subType: 'sunburst',
      query: payload
    }, handleRootToNode);
    function handleRootToNode(model, index) {
      var targetInfo = retrieveTargetInfo(payload, [ROOT_TO_NODE_ACTION], model);
      if (targetInfo) {
        var originViewRoot = model.getViewRoot();
        if (originViewRoot) {
          payload.direction = aboveViewRoot(originViewRoot, targetInfo.node) ? 'rollUp' : 'drillDown';
        }
        model.resetViewRoot(targetInfo.node);
      }
    }
  });
  registers.registerAction({
    type: HIGHLIGHT_ACTION,
    update: 'none'
  }, function (payload, ecModel, api) {
    // Clone
    payload = extend({}, payload);
    ecModel.eachComponent({
      mainType: 'series',
      subType: 'sunburst',
      query: payload
    }, handleHighlight);
    function handleHighlight(model) {
      var targetInfo = retrieveTargetInfo(payload, [HIGHLIGHT_ACTION], model);
      if (targetInfo) {
        payload.dataIndex = targetInfo.node.dataIndex;
      }
    }
    {
      deprecateReplaceLog('sunburstHighlight', 'highlight');
    }
    // Fast forward action
    api.dispatchAction(extend(payload, {
      type: 'highlight'
    }));
  });
  registers.registerAction({
    type: UNHIGHLIGHT_ACTION,
    update: 'updateView'
  }, function (payload, ecModel, api) {
    payload = extend({}, payload);
    {
      deprecateReplaceLog('sunburstUnhighlight', 'downplay');
    }
    api.dispatchAction(extend(payload, {
      type: 'downplay'
    }));
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SunburstView = /** @class */function (_super) {
  __extends(SunburstView, _super);
  function SunburstView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SunburstView.type;
    return _this;
  }
  SunburstView.prototype.render = function (seriesModel, ecModel, api,
  // @ts-ignore
  payload) {
    var self = this;
    this.seriesModel = seriesModel;
    this.api = api;
    this.ecModel = ecModel;
    var data = seriesModel.getData();
    var virtualRoot = data.tree.root;
    var newRoot = seriesModel.getViewRoot();
    var group = this.group;
    var renderLabelForZeroData = seriesModel.get('renderLabelForZeroData');
    var newChildren = [];
    newRoot.eachNode(function (node) {
      newChildren.push(node);
    });
    var oldChildren = this._oldChildren || [];
    dualTravel(newChildren, oldChildren);
    renderRollUp(virtualRoot, newRoot);
    this._initEvents();
    this._oldChildren = newChildren;
    function dualTravel(newChildren, oldChildren) {
      if (newChildren.length === 0 && oldChildren.length === 0) {
        return;
      }
      new DataDiffer$1(oldChildren, newChildren, getKey, getKey).add(processNode).update(processNode).remove(curry$1(processNode, null)).execute();
      function getKey(node) {
        return node.getId();
      }
      function processNode(newIdx, oldIdx) {
        var newNode = newIdx == null ? null : newChildren[newIdx];
        var oldNode = oldIdx == null ? null : oldChildren[oldIdx];
        doRenderNode(newNode, oldNode);
      }
    }
    function doRenderNode(newNode, oldNode) {
      if (!renderLabelForZeroData && newNode && !newNode.getValue()) {
        // Not render data with value 0
        newNode = null;
      }
      if (newNode !== virtualRoot && oldNode !== virtualRoot) {
        if (oldNode && oldNode.piece) {
          if (newNode) {
            // Update
            oldNode.piece.updateData(false, newNode, seriesModel, ecModel, api);
            // For tooltip
            data.setItemGraphicEl(newNode.dataIndex, oldNode.piece);
          } else {
            // Remove
            removeNode(oldNode);
          }
        } else if (newNode) {
          // Add
          var piece = new SunburstPiece$1(newNode, seriesModel, ecModel, api);
          group.add(piece);
          // For tooltip
          data.setItemGraphicEl(newNode.dataIndex, piece);
        }
      }
    }
    function removeNode(node) {
      if (!node) {
        return;
      }
      if (node.piece) {
        group.remove(node.piece);
        node.piece = null;
      }
    }
    function renderRollUp(virtualRoot, viewRoot) {
      if (viewRoot.depth > 0) {
        // Render
        if (self.virtualPiece) {
          // Update
          self.virtualPiece.updateData(false, virtualRoot, seriesModel, ecModel, api);
        } else {
          // Add
          self.virtualPiece = new SunburstPiece$1(virtualRoot, seriesModel, ecModel, api);
          group.add(self.virtualPiece);
        }
        // TODO event scope
        viewRoot.piece.off('click');
        self.virtualPiece.on('click', function (e) {
          self._rootToNode(viewRoot.parentNode);
        });
      } else if (self.virtualPiece) {
        // Remove
        group.remove(self.virtualPiece);
        self.virtualPiece = null;
      }
    }
  };
  /**
   * @private
   */
  SunburstView.prototype._initEvents = function () {
    var _this = this;
    this.group.off('click');
    this.group.on('click', function (e) {
      var targetFound = false;
      var viewRoot = _this.seriesModel.getViewRoot();
      viewRoot.eachNode(function (node) {
        if (!targetFound && node.piece && node.piece === e.target) {
          var nodeClick = node.getModel().get('nodeClick');
          if (nodeClick === 'rootToNode') {
            _this._rootToNode(node);
          } else if (nodeClick === 'link') {
            var itemModel = node.getModel();
            var link = itemModel.get('link');
            if (link) {
              var linkTarget = itemModel.get('target', true) || '_blank';
              windowOpen(link, linkTarget);
            }
          }
          targetFound = true;
        }
      });
    });
  };
  /**
   * @private
   */
  SunburstView.prototype._rootToNode = function (node) {
    if (node !== this.seriesModel.getViewRoot()) {
      this.api.dispatchAction({
        type: ROOT_TO_NODE_ACTION,
        from: this.uid,
        seriesId: this.seriesModel.id,
        targetNode: node
      });
    }
  };
  /**
   * @implement
   */
  SunburstView.prototype.containPoint = function (point, seriesModel) {
    var treeRoot = seriesModel.getData();
    var itemLayout = treeRoot.getItemLayout(0);
    if (itemLayout) {
      var dx = point[0] - itemLayout.cx;
      var dy = point[1] - itemLayout.cy;
      var radius = Math.sqrt(dx * dx + dy * dy);
      return radius <= itemLayout.r && radius >= itemLayout.r0;
    }
  };
  SunburstView.type = 'sunburst';
  return SunburstView;
}(ChartView$1);
var SunburstView$1 = SunburstView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SunburstSeriesModel = /** @class */function (_super) {
  __extends(SunburstSeriesModel, _super);
  function SunburstSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SunburstSeriesModel.type;
    _this.ignoreStyleOnData = true;
    return _this;
  }
  SunburstSeriesModel.prototype.getInitialData = function (option, ecModel) {
    // Create a virtual root.
    var root = {
      name: option.name,
      children: option.data
    };
    completeTreeValue(root);
    var levelModels = this._levelModels = map$1(option.levels || [], function (levelDefine) {
      return new Model$1(levelDefine, this, ecModel);
    }, this);
    // Make sure always a new tree is created when setOption,
    // in TreemapView, we check whether oldTree === newTree
    // to choose mappings approach among old shapes and new shapes.
    var tree = Tree$1.createTree(root, this, beforeLink);
    function beforeLink(nodeData) {
      nodeData.wrapMethod('getItemModel', function (model, idx) {
        var node = tree.getNodeByDataIndex(idx);
        var levelModel = levelModels[node.depth];
        levelModel && (model.parentModel = levelModel);
        return model;
      });
    }
    return tree.data;
  };
  SunburstSeriesModel.prototype.optionUpdated = function () {
    this.resetViewRoot();
  };
  /*
   * @override
   */
  SunburstSeriesModel.prototype.getDataParams = function (dataIndex) {
    var params = _super.prototype.getDataParams.apply(this, arguments);
    var node = this.getData().tree.getNodeByDataIndex(dataIndex);
    params.treePathInfo = wrapTreePathInfo(node, this);
    return params;
  };
  SunburstSeriesModel.prototype.getLevelModel = function (node) {
    return this._levelModels && this._levelModels[node.depth];
  };
  SunburstSeriesModel.prototype.getViewRoot = function () {
    return this._viewRoot;
  };
  SunburstSeriesModel.prototype.resetViewRoot = function (viewRoot) {
    viewRoot ? this._viewRoot = viewRoot : viewRoot = this._viewRoot;
    var root = this.getRawData().tree.root;
    if (!viewRoot || viewRoot !== root && !root.contains(viewRoot)) {
      this._viewRoot = root;
    }
  };
  SunburstSeriesModel.prototype.enableAriaDecal = function () {
    enableAriaDecalForTree(this);
  };
  SunburstSeriesModel.type = 'series.sunburst';
  SunburstSeriesModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    // 默认全局居中
    center: ['50%', '50%'],
    radius: [0, '75%'],
    // 默认顺时针
    clockwise: true,
    startAngle: 90,
    // 最小角度改为0
    minAngle: 0,
    // If still show when all data zero.
    stillShowZeroSum: true,
    // 'rootToNode', 'link', or false
    nodeClick: 'rootToNode',
    renderLabelForZeroData: false,
    label: {
      // could be: 'radial', 'tangential', or 'none'
      rotate: 'radial',
      show: true,
      opacity: 1,
      // 'left' is for inner side of inside, and 'right' is for outer
      // side for inside
      align: 'center',
      position: 'inside',
      distance: 5,
      silent: true
    },
    itemStyle: {
      borderWidth: 1,
      borderColor: 'white',
      borderType: 'solid',
      shadowBlur: 0,
      shadowColor: 'rgba(0, 0, 0, 0.2)',
      shadowOffsetX: 0,
      shadowOffsetY: 0,
      opacity: 1
    },
    emphasis: {
      focus: 'descendant'
    },
    blur: {
      itemStyle: {
        opacity: 0.2
      },
      label: {
        opacity: 0.1
      }
    },
    // Animation type can be expansion, scale.
    animationType: 'expansion',
    animationDuration: 1000,
    animationDurationUpdate: 500,
    data: [],
    /**
     * Sort order.
     *
     * Valid values: 'desc', 'asc', null, or callback function.
     * 'desc' and 'asc' for descend and ascendant order;
     * null for not sorting;
     * example of callback function:
     * function(nodeA, nodeB) {
     *     return nodeA.getValue() - nodeB.getValue();
     * }
     */
    sort: 'desc'
  };
  return SunburstSeriesModel;
}(SeriesModel$1);
function completeTreeValue(dataNode) {
  // Postorder travel tree.
  // If value of none-leaf node is not set,
  // calculate it by suming up the value of all children.
  var sum = 0;
  each$f(dataNode.children, function (child) {
    completeTreeValue(child);
    var childValue = child.value;
    // TODO First value of array must be a number
    isArray$1(childValue) && (childValue = childValue[0]);
    sum += childValue;
  });
  var thisValue = dataNode.value;
  if (isArray$1(thisValue)) {
    thisValue = thisValue[0];
  }
  if (thisValue == null || isNaN(thisValue)) {
    thisValue = sum;
  }
  // Value should not less than 0.
  if (thisValue < 0) {
    thisValue = 0;
  }
  isArray$1(dataNode.value) ? dataNode.value[0] = thisValue : dataNode.value = thisValue;
}
var SunburstSeriesModel$1 = SunburstSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// let PI2 = Math.PI * 2;
var RADIAN = Math.PI / 180;
function sunburstLayout(seriesType, ecModel, api) {
  ecModel.eachSeriesByType(seriesType, function (seriesModel) {
    var center = seriesModel.get('center');
    var radius = seriesModel.get('radius');
    if (!isArray$1(radius)) {
      radius = [0, radius];
    }
    if (!isArray$1(center)) {
      center = [center, center];
    }
    var width = api.getWidth();
    var height = api.getHeight();
    var size = Math.min(width, height);
    var cx = parsePercent(center[0], width);
    var cy = parsePercent(center[1], height);
    var r0 = parsePercent(radius[0], size / 2);
    var r = parsePercent(radius[1], size / 2);
    var startAngle = -seriesModel.get('startAngle') * RADIAN;
    var minAngle = seriesModel.get('minAngle') * RADIAN;
    var virtualRoot = seriesModel.getData().tree.root;
    var treeRoot = seriesModel.getViewRoot();
    var rootDepth = treeRoot.depth;
    var sort = seriesModel.get('sort');
    if (sort != null) {
      initChildren(treeRoot, sort);
    }
    var validDataCount = 0;
    each$f(treeRoot.children, function (child) {
      !isNaN(child.getValue()) && validDataCount++;
    });
    var sum = treeRoot.getValue();
    // Sum may be 0
    var unitRadian = Math.PI / (sum || validDataCount) * 2;
    var renderRollupNode = treeRoot.depth > 0;
    var levels = treeRoot.height - (renderRollupNode ? -1 : 1);
    var rPerLevel = (r - r0) / (levels || 1);
    var clockwise = seriesModel.get('clockwise');
    var stillShowZeroSum = seriesModel.get('stillShowZeroSum');
    // In the case some sector angle is smaller than minAngle
    // let restAngle = PI2;
    // let valueSumLargerThanMinAngle = 0;
    var dir = clockwise ? 1 : -1;
    /**
     * Render a tree
     * @return increased angle
     */
    var renderNode = function (node, startAngle) {
      if (!node) {
        return;
      }
      var endAngle = startAngle;
      // Render self
      if (node !== virtualRoot) {
        // Tree node is virtual, so it doesn't need to be drawn
        var value = node.getValue();
        var angle = sum === 0 && stillShowZeroSum ? unitRadian : value * unitRadian;
        if (angle < minAngle) {
          angle = minAngle;
          // restAngle -= minAngle;
        }
        // else {
        //     valueSumLargerThanMinAngle += value;
        // }
        endAngle = startAngle + dir * angle;
        var depth = node.depth - rootDepth - (renderRollupNode ? -1 : 1);
        var rStart = r0 + rPerLevel * depth;
        var rEnd = r0 + rPerLevel * (depth + 1);
        var levelModel = seriesModel.getLevelModel(node);
        if (levelModel) {
          var r0_1 = levelModel.get('r0', true);
          var r_1 = levelModel.get('r', true);
          var radius_1 = levelModel.get('radius', true);
          if (radius_1 != null) {
            r0_1 = radius_1[0];
            r_1 = radius_1[1];
          }
          r0_1 != null && (rStart = parsePercent(r0_1, size / 2));
          r_1 != null && (rEnd = parsePercent(r_1, size / 2));
        }
        node.setLayout({
          angle: angle,
          startAngle: startAngle,
          endAngle: endAngle,
          clockwise: clockwise,
          cx: cx,
          cy: cy,
          r0: rStart,
          r: rEnd
        });
      }
      // Render children
      if (node.children && node.children.length) {
        // currentAngle = startAngle;
        var siblingAngle_1 = 0;
        each$f(node.children, function (node) {
          siblingAngle_1 += renderNode(node, startAngle + siblingAngle_1);
        });
      }
      return endAngle - startAngle;
    };
    // Virtual root node for roll up
    if (renderRollupNode) {
      var rStart = r0;
      var rEnd = r0 + rPerLevel;
      var angle = Math.PI * 2;
      virtualRoot.setLayout({
        angle: angle,
        startAngle: startAngle,
        endAngle: startAngle + angle,
        clockwise: clockwise,
        cx: cx,
        cy: cy,
        r0: rStart,
        r: rEnd
      });
    }
    renderNode(treeRoot, startAngle);
  });
}
/**
 * Init node children by order and update visual
 */
function initChildren(node, sortOrder) {
  var children = node.children || [];
  node.children = sort(children, sortOrder);
  // Init children recursively
  if (children.length) {
    each$f(node.children, function (child) {
      initChildren(child, sortOrder);
    });
  }
}
/**
 * Sort children nodes
 *
 * @param {TreeNode[]}               children children of node to be sorted
 * @param {string | function | null} sort sort method
 *                                   See SunburstSeries.js for details.
 */
function sort(children, sortOrder) {
  if (isFunction(sortOrder)) {
    var sortTargets = map$1(children, function (child, idx) {
      var value = child.getValue();
      return {
        params: {
          depth: child.depth,
          height: child.height,
          dataIndex: child.dataIndex,
          getValue: function () {
            return value;
          }
        },
        index: idx
      };
    });
    sortTargets.sort(function (a, b) {
      return sortOrder(a.params, b.params);
    });
    return map$1(sortTargets, function (target) {
      return children[target.index];
    });
  } else {
    var isAsc_1 = sortOrder === 'asc';
    return children.sort(function (a, b) {
      var diff = (a.getValue() - b.getValue()) * (isAsc_1 ? 1 : -1);
      return diff === 0 ? (a.dataIndex - b.dataIndex) * (isAsc_1 ? -1 : 1) : diff;
    });
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function sunburstVisual(ecModel) {
  var paletteScope = {};
  // Default color strategy
  function pickColor(node, seriesModel, treeHeight) {
    // Choose color from palette based on the first level.
    var current = node;
    while (current && current.depth > 1) {
      current = current.parentNode;
    }
    var color = seriesModel.getColorFromPalette(current.name || current.dataIndex + '', paletteScope);
    if (node.depth > 1 && isString(color)) {
      // Lighter on the deeper level.
      color = lift(color, (node.depth - 1) / (treeHeight - 1) * 0.5);
    }
    return color;
  }
  ecModel.eachSeriesByType('sunburst', function (seriesModel) {
    var data = seriesModel.getData();
    var tree = data.tree;
    tree.eachNode(function (node) {
      var model = node.getModel();
      var style = model.getModel('itemStyle').getItemStyle();
      if (!style.fill) {
        style.fill = pickColor(node, seriesModel, tree.root.height);
      }
      var existsStyle = data.ensureUniqueItemVisual(node.dataIndex, 'style');
      extend(existsStyle, style);
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$u(registers) {
  registers.registerChartView(SunburstView$1);
  registers.registerSeriesModel(SunburstSeriesModel$1);
  registers.registerLayout(curry$1(sunburstLayout, 'sunburst'));
  registers.registerProcessor(curry$1(dataFilter$1, 'sunburst'));
  registers.registerVisual(sunburstVisual);
  installSunburstAction(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Also compat with ec4, where
// `visual('color') visual('borderColor')` is supported.
var STYLE_VISUAL_TYPE = {
  color: 'fill',
  borderColor: 'stroke'
};
var NON_STYLE_VISUAL_PROPS = {
  symbol: 1,
  symbolSize: 1,
  symbolKeepAspect: 1,
  legendIcon: 1,
  visualMeta: 1,
  liftZ: 1,
  decal: 1
};
var customInnerStore = makeInner();
var CustomSeriesModel = /** @class */function (_super) {
  __extends(CustomSeriesModel, _super);
  function CustomSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = CustomSeriesModel.type;
    return _this;
  }
  CustomSeriesModel.prototype.optionUpdated = function () {
    this.currentZLevel = this.get('zlevel', true);
    this.currentZ = this.get('z', true);
  };
  CustomSeriesModel.prototype.getInitialData = function (option, ecModel) {
    return createSeriesData(null, this);
  };
  CustomSeriesModel.prototype.getDataParams = function (dataIndex, dataType, el) {
    var params = _super.prototype.getDataParams.call(this, dataIndex, dataType);
    el && (params.info = customInnerStore(el).info);
    return params;
  };
  CustomSeriesModel.type = 'series.custom';
  CustomSeriesModel.dependencies = ['grid', 'polar', 'geo', 'singleAxis', 'calendar'];
  CustomSeriesModel.defaultOption = {
    coordinateSystem: 'cartesian2d',
    // zlevel: 0,
    z: 2,
    legendHoverLink: true,
    // Custom series will not clip by default.
    // Some case will use custom series to draw label
    // For example https://echarts.apache.org/examples/en/editor.html?c=custom-gantt-flight
    clip: false
    // Cartesian coordinate system
    // xAxisIndex: 0,
    // yAxisIndex: 0,
    // Polar coordinate system
    // polarIndex: 0,
    // Geo coordinate system
    // geoIndex: 0,
  };
  return CustomSeriesModel;
}(SeriesModel$1);
var CustomSeriesModel$1 = CustomSeriesModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function dataToCoordSize$3(dataSize, dataItem) {
  // dataItem is necessary in log axis.
  dataItem = dataItem || [0, 0];
  return map$1(['x', 'y'], function (dim, dimIdx) {
    var axis = this.getAxis(dim);
    var val = dataItem[dimIdx];
    var halfSize = dataSize[dimIdx] / 2;
    return axis.type === 'category' ? axis.getBandWidth() : Math.abs(axis.dataToCoord(val - halfSize) - axis.dataToCoord(val + halfSize));
  }, this);
}
function cartesianPrepareCustom(coordSys) {
  var rect = coordSys.master.getRect();
  return {
    coordSys: {
      // The name exposed to user is always 'cartesian2d' but not 'grid'.
      type: 'cartesian2d',
      x: rect.x,
      y: rect.y,
      width: rect.width,
      height: rect.height
    },
    api: {
      coord: function (data) {
        // do not provide "out" param
        return coordSys.dataToPoint(data);
      },
      size: bind$1(dataToCoordSize$3, coordSys)
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function dataToCoordSize$2(dataSize, dataItem) {
  dataItem = dataItem || [0, 0];
  return map$1([0, 1], function (dimIdx) {
    var val = dataItem[dimIdx];
    var halfSize = dataSize[dimIdx] / 2;
    var p1 = [];
    var p2 = [];
    p1[dimIdx] = val - halfSize;
    p2[dimIdx] = val + halfSize;
    p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
    return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
  }, this);
}
function geoPrepareCustom(coordSys) {
  var rect = coordSys.getBoundingRect();
  return {
    coordSys: {
      type: 'geo',
      x: rect.x,
      y: rect.y,
      width: rect.width,
      height: rect.height,
      zoom: coordSys.getZoom()
    },
    api: {
      coord: function (data) {
        // do not provide "out" and noRoam param,
        // Compatible with this usage:
        // echarts.util.map(item.points, api.coord)
        return coordSys.dataToPoint(data);
      },
      size: bind$1(dataToCoordSize$2, coordSys)
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function dataToCoordSize$1(dataSize, dataItem) {
  // dataItem is necessary in log axis.
  var axis = this.getAxis();
  var val = dataItem instanceof Array ? dataItem[0] : dataItem;
  var halfSize = (dataSize instanceof Array ? dataSize[0] : dataSize) / 2;
  return axis.type === 'category' ? axis.getBandWidth() : Math.abs(axis.dataToCoord(val - halfSize) - axis.dataToCoord(val + halfSize));
}
function singlePrepareCustom(coordSys) {
  var rect = coordSys.getRect();
  return {
    coordSys: {
      type: 'singleAxis',
      x: rect.x,
      y: rect.y,
      width: rect.width,
      height: rect.height
    },
    api: {
      coord: function (val) {
        // do not provide "out" param
        return coordSys.dataToPoint(val);
      },
      size: bind$1(dataToCoordSize$1, coordSys)
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// import AngleAxis from './AngleAxis.js';
function dataToCoordSize(dataSize, dataItem) {
  // dataItem is necessary in log axis.
  dataItem = dataItem || [0, 0];
  return map$1(['Radius', 'Angle'], function (dim, dimIdx) {
    var getterName = 'get' + dim + 'Axis';
    // TODO: TYPE Check Angle Axis
    var axis = this[getterName]();
    var val = dataItem[dimIdx];
    var halfSize = dataSize[dimIdx] / 2;
    var result = axis.type === 'category' ? axis.getBandWidth() : Math.abs(axis.dataToCoord(val - halfSize) - axis.dataToCoord(val + halfSize));
    if (dim === 'Angle') {
      result = result * Math.PI / 180;
    }
    return result;
  }, this);
}
function polarPrepareCustom(coordSys) {
  var radiusAxis = coordSys.getRadiusAxis();
  var angleAxis = coordSys.getAngleAxis();
  var radius = radiusAxis.getExtent();
  radius[0] > radius[1] && radius.reverse();
  return {
    coordSys: {
      type: 'polar',
      cx: coordSys.cx,
      cy: coordSys.cy,
      r: radius[1],
      r0: radius[0]
    },
    api: {
      coord: function (data) {
        var radius = radiusAxis.dataToRadius(data[0]);
        var angle = angleAxis.dataToAngle(data[1]);
        var coord = coordSys.coordToPoint([radius, angle]);
        coord.push(radius, angle * Math.PI / 180);
        return coord;
      },
      size: bind$1(dataToCoordSize, coordSys)
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function calendarPrepareCustom(coordSys) {
  var rect = coordSys.getRect();
  var rangeInfo = coordSys.getRangeInfo();
  return {
    coordSys: {
      type: 'calendar',
      x: rect.x,
      y: rect.y,
      width: rect.width,
      height: rect.height,
      cellWidth: coordSys.getCellWidth(),
      cellHeight: coordSys.getCellHeight(),
      rangeInfo: {
        start: rangeInfo.start,
        end: rangeInfo.end,
        weeks: rangeInfo.weeks,
        dayCount: rangeInfo.allDay
      }
    },
    api: {
      coord: function (data, clamp) {
        return coordSys.dataToPoint(data, clamp);
      }
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var deprecatedLogs = {};
/**
 * Whether need to call `convertEC4CompatibleStyle`.
 */
function isEC4CompatibleStyle(style, elType, hasOwnTextContentOption, hasOwnTextConfig) {
  // Since echarts5, `RectText` is separated from its host element and style.text
  // does not exist any more. The compat work brings some extra burden on performance.
  // So we provide:
  // `legacy: true` force make compat.
  // `legacy: false`, force do not compat.
  // `legacy` not set: auto detect whether legacy.
  //     But in this case we do not compat (difficult to detect and rare case):
  //     Becuse custom series and graphic component support "merge", users may firstly
  //     only set `textStrokeWidth` style or secondly only set `text`.
  return style && (style.legacy || style.legacy !== false && !hasOwnTextContentOption && !hasOwnTextConfig && elType !== 'tspan'
  // Difficult to detect whether legacy for a "text" el.
  && (elType === 'text' || hasOwn(style, 'text')));
}
/**
 * `EC4CompatibleStyle` is style that might be in echarts4 format or echarts5 format.
 * @param hostStyle The properties might be modified.
 * @return If be text el, `textContentStyle` and `textConfig` will not be returned.
 *         Otherwise a `textContentStyle` and `textConfig` will be created, whose props area
 *         retried from the `hostStyle`.
 */
function convertFromEC4CompatibleStyle(hostStyle, elType, isNormal) {
  var srcStyle = hostStyle;
  var textConfig;
  var textContent;
  var textContentStyle;
  if (elType === 'text') {
    textContentStyle = srcStyle;
  } else {
    textContentStyle = {};
    hasOwn(srcStyle, 'text') && (textContentStyle.text = srcStyle.text);
    hasOwn(srcStyle, 'rich') && (textContentStyle.rich = srcStyle.rich);
    hasOwn(srcStyle, 'textFill') && (textContentStyle.fill = srcStyle.textFill);
    hasOwn(srcStyle, 'textStroke') && (textContentStyle.stroke = srcStyle.textStroke);
    hasOwn(srcStyle, 'fontFamily') && (textContentStyle.fontFamily = srcStyle.fontFamily);
    hasOwn(srcStyle, 'fontSize') && (textContentStyle.fontSize = srcStyle.fontSize);
    hasOwn(srcStyle, 'fontStyle') && (textContentStyle.fontStyle = srcStyle.fontStyle);
    hasOwn(srcStyle, 'fontWeight') && (textContentStyle.fontWeight = srcStyle.fontWeight);
    textContent = {
      type: 'text',
      style: textContentStyle,
      // ec4 does not support rectText trigger.
      // And when text position is different in normal and emphasis
      // => hover text trigger emphasis;
      // => text position changed, leave mouse pointer immediately;
      // That might cause incorrect state.
      silent: true
    };
    textConfig = {};
    var hasOwnPos = hasOwn(srcStyle, 'textPosition');
    if (isNormal) {
      textConfig.position = hasOwnPos ? srcStyle.textPosition : 'inside';
    } else {
      hasOwnPos && (textConfig.position = srcStyle.textPosition);
    }
    hasOwn(srcStyle, 'textPosition') && (textConfig.position = srcStyle.textPosition);
    hasOwn(srcStyle, 'textOffset') && (textConfig.offset = srcStyle.textOffset);
    hasOwn(srcStyle, 'textRotation') && (textConfig.rotation = srcStyle.textRotation);
    hasOwn(srcStyle, 'textDistance') && (textConfig.distance = srcStyle.textDistance);
  }
  convertEC4CompatibleRichItem(textContentStyle, hostStyle);
  each$f(textContentStyle.rich, function (richItem) {
    convertEC4CompatibleRichItem(richItem, richItem);
  });
  return {
    textConfig: textConfig,
    textContent: textContent
  };
}
/**
 * The result will be set to `out`.
 */
function convertEC4CompatibleRichItem(out, richItem) {
  if (!richItem) {
    return;
  }
  // (1) For simplicity, make textXXX properties (deprecated since ec5) has
  // higher priority. For example, consider in ec4 `borderColor: 5, textBorderColor: 10`
  // on a rect means `borderColor: 4` on the rect and `borderColor: 10` on an attached
  // richText in ec5.
  // (2) `out === richItem` if and only if `out` is text el or rich item.
  // So we can overwrite existing props in `out` since textXXX has higher priority.
  richItem.font = richItem.textFont || richItem.font;
  hasOwn(richItem, 'textStrokeWidth') && (out.lineWidth = richItem.textStrokeWidth);
  hasOwn(richItem, 'textAlign') && (out.align = richItem.textAlign);
  hasOwn(richItem, 'textVerticalAlign') && (out.verticalAlign = richItem.textVerticalAlign);
  hasOwn(richItem, 'textLineHeight') && (out.lineHeight = richItem.textLineHeight);
  hasOwn(richItem, 'textWidth') && (out.width = richItem.textWidth);
  hasOwn(richItem, 'textHeight') && (out.height = richItem.textHeight);
  hasOwn(richItem, 'textBackgroundColor') && (out.backgroundColor = richItem.textBackgroundColor);
  hasOwn(richItem, 'textPadding') && (out.padding = richItem.textPadding);
  hasOwn(richItem, 'textBorderColor') && (out.borderColor = richItem.textBorderColor);
  hasOwn(richItem, 'textBorderWidth') && (out.borderWidth = richItem.textBorderWidth);
  hasOwn(richItem, 'textBorderRadius') && (out.borderRadius = richItem.textBorderRadius);
  hasOwn(richItem, 'textBoxShadowColor') && (out.shadowColor = richItem.textBoxShadowColor);
  hasOwn(richItem, 'textBoxShadowBlur') && (out.shadowBlur = richItem.textBoxShadowBlur);
  hasOwn(richItem, 'textBoxShadowOffsetX') && (out.shadowOffsetX = richItem.textBoxShadowOffsetX);
  hasOwn(richItem, 'textBoxShadowOffsetY') && (out.shadowOffsetY = richItem.textBoxShadowOffsetY);
}
/**
 * Convert to pure echarts4 format style.
 * `itemStyle` will be modified, added with ec4 style properties from
 * `textStyle` and `textConfig`.
 *
 * [Caveat]: For simplicity, `insideRollback` in ec4 does not compat, where
 * `styleEmphasis: {textFill: 'red'}` will remove the normal auto added stroke.
 */
function convertToEC4StyleForCustomSerise(itemStl, txStl, txCfg) {
  var out = itemStl;
  // See `custom.ts`, a trick to set extra `textPosition` firstly.
  out.textPosition = out.textPosition || txCfg.position || 'inside';
  txCfg.offset != null && (out.textOffset = txCfg.offset);
  txCfg.rotation != null && (out.textRotation = txCfg.rotation);
  txCfg.distance != null && (out.textDistance = txCfg.distance);
  var isInside = out.textPosition.indexOf('inside') >= 0;
  var hostFill = itemStl.fill || '#000';
  convertToEC4RichItem(out, txStl);
  var textFillNotSet = out.textFill == null;
  if (isInside) {
    if (textFillNotSet) {
      out.textFill = txCfg.insideFill || '#fff';
      !out.textStroke && txCfg.insideStroke && (out.textStroke = txCfg.insideStroke);
      !out.textStroke && (out.textStroke = hostFill);
      out.textStrokeWidth == null && (out.textStrokeWidth = 2);
    }
  } else {
    if (textFillNotSet) {
      out.textFill = itemStl.fill || txCfg.outsideFill || '#000';
    }
    !out.textStroke && txCfg.outsideStroke && (out.textStroke = txCfg.outsideStroke);
  }
  out.text = txStl.text;
  out.rich = txStl.rich;
  each$f(txStl.rich, function (richItem) {
    convertToEC4RichItem(richItem, richItem);
  });
  return out;
}
function convertToEC4RichItem(out, richItem) {
  if (!richItem) {
    return;
  }
  hasOwn(richItem, 'fill') && (out.textFill = richItem.fill);
  hasOwn(richItem, 'stroke') && (out.textStroke = richItem.fill);
  hasOwn(richItem, 'lineWidth') && (out.textStrokeWidth = richItem.lineWidth);
  hasOwn(richItem, 'font') && (out.font = richItem.font);
  hasOwn(richItem, 'fontStyle') && (out.fontStyle = richItem.fontStyle);
  hasOwn(richItem, 'fontWeight') && (out.fontWeight = richItem.fontWeight);
  hasOwn(richItem, 'fontSize') && (out.fontSize = richItem.fontSize);
  hasOwn(richItem, 'fontFamily') && (out.fontFamily = richItem.fontFamily);
  hasOwn(richItem, 'align') && (out.textAlign = richItem.align);
  hasOwn(richItem, 'verticalAlign') && (out.textVerticalAlign = richItem.verticalAlign);
  hasOwn(richItem, 'lineHeight') && (out.textLineHeight = richItem.lineHeight);
  hasOwn(richItem, 'width') && (out.textWidth = richItem.width);
  hasOwn(richItem, 'height') && (out.textHeight = richItem.height);
  hasOwn(richItem, 'backgroundColor') && (out.textBackgroundColor = richItem.backgroundColor);
  hasOwn(richItem, 'padding') && (out.textPadding = richItem.padding);
  hasOwn(richItem, 'borderColor') && (out.textBorderColor = richItem.borderColor);
  hasOwn(richItem, 'borderWidth') && (out.textBorderWidth = richItem.borderWidth);
  hasOwn(richItem, 'borderRadius') && (out.textBorderRadius = richItem.borderRadius);
  hasOwn(richItem, 'shadowColor') && (out.textBoxShadowColor = richItem.shadowColor);
  hasOwn(richItem, 'shadowBlur') && (out.textBoxShadowBlur = richItem.shadowBlur);
  hasOwn(richItem, 'shadowOffsetX') && (out.textBoxShadowOffsetX = richItem.shadowOffsetX);
  hasOwn(richItem, 'shadowOffsetY') && (out.textBoxShadowOffsetY = richItem.shadowOffsetY);
  hasOwn(richItem, 'textShadowColor') && (out.textShadowColor = richItem.textShadowColor);
  hasOwn(richItem, 'textShadowBlur') && (out.textShadowBlur = richItem.textShadowBlur);
  hasOwn(richItem, 'textShadowOffsetX') && (out.textShadowOffsetX = richItem.textShadowOffsetX);
  hasOwn(richItem, 'textShadowOffsetY') && (out.textShadowOffsetY = richItem.textShadowOffsetY);
}
function warnDeprecated(deprecated, insteadApproach) {
  {
    var key = deprecated + '^_^' + insteadApproach;
    if (!deprecatedLogs[key]) {
      console.warn("[ECharts] DEPRECATED: \"" + deprecated + "\" has been deprecated. " + insteadApproach);
      deprecatedLogs[key] = true;
    }
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var LEGACY_TRANSFORM_PROPS_MAP = {
  position: ['x', 'y'],
  scale: ['scaleX', 'scaleY'],
  origin: ['originX', 'originY']
};
var LEGACY_TRANSFORM_PROPS = keys(LEGACY_TRANSFORM_PROPS_MAP);
var TRANSFORM_PROPS_MAP = reduce(TRANSFORMABLE_PROPS, function (obj, key) {
  obj[key] = 1;
  return obj;
}, {});
var transformPropNamesStr = TRANSFORMABLE_PROPS.join(', ');
// '' means root
var ELEMENT_ANIMATABLE_PROPS = ['', 'style', 'shape', 'extra'];
var transitionInnerStore = makeInner();
function getElementAnimationConfig(animationType, el, elOption, parentModel, dataIndex) {
  var animationProp = animationType + "Animation";
  var config = getAnimationConfig(animationType, parentModel, dataIndex) || {};
  var userDuring = transitionInnerStore(el).userDuring;
  // Only set when duration is > 0 and it's need to be animated.
  if (config.duration > 0) {
    // For simplicity, if during not specified, the previous during will not work any more.
    config.during = userDuring ? bind$1(duringCall, {
      el: el,
      userDuring: userDuring
    }) : null;
    config.setToFinal = true;
    config.scope = animationType;
  }
  extend(config, elOption[animationProp]);
  return config;
}
function applyUpdateTransition(el, elOption, animatableModel, opts) {
  opts = opts || {};
  var dataIndex = opts.dataIndex,
    isInit = opts.isInit,
    clearStyle = opts.clearStyle;
  var hasAnimation = animatableModel.isAnimationEnabled();
  // Save the meta info for further morphing. Like apply on the sub morphing elements.
  var store = transitionInnerStore(el);
  var styleOpt = elOption.style;
  store.userDuring = elOption.during;
  var transFromProps = {};
  var propsToSet = {};
  prepareTransformAllPropsFinal(el, elOption, propsToSet);
  prepareShapeOrExtraAllPropsFinal('shape', elOption, propsToSet);
  prepareShapeOrExtraAllPropsFinal('extra', elOption, propsToSet);
  if (!isInit && hasAnimation) {
    prepareTransformTransitionFrom(el, elOption, transFromProps);
    prepareShapeOrExtraTransitionFrom('shape', el, elOption, transFromProps);
    prepareShapeOrExtraTransitionFrom('extra', el, elOption, transFromProps);
    prepareStyleTransitionFrom(el, elOption, styleOpt, transFromProps);
  }
  propsToSet.style = styleOpt;
  applyPropsDirectly(el, propsToSet, clearStyle);
  applyMiscProps(el, elOption);
  if (hasAnimation) {
    if (isInit) {
      var enterFromProps_1 = {};
      each$f(ELEMENT_ANIMATABLE_PROPS, function (propName) {
        var prop = propName ? elOption[propName] : elOption;
        if (prop && prop.enterFrom) {
          if (propName) {
            enterFromProps_1[propName] = enterFromProps_1[propName] || {};
          }
          extend(propName ? enterFromProps_1[propName] : enterFromProps_1, prop.enterFrom);
        }
      });
      var config = getElementAnimationConfig('enter', el, elOption, animatableModel, dataIndex);
      if (config.duration > 0) {
        el.animateFrom(enterFromProps_1, config);
      }
    } else {
      applyPropsTransition(el, elOption, dataIndex || 0, animatableModel, transFromProps);
    }
  }
  // Store leave to be used in leave transition.
  updateLeaveTo(el, elOption);
  styleOpt ? el.dirty() : el.markRedraw();
}
function updateLeaveTo(el, elOption) {
  // Try merge to previous set leaveTo
  var leaveToProps = transitionInnerStore(el).leaveToProps;
  for (var i = 0; i < ELEMENT_ANIMATABLE_PROPS.length; i++) {
    var propName = ELEMENT_ANIMATABLE_PROPS[i];
    var prop = propName ? elOption[propName] : elOption;
    if (prop && prop.leaveTo) {
      if (!leaveToProps) {
        leaveToProps = transitionInnerStore(el).leaveToProps = {};
      }
      if (propName) {
        leaveToProps[propName] = leaveToProps[propName] || {};
      }
      extend(propName ? leaveToProps[propName] : leaveToProps, prop.leaveTo);
    }
  }
}
function applyLeaveTransition(el, elOption, animatableModel, onRemove) {
  if (el) {
    var parent_1 = el.parent;
    var leaveToProps = transitionInnerStore(el).leaveToProps;
    if (leaveToProps) {
      // TODO TODO use leave after leaveAnimation in series is introduced
      // TODO Data index?
      var config = getElementAnimationConfig('update', el, elOption, animatableModel, 0);
      config.done = function () {
        parent_1.remove(el);
        onRemove && onRemove();
      };
      el.animateTo(leaveToProps, config);
    } else {
      parent_1.remove(el);
      onRemove && onRemove();
    }
  }
}
function isTransitionAll(transition) {
  return transition === 'all';
}
function applyPropsDirectly(el,
// Can be null/undefined
allPropsFinal, clearStyle) {
  var styleOpt = allPropsFinal.style;
  if (!el.isGroup && styleOpt) {
    if (clearStyle) {
      el.useStyle({});
      // When style object changed, how to trade the existing animation?
      // It is probably complicated and not needed to cover all the cases.
      // But still need consider the case:
      // (1) When using init animation on `style.opacity`, and before the animation
      //     ended users triggers an update by mousewhel. At that time the init
      //     animation should better be continued rather than terminated.
      //     So after `useStyle` called, we should change the animation target manually
      //     to continue the effect of the init animation.
      // (2) PENDING: If the previous animation targeted at a `val1`, and currently we need
      //     to update the value to `val2` and no animation declared, should be terminate
      //     the previous animation or just modify the target of the animation?
      //     Therotically That will happen not only on `style` but also on `shape` and
      //     `transfrom` props. But we haven't handle this case at present yet.
      // (3) PENDING: Is it proper to visit `animators` and `targetName`?
      var animators = el.animators;
      for (var i = 0; i < animators.length; i++) {
        var animator = animators[i];
        // targetName is the "topKey".
        if (animator.targetName === 'style') {
          animator.changeTarget(el.style);
        }
      }
    }
    el.setStyle(styleOpt);
  }
  if (allPropsFinal) {
    // Not set style here.
    allPropsFinal.style = null;
    // Set el to the final state firstly.
    allPropsFinal && el.attr(allPropsFinal);
    allPropsFinal.style = styleOpt;
  }
}
function applyPropsTransition(el, elOption, dataIndex, model,
// Can be null/undefined
transFromProps) {
  if (transFromProps) {
    var config = getElementAnimationConfig('update', el, elOption, model, dataIndex);
    if (config.duration > 0) {
      el.animateFrom(transFromProps, config);
    }
  }
}
function applyMiscProps(el, elOption) {
  // Merge by default.
  hasOwn(elOption, 'silent') && (el.silent = elOption.silent);
  hasOwn(elOption, 'ignore') && (el.ignore = elOption.ignore);
  if (el instanceof Displayable$1) {
    hasOwn(elOption, 'invisible') && (el.invisible = elOption.invisible);
  }
  if (el instanceof Path$1) {
    hasOwn(elOption, 'autoBatch') && (el.autoBatch = elOption.autoBatch);
  }
}
// Use it to avoid it be exposed to user.
var tmpDuringScope = {};
var transitionDuringAPI = {
  // Usually other props do not need to be changed in animation during.
  setTransform: function (key, val) {
    {
      assert(hasOwn(TRANSFORM_PROPS_MAP, key), 'Only ' + transformPropNamesStr + ' available in `setTransform`.');
    }
    tmpDuringScope.el[key] = val;
    return this;
  },
  getTransform: function (key) {
    {
      assert(hasOwn(TRANSFORM_PROPS_MAP, key), 'Only ' + transformPropNamesStr + ' available in `getTransform`.');
    }
    return tmpDuringScope.el[key];
  },
  setShape: function (key, val) {
    {
      assertNotReserved(key);
    }
    var el = tmpDuringScope.el;
    var shape = el.shape || (el.shape = {});
    shape[key] = val;
    el.dirtyShape && el.dirtyShape();
    return this;
  },
  getShape: function (key) {
    {
      assertNotReserved(key);
    }
    var shape = tmpDuringScope.el.shape;
    if (shape) {
      return shape[key];
    }
  },
  setStyle: function (key, val) {
    {
      assertNotReserved(key);
    }
    var el = tmpDuringScope.el;
    var style = el.style;
    if (style) {
      {
        if (eqNaN(val)) {
          warn('style.' + key + ' must not be assigned with NaN.');
        }
      }
      style[key] = val;
      el.dirtyStyle && el.dirtyStyle();
    }
    return this;
  },
  getStyle: function (key) {
    {
      assertNotReserved(key);
    }
    var style = tmpDuringScope.el.style;
    if (style) {
      return style[key];
    }
  },
  setExtra: function (key, val) {
    {
      assertNotReserved(key);
    }
    var extra = tmpDuringScope.el.extra || (tmpDuringScope.el.extra = {});
    extra[key] = val;
    return this;
  },
  getExtra: function (key) {
    {
      assertNotReserved(key);
    }
    var extra = tmpDuringScope.el.extra;
    if (extra) {
      return extra[key];
    }
  }
};
function assertNotReserved(key) {
  {
    if (key === 'transition' || key === 'enterFrom' || key === 'leaveTo') {
      throw new Error('key must not be "' + key + '"');
    }
  }
}
function duringCall() {
  // Do not provide "percent" until some requirements come.
  // Because consider thies case:
  // enterFrom: {x: 100, y: 30}, transition: 'x'.
  // And enter duration is different from update duration.
  // Thus it might be confused about the meaning of "percent" in during callback.
  var scope = this;
  var el = scope.el;
  if (!el) {
    return;
  }
  // If el is remove from zr by reason like legend, during still need to called,
  // because el will be added back to zr and the prop value should not be incorrect.
  var latestUserDuring = transitionInnerStore(el).userDuring;
  var scopeUserDuring = scope.userDuring;
  // Ensured a during is only called once in each animation frame.
  // If a during is called multiple times in one frame, maybe some users' calculation logic
  // might be wrong (not sure whether this usage exists).
  // The case of a during might be called twice can be: by default there is a animator for
  // 'x', 'y' when init. Before the init animation finished, call `setOption` to start
  // another animators for 'style'/'shape'/'extra'.
  if (latestUserDuring !== scopeUserDuring) {
    // release
    scope.el = scope.userDuring = null;
    return;
  }
  tmpDuringScope.el = el;
  // Give no `this` to user in "during" calling.
  scopeUserDuring(transitionDuringAPI);
  // FIXME: if in future meet the case that some prop will be both modified in `during` and `state`,
  // consider the issue that the prop might be incorrect when return to "normal" state.
}
function prepareShapeOrExtraTransitionFrom(mainAttr, fromEl, elOption, transFromProps) {
  var attrOpt = elOption[mainAttr];
  if (!attrOpt) {
    return;
  }
  var elPropsInAttr = fromEl[mainAttr];
  var transFromPropsInAttr;
  if (elPropsInAttr) {
    var transition = elOption.transition;
    var attrTransition = attrOpt.transition;
    if (attrTransition) {
      !transFromPropsInAttr && (transFromPropsInAttr = transFromProps[mainAttr] = {});
      if (isTransitionAll(attrTransition)) {
        extend(transFromPropsInAttr, elPropsInAttr);
      } else {
        var transitionKeys = normalizeToArray(attrTransition);
        for (var i = 0; i < transitionKeys.length; i++) {
          var key = transitionKeys[i];
          var elVal = elPropsInAttr[key];
          transFromPropsInAttr[key] = elVal;
        }
      }
    } else if (isTransitionAll(transition) || indexOf(transition, mainAttr) >= 0) {
      !transFromPropsInAttr && (transFromPropsInAttr = transFromProps[mainAttr] = {});
      var elPropsInAttrKeys = keys(elPropsInAttr);
      for (var i = 0; i < elPropsInAttrKeys.length; i++) {
        var key = elPropsInAttrKeys[i];
        var elVal = elPropsInAttr[key];
        if (isNonStyleTransitionEnabled(attrOpt[key], elVal)) {
          transFromPropsInAttr[key] = elVal;
        }
      }
    }
  }
}
function prepareShapeOrExtraAllPropsFinal(mainAttr, elOption, allProps) {
  var attrOpt = elOption[mainAttr];
  if (!attrOpt) {
    return;
  }
  var allPropsInAttr = allProps[mainAttr] = {};
  var keysInAttr = keys(attrOpt);
  for (var i = 0; i < keysInAttr.length; i++) {
    var key = keysInAttr[i];
    // To avoid share one object with different element, and
    // to avoid user modify the object inexpectedly, have to clone.
    allPropsInAttr[key] = cloneValue(attrOpt[key]);
  }
}
function prepareTransformTransitionFrom(el, elOption, transFromProps) {
  var transition = elOption.transition;
  var transitionKeys = isTransitionAll(transition) ? TRANSFORMABLE_PROPS : normalizeToArray(transition || []);
  for (var i = 0; i < transitionKeys.length; i++) {
    var key = transitionKeys[i];
    if (key === 'style' || key === 'shape' || key === 'extra') {
      continue;
    }
    var elVal = el[key];
    {
      checkTransformPropRefer(key, 'el.transition');
    }
    // Do not clone, animator will perform that clone.
    transFromProps[key] = elVal;
  }
}
function prepareTransformAllPropsFinal(el, elOption, allProps) {
  for (var i = 0; i < LEGACY_TRANSFORM_PROPS.length; i++) {
    var legacyName = LEGACY_TRANSFORM_PROPS[i];
    var xyName = LEGACY_TRANSFORM_PROPS_MAP[legacyName];
    var legacyArr = elOption[legacyName];
    if (legacyArr) {
      allProps[xyName[0]] = legacyArr[0];
      allProps[xyName[1]] = legacyArr[1];
    }
  }
  for (var i = 0; i < TRANSFORMABLE_PROPS.length; i++) {
    var key = TRANSFORMABLE_PROPS[i];
    if (elOption[key] != null) {
      allProps[key] = elOption[key];
    }
  }
}
function prepareStyleTransitionFrom(fromEl, elOption, styleOpt, transFromProps) {
  if (!styleOpt) {
    return;
  }
  var fromElStyle = fromEl.style;
  var transFromStyleProps;
  if (fromElStyle) {
    var styleTransition = styleOpt.transition;
    var elTransition = elOption.transition;
    if (styleTransition && !isTransitionAll(styleTransition)) {
      var transitionKeys = normalizeToArray(styleTransition);
      !transFromStyleProps && (transFromStyleProps = transFromProps.style = {});
      for (var i = 0; i < transitionKeys.length; i++) {
        var key = transitionKeys[i];
        var elVal = fromElStyle[key];
        // Do not clone, see `checkNonStyleTansitionRefer`.
        transFromStyleProps[key] = elVal;
      }
    } else if (fromEl.getAnimationStyleProps && (isTransitionAll(elTransition) || isTransitionAll(styleTransition) || indexOf(elTransition, 'style') >= 0)) {
      var animationProps = fromEl.getAnimationStyleProps();
      var animationStyleProps = animationProps ? animationProps.style : null;
      if (animationStyleProps) {
        !transFromStyleProps && (transFromStyleProps = transFromProps.style = {});
        var styleKeys = keys(styleOpt);
        for (var i = 0; i < styleKeys.length; i++) {
          var key = styleKeys[i];
          if (animationStyleProps[key]) {
            var elVal = fromElStyle[key];
            transFromStyleProps[key] = elVal;
          }
        }
      }
    }
  }
}
function isNonStyleTransitionEnabled(optVal, elVal) {
  // The same as `checkNonStyleTansitionRefer`.
  return !isArrayLike(optVal) ? optVal != null && isFinite(optVal) : optVal !== elVal;
}
var checkTransformPropRefer;
{
  checkTransformPropRefer = function (key, usedIn) {
    if (!hasOwn(TRANSFORM_PROPS_MAP, key)) {
      warn('Prop `' + key + '` is not a permitted in `' + usedIn + '`. ' + 'Only `' + keys(TRANSFORM_PROPS_MAP).join('`, `') + '` are permitted.');
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var getStateToRestore = makeInner();
var KEYFRAME_EXCLUDE_KEYS = ['percent', 'easing', 'shape', 'style', 'extra'];
/**
 * Stop previous keyframe animation and restore the attributes.
 * Avoid new keyframe animation starts with wrong internal state when the percent: 0 is not set.
 */
function stopPreviousKeyframeAnimationAndRestore(el) {
  // Stop previous keyframe animation.
  el.stopAnimation('keyframe');
  // Restore
  el.attr(getStateToRestore(el));
}
function applyKeyframeAnimation(el, animationOpts, animatableModel) {
  if (!animatableModel.isAnimationEnabled() || !animationOpts) {
    return;
  }
  if (isArray$1(animationOpts)) {
    each$f(animationOpts, function (singleAnimationOpts) {
      applyKeyframeAnimation(el, singleAnimationOpts, animatableModel);
    });
    return;
  }
  var keyframes = animationOpts.keyframes;
  var duration = animationOpts.duration;
  if (animatableModel && duration == null) {
    // Default to use duration of config.
    // NOTE: animation config from payload will be ignored because they are mainly for transitions.
    var config = getAnimationConfig('enter', animatableModel, 0);
    duration = config && config.duration;
  }
  if (!keyframes || !duration) {
    return;
  }
  var stateToRestore = getStateToRestore(el);
  each$f(ELEMENT_ANIMATABLE_PROPS, function (targetPropName) {
    if (targetPropName && !el[targetPropName]) {
      return;
    }
    var animator;
    var endFrameIsSet = false;
    // Sort keyframes by percent.
    keyframes.sort(function (a, b) {
      return a.percent - b.percent;
    });
    each$f(keyframes, function (kf) {
      // Stop current animation.
      var animators = el.animators;
      var kfValues = targetPropName ? kf[targetPropName] : kf;
      {
        if (kf.percent >= 1) {
          endFrameIsSet = true;
        }
      }
      if (!kfValues) {
        return;
      }
      var propKeys = keys(kfValues);
      if (!targetPropName) {
        // PENDING performance?
        propKeys = filter(propKeys, function (key) {
          return indexOf(KEYFRAME_EXCLUDE_KEYS, key) < 0;
        });
      }
      if (!propKeys.length) {
        return;
      }
      if (!animator) {
        animator = el.animate(targetPropName, animationOpts.loop, true);
        animator.scope = 'keyframe';
      }
      for (var i = 0; i < animators.length; i++) {
        // Stop all other animation that is not keyframe.
        if (animators[i] !== animator && animators[i].targetName === animator.targetName) {
          animators[i].stopTracks(propKeys);
        }
      }
      targetPropName && (stateToRestore[targetPropName] = stateToRestore[targetPropName] || {});
      var savedTarget = targetPropName ? stateToRestore[targetPropName] : stateToRestore;
      each$f(propKeys, function (key) {
        // Save original value.
        savedTarget[key] = ((targetPropName ? el[targetPropName] : el) || {})[key];
      });
      animator.whenWithKeys(duration * kf.percent, kfValues, propKeys, kf.easing);
    });
    if (!animator) {
      return;
    }
    {
      if (!endFrameIsSet) {
        warn('End frame with percent: 1 is missing in the keyframeAnimation.', true);
      }
    }
    animator.delay(animationOpts.delay || 0).duration(duration).start(animationOpts.easing);
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var EMPHASIS = 'emphasis';
var NORMAL = 'normal';
var BLUR = 'blur';
var SELECT = 'select';
var STATES = [NORMAL, EMPHASIS, BLUR, SELECT];
var PATH_ITEM_STYLE = {
  normal: ['itemStyle'],
  emphasis: [EMPHASIS, 'itemStyle'],
  blur: [BLUR, 'itemStyle'],
  select: [SELECT, 'itemStyle']
};
var PATH_LABEL = {
  normal: ['label'],
  emphasis: [EMPHASIS, 'label'],
  blur: [BLUR, 'label'],
  select: [SELECT, 'label']
};
var DEFAULT_TRANSITION = ['x', 'y'];
// Use prefix to avoid index to be the same as el.name,
// which will cause weird update animation.
var GROUP_DIFF_PREFIX = 'e\0\0';
var attachedTxInfoTmp = {
  normal: {},
  emphasis: {},
  blur: {},
  select: {}
};
/**
 * To reduce total package size of each coordinate systems, the modules `prepareCustom`
 * of each coordinate systems are not required by each coordinate systems directly, but
 * required by the module `custom`.
 *
 * prepareInfoForCustomSeries {Function}: optional
 *     @return {Object} {coordSys: {...}, api: {
 *         coord: function (data, clamp) {}, // return point in global.
 *         size: function (dataSize, dataItem) {} // return size of each axis in coordSys.
 *     }}
 */
var prepareCustoms = {
  cartesian2d: cartesianPrepareCustom,
  geo: geoPrepareCustom,
  single: singlePrepareCustom,
  polar: polarPrepareCustom,
  calendar: calendarPrepareCustom
};
function isPath(el) {
  return el instanceof Path$1;
}
function isDisplayable(el) {
  return el instanceof Displayable$1;
}
function copyElement(sourceEl, targetEl) {
  targetEl.copyTransform(sourceEl);
  if (isDisplayable(targetEl) && isDisplayable(sourceEl)) {
    targetEl.setStyle(sourceEl.style);
    targetEl.z = sourceEl.z;
    targetEl.z2 = sourceEl.z2;
    targetEl.zlevel = sourceEl.zlevel;
    targetEl.invisible = sourceEl.invisible;
    targetEl.ignore = sourceEl.ignore;
    if (isPath(targetEl) && isPath(sourceEl)) {
      targetEl.setShape(sourceEl.shape);
    }
  }
}
var CustomChartView = /** @class */function (_super) {
  __extends(CustomChartView, _super);
  function CustomChartView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = CustomChartView.type;
    return _this;
  }
  CustomChartView.prototype.render = function (customSeries, ecModel, api, payload) {
    // Clear previously rendered progressive elements.
    this._progressiveEls = null;
    var oldData = this._data;
    var data = customSeries.getData();
    var group = this.group;
    var renderItem = makeRenderItem(customSeries, data, ecModel, api);
    if (!oldData) {
      // Previous render is incremental render or first render.
      // Needs remove the incremental rendered elements.
      group.removeAll();
    }
    data.diff(oldData).add(function (newIdx) {
      createOrUpdateItem(api, null, newIdx, renderItem(newIdx, payload), customSeries, group, data);
    }).remove(function (oldIdx) {
      var el = oldData.getItemGraphicEl(oldIdx);
      el && applyLeaveTransition(el, customInnerStore(el).option, customSeries);
    }).update(function (newIdx, oldIdx) {
      var oldEl = oldData.getItemGraphicEl(oldIdx);
      createOrUpdateItem(api, oldEl, newIdx, renderItem(newIdx, payload), customSeries, group, data);
    }).execute();
    // Do clipping
    var clipPath = customSeries.get('clip', true) ? createClipPath(customSeries.coordinateSystem, false, customSeries) : null;
    if (clipPath) {
      group.setClipPath(clipPath);
    } else {
      group.removeClipPath();
    }
    this._data = data;
  };
  CustomChartView.prototype.incrementalPrepareRender = function (customSeries, ecModel, api) {
    this.group.removeAll();
    this._data = null;
  };
  CustomChartView.prototype.incrementalRender = function (params, customSeries, ecModel, api, payload) {
    var data = customSeries.getData();
    var renderItem = makeRenderItem(customSeries, data, ecModel, api);
    var progressiveEls = this._progressiveEls = [];
    function setIncrementalAndHoverLayer(el) {
      if (!el.isGroup) {
        el.incremental = true;
        el.ensureState('emphasis').hoverLayer = true;
      }
    }
    for (var idx = params.start; idx < params.end; idx++) {
      var el = createOrUpdateItem(null, null, idx, renderItem(idx, payload), customSeries, this.group, data);
      if (el) {
        el.traverse(setIncrementalAndHoverLayer);
        progressiveEls.push(el);
      }
    }
  };
  CustomChartView.prototype.eachRendered = function (cb) {
    traverseElements(this._progressiveEls || this.group, cb);
  };
  CustomChartView.prototype.filterForExposedEvent = function (eventType, query, targetEl, packedEvent) {
    var elementName = query.element;
    if (elementName == null || targetEl.name === elementName) {
      return true;
    }
    // Enable to give a name on a group made by `renderItem`, and listen
    // events that are triggered by its descendents.
    while ((targetEl = targetEl.__hostTarget || targetEl.parent) && targetEl !== this.group) {
      if (targetEl.name === elementName) {
        return true;
      }
    }
    return false;
  };
  CustomChartView.type = 'custom';
  return CustomChartView;
}(ChartView$1);
var CustomChartView$1 = CustomChartView;
function createEl$1(elOption) {
  var graphicType = elOption.type;
  var el;
  // Those graphic elements are not shapes. They should not be
  // overwritten by users, so do them first.
  if (graphicType === 'path') {
    var shape = elOption.shape;
    // Using pathRect brings convenience to users sacle svg path.
    var pathRect = shape.width != null && shape.height != null ? {
      x: shape.x || 0,
      y: shape.y || 0,
      width: shape.width,
      height: shape.height
    } : null;
    var pathData = getPathData(shape);
    // Path is also used for icon, so layout 'center' by default.
    el = makePath(pathData, null, pathRect, shape.layout || 'center');
    customInnerStore(el).customPathData = pathData;
  } else if (graphicType === 'image') {
    el = new ZRImage$1({});
    customInnerStore(el).customImagePath = elOption.style.image;
  } else if (graphicType === 'text') {
    el = new ZRText$1({});
    // customInnerStore(el).customText = (elOption.style as TextStyleProps).text;
  } else if (graphicType === 'group') {
    el = new Group$5();
  } else if (graphicType === 'compoundPath') {
    throw new Error('"compoundPath" is not supported yet.');
  } else {
    var Clz = getShapeClass(graphicType);
    if (!Clz) {
      var errMsg = '';
      {
        errMsg = 'graphic type "' + graphicType + '" can not be found.';
      }
      throwError(errMsg);
    }
    el = new Clz();
  }
  customInnerStore(el).customGraphicType = graphicType;
  el.name = elOption.name;
  // Compat ec4: the default z2 lift is 1. If changing the number,
  // some cases probably be broken: hierarchy layout along z, like circle packing,
  // where emphasis only intending to modify color/border rather than lift z2.
  el.z2EmphasisLift = 1;
  el.z2SelectLift = 1;
  return el;
}
function updateElNormal(
// Can be null/undefined
api, el, dataIndex, elOption, attachedTxInfo, seriesModel, isInit) {
  // Stop and restore before update any other attributes.
  stopPreviousKeyframeAnimationAndRestore(el);
  var txCfgOpt = attachedTxInfo && attachedTxInfo.normal.cfg;
  if (txCfgOpt) {
    // PENDING: whether use user object directly rather than clone?
    // TODO:5.0 textConfig transition animation?
    el.setTextConfig(txCfgOpt);
  }
  // Default transition ['x', 'y']
  if (elOption && elOption.transition == null) {
    elOption.transition = DEFAULT_TRANSITION;
  }
  // Do some normalization on style.
  var styleOpt = elOption && elOption.style;
  if (styleOpt) {
    if (el.type === 'text') {
      var textOptionStyle = styleOpt;
      // Compatible with ec4: if `textFill` or `textStroke` exists use them.
      hasOwn(textOptionStyle, 'textFill') && (textOptionStyle.fill = textOptionStyle.textFill);
      hasOwn(textOptionStyle, 'textStroke') && (textOptionStyle.stroke = textOptionStyle.textStroke);
    }
    var decalPattern = void 0;
    var decalObj = isPath(el) ? styleOpt.decal : null;
    if (api && decalObj) {
      decalObj.dirty = true;
      decalPattern = createOrUpdatePatternFromDecal(decalObj, api);
    }
    // Always overwrite in case user specify this prop.
    styleOpt.__decalPattern = decalPattern;
  }
  if (isDisplayable(el)) {
    if (styleOpt) {
      var decalPattern = styleOpt.__decalPattern;
      if (decalPattern) {
        styleOpt.decal = decalPattern;
      }
    }
  }
  applyUpdateTransition(el, elOption, seriesModel, {
    dataIndex: dataIndex,
    isInit: isInit,
    clearStyle: true
  });
  applyKeyframeAnimation(el, elOption.keyframeAnimation, seriesModel);
}
function updateElOnState(state, el, elStateOpt, styleOpt, attachedTxInfo) {
  var elDisplayable = el.isGroup ? null : el;
  var txCfgOpt = attachedTxInfo && attachedTxInfo[state].cfg;
  // PENDING:5.0 support customize scale change and transition animation?
  if (elDisplayable) {
    // By default support auto lift color when hover whether `emphasis` specified.
    var stateObj = elDisplayable.ensureState(state);
    if (styleOpt === false) {
      var existingEmphasisState = elDisplayable.getState(state);
      if (existingEmphasisState) {
        existingEmphasisState.style = null;
      }
    } else {
      // style is needed to enable default emphasis.
      stateObj.style = styleOpt || null;
    }
    // If `elOption.styleEmphasis` or `elOption.emphasis.style` is `false`,
    // remove hover style.
    // If `elOption.textConfig` or `elOption.emphasis.textConfig` is null/undefined, it does not
    // make sense. So for simplicity, we do not ditinguish `hasOwnProperty` and null/undefined.
    if (txCfgOpt) {
      stateObj.textConfig = txCfgOpt;
    }
    setDefaultStateProxy(elDisplayable);
  }
}
function updateZ(el, elOption, seriesModel) {
  // Group not support textContent and not support z yet.
  if (el.isGroup) {
    return;
  }
  var elDisplayable = el;
  var currentZ = seriesModel.currentZ;
  var currentZLevel = seriesModel.currentZLevel;
  // Always erase.
  elDisplayable.z = currentZ;
  elDisplayable.zlevel = currentZLevel;
  // z2 must not be null/undefined, otherwise sort error may occur.
  var optZ2 = elOption.z2;
  optZ2 != null && (elDisplayable.z2 = optZ2 || 0);
  for (var i = 0; i < STATES.length; i++) {
    updateZForEachState(elDisplayable, elOption, STATES[i]);
  }
}
function updateZForEachState(elDisplayable, elOption, state) {
  var isNormal = state === NORMAL;
  var elStateOpt = isNormal ? elOption : retrieveStateOption(elOption, state);
  var optZ2 = elStateOpt ? elStateOpt.z2 : null;
  var stateObj;
  if (optZ2 != null) {
    // Do not `ensureState` until required.
    stateObj = isNormal ? elDisplayable : elDisplayable.ensureState(state);
    stateObj.z2 = optZ2 || 0;
  }
}
function makeRenderItem(customSeries, data, ecModel, api) {
  var renderItem = customSeries.get('renderItem');
  var coordSys = customSeries.coordinateSystem;
  var prepareResult = {};
  if (coordSys) {
    {
      assert(renderItem, 'series.render is required.');
      assert(coordSys.prepareCustoms || prepareCustoms[coordSys.type], 'This coordSys does not support custom series.');
    }
    // `coordSys.prepareCustoms` is used for external coord sys like bmap.
    prepareResult = coordSys.prepareCustoms ? coordSys.prepareCustoms(coordSys) : prepareCustoms[coordSys.type](coordSys);
  }
  var userAPI = defaults({
    getWidth: api.getWidth,
    getHeight: api.getHeight,
    getZr: api.getZr,
    getDevicePixelRatio: api.getDevicePixelRatio,
    value: value,
    style: style,
    ordinalRawValue: ordinalRawValue,
    styleEmphasis: styleEmphasis,
    visual: visual,
    barLayout: barLayout,
    currentSeriesIndices: currentSeriesIndices,
    font: font
  }, prepareResult.api || {});
  var userParams = {
    // The life cycle of context: current round of rendering.
    // The global life cycle is probably not necessary, because
    // user can store global status by themselves.
    context: {},
    seriesId: customSeries.id,
    seriesName: customSeries.name,
    seriesIndex: customSeries.seriesIndex,
    coordSys: prepareResult.coordSys,
    dataInsideLength: data.count(),
    encode: wrapEncodeDef(customSeries.getData())
  };
  // If someday intending to refactor them to a class, should consider do not
  // break change: currently these attribute member are encapsulated in a closure
  // so that do not need to force user to call these method with a scope.
  // Do not support call `api` asynchronously without dataIndexInside input.
  var currDataIndexInside;
  var currItemModel;
  var currItemStyleModels = {};
  var currLabelModels = {};
  var seriesItemStyleModels = {};
  var seriesLabelModels = {};
  for (var i = 0; i < STATES.length; i++) {
    var stateName = STATES[i];
    seriesItemStyleModels[stateName] = customSeries.getModel(PATH_ITEM_STYLE[stateName]);
    seriesLabelModels[stateName] = customSeries.getModel(PATH_LABEL[stateName]);
  }
  function getItemModel(dataIndexInside) {
    return dataIndexInside === currDataIndexInside ? currItemModel || (currItemModel = data.getItemModel(dataIndexInside)) : data.getItemModel(dataIndexInside);
  }
  function getItemStyleModel(dataIndexInside, state) {
    return !data.hasItemOption ? seriesItemStyleModels[state] : dataIndexInside === currDataIndexInside ? currItemStyleModels[state] || (currItemStyleModels[state] = getItemModel(dataIndexInside).getModel(PATH_ITEM_STYLE[state])) : getItemModel(dataIndexInside).getModel(PATH_ITEM_STYLE[state]);
  }
  function getLabelModel(dataIndexInside, state) {
    return !data.hasItemOption ? seriesLabelModels[state] : dataIndexInside === currDataIndexInside ? currLabelModels[state] || (currLabelModels[state] = getItemModel(dataIndexInside).getModel(PATH_LABEL[state])) : getItemModel(dataIndexInside).getModel(PATH_LABEL[state]);
  }
  return function (dataIndexInside, payload) {
    currDataIndexInside = dataIndexInside;
    currItemModel = null;
    currItemStyleModels = {};
    currLabelModels = {};
    return renderItem && renderItem(defaults({
      dataIndexInside: dataIndexInside,
      dataIndex: data.getRawIndex(dataIndexInside),
      // Can be used for optimization when zoom or roam.
      actionType: payload ? payload.type : null
    }, userParams), userAPI);
  };
  /**
   * @public
   * @param dim by default 0.
   * @param dataIndexInside by default `currDataIndexInside`.
   */
  function value(dim, dataIndexInside) {
    dataIndexInside == null && (dataIndexInside = currDataIndexInside);
    return data.getStore().get(data.getDimensionIndex(dim || 0), dataIndexInside);
  }
  /**
   * @public
   * @param dim by default 0.
   * @param dataIndexInside by default `currDataIndexInside`.
   */
  function ordinalRawValue(dim, dataIndexInside) {
    dataIndexInside == null && (dataIndexInside = currDataIndexInside);
    dim = dim || 0;
    var dimInfo = data.getDimensionInfo(dim);
    if (!dimInfo) {
      var dimIndex = data.getDimensionIndex(dim);
      return dimIndex >= 0 ? data.getStore().get(dimIndex, dataIndexInside) : undefined;
    }
    var val = data.get(dimInfo.name, dataIndexInside);
    var ordinalMeta = dimInfo && dimInfo.ordinalMeta;
    return ordinalMeta ? ordinalMeta.categories[val] : val;
  }
  /**
   * @deprecated The original intention of `api.style` is enable to set itemStyle
   * like other series. But it is not necessary and not easy to give a strict definition
   * of what it returns. And since echarts5 it needs to be make compat work. So
   * deprecates it since echarts5.
   *
   * By default, `visual` is applied to style (to support visualMap).
   * `visual.color` is applied at `fill`. If user want apply visual.color on `stroke`,
   * it can be implemented as:
   * `api.style({stroke: api.visual('color'), fill: null})`;
   *
   * [Compat]: since ec5, RectText has been separated from its hosts el.
   * so `api.style()` will only return the style from `itemStyle` but not handle `label`
   * any more. But `series.label` config is never published in doc.
   * We still compat it in `api.style()`. But not encourage to use it and will still not
   * to pulish it to doc.
   * @public
   * @param dataIndexInside by default `currDataIndexInside`.
   */
  function style(userProps, dataIndexInside) {
    {
      warnDeprecated('api.style', 'Please write literal style directly instead.');
    }
    dataIndexInside == null && (dataIndexInside = currDataIndexInside);
    var style = data.getItemVisual(dataIndexInside, 'style');
    var visualColor = style && style.fill;
    var opacity = style && style.opacity;
    var itemStyle = getItemStyleModel(dataIndexInside, NORMAL).getItemStyle();
    visualColor != null && (itemStyle.fill = visualColor);
    opacity != null && (itemStyle.opacity = opacity);
    var opt = {
      inheritColor: isString(visualColor) ? visualColor : '#000'
    };
    var labelModel = getLabelModel(dataIndexInside, NORMAL);
    // Now that the feature of "auto adjust text fill/stroke" has been migrated to zrender
    // since ec5, we should set `isAttached` as `false` here and make compat in
    // `convertToEC4StyleForCustomSerise`.
    var textStyle = createTextStyle(labelModel, null, opt, false, true);
    textStyle.text = labelModel.getShallow('show') ? retrieve2(customSeries.getFormattedLabel(dataIndexInside, NORMAL), getDefaultLabel(data, dataIndexInside)) : null;
    var textConfig = createTextConfig(labelModel, opt, false);
    preFetchFromExtra(userProps, itemStyle);
    itemStyle = convertToEC4StyleForCustomSerise(itemStyle, textStyle, textConfig);
    userProps && applyUserPropsAfter(itemStyle, userProps);
    itemStyle.legacy = true;
    return itemStyle;
  }
  /**
   * @deprecated The reason see `api.style()`
   * @public
   * @param dataIndexInside by default `currDataIndexInside`.
   */
  function styleEmphasis(userProps, dataIndexInside) {
    {
      warnDeprecated('api.styleEmphasis', 'Please write literal style directly instead.');
    }
    dataIndexInside == null && (dataIndexInside = currDataIndexInside);
    var itemStyle = getItemStyleModel(dataIndexInside, EMPHASIS).getItemStyle();
    var labelModel = getLabelModel(dataIndexInside, EMPHASIS);
    var textStyle = createTextStyle(labelModel, null, null, true, true);
    textStyle.text = labelModel.getShallow('show') ? retrieve3(customSeries.getFormattedLabel(dataIndexInside, EMPHASIS), customSeries.getFormattedLabel(dataIndexInside, NORMAL), getDefaultLabel(data, dataIndexInside)) : null;
    var textConfig = createTextConfig(labelModel, null, true);
    preFetchFromExtra(userProps, itemStyle);
    itemStyle = convertToEC4StyleForCustomSerise(itemStyle, textStyle, textConfig);
    userProps && applyUserPropsAfter(itemStyle, userProps);
    itemStyle.legacy = true;
    return itemStyle;
  }
  function applyUserPropsAfter(itemStyle, extra) {
    for (var key in extra) {
      if (hasOwn(extra, key)) {
        itemStyle[key] = extra[key];
      }
    }
  }
  function preFetchFromExtra(extra, itemStyle) {
    // A trick to retrieve those props firstly, which are used to
    // apply auto inside fill/stroke in `convertToEC4StyleForCustomSerise`.
    // (It's not reasonable but only for a degree of compat)
    if (extra) {
      extra.textFill && (itemStyle.textFill = extra.textFill);
      extra.textPosition && (itemStyle.textPosition = extra.textPosition);
    }
  }
  /**
   * @public
   * @param dataIndexInside by default `currDataIndexInside`.
   */
  function visual(visualType, dataIndexInside) {
    dataIndexInside == null && (dataIndexInside = currDataIndexInside);
    if (hasOwn(STYLE_VISUAL_TYPE, visualType)) {
      var style_1 = data.getItemVisual(dataIndexInside, 'style');
      return style_1 ? style_1[STYLE_VISUAL_TYPE[visualType]] : null;
    }
    // Only support these visuals. Other visual might be inner tricky
    // for performance (like `style`), do not expose to users.
    if (hasOwn(NON_STYLE_VISUAL_PROPS, visualType)) {
      return data.getItemVisual(dataIndexInside, visualType);
    }
  }
  /**
   * @public
   * @return If not support, return undefined.
   */
  function barLayout(opt) {
    if (coordSys.type === 'cartesian2d') {
      var baseAxis = coordSys.getBaseAxis();
      return getLayoutOnAxis(defaults({
        axis: baseAxis
      }, opt));
    }
  }
  /**
   * @public
   */
  function currentSeriesIndices() {
    return ecModel.getCurrentSeriesIndices();
  }
  /**
   * @public
   * @return font string
   */
  function font(opt) {
    return getFont(opt, ecModel);
  }
}
function wrapEncodeDef(data) {
  var encodeDef = {};
  each$f(data.dimensions, function (dimName) {
    var dimInfo = data.getDimensionInfo(dimName);
    if (!dimInfo.isExtraCoord) {
      var coordDim = dimInfo.coordDim;
      var dataDims = encodeDef[coordDim] = encodeDef[coordDim] || [];
      dataDims[dimInfo.coordDimIndex] = data.getDimensionIndex(dimName);
    }
  });
  return encodeDef;
}
function createOrUpdateItem(api, existsEl, dataIndex, elOption, seriesModel, group, data) {
  // [Rule]
  // If `renderItem` returns `null`/`undefined`/`false`, remove the previous el if existing.
  //     (It seems that violate the "merge" principle, but most of users probably intuitively
  //     regard "return;" as "show nothing element whatever", so make a exception to meet the
  //     most cases.)
  // The rule or "merge" see [STRATEGY_MERGE].
  // If `elOption` is `null`/`undefined`/`false` (when `renderItem` returns nothing).
  if (!elOption) {
    group.remove(existsEl);
    return;
  }
  var el = doCreateOrUpdateEl(api, existsEl, dataIndex, elOption, seriesModel, group);
  el && data.setItemGraphicEl(dataIndex, el);
  el && toggleHoverEmphasis(el, elOption.focus, elOption.blurScope, elOption.emphasisDisabled);
  return el;
}
function doCreateOrUpdateEl(api, existsEl, dataIndex, elOption, seriesModel, group) {
  {
    assert(elOption, 'should not have an null/undefined element setting');
  }
  var toBeReplacedIdx = -1;
  var oldEl = existsEl;
  if (existsEl && doesElNeedRecreate(existsEl, elOption, seriesModel)
  // || (
  //     // PENDING: even in one-to-one mapping case, if el is marked as morph,
  //     // do not sure whether the el will be mapped to another el with different
  //     // hierarchy in Group tree. So always recreate el rather than reuse the el.
  //     morphHelper && morphHelper.isOneToOneFrom(el)
  // )
  ) {
    // Should keep at the original index, otherwise "merge by index" will be incorrect.
    toBeReplacedIdx = indexOf(group.childrenRef(), existsEl);
    existsEl = null;
  }
  var isInit = !existsEl;
  var el = existsEl;
  if (!el) {
    el = createEl$1(elOption);
    if (oldEl) {
      copyElement(oldEl, el);
    }
  } else {
    // FIMXE:NEXT unified clearState?
    // If in some case the performance issue arised, consider
    // do not clearState but update cached normal state directly.
    el.clearStates();
  }
  // Need to set morph: false explictly to disable automatically morphing.
  if (elOption.morph === false) {
    el.disableMorphing = true;
  } else if (el.disableMorphing) {
    el.disableMorphing = false;
  }
  attachedTxInfoTmp.normal.cfg = attachedTxInfoTmp.normal.conOpt = attachedTxInfoTmp.emphasis.cfg = attachedTxInfoTmp.emphasis.conOpt = attachedTxInfoTmp.blur.cfg = attachedTxInfoTmp.blur.conOpt = attachedTxInfoTmp.select.cfg = attachedTxInfoTmp.select.conOpt = null;
  attachedTxInfoTmp.isLegacy = false;
  doCreateOrUpdateAttachedTx(el, dataIndex, elOption, seriesModel, isInit, attachedTxInfoTmp);
  doCreateOrUpdateClipPath(el, dataIndex, elOption, seriesModel, isInit);
  updateElNormal(api, el, dataIndex, elOption, attachedTxInfoTmp, seriesModel, isInit);
  // `elOption.info` enables user to mount some info on
  // elements and use them in event handlers.
  // Update them only when user specified, otherwise, remain.
  hasOwn(elOption, 'info') && (customInnerStore(el).info = elOption.info);
  for (var i = 0; i < STATES.length; i++) {
    var stateName = STATES[i];
    if (stateName !== NORMAL) {
      var otherStateOpt = retrieveStateOption(elOption, stateName);
      var otherStyleOpt = retrieveStyleOptionOnState(elOption, otherStateOpt, stateName);
      updateElOnState(stateName, el, otherStateOpt, otherStyleOpt, attachedTxInfoTmp);
    }
  }
  updateZ(el, elOption, seriesModel);
  if (elOption.type === 'group') {
    mergeChildren(api, el, dataIndex, elOption, seriesModel);
  }
  if (toBeReplacedIdx >= 0) {
    group.replaceAt(el, toBeReplacedIdx);
  } else {
    group.add(el);
  }
  return el;
}
// `el` must not be null/undefined.
function doesElNeedRecreate(el, elOption, seriesModel) {
  var elInner = customInnerStore(el);
  var elOptionType = elOption.type;
  var elOptionShape = elOption.shape;
  var elOptionStyle = elOption.style;
  return (
    // Always create new if universal transition is enabled.
    // Because we do transition after render. It needs to know what old element is. Replacement will loose it.
    seriesModel.isUniversalTransitionEnabled()
    // If `elOptionType` is `null`, follow the merge principle.
    || elOptionType != null && elOptionType !== elInner.customGraphicType || elOptionType === 'path' && hasOwnPathData(elOptionShape) && getPathData(elOptionShape) !== elInner.customPathData || elOptionType === 'image' && hasOwn(elOptionStyle, 'image') && elOptionStyle.image !== elInner.customImagePath
    // // FIXME test and remove this restriction?
    // || (elOptionType === 'text'
    //     && hasOwn(elOptionStyle, 'text')
    //     && (elOptionStyle as TextStyleProps).text !== elInner.customText
    // )
  );
}
function doCreateOrUpdateClipPath(el, dataIndex, elOption, seriesModel, isInit) {
  // Based on the "merge" principle, if no clipPath provided,
  // do nothing. The exists clip will be totally removed only if
  // `el.clipPath` is `false`. Otherwise it will be merged/replaced.
  var clipPathOpt = elOption.clipPath;
  if (clipPathOpt === false) {
    if (el && el.getClipPath()) {
      el.removeClipPath();
    }
  } else if (clipPathOpt) {
    var clipPath = el.getClipPath();
    if (clipPath && doesElNeedRecreate(clipPath, clipPathOpt, seriesModel)) {
      clipPath = null;
    }
    if (!clipPath) {
      clipPath = createEl$1(clipPathOpt);
      {
        assert(isPath(clipPath), 'Only any type of `path` can be used in `clipPath`, rather than ' + clipPath.type + '.');
      }
      el.setClipPath(clipPath);
    }
    updateElNormal(null, clipPath, dataIndex, clipPathOpt, null, seriesModel, isInit);
  }
  // If not define `clipPath` in option, do nothing unnecessary.
}
function doCreateOrUpdateAttachedTx(el, dataIndex, elOption, seriesModel, isInit, attachedTxInfo) {
  // Group does not support textContent temporarily until necessary.
  if (el.isGroup) {
    return;
  }
  // Normal must be called before emphasis, for `isLegacy` detection.
  processTxInfo(elOption, null, attachedTxInfo);
  processTxInfo(elOption, EMPHASIS, attachedTxInfo);
  // If `elOption.textConfig` or `elOption.textContent` is null/undefined, it does not make sense.
  // So for simplicity, if "elOption hasOwnProperty of them but be null/undefined", we do not
  // trade them as set to null to el.
  // Especially:
  // `elOption.textContent: false` means remove textContent.
  // `elOption.textContent.emphasis.style: false` means remove the style from emphasis state.
  var txConOptNormal = attachedTxInfo.normal.conOpt;
  var txConOptEmphasis = attachedTxInfo.emphasis.conOpt;
  var txConOptBlur = attachedTxInfo.blur.conOpt;
  var txConOptSelect = attachedTxInfo.select.conOpt;
  if (txConOptNormal != null || txConOptEmphasis != null || txConOptSelect != null || txConOptBlur != null) {
    var textContent = el.getTextContent();
    if (txConOptNormal === false) {
      textContent && el.removeTextContent();
    } else {
      txConOptNormal = attachedTxInfo.normal.conOpt = txConOptNormal || {
        type: 'text'
      };
      if (!textContent) {
        textContent = createEl$1(txConOptNormal);
        el.setTextContent(textContent);
      } else {
        // If in some case the performance issue arised, consider
        // do not clearState but update cached normal state directly.
        textContent.clearStates();
      }
      updateElNormal(null, textContent, dataIndex, txConOptNormal, null, seriesModel, isInit);
      var txConStlOptNormal = txConOptNormal && txConOptNormal.style;
      for (var i = 0; i < STATES.length; i++) {
        var stateName = STATES[i];
        if (stateName !== NORMAL) {
          var txConOptOtherState = attachedTxInfo[stateName].conOpt;
          updateElOnState(stateName, textContent, txConOptOtherState, retrieveStyleOptionOnState(txConOptNormal, txConOptOtherState, stateName), null);
        }
      }
      txConStlOptNormal ? textContent.dirty() : textContent.markRedraw();
    }
  }
}
function processTxInfo(elOption, state, attachedTxInfo) {
  var stateOpt = !state ? elOption : retrieveStateOption(elOption, state);
  var styleOpt = !state ? elOption.style : retrieveStyleOptionOnState(elOption, stateOpt, EMPHASIS);
  var elType = elOption.type;
  var txCfg = stateOpt ? stateOpt.textConfig : null;
  var txConOptNormal = elOption.textContent;
  var txConOpt = !txConOptNormal ? null : !state ? txConOptNormal : retrieveStateOption(txConOptNormal, state);
  if (styleOpt && (
  // Because emphasis style has little info to detect legacy,
  // if normal is legacy, emphasis is trade as legacy.
  attachedTxInfo.isLegacy || isEC4CompatibleStyle(styleOpt, elType, !!txCfg, !!txConOpt))) {
    attachedTxInfo.isLegacy = true;
    var convertResult = convertFromEC4CompatibleStyle(styleOpt, elType, !state);
    // Explicitly specified `textConfig` and `textContent` has higher priority than
    // the ones generated by legacy style. Otherwise if users use them and `api.style`
    // at the same time, they not both work and hardly to known why.
    if (!txCfg && convertResult.textConfig) {
      txCfg = convertResult.textConfig;
    }
    if (!txConOpt && convertResult.textContent) {
      txConOpt = convertResult.textContent;
    }
  }
  if (!state && txConOpt) {
    var txConOptNormal_1 = txConOpt;
    // `textContent: {type: 'text'}`, the "type" is easy to be missing. So we tolerate it.
    !txConOptNormal_1.type && (txConOptNormal_1.type = 'text');
    {
      // Do not tolerate incorrcet type for forward compat.
      assert(txConOptNormal_1.type === 'text', 'textContent.type must be "text"');
    }
  }
  var info = !state ? attachedTxInfo.normal : attachedTxInfo[state];
  info.cfg = txCfg;
  info.conOpt = txConOpt;
}
function retrieveStateOption(elOption, state) {
  return !state ? elOption : elOption ? elOption[state] : null;
}
function retrieveStyleOptionOnState(stateOptionNormal, stateOption, state) {
  var style = stateOption && stateOption.style;
  if (style == null && state === EMPHASIS && stateOptionNormal) {
    style = stateOptionNormal.styleEmphasis;
  }
  return style;
}
// Usage:
// (1) By default, `elOption.$mergeChildren` is `'byIndex'`, which indicates
//     that the existing children will not be removed, and enables the feature
//     that update some of the props of some of the children simply by construct
//     the returned children of `renderItem` like:
//     `var children = group.children = []; children[3] = {opacity: 0.5};`
// (2) If `elOption.$mergeChildren` is `'byName'`, add/update/remove children
//     by child.name. But that might be lower performance.
// (3) If `elOption.$mergeChildren` is `false`, the existing children will be
//     replaced totally.
// (4) If `!elOption.children`, following the "merge" principle, nothing will
//     happen.
// (5) If `elOption.$mergeChildren` is not `false` neither `'byName'` and the
//     `el` is a group, and if any of the new child is null, it means to remove
//     the element at the same index, if exists. On the other hand, if the new
//     child is and empty object `{}`, it means to keep the element not changed.
//
// For implementation simpleness, do not provide a direct way to remove single
// child (otherwise the total indices of the children array have to be modified).
// User can remove a single child by setting its `ignore` to `true`.
function mergeChildren(api, el, dataIndex, elOption, seriesModel) {
  var newChildren = elOption.children;
  var newLen = newChildren ? newChildren.length : 0;
  var mergeChildren = elOption.$mergeChildren;
  // `diffChildrenByName` has been deprecated.
  var byName = mergeChildren === 'byName' || elOption.diffChildrenByName;
  var notMerge = mergeChildren === false;
  // For better performance on roam update, only enter if necessary.
  if (!newLen && !byName && !notMerge) {
    return;
  }
  if (byName) {
    diffGroupChildren({
      api: api,
      oldChildren: el.children() || [],
      newChildren: newChildren || [],
      dataIndex: dataIndex,
      seriesModel: seriesModel,
      group: el
    });
    return;
  }
  notMerge && el.removeAll();
  // Mapping children of a group simply by index, which
  // might be better performance.
  var index = 0;
  for (; index < newLen; index++) {
    var newChild = newChildren[index];
    var oldChild = el.childAt(index);
    if (newChild) {
      if (newChild.ignore == null) {
        // The old child is set to be ignored if null (see comments
        // below). So we need to set ignore to be false back.
        newChild.ignore = false;
      }
      doCreateOrUpdateEl(api, oldChild, dataIndex, newChild, seriesModel, el);
    } else {
      {
        assert(oldChild, 'renderItem should not return a group containing elements' + ' as null/undefined/{} if they do not exist before.');
      }
      // If the new element option is null, it means to remove the old
      // element. But we cannot really remove the element from the group
      // directly, because the element order may not be stable when this
      // element is added back. So we set the element to be ignored.
      oldChild.ignore = true;
    }
  }
  for (var i = el.childCount() - 1; i >= index; i--) {
    var child = el.childAt(i);
    removeChildFromGroup(el, child, seriesModel);
  }
}
function removeChildFromGroup(group, child, seriesModel) {
  // Do not support leave elements that are not mentioned in the latest
  // `renderItem` return. Otherwise users may not have a clear and simple
  // concept that how to control all of the elements.
  child && applyLeaveTransition(child, customInnerStore(group).option, seriesModel);
}
function diffGroupChildren(context) {
  new DataDiffer$1(context.oldChildren, context.newChildren, getKey, getKey, context).add(processAddUpdate).update(processAddUpdate).remove(processRemove).execute();
}
function getKey(item, idx) {
  var name = item && item.name;
  return name != null ? name : GROUP_DIFF_PREFIX + idx;
}
function processAddUpdate(newIndex, oldIndex) {
  var context = this.context;
  var childOption = newIndex != null ? context.newChildren[newIndex] : null;
  var child = oldIndex != null ? context.oldChildren[oldIndex] : null;
  doCreateOrUpdateEl(context.api, child, context.dataIndex, childOption, context.seriesModel, context.group);
}
function processRemove(oldIndex) {
  var context = this.context;
  var child = context.oldChildren[oldIndex];
  child && applyLeaveTransition(child, customInnerStore(child).option, context.seriesModel);
}
/**
 * @return SVG Path data.
 */
function getPathData(shape) {
  // "d" follows the SVG convention.
  return shape && (shape.pathData || shape.d);
}
function hasOwnPathData(shape) {
  return shape && (hasOwn(shape, 'pathData') || hasOwn(shape, 'd'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$t(registers) {
  registers.registerChartView(CustomChartView$1);
  registers.registerSeriesModel(CustomSeriesModel$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$b = makeInner();
var clone$1 = clone$4;
var bind = bind$1;
/**
 * Base axis pointer class in 2D.
 */
var BaseAxisPointer = /** @class */function () {
  function BaseAxisPointer() {
    this._dragging = false;
    /**
     * In px, arbitrary value. Do not set too small,
     * no animation is ok for most cases.
     */
    this.animationThreshold = 15;
  }
  /**
   * @implement
   */
  BaseAxisPointer.prototype.render = function (axisModel, axisPointerModel, api, forceRender) {
    var value = axisPointerModel.get('value');
    var status = axisPointerModel.get('status');
    // Bind them to `this`, not in closure, otherwise they will not
    // be replaced when user calling setOption in not merge mode.
    this._axisModel = axisModel;
    this._axisPointerModel = axisPointerModel;
    this._api = api;
    // Optimize: `render` will be called repeatedly during mouse move.
    // So it is power consuming if performing `render` each time,
    // especially on mobile device.
    if (!forceRender && this._lastValue === value && this._lastStatus === status) {
      return;
    }
    this._lastValue = value;
    this._lastStatus = status;
    var group = this._group;
    var handle = this._handle;
    if (!status || status === 'hide') {
      // Do not clear here, for animation better.
      group && group.hide();
      handle && handle.hide();
      return;
    }
    group && group.show();
    handle && handle.show();
    // Otherwise status is 'show'
    var elOption = {};
    this.makeElOption(elOption, value, axisModel, axisPointerModel, api);
    // Enable change axis pointer type.
    var graphicKey = elOption.graphicKey;
    if (graphicKey !== this._lastGraphicKey) {
      this.clear(api);
    }
    this._lastGraphicKey = graphicKey;
    var moveAnimation = this._moveAnimation = this.determineAnimation(axisModel, axisPointerModel);
    if (!group) {
      group = this._group = new Group$5();
      this.createPointerEl(group, elOption, axisModel, axisPointerModel);
      this.createLabelEl(group, elOption, axisModel, axisPointerModel);
      api.getZr().add(group);
    } else {
      var doUpdateProps = curry$1(updateProps, axisPointerModel, moveAnimation);
      this.updatePointerEl(group, elOption, doUpdateProps);
      this.updateLabelEl(group, elOption, doUpdateProps, axisPointerModel);
    }
    updateMandatoryProps(group, axisPointerModel, true);
    this._renderHandle(value);
  };
  /**
   * @implement
   */
  BaseAxisPointer.prototype.remove = function (api) {
    this.clear(api);
  };
  /**
   * @implement
   */
  BaseAxisPointer.prototype.dispose = function (api) {
    this.clear(api);
  };
  /**
   * @protected
   */
  BaseAxisPointer.prototype.determineAnimation = function (axisModel, axisPointerModel) {
    var animation = axisPointerModel.get('animation');
    var axis = axisModel.axis;
    var isCategoryAxis = axis.type === 'category';
    var useSnap = axisPointerModel.get('snap');
    // Value axis without snap always do not snap.
    if (!useSnap && !isCategoryAxis) {
      return false;
    }
    if (animation === 'auto' || animation == null) {
      var animationThreshold = this.animationThreshold;
      if (isCategoryAxis && axis.getBandWidth() > animationThreshold) {
        return true;
      }
      // It is important to auto animation when snap used. Consider if there is
      // a dataZoom, animation will be disabled when too many points exist, while
      // it will be enabled for better visual effect when little points exist.
      if (useSnap) {
        var seriesDataCount = getAxisInfo$1(axisModel).seriesDataCount;
        var axisExtent = axis.getExtent();
        // Approximate band width
        return Math.abs(axisExtent[0] - axisExtent[1]) / seriesDataCount > animationThreshold;
      }
      return false;
    }
    return animation === true;
  };
  /**
   * add {pointer, label, graphicKey} to elOption
   * @protected
   */
  BaseAxisPointer.prototype.makeElOption = function (elOption, value, axisModel, axisPointerModel, api) {
    // Should be implemenented by sub-class.
  };
  /**
   * @protected
   */
  BaseAxisPointer.prototype.createPointerEl = function (group, elOption, axisModel, axisPointerModel) {
    var pointerOption = elOption.pointer;
    if (pointerOption) {
      var pointerEl = inner$b(group).pointerEl = new graphic[pointerOption.type](clone$1(elOption.pointer));
      group.add(pointerEl);
    }
  };
  /**
   * @protected
   */
  BaseAxisPointer.prototype.createLabelEl = function (group, elOption, axisModel, axisPointerModel) {
    if (elOption.label) {
      var labelEl = inner$b(group).labelEl = new ZRText$1(clone$1(elOption.label));
      group.add(labelEl);
      updateLabelShowHide(labelEl, axisPointerModel);
    }
  };
  /**
   * @protected
   */
  BaseAxisPointer.prototype.updatePointerEl = function (group, elOption, updateProps) {
    var pointerEl = inner$b(group).pointerEl;
    if (pointerEl && elOption.pointer) {
      pointerEl.setStyle(elOption.pointer.style);
      updateProps(pointerEl, {
        shape: elOption.pointer.shape
      });
    }
  };
  /**
   * @protected
   */
  BaseAxisPointer.prototype.updateLabelEl = function (group, elOption, updateProps, axisPointerModel) {
    var labelEl = inner$b(group).labelEl;
    if (labelEl) {
      labelEl.setStyle(elOption.label.style);
      updateProps(labelEl, {
        // Consider text length change in vertical axis, animation should
        // be used on shape, otherwise the effect will be weird.
        // TODOTODO
        // shape: elOption.label.shape,
        x: elOption.label.x,
        y: elOption.label.y
      });
      updateLabelShowHide(labelEl, axisPointerModel);
    }
  };
  /**
   * @private
   */
  BaseAxisPointer.prototype._renderHandle = function (value) {
    if (this._dragging || !this.updateHandleTransform) {
      return;
    }
    var axisPointerModel = this._axisPointerModel;
    var zr = this._api.getZr();
    var handle = this._handle;
    var handleModel = axisPointerModel.getModel('handle');
    var status = axisPointerModel.get('status');
    if (!handleModel.get('show') || !status || status === 'hide') {
      handle && zr.remove(handle);
      this._handle = null;
      return;
    }
    var isInit;
    if (!this._handle) {
      isInit = true;
      handle = this._handle = createIcon(handleModel.get('icon'), {
        cursor: 'move',
        draggable: true,
        onmousemove: function (e) {
          // For mobile device, prevent screen slider on the button.
          stop(e.event);
        },
        onmousedown: bind(this._onHandleDragMove, this, 0, 0),
        drift: bind(this._onHandleDragMove, this),
        ondragend: bind(this._onHandleDragEnd, this)
      });
      zr.add(handle);
    }
    updateMandatoryProps(handle, axisPointerModel, false);
    // update style
    handle.setStyle(handleModel.getItemStyle(null, ['color', 'borderColor', 'borderWidth', 'opacity', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY']));
    // update position
    var handleSize = handleModel.get('size');
    if (!isArray$1(handleSize)) {
      handleSize = [handleSize, handleSize];
    }
    handle.scaleX = handleSize[0] / 2;
    handle.scaleY = handleSize[1] / 2;
    createOrUpdate(this, '_doDispatchAxisPointer', handleModel.get('throttle') || 0, 'fixRate');
    this._moveHandleToValue(value, isInit);
  };
  BaseAxisPointer.prototype._moveHandleToValue = function (value, isInit) {
    updateProps(this._axisPointerModel, !isInit && this._moveAnimation, this._handle, getHandleTransProps(this.getHandleTransform(value, this._axisModel, this._axisPointerModel)));
  };
  BaseAxisPointer.prototype._onHandleDragMove = function (dx, dy) {
    var handle = this._handle;
    if (!handle) {
      return;
    }
    this._dragging = true;
    // Persistent for throttle.
    var trans = this.updateHandleTransform(getHandleTransProps(handle), [dx, dy], this._axisModel, this._axisPointerModel);
    this._payloadInfo = trans;
    handle.stopAnimation();
    handle.attr(getHandleTransProps(trans));
    inner$b(handle).lastProp = null;
    this._doDispatchAxisPointer();
  };
  /**
   * Throttled method.
   */
  BaseAxisPointer.prototype._doDispatchAxisPointer = function () {
    var handle = this._handle;
    if (!handle) {
      return;
    }
    var payloadInfo = this._payloadInfo;
    var axisModel = this._axisModel;
    this._api.dispatchAction({
      type: 'updateAxisPointer',
      x: payloadInfo.cursorPoint[0],
      y: payloadInfo.cursorPoint[1],
      tooltipOption: payloadInfo.tooltipOption,
      axesInfo: [{
        axisDim: axisModel.axis.dim,
        axisIndex: axisModel.componentIndex
      }]
    });
  };
  BaseAxisPointer.prototype._onHandleDragEnd = function () {
    this._dragging = false;
    var handle = this._handle;
    if (!handle) {
      return;
    }
    var value = this._axisPointerModel.get('value');
    // Consider snap or categroy axis, handle may be not consistent with
    // axisPointer. So move handle to align the exact value position when
    // drag ended.
    this._moveHandleToValue(value);
    // For the effect: tooltip will be shown when finger holding on handle
    // button, and will be hidden after finger left handle button.
    this._api.dispatchAction({
      type: 'hideTip'
    });
  };
  /**
   * @private
   */
  BaseAxisPointer.prototype.clear = function (api) {
    this._lastValue = null;
    this._lastStatus = null;
    var zr = api.getZr();
    var group = this._group;
    var handle = this._handle;
    if (zr && group) {
      this._lastGraphicKey = null;
      group && zr.remove(group);
      handle && zr.remove(handle);
      this._group = null;
      this._handle = null;
      this._payloadInfo = null;
    }
    clear$1(this, '_doDispatchAxisPointer');
  };
  /**
   * @protected
   */
  BaseAxisPointer.prototype.doClear = function () {
    // Implemented by sub-class if necessary.
  };
  BaseAxisPointer.prototype.buildLabel = function (xy, wh, xDimIndex) {
    xDimIndex = xDimIndex || 0;
    return {
      x: xy[xDimIndex],
      y: xy[1 - xDimIndex],
      width: wh[xDimIndex],
      height: wh[1 - xDimIndex]
    };
  };
  return BaseAxisPointer;
}();
function updateProps(animationModel, moveAnimation, el, props) {
  // Animation optimize.
  if (!propsEqual(inner$b(el).lastProp, props)) {
    inner$b(el).lastProp = props;
    moveAnimation ? updateProps$1(el, props, animationModel) : (el.stopAnimation(), el.attr(props));
  }
}
function propsEqual(lastProps, newProps) {
  if (isObject$3(lastProps) && isObject$3(newProps)) {
    var equals_1 = true;
    each$f(newProps, function (item, key) {
      equals_1 = equals_1 && propsEqual(lastProps[key], item);
    });
    return !!equals_1;
  } else {
    return lastProps === newProps;
  }
}
function updateLabelShowHide(labelEl, axisPointerModel) {
  labelEl[axisPointerModel.get(['label', 'show']) ? 'show' : 'hide']();
}
function getHandleTransProps(trans) {
  return {
    x: trans.x || 0,
    y: trans.y || 0,
    rotation: trans.rotation || 0
  };
}
function updateMandatoryProps(group, axisPointerModel, silent) {
  var z = axisPointerModel.get('z');
  var zlevel = axisPointerModel.get('zlevel');
  group && group.traverse(function (el) {
    if (el.type !== 'group') {
      z != null && (el.z = z);
      zlevel != null && (el.zlevel = zlevel);
      el.silent = silent;
    }
  });
}
var BaseAxisPointer$1 = BaseAxisPointer;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function buildElStyle(axisPointerModel) {
  var axisPointerType = axisPointerModel.get('type');
  var styleModel = axisPointerModel.getModel(axisPointerType + 'Style');
  var style;
  if (axisPointerType === 'line') {
    style = styleModel.getLineStyle();
    style.fill = null;
  } else if (axisPointerType === 'shadow') {
    style = styleModel.getAreaStyle();
    style.stroke = null;
  }
  return style;
}
/**
 * @param {Function} labelPos {align, verticalAlign, position}
 */
function buildLabelElOption(elOption, axisModel, axisPointerModel, api, labelPos) {
  var value = axisPointerModel.get('value');
  var text = getValueLabel(value, axisModel.axis, axisModel.ecModel, axisPointerModel.get('seriesDataIndices'), {
    precision: axisPointerModel.get(['label', 'precision']),
    formatter: axisPointerModel.get(['label', 'formatter'])
  });
  var labelModel = axisPointerModel.getModel('label');
  var paddings = normalizeCssArray(labelModel.get('padding') || 0);
  var font = labelModel.getFont();
  var textRect = getBoundingRect(text, font);
  var position = labelPos.position;
  var width = textRect.width + paddings[1] + paddings[3];
  var height = textRect.height + paddings[0] + paddings[2];
  // Adjust by align.
  var align = labelPos.align;
  align === 'right' && (position[0] -= width);
  align === 'center' && (position[0] -= width / 2);
  var verticalAlign = labelPos.verticalAlign;
  verticalAlign === 'bottom' && (position[1] -= height);
  verticalAlign === 'middle' && (position[1] -= height / 2);
  // Not overflow ec container
  confineInContainer(position, width, height, api);
  var bgColor = labelModel.get('backgroundColor');
  if (!bgColor || bgColor === 'auto') {
    bgColor = axisModel.get(['axisLine', 'lineStyle', 'color']);
  }
  elOption.label = {
    // shape: {x: 0, y: 0, width: width, height: height, r: labelModel.get('borderRadius')},
    x: position[0],
    y: position[1],
    style: createTextStyle(labelModel, {
      text: text,
      font: font,
      fill: labelModel.getTextColor(),
      padding: paddings,
      backgroundColor: bgColor
    }),
    // Label should be over axisPointer.
    z2: 10
  };
}
// Do not overflow ec container
function confineInContainer(position, width, height, api) {
  var viewWidth = api.getWidth();
  var viewHeight = api.getHeight();
  position[0] = Math.min(position[0] + width, viewWidth) - width;
  position[1] = Math.min(position[1] + height, viewHeight) - height;
  position[0] = Math.max(position[0], 0);
  position[1] = Math.max(position[1], 0);
}
function getValueLabel(value, axis, ecModel, seriesDataIndices, opt) {
  value = axis.scale.parse(value);
  var text = axis.scale.getLabel({
    value: value
  }, {
    // If `precision` is set, width can be fixed (like '12.00500'), which
    // helps to debounce when when moving label.
    precision: opt.precision
  });
  var formatter = opt.formatter;
  if (formatter) {
    var params_1 = {
      value: getAxisRawValue(axis, {
        value: value
      }),
      axisDimension: axis.dim,
      axisIndex: axis.index,
      seriesData: []
    };
    each$f(seriesDataIndices, function (idxItem) {
      var series = ecModel.getSeriesByIndex(idxItem.seriesIndex);
      var dataIndex = idxItem.dataIndexInside;
      var dataParams = series && series.getDataParams(dataIndex);
      dataParams && params_1.seriesData.push(dataParams);
    });
    if (isString(formatter)) {
      text = formatter.replace('{value}', text);
    } else if (isFunction(formatter)) {
      text = formatter(params_1);
    }
  }
  return text;
}
function getTransformedPosition(axis, value, layoutInfo) {
  var transform = create$1();
  rotate(transform, transform, layoutInfo.rotation);
  translate(transform, transform, layoutInfo.position);
  return applyTransform([axis.dataToCoord(value), (layoutInfo.labelOffset || 0) + (layoutInfo.labelDirection || 1) * (layoutInfo.labelMargin || 0)], transform);
}
function buildCartesianSingleLabelElOption(value, elOption, layoutInfo, axisModel, axisPointerModel, api) {
  // @ts-ignore
  var textLayout = AxisBuilder$1.innerTextLayout(layoutInfo.rotation, 0, layoutInfo.labelDirection);
  layoutInfo.labelMargin = axisPointerModel.get(['label', 'margin']);
  buildLabelElOption(elOption, axisModel, axisPointerModel, api, {
    position: getTransformedPosition(axisModel.axis, value, layoutInfo),
    align: textLayout.textAlign,
    verticalAlign: textLayout.textVerticalAlign
  });
}
function makeLineShape(p1, p2, xDimIndex) {
  xDimIndex = xDimIndex || 0;
  return {
    x1: p1[xDimIndex],
    y1: p1[1 - xDimIndex],
    x2: p2[xDimIndex],
    y2: p2[1 - xDimIndex]
  };
}
function makeRectShape(xy, wh, xDimIndex) {
  xDimIndex = xDimIndex || 0;
  return {
    x: xy[xDimIndex],
    y: xy[1 - xDimIndex],
    width: wh[xDimIndex],
    height: wh[1 - xDimIndex]
  };
}
function makeSectorShape(cx, cy, r0, r, startAngle, endAngle) {
  return {
    cx: cx,
    cy: cy,
    r0: r0,
    r: r,
    startAngle: startAngle,
    endAngle: endAngle,
    clockwise: true
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var CartesianAxisPointer = /** @class */function (_super) {
  __extends(CartesianAxisPointer, _super);
  function CartesianAxisPointer() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  /**
   * @override
   */
  CartesianAxisPointer.prototype.makeElOption = function (elOption, value, axisModel, axisPointerModel, api) {
    var axis = axisModel.axis;
    var grid = axis.grid;
    var axisPointerType = axisPointerModel.get('type');
    var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent();
    var pixelValue = axis.toGlobalCoord(axis.dataToCoord(value, true));
    if (axisPointerType && axisPointerType !== 'none') {
      var elStyle = buildElStyle(axisPointerModel);
      var pointerOption = pointerShapeBuilder$2[axisPointerType](axis, pixelValue, otherExtent);
      pointerOption.style = elStyle;
      elOption.graphicKey = pointerOption.type;
      elOption.pointer = pointerOption;
    }
    var layoutInfo = layout$2(grid.model, axisModel);
    buildCartesianSingleLabelElOption(
    // @ts-ignore
    value, elOption, layoutInfo, axisModel, axisPointerModel, api);
  };
  /**
   * @override
   */
  CartesianAxisPointer.prototype.getHandleTransform = function (value, axisModel, axisPointerModel) {
    var layoutInfo = layout$2(axisModel.axis.grid.model, axisModel, {
      labelInside: false
    });
    // @ts-ignore
    layoutInfo.labelMargin = axisPointerModel.get(['handle', 'margin']);
    var pos = getTransformedPosition(axisModel.axis, value, layoutInfo);
    return {
      x: pos[0],
      y: pos[1],
      rotation: layoutInfo.rotation + (layoutInfo.labelDirection < 0 ? Math.PI : 0)
    };
  };
  /**
   * @override
   */
  CartesianAxisPointer.prototype.updateHandleTransform = function (transform, delta, axisModel, axisPointerModel) {
    var axis = axisModel.axis;
    var grid = axis.grid;
    var axisExtent = axis.getGlobalExtent(true);
    var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent();
    var dimIndex = axis.dim === 'x' ? 0 : 1;
    var currPosition = [transform.x, transform.y];
    currPosition[dimIndex] += delta[dimIndex];
    currPosition[dimIndex] = Math.min(axisExtent[1], currPosition[dimIndex]);
    currPosition[dimIndex] = Math.max(axisExtent[0], currPosition[dimIndex]);
    var cursorOtherValue = (otherExtent[1] + otherExtent[0]) / 2;
    var cursorPoint = [cursorOtherValue, cursorOtherValue];
    cursorPoint[dimIndex] = currPosition[dimIndex];
    // Make tooltip do not overlap axisPointer and in the middle of the grid.
    var tooltipOptions = [{
      verticalAlign: 'middle'
    }, {
      align: 'center'
    }];
    return {
      x: currPosition[0],
      y: currPosition[1],
      rotation: transform.rotation,
      cursorPoint: cursorPoint,
      tooltipOption: tooltipOptions[dimIndex]
    };
  };
  return CartesianAxisPointer;
}(BaseAxisPointer$1);
function getCartesian(grid, axis) {
  var opt = {};
  opt[axis.dim + 'AxisIndex'] = axis.index;
  return grid.getCartesian(opt);
}
var pointerShapeBuilder$2 = {
  line: function (axis, pixelValue, otherExtent) {
    var targetShape = makeLineShape([pixelValue, otherExtent[0]], [pixelValue, otherExtent[1]], getAxisDimIndex(axis));
    return {
      type: 'Line',
      subPixelOptimize: true,
      shape: targetShape
    };
  },
  shadow: function (axis, pixelValue, otherExtent) {
    var bandWidth = Math.max(1, axis.getBandWidth());
    var span = otherExtent[1] - otherExtent[0];
    return {
      type: 'Rect',
      shape: makeRectShape([pixelValue - bandWidth / 2, otherExtent[0]], [bandWidth, span], getAxisDimIndex(axis))
    };
  }
};
function getAxisDimIndex(axis) {
  return axis.dim === 'x' ? 0 : 1;
}
var CartesianAxisPointer$1 = CartesianAxisPointer;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var AxisPointerModel = /** @class */function (_super) {
  __extends(AxisPointerModel, _super);
  function AxisPointerModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = AxisPointerModel.type;
    return _this;
  }
  AxisPointerModel.type = 'axisPointer';
  AxisPointerModel.defaultOption = {
    // 'auto' means that show when triggered by tooltip or handle.
    show: 'auto',
    // zlevel: 0,
    z: 50,
    type: 'line',
    // axispointer triggered by tootip determine snap automatically,
    // see `modelHelper`.
    snap: false,
    triggerTooltip: true,
    triggerEmphasis: true,
    value: null,
    status: null,
    link: [],
    // Do not set 'auto' here, otherwise global animation: false
    // will not effect at this axispointer.
    animation: null,
    animationDurationUpdate: 200,
    lineStyle: {
      color: '#B9BEC9',
      width: 1,
      type: 'dashed'
    },
    shadowStyle: {
      color: 'rgba(210,219,238,0.2)'
    },
    label: {
      show: true,
      formatter: null,
      precision: 'auto',
      margin: 3,
      color: '#fff',
      padding: [5, 7, 5, 7],
      backgroundColor: 'auto',
      borderColor: null,
      borderWidth: 0,
      borderRadius: 3
    },
    handle: {
      show: false,
      // eslint-disable-next-line
      icon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z',
      size: 45,
      // handle margin is from symbol center to axis, which is stable when circular move.
      margin: 50,
      // color: '#1b8bbd'
      // color: '#2f4554'
      color: '#333',
      shadowBlur: 3,
      shadowColor: '#aaa',
      shadowOffsetX: 0,
      shadowOffsetY: 2,
      // For mobile performance
      throttle: 40
    }
  };
  return AxisPointerModel;
}(ComponentModel$1);
var AxisPointerModel$1 = AxisPointerModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$a = makeInner();
var each$8 = each$f;
/**
 * @param {string} key
 * @param {module:echarts/ExtensionAPI} api
 * @param {Function} handler
 *      param: {string} currTrigger
 *      param: {Array.<number>} point
 */
function register(key, api, handler) {
  if (env$1.node) {
    return;
  }
  var zr = api.getZr();
  inner$a(zr).records || (inner$a(zr).records = {});
  initGlobalListeners(zr, api);
  var record = inner$a(zr).records[key] || (inner$a(zr).records[key] = {});
  record.handler = handler;
}
function initGlobalListeners(zr, api) {
  if (inner$a(zr).initialized) {
    return;
  }
  inner$a(zr).initialized = true;
  useHandler('click', curry$1(doEnter, 'click'));
  useHandler('mousemove', curry$1(doEnter, 'mousemove'));
  // useHandler('mouseout', onLeave);
  useHandler('globalout', onLeave);
  function useHandler(eventType, cb) {
    zr.on(eventType, function (e) {
      var dis = makeDispatchAction$1(api);
      each$8(inner$a(zr).records, function (record) {
        record && cb(record, e, dis.dispatchAction);
      });
      dispatchTooltipFinally(dis.pendings, api);
    });
  }
}
function dispatchTooltipFinally(pendings, api) {
  var showLen = pendings.showTip.length;
  var hideLen = pendings.hideTip.length;
  var actuallyPayload;
  if (showLen) {
    actuallyPayload = pendings.showTip[showLen - 1];
  } else if (hideLen) {
    actuallyPayload = pendings.hideTip[hideLen - 1];
  }
  if (actuallyPayload) {
    actuallyPayload.dispatchAction = null;
    api.dispatchAction(actuallyPayload);
  }
}
function onLeave(record, e, dispatchAction) {
  record.handler('leave', null, dispatchAction);
}
function doEnter(currTrigger, record, e, dispatchAction) {
  record.handler(currTrigger, e, dispatchAction);
}
function makeDispatchAction$1(api) {
  var pendings = {
    showTip: [],
    hideTip: []
  };
  // FIXME
  // better approach?
  // 'showTip' and 'hideTip' can be triggered by axisPointer and tooltip,
  // which may be conflict, (axisPointer call showTip but tooltip call hideTip);
  // So we have to add "final stage" to merge those dispatched actions.
  var dispatchAction = function (payload) {
    var pendingList = pendings[payload.type];
    if (pendingList) {
      pendingList.push(payload);
    } else {
      payload.dispatchAction = dispatchAction;
      api.dispatchAction(payload);
    }
  };
  return {
    dispatchAction: dispatchAction,
    pendings: pendings
  };
}
function unregister(key, api) {
  if (env$1.node) {
    return;
  }
  var zr = api.getZr();
  var record = (inner$a(zr).records || {})[key];
  if (record) {
    inner$a(zr).records[key] = null;
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var AxisPointerView = /** @class */function (_super) {
  __extends(AxisPointerView, _super);
  function AxisPointerView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = AxisPointerView.type;
    return _this;
  }
  AxisPointerView.prototype.render = function (globalAxisPointerModel, ecModel, api) {
    var globalTooltipModel = ecModel.getComponent('tooltip');
    var triggerOn = globalAxisPointerModel.get('triggerOn') || globalTooltipModel && globalTooltipModel.get('triggerOn') || 'mousemove|click';
    // Register global listener in AxisPointerView to enable
    // AxisPointerView to be independent to Tooltip.
    register('axisPointer', api, function (currTrigger, e, dispatchAction) {
      // If 'none', it is not controlled by mouse totally.
      if (triggerOn !== 'none' && (currTrigger === 'leave' || triggerOn.indexOf(currTrigger) >= 0)) {
        dispatchAction({
          type: 'updateAxisPointer',
          currTrigger: currTrigger,
          x: e && e.offsetX,
          y: e && e.offsetY
        });
      }
    });
  };
  AxisPointerView.prototype.remove = function (ecModel, api) {
    unregister('axisPointer', api);
  };
  AxisPointerView.prototype.dispose = function (ecModel, api) {
    unregister('axisPointer', api);
  };
  AxisPointerView.type = 'axisPointer';
  return AxisPointerView;
}(ComponentView$1);
var AxisPointerView$1 = AxisPointerView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * @param finder contains {seriesIndex, dataIndex, dataIndexInside}
 * @param ecModel
 * @return  {point: [x, y], el: ...} point Will not be null.
 */
function findPointFromSeries(finder, ecModel) {
  var point = [];
  var seriesIndex = finder.seriesIndex;
  var seriesModel;
  if (seriesIndex == null || !(seriesModel = ecModel.getSeriesByIndex(seriesIndex))) {
    return {
      point: []
    };
  }
  var data = seriesModel.getData();
  var dataIndex = queryDataIndex(data, finder);
  if (dataIndex == null || dataIndex < 0 || isArray$1(dataIndex)) {
    return {
      point: []
    };
  }
  var el = data.getItemGraphicEl(dataIndex);
  var coordSys = seriesModel.coordinateSystem;
  if (seriesModel.getTooltipPosition) {
    point = seriesModel.getTooltipPosition(dataIndex) || [];
  } else if (coordSys && coordSys.dataToPoint) {
    if (finder.isStacked) {
      var baseAxis = coordSys.getBaseAxis();
      var valueAxis = coordSys.getOtherAxis(baseAxis);
      var valueAxisDim = valueAxis.dim;
      var baseAxisDim = baseAxis.dim;
      var baseDataOffset = valueAxisDim === 'x' || valueAxisDim === 'radius' ? 1 : 0;
      var baseDim = data.mapDimension(baseAxisDim);
      var stackedData = [];
      stackedData[baseDataOffset] = data.get(baseDim, dataIndex);
      stackedData[1 - baseDataOffset] = data.get(data.getCalculationInfo('stackResultDimension'), dataIndex);
      point = coordSys.dataToPoint(stackedData) || [];
    } else {
      point = coordSys.dataToPoint(data.getValues(map$1(coordSys.dimensions, function (dim) {
        return data.mapDimension(dim);
      }), dataIndex)) || [];
    }
  } else if (el) {
    // Use graphic bounding rect
    var rect = el.getBoundingRect().clone();
    rect.applyTransform(el.transform);
    point = [rect.x + rect.width / 2, rect.y + rect.height / 2];
  }
  return {
    point: point,
    el: el
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$9 = makeInner();
/**
 * Basic logic: check all axis, if they do not demand show/highlight,
 * then hide/downplay them.
 *
 * @return content of event obj for echarts.connect.
 */
function axisTrigger(payload, ecModel, api) {
  var currTrigger = payload.currTrigger;
  var point = [payload.x, payload.y];
  var finder = payload;
  var dispatchAction = payload.dispatchAction || bind$1(api.dispatchAction, api);
  var coordSysAxesInfo = ecModel.getComponent('axisPointer').coordSysAxesInfo;
  // Pending
  // See #6121. But we are not able to reproduce it yet.
  if (!coordSysAxesInfo) {
    return;
  }
  if (illegalPoint(point)) {
    // Used in the default behavior of `connection`: use the sample seriesIndex
    // and dataIndex. And also used in the tooltipView trigger.
    point = findPointFromSeries({
      seriesIndex: finder.seriesIndex,
      // Do not use dataIndexInside from other ec instance.
      // FIXME: auto detect it?
      dataIndex: finder.dataIndex
    }, ecModel).point;
  }
  var isIllegalPoint = illegalPoint(point);
  // Axis and value can be specified when calling dispatchAction({type: 'updateAxisPointer'}).
  // Notice: In this case, it is difficult to get the `point` (which is necessary to show
  // tooltip, so if point is not given, we just use the point found by sample seriesIndex
  // and dataIndex.
  var inputAxesInfo = finder.axesInfo;
  var axesInfo = coordSysAxesInfo.axesInfo;
  var shouldHide = currTrigger === 'leave' || illegalPoint(point);
  var outputPayload = {};
  var showValueMap = {};
  var dataByCoordSys = {
    list: [],
    map: {}
  };
  var updaters = {
    showPointer: curry$1(showPointer, showValueMap),
    showTooltip: curry$1(showTooltip, dataByCoordSys)
  };
  // Process for triggered axes.
  each$f(coordSysAxesInfo.coordSysMap, function (coordSys, coordSysKey) {
    // If a point given, it must be contained by the coordinate system.
    var coordSysContainsPoint = isIllegalPoint || coordSys.containPoint(point);
    each$f(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) {
      var axis = axisInfo.axis;
      var inputAxisInfo = findInputAxisInfo(inputAxesInfo, axisInfo);
      // If no inputAxesInfo, no axis is restricted.
      if (!shouldHide && coordSysContainsPoint && (!inputAxesInfo || inputAxisInfo)) {
        var val = inputAxisInfo && inputAxisInfo.value;
        if (val == null && !isIllegalPoint) {
          val = axis.pointToData(point);
        }
        val != null && processOnAxis(axisInfo, val, updaters, false, outputPayload);
      }
    });
  });
  // Process for linked axes.
  var linkTriggers = {};
  each$f(axesInfo, function (tarAxisInfo, tarKey) {
    var linkGroup = tarAxisInfo.linkGroup;
    // If axis has been triggered in the previous stage, it should not be triggered by link.
    if (linkGroup && !showValueMap[tarKey]) {
      each$f(linkGroup.axesInfo, function (srcAxisInfo, srcKey) {
        var srcValItem = showValueMap[srcKey];
        // If srcValItem exist, source axis is triggered, so link to target axis.
        if (srcAxisInfo !== tarAxisInfo && srcValItem) {
          var val = srcValItem.value;
          linkGroup.mapper && (val = tarAxisInfo.axis.scale.parse(linkGroup.mapper(val, makeMapperParam(srcAxisInfo), makeMapperParam(tarAxisInfo))));
          linkTriggers[tarAxisInfo.key] = val;
        }
      });
    }
  });
  each$f(linkTriggers, function (val, tarKey) {
    processOnAxis(axesInfo[tarKey], val, updaters, true, outputPayload);
  });
  updateModelActually(showValueMap, axesInfo, outputPayload);
  dispatchTooltipActually(dataByCoordSys, point, payload, dispatchAction);
  dispatchHighDownActually(axesInfo, dispatchAction, api);
  return outputPayload;
}
function processOnAxis(axisInfo, newValue, updaters, noSnap, outputFinder) {
  var axis = axisInfo.axis;
  if (axis.scale.isBlank() || !axis.containData(newValue)) {
    return;
  }
  if (!axisInfo.involveSeries) {
    updaters.showPointer(axisInfo, newValue);
    return;
  }
  // Heavy calculation. So put it after axis.containData checking.
  var payloadInfo = buildPayloadsBySeries(newValue, axisInfo);
  var payloadBatch = payloadInfo.payloadBatch;
  var snapToValue = payloadInfo.snapToValue;
  // Fill content of event obj for echarts.connect.
  // By default use the first involved series data as a sample to connect.
  if (payloadBatch[0] && outputFinder.seriesIndex == null) {
    extend(outputFinder, payloadBatch[0]);
  }
  // If no linkSource input, this process is for collecting link
  // target, where snap should not be accepted.
  if (!noSnap && axisInfo.snap) {
    if (axis.containData(snapToValue) && snapToValue != null) {
      newValue = snapToValue;
    }
  }
  updaters.showPointer(axisInfo, newValue, payloadBatch);
  // Tooltip should always be snapToValue, otherwise there will be
  // incorrect "axis value ~ series value" mapping displayed in tooltip.
  updaters.showTooltip(axisInfo, payloadInfo, snapToValue);
}
function buildPayloadsBySeries(value, axisInfo) {
  var axis = axisInfo.axis;
  var dim = axis.dim;
  var snapToValue = value;
  var payloadBatch = [];
  var minDist = Number.MAX_VALUE;
  var minDiff = -1;
  each$f(axisInfo.seriesModels, function (series, idx) {
    var dataDim = series.getData().mapDimensionsAll(dim);
    var seriesNestestValue;
    var dataIndices;
    if (series.getAxisTooltipData) {
      var result = series.getAxisTooltipData(dataDim, value, axis);
      dataIndices = result.dataIndices;
      seriesNestestValue = result.nestestValue;
    } else {
      dataIndices = series.getData().indicesOfNearest(dataDim[0], value,
      // Add a threshold to avoid find the wrong dataIndex
      // when data length is not same.
      // false,
      axis.type === 'category' ? 0.5 : null);
      if (!dataIndices.length) {
        return;
      }
      seriesNestestValue = series.getData().get(dataDim[0], dataIndices[0]);
    }
    if (seriesNestestValue == null || !isFinite(seriesNestestValue)) {
      return;
    }
    var diff = value - seriesNestestValue;
    var dist = Math.abs(diff);
    // Consider category case
    if (dist <= minDist) {
      if (dist < minDist || diff >= 0 && minDiff < 0) {
        minDist = dist;
        minDiff = diff;
        snapToValue = seriesNestestValue;
        payloadBatch.length = 0;
      }
      each$f(dataIndices, function (dataIndex) {
        payloadBatch.push({
          seriesIndex: series.seriesIndex,
          dataIndexInside: dataIndex,
          dataIndex: series.getData().getRawIndex(dataIndex)
        });
      });
    }
  });
  return {
    payloadBatch: payloadBatch,
    snapToValue: snapToValue
  };
}
function showPointer(showValueMap, axisInfo, value, payloadBatch) {
  showValueMap[axisInfo.key] = {
    value: value,
    payloadBatch: payloadBatch
  };
}
function showTooltip(dataByCoordSys, axisInfo, payloadInfo, value) {
  var payloadBatch = payloadInfo.payloadBatch;
  var axis = axisInfo.axis;
  var axisModel = axis.model;
  var axisPointerModel = axisInfo.axisPointerModel;
  // If no data, do not create anything in dataByCoordSys,
  // whose length will be used to judge whether dispatch action.
  if (!axisInfo.triggerTooltip || !payloadBatch.length) {
    return;
  }
  var coordSysModel = axisInfo.coordSys.model;
  var coordSysKey = makeKey(coordSysModel);
  var coordSysItem = dataByCoordSys.map[coordSysKey];
  if (!coordSysItem) {
    coordSysItem = dataByCoordSys.map[coordSysKey] = {
      coordSysId: coordSysModel.id,
      coordSysIndex: coordSysModel.componentIndex,
      coordSysType: coordSysModel.type,
      coordSysMainType: coordSysModel.mainType,
      dataByAxis: []
    };
    dataByCoordSys.list.push(coordSysItem);
  }
  coordSysItem.dataByAxis.push({
    axisDim: axis.dim,
    axisIndex: axisModel.componentIndex,
    axisType: axisModel.type,
    axisId: axisModel.id,
    value: value,
    // Caustion: viewHelper.getValueLabel is actually on "view stage", which
    // depends that all models have been updated. So it should not be performed
    // here. Considering axisPointerModel used here is volatile, which is hard
    // to be retrieve in TooltipView, we prepare parameters here.
    valueLabelOpt: {
      precision: axisPointerModel.get(['label', 'precision']),
      formatter: axisPointerModel.get(['label', 'formatter'])
    },
    seriesDataIndices: payloadBatch.slice()
  });
}
function updateModelActually(showValueMap, axesInfo, outputPayload) {
  var outputAxesInfo = outputPayload.axesInfo = [];
  // Basic logic: If no 'show' required, 'hide' this axisPointer.
  each$f(axesInfo, function (axisInfo, key) {
    var option = axisInfo.axisPointerModel.option;
    var valItem = showValueMap[key];
    if (valItem) {
      !axisInfo.useHandle && (option.status = 'show');
      option.value = valItem.value;
      // For label formatter param and highlight.
      option.seriesDataIndices = (valItem.payloadBatch || []).slice();
    }
    // When always show (e.g., handle used), remain
    // original value and status.
    else {
      // If hide, value still need to be set, consider
      // click legend to toggle axis blank.
      !axisInfo.useHandle && (option.status = 'hide');
    }
    // If status is 'hide', should be no info in payload.
    option.status === 'show' && outputAxesInfo.push({
      axisDim: axisInfo.axis.dim,
      axisIndex: axisInfo.axis.model.componentIndex,
      value: option.value
    });
  });
}
function dispatchTooltipActually(dataByCoordSys, point, payload, dispatchAction) {
  // Basic logic: If no showTip required, hideTip will be dispatched.
  if (illegalPoint(point) || !dataByCoordSys.list.length) {
    dispatchAction({
      type: 'hideTip'
    });
    return;
  }
  // In most case only one axis (or event one series is used). It is
  // convenient to fetch payload.seriesIndex and payload.dataIndex
  // directly. So put the first seriesIndex and dataIndex of the first
  // axis on the payload.
  var sampleItem = ((dataByCoordSys.list[0].dataByAxis[0] || {}).seriesDataIndices || [])[0] || {};
  dispatchAction({
    type: 'showTip',
    escapeConnect: true,
    x: point[0],
    y: point[1],
    tooltipOption: payload.tooltipOption,
    position: payload.position,
    dataIndexInside: sampleItem.dataIndexInside,
    dataIndex: sampleItem.dataIndex,
    seriesIndex: sampleItem.seriesIndex,
    dataByCoordSys: dataByCoordSys.list
  });
}
function dispatchHighDownActually(axesInfo, dispatchAction, api) {
  // FIXME
  // highlight status modification should be a stage of main process?
  // (Consider confilct (e.g., legend and axisPointer) and setOption)
  var zr = api.getZr();
  var highDownKey = 'axisPointerLastHighlights';
  var lastHighlights = inner$9(zr)[highDownKey] || {};
  var newHighlights = inner$9(zr)[highDownKey] = {};
  // Update highlight/downplay status according to axisPointer model.
  // Build hash map and remove duplicate incidentally.
  each$f(axesInfo, function (axisInfo, key) {
    var option = axisInfo.axisPointerModel.option;
    option.status === 'show' && axisInfo.triggerEmphasis && each$f(option.seriesDataIndices, function (batchItem) {
      var key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex;
      newHighlights[key] = batchItem;
    });
  });
  // Diff.
  var toHighlight = [];
  var toDownplay = [];
  each$f(lastHighlights, function (batchItem, key) {
    !newHighlights[key] && toDownplay.push(batchItem);
  });
  each$f(newHighlights, function (batchItem, key) {
    !lastHighlights[key] && toHighlight.push(batchItem);
  });
  toDownplay.length && api.dispatchAction({
    type: 'downplay',
    escapeConnect: true,
    // Not blur others when highlight in axisPointer.
    notBlur: true,
    batch: toDownplay
  });
  toHighlight.length && api.dispatchAction({
    type: 'highlight',
    escapeConnect: true,
    // Not blur others when highlight in axisPointer.
    notBlur: true,
    batch: toHighlight
  });
}
function findInputAxisInfo(inputAxesInfo, axisInfo) {
  for (var i = 0; i < (inputAxesInfo || []).length; i++) {
    var inputAxisInfo = inputAxesInfo[i];
    if (axisInfo.axis.dim === inputAxisInfo.axisDim && axisInfo.axis.model.componentIndex === inputAxisInfo.axisIndex) {
      return inputAxisInfo;
    }
  }
}
function makeMapperParam(axisInfo) {
  var axisModel = axisInfo.axis.model;
  var item = {};
  var dim = item.axisDim = axisInfo.axis.dim;
  item.axisIndex = item[dim + 'AxisIndex'] = axisModel.componentIndex;
  item.axisName = item[dim + 'AxisName'] = axisModel.name;
  item.axisId = item[dim + 'AxisId'] = axisModel.id;
  return item;
}
function illegalPoint(point) {
  return !point || point[0] == null || isNaN(point[0]) || point[1] == null || isNaN(point[1]);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$s(registers) {
  // CartesianAxisPointer is not supposed to be required here. But consider
  // echarts.simple.js and online build tooltip, which only require gridSimple,
  // CartesianAxisPointer should be able to required somewhere.
  AxisView$1.registerAxisPointerClass('CartesianAxisPointer', CartesianAxisPointer$1);
  registers.registerComponentModel(AxisPointerModel$1);
  registers.registerComponentView(AxisPointerView$1);
  registers.registerPreprocessor(function (option) {
    // Always has a global axisPointerModel for default setting.
    if (option) {
      (!option.axisPointer || option.axisPointer.length === 0) && (option.axisPointer = {});
      var link = option.axisPointer.link;
      // Normalize to array to avoid object mergin. But if link
      // is not set, remain null/undefined, otherwise it will
      // override existent link setting.
      if (link && !isArray$1(link)) {
        option.axisPointer.link = [link];
      }
    }
  });
  // This process should proformed after coordinate systems created
  // and series data processed. So put it on statistic processing stage.
  registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, function (ecModel, api) {
    // Build axisPointerModel, mergin tooltip.axisPointer model for each axis.
    // allAxesInfo should be updated when setOption performed.
    ecModel.getComponent('axisPointer').coordSysAxesInfo = collect(ecModel, api);
  });
  // Broadcast to all views.
  registers.registerAction({
    type: 'updateAxisPointer',
    event: 'updateAxisPointer',
    update: ':updateAxisPointer'
  }, axisTrigger);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$r(registers) {
  use(install$P);
  use(install$s);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PolarAxisPointer = /** @class */function (_super) {
  __extends(PolarAxisPointer, _super);
  function PolarAxisPointer() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  /**
   * @override
   */
  PolarAxisPointer.prototype.makeElOption = function (elOption, value, axisModel, axisPointerModel, api) {
    var axis = axisModel.axis;
    if (axis.dim === 'angle') {
      this.animationThreshold = Math.PI / 18;
    }
    var polar = axis.polar;
    var otherAxis = polar.getOtherAxis(axis);
    var otherExtent = otherAxis.getExtent();
    var coordValue = axis.dataToCoord(value);
    var axisPointerType = axisPointerModel.get('type');
    if (axisPointerType && axisPointerType !== 'none') {
      var elStyle = buildElStyle(axisPointerModel);
      var pointerOption = pointerShapeBuilder$1[axisPointerType](axis, polar, coordValue, otherExtent);
      pointerOption.style = elStyle;
      elOption.graphicKey = pointerOption.type;
      elOption.pointer = pointerOption;
    }
    var labelMargin = axisPointerModel.get(['label', 'margin']);
    var labelPos = getLabelPosition(value, axisModel, axisPointerModel, polar, labelMargin);
    buildLabelElOption(elOption, axisModel, axisPointerModel, api, labelPos);
  };
  return PolarAxisPointer;
}(BaseAxisPointer$1);
function getLabelPosition(value, axisModel, axisPointerModel, polar, labelMargin) {
  var axis = axisModel.axis;
  var coord = axis.dataToCoord(value);
  var axisAngle = polar.getAngleAxis().getExtent()[0];
  axisAngle = axisAngle / 180 * Math.PI;
  var radiusExtent = polar.getRadiusAxis().getExtent();
  var position;
  var align;
  var verticalAlign;
  if (axis.dim === 'radius') {
    var transform = create$1();
    rotate(transform, transform, axisAngle);
    translate(transform, transform, [polar.cx, polar.cy]);
    position = applyTransform([coord, -labelMargin], transform);
    var labelRotation = axisModel.getModel('axisLabel').get('rotate') || 0;
    // @ts-ignore
    var labelLayout = AxisBuilder$1.innerTextLayout(axisAngle, labelRotation * Math.PI / 180, -1);
    align = labelLayout.textAlign;
    verticalAlign = labelLayout.textVerticalAlign;
  } else {
    // angle axis
    var r = radiusExtent[1];
    position = polar.coordToPoint([r + labelMargin, coord]);
    var cx = polar.cx;
    var cy = polar.cy;
    align = Math.abs(position[0] - cx) / r < 0.3 ? 'center' : position[0] > cx ? 'left' : 'right';
    verticalAlign = Math.abs(position[1] - cy) / r < 0.3 ? 'middle' : position[1] > cy ? 'top' : 'bottom';
  }
  return {
    position: position,
    align: align,
    verticalAlign: verticalAlign
  };
}
var pointerShapeBuilder$1 = {
  line: function (axis, polar, coordValue, otherExtent) {
    return axis.dim === 'angle' ? {
      type: 'Line',
      shape: makeLineShape(polar.coordToPoint([otherExtent[0], coordValue]), polar.coordToPoint([otherExtent[1], coordValue]))
    } : {
      type: 'Circle',
      shape: {
        cx: polar.cx,
        cy: polar.cy,
        r: coordValue
      }
    };
  },
  shadow: function (axis, polar, coordValue, otherExtent) {
    var bandWidth = Math.max(1, axis.getBandWidth());
    var radian = Math.PI / 180;
    return axis.dim === 'angle' ? {
      type: 'Sector',
      shape: makeSectorShape(polar.cx, polar.cy, otherExtent[0], otherExtent[1],
      // In ECharts y is negative if angle is positive
      (-coordValue - bandWidth / 2) * radian, (-coordValue + bandWidth / 2) * radian)
    } : {
      type: 'Sector',
      shape: makeSectorShape(polar.cx, polar.cy, coordValue - bandWidth / 2, coordValue + bandWidth / 2, 0, Math.PI * 2)
    };
  }
};
var PolarAxisPointer$1 = PolarAxisPointer;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PolarModel = /** @class */function (_super) {
  __extends(PolarModel, _super);
  function PolarModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = PolarModel.type;
    return _this;
  }
  PolarModel.prototype.findAxisModel = function (axisType) {
    var foundAxisModel;
    var ecModel = this.ecModel;
    ecModel.eachComponent(axisType, function (axisModel) {
      if (axisModel.getCoordSysModel() === this) {
        foundAxisModel = axisModel;
      }
    }, this);
    return foundAxisModel;
  };
  PolarModel.type = 'polar';
  PolarModel.dependencies = ['radiusAxis', 'angleAxis'];
  PolarModel.defaultOption = {
    // zlevel: 0,
    z: 0,
    center: ['50%', '50%'],
    radius: '80%'
  };
  return PolarModel;
}(ComponentModel$1);
var PolarModel$1 = PolarModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PolarAxisModel = /** @class */function (_super) {
  __extends(PolarAxisModel, _super);
  function PolarAxisModel() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  PolarAxisModel.prototype.getCoordSysModel = function () {
    return this.getReferringComponents('polar', SINGLE_REFERRING).models[0];
  };
  PolarAxisModel.type = 'polarAxis';
  return PolarAxisModel;
}(ComponentModel$1);
mixin(PolarAxisModel, AxisModelCommonMixin);
var AngleAxisModel = /** @class */function (_super) {
  __extends(AngleAxisModel, _super);
  function AngleAxisModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = AngleAxisModel.type;
    return _this;
  }
  AngleAxisModel.type = 'angleAxis';
  return AngleAxisModel;
}(PolarAxisModel);
var RadiusAxisModel = /** @class */function (_super) {
  __extends(RadiusAxisModel, _super);
  function RadiusAxisModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = RadiusAxisModel.type;
    return _this;
  }
  RadiusAxisModel.type = 'radiusAxis';
  return RadiusAxisModel;
}(PolarAxisModel);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var RadiusAxis = /** @class */function (_super) {
  __extends(RadiusAxis, _super);
  function RadiusAxis(scale, radiusExtent) {
    return _super.call(this, 'radius', scale, radiusExtent) || this;
  }
  RadiusAxis.prototype.pointToData = function (point, clamp) {
    return this.polar.pointToData(point, clamp)[this.dim === 'radius' ? 0 : 1];
  };
  return RadiusAxis;
}(Axis$1);
RadiusAxis.prototype.dataToRadius = Axis$1.prototype.dataToCoord;
RadiusAxis.prototype.radiusToData = Axis$1.prototype.coordToData;
var RadiusAxis$1 = RadiusAxis;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$8 = makeInner();
var AngleAxis = /** @class */function (_super) {
  __extends(AngleAxis, _super);
  function AngleAxis(scale, angleExtent) {
    return _super.call(this, 'angle', scale, angleExtent || [0, 360]) || this;
  }
  AngleAxis.prototype.pointToData = function (point, clamp) {
    return this.polar.pointToData(point, clamp)[this.dim === 'radius' ? 0 : 1];
  };
  /**
   * Only be called in category axis.
   * Angle axis uses text height to decide interval
   *
   * @override
   * @return {number} Auto interval for cateogry axis tick and label
   */
  AngleAxis.prototype.calculateCategoryInterval = function () {
    var axis = this;
    var labelModel = axis.getLabelModel();
    var ordinalScale = axis.scale;
    var ordinalExtent = ordinalScale.getExtent();
    // Providing this method is for optimization:
    // avoid generating a long array by `getTicks`
    // in large category data case.
    var tickCount = ordinalScale.count();
    if (ordinalExtent[1] - ordinalExtent[0] < 1) {
      return 0;
    }
    var tickValue = ordinalExtent[0];
    var unitSpan = axis.dataToCoord(tickValue + 1) - axis.dataToCoord(tickValue);
    var unitH = Math.abs(unitSpan);
    // Not precise, just use height as text width
    // and each distance from axis line yet.
    var rect = getBoundingRect(tickValue == null ? '' : tickValue + '', labelModel.getFont(), 'center', 'top');
    var maxH = Math.max(rect.height, 7);
    var dh = maxH / unitH;
    // 0/0 is NaN, 1/0 is Infinity.
    isNaN(dh) && (dh = Infinity);
    var interval = Math.max(0, Math.floor(dh));
    var cache = inner$8(axis.model);
    var lastAutoInterval = cache.lastAutoInterval;
    var lastTickCount = cache.lastTickCount;
    // Use cache to keep interval stable while moving zoom window,
    // otherwise the calculated interval might jitter when the zoom
    // window size is close to the interval-changing size.
    if (lastAutoInterval != null && lastTickCount != null && Math.abs(lastAutoInterval - interval) <= 1 && Math.abs(lastTickCount - tickCount) <= 1
    // Always choose the bigger one, otherwise the critical
    // point is not the same when zooming in or zooming out.
    && lastAutoInterval > interval) {
      interval = lastAutoInterval;
    }
    // Only update cache if cache not used, otherwise the
    // changing of interval is too insensitive.
    else {
      cache.lastTickCount = tickCount;
      cache.lastAutoInterval = interval;
    }
    return interval;
  };
  return AngleAxis;
}(Axis$1);
AngleAxis.prototype.dataToAngle = Axis$1.prototype.dataToCoord;
AngleAxis.prototype.angleToData = Axis$1.prototype.coordToData;
var AngleAxis$1 = AngleAxis;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var polarDimensions = ['radius', 'angle'];
var Polar = /** @class */function () {
  function Polar(name) {
    this.dimensions = polarDimensions;
    this.type = 'polar';
    /**
     * x of polar center
     */
    this.cx = 0;
    /**
     * y of polar center
     */
    this.cy = 0;
    this._radiusAxis = new RadiusAxis$1();
    this._angleAxis = new AngleAxis$1();
    this.axisPointerEnabled = true;
    this.name = name || '';
    this._radiusAxis.polar = this._angleAxis.polar = this;
  }
  /**
   * If contain coord
   */
  Polar.prototype.containPoint = function (point) {
    var coord = this.pointToCoord(point);
    return this._radiusAxis.contain(coord[0]) && this._angleAxis.contain(coord[1]);
  };
  /**
   * If contain data
   */
  Polar.prototype.containData = function (data) {
    return this._radiusAxis.containData(data[0]) && this._angleAxis.containData(data[1]);
  };
  Polar.prototype.getAxis = function (dim) {
    var key = '_' + dim + 'Axis';
    return this[key];
  };
  Polar.prototype.getAxes = function () {
    return [this._radiusAxis, this._angleAxis];
  };
  /**
   * Get axes by type of scale
   */
  Polar.prototype.getAxesByScale = function (scaleType) {
    var axes = [];
    var angleAxis = this._angleAxis;
    var radiusAxis = this._radiusAxis;
    angleAxis.scale.type === scaleType && axes.push(angleAxis);
    radiusAxis.scale.type === scaleType && axes.push(radiusAxis);
    return axes;
  };
  Polar.prototype.getAngleAxis = function () {
    return this._angleAxis;
  };
  Polar.prototype.getRadiusAxis = function () {
    return this._radiusAxis;
  };
  Polar.prototype.getOtherAxis = function (axis) {
    var angleAxis = this._angleAxis;
    return axis === angleAxis ? this._radiusAxis : angleAxis;
  };
  /**
   * Base axis will be used on stacking.
   *
   */
  Polar.prototype.getBaseAxis = function () {
    return this.getAxesByScale('ordinal')[0] || this.getAxesByScale('time')[0] || this.getAngleAxis();
  };
  Polar.prototype.getTooltipAxes = function (dim) {
    var baseAxis = dim != null && dim !== 'auto' ? this.getAxis(dim) : this.getBaseAxis();
    return {
      baseAxes: [baseAxis],
      otherAxes: [this.getOtherAxis(baseAxis)]
    };
  };
  /**
   * Convert a single data item to (x, y) point.
   * Parameter data is an array which the first element is radius and the second is angle
   */
  Polar.prototype.dataToPoint = function (data, clamp) {
    return this.coordToPoint([this._radiusAxis.dataToRadius(data[0], clamp), this._angleAxis.dataToAngle(data[1], clamp)]);
  };
  /**
   * Convert a (x, y) point to data
   */
  Polar.prototype.pointToData = function (point, clamp) {
    var coord = this.pointToCoord(point);
    return [this._radiusAxis.radiusToData(coord[0], clamp), this._angleAxis.angleToData(coord[1], clamp)];
  };
  /**
   * Convert a (x, y) point to (radius, angle) coord
   */
  Polar.prototype.pointToCoord = function (point) {
    var dx = point[0] - this.cx;
    var dy = point[1] - this.cy;
    var angleAxis = this.getAngleAxis();
    var extent = angleAxis.getExtent();
    var minAngle = Math.min(extent[0], extent[1]);
    var maxAngle = Math.max(extent[0], extent[1]);
    // Fix fixed extent in polarCreator
    // FIXME
    angleAxis.inverse ? minAngle = maxAngle - 360 : maxAngle = minAngle + 360;
    var radius = Math.sqrt(dx * dx + dy * dy);
    dx /= radius;
    dy /= radius;
    var radian = Math.atan2(-dy, dx) / Math.PI * 180;
    // move to angleExtent
    var dir = radian < minAngle ? 1 : -1;
    while (radian < minAngle || radian > maxAngle) {
      radian += dir * 360;
    }
    return [radius, radian];
  };
  /**
   * Convert a (radius, angle) coord to (x, y) point
   */
  Polar.prototype.coordToPoint = function (coord) {
    var radius = coord[0];
    var radian = coord[1] / 180 * Math.PI;
    var x = Math.cos(radian) * radius + this.cx;
    // Inverse the y
    var y = -Math.sin(radian) * radius + this.cy;
    return [x, y];
  };
  /**
   * Get ring area of cartesian.
   * Area will have a contain function to determine if a point is in the coordinate system.
   */
  Polar.prototype.getArea = function () {
    var angleAxis = this.getAngleAxis();
    var radiusAxis = this.getRadiusAxis();
    var radiusExtent = radiusAxis.getExtent().slice();
    radiusExtent[0] > radiusExtent[1] && radiusExtent.reverse();
    var angleExtent = angleAxis.getExtent();
    var RADIAN = Math.PI / 180;
    var EPSILON = 1e-4;
    return {
      cx: this.cx,
      cy: this.cy,
      r0: radiusExtent[0],
      r: radiusExtent[1],
      startAngle: -angleExtent[0] * RADIAN,
      endAngle: -angleExtent[1] * RADIAN,
      clockwise: angleAxis.inverse,
      contain: function (x, y) {
        // It's a ring shape.
        // Start angle and end angle don't matter
        var dx = x - this.cx;
        var dy = y - this.cy;
        var d2 = dx * dx + dy * dy;
        var r = this.r;
        var r0 = this.r0;
        // minus a tiny value 1e-4 in double side to avoid being clipped unexpectedly
        // r == r0 contain nothing
        return r !== r0 && d2 - EPSILON <= r * r && d2 + EPSILON >= r0 * r0;
      }
    };
  };
  Polar.prototype.convertToPixel = function (ecModel, finder, value) {
    var coordSys = getCoordSys$2(finder);
    return coordSys === this ? this.dataToPoint(value) : null;
  };
  Polar.prototype.convertFromPixel = function (ecModel, finder, pixel) {
    var coordSys = getCoordSys$2(finder);
    return coordSys === this ? this.pointToData(pixel) : null;
  };
  return Polar;
}();
function getCoordSys$2(finder) {
  var seriesModel = finder.seriesModel;
  var polarModel = finder.polarModel;
  return polarModel && polarModel.coordinateSystem || seriesModel && seriesModel.coordinateSystem;
}
var Polar$1 = Polar;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Resize method bound to the polar
 */
function resizePolar(polar, polarModel, api) {
  var center = polarModel.get('center');
  var width = api.getWidth();
  var height = api.getHeight();
  polar.cx = parsePercent(center[0], width);
  polar.cy = parsePercent(center[1], height);
  var radiusAxis = polar.getRadiusAxis();
  var size = Math.min(width, height) / 2;
  var radius = polarModel.get('radius');
  if (radius == null) {
    radius = [0, '100%'];
  } else if (!isArray$1(radius)) {
    // r0 = 0
    radius = [0, radius];
  }
  var parsedRadius = [parsePercent(radius[0], size), parsePercent(radius[1], size)];
  radiusAxis.inverse ? radiusAxis.setExtent(parsedRadius[1], parsedRadius[0]) : radiusAxis.setExtent(parsedRadius[0], parsedRadius[1]);
}
/**
 * Update polar
 */
function updatePolarScale(ecModel, api) {
  var polar = this;
  var angleAxis = polar.getAngleAxis();
  var radiusAxis = polar.getRadiusAxis();
  // Reset scale
  angleAxis.scale.setExtent(Infinity, -Infinity);
  radiusAxis.scale.setExtent(Infinity, -Infinity);
  ecModel.eachSeries(function (seriesModel) {
    if (seriesModel.coordinateSystem === polar) {
      var data_1 = seriesModel.getData();
      each$f(getDataDimensionsOnAxis(data_1, 'radius'), function (dim) {
        radiusAxis.scale.unionExtentFromData(data_1, dim);
      });
      each$f(getDataDimensionsOnAxis(data_1, 'angle'), function (dim) {
        angleAxis.scale.unionExtentFromData(data_1, dim);
      });
    }
  });
  niceScaleExtent(angleAxis.scale, angleAxis.model);
  niceScaleExtent(radiusAxis.scale, radiusAxis.model);
  // Fix extent of category angle axis
  if (angleAxis.type === 'category' && !angleAxis.onBand) {
    var extent = angleAxis.getExtent();
    var diff = 360 / angleAxis.scale.count();
    angleAxis.inverse ? extent[1] += diff : extent[1] -= diff;
    angleAxis.setExtent(extent[0], extent[1]);
  }
}
function isAngleAxisModel(axisModel) {
  return axisModel.mainType === 'angleAxis';
}
/**
 * Set common axis properties
 */
function setAxis(axis, axisModel) {
  var _a;
  axis.type = axisModel.get('type');
  axis.scale = createScaleByModel$1(axisModel);
  axis.onBand = axisModel.get('boundaryGap') && axis.type === 'category';
  axis.inverse = axisModel.get('inverse');
  if (isAngleAxisModel(axisModel)) {
    axis.inverse = axis.inverse !== axisModel.get('clockwise');
    var startAngle = axisModel.get('startAngle');
    var endAngle = (_a = axisModel.get('endAngle')) !== null && _a !== void 0 ? _a : startAngle + (axis.inverse ? -360 : 360);
    axis.setExtent(startAngle, endAngle);
  }
  // Inject axis instance
  axisModel.axis = axis;
  axis.model = axisModel;
}
var polarCreator = {
  dimensions: polarDimensions,
  create: function (ecModel, api) {
    var polarList = [];
    ecModel.eachComponent('polar', function (polarModel, idx) {
      var polar = new Polar$1(idx + '');
      // Inject resize and update method
      polar.update = updatePolarScale;
      var radiusAxis = polar.getRadiusAxis();
      var angleAxis = polar.getAngleAxis();
      var radiusAxisModel = polarModel.findAxisModel('radiusAxis');
      var angleAxisModel = polarModel.findAxisModel('angleAxis');
      setAxis(radiusAxis, radiusAxisModel);
      setAxis(angleAxis, angleAxisModel);
      resizePolar(polar, polarModel, api);
      polarList.push(polar);
      polarModel.coordinateSystem = polar;
      polar.model = polarModel;
    });
    // Inject coordinateSystem to series
    ecModel.eachSeries(function (seriesModel) {
      if (seriesModel.get('coordinateSystem') === 'polar') {
        var polarModel = seriesModel.getReferringComponents('polar', SINGLE_REFERRING).models[0];
        {
          if (!polarModel) {
            throw new Error('Polar "' + retrieve(seriesModel.get('polarIndex'), seriesModel.get('polarId'), 0) + '" not found');
          }
        }
        seriesModel.coordinateSystem = polarModel.coordinateSystem;
      }
    });
    return polarList;
  }
};
var polarCreator$1 = polarCreator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var elementList = ['axisLine', 'axisLabel', 'axisTick', 'minorTick', 'splitLine', 'minorSplitLine', 'splitArea'];
function getAxisLineShape(polar, rExtent, angle) {
  rExtent[1] > rExtent[0] && (rExtent = rExtent.slice().reverse());
  var start = polar.coordToPoint([rExtent[0], angle]);
  var end = polar.coordToPoint([rExtent[1], angle]);
  return {
    x1: start[0],
    y1: start[1],
    x2: end[0],
    y2: end[1]
  };
}
function getRadiusIdx(polar) {
  var radiusAxis = polar.getRadiusAxis();
  return radiusAxis.inverse ? 0 : 1;
}
// Remove the last tick which will overlap the first tick
function fixAngleOverlap(list) {
  var firstItem = list[0];
  var lastItem = list[list.length - 1];
  if (firstItem && lastItem && Math.abs(Math.abs(firstItem.coord - lastItem.coord) - 360) < 1e-4) {
    list.pop();
  }
}
var AngleAxisView = /** @class */function (_super) {
  __extends(AngleAxisView, _super);
  function AngleAxisView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = AngleAxisView.type;
    _this.axisPointerClass = 'PolarAxisPointer';
    return _this;
  }
  AngleAxisView.prototype.render = function (angleAxisModel, ecModel) {
    this.group.removeAll();
    if (!angleAxisModel.get('show')) {
      return;
    }
    var angleAxis = angleAxisModel.axis;
    var polar = angleAxis.polar;
    var radiusExtent = polar.getRadiusAxis().getExtent();
    var ticksAngles = angleAxis.getTicksCoords();
    var minorTickAngles = angleAxis.getMinorTicksCoords();
    var labels = map$1(angleAxis.getViewLabels(), function (labelItem) {
      labelItem = clone$4(labelItem);
      var scale = angleAxis.scale;
      var tickValue = scale.type === 'ordinal' ? scale.getRawOrdinalNumber(labelItem.tickValue) : labelItem.tickValue;
      labelItem.coord = angleAxis.dataToCoord(tickValue);
      return labelItem;
    });
    fixAngleOverlap(labels);
    fixAngleOverlap(ticksAngles);
    each$f(elementList, function (name) {
      if (angleAxisModel.get([name, 'show']) && (!angleAxis.scale.isBlank() || name === 'axisLine')) {
        angelAxisElementsBuilders[name](this.group, angleAxisModel, polar, ticksAngles, minorTickAngles, radiusExtent, labels);
      }
    }, this);
  };
  AngleAxisView.type = 'angleAxis';
  return AngleAxisView;
}(AxisView$1);
var angelAxisElementsBuilders = {
  axisLine: function (group, angleAxisModel, polar, ticksAngles, minorTickAngles, radiusExtent) {
    var lineStyleModel = angleAxisModel.getModel(['axisLine', 'lineStyle']);
    var angleAxis = polar.getAngleAxis();
    var RADIAN = Math.PI / 180;
    var angleExtent = angleAxis.getExtent();
    // extent id of the axis radius (r0 and r)
    var rId = getRadiusIdx(polar);
    var r0Id = rId ? 0 : 1;
    var shape;
    var shapeType = Math.abs(angleExtent[1] - angleExtent[0]) === 360 ? 'Circle' : 'Arc';
    if (radiusExtent[r0Id] === 0) {
      shape = new graphic[shapeType]({
        shape: {
          cx: polar.cx,
          cy: polar.cy,
          r: radiusExtent[rId],
          startAngle: -angleExtent[0] * RADIAN,
          endAngle: -angleExtent[1] * RADIAN,
          clockwise: angleAxis.inverse
        },
        style: lineStyleModel.getLineStyle(),
        z2: 1,
        silent: true
      });
    } else {
      shape = new Ring$1({
        shape: {
          cx: polar.cx,
          cy: polar.cy,
          r: radiusExtent[rId],
          r0: radiusExtent[r0Id]
        },
        style: lineStyleModel.getLineStyle(),
        z2: 1,
        silent: true
      });
    }
    shape.style.fill = null;
    group.add(shape);
  },
  axisTick: function (group, angleAxisModel, polar, ticksAngles, minorTickAngles, radiusExtent) {
    var tickModel = angleAxisModel.getModel('axisTick');
    var tickLen = (tickModel.get('inside') ? -1 : 1) * tickModel.get('length');
    var radius = radiusExtent[getRadiusIdx(polar)];
    var lines = map$1(ticksAngles, function (tickAngleItem) {
      return new Line$4({
        shape: getAxisLineShape(polar, [radius, radius + tickLen], tickAngleItem.coord)
      });
    });
    group.add(mergePath(lines, {
      style: defaults(tickModel.getModel('lineStyle').getLineStyle(), {
        stroke: angleAxisModel.get(['axisLine', 'lineStyle', 'color'])
      })
    }));
  },
  minorTick: function (group, angleAxisModel, polar, tickAngles, minorTickAngles, radiusExtent) {
    if (!minorTickAngles.length) {
      return;
    }
    var tickModel = angleAxisModel.getModel('axisTick');
    var minorTickModel = angleAxisModel.getModel('minorTick');
    var tickLen = (tickModel.get('inside') ? -1 : 1) * minorTickModel.get('length');
    var radius = radiusExtent[getRadiusIdx(polar)];
    var lines = [];
    for (var i = 0; i < minorTickAngles.length; i++) {
      for (var k = 0; k < minorTickAngles[i].length; k++) {
        lines.push(new Line$4({
          shape: getAxisLineShape(polar, [radius, radius + tickLen], minorTickAngles[i][k].coord)
        }));
      }
    }
    group.add(mergePath(lines, {
      style: defaults(minorTickModel.getModel('lineStyle').getLineStyle(), defaults(tickModel.getLineStyle(), {
        stroke: angleAxisModel.get(['axisLine', 'lineStyle', 'color'])
      }))
    }));
  },
  axisLabel: function (group, angleAxisModel, polar, ticksAngles, minorTickAngles, radiusExtent, labels) {
    var rawCategoryData = angleAxisModel.getCategories(true);
    var commonLabelModel = angleAxisModel.getModel('axisLabel');
    var labelMargin = commonLabelModel.get('margin');
    var triggerEvent = angleAxisModel.get('triggerEvent');
    // Use length of ticksAngles because it may remove the last tick to avoid overlapping
    each$f(labels, function (labelItem, idx) {
      var labelModel = commonLabelModel;
      var tickValue = labelItem.tickValue;
      var r = radiusExtent[getRadiusIdx(polar)];
      var p = polar.coordToPoint([r + labelMargin, labelItem.coord]);
      var cx = polar.cx;
      var cy = polar.cy;
      var labelTextAlign = Math.abs(p[0] - cx) / r < 0.3 ? 'center' : p[0] > cx ? 'left' : 'right';
      var labelTextVerticalAlign = Math.abs(p[1] - cy) / r < 0.3 ? 'middle' : p[1] > cy ? 'top' : 'bottom';
      if (rawCategoryData && rawCategoryData[tickValue]) {
        var rawCategoryItem = rawCategoryData[tickValue];
        if (isObject$3(rawCategoryItem) && rawCategoryItem.textStyle) {
          labelModel = new Model$1(rawCategoryItem.textStyle, commonLabelModel, commonLabelModel.ecModel);
        }
      }
      var textEl = new ZRText$1({
        silent: AxisBuilder$1.isLabelSilent(angleAxisModel),
        style: createTextStyle(labelModel, {
          x: p[0],
          y: p[1],
          fill: labelModel.getTextColor() || angleAxisModel.get(['axisLine', 'lineStyle', 'color']),
          text: labelItem.formattedLabel,
          align: labelTextAlign,
          verticalAlign: labelTextVerticalAlign
        })
      });
      group.add(textEl);
      // Pack data for mouse event
      if (triggerEvent) {
        var eventData = AxisBuilder$1.makeAxisEventDataBase(angleAxisModel);
        eventData.targetType = 'axisLabel';
        eventData.value = labelItem.rawLabel;
        getECData(textEl).eventData = eventData;
      }
    }, this);
  },
  splitLine: function (group, angleAxisModel, polar, ticksAngles, minorTickAngles, radiusExtent) {
    var splitLineModel = angleAxisModel.getModel('splitLine');
    var lineStyleModel = splitLineModel.getModel('lineStyle');
    var lineColors = lineStyleModel.get('color');
    var lineCount = 0;
    lineColors = lineColors instanceof Array ? lineColors : [lineColors];
    var splitLines = [];
    for (var i = 0; i < ticksAngles.length; i++) {
      var colorIndex = lineCount++ % lineColors.length;
      splitLines[colorIndex] = splitLines[colorIndex] || [];
      splitLines[colorIndex].push(new Line$4({
        shape: getAxisLineShape(polar, radiusExtent, ticksAngles[i].coord)
      }));
    }
    // Simple optimization
    // Batching the lines if color are the same
    for (var i = 0; i < splitLines.length; i++) {
      group.add(mergePath(splitLines[i], {
        style: defaults({
          stroke: lineColors[i % lineColors.length]
        }, lineStyleModel.getLineStyle()),
        silent: true,
        z: angleAxisModel.get('z')
      }));
    }
  },
  minorSplitLine: function (group, angleAxisModel, polar, ticksAngles, minorTickAngles, radiusExtent) {
    if (!minorTickAngles.length) {
      return;
    }
    var minorSplitLineModel = angleAxisModel.getModel('minorSplitLine');
    var lineStyleModel = minorSplitLineModel.getModel('lineStyle');
    var lines = [];
    for (var i = 0; i < minorTickAngles.length; i++) {
      for (var k = 0; k < minorTickAngles[i].length; k++) {
        lines.push(new Line$4({
          shape: getAxisLineShape(polar, radiusExtent, minorTickAngles[i][k].coord)
        }));
      }
    }
    group.add(mergePath(lines, {
      style: lineStyleModel.getLineStyle(),
      silent: true,
      z: angleAxisModel.get('z')
    }));
  },
  splitArea: function (group, angleAxisModel, polar, ticksAngles, minorTickAngles, radiusExtent) {
    if (!ticksAngles.length) {
      return;
    }
    var splitAreaModel = angleAxisModel.getModel('splitArea');
    var areaStyleModel = splitAreaModel.getModel('areaStyle');
    var areaColors = areaStyleModel.get('color');
    var lineCount = 0;
    areaColors = areaColors instanceof Array ? areaColors : [areaColors];
    var splitAreas = [];
    var RADIAN = Math.PI / 180;
    var prevAngle = -ticksAngles[0].coord * RADIAN;
    var r0 = Math.min(radiusExtent[0], radiusExtent[1]);
    var r1 = Math.max(radiusExtent[0], radiusExtent[1]);
    var clockwise = angleAxisModel.get('clockwise');
    for (var i = 1, len = ticksAngles.length; i <= len; i++) {
      var coord = i === len ? ticksAngles[0].coord : ticksAngles[i].coord;
      var colorIndex = lineCount++ % areaColors.length;
      splitAreas[colorIndex] = splitAreas[colorIndex] || [];
      splitAreas[colorIndex].push(new Sector$1({
        shape: {
          cx: polar.cx,
          cy: polar.cy,
          r0: r0,
          r: r1,
          startAngle: prevAngle,
          endAngle: -coord * RADIAN,
          clockwise: clockwise
        },
        silent: true
      }));
      prevAngle = -coord * RADIAN;
    }
    // Simple optimization
    // Batching the lines if color are the same
    for (var i = 0; i < splitAreas.length; i++) {
      group.add(mergePath(splitAreas[i], {
        style: defaults({
          fill: areaColors[i % areaColors.length]
        }, areaStyleModel.getAreaStyle()),
        silent: true
      }));
    }
  }
};
var AngleAxisView$1 = AngleAxisView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var axisBuilderAttrs$1 = ['axisLine', 'axisTickLabel', 'axisName'];
var selfBuilderAttrs$1 = ['splitLine', 'splitArea', 'minorSplitLine'];
var RadiusAxisView = /** @class */function (_super) {
  __extends(RadiusAxisView, _super);
  function RadiusAxisView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = RadiusAxisView.type;
    _this.axisPointerClass = 'PolarAxisPointer';
    return _this;
  }
  RadiusAxisView.prototype.render = function (radiusAxisModel, ecModel) {
    this.group.removeAll();
    if (!radiusAxisModel.get('show')) {
      return;
    }
    var oldAxisGroup = this._axisGroup;
    var newAxisGroup = this._axisGroup = new Group$5();
    this.group.add(newAxisGroup);
    var radiusAxis = radiusAxisModel.axis;
    var polar = radiusAxis.polar;
    var angleAxis = polar.getAngleAxis();
    var ticksCoords = radiusAxis.getTicksCoords();
    var minorTicksCoords = radiusAxis.getMinorTicksCoords();
    var axisAngle = angleAxis.getExtent()[0];
    var radiusExtent = radiusAxis.getExtent();
    var layout = layoutAxis(polar, radiusAxisModel, axisAngle);
    var axisBuilder = new AxisBuilder$1(radiusAxisModel, layout);
    each$f(axisBuilderAttrs$1, axisBuilder.add, axisBuilder);
    newAxisGroup.add(axisBuilder.getGroup());
    groupTransition(oldAxisGroup, newAxisGroup, radiusAxisModel);
    each$f(selfBuilderAttrs$1, function (name) {
      if (radiusAxisModel.get([name, 'show']) && !radiusAxis.scale.isBlank()) {
        axisElementBuilders$1[name](this.group, radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords, minorTicksCoords);
      }
    }, this);
  };
  RadiusAxisView.type = 'radiusAxis';
  return RadiusAxisView;
}(AxisView$1);
var axisElementBuilders$1 = {
  splitLine: function (group, radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords) {
    var splitLineModel = radiusAxisModel.getModel('splitLine');
    var lineStyleModel = splitLineModel.getModel('lineStyle');
    var lineColors = lineStyleModel.get('color');
    var lineCount = 0;
    var angleAxis = polar.getAngleAxis();
    var RADIAN = Math.PI / 180;
    var angleExtent = angleAxis.getExtent();
    var shapeType = Math.abs(angleExtent[1] - angleExtent[0]) === 360 ? 'Circle' : 'Arc';
    lineColors = lineColors instanceof Array ? lineColors : [lineColors];
    var splitLines = [];
    for (var i = 0; i < ticksCoords.length; i++) {
      var colorIndex = lineCount++ % lineColors.length;
      splitLines[colorIndex] = splitLines[colorIndex] || [];
      splitLines[colorIndex].push(new graphic[shapeType]({
        shape: {
          cx: polar.cx,
          cy: polar.cy,
          // ensure circle radius >= 0
          r: Math.max(ticksCoords[i].coord, 0),
          startAngle: -angleExtent[0] * RADIAN,
          endAngle: -angleExtent[1] * RADIAN,
          clockwise: angleAxis.inverse
        }
      }));
    }
    // Simple optimization
    // Batching the lines if color are the same
    for (var i = 0; i < splitLines.length; i++) {
      group.add(mergePath(splitLines[i], {
        style: defaults({
          stroke: lineColors[i % lineColors.length],
          fill: null
        }, lineStyleModel.getLineStyle()),
        silent: true
      }));
    }
  },
  minorSplitLine: function (group, radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords, minorTicksCoords) {
    if (!minorTicksCoords.length) {
      return;
    }
    var minorSplitLineModel = radiusAxisModel.getModel('minorSplitLine');
    var lineStyleModel = minorSplitLineModel.getModel('lineStyle');
    var lines = [];
    for (var i = 0; i < minorTicksCoords.length; i++) {
      for (var k = 0; k < minorTicksCoords[i].length; k++) {
        lines.push(new Circle$1({
          shape: {
            cx: polar.cx,
            cy: polar.cy,
            r: minorTicksCoords[i][k].coord
          }
        }));
      }
    }
    group.add(mergePath(lines, {
      style: defaults({
        fill: null
      }, lineStyleModel.getLineStyle()),
      silent: true
    }));
  },
  splitArea: function (group, radiusAxisModel, polar, axisAngle, radiusExtent, ticksCoords) {
    if (!ticksCoords.length) {
      return;
    }
    var splitAreaModel = radiusAxisModel.getModel('splitArea');
    var areaStyleModel = splitAreaModel.getModel('areaStyle');
    var areaColors = areaStyleModel.get('color');
    var lineCount = 0;
    areaColors = areaColors instanceof Array ? areaColors : [areaColors];
    var splitAreas = [];
    var prevRadius = ticksCoords[0].coord;
    for (var i = 1; i < ticksCoords.length; i++) {
      var colorIndex = lineCount++ % areaColors.length;
      splitAreas[colorIndex] = splitAreas[colorIndex] || [];
      splitAreas[colorIndex].push(new Sector$1({
        shape: {
          cx: polar.cx,
          cy: polar.cy,
          r0: prevRadius,
          r: ticksCoords[i].coord,
          startAngle: 0,
          endAngle: Math.PI * 2
        },
        silent: true
      }));
      prevRadius = ticksCoords[i].coord;
    }
    // Simple optimization
    // Batching the lines if color are the same
    for (var i = 0; i < splitAreas.length; i++) {
      group.add(mergePath(splitAreas[i], {
        style: defaults({
          fill: areaColors[i % areaColors.length]
        }, areaStyleModel.getAreaStyle()),
        silent: true
      }));
    }
  }
};
/**
 * @inner
 */
function layoutAxis(polar, radiusAxisModel, axisAngle) {
  return {
    position: [polar.cx, polar.cy],
    rotation: axisAngle / 180 * Math.PI,
    labelDirection: -1,
    tickDirection: -1,
    nameDirection: 1,
    labelRotate: radiusAxisModel.getModel('axisLabel').get('rotate'),
    // Over splitLine and splitArea
    z2: 1
  };
}
var RadiusAxisView$1 = RadiusAxisView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function getSeriesStackId(seriesModel) {
  return seriesModel.get('stack') || '__ec_stack_' + seriesModel.seriesIndex;
}
function getAxisKey(polar, axis) {
  return axis.dim + polar.model.componentIndex;
}
function barLayoutPolar(seriesType, ecModel, api) {
  var lastStackCoords = {};
  var barWidthAndOffset = calRadialBar(filter(ecModel.getSeriesByType(seriesType), function (seriesModel) {
    return !ecModel.isSeriesFiltered(seriesModel) && seriesModel.coordinateSystem && seriesModel.coordinateSystem.type === 'polar';
  }));
  ecModel.eachSeriesByType(seriesType, function (seriesModel) {
    // Check series coordinate, do layout for polar only
    if (seriesModel.coordinateSystem.type !== 'polar') {
      return;
    }
    var data = seriesModel.getData();
    var polar = seriesModel.coordinateSystem;
    var baseAxis = polar.getBaseAxis();
    var axisKey = getAxisKey(polar, baseAxis);
    var stackId = getSeriesStackId(seriesModel);
    var columnLayoutInfo = barWidthAndOffset[axisKey][stackId];
    var columnOffset = columnLayoutInfo.offset;
    var columnWidth = columnLayoutInfo.width;
    var valueAxis = polar.getOtherAxis(baseAxis);
    var cx = seriesModel.coordinateSystem.cx;
    var cy = seriesModel.coordinateSystem.cy;
    var barMinHeight = seriesModel.get('barMinHeight') || 0;
    var barMinAngle = seriesModel.get('barMinAngle') || 0;
    lastStackCoords[stackId] = lastStackCoords[stackId] || [];
    var valueDim = data.mapDimension(valueAxis.dim);
    var baseDim = data.mapDimension(baseAxis.dim);
    var stacked = isDimensionStacked(data, valueDim /* , baseDim */);
    var clampLayout = baseAxis.dim !== 'radius' || !seriesModel.get('roundCap', true);
    var valueAxisModel = valueAxis.model;
    var startValue = valueAxisModel.get('startValue');
    var valueAxisStart = valueAxis.dataToCoord(startValue || 0);
    for (var idx = 0, len = data.count(); idx < len; idx++) {
      var value = data.get(valueDim, idx);
      var baseValue = data.get(baseDim, idx);
      var sign = value >= 0 ? 'p' : 'n';
      var baseCoord = valueAxisStart;
      // Because of the barMinHeight, we can not use the value in
      // stackResultDimension directly.
      // Only ordinal axis can be stacked.
      if (stacked) {
        if (!lastStackCoords[stackId][baseValue]) {
          lastStackCoords[stackId][baseValue] = {
            p: valueAxisStart,
            n: valueAxisStart // Negative stack
          };
        }
        // Should also consider #4243
        baseCoord = lastStackCoords[stackId][baseValue][sign];
      }
      var r0 = void 0;
      var r = void 0;
      var startAngle = void 0;
      var endAngle = void 0;
      // radial sector
      if (valueAxis.dim === 'radius') {
        var radiusSpan = valueAxis.dataToCoord(value) - valueAxisStart;
        var angle = baseAxis.dataToCoord(baseValue);
        if (Math.abs(radiusSpan) < barMinHeight) {
          radiusSpan = (radiusSpan < 0 ? -1 : 1) * barMinHeight;
        }
        r0 = baseCoord;
        r = baseCoord + radiusSpan;
        startAngle = angle - columnOffset;
        endAngle = startAngle - columnWidth;
        stacked && (lastStackCoords[stackId][baseValue][sign] = r);
      }
      // tangential sector
      else {
        var angleSpan = valueAxis.dataToCoord(value, clampLayout) - valueAxisStart;
        var radius = baseAxis.dataToCoord(baseValue);
        if (Math.abs(angleSpan) < barMinAngle) {
          angleSpan = (angleSpan < 0 ? -1 : 1) * barMinAngle;
        }
        r0 = radius + columnOffset;
        r = r0 + columnWidth;
        startAngle = baseCoord;
        endAngle = baseCoord + angleSpan;
        // if the previous stack is at the end of the ring,
        // add a round to differentiate it from origin
        // let extent = angleAxis.getExtent();
        // let stackCoord = angle;
        // if (stackCoord === extent[0] && value > 0) {
        //     stackCoord = extent[1];
        // }
        // else if (stackCoord === extent[1] && value < 0) {
        //     stackCoord = extent[0];
        // }
        stacked && (lastStackCoords[stackId][baseValue][sign] = endAngle);
      }
      data.setItemLayout(idx, {
        cx: cx,
        cy: cy,
        r0: r0,
        r: r,
        // Consider that positive angle is anti-clockwise,
        // while positive radian of sector is clockwise
        startAngle: -startAngle * Math.PI / 180,
        endAngle: -endAngle * Math.PI / 180,
        /**
         * Keep the same logic with bar in catesion: use end value to
         * control direction. Notice that if clockwise is true (by
         * default), the sector will always draw clockwisely, no matter
         * whether endAngle is greater or less than startAngle.
         */
        clockwise: startAngle >= endAngle
      });
    }
  });
}
/**
 * Calculate bar width and offset for radial bar charts
 */
function calRadialBar(barSeries) {
  // Columns info on each category axis. Key is polar name
  var columnsMap = {};
  each$f(barSeries, function (seriesModel, idx) {
    var data = seriesModel.getData();
    var polar = seriesModel.coordinateSystem;
    var baseAxis = polar.getBaseAxis();
    var axisKey = getAxisKey(polar, baseAxis);
    var axisExtent = baseAxis.getExtent();
    var bandWidth = baseAxis.type === 'category' ? baseAxis.getBandWidth() : Math.abs(axisExtent[1] - axisExtent[0]) / data.count();
    var columnsOnAxis = columnsMap[axisKey] || {
      bandWidth: bandWidth,
      remainedWidth: bandWidth,
      autoWidthCount: 0,
      categoryGap: '20%',
      gap: '30%',
      stacks: {}
    };
    var stacks = columnsOnAxis.stacks;
    columnsMap[axisKey] = columnsOnAxis;
    var stackId = getSeriesStackId(seriesModel);
    if (!stacks[stackId]) {
      columnsOnAxis.autoWidthCount++;
    }
    stacks[stackId] = stacks[stackId] || {
      width: 0,
      maxWidth: 0
    };
    var barWidth = parsePercent(seriesModel.get('barWidth'), bandWidth);
    var barMaxWidth = parsePercent(seriesModel.get('barMaxWidth'), bandWidth);
    var barGap = seriesModel.get('barGap');
    var barCategoryGap = seriesModel.get('barCategoryGap');
    if (barWidth && !stacks[stackId].width) {
      barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth);
      stacks[stackId].width = barWidth;
      columnsOnAxis.remainedWidth -= barWidth;
    }
    barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth);
    barGap != null && (columnsOnAxis.gap = barGap);
    barCategoryGap != null && (columnsOnAxis.categoryGap = barCategoryGap);
  });
  var result = {};
  each$f(columnsMap, function (columnsOnAxis, coordSysName) {
    result[coordSysName] = {};
    var stacks = columnsOnAxis.stacks;
    var bandWidth = columnsOnAxis.bandWidth;
    var categoryGap = parsePercent(columnsOnAxis.categoryGap, bandWidth);
    var barGapPercent = parsePercent(columnsOnAxis.gap, 1);
    var remainedWidth = columnsOnAxis.remainedWidth;
    var autoWidthCount = columnsOnAxis.autoWidthCount;
    var autoWidth = (remainedWidth - categoryGap) / (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
    autoWidth = Math.max(autoWidth, 0);
    // Find if any auto calculated bar exceeded maxBarWidth
    each$f(stacks, function (column, stack) {
      var maxWidth = column.maxWidth;
      if (maxWidth && maxWidth < autoWidth) {
        maxWidth = Math.min(maxWidth, remainedWidth);
        if (column.width) {
          maxWidth = Math.min(maxWidth, column.width);
        }
        remainedWidth -= maxWidth;
        column.width = maxWidth;
        autoWidthCount--;
      }
    });
    // Recalculate width again
    autoWidth = (remainedWidth - categoryGap) / (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
    autoWidth = Math.max(autoWidth, 0);
    var widthSum = 0;
    var lastColumn;
    each$f(stacks, function (column, idx) {
      if (!column.width) {
        column.width = autoWidth;
      }
      lastColumn = column;
      widthSum += column.width * (1 + barGapPercent);
    });
    if (lastColumn) {
      widthSum -= lastColumn.width * barGapPercent;
    }
    var offset = -widthSum / 2;
    each$f(stacks, function (column, stackId) {
      result[coordSysName][stackId] = result[coordSysName][stackId] || {
        offset: offset,
        width: column.width
      };
      offset += column.width * (1 + barGapPercent);
    });
  });
  return result;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var angleAxisExtraOption = {
  startAngle: 90,
  clockwise: true,
  splitNumber: 12,
  axisLabel: {
    rotate: 0
  }
};
var radiusAxisExtraOption = {
  splitNumber: 5
};
var PolarView = /** @class */function (_super) {
  __extends(PolarView, _super);
  function PolarView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = PolarView.type;
    return _this;
  }
  PolarView.type = 'polar';
  return PolarView;
}(ComponentView$1);
function install$q(registers) {
  use(install$s);
  AxisView$1.registerAxisPointerClass('PolarAxisPointer', PolarAxisPointer$1);
  registers.registerCoordinateSystem('polar', polarCreator$1);
  registers.registerComponentModel(PolarModel$1);
  registers.registerComponentView(PolarView);
  // Model and view for angleAxis and radiusAxis
  axisModelCreator(registers, 'angle', AngleAxisModel, angleAxisExtraOption);
  axisModelCreator(registers, 'radius', RadiusAxisModel, radiusAxisExtraOption);
  registers.registerComponentView(AngleAxisView$1);
  registers.registerComponentView(RadiusAxisView$1);
  registers.registerLayout(curry$1(barLayoutPolar, 'bar'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function layout$1(axisModel, opt) {
  opt = opt || {};
  var single = axisModel.coordinateSystem;
  var axis = axisModel.axis;
  var layout = {};
  var axisPosition = axis.position;
  var orient = axis.orient;
  var rect = single.getRect();
  var rectBound = [rect.x, rect.x + rect.width, rect.y, rect.y + rect.height];
  var positionMap = {
    horizontal: {
      top: rectBound[2],
      bottom: rectBound[3]
    },
    vertical: {
      left: rectBound[0],
      right: rectBound[1]
    }
  };
  layout.position = [orient === 'vertical' ? positionMap.vertical[axisPosition] : rectBound[0], orient === 'horizontal' ? positionMap.horizontal[axisPosition] : rectBound[3]];
  var r = {
    horizontal: 0,
    vertical: 1
  };
  layout.rotation = Math.PI / 2 * r[orient];
  var directionMap = {
    top: -1,
    bottom: 1,
    right: 1,
    left: -1
  };
  layout.labelDirection = layout.tickDirection = layout.nameDirection = directionMap[axisPosition];
  if (axisModel.get(['axisTick', 'inside'])) {
    layout.tickDirection = -layout.tickDirection;
  }
  if (retrieve(opt.labelInside, axisModel.get(['axisLabel', 'inside']))) {
    layout.labelDirection = -layout.labelDirection;
  }
  var labelRotation = opt.rotate;
  labelRotation == null && (labelRotation = axisModel.get(['axisLabel', 'rotate']));
  layout.labelRotation = axisPosition === 'top' ? -labelRotation : labelRotation;
  layout.z2 = 1;
  return layout;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var axisBuilderAttrs = ['axisLine', 'axisTickLabel', 'axisName'];
var selfBuilderAttrs = ['splitArea', 'splitLine'];
var SingleAxisView = /** @class */function (_super) {
  __extends(SingleAxisView, _super);
  function SingleAxisView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SingleAxisView.type;
    _this.axisPointerClass = 'SingleAxisPointer';
    return _this;
  }
  SingleAxisView.prototype.render = function (axisModel, ecModel, api, payload) {
    var group = this.group;
    group.removeAll();
    var oldAxisGroup = this._axisGroup;
    this._axisGroup = new Group$5();
    var layout = layout$1(axisModel);
    var axisBuilder = new AxisBuilder$1(axisModel, layout);
    each$f(axisBuilderAttrs, axisBuilder.add, axisBuilder);
    group.add(this._axisGroup);
    group.add(axisBuilder.getGroup());
    each$f(selfBuilderAttrs, function (name) {
      if (axisModel.get([name, 'show'])) {
        axisElementBuilders[name](this, this.group, this._axisGroup, axisModel);
      }
    }, this);
    groupTransition(oldAxisGroup, this._axisGroup, axisModel);
    _super.prototype.render.call(this, axisModel, ecModel, api, payload);
  };
  SingleAxisView.prototype.remove = function () {
    rectCoordAxisHandleRemove(this);
  };
  SingleAxisView.type = 'singleAxis';
  return SingleAxisView;
}(AxisView$1);
var axisElementBuilders = {
  splitLine: function (axisView, group, axisGroup, axisModel) {
    var axis = axisModel.axis;
    if (axis.scale.isBlank()) {
      return;
    }
    var splitLineModel = axisModel.getModel('splitLine');
    var lineStyleModel = splitLineModel.getModel('lineStyle');
    var lineColors = lineStyleModel.get('color');
    lineColors = lineColors instanceof Array ? lineColors : [lineColors];
    var lineWidth = lineStyleModel.get('width');
    var gridRect = axisModel.coordinateSystem.getRect();
    var isHorizontal = axis.isHorizontal();
    var splitLines = [];
    var lineCount = 0;
    var ticksCoords = axis.getTicksCoords({
      tickModel: splitLineModel
    });
    var p1 = [];
    var p2 = [];
    for (var i = 0; i < ticksCoords.length; ++i) {
      var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
      if (isHorizontal) {
        p1[0] = tickCoord;
        p1[1] = gridRect.y;
        p2[0] = tickCoord;
        p2[1] = gridRect.y + gridRect.height;
      } else {
        p1[0] = gridRect.x;
        p1[1] = tickCoord;
        p2[0] = gridRect.x + gridRect.width;
        p2[1] = tickCoord;
      }
      var line = new Line$4({
        shape: {
          x1: p1[0],
          y1: p1[1],
          x2: p2[0],
          y2: p2[1]
        },
        silent: true
      });
      subPixelOptimizeLine(line.shape, lineWidth);
      var colorIndex = lineCount++ % lineColors.length;
      splitLines[colorIndex] = splitLines[colorIndex] || [];
      splitLines[colorIndex].push(line);
    }
    var lineStyle = lineStyleModel.getLineStyle(['color']);
    for (var i = 0; i < splitLines.length; ++i) {
      group.add(mergePath(splitLines[i], {
        style: defaults({
          stroke: lineColors[i % lineColors.length]
        }, lineStyle),
        silent: true
      }));
    }
  },
  splitArea: function (axisView, group, axisGroup, axisModel) {
    rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, axisModel);
  }
};
var SingleAxisView$1 = SingleAxisView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SingleAxisModel = /** @class */function (_super) {
  __extends(SingleAxisModel, _super);
  function SingleAxisModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SingleAxisModel.type;
    return _this;
  }
  SingleAxisModel.prototype.getCoordSysModel = function () {
    return this;
  };
  SingleAxisModel.type = 'singleAxis';
  SingleAxisModel.layoutMode = 'box';
  SingleAxisModel.defaultOption = {
    left: '5%',
    top: '5%',
    right: '5%',
    bottom: '5%',
    type: 'value',
    position: 'bottom',
    orient: 'horizontal',
    axisLine: {
      show: true,
      lineStyle: {
        width: 1,
        type: 'solid'
      }
    },
    // Single coordinate system and single axis is the,
    // which is used as the parent tooltip model.
    // same model, so we set default tooltip show as true.
    tooltip: {
      show: true
    },
    axisTick: {
      show: true,
      length: 6,
      lineStyle: {
        width: 1
      }
    },
    axisLabel: {
      show: true,
      interval: 'auto'
    },
    splitLine: {
      show: true,
      lineStyle: {
        type: 'dashed',
        opacity: 0.2
      }
    }
  };
  return SingleAxisModel;
}(ComponentModel$1);
mixin(SingleAxisModel, AxisModelCommonMixin.prototype);
var SingleAxisModel$1 = SingleAxisModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SingleAxis = /** @class */function (_super) {
  __extends(SingleAxis, _super);
  function SingleAxis(dim, scale, coordExtent, axisType, position) {
    var _this = _super.call(this, dim, scale, coordExtent) || this;
    _this.type = axisType || 'value';
    _this.position = position || 'bottom';
    return _this;
  }
  /**
   * Judge the orient of the axis.
   */
  SingleAxis.prototype.isHorizontal = function () {
    var position = this.position;
    return position === 'top' || position === 'bottom';
  };
  SingleAxis.prototype.pointToData = function (point, clamp) {
    return this.coordinateSystem.pointToData(point)[0];
  };
  return SingleAxis;
}(Axis$1);
var SingleAxis$1 = SingleAxis;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var singleDimensions = ['single'];
/**
 * Create a single coordinates system.
 */
var Single = /** @class */function () {
  function Single(axisModel, ecModel, api) {
    this.type = 'single';
    this.dimension = 'single';
    /**
     * Add it just for draw tooltip.
     */
    this.dimensions = singleDimensions;
    this.axisPointerEnabled = true;
    this.model = axisModel;
    this._init(axisModel, ecModel, api);
  }
  /**
   * Initialize single coordinate system.
   */
  Single.prototype._init = function (axisModel, ecModel, api) {
    var dim = this.dimension;
    var axis = new SingleAxis$1(dim, createScaleByModel$1(axisModel), [0, 0], axisModel.get('type'), axisModel.get('position'));
    var isCategory = axis.type === 'category';
    axis.onBand = isCategory && axisModel.get('boundaryGap');
    axis.inverse = axisModel.get('inverse');
    axis.orient = axisModel.get('orient');
    axisModel.axis = axis;
    axis.model = axisModel;
    axis.coordinateSystem = this;
    this._axis = axis;
  };
  /**
   * Update axis scale after data processed
   */
  Single.prototype.update = function (ecModel, api) {
    ecModel.eachSeries(function (seriesModel) {
      if (seriesModel.coordinateSystem === this) {
        var data_1 = seriesModel.getData();
        each$f(data_1.mapDimensionsAll(this.dimension), function (dim) {
          this._axis.scale.unionExtentFromData(data_1, dim);
        }, this);
        niceScaleExtent(this._axis.scale, this._axis.model);
      }
    }, this);
  };
  /**
   * Resize the single coordinate system.
   */
  Single.prototype.resize = function (axisModel, api) {
    this._rect = getLayoutRect({
      left: axisModel.get('left'),
      top: axisModel.get('top'),
      right: axisModel.get('right'),
      bottom: axisModel.get('bottom'),
      width: axisModel.get('width'),
      height: axisModel.get('height')
    }, {
      width: api.getWidth(),
      height: api.getHeight()
    });
    this._adjustAxis();
  };
  Single.prototype.getRect = function () {
    return this._rect;
  };
  Single.prototype._adjustAxis = function () {
    var rect = this._rect;
    var axis = this._axis;
    var isHorizontal = axis.isHorizontal();
    var extent = isHorizontal ? [0, rect.width] : [0, rect.height];
    var idx = axis.inverse ? 1 : 0;
    axis.setExtent(extent[idx], extent[1 - idx]);
    this._updateAxisTransform(axis, isHorizontal ? rect.x : rect.y);
  };
  Single.prototype._updateAxisTransform = function (axis, coordBase) {
    var axisExtent = axis.getExtent();
    var extentSum = axisExtent[0] + axisExtent[1];
    var isHorizontal = axis.isHorizontal();
    axis.toGlobalCoord = isHorizontal ? function (coord) {
      return coord + coordBase;
    } : function (coord) {
      return extentSum - coord + coordBase;
    };
    axis.toLocalCoord = isHorizontal ? function (coord) {
      return coord - coordBase;
    } : function (coord) {
      return extentSum - coord + coordBase;
    };
  };
  /**
   * Get axis.
   */
  Single.prototype.getAxis = function () {
    return this._axis;
  };
  /**
   * Get axis, add it just for draw tooltip.
   */
  Single.prototype.getBaseAxis = function () {
    return this._axis;
  };
  Single.prototype.getAxes = function () {
    return [this._axis];
  };
  Single.prototype.getTooltipAxes = function () {
    return {
      baseAxes: [this.getAxis()],
      // Empty otherAxes
      otherAxes: []
    };
  };
  /**
   * If contain point.
   */
  Single.prototype.containPoint = function (point) {
    var rect = this.getRect();
    var axis = this.getAxis();
    var orient = axis.orient;
    if (orient === 'horizontal') {
      return axis.contain(axis.toLocalCoord(point[0])) && point[1] >= rect.y && point[1] <= rect.y + rect.height;
    } else {
      return axis.contain(axis.toLocalCoord(point[1])) && point[0] >= rect.y && point[0] <= rect.y + rect.height;
    }
  };
  Single.prototype.pointToData = function (point) {
    var axis = this.getAxis();
    return [axis.coordToData(axis.toLocalCoord(point[axis.orient === 'horizontal' ? 0 : 1]))];
  };
  /**
   * Convert the series data to concrete point.
   * Can be [val] | val
   */
  Single.prototype.dataToPoint = function (val) {
    var axis = this.getAxis();
    var rect = this.getRect();
    var pt = [];
    var idx = axis.orient === 'horizontal' ? 0 : 1;
    if (val instanceof Array) {
      val = val[0];
    }
    pt[idx] = axis.toGlobalCoord(axis.dataToCoord(+val));
    pt[1 - idx] = idx === 0 ? rect.y + rect.height / 2 : rect.x + rect.width / 2;
    return pt;
  };
  Single.prototype.convertToPixel = function (ecModel, finder, value) {
    var coordSys = getCoordSys$1(finder);
    return coordSys === this ? this.dataToPoint(value) : null;
  };
  Single.prototype.convertFromPixel = function (ecModel, finder, pixel) {
    var coordSys = getCoordSys$1(finder);
    return coordSys === this ? this.pointToData(pixel) : null;
  };
  return Single;
}();
function getCoordSys$1(finder) {
  var seriesModel = finder.seriesModel;
  var singleModel = finder.singleAxisModel;
  return singleModel && singleModel.coordinateSystem || seriesModel && seriesModel.coordinateSystem;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Create single coordinate system and inject it into seriesModel.
 */
function create(ecModel, api) {
  var singles = [];
  ecModel.eachComponent('singleAxis', function (axisModel, idx) {
    var single = new Single(axisModel, ecModel, api);
    single.name = 'single_' + idx;
    single.resize(axisModel, api);
    axisModel.coordinateSystem = single;
    singles.push(single);
  });
  ecModel.eachSeries(function (seriesModel) {
    if (seriesModel.get('coordinateSystem') === 'singleAxis') {
      var singleAxisModel = seriesModel.getReferringComponents('singleAxis', SINGLE_REFERRING).models[0];
      seriesModel.coordinateSystem = singleAxisModel && singleAxisModel.coordinateSystem;
    }
  });
  return singles;
}
var singleCreator = {
  create: create,
  dimensions: singleDimensions
};
var singleCreator$1 = singleCreator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var XY$1 = ['x', 'y'];
var WH$1 = ['width', 'height'];
var SingleAxisPointer = /** @class */function (_super) {
  __extends(SingleAxisPointer, _super);
  function SingleAxisPointer() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  /**
   * @override
   */
  SingleAxisPointer.prototype.makeElOption = function (elOption, value, axisModel, axisPointerModel, api) {
    var axis = axisModel.axis;
    var coordSys = axis.coordinateSystem;
    var otherExtent = getGlobalExtent(coordSys, 1 - getPointDimIndex(axis));
    var pixelValue = coordSys.dataToPoint(value)[0];
    var axisPointerType = axisPointerModel.get('type');
    if (axisPointerType && axisPointerType !== 'none') {
      var elStyle = buildElStyle(axisPointerModel);
      var pointerOption = pointerShapeBuilder[axisPointerType](axis, pixelValue, otherExtent);
      pointerOption.style = elStyle;
      elOption.graphicKey = pointerOption.type;
      elOption.pointer = pointerOption;
    }
    var layoutInfo = layout$1(axisModel);
    buildCartesianSingleLabelElOption(
    // @ts-ignore
    value, elOption, layoutInfo, axisModel, axisPointerModel, api);
  };
  /**
   * @override
   */
  SingleAxisPointer.prototype.getHandleTransform = function (value, axisModel, axisPointerModel) {
    var layoutInfo = layout$1(axisModel, {
      labelInside: false
    });
    // @ts-ignore
    layoutInfo.labelMargin = axisPointerModel.get(['handle', 'margin']);
    var position = getTransformedPosition(axisModel.axis, value, layoutInfo);
    return {
      x: position[0],
      y: position[1],
      rotation: layoutInfo.rotation + (layoutInfo.labelDirection < 0 ? Math.PI : 0)
    };
  };
  /**
   * @override
   */
  SingleAxisPointer.prototype.updateHandleTransform = function (transform, delta, axisModel, axisPointerModel) {
    var axis = axisModel.axis;
    var coordSys = axis.coordinateSystem;
    var dimIndex = getPointDimIndex(axis);
    var axisExtent = getGlobalExtent(coordSys, dimIndex);
    var currPosition = [transform.x, transform.y];
    currPosition[dimIndex] += delta[dimIndex];
    currPosition[dimIndex] = Math.min(axisExtent[1], currPosition[dimIndex]);
    currPosition[dimIndex] = Math.max(axisExtent[0], currPosition[dimIndex]);
    var otherExtent = getGlobalExtent(coordSys, 1 - dimIndex);
    var cursorOtherValue = (otherExtent[1] + otherExtent[0]) / 2;
    var cursorPoint = [cursorOtherValue, cursorOtherValue];
    cursorPoint[dimIndex] = currPosition[dimIndex];
    return {
      x: currPosition[0],
      y: currPosition[1],
      rotation: transform.rotation,
      cursorPoint: cursorPoint,
      tooltipOption: {
        verticalAlign: 'middle'
      }
    };
  };
  return SingleAxisPointer;
}(BaseAxisPointer$1);
var pointerShapeBuilder = {
  line: function (axis, pixelValue, otherExtent) {
    var targetShape = makeLineShape([pixelValue, otherExtent[0]], [pixelValue, otherExtent[1]], getPointDimIndex(axis));
    return {
      type: 'Line',
      subPixelOptimize: true,
      shape: targetShape
    };
  },
  shadow: function (axis, pixelValue, otherExtent) {
    var bandWidth = axis.getBandWidth();
    var span = otherExtent[1] - otherExtent[0];
    return {
      type: 'Rect',
      shape: makeRectShape([pixelValue - bandWidth / 2, otherExtent[0]], [bandWidth, span], getPointDimIndex(axis))
    };
  }
};
function getPointDimIndex(axis) {
  return axis.isHorizontal() ? 0 : 1;
}
function getGlobalExtent(coordSys, dimIndex) {
  var rect = coordSys.getRect();
  return [rect[XY$1[dimIndex]], rect[XY$1[dimIndex]] + rect[WH$1[dimIndex]]];
}
var SingleAxisPointer$1 = SingleAxisPointer;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SingleView = /** @class */function (_super) {
  __extends(SingleView, _super);
  function SingleView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SingleView.type;
    return _this;
  }
  SingleView.type = 'single';
  return SingleView;
}(ComponentView$1);
function install$p(registers) {
  use(install$s);
  AxisView$1.registerAxisPointerClass('SingleAxisPointer', SingleAxisPointer$1);
  registers.registerComponentView(SingleView);
  // Axis
  registers.registerComponentView(SingleAxisView$1);
  registers.registerComponentModel(SingleAxisModel$1);
  axisModelCreator(registers, 'single', SingleAxisModel$1, SingleAxisModel$1.defaultOption);
  registers.registerCoordinateSystem('single', singleCreator$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var CalendarModel = /** @class */function (_super) {
  __extends(CalendarModel, _super);
  function CalendarModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = CalendarModel.type;
    return _this;
  }
  /**
   * @override
   */
  CalendarModel.prototype.init = function (option, parentModel, ecModel) {
    var inputPositionParams = getLayoutParams(option);
    _super.prototype.init.apply(this, arguments);
    mergeAndNormalizeLayoutParams$1(option, inputPositionParams);
  };
  /**
   * @override
   */
  CalendarModel.prototype.mergeOption = function (option) {
    _super.prototype.mergeOption.apply(this, arguments);
    mergeAndNormalizeLayoutParams$1(this.option, option);
  };
  CalendarModel.prototype.getCellSize = function () {
    // Has been normalized
    return this.option.cellSize;
  };
  CalendarModel.type = 'calendar';
  CalendarModel.defaultOption = {
    // zlevel: 0,
    z: 2,
    left: 80,
    top: 60,
    cellSize: 20,
    // horizontal vertical
    orient: 'horizontal',
    // month separate line style
    splitLine: {
      show: true,
      lineStyle: {
        color: '#000',
        width: 1,
        type: 'solid'
      }
    },
    // rect style  temporarily unused emphasis
    itemStyle: {
      color: '#fff',
      borderWidth: 1,
      borderColor: '#ccc'
    },
    // week text style
    dayLabel: {
      show: true,
      firstDay: 0,
      // start end
      position: 'start',
      margin: '50%',
      color: '#000'
    },
    // month text style
    monthLabel: {
      show: true,
      // start end
      position: 'start',
      margin: 5,
      // center or left
      align: 'center',
      formatter: null,
      color: '#000'
    },
    // year text style
    yearLabel: {
      show: true,
      // top bottom left right
      position: null,
      margin: 30,
      formatter: null,
      color: '#ccc',
      fontFamily: 'sans-serif',
      fontWeight: 'bolder',
      fontSize: 20
    }
  };
  return CalendarModel;
}(ComponentModel$1);
function mergeAndNormalizeLayoutParams$1(target, raw) {
  // Normalize cellSize
  var cellSize = target.cellSize;
  var cellSizeArr;
  if (!isArray$1(cellSize)) {
    cellSizeArr = target.cellSize = [cellSize, cellSize];
  } else {
    cellSizeArr = cellSize;
  }
  if (cellSizeArr.length === 1) {
    cellSizeArr[1] = cellSizeArr[0];
  }
  var ignoreSize = map$1([0, 1], function (hvIdx) {
    // If user have set `width` or both `left` and `right`, cellSizeArr
    // will be automatically set to 'auto', otherwise the default
    // setting of cellSizeArr will make `width` setting not work.
    if (sizeCalculable(raw, hvIdx)) {
      cellSizeArr[hvIdx] = 'auto';
    }
    return cellSizeArr[hvIdx] != null && cellSizeArr[hvIdx] !== 'auto';
  });
  mergeLayoutParam(target, raw, {
    type: 'box',
    ignoreSize: ignoreSize
  });
}
var CalendarModel$1 = CalendarModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var CalendarView = /** @class */function (_super) {
  __extends(CalendarView, _super);
  function CalendarView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = CalendarView.type;
    return _this;
  }
  CalendarView.prototype.render = function (calendarModel, ecModel, api) {
    var group = this.group;
    group.removeAll();
    var coordSys = calendarModel.coordinateSystem;
    // range info
    var rangeData = coordSys.getRangeInfo();
    var orient = coordSys.getOrient();
    // locale
    var localeModel = ecModel.getLocaleModel();
    this._renderDayRect(calendarModel, rangeData, group);
    // _renderLines must be called prior to following function
    this._renderLines(calendarModel, rangeData, orient, group);
    this._renderYearText(calendarModel, rangeData, orient, group);
    this._renderMonthText(calendarModel, localeModel, orient, group);
    this._renderWeekText(calendarModel, localeModel, rangeData, orient, group);
  };
  // render day rect
  CalendarView.prototype._renderDayRect = function (calendarModel, rangeData, group) {
    var coordSys = calendarModel.coordinateSystem;
    var itemRectStyleModel = calendarModel.getModel('itemStyle').getItemStyle();
    var sw = coordSys.getCellWidth();
    var sh = coordSys.getCellHeight();
    for (var i = rangeData.start.time; i <= rangeData.end.time; i = coordSys.getNextNDay(i, 1).time) {
      var point = coordSys.dataToRect([i], false).tl;
      // every rect
      var rect = new Rect$3({
        shape: {
          x: point[0],
          y: point[1],
          width: sw,
          height: sh
        },
        cursor: 'default',
        style: itemRectStyleModel
      });
      group.add(rect);
    }
  };
  // render separate line
  CalendarView.prototype._renderLines = function (calendarModel, rangeData, orient, group) {
    var self = this;
    var coordSys = calendarModel.coordinateSystem;
    var lineStyleModel = calendarModel.getModel(['splitLine', 'lineStyle']).getLineStyle();
    var show = calendarModel.get(['splitLine', 'show']);
    var lineWidth = lineStyleModel.lineWidth;
    this._tlpoints = [];
    this._blpoints = [];
    this._firstDayOfMonth = [];
    this._firstDayPoints = [];
    var firstDay = rangeData.start;
    for (var i = 0; firstDay.time <= rangeData.end.time; i++) {
      addPoints(firstDay.formatedDate);
      if (i === 0) {
        firstDay = coordSys.getDateInfo(rangeData.start.y + '-' + rangeData.start.m);
      }
      var date = firstDay.date;
      date.setMonth(date.getMonth() + 1);
      firstDay = coordSys.getDateInfo(date);
    }
    addPoints(coordSys.getNextNDay(rangeData.end.time, 1).formatedDate);
    function addPoints(date) {
      self._firstDayOfMonth.push(coordSys.getDateInfo(date));
      self._firstDayPoints.push(coordSys.dataToRect([date], false).tl);
      var points = self._getLinePointsOfOneWeek(calendarModel, date, orient);
      self._tlpoints.push(points[0]);
      self._blpoints.push(points[points.length - 1]);
      show && self._drawSplitline(points, lineStyleModel, group);
    }
    // render top/left line
    show && this._drawSplitline(self._getEdgesPoints(self._tlpoints, lineWidth, orient), lineStyleModel, group);
    // render bottom/right line
    show && this._drawSplitline(self._getEdgesPoints(self._blpoints, lineWidth, orient), lineStyleModel, group);
  };
  // get points at both ends
  CalendarView.prototype._getEdgesPoints = function (points, lineWidth, orient) {
    var rs = [points[0].slice(), points[points.length - 1].slice()];
    var idx = orient === 'horizontal' ? 0 : 1;
    // both ends of the line are extend half lineWidth
    rs[0][idx] = rs[0][idx] - lineWidth / 2;
    rs[1][idx] = rs[1][idx] + lineWidth / 2;
    return rs;
  };
  // render split line
  CalendarView.prototype._drawSplitline = function (points, lineStyle, group) {
    var poyline = new Polyline$3({
      z2: 20,
      shape: {
        points: points
      },
      style: lineStyle
    });
    group.add(poyline);
  };
  // render month line of one week points
  CalendarView.prototype._getLinePointsOfOneWeek = function (calendarModel, date, orient) {
    var coordSys = calendarModel.coordinateSystem;
    var parsedDate = coordSys.getDateInfo(date);
    var points = [];
    for (var i = 0; i < 7; i++) {
      var tmpD = coordSys.getNextNDay(parsedDate.time, i);
      var point = coordSys.dataToRect([tmpD.time], false);
      points[2 * tmpD.day] = point.tl;
      points[2 * tmpD.day + 1] = point[orient === 'horizontal' ? 'bl' : 'tr'];
    }
    return points;
  };
  CalendarView.prototype._formatterLabel = function (formatter, params) {
    if (isString(formatter) && formatter) {
      return formatTplSimple(formatter, params);
    }
    if (isFunction(formatter)) {
      return formatter(params);
    }
    return params.nameMap;
  };
  CalendarView.prototype._yearTextPositionControl = function (textEl, point, orient, position, margin) {
    var x = point[0];
    var y = point[1];
    var aligns = ['center', 'bottom'];
    if (position === 'bottom') {
      y += margin;
      aligns = ['center', 'top'];
    } else if (position === 'left') {
      x -= margin;
    } else if (position === 'right') {
      x += margin;
      aligns = ['center', 'top'];
    } else {
      // top
      y -= margin;
    }
    var rotate = 0;
    if (position === 'left' || position === 'right') {
      rotate = Math.PI / 2;
    }
    return {
      rotation: rotate,
      x: x,
      y: y,
      style: {
        align: aligns[0],
        verticalAlign: aligns[1]
      }
    };
  };
  // render year
  CalendarView.prototype._renderYearText = function (calendarModel, rangeData, orient, group) {
    var yearLabel = calendarModel.getModel('yearLabel');
    if (!yearLabel.get('show')) {
      return;
    }
    var margin = yearLabel.get('margin');
    var pos = yearLabel.get('position');
    if (!pos) {
      pos = orient !== 'horizontal' ? 'top' : 'left';
    }
    var points = [this._tlpoints[this._tlpoints.length - 1], this._blpoints[0]];
    var xc = (points[0][0] + points[1][0]) / 2;
    var yc = (points[0][1] + points[1][1]) / 2;
    var idx = orient === 'horizontal' ? 0 : 1;
    var posPoints = {
      top: [xc, points[idx][1]],
      bottom: [xc, points[1 - idx][1]],
      left: [points[1 - idx][0], yc],
      right: [points[idx][0], yc]
    };
    var name = rangeData.start.y;
    if (+rangeData.end.y > +rangeData.start.y) {
      name = name + '-' + rangeData.end.y;
    }
    var formatter = yearLabel.get('formatter');
    var params = {
      start: rangeData.start.y,
      end: rangeData.end.y,
      nameMap: name
    };
    var content = this._formatterLabel(formatter, params);
    var yearText = new ZRText$1({
      z2: 30,
      style: createTextStyle(yearLabel, {
        text: content
      }),
      silent: yearLabel.get('silent')
    });
    yearText.attr(this._yearTextPositionControl(yearText, posPoints[pos], orient, pos, margin));
    group.add(yearText);
  };
  CalendarView.prototype._monthTextPositionControl = function (point, isCenter, orient, position, margin) {
    var align = 'left';
    var vAlign = 'top';
    var x = point[0];
    var y = point[1];
    if (orient === 'horizontal') {
      y = y + margin;
      if (isCenter) {
        align = 'center';
      }
      if (position === 'start') {
        vAlign = 'bottom';
      }
    } else {
      x = x + margin;
      if (isCenter) {
        vAlign = 'middle';
      }
      if (position === 'start') {
        align = 'right';
      }
    }
    return {
      x: x,
      y: y,
      align: align,
      verticalAlign: vAlign
    };
  };
  // render month and year text
  CalendarView.prototype._renderMonthText = function (calendarModel, localeModel, orient, group) {
    var monthLabel = calendarModel.getModel('monthLabel');
    if (!monthLabel.get('show')) {
      return;
    }
    var nameMap = monthLabel.get('nameMap');
    var margin = monthLabel.get('margin');
    var pos = monthLabel.get('position');
    var align = monthLabel.get('align');
    var termPoints = [this._tlpoints, this._blpoints];
    if (!nameMap || isString(nameMap)) {
      if (nameMap) {
        // case-sensitive
        localeModel = getLocaleModel(nameMap) || localeModel;
      }
      // PENDING
      // for ZH locale, original form is `一月` but current form is `1月`
      nameMap = localeModel.get(['time', 'monthAbbr']) || [];
    }
    var idx = pos === 'start' ? 0 : 1;
    var axis = orient === 'horizontal' ? 0 : 1;
    margin = pos === 'start' ? -margin : margin;
    var isCenter = align === 'center';
    var labelSilent = monthLabel.get('silent');
    for (var i = 0; i < termPoints[idx].length - 1; i++) {
      var tmp = termPoints[idx][i].slice();
      var firstDay = this._firstDayOfMonth[i];
      if (isCenter) {
        var firstDayPoints = this._firstDayPoints[i];
        tmp[axis] = (firstDayPoints[axis] + termPoints[0][i + 1][axis]) / 2;
      }
      var formatter = monthLabel.get('formatter');
      var name_1 = nameMap[+firstDay.m - 1];
      var params = {
        yyyy: firstDay.y,
        yy: (firstDay.y + '').slice(2),
        MM: firstDay.m,
        M: +firstDay.m,
        nameMap: name_1
      };
      var content = this._formatterLabel(formatter, params);
      var monthText = new ZRText$1({
        z2: 30,
        style: extend(createTextStyle(monthLabel, {
          text: content
        }), this._monthTextPositionControl(tmp, isCenter, orient, pos, margin)),
        silent: labelSilent
      });
      group.add(monthText);
    }
  };
  CalendarView.prototype._weekTextPositionControl = function (point, orient, position, margin, cellSize) {
    var align = 'center';
    var vAlign = 'middle';
    var x = point[0];
    var y = point[1];
    var isStart = position === 'start';
    if (orient === 'horizontal') {
      x = x + margin + (isStart ? 1 : -1) * cellSize[0] / 2;
      align = isStart ? 'right' : 'left';
    } else {
      y = y + margin + (isStart ? 1 : -1) * cellSize[1] / 2;
      vAlign = isStart ? 'bottom' : 'top';
    }
    return {
      x: x,
      y: y,
      align: align,
      verticalAlign: vAlign
    };
  };
  // render weeks
  CalendarView.prototype._renderWeekText = function (calendarModel, localeModel, rangeData, orient, group) {
    var dayLabel = calendarModel.getModel('dayLabel');
    if (!dayLabel.get('show')) {
      return;
    }
    var coordSys = calendarModel.coordinateSystem;
    var pos = dayLabel.get('position');
    var nameMap = dayLabel.get('nameMap');
    var margin = dayLabel.get('margin');
    var firstDayOfWeek = coordSys.getFirstDayOfWeek();
    if (!nameMap || isString(nameMap)) {
      if (nameMap) {
        // case-sensitive
        localeModel = getLocaleModel(nameMap) || localeModel;
      }
      // Use the first letter of `dayOfWeekAbbr` if `dayOfWeekShort` doesn't exist in the locale file
      var dayOfWeekShort = localeModel.get(['time', 'dayOfWeekShort']);
      nameMap = dayOfWeekShort || map$1(localeModel.get(['time', 'dayOfWeekAbbr']), function (val) {
        return val[0];
      });
    }
    var start = coordSys.getNextNDay(rangeData.end.time, 7 - rangeData.lweek).time;
    var cellSize = [coordSys.getCellWidth(), coordSys.getCellHeight()];
    margin = parsePercent(margin, Math.min(cellSize[1], cellSize[0]));
    if (pos === 'start') {
      start = coordSys.getNextNDay(rangeData.start.time, -(7 + rangeData.fweek)).time;
      margin = -margin;
    }
    var labelSilent = dayLabel.get('silent');
    for (var i = 0; i < 7; i++) {
      var tmpD = coordSys.getNextNDay(start, i);
      var point = coordSys.dataToRect([tmpD.time], false).center;
      var day = i;
      day = Math.abs((i + firstDayOfWeek) % 7);
      var weekText = new ZRText$1({
        z2: 30,
        style: extend(createTextStyle(dayLabel, {
          text: nameMap[day]
        }), this._weekTextPositionControl(point, orient, pos, margin, cellSize)),
        silent: labelSilent
      });
      group.add(weekText);
    }
  };
  CalendarView.type = 'calendar';
  return CalendarView;
}(ComponentView$1);
var CalendarView$1 = CalendarView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// (24*60*60*1000)
var PROXIMATE_ONE_DAY = 86400000;
var Calendar = /** @class */function () {
  function Calendar(calendarModel, ecModel, api) {
    this.type = 'calendar';
    this.dimensions = Calendar.dimensions;
    // Required in createListFromData
    this.getDimensionsInfo = Calendar.getDimensionsInfo;
    this._model = calendarModel;
  }
  Calendar.getDimensionsInfo = function () {
    return [{
      name: 'time',
      type: 'time'
    }, 'value'];
  };
  Calendar.prototype.getRangeInfo = function () {
    return this._rangeInfo;
  };
  Calendar.prototype.getModel = function () {
    return this._model;
  };
  Calendar.prototype.getRect = function () {
    return this._rect;
  };
  Calendar.prototype.getCellWidth = function () {
    return this._sw;
  };
  Calendar.prototype.getCellHeight = function () {
    return this._sh;
  };
  Calendar.prototype.getOrient = function () {
    return this._orient;
  };
  /**
   * getFirstDayOfWeek
   *
   * @example
   *     0 : start at Sunday
   *     1 : start at Monday
   *
   * @return {number}
   */
  Calendar.prototype.getFirstDayOfWeek = function () {
    return this._firstDayOfWeek;
  };
  /**
   * get date info
   * }
   */
  Calendar.prototype.getDateInfo = function (date) {
    date = parseDate(date);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var mStr = m < 10 ? '0' + m : '' + m;
    var d = date.getDate();
    var dStr = d < 10 ? '0' + d : '' + d;
    var day = date.getDay();
    day = Math.abs((day + 7 - this.getFirstDayOfWeek()) % 7);
    return {
      y: y + '',
      m: mStr,
      d: dStr,
      day: day,
      time: date.getTime(),
      formatedDate: y + '-' + mStr + '-' + dStr,
      date: date
    };
  };
  Calendar.prototype.getNextNDay = function (date, n) {
    n = n || 0;
    if (n === 0) {
      return this.getDateInfo(date);
    }
    date = new Date(this.getDateInfo(date).time);
    date.setDate(date.getDate() + n);
    return this.getDateInfo(date);
  };
  Calendar.prototype.update = function (ecModel, api) {
    this._firstDayOfWeek = +this._model.getModel('dayLabel').get('firstDay');
    this._orient = this._model.get('orient');
    this._lineWidth = this._model.getModel('itemStyle').getItemStyle().lineWidth || 0;
    this._rangeInfo = this._getRangeInfo(this._initRangeOption());
    var weeks = this._rangeInfo.weeks || 1;
    var whNames = ['width', 'height'];
    var cellSize = this._model.getCellSize().slice();
    var layoutParams = this._model.getBoxLayoutParams();
    var cellNumbers = this._orient === 'horizontal' ? [weeks, 7] : [7, weeks];
    each$f([0, 1], function (idx) {
      if (cellSizeSpecified(cellSize, idx)) {
        layoutParams[whNames[idx]] = cellSize[idx] * cellNumbers[idx];
      }
    });
    var whGlobal = {
      width: api.getWidth(),
      height: api.getHeight()
    };
    var calendarRect = this._rect = getLayoutRect(layoutParams, whGlobal);
    each$f([0, 1], function (idx) {
      if (!cellSizeSpecified(cellSize, idx)) {
        cellSize[idx] = calendarRect[whNames[idx]] / cellNumbers[idx];
      }
    });
    function cellSizeSpecified(cellSize, idx) {
      return cellSize[idx] != null && cellSize[idx] !== 'auto';
    }
    // Has been calculated out number.
    this._sw = cellSize[0];
    this._sh = cellSize[1];
  };
  /**
   * Convert a time data(time, value) item to (x, y) point.
   */
  // TODO Clamp of calendar is not same with cartesian coordinate systems.
  // It will return NaN if data exceeds.
  Calendar.prototype.dataToPoint = function (data, clamp) {
    isArray$1(data) && (data = data[0]);
    clamp == null && (clamp = true);
    var dayInfo = this.getDateInfo(data);
    var range = this._rangeInfo;
    var date = dayInfo.formatedDate;
    // if not in range return [NaN, NaN]
    if (clamp && !(dayInfo.time >= range.start.time && dayInfo.time < range.end.time + PROXIMATE_ONE_DAY)) {
      return [NaN, NaN];
    }
    var week = dayInfo.day;
    var nthWeek = this._getRangeInfo([range.start.time, date]).nthWeek;
    if (this._orient === 'vertical') {
      return [this._rect.x + week * this._sw + this._sw / 2, this._rect.y + nthWeek * this._sh + this._sh / 2];
    }
    return [this._rect.x + nthWeek * this._sw + this._sw / 2, this._rect.y + week * this._sh + this._sh / 2];
  };
  /**
   * Convert a (x, y) point to time data
   */
  Calendar.prototype.pointToData = function (point) {
    var date = this.pointToDate(point);
    return date && date.time;
  };
  /**
   * Convert a time date item to (x, y) four point.
   */
  Calendar.prototype.dataToRect = function (data, clamp) {
    var point = this.dataToPoint(data, clamp);
    return {
      contentShape: {
        x: point[0] - (this._sw - this._lineWidth) / 2,
        y: point[1] - (this._sh - this._lineWidth) / 2,
        width: this._sw - this._lineWidth,
        height: this._sh - this._lineWidth
      },
      center: point,
      tl: [point[0] - this._sw / 2, point[1] - this._sh / 2],
      tr: [point[0] + this._sw / 2, point[1] - this._sh / 2],
      br: [point[0] + this._sw / 2, point[1] + this._sh / 2],
      bl: [point[0] - this._sw / 2, point[1] + this._sh / 2]
    };
  };
  /**
   * Convert a (x, y) point to time date
   *
   * @param  {Array} point point
   * @return {Object}       date
   */
  Calendar.prototype.pointToDate = function (point) {
    var nthX = Math.floor((point[0] - this._rect.x) / this._sw) + 1;
    var nthY = Math.floor((point[1] - this._rect.y) / this._sh) + 1;
    var range = this._rangeInfo.range;
    if (this._orient === 'vertical') {
      return this._getDateByWeeksAndDay(nthY, nthX - 1, range);
    }
    return this._getDateByWeeksAndDay(nthX, nthY - 1, range);
  };
  Calendar.prototype.convertToPixel = function (ecModel, finder, value) {
    var coordSys = getCoordSys(finder);
    return coordSys === this ? coordSys.dataToPoint(value) : null;
  };
  Calendar.prototype.convertFromPixel = function (ecModel, finder, pixel) {
    var coordSys = getCoordSys(finder);
    return coordSys === this ? coordSys.pointToData(pixel) : null;
  };
  Calendar.prototype.containPoint = function (point) {
    console.warn('Not implemented.');
    return false;
  };
  /**
   * initRange
   * Normalize to an [start, end] array
   */
  Calendar.prototype._initRangeOption = function () {
    var range = this._model.get('range');
    var normalizedRange;
    // Convert [1990] to 1990
    if (isArray$1(range) && range.length === 1) {
      range = range[0];
    }
    if (!isArray$1(range)) {
      var rangeStr = range.toString();
      // One year.
      if (/^\d{4}$/.test(rangeStr)) {
        normalizedRange = [rangeStr + '-01-01', rangeStr + '-12-31'];
      }
      // One month
      if (/^\d{4}[\/|-]\d{1,2}$/.test(rangeStr)) {
        var start = this.getDateInfo(rangeStr);
        var firstDay = start.date;
        firstDay.setMonth(firstDay.getMonth() + 1);
        var end = this.getNextNDay(firstDay, -1);
        normalizedRange = [start.formatedDate, end.formatedDate];
      }
      // One day
      if (/^\d{4}[\/|-]\d{1,2}[\/|-]\d{1,2}$/.test(rangeStr)) {
        normalizedRange = [rangeStr, rangeStr];
      }
    } else {
      normalizedRange = range;
    }
    if (!normalizedRange) {
      {
        logError('Invalid date range.');
      }
      // Not handling it.
      return range;
    }
    var tmp = this._getRangeInfo(normalizedRange);
    if (tmp.start.time > tmp.end.time) {
      normalizedRange.reverse();
    }
    return normalizedRange;
  };
  /**
   * range info
   *
   * @private
   * @param  {Array} range range ['2017-01-01', '2017-07-08']
   *  If range[0] > range[1], they will not be reversed.
   * @return {Object}       obj
   */
  Calendar.prototype._getRangeInfo = function (range) {
    var parsedRange = [this.getDateInfo(range[0]), this.getDateInfo(range[1])];
    var reversed;
    if (parsedRange[0].time > parsedRange[1].time) {
      reversed = true;
      parsedRange.reverse();
    }
    var allDay = Math.floor(parsedRange[1].time / PROXIMATE_ONE_DAY) - Math.floor(parsedRange[0].time / PROXIMATE_ONE_DAY) + 1;
    // Consider case1 (#11677 #10430):
    // Set the system timezone as "UK", set the range to `['2016-07-01', '2016-12-31']`
    // Consider case2:
    // Firstly set system timezone as "Time Zone: America/Toronto",
    // ```
    // let first = new Date(1478412000000 - 3600 * 1000 * 2.5);
    // let second = new Date(1478412000000);
    // let allDays = Math.floor(second / ONE_DAY) - Math.floor(first / ONE_DAY) + 1;
    // ```
    // will get wrong result because of DST. So we should fix it.
    var date = new Date(parsedRange[0].time);
    var startDateNum = date.getDate();
    var endDateNum = parsedRange[1].date.getDate();
    date.setDate(startDateNum + allDay - 1);
    // The bias can not over a month, so just compare date.
    var dateNum = date.getDate();
    if (dateNum !== endDateNum) {
      var sign = date.getTime() - parsedRange[1].time > 0 ? 1 : -1;
      while ((dateNum = date.getDate()) !== endDateNum && (date.getTime() - parsedRange[1].time) * sign > 0) {
        allDay -= sign;
        date.setDate(dateNum - sign);
      }
    }
    var weeks = Math.floor((allDay + parsedRange[0].day + 6) / 7);
    var nthWeek = reversed ? -weeks + 1 : weeks - 1;
    reversed && parsedRange.reverse();
    return {
      range: [parsedRange[0].formatedDate, parsedRange[1].formatedDate],
      start: parsedRange[0],
      end: parsedRange[1],
      allDay: allDay,
      weeks: weeks,
      // From 0.
      nthWeek: nthWeek,
      fweek: parsedRange[0].day,
      lweek: parsedRange[1].day
    };
  };
  /**
   * get date by nthWeeks and week day in range
   *
   * @private
   * @param  {number} nthWeek the week
   * @param  {number} day   the week day
   * @param  {Array} range [d1, d2]
   * @return {Object}
   */
  Calendar.prototype._getDateByWeeksAndDay = function (nthWeek, day, range) {
    var rangeInfo = this._getRangeInfo(range);
    if (nthWeek > rangeInfo.weeks || nthWeek === 0 && day < rangeInfo.fweek || nthWeek === rangeInfo.weeks && day > rangeInfo.lweek) {
      return null;
    }
    var nthDay = (nthWeek - 1) * 7 - rangeInfo.fweek + day;
    var date = new Date(rangeInfo.start.time);
    date.setDate(+rangeInfo.start.d + nthDay);
    return this.getDateInfo(date);
  };
  Calendar.create = function (ecModel, api) {
    var calendarList = [];
    ecModel.eachComponent('calendar', function (calendarModel) {
      var calendar = new Calendar(calendarModel);
      calendarList.push(calendar);
      calendarModel.coordinateSystem = calendar;
    });
    ecModel.eachSeries(function (calendarSeries) {
      if (calendarSeries.get('coordinateSystem') === 'calendar') {
        // Inject coordinate system
        calendarSeries.coordinateSystem = calendarList[calendarSeries.get('calendarIndex') || 0];
      }
    });
    return calendarList;
  };
  Calendar.dimensions = ['time', 'value'];
  return Calendar;
}();
function getCoordSys(finder) {
  var calendarModel = finder.calendarModel;
  var seriesModel = finder.seriesModel;
  var coordSys = calendarModel ? calendarModel.coordinateSystem : seriesModel ? seriesModel.coordinateSystem : null;
  return coordSys;
}
var Calendar$1 = Calendar;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$o(registers) {
  registers.registerComponentModel(CalendarModel$1);
  registers.registerComponentView(CalendarView$1);
  registers.registerCoordinateSystem('calendar', Calendar$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function setKeyInfoToNewElOption(resultItem, newElOption) {
  var existElOption = resultItem.existing;
  // Set id and type after id assigned.
  newElOption.id = resultItem.keyInfo.id;
  !newElOption.type && existElOption && (newElOption.type = existElOption.type);
  // Set parent id if not specified
  if (newElOption.parentId == null) {
    var newElParentOption = newElOption.parentOption;
    if (newElParentOption) {
      newElOption.parentId = newElParentOption.id;
    } else if (existElOption) {
      newElOption.parentId = existElOption.parentId;
    }
  }
  // Clear
  newElOption.parentOption = null;
}
function isSetLoc(obj, props) {
  var isSet;
  each$f(props, function (prop) {
    obj[prop] != null && obj[prop] !== 'auto' && (isSet = true);
  });
  return isSet;
}
function mergeNewElOptionToExist(existList, index, newElOption) {
  // Update existing options, for `getOption` feature.
  var newElOptCopy = extend({}, newElOption);
  var existElOption = existList[index];
  var $action = newElOption.$action || 'merge';
  if ($action === 'merge') {
    if (existElOption) {
      {
        var newType = newElOption.type;
        assert(!newType || existElOption.type === newType, 'Please set $action: "replace" to change `type`');
      }
      // We can ensure that newElOptCopy and existElOption are not
      // the same object, so `merge` will not change newElOptCopy.
      merge(existElOption, newElOptCopy, true);
      // Rigid body, use ignoreSize.
      mergeLayoutParam(existElOption, newElOptCopy, {
        ignoreSize: true
      });
      // Will be used in render.
      copyLayoutParams(newElOption, existElOption);
      // Copy transition info to new option so it can be used in the transition.
      // DO IT AFTER merge
      copyTransitionInfo(newElOption, existElOption);
      copyTransitionInfo(newElOption, existElOption, 'shape');
      copyTransitionInfo(newElOption, existElOption, 'style');
      copyTransitionInfo(newElOption, existElOption, 'extra');
      // Copy clipPath
      newElOption.clipPath = existElOption.clipPath;
    } else {
      existList[index] = newElOptCopy;
    }
  } else if ($action === 'replace') {
    existList[index] = newElOptCopy;
  } else if ($action === 'remove') {
    // null will be cleaned later.
    existElOption && (existList[index] = null);
  }
}
var TRANSITION_PROPS_TO_COPY = ['transition', 'enterFrom', 'leaveTo'];
var ROOT_TRANSITION_PROPS_TO_COPY = TRANSITION_PROPS_TO_COPY.concat(['enterAnimation', 'updateAnimation', 'leaveAnimation']);
function copyTransitionInfo(target, source, targetProp) {
  if (targetProp) {
    if (!target[targetProp] && source[targetProp]) {
      // TODO avoid creating this empty object when there is no transition configuration.
      target[targetProp] = {};
    }
    target = target[targetProp];
    source = source[targetProp];
  }
  if (!target || !source) {
    return;
  }
  var props = targetProp ? TRANSITION_PROPS_TO_COPY : ROOT_TRANSITION_PROPS_TO_COPY;
  for (var i = 0; i < props.length; i++) {
    var prop = props[i];
    if (target[prop] == null && source[prop] != null) {
      target[prop] = source[prop];
    }
  }
}
function setLayoutInfoToExist(existItem, newElOption) {
  if (!existItem) {
    return;
  }
  existItem.hv = newElOption.hv = [
  // Rigid body, don't care about `width`.
  isSetLoc(newElOption, ['left', 'right']),
  // Rigid body, don't care about `height`.
  isSetLoc(newElOption, ['top', 'bottom'])];
  // Give default group size. Otherwise layout error may occur.
  if (existItem.type === 'group') {
    var existingGroupOpt = existItem;
    var newGroupOpt = newElOption;
    existingGroupOpt.width == null && (existingGroupOpt.width = newGroupOpt.width = 0);
    existingGroupOpt.height == null && (existingGroupOpt.height = newGroupOpt.height = 0);
  }
}
var GraphicComponentModel = /** @class */function (_super) {
  __extends(GraphicComponentModel, _super);
  function GraphicComponentModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = GraphicComponentModel.type;
    _this.preventAutoZ = true;
    return _this;
  }
  GraphicComponentModel.prototype.mergeOption = function (option, ecModel) {
    // Prevent default merge to elements
    var elements = this.option.elements;
    this.option.elements = null;
    _super.prototype.mergeOption.call(this, option, ecModel);
    this.option.elements = elements;
  };
  GraphicComponentModel.prototype.optionUpdated = function (newOption, isInit) {
    var thisOption = this.option;
    var newList = (isInit ? thisOption : newOption).elements;
    var existList = thisOption.elements = isInit ? [] : thisOption.elements;
    var flattenedList = [];
    this._flatten(newList, flattenedList, null);
    var mappingResult = mappingToExists(existList, flattenedList, 'normalMerge');
    // Clear elOptionsToUpdate
    var elOptionsToUpdate = this._elOptionsToUpdate = [];
    each$f(mappingResult, function (resultItem, index) {
      var newElOption = resultItem.newOption;
      {
        assert(isObject$3(newElOption) || resultItem.existing, 'Empty graphic option definition');
      }
      if (!newElOption) {
        return;
      }
      elOptionsToUpdate.push(newElOption);
      setKeyInfoToNewElOption(resultItem, newElOption);
      mergeNewElOptionToExist(existList, index, newElOption);
      setLayoutInfoToExist(existList[index], newElOption);
    }, this);
    // Clean
    thisOption.elements = filter(existList, function (item) {
      // $action should be volatile, otherwise option gotten from
      // `getOption` will contain unexpected $action.
      item && delete item.$action;
      return item != null;
    });
  };
  /**
   * Convert
   * [{
   *  type: 'group',
   *  id: 'xx',
   *  children: [{type: 'circle'}, {type: 'polygon'}]
   * }]
   * to
   * [
   *  {type: 'group', id: 'xx'},
   *  {type: 'circle', parentId: 'xx'},
   *  {type: 'polygon', parentId: 'xx'}
   * ]
   */
  GraphicComponentModel.prototype._flatten = function (optionList, result, parentOption) {
    each$f(optionList, function (option) {
      if (!option) {
        return;
      }
      if (parentOption) {
        option.parentOption = parentOption;
      }
      result.push(option);
      var children = option.children;
      // here we don't judge if option.type is `group`
      // when new option doesn't provide `type`, it will cause that the children can't be updated.
      if (children && children.length) {
        this._flatten(children, result, option);
      }
      // Deleting for JSON output, and for not affecting group creation.
      delete option.children;
    }, this);
  };
  // FIXME
  // Pass to view using payload? setOption has a payload?
  GraphicComponentModel.prototype.useElOptionsToUpdate = function () {
    var els = this._elOptionsToUpdate;
    // Clear to avoid render duplicately when zooming.
    this._elOptionsToUpdate = null;
    return els;
  };
  GraphicComponentModel.type = 'graphic';
  GraphicComponentModel.defaultOption = {
    elements: []
    // parentId: null
  };
  return GraphicComponentModel;
}(ComponentModel$1);

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var nonShapeGraphicElements = {
  // Reserved but not supported in graphic component.
  path: null,
  compoundPath: null,
  // Supported in graphic component.
  group: Group$5,
  image: ZRImage$1,
  text: ZRText$1
};
var inner$7 = makeInner();
// ------------------------
// View
// ------------------------
var GraphicComponentView = /** @class */function (_super) {
  __extends(GraphicComponentView, _super);
  function GraphicComponentView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = GraphicComponentView.type;
    return _this;
  }
  GraphicComponentView.prototype.init = function () {
    this._elMap = createHashMap();
  };
  GraphicComponentView.prototype.render = function (graphicModel, ecModel, api) {
    // Having leveraged between use cases and algorithm complexity, a very
    // simple layout mechanism is used:
    // The size(width/height) can be determined by itself or its parent (not
    // implemented yet), but can not by its children. (Top-down travel)
    // The location(x/y) can be determined by the bounding rect of itself
    // (can including its descendants or not) and the size of its parent.
    // (Bottom-up travel)
    // When `chart.clear()` or `chart.setOption({...}, true)` with the same id,
    // view will be reused.
    if (graphicModel !== this._lastGraphicModel) {
      this._clear();
    }
    this._lastGraphicModel = graphicModel;
    this._updateElements(graphicModel);
    this._relocate(graphicModel, api);
  };
  /**
   * Update graphic elements.
   */
  GraphicComponentView.prototype._updateElements = function (graphicModel) {
    var elOptionsToUpdate = graphicModel.useElOptionsToUpdate();
    if (!elOptionsToUpdate) {
      return;
    }
    var elMap = this._elMap;
    var rootGroup = this.group;
    var globalZ = graphicModel.get('z');
    var globalZLevel = graphicModel.get('zlevel');
    // Top-down tranverse to assign graphic settings to each elements.
    each$f(elOptionsToUpdate, function (elOption) {
      var id = convertOptionIdName(elOption.id, null);
      var elExisting = id != null ? elMap.get(id) : null;
      var parentId = convertOptionIdName(elOption.parentId, null);
      var targetElParent = parentId != null ? elMap.get(parentId) : rootGroup;
      var elType = elOption.type;
      var elOptionStyle = elOption.style;
      if (elType === 'text' && elOptionStyle) {
        // In top/bottom mode, textVerticalAlign should not be used, which cause
        // inaccurately locating.
        if (elOption.hv && elOption.hv[1]) {
          elOptionStyle.textVerticalAlign = elOptionStyle.textBaseline = elOptionStyle.verticalAlign = elOptionStyle.align = null;
        }
      }
      var textContentOption = elOption.textContent;
      var textConfig = elOption.textConfig;
      if (elOptionStyle && isEC4CompatibleStyle(elOptionStyle, elType, !!textConfig, !!textContentOption)) {
        var convertResult = convertFromEC4CompatibleStyle(elOptionStyle, elType, true);
        if (!textConfig && convertResult.textConfig) {
          textConfig = elOption.textConfig = convertResult.textConfig;
        }
        if (!textContentOption && convertResult.textContent) {
          textContentOption = convertResult.textContent;
        }
      }
      // Remove unnecessary props to avoid potential problems.
      var elOptionCleaned = getCleanedElOption(elOption);
      // For simple, do not support parent change, otherwise reorder is needed.
      {
        elExisting && assert(targetElParent === elExisting.parent, 'Changing parent is not supported.');
      }
      var $action = elOption.$action || 'merge';
      var isMerge = $action === 'merge';
      var isReplace = $action === 'replace';
      if (isMerge) {
        var isInit = !elExisting;
        var el_1 = elExisting;
        if (isInit) {
          el_1 = createEl(id, targetElParent, elOption.type, elMap);
        } else {
          el_1 && (inner$7(el_1).isNew = false);
          // Stop and restore before update any other attributes.
          stopPreviousKeyframeAnimationAndRestore(el_1);
        }
        if (el_1) {
          applyUpdateTransition(el_1, elOptionCleaned, graphicModel, {
            isInit: isInit
          });
          updateCommonAttrs(el_1, elOption, globalZ, globalZLevel);
        }
      } else if (isReplace) {
        removeEl$1(elExisting, elOption, elMap, graphicModel);
        var el_2 = createEl(id, targetElParent, elOption.type, elMap);
        if (el_2) {
          applyUpdateTransition(el_2, elOptionCleaned, graphicModel, {
            isInit: true
          });
          updateCommonAttrs(el_2, elOption, globalZ, globalZLevel);
        }
      } else if ($action === 'remove') {
        updateLeaveTo(elExisting, elOption);
        removeEl$1(elExisting, elOption, elMap, graphicModel);
      }
      var el = elMap.get(id);
      if (el && textContentOption) {
        if (isMerge) {
          var textContentExisting = el.getTextContent();
          textContentExisting ? textContentExisting.attr(textContentOption) : el.setTextContent(new ZRText$1(textContentOption));
        } else if (isReplace) {
          el.setTextContent(new ZRText$1(textContentOption));
        }
      }
      if (el) {
        var clipPathOption = elOption.clipPath;
        if (clipPathOption) {
          var clipPathType = clipPathOption.type;
          var clipPath = void 0;
          var isInit = false;
          if (isMerge) {
            var oldClipPath = el.getClipPath();
            isInit = !oldClipPath || inner$7(oldClipPath).type !== clipPathType;
            clipPath = isInit ? newEl(clipPathType) : oldClipPath;
          } else if (isReplace) {
            isInit = true;
            clipPath = newEl(clipPathType);
          }
          el.setClipPath(clipPath);
          applyUpdateTransition(clipPath, clipPathOption, graphicModel, {
            isInit: isInit
          });
          applyKeyframeAnimation(clipPath, clipPathOption.keyframeAnimation, graphicModel);
        }
        var elInner = inner$7(el);
        el.setTextConfig(textConfig);
        elInner.option = elOption;
        setEventData(el, graphicModel, elOption);
        setTooltipConfig({
          el: el,
          componentModel: graphicModel,
          itemName: el.name,
          itemTooltipOption: elOption.tooltip
        });
        applyKeyframeAnimation(el, elOption.keyframeAnimation, graphicModel);
      }
    });
  };
  /**
   * Locate graphic elements.
   */
  GraphicComponentView.prototype._relocate = function (graphicModel, api) {
    var elOptions = graphicModel.option.elements;
    var rootGroup = this.group;
    var elMap = this._elMap;
    var apiWidth = api.getWidth();
    var apiHeight = api.getHeight();
    var xy = ['x', 'y'];
    // Top-down to calculate percentage width/height of group
    for (var i = 0; i < elOptions.length; i++) {
      var elOption = elOptions[i];
      var id = convertOptionIdName(elOption.id, null);
      var el = id != null ? elMap.get(id) : null;
      if (!el || !el.isGroup) {
        continue;
      }
      var parentEl = el.parent;
      var isParentRoot = parentEl === rootGroup;
      // Like 'position:absolut' in css, default 0.
      var elInner = inner$7(el);
      var parentElInner = inner$7(parentEl);
      elInner.width = parsePercent(elInner.option.width, isParentRoot ? apiWidth : parentElInner.width) || 0;
      elInner.height = parsePercent(elInner.option.height, isParentRoot ? apiHeight : parentElInner.height) || 0;
    }
    // Bottom-up tranvese all elements (consider ec resize) to locate elements.
    for (var i = elOptions.length - 1; i >= 0; i--) {
      var elOption = elOptions[i];
      var id = convertOptionIdName(elOption.id, null);
      var el = id != null ? elMap.get(id) : null;
      if (!el) {
        continue;
      }
      var parentEl = el.parent;
      var parentElInner = inner$7(parentEl);
      var containerInfo = parentEl === rootGroup ? {
        width: apiWidth,
        height: apiHeight
      } : {
        width: parentElInner.width,
        height: parentElInner.height
      };
      // PENDING
      // Currently, when `bounding: 'all'`, the union bounding rect of the group
      // does not include the rect of [0, 0, group.width, group.height], which
      // is probably weird for users. Should we make a break change for it?
      var layoutPos = {};
      var layouted = positionElement(el, elOption, containerInfo, null, {
        hv: elOption.hv,
        boundingMode: elOption.bounding
      }, layoutPos);
      if (!inner$7(el).isNew && layouted) {
        var transition = elOption.transition;
        var animatePos = {};
        for (var k = 0; k < xy.length; k++) {
          var key = xy[k];
          var val = layoutPos[key];
          if (transition && (isTransitionAll(transition) || indexOf(transition, key) >= 0)) {
            animatePos[key] = val;
          } else {
            el[key] = val;
          }
        }
        updateProps$1(el, animatePos, graphicModel, 0);
      } else {
        el.attr(layoutPos);
      }
    }
  };
  /**
   * Clear all elements.
   */
  GraphicComponentView.prototype._clear = function () {
    var _this = this;
    var elMap = this._elMap;
    elMap.each(function (el) {
      removeEl$1(el, inner$7(el).option, elMap, _this._lastGraphicModel);
    });
    this._elMap = createHashMap();
  };
  GraphicComponentView.prototype.dispose = function () {
    this._clear();
  };
  GraphicComponentView.type = 'graphic';
  return GraphicComponentView;
}(ComponentView$1);
function newEl(graphicType) {
  {
    assert(graphicType, 'graphic type MUST be set');
  }
  var Clz = hasOwn(nonShapeGraphicElements, graphicType)
  // Those graphic elements are not shapes. They should not be
  // overwritten by users, so do them first.
  ? nonShapeGraphicElements[graphicType] : getShapeClass(graphicType);
  {
    assert(Clz, "graphic type " + graphicType + " can not be found");
  }
  var el = new Clz({});
  inner$7(el).type = graphicType;
  return el;
}
function createEl(id, targetElParent, graphicType, elMap) {
  var el = newEl(graphicType);
  targetElParent.add(el);
  elMap.set(id, el);
  inner$7(el).id = id;
  inner$7(el).isNew = true;
  return el;
}
function removeEl$1(elExisting, elOption, elMap, graphicModel) {
  var existElParent = elExisting && elExisting.parent;
  if (existElParent) {
    elExisting.type === 'group' && elExisting.traverse(function (el) {
      removeEl$1(el, elOption, elMap, graphicModel);
    });
    applyLeaveTransition(elExisting, elOption, graphicModel);
    elMap.removeKey(inner$7(elExisting).id);
  }
}
function updateCommonAttrs(el, elOption, defaultZ, defaultZlevel) {
  if (!el.isGroup) {
    each$f([['cursor', Displayable$1.prototype.cursor],
    // We should not support configure z and zlevel in the element level.
    // But seems we didn't limit it previously. So here still use it to avoid breaking.
    ['zlevel', defaultZlevel || 0], ['z', defaultZ || 0],
    // z2 must not be null/undefined, otherwise sort error may occur.
    ['z2', 0]], function (item) {
      var prop = item[0];
      if (hasOwn(elOption, prop)) {
        el[prop] = retrieve2(elOption[prop], item[1]);
      } else if (el[prop] == null) {
        el[prop] = item[1];
      }
    });
  }
  each$f(keys(elOption), function (key) {
    // Assign event handlers.
    // PENDING: should enumerate all event names or use pattern matching?
    if (key.indexOf('on') === 0) {
      var val = elOption[key];
      el[key] = isFunction(val) ? val : null;
    }
  });
  if (hasOwn(elOption, 'draggable')) {
    el.draggable = elOption.draggable;
  }
  // Other attributes
  elOption.name != null && (el.name = elOption.name);
  elOption.id != null && (el.id = elOption.id);
}
// Remove unnecessary props to avoid potential problems.
function getCleanedElOption(elOption) {
  elOption = extend({}, elOption);
  each$f(['id', 'parentId', '$action', 'hv', 'bounding', 'textContent', 'clipPath'].concat(LOCATION_PARAMS), function (name) {
    delete elOption[name];
  });
  return elOption;
}
function setEventData(el, graphicModel, elOption) {
  var eventData = getECData(el).eventData;
  // Simple optimize for large amount of elements that no need event.
  if (!el.silent && !el.ignore && !eventData) {
    eventData = getECData(el).eventData = {
      componentType: 'graphic',
      componentIndex: graphicModel.componentIndex,
      name: el.name
    };
  }
  // `elOption.info` enables user to mount some info on
  // elements and use them in event handlers.
  if (eventData) {
    eventData.info = elOption.info;
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$n(registers) {
  registers.registerComponentModel(GraphicComponentModel);
  registers.registerComponentView(GraphicComponentView);
  registers.registerPreprocessor(function (option) {
    var graphicOption = option.graphic;
    // Convert
    // {graphic: [{left: 10, type: 'circle'}, ...]}
    // or
    // {graphic: {left: 10, type: 'circle'}}
    // to
    // {graphic: [{elements: [{left: 10, type: 'circle'}, ...]}]}
    if (isArray$1(graphicOption)) {
      if (!graphicOption[0] || !graphicOption[0].elements) {
        option.graphic = [{
          elements: graphicOption
        }];
      } else {
        // Only one graphic instance can be instantiated. (We don't
        // want that too many views are created in echarts._viewMap.)
        option.graphic = [option.graphic[0]];
      }
    } else if (graphicOption && !graphicOption.elements) {
      option.graphic = [{
        elements: [graphicOption]
      }];
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DATA_ZOOM_AXIS_DIMENSIONS = ['x', 'y', 'radius', 'angle', 'single'];
// Supported coords.
// FIXME: polar has been broken (but rarely used).
var SERIES_COORDS = ['cartesian2d', 'polar', 'singleAxis'];
function isCoordSupported(seriesModel) {
  var coordType = seriesModel.get('coordinateSystem');
  return indexOf(SERIES_COORDS, coordType) >= 0;
}
function getAxisMainType(axisDim) {
  {
    assert(axisDim);
  }
  return axisDim + 'Axis';
}
/**
 * If two dataZoomModels has the same axis controlled, we say that they are 'linked'.
 * This function finds all linked dataZoomModels start from the given payload.
 */
function findEffectedDataZooms(ecModel, payload) {
  // Key: `DataZoomAxisDimension`
  var axisRecords = createHashMap();
  var effectedModels = [];
  // Key: uid of dataZoomModel
  var effectedModelMap = createHashMap();
  // Find the dataZooms specified by payload.
  ecModel.eachComponent({
    mainType: 'dataZoom',
    query: payload
  }, function (dataZoomModel) {
    if (!effectedModelMap.get(dataZoomModel.uid)) {
      addToEffected(dataZoomModel);
    }
  });
  // Start from the given dataZoomModels, travel the graph to find
  // all of the linked dataZoom models.
  var foundNewLink;
  do {
    foundNewLink = false;
    ecModel.eachComponent('dataZoom', processSingle);
  } while (foundNewLink);
  function processSingle(dataZoomModel) {
    if (!effectedModelMap.get(dataZoomModel.uid) && isLinked(dataZoomModel)) {
      addToEffected(dataZoomModel);
      foundNewLink = true;
    }
  }
  function addToEffected(dataZoom) {
    effectedModelMap.set(dataZoom.uid, true);
    effectedModels.push(dataZoom);
    markAxisControlled(dataZoom);
  }
  function isLinked(dataZoomModel) {
    var isLink = false;
    dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {
      var axisIdxArr = axisRecords.get(axisDim);
      if (axisIdxArr && axisIdxArr[axisIndex]) {
        isLink = true;
      }
    });
    return isLink;
  }
  function markAxisControlled(dataZoomModel) {
    dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {
      (axisRecords.get(axisDim) || axisRecords.set(axisDim, []))[axisIndex] = true;
    });
  }
  return effectedModels;
}
/**
 * Find the first target coordinate system.
 * Available after model built.
 *
 * @return Like {
 *                  grid: [
 *                      {model: coord0, axisModels: [axis1, axis3], coordIndex: 1},
 *                      {model: coord1, axisModels: [axis0, axis2], coordIndex: 0},
 *                      ...
 *                  ],  // cartesians must not be null/undefined.
 *                  polar: [
 *                      {model: coord0, axisModels: [axis4], coordIndex: 0},
 *                      ...
 *                  ],  // polars must not be null/undefined.
 *                  singleAxis: [
 *                      {model: coord0, axisModels: [], coordIndex: 0}
 *                  ]
 *              }
 */
function collectReferCoordSysModelInfo(dataZoomModel) {
  var ecModel = dataZoomModel.ecModel;
  var coordSysInfoWrap = {
    infoList: [],
    infoMap: createHashMap()
  };
  dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {
    var axisModel = ecModel.getComponent(getAxisMainType(axisDim), axisIndex);
    if (!axisModel) {
      return;
    }
    var coordSysModel = axisModel.getCoordSysModel();
    if (!coordSysModel) {
      return;
    }
    var coordSysUid = coordSysModel.uid;
    var coordSysInfo = coordSysInfoWrap.infoMap.get(coordSysUid);
    if (!coordSysInfo) {
      coordSysInfo = {
        model: coordSysModel,
        axisModels: []
      };
      coordSysInfoWrap.infoList.push(coordSysInfo);
      coordSysInfoWrap.infoMap.set(coordSysUid, coordSysInfo);
    }
    coordSysInfo.axisModels.push(axisModel);
  });
  return coordSysInfoWrap;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DataZoomAxisInfo = /** @class */function () {
  function DataZoomAxisInfo() {
    this.indexList = [];
    this.indexMap = [];
  }
  DataZoomAxisInfo.prototype.add = function (axisCmptIdx) {
    // Remove duplication.
    if (!this.indexMap[axisCmptIdx]) {
      this.indexList.push(axisCmptIdx);
      this.indexMap[axisCmptIdx] = true;
    }
  };
  return DataZoomAxisInfo;
}();
var DataZoomModel = /** @class */function (_super) {
  __extends(DataZoomModel, _super);
  function DataZoomModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = DataZoomModel.type;
    _this._autoThrottle = true;
    _this._noTarget = true;
    /**
     * It is `[rangeModeForMin, rangeModeForMax]`.
     * The optional values for `rangeMode`:
     * + `'value'` mode: the axis extent will always be determined by
     *     `dataZoom.startValue` and `dataZoom.endValue`, despite
     *     how data like and how `axis.min` and `axis.max` are.
     * + `'percent'` mode: `100` represents 100% of the `[dMin, dMax]`,
     *     where `dMin` is `axis.min` if `axis.min` specified, otherwise `data.extent[0]`,
     *     and `dMax` is `axis.max` if `axis.max` specified, otherwise `data.extent[1]`.
     *     Axis extent will be determined by the result of the percent of `[dMin, dMax]`.
     *
     * For example, when users are using dynamic data (update data periodically via `setOption`),
     * if in `'value`' mode, the window will be kept in a fixed value range despite how
     * data are appended, while if in `'percent'` mode, whe window range will be changed alone with
     * the appended data (suppose `axis.min` and `axis.max` are not specified).
     */
    _this._rangePropMode = ['percent', 'percent'];
    return _this;
  }
  DataZoomModel.prototype.init = function (option, parentModel, ecModel) {
    var inputRawOption = retrieveRawOption(option);
    /**
     * Suppose a "main process" start at the point that model prepared (that is,
     * model initialized or merged or method called in `action`).
     * We should keep the `main process` idempotent, that is, given a set of values
     * on `option`, we get the same result.
     *
     * But sometimes, values on `option` will be updated for providing users
     * a "final calculated value" (`dataZoomProcessor` will do that). Those value
     * should not be the base/input of the `main process`.
     *
     * So in that case we should save and keep the input of the `main process`
     * separately, called `settledOption`.
     *
     * For example, consider the case:
     * (Step_1) brush zoom the grid by `toolbox.dataZoom`,
     *     where the original input `option.startValue`, `option.endValue` are earsed by
     *     calculated value.
     * (Step)2) click the legend to hide and show a series,
     *     where the new range is calculated by the earsed `startValue` and `endValue`,
     *     which brings incorrect result.
     */
    this.settledOption = inputRawOption;
    this.mergeDefaultAndTheme(option, ecModel);
    this._doInit(inputRawOption);
  };
  DataZoomModel.prototype.mergeOption = function (newOption) {
    var inputRawOption = retrieveRawOption(newOption);
    // FIX #2591
    merge(this.option, newOption, true);
    merge(this.settledOption, inputRawOption, true);
    this._doInit(inputRawOption);
  };
  DataZoomModel.prototype._doInit = function (inputRawOption) {
    var thisOption = this.option;
    this._setDefaultThrottle(inputRawOption);
    this._updateRangeUse(inputRawOption);
    var settledOption = this.settledOption;
    each$f([['start', 'startValue'], ['end', 'endValue']], function (names, index) {
      // start/end has higher priority over startValue/endValue if they
      // both set, but we should make chart.setOption({endValue: 1000})
      // effective, rather than chart.setOption({endValue: 1000, end: null}).
      if (this._rangePropMode[index] === 'value') {
        thisOption[names[0]] = settledOption[names[0]] = null;
      }
      // Otherwise do nothing and use the merge result.
    }, this);
    this._resetTarget();
  };
  DataZoomModel.prototype._resetTarget = function () {
    var optionOrient = this.get('orient', true);
    var targetAxisIndexMap = this._targetAxisInfoMap = createHashMap();
    var hasAxisSpecified = this._fillSpecifiedTargetAxis(targetAxisIndexMap);
    if (hasAxisSpecified) {
      this._orient = optionOrient || this._makeAutoOrientByTargetAxis();
    } else {
      this._orient = optionOrient || 'horizontal';
      this._fillAutoTargetAxisByOrient(targetAxisIndexMap, this._orient);
    }
    this._noTarget = true;
    targetAxisIndexMap.each(function (axisInfo) {
      if (axisInfo.indexList.length) {
        this._noTarget = false;
      }
    }, this);
  };
  DataZoomModel.prototype._fillSpecifiedTargetAxis = function (targetAxisIndexMap) {
    var hasAxisSpecified = false;
    each$f(DATA_ZOOM_AXIS_DIMENSIONS, function (axisDim) {
      var refering = this.getReferringComponents(getAxisMainType(axisDim), MULTIPLE_REFERRING);
      // When user set axisIndex as a empty array, we think that user specify axisIndex
      // but do not want use auto mode. Because empty array may be encountered when
      // some error occurred.
      if (!refering.specified) {
        return;
      }
      hasAxisSpecified = true;
      var axisInfo = new DataZoomAxisInfo();
      each$f(refering.models, function (axisModel) {
        axisInfo.add(axisModel.componentIndex);
      });
      targetAxisIndexMap.set(axisDim, axisInfo);
    }, this);
    return hasAxisSpecified;
  };
  DataZoomModel.prototype._fillAutoTargetAxisByOrient = function (targetAxisIndexMap, orient) {
    var ecModel = this.ecModel;
    var needAuto = true;
    // Find axis that parallel to dataZoom as default.
    if (needAuto) {
      var axisDim = orient === 'vertical' ? 'y' : 'x';
      var axisModels = ecModel.findComponents({
        mainType: axisDim + 'Axis'
      });
      setParallelAxis(axisModels, axisDim);
    }
    // Find axis that parallel to dataZoom as default.
    if (needAuto) {
      var axisModels = ecModel.findComponents({
        mainType: 'singleAxis',
        filter: function (axisModel) {
          return axisModel.get('orient', true) === orient;
        }
      });
      setParallelAxis(axisModels, 'single');
    }
    function setParallelAxis(axisModels, axisDim) {
      // At least use the first parallel axis as the target axis.
      var axisModel = axisModels[0];
      if (!axisModel) {
        return;
      }
      var axisInfo = new DataZoomAxisInfo();
      axisInfo.add(axisModel.componentIndex);
      targetAxisIndexMap.set(axisDim, axisInfo);
      needAuto = false;
      // Find parallel axes in the same grid.
      if (axisDim === 'x' || axisDim === 'y') {
        var gridModel_1 = axisModel.getReferringComponents('grid', SINGLE_REFERRING).models[0];
        gridModel_1 && each$f(axisModels, function (axModel) {
          if (axisModel.componentIndex !== axModel.componentIndex && gridModel_1 === axModel.getReferringComponents('grid', SINGLE_REFERRING).models[0]) {
            axisInfo.add(axModel.componentIndex);
          }
        });
      }
    }
    if (needAuto) {
      // If no parallel axis, find the first category axis as default. (Also consider polar).
      each$f(DATA_ZOOM_AXIS_DIMENSIONS, function (axisDim) {
        if (!needAuto) {
          return;
        }
        var axisModels = ecModel.findComponents({
          mainType: getAxisMainType(axisDim),
          filter: function (axisModel) {
            return axisModel.get('type', true) === 'category';
          }
        });
        if (axisModels[0]) {
          var axisInfo = new DataZoomAxisInfo();
          axisInfo.add(axisModels[0].componentIndex);
          targetAxisIndexMap.set(axisDim, axisInfo);
          needAuto = false;
        }
      }, this);
    }
  };
  DataZoomModel.prototype._makeAutoOrientByTargetAxis = function () {
    var dim;
    // Find the first axis
    this.eachTargetAxis(function (axisDim) {
      !dim && (dim = axisDim);
    }, this);
    return dim === 'y' ? 'vertical' : 'horizontal';
  };
  DataZoomModel.prototype._setDefaultThrottle = function (inputRawOption) {
    // When first time user set throttle, auto throttle ends.
    if (inputRawOption.hasOwnProperty('throttle')) {
      this._autoThrottle = false;
    }
    if (this._autoThrottle) {
      var globalOption = this.ecModel.option;
      this.option.throttle = globalOption.animation && globalOption.animationDurationUpdate > 0 ? 100 : 20;
    }
  };
  DataZoomModel.prototype._updateRangeUse = function (inputRawOption) {
    var rangePropMode = this._rangePropMode;
    var rangeModeInOption = this.get('rangeMode');
    each$f([['start', 'startValue'], ['end', 'endValue']], function (names, index) {
      var percentSpecified = inputRawOption[names[0]] != null;
      var valueSpecified = inputRawOption[names[1]] != null;
      if (percentSpecified && !valueSpecified) {
        rangePropMode[index] = 'percent';
      } else if (!percentSpecified && valueSpecified) {
        rangePropMode[index] = 'value';
      } else if (rangeModeInOption) {
        rangePropMode[index] = rangeModeInOption[index];
      } else if (percentSpecified) {
        // percentSpecified && valueSpecified
        rangePropMode[index] = 'percent';
      }
      // else remain its original setting.
    });
  };
  DataZoomModel.prototype.noTarget = function () {
    return this._noTarget;
  };
  DataZoomModel.prototype.getFirstTargetAxisModel = function () {
    var firstAxisModel;
    this.eachTargetAxis(function (axisDim, axisIndex) {
      if (firstAxisModel == null) {
        firstAxisModel = this.ecModel.getComponent(getAxisMainType(axisDim), axisIndex);
      }
    }, this);
    return firstAxisModel;
  };
  /**
   * @param {Function} callback param: axisModel, dimNames, axisIndex, dataZoomModel, ecModel
   */
  DataZoomModel.prototype.eachTargetAxis = function (callback, context) {
    this._targetAxisInfoMap.each(function (axisInfo, axisDim) {
      each$f(axisInfo.indexList, function (axisIndex) {
        callback.call(context, axisDim, axisIndex);
      });
    });
  };
  /**
   * @return If not found, return null/undefined.
   */
  DataZoomModel.prototype.getAxisProxy = function (axisDim, axisIndex) {
    var axisModel = this.getAxisModel(axisDim, axisIndex);
    if (axisModel) {
      return axisModel.__dzAxisProxy;
    }
  };
  /**
   * @return If not found, return null/undefined.
   */
  DataZoomModel.prototype.getAxisModel = function (axisDim, axisIndex) {
    {
      assert(axisDim && axisIndex != null);
    }
    var axisInfo = this._targetAxisInfoMap.get(axisDim);
    if (axisInfo && axisInfo.indexMap[axisIndex]) {
      return this.ecModel.getComponent(getAxisMainType(axisDim), axisIndex);
    }
  };
  /**
   * If not specified, set to undefined.
   */
  DataZoomModel.prototype.setRawRange = function (opt) {
    var thisOption = this.option;
    var settledOption = this.settledOption;
    each$f([['start', 'startValue'], ['end', 'endValue']], function (names) {
      // Consider the pair <start, startValue>:
      // If one has value and the other one is `null/undefined`, we both set them
      // to `settledOption`. This strategy enables the feature to clear the original
      // value in `settledOption` to `null/undefined`.
      // But if both of them are `null/undefined`, we do not set them to `settledOption`
      // and keep `settledOption` with the original value. This strategy enables users to
      // only set <end or endValue> but not set <start or startValue> when calling
      // `dispatchAction`.
      // The pair <end, endValue> is treated in the same way.
      if (opt[names[0]] != null || opt[names[1]] != null) {
        thisOption[names[0]] = settledOption[names[0]] = opt[names[0]];
        thisOption[names[1]] = settledOption[names[1]] = opt[names[1]];
      }
    }, this);
    this._updateRangeUse(opt);
  };
  DataZoomModel.prototype.setCalculatedRange = function (opt) {
    var option = this.option;
    each$f(['start', 'startValue', 'end', 'endValue'], function (name) {
      option[name] = opt[name];
    });
  };
  DataZoomModel.prototype.getPercentRange = function () {
    var axisProxy = this.findRepresentativeAxisProxy();
    if (axisProxy) {
      return axisProxy.getDataPercentWindow();
    }
  };
  /**
   * For example, chart.getModel().getComponent('dataZoom').getValueRange('y', 0);
   *
   * @return [startValue, endValue] value can only be '-' or finite number.
   */
  DataZoomModel.prototype.getValueRange = function (axisDim, axisIndex) {
    if (axisDim == null && axisIndex == null) {
      var axisProxy = this.findRepresentativeAxisProxy();
      if (axisProxy) {
        return axisProxy.getDataValueWindow();
      }
    } else {
      return this.getAxisProxy(axisDim, axisIndex).getDataValueWindow();
    }
  };
  /**
   * @param axisModel If axisModel given, find axisProxy
   *      corresponding to the axisModel
   */
  DataZoomModel.prototype.findRepresentativeAxisProxy = function (axisModel) {
    if (axisModel) {
      return axisModel.__dzAxisProxy;
    }
    // Find the first hosted axisProxy
    var firstProxy;
    var axisDimList = this._targetAxisInfoMap.keys();
    for (var i = 0; i < axisDimList.length; i++) {
      var axisDim = axisDimList[i];
      var axisInfo = this._targetAxisInfoMap.get(axisDim);
      for (var j = 0; j < axisInfo.indexList.length; j++) {
        var proxy = this.getAxisProxy(axisDim, axisInfo.indexList[j]);
        if (proxy.hostedBy(this)) {
          return proxy;
        }
        if (!firstProxy) {
          firstProxy = proxy;
        }
      }
    }
    // If no hosted proxy found, still need to return a proxy.
    // This case always happens in toolbox dataZoom, where axes are all hosted by
    // other dataZooms.
    return firstProxy;
  };
  DataZoomModel.prototype.getRangePropMode = function () {
    return this._rangePropMode.slice();
  };
  DataZoomModel.prototype.getOrient = function () {
    {
      // Should not be called before initialized.
      assert(this._orient);
    }
    return this._orient;
  };
  DataZoomModel.type = 'dataZoom';
  DataZoomModel.dependencies = ['xAxis', 'yAxis', 'radiusAxis', 'angleAxis', 'singleAxis', 'series', 'toolbox'];
  DataZoomModel.defaultOption = {
    // zlevel: 0,
    z: 4,
    filterMode: 'filter',
    start: 0,
    end: 100
  };
  return DataZoomModel;
}(ComponentModel$1);
/**
 * Retrieve those raw params from option, which will be cached separately,
 * because they will be overwritten by normalized/calculated values in the main
 * process.
 */
function retrieveRawOption(option) {
  var ret = {};
  each$f(['start', 'end', 'startValue', 'endValue', 'throttle'], function (name) {
    option.hasOwnProperty(name) && (ret[name] = option[name]);
  });
  return ret;
}
var DataZoomModel$1 = DataZoomModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SelectDataZoomModel = /** @class */function (_super) {
  __extends(SelectDataZoomModel, _super);
  function SelectDataZoomModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SelectDataZoomModel.type;
    return _this;
  }
  SelectDataZoomModel.type = 'dataZoom.select';
  return SelectDataZoomModel;
}(DataZoomModel$1);
var SelectZoomModel = SelectDataZoomModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DataZoomView = /** @class */function (_super) {
  __extends(DataZoomView, _super);
  function DataZoomView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = DataZoomView.type;
    return _this;
  }
  DataZoomView.prototype.render = function (dataZoomModel, ecModel, api, payload) {
    this.dataZoomModel = dataZoomModel;
    this.ecModel = ecModel;
    this.api = api;
  };
  DataZoomView.type = 'dataZoom';
  return DataZoomView;
}(ComponentView$1);
var DataZoomView$1 = DataZoomView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SelectDataZoomView = /** @class */function (_super) {
  __extends(SelectDataZoomView, _super);
  function SelectDataZoomView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SelectDataZoomView.type;
    return _this;
  }
  SelectDataZoomView.type = 'dataZoom.select';
  return SelectDataZoomView;
}(DataZoomView$1);
var SelectZoomView = SelectDataZoomView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each$7 = each$f;
var asc$1 = asc$2;
/**
 * Operate single axis.
 * One axis can only operated by one axis operator.
 * Different dataZoomModels may be defined to operate the same axis.
 * (i.e. 'inside' data zoom and 'slider' data zoom components)
 * So dataZoomModels share one axisProxy in that case.
 */
var AxisProxy = /** @class */function () {
  function AxisProxy(dimName, axisIndex, dataZoomModel, ecModel) {
    this._dimName = dimName;
    this._axisIndex = axisIndex;
    this.ecModel = ecModel;
    this._dataZoomModel = dataZoomModel;
    // /**
    //  * @readOnly
    //  * @private
    //  */
    // this.hasSeriesStacked;
  }
  /**
   * Whether the axisProxy is hosted by dataZoomModel.
   */
  AxisProxy.prototype.hostedBy = function (dataZoomModel) {
    return this._dataZoomModel === dataZoomModel;
  };
  /**
   * @return Value can only be NaN or finite value.
   */
  AxisProxy.prototype.getDataValueWindow = function () {
    return this._valueWindow.slice();
  };
  /**
   * @return {Array.<number>}
   */
  AxisProxy.prototype.getDataPercentWindow = function () {
    return this._percentWindow.slice();
  };
  AxisProxy.prototype.getTargetSeriesModels = function () {
    var seriesModels = [];
    this.ecModel.eachSeries(function (seriesModel) {
      if (isCoordSupported(seriesModel)) {
        var axisMainType = getAxisMainType(this._dimName);
        var axisModel = seriesModel.getReferringComponents(axisMainType, SINGLE_REFERRING).models[0];
        if (axisModel && this._axisIndex === axisModel.componentIndex) {
          seriesModels.push(seriesModel);
        }
      }
    }, this);
    return seriesModels;
  };
  AxisProxy.prototype.getAxisModel = function () {
    return this.ecModel.getComponent(this._dimName + 'Axis', this._axisIndex);
  };
  AxisProxy.prototype.getMinMaxSpan = function () {
    return clone$4(this._minMaxSpan);
  };
  /**
   * Only calculate by given range and this._dataExtent, do not change anything.
   */
  AxisProxy.prototype.calculateDataWindow = function (opt) {
    var dataExtent = this._dataExtent;
    var axisModel = this.getAxisModel();
    var scale = axisModel.axis.scale;
    var rangePropMode = this._dataZoomModel.getRangePropMode();
    var percentExtent = [0, 100];
    var percentWindow = [];
    var valueWindow = [];
    var hasPropModeValue;
    each$7(['start', 'end'], function (prop, idx) {
      var boundPercent = opt[prop];
      var boundValue = opt[prop + 'Value'];
      // Notice: dataZoom is based either on `percentProp` ('start', 'end') or
      // on `valueProp` ('startValue', 'endValue'). (They are based on the data extent
      // but not min/max of axis, which will be calculated by data window then).
      // The former one is suitable for cases that a dataZoom component controls multiple
      // axes with different unit or extent, and the latter one is suitable for accurate
      // zoom by pixel (e.g., in dataZoomSelect).
      // we use `getRangePropMode()` to mark which prop is used. `rangePropMode` is updated
      // only when setOption or dispatchAction, otherwise it remains its original value.
      // (Why not only record `percentProp` and always map to `valueProp`? Because
      // the map `valueProp` -> `percentProp` -> `valueProp` probably not the original
      // `valueProp`. consider two axes constrolled by one dataZoom. They have different
      // data extent. All of values that are overflow the `dataExtent` will be calculated
      // to percent '100%').
      if (rangePropMode[idx] === 'percent') {
        boundPercent == null && (boundPercent = percentExtent[idx]);
        // Use scale.parse to math round for category or time axis.
        boundValue = scale.parse(linearMap$2(boundPercent, percentExtent, dataExtent));
      } else {
        hasPropModeValue = true;
        boundValue = boundValue == null ? dataExtent[idx] : scale.parse(boundValue);
        // Calculating `percent` from `value` may be not accurate, because
        // This calculation can not be inversed, because all of values that
        // are overflow the `dataExtent` will be calculated to percent '100%'
        boundPercent = linearMap$2(boundValue, dataExtent, percentExtent);
      }
      // valueWindow[idx] = round(boundValue);
      // percentWindow[idx] = round(boundPercent);
      // fallback to extent start/end when parsed value or percent is invalid
      valueWindow[idx] = boundValue == null || isNaN(boundValue) ? dataExtent[idx] : boundValue;
      percentWindow[idx] = boundPercent == null || isNaN(boundPercent) ? percentExtent[idx] : boundPercent;
    });
    asc$1(valueWindow);
    asc$1(percentWindow);
    // The windows from user calling of `dispatchAction` might be out of the extent,
    // or do not obey the `min/maxSpan`, `min/maxValueSpan`. But we don't restrict window
    // by `zoomLock` here, because we see `zoomLock` just as a interaction constraint,
    // where API is able to initialize/modify the window size even though `zoomLock`
    // specified.
    var spans = this._minMaxSpan;
    hasPropModeValue ? restrictSet(valueWindow, percentWindow, dataExtent, percentExtent, false) : restrictSet(percentWindow, valueWindow, percentExtent, dataExtent, true);
    function restrictSet(fromWindow, toWindow, fromExtent, toExtent, toValue) {
      var suffix = toValue ? 'Span' : 'ValueSpan';
      sliderMove(0, fromWindow, fromExtent, 'all', spans['min' + suffix], spans['max' + suffix]);
      for (var i = 0; i < 2; i++) {
        toWindow[i] = linearMap$2(fromWindow[i], fromExtent, toExtent, true);
        toValue && (toWindow[i] = scale.parse(toWindow[i]));
      }
    }
    return {
      valueWindow: valueWindow,
      percentWindow: percentWindow
    };
  };
  /**
   * Notice: reset should not be called before series.restoreData() is called,
   * so it is recommended to be called in "process stage" but not "model init
   * stage".
   */
  AxisProxy.prototype.reset = function (dataZoomModel) {
    if (dataZoomModel !== this._dataZoomModel) {
      return;
    }
    var targetSeries = this.getTargetSeriesModels();
    // Culculate data window and data extent, and record them.
    this._dataExtent = calculateDataExtent(this, this._dimName, targetSeries);
    // `calculateDataWindow` uses min/maxSpan.
    this._updateMinMaxSpan();
    var dataWindow = this.calculateDataWindow(dataZoomModel.settledOption);
    this._valueWindow = dataWindow.valueWindow;
    this._percentWindow = dataWindow.percentWindow;
    // Update axis setting then.
    this._setAxisModel();
  };
  AxisProxy.prototype.filterData = function (dataZoomModel, api) {
    if (dataZoomModel !== this._dataZoomModel) {
      return;
    }
    var axisDim = this._dimName;
    var seriesModels = this.getTargetSeriesModels();
    var filterMode = dataZoomModel.get('filterMode');
    var valueWindow = this._valueWindow;
    if (filterMode === 'none') {
      return;
    }
    // FIXME
    // Toolbox may has dataZoom injected. And if there are stacked bar chart
    // with NaN data, NaN will be filtered and stack will be wrong.
    // So we need to force the mode to be set empty.
    // In fect, it is not a big deal that do not support filterMode-'filter'
    // when using toolbox#dataZoom, utill tooltip#dataZoom support "single axis
    // selection" some day, which might need "adapt to data extent on the
    // otherAxis", which is disabled by filterMode-'empty'.
    // But currently, stack has been fixed to based on value but not index,
    // so this is not an issue any more.
    // let otherAxisModel = this.getOtherAxisModel();
    // if (dataZoomModel.get('$fromToolbox')
    //     && otherAxisModel
    //     && otherAxisModel.hasSeriesStacked
    // ) {
    //     filterMode = 'empty';
    // }
    // TODO
    // filterMode 'weakFilter' and 'empty' is not optimized for huge data yet.
    each$7(seriesModels, function (seriesModel) {
      var seriesData = seriesModel.getData();
      var dataDims = seriesData.mapDimensionsAll(axisDim);
      if (!dataDims.length) {
        return;
      }
      if (filterMode === 'weakFilter') {
        var store_1 = seriesData.getStore();
        var dataDimIndices_1 = map$1(dataDims, function (dim) {
          return seriesData.getDimensionIndex(dim);
        }, seriesData);
        seriesData.filterSelf(function (dataIndex) {
          var leftOut;
          var rightOut;
          var hasValue;
          for (var i = 0; i < dataDims.length; i++) {
            var value = store_1.get(dataDimIndices_1[i], dataIndex);
            var thisHasValue = !isNaN(value);
            var thisLeftOut = value < valueWindow[0];
            var thisRightOut = value > valueWindow[1];
            if (thisHasValue && !thisLeftOut && !thisRightOut) {
              return true;
            }
            thisHasValue && (hasValue = true);
            thisLeftOut && (leftOut = true);
            thisRightOut && (rightOut = true);
          }
          // If both left out and right out, do not filter.
          return hasValue && leftOut && rightOut;
        });
      } else {
        each$7(dataDims, function (dim) {
          if (filterMode === 'empty') {
            seriesModel.setData(seriesData = seriesData.map(dim, function (value) {
              return !isInWindow(value) ? NaN : value;
            }));
          } else {
            var range = {};
            range[dim] = valueWindow;
            // console.time('select');
            seriesData.selectRange(range);
            // console.timeEnd('select');
          }
        });
      }
      each$7(dataDims, function (dim) {
        seriesData.setApproximateExtent(valueWindow, dim);
      });
    });
    function isInWindow(value) {
      return value >= valueWindow[0] && value <= valueWindow[1];
    }
  };
  AxisProxy.prototype._updateMinMaxSpan = function () {
    var minMaxSpan = this._minMaxSpan = {};
    var dataZoomModel = this._dataZoomModel;
    var dataExtent = this._dataExtent;
    each$7(['min', 'max'], function (minMax) {
      var percentSpan = dataZoomModel.get(minMax + 'Span');
      var valueSpan = dataZoomModel.get(minMax + 'ValueSpan');
      valueSpan != null && (valueSpan = this.getAxisModel().axis.scale.parse(valueSpan));
      // minValueSpan and maxValueSpan has higher priority than minSpan and maxSpan
      if (valueSpan != null) {
        percentSpan = linearMap$2(dataExtent[0] + valueSpan, dataExtent, [0, 100], true);
      } else if (percentSpan != null) {
        valueSpan = linearMap$2(percentSpan, [0, 100], dataExtent, true) - dataExtent[0];
      }
      minMaxSpan[minMax + 'Span'] = percentSpan;
      minMaxSpan[minMax + 'ValueSpan'] = valueSpan;
    }, this);
  };
  AxisProxy.prototype._setAxisModel = function () {
    var axisModel = this.getAxisModel();
    var percentWindow = this._percentWindow;
    var valueWindow = this._valueWindow;
    if (!percentWindow) {
      return;
    }
    // [0, 500]: arbitrary value, guess axis extent.
    var precision = getPixelPrecision(valueWindow, [0, 500]);
    precision = Math.min(precision, 20);
    // For value axis, if min/max/scale are not set, we just use the extent obtained
    // by series data, which may be a little different from the extent calculated by
    // `axisHelper.getScaleExtent`. But the different just affects the experience a
    // little when zooming. So it will not be fixed until some users require it strongly.
    var rawExtentInfo = axisModel.axis.scale.rawExtentInfo;
    if (percentWindow[0] !== 0) {
      rawExtentInfo.setDeterminedMinMax('min', +valueWindow[0].toFixed(precision));
    }
    if (percentWindow[1] !== 100) {
      rawExtentInfo.setDeterminedMinMax('max', +valueWindow[1].toFixed(precision));
    }
    rawExtentInfo.freeze();
  };
  return AxisProxy;
}();
function calculateDataExtent(axisProxy, axisDim, seriesModels) {
  var dataExtent = [Infinity, -Infinity];
  each$7(seriesModels, function (seriesModel) {
    unionAxisExtentFromData(dataExtent, seriesModel.getData(), axisDim);
  });
  // It is important to get "consistent" extent when more then one axes is
  // controlled by a `dataZoom`, otherwise those axes will not be synchronized
  // when zooming. But it is difficult to know what is "consistent", considering
  // axes have different type or even different meanings (For example, two
  // time axes are used to compare data of the same date in different years).
  // So basically dataZoom just obtains extent by series.data (in category axis
  // extent can be obtained from axis.data).
  // Nevertheless, user can set min/max/scale on axes to make extent of axes
  // consistent.
  var axisModel = axisProxy.getAxisModel();
  var rawExtentResult = ensureScaleRawExtentInfo(axisModel.axis.scale, axisModel, dataExtent).calculate();
  return [rawExtentResult.min, rawExtentResult.max];
}
var AxisProxy$1 = AxisProxy;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var dataZoomProcessor = {
  // `dataZoomProcessor` will only be performed in needed series. Consider if
  // there is a line series and a pie series, it is better not to update the
  // line series if only pie series is needed to be updated.
  getTargetSeries: function (ecModel) {
    function eachAxisModel(cb) {
      ecModel.eachComponent('dataZoom', function (dataZoomModel) {
        dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {
          var axisModel = ecModel.getComponent(getAxisMainType(axisDim), axisIndex);
          cb(axisDim, axisIndex, axisModel, dataZoomModel);
        });
      });
    }
    // FIXME: it brings side-effect to `getTargetSeries`.
    // Prepare axis proxies.
    eachAxisModel(function (axisDim, axisIndex, axisModel, dataZoomModel) {
      // dispose all last axis proxy, in case that some axis are deleted.
      axisModel.__dzAxisProxy = null;
    });
    var proxyList = [];
    eachAxisModel(function (axisDim, axisIndex, axisModel, dataZoomModel) {
      // Different dataZooms may constrol the same axis. In that case,
      // an axisProxy serves both of them.
      if (!axisModel.__dzAxisProxy) {
        // Use the first dataZoomModel as the main model of axisProxy.
        axisModel.__dzAxisProxy = new AxisProxy$1(axisDim, axisIndex, dataZoomModel, ecModel);
        proxyList.push(axisModel.__dzAxisProxy);
      }
    });
    var seriesModelMap = createHashMap();
    each$f(proxyList, function (axisProxy) {
      each$f(axisProxy.getTargetSeriesModels(), function (seriesModel) {
        seriesModelMap.set(seriesModel.uid, seriesModel);
      });
    });
    return seriesModelMap;
  },
  // Consider appendData, where filter should be performed. Because data process is
  // in block mode currently, it is not need to worry about that the overallProgress
  // execute every frame.
  overallReset: function (ecModel, api) {
    ecModel.eachComponent('dataZoom', function (dataZoomModel) {
      // We calculate window and reset axis here but not in model
      // init stage and not after action dispatch handler, because
      // reset should be called after seriesData.restoreData.
      dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {
        dataZoomModel.getAxisProxy(axisDim, axisIndex).reset(dataZoomModel);
      });
      // Caution: data zoom filtering is order sensitive when using
      // percent range and no min/max/scale set on axis.
      // For example, we have dataZoom definition:
      // [
      //      {xAxisIndex: 0, start: 30, end: 70},
      //      {yAxisIndex: 0, start: 20, end: 80}
      // ]
      // In this case, [20, 80] of y-dataZoom should be based on data
      // that have filtered by x-dataZoom using range of [30, 70],
      // but should not be based on full raw data. Thus sliding
      // x-dataZoom will change both ranges of xAxis and yAxis,
      // while sliding y-dataZoom will only change the range of yAxis.
      // So we should filter x-axis after reset x-axis immediately,
      // and then reset y-axis and filter y-axis.
      dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {
        dataZoomModel.getAxisProxy(axisDim, axisIndex).filterData(dataZoomModel, api);
      });
    });
    ecModel.eachComponent('dataZoom', function (dataZoomModel) {
      // Fullfill all of the range props so that user
      // is able to get them from chart.getOption().
      var axisProxy = dataZoomModel.findRepresentativeAxisProxy();
      if (axisProxy) {
        var percentRange = axisProxy.getDataPercentWindow();
        var valueRange = axisProxy.getDataValueWindow();
        dataZoomModel.setCalculatedRange({
          start: percentRange[0],
          end: percentRange[1],
          startValue: valueRange[0],
          endValue: valueRange[1]
        });
      }
    });
  }
};
var dataZoomProcessor$1 = dataZoomProcessor;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function installDataZoomAction(registers) {
  registers.registerAction('dataZoom', function (payload, ecModel) {
    var effectedModels = findEffectedDataZooms(ecModel, payload);
    each$f(effectedModels, function (dataZoomModel) {
      dataZoomModel.setRawRange({
        start: payload.start,
        end: payload.end,
        startValue: payload.startValue,
        endValue: payload.endValue
      });
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var installed$1 = false;
function installCommon$1(registers) {
  if (installed$1) {
    return;
  }
  installed$1 = true;
  registers.registerProcessor(registers.PRIORITY.PROCESSOR.FILTER, dataZoomProcessor$1);
  installDataZoomAction(registers);
  registers.registerSubTypeDefaulter('dataZoom', function () {
    // Default 'slider' when no type specified.
    return 'slider';
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$m(registers) {
  registers.registerComponentModel(SelectZoomModel);
  registers.registerComponentView(SelectZoomView);
  installCommon$1(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

var ToolboxFeature = /** @class */function () {
  function ToolboxFeature() {}
  return ToolboxFeature;
}();
var features = {};
function registerFeature(name, ctor) {
  features[name] = ctor;
}
function getFeature(name) {
  return features[name];
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ToolboxModel = /** @class */function (_super) {
  __extends(ToolboxModel, _super);
  function ToolboxModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ToolboxModel.type;
    return _this;
  }
  ToolboxModel.prototype.optionUpdated = function () {
    _super.prototype.optionUpdated.apply(this, arguments);
    var ecModel = this.ecModel;
    each$f(this.option.feature, function (featureOpt, featureName) {
      var Feature = getFeature(featureName);
      if (Feature) {
        if (Feature.getDefaultOption) {
          Feature.defaultOption = Feature.getDefaultOption(ecModel);
        }
        merge(featureOpt, Feature.defaultOption);
      }
    });
  };
  ToolboxModel.type = 'toolbox';
  ToolboxModel.layoutMode = {
    type: 'box',
    ignoreSize: true
  };
  ToolboxModel.defaultOption = {
    show: true,
    z: 6,
    // zlevel: 0,
    orient: 'horizontal',
    left: 'right',
    top: 'top',
    // right
    // bottom
    backgroundColor: 'transparent',
    borderColor: '#ccc',
    borderRadius: 0,
    borderWidth: 0,
    padding: 5,
    itemSize: 15,
    itemGap: 8,
    showTitle: true,
    iconStyle: {
      borderColor: '#666',
      color: 'none'
    },
    emphasis: {
      iconStyle: {
        borderColor: '#3E98C5'
      }
    },
    // textStyle: {},
    // feature
    tooltip: {
      show: false,
      position: 'bottom'
    }
  };
  return ToolboxModel;
}(ComponentModel$1);
var ToolboxModel$1 = ToolboxModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Layout list like component.
 * It will box layout each items in group of component and then position the whole group in the viewport
 * @param {module:zrender/group/Group} group
 * @param {module:echarts/model/Component} componentModel
 * @param {module:echarts/ExtensionAPI}
 */
function layout(group, componentModel, api) {
  var boxLayoutParams = componentModel.getBoxLayoutParams();
  var padding = componentModel.get('padding');
  var viewportSize = {
    width: api.getWidth(),
    height: api.getHeight()
  };
  var rect = getLayoutRect(boxLayoutParams, viewportSize, padding);
  box(componentModel.get('orient'), group, componentModel.get('itemGap'), rect.width, rect.height);
  positionElement(group, boxLayoutParams, viewportSize, padding);
}
function makeBackground(rect, componentModel) {
  var padding = normalizeCssArray(componentModel.get('padding'));
  var style = componentModel.getItemStyle(['color', 'opacity']);
  style.fill = componentModel.get('backgroundColor');
  rect = new Rect$3({
    shape: {
      x: rect.x - padding[3],
      y: rect.y - padding[0],
      width: rect.width + padding[1] + padding[3],
      height: rect.height + padding[0] + padding[2],
      r: componentModel.get('borderRadius')
    },
    style: style,
    silent: true,
    z2: -1
  });
  // FIXME
  // `subPixelOptimizeRect` may bring some gap between edge of viewpart
  // and background rect when setting like `left: 0`, `top: 0`.
  // graphic.subPixelOptimizeRect(rect);
  return rect;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ToolboxView = /** @class */function (_super) {
  __extends(ToolboxView, _super);
  function ToolboxView() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  ToolboxView.prototype.render = function (toolboxModel, ecModel, api, payload) {
    var group = this.group;
    group.removeAll();
    if (!toolboxModel.get('show')) {
      return;
    }
    var itemSize = +toolboxModel.get('itemSize');
    var isVertical = toolboxModel.get('orient') === 'vertical';
    var featureOpts = toolboxModel.get('feature') || {};
    var features = this._features || (this._features = {});
    var featureNames = [];
    each$f(featureOpts, function (opt, name) {
      featureNames.push(name);
    });
    new DataDiffer$1(this._featureNames || [], featureNames).add(processFeature).update(processFeature).remove(curry$1(processFeature, null)).execute();
    // Keep for diff.
    this._featureNames = featureNames;
    function processFeature(newIndex, oldIndex) {
      var featureName = featureNames[newIndex];
      var oldName = featureNames[oldIndex];
      var featureOpt = featureOpts[featureName];
      var featureModel = new Model$1(featureOpt, toolboxModel, toolboxModel.ecModel);
      var feature;
      // FIX#11236, merge feature title from MagicType newOption. TODO: consider seriesIndex ?
      if (payload && payload.newTitle != null && payload.featureName === featureName) {
        featureOpt.title = payload.newTitle;
      }
      if (featureName && !oldName) {
        // Create
        if (isUserFeatureName(featureName)) {
          feature = {
            onclick: featureModel.option.onclick,
            featureName: featureName
          };
        } else {
          var Feature = getFeature(featureName);
          if (!Feature) {
            return;
          }
          feature = new Feature();
        }
        features[featureName] = feature;
      } else {
        feature = features[oldName];
        // If feature does not exist.
        if (!feature) {
          return;
        }
      }
      feature.uid = getUID('toolbox-feature');
      feature.model = featureModel;
      feature.ecModel = ecModel;
      feature.api = api;
      var isToolboxFeature = feature instanceof ToolboxFeature;
      if (!featureName && oldName) {
        isToolboxFeature && feature.dispose && feature.dispose(ecModel, api);
        return;
      }
      if (!featureModel.get('show') || isToolboxFeature && feature.unusable) {
        isToolboxFeature && feature.remove && feature.remove(ecModel, api);
        return;
      }
      createIconPaths(featureModel, feature, featureName);
      featureModel.setIconStatus = function (iconName, status) {
        var option = this.option;
        var iconPaths = this.iconPaths;
        option.iconStatus = option.iconStatus || {};
        option.iconStatus[iconName] = status;
        if (iconPaths[iconName]) {
          (status === 'emphasis' ? enterEmphasis : leaveEmphasis)(iconPaths[iconName]);
        }
      };
      if (feature instanceof ToolboxFeature) {
        if (feature.render) {
          feature.render(featureModel, ecModel, api, payload);
        }
      }
    }
    function createIconPaths(featureModel, feature, featureName) {
      var iconStyleModel = featureModel.getModel('iconStyle');
      var iconStyleEmphasisModel = featureModel.getModel(['emphasis', 'iconStyle']);
      // If one feature has multiple icons, they are organized as
      // {
      //     icon: {
      //         foo: '',
      //         bar: ''
      //     },
      //     title: {
      //         foo: '',
      //         bar: ''
      //     }
      // }
      var icons = feature instanceof ToolboxFeature && feature.getIcons ? feature.getIcons() : featureModel.get('icon');
      var titles = featureModel.get('title') || {};
      var iconsMap;
      var titlesMap;
      if (isString(icons)) {
        iconsMap = {};
        iconsMap[featureName] = icons;
      } else {
        iconsMap = icons;
      }
      if (isString(titles)) {
        titlesMap = {};
        titlesMap[featureName] = titles;
      } else {
        titlesMap = titles;
      }
      var iconPaths = featureModel.iconPaths = {};
      each$f(iconsMap, function (iconStr, iconName) {
        var path = createIcon(iconStr, {}, {
          x: -itemSize / 2,
          y: -itemSize / 2,
          width: itemSize,
          height: itemSize
        }); // TODO handling image
        path.setStyle(iconStyleModel.getItemStyle());
        var pathEmphasisState = path.ensureState('emphasis');
        pathEmphasisState.style = iconStyleEmphasisModel.getItemStyle();
        // Text position calculation
        // TODO: extract `textStyle` from `iconStyle` and use `createTextStyle`
        var textContent = new ZRText$1({
          style: {
            text: titlesMap[iconName],
            align: iconStyleEmphasisModel.get('textAlign'),
            borderRadius: iconStyleEmphasisModel.get('textBorderRadius'),
            padding: iconStyleEmphasisModel.get('textPadding'),
            fill: null,
            font: getFont({
              fontStyle: iconStyleEmphasisModel.get('textFontStyle'),
              fontFamily: iconStyleEmphasisModel.get('textFontFamily'),
              fontSize: iconStyleEmphasisModel.get('textFontSize'),
              fontWeight: iconStyleEmphasisModel.get('textFontWeight')
            }, ecModel)
          },
          ignore: true
        });
        path.setTextContent(textContent);
        setTooltipConfig({
          el: path,
          componentModel: toolboxModel,
          itemName: iconName,
          formatterParamsExtra: {
            title: titlesMap[iconName]
          }
        });
        path.__title = titlesMap[iconName];
        path.on('mouseover', function () {
          // Should not reuse above hoverStyle, which might be modified.
          var hoverStyle = iconStyleEmphasisModel.getItemStyle();
          var defaultTextPosition = isVertical ? toolboxModel.get('right') == null && toolboxModel.get('left') !== 'right' ? 'right' : 'left' : toolboxModel.get('bottom') == null && toolboxModel.get('top') !== 'bottom' ? 'bottom' : 'top';
          textContent.setStyle({
            fill: iconStyleEmphasisModel.get('textFill') || hoverStyle.fill || hoverStyle.stroke || '#000',
            backgroundColor: iconStyleEmphasisModel.get('textBackgroundColor')
          });
          path.setTextConfig({
            position: iconStyleEmphasisModel.get('textPosition') || defaultTextPosition
          });
          textContent.ignore = !toolboxModel.get('showTitle');
          // Use enterEmphasis and leaveEmphasis provide by ec.
          // There are flags managed by the echarts.
          api.enterEmphasis(this);
        }).on('mouseout', function () {
          if (featureModel.get(['iconStatus', iconName]) !== 'emphasis') {
            api.leaveEmphasis(this);
          }
          textContent.hide();
        });
        (featureModel.get(['iconStatus', iconName]) === 'emphasis' ? enterEmphasis : leaveEmphasis)(path);
        group.add(path);
        path.on('click', bind$1(feature.onclick, feature, ecModel, api, iconName));
        iconPaths[iconName] = path;
      });
    }
    layout(group, toolboxModel, api);
    // Render background after group is layout
    // FIXME
    group.add(makeBackground(group.getBoundingRect(), toolboxModel));
    // Adjust icon title positions to avoid them out of screen
    isVertical || group.eachChild(function (icon) {
      var titleText = icon.__title;
      // const hoverStyle = icon.hoverStyle;
      // TODO simplify code?
      var emphasisState = icon.ensureState('emphasis');
      var emphasisTextConfig = emphasisState.textConfig || (emphasisState.textConfig = {});
      var textContent = icon.getTextContent();
      var emphasisTextState = textContent && textContent.ensureState('emphasis');
      // May be background element
      if (emphasisTextState && !isFunction(emphasisTextState) && titleText) {
        var emphasisTextStyle = emphasisTextState.style || (emphasisTextState.style = {});
        var rect = getBoundingRect(titleText, ZRText$1.makeFont(emphasisTextStyle));
        var offsetX = icon.x + group.x;
        var offsetY = icon.y + group.y + itemSize;
        var needPutOnTop = false;
        if (offsetY + rect.height > api.getHeight()) {
          emphasisTextConfig.position = 'top';
          needPutOnTop = true;
        }
        var topOffset = needPutOnTop ? -5 - rect.height : itemSize + 10;
        if (offsetX + rect.width / 2 > api.getWidth()) {
          emphasisTextConfig.position = ['100%', topOffset];
          emphasisTextStyle.align = 'right';
        } else if (offsetX - rect.width / 2 < 0) {
          emphasisTextConfig.position = [0, topOffset];
          emphasisTextStyle.align = 'left';
        }
      }
    });
  };
  ToolboxView.prototype.updateView = function (toolboxModel, ecModel, api, payload) {
    each$f(this._features, function (feature) {
      feature instanceof ToolboxFeature && feature.updateView && feature.updateView(feature.model, ecModel, api, payload);
    });
  };
  // updateLayout(toolboxModel, ecModel, api, payload) {
  //     zrUtil.each(this._features, function (feature) {
  //         feature.updateLayout && feature.updateLayout(feature.model, ecModel, api, payload);
  //     });
  // },
  ToolboxView.prototype.remove = function (ecModel, api) {
    each$f(this._features, function (feature) {
      feature instanceof ToolboxFeature && feature.remove && feature.remove(ecModel, api);
    });
    this.group.removeAll();
  };
  ToolboxView.prototype.dispose = function (ecModel, api) {
    each$f(this._features, function (feature) {
      feature instanceof ToolboxFeature && feature.dispose && feature.dispose(ecModel, api);
    });
  };
  ToolboxView.type = 'toolbox';
  return ToolboxView;
}(ComponentView$1);
function isUserFeatureName(featureName) {
  return featureName.indexOf('my') === 0;
}
var ToolboxView$1 = ToolboxView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SaveAsImage = /** @class */function (_super) {
  __extends(SaveAsImage, _super);
  function SaveAsImage() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  SaveAsImage.prototype.onclick = function (ecModel, api) {
    var model = this.model;
    var title = model.get('name') || ecModel.get('title.0.text') || 'echarts';
    var isSvg = api.getZr().painter.getType() === 'svg';
    var type = isSvg ? 'svg' : model.get('type', true) || 'png';
    var url = api.getConnectedDataURL({
      type: type,
      backgroundColor: model.get('backgroundColor', true) || ecModel.get('backgroundColor') || '#fff',
      connectedBackgroundColor: model.get('connectedBackgroundColor'),
      excludeComponents: model.get('excludeComponents'),
      pixelRatio: model.get('pixelRatio')
    });
    var browser = env$1.browser;
    // Chrome, Firefox, New Edge
    if (typeof MouseEvent === 'function' && (browser.newEdge || !browser.ie && !browser.edge)) {
      var $a = document.createElement('a');
      $a.download = title + '.' + type;
      $a.target = '_blank';
      $a.href = url;
      var evt = new MouseEvent('click', {
        // some micro front-end framework， window maybe is a Proxy
        view: document.defaultView,
        bubbles: true,
        cancelable: false
      });
      $a.dispatchEvent(evt);
    }
    // IE or old Edge
    else {
      // @ts-ignore
      if (window.navigator.msSaveOrOpenBlob || isSvg) {
        var parts = url.split(',');
        // data:[<mime type>][;charset=<charset>][;base64],<encoded data>
        var base64Encoded = parts[0].indexOf('base64') > -1;
        var bstr = isSvg
        // should decode the svg data uri first
        ? decodeURIComponent(parts[1]) : parts[1];
        // only `atob` when the data uri is encoded with base64
        // otherwise, like `svg` data uri exported by zrender,
        // there will be an error, for it's not encoded with base64.
        // (just a url-encoded string through `encodeURIComponent`)
        base64Encoded && (bstr = window.atob(bstr));
        var filename = title + '.' + type;
        // @ts-ignore
        if (window.navigator.msSaveOrOpenBlob) {
          var n = bstr.length;
          var u8arr = new Uint8Array(n);
          while (n--) {
            u8arr[n] = bstr.charCodeAt(n);
          }
          var blob = new Blob([u8arr]); // @ts-ignore
          window.navigator.msSaveOrOpenBlob(blob, filename);
        } else {
          var frame = document.createElement('iframe');
          document.body.appendChild(frame);
          var cw = frame.contentWindow;
          var doc = cw.document;
          doc.open('image/svg+xml', 'replace');
          doc.write(bstr);
          doc.close();
          cw.focus();
          doc.execCommand('SaveAs', true, filename);
          document.body.removeChild(frame);
        }
      } else {
        var lang = model.get('lang');
        var html = '' + '<body style="margin:0;">' + '<img src="' + url + '" style="max-width:100%;" title="' + (lang && lang[0] || '') + '" />' + '</body>';
        var tab = window.open();
        tab.document.write(html);
        tab.document.title = title;
      }
    }
  };
  SaveAsImage.getDefaultOption = function (ecModel) {
    var defaultOption = {
      show: true,
      icon: 'M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0',
      title: ecModel.getLocaleModel().get(['toolbox', 'saveAsImage', 'title']),
      type: 'png',
      // Default use option.backgroundColor
      // backgroundColor: '#fff',
      connectedBackgroundColor: '#fff',
      name: '',
      excludeComponents: ['toolbox'],
      // use current pixel ratio of device by default
      // pixelRatio: 1,
      lang: ecModel.getLocaleModel().get(['toolbox', 'saveAsImage', 'lang'])
    };
    return defaultOption;
  };
  return SaveAsImage;
}(ToolboxFeature);
var SaveAsImage$1 = SaveAsImage;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var INNER_STACK_KEYWORD = '__ec_magicType_stack__';
var radioTypes = [['line', 'bar'], ['stack']];
var MagicType = /** @class */function (_super) {
  __extends(MagicType, _super);
  function MagicType() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  MagicType.prototype.getIcons = function () {
    var model = this.model;
    var availableIcons = model.get('icon');
    var icons = {};
    each$f(model.get('type'), function (type) {
      if (availableIcons[type]) {
        icons[type] = availableIcons[type];
      }
    });
    return icons;
  };
  MagicType.getDefaultOption = function (ecModel) {
    var defaultOption = {
      show: true,
      type: [],
      // Icon group
      icon: {
        line: 'M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4',
        bar: 'M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7',
        // eslint-disable-next-line
        stack: 'M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z' // jshint ignore:line
      },
      // `line`, `bar`, `stack`, `tiled`
      title: ecModel.getLocaleModel().get(['toolbox', 'magicType', 'title']),
      option: {},
      seriesIndex: {}
    };
    return defaultOption;
  };
  MagicType.prototype.onclick = function (ecModel, api, type) {
    var model = this.model;
    var seriesIndex = model.get(['seriesIndex', type]);
    // Not supported magicType
    if (!seriesOptGenreator[type]) {
      return;
    }
    var newOption = {
      series: []
    };
    var generateNewSeriesTypes = function (seriesModel) {
      var seriesType = seriesModel.subType;
      var seriesId = seriesModel.id;
      var newSeriesOpt = seriesOptGenreator[type](seriesType, seriesId, seriesModel, model);
      if (newSeriesOpt) {
        // PENDING If merge original option?
        defaults(newSeriesOpt, seriesModel.option);
        newOption.series.push(newSeriesOpt);
      }
      // Modify boundaryGap
      var coordSys = seriesModel.coordinateSystem;
      if (coordSys && coordSys.type === 'cartesian2d' && (type === 'line' || type === 'bar')) {
        var categoryAxis = coordSys.getAxesByScale('ordinal')[0];
        if (categoryAxis) {
          var axisDim = categoryAxis.dim;
          var axisType = axisDim + 'Axis';
          var axisModel = seriesModel.getReferringComponents(axisType, SINGLE_REFERRING).models[0];
          var axisIndex = axisModel.componentIndex;
          newOption[axisType] = newOption[axisType] || [];
          for (var i = 0; i <= axisIndex; i++) {
            newOption[axisType][axisIndex] = newOption[axisType][axisIndex] || {};
          }
          newOption[axisType][axisIndex].boundaryGap = type === 'bar';
        }
      }
    };
    each$f(radioTypes, function (radio) {
      if (indexOf(radio, type) >= 0) {
        each$f(radio, function (item) {
          model.setIconStatus(item, 'normal');
        });
      }
    });
    model.setIconStatus(type, 'emphasis');
    ecModel.eachComponent({
      mainType: 'series',
      query: seriesIndex == null ? null : {
        seriesIndex: seriesIndex
      }
    }, generateNewSeriesTypes);
    var newTitle;
    var currentType = type;
    // Change title of stack
    if (type === 'stack') {
      // use titles in model instead of ecModel
      // as stack and tiled appears in pair, just flip them
      // no need of checking stack state
      newTitle = merge({
        stack: model.option.title.tiled,
        tiled: model.option.title.stack
      }, model.option.title);
      if (model.get(['iconStatus', type]) !== 'emphasis') {
        currentType = 'tiled';
      }
    }
    api.dispatchAction({
      type: 'changeMagicType',
      currentType: currentType,
      newOption: newOption,
      newTitle: newTitle,
      featureName: 'magicType'
    });
  };
  return MagicType;
}(ToolboxFeature);
var seriesOptGenreator = {
  'line': function (seriesType, seriesId, seriesModel, model) {
    if (seriesType === 'bar') {
      return merge({
        id: seriesId,
        type: 'line',
        // Preserve data related option
        data: seriesModel.get('data'),
        stack: seriesModel.get('stack'),
        markPoint: seriesModel.get('markPoint'),
        markLine: seriesModel.get('markLine')
      }, model.get(['option', 'line']) || {}, true);
    }
  },
  'bar': function (seriesType, seriesId, seriesModel, model) {
    if (seriesType === 'line') {
      return merge({
        id: seriesId,
        type: 'bar',
        // Preserve data related option
        data: seriesModel.get('data'),
        stack: seriesModel.get('stack'),
        markPoint: seriesModel.get('markPoint'),
        markLine: seriesModel.get('markLine')
      }, model.get(['option', 'bar']) || {}, true);
    }
  },
  'stack': function (seriesType, seriesId, seriesModel, model) {
    var isStack = seriesModel.get('stack') === INNER_STACK_KEYWORD;
    if (seriesType === 'line' || seriesType === 'bar') {
      model.setIconStatus('stack', isStack ? 'normal' : 'emphasis');
      return merge({
        id: seriesId,
        stack: isStack ? '' : INNER_STACK_KEYWORD
      }, model.get(['option', 'stack']) || {}, true);
    }
  }
};
// TODO: SELF REGISTERED.
registerAction({
  type: 'changeMagicType',
  event: 'magicTypeChanged',
  update: 'prepareAndUpdate'
}, function (payload, ecModel) {
  ecModel.mergeOption(payload.newOption);
});
var MagicType$1 = MagicType;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* global document */
var BLOCK_SPLITER = new Array(60).join('-');
var ITEM_SPLITER = '\t';
/**
 * Group series into two types
 *  1. on category axis, like line, bar
 *  2. others, like scatter, pie
 */
function groupSeries(ecModel) {
  var seriesGroupByCategoryAxis = {};
  var otherSeries = [];
  var meta = [];
  ecModel.eachRawSeries(function (seriesModel) {
    var coordSys = seriesModel.coordinateSystem;
    if (coordSys && (coordSys.type === 'cartesian2d' || coordSys.type === 'polar')) {
      // TODO: TYPE Consider polar? Include polar may increase unecessary bundle size.
      var baseAxis = coordSys.getBaseAxis();
      if (baseAxis.type === 'category') {
        var key = baseAxis.dim + '_' + baseAxis.index;
        if (!seriesGroupByCategoryAxis[key]) {
          seriesGroupByCategoryAxis[key] = {
            categoryAxis: baseAxis,
            valueAxis: coordSys.getOtherAxis(baseAxis),
            series: []
          };
          meta.push({
            axisDim: baseAxis.dim,
            axisIndex: baseAxis.index
          });
        }
        seriesGroupByCategoryAxis[key].series.push(seriesModel);
      } else {
        otherSeries.push(seriesModel);
      }
    } else {
      otherSeries.push(seriesModel);
    }
  });
  return {
    seriesGroupByCategoryAxis: seriesGroupByCategoryAxis,
    other: otherSeries,
    meta: meta
  };
}
/**
 * Assemble content of series on cateogory axis
 * @inner
 */
function assembleSeriesWithCategoryAxis(groups) {
  var tables = [];
  each$f(groups, function (group, key) {
    var categoryAxis = group.categoryAxis;
    var valueAxis = group.valueAxis;
    var valueAxisDim = valueAxis.dim;
    var headers = [' '].concat(map$1(group.series, function (series) {
      return series.name;
    }));
    // @ts-ignore TODO Polar
    var columns = [categoryAxis.model.getCategories()];
    each$f(group.series, function (series) {
      var rawData = series.getRawData();
      columns.push(series.getRawData().mapArray(rawData.mapDimension(valueAxisDim), function (val) {
        return val;
      }));
    });
    // Assemble table content
    var lines = [headers.join(ITEM_SPLITER)];
    for (var i = 0; i < columns[0].length; i++) {
      var items = [];
      for (var j = 0; j < columns.length; j++) {
        items.push(columns[j][i]);
      }
      lines.push(items.join(ITEM_SPLITER));
    }
    tables.push(lines.join('\n'));
  });
  return tables.join('\n\n' + BLOCK_SPLITER + '\n\n');
}
/**
 * Assemble content of other series
 */
function assembleOtherSeries(series) {
  return map$1(series, function (series) {
    var data = series.getRawData();
    var lines = [series.name];
    var vals = [];
    data.each(data.dimensions, function () {
      var argLen = arguments.length;
      var dataIndex = arguments[argLen - 1];
      var name = data.getName(dataIndex);
      for (var i = 0; i < argLen - 1; i++) {
        vals[i] = arguments[i];
      }
      lines.push((name ? name + ITEM_SPLITER : '') + vals.join(ITEM_SPLITER));
    });
    return lines.join('\n');
  }).join('\n\n' + BLOCK_SPLITER + '\n\n');
}
function getContentFromModel(ecModel) {
  var result = groupSeries(ecModel);
  return {
    value: filter([assembleSeriesWithCategoryAxis(result.seriesGroupByCategoryAxis), assembleOtherSeries(result.other)], function (str) {
      return !!str.replace(/[\n\t\s]/g, '');
    }).join('\n\n' + BLOCK_SPLITER + '\n\n'),
    meta: result.meta
  };
}
function trim(str) {
  return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
/**
 * If a block is tsv format
 */
function isTSVFormat(block) {
  // Simple method to find out if a block is tsv format
  var firstLine = block.slice(0, block.indexOf('\n'));
  if (firstLine.indexOf(ITEM_SPLITER) >= 0) {
    return true;
  }
}
var itemSplitRegex = new RegExp('[' + ITEM_SPLITER + ']+', 'g');
/**
 * @param {string} tsv
 * @return {Object}
 */
function parseTSVContents(tsv) {
  var tsvLines = tsv.split(/\n+/g);
  var headers = trim(tsvLines.shift()).split(itemSplitRegex);
  var categories = [];
  var series = map$1(headers, function (header) {
    return {
      name: header,
      data: []
    };
  });
  for (var i = 0; i < tsvLines.length; i++) {
    var items = trim(tsvLines[i]).split(itemSplitRegex);
    categories.push(items.shift());
    for (var j = 0; j < items.length; j++) {
      series[j] && (series[j].data[i] = items[j]);
    }
  }
  return {
    series: series,
    categories: categories
  };
}
function parseListContents(str) {
  var lines = str.split(/\n+/g);
  var seriesName = trim(lines.shift());
  var data = [];
  for (var i = 0; i < lines.length; i++) {
    // if line is empty, ignore it.
    // there is a case that a user forgot to delete `\n`.
    var line = trim(lines[i]);
    if (!line) {
      continue;
    }
    var items = line.split(itemSplitRegex);
    var name_1 = '';
    var value = void 0;
    var hasName = false;
    if (isNaN(items[0])) {
      // First item is name
      hasName = true;
      name_1 = items[0];
      items = items.slice(1);
      data[i] = {
        name: name_1,
        value: []
      };
      value = data[i].value;
    } else {
      value = data[i] = [];
    }
    for (var j = 0; j < items.length; j++) {
      value.push(+items[j]);
    }
    if (value.length === 1) {
      hasName ? data[i].value = value[0] : data[i] = value[0];
    }
  }
  return {
    name: seriesName,
    data: data
  };
}
function parseContents(str, blockMetaList) {
  var blocks = str.split(new RegExp('\n*' + BLOCK_SPLITER + '\n*', 'g'));
  var newOption = {
    series: []
  };
  each$f(blocks, function (block, idx) {
    if (isTSVFormat(block)) {
      var result = parseTSVContents(block);
      var blockMeta = blockMetaList[idx];
      var axisKey = blockMeta.axisDim + 'Axis';
      if (blockMeta) {
        newOption[axisKey] = newOption[axisKey] || [];
        newOption[axisKey][blockMeta.axisIndex] = {
          data: result.categories
        };
        newOption.series = newOption.series.concat(result.series);
      }
    } else {
      var result = parseListContents(block);
      newOption.series.push(result);
    }
  });
  return newOption;
}
var DataView$1 = /** @class */function (_super) {
  __extends(DataView, _super);
  function DataView() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  DataView.prototype.onclick = function (ecModel, api) {
    // FIXME: better way?
    setTimeout(function () {
      api.dispatchAction({
        type: 'hideTip'
      });
    });
    var container = api.getDom();
    var model = this.model;
    if (this._dom) {
      container.removeChild(this._dom);
    }
    var root = document.createElement('div');
    // use padding to avoid 5px whitespace
    root.style.cssText = 'position:absolute;top:0;bottom:0;left:0;right:0;padding:5px';
    root.style.backgroundColor = model.get('backgroundColor') || '#fff';
    // Create elements
    var header = document.createElement('h4');
    var lang = model.get('lang') || [];
    header.innerHTML = lang[0] || model.get('title');
    header.style.cssText = 'margin:10px 20px';
    header.style.color = model.get('textColor');
    var viewMain = document.createElement('div');
    var textarea = document.createElement('textarea');
    viewMain.style.cssText = 'overflow:auto';
    var optionToContent = model.get('optionToContent');
    var contentToOption = model.get('contentToOption');
    var result = getContentFromModel(ecModel);
    if (isFunction(optionToContent)) {
      var htmlOrDom = optionToContent(api.getOption());
      if (isString(htmlOrDom)) {
        viewMain.innerHTML = htmlOrDom;
      } else if (isDom(htmlOrDom)) {
        viewMain.appendChild(htmlOrDom);
      }
    } else {
      // Use default textarea
      textarea.readOnly = model.get('readOnly');
      var style = textarea.style;
      // eslint-disable-next-line max-len
      style.cssText = 'display:block;width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none;box-sizing:border-box;outline:none';
      style.color = model.get('textColor');
      style.borderColor = model.get('textareaBorderColor');
      style.backgroundColor = model.get('textareaColor');
      textarea.value = result.value;
      viewMain.appendChild(textarea);
    }
    var blockMetaList = result.meta;
    var buttonContainer = document.createElement('div');
    buttonContainer.style.cssText = 'position:absolute;bottom:5px;left:0;right:0';
    // eslint-disable-next-line max-len
    var buttonStyle = 'float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px';
    var closeButton = document.createElement('div');
    var refreshButton = document.createElement('div');
    buttonStyle += ';background-color:' + model.get('buttonColor');
    buttonStyle += ';color:' + model.get('buttonTextColor');
    var self = this;
    function close() {
      container.removeChild(root);
      self._dom = null;
    }
    addEventListener(closeButton, 'click', close);
    addEventListener(refreshButton, 'click', function () {
      if (contentToOption == null && optionToContent != null || contentToOption != null && optionToContent == null) {
        {
          // eslint-disable-next-line
          warn('It seems you have just provided one of `contentToOption` and `optionToContent` functions but missed the other one. Data change is ignored.');
        }
        close();
        return;
      }
      var newOption;
      try {
        if (isFunction(contentToOption)) {
          newOption = contentToOption(viewMain, api.getOption());
        } else {
          newOption = parseContents(textarea.value, blockMetaList);
        }
      } catch (e) {
        close();
        throw new Error('Data view format error ' + e);
      }
      if (newOption) {
        api.dispatchAction({
          type: 'changeDataView',
          newOption: newOption
        });
      }
      close();
    });
    closeButton.innerHTML = lang[1];
    refreshButton.innerHTML = lang[2];
    refreshButton.style.cssText = closeButton.style.cssText = buttonStyle;
    !model.get('readOnly') && buttonContainer.appendChild(refreshButton);
    buttonContainer.appendChild(closeButton);
    root.appendChild(header);
    root.appendChild(viewMain);
    root.appendChild(buttonContainer);
    viewMain.style.height = container.clientHeight - 80 + 'px';
    container.appendChild(root);
    this._dom = root;
  };
  DataView.prototype.remove = function (ecModel, api) {
    this._dom && api.getDom().removeChild(this._dom);
  };
  DataView.prototype.dispose = function (ecModel, api) {
    this.remove(ecModel, api);
  };
  DataView.getDefaultOption = function (ecModel) {
    var defaultOption = {
      show: true,
      readOnly: false,
      optionToContent: null,
      contentToOption: null,
      // eslint-disable-next-line
      icon: 'M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28',
      title: ecModel.getLocaleModel().get(['toolbox', 'dataView', 'title']),
      lang: ecModel.getLocaleModel().get(['toolbox', 'dataView', 'lang']),
      backgroundColor: '#fff',
      textColor: '#000',
      textareaColor: '#fff',
      textareaBorderColor: '#333',
      buttonColor: '#c23531',
      buttonTextColor: '#fff'
    };
    return defaultOption;
  };
  return DataView;
}(ToolboxFeature);
/**
 * @inner
 */
function tryMergeDataOption(newData, originalData) {
  return map$1(newData, function (newVal, idx) {
    var original = originalData && originalData[idx];
    if (isObject$3(original) && !isArray$1(original)) {
      var newValIsObject = isObject$3(newVal) && !isArray$1(newVal);
      if (!newValIsObject) {
        newVal = {
          value: newVal
        };
      }
      // original data has name but new data has no name
      var shouldDeleteName = original.name != null && newVal.name == null;
      // Original data has option
      newVal = defaults(newVal, original);
      shouldDeleteName && delete newVal.name;
      return newVal;
    } else {
      return newVal;
    }
  });
}
// TODO: SELF REGISTERED.
registerAction({
  type: 'changeDataView',
  event: 'dataViewChanged',
  update: 'prepareAndUpdate'
}, function (payload, ecModel) {
  var newSeriesOptList = [];
  each$f(payload.newOption.series, function (seriesOpt) {
    var seriesModel = ecModel.getSeriesByName(seriesOpt.name)[0];
    if (!seriesModel) {
      // New created series
      // Geuss the series type
      newSeriesOptList.push(extend({
        // Default is scatter
        type: 'scatter'
      }, seriesOpt));
    } else {
      var originalData = seriesModel.get('data');
      newSeriesOptList.push({
        name: seriesOpt.name,
        data: tryMergeDataOption(seriesOpt.data, originalData)
      });
    }
  });
  ecModel.mergeOption(defaults({
    series: newSeriesOptList
  }, payload.newOption));
});
var DataView$2 = DataView$1;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each$6 = each$f;
var inner$6 = makeInner();
/**
 * @param ecModel
 * @param newSnapshot key is dataZoomId
 */
function push(ecModel, newSnapshot) {
  var storedSnapshots = getStoreSnapshots(ecModel);
  // If previous dataZoom can not be found,
  // complete an range with current range.
  each$6(newSnapshot, function (batchItem, dataZoomId) {
    var i = storedSnapshots.length - 1;
    for (; i >= 0; i--) {
      var snapshot = storedSnapshots[i];
      if (snapshot[dataZoomId]) {
        break;
      }
    }
    if (i < 0) {
      // No origin range set, create one by current range.
      var dataZoomModel = ecModel.queryComponents({
        mainType: 'dataZoom',
        subType: 'select',
        id: dataZoomId
      })[0];
      if (dataZoomModel) {
        var percentRange = dataZoomModel.getPercentRange();
        storedSnapshots[0][dataZoomId] = {
          dataZoomId: dataZoomId,
          start: percentRange[0],
          end: percentRange[1]
        };
      }
    }
  });
  storedSnapshots.push(newSnapshot);
}
function pop(ecModel) {
  var storedSnapshots = getStoreSnapshots(ecModel);
  var head = storedSnapshots[storedSnapshots.length - 1];
  storedSnapshots.length > 1 && storedSnapshots.pop();
  // Find top for all dataZoom.
  var snapshot = {};
  each$6(head, function (batchItem, dataZoomId) {
    for (var i = storedSnapshots.length - 1; i >= 0; i--) {
      batchItem = storedSnapshots[i][dataZoomId];
      if (batchItem) {
        snapshot[dataZoomId] = batchItem;
        break;
      }
    }
  });
  return snapshot;
}
function clear(ecModel) {
  inner$6(ecModel).snapshots = null;
}
function count(ecModel) {
  return getStoreSnapshots(ecModel).length;
}
/**
 * History length of each dataZoom may be different.
 * this._history[0] is used to store origin range.
 */
function getStoreSnapshots(ecModel) {
  var store = inner$6(ecModel);
  if (!store.snapshots) {
    store.snapshots = [{}];
  }
  return store.snapshots;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var RestoreOption = /** @class */function (_super) {
  __extends(RestoreOption, _super);
  function RestoreOption() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  RestoreOption.prototype.onclick = function (ecModel, api) {
    clear(ecModel);
    api.dispatchAction({
      type: 'restore',
      from: this.uid
    });
  };
  RestoreOption.getDefaultOption = function (ecModel) {
    var defaultOption = {
      show: true,
      // eslint-disable-next-line
      icon: 'M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5',
      title: ecModel.getLocaleModel().get(['toolbox', 'restore', 'title'])
    };
    return defaultOption;
  };
  return RestoreOption;
}(ToolboxFeature);
// TODO: SELF REGISTERED.
registerAction({
  type: 'restore',
  event: 'restore',
  update: 'prepareAndUpdate'
}, function (payload, ecModel) {
  ecModel.resetOption('recreate');
});
var Restore = RestoreOption;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// FIXME
// how to genarialize to more coordinate systems.
var INCLUDE_FINDER_MAIN_TYPES = ['grid', 'xAxis', 'yAxis', 'geo', 'graph', 'polar', 'radiusAxis', 'angleAxis', 'bmap'];
var BrushTargetManager = /** @class */function () {
  /**
   * @param finder contains Index/Id/Name of xAxis/yAxis/geo/grid
   *        Each can be {number|Array.<number>}. like: {xAxisIndex: [3, 4]}
   * @param opt.include include coordinate system types.
   */
  function BrushTargetManager(finder, ecModel, opt) {
    var _this = this;
    this._targetInfoList = [];
    var foundCpts = parseFinder(ecModel, finder);
    each$f(targetInfoBuilders, function (builder, type) {
      if (!opt || !opt.include || indexOf(opt.include, type) >= 0) {
        builder(foundCpts, _this._targetInfoList);
      }
    });
  }
  BrushTargetManager.prototype.setOutputRanges = function (areas, ecModel) {
    this.matchOutputRanges(areas, ecModel, function (area, coordRange, coordSys) {
      (area.coordRanges || (area.coordRanges = [])).push(coordRange);
      // area.coordRange is the first of area.coordRanges
      if (!area.coordRange) {
        area.coordRange = coordRange;
        // In 'category' axis, coord to pixel is not reversible, so we can not
        // rebuild range by coordRange accrately, which may bring trouble when
        // brushing only one item. So we use __rangeOffset to rebuilding range
        // by coordRange. And this it only used in brush component so it is no
        // need to be adapted to coordRanges.
        var result = coordConvert[area.brushType](0, coordSys, coordRange);
        area.__rangeOffset = {
          offset: diffProcessor[area.brushType](result.values, area.range, [1, 1]),
          xyMinMax: result.xyMinMax
        };
      }
    });
    return areas;
  };
  BrushTargetManager.prototype.matchOutputRanges = function (areas, ecModel, cb) {
    each$f(areas, function (area) {
      var targetInfo = this.findTargetInfo(area, ecModel);
      if (targetInfo && targetInfo !== true) {
        each$f(targetInfo.coordSyses, function (coordSys) {
          var result = coordConvert[area.brushType](1, coordSys, area.range, true);
          cb(area, result.values, coordSys, ecModel);
        });
      }
    }, this);
  };
  /**
   * the `areas` is `BrushModel.areas`.
   * Called in layout stage.
   * convert `area.coordRange` to global range and set panelId to `area.range`.
   */
  BrushTargetManager.prototype.setInputRanges = function (areas, ecModel) {
    each$f(areas, function (area) {
      var targetInfo = this.findTargetInfo(area, ecModel);
      {
        assert(!targetInfo || targetInfo === true || area.coordRange, 'coordRange must be specified when coord index specified.');
        assert(!targetInfo || targetInfo !== true || area.range, 'range must be specified in global brush.');
      }
      area.range = area.range || [];
      // convert coordRange to global range and set panelId.
      if (targetInfo && targetInfo !== true) {
        area.panelId = targetInfo.panelId;
        // (1) area.range should always be calculate from coordRange but does
        // not keep its original value, for the sake of the dataZoom scenario,
        // where area.coordRange remains unchanged but area.range may be changed.
        // (2) Only support converting one coordRange to pixel range in brush
        // component. So do not consider `coordRanges`.
        // (3) About __rangeOffset, see comment above.
        var result = coordConvert[area.brushType](0, targetInfo.coordSys, area.coordRange);
        var rangeOffset = area.__rangeOffset;
        area.range = rangeOffset ? diffProcessor[area.brushType](result.values, rangeOffset.offset, getScales(result.xyMinMax, rangeOffset.xyMinMax)) : result.values;
      }
    }, this);
  };
  BrushTargetManager.prototype.makePanelOpts = function (api, getDefaultBrushType) {
    return map$1(this._targetInfoList, function (targetInfo) {
      var rect = targetInfo.getPanelRect();
      return {
        panelId: targetInfo.panelId,
        defaultBrushType: getDefaultBrushType ? getDefaultBrushType(targetInfo) : null,
        clipPath: makeRectPanelClipPath(rect),
        isTargetByCursor: makeRectIsTargetByCursor(rect, api, targetInfo.coordSysModel),
        getLinearBrushOtherExtent: makeLinearBrushOtherExtent(rect)
      };
    });
  };
  BrushTargetManager.prototype.controlSeries = function (area, seriesModel, ecModel) {
    // Check whether area is bound in coord, and series do not belong to that coord.
    // If do not do this check, some brush (like lineX) will controll all axes.
    var targetInfo = this.findTargetInfo(area, ecModel);
    return targetInfo === true || targetInfo && indexOf(targetInfo.coordSyses, seriesModel.coordinateSystem) >= 0;
  };
  /**
   * If return Object, a coord found.
   * If return true, global found.
   * Otherwise nothing found.
   */
  BrushTargetManager.prototype.findTargetInfo = function (area, ecModel) {
    var targetInfoList = this._targetInfoList;
    var foundCpts = parseFinder(ecModel, area);
    for (var i = 0; i < targetInfoList.length; i++) {
      var targetInfo = targetInfoList[i];
      var areaPanelId = area.panelId;
      if (areaPanelId) {
        if (targetInfo.panelId === areaPanelId) {
          return targetInfo;
        }
      } else {
        for (var j = 0; j < targetInfoMatchers.length; j++) {
          if (targetInfoMatchers[j](foundCpts, targetInfo)) {
            return targetInfo;
          }
        }
      }
    }
    return true;
  };
  return BrushTargetManager;
}();
function formatMinMax(minMax) {
  minMax[0] > minMax[1] && minMax.reverse();
  return minMax;
}
function parseFinder(ecModel, finder) {
  return parseFinder$1(ecModel, finder, {
    includeMainTypes: INCLUDE_FINDER_MAIN_TYPES
  });
}
var targetInfoBuilders = {
  grid: function (foundCpts, targetInfoList) {
    var xAxisModels = foundCpts.xAxisModels;
    var yAxisModels = foundCpts.yAxisModels;
    var gridModels = foundCpts.gridModels;
    // Remove duplicated.
    var gridModelMap = createHashMap();
    var xAxesHas = {};
    var yAxesHas = {};
    if (!xAxisModels && !yAxisModels && !gridModels) {
      return;
    }
    each$f(xAxisModels, function (axisModel) {
      var gridModel = axisModel.axis.grid.model;
      gridModelMap.set(gridModel.id, gridModel);
      xAxesHas[gridModel.id] = true;
    });
    each$f(yAxisModels, function (axisModel) {
      var gridModel = axisModel.axis.grid.model;
      gridModelMap.set(gridModel.id, gridModel);
      yAxesHas[gridModel.id] = true;
    });
    each$f(gridModels, function (gridModel) {
      gridModelMap.set(gridModel.id, gridModel);
      xAxesHas[gridModel.id] = true;
      yAxesHas[gridModel.id] = true;
    });
    gridModelMap.each(function (gridModel) {
      var grid = gridModel.coordinateSystem;
      var cartesians = [];
      each$f(grid.getCartesians(), function (cartesian, index) {
        if (indexOf(xAxisModels, cartesian.getAxis('x').model) >= 0 || indexOf(yAxisModels, cartesian.getAxis('y').model) >= 0) {
          cartesians.push(cartesian);
        }
      });
      targetInfoList.push({
        panelId: 'grid--' + gridModel.id,
        gridModel: gridModel,
        coordSysModel: gridModel,
        // Use the first one as the representitive coordSys.
        coordSys: cartesians[0],
        coordSyses: cartesians,
        getPanelRect: panelRectBuilders.grid,
        xAxisDeclared: xAxesHas[gridModel.id],
        yAxisDeclared: yAxesHas[gridModel.id]
      });
    });
  },
  geo: function (foundCpts, targetInfoList) {
    each$f(foundCpts.geoModels, function (geoModel) {
      var coordSys = geoModel.coordinateSystem;
      targetInfoList.push({
        panelId: 'geo--' + geoModel.id,
        geoModel: geoModel,
        coordSysModel: geoModel,
        coordSys: coordSys,
        coordSyses: [coordSys],
        getPanelRect: panelRectBuilders.geo
      });
    });
  }
};
var targetInfoMatchers = [
// grid
function (foundCpts, targetInfo) {
  var xAxisModel = foundCpts.xAxisModel;
  var yAxisModel = foundCpts.yAxisModel;
  var gridModel = foundCpts.gridModel;
  !gridModel && xAxisModel && (gridModel = xAxisModel.axis.grid.model);
  !gridModel && yAxisModel && (gridModel = yAxisModel.axis.grid.model);
  return gridModel && gridModel === targetInfo.gridModel;
},
// geo
function (foundCpts, targetInfo) {
  var geoModel = foundCpts.geoModel;
  return geoModel && geoModel === targetInfo.geoModel;
}];
var panelRectBuilders = {
  grid: function () {
    // grid is not Transformable.
    return this.coordSys.master.getRect().clone();
  },
  geo: function () {
    var coordSys = this.coordSys;
    var rect = coordSys.getBoundingRect().clone();
    // geo roam and zoom transform
    rect.applyTransform(getTransform$1(coordSys));
    return rect;
  }
};
var coordConvert = {
  lineX: curry$1(axisConvert, 0),
  lineY: curry$1(axisConvert, 1),
  rect: function (to, coordSys, rangeOrCoordRange, clamp) {
    var xminymin = to ? coordSys.pointToData([rangeOrCoordRange[0][0], rangeOrCoordRange[1][0]], clamp) : coordSys.dataToPoint([rangeOrCoordRange[0][0], rangeOrCoordRange[1][0]], clamp);
    var xmaxymax = to ? coordSys.pointToData([rangeOrCoordRange[0][1], rangeOrCoordRange[1][1]], clamp) : coordSys.dataToPoint([rangeOrCoordRange[0][1], rangeOrCoordRange[1][1]], clamp);
    var values = [formatMinMax([xminymin[0], xmaxymax[0]]), formatMinMax([xminymin[1], xmaxymax[1]])];
    return {
      values: values,
      xyMinMax: values
    };
  },
  polygon: function (to, coordSys, rangeOrCoordRange, clamp) {
    var xyMinMax = [[Infinity, -Infinity], [Infinity, -Infinity]];
    var values = map$1(rangeOrCoordRange, function (item) {
      var p = to ? coordSys.pointToData(item, clamp) : coordSys.dataToPoint(item, clamp);
      xyMinMax[0][0] = Math.min(xyMinMax[0][0], p[0]);
      xyMinMax[1][0] = Math.min(xyMinMax[1][0], p[1]);
      xyMinMax[0][1] = Math.max(xyMinMax[0][1], p[0]);
      xyMinMax[1][1] = Math.max(xyMinMax[1][1], p[1]);
      return p;
    });
    return {
      values: values,
      xyMinMax: xyMinMax
    };
  }
};
function axisConvert(axisNameIndex, to, coordSys, rangeOrCoordRange) {
  {
    assert(coordSys.type === 'cartesian2d', 'lineX/lineY brush is available only in cartesian2d.');
  }
  var axis = coordSys.getAxis(['x', 'y'][axisNameIndex]);
  var values = formatMinMax(map$1([0, 1], function (i) {
    return to ? axis.coordToData(axis.toLocalCoord(rangeOrCoordRange[i]), true) : axis.toGlobalCoord(axis.dataToCoord(rangeOrCoordRange[i]));
  }));
  var xyMinMax = [];
  xyMinMax[axisNameIndex] = values;
  xyMinMax[1 - axisNameIndex] = [NaN, NaN];
  return {
    values: values,
    xyMinMax: xyMinMax
  };
}
var diffProcessor = {
  lineX: curry$1(axisDiffProcessor, 0),
  lineY: curry$1(axisDiffProcessor, 1),
  rect: function (values, refer, scales) {
    return [[values[0][0] - scales[0] * refer[0][0], values[0][1] - scales[0] * refer[0][1]], [values[1][0] - scales[1] * refer[1][0], values[1][1] - scales[1] * refer[1][1]]];
  },
  polygon: function (values, refer, scales) {
    return map$1(values, function (item, idx) {
      return [item[0] - scales[0] * refer[idx][0], item[1] - scales[1] * refer[idx][1]];
    });
  }
};
function axisDiffProcessor(axisNameIndex, values, refer, scales) {
  return [values[0] - scales[axisNameIndex] * refer[0], values[1] - scales[axisNameIndex] * refer[1]];
}
// We have to process scale caused by dataZoom manually,
// although it might be not accurate.
// Return [0~1, 0~1]
function getScales(xyMinMaxCurr, xyMinMaxOrigin) {
  var sizeCurr = getSize(xyMinMaxCurr);
  var sizeOrigin = getSize(xyMinMaxOrigin);
  var scales = [sizeCurr[0] / sizeOrigin[0], sizeCurr[1] / sizeOrigin[1]];
  isNaN(scales[0]) && (scales[0] = 1);
  isNaN(scales[1]) && (scales[1] = 1);
  return scales;
}
function getSize(xyMinMax) {
  return xyMinMax ? [xyMinMax[0][1] - xyMinMax[0][0], xyMinMax[1][1] - xyMinMax[1][0]] : [NaN, NaN];
}
var BrushTargetManager$1 = BrushTargetManager;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each$5 = each$f;
var DATA_ZOOM_ID_BASE = makeInternalComponentId('toolbox-dataZoom_');
var DataZoomFeature = /** @class */function (_super) {
  __extends(DataZoomFeature, _super);
  function DataZoomFeature() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  DataZoomFeature.prototype.render = function (featureModel, ecModel, api, payload) {
    if (!this._brushController) {
      this._brushController = new BrushController$1(api.getZr());
      this._brushController.on('brush', bind$1(this._onBrush, this)).mount();
    }
    updateZoomBtnStatus(featureModel, ecModel, this, payload, api);
    updateBackBtnStatus(featureModel, ecModel);
  };
  DataZoomFeature.prototype.onclick = function (ecModel, api, type) {
    handlers[type].call(this);
  };
  DataZoomFeature.prototype.remove = function (ecModel, api) {
    this._brushController && this._brushController.unmount();
  };
  DataZoomFeature.prototype.dispose = function (ecModel, api) {
    this._brushController && this._brushController.dispose();
  };
  DataZoomFeature.prototype._onBrush = function (eventParam) {
    var areas = eventParam.areas;
    if (!eventParam.isEnd || !areas.length) {
      return;
    }
    var snapshot = {};
    var ecModel = this.ecModel;
    this._brushController.updateCovers([]); // remove cover
    var brushTargetManager = new BrushTargetManager$1(makeAxisFinder(this.model), ecModel, {
      include: ['grid']
    });
    brushTargetManager.matchOutputRanges(areas, ecModel, function (area, coordRange, coordSys) {
      if (coordSys.type !== 'cartesian2d') {
        return;
      }
      var brushType = area.brushType;
      if (brushType === 'rect') {
        setBatch('x', coordSys, coordRange[0]);
        setBatch('y', coordSys, coordRange[1]);
      } else {
        setBatch({
          lineX: 'x',
          lineY: 'y'
        }[brushType], coordSys, coordRange);
      }
    });
    push(ecModel, snapshot);
    this._dispatchZoomAction(snapshot);
    function setBatch(dimName, coordSys, minMax) {
      var axis = coordSys.getAxis(dimName);
      var axisModel = axis.model;
      var dataZoomModel = findDataZoom(dimName, axisModel, ecModel);
      // Restrict range.
      var minMaxSpan = dataZoomModel.findRepresentativeAxisProxy(axisModel).getMinMaxSpan();
      if (minMaxSpan.minValueSpan != null || minMaxSpan.maxValueSpan != null) {
        minMax = sliderMove(0, minMax.slice(), axis.scale.getExtent(), 0, minMaxSpan.minValueSpan, minMaxSpan.maxValueSpan);
      }
      dataZoomModel && (snapshot[dataZoomModel.id] = {
        dataZoomId: dataZoomModel.id,
        startValue: minMax[0],
        endValue: minMax[1]
      });
    }
    function findDataZoom(dimName, axisModel, ecModel) {
      var found;
      ecModel.eachComponent({
        mainType: 'dataZoom',
        subType: 'select'
      }, function (dzModel) {
        var has = dzModel.getAxisModel(dimName, axisModel.componentIndex);
        has && (found = dzModel);
      });
      return found;
    }
  };
  DataZoomFeature.prototype._dispatchZoomAction = function (snapshot) {
    var batch = [];
    // Convert from hash map to array.
    each$5(snapshot, function (batchItem, dataZoomId) {
      batch.push(clone$4(batchItem));
    });
    batch.length && this.api.dispatchAction({
      type: 'dataZoom',
      from: this.uid,
      batch: batch
    });
  };
  DataZoomFeature.getDefaultOption = function (ecModel) {
    var defaultOption = {
      show: true,
      filterMode: 'filter',
      // Icon group
      icon: {
        zoom: 'M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1',
        back: 'M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26'
      },
      // `zoom`, `back`
      title: ecModel.getLocaleModel().get(['toolbox', 'dataZoom', 'title']),
      brushStyle: {
        borderWidth: 0,
        color: 'rgba(210,219,238,0.2)'
      }
    };
    return defaultOption;
  };
  return DataZoomFeature;
}(ToolboxFeature);
var handlers = {
  zoom: function () {
    var nextActive = !this._isZoomActive;
    this.api.dispatchAction({
      type: 'takeGlobalCursor',
      key: 'dataZoomSelect',
      dataZoomSelectActive: nextActive
    });
  },
  back: function () {
    this._dispatchZoomAction(pop(this.ecModel));
  }
};
function makeAxisFinder(dzFeatureModel) {
  var setting = {
    xAxisIndex: dzFeatureModel.get('xAxisIndex', true),
    yAxisIndex: dzFeatureModel.get('yAxisIndex', true),
    xAxisId: dzFeatureModel.get('xAxisId', true),
    yAxisId: dzFeatureModel.get('yAxisId', true)
  };
  // If both `xAxisIndex` `xAxisId` not set, it means 'all'.
  // If both `yAxisIndex` `yAxisId` not set, it means 'all'.
  // Some old cases set like this below to close yAxis control but leave xAxis control:
  // `{ feature: { dataZoom: { yAxisIndex: false } }`.
  if (setting.xAxisIndex == null && setting.xAxisId == null) {
    setting.xAxisIndex = 'all';
  }
  if (setting.yAxisIndex == null && setting.yAxisId == null) {
    setting.yAxisIndex = 'all';
  }
  return setting;
}
function updateBackBtnStatus(featureModel, ecModel) {
  featureModel.setIconStatus('back', count(ecModel) > 1 ? 'emphasis' : 'normal');
}
function updateZoomBtnStatus(featureModel, ecModel, view, payload, api) {
  var zoomActive = view._isZoomActive;
  if (payload && payload.type === 'takeGlobalCursor') {
    zoomActive = payload.key === 'dataZoomSelect' ? payload.dataZoomSelectActive : false;
  }
  view._isZoomActive = zoomActive;
  featureModel.setIconStatus('zoom', zoomActive ? 'emphasis' : 'normal');
  var brushTargetManager = new BrushTargetManager$1(makeAxisFinder(featureModel), ecModel, {
    include: ['grid']
  });
  var panels = brushTargetManager.makePanelOpts(api, function (targetInfo) {
    return targetInfo.xAxisDeclared && !targetInfo.yAxisDeclared ? 'lineX' : !targetInfo.xAxisDeclared && targetInfo.yAxisDeclared ? 'lineY' : 'rect';
  });
  view._brushController.setPanels(panels).enableBrush(zoomActive && panels.length ? {
    brushType: 'auto',
    brushStyle: featureModel.getModel('brushStyle').getItemStyle()
  } : false);
}
registerInternalOptionCreator('dataZoom', function (ecModel) {
  var toolboxModel = ecModel.getComponent('toolbox', 0);
  var featureDataZoomPath = ['feature', 'dataZoom'];
  if (!toolboxModel || toolboxModel.get(featureDataZoomPath) == null) {
    return;
  }
  var dzFeatureModel = toolboxModel.getModel(featureDataZoomPath);
  var dzOptions = [];
  var finder = makeAxisFinder(dzFeatureModel);
  var finderResult = parseFinder$1(ecModel, finder);
  each$5(finderResult.xAxisModels, function (axisModel) {
    return buildInternalOptions(axisModel, 'xAxis', 'xAxisIndex');
  });
  each$5(finderResult.yAxisModels, function (axisModel) {
    return buildInternalOptions(axisModel, 'yAxis', 'yAxisIndex');
  });
  function buildInternalOptions(axisModel, axisMainType, axisIndexPropName) {
    var axisIndex = axisModel.componentIndex;
    var newOpt = {
      type: 'select',
      $fromToolbox: true,
      // Default to be filter
      filterMode: dzFeatureModel.get('filterMode', true) || 'filter',
      // Id for merge mapping.
      id: DATA_ZOOM_ID_BASE + axisMainType + axisIndex
    };
    newOpt[axisIndexPropName] = axisIndex;
    dzOptions.push(newOpt);
  }
  return dzOptions;
});
var DataZoom = DataZoomFeature;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$l(registers) {
  registers.registerComponentModel(ToolboxModel$1);
  registers.registerComponentView(ToolboxView$1);
  registerFeature('saveAsImage', SaveAsImage$1);
  registerFeature('magicType', MagicType$1);
  registerFeature('dataView', DataView$2);
  registerFeature('dataZoom', DataZoom);
  registerFeature('restore', Restore);
  use(install$m);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TooltipModel = /** @class */function (_super) {
  __extends(TooltipModel, _super);
  function TooltipModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = TooltipModel.type;
    return _this;
  }
  TooltipModel.type = 'tooltip';
  TooltipModel.dependencies = ['axisPointer'];
  TooltipModel.defaultOption = {
    // zlevel: 0,
    z: 60,
    show: true,
    // tooltip main content
    showContent: true,
    // 'trigger' only works on coordinate system.
    // 'item' | 'axis' | 'none'
    trigger: 'item',
    // 'click' | 'mousemove' | 'none'
    triggerOn: 'mousemove|click',
    alwaysShowContent: false,
    displayMode: 'single',
    renderMode: 'auto',
    // whether restraint content inside viewRect.
    // If renderMode: 'richText', default true.
    // If renderMode: 'html', defaut false (for backward compat).
    confine: null,
    showDelay: 0,
    hideDelay: 100,
    // Animation transition time, unit is second
    transitionDuration: 0.4,
    enterable: false,
    backgroundColor: '#fff',
    // box shadow
    shadowBlur: 10,
    shadowColor: 'rgba(0, 0, 0, .2)',
    shadowOffsetX: 1,
    shadowOffsetY: 2,
    // tooltip border radius, unit is px, default is 4
    borderRadius: 4,
    // tooltip border width, unit is px, default is 0 (no border)
    borderWidth: 1,
    // Tooltip inside padding, default is 5 for all direction
    // Array is allowed to set up, right, bottom, left, same with css
    // The default value: See `tooltip/tooltipMarkup.ts#getPaddingFromTooltipModel`.
    padding: null,
    // Extra css text
    extraCssText: '',
    // axis indicator, trigger by axis
    axisPointer: {
      // default is line
      // legal values: 'line' | 'shadow' | 'cross'
      type: 'line',
      // Valid when type is line, appoint tooltip line locate on which line. Optional
      // legal values: 'x' | 'y' | 'angle' | 'radius' | 'auto'
      // default is 'auto', chose the axis which type is category.
      // for multiply y axis, cartesian coord chose x axis, polar chose angle axis
      axis: 'auto',
      animation: 'auto',
      animationDurationUpdate: 200,
      animationEasingUpdate: 'exponentialOut',
      crossStyle: {
        color: '#999',
        width: 1,
        type: 'dashed',
        // TODO formatter
        textStyle: {}
      }
      // lineStyle and shadowStyle should not be specified here,
      // otherwise it will always override those styles on option.axisPointer.
    },
    textStyle: {
      color: '#666',
      fontSize: 14
    }
  };
  return TooltipModel;
}(ComponentModel$1);
var TooltipModel$1 = TooltipModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* global document */
function shouldTooltipConfine(tooltipModel) {
  var confineOption = tooltipModel.get('confine');
  return confineOption != null ? !!confineOption
  // In richText mode, the outside part can not be visible.
  : tooltipModel.get('renderMode') === 'richText';
}
function testStyle(styleProps) {
  if (!env$1.domSupported) {
    return;
  }
  var style = document.documentElement.style;
  for (var i = 0, len = styleProps.length; i < len; i++) {
    if (styleProps[i] in style) {
      return styleProps[i];
    }
  }
}
var TRANSFORM_VENDOR = testStyle(['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']);
var TRANSITION_VENDOR = testStyle(['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']);
function toCSSVendorPrefix(styleVendor, styleProp) {
  if (!styleVendor) {
    return styleProp;
  }
  styleProp = toCamelCase(styleProp, true);
  var idx = styleVendor.indexOf(styleProp);
  styleVendor = idx === -1 ? styleProp : "-" + styleVendor.slice(0, idx) + "-" + styleProp;
  return styleVendor.toLowerCase();
}
function getComputedStyle$1(el, style) {
  var stl = el.currentStyle || document.defaultView && document.defaultView.getComputedStyle(el);
  return stl ? style ? stl[style] : stl : null;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* global document, window */
var CSS_TRANSITION_VENDOR = toCSSVendorPrefix(TRANSITION_VENDOR, 'transition');
var CSS_TRANSFORM_VENDOR = toCSSVendorPrefix(TRANSFORM_VENDOR, 'transform');
// eslint-disable-next-line
var gCssText = "position:absolute;display:block;border-style:solid;white-space:nowrap;z-index:9999999;" + (env$1.transform3dSupported ? 'will-change:transform;' : '');
function mirrorPos(pos) {
  pos = pos === 'left' ? 'right' : pos === 'right' ? 'left' : pos === 'top' ? 'bottom' : 'top';
  return pos;
}
function assembleArrow(tooltipModel, borderColor, arrowPosition) {
  if (!isString(arrowPosition) || arrowPosition === 'inside') {
    return '';
  }
  var backgroundColor = tooltipModel.get('backgroundColor');
  var borderWidth = tooltipModel.get('borderWidth');
  borderColor = convertToColorString(borderColor);
  var arrowPos = mirrorPos(arrowPosition);
  var arrowSize = Math.max(Math.round(borderWidth) * 1.5, 6);
  var positionStyle = '';
  var transformStyle = CSS_TRANSFORM_VENDOR + ':';
  var rotateDeg;
  if (indexOf(['left', 'right'], arrowPos) > -1) {
    positionStyle += 'top:50%';
    transformStyle += "translateY(-50%) rotate(" + (rotateDeg = arrowPos === 'left' ? -225 : -45) + "deg)";
  } else {
    positionStyle += 'left:50%';
    transformStyle += "translateX(-50%) rotate(" + (rotateDeg = arrowPos === 'top' ? 225 : 45) + "deg)";
  }
  var rotateRadian = rotateDeg * Math.PI / 180;
  var arrowWH = arrowSize + borderWidth;
  var rotatedWH = arrowWH * Math.abs(Math.cos(rotateRadian)) + arrowWH * Math.abs(Math.sin(rotateRadian));
  var arrowOffset = Math.round(((rotatedWH - Math.SQRT2 * borderWidth) / 2 + Math.SQRT2 * borderWidth - (rotatedWH - arrowWH) / 2) * 100) / 100;
  positionStyle += ";" + arrowPos + ":-" + arrowOffset + "px";
  var borderStyle = borderColor + " solid " + borderWidth + "px;";
  var styleCss = ["position:absolute;width:" + arrowSize + "px;height:" + arrowSize + "px;z-index:-1;", positionStyle + ";" + transformStyle + ";", "border-bottom:" + borderStyle, "border-right:" + borderStyle, "background-color:" + backgroundColor + ";"];
  return "<div style=\"" + styleCss.join('') + "\"></div>";
}
function assembleTransition(duration, onlyFade) {
  var transitionCurve = 'cubic-bezier(0.23,1,0.32,1)';
  var transitionOption = " " + duration / 2 + "s " + transitionCurve;
  var transitionText = "opacity" + transitionOption + ",visibility" + transitionOption;
  if (!onlyFade) {
    transitionOption = " " + duration + "s " + transitionCurve;
    transitionText += env$1.transformSupported ? "," + CSS_TRANSFORM_VENDOR + transitionOption : ",left" + transitionOption + ",top" + transitionOption;
  }
  return CSS_TRANSITION_VENDOR + ':' + transitionText;
}
function assembleTransform(x, y, toString) {
  // If using float on style, the final width of the dom might
  // keep changing slightly while mouse move. So `toFixed(0)` them.
  var x0 = x.toFixed(0) + 'px';
  var y0 = y.toFixed(0) + 'px';
  // not support transform, use `left` and `top` instead.
  if (!env$1.transformSupported) {
    return toString ? "top:" + y0 + ";left:" + x0 + ";" : [['top', y0], ['left', x0]];
  }
  // support transform
  var is3d = env$1.transform3dSupported;
  var translate = "translate" + (is3d ? '3d' : '') + "(" + x0 + "," + y0 + (is3d ? ',0' : '') + ")";
  return toString ? 'top:0;left:0;' + CSS_TRANSFORM_VENDOR + ':' + translate + ';' : [['top', 0], ['left', 0], [TRANSFORM_VENDOR, translate]];
}
/**
 * @param {Object} textStyle
 * @return {string}
 * @inner
 */
function assembleFont(textStyleModel) {
  var cssText = [];
  var fontSize = textStyleModel.get('fontSize');
  var color = textStyleModel.getTextColor();
  color && cssText.push('color:' + color);
  cssText.push('font:' + textStyleModel.getFont());
  // @ts-ignore, leave it to the tooltip refactor.
  var lineHeight = retrieve2(textStyleModel.get('lineHeight'), Math.round(fontSize * 3 / 2));
  fontSize && cssText.push('line-height:' + lineHeight + 'px');
  var shadowColor = textStyleModel.get('textShadowColor');
  var shadowBlur = textStyleModel.get('textShadowBlur') || 0;
  var shadowOffsetX = textStyleModel.get('textShadowOffsetX') || 0;
  var shadowOffsetY = textStyleModel.get('textShadowOffsetY') || 0;
  shadowColor && shadowBlur && cssText.push('text-shadow:' + shadowOffsetX + 'px ' + shadowOffsetY + 'px ' + shadowBlur + 'px ' + shadowColor);
  each$f(['decoration', 'align'], function (name) {
    var val = textStyleModel.get(name);
    val && cssText.push('text-' + name + ':' + val);
  });
  return cssText.join(';');
}
function assembleCssText(tooltipModel, enableTransition, onlyFade) {
  var cssText = [];
  var transitionDuration = tooltipModel.get('transitionDuration');
  var backgroundColor = tooltipModel.get('backgroundColor');
  var shadowBlur = tooltipModel.get('shadowBlur');
  var shadowColor = tooltipModel.get('shadowColor');
  var shadowOffsetX = tooltipModel.get('shadowOffsetX');
  var shadowOffsetY = tooltipModel.get('shadowOffsetY');
  var textStyleModel = tooltipModel.getModel('textStyle');
  var padding = getPaddingFromTooltipModel(tooltipModel, 'html');
  var boxShadow = shadowOffsetX + "px " + shadowOffsetY + "px " + shadowBlur + "px " + shadowColor;
  cssText.push('box-shadow:' + boxShadow);
  // Animation transition. Do not animate when transitionDuration is 0.
  enableTransition && transitionDuration && cssText.push(assembleTransition(transitionDuration, onlyFade));
  if (backgroundColor) {
    cssText.push('background-color:' + backgroundColor);
  }
  // Border style
  each$f(['width', 'color', 'radius'], function (name) {
    var borderName = 'border-' + name;
    var camelCase = toCamelCase(borderName);
    var val = tooltipModel.get(camelCase);
    val != null && cssText.push(borderName + ':' + val + (name === 'color' ? '' : 'px'));
  });
  // Text style
  cssText.push(assembleFont(textStyleModel));
  // Padding
  if (padding != null) {
    cssText.push('padding:' + normalizeCssArray(padding).join('px ') + 'px');
  }
  return cssText.join(';') + ';';
}
// If not able to make, do not modify the input `out`.
function makeStyleCoord$1(out, zr, container, zrX, zrY) {
  var zrPainter = zr && zr.painter;
  if (container) {
    var zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
    if (zrViewportRoot) {
      // Some APPs might use scale on body, so we support CSS transform here.
      transformLocalCoord(out, zrViewportRoot, container, zrX, zrY);
    }
  } else {
    out[0] = zrX;
    out[1] = zrY;
    // xy should be based on canvas root. But tooltipContent is
    // the sibling of canvas root. So padding of ec container
    // should be considered here.
    var viewportRootOffset = zrPainter && zrPainter.getViewportRootOffset();
    if (viewportRootOffset) {
      out[0] += viewportRootOffset.offsetLeft;
      out[1] += viewportRootOffset.offsetTop;
    }
  }
  out[2] = out[0] / zr.getWidth();
  out[3] = out[1] / zr.getHeight();
}
var TooltipHTMLContent = /** @class */function () {
  function TooltipHTMLContent(api, opt) {
    this._show = false;
    this._styleCoord = [0, 0, 0, 0];
    this._enterable = true;
    this._alwaysShowContent = false;
    this._firstShow = true;
    this._longHide = true;
    if (env$1.wxa) {
      return null;
    }
    var el = document.createElement('div');
    // TODO: TYPE
    el.domBelongToZr = true;
    this.el = el;
    var zr = this._zr = api.getZr();
    var appendTo = opt.appendTo;
    var container = appendTo && (isString(appendTo) ? document.querySelector(appendTo) : isDom(appendTo) ? appendTo : isFunction(appendTo) && appendTo(api.getDom()));
    makeStyleCoord$1(this._styleCoord, zr, container, api.getWidth() / 2, api.getHeight() / 2);
    (container || api.getDom()).appendChild(el);
    this._api = api;
    this._container = container;
    // FIXME
    // Is it needed to trigger zr event manually if
    // the browser do not support `pointer-events: none`.
    var self = this;
    el.onmouseenter = function () {
      // clear the timeout in hideLater and keep showing tooltip
      if (self._enterable) {
        clearTimeout(self._hideTimeout);
        self._show = true;
      }
      self._inContent = true;
    };
    el.onmousemove = function (e) {
      e = e || window.event;
      if (!self._enterable) {
        // `pointer-events: none` is set to tooltip content div
        // if `enterable` is set as `false`, and `el.onmousemove`
        // can not be triggered. But in browser that do not
        // support `pointer-events`, we need to do this:
        // Try trigger zrender event to avoid mouse
        // in and out shape too frequently
        var handler = zr.handler;
        var zrViewportRoot = zr.painter.getViewportRoot();
        normalizeEvent(zrViewportRoot, e, true);
        handler.dispatch('mousemove', e);
      }
    };
    el.onmouseleave = function () {
      // set `_inContent` to `false` before `hideLater`
      self._inContent = false;
      if (self._enterable) {
        if (self._show) {
          self.hideLater(self._hideDelay);
        }
      }
    };
  }
  /**
   * Update when tooltip is rendered
   */
  TooltipHTMLContent.prototype.update = function (tooltipModel) {
    // FIXME
    // Move this logic to ec main?
    if (!this._container) {
      var container = this._api.getDom();
      var position = getComputedStyle$1(container, 'position');
      var domStyle = container.style;
      if (domStyle.position !== 'absolute' && position !== 'absolute') {
        domStyle.position = 'relative';
      }
    }
    // move tooltip if chart resized
    var alwaysShowContent = tooltipModel.get('alwaysShowContent');
    alwaysShowContent && this._moveIfResized();
    // update alwaysShowContent
    this._alwaysShowContent = alwaysShowContent;
    // update className
    this.el.className = tooltipModel.get('className') || '';
    // Hide the tooltip
    // PENDING
    // this.hide();
  };
  TooltipHTMLContent.prototype.show = function (tooltipModel, nearPointColor) {
    clearTimeout(this._hideTimeout);
    clearTimeout(this._longHideTimeout);
    var el = this.el;
    var style = el.style;
    var styleCoord = this._styleCoord;
    if (!el.innerHTML) {
      style.display = 'none';
    } else {
      style.cssText = gCssText + assembleCssText(tooltipModel, !this._firstShow, this._longHide)
      // initial transform
      + assembleTransform(styleCoord[0], styleCoord[1], true) + ("border-color:" + convertToColorString(nearPointColor) + ";") + (tooltipModel.get('extraCssText') || '')
      // If mouse occasionally move over the tooltip, a mouseout event will be
      // triggered by canvas, and cause some unexpectable result like dragging
      // stop, "unfocusAdjacency". Here `pointer-events: none` is used to solve
      // it. Although it is not supported by IE8~IE10, fortunately it is a rare
      // scenario.
      + (";pointer-events:" + (this._enterable ? 'auto' : 'none'));
    }
    this._show = true;
    this._firstShow = false;
    this._longHide = false;
  };
  TooltipHTMLContent.prototype.setContent = function (content, markers, tooltipModel, borderColor, arrowPosition) {
    var el = this.el;
    if (content == null) {
      el.innerHTML = '';
      return;
    }
    var arrow = '';
    if (isString(arrowPosition) && tooltipModel.get('trigger') === 'item' && !shouldTooltipConfine(tooltipModel)) {
      arrow = assembleArrow(tooltipModel, borderColor, arrowPosition);
    }
    if (isString(content)) {
      el.innerHTML = content + arrow;
    } else if (content) {
      // Clear previous
      el.innerHTML = '';
      if (!isArray$1(content)) {
        content = [content];
      }
      for (var i = 0; i < content.length; i++) {
        if (isDom(content[i]) && content[i].parentNode !== el) {
          el.appendChild(content[i]);
        }
      }
      // no arrow if empty
      if (arrow && el.childNodes.length) {
        // no need to create a new parent element, but it's not supported by IE 10 and older.
        // const arrowEl = document.createRange().createContextualFragment(arrow);
        var arrowEl = document.createElement('div');
        arrowEl.innerHTML = arrow;
        el.appendChild(arrowEl);
      }
    }
  };
  TooltipHTMLContent.prototype.setEnterable = function (enterable) {
    this._enterable = enterable;
  };
  TooltipHTMLContent.prototype.getSize = function () {
    var el = this.el;
    return el ? [el.offsetWidth, el.offsetHeight] : [0, 0];
  };
  TooltipHTMLContent.prototype.moveTo = function (zrX, zrY) {
    if (!this.el) {
      return;
    }
    var styleCoord = this._styleCoord;
    makeStyleCoord$1(styleCoord, this._zr, this._container, zrX, zrY);
    if (styleCoord[0] != null && styleCoord[1] != null) {
      var style_1 = this.el.style;
      var transforms = assembleTransform(styleCoord[0], styleCoord[1]);
      each$f(transforms, function (transform) {
        style_1[transform[0]] = transform[1];
      });
    }
  };
  /**
   * when `alwaysShowContent` is true,
   * move the tooltip after chart resized
   */
  TooltipHTMLContent.prototype._moveIfResized = function () {
    // The ratio of left to width
    var ratioX = this._styleCoord[2];
    // The ratio of top to height
    var ratioY = this._styleCoord[3];
    this.moveTo(ratioX * this._zr.getWidth(), ratioY * this._zr.getHeight());
  };
  TooltipHTMLContent.prototype.hide = function () {
    var _this = this;
    var style = this.el.style;
    style.visibility = 'hidden';
    style.opacity = '0';
    env$1.transform3dSupported && (style.willChange = '');
    this._show = false;
    this._longHideTimeout = setTimeout(function () {
      return _this._longHide = true;
    }, 500);
  };
  TooltipHTMLContent.prototype.hideLater = function (time) {
    if (this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent) {
      if (time) {
        this._hideDelay = time;
        // Set show false to avoid invoke hideLater multiple times
        this._show = false;
        this._hideTimeout = setTimeout(bind$1(this.hide, this), time);
      } else {
        this.hide();
      }
    }
  };
  TooltipHTMLContent.prototype.isShow = function () {
    return this._show;
  };
  TooltipHTMLContent.prototype.dispose = function () {
    clearTimeout(this._hideTimeout);
    clearTimeout(this._longHideTimeout);
    var parentNode = this.el.parentNode;
    parentNode && parentNode.removeChild(this.el);
    this.el = this._container = null;
  };
  return TooltipHTMLContent;
}();
var TooltipHTMLContent$1 = TooltipHTMLContent;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TooltipRichContent = /** @class */function () {
  function TooltipRichContent(api) {
    this._show = false;
    this._styleCoord = [0, 0, 0, 0];
    this._alwaysShowContent = false;
    this._enterable = true;
    this._zr = api.getZr();
    makeStyleCoord(this._styleCoord, this._zr, api.getWidth() / 2, api.getHeight() / 2);
  }
  /**
   * Update when tooltip is rendered
   */
  TooltipRichContent.prototype.update = function (tooltipModel) {
    var alwaysShowContent = tooltipModel.get('alwaysShowContent');
    alwaysShowContent && this._moveIfResized();
    // update alwaysShowContent
    this._alwaysShowContent = alwaysShowContent;
  };
  TooltipRichContent.prototype.show = function () {
    if (this._hideTimeout) {
      clearTimeout(this._hideTimeout);
    }
    this.el.show();
    this._show = true;
  };
  /**
   * Set tooltip content
   */
  TooltipRichContent.prototype.setContent = function (content, markupStyleCreator, tooltipModel, borderColor, arrowPosition) {
    var _this = this;
    if (isObject$3(content)) {
      throwError('Passing DOM nodes as content is not supported in richText tooltip!' );
    }
    if (this.el) {
      this._zr.remove(this.el);
    }
    var textStyleModel = tooltipModel.getModel('textStyle');
    this.el = new ZRText$1({
      style: {
        rich: markupStyleCreator.richTextStyles,
        text: content,
        lineHeight: 22,
        borderWidth: 1,
        borderColor: borderColor,
        textShadowColor: textStyleModel.get('textShadowColor'),
        fill: tooltipModel.get(['textStyle', 'color']),
        padding: getPaddingFromTooltipModel(tooltipModel, 'richText'),
        verticalAlign: 'top',
        align: 'left'
      },
      z: tooltipModel.get('z')
    });
    each$f(['backgroundColor', 'borderRadius', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'], function (propName) {
      _this.el.style[propName] = tooltipModel.get(propName);
    });
    each$f(['textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'], function (propName) {
      _this.el.style[propName] = textStyleModel.get(propName) || 0;
    });
    this._zr.add(this.el);
    var self = this;
    this.el.on('mouseover', function () {
      // clear the timeout in hideLater and keep showing tooltip
      if (self._enterable) {
        clearTimeout(self._hideTimeout);
        self._show = true;
      }
      self._inContent = true;
    });
    this.el.on('mouseout', function () {
      if (self._enterable) {
        if (self._show) {
          self.hideLater(self._hideDelay);
        }
      }
      self._inContent = false;
    });
  };
  TooltipRichContent.prototype.setEnterable = function (enterable) {
    this._enterable = enterable;
  };
  TooltipRichContent.prototype.getSize = function () {
    var el = this.el;
    var bounding = this.el.getBoundingRect();
    // bounding rect does not include shadow. For renderMode richText,
    // if overflow, it will be cut. So calculate them accurately.
    var shadowOuterSize = calcShadowOuterSize(el.style);
    return [bounding.width + shadowOuterSize.left + shadowOuterSize.right, bounding.height + shadowOuterSize.top + shadowOuterSize.bottom];
  };
  TooltipRichContent.prototype.moveTo = function (x, y) {
    var el = this.el;
    if (el) {
      var styleCoord = this._styleCoord;
      makeStyleCoord(styleCoord, this._zr, x, y);
      x = styleCoord[0];
      y = styleCoord[1];
      var style = el.style;
      var borderWidth = mathMaxWith0(style.borderWidth || 0);
      var shadowOuterSize = calcShadowOuterSize(style);
      // rich text x, y do not include border.
      el.x = x + borderWidth + shadowOuterSize.left;
      el.y = y + borderWidth + shadowOuterSize.top;
      el.markRedraw();
    }
  };
  /**
   * when `alwaysShowContent` is true,
   * move the tooltip after chart resized
   */
  TooltipRichContent.prototype._moveIfResized = function () {
    // The ratio of left to width
    var ratioX = this._styleCoord[2];
    // The ratio of top to height
    var ratioY = this._styleCoord[3];
    this.moveTo(ratioX * this._zr.getWidth(), ratioY * this._zr.getHeight());
  };
  TooltipRichContent.prototype.hide = function () {
    if (this.el) {
      this.el.hide();
    }
    this._show = false;
  };
  TooltipRichContent.prototype.hideLater = function (time) {
    if (this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent) {
      if (time) {
        this._hideDelay = time;
        // Set show false to avoid invoke hideLater multiple times
        this._show = false;
        this._hideTimeout = setTimeout(bind$1(this.hide, this), time);
      } else {
        this.hide();
      }
    }
  };
  TooltipRichContent.prototype.isShow = function () {
    return this._show;
  };
  TooltipRichContent.prototype.dispose = function () {
    this._zr.remove(this.el);
  };
  return TooltipRichContent;
}();
function mathMaxWith0(val) {
  return Math.max(0, val);
}
function calcShadowOuterSize(style) {
  var shadowBlur = mathMaxWith0(style.shadowBlur || 0);
  var shadowOffsetX = mathMaxWith0(style.shadowOffsetX || 0);
  var shadowOffsetY = mathMaxWith0(style.shadowOffsetY || 0);
  return {
    left: mathMaxWith0(shadowBlur - shadowOffsetX),
    right: mathMaxWith0(shadowBlur + shadowOffsetX),
    top: mathMaxWith0(shadowBlur - shadowOffsetY),
    bottom: mathMaxWith0(shadowBlur + shadowOffsetY)
  };
}
function makeStyleCoord(out, zr, zrX, zrY) {
  out[0] = zrX;
  out[1] = zrY;
  out[2] = out[0] / zr.getWidth();
  out[3] = out[1] / zr.getHeight();
}
var TooltipRichContent$1 = TooltipRichContent;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var proxyRect = new Rect$3({
  shape: {
    x: -1,
    y: -1,
    width: 2,
    height: 2
  }
});
var TooltipView = /** @class */function (_super) {
  __extends(TooltipView, _super);
  function TooltipView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = TooltipView.type;
    return _this;
  }
  TooltipView.prototype.init = function (ecModel, api) {
    if (env$1.node || !api.getDom()) {
      return;
    }
    var tooltipModel = ecModel.getComponent('tooltip');
    var renderMode = this._renderMode = getTooltipRenderMode(tooltipModel.get('renderMode'));
    this._tooltipContent = renderMode === 'richText' ? new TooltipRichContent$1(api) : new TooltipHTMLContent$1(api, {
      appendTo: tooltipModel.get('appendToBody', true) ? 'body' : tooltipModel.get('appendTo', true)
    });
  };
  TooltipView.prototype.render = function (tooltipModel, ecModel, api) {
    if (env$1.node || !api.getDom()) {
      return;
    }
    // Reset
    this.group.removeAll();
    this._tooltipModel = tooltipModel;
    this._ecModel = ecModel;
    this._api = api;
    var tooltipContent = this._tooltipContent;
    tooltipContent.update(tooltipModel);
    tooltipContent.setEnterable(tooltipModel.get('enterable'));
    this._initGlobalListener();
    this._keepShow();
    // PENDING
    // `mousemove` event will be triggered very frequently when the mouse moves fast,
    // which causes that the `updatePosition` function was also called frequently.
    // In Chrome with devtools open and Firefox, tooltip looks laggy and shakes. See #14695 #16101
    // To avoid frequent triggering,
    // consider throttling it in 50ms when transition is enabled
    if (this._renderMode !== 'richText' && tooltipModel.get('transitionDuration')) {
      createOrUpdate(this, '_updatePosition', 50, 'fixRate');
    } else {
      clear$1(this, '_updatePosition');
    }
  };
  TooltipView.prototype._initGlobalListener = function () {
    var tooltipModel = this._tooltipModel;
    var triggerOn = tooltipModel.get('triggerOn');
    register('itemTooltip', this._api, bind$1(function (currTrigger, e, dispatchAction) {
      // If 'none', it is not controlled by mouse totally.
      if (triggerOn !== 'none') {
        if (triggerOn.indexOf(currTrigger) >= 0) {
          this._tryShow(e, dispatchAction);
        } else if (currTrigger === 'leave') {
          this._hide(dispatchAction);
        }
      }
    }, this));
  };
  TooltipView.prototype._keepShow = function () {
    var tooltipModel = this._tooltipModel;
    var ecModel = this._ecModel;
    var api = this._api;
    var triggerOn = tooltipModel.get('triggerOn');
    // Try to keep the tooltip show when refreshing
    if (this._lastX != null && this._lastY != null
    // When user is willing to control tooltip totally using API,
    // self.manuallyShowTip({x, y}) might cause tooltip hide,
    // which is not expected.
    && triggerOn !== 'none' && triggerOn !== 'click') {
      var self_1 = this;
      clearTimeout(this._refreshUpdateTimeout);
      this._refreshUpdateTimeout = setTimeout(function () {
        // Show tip next tick after other charts are rendered
        // In case highlight action has wrong result
        // FIXME
        !api.isDisposed() && self_1.manuallyShowTip(tooltipModel, ecModel, api, {
          x: self_1._lastX,
          y: self_1._lastY,
          dataByCoordSys: self_1._lastDataByCoordSys
        });
      });
    }
  };
  /**
   * Show tip manually by
   * dispatchAction({
   *     type: 'showTip',
   *     x: 10,
   *     y: 10
   * });
   * Or
   * dispatchAction({
   *      type: 'showTip',
   *      seriesIndex: 0,
   *      dataIndex or dataIndexInside or name
   * });
   *
   *  TODO Batch
   */
  TooltipView.prototype.manuallyShowTip = function (tooltipModel, ecModel, api, payload) {
    if (payload.from === this.uid || env$1.node || !api.getDom()) {
      return;
    }
    var dispatchAction = makeDispatchAction(payload, api);
    // Reset ticket
    this._ticket = '';
    // When triggered from axisPointer.
    var dataByCoordSys = payload.dataByCoordSys;
    var cmptRef = findComponentReference(payload, ecModel, api);
    if (cmptRef) {
      var rect = cmptRef.el.getBoundingRect().clone();
      rect.applyTransform(cmptRef.el.transform);
      this._tryShow({
        offsetX: rect.x + rect.width / 2,
        offsetY: rect.y + rect.height / 2,
        target: cmptRef.el,
        position: payload.position,
        // When manully trigger, the mouse is not on the el, so we'd better to
        // position tooltip on the bottom of the el and display arrow is possible.
        positionDefault: 'bottom'
      }, dispatchAction);
    } else if (payload.tooltip && payload.x != null && payload.y != null) {
      var el = proxyRect;
      el.x = payload.x;
      el.y = payload.y;
      el.update();
      getECData(el).tooltipConfig = {
        name: null,
        option: payload.tooltip
      };
      // Manually show tooltip while view is not using zrender elements.
      this._tryShow({
        offsetX: payload.x,
        offsetY: payload.y,
        target: el
      }, dispatchAction);
    } else if (dataByCoordSys) {
      this._tryShow({
        offsetX: payload.x,
        offsetY: payload.y,
        position: payload.position,
        dataByCoordSys: dataByCoordSys,
        tooltipOption: payload.tooltipOption
      }, dispatchAction);
    } else if (payload.seriesIndex != null) {
      if (this._manuallyAxisShowTip(tooltipModel, ecModel, api, payload)) {
        return;
      }
      var pointInfo = findPointFromSeries(payload, ecModel);
      var cx = pointInfo.point[0];
      var cy = pointInfo.point[1];
      if (cx != null && cy != null) {
        this._tryShow({
          offsetX: cx,
          offsetY: cy,
          target: pointInfo.el,
          position: payload.position,
          // When manully trigger, the mouse is not on the el, so we'd better to
          // position tooltip on the bottom of the el and display arrow is possible.
          positionDefault: 'bottom'
        }, dispatchAction);
      }
    } else if (payload.x != null && payload.y != null) {
      // FIXME
      // should wrap dispatchAction like `axisPointer/globalListener` ?
      api.dispatchAction({
        type: 'updateAxisPointer',
        x: payload.x,
        y: payload.y
      });
      this._tryShow({
        offsetX: payload.x,
        offsetY: payload.y,
        position: payload.position,
        target: api.getZr().findHover(payload.x, payload.y).target
      }, dispatchAction);
    }
  };
  TooltipView.prototype.manuallyHideTip = function (tooltipModel, ecModel, api, payload) {
    var tooltipContent = this._tooltipContent;
    if (this._tooltipModel) {
      tooltipContent.hideLater(this._tooltipModel.get('hideDelay'));
    }
    this._lastX = this._lastY = this._lastDataByCoordSys = null;
    if (payload.from !== this.uid) {
      this._hide(makeDispatchAction(payload, api));
    }
  };
  // Be compatible with previous design, that is, when tooltip.type is 'axis' and
  // dispatchAction 'showTip' with seriesIndex and dataIndex will trigger axis pointer
  // and tooltip.
  TooltipView.prototype._manuallyAxisShowTip = function (tooltipModel, ecModel, api, payload) {
    var seriesIndex = payload.seriesIndex;
    var dataIndex = payload.dataIndex;
    // @ts-ignore
    var coordSysAxesInfo = ecModel.getComponent('axisPointer').coordSysAxesInfo;
    if (seriesIndex == null || dataIndex == null || coordSysAxesInfo == null) {
      return;
    }
    var seriesModel = ecModel.getSeriesByIndex(seriesIndex);
    if (!seriesModel) {
      return;
    }
    var data = seriesModel.getData();
    var tooltipCascadedModel = buildTooltipModel([data.getItemModel(dataIndex), seriesModel, (seriesModel.coordinateSystem || {}).model], this._tooltipModel);
    if (tooltipCascadedModel.get('trigger') !== 'axis') {
      return;
    }
    api.dispatchAction({
      type: 'updateAxisPointer',
      seriesIndex: seriesIndex,
      dataIndex: dataIndex,
      position: payload.position
    });
    return true;
  };
  TooltipView.prototype._tryShow = function (e, dispatchAction) {
    var el = e.target;
    var tooltipModel = this._tooltipModel;
    if (!tooltipModel) {
      return;
    }
    // Save mouse x, mouse y. So we can try to keep showing the tip if chart is refreshed
    this._lastX = e.offsetX;
    this._lastY = e.offsetY;
    var dataByCoordSys = e.dataByCoordSys;
    if (dataByCoordSys && dataByCoordSys.length) {
      this._showAxisTooltip(dataByCoordSys, e);
    } else if (el) {
      var ecData = getECData(el);
      if (ecData.ssrType === 'legend') {
        // Don't trigger tooltip for legend tooltip item
        return;
      }
      this._lastDataByCoordSys = null;
      var seriesDispatcher_1;
      var cmptDispatcher_1;
      findEventDispatcher(el, function (target) {
        // Always show item tooltip if mouse is on the element with dataIndex
        if (getECData(target).dataIndex != null) {
          seriesDispatcher_1 = target;
          return true;
        }
        // Tooltip provided directly. Like legend.
        if (getECData(target).tooltipConfig != null) {
          cmptDispatcher_1 = target;
          return true;
        }
      }, true);
      if (seriesDispatcher_1) {
        this._showSeriesItemTooltip(e, seriesDispatcher_1, dispatchAction);
      } else if (cmptDispatcher_1) {
        this._showComponentItemTooltip(e, cmptDispatcher_1, dispatchAction);
      } else {
        this._hide(dispatchAction);
      }
    } else {
      this._lastDataByCoordSys = null;
      this._hide(dispatchAction);
    }
  };
  TooltipView.prototype._showOrMove = function (tooltipModel, cb) {
    // showDelay is used in this case: tooltip.enterable is set
    // as true. User intent to move mouse into tooltip and click
    // something. `showDelay` makes it easier to enter the content
    // but tooltip do not move immediately.
    var delay = tooltipModel.get('showDelay');
    cb = bind$1(cb, this);
    clearTimeout(this._showTimout);
    delay > 0 ? this._showTimout = setTimeout(cb, delay) : cb();
  };
  TooltipView.prototype._showAxisTooltip = function (dataByCoordSys, e) {
    var ecModel = this._ecModel;
    var globalTooltipModel = this._tooltipModel;
    var point = [e.offsetX, e.offsetY];
    var singleTooltipModel = buildTooltipModel([e.tooltipOption], globalTooltipModel);
    var renderMode = this._renderMode;
    var cbParamsList = [];
    var articleMarkup = createTooltipMarkup('section', {
      blocks: [],
      noHeader: true
    });
    // Only for legacy: `Serise['formatTooltip']` returns a string.
    var markupTextArrLegacy = [];
    var markupStyleCreator = new TooltipMarkupStyleCreator();
    each$f(dataByCoordSys, function (itemCoordSys) {
      each$f(itemCoordSys.dataByAxis, function (axisItem) {
        var axisModel = ecModel.getComponent(axisItem.axisDim + 'Axis', axisItem.axisIndex);
        var axisValue = axisItem.value;
        if (!axisModel || axisValue == null) {
          return;
        }
        var axisValueLabel = getValueLabel(axisValue, axisModel.axis, ecModel, axisItem.seriesDataIndices, axisItem.valueLabelOpt);
        var axisSectionMarkup = createTooltipMarkup('section', {
          header: axisValueLabel,
          noHeader: !trim$1(axisValueLabel),
          sortBlocks: true,
          blocks: []
        });
        articleMarkup.blocks.push(axisSectionMarkup);
        each$f(axisItem.seriesDataIndices, function (idxItem) {
          var series = ecModel.getSeriesByIndex(idxItem.seriesIndex);
          var dataIndex = idxItem.dataIndexInside;
          var cbParams = series.getDataParams(dataIndex);
          // Can't find data.
          if (cbParams.dataIndex < 0) {
            return;
          }
          cbParams.axisDim = axisItem.axisDim;
          cbParams.axisIndex = axisItem.axisIndex;
          cbParams.axisType = axisItem.axisType;
          cbParams.axisId = axisItem.axisId;
          cbParams.axisValue = getAxisRawValue(axisModel.axis, {
            value: axisValue
          });
          cbParams.axisValueLabel = axisValueLabel;
          // Pre-create marker style for makers. Users can assemble richText
          // text in `formatter` callback and use those markers style.
          cbParams.marker = markupStyleCreator.makeTooltipMarker('item', convertToColorString(cbParams.color), renderMode);
          var seriesTooltipResult = normalizeTooltipFormatResult(series.formatTooltip(dataIndex, true, null));
          var frag = seriesTooltipResult.frag;
          if (frag) {
            var valueFormatter = buildTooltipModel([series], globalTooltipModel).get('valueFormatter');
            axisSectionMarkup.blocks.push(valueFormatter ? extend({
              valueFormatter: valueFormatter
            }, frag) : frag);
          }
          if (seriesTooltipResult.text) {
            markupTextArrLegacy.push(seriesTooltipResult.text);
          }
          cbParamsList.push(cbParams);
        });
      });
    });
    // In most cases, the second axis is displays upper on the first one.
    // So we reverse it to look better.
    articleMarkup.blocks.reverse();
    markupTextArrLegacy.reverse();
    var positionExpr = e.position;
    var orderMode = singleTooltipModel.get('order');
    var builtMarkupText = buildTooltipMarkup(articleMarkup, markupStyleCreator, renderMode, orderMode, ecModel.get('useUTC'), singleTooltipModel.get('textStyle'));
    builtMarkupText && markupTextArrLegacy.unshift(builtMarkupText);
    var blockBreak = renderMode === 'richText' ? '\n\n' : '<br/>';
    var allMarkupText = markupTextArrLegacy.join(blockBreak);
    this._showOrMove(singleTooltipModel, function () {
      if (this._updateContentNotChangedOnAxis(dataByCoordSys, cbParamsList)) {
        this._updatePosition(singleTooltipModel, positionExpr, point[0], point[1], this._tooltipContent, cbParamsList);
      } else {
        this._showTooltipContent(singleTooltipModel, allMarkupText, cbParamsList, Math.random() + '', point[0], point[1], positionExpr, null, markupStyleCreator);
      }
    });
    // Do not trigger events here, because this branch only be entered
    // from dispatchAction.
  };
  TooltipView.prototype._showSeriesItemTooltip = function (e, dispatcher, dispatchAction) {
    var ecModel = this._ecModel;
    var ecData = getECData(dispatcher);
    // Use dataModel in element if possible
    // Used when mouseover on a element like markPoint or edge
    // In which case, the data is not main data in series.
    var seriesIndex = ecData.seriesIndex;
    var seriesModel = ecModel.getSeriesByIndex(seriesIndex);
    // For example, graph link.
    var dataModel = ecData.dataModel || seriesModel;
    var dataIndex = ecData.dataIndex;
    var dataType = ecData.dataType;
    var data = dataModel.getData(dataType);
    var renderMode = this._renderMode;
    var positionDefault = e.positionDefault;
    var tooltipModel = buildTooltipModel([data.getItemModel(dataIndex), dataModel, seriesModel && (seriesModel.coordinateSystem || {}).model], this._tooltipModel, positionDefault ? {
      position: positionDefault
    } : null);
    var tooltipTrigger = tooltipModel.get('trigger');
    if (tooltipTrigger != null && tooltipTrigger !== 'item') {
      return;
    }
    var params = dataModel.getDataParams(dataIndex, dataType);
    var markupStyleCreator = new TooltipMarkupStyleCreator();
    // Pre-create marker style for makers. Users can assemble richText
    // text in `formatter` callback and use those markers style.
    params.marker = markupStyleCreator.makeTooltipMarker('item', convertToColorString(params.color), renderMode);
    var seriesTooltipResult = normalizeTooltipFormatResult(dataModel.formatTooltip(dataIndex, false, dataType));
    var orderMode = tooltipModel.get('order');
    var valueFormatter = tooltipModel.get('valueFormatter');
    var frag = seriesTooltipResult.frag;
    var markupText = frag ? buildTooltipMarkup(valueFormatter ? extend({
      valueFormatter: valueFormatter
    }, frag) : frag, markupStyleCreator, renderMode, orderMode, ecModel.get('useUTC'), tooltipModel.get('textStyle')) : seriesTooltipResult.text;
    var asyncTicket = 'item_' + dataModel.name + '_' + dataIndex;
    this._showOrMove(tooltipModel, function () {
      this._showTooltipContent(tooltipModel, markupText, params, asyncTicket, e.offsetX, e.offsetY, e.position, e.target, markupStyleCreator);
    });
    // FIXME
    // duplicated showtip if manuallyShowTip is called from dispatchAction.
    dispatchAction({
      type: 'showTip',
      dataIndexInside: dataIndex,
      dataIndex: data.getRawIndex(dataIndex),
      seriesIndex: seriesIndex,
      from: this.uid
    });
  };
  TooltipView.prototype._showComponentItemTooltip = function (e, el, dispatchAction) {
    var isHTMLRenderMode = this._renderMode === 'html';
    var ecData = getECData(el);
    var tooltipConfig = ecData.tooltipConfig;
    var tooltipOpt = tooltipConfig.option || {};
    var encodeHTMLContent = tooltipOpt.encodeHTMLContent;
    if (isString(tooltipOpt)) {
      var content = tooltipOpt;
      tooltipOpt = {
        content: content,
        // Fixed formatter
        formatter: content
      };
      // when `tooltipConfig.option` is a string rather than an object,
      // we can't know if the content needs to be encoded
      // for the sake of security, encode it by default.
      encodeHTMLContent = true;
    }
    if (encodeHTMLContent && isHTMLRenderMode && tooltipOpt.content) {
      // clone might be unnecessary?
      tooltipOpt = clone$4(tooltipOpt);
      tooltipOpt.content = encodeHTML(tooltipOpt.content);
    }
    var tooltipModelCascade = [tooltipOpt];
    var cmpt = this._ecModel.getComponent(ecData.componentMainType, ecData.componentIndex);
    if (cmpt) {
      tooltipModelCascade.push(cmpt);
    }
    // In most cases, component tooltip formatter has different params with series tooltip formatter,
    // so that they cannot share the same formatter. Since the global tooltip formatter is used for series
    // by convention, we do not use it as the default formatter for component.
    tooltipModelCascade.push({
      formatter: tooltipOpt.content
    });
    var positionDefault = e.positionDefault;
    var subTooltipModel = buildTooltipModel(tooltipModelCascade, this._tooltipModel, positionDefault ? {
      position: positionDefault
    } : null);
    var defaultHtml = subTooltipModel.get('content');
    var asyncTicket = Math.random() + '';
    // PENDING: this case do not support richText style yet.
    var markupStyleCreator = new TooltipMarkupStyleCreator();
    // Do not check whether `trigger` is 'none' here, because `trigger`
    // only works on coordinate system. In fact, we have not found case
    // that requires setting `trigger` nothing on component yet.
    this._showOrMove(subTooltipModel, function () {
      // Use formatterParams from element defined in component
      // Avoid users modify it.
      var formatterParams = clone$4(subTooltipModel.get('formatterParams') || {});
      this._showTooltipContent(subTooltipModel, defaultHtml, formatterParams, asyncTicket, e.offsetX, e.offsetY, e.position, el, markupStyleCreator);
    });
    // If not dispatch showTip, tip may be hide triggered by axis.
    dispatchAction({
      type: 'showTip',
      from: this.uid
    });
  };
  TooltipView.prototype._showTooltipContent = function (
  // Use Model<TooltipOption> insteadof TooltipModel because this model may be from series or other options.
  // Instead of top level tooltip.
  tooltipModel, defaultHtml, params, asyncTicket, x, y, positionExpr, el, markupStyleCreator) {
    // Reset ticket
    this._ticket = '';
    if (!tooltipModel.get('showContent') || !tooltipModel.get('show')) {
      return;
    }
    var tooltipContent = this._tooltipContent;
    tooltipContent.setEnterable(tooltipModel.get('enterable'));
    var formatter = tooltipModel.get('formatter');
    positionExpr = positionExpr || tooltipModel.get('position');
    var html = defaultHtml;
    var nearPoint = this._getNearestPoint([x, y], params, tooltipModel.get('trigger'), tooltipModel.get('borderColor'));
    var nearPointColor = nearPoint.color;
    if (formatter) {
      if (isString(formatter)) {
        var useUTC = tooltipModel.ecModel.get('useUTC');
        var params0 = isArray$1(params) ? params[0] : params;
        var isTimeAxis = params0 && params0.axisType && params0.axisType.indexOf('time') >= 0;
        html = formatter;
        if (isTimeAxis) {
          html = format(params0.axisValue, html, useUTC);
        }
        html = formatTpl(html, params, true);
      } else if (isFunction(formatter)) {
        var callback = bind$1(function (cbTicket, html) {
          if (cbTicket === this._ticket) {
            tooltipContent.setContent(html, markupStyleCreator, tooltipModel, nearPointColor, positionExpr);
            this._updatePosition(tooltipModel, positionExpr, x, y, tooltipContent, params, el);
          }
        }, this);
        this._ticket = asyncTicket;
        html = formatter(params, asyncTicket, callback);
      } else {
        html = formatter;
      }
    }
    tooltipContent.setContent(html, markupStyleCreator, tooltipModel, nearPointColor, positionExpr);
    tooltipContent.show(tooltipModel, nearPointColor);
    this._updatePosition(tooltipModel, positionExpr, x, y, tooltipContent, params, el);
  };
  TooltipView.prototype._getNearestPoint = function (point, tooltipDataParams, trigger, borderColor) {
    if (trigger === 'axis' || isArray$1(tooltipDataParams)) {
      return {
        color: borderColor || (this._renderMode === 'html' ? '#fff' : 'none')
      };
    }
    if (!isArray$1(tooltipDataParams)) {
      return {
        color: borderColor || tooltipDataParams.color || tooltipDataParams.borderColor
      };
    }
  };
  TooltipView.prototype._updatePosition = function (tooltipModel, positionExpr, x,
  // Mouse x
  y,
  // Mouse y
  content, params, el) {
    var viewWidth = this._api.getWidth();
    var viewHeight = this._api.getHeight();
    positionExpr = positionExpr || tooltipModel.get('position');
    var contentSize = content.getSize();
    var align = tooltipModel.get('align');
    var vAlign = tooltipModel.get('verticalAlign');
    var rect = el && el.getBoundingRect().clone();
    el && rect.applyTransform(el.transform);
    if (isFunction(positionExpr)) {
      // Callback of position can be an array or a string specify the position
      positionExpr = positionExpr([x, y], params, content.el, rect, {
        viewSize: [viewWidth, viewHeight],
        contentSize: contentSize.slice()
      });
    }
    if (isArray$1(positionExpr)) {
      x = parsePercent(positionExpr[0], viewWidth);
      y = parsePercent(positionExpr[1], viewHeight);
    } else if (isObject$3(positionExpr)) {
      var boxLayoutPosition = positionExpr;
      boxLayoutPosition.width = contentSize[0];
      boxLayoutPosition.height = contentSize[1];
      var layoutRect = getLayoutRect(boxLayoutPosition, {
        width: viewWidth,
        height: viewHeight
      });
      x = layoutRect.x;
      y = layoutRect.y;
      align = null;
      // When positionExpr is left/top/right/bottom,
      // align and verticalAlign will not work.
      vAlign = null;
    }
    // Specify tooltip position by string 'top' 'bottom' 'left' 'right' around graphic element
    else if (isString(positionExpr) && el) {
      var pos = calcTooltipPosition(positionExpr, rect, contentSize, tooltipModel.get('borderWidth'));
      x = pos[0];
      y = pos[1];
    } else {
      var pos = refixTooltipPosition(x, y, content, viewWidth, viewHeight, align ? null : 20, vAlign ? null : 20);
      x = pos[0];
      y = pos[1];
    }
    align && (x -= isCenterAlign(align) ? contentSize[0] / 2 : align === 'right' ? contentSize[0] : 0);
    vAlign && (y -= isCenterAlign(vAlign) ? contentSize[1] / 2 : vAlign === 'bottom' ? contentSize[1] : 0);
    if (shouldTooltipConfine(tooltipModel)) {
      var pos = confineTooltipPosition(x, y, content, viewWidth, viewHeight);
      x = pos[0];
      y = pos[1];
    }
    content.moveTo(x, y);
  };
  // FIXME
  // Should we remove this but leave this to user?
  TooltipView.prototype._updateContentNotChangedOnAxis = function (dataByCoordSys, cbParamsList) {
    var lastCoordSys = this._lastDataByCoordSys;
    var lastCbParamsList = this._cbParamsList;
    var contentNotChanged = !!lastCoordSys && lastCoordSys.length === dataByCoordSys.length;
    contentNotChanged && each$f(lastCoordSys, function (lastItemCoordSys, indexCoordSys) {
      var lastDataByAxis = lastItemCoordSys.dataByAxis || [];
      var thisItemCoordSys = dataByCoordSys[indexCoordSys] || {};
      var thisDataByAxis = thisItemCoordSys.dataByAxis || [];
      contentNotChanged = contentNotChanged && lastDataByAxis.length === thisDataByAxis.length;
      contentNotChanged && each$f(lastDataByAxis, function (lastItem, indexAxis) {
        var thisItem = thisDataByAxis[indexAxis] || {};
        var lastIndices = lastItem.seriesDataIndices || [];
        var newIndices = thisItem.seriesDataIndices || [];
        contentNotChanged = contentNotChanged && lastItem.value === thisItem.value && lastItem.axisType === thisItem.axisType && lastItem.axisId === thisItem.axisId && lastIndices.length === newIndices.length;
        contentNotChanged && each$f(lastIndices, function (lastIdxItem, j) {
          var newIdxItem = newIndices[j];
          contentNotChanged = contentNotChanged && lastIdxItem.seriesIndex === newIdxItem.seriesIndex && lastIdxItem.dataIndex === newIdxItem.dataIndex;
        });
        // check is cbParams data value changed
        lastCbParamsList && each$f(lastItem.seriesDataIndices, function (idxItem) {
          var seriesIdx = idxItem.seriesIndex;
          var cbParams = cbParamsList[seriesIdx];
          var lastCbParams = lastCbParamsList[seriesIdx];
          if (cbParams && lastCbParams && lastCbParams.data !== cbParams.data) {
            contentNotChanged = false;
          }
        });
      });
    });
    this._lastDataByCoordSys = dataByCoordSys;
    this._cbParamsList = cbParamsList;
    return !!contentNotChanged;
  };
  TooltipView.prototype._hide = function (dispatchAction) {
    // Do not directly hideLater here, because this behavior may be prevented
    // in dispatchAction when showTip is dispatched.
    // FIXME
    // duplicated hideTip if manuallyHideTip is called from dispatchAction.
    this._lastDataByCoordSys = null;
    dispatchAction({
      type: 'hideTip',
      from: this.uid
    });
  };
  TooltipView.prototype.dispose = function (ecModel, api) {
    if (env$1.node || !api.getDom()) {
      return;
    }
    clear$1(this, '_updatePosition');
    this._tooltipContent.dispose();
    unregister('itemTooltip', api);
  };
  TooltipView.type = 'tooltip';
  return TooltipView;
}(ComponentView$1);
/**
 * From top to bottom. (the last one should be globalTooltipModel);
 */
function buildTooltipModel(modelCascade, globalTooltipModel, defaultTooltipOption) {
  // Last is always tooltip model.
  var ecModel = globalTooltipModel.ecModel;
  var resultModel;
  if (defaultTooltipOption) {
    resultModel = new Model$1(defaultTooltipOption, ecModel, ecModel);
    resultModel = new Model$1(globalTooltipModel.option, resultModel, ecModel);
  } else {
    resultModel = globalTooltipModel;
  }
  for (var i = modelCascade.length - 1; i >= 0; i--) {
    var tooltipOpt = modelCascade[i];
    if (tooltipOpt) {
      if (tooltipOpt instanceof Model$1) {
        tooltipOpt = tooltipOpt.get('tooltip', true);
      }
      // In each data item tooltip can be simply write:
      // {
      //  value: 10,
      //  tooltip: 'Something you need to know'
      // }
      if (isString(tooltipOpt)) {
        tooltipOpt = {
          formatter: tooltipOpt
        };
      }
      if (tooltipOpt) {
        resultModel = new Model$1(tooltipOpt, resultModel, ecModel);
      }
    }
  }
  return resultModel;
}
function makeDispatchAction(payload, api) {
  return payload.dispatchAction || bind$1(api.dispatchAction, api);
}
function refixTooltipPosition(x, y, content, viewWidth, viewHeight, gapH, gapV) {
  var size = content.getSize();
  var width = size[0];
  var height = size[1];
  if (gapH != null) {
    // Add extra 2 pixels for this case:
    // At present the "values" in default tooltip are using CSS `float: right`.
    // When the right edge of the tooltip box is on the right side of the
    // viewport, the `float` layout might push the "values" to the second line.
    if (x + width + gapH + 2 > viewWidth) {
      x -= width + gapH;
    } else {
      x += gapH;
    }
  }
  if (gapV != null) {
    if (y + height + gapV > viewHeight) {
      y -= height + gapV;
    } else {
      y += gapV;
    }
  }
  return [x, y];
}
function confineTooltipPosition(x, y, content, viewWidth, viewHeight) {
  var size = content.getSize();
  var width = size[0];
  var height = size[1];
  x = Math.min(x + width, viewWidth) - width;
  y = Math.min(y + height, viewHeight) - height;
  x = Math.max(x, 0);
  y = Math.max(y, 0);
  return [x, y];
}
function calcTooltipPosition(position, rect, contentSize, borderWidth) {
  var domWidth = contentSize[0];
  var domHeight = contentSize[1];
  var offset = Math.ceil(Math.SQRT2 * borderWidth) + 8;
  var x = 0;
  var y = 0;
  var rectWidth = rect.width;
  var rectHeight = rect.height;
  switch (position) {
    case 'inside':
      x = rect.x + rectWidth / 2 - domWidth / 2;
      y = rect.y + rectHeight / 2 - domHeight / 2;
      break;
    case 'top':
      x = rect.x + rectWidth / 2 - domWidth / 2;
      y = rect.y - domHeight - offset;
      break;
    case 'bottom':
      x = rect.x + rectWidth / 2 - domWidth / 2;
      y = rect.y + rectHeight + offset;
      break;
    case 'left':
      x = rect.x - domWidth - offset;
      y = rect.y + rectHeight / 2 - domHeight / 2;
      break;
    case 'right':
      x = rect.x + rectWidth + offset;
      y = rect.y + rectHeight / 2 - domHeight / 2;
  }
  return [x, y];
}
function isCenterAlign(align) {
  return align === 'center' || align === 'middle';
}
/**
 * Find target component by payload like:
 * ```js
 * { legendId: 'some_id', name: 'xxx' }
 * { toolboxIndex: 1, name: 'xxx' }
 * { geoName: 'some_name', name: 'xxx' }
 * ```
 * PENDING: at present only
 *
 * If not found, return null/undefined.
 */
function findComponentReference(payload, ecModel, api) {
  var queryOptionMap = preParseFinder(payload).queryOptionMap;
  var componentMainType = queryOptionMap.keys()[0];
  if (!componentMainType || componentMainType === 'series') {
    return;
  }
  var queryResult = queryReferringComponents(ecModel, componentMainType, queryOptionMap.get(componentMainType), {
    useDefault: false,
    enableAll: false,
    enableNone: false
  });
  var model = queryResult.models[0];
  if (!model) {
    return;
  }
  var view = api.getViewOfComponentModel(model);
  var el;
  view.group.traverse(function (subEl) {
    var tooltipConfig = getECData(subEl).tooltipConfig;
    if (tooltipConfig && tooltipConfig.name === payload.name) {
      el = subEl;
      return true; // stop
    }
  });
  if (el) {
    return {
      componentMainType: componentMainType,
      componentIndex: model.componentIndex,
      el: el
    };
  }
}
var TooltipView$1 = TooltipView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$k(registers) {
  use(install$s);
  registers.registerComponentModel(TooltipModel$1);
  registers.registerComponentView(TooltipView$1);
  /**
   * @action
   * @property {string} type
   * @property {number} seriesIndex
   * @property {number} dataIndex
   * @property {number} [x]
   * @property {number} [y]
   */
  registers.registerAction({
    type: 'showTip',
    event: 'showTip',
    update: 'tooltip:manuallyShowTip'
  }, noop);
  registers.registerAction({
    type: 'hideTip',
    event: 'hideTip',
    update: 'tooltip:manuallyHideTip'
  }, noop);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DEFAULT_TOOLBOX_BTNS = ['rect', 'polygon', 'keep', 'clear'];
function brushPreprocessor(option, isNew) {
  var brushComponents = normalizeToArray(option ? option.brush : []);
  if (!brushComponents.length) {
    return;
  }
  var brushComponentSpecifiedBtns = [];
  each$f(brushComponents, function (brushOpt) {
    var tbs = brushOpt.hasOwnProperty('toolbox') ? brushOpt.toolbox : [];
    if (tbs instanceof Array) {
      brushComponentSpecifiedBtns = brushComponentSpecifiedBtns.concat(tbs);
    }
  });
  var toolbox = option && option.toolbox;
  if (isArray$1(toolbox)) {
    toolbox = toolbox[0];
  }
  if (!toolbox) {
    toolbox = {
      feature: {}
    };
    option.toolbox = [toolbox];
  }
  var toolboxFeature = toolbox.feature || (toolbox.feature = {});
  var toolboxBrush = toolboxFeature.brush || (toolboxFeature.brush = {});
  var brushTypes = toolboxBrush.type || (toolboxBrush.type = []);
  brushTypes.push.apply(brushTypes, brushComponentSpecifiedBtns);
  removeDuplicate(brushTypes);
  if (isNew && !brushTypes.length) {
    brushTypes.push.apply(brushTypes, DEFAULT_TOOLBOX_BTNS);
  }
}
function removeDuplicate(arr) {
  var map = {};
  each$f(arr, function (val) {
    map[val] = 1;
  });
  arr.length = 0;
  each$f(map, function (flag, val) {
    arr.push(val);
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each$4 = each$f;
function hasKeys(obj) {
  if (obj) {
    for (var name_1 in obj) {
      if (obj.hasOwnProperty(name_1)) {
        return true;
      }
    }
  }
}
function createVisualMappings(option, stateList, supplementVisualOption) {
  var visualMappings = {};
  each$4(stateList, function (state) {
    var mappings = visualMappings[state] = createMappings();
    each$4(option[state], function (visualData, visualType) {
      if (!VisualMapping$1.isValidType(visualType)) {
        return;
      }
      var mappingOption = {
        type: visualType,
        visual: visualData
      };
      supplementVisualOption && supplementVisualOption(mappingOption, state);
      mappings[visualType] = new VisualMapping$1(mappingOption);
      // Prepare a alpha for opacity, for some case that opacity
      // is not supported, such as rendering using gradient color.
      if (visualType === 'opacity') {
        mappingOption = clone$4(mappingOption);
        mappingOption.type = 'colorAlpha';
        mappings.__hidden.__alphaForOpacity = new VisualMapping$1(mappingOption);
      }
    });
  });
  return visualMappings;
  function createMappings() {
    var Creater = function () {};
    // Make sure hidden fields will not be visited by
    // object iteration (with hasOwnProperty checking).
    Creater.prototype.__hidden = Creater.prototype;
    var obj = new Creater();
    return obj;
  }
}
function replaceVisualOption(thisOption, newOption, keys) {
  // Visual attributes merge is not supported, otherwise it
  // brings overcomplicated merge logic. See #2853. So if
  // newOption has anyone of these keys, all of these keys
  // will be reset. Otherwise, all keys remain.
  var has;
  each$f(keys, function (key) {
    if (newOption.hasOwnProperty(key) && hasKeys(newOption[key])) {
      has = true;
    }
  });
  has && each$f(keys, function (key) {
    if (newOption.hasOwnProperty(key) && hasKeys(newOption[key])) {
      thisOption[key] = clone$4(newOption[key]);
    } else {
      delete thisOption[key];
    }
  });
}
/**
 * @param stateList
 * @param visualMappings
 * @param list
 * @param getValueState param: valueOrIndex, return: state.
 * @param scope Scope for getValueState
 * @param dimension Concrete dimension, if used.
 */
// ???! handle brush?
function applyVisual(stateList, visualMappings, data, getValueState, scope, dimension) {
  var visualTypesMap = {};
  each$f(stateList, function (state) {
    var visualTypes = VisualMapping$1.prepareVisualTypes(visualMappings[state]);
    visualTypesMap[state] = visualTypes;
  });
  var dataIndex;
  function getVisual(key) {
    return getItemVisualFromData(data, dataIndex, key);
  }
  function setVisual(key, value) {
    setItemVisualFromData(data, dataIndex, key, value);
  }
  if (dimension == null) {
    data.each(eachItem);
  } else {
    data.each([dimension], eachItem);
  }
  function eachItem(valueOrIndex, index) {
    dataIndex = dimension == null ? valueOrIndex // First argument is index
    : index;
    var rawDataItem = data.getRawDataItem(dataIndex);
    // Consider performance
    // @ts-ignore
    if (rawDataItem && rawDataItem.visualMap === false) {
      return;
    }
    var valueState = getValueState.call(scope, valueOrIndex);
    var mappings = visualMappings[valueState];
    var visualTypes = visualTypesMap[valueState];
    for (var i = 0, len = visualTypes.length; i < len; i++) {
      var type = visualTypes[i];
      mappings[type] && mappings[type].applyVisual(valueOrIndex, getVisual, setVisual);
    }
  }
}
/**
 * @param data
 * @param stateList
 * @param visualMappings <state, Object.<visualType, module:echarts/visual/VisualMapping>>
 * @param getValueState param: valueOrIndex, return: state.
 * @param dim dimension or dimension index.
 */
function incrementalApplyVisual(stateList, visualMappings, getValueState, dim) {
  var visualTypesMap = {};
  each$f(stateList, function (state) {
    var visualTypes = VisualMapping$1.prepareVisualTypes(visualMappings[state]);
    visualTypesMap[state] = visualTypes;
  });
  return {
    progress: function progress(params, data) {
      var dimIndex;
      if (dim != null) {
        dimIndex = data.getDimensionIndex(dim);
      }
      function getVisual(key) {
        return getItemVisualFromData(data, dataIndex, key);
      }
      function setVisual(key, value) {
        setItemVisualFromData(data, dataIndex, key, value);
      }
      var dataIndex;
      var store = data.getStore();
      while ((dataIndex = params.next()) != null) {
        var rawDataItem = data.getRawDataItem(dataIndex);
        // Consider performance
        // @ts-ignore
        if (rawDataItem && rawDataItem.visualMap === false) {
          continue;
        }
        var value = dim != null ? store.get(dimIndex, dataIndex) : dataIndex;
        var valueState = getValueState(value);
        var mappings = visualMappings[valueState];
        var visualTypes = visualTypesMap[valueState];
        for (var i = 0, len = visualTypes.length; i < len; i++) {
          var type = visualTypes[i];
          mappings[type] && mappings[type].applyVisual(value, getVisual, setVisual);
        }
      }
    }
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function makeBrushCommonSelectorForSeries(area) {
  var brushType = area.brushType;
  // Do not use function binding or curry for performance.
  var selectors = {
    point: function (itemLayout) {
      return selector[brushType].point(itemLayout, selectors, area);
    },
    rect: function (itemLayout) {
      return selector[brushType].rect(itemLayout, selectors, area);
    }
  };
  return selectors;
}
var selector = {
  lineX: getLineSelectors(0),
  lineY: getLineSelectors(1),
  rect: {
    point: function (itemLayout, selectors, area) {
      return itemLayout && area.boundingRect.contain(itemLayout[0], itemLayout[1]);
    },
    rect: function (itemLayout, selectors, area) {
      return itemLayout && area.boundingRect.intersect(itemLayout);
    }
  },
  polygon: {
    point: function (itemLayout, selectors, area) {
      return itemLayout && area.boundingRect.contain(itemLayout[0], itemLayout[1]) && contain(area.range, itemLayout[0], itemLayout[1]);
    },
    rect: function (itemLayout, selectors, area) {
      var points = area.range;
      if (!itemLayout || points.length <= 1) {
        return false;
      }
      var x = itemLayout.x;
      var y = itemLayout.y;
      var width = itemLayout.width;
      var height = itemLayout.height;
      var p = points[0];
      if (contain(points, x, y) || contain(points, x + width, y) || contain(points, x, y + height) || contain(points, x + width, y + height) || BoundingRect$1.create(itemLayout).contain(p[0], p[1]) || linePolygonIntersect(x, y, x + width, y, points) || linePolygonIntersect(x, y, x, y + height, points) || linePolygonIntersect(x + width, y, x + width, y + height, points) || linePolygonIntersect(x, y + height, x + width, y + height, points)) {
        return true;
      }
    }
  }
};
function getLineSelectors(xyIndex) {
  var xy = ['x', 'y'];
  var wh = ['width', 'height'];
  return {
    point: function (itemLayout, selectors, area) {
      if (itemLayout) {
        var range = area.range;
        var p = itemLayout[xyIndex];
        return inLineRange(p, range);
      }
    },
    rect: function (itemLayout, selectors, area) {
      if (itemLayout) {
        var range = area.range;
        var layoutRange = [itemLayout[xy[xyIndex]], itemLayout[xy[xyIndex]] + itemLayout[wh[xyIndex]]];
        layoutRange[1] < layoutRange[0] && layoutRange.reverse();
        return inLineRange(layoutRange[0], range) || inLineRange(layoutRange[1], range) || inLineRange(range[0], layoutRange) || inLineRange(range[1], layoutRange);
      }
    }
  };
}
function inLineRange(p, range) {
  return range[0] <= p && p <= range[1];
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var STATE_LIST = ['inBrush', 'outOfBrush'];
var DISPATCH_METHOD = '__ecBrushSelect';
var DISPATCH_FLAG = '__ecInBrushSelectEvent';
function layoutCovers(ecModel) {
  ecModel.eachComponent({
    mainType: 'brush'
  }, function (brushModel) {
    var brushTargetManager = brushModel.brushTargetManager = new BrushTargetManager$1(brushModel.option, ecModel);
    brushTargetManager.setInputRanges(brushModel.areas, ecModel);
  });
}
/**
 * Register the visual encoding if this modules required.
 */
function brushVisual(ecModel, api, payload) {
  var brushSelected = [];
  var throttleType;
  var throttleDelay;
  ecModel.eachComponent({
    mainType: 'brush'
  }, function (brushModel) {
    payload && payload.type === 'takeGlobalCursor' && brushModel.setBrushOption(payload.key === 'brush' ? payload.brushOption : {
      brushType: false
    });
  });
  layoutCovers(ecModel);
  ecModel.eachComponent({
    mainType: 'brush'
  }, function (brushModel, brushIndex) {
    var thisBrushSelected = {
      brushId: brushModel.id,
      brushIndex: brushIndex,
      brushName: brushModel.name,
      areas: clone$4(brushModel.areas),
      selected: []
    };
    // Every brush component exists in event params, convenient
    // for user to find by index.
    brushSelected.push(thisBrushSelected);
    var brushOption = brushModel.option;
    var brushLink = brushOption.brushLink;
    var linkedSeriesMap = [];
    var selectedDataIndexForLink = [];
    var rangeInfoBySeries = [];
    var hasBrushExists = false;
    if (!brushIndex) {
      // Only the first throttle setting works.
      throttleType = brushOption.throttleType;
      throttleDelay = brushOption.throttleDelay;
    }
    // Add boundingRect and selectors to range.
    var areas = map$1(brushModel.areas, function (area) {
      var builder = boundingRectBuilders[area.brushType];
      var selectableArea = defaults({
        boundingRect: builder ? builder(area) : void 0
      }, area);
      selectableArea.selectors = makeBrushCommonSelectorForSeries(selectableArea);
      return selectableArea;
    });
    var visualMappings = createVisualMappings(brushModel.option, STATE_LIST, function (mappingOption) {
      mappingOption.mappingMethod = 'fixed';
    });
    isArray$1(brushLink) && each$f(brushLink, function (seriesIndex) {
      linkedSeriesMap[seriesIndex] = 1;
    });
    function linkOthers(seriesIndex) {
      return brushLink === 'all' || !!linkedSeriesMap[seriesIndex];
    }
    // If no supported brush or no brush on the series,
    // all visuals should be in original state.
    function brushed(rangeInfoList) {
      return !!rangeInfoList.length;
    }
    /**
     * Logic for each series: (If the logic has to be modified one day, do it carefully!)
     *
     * ( brushed ┬ && ┬hasBrushExist ┬ && linkOthers  ) => StepA: ┬record, ┬ StepB: ┬visualByRecord.
     *   !brushed┘    ├hasBrushExist ┤                            └nothing,┘        ├visualByRecord.
     *                └!hasBrushExist┘                                              └nothing.
     * ( !brushed  && ┬hasBrushExist ┬ && linkOthers  ) => StepA:  nothing,  StepB: ┬visualByRecord.
     *                └!hasBrushExist┘                                              └nothing.
     * ( brushed ┬ &&                     !linkOthers ) => StepA:  nothing,  StepB: ┬visualByCheck.
     *   !brushed┘                                                                  └nothing.
     * ( !brushed  &&                     !linkOthers ) => StepA:  nothing,  StepB:  nothing.
     */
    // Step A
    ecModel.eachSeries(function (seriesModel, seriesIndex) {
      var rangeInfoList = rangeInfoBySeries[seriesIndex] = [];
      seriesModel.subType === 'parallel' ? stepAParallel(seriesModel, seriesIndex) : stepAOthers(seriesModel, seriesIndex, rangeInfoList);
    });
    function stepAParallel(seriesModel, seriesIndex) {
      var coordSys = seriesModel.coordinateSystem;
      hasBrushExists = hasBrushExists || coordSys.hasAxisBrushed();
      linkOthers(seriesIndex) && coordSys.eachActiveState(seriesModel.getData(), function (activeState, dataIndex) {
        activeState === 'active' && (selectedDataIndexForLink[dataIndex] = 1);
      });
    }
    function stepAOthers(seriesModel, seriesIndex, rangeInfoList) {
      if (!seriesModel.brushSelector || brushModelNotControll(brushModel, seriesIndex)) {
        return;
      }
      each$f(areas, function (area) {
        if (brushModel.brushTargetManager.controlSeries(area, seriesModel, ecModel)) {
          rangeInfoList.push(area);
        }
        hasBrushExists = hasBrushExists || brushed(rangeInfoList);
      });
      if (linkOthers(seriesIndex) && brushed(rangeInfoList)) {
        var data_1 = seriesModel.getData();
        data_1.each(function (dataIndex) {
          if (checkInRange(seriesModel, rangeInfoList, data_1, dataIndex)) {
            selectedDataIndexForLink[dataIndex] = 1;
          }
        });
      }
    }
    // Step B
    ecModel.eachSeries(function (seriesModel, seriesIndex) {
      var seriesBrushSelected = {
        seriesId: seriesModel.id,
        seriesIndex: seriesIndex,
        seriesName: seriesModel.name,
        dataIndex: []
      };
      // Every series exists in event params, convenient
      // for user to find series by seriesIndex.
      thisBrushSelected.selected.push(seriesBrushSelected);
      var rangeInfoList = rangeInfoBySeries[seriesIndex];
      var data = seriesModel.getData();
      var getValueState = linkOthers(seriesIndex) ? function (dataIndex) {
        return selectedDataIndexForLink[dataIndex] ? (seriesBrushSelected.dataIndex.push(data.getRawIndex(dataIndex)), 'inBrush') : 'outOfBrush';
      } : function (dataIndex) {
        return checkInRange(seriesModel, rangeInfoList, data, dataIndex) ? (seriesBrushSelected.dataIndex.push(data.getRawIndex(dataIndex)), 'inBrush') : 'outOfBrush';
      };
      // If no supported brush or no brush, all visuals are in original state.
      (linkOthers(seriesIndex) ? hasBrushExists : brushed(rangeInfoList)) && applyVisual(STATE_LIST, visualMappings, data, getValueState);
    });
  });
  dispatchAction$1(api, throttleType, throttleDelay, brushSelected, payload);
}
function dispatchAction$1(api, throttleType, throttleDelay, brushSelected, payload) {
  // This event will not be triggered when `setOpion`, otherwise dead lock may
  // triggered when do `setOption` in event listener, which we do not find
  // satisfactory way to solve yet. Some considered resolutions:
  // (a) Diff with prevoius selected data ant only trigger event when changed.
  // But store previous data and diff precisely (i.e., not only by dataIndex, but
  // also detect value changes in selected data) might bring complexity or fragility.
  // (b) Use spectial param like `silent` to suppress event triggering.
  // But such kind of volatile param may be weird in `setOption`.
  if (!payload) {
    return;
  }
  var zr = api.getZr();
  if (zr[DISPATCH_FLAG]) {
    return;
  }
  if (!zr[DISPATCH_METHOD]) {
    zr[DISPATCH_METHOD] = doDispatch;
  }
  var fn = createOrUpdate(zr, DISPATCH_METHOD, throttleDelay, throttleType);
  fn(api, brushSelected);
}
function doDispatch(api, brushSelected) {
  if (!api.isDisposed()) {
    var zr = api.getZr();
    zr[DISPATCH_FLAG] = true;
    api.dispatchAction({
      type: 'brushSelect',
      batch: brushSelected
    });
    zr[DISPATCH_FLAG] = false;
  }
}
function checkInRange(seriesModel, rangeInfoList, data, dataIndex) {
  for (var i = 0, len = rangeInfoList.length; i < len; i++) {
    var area = rangeInfoList[i];
    if (seriesModel.brushSelector(dataIndex, data, area.selectors, area)) {
      return true;
    }
  }
}
function brushModelNotControll(brushModel, seriesIndex) {
  var seriesIndices = brushModel.option.seriesIndex;
  return seriesIndices != null && seriesIndices !== 'all' && (isArray$1(seriesIndices) ? indexOf(seriesIndices, seriesIndex) < 0 : seriesIndex !== seriesIndices);
}
var boundingRectBuilders = {
  rect: function (area) {
    return getBoundingRectFromMinMax(area.range);
  },
  polygon: function (area) {
    var minMax;
    var range = area.range;
    for (var i = 0, len = range.length; i < len; i++) {
      minMax = minMax || [[Infinity, -Infinity], [Infinity, -Infinity]];
      var rg = range[i];
      rg[0] < minMax[0][0] && (minMax[0][0] = rg[0]);
      rg[0] > minMax[0][1] && (minMax[0][1] = rg[0]);
      rg[1] < minMax[1][0] && (minMax[1][0] = rg[1]);
      rg[1] > minMax[1][1] && (minMax[1][1] = rg[1]);
    }
    return minMax && getBoundingRectFromMinMax(minMax);
  }
};
function getBoundingRectFromMinMax(minMax) {
  return new BoundingRect$1(minMax[0][0], minMax[1][0], minMax[0][1] - minMax[0][0], minMax[1][1] - minMax[1][0]);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var BrushView = /** @class */function (_super) {
  __extends(BrushView, _super);
  function BrushView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = BrushView.type;
    return _this;
  }
  BrushView.prototype.init = function (ecModel, api) {
    this.ecModel = ecModel;
    this.api = api;
    this.model;
    (this._brushController = new BrushController$1(api.getZr())).on('brush', bind$1(this._onBrush, this)).mount();
  };
  BrushView.prototype.render = function (brushModel, ecModel, api, payload) {
    this.model = brushModel;
    this._updateController(brushModel, ecModel, api, payload);
  };
  BrushView.prototype.updateTransform = function (brushModel, ecModel, api, payload) {
    // PENDING: `updateTransform` is a little tricky, whose layout need
    // to be calculate mandatorily and other stages will not be performed.
    // Take care the correctness of the logic. See #11754 .
    layoutCovers(ecModel);
    this._updateController(brushModel, ecModel, api, payload);
  };
  BrushView.prototype.updateVisual = function (brushModel, ecModel, api, payload) {
    this.updateTransform(brushModel, ecModel, api, payload);
  };
  BrushView.prototype.updateView = function (brushModel, ecModel, api, payload) {
    this._updateController(brushModel, ecModel, api, payload);
  };
  BrushView.prototype._updateController = function (brushModel, ecModel, api, payload) {
    // Do not update controller when drawing.
    (!payload || payload.$from !== brushModel.id) && this._brushController.setPanels(brushModel.brushTargetManager.makePanelOpts(api)).enableBrush(brushModel.brushOption).updateCovers(brushModel.areas.slice());
  };
  // updateLayout: updateController,
  // updateVisual: updateController,
  BrushView.prototype.dispose = function () {
    this._brushController.dispose();
  };
  BrushView.prototype._onBrush = function (eventParam) {
    var modelId = this.model.id;
    var areas = this.model.brushTargetManager.setOutputRanges(eventParam.areas, this.ecModel);
    // Action is not dispatched on drag end, because the drag end
    // emits the same params with the last drag move event, and
    // may have some delay when using touch pad, which makes
    // animation not smooth (when using debounce).
    (!eventParam.isEnd || eventParam.removeOnClick) && this.api.dispatchAction({
      type: 'brush',
      brushId: modelId,
      areas: clone$4(areas),
      $from: modelId
    });
    eventParam.isEnd && this.api.dispatchAction({
      type: 'brushEnd',
      brushId: modelId,
      areas: clone$4(areas),
      $from: modelId
    });
  };
  BrushView.type = 'brush';
  return BrushView;
}(ComponentView$1);
var BrushView$1 = BrushView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DEFAULT_OUT_OF_BRUSH_COLOR = '#ddd';
var BrushModel = /** @class */function (_super) {
  __extends(BrushModel, _super);
  function BrushModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = BrushModel.type;
    /**
     * @readOnly
     */
    _this.areas = [];
    /**
     * Current brush painting area settings.
     * @readOnly
     */
    _this.brushOption = {};
    return _this;
  }
  BrushModel.prototype.optionUpdated = function (newOption, isInit) {
    var thisOption = this.option;
    !isInit && replaceVisualOption(thisOption, newOption, ['inBrush', 'outOfBrush']);
    var inBrush = thisOption.inBrush = thisOption.inBrush || {};
    // Always give default visual, consider setOption at the second time.
    thisOption.outOfBrush = thisOption.outOfBrush || {
      color: DEFAULT_OUT_OF_BRUSH_COLOR
    };
    if (!inBrush.hasOwnProperty('liftZ')) {
      // Bigger than the highlight z lift, otherwise it will
      // be effected by the highlight z when brush.
      inBrush.liftZ = 5;
    }
  };
  /**
   * If `areas` is null/undefined, range state remain.
   */
  BrushModel.prototype.setAreas = function (areas) {
    {
      assert(isArray$1(areas));
      each$f(areas, function (area) {
        assert(area.brushType, 'Illegal areas');
      });
    }
    // If areas is null/undefined, range state remain.
    // This helps user to dispatchAction({type: 'brush'}) with no areas
    // set but just want to get the current brush select info from a `brush` event.
    if (!areas) {
      return;
    }
    this.areas = map$1(areas, function (area) {
      return generateBrushOption(this.option, area);
    }, this);
  };
  /**
   * Set the current painting brush option.
   */
  BrushModel.prototype.setBrushOption = function (brushOption) {
    this.brushOption = generateBrushOption(this.option, brushOption);
    this.brushType = this.brushOption.brushType;
  };
  BrushModel.type = 'brush';
  BrushModel.dependencies = ['geo', 'grid', 'xAxis', 'yAxis', 'parallel', 'series'];
  BrushModel.defaultOption = {
    seriesIndex: 'all',
    brushType: 'rect',
    brushMode: 'single',
    transformable: true,
    brushStyle: {
      borderWidth: 1,
      color: 'rgba(210,219,238,0.3)',
      borderColor: '#D2DBEE'
    },
    throttleType: 'fixRate',
    throttleDelay: 0,
    removeOnClick: true,
    z: 10000
  };
  return BrushModel;
}(ComponentModel$1);
function generateBrushOption(option, brushOption) {
  return merge({
    brushType: option.brushType,
    brushMode: option.brushMode,
    transformable: option.transformable,
    brushStyle: new Model$1(option.brushStyle).getItemStyle(),
    removeOnClick: option.removeOnClick,
    z: option.z
  }, brushOption, true);
}
var BrushModel$1 = BrushModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ICON_TYPES = ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'];
var BrushFeature = /** @class */function (_super) {
  __extends(BrushFeature, _super);
  function BrushFeature() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  BrushFeature.prototype.render = function (featureModel, ecModel, api) {
    var brushType;
    var brushMode;
    var isBrushed;
    ecModel.eachComponent({
      mainType: 'brush'
    }, function (brushModel) {
      brushType = brushModel.brushType;
      brushMode = brushModel.brushOption.brushMode || 'single';
      isBrushed = isBrushed || !!brushModel.areas.length;
    });
    this._brushType = brushType;
    this._brushMode = brushMode;
    each$f(featureModel.get('type', true), function (type) {
      featureModel.setIconStatus(type, (type === 'keep' ? brushMode === 'multiple' : type === 'clear' ? isBrushed : type === brushType) ? 'emphasis' : 'normal');
    });
  };
  BrushFeature.prototype.updateView = function (featureModel, ecModel, api) {
    this.render(featureModel, ecModel, api);
  };
  BrushFeature.prototype.getIcons = function () {
    var model = this.model;
    var availableIcons = model.get('icon', true);
    var icons = {};
    each$f(model.get('type', true), function (type) {
      if (availableIcons[type]) {
        icons[type] = availableIcons[type];
      }
    });
    return icons;
  };
  BrushFeature.prototype.onclick = function (ecModel, api, type) {
    var brushType = this._brushType;
    var brushMode = this._brushMode;
    if (type === 'clear') {
      // Trigger parallel action firstly
      api.dispatchAction({
        type: 'axisAreaSelect',
        intervals: []
      });
      api.dispatchAction({
        type: 'brush',
        command: 'clear',
        // Clear all areas of all brush components.
        areas: []
      });
    } else {
      api.dispatchAction({
        type: 'takeGlobalCursor',
        key: 'brush',
        brushOption: {
          brushType: type === 'keep' ? brushType : brushType === type ? false : type,
          brushMode: type === 'keep' ? brushMode === 'multiple' ? 'single' : 'multiple' : brushMode
        }
      });
    }
  };
  BrushFeature.getDefaultOption = function (ecModel) {
    var defaultOption = {
      show: true,
      type: ICON_TYPES.slice(),
      icon: {
        /* eslint-disable */
        rect: 'M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13',
        polygon: 'M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2',
        lineX: 'M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4',
        lineY: 'M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4',
        keep: 'M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z',
        clear: 'M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2' // jshint ignore:line
        /* eslint-enable */
      },
      // `rect`, `polygon`, `lineX`, `lineY`, `keep`, `clear`
      title: ecModel.getLocaleModel().get(['toolbox', 'brush', 'title'])
    };
    return defaultOption;
  };
  return BrushFeature;
}(ToolboxFeature);
var BrushFeature$1 = BrushFeature;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$j(registers) {
  registers.registerComponentView(BrushView$1);
  registers.registerComponentModel(BrushModel$1);
  registers.registerPreprocessor(brushPreprocessor);
  registers.registerVisual(registers.PRIORITY.VISUAL.BRUSH, brushVisual);
  registers.registerAction({
    type: 'brush',
    event: 'brush',
    update: 'updateVisual'
  }, function (payload, ecModel) {
    ecModel.eachComponent({
      mainType: 'brush',
      query: payload
    }, function (brushModel) {
      brushModel.setAreas(payload.areas);
    });
  });
  /**
   * payload: {
   *      brushComponents: [
   *          {
   *              brushId,
   *              brushIndex,
   *              brushName,
   *              series: [
   *                  {
   *                      seriesId,
   *                      seriesIndex,
   *                      seriesName,
   *                      rawIndices: [21, 34, ...]
   *                  },
   *                  ...
   *              ]
   *          },
   *          ...
   *      ]
   * }
   */
  registers.registerAction({
    type: 'brushSelect',
    event: 'brushSelected',
    update: 'none'
  }, noop);
  registers.registerAction({
    type: 'brushEnd',
    event: 'brushEnd',
    update: 'none'
  }, noop);
  registerFeature('brush', BrushFeature$1);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TitleModel = /** @class */function (_super) {
  __extends(TitleModel, _super);
  function TitleModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = TitleModel.type;
    _this.layoutMode = {
      type: 'box',
      ignoreSize: true
    };
    return _this;
  }
  TitleModel.type = 'title';
  TitleModel.defaultOption = {
    // zlevel: 0,
    z: 6,
    show: true,
    text: '',
    target: 'blank',
    subtext: '',
    subtarget: 'blank',
    left: 0,
    top: 0,
    backgroundColor: 'rgba(0,0,0,0)',
    borderColor: '#ccc',
    borderWidth: 0,
    padding: 5,
    itemGap: 10,
    textStyle: {
      fontSize: 18,
      fontWeight: 'bold',
      color: '#464646'
    },
    subtextStyle: {
      fontSize: 12,
      color: '#6E7079'
    }
  };
  return TitleModel;
}(ComponentModel$1);
// View
var TitleView = /** @class */function (_super) {
  __extends(TitleView, _super);
  function TitleView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = TitleView.type;
    return _this;
  }
  TitleView.prototype.render = function (titleModel, ecModel, api) {
    this.group.removeAll();
    if (!titleModel.get('show')) {
      return;
    }
    var group = this.group;
    var textStyleModel = titleModel.getModel('textStyle');
    var subtextStyleModel = titleModel.getModel('subtextStyle');
    var textAlign = titleModel.get('textAlign');
    var textVerticalAlign = retrieve2(titleModel.get('textBaseline'), titleModel.get('textVerticalAlign'));
    var textEl = new ZRText$1({
      style: createTextStyle(textStyleModel, {
        text: titleModel.get('text'),
        fill: textStyleModel.getTextColor()
      }, {
        disableBox: true
      }),
      z2: 10
    });
    var textRect = textEl.getBoundingRect();
    var subText = titleModel.get('subtext');
    var subTextEl = new ZRText$1({
      style: createTextStyle(subtextStyleModel, {
        text: subText,
        fill: subtextStyleModel.getTextColor(),
        y: textRect.height + titleModel.get('itemGap'),
        verticalAlign: 'top'
      }, {
        disableBox: true
      }),
      z2: 10
    });
    var link = titleModel.get('link');
    var sublink = titleModel.get('sublink');
    var triggerEvent = titleModel.get('triggerEvent', true);
    textEl.silent = !link && !triggerEvent;
    subTextEl.silent = !sublink && !triggerEvent;
    if (link) {
      textEl.on('click', function () {
        windowOpen(link, '_' + titleModel.get('target'));
      });
    }
    if (sublink) {
      subTextEl.on('click', function () {
        windowOpen(sublink, '_' + titleModel.get('subtarget'));
      });
    }
    getECData(textEl).eventData = getECData(subTextEl).eventData = triggerEvent ? {
      componentType: 'title',
      componentIndex: titleModel.componentIndex
    } : null;
    group.add(textEl);
    subText && group.add(subTextEl);
    // If no subText, but add subTextEl, there will be an empty line.
    var groupRect = group.getBoundingRect();
    var layoutOption = titleModel.getBoxLayoutParams();
    layoutOption.width = groupRect.width;
    layoutOption.height = groupRect.height;
    var layoutRect = getLayoutRect(layoutOption, {
      width: api.getWidth(),
      height: api.getHeight()
    }, titleModel.get('padding'));
    // Adjust text align based on position
    if (!textAlign) {
      // Align left if title is on the left. center and right is same
      textAlign = titleModel.get('left') || titleModel.get('right');
      // @ts-ignore
      if (textAlign === 'middle') {
        textAlign = 'center';
      }
      // Adjust layout by text align
      if (textAlign === 'right') {
        layoutRect.x += layoutRect.width;
      } else if (textAlign === 'center') {
        layoutRect.x += layoutRect.width / 2;
      }
    }
    if (!textVerticalAlign) {
      textVerticalAlign = titleModel.get('top') || titleModel.get('bottom');
      // @ts-ignore
      if (textVerticalAlign === 'center') {
        textVerticalAlign = 'middle';
      }
      if (textVerticalAlign === 'bottom') {
        layoutRect.y += layoutRect.height;
      } else if (textVerticalAlign === 'middle') {
        layoutRect.y += layoutRect.height / 2;
      }
      textVerticalAlign = textVerticalAlign || 'top';
    }
    group.x = layoutRect.x;
    group.y = layoutRect.y;
    group.markRedraw();
    var alignStyle = {
      align: textAlign,
      verticalAlign: textVerticalAlign
    };
    textEl.setStyle(alignStyle);
    subTextEl.setStyle(alignStyle);
    // Render background
    // Get groupRect again because textAlign has been changed
    groupRect = group.getBoundingRect();
    var padding = layoutRect.margin;
    var style = titleModel.getItemStyle(['color', 'opacity']);
    style.fill = titleModel.get('backgroundColor');
    var rect = new Rect$3({
      shape: {
        x: groupRect.x - padding[3],
        y: groupRect.y - padding[0],
        width: groupRect.width + padding[1] + padding[3],
        height: groupRect.height + padding[0] + padding[2],
        r: titleModel.get('borderRadius')
      },
      style: style,
      subPixelOptimize: true,
      silent: true
    });
    group.add(rect);
  };
  TitleView.type = 'title';
  return TitleView;
}(ComponentView$1);
function install$i(registers) {
  registers.registerComponentModel(TitleModel);
  registers.registerComponentView(TitleView);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TimelineModel = /** @class */function (_super) {
  __extends(TimelineModel, _super);
  function TimelineModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = TimelineModel.type;
    _this.layoutMode = 'box';
    return _this;
  }
  /**
   * @override
   */
  TimelineModel.prototype.init = function (option, parentModel, ecModel) {
    this.mergeDefaultAndTheme(option, ecModel);
    this._initData();
  };
  /**
   * @override
   */
  TimelineModel.prototype.mergeOption = function (option) {
    _super.prototype.mergeOption.apply(this, arguments);
    this._initData();
  };
  TimelineModel.prototype.setCurrentIndex = function (currentIndex) {
    if (currentIndex == null) {
      currentIndex = this.option.currentIndex;
    }
    var count = this._data.count();
    if (this.option.loop) {
      currentIndex = (currentIndex % count + count) % count;
    } else {
      currentIndex >= count && (currentIndex = count - 1);
      currentIndex < 0 && (currentIndex = 0);
    }
    this.option.currentIndex = currentIndex;
  };
  /**
   * @return {number} currentIndex
   */
  TimelineModel.prototype.getCurrentIndex = function () {
    return this.option.currentIndex;
  };
  /**
   * @return {boolean}
   */
  TimelineModel.prototype.isIndexMax = function () {
    return this.getCurrentIndex() >= this._data.count() - 1;
  };
  /**
   * @param {boolean} state true: play, false: stop
   */
  TimelineModel.prototype.setPlayState = function (state) {
    this.option.autoPlay = !!state;
  };
  /**
   * @return {boolean} true: play, false: stop
   */
  TimelineModel.prototype.getPlayState = function () {
    return !!this.option.autoPlay;
  };
  /**
   * @private
   */
  TimelineModel.prototype._initData = function () {
    var thisOption = this.option;
    var dataArr = thisOption.data || [];
    var axisType = thisOption.axisType;
    var names = this._names = [];
    var processedDataArr;
    if (axisType === 'category') {
      processedDataArr = [];
      each$f(dataArr, function (item, index) {
        var value = convertOptionIdName(getDataItemValue(item), '');
        var newItem;
        if (isObject$3(item)) {
          newItem = clone$4(item);
          newItem.value = index;
        } else {
          newItem = index;
        }
        processedDataArr.push(newItem);
        names.push(value);
      });
    } else {
      processedDataArr = dataArr;
    }
    var dimType = {
      category: 'ordinal',
      time: 'time',
      value: 'number'
    }[axisType] || 'number';
    var data = this._data = new SeriesData$1([{
      name: 'value',
      type: dimType
    }], this);
    data.initData(processedDataArr, names);
  };
  TimelineModel.prototype.getData = function () {
    return this._data;
  };
  /**
   * @public
   * @return {Array.<string>} categoreis
   */
  TimelineModel.prototype.getCategories = function () {
    if (this.get('axisType') === 'category') {
      return this._names.slice();
    }
  };
  TimelineModel.type = 'timeline';
  /**
   * @protected
   */
  TimelineModel.defaultOption = {
    // zlevel: 0,                  // 一级层叠
    z: 4,
    show: true,
    axisType: 'time',
    realtime: true,
    left: '20%',
    top: null,
    right: '20%',
    bottom: 0,
    width: null,
    height: 40,
    padding: 5,
    controlPosition: 'left',
    autoPlay: false,
    rewind: false,
    loop: true,
    playInterval: 2000,
    currentIndex: 0,
    itemStyle: {},
    label: {
      color: '#000'
    },
    data: []
  };
  return TimelineModel;
}(ComponentModel$1);
var TimelineModel$1 = TimelineModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SliderTimelineModel = /** @class */function (_super) {
  __extends(SliderTimelineModel, _super);
  function SliderTimelineModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SliderTimelineModel.type;
    return _this;
  }
  SliderTimelineModel.type = 'timeline.slider';
  /**
   * @protected
   */
  SliderTimelineModel.defaultOption = inheritDefaultOption(TimelineModel$1.defaultOption, {
    backgroundColor: 'rgba(0,0,0,0)',
    borderColor: '#ccc',
    borderWidth: 0,
    orient: 'horizontal',
    inverse: false,
    tooltip: {
      trigger: 'item' // data item may also have tootip attr.
    },
    symbol: 'circle',
    symbolSize: 12,
    lineStyle: {
      show: true,
      width: 2,
      color: '#DAE1F5'
    },
    label: {
      position: 'auto',
      // When using number, label position is not
      // restricted by viewRect.
      // positive: right/bottom, negative: left/top
      show: true,
      interval: 'auto',
      rotate: 0,
      // formatter: null,
      // 其余属性默认使用全局文本样式，详见TEXTSTYLE
      color: '#A4B1D7'
    },
    itemStyle: {
      color: '#A4B1D7',
      borderWidth: 1
    },
    checkpointStyle: {
      symbol: 'circle',
      symbolSize: 15,
      color: '#316bf3',
      borderColor: '#fff',
      borderWidth: 2,
      shadowBlur: 2,
      shadowOffsetX: 1,
      shadowOffsetY: 1,
      shadowColor: 'rgba(0, 0, 0, 0.3)',
      // borderColor: 'rgba(194,53,49, 0.5)',
      animation: true,
      animationDuration: 300,
      animationEasing: 'quinticInOut'
    },
    controlStyle: {
      show: true,
      showPlayBtn: true,
      showPrevBtn: true,
      showNextBtn: true,
      itemSize: 24,
      itemGap: 12,
      position: 'left',
      playIcon: 'path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z',
      stopIcon: 'path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z',
      // eslint-disable-next-line max-len
      nextIcon: 'M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z',
      // eslint-disable-next-line max-len
      prevIcon: 'M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z',
      prevBtnSize: 18,
      nextBtnSize: 18,
      color: '#A4B1D7',
      borderColor: '#A4B1D7',
      borderWidth: 1
    },
    emphasis: {
      label: {
        show: true,
        // 其余属性默认使用全局文本样式，详见TEXTSTYLE
        color: '#6f778d'
      },
      itemStyle: {
        color: '#316BF3'
      },
      controlStyle: {
        color: '#316BF3',
        borderColor: '#316BF3',
        borderWidth: 2
      }
    },
    progress: {
      lineStyle: {
        color: '#316BF3'
      },
      itemStyle: {
        color: '#316BF3'
      },
      label: {
        color: '#6f778d'
      }
    },
    data: []
  });
  return SliderTimelineModel;
}(TimelineModel$1);
mixin(SliderTimelineModel, DataFormatMixin.prototype);
var SliderTimelineModel$1 = SliderTimelineModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var TimelineView = /** @class */function (_super) {
  __extends(TimelineView, _super);
  function TimelineView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = TimelineView.type;
    return _this;
  }
  TimelineView.type = 'timeline';
  return TimelineView;
}(ComponentView$1);
var TimelineView$1 = TimelineView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
 * Extend axis 2d
 */
var TimelineAxis = /** @class */function (_super) {
  __extends(TimelineAxis, _super);
  function TimelineAxis(dim, scale, coordExtent, axisType) {
    var _this = _super.call(this, dim, scale, coordExtent) || this;
    _this.type = axisType || 'value';
    return _this;
  }
  /**
   * @override
   */
  TimelineAxis.prototype.getLabelModel = function () {
    // Force override
    return this.model.getModel('label');
  };
  /**
   * @override
   */
  TimelineAxis.prototype.isHorizontal = function () {
    return this.model.get('orient') === 'horizontal';
  };
  return TimelineAxis;
}(Axis$1);
var TimelineAxis$1 = TimelineAxis;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PI$1 = Math.PI;
var labelDataIndexStore = makeInner();
var SliderTimelineView = /** @class */function (_super) {
  __extends(SliderTimelineView, _super);
  function SliderTimelineView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SliderTimelineView.type;
    return _this;
  }
  SliderTimelineView.prototype.init = function (ecModel, api) {
    this.api = api;
  };
  /**
   * @override
   */
  SliderTimelineView.prototype.render = function (timelineModel, ecModel, api) {
    this.model = timelineModel;
    this.api = api;
    this.ecModel = ecModel;
    this.group.removeAll();
    if (timelineModel.get('show', true)) {
      var layoutInfo_1 = this._layout(timelineModel, api);
      var mainGroup_1 = this._createGroup('_mainGroup');
      var labelGroup = this._createGroup('_labelGroup');
      var axis_1 = this._axis = this._createAxis(layoutInfo_1, timelineModel);
      timelineModel.formatTooltip = function (dataIndex) {
        var name = axis_1.scale.getLabel({
          value: dataIndex
        });
        return createTooltipMarkup('nameValue', {
          noName: true,
          value: name
        });
      };
      each$f(['AxisLine', 'AxisTick', 'Control', 'CurrentPointer'], function (name) {
        this['_render' + name](layoutInfo_1, mainGroup_1, axis_1, timelineModel);
      }, this);
      this._renderAxisLabel(layoutInfo_1, labelGroup, axis_1, timelineModel);
      this._position(layoutInfo_1, timelineModel);
    }
    this._doPlayStop();
    this._updateTicksStatus();
  };
  /**
   * @override
   */
  SliderTimelineView.prototype.remove = function () {
    this._clearTimer();
    this.group.removeAll();
  };
  /**
   * @override
   */
  SliderTimelineView.prototype.dispose = function () {
    this._clearTimer();
  };
  SliderTimelineView.prototype._layout = function (timelineModel, api) {
    var labelPosOpt = timelineModel.get(['label', 'position']);
    var orient = timelineModel.get('orient');
    var viewRect = getViewRect(timelineModel, api);
    var parsedLabelPos;
    // Auto label offset.
    if (labelPosOpt == null || labelPosOpt === 'auto') {
      parsedLabelPos = orient === 'horizontal' ? viewRect.y + viewRect.height / 2 < api.getHeight() / 2 ? '-' : '+' : viewRect.x + viewRect.width / 2 < api.getWidth() / 2 ? '+' : '-';
    } else if (isString(labelPosOpt)) {
      parsedLabelPos = {
        horizontal: {
          top: '-',
          bottom: '+'
        },
        vertical: {
          left: '-',
          right: '+'
        }
      }[orient][labelPosOpt];
    } else {
      // is number
      parsedLabelPos = labelPosOpt;
    }
    var labelAlignMap = {
      horizontal: 'center',
      vertical: parsedLabelPos >= 0 || parsedLabelPos === '+' ? 'left' : 'right'
    };
    var labelBaselineMap = {
      horizontal: parsedLabelPos >= 0 || parsedLabelPos === '+' ? 'top' : 'bottom',
      vertical: 'middle'
    };
    var rotationMap = {
      horizontal: 0,
      vertical: PI$1 / 2
    };
    // Position
    var mainLength = orient === 'vertical' ? viewRect.height : viewRect.width;
    var controlModel = timelineModel.getModel('controlStyle');
    var showControl = controlModel.get('show', true);
    var controlSize = showControl ? controlModel.get('itemSize') : 0;
    var controlGap = showControl ? controlModel.get('itemGap') : 0;
    var sizePlusGap = controlSize + controlGap;
    // Special label rotate.
    var labelRotation = timelineModel.get(['label', 'rotate']) || 0;
    labelRotation = labelRotation * PI$1 / 180; // To radian.
    var playPosition;
    var prevBtnPosition;
    var nextBtnPosition;
    var controlPosition = controlModel.get('position', true);
    var showPlayBtn = showControl && controlModel.get('showPlayBtn', true);
    var showPrevBtn = showControl && controlModel.get('showPrevBtn', true);
    var showNextBtn = showControl && controlModel.get('showNextBtn', true);
    var xLeft = 0;
    var xRight = mainLength;
    // position[0] means left, position[1] means middle.
    if (controlPosition === 'left' || controlPosition === 'bottom') {
      showPlayBtn && (playPosition = [0, 0], xLeft += sizePlusGap);
      showPrevBtn && (prevBtnPosition = [xLeft, 0], xLeft += sizePlusGap);
      showNextBtn && (nextBtnPosition = [xRight - controlSize, 0], xRight -= sizePlusGap);
    } else {
      // 'top' 'right'
      showPlayBtn && (playPosition = [xRight - controlSize, 0], xRight -= sizePlusGap);
      showPrevBtn && (prevBtnPosition = [0, 0], xLeft += sizePlusGap);
      showNextBtn && (nextBtnPosition = [xRight - controlSize, 0], xRight -= sizePlusGap);
    }
    var axisExtent = [xLeft, xRight];
    if (timelineModel.get('inverse')) {
      axisExtent.reverse();
    }
    return {
      viewRect: viewRect,
      mainLength: mainLength,
      orient: orient,
      rotation: rotationMap[orient],
      labelRotation: labelRotation,
      labelPosOpt: parsedLabelPos,
      labelAlign: timelineModel.get(['label', 'align']) || labelAlignMap[orient],
      labelBaseline: timelineModel.get(['label', 'verticalAlign']) || timelineModel.get(['label', 'baseline']) || labelBaselineMap[orient],
      // Based on mainGroup.
      playPosition: playPosition,
      prevBtnPosition: prevBtnPosition,
      nextBtnPosition: nextBtnPosition,
      axisExtent: axisExtent,
      controlSize: controlSize,
      controlGap: controlGap
    };
  };
  SliderTimelineView.prototype._position = function (layoutInfo, timelineModel) {
    // Position is be called finally, because bounding rect is needed for
    // adapt content to fill viewRect (auto adapt offset).
    // Timeline may be not all in the viewRect when 'offset' is specified
    // as a number, because it is more appropriate that label aligns at
    // 'offset' but not the other edge defined by viewRect.
    var mainGroup = this._mainGroup;
    var labelGroup = this._labelGroup;
    var viewRect = layoutInfo.viewRect;
    if (layoutInfo.orient === 'vertical') {
      // transform to horizontal, inverse rotate by left-top point.
      var m = create$1();
      var rotateOriginX = viewRect.x;
      var rotateOriginY = viewRect.y + viewRect.height;
      translate(m, m, [-rotateOriginX, -rotateOriginY]);
      rotate(m, m, -PI$1 / 2);
      translate(m, m, [rotateOriginX, rotateOriginY]);
      viewRect = viewRect.clone();
      viewRect.applyTransform(m);
    }
    var viewBound = getBound(viewRect);
    var mainBound = getBound(mainGroup.getBoundingRect());
    var labelBound = getBound(labelGroup.getBoundingRect());
    var mainPosition = [mainGroup.x, mainGroup.y];
    var labelsPosition = [labelGroup.x, labelGroup.y];
    labelsPosition[0] = mainPosition[0] = viewBound[0][0];
    var labelPosOpt = layoutInfo.labelPosOpt;
    if (labelPosOpt == null || isString(labelPosOpt)) {
      // '+' or '-'
      var mainBoundIdx = labelPosOpt === '+' ? 0 : 1;
      toBound(mainPosition, mainBound, viewBound, 1, mainBoundIdx);
      toBound(labelsPosition, labelBound, viewBound, 1, 1 - mainBoundIdx);
    } else {
      var mainBoundIdx = labelPosOpt >= 0 ? 0 : 1;
      toBound(mainPosition, mainBound, viewBound, 1, mainBoundIdx);
      labelsPosition[1] = mainPosition[1] + labelPosOpt;
    }
    mainGroup.setPosition(mainPosition);
    labelGroup.setPosition(labelsPosition);
    mainGroup.rotation = labelGroup.rotation = layoutInfo.rotation;
    setOrigin(mainGroup);
    setOrigin(labelGroup);
    function setOrigin(targetGroup) {
      targetGroup.originX = viewBound[0][0] - targetGroup.x;
      targetGroup.originY = viewBound[1][0] - targetGroup.y;
    }
    function getBound(rect) {
      // [[xmin, xmax], [ymin, ymax]]
      return [[rect.x, rect.x + rect.width], [rect.y, rect.y + rect.height]];
    }
    function toBound(fromPos, from, to, dimIdx, boundIdx) {
      fromPos[dimIdx] += to[dimIdx][boundIdx] - from[dimIdx][boundIdx];
    }
  };
  SliderTimelineView.prototype._createAxis = function (layoutInfo, timelineModel) {
    var data = timelineModel.getData();
    var axisType = timelineModel.get('axisType');
    var scale = createScaleByModel(timelineModel, axisType);
    // Customize scale. The `tickValue` is `dataIndex`.
    scale.getTicks = function () {
      return data.mapArray(['value'], function (value) {
        return {
          value: value
        };
      });
    };
    var dataExtent = data.getDataExtent('value');
    scale.setExtent(dataExtent[0], dataExtent[1]);
    scale.calcNiceTicks();
    var axis = new TimelineAxis$1('value', scale, layoutInfo.axisExtent, axisType);
    axis.model = timelineModel;
    return axis;
  };
  SliderTimelineView.prototype._createGroup = function (key) {
    var newGroup = this[key] = new Group$5();
    this.group.add(newGroup);
    return newGroup;
  };
  SliderTimelineView.prototype._renderAxisLine = function (layoutInfo, group, axis, timelineModel) {
    var axisExtent = axis.getExtent();
    if (!timelineModel.get(['lineStyle', 'show'])) {
      return;
    }
    var line = new Line$4({
      shape: {
        x1: axisExtent[0],
        y1: 0,
        x2: axisExtent[1],
        y2: 0
      },
      style: extend({
        lineCap: 'round'
      }, timelineModel.getModel('lineStyle').getLineStyle()),
      silent: true,
      z2: 1
    });
    group.add(line);
    var progressLine = this._progressLine = new Line$4({
      shape: {
        x1: axisExtent[0],
        x2: this._currentPointer ? this._currentPointer.x : axisExtent[0],
        y1: 0,
        y2: 0
      },
      style: defaults({
        lineCap: 'round',
        lineWidth: line.style.lineWidth
      }, timelineModel.getModel(['progress', 'lineStyle']).getLineStyle()),
      silent: true,
      z2: 1
    });
    group.add(progressLine);
  };
  SliderTimelineView.prototype._renderAxisTick = function (layoutInfo, group, axis, timelineModel) {
    var _this = this;
    var data = timelineModel.getData();
    // Show all ticks, despite ignoring strategy.
    var ticks = axis.scale.getTicks();
    this._tickSymbols = [];
    // The value is dataIndex, see the customized scale.
    each$f(ticks, function (tick) {
      var tickCoord = axis.dataToCoord(tick.value);
      var itemModel = data.getItemModel(tick.value);
      var itemStyleModel = itemModel.getModel('itemStyle');
      var hoverStyleModel = itemModel.getModel(['emphasis', 'itemStyle']);
      var progressStyleModel = itemModel.getModel(['progress', 'itemStyle']);
      var symbolOpt = {
        x: tickCoord,
        y: 0,
        onclick: bind$1(_this._changeTimeline, _this, tick.value)
      };
      var el = giveSymbol(itemModel, itemStyleModel, group, symbolOpt);
      el.ensureState('emphasis').style = hoverStyleModel.getItemStyle();
      el.ensureState('progress').style = progressStyleModel.getItemStyle();
      enableHoverEmphasis(el);
      var ecData = getECData(el);
      if (itemModel.get('tooltip')) {
        ecData.dataIndex = tick.value;
        ecData.dataModel = timelineModel;
      } else {
        ecData.dataIndex = ecData.dataModel = null;
      }
      _this._tickSymbols.push(el);
    });
  };
  SliderTimelineView.prototype._renderAxisLabel = function (layoutInfo, group, axis, timelineModel) {
    var _this = this;
    var labelModel = axis.getLabelModel();
    if (!labelModel.get('show')) {
      return;
    }
    var data = timelineModel.getData();
    var labels = axis.getViewLabels();
    this._tickLabels = [];
    each$f(labels, function (labelItem) {
      // The tickValue is dataIndex, see the customized scale.
      var dataIndex = labelItem.tickValue;
      var itemModel = data.getItemModel(dataIndex);
      var normalLabelModel = itemModel.getModel('label');
      var hoverLabelModel = itemModel.getModel(['emphasis', 'label']);
      var progressLabelModel = itemModel.getModel(['progress', 'label']);
      var tickCoord = axis.dataToCoord(labelItem.tickValue);
      var textEl = new ZRText$1({
        x: tickCoord,
        y: 0,
        rotation: layoutInfo.labelRotation - layoutInfo.rotation,
        onclick: bind$1(_this._changeTimeline, _this, dataIndex),
        silent: false,
        style: createTextStyle(normalLabelModel, {
          text: labelItem.formattedLabel,
          align: layoutInfo.labelAlign,
          verticalAlign: layoutInfo.labelBaseline
        })
      });
      textEl.ensureState('emphasis').style = createTextStyle(hoverLabelModel);
      textEl.ensureState('progress').style = createTextStyle(progressLabelModel);
      group.add(textEl);
      enableHoverEmphasis(textEl);
      labelDataIndexStore(textEl).dataIndex = dataIndex;
      _this._tickLabels.push(textEl);
    });
  };
  SliderTimelineView.prototype._renderControl = function (layoutInfo, group, axis, timelineModel) {
    var controlSize = layoutInfo.controlSize;
    var rotation = layoutInfo.rotation;
    var itemStyle = timelineModel.getModel('controlStyle').getItemStyle();
    var hoverStyle = timelineModel.getModel(['emphasis', 'controlStyle']).getItemStyle();
    var playState = timelineModel.getPlayState();
    var inverse = timelineModel.get('inverse', true);
    makeBtn(layoutInfo.nextBtnPosition, 'next', bind$1(this._changeTimeline, this, inverse ? '-' : '+'));
    makeBtn(layoutInfo.prevBtnPosition, 'prev', bind$1(this._changeTimeline, this, inverse ? '+' : '-'));
    makeBtn(layoutInfo.playPosition, playState ? 'stop' : 'play', bind$1(this._handlePlayClick, this, !playState), true);
    function makeBtn(position, iconName, onclick, willRotate) {
      if (!position) {
        return;
      }
      var iconSize = parsePercent$1(retrieve2(timelineModel.get(['controlStyle', iconName + 'BtnSize']), controlSize), controlSize);
      var rect = [0, -iconSize / 2, iconSize, iconSize];
      var btn = makeControlIcon(timelineModel, iconName + 'Icon', rect, {
        x: position[0],
        y: position[1],
        originX: controlSize / 2,
        originY: 0,
        rotation: willRotate ? -rotation : 0,
        rectHover: true,
        style: itemStyle,
        onclick: onclick
      });
      btn.ensureState('emphasis').style = hoverStyle;
      group.add(btn);
      enableHoverEmphasis(btn);
    }
  };
  SliderTimelineView.prototype._renderCurrentPointer = function (layoutInfo, group, axis, timelineModel) {
    var data = timelineModel.getData();
    var currentIndex = timelineModel.getCurrentIndex();
    var pointerModel = data.getItemModel(currentIndex).getModel('checkpointStyle');
    var me = this;
    var callback = {
      onCreate: function (pointer) {
        pointer.draggable = true;
        pointer.drift = bind$1(me._handlePointerDrag, me);
        pointer.ondragend = bind$1(me._handlePointerDragend, me);
        pointerMoveTo(pointer, me._progressLine, currentIndex, axis, timelineModel, true);
      },
      onUpdate: function (pointer) {
        pointerMoveTo(pointer, me._progressLine, currentIndex, axis, timelineModel);
      }
    };
    // Reuse when exists, for animation and drag.
    this._currentPointer = giveSymbol(pointerModel, pointerModel, this._mainGroup, {}, this._currentPointer, callback);
  };
  SliderTimelineView.prototype._handlePlayClick = function (nextState) {
    this._clearTimer();
    this.api.dispatchAction({
      type: 'timelinePlayChange',
      playState: nextState,
      from: this.uid
    });
  };
  SliderTimelineView.prototype._handlePointerDrag = function (dx, dy, e) {
    this._clearTimer();
    this._pointerChangeTimeline([e.offsetX, e.offsetY]);
  };
  SliderTimelineView.prototype._handlePointerDragend = function (e) {
    this._pointerChangeTimeline([e.offsetX, e.offsetY], true);
  };
  SliderTimelineView.prototype._pointerChangeTimeline = function (mousePos, trigger) {
    var toCoord = this._toAxisCoord(mousePos)[0];
    var axis = this._axis;
    var axisExtent = asc$2(axis.getExtent().slice());
    toCoord > axisExtent[1] && (toCoord = axisExtent[1]);
    toCoord < axisExtent[0] && (toCoord = axisExtent[0]);
    this._currentPointer.x = toCoord;
    this._currentPointer.markRedraw();
    var progressLine = this._progressLine;
    if (progressLine) {
      progressLine.shape.x2 = toCoord;
      progressLine.dirty();
    }
    var targetDataIndex = this._findNearestTick(toCoord);
    var timelineModel = this.model;
    if (trigger || targetDataIndex !== timelineModel.getCurrentIndex() && timelineModel.get('realtime')) {
      this._changeTimeline(targetDataIndex);
    }
  };
  SliderTimelineView.prototype._doPlayStop = function () {
    var _this = this;
    this._clearTimer();
    if (this.model.getPlayState()) {
      this._timer = setTimeout(function () {
        // Do not cache
        var timelineModel = _this.model;
        _this._changeTimeline(timelineModel.getCurrentIndex() + (timelineModel.get('rewind', true) ? -1 : 1));
      }, this.model.get('playInterval'));
    }
  };
  SliderTimelineView.prototype._toAxisCoord = function (vertex) {
    var trans = this._mainGroup.getLocalTransform();
    return applyTransform(vertex, trans, true);
  };
  SliderTimelineView.prototype._findNearestTick = function (axisCoord) {
    var data = this.model.getData();
    var dist = Infinity;
    var targetDataIndex;
    var axis = this._axis;
    data.each(['value'], function (value, dataIndex) {
      var coord = axis.dataToCoord(value);
      var d = Math.abs(coord - axisCoord);
      if (d < dist) {
        dist = d;
        targetDataIndex = dataIndex;
      }
    });
    return targetDataIndex;
  };
  SliderTimelineView.prototype._clearTimer = function () {
    if (this._timer) {
      clearTimeout(this._timer);
      this._timer = null;
    }
  };
  SliderTimelineView.prototype._changeTimeline = function (nextIndex) {
    var currentIndex = this.model.getCurrentIndex();
    if (nextIndex === '+') {
      nextIndex = currentIndex + 1;
    } else if (nextIndex === '-') {
      nextIndex = currentIndex - 1;
    }
    this.api.dispatchAction({
      type: 'timelineChange',
      currentIndex: nextIndex,
      from: this.uid
    });
  };
  SliderTimelineView.prototype._updateTicksStatus = function () {
    var currentIndex = this.model.getCurrentIndex();
    var tickSymbols = this._tickSymbols;
    var tickLabels = this._tickLabels;
    if (tickSymbols) {
      for (var i = 0; i < tickSymbols.length; i++) {
        tickSymbols && tickSymbols[i] && tickSymbols[i].toggleState('progress', i < currentIndex);
      }
    }
    if (tickLabels) {
      for (var i = 0; i < tickLabels.length; i++) {
        tickLabels && tickLabels[i] && tickLabels[i].toggleState('progress', labelDataIndexStore(tickLabels[i]).dataIndex <= currentIndex);
      }
    }
  };
  SliderTimelineView.type = 'timeline.slider';
  return SliderTimelineView;
}(TimelineView$1);
function createScaleByModel(model, axisType) {
  axisType = axisType || model.get('type');
  if (axisType) {
    switch (axisType) {
      // Buildin scale
      case 'category':
        return new OrdinalScale$1({
          ordinalMeta: model.getCategories(),
          extent: [Infinity, -Infinity]
        });
      case 'time':
        return new TimeScale$1({
          locale: model.ecModel.getLocaleModel(),
          useUTC: model.ecModel.get('useUTC')
        });
      default:
        // default to be value
        return new IntervalScale$1();
    }
  }
}
function getViewRect(model, api) {
  return getLayoutRect(model.getBoxLayoutParams(), {
    width: api.getWidth(),
    height: api.getHeight()
  }, model.get('padding'));
}
function makeControlIcon(timelineModel, objPath, rect, opts) {
  var style = opts.style;
  var icon = createIcon(timelineModel.get(['controlStyle', objPath]), opts || {}, new BoundingRect$1(rect[0], rect[1], rect[2], rect[3]));
  // TODO createIcon won't use style in opt.
  if (style) {
    icon.setStyle(style);
  }
  return icon;
}
/**
 * Create symbol or update symbol
 * opt: basic position and event handlers
 */
function giveSymbol(hostModel, itemStyleModel, group, opt, symbol, callback) {
  var color = itemStyleModel.get('color');
  if (!symbol) {
    var symbolType = hostModel.get('symbol');
    symbol = createSymbol$1(symbolType, -1, -1, 2, 2, color);
    symbol.setStyle('strokeNoScale', true);
    group.add(symbol);
    callback && callback.onCreate(symbol);
  } else {
    symbol.setColor(color);
    group.add(symbol); // Group may be new, also need to add.
    callback && callback.onUpdate(symbol);
  }
  // Style
  var itemStyle = itemStyleModel.getItemStyle(['color']);
  symbol.setStyle(itemStyle);
  // Transform and events.
  opt = merge({
    rectHover: true,
    z2: 100
  }, opt, true);
  var symbolSize = normalizeSymbolSize(hostModel.get('symbolSize'));
  opt.scaleX = symbolSize[0] / 2;
  opt.scaleY = symbolSize[1] / 2;
  var symbolOffset = normalizeSymbolOffset(hostModel.get('symbolOffset'), symbolSize);
  if (symbolOffset) {
    opt.x = (opt.x || 0) + symbolOffset[0];
    opt.y = (opt.y || 0) + symbolOffset[1];
  }
  var symbolRotate = hostModel.get('symbolRotate');
  opt.rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
  symbol.attr(opt);
  // FIXME
  // (1) When symbol.style.strokeNoScale is true and updateTransform is not performed,
  // getBoundingRect will return wrong result.
  // (This is supposed to be resolved in zrender, but it is a little difficult to
  // leverage performance and auto updateTransform)
  // (2) All of ancesters of symbol do not scale, so we can just updateTransform symbol.
  symbol.updateTransform();
  return symbol;
}
function pointerMoveTo(pointer, progressLine, dataIndex, axis, timelineModel, noAnimation) {
  if (pointer.dragging) {
    return;
  }
  var pointerModel = timelineModel.getModel('checkpointStyle');
  var toCoord = axis.dataToCoord(timelineModel.getData().get('value', dataIndex));
  if (noAnimation || !pointerModel.get('animation', true)) {
    pointer.attr({
      x: toCoord,
      y: 0
    });
    progressLine && progressLine.attr({
      shape: {
        x2: toCoord
      }
    });
  } else {
    var animationCfg = {
      duration: pointerModel.get('animationDuration', true),
      easing: pointerModel.get('animationEasing', true)
    };
    pointer.stopAnimation(null, true);
    pointer.animateTo({
      x: toCoord,
      y: 0
    }, animationCfg);
    progressLine && progressLine.animateTo({
      shape: {
        x2: toCoord
      }
    }, animationCfg);
  }
}
var SliderTimelineView$1 = SliderTimelineView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function installTimelineAction(registers) {
  registers.registerAction({
    type: 'timelineChange',
    event: 'timelineChanged',
    update: 'prepareAndUpdate'
  }, function (payload, ecModel, api) {
    var timelineModel = ecModel.getComponent('timeline');
    if (timelineModel && payload.currentIndex != null) {
      timelineModel.setCurrentIndex(payload.currentIndex);
      if (!timelineModel.get('loop', true) && timelineModel.isIndexMax() && timelineModel.getPlayState()) {
        timelineModel.setPlayState(false);
        // The timeline has played to the end, trigger event
        api.dispatchAction({
          type: 'timelinePlayChange',
          playState: false,
          from: payload.from
        });
      }
    }
    // Set normalized currentIndex to payload.
    ecModel.resetOption('timeline', {
      replaceMerge: timelineModel.get('replaceMerge', true)
    });
    return defaults({
      currentIndex: timelineModel.option.currentIndex
    }, payload);
  });
  registers.registerAction({
    type: 'timelinePlayChange',
    event: 'timelinePlayChanged',
    update: 'update'
  }, function (payload, ecModel) {
    var timelineModel = ecModel.getComponent('timeline');
    if (timelineModel && payload.playState != null) {
      timelineModel.setPlayState(payload.playState);
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function timelinePreprocessor(option) {
  var timelineOpt = option && option.timeline;
  if (!isArray$1(timelineOpt)) {
    timelineOpt = timelineOpt ? [timelineOpt] : [];
  }
  each$f(timelineOpt, function (opt) {
    if (!opt) {
      return;
    }
    compatibleEC2(opt);
  });
}
function compatibleEC2(opt) {
  var type = opt.type;
  var ec2Types = {
    'number': 'value',
    'time': 'time'
  };
  // Compatible with ec2
  if (ec2Types[type]) {
    opt.axisType = ec2Types[type];
    delete opt.type;
  }
  transferItem(opt);
  if (has$1(opt, 'controlPosition')) {
    var controlStyle = opt.controlStyle || (opt.controlStyle = {});
    if (!has$1(controlStyle, 'position')) {
      controlStyle.position = opt.controlPosition;
    }
    if (controlStyle.position === 'none' && !has$1(controlStyle, 'show')) {
      controlStyle.show = false;
      delete controlStyle.position;
    }
    delete opt.controlPosition;
  }
  each$f(opt.data || [], function (dataItem) {
    if (isObject$3(dataItem) && !isArray$1(dataItem)) {
      if (!has$1(dataItem, 'value') && has$1(dataItem, 'name')) {
        // In ec2, using name as value.
        dataItem.value = dataItem.name;
      }
      transferItem(dataItem);
    }
  });
}
function transferItem(opt) {
  var itemStyle = opt.itemStyle || (opt.itemStyle = {});
  var itemStyleEmphasis = itemStyle.emphasis || (itemStyle.emphasis = {});
  // Transfer label out
  var label = opt.label || opt.label || {};
  var labelNormal = label.normal || (label.normal = {});
  var excludeLabelAttr = {
    normal: 1,
    emphasis: 1
  };
  each$f(label, function (value, name) {
    if (!excludeLabelAttr[name] && !has$1(labelNormal, name)) {
      labelNormal[name] = value;
    }
  });
  if (itemStyleEmphasis.label && !has$1(label, 'emphasis')) {
    label.emphasis = itemStyleEmphasis.label;
    delete itemStyleEmphasis.label;
  }
}
function has$1(obj, attr) {
  return obj.hasOwnProperty(attr);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$h(registers) {
  registers.registerComponentModel(SliderTimelineModel$1);
  registers.registerComponentView(SliderTimelineView$1);
  registers.registerSubTypeDefaulter('timeline', function () {
    // Only slider now.
    return 'slider';
  });
  installTimelineAction(registers);
  registers.registerPreprocessor(timelinePreprocessor);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function checkMarkerInSeries(seriesOpts, markerType) {
  if (!seriesOpts) {
    return false;
  }
  var seriesOptArr = isArray$1(seriesOpts) ? seriesOpts : [seriesOpts];
  for (var idx = 0; idx < seriesOptArr.length; idx++) {
    if (seriesOptArr[idx] && seriesOptArr[idx][markerType]) {
      return true;
    }
  }
  return false;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function fillLabel(opt) {
  defaultEmphasis(opt, 'label', ['show']);
}
// { [componentType]: MarkerModel }
var inner$5 = makeInner();
var MarkerModel = /** @class */function (_super) {
  __extends(MarkerModel, _super);
  function MarkerModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MarkerModel.type;
    /**
     * If marker model is created by self from series
     */
    _this.createdBySelf = false;
    return _this;
  }
  /**
   * @overrite
   */
  MarkerModel.prototype.init = function (option, parentModel, ecModel) {
    {
      if (this.type === 'marker') {
        throw new Error('Marker component is abstract component. Use markLine, markPoint, markArea instead.');
      }
    }
    this.mergeDefaultAndTheme(option, ecModel);
    this._mergeOption(option, ecModel, false, true);
  };
  MarkerModel.prototype.isAnimationEnabled = function () {
    if (env$1.node) {
      return false;
    }
    var hostSeries = this.__hostSeries;
    return this.getShallow('animation') && hostSeries && hostSeries.isAnimationEnabled();
  };
  /**
   * @overrite
   */
  MarkerModel.prototype.mergeOption = function (newOpt, ecModel) {
    this._mergeOption(newOpt, ecModel, false, false);
  };
  MarkerModel.prototype._mergeOption = function (newOpt, ecModel, createdBySelf, isInit) {
    var componentType = this.mainType;
    if (!createdBySelf) {
      ecModel.eachSeries(function (seriesModel) {
        // mainType can be markPoint, markLine, markArea
        var markerOpt = seriesModel.get(this.mainType, true);
        var markerModel = inner$5(seriesModel)[componentType];
        if (!markerOpt || !markerOpt.data) {
          inner$5(seriesModel)[componentType] = null;
          return;
        }
        if (!markerModel) {
          if (isInit) {
            // Default label emphasis `position` and `show`
            fillLabel(markerOpt);
          }
          each$f(markerOpt.data, function (item) {
            // FIXME Overwrite fillLabel method ?
            if (item instanceof Array) {
              fillLabel(item[0]);
              fillLabel(item[1]);
            } else {
              fillLabel(item);
            }
          });
          markerModel = this.createMarkerModelFromSeries(markerOpt, this, ecModel);
          // markerModel = new ImplementedMarkerModel(
          //     markerOpt, this, ecModel
          // );
          extend(markerModel, {
            mainType: this.mainType,
            // Use the same series index and name
            seriesIndex: seriesModel.seriesIndex,
            name: seriesModel.name,
            createdBySelf: true
          });
          markerModel.__hostSeries = seriesModel;
        } else {
          markerModel._mergeOption(markerOpt, ecModel, true);
        }
        inner$5(seriesModel)[componentType] = markerModel;
      }, this);
    }
  };
  MarkerModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
    var data = this.getData();
    var value = this.getRawValue(dataIndex);
    var itemName = data.getName(dataIndex);
    return createTooltipMarkup('section', {
      header: this.name,
      blocks: [createTooltipMarkup('nameValue', {
        name: itemName,
        value: value,
        noName: !itemName,
        noValue: value == null
      })]
    });
  };
  MarkerModel.prototype.getData = function () {
    return this._data;
  };
  MarkerModel.prototype.setData = function (data) {
    this._data = data;
  };
  MarkerModel.prototype.getDataParams = function (dataIndex, dataType) {
    var params = DataFormatMixin.prototype.getDataParams.call(this, dataIndex, dataType);
    var hostSeries = this.__hostSeries;
    if (hostSeries) {
      params.seriesId = hostSeries.id;
      params.seriesName = hostSeries.name;
      params.seriesType = hostSeries.subType;
    }
    return params;
  };
  MarkerModel.getMarkerModelFromSeries = function (seriesModel,
  // Support three types of markers. Strict check.
  componentType) {
    return inner$5(seriesModel)[componentType];
  };
  MarkerModel.type = 'marker';
  MarkerModel.dependencies = ['series', 'grid', 'polar', 'geo'];
  return MarkerModel;
}(ComponentModel$1);
mixin(MarkerModel, DataFormatMixin.prototype);
var MarkerModel$1 = MarkerModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var MarkPointModel = /** @class */function (_super) {
  __extends(MarkPointModel, _super);
  function MarkPointModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MarkPointModel.type;
    return _this;
  }
  MarkPointModel.prototype.createMarkerModelFromSeries = function (markerOpt, masterMarkerModel, ecModel) {
    return new MarkPointModel(markerOpt, masterMarkerModel, ecModel);
  };
  MarkPointModel.type = 'markPoint';
  MarkPointModel.defaultOption = {
    // zlevel: 0,
    z: 5,
    symbol: 'pin',
    symbolSize: 50,
    // symbolRotate: 0,
    // symbolOffset: [0, 0]
    tooltip: {
      trigger: 'item'
    },
    label: {
      show: true,
      position: 'inside'
    },
    itemStyle: {
      borderWidth: 2
    },
    emphasis: {
      label: {
        show: true
      }
    }
  };
  return MarkPointModel;
}(MarkerModel$1);
var MarkPointModel$1 = MarkPointModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function hasXOrY(item) {
  return !(isNaN(parseFloat(item.x)) && isNaN(parseFloat(item.y)));
}
function hasXAndY(item) {
  return !isNaN(parseFloat(item.x)) && !isNaN(parseFloat(item.y));
}
function markerTypeCalculatorWithExtent(markerType, data, otherDataDim, targetDataDim, otherCoordIndex, targetCoordIndex) {
  var coordArr = [];
  var stacked = isDimensionStacked(data, targetDataDim /* , otherDataDim */);
  var calcDataDim = stacked ? data.getCalculationInfo('stackResultDimension') : targetDataDim;
  var value = numCalculate(data, calcDataDim, markerType);
  var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];
  coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);
  coordArr[targetCoordIndex] = data.get(calcDataDim, dataIndex);
  var coordArrValue = data.get(targetDataDim, dataIndex);
  // Make it simple, do not visit all stacked value to count precision.
  var precision = getPrecision(data.get(targetDataDim, dataIndex));
  precision = Math.min(precision, 20);
  if (precision >= 0) {
    coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);
  }
  return [coordArr, coordArrValue];
}
// TODO Specified percent
var markerTypeCalculator = {
  min: curry$1(markerTypeCalculatorWithExtent, 'min'),
  max: curry$1(markerTypeCalculatorWithExtent, 'max'),
  average: curry$1(markerTypeCalculatorWithExtent, 'average'),
  median: curry$1(markerTypeCalculatorWithExtent, 'median')
};
/**
 * Transform markPoint data item to format used in List by do the following
 * 1. Calculate statistic like `max`, `min`, `average`
 * 2. Convert `item.xAxis`, `item.yAxis` to `item.coord` array
 */
function dataTransform(seriesModel, item) {
  if (!item) {
    return;
  }
  var data = seriesModel.getData();
  var coordSys = seriesModel.coordinateSystem;
  var dims = coordSys && coordSys.dimensions;
  // 1. If not specify the position with pixel directly
  // 2. If `coord` is not a data array. Which uses `xAxis`,
  // `yAxis` to specify the coord on each dimension
  // parseFloat first because item.x and item.y can be percent string like '20%'
  if (!hasXAndY(item) && !isArray$1(item.coord) && isArray$1(dims)) {
    var axisInfo = getAxisInfo(item, data, coordSys, seriesModel);
    // Clone the option
    // Transform the properties xAxis, yAxis, radiusAxis, angleAxis, geoCoord to value
    item = clone$4(item);
    if (item.type && markerTypeCalculator[item.type] && axisInfo.baseAxis && axisInfo.valueAxis) {
      var otherCoordIndex = indexOf(dims, axisInfo.baseAxis.dim);
      var targetCoordIndex = indexOf(dims, axisInfo.valueAxis.dim);
      var coordInfo = markerTypeCalculator[item.type](data, axisInfo.baseDataDim, axisInfo.valueDataDim, otherCoordIndex, targetCoordIndex);
      item.coord = coordInfo[0];
      // Force to use the value of calculated value.
      // let item use the value without stack.
      item.value = coordInfo[1];
    } else {
      // FIXME Only has one of xAxis and yAxis.
      item.coord = [item.xAxis != null ? item.xAxis : item.radiusAxis, item.yAxis != null ? item.yAxis : item.angleAxis];
    }
  }
  // x y is provided
  if (item.coord == null || !isArray$1(dims)) {
    item.coord = [];
  } else {
    // Each coord support max, min, average
    var coord = item.coord;
    for (var i = 0; i < 2; i++) {
      if (markerTypeCalculator[coord[i]]) {
        coord[i] = numCalculate(data, data.mapDimension(dims[i]), coord[i]);
      }
    }
  }
  return item;
}
function getAxisInfo(item, data, coordSys, seriesModel) {
  var ret = {};
  if (item.valueIndex != null || item.valueDim != null) {
    ret.valueDataDim = item.valueIndex != null ? data.getDimension(item.valueIndex) : item.valueDim;
    ret.valueAxis = coordSys.getAxis(dataDimToCoordDim(seriesModel, ret.valueDataDim));
    ret.baseAxis = coordSys.getOtherAxis(ret.valueAxis);
    ret.baseDataDim = data.mapDimension(ret.baseAxis.dim);
  } else {
    ret.baseAxis = seriesModel.getBaseAxis();
    ret.valueAxis = coordSys.getOtherAxis(ret.baseAxis);
    ret.baseDataDim = data.mapDimension(ret.baseAxis.dim);
    ret.valueDataDim = data.mapDimension(ret.valueAxis.dim);
  }
  return ret;
}
function dataDimToCoordDim(seriesModel, dataDim) {
  var dimItem = seriesModel.getData().getDimensionInfo(dataDim);
  return dimItem && dimItem.coordDim;
}
/**
 * Filter data which is out of coordinateSystem range
 * [dataFilter description]
 */
function dataFilter(
// Currently only polar and cartesian has containData.
coordSys, item) {
  // Always return true if there is no coordSys
  return coordSys && coordSys.containData && item.coord && !hasXOrY(item) ? coordSys.containData(item.coord) : true;
}
function zoneFilter(
// Currently only polar and cartesian has containData.
coordSys, item1, item2) {
  // Always return true if there is no coordSys
  return coordSys && coordSys.containZone && item1.coord && item2.coord && !hasXOrY(item1) && !hasXOrY(item2) ? coordSys.containZone(item1.coord, item2.coord) : true;
}
function createMarkerDimValueGetter(inCoordSys, dims) {
  return inCoordSys ? function (item, dimName, dataIndex, dimIndex) {
    var rawVal = dimIndex < 2
    // x, y, radius, angle
    ? item.coord && item.coord[dimIndex] : item.value;
    return parseDataValue(rawVal, dims[dimIndex]);
  } : function (item, dimName, dataIndex, dimIndex) {
    return parseDataValue(item.value, dims[dimIndex]);
  };
}
function numCalculate(data, valueDataDim, type) {
  if (type === 'average') {
    var sum_1 = 0;
    var count_1 = 0;
    data.each(valueDataDim, function (val, idx) {
      if (!isNaN(val)) {
        sum_1 += val;
        count_1++;
      }
    });
    return sum_1 / count_1;
  } else if (type === 'median') {
    return data.getMedian(valueDataDim);
  } else {
    // max & min
    return data.getDataExtent(valueDataDim)[type === 'max' ? 1 : 0];
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$4 = makeInner();
var MarkerView = /** @class */function (_super) {
  __extends(MarkerView, _super);
  function MarkerView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MarkerView.type;
    return _this;
  }
  MarkerView.prototype.init = function () {
    this.markerGroupMap = createHashMap();
  };
  MarkerView.prototype.render = function (markerModel, ecModel, api) {
    var _this = this;
    var markerGroupMap = this.markerGroupMap;
    markerGroupMap.each(function (item) {
      inner$4(item).keep = false;
    });
    ecModel.eachSeries(function (seriesModel) {
      var markerModel = MarkerModel$1.getMarkerModelFromSeries(seriesModel, _this.type);
      markerModel && _this.renderSeries(seriesModel, markerModel, ecModel, api);
    });
    markerGroupMap.each(function (item) {
      !inner$4(item).keep && _this.group.remove(item.group);
    });
  };
  MarkerView.prototype.markKeep = function (drawGroup) {
    inner$4(drawGroup).keep = true;
  };
  MarkerView.prototype.toggleBlurSeries = function (seriesModelList, isBlur) {
    var _this = this;
    each$f(seriesModelList, function (seriesModel) {
      var markerModel = MarkerModel$1.getMarkerModelFromSeries(seriesModel, _this.type);
      if (markerModel) {
        var data = markerModel.getData();
        data.eachItemGraphicEl(function (el) {
          if (el) {
            isBlur ? enterBlur(el) : leaveBlur(el);
          }
        });
      }
    });
  };
  MarkerView.type = 'marker';
  return MarkerView;
}(ComponentView$1);
var MarkerView$1 = MarkerView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function updateMarkerLayout(mpData, seriesModel, api) {
  var coordSys = seriesModel.coordinateSystem;
  mpData.each(function (idx) {
    var itemModel = mpData.getItemModel(idx);
    var point;
    var xPx = parsePercent(itemModel.get('x'), api.getWidth());
    var yPx = parsePercent(itemModel.get('y'), api.getHeight());
    if (!isNaN(xPx) && !isNaN(yPx)) {
      point = [xPx, yPx];
    }
    // Chart like bar may have there own marker positioning logic
    else if (seriesModel.getMarkerPosition) {
      // Use the getMarkerPosition
      point = seriesModel.getMarkerPosition(mpData.getValues(mpData.dimensions, idx));
    } else if (coordSys) {
      var x = mpData.get(coordSys.dimensions[0], idx);
      var y = mpData.get(coordSys.dimensions[1], idx);
      point = coordSys.dataToPoint([x, y]);
    }
    // Use x, y if has any
    if (!isNaN(xPx)) {
      point[0] = xPx;
    }
    if (!isNaN(yPx)) {
      point[1] = yPx;
    }
    mpData.setItemLayout(idx, point);
  });
}
var MarkPointView = /** @class */function (_super) {
  __extends(MarkPointView, _super);
  function MarkPointView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MarkPointView.type;
    return _this;
  }
  MarkPointView.prototype.updateTransform = function (markPointModel, ecModel, api) {
    ecModel.eachSeries(function (seriesModel) {
      var mpModel = MarkerModel$1.getMarkerModelFromSeries(seriesModel, 'markPoint');
      if (mpModel) {
        updateMarkerLayout(mpModel.getData(), seriesModel, api);
        this.markerGroupMap.get(seriesModel.id).updateLayout();
      }
    }, this);
  };
  MarkPointView.prototype.renderSeries = function (seriesModel, mpModel, ecModel, api) {
    var coordSys = seriesModel.coordinateSystem;
    var seriesId = seriesModel.id;
    var seriesData = seriesModel.getData();
    var symbolDrawMap = this.markerGroupMap;
    var symbolDraw = symbolDrawMap.get(seriesId) || symbolDrawMap.set(seriesId, new SymbolDraw$1());
    var mpData = createData(coordSys, seriesModel, mpModel);
    // FIXME
    mpModel.setData(mpData);
    updateMarkerLayout(mpModel.getData(), seriesModel, api);
    mpData.each(function (idx) {
      var itemModel = mpData.getItemModel(idx);
      var symbol = itemModel.getShallow('symbol');
      var symbolSize = itemModel.getShallow('symbolSize');
      var symbolRotate = itemModel.getShallow('symbolRotate');
      var symbolOffset = itemModel.getShallow('symbolOffset');
      var symbolKeepAspect = itemModel.getShallow('symbolKeepAspect');
      // TODO: refactor needed: single data item should not support callback function
      if (isFunction(symbol) || isFunction(symbolSize) || isFunction(symbolRotate) || isFunction(symbolOffset)) {
        var rawIdx = mpModel.getRawValue(idx);
        var dataParams = mpModel.getDataParams(idx);
        if (isFunction(symbol)) {
          symbol = symbol(rawIdx, dataParams);
        }
        if (isFunction(symbolSize)) {
          // FIXME 这里不兼容 ECharts 2.x，2.x 貌似参数是整个数据？
          symbolSize = symbolSize(rawIdx, dataParams);
        }
        if (isFunction(symbolRotate)) {
          symbolRotate = symbolRotate(rawIdx, dataParams);
        }
        if (isFunction(symbolOffset)) {
          symbolOffset = symbolOffset(rawIdx, dataParams);
        }
      }
      var style = itemModel.getModel('itemStyle').getItemStyle();
      var color = getVisualFromData(seriesData, 'color');
      if (!style.fill) {
        style.fill = color;
      }
      mpData.setItemVisual(idx, {
        symbol: symbol,
        symbolSize: symbolSize,
        symbolRotate: symbolRotate,
        symbolOffset: symbolOffset,
        symbolKeepAspect: symbolKeepAspect,
        style: style
      });
    });
    // TODO Text are wrong
    symbolDraw.updateData(mpData);
    this.group.add(symbolDraw.group);
    // Set host model for tooltip
    // FIXME
    mpData.eachItemGraphicEl(function (el) {
      el.traverse(function (child) {
        getECData(child).dataModel = mpModel;
      });
    });
    this.markKeep(symbolDraw);
    symbolDraw.group.silent = mpModel.get('silent') || seriesModel.get('silent');
  };
  MarkPointView.type = 'markPoint';
  return MarkPointView;
}(MarkerView$1);
function createData(coordSys, seriesModel, mpModel) {
  var coordDimsInfos;
  if (coordSys) {
    coordDimsInfos = map$1(coordSys && coordSys.dimensions, function (coordDim) {
      var info = seriesModel.getData().getDimensionInfo(seriesModel.getData().mapDimension(coordDim)) || {};
      // In map series data don't have lng and lat dimension. Fallback to same with coordSys
      return extend(extend({}, info), {
        name: coordDim,
        // DON'T use ordinalMeta to parse and collect ordinal.
        ordinalMeta: null
      });
    });
  } else {
    coordDimsInfos = [{
      name: 'value',
      type: 'float'
    }];
  }
  var mpData = new SeriesData$1(coordDimsInfos, mpModel);
  var dataOpt = map$1(mpModel.get('data'), curry$1(dataTransform, seriesModel));
  if (coordSys) {
    dataOpt = filter(dataOpt, curry$1(dataFilter, coordSys));
  }
  var dimValueGetter = createMarkerDimValueGetter(!!coordSys, coordDimsInfos);
  mpData.initData(dataOpt, null, dimValueGetter);
  return mpData;
}
var MarkPointView$1 = MarkPointView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$g(registers) {
  registers.registerComponentModel(MarkPointModel$1);
  registers.registerComponentView(MarkPointView$1);
  registers.registerPreprocessor(function (opt) {
    if (checkMarkerInSeries(opt.series, 'markPoint')) {
      // Make sure markPoint component is enabled
      opt.markPoint = opt.markPoint || {};
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var MarkLineModel = /** @class */function (_super) {
  __extends(MarkLineModel, _super);
  function MarkLineModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MarkLineModel.type;
    return _this;
  }
  MarkLineModel.prototype.createMarkerModelFromSeries = function (markerOpt, masterMarkerModel, ecModel) {
    return new MarkLineModel(markerOpt, masterMarkerModel, ecModel);
  };
  MarkLineModel.type = 'markLine';
  MarkLineModel.defaultOption = {
    // zlevel: 0,
    z: 5,
    symbol: ['circle', 'arrow'],
    symbolSize: [8, 16],
    // symbolRotate: 0,
    symbolOffset: 0,
    precision: 2,
    tooltip: {
      trigger: 'item'
    },
    label: {
      show: true,
      position: 'end',
      distance: 5
    },
    lineStyle: {
      type: 'dashed'
    },
    emphasis: {
      label: {
        show: true
      },
      lineStyle: {
        width: 3
      }
    },
    animationEasing: 'linear'
  };
  return MarkLineModel;
}(MarkerModel$1);
var MarkLineModel$1 = MarkLineModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$3 = makeInner();
var markLineTransform = function (seriesModel, coordSys, mlModel, item) {
  var data = seriesModel.getData();
  var itemArray;
  if (!isArray$1(item)) {
    // Special type markLine like 'min', 'max', 'average', 'median'
    var mlType = item.type;
    if (mlType === 'min' || mlType === 'max' || mlType === 'average' || mlType === 'median'
    // In case
    // data: [{
    //   yAxis: 10
    // }]
    || item.xAxis != null || item.yAxis != null) {
      var valueAxis = void 0;
      var value = void 0;
      if (item.yAxis != null || item.xAxis != null) {
        valueAxis = coordSys.getAxis(item.yAxis != null ? 'y' : 'x');
        value = retrieve(item.yAxis, item.xAxis);
      } else {
        var axisInfo = getAxisInfo(item, data, coordSys, seriesModel);
        valueAxis = axisInfo.valueAxis;
        var valueDataDim = getStackedDimension(data, axisInfo.valueDataDim);
        value = numCalculate(data, valueDataDim, mlType);
      }
      var valueIndex = valueAxis.dim === 'x' ? 0 : 1;
      var baseIndex = 1 - valueIndex;
      // Normized to 2d data with start and end point
      var mlFrom = clone$4(item);
      var mlTo = {
        coord: []
      };
      mlFrom.type = null;
      mlFrom.coord = [];
      mlFrom.coord[baseIndex] = -Infinity;
      mlTo.coord[baseIndex] = Infinity;
      var precision = mlModel.get('precision');
      if (precision >= 0 && isNumber(value)) {
        value = +value.toFixed(Math.min(precision, 20));
      }
      mlFrom.coord[valueIndex] = mlTo.coord[valueIndex] = value;
      itemArray = [mlFrom, mlTo, {
        type: mlType,
        valueIndex: item.valueIndex,
        // Force to use the value of calculated value.
        value: value
      }];
    } else {
      // Invalid data
      {
        logError('Invalid markLine data.');
      }
      itemArray = [];
    }
  } else {
    itemArray = item;
  }
  var normalizedItem = [dataTransform(seriesModel, itemArray[0]), dataTransform(seriesModel, itemArray[1]), extend({}, itemArray[2])];
  // Avoid line data type is extended by from(to) data type
  normalizedItem[2].type = normalizedItem[2].type || null;
  // Merge from option and to option into line option
  merge(normalizedItem[2], normalizedItem[0]);
  merge(normalizedItem[2], normalizedItem[1]);
  return normalizedItem;
};
function isInfinity$1(val) {
  return !isNaN(val) && !isFinite(val);
}
// If a markLine has one dim
function ifMarkLineHasOnlyDim(dimIndex, fromCoord, toCoord, coordSys) {
  var otherDimIndex = 1 - dimIndex;
  var dimName = coordSys.dimensions[dimIndex];
  return isInfinity$1(fromCoord[otherDimIndex]) && isInfinity$1(toCoord[otherDimIndex]) && fromCoord[dimIndex] === toCoord[dimIndex] && coordSys.getAxis(dimName).containData(fromCoord[dimIndex]);
}
function markLineFilter(coordSys, item) {
  if (coordSys.type === 'cartesian2d') {
    var fromCoord = item[0].coord;
    var toCoord = item[1].coord;
    // In case
    // {
    //  markLine: {
    //    data: [{ yAxis: 2 }]
    //  }
    // }
    if (fromCoord && toCoord && (ifMarkLineHasOnlyDim(1, fromCoord, toCoord, coordSys) || ifMarkLineHasOnlyDim(0, fromCoord, toCoord, coordSys))) {
      return true;
    }
  }
  return dataFilter(coordSys, item[0]) && dataFilter(coordSys, item[1]);
}
function updateSingleMarkerEndLayout(data, idx, isFrom, seriesModel, api) {
  var coordSys = seriesModel.coordinateSystem;
  var itemModel = data.getItemModel(idx);
  var point;
  var xPx = parsePercent(itemModel.get('x'), api.getWidth());
  var yPx = parsePercent(itemModel.get('y'), api.getHeight());
  if (!isNaN(xPx) && !isNaN(yPx)) {
    point = [xPx, yPx];
  } else {
    // Chart like bar may have there own marker positioning logic
    if (seriesModel.getMarkerPosition) {
      // Use the getMarkerPosition
      point = seriesModel.getMarkerPosition(data.getValues(data.dimensions, idx));
    } else {
      var dims = coordSys.dimensions;
      var x = data.get(dims[0], idx);
      var y = data.get(dims[1], idx);
      point = coordSys.dataToPoint([x, y]);
    }
    // Expand line to the edge of grid if value on one axis is Inifnity
    // In case
    //  markLine: {
    //    data: [{
    //      yAxis: 2
    //      // or
    //      type: 'average'
    //    }]
    //  }
    if (isCoordinateSystemType(coordSys, 'cartesian2d')) {
      // TODO: TYPE ts@4.1 may still infer it as Axis instead of Axis2D. Not sure if it's a bug
      var xAxis = coordSys.getAxis('x');
      var yAxis = coordSys.getAxis('y');
      var dims = coordSys.dimensions;
      if (isInfinity$1(data.get(dims[0], idx))) {
        point[0] = xAxis.toGlobalCoord(xAxis.getExtent()[isFrom ? 0 : 1]);
      } else if (isInfinity$1(data.get(dims[1], idx))) {
        point[1] = yAxis.toGlobalCoord(yAxis.getExtent()[isFrom ? 0 : 1]);
      }
    }
    // Use x, y if has any
    if (!isNaN(xPx)) {
      point[0] = xPx;
    }
    if (!isNaN(yPx)) {
      point[1] = yPx;
    }
  }
  data.setItemLayout(idx, point);
}
var MarkLineView = /** @class */function (_super) {
  __extends(MarkLineView, _super);
  function MarkLineView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MarkLineView.type;
    return _this;
  }
  MarkLineView.prototype.updateTransform = function (markLineModel, ecModel, api) {
    ecModel.eachSeries(function (seriesModel) {
      var mlModel = MarkerModel$1.getMarkerModelFromSeries(seriesModel, 'markLine');
      if (mlModel) {
        var mlData_1 = mlModel.getData();
        var fromData_1 = inner$3(mlModel).from;
        var toData_1 = inner$3(mlModel).to;
        // Update visual and layout of from symbol and to symbol
        fromData_1.each(function (idx) {
          updateSingleMarkerEndLayout(fromData_1, idx, true, seriesModel, api);
          updateSingleMarkerEndLayout(toData_1, idx, false, seriesModel, api);
        });
        // Update layout of line
        mlData_1.each(function (idx) {
          mlData_1.setItemLayout(idx, [fromData_1.getItemLayout(idx), toData_1.getItemLayout(idx)]);
        });
        this.markerGroupMap.get(seriesModel.id).updateLayout();
      }
    }, this);
  };
  MarkLineView.prototype.renderSeries = function (seriesModel, mlModel, ecModel, api) {
    var coordSys = seriesModel.coordinateSystem;
    var seriesId = seriesModel.id;
    var seriesData = seriesModel.getData();
    var lineDrawMap = this.markerGroupMap;
    var lineDraw = lineDrawMap.get(seriesId) || lineDrawMap.set(seriesId, new LineDraw$1());
    this.group.add(lineDraw.group);
    var mlData = createList$1(coordSys, seriesModel, mlModel);
    var fromData = mlData.from;
    var toData = mlData.to;
    var lineData = mlData.line;
    inner$3(mlModel).from = fromData;
    inner$3(mlModel).to = toData;
    // Line data for tooltip and formatter
    mlModel.setData(lineData);
    // TODO
    // Functionally, `symbolSize` & `symbolOffset` can also be 2D array now.
    // But the related logic and type definition are not finished yet.
    // Finish it if required
    var symbolType = mlModel.get('symbol');
    var symbolSize = mlModel.get('symbolSize');
    var symbolRotate = mlModel.get('symbolRotate');
    var symbolOffset = mlModel.get('symbolOffset');
    // TODO: support callback function like markPoint
    if (!isArray$1(symbolType)) {
      symbolType = [symbolType, symbolType];
    }
    if (!isArray$1(symbolSize)) {
      symbolSize = [symbolSize, symbolSize];
    }
    if (!isArray$1(symbolRotate)) {
      symbolRotate = [symbolRotate, symbolRotate];
    }
    if (!isArray$1(symbolOffset)) {
      symbolOffset = [symbolOffset, symbolOffset];
    }
    // Update visual and layout of from symbol and to symbol
    mlData.from.each(function (idx) {
      updateDataVisualAndLayout(fromData, idx, true);
      updateDataVisualAndLayout(toData, idx, false);
    });
    // Update visual and layout of line
    lineData.each(function (idx) {
      var lineStyle = lineData.getItemModel(idx).getModel('lineStyle').getLineStyle();
      // lineData.setItemVisual(idx, {
      //     color: lineColor || fromData.getItemVisual(idx, 'color')
      // });
      lineData.setItemLayout(idx, [fromData.getItemLayout(idx), toData.getItemLayout(idx)]);
      if (lineStyle.stroke == null) {
        lineStyle.stroke = fromData.getItemVisual(idx, 'style').fill;
      }
      lineData.setItemVisual(idx, {
        fromSymbolKeepAspect: fromData.getItemVisual(idx, 'symbolKeepAspect'),
        fromSymbolOffset: fromData.getItemVisual(idx, 'symbolOffset'),
        fromSymbolRotate: fromData.getItemVisual(idx, 'symbolRotate'),
        fromSymbolSize: fromData.getItemVisual(idx, 'symbolSize'),
        fromSymbol: fromData.getItemVisual(idx, 'symbol'),
        toSymbolKeepAspect: toData.getItemVisual(idx, 'symbolKeepAspect'),
        toSymbolOffset: toData.getItemVisual(idx, 'symbolOffset'),
        toSymbolRotate: toData.getItemVisual(idx, 'symbolRotate'),
        toSymbolSize: toData.getItemVisual(idx, 'symbolSize'),
        toSymbol: toData.getItemVisual(idx, 'symbol'),
        style: lineStyle
      });
    });
    lineDraw.updateData(lineData);
    // Set host model for tooltip
    // FIXME
    mlData.line.eachItemGraphicEl(function (el) {
      getECData(el).dataModel = mlModel;
      el.traverse(function (child) {
        getECData(child).dataModel = mlModel;
      });
    });
    function updateDataVisualAndLayout(data, idx, isFrom) {
      var itemModel = data.getItemModel(idx);
      updateSingleMarkerEndLayout(data, idx, isFrom, seriesModel, api);
      var style = itemModel.getModel('itemStyle').getItemStyle();
      if (style.fill == null) {
        style.fill = getVisualFromData(seriesData, 'color');
      }
      data.setItemVisual(idx, {
        symbolKeepAspect: itemModel.get('symbolKeepAspect'),
        // `0` should be considered as a valid value, so use `retrieve2` instead of `||`
        symbolOffset: retrieve2(itemModel.get('symbolOffset', true), symbolOffset[isFrom ? 0 : 1]),
        symbolRotate: retrieve2(itemModel.get('symbolRotate', true), symbolRotate[isFrom ? 0 : 1]),
        // TODO: when 2d array is supported, it should ignore parent
        symbolSize: retrieve2(itemModel.get('symbolSize'), symbolSize[isFrom ? 0 : 1]),
        symbol: retrieve2(itemModel.get('symbol', true), symbolType[isFrom ? 0 : 1]),
        style: style
      });
    }
    this.markKeep(lineDraw);
    lineDraw.group.silent = mlModel.get('silent') || seriesModel.get('silent');
  };
  MarkLineView.type = 'markLine';
  return MarkLineView;
}(MarkerView$1);
function createList$1(coordSys, seriesModel, mlModel) {
  var coordDimsInfos;
  if (coordSys) {
    coordDimsInfos = map$1(coordSys && coordSys.dimensions, function (coordDim) {
      var info = seriesModel.getData().getDimensionInfo(seriesModel.getData().mapDimension(coordDim)) || {};
      // In map series data don't have lng and lat dimension. Fallback to same with coordSys
      return extend(extend({}, info), {
        name: coordDim,
        // DON'T use ordinalMeta to parse and collect ordinal.
        ordinalMeta: null
      });
    });
  } else {
    coordDimsInfos = [{
      name: 'value',
      type: 'float'
    }];
  }
  var fromData = new SeriesData$1(coordDimsInfos, mlModel);
  var toData = new SeriesData$1(coordDimsInfos, mlModel);
  // No dimensions
  var lineData = new SeriesData$1([], mlModel);
  var optData = map$1(mlModel.get('data'), curry$1(markLineTransform, seriesModel, coordSys, mlModel));
  if (coordSys) {
    optData = filter(optData, curry$1(markLineFilter, coordSys));
  }
  var dimValueGetter = createMarkerDimValueGetter(!!coordSys, coordDimsInfos);
  fromData.initData(map$1(optData, function (item) {
    return item[0];
  }), null, dimValueGetter);
  toData.initData(map$1(optData, function (item) {
    return item[1];
  }), null, dimValueGetter);
  lineData.initData(map$1(optData, function (item) {
    return item[2];
  }));
  lineData.hasItemOption = true;
  return {
    from: fromData,
    to: toData,
    line: lineData
  };
}
var MarkLineView$1 = MarkLineView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$f(registers) {
  registers.registerComponentModel(MarkLineModel$1);
  registers.registerComponentView(MarkLineView$1);
  registers.registerPreprocessor(function (opt) {
    if (checkMarkerInSeries(opt.series, 'markLine')) {
      // Make sure markLine component is enabled
      opt.markLine = opt.markLine || {};
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var MarkAreaModel = /** @class */function (_super) {
  __extends(MarkAreaModel, _super);
  function MarkAreaModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MarkAreaModel.type;
    return _this;
  }
  MarkAreaModel.prototype.createMarkerModelFromSeries = function (markerOpt, masterMarkerModel, ecModel) {
    return new MarkAreaModel(markerOpt, masterMarkerModel, ecModel);
  };
  MarkAreaModel.type = 'markArea';
  MarkAreaModel.defaultOption = {
    // zlevel: 0,
    // PENDING
    z: 1,
    tooltip: {
      trigger: 'item'
    },
    // markArea should fixed on the coordinate system
    animation: false,
    label: {
      show: true,
      position: 'top'
    },
    itemStyle: {
      // color and borderColor default to use color from series
      // color: 'auto'
      // borderColor: 'auto'
      borderWidth: 0
    },
    emphasis: {
      label: {
        show: true,
        position: 'top'
      }
    }
  };
  return MarkAreaModel;
}(MarkerModel$1);
var MarkAreaModel$1 = MarkAreaModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$2 = makeInner();
var markAreaTransform = function (seriesModel, coordSys, maModel, item) {
  // item may be null
  var item0 = item[0];
  var item1 = item[1];
  if (!item0 || !item1) {
    return;
  }
  var lt = dataTransform(seriesModel, item0);
  var rb = dataTransform(seriesModel, item1);
  // FIXME make sure lt is less than rb
  var ltCoord = lt.coord;
  var rbCoord = rb.coord;
  ltCoord[0] = retrieve(ltCoord[0], -Infinity);
  ltCoord[1] = retrieve(ltCoord[1], -Infinity);
  rbCoord[0] = retrieve(rbCoord[0], Infinity);
  rbCoord[1] = retrieve(rbCoord[1], Infinity);
  // Merge option into one
  var result = mergeAll([{}, lt, rb]);
  result.coord = [lt.coord, rb.coord];
  result.x0 = lt.x;
  result.y0 = lt.y;
  result.x1 = rb.x;
  result.y1 = rb.y;
  return result;
};
function isInfinity(val) {
  return !isNaN(val) && !isFinite(val);
}
// If a markArea has one dim
function ifMarkAreaHasOnlyDim(dimIndex, fromCoord, toCoord, coordSys) {
  var otherDimIndex = 1 - dimIndex;
  return isInfinity(fromCoord[otherDimIndex]) && isInfinity(toCoord[otherDimIndex]);
}
function markAreaFilter(coordSys, item) {
  var fromCoord = item.coord[0];
  var toCoord = item.coord[1];
  var item0 = {
    coord: fromCoord,
    x: item.x0,
    y: item.y0
  };
  var item1 = {
    coord: toCoord,
    x: item.x1,
    y: item.y1
  };
  if (isCoordinateSystemType(coordSys, 'cartesian2d')) {
    // In case
    // {
    //  markArea: {
    //    data: [{ yAxis: 2 }]
    //  }
    // }
    if (fromCoord && toCoord && (ifMarkAreaHasOnlyDim(1, fromCoord, toCoord) || ifMarkAreaHasOnlyDim(0, fromCoord, toCoord))) {
      return true;
    }
    // Directly returning true may also do the work,
    // because markArea will not be shown automatically
    // when it's not included in coordinate system.
    // But filtering ahead can avoid keeping rendering markArea
    // when there are too many of them.
    return zoneFilter(coordSys, item0, item1);
  }
  return dataFilter(coordSys, item0) || dataFilter(coordSys, item1);
}
// dims can be ['x0', 'y0'], ['x1', 'y1'], ['x0', 'y1'], ['x1', 'y0']
function getSingleMarkerEndPoint(data, idx, dims, seriesModel, api) {
  var coordSys = seriesModel.coordinateSystem;
  var itemModel = data.getItemModel(idx);
  var point;
  var xPx = parsePercent(itemModel.get(dims[0]), api.getWidth());
  var yPx = parsePercent(itemModel.get(dims[1]), api.getHeight());
  if (!isNaN(xPx) && !isNaN(yPx)) {
    point = [xPx, yPx];
  } else {
    // Chart like bar may have there own marker positioning logic
    if (seriesModel.getMarkerPosition) {
      // Consider the case that user input the right-bottom point first
      // Pick the larger x and y as 'x1' and 'y1'
      var pointValue0 = data.getValues(['x0', 'y0'], idx);
      var pointValue1 = data.getValues(['x1', 'y1'], idx);
      var clampPointValue0 = coordSys.clampData(pointValue0);
      var clampPointValue1 = coordSys.clampData(pointValue1);
      var pointValue = [];
      if (dims[0] === 'x0') {
        pointValue[0] = clampPointValue0[0] > clampPointValue1[0] ? pointValue1[0] : pointValue0[0];
      } else {
        pointValue[0] = clampPointValue0[0] > clampPointValue1[0] ? pointValue0[0] : pointValue1[0];
      }
      if (dims[1] === 'y0') {
        pointValue[1] = clampPointValue0[1] > clampPointValue1[1] ? pointValue1[1] : pointValue0[1];
      } else {
        pointValue[1] = clampPointValue0[1] > clampPointValue1[1] ? pointValue0[1] : pointValue1[1];
      }
      // Use the getMarkerPosition
      point = seriesModel.getMarkerPosition(pointValue, dims, true);
    } else {
      var x = data.get(dims[0], idx);
      var y = data.get(dims[1], idx);
      var pt = [x, y];
      coordSys.clampData && coordSys.clampData(pt, pt);
      point = coordSys.dataToPoint(pt, true);
    }
    if (isCoordinateSystemType(coordSys, 'cartesian2d')) {
      // TODO: TYPE ts@4.1 may still infer it as Axis instead of Axis2D. Not sure if it's a bug
      var xAxis = coordSys.getAxis('x');
      var yAxis = coordSys.getAxis('y');
      var x = data.get(dims[0], idx);
      var y = data.get(dims[1], idx);
      if (isInfinity(x)) {
        point[0] = xAxis.toGlobalCoord(xAxis.getExtent()[dims[0] === 'x0' ? 0 : 1]);
      } else if (isInfinity(y)) {
        point[1] = yAxis.toGlobalCoord(yAxis.getExtent()[dims[1] === 'y0' ? 0 : 1]);
      }
    }
    // Use x, y if has any
    if (!isNaN(xPx)) {
      point[0] = xPx;
    }
    if (!isNaN(yPx)) {
      point[1] = yPx;
    }
  }
  return point;
}
var dimPermutations = [['x0', 'y0'], ['x1', 'y0'], ['x1', 'y1'], ['x0', 'y1']];
var MarkAreaView = /** @class */function (_super) {
  __extends(MarkAreaView, _super);
  function MarkAreaView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MarkAreaView.type;
    return _this;
  }
  MarkAreaView.prototype.updateTransform = function (markAreaModel, ecModel, api) {
    ecModel.eachSeries(function (seriesModel) {
      var maModel = MarkerModel$1.getMarkerModelFromSeries(seriesModel, 'markArea');
      if (maModel) {
        var areaData_1 = maModel.getData();
        areaData_1.each(function (idx) {
          var points = map$1(dimPermutations, function (dim) {
            return getSingleMarkerEndPoint(areaData_1, idx, dim, seriesModel, api);
          });
          // Layout
          areaData_1.setItemLayout(idx, points);
          var el = areaData_1.getItemGraphicEl(idx);
          el.setShape('points', points);
        });
      }
    }, this);
  };
  MarkAreaView.prototype.renderSeries = function (seriesModel, maModel, ecModel, api) {
    var coordSys = seriesModel.coordinateSystem;
    var seriesId = seriesModel.id;
    var seriesData = seriesModel.getData();
    var areaGroupMap = this.markerGroupMap;
    var polygonGroup = areaGroupMap.get(seriesId) || areaGroupMap.set(seriesId, {
      group: new Group$5()
    });
    this.group.add(polygonGroup.group);
    this.markKeep(polygonGroup);
    var areaData = createList(coordSys, seriesModel, maModel);
    // Line data for tooltip and formatter
    maModel.setData(areaData);
    // Update visual and layout of line
    areaData.each(function (idx) {
      // Layout
      var points = map$1(dimPermutations, function (dim) {
        return getSingleMarkerEndPoint(areaData, idx, dim, seriesModel, api);
      });
      var xAxisScale = coordSys.getAxis('x').scale;
      var yAxisScale = coordSys.getAxis('y').scale;
      var xAxisExtent = xAxisScale.getExtent();
      var yAxisExtent = yAxisScale.getExtent();
      var xPointExtent = [xAxisScale.parse(areaData.get('x0', idx)), xAxisScale.parse(areaData.get('x1', idx))];
      var yPointExtent = [yAxisScale.parse(areaData.get('y0', idx)), yAxisScale.parse(areaData.get('y1', idx))];
      asc$2(xPointExtent);
      asc$2(yPointExtent);
      var overlapped = !(xAxisExtent[0] > xPointExtent[1] || xAxisExtent[1] < xPointExtent[0] || yAxisExtent[0] > yPointExtent[1] || yAxisExtent[1] < yPointExtent[0]);
      // If none of the area is inside coordSys, allClipped is set to be true
      // in layout so that label will not be displayed. See #12591
      var allClipped = !overlapped;
      areaData.setItemLayout(idx, {
        points: points,
        allClipped: allClipped
      });
      var style = areaData.getItemModel(idx).getModel('itemStyle').getItemStyle();
      var color = getVisualFromData(seriesData, 'color');
      if (!style.fill) {
        style.fill = color;
        if (isString(style.fill)) {
          style.fill = modifyAlpha(style.fill, 0.4);
        }
      }
      if (!style.stroke) {
        style.stroke = color;
      }
      // Visual
      areaData.setItemVisual(idx, 'style', style);
    });
    areaData.diff(inner$2(polygonGroup).data).add(function (idx) {
      var layout = areaData.getItemLayout(idx);
      if (!layout.allClipped) {
        var polygon = new Polygon$1({
          shape: {
            points: layout.points
          }
        });
        areaData.setItemGraphicEl(idx, polygon);
        polygonGroup.group.add(polygon);
      }
    }).update(function (newIdx, oldIdx) {
      var polygon = inner$2(polygonGroup).data.getItemGraphicEl(oldIdx);
      var layout = areaData.getItemLayout(newIdx);
      if (!layout.allClipped) {
        if (polygon) {
          updateProps$1(polygon, {
            shape: {
              points: layout.points
            }
          }, maModel, newIdx);
        } else {
          polygon = new Polygon$1({
            shape: {
              points: layout.points
            }
          });
        }
        areaData.setItemGraphicEl(newIdx, polygon);
        polygonGroup.group.add(polygon);
      } else if (polygon) {
        polygonGroup.group.remove(polygon);
      }
    }).remove(function (idx) {
      var polygon = inner$2(polygonGroup).data.getItemGraphicEl(idx);
      polygonGroup.group.remove(polygon);
    }).execute();
    areaData.eachItemGraphicEl(function (polygon, idx) {
      var itemModel = areaData.getItemModel(idx);
      var style = areaData.getItemVisual(idx, 'style');
      polygon.useStyle(areaData.getItemVisual(idx, 'style'));
      setLabelStyle(polygon, getLabelStatesModels(itemModel), {
        labelFetcher: maModel,
        labelDataIndex: idx,
        defaultText: areaData.getName(idx) || '',
        inheritColor: isString(style.fill) ? modifyAlpha(style.fill, 1) : '#000'
      });
      setStatesStylesFromModel(polygon, itemModel);
      toggleHoverEmphasis(polygon, null, null, itemModel.get(['emphasis', 'disabled']));
      getECData(polygon).dataModel = maModel;
    });
    inner$2(polygonGroup).data = areaData;
    polygonGroup.group.silent = maModel.get('silent') || seriesModel.get('silent');
  };
  MarkAreaView.type = 'markArea';
  return MarkAreaView;
}(MarkerView$1);
function createList(coordSys, seriesModel, maModel) {
  var areaData;
  var dataDims;
  var dims = ['x0', 'y0', 'x1', 'y1'];
  if (coordSys) {
    var coordDimsInfos_1 = map$1(coordSys && coordSys.dimensions, function (coordDim) {
      var data = seriesModel.getData();
      var info = data.getDimensionInfo(data.mapDimension(coordDim)) || {};
      // In map series data don't have lng and lat dimension. Fallback to same with coordSys
      return extend(extend({}, info), {
        name: coordDim,
        // DON'T use ordinalMeta to parse and collect ordinal.
        ordinalMeta: null
      });
    });
    dataDims = map$1(dims, function (dim, idx) {
      return {
        name: dim,
        type: coordDimsInfos_1[idx % 2].type
      };
    });
    areaData = new SeriesData$1(dataDims, maModel);
  } else {
    dataDims = [{
      name: 'value',
      type: 'float'
    }];
    areaData = new SeriesData$1(dataDims, maModel);
  }
  var optData = map$1(maModel.get('data'), curry$1(markAreaTransform, seriesModel, coordSys, maModel));
  if (coordSys) {
    optData = filter(optData, curry$1(markAreaFilter, coordSys));
  }
  var dimValueGetter = coordSys ? function (item, dimName, dataIndex, dimIndex) {
    // TODO should convert to ParsedValue?
    var rawVal = item.coord[Math.floor(dimIndex / 2)][dimIndex % 2];
    return parseDataValue(rawVal, dataDims[dimIndex]);
  } : function (item, dimName, dataIndex, dimIndex) {
    return parseDataValue(item.value, dataDims[dimIndex]);
  };
  areaData.initData(optData, null, dimValueGetter);
  areaData.hasItemOption = true;
  return areaData;
}
var MarkAreaView$1 = MarkAreaView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$e(registers) {
  registers.registerComponentModel(MarkAreaModel$1);
  registers.registerComponentView(MarkAreaView$1);
  registers.registerPreprocessor(function (opt) {
    if (checkMarkerInSeries(opt.series, 'markArea')) {
      // Make sure markArea component is enabled
      opt.markArea = opt.markArea || {};
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var getDefaultSelectorOptions = function (ecModel, type) {
  if (type === 'all') {
    return {
      type: 'all',
      title: ecModel.getLocaleModel().get(['legend', 'selector', 'all'])
    };
  } else if (type === 'inverse') {
    return {
      type: 'inverse',
      title: ecModel.getLocaleModel().get(['legend', 'selector', 'inverse'])
    };
  }
};
var LegendModel = /** @class */function (_super) {
  __extends(LegendModel, _super);
  function LegendModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = LegendModel.type;
    _this.layoutMode = {
      type: 'box',
      // legend.width/height are maxWidth/maxHeight actually,
      // whereas real width/height is calculated by its content.
      // (Setting {left: 10, right: 10} does not make sense).
      // So consider the case:
      // `setOption({legend: {left: 10});`
      // then `setOption({legend: {right: 10});`
      // The previous `left` should be cleared by setting `ignoreSize`.
      ignoreSize: true
    };
    return _this;
  }
  LegendModel.prototype.init = function (option, parentModel, ecModel) {
    this.mergeDefaultAndTheme(option, ecModel);
    option.selected = option.selected || {};
    this._updateSelector(option);
  };
  LegendModel.prototype.mergeOption = function (option, ecModel) {
    _super.prototype.mergeOption.call(this, option, ecModel);
    this._updateSelector(option);
  };
  LegendModel.prototype._updateSelector = function (option) {
    var selector = option.selector;
    var ecModel = this.ecModel;
    if (selector === true) {
      selector = option.selector = ['all', 'inverse'];
    }
    if (isArray$1(selector)) {
      each$f(selector, function (item, index) {
        isString(item) && (item = {
          type: item
        });
        selector[index] = merge(item, getDefaultSelectorOptions(ecModel, item.type));
      });
    }
  };
  LegendModel.prototype.optionUpdated = function () {
    this._updateData(this.ecModel);
    var legendData = this._data;
    // If selectedMode is single, try to select one
    if (legendData[0] && this.get('selectedMode') === 'single') {
      var hasSelected = false;
      // If has any selected in option.selected
      for (var i = 0; i < legendData.length; i++) {
        var name_1 = legendData[i].get('name');
        if (this.isSelected(name_1)) {
          // Force to unselect others
          this.select(name_1);
          hasSelected = true;
          break;
        }
      }
      // Try select the first if selectedMode is single
      !hasSelected && this.select(legendData[0].get('name'));
    }
  };
  LegendModel.prototype._updateData = function (ecModel) {
    var potentialData = [];
    var availableNames = [];
    ecModel.eachRawSeries(function (seriesModel) {
      var seriesName = seriesModel.name;
      availableNames.push(seriesName);
      var isPotential;
      if (seriesModel.legendVisualProvider) {
        var provider = seriesModel.legendVisualProvider;
        var names = provider.getAllNames();
        if (!ecModel.isSeriesFiltered(seriesModel)) {
          availableNames = availableNames.concat(names);
        }
        if (names.length) {
          potentialData = potentialData.concat(names);
        } else {
          isPotential = true;
        }
      } else {
        isPotential = true;
      }
      if (isPotential && isNameSpecified(seriesModel)) {
        potentialData.push(seriesModel.name);
      }
    });
    /**
     * @type {Array.<string>}
     * @private
     */
    this._availableNames = availableNames;
    // If legend.data is not specified in option, use availableNames as data,
    // which is convenient for user preparing option.
    var rawData = this.get('data') || potentialData;
    var legendNameMap = createHashMap();
    var legendData = map$1(rawData, function (dataItem) {
      // Can be string or number
      if (isString(dataItem) || isNumber(dataItem)) {
        dataItem = {
          name: dataItem
        };
      }
      if (legendNameMap.get(dataItem.name)) {
        // remove legend name duplicate
        return null;
      }
      legendNameMap.set(dataItem.name, true);
      return new Model$1(dataItem, this, this.ecModel);
    }, this);
    /**
     * @type {Array.<module:echarts/model/Model>}
     * @private
     */
    this._data = filter(legendData, function (item) {
      return !!item;
    });
  };
  LegendModel.prototype.getData = function () {
    return this._data;
  };
  LegendModel.prototype.select = function (name) {
    var selected = this.option.selected;
    var selectedMode = this.get('selectedMode');
    if (selectedMode === 'single') {
      var data = this._data;
      each$f(data, function (dataItem) {
        selected[dataItem.get('name')] = false;
      });
    }
    selected[name] = true;
  };
  LegendModel.prototype.unSelect = function (name) {
    if (this.get('selectedMode') !== 'single') {
      this.option.selected[name] = false;
    }
  };
  LegendModel.prototype.toggleSelected = function (name) {
    var selected = this.option.selected;
    // Default is true
    if (!selected.hasOwnProperty(name)) {
      selected[name] = true;
    }
    this[selected[name] ? 'unSelect' : 'select'](name);
  };
  LegendModel.prototype.allSelect = function () {
    var data = this._data;
    var selected = this.option.selected;
    each$f(data, function (dataItem) {
      selected[dataItem.get('name', true)] = true;
    });
  };
  LegendModel.prototype.inverseSelect = function () {
    var data = this._data;
    var selected = this.option.selected;
    each$f(data, function (dataItem) {
      var name = dataItem.get('name', true);
      // Initially, default value is true
      if (!selected.hasOwnProperty(name)) {
        selected[name] = true;
      }
      selected[name] = !selected[name];
    });
  };
  LegendModel.prototype.isSelected = function (name) {
    var selected = this.option.selected;
    return !(selected.hasOwnProperty(name) && !selected[name]) && indexOf(this._availableNames, name) >= 0;
  };
  LegendModel.prototype.getOrient = function () {
    return this.get('orient') === 'vertical' ? {
      index: 1,
      name: 'vertical'
    } : {
      index: 0,
      name: 'horizontal'
    };
  };
  LegendModel.type = 'legend.plain';
  LegendModel.dependencies = ['series'];
  LegendModel.defaultOption = {
    // zlevel: 0,
    z: 4,
    show: true,
    orient: 'horizontal',
    left: 'center',
    // right: 'center',
    top: 0,
    // bottom: null,
    align: 'auto',
    backgroundColor: 'rgba(0,0,0,0)',
    borderColor: '#ccc',
    borderRadius: 0,
    borderWidth: 0,
    padding: 5,
    itemGap: 10,
    itemWidth: 25,
    itemHeight: 14,
    symbolRotate: 'inherit',
    symbolKeepAspect: true,
    inactiveColor: '#ccc',
    inactiveBorderColor: '#ccc',
    inactiveBorderWidth: 'auto',
    itemStyle: {
      color: 'inherit',
      opacity: 'inherit',
      borderColor: 'inherit',
      borderWidth: 'auto',
      borderCap: 'inherit',
      borderJoin: 'inherit',
      borderDashOffset: 'inherit',
      borderMiterLimit: 'inherit'
    },
    lineStyle: {
      width: 'auto',
      color: 'inherit',
      inactiveColor: '#ccc',
      inactiveWidth: 2,
      opacity: 'inherit',
      type: 'inherit',
      cap: 'inherit',
      join: 'inherit',
      dashOffset: 'inherit',
      miterLimit: 'inherit'
    },
    textStyle: {
      color: '#333'
    },
    selectedMode: true,
    selector: false,
    selectorLabel: {
      show: true,
      borderRadius: 10,
      padding: [3, 5, 3, 5],
      fontSize: 12,
      fontFamily: 'sans-serif',
      color: '#666',
      borderWidth: 1,
      borderColor: '#666'
    },
    emphasis: {
      selectorLabel: {
        show: true,
        color: '#eee',
        backgroundColor: '#666'
      }
    },
    selectorPosition: 'auto',
    selectorItemGap: 7,
    selectorButtonGap: 10,
    tooltip: {
      show: false
    }
  };
  return LegendModel;
}(ComponentModel$1);
var LegendModel$1 = LegendModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var curry = curry$1;
var each$3 = each$f;
var Group$2 = Group$5;
var LegendView = /** @class */function (_super) {
  __extends(LegendView, _super);
  function LegendView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = LegendView.type;
    _this.newlineDisabled = false;
    return _this;
  }
  LegendView.prototype.init = function () {
    this.group.add(this._contentGroup = new Group$2());
    this.group.add(this._selectorGroup = new Group$2());
    this._isFirstRender = true;
  };
  /**
   * @protected
   */
  LegendView.prototype.getContentGroup = function () {
    return this._contentGroup;
  };
  /**
   * @protected
   */
  LegendView.prototype.getSelectorGroup = function () {
    return this._selectorGroup;
  };
  /**
   * @override
   */
  LegendView.prototype.render = function (legendModel, ecModel, api) {
    var isFirstRender = this._isFirstRender;
    this._isFirstRender = false;
    this.resetInner();
    if (!legendModel.get('show', true)) {
      return;
    }
    var itemAlign = legendModel.get('align');
    var orient = legendModel.get('orient');
    if (!itemAlign || itemAlign === 'auto') {
      itemAlign = legendModel.get('left') === 'right' && orient === 'vertical' ? 'right' : 'left';
    }
    // selector has been normalized to an array in model
    var selector = legendModel.get('selector', true);
    var selectorPosition = legendModel.get('selectorPosition', true);
    if (selector && (!selectorPosition || selectorPosition === 'auto')) {
      selectorPosition = orient === 'horizontal' ? 'end' : 'start';
    }
    this.renderInner(itemAlign, legendModel, ecModel, api, selector, orient, selectorPosition);
    // Perform layout.
    var positionInfo = legendModel.getBoxLayoutParams();
    var viewportSize = {
      width: api.getWidth(),
      height: api.getHeight()
    };
    var padding = legendModel.get('padding');
    var maxSize = getLayoutRect(positionInfo, viewportSize, padding);
    var mainRect = this.layoutInner(legendModel, itemAlign, maxSize, isFirstRender, selector, selectorPosition);
    // Place mainGroup, based on the calculated `mainRect`.
    var layoutRect = getLayoutRect(defaults({
      width: mainRect.width,
      height: mainRect.height
    }, positionInfo), viewportSize, padding);
    this.group.x = layoutRect.x - mainRect.x;
    this.group.y = layoutRect.y - mainRect.y;
    this.group.markRedraw();
    // Render background after group is layout.
    this.group.add(this._backgroundEl = makeBackground(mainRect, legendModel));
  };
  LegendView.prototype.resetInner = function () {
    this.getContentGroup().removeAll();
    this._backgroundEl && this.group.remove(this._backgroundEl);
    this.getSelectorGroup().removeAll();
  };
  LegendView.prototype.renderInner = function (itemAlign, legendModel, ecModel, api, selector, orient, selectorPosition) {
    var contentGroup = this.getContentGroup();
    var legendDrawnMap = createHashMap();
    var selectMode = legendModel.get('selectedMode');
    var excludeSeriesId = [];
    ecModel.eachRawSeries(function (seriesModel) {
      !seriesModel.get('legendHoverLink') && excludeSeriesId.push(seriesModel.id);
    });
    each$3(legendModel.getData(), function (legendItemModel, dataIndex) {
      var name = legendItemModel.get('name');
      // Use empty string or \n as a newline string
      if (!this.newlineDisabled && (name === '' || name === '\n')) {
        var g = new Group$2();
        // @ts-ignore
        g.newline = true;
        contentGroup.add(g);
        return;
      }
      // Representitive series.
      var seriesModel = ecModel.getSeriesByName(name)[0];
      if (legendDrawnMap.get(name)) {
        // Have been drawn
        return;
      }
      // Legend to control series.
      if (seriesModel) {
        var data = seriesModel.getData();
        var lineVisualStyle = data.getVisual('legendLineStyle') || {};
        var legendIcon = data.getVisual('legendIcon');
        /**
         * `data.getVisual('style')` may be the color from the register
         * in series. For example, for line series,
         */
        var style = data.getVisual('style');
        var itemGroup = this._createItem(seriesModel, name, dataIndex, legendItemModel, legendModel, itemAlign, lineVisualStyle, style, legendIcon, selectMode, api);
        itemGroup.on('click', curry(dispatchSelectAction, name, null, api, excludeSeriesId)).on('mouseover', curry(dispatchHighlightAction, seriesModel.name, null, api, excludeSeriesId)).on('mouseout', curry(dispatchDownplayAction, seriesModel.name, null, api, excludeSeriesId));
        if (ecModel.ssr) {
          itemGroup.eachChild(function (child) {
            var ecData = getECData(child);
            ecData.seriesIndex = seriesModel.seriesIndex;
            ecData.dataIndex = dataIndex;
            ecData.ssrType = 'legend';
          });
        }
        legendDrawnMap.set(name, true);
      } else {
        // Legend to control data. In pie and funnel.
        ecModel.eachRawSeries(function (seriesModel) {
          // In case multiple series has same data name
          if (legendDrawnMap.get(name)) {
            return;
          }
          if (seriesModel.legendVisualProvider) {
            var provider = seriesModel.legendVisualProvider;
            if (!provider.containName(name)) {
              return;
            }
            var idx = provider.indexOfName(name);
            var style = provider.getItemVisual(idx, 'style');
            var legendIcon = provider.getItemVisual(idx, 'legendIcon');
            var colorArr = parse(style.fill);
            // Color may be set to transparent in visualMap when data is out of range.
            // Do not show nothing.
            if (colorArr && colorArr[3] === 0) {
              colorArr[3] = 0.2;
              // TODO color is set to 0, 0, 0, 0. Should show correct RGBA
              style = extend(extend({}, style), {
                fill: stringify(colorArr, 'rgba')
              });
            }
            var itemGroup = this._createItem(seriesModel, name, dataIndex, legendItemModel, legendModel, itemAlign, {}, style, legendIcon, selectMode, api);
            // FIXME: consider different series has items with the same name.
            itemGroup.on('click', curry(dispatchSelectAction, null, name, api, excludeSeriesId))
            // Should not specify the series name, consider legend controls
            // more than one pie series.
            .on('mouseover', curry(dispatchHighlightAction, null, name, api, excludeSeriesId)).on('mouseout', curry(dispatchDownplayAction, null, name, api, excludeSeriesId));
            if (ecModel.ssr) {
              itemGroup.eachChild(function (child) {
                var ecData = getECData(child);
                ecData.seriesIndex = seriesModel.seriesIndex;
                ecData.dataIndex = dataIndex;
                ecData.ssrType = 'legend';
              });
            }
            legendDrawnMap.set(name, true);
          }
        }, this);
      }
      {
        if (!legendDrawnMap.get(name)) {
          console.warn(name + ' series not exists. Legend data should be same with series name or data name.');
        }
      }
    }, this);
    if (selector) {
      this._createSelector(selector, legendModel, api, orient, selectorPosition);
    }
  };
  LegendView.prototype._createSelector = function (selector, legendModel, api, orient, selectorPosition) {
    var selectorGroup = this.getSelectorGroup();
    each$3(selector, function createSelectorButton(selectorItem) {
      var type = selectorItem.type;
      var labelText = new ZRText$1({
        style: {
          x: 0,
          y: 0,
          align: 'center',
          verticalAlign: 'middle'
        },
        onclick: function () {
          api.dispatchAction({
            type: type === 'all' ? 'legendAllSelect' : 'legendInverseSelect',
            legendId: legendModel.id
          });
        }
      });
      selectorGroup.add(labelText);
      var labelModel = legendModel.getModel('selectorLabel');
      var emphasisLabelModel = legendModel.getModel(['emphasis', 'selectorLabel']);
      setLabelStyle(labelText, {
        normal: labelModel,
        emphasis: emphasisLabelModel
      }, {
        defaultText: selectorItem.title
      });
      enableHoverEmphasis(labelText);
    });
  };
  LegendView.prototype._createItem = function (seriesModel, name, dataIndex, legendItemModel, legendModel, itemAlign, lineVisualStyle, itemVisualStyle, legendIcon, selectMode, api) {
    var drawType = seriesModel.visualDrawType;
    var itemWidth = legendModel.get('itemWidth');
    var itemHeight = legendModel.get('itemHeight');
    var isSelected = legendModel.isSelected(name);
    var iconRotate = legendItemModel.get('symbolRotate');
    var symbolKeepAspect = legendItemModel.get('symbolKeepAspect');
    var legendIconType = legendItemModel.get('icon');
    legendIcon = legendIconType || legendIcon || 'roundRect';
    var style = getLegendStyle(legendIcon, legendItemModel, lineVisualStyle, itemVisualStyle, drawType, isSelected, api);
    var itemGroup = new Group$2();
    var textStyleModel = legendItemModel.getModel('textStyle');
    if (isFunction(seriesModel.getLegendIcon) && (!legendIconType || legendIconType === 'inherit')) {
      // Series has specific way to define legend icon
      itemGroup.add(seriesModel.getLegendIcon({
        itemWidth: itemWidth,
        itemHeight: itemHeight,
        icon: legendIcon,
        iconRotate: iconRotate,
        itemStyle: style.itemStyle,
        lineStyle: style.lineStyle,
        symbolKeepAspect: symbolKeepAspect
      }));
    } else {
      // Use default legend icon policy for most series
      var rotate = legendIconType === 'inherit' && seriesModel.getData().getVisual('symbol') ? iconRotate === 'inherit' ? seriesModel.getData().getVisual('symbolRotate') : iconRotate : 0; // No rotation for no icon
      itemGroup.add(getDefaultLegendIcon({
        itemWidth: itemWidth,
        itemHeight: itemHeight,
        icon: legendIcon,
        iconRotate: rotate,
        itemStyle: style.itemStyle,
        lineStyle: style.lineStyle,
        symbolKeepAspect: symbolKeepAspect
      }));
    }
    var textX = itemAlign === 'left' ? itemWidth + 5 : -5;
    var textAlign = itemAlign;
    var formatter = legendModel.get('formatter');
    var content = name;
    if (isString(formatter) && formatter) {
      content = formatter.replace('{name}', name != null ? name : '');
    } else if (isFunction(formatter)) {
      content = formatter(name);
    }
    var textColor = isSelected ? textStyleModel.getTextColor() : legendItemModel.get('inactiveColor');
    itemGroup.add(new ZRText$1({
      style: createTextStyle(textStyleModel, {
        text: content,
        x: textX,
        y: itemHeight / 2,
        fill: textColor,
        align: textAlign,
        verticalAlign: 'middle'
      }, {
        inheritColor: textColor
      })
    }));
    // Add a invisible rect to increase the area of mouse hover
    var hitRect = new Rect$3({
      shape: itemGroup.getBoundingRect(),
      style: {
        // Cannot use 'invisible' because SVG SSR will miss the node
        fill: 'transparent'
      }
    });
    var tooltipModel = legendItemModel.getModel('tooltip');
    if (tooltipModel.get('show')) {
      setTooltipConfig({
        el: hitRect,
        componentModel: legendModel,
        itemName: name,
        itemTooltipOption: tooltipModel.option
      });
    }
    itemGroup.add(hitRect);
    itemGroup.eachChild(function (child) {
      child.silent = true;
    });
    hitRect.silent = !selectMode;
    this.getContentGroup().add(itemGroup);
    enableHoverEmphasis(itemGroup);
    // @ts-ignore
    itemGroup.__legendDataIndex = dataIndex;
    return itemGroup;
  };
  LegendView.prototype.layoutInner = function (legendModel, itemAlign, maxSize, isFirstRender, selector, selectorPosition) {
    var contentGroup = this.getContentGroup();
    var selectorGroup = this.getSelectorGroup();
    // Place items in contentGroup.
    box(legendModel.get('orient'), contentGroup, legendModel.get('itemGap'), maxSize.width, maxSize.height);
    var contentRect = contentGroup.getBoundingRect();
    var contentPos = [-contentRect.x, -contentRect.y];
    selectorGroup.markRedraw();
    contentGroup.markRedraw();
    if (selector) {
      // Place buttons in selectorGroup
      box(
      // Buttons in selectorGroup always layout horizontally
      'horizontal', selectorGroup, legendModel.get('selectorItemGap', true));
      var selectorRect = selectorGroup.getBoundingRect();
      var selectorPos = [-selectorRect.x, -selectorRect.y];
      var selectorButtonGap = legendModel.get('selectorButtonGap', true);
      var orientIdx = legendModel.getOrient().index;
      var wh = orientIdx === 0 ? 'width' : 'height';
      var hw = orientIdx === 0 ? 'height' : 'width';
      var yx = orientIdx === 0 ? 'y' : 'x';
      if (selectorPosition === 'end') {
        selectorPos[orientIdx] += contentRect[wh] + selectorButtonGap;
      } else {
        contentPos[orientIdx] += selectorRect[wh] + selectorButtonGap;
      }
      // Always align selector to content as 'middle'
      selectorPos[1 - orientIdx] += contentRect[hw] / 2 - selectorRect[hw] / 2;
      selectorGroup.x = selectorPos[0];
      selectorGroup.y = selectorPos[1];
      contentGroup.x = contentPos[0];
      contentGroup.y = contentPos[1];
      var mainRect = {
        x: 0,
        y: 0
      };
      mainRect[wh] = contentRect[wh] + selectorButtonGap + selectorRect[wh];
      mainRect[hw] = Math.max(contentRect[hw], selectorRect[hw]);
      mainRect[yx] = Math.min(0, selectorRect[yx] + selectorPos[1 - orientIdx]);
      return mainRect;
    } else {
      contentGroup.x = contentPos[0];
      contentGroup.y = contentPos[1];
      return this.group.getBoundingRect();
    }
  };
  /**
   * @protected
   */
  LegendView.prototype.remove = function () {
    this.getContentGroup().removeAll();
    this._isFirstRender = true;
  };
  LegendView.type = 'legend.plain';
  return LegendView;
}(ComponentView$1);
function getLegendStyle(iconType, legendItemModel, lineVisualStyle, itemVisualStyle, drawType, isSelected, api) {
  /**
   * Use series style if is inherit;
   * elsewise, use legend style
   */
  function handleCommonProps(style, visualStyle) {
    // If lineStyle.width is 'auto', it is set to be 2 if series has border
    if (style.lineWidth === 'auto') {
      style.lineWidth = visualStyle.lineWidth > 0 ? 2 : 0;
    }
    each$3(style, function (propVal, propName) {
      style[propName] === 'inherit' && (style[propName] = visualStyle[propName]);
    });
  }
  // itemStyle
  var itemStyleModel = legendItemModel.getModel('itemStyle');
  var itemStyle = itemStyleModel.getItemStyle();
  var iconBrushType = iconType.lastIndexOf('empty', 0) === 0 ? 'fill' : 'stroke';
  var decalStyle = itemStyleModel.getShallow('decal');
  itemStyle.decal = !decalStyle || decalStyle === 'inherit' ? itemVisualStyle.decal : createOrUpdatePatternFromDecal(decalStyle, api);
  if (itemStyle.fill === 'inherit') {
    /**
     * Series with visualDrawType as 'stroke' should have
     * series stroke as legend fill
     */
    itemStyle.fill = itemVisualStyle[drawType];
  }
  if (itemStyle.stroke === 'inherit') {
    /**
     * icon type with "emptyXXX" should use fill color
     * in visual style
     */
    itemStyle.stroke = itemVisualStyle[iconBrushType];
  }
  if (itemStyle.opacity === 'inherit') {
    /**
     * Use lineStyle.opacity if drawType is stroke
     */
    itemStyle.opacity = (drawType === 'fill' ? itemVisualStyle : lineVisualStyle).opacity;
  }
  handleCommonProps(itemStyle, itemVisualStyle);
  // lineStyle
  var legendLineModel = legendItemModel.getModel('lineStyle');
  var lineStyle = legendLineModel.getLineStyle();
  handleCommonProps(lineStyle, lineVisualStyle);
  // Fix auto color to real color
  itemStyle.fill === 'auto' && (itemStyle.fill = itemVisualStyle.fill);
  itemStyle.stroke === 'auto' && (itemStyle.stroke = itemVisualStyle.fill);
  lineStyle.stroke === 'auto' && (lineStyle.stroke = itemVisualStyle.fill);
  if (!isSelected) {
    var borderWidth = legendItemModel.get('inactiveBorderWidth');
    /**
     * Since stroke is set to be inactiveBorderColor, it may occur that
     * there is no border in series but border in legend, so we need to
     * use border only when series has border if is set to be auto
     */
    var visualHasBorder = itemStyle[iconBrushType];
    itemStyle.lineWidth = borderWidth === 'auto' ? itemVisualStyle.lineWidth > 0 && visualHasBorder ? 2 : 0 : itemStyle.lineWidth;
    itemStyle.fill = legendItemModel.get('inactiveColor');
    itemStyle.stroke = legendItemModel.get('inactiveBorderColor');
    lineStyle.stroke = legendLineModel.get('inactiveColor');
    lineStyle.lineWidth = legendLineModel.get('inactiveWidth');
  }
  return {
    itemStyle: itemStyle,
    lineStyle: lineStyle
  };
}
function getDefaultLegendIcon(opt) {
  var symboType = opt.icon || 'roundRect';
  var icon = createSymbol$1(symboType, 0, 0, opt.itemWidth, opt.itemHeight, opt.itemStyle.fill, opt.symbolKeepAspect);
  icon.setStyle(opt.itemStyle);
  icon.rotation = (opt.iconRotate || 0) * Math.PI / 180;
  icon.setOrigin([opt.itemWidth / 2, opt.itemHeight / 2]);
  if (symboType.indexOf('empty') > -1) {
    icon.style.stroke = icon.style.fill;
    icon.style.fill = '#fff';
    icon.style.lineWidth = 2;
  }
  return icon;
}
function dispatchSelectAction(seriesName, dataName, api, excludeSeriesId) {
  // downplay before unselect
  dispatchDownplayAction(seriesName, dataName, api, excludeSeriesId);
  api.dispatchAction({
    type: 'legendToggleSelect',
    name: seriesName != null ? seriesName : dataName
  });
  // highlight after select
  // TODO highlight immediately may cause animation loss.
  dispatchHighlightAction(seriesName, dataName, api, excludeSeriesId);
}
function isUseHoverLayer(api) {
  var list = api.getZr().storage.getDisplayList();
  var emphasisState;
  var i = 0;
  var len = list.length;
  while (i < len && !(emphasisState = list[i].states.emphasis)) {
    i++;
  }
  return emphasisState && emphasisState.hoverLayer;
}
function dispatchHighlightAction(seriesName, dataName, api, excludeSeriesId) {
  // If element hover will move to a hoverLayer.
  if (!isUseHoverLayer(api)) {
    api.dispatchAction({
      type: 'highlight',
      seriesName: seriesName,
      name: dataName,
      excludeSeriesId: excludeSeriesId
    });
  }
}
function dispatchDownplayAction(seriesName, dataName, api, excludeSeriesId) {
  // If element hover will move to a hoverLayer.
  if (!isUseHoverLayer(api)) {
    api.dispatchAction({
      type: 'downplay',
      seriesName: seriesName,
      name: dataName,
      excludeSeriesId: excludeSeriesId
    });
  }
}
var LegendView$1 = LegendView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function legendFilter(ecModel) {
  var legendModels = ecModel.findComponents({
    mainType: 'legend'
  });
  if (legendModels && legendModels.length) {
    ecModel.filterSeries(function (series) {
      // If in any legend component the status is not selected.
      // Because in legend series is assumed selected when it is not in the legend data.
      for (var i = 0; i < legendModels.length; i++) {
        if (!legendModels[i].isSelected(series.name)) {
          return false;
        }
      }
      return true;
    });
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function legendSelectActionHandler(methodName, payload, ecModel) {
  var isAllSelect = methodName === 'allSelect' || methodName === 'inverseSelect';
  var selectedMap = {};
  var actionLegendIndices = [];
  ecModel.eachComponent({
    mainType: 'legend',
    query: payload
  }, function (legendModel) {
    if (isAllSelect) {
      legendModel[methodName]();
    } else {
      legendModel[methodName](payload.name);
    }
    makeSelectedMap(legendModel, selectedMap);
    actionLegendIndices.push(legendModel.componentIndex);
  });
  var allSelectedMap = {};
  // make selectedMap from all legend components
  ecModel.eachComponent('legend', function (legendModel) {
    each$f(selectedMap, function (isSelected, name) {
      // Force other legend has same selected status
      // Or the first is toggled to true and other are toggled to false
      // In the case one legend has some item unSelected in option. And if other legend
      // doesn't has the item, they will assume it is selected.
      legendModel[isSelected ? 'select' : 'unSelect'](name);
    });
    makeSelectedMap(legendModel, allSelectedMap);
  });
  // Return the event explicitly
  return isAllSelect ? {
    selected: allSelectedMap,
    // return legendIndex array to tell the developers which legends are allSelect / inverseSelect
    legendIndex: actionLegendIndices
  } : {
    name: payload.name,
    selected: allSelectedMap
  };
}
function makeSelectedMap(legendModel, out) {
  var selectedMap = out || {};
  each$f(legendModel.getData(), function (model) {
    var name = model.get('name');
    // Wrap element
    if (name === '\n' || name === '') {
      return;
    }
    var isItemSelected = legendModel.isSelected(name);
    if (hasOwn(selectedMap, name)) {
      // Unselected if any legend is unselected
      selectedMap[name] = selectedMap[name] && isItemSelected;
    } else {
      selectedMap[name] = isItemSelected;
    }
  });
  return selectedMap;
}
function installLegendAction(registers) {
  /**
   * @event legendToggleSelect
   * @type {Object}
   * @property {string} type 'legendToggleSelect'
   * @property {string} [from]
   * @property {string} name Series name or data item name
   */
  registers.registerAction('legendToggleSelect', 'legendselectchanged', curry$1(legendSelectActionHandler, 'toggleSelected'));
  registers.registerAction('legendAllSelect', 'legendselectall', curry$1(legendSelectActionHandler, 'allSelect'));
  registers.registerAction('legendInverseSelect', 'legendinverseselect', curry$1(legendSelectActionHandler, 'inverseSelect'));
  /**
   * @event legendSelect
   * @type {Object}
   * @property {string} type 'legendSelect'
   * @property {string} name Series name or data item name
   */
  registers.registerAction('legendSelect', 'legendselected', curry$1(legendSelectActionHandler, 'select'));
  /**
   * @event legendUnSelect
   * @type {Object}
   * @property {string} type 'legendUnSelect'
   * @property {string} name Series name or data item name
   */
  registers.registerAction('legendUnSelect', 'legendunselected', curry$1(legendSelectActionHandler, 'unSelect'));
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$d(registers) {
  registers.registerComponentModel(LegendModel$1);
  registers.registerComponentView(LegendView$1);
  registers.registerProcessor(registers.PRIORITY.PROCESSOR.SERIES_FILTER, legendFilter);
  registers.registerSubTypeDefaulter('legend', function () {
    return 'plain';
  });
  installLegendAction(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var ScrollableLegendModel = /** @class */function (_super) {
  __extends(ScrollableLegendModel, _super);
  function ScrollableLegendModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ScrollableLegendModel.type;
    return _this;
  }
  /**
   * @param {number} scrollDataIndex
   */
  ScrollableLegendModel.prototype.setScrollDataIndex = function (scrollDataIndex) {
    this.option.scrollDataIndex = scrollDataIndex;
  };
  ScrollableLegendModel.prototype.init = function (option, parentModel, ecModel) {
    var inputPositionParams = getLayoutParams(option);
    _super.prototype.init.call(this, option, parentModel, ecModel);
    mergeAndNormalizeLayoutParams(this, option, inputPositionParams);
  };
  /**
   * @override
   */
  ScrollableLegendModel.prototype.mergeOption = function (option, ecModel) {
    _super.prototype.mergeOption.call(this, option, ecModel);
    mergeAndNormalizeLayoutParams(this, this.option, option);
  };
  ScrollableLegendModel.type = 'legend.scroll';
  ScrollableLegendModel.defaultOption = inheritDefaultOption(LegendModel$1.defaultOption, {
    scrollDataIndex: 0,
    pageButtonItemGap: 5,
    pageButtonGap: null,
    pageButtonPosition: 'end',
    pageFormatter: '{current}/{total}',
    pageIcons: {
      horizontal: ['M0,0L12,-10L12,10z', 'M0,0L-12,-10L-12,10z'],
      vertical: ['M0,0L20,0L10,-20z', 'M0,0L20,0L10,20z']
    },
    pageIconColor: '#2f4554',
    pageIconInactiveColor: '#aaa',
    pageIconSize: 15,
    pageTextStyle: {
      color: '#333'
    },
    animationDurationUpdate: 800
  });
  return ScrollableLegendModel;
}(LegendModel$1);
// Do not `ignoreSize` to enable setting {left: 10, right: 10}.
function mergeAndNormalizeLayoutParams(legendModel, target, raw) {
  var orient = legendModel.getOrient();
  var ignoreSize = [1, 1];
  ignoreSize[orient.index] = 0;
  mergeLayoutParam(target, raw, {
    type: 'box',
    ignoreSize: !!ignoreSize
  });
}
var ScrollableLegendModel$1 = ScrollableLegendModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Group$1 = Group$5;
var WH = ['width', 'height'];
var XY = ['x', 'y'];
var ScrollableLegendView = /** @class */function (_super) {
  __extends(ScrollableLegendView, _super);
  function ScrollableLegendView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ScrollableLegendView.type;
    _this.newlineDisabled = true;
    _this._currentIndex = 0;
    return _this;
  }
  ScrollableLegendView.prototype.init = function () {
    _super.prototype.init.call(this);
    this.group.add(this._containerGroup = new Group$1());
    this._containerGroup.add(this.getContentGroup());
    this.group.add(this._controllerGroup = new Group$1());
  };
  /**
   * @override
   */
  ScrollableLegendView.prototype.resetInner = function () {
    _super.prototype.resetInner.call(this);
    this._controllerGroup.removeAll();
    this._containerGroup.removeClipPath();
    this._containerGroup.__rectSize = null;
  };
  /**
   * @override
   */
  ScrollableLegendView.prototype.renderInner = function (itemAlign, legendModel, ecModel, api, selector, orient, selectorPosition) {
    var self = this;
    // Render content items.
    _super.prototype.renderInner.call(this, itemAlign, legendModel, ecModel, api, selector, orient, selectorPosition);
    var controllerGroup = this._controllerGroup;
    // FIXME: support be 'auto' adapt to size number text length,
    // e.g., '3/12345' should not overlap with the control arrow button.
    var pageIconSize = legendModel.get('pageIconSize', true);
    var pageIconSizeArr = isArray$1(pageIconSize) ? pageIconSize : [pageIconSize, pageIconSize];
    createPageButton('pagePrev', 0);
    var pageTextStyleModel = legendModel.getModel('pageTextStyle');
    controllerGroup.add(new ZRText$1({
      name: 'pageText',
      style: {
        // Placeholder to calculate a proper layout.
        text: 'xx/xx',
        fill: pageTextStyleModel.getTextColor(),
        font: pageTextStyleModel.getFont(),
        verticalAlign: 'middle',
        align: 'center'
      },
      silent: true
    }));
    createPageButton('pageNext', 1);
    function createPageButton(name, iconIdx) {
      var pageDataIndexName = name + 'DataIndex';
      var icon = createIcon(legendModel.get('pageIcons', true)[legendModel.getOrient().name][iconIdx], {
        // Buttons will be created in each render, so we do not need
        // to worry about avoiding using legendModel kept in scope.
        onclick: bind$1(self._pageGo, self, pageDataIndexName, legendModel, api)
      }, {
        x: -pageIconSizeArr[0] / 2,
        y: -pageIconSizeArr[1] / 2,
        width: pageIconSizeArr[0],
        height: pageIconSizeArr[1]
      });
      icon.name = name;
      controllerGroup.add(icon);
    }
  };
  /**
   * @override
   */
  ScrollableLegendView.prototype.layoutInner = function (legendModel, itemAlign, maxSize, isFirstRender, selector, selectorPosition) {
    var selectorGroup = this.getSelectorGroup();
    var orientIdx = legendModel.getOrient().index;
    var wh = WH[orientIdx];
    var xy = XY[orientIdx];
    var hw = WH[1 - orientIdx];
    var yx = XY[1 - orientIdx];
    selector && box(
    // Buttons in selectorGroup always layout horizontally
    'horizontal', selectorGroup, legendModel.get('selectorItemGap', true));
    var selectorButtonGap = legendModel.get('selectorButtonGap', true);
    var selectorRect = selectorGroup.getBoundingRect();
    var selectorPos = [-selectorRect.x, -selectorRect.y];
    var processMaxSize = clone$4(maxSize);
    selector && (processMaxSize[wh] = maxSize[wh] - selectorRect[wh] - selectorButtonGap);
    var mainRect = this._layoutContentAndController(legendModel, isFirstRender, processMaxSize, orientIdx, wh, hw, yx, xy);
    if (selector) {
      if (selectorPosition === 'end') {
        selectorPos[orientIdx] += mainRect[wh] + selectorButtonGap;
      } else {
        var offset = selectorRect[wh] + selectorButtonGap;
        selectorPos[orientIdx] -= offset;
        mainRect[xy] -= offset;
      }
      mainRect[wh] += selectorRect[wh] + selectorButtonGap;
      selectorPos[1 - orientIdx] += mainRect[yx] + mainRect[hw] / 2 - selectorRect[hw] / 2;
      mainRect[hw] = Math.max(mainRect[hw], selectorRect[hw]);
      mainRect[yx] = Math.min(mainRect[yx], selectorRect[yx] + selectorPos[1 - orientIdx]);
      selectorGroup.x = selectorPos[0];
      selectorGroup.y = selectorPos[1];
      selectorGroup.markRedraw();
    }
    return mainRect;
  };
  ScrollableLegendView.prototype._layoutContentAndController = function (legendModel, isFirstRender, maxSize, orientIdx, wh, hw, yx, xy) {
    var contentGroup = this.getContentGroup();
    var containerGroup = this._containerGroup;
    var controllerGroup = this._controllerGroup;
    // Place items in contentGroup.
    box(legendModel.get('orient'), contentGroup, legendModel.get('itemGap'), !orientIdx ? null : maxSize.width, orientIdx ? null : maxSize.height);
    box(
    // Buttons in controller are layout always horizontally.
    'horizontal', controllerGroup, legendModel.get('pageButtonItemGap', true));
    var contentRect = contentGroup.getBoundingRect();
    var controllerRect = controllerGroup.getBoundingRect();
    var showController = this._showController = contentRect[wh] > maxSize[wh];
    // In case that the inner elements of contentGroup layout do not based on [0, 0]
    var contentPos = [-contentRect.x, -contentRect.y];
    // Remain contentPos when scroll animation perfroming.
    // If first rendering, `contentGroup.position` is [0, 0], which
    // does not make sense and may cause unexepcted animation if adopted.
    if (!isFirstRender) {
      contentPos[orientIdx] = contentGroup[xy];
    }
    // Layout container group based on 0.
    var containerPos = [0, 0];
    var controllerPos = [-controllerRect.x, -controllerRect.y];
    var pageButtonGap = retrieve2(legendModel.get('pageButtonGap', true), legendModel.get('itemGap', true));
    // Place containerGroup and controllerGroup and contentGroup.
    if (showController) {
      var pageButtonPosition = legendModel.get('pageButtonPosition', true);
      // controller is on the right / bottom.
      if (pageButtonPosition === 'end') {
        controllerPos[orientIdx] += maxSize[wh] - controllerRect[wh];
      }
      // controller is on the left / top.
      else {
        containerPos[orientIdx] += controllerRect[wh] + pageButtonGap;
      }
    }
    // Always align controller to content as 'middle'.
    controllerPos[1 - orientIdx] += contentRect[hw] / 2 - controllerRect[hw] / 2;
    contentGroup.setPosition(contentPos);
    containerGroup.setPosition(containerPos);
    controllerGroup.setPosition(controllerPos);
    // Calculate `mainRect` and set `clipPath`.
    // mainRect should not be calculated by `this.group.getBoundingRect()`
    // for sake of the overflow.
    var mainRect = {
      x: 0,
      y: 0
    };
    // Consider content may be overflow (should be clipped).
    mainRect[wh] = showController ? maxSize[wh] : contentRect[wh];
    mainRect[hw] = Math.max(contentRect[hw], controllerRect[hw]);
    // `containerRect[yx] + containerPos[1 - orientIdx]` is 0.
    mainRect[yx] = Math.min(0, controllerRect[yx] + controllerPos[1 - orientIdx]);
    containerGroup.__rectSize = maxSize[wh];
    if (showController) {
      var clipShape = {
        x: 0,
        y: 0
      };
      clipShape[wh] = Math.max(maxSize[wh] - controllerRect[wh] - pageButtonGap, 0);
      clipShape[hw] = mainRect[hw];
      containerGroup.setClipPath(new Rect$3({
        shape: clipShape
      }));
      // Consider content may be larger than container, container rect
      // can not be obtained from `containerGroup.getBoundingRect()`.
      containerGroup.__rectSize = clipShape[wh];
    } else {
      // Do not remove or ignore controller. Keep them set as placeholders.
      controllerGroup.eachChild(function (child) {
        child.attr({
          invisible: true,
          silent: true
        });
      });
    }
    // Content translate animation.
    var pageInfo = this._getPageInfo(legendModel);
    pageInfo.pageIndex != null && updateProps$1(contentGroup, {
      x: pageInfo.contentPosition[0],
      y: pageInfo.contentPosition[1]
    },
    // When switch from "show controller" to "not show controller", view should be
    // updated immediately without animation, otherwise causes weird effect.
    showController ? legendModel : null);
    this._updatePageInfoView(legendModel, pageInfo);
    return mainRect;
  };
  ScrollableLegendView.prototype._pageGo = function (to, legendModel, api) {
    var scrollDataIndex = this._getPageInfo(legendModel)[to];
    scrollDataIndex != null && api.dispatchAction({
      type: 'legendScroll',
      scrollDataIndex: scrollDataIndex,
      legendId: legendModel.id
    });
  };
  ScrollableLegendView.prototype._updatePageInfoView = function (legendModel, pageInfo) {
    var controllerGroup = this._controllerGroup;
    each$f(['pagePrev', 'pageNext'], function (name) {
      var key = name + 'DataIndex';
      var canJump = pageInfo[key] != null;
      var icon = controllerGroup.childOfName(name);
      if (icon) {
        icon.setStyle('fill', canJump ? legendModel.get('pageIconColor', true) : legendModel.get('pageIconInactiveColor', true));
        icon.cursor = canJump ? 'pointer' : 'default';
      }
    });
    var pageText = controllerGroup.childOfName('pageText');
    var pageFormatter = legendModel.get('pageFormatter');
    var pageIndex = pageInfo.pageIndex;
    var current = pageIndex != null ? pageIndex + 1 : 0;
    var total = pageInfo.pageCount;
    pageText && pageFormatter && pageText.setStyle('text', isString(pageFormatter) ? pageFormatter.replace('{current}', current == null ? '' : current + '').replace('{total}', total == null ? '' : total + '') : pageFormatter({
      current: current,
      total: total
    }));
  };
  /**
   *  contentPosition: Array.<number>, null when data item not found.
   *  pageIndex: number, null when data item not found.
   *  pageCount: number, always be a number, can be 0.
   *  pagePrevDataIndex: number, null when no previous page.
   *  pageNextDataIndex: number, null when no next page.
   * }
   */
  ScrollableLegendView.prototype._getPageInfo = function (legendModel) {
    var scrollDataIndex = legendModel.get('scrollDataIndex', true);
    var contentGroup = this.getContentGroup();
    var containerRectSize = this._containerGroup.__rectSize;
    var orientIdx = legendModel.getOrient().index;
    var wh = WH[orientIdx];
    var xy = XY[orientIdx];
    var targetItemIndex = this._findTargetItemIndex(scrollDataIndex);
    var children = contentGroup.children();
    var targetItem = children[targetItemIndex];
    var itemCount = children.length;
    var pCount = !itemCount ? 0 : 1;
    var result = {
      contentPosition: [contentGroup.x, contentGroup.y],
      pageCount: pCount,
      pageIndex: pCount - 1,
      pagePrevDataIndex: null,
      pageNextDataIndex: null
    };
    if (!targetItem) {
      return result;
    }
    var targetItemInfo = getItemInfo(targetItem);
    result.contentPosition[orientIdx] = -targetItemInfo.s;
    // Strategy:
    // (1) Always align based on the left/top most item.
    // (2) It is user-friendly that the last item shown in the
    // current window is shown at the begining of next window.
    // Otherwise if half of the last item is cut by the window,
    // it will have no chance to display entirely.
    // (3) Consider that item size probably be different, we
    // have calculate pageIndex by size rather than item index,
    // and we can not get page index directly by division.
    // (4) The window is to narrow to contain more than
    // one item, we should make sure that the page can be fliped.
    for (var i = targetItemIndex + 1, winStartItemInfo = targetItemInfo, winEndItemInfo = targetItemInfo, currItemInfo = null; i <= itemCount; ++i) {
      currItemInfo = getItemInfo(children[i]);
      if (
      // Half of the last item is out of the window.
      !currItemInfo && winEndItemInfo.e > winStartItemInfo.s + containerRectSize
      // If the current item does not intersect with the window, the new page
      // can be started at the current item or the last item.
      || currItemInfo && !intersect(currItemInfo, winStartItemInfo.s)) {
        if (winEndItemInfo.i > winStartItemInfo.i) {
          winStartItemInfo = winEndItemInfo;
        } else {
          // e.g., when page size is smaller than item size.
          winStartItemInfo = currItemInfo;
        }
        if (winStartItemInfo) {
          if (result.pageNextDataIndex == null) {
            result.pageNextDataIndex = winStartItemInfo.i;
          }
          ++result.pageCount;
        }
      }
      winEndItemInfo = currItemInfo;
    }
    for (var i = targetItemIndex - 1, winStartItemInfo = targetItemInfo, winEndItemInfo = targetItemInfo, currItemInfo = null; i >= -1; --i) {
      currItemInfo = getItemInfo(children[i]);
      if (
      // If the the end item does not intersect with the window started
      // from the current item, a page can be settled.
      (!currItemInfo || !intersect(winEndItemInfo, currItemInfo.s)
      // e.g., when page size is smaller than item size.
      ) && winStartItemInfo.i < winEndItemInfo.i) {
        winEndItemInfo = winStartItemInfo;
        if (result.pagePrevDataIndex == null) {
          result.pagePrevDataIndex = winStartItemInfo.i;
        }
        ++result.pageCount;
        ++result.pageIndex;
      }
      winStartItemInfo = currItemInfo;
    }
    return result;
    function getItemInfo(el) {
      if (el) {
        var itemRect = el.getBoundingRect();
        var start = itemRect[xy] + el[xy];
        return {
          s: start,
          e: start + itemRect[wh],
          i: el.__legendDataIndex
        };
      }
    }
    function intersect(itemInfo, winStart) {
      return itemInfo.e >= winStart && itemInfo.s <= winStart + containerRectSize;
    }
  };
  ScrollableLegendView.prototype._findTargetItemIndex = function (targetDataIndex) {
    if (!this._showController) {
      return 0;
    }
    var index;
    var contentGroup = this.getContentGroup();
    var defaultIndex;
    contentGroup.eachChild(function (child, idx) {
      var legendDataIdx = child.__legendDataIndex;
      // FIXME
      // If the given targetDataIndex (from model) is illegal,
      // we use defaultIndex. But the index on the legend model and
      // action payload is still illegal. That case will not be
      // changed until some scenario requires.
      if (defaultIndex == null && legendDataIdx != null) {
        defaultIndex = idx;
      }
      if (legendDataIdx === targetDataIndex) {
        index = idx;
      }
    });
    return index != null ? index : defaultIndex;
  };
  ScrollableLegendView.type = 'legend.scroll';
  return ScrollableLegendView;
}(LegendView$1);
var ScrollableLegendView$1 = ScrollableLegendView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function installScrollableLegendAction(registers) {
  /**
   * @event legendScroll
   * @type {Object}
   * @property {string} type 'legendScroll'
   * @property {string} scrollDataIndex
   */
  registers.registerAction('legendScroll', 'legendscroll', function (payload, ecModel) {
    var scrollDataIndex = payload.scrollDataIndex;
    scrollDataIndex != null && ecModel.eachComponent({
      mainType: 'legend',
      subType: 'scroll',
      query: payload
    }, function (legendModel) {
      legendModel.setScrollDataIndex(scrollDataIndex);
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$c(registers) {
  use(install$d);
  registers.registerComponentModel(ScrollableLegendModel$1);
  registers.registerComponentView(ScrollableLegendView$1);
  installScrollableLegendAction(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$b(registers) {
  use(install$d);
  use(install$c);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var InsideZoomModel = /** @class */function (_super) {
  __extends(InsideZoomModel, _super);
  function InsideZoomModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = InsideZoomModel.type;
    return _this;
  }
  InsideZoomModel.type = 'dataZoom.inside';
  InsideZoomModel.defaultOption = inheritDefaultOption(DataZoomModel$1.defaultOption, {
    disabled: false,
    zoomLock: false,
    zoomOnMouseWheel: true,
    moveOnMouseMove: true,
    moveOnMouseWheel: false,
    preventDefaultMouseMove: true
  });
  return InsideZoomModel;
}(DataZoomModel$1);
var InsideZoomModel$1 = InsideZoomModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var inner$1 = makeInner();
function setViewInfoToCoordSysRecord(api, dataZoomModel, getRange) {
  inner$1(api).coordSysRecordMap.each(function (coordSysRecord) {
    var dzInfo = coordSysRecord.dataZoomInfoMap.get(dataZoomModel.uid);
    if (dzInfo) {
      dzInfo.getRange = getRange;
    }
  });
}
function disposeCoordSysRecordIfNeeded(api, dataZoomModel) {
  var coordSysRecordMap = inner$1(api).coordSysRecordMap;
  var coordSysKeyArr = coordSysRecordMap.keys();
  for (var i = 0; i < coordSysKeyArr.length; i++) {
    var coordSysKey = coordSysKeyArr[i];
    var coordSysRecord = coordSysRecordMap.get(coordSysKey);
    var dataZoomInfoMap = coordSysRecord.dataZoomInfoMap;
    if (dataZoomInfoMap) {
      var dzUid = dataZoomModel.uid;
      var dzInfo = dataZoomInfoMap.get(dzUid);
      if (dzInfo) {
        dataZoomInfoMap.removeKey(dzUid);
        if (!dataZoomInfoMap.keys().length) {
          disposeCoordSysRecord(coordSysRecordMap, coordSysRecord);
        }
      }
    }
  }
}
function disposeCoordSysRecord(coordSysRecordMap, coordSysRecord) {
  if (coordSysRecord) {
    coordSysRecordMap.removeKey(coordSysRecord.model.uid);
    var controller = coordSysRecord.controller;
    controller && controller.dispose();
  }
}
function createCoordSysRecord(api, coordSysModel) {
  // These init props will never change after record created.
  var coordSysRecord = {
    model: coordSysModel,
    containsPoint: curry$1(containsPoint, coordSysModel),
    dispatchAction: curry$1(dispatchAction, api),
    dataZoomInfoMap: null,
    controller: null
  };
  // Must not do anything depends on coordSysRecord outside the event handler here,
  // because coordSysRecord not completed yet.
  var controller = coordSysRecord.controller = new RoamController$1(api.getZr());
  each$f(['pan', 'zoom', 'scrollMove'], function (eventName) {
    controller.on(eventName, function (event) {
      var batch = [];
      coordSysRecord.dataZoomInfoMap.each(function (dzInfo) {
        // Check whether the behaviors (zoomOnMouseWheel, moveOnMouseMove,
        // moveOnMouseWheel, ...) enabled.
        if (!event.isAvailableBehavior(dzInfo.model.option)) {
          return;
        }
        var method = (dzInfo.getRange || {})[eventName];
        var range = method && method(dzInfo.dzReferCoordSysInfo, coordSysRecord.model.mainType, coordSysRecord.controller, event);
        !dzInfo.model.get('disabled', true) && range && batch.push({
          dataZoomId: dzInfo.model.id,
          start: range[0],
          end: range[1]
        });
      });
      batch.length && coordSysRecord.dispatchAction(batch);
    });
  });
  return coordSysRecord;
}
/**
 * This action will be throttled.
 */
function dispatchAction(api, batch) {
  if (!api.isDisposed()) {
    api.dispatchAction({
      type: 'dataZoom',
      animation: {
        easing: 'cubicOut',
        duration: 100
      },
      batch: batch
    });
  }
}
function containsPoint(coordSysModel, e, x, y) {
  return coordSysModel.coordinateSystem.containPoint([x, y]);
}
/**
 * Merge roamController settings when multiple dataZooms share one roamController.
 */
function mergeControllerParams(dataZoomInfoMap) {
  var controlType;
  // DO NOT use reserved word (true, false, undefined) as key literally. Even if encapsulated
  // as string, it is probably revert to reserved word by compress tool. See #7411.
  var prefix = 'type_';
  var typePriority = {
    'type_true': 2,
    'type_move': 1,
    'type_false': 0,
    'type_undefined': -1
  };
  var preventDefaultMouseMove = true;
  dataZoomInfoMap.each(function (dataZoomInfo) {
    var dataZoomModel = dataZoomInfo.model;
    var oneType = dataZoomModel.get('disabled', true) ? false : dataZoomModel.get('zoomLock', true) ? 'move' : true;
    if (typePriority[prefix + oneType] > typePriority[prefix + controlType]) {
      controlType = oneType;
    }
    // Prevent default move event by default. If one false, do not prevent. Otherwise
    // users may be confused why it does not work when multiple insideZooms exist.
    preventDefaultMouseMove = preventDefaultMouseMove && dataZoomModel.get('preventDefaultMouseMove', true);
  });
  return {
    controlType: controlType,
    opt: {
      // RoamController will enable all of these functionalities,
      // and the final behavior is determined by its event listener
      // provided by each inside zoom.
      zoomOnMouseWheel: true,
      moveOnMouseMove: true,
      moveOnMouseWheel: true,
      preventDefaultMouseMove: !!preventDefaultMouseMove
    }
  };
}
function installDataZoomRoamProcessor(registers) {
  registers.registerProcessor(registers.PRIORITY.PROCESSOR.FILTER, function (ecModel, api) {
    var apiInner = inner$1(api);
    var coordSysRecordMap = apiInner.coordSysRecordMap || (apiInner.coordSysRecordMap = createHashMap());
    coordSysRecordMap.each(function (coordSysRecord) {
      // `coordSysRecordMap` always exists (because it holds the `roam controller`, which should
      // better not re-create each time), but clear `dataZoomInfoMap` each round of the workflow.
      coordSysRecord.dataZoomInfoMap = null;
    });
    ecModel.eachComponent({
      mainType: 'dataZoom',
      subType: 'inside'
    }, function (dataZoomModel) {
      var dzReferCoordSysWrap = collectReferCoordSysModelInfo(dataZoomModel);
      each$f(dzReferCoordSysWrap.infoList, function (dzCoordSysInfo) {
        var coordSysUid = dzCoordSysInfo.model.uid;
        var coordSysRecord = coordSysRecordMap.get(coordSysUid) || coordSysRecordMap.set(coordSysUid, createCoordSysRecord(api, dzCoordSysInfo.model));
        var dataZoomInfoMap = coordSysRecord.dataZoomInfoMap || (coordSysRecord.dataZoomInfoMap = createHashMap());
        // Notice these props might be changed each time for a single dataZoomModel.
        dataZoomInfoMap.set(dataZoomModel.uid, {
          dzReferCoordSysInfo: dzCoordSysInfo,
          model: dataZoomModel,
          getRange: null
        });
      });
    });
    // (1) Merge dataZoom settings for each coord sys and set to the roam controller.
    // (2) Clear coord sys if not refered by any dataZoom.
    coordSysRecordMap.each(function (coordSysRecord) {
      var controller = coordSysRecord.controller;
      var firstDzInfo;
      var dataZoomInfoMap = coordSysRecord.dataZoomInfoMap;
      if (dataZoomInfoMap) {
        var firstDzKey = dataZoomInfoMap.keys()[0];
        if (firstDzKey != null) {
          firstDzInfo = dataZoomInfoMap.get(firstDzKey);
        }
      }
      if (!firstDzInfo) {
        disposeCoordSysRecord(coordSysRecordMap, coordSysRecord);
        return;
      }
      var controllerParams = mergeControllerParams(dataZoomInfoMap);
      controller.enable(controllerParams.controlType, controllerParams.opt);
      controller.setPointerChecker(coordSysRecord.containsPoint);
      createOrUpdate(coordSysRecord, 'dispatchAction', firstDzInfo.model.get('throttle', true), 'fixRate');
    });
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var InsideZoomView = /** @class */function (_super) {
  __extends(InsideZoomView, _super);
  function InsideZoomView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = 'dataZoom.inside';
    return _this;
  }
  InsideZoomView.prototype.render = function (dataZoomModel, ecModel, api) {
    _super.prototype.render.apply(this, arguments);
    if (dataZoomModel.noTarget()) {
      this._clear();
      return;
    }
    // Hence the `throttle` util ensures to preserve command order,
    // here simply updating range all the time will not cause missing
    // any of the the roam change.
    this.range = dataZoomModel.getPercentRange();
    // Reset controllers.
    setViewInfoToCoordSysRecord(api, dataZoomModel, {
      pan: bind$1(getRangeHandlers.pan, this),
      zoom: bind$1(getRangeHandlers.zoom, this),
      scrollMove: bind$1(getRangeHandlers.scrollMove, this)
    });
  };
  InsideZoomView.prototype.dispose = function () {
    this._clear();
    _super.prototype.dispose.apply(this, arguments);
  };
  InsideZoomView.prototype._clear = function () {
    disposeCoordSysRecordIfNeeded(this.api, this.dataZoomModel);
    this.range = null;
  };
  InsideZoomView.type = 'dataZoom.inside';
  return InsideZoomView;
}(DataZoomView$1);
var getRangeHandlers = {
  zoom: function (coordSysInfo, coordSysMainType, controller, e) {
    var lastRange = this.range;
    var range = lastRange.slice();
    // Calculate transform by the first axis.
    var axisModel = coordSysInfo.axisModels[0];
    if (!axisModel) {
      return;
    }
    var directionInfo = getDirectionInfo[coordSysMainType](null, [e.originX, e.originY], axisModel, controller, coordSysInfo);
    var percentPoint = (directionInfo.signal > 0 ? directionInfo.pixelStart + directionInfo.pixelLength - directionInfo.pixel : directionInfo.pixel - directionInfo.pixelStart) / directionInfo.pixelLength * (range[1] - range[0]) + range[0];
    var scale = Math.max(1 / e.scale, 0);
    range[0] = (range[0] - percentPoint) * scale + percentPoint;
    range[1] = (range[1] - percentPoint) * scale + percentPoint;
    // Restrict range.
    var minMaxSpan = this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();
    sliderMove(0, range, [0, 100], 0, minMaxSpan.minSpan, minMaxSpan.maxSpan);
    this.range = range;
    if (lastRange[0] !== range[0] || lastRange[1] !== range[1]) {
      return range;
    }
  },
  pan: makeMover(function (range, axisModel, coordSysInfo, coordSysMainType, controller, e) {
    var directionInfo = getDirectionInfo[coordSysMainType]([e.oldX, e.oldY], [e.newX, e.newY], axisModel, controller, coordSysInfo);
    return directionInfo.signal * (range[1] - range[0]) * directionInfo.pixel / directionInfo.pixelLength;
  }),
  scrollMove: makeMover(function (range, axisModel, coordSysInfo, coordSysMainType, controller, e) {
    var directionInfo = getDirectionInfo[coordSysMainType]([0, 0], [e.scrollDelta, e.scrollDelta], axisModel, controller, coordSysInfo);
    return directionInfo.signal * (range[1] - range[0]) * e.scrollDelta;
  })
};
function makeMover(getPercentDelta) {
  return function (coordSysInfo, coordSysMainType, controller, e) {
    var lastRange = this.range;
    var range = lastRange.slice();
    // Calculate transform by the first axis.
    var axisModel = coordSysInfo.axisModels[0];
    if (!axisModel) {
      return;
    }
    var percentDelta = getPercentDelta(range, axisModel, coordSysInfo, coordSysMainType, controller, e);
    sliderMove(percentDelta, range, [0, 100], 'all');
    this.range = range;
    if (lastRange[0] !== range[0] || lastRange[1] !== range[1]) {
      return range;
    }
  };
}
var getDirectionInfo = {
  grid: function (oldPoint, newPoint, axisModel, controller, coordSysInfo) {
    var axis = axisModel.axis;
    var ret = {};
    var rect = coordSysInfo.model.coordinateSystem.getRect();
    oldPoint = oldPoint || [0, 0];
    if (axis.dim === 'x') {
      ret.pixel = newPoint[0] - oldPoint[0];
      ret.pixelLength = rect.width;
      ret.pixelStart = rect.x;
      ret.signal = axis.inverse ? 1 : -1;
    } else {
      // axis.dim === 'y'
      ret.pixel = newPoint[1] - oldPoint[1];
      ret.pixelLength = rect.height;
      ret.pixelStart = rect.y;
      ret.signal = axis.inverse ? -1 : 1;
    }
    return ret;
  },
  polar: function (oldPoint, newPoint, axisModel, controller, coordSysInfo) {
    var axis = axisModel.axis;
    var ret = {};
    var polar = coordSysInfo.model.coordinateSystem;
    var radiusExtent = polar.getRadiusAxis().getExtent();
    var angleExtent = polar.getAngleAxis().getExtent();
    oldPoint = oldPoint ? polar.pointToCoord(oldPoint) : [0, 0];
    newPoint = polar.pointToCoord(newPoint);
    if (axisModel.mainType === 'radiusAxis') {
      ret.pixel = newPoint[0] - oldPoint[0];
      // ret.pixelLength = Math.abs(radiusExtent[1] - radiusExtent[0]);
      // ret.pixelStart = Math.min(radiusExtent[0], radiusExtent[1]);
      ret.pixelLength = radiusExtent[1] - radiusExtent[0];
      ret.pixelStart = radiusExtent[0];
      ret.signal = axis.inverse ? 1 : -1;
    } else {
      // 'angleAxis'
      ret.pixel = newPoint[1] - oldPoint[1];
      // ret.pixelLength = Math.abs(angleExtent[1] - angleExtent[0]);
      // ret.pixelStart = Math.min(angleExtent[0], angleExtent[1]);
      ret.pixelLength = angleExtent[1] - angleExtent[0];
      ret.pixelStart = angleExtent[0];
      ret.signal = axis.inverse ? -1 : 1;
    }
    return ret;
  },
  singleAxis: function (oldPoint, newPoint, axisModel, controller, coordSysInfo) {
    var axis = axisModel.axis;
    var rect = coordSysInfo.model.coordinateSystem.getRect();
    var ret = {};
    oldPoint = oldPoint || [0, 0];
    if (axis.orient === 'horizontal') {
      ret.pixel = newPoint[0] - oldPoint[0];
      ret.pixelLength = rect.width;
      ret.pixelStart = rect.x;
      ret.signal = axis.inverse ? 1 : -1;
    } else {
      // 'vertical'
      ret.pixel = newPoint[1] - oldPoint[1];
      ret.pixelLength = rect.height;
      ret.pixelStart = rect.y;
      ret.signal = axis.inverse ? -1 : 1;
    }
    return ret;
  }
};
var InsideZoomView$1 = InsideZoomView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$a(registers) {
  installCommon$1(registers);
  registers.registerComponentModel(InsideZoomModel$1);
  registers.registerComponentView(InsideZoomView$1);
  installDataZoomRoamProcessor(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var SliderZoomModel = /** @class */function (_super) {
  __extends(SliderZoomModel, _super);
  function SliderZoomModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SliderZoomModel.type;
    return _this;
  }
  SliderZoomModel.type = 'dataZoom.slider';
  SliderZoomModel.layoutMode = 'box';
  SliderZoomModel.defaultOption = inheritDefaultOption(DataZoomModel$1.defaultOption, {
    show: true,
    // deault value can only be drived in view stage.
    right: 'ph',
    top: 'ph',
    width: 'ph',
    height: 'ph',
    left: null,
    bottom: null,
    borderColor: '#d2dbee',
    borderRadius: 3,
    backgroundColor: 'rgba(47,69,84,0)',
    // dataBackgroundColor: '#ddd',
    dataBackground: {
      lineStyle: {
        color: '#d2dbee',
        width: 0.5
      },
      areaStyle: {
        color: '#d2dbee',
        opacity: 0.2
      }
    },
    selectedDataBackground: {
      lineStyle: {
        color: '#8fb0f7',
        width: 0.5
      },
      areaStyle: {
        color: '#8fb0f7',
        opacity: 0.2
      }
    },
    // Color of selected window.
    fillerColor: 'rgba(135,175,274,0.2)',
    handleIcon: 'path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z',
    // Percent of the slider height
    handleSize: '100%',
    handleStyle: {
      color: '#fff',
      borderColor: '#ACB8D1'
    },
    moveHandleSize: 7,
    moveHandleIcon: 'path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z',
    moveHandleStyle: {
      color: '#D2DBEE',
      opacity: 0.7
    },
    showDetail: true,
    showDataShadow: 'auto',
    realtime: true,
    zoomLock: false,
    textStyle: {
      color: '#6E7079'
    },
    brushSelect: true,
    brushStyle: {
      color: 'rgba(135,175,274,0.15)'
    },
    emphasis: {
      handleLabel: {
        show: true
      },
      handleStyle: {
        borderColor: '#8FB0F7'
      },
      moveHandleStyle: {
        color: '#8FB0F7'
      }
    }
  });
  return SliderZoomModel;
}(DataZoomModel$1);
var SliderZoomModel$1 = SliderZoomModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var Rect = Rect$3;
// Constants
var DEFAULT_LOCATION_EDGE_GAP = 7;
var DEFAULT_FRAME_BORDER_WIDTH = 1;
var DEFAULT_FILLER_SIZE = 30;
var DEFAULT_MOVE_HANDLE_SIZE = 7;
var HORIZONTAL = 'horizontal';
var VERTICAL = 'vertical';
var LABEL_GAP = 5;
var SHOW_DATA_SHADOW_SERIES_TYPE = ['line', 'bar', 'candlestick', 'scatter'];
var REALTIME_ANIMATION_CONFIG = {
  easing: 'cubicOut',
  duration: 100,
  delay: 0
};
var SliderZoomView = /** @class */function (_super) {
  __extends(SliderZoomView, _super);
  function SliderZoomView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = SliderZoomView.type;
    _this._displayables = {};
    return _this;
  }
  SliderZoomView.prototype.init = function (ecModel, api) {
    this.api = api;
    // A unique handler for each dataZoom component
    this._onBrush = bind$1(this._onBrush, this);
    this._onBrushEnd = bind$1(this._onBrushEnd, this);
  };
  SliderZoomView.prototype.render = function (dataZoomModel, ecModel, api, payload) {
    _super.prototype.render.apply(this, arguments);
    createOrUpdate(this, '_dispatchZoomAction', dataZoomModel.get('throttle'), 'fixRate');
    this._orient = dataZoomModel.getOrient();
    if (dataZoomModel.get('show') === false) {
      this.group.removeAll();
      return;
    }
    if (dataZoomModel.noTarget()) {
      this._clear();
      this.group.removeAll();
      return;
    }
    // Notice: this._resetInterval() should not be executed when payload.type
    // is 'dataZoom', origin this._range should be maintained, otherwise 'pan'
    // or 'zoom' info will be missed because of 'throttle' of this.dispatchAction,
    if (!payload || payload.type !== 'dataZoom' || payload.from !== this.uid) {
      this._buildView();
    }
    this._updateView();
  };
  SliderZoomView.prototype.dispose = function () {
    this._clear();
    _super.prototype.dispose.apply(this, arguments);
  };
  SliderZoomView.prototype._clear = function () {
    clear$1(this, '_dispatchZoomAction');
    var zr = this.api.getZr();
    zr.off('mousemove', this._onBrush);
    zr.off('mouseup', this._onBrushEnd);
  };
  SliderZoomView.prototype._buildView = function () {
    var thisGroup = this.group;
    thisGroup.removeAll();
    this._brushing = false;
    this._displayables.brushRect = null;
    this._resetLocation();
    this._resetInterval();
    var barGroup = this._displayables.sliderGroup = new Group$5();
    this._renderBackground();
    this._renderHandle();
    this._renderDataShadow();
    thisGroup.add(barGroup);
    this._positionGroup();
  };
  SliderZoomView.prototype._resetLocation = function () {
    var dataZoomModel = this.dataZoomModel;
    var api = this.api;
    var showMoveHandle = dataZoomModel.get('brushSelect');
    var moveHandleSize = showMoveHandle ? DEFAULT_MOVE_HANDLE_SIZE : 0;
    // If some of x/y/width/height are not specified,
    // auto-adapt according to target grid.
    var coordRect = this._findCoordRect();
    var ecSize = {
      width: api.getWidth(),
      height: api.getHeight()
    };
    // Default align by coordinate system rect.
    var positionInfo = this._orient === HORIZONTAL ? {
      // Why using 'right', because right should be used in vertical,
      // and it is better to be consistent for dealing with position param merge.
      right: ecSize.width - coordRect.x - coordRect.width,
      top: ecSize.height - DEFAULT_FILLER_SIZE - DEFAULT_LOCATION_EDGE_GAP - moveHandleSize,
      width: coordRect.width,
      height: DEFAULT_FILLER_SIZE
    } : {
      right: DEFAULT_LOCATION_EDGE_GAP,
      top: coordRect.y,
      width: DEFAULT_FILLER_SIZE,
      height: coordRect.height
    };
    // Do not write back to option and replace value 'ph', because
    // the 'ph' value should be recalculated when resize.
    var layoutParams = getLayoutParams(dataZoomModel.option);
    // Replace the placeholder value.
    each$f(['right', 'top', 'width', 'height'], function (name) {
      if (layoutParams[name] === 'ph') {
        layoutParams[name] = positionInfo[name];
      }
    });
    var layoutRect = getLayoutRect(layoutParams, ecSize);
    this._location = {
      x: layoutRect.x,
      y: layoutRect.y
    };
    this._size = [layoutRect.width, layoutRect.height];
    this._orient === VERTICAL && this._size.reverse();
  };
  SliderZoomView.prototype._positionGroup = function () {
    var thisGroup = this.group;
    var location = this._location;
    var orient = this._orient;
    // Just use the first axis to determine mapping.
    var targetAxisModel = this.dataZoomModel.getFirstTargetAxisModel();
    var inverse = targetAxisModel && targetAxisModel.get('inverse');
    var sliderGroup = this._displayables.sliderGroup;
    var otherAxisInverse = (this._dataShadowInfo || {}).otherAxisInverse;
    // Transform barGroup.
    sliderGroup.attr(orient === HORIZONTAL && !inverse ? {
      scaleY: otherAxisInverse ? 1 : -1,
      scaleX: 1
    } : orient === HORIZONTAL && inverse ? {
      scaleY: otherAxisInverse ? 1 : -1,
      scaleX: -1
    } : orient === VERTICAL && !inverse ? {
      scaleY: otherAxisInverse ? -1 : 1,
      scaleX: 1,
      rotation: Math.PI / 2
    }
    // Don't use Math.PI, considering shadow direction.
    : {
      scaleY: otherAxisInverse ? -1 : 1,
      scaleX: -1,
      rotation: Math.PI / 2
    });
    // Position barGroup
    var rect = thisGroup.getBoundingRect([sliderGroup]);
    thisGroup.x = location.x - rect.x;
    thisGroup.y = location.y - rect.y;
    thisGroup.markRedraw();
  };
  SliderZoomView.prototype._getViewExtent = function () {
    return [0, this._size[0]];
  };
  SliderZoomView.prototype._renderBackground = function () {
    var dataZoomModel = this.dataZoomModel;
    var size = this._size;
    var barGroup = this._displayables.sliderGroup;
    var brushSelect = dataZoomModel.get('brushSelect');
    barGroup.add(new Rect({
      silent: true,
      shape: {
        x: 0,
        y: 0,
        width: size[0],
        height: size[1]
      },
      style: {
        fill: dataZoomModel.get('backgroundColor')
      },
      z2: -40
    }));
    // Click panel, over shadow, below handles.
    var clickPanel = new Rect({
      shape: {
        x: 0,
        y: 0,
        width: size[0],
        height: size[1]
      },
      style: {
        fill: 'transparent'
      },
      z2: 0,
      onclick: bind$1(this._onClickPanel, this)
    });
    var zr = this.api.getZr();
    if (brushSelect) {
      clickPanel.on('mousedown', this._onBrushStart, this);
      clickPanel.cursor = 'crosshair';
      zr.on('mousemove', this._onBrush);
      zr.on('mouseup', this._onBrushEnd);
    } else {
      zr.off('mousemove', this._onBrush);
      zr.off('mouseup', this._onBrushEnd);
    }
    barGroup.add(clickPanel);
  };
  SliderZoomView.prototype._renderDataShadow = function () {
    var info = this._dataShadowInfo = this._prepareDataShadowInfo();
    this._displayables.dataShadowSegs = [];
    if (!info) {
      return;
    }
    var size = this._size;
    var oldSize = this._shadowSize || [];
    var seriesModel = info.series;
    var data = seriesModel.getRawData();
    var candlestickDim = seriesModel.getShadowDim && seriesModel.getShadowDim();
    var otherDim = candlestickDim && data.getDimensionInfo(candlestickDim) ? seriesModel.getShadowDim() // @see candlestick
    : info.otherDim;
    if (otherDim == null) {
      return;
    }
    var polygonPts = this._shadowPolygonPts;
    var polylinePts = this._shadowPolylinePts;
    // Not re-render if data doesn't change.
    if (data !== this._shadowData || otherDim !== this._shadowDim || size[0] !== oldSize[0] || size[1] !== oldSize[1]) {
      var otherDataExtent_1 = data.getDataExtent(otherDim);
      // Nice extent.
      var otherOffset = (otherDataExtent_1[1] - otherDataExtent_1[0]) * 0.3;
      otherDataExtent_1 = [otherDataExtent_1[0] - otherOffset, otherDataExtent_1[1] + otherOffset];
      var otherShadowExtent_1 = [0, size[1]];
      var thisShadowExtent = [0, size[0]];
      var areaPoints_1 = [[size[0], 0], [0, 0]];
      var linePoints_1 = [];
      var step_1 = thisShadowExtent[1] / (data.count() - 1);
      var thisCoord_1 = 0;
      // Optimize for large data shadow
      var stride_1 = Math.round(data.count() / size[0]);
      var lastIsEmpty_1;
      data.each([otherDim], function (value, index) {
        if (stride_1 > 0 && index % stride_1) {
          thisCoord_1 += step_1;
          return;
        }
        // FIXME
        // Should consider axis.min/axis.max when drawing dataShadow.
        // FIXME
        // 应该使用统一的空判断？还是在list里进行空判断？
        var isEmpty = value == null || isNaN(value) || value === '';
        // See #4235.
        var otherCoord = isEmpty ? 0 : linearMap$2(value, otherDataExtent_1, otherShadowExtent_1, true);
        // Attempt to draw data shadow precisely when there are empty value.
        if (isEmpty && !lastIsEmpty_1 && index) {
          areaPoints_1.push([areaPoints_1[areaPoints_1.length - 1][0], 0]);
          linePoints_1.push([linePoints_1[linePoints_1.length - 1][0], 0]);
        } else if (!isEmpty && lastIsEmpty_1) {
          areaPoints_1.push([thisCoord_1, 0]);
          linePoints_1.push([thisCoord_1, 0]);
        }
        areaPoints_1.push([thisCoord_1, otherCoord]);
        linePoints_1.push([thisCoord_1, otherCoord]);
        thisCoord_1 += step_1;
        lastIsEmpty_1 = isEmpty;
      });
      polygonPts = this._shadowPolygonPts = areaPoints_1;
      polylinePts = this._shadowPolylinePts = linePoints_1;
    }
    this._shadowData = data;
    this._shadowDim = otherDim;
    this._shadowSize = [size[0], size[1]];
    var dataZoomModel = this.dataZoomModel;
    function createDataShadowGroup(isSelectedArea) {
      var model = dataZoomModel.getModel(isSelectedArea ? 'selectedDataBackground' : 'dataBackground');
      var group = new Group$5();
      var polygon = new Polygon$1({
        shape: {
          points: polygonPts
        },
        segmentIgnoreThreshold: 1,
        style: model.getModel('areaStyle').getAreaStyle(),
        silent: true,
        z2: -20
      });
      var polyline = new Polyline$3({
        shape: {
          points: polylinePts
        },
        segmentIgnoreThreshold: 1,
        style: model.getModel('lineStyle').getLineStyle(),
        silent: true,
        z2: -19
      });
      group.add(polygon);
      group.add(polyline);
      return group;
    }
    // let dataBackgroundModel = dataZoomModel.getModel('dataBackground');
    for (var i = 0; i < 3; i++) {
      var group = createDataShadowGroup(i === 1);
      this._displayables.sliderGroup.add(group);
      this._displayables.dataShadowSegs.push(group);
    }
  };
  SliderZoomView.prototype._prepareDataShadowInfo = function () {
    var dataZoomModel = this.dataZoomModel;
    var showDataShadow = dataZoomModel.get('showDataShadow');
    if (showDataShadow === false) {
      return;
    }
    // Find a representative series.
    var result;
    var ecModel = this.ecModel;
    dataZoomModel.eachTargetAxis(function (axisDim, axisIndex) {
      var seriesModels = dataZoomModel.getAxisProxy(axisDim, axisIndex).getTargetSeriesModels();
      each$f(seriesModels, function (seriesModel) {
        if (result) {
          return;
        }
        if (showDataShadow !== true && indexOf(SHOW_DATA_SHADOW_SERIES_TYPE, seriesModel.get('type')) < 0) {
          return;
        }
        var thisAxis = ecModel.getComponent(getAxisMainType(axisDim), axisIndex).axis;
        var otherDim = getOtherDim(axisDim);
        var otherAxisInverse;
        var coordSys = seriesModel.coordinateSystem;
        if (otherDim != null && coordSys.getOtherAxis) {
          otherAxisInverse = coordSys.getOtherAxis(thisAxis).inverse;
        }
        otherDim = seriesModel.getData().mapDimension(otherDim);
        result = {
          thisAxis: thisAxis,
          series: seriesModel,
          thisDim: axisDim,
          otherDim: otherDim,
          otherAxisInverse: otherAxisInverse
        };
      }, this);
    }, this);
    return result;
  };
  SliderZoomView.prototype._renderHandle = function () {
    var thisGroup = this.group;
    var displayables = this._displayables;
    var handles = displayables.handles = [null, null];
    var handleLabels = displayables.handleLabels = [null, null];
    var sliderGroup = this._displayables.sliderGroup;
    var size = this._size;
    var dataZoomModel = this.dataZoomModel;
    var api = this.api;
    var borderRadius = dataZoomModel.get('borderRadius') || 0;
    var brushSelect = dataZoomModel.get('brushSelect');
    var filler = displayables.filler = new Rect({
      silent: brushSelect,
      style: {
        fill: dataZoomModel.get('fillerColor')
      },
      textConfig: {
        position: 'inside'
      }
    });
    sliderGroup.add(filler);
    // Frame border.
    sliderGroup.add(new Rect({
      silent: true,
      subPixelOptimize: true,
      shape: {
        x: 0,
        y: 0,
        width: size[0],
        height: size[1],
        r: borderRadius
      },
      style: {
        // deprecated option
        stroke: dataZoomModel.get('dataBackgroundColor') || dataZoomModel.get('borderColor'),
        lineWidth: DEFAULT_FRAME_BORDER_WIDTH,
        fill: 'rgba(0,0,0,0)'
      }
    }));
    // Left and right handle to resize
    each$f([0, 1], function (handleIndex) {
      var iconStr = dataZoomModel.get('handleIcon');
      if (!symbolBuildProxies[iconStr] && iconStr.indexOf('path://') < 0 && iconStr.indexOf('image://') < 0) {
        // Compatitable with the old icon parsers. Which can use a path string without path://
        iconStr = 'path://' + iconStr;
        {
          deprecateLog('handleIcon now needs \'path://\' prefix when using a path string');
        }
      }
      var path = createSymbol$1(iconStr, -1, 0, 2, 2, null, true);
      path.attr({
        cursor: getCursor$1(this._orient),
        draggable: true,
        drift: bind$1(this._onDragMove, this, handleIndex),
        ondragend: bind$1(this._onDragEnd, this),
        onmouseover: bind$1(this._showDataInfo, this, true),
        onmouseout: bind$1(this._showDataInfo, this, false),
        z2: 5
      });
      var bRect = path.getBoundingRect();
      var handleSize = dataZoomModel.get('handleSize');
      this._handleHeight = parsePercent(handleSize, this._size[1]);
      this._handleWidth = bRect.width / bRect.height * this._handleHeight;
      path.setStyle(dataZoomModel.getModel('handleStyle').getItemStyle());
      path.style.strokeNoScale = true;
      path.rectHover = true;
      path.ensureState('emphasis').style = dataZoomModel.getModel(['emphasis', 'handleStyle']).getItemStyle();
      enableHoverEmphasis(path);
      var handleColor = dataZoomModel.get('handleColor'); // deprecated option
      // Compatitable with previous version
      if (handleColor != null) {
        path.style.fill = handleColor;
      }
      sliderGroup.add(handles[handleIndex] = path);
      var textStyleModel = dataZoomModel.getModel('textStyle');
      var handleLabel = dataZoomModel.get('handleLabel') || {};
      var handleLabelShow = handleLabel.show || false;
      thisGroup.add(handleLabels[handleIndex] = new ZRText$1({
        silent: true,
        invisible: !handleLabelShow,
        style: createTextStyle(textStyleModel, {
          x: 0,
          y: 0,
          text: '',
          verticalAlign: 'middle',
          align: 'center',
          fill: textStyleModel.getTextColor(),
          font: textStyleModel.getFont()
        }),
        z2: 10
      }));
    }, this);
    // Handle to move. Only visible when brushSelect is set true.
    var actualMoveZone = filler;
    if (brushSelect) {
      var moveHandleHeight = parsePercent(dataZoomModel.get('moveHandleSize'), size[1]);
      var moveHandle_1 = displayables.moveHandle = new Rect$3({
        style: dataZoomModel.getModel('moveHandleStyle').getItemStyle(),
        silent: true,
        shape: {
          r: [0, 0, 2, 2],
          y: size[1] - 0.5,
          height: moveHandleHeight
        }
      });
      var iconSize = moveHandleHeight * 0.8;
      var moveHandleIcon = displayables.moveHandleIcon = createSymbol$1(dataZoomModel.get('moveHandleIcon'), -iconSize / 2, -iconSize / 2, iconSize, iconSize, '#fff', true);
      moveHandleIcon.silent = true;
      moveHandleIcon.y = size[1] + moveHandleHeight / 2 - 0.5;
      moveHandle_1.ensureState('emphasis').style = dataZoomModel.getModel(['emphasis', 'moveHandleStyle']).getItemStyle();
      var moveZoneExpandSize = Math.min(size[1] / 2, Math.max(moveHandleHeight, 10));
      actualMoveZone = displayables.moveZone = new Rect$3({
        invisible: true,
        shape: {
          y: size[1] - moveZoneExpandSize,
          height: moveHandleHeight + moveZoneExpandSize
        }
      });
      actualMoveZone.on('mouseover', function () {
        api.enterEmphasis(moveHandle_1);
      }).on('mouseout', function () {
        api.leaveEmphasis(moveHandle_1);
      });
      sliderGroup.add(moveHandle_1);
      sliderGroup.add(moveHandleIcon);
      sliderGroup.add(actualMoveZone);
    }
    actualMoveZone.attr({
      draggable: true,
      cursor: getCursor$1(this._orient),
      drift: bind$1(this._onDragMove, this, 'all'),
      ondragstart: bind$1(this._showDataInfo, this, true),
      ondragend: bind$1(this._onDragEnd, this),
      onmouseover: bind$1(this._showDataInfo, this, true),
      onmouseout: bind$1(this._showDataInfo, this, false)
    });
  };
  SliderZoomView.prototype._resetInterval = function () {
    var range = this._range = this.dataZoomModel.getPercentRange();
    var viewExtent = this._getViewExtent();
    this._handleEnds = [linearMap$2(range[0], [0, 100], viewExtent, true), linearMap$2(range[1], [0, 100], viewExtent, true)];
  };
  SliderZoomView.prototype._updateInterval = function (handleIndex, delta) {
    var dataZoomModel = this.dataZoomModel;
    var handleEnds = this._handleEnds;
    var viewExtend = this._getViewExtent();
    var minMaxSpan = dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();
    var percentExtent = [0, 100];
    sliderMove(delta, handleEnds, viewExtend, dataZoomModel.get('zoomLock') ? 'all' : handleIndex, minMaxSpan.minSpan != null ? linearMap$2(minMaxSpan.minSpan, percentExtent, viewExtend, true) : null, minMaxSpan.maxSpan != null ? linearMap$2(minMaxSpan.maxSpan, percentExtent, viewExtend, true) : null);
    var lastRange = this._range;
    var range = this._range = asc$2([linearMap$2(handleEnds[0], viewExtend, percentExtent, true), linearMap$2(handleEnds[1], viewExtend, percentExtent, true)]);
    return !lastRange || lastRange[0] !== range[0] || lastRange[1] !== range[1];
  };
  SliderZoomView.prototype._updateView = function (nonRealtime) {
    var displaybles = this._displayables;
    var handleEnds = this._handleEnds;
    var handleInterval = asc$2(handleEnds.slice());
    var size = this._size;
    each$f([0, 1], function (handleIndex) {
      // Handles
      var handle = displaybles.handles[handleIndex];
      var handleHeight = this._handleHeight;
      handle.attr({
        scaleX: handleHeight / 2,
        scaleY: handleHeight / 2,
        // This is a trick, by adding an extra tiny offset to let the default handle's end point align to the drag window.
        // NOTE: It may affect some custom shapes a bit. But we prefer to have better result by default.
        x: handleEnds[handleIndex] + (handleIndex ? -1 : 1),
        y: size[1] / 2 - handleHeight / 2
      });
    }, this);
    // Filler
    displaybles.filler.setShape({
      x: handleInterval[0],
      y: 0,
      width: handleInterval[1] - handleInterval[0],
      height: size[1]
    });
    var viewExtent = {
      x: handleInterval[0],
      width: handleInterval[1] - handleInterval[0]
    };
    // Move handle
    if (displaybles.moveHandle) {
      displaybles.moveHandle.setShape(viewExtent);
      displaybles.moveZone.setShape(viewExtent);
      // Force update path on the invisible object
      displaybles.moveZone.getBoundingRect();
      displaybles.moveHandleIcon && displaybles.moveHandleIcon.attr('x', viewExtent.x + viewExtent.width / 2);
    }
    // update clip path of shadow.
    var dataShadowSegs = displaybles.dataShadowSegs;
    var segIntervals = [0, handleInterval[0], handleInterval[1], size[0]];
    for (var i = 0; i < dataShadowSegs.length; i++) {
      var segGroup = dataShadowSegs[i];
      var clipPath = segGroup.getClipPath();
      if (!clipPath) {
        clipPath = new Rect$3();
        segGroup.setClipPath(clipPath);
      }
      clipPath.setShape({
        x: segIntervals[i],
        y: 0,
        width: segIntervals[i + 1] - segIntervals[i],
        height: size[1]
      });
    }
    this._updateDataInfo(nonRealtime);
  };
  SliderZoomView.prototype._updateDataInfo = function (nonRealtime) {
    var dataZoomModel = this.dataZoomModel;
    var displaybles = this._displayables;
    var handleLabels = displaybles.handleLabels;
    var orient = this._orient;
    var labelTexts = ['', ''];
    // FIXME
    // date型，支持formatter，autoformatter（ec2 date.getAutoFormatter）
    if (dataZoomModel.get('showDetail')) {
      var axisProxy = dataZoomModel.findRepresentativeAxisProxy();
      if (axisProxy) {
        var axis = axisProxy.getAxisModel().axis;
        var range = this._range;
        var dataInterval = nonRealtime
        // See #4434, data and axis are not processed and reset yet in non-realtime mode.
        ? axisProxy.calculateDataWindow({
          start: range[0],
          end: range[1]
        }).valueWindow : axisProxy.getDataValueWindow();
        labelTexts = [this._formatLabel(dataInterval[0], axis), this._formatLabel(dataInterval[1], axis)];
      }
    }
    var orderedHandleEnds = asc$2(this._handleEnds.slice());
    setLabel.call(this, 0);
    setLabel.call(this, 1);
    function setLabel(handleIndex) {
      // Label
      // Text should not transform by barGroup.
      // Ignore handlers transform
      var barTransform = getTransform$1(displaybles.handles[handleIndex].parent, this.group);
      var direction = transformDirection$1(handleIndex === 0 ? 'right' : 'left', barTransform);
      var offset = this._handleWidth / 2 + LABEL_GAP;
      var textPoint = applyTransform([orderedHandleEnds[handleIndex] + (handleIndex === 0 ? -offset : offset), this._size[1] / 2], barTransform);
      handleLabels[handleIndex].setStyle({
        x: textPoint[0],
        y: textPoint[1],
        verticalAlign: orient === HORIZONTAL ? 'middle' : direction,
        align: orient === HORIZONTAL ? direction : 'center',
        text: labelTexts[handleIndex]
      });
    }
  };
  SliderZoomView.prototype._formatLabel = function (value, axis) {
    var dataZoomModel = this.dataZoomModel;
    var labelFormatter = dataZoomModel.get('labelFormatter');
    var labelPrecision = dataZoomModel.get('labelPrecision');
    if (labelPrecision == null || labelPrecision === 'auto') {
      labelPrecision = axis.getPixelPrecision();
    }
    var valueStr = value == null || isNaN(value) ? ''
    // FIXME Glue code
    : axis.type === 'category' || axis.type === 'time' ? axis.scale.getLabel({
      value: Math.round(value)
    })
    // param of toFixed should less then 20.
    : value.toFixed(Math.min(labelPrecision, 20));
    return isFunction(labelFormatter) ? labelFormatter(value, valueStr) : isString(labelFormatter) ? labelFormatter.replace('{value}', valueStr) : valueStr;
  };
  /**
   * @param isEmphasis true: show, false: hide
   */
  SliderZoomView.prototype._showDataInfo = function (isEmphasis) {
    var handleLabel = this.dataZoomModel.get('handleLabel') || {};
    var normalShow = handleLabel.show || false;
    var emphasisHandleLabel = this.dataZoomModel.getModel(['emphasis', 'handleLabel']);
    var emphasisShow = emphasisHandleLabel.get('show') || false;
    // Dragging is considered as emphasis, unless emphasisShow is false
    var toShow = isEmphasis || this._dragging ? emphasisShow : normalShow;
    var displayables = this._displayables;
    var handleLabels = displayables.handleLabels;
    handleLabels[0].attr('invisible', !toShow);
    handleLabels[1].attr('invisible', !toShow);
    // Highlight move handle
    displayables.moveHandle && this.api[toShow ? 'enterEmphasis' : 'leaveEmphasis'](displayables.moveHandle, 1);
  };
  SliderZoomView.prototype._onDragMove = function (handleIndex, dx, dy, event) {
    this._dragging = true;
    // For mobile device, prevent screen slider on the button.
    stop(event.event);
    // Transform dx, dy to bar coordination.
    var barTransform = this._displayables.sliderGroup.getLocalTransform();
    var vertex = applyTransform([dx, dy], barTransform, true);
    var changed = this._updateInterval(handleIndex, vertex[0]);
    var realtime = this.dataZoomModel.get('realtime');
    this._updateView(!realtime);
    // Avoid dispatch dataZoom repeatly but range not changed,
    // which cause bad visual effect when progressive enabled.
    changed && realtime && this._dispatchZoomAction(true);
  };
  SliderZoomView.prototype._onDragEnd = function () {
    this._dragging = false;
    this._showDataInfo(false);
    // While in realtime mode and stream mode, dispatch action when
    // drag end will cause the whole view rerender, which is unnecessary.
    var realtime = this.dataZoomModel.get('realtime');
    !realtime && this._dispatchZoomAction(false);
  };
  SliderZoomView.prototype._onClickPanel = function (e) {
    var size = this._size;
    var localPoint = this._displayables.sliderGroup.transformCoordToLocal(e.offsetX, e.offsetY);
    if (localPoint[0] < 0 || localPoint[0] > size[0] || localPoint[1] < 0 || localPoint[1] > size[1]) {
      return;
    }
    var handleEnds = this._handleEnds;
    var center = (handleEnds[0] + handleEnds[1]) / 2;
    var changed = this._updateInterval('all', localPoint[0] - center);
    this._updateView();
    changed && this._dispatchZoomAction(false);
  };
  SliderZoomView.prototype._onBrushStart = function (e) {
    var x = e.offsetX;
    var y = e.offsetY;
    this._brushStart = new Point$1(x, y);
    this._brushing = true;
    this._brushStartTime = +new Date();
    // this._updateBrushRect(x, y);
  };
  SliderZoomView.prototype._onBrushEnd = function (e) {
    if (!this._brushing) {
      return;
    }
    var brushRect = this._displayables.brushRect;
    this._brushing = false;
    if (!brushRect) {
      return;
    }
    brushRect.attr('ignore', true);
    var brushShape = brushRect.shape;
    var brushEndTime = +new Date();
    // console.log(brushEndTime - this._brushStartTime);
    if (brushEndTime - this._brushStartTime < 200 && Math.abs(brushShape.width) < 5) {
      // Will treat it as a click
      return;
    }
    var viewExtend = this._getViewExtent();
    var percentExtent = [0, 100];
    this._range = asc$2([linearMap$2(brushShape.x, viewExtend, percentExtent, true), linearMap$2(brushShape.x + brushShape.width, viewExtend, percentExtent, true)]);
    this._handleEnds = [brushShape.x, brushShape.x + brushShape.width];
    this._updateView();
    this._dispatchZoomAction(false);
  };
  SliderZoomView.prototype._onBrush = function (e) {
    if (this._brushing) {
      // For mobile device, prevent screen slider on the button.
      stop(e.event);
      this._updateBrushRect(e.offsetX, e.offsetY);
    }
  };
  SliderZoomView.prototype._updateBrushRect = function (mouseX, mouseY) {
    var displayables = this._displayables;
    var dataZoomModel = this.dataZoomModel;
    var brushRect = displayables.brushRect;
    if (!brushRect) {
      brushRect = displayables.brushRect = new Rect({
        silent: true,
        style: dataZoomModel.getModel('brushStyle').getItemStyle()
      });
      displayables.sliderGroup.add(brushRect);
    }
    brushRect.attr('ignore', false);
    var brushStart = this._brushStart;
    var sliderGroup = this._displayables.sliderGroup;
    var endPoint = sliderGroup.transformCoordToLocal(mouseX, mouseY);
    var startPoint = sliderGroup.transformCoordToLocal(brushStart.x, brushStart.y);
    var size = this._size;
    endPoint[0] = Math.max(Math.min(size[0], endPoint[0]), 0);
    brushRect.setShape({
      x: startPoint[0],
      y: 0,
      width: endPoint[0] - startPoint[0],
      height: size[1]
    });
  };
  /**
   * This action will be throttled.
   */
  SliderZoomView.prototype._dispatchZoomAction = function (realtime) {
    var range = this._range;
    this.api.dispatchAction({
      type: 'dataZoom',
      from: this.uid,
      dataZoomId: this.dataZoomModel.id,
      animation: realtime ? REALTIME_ANIMATION_CONFIG : null,
      start: range[0],
      end: range[1]
    });
  };
  SliderZoomView.prototype._findCoordRect = function () {
    // Find the grid corresponding to the first axis referred by dataZoom.
    var rect;
    var coordSysInfoList = collectReferCoordSysModelInfo(this.dataZoomModel).infoList;
    if (!rect && coordSysInfoList.length) {
      var coordSys = coordSysInfoList[0].model.coordinateSystem;
      rect = coordSys.getRect && coordSys.getRect();
    }
    if (!rect) {
      var width = this.api.getWidth();
      var height = this.api.getHeight();
      rect = {
        x: width * 0.2,
        y: height * 0.2,
        width: width * 0.6,
        height: height * 0.6
      };
    }
    return rect;
  };
  SliderZoomView.type = 'dataZoom.slider';
  return SliderZoomView;
}(DataZoomView$1);
function getOtherDim(thisDim) {
  // FIXME
  // 这个逻辑和getOtherAxis里一致，但是写在这里是否不好
  var map = {
    x: 'y',
    y: 'x',
    radius: 'angle',
    angle: 'radius'
  };
  return map[thisDim];
}
function getCursor$1(orient) {
  return orient === 'vertical' ? 'ns-resize' : 'ew-resize';
}
var SliderZoomView$1 = SliderZoomView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$9(registers) {
  registers.registerComponentModel(SliderZoomModel$1);
  registers.registerComponentView(SliderZoomView$1);
  installCommon$1(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$8(registers) {
  use(install$a);
  use(install$9);
  // Do not install './dataZoomSelect',
  // since it only work for toolbox dataZoom.
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var visualDefault = {
  /**
   * @public
   */
  get: function (visualType, key, isCategory) {
    var value = clone$4((defaultOption[visualType] || {})[key]);
    return isCategory ? isArray$1(value) ? value[value.length - 1] : value : value;
  }
};
var defaultOption = {
  color: {
    active: ['#006edd', '#e0ffff'],
    inactive: ['rgba(0,0,0,0)']
  },
  colorHue: {
    active: [0, 360],
    inactive: [0, 0]
  },
  colorSaturation: {
    active: [0.3, 1],
    inactive: [0, 0]
  },
  colorLightness: {
    active: [0.9, 0.5],
    inactive: [0, 0]
  },
  colorAlpha: {
    active: [0.3, 1],
    inactive: [0, 0]
  },
  opacity: {
    active: [0.3, 1],
    inactive: [0, 0]
  },
  symbol: {
    active: ['circle', 'roundRect', 'diamond'],
    inactive: ['none']
  },
  symbolSize: {
    active: [10, 50],
    inactive: [0, 0]
  }
};
var visualDefault$1 = visualDefault;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var mapVisual = VisualMapping$1.mapVisual;
var eachVisual = VisualMapping$1.eachVisual;
var isArray = isArray$1;
var each$2 = each$f;
var asc = asc$2;
var linearMap$1 = linearMap$2;
var VisualMapModel = /** @class */function (_super) {
  __extends(VisualMapModel, _super);
  function VisualMapModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = VisualMapModel.type;
    _this.stateList = ['inRange', 'outOfRange'];
    _this.replacableOptionKeys = ['inRange', 'outOfRange', 'target', 'controller', 'color'];
    _this.layoutMode = {
      type: 'box',
      ignoreSize: true
    };
    /**
     * [lowerBound, upperBound]
     */
    _this.dataBound = [-Infinity, Infinity];
    _this.targetVisuals = {};
    _this.controllerVisuals = {};
    return _this;
  }
  VisualMapModel.prototype.init = function (option, parentModel, ecModel) {
    this.mergeDefaultAndTheme(option, ecModel);
  };
  /**
   * @protected
   */
  VisualMapModel.prototype.optionUpdated = function (newOption, isInit) {
    var thisOption = this.option;
    !isInit && replaceVisualOption(thisOption, newOption, this.replacableOptionKeys);
    this.textStyleModel = this.getModel('textStyle');
    this.resetItemSize();
    this.completeVisualOption();
  };
  /**
   * @protected
   */
  VisualMapModel.prototype.resetVisual = function (supplementVisualOption) {
    var stateList = this.stateList;
    supplementVisualOption = bind$1(supplementVisualOption, this);
    this.controllerVisuals = createVisualMappings(this.option.controller, stateList, supplementVisualOption);
    this.targetVisuals = createVisualMappings(this.option.target, stateList, supplementVisualOption);
  };
  /**
   * @public
   */
  VisualMapModel.prototype.getItemSymbol = function () {
    return null;
  };
  /**
   * @protected
   * @return {Array.<number>} An array of series indices.
   */
  VisualMapModel.prototype.getTargetSeriesIndices = function () {
    var optionSeriesIndex = this.option.seriesIndex;
    var seriesIndices = [];
    if (optionSeriesIndex == null || optionSeriesIndex === 'all') {
      this.ecModel.eachSeries(function (seriesModel, index) {
        seriesIndices.push(index);
      });
    } else {
      seriesIndices = normalizeToArray(optionSeriesIndex);
    }
    return seriesIndices;
  };
  /**
   * @public
   */
  VisualMapModel.prototype.eachTargetSeries = function (callback, context) {
    each$f(this.getTargetSeriesIndices(), function (seriesIndex) {
      var seriesModel = this.ecModel.getSeriesByIndex(seriesIndex);
      if (seriesModel) {
        callback.call(context, seriesModel);
      }
    }, this);
  };
  /**
   * @pubilc
   */
  VisualMapModel.prototype.isTargetSeries = function (seriesModel) {
    var is = false;
    this.eachTargetSeries(function (model) {
      model === seriesModel && (is = true);
    });
    return is;
  };
  /**
   * @example
   * this.formatValueText(someVal); // format single numeric value to text.
   * this.formatValueText(someVal, true); // format single category value to text.
   * this.formatValueText([min, max]); // format numeric min-max to text.
   * this.formatValueText([this.dataBound[0], max]); // using data lower bound.
   * this.formatValueText([min, this.dataBound[1]]); // using data upper bound.
   *
   * @param value Real value, or this.dataBound[0 or 1].
   * @param isCategory Only available when value is number.
   * @param edgeSymbols Open-close symbol when value is interval.
   * @protected
   */
  VisualMapModel.prototype.formatValueText = function (value, isCategory, edgeSymbols) {
    var option = this.option;
    var precision = option.precision;
    var dataBound = this.dataBound;
    var formatter = option.formatter;
    var isMinMax;
    edgeSymbols = edgeSymbols || ['<', '>'];
    if (isArray$1(value)) {
      value = value.slice();
      isMinMax = true;
    }
    var textValue = isCategory ? value // Value is string when isCategory
    : isMinMax ? [toFixed(value[0]), toFixed(value[1])] : toFixed(value);
    if (isString(formatter)) {
      return formatter.replace('{value}', isMinMax ? textValue[0] : textValue).replace('{value2}', isMinMax ? textValue[1] : textValue);
    } else if (isFunction(formatter)) {
      return isMinMax ? formatter(value[0], value[1]) : formatter(value);
    }
    if (isMinMax) {
      if (value[0] === dataBound[0]) {
        return edgeSymbols[0] + ' ' + textValue[1];
      } else if (value[1] === dataBound[1]) {
        return edgeSymbols[1] + ' ' + textValue[0];
      } else {
        return textValue[0] + ' - ' + textValue[1];
      }
    } else {
      // Format single value (includes category case).
      return textValue;
    }
    function toFixed(val) {
      return val === dataBound[0] ? 'min' : val === dataBound[1] ? 'max' : (+val).toFixed(Math.min(precision, 20));
    }
  };
  /**
   * @protected
   */
  VisualMapModel.prototype.resetExtent = function () {
    var thisOption = this.option;
    // Can not calculate data extent by data here.
    // Because series and data may be modified in processing stage.
    // So we do not support the feature "auto min/max".
    var extent = asc([thisOption.min, thisOption.max]);
    this._dataExtent = extent;
  };
  /**
   * PENDING:
   * delete this method if no outer usage.
   *
   * Return  Concrete dimension. If null/undefined is returned, no dimension is used.
   */
  // getDataDimension(data: SeriesData) {
  //     const optDim = this.option.dimension;
  //     if (optDim != null) {
  //         return data.getDimension(optDim);
  //     }
  //     const dimNames = data.dimensions;
  //     for (let i = dimNames.length - 1; i >= 0; i--) {
  //         const dimName = dimNames[i];
  //         const dimInfo = data.getDimensionInfo(dimName);
  //         if (!dimInfo.isCalculationCoord) {
  //             return dimName;
  //         }
  //     }
  // }
  VisualMapModel.prototype.getDataDimensionIndex = function (data) {
    var optDim = this.option.dimension;
    if (optDim != null) {
      return data.getDimensionIndex(optDim);
    }
    var dimNames = data.dimensions;
    for (var i = dimNames.length - 1; i >= 0; i--) {
      var dimName = dimNames[i];
      var dimInfo = data.getDimensionInfo(dimName);
      if (!dimInfo.isCalculationCoord) {
        return dimInfo.storeDimIndex;
      }
    }
  };
  VisualMapModel.prototype.getExtent = function () {
    return this._dataExtent.slice();
  };
  VisualMapModel.prototype.completeVisualOption = function () {
    var ecModel = this.ecModel;
    var thisOption = this.option;
    var base = {
      inRange: thisOption.inRange,
      outOfRange: thisOption.outOfRange
    };
    var target = thisOption.target || (thisOption.target = {});
    var controller = thisOption.controller || (thisOption.controller = {});
    merge(target, base); // Do not override
    merge(controller, base); // Do not override
    var isCategory = this.isCategory();
    completeSingle.call(this, target);
    completeSingle.call(this, controller);
    completeInactive.call(this, target, 'inRange', 'outOfRange');
    // completeInactive.call(this, target, 'outOfRange', 'inRange');
    completeController.call(this, controller);
    function completeSingle(base) {
      // Compatible with ec2 dataRange.color.
      // The mapping order of dataRange.color is: [high value, ..., low value]
      // whereas inRange.color and outOfRange.color is [low value, ..., high value]
      // Notice: ec2 has no inverse.
      if (isArray(thisOption.color)
      // If there has been inRange: {symbol: ...}, adding color is a mistake.
      // So adding color only when no inRange defined.
      && !base.inRange) {
        base.inRange = {
          color: thisOption.color.slice().reverse()
        };
      }
      // Compatible with previous logic, always give a default color, otherwise
      // simple config with no inRange and outOfRange will not work.
      // Originally we use visualMap.color as the default color, but setOption at
      // the second time the default color will be erased. So we change to use
      // constant DEFAULT_COLOR.
      // If user do not want the default color, set inRange: {color: null}.
      base.inRange = base.inRange || {
        color: ecModel.get('gradientColor')
      };
    }
    function completeInactive(base, stateExist, stateAbsent) {
      var optExist = base[stateExist];
      var optAbsent = base[stateAbsent];
      if (optExist && !optAbsent) {
        optAbsent = base[stateAbsent] = {};
        each$2(optExist, function (visualData, visualType) {
          if (!VisualMapping$1.isValidType(visualType)) {
            return;
          }
          var defa = visualDefault$1.get(visualType, 'inactive', isCategory);
          if (defa != null) {
            optAbsent[visualType] = defa;
            // Compatibable with ec2:
            // Only inactive color to rgba(0,0,0,0) can not
            // make label transparent, so use opacity also.
            if (visualType === 'color' && !optAbsent.hasOwnProperty('opacity') && !optAbsent.hasOwnProperty('colorAlpha')) {
              optAbsent.opacity = [0, 0];
            }
          }
        });
      }
    }
    function completeController(controller) {
      var symbolExists = (controller.inRange || {}).symbol || (controller.outOfRange || {}).symbol;
      var symbolSizeExists = (controller.inRange || {}).symbolSize || (controller.outOfRange || {}).symbolSize;
      var inactiveColor = this.get('inactiveColor');
      var itemSymbol = this.getItemSymbol();
      var defaultSymbol = itemSymbol || 'roundRect';
      each$2(this.stateList, function (state) {
        var itemSize = this.itemSize;
        var visuals = controller[state];
        // Set inactive color for controller if no other color
        // attr (like colorAlpha) specified.
        if (!visuals) {
          visuals = controller[state] = {
            color: isCategory ? inactiveColor : [inactiveColor]
          };
        }
        // Consistent symbol and symbolSize if not specified.
        if (visuals.symbol == null) {
          visuals.symbol = symbolExists && clone$4(symbolExists) || (isCategory ? defaultSymbol : [defaultSymbol]);
        }
        if (visuals.symbolSize == null) {
          visuals.symbolSize = symbolSizeExists && clone$4(symbolSizeExists) || (isCategory ? itemSize[0] : [itemSize[0], itemSize[0]]);
        }
        // Filter none
        visuals.symbol = mapVisual(visuals.symbol, function (symbol) {
          return symbol === 'none' ? defaultSymbol : symbol;
        });
        // Normalize symbolSize
        var symbolSize = visuals.symbolSize;
        if (symbolSize != null) {
          var max_1 = -Infinity;
          // symbolSize can be object when categories defined.
          eachVisual(symbolSize, function (value) {
            value > max_1 && (max_1 = value);
          });
          visuals.symbolSize = mapVisual(symbolSize, function (value) {
            return linearMap$1(value, [0, max_1], [0, itemSize[0]], true);
          });
        }
      }, this);
    }
  };
  VisualMapModel.prototype.resetItemSize = function () {
    this.itemSize = [parseFloat(this.get('itemWidth')), parseFloat(this.get('itemHeight'))];
  };
  VisualMapModel.prototype.isCategory = function () {
    return !!this.option.categories;
  };
  /**
   * @public
   * @abstract
   */
  VisualMapModel.prototype.setSelected = function (selected) {};
  VisualMapModel.prototype.getSelected = function () {
    return null;
  };
  /**
   * @public
   * @abstract
   */
  VisualMapModel.prototype.getValueState = function (value) {
    return null;
  };
  /**
   * FIXME
   * Do not publish to thirt-part-dev temporarily
   * util the interface is stable. (Should it return
   * a function but not visual meta?)
   *
   * @pubilc
   * @abstract
   * @param getColorVisual
   *        params: value, valueState
   *        return: color
   * @return {Object} visualMeta
   *        should includes {stops, outerColors}
   *        outerColor means [colorBeyondMinValue, colorBeyondMaxValue]
   */
  VisualMapModel.prototype.getVisualMeta = function (getColorVisual) {
    return null;
  };
  VisualMapModel.type = 'visualMap';
  VisualMapModel.dependencies = ['series'];
  VisualMapModel.defaultOption = {
    show: true,
    // zlevel: 0,
    z: 4,
    seriesIndex: 'all',
    min: 0,
    max: 200,
    left: 0,
    right: null,
    top: null,
    bottom: 0,
    itemWidth: null,
    itemHeight: null,
    inverse: false,
    orient: 'vertical',
    backgroundColor: 'rgba(0,0,0,0)',
    borderColor: '#ccc',
    contentColor: '#5793f3',
    inactiveColor: '#aaa',
    borderWidth: 0,
    padding: 5,
    // 接受数组分别设定上右下左边距，同css
    textGap: 10,
    precision: 0,
    textStyle: {
      color: '#333' // 值域文字颜色
    }
  };
  return VisualMapModel;
}(ComponentModel$1);
var VisualMapModel$1 = VisualMapModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Constant
var DEFAULT_BAR_BOUND = [20, 140];
var ContinuousModel = /** @class */function (_super) {
  __extends(ContinuousModel, _super);
  function ContinuousModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ContinuousModel.type;
    return _this;
  }
  /**
   * @override
   */
  ContinuousModel.prototype.optionUpdated = function (newOption, isInit) {
    _super.prototype.optionUpdated.apply(this, arguments);
    this.resetExtent();
    this.resetVisual(function (mappingOption) {
      mappingOption.mappingMethod = 'linear';
      mappingOption.dataExtent = this.getExtent();
    });
    this._resetRange();
  };
  /**
   * @protected
   * @override
   */
  ContinuousModel.prototype.resetItemSize = function () {
    _super.prototype.resetItemSize.apply(this, arguments);
    var itemSize = this.itemSize;
    (itemSize[0] == null || isNaN(itemSize[0])) && (itemSize[0] = DEFAULT_BAR_BOUND[0]);
    (itemSize[1] == null || isNaN(itemSize[1])) && (itemSize[1] = DEFAULT_BAR_BOUND[1]);
  };
  /**
   * @private
   */
  ContinuousModel.prototype._resetRange = function () {
    var dataExtent = this.getExtent();
    var range = this.option.range;
    if (!range || range.auto) {
      // `range` should always be array (so we don't use other
      // value like 'auto') for user-friend. (consider getOption).
      dataExtent.auto = 1;
      this.option.range = dataExtent;
    } else if (isArray$1(range)) {
      if (range[0] > range[1]) {
        range.reverse();
      }
      range[0] = Math.max(range[0], dataExtent[0]);
      range[1] = Math.min(range[1], dataExtent[1]);
    }
  };
  /**
   * @protected
   * @override
   */
  ContinuousModel.prototype.completeVisualOption = function () {
    _super.prototype.completeVisualOption.apply(this, arguments);
    each$f(this.stateList, function (state) {
      var symbolSize = this.option.controller[state].symbolSize;
      if (symbolSize && symbolSize[0] !== symbolSize[1]) {
        symbolSize[0] = symbolSize[1] / 3; // For good looking.
      }
    }, this);
  };
  /**
   * @override
   */
  ContinuousModel.prototype.setSelected = function (selected) {
    this.option.range = selected.slice();
    this._resetRange();
  };
  /**
   * @public
   */
  ContinuousModel.prototype.getSelected = function () {
    var dataExtent = this.getExtent();
    var dataInterval = asc$2((this.get('range') || []).slice());
    // Clamp
    dataInterval[0] > dataExtent[1] && (dataInterval[0] = dataExtent[1]);
    dataInterval[1] > dataExtent[1] && (dataInterval[1] = dataExtent[1]);
    dataInterval[0] < dataExtent[0] && (dataInterval[0] = dataExtent[0]);
    dataInterval[1] < dataExtent[0] && (dataInterval[1] = dataExtent[0]);
    return dataInterval;
  };
  /**
   * @override
   */
  ContinuousModel.prototype.getValueState = function (value) {
    var range = this.option.range;
    var dataExtent = this.getExtent();
    // When range[0] === dataExtent[0], any value larger than dataExtent[0] maps to 'inRange'.
    // range[1] is processed likewise.
    return (range[0] <= dataExtent[0] || range[0] <= value) && (range[1] >= dataExtent[1] || value <= range[1]) ? 'inRange' : 'outOfRange';
  };
  ContinuousModel.prototype.findTargetDataIndices = function (range) {
    var result = [];
    this.eachTargetSeries(function (seriesModel) {
      var dataIndices = [];
      var data = seriesModel.getData();
      data.each(this.getDataDimensionIndex(data), function (value, dataIndex) {
        range[0] <= value && value <= range[1] && dataIndices.push(dataIndex);
      }, this);
      result.push({
        seriesId: seriesModel.id,
        dataIndex: dataIndices
      });
    }, this);
    return result;
  };
  /**
   * @implement
   */
  ContinuousModel.prototype.getVisualMeta = function (getColorVisual) {
    var oVals = getColorStopValues(this, 'outOfRange', this.getExtent());
    var iVals = getColorStopValues(this, 'inRange', this.option.range.slice());
    var stops = [];
    function setStop(value, valueState) {
      stops.push({
        value: value,
        color: getColorVisual(value, valueState)
      });
    }
    // Format to: outOfRange -- inRange -- outOfRange.
    var iIdx = 0;
    var oIdx = 0;
    var iLen = iVals.length;
    var oLen = oVals.length;
    for (; oIdx < oLen && (!iVals.length || oVals[oIdx] <= iVals[0]); oIdx++) {
      // If oVal[oIdx] === iVals[iIdx], oVal[oIdx] should be ignored.
      if (oVals[oIdx] < iVals[iIdx]) {
        setStop(oVals[oIdx], 'outOfRange');
      }
    }
    for (var first = 1; iIdx < iLen; iIdx++, first = 0) {
      // If range is full, value beyond min, max will be clamped.
      // make a singularity
      first && stops.length && setStop(iVals[iIdx], 'outOfRange');
      setStop(iVals[iIdx], 'inRange');
    }
    for (var first = 1; oIdx < oLen; oIdx++) {
      if (!iVals.length || iVals[iVals.length - 1] < oVals[oIdx]) {
        // make a singularity
        if (first) {
          stops.length && setStop(stops[stops.length - 1].value, 'outOfRange');
          first = 0;
        }
        setStop(oVals[oIdx], 'outOfRange');
      }
    }
    var stopsLen = stops.length;
    return {
      stops: stops,
      outerColors: [stopsLen ? stops[0].color : 'transparent', stopsLen ? stops[stopsLen - 1].color : 'transparent']
    };
  };
  ContinuousModel.type = 'visualMap.continuous';
  ContinuousModel.defaultOption = inheritDefaultOption(VisualMapModel$1.defaultOption, {
    align: 'auto',
    calculable: false,
    hoverLink: true,
    realtime: true,
    handleIcon: 'path://M-11.39,9.77h0a3.5,3.5,0,0,1-3.5,3.5h-22a3.5,3.5,0,0,1-3.5-3.5h0a3.5,3.5,0,0,1,3.5-3.5h22A3.5,3.5,0,0,1-11.39,9.77Z',
    handleSize: '120%',
    handleStyle: {
      borderColor: '#fff',
      borderWidth: 1
    },
    indicatorIcon: 'circle',
    indicatorSize: '50%',
    indicatorStyle: {
      borderColor: '#fff',
      borderWidth: 2,
      shadowBlur: 2,
      shadowOffsetX: 1,
      shadowOffsetY: 1,
      shadowColor: 'rgba(0,0,0,0.2)'
    }
    // emphasis: {
    //     handleStyle: {
    //         shadowBlur: 3,
    //         shadowOffsetX: 1,
    //         shadowOffsetY: 1,
    //         shadowColor: 'rgba(0,0,0,0.2)'
    //     }
    // }
  });
  return ContinuousModel;
}(VisualMapModel$1);
function getColorStopValues(visualMapModel, valueState, dataExtent) {
  if (dataExtent[0] === dataExtent[1]) {
    return dataExtent.slice();
  }
  // When using colorHue mapping, it is not linear color any more.
  // Moreover, canvas gradient seems not to be accurate linear.
  // FIXME
  // Should be arbitrary value 100? or based on pixel size?
  var count = 200;
  var step = (dataExtent[1] - dataExtent[0]) / count;
  var value = dataExtent[0];
  var stopValues = [];
  for (var i = 0; i <= count && value < dataExtent[1]; i++) {
    stopValues.push(value);
    value += step;
  }
  stopValues.push(dataExtent[1]);
  return stopValues;
}
var ContinuousModel$1 = ContinuousModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var VisualMapView = /** @class */function (_super) {
  __extends(VisualMapView, _super);
  function VisualMapView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = VisualMapView.type;
    _this.autoPositionValues = {
      left: 1,
      right: 1,
      top: 1,
      bottom: 1
    };
    return _this;
  }
  VisualMapView.prototype.init = function (ecModel, api) {
    this.ecModel = ecModel;
    this.api = api;
  };
  /**
   * @protected
   */
  VisualMapView.prototype.render = function (visualMapModel, ecModel, api, payload // TODO: TYPE
  ) {
    this.visualMapModel = visualMapModel;
    if (visualMapModel.get('show') === false) {
      this.group.removeAll();
      return;
    }
    this.doRender(visualMapModel, ecModel, api, payload);
  };
  /**
   * @protected
   */
  VisualMapView.prototype.renderBackground = function (group) {
    var visualMapModel = this.visualMapModel;
    var padding = normalizeCssArray(visualMapModel.get('padding') || 0);
    var rect = group.getBoundingRect();
    group.add(new Rect$3({
      z2: -1,
      silent: true,
      shape: {
        x: rect.x - padding[3],
        y: rect.y - padding[0],
        width: rect.width + padding[3] + padding[1],
        height: rect.height + padding[0] + padding[2]
      },
      style: {
        fill: visualMapModel.get('backgroundColor'),
        stroke: visualMapModel.get('borderColor'),
        lineWidth: visualMapModel.get('borderWidth')
      }
    }));
  };
  /**
   * @protected
   * @param targetValue can be Infinity or -Infinity
   * @param visualCluster Only can be 'color' 'opacity' 'symbol' 'symbolSize'
   * @param opts
   * @param opts.forceState Specify state, instead of using getValueState method.
   * @param opts.convertOpacityToAlpha For color gradient in controller widget.
   * @return {*} Visual value.
   */
  VisualMapView.prototype.getControllerVisual = function (targetValue, visualCluster, opts) {
    opts = opts || {};
    var forceState = opts.forceState;
    var visualMapModel = this.visualMapModel;
    var visualObj = {};
    // Default values.
    if (visualCluster === 'color') {
      var defaultColor = visualMapModel.get('contentColor');
      visualObj.color = defaultColor;
    }
    function getter(key) {
      return visualObj[key];
    }
    function setter(key, value) {
      visualObj[key] = value;
    }
    var mappings = visualMapModel.controllerVisuals[forceState || visualMapModel.getValueState(targetValue)];
    var visualTypes = VisualMapping$1.prepareVisualTypes(mappings);
    each$f(visualTypes, function (type) {
      var visualMapping = mappings[type];
      if (opts.convertOpacityToAlpha && type === 'opacity') {
        type = 'colorAlpha';
        visualMapping = mappings.__alphaForOpacity;
      }
      if (VisualMapping$1.dependsOn(type, visualCluster)) {
        visualMapping && visualMapping.applyVisual(targetValue, getter, setter);
      }
    });
    return visualObj[visualCluster];
  };
  VisualMapView.prototype.positionGroup = function (group) {
    var model = this.visualMapModel;
    var api = this.api;
    positionElement(group, model.getBoxLayoutParams(), {
      width: api.getWidth(),
      height: api.getHeight()
    });
  };
  VisualMapView.prototype.doRender = function (visualMapModel, ecModel, api, payload) {};
  VisualMapView.type = 'visualMap';
  return VisualMapView;
}(ComponentView$1);
var VisualMapView$1 = VisualMapView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var paramsSet = [['left', 'right', 'width'], ['top', 'bottom', 'height']];
/**
 * @param visualMapModel
 * @param api
 * @param itemSize always [short, long]
 * @return {string} 'left' or 'right' or 'top' or 'bottom'
 */
function getItemAlign(visualMapModel, api, itemSize) {
  var modelOption = visualMapModel.option;
  var itemAlign = modelOption.align;
  if (itemAlign != null && itemAlign !== 'auto') {
    return itemAlign;
  }
  // Auto decision align.
  var ecSize = {
    width: api.getWidth(),
    height: api.getHeight()
  };
  var realIndex = modelOption.orient === 'horizontal' ? 1 : 0;
  var reals = paramsSet[realIndex];
  var fakeValue = [0, null, 10];
  var layoutInput = {};
  for (var i = 0; i < 3; i++) {
    layoutInput[paramsSet[1 - realIndex][i]] = fakeValue[i];
    layoutInput[reals[i]] = i === 2 ? itemSize[0] : modelOption[reals[i]];
  }
  var rParam = [['x', 'width', 3], ['y', 'height', 0]][realIndex];
  var rect = getLayoutRect(layoutInput, ecSize, modelOption.padding);
  return reals[(rect.margin[rParam[2]] || 0) + rect[rParam[0]] + rect[rParam[1]] * 0.5 < ecSize[rParam[1]] * 0.5 ? 0 : 1];
}
/**
 * Prepare dataIndex for outside usage, where dataIndex means rawIndex, and
 * dataIndexInside means filtered index.
 */
// TODO: TYPE more specified payload types.
function makeHighDownBatch(batch, visualMapModel) {
  each$f(batch || [], function (batchItem) {
    if (batchItem.dataIndex != null) {
      batchItem.dataIndexInside = batchItem.dataIndex;
      batchItem.dataIndex = null;
    }
    batchItem.highlightKey = 'visualMap' + (visualMapModel ? visualMapModel.componentIndex : '');
  });
  return batch;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var linearMap = linearMap$2;
var each$1 = each$f;
var mathMin = Math.min;
var mathMax = Math.max;
// Arbitrary value
var HOVER_LINK_SIZE = 12;
var HOVER_LINK_OUT = 6;
// Notice:
// Any "interval" should be by the order of [low, high].
// "handle0" (handleIndex === 0) maps to
// low data value: this._dataInterval[0] and has low coord.
// "handle1" (handleIndex === 1) maps to
// high data value: this._dataInterval[1] and has high coord.
// The logic of transform is implemented in this._createBarGroup.
var ContinuousView = /** @class */function (_super) {
  __extends(ContinuousView, _super);
  function ContinuousView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = ContinuousView.type;
    _this._shapes = {};
    _this._dataInterval = [];
    _this._handleEnds = [];
    _this._hoverLinkDataIndices = [];
    return _this;
  }
  ContinuousView.prototype.init = function (ecModel, api) {
    _super.prototype.init.call(this, ecModel, api);
    this._hoverLinkFromSeriesMouseOver = bind$1(this._hoverLinkFromSeriesMouseOver, this);
    this._hideIndicator = bind$1(this._hideIndicator, this);
  };
  ContinuousView.prototype.doRender = function (visualMapModel, ecModel, api, payload) {
    if (!payload || payload.type !== 'selectDataRange' || payload.from !== this.uid) {
      this._buildView();
    }
  };
  ContinuousView.prototype._buildView = function () {
    this.group.removeAll();
    var visualMapModel = this.visualMapModel;
    var thisGroup = this.group;
    this._orient = visualMapModel.get('orient');
    this._useHandle = visualMapModel.get('calculable');
    this._resetInterval();
    this._renderBar(thisGroup);
    var dataRangeText = visualMapModel.get('text');
    this._renderEndsText(thisGroup, dataRangeText, 0);
    this._renderEndsText(thisGroup, dataRangeText, 1);
    // Do this for background size calculation.
    this._updateView(true);
    // After updating view, inner shapes is built completely,
    // and then background can be rendered.
    this.renderBackground(thisGroup);
    // Real update view
    this._updateView();
    this._enableHoverLinkToSeries();
    this._enableHoverLinkFromSeries();
    this.positionGroup(thisGroup);
  };
  ContinuousView.prototype._renderEndsText = function (group, dataRangeText, endsIndex) {
    if (!dataRangeText) {
      return;
    }
    // Compatible with ec2, text[0] map to high value, text[1] map low value.
    var text = dataRangeText[1 - endsIndex];
    text = text != null ? text + '' : '';
    var visualMapModel = this.visualMapModel;
    var textGap = visualMapModel.get('textGap');
    var itemSize = visualMapModel.itemSize;
    var barGroup = this._shapes.mainGroup;
    var position = this._applyTransform([itemSize[0] / 2, endsIndex === 0 ? -textGap : itemSize[1] + textGap], barGroup);
    var align = this._applyTransform(endsIndex === 0 ? 'bottom' : 'top', barGroup);
    var orient = this._orient;
    var textStyleModel = this.visualMapModel.textStyleModel;
    this.group.add(new ZRText$1({
      style: createTextStyle(textStyleModel, {
        x: position[0],
        y: position[1],
        verticalAlign: orient === 'horizontal' ? 'middle' : align,
        align: orient === 'horizontal' ? align : 'center',
        text: text
      })
    }));
  };
  ContinuousView.prototype._renderBar = function (targetGroup) {
    var visualMapModel = this.visualMapModel;
    var shapes = this._shapes;
    var itemSize = visualMapModel.itemSize;
    var orient = this._orient;
    var useHandle = this._useHandle;
    var itemAlign = getItemAlign(visualMapModel, this.api, itemSize);
    var mainGroup = shapes.mainGroup = this._createBarGroup(itemAlign);
    var gradientBarGroup = new Group$5();
    mainGroup.add(gradientBarGroup);
    // Bar
    gradientBarGroup.add(shapes.outOfRange = createPolygon());
    gradientBarGroup.add(shapes.inRange = createPolygon(null, useHandle ? getCursor(this._orient) : null, bind$1(this._dragHandle, this, 'all', false), bind$1(this._dragHandle, this, 'all', true)));
    // A border radius clip.
    gradientBarGroup.setClipPath(new Rect$3({
      shape: {
        x: 0,
        y: 0,
        width: itemSize[0],
        height: itemSize[1],
        r: 3
      }
    }));
    var textRect = visualMapModel.textStyleModel.getTextRect('国');
    var textSize = mathMax(textRect.width, textRect.height);
    // Handle
    if (useHandle) {
      shapes.handleThumbs = [];
      shapes.handleLabels = [];
      shapes.handleLabelPoints = [];
      this._createHandle(visualMapModel, mainGroup, 0, itemSize, textSize, orient);
      this._createHandle(visualMapModel, mainGroup, 1, itemSize, textSize, orient);
    }
    this._createIndicator(visualMapModel, mainGroup, itemSize, textSize, orient);
    targetGroup.add(mainGroup);
  };
  ContinuousView.prototype._createHandle = function (visualMapModel, mainGroup, handleIndex, itemSize, textSize, orient) {
    var onDrift = bind$1(this._dragHandle, this, handleIndex, false);
    var onDragEnd = bind$1(this._dragHandle, this, handleIndex, true);
    var handleSize = parsePercent$1(visualMapModel.get('handleSize'), itemSize[0]);
    var handleThumb = createSymbol$1(visualMapModel.get('handleIcon'), -handleSize / 2, -handleSize / 2, handleSize, handleSize, null, true);
    var cursor = getCursor(this._orient);
    handleThumb.attr({
      cursor: cursor,
      draggable: true,
      drift: onDrift,
      ondragend: onDragEnd,
      onmousemove: function (e) {
        stop(e.event);
      }
    });
    handleThumb.x = itemSize[0] / 2;
    handleThumb.useStyle(visualMapModel.getModel('handleStyle').getItemStyle());
    handleThumb.setStyle({
      strokeNoScale: true,
      strokeFirst: true
    });
    handleThumb.style.lineWidth *= 2;
    handleThumb.ensureState('emphasis').style = visualMapModel.getModel(['emphasis', 'handleStyle']).getItemStyle();
    setAsHighDownDispatcher(handleThumb, true);
    mainGroup.add(handleThumb);
    // Text is always horizontal layout but should not be effected by
    // transform (orient/inverse). So label is built separately but not
    // use zrender/graphic/helper/RectText, and is located based on view
    // group (according to handleLabelPoint) but not barGroup.
    var textStyleModel = this.visualMapModel.textStyleModel;
    var handleLabel = new ZRText$1({
      cursor: cursor,
      draggable: true,
      drift: onDrift,
      onmousemove: function (e) {
        // For mobile device, prevent screen slider on the button.
        stop(e.event);
      },
      ondragend: onDragEnd,
      style: createTextStyle(textStyleModel, {
        x: 0,
        y: 0,
        text: ''
      })
    });
    handleLabel.ensureState('blur').style = {
      opacity: 0.1
    };
    handleLabel.stateTransition = {
      duration: 200
    };
    this.group.add(handleLabel);
    var handleLabelPoint = [handleSize, 0];
    var shapes = this._shapes;
    shapes.handleThumbs[handleIndex] = handleThumb;
    shapes.handleLabelPoints[handleIndex] = handleLabelPoint;
    shapes.handleLabels[handleIndex] = handleLabel;
  };
  ContinuousView.prototype._createIndicator = function (visualMapModel, mainGroup, itemSize, textSize, orient) {
    var scale = parsePercent$1(visualMapModel.get('indicatorSize'), itemSize[0]);
    var indicator = createSymbol$1(visualMapModel.get('indicatorIcon'), -scale / 2, -scale / 2, scale, scale, null, true);
    indicator.attr({
      cursor: 'move',
      invisible: true,
      silent: true,
      x: itemSize[0] / 2
    });
    var indicatorStyle = visualMapModel.getModel('indicatorStyle').getItemStyle();
    if (indicator instanceof ZRImage$1) {
      var pathStyle = indicator.style;
      indicator.useStyle(extend({
        // TODO other properties like x, y ?
        image: pathStyle.image,
        x: pathStyle.x,
        y: pathStyle.y,
        width: pathStyle.width,
        height: pathStyle.height
      }, indicatorStyle));
    } else {
      indicator.useStyle(indicatorStyle);
    }
    mainGroup.add(indicator);
    var textStyleModel = this.visualMapModel.textStyleModel;
    var indicatorLabel = new ZRText$1({
      silent: true,
      invisible: true,
      style: createTextStyle(textStyleModel, {
        x: 0,
        y: 0,
        text: ''
      })
    });
    this.group.add(indicatorLabel);
    var indicatorLabelPoint = [(orient === 'horizontal' ? textSize / 2 : HOVER_LINK_OUT) + itemSize[0] / 2, 0];
    var shapes = this._shapes;
    shapes.indicator = indicator;
    shapes.indicatorLabel = indicatorLabel;
    shapes.indicatorLabelPoint = indicatorLabelPoint;
    this._firstShowIndicator = true;
  };
  ContinuousView.prototype._dragHandle = function (handleIndex, isEnd,
  // dx is event from ondragend if isEnd is true. It's not used
  dx, dy) {
    if (!this._useHandle) {
      return;
    }
    this._dragging = !isEnd;
    if (!isEnd) {
      // Transform dx, dy to bar coordination.
      var vertex = this._applyTransform([dx, dy], this._shapes.mainGroup, true);
      this._updateInterval(handleIndex, vertex[1]);
      this._hideIndicator();
      // Considering realtime, update view should be executed
      // before dispatch action.
      this._updateView();
    }
    // dragEnd do not dispatch action when realtime.
    if (isEnd === !this.visualMapModel.get('realtime')) {
      // jshint ignore:line
      this.api.dispatchAction({
        type: 'selectDataRange',
        from: this.uid,
        visualMapId: this.visualMapModel.id,
        selected: this._dataInterval.slice()
      });
    }
    if (isEnd) {
      !this._hovering && this._clearHoverLinkToSeries();
    } else if (useHoverLinkOnHandle(this.visualMapModel)) {
      this._doHoverLinkToSeries(this._handleEnds[handleIndex], false);
    }
  };
  ContinuousView.prototype._resetInterval = function () {
    var visualMapModel = this.visualMapModel;
    var dataInterval = this._dataInterval = visualMapModel.getSelected();
    var dataExtent = visualMapModel.getExtent();
    var sizeExtent = [0, visualMapModel.itemSize[1]];
    this._handleEnds = [linearMap(dataInterval[0], dataExtent, sizeExtent, true), linearMap(dataInterval[1], dataExtent, sizeExtent, true)];
  };
  /**
   * @private
   * @param {(number|string)} handleIndex 0 or 1 or 'all'
   * @param {number} dx
   * @param {number} dy
   */
  ContinuousView.prototype._updateInterval = function (handleIndex, delta) {
    delta = delta || 0;
    var visualMapModel = this.visualMapModel;
    var handleEnds = this._handleEnds;
    var sizeExtent = [0, visualMapModel.itemSize[1]];
    sliderMove(delta, handleEnds, sizeExtent, handleIndex,
    // cross is forbidden
    0);
    var dataExtent = visualMapModel.getExtent();
    // Update data interval.
    this._dataInterval = [linearMap(handleEnds[0], sizeExtent, dataExtent, true), linearMap(handleEnds[1], sizeExtent, dataExtent, true)];
  };
  ContinuousView.prototype._updateView = function (forSketch) {
    var visualMapModel = this.visualMapModel;
    var dataExtent = visualMapModel.getExtent();
    var shapes = this._shapes;
    var outOfRangeHandleEnds = [0, visualMapModel.itemSize[1]];
    var inRangeHandleEnds = forSketch ? outOfRangeHandleEnds : this._handleEnds;
    var visualInRange = this._createBarVisual(this._dataInterval, dataExtent, inRangeHandleEnds, 'inRange');
    var visualOutOfRange = this._createBarVisual(dataExtent, dataExtent, outOfRangeHandleEnds, 'outOfRange');
    shapes.inRange.setStyle({
      fill: visualInRange.barColor
      // opacity: visualInRange.opacity
    }).setShape('points', visualInRange.barPoints);
    shapes.outOfRange.setStyle({
      fill: visualOutOfRange.barColor
      // opacity: visualOutOfRange.opacity
    }).setShape('points', visualOutOfRange.barPoints);
    this._updateHandle(inRangeHandleEnds, visualInRange);
  };
  ContinuousView.prototype._createBarVisual = function (dataInterval, dataExtent, handleEnds, forceState) {
    var opts = {
      forceState: forceState,
      convertOpacityToAlpha: true
    };
    var colorStops = this._makeColorGradient(dataInterval, opts);
    var symbolSizes = [this.getControllerVisual(dataInterval[0], 'symbolSize', opts), this.getControllerVisual(dataInterval[1], 'symbolSize', opts)];
    var barPoints = this._createBarPoints(handleEnds, symbolSizes);
    return {
      barColor: new LinearGradient$1(0, 0, 0, 1, colorStops),
      barPoints: barPoints,
      handlesColor: [colorStops[0].color, colorStops[colorStops.length - 1].color]
    };
  };
  ContinuousView.prototype._makeColorGradient = function (dataInterval, opts) {
    // Considering colorHue, which is not linear, so we have to sample
    // to calculate gradient color stops, but not only calculate head
    // and tail.
    var sampleNumber = 100; // Arbitrary value.
    var colorStops = [];
    var step = (dataInterval[1] - dataInterval[0]) / sampleNumber;
    colorStops.push({
      color: this.getControllerVisual(dataInterval[0], 'color', opts),
      offset: 0
    });
    for (var i = 1; i < sampleNumber; i++) {
      var currValue = dataInterval[0] + step * i;
      if (currValue > dataInterval[1]) {
        break;
      }
      colorStops.push({
        color: this.getControllerVisual(currValue, 'color', opts),
        offset: i / sampleNumber
      });
    }
    colorStops.push({
      color: this.getControllerVisual(dataInterval[1], 'color', opts),
      offset: 1
    });
    return colorStops;
  };
  ContinuousView.prototype._createBarPoints = function (handleEnds, symbolSizes) {
    var itemSize = this.visualMapModel.itemSize;
    return [[itemSize[0] - symbolSizes[0], handleEnds[0]], [itemSize[0], handleEnds[0]], [itemSize[0], handleEnds[1]], [itemSize[0] - symbolSizes[1], handleEnds[1]]];
  };
  ContinuousView.prototype._createBarGroup = function (itemAlign) {
    var orient = this._orient;
    var inverse = this.visualMapModel.get('inverse');
    return new Group$5(orient === 'horizontal' && !inverse ? {
      scaleX: itemAlign === 'bottom' ? 1 : -1,
      rotation: Math.PI / 2
    } : orient === 'horizontal' && inverse ? {
      scaleX: itemAlign === 'bottom' ? -1 : 1,
      rotation: -Math.PI / 2
    } : orient === 'vertical' && !inverse ? {
      scaleX: itemAlign === 'left' ? 1 : -1,
      scaleY: -1
    } : {
      scaleX: itemAlign === 'left' ? 1 : -1
    });
  };
  ContinuousView.prototype._updateHandle = function (handleEnds, visualInRange) {
    if (!this._useHandle) {
      return;
    }
    var shapes = this._shapes;
    var visualMapModel = this.visualMapModel;
    var handleThumbs = shapes.handleThumbs;
    var handleLabels = shapes.handleLabels;
    var itemSize = visualMapModel.itemSize;
    var dataExtent = visualMapModel.getExtent();
    var align = this._applyTransform('left', shapes.mainGroup);
    each$1([0, 1], function (handleIndex) {
      var handleThumb = handleThumbs[handleIndex];
      handleThumb.setStyle('fill', visualInRange.handlesColor[handleIndex]);
      handleThumb.y = handleEnds[handleIndex];
      var val = linearMap(handleEnds[handleIndex], [0, itemSize[1]], dataExtent, true);
      var symbolSize = this.getControllerVisual(val, 'symbolSize');
      handleThumb.scaleX = handleThumb.scaleY = symbolSize / itemSize[0];
      handleThumb.x = itemSize[0] - symbolSize / 2;
      // Update handle label position.
      var textPoint = applyTransform(shapes.handleLabelPoints[handleIndex], getTransform$1(handleThumb, this.group));
      if (this._orient === 'horizontal') {
        // If visualMap controls symbol size, an additional offset needs to be added to labels to avoid collision at minimum size.
        // Offset reaches value of 0 at "maximum" position, so maximum position is not altered at all.
        var minimumOffset = align === 'left' || align === 'top' ? (itemSize[0] - symbolSize) / 2 : (itemSize[0] - symbolSize) / -2;
        textPoint[1] += minimumOffset;
      }
      handleLabels[handleIndex].setStyle({
        x: textPoint[0],
        y: textPoint[1],
        text: visualMapModel.formatValueText(this._dataInterval[handleIndex]),
        verticalAlign: 'middle',
        align: this._orient === 'vertical' ? this._applyTransform('left', shapes.mainGroup) : 'center'
      });
    }, this);
  };
  ContinuousView.prototype._showIndicator = function (cursorValue, textValue, rangeSymbol, halfHoverLinkSize) {
    var visualMapModel = this.visualMapModel;
    var dataExtent = visualMapModel.getExtent();
    var itemSize = visualMapModel.itemSize;
    var sizeExtent = [0, itemSize[1]];
    var shapes = this._shapes;
    var indicator = shapes.indicator;
    if (!indicator) {
      return;
    }
    indicator.attr('invisible', false);
    var opts = {
      convertOpacityToAlpha: true
    };
    var color = this.getControllerVisual(cursorValue, 'color', opts);
    var symbolSize = this.getControllerVisual(cursorValue, 'symbolSize');
    var y = linearMap(cursorValue, dataExtent, sizeExtent, true);
    var x = itemSize[0] - symbolSize / 2;
    var oldIndicatorPos = {
      x: indicator.x,
      y: indicator.y
    };
    // Update handle label position.
    indicator.y = y;
    indicator.x = x;
    var textPoint = applyTransform(shapes.indicatorLabelPoint, getTransform$1(indicator, this.group));
    var indicatorLabel = shapes.indicatorLabel;
    indicatorLabel.attr('invisible', false);
    var align = this._applyTransform('left', shapes.mainGroup);
    var orient = this._orient;
    var isHorizontal = orient === 'horizontal';
    indicatorLabel.setStyle({
      text: (rangeSymbol ? rangeSymbol : '') + visualMapModel.formatValueText(textValue),
      verticalAlign: isHorizontal ? align : 'middle',
      align: isHorizontal ? 'center' : align
    });
    var indicatorNewProps = {
      x: x,
      y: y,
      style: {
        fill: color
      }
    };
    var labelNewProps = {
      style: {
        x: textPoint[0],
        y: textPoint[1]
      }
    };
    if (visualMapModel.ecModel.isAnimationEnabled() && !this._firstShowIndicator) {
      var animationCfg = {
        duration: 100,
        easing: 'cubicInOut',
        additive: true
      };
      indicator.x = oldIndicatorPos.x;
      indicator.y = oldIndicatorPos.y;
      indicator.animateTo(indicatorNewProps, animationCfg);
      indicatorLabel.animateTo(labelNewProps, animationCfg);
    } else {
      indicator.attr(indicatorNewProps);
      indicatorLabel.attr(labelNewProps);
    }
    this._firstShowIndicator = false;
    var handleLabels = this._shapes.handleLabels;
    if (handleLabels) {
      for (var i = 0; i < handleLabels.length; i++) {
        // Fade out handle labels.
        // NOTE: Must use api enter/leave on emphasis/blur/select state. Or the global states manager will change it.
        this.api.enterBlur(handleLabels[i]);
      }
    }
  };
  ContinuousView.prototype._enableHoverLinkToSeries = function () {
    var self = this;
    this._shapes.mainGroup.on('mousemove', function (e) {
      self._hovering = true;
      if (!self._dragging) {
        var itemSize = self.visualMapModel.itemSize;
        var pos = self._applyTransform([e.offsetX, e.offsetY], self._shapes.mainGroup, true, true);
        // For hover link show when hover handle, which might be
        // below or upper than sizeExtent.
        pos[1] = mathMin(mathMax(0, pos[1]), itemSize[1]);
        self._doHoverLinkToSeries(pos[1], 0 <= pos[0] && pos[0] <= itemSize[0]);
      }
    }).on('mouseout', function () {
      // When mouse is out of handle, hoverLink still need
      // to be displayed when realtime is set as false.
      self._hovering = false;
      !self._dragging && self._clearHoverLinkToSeries();
    });
  };
  ContinuousView.prototype._enableHoverLinkFromSeries = function () {
    var zr = this.api.getZr();
    if (this.visualMapModel.option.hoverLink) {
      zr.on('mouseover', this._hoverLinkFromSeriesMouseOver, this);
      zr.on('mouseout', this._hideIndicator, this);
    } else {
      this._clearHoverLinkFromSeries();
    }
  };
  ContinuousView.prototype._doHoverLinkToSeries = function (cursorPos, hoverOnBar) {
    var visualMapModel = this.visualMapModel;
    var itemSize = visualMapModel.itemSize;
    if (!visualMapModel.option.hoverLink) {
      return;
    }
    var sizeExtent = [0, itemSize[1]];
    var dataExtent = visualMapModel.getExtent();
    // For hover link show when hover handle, which might be below or upper than sizeExtent.
    cursorPos = mathMin(mathMax(sizeExtent[0], cursorPos), sizeExtent[1]);
    var halfHoverLinkSize = getHalfHoverLinkSize(visualMapModel, dataExtent, sizeExtent);
    var hoverRange = [cursorPos - halfHoverLinkSize, cursorPos + halfHoverLinkSize];
    var cursorValue = linearMap(cursorPos, sizeExtent, dataExtent, true);
    var valueRange = [linearMap(hoverRange[0], sizeExtent, dataExtent, true), linearMap(hoverRange[1], sizeExtent, dataExtent, true)];
    // Consider data range is out of visualMap range, see test/visualMap-continuous.html,
    // where china and india has very large population.
    hoverRange[0] < sizeExtent[0] && (valueRange[0] = -Infinity);
    hoverRange[1] > sizeExtent[1] && (valueRange[1] = Infinity);
    // Do not show indicator when mouse is over handle,
    // otherwise labels overlap, especially when dragging.
    if (hoverOnBar) {
      if (valueRange[0] === -Infinity) {
        this._showIndicator(cursorValue, valueRange[1], '< ', halfHoverLinkSize);
      } else if (valueRange[1] === Infinity) {
        this._showIndicator(cursorValue, valueRange[0], '> ', halfHoverLinkSize);
      } else {
        this._showIndicator(cursorValue, cursorValue, '≈ ', halfHoverLinkSize);
      }
    }
    // When realtime is set as false, handles, which are in barGroup,
    // also trigger hoverLink, which help user to realize where they
    // focus on when dragging. (see test/heatmap-large.html)
    // When realtime is set as true, highlight will not show when hover
    // handle, because the label on handle, which displays a exact value
    // but not range, might mislead users.
    var oldBatch = this._hoverLinkDataIndices;
    var newBatch = [];
    if (hoverOnBar || useHoverLinkOnHandle(visualMapModel)) {
      newBatch = this._hoverLinkDataIndices = visualMapModel.findTargetDataIndices(valueRange);
    }
    var resultBatches = compressBatches(oldBatch, newBatch);
    this._dispatchHighDown('downplay', makeHighDownBatch(resultBatches[0], visualMapModel));
    this._dispatchHighDown('highlight', makeHighDownBatch(resultBatches[1], visualMapModel));
  };
  ContinuousView.prototype._hoverLinkFromSeriesMouseOver = function (e) {
    var ecData;
    findEventDispatcher(e.target, function (target) {
      var currECData = getECData(target);
      if (currECData.dataIndex != null) {
        ecData = currECData;
        return true;
      }
    }, true);
    if (!ecData) {
      return;
    }
    var dataModel = this.ecModel.getSeriesByIndex(ecData.seriesIndex);
    var visualMapModel = this.visualMapModel;
    if (!visualMapModel.isTargetSeries(dataModel)) {
      return;
    }
    var data = dataModel.getData(ecData.dataType);
    var value = data.getStore().get(visualMapModel.getDataDimensionIndex(data), ecData.dataIndex);
    if (!isNaN(value)) {
      this._showIndicator(value, value);
    }
  };
  ContinuousView.prototype._hideIndicator = function () {
    var shapes = this._shapes;
    shapes.indicator && shapes.indicator.attr('invisible', true);
    shapes.indicatorLabel && shapes.indicatorLabel.attr('invisible', true);
    var handleLabels = this._shapes.handleLabels;
    if (handleLabels) {
      for (var i = 0; i < handleLabels.length; i++) {
        // Fade out handle labels.
        // NOTE: Must use api enter/leave on emphasis/blur/select state. Or the global states manager will change it.
        this.api.leaveBlur(handleLabels[i]);
      }
    }
  };
  ContinuousView.prototype._clearHoverLinkToSeries = function () {
    this._hideIndicator();
    var indices = this._hoverLinkDataIndices;
    this._dispatchHighDown('downplay', makeHighDownBatch(indices, this.visualMapModel));
    indices.length = 0;
  };
  ContinuousView.prototype._clearHoverLinkFromSeries = function () {
    this._hideIndicator();
    var zr = this.api.getZr();
    zr.off('mouseover', this._hoverLinkFromSeriesMouseOver);
    zr.off('mouseout', this._hideIndicator);
  };
  ContinuousView.prototype._applyTransform = function (vertex, element, inverse, global) {
    var transform = getTransform$1(element, global ? null : this.group);
    return isArray$1(vertex) ? applyTransform(vertex, transform, inverse) : transformDirection$1(vertex, transform, inverse);
  };
  // TODO: TYPE more specified payload types.
  ContinuousView.prototype._dispatchHighDown = function (type, batch) {
    batch && batch.length && this.api.dispatchAction({
      type: type,
      batch: batch
    });
  };
  /**
   * @override
   */
  ContinuousView.prototype.dispose = function () {
    this._clearHoverLinkFromSeries();
    this._clearHoverLinkToSeries();
  };
  ContinuousView.type = 'visualMap.continuous';
  return ContinuousView;
}(VisualMapView$1);
function createPolygon(points, cursor, onDrift, onDragEnd) {
  return new Polygon$1({
    shape: {
      points: points
    },
    draggable: !!onDrift,
    cursor: cursor,
    drift: onDrift,
    onmousemove: function (e) {
      // For mobile device, prevent screen slider on the button.
      stop(e.event);
    },
    ondragend: onDragEnd
  });
}
function getHalfHoverLinkSize(visualMapModel, dataExtent, sizeExtent) {
  var halfHoverLinkSize = HOVER_LINK_SIZE / 2;
  var hoverLinkDataSize = visualMapModel.get('hoverLinkDataSize');
  if (hoverLinkDataSize) {
    halfHoverLinkSize = linearMap(hoverLinkDataSize, dataExtent, sizeExtent, true) / 2;
  }
  return halfHoverLinkSize;
}
function useHoverLinkOnHandle(visualMapModel) {
  var hoverLinkOnHandle = visualMapModel.get('hoverLinkOnHandle');
  return !!(hoverLinkOnHandle == null ? visualMapModel.get('realtime') : hoverLinkOnHandle);
}
function getCursor(orient) {
  return orient === 'vertical' ? 'ns-resize' : 'ew-resize';
}
var ContinuousView$1 = ContinuousView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var visualMapActionInfo = {
  type: 'selectDataRange',
  event: 'dataRangeSelected',
  // FIXME use updateView appears wrong
  update: 'update'
};
var visualMapActionHander = function (payload, ecModel) {
  ecModel.eachComponent({
    mainType: 'visualMap',
    query: payload
  }, function (model) {
    model.setSelected(payload.selected);
  });
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var visualMapEncodingHandlers = [{
  createOnAllSeries: true,
  reset: function (seriesModel, ecModel) {
    var resetDefines = [];
    ecModel.eachComponent('visualMap', function (visualMapModel) {
      var pipelineContext = seriesModel.pipelineContext;
      if (!visualMapModel.isTargetSeries(seriesModel) || pipelineContext && pipelineContext.large) {
        return;
      }
      resetDefines.push(incrementalApplyVisual(visualMapModel.stateList, visualMapModel.targetVisuals, bind$1(visualMapModel.getValueState, visualMapModel), visualMapModel.getDataDimensionIndex(seriesModel.getData())));
    });
    return resetDefines;
  }
},
// Only support color.
{
  createOnAllSeries: true,
  reset: function (seriesModel, ecModel) {
    var data = seriesModel.getData();
    var visualMetaList = [];
    ecModel.eachComponent('visualMap', function (visualMapModel) {
      if (visualMapModel.isTargetSeries(seriesModel)) {
        var visualMeta = visualMapModel.getVisualMeta(bind$1(getColorVisual, null, seriesModel, visualMapModel)) || {
          stops: [],
          outerColors: []
        };
        var dimIdx = visualMapModel.getDataDimensionIndex(data);
        if (dimIdx >= 0) {
          // visualMeta.dimension should be dimension index, but not concrete dimension.
          visualMeta.dimension = dimIdx;
          visualMetaList.push(visualMeta);
        }
      }
    });
    // console.log(JSON.stringify(visualMetaList.map(a => a.stops)));
    seriesModel.getData().setVisual('visualMeta', visualMetaList);
  }
}];
// FIXME
// performance and export for heatmap?
// value can be Infinity or -Infinity
function getColorVisual(seriesModel, visualMapModel, value, valueState) {
  var mappings = visualMapModel.targetVisuals[valueState];
  var visualTypes = VisualMapping$1.prepareVisualTypes(mappings);
  var resultVisual = {
    color: getVisualFromData(seriesModel.getData(), 'color') // default color.
  };
  for (var i = 0, len = visualTypes.length; i < len; i++) {
    var type = visualTypes[i];
    var mapping = mappings[type === 'opacity' ? '__alphaForOpacity' : type];
    mapping && mapping.applyVisual(value, getVisual, setVisual);
  }
  return resultVisual.color;
  function getVisual(key) {
    return resultVisual[key];
  }
  function setVisual(key, value) {
    resultVisual[key] = value;
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var each = each$f;
function visualMapPreprocessor(option) {
  var visualMap = option && option.visualMap;
  if (!isArray$1(visualMap)) {
    visualMap = visualMap ? [visualMap] : [];
  }
  each(visualMap, function (opt) {
    if (!opt) {
      return;
    }
    // rename splitList to pieces
    if (has(opt, 'splitList') && !has(opt, 'pieces')) {
      opt.pieces = opt.splitList;
      delete opt.splitList;
    }
    var pieces = opt.pieces;
    if (pieces && isArray$1(pieces)) {
      each(pieces, function (piece) {
        if (isObject$3(piece)) {
          if (has(piece, 'start') && !has(piece, 'min')) {
            piece.min = piece.start;
          }
          if (has(piece, 'end') && !has(piece, 'max')) {
            piece.max = piece.end;
          }
        }
      });
    }
  });
}
function has(obj, name) {
  return obj && obj.hasOwnProperty && obj.hasOwnProperty(name);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var installed = false;
function installCommon(registers) {
  if (installed) {
    return;
  }
  installed = true;
  registers.registerSubTypeDefaulter('visualMap', function (option) {
    // Compatible with ec2, when splitNumber === 0, continuous visualMap will be used.
    return !option.categories && (!(option.pieces ? option.pieces.length > 0 : option.splitNumber > 0) || option.calculable) ? 'continuous' : 'piecewise';
  });
  registers.registerAction(visualMapActionInfo, visualMapActionHander);
  each$f(visualMapEncodingHandlers, function (handler) {
    registers.registerVisual(registers.PRIORITY.VISUAL.COMPONENT, handler);
  });
  registers.registerPreprocessor(visualMapPreprocessor);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$7(registers) {
  registers.registerComponentModel(ContinuousModel$1);
  registers.registerComponentView(ContinuousView$1);
  installCommon(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PiecewiseModel = /** @class */function (_super) {
  __extends(PiecewiseModel, _super);
  function PiecewiseModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = PiecewiseModel.type;
    /**
     * The order is always [low, ..., high].
     * [{text: string, interval: Array.<number>}, ...]
     */
    _this._pieceList = [];
    return _this;
  }
  PiecewiseModel.prototype.optionUpdated = function (newOption, isInit) {
    _super.prototype.optionUpdated.apply(this, arguments);
    this.resetExtent();
    var mode = this._mode = this._determineMode();
    this._pieceList = [];
    resetMethods[this._mode].call(this, this._pieceList);
    this._resetSelected(newOption, isInit);
    var categories = this.option.categories;
    this.resetVisual(function (mappingOption, state) {
      if (mode === 'categories') {
        mappingOption.mappingMethod = 'category';
        mappingOption.categories = clone$4(categories);
      } else {
        mappingOption.dataExtent = this.getExtent();
        mappingOption.mappingMethod = 'piecewise';
        mappingOption.pieceList = map$1(this._pieceList, function (piece) {
          piece = clone$4(piece);
          if (state !== 'inRange') {
            // FIXME
            // outOfRange do not support special visual in pieces.
            piece.visual = null;
          }
          return piece;
        });
      }
    });
  };
  /**
   * @protected
   * @override
   */
  PiecewiseModel.prototype.completeVisualOption = function () {
    // Consider this case:
    // visualMap: {
    //      pieces: [{symbol: 'circle', lt: 0}, {symbol: 'rect', gte: 0}]
    // }
    // where no inRange/outOfRange set but only pieces. So we should make
    // default inRange/outOfRange for this case, otherwise visuals that only
    // appear in `pieces` will not be taken into account in visual encoding.
    var option = this.option;
    var visualTypesInPieces = {};
    var visualTypes = VisualMapping$1.listVisualTypes();
    var isCategory = this.isCategory();
    each$f(option.pieces, function (piece) {
      each$f(visualTypes, function (visualType) {
        if (piece.hasOwnProperty(visualType)) {
          visualTypesInPieces[visualType] = 1;
        }
      });
    });
    each$f(visualTypesInPieces, function (v, visualType) {
      var exists = false;
      each$f(this.stateList, function (state) {
        exists = exists || has(option, state, visualType) || has(option.target, state, visualType);
      }, this);
      !exists && each$f(this.stateList, function (state) {
        (option[state] || (option[state] = {}))[visualType] = visualDefault$1.get(visualType, state === 'inRange' ? 'active' : 'inactive', isCategory);
      });
    }, this);
    function has(obj, state, visualType) {
      return obj && obj[state] && obj[state].hasOwnProperty(visualType);
    }
    _super.prototype.completeVisualOption.apply(this, arguments);
  };
  PiecewiseModel.prototype._resetSelected = function (newOption, isInit) {
    var thisOption = this.option;
    var pieceList = this._pieceList;
    // Selected do not merge but all override.
    var selected = (isInit ? thisOption : newOption).selected || {};
    thisOption.selected = selected;
    // Consider 'not specified' means true.
    each$f(pieceList, function (piece, index) {
      var key = this.getSelectedMapKey(piece);
      if (!selected.hasOwnProperty(key)) {
        selected[key] = true;
      }
    }, this);
    if (thisOption.selectedMode === 'single') {
      // Ensure there is only one selected.
      var hasSel_1 = false;
      each$f(pieceList, function (piece, index) {
        var key = this.getSelectedMapKey(piece);
        if (selected[key]) {
          hasSel_1 ? selected[key] = false : hasSel_1 = true;
        }
      }, this);
    }
    // thisOption.selectedMode === 'multiple', default: all selected.
  };
  /**
   * @public
   */
  PiecewiseModel.prototype.getItemSymbol = function () {
    return this.get('itemSymbol');
  };
  /**
   * @public
   */
  PiecewiseModel.prototype.getSelectedMapKey = function (piece) {
    return this._mode === 'categories' ? piece.value + '' : piece.index + '';
  };
  /**
   * @public
   */
  PiecewiseModel.prototype.getPieceList = function () {
    return this._pieceList;
  };
  /**
   * @return {string}
   */
  PiecewiseModel.prototype._determineMode = function () {
    var option = this.option;
    return option.pieces && option.pieces.length > 0 ? 'pieces' : this.option.categories ? 'categories' : 'splitNumber';
  };
  /**
   * @override
   */
  PiecewiseModel.prototype.setSelected = function (selected) {
    this.option.selected = clone$4(selected);
  };
  /**
   * @override
   */
  PiecewiseModel.prototype.getValueState = function (value) {
    var index = VisualMapping$1.findPieceIndex(value, this._pieceList);
    return index != null ? this.option.selected[this.getSelectedMapKey(this._pieceList[index])] ? 'inRange' : 'outOfRange' : 'outOfRange';
  };
  /**
   * @public
   * @param pieceIndex piece index in visualMapModel.getPieceList()
   */
  PiecewiseModel.prototype.findTargetDataIndices = function (pieceIndex) {
    var result = [];
    var pieceList = this._pieceList;
    this.eachTargetSeries(function (seriesModel) {
      var dataIndices = [];
      var data = seriesModel.getData();
      data.each(this.getDataDimensionIndex(data), function (value, dataIndex) {
        // Should always base on model pieceList, because it is order sensitive.
        var pIdx = VisualMapping$1.findPieceIndex(value, pieceList);
        pIdx === pieceIndex && dataIndices.push(dataIndex);
      }, this);
      result.push({
        seriesId: seriesModel.id,
        dataIndex: dataIndices
      });
    }, this);
    return result;
  };
  /**
   * @private
   * @param piece piece.value or piece.interval is required.
   * @return  Can be Infinity or -Infinity
   */
  PiecewiseModel.prototype.getRepresentValue = function (piece) {
    var representValue;
    if (this.isCategory()) {
      representValue = piece.value;
    } else {
      if (piece.value != null) {
        representValue = piece.value;
      } else {
        var pieceInterval = piece.interval || [];
        representValue = pieceInterval[0] === -Infinity && pieceInterval[1] === Infinity ? 0 : (pieceInterval[0] + pieceInterval[1]) / 2;
      }
    }
    return representValue;
  };
  PiecewiseModel.prototype.getVisualMeta = function (getColorVisual) {
    // Do not support category. (category axis is ordinal, numerical)
    if (this.isCategory()) {
      return;
    }
    var stops = [];
    var outerColors = ['', ''];
    var visualMapModel = this;
    function setStop(interval, valueState) {
      var representValue = visualMapModel.getRepresentValue({
        interval: interval
      }); // Not category
      if (!valueState) {
        valueState = visualMapModel.getValueState(representValue);
      }
      var color = getColorVisual(representValue, valueState);
      if (interval[0] === -Infinity) {
        outerColors[0] = color;
      } else if (interval[1] === Infinity) {
        outerColors[1] = color;
      } else {
        stops.push({
          value: interval[0],
          color: color
        }, {
          value: interval[1],
          color: color
        });
      }
    }
    // Suplement
    var pieceList = this._pieceList.slice();
    if (!pieceList.length) {
      pieceList.push({
        interval: [-Infinity, Infinity]
      });
    } else {
      var edge = pieceList[0].interval[0];
      edge !== -Infinity && pieceList.unshift({
        interval: [-Infinity, edge]
      });
      edge = pieceList[pieceList.length - 1].interval[1];
      edge !== Infinity && pieceList.push({
        interval: [edge, Infinity]
      });
    }
    var curr = -Infinity;
    each$f(pieceList, function (piece) {
      var interval = piece.interval;
      if (interval) {
        // Fulfill gap.
        interval[0] > curr && setStop([curr, interval[0]], 'outOfRange');
        setStop(interval.slice());
        curr = interval[1];
      }
    }, this);
    return {
      stops: stops,
      outerColors: outerColors
    };
  };
  PiecewiseModel.type = 'visualMap.piecewise';
  PiecewiseModel.defaultOption = inheritDefaultOption(VisualMapModel$1.defaultOption, {
    selected: null,
    minOpen: false,
    maxOpen: false,
    align: 'auto',
    itemWidth: 20,
    itemHeight: 14,
    itemSymbol: 'roundRect',
    pieces: null,
    categories: null,
    splitNumber: 5,
    selectedMode: 'multiple',
    itemGap: 10,
    hoverLink: true // Enable hover highlight.
  });
  return PiecewiseModel;
}(VisualMapModel$1);
/**
 * Key is this._mode
 * @type {Object}
 * @this {module:echarts/component/viusalMap/PiecewiseMode}
 */
var resetMethods = {
  splitNumber: function (outPieceList) {
    var thisOption = this.option;
    var precision = Math.min(thisOption.precision, 20);
    var dataExtent = this.getExtent();
    var splitNumber = thisOption.splitNumber;
    splitNumber = Math.max(parseInt(splitNumber, 10), 1);
    thisOption.splitNumber = splitNumber;
    var splitStep = (dataExtent[1] - dataExtent[0]) / splitNumber;
    // Precision auto-adaption
    while (+splitStep.toFixed(precision) !== splitStep && precision < 5) {
      precision++;
    }
    thisOption.precision = precision;
    splitStep = +splitStep.toFixed(precision);
    if (thisOption.minOpen) {
      outPieceList.push({
        interval: [-Infinity, dataExtent[0]],
        close: [0, 0]
      });
    }
    for (var index = 0, curr = dataExtent[0]; index < splitNumber; curr += splitStep, index++) {
      var max = index === splitNumber - 1 ? dataExtent[1] : curr + splitStep;
      outPieceList.push({
        interval: [curr, max],
        close: [1, 1]
      });
    }
    if (thisOption.maxOpen) {
      outPieceList.push({
        interval: [dataExtent[1], Infinity],
        close: [0, 0]
      });
    }
    reformIntervals(outPieceList);
    each$f(outPieceList, function (piece, index) {
      piece.index = index;
      piece.text = this.formatValueText(piece.interval);
    }, this);
  },
  categories: function (outPieceList) {
    var thisOption = this.option;
    each$f(thisOption.categories, function (cate) {
      // FIXME category模式也使用pieceList，但在visualMapping中不是使用pieceList。
      // 是否改一致。
      outPieceList.push({
        text: this.formatValueText(cate, true),
        value: cate
      });
    }, this);
    // See "Order Rule".
    normalizeReverse(thisOption, outPieceList);
  },
  pieces: function (outPieceList) {
    var thisOption = this.option;
    each$f(thisOption.pieces, function (pieceListItem, index) {
      if (!isObject$3(pieceListItem)) {
        pieceListItem = {
          value: pieceListItem
        };
      }
      var item = {
        text: '',
        index: index
      };
      if (pieceListItem.label != null) {
        item.text = pieceListItem.label;
      }
      if (pieceListItem.hasOwnProperty('value')) {
        var value = item.value = pieceListItem.value;
        item.interval = [value, value];
        item.close = [1, 1];
      } else {
        // `min` `max` is legacy option.
        // `lt` `gt` `lte` `gte` is recommended.
        var interval = item.interval = [];
        var close_1 = item.close = [0, 0];
        var closeList = [1, 0, 1];
        var infinityList = [-Infinity, Infinity];
        var useMinMax = [];
        for (var lg = 0; lg < 2; lg++) {
          var names = [['gte', 'gt', 'min'], ['lte', 'lt', 'max']][lg];
          for (var i = 0; i < 3 && interval[lg] == null; i++) {
            interval[lg] = pieceListItem[names[i]];
            close_1[lg] = closeList[i];
            useMinMax[lg] = i === 2;
          }
          interval[lg] == null && (interval[lg] = infinityList[lg]);
        }
        useMinMax[0] && interval[1] === Infinity && (close_1[0] = 0);
        useMinMax[1] && interval[0] === -Infinity && (close_1[1] = 0);
        {
          if (interval[0] > interval[1]) {
            console.warn('Piece ' + index + 'is illegal: ' + interval + ' lower bound should not greater then uppper bound.');
          }
        }
        if (interval[0] === interval[1] && close_1[0] && close_1[1]) {
          // Consider: [{min: 5, max: 5, visual: {...}}, {min: 0, max: 5}],
          // we use value to lift the priority when min === max
          item.value = interval[0];
        }
      }
      item.visual = VisualMapping$1.retrieveVisuals(pieceListItem);
      outPieceList.push(item);
    }, this);
    // See "Order Rule".
    normalizeReverse(thisOption, outPieceList);
    // Only pieces
    reformIntervals(outPieceList);
    each$f(outPieceList, function (piece) {
      var close = piece.close;
      var edgeSymbols = [['<', '≤'][close[1]], ['>', '≥'][close[0]]];
      piece.text = piece.text || this.formatValueText(piece.value != null ? piece.value : piece.interval, false, edgeSymbols);
    }, this);
  }
};
function normalizeReverse(thisOption, pieceList) {
  var inverse = thisOption.inverse;
  if (thisOption.orient === 'vertical' ? !inverse : inverse) {
    pieceList.reverse();
  }
}
var PiecewiseModel$1 = PiecewiseModel;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var PiecewiseVisualMapView = /** @class */function (_super) {
  __extends(PiecewiseVisualMapView, _super);
  function PiecewiseVisualMapView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = PiecewiseVisualMapView.type;
    return _this;
  }
  PiecewiseVisualMapView.prototype.doRender = function () {
    var thisGroup = this.group;
    thisGroup.removeAll();
    var visualMapModel = this.visualMapModel;
    var textGap = visualMapModel.get('textGap');
    var textStyleModel = visualMapModel.textStyleModel;
    var textFont = textStyleModel.getFont();
    var textFill = textStyleModel.getTextColor();
    var itemAlign = this._getItemAlign();
    var itemSize = visualMapModel.itemSize;
    var viewData = this._getViewData();
    var endsText = viewData.endsText;
    var showLabel = retrieve(visualMapModel.get('showLabel', true), !endsText);
    var silent = !visualMapModel.get('selectedMode');
    endsText && this._renderEndsText(thisGroup, endsText[0], itemSize, showLabel, itemAlign);
    each$f(viewData.viewPieceList, function (item) {
      var piece = item.piece;
      var itemGroup = new Group$5();
      itemGroup.onclick = bind$1(this._onItemClick, this, piece);
      this._enableHoverLink(itemGroup, item.indexInModelPieceList);
      // TODO Category
      var representValue = visualMapModel.getRepresentValue(piece);
      this._createItemSymbol(itemGroup, representValue, [0, 0, itemSize[0], itemSize[1]], silent);
      if (showLabel) {
        var visualState = this.visualMapModel.getValueState(representValue);
        itemGroup.add(new ZRText$1({
          style: {
            x: itemAlign === 'right' ? -textGap : itemSize[0] + textGap,
            y: itemSize[1] / 2,
            text: piece.text,
            verticalAlign: 'middle',
            align: itemAlign,
            font: textFont,
            fill: textFill,
            opacity: visualState === 'outOfRange' ? 0.5 : 1
          },
          silent: silent
        }));
      }
      thisGroup.add(itemGroup);
    }, this);
    endsText && this._renderEndsText(thisGroup, endsText[1], itemSize, showLabel, itemAlign);
    box(visualMapModel.get('orient'), thisGroup, visualMapModel.get('itemGap'));
    this.renderBackground(thisGroup);
    this.positionGroup(thisGroup);
  };
  PiecewiseVisualMapView.prototype._enableHoverLink = function (itemGroup, pieceIndex) {
    var _this = this;
    itemGroup.on('mouseover', function () {
      return onHoverLink('highlight');
    }).on('mouseout', function () {
      return onHoverLink('downplay');
    });
    var onHoverLink = function (method) {
      var visualMapModel = _this.visualMapModel;
      // TODO: TYPE More detailed action types
      visualMapModel.option.hoverLink && _this.api.dispatchAction({
        type: method,
        batch: makeHighDownBatch(visualMapModel.findTargetDataIndices(pieceIndex), visualMapModel)
      });
    };
  };
  PiecewiseVisualMapView.prototype._getItemAlign = function () {
    var visualMapModel = this.visualMapModel;
    var modelOption = visualMapModel.option;
    if (modelOption.orient === 'vertical') {
      return getItemAlign(visualMapModel, this.api, visualMapModel.itemSize);
    } else {
      // horizontal, most case left unless specifying right.
      var align = modelOption.align;
      if (!align || align === 'auto') {
        align = 'left';
      }
      return align;
    }
  };
  PiecewiseVisualMapView.prototype._renderEndsText = function (group, text, itemSize, showLabel, itemAlign) {
    if (!text) {
      return;
    }
    var itemGroup = new Group$5();
    var textStyleModel = this.visualMapModel.textStyleModel;
    itemGroup.add(new ZRText$1({
      style: createTextStyle(textStyleModel, {
        x: showLabel ? itemAlign === 'right' ? itemSize[0] : 0 : itemSize[0] / 2,
        y: itemSize[1] / 2,
        verticalAlign: 'middle',
        align: showLabel ? itemAlign : 'center',
        text: text
      })
    }));
    group.add(itemGroup);
  };
  /**
   * @private
   * @return {Object} {peiceList, endsText} The order is the same as screen pixel order.
   */
  PiecewiseVisualMapView.prototype._getViewData = function () {
    var visualMapModel = this.visualMapModel;
    var viewPieceList = map$1(visualMapModel.getPieceList(), function (piece, index) {
      return {
        piece: piece,
        indexInModelPieceList: index
      };
    });
    var endsText = visualMapModel.get('text');
    // Consider orient and inverse.
    var orient = visualMapModel.get('orient');
    var inverse = visualMapModel.get('inverse');
    // Order of model pieceList is always [low, ..., high]
    if (orient === 'horizontal' ? inverse : !inverse) {
      viewPieceList.reverse();
    }
    // Origin order of endsText is [high, low]
    else if (endsText) {
      endsText = endsText.slice().reverse();
    }
    return {
      viewPieceList: viewPieceList,
      endsText: endsText
    };
  };
  PiecewiseVisualMapView.prototype._createItemSymbol = function (group, representValue, shapeParam, silent) {
    var itemSymbol = createSymbol$1(
    // symbol will be string
    this.getControllerVisual(representValue, 'symbol'), shapeParam[0], shapeParam[1], shapeParam[2], shapeParam[3],
    // color will be string
    this.getControllerVisual(representValue, 'color'));
    itemSymbol.silent = silent;
    group.add(itemSymbol);
  };
  PiecewiseVisualMapView.prototype._onItemClick = function (piece) {
    var visualMapModel = this.visualMapModel;
    var option = visualMapModel.option;
    var selectedMode = option.selectedMode;
    if (!selectedMode) {
      return;
    }
    var selected = clone$4(option.selected);
    var newKey = visualMapModel.getSelectedMapKey(piece);
    if (selectedMode === 'single' || selectedMode === true) {
      selected[newKey] = true;
      each$f(selected, function (o, key) {
        selected[key] = key === newKey;
      });
    } else {
      selected[newKey] = !selected[newKey];
    }
    this.api.dispatchAction({
      type: 'selectDataRange',
      from: this.uid,
      visualMapId: this.visualMapModel.id,
      selected: selected
    });
  };
  PiecewiseVisualMapView.type = 'visualMap.piecewise';
  return PiecewiseVisualMapView;
}(VisualMapView$1);
var PiecewiseView = PiecewiseVisualMapView;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$6(registers) {
  registers.registerComponentModel(PiecewiseModel$1);
  registers.registerComponentView(PiecewiseView);
  installCommon(registers);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$5(registers) {
  use(install$7);
  use(install$6);
  // Do not install './dataZoomSelect',
  // since it only work for toolbox dataZoom.
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DEFAULT_OPTION = {
  label: {
    enabled: true
  },
  decal: {
    show: false
  }
};
var inner = makeInner();
var decalPaletteScope = {};
function ariaVisual(ecModel, api) {
  var ariaModel = ecModel.getModel('aria');
  // See "area enabled" detection code in `GlobalModel.ts`.
  if (!ariaModel.get('enabled')) {
    return;
  }
  var defaultOption = clone$4(DEFAULT_OPTION);
  merge(defaultOption.label, ecModel.getLocaleModel().get('aria'), false);
  merge(ariaModel.option, defaultOption, false);
  setDecal();
  setLabel();
  function setDecal() {
    var decalModel = ariaModel.getModel('decal');
    var useDecal = decalModel.get('show');
    if (useDecal) {
      // Each type of series use one scope.
      // Pie and funnel are using different scopes.
      var paletteScopeGroupByType_1 = createHashMap();
      ecModel.eachSeries(function (seriesModel) {
        if (seriesModel.isColorBySeries()) {
          return;
        }
        var decalScope = paletteScopeGroupByType_1.get(seriesModel.type);
        if (!decalScope) {
          decalScope = {};
          paletteScopeGroupByType_1.set(seriesModel.type, decalScope);
        }
        inner(seriesModel).scope = decalScope;
      });
      ecModel.eachRawSeries(function (seriesModel) {
        if (ecModel.isSeriesFiltered(seriesModel)) {
          return;
        }
        if (isFunction(seriesModel.enableAriaDecal)) {
          // Let series define how to use decal palette on data
          seriesModel.enableAriaDecal();
          return;
        }
        var data = seriesModel.getData();
        if (!seriesModel.isColorBySeries()) {
          var dataAll_1 = seriesModel.getRawData();
          var idxMap_1 = {};
          var decalScope_1 = inner(seriesModel).scope;
          data.each(function (idx) {
            var rawIdx = data.getRawIndex(idx);
            idxMap_1[rawIdx] = idx;
          });
          var dataCount_1 = dataAll_1.count();
          dataAll_1.each(function (rawIdx) {
            var idx = idxMap_1[rawIdx];
            var name = dataAll_1.getName(rawIdx) || rawIdx + '';
            var paletteDecal = getDecalFromPalette(seriesModel.ecModel, name, decalScope_1, dataCount_1);
            var specifiedDecal = data.getItemVisual(idx, 'decal');
            data.setItemVisual(idx, 'decal', mergeDecal(specifiedDecal, paletteDecal));
          });
        } else {
          var paletteDecal = getDecalFromPalette(seriesModel.ecModel, seriesModel.name, decalPaletteScope, ecModel.getSeriesCount());
          var specifiedDecal = data.getVisual('decal');
          data.setVisual('decal', mergeDecal(specifiedDecal, paletteDecal));
        }
        function mergeDecal(specifiedDecal, paletteDecal) {
          // Merge decal from palette to decal from itemStyle.
          // User do not need to specify all of the decal props.
          var resultDecal = specifiedDecal ? extend(extend({}, paletteDecal), specifiedDecal) : paletteDecal;
          resultDecal.dirty = true;
          return resultDecal;
        }
      });
    }
  }
  function setLabel() {
    var dom = api.getZr().dom;
    // TODO: support for SSR
    if (!dom) {
      return;
    }
    var labelLocale = ecModel.getLocaleModel().get('aria');
    var labelModel = ariaModel.getModel('label');
    labelModel.option = defaults(labelModel.option, labelLocale);
    if (!labelModel.get('enabled')) {
      return;
    }
    dom.setAttribute('role', 'img');
    if (labelModel.get('description')) {
      dom.setAttribute('aria-label', labelModel.get('description'));
      return;
    }
    var seriesCnt = ecModel.getSeriesCount();
    var maxDataCnt = labelModel.get(['data', 'maxCount']) || 10;
    var maxSeriesCnt = labelModel.get(['series', 'maxCount']) || 10;
    var displaySeriesCnt = Math.min(seriesCnt, maxSeriesCnt);
    var ariaLabel;
    if (seriesCnt < 1) {
      // No series, no aria label
      return;
    } else {
      var title = getTitle();
      if (title) {
        var withTitle = labelModel.get(['general', 'withTitle']);
        ariaLabel = replace(withTitle, {
          title: title
        });
      } else {
        ariaLabel = labelModel.get(['general', 'withoutTitle']);
      }
      var seriesLabels_1 = [];
      var prefix = seriesCnt > 1 ? labelModel.get(['series', 'multiple', 'prefix']) : labelModel.get(['series', 'single', 'prefix']);
      ariaLabel += replace(prefix, {
        seriesCount: seriesCnt
      });
      ecModel.eachSeries(function (seriesModel, idx) {
        if (idx < displaySeriesCnt) {
          var seriesLabel = void 0;
          var seriesName = seriesModel.get('name');
          var withName = seriesName ? 'withName' : 'withoutName';
          seriesLabel = seriesCnt > 1 ? labelModel.get(['series', 'multiple', withName]) : labelModel.get(['series', 'single', withName]);
          seriesLabel = replace(seriesLabel, {
            seriesId: seriesModel.seriesIndex,
            seriesName: seriesModel.get('name'),
            seriesType: getSeriesTypeName(seriesModel.subType)
          });
          var data = seriesModel.getData();
          if (data.count() > maxDataCnt) {
            // Show part of data
            var partialLabel = labelModel.get(['data', 'partialData']);
            seriesLabel += replace(partialLabel, {
              displayCnt: maxDataCnt
            });
          } else {
            seriesLabel += labelModel.get(['data', 'allData']);
          }
          var middleSeparator_1 = labelModel.get(['data', 'separator', 'middle']);
          var endSeparator_1 = labelModel.get(['data', 'separator', 'end']);
          var excludeDimensionId_1 = labelModel.get(['data', 'excludeDimensionId']);
          var dataLabels = [];
          for (var i = 0; i < data.count(); i++) {
            if (i < maxDataCnt) {
              var name_1 = data.getName(i);
              var value = !excludeDimensionId_1 ? data.getValues(i) : filter(data.getValues(i), function (v, j) {
                return indexOf(excludeDimensionId_1, j) === -1;
              });
              var dataLabel = labelModel.get(['data', name_1 ? 'withName' : 'withoutName']);
              dataLabels.push(replace(dataLabel, {
                name: name_1,
                value: value.join(middleSeparator_1)
              }));
            }
          }
          seriesLabel += dataLabels.join(middleSeparator_1) + endSeparator_1;
          seriesLabels_1.push(seriesLabel);
        }
      });
      var separatorModel = labelModel.getModel(['series', 'multiple', 'separator']);
      var middleSeparator = separatorModel.get('middle');
      var endSeparator = separatorModel.get('end');
      ariaLabel += seriesLabels_1.join(middleSeparator) + endSeparator;
      dom.setAttribute('aria-label', ariaLabel);
    }
  }
  function replace(str, keyValues) {
    if (!isString(str)) {
      return str;
    }
    var result = str;
    each$f(keyValues, function (value, key) {
      result = result.replace(new RegExp('\\{\\s*' + key + '\\s*\\}', 'g'), value);
    });
    return result;
  }
  function getTitle() {
    var title = ecModel.get('title');
    if (title && title.length) {
      title = title[0];
    }
    return title && title.text;
  }
  function getSeriesTypeName(type) {
    var typeNames = ecModel.getLocaleModel().get(['series', 'typeNames']);
    return typeNames[type] || typeNames.chart;
  }
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function ariaPreprocessor(option) {
  if (!option || !option.aria) {
    return;
  }
  var aria = option.aria;
  // aria.show is deprecated and should use aria.enabled instead
  if (aria.show != null) {
    aria.enabled = aria.show;
  }
  aria.label = aria.label || {};
  // move description, general, series, data to be under aria.label
  each$f(['description', 'general', 'series', 'data'], function (name) {
    if (aria[name] != null) {
      aria.label[name] = aria[name];
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$4(registers) {
  registers.registerPreprocessor(ariaPreprocessor);
  registers.registerVisual(registers.PRIORITY.VISUAL.ARIA, ariaVisual);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var RELATIONAL_EXPRESSION_OP_ALIAS_MAP = {
  value: 'eq',
  // PENDING: not good for literal semantic?
  '<': 'lt',
  '<=': 'lte',
  '>': 'gt',
  '>=': 'gte',
  '=': 'eq',
  '!=': 'ne',
  '<>': 'ne'
  // Might be misleading for sake of the difference between '==' and '===',
  // so don't support them.
  // '==': 'eq',
  // '===': 'seq',
  // '!==': 'sne'
  // PENDING: Whether support some common alias "ge", "le", "neq"?
  // ge: 'gte',
  // le: 'lte',
  // neq: 'ne',
};
// type RelationalExpressionOpEvaluate = (tarVal: unknown, condVal: unknown) => boolean;
var RegExpEvaluator = /** @class */function () {
  function RegExpEvaluator(rVal) {
    // Support condVal: RegExp | string
    var condValue = this._condVal = isString(rVal) ? new RegExp(rVal) : isRegExp(rVal) ? rVal : null;
    if (condValue == null) {
      var errMsg = '';
      {
        errMsg = makePrintable('Illegal regexp', rVal, 'in');
      }
      throwError(errMsg);
    }
  }
  RegExpEvaluator.prototype.evaluate = function (lVal) {
    var type = typeof lVal;
    return isString(type) ? this._condVal.test(lVal) : isNumber(type) ? this._condVal.test(lVal + '') : false;
  };
  return RegExpEvaluator;
}();
var ConstConditionInternal = /** @class */function () {
  function ConstConditionInternal() {}
  ConstConditionInternal.prototype.evaluate = function () {
    return this.value;
  };
  return ConstConditionInternal;
}();
var AndConditionInternal = /** @class */function () {
  function AndConditionInternal() {}
  AndConditionInternal.prototype.evaluate = function () {
    var children = this.children;
    for (var i = 0; i < children.length; i++) {
      if (!children[i].evaluate()) {
        return false;
      }
    }
    return true;
  };
  return AndConditionInternal;
}();
var OrConditionInternal = /** @class */function () {
  function OrConditionInternal() {}
  OrConditionInternal.prototype.evaluate = function () {
    var children = this.children;
    for (var i = 0; i < children.length; i++) {
      if (children[i].evaluate()) {
        return true;
      }
    }
    return false;
  };
  return OrConditionInternal;
}();
var NotConditionInternal = /** @class */function () {
  function NotConditionInternal() {}
  NotConditionInternal.prototype.evaluate = function () {
    return !this.child.evaluate();
  };
  return NotConditionInternal;
}();
var RelationalConditionInternal = /** @class */function () {
  function RelationalConditionInternal() {}
  RelationalConditionInternal.prototype.evaluate = function () {
    var needParse = !!this.valueParser;
    // Call getValue with no `this`.
    var getValue = this.getValue;
    var tarValRaw = getValue(this.valueGetterParam);
    var tarValParsed = needParse ? this.valueParser(tarValRaw) : null;
    // Relational cond follow "and" logic internally.
    for (var i = 0; i < this.subCondList.length; i++) {
      if (!this.subCondList[i].evaluate(needParse ? tarValParsed : tarValRaw)) {
        return false;
      }
    }
    return true;
  };
  return RelationalConditionInternal;
}();
function parseOption(exprOption, getters) {
  if (exprOption === true || exprOption === false) {
    var cond = new ConstConditionInternal();
    cond.value = exprOption;
    return cond;
  }
  var errMsg = '';
  if (!isObjectNotArray(exprOption)) {
    {
      errMsg = makePrintable('Illegal config. Expect a plain object but actually', exprOption);
    }
    throwError(errMsg);
  }
  if (exprOption.and) {
    return parseAndOrOption('and', exprOption, getters);
  } else if (exprOption.or) {
    return parseAndOrOption('or', exprOption, getters);
  } else if (exprOption.not) {
    return parseNotOption(exprOption, getters);
  }
  return parseRelationalOption(exprOption, getters);
}
function parseAndOrOption(op, exprOption, getters) {
  var subOptionArr = exprOption[op];
  var errMsg = '';
  {
    errMsg = makePrintable('"and"/"or" condition should only be `' + op + ': [...]` and must not be empty array.', 'Illegal condition:', exprOption);
  }
  if (!isArray$1(subOptionArr)) {
    throwError(errMsg);
  }
  if (!subOptionArr.length) {
    throwError(errMsg);
  }
  var cond = op === 'and' ? new AndConditionInternal() : new OrConditionInternal();
  cond.children = map$1(subOptionArr, function (subOption) {
    return parseOption(subOption, getters);
  });
  if (!cond.children.length) {
    throwError(errMsg);
  }
  return cond;
}
function parseNotOption(exprOption, getters) {
  var subOption = exprOption.not;
  var errMsg = '';
  {
    errMsg = makePrintable('"not" condition should only be `not: {}`.', 'Illegal condition:', exprOption);
  }
  if (!isObjectNotArray(subOption)) {
    throwError(errMsg);
  }
  var cond = new NotConditionInternal();
  cond.child = parseOption(subOption, getters);
  if (!cond.child) {
    throwError(errMsg);
  }
  return cond;
}
function parseRelationalOption(exprOption, getters) {
  var errMsg = '';
  var valueGetterParam = getters.prepareGetValue(exprOption);
  var subCondList = [];
  var exprKeys = keys(exprOption);
  var parserName = exprOption.parser;
  var valueParser = parserName ? getRawValueParser(parserName) : null;
  for (var i = 0; i < exprKeys.length; i++) {
    var keyRaw = exprKeys[i];
    if (keyRaw === 'parser' || getters.valueGetterAttrMap.get(keyRaw)) {
      continue;
    }
    var op = hasOwn(RELATIONAL_EXPRESSION_OP_ALIAS_MAP, keyRaw) ? RELATIONAL_EXPRESSION_OP_ALIAS_MAP[keyRaw] : keyRaw;
    var condValueRaw = exprOption[keyRaw];
    var condValueParsed = valueParser ? valueParser(condValueRaw) : condValueRaw;
    var evaluator = createFilterComparator(op, condValueParsed) || op === 'reg' && new RegExpEvaluator(condValueParsed);
    if (!evaluator) {
      {
        errMsg = makePrintable('Illegal relational operation: "' + keyRaw + '" in condition:', exprOption);
      }
      throwError(errMsg);
    }
    subCondList.push(evaluator);
  }
  if (!subCondList.length) {
    {
      errMsg = makePrintable('Relational condition must have at least one operator.', 'Illegal condition:', exprOption);
    }
    // No relational operator always disabled in case of dangers result.
    throwError(errMsg);
  }
  var cond = new RelationalConditionInternal();
  cond.valueGetterParam = valueGetterParam;
  cond.valueParser = valueParser;
  cond.getValue = getters.getValue;
  cond.subCondList = subCondList;
  return cond;
}
function isObjectNotArray(val) {
  return isObject$3(val) && !isArrayLike(val);
}
var ConditionalExpressionParsed = /** @class */function () {
  function ConditionalExpressionParsed(exprOption, getters) {
    this._cond = parseOption(exprOption, getters);
  }
  ConditionalExpressionParsed.prototype.evaluate = function () {
    return this._cond.evaluate();
  };
  return ConditionalExpressionParsed;
}();
function parseConditionalExpression(exprOption, getters) {
  return new ConditionalExpressionParsed(exprOption, getters);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var filterTransform = {
  type: 'echarts:filter',
  // PENDING: enhance to filter by index rather than create new data
  transform: function (params) {
    // [Caveat] Fail-Fast:
    // Do not return the whole dataset unless user config indicates it explicitly.
    // For example, if no condition is specified by mistake, returning an empty result
    // is better than returning the entire raw source for the user to find the mistake.
    var upstream = params.upstream;
    var rawItem;
    var condition = parseConditionalExpression(params.config, {
      valueGetterAttrMap: createHashMap({
        dimension: true
      }),
      prepareGetValue: function (exprOption) {
        var errMsg = '';
        var dimLoose = exprOption.dimension;
        if (!hasOwn(exprOption, 'dimension')) {
          {
            errMsg = makePrintable('Relation condition must has prop "dimension" specified.', 'Illegal condition:', exprOption);
          }
          throwError(errMsg);
        }
        var dimInfo = upstream.getDimensionInfo(dimLoose);
        if (!dimInfo) {
          {
            errMsg = makePrintable('Can not find dimension info via: ' + dimLoose + '.\n', 'Existing dimensions: ', upstream.cloneAllDimensionInfo(), '.\n', 'Illegal condition:', exprOption, '.\n');
          }
          throwError(errMsg);
        }
        return {
          dimIdx: dimInfo.index
        };
      },
      getValue: function (param) {
        return upstream.retrieveValueFromItem(rawItem, param.dimIdx);
      }
    });
    var resultData = [];
    for (var i = 0, len = upstream.count(); i < len; i++) {
      rawItem = upstream.getRawDataItem(i);
      if (condition.evaluate()) {
        resultData.push(rawItem);
      }
    }
    return {
      data: resultData
    };
  }
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var sampleLog = '';
{
  sampleLog = ['Valid config is like:', '{ dimension: "age", order: "asc" }', 'or [{ dimension: "age", order: "asc"], { dimension: "date", order: "desc" }]'].join(' ');
}
var sortTransform = {
  type: 'echarts:sort',
  transform: function (params) {
    var upstream = params.upstream;
    var config = params.config;
    var errMsg = '';
    // Normalize
    // const orderExprList: OrderExpression[] = isArray(config[0])
    //     ? config as OrderExpression[]
    //     : [config as OrderExpression];
    var orderExprList = normalizeToArray(config);
    if (!orderExprList.length) {
      {
        errMsg = 'Empty `config` in sort transform.';
      }
      throwError(errMsg);
    }
    var orderDefList = [];
    each$f(orderExprList, function (orderExpr) {
      var dimLoose = orderExpr.dimension;
      var order = orderExpr.order;
      var parserName = orderExpr.parser;
      var incomparable = orderExpr.incomparable;
      if (dimLoose == null) {
        {
          errMsg = 'Sort transform config must has "dimension" specified.' + sampleLog;
        }
        throwError(errMsg);
      }
      if (order !== 'asc' && order !== 'desc') {
        {
          errMsg = 'Sort transform config must has "order" specified.' + sampleLog;
        }
        throwError(errMsg);
      }
      if (incomparable && incomparable !== 'min' && incomparable !== 'max') {
        var errMsg_1 = '';
        {
          errMsg_1 = 'incomparable must be "min" or "max" rather than "' + incomparable + '".';
        }
        throwError(errMsg_1);
      }
      if (order !== 'asc' && order !== 'desc') {
        var errMsg_2 = '';
        {
          errMsg_2 = 'order must be "asc" or "desc" rather than "' + order + '".';
        }
        throwError(errMsg_2);
      }
      var dimInfo = upstream.getDimensionInfo(dimLoose);
      if (!dimInfo) {
        {
          errMsg = makePrintable('Can not find dimension info via: ' + dimLoose + '.\n', 'Existing dimensions: ', upstream.cloneAllDimensionInfo(), '.\n', 'Illegal config:', orderExpr, '.\n');
        }
        throwError(errMsg);
      }
      var parser = parserName ? getRawValueParser(parserName) : null;
      if (parserName && !parser) {
        {
          errMsg = makePrintable('Invalid parser name ' + parserName + '.\n', 'Illegal config:', orderExpr, '.\n');
        }
        throwError(errMsg);
      }
      orderDefList.push({
        dimIdx: dimInfo.index,
        parser: parser,
        comparator: new SortOrderComparator(order, incomparable)
      });
    });
    // TODO: support it?
    var sourceFormat = upstream.sourceFormat;
    if (sourceFormat !== SOURCE_FORMAT_ARRAY_ROWS && sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS) {
      {
        errMsg = 'sourceFormat "' + sourceFormat + '" is not supported yet';
      }
      throwError(errMsg);
    }
    // Other upstream format are all array.
    var resultData = [];
    for (var i = 0, len = upstream.count(); i < len; i++) {
      resultData.push(upstream.getRawDataItem(i));
    }
    resultData.sort(function (item0, item1) {
      for (var i = 0; i < orderDefList.length; i++) {
        var orderDef = orderDefList[i];
        var val0 = upstream.retrieveValueFromItem(item0, orderDef.dimIdx);
        var val1 = upstream.retrieveValueFromItem(item1, orderDef.dimIdx);
        if (orderDef.parser) {
          val0 = orderDef.parser(val0);
          val1 = orderDef.parser(val1);
        }
        var result = orderDef.comparator.evaluate(val0, val1);
        if (result !== 0) {
          return result;
        }
      }
      return 0;
    });
    return {
      data: resultData
    };
  }
};

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function install$3(registers) {
  registers.registerTransform(filterTransform);
  registers.registerTransform(sortTransform);
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DatasetModel = /** @class */function (_super) {
  __extends(DatasetModel, _super);
  function DatasetModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = 'dataset';
    return _this;
  }
  DatasetModel.prototype.init = function (option, parentModel, ecModel) {
    _super.prototype.init.call(this, option, parentModel, ecModel);
    this._sourceManager = new SourceManager(this);
    disableTransformOptionMerge(this);
  };
  DatasetModel.prototype.mergeOption = function (newOption, ecModel) {
    _super.prototype.mergeOption.call(this, newOption, ecModel);
    disableTransformOptionMerge(this);
  };
  DatasetModel.prototype.optionUpdated = function () {
    this._sourceManager.dirty();
  };
  DatasetModel.prototype.getSourceManager = function () {
    return this._sourceManager;
  };
  DatasetModel.type = 'dataset';
  DatasetModel.defaultOption = {
    seriesLayoutBy: SERIES_LAYOUT_BY_COLUMN
  };
  return DatasetModel;
}(ComponentModel$1);
var DatasetView = /** @class */function (_super) {
  __extends(DatasetView, _super);
  function DatasetView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = 'dataset';
    return _this;
  }
  DatasetView.type = 'dataset';
  return DatasetView;
}(ComponentView$1);
function install$2(registers) {
  registers.registerComponentModel(DatasetModel);
  registers.registerComponentView(DatasetView);
}

var CMD = PathProxy.CMD;
function aroundEqual(a, b) {
  return Math.abs(a - b) < 1e-5;
}
function pathToBezierCurves(path) {
  var data = path.data;
  var len = path.len();
  var bezierArrayGroups = [];
  var currentSubpath;
  var xi = 0;
  var yi = 0;
  var x0 = 0;
  var y0 = 0;
  function createNewSubpath(x, y) {
    if (currentSubpath && currentSubpath.length > 2) {
      bezierArrayGroups.push(currentSubpath);
    }
    currentSubpath = [x, y];
  }
  function addLine(x0, y0, x1, y1) {
    if (!(aroundEqual(x0, x1) && aroundEqual(y0, y1))) {
      currentSubpath.push(x0, y0, x1, y1, x1, y1);
    }
  }
  function addArc(startAngle, endAngle, cx, cy, rx, ry) {
    var delta = Math.abs(endAngle - startAngle);
    var len = Math.tan(delta / 4) * 4 / 3;
    var dir = endAngle < startAngle ? -1 : 1;
    var c1 = Math.cos(startAngle);
    var s1 = Math.sin(startAngle);
    var c2 = Math.cos(endAngle);
    var s2 = Math.sin(endAngle);
    var x1 = c1 * rx + cx;
    var y1 = s1 * ry + cy;
    var x4 = c2 * rx + cx;
    var y4 = s2 * ry + cy;
    var hx = rx * len * dir;
    var hy = ry * len * dir;
    currentSubpath.push(x1 - hx * s1, y1 + hy * c1, x4 + hx * s2, y4 - hy * c2, x4, y4);
  }
  var x1;
  var y1;
  var x2;
  var y2;
  for (var i = 0; i < len;) {
    var cmd = data[i++];
    var isFirst = i === 1;
    if (isFirst) {
      xi = data[i];
      yi = data[i + 1];
      x0 = xi;
      y0 = yi;
      if (cmd === CMD.L || cmd === CMD.C || cmd === CMD.Q) {
        currentSubpath = [x0, y0];
      }
    }
    switch (cmd) {
      case CMD.M:
        xi = x0 = data[i++];
        yi = y0 = data[i++];
        createNewSubpath(x0, y0);
        break;
      case CMD.L:
        x1 = data[i++];
        y1 = data[i++];
        addLine(xi, yi, x1, y1);
        xi = x1;
        yi = y1;
        break;
      case CMD.C:
        currentSubpath.push(data[i++], data[i++], data[i++], data[i++], xi = data[i++], yi = data[i++]);
        break;
      case CMD.Q:
        x1 = data[i++];
        y1 = data[i++];
        x2 = data[i++];
        y2 = data[i++];
        currentSubpath.push(xi + 2 / 3 * (x1 - xi), yi + 2 / 3 * (y1 - yi), x2 + 2 / 3 * (x1 - x2), y2 + 2 / 3 * (y1 - y2), x2, y2);
        xi = x2;
        yi = y2;
        break;
      case CMD.A:
        var cx = data[i++];
        var cy = data[i++];
        var rx = data[i++];
        var ry = data[i++];
        var startAngle = data[i++];
        var endAngle = data[i++] + startAngle;
        i += 1;
        var anticlockwise = !data[i++];
        x1 = Math.cos(startAngle) * rx + cx;
        y1 = Math.sin(startAngle) * ry + cy;
        if (isFirst) {
          x0 = x1;
          y0 = y1;
          createNewSubpath(x0, y0);
        } else {
          addLine(xi, yi, x1, y1);
        }
        xi = Math.cos(endAngle) * rx + cx;
        yi = Math.sin(endAngle) * ry + cy;
        var step = (anticlockwise ? -1 : 1) * Math.PI / 2;
        for (var angle = startAngle; anticlockwise ? angle > endAngle : angle < endAngle; angle += step) {
          var nextAngle = anticlockwise ? Math.max(angle + step, endAngle) : Math.min(angle + step, endAngle);
          addArc(angle, nextAngle, cx, cy, rx, ry);
        }
        break;
      case CMD.R:
        x0 = xi = data[i++];
        y0 = yi = data[i++];
        x1 = x0 + data[i++];
        y1 = y0 + data[i++];
        createNewSubpath(x1, y0);
        addLine(x1, y0, x1, y1);
        addLine(x1, y1, x0, y1);
        addLine(x0, y1, x0, y0);
        addLine(x0, y0, x1, y0);
        break;
      case CMD.Z:
        currentSubpath && addLine(xi, yi, x0, y0);
        xi = x0;
        yi = y0;
        break;
    }
  }
  if (currentSubpath && currentSubpath.length > 2) {
    bezierArrayGroups.push(currentSubpath);
  }
  return bezierArrayGroups;
}
function adpativeBezier(x0, y0, x1, y1, x2, y2, x3, y3, out, scale) {
  if (aroundEqual(x0, x1) && aroundEqual(y0, y1) && aroundEqual(x2, x3) && aroundEqual(y2, y3)) {
    out.push(x3, y3);
    return;
  }
  var PIXEL_DISTANCE = 2 / scale;
  var PIXEL_DISTANCE_SQR = PIXEL_DISTANCE * PIXEL_DISTANCE;
  var dx = x3 - x0;
  var dy = y3 - y0;
  var d = Math.sqrt(dx * dx + dy * dy);
  dx /= d;
  dy /= d;
  var dx1 = x1 - x0;
  var dy1 = y1 - y0;
  var dx2 = x2 - x3;
  var dy2 = y2 - y3;
  var cp1LenSqr = dx1 * dx1 + dy1 * dy1;
  var cp2LenSqr = dx2 * dx2 + dy2 * dy2;
  if (cp1LenSqr < PIXEL_DISTANCE_SQR && cp2LenSqr < PIXEL_DISTANCE_SQR) {
    out.push(x3, y3);
    return;
  }
  var projLen1 = dx * dx1 + dy * dy1;
  var projLen2 = -dx * dx2 - dy * dy2;
  var d1Sqr = cp1LenSqr - projLen1 * projLen1;
  var d2Sqr = cp2LenSqr - projLen2 * projLen2;
  if (d1Sqr < PIXEL_DISTANCE_SQR && projLen1 >= 0 && d2Sqr < PIXEL_DISTANCE_SQR && projLen2 >= 0) {
    out.push(x3, y3);
    return;
  }
  var tmpSegX = [];
  var tmpSegY = [];
  cubicSubdivide(x0, x1, x2, x3, 0.5, tmpSegX);
  cubicSubdivide(y0, y1, y2, y3, 0.5, tmpSegY);
  adpativeBezier(tmpSegX[0], tmpSegY[0], tmpSegX[1], tmpSegY[1], tmpSegX[2], tmpSegY[2], tmpSegX[3], tmpSegY[3], out, scale);
  adpativeBezier(tmpSegX[4], tmpSegY[4], tmpSegX[5], tmpSegY[5], tmpSegX[6], tmpSegY[6], tmpSegX[7], tmpSegY[7], out, scale);
}
function pathToPolygons(path, scale) {
  var bezierArrayGroups = pathToBezierCurves(path);
  var polygons = [];
  scale = scale || 1;
  for (var i = 0; i < bezierArrayGroups.length; i++) {
    var beziers = bezierArrayGroups[i];
    var polygon = [];
    var x0 = beziers[0];
    var y0 = beziers[1];
    polygon.push(x0, y0);
    for (var k = 2; k < beziers.length;) {
      var x1 = beziers[k++];
      var y1 = beziers[k++];
      var x2 = beziers[k++];
      var y2 = beziers[k++];
      var x3 = beziers[k++];
      var y3 = beziers[k++];
      adpativeBezier(x0, y0, x1, y1, x2, y2, x3, y3, polygon, scale);
      x0 = x3;
      y0 = y3;
    }
    polygons.push(polygon);
  }
  return polygons;
}

function getDividingGrids(dimSize, rowDim, count) {
  var rowSize = dimSize[rowDim];
  var columnSize = dimSize[1 - rowDim];
  var ratio = Math.abs(rowSize / columnSize);
  var rowCount = Math.ceil(Math.sqrt(ratio * count));
  var columnCount = Math.floor(count / rowCount);
  if (columnCount === 0) {
    columnCount = 1;
    rowCount = count;
  }
  var grids = [];
  for (var i = 0; i < rowCount; i++) {
    grids.push(columnCount);
  }
  var currentCount = rowCount * columnCount;
  var remained = count - currentCount;
  if (remained > 0) {
    for (var i = 0; i < remained; i++) {
      grids[i % rowCount] += 1;
    }
  }
  return grids;
}
function divideSector(sectorShape, count, outShapes) {
  var r0 = sectorShape.r0;
  var r = sectorShape.r;
  var startAngle = sectorShape.startAngle;
  var endAngle = sectorShape.endAngle;
  var angle = Math.abs(endAngle - startAngle);
  var arcLen = angle * r;
  var deltaR = r - r0;
  var isAngleRow = arcLen > Math.abs(deltaR);
  var grids = getDividingGrids([arcLen, deltaR], isAngleRow ? 0 : 1, count);
  var rowSize = (isAngleRow ? angle : deltaR) / grids.length;
  for (var row = 0; row < grids.length; row++) {
    var columnSize = (isAngleRow ? deltaR : angle) / grids[row];
    for (var column = 0; column < grids[row]; column++) {
      var newShape = {};
      if (isAngleRow) {
        newShape.startAngle = startAngle + rowSize * row;
        newShape.endAngle = startAngle + rowSize * (row + 1);
        newShape.r0 = r0 + columnSize * column;
        newShape.r = r0 + columnSize * (column + 1);
      } else {
        newShape.startAngle = startAngle + columnSize * column;
        newShape.endAngle = startAngle + columnSize * (column + 1);
        newShape.r0 = r0 + rowSize * row;
        newShape.r = r0 + rowSize * (row + 1);
      }
      newShape.clockwise = sectorShape.clockwise;
      newShape.cx = sectorShape.cx;
      newShape.cy = sectorShape.cy;
      outShapes.push(newShape);
    }
  }
}
function divideRect(rectShape, count, outShapes) {
  var width = rectShape.width;
  var height = rectShape.height;
  var isHorizontalRow = width > height;
  var grids = getDividingGrids([width, height], isHorizontalRow ? 0 : 1, count);
  var rowSizeDim = isHorizontalRow ? 'width' : 'height';
  var columnSizeDim = isHorizontalRow ? 'height' : 'width';
  var rowDim = isHorizontalRow ? 'x' : 'y';
  var columnDim = isHorizontalRow ? 'y' : 'x';
  var rowSize = rectShape[rowSizeDim] / grids.length;
  for (var row = 0; row < grids.length; row++) {
    var columnSize = rectShape[columnSizeDim] / grids[row];
    for (var column = 0; column < grids[row]; column++) {
      var newShape = {};
      newShape[rowDim] = row * rowSize;
      newShape[columnDim] = column * columnSize;
      newShape[rowSizeDim] = rowSize;
      newShape[columnSizeDim] = columnSize;
      newShape.x += rectShape.x;
      newShape.y += rectShape.y;
      outShapes.push(newShape);
    }
  }
}
function crossProduct2d(x1, y1, x2, y2) {
  return x1 * y2 - x2 * y1;
}
function lineLineIntersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) {
  var mx = a2x - a1x;
  var my = a2y - a1y;
  var nx = b2x - b1x;
  var ny = b2y - b1y;
  var nmCrossProduct = crossProduct2d(nx, ny, mx, my);
  if (Math.abs(nmCrossProduct) < 1e-6) {
    return null;
  }
  var b1a1x = a1x - b1x;
  var b1a1y = a1y - b1y;
  var p = crossProduct2d(b1a1x, b1a1y, nx, ny) / nmCrossProduct;
  if (p < 0 || p > 1) {
    return null;
  }
  return new Point$1(p * mx + a1x, p * my + a1y);
}
function projPtOnLine(pt, lineA, lineB) {
  var dir = new Point$1();
  Point$1.sub(dir, lineB, lineA);
  dir.normalize();
  var dir2 = new Point$1();
  Point$1.sub(dir2, pt, lineA);
  var len = dir2.dot(dir);
  return len;
}
function addToPoly(poly, pt) {
  var last = poly[poly.length - 1];
  if (last && last[0] === pt[0] && last[1] === pt[1]) {
    return;
  }
  poly.push(pt);
}
function splitPolygonByLine(points, lineA, lineB) {
  var len = points.length;
  var intersections = [];
  for (var i = 0; i < len; i++) {
    var p0 = points[i];
    var p1 = points[(i + 1) % len];
    var intersectionPt = lineLineIntersect(p0[0], p0[1], p1[0], p1[1], lineA.x, lineA.y, lineB.x, lineB.y);
    if (intersectionPt) {
      intersections.push({
        projPt: projPtOnLine(intersectionPt, lineA, lineB),
        pt: intersectionPt,
        idx: i
      });
    }
  }
  if (intersections.length < 2) {
    return [{
      points: points
    }, {
      points: points
    }];
  }
  intersections.sort(function (a, b) {
    return a.projPt - b.projPt;
  });
  var splitPt0 = intersections[0];
  var splitPt1 = intersections[intersections.length - 1];
  if (splitPt1.idx < splitPt0.idx) {
    var tmp = splitPt0;
    splitPt0 = splitPt1;
    splitPt1 = tmp;
  }
  var splitPt0Arr = [splitPt0.pt.x, splitPt0.pt.y];
  var splitPt1Arr = [splitPt1.pt.x, splitPt1.pt.y];
  var newPolyA = [splitPt0Arr];
  var newPolyB = [splitPt1Arr];
  for (var i = splitPt0.idx + 1; i <= splitPt1.idx; i++) {
    addToPoly(newPolyA, points[i].slice());
  }
  addToPoly(newPolyA, splitPt1Arr);
  addToPoly(newPolyA, splitPt0Arr);
  for (var i = splitPt1.idx + 1; i <= splitPt0.idx + len; i++) {
    addToPoly(newPolyB, points[i % len].slice());
  }
  addToPoly(newPolyB, splitPt0Arr);
  addToPoly(newPolyB, splitPt1Arr);
  return [{
    points: newPolyA
  }, {
    points: newPolyB
  }];
}
function binaryDividePolygon(polygonShape) {
  var points = polygonShape.points;
  var min = [];
  var max = [];
  fromPoints(points, min, max);
  var boundingRect = new BoundingRect$1(min[0], min[1], max[0] - min[0], max[1] - min[1]);
  var width = boundingRect.width;
  var height = boundingRect.height;
  var x = boundingRect.x;
  var y = boundingRect.y;
  var pt0 = new Point$1();
  var pt1 = new Point$1();
  if (width > height) {
    pt0.x = pt1.x = x + width / 2;
    pt0.y = y;
    pt1.y = y + height;
  } else {
    pt0.y = pt1.y = y + height / 2;
    pt0.x = x;
    pt1.x = x + width;
  }
  return splitPolygonByLine(points, pt0, pt1);
}
function binaryDivideRecursive(divider, shape, count, out) {
  if (count === 1) {
    out.push(shape);
  } else {
    var mid = Math.floor(count / 2);
    var sub = divider(shape);
    binaryDivideRecursive(divider, sub[0], mid, out);
    binaryDivideRecursive(divider, sub[1], count - mid, out);
  }
  return out;
}
function clone(path, count) {
  var paths = [];
  for (var i = 0; i < count; i++) {
    paths.push(clonePath(path));
  }
  return paths;
}
function copyPathProps(source, target) {
  target.setStyle(source.style);
  target.z = source.z;
  target.z2 = source.z2;
  target.zlevel = source.zlevel;
}
function polygonConvert(points) {
  var out = [];
  for (var i = 0; i < points.length;) {
    out.push([points[i++], points[i++]]);
  }
  return out;
}
function split(path, count) {
  var outShapes = [];
  var shape = path.shape;
  var OutShapeCtor;
  switch (path.type) {
    case 'rect':
      divideRect(shape, count, outShapes);
      OutShapeCtor = Rect$3;
      break;
    case 'sector':
      divideSector(shape, count, outShapes);
      OutShapeCtor = Sector$1;
      break;
    case 'circle':
      divideSector({
        r0: 0,
        r: shape.r,
        startAngle: 0,
        endAngle: Math.PI * 2,
        cx: shape.cx,
        cy: shape.cy
      }, count, outShapes);
      OutShapeCtor = Sector$1;
      break;
    default:
      var m = path.getComputedTransform();
      var scale = m ? Math.sqrt(Math.max(m[0] * m[0] + m[1] * m[1], m[2] * m[2] + m[3] * m[3])) : 1;
      var polygons = map$1(pathToPolygons(path.getUpdatedPathProxy(), scale), function (poly) {
        return polygonConvert(poly);
      });
      var polygonCount = polygons.length;
      if (polygonCount === 0) {
        binaryDivideRecursive(binaryDividePolygon, {
          points: polygons[0]
        }, count, outShapes);
      } else if (polygonCount === count) {
        for (var i = 0; i < polygonCount; i++) {
          outShapes.push({
            points: polygons[i]
          });
        }
      } else {
        var totalArea_1 = 0;
        var items = map$1(polygons, function (poly) {
          var min = [];
          var max = [];
          fromPoints(poly, min, max);
          var area = (max[1] - min[1]) * (max[0] - min[0]);
          totalArea_1 += area;
          return {
            poly: poly,
            area: area
          };
        });
        items.sort(function (a, b) {
          return b.area - a.area;
        });
        var left = count;
        for (var i = 0; i < polygonCount; i++) {
          var item = items[i];
          if (left <= 0) {
            break;
          }
          var selfCount = i === polygonCount - 1 ? left : Math.ceil(item.area / totalArea_1 * count);
          if (selfCount < 0) {
            continue;
          }
          binaryDivideRecursive(binaryDividePolygon, {
            points: item.poly
          }, selfCount, outShapes);
          left -= selfCount;
        }
      }
      OutShapeCtor = Polygon$1;
      break;
  }
  if (!OutShapeCtor) {
    return clone(path, count);
  }
  var out = [];
  for (var i = 0; i < outShapes.length; i++) {
    var subPath = new OutShapeCtor();
    subPath.setShape(outShapes[i]);
    copyPathProps(path, subPath);
    out.push(subPath);
  }
  return out;
}

function alignSubpath(subpath1, subpath2) {
  var len1 = subpath1.length;
  var len2 = subpath2.length;
  if (len1 === len2) {
    return [subpath1, subpath2];
  }
  var tmpSegX = [];
  var tmpSegY = [];
  var shorterPath = len1 < len2 ? subpath1 : subpath2;
  var shorterLen = Math.min(len1, len2);
  var diff = Math.abs(len2 - len1) / 6;
  var shorterBezierCount = (shorterLen - 2) / 6;
  var eachCurveSubDivCount = Math.ceil(diff / shorterBezierCount) + 1;
  var newSubpath = [shorterPath[0], shorterPath[1]];
  var remained = diff;
  for (var i = 2; i < shorterLen;) {
    var x0 = shorterPath[i - 2];
    var y0 = shorterPath[i - 1];
    var x1 = shorterPath[i++];
    var y1 = shorterPath[i++];
    var x2 = shorterPath[i++];
    var y2 = shorterPath[i++];
    var x3 = shorterPath[i++];
    var y3 = shorterPath[i++];
    if (remained <= 0) {
      newSubpath.push(x1, y1, x2, y2, x3, y3);
      continue;
    }
    var actualSubDivCount = Math.min(remained, eachCurveSubDivCount - 1) + 1;
    for (var k = 1; k <= actualSubDivCount; k++) {
      var p = k / actualSubDivCount;
      cubicSubdivide(x0, x1, x2, x3, p, tmpSegX);
      cubicSubdivide(y0, y1, y2, y3, p, tmpSegY);
      x0 = tmpSegX[3];
      y0 = tmpSegY[3];
      newSubpath.push(tmpSegX[1], tmpSegY[1], tmpSegX[2], tmpSegY[2], x0, y0);
      x1 = tmpSegX[5];
      y1 = tmpSegY[5];
      x2 = tmpSegX[6];
      y2 = tmpSegY[6];
    }
    remained -= actualSubDivCount - 1;
  }
  return shorterPath === subpath1 ? [newSubpath, subpath2] : [subpath1, newSubpath];
}
function createSubpath(lastSubpathSubpath, otherSubpath) {
  var len = lastSubpathSubpath.length;
  var lastX = lastSubpathSubpath[len - 2];
  var lastY = lastSubpathSubpath[len - 1];
  var newSubpath = [];
  for (var i = 0; i < otherSubpath.length;) {
    newSubpath[i++] = lastX;
    newSubpath[i++] = lastY;
  }
  return newSubpath;
}
function alignBezierCurves(array1, array2) {
  var _a;
  var lastSubpath1;
  var lastSubpath2;
  var newArray1 = [];
  var newArray2 = [];
  for (var i = 0; i < Math.max(array1.length, array2.length); i++) {
    var subpath1 = array1[i];
    var subpath2 = array2[i];
    var newSubpath1 = void 0;
    var newSubpath2 = void 0;
    if (!subpath1) {
      newSubpath1 = createSubpath(lastSubpath1 || subpath2, subpath2);
      newSubpath2 = subpath2;
    } else if (!subpath2) {
      newSubpath2 = createSubpath(lastSubpath2 || subpath1, subpath1);
      newSubpath1 = subpath1;
    } else {
      _a = alignSubpath(subpath1, subpath2), newSubpath1 = _a[0], newSubpath2 = _a[1];
      lastSubpath1 = newSubpath1;
      lastSubpath2 = newSubpath2;
    }
    newArray1.push(newSubpath1);
    newArray2.push(newSubpath2);
  }
  return [newArray1, newArray2];
}
function centroid(array) {
  var signedArea = 0;
  var cx = 0;
  var cy = 0;
  var len = array.length;
  for (var i = 0, j = len - 2; i < len; j = i, i += 2) {
    var x0 = array[j];
    var y0 = array[j + 1];
    var x1 = array[i];
    var y1 = array[i + 1];
    var a = x0 * y1 - x1 * y0;
    signedArea += a;
    cx += (x0 + x1) * a;
    cy += (y0 + y1) * a;
  }
  if (signedArea === 0) {
    return [array[0] || 0, array[1] || 0];
  }
  return [cx / signedArea / 3, cy / signedArea / 3, signedArea];
}
function findBestRingOffset(fromSubBeziers, toSubBeziers, fromCp, toCp) {
  var bezierCount = (fromSubBeziers.length - 2) / 6;
  var bestScore = Infinity;
  var bestOffset = 0;
  var len = fromSubBeziers.length;
  var len2 = len - 2;
  for (var offset = 0; offset < bezierCount; offset++) {
    var cursorOffset = offset * 6;
    var score = 0;
    for (var k = 0; k < len; k += 2) {
      var idx = k === 0 ? cursorOffset : (cursorOffset + k - 2) % len2 + 2;
      var x0 = fromSubBeziers[idx] - fromCp[0];
      var y0 = fromSubBeziers[idx + 1] - fromCp[1];
      var x1 = toSubBeziers[k] - toCp[0];
      var y1 = toSubBeziers[k + 1] - toCp[1];
      var dx = x1 - x0;
      var dy = y1 - y0;
      score += dx * dx + dy * dy;
    }
    if (score < bestScore) {
      bestScore = score;
      bestOffset = offset;
    }
  }
  return bestOffset;
}
function reverse(array) {
  var newArr = [];
  var len = array.length;
  for (var i = 0; i < len; i += 2) {
    newArr[i] = array[len - i - 2];
    newArr[i + 1] = array[len - i - 1];
  }
  return newArr;
}
function findBestMorphingRotation(fromArr, toArr, searchAngleIteration, searchAngleRange) {
  var result = [];
  var fromNeedsReverse;
  for (var i = 0; i < fromArr.length; i++) {
    var fromSubpathBezier = fromArr[i];
    var toSubpathBezier = toArr[i];
    var fromCp = centroid(fromSubpathBezier);
    var toCp = centroid(toSubpathBezier);
    if (fromNeedsReverse == null) {
      fromNeedsReverse = fromCp[2] < 0 !== toCp[2] < 0;
    }
    var newFromSubpathBezier = [];
    var newToSubpathBezier = [];
    var bestAngle = 0;
    var bestScore = Infinity;
    var tmpArr = [];
    var len = fromSubpathBezier.length;
    if (fromNeedsReverse) {
      fromSubpathBezier = reverse(fromSubpathBezier);
    }
    var offset = findBestRingOffset(fromSubpathBezier, toSubpathBezier, fromCp, toCp) * 6;
    var len2 = len - 2;
    for (var k = 0; k < len2; k += 2) {
      var idx = (offset + k) % len2 + 2;
      newFromSubpathBezier[k + 2] = fromSubpathBezier[idx] - fromCp[0];
      newFromSubpathBezier[k + 3] = fromSubpathBezier[idx + 1] - fromCp[1];
    }
    newFromSubpathBezier[0] = fromSubpathBezier[offset] - fromCp[0];
    newFromSubpathBezier[1] = fromSubpathBezier[offset + 1] - fromCp[1];
    if (searchAngleIteration > 0) {
      var step = searchAngleRange / searchAngleIteration;
      for (var angle = -searchAngleRange / 2; angle <= searchAngleRange / 2; angle += step) {
        var sa = Math.sin(angle);
        var ca = Math.cos(angle);
        var score = 0;
        for (var k = 0; k < fromSubpathBezier.length; k += 2) {
          var x0 = newFromSubpathBezier[k];
          var y0 = newFromSubpathBezier[k + 1];
          var x1 = toSubpathBezier[k] - toCp[0];
          var y1 = toSubpathBezier[k + 1] - toCp[1];
          var newX1 = x1 * ca - y1 * sa;
          var newY1 = x1 * sa + y1 * ca;
          tmpArr[k] = newX1;
          tmpArr[k + 1] = newY1;
          var dx = newX1 - x0;
          var dy = newY1 - y0;
          score += dx * dx + dy * dy;
        }
        if (score < bestScore) {
          bestScore = score;
          bestAngle = angle;
          for (var m = 0; m < tmpArr.length; m++) {
            newToSubpathBezier[m] = tmpArr[m];
          }
        }
      }
    } else {
      for (var i_1 = 0; i_1 < len; i_1 += 2) {
        newToSubpathBezier[i_1] = toSubpathBezier[i_1] - toCp[0];
        newToSubpathBezier[i_1 + 1] = toSubpathBezier[i_1 + 1] - toCp[1];
      }
    }
    result.push({
      from: newFromSubpathBezier,
      to: newToSubpathBezier,
      fromCp: fromCp,
      toCp: toCp,
      rotation: -bestAngle
    });
  }
  return result;
}
function isCombineMorphing(path) {
  return path.__isCombineMorphing;
}
var SAVED_METHOD_PREFIX = '__mOriginal_';
function saveAndModifyMethod(obj, methodName, modifiers) {
  var savedMethodName = SAVED_METHOD_PREFIX + methodName;
  var originalMethod = obj[savedMethodName] || obj[methodName];
  if (!obj[savedMethodName]) {
    obj[savedMethodName] = obj[methodName];
  }
  var replace = modifiers.replace;
  var after = modifiers.after;
  var before = modifiers.before;
  obj[methodName] = function () {
    var args = arguments;
    var res;
    before && before.apply(this, args);
    if (replace) {
      res = replace.apply(this, args);
    } else {
      res = originalMethod.apply(this, args);
    }
    after && after.apply(this, args);
    return res;
  };
}
function restoreMethod(obj, methodName) {
  var savedMethodName = SAVED_METHOD_PREFIX + methodName;
  if (obj[savedMethodName]) {
    obj[methodName] = obj[savedMethodName];
    obj[savedMethodName] = null;
  }
}
function applyTransformOnBeziers(bezierCurves, mm) {
  for (var i = 0; i < bezierCurves.length; i++) {
    var subBeziers = bezierCurves[i];
    for (var k = 0; k < subBeziers.length;) {
      var x = subBeziers[k];
      var y = subBeziers[k + 1];
      subBeziers[k++] = mm[0] * x + mm[2] * y + mm[4];
      subBeziers[k++] = mm[1] * x + mm[3] * y + mm[5];
    }
  }
}
function prepareMorphPath(fromPath, toPath) {
  var fromPathProxy = fromPath.getUpdatedPathProxy();
  var toPathProxy = toPath.getUpdatedPathProxy();
  var _a = alignBezierCurves(pathToBezierCurves(fromPathProxy), pathToBezierCurves(toPathProxy)),
    fromBezierCurves = _a[0],
    toBezierCurves = _a[1];
  var fromPathTransform = fromPath.getComputedTransform();
  var toPathTransform = toPath.getComputedTransform();
  function updateIdentityTransform() {
    this.transform = null;
  }
  fromPathTransform && applyTransformOnBeziers(fromBezierCurves, fromPathTransform);
  toPathTransform && applyTransformOnBeziers(toBezierCurves, toPathTransform);
  saveAndModifyMethod(toPath, 'updateTransform', {
    replace: updateIdentityTransform
  });
  toPath.transform = null;
  var morphingData = findBestMorphingRotation(fromBezierCurves, toBezierCurves, 10, Math.PI);
  var tmpArr = [];
  saveAndModifyMethod(toPath, 'buildPath', {
    replace: function (path) {
      var t = toPath.__morphT;
      var onet = 1 - t;
      var newCp = [];
      for (var i = 0; i < morphingData.length; i++) {
        var item = morphingData[i];
        var from = item.from;
        var to = item.to;
        var angle = item.rotation * t;
        var fromCp = item.fromCp;
        var toCp = item.toCp;
        var sa = Math.sin(angle);
        var ca = Math.cos(angle);
        lerp$3(newCp, fromCp, toCp, t);
        for (var m = 0; m < from.length; m += 2) {
          var x0_1 = from[m];
          var y0_1 = from[m + 1];
          var x1 = to[m];
          var y1 = to[m + 1];
          var x = x0_1 * onet + x1 * t;
          var y = y0_1 * onet + y1 * t;
          tmpArr[m] = x * ca - y * sa + newCp[0];
          tmpArr[m + 1] = x * sa + y * ca + newCp[1];
        }
        var x0 = tmpArr[0];
        var y0 = tmpArr[1];
        path.moveTo(x0, y0);
        for (var m = 2; m < from.length;) {
          var x1 = tmpArr[m++];
          var y1 = tmpArr[m++];
          var x2 = tmpArr[m++];
          var y2 = tmpArr[m++];
          var x3 = tmpArr[m++];
          var y3 = tmpArr[m++];
          if (x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3) {
            path.lineTo(x3, y3);
          } else {
            path.bezierCurveTo(x1, y1, x2, y2, x3, y3);
          }
          x0 = x3;
          y0 = y3;
        }
      }
    }
  });
}
function morphPath(fromPath, toPath, animationOpts) {
  if (!fromPath || !toPath) {
    return toPath;
  }
  var oldDone = animationOpts.done;
  var oldDuring = animationOpts.during;
  prepareMorphPath(fromPath, toPath);
  toPath.__morphT = 0;
  function restoreToPath() {
    restoreMethod(toPath, 'buildPath');
    restoreMethod(toPath, 'updateTransform');
    toPath.__morphT = -1;
    toPath.createPathProxy();
    toPath.dirtyShape();
  }
  toPath.animateTo({
    __morphT: 1
  }, defaults({
    during: function (p) {
      toPath.dirtyShape();
      oldDuring && oldDuring(p);
    },
    done: function () {
      restoreToPath();
      oldDone && oldDone();
    }
  }, animationOpts));
  return toPath;
}
function hilbert(x, y, minX, minY, maxX, maxY) {
  var bits = 16;
  x = maxX === minX ? 0 : Math.round(32767 * (x - minX) / (maxX - minX));
  y = maxY === minY ? 0 : Math.round(32767 * (y - minY) / (maxY - minY));
  var d = 0;
  var tmp;
  for (var s = (1 << bits) / 2; s > 0; s /= 2) {
    var rx = 0;
    var ry = 0;
    if ((x & s) > 0) {
      rx = 1;
    }
    if ((y & s) > 0) {
      ry = 1;
    }
    d += s * s * (3 * rx ^ ry);
    if (ry === 0) {
      if (rx === 1) {
        x = s - 1 - x;
        y = s - 1 - y;
      }
      tmp = x;
      x = y;
      y = tmp;
    }
  }
  return d;
}
function sortPaths(pathList) {
  var xMin = Infinity;
  var yMin = Infinity;
  var xMax = -Infinity;
  var yMax = -Infinity;
  var cps = map$1(pathList, function (path) {
    var rect = path.getBoundingRect();
    var m = path.getComputedTransform();
    var x = rect.x + rect.width / 2 + (m ? m[4] : 0);
    var y = rect.y + rect.height / 2 + (m ? m[5] : 0);
    xMin = Math.min(x, xMin);
    yMin = Math.min(y, yMin);
    xMax = Math.max(x, xMax);
    yMax = Math.max(y, yMax);
    return [x, y];
  });
  var items = map$1(cps, function (cp, idx) {
    return {
      cp: cp,
      z: hilbert(cp[0], cp[1], xMin, yMin, xMax, yMax),
      path: pathList[idx]
    };
  });
  return items.sort(function (a, b) {
    return a.z - b.z;
  }).map(function (item) {
    return item.path;
  });
}
function defaultDividePath(param) {
  return split(param.path, param.count);
}
function createEmptyReturn() {
  return {
    fromIndividuals: [],
    toIndividuals: [],
    count: 0
  };
}
function combineMorph(fromList, toPath, animationOpts) {
  var fromPathList = [];
  function addFromPath(fromList) {
    for (var i = 0; i < fromList.length; i++) {
      var from = fromList[i];
      if (isCombineMorphing(from)) {
        addFromPath(from.childrenRef());
      } else if (from instanceof Path$1) {
        fromPathList.push(from);
      }
    }
  }
  addFromPath(fromList);
  var separateCount = fromPathList.length;
  if (!separateCount) {
    return createEmptyReturn();
  }
  var dividePath = animationOpts.dividePath || defaultDividePath;
  var toSubPathList = dividePath({
    path: toPath,
    count: separateCount
  });
  if (toSubPathList.length !== separateCount) {
    console.error('Invalid morphing: unmatched splitted path');
    return createEmptyReturn();
  }
  fromPathList = sortPaths(fromPathList);
  toSubPathList = sortPaths(toSubPathList);
  var oldDone = animationOpts.done;
  var oldDuring = animationOpts.during;
  var individualDelay = animationOpts.individualDelay;
  var identityTransform = new Transformable$1();
  for (var i = 0; i < separateCount; i++) {
    var from = fromPathList[i];
    var to = toSubPathList[i];
    to.parent = toPath;
    to.copyTransform(identityTransform);
    if (!individualDelay) {
      prepareMorphPath(from, to);
    }
  }
  toPath.__isCombineMorphing = true;
  toPath.childrenRef = function () {
    return toSubPathList;
  };
  function addToSubPathListToZr(zr) {
    for (var i = 0; i < toSubPathList.length; i++) {
      toSubPathList[i].addSelfToZr(zr);
    }
  }
  saveAndModifyMethod(toPath, 'addSelfToZr', {
    after: function (zr) {
      addToSubPathListToZr(zr);
    }
  });
  saveAndModifyMethod(toPath, 'removeSelfFromZr', {
    after: function (zr) {
      for (var i = 0; i < toSubPathList.length; i++) {
        toSubPathList[i].removeSelfFromZr(zr);
      }
    }
  });
  function restoreToPath() {
    toPath.__isCombineMorphing = false;
    toPath.__morphT = -1;
    toPath.childrenRef = null;
    restoreMethod(toPath, 'addSelfToZr');
    restoreMethod(toPath, 'removeSelfFromZr');
  }
  var toLen = toSubPathList.length;
  if (individualDelay) {
    var animating_1 = toLen;
    var eachDone = function () {
      animating_1--;
      if (animating_1 === 0) {
        restoreToPath();
        oldDone && oldDone();
      }
    };
    for (var i = 0; i < toLen; i++) {
      var indivdualAnimationOpts = individualDelay ? defaults({
        delay: (animationOpts.delay || 0) + individualDelay(i, toLen, fromPathList[i], toSubPathList[i]),
        done: eachDone
      }, animationOpts) : animationOpts;
      morphPath(fromPathList[i], toSubPathList[i], indivdualAnimationOpts);
    }
  } else {
    toPath.__morphT = 0;
    toPath.animateTo({
      __morphT: 1
    }, defaults({
      during: function (p) {
        for (var i = 0; i < toLen; i++) {
          var child = toSubPathList[i];
          child.__morphT = toPath.__morphT;
          child.dirtyShape();
        }
        oldDuring && oldDuring(p);
      },
      done: function () {
        restoreToPath();
        for (var i = 0; i < fromList.length; i++) {
          restoreMethod(fromList[i], 'updateTransform');
        }
        oldDone && oldDone();
      }
    }, animationOpts));
  }
  if (toPath.__zr) {
    addToSubPathListToZr(toPath.__zr);
  }
  return {
    fromIndividuals: fromPathList,
    toIndividuals: toSubPathList,
    count: toLen
  };
}
function separateMorph(fromPath, toPathList, animationOpts) {
  var toLen = toPathList.length;
  var fromPathList = [];
  var dividePath = animationOpts.dividePath || defaultDividePath;
  function addFromPath(fromList) {
    for (var i = 0; i < fromList.length; i++) {
      var from = fromList[i];
      if (isCombineMorphing(from)) {
        addFromPath(from.childrenRef());
      } else if (from instanceof Path$1) {
        fromPathList.push(from);
      }
    }
  }
  if (isCombineMorphing(fromPath)) {
    addFromPath(fromPath.childrenRef());
    var fromLen = fromPathList.length;
    if (fromLen < toLen) {
      var k = 0;
      for (var i = fromLen; i < toLen; i++) {
        fromPathList.push(clonePath(fromPathList[k++ % fromLen]));
      }
    }
    fromPathList.length = toLen;
  } else {
    fromPathList = dividePath({
      path: fromPath,
      count: toLen
    });
    var fromPathTransform = fromPath.getComputedTransform();
    for (var i = 0; i < fromPathList.length; i++) {
      fromPathList[i].setLocalTransform(fromPathTransform);
    }
    if (fromPathList.length !== toLen) {
      console.error('Invalid morphing: unmatched splitted path');
      return createEmptyReturn();
    }
  }
  fromPathList = sortPaths(fromPathList);
  toPathList = sortPaths(toPathList);
  var individualDelay = animationOpts.individualDelay;
  for (var i = 0; i < toLen; i++) {
    var indivdualAnimationOpts = individualDelay ? defaults({
      delay: (animationOpts.delay || 0) + individualDelay(i, toLen, fromPathList[i], toPathList[i])
    }, animationOpts) : animationOpts;
    morphPath(fromPathList[i], toPathList[i], indivdualAnimationOpts);
  }
  return {
    fromIndividuals: fromPathList,
    toIndividuals: toPathList,
    count: toPathList.length
  };
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
function isMultiple(elements) {
  return isArray$1(elements[0]);
}
function prepareMorphBatches(one, many) {
  var batches = [];
  var batchCount = one.length;
  for (var i = 0; i < batchCount; i++) {
    batches.push({
      one: one[i],
      many: []
    });
  }
  for (var i = 0; i < many.length; i++) {
    var len = many[i].length;
    var k = void 0;
    for (k = 0; k < len; k++) {
      batches[k % batchCount].many.push(many[i][k]);
    }
  }
  var off = 0;
  // If one has more paths than each one of many. average them.
  for (var i = batchCount - 1; i >= 0; i--) {
    if (!batches[i].many.length) {
      var moveFrom = batches[off].many;
      if (moveFrom.length <= 1) {
        // Not enough
        // Start from the first one.
        if (off) {
          off = 0;
        } else {
          return batches;
        }
      }
      var len = moveFrom.length;
      var mid = Math.ceil(len / 2);
      batches[i].many = moveFrom.slice(mid, len);
      batches[off].many = moveFrom.slice(0, mid);
      off++;
    }
  }
  return batches;
}
var pathDividers = {
  clone: function (params) {
    var ret = [];
    // Fitting the alpha
    var approxOpacity = 1 - Math.pow(1 - params.path.style.opacity, 1 / params.count);
    for (var i = 0; i < params.count; i++) {
      var cloned = clonePath(params.path);
      cloned.setStyle('opacity', approxOpacity);
      ret.push(cloned);
    }
    return ret;
  },
  // Use the default divider
  split: null
};
function applyMorphAnimation(from, to, divideShape, seriesModel, dataIndex, animateOtherProps) {
  if (!from.length || !to.length) {
    return;
  }
  var updateAnimationCfg = getAnimationConfig('update', seriesModel, dataIndex);
  if (!(updateAnimationCfg && updateAnimationCfg.duration > 0)) {
    return;
  }
  var animationDelay = seriesModel.getModel('universalTransition').get('delay');
  var animationCfg = Object.assign({
    // Need to setToFinal so the further calculation based on the style can be correct.
    // Like emphasis color.
    setToFinal: true
  }, updateAnimationCfg);
  var many;
  var one;
  if (isMultiple(from)) {
    // manyToOne
    many = from;
    one = to;
  }
  if (isMultiple(to)) {
    // oneToMany
    many = to;
    one = from;
  }
  function morphOneBatch(batch, fromIsMany, animateIndex, animateCount, forceManyOne) {
    var batchMany = batch.many;
    var batchOne = batch.one;
    if (batchMany.length === 1 && !forceManyOne) {
      // Is one to one
      var batchFrom = fromIsMany ? batchMany[0] : batchOne;
      var batchTo = fromIsMany ? batchOne : batchMany[0];
      if (isCombineMorphing(batchFrom)) {
        // Keep doing combine animation.
        morphOneBatch({
          many: [batchFrom],
          one: batchTo
        }, true, animateIndex, animateCount, true);
      } else {
        var individualAnimationCfg = animationDelay ? defaults({
          delay: animationDelay(animateIndex, animateCount)
        }, animationCfg) : animationCfg;
        morphPath(batchFrom, batchTo, individualAnimationCfg);
        animateOtherProps(batchFrom, batchTo, batchFrom, batchTo, individualAnimationCfg);
      }
    } else {
      var separateAnimationCfg = defaults({
        dividePath: pathDividers[divideShape],
        individualDelay: animationDelay && function (idx, count, fromPath, toPath) {
          return animationDelay(idx + animateIndex, animateCount);
        }
      }, animationCfg);
      var _a = fromIsMany ? combineMorph(batchMany, batchOne, separateAnimationCfg) : separateMorph(batchOne, batchMany, separateAnimationCfg),
        fromIndividuals = _a.fromIndividuals,
        toIndividuals = _a.toIndividuals;
      var count = fromIndividuals.length;
      for (var k = 0; k < count; k++) {
        var individualAnimationCfg = animationDelay ? defaults({
          delay: animationDelay(k, count)
        }, animationCfg) : animationCfg;
        animateOtherProps(fromIndividuals[k], toIndividuals[k], fromIsMany ? batchMany[k] : batch.one, fromIsMany ? batch.one : batchMany[k], individualAnimationCfg);
      }
    }
  }
  var fromIsMany = many ? many === from
  // Is one to one. If the path number not match. also needs do merge and separate morphing.
  : from.length > to.length;
  var morphBatches = many ? prepareMorphBatches(one, many) : prepareMorphBatches(fromIsMany ? to : from, [fromIsMany ? from : to]);
  var animateCount = 0;
  for (var i = 0; i < morphBatches.length; i++) {
    animateCount += morphBatches[i].many.length;
  }
  var animateIndex = 0;
  for (var i = 0; i < morphBatches.length; i++) {
    morphOneBatch(morphBatches[i], fromIsMany, animateIndex, animateCount);
    animateIndex += morphBatches[i].many.length;
  }
}
function getPathList(elements) {
  if (!elements) {
    return [];
  }
  if (isArray$1(elements)) {
    var pathList_1 = [];
    for (var i = 0; i < elements.length; i++) {
      pathList_1.push(getPathList(elements[i]));
    }
    return pathList_1;
  }
  var pathList = [];
  elements.traverse(function (el) {
    if (el instanceof Path$1 && !el.disableMorphing && !el.invisible && !el.ignore) {
      pathList.push(el);
    }
  });
  return pathList;
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var DATA_COUNT_THRESHOLD = 1e4;
var TRANSITION_NONE = 0;
var TRANSITION_P2C = 1;
var TRANSITION_C2P = 2;
var getUniversalTransitionGlobalStore = makeInner();
function getDimension(data, visualDimension) {
  var dimensions = data.dimensions;
  for (var i = 0; i < dimensions.length; i++) {
    var dimInfo = data.getDimensionInfo(dimensions[i]);
    if (dimInfo && dimInfo.otherDims[visualDimension] === 0) {
      return dimensions[i];
    }
  }
}
// get value by dimension. (only get value of itemGroupId or childGroupId, so convert it to string)
function getValueByDimension(data, dataIndex, dimension) {
  var dimInfo = data.getDimensionInfo(dimension);
  var dimOrdinalMeta = dimInfo && dimInfo.ordinalMeta;
  if (dimInfo) {
    var value = data.get(dimInfo.name, dataIndex);
    if (dimOrdinalMeta) {
      return dimOrdinalMeta.categories[value] || value + '';
    }
    return value + '';
  }
}
function getGroupId(data, dataIndex, dataGroupId, isChild) {
  // try to get groupId from encode
  var visualDimension = isChild ? 'itemChildGroupId' : 'itemGroupId';
  var groupIdDim = getDimension(data, visualDimension);
  if (groupIdDim) {
    var groupId = getValueByDimension(data, dataIndex, groupIdDim);
    return groupId;
  }
  // try to get groupId from raw data item
  var rawDataItem = data.getRawDataItem(dataIndex);
  var property = isChild ? 'childGroupId' : 'groupId';
  if (rawDataItem && rawDataItem[property]) {
    return rawDataItem[property] + '';
  }
  // fallback
  if (isChild) {
    return;
  }
  // try to use series.dataGroupId as groupId, otherwise use dataItem's id as groupId
  return dataGroupId || data.getId(dataIndex);
}
// flatten all data items from different serieses into one arrary
function flattenDataDiffItems(list) {
  var items = [];
  each$f(list, function (seriesInfo) {
    var data = seriesInfo.data;
    var dataGroupId = seriesInfo.dataGroupId;
    if (data.count() > DATA_COUNT_THRESHOLD) {
      {
        warn('Universal transition is disabled on large data > 10k.');
      }
      return;
    }
    var indices = data.getIndices();
    for (var dataIndex = 0; dataIndex < indices.length; dataIndex++) {
      items.push({
        data: data,
        groupId: getGroupId(data, dataIndex, dataGroupId, false),
        childGroupId: getGroupId(data, dataIndex, dataGroupId, true),
        divide: seriesInfo.divide,
        dataIndex: dataIndex
      });
    }
  });
  return items;
}
function fadeInElement(newEl, newSeries, newIndex) {
  newEl.traverse(function (el) {
    if (el instanceof Path$1) {
      // TODO use fade in animation for target element.
      initProps(el, {
        style: {
          opacity: 0
        }
      }, newSeries, {
        dataIndex: newIndex,
        isFrom: true
      });
    }
  });
}
function removeEl(el) {
  if (el.parent) {
    // Bake parent transform to element.
    // So it can still have proper transform to transition after it's removed.
    var computedTransform = el.getComputedTransform();
    el.setLocalTransform(computedTransform);
    el.parent.remove(el);
  }
}
function stopAnimation(el) {
  el.stopAnimation();
  if (el.isGroup) {
    el.traverse(function (child) {
      child.stopAnimation();
    });
  }
}
function animateElementStyles(el, dataIndex, seriesModel) {
  var animationConfig = getAnimationConfig('update', seriesModel, dataIndex);
  animationConfig && el.traverse(function (child) {
    if (child instanceof Displayable$1) {
      var oldStyle = getOldStyle(child);
      if (oldStyle) {
        child.animateFrom({
          style: oldStyle
        }, animationConfig);
      }
    }
  });
}
function isAllIdSame(oldDiffItems, newDiffItems) {
  var len = oldDiffItems.length;
  if (len !== newDiffItems.length) {
    return false;
  }
  for (var i = 0; i < len; i++) {
    var oldItem = oldDiffItems[i];
    var newItem = newDiffItems[i];
    if (oldItem.data.getId(oldItem.dataIndex) !== newItem.data.getId(newItem.dataIndex)) {
      return false;
    }
  }
  return true;
}
function transitionBetween(oldList, newList, api) {
  var oldDiffItems = flattenDataDiffItems(oldList);
  var newDiffItems = flattenDataDiffItems(newList);
  function updateMorphingPathProps(from, to, rawFrom, rawTo, animationCfg) {
    if (rawFrom || from) {
      to.animateFrom({
        style: rawFrom && rawFrom !== from
        // dividingMethod like clone may override the style(opacity)
        // So extend it to raw style.
        ? extend(extend({}, rawFrom.style), from.style) : from.style
      }, animationCfg);
    }
  }
  var hasMorphAnimation = false;
  /**
   * With groupId and childGroupId, we can build parent-child relationships between dataItems.
   * However, we should mind the parent-child "direction" between old and new options.
   *
   * For example, suppose we have two dataItems from two series.data:
   *
   * dataA: [                          dataB: [
   *   {                                 {
   *     value: 5,                         value: 3,
   *     groupId: 'creatures',             groupId: 'animals',
   *     childGroupId: 'animals'           childGroupId: 'dogs'
   *   },                                },
   *   ...                               ...
   * ]                                 ]
   *
   * where dataA is belong to optionA and dataB is belong to optionB.
   *
   * When we `setOption(optionB)` from optionA, we choose childGroupId of dataItemA and groupId of
   * dataItemB as keys so the two keys are matched (both are 'animals'), then universalTransition
   * will work. This derection is "parent -> child".
   *
   * If we `setOption(optionA)` from optionB, we also choose groupId of dataItemB and childGroupId
   * of dataItemA as keys and universalTransition will work. This derection is "child -> parent".
   *
   * If there is no childGroupId specified, which means no multiLevelDrillDown/Up is needed and no
   * parent-child relationship exists. This direction is "none".
   *
   * So we need to know whether to use groupId or childGroupId as the key when we call the keyGetter
   * functions. Thus, we need to decide the direction first.
   *
   * The rule is:
   *
   * if (all childGroupIds in oldDiffItems and all groupIds in newDiffItems have common value) {
   *   direction = 'parent -> child';
   * } else if (all groupIds in oldDiffItems and all childGroupIds in newDiffItems have common value) {
   *   direction = 'child -> parent';
   * } else {
   *   direction = 'none';
   * }
   */
  var direction = TRANSITION_NONE;
  // find all groupIds and childGroupIds from oldDiffItems
  var oldGroupIds = createHashMap();
  var oldChildGroupIds = createHashMap();
  oldDiffItems.forEach(function (item) {
    item.groupId && oldGroupIds.set(item.groupId, true);
    item.childGroupId && oldChildGroupIds.set(item.childGroupId, true);
  });
  // traverse newDiffItems and decide the direction according to the rule
  for (var i = 0; i < newDiffItems.length; i++) {
    var newGroupId = newDiffItems[i].groupId;
    if (oldChildGroupIds.get(newGroupId)) {
      direction = TRANSITION_P2C;
      break;
    }
    var newChildGroupId = newDiffItems[i].childGroupId;
    if (newChildGroupId && oldGroupIds.get(newChildGroupId)) {
      direction = TRANSITION_C2P;
      break;
    }
  }
  function createKeyGetter(isOld, onlyGetId) {
    return function (diffItem) {
      var data = diffItem.data;
      var dataIndex = diffItem.dataIndex;
      // TODO if specified dim
      if (onlyGetId) {
        return data.getId(dataIndex);
      }
      if (isOld) {
        return direction === TRANSITION_P2C ? diffItem.childGroupId : diffItem.groupId;
      } else {
        return direction === TRANSITION_C2P ? diffItem.childGroupId : diffItem.groupId;
      }
    };
  }
  // Use id if it's very likely to be an one to one animation
  // It's more robust than groupId
  // TODO Check if key dimension is specified.
  var useId = isAllIdSame(oldDiffItems, newDiffItems);
  var isElementStillInChart = {};
  if (!useId) {
    // We may have different diff strategy with basicTransition if we use other dimension as key.
    // If so, we can't simply check if oldEl is same with newEl. We need a map to check if oldEl is still being used in the new chart.
    // We can't use the elements that already being morphed. Let it keep it's original basic transition.
    for (var i = 0; i < newDiffItems.length; i++) {
      var newItem = newDiffItems[i];
      var el = newItem.data.getItemGraphicEl(newItem.dataIndex);
      if (el) {
        isElementStillInChart[el.id] = true;
      }
    }
  }
  function updateOneToOne(newIndex, oldIndex) {
    var oldItem = oldDiffItems[oldIndex];
    var newItem = newDiffItems[newIndex];
    var newSeries = newItem.data.hostModel;
    // TODO Mark this elements is morphed and don't morph them anymore
    var oldEl = oldItem.data.getItemGraphicEl(oldItem.dataIndex);
    var newEl = newItem.data.getItemGraphicEl(newItem.dataIndex);
    // Can't handle same elements.
    if (oldEl === newEl) {
      newEl && animateElementStyles(newEl, newItem.dataIndex, newSeries);
      return;
    }
    if (
    // We can't use the elements that already being morphed
    oldEl && isElementStillInChart[oldEl.id]) {
      return;
    }
    if (newEl) {
      // TODO: If keep animating the group in case
      // some of the elements don't want to be morphed.
      // TODO Label?
      stopAnimation(newEl);
      if (oldEl) {
        stopAnimation(oldEl);
        // If old element is doing leaving animation. stop it and remove it immediately.
        removeEl(oldEl);
        hasMorphAnimation = true;
        applyMorphAnimation(getPathList(oldEl), getPathList(newEl), newItem.divide, newSeries, newIndex, updateMorphingPathProps);
      } else {
        fadeInElement(newEl, newSeries, newIndex);
      }
    }
    // else keep oldEl leaving animation.
  }
  new DataDiffer$1(oldDiffItems, newDiffItems, createKeyGetter(true, useId), createKeyGetter(false, useId), null, 'multiple').update(updateOneToOne).updateManyToOne(function (newIndex, oldIndices) {
    var newItem = newDiffItems[newIndex];
    var newData = newItem.data;
    var newSeries = newData.hostModel;
    var newEl = newData.getItemGraphicEl(newItem.dataIndex);
    var oldElsList = filter(map$1(oldIndices, function (idx) {
      return oldDiffItems[idx].data.getItemGraphicEl(oldDiffItems[idx].dataIndex);
    }), function (oldEl) {
      return oldEl && oldEl !== newEl && !isElementStillInChart[oldEl.id];
    });
    if (newEl) {
      stopAnimation(newEl);
      if (oldElsList.length) {
        // If old element is doing leaving animation. stop it and remove it immediately.
        each$f(oldElsList, function (oldEl) {
          stopAnimation(oldEl);
          removeEl(oldEl);
        });
        hasMorphAnimation = true;
        applyMorphAnimation(getPathList(oldElsList), getPathList(newEl), newItem.divide, newSeries, newIndex, updateMorphingPathProps);
      } else {
        fadeInElement(newEl, newSeries, newItem.dataIndex);
      }
    }
    // else keep oldEl leaving animation.
  }).updateOneToMany(function (newIndices, oldIndex) {
    var oldItem = oldDiffItems[oldIndex];
    var oldEl = oldItem.data.getItemGraphicEl(oldItem.dataIndex);
    // We can't use the elements that already being morphed
    if (oldEl && isElementStillInChart[oldEl.id]) {
      return;
    }
    var newElsList = filter(map$1(newIndices, function (idx) {
      return newDiffItems[idx].data.getItemGraphicEl(newDiffItems[idx].dataIndex);
    }), function (el) {
      return el && el !== oldEl;
    });
    var newSeris = newDiffItems[newIndices[0]].data.hostModel;
    if (newElsList.length) {
      each$f(newElsList, function (newEl) {
        return stopAnimation(newEl);
      });
      if (oldEl) {
        stopAnimation(oldEl);
        // If old element is doing leaving animation. stop it and remove it immediately.
        removeEl(oldEl);
        hasMorphAnimation = true;
        applyMorphAnimation(getPathList(oldEl), getPathList(newElsList), oldItem.divide,
        // Use divide on old.
        newSeris, newIndices[0], updateMorphingPathProps);
      } else {
        each$f(newElsList, function (newEl) {
          return fadeInElement(newEl, newSeris, newIndices[0]);
        });
      }
    }
    // else keep oldEl leaving animation.
  }).updateManyToMany(function (newIndices, oldIndices) {
    // If two data are same and both have groupId.
    // Normally they should be diff by id.
    new DataDiffer$1(oldIndices, newIndices, function (rawIdx) {
      return oldDiffItems[rawIdx].data.getId(oldDiffItems[rawIdx].dataIndex);
    }, function (rawIdx) {
      return newDiffItems[rawIdx].data.getId(newDiffItems[rawIdx].dataIndex);
    }).update(function (newIndex, oldIndex) {
      // Use the original index
      updateOneToOne(newIndices[newIndex], oldIndices[oldIndex]);
    }).execute();
  }).execute();
  if (hasMorphAnimation) {
    each$f(newList, function (_a) {
      var data = _a.data;
      var seriesModel = data.hostModel;
      var view = seriesModel && api.getViewOfSeriesModel(seriesModel);
      var animationCfg = getAnimationConfig('update', seriesModel, 0); // use 0 index.
      if (view && seriesModel.isAnimationEnabled() && animationCfg && animationCfg.duration > 0) {
        view.group.traverse(function (el) {
          if (el instanceof Path$1 && !el.animators.length) {
            // We can't accept there still exists element that has no animation
            // if universalTransition is enabled
            el.animateFrom({
              style: {
                opacity: 0
              }
            }, animationCfg);
          }
        });
      }
    });
  }
}
function getSeriesTransitionKey(series) {
  var seriesKey = series.getModel('universalTransition').get('seriesKey');
  if (!seriesKey) {
    // Use series id by default.
    return series.id;
  }
  return seriesKey;
}
function convertArraySeriesKeyToString(seriesKey) {
  if (isArray$1(seriesKey)) {
    // Order independent.
    return seriesKey.sort().join(',');
  }
  return seriesKey;
}
function getDivideShapeFromData(data) {
  if (data.hostModel) {
    return data.hostModel.getModel('universalTransition').get('divideShape');
  }
}
function findTransitionSeriesBatches(globalStore, params) {
  var updateBatches = createHashMap();
  var oldDataMap = createHashMap();
  // Map that only store key in array seriesKey.
  // Which is used to query the old data when transition from one to multiple series.
  var oldDataMapForSplit = createHashMap();
  each$f(globalStore.oldSeries, function (series, idx) {
    var oldDataGroupId = globalStore.oldDataGroupIds[idx];
    var oldData = globalStore.oldData[idx];
    var transitionKey = getSeriesTransitionKey(series);
    var transitionKeyStr = convertArraySeriesKeyToString(transitionKey);
    oldDataMap.set(transitionKeyStr, {
      dataGroupId: oldDataGroupId,
      data: oldData
    });
    if (isArray$1(transitionKey)) {
      // Same key can't in different array seriesKey.
      each$f(transitionKey, function (key) {
        oldDataMapForSplit.set(key, {
          key: transitionKeyStr,
          dataGroupId: oldDataGroupId,
          data: oldData
        });
      });
    }
  });
  function checkTransitionSeriesKeyDuplicated(transitionKeyStr) {
    if (updateBatches.get(transitionKeyStr)) {
      warn("Duplicated seriesKey in universalTransition " + transitionKeyStr);
    }
  }
  each$f(params.updatedSeries, function (series) {
    if (series.isUniversalTransitionEnabled() && series.isAnimationEnabled()) {
      var newDataGroupId = series.get('dataGroupId');
      var newData = series.getData();
      var transitionKey = getSeriesTransitionKey(series);
      var transitionKeyStr = convertArraySeriesKeyToString(transitionKey);
      // Only transition between series with same id.
      var oldData = oldDataMap.get(transitionKeyStr);
      // string transition key is the best match.
      if (oldData) {
        {
          checkTransitionSeriesKeyDuplicated(transitionKeyStr);
        }
        // TODO check if data is same?
        updateBatches.set(transitionKeyStr, {
          oldSeries: [{
            dataGroupId: oldData.dataGroupId,
            divide: getDivideShapeFromData(oldData.data),
            data: oldData.data
          }],
          newSeries: [{
            dataGroupId: newDataGroupId,
            divide: getDivideShapeFromData(newData),
            data: newData
          }]
        });
      } else {
        // Transition from multiple series.
        // e.g. 'female', 'male' -> ['female', 'male']
        if (isArray$1(transitionKey)) {
          {
            checkTransitionSeriesKeyDuplicated(transitionKeyStr);
          }
          var oldSeries_1 = [];
          each$f(transitionKey, function (key) {
            var oldData = oldDataMap.get(key);
            if (oldData.data) {
              oldSeries_1.push({
                dataGroupId: oldData.dataGroupId,
                divide: getDivideShapeFromData(oldData.data),
                data: oldData.data
              });
            }
          });
          if (oldSeries_1.length) {
            updateBatches.set(transitionKeyStr, {
              oldSeries: oldSeries_1,
              newSeries: [{
                dataGroupId: newDataGroupId,
                data: newData,
                divide: getDivideShapeFromData(newData)
              }]
            });
          }
        } else {
          // Try transition to multiple series.
          // e.g. ['female', 'male'] -> 'female', 'male'
          var oldData_1 = oldDataMapForSplit.get(transitionKey);
          if (oldData_1) {
            var batch = updateBatches.get(oldData_1.key);
            if (!batch) {
              batch = {
                oldSeries: [{
                  dataGroupId: oldData_1.dataGroupId,
                  data: oldData_1.data,
                  divide: getDivideShapeFromData(oldData_1.data)
                }],
                newSeries: []
              };
              updateBatches.set(oldData_1.key, batch);
            }
            batch.newSeries.push({
              dataGroupId: newDataGroupId,
              data: newData,
              divide: getDivideShapeFromData(newData)
            });
          }
        }
      }
    }
  });
  return updateBatches;
}
function querySeries(series, finder) {
  for (var i = 0; i < series.length; i++) {
    var found = finder.seriesIndex != null && finder.seriesIndex === series[i].seriesIndex || finder.seriesId != null && finder.seriesId === series[i].id;
    if (found) {
      return i;
    }
  }
}
function transitionSeriesFromOpt(transitionOpt, globalStore, params, api) {
  var from = [];
  var to = [];
  each$f(normalizeToArray(transitionOpt.from), function (finder) {
    var idx = querySeries(globalStore.oldSeries, finder);
    if (idx >= 0) {
      from.push({
        dataGroupId: globalStore.oldDataGroupIds[idx],
        data: globalStore.oldData[idx],
        // TODO can specify divideShape in transition.
        divide: getDivideShapeFromData(globalStore.oldData[idx]),
        groupIdDim: finder.dimension
      });
    }
  });
  each$f(normalizeToArray(transitionOpt.to), function (finder) {
    var idx = querySeries(params.updatedSeries, finder);
    if (idx >= 0) {
      var data = params.updatedSeries[idx].getData();
      to.push({
        dataGroupId: globalStore.oldDataGroupIds[idx],
        data: data,
        divide: getDivideShapeFromData(data),
        groupIdDim: finder.dimension
      });
    }
  });
  if (from.length > 0 && to.length > 0) {
    transitionBetween(from, to, api);
  }
}
function installUniversalTransition(registers) {
  registers.registerUpdateLifecycle('series:beforeupdate', function (ecMOdel, api, params) {
    each$f(normalizeToArray(params.seriesTransition), function (transOpt) {
      each$f(normalizeToArray(transOpt.to), function (finder) {
        var series = params.updatedSeries;
        for (var i = 0; i < series.length; i++) {
          if (finder.seriesIndex != null && finder.seriesIndex === series[i].seriesIndex || finder.seriesId != null && finder.seriesId === series[i].id) {
            series[i][SERIES_UNIVERSAL_TRANSITION_PROP] = true;
          }
        }
      });
    });
  });
  registers.registerUpdateLifecycle('series:transition', function (ecModel, api, params) {
    // TODO api provide an namespace that can save stuff per instance
    var globalStore = getUniversalTransitionGlobalStore(api);
    // TODO multiple to multiple series.
    if (globalStore.oldSeries && params.updatedSeries && params.optionChanged) {
      // TODO transitionOpt was used in an old implementation and can be removed now
      // Use give transition config if its' give;
      var transitionOpt = params.seriesTransition;
      if (transitionOpt) {
        each$f(normalizeToArray(transitionOpt), function (opt) {
          transitionSeriesFromOpt(opt, globalStore, params, api);
        });
      } else {
        // Else guess from series based on transition series key.
        var updateBatches_1 = findTransitionSeriesBatches(globalStore, params);
        each$f(updateBatches_1.keys(), function (key) {
          var batch = updateBatches_1.get(key);
          transitionBetween(batch.oldSeries, batch.newSeries, api);
        });
      }
      // Reset
      each$f(params.updatedSeries, function (series) {
        // Reset;
        if (series[SERIES_UNIVERSAL_TRANSITION_PROP]) {
          series[SERIES_UNIVERSAL_TRANSITION_PROP] = false;
        }
      });
    }
    // Save all series of current update. Not only the updated one.
    var allSeries = ecModel.getSeries();
    var savedSeries = globalStore.oldSeries = [];
    var savedDataGroupIds = globalStore.oldDataGroupIds = [];
    var savedData = globalStore.oldData = [];
    for (var i = 0; i < allSeries.length; i++) {
      var data = allSeries[i].getData();
      // Only save the data that can have transition.
      // Avoid large data costing too much extra memory
      if (data.count() < DATA_COUNT_THRESHOLD) {
        savedSeries.push(allSeries[i]);
        savedDataGroupIds.push(allSeries[i].get('dataGroupId'));
        savedData.push(data);
      }
    }
  });
}

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// -----------------
// Render engines
// -----------------
// Render via Canvas.
// echarts.init(dom, null, { renderer: 'canvas' })
use([install$T]);
// Render via SVG.
// echarts.init(dom, null, { renderer: 'svg' })
use([install$U]);
// ----------------
// Charts (series)
// ----------------
// All of the series types, for example:
// chart.setOption({
//     series: [{
//         type: 'line' // or 'bar', 'pie', ...
//     }]
// });
use([install$S, install$R, install$Q, install$O, install$M, install$K, install$J, install$I, install$H, install$G, install$F, install$D, install$C, install$B, install$A, install$z, install$y, install$x, install$w, install$v, install$u, install$t]);
// -------------------
// Coordinate systems
// -------------------
// All of the axis modules have been included in the
// coordinate system module below, do not need to
// make extra import.
// `cartesian` coordinate system. For some historical
// reasons, it is named as grid, for example:
// chart.setOption({
//     grid: {...},
//     xAxis: {...},
//     yAxis: {...},
//     series: [{...}]
// });
use(install$r);
// `polar` coordinate system, for example:
// chart.setOption({
//     polar: {...},
//     radiusAxis: {...},
//     angleAxis: {...},
//     series: [{
//         coordinateSystem: 'polar'
//     }]
// });
use(install$q);
// `geo` coordinate system, for example:
// chart.setOption({
//     geo: {...},
//     series: [{
//         coordinateSystem: 'geo'
//     }]
// });
use(install$L);
// `singleAxis` coordinate system (notice, it is a coordinate system
// with only one axis, work for chart like theme river), for example:
// chart.setOption({
//     singleAxis: {...}
//     series: [{type: 'themeRiver', ...}]
// });
use(install$p);
// `parallel` coordinate system, only work for parallel series, for example:
// chart.setOption({
//     parallel: {...},
//     parallelAxis: [{...}, ...],
//     series: [{
//         type: 'parallel'
//     }]
// });
use(install$E);
// `calendar` coordinate system. for example,
// chart.setOption({
//     calendar: {...},
//     series: [{
//         coordinateSystem: 'calendar'
//     }]
// );
use(install$o);
// ------------------
// Other components
// ------------------
// `graphic` component, for example:
// chart.setOption({
//     graphic: {...}
// });
use(install$n);
// `toolbox` component, for example:
// chart.setOption({
//     toolbox: {...}
// });
use(install$l);
// `tooltip` component, for example:
// chart.setOption({
//     tooltip: {...}
// });
use(install$k);
// `axisPointer` component, for example:
// chart.setOption({
//     tooltip: {axisPointer: {...}, ...}
// });
// Or
// chart.setOption({
//     axisPointer: {...}
// });
use(install$s);
// `brush` component, for example:
// chart.setOption({
//     brush: {...}
// });
// Or
// chart.setOption({
//     tooltip: {feature: {brush: {...}}
// })
use(install$j);
// `title` component, for example:
// chart.setOption({
//     title: {...}
// });
use(install$i);
// `timeline` component, for example:
// chart.setOption({
//     timeline: {...}
// });
use(install$h);
// `markPoint` component, for example:
// chart.setOption({
//     series: [{markPoint: {...}}]
// });
use(install$g);
// `markLine` component, for example:
// chart.setOption({
//     series: [{markLine: {...}}]
// });
use(install$f);
// `markArea` component, for example:
// chart.setOption({
//     series: [{markArea: {...}}]
// });
use(install$e);
// `legend` component not scrollable. for example:
// chart.setOption({
//     legend: {...}
// });
use(install$b);
// `dataZoom` component including both `dataZoomInside` and `dataZoomSlider`.
use(install$8);
// `dataZoom` component providing drag, pinch, wheel behaviors
// inside coordinate system, for example:
// chart.setOption({
//     dataZoom: {type: 'inside'}
// });
use(install$a);
// `dataZoom` component providing a slider bar, for example:
// chart.setOption({
//     dataZoom: {type: 'slider'}
// });
use(install$9);
// `visualMap` component including both `visualMapContinuous` and `visualMapPiecewise`.
use(install$5);
// `visualMap` component providing continuous bar, for example:
// chart.setOption({
//     visualMap: {type: 'continuous'}
// });
use(install$7);
// `visualMap` component providing pieces bar, for example:
// chart.setOption({
//     visualMap: {type: 'piecewise'}
// });
use(install$6);
// `aria` component providing aria, for example:
// chart.setOption({
//     aria: {...}
// });
use(install$4);
// dataset transform
// chart.setOption({
//     dataset: {
//          transform: []
//     }
// });
use(install$3);
use(install$2);
// universal transition
// chart.setOption({
//     series: {
//         universalTransition: { enabled: true }
//     }
// })
use(installUniversalTransition);
// label layout
// chart.setOption({
//     series: {
//         labelLayout: { hideOverlap: true }
//     }
// })
use(installLabelLayout);

//
require('echarts/theme/macarons');
var script$v = {
  name: 'XmlKnowledgeGraph',
  props: {
    model: {
      type: Object,
      default: () => ({})
    },
    tooltip: {
      type: Boolean,
      default: false
    },
    visible: {
      type: Boolean,
      default: false
    },
    switchable: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      chart: null,
      isMounted: false,
      // 是否已挂载
      prevHighlight: -1
    };
  },
  computed: {
    nodes: function () {
      let nodes = this.model.nodes || [];
      return nodes.map(node => {
        let item = {
          id: node.id + '',
          name: node.name,
          category: node.id + '' === this.model.id + '' ? 'main' : this.model.subNodeIds.includes(node.id) ? 'sub' : 'leaf',
          value: node.description || ''
        };
        if (node.id + '' === this.model.id + '') {
          item.x = '50%';
          item.y = '50%';
        }
        return item;
      });
    },
    links: function () {
      let links = this.model.links || [];
      return links.map(link => {
        return {
          source: link.start + '',
          target: link.end + ''
        };
      });
    }
  },
  watch: {
    model: {
      handler(val) {
        if (this.chart) {
          this.chart.off('click', this.nodeClick);
          this.chart.dispose();
          this.chart = null;
          this.prevHighlight = -1;
        }
        this.runWhenMounted(() => {
          this.initChart();
        });
      },
      deep: true,
      immediate: true
    },
    visible: {
      handler(val) {
        if (val) {
          if (this.chart) {
            this.chart.resize();
          }
        }
      },
      immediate: true
    }
  },
  mounted() {
    this.isMounted = true;
    this.$nextTick(() => {
      this.initChart();
    });
  },
  beforeDestroy() {
    if (!this.chart) {
      return;
    }
    this.chart.off('click', this.nodeClick);
    this.chart.dispose();
    this.chart = null;
    this.prevHighlight = -1;
  },
  methods: {
    runWhenMounted(fn) {
      if (this.isMounted) {
        fn();
      } else {
        setTimeout(() => {
          this.runWhenMounted(fn);
        }, 100);
      }
    },
    initChart() {
      this.chart = init$1(this.$el, 'macarons');
      this.chart.setOption({
        tooltip: this.tooltip ? {
          trigger: 'item',
          padding: 0,
          backgroundColor: 'rgba(255,255,255,0)',
          formatter: function (params) {
            let div = document.createElement('div');
            let inner = `
              <div style="width:300px;max-height:500px;background-color:rgba(255,255,255,0.85);overflow-y:auto;color:#333;padding:12px 10px;border-radius:8px;white-space: normal;">
                <div style="display:flex;align-items:center;padding-left:4px;">
                  <span style="display:inline-block;width:8px;height:8px;border-radius:50%;background-color:#009dff;margin-right:6px;"></span>
                  <span style="font-size:14px;font-weight:600;">${params.name}</span>
                </div>
                <p style="width:100%;word-break:break-all;margin-top:4px;">${params.value}</p>
              </div>
            `;
            div.innerHTML = inner;
            return div;
          },
          textStyle: {
            overflow: 'breakAll'
          },
          confine: true
        } : {
          show: false
        },
        series: [{
          name: this.model.name,
          type: 'graph',
          layout: 'force',
          data: this.nodes,
          links: this.links,
          roam: true,
          label: {
            show: true
          },
          labelLayout: {
            hideOverlap: true
          },
          force: {
            repulsion: 200,
            gravity: 0.06,
            edgeLength: 50
          },
          lineStyle: {
            color: '#8CD0DC'
          },
          categories: [{
            name: 'main',
            symbolSize: 48,
            itemStyle: {
              color: '#199FB3',
              borderColor: '#BAE2E8',
              borderWidth: 8
            },
            label: {
              color: '#FFF',
              fontSize: 14,
              overflow: 'truncate'
            }
          }, {
            name: 'sub',
            symbolSize: 36,
            itemStyle: {
              color: '#FFF',
              borderColor: '#19A1B9',
              borderWidth: 2
            },
            label: {
              position: 'bottom',
              offset: [0, 36],
              color: '#47B3C7',
              fontSize: 13,
              overflow: 'truncate'
            }
          }, {
            name: 'leaf',
            symbolSize: 32,
            itemStyle: {
              color: '#ECF7F5',
              borderColor: '#83D5DF',
              borderWidth: 3,
              shadowColor: '#00A7BF'
            },
            label: {
              color: '#47B3C7',
              fontSize: 12,
              position: 'bottom',
              overflow: 'truncate'
            }
          }]
        }]
      });
      this.chart.on('click', {
        dataType: 'node'
      }, this.nodeClick);
    },
    nodeClick(params) {
      if (this.switchable) {
        if (this.prevHighlight !== -1) {
          this.chart.dispatchAction({
            type: 'downplay',
            seriesIndex: 0,
            dataIndex: this.prevHighlight
          });
        }
        this.chart.dispatchAction({
          type: 'highlight',
          seriesIndex: 0,
          dataIndex: params.dataIndex
        });
        this.prevHighlight = params.dataIndex;
        this.$emit('switch', params.data);
      }
    }
  }
};

/* script */
const __vue_script__$v = script$v;
/* template */
var __vue_render__$v = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("section", { staticClass: "xml-knowledge-graph" })
};
var __vue_staticRenderFns__$v = [];
__vue_render__$v._withStripped = true;

  /* style */
  const __vue_inject_styles__$v = undefined;
  /* scoped */
  const __vue_scope_id__$v = "data-v-5d927fbc";
  /* module identifier */
  const __vue_module_identifier__$v = undefined;
  /* functional template */
  const __vue_is_functional_template__$v = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$v = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$v, staticRenderFns: __vue_staticRenderFns__$v },
    __vue_inject_styles__$v,
    __vue_script__$v,
    __vue_scope_id__$v,
    __vue_is_functional_template__$v,
    __vue_module_identifier__$v,
    false,
    undefined,
    undefined,
    undefined
  );

/* istanbul ignore next */
__vue_component__$v.install = function (Vue) {
  Vue.component(__vue_component__$v.name, __vue_component__$v);
};

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$u = {
  name: 'XmlGraphViewer',
  props: {
    model: {
      type: Object,
      default: () => ({})
    },
    title: {
      type: String,
      default: ''
    },
    mode: {
      type: String,
      default: 'node'
    },
    indexs: {
      type: Array,
      default: () => []
    },
    withLevel: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      windowWidth: window.innerWidth,
      show: false,
      loading: true,
      // 遮罩层
      currentDesc: '',
      currentName: '',
      currentLevel: 3
    };
  },
  computed: {
    mainDesc() {
      let nodes = this.model.nodes || [];
      let main = nodes.find(item => item.id + '' === this.model.id + '');
      if (main) {
        return main.description;
      }
      return '';
    }
  },
  methods: {
    jump2Index(index) {
      // console.log("%c%s","font-size:2em;background: #00965E;color: #FFF",'jump',item)
      this.closeDialog();
      this.$emit('jump', index);
    },
    onNodeSwitch(data) {
      this.currentDesc = data.value;
      this.currentName = data.name;
      this.$emit('updateIndexs', data.id);
    },
    doChangeLevel(e) {
      this.currentLevel = e;
      console.log("%c%s", "font-size:2em;background: #00965E;color: #FFF", 'change', e);
      this.$emit('levelChange', e);
    },
    close() {
      this.$emit('closed');
    },
    open() {
      this.show = true;
    },
    // 关闭
    closeDialog() {
      this.show = false;
    }
  }
};

/* script */
const __vue_script__$u = script$u;
/* template */
var __vue_render__$u = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      staticClass: "ou-modal graph-modal",
      attrs: {
        title: _vm.title,
        visible: _vm.show,
        width: _vm.mode === "book" ? "880px" : "720px",
        "append-to-body": "",
        "destroy-on-close": true,
      },
      on: {
        "update:visible": function ($event) {
          _vm.show = $event;
        },
        close: _vm.close,
      },
    },
    [
      _c(
        "div",
        { staticClass: "mate-title", attrs: { slot: "title" }, slot: "title" },
        [
          _c("div", { staticClass: "mate-text" }, [
            _vm._v(
              _vm._s(
                _vm.mode === "book" ? "知识图谱" : _vm.title || _vm.model.name
              )
            ),
          ]),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "mate-dropdown" },
            [
              _vm.withLevel
                ? _c(
                    "el-dropdown",
                    { on: { command: _vm.doChangeLevel } },
                    [
                      _c("span", { staticClass: "el-dropdown-link" }, [
                        _vm._v(
                          "\n          " + _vm._s(_vm.currentLevel) + "级"
                        ),
                        _c("i", {
                          staticClass: "el-icon-arrow-down el-icon--right",
                        }),
                      ]),
                      _vm._v(" "),
                      _c(
                        "el-dropdown-menu",
                        { attrs: { slot: "dropdown" }, slot: "dropdown" },
                        [
                          _c("el-dropdown-item", { attrs: { command: 2 } }, [
                            _vm._v("2级"),
                          ]),
                          _vm._v(" "),
                          _c("el-dropdown-item", { attrs: { command: 3 } }, [
                            _vm._v("3级"),
                          ]),
                          _vm._v(" "),
                          _c("el-dropdown-item", { attrs: { command: 4 } }, [
                            _vm._v("4级"),
                          ]),
                        ],
                        1
                      ),
                    ],
                    1
                  )
                : _vm._e(),
            ],
            1
          ),
        ]
      ),
      _vm._v(" "),
      _vm.mode === "book"
        ? [
            _c(
              "div",
              { staticClass: "graph-viewer", staticStyle: { height: "680px" } },
              [
                _vm.show && _vm.model.id
                  ? _c("XmlKnowledgeGraph", {
                      attrs: { model: _vm.model, tooltip: "" },
                    })
                  : _vm._e(),
              ],
              1
            ),
          ]
        : [
            _c("div", { staticClass: "graph-viewer" }, [
              _c("div", { staticClass: "graph-viewer__wrap" }, [
                _c("div", { staticClass: "graph-viewer__main" }, [
                  _c("div", { staticStyle: { width: "68%" } }, [
                    _c("div", { staticClass: "box-title" }, [
                      _vm._v("知识图谱"),
                    ]),
                    _vm._v(" "),
                    _c(
                      "div",
                      { staticStyle: { width: "100%", height: "380px" } },
                      [
                        _vm.model.id
                          ? _c("XmlKnowledgeGraph", {
                              attrs: {
                                model: _vm.model,
                                tooltip: "",
                                switchable: "",
                              },
                              on: { switch: _vm.onNodeSwitch },
                            })
                          : _vm._e(),
                      ],
                      1
                    ),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    {
                      staticStyle: {
                        flex: "1",
                        "min-width": "0",
                        "margin-left": "10px",
                        display: "flex",
                        "flex-direction": "column",
                      },
                    },
                    [
                      _c("div", { staticClass: "box-title" }, [
                        _vm._v(
                          "释义 " +
                            _vm._s(
                              _vm.currentName &&
                                _vm.currentName !== _vm.model.name
                                ? " - " + _vm.currentName
                                : ""
                            )
                        ),
                      ]),
                      _vm._v(" "),
                      _c(
                        "div",
                        { staticStyle: { flex: "1", "min-height": "0" } },
                        [_vm._v(_vm._s(_vm.currentDesc || _vm.mainDesc))]
                      ),
                    ]
                  ),
                ]),
              ]),
            ]),
          ],
    ],
    2
  )
};
var __vue_staticRenderFns__$u = [];
__vue_render__$u._withStripped = true;

  /* style */
  const __vue_inject_styles__$u = undefined;
  /* scoped */
  const __vue_scope_id__$u = "data-v-ae2f5982";
  /* module identifier */
  const __vue_module_identifier__$u = undefined;
  /* functional template */
  const __vue_is_functional_template__$u = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$u = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$u, staticRenderFns: __vue_staticRenderFns__$u },
    __vue_inject_styles__$u,
    __vue_script__$u,
    __vue_scope_id__$u,
    __vue_is_functional_template__$u,
    __vue_module_identifier__$u,
    false,
    undefined,
    undefined,
    undefined
  );

/* istanbul ignore next */
__vue_component__$u.install = function (Vue) {
  Vue.component(__vue_component__$u.name, __vue_component__$u);
};

//
//
//
//
//
//
//
//
//
//
//

var script$t = {
  name: 'xmlPopup',
  props: {
    position: {
      //弹窗方向top、bottom、left、right、center
      type: String,
      default: 'bottom'
    },
    round: {
      type: Boolean,
      default: true
    }
  },
  watch: {
    show(val) {
      if (val) {
        this.showPopup = true;
      } else {
        setTimeout(() => {
          this.showPopup = false;
        }, 300);
      }
    }
  },
  data() {
    return {
      showPopup: false,
      show: false
    };
  },
  computed: {
    styleData() {
      let data = {};
      if (this.position == 'top') {
        data = {
          'align-items': 'center'
        };
      } else if (this.position == 'bottom') {
        data = {
          'justify-content': 'flex-end',
          'align-items': 'cneter'
        };
      } else if (this.position == 'left') {
        data = {
          'justify-content': 'center'
        };
      } else if (this.position == 'right') {
        data = {
          'justify-content': 'center',
          'align-items': 'flex-end'
        };
      } else if (this.position == 'center') {
        data = {
          'justify-content': 'center',
          'align-items': 'center'
        };
      }
      return data;
    }
  },
  methods: {
    close() {
      this.$emit('close');
    }
  },
  created() {},
  mounted() {}
};

/* script */
const __vue_script__$t = script$t;
/* template */
var __vue_render__$t = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "van-popup",
    {
      attrs: { round: _vm.round, position: _vm.position },
      on: { close: _vm.close },
      model: {
        value: _vm.show,
        callback: function ($$v) {
          _vm.show = $$v;
        },
        expression: "show",
      },
    },
    [
      _c("div", { staticClass: "xml-popup-content" }, [
        _c("div", { staticClass: "content" }, [_vm._t("default")], 2),
      ]),
    ]
  )
};
var __vue_staticRenderFns__$t = [];
__vue_render__$t._withStripped = true;

  /* style */
  const __vue_inject_styles__$t = undefined;
  /* scoped */
  const __vue_scope_id__$t = "data-v-40983ba8";
  /* module identifier */
  const __vue_module_identifier__$t = undefined;
  /* functional template */
  const __vue_is_functional_template__$t = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$t = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$t, staticRenderFns: __vue_staticRenderFns__$t },
    __vue_inject_styles__$t,
    __vue_script__$t,
    __vue_scope_id__$t,
    __vue_is_functional_template__$t,
    __vue_module_identifier__$t,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$s = {
  name: 'xmlCollapse',
  props: {
    title: {
      type: String,
      default: ''
    },
    name: {
      type: Number,
      default: 0
    },
    current: {
      type: Number,
      default: 0
    },
    className: {
      type: String,
      default: ''
    }
  },
  data() {
    return {};
  },
  methods: {},
  created() {},
  mounted() {}
};

/* script */
const __vue_script__$s = script$s;
/* template */
var __vue_render__$s = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "xml-collapse-content" }, [
    _c("div", { staticClass: "xml-collapse-item" }, [
      _c(
        "div",
        {
          staticClass: "collapse-top",
          on: {
            click: function ($event) {
              $event.stopPropagation();
              return _vm.$emit(
                "collapseClick",
                _vm.name != _vm.current ? _vm.name : -1
              )
            },
          },
        },
        [
          _c("div", { staticClass: "collapse-title" }, [
            _vm._v(_vm._s(_vm.title)),
          ]),
          _vm._v(" "),
          _c("i", {
            staticClass: "el-icon-arrow-down",
            class: _vm.name == _vm.current ? "collapse" : "",
          }),
        ]
      ),
      _vm._v(" "),
      _vm.name == _vm.current
        ? _c(
            "div",
            { staticClass: "collapse-content", class: _vm.className },
            [_vm._t("default")],
            2
          )
        : _vm._e(),
    ]),
  ])
};
var __vue_staticRenderFns__$s = [];
__vue_render__$s._withStripped = true;

  /* style */
  const __vue_inject_styles__$s = undefined;
  /* scoped */
  const __vue_scope_id__$s = "data-v-d455a6a0";
  /* module identifier */
  const __vue_module_identifier__$s = undefined;
  /* functional template */
  const __vue_is_functional_template__$s = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$s = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$s, staticRenderFns: __vue_staticRenderFns__$s },
    __vue_inject_styles__$s,
    __vue_script__$s,
    __vue_scope_id__$s,
    __vue_is_functional_template__$s,
    __vue_module_identifier__$s,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

// 拖拽状态 true：下拉  false：上拉
let SCROLLSTATUS;
var script$r = {
  name: 'xmlWrapperPage',
  props: {
    // 能够拖拽的最大距离
    maxDistance: {
      type: Number,
      default: 120
    },
    // 定义触发加载刷新事件的拉伸长度
    triggerDistance: {
      type: Number,
      default: 100
    },
    isFirstOne: {
      // 是否是第一章
      type: Boolean,
      default: false
    },
    isLastOne: {
      // 是否是最后一章
      type: Boolean,
      default: false
    },
    showToast: {
      type: Function,
      default: null
    }
  },
  data() {
    return {
      startLocation: '',
      // 记录触摸开始的位置
      moveDistance: 0,
      // 记录移动的位置
      isTransition: false,
      // 是否启动transition
      isRotate: false,
      // 是否选择箭头
      isShrinked: false,
      // 是否收缩完成
      isTop: false,
      isBottom: false,
      isFlippingPages: false,
      //是否可以翻页
      startTime: 0 //触摸开始时间
    };
  },
  mounted() {},
  methods: {
    // 获取手指触屏时的屏幕Y轴位置
    handlerTouchStart(e) {
      this.startTime = new Date().getTime();
      let xmlPreviewDom = document.getElementById('xmlPreviewDom');
      this.isTop = false;
      this.isBottom = false;
      this.isFlippingPages = true;
      if (xmlPreviewDom.scrollTop == 0) {
        this.isTop = true;
      }
      if (xmlPreviewDom.scrollHeight < xmlPreviewDom.scrollTop + xmlPreviewDom.offsetHeight + 2) {
        this.isBottom = true;
      }
      this.isTransition = false;
      this.startLocation = e.touches[0].pageY;
      // 重置箭头反转
      this.isRotate = false;
      // 重置箭头
      this.isShrinked = false;
      //   触摸500毫秒后，代表长按 禁用拖拽
      setTimeout(() => {
        this.isFlippingPages = false;
      }, 500);
    },
    // 获取手指移动的距离
    handlerTouchMove(e) {
      if (!this.isFlippingPages) return;
      if (this.moveDistance > this.maxDistance + 1 || -this.moveDistance > this.maxDistance + 1) {
        this.isRotate = true;
        return;
      }
      this.moveDistance = Math.floor((e.touches[0].pageY - this.startLocation) / 2);
      // console.log(this.moveDistance)
      if (this.moveDistance > 0 && this.isTop || this.moveDistance < 0 && this.isBottom) {
        this.$refs.scrollContainer.style.transform = `translateY(${this.moveDistance}px)`;
      } else {
        this.moveDistance = 0;
      }
    },
    // 获取手指松开的Y轴位置
    handlerTouchEnd(e) {
      // 记录拖拽状态是为上拉还是下拉
      SCROLLSTATUS = this.moveDistance > 0;
      this.isTransition = true; // 开启transition

      this.isFlippingPages = true;
      let endTime = new Date().getTime() - this.startTime;
      if (Math.abs(this.moveDistance) < this.triggerDistance || !this.isTop && !this.isBottom || endTime < 300 || this.isFirstOne && SCROLLSTATUS || this.isLastOne && !SCROLLSTATUS) {
        this.$refs.scrollContainer.style.transform = 'translateY(0px)';
        this.moveDistance = 0;
      } else {
        // 拖拽距离是否大于指定的触发长度
        // 容器位置恢复后触发
        setTimeout(() => {
          setTimeout(() => {
            this.moveDistance = 0;
            this.$refs.scrollContainer.style.transform = 'translateY(0px)';
          }, 200);
          this.shrinked();
        }, 700);
      }
    },
    // 容器恢复后的操作
    shrinked() {
      //   this.showToast(SCROLLSTATUS)
      if (SCROLLSTATUS) {
        // 下拉刷新业务逻辑
        // 已经恢复完，箭头转为加载
        this.isShrinked = true;
        this.$emit('previousChapter');
      } else {
        // 上拉加载业务逻辑
        this.$emit('nextChapter');
      }
    }
  }
};

/* script */
const __vue_script__$r = script$r;
/* template */
var __vue_render__$r = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "xml-drag-and-drop-loading" }, [
    _c(
      "div",
      {
        ref: "scrollContainer",
        class: { transition: _vm.isTransition },
        attrs: { id: "xml-scroll-container" },
        on: {
          touchstart: function ($event) {
            $event.stopPropagation();
            return _vm.handlerTouchStart.apply(null, arguments)
          },
          touchmove: function ($event) {
            $event.stopPropagation();
            return _vm.handlerTouchMove.apply(null, arguments)
          },
          touchend: function ($event) {
            $event.stopPropagation();
            return _vm.handlerTouchEnd.apply(null, arguments)
          },
        },
      },
      [
        _c(
          "div",
          { staticClass: "xml-loading-text", attrs: { id: "up-loading-text" } },
          [
            _c(
              "span",
              {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: !_vm.isTransition,
                    expression: "!isTransition",
                  },
                ],
              },
              [
                _vm._v(
                  _vm._s(
                    _vm.isFirstOne
                      ? "已经是第一章啦"
                      : _vm.triggerDistance < _vm.moveDistance
                      ? "释放即可加载上一章"
                      : "继续上拉加载上一章"
                  )
                ),
              ]
            ),
            _vm._v(" "),
            _c(
              "span",
              {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: _vm.isTransition,
                    expression: "isTransition",
                  },
                ],
              },
              [_vm._v("加载中"), _c("i", { staticClass: "el-icon-loading" })]
            ),
          ]
        ),
        _vm._v(" "),
        _vm._t("default"),
        _vm._v(" "),
        _c(
          "div",
          {
            staticClass: "xml-loading-text",
            attrs: { id: "down-loading-text" },
          },
          [
            _c(
              "span",
              {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: !_vm.isTransition,
                    expression: "!isTransition",
                  },
                ],
              },
              [
                _vm._v(
                  _vm._s(
                    _vm.isLastOne
                      ? "已经是最后一章啦"
                      : _vm.triggerDistance < -_vm.moveDistance
                      ? "释放即可加载下一章"
                      : "继续上拉加载下一章"
                  )
                ),
              ]
            ),
            _vm._v(" "),
            _c(
              "span",
              {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: _vm.isTransition,
                    expression: "isTransition",
                  },
                ],
              },
              [_vm._v("加载中"), _c("i", { staticClass: "el-icon-loading" })]
            ),
          ]
        ),
      ],
      2
    ),
  ])
};
var __vue_staticRenderFns__$r = [];
__vue_render__$r._withStripped = true;

  /* style */
  const __vue_inject_styles__$r = undefined;
  /* scoped */
  const __vue_scope_id__$r = undefined;
  /* module identifier */
  const __vue_module_identifier__$r = undefined;
  /* functional template */
  const __vue_is_functional_template__$r = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$r = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$r, staticRenderFns: __vue_staticRenderFns__$r },
    __vue_inject_styles__$r,
    __vue_script__$r,
    __vue_scope_id__$r,
    __vue_is_functional_template__$r,
    __vue_module_identifier__$r,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//

var script$q = {
  name: 'xmlTextOverflow',
  props: {
    info: {
      type: String,
      default: ''
    },
    lineClamp: {
      type: Number,
      default: 3
    },
    hiddenBtn: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      showall: false,
      isBtn: false
    };
  },
  computed: {
    textStyleObject() {
      return {
        'max-height': this.showall ? 'none' : `${1.5 * this.lineClamp}em`
      };
    },
    textClass() {
      let cls = this.showall ? 'showall' : '';
      cls = cls + (this.hiddenBtn ? ' hidden-btn' : '');
      return cls;
    }
  },
  watch: {
    info() {
      this.showall = false;
    }
  },
  mounted() {
    this.$nextTick(() => {
      setTimeout(() => {
        if (this.$refs.textBox.offsetHeight > this.$refs.content.offsetHeight) {
          this.isBtn = true;
        } else {
          this.isBtn = false;
        }
      }, 200);
    });
  }
};

/* script */
const __vue_script__$q = script$q;
/* template */
var __vue_render__$q = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { staticClass: "dp-text-ellipsis-wrapper" }, [
    _c(
      "div",
      {
        ref: "content",
        staticClass: "text",
        class: _vm.textClass,
        style: _vm.textStyleObject,
      },
      [
        _c("label", {
          class: _vm.isBtn ? "btn" : "",
          on: {
            click: function ($event) {
              $event.stopPropagation();
              _vm.showall = !_vm.showall;
            },
          },
        }),
        _vm._v(" "),
        _c("span", { ref: "textBox" }, [_vm._v(_vm._s(_vm.info))]),
      ]
    ),
  ])
};
var __vue_staticRenderFns__$q = [];
__vue_render__$q._withStripped = true;

  /* style */
  const __vue_inject_styles__$q = undefined;
  /* scoped */
  const __vue_scope_id__$q = undefined;
  /* module identifier */
  const __vue_module_identifier__$q = undefined;
  /* functional template */
  const __vue_is_functional_template__$q = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$q = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$q, staticRenderFns: __vue_staticRenderFns__$q },
    __vue_inject_styles__$q,
    __vue_script__$q,
    __vue_scope_id__$q,
    __vue_is_functional_template__$q,
    __vue_module_identifier__$q,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//

var script$p = {
  name: 'xmlWatermarkBg',
  data() {
    return {
      div: null,
      base64: 'url("data:image/png;base64,[encoded data, 8776 characters]")'
    };
  },
  mounted() {
    this.resetWatermark();
    const ob = new MutationObserver(entries => {
      for (const entry of entries) {
        for (const node of entry.removedNodes) {
          if (node === this.div) {
            // 处理删除
            this.resetWatermark();
          }
        }
        if (entry.target === this.div) {
          // 处理修改
          this.resetWatermark();
        }
      }
    });
    ob.observe(this.$refs.xmlWatermarkBg, {
      childList: true,
      subtree: true,
      attributes: true
    });
  },
  methods: {
    resetWatermark() {
      if (!this.$refs.xmlWatermarkBg) {
        return;
      }
      if (this.div) {
        this.div.remove();
      }
      this.div = document.createElement('div');
      this.div.style.position = 'absolute';
      this.div.style.zIndex = 999;
      this.div.style.backgroundImage = this.base64;
      this.div.style.backgroundSize = '50%';
      this.div.style.backgroundRepeat = 'repeat';
      //   this.div.style.backgroundPositionY = 'calc(80vh - 100px)'
      this.div.style.pointerEvents = 'none';
      this.div.style.inset = 0;
      this.$refs.xmlWatermarkBg.appendChild(this.div);
    }
  }
};

/* script */
const __vue_script__$p = script$p;

/* template */
var __vue_render__$p = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { ref: "xmlWatermarkBg" }, [_vm._t("default")], 2)
};
var __vue_staticRenderFns__$p = [];
__vue_render__$p._withStripped = true;

  /* style */
  const __vue_inject_styles__$p = undefined;
  /* scoped */
  const __vue_scope_id__$p = undefined;
  /* module identifier */
  const __vue_module_identifier__$p = undefined;
  /* functional template */
  const __vue_is_functional_template__$p = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$p = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$p, staticRenderFns: __vue_staticRenderFns__$p },
    __vue_inject_styles__$p,
    __vue_script__$p,
    __vue_scope_id__$p,
    __vue_is_functional_template__$p,
    __vue_module_identifier__$p,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$o = {
  name: 'xmlDialog',
  props: {
    show: {
      type: Boolean,
      default: false
    },
    baseUrl: {
      type: String,
      default: ''
    },
    textInfo: {
      type: String,
      default: ''
    },
    pageType: {
      type: String,
      default: 'pc'
    },
    width: {
      type: String,
      default: '800px'
    },
    height: {
      type: String,
      default: '80vh'
    },
    dialogData: {
      type: Object,
      default: () => {}
    },
    fullscreen: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      src: encodeURI('http://ouchn-textbook-public.oss-cn-qingdao.aliyuncs.com/ouchn-test-paper-web/stem-files/faf5276a-e523-4df1-8d11-ac858c954cf3.pdf'),
      loading: false
    };
  },
  methods: {
    onBackClick() {
      this.$emit('handleClose', false);
    },
    open() {
      window.open(this.baseUrl);
    },
    load() {
      console.log('加载完成');
      // this.loading = false
    },
    onerror() {
      console.log('加载失败了');
    }
  }
};

/* script */
const __vue_script__$o = script$o;
/* template */
var __vue_render__$o = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    [
      _vm.pageType == "pc"
        ? _c(
            "el-dialog",
            {
              attrs: {
                title: _vm.textInfo,
                visible: _vm.show,
                width: _vm.width,
                fullscreen: _vm.fullscreen,
                top: "80px",
                "custom-class": "xml-epub-pdf-dialog",
                "modal-append-to-body": "",
                "before-close": _vm.onBackClick,
              },
              on: {
                "update:visible": function ($event) {
                  _vm.show = $event;
                },
              },
            },
            [
              _c(
                "div",
                {
                  staticClass: "xml-heder",
                  attrs: { slot: "title" },
                  slot: "title",
                },
                [
                  _c("div", { staticClass: "title" }, [
                    _vm._v(_vm._s(_vm.textInfo)),
                  ]),
                  _vm._v(" "),
                  _vm.baseUrl && !_vm.fullscreen
                    ? _c(
                        "div",
                        {
                          staticClass: "xml-full-screen",
                          on: { click: _vm.open },
                        },
                        [
                          _c("i", {
                            staticClass: "el-icon-full-screen",
                            attrs: { title: "全屏" },
                          }),
                        ]
                      )
                    : _vm._e(),
                ]
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "mod-config xml-iframe-web-view",
                  staticStyle: { position: "relative" },
                  style: {
                    height: _vm.height,
                    width: "100%",
                    padding: "0px 14px 20px 14px",
                  },
                  attrs: { id: "xmlLooseLeafReader" },
                },
                [
                  _vm.baseUrl && _vm.show
                    ? _c("iframe", {
                        ref: "xmlIframe",
                        staticClass: "xml-view-iframe",
                        attrs: { frameborder: "0", src: _vm.baseUrl },
                        on: { load: _vm.load, error: _vm.onerror },
                      })
                    : _vm.dialogData.textBookData && _vm.show
                    ? _c("xmlLooseLeafReader", {
                        attrs: {
                          textBookData: _vm.dialogData.textBookData,
                          catalogList: _vm.dialogData.catalogList,
                          looseLeaf: _vm.dialogData.looseLeafData,
                          looseLeafId: _vm.dialogData.id,
                          pageType: _vm.pageType,
                          resourceBasisPath: _vm.dialogData.basisPath,
                          systemEnvId: _vm.dialogData.systemEnvId,
                          testPaperPath: _vm.dialogData.testPaperPath,
                        },
                      })
                    : _vm._e(),
                ],
                1
              ),
            ]
          )
        : [
            _vm.show
              ? _c("div", { staticClass: "xml-epub-pdf-view" }, [
                  _c("div", { staticClass: "xmlPreviewSearch-navbar" }, [
                    _c("div", { staticClass: "xmlPreviewSearch-sou" }, [
                      _vm._v(_vm._s(_vm.textInfo)),
                    ]),
                    _vm._v(" "),
                    _c("i", {
                      staticClass: "el-icon-close",
                      on: { click: _vm.onBackClick },
                    }),
                  ]),
                  _vm._v(" "),
                  _c(
                    "div",
                    {
                      staticClass: "mod-config xml-iframe-web-view",
                      staticStyle: {
                        height: "calc(100vh - 60px)",
                        width: "100%",
                      },
                      attrs: { id: "xmlLooseLeafReader" },
                    },
                    [
                      _vm.baseUrl && _vm.show
                        ? _c("iframe", {
                            staticClass: "xml-view-iframe",
                            attrs: { frameborder: "0", src: _vm.baseUrl },
                          })
                        : _vm.dialogData.textBookData && _vm.show
                        ? _c("xmlLooseLeafReader", {
                            attrs: {
                              textBookData: _vm.dialogData.textBookData,
                              catalogList: _vm.dialogData.catalogList,
                              looseLeaf: _vm.dialogData.looseLeafData,
                              looseLeafId: _vm.dialogData.id,
                              pageType: _vm.pageType,
                              resourceBasisPath: _vm.dialogData.basisPath,
                              systemEnvId: _vm.dialogData.systemEnvId,
                              testPaperPath: _vm.dialogData.testPaperPath,
                            },
                          })
                        : _vm._e(),
                    ],
                    1
                  ),
                ])
              : _vm._e(),
          ],
    ],
    2
  )
};
var __vue_staticRenderFns__$o = [];
__vue_render__$o._withStripped = true;

  /* style */
  const __vue_inject_styles__$o = undefined;
  /* scoped */
  const __vue_scope_id__$o = undefined;
  /* module identifier */
  const __vue_module_identifier__$o = undefined;
  /* functional template */
  const __vue_is_functional_template__$o = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$o = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$o, staticRenderFns: __vue_staticRenderFns__$o },
    __vue_inject_styles__$o,
    __vue_script__$o,
    __vue_scope_id__$o,
    __vue_is_functional_template__$o,
    __vue_module_identifier__$o,
    false,
    undefined,
    undefined,
    undefined
  );

const xmlView = [__vue_component__$t, __vue_component__$s, __vue_component__$2V, __vue_component__$r, __vue_component__$q, __vue_component__$p, __vue_component__$o];
var xmlView$1 = {
  // install,
  ...xmlView
};

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$n = {
  name: 'xml-hevue-img-preview',
  data() {
    return {
      // imgWidth: 0,
      // imgHeight: 0,
      visible: false,
      // 插件显示，默认为false
      imgScale: 1,
      imgTop: 0,
      imgLeft: 0,
      imgRotate: 0,
      isFull: false,
      maxWH: window.innerWidth < 1000 ? 'max-width:100%;max-height:100%;' : 'max-width:90%;max-height:86%;',
      clientX: 0,
      clientY: 0,
      imgIndex: 0,
      canRun: true,
      imgurl: '',
      imgState: 1,
      start: [{}, {}],
      mobileScale: 0,
      // 手指离开时图片的缩放比例
      // 以下内容为用户传入配置
      // show: true, // 插件显示，默认为false
      url: '',
      // 预览图片的地址
      nowImgIndex: 0,
      multiple: false,
      imgList: [],
      imgKey: 'url',
      titleKey: 'title',
      imgTitle: '',
      descriptionKey: 'description',
      description: '',
      // 以下为可全局配置
      controlBar: true,
      closeBtn: true,
      arrowBtn: true,
      keyboard: false,
      clickMaskCLose: false,
      // 是否点击遮罩关闭，默认false
      closeFn: null,
      // 关闭回调函数
      changeFn: null,
      // 切换图片回调函数
      isOpen: false
    };
  },
  mounted() {
    this.initImg();
  },
  watch: {
    url() {
      this.initImg();
    },
    visible: {
      handler(newV) {
        if (newV) {
          this.$nextTick(() => {
            let _dom = document.getElementById('hevue-imgpreview-wrap');
            _dom.onmousewheel = this.scrollFunc;
            // 火狐浏览器没有onmousewheel事件，用DOMMouseScroll代替(滚轮事件)
            document.body.addEventListener('DOMMouseScroll', this.scrollFunc);
            // 禁止火狐浏览器下拖拽图片的默认事件
            document.ondragstart = function () {
              return false;
            };
            // 判断是否多图
            if (this.multiple) {
              if (Array.isArray(this.imgList) && this.imgList.length > 0) {
                this.imgIndex = Number(this.nowImgIndex) || 0;
                // this.url = this.imgList[this.imgIndex]
                this.imgTitle = this.imgList[this.imgIndex][this.titleKey];
                this.description = this.imgList[this.imgIndex][this.descriptionKey];
                this.changeUrl(this.imgList[this.imgIndex][this.imgKey], this.imgIndex);
              }
            } else {
              this.changeUrl(this.url);
            }
            // 判断是否开启键盘事件
            if (this.keyboard) {
              document.addEventListener('keydown', this.keyHandleDebounce);
            }
          });
        }
      },
      immediate: true
    }
  },
  methods: {
    show() {
      this.visible = true;
    },
    close(data) {
      this.initImg();
      // this.maxWH = "max-width:100%;max-height:100%;";
      // this.isFull = false;
      // 移除火狐浏览器下的鼠标滚动事件
      document.body.removeEventListener('DOMMouseScroll', this.scrollFunc);
      //恢复火狐及Safari浏览器下的图片拖拽
      document.ondragstart = null;
      // 移除键盘事件
      if (this.keyboard) {
        document.removeEventListener('keydown', this.keyHandleDebounce);
      }
      this.visible = false;
      this.closeFn && this.closeFn(data);
    },
    initImg() {
      this.mobileScale = 1;
      this.imgScale = 1;
      this.imgRotate = 0;
      this.imgTop = 0;
      this.imgLeft = 0;
    },
    /**
     * 切换图片
     * true 下一张
     * false 上一张
     */
    toogleImg(bool, way) {
      let fromIndex = this.imgIndex;
      if (bool) {
        this.imgIndex++;
        if (this.imgIndex > this.imgList.length - 1) {
          this.imgIndex = 0;
        }
      } else {
        this.imgIndex--;
        if (this.imgIndex < 0) {
          this.imgIndex = this.imgList.length - 1;
        }
      }
      this.changeFn && this.changeFn({
        type: bool ? 'next' : 'prev',
        fromImgIndex: fromIndex,
        fromImgUrl: this.imgList[fromIndex],
        toImgIndex: this.imgIndex,
        toImgUrl: this.imgList[this.imgIndex],
        way
      });
      // this.url = this.imgList[this.imgIndex]
      this.imgTitle = this.imgList[this.imgIndex][this.titleKey];
      this.description = this.imgList[this.imgIndex][this.descriptionKey];
      this.changeUrl(this.imgList[this.imgIndex][this.imgKey], this.imgIndex);
    },
    // 改变图片地址
    /**
     * @description:
     * @param {String} url 要显示的图片的url
     * @param {Number} index 当前显示当图片下标，防止用户点击切换图片过快
     * @return {*}
     */
    changeUrl(url, index) {
      this.imgState = 1;
      let img = new Image();
      img.src = url;
      img.onload = () => {
        // 如果加载出来图片当下标不是当前显示图片当下标，则不予显示（用户点击过快当时候，会出现用户点到第三张了，此时第一张图片才加载完当情况）
        if (index != undefined && index == this.imgIndex) {
          this.imgState = 2;
          this.imgurl = url;
        } else if (index == undefined) {
          this.imgState = 2;
          this.imgurl = url;
        }
      };
      img.onerror = () => {
        if (index != undefined && index == this.imgIndex) {
          this.imgState = 3;
        } else if (index == undefined) {
          this.imgState = 3;
        }
      };
    },
    // 旋转图片
    rotateFunc(deg) {
      this.imgRotate += deg;
    },
    // 图片缩放
    scaleFunc(num, bool) {
      if (this.imgScale <= 0.2 && num < 0) return;
      if (bool) {
        this.imgScale = num;
      } else {
        this.imgScale += num;
      }
    },
    // 图片原尺寸切换
    imgToggle() {
      this.initImg();
      if (this.isFull) {
        this.maxWH = window.innerWidth < 1000 ? 'max-width:100%;max-height:100%;' : 'max-width:90%;max-height:86%;';
      } else {
        this.maxWH = '';
      }
      this.isFull = !this.isFull;
    },
    // 鼠标滚轮缩放
    scrollFunc(e) {
      e = e || window.event;
      // e.returnValue = false // ie
      // 火狐下没有wheelDelta，用detail代替，由于detail值的正负和wheelDelta相反，所以取反
      e.delta = e.wheelDelta || -e.detail;
      e.preventDefault();
      if (e.delta > 0) {
        //当滑轮向上滚动时
        this.scaleFunc(0.05);
      }
      if (e.delta < 0) {
        //当滑轮向下滚动时
        this.scaleFunc(-0.05);
      }
    },
    // 鼠标按下
    addMove(e) {
      e = e || window.event;
      this.clientX = e.clientX;
      this.clientY = e.clientY;
      this.$refs.heImg.onmousemove = this.moveFunc;
    },
    // 手指按下事件
    addMoveMobile(e) {
      e.preventDefault();
      e = e || window.event;
      if (e.touches.length > 1) {
        this.start = e.touches;
      } else {
        this.clientX = e.touches[0].pageX;
        this.clientY = e.touches[0].pageY;
      }
      // 添加手指拖动事件
      this.$refs.heImg.ontouchmove = this.moveFuncMobile;
    },
    // 鼠标拖动
    moveFunc(e) {
      e = e || window.event;
      e.preventDefault();
      let movementX = e.clientX - this.clientX;
      let movementY = e.clientY - this.clientY;
      // event.clientY;
      this.imgLeft += movementX * 2;
      this.imgTop += movementY * 2;
      this.clientX = e.clientX;
      this.clientY = e.clientY;
    },
    // 手指拖动
    moveFuncMobile(e) {
      e = e || window.event;
      if (e.touches.length > 1) {
        var now = e.touches;
        var scale = this.getDistance(now[0], now[1]) / this.getDistance(this.start[0], this.start[1]);
        // 判断是否手指缩放过，如果缩放过，要在上次缩放的比例基础上进行缩放
        if (this.mobileScale) {
          if (scale > 1) {
            // 放大
            this.scaleFunc(scale + this.mobileScale - 1, true);
          } else {
            // 缩小
            this.scaleFunc(scale * this.mobileScale, true);
          }
        } else {
          this.scaleFunc(scale, true);
        }
      } else {
        let touch = e.touches[0];
        e.preventDefault();
        let movementX = touch.pageX - this.clientX;
        let movementY = touch.pageY - this.clientY;
        // event.clientY;
        this.imgLeft += movementX * 2;
        this.imgTop += movementY * 2;
        this.clientX = touch.pageX;
        this.clientY = touch.pageY;
      }
    },
    // 移除拖动事件
    removeMove(type) {
      if (type === 'pc') {
        this.$refs.heImg.onmousemove = null;
      } else {
        this.mobileScale = this.imgScale;
        this.$refs.heImg.ontouchmove = null;
      }
    },
    keyHandleDebounce(e) {
      if (this.canRun) {
        // 如果this.canRun为true证明当前可以执行函数
        this.keyHandle(e);
        this.canRun = false; // 执行函数后一段时间内不可再次执行
        setTimeout(() => {
          this.canRun = true; // 等到了我们设定的时间之后，把this.canRun改为true，可以再次执行函数
        }, 300);
      }
    },
    // 键盘事件
    keyHandle(e) {
      e = window.event || e;
      var key = e.keyCode || e.which || e.charCode;
      switch (key) {
        case 27:
          // esc
          this.close({
            way: 'esc'
          });
          break;
        case 65:
          // a键-上一张
          if (this.multiple) {
            this.toogleImg(false, 'key-a');
          }
          break;
        case 68:
          // d键-下一张
          if (this.multiple) {
            this.toogleImg(true, 'key-d');
          }
          break;
        case 87:
          // w键-放大
          this.scaleFunc(0.15);
          break;
        case 83:
          // s键-缩小
          this.scaleFunc(-0.15);
          break;
        case 81:
          // q键-逆时针旋转
          this.rotateFunc(-90);
          break;
        case 69:
          // e键-顺时针旋转
          this.rotateFunc(90);
          break;
        case 82:
          // r键-复位键
          this.initImg();
          break;
      }
    },
    // 点击遮罩层
    clickMask() {
      if (this.clickMaskCLose) {
        this.close({
          way: 'mask'
        });
      }
    },
    //缩放 勾股定理方法-求两点之间的距离
    getDistance(p1, p2) {
      var x = p2.pageX - p1.pageX,
        y = p2.pageY - p1.pageY;
      return Math.sqrt(x * x + y * y);
    },
    /**
     * @description:
     * @param {String} imgsrc
     * @param {*} name
     * @return {*}
     */
    downloadIamge() {
      //下载图片地址和图片名
      let image = new Image();
      // 解决跨域 Canvas 污染问题
      image.setAttribute('crossOrigin', 'anonymous');
      image.onload = function () {
        let canvas = document.createElement('canvas');
        canvas.width = image.width;
        canvas.height = image.height;
        let context = canvas.getContext('2d');
        context.drawImage(image, 0, 0, image.width, image.height);
        let url = canvas.toDataURL('image/png'); //得到图片的base64编码数据
        let a = document.createElement('a'); // 生成一个a元素
        let event = new MouseEvent('click'); // 创建一个单击事件
        a.download = 'photo' + +new Date(); // 设置图片名称
        a.href = url; // 将生成的URL设置为a.href属性
        a.dispatchEvent(event); // 触发a的单击事件
      };
      image.onerror = function (err) {
        console.log('图片信息不正确或图片服务器禁止访问');
        console.log(err);
      };
      if (this.multiple) {
        image.src = this.imgList[this.imgIndex];
      } else {
        image.src = this.url;
      }
    },
    removeStyle(e) {
      if (e) {
        e = e.replace(/<[^>]+>/g, ''); //去除所有标签，以纯文本展示
        e = e.replace(/\s/gi, ''); //去除空格
        e = e.replace(/&nbsp;/gi, ''); //去除空格
        return e;
      } else {
        return '';
      }
    }
  }
};

/* script */
const __vue_script__$n = script$n;

/* template */
var __vue_render__$n = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("transition", { attrs: { name: "fade" } }, [
    _vm.visible
      ? _c(
          "div",
          {
            ref: "heImg",
            staticClass: "xml-hevue-imgpreview-wrap",
            attrs: { id: "hevue-imgpreview-wrap" },
            on: {
              mouseup: function ($event) {
                return _vm.removeMove("pc")
              },
              touchend: function ($event) {
                return _vm.removeMove("mobile")
              },
              click: function ($event) {
                $event.stopPropagation();
                return _vm.clickMask.apply(null, arguments)
              },
            },
          },
          [
            _c("div", { staticClass: "he-img-wrap" }, [
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.removeStyle(_vm.imgTitle) != "暂不支持此公式",
                      expression: "removeStyle(imgTitle)!='暂不支持此公式'",
                    },
                  ],
                  staticClass: "he-control-title",
                },
                [_vm._v(_vm._s(_vm.removeStyle(_vm.imgTitle)))]
              ),
              _vm._v(" "),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.imgState === 1,
                      expression: "imgState === 1",
                    },
                  ],
                  staticClass:
                    "heimgfont hevue-img-status-icon rotate-animation",
                },
                [_vm._v("")]
              ),
              _vm._v(" "),
              _c("img", {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: _vm.imgState === 2,
                    expression: "imgState === 2",
                  },
                ],
                ref: "heImView",
                staticClass: "he-img-view",
                style:
                  "background-color: #fff;" +
                  "transform: scale(" +
                  _vm.imgScale +
                  ") rotate(" +
                  _vm.imgRotate +
                  "deg);margin-top:" +
                  _vm.imgTop +
                  "px;margin-left:" +
                  _vm.imgLeft +
                  "px;" +
                  _vm.maxWH,
                attrs: { src: _vm.imgurl },
                on: {
                  click: function ($event) {
                    $event.stopPropagation();
                  },
                  mousedown: _vm.addMove,
                  touchstart: _vm.addMoveMobile,
                },
              }),
              _vm._v(" "),
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: _vm.imgState === 3,
                      expression: "imgState === 3",
                    },
                  ],
                  staticClass: "heimgfont hevue-img-status-icon",
                },
                [_vm._v("")]
              ),
              _vm._v(" "),
              _vm.closeBtn
                ? _c(
                    "div",
                    {
                      staticClass: "heimgfont he-close-icon",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.close({ way: "closeBtn" })
                        },
                      },
                    },
                    [_vm._v("")]
                  )
                : _vm._e(),
              _vm._v(" "),
              _vm.arrowBtn && _vm.multiple && _vm.imgList.length > 1
                ? _c(
                    "div",
                    {
                      staticClass: "arrow arrow-left heimgfont",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.toogleImg(false, "btn")
                        },
                      },
                    },
                    [_vm._v("\n        \n      ")]
                  )
                : _vm._e(),
              _vm._v(" "),
              _vm.arrowBtn && _vm.multiple && _vm.imgList.length > 1
                ? _c(
                    "div",
                    {
                      staticClass: "arrow arrow-right heimgfont",
                      on: {
                        click: function ($event) {
                          $event.stopPropagation();
                          return _vm.toogleImg(true, "btn")
                        },
                      },
                    },
                    [_vm._v("\n        \n      ")]
                  )
                : _vm._e(),
              _vm._v(" "),
              _vm.controlBar
                ? _c("div", { staticClass: "he-control-bar-wrap" }, [
                    _c(
                      "div",
                      {
                        staticClass: "he-control-bar",
                        on: {
                          click: function ($event) {
                            $event.stopPropagation();
                          },
                        },
                      },
                      [
                        _c(
                          "div",
                          {
                            staticClass: "he-control-btn heimgfont",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.scaleFunc(-0.15)
                              },
                            },
                          },
                          [_vm._v("")]
                        ),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            staticClass: "he-control-btn heimgfont",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.scaleFunc(0.15)
                              },
                            },
                          },
                          [_vm._v("")]
                        ),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: _vm.isFull,
                                expression: "isFull",
                              },
                            ],
                            staticClass: "he-control-btn heimgfont",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.imgToggle.apply(null, arguments)
                              },
                            },
                          },
                          [_vm._v("")]
                        ),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            directives: [
                              {
                                name: "show",
                                rawName: "v-show",
                                value: !_vm.isFull,
                                expression: "!isFull",
                              },
                            ],
                            staticClass: "he-control-btn heimgfont",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.imgToggle.apply(null, arguments)
                              },
                            },
                          },
                          [_vm._v("")]
                        ),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            staticClass: "he-control-btn heimgfont",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.rotateFunc(-90)
                              },
                            },
                          },
                          [_vm._v("")]
                        ),
                        _vm._v(" "),
                        _c(
                          "div",
                          {
                            staticClass: "he-control-btn heimgfont",
                            on: {
                              click: function ($event) {
                                $event.stopPropagation();
                                return _vm.rotateFunc(90)
                              },
                            },
                          },
                          [_vm._v("")]
                        ),
                      ]
                    ),
                  ])
                : _vm._e(),
              _vm._v(" "),
              _vm.controlBar && _vm.multiple
                ? _c("div", { staticClass: "he-control-num" }, [
                    _vm.description
                      ? _c(
                          "div",
                          { staticClass: "briefIntroduction" },
                          [
                            _c("xmlTextOverflow", {
                              attrs: { info: _vm.description },
                            }),
                          ],
                          1
                        )
                      : _vm._e(),
                  ])
                : _vm._e(),
            ]),
          ]
        )
      : _vm._e(),
  ])
};
var __vue_staticRenderFns__$n = [];
__vue_render__$n._withStripped = true;

  /* style */
  const __vue_inject_styles__$n = undefined;
  /* scoped */
  const __vue_scope_id__$n = undefined;
  /* module identifier */
  const __vue_module_identifier__$n = undefined;
  /* functional template */
  const __vue_is_functional_template__$n = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$n = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$n, staticRenderFns: __vue_staticRenderFns__$n },
    __vue_inject_styles__$n,
    __vue_script__$n,
    __vue_scope_id__$n,
    __vue_is_functional_template__$n,
    __vue_module_identifier__$n,
    false,
    undefined,
    undefined,
    undefined
  );

/*
 * @Author: 贺永胜
 * @Date: 2020-04-22 15:40:42
 * @公众号: 百里青山
 * @LastEditors: 贺永胜
 * @LastEditTime: 2022-07-21 16:21:47
 * @Descripttion:
 */
const install$1 = async (app, opts = {}) => {
  console.log('~install');
  if (app && app.version) {
    app.version?.split('.')[0];
  }
  // if (vueVersion > 2) {
  //   let {createApp} = await import("vue");
  //   imgApp = createApp(VueToast)
  //   app.config.globalProperties.$hevueImgPreview = ImgPreview;
  // } else {
  // let _vue = await (await import("vue")).default;
  // imgApp = _vue.extend(VueToast)
  // _vue.prototype.$hevueImgPreview = ImgPreview;
  // }
};
if (typeof window !== 'undefined' && window.Vue) {
  install$1(window.Vue);
}

/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const REVISION='168';const MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};const TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};const CullFaceNone=0;const CullFaceBack=1;const CullFaceFront=2;const PCFShadowMap=1;const PCFSoftShadowMap=2;const VSMShadowMap=3;const FrontSide$1=0;const BackSide$1=1;const DoubleSide=2;const NoBlending=0;const NormalBlending$1=1;const AdditiveBlending$1=2;const SubtractiveBlending=3;const MultiplyBlending=4;const CustomBlending=5;const AddEquation$1=100;const SubtractEquation=101;const ReverseSubtractEquation=102;const MinEquation=103;const MaxEquation=104;const ZeroFactor=200;const OneFactor=201;const SrcColorFactor=202;const OneMinusSrcColorFactor=203;const SrcAlphaFactor$1=204;const OneMinusSrcAlphaFactor$1=205;const DstAlphaFactor=206;const OneMinusDstAlphaFactor=207;const DstColorFactor=208;const OneMinusDstColorFactor=209;const SrcAlphaSaturateFactor=210;const ConstantColorFactor=211;const OneMinusConstantColorFactor=212;const ConstantAlphaFactor=213;const OneMinusConstantAlphaFactor=214;const NeverDepth=0;const AlwaysDepth=1;const LessDepth=2;const LessEqualDepth$1=3;const EqualDepth=4;const GreaterEqualDepth=5;const GreaterDepth=6;const NotEqualDepth=7;const MultiplyOperation$1=0;const MixOperation=1;const AddOperation=2;const NoToneMapping$1=0;const LinearToneMapping=1;const ReinhardToneMapping=2;const CineonToneMapping=3;const ACESFilmicToneMapping=4;const CustomToneMapping=5;const AgXToneMapping=6;const NeutralToneMapping=7;const AttachedBindMode='attached';const DetachedBindMode='detached';const UVMapping$1=300;const CubeReflectionMapping$1=301;const CubeRefractionMapping$1=302;const EquirectangularReflectionMapping=303;const EquirectangularRefractionMapping=304;const CubeUVReflectionMapping=306;const RepeatWrapping$1=1000;const ClampToEdgeWrapping$1=1001;const MirroredRepeatWrapping$1=1002;const NearestFilter$1=1003;const NearestMipmapNearestFilter=1004;const NearestMipmapLinearFilter=1005;const LinearFilter$1=1006;const LinearMipmapNearestFilter=1007;const LinearMipmapLinearFilter$1=1008;const UnsignedByteType$1=1009;const ByteType=1010;const ShortType=1011;const UnsignedShortType=1012;const IntType$1=1013;const UnsignedIntType$1=1014;const FloatType$1=1015;const HalfFloatType$1=1016;const UnsignedShort4444Type=1017;const UnsignedShort5551Type=1018;const UnsignedInt248Type$1=1020;const UnsignedInt5999Type=35902;const AlphaFormat=1021;const RGBFormat=1022;const RGBAFormat$1=1023;const LuminanceFormat=1024;const LuminanceAlphaFormat=1025;const DepthFormat$1=1026;const DepthStencilFormat$1=1027;const RedFormat=1028;const RedIntegerFormat=1029;const RGFormat=1030;const RGIntegerFormat=1031;const RGBAIntegerFormat=1033;const RGB_S3TC_DXT1_Format=33776;const RGBA_S3TC_DXT1_Format=33777;const RGBA_S3TC_DXT3_Format=33778;const RGBA_S3TC_DXT5_Format=33779;const RGB_PVRTC_4BPPV1_Format=35840;const RGB_PVRTC_2BPPV1_Format=35841;const RGBA_PVRTC_4BPPV1_Format=35842;const RGBA_PVRTC_2BPPV1_Format=35843;const RGB_ETC1_Format=36196;const RGB_ETC2_Format=37492;const RGBA_ETC2_EAC_Format=37496;const RGBA_ASTC_4x4_Format=37808;const RGBA_ASTC_5x4_Format=37809;const RGBA_ASTC_5x5_Format=37810;const RGBA_ASTC_6x5_Format=37811;const RGBA_ASTC_6x6_Format=37812;const RGBA_ASTC_8x5_Format=37813;const RGBA_ASTC_8x6_Format=37814;const RGBA_ASTC_8x8_Format=37815;const RGBA_ASTC_10x5_Format=37816;const RGBA_ASTC_10x6_Format=37817;const RGBA_ASTC_10x8_Format=37818;const RGBA_ASTC_10x10_Format=37819;const RGBA_ASTC_12x10_Format=37820;const RGBA_ASTC_12x12_Format=37821;const RGBA_BPTC_Format=36492;const RGB_BPTC_SIGNED_Format=36494;const RGB_BPTC_UNSIGNED_Format=36495;const RED_RGTC1_Format=36283;const SIGNED_RED_RGTC1_Format=36284;const RED_GREEN_RGTC2_Format=36285;const SIGNED_RED_GREEN_RGTC2_Format=36286;const InterpolateDiscrete=2300;const InterpolateLinear=2301;const InterpolateSmooth=2302;const ZeroCurvatureEnding=2400;const ZeroSlopeEnding=2401;const WrapAroundEnding=2402;const NormalAnimationBlendMode=2500;const TrianglesDrawMode=0;const TriangleStripDrawMode=1;const TriangleFanDrawMode=2;const BasicDepthPacking=3200;const RGBADepthPacking=3201;const TangentSpaceNormalMap$1=0;const ObjectSpaceNormalMap$1=1;// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.
const NoColorSpace$1='';const SRGBColorSpace$1='srgb';const LinearSRGBColorSpace$1='srgb-linear';const DisplayP3ColorSpace$1='display-p3';const LinearDisplayP3ColorSpace$1='display-p3-linear';const LinearTransfer$1='linear';const SRGBTransfer$1='srgb';const Rec709Primaries$1='rec709';const P3Primaries$1='p3';const KeepStencilOp$1=7680;const AlwaysStencilFunc$1=519;const NeverCompare=512;const LessCompare=513;const EqualCompare=514;const LessEqualCompare=515;const GreaterCompare=516;const NotEqualCompare=517;const GreaterEqualCompare=518;const AlwaysCompare=519;const StaticDrawUsage$1=35044;const GLSL3='300 es';const WebGLCoordinateSystem$1=2000;const WebGPUCoordinateSystem$1=2001;/**
 * https://github.com/mrdoob/eventdispatcher.js/
 */class EventDispatcher$1{addEventListener(type,listener){if(this._listeners===undefined)this._listeners={};const listeners=this._listeners;if(listeners[type]===undefined){listeners[type]=[];}if(listeners[type].indexOf(listener)===-1){listeners[type].push(listener);}}hasEventListener(type,listener){if(this._listeners===undefined)return false;const listeners=this._listeners;return listeners[type]!==undefined&&listeners[type].indexOf(listener)!==-1;}removeEventListener(type,listener){if(this._listeners===undefined)return;const listeners=this._listeners;const listenerArray=listeners[type];if(listenerArray!==undefined){const index=listenerArray.indexOf(listener);if(index!==-1){listenerArray.splice(index,1);}}}dispatchEvent(event){if(this._listeners===undefined)return;const listeners=this._listeners;const listenerArray=listeners[event.type];if(listenerArray!==undefined){event.target=this;// Make a copy, in case listeners are removed while iterating.
const array=listenerArray.slice(0);for(let i=0,l=array.length;i<l;i++){array[i].call(this,event);}event.target=null;}}}const _lut$1=['00','01','02','03','04','05','06','07','08','09','0a','0b','0c','0d','0e','0f','10','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','70','71','72','73','74','75','76','77','78','79','7a','7b','7c','7d','7e','7f','80','81','82','83','84','85','86','87','88','89','8a','8b','8c','8d','8e','8f','90','91','92','93','94','95','96','97','98','99','9a','9b','9c','9d','9e','9f','a0','a1','a2','a3','a4','a5','a6','a7','a8','a9','aa','ab','ac','ad','ae','af','b0','b1','b2','b3','b4','b5','b6','b7','b8','b9','ba','bb','bc','bd','be','bf','c0','c1','c2','c3','c4','c5','c6','c7','c8','c9','ca','cb','cc','cd','ce','cf','d0','d1','d2','d3','d4','d5','d6','d7','d8','d9','da','db','dc','dd','de','df','e0','e1','e2','e3','e4','e5','e6','e7','e8','e9','ea','eb','ec','ed','ee','ef','f0','f1','f2','f3','f4','f5','f6','f7','f8','f9','fa','fb','fc','fd','fe','ff'];let _seed$1=1234567;const DEG2RAD$1=Math.PI/180;const RAD2DEG$1=180/Math.PI;// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
function generateUUID$1(){const d0=Math.random()*0xffffffff|0;const d1=Math.random()*0xffffffff|0;const d2=Math.random()*0xffffffff|0;const d3=Math.random()*0xffffffff|0;const uuid=_lut$1[d0&0xff]+_lut$1[d0>>8&0xff]+_lut$1[d0>>16&0xff]+_lut$1[d0>>24&0xff]+'-'+_lut$1[d1&0xff]+_lut$1[d1>>8&0xff]+'-'+_lut$1[d1>>16&0x0f|0x40]+_lut$1[d1>>24&0xff]+'-'+_lut$1[d2&0x3f|0x80]+_lut$1[d2>>8&0xff]+'-'+_lut$1[d2>>16&0xff]+_lut$1[d2>>24&0xff]+_lut$1[d3&0xff]+_lut$1[d3>>8&0xff]+_lut$1[d3>>16&0xff]+_lut$1[d3>>24&0xff];// .toLowerCase() here flattens concatenated strings to save heap memory space.
return uuid.toLowerCase();}function clamp$2(value,min,max){return Math.max(min,Math.min(max,value));}// compute euclidean modulo of m % n
// https://en.wikipedia.org/wiki/Modulo_operation
function euclideanModulo$1(n,m){return (n%m+m)%m;}// Linear mapping from range <a1, a2> to range <b1, b2>
function mapLinear$1(x,a1,a2,b1,b2){return b1+(x-a1)*(b2-b1)/(a2-a1);}// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
function inverseLerp$1(x,y,value){if(x!==y){return (value-x)/(y-x);}else {return 0;}}// https://en.wikipedia.org/wiki/Linear_interpolation
function lerp$1(x,y,t){return (1-t)*x+t*y;}// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
function damp$1(x,y,lambda,dt){return lerp$1(x,y,1-Math.exp(-lambda*dt));}// https://www.desmos.com/calculator/vcsjnyz7x4
function pingpong$1(x,length=1){return length-Math.abs(euclideanModulo$1(x,length*2)-length);}// http://en.wikipedia.org/wiki/Smoothstep
function smoothstep$2(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*(3-2*x);}function smootherstep$1(x,min,max){if(x<=min)return 0;if(x>=max)return 1;x=(x-min)/(max-min);return x*x*x*(x*(x*6-15)+10);}// Random integer from <low, high> interval
function randInt$1(low,high){return low+Math.floor(Math.random()*(high-low+1));}// Random float from <low, high> interval
function randFloat$1(low,high){return low+Math.random()*(high-low);}// Random float from <-range/2, range/2> interval
function randFloatSpread$1(range){return range*(0.5-Math.random());}// Deterministic pseudo-random float in the interval [ 0, 1 ]
function seededRandom$1(s){if(s!==undefined)_seed$1=s;// Mulberry32 generator
let t=_seed$1+=0x6D2B79F5;t=Math.imul(t^t>>>15,t|1);t^=t+Math.imul(t^t>>>7,t|61);return ((t^t>>>14)>>>0)/4294967296;}function degToRad$1(degrees){return degrees*DEG2RAD$1;}function radToDeg$1(radians){return radians*RAD2DEG$1;}function isPowerOfTwo$1(value){return (value&value-1)===0&&value!==0;}function ceilPowerOfTwo$1(value){return Math.pow(2,Math.ceil(Math.log(value)/Math.LN2));}function floorPowerOfTwo$1(value){return Math.pow(2,Math.floor(Math.log(value)/Math.LN2));}function setQuaternionFromProperEuler$1(q,a,b,c,order){// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
// rotations are applied to the axes in the order specified by 'order'
// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
// angles are in radians
const cos=Math.cos;const sin=Math.sin;const c2=cos(b/2);const s2=sin(b/2);const c13=cos((a+c)/2);const s13=sin((a+c)/2);const c1_3=cos((a-c)/2);const s1_3=sin((a-c)/2);const c3_1=cos((c-a)/2);const s3_1=sin((c-a)/2);switch(order){case'XYX':q.set(c2*s13,s2*c1_3,s2*s1_3,c2*c13);break;case'YZY':q.set(s2*s1_3,c2*s13,s2*c1_3,c2*c13);break;case'ZXZ':q.set(s2*c1_3,s2*s1_3,c2*s13,c2*c13);break;case'XZX':q.set(c2*s13,s2*s3_1,s2*c3_1,c2*c13);break;case'YXY':q.set(s2*c3_1,c2*s13,s2*s3_1,c2*c13);break;case'ZYZ':q.set(s2*s3_1,s2*c3_1,c2*s13,c2*c13);break;default:console.warn('THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: '+order);}}function denormalize$1(value,array){switch(array.constructor){case Float32Array:return value;case Uint32Array:return value/4294967295.0;case Uint16Array:return value/65535.0;case Uint8Array:return value/255.0;case Int32Array:return Math.max(value/2147483647.0,-1.0);case Int16Array:return Math.max(value/32767.0,-1.0);case Int8Array:return Math.max(value/127.0,-1.0);default:throw new Error('Invalid component type.');}}function normalize$2(value,array){switch(array.constructor){case Float32Array:return value;case Uint32Array:return Math.round(value*4294967295.0);case Uint16Array:return Math.round(value*65535.0);case Uint8Array:return Math.round(value*255.0);case Int32Array:return Math.round(value*2147483647.0);case Int16Array:return Math.round(value*32767.0);case Int8Array:return Math.round(value*127.0);default:throw new Error('Invalid component type.');}}const MathUtils$1={DEG2RAD:DEG2RAD$1,RAD2DEG:RAD2DEG$1,generateUUID:generateUUID$1,clamp:clamp$2,euclideanModulo:euclideanModulo$1,mapLinear:mapLinear$1,inverseLerp:inverseLerp$1,lerp:lerp$1,damp:damp$1,pingpong:pingpong$1,smoothstep:smoothstep$2,smootherstep:smootherstep$1,randInt:randInt$1,randFloat:randFloat$1,randFloatSpread:randFloatSpread$1,seededRandom:seededRandom$1,degToRad:degToRad$1,radToDeg:radToDeg$1,isPowerOfTwo:isPowerOfTwo$1,ceilPowerOfTwo:ceilPowerOfTwo$1,floorPowerOfTwo:floorPowerOfTwo$1,setQuaternionFromProperEuler:setQuaternionFromProperEuler$1,normalize:normalize$2,denormalize:denormalize$1};class Vector2$1{constructor(x=0,y=0){Vector2$1.prototype.isVector2=true;this.x=x;this.y=y;}get width(){return this.x;}set width(value){this.x=value;}get height(){return this.y;}set height(value){this.y=value;}set(x,y){this.x=x;this.y=y;return this;}setScalar(scalar){this.x=scalar;this.y=scalar;return this;}setX(x){this.x=x;return this;}setY(y){this.y=y;return this;}setComponent(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;default:throw new Error('index is out of range: '+index);}return this;}getComponent(index){switch(index){case 0:return this.x;case 1:return this.y;default:throw new Error('index is out of range: '+index);}}clone(){return new this.constructor(this.x,this.y);}copy(v){this.x=v.x;this.y=v.y;return this;}add(v){this.x+=v.x;this.y+=v.y;return this;}addScalar(s){this.x+=s;this.y+=s;return this;}addVectors(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this;}addScaledVector(v,s){this.x+=v.x*s;this.y+=v.y*s;return this;}sub(v){this.x-=v.x;this.y-=v.y;return this;}subScalar(s){this.x-=s;this.y-=s;return this;}subVectors(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this;}multiply(v){this.x*=v.x;this.y*=v.y;return this;}multiplyScalar(scalar){this.x*=scalar;this.y*=scalar;return this;}divide(v){this.x/=v.x;this.y/=v.y;return this;}divideScalar(scalar){return this.multiplyScalar(1/scalar);}applyMatrix3(m){const x=this.x,y=this.y;const e=m.elements;this.x=e[0]*x+e[3]*y+e[6];this.y=e[1]*x+e[4]*y+e[7];return this;}min(v){this.x=Math.min(this.x,v.x);this.y=Math.min(this.y,v.y);return this;}max(v){this.x=Math.max(this.x,v.x);this.y=Math.max(this.y,v.y);return this;}clamp(min,max){// assumes min < max, componentwise
this.x=Math.max(min.x,Math.min(max.x,this.x));this.y=Math.max(min.y,Math.min(max.y,this.y));return this;}clampScalar(minVal,maxVal){this.x=Math.max(minVal,Math.min(maxVal,this.x));this.y=Math.max(minVal,Math.min(maxVal,this.y));return this;}clampLength(min,max){const length=this.length();return this.divideScalar(length||1).multiplyScalar(Math.max(min,Math.min(max,length)));}floor(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this;}ceil(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this;}round(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this;}roundToZero(){this.x=Math.trunc(this.x);this.y=Math.trunc(this.y);return this;}negate(){this.x=-this.x;this.y=-this.y;return this;}dot(v){return this.x*v.x+this.y*v.y;}cross(v){return this.x*v.y-this.y*v.x;}lengthSq(){return this.x*this.x+this.y*this.y;}length(){return Math.sqrt(this.x*this.x+this.y*this.y);}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y);}normalize(){return this.divideScalar(this.length()||1);}angle(){// computes the angle in radians with respect to the positive x-axis
const angle=Math.atan2(-this.y,-this.x)+Math.PI;return angle;}angleTo(v){const denominator=Math.sqrt(this.lengthSq()*v.lengthSq());if(denominator===0)return Math.PI/2;const theta=this.dot(v)/denominator;// clamp, to handle numerical problems
return Math.acos(clamp$2(theta,-1,1));}distanceTo(v){return Math.sqrt(this.distanceToSquared(v));}distanceToSquared(v){const dx=this.x-v.x,dy=this.y-v.y;return dx*dx+dy*dy;}manhattanDistanceTo(v){return Math.abs(this.x-v.x)+Math.abs(this.y-v.y);}setLength(length){return this.normalize().multiplyScalar(length);}lerp(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;return this;}lerpVectors(v1,v2,alpha){this.x=v1.x+(v2.x-v1.x)*alpha;this.y=v1.y+(v2.y-v1.y)*alpha;return this;}equals(v){return v.x===this.x&&v.y===this.y;}fromArray(array,offset=0){this.x=array[offset];this.y=array[offset+1];return this;}toArray(array=[],offset=0){array[offset]=this.x;array[offset+1]=this.y;return array;}fromBufferAttribute(attribute,index){this.x=attribute.getX(index);this.y=attribute.getY(index);return this;}rotateAround(center,angle){const c=Math.cos(angle),s=Math.sin(angle);const x=this.x-center.x;const y=this.y-center.y;this.x=x*c-y*s+center.x;this.y=x*s+y*c+center.y;return this;}random(){this.x=Math.random();this.y=Math.random();return this;}*[Symbol.iterator](){yield this.x;yield this.y;}}class Matrix3$1{constructor(n11,n12,n13,n21,n22,n23,n31,n32,n33){Matrix3$1.prototype.isMatrix3=true;this.elements=[1,0,0,0,1,0,0,0,1];if(n11!==undefined){this.set(n11,n12,n13,n21,n22,n23,n31,n32,n33);}}set(n11,n12,n13,n21,n22,n23,n31,n32,n33){const te=this.elements;te[0]=n11;te[1]=n21;te[2]=n31;te[3]=n12;te[4]=n22;te[5]=n32;te[6]=n13;te[7]=n23;te[8]=n33;return this;}identity(){this.set(1,0,0,0,1,0,0,0,1);return this;}copy(m){const te=this.elements;const me=m.elements;te[0]=me[0];te[1]=me[1];te[2]=me[2];te[3]=me[3];te[4]=me[4];te[5]=me[5];te[6]=me[6];te[7]=me[7];te[8]=me[8];return this;}extractBasis(xAxis,yAxis,zAxis){xAxis.setFromMatrix3Column(this,0);yAxis.setFromMatrix3Column(this,1);zAxis.setFromMatrix3Column(this,2);return this;}setFromMatrix4(m){const me=m.elements;this.set(me[0],me[4],me[8],me[1],me[5],me[9],me[2],me[6],me[10]);return this;}multiply(m){return this.multiplyMatrices(this,m);}premultiply(m){return this.multiplyMatrices(m,this);}multiplyMatrices(a,b){const ae=a.elements;const be=b.elements;const te=this.elements;const a11=ae[0],a12=ae[3],a13=ae[6];const a21=ae[1],a22=ae[4],a23=ae[7];const a31=ae[2],a32=ae[5],a33=ae[8];const b11=be[0],b12=be[3],b13=be[6];const b21=be[1],b22=be[4],b23=be[7];const b31=be[2],b32=be[5],b33=be[8];te[0]=a11*b11+a12*b21+a13*b31;te[3]=a11*b12+a12*b22+a13*b32;te[6]=a11*b13+a12*b23+a13*b33;te[1]=a21*b11+a22*b21+a23*b31;te[4]=a21*b12+a22*b22+a23*b32;te[7]=a21*b13+a22*b23+a23*b33;te[2]=a31*b11+a32*b21+a33*b31;te[5]=a31*b12+a32*b22+a33*b32;te[8]=a31*b13+a32*b23+a33*b33;return this;}multiplyScalar(s){const te=this.elements;te[0]*=s;te[3]*=s;te[6]*=s;te[1]*=s;te[4]*=s;te[7]*=s;te[2]*=s;te[5]*=s;te[8]*=s;return this;}determinant(){const te=this.elements;const a=te[0],b=te[1],c=te[2],d=te[3],e=te[4],f=te[5],g=te[6],h=te[7],i=te[8];return a*e*i-a*f*h-b*d*i+b*f*g+c*d*h-c*e*g;}invert(){const te=this.elements,n11=te[0],n21=te[1],n31=te[2],n12=te[3],n22=te[4],n32=te[5],n13=te[6],n23=te[7],n33=te[8],t11=n33*n22-n32*n23,t12=n32*n13-n33*n12,t13=n23*n12-n22*n13,det=n11*t11+n21*t12+n31*t13;if(det===0)return this.set(0,0,0,0,0,0,0,0,0);const detInv=1/det;te[0]=t11*detInv;te[1]=(n31*n23-n33*n21)*detInv;te[2]=(n32*n21-n31*n22)*detInv;te[3]=t12*detInv;te[4]=(n33*n11-n31*n13)*detInv;te[5]=(n31*n12-n32*n11)*detInv;te[6]=t13*detInv;te[7]=(n21*n13-n23*n11)*detInv;te[8]=(n22*n11-n21*n12)*detInv;return this;}transpose(){let tmp;const m=this.elements;tmp=m[1];m[1]=m[3];m[3]=tmp;tmp=m[2];m[2]=m[6];m[6]=tmp;tmp=m[5];m[5]=m[7];m[7]=tmp;return this;}getNormalMatrix(matrix4){return this.setFromMatrix4(matrix4).invert().transpose();}transposeIntoArray(r){const m=this.elements;r[0]=m[0];r[1]=m[3];r[2]=m[6];r[3]=m[1];r[4]=m[4];r[5]=m[7];r[6]=m[2];r[7]=m[5];r[8]=m[8];return this;}setUvTransform(tx,ty,sx,sy,rotation,cx,cy){const c=Math.cos(rotation);const s=Math.sin(rotation);this.set(sx*c,sx*s,-sx*(c*cx+s*cy)+cx+tx,-sy*s,sy*c,-sy*(-s*cx+c*cy)+cy+ty,0,0,1);return this;}//
scale(sx,sy){this.premultiply(_m3$1.makeScale(sx,sy));return this;}rotate(theta){this.premultiply(_m3$1.makeRotation(-theta));return this;}translate(tx,ty){this.premultiply(_m3$1.makeTranslation(tx,ty));return this;}// for 2D Transforms
makeTranslation(x,y){if(x.isVector2){this.set(1,0,x.x,0,1,x.y,0,0,1);}else {this.set(1,0,x,0,1,y,0,0,1);}return this;}makeRotation(theta){// counterclockwise
const c=Math.cos(theta);const s=Math.sin(theta);this.set(c,-s,0,s,c,0,0,0,1);return this;}makeScale(x,y){this.set(x,0,0,0,y,0,0,0,1);return this;}//
equals(matrix){const te=this.elements;const me=matrix.elements;for(let i=0;i<9;i++){if(te[i]!==me[i])return false;}return true;}fromArray(array,offset=0){for(let i=0;i<9;i++){this.elements[i]=array[i+offset];}return this;}toArray(array=[],offset=0){const te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];return array;}clone(){return new this.constructor().fromArray(this.elements);}}const _m3$1=/*@__PURE__*/new Matrix3$1();function arrayNeedsUint32$1(array){// assumes larger values usually on last
for(let i=array.length-1;i>=0;--i){if(array[i]>=65535)return true;// account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
}return false;}function createElementNS$1(name){return document.createElementNS('http://www.w3.org/1999/xhtml',name);}function createCanvasElement(){const canvas=createElementNS$1('canvas');canvas.style.display='block';return canvas;}const _cache$2={};function warnOnce$1(message){if(message in _cache$2)return;_cache$2[message]=true;console.warn(message);}function probeAsync(gl,sync,interval){return new Promise(function(resolve,reject){function probe(){switch(gl.clientWaitSync(sync,gl.SYNC_FLUSH_COMMANDS_BIT,0)){case gl.WAIT_FAILED:reject();break;case gl.TIMEOUT_EXPIRED:setTimeout(probe,interval);break;default:resolve();}}setTimeout(probe,interval);});}/**
 * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
 * or clipping. Based on W3C specifications for sRGB and Display P3,
 * and ICC specifications for the D50 connection space. Values in/out
 * are _linear_ sRGB and _linear_ Display P3.
 *
 * Note that both sRGB and Display P3 use the sRGB transfer functions.
 *
 * Reference:
 * - http://www.russellcottrell.com/photo/matrixCalculator.htm
 */const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3$1=/*@__PURE__*/new Matrix3$1().set(0.8224621,0.177538,0.0,0.0331941,0.9668058,0.0,0.0170827,0.0723974,0.9105199);const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB$1=/*@__PURE__*/new Matrix3$1().set(1.2249401,-0.2249404,0.0,-0.0420569,1.0420571,0.0,-0.0196376,-0.0786361,1.0982735);/**
 * Defines supported color spaces by transfer function and primaries,
 * and provides conversions to/from the Linear-sRGB reference space.
 */const COLOR_SPACES$1={[LinearSRGBColorSpace$1]:{transfer:LinearTransfer$1,primaries:Rec709Primaries$1,luminanceCoefficients:[0.2126,0.7152,0.0722],toReference:color=>color,fromReference:color=>color},[SRGBColorSpace$1]:{transfer:SRGBTransfer$1,primaries:Rec709Primaries$1,luminanceCoefficients:[0.2126,0.7152,0.0722],toReference:color=>color.convertSRGBToLinear(),fromReference:color=>color.convertLinearToSRGB()},[LinearDisplayP3ColorSpace$1]:{transfer:LinearTransfer$1,primaries:P3Primaries$1,luminanceCoefficients:[0.2289,0.6917,0.0793],toReference:color=>color.applyMatrix3(LINEAR_DISPLAY_P3_TO_LINEAR_SRGB$1),fromReference:color=>color.applyMatrix3(LINEAR_SRGB_TO_LINEAR_DISPLAY_P3$1)},[DisplayP3ColorSpace$1]:{transfer:SRGBTransfer$1,primaries:P3Primaries$1,luminanceCoefficients:[0.2289,0.6917,0.0793],toReference:color=>color.convertSRGBToLinear().applyMatrix3(LINEAR_DISPLAY_P3_TO_LINEAR_SRGB$1),fromReference:color=>color.applyMatrix3(LINEAR_SRGB_TO_LINEAR_DISPLAY_P3$1).convertLinearToSRGB()}};const SUPPORTED_WORKING_COLOR_SPACES$1=new Set([LinearSRGBColorSpace$1,LinearDisplayP3ColorSpace$1]);const ColorManagement$1={enabled:true,_workingColorSpace:LinearSRGBColorSpace$1,get workingColorSpace(){return this._workingColorSpace;},set workingColorSpace(colorSpace){if(!SUPPORTED_WORKING_COLOR_SPACES$1.has(colorSpace)){throw new Error(`Unsupported working color space, "${colorSpace}".`);}this._workingColorSpace=colorSpace;},convert:function(color,sourceColorSpace,targetColorSpace){if(this.enabled===false||sourceColorSpace===targetColorSpace||!sourceColorSpace||!targetColorSpace){return color;}const sourceToReference=COLOR_SPACES$1[sourceColorSpace].toReference;const targetFromReference=COLOR_SPACES$1[targetColorSpace].fromReference;return targetFromReference(sourceToReference(color));},fromWorkingColorSpace:function(color,targetColorSpace){return this.convert(color,this._workingColorSpace,targetColorSpace);},toWorkingColorSpace:function(color,sourceColorSpace){return this.convert(color,sourceColorSpace,this._workingColorSpace);},getPrimaries:function(colorSpace){return COLOR_SPACES$1[colorSpace].primaries;},getTransfer:function(colorSpace){if(colorSpace===NoColorSpace$1)return LinearTransfer$1;return COLOR_SPACES$1[colorSpace].transfer;},getLuminanceCoefficients:function(target,colorSpace=this._workingColorSpace){return target.fromArray(COLOR_SPACES$1[colorSpace].luminanceCoefficients);}};function SRGBToLinear$1(c){return c<0.04045?c*0.0773993808:Math.pow(c*0.9478672986+0.0521327014,2.4);}function LinearToSRGB$1(c){return c<0.0031308?c*12.92:1.055*Math.pow(c,0.41666)-0.055;}let _canvas$1;class ImageUtils$1{static getDataURL(image){if(/^data:/i.test(image.src)){return image.src;}if(typeof HTMLCanvasElement==='undefined'){return image.src;}let canvas;if(image instanceof HTMLCanvasElement){canvas=image;}else {if(_canvas$1===undefined)_canvas$1=createElementNS$1('canvas');_canvas$1.width=image.width;_canvas$1.height=image.height;const context=_canvas$1.getContext('2d');if(image instanceof ImageData){context.putImageData(image,0,0);}else {context.drawImage(image,0,0,image.width,image.height);}canvas=_canvas$1;}if(canvas.width>2048||canvas.height>2048){console.warn('THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons',image);return canvas.toDataURL('image/jpeg',0.6);}else {return canvas.toDataURL('image/png');}}static sRGBToLinear(image){if(typeof HTMLImageElement!=='undefined'&&image instanceof HTMLImageElement||typeof HTMLCanvasElement!=='undefined'&&image instanceof HTMLCanvasElement||typeof ImageBitmap!=='undefined'&&image instanceof ImageBitmap){const canvas=createElementNS$1('canvas');canvas.width=image.width;canvas.height=image.height;const context=canvas.getContext('2d');context.drawImage(image,0,0,image.width,image.height);const imageData=context.getImageData(0,0,image.width,image.height);const data=imageData.data;for(let i=0;i<data.length;i++){data[i]=SRGBToLinear$1(data[i]/255)*255;}context.putImageData(imageData,0,0);return canvas;}else if(image.data){const data=image.data.slice(0);for(let i=0;i<data.length;i++){if(data instanceof Uint8Array||data instanceof Uint8ClampedArray){data[i]=Math.floor(SRGBToLinear$1(data[i]/255)*255);}else {// assuming float
data[i]=SRGBToLinear$1(data[i]);}}return {data:data,width:image.width,height:image.height};}else {console.warn('THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.');return image;}}}let _sourceId$1=0;class Source$1{constructor(data=null){this.isSource=true;Object.defineProperty(this,'id',{value:_sourceId$1++});this.uuid=generateUUID$1();this.data=data;this.dataReady=true;this.version=0;}set needsUpdate(value){if(value===true)this.version++;}toJSON(meta){const isRootObject=meta===undefined||typeof meta==='string';if(!isRootObject&&meta.images[this.uuid]!==undefined){return meta.images[this.uuid];}const output={uuid:this.uuid,url:''};const data=this.data;if(data!==null){let url;if(Array.isArray(data)){// cube texture
url=[];for(let i=0,l=data.length;i<l;i++){if(data[i].isDataTexture){url.push(serializeImage$1(data[i].image));}else {url.push(serializeImage$1(data[i]));}}}else {// texture
url=serializeImage$1(data);}output.url=url;}if(!isRootObject){meta.images[this.uuid]=output;}return output;}}function serializeImage$1(image){if(typeof HTMLImageElement!=='undefined'&&image instanceof HTMLImageElement||typeof HTMLCanvasElement!=='undefined'&&image instanceof HTMLCanvasElement||typeof ImageBitmap!=='undefined'&&image instanceof ImageBitmap){// default images
return ImageUtils$1.getDataURL(image);}else {if(image.data){// images of DataTexture
return {data:Array.from(image.data),width:image.width,height:image.height,type:image.data.constructor.name};}else {console.warn('THREE.Texture: Unable to serialize Texture.');return {};}}}let _textureId$1=0;class Texture$1 extends EventDispatcher$1{constructor(image=Texture$1.DEFAULT_IMAGE,mapping=Texture$1.DEFAULT_MAPPING,wrapS=ClampToEdgeWrapping$1,wrapT=ClampToEdgeWrapping$1,magFilter=LinearFilter$1,minFilter=LinearMipmapLinearFilter$1,format=RGBAFormat$1,type=UnsignedByteType$1,anisotropy=Texture$1.DEFAULT_ANISOTROPY,colorSpace=NoColorSpace$1){super();this.isTexture=true;Object.defineProperty(this,'id',{value:_textureId$1++});this.uuid=generateUUID$1();this.name='';this.source=new Source$1(image);this.mipmaps=[];this.mapping=mapping;this.channel=0;this.wrapS=wrapS;this.wrapT=wrapT;this.magFilter=magFilter;this.minFilter=minFilter;this.anisotropy=anisotropy;this.format=format;this.internalFormat=null;this.type=type;this.offset=new Vector2$1(0,0);this.repeat=new Vector2$1(1,1);this.center=new Vector2$1(0,0);this.rotation=0;this.matrixAutoUpdate=true;this.matrix=new Matrix3$1();this.generateMipmaps=true;this.premultiplyAlpha=false;this.flipY=true;this.unpackAlignment=4;// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
this.colorSpace=colorSpace;this.userData={};this.version=0;this.onUpdate=null;this.isRenderTargetTexture=false;// indicates whether a texture belongs to a render target or not
this.pmremVersion=0;// indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
}get image(){return this.source.data;}set image(value=null){this.source.data=value;}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y);}clone(){return new this.constructor().copy(this);}copy(source){this.name=source.name;this.source=source.source;this.mipmaps=source.mipmaps.slice(0);this.mapping=source.mapping;this.channel=source.channel;this.wrapS=source.wrapS;this.wrapT=source.wrapT;this.magFilter=source.magFilter;this.minFilter=source.minFilter;this.anisotropy=source.anisotropy;this.format=source.format;this.internalFormat=source.internalFormat;this.type=source.type;this.offset.copy(source.offset);this.repeat.copy(source.repeat);this.center.copy(source.center);this.rotation=source.rotation;this.matrixAutoUpdate=source.matrixAutoUpdate;this.matrix.copy(source.matrix);this.generateMipmaps=source.generateMipmaps;this.premultiplyAlpha=source.premultiplyAlpha;this.flipY=source.flipY;this.unpackAlignment=source.unpackAlignment;this.colorSpace=source.colorSpace;this.userData=JSON.parse(JSON.stringify(source.userData));this.needsUpdate=true;return this;}toJSON(meta){const isRootObject=meta===undefined||typeof meta==='string';if(!isRootObject&&meta.textures[this.uuid]!==undefined){return meta.textures[this.uuid];}const output={metadata:{version:4.6,type:'Texture',generator:'Texture.toJSON'},uuid:this.uuid,name:this.name,image:this.source.toJSON(meta).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)output.userData=this.userData;if(!isRootObject){meta.textures[this.uuid]=output;}return output;}dispose(){this.dispatchEvent({type:'dispose'});}transformUv(uv){if(this.mapping!==UVMapping$1)return uv;uv.applyMatrix3(this.matrix);if(uv.x<0||uv.x>1){switch(this.wrapS){case RepeatWrapping$1:uv.x=uv.x-Math.floor(uv.x);break;case ClampToEdgeWrapping$1:uv.x=uv.x<0?0:1;break;case MirroredRepeatWrapping$1:if(Math.abs(Math.floor(uv.x)%2)===1){uv.x=Math.ceil(uv.x)-uv.x;}else {uv.x=uv.x-Math.floor(uv.x);}break;}}if(uv.y<0||uv.y>1){switch(this.wrapT){case RepeatWrapping$1:uv.y=uv.y-Math.floor(uv.y);break;case ClampToEdgeWrapping$1:uv.y=uv.y<0?0:1;break;case MirroredRepeatWrapping$1:if(Math.abs(Math.floor(uv.y)%2)===1){uv.y=Math.ceil(uv.y)-uv.y;}else {uv.y=uv.y-Math.floor(uv.y);}break;}}if(this.flipY){uv.y=1-uv.y;}return uv;}set needsUpdate(value){if(value===true){this.version++;this.source.needsUpdate=true;}}set needsPMREMUpdate(value){if(value===true){this.pmremVersion++;}}}Texture$1.DEFAULT_IMAGE=null;Texture$1.DEFAULT_MAPPING=UVMapping$1;Texture$1.DEFAULT_ANISOTROPY=1;class Vector4$1{constructor(x=0,y=0,z=0,w=1){Vector4$1.prototype.isVector4=true;this.x=x;this.y=y;this.z=z;this.w=w;}get width(){return this.z;}set width(value){this.z=value;}get height(){return this.w;}set height(value){this.w=value;}set(x,y,z,w){this.x=x;this.y=y;this.z=z;this.w=w;return this;}setScalar(scalar){this.x=scalar;this.y=scalar;this.z=scalar;this.w=scalar;return this;}setX(x){this.x=x;return this;}setY(y){this.y=y;return this;}setZ(z){this.z=z;return this;}setW(w){this.w=w;return this;}setComponent(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;case 3:this.w=value;break;default:throw new Error('index is out of range: '+index);}return this;}getComponent(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error('index is out of range: '+index);}}clone(){return new this.constructor(this.x,this.y,this.z,this.w);}copy(v){this.x=v.x;this.y=v.y;this.z=v.z;this.w=v.w!==undefined?v.w:1;return this;}add(v){this.x+=v.x;this.y+=v.y;this.z+=v.z;this.w+=v.w;return this;}addScalar(s){this.x+=s;this.y+=s;this.z+=s;this.w+=s;return this;}addVectors(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this;}addScaledVector(v,s){this.x+=v.x*s;this.y+=v.y*s;this.z+=v.z*s;this.w+=v.w*s;return this;}sub(v){this.x-=v.x;this.y-=v.y;this.z-=v.z;this.w-=v.w;return this;}subScalar(s){this.x-=s;this.y-=s;this.z-=s;this.w-=s;return this;}subVectors(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this;}multiply(v){this.x*=v.x;this.y*=v.y;this.z*=v.z;this.w*=v.w;return this;}multiplyScalar(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;this.w*=scalar;return this;}applyMatrix4(m){const x=this.x,y=this.y,z=this.z,w=this.w;const e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z+e[12]*w;this.y=e[1]*x+e[5]*y+e[9]*z+e[13]*w;this.z=e[2]*x+e[6]*y+e[10]*z+e[14]*w;this.w=e[3]*x+e[7]*y+e[11]*z+e[15]*w;return this;}divideScalar(scalar){return this.multiplyScalar(1/scalar);}setAxisAngleFromQuaternion(q){// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
// q is assumed to be normalized
this.w=2*Math.acos(q.w);const s=Math.sqrt(1-q.w*q.w);if(s<0.0001){this.x=1;this.y=0;this.z=0;}else {this.x=q.x/s;this.y=q.y/s;this.z=q.z/s;}return this;}setAxisAngleFromRotationMatrix(m){// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
let angle,x,y,z;// variables for result
const epsilon=0.01,// margin to allow for rounding errors
epsilon2=0.1,// margin to distinguish between 0 and 180 degrees
te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10];if(Math.abs(m12-m21)<epsilon&&Math.abs(m13-m31)<epsilon&&Math.abs(m23-m32)<epsilon){// singularity found
// first check for identity matrix which must have +1 for all terms
// in leading diagonal and zero in other terms
if(Math.abs(m12+m21)<epsilon2&&Math.abs(m13+m31)<epsilon2&&Math.abs(m23+m32)<epsilon2&&Math.abs(m11+m22+m33-3)<epsilon2){// this singularity is identity matrix so angle = 0
this.set(1,0,0,0);return this;// zero angle, arbitrary axis
}// otherwise this singularity is angle = 180
angle=Math.PI;const xx=(m11+1)/2;const yy=(m22+1)/2;const zz=(m33+1)/2;const xy=(m12+m21)/4;const xz=(m13+m31)/4;const yz=(m23+m32)/4;if(xx>yy&&xx>zz){// m11 is the largest diagonal term
if(xx<epsilon){x=0;y=0.707106781;z=0.707106781;}else {x=Math.sqrt(xx);y=xy/x;z=xz/x;}}else if(yy>zz){// m22 is the largest diagonal term
if(yy<epsilon){x=0.707106781;y=0;z=0.707106781;}else {y=Math.sqrt(yy);x=xy/y;z=yz/y;}}else {// m33 is the largest diagonal term so base result on this
if(zz<epsilon){x=0.707106781;y=0.707106781;z=0;}else {z=Math.sqrt(zz);x=xz/z;y=yz/z;}}this.set(x,y,z,angle);return this;// return 180 deg rotation
}// as we have reached here there are no singularities so we can handle normally
let s=Math.sqrt((m32-m23)*(m32-m23)+(m13-m31)*(m13-m31)+(m21-m12)*(m21-m12));// used to normalize
if(Math.abs(s)<0.001)s=1;// prevent divide by zero, should not happen if matrix is orthogonal and should be
// caught by singularity test above, but I've left it in just in case
this.x=(m32-m23)/s;this.y=(m13-m31)/s;this.z=(m21-m12)/s;this.w=Math.acos((m11+m22+m33-1)/2);return this;}setFromMatrixPosition(m){const e=m.elements;this.x=e[12];this.y=e[13];this.z=e[14];this.w=e[15];return this;}min(v){this.x=Math.min(this.x,v.x);this.y=Math.min(this.y,v.y);this.z=Math.min(this.z,v.z);this.w=Math.min(this.w,v.w);return this;}max(v){this.x=Math.max(this.x,v.x);this.y=Math.max(this.y,v.y);this.z=Math.max(this.z,v.z);this.w=Math.max(this.w,v.w);return this;}clamp(min,max){// assumes min < max, componentwise
this.x=Math.max(min.x,Math.min(max.x,this.x));this.y=Math.max(min.y,Math.min(max.y,this.y));this.z=Math.max(min.z,Math.min(max.z,this.z));this.w=Math.max(min.w,Math.min(max.w,this.w));return this;}clampScalar(minVal,maxVal){this.x=Math.max(minVal,Math.min(maxVal,this.x));this.y=Math.max(minVal,Math.min(maxVal,this.y));this.z=Math.max(minVal,Math.min(maxVal,this.z));this.w=Math.max(minVal,Math.min(maxVal,this.w));return this;}clampLength(min,max){const length=this.length();return this.divideScalar(length||1).multiplyScalar(Math.max(min,Math.min(max,length)));}floor(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this;}ceil(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this;}round(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this;}roundToZero(){this.x=Math.trunc(this.x);this.y=Math.trunc(this.y);this.z=Math.trunc(this.z);this.w=Math.trunc(this.w);return this;}negate(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this;}dot(v){return this.x*v.x+this.y*v.y+this.z*v.z+this.w*v.w;}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w;}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w);}normalize(){return this.divideScalar(this.length()||1);}setLength(length){return this.normalize().multiplyScalar(length);}lerp(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;this.w+=(v.w-this.w)*alpha;return this;}lerpVectors(v1,v2,alpha){this.x=v1.x+(v2.x-v1.x)*alpha;this.y=v1.y+(v2.y-v1.y)*alpha;this.z=v1.z+(v2.z-v1.z)*alpha;this.w=v1.w+(v2.w-v1.w)*alpha;return this;}equals(v){return v.x===this.x&&v.y===this.y&&v.z===this.z&&v.w===this.w;}fromArray(array,offset=0){this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];this.w=array[offset+3];return this;}toArray(array=[],offset=0){array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;array[offset+3]=this.w;return array;}fromBufferAttribute(attribute,index){this.x=attribute.getX(index);this.y=attribute.getY(index);this.z=attribute.getZ(index);this.w=attribute.getW(index);return this;}random(){this.x=Math.random();this.y=Math.random();this.z=Math.random();this.w=Math.random();return this;}*[Symbol.iterator](){yield this.x;yield this.y;yield this.z;yield this.w;}}/*
 In options, we can specify:
 * Texture parameters for an auto-generated target texture
 * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
*/class RenderTarget$1 extends EventDispatcher$1{constructor(width=1,height=1,options={}){super();this.isRenderTarget=true;this.width=width;this.height=height;this.depth=1;this.scissor=new Vector4$1(0,0,width,height);this.scissorTest=false;this.viewport=new Vector4$1(0,0,width,height);const image={width:width,height:height,depth:1};options=Object.assign({generateMipmaps:false,internalFormat:null,minFilter:LinearFilter$1,depthBuffer:true,stencilBuffer:false,resolveDepthBuffer:true,resolveStencilBuffer:true,depthTexture:null,samples:0,count:1},options);const texture=new Texture$1(image,options.mapping,options.wrapS,options.wrapT,options.magFilter,options.minFilter,options.format,options.type,options.anisotropy,options.colorSpace);texture.flipY=false;texture.generateMipmaps=options.generateMipmaps;texture.internalFormat=options.internalFormat;this.textures=[];const count=options.count;for(let i=0;i<count;i++){this.textures[i]=texture.clone();this.textures[i].isRenderTargetTexture=true;}this.depthBuffer=options.depthBuffer;this.stencilBuffer=options.stencilBuffer;this.resolveDepthBuffer=options.resolveDepthBuffer;this.resolveStencilBuffer=options.resolveStencilBuffer;this.depthTexture=options.depthTexture;this.samples=options.samples;}get texture(){return this.textures[0];}set texture(value){this.textures[0]=value;}setSize(width,height,depth=1){if(this.width!==width||this.height!==height||this.depth!==depth){this.width=width;this.height=height;this.depth=depth;for(let i=0,il=this.textures.length;i<il;i++){this.textures[i].image.width=width;this.textures[i].image.height=height;this.textures[i].image.depth=depth;}this.dispose();}this.viewport.set(0,0,width,height);this.scissor.set(0,0,width,height);}clone(){return new this.constructor().copy(this);}copy(source){this.width=source.width;this.height=source.height;this.depth=source.depth;this.scissor.copy(source.scissor);this.scissorTest=source.scissorTest;this.viewport.copy(source.viewport);this.textures.length=0;for(let i=0,il=source.textures.length;i<il;i++){this.textures[i]=source.textures[i].clone();this.textures[i].isRenderTargetTexture=true;}// ensure image object is not shared, see #20328
const image=Object.assign({},source.texture.image);this.texture.source=new Source$1(image);this.depthBuffer=source.depthBuffer;this.stencilBuffer=source.stencilBuffer;this.resolveDepthBuffer=source.resolveDepthBuffer;this.resolveStencilBuffer=source.resolveStencilBuffer;if(source.depthTexture!==null)this.depthTexture=source.depthTexture.clone();this.samples=source.samples;return this;}dispose(){this.dispatchEvent({type:'dispose'});}}class WebGLRenderTarget extends RenderTarget$1{constructor(width=1,height=1,options={}){super(width,height,options);this.isWebGLRenderTarget=true;}}class DataArrayTexture$1 extends Texture$1{constructor(data=null,width=1,height=1,depth=1){super(null);this.isDataArrayTexture=true;this.image={data,width,height,depth};this.magFilter=NearestFilter$1;this.minFilter=NearestFilter$1;this.wrapR=ClampToEdgeWrapping$1;this.generateMipmaps=false;this.flipY=false;this.unpackAlignment=1;this.layerUpdates=new Set();}addLayerUpdate(layerIndex){this.layerUpdates.add(layerIndex);}clearLayerUpdates(){this.layerUpdates.clear();}}class Data3DTexture extends Texture$1{constructor(data=null,width=1,height=1,depth=1){// We're going to add .setXXX() methods for setting properties later.
// Users can still set in DataTexture3D directly.
//
//	const texture = new THREE.DataTexture3D( data, width, height, depth );
// 	texture.anisotropy = 16;
//
// See #14839
super(null);this.isData3DTexture=true;this.image={data,width,height,depth};this.magFilter=NearestFilter$1;this.minFilter=NearestFilter$1;this.wrapR=ClampToEdgeWrapping$1;this.generateMipmaps=false;this.flipY=false;this.unpackAlignment=1;}}class Quaternion$1{constructor(x=0,y=0,z=0,w=1){this.isQuaternion=true;this._x=x;this._y=y;this._z=z;this._w=w;}static slerpFlat(dst,dstOffset,src0,srcOffset0,src1,srcOffset1,t){// fuzz-free, array-based Quaternion SLERP operation
let x0=src0[srcOffset0+0],y0=src0[srcOffset0+1],z0=src0[srcOffset0+2],w0=src0[srcOffset0+3];const x1=src1[srcOffset1+0],y1=src1[srcOffset1+1],z1=src1[srcOffset1+2],w1=src1[srcOffset1+3];if(t===0){dst[dstOffset+0]=x0;dst[dstOffset+1]=y0;dst[dstOffset+2]=z0;dst[dstOffset+3]=w0;return;}if(t===1){dst[dstOffset+0]=x1;dst[dstOffset+1]=y1;dst[dstOffset+2]=z1;dst[dstOffset+3]=w1;return;}if(w0!==w1||x0!==x1||y0!==y1||z0!==z1){let s=1-t;const cos=x0*x1+y0*y1+z0*z1+w0*w1,dir=cos>=0?1:-1,sqrSin=1-cos*cos;// Skip the Slerp for tiny steps to avoid numeric problems:
if(sqrSin>Number.EPSILON){const sin=Math.sqrt(sqrSin),len=Math.atan2(sin,cos*dir);s=Math.sin(s*len)/sin;t=Math.sin(t*len)/sin;}const tDir=t*dir;x0=x0*s+x1*tDir;y0=y0*s+y1*tDir;z0=z0*s+z1*tDir;w0=w0*s+w1*tDir;// Normalize in case we just did a lerp:
if(s===1-t){const f=1/Math.sqrt(x0*x0+y0*y0+z0*z0+w0*w0);x0*=f;y0*=f;z0*=f;w0*=f;}}dst[dstOffset]=x0;dst[dstOffset+1]=y0;dst[dstOffset+2]=z0;dst[dstOffset+3]=w0;}static multiplyQuaternionsFlat(dst,dstOffset,src0,srcOffset0,src1,srcOffset1){const x0=src0[srcOffset0];const y0=src0[srcOffset0+1];const z0=src0[srcOffset0+2];const w0=src0[srcOffset0+3];const x1=src1[srcOffset1];const y1=src1[srcOffset1+1];const z1=src1[srcOffset1+2];const w1=src1[srcOffset1+3];dst[dstOffset]=x0*w1+w0*x1+y0*z1-z0*y1;dst[dstOffset+1]=y0*w1+w0*y1+z0*x1-x0*z1;dst[dstOffset+2]=z0*w1+w0*z1+x0*y1-y0*x1;dst[dstOffset+3]=w0*w1-x0*x1-y0*y1-z0*z1;return dst;}get x(){return this._x;}set x(value){this._x=value;this._onChangeCallback();}get y(){return this._y;}set y(value){this._y=value;this._onChangeCallback();}get z(){return this._z;}set z(value){this._z=value;this._onChangeCallback();}get w(){return this._w;}set w(value){this._w=value;this._onChangeCallback();}set(x,y,z,w){this._x=x;this._y=y;this._z=z;this._w=w;this._onChangeCallback();return this;}clone(){return new this.constructor(this._x,this._y,this._z,this._w);}copy(quaternion){this._x=quaternion.x;this._y=quaternion.y;this._z=quaternion.z;this._w=quaternion.w;this._onChangeCallback();return this;}setFromEuler(euler,update=true){const x=euler._x,y=euler._y,z=euler._z,order=euler._order;// http://www.mathworks.com/matlabcentral/fileexchange/
// 	20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
//	content/SpinCalc.m
const cos=Math.cos;const sin=Math.sin;const c1=cos(x/2);const c2=cos(y/2);const c3=cos(z/2);const s1=sin(x/2);const s2=sin(y/2);const s3=sin(z/2);switch(order){case'XYZ':this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3;break;case'YXZ':this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3;break;case'ZXY':this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3;break;case'ZYX':this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3;break;case'YZX':this._x=s1*c2*c3+c1*s2*s3;this._y=c1*s2*c3+s1*c2*s3;this._z=c1*c2*s3-s1*s2*c3;this._w=c1*c2*c3-s1*s2*s3;break;case'XZY':this._x=s1*c2*c3-c1*s2*s3;this._y=c1*s2*c3-s1*c2*s3;this._z=c1*c2*s3+s1*s2*c3;this._w=c1*c2*c3+s1*s2*s3;break;default:console.warn('THREE.Quaternion: .setFromEuler() encountered an unknown order: '+order);}if(update===true)this._onChangeCallback();return this;}setFromAxisAngle(axis,angle){// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
// assumes axis is normalized
const halfAngle=angle/2,s=Math.sin(halfAngle);this._x=axis.x*s;this._y=axis.y*s;this._z=axis.z*s;this._w=Math.cos(halfAngle);this._onChangeCallback();return this;}setFromRotationMatrix(m){// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
const te=m.elements,m11=te[0],m12=te[4],m13=te[8],m21=te[1],m22=te[5],m23=te[9],m31=te[2],m32=te[6],m33=te[10],trace=m11+m22+m33;if(trace>0){const s=0.5/Math.sqrt(trace+1.0);this._w=0.25/s;this._x=(m32-m23)*s;this._y=(m13-m31)*s;this._z=(m21-m12)*s;}else if(m11>m22&&m11>m33){const s=2.0*Math.sqrt(1.0+m11-m22-m33);this._w=(m32-m23)/s;this._x=0.25*s;this._y=(m12+m21)/s;this._z=(m13+m31)/s;}else if(m22>m33){const s=2.0*Math.sqrt(1.0+m22-m11-m33);this._w=(m13-m31)/s;this._x=(m12+m21)/s;this._y=0.25*s;this._z=(m23+m32)/s;}else {const s=2.0*Math.sqrt(1.0+m33-m11-m22);this._w=(m21-m12)/s;this._x=(m13+m31)/s;this._y=(m23+m32)/s;this._z=0.25*s;}this._onChangeCallback();return this;}setFromUnitVectors(vFrom,vTo){// assumes direction vectors vFrom and vTo are normalized
let r=vFrom.dot(vTo)+1;if(r<Number.EPSILON){// vFrom and vTo point in opposite directions
r=0;if(Math.abs(vFrom.x)>Math.abs(vFrom.z)){this._x=-vFrom.y;this._y=vFrom.x;this._z=0;this._w=r;}else {this._x=0;this._y=-vFrom.z;this._z=vFrom.y;this._w=r;}}else {// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3
this._x=vFrom.y*vTo.z-vFrom.z*vTo.y;this._y=vFrom.z*vTo.x-vFrom.x*vTo.z;this._z=vFrom.x*vTo.y-vFrom.y*vTo.x;this._w=r;}return this.normalize();}angleTo(q){return 2*Math.acos(Math.abs(clamp$2(this.dot(q),-1,1)));}rotateTowards(q,step){const angle=this.angleTo(q);if(angle===0)return this;const t=Math.min(1,step/angle);this.slerp(q,t);return this;}identity(){return this.set(0,0,0,1);}invert(){// quaternion is assumed to have unit length
return this.conjugate();}conjugate(){this._x*=-1;this._y*=-1;this._z*=-1;this._onChangeCallback();return this;}dot(v){return this._x*v._x+this._y*v._y+this._z*v._z+this._w*v._w;}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w;}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w);}normalize(){let l=this.length();if(l===0){this._x=0;this._y=0;this._z=0;this._w=1;}else {l=1/l;this._x=this._x*l;this._y=this._y*l;this._z=this._z*l;this._w=this._w*l;}this._onChangeCallback();return this;}multiply(q){return this.multiplyQuaternions(this,q);}premultiply(q){return this.multiplyQuaternions(q,this);}multiplyQuaternions(a,b){// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
const qax=a._x,qay=a._y,qaz=a._z,qaw=a._w;const qbx=b._x,qby=b._y,qbz=b._z,qbw=b._w;this._x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;this._y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;this._z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;this._w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this._onChangeCallback();return this;}slerp(qb,t){if(t===0)return this;if(t===1)return this.copy(qb);const x=this._x,y=this._y,z=this._z,w=this._w;// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
let cosHalfTheta=w*qb._w+x*qb._x+y*qb._y+z*qb._z;if(cosHalfTheta<0){this._w=-qb._w;this._x=-qb._x;this._y=-qb._y;this._z=-qb._z;cosHalfTheta=-cosHalfTheta;}else {this.copy(qb);}if(cosHalfTheta>=1.0){this._w=w;this._x=x;this._y=y;this._z=z;return this;}const sqrSinHalfTheta=1.0-cosHalfTheta*cosHalfTheta;if(sqrSinHalfTheta<=Number.EPSILON){const s=1-t;this._w=s*w+t*this._w;this._x=s*x+t*this._x;this._y=s*y+t*this._y;this._z=s*z+t*this._z;this.normalize();// normalize calls _onChangeCallback()
return this;}const sinHalfTheta=Math.sqrt(sqrSinHalfTheta);const halfTheta=Math.atan2(sinHalfTheta,cosHalfTheta);const ratioA=Math.sin((1-t)*halfTheta)/sinHalfTheta,ratioB=Math.sin(t*halfTheta)/sinHalfTheta;this._w=w*ratioA+this._w*ratioB;this._x=x*ratioA+this._x*ratioB;this._y=y*ratioA+this._y*ratioB;this._z=z*ratioA+this._z*ratioB;this._onChangeCallback();return this;}slerpQuaternions(qa,qb,t){return this.copy(qa).slerp(qb,t);}random(){// sets this quaternion to a uniform random unit quaternnion
// Ken Shoemake
// Uniform random rotations
// D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.
const theta1=2*Math.PI*Math.random();const theta2=2*Math.PI*Math.random();const x0=Math.random();const r1=Math.sqrt(1-x0);const r2=Math.sqrt(x0);return this.set(r1*Math.sin(theta1),r1*Math.cos(theta1),r2*Math.sin(theta2),r2*Math.cos(theta2));}equals(quaternion){return quaternion._x===this._x&&quaternion._y===this._y&&quaternion._z===this._z&&quaternion._w===this._w;}fromArray(array,offset=0){this._x=array[offset];this._y=array[offset+1];this._z=array[offset+2];this._w=array[offset+3];this._onChangeCallback();return this;}toArray(array=[],offset=0){array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._w;return array;}fromBufferAttribute(attribute,index){this._x=attribute.getX(index);this._y=attribute.getY(index);this._z=attribute.getZ(index);this._w=attribute.getW(index);this._onChangeCallback();return this;}toJSON(){return this.toArray();}_onChange(callback){this._onChangeCallback=callback;return this;}_onChangeCallback(){}*[Symbol.iterator](){yield this._x;yield this._y;yield this._z;yield this._w;}}class Vector3$1{constructor(x=0,y=0,z=0){Vector3$1.prototype.isVector3=true;this.x=x;this.y=y;this.z=z;}set(x,y,z){if(z===undefined)z=this.z;// sprite.scale.set(x,y)
this.x=x;this.y=y;this.z=z;return this;}setScalar(scalar){this.x=scalar;this.y=scalar;this.z=scalar;return this;}setX(x){this.x=x;return this;}setY(y){this.y=y;return this;}setZ(z){this.z=z;return this;}setComponent(index,value){switch(index){case 0:this.x=value;break;case 1:this.y=value;break;case 2:this.z=value;break;default:throw new Error('index is out of range: '+index);}return this;}getComponent(index){switch(index){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error('index is out of range: '+index);}}clone(){return new this.constructor(this.x,this.y,this.z);}copy(v){this.x=v.x;this.y=v.y;this.z=v.z;return this;}add(v){this.x+=v.x;this.y+=v.y;this.z+=v.z;return this;}addScalar(s){this.x+=s;this.y+=s;this.z+=s;return this;}addVectors(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this;}addScaledVector(v,s){this.x+=v.x*s;this.y+=v.y*s;this.z+=v.z*s;return this;}sub(v){this.x-=v.x;this.y-=v.y;this.z-=v.z;return this;}subScalar(s){this.x-=s;this.y-=s;this.z-=s;return this;}subVectors(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this;}multiply(v){this.x*=v.x;this.y*=v.y;this.z*=v.z;return this;}multiplyScalar(scalar){this.x*=scalar;this.y*=scalar;this.z*=scalar;return this;}multiplyVectors(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this;}applyEuler(euler){return this.applyQuaternion(_quaternion$4.setFromEuler(euler));}applyAxisAngle(axis,angle){return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis,angle));}applyMatrix3(m){const x=this.x,y=this.y,z=this.z;const e=m.elements;this.x=e[0]*x+e[3]*y+e[6]*z;this.y=e[1]*x+e[4]*y+e[7]*z;this.z=e[2]*x+e[5]*y+e[8]*z;return this;}applyNormalMatrix(m){return this.applyMatrix3(m).normalize();}applyMatrix4(m){const x=this.x,y=this.y,z=this.z;const e=m.elements;const w=1/(e[3]*x+e[7]*y+e[11]*z+e[15]);this.x=(e[0]*x+e[4]*y+e[8]*z+e[12])*w;this.y=(e[1]*x+e[5]*y+e[9]*z+e[13])*w;this.z=(e[2]*x+e[6]*y+e[10]*z+e[14])*w;return this;}applyQuaternion(q){// quaternion q is assumed to have unit length
const vx=this.x,vy=this.y,vz=this.z;const qx=q.x,qy=q.y,qz=q.z,qw=q.w;// t = 2 * cross( q.xyz, v );
const tx=2*(qy*vz-qz*vy);const ty=2*(qz*vx-qx*vz);const tz=2*(qx*vy-qy*vx);// v + q.w * t + cross( q.xyz, t );
this.x=vx+qw*tx+qy*tz-qz*ty;this.y=vy+qw*ty+qz*tx-qx*tz;this.z=vz+qw*tz+qx*ty-qy*tx;return this;}project(camera){return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix);}unproject(camera){return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld);}transformDirection(m){// input: THREE.Matrix4 affine matrix
// vector interpreted as a direction
const x=this.x,y=this.y,z=this.z;const e=m.elements;this.x=e[0]*x+e[4]*y+e[8]*z;this.y=e[1]*x+e[5]*y+e[9]*z;this.z=e[2]*x+e[6]*y+e[10]*z;return this.normalize();}divide(v){this.x/=v.x;this.y/=v.y;this.z/=v.z;return this;}divideScalar(scalar){return this.multiplyScalar(1/scalar);}min(v){this.x=Math.min(this.x,v.x);this.y=Math.min(this.y,v.y);this.z=Math.min(this.z,v.z);return this;}max(v){this.x=Math.max(this.x,v.x);this.y=Math.max(this.y,v.y);this.z=Math.max(this.z,v.z);return this;}clamp(min,max){// assumes min < max, componentwise
this.x=Math.max(min.x,Math.min(max.x,this.x));this.y=Math.max(min.y,Math.min(max.y,this.y));this.z=Math.max(min.z,Math.min(max.z,this.z));return this;}clampScalar(minVal,maxVal){this.x=Math.max(minVal,Math.min(maxVal,this.x));this.y=Math.max(minVal,Math.min(maxVal,this.y));this.z=Math.max(minVal,Math.min(maxVal,this.z));return this;}clampLength(min,max){const length=this.length();return this.divideScalar(length||1).multiplyScalar(Math.max(min,Math.min(max,length)));}floor(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this;}ceil(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this;}round(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this;}roundToZero(){this.x=Math.trunc(this.x);this.y=Math.trunc(this.y);this.z=Math.trunc(this.z);return this;}negate(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this;}dot(v){return this.x*v.x+this.y*v.y+this.z*v.z;}// TODO lengthSquared?
lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z;}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z);}normalize(){return this.divideScalar(this.length()||1);}setLength(length){return this.normalize().multiplyScalar(length);}lerp(v,alpha){this.x+=(v.x-this.x)*alpha;this.y+=(v.y-this.y)*alpha;this.z+=(v.z-this.z)*alpha;return this;}lerpVectors(v1,v2,alpha){this.x=v1.x+(v2.x-v1.x)*alpha;this.y=v1.y+(v2.y-v1.y)*alpha;this.z=v1.z+(v2.z-v1.z)*alpha;return this;}cross(v){return this.crossVectors(this,v);}crossVectors(a,b){const ax=a.x,ay=a.y,az=a.z;const bx=b.x,by=b.y,bz=b.z;this.x=ay*bz-az*by;this.y=az*bx-ax*bz;this.z=ax*by-ay*bx;return this;}projectOnVector(v){const denominator=v.lengthSq();if(denominator===0)return this.set(0,0,0);const scalar=v.dot(this)/denominator;return this.copy(v).multiplyScalar(scalar);}projectOnPlane(planeNormal){_vector$c.copy(this).projectOnVector(planeNormal);return this.sub(_vector$c);}reflect(normal){// reflect incident vector off plane orthogonal to normal
// normal is assumed to have unit length
return this.sub(_vector$c.copy(normal).multiplyScalar(2*this.dot(normal)));}angleTo(v){const denominator=Math.sqrt(this.lengthSq()*v.lengthSq());if(denominator===0)return Math.PI/2;const theta=this.dot(v)/denominator;// clamp, to handle numerical problems
return Math.acos(clamp$2(theta,-1,1));}distanceTo(v){return Math.sqrt(this.distanceToSquared(v));}distanceToSquared(v){const dx=this.x-v.x,dy=this.y-v.y,dz=this.z-v.z;return dx*dx+dy*dy+dz*dz;}manhattanDistanceTo(v){return Math.abs(this.x-v.x)+Math.abs(this.y-v.y)+Math.abs(this.z-v.z);}setFromSpherical(s){return this.setFromSphericalCoords(s.radius,s.phi,s.theta);}setFromSphericalCoords(radius,phi,theta){const sinPhiRadius=Math.sin(phi)*radius;this.x=sinPhiRadius*Math.sin(theta);this.y=Math.cos(phi)*radius;this.z=sinPhiRadius*Math.cos(theta);return this;}setFromCylindrical(c){return this.setFromCylindricalCoords(c.radius,c.theta,c.y);}setFromCylindricalCoords(radius,theta,y){this.x=radius*Math.sin(theta);this.y=y;this.z=radius*Math.cos(theta);return this;}setFromMatrixPosition(m){const e=m.elements;this.x=e[12];this.y=e[13];this.z=e[14];return this;}setFromMatrixScale(m){const sx=this.setFromMatrixColumn(m,0).length();const sy=this.setFromMatrixColumn(m,1).length();const sz=this.setFromMatrixColumn(m,2).length();this.x=sx;this.y=sy;this.z=sz;return this;}setFromMatrixColumn(m,index){return this.fromArray(m.elements,index*4);}setFromMatrix3Column(m,index){return this.fromArray(m.elements,index*3);}setFromEuler(e){this.x=e._x;this.y=e._y;this.z=e._z;return this;}setFromColor(c){this.x=c.r;this.y=c.g;this.z=c.b;return this;}equals(v){return v.x===this.x&&v.y===this.y&&v.z===this.z;}fromArray(array,offset=0){this.x=array[offset];this.y=array[offset+1];this.z=array[offset+2];return this;}toArray(array=[],offset=0){array[offset]=this.x;array[offset+1]=this.y;array[offset+2]=this.z;return array;}fromBufferAttribute(attribute,index){this.x=attribute.getX(index);this.y=attribute.getY(index);this.z=attribute.getZ(index);return this;}random(){this.x=Math.random();this.y=Math.random();this.z=Math.random();return this;}randomDirection(){// https://mathworld.wolfram.com/SpherePointPicking.html
const theta=Math.random()*Math.PI*2;const u=Math.random()*2-1;const c=Math.sqrt(1-u*u);this.x=c*Math.cos(theta);this.y=u;this.z=c*Math.sin(theta);return this;}*[Symbol.iterator](){yield this.x;yield this.y;yield this.z;}}const _vector$c=/*@__PURE__*/new Vector3$1();const _quaternion$4=/*@__PURE__*/new Quaternion$1();class Box3$1{constructor(min=new Vector3$1(+Infinity,+Infinity,+Infinity),max=new Vector3$1(-Infinity,-Infinity,-Infinity)){this.isBox3=true;this.min=min;this.max=max;}set(min,max){this.min.copy(min);this.max.copy(max);return this;}setFromArray(array){this.makeEmpty();for(let i=0,il=array.length;i<il;i+=3){this.expandByPoint(_vector$b.fromArray(array,i));}return this;}setFromBufferAttribute(attribute){this.makeEmpty();for(let i=0,il=attribute.count;i<il;i++){this.expandByPoint(_vector$b.fromBufferAttribute(attribute,i));}return this;}setFromPoints(points){this.makeEmpty();for(let i=0,il=points.length;i<il;i++){this.expandByPoint(points[i]);}return this;}setFromCenterAndSize(center,size){const halfSize=_vector$b.copy(size).multiplyScalar(0.5);this.min.copy(center).sub(halfSize);this.max.copy(center).add(halfSize);return this;}setFromObject(object,precise=false){this.makeEmpty();return this.expandByObject(object,precise);}clone(){return new this.constructor().copy(this);}copy(box){this.min.copy(box.min);this.max.copy(box.max);return this;}makeEmpty(){this.min.x=this.min.y=this.min.z=+Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this;}isEmpty(){// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z;}getCenter(target){return this.isEmpty()?target.set(0,0,0):target.addVectors(this.min,this.max).multiplyScalar(0.5);}getSize(target){return this.isEmpty()?target.set(0,0,0):target.subVectors(this.max,this.min);}expandByPoint(point){this.min.min(point);this.max.max(point);return this;}expandByVector(vector){this.min.sub(vector);this.max.add(vector);return this;}expandByScalar(scalar){this.min.addScalar(-scalar);this.max.addScalar(scalar);return this;}expandByObject(object,precise=false){// Computes the world-axis-aligned bounding box of an object (including its children),
// accounting for both the object's, and children's, world transforms
object.updateWorldMatrix(false,false);const geometry=object.geometry;if(geometry!==undefined){const positionAttribute=geometry.getAttribute('position');// precise AABB computation based on vertex data requires at least a position attribute.
// instancing isn't supported so far and uses the normal (conservative) code path.
if(precise===true&&positionAttribute!==undefined&&object.isInstancedMesh!==true){for(let i=0,l=positionAttribute.count;i<l;i++){if(object.isMesh===true){object.getVertexPosition(i,_vector$b);}else {_vector$b.fromBufferAttribute(positionAttribute,i);}_vector$b.applyMatrix4(object.matrixWorld);this.expandByPoint(_vector$b);}}else {if(object.boundingBox!==undefined){// object-level bounding box
if(object.boundingBox===null){object.computeBoundingBox();}_box$4.copy(object.boundingBox);}else {// geometry-level bounding box
if(geometry.boundingBox===null){geometry.computeBoundingBox();}_box$4.copy(geometry.boundingBox);}_box$4.applyMatrix4(object.matrixWorld);this.union(_box$4);}}const children=object.children;for(let i=0,l=children.length;i<l;i++){this.expandByObject(children[i],precise);}return this;}containsPoint(point){return point.x>=this.min.x&&point.x<=this.max.x&&point.y>=this.min.y&&point.y<=this.max.y&&point.z>=this.min.z&&point.z<=this.max.z;}containsBox(box){return this.min.x<=box.min.x&&box.max.x<=this.max.x&&this.min.y<=box.min.y&&box.max.y<=this.max.y&&this.min.z<=box.min.z&&box.max.z<=this.max.z;}getParameter(point,target){// This can potentially have a divide by zero if the box
// has a size dimension of 0.
return target.set((point.x-this.min.x)/(this.max.x-this.min.x),(point.y-this.min.y)/(this.max.y-this.min.y),(point.z-this.min.z)/(this.max.z-this.min.z));}intersectsBox(box){// using 6 splitting planes to rule out intersections.
return box.max.x>=this.min.x&&box.min.x<=this.max.x&&box.max.y>=this.min.y&&box.min.y<=this.max.y&&box.max.z>=this.min.z&&box.min.z<=this.max.z;}intersectsSphere(sphere){// Find the point on the AABB closest to the sphere center.
this.clampPoint(sphere.center,_vector$b);// If that point is inside the sphere, the AABB and sphere intersect.
return _vector$b.distanceToSquared(sphere.center)<=sphere.radius*sphere.radius;}intersectsPlane(plane){// We compute the minimum and maximum dot product values. If those values
// are on the same side (back or front) of the plane, then there is no intersection.
let min,max;if(plane.normal.x>0){min=plane.normal.x*this.min.x;max=plane.normal.x*this.max.x;}else {min=plane.normal.x*this.max.x;max=plane.normal.x*this.min.x;}if(plane.normal.y>0){min+=plane.normal.y*this.min.y;max+=plane.normal.y*this.max.y;}else {min+=plane.normal.y*this.max.y;max+=plane.normal.y*this.min.y;}if(plane.normal.z>0){min+=plane.normal.z*this.min.z;max+=plane.normal.z*this.max.z;}else {min+=plane.normal.z*this.max.z;max+=plane.normal.z*this.min.z;}return min<=-plane.constant&&max>=-plane.constant;}intersectsTriangle(triangle){if(this.isEmpty()){return false;}// compute box center and extents
this.getCenter(_center$1);_extents$1.subVectors(this.max,_center$1);// translate triangle to aabb origin
_v0$3.subVectors(triangle.a,_center$1);_v1$7.subVectors(triangle.b,_center$1);_v2$4.subVectors(triangle.c,_center$1);// compute edge vectors for triangle
_f0$1.subVectors(_v1$7,_v0$3);_f1$1.subVectors(_v2$4,_v1$7);_f2$1.subVectors(_v0$3,_v2$4);// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
let axes=[0,-_f0$1.z,_f0$1.y,0,-_f1$1.z,_f1$1.y,0,-_f2$1.z,_f2$1.y,_f0$1.z,0,-_f0$1.x,_f1$1.z,0,-_f1$1.x,_f2$1.z,0,-_f2$1.x,-_f0$1.y,_f0$1.x,0,-_f1$1.y,_f1$1.x,0,-_f2$1.y,_f2$1.x,0];if(!satForAxes$1(axes,_v0$3,_v1$7,_v2$4,_extents$1)){return false;}// test 3 face normals from the aabb
axes=[1,0,0,0,1,0,0,0,1];if(!satForAxes$1(axes,_v0$3,_v1$7,_v2$4,_extents$1)){return false;}// finally testing the face normal of the triangle
// use already existing triangle edge vectors here
_triangleNormal$1.crossVectors(_f0$1,_f1$1);axes=[_triangleNormal$1.x,_triangleNormal$1.y,_triangleNormal$1.z];return satForAxes$1(axes,_v0$3,_v1$7,_v2$4,_extents$1);}clampPoint(point,target){return target.copy(point).clamp(this.min,this.max);}distanceToPoint(point){return this.clampPoint(point,_vector$b).distanceTo(point);}getBoundingSphere(target){if(this.isEmpty()){target.makeEmpty();}else {this.getCenter(target.center);target.radius=this.getSize(_vector$b).length()*0.5;}return target;}intersect(box){this.min.max(box.min);this.max.min(box.max);// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.
if(this.isEmpty())this.makeEmpty();return this;}union(box){this.min.min(box.min);this.max.max(box.max);return this;}applyMatrix4(matrix){// transform of empty box is an empty box.
if(this.isEmpty())return this;// NOTE: I am using a binary pattern to specify all 2^3 combinations below
_points$1[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(matrix);// 000
_points$1[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(matrix);// 001
_points$1[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(matrix);// 010
_points$1[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(matrix);// 011
_points$1[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(matrix);// 100
_points$1[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(matrix);// 101
_points$1[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(matrix);// 110
_points$1[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(matrix);// 111
this.setFromPoints(_points$1);return this;}translate(offset){this.min.add(offset);this.max.add(offset);return this;}equals(box){return box.min.equals(this.min)&&box.max.equals(this.max);}}const _points$1=[/*@__PURE__*/new Vector3$1(),/*@__PURE__*/new Vector3$1(),/*@__PURE__*/new Vector3$1(),/*@__PURE__*/new Vector3$1(),/*@__PURE__*/new Vector3$1(),/*@__PURE__*/new Vector3$1(),/*@__PURE__*/new Vector3$1(),/*@__PURE__*/new Vector3$1()];const _vector$b=/*@__PURE__*/new Vector3$1();const _box$4=/*@__PURE__*/new Box3$1();// triangle centered vertices
const _v0$3=/*@__PURE__*/new Vector3$1();const _v1$7=/*@__PURE__*/new Vector3$1();const _v2$4=/*@__PURE__*/new Vector3$1();// triangle edge vectors
const _f0$1=/*@__PURE__*/new Vector3$1();const _f1$1=/*@__PURE__*/new Vector3$1();const _f2$1=/*@__PURE__*/new Vector3$1();const _center$1=/*@__PURE__*/new Vector3$1();const _extents$1=/*@__PURE__*/new Vector3$1();const _triangleNormal$1=/*@__PURE__*/new Vector3$1();const _testAxis$1=/*@__PURE__*/new Vector3$1();function satForAxes$1(axes,v0,v1,v2,extents){for(let i=0,j=axes.length-3;i<=j;i+=3){_testAxis$1.fromArray(axes,i);// project the aabb onto the separating axis
const r=extents.x*Math.abs(_testAxis$1.x)+extents.y*Math.abs(_testAxis$1.y)+extents.z*Math.abs(_testAxis$1.z);// project all 3 vertices of the triangle onto the separating axis
const p0=v0.dot(_testAxis$1);const p1=v1.dot(_testAxis$1);const p2=v2.dot(_testAxis$1);// actual test, basically see if either of the most extreme of the triangle points intersects r
if(Math.max(-Math.max(p0,p1,p2),Math.min(p0,p1,p2))>r){// points of the projected triangle are outside the projected half-length of the aabb
// the axis is separating and we can exit
return false;}}return true;}const _box$3=/*@__PURE__*/new Box3$1();const _v1$6=/*@__PURE__*/new Vector3$1();const _v2$3=/*@__PURE__*/new Vector3$1();class Sphere$1{constructor(center=new Vector3$1(),radius=-1){this.isSphere=true;this.center=center;this.radius=radius;}set(center,radius){this.center.copy(center);this.radius=radius;return this;}setFromPoints(points,optionalCenter){const center=this.center;if(optionalCenter!==undefined){center.copy(optionalCenter);}else {_box$3.setFromPoints(points).getCenter(center);}let maxRadiusSq=0;for(let i=0,il=points.length;i<il;i++){maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(points[i]));}this.radius=Math.sqrt(maxRadiusSq);return this;}copy(sphere){this.center.copy(sphere.center);this.radius=sphere.radius;return this;}isEmpty(){return this.radius<0;}makeEmpty(){this.center.set(0,0,0);this.radius=-1;return this;}containsPoint(point){return point.distanceToSquared(this.center)<=this.radius*this.radius;}distanceToPoint(point){return point.distanceTo(this.center)-this.radius;}intersectsSphere(sphere){const radiusSum=this.radius+sphere.radius;return sphere.center.distanceToSquared(this.center)<=radiusSum*radiusSum;}intersectsBox(box){return box.intersectsSphere(this);}intersectsPlane(plane){return Math.abs(plane.distanceToPoint(this.center))<=this.radius;}clampPoint(point,target){const deltaLengthSq=this.center.distanceToSquared(point);target.copy(point);if(deltaLengthSq>this.radius*this.radius){target.sub(this.center).normalize();target.multiplyScalar(this.radius).add(this.center);}return target;}getBoundingBox(target){if(this.isEmpty()){// Empty sphere produces empty bounding box
target.makeEmpty();return target;}target.set(this.center,this.center);target.expandByScalar(this.radius);return target;}applyMatrix4(matrix){this.center.applyMatrix4(matrix);this.radius=this.radius*matrix.getMaxScaleOnAxis();return this;}translate(offset){this.center.add(offset);return this;}expandByPoint(point){if(this.isEmpty()){this.center.copy(point);this.radius=0;return this;}_v1$6.subVectors(point,this.center);const lengthSq=_v1$6.lengthSq();if(lengthSq>this.radius*this.radius){// calculate the minimal sphere
const length=Math.sqrt(lengthSq);const delta=(length-this.radius)*0.5;this.center.addScaledVector(_v1$6,delta/length);this.radius+=delta;}return this;}union(sphere){if(sphere.isEmpty()){return this;}if(this.isEmpty()){this.copy(sphere);return this;}if(this.center.equals(sphere.center)===true){this.radius=Math.max(this.radius,sphere.radius);}else {_v2$3.subVectors(sphere.center,this.center).setLength(sphere.radius);this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3));this.expandByPoint(_v1$6.copy(sphere.center).sub(_v2$3));}return this;}equals(sphere){return sphere.center.equals(this.center)&&sphere.radius===this.radius;}clone(){return new this.constructor().copy(this);}}const _vector$a=/*@__PURE__*/new Vector3$1();const _segCenter$1=/*@__PURE__*/new Vector3$1();const _segDir$1=/*@__PURE__*/new Vector3$1();const _diff$1=/*@__PURE__*/new Vector3$1();const _edge1$1=/*@__PURE__*/new Vector3$1();const _edge2$1=/*@__PURE__*/new Vector3$1();const _normal$1$1=/*@__PURE__*/new Vector3$1();class Ray$1{constructor(origin=new Vector3$1(),direction=new Vector3$1(0,0,-1)){this.origin=origin;this.direction=direction;}set(origin,direction){this.origin.copy(origin);this.direction.copy(direction);return this;}copy(ray){this.origin.copy(ray.origin);this.direction.copy(ray.direction);return this;}at(t,target){return target.copy(this.origin).addScaledVector(this.direction,t);}lookAt(v){this.direction.copy(v).sub(this.origin).normalize();return this;}recast(t){this.origin.copy(this.at(t,_vector$a));return this;}closestPointToPoint(point,target){target.subVectors(point,this.origin);const directionDistance=target.dot(this.direction);if(directionDistance<0){return target.copy(this.origin);}return target.copy(this.origin).addScaledVector(this.direction,directionDistance);}distanceToPoint(point){return Math.sqrt(this.distanceSqToPoint(point));}distanceSqToPoint(point){const directionDistance=_vector$a.subVectors(point,this.origin).dot(this.direction);// point behind the ray
if(directionDistance<0){return this.origin.distanceToSquared(point);}_vector$a.copy(this.origin).addScaledVector(this.direction,directionDistance);return _vector$a.distanceToSquared(point);}distanceSqToSegment(v0,v1,optionalPointOnRay,optionalPointOnSegment){// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h
// It returns the min distance between the ray and the segment
// defined by v0 and v1
// It can also set two optional targets :
// - The closest point on the ray
// - The closest point on the segment
_segCenter$1.copy(v0).add(v1).multiplyScalar(0.5);_segDir$1.copy(v1).sub(v0).normalize();_diff$1.copy(this.origin).sub(_segCenter$1);const segExtent=v0.distanceTo(v1)*0.5;const a01=-this.direction.dot(_segDir$1);const b0=_diff$1.dot(this.direction);const b1=-_diff$1.dot(_segDir$1);const c=_diff$1.lengthSq();const det=Math.abs(1-a01*a01);let s0,s1,sqrDist,extDet;if(det>0){// The ray and segment are not parallel.
s0=a01*b1-b0;s1=a01*b0-b1;extDet=segExtent*det;if(s0>=0){if(s1>=-extDet){if(s1<=extDet){// region 0
// Minimum at interior points of ray and segment.
const invDet=1/det;s0*=invDet;s1*=invDet;sqrDist=s0*(s0+a01*s1+2*b0)+s1*(a01*s0+s1+2*b1)+c;}else {// region 1
s1=segExtent;s0=Math.max(0,-(a01*s1+b0));sqrDist=-s0*s0+s1*(s1+2*b1)+c;}}else {// region 5
s1=-segExtent;s0=Math.max(0,-(a01*s1+b0));sqrDist=-s0*s0+s1*(s1+2*b1)+c;}}else {if(s1<=-extDet){// region 4
s0=Math.max(0,-(-a01*segExtent+b0));s1=s0>0?-segExtent:Math.min(Math.max(-segExtent,-b1),segExtent);sqrDist=-s0*s0+s1*(s1+2*b1)+c;}else if(s1<=extDet){// region 3
s0=0;s1=Math.min(Math.max(-segExtent,-b1),segExtent);sqrDist=s1*(s1+2*b1)+c;}else {// region 2
s0=Math.max(0,-(a01*segExtent+b0));s1=s0>0?segExtent:Math.min(Math.max(-segExtent,-b1),segExtent);sqrDist=-s0*s0+s1*(s1+2*b1)+c;}}}else {// Ray and segment are parallel.
s1=a01>0?-segExtent:segExtent;s0=Math.max(0,-(a01*s1+b0));sqrDist=-s0*s0+s1*(s1+2*b1)+c;}if(optionalPointOnRay){optionalPointOnRay.copy(this.origin).addScaledVector(this.direction,s0);}if(optionalPointOnSegment){optionalPointOnSegment.copy(_segCenter$1).addScaledVector(_segDir$1,s1);}return sqrDist;}intersectSphere(sphere,target){_vector$a.subVectors(sphere.center,this.origin);const tca=_vector$a.dot(this.direction);const d2=_vector$a.dot(_vector$a)-tca*tca;const radius2=sphere.radius*sphere.radius;if(d2>radius2)return null;const thc=Math.sqrt(radius2-d2);// t0 = first intersect point - entrance on front of sphere
const t0=tca-thc;// t1 = second intersect point - exit point on back of sphere
const t1=tca+thc;// test to see if t1 is behind the ray - if so, return null
if(t1<0)return null;// test to see if t0 is behind the ray:
// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,
// in order to always return an intersect point that is in front of the ray.
if(t0<0)return this.at(t1,target);// else t0 is in front of the ray, so return the first collision point scaled by t0
return this.at(t0,target);}intersectsSphere(sphere){return this.distanceSqToPoint(sphere.center)<=sphere.radius*sphere.radius;}distanceToPlane(plane){const denominator=plane.normal.dot(this.direction);if(denominator===0){// line is coplanar, return origin
if(plane.distanceToPoint(this.origin)===0){return 0;}// Null is preferable to undefined since undefined means.... it is undefined
return null;}const t=-(this.origin.dot(plane.normal)+plane.constant)/denominator;// Return if the ray never intersects the plane
return t>=0?t:null;}intersectPlane(plane,target){const t=this.distanceToPlane(plane);if(t===null){return null;}return this.at(t,target);}intersectsPlane(plane){// check if the ray lies on the plane first
const distToPoint=plane.distanceToPoint(this.origin);if(distToPoint===0){return true;}const denominator=plane.normal.dot(this.direction);if(denominator*distToPoint<0){return true;}// ray origin is behind the plane (and is pointing behind it)
return false;}intersectBox(box,target){let tmin,tmax,tymin,tymax,tzmin,tzmax;const invdirx=1/this.direction.x,invdiry=1/this.direction.y,invdirz=1/this.direction.z;const origin=this.origin;if(invdirx>=0){tmin=(box.min.x-origin.x)*invdirx;tmax=(box.max.x-origin.x)*invdirx;}else {tmin=(box.max.x-origin.x)*invdirx;tmax=(box.min.x-origin.x)*invdirx;}if(invdiry>=0){tymin=(box.min.y-origin.y)*invdiry;tymax=(box.max.y-origin.y)*invdiry;}else {tymin=(box.max.y-origin.y)*invdiry;tymax=(box.min.y-origin.y)*invdiry;}if(tmin>tymax||tymin>tmax)return null;if(tymin>tmin||isNaN(tmin))tmin=tymin;if(tymax<tmax||isNaN(tmax))tmax=tymax;if(invdirz>=0){tzmin=(box.min.z-origin.z)*invdirz;tzmax=(box.max.z-origin.z)*invdirz;}else {tzmin=(box.max.z-origin.z)*invdirz;tzmax=(box.min.z-origin.z)*invdirz;}if(tmin>tzmax||tzmin>tmax)return null;if(tzmin>tmin||tmin!==tmin)tmin=tzmin;if(tzmax<tmax||tmax!==tmax)tmax=tzmax;//return point closest to the ray (positive side)
if(tmax<0)return null;return this.at(tmin>=0?tmin:tmax,target);}intersectsBox(box){return this.intersectBox(box,_vector$a)!==null;}intersectTriangle(a,b,c,backfaceCulling,target){// Compute the offset origin, edges, and normal.
// from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
_edge1$1.subVectors(b,a);_edge2$1.subVectors(c,a);_normal$1$1.crossVectors(_edge1$1,_edge2$1);// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,
// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
//   |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
//   |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
//   |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
let DdN=this.direction.dot(_normal$1$1);let sign;if(DdN>0){if(backfaceCulling)return null;sign=1;}else if(DdN<0){sign=-1;DdN=-DdN;}else {return null;}_diff$1.subVectors(this.origin,a);const DdQxE2=sign*this.direction.dot(_edge2$1.crossVectors(_diff$1,_edge2$1));// b1 < 0, no intersection
if(DdQxE2<0){return null;}const DdE1xQ=sign*this.direction.dot(_edge1$1.cross(_diff$1));// b2 < 0, no intersection
if(DdE1xQ<0){return null;}// b1+b2 > 1, no intersection
if(DdQxE2+DdE1xQ>DdN){return null;}// Line intersects triangle, check if ray does.
const QdN=-sign*_diff$1.dot(_normal$1$1);// t < 0, no intersection
if(QdN<0){return null;}// Ray intersects triangle.
return this.at(QdN/DdN,target);}applyMatrix4(matrix4){this.origin.applyMatrix4(matrix4);this.direction.transformDirection(matrix4);return this;}equals(ray){return ray.origin.equals(this.origin)&&ray.direction.equals(this.direction);}clone(){return new this.constructor().copy(this);}}class Matrix4$1{constructor(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){Matrix4$1.prototype.isMatrix4=true;this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];if(n11!==undefined){this.set(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44);}}set(n11,n12,n13,n14,n21,n22,n23,n24,n31,n32,n33,n34,n41,n42,n43,n44){const te=this.elements;te[0]=n11;te[4]=n12;te[8]=n13;te[12]=n14;te[1]=n21;te[5]=n22;te[9]=n23;te[13]=n24;te[2]=n31;te[6]=n32;te[10]=n33;te[14]=n34;te[3]=n41;te[7]=n42;te[11]=n43;te[15]=n44;return this;}identity(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this;}clone(){return new Matrix4$1().fromArray(this.elements);}copy(m){const te=this.elements;const me=m.elements;te[0]=me[0];te[1]=me[1];te[2]=me[2];te[3]=me[3];te[4]=me[4];te[5]=me[5];te[6]=me[6];te[7]=me[7];te[8]=me[8];te[9]=me[9];te[10]=me[10];te[11]=me[11];te[12]=me[12];te[13]=me[13];te[14]=me[14];te[15]=me[15];return this;}copyPosition(m){const te=this.elements,me=m.elements;te[12]=me[12];te[13]=me[13];te[14]=me[14];return this;}setFromMatrix3(m){const me=m.elements;this.set(me[0],me[3],me[6],0,me[1],me[4],me[7],0,me[2],me[5],me[8],0,0,0,0,1);return this;}extractBasis(xAxis,yAxis,zAxis){xAxis.setFromMatrixColumn(this,0);yAxis.setFromMatrixColumn(this,1);zAxis.setFromMatrixColumn(this,2);return this;}makeBasis(xAxis,yAxis,zAxis){this.set(xAxis.x,yAxis.x,zAxis.x,0,xAxis.y,yAxis.y,zAxis.y,0,xAxis.z,yAxis.z,zAxis.z,0,0,0,0,1);return this;}extractRotation(m){// this method does not support reflection matrices
const te=this.elements;const me=m.elements;const scaleX=1/_v1$5.setFromMatrixColumn(m,0).length();const scaleY=1/_v1$5.setFromMatrixColumn(m,1).length();const scaleZ=1/_v1$5.setFromMatrixColumn(m,2).length();te[0]=me[0]*scaleX;te[1]=me[1]*scaleX;te[2]=me[2]*scaleX;te[3]=0;te[4]=me[4]*scaleY;te[5]=me[5]*scaleY;te[6]=me[6]*scaleY;te[7]=0;te[8]=me[8]*scaleZ;te[9]=me[9]*scaleZ;te[10]=me[10]*scaleZ;te[11]=0;te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this;}makeRotationFromEuler(euler){const te=this.elements;const x=euler.x,y=euler.y,z=euler.z;const a=Math.cos(x),b=Math.sin(x);const c=Math.cos(y),d=Math.sin(y);const e=Math.cos(z),f=Math.sin(z);if(euler.order==='XYZ'){const ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=-c*f;te[8]=d;te[1]=af+be*d;te[5]=ae-bf*d;te[9]=-b*c;te[2]=bf-ae*d;te[6]=be+af*d;te[10]=a*c;}else if(euler.order==='YXZ'){const ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce+df*b;te[4]=de*b-cf;te[8]=a*d;te[1]=a*f;te[5]=a*e;te[9]=-b;te[2]=cf*b-de;te[6]=df+ce*b;te[10]=a*c;}else if(euler.order==='ZXY'){const ce=c*e,cf=c*f,de=d*e,df=d*f;te[0]=ce-df*b;te[4]=-a*f;te[8]=de+cf*b;te[1]=cf+de*b;te[5]=a*e;te[9]=df-ce*b;te[2]=-a*d;te[6]=b;te[10]=a*c;}else if(euler.order==='ZYX'){const ae=a*e,af=a*f,be=b*e,bf=b*f;te[0]=c*e;te[4]=be*d-af;te[8]=ae*d+bf;te[1]=c*f;te[5]=bf*d+ae;te[9]=af*d-be;te[2]=-d;te[6]=b*c;te[10]=a*c;}else if(euler.order==='YZX'){const ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=bd-ac*f;te[8]=bc*f+ad;te[1]=f;te[5]=a*e;te[9]=-b*e;te[2]=-d*e;te[6]=ad*f+bc;te[10]=ac-bd*f;}else if(euler.order==='XZY'){const ac=a*c,ad=a*d,bc=b*c,bd=b*d;te[0]=c*e;te[4]=-f;te[8]=d*e;te[1]=ac*f+bd;te[5]=a*e;te[9]=ad*f-bc;te[2]=bc*f-ad;te[6]=b*e;te[10]=bd*f+ac;}// bottom row
te[3]=0;te[7]=0;te[11]=0;// last column
te[12]=0;te[13]=0;te[14]=0;te[15]=1;return this;}makeRotationFromQuaternion(q){return this.compose(_zero$1,q,_one$1);}lookAt(eye,target,up){const te=this.elements;_z$1.subVectors(eye,target);if(_z$1.lengthSq()===0){// eye and target are in the same position
_z$1.z=1;}_z$1.normalize();_x$1.crossVectors(up,_z$1);if(_x$1.lengthSq()===0){// up and z are parallel
if(Math.abs(up.z)===1){_z$1.x+=0.0001;}else {_z$1.z+=0.0001;}_z$1.normalize();_x$1.crossVectors(up,_z$1);}_x$1.normalize();_y$1.crossVectors(_z$1,_x$1);te[0]=_x$1.x;te[4]=_y$1.x;te[8]=_z$1.x;te[1]=_x$1.y;te[5]=_y$1.y;te[9]=_z$1.y;te[2]=_x$1.z;te[6]=_y$1.z;te[10]=_z$1.z;return this;}multiply(m){return this.multiplyMatrices(this,m);}premultiply(m){return this.multiplyMatrices(m,this);}multiplyMatrices(a,b){const ae=a.elements;const be=b.elements;const te=this.elements;const a11=ae[0],a12=ae[4],a13=ae[8],a14=ae[12];const a21=ae[1],a22=ae[5],a23=ae[9],a24=ae[13];const a31=ae[2],a32=ae[6],a33=ae[10],a34=ae[14];const a41=ae[3],a42=ae[7],a43=ae[11],a44=ae[15];const b11=be[0],b12=be[4],b13=be[8],b14=be[12];const b21=be[1],b22=be[5],b23=be[9],b24=be[13];const b31=be[2],b32=be[6],b33=be[10],b34=be[14];const b41=be[3],b42=be[7],b43=be[11],b44=be[15];te[0]=a11*b11+a12*b21+a13*b31+a14*b41;te[4]=a11*b12+a12*b22+a13*b32+a14*b42;te[8]=a11*b13+a12*b23+a13*b33+a14*b43;te[12]=a11*b14+a12*b24+a13*b34+a14*b44;te[1]=a21*b11+a22*b21+a23*b31+a24*b41;te[5]=a21*b12+a22*b22+a23*b32+a24*b42;te[9]=a21*b13+a22*b23+a23*b33+a24*b43;te[13]=a21*b14+a22*b24+a23*b34+a24*b44;te[2]=a31*b11+a32*b21+a33*b31+a34*b41;te[6]=a31*b12+a32*b22+a33*b32+a34*b42;te[10]=a31*b13+a32*b23+a33*b33+a34*b43;te[14]=a31*b14+a32*b24+a33*b34+a34*b44;te[3]=a41*b11+a42*b21+a43*b31+a44*b41;te[7]=a41*b12+a42*b22+a43*b32+a44*b42;te[11]=a41*b13+a42*b23+a43*b33+a44*b43;te[15]=a41*b14+a42*b24+a43*b34+a44*b44;return this;}multiplyScalar(s){const te=this.elements;te[0]*=s;te[4]*=s;te[8]*=s;te[12]*=s;te[1]*=s;te[5]*=s;te[9]*=s;te[13]*=s;te[2]*=s;te[6]*=s;te[10]*=s;te[14]*=s;te[3]*=s;te[7]*=s;te[11]*=s;te[15]*=s;return this;}determinant(){const te=this.elements;const n11=te[0],n12=te[4],n13=te[8],n14=te[12];const n21=te[1],n22=te[5],n23=te[9],n24=te[13];const n31=te[2],n32=te[6],n33=te[10],n34=te[14];const n41=te[3],n42=te[7],n43=te[11],n44=te[15];//TODO: make this more efficient
//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
return n41*(+n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34)+n42*(+n11*n23*n34-n11*n24*n33+n14*n21*n33-n13*n21*n34+n13*n24*n31-n14*n23*n31)+n43*(+n11*n24*n32-n11*n22*n34-n14*n21*n32+n12*n21*n34+n14*n22*n31-n12*n24*n31)+n44*(-n13*n22*n31-n11*n23*n32+n11*n22*n33+n13*n21*n32-n12*n21*n33+n12*n23*n31);}transpose(){const te=this.elements;let tmp;tmp=te[1];te[1]=te[4];te[4]=tmp;tmp=te[2];te[2]=te[8];te[8]=tmp;tmp=te[6];te[6]=te[9];te[9]=tmp;tmp=te[3];te[3]=te[12];te[12]=tmp;tmp=te[7];te[7]=te[13];te[13]=tmp;tmp=te[11];te[11]=te[14];te[14]=tmp;return this;}setPosition(x,y,z){const te=this.elements;if(x.isVector3){te[12]=x.x;te[13]=x.y;te[14]=x.z;}else {te[12]=x;te[13]=y;te[14]=z;}return this;}invert(){// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
const te=this.elements,n11=te[0],n21=te[1],n31=te[2],n41=te[3],n12=te[4],n22=te[5],n32=te[6],n42=te[7],n13=te[8],n23=te[9],n33=te[10],n43=te[11],n14=te[12],n24=te[13],n34=te[14],n44=te[15],t11=n23*n34*n42-n24*n33*n42+n24*n32*n43-n22*n34*n43-n23*n32*n44+n22*n33*n44,t12=n14*n33*n42-n13*n34*n42-n14*n32*n43+n12*n34*n43+n13*n32*n44-n12*n33*n44,t13=n13*n24*n42-n14*n23*n42+n14*n22*n43-n12*n24*n43-n13*n22*n44+n12*n23*n44,t14=n14*n23*n32-n13*n24*n32-n14*n22*n33+n12*n24*n33+n13*n22*n34-n12*n23*n34;const det=n11*t11+n21*t12+n31*t13+n41*t14;if(det===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const detInv=1/det;te[0]=t11*detInv;te[1]=(n24*n33*n41-n23*n34*n41-n24*n31*n43+n21*n34*n43+n23*n31*n44-n21*n33*n44)*detInv;te[2]=(n22*n34*n41-n24*n32*n41+n24*n31*n42-n21*n34*n42-n22*n31*n44+n21*n32*n44)*detInv;te[3]=(n23*n32*n41-n22*n33*n41-n23*n31*n42+n21*n33*n42+n22*n31*n43-n21*n32*n43)*detInv;te[4]=t12*detInv;te[5]=(n13*n34*n41-n14*n33*n41+n14*n31*n43-n11*n34*n43-n13*n31*n44+n11*n33*n44)*detInv;te[6]=(n14*n32*n41-n12*n34*n41-n14*n31*n42+n11*n34*n42+n12*n31*n44-n11*n32*n44)*detInv;te[7]=(n12*n33*n41-n13*n32*n41+n13*n31*n42-n11*n33*n42-n12*n31*n43+n11*n32*n43)*detInv;te[8]=t13*detInv;te[9]=(n14*n23*n41-n13*n24*n41-n14*n21*n43+n11*n24*n43+n13*n21*n44-n11*n23*n44)*detInv;te[10]=(n12*n24*n41-n14*n22*n41+n14*n21*n42-n11*n24*n42-n12*n21*n44+n11*n22*n44)*detInv;te[11]=(n13*n22*n41-n12*n23*n41-n13*n21*n42+n11*n23*n42+n12*n21*n43-n11*n22*n43)*detInv;te[12]=t14*detInv;te[13]=(n13*n24*n31-n14*n23*n31+n14*n21*n33-n11*n24*n33-n13*n21*n34+n11*n23*n34)*detInv;te[14]=(n14*n22*n31-n12*n24*n31-n14*n21*n32+n11*n24*n32+n12*n21*n34-n11*n22*n34)*detInv;te[15]=(n12*n23*n31-n13*n22*n31+n13*n21*n32-n11*n23*n32-n12*n21*n33+n11*n22*n33)*detInv;return this;}scale(v){const te=this.elements;const x=v.x,y=v.y,z=v.z;te[0]*=x;te[4]*=y;te[8]*=z;te[1]*=x;te[5]*=y;te[9]*=z;te[2]*=x;te[6]*=y;te[10]*=z;te[3]*=x;te[7]*=y;te[11]*=z;return this;}getMaxScaleOnAxis(){const te=this.elements;const scaleXSq=te[0]*te[0]+te[1]*te[1]+te[2]*te[2];const scaleYSq=te[4]*te[4]+te[5]*te[5]+te[6]*te[6];const scaleZSq=te[8]*te[8]+te[9]*te[9]+te[10]*te[10];return Math.sqrt(Math.max(scaleXSq,scaleYSq,scaleZSq));}makeTranslation(x,y,z){if(x.isVector3){this.set(1,0,0,x.x,0,1,0,x.y,0,0,1,x.z,0,0,0,1);}else {this.set(1,0,0,x,0,1,0,y,0,0,1,z,0,0,0,1);}return this;}makeRotationX(theta){const c=Math.cos(theta),s=Math.sin(theta);this.set(1,0,0,0,0,c,-s,0,0,s,c,0,0,0,0,1);return this;}makeRotationY(theta){const c=Math.cos(theta),s=Math.sin(theta);this.set(c,0,s,0,0,1,0,0,-s,0,c,0,0,0,0,1);return this;}makeRotationZ(theta){const c=Math.cos(theta),s=Math.sin(theta);this.set(c,-s,0,0,s,c,0,0,0,0,1,0,0,0,0,1);return this;}makeRotationAxis(axis,angle){// Based on http://www.gamedev.net/reference/articles/article1199.asp
const c=Math.cos(angle);const s=Math.sin(angle);const t=1-c;const x=axis.x,y=axis.y,z=axis.z;const tx=t*x,ty=t*y;this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+c,0,0,0,0,1);return this;}makeScale(x,y,z){this.set(x,0,0,0,0,y,0,0,0,0,z,0,0,0,0,1);return this;}makeShear(xy,xz,yx,yz,zx,zy){this.set(1,yx,zx,0,xy,1,zy,0,xz,yz,1,0,0,0,0,1);return this;}compose(position,quaternion,scale){const te=this.elements;const x=quaternion._x,y=quaternion._y,z=quaternion._z,w=quaternion._w;const x2=x+x,y2=y+y,z2=z+z;const xx=x*x2,xy=x*y2,xz=x*z2;const yy=y*y2,yz=y*z2,zz=z*z2;const wx=w*x2,wy=w*y2,wz=w*z2;const sx=scale.x,sy=scale.y,sz=scale.z;te[0]=(1-(yy+zz))*sx;te[1]=(xy+wz)*sx;te[2]=(xz-wy)*sx;te[3]=0;te[4]=(xy-wz)*sy;te[5]=(1-(xx+zz))*sy;te[6]=(yz+wx)*sy;te[7]=0;te[8]=(xz+wy)*sz;te[9]=(yz-wx)*sz;te[10]=(1-(xx+yy))*sz;te[11]=0;te[12]=position.x;te[13]=position.y;te[14]=position.z;te[15]=1;return this;}decompose(position,quaternion,scale){const te=this.elements;let sx=_v1$5.set(te[0],te[1],te[2]).length();const sy=_v1$5.set(te[4],te[5],te[6]).length();const sz=_v1$5.set(te[8],te[9],te[10]).length();// if determine is negative, we need to invert one scale
const det=this.determinant();if(det<0)sx=-sx;position.x=te[12];position.y=te[13];position.z=te[14];// scale the rotation part
_m1$4.copy(this);const invSX=1/sx;const invSY=1/sy;const invSZ=1/sz;_m1$4.elements[0]*=invSX;_m1$4.elements[1]*=invSX;_m1$4.elements[2]*=invSX;_m1$4.elements[4]*=invSY;_m1$4.elements[5]*=invSY;_m1$4.elements[6]*=invSY;_m1$4.elements[8]*=invSZ;_m1$4.elements[9]*=invSZ;_m1$4.elements[10]*=invSZ;quaternion.setFromRotationMatrix(_m1$4);scale.x=sx;scale.y=sy;scale.z=sz;return this;}makePerspective(left,right,top,bottom,near,far,coordinateSystem=WebGLCoordinateSystem$1){const te=this.elements;const x=2*near/(right-left);const y=2*near/(top-bottom);const a=(right+left)/(right-left);const b=(top+bottom)/(top-bottom);let c,d;if(coordinateSystem===WebGLCoordinateSystem$1){c=-(far+near)/(far-near);d=-2*far*near/(far-near);}else if(coordinateSystem===WebGPUCoordinateSystem$1){c=-far/(far-near);d=-far*near/(far-near);}else {throw new Error('THREE.Matrix4.makePerspective(): Invalid coordinate system: '+coordinateSystem);}te[0]=x;te[4]=0;te[8]=a;te[12]=0;te[1]=0;te[5]=y;te[9]=b;te[13]=0;te[2]=0;te[6]=0;te[10]=c;te[14]=d;te[3]=0;te[7]=0;te[11]=-1;te[15]=0;return this;}makeOrthographic(left,right,top,bottom,near,far,coordinateSystem=WebGLCoordinateSystem$1){const te=this.elements;const w=1.0/(right-left);const h=1.0/(top-bottom);const p=1.0/(far-near);const x=(right+left)*w;const y=(top+bottom)*h;let z,zInv;if(coordinateSystem===WebGLCoordinateSystem$1){z=(far+near)*p;zInv=-2*p;}else if(coordinateSystem===WebGPUCoordinateSystem$1){z=near*p;zInv=-1*p;}else {throw new Error('THREE.Matrix4.makeOrthographic(): Invalid coordinate system: '+coordinateSystem);}te[0]=2*w;te[4]=0;te[8]=0;te[12]=-x;te[1]=0;te[5]=2*h;te[9]=0;te[13]=-y;te[2]=0;te[6]=0;te[10]=zInv;te[14]=-z;te[3]=0;te[7]=0;te[11]=0;te[15]=1;return this;}equals(matrix){const te=this.elements;const me=matrix.elements;for(let i=0;i<16;i++){if(te[i]!==me[i])return false;}return true;}fromArray(array,offset=0){for(let i=0;i<16;i++){this.elements[i]=array[i+offset];}return this;}toArray(array=[],offset=0){const te=this.elements;array[offset]=te[0];array[offset+1]=te[1];array[offset+2]=te[2];array[offset+3]=te[3];array[offset+4]=te[4];array[offset+5]=te[5];array[offset+6]=te[6];array[offset+7]=te[7];array[offset+8]=te[8];array[offset+9]=te[9];array[offset+10]=te[10];array[offset+11]=te[11];array[offset+12]=te[12];array[offset+13]=te[13];array[offset+14]=te[14];array[offset+15]=te[15];return array;}}const _v1$5=/*@__PURE__*/new Vector3$1();const _m1$4=/*@__PURE__*/new Matrix4$1();const _zero$1=/*@__PURE__*/new Vector3$1(0,0,0);const _one$1=/*@__PURE__*/new Vector3$1(1,1,1);const _x$1=/*@__PURE__*/new Vector3$1();const _y$1=/*@__PURE__*/new Vector3$1();const _z$1=/*@__PURE__*/new Vector3$1();const _matrix$2=/*@__PURE__*/new Matrix4$1();const _quaternion$3=/*@__PURE__*/new Quaternion$1();class Euler$1{constructor(x=0,y=0,z=0,order=Euler$1.DEFAULT_ORDER){this.isEuler=true;this._x=x;this._y=y;this._z=z;this._order=order;}get x(){return this._x;}set x(value){this._x=value;this._onChangeCallback();}get y(){return this._y;}set y(value){this._y=value;this._onChangeCallback();}get z(){return this._z;}set z(value){this._z=value;this._onChangeCallback();}get order(){return this._order;}set order(value){this._order=value;this._onChangeCallback();}set(x,y,z,order=this._order){this._x=x;this._y=y;this._z=z;this._order=order;this._onChangeCallback();return this;}clone(){return new this.constructor(this._x,this._y,this._z,this._order);}copy(euler){this._x=euler._x;this._y=euler._y;this._z=euler._z;this._order=euler._order;this._onChangeCallback();return this;}setFromRotationMatrix(m,order=this._order,update=true){// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
const te=m.elements;const m11=te[0],m12=te[4],m13=te[8];const m21=te[1],m22=te[5],m23=te[9];const m31=te[2],m32=te[6],m33=te[10];switch(order){case'XYZ':this._y=Math.asin(clamp$2(m13,-1,1));if(Math.abs(m13)<0.9999999){this._x=Math.atan2(-m23,m33);this._z=Math.atan2(-m12,m11);}else {this._x=Math.atan2(m32,m22);this._z=0;}break;case'YXZ':this._x=Math.asin(-clamp$2(m23,-1,1));if(Math.abs(m23)<0.9999999){this._y=Math.atan2(m13,m33);this._z=Math.atan2(m21,m22);}else {this._y=Math.atan2(-m31,m11);this._z=0;}break;case'ZXY':this._x=Math.asin(clamp$2(m32,-1,1));if(Math.abs(m32)<0.9999999){this._y=Math.atan2(-m31,m33);this._z=Math.atan2(-m12,m22);}else {this._y=0;this._z=Math.atan2(m21,m11);}break;case'ZYX':this._y=Math.asin(-clamp$2(m31,-1,1));if(Math.abs(m31)<0.9999999){this._x=Math.atan2(m32,m33);this._z=Math.atan2(m21,m11);}else {this._x=0;this._z=Math.atan2(-m12,m22);}break;case'YZX':this._z=Math.asin(clamp$2(m21,-1,1));if(Math.abs(m21)<0.9999999){this._x=Math.atan2(-m23,m22);this._y=Math.atan2(-m31,m11);}else {this._x=0;this._y=Math.atan2(m13,m33);}break;case'XZY':this._z=Math.asin(-clamp$2(m12,-1,1));if(Math.abs(m12)<0.9999999){this._x=Math.atan2(m32,m22);this._y=Math.atan2(m13,m11);}else {this._x=Math.atan2(-m23,m33);this._y=0;}break;default:console.warn('THREE.Euler: .setFromRotationMatrix() encountered an unknown order: '+order);}this._order=order;if(update===true)this._onChangeCallback();return this;}setFromQuaternion(q,order,update){_matrix$2.makeRotationFromQuaternion(q);return this.setFromRotationMatrix(_matrix$2,order,update);}setFromVector3(v,order=this._order){return this.set(v.x,v.y,v.z,order);}reorder(newOrder){// WARNING: this discards revolution information -bhouston
_quaternion$3.setFromEuler(this);return this.setFromQuaternion(_quaternion$3,newOrder);}equals(euler){return euler._x===this._x&&euler._y===this._y&&euler._z===this._z&&euler._order===this._order;}fromArray(array){this._x=array[0];this._y=array[1];this._z=array[2];if(array[3]!==undefined)this._order=array[3];this._onChangeCallback();return this;}toArray(array=[],offset=0){array[offset]=this._x;array[offset+1]=this._y;array[offset+2]=this._z;array[offset+3]=this._order;return array;}_onChange(callback){this._onChangeCallback=callback;return this;}_onChangeCallback(){}*[Symbol.iterator](){yield this._x;yield this._y;yield this._z;yield this._order;}}Euler$1.DEFAULT_ORDER='XYZ';class Layers$1{constructor(){this.mask=1|0;}set(channel){this.mask=(1<<channel|0)>>>0;}enable(channel){this.mask|=1<<channel|0;}enableAll(){this.mask=0xffffffff|0;}toggle(channel){this.mask^=1<<channel|0;}disable(channel){this.mask&=~(1<<channel|0);}disableAll(){this.mask=0;}test(layers){return (this.mask&layers.mask)!==0;}isEnabled(channel){return (this.mask&(1<<channel|0))!==0;}}let _object3DId$1=0;const _v1$4$1=/*@__PURE__*/new Vector3$1();const _q1$1=/*@__PURE__*/new Quaternion$1();const _m1$3=/*@__PURE__*/new Matrix4$1();const _target$2=/*@__PURE__*/new Vector3$1();const _position$3=/*@__PURE__*/new Vector3$1();const _scale$2=/*@__PURE__*/new Vector3$1();const _quaternion$2$1=/*@__PURE__*/new Quaternion$1();const _xAxis$1=/*@__PURE__*/new Vector3$1(1,0,0);const _yAxis$1=/*@__PURE__*/new Vector3$1(0,1,0);const _zAxis$1=/*@__PURE__*/new Vector3$1(0,0,1);const _addedEvent$1={type:'added'};const _removedEvent$1={type:'removed'};const _childaddedEvent$1={type:'childadded',child:null};const _childremovedEvent$1={type:'childremoved',child:null};class Object3D$1 extends EventDispatcher$1{constructor(){super();this.isObject3D=true;Object.defineProperty(this,'id',{value:_object3DId$1++});this.uuid=generateUUID$1();this.name='';this.type='Object3D';this.parent=null;this.children=[];this.up=Object3D$1.DEFAULT_UP.clone();const position=new Vector3$1();const rotation=new Euler$1();const quaternion=new Quaternion$1();const scale=new Vector3$1(1,1,1);function onRotationChange(){quaternion.setFromEuler(rotation,false);}function onQuaternionChange(){rotation.setFromQuaternion(quaternion,undefined,false);}rotation._onChange(onRotationChange);quaternion._onChange(onQuaternionChange);Object.defineProperties(this,{position:{configurable:true,enumerable:true,value:position},rotation:{configurable:true,enumerable:true,value:rotation},quaternion:{configurable:true,enumerable:true,value:quaternion},scale:{configurable:true,enumerable:true,value:scale},modelViewMatrix:{value:new Matrix4$1()},normalMatrix:{value:new Matrix3$1()}});this.matrix=new Matrix4$1();this.matrixWorld=new Matrix4$1();this.matrixAutoUpdate=Object3D$1.DEFAULT_MATRIX_AUTO_UPDATE;this.matrixWorldAutoUpdate=Object3D$1.DEFAULT_MATRIX_WORLD_AUTO_UPDATE;// checked by the renderer
this.matrixWorldNeedsUpdate=false;this.layers=new Layers$1();this.visible=true;this.castShadow=false;this.receiveShadow=false;this.frustumCulled=true;this.renderOrder=0;this.animations=[];this.userData={};}onBeforeShadow(/* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */){}onAfterShadow(/* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */){}onBeforeRender(/* renderer, scene, camera, geometry, material, group */){}onAfterRender(/* renderer, scene, camera, geometry, material, group */){}applyMatrix4(matrix){if(this.matrixAutoUpdate)this.updateMatrix();this.matrix.premultiply(matrix);this.matrix.decompose(this.position,this.quaternion,this.scale);}applyQuaternion(q){this.quaternion.premultiply(q);return this;}setRotationFromAxisAngle(axis,angle){// assumes axis is normalized
this.quaternion.setFromAxisAngle(axis,angle);}setRotationFromEuler(euler){this.quaternion.setFromEuler(euler,true);}setRotationFromMatrix(m){// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
this.quaternion.setFromRotationMatrix(m);}setRotationFromQuaternion(q){// assumes q is normalized
this.quaternion.copy(q);}rotateOnAxis(axis,angle){// rotate object on axis in object space
// axis is assumed to be normalized
_q1$1.setFromAxisAngle(axis,angle);this.quaternion.multiply(_q1$1);return this;}rotateOnWorldAxis(axis,angle){// rotate object on axis in world space
// axis is assumed to be normalized
// method assumes no rotated parent
_q1$1.setFromAxisAngle(axis,angle);this.quaternion.premultiply(_q1$1);return this;}rotateX(angle){return this.rotateOnAxis(_xAxis$1,angle);}rotateY(angle){return this.rotateOnAxis(_yAxis$1,angle);}rotateZ(angle){return this.rotateOnAxis(_zAxis$1,angle);}translateOnAxis(axis,distance){// translate object by distance along axis in object space
// axis is assumed to be normalized
_v1$4$1.copy(axis).applyQuaternion(this.quaternion);this.position.add(_v1$4$1.multiplyScalar(distance));return this;}translateX(distance){return this.translateOnAxis(_xAxis$1,distance);}translateY(distance){return this.translateOnAxis(_yAxis$1,distance);}translateZ(distance){return this.translateOnAxis(_zAxis$1,distance);}localToWorld(vector){this.updateWorldMatrix(true,false);return vector.applyMatrix4(this.matrixWorld);}worldToLocal(vector){this.updateWorldMatrix(true,false);return vector.applyMatrix4(_m1$3.copy(this.matrixWorld).invert());}lookAt(x,y,z){// This method does not support objects having non-uniformly-scaled parent(s)
if(x.isVector3){_target$2.copy(x);}else {_target$2.set(x,y,z);}const parent=this.parent;this.updateWorldMatrix(true,false);_position$3.setFromMatrixPosition(this.matrixWorld);if(this.isCamera||this.isLight){_m1$3.lookAt(_position$3,_target$2,this.up);}else {_m1$3.lookAt(_target$2,_position$3,this.up);}this.quaternion.setFromRotationMatrix(_m1$3);if(parent){_m1$3.extractRotation(parent.matrixWorld);_q1$1.setFromRotationMatrix(_m1$3);this.quaternion.premultiply(_q1$1.invert());}}add(object){if(arguments.length>1){for(let i=0;i<arguments.length;i++){this.add(arguments[i]);}return this;}if(object===this){console.error('THREE.Object3D.add: object can\'t be added as a child of itself.',object);return this;}if(object&&object.isObject3D){object.removeFromParent();object.parent=this;this.children.push(object);object.dispatchEvent(_addedEvent$1);_childaddedEvent$1.child=object;this.dispatchEvent(_childaddedEvent$1);_childaddedEvent$1.child=null;}else {console.error('THREE.Object3D.add: object not an instance of THREE.Object3D.',object);}return this;}remove(object){if(arguments.length>1){for(let i=0;i<arguments.length;i++){this.remove(arguments[i]);}return this;}const index=this.children.indexOf(object);if(index!==-1){object.parent=null;this.children.splice(index,1);object.dispatchEvent(_removedEvent$1);_childremovedEvent$1.child=object;this.dispatchEvent(_childremovedEvent$1);_childremovedEvent$1.child=null;}return this;}removeFromParent(){const parent=this.parent;if(parent!==null){parent.remove(this);}return this;}clear(){return this.remove(...this.children);}attach(object){// adds object as a child of this, while maintaining the object's world transform
// Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)
this.updateWorldMatrix(true,false);_m1$3.copy(this.matrixWorld).invert();if(object.parent!==null){object.parent.updateWorldMatrix(true,false);_m1$3.multiply(object.parent.matrixWorld);}object.applyMatrix4(_m1$3);object.removeFromParent();object.parent=this;this.children.push(object);object.updateWorldMatrix(false,true);object.dispatchEvent(_addedEvent$1);_childaddedEvent$1.child=object;this.dispatchEvent(_childaddedEvent$1);_childaddedEvent$1.child=null;return this;}getObjectById(id){return this.getObjectByProperty('id',id);}getObjectByName(name){return this.getObjectByProperty('name',name);}getObjectByProperty(name,value){if(this[name]===value)return this;for(let i=0,l=this.children.length;i<l;i++){const child=this.children[i];const object=child.getObjectByProperty(name,value);if(object!==undefined){return object;}}return undefined;}getObjectsByProperty(name,value,result=[]){if(this[name]===value)result.push(this);const children=this.children;for(let i=0,l=children.length;i<l;i++){children[i].getObjectsByProperty(name,value,result);}return result;}getWorldPosition(target){this.updateWorldMatrix(true,false);return target.setFromMatrixPosition(this.matrixWorld);}getWorldQuaternion(target){this.updateWorldMatrix(true,false);this.matrixWorld.decompose(_position$3,target,_scale$2);return target;}getWorldScale(target){this.updateWorldMatrix(true,false);this.matrixWorld.decompose(_position$3,_quaternion$2$1,target);return target;}getWorldDirection(target){this.updateWorldMatrix(true,false);const e=this.matrixWorld.elements;return target.set(e[8],e[9],e[10]).normalize();}raycast(/* raycaster, intersects */){}traverse(callback){callback(this);const children=this.children;for(let i=0,l=children.length;i<l;i++){children[i].traverse(callback);}}traverseVisible(callback){if(this.visible===false)return;callback(this);const children=this.children;for(let i=0,l=children.length;i<l;i++){children[i].traverseVisible(callback);}}traverseAncestors(callback){const parent=this.parent;if(parent!==null){callback(parent);parent.traverseAncestors(callback);}}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=true;}updateMatrixWorld(force){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||force){if(this.matrixWorldAutoUpdate===true){if(this.parent===null){this.matrixWorld.copy(this.matrix);}else {this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);}}this.matrixWorldNeedsUpdate=false;force=true;}// make sure descendants are updated if required
const children=this.children;for(let i=0,l=children.length;i<l;i++){const child=children[i];child.updateMatrixWorld(force);}}updateWorldMatrix(updateParents,updateChildren){const parent=this.parent;if(updateParents===true&&parent!==null){parent.updateWorldMatrix(true,false);}if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldAutoUpdate===true){if(this.parent===null){this.matrixWorld.copy(this.matrix);}else {this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);}}// make sure descendants are updated
if(updateChildren===true){const children=this.children;for(let i=0,l=children.length;i<l;i++){const child=children[i];child.updateWorldMatrix(false,true);}}}toJSON(meta){// meta is a string when called from JSON.stringify
const isRootObject=meta===undefined||typeof meta==='string';const output={};// meta is a hash used to collect geometries, materials.
// not providing it implies that this is the root object
// being serialized.
if(isRootObject){// initialize meta obj
meta={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}};output.metadata={version:4.6,type:'Object',generator:'Object3D.toJSON'};}// standard Object3D serialization
const object={};object.uuid=this.uuid;object.type=this.type;if(this.name!=='')object.name=this.name;if(this.castShadow===true)object.castShadow=true;if(this.receiveShadow===true)object.receiveShadow=true;if(this.visible===false)object.visible=false;if(this.frustumCulled===false)object.frustumCulled=false;if(this.renderOrder!==0)object.renderOrder=this.renderOrder;if(Object.keys(this.userData).length>0)object.userData=this.userData;object.layers=this.layers.mask;object.matrix=this.matrix.toArray();object.up=this.up.toArray();if(this.matrixAutoUpdate===false)object.matrixAutoUpdate=false;// object specific properties
if(this.isInstancedMesh){object.type='InstancedMesh';object.count=this.count;object.instanceMatrix=this.instanceMatrix.toJSON();if(this.instanceColor!==null)object.instanceColor=this.instanceColor.toJSON();}if(this.isBatchedMesh){object.type='BatchedMesh';object.perObjectFrustumCulled=this.perObjectFrustumCulled;object.sortObjects=this.sortObjects;object.drawRanges=this._drawRanges;object.reservedRanges=this._reservedRanges;object.visibility=this._visibility;object.active=this._active;object.bounds=this._bounds.map(bound=>({boxInitialized:bound.boxInitialized,boxMin:bound.box.min.toArray(),boxMax:bound.box.max.toArray(),sphereInitialized:bound.sphereInitialized,sphereRadius:bound.sphere.radius,sphereCenter:bound.sphere.center.toArray()}));object.maxInstanceCount=this._maxInstanceCount;object.maxVertexCount=this._maxVertexCount;object.maxIndexCount=this._maxIndexCount;object.geometryInitialized=this._geometryInitialized;object.geometryCount=this._geometryCount;object.matricesTexture=this._matricesTexture.toJSON(meta);if(this._colorsTexture!==null)object.colorsTexture=this._colorsTexture.toJSON(meta);if(this.boundingSphere!==null){object.boundingSphere={center:object.boundingSphere.center.toArray(),radius:object.boundingSphere.radius};}if(this.boundingBox!==null){object.boundingBox={min:object.boundingBox.min.toArray(),max:object.boundingBox.max.toArray()};}}//
function serialize(library,element){if(library[element.uuid]===undefined){library[element.uuid]=element.toJSON(meta);}return element.uuid;}if(this.isScene){if(this.background){if(this.background.isColor){object.background=this.background.toJSON();}else if(this.background.isTexture){object.background=this.background.toJSON(meta).uuid;}}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==true){object.environment=this.environment.toJSON(meta).uuid;}}else if(this.isMesh||this.isLine||this.isPoints){object.geometry=serialize(meta.geometries,this.geometry);const parameters=this.geometry.parameters;if(parameters!==undefined&&parameters.shapes!==undefined){const shapes=parameters.shapes;if(Array.isArray(shapes)){for(let i=0,l=shapes.length;i<l;i++){const shape=shapes[i];serialize(meta.shapes,shape);}}else {serialize(meta.shapes,shapes);}}}if(this.isSkinnedMesh){object.bindMode=this.bindMode;object.bindMatrix=this.bindMatrix.toArray();if(this.skeleton!==undefined){serialize(meta.skeletons,this.skeleton);object.skeleton=this.skeleton.uuid;}}if(this.material!==undefined){if(Array.isArray(this.material)){const uuids=[];for(let i=0,l=this.material.length;i<l;i++){uuids.push(serialize(meta.materials,this.material[i]));}object.material=uuids;}else {object.material=serialize(meta.materials,this.material);}}//
if(this.children.length>0){object.children=[];for(let i=0;i<this.children.length;i++){object.children.push(this.children[i].toJSON(meta).object);}}//
if(this.animations.length>0){object.animations=[];for(let i=0;i<this.animations.length;i++){const animation=this.animations[i];object.animations.push(serialize(meta.animations,animation));}}if(isRootObject){const geometries=extractFromCache(meta.geometries);const materials=extractFromCache(meta.materials);const textures=extractFromCache(meta.textures);const images=extractFromCache(meta.images);const shapes=extractFromCache(meta.shapes);const skeletons=extractFromCache(meta.skeletons);const animations=extractFromCache(meta.animations);const nodes=extractFromCache(meta.nodes);if(geometries.length>0)output.geometries=geometries;if(materials.length>0)output.materials=materials;if(textures.length>0)output.textures=textures;if(images.length>0)output.images=images;if(shapes.length>0)output.shapes=shapes;if(skeletons.length>0)output.skeletons=skeletons;if(animations.length>0)output.animations=animations;if(nodes.length>0)output.nodes=nodes;}output.object=object;return output;// extract data from the cache hash
// remove metadata on each item
// and return as array
function extractFromCache(cache){const values=[];for(const key in cache){const data=cache[key];delete data.metadata;values.push(data);}return values;}}clone(recursive){return new this.constructor().copy(this,recursive);}copy(source,recursive=true){this.name=source.name;this.up.copy(source.up);this.position.copy(source.position);this.rotation.order=source.rotation.order;this.quaternion.copy(source.quaternion);this.scale.copy(source.scale);this.matrix.copy(source.matrix);this.matrixWorld.copy(source.matrixWorld);this.matrixAutoUpdate=source.matrixAutoUpdate;this.matrixWorldAutoUpdate=source.matrixWorldAutoUpdate;this.matrixWorldNeedsUpdate=source.matrixWorldNeedsUpdate;this.layers.mask=source.layers.mask;this.visible=source.visible;this.castShadow=source.castShadow;this.receiveShadow=source.receiveShadow;this.frustumCulled=source.frustumCulled;this.renderOrder=source.renderOrder;this.animations=source.animations.slice();this.userData=JSON.parse(JSON.stringify(source.userData));if(recursive===true){for(let i=0;i<source.children.length;i++){const child=source.children[i];this.add(child.clone());}}return this;}}Object3D$1.DEFAULT_UP=/*@__PURE__*/new Vector3$1(0,1,0);Object3D$1.DEFAULT_MATRIX_AUTO_UPDATE=true;Object3D$1.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=true;const _v0$2=/*@__PURE__*/new Vector3$1();const _v1$3$1=/*@__PURE__*/new Vector3$1();const _v2$2$1=/*@__PURE__*/new Vector3$1();const _v3$2=/*@__PURE__*/new Vector3$1();const _vab$1=/*@__PURE__*/new Vector3$1();const _vac$1=/*@__PURE__*/new Vector3$1();const _vbc$1=/*@__PURE__*/new Vector3$1();const _vap$1=/*@__PURE__*/new Vector3$1();const _vbp$1=/*@__PURE__*/new Vector3$1();const _vcp$1=/*@__PURE__*/new Vector3$1();class Triangle$1{constructor(a=new Vector3$1(),b=new Vector3$1(),c=new Vector3$1()){this.a=a;this.b=b;this.c=c;}static getNormal(a,b,c,target){target.subVectors(c,b);_v0$2.subVectors(a,b);target.cross(_v0$2);const targetLengthSq=target.lengthSq();if(targetLengthSq>0){return target.multiplyScalar(1/Math.sqrt(targetLengthSq));}return target.set(0,0,0);}// static/instance method to calculate barycentric coordinates
// based on: http://www.blackpawn.com/texts/pointinpoly/default.html
static getBarycoord(point,a,b,c,target){_v0$2.subVectors(c,a);_v1$3$1.subVectors(b,a);_v2$2$1.subVectors(point,a);const dot00=_v0$2.dot(_v0$2);const dot01=_v0$2.dot(_v1$3$1);const dot02=_v0$2.dot(_v2$2$1);const dot11=_v1$3$1.dot(_v1$3$1);const dot12=_v1$3$1.dot(_v2$2$1);const denom=dot00*dot11-dot01*dot01;// collinear or singular triangle
if(denom===0){target.set(0,0,0);return null;}const invDenom=1/denom;const u=(dot11*dot02-dot01*dot12)*invDenom;const v=(dot00*dot12-dot01*dot02)*invDenom;// barycentric coordinates must always sum to 1
return target.set(1-u-v,v,u);}static containsPoint(point,a,b,c){// if the triangle is degenerate then we can't contain a point
if(this.getBarycoord(point,a,b,c,_v3$2)===null){return false;}return _v3$2.x>=0&&_v3$2.y>=0&&_v3$2.x+_v3$2.y<=1;}static getInterpolation(point,p1,p2,p3,v1,v2,v3,target){if(this.getBarycoord(point,p1,p2,p3,_v3$2)===null){target.x=0;target.y=0;if('z'in target)target.z=0;if('w'in target)target.w=0;return null;}target.setScalar(0);target.addScaledVector(v1,_v3$2.x);target.addScaledVector(v2,_v3$2.y);target.addScaledVector(v3,_v3$2.z);return target;}static isFrontFacing(a,b,c,direction){_v0$2.subVectors(c,b);_v1$3$1.subVectors(a,b);// strictly front facing
return _v0$2.cross(_v1$3$1).dot(direction)<0?true:false;}set(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this;}setFromPointsAndIndices(points,i0,i1,i2){this.a.copy(points[i0]);this.b.copy(points[i1]);this.c.copy(points[i2]);return this;}setFromAttributeAndIndices(attribute,i0,i1,i2){this.a.fromBufferAttribute(attribute,i0);this.b.fromBufferAttribute(attribute,i1);this.c.fromBufferAttribute(attribute,i2);return this;}clone(){return new this.constructor().copy(this);}copy(triangle){this.a.copy(triangle.a);this.b.copy(triangle.b);this.c.copy(triangle.c);return this;}getArea(){_v0$2.subVectors(this.c,this.b);_v1$3$1.subVectors(this.a,this.b);return _v0$2.cross(_v1$3$1).length()*0.5;}getMidpoint(target){return target.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3);}getNormal(target){return Triangle$1.getNormal(this.a,this.b,this.c,target);}getPlane(target){return target.setFromCoplanarPoints(this.a,this.b,this.c);}getBarycoord(point,target){return Triangle$1.getBarycoord(point,this.a,this.b,this.c,target);}getInterpolation(point,v1,v2,v3,target){return Triangle$1.getInterpolation(point,this.a,this.b,this.c,v1,v2,v3,target);}containsPoint(point){return Triangle$1.containsPoint(point,this.a,this.b,this.c);}isFrontFacing(direction){return Triangle$1.isFrontFacing(this.a,this.b,this.c,direction);}intersectsBox(box){return box.intersectsTriangle(this);}closestPointToPoint(p,target){const a=this.a,b=this.b,c=this.c;let v,w;// algorithm thanks to Real-Time Collision Detection by Christer Ericson,
// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,
// under the accompanying license; see chapter 5.1.5 for detailed explanation.
// basically, we're distinguishing which of the voronoi regions of the triangle
// the point lies in with the minimum amount of redundant computation.
_vab$1.subVectors(b,a);_vac$1.subVectors(c,a);_vap$1.subVectors(p,a);const d1=_vab$1.dot(_vap$1);const d2=_vac$1.dot(_vap$1);if(d1<=0&&d2<=0){// vertex region of A; barycentric coords (1, 0, 0)
return target.copy(a);}_vbp$1.subVectors(p,b);const d3=_vab$1.dot(_vbp$1);const d4=_vac$1.dot(_vbp$1);if(d3>=0&&d4<=d3){// vertex region of B; barycentric coords (0, 1, 0)
return target.copy(b);}const vc=d1*d4-d3*d2;if(vc<=0&&d1>=0&&d3<=0){v=d1/(d1-d3);// edge region of AB; barycentric coords (1-v, v, 0)
return target.copy(a).addScaledVector(_vab$1,v);}_vcp$1.subVectors(p,c);const d5=_vab$1.dot(_vcp$1);const d6=_vac$1.dot(_vcp$1);if(d6>=0&&d5<=d6){// vertex region of C; barycentric coords (0, 0, 1)
return target.copy(c);}const vb=d5*d2-d1*d6;if(vb<=0&&d2>=0&&d6<=0){w=d2/(d2-d6);// edge region of AC; barycentric coords (1-w, 0, w)
return target.copy(a).addScaledVector(_vac$1,w);}const va=d3*d6-d5*d4;if(va<=0&&d4-d3>=0&&d5-d6>=0){_vbc$1.subVectors(c,b);w=(d4-d3)/(d4-d3+(d5-d6));// edge region of BC; barycentric coords (0, 1-w, w)
return target.copy(b).addScaledVector(_vbc$1,w);// edge region of BC
}// face region
const denom=1/(va+vb+vc);// u = va * denom
v=vb*denom;w=vc*denom;return target.copy(a).addScaledVector(_vab$1,v).addScaledVector(_vac$1,w);}equals(triangle){return triangle.a.equals(this.a)&&triangle.b.equals(this.b)&&triangle.c.equals(this.c);}}const _colorKeywords$1={'aliceblue':0xF0F8FF,'antiquewhite':0xFAEBD7,'aqua':0x00FFFF,'aquamarine':0x7FFFD4,'azure':0xF0FFFF,'beige':0xF5F5DC,'bisque':0xFFE4C4,'black':0x000000,'blanchedalmond':0xFFEBCD,'blue':0x0000FF,'blueviolet':0x8A2BE2,'brown':0xA52A2A,'burlywood':0xDEB887,'cadetblue':0x5F9EA0,'chartreuse':0x7FFF00,'chocolate':0xD2691E,'coral':0xFF7F50,'cornflowerblue':0x6495ED,'cornsilk':0xFFF8DC,'crimson':0xDC143C,'cyan':0x00FFFF,'darkblue':0x00008B,'darkcyan':0x008B8B,'darkgoldenrod':0xB8860B,'darkgray':0xA9A9A9,'darkgreen':0x006400,'darkgrey':0xA9A9A9,'darkkhaki':0xBDB76B,'darkmagenta':0x8B008B,'darkolivegreen':0x556B2F,'darkorange':0xFF8C00,'darkorchid':0x9932CC,'darkred':0x8B0000,'darksalmon':0xE9967A,'darkseagreen':0x8FBC8F,'darkslateblue':0x483D8B,'darkslategray':0x2F4F4F,'darkslategrey':0x2F4F4F,'darkturquoise':0x00CED1,'darkviolet':0x9400D3,'deeppink':0xFF1493,'deepskyblue':0x00BFFF,'dimgray':0x696969,'dimgrey':0x696969,'dodgerblue':0x1E90FF,'firebrick':0xB22222,'floralwhite':0xFFFAF0,'forestgreen':0x228B22,'fuchsia':0xFF00FF,'gainsboro':0xDCDCDC,'ghostwhite':0xF8F8FF,'gold':0xFFD700,'goldenrod':0xDAA520,'gray':0x808080,'green':0x008000,'greenyellow':0xADFF2F,'grey':0x808080,'honeydew':0xF0FFF0,'hotpink':0xFF69B4,'indianred':0xCD5C5C,'indigo':0x4B0082,'ivory':0xFFFFF0,'khaki':0xF0E68C,'lavender':0xE6E6FA,'lavenderblush':0xFFF0F5,'lawngreen':0x7CFC00,'lemonchiffon':0xFFFACD,'lightblue':0xADD8E6,'lightcoral':0xF08080,'lightcyan':0xE0FFFF,'lightgoldenrodyellow':0xFAFAD2,'lightgray':0xD3D3D3,'lightgreen':0x90EE90,'lightgrey':0xD3D3D3,'lightpink':0xFFB6C1,'lightsalmon':0xFFA07A,'lightseagreen':0x20B2AA,'lightskyblue':0x87CEFA,'lightslategray':0x778899,'lightslategrey':0x778899,'lightsteelblue':0xB0C4DE,'lightyellow':0xFFFFE0,'lime':0x00FF00,'limegreen':0x32CD32,'linen':0xFAF0E6,'magenta':0xFF00FF,'maroon':0x800000,'mediumaquamarine':0x66CDAA,'mediumblue':0x0000CD,'mediumorchid':0xBA55D3,'mediumpurple':0x9370DB,'mediumseagreen':0x3CB371,'mediumslateblue':0x7B68EE,'mediumspringgreen':0x00FA9A,'mediumturquoise':0x48D1CC,'mediumvioletred':0xC71585,'midnightblue':0x191970,'mintcream':0xF5FFFA,'mistyrose':0xFFE4E1,'moccasin':0xFFE4B5,'navajowhite':0xFFDEAD,'navy':0x000080,'oldlace':0xFDF5E6,'olive':0x808000,'olivedrab':0x6B8E23,'orange':0xFFA500,'orangered':0xFF4500,'orchid':0xDA70D6,'palegoldenrod':0xEEE8AA,'palegreen':0x98FB98,'paleturquoise':0xAFEEEE,'palevioletred':0xDB7093,'papayawhip':0xFFEFD5,'peachpuff':0xFFDAB9,'peru':0xCD853F,'pink':0xFFC0CB,'plum':0xDDA0DD,'powderblue':0xB0E0E6,'purple':0x800080,'rebeccapurple':0x663399,'red':0xFF0000,'rosybrown':0xBC8F8F,'royalblue':0x4169E1,'saddlebrown':0x8B4513,'salmon':0xFA8072,'sandybrown':0xF4A460,'seagreen':0x2E8B57,'seashell':0xFFF5EE,'sienna':0xA0522D,'silver':0xC0C0C0,'skyblue':0x87CEEB,'slateblue':0x6A5ACD,'slategray':0x708090,'slategrey':0x708090,'snow':0xFFFAFA,'springgreen':0x00FF7F,'steelblue':0x4682B4,'tan':0xD2B48C,'teal':0x008080,'thistle':0xD8BFD8,'tomato':0xFF6347,'turquoise':0x40E0D0,'violet':0xEE82EE,'wheat':0xF5DEB3,'white':0xFFFFFF,'whitesmoke':0xF5F5F5,'yellow':0xFFFF00,'yellowgreen':0x9ACD32};const _hslA$1={h:0,s:0,l:0};const _hslB$1={h:0,s:0,l:0};function hue2rgb$1(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*6*(2/3-t);return p;}class Color$1{constructor(r,g,b){this.isColor=true;this.r=1;this.g=1;this.b=1;return this.set(r,g,b);}set(r,g,b){if(g===undefined&&b===undefined){// r is THREE.Color, hex or string
const value=r;if(value&&value.isColor){this.copy(value);}else if(typeof value==='number'){this.setHex(value);}else if(typeof value==='string'){this.setStyle(value);}}else {this.setRGB(r,g,b);}return this;}setScalar(scalar){this.r=scalar;this.g=scalar;this.b=scalar;return this;}setHex(hex,colorSpace=SRGBColorSpace$1){hex=Math.floor(hex);this.r=(hex>>16&255)/255;this.g=(hex>>8&255)/255;this.b=(hex&255)/255;ColorManagement$1.toWorkingColorSpace(this,colorSpace);return this;}setRGB(r,g,b,colorSpace=ColorManagement$1.workingColorSpace){this.r=r;this.g=g;this.b=b;ColorManagement$1.toWorkingColorSpace(this,colorSpace);return this;}setHSL(h,s,l,colorSpace=ColorManagement$1.workingColorSpace){// h,s,l ranges are in 0.0 - 1.0
h=euclideanModulo$1(h,1);s=clamp$2(s,0,1);l=clamp$2(l,0,1);if(s===0){this.r=this.g=this.b=l;}else {const p=l<=0.5?l*(1+s):l+s-l*s;const q=2*l-p;this.r=hue2rgb$1(q,p,h+1/3);this.g=hue2rgb$1(q,p,h);this.b=hue2rgb$1(q,p,h-1/3);}ColorManagement$1.toWorkingColorSpace(this,colorSpace);return this;}setStyle(style,colorSpace=SRGBColorSpace$1){function handleAlpha(string){if(string===undefined)return;if(parseFloat(string)<1){console.warn('THREE.Color: Alpha component of '+style+' will be ignored.');}}let m;if(m=/^(\w+)\(([^\)]*)\)/.exec(style)){// rgb / hsl
let color;const name=m[1];const components=m[2];switch(name){case'rgb':case'rgba':if(color=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)){// rgb(255,0,0) rgba(255,0,0,0.5)
handleAlpha(color[4]);return this.setRGB(Math.min(255,parseInt(color[1],10))/255,Math.min(255,parseInt(color[2],10))/255,Math.min(255,parseInt(color[3],10))/255,colorSpace);}if(color=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)){// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)
handleAlpha(color[4]);return this.setRGB(Math.min(100,parseInt(color[1],10))/100,Math.min(100,parseInt(color[2],10))/100,Math.min(100,parseInt(color[3],10))/100,colorSpace);}break;case'hsl':case'hsla':if(color=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)){// hsl(120,50%,50%) hsla(120,50%,50%,0.5)
handleAlpha(color[4]);return this.setHSL(parseFloat(color[1])/360,parseFloat(color[2])/100,parseFloat(color[3])/100,colorSpace);}break;default:console.warn('THREE.Color: Unknown color model '+style);}}else if(m=/^\#([A-Fa-f\d]+)$/.exec(style)){// hex color
const hex=m[1];const size=hex.length;if(size===3){// #ff0
return this.setRGB(parseInt(hex.charAt(0),16)/15,parseInt(hex.charAt(1),16)/15,parseInt(hex.charAt(2),16)/15,colorSpace);}else if(size===6){// #ff0000
return this.setHex(parseInt(hex,16),colorSpace);}else {console.warn('THREE.Color: Invalid hex color '+style);}}else if(style&&style.length>0){return this.setColorName(style,colorSpace);}return this;}setColorName(style,colorSpace=SRGBColorSpace$1){// color keywords
const hex=_colorKeywords$1[style.toLowerCase()];if(hex!==undefined){// red
this.setHex(hex,colorSpace);}else {// unknown color
console.warn('THREE.Color: Unknown color '+style);}return this;}clone(){return new this.constructor(this.r,this.g,this.b);}copy(color){this.r=color.r;this.g=color.g;this.b=color.b;return this;}copySRGBToLinear(color){this.r=SRGBToLinear$1(color.r);this.g=SRGBToLinear$1(color.g);this.b=SRGBToLinear$1(color.b);return this;}copyLinearToSRGB(color){this.r=LinearToSRGB$1(color.r);this.g=LinearToSRGB$1(color.g);this.b=LinearToSRGB$1(color.b);return this;}convertSRGBToLinear(){this.copySRGBToLinear(this);return this;}convertLinearToSRGB(){this.copyLinearToSRGB(this);return this;}getHex(colorSpace=SRGBColorSpace$1){ColorManagement$1.fromWorkingColorSpace(_color$2.copy(this),colorSpace);return Math.round(clamp$2(_color$2.r*255,0,255))*65536+Math.round(clamp$2(_color$2.g*255,0,255))*256+Math.round(clamp$2(_color$2.b*255,0,255));}getHexString(colorSpace=SRGBColorSpace$1){return ('000000'+this.getHex(colorSpace).toString(16)).slice(-6);}getHSL(target,colorSpace=ColorManagement$1.workingColorSpace){// h,s,l ranges are in 0.0 - 1.0
ColorManagement$1.fromWorkingColorSpace(_color$2.copy(this),colorSpace);const r=_color$2.r,g=_color$2.g,b=_color$2.b;const max=Math.max(r,g,b);const min=Math.min(r,g,b);let hue,saturation;const lightness=(min+max)/2.0;if(min===max){hue=0;saturation=0;}else {const delta=max-min;saturation=lightness<=0.5?delta/(max+min):delta/(2-max-min);switch(max){case r:hue=(g-b)/delta+(g<b?6:0);break;case g:hue=(b-r)/delta+2;break;case b:hue=(r-g)/delta+4;break;}hue/=6;}target.h=hue;target.s=saturation;target.l=lightness;return target;}getRGB(target,colorSpace=ColorManagement$1.workingColorSpace){ColorManagement$1.fromWorkingColorSpace(_color$2.copy(this),colorSpace);target.r=_color$2.r;target.g=_color$2.g;target.b=_color$2.b;return target;}getStyle(colorSpace=SRGBColorSpace$1){ColorManagement$1.fromWorkingColorSpace(_color$2.copy(this),colorSpace);const r=_color$2.r,g=_color$2.g,b=_color$2.b;if(colorSpace!==SRGBColorSpace$1){// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).
return `color(${colorSpace} ${r.toFixed(3)} ${g.toFixed(3)} ${b.toFixed(3)})`;}return `rgb(${Math.round(r*255)},${Math.round(g*255)},${Math.round(b*255)})`;}offsetHSL(h,s,l){this.getHSL(_hslA$1);return this.setHSL(_hslA$1.h+h,_hslA$1.s+s,_hslA$1.l+l);}add(color){this.r+=color.r;this.g+=color.g;this.b+=color.b;return this;}addColors(color1,color2){this.r=color1.r+color2.r;this.g=color1.g+color2.g;this.b=color1.b+color2.b;return this;}addScalar(s){this.r+=s;this.g+=s;this.b+=s;return this;}sub(color){this.r=Math.max(0,this.r-color.r);this.g=Math.max(0,this.g-color.g);this.b=Math.max(0,this.b-color.b);return this;}multiply(color){this.r*=color.r;this.g*=color.g;this.b*=color.b;return this;}multiplyScalar(s){this.r*=s;this.g*=s;this.b*=s;return this;}lerp(color,alpha){this.r+=(color.r-this.r)*alpha;this.g+=(color.g-this.g)*alpha;this.b+=(color.b-this.b)*alpha;return this;}lerpColors(color1,color2,alpha){this.r=color1.r+(color2.r-color1.r)*alpha;this.g=color1.g+(color2.g-color1.g)*alpha;this.b=color1.b+(color2.b-color1.b)*alpha;return this;}lerpHSL(color,alpha){this.getHSL(_hslA$1);color.getHSL(_hslB$1);const h=lerp$1(_hslA$1.h,_hslB$1.h,alpha);const s=lerp$1(_hslA$1.s,_hslB$1.s,alpha);const l=lerp$1(_hslA$1.l,_hslB$1.l,alpha);this.setHSL(h,s,l);return this;}setFromVector3(v){this.r=v.x;this.g=v.y;this.b=v.z;return this;}applyMatrix3(m){const r=this.r,g=this.g,b=this.b;const e=m.elements;this.r=e[0]*r+e[3]*g+e[6]*b;this.g=e[1]*r+e[4]*g+e[7]*b;this.b=e[2]*r+e[5]*g+e[8]*b;return this;}equals(c){return c.r===this.r&&c.g===this.g&&c.b===this.b;}fromArray(array,offset=0){this.r=array[offset];this.g=array[offset+1];this.b=array[offset+2];return this;}toArray(array=[],offset=0){array[offset]=this.r;array[offset+1]=this.g;array[offset+2]=this.b;return array;}fromBufferAttribute(attribute,index){this.r=attribute.getX(index);this.g=attribute.getY(index);this.b=attribute.getZ(index);return this;}toJSON(){return this.getHex();}*[Symbol.iterator](){yield this.r;yield this.g;yield this.b;}}const _color$2=/*@__PURE__*/new Color$1();Color$1.NAMES=_colorKeywords$1;let _materialId$1=0;class Material$1 extends EventDispatcher$1{constructor(){super();this.isMaterial=true;Object.defineProperty(this,'id',{value:_materialId$1++});this.uuid=generateUUID$1();this.name='';this.type='Material';this.blending=NormalBlending$1;this.side=FrontSide$1;this.vertexColors=false;this.opacity=1;this.transparent=false;this.alphaHash=false;this.blendSrc=SrcAlphaFactor$1;this.blendDst=OneMinusSrcAlphaFactor$1;this.blendEquation=AddEquation$1;this.blendSrcAlpha=null;this.blendDstAlpha=null;this.blendEquationAlpha=null;this.blendColor=new Color$1(0,0,0);this.blendAlpha=0;this.depthFunc=LessEqualDepth$1;this.depthTest=true;this.depthWrite=true;this.stencilWriteMask=0xff;this.stencilFunc=AlwaysStencilFunc$1;this.stencilRef=0;this.stencilFuncMask=0xff;this.stencilFail=KeepStencilOp$1;this.stencilZFail=KeepStencilOp$1;this.stencilZPass=KeepStencilOp$1;this.stencilWrite=false;this.clippingPlanes=null;this.clipIntersection=false;this.clipShadows=false;this.shadowSide=null;this.colorWrite=true;this.precision=null;// override the renderer's default precision for this material
this.polygonOffset=false;this.polygonOffsetFactor=0;this.polygonOffsetUnits=0;this.dithering=false;this.alphaToCoverage=false;this.premultipliedAlpha=false;this.forceSinglePass=false;this.visible=true;this.toneMapped=true;this.userData={};this.version=0;this._alphaTest=0;}get alphaTest(){return this._alphaTest;}set alphaTest(value){if(this._alphaTest>0!==value>0){this.version++;}this._alphaTest=value;}// onBeforeRender and onBeforeCompile only supported in WebGLRenderer
onBeforeRender(/* renderer, scene, camera, geometry, object, group */){}onBeforeCompile(/* shaderobject, renderer */){}customProgramCacheKey(){return this.onBeforeCompile.toString();}setValues(values){if(values===undefined)return;for(const key in values){const newValue=values[key];if(newValue===undefined){console.warn(`THREE.Material: parameter '${key}' has value of undefined.`);continue;}const currentValue=this[key];if(currentValue===undefined){console.warn(`THREE.Material: '${key}' is not a property of THREE.${this.type}.`);continue;}if(currentValue&&currentValue.isColor){currentValue.set(newValue);}else if(currentValue&&currentValue.isVector3&&newValue&&newValue.isVector3){currentValue.copy(newValue);}else {this[key]=newValue;}}}toJSON(meta){const isRootObject=meta===undefined||typeof meta==='string';if(isRootObject){meta={textures:{},images:{}};}const data={metadata:{version:4.6,type:'Material',generator:'Material.toJSON'}};// standard Material serialization
data.uuid=this.uuid;data.type=this.type;if(this.name!=='')data.name=this.name;if(this.color&&this.color.isColor)data.color=this.color.getHex();if(this.roughness!==undefined)data.roughness=this.roughness;if(this.metalness!==undefined)data.metalness=this.metalness;if(this.sheen!==undefined)data.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)data.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==undefined)data.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)data.emissive=this.emissive.getHex();if(this.emissiveIntensity!==undefined&&this.emissiveIntensity!==1)data.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)data.specular=this.specular.getHex();if(this.specularIntensity!==undefined)data.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)data.specularColor=this.specularColor.getHex();if(this.shininess!==undefined)data.shininess=this.shininess;if(this.clearcoat!==undefined)data.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==undefined)data.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture){data.clearcoatMap=this.clearcoatMap.toJSON(meta).uuid;}if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture){data.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(meta).uuid;}if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture){data.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(meta).uuid;data.clearcoatNormalScale=this.clearcoatNormalScale.toArray();}if(this.dispersion!==undefined)data.dispersion=this.dispersion;if(this.iridescence!==undefined)data.iridescence=this.iridescence;if(this.iridescenceIOR!==undefined)data.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==undefined)data.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture){data.iridescenceMap=this.iridescenceMap.toJSON(meta).uuid;}if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture){data.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(meta).uuid;}if(this.anisotropy!==undefined)data.anisotropy=this.anisotropy;if(this.anisotropyRotation!==undefined)data.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture){data.anisotropyMap=this.anisotropyMap.toJSON(meta).uuid;}if(this.map&&this.map.isTexture)data.map=this.map.toJSON(meta).uuid;if(this.matcap&&this.matcap.isTexture)data.matcap=this.matcap.toJSON(meta).uuid;if(this.alphaMap&&this.alphaMap.isTexture)data.alphaMap=this.alphaMap.toJSON(meta).uuid;if(this.lightMap&&this.lightMap.isTexture){data.lightMap=this.lightMap.toJSON(meta).uuid;data.lightMapIntensity=this.lightMapIntensity;}if(this.aoMap&&this.aoMap.isTexture){data.aoMap=this.aoMap.toJSON(meta).uuid;data.aoMapIntensity=this.aoMapIntensity;}if(this.bumpMap&&this.bumpMap.isTexture){data.bumpMap=this.bumpMap.toJSON(meta).uuid;data.bumpScale=this.bumpScale;}if(this.normalMap&&this.normalMap.isTexture){data.normalMap=this.normalMap.toJSON(meta).uuid;data.normalMapType=this.normalMapType;data.normalScale=this.normalScale.toArray();}if(this.displacementMap&&this.displacementMap.isTexture){data.displacementMap=this.displacementMap.toJSON(meta).uuid;data.displacementScale=this.displacementScale;data.displacementBias=this.displacementBias;}if(this.roughnessMap&&this.roughnessMap.isTexture)data.roughnessMap=this.roughnessMap.toJSON(meta).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)data.metalnessMap=this.metalnessMap.toJSON(meta).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)data.emissiveMap=this.emissiveMap.toJSON(meta).uuid;if(this.specularMap&&this.specularMap.isTexture)data.specularMap=this.specularMap.toJSON(meta).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)data.specularIntensityMap=this.specularIntensityMap.toJSON(meta).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)data.specularColorMap=this.specularColorMap.toJSON(meta).uuid;if(this.envMap&&this.envMap.isTexture){data.envMap=this.envMap.toJSON(meta).uuid;if(this.combine!==undefined)data.combine=this.combine;}if(this.envMapRotation!==undefined)data.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==undefined)data.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==undefined)data.reflectivity=this.reflectivity;if(this.refractionRatio!==undefined)data.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture){data.gradientMap=this.gradientMap.toJSON(meta).uuid;}if(this.transmission!==undefined)data.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)data.transmissionMap=this.transmissionMap.toJSON(meta).uuid;if(this.thickness!==undefined)data.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)data.thicknessMap=this.thicknessMap.toJSON(meta).uuid;if(this.attenuationDistance!==undefined&&this.attenuationDistance!==Infinity)data.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==undefined)data.attenuationColor=this.attenuationColor.getHex();if(this.size!==undefined)data.size=this.size;if(this.shadowSide!==null)data.shadowSide=this.shadowSide;if(this.sizeAttenuation!==undefined)data.sizeAttenuation=this.sizeAttenuation;if(this.blending!==NormalBlending$1)data.blending=this.blending;if(this.side!==FrontSide$1)data.side=this.side;if(this.vertexColors===true)data.vertexColors=true;if(this.opacity<1)data.opacity=this.opacity;if(this.transparent===true)data.transparent=true;if(this.blendSrc!==SrcAlphaFactor$1)data.blendSrc=this.blendSrc;if(this.blendDst!==OneMinusSrcAlphaFactor$1)data.blendDst=this.blendDst;if(this.blendEquation!==AddEquation$1)data.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)data.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)data.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)data.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)data.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)data.blendAlpha=this.blendAlpha;if(this.depthFunc!==LessEqualDepth$1)data.depthFunc=this.depthFunc;if(this.depthTest===false)data.depthTest=this.depthTest;if(this.depthWrite===false)data.depthWrite=this.depthWrite;if(this.colorWrite===false)data.colorWrite=this.colorWrite;if(this.stencilWriteMask!==0xff)data.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==AlwaysStencilFunc$1)data.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)data.stencilRef=this.stencilRef;if(this.stencilFuncMask!==0xff)data.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==KeepStencilOp$1)data.stencilFail=this.stencilFail;if(this.stencilZFail!==KeepStencilOp$1)data.stencilZFail=this.stencilZFail;if(this.stencilZPass!==KeepStencilOp$1)data.stencilZPass=this.stencilZPass;if(this.stencilWrite===true)data.stencilWrite=this.stencilWrite;// rotation (SpriteMaterial)
if(this.rotation!==undefined&&this.rotation!==0)data.rotation=this.rotation;if(this.polygonOffset===true)data.polygonOffset=true;if(this.polygonOffsetFactor!==0)data.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)data.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==undefined&&this.linewidth!==1)data.linewidth=this.linewidth;if(this.dashSize!==undefined)data.dashSize=this.dashSize;if(this.gapSize!==undefined)data.gapSize=this.gapSize;if(this.scale!==undefined)data.scale=this.scale;if(this.dithering===true)data.dithering=true;if(this.alphaTest>0)data.alphaTest=this.alphaTest;if(this.alphaHash===true)data.alphaHash=true;if(this.alphaToCoverage===true)data.alphaToCoverage=true;if(this.premultipliedAlpha===true)data.premultipliedAlpha=true;if(this.forceSinglePass===true)data.forceSinglePass=true;if(this.wireframe===true)data.wireframe=true;if(this.wireframeLinewidth>1)data.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=='round')data.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=='round')data.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===true)data.flatShading=true;if(this.visible===false)data.visible=false;if(this.toneMapped===false)data.toneMapped=false;if(this.fog===false)data.fog=false;if(Object.keys(this.userData).length>0)data.userData=this.userData;// TODO: Copied from Object3D.toJSON
function extractFromCache(cache){const values=[];for(const key in cache){const data=cache[key];delete data.metadata;values.push(data);}return values;}if(isRootObject){const textures=extractFromCache(meta.textures);const images=extractFromCache(meta.images);if(textures.length>0)data.textures=textures;if(images.length>0)data.images=images;}return data;}clone(){return new this.constructor().copy(this);}copy(source){this.name=source.name;this.blending=source.blending;this.side=source.side;this.vertexColors=source.vertexColors;this.opacity=source.opacity;this.transparent=source.transparent;this.blendSrc=source.blendSrc;this.blendDst=source.blendDst;this.blendEquation=source.blendEquation;this.blendSrcAlpha=source.blendSrcAlpha;this.blendDstAlpha=source.blendDstAlpha;this.blendEquationAlpha=source.blendEquationAlpha;this.blendColor.copy(source.blendColor);this.blendAlpha=source.blendAlpha;this.depthFunc=source.depthFunc;this.depthTest=source.depthTest;this.depthWrite=source.depthWrite;this.stencilWriteMask=source.stencilWriteMask;this.stencilFunc=source.stencilFunc;this.stencilRef=source.stencilRef;this.stencilFuncMask=source.stencilFuncMask;this.stencilFail=source.stencilFail;this.stencilZFail=source.stencilZFail;this.stencilZPass=source.stencilZPass;this.stencilWrite=source.stencilWrite;const srcPlanes=source.clippingPlanes;let dstPlanes=null;if(srcPlanes!==null){const n=srcPlanes.length;dstPlanes=new Array(n);for(let i=0;i!==n;++i){dstPlanes[i]=srcPlanes[i].clone();}}this.clippingPlanes=dstPlanes;this.clipIntersection=source.clipIntersection;this.clipShadows=source.clipShadows;this.shadowSide=source.shadowSide;this.colorWrite=source.colorWrite;this.precision=source.precision;this.polygonOffset=source.polygonOffset;this.polygonOffsetFactor=source.polygonOffsetFactor;this.polygonOffsetUnits=source.polygonOffsetUnits;this.dithering=source.dithering;this.alphaTest=source.alphaTest;this.alphaHash=source.alphaHash;this.alphaToCoverage=source.alphaToCoverage;this.premultipliedAlpha=source.premultipliedAlpha;this.forceSinglePass=source.forceSinglePass;this.visible=source.visible;this.toneMapped=source.toneMapped;this.userData=JSON.parse(JSON.stringify(source.userData));return this;}dispose(){this.dispatchEvent({type:'dispose'});}set needsUpdate(value){if(value===true)this.version++;}onBuild(/* shaderobject, renderer */){console.warn('Material: onBuild() has been removed.');// @deprecated, r166
}}class MeshBasicMaterial$1 extends Material$1{constructor(parameters){super();this.isMeshBasicMaterial=true;this.type='MeshBasicMaterial';this.color=new Color$1(0xffffff);// emissive
this.map=null;this.lightMap=null;this.lightMapIntensity=1.0;this.aoMap=null;this.aoMapIntensity=1.0;this.specularMap=null;this.alphaMap=null;this.envMap=null;this.envMapRotation=new Euler$1();this.combine=MultiplyOperation$1;this.reflectivity=1;this.refractionRatio=0.98;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinecap='round';this.wireframeLinejoin='round';this.fog=true;this.setValues(parameters);}copy(source){super.copy(source);this.color.copy(source.color);this.map=source.map;this.lightMap=source.lightMap;this.lightMapIntensity=source.lightMapIntensity;this.aoMap=source.aoMap;this.aoMapIntensity=source.aoMapIntensity;this.specularMap=source.specularMap;this.alphaMap=source.alphaMap;this.envMap=source.envMap;this.envMapRotation.copy(source.envMapRotation);this.combine=source.combine;this.reflectivity=source.reflectivity;this.refractionRatio=source.refractionRatio;this.wireframe=source.wireframe;this.wireframeLinewidth=source.wireframeLinewidth;this.wireframeLinecap=source.wireframeLinecap;this.wireframeLinejoin=source.wireframeLinejoin;this.fog=source.fog;return this;}}// Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf
const _vector$9=/*@__PURE__*/new Vector3$1();const _vector2$1$1=/*@__PURE__*/new Vector2$1();class BufferAttribute$1{constructor(array,itemSize,normalized=false){if(Array.isArray(array)){throw new TypeError('THREE.BufferAttribute: array should be a Typed Array.');}this.isBufferAttribute=true;this.name='';this.array=array;this.itemSize=itemSize;this.count=array!==undefined?array.length/itemSize:0;this.normalized=normalized;this.usage=StaticDrawUsage$1;this._updateRange={offset:0,count:-1};this.updateRanges=[];this.gpuType=FloatType$1;this.version=0;}onUploadCallback(){}set needsUpdate(value){if(value===true)this.version++;}get updateRange(){warnOnce$1('THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.');// @deprecated, r159
return this._updateRange;}setUsage(value){this.usage=value;return this;}addUpdateRange(start,count){this.updateRanges.push({start,count});}clearUpdateRanges(){this.updateRanges.length=0;}copy(source){this.name=source.name;this.array=new source.array.constructor(source.array);this.itemSize=source.itemSize;this.count=source.count;this.normalized=source.normalized;this.usage=source.usage;this.gpuType=source.gpuType;return this;}copyAt(index1,attribute,index2){index1*=this.itemSize;index2*=attribute.itemSize;for(let i=0,l=this.itemSize;i<l;i++){this.array[index1+i]=attribute.array[index2+i];}return this;}copyArray(array){this.array.set(array);return this;}applyMatrix3(m){if(this.itemSize===2){for(let i=0,l=this.count;i<l;i++){_vector2$1$1.fromBufferAttribute(this,i);_vector2$1$1.applyMatrix3(m);this.setXY(i,_vector2$1$1.x,_vector2$1$1.y);}}else if(this.itemSize===3){for(let i=0,l=this.count;i<l;i++){_vector$9.fromBufferAttribute(this,i);_vector$9.applyMatrix3(m);this.setXYZ(i,_vector$9.x,_vector$9.y,_vector$9.z);}}return this;}applyMatrix4(m){for(let i=0,l=this.count;i<l;i++){_vector$9.fromBufferAttribute(this,i);_vector$9.applyMatrix4(m);this.setXYZ(i,_vector$9.x,_vector$9.y,_vector$9.z);}return this;}applyNormalMatrix(m){for(let i=0,l=this.count;i<l;i++){_vector$9.fromBufferAttribute(this,i);_vector$9.applyNormalMatrix(m);this.setXYZ(i,_vector$9.x,_vector$9.y,_vector$9.z);}return this;}transformDirection(m){for(let i=0,l=this.count;i<l;i++){_vector$9.fromBufferAttribute(this,i);_vector$9.transformDirection(m);this.setXYZ(i,_vector$9.x,_vector$9.y,_vector$9.z);}return this;}set(value,offset=0){// Matching BufferAttribute constructor, do not normalize the array.
this.array.set(value,offset);return this;}getComponent(index,component){let value=this.array[index*this.itemSize+component];if(this.normalized)value=denormalize$1(value,this.array);return value;}setComponent(index,component,value){if(this.normalized)value=normalize$2(value,this.array);this.array[index*this.itemSize+component]=value;return this;}getX(index){let x=this.array[index*this.itemSize];if(this.normalized)x=denormalize$1(x,this.array);return x;}setX(index,x){if(this.normalized)x=normalize$2(x,this.array);this.array[index*this.itemSize]=x;return this;}getY(index){let y=this.array[index*this.itemSize+1];if(this.normalized)y=denormalize$1(y,this.array);return y;}setY(index,y){if(this.normalized)y=normalize$2(y,this.array);this.array[index*this.itemSize+1]=y;return this;}getZ(index){let z=this.array[index*this.itemSize+2];if(this.normalized)z=denormalize$1(z,this.array);return z;}setZ(index,z){if(this.normalized)z=normalize$2(z,this.array);this.array[index*this.itemSize+2]=z;return this;}getW(index){let w=this.array[index*this.itemSize+3];if(this.normalized)w=denormalize$1(w,this.array);return w;}setW(index,w){if(this.normalized)w=normalize$2(w,this.array);this.array[index*this.itemSize+3]=w;return this;}setXY(index,x,y){index*=this.itemSize;if(this.normalized){x=normalize$2(x,this.array);y=normalize$2(y,this.array);}this.array[index+0]=x;this.array[index+1]=y;return this;}setXYZ(index,x,y,z){index*=this.itemSize;if(this.normalized){x=normalize$2(x,this.array);y=normalize$2(y,this.array);z=normalize$2(z,this.array);}this.array[index+0]=x;this.array[index+1]=y;this.array[index+2]=z;return this;}setXYZW(index,x,y,z,w){index*=this.itemSize;if(this.normalized){x=normalize$2(x,this.array);y=normalize$2(y,this.array);z=normalize$2(z,this.array);w=normalize$2(w,this.array);}this.array[index+0]=x;this.array[index+1]=y;this.array[index+2]=z;this.array[index+3]=w;return this;}onUpload(callback){this.onUploadCallback=callback;return this;}clone(){return new this.constructor(this.array,this.itemSize).copy(this);}toJSON(){const data={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=='')data.name=this.name;if(this.usage!==StaticDrawUsage$1)data.usage=this.usage;return data;}}//
class Uint16BufferAttribute$1 extends BufferAttribute$1{constructor(array,itemSize,normalized){super(new Uint16Array(array),itemSize,normalized);}}class Uint32BufferAttribute$1 extends BufferAttribute$1{constructor(array,itemSize,normalized){super(new Uint32Array(array),itemSize,normalized);}}class Float32BufferAttribute$1 extends BufferAttribute$1{constructor(array,itemSize,normalized){super(new Float32Array(array),itemSize,normalized);}}let _id$2=0;const _m1$2$1=/*@__PURE__*/new Matrix4$1();const _obj$1=/*@__PURE__*/new Object3D$1();const _offset$1=/*@__PURE__*/new Vector3$1();const _box$2$1=/*@__PURE__*/new Box3$1();const _boxMorphTargets$1=/*@__PURE__*/new Box3$1();const _vector$8=/*@__PURE__*/new Vector3$1();class BufferGeometry$1 extends EventDispatcher$1{constructor(){super();this.isBufferGeometry=true;Object.defineProperty(this,'id',{value:_id$2++});this.uuid=generateUUID$1();this.name='';this.type='BufferGeometry';this.index=null;this.attributes={};this.morphAttributes={};this.morphTargetsRelative=false;this.groups=[];this.boundingBox=null;this.boundingSphere=null;this.drawRange={start:0,count:Infinity};this.userData={};}getIndex(){return this.index;}setIndex(index){if(Array.isArray(index)){this.index=new(arrayNeedsUint32$1(index)?Uint32BufferAttribute$1:Uint16BufferAttribute$1)(index,1);}else {this.index=index;}return this;}getAttribute(name){return this.attributes[name];}setAttribute(name,attribute){this.attributes[name]=attribute;return this;}deleteAttribute(name){delete this.attributes[name];return this;}hasAttribute(name){return this.attributes[name]!==undefined;}addGroup(start,count,materialIndex=0){this.groups.push({start:start,count:count,materialIndex:materialIndex});}clearGroups(){this.groups=[];}setDrawRange(start,count){this.drawRange.start=start;this.drawRange.count=count;}applyMatrix4(matrix){const position=this.attributes.position;if(position!==undefined){position.applyMatrix4(matrix);position.needsUpdate=true;}const normal=this.attributes.normal;if(normal!==undefined){const normalMatrix=new Matrix3$1().getNormalMatrix(matrix);normal.applyNormalMatrix(normalMatrix);normal.needsUpdate=true;}const tangent=this.attributes.tangent;if(tangent!==undefined){tangent.transformDirection(matrix);tangent.needsUpdate=true;}if(this.boundingBox!==null){this.computeBoundingBox();}if(this.boundingSphere!==null){this.computeBoundingSphere();}return this;}applyQuaternion(q){_m1$2$1.makeRotationFromQuaternion(q);this.applyMatrix4(_m1$2$1);return this;}rotateX(angle){// rotate geometry around world x-axis
_m1$2$1.makeRotationX(angle);this.applyMatrix4(_m1$2$1);return this;}rotateY(angle){// rotate geometry around world y-axis
_m1$2$1.makeRotationY(angle);this.applyMatrix4(_m1$2$1);return this;}rotateZ(angle){// rotate geometry around world z-axis
_m1$2$1.makeRotationZ(angle);this.applyMatrix4(_m1$2$1);return this;}translate(x,y,z){// translate geometry
_m1$2$1.makeTranslation(x,y,z);this.applyMatrix4(_m1$2$1);return this;}scale(x,y,z){// scale geometry
_m1$2$1.makeScale(x,y,z);this.applyMatrix4(_m1$2$1);return this;}lookAt(vector){_obj$1.lookAt(vector);_obj$1.updateMatrix();this.applyMatrix4(_obj$1.matrix);return this;}center(){this.computeBoundingBox();this.boundingBox.getCenter(_offset$1).negate();this.translate(_offset$1.x,_offset$1.y,_offset$1.z);return this;}setFromPoints(points){const position=[];for(let i=0,l=points.length;i<l;i++){const point=points[i];position.push(point.x,point.y,point.z||0);}this.setAttribute('position',new Float32BufferAttribute$1(position,3));return this;}computeBoundingBox(){if(this.boundingBox===null){this.boundingBox=new Box3$1();}const position=this.attributes.position;const morphAttributesPosition=this.morphAttributes.position;if(position&&position.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.',this);this.boundingBox.set(new Vector3$1(-Infinity,-Infinity,-Infinity),new Vector3$1(+Infinity,+Infinity,+Infinity));return;}if(position!==undefined){this.boundingBox.setFromBufferAttribute(position);// process morph attributes if present
if(morphAttributesPosition){for(let i=0,il=morphAttributesPosition.length;i<il;i++){const morphAttribute=morphAttributesPosition[i];_box$2$1.setFromBufferAttribute(morphAttribute);if(this.morphTargetsRelative){_vector$8.addVectors(this.boundingBox.min,_box$2$1.min);this.boundingBox.expandByPoint(_vector$8);_vector$8.addVectors(this.boundingBox.max,_box$2$1.max);this.boundingBox.expandByPoint(_vector$8);}else {this.boundingBox.expandByPoint(_box$2$1.min);this.boundingBox.expandByPoint(_box$2$1.max);}}}}else {this.boundingBox.makeEmpty();}if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)){console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this);}}computeBoundingSphere(){if(this.boundingSphere===null){this.boundingSphere=new Sphere$1();}const position=this.attributes.position;const morphAttributesPosition=this.morphAttributes.position;if(position&&position.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.',this);this.boundingSphere.set(new Vector3$1(),Infinity);return;}if(position){// first, find the center of the bounding sphere
const center=this.boundingSphere.center;_box$2$1.setFromBufferAttribute(position);// process morph attributes if present
if(morphAttributesPosition){for(let i=0,il=morphAttributesPosition.length;i<il;i++){const morphAttribute=morphAttributesPosition[i];_boxMorphTargets$1.setFromBufferAttribute(morphAttribute);if(this.morphTargetsRelative){_vector$8.addVectors(_box$2$1.min,_boxMorphTargets$1.min);_box$2$1.expandByPoint(_vector$8);_vector$8.addVectors(_box$2$1.max,_boxMorphTargets$1.max);_box$2$1.expandByPoint(_vector$8);}else {_box$2$1.expandByPoint(_boxMorphTargets$1.min);_box$2$1.expandByPoint(_boxMorphTargets$1.max);}}}_box$2$1.getCenter(center);// second, try to find a boundingSphere with a radius smaller than the
// boundingSphere of the boundingBox: sqrt(3) smaller in the best case
let maxRadiusSq=0;for(let i=0,il=position.count;i<il;i++){_vector$8.fromBufferAttribute(position,i);maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(_vector$8));}// process morph attributes if present
if(morphAttributesPosition){for(let i=0,il=morphAttributesPosition.length;i<il;i++){const morphAttribute=morphAttributesPosition[i];const morphTargetsRelative=this.morphTargetsRelative;for(let j=0,jl=morphAttribute.count;j<jl;j++){_vector$8.fromBufferAttribute(morphAttribute,j);if(morphTargetsRelative){_offset$1.fromBufferAttribute(position,j);_vector$8.add(_offset$1);}maxRadiusSq=Math.max(maxRadiusSq,center.distanceToSquared(_vector$8));}}}this.boundingSphere.radius=Math.sqrt(maxRadiusSq);if(isNaN(this.boundingSphere.radius)){console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this);}}}computeTangents(){const index=this.index;const attributes=this.attributes;// based on http://www.terathon.com/code/tangent.html
// (per vertex tangents)
if(index===null||attributes.position===undefined||attributes.normal===undefined||attributes.uv===undefined){console.error('THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)');return;}const positionAttribute=attributes.position;const normalAttribute=attributes.normal;const uvAttribute=attributes.uv;if(this.hasAttribute('tangent')===false){this.setAttribute('tangent',new BufferAttribute$1(new Float32Array(4*positionAttribute.count),4));}const tangentAttribute=this.getAttribute('tangent');const tan1=[],tan2=[];for(let i=0;i<positionAttribute.count;i++){tan1[i]=new Vector3$1();tan2[i]=new Vector3$1();}const vA=new Vector3$1(),vB=new Vector3$1(),vC=new Vector3$1(),uvA=new Vector2$1(),uvB=new Vector2$1(),uvC=new Vector2$1(),sdir=new Vector3$1(),tdir=new Vector3$1();function handleTriangle(a,b,c){vA.fromBufferAttribute(positionAttribute,a);vB.fromBufferAttribute(positionAttribute,b);vC.fromBufferAttribute(positionAttribute,c);uvA.fromBufferAttribute(uvAttribute,a);uvB.fromBufferAttribute(uvAttribute,b);uvC.fromBufferAttribute(uvAttribute,c);vB.sub(vA);vC.sub(vA);uvB.sub(uvA);uvC.sub(uvA);const r=1.0/(uvB.x*uvC.y-uvC.x*uvB.y);// silently ignore degenerate uv triangles having coincident or colinear vertices
if(!isFinite(r))return;sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC,-uvB.y).multiplyScalar(r);tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB,-uvC.x).multiplyScalar(r);tan1[a].add(sdir);tan1[b].add(sdir);tan1[c].add(sdir);tan2[a].add(tdir);tan2[b].add(tdir);tan2[c].add(tdir);}let groups=this.groups;if(groups.length===0){groups=[{start:0,count:index.count}];}for(let i=0,il=groups.length;i<il;++i){const group=groups[i];const start=group.start;const count=group.count;for(let j=start,jl=start+count;j<jl;j+=3){handleTriangle(index.getX(j+0),index.getX(j+1),index.getX(j+2));}}const tmp=new Vector3$1(),tmp2=new Vector3$1();const n=new Vector3$1(),n2=new Vector3$1();function handleVertex(v){n.fromBufferAttribute(normalAttribute,v);n2.copy(n);const t=tan1[v];// Gram-Schmidt orthogonalize
tmp.copy(t);tmp.sub(n.multiplyScalar(n.dot(t))).normalize();// Calculate handedness
tmp2.crossVectors(n2,t);const test=tmp2.dot(tan2[v]);const w=test<0.0?-1.0:1.0;tangentAttribute.setXYZW(v,tmp.x,tmp.y,tmp.z,w);}for(let i=0,il=groups.length;i<il;++i){const group=groups[i];const start=group.start;const count=group.count;for(let j=start,jl=start+count;j<jl;j+=3){handleVertex(index.getX(j+0));handleVertex(index.getX(j+1));handleVertex(index.getX(j+2));}}}computeVertexNormals(){const index=this.index;const positionAttribute=this.getAttribute('position');if(positionAttribute!==undefined){let normalAttribute=this.getAttribute('normal');if(normalAttribute===undefined){normalAttribute=new BufferAttribute$1(new Float32Array(positionAttribute.count*3),3);this.setAttribute('normal',normalAttribute);}else {// reset existing normals to zero
for(let i=0,il=normalAttribute.count;i<il;i++){normalAttribute.setXYZ(i,0,0,0);}}const pA=new Vector3$1(),pB=new Vector3$1(),pC=new Vector3$1();const nA=new Vector3$1(),nB=new Vector3$1(),nC=new Vector3$1();const cb=new Vector3$1(),ab=new Vector3$1();// indexed elements
if(index){for(let i=0,il=index.count;i<il;i+=3){const vA=index.getX(i+0);const vB=index.getX(i+1);const vC=index.getX(i+2);pA.fromBufferAttribute(positionAttribute,vA);pB.fromBufferAttribute(positionAttribute,vB);pC.fromBufferAttribute(positionAttribute,vC);cb.subVectors(pC,pB);ab.subVectors(pA,pB);cb.cross(ab);nA.fromBufferAttribute(normalAttribute,vA);nB.fromBufferAttribute(normalAttribute,vB);nC.fromBufferAttribute(normalAttribute,vC);nA.add(cb);nB.add(cb);nC.add(cb);normalAttribute.setXYZ(vA,nA.x,nA.y,nA.z);normalAttribute.setXYZ(vB,nB.x,nB.y,nB.z);normalAttribute.setXYZ(vC,nC.x,nC.y,nC.z);}}else {// non-indexed elements (unconnected triangle soup)
for(let i=0,il=positionAttribute.count;i<il;i+=3){pA.fromBufferAttribute(positionAttribute,i+0);pB.fromBufferAttribute(positionAttribute,i+1);pC.fromBufferAttribute(positionAttribute,i+2);cb.subVectors(pC,pB);ab.subVectors(pA,pB);cb.cross(ab);normalAttribute.setXYZ(i+0,cb.x,cb.y,cb.z);normalAttribute.setXYZ(i+1,cb.x,cb.y,cb.z);normalAttribute.setXYZ(i+2,cb.x,cb.y,cb.z);}}this.normalizeNormals();normalAttribute.needsUpdate=true;}}normalizeNormals(){const normals=this.attributes.normal;for(let i=0,il=normals.count;i<il;i++){_vector$8.fromBufferAttribute(normals,i);_vector$8.normalize();normals.setXYZ(i,_vector$8.x,_vector$8.y,_vector$8.z);}}toNonIndexed(){function convertBufferAttribute(attribute,indices){const array=attribute.array;const itemSize=attribute.itemSize;const normalized=attribute.normalized;const array2=new array.constructor(indices.length*itemSize);let index=0,index2=0;for(let i=0,l=indices.length;i<l;i++){if(attribute.isInterleavedBufferAttribute){index=indices[i]*attribute.data.stride+attribute.offset;}else {index=indices[i]*itemSize;}for(let j=0;j<itemSize;j++){array2[index2++]=array[index++];}}return new BufferAttribute$1(array2,itemSize,normalized);}//
if(this.index===null){console.warn('THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.');return this;}const geometry2=new BufferGeometry$1();const indices=this.index.array;const attributes=this.attributes;// attributes
for(const name in attributes){const attribute=attributes[name];const newAttribute=convertBufferAttribute(attribute,indices);geometry2.setAttribute(name,newAttribute);}// morph attributes
const morphAttributes=this.morphAttributes;for(const name in morphAttributes){const morphArray=[];const morphAttribute=morphAttributes[name];// morphAttribute: array of Float32BufferAttributes
for(let i=0,il=morphAttribute.length;i<il;i++){const attribute=morphAttribute[i];const newAttribute=convertBufferAttribute(attribute,indices);morphArray.push(newAttribute);}geometry2.morphAttributes[name]=morphArray;}geometry2.morphTargetsRelative=this.morphTargetsRelative;// groups
const groups=this.groups;for(let i=0,l=groups.length;i<l;i++){const group=groups[i];geometry2.addGroup(group.start,group.count,group.materialIndex);}return geometry2;}toJSON(){const data={metadata:{version:4.6,type:'BufferGeometry',generator:'BufferGeometry.toJSON'}};// standard BufferGeometry serialization
data.uuid=this.uuid;data.type=this.type;if(this.name!=='')data.name=this.name;if(Object.keys(this.userData).length>0)data.userData=this.userData;if(this.parameters!==undefined){const parameters=this.parameters;for(const key in parameters){if(parameters[key]!==undefined)data[key]=parameters[key];}return data;}// for simplicity the code assumes attributes are not shared across geometries, see #15811
data.data={attributes:{}};const index=this.index;if(index!==null){data.data.index={type:index.array.constructor.name,array:Array.prototype.slice.call(index.array)};}const attributes=this.attributes;for(const key in attributes){const attribute=attributes[key];data.data.attributes[key]=attribute.toJSON(data.data);}const morphAttributes={};let hasMorphAttributes=false;for(const key in this.morphAttributes){const attributeArray=this.morphAttributes[key];const array=[];for(let i=0,il=attributeArray.length;i<il;i++){const attribute=attributeArray[i];array.push(attribute.toJSON(data.data));}if(array.length>0){morphAttributes[key]=array;hasMorphAttributes=true;}}if(hasMorphAttributes){data.data.morphAttributes=morphAttributes;data.data.morphTargetsRelative=this.morphTargetsRelative;}const groups=this.groups;if(groups.length>0){data.data.groups=JSON.parse(JSON.stringify(groups));}const boundingSphere=this.boundingSphere;if(boundingSphere!==null){data.data.boundingSphere={center:boundingSphere.center.toArray(),radius:boundingSphere.radius};}return data;}clone(){return new this.constructor().copy(this);}copy(source){// reset
this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingBox=null;this.boundingSphere=null;// used for storing cloned, shared data
const data={};// name
this.name=source.name;// index
const index=source.index;if(index!==null){this.setIndex(index.clone(data));}// attributes
const attributes=source.attributes;for(const name in attributes){const attribute=attributes[name];this.setAttribute(name,attribute.clone(data));}// morph attributes
const morphAttributes=source.morphAttributes;for(const name in morphAttributes){const array=[];const morphAttribute=morphAttributes[name];// morphAttribute: array of Float32BufferAttributes
for(let i=0,l=morphAttribute.length;i<l;i++){array.push(morphAttribute[i].clone(data));}this.morphAttributes[name]=array;}this.morphTargetsRelative=source.morphTargetsRelative;// groups
const groups=source.groups;for(let i=0,l=groups.length;i<l;i++){const group=groups[i];this.addGroup(group.start,group.count,group.materialIndex);}// bounding box
const boundingBox=source.boundingBox;if(boundingBox!==null){this.boundingBox=boundingBox.clone();}// bounding sphere
const boundingSphere=source.boundingSphere;if(boundingSphere!==null){this.boundingSphere=boundingSphere.clone();}// draw range
this.drawRange.start=source.drawRange.start;this.drawRange.count=source.drawRange.count;// user data
this.userData=source.userData;return this;}dispose(){this.dispatchEvent({type:'dispose'});}}const _inverseMatrix$3=/*@__PURE__*/new Matrix4$1();const _ray$3=/*@__PURE__*/new Ray$1();const _sphere$6=/*@__PURE__*/new Sphere$1();const _sphereHitAt$1=/*@__PURE__*/new Vector3$1();const _vA$1$1=/*@__PURE__*/new Vector3$1();const _vB$1$1=/*@__PURE__*/new Vector3$1();const _vC$1$1=/*@__PURE__*/new Vector3$1();const _tempA$1=/*@__PURE__*/new Vector3$1();const _morphA$1=/*@__PURE__*/new Vector3$1();const _uvA$1=/*@__PURE__*/new Vector2$1();const _uvB$1=/*@__PURE__*/new Vector2$1();const _uvC$1=/*@__PURE__*/new Vector2$1();const _normalA$1=/*@__PURE__*/new Vector3$1();const _normalB$1=/*@__PURE__*/new Vector3$1();const _normalC$1=/*@__PURE__*/new Vector3$1();const _intersectionPoint$1=/*@__PURE__*/new Vector3$1();const _intersectionPointWorld$1=/*@__PURE__*/new Vector3$1();class Mesh$1 extends Object3D$1{constructor(geometry=new BufferGeometry$1(),material=new MeshBasicMaterial$1()){super();this.isMesh=true;this.type='Mesh';this.geometry=geometry;this.material=material;this.updateMorphTargets();}copy(source,recursive){super.copy(source,recursive);if(source.morphTargetInfluences!==undefined){this.morphTargetInfluences=source.morphTargetInfluences.slice();}if(source.morphTargetDictionary!==undefined){this.morphTargetDictionary=Object.assign({},source.morphTargetDictionary);}this.material=Array.isArray(source.material)?source.material.slice():source.material;this.geometry=source.geometry;return this;}updateMorphTargets(){const geometry=this.geometry;const morphAttributes=geometry.morphAttributes;const keys=Object.keys(morphAttributes);if(keys.length>0){const morphAttribute=morphAttributes[keys[0]];if(morphAttribute!==undefined){this.morphTargetInfluences=[];this.morphTargetDictionary={};for(let m=0,ml=morphAttribute.length;m<ml;m++){const name=morphAttribute[m].name||String(m);this.morphTargetInfluences.push(0);this.morphTargetDictionary[name]=m;}}}}getVertexPosition(index,target){const geometry=this.geometry;const position=geometry.attributes.position;const morphPosition=geometry.morphAttributes.position;const morphTargetsRelative=geometry.morphTargetsRelative;target.fromBufferAttribute(position,index);const morphInfluences=this.morphTargetInfluences;if(morphPosition&&morphInfluences){_morphA$1.set(0,0,0);for(let i=0,il=morphPosition.length;i<il;i++){const influence=morphInfluences[i];const morphAttribute=morphPosition[i];if(influence===0)continue;_tempA$1.fromBufferAttribute(morphAttribute,index);if(morphTargetsRelative){_morphA$1.addScaledVector(_tempA$1,influence);}else {_morphA$1.addScaledVector(_tempA$1.sub(target),influence);}}target.add(_morphA$1);}return target;}raycast(raycaster,intersects){const geometry=this.geometry;const material=this.material;const matrixWorld=this.matrixWorld;if(material===undefined)return;// test with bounding sphere in world space
if(geometry.boundingSphere===null)geometry.computeBoundingSphere();_sphere$6.copy(geometry.boundingSphere);_sphere$6.applyMatrix4(matrixWorld);// check distance from ray origin to bounding sphere
_ray$3.copy(raycaster.ray).recast(raycaster.near);if(_sphere$6.containsPoint(_ray$3.origin)===false){if(_ray$3.intersectSphere(_sphere$6,_sphereHitAt$1)===null)return;if(_ray$3.origin.distanceToSquared(_sphereHitAt$1)>(raycaster.far-raycaster.near)**2)return;}// convert ray to local space of mesh
_inverseMatrix$3.copy(matrixWorld).invert();_ray$3.copy(raycaster.ray).applyMatrix4(_inverseMatrix$3);// test with bounding box in local space
if(geometry.boundingBox!==null){if(_ray$3.intersectsBox(geometry.boundingBox)===false)return;}// test for intersections with geometry
this._computeIntersections(raycaster,intersects,_ray$3);}_computeIntersections(raycaster,intersects,rayLocalSpace){let intersection;const geometry=this.geometry;const material=this.material;const index=geometry.index;const position=geometry.attributes.position;const uv=geometry.attributes.uv;const uv1=geometry.attributes.uv1;const normal=geometry.attributes.normal;const groups=geometry.groups;const drawRange=geometry.drawRange;if(index!==null){// indexed buffer geometry
if(Array.isArray(material)){for(let i=0,il=groups.length;i<il;i++){const group=groups[i];const groupMaterial=material[group.materialIndex];const start=Math.max(group.start,drawRange.start);const end=Math.min(index.count,Math.min(group.start+group.count,drawRange.start+drawRange.count));for(let j=start,jl=end;j<jl;j+=3){const a=index.getX(j);const b=index.getX(j+1);const c=index.getX(j+2);intersection=checkGeometryIntersection$1(this,groupMaterial,raycaster,rayLocalSpace,uv,uv1,normal,a,b,c);if(intersection){intersection.faceIndex=Math.floor(j/3);// triangle number in indexed buffer semantics
intersection.face.materialIndex=group.materialIndex;intersects.push(intersection);}}}}else {const start=Math.max(0,drawRange.start);const end=Math.min(index.count,drawRange.start+drawRange.count);for(let i=start,il=end;i<il;i+=3){const a=index.getX(i);const b=index.getX(i+1);const c=index.getX(i+2);intersection=checkGeometryIntersection$1(this,material,raycaster,rayLocalSpace,uv,uv1,normal,a,b,c);if(intersection){intersection.faceIndex=Math.floor(i/3);// triangle number in indexed buffer semantics
intersects.push(intersection);}}}}else if(position!==undefined){// non-indexed buffer geometry
if(Array.isArray(material)){for(let i=0,il=groups.length;i<il;i++){const group=groups[i];const groupMaterial=material[group.materialIndex];const start=Math.max(group.start,drawRange.start);const end=Math.min(position.count,Math.min(group.start+group.count,drawRange.start+drawRange.count));for(let j=start,jl=end;j<jl;j+=3){const a=j;const b=j+1;const c=j+2;intersection=checkGeometryIntersection$1(this,groupMaterial,raycaster,rayLocalSpace,uv,uv1,normal,a,b,c);if(intersection){intersection.faceIndex=Math.floor(j/3);// triangle number in non-indexed buffer semantics
intersection.face.materialIndex=group.materialIndex;intersects.push(intersection);}}}}else {const start=Math.max(0,drawRange.start);const end=Math.min(position.count,drawRange.start+drawRange.count);for(let i=start,il=end;i<il;i+=3){const a=i;const b=i+1;const c=i+2;intersection=checkGeometryIntersection$1(this,material,raycaster,rayLocalSpace,uv,uv1,normal,a,b,c);if(intersection){intersection.faceIndex=Math.floor(i/3);// triangle number in non-indexed buffer semantics
intersects.push(intersection);}}}}}}function checkIntersection$1(object,material,raycaster,ray,pA,pB,pC,point){let intersect;if(material.side===BackSide$1){intersect=ray.intersectTriangle(pC,pB,pA,true,point);}else {intersect=ray.intersectTriangle(pA,pB,pC,material.side===FrontSide$1,point);}if(intersect===null)return null;_intersectionPointWorld$1.copy(point);_intersectionPointWorld$1.applyMatrix4(object.matrixWorld);const distance=raycaster.ray.origin.distanceTo(_intersectionPointWorld$1);if(distance<raycaster.near||distance>raycaster.far)return null;return {distance:distance,point:_intersectionPointWorld$1.clone(),object:object};}function checkGeometryIntersection$1(object,material,raycaster,ray,uv,uv1,normal,a,b,c){object.getVertexPosition(a,_vA$1$1);object.getVertexPosition(b,_vB$1$1);object.getVertexPosition(c,_vC$1$1);const intersection=checkIntersection$1(object,material,raycaster,ray,_vA$1$1,_vB$1$1,_vC$1$1,_intersectionPoint$1);if(intersection){if(uv){_uvA$1.fromBufferAttribute(uv,a);_uvB$1.fromBufferAttribute(uv,b);_uvC$1.fromBufferAttribute(uv,c);intersection.uv=Triangle$1.getInterpolation(_intersectionPoint$1,_vA$1$1,_vB$1$1,_vC$1$1,_uvA$1,_uvB$1,_uvC$1,new Vector2$1());}if(uv1){_uvA$1.fromBufferAttribute(uv1,a);_uvB$1.fromBufferAttribute(uv1,b);_uvC$1.fromBufferAttribute(uv1,c);intersection.uv1=Triangle$1.getInterpolation(_intersectionPoint$1,_vA$1$1,_vB$1$1,_vC$1$1,_uvA$1,_uvB$1,_uvC$1,new Vector2$1());}if(normal){_normalA$1.fromBufferAttribute(normal,a);_normalB$1.fromBufferAttribute(normal,b);_normalC$1.fromBufferAttribute(normal,c);intersection.normal=Triangle$1.getInterpolation(_intersectionPoint$1,_vA$1$1,_vB$1$1,_vC$1$1,_normalA$1,_normalB$1,_normalC$1,new Vector3$1());if(intersection.normal.dot(ray.direction)>0){intersection.normal.multiplyScalar(-1);}}const face={a:a,b:b,c:c,normal:new Vector3$1(),materialIndex:0};Triangle$1.getNormal(_vA$1$1,_vB$1$1,_vC$1$1,face.normal);intersection.face=face;}return intersection;}class BoxGeometry extends BufferGeometry$1{constructor(width=1,height=1,depth=1,widthSegments=1,heightSegments=1,depthSegments=1){super();this.type='BoxGeometry';this.parameters={width:width,height:height,depth:depth,widthSegments:widthSegments,heightSegments:heightSegments,depthSegments:depthSegments};const scope=this;// segments
widthSegments=Math.floor(widthSegments);heightSegments=Math.floor(heightSegments);depthSegments=Math.floor(depthSegments);// buffers
const indices=[];const vertices=[];const normals=[];const uvs=[];// helper variables
let numberOfVertices=0;let groupStart=0;// build each side of the box geometry
buildPlane('z','y','x',-1,-1,depth,height,width,depthSegments,heightSegments,0);// px
buildPlane('z','y','x',1,-1,depth,height,-width,depthSegments,heightSegments,1);// nx
buildPlane('x','z','y',1,1,width,depth,height,widthSegments,depthSegments,2);// py
buildPlane('x','z','y',1,-1,width,depth,-height,widthSegments,depthSegments,3);// ny
buildPlane('x','y','z',1,-1,width,height,depth,widthSegments,heightSegments,4);// pz
buildPlane('x','y','z',-1,-1,width,height,-depth,widthSegments,heightSegments,5);// nz
// build geometry
this.setIndex(indices);this.setAttribute('position',new Float32BufferAttribute$1(vertices,3));this.setAttribute('normal',new Float32BufferAttribute$1(normals,3));this.setAttribute('uv',new Float32BufferAttribute$1(uvs,2));function buildPlane(u,v,w,udir,vdir,width,height,depth,gridX,gridY,materialIndex){const segmentWidth=width/gridX;const segmentHeight=height/gridY;const widthHalf=width/2;const heightHalf=height/2;const depthHalf=depth/2;const gridX1=gridX+1;const gridY1=gridY+1;let vertexCounter=0;let groupCount=0;const vector=new Vector3$1();// generate vertices, normals and uvs
for(let iy=0;iy<gridY1;iy++){const y=iy*segmentHeight-heightHalf;for(let ix=0;ix<gridX1;ix++){const x=ix*segmentWidth-widthHalf;// set values to correct vector component
vector[u]=x*udir;vector[v]=y*vdir;vector[w]=depthHalf;// now apply vector to vertex buffer
vertices.push(vector.x,vector.y,vector.z);// set values to correct vector component
vector[u]=0;vector[v]=0;vector[w]=depth>0?1:-1;// now apply vector to normal buffer
normals.push(vector.x,vector.y,vector.z);// uvs
uvs.push(ix/gridX);uvs.push(1-iy/gridY);// counters
vertexCounter+=1;}}// indices
// 1. you need three indices to draw a single face
// 2. a single segment consists of two faces
// 3. so we need to generate six (2*3) indices per segment
for(let iy=0;iy<gridY;iy++){for(let ix=0;ix<gridX;ix++){const a=numberOfVertices+ix+gridX1*iy;const b=numberOfVertices+ix+gridX1*(iy+1);const c=numberOfVertices+(ix+1)+gridX1*(iy+1);const d=numberOfVertices+(ix+1)+gridX1*iy;// faces
indices.push(a,b,d);indices.push(b,c,d);// increase counter
groupCount+=6;}}// add a group to the geometry. this will ensure multi material support
scope.addGroup(groupStart,groupCount,materialIndex);// calculate new start value for groups
groupStart+=groupCount;// update total number of vertices
numberOfVertices+=vertexCounter;}}copy(source){super.copy(source);this.parameters=Object.assign({},source.parameters);return this;}static fromJSON(data){return new BoxGeometry(data.width,data.height,data.depth,data.widthSegments,data.heightSegments,data.depthSegments);}}/**
 * Uniform Utilities
 */function cloneUniforms(src){const dst={};for(const u in src){dst[u]={};for(const p in src[u]){const property=src[u][p];if(property&&(property.isColor||property.isMatrix3||property.isMatrix4||property.isVector2||property.isVector3||property.isVector4||property.isTexture||property.isQuaternion)){if(property.isRenderTargetTexture){console.warn('UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().');dst[u][p]=null;}else {dst[u][p]=property.clone();}}else if(Array.isArray(property)){dst[u][p]=property.slice();}else {dst[u][p]=property;}}}return dst;}function mergeUniforms(uniforms){const merged={};for(let u=0;u<uniforms.length;u++){const tmp=cloneUniforms(uniforms[u]);for(const p in tmp){merged[p]=tmp[p];}}return merged;}function cloneUniformsGroups(src){const dst=[];for(let u=0;u<src.length;u++){dst.push(src[u].clone());}return dst;}function getUnlitUniformColorSpace(renderer){const currentRenderTarget=renderer.getRenderTarget();if(currentRenderTarget===null){// https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
return renderer.outputColorSpace;}// https://github.com/mrdoob/three.js/issues/27868
if(currentRenderTarget.isXRRenderTarget===true){return currentRenderTarget.texture.colorSpace;}return ColorManagement$1.workingColorSpace;}// Legacy
const UniformsUtils={clone:cloneUniforms,merge:mergeUniforms};var default_vertex="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";var default_fragment="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";class ShaderMaterial extends Material$1{constructor(parameters){super();this.isShaderMaterial=true;this.type='ShaderMaterial';this.defines={};this.uniforms={};this.uniformsGroups=[];this.vertexShader=default_vertex;this.fragmentShader=default_fragment;this.linewidth=1;this.wireframe=false;this.wireframeLinewidth=1;this.fog=false;// set to use scene fog
this.lights=false;// set to use scene lights
this.clipping=false;// set to use user-defined clipping planes
this.forceSinglePass=true;this.extensions={clipCullDistance:false,// set to use vertex shader clipping
multiDraw:false// set to use vertex shader multi_draw / enable gl_DrawID
};// When rendered geometry doesn't include these attributes but the material does,
// use these default values in WebGL. This avoids errors when buffer data is missing.
this.defaultAttributeValues={'color':[1,1,1],'uv':[0,0],'uv1':[0,0]};this.index0AttributeName=undefined;this.uniformsNeedUpdate=false;this.glslVersion=null;if(parameters!==undefined){this.setValues(parameters);}}copy(source){super.copy(source);this.fragmentShader=source.fragmentShader;this.vertexShader=source.vertexShader;this.uniforms=cloneUniforms(source.uniforms);this.uniformsGroups=cloneUniformsGroups(source.uniformsGroups);this.defines=Object.assign({},source.defines);this.wireframe=source.wireframe;this.wireframeLinewidth=source.wireframeLinewidth;this.fog=source.fog;this.lights=source.lights;this.clipping=source.clipping;this.extensions=Object.assign({},source.extensions);this.glslVersion=source.glslVersion;return this;}toJSON(meta){const data=super.toJSON(meta);data.glslVersion=this.glslVersion;data.uniforms={};for(const name in this.uniforms){const uniform=this.uniforms[name];const value=uniform.value;if(value&&value.isTexture){data.uniforms[name]={type:'t',value:value.toJSON(meta).uuid};}else if(value&&value.isColor){data.uniforms[name]={type:'c',value:value.getHex()};}else if(value&&value.isVector2){data.uniforms[name]={type:'v2',value:value.toArray()};}else if(value&&value.isVector3){data.uniforms[name]={type:'v3',value:value.toArray()};}else if(value&&value.isVector4){data.uniforms[name]={type:'v4',value:value.toArray()};}else if(value&&value.isMatrix3){data.uniforms[name]={type:'m3',value:value.toArray()};}else if(value&&value.isMatrix4){data.uniforms[name]={type:'m4',value:value.toArray()};}else {data.uniforms[name]={value:value};// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far
}}if(Object.keys(this.defines).length>0)data.defines=this.defines;data.vertexShader=this.vertexShader;data.fragmentShader=this.fragmentShader;data.lights=this.lights;data.clipping=this.clipping;const extensions={};for(const key in this.extensions){if(this.extensions[key]===true)extensions[key]=true;}if(Object.keys(extensions).length>0)data.extensions=extensions;return data;}}class Camera$1 extends Object3D$1{constructor(){super();this.isCamera=true;this.type='Camera';this.matrixWorldInverse=new Matrix4$1();this.projectionMatrix=new Matrix4$1();this.projectionMatrixInverse=new Matrix4$1();this.coordinateSystem=WebGLCoordinateSystem$1;}copy(source,recursive){super.copy(source,recursive);this.matrixWorldInverse.copy(source.matrixWorldInverse);this.projectionMatrix.copy(source.projectionMatrix);this.projectionMatrixInverse.copy(source.projectionMatrixInverse);this.coordinateSystem=source.coordinateSystem;return this;}getWorldDirection(target){return super.getWorldDirection(target).negate();}updateMatrixWorld(force){super.updateMatrixWorld(force);this.matrixWorldInverse.copy(this.matrixWorld).invert();}updateWorldMatrix(updateParents,updateChildren){super.updateWorldMatrix(updateParents,updateChildren);this.matrixWorldInverse.copy(this.matrixWorld).invert();}clone(){return new this.constructor().copy(this);}}const _v3$1$1=/*@__PURE__*/new Vector3$1();const _minTarget$1=/*@__PURE__*/new Vector2$1();const _maxTarget$1=/*@__PURE__*/new Vector2$1();class PerspectiveCamera$1 extends Camera$1{constructor(fov=50,aspect=1,near=0.1,far=2000){super();this.isPerspectiveCamera=true;this.type='PerspectiveCamera';this.fov=fov;this.zoom=1;this.near=near;this.far=far;this.focus=10;this.aspect=aspect;this.view=null;this.filmGauge=35;// width of the film (default in millimeters)
this.filmOffset=0;// horizontal film offset (same unit as gauge)
this.updateProjectionMatrix();}copy(source,recursive){super.copy(source,recursive);this.fov=source.fov;this.zoom=source.zoom;this.near=source.near;this.far=source.far;this.focus=source.focus;this.aspect=source.aspect;this.view=source.view===null?null:Object.assign({},source.view);this.filmGauge=source.filmGauge;this.filmOffset=source.filmOffset;return this;}/**
	 * Sets the FOV by focal length in respect to the current .filmGauge.
	 *
	 * The default film gauge is 35, so that the focal length can be specified for
	 * a 35mm (full frame) camera.
	 *
	 * Values for focal length and film gauge must have the same unit.
	 */setFocalLength(focalLength){/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */const vExtentSlope=0.5*this.getFilmHeight()/focalLength;this.fov=RAD2DEG$1*2*Math.atan(vExtentSlope);this.updateProjectionMatrix();}/**
	 * Calculates the focal length from the current .fov and .filmGauge.
	 */getFocalLength(){const vExtentSlope=Math.tan(DEG2RAD$1*0.5*this.fov);return 0.5*this.getFilmHeight()/vExtentSlope;}getEffectiveFOV(){return RAD2DEG$1*2*Math.atan(Math.tan(DEG2RAD$1*0.5*this.fov)/this.zoom);}getFilmWidth(){// film not completely covered in portrait format (aspect < 1)
return this.filmGauge*Math.min(this.aspect,1);}getFilmHeight(){// film not completely covered in landscape format (aspect > 1)
return this.filmGauge/Math.max(this.aspect,1);}/**
	 * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
	 * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
	 */getViewBounds(distance,minTarget,maxTarget){_v3$1$1.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse);minTarget.set(_v3$1$1.x,_v3$1$1.y).multiplyScalar(-distance/_v3$1$1.z);_v3$1$1.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse);maxTarget.set(_v3$1$1.x,_v3$1$1.y).multiplyScalar(-distance/_v3$1$1.z);}/**
	 * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
	 * Copies the result into the target Vector2, where x is width and y is height.
	 */getViewSize(distance,target){this.getViewBounds(distance,_minTarget$1,_maxTarget$1);return target.subVectors(_maxTarget$1,_minTarget$1);}/**
	 * Sets an offset in a larger frustum. This is useful for multi-window or
	 * multi-monitor/multi-machine setups.
	 *
	 * For example, if you have 3x2 monitors and each monitor is 1920x1080 and
	 * the monitors are in grid like this
	 *
	 *   +---+---+---+
	 *   | A | B | C |
	 *   +---+---+---+
	 *   | D | E | F |
	 *   +---+---+---+
	 *
	 * then for each monitor you would call it like this
	 *
	 *   const w = 1920;
	 *   const h = 1080;
	 *   const fullWidth = w * 3;
	 *   const fullHeight = h * 2;
	 *
	 *   --A--
	 *   camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
	 *   --B--
	 *   camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
	 *   --C--
	 *   camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
	 *   --D--
	 *   camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
	 *   --E--
	 *   camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
	 *   --F--
	 *   camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
	 *
	 *   Note there is no reason monitors have to be the same size or in a grid.
	 */setViewOffset(fullWidth,fullHeight,x,y,width,height){this.aspect=fullWidth/fullHeight;if(this.view===null){this.view={enabled:true,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};}this.view.enabled=true;this.view.fullWidth=fullWidth;this.view.fullHeight=fullHeight;this.view.offsetX=x;this.view.offsetY=y;this.view.width=width;this.view.height=height;this.updateProjectionMatrix();}clearViewOffset(){if(this.view!==null){this.view.enabled=false;}this.updateProjectionMatrix();}updateProjectionMatrix(){const near=this.near;let top=near*Math.tan(DEG2RAD$1*0.5*this.fov)/this.zoom;let height=2*top;let width=this.aspect*height;let left=-0.5*width;const view=this.view;if(this.view!==null&&this.view.enabled){const fullWidth=view.fullWidth,fullHeight=view.fullHeight;left+=view.offsetX*width/fullWidth;top-=view.offsetY*height/fullHeight;width*=view.width/fullWidth;height*=view.height/fullHeight;}const skew=this.filmOffset;if(skew!==0)left+=near*skew/this.getFilmWidth();this.projectionMatrix.makePerspective(left,left+width,top,top-height,near,this.far,this.coordinateSystem);this.projectionMatrixInverse.copy(this.projectionMatrix).invert();}toJSON(meta){const data=super.toJSON(meta);data.object.fov=this.fov;data.object.zoom=this.zoom;data.object.near=this.near;data.object.far=this.far;data.object.focus=this.focus;data.object.aspect=this.aspect;if(this.view!==null)data.object.view=Object.assign({},this.view);data.object.filmGauge=this.filmGauge;data.object.filmOffset=this.filmOffset;return data;}}const fov=-90;// negative fov is not an error
const aspect=1;class CubeCamera extends Object3D$1{constructor(near,far,renderTarget){super();this.type='CubeCamera';this.renderTarget=renderTarget;this.coordinateSystem=null;this.activeMipmapLevel=0;const cameraPX=new PerspectiveCamera$1(fov,aspect,near,far);cameraPX.layers=this.layers;this.add(cameraPX);const cameraNX=new PerspectiveCamera$1(fov,aspect,near,far);cameraNX.layers=this.layers;this.add(cameraNX);const cameraPY=new PerspectiveCamera$1(fov,aspect,near,far);cameraPY.layers=this.layers;this.add(cameraPY);const cameraNY=new PerspectiveCamera$1(fov,aspect,near,far);cameraNY.layers=this.layers;this.add(cameraNY);const cameraPZ=new PerspectiveCamera$1(fov,aspect,near,far);cameraPZ.layers=this.layers;this.add(cameraPZ);const cameraNZ=new PerspectiveCamera$1(fov,aspect,near,far);cameraNZ.layers=this.layers;this.add(cameraNZ);}updateCoordinateSystem(){const coordinateSystem=this.coordinateSystem;const cameras=this.children.concat();const[cameraPX,cameraNX,cameraPY,cameraNY,cameraPZ,cameraNZ]=cameras;for(const camera of cameras)this.remove(camera);if(coordinateSystem===WebGLCoordinateSystem$1){cameraPX.up.set(0,1,0);cameraPX.lookAt(1,0,0);cameraNX.up.set(0,1,0);cameraNX.lookAt(-1,0,0);cameraPY.up.set(0,0,-1);cameraPY.lookAt(0,1,0);cameraNY.up.set(0,0,1);cameraNY.lookAt(0,-1,0);cameraPZ.up.set(0,1,0);cameraPZ.lookAt(0,0,1);cameraNZ.up.set(0,1,0);cameraNZ.lookAt(0,0,-1);}else if(coordinateSystem===WebGPUCoordinateSystem$1){cameraPX.up.set(0,-1,0);cameraPX.lookAt(-1,0,0);cameraNX.up.set(0,-1,0);cameraNX.lookAt(1,0,0);cameraPY.up.set(0,0,1);cameraPY.lookAt(0,1,0);cameraNY.up.set(0,0,-1);cameraNY.lookAt(0,-1,0);cameraPZ.up.set(0,-1,0);cameraPZ.lookAt(0,0,1);cameraNZ.up.set(0,-1,0);cameraNZ.lookAt(0,0,-1);}else {throw new Error('THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: '+coordinateSystem);}for(const camera of cameras){this.add(camera);camera.updateMatrixWorld();}}update(renderer,scene){if(this.parent===null)this.updateMatrixWorld();const{renderTarget,activeMipmapLevel}=this;if(this.coordinateSystem!==renderer.coordinateSystem){this.coordinateSystem=renderer.coordinateSystem;this.updateCoordinateSystem();}const[cameraPX,cameraNX,cameraPY,cameraNY,cameraPZ,cameraNZ]=this.children;const currentRenderTarget=renderer.getRenderTarget();const currentActiveCubeFace=renderer.getActiveCubeFace();const currentActiveMipmapLevel=renderer.getActiveMipmapLevel();const currentXrEnabled=renderer.xr.enabled;renderer.xr.enabled=false;const generateMipmaps=renderTarget.texture.generateMipmaps;renderTarget.texture.generateMipmaps=false;renderer.setRenderTarget(renderTarget,0,activeMipmapLevel);renderer.render(scene,cameraPX);renderer.setRenderTarget(renderTarget,1,activeMipmapLevel);renderer.render(scene,cameraNX);renderer.setRenderTarget(renderTarget,2,activeMipmapLevel);renderer.render(scene,cameraPY);renderer.setRenderTarget(renderTarget,3,activeMipmapLevel);renderer.render(scene,cameraNY);renderer.setRenderTarget(renderTarget,4,activeMipmapLevel);renderer.render(scene,cameraPZ);// mipmaps are generated during the last call of render()
// at this point, all sides of the cube render target are defined
renderTarget.texture.generateMipmaps=generateMipmaps;renderer.setRenderTarget(renderTarget,5,activeMipmapLevel);renderer.render(scene,cameraNZ);renderer.setRenderTarget(currentRenderTarget,currentActiveCubeFace,currentActiveMipmapLevel);renderer.xr.enabled=currentXrEnabled;renderTarget.texture.needsPMREMUpdate=true;}}class CubeTexture extends Texture$1{constructor(images,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy,colorSpace){images=images!==undefined?images:[];mapping=mapping!==undefined?mapping:CubeReflectionMapping$1;super(images,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy,colorSpace);this.isCubeTexture=true;this.flipY=false;}get images(){return this.image;}set images(value){this.image=value;}}class WebGLCubeRenderTarget extends WebGLRenderTarget{constructor(size=1,options={}){super(size,size,options);this.isWebGLCubeRenderTarget=true;const image={width:size,height:size,depth:1};const images=[image,image,image,image,image,image];this.texture=new CubeTexture(images,options.mapping,options.wrapS,options.wrapT,options.magFilter,options.minFilter,options.format,options.type,options.anisotropy,options.colorSpace);// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.
// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped
// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture
// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).
this.texture.isRenderTargetTexture=true;this.texture.generateMipmaps=options.generateMipmaps!==undefined?options.generateMipmaps:false;this.texture.minFilter=options.minFilter!==undefined?options.minFilter:LinearFilter$1;}fromEquirectangularTexture(renderer,texture){this.texture.type=texture.type;this.texture.colorSpace=texture.colorSpace;this.texture.generateMipmaps=texture.generateMipmaps;this.texture.minFilter=texture.minFilter;this.texture.magFilter=texture.magFilter;const shader={uniforms:{tEquirect:{value:null}},vertexShader:/* glsl */`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:/* glsl */`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`};const geometry=new BoxGeometry(5,5,5);const material=new ShaderMaterial({name:'CubemapFromEquirect',uniforms:cloneUniforms(shader.uniforms),vertexShader:shader.vertexShader,fragmentShader:shader.fragmentShader,side:BackSide$1,blending:NoBlending});material.uniforms.tEquirect.value=texture;const mesh=new Mesh$1(geometry,material);const currentMinFilter=texture.minFilter;// Avoid blurred poles
if(texture.minFilter===LinearMipmapLinearFilter$1)texture.minFilter=LinearFilter$1;const camera=new CubeCamera(1,10,this);camera.update(renderer,mesh);texture.minFilter=currentMinFilter;mesh.geometry.dispose();mesh.material.dispose();return this;}clear(renderer,color,depth,stencil){const currentRenderTarget=renderer.getRenderTarget();for(let i=0;i<6;i++){renderer.setRenderTarget(this,i);renderer.clear(color,depth,stencil);}renderer.setRenderTarget(currentRenderTarget);}}const _vector1$1=/*@__PURE__*/new Vector3$1();const _vector2$2=/*@__PURE__*/new Vector3$1();const _normalMatrix$1=/*@__PURE__*/new Matrix3$1();class Plane$1{constructor(normal=new Vector3$1(1,0,0),constant=0){this.isPlane=true;// normal is assumed to be normalized
this.normal=normal;this.constant=constant;}set(normal,constant){this.normal.copy(normal);this.constant=constant;return this;}setComponents(x,y,z,w){this.normal.set(x,y,z);this.constant=w;return this;}setFromNormalAndCoplanarPoint(normal,point){this.normal.copy(normal);this.constant=-point.dot(this.normal);return this;}setFromCoplanarPoints(a,b,c){const normal=_vector1$1.subVectors(c,b).cross(_vector2$2.subVectors(a,b)).normalize();// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
this.setFromNormalAndCoplanarPoint(normal,a);return this;}copy(plane){this.normal.copy(plane.normal);this.constant=plane.constant;return this;}normalize(){// Note: will lead to a divide by zero if the plane is invalid.
const inverseNormalLength=1.0/this.normal.length();this.normal.multiplyScalar(inverseNormalLength);this.constant*=inverseNormalLength;return this;}negate(){this.constant*=-1;this.normal.negate();return this;}distanceToPoint(point){return this.normal.dot(point)+this.constant;}distanceToSphere(sphere){return this.distanceToPoint(sphere.center)-sphere.radius;}projectPoint(point,target){return target.copy(point).addScaledVector(this.normal,-this.distanceToPoint(point));}intersectLine(line,target){const direction=line.delta(_vector1$1);const denominator=this.normal.dot(direction);if(denominator===0){// line is coplanar, return origin
if(this.distanceToPoint(line.start)===0){return target.copy(line.start);}// Unsure if this is the correct method to handle this case.
return null;}const t=-(line.start.dot(this.normal)+this.constant)/denominator;if(t<0||t>1){return null;}return target.copy(line.start).addScaledVector(direction,t);}intersectsLine(line){// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
const startSign=this.distanceToPoint(line.start);const endSign=this.distanceToPoint(line.end);return startSign<0&&endSign>0||endSign<0&&startSign>0;}intersectsBox(box){return box.intersectsPlane(this);}intersectsSphere(sphere){return sphere.intersectsPlane(this);}coplanarPoint(target){return target.copy(this.normal).multiplyScalar(-this.constant);}applyMatrix4(matrix,optionalNormalMatrix){const normalMatrix=optionalNormalMatrix||_normalMatrix$1.getNormalMatrix(matrix);const referencePoint=this.coplanarPoint(_vector1$1).applyMatrix4(matrix);const normal=this.normal.applyMatrix3(normalMatrix).normalize();this.constant=-referencePoint.dot(normal);return this;}translate(offset){this.constant-=offset.dot(this.normal);return this;}equals(plane){return plane.normal.equals(this.normal)&&plane.constant===this.constant;}clone(){return new this.constructor().copy(this);}}const _sphere$5=/*@__PURE__*/new Sphere$1();const _vector$7=/*@__PURE__*/new Vector3$1();class Frustum{constructor(p0=new Plane$1(),p1=new Plane$1(),p2=new Plane$1(),p3=new Plane$1(),p4=new Plane$1(),p5=new Plane$1()){this.planes=[p0,p1,p2,p3,p4,p5];}set(p0,p1,p2,p3,p4,p5){const planes=this.planes;planes[0].copy(p0);planes[1].copy(p1);planes[2].copy(p2);planes[3].copy(p3);planes[4].copy(p4);planes[5].copy(p5);return this;}copy(frustum){const planes=this.planes;for(let i=0;i<6;i++){planes[i].copy(frustum.planes[i]);}return this;}setFromProjectionMatrix(m,coordinateSystem=WebGLCoordinateSystem$1){const planes=this.planes;const me=m.elements;const me0=me[0],me1=me[1],me2=me[2],me3=me[3];const me4=me[4],me5=me[5],me6=me[6],me7=me[7];const me8=me[8],me9=me[9],me10=me[10],me11=me[11];const me12=me[12],me13=me[13],me14=me[14],me15=me[15];planes[0].setComponents(me3-me0,me7-me4,me11-me8,me15-me12).normalize();planes[1].setComponents(me3+me0,me7+me4,me11+me8,me15+me12).normalize();planes[2].setComponents(me3+me1,me7+me5,me11+me9,me15+me13).normalize();planes[3].setComponents(me3-me1,me7-me5,me11-me9,me15-me13).normalize();planes[4].setComponents(me3-me2,me7-me6,me11-me10,me15-me14).normalize();if(coordinateSystem===WebGLCoordinateSystem$1){planes[5].setComponents(me3+me2,me7+me6,me11+me10,me15+me14).normalize();}else if(coordinateSystem===WebGPUCoordinateSystem$1){planes[5].setComponents(me2,me6,me10,me14).normalize();}else {throw new Error('THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: '+coordinateSystem);}return this;}intersectsObject(object){if(object.boundingSphere!==undefined){if(object.boundingSphere===null)object.computeBoundingSphere();_sphere$5.copy(object.boundingSphere).applyMatrix4(object.matrixWorld);}else {const geometry=object.geometry;if(geometry.boundingSphere===null)geometry.computeBoundingSphere();_sphere$5.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld);}return this.intersectsSphere(_sphere$5);}intersectsSprite(sprite){_sphere$5.center.set(0,0,0);_sphere$5.radius=0.7071067811865476;_sphere$5.applyMatrix4(sprite.matrixWorld);return this.intersectsSphere(_sphere$5);}intersectsSphere(sphere){const planes=this.planes;const center=sphere.center;const negRadius=-sphere.radius;for(let i=0;i<6;i++){const distance=planes[i].distanceToPoint(center);if(distance<negRadius){return false;}}return true;}intersectsBox(box){const planes=this.planes;for(let i=0;i<6;i++){const plane=planes[i];// corner at max distance
_vector$7.x=plane.normal.x>0?box.max.x:box.min.x;_vector$7.y=plane.normal.y>0?box.max.y:box.min.y;_vector$7.z=plane.normal.z>0?box.max.z:box.min.z;if(plane.distanceToPoint(_vector$7)<0){return false;}}return true;}containsPoint(point){const planes=this.planes;for(let i=0;i<6;i++){if(planes[i].distanceToPoint(point)<0){return false;}}return true;}clone(){return new this.constructor().copy(this);}}function WebGLAnimation(){let context=null;let isAnimating=false;let animationLoop=null;let requestId=null;function onAnimationFrame(time,frame){animationLoop(time,frame);requestId=context.requestAnimationFrame(onAnimationFrame);}return {start:function(){if(isAnimating===true)return;if(animationLoop===null)return;requestId=context.requestAnimationFrame(onAnimationFrame);isAnimating=true;},stop:function(){context.cancelAnimationFrame(requestId);isAnimating=false;},setAnimationLoop:function(callback){animationLoop=callback;},setContext:function(value){context=value;}};}function WebGLAttributes(gl){const buffers=new WeakMap();function createBuffer(attribute,bufferType){const array=attribute.array;const usage=attribute.usage;const size=array.byteLength;const buffer=gl.createBuffer();gl.bindBuffer(bufferType,buffer);gl.bufferData(bufferType,array,usage);attribute.onUploadCallback();let type;if(array instanceof Float32Array){type=gl.FLOAT;}else if(array instanceof Uint16Array){if(attribute.isFloat16BufferAttribute){type=gl.HALF_FLOAT;}else {type=gl.UNSIGNED_SHORT;}}else if(array instanceof Int16Array){type=gl.SHORT;}else if(array instanceof Uint32Array){type=gl.UNSIGNED_INT;}else if(array instanceof Int32Array){type=gl.INT;}else if(array instanceof Int8Array){type=gl.BYTE;}else if(array instanceof Uint8Array){type=gl.UNSIGNED_BYTE;}else if(array instanceof Uint8ClampedArray){type=gl.UNSIGNED_BYTE;}else {throw new Error('THREE.WebGLAttributes: Unsupported buffer data format: '+array);}return {buffer:buffer,type:type,bytesPerElement:array.BYTES_PER_ELEMENT,version:attribute.version,size:size};}function updateBuffer(buffer,attribute,bufferType){const array=attribute.array;const updateRange=attribute._updateRange;// @deprecated, r159
const updateRanges=attribute.updateRanges;gl.bindBuffer(bufferType,buffer);if(updateRange.count===-1&&updateRanges.length===0){// Not using update ranges
gl.bufferSubData(bufferType,0,array);}if(updateRanges.length!==0){for(let i=0,l=updateRanges.length;i<l;i++){const range=updateRanges[i];gl.bufferSubData(bufferType,range.start*array.BYTES_PER_ELEMENT,array,range.start,range.count);}attribute.clearUpdateRanges();}// @deprecated, r159
if(updateRange.count!==-1){gl.bufferSubData(bufferType,updateRange.offset*array.BYTES_PER_ELEMENT,array,updateRange.offset,updateRange.count);updateRange.count=-1;// reset range
}attribute.onUploadCallback();}//
function get(attribute){if(attribute.isInterleavedBufferAttribute)attribute=attribute.data;return buffers.get(attribute);}function remove(attribute){if(attribute.isInterleavedBufferAttribute)attribute=attribute.data;const data=buffers.get(attribute);if(data){gl.deleteBuffer(data.buffer);buffers.delete(attribute);}}function update(attribute,bufferType){if(attribute.isInterleavedBufferAttribute)attribute=attribute.data;if(attribute.isGLBufferAttribute){const cached=buffers.get(attribute);if(!cached||cached.version<attribute.version){buffers.set(attribute,{buffer:attribute.buffer,type:attribute.type,bytesPerElement:attribute.elementSize,version:attribute.version});}return;}const data=buffers.get(attribute);if(data===undefined){buffers.set(attribute,createBuffer(attribute,bufferType));}else if(data.version<attribute.version){if(data.size!==attribute.array.byteLength){throw new Error('THREE.WebGLAttributes: The size of the buffer attribute\'s array buffer does not match the original size. Resizing buffer attributes is not supported.');}updateBuffer(data.buffer,attribute,bufferType);data.version=attribute.version;}}return {get:get,remove:remove,update:update};}class PlaneGeometry extends BufferGeometry$1{constructor(width=1,height=1,widthSegments=1,heightSegments=1){super();this.type='PlaneGeometry';this.parameters={width:width,height:height,widthSegments:widthSegments,heightSegments:heightSegments};const width_half=width/2;const height_half=height/2;const gridX=Math.floor(widthSegments);const gridY=Math.floor(heightSegments);const gridX1=gridX+1;const gridY1=gridY+1;const segment_width=width/gridX;const segment_height=height/gridY;//
const indices=[];const vertices=[];const normals=[];const uvs=[];for(let iy=0;iy<gridY1;iy++){const y=iy*segment_height-height_half;for(let ix=0;ix<gridX1;ix++){const x=ix*segment_width-width_half;vertices.push(x,-y,0);normals.push(0,0,1);uvs.push(ix/gridX);uvs.push(1-iy/gridY);}}for(let iy=0;iy<gridY;iy++){for(let ix=0;ix<gridX;ix++){const a=ix+gridX1*iy;const b=ix+gridX1*(iy+1);const c=ix+1+gridX1*(iy+1);const d=ix+1+gridX1*iy;indices.push(a,b,d);indices.push(b,c,d);}}this.setIndex(indices);this.setAttribute('position',new Float32BufferAttribute$1(vertices,3));this.setAttribute('normal',new Float32BufferAttribute$1(normals,3));this.setAttribute('uv',new Float32BufferAttribute$1(uvs,2));}copy(source){super.copy(source);this.parameters=Object.assign({},source.parameters);return this;}static fromJSON(data){return new PlaneGeometry(data.width,data.height,data.widthSegments,data.heightSegments);}}var alphahash_fragment="#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif";var alphahash_pars_fragment="#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif";var alphamap_fragment="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif";var alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";var alphatest_fragment="#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif";var alphatest_pars_fragment="#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";var aomap_fragment="#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";var aomap_pars_fragment="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";var batching_pars_vertex="#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif";var batching_vertex="#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif";var begin_vertex="vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";var beginnormal_vertex="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";var bsdfs="float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated";var iridescence_fragment="#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660,  0.0556434,\n\t\t-1.5371385,  1.8760108, -0.2040259,\n\t\t-0.4985314,  0.0415560,  1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif";var bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";var clipping_planes_fragment="#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif";var clipping_planes_pars_fragment="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif";var clipping_planes_pars_vertex="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif";var clipping_planes_vertex="#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif";var color_fragment="#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif";var color_pars_fragment="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif";var color_pars_vertex="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif";var color_vertex="#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif";var common="#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";var cube_uv_reflection_fragment="#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";var defaultnormal_vertex="vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";var displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif";var displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif";var emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif";var emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif";var colorspace_fragment="gl_FragColor = linearToOutputTexel( gl_FragColor );";var colorspace_pars_fragment="\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";var envmap_fragment="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";var envmap_common_pars_fragment="#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";var envmap_pars_fragment="#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";var envmap_pars_vertex="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";var envmap_vertex="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif";var fog_vertex="#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif";var fog_pars_vertex="#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif";var fog_fragment="#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif";var fog_pars_fragment="#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif";var gradientmap_pars_fragment="#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}";var lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";var lights_lambert_fragment="LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";var lights_lambert_pars_fragment="varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert";var lights_pars_begin="uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";var envmap_physical_pars_fragment="#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";var lights_toon_fragment="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";var lights_toon_pars_fragment="varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon";var lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";var lights_phong_pars_fragment="varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";var lights_physical_fragment="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";var lights_physical_pars_fragment="struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n    float x2 = x * x;\n    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";var lights_fragment_begin="\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";var lights_fragment_maps="#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";var lights_fragment_end="#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";var logdepthbuf_fragment="#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";var logdepthbuf_pars_fragment="#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";var logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";var logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";var map_fragment="#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";var map_pars_fragment="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";var map_particle_fragment="#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif";var map_particle_pars_fragment="#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";var metalnessmap_fragment="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif";var metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";var morphinstance_vertex="#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif";var morphcolor_vertex="#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif";var morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif";var morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif";var morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif";var normal_fragment_begin="float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;";var normal_fragment_maps="#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";var normal_pars_fragment="#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";var normal_pars_vertex="#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";var normal_vertex="#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";var normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";var clearcoat_normal_fragment_begin="#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif";var clearcoat_normal_fragment_maps="#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif";var clearcoat_pars_fragment="#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif";var iridescence_pars_fragment="#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif";var opaque_fragment="#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";var packing="vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}";var premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";var project_vertex="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;";var dithering_fragment="#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif";var dithering_pars_fragment="#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif";var roughnessmap_fragment="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif";var roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";var shadowmap_pars_fragment="#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif";var shadowmap_pars_vertex="#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";var shadowmap_vertex="#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif";var shadowmask_pars_fragment="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";var skinbase_vertex="#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";var skinning_pars_vertex="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif";var skinning_vertex="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif";var skinnormal_vertex="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif";var specularmap_fragment="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif";var specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif";var tonemapping_fragment="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";var tonemapping_pars_fragment="#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(  1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,  1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,  1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";var transmission_fragment="#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";var transmission_pars_fragment="#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";var uv_pars_fragment="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";var uv_pars_vertex="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";var uv_vertex="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";var worldpos_vertex="#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";const vertex$h="varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";const fragment$h="uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";const vertex$g="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";const fragment$g="#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";const vertex$f="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";const fragment$f="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";const vertex$e="#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";const fragment$e="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";const vertex$d="#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";const fragment$d="#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}";const vertex$c="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}";const fragment$c="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";const vertex$b="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";const fragment$b="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";const vertex$a="#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";const fragment$a="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const vertex$9="#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";const fragment$9="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const vertex$8="#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";const fragment$8="#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const vertex$7="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";const fragment$7="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";const vertex$6="#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";const fragment$6="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const vertex$5="#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";const fragment$5="#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const vertex$4="#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";const fragment$4="#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";const vertex$3="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";const fragment$3="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";const vertex$2="#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";const fragment$2="uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";const vertex$1="uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";const fragment$1="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";const ShaderChunk={alphahash_fragment:alphahash_fragment,alphahash_pars_fragment:alphahash_pars_fragment,alphamap_fragment:alphamap_fragment,alphamap_pars_fragment:alphamap_pars_fragment,alphatest_fragment:alphatest_fragment,alphatest_pars_fragment:alphatest_pars_fragment,aomap_fragment:aomap_fragment,aomap_pars_fragment:aomap_pars_fragment,batching_pars_vertex:batching_pars_vertex,batching_vertex:batching_vertex,begin_vertex:begin_vertex,beginnormal_vertex:beginnormal_vertex,bsdfs:bsdfs,iridescence_fragment:iridescence_fragment,bumpmap_pars_fragment:bumpmap_pars_fragment,clipping_planes_fragment:clipping_planes_fragment,clipping_planes_pars_fragment:clipping_planes_pars_fragment,clipping_planes_pars_vertex:clipping_planes_pars_vertex,clipping_planes_vertex:clipping_planes_vertex,color_fragment:color_fragment,color_pars_fragment:color_pars_fragment,color_pars_vertex:color_pars_vertex,color_vertex:color_vertex,common:common,cube_uv_reflection_fragment:cube_uv_reflection_fragment,defaultnormal_vertex:defaultnormal_vertex,displacementmap_pars_vertex:displacementmap_pars_vertex,displacementmap_vertex:displacementmap_vertex,emissivemap_fragment:emissivemap_fragment,emissivemap_pars_fragment:emissivemap_pars_fragment,colorspace_fragment:colorspace_fragment,colorspace_pars_fragment:colorspace_pars_fragment,envmap_fragment:envmap_fragment,envmap_common_pars_fragment:envmap_common_pars_fragment,envmap_pars_fragment:envmap_pars_fragment,envmap_pars_vertex:envmap_pars_vertex,envmap_physical_pars_fragment:envmap_physical_pars_fragment,envmap_vertex:envmap_vertex,fog_vertex:fog_vertex,fog_pars_vertex:fog_pars_vertex,fog_fragment:fog_fragment,fog_pars_fragment:fog_pars_fragment,gradientmap_pars_fragment:gradientmap_pars_fragment,lightmap_pars_fragment:lightmap_pars_fragment,lights_lambert_fragment:lights_lambert_fragment,lights_lambert_pars_fragment:lights_lambert_pars_fragment,lights_pars_begin:lights_pars_begin,lights_toon_fragment:lights_toon_fragment,lights_toon_pars_fragment:lights_toon_pars_fragment,lights_phong_fragment:lights_phong_fragment,lights_phong_pars_fragment:lights_phong_pars_fragment,lights_physical_fragment:lights_physical_fragment,lights_physical_pars_fragment:lights_physical_pars_fragment,lights_fragment_begin:lights_fragment_begin,lights_fragment_maps:lights_fragment_maps,lights_fragment_end:lights_fragment_end,logdepthbuf_fragment:logdepthbuf_fragment,logdepthbuf_pars_fragment:logdepthbuf_pars_fragment,logdepthbuf_pars_vertex:logdepthbuf_pars_vertex,logdepthbuf_vertex:logdepthbuf_vertex,map_fragment:map_fragment,map_pars_fragment:map_pars_fragment,map_particle_fragment:map_particle_fragment,map_particle_pars_fragment:map_particle_pars_fragment,metalnessmap_fragment:metalnessmap_fragment,metalnessmap_pars_fragment:metalnessmap_pars_fragment,morphinstance_vertex:morphinstance_vertex,morphcolor_vertex:morphcolor_vertex,morphnormal_vertex:morphnormal_vertex,morphtarget_pars_vertex:morphtarget_pars_vertex,morphtarget_vertex:morphtarget_vertex,normal_fragment_begin:normal_fragment_begin,normal_fragment_maps:normal_fragment_maps,normal_pars_fragment:normal_pars_fragment,normal_pars_vertex:normal_pars_vertex,normal_vertex:normal_vertex,normalmap_pars_fragment:normalmap_pars_fragment,clearcoat_normal_fragment_begin:clearcoat_normal_fragment_begin,clearcoat_normal_fragment_maps:clearcoat_normal_fragment_maps,clearcoat_pars_fragment:clearcoat_pars_fragment,iridescence_pars_fragment:iridescence_pars_fragment,opaque_fragment:opaque_fragment,packing:packing,premultiplied_alpha_fragment:premultiplied_alpha_fragment,project_vertex:project_vertex,dithering_fragment:dithering_fragment,dithering_pars_fragment:dithering_pars_fragment,roughnessmap_fragment:roughnessmap_fragment,roughnessmap_pars_fragment:roughnessmap_pars_fragment,shadowmap_pars_fragment:shadowmap_pars_fragment,shadowmap_pars_vertex:shadowmap_pars_vertex,shadowmap_vertex:shadowmap_vertex,shadowmask_pars_fragment:shadowmask_pars_fragment,skinbase_vertex:skinbase_vertex,skinning_pars_vertex:skinning_pars_vertex,skinning_vertex:skinning_vertex,skinnormal_vertex:skinnormal_vertex,specularmap_fragment:specularmap_fragment,specularmap_pars_fragment:specularmap_pars_fragment,tonemapping_fragment:tonemapping_fragment,tonemapping_pars_fragment:tonemapping_pars_fragment,transmission_fragment:transmission_fragment,transmission_pars_fragment:transmission_pars_fragment,uv_pars_fragment:uv_pars_fragment,uv_pars_vertex:uv_pars_vertex,uv_vertex:uv_vertex,worldpos_vertex:worldpos_vertex,background_vert:vertex$h,background_frag:fragment$h,backgroundCube_vert:vertex$g,backgroundCube_frag:fragment$g,cube_vert:vertex$f,cube_frag:fragment$f,depth_vert:vertex$e,depth_frag:fragment$e,distanceRGBA_vert:vertex$d,distanceRGBA_frag:fragment$d,equirect_vert:vertex$c,equirect_frag:fragment$c,linedashed_vert:vertex$b,linedashed_frag:fragment$b,meshbasic_vert:vertex$a,meshbasic_frag:fragment$a,meshlambert_vert:vertex$9,meshlambert_frag:fragment$9,meshmatcap_vert:vertex$8,meshmatcap_frag:fragment$8,meshnormal_vert:vertex$7,meshnormal_frag:fragment$7,meshphong_vert:vertex$6,meshphong_frag:fragment$6,meshphysical_vert:vertex$5,meshphysical_frag:fragment$5,meshtoon_vert:vertex$4,meshtoon_frag:fragment$4,points_vert:vertex$3,points_frag:fragment$3,shadow_vert:vertex$2,shadow_frag:fragment$2,sprite_vert:vertex$1,sprite_frag:fragment$1};/**
 * Uniforms library for shared webgl shaders
 */const UniformsLib={common:{diffuse:{value:/*@__PURE__*/new Color$1(0xffffff)},opacity:{value:1.0},map:{value:null},mapTransform:{value:/*@__PURE__*/new Matrix3$1()},alphaMap:{value:null},alphaMapTransform:{value:/*@__PURE__*/new Matrix3$1()},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:/*@__PURE__*/new Matrix3$1()}},envmap:{envMap:{value:null},envMapRotation:{value:/*@__PURE__*/new Matrix3$1()},flipEnvMap:{value:-1},reflectivity:{value:1.0},// basic, lambert, phong
ior:{value:1.5},// physical
refractionRatio:{value:0.98}// basic, lambert, phong
},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:/*@__PURE__*/new Matrix3$1()}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:/*@__PURE__*/new Matrix3$1()}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:/*@__PURE__*/new Matrix3$1()},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:/*@__PURE__*/new Matrix3$1()},normalScale:{value:/*@__PURE__*/new Vector2$1(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:/*@__PURE__*/new Matrix3$1()},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:/*@__PURE__*/new Matrix3$1()}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:/*@__PURE__*/new Matrix3$1()}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:/*@__PURE__*/new Matrix3$1()}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:/*@__PURE__*/new Color$1(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src
rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:/*@__PURE__*/new Color$1(0xffffff)},opacity:{value:1.0},size:{value:1.0},scale:{value:1.0},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:/*@__PURE__*/new Matrix3$1()},alphaTest:{value:0},uvTransform:{value:/*@__PURE__*/new Matrix3$1()}},sprite:{diffuse:{value:/*@__PURE__*/new Color$1(0xffffff)},opacity:{value:1.0},center:{value:/*@__PURE__*/new Vector2$1(0.5,0.5)},rotation:{value:0.0},map:{value:null},mapTransform:{value:/*@__PURE__*/new Matrix3$1()},alphaMap:{value:null},alphaMapTransform:{value:/*@__PURE__*/new Matrix3$1()},alphaTest:{value:0}}};const ShaderLib={basic:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.fog]),vertexShader:ShaderChunk.meshbasic_vert,fragmentShader:ShaderChunk.meshbasic_frag},lambert:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:/*@__PURE__*/new Color$1(0x000000)}}]),vertexShader:ShaderChunk.meshlambert_vert,fragmentShader:ShaderChunk.meshlambert_frag},phong:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.specularmap,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:/*@__PURE__*/new Color$1(0x000000)},specular:{value:/*@__PURE__*/new Color$1(0x111111)},shininess:{value:30}}]),vertexShader:ShaderChunk.meshphong_vert,fragmentShader:ShaderChunk.meshphong_frag},standard:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.envmap,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.roughnessmap,UniformsLib.metalnessmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:/*@__PURE__*/new Color$1(0x000000)},roughness:{value:1.0},metalness:{value:0.0},envMapIntensity:{value:1}}]),vertexShader:ShaderChunk.meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag},toon:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.aomap,UniformsLib.lightmap,UniformsLib.emissivemap,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.gradientmap,UniformsLib.fog,UniformsLib.lights,{emissive:{value:/*@__PURE__*/new Color$1(0x000000)}}]),vertexShader:ShaderChunk.meshtoon_vert,fragmentShader:ShaderChunk.meshtoon_frag},matcap:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,UniformsLib.fog,{matcap:{value:null}}]),vertexShader:ShaderChunk.meshmatcap_vert,fragmentShader:ShaderChunk.meshmatcap_frag},points:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.points,UniformsLib.fog]),vertexShader:ShaderChunk.points_vert,fragmentShader:ShaderChunk.points_frag},dashed:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ShaderChunk.linedashed_vert,fragmentShader:ShaderChunk.linedashed_frag},depth:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.displacementmap]),vertexShader:ShaderChunk.depth_vert,fragmentShader:ShaderChunk.depth_frag},normal:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.bumpmap,UniformsLib.normalmap,UniformsLib.displacementmap,{opacity:{value:1.0}}]),vertexShader:ShaderChunk.meshnormal_vert,fragmentShader:ShaderChunk.meshnormal_frag},sprite:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.sprite,UniformsLib.fog]),vertexShader:ShaderChunk.sprite_vert,fragmentShader:ShaderChunk.sprite_frag},background:{uniforms:{uvTransform:{value:/*@__PURE__*/new Matrix3$1()},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ShaderChunk.background_vert,fragmentShader:ShaderChunk.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:/*@__PURE__*/new Matrix3$1()}},vertexShader:ShaderChunk.backgroundCube_vert,fragmentShader:ShaderChunk.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1.0}},vertexShader:ShaderChunk.cube_vert,fragmentShader:ShaderChunk.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ShaderChunk.equirect_vert,fragmentShader:ShaderChunk.equirect_frag},distanceRGBA:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.common,UniformsLib.displacementmap,{referencePosition:{value:/*@__PURE__*/new Vector3$1()},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:ShaderChunk.distanceRGBA_vert,fragmentShader:ShaderChunk.distanceRGBA_frag},shadow:{uniforms:/*@__PURE__*/mergeUniforms([UniformsLib.lights,UniformsLib.fog,{color:{value:/*@__PURE__*/new Color$1(0x00000)},opacity:{value:1.0}}]),vertexShader:ShaderChunk.shadow_vert,fragmentShader:ShaderChunk.shadow_frag}};ShaderLib.physical={uniforms:/*@__PURE__*/mergeUniforms([ShaderLib.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:/*@__PURE__*/new Matrix3$1()},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:/*@__PURE__*/new Matrix3$1()},clearcoatNormalScale:{value:/*@__PURE__*/new Vector2$1(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:/*@__PURE__*/new Matrix3$1()},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:/*@__PURE__*/new Matrix3$1()},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:/*@__PURE__*/new Matrix3$1()},sheen:{value:0},sheenColor:{value:/*@__PURE__*/new Color$1(0x000000)},sheenColorMap:{value:null},sheenColorMapTransform:{value:/*@__PURE__*/new Matrix3$1()},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:/*@__PURE__*/new Matrix3$1()},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:/*@__PURE__*/new Matrix3$1()},transmissionSamplerSize:{value:/*@__PURE__*/new Vector2$1()},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:/*@__PURE__*/new Matrix3$1()},attenuationDistance:{value:0},attenuationColor:{value:/*@__PURE__*/new Color$1(0x000000)},specularColor:{value:/*@__PURE__*/new Color$1(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:/*@__PURE__*/new Matrix3$1()},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:/*@__PURE__*/new Matrix3$1()},anisotropyVector:{value:/*@__PURE__*/new Vector2$1()},anisotropyMap:{value:null},anisotropyMapTransform:{value:/*@__PURE__*/new Matrix3$1()}}]),vertexShader:ShaderChunk.meshphysical_vert,fragmentShader:ShaderChunk.meshphysical_frag};const _rgb={r:0,b:0,g:0};const _e1$1=/*@__PURE__*/new Euler$1();const _m1$1$1=/*@__PURE__*/new Matrix4$1();function WebGLBackground(renderer,cubemaps,cubeuvmaps,state,objects,alpha,premultipliedAlpha){const clearColor=new Color$1(0x000000);let clearAlpha=alpha===true?0:1;let planeMesh;let boxMesh;let currentBackground=null;let currentBackgroundVersion=0;let currentTonemapping=null;function getBackground(scene){let background=scene.isScene===true?scene.background:null;if(background&&background.isTexture){const usePMREM=scene.backgroundBlurriness>0;// use PMREM if the user wants to blur the background
background=(usePMREM?cubeuvmaps:cubemaps).get(background);}return background;}function render(scene){let forceClear=false;const background=getBackground(scene);if(background===null){setClear(clearColor,clearAlpha);}else if(background&&background.isColor){setClear(background,1);forceClear=true;}const environmentBlendMode=renderer.xr.getEnvironmentBlendMode();if(environmentBlendMode==='additive'){state.buffers.color.setClear(0,0,0,1,premultipliedAlpha);}else if(environmentBlendMode==='alpha-blend'){state.buffers.color.setClear(0,0,0,0,premultipliedAlpha);}if(renderer.autoClear||forceClear){// buffers might not be writable which is required to ensure a correct clear
state.buffers.depth.setTest(true);state.buffers.depth.setMask(true);state.buffers.color.setMask(true);renderer.clear(renderer.autoClearColor,renderer.autoClearDepth,renderer.autoClearStencil);}}function addToRenderList(renderList,scene){const background=getBackground(scene);if(background&&(background.isCubeTexture||background.mapping===CubeUVReflectionMapping)){if(boxMesh===undefined){boxMesh=new Mesh$1(new BoxGeometry(1,1,1),new ShaderMaterial({name:'BackgroundCubeMaterial',uniforms:cloneUniforms(ShaderLib.backgroundCube.uniforms),vertexShader:ShaderLib.backgroundCube.vertexShader,fragmentShader:ShaderLib.backgroundCube.fragmentShader,side:BackSide$1,depthTest:false,depthWrite:false,fog:false}));boxMesh.geometry.deleteAttribute('normal');boxMesh.geometry.deleteAttribute('uv');boxMesh.onBeforeRender=function(renderer,scene,camera){this.matrixWorld.copyPosition(camera.matrixWorld);};// add "envMap" material property so the renderer can evaluate it like for built-in materials
Object.defineProperty(boxMesh.material,'envMap',{get:function(){return this.uniforms.envMap.value;}});objects.update(boxMesh);}_e1$1.copy(scene.backgroundRotation);// accommodate left-handed frame
_e1$1.x*=-1;_e1$1.y*=-1;_e1$1.z*=-1;if(background.isCubeTexture&&background.isRenderTargetTexture===false){// environment maps which are not cube render targets or PMREMs follow a different convention
_e1$1.y*=-1;_e1$1.z*=-1;}boxMesh.material.uniforms.envMap.value=background;boxMesh.material.uniforms.flipEnvMap.value=background.isCubeTexture&&background.isRenderTargetTexture===false?-1:1;boxMesh.material.uniforms.backgroundBlurriness.value=scene.backgroundBlurriness;boxMesh.material.uniforms.backgroundIntensity.value=scene.backgroundIntensity;boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$1$1.makeRotationFromEuler(_e1$1));boxMesh.material.toneMapped=ColorManagement$1.getTransfer(background.colorSpace)!==SRGBTransfer$1;if(currentBackground!==background||currentBackgroundVersion!==background.version||currentTonemapping!==renderer.toneMapping){boxMesh.material.needsUpdate=true;currentBackground=background;currentBackgroundVersion=background.version;currentTonemapping=renderer.toneMapping;}boxMesh.layers.enableAll();// push to the pre-sorted opaque render list
renderList.unshift(boxMesh,boxMesh.geometry,boxMesh.material,0,0,null);}else if(background&&background.isTexture){if(planeMesh===undefined){planeMesh=new Mesh$1(new PlaneGeometry(2,2),new ShaderMaterial({name:'BackgroundMaterial',uniforms:cloneUniforms(ShaderLib.background.uniforms),vertexShader:ShaderLib.background.vertexShader,fragmentShader:ShaderLib.background.fragmentShader,side:FrontSide$1,depthTest:false,depthWrite:false,fog:false}));planeMesh.geometry.deleteAttribute('normal');// add "map" material property so the renderer can evaluate it like for built-in materials
Object.defineProperty(planeMesh.material,'map',{get:function(){return this.uniforms.t2D.value;}});objects.update(planeMesh);}planeMesh.material.uniforms.t2D.value=background;planeMesh.material.uniforms.backgroundIntensity.value=scene.backgroundIntensity;planeMesh.material.toneMapped=ColorManagement$1.getTransfer(background.colorSpace)!==SRGBTransfer$1;if(background.matrixAutoUpdate===true){background.updateMatrix();}planeMesh.material.uniforms.uvTransform.value.copy(background.matrix);if(currentBackground!==background||currentBackgroundVersion!==background.version||currentTonemapping!==renderer.toneMapping){planeMesh.material.needsUpdate=true;currentBackground=background;currentBackgroundVersion=background.version;currentTonemapping=renderer.toneMapping;}planeMesh.layers.enableAll();// push to the pre-sorted opaque render list
renderList.unshift(planeMesh,planeMesh.geometry,planeMesh.material,0,0,null);}}function setClear(color,alpha){color.getRGB(_rgb,getUnlitUniformColorSpace(renderer));state.buffers.color.setClear(_rgb.r,_rgb.g,_rgb.b,alpha,premultipliedAlpha);}return {getClearColor:function(){return clearColor;},setClearColor:function(color,alpha=1){clearColor.set(color);clearAlpha=alpha;setClear(clearColor,clearAlpha);},getClearAlpha:function(){return clearAlpha;},setClearAlpha:function(alpha){clearAlpha=alpha;setClear(clearColor,clearAlpha);},render:render,addToRenderList:addToRenderList};}function WebGLBindingStates(gl,attributes){const maxVertexAttributes=gl.getParameter(gl.MAX_VERTEX_ATTRIBS);const bindingStates={};const defaultState=createBindingState(null);let currentState=defaultState;let forceUpdate=false;function setup(object,material,program,geometry,index){let updateBuffers=false;const state=getBindingState(geometry,program,material);if(currentState!==state){currentState=state;bindVertexArrayObject(currentState.object);}updateBuffers=needsUpdate(object,geometry,program,index);if(updateBuffers)saveCache(object,geometry,program,index);if(index!==null){attributes.update(index,gl.ELEMENT_ARRAY_BUFFER);}if(updateBuffers||forceUpdate){forceUpdate=false;setupVertexAttributes(object,material,program,geometry);if(index!==null){gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,attributes.get(index).buffer);}}}function createVertexArrayObject(){return gl.createVertexArray();}function bindVertexArrayObject(vao){return gl.bindVertexArray(vao);}function deleteVertexArrayObject(vao){return gl.deleteVertexArray(vao);}function getBindingState(geometry,program,material){const wireframe=material.wireframe===true;let programMap=bindingStates[geometry.id];if(programMap===undefined){programMap={};bindingStates[geometry.id]=programMap;}let stateMap=programMap[program.id];if(stateMap===undefined){stateMap={};programMap[program.id]=stateMap;}let state=stateMap[wireframe];if(state===undefined){state=createBindingState(createVertexArrayObject());stateMap[wireframe]=state;}return state;}function createBindingState(vao){const newAttributes=[];const enabledAttributes=[];const attributeDivisors=[];for(let i=0;i<maxVertexAttributes;i++){newAttributes[i]=0;enabledAttributes[i]=0;attributeDivisors[i]=0;}return {// for backward compatibility on non-VAO support browser
geometry:null,program:null,wireframe:false,newAttributes:newAttributes,enabledAttributes:enabledAttributes,attributeDivisors:attributeDivisors,object:vao,attributes:{},index:null};}function needsUpdate(object,geometry,program,index){const cachedAttributes=currentState.attributes;const geometryAttributes=geometry.attributes;let attributesNum=0;const programAttributes=program.getAttributes();for(const name in programAttributes){const programAttribute=programAttributes[name];if(programAttribute.location>=0){const cachedAttribute=cachedAttributes[name];let geometryAttribute=geometryAttributes[name];if(geometryAttribute===undefined){if(name==='instanceMatrix'&&object.instanceMatrix)geometryAttribute=object.instanceMatrix;if(name==='instanceColor'&&object.instanceColor)geometryAttribute=object.instanceColor;}if(cachedAttribute===undefined)return true;if(cachedAttribute.attribute!==geometryAttribute)return true;if(geometryAttribute&&cachedAttribute.data!==geometryAttribute.data)return true;attributesNum++;}}if(currentState.attributesNum!==attributesNum)return true;if(currentState.index!==index)return true;return false;}function saveCache(object,geometry,program,index){const cache={};const attributes=geometry.attributes;let attributesNum=0;const programAttributes=program.getAttributes();for(const name in programAttributes){const programAttribute=programAttributes[name];if(programAttribute.location>=0){let attribute=attributes[name];if(attribute===undefined){if(name==='instanceMatrix'&&object.instanceMatrix)attribute=object.instanceMatrix;if(name==='instanceColor'&&object.instanceColor)attribute=object.instanceColor;}const data={};data.attribute=attribute;if(attribute&&attribute.data){data.data=attribute.data;}cache[name]=data;attributesNum++;}}currentState.attributes=cache;currentState.attributesNum=attributesNum;currentState.index=index;}function initAttributes(){const newAttributes=currentState.newAttributes;for(let i=0,il=newAttributes.length;i<il;i++){newAttributes[i]=0;}}function enableAttribute(attribute){enableAttributeAndDivisor(attribute,0);}function enableAttributeAndDivisor(attribute,meshPerAttribute){const newAttributes=currentState.newAttributes;const enabledAttributes=currentState.enabledAttributes;const attributeDivisors=currentState.attributeDivisors;newAttributes[attribute]=1;if(enabledAttributes[attribute]===0){gl.enableVertexAttribArray(attribute);enabledAttributes[attribute]=1;}if(attributeDivisors[attribute]!==meshPerAttribute){gl.vertexAttribDivisor(attribute,meshPerAttribute);attributeDivisors[attribute]=meshPerAttribute;}}function disableUnusedAttributes(){const newAttributes=currentState.newAttributes;const enabledAttributes=currentState.enabledAttributes;for(let i=0,il=enabledAttributes.length;i<il;i++){if(enabledAttributes[i]!==newAttributes[i]){gl.disableVertexAttribArray(i);enabledAttributes[i]=0;}}}function vertexAttribPointer(index,size,type,normalized,stride,offset,integer){if(integer===true){gl.vertexAttribIPointer(index,size,type,stride,offset);}else {gl.vertexAttribPointer(index,size,type,normalized,stride,offset);}}function setupVertexAttributes(object,material,program,geometry){initAttributes();const geometryAttributes=geometry.attributes;const programAttributes=program.getAttributes();const materialDefaultAttributeValues=material.defaultAttributeValues;for(const name in programAttributes){const programAttribute=programAttributes[name];if(programAttribute.location>=0){let geometryAttribute=geometryAttributes[name];if(geometryAttribute===undefined){if(name==='instanceMatrix'&&object.instanceMatrix)geometryAttribute=object.instanceMatrix;if(name==='instanceColor'&&object.instanceColor)geometryAttribute=object.instanceColor;}if(geometryAttribute!==undefined){const normalized=geometryAttribute.normalized;const size=geometryAttribute.itemSize;const attribute=attributes.get(geometryAttribute);// TODO Attribute may not be available on context restore
if(attribute===undefined)continue;const buffer=attribute.buffer;const type=attribute.type;const bytesPerElement=attribute.bytesPerElement;// check for integer attributes
const integer=type===gl.INT||type===gl.UNSIGNED_INT||geometryAttribute.gpuType===IntType$1;if(geometryAttribute.isInterleavedBufferAttribute){const data=geometryAttribute.data;const stride=data.stride;const offset=geometryAttribute.offset;if(data.isInstancedInterleavedBuffer){for(let i=0;i<programAttribute.locationSize;i++){enableAttributeAndDivisor(programAttribute.location+i,data.meshPerAttribute);}if(object.isInstancedMesh!==true&&geometry._maxInstanceCount===undefined){geometry._maxInstanceCount=data.meshPerAttribute*data.count;}}else {for(let i=0;i<programAttribute.locationSize;i++){enableAttribute(programAttribute.location+i);}}gl.bindBuffer(gl.ARRAY_BUFFER,buffer);for(let i=0;i<programAttribute.locationSize;i++){vertexAttribPointer(programAttribute.location+i,size/programAttribute.locationSize,type,normalized,stride*bytesPerElement,(offset+size/programAttribute.locationSize*i)*bytesPerElement,integer);}}else {if(geometryAttribute.isInstancedBufferAttribute){for(let i=0;i<programAttribute.locationSize;i++){enableAttributeAndDivisor(programAttribute.location+i,geometryAttribute.meshPerAttribute);}if(object.isInstancedMesh!==true&&geometry._maxInstanceCount===undefined){geometry._maxInstanceCount=geometryAttribute.meshPerAttribute*geometryAttribute.count;}}else {for(let i=0;i<programAttribute.locationSize;i++){enableAttribute(programAttribute.location+i);}}gl.bindBuffer(gl.ARRAY_BUFFER,buffer);for(let i=0;i<programAttribute.locationSize;i++){vertexAttribPointer(programAttribute.location+i,size/programAttribute.locationSize,type,normalized,size*bytesPerElement,size/programAttribute.locationSize*i*bytesPerElement,integer);}}}else if(materialDefaultAttributeValues!==undefined){const value=materialDefaultAttributeValues[name];if(value!==undefined){switch(value.length){case 2:gl.vertexAttrib2fv(programAttribute.location,value);break;case 3:gl.vertexAttrib3fv(programAttribute.location,value);break;case 4:gl.vertexAttrib4fv(programAttribute.location,value);break;default:gl.vertexAttrib1fv(programAttribute.location,value);}}}}}disableUnusedAttributes();}function dispose(){reset();for(const geometryId in bindingStates){const programMap=bindingStates[geometryId];for(const programId in programMap){const stateMap=programMap[programId];for(const wireframe in stateMap){deleteVertexArrayObject(stateMap[wireframe].object);delete stateMap[wireframe];}delete programMap[programId];}delete bindingStates[geometryId];}}function releaseStatesOfGeometry(geometry){if(bindingStates[geometry.id]===undefined)return;const programMap=bindingStates[geometry.id];for(const programId in programMap){const stateMap=programMap[programId];for(const wireframe in stateMap){deleteVertexArrayObject(stateMap[wireframe].object);delete stateMap[wireframe];}delete programMap[programId];}delete bindingStates[geometry.id];}function releaseStatesOfProgram(program){for(const geometryId in bindingStates){const programMap=bindingStates[geometryId];if(programMap[program.id]===undefined)continue;const stateMap=programMap[program.id];for(const wireframe in stateMap){deleteVertexArrayObject(stateMap[wireframe].object);delete stateMap[wireframe];}delete programMap[program.id];}}function reset(){resetDefaultState();forceUpdate=true;if(currentState===defaultState)return;currentState=defaultState;bindVertexArrayObject(currentState.object);}// for backward-compatibility
function resetDefaultState(){defaultState.geometry=null;defaultState.program=null;defaultState.wireframe=false;}return {setup:setup,reset:reset,resetDefaultState:resetDefaultState,dispose:dispose,releaseStatesOfGeometry:releaseStatesOfGeometry,releaseStatesOfProgram:releaseStatesOfProgram,initAttributes:initAttributes,enableAttribute:enableAttribute,disableUnusedAttributes:disableUnusedAttributes};}function WebGLBufferRenderer(gl,extensions,info){let mode;function setMode(value){mode=value;}function render(start,count){gl.drawArrays(mode,start,count);info.update(count,mode,1);}function renderInstances(start,count,primcount){if(primcount===0)return;gl.drawArraysInstanced(mode,start,count,primcount);info.update(count,mode,primcount);}function renderMultiDraw(starts,counts,drawCount){if(drawCount===0)return;const extension=extensions.get('WEBGL_multi_draw');extension.multiDrawArraysWEBGL(mode,starts,0,counts,0,drawCount);let elementCount=0;for(let i=0;i<drawCount;i++){elementCount+=counts[i];}info.update(elementCount,mode,1);}function renderMultiDrawInstances(starts,counts,drawCount,primcount){if(drawCount===0)return;const extension=extensions.get('WEBGL_multi_draw');if(extension===null){for(let i=0;i<starts.length;i++){renderInstances(starts[i],counts[i],primcount[i]);}}else {extension.multiDrawArraysInstancedWEBGL(mode,starts,0,counts,0,primcount,0,drawCount);let elementCount=0;for(let i=0;i<drawCount;i++){elementCount+=counts[i];}for(let i=0;i<primcount.length;i++){info.update(elementCount,mode,primcount[i]);}}}//
this.setMode=setMode;this.render=render;this.renderInstances=renderInstances;this.renderMultiDraw=renderMultiDraw;this.renderMultiDrawInstances=renderMultiDrawInstances;}function WebGLCapabilities(gl,extensions,parameters,utils){let maxAnisotropy;function getMaxAnisotropy(){if(maxAnisotropy!==undefined)return maxAnisotropy;if(extensions.has('EXT_texture_filter_anisotropic')===true){const extension=extensions.get('EXT_texture_filter_anisotropic');maxAnisotropy=gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT);}else {maxAnisotropy=0;}return maxAnisotropy;}function textureFormatReadable(textureFormat){if(textureFormat!==RGBAFormat$1&&utils.convert(textureFormat)!==gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT)){return false;}return true;}function textureTypeReadable(textureType){const halfFloatSupportedByExt=textureType===HalfFloatType$1&&(extensions.has('EXT_color_buffer_half_float')||extensions.has('EXT_color_buffer_float'));if(textureType!==UnsignedByteType$1&&utils.convert(textureType)!==gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE)&&// Edge and Chrome Mac < 52 (#9513)
textureType!==FloatType$1&&!halfFloatSupportedByExt){return false;}return true;}function getMaxPrecision(precision){if(precision==='highp'){if(gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_FLOAT).precision>0&&gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_FLOAT).precision>0){return 'highp';}precision='mediump';}if(precision==='mediump'){if(gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.MEDIUM_FLOAT).precision>0&&gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.MEDIUM_FLOAT).precision>0){return 'mediump';}}return 'lowp';}let precision=parameters.precision!==undefined?parameters.precision:'highp';const maxPrecision=getMaxPrecision(precision);if(maxPrecision!==precision){console.warn('THREE.WebGLRenderer:',precision,'not supported, using',maxPrecision,'instead.');precision=maxPrecision;}const logarithmicDepthBuffer=parameters.logarithmicDepthBuffer===true;const maxTextures=gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);const maxVertexTextures=gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);const maxTextureSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);const maxCubemapSize=gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);const maxAttributes=gl.getParameter(gl.MAX_VERTEX_ATTRIBS);const maxVertexUniforms=gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);const maxVaryings=gl.getParameter(gl.MAX_VARYING_VECTORS);const maxFragmentUniforms=gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);const vertexTextures=maxVertexTextures>0;const maxSamples=gl.getParameter(gl.MAX_SAMPLES);return {isWebGL2:true,// keeping this for backwards compatibility
getMaxAnisotropy:getMaxAnisotropy,getMaxPrecision:getMaxPrecision,textureFormatReadable:textureFormatReadable,textureTypeReadable:textureTypeReadable,precision:precision,logarithmicDepthBuffer:logarithmicDepthBuffer,maxTextures:maxTextures,maxVertexTextures:maxVertexTextures,maxTextureSize:maxTextureSize,maxCubemapSize:maxCubemapSize,maxAttributes:maxAttributes,maxVertexUniforms:maxVertexUniforms,maxVaryings:maxVaryings,maxFragmentUniforms:maxFragmentUniforms,vertexTextures:vertexTextures,maxSamples:maxSamples};}function WebGLClipping(properties){const scope=this;let globalState=null,numGlobalPlanes=0,localClippingEnabled=false,renderingShadows=false;const plane=new Plane$1(),viewNormalMatrix=new Matrix3$1(),uniform={value:null,needsUpdate:false};this.uniform=uniform;this.numPlanes=0;this.numIntersection=0;this.init=function(planes,enableLocalClipping){const enabled=planes.length!==0||enableLocalClipping||// enable state of previous frame - the clipping code has to
// run another frame in order to reset the state:
numGlobalPlanes!==0||localClippingEnabled;localClippingEnabled=enableLocalClipping;numGlobalPlanes=planes.length;return enabled;};this.beginShadows=function(){renderingShadows=true;projectPlanes(null);};this.endShadows=function(){renderingShadows=false;};this.setGlobalState=function(planes,camera){globalState=projectPlanes(planes,camera,0);};this.setState=function(material,camera,useCache){const planes=material.clippingPlanes,clipIntersection=material.clipIntersection,clipShadows=material.clipShadows;const materialProperties=properties.get(material);if(!localClippingEnabled||planes===null||planes.length===0||renderingShadows&&!clipShadows){// there's no local clipping
if(renderingShadows){// there's no global clipping
projectPlanes(null);}else {resetGlobalState();}}else {const nGlobal=renderingShadows?0:numGlobalPlanes,lGlobal=nGlobal*4;let dstArray=materialProperties.clippingState||null;uniform.value=dstArray;// ensure unique state
dstArray=projectPlanes(planes,camera,lGlobal,useCache);for(let i=0;i!==lGlobal;++i){dstArray[i]=globalState[i];}materialProperties.clippingState=dstArray;this.numIntersection=clipIntersection?this.numPlanes:0;this.numPlanes+=nGlobal;}};function resetGlobalState(){if(uniform.value!==globalState){uniform.value=globalState;uniform.needsUpdate=numGlobalPlanes>0;}scope.numPlanes=numGlobalPlanes;scope.numIntersection=0;}function projectPlanes(planes,camera,dstOffset,skipTransform){const nPlanes=planes!==null?planes.length:0;let dstArray=null;if(nPlanes!==0){dstArray=uniform.value;if(skipTransform!==true||dstArray===null){const flatSize=dstOffset+nPlanes*4,viewMatrix=camera.matrixWorldInverse;viewNormalMatrix.getNormalMatrix(viewMatrix);if(dstArray===null||dstArray.length<flatSize){dstArray=new Float32Array(flatSize);}for(let i=0,i4=dstOffset;i!==nPlanes;++i,i4+=4){plane.copy(planes[i]).applyMatrix4(viewMatrix,viewNormalMatrix);plane.normal.toArray(dstArray,i4);dstArray[i4+3]=plane.constant;}}uniform.value=dstArray;uniform.needsUpdate=true;}scope.numPlanes=nPlanes;scope.numIntersection=0;return dstArray;}}function WebGLCubeMaps(renderer){let cubemaps=new WeakMap();function mapTextureMapping(texture,mapping){if(mapping===EquirectangularReflectionMapping){texture.mapping=CubeReflectionMapping$1;}else if(mapping===EquirectangularRefractionMapping){texture.mapping=CubeRefractionMapping$1;}return texture;}function get(texture){if(texture&&texture.isTexture){const mapping=texture.mapping;if(mapping===EquirectangularReflectionMapping||mapping===EquirectangularRefractionMapping){if(cubemaps.has(texture)){const cubemap=cubemaps.get(texture).texture;return mapTextureMapping(cubemap,texture.mapping);}else {const image=texture.image;if(image&&image.height>0){const renderTarget=new WebGLCubeRenderTarget(image.height);renderTarget.fromEquirectangularTexture(renderer,texture);cubemaps.set(texture,renderTarget);texture.addEventListener('dispose',onTextureDispose);return mapTextureMapping(renderTarget.texture,texture.mapping);}else {// image not yet ready. try the conversion next frame
return null;}}}}return texture;}function onTextureDispose(event){const texture=event.target;texture.removeEventListener('dispose',onTextureDispose);const cubemap=cubemaps.get(texture);if(cubemap!==undefined){cubemaps.delete(texture);cubemap.dispose();}}function dispose(){cubemaps=new WeakMap();}return {get:get,dispose:dispose};}class OrthographicCamera$1 extends Camera$1{constructor(left=-1,right=1,top=1,bottom=-1,near=0.1,far=2000){super();this.isOrthographicCamera=true;this.type='OrthographicCamera';this.zoom=1;this.view=null;this.left=left;this.right=right;this.top=top;this.bottom=bottom;this.near=near;this.far=far;this.updateProjectionMatrix();}copy(source,recursive){super.copy(source,recursive);this.left=source.left;this.right=source.right;this.top=source.top;this.bottom=source.bottom;this.near=source.near;this.far=source.far;this.zoom=source.zoom;this.view=source.view===null?null:Object.assign({},source.view);return this;}setViewOffset(fullWidth,fullHeight,x,y,width,height){if(this.view===null){this.view={enabled:true,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};}this.view.enabled=true;this.view.fullWidth=fullWidth;this.view.fullHeight=fullHeight;this.view.offsetX=x;this.view.offsetY=y;this.view.width=width;this.view.height=height;this.updateProjectionMatrix();}clearViewOffset(){if(this.view!==null){this.view.enabled=false;}this.updateProjectionMatrix();}updateProjectionMatrix(){const dx=(this.right-this.left)/(2*this.zoom);const dy=(this.top-this.bottom)/(2*this.zoom);const cx=(this.right+this.left)/2;const cy=(this.top+this.bottom)/2;let left=cx-dx;let right=cx+dx;let top=cy+dy;let bottom=cy-dy;if(this.view!==null&&this.view.enabled){const scaleW=(this.right-this.left)/this.view.fullWidth/this.zoom;const scaleH=(this.top-this.bottom)/this.view.fullHeight/this.zoom;left+=scaleW*this.view.offsetX;right=left+scaleW*this.view.width;top-=scaleH*this.view.offsetY;bottom=top-scaleH*this.view.height;}this.projectionMatrix.makeOrthographic(left,right,top,bottom,this.near,this.far,this.coordinateSystem);this.projectionMatrixInverse.copy(this.projectionMatrix).invert();}toJSON(meta){const data=super.toJSON(meta);data.object.zoom=this.zoom;data.object.left=this.left;data.object.right=this.right;data.object.top=this.top;data.object.bottom=this.bottom;data.object.near=this.near;data.object.far=this.far;if(this.view!==null)data.object.view=Object.assign({},this.view);return data;}}const LOD_MIN=4;// The standard deviations (radians) associated with the extra mips. These are
// chosen to approximate a Trowbridge-Reitz distribution function times the
// geometric shadowing function. These sigma values squared must match the
// variance #defines in cube_uv_reflection_fragment.glsl.js.
const EXTRA_LOD_SIGMA=[0.125,0.215,0.35,0.446,0.526,0.582];// The maximum length of the blur for loop. Smaller sigmas will use fewer
// samples and exit early, but not recompile the shader.
const MAX_SAMPLES=20;const _flatCamera=/*@__PURE__*/new OrthographicCamera$1();const _clearColor$1=/*@__PURE__*/new Color$1();let _oldTarget=null;let _oldActiveCubeFace=0;let _oldActiveMipmapLevel=0;let _oldXrEnabled=false;// Golden Ratio
const PHI=(1+Math.sqrt(5))/2;const INV_PHI=1/PHI;// Vertices of a dodecahedron (except the opposites, which represent the
// same axis), used as axis directions evenly spread on a sphere.
const _axisDirections=[/*@__PURE__*/new Vector3$1(-PHI,INV_PHI,0),/*@__PURE__*/new Vector3$1(PHI,INV_PHI,0),/*@__PURE__*/new Vector3$1(-INV_PHI,0,PHI),/*@__PURE__*/new Vector3$1(INV_PHI,0,PHI),/*@__PURE__*/new Vector3$1(0,PHI,-INV_PHI),/*@__PURE__*/new Vector3$1(0,PHI,INV_PHI),/*@__PURE__*/new Vector3$1(-1,1,-1),/*@__PURE__*/new Vector3$1(1,1,-1),/*@__PURE__*/new Vector3$1(-1,1,1),/*@__PURE__*/new Vector3$1(1,1,1)];/**
 * This class generates a Prefiltered, Mipmapped Radiance Environment Map
 * (PMREM) from a cubeMap environment texture. This allows different levels of
 * blur to be quickly accessed based on material roughness. It is packed into a
 * special CubeUV format that allows us to perform custom interpolation so that
 * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap
 * chain, it only goes down to the LOD_MIN level (above), and then creates extra
 * even more filtered 'mips' at the same LOD_MIN resolution, associated with
 * higher roughness levels. In this way we maintain resolution to smoothly
 * interpolate diffuse lighting while limiting sampling computation.
 *
 * Paper: Fast, Accurate Image-Based Lighting
 * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view
*/class PMREMGenerator{constructor(renderer){this._renderer=renderer;this._pingPongRenderTarget=null;this._lodMax=0;this._cubeSize=0;this._lodPlanes=[];this._sizeLods=[];this._sigmas=[];this._blurMaterial=null;this._cubemapMaterial=null;this._equirectMaterial=null;this._compileMaterial(this._blurMaterial);}/**
	 * Generates a PMREM from a supplied Scene, which can be faster than using an
	 * image if networking bandwidth is low. Optional sigma specifies a blur radius
	 * in radians to be applied to the scene before PMREM generation. Optional near
	 * and far planes ensure the scene is rendered in its entirety (the cubeCamera
	 * is placed at the origin).
	 */fromScene(scene,sigma=0,near=0.1,far=100){_oldTarget=this._renderer.getRenderTarget();_oldActiveCubeFace=this._renderer.getActiveCubeFace();_oldActiveMipmapLevel=this._renderer.getActiveMipmapLevel();_oldXrEnabled=this._renderer.xr.enabled;this._renderer.xr.enabled=false;this._setSize(256);const cubeUVRenderTarget=this._allocateTargets();cubeUVRenderTarget.depthBuffer=true;this._sceneToCubeUV(scene,near,far,cubeUVRenderTarget);if(sigma>0){this._blur(cubeUVRenderTarget,0,0,sigma);}this._applyPMREM(cubeUVRenderTarget);this._cleanup(cubeUVRenderTarget);return cubeUVRenderTarget;}/**
	 * Generates a PMREM from an equirectangular texture, which can be either LDR
	 * or HDR. The ideal input image size is 1k (1024 x 512),
	 * as this matches best with the 256 x 256 cubemap output.
	 * The smallest supported equirectangular image size is 64 x 32.
	 */fromEquirectangular(equirectangular,renderTarget=null){return this._fromTexture(equirectangular,renderTarget);}/**
	 * Generates a PMREM from an cubemap texture, which can be either LDR
	 * or HDR. The ideal input cube size is 256 x 256,
	 * as this matches best with the 256 x 256 cubemap output.
	 * The smallest supported cube size is 16 x 16.
	 */fromCubemap(cubemap,renderTarget=null){return this._fromTexture(cubemap,renderTarget);}/**
	 * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during
	 * your texture's network fetch for increased concurrency.
	 */compileCubemapShader(){if(this._cubemapMaterial===null){this._cubemapMaterial=_getCubemapMaterial();this._compileMaterial(this._cubemapMaterial);}}/**
	 * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during
	 * your texture's network fetch for increased concurrency.
	 */compileEquirectangularShader(){if(this._equirectMaterial===null){this._equirectMaterial=_getEquirectMaterial();this._compileMaterial(this._equirectMaterial);}}/**
	 * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,
	 * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on
	 * one of them will cause any others to also become unusable.
	 */dispose(){this._dispose();if(this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();}// private interface
_setSize(cubeSize){this._lodMax=Math.floor(Math.log2(cubeSize));this._cubeSize=Math.pow(2,this._lodMax);}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let i=0;i<this._lodPlanes.length;i++){this._lodPlanes[i].dispose();}}_cleanup(outputTarget){this._renderer.setRenderTarget(_oldTarget,_oldActiveCubeFace,_oldActiveMipmapLevel);this._renderer.xr.enabled=_oldXrEnabled;outputTarget.scissorTest=false;_setViewport(outputTarget,0,0,outputTarget.width,outputTarget.height);}_fromTexture(texture,renderTarget){if(texture.mapping===CubeReflectionMapping$1||texture.mapping===CubeRefractionMapping$1){this._setSize(texture.image.length===0?16:texture.image[0].width||texture.image[0].image.width);}else {// Equirectangular
this._setSize(texture.image.width/4);}_oldTarget=this._renderer.getRenderTarget();_oldActiveCubeFace=this._renderer.getActiveCubeFace();_oldActiveMipmapLevel=this._renderer.getActiveMipmapLevel();_oldXrEnabled=this._renderer.xr.enabled;this._renderer.xr.enabled=false;const cubeUVRenderTarget=renderTarget||this._allocateTargets();this._textureToCubeUV(texture,cubeUVRenderTarget);this._applyPMREM(cubeUVRenderTarget);this._cleanup(cubeUVRenderTarget);return cubeUVRenderTarget;}_allocateTargets(){const width=3*Math.max(this._cubeSize,16*7);const height=4*this._cubeSize;const params={magFilter:LinearFilter$1,minFilter:LinearFilter$1,generateMipmaps:false,type:HalfFloatType$1,format:RGBAFormat$1,colorSpace:LinearSRGBColorSpace$1,depthBuffer:false};const cubeUVRenderTarget=_createRenderTarget(width,height,params);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==width||this._pingPongRenderTarget.height!==height){if(this._pingPongRenderTarget!==null){this._dispose();}this._pingPongRenderTarget=_createRenderTarget(width,height,params);const{_lodMax}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=_createPlanes(_lodMax));this._blurMaterial=_getBlurShader(_lodMax,width,height);}return cubeUVRenderTarget;}_compileMaterial(material){const tmpMesh=new Mesh$1(this._lodPlanes[0],material);this._renderer.compile(tmpMesh,_flatCamera);}_sceneToCubeUV(scene,near,far,cubeUVRenderTarget){const fov=90;const aspect=1;const cubeCamera=new PerspectiveCamera$1(fov,aspect,near,far);const upSign=[1,-1,1,1,1,1];const forwardSign=[1,1,1,-1,-1,-1];const renderer=this._renderer;const originalAutoClear=renderer.autoClear;const toneMapping=renderer.toneMapping;renderer.getClearColor(_clearColor$1);renderer.toneMapping=NoToneMapping$1;renderer.autoClear=false;const backgroundMaterial=new MeshBasicMaterial$1({name:'PMREM.Background',side:BackSide$1,depthWrite:false,depthTest:false});const backgroundBox=new Mesh$1(new BoxGeometry(),backgroundMaterial);let useSolidColor=false;const background=scene.background;if(background){if(background.isColor){backgroundMaterial.color.copy(background);scene.background=null;useSolidColor=true;}}else {backgroundMaterial.color.copy(_clearColor$1);useSolidColor=true;}for(let i=0;i<6;i++){const col=i%3;if(col===0){cubeCamera.up.set(0,upSign[i],0);cubeCamera.lookAt(forwardSign[i],0,0);}else if(col===1){cubeCamera.up.set(0,0,upSign[i]);cubeCamera.lookAt(0,forwardSign[i],0);}else {cubeCamera.up.set(0,upSign[i],0);cubeCamera.lookAt(0,0,forwardSign[i]);}const size=this._cubeSize;_setViewport(cubeUVRenderTarget,col*size,i>2?size:0,size,size);renderer.setRenderTarget(cubeUVRenderTarget);if(useSolidColor){renderer.render(backgroundBox,cubeCamera);}renderer.render(scene,cubeCamera);}backgroundBox.geometry.dispose();backgroundBox.material.dispose();renderer.toneMapping=toneMapping;renderer.autoClear=originalAutoClear;scene.background=background;}_textureToCubeUV(texture,cubeUVRenderTarget){const renderer=this._renderer;const isCubeTexture=texture.mapping===CubeReflectionMapping$1||texture.mapping===CubeRefractionMapping$1;if(isCubeTexture){if(this._cubemapMaterial===null){this._cubemapMaterial=_getCubemapMaterial();}this._cubemapMaterial.uniforms.flipEnvMap.value=texture.isRenderTargetTexture===false?-1:1;}else {if(this._equirectMaterial===null){this._equirectMaterial=_getEquirectMaterial();}}const material=isCubeTexture?this._cubemapMaterial:this._equirectMaterial;const mesh=new Mesh$1(this._lodPlanes[0],material);const uniforms=material.uniforms;uniforms['envMap'].value=texture;const size=this._cubeSize;_setViewport(cubeUVRenderTarget,0,0,3*size,2*size);renderer.setRenderTarget(cubeUVRenderTarget);renderer.render(mesh,_flatCamera);}_applyPMREM(cubeUVRenderTarget){const renderer=this._renderer;const autoClear=renderer.autoClear;renderer.autoClear=false;const n=this._lodPlanes.length;for(let i=1;i<n;i++){const sigma=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]);const poleAxis=_axisDirections[(n-i-1)%_axisDirections.length];this._blur(cubeUVRenderTarget,i-1,i,sigma,poleAxis);}renderer.autoClear=autoClear;}/**
	 * This is a two-pass Gaussian blur for a cubemap. Normally this is done
	 * vertically and horizontally, but this breaks down on a cube. Here we apply
	 * the blur latitudinally (around the poles), and then longitudinally (towards
	 * the poles) to approximate the orthogonally-separable blur. It is least
	 * accurate at the poles, but still does a decent job.
	 */_blur(cubeUVRenderTarget,lodIn,lodOut,sigma,poleAxis){const pingPongRenderTarget=this._pingPongRenderTarget;this._halfBlur(cubeUVRenderTarget,pingPongRenderTarget,lodIn,lodOut,sigma,'latitudinal',poleAxis);this._halfBlur(pingPongRenderTarget,cubeUVRenderTarget,lodOut,lodOut,sigma,'longitudinal',poleAxis);}_halfBlur(targetIn,targetOut,lodIn,lodOut,sigmaRadians,direction,poleAxis){const renderer=this._renderer;const blurMaterial=this._blurMaterial;if(direction!=='latitudinal'&&direction!=='longitudinal'){console.error('blur direction must be either latitudinal or longitudinal!');}// Number of standard deviations at which to cut off the discrete approximation.
const STANDARD_DEVIATIONS=3;const blurMesh=new Mesh$1(this._lodPlanes[lodOut],blurMaterial);const blurUniforms=blurMaterial.uniforms;const pixels=this._sizeLods[lodIn]-1;const radiansPerPixel=isFinite(sigmaRadians)?Math.PI/(2*pixels):2*Math.PI/(2*MAX_SAMPLES-1);const sigmaPixels=sigmaRadians/radiansPerPixel;const samples=isFinite(sigmaRadians)?1+Math.floor(STANDARD_DEVIATIONS*sigmaPixels):MAX_SAMPLES;if(samples>MAX_SAMPLES){console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${MAX_SAMPLES}`);}const weights=[];let sum=0;for(let i=0;i<MAX_SAMPLES;++i){const x=i/sigmaPixels;const weight=Math.exp(-x*x/2);weights.push(weight);if(i===0){sum+=weight;}else if(i<samples){sum+=2*weight;}}for(let i=0;i<weights.length;i++){weights[i]=weights[i]/sum;}blurUniforms['envMap'].value=targetIn.texture;blurUniforms['samples'].value=samples;blurUniforms['weights'].value=weights;blurUniforms['latitudinal'].value=direction==='latitudinal';if(poleAxis){blurUniforms['poleAxis'].value=poleAxis;}const{_lodMax}=this;blurUniforms['dTheta'].value=radiansPerPixel;blurUniforms['mipInt'].value=_lodMax-lodIn;const outputSize=this._sizeLods[lodOut];const x=3*outputSize*(lodOut>_lodMax-LOD_MIN?lodOut-_lodMax+LOD_MIN:0);const y=4*(this._cubeSize-outputSize);_setViewport(targetOut,x,y,3*outputSize,2*outputSize);renderer.setRenderTarget(targetOut);renderer.render(blurMesh,_flatCamera);}}function _createPlanes(lodMax){const lodPlanes=[];const sizeLods=[];const sigmas=[];let lod=lodMax;const totalLods=lodMax-LOD_MIN+1+EXTRA_LOD_SIGMA.length;for(let i=0;i<totalLods;i++){const sizeLod=Math.pow(2,lod);sizeLods.push(sizeLod);let sigma=1.0/sizeLod;if(i>lodMax-LOD_MIN){sigma=EXTRA_LOD_SIGMA[i-lodMax+LOD_MIN-1];}else if(i===0){sigma=0;}sigmas.push(sigma);const texelSize=1.0/(sizeLod-2);const min=-texelSize;const max=1+texelSize;const uv1=[min,min,max,min,max,max,min,min,max,max,min,max];const cubeFaces=6;const vertices=6;const positionSize=3;const uvSize=2;const faceIndexSize=1;const position=new Float32Array(positionSize*vertices*cubeFaces);const uv=new Float32Array(uvSize*vertices*cubeFaces);const faceIndex=new Float32Array(faceIndexSize*vertices*cubeFaces);for(let face=0;face<cubeFaces;face++){const x=face%3*2/3-1;const y=face>2?0:-1;const coordinates=[x,y,0,x+2/3,y,0,x+2/3,y+1,0,x,y,0,x+2/3,y+1,0,x,y+1,0];position.set(coordinates,positionSize*vertices*face);uv.set(uv1,uvSize*vertices*face);const fill=[face,face,face,face,face,face];faceIndex.set(fill,faceIndexSize*vertices*face);}const planes=new BufferGeometry$1();planes.setAttribute('position',new BufferAttribute$1(position,positionSize));planes.setAttribute('uv',new BufferAttribute$1(uv,uvSize));planes.setAttribute('faceIndex',new BufferAttribute$1(faceIndex,faceIndexSize));lodPlanes.push(planes);if(lod>LOD_MIN){lod--;}}return {lodPlanes,sizeLods,sigmas};}function _createRenderTarget(width,height,params){const cubeUVRenderTarget=new WebGLRenderTarget(width,height,params);cubeUVRenderTarget.texture.mapping=CubeUVReflectionMapping;cubeUVRenderTarget.texture.name='PMREM.cubeUv';cubeUVRenderTarget.scissorTest=true;return cubeUVRenderTarget;}function _setViewport(target,x,y,width,height){target.viewport.set(x,y,width,height);target.scissor.set(x,y,width,height);}function _getBlurShader(lodMax,width,height){const weights=new Float32Array(MAX_SAMPLES);const poleAxis=new Vector3$1(0,1,0);const shaderMaterial=new ShaderMaterial({name:'SphericalGaussianBlur',defines:{'n':MAX_SAMPLES,'CUBEUV_TEXEL_WIDTH':1.0/width,'CUBEUV_TEXEL_HEIGHT':1.0/height,'CUBEUV_MAX_MIP':`${lodMax}.0`},uniforms:{'envMap':{value:null},'samples':{value:1},'weights':{value:weights},'latitudinal':{value:false},'dTheta':{value:0},'mipInt':{value:0},'poleAxis':{value:poleAxis}},vertexShader:_getCommonVertexShader(),fragmentShader:/* glsl */`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:NoBlending,depthTest:false,depthWrite:false});return shaderMaterial;}function _getEquirectMaterial(){return new ShaderMaterial({name:'EquirectangularToCubeUV',uniforms:{'envMap':{value:null}},vertexShader:_getCommonVertexShader(),fragmentShader:/* glsl */`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:NoBlending,depthTest:false,depthWrite:false});}function _getCubemapMaterial(){return new ShaderMaterial({name:'CubemapToCubeUV',uniforms:{'envMap':{value:null},'flipEnvMap':{value:-1}},vertexShader:_getCommonVertexShader(),fragmentShader:/* glsl */`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:NoBlending,depthTest:false,depthWrite:false});}function _getCommonVertexShader(){return/* glsl */`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`;}function WebGLCubeUVMaps(renderer){let cubeUVmaps=new WeakMap();let pmremGenerator=null;function get(texture){if(texture&&texture.isTexture){const mapping=texture.mapping;const isEquirectMap=mapping===EquirectangularReflectionMapping||mapping===EquirectangularRefractionMapping;const isCubeMap=mapping===CubeReflectionMapping$1||mapping===CubeRefractionMapping$1;// equirect/cube map to cubeUV conversion
if(isEquirectMap||isCubeMap){let renderTarget=cubeUVmaps.get(texture);const currentPMREMVersion=renderTarget!==undefined?renderTarget.texture.pmremVersion:0;if(texture.isRenderTargetTexture&&texture.pmremVersion!==currentPMREMVersion){if(pmremGenerator===null)pmremGenerator=new PMREMGenerator(renderer);renderTarget=isEquirectMap?pmremGenerator.fromEquirectangular(texture,renderTarget):pmremGenerator.fromCubemap(texture,renderTarget);renderTarget.texture.pmremVersion=texture.pmremVersion;cubeUVmaps.set(texture,renderTarget);return renderTarget.texture;}else {if(renderTarget!==undefined){return renderTarget.texture;}else {const image=texture.image;if(isEquirectMap&&image&&image.height>0||isCubeMap&&image&&isCubeTextureComplete(image)){if(pmremGenerator===null)pmremGenerator=new PMREMGenerator(renderer);renderTarget=isEquirectMap?pmremGenerator.fromEquirectangular(texture):pmremGenerator.fromCubemap(texture);renderTarget.texture.pmremVersion=texture.pmremVersion;cubeUVmaps.set(texture,renderTarget);texture.addEventListener('dispose',onTextureDispose);return renderTarget.texture;}else {// image not yet ready. try the conversion next frame
return null;}}}}}return texture;}function isCubeTextureComplete(image){let count=0;const length=6;for(let i=0;i<length;i++){if(image[i]!==undefined)count++;}return count===length;}function onTextureDispose(event){const texture=event.target;texture.removeEventListener('dispose',onTextureDispose);const cubemapUV=cubeUVmaps.get(texture);if(cubemapUV!==undefined){cubeUVmaps.delete(texture);cubemapUV.dispose();}}function dispose(){cubeUVmaps=new WeakMap();if(pmremGenerator!==null){pmremGenerator.dispose();pmremGenerator=null;}}return {get:get,dispose:dispose};}function WebGLExtensions(gl){const extensions={};function getExtension(name){if(extensions[name]!==undefined){return extensions[name];}let extension;switch(name){case'WEBGL_depth_texture':extension=gl.getExtension('WEBGL_depth_texture')||gl.getExtension('MOZ_WEBGL_depth_texture')||gl.getExtension('WEBKIT_WEBGL_depth_texture');break;case'EXT_texture_filter_anisotropic':extension=gl.getExtension('EXT_texture_filter_anisotropic')||gl.getExtension('MOZ_EXT_texture_filter_anisotropic')||gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic');break;case'WEBGL_compressed_texture_s3tc':extension=gl.getExtension('WEBGL_compressed_texture_s3tc')||gl.getExtension('MOZ_WEBGL_compressed_texture_s3tc')||gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc');break;case'WEBGL_compressed_texture_pvrtc':extension=gl.getExtension('WEBGL_compressed_texture_pvrtc')||gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');break;default:extension=gl.getExtension(name);}extensions[name]=extension;return extension;}return {has:function(name){return getExtension(name)!==null;},init:function(){getExtension('EXT_color_buffer_float');getExtension('WEBGL_clip_cull_distance');getExtension('OES_texture_float_linear');getExtension('EXT_color_buffer_half_float');getExtension('WEBGL_multisampled_render_to_texture');getExtension('WEBGL_render_shared_exponent');},get:function(name){const extension=getExtension(name);if(extension===null){warnOnce$1('THREE.WebGLRenderer: '+name+' extension not supported.');}return extension;}};}function WebGLGeometries(gl,attributes,info,bindingStates){const geometries={};const wireframeAttributes=new WeakMap();function onGeometryDispose(event){const geometry=event.target;if(geometry.index!==null){attributes.remove(geometry.index);}for(const name in geometry.attributes){attributes.remove(geometry.attributes[name]);}for(const name in geometry.morphAttributes){const array=geometry.morphAttributes[name];for(let i=0,l=array.length;i<l;i++){attributes.remove(array[i]);}}geometry.removeEventListener('dispose',onGeometryDispose);delete geometries[geometry.id];const attribute=wireframeAttributes.get(geometry);if(attribute){attributes.remove(attribute);wireframeAttributes.delete(geometry);}bindingStates.releaseStatesOfGeometry(geometry);if(geometry.isInstancedBufferGeometry===true){delete geometry._maxInstanceCount;}//
info.memory.geometries--;}function get(object,geometry){if(geometries[geometry.id]===true)return geometry;geometry.addEventListener('dispose',onGeometryDispose);geometries[geometry.id]=true;info.memory.geometries++;return geometry;}function update(geometry){const geometryAttributes=geometry.attributes;// Updating index buffer in VAO now. See WebGLBindingStates.
for(const name in geometryAttributes){attributes.update(geometryAttributes[name],gl.ARRAY_BUFFER);}// morph targets
const morphAttributes=geometry.morphAttributes;for(const name in morphAttributes){const array=morphAttributes[name];for(let i=0,l=array.length;i<l;i++){attributes.update(array[i],gl.ARRAY_BUFFER);}}}function updateWireframeAttribute(geometry){const indices=[];const geometryIndex=geometry.index;const geometryPosition=geometry.attributes.position;let version=0;if(geometryIndex!==null){const array=geometryIndex.array;version=geometryIndex.version;for(let i=0,l=array.length;i<l;i+=3){const a=array[i+0];const b=array[i+1];const c=array[i+2];indices.push(a,b,b,c,c,a);}}else if(geometryPosition!==undefined){const array=geometryPosition.array;version=geometryPosition.version;for(let i=0,l=array.length/3-1;i<l;i+=3){const a=i+0;const b=i+1;const c=i+2;indices.push(a,b,b,c,c,a);}}else {return;}const attribute=new(arrayNeedsUint32$1(indices)?Uint32BufferAttribute$1:Uint16BufferAttribute$1)(indices,1);attribute.version=version;// Updating index buffer in VAO now. See WebGLBindingStates
//
const previousAttribute=wireframeAttributes.get(geometry);if(previousAttribute)attributes.remove(previousAttribute);//
wireframeAttributes.set(geometry,attribute);}function getWireframeAttribute(geometry){const currentAttribute=wireframeAttributes.get(geometry);if(currentAttribute){const geometryIndex=geometry.index;if(geometryIndex!==null){// if the attribute is obsolete, create a new one
if(currentAttribute.version<geometryIndex.version){updateWireframeAttribute(geometry);}}}else {updateWireframeAttribute(geometry);}return wireframeAttributes.get(geometry);}return {get:get,update:update,getWireframeAttribute:getWireframeAttribute};}function WebGLIndexedBufferRenderer(gl,extensions,info){let mode;function setMode(value){mode=value;}let type,bytesPerElement;function setIndex(value){type=value.type;bytesPerElement=value.bytesPerElement;}function render(start,count){gl.drawElements(mode,count,type,start*bytesPerElement);info.update(count,mode,1);}function renderInstances(start,count,primcount){if(primcount===0)return;gl.drawElementsInstanced(mode,count,type,start*bytesPerElement,primcount);info.update(count,mode,primcount);}function renderMultiDraw(starts,counts,drawCount){if(drawCount===0)return;const extension=extensions.get('WEBGL_multi_draw');extension.multiDrawElementsWEBGL(mode,counts,0,type,starts,0,drawCount);let elementCount=0;for(let i=0;i<drawCount;i++){elementCount+=counts[i];}info.update(elementCount,mode,1);}function renderMultiDrawInstances(starts,counts,drawCount,primcount){if(drawCount===0)return;const extension=extensions.get('WEBGL_multi_draw');if(extension===null){for(let i=0;i<starts.length;i++){renderInstances(starts[i]/bytesPerElement,counts[i],primcount[i]);}}else {extension.multiDrawElementsInstancedWEBGL(mode,counts,0,type,starts,0,primcount,0,drawCount);let elementCount=0;for(let i=0;i<drawCount;i++){elementCount+=counts[i];}for(let i=0;i<primcount.length;i++){info.update(elementCount,mode,primcount[i]);}}}//
this.setMode=setMode;this.setIndex=setIndex;this.render=render;this.renderInstances=renderInstances;this.renderMultiDraw=renderMultiDraw;this.renderMultiDrawInstances=renderMultiDrawInstances;}function WebGLInfo(gl){const memory={geometries:0,textures:0};const render={frame:0,calls:0,triangles:0,points:0,lines:0};function update(count,mode,instanceCount){render.calls++;switch(mode){case gl.TRIANGLES:render.triangles+=instanceCount*(count/3);break;case gl.LINES:render.lines+=instanceCount*(count/2);break;case gl.LINE_STRIP:render.lines+=instanceCount*(count-1);break;case gl.LINE_LOOP:render.lines+=instanceCount*count;break;case gl.POINTS:render.points+=instanceCount*count;break;default:console.error('THREE.WebGLInfo: Unknown draw mode:',mode);break;}}function reset(){render.calls=0;render.triangles=0;render.points=0;render.lines=0;}return {memory:memory,render:render,programs:null,autoReset:true,reset:reset,update:update};}function WebGLMorphtargets(gl,capabilities,textures){const morphTextures=new WeakMap();const morph=new Vector4$1();function update(object,geometry,program){const objectInfluences=object.morphTargetInfluences;// the following encodes morph targets into an array of data textures. Each layer represents a single morph target.
const morphAttribute=geometry.morphAttributes.position||geometry.morphAttributes.normal||geometry.morphAttributes.color;const morphTargetsCount=morphAttribute!==undefined?morphAttribute.length:0;let entry=morphTextures.get(geometry);if(entry===undefined||entry.count!==morphTargetsCount){if(entry!==undefined)entry.texture.dispose();const hasMorphPosition=geometry.morphAttributes.position!==undefined;const hasMorphNormals=geometry.morphAttributes.normal!==undefined;const hasMorphColors=geometry.morphAttributes.color!==undefined;const morphTargets=geometry.morphAttributes.position||[];const morphNormals=geometry.morphAttributes.normal||[];const morphColors=geometry.morphAttributes.color||[];let vertexDataCount=0;if(hasMorphPosition===true)vertexDataCount=1;if(hasMorphNormals===true)vertexDataCount=2;if(hasMorphColors===true)vertexDataCount=3;let width=geometry.attributes.position.count*vertexDataCount;let height=1;if(width>capabilities.maxTextureSize){height=Math.ceil(width/capabilities.maxTextureSize);width=capabilities.maxTextureSize;}const buffer=new Float32Array(width*height*4*morphTargetsCount);const texture=new DataArrayTexture$1(buffer,width,height,morphTargetsCount);texture.type=FloatType$1;texture.needsUpdate=true;// fill buffer
const vertexDataStride=vertexDataCount*4;for(let i=0;i<morphTargetsCount;i++){const morphTarget=morphTargets[i];const morphNormal=morphNormals[i];const morphColor=morphColors[i];const offset=width*height*4*i;for(let j=0;j<morphTarget.count;j++){const stride=j*vertexDataStride;if(hasMorphPosition===true){morph.fromBufferAttribute(morphTarget,j);buffer[offset+stride+0]=morph.x;buffer[offset+stride+1]=morph.y;buffer[offset+stride+2]=morph.z;buffer[offset+stride+3]=0;}if(hasMorphNormals===true){morph.fromBufferAttribute(morphNormal,j);buffer[offset+stride+4]=morph.x;buffer[offset+stride+5]=morph.y;buffer[offset+stride+6]=morph.z;buffer[offset+stride+7]=0;}if(hasMorphColors===true){morph.fromBufferAttribute(morphColor,j);buffer[offset+stride+8]=morph.x;buffer[offset+stride+9]=morph.y;buffer[offset+stride+10]=morph.z;buffer[offset+stride+11]=morphColor.itemSize===4?morph.w:1;}}}entry={count:morphTargetsCount,texture:texture,size:new Vector2$1(width,height)};morphTextures.set(geometry,entry);function disposeTexture(){texture.dispose();morphTextures.delete(geometry);geometry.removeEventListener('dispose',disposeTexture);}geometry.addEventListener('dispose',disposeTexture);}//
if(object.isInstancedMesh===true&&object.morphTexture!==null){program.getUniforms().setValue(gl,'morphTexture',object.morphTexture,textures);}else {let morphInfluencesSum=0;for(let i=0;i<objectInfluences.length;i++){morphInfluencesSum+=objectInfluences[i];}const morphBaseInfluence=geometry.morphTargetsRelative?1:1-morphInfluencesSum;program.getUniforms().setValue(gl,'morphTargetBaseInfluence',morphBaseInfluence);program.getUniforms().setValue(gl,'morphTargetInfluences',objectInfluences);}program.getUniforms().setValue(gl,'morphTargetsTexture',entry.texture,textures);program.getUniforms().setValue(gl,'morphTargetsTextureSize',entry.size);}return {update:update};}function WebGLObjects(gl,geometries,attributes,info){let updateMap=new WeakMap();function update(object){const frame=info.render.frame;const geometry=object.geometry;const buffergeometry=geometries.get(object,geometry);// Update once per frame
if(updateMap.get(buffergeometry)!==frame){geometries.update(buffergeometry);updateMap.set(buffergeometry,frame);}if(object.isInstancedMesh){if(object.hasEventListener('dispose',onInstancedMeshDispose)===false){object.addEventListener('dispose',onInstancedMeshDispose);}if(updateMap.get(object)!==frame){attributes.update(object.instanceMatrix,gl.ARRAY_BUFFER);if(object.instanceColor!==null){attributes.update(object.instanceColor,gl.ARRAY_BUFFER);}updateMap.set(object,frame);}}if(object.isSkinnedMesh){const skeleton=object.skeleton;if(updateMap.get(skeleton)!==frame){skeleton.update();updateMap.set(skeleton,frame);}}return buffergeometry;}function dispose(){updateMap=new WeakMap();}function onInstancedMeshDispose(event){const instancedMesh=event.target;instancedMesh.removeEventListener('dispose',onInstancedMeshDispose);attributes.remove(instancedMesh.instanceMatrix);if(instancedMesh.instanceColor!==null)attributes.remove(instancedMesh.instanceColor);}return {update:update,dispose:dispose};}class DepthTexture$1 extends Texture$1{constructor(width,height,type,mapping,wrapS,wrapT,magFilter,minFilter,anisotropy,format=DepthFormat$1){if(format!==DepthFormat$1&&format!==DepthStencilFormat$1){throw new Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');}if(type===undefined&&format===DepthFormat$1)type=UnsignedIntType$1;if(type===undefined&&format===DepthStencilFormat$1)type=UnsignedInt248Type$1;super(null,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy);this.isDepthTexture=true;this.image={width:width,height:height};this.magFilter=magFilter!==undefined?magFilter:NearestFilter$1;this.minFilter=minFilter!==undefined?minFilter:NearestFilter$1;this.flipY=false;this.generateMipmaps=false;this.compareFunction=null;}copy(source){super.copy(source);this.compareFunction=source.compareFunction;return this;}toJSON(meta){const data=super.toJSON(meta);if(this.compareFunction!==null)data.compareFunction=this.compareFunction;return data;}}/**
 * Uniforms of a program.
 * Those form a tree structure with a special top-level container for the root,
 * which you get by calling 'new WebGLUniforms( gl, program )'.
 *
 *
 * Properties of inner nodes including the top-level container:
 *
 * .seq - array of nested uniforms
 * .map - nested uniforms by name
 *
 *
 * Methods of all nodes except the top-level container:
 *
 * .setValue( gl, value, [textures] )
 *
 * 		uploads a uniform value(s)
 *  	the 'textures' parameter is needed for sampler uniforms
 *
 *
 * Static methods of the top-level container (textures factorizations):
 *
 * .upload( gl, seq, values, textures )
 *
 * 		sets uniforms in 'seq' to 'values[id].value'
 *
 * .seqWithValue( seq, values ) : filteredSeq
 *
 * 		filters 'seq' entries with corresponding entry in values
 *
 *
 * Methods of the top-level container (textures factorizations):
 *
 * .setValue( gl, name, value, textures )
 *
 * 		sets uniform with  name 'name' to 'value'
 *
 * .setOptional( gl, obj, prop )
 *
 * 		like .set for an optional property of the object
 *
 */const emptyTexture=/*@__PURE__*/new Texture$1();const emptyShadowTexture=/*@__PURE__*/new DepthTexture$1(1,1);const emptyArrayTexture=/*@__PURE__*/new DataArrayTexture$1();const empty3dTexture=/*@__PURE__*/new Data3DTexture();const emptyCubeTexture=/*@__PURE__*/new CubeTexture();// --- Utilities ---
// Array Caches (provide typed arrays for temporary by size)
const arrayCacheF32=[];const arrayCacheI32=[];// Float32Array caches used for uploading Matrix uniforms
const mat4array=new Float32Array(16);const mat3array=new Float32Array(9);const mat2array=new Float32Array(4);// Flattening for arrays of vectors and matrices
function flatten(array,nBlocks,blockSize){const firstElem=array[0];if(firstElem<=0||firstElem>0)return array;// unoptimized: ! isNaN( firstElem )
// see http://jacksondunstan.com/articles/983
const n=nBlocks*blockSize;let r=arrayCacheF32[n];if(r===undefined){r=new Float32Array(n);arrayCacheF32[n]=r;}if(nBlocks!==0){firstElem.toArray(r,0);for(let i=1,offset=0;i!==nBlocks;++i){offset+=blockSize;array[i].toArray(r,offset);}}return r;}function arraysEqual(a,b){if(a.length!==b.length)return false;for(let i=0,l=a.length;i<l;i++){if(a[i]!==b[i])return false;}return true;}function copyArray(a,b){for(let i=0,l=b.length;i<l;i++){a[i]=b[i];}}// Texture unit allocation
function allocTexUnits(textures,n){let r=arrayCacheI32[n];if(r===undefined){r=new Int32Array(n);arrayCacheI32[n]=r;}for(let i=0;i!==n;++i){r[i]=textures.allocateTextureUnit();}return r;}// --- Setters ---
// Note: Defining these methods externally, because they come in a bunch
// and this way their names minify.
// Single scalar
function setValueV1f(gl,v){const cache=this.cache;if(cache[0]===v)return;gl.uniform1f(this.addr,v);cache[0]=v;}// Single float vector (from flat array or THREE.VectorN)
function setValueV2f(gl,v){const cache=this.cache;if(v.x!==undefined){if(cache[0]!==v.x||cache[1]!==v.y){gl.uniform2f(this.addr,v.x,v.y);cache[0]=v.x;cache[1]=v.y;}}else {if(arraysEqual(cache,v))return;gl.uniform2fv(this.addr,v);copyArray(cache,v);}}function setValueV3f(gl,v){const cache=this.cache;if(v.x!==undefined){if(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z){gl.uniform3f(this.addr,v.x,v.y,v.z);cache[0]=v.x;cache[1]=v.y;cache[2]=v.z;}}else if(v.r!==undefined){if(cache[0]!==v.r||cache[1]!==v.g||cache[2]!==v.b){gl.uniform3f(this.addr,v.r,v.g,v.b);cache[0]=v.r;cache[1]=v.g;cache[2]=v.b;}}else {if(arraysEqual(cache,v))return;gl.uniform3fv(this.addr,v);copyArray(cache,v);}}function setValueV4f(gl,v){const cache=this.cache;if(v.x!==undefined){if(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z||cache[3]!==v.w){gl.uniform4f(this.addr,v.x,v.y,v.z,v.w);cache[0]=v.x;cache[1]=v.y;cache[2]=v.z;cache[3]=v.w;}}else {if(arraysEqual(cache,v))return;gl.uniform4fv(this.addr,v);copyArray(cache,v);}}// Single matrix (from flat array or THREE.MatrixN)
function setValueM2(gl,v){const cache=this.cache;const elements=v.elements;if(elements===undefined){if(arraysEqual(cache,v))return;gl.uniformMatrix2fv(this.addr,false,v);copyArray(cache,v);}else {if(arraysEqual(cache,elements))return;mat2array.set(elements);gl.uniformMatrix2fv(this.addr,false,mat2array);copyArray(cache,elements);}}function setValueM3(gl,v){const cache=this.cache;const elements=v.elements;if(elements===undefined){if(arraysEqual(cache,v))return;gl.uniformMatrix3fv(this.addr,false,v);copyArray(cache,v);}else {if(arraysEqual(cache,elements))return;mat3array.set(elements);gl.uniformMatrix3fv(this.addr,false,mat3array);copyArray(cache,elements);}}function setValueM4(gl,v){const cache=this.cache;const elements=v.elements;if(elements===undefined){if(arraysEqual(cache,v))return;gl.uniformMatrix4fv(this.addr,false,v);copyArray(cache,v);}else {if(arraysEqual(cache,elements))return;mat4array.set(elements);gl.uniformMatrix4fv(this.addr,false,mat4array);copyArray(cache,elements);}}// Single integer / boolean
function setValueV1i(gl,v){const cache=this.cache;if(cache[0]===v)return;gl.uniform1i(this.addr,v);cache[0]=v;}// Single integer / boolean vector (from flat array or THREE.VectorN)
function setValueV2i(gl,v){const cache=this.cache;if(v.x!==undefined){if(cache[0]!==v.x||cache[1]!==v.y){gl.uniform2i(this.addr,v.x,v.y);cache[0]=v.x;cache[1]=v.y;}}else {if(arraysEqual(cache,v))return;gl.uniform2iv(this.addr,v);copyArray(cache,v);}}function setValueV3i(gl,v){const cache=this.cache;if(v.x!==undefined){if(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z){gl.uniform3i(this.addr,v.x,v.y,v.z);cache[0]=v.x;cache[1]=v.y;cache[2]=v.z;}}else {if(arraysEqual(cache,v))return;gl.uniform3iv(this.addr,v);copyArray(cache,v);}}function setValueV4i(gl,v){const cache=this.cache;if(v.x!==undefined){if(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z||cache[3]!==v.w){gl.uniform4i(this.addr,v.x,v.y,v.z,v.w);cache[0]=v.x;cache[1]=v.y;cache[2]=v.z;cache[3]=v.w;}}else {if(arraysEqual(cache,v))return;gl.uniform4iv(this.addr,v);copyArray(cache,v);}}// Single unsigned integer
function setValueV1ui(gl,v){const cache=this.cache;if(cache[0]===v)return;gl.uniform1ui(this.addr,v);cache[0]=v;}// Single unsigned integer vector (from flat array or THREE.VectorN)
function setValueV2ui(gl,v){const cache=this.cache;if(v.x!==undefined){if(cache[0]!==v.x||cache[1]!==v.y){gl.uniform2ui(this.addr,v.x,v.y);cache[0]=v.x;cache[1]=v.y;}}else {if(arraysEqual(cache,v))return;gl.uniform2uiv(this.addr,v);copyArray(cache,v);}}function setValueV3ui(gl,v){const cache=this.cache;if(v.x!==undefined){if(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z){gl.uniform3ui(this.addr,v.x,v.y,v.z);cache[0]=v.x;cache[1]=v.y;cache[2]=v.z;}}else {if(arraysEqual(cache,v))return;gl.uniform3uiv(this.addr,v);copyArray(cache,v);}}function setValueV4ui(gl,v){const cache=this.cache;if(v.x!==undefined){if(cache[0]!==v.x||cache[1]!==v.y||cache[2]!==v.z||cache[3]!==v.w){gl.uniform4ui(this.addr,v.x,v.y,v.z,v.w);cache[0]=v.x;cache[1]=v.y;cache[2]=v.z;cache[3]=v.w;}}else {if(arraysEqual(cache,v))return;gl.uniform4uiv(this.addr,v);copyArray(cache,v);}}// Single texture (2D / Cube)
function setValueT1(gl,v,textures){const cache=this.cache;const unit=textures.allocateTextureUnit();if(cache[0]!==unit){gl.uniform1i(this.addr,unit);cache[0]=unit;}let emptyTexture2D;if(this.type===gl.SAMPLER_2D_SHADOW){emptyShadowTexture.compareFunction=LessEqualCompare;// #28670
emptyTexture2D=emptyShadowTexture;}else {emptyTexture2D=emptyTexture;}textures.setTexture2D(v||emptyTexture2D,unit);}function setValueT3D1(gl,v,textures){const cache=this.cache;const unit=textures.allocateTextureUnit();if(cache[0]!==unit){gl.uniform1i(this.addr,unit);cache[0]=unit;}textures.setTexture3D(v||empty3dTexture,unit);}function setValueT6(gl,v,textures){const cache=this.cache;const unit=textures.allocateTextureUnit();if(cache[0]!==unit){gl.uniform1i(this.addr,unit);cache[0]=unit;}textures.setTextureCube(v||emptyCubeTexture,unit);}function setValueT2DArray1(gl,v,textures){const cache=this.cache;const unit=textures.allocateTextureUnit();if(cache[0]!==unit){gl.uniform1i(this.addr,unit);cache[0]=unit;}textures.setTexture2DArray(v||emptyArrayTexture,unit);}// Helper to pick the right setter for the singular case
function getSingularSetter(type){switch(type){case 0x1406:return setValueV1f;// FLOAT
case 0x8b50:return setValueV2f;// _VEC2
case 0x8b51:return setValueV3f;// _VEC3
case 0x8b52:return setValueV4f;// _VEC4
case 0x8b5a:return setValueM2;// _MAT2
case 0x8b5b:return setValueM3;// _MAT3
case 0x8b5c:return setValueM4;// _MAT4
case 0x1404:case 0x8b56:return setValueV1i;// INT, BOOL
case 0x8b53:case 0x8b57:return setValueV2i;// _VEC2
case 0x8b54:case 0x8b58:return setValueV3i;// _VEC3
case 0x8b55:case 0x8b59:return setValueV4i;// _VEC4
case 0x1405:return setValueV1ui;// UINT
case 0x8dc6:return setValueV2ui;// _VEC2
case 0x8dc7:return setValueV3ui;// _VEC3
case 0x8dc8:return setValueV4ui;// _VEC4
case 0x8b5e:// SAMPLER_2D
case 0x8d66:// SAMPLER_EXTERNAL_OES
case 0x8dca:// INT_SAMPLER_2D
case 0x8dd2:// UNSIGNED_INT_SAMPLER_2D
case 0x8b62:// SAMPLER_2D_SHADOW
return setValueT1;case 0x8b5f:// SAMPLER_3D
case 0x8dcb:// INT_SAMPLER_3D
case 0x8dd3:// UNSIGNED_INT_SAMPLER_3D
return setValueT3D1;case 0x8b60:// SAMPLER_CUBE
case 0x8dcc:// INT_SAMPLER_CUBE
case 0x8dd4:// UNSIGNED_INT_SAMPLER_CUBE
case 0x8dc5:// SAMPLER_CUBE_SHADOW
return setValueT6;case 0x8dc1:// SAMPLER_2D_ARRAY
case 0x8dcf:// INT_SAMPLER_2D_ARRAY
case 0x8dd7:// UNSIGNED_INT_SAMPLER_2D_ARRAY
case 0x8dc4:// SAMPLER_2D_ARRAY_SHADOW
return setValueT2DArray1;}}// Array of scalars
function setValueV1fArray(gl,v){gl.uniform1fv(this.addr,v);}// Array of vectors (from flat array or array of THREE.VectorN)
function setValueV2fArray(gl,v){const data=flatten(v,this.size,2);gl.uniform2fv(this.addr,data);}function setValueV3fArray(gl,v){const data=flatten(v,this.size,3);gl.uniform3fv(this.addr,data);}function setValueV4fArray(gl,v){const data=flatten(v,this.size,4);gl.uniform4fv(this.addr,data);}// Array of matrices (from flat array or array of THREE.MatrixN)
function setValueM2Array(gl,v){const data=flatten(v,this.size,4);gl.uniformMatrix2fv(this.addr,false,data);}function setValueM3Array(gl,v){const data=flatten(v,this.size,9);gl.uniformMatrix3fv(this.addr,false,data);}function setValueM4Array(gl,v){const data=flatten(v,this.size,16);gl.uniformMatrix4fv(this.addr,false,data);}// Array of integer / boolean
function setValueV1iArray(gl,v){gl.uniform1iv(this.addr,v);}// Array of integer / boolean vectors (from flat array)
function setValueV2iArray(gl,v){gl.uniform2iv(this.addr,v);}function setValueV3iArray(gl,v){gl.uniform3iv(this.addr,v);}function setValueV4iArray(gl,v){gl.uniform4iv(this.addr,v);}// Array of unsigned integer
function setValueV1uiArray(gl,v){gl.uniform1uiv(this.addr,v);}// Array of unsigned integer vectors (from flat array)
function setValueV2uiArray(gl,v){gl.uniform2uiv(this.addr,v);}function setValueV3uiArray(gl,v){gl.uniform3uiv(this.addr,v);}function setValueV4uiArray(gl,v){gl.uniform4uiv(this.addr,v);}// Array of textures (2D / 3D / Cube / 2DArray)
function setValueT1Array(gl,v,textures){const cache=this.cache;const n=v.length;const units=allocTexUnits(textures,n);if(!arraysEqual(cache,units)){gl.uniform1iv(this.addr,units);copyArray(cache,units);}for(let i=0;i!==n;++i){textures.setTexture2D(v[i]||emptyTexture,units[i]);}}function setValueT3DArray(gl,v,textures){const cache=this.cache;const n=v.length;const units=allocTexUnits(textures,n);if(!arraysEqual(cache,units)){gl.uniform1iv(this.addr,units);copyArray(cache,units);}for(let i=0;i!==n;++i){textures.setTexture3D(v[i]||empty3dTexture,units[i]);}}function setValueT6Array(gl,v,textures){const cache=this.cache;const n=v.length;const units=allocTexUnits(textures,n);if(!arraysEqual(cache,units)){gl.uniform1iv(this.addr,units);copyArray(cache,units);}for(let i=0;i!==n;++i){textures.setTextureCube(v[i]||emptyCubeTexture,units[i]);}}function setValueT2DArrayArray(gl,v,textures){const cache=this.cache;const n=v.length;const units=allocTexUnits(textures,n);if(!arraysEqual(cache,units)){gl.uniform1iv(this.addr,units);copyArray(cache,units);}for(let i=0;i!==n;++i){textures.setTexture2DArray(v[i]||emptyArrayTexture,units[i]);}}// Helper to pick the right setter for a pure (bottom-level) array
function getPureArraySetter(type){switch(type){case 0x1406:return setValueV1fArray;// FLOAT
case 0x8b50:return setValueV2fArray;// _VEC2
case 0x8b51:return setValueV3fArray;// _VEC3
case 0x8b52:return setValueV4fArray;// _VEC4
case 0x8b5a:return setValueM2Array;// _MAT2
case 0x8b5b:return setValueM3Array;// _MAT3
case 0x8b5c:return setValueM4Array;// _MAT4
case 0x1404:case 0x8b56:return setValueV1iArray;// INT, BOOL
case 0x8b53:case 0x8b57:return setValueV2iArray;// _VEC2
case 0x8b54:case 0x8b58:return setValueV3iArray;// _VEC3
case 0x8b55:case 0x8b59:return setValueV4iArray;// _VEC4
case 0x1405:return setValueV1uiArray;// UINT
case 0x8dc6:return setValueV2uiArray;// _VEC2
case 0x8dc7:return setValueV3uiArray;// _VEC3
case 0x8dc8:return setValueV4uiArray;// _VEC4
case 0x8b5e:// SAMPLER_2D
case 0x8d66:// SAMPLER_EXTERNAL_OES
case 0x8dca:// INT_SAMPLER_2D
case 0x8dd2:// UNSIGNED_INT_SAMPLER_2D
case 0x8b62:// SAMPLER_2D_SHADOW
return setValueT1Array;case 0x8b5f:// SAMPLER_3D
case 0x8dcb:// INT_SAMPLER_3D
case 0x8dd3:// UNSIGNED_INT_SAMPLER_3D
return setValueT3DArray;case 0x8b60:// SAMPLER_CUBE
case 0x8dcc:// INT_SAMPLER_CUBE
case 0x8dd4:// UNSIGNED_INT_SAMPLER_CUBE
case 0x8dc5:// SAMPLER_CUBE_SHADOW
return setValueT6Array;case 0x8dc1:// SAMPLER_2D_ARRAY
case 0x8dcf:// INT_SAMPLER_2D_ARRAY
case 0x8dd7:// UNSIGNED_INT_SAMPLER_2D_ARRAY
case 0x8dc4:// SAMPLER_2D_ARRAY_SHADOW
return setValueT2DArrayArray;}}// --- Uniform Classes ---
class SingleUniform{constructor(id,activeInfo,addr){this.id=id;this.addr=addr;this.cache=[];this.type=activeInfo.type;this.setValue=getSingularSetter(activeInfo.type);// this.path = activeInfo.name; // DEBUG
}}class PureArrayUniform{constructor(id,activeInfo,addr){this.id=id;this.addr=addr;this.cache=[];this.type=activeInfo.type;this.size=activeInfo.size;this.setValue=getPureArraySetter(activeInfo.type);// this.path = activeInfo.name; // DEBUG
}}class StructuredUniform{constructor(id){this.id=id;this.seq=[];this.map={};}setValue(gl,value,textures){const seq=this.seq;for(let i=0,n=seq.length;i!==n;++i){const u=seq[i];u.setValue(gl,value[u.id],textures);}}}// --- Top-level ---
// Parser - builds up the property tree from the path strings
const RePathPart=/(\w+)(\])?(\[|\.)?/g;// extracts
// 	- the identifier (member name or array index)
//  - followed by an optional right bracket (found when array index)
//  - followed by an optional left bracket or dot (type of subscript)
//
// Note: These portions can be read in a non-overlapping fashion and
// allow straightforward parsing of the hierarchy that WebGL encodes
// in the uniform names.
function addUniform(container,uniformObject){container.seq.push(uniformObject);container.map[uniformObject.id]=uniformObject;}function parseUniform(activeInfo,addr,container){const path=activeInfo.name,pathLength=path.length;// reset RegExp object, because of the early exit of a previous run
RePathPart.lastIndex=0;while(true){const match=RePathPart.exec(path),matchEnd=RePathPart.lastIndex;let id=match[1];const idIsIndex=match[2]===']',subscript=match[3];if(idIsIndex)id=id|0;// convert to integer
if(subscript===undefined||subscript==='['&&matchEnd+2===pathLength){// bare name or "pure" bottom-level array "[0]" suffix
addUniform(container,subscript===undefined?new SingleUniform(id,activeInfo,addr):new PureArrayUniform(id,activeInfo,addr));break;}else {// step into inner node / create it in case it doesn't exist
const map=container.map;let next=map[id];if(next===undefined){next=new StructuredUniform(id);addUniform(container,next);}container=next;}}}// Root Container
class WebGLUniforms{constructor(gl,program){this.seq=[];this.map={};const n=gl.getProgramParameter(program,gl.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const info=gl.getActiveUniform(program,i),addr=gl.getUniformLocation(program,info.name);parseUniform(info,addr,this);}}setValue(gl,name,value,textures){const u=this.map[name];if(u!==undefined)u.setValue(gl,value,textures);}setOptional(gl,object,name){const v=object[name];if(v!==undefined)this.setValue(gl,name,v);}static upload(gl,seq,values,textures){for(let i=0,n=seq.length;i!==n;++i){const u=seq[i],v=values[u.id];if(v.needsUpdate!==false){// note: always updating when .needsUpdate is undefined
u.setValue(gl,v.value,textures);}}}static seqWithValue(seq,values){const r=[];for(let i=0,n=seq.length;i!==n;++i){const u=seq[i];if(u.id in values)r.push(u);}return r;}}function WebGLShader(gl,type,string){const shader=gl.createShader(type);gl.shaderSource(shader,string);gl.compileShader(shader);return shader;}// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/
const COMPLETION_STATUS_KHR=0x91B1;let programIdCount=0;function handleSource(string,errorLine){const lines=string.split('\n');const lines2=[];const from=Math.max(errorLine-6,0);const to=Math.min(errorLine+6,lines.length);for(let i=from;i<to;i++){const line=i+1;lines2.push(`${line===errorLine?'>':' '} ${line}: ${lines[i]}`);}return lines2.join('\n');}function getEncodingComponents(colorSpace){const workingPrimaries=ColorManagement$1.getPrimaries(ColorManagement$1.workingColorSpace);const encodingPrimaries=ColorManagement$1.getPrimaries(colorSpace);let gamutMapping;if(workingPrimaries===encodingPrimaries){gamutMapping='';}else if(workingPrimaries===P3Primaries$1&&encodingPrimaries===Rec709Primaries$1){gamutMapping='LinearDisplayP3ToLinearSRGB';}else if(workingPrimaries===Rec709Primaries$1&&encodingPrimaries===P3Primaries$1){gamutMapping='LinearSRGBToLinearDisplayP3';}switch(colorSpace){case LinearSRGBColorSpace$1:case LinearDisplayP3ColorSpace$1:return [gamutMapping,'LinearTransferOETF'];case SRGBColorSpace$1:case DisplayP3ColorSpace$1:return [gamutMapping,'sRGBTransferOETF'];default:console.warn('THREE.WebGLProgram: Unsupported color space:',colorSpace);return [gamutMapping,'LinearTransferOETF'];}}function getShaderErrors(gl,shader,type){const status=gl.getShaderParameter(shader,gl.COMPILE_STATUS);const errors=gl.getShaderInfoLog(shader).trim();if(status&&errors==='')return '';const errorMatches=/ERROR: 0:(\d+)/.exec(errors);if(errorMatches){// --enable-privileged-webgl-extension
// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );
const errorLine=parseInt(errorMatches[1]);return type.toUpperCase()+'\n\n'+errors+'\n\n'+handleSource(gl.getShaderSource(shader),errorLine);}else {return errors;}}function getTexelEncodingFunction(functionName,colorSpace){const components=getEncodingComponents(colorSpace);return `vec4 ${functionName}( vec4 value ) { return ${components[0]}( ${components[1]}( value ) ); }`;}function getToneMappingFunction(functionName,toneMapping){let toneMappingName;switch(toneMapping){case LinearToneMapping:toneMappingName='Linear';break;case ReinhardToneMapping:toneMappingName='Reinhard';break;case CineonToneMapping:toneMappingName='Cineon';break;case ACESFilmicToneMapping:toneMappingName='ACESFilmic';break;case AgXToneMapping:toneMappingName='AgX';break;case NeutralToneMapping:toneMappingName='Neutral';break;case CustomToneMapping:toneMappingName='Custom';break;default:console.warn('THREE.WebGLProgram: Unsupported toneMapping:',toneMapping);toneMappingName='Linear';}return 'vec3 '+functionName+'( vec3 color ) { return '+toneMappingName+'ToneMapping( color ); }';}const _v0$1$1=/*@__PURE__*/new Vector3$1();function getLuminanceFunction(){ColorManagement$1.getLuminanceCoefficients(_v0$1$1);const r=_v0$1$1.x.toFixed(4);const g=_v0$1$1.y.toFixed(4);const b=_v0$1$1.z.toFixed(4);return ['float luminance( const in vec3 rgb ) {',`	const vec3 weights = vec3( ${r}, ${g}, ${b} );`,'	return dot( weights, rgb );','}'].join('\n');}function generateVertexExtensions(parameters){const chunks=[parameters.extensionClipCullDistance?'#extension GL_ANGLE_clip_cull_distance : require':'',parameters.extensionMultiDraw?'#extension GL_ANGLE_multi_draw : require':''];return chunks.filter(filterEmptyLine).join('\n');}function generateDefines(defines){const chunks=[];for(const name in defines){const value=defines[name];if(value===false)continue;chunks.push('#define '+name+' '+value);}return chunks.join('\n');}function fetchAttributeLocations(gl,program){const attributes={};const n=gl.getProgramParameter(program,gl.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const info=gl.getActiveAttrib(program,i);const name=info.name;let locationSize=1;if(info.type===gl.FLOAT_MAT2)locationSize=2;if(info.type===gl.FLOAT_MAT3)locationSize=3;if(info.type===gl.FLOAT_MAT4)locationSize=4;// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );
attributes[name]={type:info.type,location:gl.getAttribLocation(program,name),locationSize:locationSize};}return attributes;}function filterEmptyLine(string){return string!=='';}function replaceLightNums(string,parameters){const numSpotLightCoords=parameters.numSpotLightShadows+parameters.numSpotLightMaps-parameters.numSpotLightShadowsWithMaps;return string.replace(/NUM_DIR_LIGHTS/g,parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g,parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g,parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g,parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,parameters.numPointLightShadows);}function replaceClippingPlaneNums(string,parameters){return string.replace(/NUM_CLIPPING_PLANES/g,parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,parameters.numClippingPlanes-parameters.numClipIntersection);}// Resolve Includes
const includePattern=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(string){return string.replace(includePattern,includeReplacer);}const shaderChunkMap=new Map();function includeReplacer(match,include){let string=ShaderChunk[include];if(string===undefined){const newInclude=shaderChunkMap.get(include);if(newInclude!==undefined){string=ShaderChunk[newInclude];console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',include,newInclude);}else {throw new Error('Can not resolve #include <'+include+'>');}}return resolveIncludes(string);}// Unroll Loops
const unrollLoopPattern=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function unrollLoops(string){return string.replace(unrollLoopPattern,loopReplacer);}function loopReplacer(match,start,end,snippet){let string='';for(let i=parseInt(start);i<parseInt(end);i++){string+=snippet.replace(/\[\s*i\s*\]/g,'[ '+i+' ]').replace(/UNROLLED_LOOP_INDEX/g,i);}return string;}//
function generatePrecision(parameters){let precisionstring=`precision ${parameters.precision} float;
	precision ${parameters.precision} int;
	precision ${parameters.precision} sampler2D;
	precision ${parameters.precision} samplerCube;
	precision ${parameters.precision} sampler3D;
	precision ${parameters.precision} sampler2DArray;
	precision ${parameters.precision} sampler2DShadow;
	precision ${parameters.precision} samplerCubeShadow;
	precision ${parameters.precision} sampler2DArrayShadow;
	precision ${parameters.precision} isampler2D;
	precision ${parameters.precision} isampler3D;
	precision ${parameters.precision} isamplerCube;
	precision ${parameters.precision} isampler2DArray;
	precision ${parameters.precision} usampler2D;
	precision ${parameters.precision} usampler3D;
	precision ${parameters.precision} usamplerCube;
	precision ${parameters.precision} usampler2DArray;
	`;if(parameters.precision==='highp'){precisionstring+='\n#define HIGH_PRECISION';}else if(parameters.precision==='mediump'){precisionstring+='\n#define MEDIUM_PRECISION';}else if(parameters.precision==='lowp'){precisionstring+='\n#define LOW_PRECISION';}return precisionstring;}function generateShadowMapTypeDefine(parameters){let shadowMapTypeDefine='SHADOWMAP_TYPE_BASIC';if(parameters.shadowMapType===PCFShadowMap){shadowMapTypeDefine='SHADOWMAP_TYPE_PCF';}else if(parameters.shadowMapType===PCFSoftShadowMap){shadowMapTypeDefine='SHADOWMAP_TYPE_PCF_SOFT';}else if(parameters.shadowMapType===VSMShadowMap){shadowMapTypeDefine='SHADOWMAP_TYPE_VSM';}return shadowMapTypeDefine;}function generateEnvMapTypeDefine(parameters){let envMapTypeDefine='ENVMAP_TYPE_CUBE';if(parameters.envMap){switch(parameters.envMapMode){case CubeReflectionMapping$1:case CubeRefractionMapping$1:envMapTypeDefine='ENVMAP_TYPE_CUBE';break;case CubeUVReflectionMapping:envMapTypeDefine='ENVMAP_TYPE_CUBE_UV';break;}}return envMapTypeDefine;}function generateEnvMapModeDefine(parameters){let envMapModeDefine='ENVMAP_MODE_REFLECTION';if(parameters.envMap){switch(parameters.envMapMode){case CubeRefractionMapping$1:envMapModeDefine='ENVMAP_MODE_REFRACTION';break;}}return envMapModeDefine;}function generateEnvMapBlendingDefine(parameters){let envMapBlendingDefine='ENVMAP_BLENDING_NONE';if(parameters.envMap){switch(parameters.combine){case MultiplyOperation$1:envMapBlendingDefine='ENVMAP_BLENDING_MULTIPLY';break;case MixOperation:envMapBlendingDefine='ENVMAP_BLENDING_MIX';break;case AddOperation:envMapBlendingDefine='ENVMAP_BLENDING_ADD';break;}}return envMapBlendingDefine;}function generateCubeUVSize(parameters){const imageHeight=parameters.envMapCubeUVHeight;if(imageHeight===null)return null;const maxMip=Math.log2(imageHeight)-2;const texelHeight=1.0/imageHeight;const texelWidth=1.0/(3*Math.max(Math.pow(2,maxMip),7*16));return {texelWidth,texelHeight,maxMip};}function WebGLProgram(renderer,cacheKey,parameters,bindingStates){// TODO Send this event to Three.js DevTools
// console.log( 'WebGLProgram', cacheKey );
const gl=renderer.getContext();const defines=parameters.defines;let vertexShader=parameters.vertexShader;let fragmentShader=parameters.fragmentShader;const shadowMapTypeDefine=generateShadowMapTypeDefine(parameters);const envMapTypeDefine=generateEnvMapTypeDefine(parameters);const envMapModeDefine=generateEnvMapModeDefine(parameters);const envMapBlendingDefine=generateEnvMapBlendingDefine(parameters);const envMapCubeUVSize=generateCubeUVSize(parameters);const customVertexExtensions=generateVertexExtensions(parameters);const customDefines=generateDefines(defines);const program=gl.createProgram();let prefixVertex,prefixFragment;let versionString=parameters.glslVersion?'#version '+parameters.glslVersion+'\n':'';if(parameters.isRawShaderMaterial){prefixVertex=['#define SHADER_TYPE '+parameters.shaderType,'#define SHADER_NAME '+parameters.shaderName,customDefines].filter(filterEmptyLine).join('\n');if(prefixVertex.length>0){prefixVertex+='\n';}prefixFragment=['#define SHADER_TYPE '+parameters.shaderType,'#define SHADER_NAME '+parameters.shaderName,customDefines].filter(filterEmptyLine).join('\n');if(prefixFragment.length>0){prefixFragment+='\n';}}else {prefixVertex=[generatePrecision(parameters),'#define SHADER_TYPE '+parameters.shaderType,'#define SHADER_NAME '+parameters.shaderName,customDefines,parameters.extensionClipCullDistance?'#define USE_CLIP_DISTANCE':'',parameters.batching?'#define USE_BATCHING':'',parameters.batchingColor?'#define USE_BATCHING_COLOR':'',parameters.instancing?'#define USE_INSTANCING':'',parameters.instancingColor?'#define USE_INSTANCING_COLOR':'',parameters.instancingMorph?'#define USE_INSTANCING_MORPH':'',parameters.useFog&&parameters.fog?'#define USE_FOG':'',parameters.useFog&&parameters.fogExp2?'#define FOG_EXP2':'',parameters.map?'#define USE_MAP':'',parameters.envMap?'#define USE_ENVMAP':'',parameters.envMap?'#define '+envMapModeDefine:'',parameters.lightMap?'#define USE_LIGHTMAP':'',parameters.aoMap?'#define USE_AOMAP':'',parameters.bumpMap?'#define USE_BUMPMAP':'',parameters.normalMap?'#define USE_NORMALMAP':'',parameters.normalMapObjectSpace?'#define USE_NORMALMAP_OBJECTSPACE':'',parameters.normalMapTangentSpace?'#define USE_NORMALMAP_TANGENTSPACE':'',parameters.displacementMap?'#define USE_DISPLACEMENTMAP':'',parameters.emissiveMap?'#define USE_EMISSIVEMAP':'',parameters.anisotropy?'#define USE_ANISOTROPY':'',parameters.anisotropyMap?'#define USE_ANISOTROPYMAP':'',parameters.clearcoatMap?'#define USE_CLEARCOATMAP':'',parameters.clearcoatRoughnessMap?'#define USE_CLEARCOAT_ROUGHNESSMAP':'',parameters.clearcoatNormalMap?'#define USE_CLEARCOAT_NORMALMAP':'',parameters.iridescenceMap?'#define USE_IRIDESCENCEMAP':'',parameters.iridescenceThicknessMap?'#define USE_IRIDESCENCE_THICKNESSMAP':'',parameters.specularMap?'#define USE_SPECULARMAP':'',parameters.specularColorMap?'#define USE_SPECULAR_COLORMAP':'',parameters.specularIntensityMap?'#define USE_SPECULAR_INTENSITYMAP':'',parameters.roughnessMap?'#define USE_ROUGHNESSMAP':'',parameters.metalnessMap?'#define USE_METALNESSMAP':'',parameters.alphaMap?'#define USE_ALPHAMAP':'',parameters.alphaHash?'#define USE_ALPHAHASH':'',parameters.transmission?'#define USE_TRANSMISSION':'',parameters.transmissionMap?'#define USE_TRANSMISSIONMAP':'',parameters.thicknessMap?'#define USE_THICKNESSMAP':'',parameters.sheenColorMap?'#define USE_SHEEN_COLORMAP':'',parameters.sheenRoughnessMap?'#define USE_SHEEN_ROUGHNESSMAP':'',//
parameters.mapUv?'#define MAP_UV '+parameters.mapUv:'',parameters.alphaMapUv?'#define ALPHAMAP_UV '+parameters.alphaMapUv:'',parameters.lightMapUv?'#define LIGHTMAP_UV '+parameters.lightMapUv:'',parameters.aoMapUv?'#define AOMAP_UV '+parameters.aoMapUv:'',parameters.emissiveMapUv?'#define EMISSIVEMAP_UV '+parameters.emissiveMapUv:'',parameters.bumpMapUv?'#define BUMPMAP_UV '+parameters.bumpMapUv:'',parameters.normalMapUv?'#define NORMALMAP_UV '+parameters.normalMapUv:'',parameters.displacementMapUv?'#define DISPLACEMENTMAP_UV '+parameters.displacementMapUv:'',parameters.metalnessMapUv?'#define METALNESSMAP_UV '+parameters.metalnessMapUv:'',parameters.roughnessMapUv?'#define ROUGHNESSMAP_UV '+parameters.roughnessMapUv:'',parameters.anisotropyMapUv?'#define ANISOTROPYMAP_UV '+parameters.anisotropyMapUv:'',parameters.clearcoatMapUv?'#define CLEARCOATMAP_UV '+parameters.clearcoatMapUv:'',parameters.clearcoatNormalMapUv?'#define CLEARCOAT_NORMALMAP_UV '+parameters.clearcoatNormalMapUv:'',parameters.clearcoatRoughnessMapUv?'#define CLEARCOAT_ROUGHNESSMAP_UV '+parameters.clearcoatRoughnessMapUv:'',parameters.iridescenceMapUv?'#define IRIDESCENCEMAP_UV '+parameters.iridescenceMapUv:'',parameters.iridescenceThicknessMapUv?'#define IRIDESCENCE_THICKNESSMAP_UV '+parameters.iridescenceThicknessMapUv:'',parameters.sheenColorMapUv?'#define SHEEN_COLORMAP_UV '+parameters.sheenColorMapUv:'',parameters.sheenRoughnessMapUv?'#define SHEEN_ROUGHNESSMAP_UV '+parameters.sheenRoughnessMapUv:'',parameters.specularMapUv?'#define SPECULARMAP_UV '+parameters.specularMapUv:'',parameters.specularColorMapUv?'#define SPECULAR_COLORMAP_UV '+parameters.specularColorMapUv:'',parameters.specularIntensityMapUv?'#define SPECULAR_INTENSITYMAP_UV '+parameters.specularIntensityMapUv:'',parameters.transmissionMapUv?'#define TRANSMISSIONMAP_UV '+parameters.transmissionMapUv:'',parameters.thicknessMapUv?'#define THICKNESSMAP_UV '+parameters.thicknessMapUv:'',//
parameters.vertexTangents&&parameters.flatShading===false?'#define USE_TANGENT':'',parameters.vertexColors?'#define USE_COLOR':'',parameters.vertexAlphas?'#define USE_COLOR_ALPHA':'',parameters.vertexUv1s?'#define USE_UV1':'',parameters.vertexUv2s?'#define USE_UV2':'',parameters.vertexUv3s?'#define USE_UV3':'',parameters.pointsUvs?'#define USE_POINTS_UV':'',parameters.flatShading?'#define FLAT_SHADED':'',parameters.skinning?'#define USE_SKINNING':'',parameters.morphTargets?'#define USE_MORPHTARGETS':'',parameters.morphNormals&&parameters.flatShading===false?'#define USE_MORPHNORMALS':'',parameters.morphColors?'#define USE_MORPHCOLORS':'',parameters.morphTargetsCount>0?'#define MORPHTARGETS_TEXTURE_STRIDE '+parameters.morphTextureStride:'',parameters.morphTargetsCount>0?'#define MORPHTARGETS_COUNT '+parameters.morphTargetsCount:'',parameters.doubleSided?'#define DOUBLE_SIDED':'',parameters.flipSided?'#define FLIP_SIDED':'',parameters.shadowMapEnabled?'#define USE_SHADOWMAP':'',parameters.shadowMapEnabled?'#define '+shadowMapTypeDefine:'',parameters.sizeAttenuation?'#define USE_SIZEATTENUATION':'',parameters.numLightProbes>0?'#define USE_LIGHT_PROBES':'',parameters.logarithmicDepthBuffer?'#define USE_LOGDEPTHBUF':'','uniform mat4 modelMatrix;','uniform mat4 modelViewMatrix;','uniform mat4 projectionMatrix;','uniform mat4 viewMatrix;','uniform mat3 normalMatrix;','uniform vec3 cameraPosition;','uniform bool isOrthographic;','#ifdef USE_INSTANCING','	attribute mat4 instanceMatrix;','#endif','#ifdef USE_INSTANCING_COLOR','	attribute vec3 instanceColor;','#endif','#ifdef USE_INSTANCING_MORPH','	uniform sampler2D morphTexture;','#endif','attribute vec3 position;','attribute vec3 normal;','attribute vec2 uv;','#ifdef USE_UV1','	attribute vec2 uv1;','#endif','#ifdef USE_UV2','	attribute vec2 uv2;','#endif','#ifdef USE_UV3','	attribute vec2 uv3;','#endif','#ifdef USE_TANGENT','	attribute vec4 tangent;','#endif','#if defined( USE_COLOR_ALPHA )','	attribute vec4 color;','#elif defined( USE_COLOR )','	attribute vec3 color;','#endif','#ifdef USE_SKINNING','	attribute vec4 skinIndex;','	attribute vec4 skinWeight;','#endif','\n'].filter(filterEmptyLine).join('\n');prefixFragment=[generatePrecision(parameters),'#define SHADER_TYPE '+parameters.shaderType,'#define SHADER_NAME '+parameters.shaderName,customDefines,parameters.useFog&&parameters.fog?'#define USE_FOG':'',parameters.useFog&&parameters.fogExp2?'#define FOG_EXP2':'',parameters.alphaToCoverage?'#define ALPHA_TO_COVERAGE':'',parameters.map?'#define USE_MAP':'',parameters.matcap?'#define USE_MATCAP':'',parameters.envMap?'#define USE_ENVMAP':'',parameters.envMap?'#define '+envMapTypeDefine:'',parameters.envMap?'#define '+envMapModeDefine:'',parameters.envMap?'#define '+envMapBlendingDefine:'',envMapCubeUVSize?'#define CUBEUV_TEXEL_WIDTH '+envMapCubeUVSize.texelWidth:'',envMapCubeUVSize?'#define CUBEUV_TEXEL_HEIGHT '+envMapCubeUVSize.texelHeight:'',envMapCubeUVSize?'#define CUBEUV_MAX_MIP '+envMapCubeUVSize.maxMip+'.0':'',parameters.lightMap?'#define USE_LIGHTMAP':'',parameters.aoMap?'#define USE_AOMAP':'',parameters.bumpMap?'#define USE_BUMPMAP':'',parameters.normalMap?'#define USE_NORMALMAP':'',parameters.normalMapObjectSpace?'#define USE_NORMALMAP_OBJECTSPACE':'',parameters.normalMapTangentSpace?'#define USE_NORMALMAP_TANGENTSPACE':'',parameters.emissiveMap?'#define USE_EMISSIVEMAP':'',parameters.anisotropy?'#define USE_ANISOTROPY':'',parameters.anisotropyMap?'#define USE_ANISOTROPYMAP':'',parameters.clearcoat?'#define USE_CLEARCOAT':'',parameters.clearcoatMap?'#define USE_CLEARCOATMAP':'',parameters.clearcoatRoughnessMap?'#define USE_CLEARCOAT_ROUGHNESSMAP':'',parameters.clearcoatNormalMap?'#define USE_CLEARCOAT_NORMALMAP':'',parameters.dispersion?'#define USE_DISPERSION':'',parameters.iridescence?'#define USE_IRIDESCENCE':'',parameters.iridescenceMap?'#define USE_IRIDESCENCEMAP':'',parameters.iridescenceThicknessMap?'#define USE_IRIDESCENCE_THICKNESSMAP':'',parameters.specularMap?'#define USE_SPECULARMAP':'',parameters.specularColorMap?'#define USE_SPECULAR_COLORMAP':'',parameters.specularIntensityMap?'#define USE_SPECULAR_INTENSITYMAP':'',parameters.roughnessMap?'#define USE_ROUGHNESSMAP':'',parameters.metalnessMap?'#define USE_METALNESSMAP':'',parameters.alphaMap?'#define USE_ALPHAMAP':'',parameters.alphaTest?'#define USE_ALPHATEST':'',parameters.alphaHash?'#define USE_ALPHAHASH':'',parameters.sheen?'#define USE_SHEEN':'',parameters.sheenColorMap?'#define USE_SHEEN_COLORMAP':'',parameters.sheenRoughnessMap?'#define USE_SHEEN_ROUGHNESSMAP':'',parameters.transmission?'#define USE_TRANSMISSION':'',parameters.transmissionMap?'#define USE_TRANSMISSIONMAP':'',parameters.thicknessMap?'#define USE_THICKNESSMAP':'',parameters.vertexTangents&&parameters.flatShading===false?'#define USE_TANGENT':'',parameters.vertexColors||parameters.instancingColor||parameters.batchingColor?'#define USE_COLOR':'',parameters.vertexAlphas?'#define USE_COLOR_ALPHA':'',parameters.vertexUv1s?'#define USE_UV1':'',parameters.vertexUv2s?'#define USE_UV2':'',parameters.vertexUv3s?'#define USE_UV3':'',parameters.pointsUvs?'#define USE_POINTS_UV':'',parameters.gradientMap?'#define USE_GRADIENTMAP':'',parameters.flatShading?'#define FLAT_SHADED':'',parameters.doubleSided?'#define DOUBLE_SIDED':'',parameters.flipSided?'#define FLIP_SIDED':'',parameters.shadowMapEnabled?'#define USE_SHADOWMAP':'',parameters.shadowMapEnabled?'#define '+shadowMapTypeDefine:'',parameters.premultipliedAlpha?'#define PREMULTIPLIED_ALPHA':'',parameters.numLightProbes>0?'#define USE_LIGHT_PROBES':'',parameters.decodeVideoTexture?'#define DECODE_VIDEO_TEXTURE':'',parameters.logarithmicDepthBuffer?'#define USE_LOGDEPTHBUF':'','uniform mat4 viewMatrix;','uniform vec3 cameraPosition;','uniform bool isOrthographic;',parameters.toneMapping!==NoToneMapping$1?'#define TONE_MAPPING':'',parameters.toneMapping!==NoToneMapping$1?ShaderChunk['tonemapping_pars_fragment']:'',// this code is required here because it is used by the toneMapping() function defined below
parameters.toneMapping!==NoToneMapping$1?getToneMappingFunction('toneMapping',parameters.toneMapping):'',parameters.dithering?'#define DITHERING':'',parameters.opaque?'#define OPAQUE':'',ShaderChunk['colorspace_pars_fragment'],// this code is required here because it is used by the various encoding/decoding function defined below
getTexelEncodingFunction('linearToOutputTexel',parameters.outputColorSpace),getLuminanceFunction(),parameters.useDepthPacking?'#define DEPTH_PACKING '+parameters.depthPacking:'','\n'].filter(filterEmptyLine).join('\n');}vertexShader=resolveIncludes(vertexShader);vertexShader=replaceLightNums(vertexShader,parameters);vertexShader=replaceClippingPlaneNums(vertexShader,parameters);fragmentShader=resolveIncludes(fragmentShader);fragmentShader=replaceLightNums(fragmentShader,parameters);fragmentShader=replaceClippingPlaneNums(fragmentShader,parameters);vertexShader=unrollLoops(vertexShader);fragmentShader=unrollLoops(fragmentShader);if(parameters.isRawShaderMaterial!==true){// GLSL 3.0 conversion for built-in materials and ShaderMaterial
versionString='#version 300 es\n';prefixVertex=[customVertexExtensions,'#define attribute in','#define varying out','#define texture2D texture'].join('\n')+'\n'+prefixVertex;prefixFragment=['#define varying in',parameters.glslVersion===GLSL3?'':'layout(location = 0) out highp vec4 pc_fragColor;',parameters.glslVersion===GLSL3?'':'#define gl_FragColor pc_fragColor','#define gl_FragDepthEXT gl_FragDepth','#define texture2D texture','#define textureCube texture','#define texture2DProj textureProj','#define texture2DLodEXT textureLod','#define texture2DProjLodEXT textureProjLod','#define textureCubeLodEXT textureLod','#define texture2DGradEXT textureGrad','#define texture2DProjGradEXT textureProjGrad','#define textureCubeGradEXT textureGrad'].join('\n')+'\n'+prefixFragment;}const vertexGlsl=versionString+prefixVertex+vertexShader;const fragmentGlsl=versionString+prefixFragment+fragmentShader;// console.log( '*VERTEX*', vertexGlsl );
// console.log( '*FRAGMENT*', fragmentGlsl );
const glVertexShader=WebGLShader(gl,gl.VERTEX_SHADER,vertexGlsl);const glFragmentShader=WebGLShader(gl,gl.FRAGMENT_SHADER,fragmentGlsl);gl.attachShader(program,glVertexShader);gl.attachShader(program,glFragmentShader);// Force a particular attribute to index 0.
if(parameters.index0AttributeName!==undefined){gl.bindAttribLocation(program,0,parameters.index0AttributeName);}else if(parameters.morphTargets===true){// programs with morphTargets displace position out of attribute 0
gl.bindAttribLocation(program,0,'position');}gl.linkProgram(program);function onFirstUse(self){// check for link errors
if(renderer.debug.checkShaderErrors){const programLog=gl.getProgramInfoLog(program).trim();const vertexLog=gl.getShaderInfoLog(glVertexShader).trim();const fragmentLog=gl.getShaderInfoLog(glFragmentShader).trim();let runnable=true;let haveDiagnostics=true;if(gl.getProgramParameter(program,gl.LINK_STATUS)===false){runnable=false;if(typeof renderer.debug.onShaderError==='function'){renderer.debug.onShaderError(gl,program,glVertexShader,glFragmentShader);}else {// default error reporting
const vertexErrors=getShaderErrors(gl,glVertexShader,'vertex');const fragmentErrors=getShaderErrors(gl,glFragmentShader,'fragment');console.error('THREE.WebGLProgram: Shader Error '+gl.getError()+' - '+'VALIDATE_STATUS '+gl.getProgramParameter(program,gl.VALIDATE_STATUS)+'\n\n'+'Material Name: '+self.name+'\n'+'Material Type: '+self.type+'\n\n'+'Program Info Log: '+programLog+'\n'+vertexErrors+'\n'+fragmentErrors);}}else if(programLog!==''){console.warn('THREE.WebGLProgram: Program Info Log:',programLog);}else if(vertexLog===''||fragmentLog===''){haveDiagnostics=false;}if(haveDiagnostics){self.diagnostics={runnable:runnable,programLog:programLog,vertexShader:{log:vertexLog,prefix:prefixVertex},fragmentShader:{log:fragmentLog,prefix:prefixFragment}};}}// Clean up
// Crashes in iOS9 and iOS10. #18402
// gl.detachShader( program, glVertexShader );
// gl.detachShader( program, glFragmentShader );
gl.deleteShader(glVertexShader);gl.deleteShader(glFragmentShader);cachedUniforms=new WebGLUniforms(gl,program);cachedAttributes=fetchAttributeLocations(gl,program);}// set up caching for uniform locations
let cachedUniforms;this.getUniforms=function(){if(cachedUniforms===undefined){// Populates cachedUniforms and cachedAttributes
onFirstUse(this);}return cachedUniforms;};// set up caching for attribute locations
let cachedAttributes;this.getAttributes=function(){if(cachedAttributes===undefined){// Populates cachedAttributes and cachedUniforms
onFirstUse(this);}return cachedAttributes;};// indicate when the program is ready to be used. if the KHR_parallel_shader_compile extension isn't supported,
// flag the program as ready immediately. It may cause a stall when it's first used.
let programReady=parameters.rendererExtensionParallelShaderCompile===false;this.isReady=function(){if(programReady===false){programReady=gl.getProgramParameter(program,COMPLETION_STATUS_KHR);}return programReady;};// free resource
this.destroy=function(){bindingStates.releaseStatesOfProgram(this);gl.deleteProgram(program);this.program=undefined;};//
this.type=parameters.shaderType;this.name=parameters.shaderName;this.id=programIdCount++;this.cacheKey=cacheKey;this.usedTimes=1;this.program=program;this.vertexShader=glVertexShader;this.fragmentShader=glFragmentShader;return this;}let _id$1=0;class WebGLShaderCache{constructor(){this.shaderCache=new Map();this.materialCache=new Map();}update(material){const vertexShader=material.vertexShader;const fragmentShader=material.fragmentShader;const vertexShaderStage=this._getShaderStage(vertexShader);const fragmentShaderStage=this._getShaderStage(fragmentShader);const materialShaders=this._getShaderCacheForMaterial(material);if(materialShaders.has(vertexShaderStage)===false){materialShaders.add(vertexShaderStage);vertexShaderStage.usedTimes++;}if(materialShaders.has(fragmentShaderStage)===false){materialShaders.add(fragmentShaderStage);fragmentShaderStage.usedTimes++;}return this;}remove(material){const materialShaders=this.materialCache.get(material);for(const shaderStage of materialShaders){shaderStage.usedTimes--;if(shaderStage.usedTimes===0)this.shaderCache.delete(shaderStage.code);}this.materialCache.delete(material);return this;}getVertexShaderID(material){return this._getShaderStage(material.vertexShader).id;}getFragmentShaderID(material){return this._getShaderStage(material.fragmentShader).id;}dispose(){this.shaderCache.clear();this.materialCache.clear();}_getShaderCacheForMaterial(material){const cache=this.materialCache;let set=cache.get(material);if(set===undefined){set=new Set();cache.set(material,set);}return set;}_getShaderStage(code){const cache=this.shaderCache;let stage=cache.get(code);if(stage===undefined){stage=new WebGLShaderStage(code);cache.set(code,stage);}return stage;}}class WebGLShaderStage{constructor(code){this.id=_id$1++;this.code=code;this.usedTimes=0;}}function WebGLPrograms(renderer,cubemaps,cubeuvmaps,extensions,capabilities,bindingStates,clipping){const _programLayers=new Layers$1();const _customShaders=new WebGLShaderCache();const _activeChannels=new Set();const programs=[];const logarithmicDepthBuffer=capabilities.logarithmicDepthBuffer;const SUPPORTS_VERTEX_TEXTURES=capabilities.vertexTextures;let precision=capabilities.precision;const shaderIDs={MeshDepthMaterial:'depth',MeshDistanceMaterial:'distanceRGBA',MeshNormalMaterial:'normal',MeshBasicMaterial:'basic',MeshLambertMaterial:'lambert',MeshPhongMaterial:'phong',MeshToonMaterial:'toon',MeshStandardMaterial:'physical',MeshPhysicalMaterial:'physical',MeshMatcapMaterial:'matcap',LineBasicMaterial:'basic',LineDashedMaterial:'dashed',PointsMaterial:'points',ShadowMaterial:'shadow',SpriteMaterial:'sprite'};function getChannel(value){_activeChannels.add(value);if(value===0)return 'uv';return `uv${value}`;}function getParameters(material,lights,shadows,scene,object){const fog=scene.fog;const geometry=object.geometry;const environment=material.isMeshStandardMaterial?scene.environment:null;const envMap=(material.isMeshStandardMaterial?cubeuvmaps:cubemaps).get(material.envMap||environment);const envMapCubeUVHeight=!!envMap&&envMap.mapping===CubeUVReflectionMapping?envMap.image.height:null;const shaderID=shaderIDs[material.type];// heuristics to create shader parameters according to lights in the scene
// (not to blow over maxLights budget)
if(material.precision!==null){precision=capabilities.getMaxPrecision(material.precision);if(precision!==material.precision){console.warn('THREE.WebGLProgram.getParameters:',material.precision,'not supported, using',precision,'instead.');}}//
const morphAttribute=geometry.morphAttributes.position||geometry.morphAttributes.normal||geometry.morphAttributes.color;const morphTargetsCount=morphAttribute!==undefined?morphAttribute.length:0;let morphTextureStride=0;if(geometry.morphAttributes.position!==undefined)morphTextureStride=1;if(geometry.morphAttributes.normal!==undefined)morphTextureStride=2;if(geometry.morphAttributes.color!==undefined)morphTextureStride=3;//
let vertexShader,fragmentShader;let customVertexShaderID,customFragmentShaderID;if(shaderID){const shader=ShaderLib[shaderID];vertexShader=shader.vertexShader;fragmentShader=shader.fragmentShader;}else {vertexShader=material.vertexShader;fragmentShader=material.fragmentShader;_customShaders.update(material);customVertexShaderID=_customShaders.getVertexShaderID(material);customFragmentShaderID=_customShaders.getFragmentShaderID(material);}const currentRenderTarget=renderer.getRenderTarget();const IS_INSTANCEDMESH=object.isInstancedMesh===true;const IS_BATCHEDMESH=object.isBatchedMesh===true;const HAS_MAP=!!material.map;const HAS_MATCAP=!!material.matcap;const HAS_ENVMAP=!!envMap;const HAS_AOMAP=!!material.aoMap;const HAS_LIGHTMAP=!!material.lightMap;const HAS_BUMPMAP=!!material.bumpMap;const HAS_NORMALMAP=!!material.normalMap;const HAS_DISPLACEMENTMAP=!!material.displacementMap;const HAS_EMISSIVEMAP=!!material.emissiveMap;const HAS_METALNESSMAP=!!material.metalnessMap;const HAS_ROUGHNESSMAP=!!material.roughnessMap;const HAS_ANISOTROPY=material.anisotropy>0;const HAS_CLEARCOAT=material.clearcoat>0;const HAS_DISPERSION=material.dispersion>0;const HAS_IRIDESCENCE=material.iridescence>0;const HAS_SHEEN=material.sheen>0;const HAS_TRANSMISSION=material.transmission>0;const HAS_ANISOTROPYMAP=HAS_ANISOTROPY&&!!material.anisotropyMap;const HAS_CLEARCOATMAP=HAS_CLEARCOAT&&!!material.clearcoatMap;const HAS_CLEARCOAT_NORMALMAP=HAS_CLEARCOAT&&!!material.clearcoatNormalMap;const HAS_CLEARCOAT_ROUGHNESSMAP=HAS_CLEARCOAT&&!!material.clearcoatRoughnessMap;const HAS_IRIDESCENCEMAP=HAS_IRIDESCENCE&&!!material.iridescenceMap;const HAS_IRIDESCENCE_THICKNESSMAP=HAS_IRIDESCENCE&&!!material.iridescenceThicknessMap;const HAS_SHEEN_COLORMAP=HAS_SHEEN&&!!material.sheenColorMap;const HAS_SHEEN_ROUGHNESSMAP=HAS_SHEEN&&!!material.sheenRoughnessMap;const HAS_SPECULARMAP=!!material.specularMap;const HAS_SPECULAR_COLORMAP=!!material.specularColorMap;const HAS_SPECULAR_INTENSITYMAP=!!material.specularIntensityMap;const HAS_TRANSMISSIONMAP=HAS_TRANSMISSION&&!!material.transmissionMap;const HAS_THICKNESSMAP=HAS_TRANSMISSION&&!!material.thicknessMap;const HAS_GRADIENTMAP=!!material.gradientMap;const HAS_ALPHAMAP=!!material.alphaMap;const HAS_ALPHATEST=material.alphaTest>0;const HAS_ALPHAHASH=!!material.alphaHash;const HAS_EXTENSIONS=!!material.extensions;let toneMapping=NoToneMapping$1;if(material.toneMapped){if(currentRenderTarget===null||currentRenderTarget.isXRRenderTarget===true){toneMapping=renderer.toneMapping;}}const parameters={shaderID:shaderID,shaderType:material.type,shaderName:material.name,vertexShader:vertexShader,fragmentShader:fragmentShader,defines:material.defines,customVertexShaderID:customVertexShaderID,customFragmentShaderID:customFragmentShaderID,isRawShaderMaterial:material.isRawShaderMaterial===true,glslVersion:material.glslVersion,precision:precision,batching:IS_BATCHEDMESH,batchingColor:IS_BATCHEDMESH&&object._colorsTexture!==null,instancing:IS_INSTANCEDMESH,instancingColor:IS_INSTANCEDMESH&&object.instanceColor!==null,instancingMorph:IS_INSTANCEDMESH&&object.morphTexture!==null,supportsVertexTextures:SUPPORTS_VERTEX_TEXTURES,outputColorSpace:currentRenderTarget===null?renderer.outputColorSpace:currentRenderTarget.isXRRenderTarget===true?currentRenderTarget.texture.colorSpace:LinearSRGBColorSpace$1,alphaToCoverage:!!material.alphaToCoverage,map:HAS_MAP,matcap:HAS_MATCAP,envMap:HAS_ENVMAP,envMapMode:HAS_ENVMAP&&envMap.mapping,envMapCubeUVHeight:envMapCubeUVHeight,aoMap:HAS_AOMAP,lightMap:HAS_LIGHTMAP,bumpMap:HAS_BUMPMAP,normalMap:HAS_NORMALMAP,displacementMap:SUPPORTS_VERTEX_TEXTURES&&HAS_DISPLACEMENTMAP,emissiveMap:HAS_EMISSIVEMAP,normalMapObjectSpace:HAS_NORMALMAP&&material.normalMapType===ObjectSpaceNormalMap$1,normalMapTangentSpace:HAS_NORMALMAP&&material.normalMapType===TangentSpaceNormalMap$1,metalnessMap:HAS_METALNESSMAP,roughnessMap:HAS_ROUGHNESSMAP,anisotropy:HAS_ANISOTROPY,anisotropyMap:HAS_ANISOTROPYMAP,clearcoat:HAS_CLEARCOAT,clearcoatMap:HAS_CLEARCOATMAP,clearcoatNormalMap:HAS_CLEARCOAT_NORMALMAP,clearcoatRoughnessMap:HAS_CLEARCOAT_ROUGHNESSMAP,dispersion:HAS_DISPERSION,iridescence:HAS_IRIDESCENCE,iridescenceMap:HAS_IRIDESCENCEMAP,iridescenceThicknessMap:HAS_IRIDESCENCE_THICKNESSMAP,sheen:HAS_SHEEN,sheenColorMap:HAS_SHEEN_COLORMAP,sheenRoughnessMap:HAS_SHEEN_ROUGHNESSMAP,specularMap:HAS_SPECULARMAP,specularColorMap:HAS_SPECULAR_COLORMAP,specularIntensityMap:HAS_SPECULAR_INTENSITYMAP,transmission:HAS_TRANSMISSION,transmissionMap:HAS_TRANSMISSIONMAP,thicknessMap:HAS_THICKNESSMAP,gradientMap:HAS_GRADIENTMAP,opaque:material.transparent===false&&material.blending===NormalBlending$1&&material.alphaToCoverage===false,alphaMap:HAS_ALPHAMAP,alphaTest:HAS_ALPHATEST,alphaHash:HAS_ALPHAHASH,combine:material.combine,//
mapUv:HAS_MAP&&getChannel(material.map.channel),aoMapUv:HAS_AOMAP&&getChannel(material.aoMap.channel),lightMapUv:HAS_LIGHTMAP&&getChannel(material.lightMap.channel),bumpMapUv:HAS_BUMPMAP&&getChannel(material.bumpMap.channel),normalMapUv:HAS_NORMALMAP&&getChannel(material.normalMap.channel),displacementMapUv:HAS_DISPLACEMENTMAP&&getChannel(material.displacementMap.channel),emissiveMapUv:HAS_EMISSIVEMAP&&getChannel(material.emissiveMap.channel),metalnessMapUv:HAS_METALNESSMAP&&getChannel(material.metalnessMap.channel),roughnessMapUv:HAS_ROUGHNESSMAP&&getChannel(material.roughnessMap.channel),anisotropyMapUv:HAS_ANISOTROPYMAP&&getChannel(material.anisotropyMap.channel),clearcoatMapUv:HAS_CLEARCOATMAP&&getChannel(material.clearcoatMap.channel),clearcoatNormalMapUv:HAS_CLEARCOAT_NORMALMAP&&getChannel(material.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:HAS_CLEARCOAT_ROUGHNESSMAP&&getChannel(material.clearcoatRoughnessMap.channel),iridescenceMapUv:HAS_IRIDESCENCEMAP&&getChannel(material.iridescenceMap.channel),iridescenceThicknessMapUv:HAS_IRIDESCENCE_THICKNESSMAP&&getChannel(material.iridescenceThicknessMap.channel),sheenColorMapUv:HAS_SHEEN_COLORMAP&&getChannel(material.sheenColorMap.channel),sheenRoughnessMapUv:HAS_SHEEN_ROUGHNESSMAP&&getChannel(material.sheenRoughnessMap.channel),specularMapUv:HAS_SPECULARMAP&&getChannel(material.specularMap.channel),specularColorMapUv:HAS_SPECULAR_COLORMAP&&getChannel(material.specularColorMap.channel),specularIntensityMapUv:HAS_SPECULAR_INTENSITYMAP&&getChannel(material.specularIntensityMap.channel),transmissionMapUv:HAS_TRANSMISSIONMAP&&getChannel(material.transmissionMap.channel),thicknessMapUv:HAS_THICKNESSMAP&&getChannel(material.thicknessMap.channel),alphaMapUv:HAS_ALPHAMAP&&getChannel(material.alphaMap.channel),//
vertexTangents:!!geometry.attributes.tangent&&(HAS_NORMALMAP||HAS_ANISOTROPY),vertexColors:material.vertexColors,vertexAlphas:material.vertexColors===true&&!!geometry.attributes.color&&geometry.attributes.color.itemSize===4,pointsUvs:object.isPoints===true&&!!geometry.attributes.uv&&(HAS_MAP||HAS_ALPHAMAP),fog:!!fog,useFog:material.fog===true,fogExp2:!!fog&&fog.isFogExp2,flatShading:material.flatShading===true,sizeAttenuation:material.sizeAttenuation===true,logarithmicDepthBuffer:logarithmicDepthBuffer,skinning:object.isSkinnedMesh===true,morphTargets:geometry.morphAttributes.position!==undefined,morphNormals:geometry.morphAttributes.normal!==undefined,morphColors:geometry.morphAttributes.color!==undefined,morphTargetsCount:morphTargetsCount,morphTextureStride:morphTextureStride,numDirLights:lights.directional.length,numPointLights:lights.point.length,numSpotLights:lights.spot.length,numSpotLightMaps:lights.spotLightMap.length,numRectAreaLights:lights.rectArea.length,numHemiLights:lights.hemi.length,numDirLightShadows:lights.directionalShadowMap.length,numPointLightShadows:lights.pointShadowMap.length,numSpotLightShadows:lights.spotShadowMap.length,numSpotLightShadowsWithMaps:lights.numSpotLightShadowsWithMaps,numLightProbes:lights.numLightProbes,numClippingPlanes:clipping.numPlanes,numClipIntersection:clipping.numIntersection,dithering:material.dithering,shadowMapEnabled:renderer.shadowMap.enabled&&shadows.length>0,shadowMapType:renderer.shadowMap.type,toneMapping:toneMapping,decodeVideoTexture:HAS_MAP&&material.map.isVideoTexture===true&&ColorManagement$1.getTransfer(material.map.colorSpace)===SRGBTransfer$1,premultipliedAlpha:material.premultipliedAlpha,doubleSided:material.side===DoubleSide,flipSided:material.side===BackSide$1,useDepthPacking:material.depthPacking>=0,depthPacking:material.depthPacking||0,index0AttributeName:material.index0AttributeName,extensionClipCullDistance:HAS_EXTENSIONS&&material.extensions.clipCullDistance===true&&extensions.has('WEBGL_clip_cull_distance'),extensionMultiDraw:(HAS_EXTENSIONS&&material.extensions.multiDraw===true||IS_BATCHEDMESH)&&extensions.has('WEBGL_multi_draw'),rendererExtensionParallelShaderCompile:extensions.has('KHR_parallel_shader_compile'),customProgramCacheKey:material.customProgramCacheKey()};// the usage of getChannel() determines the active texture channels for this shader
parameters.vertexUv1s=_activeChannels.has(1);parameters.vertexUv2s=_activeChannels.has(2);parameters.vertexUv3s=_activeChannels.has(3);_activeChannels.clear();return parameters;}function getProgramCacheKey(parameters){const array=[];if(parameters.shaderID){array.push(parameters.shaderID);}else {array.push(parameters.customVertexShaderID);array.push(parameters.customFragmentShaderID);}if(parameters.defines!==undefined){for(const name in parameters.defines){array.push(name);array.push(parameters.defines[name]);}}if(parameters.isRawShaderMaterial===false){getProgramCacheKeyParameters(array,parameters);getProgramCacheKeyBooleans(array,parameters);array.push(renderer.outputColorSpace);}array.push(parameters.customProgramCacheKey);return array.join();}function getProgramCacheKeyParameters(array,parameters){array.push(parameters.precision);array.push(parameters.outputColorSpace);array.push(parameters.envMapMode);array.push(parameters.envMapCubeUVHeight);array.push(parameters.mapUv);array.push(parameters.alphaMapUv);array.push(parameters.lightMapUv);array.push(parameters.aoMapUv);array.push(parameters.bumpMapUv);array.push(parameters.normalMapUv);array.push(parameters.displacementMapUv);array.push(parameters.emissiveMapUv);array.push(parameters.metalnessMapUv);array.push(parameters.roughnessMapUv);array.push(parameters.anisotropyMapUv);array.push(parameters.clearcoatMapUv);array.push(parameters.clearcoatNormalMapUv);array.push(parameters.clearcoatRoughnessMapUv);array.push(parameters.iridescenceMapUv);array.push(parameters.iridescenceThicknessMapUv);array.push(parameters.sheenColorMapUv);array.push(parameters.sheenRoughnessMapUv);array.push(parameters.specularMapUv);array.push(parameters.specularColorMapUv);array.push(parameters.specularIntensityMapUv);array.push(parameters.transmissionMapUv);array.push(parameters.thicknessMapUv);array.push(parameters.combine);array.push(parameters.fogExp2);array.push(parameters.sizeAttenuation);array.push(parameters.morphTargetsCount);array.push(parameters.morphAttributeCount);array.push(parameters.numDirLights);array.push(parameters.numPointLights);array.push(parameters.numSpotLights);array.push(parameters.numSpotLightMaps);array.push(parameters.numHemiLights);array.push(parameters.numRectAreaLights);array.push(parameters.numDirLightShadows);array.push(parameters.numPointLightShadows);array.push(parameters.numSpotLightShadows);array.push(parameters.numSpotLightShadowsWithMaps);array.push(parameters.numLightProbes);array.push(parameters.shadowMapType);array.push(parameters.toneMapping);array.push(parameters.numClippingPlanes);array.push(parameters.numClipIntersection);array.push(parameters.depthPacking);}function getProgramCacheKeyBooleans(array,parameters){_programLayers.disableAll();if(parameters.supportsVertexTextures)_programLayers.enable(0);if(parameters.instancing)_programLayers.enable(1);if(parameters.instancingColor)_programLayers.enable(2);if(parameters.instancingMorph)_programLayers.enable(3);if(parameters.matcap)_programLayers.enable(4);if(parameters.envMap)_programLayers.enable(5);if(parameters.normalMapObjectSpace)_programLayers.enable(6);if(parameters.normalMapTangentSpace)_programLayers.enable(7);if(parameters.clearcoat)_programLayers.enable(8);if(parameters.iridescence)_programLayers.enable(9);if(parameters.alphaTest)_programLayers.enable(10);if(parameters.vertexColors)_programLayers.enable(11);if(parameters.vertexAlphas)_programLayers.enable(12);if(parameters.vertexUv1s)_programLayers.enable(13);if(parameters.vertexUv2s)_programLayers.enable(14);if(parameters.vertexUv3s)_programLayers.enable(15);if(parameters.vertexTangents)_programLayers.enable(16);if(parameters.anisotropy)_programLayers.enable(17);if(parameters.alphaHash)_programLayers.enable(18);if(parameters.batching)_programLayers.enable(19);if(parameters.dispersion)_programLayers.enable(20);if(parameters.batchingColor)_programLayers.enable(21);array.push(_programLayers.mask);_programLayers.disableAll();if(parameters.fog)_programLayers.enable(0);if(parameters.useFog)_programLayers.enable(1);if(parameters.flatShading)_programLayers.enable(2);if(parameters.logarithmicDepthBuffer)_programLayers.enable(3);if(parameters.skinning)_programLayers.enable(4);if(parameters.morphTargets)_programLayers.enable(5);if(parameters.morphNormals)_programLayers.enable(6);if(parameters.morphColors)_programLayers.enable(7);if(parameters.premultipliedAlpha)_programLayers.enable(8);if(parameters.shadowMapEnabled)_programLayers.enable(9);if(parameters.doubleSided)_programLayers.enable(10);if(parameters.flipSided)_programLayers.enable(11);if(parameters.useDepthPacking)_programLayers.enable(12);if(parameters.dithering)_programLayers.enable(13);if(parameters.transmission)_programLayers.enable(14);if(parameters.sheen)_programLayers.enable(15);if(parameters.opaque)_programLayers.enable(16);if(parameters.pointsUvs)_programLayers.enable(17);if(parameters.decodeVideoTexture)_programLayers.enable(18);if(parameters.alphaToCoverage)_programLayers.enable(19);array.push(_programLayers.mask);}function getUniforms(material){const shaderID=shaderIDs[material.type];let uniforms;if(shaderID){const shader=ShaderLib[shaderID];uniforms=UniformsUtils.clone(shader.uniforms);}else {uniforms=material.uniforms;}return uniforms;}function acquireProgram(parameters,cacheKey){let program;// Check if code has been already compiled
for(let p=0,pl=programs.length;p<pl;p++){const preexistingProgram=programs[p];if(preexistingProgram.cacheKey===cacheKey){program=preexistingProgram;++program.usedTimes;break;}}if(program===undefined){program=new WebGLProgram(renderer,cacheKey,parameters,bindingStates);programs.push(program);}return program;}function releaseProgram(program){if(--program.usedTimes===0){// Remove from unordered set
const i=programs.indexOf(program);programs[i]=programs[programs.length-1];programs.pop();// Free WebGL resources
program.destroy();}}function releaseShaderCache(material){_customShaders.remove(material);}function dispose(){_customShaders.dispose();}return {getParameters:getParameters,getProgramCacheKey:getProgramCacheKey,getUniforms:getUniforms,acquireProgram:acquireProgram,releaseProgram:releaseProgram,releaseShaderCache:releaseShaderCache,// Exposed for resource monitoring & error feedback via renderer.info:
programs:programs,dispose:dispose};}function WebGLProperties(){let properties=new WeakMap();function has(object){return properties.has(object);}function get(object){let map=properties.get(object);if(map===undefined){map={};properties.set(object,map);}return map;}function remove(object){properties.delete(object);}function update(object,key,value){properties.get(object)[key]=value;}function dispose(){properties=new WeakMap();}return {has:has,get:get,remove:remove,update:update,dispose:dispose};}function painterSortStable(a,b){if(a.groupOrder!==b.groupOrder){return a.groupOrder-b.groupOrder;}else if(a.renderOrder!==b.renderOrder){return a.renderOrder-b.renderOrder;}else if(a.material.id!==b.material.id){return a.material.id-b.material.id;}else if(a.z!==b.z){return a.z-b.z;}else {return a.id-b.id;}}function reversePainterSortStable(a,b){if(a.groupOrder!==b.groupOrder){return a.groupOrder-b.groupOrder;}else if(a.renderOrder!==b.renderOrder){return a.renderOrder-b.renderOrder;}else if(a.z!==b.z){return b.z-a.z;}else {return a.id-b.id;}}function WebGLRenderList(){const renderItems=[];let renderItemsIndex=0;const opaque=[];const transmissive=[];const transparent=[];function init(){renderItemsIndex=0;opaque.length=0;transmissive.length=0;transparent.length=0;}function getNextRenderItem(object,geometry,material,groupOrder,z,group){let renderItem=renderItems[renderItemsIndex];if(renderItem===undefined){renderItem={id:object.id,object:object,geometry:geometry,material:material,groupOrder:groupOrder,renderOrder:object.renderOrder,z:z,group:group};renderItems[renderItemsIndex]=renderItem;}else {renderItem.id=object.id;renderItem.object=object;renderItem.geometry=geometry;renderItem.material=material;renderItem.groupOrder=groupOrder;renderItem.renderOrder=object.renderOrder;renderItem.z=z;renderItem.group=group;}renderItemsIndex++;return renderItem;}function push(object,geometry,material,groupOrder,z,group){const renderItem=getNextRenderItem(object,geometry,material,groupOrder,z,group);if(material.transmission>0.0){transmissive.push(renderItem);}else if(material.transparent===true){transparent.push(renderItem);}else {opaque.push(renderItem);}}function unshift(object,geometry,material,groupOrder,z,group){const renderItem=getNextRenderItem(object,geometry,material,groupOrder,z,group);if(material.transmission>0.0){transmissive.unshift(renderItem);}else if(material.transparent===true){transparent.unshift(renderItem);}else {opaque.unshift(renderItem);}}function sort(customOpaqueSort,customTransparentSort){if(opaque.length>1)opaque.sort(customOpaqueSort||painterSortStable);if(transmissive.length>1)transmissive.sort(customTransparentSort||reversePainterSortStable);if(transparent.length>1)transparent.sort(customTransparentSort||reversePainterSortStable);}function finish(){// Clear references from inactive renderItems in the list
for(let i=renderItemsIndex,il=renderItems.length;i<il;i++){const renderItem=renderItems[i];if(renderItem.id===null)break;renderItem.id=null;renderItem.object=null;renderItem.geometry=null;renderItem.material=null;renderItem.group=null;}}return {opaque:opaque,transmissive:transmissive,transparent:transparent,init:init,push:push,unshift:unshift,finish:finish,sort:sort};}function WebGLRenderLists(){let lists=new WeakMap();function get(scene,renderCallDepth){const listArray=lists.get(scene);let list;if(listArray===undefined){list=new WebGLRenderList();lists.set(scene,[list]);}else {if(renderCallDepth>=listArray.length){list=new WebGLRenderList();listArray.push(list);}else {list=listArray[renderCallDepth];}}return list;}function dispose(){lists=new WeakMap();}return {get:get,dispose:dispose};}function UniformsCache(){const lights={};return {get:function(light){if(lights[light.id]!==undefined){return lights[light.id];}let uniforms;switch(light.type){case'DirectionalLight':uniforms={direction:new Vector3$1(),color:new Color$1()};break;case'SpotLight':uniforms={position:new Vector3$1(),direction:new Vector3$1(),color:new Color$1(),distance:0,coneCos:0,penumbraCos:0,decay:0};break;case'PointLight':uniforms={position:new Vector3$1(),color:new Color$1(),distance:0,decay:0};break;case'HemisphereLight':uniforms={direction:new Vector3$1(),skyColor:new Color$1(),groundColor:new Color$1()};break;case'RectAreaLight':uniforms={color:new Color$1(),position:new Vector3$1(),halfWidth:new Vector3$1(),halfHeight:new Vector3$1()};break;}lights[light.id]=uniforms;return uniforms;}};}function ShadowUniformsCache(){const lights={};return {get:function(light){if(lights[light.id]!==undefined){return lights[light.id];}let uniforms;switch(light.type){case'DirectionalLight':uniforms={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2$1()};break;case'SpotLight':uniforms={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2$1()};break;case'PointLight':uniforms={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2$1(),shadowCameraNear:1,shadowCameraFar:1000};break;// TODO (abelnation): set RectAreaLight shadow uniforms
}lights[light.id]=uniforms;return uniforms;}};}let nextVersion=0;function shadowCastingAndTexturingLightsFirst(lightA,lightB){return (lightB.castShadow?2:0)-(lightA.castShadow?2:0)+(lightB.map?1:0)-(lightA.map?1:0);}function WebGLLights(extensions){const cache=new UniformsCache();const shadowCache=ShadowUniformsCache();const state={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let i=0;i<9;i++)state.probe.push(new Vector3$1());const vector3=new Vector3$1();const matrix4=new Matrix4$1();const matrix42=new Matrix4$1();function setup(lights){let r=0,g=0,b=0;for(let i=0;i<9;i++)state.probe[i].set(0,0,0);let directionalLength=0;let pointLength=0;let spotLength=0;let rectAreaLength=0;let hemiLength=0;let numDirectionalShadows=0;let numPointShadows=0;let numSpotShadows=0;let numSpotMaps=0;let numSpotShadowsWithMaps=0;let numLightProbes=0;// ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]
lights.sort(shadowCastingAndTexturingLightsFirst);for(let i=0,l=lights.length;i<l;i++){const light=lights[i];const color=light.color;const intensity=light.intensity;const distance=light.distance;const shadowMap=light.shadow&&light.shadow.map?light.shadow.map.texture:null;if(light.isAmbientLight){r+=color.r*intensity;g+=color.g*intensity;b+=color.b*intensity;}else if(light.isLightProbe){for(let j=0;j<9;j++){state.probe[j].addScaledVector(light.sh.coefficients[j],intensity);}numLightProbes++;}else if(light.isDirectionalLight){const uniforms=cache.get(light);uniforms.color.copy(light.color).multiplyScalar(light.intensity);if(light.castShadow){const shadow=light.shadow;const shadowUniforms=shadowCache.get(light);shadowUniforms.shadowIntensity=shadow.intensity;shadowUniforms.shadowBias=shadow.bias;shadowUniforms.shadowNormalBias=shadow.normalBias;shadowUniforms.shadowRadius=shadow.radius;shadowUniforms.shadowMapSize=shadow.mapSize;state.directionalShadow[directionalLength]=shadowUniforms;state.directionalShadowMap[directionalLength]=shadowMap;state.directionalShadowMatrix[directionalLength]=light.shadow.matrix;numDirectionalShadows++;}state.directional[directionalLength]=uniforms;directionalLength++;}else if(light.isSpotLight){const uniforms=cache.get(light);uniforms.position.setFromMatrixPosition(light.matrixWorld);uniforms.color.copy(color).multiplyScalar(intensity);uniforms.distance=distance;uniforms.coneCos=Math.cos(light.angle);uniforms.penumbraCos=Math.cos(light.angle*(1-light.penumbra));uniforms.decay=light.decay;state.spot[spotLength]=uniforms;const shadow=light.shadow;if(light.map){state.spotLightMap[numSpotMaps]=light.map;numSpotMaps++;// make sure the lightMatrix is up to date
// TODO : do it if required only
shadow.updateMatrices(light);if(light.castShadow)numSpotShadowsWithMaps++;}state.spotLightMatrix[spotLength]=shadow.matrix;if(light.castShadow){const shadowUniforms=shadowCache.get(light);shadowUniforms.shadowIntensity=shadow.intensity;shadowUniforms.shadowBias=shadow.bias;shadowUniforms.shadowNormalBias=shadow.normalBias;shadowUniforms.shadowRadius=shadow.radius;shadowUniforms.shadowMapSize=shadow.mapSize;state.spotShadow[spotLength]=shadowUniforms;state.spotShadowMap[spotLength]=shadowMap;numSpotShadows++;}spotLength++;}else if(light.isRectAreaLight){const uniforms=cache.get(light);uniforms.color.copy(color).multiplyScalar(intensity);uniforms.halfWidth.set(light.width*0.5,0.0,0.0);uniforms.halfHeight.set(0.0,light.height*0.5,0.0);state.rectArea[rectAreaLength]=uniforms;rectAreaLength++;}else if(light.isPointLight){const uniforms=cache.get(light);uniforms.color.copy(light.color).multiplyScalar(light.intensity);uniforms.distance=light.distance;uniforms.decay=light.decay;if(light.castShadow){const shadow=light.shadow;const shadowUniforms=shadowCache.get(light);shadowUniforms.shadowIntensity=shadow.intensity;shadowUniforms.shadowBias=shadow.bias;shadowUniforms.shadowNormalBias=shadow.normalBias;shadowUniforms.shadowRadius=shadow.radius;shadowUniforms.shadowMapSize=shadow.mapSize;shadowUniforms.shadowCameraNear=shadow.camera.near;shadowUniforms.shadowCameraFar=shadow.camera.far;state.pointShadow[pointLength]=shadowUniforms;state.pointShadowMap[pointLength]=shadowMap;state.pointShadowMatrix[pointLength]=light.shadow.matrix;numPointShadows++;}state.point[pointLength]=uniforms;pointLength++;}else if(light.isHemisphereLight){const uniforms=cache.get(light);uniforms.skyColor.copy(light.color).multiplyScalar(intensity);uniforms.groundColor.copy(light.groundColor).multiplyScalar(intensity);state.hemi[hemiLength]=uniforms;hemiLength++;}}if(rectAreaLength>0){if(extensions.has('OES_texture_float_linear')===true){state.rectAreaLTC1=UniformsLib.LTC_FLOAT_1;state.rectAreaLTC2=UniformsLib.LTC_FLOAT_2;}else {state.rectAreaLTC1=UniformsLib.LTC_HALF_1;state.rectAreaLTC2=UniformsLib.LTC_HALF_2;}}state.ambient[0]=r;state.ambient[1]=g;state.ambient[2]=b;const hash=state.hash;if(hash.directionalLength!==directionalLength||hash.pointLength!==pointLength||hash.spotLength!==spotLength||hash.rectAreaLength!==rectAreaLength||hash.hemiLength!==hemiLength||hash.numDirectionalShadows!==numDirectionalShadows||hash.numPointShadows!==numPointShadows||hash.numSpotShadows!==numSpotShadows||hash.numSpotMaps!==numSpotMaps||hash.numLightProbes!==numLightProbes){state.directional.length=directionalLength;state.spot.length=spotLength;state.rectArea.length=rectAreaLength;state.point.length=pointLength;state.hemi.length=hemiLength;state.directionalShadow.length=numDirectionalShadows;state.directionalShadowMap.length=numDirectionalShadows;state.pointShadow.length=numPointShadows;state.pointShadowMap.length=numPointShadows;state.spotShadow.length=numSpotShadows;state.spotShadowMap.length=numSpotShadows;state.directionalShadowMatrix.length=numDirectionalShadows;state.pointShadowMatrix.length=numPointShadows;state.spotLightMatrix.length=numSpotShadows+numSpotMaps-numSpotShadowsWithMaps;state.spotLightMap.length=numSpotMaps;state.numSpotLightShadowsWithMaps=numSpotShadowsWithMaps;state.numLightProbes=numLightProbes;hash.directionalLength=directionalLength;hash.pointLength=pointLength;hash.spotLength=spotLength;hash.rectAreaLength=rectAreaLength;hash.hemiLength=hemiLength;hash.numDirectionalShadows=numDirectionalShadows;hash.numPointShadows=numPointShadows;hash.numSpotShadows=numSpotShadows;hash.numSpotMaps=numSpotMaps;hash.numLightProbes=numLightProbes;state.version=nextVersion++;}}function setupView(lights,camera){let directionalLength=0;let pointLength=0;let spotLength=0;let rectAreaLength=0;let hemiLength=0;const viewMatrix=camera.matrixWorldInverse;for(let i=0,l=lights.length;i<l;i++){const light=lights[i];if(light.isDirectionalLight){const uniforms=state.directional[directionalLength];uniforms.direction.setFromMatrixPosition(light.matrixWorld);vector3.setFromMatrixPosition(light.target.matrixWorld);uniforms.direction.sub(vector3);uniforms.direction.transformDirection(viewMatrix);directionalLength++;}else if(light.isSpotLight){const uniforms=state.spot[spotLength];uniforms.position.setFromMatrixPosition(light.matrixWorld);uniforms.position.applyMatrix4(viewMatrix);uniforms.direction.setFromMatrixPosition(light.matrixWorld);vector3.setFromMatrixPosition(light.target.matrixWorld);uniforms.direction.sub(vector3);uniforms.direction.transformDirection(viewMatrix);spotLength++;}else if(light.isRectAreaLight){const uniforms=state.rectArea[rectAreaLength];uniforms.position.setFromMatrixPosition(light.matrixWorld);uniforms.position.applyMatrix4(viewMatrix);// extract local rotation of light to derive width/height half vectors
matrix42.identity();matrix4.copy(light.matrixWorld);matrix4.premultiply(viewMatrix);matrix42.extractRotation(matrix4);uniforms.halfWidth.set(light.width*0.5,0.0,0.0);uniforms.halfHeight.set(0.0,light.height*0.5,0.0);uniforms.halfWidth.applyMatrix4(matrix42);uniforms.halfHeight.applyMatrix4(matrix42);rectAreaLength++;}else if(light.isPointLight){const uniforms=state.point[pointLength];uniforms.position.setFromMatrixPosition(light.matrixWorld);uniforms.position.applyMatrix4(viewMatrix);pointLength++;}else if(light.isHemisphereLight){const uniforms=state.hemi[hemiLength];uniforms.direction.setFromMatrixPosition(light.matrixWorld);uniforms.direction.transformDirection(viewMatrix);hemiLength++;}}}return {setup:setup,setupView:setupView,state:state};}function WebGLRenderState(extensions){const lights=new WebGLLights(extensions);const lightsArray=[];const shadowsArray=[];function init(camera){state.camera=camera;lightsArray.length=0;shadowsArray.length=0;}function pushLight(light){lightsArray.push(light);}function pushShadow(shadowLight){shadowsArray.push(shadowLight);}function setupLights(){lights.setup(lightsArray);}function setupLightsView(camera){lights.setupView(lightsArray,camera);}const state={lightsArray:lightsArray,shadowsArray:shadowsArray,camera:null,lights:lights,transmissionRenderTarget:{}};return {init:init,state:state,setupLights:setupLights,setupLightsView:setupLightsView,pushLight:pushLight,pushShadow:pushShadow};}function WebGLRenderStates(extensions){let renderStates=new WeakMap();function get(scene,renderCallDepth=0){const renderStateArray=renderStates.get(scene);let renderState;if(renderStateArray===undefined){renderState=new WebGLRenderState(extensions);renderStates.set(scene,[renderState]);}else {if(renderCallDepth>=renderStateArray.length){renderState=new WebGLRenderState(extensions);renderStateArray.push(renderState);}else {renderState=renderStateArray[renderCallDepth];}}return renderState;}function dispose(){renderStates=new WeakMap();}return {get:get,dispose:dispose};}class MeshDepthMaterial extends Material$1{constructor(parameters){super();this.isMeshDepthMaterial=true;this.type='MeshDepthMaterial';this.depthPacking=BasicDepthPacking;this.map=null;this.alphaMap=null;this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.wireframe=false;this.wireframeLinewidth=1;this.setValues(parameters);}copy(source){super.copy(source);this.depthPacking=source.depthPacking;this.map=source.map;this.alphaMap=source.alphaMap;this.displacementMap=source.displacementMap;this.displacementScale=source.displacementScale;this.displacementBias=source.displacementBias;this.wireframe=source.wireframe;this.wireframeLinewidth=source.wireframeLinewidth;return this;}}class MeshDistanceMaterial extends Material$1{constructor(parameters){super();this.isMeshDistanceMaterial=true;this.type='MeshDistanceMaterial';this.map=null;this.alphaMap=null;this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.setValues(parameters);}copy(source){super.copy(source);this.map=source.map;this.alphaMap=source.alphaMap;this.displacementMap=source.displacementMap;this.displacementScale=source.displacementScale;this.displacementBias=source.displacementBias;return this;}}const vertex="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";const fragment="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function WebGLShadowMap(renderer,objects,capabilities){let _frustum=new Frustum();const _shadowMapSize=new Vector2$1(),_viewportSize=new Vector2$1(),_viewport=new Vector4$1(),_depthMaterial=new MeshDepthMaterial({depthPacking:RGBADepthPacking}),_distanceMaterial=new MeshDistanceMaterial(),_materialCache={},_maxTextureSize=capabilities.maxTextureSize;const shadowSide={[FrontSide$1]:BackSide$1,[BackSide$1]:FrontSide$1,[DoubleSide]:DoubleSide};const shadowMaterialVertical=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2$1()},radius:{value:4.0}},vertexShader:vertex,fragmentShader:fragment});const shadowMaterialHorizontal=shadowMaterialVertical.clone();shadowMaterialHorizontal.defines.HORIZONTAL_PASS=1;const fullScreenTri=new BufferGeometry$1();fullScreenTri.setAttribute('position',new BufferAttribute$1(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));const fullScreenMesh=new Mesh$1(fullScreenTri,shadowMaterialVertical);const scope=this;this.enabled=false;this.autoUpdate=true;this.needsUpdate=false;this.type=PCFShadowMap;let _previousType=this.type;this.render=function(lights,scene,camera){if(scope.enabled===false)return;if(scope.autoUpdate===false&&scope.needsUpdate===false)return;if(lights.length===0)return;const currentRenderTarget=renderer.getRenderTarget();const activeCubeFace=renderer.getActiveCubeFace();const activeMipmapLevel=renderer.getActiveMipmapLevel();const _state=renderer.state;// Set GL state for depth map.
_state.setBlending(NoBlending);_state.buffers.color.setClear(1,1,1,1);_state.buffers.depth.setTest(true);_state.setScissorTest(false);// check for shadow map type changes
const toVSM=_previousType!==VSMShadowMap&&this.type===VSMShadowMap;const fromVSM=_previousType===VSMShadowMap&&this.type!==VSMShadowMap;// render depth map
for(let i=0,il=lights.length;i<il;i++){const light=lights[i];const shadow=light.shadow;if(shadow===undefined){console.warn('THREE.WebGLShadowMap:',light,'has no shadow.');continue;}if(shadow.autoUpdate===false&&shadow.needsUpdate===false)continue;_shadowMapSize.copy(shadow.mapSize);const shadowFrameExtents=shadow.getFrameExtents();_shadowMapSize.multiply(shadowFrameExtents);_viewportSize.copy(shadow.mapSize);if(_shadowMapSize.x>_maxTextureSize||_shadowMapSize.y>_maxTextureSize){if(_shadowMapSize.x>_maxTextureSize){_viewportSize.x=Math.floor(_maxTextureSize/shadowFrameExtents.x);_shadowMapSize.x=_viewportSize.x*shadowFrameExtents.x;shadow.mapSize.x=_viewportSize.x;}if(_shadowMapSize.y>_maxTextureSize){_viewportSize.y=Math.floor(_maxTextureSize/shadowFrameExtents.y);_shadowMapSize.y=_viewportSize.y*shadowFrameExtents.y;shadow.mapSize.y=_viewportSize.y;}}if(shadow.map===null||toVSM===true||fromVSM===true){const pars=this.type!==VSMShadowMap?{minFilter:NearestFilter$1,magFilter:NearestFilter$1}:{};if(shadow.map!==null){shadow.map.dispose();}shadow.map=new WebGLRenderTarget(_shadowMapSize.x,_shadowMapSize.y,pars);shadow.map.texture.name=light.name+'.shadowMap';shadow.camera.updateProjectionMatrix();}renderer.setRenderTarget(shadow.map);renderer.clear();const viewportCount=shadow.getViewportCount();for(let vp=0;vp<viewportCount;vp++){const viewport=shadow.getViewport(vp);_viewport.set(_viewportSize.x*viewport.x,_viewportSize.y*viewport.y,_viewportSize.x*viewport.z,_viewportSize.y*viewport.w);_state.viewport(_viewport);shadow.updateMatrices(light,vp);_frustum=shadow.getFrustum();renderObject(scene,camera,shadow.camera,light,this.type);}// do blur pass for VSM
if(shadow.isPointLightShadow!==true&&this.type===VSMShadowMap){VSMPass(shadow,camera);}shadow.needsUpdate=false;}_previousType=this.type;scope.needsUpdate=false;renderer.setRenderTarget(currentRenderTarget,activeCubeFace,activeMipmapLevel);};function VSMPass(shadow,camera){const geometry=objects.update(fullScreenMesh);if(shadowMaterialVertical.defines.VSM_SAMPLES!==shadow.blurSamples){shadowMaterialVertical.defines.VSM_SAMPLES=shadow.blurSamples;shadowMaterialHorizontal.defines.VSM_SAMPLES=shadow.blurSamples;shadowMaterialVertical.needsUpdate=true;shadowMaterialHorizontal.needsUpdate=true;}if(shadow.mapPass===null){shadow.mapPass=new WebGLRenderTarget(_shadowMapSize.x,_shadowMapSize.y);}// vertical pass
shadowMaterialVertical.uniforms.shadow_pass.value=shadow.map.texture;shadowMaterialVertical.uniforms.resolution.value=shadow.mapSize;shadowMaterialVertical.uniforms.radius.value=shadow.radius;renderer.setRenderTarget(shadow.mapPass);renderer.clear();renderer.renderBufferDirect(camera,null,geometry,shadowMaterialVertical,fullScreenMesh,null);// horizontal pass
shadowMaterialHorizontal.uniforms.shadow_pass.value=shadow.mapPass.texture;shadowMaterialHorizontal.uniforms.resolution.value=shadow.mapSize;shadowMaterialHorizontal.uniforms.radius.value=shadow.radius;renderer.setRenderTarget(shadow.map);renderer.clear();renderer.renderBufferDirect(camera,null,geometry,shadowMaterialHorizontal,fullScreenMesh,null);}function getDepthMaterial(object,material,light,type){let result=null;const customMaterial=light.isPointLight===true?object.customDistanceMaterial:object.customDepthMaterial;if(customMaterial!==undefined){result=customMaterial;}else {result=light.isPointLight===true?_distanceMaterial:_depthMaterial;if(renderer.localClippingEnabled&&material.clipShadows===true&&Array.isArray(material.clippingPlanes)&&material.clippingPlanes.length!==0||material.displacementMap&&material.displacementScale!==0||material.alphaMap&&material.alphaTest>0||material.map&&material.alphaTest>0){// in this case we need a unique material instance reflecting the
// appropriate state
const keyA=result.uuid,keyB=material.uuid;let materialsForVariant=_materialCache[keyA];if(materialsForVariant===undefined){materialsForVariant={};_materialCache[keyA]=materialsForVariant;}let cachedMaterial=materialsForVariant[keyB];if(cachedMaterial===undefined){cachedMaterial=result.clone();materialsForVariant[keyB]=cachedMaterial;material.addEventListener('dispose',onMaterialDispose);}result=cachedMaterial;}}result.visible=material.visible;result.wireframe=material.wireframe;if(type===VSMShadowMap){result.side=material.shadowSide!==null?material.shadowSide:material.side;}else {result.side=material.shadowSide!==null?material.shadowSide:shadowSide[material.side];}result.alphaMap=material.alphaMap;result.alphaTest=material.alphaTest;result.map=material.map;result.clipShadows=material.clipShadows;result.clippingPlanes=material.clippingPlanes;result.clipIntersection=material.clipIntersection;result.displacementMap=material.displacementMap;result.displacementScale=material.displacementScale;result.displacementBias=material.displacementBias;result.wireframeLinewidth=material.wireframeLinewidth;result.linewidth=material.linewidth;if(light.isPointLight===true&&result.isMeshDistanceMaterial===true){const materialProperties=renderer.properties.get(result);materialProperties.light=light;}return result;}function renderObject(object,camera,shadowCamera,light,type){if(object.visible===false)return;const visible=object.layers.test(camera.layers);if(visible&&(object.isMesh||object.isLine||object.isPoints)){if((object.castShadow||object.receiveShadow&&type===VSMShadowMap)&&(!object.frustumCulled||_frustum.intersectsObject(object))){object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse,object.matrixWorld);const geometry=objects.update(object);const material=object.material;if(Array.isArray(material)){const groups=geometry.groups;for(let k=0,kl=groups.length;k<kl;k++){const group=groups[k];const groupMaterial=material[group.materialIndex];if(groupMaterial&&groupMaterial.visible){const depthMaterial=getDepthMaterial(object,groupMaterial,light,type);object.onBeforeShadow(renderer,object,camera,shadowCamera,geometry,depthMaterial,group);renderer.renderBufferDirect(shadowCamera,null,geometry,depthMaterial,object,group);object.onAfterShadow(renderer,object,camera,shadowCamera,geometry,depthMaterial,group);}}}else if(material.visible){const depthMaterial=getDepthMaterial(object,material,light,type);object.onBeforeShadow(renderer,object,camera,shadowCamera,geometry,depthMaterial,null);renderer.renderBufferDirect(shadowCamera,null,geometry,depthMaterial,object,null);object.onAfterShadow(renderer,object,camera,shadowCamera,geometry,depthMaterial,null);}}}const children=object.children;for(let i=0,l=children.length;i<l;i++){renderObject(children[i],camera,shadowCamera,light,type);}}function onMaterialDispose(event){const material=event.target;material.removeEventListener('dispose',onMaterialDispose);// make sure to remove the unique distance/depth materials used for shadow map rendering
for(const id in _materialCache){const cache=_materialCache[id];const uuid=event.target.uuid;if(uuid in cache){const shadowMaterial=cache[uuid];shadowMaterial.dispose();delete cache[uuid];}}}}function WebGLState(gl){function ColorBuffer(){let locked=false;const color=new Vector4$1();let currentColorMask=null;const currentColorClear=new Vector4$1(0,0,0,0);return {setMask:function(colorMask){if(currentColorMask!==colorMask&&!locked){gl.colorMask(colorMask,colorMask,colorMask,colorMask);currentColorMask=colorMask;}},setLocked:function(lock){locked=lock;},setClear:function(r,g,b,a,premultipliedAlpha){if(premultipliedAlpha===true){r*=a;g*=a;b*=a;}color.set(r,g,b,a);if(currentColorClear.equals(color)===false){gl.clearColor(r,g,b,a);currentColorClear.copy(color);}},reset:function(){locked=false;currentColorMask=null;currentColorClear.set(-1,0,0,0);// set to invalid state
}};}function DepthBuffer(){let locked=false;let currentDepthMask=null;let currentDepthFunc=null;let currentDepthClear=null;return {setTest:function(depthTest){if(depthTest){enable(gl.DEPTH_TEST);}else {disable(gl.DEPTH_TEST);}},setMask:function(depthMask){if(currentDepthMask!==depthMask&&!locked){gl.depthMask(depthMask);currentDepthMask=depthMask;}},setFunc:function(depthFunc){if(currentDepthFunc!==depthFunc){switch(depthFunc){case NeverDepth:gl.depthFunc(gl.NEVER);break;case AlwaysDepth:gl.depthFunc(gl.ALWAYS);break;case LessDepth:gl.depthFunc(gl.LESS);break;case LessEqualDepth$1:gl.depthFunc(gl.LEQUAL);break;case EqualDepth:gl.depthFunc(gl.EQUAL);break;case GreaterEqualDepth:gl.depthFunc(gl.GEQUAL);break;case GreaterDepth:gl.depthFunc(gl.GREATER);break;case NotEqualDepth:gl.depthFunc(gl.NOTEQUAL);break;default:gl.depthFunc(gl.LEQUAL);}currentDepthFunc=depthFunc;}},setLocked:function(lock){locked=lock;},setClear:function(depth){if(currentDepthClear!==depth){gl.clearDepth(depth);currentDepthClear=depth;}},reset:function(){locked=false;currentDepthMask=null;currentDepthFunc=null;currentDepthClear=null;}};}function StencilBuffer(){let locked=false;let currentStencilMask=null;let currentStencilFunc=null;let currentStencilRef=null;let currentStencilFuncMask=null;let currentStencilFail=null;let currentStencilZFail=null;let currentStencilZPass=null;let currentStencilClear=null;return {setTest:function(stencilTest){if(!locked){if(stencilTest){enable(gl.STENCIL_TEST);}else {disable(gl.STENCIL_TEST);}}},setMask:function(stencilMask){if(currentStencilMask!==stencilMask&&!locked){gl.stencilMask(stencilMask);currentStencilMask=stencilMask;}},setFunc:function(stencilFunc,stencilRef,stencilMask){if(currentStencilFunc!==stencilFunc||currentStencilRef!==stencilRef||currentStencilFuncMask!==stencilMask){gl.stencilFunc(stencilFunc,stencilRef,stencilMask);currentStencilFunc=stencilFunc;currentStencilRef=stencilRef;currentStencilFuncMask=stencilMask;}},setOp:function(stencilFail,stencilZFail,stencilZPass){if(currentStencilFail!==stencilFail||currentStencilZFail!==stencilZFail||currentStencilZPass!==stencilZPass){gl.stencilOp(stencilFail,stencilZFail,stencilZPass);currentStencilFail=stencilFail;currentStencilZFail=stencilZFail;currentStencilZPass=stencilZPass;}},setLocked:function(lock){locked=lock;},setClear:function(stencil){if(currentStencilClear!==stencil){gl.clearStencil(stencil);currentStencilClear=stencil;}},reset:function(){locked=false;currentStencilMask=null;currentStencilFunc=null;currentStencilRef=null;currentStencilFuncMask=null;currentStencilFail=null;currentStencilZFail=null;currentStencilZPass=null;currentStencilClear=null;}};}//
const colorBuffer=new ColorBuffer();const depthBuffer=new DepthBuffer();const stencilBuffer=new StencilBuffer();const uboBindings=new WeakMap();const uboProgramMap=new WeakMap();let enabledCapabilities={};let currentBoundFramebuffers={};let currentDrawbuffers=new WeakMap();let defaultDrawbuffers=[];let currentProgram=null;let currentBlendingEnabled=false;let currentBlending=null;let currentBlendEquation=null;let currentBlendSrc=null;let currentBlendDst=null;let currentBlendEquationAlpha=null;let currentBlendSrcAlpha=null;let currentBlendDstAlpha=null;let currentBlendColor=new Color$1(0,0,0);let currentBlendAlpha=0;let currentPremultipledAlpha=false;let currentFlipSided=null;let currentCullFace=null;let currentLineWidth=null;let currentPolygonOffsetFactor=null;let currentPolygonOffsetUnits=null;const maxTextures=gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let lineWidthAvailable=false;let version=0;const glVersion=gl.getParameter(gl.VERSION);if(glVersion.indexOf('WebGL')!==-1){version=parseFloat(/^WebGL (\d)/.exec(glVersion)[1]);lineWidthAvailable=version>=1.0;}else if(glVersion.indexOf('OpenGL ES')!==-1){version=parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]);lineWidthAvailable=version>=2.0;}let currentTextureSlot=null;let currentBoundTextures={};const scissorParam=gl.getParameter(gl.SCISSOR_BOX);const viewportParam=gl.getParameter(gl.VIEWPORT);const currentScissor=new Vector4$1().fromArray(scissorParam);const currentViewport=new Vector4$1().fromArray(viewportParam);function createTexture(type,target,count,dimensions){const data=new Uint8Array(4);// 4 is required to match default unpack alignment of 4.
const texture=gl.createTexture();gl.bindTexture(type,texture);gl.texParameteri(type,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(type,gl.TEXTURE_MAG_FILTER,gl.NEAREST);for(let i=0;i<count;i++){if(type===gl.TEXTURE_3D||type===gl.TEXTURE_2D_ARRAY){gl.texImage3D(target,0,gl.RGBA,1,1,dimensions,0,gl.RGBA,gl.UNSIGNED_BYTE,data);}else {gl.texImage2D(target+i,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,data);}}return texture;}const emptyTextures={};emptyTextures[gl.TEXTURE_2D]=createTexture(gl.TEXTURE_2D,gl.TEXTURE_2D,1);emptyTextures[gl.TEXTURE_CUBE_MAP]=createTexture(gl.TEXTURE_CUBE_MAP,gl.TEXTURE_CUBE_MAP_POSITIVE_X,6);emptyTextures[gl.TEXTURE_2D_ARRAY]=createTexture(gl.TEXTURE_2D_ARRAY,gl.TEXTURE_2D_ARRAY,1,1);emptyTextures[gl.TEXTURE_3D]=createTexture(gl.TEXTURE_3D,gl.TEXTURE_3D,1,1);// init
colorBuffer.setClear(0,0,0,1);depthBuffer.setClear(1);stencilBuffer.setClear(0);enable(gl.DEPTH_TEST);depthBuffer.setFunc(LessEqualDepth$1);setFlipSided(false);setCullFace(CullFaceBack);enable(gl.CULL_FACE);setBlending(NoBlending);//
function enable(id){if(enabledCapabilities[id]!==true){gl.enable(id);enabledCapabilities[id]=true;}}function disable(id){if(enabledCapabilities[id]!==false){gl.disable(id);enabledCapabilities[id]=false;}}function bindFramebuffer(target,framebuffer){if(currentBoundFramebuffers[target]!==framebuffer){gl.bindFramebuffer(target,framebuffer);currentBoundFramebuffers[target]=framebuffer;// gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
if(target===gl.DRAW_FRAMEBUFFER){currentBoundFramebuffers[gl.FRAMEBUFFER]=framebuffer;}if(target===gl.FRAMEBUFFER){currentBoundFramebuffers[gl.DRAW_FRAMEBUFFER]=framebuffer;}return true;}return false;}function drawBuffers(renderTarget,framebuffer){let drawBuffers=defaultDrawbuffers;let needsUpdate=false;if(renderTarget){drawBuffers=currentDrawbuffers.get(framebuffer);if(drawBuffers===undefined){drawBuffers=[];currentDrawbuffers.set(framebuffer,drawBuffers);}const textures=renderTarget.textures;if(drawBuffers.length!==textures.length||drawBuffers[0]!==gl.COLOR_ATTACHMENT0){for(let i=0,il=textures.length;i<il;i++){drawBuffers[i]=gl.COLOR_ATTACHMENT0+i;}drawBuffers.length=textures.length;needsUpdate=true;}}else {if(drawBuffers[0]!==gl.BACK){drawBuffers[0]=gl.BACK;needsUpdate=true;}}if(needsUpdate){gl.drawBuffers(drawBuffers);}}function useProgram(program){if(currentProgram!==program){gl.useProgram(program);currentProgram=program;return true;}return false;}const equationToGL={[AddEquation$1]:gl.FUNC_ADD,[SubtractEquation]:gl.FUNC_SUBTRACT,[ReverseSubtractEquation]:gl.FUNC_REVERSE_SUBTRACT};equationToGL[MinEquation]=gl.MIN;equationToGL[MaxEquation]=gl.MAX;const factorToGL={[ZeroFactor]:gl.ZERO,[OneFactor]:gl.ONE,[SrcColorFactor]:gl.SRC_COLOR,[SrcAlphaFactor$1]:gl.SRC_ALPHA,[SrcAlphaSaturateFactor]:gl.SRC_ALPHA_SATURATE,[DstColorFactor]:gl.DST_COLOR,[DstAlphaFactor]:gl.DST_ALPHA,[OneMinusSrcColorFactor]:gl.ONE_MINUS_SRC_COLOR,[OneMinusSrcAlphaFactor$1]:gl.ONE_MINUS_SRC_ALPHA,[OneMinusDstColorFactor]:gl.ONE_MINUS_DST_COLOR,[OneMinusDstAlphaFactor]:gl.ONE_MINUS_DST_ALPHA,[ConstantColorFactor]:gl.CONSTANT_COLOR,[OneMinusConstantColorFactor]:gl.ONE_MINUS_CONSTANT_COLOR,[ConstantAlphaFactor]:gl.CONSTANT_ALPHA,[OneMinusConstantAlphaFactor]:gl.ONE_MINUS_CONSTANT_ALPHA};function setBlending(blending,blendEquation,blendSrc,blendDst,blendEquationAlpha,blendSrcAlpha,blendDstAlpha,blendColor,blendAlpha,premultipliedAlpha){if(blending===NoBlending){if(currentBlendingEnabled===true){disable(gl.BLEND);currentBlendingEnabled=false;}return;}if(currentBlendingEnabled===false){enable(gl.BLEND);currentBlendingEnabled=true;}if(blending!==CustomBlending){if(blending!==currentBlending||premultipliedAlpha!==currentPremultipledAlpha){if(currentBlendEquation!==AddEquation$1||currentBlendEquationAlpha!==AddEquation$1){gl.blendEquation(gl.FUNC_ADD);currentBlendEquation=AddEquation$1;currentBlendEquationAlpha=AddEquation$1;}if(premultipliedAlpha){switch(blending){case NormalBlending$1:gl.blendFuncSeparate(gl.ONE,gl.ONE_MINUS_SRC_ALPHA,gl.ONE,gl.ONE_MINUS_SRC_ALPHA);break;case AdditiveBlending$1:gl.blendFunc(gl.ONE,gl.ONE);break;case SubtractiveBlending:gl.blendFuncSeparate(gl.ZERO,gl.ONE_MINUS_SRC_COLOR,gl.ZERO,gl.ONE);break;case MultiplyBlending:gl.blendFuncSeparate(gl.ZERO,gl.SRC_COLOR,gl.ZERO,gl.SRC_ALPHA);break;default:console.error('THREE.WebGLState: Invalid blending: ',blending);break;}}else {switch(blending){case NormalBlending$1:gl.blendFuncSeparate(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA,gl.ONE,gl.ONE_MINUS_SRC_ALPHA);break;case AdditiveBlending$1:gl.blendFunc(gl.SRC_ALPHA,gl.ONE);break;case SubtractiveBlending:gl.blendFuncSeparate(gl.ZERO,gl.ONE_MINUS_SRC_COLOR,gl.ZERO,gl.ONE);break;case MultiplyBlending:gl.blendFunc(gl.ZERO,gl.SRC_COLOR);break;default:console.error('THREE.WebGLState: Invalid blending: ',blending);break;}}currentBlendSrc=null;currentBlendDst=null;currentBlendSrcAlpha=null;currentBlendDstAlpha=null;currentBlendColor.set(0,0,0);currentBlendAlpha=0;currentBlending=blending;currentPremultipledAlpha=premultipliedAlpha;}return;}// custom blending
blendEquationAlpha=blendEquationAlpha||blendEquation;blendSrcAlpha=blendSrcAlpha||blendSrc;blendDstAlpha=blendDstAlpha||blendDst;if(blendEquation!==currentBlendEquation||blendEquationAlpha!==currentBlendEquationAlpha){gl.blendEquationSeparate(equationToGL[blendEquation],equationToGL[blendEquationAlpha]);currentBlendEquation=blendEquation;currentBlendEquationAlpha=blendEquationAlpha;}if(blendSrc!==currentBlendSrc||blendDst!==currentBlendDst||blendSrcAlpha!==currentBlendSrcAlpha||blendDstAlpha!==currentBlendDstAlpha){gl.blendFuncSeparate(factorToGL[blendSrc],factorToGL[blendDst],factorToGL[blendSrcAlpha],factorToGL[blendDstAlpha]);currentBlendSrc=blendSrc;currentBlendDst=blendDst;currentBlendSrcAlpha=blendSrcAlpha;currentBlendDstAlpha=blendDstAlpha;}if(blendColor.equals(currentBlendColor)===false||blendAlpha!==currentBlendAlpha){gl.blendColor(blendColor.r,blendColor.g,blendColor.b,blendAlpha);currentBlendColor.copy(blendColor);currentBlendAlpha=blendAlpha;}currentBlending=blending;currentPremultipledAlpha=false;}function setMaterial(material,frontFaceCW){material.side===DoubleSide?disable(gl.CULL_FACE):enable(gl.CULL_FACE);let flipSided=material.side===BackSide$1;if(frontFaceCW)flipSided=!flipSided;setFlipSided(flipSided);material.blending===NormalBlending$1&&material.transparent===false?setBlending(NoBlending):setBlending(material.blending,material.blendEquation,material.blendSrc,material.blendDst,material.blendEquationAlpha,material.blendSrcAlpha,material.blendDstAlpha,material.blendColor,material.blendAlpha,material.premultipliedAlpha);depthBuffer.setFunc(material.depthFunc);depthBuffer.setTest(material.depthTest);depthBuffer.setMask(material.depthWrite);colorBuffer.setMask(material.colorWrite);const stencilWrite=material.stencilWrite;stencilBuffer.setTest(stencilWrite);if(stencilWrite){stencilBuffer.setMask(material.stencilWriteMask);stencilBuffer.setFunc(material.stencilFunc,material.stencilRef,material.stencilFuncMask);stencilBuffer.setOp(material.stencilFail,material.stencilZFail,material.stencilZPass);}setPolygonOffset(material.polygonOffset,material.polygonOffsetFactor,material.polygonOffsetUnits);material.alphaToCoverage===true?enable(gl.SAMPLE_ALPHA_TO_COVERAGE):disable(gl.SAMPLE_ALPHA_TO_COVERAGE);}//
function setFlipSided(flipSided){if(currentFlipSided!==flipSided){if(flipSided){gl.frontFace(gl.CW);}else {gl.frontFace(gl.CCW);}currentFlipSided=flipSided;}}function setCullFace(cullFace){if(cullFace!==CullFaceNone){enable(gl.CULL_FACE);if(cullFace!==currentCullFace){if(cullFace===CullFaceBack){gl.cullFace(gl.BACK);}else if(cullFace===CullFaceFront){gl.cullFace(gl.FRONT);}else {gl.cullFace(gl.FRONT_AND_BACK);}}}else {disable(gl.CULL_FACE);}currentCullFace=cullFace;}function setLineWidth(width){if(width!==currentLineWidth){if(lineWidthAvailable)gl.lineWidth(width);currentLineWidth=width;}}function setPolygonOffset(polygonOffset,factor,units){if(polygonOffset){enable(gl.POLYGON_OFFSET_FILL);if(currentPolygonOffsetFactor!==factor||currentPolygonOffsetUnits!==units){gl.polygonOffset(factor,units);currentPolygonOffsetFactor=factor;currentPolygonOffsetUnits=units;}}else {disable(gl.POLYGON_OFFSET_FILL);}}function setScissorTest(scissorTest){if(scissorTest){enable(gl.SCISSOR_TEST);}else {disable(gl.SCISSOR_TEST);}}// texture
function activeTexture(webglSlot){if(webglSlot===undefined)webglSlot=gl.TEXTURE0+maxTextures-1;if(currentTextureSlot!==webglSlot){gl.activeTexture(webglSlot);currentTextureSlot=webglSlot;}}function bindTexture(webglType,webglTexture,webglSlot){if(webglSlot===undefined){if(currentTextureSlot===null){webglSlot=gl.TEXTURE0+maxTextures-1;}else {webglSlot=currentTextureSlot;}}let boundTexture=currentBoundTextures[webglSlot];if(boundTexture===undefined){boundTexture={type:undefined,texture:undefined};currentBoundTextures[webglSlot]=boundTexture;}if(boundTexture.type!==webglType||boundTexture.texture!==webglTexture){if(currentTextureSlot!==webglSlot){gl.activeTexture(webglSlot);currentTextureSlot=webglSlot;}gl.bindTexture(webglType,webglTexture||emptyTextures[webglType]);boundTexture.type=webglType;boundTexture.texture=webglTexture;}}function unbindTexture(){const boundTexture=currentBoundTextures[currentTextureSlot];if(boundTexture!==undefined&&boundTexture.type!==undefined){gl.bindTexture(boundTexture.type,null);boundTexture.type=undefined;boundTexture.texture=undefined;}}function compressedTexImage2D(){try{gl.compressedTexImage2D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}function compressedTexImage3D(){try{gl.compressedTexImage3D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}function texSubImage2D(){try{gl.texSubImage2D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}function texSubImage3D(){try{gl.texSubImage3D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}function compressedTexSubImage2D(){try{gl.compressedTexSubImage2D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}function compressedTexSubImage3D(){try{gl.compressedTexSubImage3D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}function texStorage2D(){try{gl.texStorage2D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}function texStorage3D(){try{gl.texStorage3D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}function texImage2D(){try{gl.texImage2D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}function texImage3D(){try{gl.texImage3D.apply(gl,arguments);}catch(error){console.error('THREE.WebGLState:',error);}}//
function scissor(scissor){if(currentScissor.equals(scissor)===false){gl.scissor(scissor.x,scissor.y,scissor.z,scissor.w);currentScissor.copy(scissor);}}function viewport(viewport){if(currentViewport.equals(viewport)===false){gl.viewport(viewport.x,viewport.y,viewport.z,viewport.w);currentViewport.copy(viewport);}}function updateUBOMapping(uniformsGroup,program){let mapping=uboProgramMap.get(program);if(mapping===undefined){mapping=new WeakMap();uboProgramMap.set(program,mapping);}let blockIndex=mapping.get(uniformsGroup);if(blockIndex===undefined){blockIndex=gl.getUniformBlockIndex(program,uniformsGroup.name);mapping.set(uniformsGroup,blockIndex);}}function uniformBlockBinding(uniformsGroup,program){const mapping=uboProgramMap.get(program);const blockIndex=mapping.get(uniformsGroup);if(uboBindings.get(program)!==blockIndex){// bind shader specific block index to global block point
gl.uniformBlockBinding(program,blockIndex,uniformsGroup.__bindingPointIndex);uboBindings.set(program,blockIndex);}}//
function reset(){// reset state
gl.disable(gl.BLEND);gl.disable(gl.CULL_FACE);gl.disable(gl.DEPTH_TEST);gl.disable(gl.POLYGON_OFFSET_FILL);gl.disable(gl.SCISSOR_TEST);gl.disable(gl.STENCIL_TEST);gl.disable(gl.SAMPLE_ALPHA_TO_COVERAGE);gl.blendEquation(gl.FUNC_ADD);gl.blendFunc(gl.ONE,gl.ZERO);gl.blendFuncSeparate(gl.ONE,gl.ZERO,gl.ONE,gl.ZERO);gl.blendColor(0,0,0,0);gl.colorMask(true,true,true,true);gl.clearColor(0,0,0,0);gl.depthMask(true);gl.depthFunc(gl.LESS);gl.clearDepth(1);gl.stencilMask(0xffffffff);gl.stencilFunc(gl.ALWAYS,0,0xffffffff);gl.stencilOp(gl.KEEP,gl.KEEP,gl.KEEP);gl.clearStencil(0);gl.cullFace(gl.BACK);gl.frontFace(gl.CCW);gl.polygonOffset(0,0);gl.activeTexture(gl.TEXTURE0);gl.bindFramebuffer(gl.FRAMEBUFFER,null);gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER,null);gl.bindFramebuffer(gl.READ_FRAMEBUFFER,null);gl.useProgram(null);gl.lineWidth(1);gl.scissor(0,0,gl.canvas.width,gl.canvas.height);gl.viewport(0,0,gl.canvas.width,gl.canvas.height);// reset internals
enabledCapabilities={};currentTextureSlot=null;currentBoundTextures={};currentBoundFramebuffers={};currentDrawbuffers=new WeakMap();defaultDrawbuffers=[];currentProgram=null;currentBlendingEnabled=false;currentBlending=null;currentBlendEquation=null;currentBlendSrc=null;currentBlendDst=null;currentBlendEquationAlpha=null;currentBlendSrcAlpha=null;currentBlendDstAlpha=null;currentBlendColor=new Color$1(0,0,0);currentBlendAlpha=0;currentPremultipledAlpha=false;currentFlipSided=null;currentCullFace=null;currentLineWidth=null;currentPolygonOffsetFactor=null;currentPolygonOffsetUnits=null;currentScissor.set(0,0,gl.canvas.width,gl.canvas.height);currentViewport.set(0,0,gl.canvas.width,gl.canvas.height);colorBuffer.reset();depthBuffer.reset();stencilBuffer.reset();}return {buffers:{color:colorBuffer,depth:depthBuffer,stencil:stencilBuffer},enable:enable,disable:disable,bindFramebuffer:bindFramebuffer,drawBuffers:drawBuffers,useProgram:useProgram,setBlending:setBlending,setMaterial:setMaterial,setFlipSided:setFlipSided,setCullFace:setCullFace,setLineWidth:setLineWidth,setPolygonOffset:setPolygonOffset,setScissorTest:setScissorTest,activeTexture:activeTexture,bindTexture:bindTexture,unbindTexture:unbindTexture,compressedTexImage2D:compressedTexImage2D,compressedTexImage3D:compressedTexImage3D,texImage2D:texImage2D,texImage3D:texImage3D,updateUBOMapping:updateUBOMapping,uniformBlockBinding:uniformBlockBinding,texStorage2D:texStorage2D,texStorage3D:texStorage3D,texSubImage2D:texSubImage2D,texSubImage3D:texSubImage3D,compressedTexSubImage2D:compressedTexSubImage2D,compressedTexSubImage3D:compressedTexSubImage3D,scissor:scissor,viewport:viewport,reset:reset};}/**
 * Given the width, height, format, and type of a texture. Determines how many
 * bytes must be used to represent the texture.
 */function getByteLength(width,height,format,type){const typeByteLength=getTextureTypeByteLength(type);switch(format){// https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml
case AlphaFormat:return width*height;case LuminanceFormat:return width*height;case LuminanceAlphaFormat:return width*height*2;case RedFormat:return width*height/typeByteLength.components*typeByteLength.byteLength;case RedIntegerFormat:return width*height/typeByteLength.components*typeByteLength.byteLength;case RGFormat:return width*height*2/typeByteLength.components*typeByteLength.byteLength;case RGIntegerFormat:return width*height*2/typeByteLength.components*typeByteLength.byteLength;case RGBFormat:return width*height*3/typeByteLength.components*typeByteLength.byteLength;case RGBAFormat$1:return width*height*4/typeByteLength.components*typeByteLength.byteLength;case RGBAIntegerFormat:return width*height*4/typeByteLength.components*typeByteLength.byteLength;// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_s3tc_srgb/
case RGB_S3TC_DXT1_Format:case RGBA_S3TC_DXT1_Format:return Math.floor((width+3)/4)*Math.floor((height+3)/4)*8;case RGBA_S3TC_DXT3_Format:case RGBA_S3TC_DXT5_Format:return Math.floor((width+3)/4)*Math.floor((height+3)/4)*16;// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_pvrtc/
case RGB_PVRTC_2BPPV1_Format:case RGBA_PVRTC_2BPPV1_Format:return Math.max(width,16)*Math.max(height,8)/4;case RGB_PVRTC_4BPPV1_Format:case RGBA_PVRTC_4BPPV1_Format:return Math.max(width,8)*Math.max(height,8)/2;// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/
case RGB_ETC1_Format:case RGB_ETC2_Format:return Math.floor((width+3)/4)*Math.floor((height+3)/4)*8;case RGBA_ETC2_EAC_Format:return Math.floor((width+3)/4)*Math.floor((height+3)/4)*16;// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
case RGBA_ASTC_4x4_Format:return Math.floor((width+3)/4)*Math.floor((height+3)/4)*16;case RGBA_ASTC_5x4_Format:return Math.floor((width+4)/5)*Math.floor((height+3)/4)*16;case RGBA_ASTC_5x5_Format:return Math.floor((width+4)/5)*Math.floor((height+4)/5)*16;case RGBA_ASTC_6x5_Format:return Math.floor((width+5)/6)*Math.floor((height+4)/5)*16;case RGBA_ASTC_6x6_Format:return Math.floor((width+5)/6)*Math.floor((height+5)/6)*16;case RGBA_ASTC_8x5_Format:return Math.floor((width+7)/8)*Math.floor((height+4)/5)*16;case RGBA_ASTC_8x6_Format:return Math.floor((width+7)/8)*Math.floor((height+5)/6)*16;case RGBA_ASTC_8x8_Format:return Math.floor((width+7)/8)*Math.floor((height+7)/8)*16;case RGBA_ASTC_10x5_Format:return Math.floor((width+9)/10)*Math.floor((height+4)/5)*16;case RGBA_ASTC_10x6_Format:return Math.floor((width+9)/10)*Math.floor((height+5)/6)*16;case RGBA_ASTC_10x8_Format:return Math.floor((width+9)/10)*Math.floor((height+7)/8)*16;case RGBA_ASTC_10x10_Format:return Math.floor((width+9)/10)*Math.floor((height+9)/10)*16;case RGBA_ASTC_12x10_Format:return Math.floor((width+11)/12)*Math.floor((height+9)/10)*16;case RGBA_ASTC_12x12_Format:return Math.floor((width+11)/12)*Math.floor((height+11)/12)*16;// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_bptc/
case RGBA_BPTC_Format:case RGB_BPTC_SIGNED_Format:case RGB_BPTC_UNSIGNED_Format:return Math.ceil(width/4)*Math.ceil(height/4)*16;// https://registry.khronos.org/webgl/extensions/EXT_texture_compression_rgtc/
case RED_RGTC1_Format:case SIGNED_RED_RGTC1_Format:return Math.ceil(width/4)*Math.ceil(height/4)*8;case RED_GREEN_RGTC2_Format:case SIGNED_RED_GREEN_RGTC2_Format:return Math.ceil(width/4)*Math.ceil(height/4)*16;}throw new Error(`Unable to determine texture byte length for ${format} format.`);}function getTextureTypeByteLength(type){switch(type){case UnsignedByteType$1:case ByteType:return {byteLength:1,components:1};case UnsignedShortType:case ShortType:case HalfFloatType$1:return {byteLength:2,components:1};case UnsignedShort4444Type:case UnsignedShort5551Type:return {byteLength:2,components:4};case UnsignedIntType$1:case IntType$1:case FloatType$1:return {byteLength:4,components:1};case UnsignedInt5999Type:return {byteLength:4,components:3};}throw new Error(`Unknown texture type ${type}.`);}function WebGLTextures(_gl,extensions,state,properties,capabilities,utils,info){const multisampledRTTExt=extensions.has('WEBGL_multisampled_render_to_texture')?extensions.get('WEBGL_multisampled_render_to_texture'):null;const supportsInvalidateFramebuffer=typeof navigator==='undefined'?false:/OculusBrowser/g.test(navigator.userAgent);const _imageDimensions=new Vector2$1();const _videoTextures=new WeakMap();let _canvas;const _sources=new WeakMap();// maps WebglTexture objects to instances of Source
// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,
// also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")!
// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).
let useOffscreenCanvas=false;try{useOffscreenCanvas=typeof OffscreenCanvas!=='undefined'// eslint-disable-next-line compat/compat
&&new OffscreenCanvas(1,1).getContext('2d')!==null;}catch(err){// Ignore any errors
}function createCanvas(width,height){// Use OffscreenCanvas when available. Specially needed in web workers
return useOffscreenCanvas?// eslint-disable-next-line compat/compat
new OffscreenCanvas(width,height):createElementNS$1('canvas');}function resizeImage(image,needsNewCanvas,maxSize){let scale=1;const dimensions=getDimensions(image);// handle case if texture exceeds max size
if(dimensions.width>maxSize||dimensions.height>maxSize){scale=maxSize/Math.max(dimensions.width,dimensions.height);}// only perform resize if necessary
if(scale<1){// only perform resize for certain image types
if(typeof HTMLImageElement!=='undefined'&&image instanceof HTMLImageElement||typeof HTMLCanvasElement!=='undefined'&&image instanceof HTMLCanvasElement||typeof ImageBitmap!=='undefined'&&image instanceof ImageBitmap||typeof VideoFrame!=='undefined'&&image instanceof VideoFrame){const width=Math.floor(scale*dimensions.width);const height=Math.floor(scale*dimensions.height);if(_canvas===undefined)_canvas=createCanvas(width,height);// cube textures can't reuse the same canvas
const canvas=needsNewCanvas?createCanvas(width,height):_canvas;canvas.width=width;canvas.height=height;const context=canvas.getContext('2d');context.drawImage(image,0,0,width,height);console.warn('THREE.WebGLRenderer: Texture has been resized from ('+dimensions.width+'x'+dimensions.height+') to ('+width+'x'+height+').');return canvas;}else {if('data'in image){console.warn('THREE.WebGLRenderer: Image in DataTexture is too big ('+dimensions.width+'x'+dimensions.height+').');}return image;}}return image;}function textureNeedsGenerateMipmaps(texture){return texture.generateMipmaps&&texture.minFilter!==NearestFilter$1&&texture.minFilter!==LinearFilter$1;}function generateMipmap(target){_gl.generateMipmap(target);}function getInternalFormat(internalFormatName,glFormat,glType,colorSpace,forceLinearTransfer=false){if(internalFormatName!==null){if(_gl[internalFormatName]!==undefined)return _gl[internalFormatName];console.warn('THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \''+internalFormatName+'\'');}let internalFormat=glFormat;if(glFormat===_gl.RED){if(glType===_gl.FLOAT)internalFormat=_gl.R32F;if(glType===_gl.HALF_FLOAT)internalFormat=_gl.R16F;if(glType===_gl.UNSIGNED_BYTE)internalFormat=_gl.R8;}if(glFormat===_gl.RED_INTEGER){if(glType===_gl.UNSIGNED_BYTE)internalFormat=_gl.R8UI;if(glType===_gl.UNSIGNED_SHORT)internalFormat=_gl.R16UI;if(glType===_gl.UNSIGNED_INT)internalFormat=_gl.R32UI;if(glType===_gl.BYTE)internalFormat=_gl.R8I;if(glType===_gl.SHORT)internalFormat=_gl.R16I;if(glType===_gl.INT)internalFormat=_gl.R32I;}if(glFormat===_gl.RG){if(glType===_gl.FLOAT)internalFormat=_gl.RG32F;if(glType===_gl.HALF_FLOAT)internalFormat=_gl.RG16F;if(glType===_gl.UNSIGNED_BYTE)internalFormat=_gl.RG8;}if(glFormat===_gl.RG_INTEGER){if(glType===_gl.UNSIGNED_BYTE)internalFormat=_gl.RG8UI;if(glType===_gl.UNSIGNED_SHORT)internalFormat=_gl.RG16UI;if(glType===_gl.UNSIGNED_INT)internalFormat=_gl.RG32UI;if(glType===_gl.BYTE)internalFormat=_gl.RG8I;if(glType===_gl.SHORT)internalFormat=_gl.RG16I;if(glType===_gl.INT)internalFormat=_gl.RG32I;}if(glFormat===_gl.RGB){if(glType===_gl.UNSIGNED_INT_5_9_9_9_REV)internalFormat=_gl.RGB9_E5;}if(glFormat===_gl.RGBA){const transfer=forceLinearTransfer?LinearTransfer$1:ColorManagement$1.getTransfer(colorSpace);if(glType===_gl.FLOAT)internalFormat=_gl.RGBA32F;if(glType===_gl.HALF_FLOAT)internalFormat=_gl.RGBA16F;if(glType===_gl.UNSIGNED_BYTE)internalFormat=transfer===SRGBTransfer$1?_gl.SRGB8_ALPHA8:_gl.RGBA8;if(glType===_gl.UNSIGNED_SHORT_4_4_4_4)internalFormat=_gl.RGBA4;if(glType===_gl.UNSIGNED_SHORT_5_5_5_1)internalFormat=_gl.RGB5_A1;}if(internalFormat===_gl.R16F||internalFormat===_gl.R32F||internalFormat===_gl.RG16F||internalFormat===_gl.RG32F||internalFormat===_gl.RGBA16F||internalFormat===_gl.RGBA32F){extensions.get('EXT_color_buffer_float');}return internalFormat;}function getInternalDepthFormat(useStencil,depthType){let glInternalFormat;if(useStencil){if(depthType===null||depthType===UnsignedIntType$1||depthType===UnsignedInt248Type$1){glInternalFormat=_gl.DEPTH24_STENCIL8;}else if(depthType===FloatType$1){glInternalFormat=_gl.DEPTH32F_STENCIL8;}else if(depthType===UnsignedShortType){glInternalFormat=_gl.DEPTH24_STENCIL8;console.warn('DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.');}}else {if(depthType===null||depthType===UnsignedIntType$1||depthType===UnsignedInt248Type$1){glInternalFormat=_gl.DEPTH_COMPONENT24;}else if(depthType===FloatType$1){glInternalFormat=_gl.DEPTH_COMPONENT32F;}else if(depthType===UnsignedShortType){glInternalFormat=_gl.DEPTH_COMPONENT16;}}return glInternalFormat;}function getMipLevels(texture,image){if(textureNeedsGenerateMipmaps(texture)===true||texture.isFramebufferTexture&&texture.minFilter!==NearestFilter$1&&texture.minFilter!==LinearFilter$1){return Math.log2(Math.max(image.width,image.height))+1;}else if(texture.mipmaps!==undefined&&texture.mipmaps.length>0){// user-defined mipmaps
return texture.mipmaps.length;}else if(texture.isCompressedTexture&&Array.isArray(texture.image)){return image.mipmaps.length;}else {// texture without mipmaps (only base level)
return 1;}}//
function onTextureDispose(event){const texture=event.target;texture.removeEventListener('dispose',onTextureDispose);deallocateTexture(texture);if(texture.isVideoTexture){_videoTextures.delete(texture);}}function onRenderTargetDispose(event){const renderTarget=event.target;renderTarget.removeEventListener('dispose',onRenderTargetDispose);deallocateRenderTarget(renderTarget);}//
function deallocateTexture(texture){const textureProperties=properties.get(texture);if(textureProperties.__webglInit===undefined)return;// check if it's necessary to remove the WebGLTexture object
const source=texture.source;const webglTextures=_sources.get(source);if(webglTextures){const webglTexture=webglTextures[textureProperties.__cacheKey];webglTexture.usedTimes--;// the WebGLTexture object is not used anymore, remove it
if(webglTexture.usedTimes===0){deleteTexture(texture);}// remove the weak map entry if no WebGLTexture uses the source anymore
if(Object.keys(webglTextures).length===0){_sources.delete(source);}}properties.remove(texture);}function deleteTexture(texture){const textureProperties=properties.get(texture);_gl.deleteTexture(textureProperties.__webglTexture);const source=texture.source;const webglTextures=_sources.get(source);delete webglTextures[textureProperties.__cacheKey];info.memory.textures--;}function deallocateRenderTarget(renderTarget){const renderTargetProperties=properties.get(renderTarget);if(renderTarget.depthTexture){renderTarget.depthTexture.dispose();}if(renderTarget.isWebGLCubeRenderTarget){for(let i=0;i<6;i++){if(Array.isArray(renderTargetProperties.__webglFramebuffer[i])){for(let level=0;level<renderTargetProperties.__webglFramebuffer[i].length;level++)_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i][level]);}else {_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]);}if(renderTargetProperties.__webglDepthbuffer)_gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]);}}else {if(Array.isArray(renderTargetProperties.__webglFramebuffer)){for(let level=0;level<renderTargetProperties.__webglFramebuffer.length;level++)_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[level]);}else {_gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer);}if(renderTargetProperties.__webglDepthbuffer)_gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer);if(renderTargetProperties.__webglMultisampledFramebuffer)_gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer);if(renderTargetProperties.__webglColorRenderbuffer){for(let i=0;i<renderTargetProperties.__webglColorRenderbuffer.length;i++){if(renderTargetProperties.__webglColorRenderbuffer[i])_gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer[i]);}}if(renderTargetProperties.__webglDepthRenderbuffer)_gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer);}const textures=renderTarget.textures;for(let i=0,il=textures.length;i<il;i++){const attachmentProperties=properties.get(textures[i]);if(attachmentProperties.__webglTexture){_gl.deleteTexture(attachmentProperties.__webglTexture);info.memory.textures--;}properties.remove(textures[i]);}properties.remove(renderTarget);}//
let textureUnits=0;function resetTextureUnits(){textureUnits=0;}function allocateTextureUnit(){const textureUnit=textureUnits;if(textureUnit>=capabilities.maxTextures){console.warn('THREE.WebGLTextures: Trying to use '+textureUnit+' texture units while this GPU supports only '+capabilities.maxTextures);}textureUnits+=1;return textureUnit;}function getTextureCacheKey(texture){const array=[];array.push(texture.wrapS);array.push(texture.wrapT);array.push(texture.wrapR||0);array.push(texture.magFilter);array.push(texture.minFilter);array.push(texture.anisotropy);array.push(texture.internalFormat);array.push(texture.format);array.push(texture.type);array.push(texture.generateMipmaps);array.push(texture.premultiplyAlpha);array.push(texture.flipY);array.push(texture.unpackAlignment);array.push(texture.colorSpace);return array.join();}//
function setTexture2D(texture,slot){const textureProperties=properties.get(texture);if(texture.isVideoTexture)updateVideoTexture(texture);if(texture.isRenderTargetTexture===false&&texture.version>0&&textureProperties.__version!==texture.version){const image=texture.image;if(image===null){console.warn('THREE.WebGLRenderer: Texture marked for update but no image data found.');}else if(image.complete===false){console.warn('THREE.WebGLRenderer: Texture marked for update but image is incomplete');}else {uploadTexture(textureProperties,texture,slot);return;}}state.bindTexture(_gl.TEXTURE_2D,textureProperties.__webglTexture,_gl.TEXTURE0+slot);}function setTexture2DArray(texture,slot){const textureProperties=properties.get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){uploadTexture(textureProperties,texture,slot);return;}state.bindTexture(_gl.TEXTURE_2D_ARRAY,textureProperties.__webglTexture,_gl.TEXTURE0+slot);}function setTexture3D(texture,slot){const textureProperties=properties.get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){uploadTexture(textureProperties,texture,slot);return;}state.bindTexture(_gl.TEXTURE_3D,textureProperties.__webglTexture,_gl.TEXTURE0+slot);}function setTextureCube(texture,slot){const textureProperties=properties.get(texture);if(texture.version>0&&textureProperties.__version!==texture.version){uploadCubeTexture(textureProperties,texture,slot);return;}state.bindTexture(_gl.TEXTURE_CUBE_MAP,textureProperties.__webglTexture,_gl.TEXTURE0+slot);}const wrappingToGL={[RepeatWrapping$1]:_gl.REPEAT,[ClampToEdgeWrapping$1]:_gl.CLAMP_TO_EDGE,[MirroredRepeatWrapping$1]:_gl.MIRRORED_REPEAT};const filterToGL={[NearestFilter$1]:_gl.NEAREST,[NearestMipmapNearestFilter]:_gl.NEAREST_MIPMAP_NEAREST,[NearestMipmapLinearFilter]:_gl.NEAREST_MIPMAP_LINEAR,[LinearFilter$1]:_gl.LINEAR,[LinearMipmapNearestFilter]:_gl.LINEAR_MIPMAP_NEAREST,[LinearMipmapLinearFilter$1]:_gl.LINEAR_MIPMAP_LINEAR};const compareToGL={[NeverCompare]:_gl.NEVER,[AlwaysCompare]:_gl.ALWAYS,[LessCompare]:_gl.LESS,[LessEqualCompare]:_gl.LEQUAL,[EqualCompare]:_gl.EQUAL,[GreaterEqualCompare]:_gl.GEQUAL,[GreaterCompare]:_gl.GREATER,[NotEqualCompare]:_gl.NOTEQUAL};function setTextureParameters(textureType,texture){if(texture.type===FloatType$1&&extensions.has('OES_texture_float_linear')===false&&(texture.magFilter===LinearFilter$1||texture.magFilter===LinearMipmapNearestFilter||texture.magFilter===NearestMipmapLinearFilter||texture.magFilter===LinearMipmapLinearFilter$1||texture.minFilter===LinearFilter$1||texture.minFilter===LinearMipmapNearestFilter||texture.minFilter===NearestMipmapLinearFilter||texture.minFilter===LinearMipmapLinearFilter$1)){console.warn('THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.');}_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_S,wrappingToGL[texture.wrapS]);_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_T,wrappingToGL[texture.wrapT]);if(textureType===_gl.TEXTURE_3D||textureType===_gl.TEXTURE_2D_ARRAY){_gl.texParameteri(textureType,_gl.TEXTURE_WRAP_R,wrappingToGL[texture.wrapR]);}_gl.texParameteri(textureType,_gl.TEXTURE_MAG_FILTER,filterToGL[texture.magFilter]);_gl.texParameteri(textureType,_gl.TEXTURE_MIN_FILTER,filterToGL[texture.minFilter]);if(texture.compareFunction){_gl.texParameteri(textureType,_gl.TEXTURE_COMPARE_MODE,_gl.COMPARE_REF_TO_TEXTURE);_gl.texParameteri(textureType,_gl.TEXTURE_COMPARE_FUNC,compareToGL[texture.compareFunction]);}if(extensions.has('EXT_texture_filter_anisotropic')===true){if(texture.magFilter===NearestFilter$1)return;if(texture.minFilter!==NearestMipmapLinearFilter&&texture.minFilter!==LinearMipmapLinearFilter$1)return;if(texture.type===FloatType$1&&extensions.has('OES_texture_float_linear')===false)return;// verify extension
if(texture.anisotropy>1||properties.get(texture).__currentAnisotropy){const extension=extensions.get('EXT_texture_filter_anisotropic');_gl.texParameterf(textureType,extension.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(texture.anisotropy,capabilities.getMaxAnisotropy()));properties.get(texture).__currentAnisotropy=texture.anisotropy;}}}function initTexture(textureProperties,texture){let forceUpload=false;if(textureProperties.__webglInit===undefined){textureProperties.__webglInit=true;texture.addEventListener('dispose',onTextureDispose);}// create Source <-> WebGLTextures mapping if necessary
const source=texture.source;let webglTextures=_sources.get(source);if(webglTextures===undefined){webglTextures={};_sources.set(source,webglTextures);}// check if there is already a WebGLTexture object for the given texture parameters
const textureCacheKey=getTextureCacheKey(texture);if(textureCacheKey!==textureProperties.__cacheKey){// if not, create a new instance of WebGLTexture
if(webglTextures[textureCacheKey]===undefined){// create new entry
webglTextures[textureCacheKey]={texture:_gl.createTexture(),usedTimes:0};info.memory.textures++;// when a new instance of WebGLTexture was created, a texture upload is required
// even if the image contents are identical
forceUpload=true;}webglTextures[textureCacheKey].usedTimes++;// every time the texture cache key changes, it's necessary to check if an instance of
// WebGLTexture can be deleted in order to avoid a memory leak.
const webglTexture=webglTextures[textureProperties.__cacheKey];if(webglTexture!==undefined){webglTextures[textureProperties.__cacheKey].usedTimes--;if(webglTexture.usedTimes===0){deleteTexture(texture);}}// store references to cache key and WebGLTexture object
textureProperties.__cacheKey=textureCacheKey;textureProperties.__webglTexture=webglTextures[textureCacheKey].texture;}return forceUpload;}function uploadTexture(textureProperties,texture,slot){let textureType=_gl.TEXTURE_2D;if(texture.isDataArrayTexture||texture.isCompressedArrayTexture)textureType=_gl.TEXTURE_2D_ARRAY;if(texture.isData3DTexture)textureType=_gl.TEXTURE_3D;const forceUpload=initTexture(textureProperties,texture);const source=texture.source;state.bindTexture(textureType,textureProperties.__webglTexture,_gl.TEXTURE0+slot);const sourceProperties=properties.get(source);if(source.version!==sourceProperties.__version||forceUpload===true){state.activeTexture(_gl.TEXTURE0+slot);const workingPrimaries=ColorManagement$1.getPrimaries(ColorManagement$1.workingColorSpace);const texturePrimaries=texture.colorSpace===NoColorSpace$1?null:ColorManagement$1.getPrimaries(texture.colorSpace);const unpackConversion=texture.colorSpace===NoColorSpace$1||workingPrimaries===texturePrimaries?_gl.NONE:_gl.BROWSER_DEFAULT_WEBGL;_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,texture.flipY);_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,texture.premultiplyAlpha);_gl.pixelStorei(_gl.UNPACK_ALIGNMENT,texture.unpackAlignment);_gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,unpackConversion);let image=resizeImage(texture.image,false,capabilities.maxTextureSize);image=verifyColorSpace(texture,image);const glFormat=utils.convert(texture.format,texture.colorSpace);const glType=utils.convert(texture.type);let glInternalFormat=getInternalFormat(texture.internalFormat,glFormat,glType,texture.colorSpace,texture.isVideoTexture);setTextureParameters(textureType,texture);let mipmap;const mipmaps=texture.mipmaps;const useTexStorage=texture.isVideoTexture!==true;const allocateMemory=sourceProperties.__version===undefined||forceUpload===true;const dataReady=source.dataReady;const levels=getMipLevels(texture,image);if(texture.isDepthTexture){glInternalFormat=getInternalDepthFormat(texture.format===DepthStencilFormat$1,texture.type);//
if(allocateMemory){if(useTexStorage){state.texStorage2D(_gl.TEXTURE_2D,1,glInternalFormat,image.width,image.height);}else {state.texImage2D(_gl.TEXTURE_2D,0,glInternalFormat,image.width,image.height,0,glFormat,glType,null);}}}else if(texture.isDataTexture){// use manually created mipmaps if available
// if there are no manual mipmaps
// set 0 level mipmap and then use GL to generate other mipmap levels
if(mipmaps.length>0){if(useTexStorage&&allocateMemory){state.texStorage2D(_gl.TEXTURE_2D,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);}for(let i=0,il=mipmaps.length;i<il;i++){mipmap=mipmaps[i];if(useTexStorage){if(dataReady){state.texSubImage2D(_gl.TEXTURE_2D,i,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data);}}else {state.texImage2D(_gl.TEXTURE_2D,i,glInternalFormat,mipmap.width,mipmap.height,0,glFormat,glType,mipmap.data);}}texture.generateMipmaps=false;}else {if(useTexStorage){if(allocateMemory){state.texStorage2D(_gl.TEXTURE_2D,levels,glInternalFormat,image.width,image.height);}if(dataReady){state.texSubImage2D(_gl.TEXTURE_2D,0,0,0,image.width,image.height,glFormat,glType,image.data);}}else {state.texImage2D(_gl.TEXTURE_2D,0,glInternalFormat,image.width,image.height,0,glFormat,glType,image.data);}}}else if(texture.isCompressedTexture){if(texture.isCompressedArrayTexture){if(useTexStorage&&allocateMemory){state.texStorage3D(_gl.TEXTURE_2D_ARRAY,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height,image.depth);}for(let i=0,il=mipmaps.length;i<il;i++){mipmap=mipmaps[i];if(texture.format!==RGBAFormat$1){if(glFormat!==null){if(useTexStorage){if(dataReady){if(texture.layerUpdates.size>0){const layerByteLength=getByteLength(mipmap.width,mipmap.height,texture.format,texture.type);for(const layerIndex of texture.layerUpdates){const layerData=mipmap.data.subarray(layerIndex*layerByteLength/mipmap.data.BYTES_PER_ELEMENT,(layerIndex+1)*layerByteLength/mipmap.data.BYTES_PER_ELEMENT);state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY,i,0,0,layerIndex,mipmap.width,mipmap.height,1,glFormat,layerData,0,0);}texture.clearLayerUpdates();}else {state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY,i,0,0,0,mipmap.width,mipmap.height,image.depth,glFormat,mipmap.data,0,0);}}}else {state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY,i,glInternalFormat,mipmap.width,mipmap.height,image.depth,0,mipmap.data,0,0);}}else {console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');}}else {if(useTexStorage){if(dataReady){state.texSubImage3D(_gl.TEXTURE_2D_ARRAY,i,0,0,0,mipmap.width,mipmap.height,image.depth,glFormat,glType,mipmap.data);}}else {state.texImage3D(_gl.TEXTURE_2D_ARRAY,i,glInternalFormat,mipmap.width,mipmap.height,image.depth,0,glFormat,glType,mipmap.data);}}}}else {if(useTexStorage&&allocateMemory){state.texStorage2D(_gl.TEXTURE_2D,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);}for(let i=0,il=mipmaps.length;i<il;i++){mipmap=mipmaps[i];if(texture.format!==RGBAFormat$1){if(glFormat!==null){if(useTexStorage){if(dataReady){state.compressedTexSubImage2D(_gl.TEXTURE_2D,i,0,0,mipmap.width,mipmap.height,glFormat,mipmap.data);}}else {state.compressedTexImage2D(_gl.TEXTURE_2D,i,glInternalFormat,mipmap.width,mipmap.height,0,mipmap.data);}}else {console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');}}else {if(useTexStorage){if(dataReady){state.texSubImage2D(_gl.TEXTURE_2D,i,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data);}}else {state.texImage2D(_gl.TEXTURE_2D,i,glInternalFormat,mipmap.width,mipmap.height,0,glFormat,glType,mipmap.data);}}}}}else if(texture.isDataArrayTexture){if(useTexStorage){if(allocateMemory){state.texStorage3D(_gl.TEXTURE_2D_ARRAY,levels,glInternalFormat,image.width,image.height,image.depth);}if(dataReady){if(texture.layerUpdates.size>0){const layerByteLength=getByteLength(image.width,image.height,texture.format,texture.type);for(const layerIndex of texture.layerUpdates){const layerData=image.data.subarray(layerIndex*layerByteLength/image.data.BYTES_PER_ELEMENT,(layerIndex+1)*layerByteLength/image.data.BYTES_PER_ELEMENT);state.texSubImage3D(_gl.TEXTURE_2D_ARRAY,0,0,0,layerIndex,image.width,image.height,1,glFormat,glType,layerData);}texture.clearLayerUpdates();}else {state.texSubImage3D(_gl.TEXTURE_2D_ARRAY,0,0,0,0,image.width,image.height,image.depth,glFormat,glType,image.data);}}}else {state.texImage3D(_gl.TEXTURE_2D_ARRAY,0,glInternalFormat,image.width,image.height,image.depth,0,glFormat,glType,image.data);}}else if(texture.isData3DTexture){if(useTexStorage){if(allocateMemory){state.texStorage3D(_gl.TEXTURE_3D,levels,glInternalFormat,image.width,image.height,image.depth);}if(dataReady){state.texSubImage3D(_gl.TEXTURE_3D,0,0,0,0,image.width,image.height,image.depth,glFormat,glType,image.data);}}else {state.texImage3D(_gl.TEXTURE_3D,0,glInternalFormat,image.width,image.height,image.depth,0,glFormat,glType,image.data);}}else if(texture.isFramebufferTexture){if(allocateMemory){if(useTexStorage){state.texStorage2D(_gl.TEXTURE_2D,levels,glInternalFormat,image.width,image.height);}else {let width=image.width,height=image.height;for(let i=0;i<levels;i++){state.texImage2D(_gl.TEXTURE_2D,i,glInternalFormat,width,height,0,glFormat,glType,null);width>>=1;height>>=1;}}}}else {// regular Texture (image, video, canvas)
// use manually created mipmaps if available
// if there are no manual mipmaps
// set 0 level mipmap and then use GL to generate other mipmap levels
if(mipmaps.length>0){if(useTexStorage&&allocateMemory){const dimensions=getDimensions(mipmaps[0]);state.texStorage2D(_gl.TEXTURE_2D,levels,glInternalFormat,dimensions.width,dimensions.height);}for(let i=0,il=mipmaps.length;i<il;i++){mipmap=mipmaps[i];if(useTexStorage){if(dataReady){state.texSubImage2D(_gl.TEXTURE_2D,i,0,0,glFormat,glType,mipmap);}}else {state.texImage2D(_gl.TEXTURE_2D,i,glInternalFormat,glFormat,glType,mipmap);}}texture.generateMipmaps=false;}else {if(useTexStorage){if(allocateMemory){const dimensions=getDimensions(image);state.texStorage2D(_gl.TEXTURE_2D,levels,glInternalFormat,dimensions.width,dimensions.height);}if(dataReady){state.texSubImage2D(_gl.TEXTURE_2D,0,0,0,glFormat,glType,image);}}else {state.texImage2D(_gl.TEXTURE_2D,0,glInternalFormat,glFormat,glType,image);}}}if(textureNeedsGenerateMipmaps(texture)){generateMipmap(textureType);}sourceProperties.__version=source.version;if(texture.onUpdate)texture.onUpdate(texture);}textureProperties.__version=texture.version;}function uploadCubeTexture(textureProperties,texture,slot){if(texture.image.length!==6)return;const forceUpload=initTexture(textureProperties,texture);const source=texture.source;state.bindTexture(_gl.TEXTURE_CUBE_MAP,textureProperties.__webglTexture,_gl.TEXTURE0+slot);const sourceProperties=properties.get(source);if(source.version!==sourceProperties.__version||forceUpload===true){state.activeTexture(_gl.TEXTURE0+slot);const workingPrimaries=ColorManagement$1.getPrimaries(ColorManagement$1.workingColorSpace);const texturePrimaries=texture.colorSpace===NoColorSpace$1?null:ColorManagement$1.getPrimaries(texture.colorSpace);const unpackConversion=texture.colorSpace===NoColorSpace$1||workingPrimaries===texturePrimaries?_gl.NONE:_gl.BROWSER_DEFAULT_WEBGL;_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,texture.flipY);_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,texture.premultiplyAlpha);_gl.pixelStorei(_gl.UNPACK_ALIGNMENT,texture.unpackAlignment);_gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,unpackConversion);const isCompressed=texture.isCompressedTexture||texture.image[0].isCompressedTexture;const isDataTexture=texture.image[0]&&texture.image[0].isDataTexture;const cubeImage=[];for(let i=0;i<6;i++){if(!isCompressed&&!isDataTexture){cubeImage[i]=resizeImage(texture.image[i],true,capabilities.maxCubemapSize);}else {cubeImage[i]=isDataTexture?texture.image[i].image:texture.image[i];}cubeImage[i]=verifyColorSpace(texture,cubeImage[i]);}const image=cubeImage[0],glFormat=utils.convert(texture.format,texture.colorSpace),glType=utils.convert(texture.type),glInternalFormat=getInternalFormat(texture.internalFormat,glFormat,glType,texture.colorSpace);const useTexStorage=texture.isVideoTexture!==true;const allocateMemory=sourceProperties.__version===undefined||forceUpload===true;const dataReady=source.dataReady;let levels=getMipLevels(texture,image);setTextureParameters(_gl.TEXTURE_CUBE_MAP,texture);let mipmaps;if(isCompressed){if(useTexStorage&&allocateMemory){state.texStorage2D(_gl.TEXTURE_CUBE_MAP,levels,glInternalFormat,image.width,image.height);}for(let i=0;i<6;i++){mipmaps=cubeImage[i].mipmaps;for(let j=0;j<mipmaps.length;j++){const mipmap=mipmaps[j];if(texture.format!==RGBAFormat$1){if(glFormat!==null){if(useTexStorage){if(dataReady){state.compressedTexSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j,0,0,mipmap.width,mipmap.height,glFormat,mipmap.data);}}else {state.compressedTexImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j,glInternalFormat,mipmap.width,mipmap.height,0,mipmap.data);}}else {console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()');}}else {if(useTexStorage){if(dataReady){state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data);}}else {state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j,glInternalFormat,mipmap.width,mipmap.height,0,glFormat,glType,mipmap.data);}}}}}else {mipmaps=texture.mipmaps;if(useTexStorage&&allocateMemory){// TODO: Uniformly handle mipmap definitions
// Normal textures and compressed cube textures define base level + mips with their mipmap array
// Uncompressed cube textures use their mipmap array only for mips (no base level)
if(mipmaps.length>0)levels++;const dimensions=getDimensions(cubeImage[0]);state.texStorage2D(_gl.TEXTURE_CUBE_MAP,levels,glInternalFormat,dimensions.width,dimensions.height);}for(let i=0;i<6;i++){if(isDataTexture){if(useTexStorage){if(dataReady){state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,0,0,cubeImage[i].width,cubeImage[i].height,glFormat,glType,cubeImage[i].data);}}else {state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,glInternalFormat,cubeImage[i].width,cubeImage[i].height,0,glFormat,glType,cubeImage[i].data);}for(let j=0;j<mipmaps.length;j++){const mipmap=mipmaps[j];const mipmapImage=mipmap.image[i].image;if(useTexStorage){if(dataReady){state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j+1,0,0,mipmapImage.width,mipmapImage.height,glFormat,glType,mipmapImage.data);}}else {state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j+1,glInternalFormat,mipmapImage.width,mipmapImage.height,0,glFormat,glType,mipmapImage.data);}}}else {if(useTexStorage){if(dataReady){state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,0,0,glFormat,glType,cubeImage[i]);}}else {state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,glInternalFormat,glFormat,glType,cubeImage[i]);}for(let j=0;j<mipmaps.length;j++){const mipmap=mipmaps[j];if(useTexStorage){if(dataReady){state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j+1,0,0,glFormat,glType,mipmap.image[i]);}}else {state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,j+1,glInternalFormat,glFormat,glType,mipmap.image[i]);}}}}}if(textureNeedsGenerateMipmaps(texture)){// We assume images for cube map have the same size.
generateMipmap(_gl.TEXTURE_CUBE_MAP);}sourceProperties.__version=source.version;if(texture.onUpdate)texture.onUpdate(texture);}textureProperties.__version=texture.version;}// Render targets
// Setup storage for target texture and bind it to correct framebuffer
function setupFrameBufferTexture(framebuffer,renderTarget,texture,attachment,textureTarget,level){const glFormat=utils.convert(texture.format,texture.colorSpace);const glType=utils.convert(texture.type);const glInternalFormat=getInternalFormat(texture.internalFormat,glFormat,glType,texture.colorSpace);const renderTargetProperties=properties.get(renderTarget);if(!renderTargetProperties.__hasExternalTextures){const width=Math.max(1,renderTarget.width>>level);const height=Math.max(1,renderTarget.height>>level);if(textureTarget===_gl.TEXTURE_3D||textureTarget===_gl.TEXTURE_2D_ARRAY){state.texImage3D(textureTarget,level,glInternalFormat,width,height,renderTarget.depth,0,glFormat,glType,null);}else {state.texImage2D(textureTarget,level,glInternalFormat,width,height,0,glFormat,glType,null);}}state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);if(useMultisampledRTT(renderTarget)){multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER,attachment,textureTarget,properties.get(texture).__webglTexture,0,getRenderTargetSamples(renderTarget));}else if(textureTarget===_gl.TEXTURE_2D||textureTarget>=_gl.TEXTURE_CUBE_MAP_POSITIVE_X&&textureTarget<=_gl.TEXTURE_CUBE_MAP_NEGATIVE_Z){// see #24753
_gl.framebufferTexture2D(_gl.FRAMEBUFFER,attachment,textureTarget,properties.get(texture).__webglTexture,level);}state.bindFramebuffer(_gl.FRAMEBUFFER,null);}// Setup storage for internal depth/stencil buffers and bind to correct framebuffer
function setupRenderBufferStorage(renderbuffer,renderTarget,isMultisample){_gl.bindRenderbuffer(_gl.RENDERBUFFER,renderbuffer);if(renderTarget.depthBuffer){// retrieve the depth attachment types
const depthTexture=renderTarget.depthTexture;const depthType=depthTexture&&depthTexture.isDepthTexture?depthTexture.type:null;const glInternalFormat=getInternalDepthFormat(renderTarget.stencilBuffer,depthType);const glAttachmentType=renderTarget.stencilBuffer?_gl.DEPTH_STENCIL_ATTACHMENT:_gl.DEPTH_ATTACHMENT;// set up the attachment
const samples=getRenderTargetSamples(renderTarget);const isUseMultisampledRTT=useMultisampledRTT(renderTarget);if(isUseMultisampledRTT){multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER,samples,glInternalFormat,renderTarget.width,renderTarget.height);}else if(isMultisample){_gl.renderbufferStorageMultisample(_gl.RENDERBUFFER,samples,glInternalFormat,renderTarget.width,renderTarget.height);}else {_gl.renderbufferStorage(_gl.RENDERBUFFER,glInternalFormat,renderTarget.width,renderTarget.height);}_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,glAttachmentType,_gl.RENDERBUFFER,renderbuffer);}else {const textures=renderTarget.textures;for(let i=0;i<textures.length;i++){const texture=textures[i];const glFormat=utils.convert(texture.format,texture.colorSpace);const glType=utils.convert(texture.type);const glInternalFormat=getInternalFormat(texture.internalFormat,glFormat,glType,texture.colorSpace);const samples=getRenderTargetSamples(renderTarget);if(isMultisample&&useMultisampledRTT(renderTarget)===false){_gl.renderbufferStorageMultisample(_gl.RENDERBUFFER,samples,glInternalFormat,renderTarget.width,renderTarget.height);}else if(useMultisampledRTT(renderTarget)){multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER,samples,glInternalFormat,renderTarget.width,renderTarget.height);}else {_gl.renderbufferStorage(_gl.RENDERBUFFER,glInternalFormat,renderTarget.width,renderTarget.height);}}}_gl.bindRenderbuffer(_gl.RENDERBUFFER,null);}// Setup resources for a Depth Texture for a FBO (needs an extension)
function setupDepthTexture(framebuffer,renderTarget){const isCube=renderTarget&&renderTarget.isWebGLCubeRenderTarget;if(isCube)throw new Error('Depth Texture with cube render targets is not supported');state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);if(!(renderTarget.depthTexture&&renderTarget.depthTexture.isDepthTexture)){throw new Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');}// upload an empty depth texture with framebuffer size
if(!properties.get(renderTarget.depthTexture).__webglTexture||renderTarget.depthTexture.image.width!==renderTarget.width||renderTarget.depthTexture.image.height!==renderTarget.height){renderTarget.depthTexture.image.width=renderTarget.width;renderTarget.depthTexture.image.height=renderTarget.height;renderTarget.depthTexture.needsUpdate=true;}setTexture2D(renderTarget.depthTexture,0);const webglDepthTexture=properties.get(renderTarget.depthTexture).__webglTexture;const samples=getRenderTargetSamples(renderTarget);if(renderTarget.depthTexture.format===DepthFormat$1){if(useMultisampledRTT(renderTarget)){multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER,_gl.DEPTH_ATTACHMENT,_gl.TEXTURE_2D,webglDepthTexture,0,samples);}else {_gl.framebufferTexture2D(_gl.FRAMEBUFFER,_gl.DEPTH_ATTACHMENT,_gl.TEXTURE_2D,webglDepthTexture,0);}}else if(renderTarget.depthTexture.format===DepthStencilFormat$1){if(useMultisampledRTT(renderTarget)){multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER,_gl.DEPTH_STENCIL_ATTACHMENT,_gl.TEXTURE_2D,webglDepthTexture,0,samples);}else {_gl.framebufferTexture2D(_gl.FRAMEBUFFER,_gl.DEPTH_STENCIL_ATTACHMENT,_gl.TEXTURE_2D,webglDepthTexture,0);}}else {throw new Error('Unknown depthTexture format');}}// Setup GL resources for a non-texture depth buffer
function setupDepthRenderbuffer(renderTarget){const renderTargetProperties=properties.get(renderTarget);const isCube=renderTarget.isWebGLCubeRenderTarget===true;// if the bound depth texture has changed
if(renderTargetProperties.__boundDepthTexture!==renderTarget.depthTexture){// fire the dispose event to get rid of stored state associated with the previously bound depth buffer
const depthTexture=renderTarget.depthTexture;if(renderTargetProperties.__depthDisposeCallback){renderTargetProperties.__depthDisposeCallback();}// set up dispose listeners to track when the currently attached buffer is implicitly unbound
if(depthTexture){const disposeEvent=()=>{delete renderTargetProperties.__boundDepthTexture;delete renderTargetProperties.__depthDisposeCallback;depthTexture.removeEventListener('dispose',disposeEvent);};depthTexture.addEventListener('dispose',disposeEvent);renderTargetProperties.__depthDisposeCallback=disposeEvent;}renderTargetProperties.__boundDepthTexture=depthTexture;}if(renderTarget.depthTexture&&!renderTargetProperties.__autoAllocateDepthBuffer){if(isCube)throw new Error('target.depthTexture not supported in Cube render targets');setupDepthTexture(renderTargetProperties.__webglFramebuffer,renderTarget);}else {if(isCube){renderTargetProperties.__webglDepthbuffer=[];for(let i=0;i<6;i++){state.bindFramebuffer(_gl.FRAMEBUFFER,renderTargetProperties.__webglFramebuffer[i]);if(renderTargetProperties.__webglDepthbuffer[i]===undefined){renderTargetProperties.__webglDepthbuffer[i]=_gl.createRenderbuffer();setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i],renderTarget,false);}else {// attach buffer if it's been created already
const glAttachmentType=renderTarget.stencilBuffer?_gl.DEPTH_STENCIL_ATTACHMENT:_gl.DEPTH_ATTACHMENT;const renderbuffer=renderTargetProperties.__webglDepthbuffer[i];_gl.bindRenderbuffer(_gl.RENDERBUFFER,renderbuffer);_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,glAttachmentType,_gl.RENDERBUFFER,renderbuffer);}}}else {state.bindFramebuffer(_gl.FRAMEBUFFER,renderTargetProperties.__webglFramebuffer);if(renderTargetProperties.__webglDepthbuffer===undefined){renderTargetProperties.__webglDepthbuffer=_gl.createRenderbuffer();setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer,renderTarget,false);}else {// attach buffer if it's been created already
const glAttachmentType=renderTarget.stencilBuffer?_gl.DEPTH_STENCIL_ATTACHMENT:_gl.DEPTH_ATTACHMENT;const renderbuffer=renderTargetProperties.__webglDepthbuffer;_gl.bindRenderbuffer(_gl.RENDERBUFFER,renderbuffer);_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,glAttachmentType,_gl.RENDERBUFFER,renderbuffer);}}}state.bindFramebuffer(_gl.FRAMEBUFFER,null);}// rebind framebuffer with external textures
function rebindTextures(renderTarget,colorTexture,depthTexture){const renderTargetProperties=properties.get(renderTarget);if(colorTexture!==undefined){setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer,renderTarget,renderTarget.texture,_gl.COLOR_ATTACHMENT0,_gl.TEXTURE_2D,0);}if(depthTexture!==undefined){setupDepthRenderbuffer(renderTarget);}}// Set up GL resources for the render target
function setupRenderTarget(renderTarget){const texture=renderTarget.texture;const renderTargetProperties=properties.get(renderTarget);const textureProperties=properties.get(texture);renderTarget.addEventListener('dispose',onRenderTargetDispose);const textures=renderTarget.textures;const isCube=renderTarget.isWebGLCubeRenderTarget===true;const isMultipleRenderTargets=textures.length>1;if(!isMultipleRenderTargets){if(textureProperties.__webglTexture===undefined){textureProperties.__webglTexture=_gl.createTexture();}textureProperties.__version=texture.version;info.memory.textures++;}// Setup framebuffer
if(isCube){renderTargetProperties.__webglFramebuffer=[];for(let i=0;i<6;i++){if(texture.mipmaps&&texture.mipmaps.length>0){renderTargetProperties.__webglFramebuffer[i]=[];for(let level=0;level<texture.mipmaps.length;level++){renderTargetProperties.__webglFramebuffer[i][level]=_gl.createFramebuffer();}}else {renderTargetProperties.__webglFramebuffer[i]=_gl.createFramebuffer();}}}else {if(texture.mipmaps&&texture.mipmaps.length>0){renderTargetProperties.__webglFramebuffer=[];for(let level=0;level<texture.mipmaps.length;level++){renderTargetProperties.__webglFramebuffer[level]=_gl.createFramebuffer();}}else {renderTargetProperties.__webglFramebuffer=_gl.createFramebuffer();}if(isMultipleRenderTargets){for(let i=0,il=textures.length;i<il;i++){const attachmentProperties=properties.get(textures[i]);if(attachmentProperties.__webglTexture===undefined){attachmentProperties.__webglTexture=_gl.createTexture();info.memory.textures++;}}}if(renderTarget.samples>0&&useMultisampledRTT(renderTarget)===false){renderTargetProperties.__webglMultisampledFramebuffer=_gl.createFramebuffer();renderTargetProperties.__webglColorRenderbuffer=[];state.bindFramebuffer(_gl.FRAMEBUFFER,renderTargetProperties.__webglMultisampledFramebuffer);for(let i=0;i<textures.length;i++){const texture=textures[i];renderTargetProperties.__webglColorRenderbuffer[i]=_gl.createRenderbuffer();_gl.bindRenderbuffer(_gl.RENDERBUFFER,renderTargetProperties.__webglColorRenderbuffer[i]);const glFormat=utils.convert(texture.format,texture.colorSpace);const glType=utils.convert(texture.type);const glInternalFormat=getInternalFormat(texture.internalFormat,glFormat,glType,texture.colorSpace,renderTarget.isXRRenderTarget===true);const samples=getRenderTargetSamples(renderTarget);_gl.renderbufferStorageMultisample(_gl.RENDERBUFFER,samples,glInternalFormat,renderTarget.width,renderTarget.height);_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.COLOR_ATTACHMENT0+i,_gl.RENDERBUFFER,renderTargetProperties.__webglColorRenderbuffer[i]);}_gl.bindRenderbuffer(_gl.RENDERBUFFER,null);if(renderTarget.depthBuffer){renderTargetProperties.__webglDepthRenderbuffer=_gl.createRenderbuffer();setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer,renderTarget,true);}state.bindFramebuffer(_gl.FRAMEBUFFER,null);}}// Setup color buffer
if(isCube){state.bindTexture(_gl.TEXTURE_CUBE_MAP,textureProperties.__webglTexture);setTextureParameters(_gl.TEXTURE_CUBE_MAP,texture);for(let i=0;i<6;i++){if(texture.mipmaps&&texture.mipmaps.length>0){for(let level=0;level<texture.mipmaps.length;level++){setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i][level],renderTarget,texture,_gl.COLOR_ATTACHMENT0,_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,level);}}else {setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i],renderTarget,texture,_gl.COLOR_ATTACHMENT0,_gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);}}if(textureNeedsGenerateMipmaps(texture)){generateMipmap(_gl.TEXTURE_CUBE_MAP);}state.unbindTexture();}else if(isMultipleRenderTargets){for(let i=0,il=textures.length;i<il;i++){const attachment=textures[i];const attachmentProperties=properties.get(attachment);state.bindTexture(_gl.TEXTURE_2D,attachmentProperties.__webglTexture);setTextureParameters(_gl.TEXTURE_2D,attachment);setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer,renderTarget,attachment,_gl.COLOR_ATTACHMENT0+i,_gl.TEXTURE_2D,0);if(textureNeedsGenerateMipmaps(attachment)){generateMipmap(_gl.TEXTURE_2D);}}state.unbindTexture();}else {let glTextureType=_gl.TEXTURE_2D;if(renderTarget.isWebGL3DRenderTarget||renderTarget.isWebGLArrayRenderTarget){glTextureType=renderTarget.isWebGL3DRenderTarget?_gl.TEXTURE_3D:_gl.TEXTURE_2D_ARRAY;}state.bindTexture(glTextureType,textureProperties.__webglTexture);setTextureParameters(glTextureType,texture);if(texture.mipmaps&&texture.mipmaps.length>0){for(let level=0;level<texture.mipmaps.length;level++){setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[level],renderTarget,texture,_gl.COLOR_ATTACHMENT0,glTextureType,level);}}else {setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer,renderTarget,texture,_gl.COLOR_ATTACHMENT0,glTextureType,0);}if(textureNeedsGenerateMipmaps(texture)){generateMipmap(glTextureType);}state.unbindTexture();}// Setup depth and stencil buffers
if(renderTarget.depthBuffer){setupDepthRenderbuffer(renderTarget);}}function updateRenderTargetMipmap(renderTarget){const textures=renderTarget.textures;for(let i=0,il=textures.length;i<il;i++){const texture=textures[i];if(textureNeedsGenerateMipmaps(texture)){const target=renderTarget.isWebGLCubeRenderTarget?_gl.TEXTURE_CUBE_MAP:_gl.TEXTURE_2D;const webglTexture=properties.get(texture).__webglTexture;state.bindTexture(target,webglTexture);generateMipmap(target);state.unbindTexture();}}}const invalidationArrayRead=[];const invalidationArrayDraw=[];function updateMultisampleRenderTarget(renderTarget){if(renderTarget.samples>0){if(useMultisampledRTT(renderTarget)===false){const textures=renderTarget.textures;const width=renderTarget.width;const height=renderTarget.height;let mask=_gl.COLOR_BUFFER_BIT;const depthStyle=renderTarget.stencilBuffer?_gl.DEPTH_STENCIL_ATTACHMENT:_gl.DEPTH_ATTACHMENT;const renderTargetProperties=properties.get(renderTarget);const isMultipleRenderTargets=textures.length>1;// If MRT we need to remove FBO attachments
if(isMultipleRenderTargets){for(let i=0;i<textures.length;i++){state.bindFramebuffer(_gl.FRAMEBUFFER,renderTargetProperties.__webglMultisampledFramebuffer);_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.COLOR_ATTACHMENT0+i,_gl.RENDERBUFFER,null);state.bindFramebuffer(_gl.FRAMEBUFFER,renderTargetProperties.__webglFramebuffer);_gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER,_gl.COLOR_ATTACHMENT0+i,_gl.TEXTURE_2D,null,0);}}state.bindFramebuffer(_gl.READ_FRAMEBUFFER,renderTargetProperties.__webglMultisampledFramebuffer);state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER,renderTargetProperties.__webglFramebuffer);for(let i=0;i<textures.length;i++){if(renderTarget.resolveDepthBuffer){if(renderTarget.depthBuffer)mask|=_gl.DEPTH_BUFFER_BIT;// resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)
if(renderTarget.stencilBuffer&&renderTarget.resolveStencilBuffer)mask|=_gl.STENCIL_BUFFER_BIT;}if(isMultipleRenderTargets){_gl.framebufferRenderbuffer(_gl.READ_FRAMEBUFFER,_gl.COLOR_ATTACHMENT0,_gl.RENDERBUFFER,renderTargetProperties.__webglColorRenderbuffer[i]);const webglTexture=properties.get(textures[i]).__webglTexture;_gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER,_gl.COLOR_ATTACHMENT0,_gl.TEXTURE_2D,webglTexture,0);}_gl.blitFramebuffer(0,0,width,height,0,0,width,height,mask,_gl.NEAREST);if(supportsInvalidateFramebuffer===true){invalidationArrayRead.length=0;invalidationArrayDraw.length=0;invalidationArrayRead.push(_gl.COLOR_ATTACHMENT0+i);if(renderTarget.depthBuffer&&renderTarget.resolveDepthBuffer===false){invalidationArrayRead.push(depthStyle);invalidationArrayDraw.push(depthStyle);_gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER,invalidationArrayDraw);}_gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER,invalidationArrayRead);}}state.bindFramebuffer(_gl.READ_FRAMEBUFFER,null);state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER,null);// If MRT since pre-blit we removed the FBO we need to reconstruct the attachments
if(isMultipleRenderTargets){for(let i=0;i<textures.length;i++){state.bindFramebuffer(_gl.FRAMEBUFFER,renderTargetProperties.__webglMultisampledFramebuffer);_gl.framebufferRenderbuffer(_gl.FRAMEBUFFER,_gl.COLOR_ATTACHMENT0+i,_gl.RENDERBUFFER,renderTargetProperties.__webglColorRenderbuffer[i]);const webglTexture=properties.get(textures[i]).__webglTexture;state.bindFramebuffer(_gl.FRAMEBUFFER,renderTargetProperties.__webglFramebuffer);_gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER,_gl.COLOR_ATTACHMENT0+i,_gl.TEXTURE_2D,webglTexture,0);}}state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER,renderTargetProperties.__webglMultisampledFramebuffer);}else {if(renderTarget.depthBuffer&&renderTarget.resolveDepthBuffer===false&&supportsInvalidateFramebuffer){const depthStyle=renderTarget.stencilBuffer?_gl.DEPTH_STENCIL_ATTACHMENT:_gl.DEPTH_ATTACHMENT;_gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER,[depthStyle]);}}}}function getRenderTargetSamples(renderTarget){return Math.min(capabilities.maxSamples,renderTarget.samples);}function useMultisampledRTT(renderTarget){const renderTargetProperties=properties.get(renderTarget);return renderTarget.samples>0&&extensions.has('WEBGL_multisampled_render_to_texture')===true&&renderTargetProperties.__useRenderToTexture!==false;}function updateVideoTexture(texture){const frame=info.render.frame;// Check the last frame we updated the VideoTexture
if(_videoTextures.get(texture)!==frame){_videoTextures.set(texture,frame);texture.update();}}function verifyColorSpace(texture,image){const colorSpace=texture.colorSpace;const format=texture.format;const type=texture.type;if(texture.isCompressedTexture===true||texture.isVideoTexture===true)return image;if(colorSpace!==LinearSRGBColorSpace$1&&colorSpace!==NoColorSpace$1){// sRGB
if(ColorManagement$1.getTransfer(colorSpace)===SRGBTransfer$1){// in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
if(format!==RGBAFormat$1||type!==UnsignedByteType$1){console.warn('THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.');}}else {console.error('THREE.WebGLTextures: Unsupported texture color space:',colorSpace);}}return image;}function getDimensions(image){if(typeof HTMLImageElement!=='undefined'&&image instanceof HTMLImageElement){// if intrinsic data are not available, fallback to width/height
_imageDimensions.width=image.naturalWidth||image.width;_imageDimensions.height=image.naturalHeight||image.height;}else if(typeof VideoFrame!=='undefined'&&image instanceof VideoFrame){_imageDimensions.width=image.displayWidth;_imageDimensions.height=image.displayHeight;}else {_imageDimensions.width=image.width;_imageDimensions.height=image.height;}return _imageDimensions;}//
this.allocateTextureUnit=allocateTextureUnit;this.resetTextureUnits=resetTextureUnits;this.setTexture2D=setTexture2D;this.setTexture2DArray=setTexture2DArray;this.setTexture3D=setTexture3D;this.setTextureCube=setTextureCube;this.rebindTextures=rebindTextures;this.setupRenderTarget=setupRenderTarget;this.updateRenderTargetMipmap=updateRenderTargetMipmap;this.updateMultisampleRenderTarget=updateMultisampleRenderTarget;this.setupDepthRenderbuffer=setupDepthRenderbuffer;this.setupFrameBufferTexture=setupFrameBufferTexture;this.useMultisampledRTT=useMultisampledRTT;}function WebGLUtils(gl,extensions){function convert(p,colorSpace=NoColorSpace$1){let extension;const transfer=ColorManagement$1.getTransfer(colorSpace);if(p===UnsignedByteType$1)return gl.UNSIGNED_BYTE;if(p===UnsignedShort4444Type)return gl.UNSIGNED_SHORT_4_4_4_4;if(p===UnsignedShort5551Type)return gl.UNSIGNED_SHORT_5_5_5_1;if(p===UnsignedInt5999Type)return gl.UNSIGNED_INT_5_9_9_9_REV;if(p===ByteType)return gl.BYTE;if(p===ShortType)return gl.SHORT;if(p===UnsignedShortType)return gl.UNSIGNED_SHORT;if(p===IntType$1)return gl.INT;if(p===UnsignedIntType$1)return gl.UNSIGNED_INT;if(p===FloatType$1)return gl.FLOAT;if(p===HalfFloatType$1)return gl.HALF_FLOAT;if(p===AlphaFormat)return gl.ALPHA;if(p===RGBFormat)return gl.RGB;if(p===RGBAFormat$1)return gl.RGBA;if(p===LuminanceFormat)return gl.LUMINANCE;if(p===LuminanceAlphaFormat)return gl.LUMINANCE_ALPHA;if(p===DepthFormat$1)return gl.DEPTH_COMPONENT;if(p===DepthStencilFormat$1)return gl.DEPTH_STENCIL;// WebGL2 formats.
if(p===RedFormat)return gl.RED;if(p===RedIntegerFormat)return gl.RED_INTEGER;if(p===RGFormat)return gl.RG;if(p===RGIntegerFormat)return gl.RG_INTEGER;if(p===RGBAIntegerFormat)return gl.RGBA_INTEGER;// S3TC
if(p===RGB_S3TC_DXT1_Format||p===RGBA_S3TC_DXT1_Format||p===RGBA_S3TC_DXT3_Format||p===RGBA_S3TC_DXT5_Format){if(transfer===SRGBTransfer$1){extension=extensions.get('WEBGL_compressed_texture_s3tc_srgb');if(extension!==null){if(p===RGB_S3TC_DXT1_Format)return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(p===RGBA_S3TC_DXT1_Format)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(p===RGBA_S3TC_DXT3_Format)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(p===RGBA_S3TC_DXT5_Format)return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;}else {return null;}}else {extension=extensions.get('WEBGL_compressed_texture_s3tc');if(extension!==null){if(p===RGB_S3TC_DXT1_Format)return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;if(p===RGBA_S3TC_DXT1_Format)return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(p===RGBA_S3TC_DXT3_Format)return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(p===RGBA_S3TC_DXT5_Format)return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;}else {return null;}}}// PVRTC
if(p===RGB_PVRTC_4BPPV1_Format||p===RGB_PVRTC_2BPPV1_Format||p===RGBA_PVRTC_4BPPV1_Format||p===RGBA_PVRTC_2BPPV1_Format){extension=extensions.get('WEBGL_compressed_texture_pvrtc');if(extension!==null){if(p===RGB_PVRTC_4BPPV1_Format)return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(p===RGB_PVRTC_2BPPV1_Format)return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(p===RGBA_PVRTC_4BPPV1_Format)return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(p===RGBA_PVRTC_2BPPV1_Format)return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;}else {return null;}}// ETC
if(p===RGB_ETC1_Format||p===RGB_ETC2_Format||p===RGBA_ETC2_EAC_Format){extension=extensions.get('WEBGL_compressed_texture_etc');if(extension!==null){if(p===RGB_ETC1_Format||p===RGB_ETC2_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ETC2:extension.COMPRESSED_RGB8_ETC2;if(p===RGBA_ETC2_EAC_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:extension.COMPRESSED_RGBA8_ETC2_EAC;}else {return null;}}// ASTC
if(p===RGBA_ASTC_4x4_Format||p===RGBA_ASTC_5x4_Format||p===RGBA_ASTC_5x5_Format||p===RGBA_ASTC_6x5_Format||p===RGBA_ASTC_6x6_Format||p===RGBA_ASTC_8x5_Format||p===RGBA_ASTC_8x6_Format||p===RGBA_ASTC_8x8_Format||p===RGBA_ASTC_10x5_Format||p===RGBA_ASTC_10x6_Format||p===RGBA_ASTC_10x8_Format||p===RGBA_ASTC_10x10_Format||p===RGBA_ASTC_12x10_Format||p===RGBA_ASTC_12x12_Format){extension=extensions.get('WEBGL_compressed_texture_astc');if(extension!==null){if(p===RGBA_ASTC_4x4_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:extension.COMPRESSED_RGBA_ASTC_4x4_KHR;if(p===RGBA_ASTC_5x4_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:extension.COMPRESSED_RGBA_ASTC_5x4_KHR;if(p===RGBA_ASTC_5x5_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:extension.COMPRESSED_RGBA_ASTC_5x5_KHR;if(p===RGBA_ASTC_6x5_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:extension.COMPRESSED_RGBA_ASTC_6x5_KHR;if(p===RGBA_ASTC_6x6_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:extension.COMPRESSED_RGBA_ASTC_6x6_KHR;if(p===RGBA_ASTC_8x5_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:extension.COMPRESSED_RGBA_ASTC_8x5_KHR;if(p===RGBA_ASTC_8x6_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:extension.COMPRESSED_RGBA_ASTC_8x6_KHR;if(p===RGBA_ASTC_8x8_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:extension.COMPRESSED_RGBA_ASTC_8x8_KHR;if(p===RGBA_ASTC_10x5_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:extension.COMPRESSED_RGBA_ASTC_10x5_KHR;if(p===RGBA_ASTC_10x6_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:extension.COMPRESSED_RGBA_ASTC_10x6_KHR;if(p===RGBA_ASTC_10x8_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:extension.COMPRESSED_RGBA_ASTC_10x8_KHR;if(p===RGBA_ASTC_10x10_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:extension.COMPRESSED_RGBA_ASTC_10x10_KHR;if(p===RGBA_ASTC_12x10_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:extension.COMPRESSED_RGBA_ASTC_12x10_KHR;if(p===RGBA_ASTC_12x12_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:extension.COMPRESSED_RGBA_ASTC_12x12_KHR;}else {return null;}}// BPTC
if(p===RGBA_BPTC_Format||p===RGB_BPTC_SIGNED_Format||p===RGB_BPTC_UNSIGNED_Format){extension=extensions.get('EXT_texture_compression_bptc');if(extension!==null){if(p===RGBA_BPTC_Format)return transfer===SRGBTransfer$1?extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(p===RGB_BPTC_SIGNED_Format)return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(p===RGB_BPTC_UNSIGNED_Format)return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;}else {return null;}}// RGTC
if(p===RED_RGTC1_Format||p===SIGNED_RED_RGTC1_Format||p===RED_GREEN_RGTC2_Format||p===SIGNED_RED_GREEN_RGTC2_Format){extension=extensions.get('EXT_texture_compression_rgtc');if(extension!==null){if(p===RGBA_BPTC_Format)return extension.COMPRESSED_RED_RGTC1_EXT;if(p===SIGNED_RED_RGTC1_Format)return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(p===RED_GREEN_RGTC2_Format)return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;if(p===SIGNED_RED_GREEN_RGTC2_Format)return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;}else {return null;}}//
if(p===UnsignedInt248Type$1)return gl.UNSIGNED_INT_24_8;// if "p" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)
return gl[p]!==undefined?gl[p]:null;}return {convert:convert};}class ArrayCamera extends PerspectiveCamera$1{constructor(array=[]){super();this.isArrayCamera=true;this.cameras=array;}}class Group extends Object3D$1{constructor(){super();this.isGroup=true;this.type='Group';}}const _moveEvent={type:'move'};class WebXRController{constructor(){this._targetRay=null;this._grip=null;this._hand=null;}getHandSpace(){if(this._hand===null){this._hand=new Group();this._hand.matrixAutoUpdate=false;this._hand.visible=false;this._hand.joints={};this._hand.inputState={pinching:false};}return this._hand;}getTargetRaySpace(){if(this._targetRay===null){this._targetRay=new Group();this._targetRay.matrixAutoUpdate=false;this._targetRay.visible=false;this._targetRay.hasLinearVelocity=false;this._targetRay.linearVelocity=new Vector3$1();this._targetRay.hasAngularVelocity=false;this._targetRay.angularVelocity=new Vector3$1();}return this._targetRay;}getGripSpace(){if(this._grip===null){this._grip=new Group();this._grip.matrixAutoUpdate=false;this._grip.visible=false;this._grip.hasLinearVelocity=false;this._grip.linearVelocity=new Vector3$1();this._grip.hasAngularVelocity=false;this._grip.angularVelocity=new Vector3$1();}return this._grip;}dispatchEvent(event){if(this._targetRay!==null){this._targetRay.dispatchEvent(event);}if(this._grip!==null){this._grip.dispatchEvent(event);}if(this._hand!==null){this._hand.dispatchEvent(event);}return this;}connect(inputSource){if(inputSource&&inputSource.hand){const hand=this._hand;if(hand){for(const inputjoint of inputSource.hand.values()){// Initialize hand with joints when connected
this._getHandJoint(hand,inputjoint);}}}this.dispatchEvent({type:'connected',data:inputSource});return this;}disconnect(inputSource){this.dispatchEvent({type:'disconnected',data:inputSource});if(this._targetRay!==null){this._targetRay.visible=false;}if(this._grip!==null){this._grip.visible=false;}if(this._hand!==null){this._hand.visible=false;}return this;}update(inputSource,frame,referenceSpace){let inputPose=null;let gripPose=null;let handPose=null;const targetRay=this._targetRay;const grip=this._grip;const hand=this._hand;if(inputSource&&frame.session.visibilityState!=='visible-blurred'){if(hand&&inputSource.hand){handPose=true;for(const inputjoint of inputSource.hand.values()){// Update the joints groups with the XRJoint poses
const jointPose=frame.getJointPose(inputjoint,referenceSpace);// The transform of this joint will be updated with the joint pose on each frame
const joint=this._getHandJoint(hand,inputjoint);if(jointPose!==null){joint.matrix.fromArray(jointPose.transform.matrix);joint.matrix.decompose(joint.position,joint.rotation,joint.scale);joint.matrixWorldNeedsUpdate=true;joint.jointRadius=jointPose.radius;}joint.visible=jointPose!==null;}// Custom events
// Check pinchz
const indexTip=hand.joints['index-finger-tip'];const thumbTip=hand.joints['thumb-tip'];const distance=indexTip.position.distanceTo(thumbTip.position);const distanceToPinch=0.02;const threshold=0.005;if(hand.inputState.pinching&&distance>distanceToPinch+threshold){hand.inputState.pinching=false;this.dispatchEvent({type:'pinchend',handedness:inputSource.handedness,target:this});}else if(!hand.inputState.pinching&&distance<=distanceToPinch-threshold){hand.inputState.pinching=true;this.dispatchEvent({type:'pinchstart',handedness:inputSource.handedness,target:this});}}else {if(grip!==null&&inputSource.gripSpace){gripPose=frame.getPose(inputSource.gripSpace,referenceSpace);if(gripPose!==null){grip.matrix.fromArray(gripPose.transform.matrix);grip.matrix.decompose(grip.position,grip.rotation,grip.scale);grip.matrixWorldNeedsUpdate=true;if(gripPose.linearVelocity){grip.hasLinearVelocity=true;grip.linearVelocity.copy(gripPose.linearVelocity);}else {grip.hasLinearVelocity=false;}if(gripPose.angularVelocity){grip.hasAngularVelocity=true;grip.angularVelocity.copy(gripPose.angularVelocity);}else {grip.hasAngularVelocity=false;}}}}if(targetRay!==null){inputPose=frame.getPose(inputSource.targetRaySpace,referenceSpace);// Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it
if(inputPose===null&&gripPose!==null){inputPose=gripPose;}if(inputPose!==null){targetRay.matrix.fromArray(inputPose.transform.matrix);targetRay.matrix.decompose(targetRay.position,targetRay.rotation,targetRay.scale);targetRay.matrixWorldNeedsUpdate=true;if(inputPose.linearVelocity){targetRay.hasLinearVelocity=true;targetRay.linearVelocity.copy(inputPose.linearVelocity);}else {targetRay.hasLinearVelocity=false;}if(inputPose.angularVelocity){targetRay.hasAngularVelocity=true;targetRay.angularVelocity.copy(inputPose.angularVelocity);}else {targetRay.hasAngularVelocity=false;}this.dispatchEvent(_moveEvent);}}}if(targetRay!==null){targetRay.visible=inputPose!==null;}if(grip!==null){grip.visible=gripPose!==null;}if(hand!==null){hand.visible=handPose!==null;}return this;}// private method
_getHandJoint(hand,inputjoint){if(hand.joints[inputjoint.jointName]===undefined){const joint=new Group();joint.matrixAutoUpdate=false;joint.visible=false;hand.joints[inputjoint.jointName]=joint;hand.add(joint);}return hand.joints[inputjoint.jointName];}}const _occlusion_vertex=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`;const _occlusion_fragment=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;

void main() {

	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );

	if ( coord.x >= 1.0 ) {

		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

	} else {

		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

	}

}`;class WebXRDepthSensing{constructor(){this.texture=null;this.mesh=null;this.depthNear=0;this.depthFar=0;}init(renderer,depthData,renderState){if(this.texture===null){const texture=new Texture$1();const texProps=renderer.properties.get(texture);texProps.__webglTexture=depthData.texture;if(depthData.depthNear!=renderState.depthNear||depthData.depthFar!=renderState.depthFar){this.depthNear=depthData.depthNear;this.depthFar=depthData.depthFar;}this.texture=texture;}}getMesh(cameraXR){if(this.texture!==null){if(this.mesh===null){const viewport=cameraXR.cameras[0].viewport;const material=new ShaderMaterial({vertexShader:_occlusion_vertex,fragmentShader:_occlusion_fragment,uniforms:{depthColor:{value:this.texture},depthWidth:{value:viewport.z},depthHeight:{value:viewport.w}}});this.mesh=new Mesh$1(new PlaneGeometry(20,20),material);}}return this.mesh;}reset(){this.texture=null;this.mesh=null;}getDepthTexture(){return this.texture;}}class WebXRManager extends EventDispatcher$1{constructor(renderer,gl){super();const scope=this;let session=null;let framebufferScaleFactor=1.0;let referenceSpace=null;let referenceSpaceType='local-floor';// Set default foveation to maximum.
let foveation=1.0;let customReferenceSpace=null;let pose=null;let glBinding=null;let glProjLayer=null;let glBaseLayer=null;let xrFrame=null;const depthSensing=new WebXRDepthSensing();const attributes=gl.getContextAttributes();let initialRenderTarget=null;let newRenderTarget=null;const controllers=[];const controllerInputSources=[];const currentSize=new Vector2$1();let currentPixelRatio=null;//
const cameraL=new PerspectiveCamera$1();cameraL.layers.enable(1);cameraL.viewport=new Vector4$1();const cameraR=new PerspectiveCamera$1();cameraR.layers.enable(2);cameraR.viewport=new Vector4$1();const cameras=[cameraL,cameraR];const cameraXR=new ArrayCamera();cameraXR.layers.enable(1);cameraXR.layers.enable(2);let _currentDepthNear=null;let _currentDepthFar=null;//
this.cameraAutoUpdate=true;this.enabled=false;this.isPresenting=false;this.getController=function(index){let controller=controllers[index];if(controller===undefined){controller=new WebXRController();controllers[index]=controller;}return controller.getTargetRaySpace();};this.getControllerGrip=function(index){let controller=controllers[index];if(controller===undefined){controller=new WebXRController();controllers[index]=controller;}return controller.getGripSpace();};this.getHand=function(index){let controller=controllers[index];if(controller===undefined){controller=new WebXRController();controllers[index]=controller;}return controller.getHandSpace();};//
function onSessionEvent(event){const controllerIndex=controllerInputSources.indexOf(event.inputSource);if(controllerIndex===-1){return;}const controller=controllers[controllerIndex];if(controller!==undefined){controller.update(event.inputSource,event.frame,customReferenceSpace||referenceSpace);controller.dispatchEvent({type:event.type,data:event.inputSource});}}function onSessionEnd(){session.removeEventListener('select',onSessionEvent);session.removeEventListener('selectstart',onSessionEvent);session.removeEventListener('selectend',onSessionEvent);session.removeEventListener('squeeze',onSessionEvent);session.removeEventListener('squeezestart',onSessionEvent);session.removeEventListener('squeezeend',onSessionEvent);session.removeEventListener('end',onSessionEnd);session.removeEventListener('inputsourceschange',onInputSourcesChange);for(let i=0;i<controllers.length;i++){const inputSource=controllerInputSources[i];if(inputSource===null)continue;controllerInputSources[i]=null;controllers[i].disconnect(inputSource);}_currentDepthNear=null;_currentDepthFar=null;depthSensing.reset();// restore framebuffer/rendering state
renderer.setRenderTarget(initialRenderTarget);glBaseLayer=null;glProjLayer=null;glBinding=null;session=null;newRenderTarget=null;//
animation.stop();scope.isPresenting=false;renderer.setPixelRatio(currentPixelRatio);renderer.setSize(currentSize.width,currentSize.height,false);scope.dispatchEvent({type:'sessionend'});}this.setFramebufferScaleFactor=function(value){framebufferScaleFactor=value;if(scope.isPresenting===true){console.warn('THREE.WebXRManager: Cannot change framebuffer scale while presenting.');}};this.setReferenceSpaceType=function(value){referenceSpaceType=value;if(scope.isPresenting===true){console.warn('THREE.WebXRManager: Cannot change reference space type while presenting.');}};this.getReferenceSpace=function(){return customReferenceSpace||referenceSpace;};this.setReferenceSpace=function(space){customReferenceSpace=space;};this.getBaseLayer=function(){return glProjLayer!==null?glProjLayer:glBaseLayer;};this.getBinding=function(){return glBinding;};this.getFrame=function(){return xrFrame;};this.getSession=function(){return session;};this.setSession=async function(value){session=value;if(session!==null){initialRenderTarget=renderer.getRenderTarget();session.addEventListener('select',onSessionEvent);session.addEventListener('selectstart',onSessionEvent);session.addEventListener('selectend',onSessionEvent);session.addEventListener('squeeze',onSessionEvent);session.addEventListener('squeezestart',onSessionEvent);session.addEventListener('squeezeend',onSessionEvent);session.addEventListener('end',onSessionEnd);session.addEventListener('inputsourceschange',onInputSourcesChange);if(attributes.xrCompatible!==true){await gl.makeXRCompatible();}currentPixelRatio=renderer.getPixelRatio();renderer.getSize(currentSize);if(session.renderState.layers===undefined){const layerInit={antialias:attributes.antialias,alpha:true,depth:attributes.depth,stencil:attributes.stencil,framebufferScaleFactor:framebufferScaleFactor};glBaseLayer=new XRWebGLLayer(session,gl,layerInit);session.updateRenderState({baseLayer:glBaseLayer});renderer.setPixelRatio(1);renderer.setSize(glBaseLayer.framebufferWidth,glBaseLayer.framebufferHeight,false);newRenderTarget=new WebGLRenderTarget(glBaseLayer.framebufferWidth,glBaseLayer.framebufferHeight,{format:RGBAFormat$1,type:UnsignedByteType$1,colorSpace:renderer.outputColorSpace,stencilBuffer:attributes.stencil});}else {let depthFormat=null;let depthType=null;let glDepthFormat=null;if(attributes.depth){glDepthFormat=attributes.stencil?gl.DEPTH24_STENCIL8:gl.DEPTH_COMPONENT24;depthFormat=attributes.stencil?DepthStencilFormat$1:DepthFormat$1;depthType=attributes.stencil?UnsignedInt248Type$1:UnsignedIntType$1;}const projectionlayerInit={colorFormat:gl.RGBA8,depthFormat:glDepthFormat,scaleFactor:framebufferScaleFactor};glBinding=new XRWebGLBinding(session,gl);glProjLayer=glBinding.createProjectionLayer(projectionlayerInit);session.updateRenderState({layers:[glProjLayer]});renderer.setPixelRatio(1);renderer.setSize(glProjLayer.textureWidth,glProjLayer.textureHeight,false);newRenderTarget=new WebGLRenderTarget(glProjLayer.textureWidth,glProjLayer.textureHeight,{format:RGBAFormat$1,type:UnsignedByteType$1,depthTexture:new DepthTexture$1(glProjLayer.textureWidth,glProjLayer.textureHeight,depthType,undefined,undefined,undefined,undefined,undefined,undefined,depthFormat),stencilBuffer:attributes.stencil,colorSpace:renderer.outputColorSpace,samples:attributes.antialias?4:0,resolveDepthBuffer:glProjLayer.ignoreDepthValues===false});}newRenderTarget.isXRRenderTarget=true;// TODO Remove this when possible, see #23278
this.setFoveation(foveation);customReferenceSpace=null;referenceSpace=await session.requestReferenceSpace(referenceSpaceType);animation.setContext(session);animation.start();scope.isPresenting=true;scope.dispatchEvent({type:'sessionstart'});}};this.getEnvironmentBlendMode=function(){if(session!==null){return session.environmentBlendMode;}};this.getDepthTexture=function(){return depthSensing.getDepthTexture();};function onInputSourcesChange(event){// Notify disconnected
for(let i=0;i<event.removed.length;i++){const inputSource=event.removed[i];const index=controllerInputSources.indexOf(inputSource);if(index>=0){controllerInputSources[index]=null;controllers[index].disconnect(inputSource);}}// Notify connected
for(let i=0;i<event.added.length;i++){const inputSource=event.added[i];let controllerIndex=controllerInputSources.indexOf(inputSource);if(controllerIndex===-1){// Assign input source a controller that currently has no input source
for(let i=0;i<controllers.length;i++){if(i>=controllerInputSources.length){controllerInputSources.push(inputSource);controllerIndex=i;break;}else if(controllerInputSources[i]===null){controllerInputSources[i]=inputSource;controllerIndex=i;break;}}// If all controllers do currently receive input we ignore new ones
if(controllerIndex===-1)break;}const controller=controllers[controllerIndex];if(controller){controller.connect(inputSource);}}}//
const cameraLPos=new Vector3$1();const cameraRPos=new Vector3$1();/**
		 * Assumes 2 cameras that are parallel and share an X-axis, and that
		 * the cameras' projection and world matrices have already been set.
		 * And that near and far planes are identical for both cameras.
		 * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765
		 */function setProjectionFromUnion(camera,cameraL,cameraR){cameraLPos.setFromMatrixPosition(cameraL.matrixWorld);cameraRPos.setFromMatrixPosition(cameraR.matrixWorld);const ipd=cameraLPos.distanceTo(cameraRPos);const projL=cameraL.projectionMatrix.elements;const projR=cameraR.projectionMatrix.elements;// VR systems will have identical far and near planes, and
// most likely identical top and bottom frustum extents.
// Use the left camera for these values.
const near=projL[14]/(projL[10]-1);const far=projL[14]/(projL[10]+1);const topFov=(projL[9]+1)/projL[5];const bottomFov=(projL[9]-1)/projL[5];const leftFov=(projL[8]-1)/projL[0];const rightFov=(projR[8]+1)/projR[0];const left=near*leftFov;const right=near*rightFov;// Calculate the new camera's position offset from the
// left camera. xOffset should be roughly half `ipd`.
const zOffset=ipd/(-leftFov+rightFov);const xOffset=zOffset*-leftFov;// TODO: Better way to apply this offset?
cameraL.matrixWorld.decompose(camera.position,camera.quaternion,camera.scale);camera.translateX(xOffset);camera.translateZ(zOffset);camera.matrixWorld.compose(camera.position,camera.quaternion,camera.scale);camera.matrixWorldInverse.copy(camera.matrixWorld).invert();// Check if the projection uses an infinite far plane.
if(projL[10]===-1.0){// Use the projection matrix from the left eye.
// The camera offset is sufficient to include the view volumes
// of both eyes (assuming symmetric projections).
camera.projectionMatrix.copy(cameraL.projectionMatrix);camera.projectionMatrixInverse.copy(cameraL.projectionMatrixInverse);}else {// Find the union of the frustum values of the cameras and scale
// the values so that the near plane's position does not change in world space,
// although must now be relative to the new union camera.
const near2=near+zOffset;const far2=far+zOffset;const left2=left-xOffset;const right2=right+(ipd-xOffset);const top2=topFov*far/far2*near2;const bottom2=bottomFov*far/far2*near2;camera.projectionMatrix.makePerspective(left2,right2,top2,bottom2,near2,far2);camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();}}function updateCamera(camera,parent){if(parent===null){camera.matrixWorld.copy(camera.matrix);}else {camera.matrixWorld.multiplyMatrices(parent.matrixWorld,camera.matrix);}camera.matrixWorldInverse.copy(camera.matrixWorld).invert();}this.updateCamera=function(camera){if(session===null)return;let depthNear=camera.near;let depthFar=camera.far;if(depthSensing.texture!==null){if(depthSensing.depthNear>0)depthNear=depthSensing.depthNear;if(depthSensing.depthFar>0)depthFar=depthSensing.depthFar;}cameraXR.near=cameraR.near=cameraL.near=depthNear;cameraXR.far=cameraR.far=cameraL.far=depthFar;if(_currentDepthNear!==cameraXR.near||_currentDepthFar!==cameraXR.far){// Note that the new renderState won't apply until the next frame. See #18320
session.updateRenderState({depthNear:cameraXR.near,depthFar:cameraXR.far});_currentDepthNear=cameraXR.near;_currentDepthFar=cameraXR.far;}const parent=camera.parent;const cameras=cameraXR.cameras;updateCamera(cameraXR,parent);for(let i=0;i<cameras.length;i++){updateCamera(cameras[i],parent);}// update projection matrix for proper view frustum culling
if(cameras.length===2){setProjectionFromUnion(cameraXR,cameraL,cameraR);}else {// assume single camera setup (AR)
cameraXR.projectionMatrix.copy(cameraL.projectionMatrix);}// update user camera and its children
updateUserCamera(camera,cameraXR,parent);};function updateUserCamera(camera,cameraXR,parent){if(parent===null){camera.matrix.copy(cameraXR.matrixWorld);}else {camera.matrix.copy(parent.matrixWorld);camera.matrix.invert();camera.matrix.multiply(cameraXR.matrixWorld);}camera.matrix.decompose(camera.position,camera.quaternion,camera.scale);camera.updateMatrixWorld(true);camera.projectionMatrix.copy(cameraXR.projectionMatrix);camera.projectionMatrixInverse.copy(cameraXR.projectionMatrixInverse);if(camera.isPerspectiveCamera){camera.fov=RAD2DEG$1*2*Math.atan(1/camera.projectionMatrix.elements[5]);camera.zoom=1;}}this.getCamera=function(){return cameraXR;};this.getFoveation=function(){if(glProjLayer===null&&glBaseLayer===null){return undefined;}return foveation;};this.setFoveation=function(value){// 0 = no foveation = full resolution
// 1 = maximum foveation = the edges render at lower resolution
foveation=value;if(glProjLayer!==null){glProjLayer.fixedFoveation=value;}if(glBaseLayer!==null&&glBaseLayer.fixedFoveation!==undefined){glBaseLayer.fixedFoveation=value;}};this.hasDepthSensing=function(){return depthSensing.texture!==null;};this.getDepthSensingMesh=function(){return depthSensing.getMesh(cameraXR);};// Animation Loop
let onAnimationFrameCallback=null;function onAnimationFrame(time,frame){pose=frame.getViewerPose(customReferenceSpace||referenceSpace);xrFrame=frame;if(pose!==null){const views=pose.views;if(glBaseLayer!==null){renderer.setRenderTargetFramebuffer(newRenderTarget,glBaseLayer.framebuffer);renderer.setRenderTarget(newRenderTarget);}let cameraXRNeedsUpdate=false;// check if it's necessary to rebuild cameraXR's camera list
if(views.length!==cameraXR.cameras.length){cameraXR.cameras.length=0;cameraXRNeedsUpdate=true;}for(let i=0;i<views.length;i++){const view=views[i];let viewport=null;if(glBaseLayer!==null){viewport=glBaseLayer.getViewport(view);}else {const glSubImage=glBinding.getViewSubImage(glProjLayer,view);viewport=glSubImage.viewport;// For side-by-side projection, we only produce a single texture for both eyes.
if(i===0){renderer.setRenderTargetTextures(newRenderTarget,glSubImage.colorTexture,glProjLayer.ignoreDepthValues?undefined:glSubImage.depthStencilTexture);renderer.setRenderTarget(newRenderTarget);}}let camera=cameras[i];if(camera===undefined){camera=new PerspectiveCamera$1();camera.layers.enable(i);camera.viewport=new Vector4$1();cameras[i]=camera;}camera.matrix.fromArray(view.transform.matrix);camera.matrix.decompose(camera.position,camera.quaternion,camera.scale);camera.projectionMatrix.fromArray(view.projectionMatrix);camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();camera.viewport.set(viewport.x,viewport.y,viewport.width,viewport.height);if(i===0){cameraXR.matrix.copy(camera.matrix);cameraXR.matrix.decompose(cameraXR.position,cameraXR.quaternion,cameraXR.scale);}if(cameraXRNeedsUpdate===true){cameraXR.cameras.push(camera);}}//
const enabledFeatures=session.enabledFeatures;if(enabledFeatures&&enabledFeatures.includes('depth-sensing')){const depthData=glBinding.getDepthInformation(views[0]);if(depthData&&depthData.isValid&&depthData.texture){depthSensing.init(renderer,depthData,session.renderState);}}}//
for(let i=0;i<controllers.length;i++){const inputSource=controllerInputSources[i];const controller=controllers[i];if(inputSource!==null&&controller!==undefined){controller.update(inputSource,frame,customReferenceSpace||referenceSpace);}}if(onAnimationFrameCallback)onAnimationFrameCallback(time,frame);if(frame.detectedPlanes){scope.dispatchEvent({type:'planesdetected',data:frame});}xrFrame=null;}const animation=new WebGLAnimation();animation.setAnimationLoop(onAnimationFrame);this.setAnimationLoop=function(callback){onAnimationFrameCallback=callback;};this.dispose=function(){};}}const _e1=/*@__PURE__*/new Euler$1();const _m1$5=/*@__PURE__*/new Matrix4$1();function WebGLMaterials(renderer,properties){function refreshTransformUniform(map,uniform){if(map.matrixAutoUpdate===true){map.updateMatrix();}uniform.value.copy(map.matrix);}function refreshFogUniforms(uniforms,fog){fog.color.getRGB(uniforms.fogColor.value,getUnlitUniformColorSpace(renderer));if(fog.isFog){uniforms.fogNear.value=fog.near;uniforms.fogFar.value=fog.far;}else if(fog.isFogExp2){uniforms.fogDensity.value=fog.density;}}function refreshMaterialUniforms(uniforms,material,pixelRatio,height,transmissionRenderTarget){if(material.isMeshBasicMaterial){refreshUniformsCommon(uniforms,material);}else if(material.isMeshLambertMaterial){refreshUniformsCommon(uniforms,material);}else if(material.isMeshToonMaterial){refreshUniformsCommon(uniforms,material);refreshUniformsToon(uniforms,material);}else if(material.isMeshPhongMaterial){refreshUniformsCommon(uniforms,material);refreshUniformsPhong(uniforms,material);}else if(material.isMeshStandardMaterial){refreshUniformsCommon(uniforms,material);refreshUniformsStandard(uniforms,material);if(material.isMeshPhysicalMaterial){refreshUniformsPhysical(uniforms,material,transmissionRenderTarget);}}else if(material.isMeshMatcapMaterial){refreshUniformsCommon(uniforms,material);refreshUniformsMatcap(uniforms,material);}else if(material.isMeshDepthMaterial){refreshUniformsCommon(uniforms,material);}else if(material.isMeshDistanceMaterial){refreshUniformsCommon(uniforms,material);refreshUniformsDistance(uniforms,material);}else if(material.isMeshNormalMaterial){refreshUniformsCommon(uniforms,material);}else if(material.isLineBasicMaterial){refreshUniformsLine(uniforms,material);if(material.isLineDashedMaterial){refreshUniformsDash(uniforms,material);}}else if(material.isPointsMaterial){refreshUniformsPoints(uniforms,material,pixelRatio,height);}else if(material.isSpriteMaterial){refreshUniformsSprites(uniforms,material);}else if(material.isShadowMaterial){uniforms.color.value.copy(material.color);uniforms.opacity.value=material.opacity;}else if(material.isShaderMaterial){material.uniformsNeedUpdate=false;// #15581
}}function refreshUniformsCommon(uniforms,material){uniforms.opacity.value=material.opacity;if(material.color){uniforms.diffuse.value.copy(material.color);}if(material.emissive){uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity);}if(material.map){uniforms.map.value=material.map;refreshTransformUniform(material.map,uniforms.mapTransform);}if(material.alphaMap){uniforms.alphaMap.value=material.alphaMap;refreshTransformUniform(material.alphaMap,uniforms.alphaMapTransform);}if(material.bumpMap){uniforms.bumpMap.value=material.bumpMap;refreshTransformUniform(material.bumpMap,uniforms.bumpMapTransform);uniforms.bumpScale.value=material.bumpScale;if(material.side===BackSide$1){uniforms.bumpScale.value*=-1;}}if(material.normalMap){uniforms.normalMap.value=material.normalMap;refreshTransformUniform(material.normalMap,uniforms.normalMapTransform);uniforms.normalScale.value.copy(material.normalScale);if(material.side===BackSide$1){uniforms.normalScale.value.negate();}}if(material.displacementMap){uniforms.displacementMap.value=material.displacementMap;refreshTransformUniform(material.displacementMap,uniforms.displacementMapTransform);uniforms.displacementScale.value=material.displacementScale;uniforms.displacementBias.value=material.displacementBias;}if(material.emissiveMap){uniforms.emissiveMap.value=material.emissiveMap;refreshTransformUniform(material.emissiveMap,uniforms.emissiveMapTransform);}if(material.specularMap){uniforms.specularMap.value=material.specularMap;refreshTransformUniform(material.specularMap,uniforms.specularMapTransform);}if(material.alphaTest>0){uniforms.alphaTest.value=material.alphaTest;}const materialProperties=properties.get(material);const envMap=materialProperties.envMap;const envMapRotation=materialProperties.envMapRotation;if(envMap){uniforms.envMap.value=envMap;_e1.copy(envMapRotation);// accommodate left-handed frame
_e1.x*=-1;_e1.y*=-1;_e1.z*=-1;if(envMap.isCubeTexture&&envMap.isRenderTargetTexture===false){// environment maps which are not cube render targets or PMREMs follow a different convention
_e1.y*=-1;_e1.z*=-1;}uniforms.envMapRotation.value.setFromMatrix4(_m1$5.makeRotationFromEuler(_e1));uniforms.flipEnvMap.value=envMap.isCubeTexture&&envMap.isRenderTargetTexture===false?-1:1;uniforms.reflectivity.value=material.reflectivity;uniforms.ior.value=material.ior;uniforms.refractionRatio.value=material.refractionRatio;}if(material.lightMap){uniforms.lightMap.value=material.lightMap;uniforms.lightMapIntensity.value=material.lightMapIntensity;refreshTransformUniform(material.lightMap,uniforms.lightMapTransform);}if(material.aoMap){uniforms.aoMap.value=material.aoMap;uniforms.aoMapIntensity.value=material.aoMapIntensity;refreshTransformUniform(material.aoMap,uniforms.aoMapTransform);}}function refreshUniformsLine(uniforms,material){uniforms.diffuse.value.copy(material.color);uniforms.opacity.value=material.opacity;if(material.map){uniforms.map.value=material.map;refreshTransformUniform(material.map,uniforms.mapTransform);}}function refreshUniformsDash(uniforms,material){uniforms.dashSize.value=material.dashSize;uniforms.totalSize.value=material.dashSize+material.gapSize;uniforms.scale.value=material.scale;}function refreshUniformsPoints(uniforms,material,pixelRatio,height){uniforms.diffuse.value.copy(material.color);uniforms.opacity.value=material.opacity;uniforms.size.value=material.size*pixelRatio;uniforms.scale.value=height*0.5;if(material.map){uniforms.map.value=material.map;refreshTransformUniform(material.map,uniforms.uvTransform);}if(material.alphaMap){uniforms.alphaMap.value=material.alphaMap;refreshTransformUniform(material.alphaMap,uniforms.alphaMapTransform);}if(material.alphaTest>0){uniforms.alphaTest.value=material.alphaTest;}}function refreshUniformsSprites(uniforms,material){uniforms.diffuse.value.copy(material.color);uniforms.opacity.value=material.opacity;uniforms.rotation.value=material.rotation;if(material.map){uniforms.map.value=material.map;refreshTransformUniform(material.map,uniforms.mapTransform);}if(material.alphaMap){uniforms.alphaMap.value=material.alphaMap;refreshTransformUniform(material.alphaMap,uniforms.alphaMapTransform);}if(material.alphaTest>0){uniforms.alphaTest.value=material.alphaTest;}}function refreshUniformsPhong(uniforms,material){uniforms.specular.value.copy(material.specular);uniforms.shininess.value=Math.max(material.shininess,1e-4);// to prevent pow( 0.0, 0.0 )
}function refreshUniformsToon(uniforms,material){if(material.gradientMap){uniforms.gradientMap.value=material.gradientMap;}}function refreshUniformsStandard(uniforms,material){uniforms.metalness.value=material.metalness;if(material.metalnessMap){uniforms.metalnessMap.value=material.metalnessMap;refreshTransformUniform(material.metalnessMap,uniforms.metalnessMapTransform);}uniforms.roughness.value=material.roughness;if(material.roughnessMap){uniforms.roughnessMap.value=material.roughnessMap;refreshTransformUniform(material.roughnessMap,uniforms.roughnessMapTransform);}if(material.envMap){//uniforms.envMap.value = material.envMap; // part of uniforms common
uniforms.envMapIntensity.value=material.envMapIntensity;}}function refreshUniformsPhysical(uniforms,material,transmissionRenderTarget){uniforms.ior.value=material.ior;// also part of uniforms common
if(material.sheen>0){uniforms.sheenColor.value.copy(material.sheenColor).multiplyScalar(material.sheen);uniforms.sheenRoughness.value=material.sheenRoughness;if(material.sheenColorMap){uniforms.sheenColorMap.value=material.sheenColorMap;refreshTransformUniform(material.sheenColorMap,uniforms.sheenColorMapTransform);}if(material.sheenRoughnessMap){uniforms.sheenRoughnessMap.value=material.sheenRoughnessMap;refreshTransformUniform(material.sheenRoughnessMap,uniforms.sheenRoughnessMapTransform);}}if(material.clearcoat>0){uniforms.clearcoat.value=material.clearcoat;uniforms.clearcoatRoughness.value=material.clearcoatRoughness;if(material.clearcoatMap){uniforms.clearcoatMap.value=material.clearcoatMap;refreshTransformUniform(material.clearcoatMap,uniforms.clearcoatMapTransform);}if(material.clearcoatRoughnessMap){uniforms.clearcoatRoughnessMap.value=material.clearcoatRoughnessMap;refreshTransformUniform(material.clearcoatRoughnessMap,uniforms.clearcoatRoughnessMapTransform);}if(material.clearcoatNormalMap){uniforms.clearcoatNormalMap.value=material.clearcoatNormalMap;refreshTransformUniform(material.clearcoatNormalMap,uniforms.clearcoatNormalMapTransform);uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale);if(material.side===BackSide$1){uniforms.clearcoatNormalScale.value.negate();}}}if(material.dispersion>0){uniforms.dispersion.value=material.dispersion;}if(material.iridescence>0){uniforms.iridescence.value=material.iridescence;uniforms.iridescenceIOR.value=material.iridescenceIOR;uniforms.iridescenceThicknessMinimum.value=material.iridescenceThicknessRange[0];uniforms.iridescenceThicknessMaximum.value=material.iridescenceThicknessRange[1];if(material.iridescenceMap){uniforms.iridescenceMap.value=material.iridescenceMap;refreshTransformUniform(material.iridescenceMap,uniforms.iridescenceMapTransform);}if(material.iridescenceThicknessMap){uniforms.iridescenceThicknessMap.value=material.iridescenceThicknessMap;refreshTransformUniform(material.iridescenceThicknessMap,uniforms.iridescenceThicknessMapTransform);}}if(material.transmission>0){uniforms.transmission.value=material.transmission;uniforms.transmissionSamplerMap.value=transmissionRenderTarget.texture;uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width,transmissionRenderTarget.height);if(material.transmissionMap){uniforms.transmissionMap.value=material.transmissionMap;refreshTransformUniform(material.transmissionMap,uniforms.transmissionMapTransform);}uniforms.thickness.value=material.thickness;if(material.thicknessMap){uniforms.thicknessMap.value=material.thicknessMap;refreshTransformUniform(material.thicknessMap,uniforms.thicknessMapTransform);}uniforms.attenuationDistance.value=material.attenuationDistance;uniforms.attenuationColor.value.copy(material.attenuationColor);}if(material.anisotropy>0){uniforms.anisotropyVector.value.set(material.anisotropy*Math.cos(material.anisotropyRotation),material.anisotropy*Math.sin(material.anisotropyRotation));if(material.anisotropyMap){uniforms.anisotropyMap.value=material.anisotropyMap;refreshTransformUniform(material.anisotropyMap,uniforms.anisotropyMapTransform);}}uniforms.specularIntensity.value=material.specularIntensity;uniforms.specularColor.value.copy(material.specularColor);if(material.specularColorMap){uniforms.specularColorMap.value=material.specularColorMap;refreshTransformUniform(material.specularColorMap,uniforms.specularColorMapTransform);}if(material.specularIntensityMap){uniforms.specularIntensityMap.value=material.specularIntensityMap;refreshTransformUniform(material.specularIntensityMap,uniforms.specularIntensityMapTransform);}}function refreshUniformsMatcap(uniforms,material){if(material.matcap){uniforms.matcap.value=material.matcap;}}function refreshUniformsDistance(uniforms,material){const light=properties.get(material).light;uniforms.referencePosition.value.setFromMatrixPosition(light.matrixWorld);uniforms.nearDistance.value=light.shadow.camera.near;uniforms.farDistance.value=light.shadow.camera.far;}return {refreshFogUniforms:refreshFogUniforms,refreshMaterialUniforms:refreshMaterialUniforms};}function WebGLUniformsGroups(gl,info,capabilities,state){let buffers={};let updateList={};let allocatedBindingPoints=[];const maxBindingPoints=gl.getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS);// binding points are global whereas block indices are per shader program
function bind(uniformsGroup,program){const webglProgram=program.program;state.uniformBlockBinding(uniformsGroup,webglProgram);}function update(uniformsGroup,program){let buffer=buffers[uniformsGroup.id];if(buffer===undefined){prepareUniformsGroup(uniformsGroup);buffer=createBuffer(uniformsGroup);buffers[uniformsGroup.id]=buffer;uniformsGroup.addEventListener('dispose',onUniformsGroupsDispose);}// ensure to update the binding points/block indices mapping for this program
const webglProgram=program.program;state.updateUBOMapping(uniformsGroup,webglProgram);// update UBO once per frame
const frame=info.render.frame;if(updateList[uniformsGroup.id]!==frame){updateBufferData(uniformsGroup);updateList[uniformsGroup.id]=frame;}}function createBuffer(uniformsGroup){// the setup of an UBO is independent of a particular shader program but global
const bindingPointIndex=allocateBindingPointIndex();uniformsGroup.__bindingPointIndex=bindingPointIndex;const buffer=gl.createBuffer();const size=uniformsGroup.__size;const usage=uniformsGroup.usage;gl.bindBuffer(gl.UNIFORM_BUFFER,buffer);gl.bufferData(gl.UNIFORM_BUFFER,size,usage);gl.bindBuffer(gl.UNIFORM_BUFFER,null);gl.bindBufferBase(gl.UNIFORM_BUFFER,bindingPointIndex,buffer);return buffer;}function allocateBindingPointIndex(){for(let i=0;i<maxBindingPoints;i++){if(allocatedBindingPoints.indexOf(i)===-1){allocatedBindingPoints.push(i);return i;}}console.error('THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.');return 0;}function updateBufferData(uniformsGroup){const buffer=buffers[uniformsGroup.id];const uniforms=uniformsGroup.uniforms;const cache=uniformsGroup.__cache;gl.bindBuffer(gl.UNIFORM_BUFFER,buffer);for(let i=0,il=uniforms.length;i<il;i++){const uniformArray=Array.isArray(uniforms[i])?uniforms[i]:[uniforms[i]];for(let j=0,jl=uniformArray.length;j<jl;j++){const uniform=uniformArray[j];if(hasUniformChanged(uniform,i,j,cache)===true){const offset=uniform.__offset;const values=Array.isArray(uniform.value)?uniform.value:[uniform.value];let arrayOffset=0;for(let k=0;k<values.length;k++){const value=values[k];const info=getUniformSize(value);// TODO add integer and struct support
if(typeof value==='number'||typeof value==='boolean'){uniform.__data[0]=value;gl.bufferSubData(gl.UNIFORM_BUFFER,offset+arrayOffset,uniform.__data);}else if(value.isMatrix3){// manually converting 3x3 to 3x4
uniform.__data[0]=value.elements[0];uniform.__data[1]=value.elements[1];uniform.__data[2]=value.elements[2];uniform.__data[3]=0;uniform.__data[4]=value.elements[3];uniform.__data[5]=value.elements[4];uniform.__data[6]=value.elements[5];uniform.__data[7]=0;uniform.__data[8]=value.elements[6];uniform.__data[9]=value.elements[7];uniform.__data[10]=value.elements[8];uniform.__data[11]=0;}else {value.toArray(uniform.__data,arrayOffset);arrayOffset+=info.storage/Float32Array.BYTES_PER_ELEMENT;}}gl.bufferSubData(gl.UNIFORM_BUFFER,offset,uniform.__data);}}}gl.bindBuffer(gl.UNIFORM_BUFFER,null);}function hasUniformChanged(uniform,index,indexArray,cache){const value=uniform.value;const indexString=index+'_'+indexArray;if(cache[indexString]===undefined){// cache entry does not exist so far
if(typeof value==='number'||typeof value==='boolean'){cache[indexString]=value;}else {cache[indexString]=value.clone();}return true;}else {const cachedObject=cache[indexString];// compare current value with cached entry
if(typeof value==='number'||typeof value==='boolean'){if(cachedObject!==value){cache[indexString]=value;return true;}}else {if(cachedObject.equals(value)===false){cachedObject.copy(value);return true;}}}return false;}function prepareUniformsGroup(uniformsGroup){// determine total buffer size according to the STD140 layout
// Hint: STD140 is the only supported layout in WebGL 2
const uniforms=uniformsGroup.uniforms;let offset=0;// global buffer offset in bytes
const chunkSize=16;// size of a chunk in bytes
for(let i=0,l=uniforms.length;i<l;i++){const uniformArray=Array.isArray(uniforms[i])?uniforms[i]:[uniforms[i]];for(let j=0,jl=uniformArray.length;j<jl;j++){const uniform=uniformArray[j];const values=Array.isArray(uniform.value)?uniform.value:[uniform.value];for(let k=0,kl=values.length;k<kl;k++){const value=values[k];const info=getUniformSize(value);const chunkOffset=offset%chunkSize;// offset in the current chunk
const chunkPadding=chunkOffset%info.boundary;// required padding to match boundary
const chunkStart=chunkOffset+chunkPadding;// the start position in the current chunk for the data
offset+=chunkPadding;// Check for chunk overflow
if(chunkStart!==0&&chunkSize-chunkStart<info.storage){// Add padding and adjust offset
offset+=chunkSize-chunkStart;}// the following two properties will be used for partial buffer updates
uniform.__data=new Float32Array(info.storage/Float32Array.BYTES_PER_ELEMENT);uniform.__offset=offset;// Update the global offset
offset+=info.storage;}}}// ensure correct final padding
const chunkOffset=offset%chunkSize;if(chunkOffset>0)offset+=chunkSize-chunkOffset;//
uniformsGroup.__size=offset;uniformsGroup.__cache={};return this;}function getUniformSize(value){const info={boundary:0,// bytes
storage:0// bytes
};// determine sizes according to STD140
if(typeof value==='number'||typeof value==='boolean'){// float/int/bool
info.boundary=4;info.storage=4;}else if(value.isVector2){// vec2
info.boundary=8;info.storage=8;}else if(value.isVector3||value.isColor){// vec3
info.boundary=16;info.storage=12;// evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes
}else if(value.isVector4){// vec4
info.boundary=16;info.storage=16;}else if(value.isMatrix3){// mat3 (in STD140 a 3x3 matrix is represented as 3x4)
info.boundary=48;info.storage=48;}else if(value.isMatrix4){// mat4
info.boundary=64;info.storage=64;}else if(value.isTexture){console.warn('THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.');}else {console.warn('THREE.WebGLRenderer: Unsupported uniform value type.',value);}return info;}function onUniformsGroupsDispose(event){const uniformsGroup=event.target;uniformsGroup.removeEventListener('dispose',onUniformsGroupsDispose);const index=allocatedBindingPoints.indexOf(uniformsGroup.__bindingPointIndex);allocatedBindingPoints.splice(index,1);gl.deleteBuffer(buffers[uniformsGroup.id]);delete buffers[uniformsGroup.id];delete updateList[uniformsGroup.id];}function dispose(){for(const id in buffers){gl.deleteBuffer(buffers[id]);}allocatedBindingPoints=[];buffers={};updateList={};}return {bind:bind,update:update,dispose:dispose};}class WebGLRenderer{constructor(parameters={}){const{canvas=createCanvasElement(),context=null,depth=true,stencil=false,alpha=false,antialias=false,premultipliedAlpha=true,preserveDrawingBuffer=false,powerPreference='default',failIfMajorPerformanceCaveat=false}=parameters;this.isWebGLRenderer=true;let _alpha;if(context!==null){if(typeof WebGLRenderingContext!=='undefined'&&context instanceof WebGLRenderingContext){throw new Error('THREE.WebGLRenderer: WebGL 1 is not supported since r163.');}_alpha=context.getContextAttributes().alpha;}else {_alpha=alpha;}const uintClearColor=new Uint32Array(4);const intClearColor=new Int32Array(4);let currentRenderList=null;let currentRenderState=null;// render() can be called from within a callback triggered by another render.
// We track this so that the nested render call gets its list and state isolated from the parent render call.
const renderListStack=[];const renderStateStack=[];// public properties
this.domElement=canvas;// Debug configuration container
this.debug={/**
			 * Enables error checking and reporting when shader programs are being compiled
			 * @type {boolean}
			 */checkShaderErrors:true,/**
			 * Callback for custom error reporting.
			 * @type {?Function}
			 */onShaderError:null};// clearing
this.autoClear=true;this.autoClearColor=true;this.autoClearDepth=true;this.autoClearStencil=true;// scene graph
this.sortObjects=true;// user-defined clipping
this.clippingPlanes=[];this.localClippingEnabled=false;// physically based shading
this._outputColorSpace=SRGBColorSpace$1;// tone mapping
this.toneMapping=NoToneMapping$1;this.toneMappingExposure=1.0;// internal properties
const _this=this;let _isContextLost=false;// internal state cache
let _currentActiveCubeFace=0;let _currentActiveMipmapLevel=0;let _currentRenderTarget=null;let _currentMaterialId=-1;let _currentCamera=null;const _currentViewport=new Vector4$1();const _currentScissor=new Vector4$1();let _currentScissorTest=null;const _currentClearColor=new Color$1(0x000000);let _currentClearAlpha=0;//
let _width=canvas.width;let _height=canvas.height;let _pixelRatio=1;let _opaqueSort=null;let _transparentSort=null;const _viewport=new Vector4$1(0,0,_width,_height);const _scissor=new Vector4$1(0,0,_width,_height);let _scissorTest=false;// frustum
const _frustum=new Frustum();// clipping
let _clippingEnabled=false;let _localClippingEnabled=false;// camera matrices cache
const _projScreenMatrix=new Matrix4$1();const _vector3=new Vector3$1();const _vector4=new Vector4$1();const _emptyScene={background:null,fog:null,environment:null,overrideMaterial:null,isScene:true};let _renderBackground=false;function getTargetPixelRatio(){return _currentRenderTarget===null?_pixelRatio:1;}// initialize
let _gl=context;function getContext(contextName,contextAttributes){return canvas.getContext(contextName,contextAttributes);}try{const contextAttributes={alpha:true,depth,stencil,antialias,premultipliedAlpha,preserveDrawingBuffer,powerPreference,failIfMajorPerformanceCaveat};// OffscreenCanvas does not have setAttribute, see #22811
if('setAttribute'in canvas)canvas.setAttribute('data-engine',`three.js r${REVISION}`);// event listeners must be registered before WebGL context is created, see #12753
canvas.addEventListener('webglcontextlost',onContextLost,false);canvas.addEventListener('webglcontextrestored',onContextRestore,false);canvas.addEventListener('webglcontextcreationerror',onContextCreationError,false);if(_gl===null){const contextName='webgl2';_gl=getContext(contextName,contextAttributes);if(_gl===null){if(getContext(contextName)){throw new Error('Error creating WebGL context with your selected attributes.');}else {throw new Error('Error creating WebGL context.');}}}}catch(error){console.error('THREE.WebGLRenderer: '+error.message);throw error;}let extensions,capabilities,state,info;let properties,textures,cubemaps,cubeuvmaps,attributes,geometries,objects;let programCache,materials,renderLists,renderStates,clipping,shadowMap;let background,morphtargets,bufferRenderer,indexedBufferRenderer;let utils,bindingStates,uniformsGroups;function initGLContext(){extensions=new WebGLExtensions(_gl);extensions.init();utils=new WebGLUtils(_gl,extensions);capabilities=new WebGLCapabilities(_gl,extensions,parameters,utils);state=new WebGLState(_gl);info=new WebGLInfo(_gl);properties=new WebGLProperties();textures=new WebGLTextures(_gl,extensions,state,properties,capabilities,utils,info);cubemaps=new WebGLCubeMaps(_this);cubeuvmaps=new WebGLCubeUVMaps(_this);attributes=new WebGLAttributes(_gl);bindingStates=new WebGLBindingStates(_gl,attributes);geometries=new WebGLGeometries(_gl,attributes,info,bindingStates);objects=new WebGLObjects(_gl,geometries,attributes,info);morphtargets=new WebGLMorphtargets(_gl,capabilities,textures);clipping=new WebGLClipping(properties);programCache=new WebGLPrograms(_this,cubemaps,cubeuvmaps,extensions,capabilities,bindingStates,clipping);materials=new WebGLMaterials(_this,properties);renderLists=new WebGLRenderLists();renderStates=new WebGLRenderStates(extensions);background=new WebGLBackground(_this,cubemaps,cubeuvmaps,state,objects,_alpha,premultipliedAlpha);shadowMap=new WebGLShadowMap(_this,objects,capabilities);uniformsGroups=new WebGLUniformsGroups(_gl,info,capabilities,state);bufferRenderer=new WebGLBufferRenderer(_gl,extensions,info);indexedBufferRenderer=new WebGLIndexedBufferRenderer(_gl,extensions,info);info.programs=programCache.programs;_this.capabilities=capabilities;_this.extensions=extensions;_this.properties=properties;_this.renderLists=renderLists;_this.shadowMap=shadowMap;_this.state=state;_this.info=info;}initGLContext();// xr
const xr=new WebXRManager(_this,_gl);this.xr=xr;// API
this.getContext=function(){return _gl;};this.getContextAttributes=function(){return _gl.getContextAttributes();};this.forceContextLoss=function(){const extension=extensions.get('WEBGL_lose_context');if(extension)extension.loseContext();};this.forceContextRestore=function(){const extension=extensions.get('WEBGL_lose_context');if(extension)extension.restoreContext();};this.getPixelRatio=function(){return _pixelRatio;};this.setPixelRatio=function(value){if(value===undefined)return;_pixelRatio=value;this.setSize(_width,_height,false);};this.getSize=function(target){return target.set(_width,_height);};this.setSize=function(width,height,updateStyle=true){if(xr.isPresenting){console.warn('THREE.WebGLRenderer: Can\'t change size while VR device is presenting.');return;}_width=width;_height=height;canvas.width=Math.floor(width*_pixelRatio);canvas.height=Math.floor(height*_pixelRatio);if(updateStyle===true){canvas.style.width=width+'px';canvas.style.height=height+'px';}this.setViewport(0,0,width,height);};this.getDrawingBufferSize=function(target){return target.set(_width*_pixelRatio,_height*_pixelRatio).floor();};this.setDrawingBufferSize=function(width,height,pixelRatio){_width=width;_height=height;_pixelRatio=pixelRatio;canvas.width=Math.floor(width*pixelRatio);canvas.height=Math.floor(height*pixelRatio);this.setViewport(0,0,width,height);};this.getCurrentViewport=function(target){return target.copy(_currentViewport);};this.getViewport=function(target){return target.copy(_viewport);};this.setViewport=function(x,y,width,height){if(x.isVector4){_viewport.set(x.x,x.y,x.z,x.w);}else {_viewport.set(x,y,width,height);}state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).round());};this.getScissor=function(target){return target.copy(_scissor);};this.setScissor=function(x,y,width,height){if(x.isVector4){_scissor.set(x.x,x.y,x.z,x.w);}else {_scissor.set(x,y,width,height);}state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).round());};this.getScissorTest=function(){return _scissorTest;};this.setScissorTest=function(boolean){state.setScissorTest(_scissorTest=boolean);};this.setOpaqueSort=function(method){_opaqueSort=method;};this.setTransparentSort=function(method){_transparentSort=method;};// Clearing
this.getClearColor=function(target){return target.copy(background.getClearColor());};this.setClearColor=function(){background.setClearColor.apply(background,arguments);};this.getClearAlpha=function(){return background.getClearAlpha();};this.setClearAlpha=function(){background.setClearAlpha.apply(background,arguments);};this.clear=function(color=true,depth=true,stencil=true){let bits=0;if(color){// check if we're trying to clear an integer target
let isIntegerFormat=false;if(_currentRenderTarget!==null){const targetFormat=_currentRenderTarget.texture.format;isIntegerFormat=targetFormat===RGBAIntegerFormat||targetFormat===RGIntegerFormat||targetFormat===RedIntegerFormat;}// use the appropriate clear functions to clear the target if it's a signed
// or unsigned integer target
if(isIntegerFormat){const targetType=_currentRenderTarget.texture.type;const isUnsignedType=targetType===UnsignedByteType$1||targetType===UnsignedIntType$1||targetType===UnsignedShortType||targetType===UnsignedInt248Type$1||targetType===UnsignedShort4444Type||targetType===UnsignedShort5551Type;const clearColor=background.getClearColor();const a=background.getClearAlpha();const r=clearColor.r;const g=clearColor.g;const b=clearColor.b;if(isUnsignedType){uintClearColor[0]=r;uintClearColor[1]=g;uintClearColor[2]=b;uintClearColor[3]=a;_gl.clearBufferuiv(_gl.COLOR,0,uintClearColor);}else {intClearColor[0]=r;intClearColor[1]=g;intClearColor[2]=b;intClearColor[3]=a;_gl.clearBufferiv(_gl.COLOR,0,intClearColor);}}else {bits|=_gl.COLOR_BUFFER_BIT;}}if(depth)bits|=_gl.DEPTH_BUFFER_BIT;if(stencil){bits|=_gl.STENCIL_BUFFER_BIT;this.state.buffers.stencil.setMask(0xffffffff);}_gl.clear(bits);};this.clearColor=function(){this.clear(true,false,false);};this.clearDepth=function(){this.clear(false,true,false);};this.clearStencil=function(){this.clear(false,false,true);};//
this.dispose=function(){canvas.removeEventListener('webglcontextlost',onContextLost,false);canvas.removeEventListener('webglcontextrestored',onContextRestore,false);canvas.removeEventListener('webglcontextcreationerror',onContextCreationError,false);renderLists.dispose();renderStates.dispose();properties.dispose();cubemaps.dispose();cubeuvmaps.dispose();objects.dispose();bindingStates.dispose();uniformsGroups.dispose();programCache.dispose();xr.dispose();xr.removeEventListener('sessionstart',onXRSessionStart);xr.removeEventListener('sessionend',onXRSessionEnd);animation.stop();};// Events
function onContextLost(event){event.preventDefault();console.log('THREE.WebGLRenderer: Context Lost.');_isContextLost=true;}function onContextRestore(/* event */){console.log('THREE.WebGLRenderer: Context Restored.');_isContextLost=false;const infoAutoReset=info.autoReset;const shadowMapEnabled=shadowMap.enabled;const shadowMapAutoUpdate=shadowMap.autoUpdate;const shadowMapNeedsUpdate=shadowMap.needsUpdate;const shadowMapType=shadowMap.type;initGLContext();info.autoReset=infoAutoReset;shadowMap.enabled=shadowMapEnabled;shadowMap.autoUpdate=shadowMapAutoUpdate;shadowMap.needsUpdate=shadowMapNeedsUpdate;shadowMap.type=shadowMapType;}function onContextCreationError(event){console.error('THREE.WebGLRenderer: A WebGL context could not be created. Reason: ',event.statusMessage);}function onMaterialDispose(event){const material=event.target;material.removeEventListener('dispose',onMaterialDispose);deallocateMaterial(material);}// Buffer deallocation
function deallocateMaterial(material){releaseMaterialProgramReferences(material);properties.remove(material);}function releaseMaterialProgramReferences(material){const programs=properties.get(material).programs;if(programs!==undefined){programs.forEach(function(program){programCache.releaseProgram(program);});if(material.isShaderMaterial){programCache.releaseShaderCache(material);}}}// Buffer rendering
this.renderBufferDirect=function(camera,scene,geometry,material,object,group){if(scene===null)scene=_emptyScene;// renderBufferDirect second parameter used to be fog (could be null)
const frontFaceCW=object.isMesh&&object.matrixWorld.determinant()<0;const program=setProgram(camera,scene,geometry,material,object);state.setMaterial(material,frontFaceCW);//
let index=geometry.index;let rangeFactor=1;if(material.wireframe===true){index=geometries.getWireframeAttribute(geometry);if(index===undefined)return;rangeFactor=2;}//
const drawRange=geometry.drawRange;const position=geometry.attributes.position;let drawStart=drawRange.start*rangeFactor;let drawEnd=(drawRange.start+drawRange.count)*rangeFactor;if(group!==null){drawStart=Math.max(drawStart,group.start*rangeFactor);drawEnd=Math.min(drawEnd,(group.start+group.count)*rangeFactor);}if(index!==null){drawStart=Math.max(drawStart,0);drawEnd=Math.min(drawEnd,index.count);}else if(position!==undefined&&position!==null){drawStart=Math.max(drawStart,0);drawEnd=Math.min(drawEnd,position.count);}const drawCount=drawEnd-drawStart;if(drawCount<0||drawCount===Infinity)return;//
bindingStates.setup(object,material,program,geometry,index);let attribute;let renderer=bufferRenderer;if(index!==null){attribute=attributes.get(index);renderer=indexedBufferRenderer;renderer.setIndex(attribute);}//
if(object.isMesh){if(material.wireframe===true){state.setLineWidth(material.wireframeLinewidth*getTargetPixelRatio());renderer.setMode(_gl.LINES);}else {renderer.setMode(_gl.TRIANGLES);}}else if(object.isLine){let lineWidth=material.linewidth;if(lineWidth===undefined)lineWidth=1;// Not using Line*Material
state.setLineWidth(lineWidth*getTargetPixelRatio());if(object.isLineSegments){renderer.setMode(_gl.LINES);}else if(object.isLineLoop){renderer.setMode(_gl.LINE_LOOP);}else {renderer.setMode(_gl.LINE_STRIP);}}else if(object.isPoints){renderer.setMode(_gl.POINTS);}else if(object.isSprite){renderer.setMode(_gl.TRIANGLES);}if(object.isBatchedMesh){if(object._multiDrawInstances!==null){renderer.renderMultiDrawInstances(object._multiDrawStarts,object._multiDrawCounts,object._multiDrawCount,object._multiDrawInstances);}else {if(!extensions.get('WEBGL_multi_draw')){const starts=object._multiDrawStarts;const counts=object._multiDrawCounts;const drawCount=object._multiDrawCount;const bytesPerElement=index?attributes.get(index).bytesPerElement:1;const uniforms=properties.get(material).currentProgram.getUniforms();for(let i=0;i<drawCount;i++){uniforms.setValue(_gl,'_gl_DrawID',i);renderer.render(starts[i]/bytesPerElement,counts[i]);}}else {renderer.renderMultiDraw(object._multiDrawStarts,object._multiDrawCounts,object._multiDrawCount);}}}else if(object.isInstancedMesh){renderer.renderInstances(drawStart,drawCount,object.count);}else if(geometry.isInstancedBufferGeometry){const maxInstanceCount=geometry._maxInstanceCount!==undefined?geometry._maxInstanceCount:Infinity;const instanceCount=Math.min(geometry.instanceCount,maxInstanceCount);renderer.renderInstances(drawStart,drawCount,instanceCount);}else {renderer.render(drawStart,drawCount);}};// Compile
function prepareMaterial(material,scene,object){if(material.transparent===true&&material.side===DoubleSide&&material.forceSinglePass===false){material.side=BackSide$1;material.needsUpdate=true;getProgram(material,scene,object);material.side=FrontSide$1;material.needsUpdate=true;getProgram(material,scene,object);material.side=DoubleSide;}else {getProgram(material,scene,object);}}this.compile=function(scene,camera,targetScene=null){if(targetScene===null)targetScene=scene;currentRenderState=renderStates.get(targetScene);currentRenderState.init(camera);renderStateStack.push(currentRenderState);// gather lights from both the target scene and the new object that will be added to the scene.
targetScene.traverseVisible(function(object){if(object.isLight&&object.layers.test(camera.layers)){currentRenderState.pushLight(object);if(object.castShadow){currentRenderState.pushShadow(object);}}});if(scene!==targetScene){scene.traverseVisible(function(object){if(object.isLight&&object.layers.test(camera.layers)){currentRenderState.pushLight(object);if(object.castShadow){currentRenderState.pushShadow(object);}}});}currentRenderState.setupLights();// Only initialize materials in the new scene, not the targetScene.
const materials=new Set();scene.traverse(function(object){const material=object.material;if(material){if(Array.isArray(material)){for(let i=0;i<material.length;i++){const material2=material[i];prepareMaterial(material2,targetScene,object);materials.add(material2);}}else {prepareMaterial(material,targetScene,object);materials.add(material);}}});renderStateStack.pop();currentRenderState=null;return materials;};// compileAsync
this.compileAsync=function(scene,camera,targetScene=null){const materials=this.compile(scene,camera,targetScene);// Wait for all the materials in the new object to indicate that they're
// ready to be used before resolving the promise.
return new Promise(resolve=>{function checkMaterialsReady(){materials.forEach(function(material){const materialProperties=properties.get(material);const program=materialProperties.currentProgram;if(program.isReady()){// remove any programs that report they're ready to use from the list
materials.delete(material);}});// once the list of compiling materials is empty, call the callback
if(materials.size===0){resolve(scene);return;}// if some materials are still not ready, wait a bit and check again
setTimeout(checkMaterialsReady,10);}if(extensions.get('KHR_parallel_shader_compile')!==null){// If we can check the compilation status of the materials without
// blocking then do so right away.
checkMaterialsReady();}else {// Otherwise start by waiting a bit to give the materials we just
// initialized a chance to finish.
setTimeout(checkMaterialsReady,10);}});};// Animation Loop
let onAnimationFrameCallback=null;function onAnimationFrame(time){if(onAnimationFrameCallback)onAnimationFrameCallback(time);}function onXRSessionStart(){animation.stop();}function onXRSessionEnd(){animation.start();}const animation=new WebGLAnimation();animation.setAnimationLoop(onAnimationFrame);if(typeof self!=='undefined')animation.setContext(self);this.setAnimationLoop=function(callback){onAnimationFrameCallback=callback;xr.setAnimationLoop(callback);callback===null?animation.stop():animation.start();};xr.addEventListener('sessionstart',onXRSessionStart);xr.addEventListener('sessionend',onXRSessionEnd);// Rendering
this.render=function(scene,camera){if(camera!==undefined&&camera.isCamera!==true){console.error('THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.');return;}if(_isContextLost===true)return;// update scene graph
if(scene.matrixWorldAutoUpdate===true)scene.updateMatrixWorld();// update camera matrices and frustum
if(camera.parent===null&&camera.matrixWorldAutoUpdate===true)camera.updateMatrixWorld();if(xr.enabled===true&&xr.isPresenting===true){if(xr.cameraAutoUpdate===true)xr.updateCamera(camera);camera=xr.getCamera();// use XR camera for rendering
}//
if(scene.isScene===true)scene.onBeforeRender(_this,scene,camera,_currentRenderTarget);currentRenderState=renderStates.get(scene,renderStateStack.length);currentRenderState.init(camera);renderStateStack.push(currentRenderState);_projScreenMatrix.multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse);_frustum.setFromProjectionMatrix(_projScreenMatrix);_localClippingEnabled=this.localClippingEnabled;_clippingEnabled=clipping.init(this.clippingPlanes,_localClippingEnabled);currentRenderList=renderLists.get(scene,renderListStack.length);currentRenderList.init();renderListStack.push(currentRenderList);if(xr.enabled===true&&xr.isPresenting===true){const depthSensingMesh=_this.xr.getDepthSensingMesh();if(depthSensingMesh!==null){projectObject(depthSensingMesh,camera,-Infinity,_this.sortObjects);}}projectObject(scene,camera,0,_this.sortObjects);currentRenderList.finish();if(_this.sortObjects===true){currentRenderList.sort(_opaqueSort,_transparentSort);}_renderBackground=xr.enabled===false||xr.isPresenting===false||xr.hasDepthSensing()===false;if(_renderBackground){background.addToRenderList(currentRenderList,scene);}//
this.info.render.frame++;if(_clippingEnabled===true)clipping.beginShadows();const shadowsArray=currentRenderState.state.shadowsArray;shadowMap.render(shadowsArray,scene,camera);if(_clippingEnabled===true)clipping.endShadows();//
if(this.info.autoReset===true)this.info.reset();// render scene
const opaqueObjects=currentRenderList.opaque;const transmissiveObjects=currentRenderList.transmissive;currentRenderState.setupLights();if(camera.isArrayCamera){const cameras=camera.cameras;if(transmissiveObjects.length>0){for(let i=0,l=cameras.length;i<l;i++){const camera2=cameras[i];renderTransmissionPass(opaqueObjects,transmissiveObjects,scene,camera2);}}if(_renderBackground)background.render(scene);for(let i=0,l=cameras.length;i<l;i++){const camera2=cameras[i];renderScene(currentRenderList,scene,camera2,camera2.viewport);}}else {if(transmissiveObjects.length>0)renderTransmissionPass(opaqueObjects,transmissiveObjects,scene,camera);if(_renderBackground)background.render(scene);renderScene(currentRenderList,scene,camera);}//
if(_currentRenderTarget!==null){// resolve multisample renderbuffers to a single-sample texture if necessary
textures.updateMultisampleRenderTarget(_currentRenderTarget);// Generate mipmap if we're using any kind of mipmap filtering
textures.updateRenderTargetMipmap(_currentRenderTarget);}//
if(scene.isScene===true)scene.onAfterRender(_this,scene,camera);// _gl.finish();
bindingStates.resetDefaultState();_currentMaterialId=-1;_currentCamera=null;renderStateStack.pop();if(renderStateStack.length>0){currentRenderState=renderStateStack[renderStateStack.length-1];if(_clippingEnabled===true)clipping.setGlobalState(_this.clippingPlanes,currentRenderState.state.camera);}else {currentRenderState=null;}renderListStack.pop();if(renderListStack.length>0){currentRenderList=renderListStack[renderListStack.length-1];}else {currentRenderList=null;}};function projectObject(object,camera,groupOrder,sortObjects){if(object.visible===false)return;const visible=object.layers.test(camera.layers);if(visible){if(object.isGroup){groupOrder=object.renderOrder;}else if(object.isLOD){if(object.autoUpdate===true)object.update(camera);}else if(object.isLight){currentRenderState.pushLight(object);if(object.castShadow){currentRenderState.pushShadow(object);}}else if(object.isSprite){if(!object.frustumCulled||_frustum.intersectsSprite(object)){if(sortObjects){_vector4.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);}const geometry=objects.update(object);const material=object.material;if(material.visible){currentRenderList.push(object,geometry,material,groupOrder,_vector4.z,null);}}}else if(object.isMesh||object.isLine||object.isPoints){if(!object.frustumCulled||_frustum.intersectsObject(object)){const geometry=objects.update(object);const material=object.material;if(sortObjects){if(object.boundingSphere!==undefined){if(object.boundingSphere===null)object.computeBoundingSphere();_vector4.copy(object.boundingSphere.center);}else {if(geometry.boundingSphere===null)geometry.computeBoundingSphere();_vector4.copy(geometry.boundingSphere.center);}_vector4.applyMatrix4(object.matrixWorld).applyMatrix4(_projScreenMatrix);}if(Array.isArray(material)){const groups=geometry.groups;for(let i=0,l=groups.length;i<l;i++){const group=groups[i];const groupMaterial=material[group.materialIndex];if(groupMaterial&&groupMaterial.visible){currentRenderList.push(object,geometry,groupMaterial,groupOrder,_vector4.z,group);}}}else if(material.visible){currentRenderList.push(object,geometry,material,groupOrder,_vector4.z,null);}}}}const children=object.children;for(let i=0,l=children.length;i<l;i++){projectObject(children[i],camera,groupOrder,sortObjects);}}function renderScene(currentRenderList,scene,camera,viewport){const opaqueObjects=currentRenderList.opaque;const transmissiveObjects=currentRenderList.transmissive;const transparentObjects=currentRenderList.transparent;currentRenderState.setupLightsView(camera);if(_clippingEnabled===true)clipping.setGlobalState(_this.clippingPlanes,camera);if(viewport)state.viewport(_currentViewport.copy(viewport));if(opaqueObjects.length>0)renderObjects(opaqueObjects,scene,camera);if(transmissiveObjects.length>0)renderObjects(transmissiveObjects,scene,camera);if(transparentObjects.length>0)renderObjects(transparentObjects,scene,camera);// Ensure depth buffer writing is enabled so it can be cleared on next render
state.buffers.depth.setTest(true);state.buffers.depth.setMask(true);state.buffers.color.setMask(true);state.setPolygonOffset(false);}function renderTransmissionPass(opaqueObjects,transmissiveObjects,scene,camera){const overrideMaterial=scene.isScene===true?scene.overrideMaterial:null;if(overrideMaterial!==null){return;}if(currentRenderState.state.transmissionRenderTarget[camera.id]===undefined){currentRenderState.state.transmissionRenderTarget[camera.id]=new WebGLRenderTarget(1,1,{generateMipmaps:true,type:extensions.has('EXT_color_buffer_half_float')||extensions.has('EXT_color_buffer_float')?HalfFloatType$1:UnsignedByteType$1,minFilter:LinearMipmapLinearFilter$1,samples:4,stencilBuffer:stencil,resolveDepthBuffer:false,resolveStencilBuffer:false,colorSpace:ColorManagement$1.workingColorSpace});// debug
/*
				const geometry = new PlaneGeometry();
				const material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );

				const mesh = new Mesh( geometry, material );
				scene.add( mesh );
				*/}const transmissionRenderTarget=currentRenderState.state.transmissionRenderTarget[camera.id];const activeViewport=camera.viewport||_currentViewport;transmissionRenderTarget.setSize(activeViewport.z,activeViewport.w);//
const currentRenderTarget=_this.getRenderTarget();_this.setRenderTarget(transmissionRenderTarget);_this.getClearColor(_currentClearColor);_currentClearAlpha=_this.getClearAlpha();if(_currentClearAlpha<1)_this.setClearColor(0xffffff,0.5);_this.clear();if(_renderBackground)background.render(scene);// Turn off the features which can affect the frag color for opaque objects pass.
// Otherwise they are applied twice in opaque objects pass and transmission objects pass.
const currentToneMapping=_this.toneMapping;_this.toneMapping=NoToneMapping$1;// Remove viewport from camera to avoid nested render calls resetting viewport to it (e.g Reflector).
// Transmission render pass requires viewport to match the transmissionRenderTarget.
const currentCameraViewport=camera.viewport;if(camera.viewport!==undefined)camera.viewport=undefined;currentRenderState.setupLightsView(camera);if(_clippingEnabled===true)clipping.setGlobalState(_this.clippingPlanes,camera);renderObjects(opaqueObjects,scene,camera);textures.updateMultisampleRenderTarget(transmissionRenderTarget);textures.updateRenderTargetMipmap(transmissionRenderTarget);if(extensions.has('WEBGL_multisampled_render_to_texture')===false){// see #28131
let renderTargetNeedsUpdate=false;for(let i=0,l=transmissiveObjects.length;i<l;i++){const renderItem=transmissiveObjects[i];const object=renderItem.object;const geometry=renderItem.geometry;const material=renderItem.material;const group=renderItem.group;if(material.side===DoubleSide&&object.layers.test(camera.layers)){const currentSide=material.side;material.side=BackSide$1;material.needsUpdate=true;renderObject(object,scene,camera,geometry,material,group);material.side=currentSide;material.needsUpdate=true;renderTargetNeedsUpdate=true;}}if(renderTargetNeedsUpdate===true){textures.updateMultisampleRenderTarget(transmissionRenderTarget);textures.updateRenderTargetMipmap(transmissionRenderTarget);}}_this.setRenderTarget(currentRenderTarget);_this.setClearColor(_currentClearColor,_currentClearAlpha);if(currentCameraViewport!==undefined)camera.viewport=currentCameraViewport;_this.toneMapping=currentToneMapping;}function renderObjects(renderList,scene,camera){const overrideMaterial=scene.isScene===true?scene.overrideMaterial:null;for(let i=0,l=renderList.length;i<l;i++){const renderItem=renderList[i];const object=renderItem.object;const geometry=renderItem.geometry;const material=overrideMaterial===null?renderItem.material:overrideMaterial;const group=renderItem.group;if(object.layers.test(camera.layers)){renderObject(object,scene,camera,geometry,material,group);}}}function renderObject(object,scene,camera,geometry,material,group){object.onBeforeRender(_this,scene,camera,geometry,material,group);object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse,object.matrixWorld);object.normalMatrix.getNormalMatrix(object.modelViewMatrix);material.onBeforeRender(_this,scene,camera,geometry,object,group);if(material.transparent===true&&material.side===DoubleSide&&material.forceSinglePass===false){material.side=BackSide$1;material.needsUpdate=true;_this.renderBufferDirect(camera,scene,geometry,material,object,group);material.side=FrontSide$1;material.needsUpdate=true;_this.renderBufferDirect(camera,scene,geometry,material,object,group);material.side=DoubleSide;}else {_this.renderBufferDirect(camera,scene,geometry,material,object,group);}object.onAfterRender(_this,scene,camera,geometry,material,group);}function getProgram(material,scene,object){if(scene.isScene!==true)scene=_emptyScene;// scene could be a Mesh, Line, Points, ...
const materialProperties=properties.get(material);const lights=currentRenderState.state.lights;const shadowsArray=currentRenderState.state.shadowsArray;const lightsStateVersion=lights.state.version;const parameters=programCache.getParameters(material,lights.state,shadowsArray,scene,object);const programCacheKey=programCache.getProgramCacheKey(parameters);let programs=materialProperties.programs;// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change
materialProperties.environment=material.isMeshStandardMaterial?scene.environment:null;materialProperties.fog=scene.fog;materialProperties.envMap=(material.isMeshStandardMaterial?cubeuvmaps:cubemaps).get(material.envMap||materialProperties.environment);materialProperties.envMapRotation=materialProperties.environment!==null&&material.envMap===null?scene.environmentRotation:material.envMapRotation;if(programs===undefined){// new material
material.addEventListener('dispose',onMaterialDispose);programs=new Map();materialProperties.programs=programs;}let program=programs.get(programCacheKey);if(program!==undefined){// early out if program and light state is identical
if(materialProperties.currentProgram===program&&materialProperties.lightsStateVersion===lightsStateVersion){updateCommonMaterialProperties(material,parameters);return program;}}else {parameters.uniforms=programCache.getUniforms(material);material.onBeforeCompile(parameters,_this);program=programCache.acquireProgram(parameters,programCacheKey);programs.set(programCacheKey,program);materialProperties.uniforms=parameters.uniforms;}const uniforms=materialProperties.uniforms;if(!material.isShaderMaterial&&!material.isRawShaderMaterial||material.clipping===true){uniforms.clippingPlanes=clipping.uniform;}updateCommonMaterialProperties(material,parameters);// store the light setup it was created for
materialProperties.needsLights=materialNeedsLights(material);materialProperties.lightsStateVersion=lightsStateVersion;if(materialProperties.needsLights){// wire up the material to this renderer's lighting state
uniforms.ambientLightColor.value=lights.state.ambient;uniforms.lightProbe.value=lights.state.probe;uniforms.directionalLights.value=lights.state.directional;uniforms.directionalLightShadows.value=lights.state.directionalShadow;uniforms.spotLights.value=lights.state.spot;uniforms.spotLightShadows.value=lights.state.spotShadow;uniforms.rectAreaLights.value=lights.state.rectArea;uniforms.ltc_1.value=lights.state.rectAreaLTC1;uniforms.ltc_2.value=lights.state.rectAreaLTC2;uniforms.pointLights.value=lights.state.point;uniforms.pointLightShadows.value=lights.state.pointShadow;uniforms.hemisphereLights.value=lights.state.hemi;uniforms.directionalShadowMap.value=lights.state.directionalShadowMap;uniforms.directionalShadowMatrix.value=lights.state.directionalShadowMatrix;uniforms.spotShadowMap.value=lights.state.spotShadowMap;uniforms.spotLightMatrix.value=lights.state.spotLightMatrix;uniforms.spotLightMap.value=lights.state.spotLightMap;uniforms.pointShadowMap.value=lights.state.pointShadowMap;uniforms.pointShadowMatrix.value=lights.state.pointShadowMatrix;// TODO (abelnation): add area lights shadow info to uniforms
}materialProperties.currentProgram=program;materialProperties.uniformsList=null;return program;}function getUniformList(materialProperties){if(materialProperties.uniformsList===null){const progUniforms=materialProperties.currentProgram.getUniforms();materialProperties.uniformsList=WebGLUniforms.seqWithValue(progUniforms.seq,materialProperties.uniforms);}return materialProperties.uniformsList;}function updateCommonMaterialProperties(material,parameters){const materialProperties=properties.get(material);materialProperties.outputColorSpace=parameters.outputColorSpace;materialProperties.batching=parameters.batching;materialProperties.batchingColor=parameters.batchingColor;materialProperties.instancing=parameters.instancing;materialProperties.instancingColor=parameters.instancingColor;materialProperties.instancingMorph=parameters.instancingMorph;materialProperties.skinning=parameters.skinning;materialProperties.morphTargets=parameters.morphTargets;materialProperties.morphNormals=parameters.morphNormals;materialProperties.morphColors=parameters.morphColors;materialProperties.morphTargetsCount=parameters.morphTargetsCount;materialProperties.numClippingPlanes=parameters.numClippingPlanes;materialProperties.numIntersection=parameters.numClipIntersection;materialProperties.vertexAlphas=parameters.vertexAlphas;materialProperties.vertexTangents=parameters.vertexTangents;materialProperties.toneMapping=parameters.toneMapping;}function setProgram(camera,scene,geometry,material,object){if(scene.isScene!==true)scene=_emptyScene;// scene could be a Mesh, Line, Points, ...
textures.resetTextureUnits();const fog=scene.fog;const environment=material.isMeshStandardMaterial?scene.environment:null;const colorSpace=_currentRenderTarget===null?_this.outputColorSpace:_currentRenderTarget.isXRRenderTarget===true?_currentRenderTarget.texture.colorSpace:LinearSRGBColorSpace$1;const envMap=(material.isMeshStandardMaterial?cubeuvmaps:cubemaps).get(material.envMap||environment);const vertexAlphas=material.vertexColors===true&&!!geometry.attributes.color&&geometry.attributes.color.itemSize===4;const vertexTangents=!!geometry.attributes.tangent&&(!!material.normalMap||material.anisotropy>0);const morphTargets=!!geometry.morphAttributes.position;const morphNormals=!!geometry.morphAttributes.normal;const morphColors=!!geometry.morphAttributes.color;let toneMapping=NoToneMapping$1;if(material.toneMapped){if(_currentRenderTarget===null||_currentRenderTarget.isXRRenderTarget===true){toneMapping=_this.toneMapping;}}const morphAttribute=geometry.morphAttributes.position||geometry.morphAttributes.normal||geometry.morphAttributes.color;const morphTargetsCount=morphAttribute!==undefined?morphAttribute.length:0;const materialProperties=properties.get(material);const lights=currentRenderState.state.lights;if(_clippingEnabled===true){if(_localClippingEnabled===true||camera!==_currentCamera){const useCache=camera===_currentCamera&&material.id===_currentMaterialId;// we might want to call this function with some ClippingGroup
// object instead of the material, once it becomes feasible
// (#8465, #8379)
clipping.setState(material,camera,useCache);}}//
let needsProgramChange=false;if(material.version===materialProperties.__version){if(materialProperties.needsLights&&materialProperties.lightsStateVersion!==lights.state.version){needsProgramChange=true;}else if(materialProperties.outputColorSpace!==colorSpace){needsProgramChange=true;}else if(object.isBatchedMesh&&materialProperties.batching===false){needsProgramChange=true;}else if(!object.isBatchedMesh&&materialProperties.batching===true){needsProgramChange=true;}else if(object.isBatchedMesh&&materialProperties.batchingColor===true&&object.colorTexture===null){needsProgramChange=true;}else if(object.isBatchedMesh&&materialProperties.batchingColor===false&&object.colorTexture!==null){needsProgramChange=true;}else if(object.isInstancedMesh&&materialProperties.instancing===false){needsProgramChange=true;}else if(!object.isInstancedMesh&&materialProperties.instancing===true){needsProgramChange=true;}else if(object.isSkinnedMesh&&materialProperties.skinning===false){needsProgramChange=true;}else if(!object.isSkinnedMesh&&materialProperties.skinning===true){needsProgramChange=true;}else if(object.isInstancedMesh&&materialProperties.instancingColor===true&&object.instanceColor===null){needsProgramChange=true;}else if(object.isInstancedMesh&&materialProperties.instancingColor===false&&object.instanceColor!==null){needsProgramChange=true;}else if(object.isInstancedMesh&&materialProperties.instancingMorph===true&&object.morphTexture===null){needsProgramChange=true;}else if(object.isInstancedMesh&&materialProperties.instancingMorph===false&&object.morphTexture!==null){needsProgramChange=true;}else if(materialProperties.envMap!==envMap){needsProgramChange=true;}else if(material.fog===true&&materialProperties.fog!==fog){needsProgramChange=true;}else if(materialProperties.numClippingPlanes!==undefined&&(materialProperties.numClippingPlanes!==clipping.numPlanes||materialProperties.numIntersection!==clipping.numIntersection)){needsProgramChange=true;}else if(materialProperties.vertexAlphas!==vertexAlphas){needsProgramChange=true;}else if(materialProperties.vertexTangents!==vertexTangents){needsProgramChange=true;}else if(materialProperties.morphTargets!==morphTargets){needsProgramChange=true;}else if(materialProperties.morphNormals!==morphNormals){needsProgramChange=true;}else if(materialProperties.morphColors!==morphColors){needsProgramChange=true;}else if(materialProperties.toneMapping!==toneMapping){needsProgramChange=true;}else if(materialProperties.morphTargetsCount!==morphTargetsCount){needsProgramChange=true;}}else {needsProgramChange=true;materialProperties.__version=material.version;}//
let program=materialProperties.currentProgram;if(needsProgramChange===true){program=getProgram(material,scene,object);}let refreshProgram=false;let refreshMaterial=false;let refreshLights=false;const p_uniforms=program.getUniforms(),m_uniforms=materialProperties.uniforms;if(state.useProgram(program.program)){refreshProgram=true;refreshMaterial=true;refreshLights=true;}if(material.id!==_currentMaterialId){_currentMaterialId=material.id;refreshMaterial=true;}if(refreshProgram||_currentCamera!==camera){// common camera uniforms
p_uniforms.setValue(_gl,'projectionMatrix',camera.projectionMatrix);p_uniforms.setValue(_gl,'viewMatrix',camera.matrixWorldInverse);const uCamPos=p_uniforms.map.cameraPosition;if(uCamPos!==undefined){uCamPos.setValue(_gl,_vector3.setFromMatrixPosition(camera.matrixWorld));}if(capabilities.logarithmicDepthBuffer){p_uniforms.setValue(_gl,'logDepthBufFC',2.0/(Math.log(camera.far+1.0)/Math.LN2));}// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067
if(material.isMeshPhongMaterial||material.isMeshToonMaterial||material.isMeshLambertMaterial||material.isMeshBasicMaterial||material.isMeshStandardMaterial||material.isShaderMaterial){p_uniforms.setValue(_gl,'isOrthographic',camera.isOrthographicCamera===true);}if(_currentCamera!==camera){_currentCamera=camera;// lighting uniforms depend on the camera so enforce an update
// now, in case this material supports lights - or later, when
// the next material that does gets activated:
refreshMaterial=true;// set to true on material change
refreshLights=true;// remains set until update done
}}// skinning and morph target uniforms must be set even if material didn't change
// auto-setting of texture unit for bone and morph texture must go before other textures
// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures
if(object.isSkinnedMesh){p_uniforms.setOptional(_gl,object,'bindMatrix');p_uniforms.setOptional(_gl,object,'bindMatrixInverse');const skeleton=object.skeleton;if(skeleton){if(skeleton.boneTexture===null)skeleton.computeBoneTexture();p_uniforms.setValue(_gl,'boneTexture',skeleton.boneTexture,textures);}}if(object.isBatchedMesh){p_uniforms.setOptional(_gl,object,'batchingTexture');p_uniforms.setValue(_gl,'batchingTexture',object._matricesTexture,textures);p_uniforms.setOptional(_gl,object,'batchingIdTexture');p_uniforms.setValue(_gl,'batchingIdTexture',object._indirectTexture,textures);p_uniforms.setOptional(_gl,object,'batchingColorTexture');if(object._colorsTexture!==null){p_uniforms.setValue(_gl,'batchingColorTexture',object._colorsTexture,textures);}}const morphAttributes=geometry.morphAttributes;if(morphAttributes.position!==undefined||morphAttributes.normal!==undefined||morphAttributes.color!==undefined){morphtargets.update(object,geometry,program);}if(refreshMaterial||materialProperties.receiveShadow!==object.receiveShadow){materialProperties.receiveShadow=object.receiveShadow;p_uniforms.setValue(_gl,'receiveShadow',object.receiveShadow);}// https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512
if(material.isMeshGouraudMaterial&&material.envMap!==null){m_uniforms.envMap.value=envMap;m_uniforms.flipEnvMap.value=envMap.isCubeTexture&&envMap.isRenderTargetTexture===false?-1:1;}if(material.isMeshStandardMaterial&&material.envMap===null&&scene.environment!==null){m_uniforms.envMapIntensity.value=scene.environmentIntensity;}if(refreshMaterial){p_uniforms.setValue(_gl,'toneMappingExposure',_this.toneMappingExposure);if(materialProperties.needsLights){// the current material requires lighting info
// note: all lighting uniforms are always set correctly
// they simply reference the renderer's state for their
// values
//
// use the current material's .needsUpdate flags to set
// the GL state when required
markUniformsLightsNeedsUpdate(m_uniforms,refreshLights);}// refresh uniforms common to several materials
if(fog&&material.fog===true){materials.refreshFogUniforms(m_uniforms,fog);}materials.refreshMaterialUniforms(m_uniforms,material,_pixelRatio,_height,currentRenderState.state.transmissionRenderTarget[camera.id]);WebGLUniforms.upload(_gl,getUniformList(materialProperties),m_uniforms,textures);}if(material.isShaderMaterial&&material.uniformsNeedUpdate===true){WebGLUniforms.upload(_gl,getUniformList(materialProperties),m_uniforms,textures);material.uniformsNeedUpdate=false;}if(material.isSpriteMaterial){p_uniforms.setValue(_gl,'center',object.center);}// common matrices
p_uniforms.setValue(_gl,'modelViewMatrix',object.modelViewMatrix);p_uniforms.setValue(_gl,'normalMatrix',object.normalMatrix);p_uniforms.setValue(_gl,'modelMatrix',object.matrixWorld);// UBOs
if(material.isShaderMaterial||material.isRawShaderMaterial){const groups=material.uniformsGroups;for(let i=0,l=groups.length;i<l;i++){const group=groups[i];uniformsGroups.update(group,program);uniformsGroups.bind(group,program);}}return program;}// If uniforms are marked as clean, they don't need to be loaded to the GPU.
function markUniformsLightsNeedsUpdate(uniforms,value){uniforms.ambientLightColor.needsUpdate=value;uniforms.lightProbe.needsUpdate=value;uniforms.directionalLights.needsUpdate=value;uniforms.directionalLightShadows.needsUpdate=value;uniforms.pointLights.needsUpdate=value;uniforms.pointLightShadows.needsUpdate=value;uniforms.spotLights.needsUpdate=value;uniforms.spotLightShadows.needsUpdate=value;uniforms.rectAreaLights.needsUpdate=value;uniforms.hemisphereLights.needsUpdate=value;}function materialNeedsLights(material){return material.isMeshLambertMaterial||material.isMeshToonMaterial||material.isMeshPhongMaterial||material.isMeshStandardMaterial||material.isShadowMaterial||material.isShaderMaterial&&material.lights===true;}this.getActiveCubeFace=function(){return _currentActiveCubeFace;};this.getActiveMipmapLevel=function(){return _currentActiveMipmapLevel;};this.getRenderTarget=function(){return _currentRenderTarget;};this.setRenderTargetTextures=function(renderTarget,colorTexture,depthTexture){properties.get(renderTarget.texture).__webglTexture=colorTexture;properties.get(renderTarget.depthTexture).__webglTexture=depthTexture;const renderTargetProperties=properties.get(renderTarget);renderTargetProperties.__hasExternalTextures=true;renderTargetProperties.__autoAllocateDepthBuffer=depthTexture===undefined;if(!renderTargetProperties.__autoAllocateDepthBuffer){// The multisample_render_to_texture extension doesn't work properly if there
// are midframe flushes and an external depth buffer. Disable use of the extension.
if(extensions.has('WEBGL_multisampled_render_to_texture')===true){console.warn('THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided');renderTargetProperties.__useRenderToTexture=false;}}};this.setRenderTargetFramebuffer=function(renderTarget,defaultFramebuffer){const renderTargetProperties=properties.get(renderTarget);renderTargetProperties.__webglFramebuffer=defaultFramebuffer;renderTargetProperties.__useDefaultFramebuffer=defaultFramebuffer===undefined;};this.setRenderTarget=function(renderTarget,activeCubeFace=0,activeMipmapLevel=0){_currentRenderTarget=renderTarget;_currentActiveCubeFace=activeCubeFace;_currentActiveMipmapLevel=activeMipmapLevel;let useDefaultFramebuffer=true;let framebuffer=null;let isCube=false;let isRenderTarget3D=false;if(renderTarget){const renderTargetProperties=properties.get(renderTarget);if(renderTargetProperties.__useDefaultFramebuffer!==undefined){// We need to make sure to rebind the framebuffer.
state.bindFramebuffer(_gl.FRAMEBUFFER,null);useDefaultFramebuffer=false;}else if(renderTargetProperties.__webglFramebuffer===undefined){textures.setupRenderTarget(renderTarget);}else if(renderTargetProperties.__hasExternalTextures){// Color and depth texture must be rebound in order for the swapchain to update.
textures.rebindTextures(renderTarget,properties.get(renderTarget.texture).__webglTexture,properties.get(renderTarget.depthTexture).__webglTexture);}else if(renderTarget.depthBuffer){// check if the depth texture is already bound to the frame buffer and that it's been initialized
const depthTexture=renderTarget.depthTexture;if(renderTargetProperties.__boundDepthTexture!==depthTexture){// check if the depth texture is compatible
if(depthTexture!==null&&properties.has(depthTexture)&&(renderTarget.width!==depthTexture.image.width||renderTarget.height!==depthTexture.image.height)){throw new Error('WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.');}// Swap the depth buffer to the currently attached one
textures.setupDepthRenderbuffer(renderTarget);}}const texture=renderTarget.texture;if(texture.isData3DTexture||texture.isDataArrayTexture||texture.isCompressedArrayTexture){isRenderTarget3D=true;}const __webglFramebuffer=properties.get(renderTarget).__webglFramebuffer;if(renderTarget.isWebGLCubeRenderTarget){if(Array.isArray(__webglFramebuffer[activeCubeFace])){framebuffer=__webglFramebuffer[activeCubeFace][activeMipmapLevel];}else {framebuffer=__webglFramebuffer[activeCubeFace];}isCube=true;}else if(renderTarget.samples>0&&textures.useMultisampledRTT(renderTarget)===false){framebuffer=properties.get(renderTarget).__webglMultisampledFramebuffer;}else {if(Array.isArray(__webglFramebuffer)){framebuffer=__webglFramebuffer[activeMipmapLevel];}else {framebuffer=__webglFramebuffer;}}_currentViewport.copy(renderTarget.viewport);_currentScissor.copy(renderTarget.scissor);_currentScissorTest=renderTarget.scissorTest;}else {_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor();_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor();_currentScissorTest=_scissorTest;}const framebufferBound=state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);if(framebufferBound&&useDefaultFramebuffer){state.drawBuffers(renderTarget,framebuffer);}state.viewport(_currentViewport);state.scissor(_currentScissor);state.setScissorTest(_currentScissorTest);if(isCube){const textureProperties=properties.get(renderTarget.texture);_gl.framebufferTexture2D(_gl.FRAMEBUFFER,_gl.COLOR_ATTACHMENT0,_gl.TEXTURE_CUBE_MAP_POSITIVE_X+activeCubeFace,textureProperties.__webglTexture,activeMipmapLevel);}else if(isRenderTarget3D){const textureProperties=properties.get(renderTarget.texture);const layer=activeCubeFace||0;_gl.framebufferTextureLayer(_gl.FRAMEBUFFER,_gl.COLOR_ATTACHMENT0,textureProperties.__webglTexture,activeMipmapLevel||0,layer);}_currentMaterialId=-1;// reset current material to ensure correct uniform bindings
};this.readRenderTargetPixels=function(renderTarget,x,y,width,height,buffer,activeCubeFaceIndex){if(!(renderTarget&&renderTarget.isWebGLRenderTarget)){console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.');return;}let framebuffer=properties.get(renderTarget).__webglFramebuffer;if(renderTarget.isWebGLCubeRenderTarget&&activeCubeFaceIndex!==undefined){framebuffer=framebuffer[activeCubeFaceIndex];}if(framebuffer){state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);try{const texture=renderTarget.texture;const textureFormat=texture.format;const textureType=texture.type;if(!capabilities.textureFormatReadable(textureFormat)){console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.');return;}if(!capabilities.textureTypeReadable(textureType)){console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.');return;}// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
if(x>=0&&x<=renderTarget.width-width&&y>=0&&y<=renderTarget.height-height){_gl.readPixels(x,y,width,height,utils.convert(textureFormat),utils.convert(textureType),buffer);}}finally{// restore framebuffer of current render target if necessary
const framebuffer=_currentRenderTarget!==null?properties.get(_currentRenderTarget).__webglFramebuffer:null;state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);}}};this.readRenderTargetPixelsAsync=async function(renderTarget,x,y,width,height,buffer,activeCubeFaceIndex){if(!(renderTarget&&renderTarget.isWebGLRenderTarget)){throw new Error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.');}let framebuffer=properties.get(renderTarget).__webglFramebuffer;if(renderTarget.isWebGLCubeRenderTarget&&activeCubeFaceIndex!==undefined){framebuffer=framebuffer[activeCubeFaceIndex];}if(framebuffer){state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);try{const texture=renderTarget.texture;const textureFormat=texture.format;const textureType=texture.type;if(!capabilities.textureFormatReadable(textureFormat)){throw new Error('THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.');}if(!capabilities.textureTypeReadable(textureType)){throw new Error('THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.');}// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
if(x>=0&&x<=renderTarget.width-width&&y>=0&&y<=renderTarget.height-height){const glBuffer=_gl.createBuffer();_gl.bindBuffer(_gl.PIXEL_PACK_BUFFER,glBuffer);_gl.bufferData(_gl.PIXEL_PACK_BUFFER,buffer.byteLength,_gl.STREAM_READ);_gl.readPixels(x,y,width,height,utils.convert(textureFormat),utils.convert(textureType),0);_gl.flush();// check if the commands have finished every 8 ms
const sync=_gl.fenceSync(_gl.SYNC_GPU_COMMANDS_COMPLETE,0);await probeAsync(_gl,sync,4);try{_gl.bindBuffer(_gl.PIXEL_PACK_BUFFER,glBuffer);_gl.getBufferSubData(_gl.PIXEL_PACK_BUFFER,0,buffer);}finally{_gl.deleteBuffer(glBuffer);_gl.deleteSync(sync);}return buffer;}}finally{// restore framebuffer of current render target if necessary
const framebuffer=_currentRenderTarget!==null?properties.get(_currentRenderTarget).__webglFramebuffer:null;state.bindFramebuffer(_gl.FRAMEBUFFER,framebuffer);}}};this.copyFramebufferToTexture=function(texture,position=null,level=0){// support previous signature with position first
if(texture.isTexture!==true){// @deprecated, r165
warnOnce$1('WebGLRenderer: copyFramebufferToTexture function signature has changed.');position=arguments[0]||null;texture=arguments[1];}const levelScale=Math.pow(2,-level);const width=Math.floor(texture.image.width*levelScale);const height=Math.floor(texture.image.height*levelScale);const x=position!==null?position.x:0;const y=position!==null?position.y:0;textures.setTexture2D(texture,0);_gl.copyTexSubImage2D(_gl.TEXTURE_2D,level,0,0,x,y,width,height);state.unbindTexture();};this.copyTextureToTexture=function(srcTexture,dstTexture,srcRegion=null,dstPosition=null,level=0){// support previous signature with dstPosition first
if(srcTexture.isTexture!==true){// @deprecated, r165
warnOnce$1('WebGLRenderer: copyTextureToTexture function signature has changed.');dstPosition=arguments[0]||null;srcTexture=arguments[1];dstTexture=arguments[2];level=arguments[3]||0;srcRegion=null;}let width,height,minX,minY;let dstX,dstY;if(srcRegion!==null){width=srcRegion.max.x-srcRegion.min.x;height=srcRegion.max.y-srcRegion.min.y;minX=srcRegion.min.x;minY=srcRegion.min.y;}else {width=srcTexture.image.width;height=srcTexture.image.height;minX=0;minY=0;}if(dstPosition!==null){dstX=dstPosition.x;dstY=dstPosition.y;}else {dstX=0;dstY=0;}const glFormat=utils.convert(dstTexture.format);const glType=utils.convert(dstTexture.type);textures.setTexture2D(dstTexture,0);// As another texture upload may have changed pixelStorei
// parameters, make sure they are correct for the dstTexture
_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,dstTexture.flipY);_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,dstTexture.premultiplyAlpha);_gl.pixelStorei(_gl.UNPACK_ALIGNMENT,dstTexture.unpackAlignment);const currentUnpackRowLen=_gl.getParameter(_gl.UNPACK_ROW_LENGTH);const currentUnpackImageHeight=_gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT);const currentUnpackSkipPixels=_gl.getParameter(_gl.UNPACK_SKIP_PIXELS);const currentUnpackSkipRows=_gl.getParameter(_gl.UNPACK_SKIP_ROWS);const currentUnpackSkipImages=_gl.getParameter(_gl.UNPACK_SKIP_IMAGES);const image=srcTexture.isCompressedTexture?srcTexture.mipmaps[level]:srcTexture.image;_gl.pixelStorei(_gl.UNPACK_ROW_LENGTH,image.width);_gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT,image.height);_gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS,minX);_gl.pixelStorei(_gl.UNPACK_SKIP_ROWS,minY);if(srcTexture.isDataTexture){_gl.texSubImage2D(_gl.TEXTURE_2D,level,dstX,dstY,width,height,glFormat,glType,image.data);}else {if(srcTexture.isCompressedTexture){_gl.compressedTexSubImage2D(_gl.TEXTURE_2D,level,dstX,dstY,image.width,image.height,glFormat,image.data);}else {_gl.texSubImage2D(_gl.TEXTURE_2D,level,dstX,dstY,width,height,glFormat,glType,image);}}_gl.pixelStorei(_gl.UNPACK_ROW_LENGTH,currentUnpackRowLen);_gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT,currentUnpackImageHeight);_gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS,currentUnpackSkipPixels);_gl.pixelStorei(_gl.UNPACK_SKIP_ROWS,currentUnpackSkipRows);_gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES,currentUnpackSkipImages);// Generate mipmaps only when copying level 0
if(level===0&&dstTexture.generateMipmaps)_gl.generateMipmap(_gl.TEXTURE_2D);state.unbindTexture();};this.copyTextureToTexture3D=function(srcTexture,dstTexture,srcRegion=null,dstPosition=null,level=0){// support previous signature with source box first
if(srcTexture.isTexture!==true){// @deprecated, r165
warnOnce$1('WebGLRenderer: copyTextureToTexture3D function signature has changed.');srcRegion=arguments[0]||null;dstPosition=arguments[1]||null;srcTexture=arguments[2];dstTexture=arguments[3];level=arguments[4]||0;}let width,height,depth,minX,minY,minZ;let dstX,dstY,dstZ;const image=srcTexture.isCompressedTexture?srcTexture.mipmaps[level]:srcTexture.image;if(srcRegion!==null){width=srcRegion.max.x-srcRegion.min.x;height=srcRegion.max.y-srcRegion.min.y;depth=srcRegion.max.z-srcRegion.min.z;minX=srcRegion.min.x;minY=srcRegion.min.y;minZ=srcRegion.min.z;}else {width=image.width;height=image.height;depth=image.depth;minX=0;minY=0;minZ=0;}if(dstPosition!==null){dstX=dstPosition.x;dstY=dstPosition.y;dstZ=dstPosition.z;}else {dstX=0;dstY=0;dstZ=0;}const glFormat=utils.convert(dstTexture.format);const glType=utils.convert(dstTexture.type);let glTarget;if(dstTexture.isData3DTexture){textures.setTexture3D(dstTexture,0);glTarget=_gl.TEXTURE_3D;}else if(dstTexture.isDataArrayTexture||dstTexture.isCompressedArrayTexture){textures.setTexture2DArray(dstTexture,0);glTarget=_gl.TEXTURE_2D_ARRAY;}else {console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.');return;}_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL,dstTexture.flipY);_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,dstTexture.premultiplyAlpha);_gl.pixelStorei(_gl.UNPACK_ALIGNMENT,dstTexture.unpackAlignment);const currentUnpackRowLen=_gl.getParameter(_gl.UNPACK_ROW_LENGTH);const currentUnpackImageHeight=_gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT);const currentUnpackSkipPixels=_gl.getParameter(_gl.UNPACK_SKIP_PIXELS);const currentUnpackSkipRows=_gl.getParameter(_gl.UNPACK_SKIP_ROWS);const currentUnpackSkipImages=_gl.getParameter(_gl.UNPACK_SKIP_IMAGES);_gl.pixelStorei(_gl.UNPACK_ROW_LENGTH,image.width);_gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT,image.height);_gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS,minX);_gl.pixelStorei(_gl.UNPACK_SKIP_ROWS,minY);_gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES,minZ);if(srcTexture.isDataTexture||srcTexture.isData3DTexture){_gl.texSubImage3D(glTarget,level,dstX,dstY,dstZ,width,height,depth,glFormat,glType,image.data);}else {if(dstTexture.isCompressedArrayTexture){_gl.compressedTexSubImage3D(glTarget,level,dstX,dstY,dstZ,width,height,depth,glFormat,image.data);}else {_gl.texSubImage3D(glTarget,level,dstX,dstY,dstZ,width,height,depth,glFormat,glType,image);}}_gl.pixelStorei(_gl.UNPACK_ROW_LENGTH,currentUnpackRowLen);_gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT,currentUnpackImageHeight);_gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS,currentUnpackSkipPixels);_gl.pixelStorei(_gl.UNPACK_SKIP_ROWS,currentUnpackSkipRows);_gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES,currentUnpackSkipImages);// Generate mipmaps only when copying level 0
if(level===0&&dstTexture.generateMipmaps)_gl.generateMipmap(glTarget);state.unbindTexture();};this.initRenderTarget=function(target){if(properties.get(target).__webglFramebuffer===undefined){textures.setupRenderTarget(target);}};this.initTexture=function(texture){if(texture.isCubeTexture){textures.setTextureCube(texture,0);}else if(texture.isData3DTexture){textures.setTexture3D(texture,0);}else if(texture.isDataArrayTexture||texture.isCompressedArrayTexture){textures.setTexture2DArray(texture,0);}else {textures.setTexture2D(texture,0);}state.unbindTexture();};this.resetState=function(){_currentActiveCubeFace=0;_currentActiveMipmapLevel=0;_currentRenderTarget=null;state.reset();bindingStates.reset();};if(typeof __THREE_DEVTOOLS__!=='undefined'){__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe',{detail:this}));}}get coordinateSystem(){return WebGLCoordinateSystem$1;}get outputColorSpace(){return this._outputColorSpace;}set outputColorSpace(colorSpace){this._outputColorSpace=colorSpace;const gl=this.getContext();gl.drawingBufferColorSpace=colorSpace===DisplayP3ColorSpace$1?'display-p3':'srgb';gl.unpackColorSpace=ColorManagement$1.workingColorSpace===LinearDisplayP3ColorSpace$1?'display-p3':'srgb';}}class Scene extends Object3D$1{constructor(){super();this.isScene=true;this.type='Scene';this.background=null;this.environment=null;this.fog=null;this.backgroundBlurriness=0;this.backgroundIntensity=1;this.backgroundRotation=new Euler$1();this.environmentIntensity=1;this.environmentRotation=new Euler$1();this.overrideMaterial=null;if(typeof __THREE_DEVTOOLS__!=='undefined'){__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe',{detail:this}));}}copy(source,recursive){super.copy(source,recursive);if(source.background!==null)this.background=source.background.clone();if(source.environment!==null)this.environment=source.environment.clone();if(source.fog!==null)this.fog=source.fog.clone();this.backgroundBlurriness=source.backgroundBlurriness;this.backgroundIntensity=source.backgroundIntensity;this.backgroundRotation.copy(source.backgroundRotation);this.environmentIntensity=source.environmentIntensity;this.environmentRotation.copy(source.environmentRotation);if(source.overrideMaterial!==null)this.overrideMaterial=source.overrideMaterial.clone();this.matrixAutoUpdate=source.matrixAutoUpdate;return this;}toJSON(meta){const data=super.toJSON(meta);if(this.fog!==null)data.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)data.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)data.object.backgroundIntensity=this.backgroundIntensity;data.object.backgroundRotation=this.backgroundRotation.toArray();if(this.environmentIntensity!==1)data.object.environmentIntensity=this.environmentIntensity;data.object.environmentRotation=this.environmentRotation.toArray();return data;}}class InterleavedBuffer$1{constructor(array,stride){this.isInterleavedBuffer=true;this.array=array;this.stride=stride;this.count=array!==undefined?array.length/stride:0;this.usage=StaticDrawUsage$1;this._updateRange={offset:0,count:-1};this.updateRanges=[];this.version=0;this.uuid=generateUUID$1();}onUploadCallback(){}set needsUpdate(value){if(value===true)this.version++;}get updateRange(){warnOnce$1('THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.');// @deprecated, r159
return this._updateRange;}setUsage(value){this.usage=value;return this;}addUpdateRange(start,count){this.updateRanges.push({start,count});}clearUpdateRanges(){this.updateRanges.length=0;}copy(source){this.array=new source.array.constructor(source.array);this.count=source.count;this.stride=source.stride;this.usage=source.usage;return this;}copyAt(index1,attribute,index2){index1*=this.stride;index2*=attribute.stride;for(let i=0,l=this.stride;i<l;i++){this.array[index1+i]=attribute.array[index2+i];}return this;}set(value,offset=0){this.array.set(value,offset);return this;}clone(data){if(data.arrayBuffers===undefined){data.arrayBuffers={};}if(this.array.buffer._uuid===undefined){this.array.buffer._uuid=generateUUID$1();}if(data.arrayBuffers[this.array.buffer._uuid]===undefined){data.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer;}const array=new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]);const ib=new this.constructor(array,this.stride);ib.setUsage(this.usage);return ib;}onUpload(callback){this.onUploadCallback=callback;return this;}toJSON(data){if(data.arrayBuffers===undefined){data.arrayBuffers={};}// generate UUID for array buffer if necessary
if(this.array.buffer._uuid===undefined){this.array.buffer._uuid=generateUUID$1();}if(data.arrayBuffers[this.array.buffer._uuid]===undefined){data.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));}//
return {uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride};}}const _vector$6=/*@__PURE__*/new Vector3$1();class InterleavedBufferAttribute$1{constructor(interleavedBuffer,itemSize,offset,normalized=false){this.isInterleavedBufferAttribute=true;this.name='';this.data=interleavedBuffer;this.itemSize=itemSize;this.offset=offset;this.normalized=normalized;}get count(){return this.data.count;}get array(){return this.data.array;}set needsUpdate(value){this.data.needsUpdate=value;}applyMatrix4(m){for(let i=0,l=this.data.count;i<l;i++){_vector$6.fromBufferAttribute(this,i);_vector$6.applyMatrix4(m);this.setXYZ(i,_vector$6.x,_vector$6.y,_vector$6.z);}return this;}applyNormalMatrix(m){for(let i=0,l=this.count;i<l;i++){_vector$6.fromBufferAttribute(this,i);_vector$6.applyNormalMatrix(m);this.setXYZ(i,_vector$6.x,_vector$6.y,_vector$6.z);}return this;}transformDirection(m){for(let i=0,l=this.count;i<l;i++){_vector$6.fromBufferAttribute(this,i);_vector$6.transformDirection(m);this.setXYZ(i,_vector$6.x,_vector$6.y,_vector$6.z);}return this;}getComponent(index,component){let value=this.array[index*this.data.stride+this.offset+component];if(this.normalized)value=denormalize$1(value,this.array);return value;}setComponent(index,component,value){if(this.normalized)value=normalize$2(value,this.array);this.data.array[index*this.data.stride+this.offset+component]=value;return this;}setX(index,x){if(this.normalized)x=normalize$2(x,this.array);this.data.array[index*this.data.stride+this.offset]=x;return this;}setY(index,y){if(this.normalized)y=normalize$2(y,this.array);this.data.array[index*this.data.stride+this.offset+1]=y;return this;}setZ(index,z){if(this.normalized)z=normalize$2(z,this.array);this.data.array[index*this.data.stride+this.offset+2]=z;return this;}setW(index,w){if(this.normalized)w=normalize$2(w,this.array);this.data.array[index*this.data.stride+this.offset+3]=w;return this;}getX(index){let x=this.data.array[index*this.data.stride+this.offset];if(this.normalized)x=denormalize$1(x,this.array);return x;}getY(index){let y=this.data.array[index*this.data.stride+this.offset+1];if(this.normalized)y=denormalize$1(y,this.array);return y;}getZ(index){let z=this.data.array[index*this.data.stride+this.offset+2];if(this.normalized)z=denormalize$1(z,this.array);return z;}getW(index){let w=this.data.array[index*this.data.stride+this.offset+3];if(this.normalized)w=denormalize$1(w,this.array);return w;}setXY(index,x,y){index=index*this.data.stride+this.offset;if(this.normalized){x=normalize$2(x,this.array);y=normalize$2(y,this.array);}this.data.array[index+0]=x;this.data.array[index+1]=y;return this;}setXYZ(index,x,y,z){index=index*this.data.stride+this.offset;if(this.normalized){x=normalize$2(x,this.array);y=normalize$2(y,this.array);z=normalize$2(z,this.array);}this.data.array[index+0]=x;this.data.array[index+1]=y;this.data.array[index+2]=z;return this;}setXYZW(index,x,y,z,w){index=index*this.data.stride+this.offset;if(this.normalized){x=normalize$2(x,this.array);y=normalize$2(y,this.array);z=normalize$2(z,this.array);w=normalize$2(w,this.array);}this.data.array[index+0]=x;this.data.array[index+1]=y;this.data.array[index+2]=z;this.data.array[index+3]=w;return this;}clone(data){if(data===undefined){console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.');const array=[];for(let i=0;i<this.count;i++){const index=i*this.data.stride+this.offset;for(let j=0;j<this.itemSize;j++){array.push(this.data.array[index+j]);}}return new BufferAttribute$1(new this.array.constructor(array),this.itemSize,this.normalized);}else {if(data.interleavedBuffers===undefined){data.interleavedBuffers={};}if(data.interleavedBuffers[this.data.uuid]===undefined){data.interleavedBuffers[this.data.uuid]=this.data.clone(data);}return new InterleavedBufferAttribute$1(data.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);}}toJSON(data){if(data===undefined){console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.');const array=[];for(let i=0;i<this.count;i++){const index=i*this.data.stride+this.offset;for(let j=0;j<this.itemSize;j++){array.push(this.data.array[index+j]);}}// de-interleave data and save it as an ordinary buffer attribute for now
return {itemSize:this.itemSize,type:this.array.constructor.name,array:array,normalized:this.normalized};}else {// save as true interleaved attribute
if(data.interleavedBuffers===undefined){data.interleavedBuffers={};}if(data.interleavedBuffers[this.data.uuid]===undefined){data.interleavedBuffers[this.data.uuid]=this.data.toJSON(data);}return {isInterleavedBufferAttribute:true,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};}}}const _basePosition=/*@__PURE__*/new Vector3$1();const _skinIndex=/*@__PURE__*/new Vector4$1();const _skinWeight=/*@__PURE__*/new Vector4$1();const _vector3=/*@__PURE__*/new Vector3$1();const _matrix4=/*@__PURE__*/new Matrix4$1();const _vertex=/*@__PURE__*/new Vector3$1();const _sphere$4=/*@__PURE__*/new Sphere$1();const _inverseMatrix$2=/*@__PURE__*/new Matrix4$1();const _ray$2=/*@__PURE__*/new Ray$1();class SkinnedMesh extends Mesh$1{constructor(geometry,material){super(geometry,material);this.isSkinnedMesh=true;this.type='SkinnedMesh';this.bindMode=AttachedBindMode;this.bindMatrix=new Matrix4$1();this.bindMatrixInverse=new Matrix4$1();this.boundingBox=null;this.boundingSphere=null;}computeBoundingBox(){const geometry=this.geometry;if(this.boundingBox===null){this.boundingBox=new Box3$1();}this.boundingBox.makeEmpty();const positionAttribute=geometry.getAttribute('position');for(let i=0;i<positionAttribute.count;i++){this.getVertexPosition(i,_vertex);this.boundingBox.expandByPoint(_vertex);}}computeBoundingSphere(){const geometry=this.geometry;if(this.boundingSphere===null){this.boundingSphere=new Sphere$1();}this.boundingSphere.makeEmpty();const positionAttribute=geometry.getAttribute('position');for(let i=0;i<positionAttribute.count;i++){this.getVertexPosition(i,_vertex);this.boundingSphere.expandByPoint(_vertex);}}copy(source,recursive){super.copy(source,recursive);this.bindMode=source.bindMode;this.bindMatrix.copy(source.bindMatrix);this.bindMatrixInverse.copy(source.bindMatrixInverse);this.skeleton=source.skeleton;if(source.boundingBox!==null)this.boundingBox=source.boundingBox.clone();if(source.boundingSphere!==null)this.boundingSphere=source.boundingSphere.clone();return this;}raycast(raycaster,intersects){const material=this.material;const matrixWorld=this.matrixWorld;if(material===undefined)return;// test with bounding sphere in world space
if(this.boundingSphere===null)this.computeBoundingSphere();_sphere$4.copy(this.boundingSphere);_sphere$4.applyMatrix4(matrixWorld);if(raycaster.ray.intersectsSphere(_sphere$4)===false)return;// convert ray to local space of skinned mesh
_inverseMatrix$2.copy(matrixWorld).invert();_ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2);// test with bounding box in local space
if(this.boundingBox!==null){if(_ray$2.intersectsBox(this.boundingBox)===false)return;}// test for intersections with geometry
this._computeIntersections(raycaster,intersects,_ray$2);}getVertexPosition(index,target){super.getVertexPosition(index,target);this.applyBoneTransform(index,target);return target;}bind(skeleton,bindMatrix){this.skeleton=skeleton;if(bindMatrix===undefined){this.updateMatrixWorld(true);this.skeleton.calculateInverses();bindMatrix=this.matrixWorld;}this.bindMatrix.copy(bindMatrix);this.bindMatrixInverse.copy(bindMatrix).invert();}pose(){this.skeleton.pose();}normalizeSkinWeights(){const vector=new Vector4$1();const skinWeight=this.geometry.attributes.skinWeight;for(let i=0,l=skinWeight.count;i<l;i++){vector.fromBufferAttribute(skinWeight,i);const scale=1.0/vector.manhattanLength();if(scale!==Infinity){vector.multiplyScalar(scale);}else {vector.set(1,0,0,0);// do something reasonable
}skinWeight.setXYZW(i,vector.x,vector.y,vector.z,vector.w);}}updateMatrixWorld(force){super.updateMatrixWorld(force);if(this.bindMode===AttachedBindMode){this.bindMatrixInverse.copy(this.matrixWorld).invert();}else if(this.bindMode===DetachedBindMode){this.bindMatrixInverse.copy(this.bindMatrix).invert();}else {console.warn('THREE.SkinnedMesh: Unrecognized bindMode: '+this.bindMode);}}applyBoneTransform(index,vector){const skeleton=this.skeleton;const geometry=this.geometry;_skinIndex.fromBufferAttribute(geometry.attributes.skinIndex,index);_skinWeight.fromBufferAttribute(geometry.attributes.skinWeight,index);_basePosition.copy(vector).applyMatrix4(this.bindMatrix);vector.set(0,0,0);for(let i=0;i<4;i++){const weight=_skinWeight.getComponent(i);if(weight!==0){const boneIndex=_skinIndex.getComponent(i);_matrix4.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld,skeleton.boneInverses[boneIndex]);vector.addScaledVector(_vector3.copy(_basePosition).applyMatrix4(_matrix4),weight);}}return vector.applyMatrix4(this.bindMatrixInverse);}}class Bone extends Object3D$1{constructor(){super();this.isBone=true;this.type='Bone';}}class DataTexture$1 extends Texture$1{constructor(data=null,width=1,height=1,format,type,mapping,wrapS,wrapT,magFilter=NearestFilter$1,minFilter=NearestFilter$1,anisotropy,colorSpace){super(null,mapping,wrapS,wrapT,magFilter,minFilter,format,type,anisotropy,colorSpace);this.isDataTexture=true;this.image={data:data,width:width,height:height};this.generateMipmaps=false;this.flipY=false;this.unpackAlignment=1;}}const _offsetMatrix=/*@__PURE__*/new Matrix4$1();const _identityMatrix$1=/*@__PURE__*/new Matrix4$1();class Skeleton{constructor(bones=[],boneInverses=[]){this.uuid=generateUUID$1();this.bones=bones.slice(0);this.boneInverses=boneInverses;this.boneMatrices=null;this.boneTexture=null;this.init();}init(){const bones=this.bones;const boneInverses=this.boneInverses;this.boneMatrices=new Float32Array(bones.length*16);// calculate inverse bone matrices if necessary
if(boneInverses.length===0){this.calculateInverses();}else {// handle special case
if(bones.length!==boneInverses.length){console.warn('THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.');this.boneInverses=[];for(let i=0,il=this.bones.length;i<il;i++){this.boneInverses.push(new Matrix4$1());}}}}calculateInverses(){this.boneInverses.length=0;for(let i=0,il=this.bones.length;i<il;i++){const inverse=new Matrix4$1();if(this.bones[i]){inverse.copy(this.bones[i].matrixWorld).invert();}this.boneInverses.push(inverse);}}pose(){// recover the bind-time world matrices
for(let i=0,il=this.bones.length;i<il;i++){const bone=this.bones[i];if(bone){bone.matrixWorld.copy(this.boneInverses[i]).invert();}}// compute the local matrices, positions, rotations and scales
for(let i=0,il=this.bones.length;i<il;i++){const bone=this.bones[i];if(bone){if(bone.parent&&bone.parent.isBone){bone.matrix.copy(bone.parent.matrixWorld).invert();bone.matrix.multiply(bone.matrixWorld);}else {bone.matrix.copy(bone.matrixWorld);}bone.matrix.decompose(bone.position,bone.quaternion,bone.scale);}}}update(){const bones=this.bones;const boneInverses=this.boneInverses;const boneMatrices=this.boneMatrices;const boneTexture=this.boneTexture;// flatten bone matrices to array
for(let i=0,il=bones.length;i<il;i++){// compute the offset between the current and the original transform
const matrix=bones[i]?bones[i].matrixWorld:_identityMatrix$1;_offsetMatrix.multiplyMatrices(matrix,boneInverses[i]);_offsetMatrix.toArray(boneMatrices,i*16);}if(boneTexture!==null){boneTexture.needsUpdate=true;}}clone(){return new Skeleton(this.bones,this.boneInverses);}computeBoneTexture(){// layout (1 matrix = 4 pixels)
//      RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)
//  with  8x8  pixel texture max   16 bones * 4 pixels =  (8 * 8)
//       16x16 pixel texture max   64 bones * 4 pixels = (16 * 16)
//       32x32 pixel texture max  256 bones * 4 pixels = (32 * 32)
//       64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)
let size=Math.sqrt(this.bones.length*4);// 4 pixels needed for 1 matrix
size=Math.ceil(size/4)*4;size=Math.max(size,4);const boneMatrices=new Float32Array(size*size*4);// 4 floats per RGBA pixel
boneMatrices.set(this.boneMatrices);// copy current values
const boneTexture=new DataTexture$1(boneMatrices,size,size,RGBAFormat$1,FloatType$1);boneTexture.needsUpdate=true;this.boneMatrices=boneMatrices;this.boneTexture=boneTexture;return this;}getBoneByName(name){for(let i=0,il=this.bones.length;i<il;i++){const bone=this.bones[i];if(bone.name===name){return bone;}}return undefined;}dispose(){if(this.boneTexture!==null){this.boneTexture.dispose();this.boneTexture=null;}}fromJSON(json,bones){this.uuid=json.uuid;for(let i=0,l=json.bones.length;i<l;i++){const uuid=json.bones[i];let bone=bones[uuid];if(bone===undefined){console.warn('THREE.Skeleton: No bone found with UUID:',uuid);bone=new Bone();}this.bones.push(bone);this.boneInverses.push(new Matrix4$1().fromArray(json.boneInverses[i]));}this.init();return this;}toJSON(){const data={metadata:{version:4.6,type:'Skeleton',generator:'Skeleton.toJSON'},bones:[],boneInverses:[]};data.uuid=this.uuid;const bones=this.bones;const boneInverses=this.boneInverses;for(let i=0,l=bones.length;i<l;i++){const bone=bones[i];data.bones.push(bone.uuid);const boneInverse=boneInverses[i];data.boneInverses.push(boneInverse.toArray());}return data;}}class InstancedBufferAttribute$1 extends BufferAttribute$1{constructor(array,itemSize,normalized,meshPerAttribute=1){super(array,itemSize,normalized);this.isInstancedBufferAttribute=true;this.meshPerAttribute=meshPerAttribute;}copy(source){super.copy(source);this.meshPerAttribute=source.meshPerAttribute;return this;}toJSON(){const data=super.toJSON();data.meshPerAttribute=this.meshPerAttribute;data.isInstancedBufferAttribute=true;return data;}}const _instanceLocalMatrix=/*@__PURE__*/new Matrix4$1();const _instanceWorldMatrix=/*@__PURE__*/new Matrix4$1();const _instanceIntersects=[];const _box3=/*@__PURE__*/new Box3$1();const _identity=/*@__PURE__*/new Matrix4$1();const _mesh$1=/*@__PURE__*/new Mesh$1();const _sphere$3=/*@__PURE__*/new Sphere$1();class InstancedMesh extends Mesh$1{constructor(geometry,material,count){super(geometry,material);this.isInstancedMesh=true;this.instanceMatrix=new InstancedBufferAttribute$1(new Float32Array(count*16),16);this.instanceColor=null;this.morphTexture=null;this.count=count;this.boundingBox=null;this.boundingSphere=null;for(let i=0;i<count;i++){this.setMatrixAt(i,_identity);}}computeBoundingBox(){const geometry=this.geometry;const count=this.count;if(this.boundingBox===null){this.boundingBox=new Box3$1();}if(geometry.boundingBox===null){geometry.computeBoundingBox();}this.boundingBox.makeEmpty();for(let i=0;i<count;i++){this.getMatrixAt(i,_instanceLocalMatrix);_box3.copy(geometry.boundingBox).applyMatrix4(_instanceLocalMatrix);this.boundingBox.union(_box3);}}computeBoundingSphere(){const geometry=this.geometry;const count=this.count;if(this.boundingSphere===null){this.boundingSphere=new Sphere$1();}if(geometry.boundingSphere===null){geometry.computeBoundingSphere();}this.boundingSphere.makeEmpty();for(let i=0;i<count;i++){this.getMatrixAt(i,_instanceLocalMatrix);_sphere$3.copy(geometry.boundingSphere).applyMatrix4(_instanceLocalMatrix);this.boundingSphere.union(_sphere$3);}}copy(source,recursive){super.copy(source,recursive);this.instanceMatrix.copy(source.instanceMatrix);if(source.morphTexture!==null)this.morphTexture=source.morphTexture.clone();if(source.instanceColor!==null)this.instanceColor=source.instanceColor.clone();this.count=source.count;if(source.boundingBox!==null)this.boundingBox=source.boundingBox.clone();if(source.boundingSphere!==null)this.boundingSphere=source.boundingSphere.clone();return this;}getColorAt(index,color){color.fromArray(this.instanceColor.array,index*3);}getMatrixAt(index,matrix){matrix.fromArray(this.instanceMatrix.array,index*16);}getMorphAt(index,object){const objectInfluences=object.morphTargetInfluences;const array=this.morphTexture.source.data.data;const len=objectInfluences.length+1;// All influences + the baseInfluenceSum
const dataIndex=index*len+1;// Skip the baseInfluenceSum at the beginning
for(let i=0;i<objectInfluences.length;i++){objectInfluences[i]=array[dataIndex+i];}}raycast(raycaster,intersects){const matrixWorld=this.matrixWorld;const raycastTimes=this.count;_mesh$1.geometry=this.geometry;_mesh$1.material=this.material;if(_mesh$1.material===undefined)return;// test with bounding sphere first
if(this.boundingSphere===null)this.computeBoundingSphere();_sphere$3.copy(this.boundingSphere);_sphere$3.applyMatrix4(matrixWorld);if(raycaster.ray.intersectsSphere(_sphere$3)===false)return;// now test each instance
for(let instanceId=0;instanceId<raycastTimes;instanceId++){// calculate the world matrix for each instance
this.getMatrixAt(instanceId,_instanceLocalMatrix);_instanceWorldMatrix.multiplyMatrices(matrixWorld,_instanceLocalMatrix);// the mesh represents this single instance
_mesh$1.matrixWorld=_instanceWorldMatrix;_mesh$1.raycast(raycaster,_instanceIntersects);// process the result of raycast
for(let i=0,l=_instanceIntersects.length;i<l;i++){const intersect=_instanceIntersects[i];intersect.instanceId=instanceId;intersect.object=this;intersects.push(intersect);}_instanceIntersects.length=0;}}setColorAt(index,color){if(this.instanceColor===null){this.instanceColor=new InstancedBufferAttribute$1(new Float32Array(this.instanceMatrix.count*3).fill(1),3);}color.toArray(this.instanceColor.array,index*3);}setMatrixAt(index,matrix){matrix.toArray(this.instanceMatrix.array,index*16);}setMorphAt(index,object){const objectInfluences=object.morphTargetInfluences;const len=objectInfluences.length+1;// morphBaseInfluence + all influences
if(this.morphTexture===null){this.morphTexture=new DataTexture$1(new Float32Array(len*this.count),len,this.count,RedFormat,FloatType$1);}const array=this.morphTexture.source.data.data;let morphInfluencesSum=0;for(let i=0;i<objectInfluences.length;i++){morphInfluencesSum+=objectInfluences[i];}const morphBaseInfluence=this.geometry.morphTargetsRelative?1:1-morphInfluencesSum;const dataIndex=len*index;array[dataIndex]=morphBaseInfluence;array.set(objectInfluences,dataIndex+1);}updateMorphTargets(){}dispose(){this.dispatchEvent({type:'dispose'});if(this.morphTexture!==null){this.morphTexture.dispose();this.morphTexture=null;}return this;}}class LineBasicMaterial extends Material$1{constructor(parameters){super();this.isLineBasicMaterial=true;this.type='LineBasicMaterial';this.color=new Color$1(0xffffff);this.map=null;this.linewidth=1;this.linecap='round';this.linejoin='round';this.fog=true;this.setValues(parameters);}copy(source){super.copy(source);this.color.copy(source.color);this.map=source.map;this.linewidth=source.linewidth;this.linecap=source.linecap;this.linejoin=source.linejoin;this.fog=source.fog;return this;}}const _vStart=/*@__PURE__*/new Vector3$1();const _vEnd=/*@__PURE__*/new Vector3$1();const _inverseMatrix$1=/*@__PURE__*/new Matrix4$1();const _ray$1$1=/*@__PURE__*/new Ray$1();const _sphere$1=/*@__PURE__*/new Sphere$1();const _intersectPointOnRay=/*@__PURE__*/new Vector3$1();const _intersectPointOnSegment=/*@__PURE__*/new Vector3$1();class Line extends Object3D$1{constructor(geometry=new BufferGeometry$1(),material=new LineBasicMaterial()){super();this.isLine=true;this.type='Line';this.geometry=geometry;this.material=material;this.updateMorphTargets();}copy(source,recursive){super.copy(source,recursive);this.material=Array.isArray(source.material)?source.material.slice():source.material;this.geometry=source.geometry;return this;}computeLineDistances(){const geometry=this.geometry;// we assume non-indexed geometry
if(geometry.index===null){const positionAttribute=geometry.attributes.position;const lineDistances=[0];for(let i=1,l=positionAttribute.count;i<l;i++){_vStart.fromBufferAttribute(positionAttribute,i-1);_vEnd.fromBufferAttribute(positionAttribute,i);lineDistances[i]=lineDistances[i-1];lineDistances[i]+=_vStart.distanceTo(_vEnd);}geometry.setAttribute('lineDistance',new Float32BufferAttribute$1(lineDistances,1));}else {console.warn('THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.');}return this;}raycast(raycaster,intersects){const geometry=this.geometry;const matrixWorld=this.matrixWorld;const threshold=raycaster.params.Line.threshold;const drawRange=geometry.drawRange;// Checking boundingSphere distance to ray
if(geometry.boundingSphere===null)geometry.computeBoundingSphere();_sphere$1.copy(geometry.boundingSphere);_sphere$1.applyMatrix4(matrixWorld);_sphere$1.radius+=threshold;if(raycaster.ray.intersectsSphere(_sphere$1)===false)return;//
_inverseMatrix$1.copy(matrixWorld).invert();_ray$1$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1);const localThreshold=threshold/((this.scale.x+this.scale.y+this.scale.z)/3);const localThresholdSq=localThreshold*localThreshold;const step=this.isLineSegments?2:1;const index=geometry.index;const attributes=geometry.attributes;const positionAttribute=attributes.position;if(index!==null){const start=Math.max(0,drawRange.start);const end=Math.min(index.count,drawRange.start+drawRange.count);for(let i=start,l=end-1;i<l;i+=step){const a=index.getX(i);const b=index.getX(i+1);const intersect=checkIntersection$2(this,raycaster,_ray$1$1,localThresholdSq,a,b);if(intersect){intersects.push(intersect);}}if(this.isLineLoop){const a=index.getX(end-1);const b=index.getX(start);const intersect=checkIntersection$2(this,raycaster,_ray$1$1,localThresholdSq,a,b);if(intersect){intersects.push(intersect);}}}else {const start=Math.max(0,drawRange.start);const end=Math.min(positionAttribute.count,drawRange.start+drawRange.count);for(let i=start,l=end-1;i<l;i+=step){const intersect=checkIntersection$2(this,raycaster,_ray$1$1,localThresholdSq,i,i+1);if(intersect){intersects.push(intersect);}}if(this.isLineLoop){const intersect=checkIntersection$2(this,raycaster,_ray$1$1,localThresholdSq,end-1,start);if(intersect){intersects.push(intersect);}}}}updateMorphTargets(){const geometry=this.geometry;const morphAttributes=geometry.morphAttributes;const keys=Object.keys(morphAttributes);if(keys.length>0){const morphAttribute=morphAttributes[keys[0]];if(morphAttribute!==undefined){this.morphTargetInfluences=[];this.morphTargetDictionary={};for(let m=0,ml=morphAttribute.length;m<ml;m++){const name=morphAttribute[m].name||String(m);this.morphTargetInfluences.push(0);this.morphTargetDictionary[name]=m;}}}}}function checkIntersection$2(object,raycaster,ray,thresholdSq,a,b){const positionAttribute=object.geometry.attributes.position;_vStart.fromBufferAttribute(positionAttribute,a);_vEnd.fromBufferAttribute(positionAttribute,b);const distSq=ray.distanceSqToSegment(_vStart,_vEnd,_intersectPointOnRay,_intersectPointOnSegment);if(distSq>thresholdSq)return;_intersectPointOnRay.applyMatrix4(object.matrixWorld);// Move back to world space for distance calculation
const distance=raycaster.ray.origin.distanceTo(_intersectPointOnRay);if(distance<raycaster.near||distance>raycaster.far)return;return {distance:distance,// What do we want? intersection point on the ray or on the segment??
// point: raycaster.ray.at( distance ),
point:_intersectPointOnSegment.clone().applyMatrix4(object.matrixWorld),index:a,face:null,faceIndex:null,object:object};}const _start=/*@__PURE__*/new Vector3$1();const _end=/*@__PURE__*/new Vector3$1();class LineSegments extends Line{constructor(geometry,material){super(geometry,material);this.isLineSegments=true;this.type='LineSegments';}computeLineDistances(){const geometry=this.geometry;// we assume non-indexed geometry
if(geometry.index===null){const positionAttribute=geometry.attributes.position;const lineDistances=[];for(let i=0,l=positionAttribute.count;i<l;i+=2){_start.fromBufferAttribute(positionAttribute,i);_end.fromBufferAttribute(positionAttribute,i+1);lineDistances[i]=i===0?0:lineDistances[i-1];lineDistances[i+1]=lineDistances[i]+_start.distanceTo(_end);}geometry.setAttribute('lineDistance',new Float32BufferAttribute$1(lineDistances,1));}else {console.warn('THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.');}return this;}}class LineLoop extends Line{constructor(geometry,material){super(geometry,material);this.isLineLoop=true;this.type='LineLoop';}}class PointsMaterial extends Material$1{constructor(parameters){super();this.isPointsMaterial=true;this.type='PointsMaterial';this.color=new Color$1(0xffffff);this.map=null;this.alphaMap=null;this.size=1;this.sizeAttenuation=true;this.fog=true;this.setValues(parameters);}copy(source){super.copy(source);this.color.copy(source.color);this.map=source.map;this.alphaMap=source.alphaMap;this.size=source.size;this.sizeAttenuation=source.sizeAttenuation;this.fog=source.fog;return this;}}const _inverseMatrix$4=/*@__PURE__*/new Matrix4$1();const _ray$4=/*@__PURE__*/new Ray$1();const _sphere$2=/*@__PURE__*/new Sphere$1();const _position$2=/*@__PURE__*/new Vector3$1();class Points extends Object3D$1{constructor(geometry=new BufferGeometry$1(),material=new PointsMaterial()){super();this.isPoints=true;this.type='Points';this.geometry=geometry;this.material=material;this.updateMorphTargets();}copy(source,recursive){super.copy(source,recursive);this.material=Array.isArray(source.material)?source.material.slice():source.material;this.geometry=source.geometry;return this;}raycast(raycaster,intersects){const geometry=this.geometry;const matrixWorld=this.matrixWorld;const threshold=raycaster.params.Points.threshold;const drawRange=geometry.drawRange;// Checking boundingSphere distance to ray
if(geometry.boundingSphere===null)geometry.computeBoundingSphere();_sphere$2.copy(geometry.boundingSphere);_sphere$2.applyMatrix4(matrixWorld);_sphere$2.radius+=threshold;if(raycaster.ray.intersectsSphere(_sphere$2)===false)return;//
_inverseMatrix$4.copy(matrixWorld).invert();_ray$4.copy(raycaster.ray).applyMatrix4(_inverseMatrix$4);const localThreshold=threshold/((this.scale.x+this.scale.y+this.scale.z)/3);const localThresholdSq=localThreshold*localThreshold;const index=geometry.index;const attributes=geometry.attributes;const positionAttribute=attributes.position;if(index!==null){const start=Math.max(0,drawRange.start);const end=Math.min(index.count,drawRange.start+drawRange.count);for(let i=start,il=end;i<il;i++){const a=index.getX(i);_position$2.fromBufferAttribute(positionAttribute,a);testPoint(_position$2,a,localThresholdSq,matrixWorld,raycaster,intersects,this);}}else {const start=Math.max(0,drawRange.start);const end=Math.min(positionAttribute.count,drawRange.start+drawRange.count);for(let i=start,l=end;i<l;i++){_position$2.fromBufferAttribute(positionAttribute,i);testPoint(_position$2,i,localThresholdSq,matrixWorld,raycaster,intersects,this);}}}updateMorphTargets(){const geometry=this.geometry;const morphAttributes=geometry.morphAttributes;const keys=Object.keys(morphAttributes);if(keys.length>0){const morphAttribute=morphAttributes[keys[0]];if(morphAttribute!==undefined){this.morphTargetInfluences=[];this.morphTargetDictionary={};for(let m=0,ml=morphAttribute.length;m<ml;m++){const name=morphAttribute[m].name||String(m);this.morphTargetInfluences.push(0);this.morphTargetDictionary[name]=m;}}}}}function testPoint(point,index,localThresholdSq,matrixWorld,raycaster,intersects,object){const rayPointDistanceSq=_ray$4.distanceSqToPoint(point);if(rayPointDistanceSq<localThresholdSq){const intersectPoint=new Vector3$1();_ray$4.closestPointToPoint(point,intersectPoint);intersectPoint.applyMatrix4(matrixWorld);const distance=raycaster.ray.origin.distanceTo(intersectPoint);if(distance<raycaster.near||distance>raycaster.far)return;intersects.push({distance:distance,distanceToRay:Math.sqrt(rayPointDistanceSq),point:intersectPoint,index:index,face:null,object:object});}}/**
 * Extensible curve object.
 *
 * Some common of curve methods:
 * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )
 * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )
 * .getPoints(), .getSpacedPoints()
 * .getLength()
 * .updateArcLengths()
 *
 * This following curves inherit from THREE.Curve:
 *
 * -- 2D curves --
 * THREE.ArcCurve
 * THREE.CubicBezierCurve
 * THREE.EllipseCurve
 * THREE.LineCurve
 * THREE.QuadraticBezierCurve
 * THREE.SplineCurve
 *
 * -- 3D curves --
 * THREE.CatmullRomCurve3
 * THREE.CubicBezierCurve3
 * THREE.LineCurve3
 * THREE.QuadraticBezierCurve3
 *
 * A series of curves can be represented as a THREE.CurvePath.
 *
 **/class Curve{constructor(){this.type='Curve';this.arcLengthDivisions=200;}// Virtual base class method to overwrite and implement in subclasses
//	- t [0 .. 1]
getPoint(/* t, optionalTarget */){console.warn('THREE.Curve: .getPoint() not implemented.');return null;}// Get point at relative position in curve according to arc length
// - u [0 .. 1]
getPointAt(u,optionalTarget){const t=this.getUtoTmapping(u);return this.getPoint(t,optionalTarget);}// Get sequence of points using getPoint( t )
getPoints(divisions=5){const points=[];for(let d=0;d<=divisions;d++){points.push(this.getPoint(d/divisions));}return points;}// Get sequence of points using getPointAt( u )
getSpacedPoints(divisions=5){const points=[];for(let d=0;d<=divisions;d++){points.push(this.getPointAt(d/divisions));}return points;}// Get total curve arc length
getLength(){const lengths=this.getLengths();return lengths[lengths.length-1];}// Get list of cumulative segment lengths
getLengths(divisions=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===divisions+1&&!this.needsUpdate){return this.cacheArcLengths;}this.needsUpdate=false;const cache=[];let current,last=this.getPoint(0);let sum=0;cache.push(0);for(let p=1;p<=divisions;p++){current=this.getPoint(p/divisions);sum+=current.distanceTo(last);cache.push(sum);last=current;}this.cacheArcLengths=cache;return cache;// { sums: cache, sum: sum }; Sum is in the last element.
}updateArcLengths(){this.needsUpdate=true;this.getLengths();}// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant
getUtoTmapping(u,distance){const arcLengths=this.getLengths();let i=0;const il=arcLengths.length;let targetArcLength;// The targeted u distance value to get
if(distance){targetArcLength=distance;}else {targetArcLength=u*arcLengths[il-1];}// binary search for the index with largest value smaller than target u distance
let low=0,high=il-1,comparison;while(low<=high){i=Math.floor(low+(high-low)/2);// less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats
comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(comparison>0){high=i-1;}else {high=i;break;// DONE
}}i=high;if(arcLengths[i]===targetArcLength){return i/(il-1);}// we could get finer grain at lengths, or use simple interpolation between two points
const lengthBefore=arcLengths[i];const lengthAfter=arcLengths[i+1];const segmentLength=lengthAfter-lengthBefore;// determine where we are between the 'before' and 'after' points
const segmentFraction=(targetArcLength-lengthBefore)/segmentLength;// add that fractional amount to t
const t=(i+segmentFraction)/(il-1);return t;}// Returns a unit vector tangent at t
// In case any sub curve does not implement its tangent derivation,
// 2 points a small delta apart will be used to find its gradient
// which seems to give a reasonable approximation
getTangent(t,optionalTarget){const delta=0.0001;let t1=t-delta;let t2=t+delta;// Capping in case of danger
if(t1<0)t1=0;if(t2>1)t2=1;const pt1=this.getPoint(t1);const pt2=this.getPoint(t2);const tangent=optionalTarget||(pt1.isVector2?new Vector2$1():new Vector3$1());tangent.copy(pt2).sub(pt1).normalize();return tangent;}getTangentAt(u,optionalTarget){const t=this.getUtoTmapping(u);return this.getTangent(t,optionalTarget);}computeFrenetFrames(segments,closed){// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf
const normal=new Vector3$1();const tangents=[];const normals=[];const binormals=[];const vec=new Vector3$1();const mat=new Matrix4$1();// compute the tangent vectors for each segment on the curve
for(let i=0;i<=segments;i++){const u=i/segments;tangents[i]=this.getTangentAt(u,new Vector3$1());}// select an initial normal vector perpendicular to the first tangent vector,
// and in the direction of the minimum tangent xyz component
normals[0]=new Vector3$1();binormals[0]=new Vector3$1();let min=Number.MAX_VALUE;const tx=Math.abs(tangents[0].x);const ty=Math.abs(tangents[0].y);const tz=Math.abs(tangents[0].z);if(tx<=min){min=tx;normal.set(1,0,0);}if(ty<=min){min=ty;normal.set(0,1,0);}if(tz<=min){normal.set(0,0,1);}vec.crossVectors(tangents[0],normal).normalize();normals[0].crossVectors(tangents[0],vec);binormals[0].crossVectors(tangents[0],normals[0]);// compute the slowly-varying normal and binormal vectors for each segment on the curve
for(let i=1;i<=segments;i++){normals[i]=normals[i-1].clone();binormals[i]=binormals[i-1].clone();vec.crossVectors(tangents[i-1],tangents[i]);if(vec.length()>Number.EPSILON){vec.normalize();const theta=Math.acos(clamp$2(tangents[i-1].dot(tangents[i]),-1,1));// clamp for floating pt errors
normals[i].applyMatrix4(mat.makeRotationAxis(vec,theta));}binormals[i].crossVectors(tangents[i],normals[i]);}// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same
if(closed===true){let theta=Math.acos(clamp$2(normals[0].dot(normals[segments]),-1,1));theta/=segments;if(tangents[0].dot(vec.crossVectors(normals[0],normals[segments]))>0){theta=-theta;}for(let i=1;i<=segments;i++){// twist a little...
normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i],theta*i));binormals[i].crossVectors(tangents[i],normals[i]);}}return {tangents:tangents,normals:normals,binormals:binormals};}clone(){return new this.constructor().copy(this);}copy(source){this.arcLengthDivisions=source.arcLengthDivisions;return this;}toJSON(){const data={metadata:{version:4.6,type:'Curve',generator:'Curve.toJSON'}};data.arcLengthDivisions=this.arcLengthDivisions;data.type=this.type;return data;}fromJSON(json){this.arcLengthDivisions=json.arcLengthDivisions;return this;}}/**
 * Port from https://github.com/mapbox/earcut (v2.2.4)
 */const Earcut={triangulate:function(data,holeIndices,dim=2){const hasHoles=holeIndices&&holeIndices.length;const outerLen=hasHoles?holeIndices[0]*dim:data.length;let outerNode=linkedList(data,0,outerLen,dim,true);const triangles=[];if(!outerNode||outerNode.next===outerNode.prev)return triangles;let minX,minY,maxX,maxY,x,y,invSize;if(hasHoles)outerNode=eliminateHoles(data,holeIndices,outerNode,dim);// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
if(data.length>80*dim){minX=maxX=data[0];minY=maxY=data[1];for(let i=dim;i<outerLen;i+=dim){x=data[i];y=data[i+1];if(x<minX)minX=x;if(y<minY)minY=y;if(x>maxX)maxX=x;if(y>maxY)maxY=y;}// minX, minY and invSize are later used to transform coords into integers for z-order calculation
invSize=Math.max(maxX-minX,maxY-minY);invSize=invSize!==0?32767/invSize:0;}earcutLinked(outerNode,triangles,dim,minX,minY,invSize,0);return triangles;}};// create a circular doubly linked list from polygon points in the specified winding order
function linkedList(data,start,end,dim,clockwise){let i,last;if(clockwise===signedArea(data,start,end,dim)>0){for(i=start;i<end;i+=dim)last=insertNode(i,data[i],data[i+1],last);}else {for(i=end-dim;i>=start;i-=dim)last=insertNode(i,data[i],data[i+1],last);}if(last&&equals$1(last,last.next)){removeNode(last);last=last.next;}return last;}// eliminate colinear or duplicate points
function filterPoints(start,end){if(!start)return start;if(!end)end=start;let p=start,again;do{again=false;if(!p.steiner&&(equals$1(p,p.next)||area(p.prev,p,p.next)===0)){removeNode(p);p=end=p.prev;if(p===p.next)break;again=true;}else {p=p.next;}}while(again||p!==end);return end;}// main ear slicing loop which triangulates a polygon (given as a linked list)
function earcutLinked(ear,triangles,dim,minX,minY,invSize,pass){if(!ear)return;// interlink polygon nodes in z-order
if(!pass&&invSize)indexCurve(ear,minX,minY,invSize);let stop=ear,prev,next;// iterate through ears, slicing them one by one
while(ear.prev!==ear.next){prev=ear.prev;next=ear.next;if(invSize?isEarHashed(ear,minX,minY,invSize):isEar(ear)){// cut off the triangle
triangles.push(prev.i/dim|0);triangles.push(ear.i/dim|0);triangles.push(next.i/dim|0);removeNode(ear);// skipping the next vertex leads to less sliver triangles
ear=next.next;stop=next.next;continue;}ear=next;// if we looped through the whole remaining polygon and can't find any more ears
if(ear===stop){// try filtering points and slicing again
if(!pass){earcutLinked(filterPoints(ear),triangles,dim,minX,minY,invSize,1);// if this didn't work, try curing all small self-intersections locally
}else if(pass===1){ear=cureLocalIntersections(filterPoints(ear),triangles,dim);earcutLinked(ear,triangles,dim,minX,minY,invSize,2);// as a last resort, try splitting the remaining polygon into two
}else if(pass===2){splitEarcut(ear,triangles,dim,minX,minY,invSize);}break;}}}// check whether a polygon node forms a valid ear with adjacent nodes
function isEar(ear){const a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return false;// reflex, can't be an ear
// now make sure we don't have other points inside the potential ear
const ax=a.x,bx=b.x,cx=c.x,ay=a.y,by=b.y,cy=c.y;// triangle bbox; min & max are calculated like this for speed
const x0=ax<bx?ax<cx?ax:cx:bx<cx?bx:cx,y0=ay<by?ay<cy?ay:cy:by<cy?by:cy,x1=ax>bx?ax>cx?ax:cx:bx>cx?bx:cx,y1=ay>by?ay>cy?ay:cy:by>cy?by:cy;let p=c.next;while(p!==a){if(p.x>=x0&&p.x<=x1&&p.y>=y0&&p.y<=y1&&pointInTriangle(ax,ay,bx,by,cx,cy,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.next;}return true;}function isEarHashed(ear,minX,minY,invSize){const a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return false;// reflex, can't be an ear
const ax=a.x,bx=b.x,cx=c.x,ay=a.y,by=b.y,cy=c.y;// triangle bbox; min & max are calculated like this for speed
const x0=ax<bx?ax<cx?ax:cx:bx<cx?bx:cx,y0=ay<by?ay<cy?ay:cy:by<cy?by:cy,x1=ax>bx?ax>cx?ax:cx:bx>cx?bx:cx,y1=ay>by?ay>cy?ay:cy:by>cy?by:cy;// z-order range for the current triangle bbox;
const minZ=zOrder(x0,y0,minX,minY,invSize),maxZ=zOrder(x1,y1,minX,minY,invSize);let p=ear.prevZ,n=ear.nextZ;// look for points inside the triangle in both directions
while(p&&p.z>=minZ&&n&&n.z<=maxZ){if(p.x>=x0&&p.x<=x1&&p.y>=y0&&p.y<=y1&&p!==a&&p!==c&&pointInTriangle(ax,ay,bx,by,cx,cy,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.prevZ;if(n.x>=x0&&n.x<=x1&&n.y>=y0&&n.y<=y1&&n!==a&&n!==c&&pointInTriangle(ax,ay,bx,by,cx,cy,n.x,n.y)&&area(n.prev,n,n.next)>=0)return false;n=n.nextZ;}// look for remaining points in decreasing z-order
while(p&&p.z>=minZ){if(p.x>=x0&&p.x<=x1&&p.y>=y0&&p.y<=y1&&p!==a&&p!==c&&pointInTriangle(ax,ay,bx,by,cx,cy,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.prevZ;}// look for remaining points in increasing z-order
while(n&&n.z<=maxZ){if(n.x>=x0&&n.x<=x1&&n.y>=y0&&n.y<=y1&&n!==a&&n!==c&&pointInTriangle(ax,ay,bx,by,cx,cy,n.x,n.y)&&area(n.prev,n,n.next)>=0)return false;n=n.nextZ;}return true;}// go through all polygon nodes and cure small local self-intersections
function cureLocalIntersections(start,triangles,dim){let p=start;do{const a=p.prev,b=p.next.next;if(!equals$1(a,b)&&intersects(a,p,p.next,b)&&locallyInside(a,b)&&locallyInside(b,a)){triangles.push(a.i/dim|0);triangles.push(p.i/dim|0);triangles.push(b.i/dim|0);// remove two nodes involved
removeNode(p);removeNode(p.next);p=start=b;}p=p.next;}while(p!==start);return filterPoints(p);}// try splitting polygon into two and triangulate them independently
function splitEarcut(start,triangles,dim,minX,minY,invSize){// look for a valid diagonal that divides the polygon into two
let a=start;do{let b=a.next.next;while(b!==a.prev){if(a.i!==b.i&&isValidDiagonal(a,b)){// split the polygon in two by the diagonal
let c=splitPolygon(a,b);// filter colinear points around the cuts
a=filterPoints(a,a.next);c=filterPoints(c,c.next);// run earcut on each half
earcutLinked(a,triangles,dim,minX,minY,invSize,0);earcutLinked(c,triangles,dim,minX,minY,invSize,0);return;}b=b.next;}a=a.next;}while(a!==start);}// link every hole into the outer loop, producing a single-ring polygon without holes
function eliminateHoles(data,holeIndices,outerNode,dim){const queue=[];let i,len,start,end,list;for(i=0,len=holeIndices.length;i<len;i++){start=holeIndices[i]*dim;end=i<len-1?holeIndices[i+1]*dim:data.length;list=linkedList(data,start,end,dim,false);if(list===list.next)list.steiner=true;queue.push(getLeftmost(list));}queue.sort(compareX);// process holes from left to right
for(i=0;i<queue.length;i++){outerNode=eliminateHole(queue[i],outerNode);}return outerNode;}function compareX(a,b){return a.x-b.x;}// find a bridge between vertices that connects hole with an outer ring and link it
function eliminateHole(hole,outerNode){const bridge=findHoleBridge(hole,outerNode);if(!bridge){return outerNode;}const bridgeReverse=splitPolygon(bridge,hole);// filter collinear points around the cuts
filterPoints(bridgeReverse,bridgeReverse.next);return filterPoints(bridge,bridge.next);}// David Eberly's algorithm for finding a bridge between hole and outer polygon
function findHoleBridge(hole,outerNode){let p=outerNode,qx=-Infinity,m;const hx=hole.x,hy=hole.y;// find a segment intersected by a ray from the hole's leftmost point to the left;
// segment's endpoint with lesser x will be potential connection point
do{if(hy<=p.y&&hy>=p.next.y&&p.next.y!==p.y){const x=p.x+(hy-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(x<=hx&&x>qx){qx=x;m=p.x<p.next.x?p:p.next;if(x===hx)return m;// hole touches outer segment; pick leftmost endpoint
}}p=p.next;}while(p!==outerNode);if(!m)return null;// look for points inside the triangle of hole point, segment intersection and endpoint;
// if there are no points found, we have a valid connection;
// otherwise choose the point of the minimum angle with the ray as connection point
const stop=m,mx=m.x,my=m.y;let tanMin=Infinity,tan;p=m;do{if(hx>=p.x&&p.x>=mx&&hx!==p.x&&pointInTriangle(hy<my?hx:qx,hy,mx,my,hy<my?qx:hx,hy,p.x,p.y)){tan=Math.abs(hy-p.y)/(hx-p.x);// tangential
if(locallyInside(p,hole)&&(tan<tanMin||tan===tanMin&&(p.x>m.x||p.x===m.x&&sectorContainsSector(m,p)))){m=p;tanMin=tan;}}p=p.next;}while(p!==stop);return m;}// whether sector in vertex m contains sector in vertex p in the same coordinates
function sectorContainsSector(m,p){return area(m.prev,m,p.prev)<0&&area(p.next,m,m.next)<0;}// interlink polygon nodes in z-order
function indexCurve(start,minX,minY,invSize){let p=start;do{if(p.z===0)p.z=zOrder(p.x,p.y,minX,minY,invSize);p.prevZ=p.prev;p.nextZ=p.next;p=p.next;}while(p!==start);p.prevZ.nextZ=null;p.prevZ=null;sortLinked(p);}// Simon Tatham's linked list merge sort algorithm
// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
function sortLinked(list){let i,p,q,e,tail,numMerges,pSize,qSize,inSize=1;do{p=list;list=null;tail=null;numMerges=0;while(p){numMerges++;q=p;pSize=0;for(i=0;i<inSize;i++){pSize++;q=q.nextZ;if(!q)break;}qSize=inSize;while(pSize>0||qSize>0&&q){if(pSize!==0&&(qSize===0||!q||p.z<=q.z)){e=p;p=p.nextZ;pSize--;}else {e=q;q=q.nextZ;qSize--;}if(tail)tail.nextZ=e;else list=e;e.prevZ=tail;tail=e;}p=q;}tail.nextZ=null;inSize*=2;}while(numMerges>1);return list;}// z-order of a point given coords and inverse of the longer side of data bbox
function zOrder(x,y,minX,minY,invSize){// coords are transformed into non-negative 15-bit integer range
x=(x-minX)*invSize|0;y=(y-minY)*invSize|0;x=(x|x<<8)&0x00FF00FF;x=(x|x<<4)&0x0F0F0F0F;x=(x|x<<2)&0x33333333;x=(x|x<<1)&0x55555555;y=(y|y<<8)&0x00FF00FF;y=(y|y<<4)&0x0F0F0F0F;y=(y|y<<2)&0x33333333;y=(y|y<<1)&0x55555555;return x|y<<1;}// find the leftmost node of a polygon ring
function getLeftmost(start){let p=start,leftmost=start;do{if(p.x<leftmost.x||p.x===leftmost.x&&p.y<leftmost.y)leftmost=p;p=p.next;}while(p!==start);return leftmost;}// check if a point lies within a convex triangle
function pointInTriangle(ax,ay,bx,by,cx,cy,px,py){return (cx-px)*(ay-py)>=(ax-px)*(cy-py)&&(ax-px)*(by-py)>=(bx-px)*(ay-py)&&(bx-px)*(cy-py)>=(cx-px)*(by-py);}// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
function isValidDiagonal(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!intersectsPolygon(a,b)&&(// dones't intersect other edges
locallyInside(a,b)&&locallyInside(b,a)&&middleInside(a,b)&&(// locally visible
area(a.prev,a,b.prev)||area(a,b.prev,b))||// does not create opposite-facing sectors
equals$1(a,b)&&area(a.prev,a,a.next)>0&&area(b.prev,b,b.next)>0);// special zero-length case
}// signed area of a triangle
function area(p,q,r){return (q.y-p.y)*(r.x-q.x)-(q.x-p.x)*(r.y-q.y);}// check if two points are equal
function equals$1(p1,p2){return p1.x===p2.x&&p1.y===p2.y;}// check if two segments intersect
function intersects(p1,q1,p2,q2){const o1=sign$1(area(p1,q1,p2));const o2=sign$1(area(p1,q1,q2));const o3=sign$1(area(p2,q2,p1));const o4=sign$1(area(p2,q2,q1));if(o1!==o2&&o3!==o4)return true;// general case
if(o1===0&&onSegment(p1,p2,q1))return true;// p1, q1 and p2 are collinear and p2 lies on p1q1
if(o2===0&&onSegment(p1,q2,q1))return true;// p1, q1 and q2 are collinear and q2 lies on p1q1
if(o3===0&&onSegment(p2,p1,q2))return true;// p2, q2 and p1 are collinear and p1 lies on p2q2
if(o4===0&&onSegment(p2,q1,q2))return true;// p2, q2 and q1 are collinear and q1 lies on p2q2
return false;}// for collinear points p, q, r, check if point q lies on segment pr
function onSegment(p,q,r){return q.x<=Math.max(p.x,r.x)&&q.x>=Math.min(p.x,r.x)&&q.y<=Math.max(p.y,r.y)&&q.y>=Math.min(p.y,r.y);}function sign$1(num){return num>0?1:num<0?-1:0;}// check if a polygon diagonal intersects any polygon segments
function intersectsPolygon(a,b){let p=a;do{if(p.i!==a.i&&p.next.i!==a.i&&p.i!==b.i&&p.next.i!==b.i&&intersects(p,p.next,a,b))return true;p=p.next;}while(p!==a);return false;}// check if a polygon diagonal is locally inside the polygon
function locallyInside(a,b){return area(a.prev,a,a.next)<0?area(a,b,a.next)>=0&&area(a,a.prev,b)>=0:area(a,b,a.prev)<0||area(a,a.next,b)<0;}// check if the middle point of a polygon diagonal is inside the polygon
function middleInside(a,b){let p=a,inside=false;const px=(a.x+b.x)/2,py=(a.y+b.y)/2;do{if(p.y>py!==p.next.y>py&&p.next.y!==p.y&&px<(p.next.x-p.x)*(py-p.y)/(p.next.y-p.y)+p.x)inside=!inside;p=p.next;}while(p!==a);return inside;}// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
// if one belongs to the outer ring and another to a hole, it merges it into a single ring
function splitPolygon(a,b){const a2=new Node$2(a.i,a.x,a.y),b2=new Node$2(b.i,b.x,b.y),an=a.next,bp=b.prev;a.next=b;b.prev=a;a2.next=an;an.prev=a2;b2.next=a2;a2.prev=b2;bp.next=b2;b2.prev=bp;return b2;}// create a node and optionally link it with previous one (in a circular doubly linked list)
function insertNode(i,x,y,last){const p=new Node$2(i,x,y);if(!last){p.prev=p;p.next=p;}else {p.next=last.next;p.prev=last;last.next.prev=p;last.next=p;}return p;}function removeNode(p){p.next.prev=p.prev;p.prev.next=p.next;if(p.prevZ)p.prevZ.nextZ=p.nextZ;if(p.nextZ)p.nextZ.prevZ=p.prevZ;}function Node$2(i,x,y){// vertex index in coordinates array
this.i=i;// vertex coordinates
this.x=x;this.y=y;// previous and next vertex nodes in a polygon ring
this.prev=null;this.next=null;// z-order curve value
this.z=0;// previous and next nodes in z-order
this.prevZ=null;this.nextZ=null;// indicates whether this is a steiner point
this.steiner=false;}function signedArea(data,start,end,dim){let sum=0;for(let i=start,j=end-dim;i<end;i+=dim){sum+=(data[j]-data[i])*(data[i+1]+data[j+1]);j=i;}return sum;}class ShapeUtils{// calculate area of the contour polygon
static area(contour){const n=contour.length;let a=0.0;for(let p=n-1,q=0;q<n;p=q++){a+=contour[p].x*contour[q].y-contour[q].x*contour[p].y;}return a*0.5;}static isClockWise(pts){return ShapeUtils.area(pts)<0;}static triangulateShape(contour,holes){const vertices=[];// flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]
const holeIndices=[];// array of hole indices
const faces=[];// final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]
removeDupEndPts(contour);addContour(vertices,contour);//
let holeIndex=contour.length;holes.forEach(removeDupEndPts);for(let i=0;i<holes.length;i++){holeIndices.push(holeIndex);holeIndex+=holes[i].length;addContour(vertices,holes[i]);}//
const triangles=Earcut.triangulate(vertices,holeIndices);//
for(let i=0;i<triangles.length;i+=3){faces.push(triangles.slice(i,i+3));}return faces;}}function removeDupEndPts(points){const l=points.length;if(l>2&&points[l-1].equals(points[0])){points.pop();}}function addContour(vertices,contour){for(let i=0;i<contour.length;i++){vertices.push(contour[i].x);vertices.push(contour[i].y);}}class MeshStandardMaterial extends Material$1{constructor(parameters){super();this.isMeshStandardMaterial=true;this.defines={'STANDARD':''};this.type='MeshStandardMaterial';this.color=new Color$1(0xffffff);// diffuse
this.roughness=1.0;this.metalness=0.0;this.map=null;this.lightMap=null;this.lightMapIntensity=1.0;this.aoMap=null;this.aoMapIntensity=1.0;this.emissive=new Color$1(0x000000);this.emissiveIntensity=1.0;this.emissiveMap=null;this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=TangentSpaceNormalMap$1;this.normalScale=new Vector2$1(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.roughnessMap=null;this.metalnessMap=null;this.alphaMap=null;this.envMap=null;this.envMapRotation=new Euler$1();this.envMapIntensity=1.0;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinecap='round';this.wireframeLinejoin='round';this.flatShading=false;this.fog=true;this.setValues(parameters);}copy(source){super.copy(source);this.defines={'STANDARD':''};this.color.copy(source.color);this.roughness=source.roughness;this.metalness=source.metalness;this.map=source.map;this.lightMap=source.lightMap;this.lightMapIntensity=source.lightMapIntensity;this.aoMap=source.aoMap;this.aoMapIntensity=source.aoMapIntensity;this.emissive.copy(source.emissive);this.emissiveMap=source.emissiveMap;this.emissiveIntensity=source.emissiveIntensity;this.bumpMap=source.bumpMap;this.bumpScale=source.bumpScale;this.normalMap=source.normalMap;this.normalMapType=source.normalMapType;this.normalScale.copy(source.normalScale);this.displacementMap=source.displacementMap;this.displacementScale=source.displacementScale;this.displacementBias=source.displacementBias;this.roughnessMap=source.roughnessMap;this.metalnessMap=source.metalnessMap;this.alphaMap=source.alphaMap;this.envMap=source.envMap;this.envMapRotation.copy(source.envMapRotation);this.envMapIntensity=source.envMapIntensity;this.wireframe=source.wireframe;this.wireframeLinewidth=source.wireframeLinewidth;this.wireframeLinecap=source.wireframeLinecap;this.wireframeLinejoin=source.wireframeLinejoin;this.flatShading=source.flatShading;this.fog=source.fog;return this;}}class MeshPhysicalMaterial extends MeshStandardMaterial{constructor(parameters){super();this.isMeshPhysicalMaterial=true;this.defines={'STANDARD':'','PHYSICAL':''};this.type='MeshPhysicalMaterial';this.anisotropyRotation=0;this.anisotropyMap=null;this.clearcoatMap=null;this.clearcoatRoughness=0.0;this.clearcoatRoughnessMap=null;this.clearcoatNormalScale=new Vector2$1(1,1);this.clearcoatNormalMap=null;this.ior=1.5;Object.defineProperty(this,'reflectivity',{get:function(){return clamp$2(2.5*(this.ior-1)/(this.ior+1),0,1);},set:function(reflectivity){this.ior=(1+0.4*reflectivity)/(1-0.4*reflectivity);}});this.iridescenceMap=null;this.iridescenceIOR=1.3;this.iridescenceThicknessRange=[100,400];this.iridescenceThicknessMap=null;this.sheenColor=new Color$1(0x000000);this.sheenColorMap=null;this.sheenRoughness=1.0;this.sheenRoughnessMap=null;this.transmissionMap=null;this.thickness=0;this.thicknessMap=null;this.attenuationDistance=Infinity;this.attenuationColor=new Color$1(1,1,1);this.specularIntensity=1.0;this.specularIntensityMap=null;this.specularColor=new Color$1(1,1,1);this.specularColorMap=null;this._anisotropy=0;this._clearcoat=0;this._dispersion=0;this._iridescence=0;this._sheen=0.0;this._transmission=0;this.setValues(parameters);}get anisotropy(){return this._anisotropy;}set anisotropy(value){if(this._anisotropy>0!==value>0){this.version++;}this._anisotropy=value;}get clearcoat(){return this._clearcoat;}set clearcoat(value){if(this._clearcoat>0!==value>0){this.version++;}this._clearcoat=value;}get iridescence(){return this._iridescence;}set iridescence(value){if(this._iridescence>0!==value>0){this.version++;}this._iridescence=value;}get dispersion(){return this._dispersion;}set dispersion(value){if(this._dispersion>0!==value>0){this.version++;}this._dispersion=value;}get sheen(){return this._sheen;}set sheen(value){if(this._sheen>0!==value>0){this.version++;}this._sheen=value;}get transmission(){return this._transmission;}set transmission(value){if(this._transmission>0!==value>0){this.version++;}this._transmission=value;}copy(source){super.copy(source);this.defines={'STANDARD':'','PHYSICAL':''};this.anisotropy=source.anisotropy;this.anisotropyRotation=source.anisotropyRotation;this.anisotropyMap=source.anisotropyMap;this.clearcoat=source.clearcoat;this.clearcoatMap=source.clearcoatMap;this.clearcoatRoughness=source.clearcoatRoughness;this.clearcoatRoughnessMap=source.clearcoatRoughnessMap;this.clearcoatNormalMap=source.clearcoatNormalMap;this.clearcoatNormalScale.copy(source.clearcoatNormalScale);this.dispersion=source.dispersion;this.ior=source.ior;this.iridescence=source.iridescence;this.iridescenceMap=source.iridescenceMap;this.iridescenceIOR=source.iridescenceIOR;this.iridescenceThicknessRange=[...source.iridescenceThicknessRange];this.iridescenceThicknessMap=source.iridescenceThicknessMap;this.sheen=source.sheen;this.sheenColor.copy(source.sheenColor);this.sheenColorMap=source.sheenColorMap;this.sheenRoughness=source.sheenRoughness;this.sheenRoughnessMap=source.sheenRoughnessMap;this.transmission=source.transmission;this.transmissionMap=source.transmissionMap;this.thickness=source.thickness;this.thicknessMap=source.thicknessMap;this.attenuationDistance=source.attenuationDistance;this.attenuationColor.copy(source.attenuationColor);this.specularIntensity=source.specularIntensity;this.specularIntensityMap=source.specularIntensityMap;this.specularColor.copy(source.specularColor);this.specularColorMap=source.specularColorMap;return this;}}class MeshPhongMaterial extends Material$1{constructor(parameters){super();this.isMeshPhongMaterial=true;this.type='MeshPhongMaterial';this.color=new Color$1(0xffffff);// diffuse
this.specular=new Color$1(0x111111);this.shininess=30;this.map=null;this.lightMap=null;this.lightMapIntensity=1.0;this.aoMap=null;this.aoMapIntensity=1.0;this.emissive=new Color$1(0x000000);this.emissiveIntensity=1.0;this.emissiveMap=null;this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=TangentSpaceNormalMap$1;this.normalScale=new Vector2$1(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.specularMap=null;this.alphaMap=null;this.envMap=null;this.envMapRotation=new Euler$1();this.combine=MultiplyOperation$1;this.reflectivity=1;this.refractionRatio=0.98;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinecap='round';this.wireframeLinejoin='round';this.flatShading=false;this.fog=true;this.setValues(parameters);}copy(source){super.copy(source);this.color.copy(source.color);this.specular.copy(source.specular);this.shininess=source.shininess;this.map=source.map;this.lightMap=source.lightMap;this.lightMapIntensity=source.lightMapIntensity;this.aoMap=source.aoMap;this.aoMapIntensity=source.aoMapIntensity;this.emissive.copy(source.emissive);this.emissiveMap=source.emissiveMap;this.emissiveIntensity=source.emissiveIntensity;this.bumpMap=source.bumpMap;this.bumpScale=source.bumpScale;this.normalMap=source.normalMap;this.normalMapType=source.normalMapType;this.normalScale.copy(source.normalScale);this.displacementMap=source.displacementMap;this.displacementScale=source.displacementScale;this.displacementBias=source.displacementBias;this.specularMap=source.specularMap;this.alphaMap=source.alphaMap;this.envMap=source.envMap;this.envMapRotation.copy(source.envMapRotation);this.combine=source.combine;this.reflectivity=source.reflectivity;this.refractionRatio=source.refractionRatio;this.wireframe=source.wireframe;this.wireframeLinewidth=source.wireframeLinewidth;this.wireframeLinecap=source.wireframeLinecap;this.wireframeLinejoin=source.wireframeLinejoin;this.flatShading=source.flatShading;this.fog=source.fog;return this;}}class MeshLambertMaterial extends Material$1{constructor(parameters){super();this.isMeshLambertMaterial=true;this.type='MeshLambertMaterial';this.color=new Color$1(0xffffff);// diffuse
this.map=null;this.lightMap=null;this.lightMapIntensity=1.0;this.aoMap=null;this.aoMapIntensity=1.0;this.emissive=new Color$1(0x000000);this.emissiveIntensity=1.0;this.emissiveMap=null;this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalMapType=TangentSpaceNormalMap$1;this.normalScale=new Vector2$1(1,1);this.displacementMap=null;this.displacementScale=1;this.displacementBias=0;this.specularMap=null;this.alphaMap=null;this.envMap=null;this.envMapRotation=new Euler$1();this.combine=MultiplyOperation$1;this.reflectivity=1;this.refractionRatio=0.98;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinecap='round';this.wireframeLinejoin='round';this.flatShading=false;this.fog=true;this.setValues(parameters);}copy(source){super.copy(source);this.color.copy(source.color);this.map=source.map;this.lightMap=source.lightMap;this.lightMapIntensity=source.lightMapIntensity;this.aoMap=source.aoMap;this.aoMapIntensity=source.aoMapIntensity;this.emissive.copy(source.emissive);this.emissiveMap=source.emissiveMap;this.emissiveIntensity=source.emissiveIntensity;this.bumpMap=source.bumpMap;this.bumpScale=source.bumpScale;this.normalMap=source.normalMap;this.normalMapType=source.normalMapType;this.normalScale.copy(source.normalScale);this.displacementMap=source.displacementMap;this.displacementScale=source.displacementScale;this.displacementBias=source.displacementBias;this.specularMap=source.specularMap;this.alphaMap=source.alphaMap;this.envMap=source.envMap;this.envMapRotation.copy(source.envMapRotation);this.combine=source.combine;this.reflectivity=source.reflectivity;this.refractionRatio=source.refractionRatio;this.wireframe=source.wireframe;this.wireframeLinewidth=source.wireframeLinewidth;this.wireframeLinecap=source.wireframeLinecap;this.wireframeLinejoin=source.wireframeLinejoin;this.flatShading=source.flatShading;this.fog=source.fog;return this;}}function convertArray(array,type,forceClone){if(!array||// let 'undefined' and 'null' pass
!forceClone&&array.constructor===type)return array;if(typeof type.BYTES_PER_ELEMENT==='number'){return new type(array);// create typed array
}return Array.prototype.slice.call(array);// create Array
}function isTypedArray(object){return ArrayBuffer.isView(object)&&!(object instanceof DataView);}// returns an array by which times and values can be sorted
function getKeyframeOrder(times){function compareTime(i,j){return times[i]-times[j];}const n=times.length;const result=new Array(n);for(let i=0;i!==n;++i)result[i]=i;result.sort(compareTime);return result;}// uses the array previously returned by 'getKeyframeOrder' to sort data
function sortedArray(values,stride,order){const nValues=values.length;const result=new values.constructor(nValues);for(let i=0,dstOffset=0;dstOffset!==nValues;++i){const srcOffset=order[i]*stride;for(let j=0;j!==stride;++j){result[dstOffset++]=values[srcOffset+j];}}return result;}// function for parsing AOS keyframe formats
function flattenJSON(jsonKeys,times,values,valuePropertyName){let i=1,key=jsonKeys[0];while(key!==undefined&&key[valuePropertyName]===undefined){key=jsonKeys[i++];}if(key===undefined)return;// no data
let value=key[valuePropertyName];if(value===undefined)return;// no data
if(Array.isArray(value)){do{value=key[valuePropertyName];if(value!==undefined){times.push(key.time);values.push.apply(values,value);// push all elements
}key=jsonKeys[i++];}while(key!==undefined);}else if(value.toArray!==undefined){// ...assume THREE.Math-ish
do{value=key[valuePropertyName];if(value!==undefined){times.push(key.time);value.toArray(values,values.length);}key=jsonKeys[i++];}while(key!==undefined);}else {// otherwise push as-is
do{value=key[valuePropertyName];if(value!==undefined){times.push(key.time);values.push(value);}key=jsonKeys[i++];}while(key!==undefined);}}/**
 * Abstract base class of interpolants over parametric samples.
 *
 * The parameter domain is one dimensional, typically the time or a path
 * along a curve defined by the data.
 *
 * The sample values can have any dimensionality and derived classes may
 * apply special interpretations to the data.
 *
 * This class provides the interval seek in a Template Method, deferring
 * the actual interpolation to derived classes.
 *
 * Time complexity is O(1) for linear access crossing at most two points
 * and O(log N) for random access, where N is the number of positions.
 *
 * References:
 *
 * 		http://www.oodesign.com/template-method-pattern.html
 *
 */class Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){this.parameterPositions=parameterPositions;this._cachedIndex=0;this.resultBuffer=resultBuffer!==undefined?resultBuffer:new sampleValues.constructor(sampleSize);this.sampleValues=sampleValues;this.valueSize=sampleSize;this.settings=null;this.DefaultSettings_={};}evaluate(t){const pp=this.parameterPositions;let i1=this._cachedIndex,t1=pp[i1],t0=pp[i1-1];validate_interval:{seek:{let right;linear_scan:{//- See http://jsperf.com/comparison-to-undefined/3
//- slower code:
//-
//- 				if ( t >= t1 || t1 === undefined ) {
forward_scan:if(!(t<t1)){for(let giveUpAt=i1+2;;){if(t1===undefined){if(t<t0)break forward_scan;// after end
i1=pp.length;this._cachedIndex=i1;return this.copySampleValue_(i1-1);}if(i1===giveUpAt)break;// this loop
t0=t1;t1=pp[++i1];if(t<t1){// we have arrived at the sought interval
break seek;}}// prepare binary search on the right side of the index
right=pp.length;break linear_scan;}//- slower code:
//-					if ( t < t0 || t0 === undefined ) {
if(!(t>=t0)){// looping?
const t1global=pp[1];if(t<t1global){i1=2;// + 1, using the scan for the details
t0=t1global;}// linear reverse scan
for(let giveUpAt=i1-2;;){if(t0===undefined){// before start
this._cachedIndex=0;return this.copySampleValue_(0);}if(i1===giveUpAt)break;// this loop
t1=t0;t0=pp[--i1-1];if(t>=t0){// we have arrived at the sought interval
break seek;}}// prepare binary search on the left side of the index
right=i1;i1=0;break linear_scan;}// the interval is valid
break validate_interval;}// linear scan
// binary search
while(i1<right){const mid=i1+right>>>1;if(t<pp[mid]){right=mid;}else {i1=mid+1;}}t1=pp[i1];t0=pp[i1-1];// check boundary cases, again
if(t0===undefined){this._cachedIndex=0;return this.copySampleValue_(0);}if(t1===undefined){i1=pp.length;this._cachedIndex=i1;return this.copySampleValue_(i1-1);}}// seek
this._cachedIndex=i1;this.intervalChanged_(i1,t0,t1);}// validate_interval
return this.interpolate_(i1,t0,t,t1);}getSettings_(){return this.settings||this.DefaultSettings_;}copySampleValue_(index){// copies a sample value to the result buffer
const result=this.resultBuffer,values=this.sampleValues,stride=this.valueSize,offset=index*stride;for(let i=0;i!==stride;++i){result[i]=values[offset+i];}return result;}// Template methods for derived classes:
interpolate_(/* i1, t0, t, t1 */){throw new Error('call to abstract method');// implementations shall return this.resultBuffer
}intervalChanged_(/* i1, t0, t1 */){// empty
}}/**
 * Fast and simple cubic spline interpolant.
 *
 * It was derived from a Hermitian construction setting the first derivative
 * at each sample position to the linear slope between neighboring positions
 * over their parameter interval.
 */class CubicInterpolant extends Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){super(parameterPositions,sampleValues,sampleSize,resultBuffer);this._weightPrev=-0;this._offsetPrev=-0;this._weightNext=-0;this._offsetNext=-0;this.DefaultSettings_={endingStart:ZeroCurvatureEnding,endingEnd:ZeroCurvatureEnding};}intervalChanged_(i1,t0,t1){const pp=this.parameterPositions;let iPrev=i1-2,iNext=i1+1,tPrev=pp[iPrev],tNext=pp[iNext];if(tPrev===undefined){switch(this.getSettings_().endingStart){case ZeroSlopeEnding:// f'(t0) = 0
iPrev=i1;tPrev=2*t0-t1;break;case WrapAroundEnding:// use the other end of the curve
iPrev=pp.length-2;tPrev=t0+pp[iPrev]-pp[iPrev+1];break;default:// ZeroCurvatureEnding
// f''(t0) = 0 a.k.a. Natural Spline
iPrev=i1;tPrev=t1;}}if(tNext===undefined){switch(this.getSettings_().endingEnd){case ZeroSlopeEnding:// f'(tN) = 0
iNext=i1;tNext=2*t1-t0;break;case WrapAroundEnding:// use the other end of the curve
iNext=1;tNext=t1+pp[1]-pp[0];break;default:// ZeroCurvatureEnding
// f''(tN) = 0, a.k.a. Natural Spline
iNext=i1-1;tNext=t0;}}const halfDt=(t1-t0)*0.5,stride=this.valueSize;this._weightPrev=halfDt/(t0-tPrev);this._weightNext=halfDt/(tNext-t1);this._offsetPrev=iPrev*stride;this._offsetNext=iNext*stride;}interpolate_(i1,t0,t,t1){const result=this.resultBuffer,values=this.sampleValues,stride=this.valueSize,o1=i1*stride,o0=o1-stride,oP=this._offsetPrev,oN=this._offsetNext,wP=this._weightPrev,wN=this._weightNext,p=(t-t0)/(t1-t0),pp=p*p,ppp=pp*p;// evaluate polynomials
const sP=-wP*ppp+2*wP*pp-wP*p;const s0=(1+wP)*ppp+(-1.5-2*wP)*pp+(-0.5+wP)*p+1;const s1=(-1-wN)*ppp+(1.5+wN)*pp+0.5*p;const sN=wN*ppp-wN*pp;// combine data linearly
for(let i=0;i!==stride;++i){result[i]=sP*values[oP+i]+s0*values[o0+i]+s1*values[o1+i]+sN*values[oN+i];}return result;}}class LinearInterpolant extends Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){super(parameterPositions,sampleValues,sampleSize,resultBuffer);}interpolate_(i1,t0,t,t1){const result=this.resultBuffer,values=this.sampleValues,stride=this.valueSize,offset1=i1*stride,offset0=offset1-stride,weight1=(t-t0)/(t1-t0),weight0=1-weight1;for(let i=0;i!==stride;++i){result[i]=values[offset0+i]*weight0+values[offset1+i]*weight1;}return result;}}/**
 *
 * Interpolant that evaluates to the sample value at the position preceding
 * the parameter.
 */class DiscreteInterpolant extends Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){super(parameterPositions,sampleValues,sampleSize,resultBuffer);}interpolate_(i1/*, t0, t, t1 */){return this.copySampleValue_(i1-1);}}class KeyframeTrack{constructor(name,times,values,interpolation){if(name===undefined)throw new Error('THREE.KeyframeTrack: track name is undefined');if(times===undefined||times.length===0)throw new Error('THREE.KeyframeTrack: no keyframes in track named '+name);this.name=name;this.times=convertArray(times,this.TimeBufferType);this.values=convertArray(values,this.ValueBufferType);this.setInterpolation(interpolation||this.DefaultInterpolation);}// Serialization (in static context, because of constructor invocation
// and automatic invocation of .toJSON):
static toJSON(track){const trackType=track.constructor;let json;// derived classes can define a static toJSON method
if(trackType.toJSON!==this.toJSON){json=trackType.toJSON(track);}else {// by default, we assume the data can be serialized as-is
json={'name':track.name,'times':convertArray(track.times,Array),'values':convertArray(track.values,Array)};const interpolation=track.getInterpolation();if(interpolation!==track.DefaultInterpolation){json.interpolation=interpolation;}}json.type=track.ValueTypeName;// mandatory
return json;}InterpolantFactoryMethodDiscrete(result){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),result);}InterpolantFactoryMethodLinear(result){return new LinearInterpolant(this.times,this.values,this.getValueSize(),result);}InterpolantFactoryMethodSmooth(result){return new CubicInterpolant(this.times,this.values,this.getValueSize(),result);}setInterpolation(interpolation){let factoryMethod;switch(interpolation){case InterpolateDiscrete:factoryMethod=this.InterpolantFactoryMethodDiscrete;break;case InterpolateLinear:factoryMethod=this.InterpolantFactoryMethodLinear;break;case InterpolateSmooth:factoryMethod=this.InterpolantFactoryMethodSmooth;break;}if(factoryMethod===undefined){const message='unsupported interpolation for '+this.ValueTypeName+' keyframe track named '+this.name;if(this.createInterpolant===undefined){// fall back to default, unless the default itself is messed up
if(interpolation!==this.DefaultInterpolation){this.setInterpolation(this.DefaultInterpolation);}else {throw new Error(message);// fatal, in this case
}}console.warn('THREE.KeyframeTrack:',message);return this;}this.createInterpolant=factoryMethod;return this;}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return InterpolateSmooth;}}getValueSize(){return this.values.length/this.times.length;}// move all keyframes either forwards or backwards in time
shift(timeOffset){if(timeOffset!==0.0){const times=this.times;for(let i=0,n=times.length;i!==n;++i){times[i]+=timeOffset;}}return this;}// scale all keyframe times by a factor (useful for frame <-> seconds conversions)
scale(timeScale){if(timeScale!==1.0){const times=this.times;for(let i=0,n=times.length;i!==n;++i){times[i]*=timeScale;}}return this;}// removes keyframes before and after animation without changing any values within the range [startTime, endTime].
// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values
trim(startTime,endTime){const times=this.times,nKeys=times.length;let from=0,to=nKeys-1;while(from!==nKeys&&times[from]<startTime){++from;}while(to!==-1&&times[to]>endTime){--to;}++to;// inclusive -> exclusive bound
if(from!==0||to!==nKeys){// empty tracks are forbidden, so keep at least one keyframe
if(from>=to){to=Math.max(to,1);from=to-1;}const stride=this.getValueSize();this.times=times.slice(from,to);this.values=this.values.slice(from*stride,to*stride);}return this;}// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable
validate(){let valid=true;const valueSize=this.getValueSize();if(valueSize-Math.floor(valueSize)!==0){console.error('THREE.KeyframeTrack: Invalid value size in track.',this);valid=false;}const times=this.times,values=this.values,nKeys=times.length;if(nKeys===0){console.error('THREE.KeyframeTrack: Track is empty.',this);valid=false;}let prevTime=null;for(let i=0;i!==nKeys;i++){const currTime=times[i];if(typeof currTime==='number'&&isNaN(currTime)){console.error('THREE.KeyframeTrack: Time is not a valid number.',this,i,currTime);valid=false;break;}if(prevTime!==null&&prevTime>currTime){console.error('THREE.KeyframeTrack: Out of order keys.',this,i,currTime,prevTime);valid=false;break;}prevTime=currTime;}if(values!==undefined){if(isTypedArray(values)){for(let i=0,n=values.length;i!==n;++i){const value=values[i];if(isNaN(value)){console.error('THREE.KeyframeTrack: Value is not a valid number.',this,i,value);valid=false;break;}}}}return valid;}// removes equivalent sequential keys as common in morph target sequences
// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)
optimize(){// times or values may be shared with other tracks, so overwriting is unsafe
const times=this.times.slice(),values=this.values.slice(),stride=this.getValueSize(),smoothInterpolation=this.getInterpolation()===InterpolateSmooth,lastIndex=times.length-1;let writeIndex=1;for(let i=1;i<lastIndex;++i){let keep=false;const time=times[i];const timeNext=times[i+1];// remove adjacent keyframes scheduled at the same time
if(time!==timeNext&&(i!==1||time!==times[0])){if(!smoothInterpolation){// remove unnecessary keyframes same as their neighbors
const offset=i*stride,offsetP=offset-stride,offsetN=offset+stride;for(let j=0;j!==stride;++j){const value=values[offset+j];if(value!==values[offsetP+j]||value!==values[offsetN+j]){keep=true;break;}}}else {keep=true;}}// in-place compaction
if(keep){if(i!==writeIndex){times[writeIndex]=times[i];const readOffset=i*stride,writeOffset=writeIndex*stride;for(let j=0;j!==stride;++j){values[writeOffset+j]=values[readOffset+j];}}++writeIndex;}}// flush last keyframe (compaction looks ahead)
if(lastIndex>0){times[writeIndex]=times[lastIndex];for(let readOffset=lastIndex*stride,writeOffset=writeIndex*stride,j=0;j!==stride;++j){values[writeOffset+j]=values[readOffset+j];}++writeIndex;}if(writeIndex!==times.length){this.times=times.slice(0,writeIndex);this.values=values.slice(0,writeIndex*stride);}else {this.times=times;this.values=values;}return this;}clone(){const times=this.times.slice();const values=this.values.slice();const TypedKeyframeTrack=this.constructor;const track=new TypedKeyframeTrack(this.name,times,values);// Interpolant argument to constructor is not saved, so copy the factory method directly.
track.createInterpolant=this.createInterpolant;return track;}}KeyframeTrack.prototype.TimeBufferType=Float32Array;KeyframeTrack.prototype.ValueBufferType=Float32Array;KeyframeTrack.prototype.DefaultInterpolation=InterpolateLinear;/**
 * A Track of Boolean keyframe values.
 */class BooleanKeyframeTrack extends KeyframeTrack{// No interpolation parameter because only InterpolateDiscrete is valid.
constructor(name,times,values){super(name,times,values);}}BooleanKeyframeTrack.prototype.ValueTypeName='bool';BooleanKeyframeTrack.prototype.ValueBufferType=Array;BooleanKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=undefined;BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=undefined;/**
 * A Track of keyframe values that represent color.
 */class ColorKeyframeTrack extends KeyframeTrack{}ColorKeyframeTrack.prototype.ValueTypeName='color';/**
 * A Track of numeric keyframe values.
 */class NumberKeyframeTrack extends KeyframeTrack{}NumberKeyframeTrack.prototype.ValueTypeName='number';/**
 * Spherical linear unit quaternion interpolant.
 */class QuaternionLinearInterpolant extends Interpolant{constructor(parameterPositions,sampleValues,sampleSize,resultBuffer){super(parameterPositions,sampleValues,sampleSize,resultBuffer);}interpolate_(i1,t0,t,t1){const result=this.resultBuffer,values=this.sampleValues,stride=this.valueSize,alpha=(t-t0)/(t1-t0);let offset=i1*stride;for(let end=offset+stride;offset!==end;offset+=4){Quaternion$1.slerpFlat(result,0,values,offset-stride,values,offset,alpha);}return result;}}/**
 * A Track of quaternion keyframe values.
 */class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(result){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),result);}}QuaternionKeyframeTrack.prototype.ValueTypeName='quaternion';// ValueBufferType is inherited
// DefaultInterpolation is inherited;
QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=undefined;/**
 * A Track that interpolates Strings
 */class StringKeyframeTrack extends KeyframeTrack{// No interpolation parameter because only InterpolateDiscrete is valid.
constructor(name,times,values){super(name,times,values);}}StringKeyframeTrack.prototype.ValueTypeName='string';StringKeyframeTrack.prototype.ValueBufferType=Array;StringKeyframeTrack.prototype.DefaultInterpolation=InterpolateDiscrete;StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=undefined;StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=undefined;/**
 * A Track of vectored keyframe values.
 */class VectorKeyframeTrack extends KeyframeTrack{}VectorKeyframeTrack.prototype.ValueTypeName='vector';class AnimationClip{constructor(name='',duration=-1,tracks=[],blendMode=NormalAnimationBlendMode){this.name=name;this.tracks=tracks;this.duration=duration;this.blendMode=blendMode;this.uuid=generateUUID$1();// this means it should figure out its duration by scanning the tracks
if(this.duration<0){this.resetDuration();}}static parse(json){const tracks=[],jsonTracks=json.tracks,frameTime=1.0/(json.fps||1.0);for(let i=0,n=jsonTracks.length;i!==n;++i){tracks.push(parseKeyframeTrack(jsonTracks[i]).scale(frameTime));}const clip=new this(json.name,json.duration,tracks,json.blendMode);clip.uuid=json.uuid;return clip;}static toJSON(clip){const tracks=[],clipTracks=clip.tracks;const json={'name':clip.name,'duration':clip.duration,'tracks':tracks,'uuid':clip.uuid,'blendMode':clip.blendMode};for(let i=0,n=clipTracks.length;i!==n;++i){tracks.push(KeyframeTrack.toJSON(clipTracks[i]));}return json;}static CreateFromMorphTargetSequence(name,morphTargetSequence,fps,noLoop){const numMorphTargets=morphTargetSequence.length;const tracks=[];for(let i=0;i<numMorphTargets;i++){let times=[];let values=[];times.push((i+numMorphTargets-1)%numMorphTargets,i,(i+1)%numMorphTargets);values.push(0,1,0);const order=getKeyframeOrder(times);times=sortedArray(times,1,order);values=sortedArray(values,1,order);// if there is a key at the first frame, duplicate it as the
// last frame as well for perfect loop.
if(!noLoop&&times[0]===0){times.push(numMorphTargets);values.push(values[0]);}tracks.push(new NumberKeyframeTrack('.morphTargetInfluences['+morphTargetSequence[i].name+']',times,values).scale(1.0/fps));}return new this(name,-1,tracks);}static findByName(objectOrClipArray,name){let clipArray=objectOrClipArray;if(!Array.isArray(objectOrClipArray)){const o=objectOrClipArray;clipArray=o.geometry&&o.geometry.animations||o.animations;}for(let i=0;i<clipArray.length;i++){if(clipArray[i].name===name){return clipArray[i];}}return null;}static CreateClipsFromMorphTargetSequences(morphTargets,fps,noLoop){const animationToMorphTargets={};// tested with https://regex101.com/ on trick sequences
// such flamingo_flyA_003, flamingo_run1_003, crdeath0059
const pattern=/^([\w-]*?)([\d]+)$/;// sort morph target names into animation groups based
// patterns like Walk_001, Walk_002, Run_001, Run_002
for(let i=0,il=morphTargets.length;i<il;i++){const morphTarget=morphTargets[i];const parts=morphTarget.name.match(pattern);if(parts&&parts.length>1){const name=parts[1];let animationMorphTargets=animationToMorphTargets[name];if(!animationMorphTargets){animationToMorphTargets[name]=animationMorphTargets=[];}animationMorphTargets.push(morphTarget);}}const clips=[];for(const name in animationToMorphTargets){clips.push(this.CreateFromMorphTargetSequence(name,animationToMorphTargets[name],fps,noLoop));}return clips;}// parse the animation.hierarchy format
static parseAnimation(animation,bones){if(!animation){console.error('THREE.AnimationClip: No animation in JSONLoader data.');return null;}const addNonemptyTrack=function(trackType,trackName,animationKeys,propertyName,destTracks){// only return track if there are actually keys.
if(animationKeys.length!==0){const times=[];const values=[];flattenJSON(animationKeys,times,values,propertyName);// empty keys are filtered out, so check again
if(times.length!==0){destTracks.push(new trackType(trackName,times,values));}}};const tracks=[];const clipName=animation.name||'default';const fps=animation.fps||30;const blendMode=animation.blendMode;// automatic length determination in AnimationClip.
let duration=animation.length||-1;const hierarchyTracks=animation.hierarchy||[];for(let h=0;h<hierarchyTracks.length;h++){const animationKeys=hierarchyTracks[h].keys;// skip empty tracks
if(!animationKeys||animationKeys.length===0)continue;// process morph targets
if(animationKeys[0].morphTargets){// figure out all morph targets used in this track
const morphTargetNames={};let k;for(k=0;k<animationKeys.length;k++){if(animationKeys[k].morphTargets){for(let m=0;m<animationKeys[k].morphTargets.length;m++){morphTargetNames[animationKeys[k].morphTargets[m]]=-1;}}}// create a track for each morph target with all zero
// morphTargetInfluences except for the keys in which
// the morphTarget is named.
for(const morphTargetName in morphTargetNames){const times=[];const values=[];for(let m=0;m!==animationKeys[k].morphTargets.length;++m){const animationKey=animationKeys[k];times.push(animationKey.time);values.push(animationKey.morphTarget===morphTargetName?1:0);}tracks.push(new NumberKeyframeTrack('.morphTargetInfluence['+morphTargetName+']',times,values));}duration=morphTargetNames.length*fps;}else {// ...assume skeletal animation
const boneName='.bones['+bones[h].name+']';addNonemptyTrack(VectorKeyframeTrack,boneName+'.position',animationKeys,'pos',tracks);addNonemptyTrack(QuaternionKeyframeTrack,boneName+'.quaternion',animationKeys,'rot',tracks);addNonemptyTrack(VectorKeyframeTrack,boneName+'.scale',animationKeys,'scl',tracks);}}if(tracks.length===0){return null;}const clip=new this(clipName,duration,tracks,blendMode);return clip;}resetDuration(){const tracks=this.tracks;let duration=0;for(let i=0,n=tracks.length;i!==n;++i){const track=this.tracks[i];duration=Math.max(duration,track.times[track.times.length-1]);}this.duration=duration;return this;}trim(){for(let i=0;i<this.tracks.length;i++){this.tracks[i].trim(0,this.duration);}return this;}validate(){let valid=true;for(let i=0;i<this.tracks.length;i++){valid=valid&&this.tracks[i].validate();}return valid;}optimize(){for(let i=0;i<this.tracks.length;i++){this.tracks[i].optimize();}return this;}clone(){const tracks=[];for(let i=0;i<this.tracks.length;i++){tracks.push(this.tracks[i].clone());}return new this.constructor(this.name,this.duration,tracks,this.blendMode);}toJSON(){return this.constructor.toJSON(this);}}function getTrackTypeForValueTypeName(typeName){switch(typeName.toLowerCase()){case'scalar':case'double':case'float':case'number':case'integer':return NumberKeyframeTrack;case'vector':case'vector2':case'vector3':case'vector4':return VectorKeyframeTrack;case'color':return ColorKeyframeTrack;case'quaternion':return QuaternionKeyframeTrack;case'bool':case'boolean':return BooleanKeyframeTrack;case'string':return StringKeyframeTrack;}throw new Error('THREE.KeyframeTrack: Unsupported typeName: '+typeName);}function parseKeyframeTrack(json){if(json.type===undefined){throw new Error('THREE.KeyframeTrack: track type undefined, can not parse');}const trackType=getTrackTypeForValueTypeName(json.type);if(json.times===undefined){const times=[],values=[];flattenJSON(json.keys,times,values,'value');json.times=times;json.values=values;}// derived classes can define a static parse method
if(trackType.parse!==undefined){return trackType.parse(json);}else {// by default, we assume a constructor compatible with the base
return new trackType(json.name,json.times,json.values,json.interpolation);}}const Cache={enabled:false,files:{},add:function(key,file){if(this.enabled===false)return;// console.log( 'THREE.Cache', 'Adding key:', key );
this.files[key]=file;},get:function(key){if(this.enabled===false)return;// console.log( 'THREE.Cache', 'Checking key:', key );
return this.files[key];},remove:function(key){delete this.files[key];},clear:function(){this.files={};}};class LoadingManager{constructor(onLoad,onProgress,onError){const scope=this;let isLoading=false;let itemsLoaded=0;let itemsTotal=0;let urlModifier=undefined;const handlers=[];// Refer to #5689 for the reason why we don't set .onStart
// in the constructor
this.onStart=undefined;this.onLoad=onLoad;this.onProgress=onProgress;this.onError=onError;this.itemStart=function(url){itemsTotal++;if(isLoading===false){if(scope.onStart!==undefined){scope.onStart(url,itemsLoaded,itemsTotal);}}isLoading=true;};this.itemEnd=function(url){itemsLoaded++;if(scope.onProgress!==undefined){scope.onProgress(url,itemsLoaded,itemsTotal);}if(itemsLoaded===itemsTotal){isLoading=false;if(scope.onLoad!==undefined){scope.onLoad();}}};this.itemError=function(url){if(scope.onError!==undefined){scope.onError(url);}};this.resolveURL=function(url){if(urlModifier){return urlModifier(url);}return url;};this.setURLModifier=function(transform){urlModifier=transform;return this;};this.addHandler=function(regex,loader){handlers.push(regex,loader);return this;};this.removeHandler=function(regex){const index=handlers.indexOf(regex);if(index!==-1){handlers.splice(index,2);}return this;};this.getHandler=function(file){for(let i=0,l=handlers.length;i<l;i+=2){const regex=handlers[i];const loader=handlers[i+1];if(regex.global)regex.lastIndex=0;// see #17920
if(regex.test(file)){return loader;}}return null;};}}const DefaultLoadingManager=/*@__PURE__*/new LoadingManager();class Loader{constructor(manager){this.manager=manager!==undefined?manager:DefaultLoadingManager;this.crossOrigin='anonymous';this.withCredentials=false;this.path='';this.resourcePath='';this.requestHeader={};}load(/* url, onLoad, onProgress, onError */){}loadAsync(url,onProgress){const scope=this;return new Promise(function(resolve,reject){scope.load(url,resolve,onProgress,reject);});}parse(/* data */){}setCrossOrigin(crossOrigin){this.crossOrigin=crossOrigin;return this;}setWithCredentials(value){this.withCredentials=value;return this;}setPath(path){this.path=path;return this;}setResourcePath(resourcePath){this.resourcePath=resourcePath;return this;}setRequestHeader(requestHeader){this.requestHeader=requestHeader;return this;}}Loader.DEFAULT_MATERIAL_NAME='__DEFAULT';const loading={};class HttpError extends Error{constructor(message,response){super(message);this.response=response;}}class FileLoader extends Loader{constructor(manager){super(manager);}load(url,onLoad,onProgress,onError){if(url===undefined)url='';if(this.path!==undefined)url=this.path+url;url=this.manager.resolveURL(url);const cached=Cache.get(url);if(cached!==undefined){this.manager.itemStart(url);setTimeout(()=>{if(onLoad)onLoad(cached);this.manager.itemEnd(url);},0);return cached;}// Check if request is duplicate
if(loading[url]!==undefined){loading[url].push({onLoad:onLoad,onProgress:onProgress,onError:onError});return;}// Initialise array for duplicate requests
loading[url]=[];loading[url].push({onLoad:onLoad,onProgress:onProgress,onError:onError});// create request
const req=new Request(url,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?'include':'same-origin'// An abort controller could be added within a future PR
});// record states ( avoid data race )
const mimeType=this.mimeType;const responseType=this.responseType;// start the fetch
fetch(req).then(response=>{if(response.status===200||response.status===0){// Some browsers return HTTP Status 0 when using non-http protocol
// e.g. 'file://' or 'data://'. Handle as success.
if(response.status===0){console.warn('THREE.FileLoader: HTTP Status 0 received.');}// Workaround: Checking if response.body === undefined for Alipay browser #23548
if(typeof ReadableStream==='undefined'||response.body===undefined||response.body.getReader===undefined){return response;}const callbacks=loading[url];const reader=response.body.getReader();// Nginx needs X-File-Size check
// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content
const contentLength=response.headers.get('X-File-Size')||response.headers.get('Content-Length');const total=contentLength?parseInt(contentLength):0;const lengthComputable=total!==0;let loaded=0;// periodically read data into the new stream tracking while download progress
const stream=new ReadableStream({start(controller){readData();function readData(){reader.read().then(({done,value})=>{if(done){controller.close();}else {loaded+=value.byteLength;const event=new ProgressEvent('progress',{lengthComputable,loaded,total});for(let i=0,il=callbacks.length;i<il;i++){const callback=callbacks[i];if(callback.onProgress)callback.onProgress(event);}controller.enqueue(value);readData();}},e=>{controller.error(e);});}}});return new Response(stream);}else {throw new HttpError(`fetch for "${response.url}" responded with ${response.status}: ${response.statusText}`,response);}}).then(response=>{switch(responseType){case'arraybuffer':return response.arrayBuffer();case'blob':return response.blob();case'document':return response.text().then(text=>{const parser=new DOMParser();return parser.parseFromString(text,mimeType);});case'json':return response.json();default:if(mimeType===undefined){return response.text();}else {// sniff encoding
const re=/charset="?([^;"\s]*)"?/i;const exec=re.exec(mimeType);const label=exec&&exec[1]?exec[1].toLowerCase():undefined;const decoder=new TextDecoder(label);return response.arrayBuffer().then(ab=>decoder.decode(ab));}}}).then(data=>{// Add to cache only on HTTP success, so that we do not cache
// error response bodies as proper responses to requests.
Cache.add(url,data);const callbacks=loading[url];delete loading[url];for(let i=0,il=callbacks.length;i<il;i++){const callback=callbacks[i];if(callback.onLoad)callback.onLoad(data);}}).catch(err=>{// Abort errors and other errors are handled the same
const callbacks=loading[url];if(callbacks===undefined){// When onLoad was called and url was deleted in `loading`
this.manager.itemError(url);throw err;}delete loading[url];for(let i=0,il=callbacks.length;i<il;i++){const callback=callbacks[i];if(callback.onError)callback.onError(err);}this.manager.itemError(url);}).finally(()=>{this.manager.itemEnd(url);});this.manager.itemStart(url);}setResponseType(value){this.responseType=value;return this;}setMimeType(value){this.mimeType=value;return this;}}class ImageLoader extends Loader{constructor(manager){super(manager);}load(url,onLoad,onProgress,onError){if(this.path!==undefined)url=this.path+url;url=this.manager.resolveURL(url);const scope=this;const cached=Cache.get(url);if(cached!==undefined){scope.manager.itemStart(url);setTimeout(function(){if(onLoad)onLoad(cached);scope.manager.itemEnd(url);},0);return cached;}const image=createElementNS$1('img');function onImageLoad(){removeEventListeners();Cache.add(url,this);if(onLoad)onLoad(this);scope.manager.itemEnd(url);}function onImageError(event){removeEventListeners();if(onError)onError(event);scope.manager.itemError(url);scope.manager.itemEnd(url);}function removeEventListeners(){image.removeEventListener('load',onImageLoad,false);image.removeEventListener('error',onImageError,false);}image.addEventListener('load',onImageLoad,false);image.addEventListener('error',onImageError,false);if(url.slice(0,5)!=='data:'){if(this.crossOrigin!==undefined)image.crossOrigin=this.crossOrigin;}scope.manager.itemStart(url);image.src=url;return image;}}/**
 * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)
 *
 * Sub classes have to implement the parse() method which will be used in load().
 */class DataTextureLoader extends Loader{constructor(manager){super(manager);}load(url,onLoad,onProgress,onError){const scope=this;const texture=new DataTexture$1();const loader=new FileLoader(this.manager);loader.setResponseType('arraybuffer');loader.setRequestHeader(this.requestHeader);loader.setPath(this.path);loader.setWithCredentials(scope.withCredentials);loader.load(url,function(buffer){let texData;try{texData=scope.parse(buffer);}catch(error){if(onError!==undefined){onError(error);}else {console.error(error);return;}}if(texData.image!==undefined){texture.image=texData.image;}else if(texData.data!==undefined){texture.image.width=texData.width;texture.image.height=texData.height;texture.image.data=texData.data;}texture.wrapS=texData.wrapS!==undefined?texData.wrapS:ClampToEdgeWrapping$1;texture.wrapT=texData.wrapT!==undefined?texData.wrapT:ClampToEdgeWrapping$1;texture.magFilter=texData.magFilter!==undefined?texData.magFilter:LinearFilter$1;texture.minFilter=texData.minFilter!==undefined?texData.minFilter:LinearFilter$1;texture.anisotropy=texData.anisotropy!==undefined?texData.anisotropy:1;if(texData.colorSpace!==undefined){texture.colorSpace=texData.colorSpace;}if(texData.flipY!==undefined){texture.flipY=texData.flipY;}if(texData.format!==undefined){texture.format=texData.format;}if(texData.type!==undefined){texture.type=texData.type;}if(texData.mipmaps!==undefined){texture.mipmaps=texData.mipmaps;texture.minFilter=LinearMipmapLinearFilter$1;// presumably...
}if(texData.mipmapCount===1){texture.minFilter=LinearFilter$1;}if(texData.generateMipmaps!==undefined){texture.generateMipmaps=texData.generateMipmaps;}texture.needsUpdate=true;if(onLoad)onLoad(texture,texData);},onProgress,onError);return texture;}}class TextureLoader extends Loader{constructor(manager){super(manager);}load(url,onLoad,onProgress,onError){const texture=new Texture$1();const loader=new ImageLoader(this.manager);loader.setCrossOrigin(this.crossOrigin);loader.setPath(this.path);loader.load(url,function(image){texture.image=image;texture.needsUpdate=true;if(onLoad!==undefined){onLoad(texture);}},onProgress,onError);return texture;}}class Light extends Object3D$1{constructor(color,intensity=1){super();this.isLight=true;this.type='Light';this.color=new Color$1(color);this.intensity=intensity;}dispose(){// Empty here in base class; some subclasses override.
}copy(source,recursive){super.copy(source,recursive);this.color.copy(source.color);this.intensity=source.intensity;return this;}toJSON(meta){const data=super.toJSON(meta);data.object.color=this.color.getHex();data.object.intensity=this.intensity;if(this.groundColor!==undefined)data.object.groundColor=this.groundColor.getHex();if(this.distance!==undefined)data.object.distance=this.distance;if(this.angle!==undefined)data.object.angle=this.angle;if(this.decay!==undefined)data.object.decay=this.decay;if(this.penumbra!==undefined)data.object.penumbra=this.penumbra;if(this.shadow!==undefined)data.object.shadow=this.shadow.toJSON();if(this.target!==undefined)data.object.target=this.target.uuid;return data;}}const _projScreenMatrix$1=/*@__PURE__*/new Matrix4$1();const _lightPositionWorld$1=/*@__PURE__*/new Vector3$1();const _lookTarget$1=/*@__PURE__*/new Vector3$1();class LightShadow{constructor(camera){this.camera=camera;this.intensity=1;this.bias=0;this.normalBias=0;this.radius=1;this.blurSamples=8;this.mapSize=new Vector2$1(512,512);this.map=null;this.mapPass=null;this.matrix=new Matrix4$1();this.autoUpdate=true;this.needsUpdate=false;this._frustum=new Frustum();this._frameExtents=new Vector2$1(1,1);this._viewportCount=1;this._viewports=[new Vector4$1(0,0,1,1)];}getViewportCount(){return this._viewportCount;}getFrustum(){return this._frustum;}updateMatrices(light){const shadowCamera=this.camera;const shadowMatrix=this.matrix;_lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld);shadowCamera.position.copy(_lightPositionWorld$1);_lookTarget$1.setFromMatrixPosition(light.target.matrixWorld);shadowCamera.lookAt(_lookTarget$1);shadowCamera.updateMatrixWorld();_projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix,shadowCamera.matrixWorldInverse);this._frustum.setFromProjectionMatrix(_projScreenMatrix$1);shadowMatrix.set(0.5,0.0,0.0,0.5,0.0,0.5,0.0,0.5,0.0,0.0,0.5,0.5,0.0,0.0,0.0,1.0);shadowMatrix.multiply(_projScreenMatrix$1);}getViewport(viewportIndex){return this._viewports[viewportIndex];}getFrameExtents(){return this._frameExtents;}dispose(){if(this.map){this.map.dispose();}if(this.mapPass){this.mapPass.dispose();}}copy(source){this.camera=source.camera.clone();this.intensity=source.intensity;this.bias=source.bias;this.radius=source.radius;this.mapSize.copy(source.mapSize);return this;}clone(){return new this.constructor().copy(this);}toJSON(){const object={};if(this.intensity!==1)object.intensity=this.intensity;if(this.bias!==0)object.bias=this.bias;if(this.normalBias!==0)object.normalBias=this.normalBias;if(this.radius!==1)object.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)object.mapSize=this.mapSize.toArray();object.camera=this.camera.toJSON(false).object;delete object.camera.matrix;return object;}}class SpotLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera$1(50,1,0.5,500));this.isSpotLightShadow=true;this.focus=1;}updateMatrices(light){const camera=this.camera;const fov=RAD2DEG$1*2*light.angle*this.focus;const aspect=this.mapSize.width/this.mapSize.height;const far=light.distance||camera.far;if(fov!==camera.fov||aspect!==camera.aspect||far!==camera.far){camera.fov=fov;camera.aspect=aspect;camera.far=far;camera.updateProjectionMatrix();}super.updateMatrices(light);}copy(source){super.copy(source);this.focus=source.focus;return this;}}class SpotLight extends Light{constructor(color,intensity,distance=0,angle=Math.PI/3,penumbra=0,decay=2){super(color,intensity);this.isSpotLight=true;this.type='SpotLight';this.position.copy(Object3D$1.DEFAULT_UP);this.updateMatrix();this.target=new Object3D$1();this.distance=distance;this.angle=angle;this.penumbra=penumbra;this.decay=decay;this.map=null;this.shadow=new SpotLightShadow();}get power(){// compute the light's luminous power (in lumens) from its intensity (in candela)
// by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)
return this.intensity*Math.PI;}set power(power){// set the light's intensity (in candela) from the desired luminous power (in lumens)
this.intensity=power/Math.PI;}dispose(){this.shadow.dispose();}copy(source,recursive){super.copy(source,recursive);this.distance=source.distance;this.angle=source.angle;this.penumbra=source.penumbra;this.decay=source.decay;this.target=source.target.clone();this.shadow=source.shadow.clone();return this;}}const _projScreenMatrix=/*@__PURE__*/new Matrix4$1();const _lightPositionWorld=/*@__PURE__*/new Vector3$1();const _lookTarget=/*@__PURE__*/new Vector3$1();class PointLightShadow extends LightShadow{constructor(){super(new PerspectiveCamera$1(90,1,0.5,500));this.isPointLightShadow=true;this._frameExtents=new Vector2$1(4,2);this._viewportCount=6;this._viewports=[// These viewports map a cube-map onto a 2D texture with the
// following orientation:
//
//  xzXZ
//   y Y
//
// X - Positive x direction
// x - Negative x direction
// Y - Positive y direction
// y - Negative y direction
// Z - Positive z direction
// z - Negative z direction
// positive X
new Vector4$1(2,1,1,1),// negative X
new Vector4$1(0,1,1,1),// positive Z
new Vector4$1(3,1,1,1),// negative Z
new Vector4$1(1,1,1,1),// positive Y
new Vector4$1(3,0,1,1),// negative Y
new Vector4$1(1,0,1,1)];this._cubeDirections=[new Vector3$1(1,0,0),new Vector3$1(-1,0,0),new Vector3$1(0,0,1),new Vector3$1(0,0,-1),new Vector3$1(0,1,0),new Vector3$1(0,-1,0)];this._cubeUps=[new Vector3$1(0,1,0),new Vector3$1(0,1,0),new Vector3$1(0,1,0),new Vector3$1(0,1,0),new Vector3$1(0,0,1),new Vector3$1(0,0,-1)];}updateMatrices(light,viewportIndex=0){const camera=this.camera;const shadowMatrix=this.matrix;const far=light.distance||camera.far;if(far!==camera.far){camera.far=far;camera.updateProjectionMatrix();}_lightPositionWorld.setFromMatrixPosition(light.matrixWorld);camera.position.copy(_lightPositionWorld);_lookTarget.copy(camera.position);_lookTarget.add(this._cubeDirections[viewportIndex]);camera.up.copy(this._cubeUps[viewportIndex]);camera.lookAt(_lookTarget);camera.updateMatrixWorld();shadowMatrix.makeTranslation(-_lightPositionWorld.x,-_lightPositionWorld.y,-_lightPositionWorld.z);_projScreenMatrix.multiplyMatrices(camera.projectionMatrix,camera.matrixWorldInverse);this._frustum.setFromProjectionMatrix(_projScreenMatrix);}}class PointLight extends Light{constructor(color,intensity,distance=0,decay=2){super(color,intensity);this.isPointLight=true;this.type='PointLight';this.distance=distance;this.decay=decay;this.shadow=new PointLightShadow();}get power(){// compute the light's luminous power (in lumens) from its intensity (in candela)
// for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)
return this.intensity*4*Math.PI;}set power(power){// set the light's intensity (in candela) from the desired luminous power (in lumens)
this.intensity=power/(4*Math.PI);}dispose(){this.shadow.dispose();}copy(source,recursive){super.copy(source,recursive);this.distance=source.distance;this.decay=source.decay;this.shadow=source.shadow.clone();return this;}}class DirectionalLightShadow extends LightShadow{constructor(){super(new OrthographicCamera$1(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=true;}}class DirectionalLight extends Light{constructor(color,intensity){super(color,intensity);this.isDirectionalLight=true;this.type='DirectionalLight';this.position.copy(Object3D$1.DEFAULT_UP);this.updateMatrix();this.target=new Object3D$1();this.shadow=new DirectionalLightShadow();}dispose(){this.shadow.dispose();}copy(source){super.copy(source);this.target=source.target.clone();this.shadow=source.shadow.clone();return this;}}class AmbientLight extends Light{constructor(color,intensity){super(color,intensity);this.isAmbientLight=true;this.type='AmbientLight';}}class LoaderUtils{static decodeText(array){// @deprecated, r165
console.warn('THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead.');if(typeof TextDecoder!=='undefined'){return new TextDecoder().decode(array);}// Avoid the String.fromCharCode.apply(null, array) shortcut, which
// throws a "maximum call stack size exceeded" error for large arrays.
let s='';for(let i=0,il=array.length;i<il;i++){// Implicitly assumes little-endian.
s+=String.fromCharCode(array[i]);}try{// merges multi-byte utf-8 characters.
return decodeURIComponent(escape(s));}catch(e){// see #16358
return s;}}static extractUrlBase(url){const index=url.lastIndexOf('/');if(index===-1)return './';return url.slice(0,index+1);}static resolveURL(url,path){// Invalid URL
if(typeof url!=='string'||url==='')return '';// Host Relative URL
if(/^https?:\/\//i.test(path)&&/^\//.test(url)){path=path.replace(/(^https?:\/\/[^\/]+).*/i,'$1');}// Absolute URL http://,https://,//
if(/^(https?:)?\/\//i.test(url))return url;// Data URI
if(/^data:.*,.*$/i.test(url))return url;// Blob URL
if(/^blob:.*$/i.test(url))return url;// Relative URL
return path+url;}}class ImageBitmapLoader extends Loader{constructor(manager){super(manager);this.isImageBitmapLoader=true;if(typeof createImageBitmap==='undefined'){console.warn('THREE.ImageBitmapLoader: createImageBitmap() not supported.');}if(typeof fetch==='undefined'){console.warn('THREE.ImageBitmapLoader: fetch() not supported.');}this.options={premultiplyAlpha:'none'};}setOptions(options){this.options=options;return this;}load(url,onLoad,onProgress,onError){if(url===undefined)url='';if(this.path!==undefined)url=this.path+url;url=this.manager.resolveURL(url);const scope=this;const cached=Cache.get(url);if(cached!==undefined){scope.manager.itemStart(url);// If cached is a promise, wait for it to resolve
if(cached.then){cached.then(imageBitmap=>{if(onLoad)onLoad(imageBitmap);scope.manager.itemEnd(url);}).catch(e=>{if(onError)onError(e);});return;}// If cached is not a promise (i.e., it's already an imageBitmap)
setTimeout(function(){if(onLoad)onLoad(cached);scope.manager.itemEnd(url);},0);return cached;}const fetchOptions={};fetchOptions.credentials=this.crossOrigin==='anonymous'?'same-origin':'include';fetchOptions.headers=this.requestHeader;const promise=fetch(url,fetchOptions).then(function(res){return res.blob();}).then(function(blob){return createImageBitmap(blob,Object.assign(scope.options,{colorSpaceConversion:'none'}));}).then(function(imageBitmap){Cache.add(url,imageBitmap);if(onLoad)onLoad(imageBitmap);scope.manager.itemEnd(url);return imageBitmap;}).catch(function(e){if(onError)onError(e);Cache.remove(url);scope.manager.itemError(url);scope.manager.itemEnd(url);});Cache.add(url,promise);scope.manager.itemStart(url);}}const _RESERVED_CHARS_RE='\\[\\]\\.:\\/';const _reservedRe=new RegExp('['+_RESERVED_CHARS_RE+']','g');// Attempts to allow node names from any language. ES5's `\w` regexp matches
// only latin characters, and the unicode \p{L} is not yet supported. So
// instead, we exclude reserved characters and match everything else.
const _wordChar='[^'+_RESERVED_CHARS_RE+']';const _wordCharOrDot='[^'+_RESERVED_CHARS_RE.replace('\\.','')+']';// Parent directories, delimited by '/' or ':'. Currently unused, but must
// be matched to parse the rest of the track name.
const _directoryRe=/*@__PURE__*//((?:WC+[\/:])*)/.source.replace('WC',_wordChar);// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
const _nodeRe=/*@__PURE__*//(WCOD+)?/.source.replace('WCOD',_wordCharOrDot);// Object on target node, and accessor. May not contain reserved
// characters. Accessor may contain any character except closing bracket.
const _objectRe=/*@__PURE__*//(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC',_wordChar);// Property and accessor. May not contain reserved characters. Accessor may
// contain any non-bracket characters.
const _propertyRe=/*@__PURE__*//\.(WC+)(?:\[(.+)\])?/.source.replace('WC',_wordChar);const _trackRe=new RegExp(''+'^'+_directoryRe+_nodeRe+_objectRe+_propertyRe+'$');const _supportedObjectNames=['material','materials','bones','map'];class Composite{constructor(targetGroup,path,optionalParsedPath){const parsedPath=optionalParsedPath||PropertyBinding.parseTrackName(path);this._targetGroup=targetGroup;this._bindings=targetGroup.subscribe_(path,parsedPath);}getValue(array,offset){this.bind();// bind all binding
const firstValidIndex=this._targetGroup.nCachedObjects_,binding=this._bindings[firstValidIndex];// and only call .getValue on the first
if(binding!==undefined)binding.getValue(array,offset);}setValue(array,offset){const bindings=this._bindings;for(let i=this._targetGroup.nCachedObjects_,n=bindings.length;i!==n;++i){bindings[i].setValue(array,offset);}}bind(){const bindings=this._bindings;for(let i=this._targetGroup.nCachedObjects_,n=bindings.length;i!==n;++i){bindings[i].bind();}}unbind(){const bindings=this._bindings;for(let i=this._targetGroup.nCachedObjects_,n=bindings.length;i!==n;++i){bindings[i].unbind();}}}// Note: This class uses a State pattern on a per-method basis:
// 'bind' sets 'this.getValue' / 'setValue' and shadows the
// prototype version of these methods with one that represents
// the bound state. When the property is not found, the methods
// become no-ops.
class PropertyBinding{constructor(rootNode,path,parsedPath){this.path=path;this.parsedPath=parsedPath||PropertyBinding.parseTrackName(path);this.node=PropertyBinding.findNode(rootNode,this.parsedPath.nodeName);this.rootNode=rootNode;// initial state of these methods that calls 'bind'
this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound;}static create(root,path,parsedPath){if(!(root&&root.isAnimationObjectGroup)){return new PropertyBinding(root,path,parsedPath);}else {return new PropertyBinding.Composite(root,path,parsedPath);}}/**
	 * Replaces spaces with underscores and removes unsupported characters from
	 * node names, to ensure compatibility with parseTrackName().
	 *
	 * @param {string} name Node name to be sanitized.
	 * @return {string}
	 */static sanitizeNodeName(name){return name.replace(/\s/g,'_').replace(_reservedRe,'');}static parseTrackName(trackName){const matches=_trackRe.exec(trackName);if(matches===null){throw new Error('PropertyBinding: Cannot parse trackName: '+trackName);}const results={// directoryName: matches[ 1 ], // (tschw) currently unused
nodeName:matches[2],objectName:matches[3],objectIndex:matches[4],propertyName:matches[5],// required
propertyIndex:matches[6]};const lastDot=results.nodeName&&results.nodeName.lastIndexOf('.');if(lastDot!==undefined&&lastDot!==-1){const objectName=results.nodeName.substring(lastDot+1);// Object names must be checked against an allowlist. Otherwise, there
// is no way to parse 'foo.bar.baz': 'baz' must be a property, but
// 'bar' could be the objectName, or part of a nodeName (which can
// include '.' characters).
if(_supportedObjectNames.indexOf(objectName)!==-1){results.nodeName=results.nodeName.substring(0,lastDot);results.objectName=objectName;}}if(results.propertyName===null||results.propertyName.length===0){throw new Error('PropertyBinding: can not parse propertyName from trackName: '+trackName);}return results;}static findNode(root,nodeName){if(nodeName===undefined||nodeName===''||nodeName==='.'||nodeName===-1||nodeName===root.name||nodeName===root.uuid){return root;}// search into skeleton bones.
if(root.skeleton){const bone=root.skeleton.getBoneByName(nodeName);if(bone!==undefined){return bone;}}// search into node subtree.
if(root.children){const searchNodeSubtree=function(children){for(let i=0;i<children.length;i++){const childNode=children[i];if(childNode.name===nodeName||childNode.uuid===nodeName){return childNode;}const result=searchNodeSubtree(childNode.children);if(result)return result;}return null;};const subTreeNode=searchNodeSubtree(root.children);if(subTreeNode){return subTreeNode;}}return null;}// these are used to "bind" a nonexistent property
_getValue_unavailable(){}_setValue_unavailable(){}// Getters
_getValue_direct(buffer,offset){buffer[offset]=this.targetObject[this.propertyName];}_getValue_array(buffer,offset){const source=this.resolvedProperty;for(let i=0,n=source.length;i!==n;++i){buffer[offset++]=source[i];}}_getValue_arrayElement(buffer,offset){buffer[offset]=this.resolvedProperty[this.propertyIndex];}_getValue_toArray(buffer,offset){this.resolvedProperty.toArray(buffer,offset);}// Direct
_setValue_direct(buffer,offset){this.targetObject[this.propertyName]=buffer[offset];}_setValue_direct_setNeedsUpdate(buffer,offset){this.targetObject[this.propertyName]=buffer[offset];this.targetObject.needsUpdate=true;}_setValue_direct_setMatrixWorldNeedsUpdate(buffer,offset){this.targetObject[this.propertyName]=buffer[offset];this.targetObject.matrixWorldNeedsUpdate=true;}// EntireArray
_setValue_array(buffer,offset){const dest=this.resolvedProperty;for(let i=0,n=dest.length;i!==n;++i){dest[i]=buffer[offset++];}}_setValue_array_setNeedsUpdate(buffer,offset){const dest=this.resolvedProperty;for(let i=0,n=dest.length;i!==n;++i){dest[i]=buffer[offset++];}this.targetObject.needsUpdate=true;}_setValue_array_setMatrixWorldNeedsUpdate(buffer,offset){const dest=this.resolvedProperty;for(let i=0,n=dest.length;i!==n;++i){dest[i]=buffer[offset++];}this.targetObject.matrixWorldNeedsUpdate=true;}// ArrayElement
_setValue_arrayElement(buffer,offset){this.resolvedProperty[this.propertyIndex]=buffer[offset];}_setValue_arrayElement_setNeedsUpdate(buffer,offset){this.resolvedProperty[this.propertyIndex]=buffer[offset];this.targetObject.needsUpdate=true;}_setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer,offset){this.resolvedProperty[this.propertyIndex]=buffer[offset];this.targetObject.matrixWorldNeedsUpdate=true;}// HasToFromArray
_setValue_fromArray(buffer,offset){this.resolvedProperty.fromArray(buffer,offset);}_setValue_fromArray_setNeedsUpdate(buffer,offset){this.resolvedProperty.fromArray(buffer,offset);this.targetObject.needsUpdate=true;}_setValue_fromArray_setMatrixWorldNeedsUpdate(buffer,offset){this.resolvedProperty.fromArray(buffer,offset);this.targetObject.matrixWorldNeedsUpdate=true;}_getValue_unbound(targetArray,offset){this.bind();this.getValue(targetArray,offset);}_setValue_unbound(sourceArray,offset){this.bind();this.setValue(sourceArray,offset);}// create getter / setter pair for a property in the scene graph
bind(){let targetObject=this.node;const parsedPath=this.parsedPath;const objectName=parsedPath.objectName;const propertyName=parsedPath.propertyName;let propertyIndex=parsedPath.propertyIndex;if(!targetObject){targetObject=PropertyBinding.findNode(this.rootNode,parsedPath.nodeName);this.node=targetObject;}// set fail state so we can just 'return' on error
this.getValue=this._getValue_unavailable;this.setValue=this._setValue_unavailable;// ensure there is a value node
if(!targetObject){console.warn('THREE.PropertyBinding: No target node found for track: '+this.path+'.');return;}if(objectName){let objectIndex=parsedPath.objectIndex;// special cases were we need to reach deeper into the hierarchy to get the face materials....
switch(objectName){case'materials':if(!targetObject.material){console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.',this);return;}if(!targetObject.material.materials){console.error('THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.',this);return;}targetObject=targetObject.material.materials;break;case'bones':if(!targetObject.skeleton){console.error('THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.',this);return;}// potential future optimization: skip this if propertyIndex is already an integer
// and convert the integer string to a true integer.
targetObject=targetObject.skeleton.bones;// support resolving morphTarget names into indices.
for(let i=0;i<targetObject.length;i++){if(targetObject[i].name===objectIndex){objectIndex=i;break;}}break;case'map':if('map'in targetObject){targetObject=targetObject.map;break;}if(!targetObject.material){console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.',this);return;}if(!targetObject.material.map){console.error('THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.',this);return;}targetObject=targetObject.material.map;break;default:if(targetObject[objectName]===undefined){console.error('THREE.PropertyBinding: Can not bind to objectName of node undefined.',this);return;}targetObject=targetObject[objectName];}if(objectIndex!==undefined){if(targetObject[objectIndex]===undefined){console.error('THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.',this,targetObject);return;}targetObject=targetObject[objectIndex];}}// resolve property
const nodeProperty=targetObject[propertyName];if(nodeProperty===undefined){const nodeName=parsedPath.nodeName;console.error('THREE.PropertyBinding: Trying to update property for track: '+nodeName+'.'+propertyName+' but it wasn\'t found.',targetObject);return;}// determine versioning scheme
let versioning=this.Versioning.None;this.targetObject=targetObject;if(targetObject.needsUpdate!==undefined){// material
versioning=this.Versioning.NeedsUpdate;}else if(targetObject.matrixWorldNeedsUpdate!==undefined){// node transform
versioning=this.Versioning.MatrixWorldNeedsUpdate;}// determine how the property gets bound
let bindingType=this.BindingType.Direct;if(propertyIndex!==undefined){// access a sub element of the property array (only primitives are supported right now)
if(propertyName==='morphTargetInfluences'){// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.
// support resolving morphTarget names into indices.
if(!targetObject.geometry){console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.',this);return;}if(!targetObject.geometry.morphAttributes){console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.',this);return;}if(targetObject.morphTargetDictionary[propertyIndex]!==undefined){propertyIndex=targetObject.morphTargetDictionary[propertyIndex];}}bindingType=this.BindingType.ArrayElement;this.resolvedProperty=nodeProperty;this.propertyIndex=propertyIndex;}else if(nodeProperty.fromArray!==undefined&&nodeProperty.toArray!==undefined){// must use copy for Object3D.Euler/Quaternion
bindingType=this.BindingType.HasFromToArray;this.resolvedProperty=nodeProperty;}else if(Array.isArray(nodeProperty)){bindingType=this.BindingType.EntireArray;this.resolvedProperty=nodeProperty;}else {this.propertyName=propertyName;}// select getter / setter
this.getValue=this.GetterByBindingType[bindingType];this.setValue=this.SetterByBindingTypeAndVersioning[bindingType][versioning];}unbind(){this.node=null;// back to the prototype version of getValue / setValue
// note: avoiding to mutate the shape of 'this' via 'delete'
this.getValue=this._getValue_unbound;this.setValue=this._setValue_unbound;}}PropertyBinding.Composite=Composite;PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray];PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[// Direct
PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[// EntireArray
PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate],[// ArrayElement
PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[// HasToFromArray
PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];/**
 * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
 *
 * phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.
 * theta (the azimuthal angle) is measured from the positive z-axis.
 */class Spherical{constructor(radius=1,phi=0,theta=0){this.radius=radius;this.phi=phi;// polar angle
this.theta=theta;// azimuthal angle
return this;}set(radius,phi,theta){this.radius=radius;this.phi=phi;this.theta=theta;return this;}copy(other){this.radius=other.radius;this.phi=other.phi;this.theta=other.theta;return this;}// restrict phi to be between EPS and PI-EPS
makeSafe(){const EPS=0.000001;this.phi=Math.max(EPS,Math.min(Math.PI-EPS,this.phi));return this;}setFromVector3(v){return this.setFromCartesianCoords(v.x,v.y,v.z);}setFromCartesianCoords(x,y,z){this.radius=Math.sqrt(x*x+y*y+z*z);if(this.radius===0){this.theta=0;this.phi=0;}else {this.theta=Math.atan2(x,z);this.phi=Math.acos(clamp$2(y/this.radius,-1,1));}return this;}clone(){return new this.constructor().copy(this);}}class Controls extends EventDispatcher$1{constructor(object,domElement){super();this.object=object;this.domElement=domElement;this.enabled=true;this.state=-1;this.keys={};this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null};this.touches={ONE:null,TWO:null};}connect(){}disconnect(){}dispose(){}update(/* delta */){}}if(typeof __THREE_DEVTOOLS__!=='undefined'){__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('register',{detail:{revision:REVISION}}));}if(typeof window!=='undefined'){if(window.__THREE__){console.warn('WARNING: Multiple instances of Three.js being imported.');}else {window.__THREE__=REVISION;}}

/**
 * @param {BufferGeometry} geometry
 * @param {number} drawMode
 * @return {BufferGeometry}
 */
function toTrianglesDrawMode(geometry, drawMode) {
  if (drawMode === TrianglesDrawMode) {
    console.warn('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.');
    return geometry;
  }
  if (drawMode === TriangleFanDrawMode || drawMode === TriangleStripDrawMode) {
    let index = geometry.getIndex();

    // generate index if not present

    if (index === null) {
      const indices = [];
      const position = geometry.getAttribute('position');
      if (position !== undefined) {
        for (let i = 0; i < position.count; i++) {
          indices.push(i);
        }
        geometry.setIndex(indices);
        index = geometry.getIndex();
      } else {
        console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.');
        return geometry;
      }
    }

    //

    const numberOfTriangles = index.count - 2;
    const newIndices = [];
    if (drawMode === TriangleFanDrawMode) {
      // gl.TRIANGLE_FAN

      for (let i = 1; i <= numberOfTriangles; i++) {
        newIndices.push(index.getX(0));
        newIndices.push(index.getX(i));
        newIndices.push(index.getX(i + 1));
      }
    } else {
      // gl.TRIANGLE_STRIP

      for (let i = 0; i < numberOfTriangles; i++) {
        if (i % 2 === 0) {
          newIndices.push(index.getX(i));
          newIndices.push(index.getX(i + 1));
          newIndices.push(index.getX(i + 2));
        } else {
          newIndices.push(index.getX(i + 2));
          newIndices.push(index.getX(i + 1));
          newIndices.push(index.getX(i));
        }
      }
    }
    if (newIndices.length / 3 !== numberOfTriangles) {
      console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.');
    }

    // build final geometry

    const newGeometry = geometry.clone();
    newGeometry.setIndex(newIndices);
    newGeometry.clearGroups();
    return newGeometry;
  } else {
    console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode);
    return geometry;
  }
}

class GLTFLoader extends Loader {
  constructor(manager) {
    super(manager);
    this.dracoLoader = null;
    this.ktx2Loader = null;
    this.meshoptDecoder = null;
    this.pluginCallbacks = [];
    this.register(function (parser) {
      return new GLTFMaterialsClearcoatExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsDispersionExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFTextureBasisUExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFTextureWebPExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFTextureAVIFExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsSheenExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsTransmissionExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsVolumeExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsIorExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsEmissiveStrengthExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsSpecularExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsIridescenceExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsAnisotropyExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMaterialsBumpExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFLightsExtension(parser);
    });
    this.register(function (parser) {
      return new GLTFMeshoptCompression(parser);
    });
    this.register(function (parser) {
      return new GLTFMeshGpuInstancing(parser);
    });
  }
  load(url, onLoad, onProgress, onError) {
    const scope = this;
    let resourcePath;
    if (this.resourcePath !== '') {
      resourcePath = this.resourcePath;
    } else if (this.path !== '') {
      // If a base path is set, resources will be relative paths from that plus the relative path of the gltf file
      // Example  path = 'https://my-cnd-server.com/', url = 'assets/models/model.gltf'
      // resourcePath = 'https://my-cnd-server.com/assets/models/'
      // referenced resource 'model.bin' will be loaded from 'https://my-cnd-server.com/assets/models/model.bin'
      // referenced resource '../textures/texture.png' will be loaded from 'https://my-cnd-server.com/assets/textures/texture.png'
      const relativeUrl = LoaderUtils.extractUrlBase(url);
      resourcePath = LoaderUtils.resolveURL(relativeUrl, this.path);
    } else {
      resourcePath = LoaderUtils.extractUrlBase(url);
    }

    // Tells the LoadingManager to track an extra item, which resolves after
    // the model is fully loaded. This means the count of items loaded will
    // be incorrect, but ensures manager.onLoad() does not fire early.
    this.manager.itemStart(url);
    const _onError = function (e) {
      if (onError) {
        onError(e);
      } else {
        console.error(e);
      }
      scope.manager.itemError(url);
      scope.manager.itemEnd(url);
    };
    const loader = new FileLoader(this.manager);
    loader.setPath(this.path);
    loader.setResponseType('arraybuffer');
    loader.setRequestHeader(this.requestHeader);
    loader.setWithCredentials(this.withCredentials);
    loader.load(url, function (data) {
      try {
        scope.parse(data, resourcePath, function (gltf) {
          onLoad(gltf);
          scope.manager.itemEnd(url);
        }, _onError);
      } catch (e) {
        _onError(e);
      }
    }, onProgress, _onError);
  }
  setDRACOLoader(dracoLoader) {
    this.dracoLoader = dracoLoader;
    return this;
  }
  setDDSLoader() {
    throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".');
  }
  setKTX2Loader(ktx2Loader) {
    this.ktx2Loader = ktx2Loader;
    return this;
  }
  setMeshoptDecoder(meshoptDecoder) {
    this.meshoptDecoder = meshoptDecoder;
    return this;
  }
  register(callback) {
    if (this.pluginCallbacks.indexOf(callback) === -1) {
      this.pluginCallbacks.push(callback);
    }
    return this;
  }
  unregister(callback) {
    if (this.pluginCallbacks.indexOf(callback) !== -1) {
      this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1);
    }
    return this;
  }
  parse(data, path, onLoad, onError) {
    let json;
    const extensions = {};
    const plugins = {};
    const textDecoder = new TextDecoder();
    if (typeof data === 'string') {
      json = JSON.parse(data);
    } else if (data instanceof ArrayBuffer) {
      const magic = textDecoder.decode(new Uint8Array(data, 0, 4));
      if (magic === BINARY_EXTENSION_HEADER_MAGIC) {
        try {
          extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);
        } catch (error) {
          if (onError) onError(error);
          return;
        }
        json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content);
      } else {
        json = JSON.parse(textDecoder.decode(data));
      }
    } else {
      json = data;
    }
    if (json.asset === undefined || json.asset.version[0] < 2) {
      if (onError) onError(new Error('THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.'));
      return;
    }
    const parser = new GLTFParser(json, {
      path: path || this.resourcePath || '',
      crossOrigin: this.crossOrigin,
      requestHeader: this.requestHeader,
      manager: this.manager,
      ktx2Loader: this.ktx2Loader,
      meshoptDecoder: this.meshoptDecoder
    });
    parser.fileLoader.setRequestHeader(this.requestHeader);
    for (let i = 0; i < this.pluginCallbacks.length; i++) {
      const plugin = this.pluginCallbacks[i](parser);
      if (!plugin.name) console.error('THREE.GLTFLoader: Invalid plugin found: missing name');
      plugins[plugin.name] = plugin;

      // Workaround to avoid determining as unknown extension
      // in addUnknownExtensionsToUserData().
      // Remove this workaround if we move all the existing
      // extension handlers to plugin system
      extensions[plugin.name] = true;
    }
    if (json.extensionsUsed) {
      for (let i = 0; i < json.extensionsUsed.length; ++i) {
        const extensionName = json.extensionsUsed[i];
        const extensionsRequired = json.extensionsRequired || [];
        switch (extensionName) {
          case EXTENSIONS.KHR_MATERIALS_UNLIT:
            extensions[extensionName] = new GLTFMaterialsUnlitExtension();
            break;
          case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:
            extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader);
            break;
          case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
            extensions[extensionName] = new GLTFTextureTransformExtension();
            break;
          case EXTENSIONS.KHR_MESH_QUANTIZATION:
            extensions[extensionName] = new GLTFMeshQuantizationExtension();
            break;
          default:
            if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === undefined) {
              console.warn('THREE.GLTFLoader: Unknown extension "' + extensionName + '".');
            }
        }
      }
    }
    parser.setExtensions(extensions);
    parser.setPlugins(plugins);
    parser.parse(onLoad, onError);
  }
  parseAsync(data, path) {
    const scope = this;
    return new Promise(function (resolve, reject) {
      scope.parse(data, path, resolve, reject);
    });
  }
}

/* GLTFREGISTRY */

function GLTFRegistry() {
  let objects = {};
  return {
    get: function (key) {
      return objects[key];
    },
    add: function (key, object) {
      objects[key] = object;
    },
    remove: function (key) {
      delete objects[key];
    },
    removeAll: function () {
      objects = {};
    }
  };
}

/*********************************/
/********** EXTENSIONS ***********/
/*********************************/

const EXTENSIONS = {
  KHR_BINARY_GLTF: 'KHR_binary_glTF',
  KHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',
  KHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',
  KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
  KHR_MATERIALS_DISPERSION: 'KHR_materials_dispersion',
  KHR_MATERIALS_IOR: 'KHR_materials_ior',
  KHR_MATERIALS_SHEEN: 'KHR_materials_sheen',
  KHR_MATERIALS_SPECULAR: 'KHR_materials_specular',
  KHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',
  KHR_MATERIALS_IRIDESCENCE: 'KHR_materials_iridescence',
  KHR_MATERIALS_ANISOTROPY: 'KHR_materials_anisotropy',
  KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
  KHR_MATERIALS_VOLUME: 'KHR_materials_volume',
  KHR_TEXTURE_BASISU: 'KHR_texture_basisu',
  KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
  KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
  KHR_MATERIALS_EMISSIVE_STRENGTH: 'KHR_materials_emissive_strength',
  EXT_MATERIALS_BUMP: 'EXT_materials_bump',
  EXT_TEXTURE_WEBP: 'EXT_texture_webp',
  EXT_TEXTURE_AVIF: 'EXT_texture_avif',
  EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',
  EXT_MESH_GPU_INSTANCING: 'EXT_mesh_gpu_instancing'
};

/**
 * Punctual Lights Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
 */
class GLTFLightsExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;

    // Object3D instance caches
    this.cache = {
      refs: {},
      uses: {}
    };
  }
  _markDefs() {
    const parser = this.parser;
    const nodeDefs = this.parser.json.nodes || [];
    for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {
      const nodeDef = nodeDefs[nodeIndex];
      if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== undefined) {
        parser._addNodeRef(this.cache, nodeDef.extensions[this.name].light);
      }
    }
  }
  _loadLight(lightIndex) {
    const parser = this.parser;
    const cacheKey = 'light:' + lightIndex;
    let dependency = parser.cache.get(cacheKey);
    if (dependency) return dependency;
    const json = parser.json;
    const extensions = json.extensions && json.extensions[this.name] || {};
    const lightDefs = extensions.lights || [];
    const lightDef = lightDefs[lightIndex];
    let lightNode;
    const color = new Color$1(0xffffff);
    if (lightDef.color !== undefined) color.setRGB(lightDef.color[0], lightDef.color[1], lightDef.color[2], LinearSRGBColorSpace$1);
    const range = lightDef.range !== undefined ? lightDef.range : 0;
    switch (lightDef.type) {
      case 'directional':
        lightNode = new DirectionalLight(color);
        lightNode.target.position.set(0, 0, -1);
        lightNode.add(lightNode.target);
        break;
      case 'point':
        lightNode = new PointLight(color);
        lightNode.distance = range;
        break;
      case 'spot':
        lightNode = new SpotLight(color);
        lightNode.distance = range;
        // Handle spotlight properties.
        lightDef.spot = lightDef.spot || {};
        lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;
        lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;
        lightNode.angle = lightDef.spot.outerConeAngle;
        lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
        lightNode.target.position.set(0, 0, -1);
        lightNode.add(lightNode.target);
        break;
      default:
        throw new Error('THREE.GLTFLoader: Unexpected light type: ' + lightDef.type);
    }

    // Some lights (e.g. spot) default to a position other than the origin. Reset the position
    // here, because node-level parsing will only override position if explicitly specified.
    lightNode.position.set(0, 0, 0);
    lightNode.decay = 2;
    assignExtrasToUserData(lightNode, lightDef);
    if (lightDef.intensity !== undefined) lightNode.intensity = lightDef.intensity;
    lightNode.name = parser.createUniqueName(lightDef.name || 'light_' + lightIndex);
    dependency = Promise.resolve(lightNode);
    parser.cache.add(cacheKey, dependency);
    return dependency;
  }
  getDependency(type, index) {
    if (type !== 'light') return;
    return this._loadLight(index);
  }
  createNodeAttachment(nodeIndex) {
    const self = this;
    const parser = this.parser;
    const json = parser.json;
    const nodeDef = json.nodes[nodeIndex];
    const lightDef = nodeDef.extensions && nodeDef.extensions[this.name] || {};
    const lightIndex = lightDef.light;
    if (lightIndex === undefined) return null;
    return this._loadLight(lightIndex).then(function (light) {
      return parser._getNodeRef(self.cache, lightIndex, light);
    });
  }
}

/**
 * Unlit Materials Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit
 */
class GLTFMaterialsUnlitExtension {
  constructor() {
    this.name = EXTENSIONS.KHR_MATERIALS_UNLIT;
  }
  getMaterialType() {
    return MeshBasicMaterial$1;
  }
  extendParams(materialParams, materialDef, parser) {
    const pending = [];
    materialParams.color = new Color$1(1.0, 1.0, 1.0);
    materialParams.opacity = 1.0;
    const metallicRoughness = materialDef.pbrMetallicRoughness;
    if (metallicRoughness) {
      if (Array.isArray(metallicRoughness.baseColorFactor)) {
        const array = metallicRoughness.baseColorFactor;
        materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace$1);
        materialParams.opacity = array[3];
      }
      if (metallicRoughness.baseColorTexture !== undefined) {
        pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace$1));
      }
    }
    return Promise.all(pending);
  }
}

/**
 * Materials Emissive Strength Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md
 */
class GLTFMaterialsEmissiveStrengthExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const emissiveStrength = materialDef.extensions[this.name].emissiveStrength;
    if (emissiveStrength !== undefined) {
      materialParams.emissiveIntensity = emissiveStrength;
    }
    return Promise.resolve();
  }
}

/**
 * Clearcoat Materials Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat
 */
class GLTFMaterialsClearcoatExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const pending = [];
    const extension = materialDef.extensions[this.name];
    if (extension.clearcoatFactor !== undefined) {
      materialParams.clearcoat = extension.clearcoatFactor;
    }
    if (extension.clearcoatTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'clearcoatMap', extension.clearcoatTexture));
    }
    if (extension.clearcoatRoughnessFactor !== undefined) {
      materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;
    }
    if (extension.clearcoatRoughnessTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'clearcoatRoughnessMap', extension.clearcoatRoughnessTexture));
    }
    if (extension.clearcoatNormalTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture));
      if (extension.clearcoatNormalTexture.scale !== undefined) {
        const scale = extension.clearcoatNormalTexture.scale;
        materialParams.clearcoatNormalScale = new Vector2$1(scale, scale);
      }
    }
    return Promise.all(pending);
  }
}

/**
 * Materials dispersion Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion
 */
class GLTFMaterialsDispersionExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_DISPERSION;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const extension = materialDef.extensions[this.name];
    materialParams.dispersion = extension.dispersion !== undefined ? extension.dispersion : 0;
    return Promise.resolve();
  }
}

/**
 * Iridescence Materials Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_iridescence
 */
class GLTFMaterialsIridescenceExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const pending = [];
    const extension = materialDef.extensions[this.name];
    if (extension.iridescenceFactor !== undefined) {
      materialParams.iridescence = extension.iridescenceFactor;
    }
    if (extension.iridescenceTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'iridescenceMap', extension.iridescenceTexture));
    }
    if (extension.iridescenceIor !== undefined) {
      materialParams.iridescenceIOR = extension.iridescenceIor;
    }
    if (materialParams.iridescenceThicknessRange === undefined) {
      materialParams.iridescenceThicknessRange = [100, 400];
    }
    if (extension.iridescenceThicknessMinimum !== undefined) {
      materialParams.iridescenceThicknessRange[0] = extension.iridescenceThicknessMinimum;
    }
    if (extension.iridescenceThicknessMaximum !== undefined) {
      materialParams.iridescenceThicknessRange[1] = extension.iridescenceThicknessMaximum;
    }
    if (extension.iridescenceThicknessTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'iridescenceThicknessMap', extension.iridescenceThicknessTexture));
    }
    return Promise.all(pending);
  }
}

/**
 * Sheen Materials Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
 */
class GLTFMaterialsSheenExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_SHEEN;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const pending = [];
    materialParams.sheenColor = new Color$1(0, 0, 0);
    materialParams.sheenRoughness = 0;
    materialParams.sheen = 1;
    const extension = materialDef.extensions[this.name];
    if (extension.sheenColorFactor !== undefined) {
      const colorFactor = extension.sheenColorFactor;
      materialParams.sheenColor.setRGB(colorFactor[0], colorFactor[1], colorFactor[2], LinearSRGBColorSpace$1);
    }
    if (extension.sheenRoughnessFactor !== undefined) {
      materialParams.sheenRoughness = extension.sheenRoughnessFactor;
    }
    if (extension.sheenColorTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'sheenColorMap', extension.sheenColorTexture, SRGBColorSpace$1));
    }
    if (extension.sheenRoughnessTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture));
    }
    return Promise.all(pending);
  }
}

/**
 * Transmission Materials Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission
 * Draft: https://github.com/KhronosGroup/glTF/pull/1698
 */
class GLTFMaterialsTransmissionExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const pending = [];
    const extension = materialDef.extensions[this.name];
    if (extension.transmissionFactor !== undefined) {
      materialParams.transmission = extension.transmissionFactor;
    }
    if (extension.transmissionTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'transmissionMap', extension.transmissionTexture));
    }
    return Promise.all(pending);
  }
}

/**
 * Materials Volume Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume
 */
class GLTFMaterialsVolumeExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_VOLUME;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const pending = [];
    const extension = materialDef.extensions[this.name];
    materialParams.thickness = extension.thicknessFactor !== undefined ? extension.thicknessFactor : 0;
    if (extension.thicknessTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'thicknessMap', extension.thicknessTexture));
    }
    materialParams.attenuationDistance = extension.attenuationDistance || Infinity;
    const colorArray = extension.attenuationColor || [1, 1, 1];
    materialParams.attenuationColor = new Color$1().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace$1);
    return Promise.all(pending);
  }
}

/**
 * Materials ior Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior
 */
class GLTFMaterialsIorExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_IOR;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const extension = materialDef.extensions[this.name];
    materialParams.ior = extension.ior !== undefined ? extension.ior : 1.5;
    return Promise.resolve();
  }
}

/**
 * Materials specular Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular
 */
class GLTFMaterialsSpecularExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const pending = [];
    const extension = materialDef.extensions[this.name];
    materialParams.specularIntensity = extension.specularFactor !== undefined ? extension.specularFactor : 1.0;
    if (extension.specularTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'specularIntensityMap', extension.specularTexture));
    }
    const colorArray = extension.specularColorFactor || [1, 1, 1];
    materialParams.specularColor = new Color$1().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace$1);
    if (extension.specularColorTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'specularColorMap', extension.specularColorTexture, SRGBColorSpace$1));
    }
    return Promise.all(pending);
  }
}

/**
 * Materials bump Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_materials_bump
 */
class GLTFMaterialsBumpExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.EXT_MATERIALS_BUMP;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const pending = [];
    const extension = materialDef.extensions[this.name];
    materialParams.bumpScale = extension.bumpFactor !== undefined ? extension.bumpFactor : 1.0;
    if (extension.bumpTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'bumpMap', extension.bumpTexture));
    }
    return Promise.all(pending);
  }
}

/**
 * Materials anisotropy Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_anisotropy
 */
class GLTFMaterialsAnisotropyExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY;
  }
  getMaterialType(materialIndex) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
    return MeshPhysicalMaterial;
  }
  extendMaterialParams(materialIndex, materialParams) {
    const parser = this.parser;
    const materialDef = parser.json.materials[materialIndex];
    if (!materialDef.extensions || !materialDef.extensions[this.name]) {
      return Promise.resolve();
    }
    const pending = [];
    const extension = materialDef.extensions[this.name];
    if (extension.anisotropyStrength !== undefined) {
      materialParams.anisotropy = extension.anisotropyStrength;
    }
    if (extension.anisotropyRotation !== undefined) {
      materialParams.anisotropyRotation = extension.anisotropyRotation;
    }
    if (extension.anisotropyTexture !== undefined) {
      pending.push(parser.assignTexture(materialParams, 'anisotropyMap', extension.anisotropyTexture));
    }
    return Promise.all(pending);
  }
}

/**
 * BasisU Texture Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu
 */
class GLTFTextureBasisUExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.KHR_TEXTURE_BASISU;
  }
  loadTexture(textureIndex) {
    const parser = this.parser;
    const json = parser.json;
    const textureDef = json.textures[textureIndex];
    if (!textureDef.extensions || !textureDef.extensions[this.name]) {
      return null;
    }
    const extension = textureDef.extensions[this.name];
    const loader = parser.options.ktx2Loader;
    if (!loader) {
      if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {
        throw new Error('THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures');
      } else {
        // Assumes that the extension is optional and that a fallback texture is present
        return null;
      }
    }
    return parser.loadTextureImage(textureIndex, extension.source, loader);
  }
}

/**
 * WebP Texture Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp
 */
class GLTFTextureWebPExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.EXT_TEXTURE_WEBP;
    this.isSupported = null;
  }
  loadTexture(textureIndex) {
    const name = this.name;
    const parser = this.parser;
    const json = parser.json;
    const textureDef = json.textures[textureIndex];
    if (!textureDef.extensions || !textureDef.extensions[name]) {
      return null;
    }
    const extension = textureDef.extensions[name];
    const source = json.images[extension.source];
    let loader = parser.textureLoader;
    if (source.uri) {
      const handler = parser.options.manager.getHandler(source.uri);
      if (handler !== null) loader = handler;
    }
    return this.detectSupport().then(function (isSupported) {
      if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader);
      if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {
        throw new Error('THREE.GLTFLoader: WebP required by asset but unsupported.');
      }

      // Fall back to PNG or JPEG.
      return parser.loadTexture(textureIndex);
    });
  }
  detectSupport() {
    if (!this.isSupported) {
      this.isSupported = new Promise(function (resolve) {
        const image = new Image();

        // Lossy test image. Support for lossy images doesn't guarantee support for all
        // WebP images, unfortunately.
        image.src = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';
        image.onload = image.onerror = function () {
          resolve(image.height === 1);
        };
      });
    }
    return this.isSupported;
  }
}

/**
 * AVIF Texture Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_avif
 */
class GLTFTextureAVIFExtension {
  constructor(parser) {
    this.parser = parser;
    this.name = EXTENSIONS.EXT_TEXTURE_AVIF;
    this.isSupported = null;
  }
  loadTexture(textureIndex) {
    const name = this.name;
    const parser = this.parser;
    const json = parser.json;
    const textureDef = json.textures[textureIndex];
    if (!textureDef.extensions || !textureDef.extensions[name]) {
      return null;
    }
    const extension = textureDef.extensions[name];
    const source = json.images[extension.source];
    let loader = parser.textureLoader;
    if (source.uri) {
      const handler = parser.options.manager.getHandler(source.uri);
      if (handler !== null) loader = handler;
    }
    return this.detectSupport().then(function (isSupported) {
      if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader);
      if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {
        throw new Error('THREE.GLTFLoader: AVIF required by asset but unsupported.');
      }

      // Fall back to PNG or JPEG.
      return parser.loadTexture(textureIndex);
    });
  }
  detectSupport() {
    if (!this.isSupported) {
      this.isSupported = new Promise(function (resolve) {
        const image = new Image();

        // Lossy test image.
        image.src = 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=';
        image.onload = image.onerror = function () {
          resolve(image.height === 1);
        };
      });
    }
    return this.isSupported;
  }
}

/**
 * meshopt BufferView Compression Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression
 */
class GLTFMeshoptCompression {
  constructor(parser) {
    this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION;
    this.parser = parser;
  }
  loadBufferView(index) {
    const json = this.parser.json;
    const bufferView = json.bufferViews[index];
    if (bufferView.extensions && bufferView.extensions[this.name]) {
      const extensionDef = bufferView.extensions[this.name];
      const buffer = this.parser.getDependency('buffer', extensionDef.buffer);
      const decoder = this.parser.options.meshoptDecoder;
      if (!decoder || !decoder.supported) {
        if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {
          throw new Error('THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files');
        } else {
          // Assumes that the extension is optional and that fallback buffer data is present
          return null;
        }
      }
      return buffer.then(function (res) {
        const byteOffset = extensionDef.byteOffset || 0;
        const byteLength = extensionDef.byteLength || 0;
        const count = extensionDef.count;
        const stride = extensionDef.byteStride;
        const source = new Uint8Array(res, byteOffset, byteLength);
        if (decoder.decodeGltfBufferAsync) {
          return decoder.decodeGltfBufferAsync(count, stride, source, extensionDef.mode, extensionDef.filter).then(function (res) {
            return res.buffer;
          });
        } else {
          // Support for MeshoptDecoder 0.18 or earlier, without decodeGltfBufferAsync
          return decoder.ready.then(function () {
            const result = new ArrayBuffer(count * stride);
            decoder.decodeGltfBuffer(new Uint8Array(result), count, stride, source, extensionDef.mode, extensionDef.filter);
            return result;
          });
        }
      });
    } else {
      return null;
    }
  }
}

/**
 * GPU Instancing Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_mesh_gpu_instancing
 *
 */
class GLTFMeshGpuInstancing {
  constructor(parser) {
    this.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING;
    this.parser = parser;
  }
  createNodeMesh(nodeIndex) {
    const json = this.parser.json;
    const nodeDef = json.nodes[nodeIndex];
    if (!nodeDef.extensions || !nodeDef.extensions[this.name] || nodeDef.mesh === undefined) {
      return null;
    }
    const meshDef = json.meshes[nodeDef.mesh];

    // No Points or Lines + Instancing support yet

    for (const primitive of meshDef.primitives) {
      if (primitive.mode !== WEBGL_CONSTANTS.TRIANGLES && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN && primitive.mode !== undefined) {
        return null;
      }
    }
    const extensionDef = nodeDef.extensions[this.name];
    const attributesDef = extensionDef.attributes;

    // @TODO: Can we support InstancedMesh + SkinnedMesh?

    const pending = [];
    const attributes = {};
    for (const key in attributesDef) {
      pending.push(this.parser.getDependency('accessor', attributesDef[key]).then(accessor => {
        attributes[key] = accessor;
        return attributes[key];
      }));
    }
    if (pending.length < 1) {
      return null;
    }
    pending.push(this.parser.createNodeMesh(nodeIndex));
    return Promise.all(pending).then(results => {
      const nodeObject = results.pop();
      const meshes = nodeObject.isGroup ? nodeObject.children : [nodeObject];
      const count = results[0].count; // All attribute counts should be same
      const instancedMeshes = [];
      for (const mesh of meshes) {
        // Temporal variables
        const m = new Matrix4$1();
        const p = new Vector3$1();
        const q = new Quaternion$1();
        const s = new Vector3$1(1, 1, 1);
        const instancedMesh = new InstancedMesh(mesh.geometry, mesh.material, count);
        for (let i = 0; i < count; i++) {
          if (attributes.TRANSLATION) {
            p.fromBufferAttribute(attributes.TRANSLATION, i);
          }
          if (attributes.ROTATION) {
            q.fromBufferAttribute(attributes.ROTATION, i);
          }
          if (attributes.SCALE) {
            s.fromBufferAttribute(attributes.SCALE, i);
          }
          instancedMesh.setMatrixAt(i, m.compose(p, q, s));
        }

        // Add instance attributes to the geometry, excluding TRS.
        for (const attributeName in attributes) {
          if (attributeName === '_COLOR_0') {
            const attr = attributes[attributeName];
            instancedMesh.instanceColor = new InstancedBufferAttribute$1(attr.array, attr.itemSize, attr.normalized);
          } else if (attributeName !== 'TRANSLATION' && attributeName !== 'ROTATION' && attributeName !== 'SCALE') {
            mesh.geometry.setAttribute(attributeName, attributes[attributeName]);
          }
        }

        // Just in case
        Object3D$1.prototype.copy.call(instancedMesh, mesh);
        this.parser.assignFinalMaterial(instancedMesh);
        instancedMeshes.push(instancedMesh);
      }
      if (nodeObject.isGroup) {
        nodeObject.clear();
        nodeObject.add(...instancedMeshes);
        return nodeObject;
      }
      return instancedMeshes[0];
    });
  }
}

/* BINARY EXTENSION */
const BINARY_EXTENSION_HEADER_MAGIC = 'glTF';
const BINARY_EXTENSION_HEADER_LENGTH = 12;
const BINARY_EXTENSION_CHUNK_TYPES = {
  JSON: 0x4E4F534A,
  BIN: 0x004E4942
};
class GLTFBinaryExtension {
  constructor(data) {
    this.name = EXTENSIONS.KHR_BINARY_GLTF;
    this.content = null;
    this.body = null;
    const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH);
    const textDecoder = new TextDecoder();
    this.header = {
      magic: textDecoder.decode(new Uint8Array(data.slice(0, 4))),
      version: headerView.getUint32(4, true),
      length: headerView.getUint32(8, true)
    };
    if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) {
      throw new Error('THREE.GLTFLoader: Unsupported glTF-Binary header.');
    } else if (this.header.version < 2.0) {
      throw new Error('THREE.GLTFLoader: Legacy binary file detected.');
    }
    const chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH;
    const chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH);
    let chunkIndex = 0;
    while (chunkIndex < chunkContentsLength) {
      const chunkLength = chunkView.getUint32(chunkIndex, true);
      chunkIndex += 4;
      const chunkType = chunkView.getUint32(chunkIndex, true);
      chunkIndex += 4;
      if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {
        const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength);
        this.content = textDecoder.decode(contentArray);
      } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {
        const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;
        this.body = data.slice(byteOffset, byteOffset + chunkLength);
      }

      // Clients must ignore chunks with unknown types.

      chunkIndex += chunkLength;
    }
    if (this.content === null) {
      throw new Error('THREE.GLTFLoader: JSON content not found.');
    }
  }
}

/**
 * DRACO Mesh Compression Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
 */
class GLTFDracoMeshCompressionExtension {
  constructor(json, dracoLoader) {
    if (!dracoLoader) {
      throw new Error('THREE.GLTFLoader: No DRACOLoader instance provided.');
    }
    this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;
    this.json = json;
    this.dracoLoader = dracoLoader;
    this.dracoLoader.preload();
  }
  decodePrimitive(primitive, parser) {
    const json = this.json;
    const dracoLoader = this.dracoLoader;
    const bufferViewIndex = primitive.extensions[this.name].bufferView;
    const gltfAttributeMap = primitive.extensions[this.name].attributes;
    const threeAttributeMap = {};
    const attributeNormalizedMap = {};
    const attributeTypeMap = {};
    for (const attributeName in gltfAttributeMap) {
      const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();
      threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName];
    }
    for (const attributeName in primitive.attributes) {
      const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();
      if (gltfAttributeMap[attributeName] !== undefined) {
        const accessorDef = json.accessors[primitive.attributes[attributeName]];
        const componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType];
        attributeTypeMap[threeAttributeName] = componentType.name;
        attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true;
      }
    }
    return parser.getDependency('bufferView', bufferViewIndex).then(function (bufferView) {
      return new Promise(function (resolve, reject) {
        dracoLoader.decodeDracoFile(bufferView, function (geometry) {
          for (const attributeName in geometry.attributes) {
            const attribute = geometry.attributes[attributeName];
            const normalized = attributeNormalizedMap[attributeName];
            if (normalized !== undefined) attribute.normalized = normalized;
          }
          resolve(geometry);
        }, threeAttributeMap, attributeTypeMap, LinearSRGBColorSpace$1, reject);
      });
    });
  }
}

/**
 * Texture Transform Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform
 */
class GLTFTextureTransformExtension {
  constructor() {
    this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;
  }
  extendTexture(texture, transform) {
    if ((transform.texCoord === undefined || transform.texCoord === texture.channel) && transform.offset === undefined && transform.rotation === undefined && transform.scale === undefined) {
      // See https://github.com/mrdoob/three.js/issues/21819.
      return texture;
    }
    texture = texture.clone();
    if (transform.texCoord !== undefined) {
      texture.channel = transform.texCoord;
    }
    if (transform.offset !== undefined) {
      texture.offset.fromArray(transform.offset);
    }
    if (transform.rotation !== undefined) {
      texture.rotation = transform.rotation;
    }
    if (transform.scale !== undefined) {
      texture.repeat.fromArray(transform.scale);
    }
    texture.needsUpdate = true;
    return texture;
  }
}

/**
 * Mesh Quantization Extension
 *
 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization
 */
class GLTFMeshQuantizationExtension {
  constructor() {
    this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;
  }
}

/*********************************/
/********** INTERPOLATION ********/
/*********************************/

// Spline Interpolation
// Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation
class GLTFCubicSplineInterpolant extends Interpolant {
  constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
    super(parameterPositions, sampleValues, sampleSize, resultBuffer);
  }
  copySampleValue_(index) {
    // Copies a sample value to the result buffer. See description of glTF
    // CUBICSPLINE values layout in interpolate_() function below.

    const result = this.resultBuffer,
      values = this.sampleValues,
      valueSize = this.valueSize,
      offset = index * valueSize * 3 + valueSize;
    for (let i = 0; i !== valueSize; i++) {
      result[i] = values[offset + i];
    }
    return result;
  }
  interpolate_(i1, t0, t, t1) {
    const result = this.resultBuffer;
    const values = this.sampleValues;
    const stride = this.valueSize;
    const stride2 = stride * 2;
    const stride3 = stride * 3;
    const td = t1 - t0;
    const p = (t - t0) / td;
    const pp = p * p;
    const ppp = pp * p;
    const offset1 = i1 * stride3;
    const offset0 = offset1 - stride3;
    const s2 = -2 * ppp + 3 * pp;
    const s3 = ppp - pp;
    const s0 = 1 - s2;
    const s1 = s3 - pp + p;

    // Layout of keyframe output values for CUBICSPLINE animations:
    //   [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
    for (let i = 0; i !== stride; i++) {
      const p0 = values[offset0 + i + stride]; // splineVertex_k
      const m0 = values[offset0 + i + stride2] * td; // outTangent_k * (t_k+1 - t_k)
      const p1 = values[offset1 + i + stride]; // splineVertex_k+1
      const m1 = values[offset1 + i] * td; // inTangent_k+1 * (t_k+1 - t_k)

      result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
    }
    return result;
  }
}
const _q$1 = new Quaternion$1();
class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
  interpolate_(i1, t0, t, t1) {
    const result = super.interpolate_(i1, t0, t, t1);
    _q$1.fromArray(result).normalize().toArray(result);
    return result;
  }
}

/*********************************/
/********** INTERNALS ************/
/*********************************/

/* CONSTANTS */

const WEBGL_CONSTANTS = {
  FLOAT: 5126,
  //FLOAT_MAT2: 35674,
  FLOAT_MAT3: 35675,
  FLOAT_MAT4: 35676,
  FLOAT_VEC2: 35664,
  FLOAT_VEC3: 35665,
  FLOAT_VEC4: 35666,
  LINEAR: 9729,
  REPEAT: 10497,
  SAMPLER_2D: 35678,
  POINTS: 0,
  LINES: 1,
  LINE_LOOP: 2,
  LINE_STRIP: 3,
  TRIANGLES: 4,
  TRIANGLE_STRIP: 5,
  TRIANGLE_FAN: 6,
  UNSIGNED_BYTE: 5121,
  UNSIGNED_SHORT: 5123
};
const WEBGL_COMPONENT_TYPES = {
  5120: Int8Array,
  5121: Uint8Array,
  5122: Int16Array,
  5123: Uint16Array,
  5125: Uint32Array,
  5126: Float32Array
};
const WEBGL_FILTERS = {
  9728: NearestFilter$1,
  9729: LinearFilter$1,
  9984: NearestMipmapNearestFilter,
  9985: LinearMipmapNearestFilter,
  9986: NearestMipmapLinearFilter,
  9987: LinearMipmapLinearFilter$1
};
const WEBGL_WRAPPINGS = {
  33071: ClampToEdgeWrapping$1,
  33648: MirroredRepeatWrapping$1,
  10497: RepeatWrapping$1
};
const WEBGL_TYPE_SIZES = {
  'SCALAR': 1,
  'VEC2': 2,
  'VEC3': 3,
  'VEC4': 4,
  'MAT2': 4,
  'MAT3': 9,
  'MAT4': 16
};
const ATTRIBUTES = {
  POSITION: 'position',
  NORMAL: 'normal',
  TANGENT: 'tangent',
  TEXCOORD_0: 'uv',
  TEXCOORD_1: 'uv1',
  TEXCOORD_2: 'uv2',
  TEXCOORD_3: 'uv3',
  COLOR_0: 'color',
  WEIGHTS_0: 'skinWeight',
  JOINTS_0: 'skinIndex'
};
const PATH_PROPERTIES = {
  scale: 'scale',
  translation: 'position',
  rotation: 'quaternion',
  weights: 'morphTargetInfluences'
};
const INTERPOLATION = {
  CUBICSPLINE: undefined,
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
  // keyframe track will be initialized with a default interpolation type, then modified.
  LINEAR: InterpolateLinear,
  STEP: InterpolateDiscrete
};
const ALPHA_MODES = {
  OPAQUE: 'OPAQUE',
  MASK: 'MASK',
  BLEND: 'BLEND'
};

/**
 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
 */
function createDefaultMaterial(cache) {
  if (cache['DefaultMaterial'] === undefined) {
    cache['DefaultMaterial'] = new MeshStandardMaterial({
      color: 0xFFFFFF,
      emissive: 0x000000,
      metalness: 1,
      roughness: 1,
      transparent: false,
      depthTest: true,
      side: FrontSide$1
    });
  }
  return cache['DefaultMaterial'];
}
function addUnknownExtensionsToUserData(knownExtensions, object, objectDef) {
  // Add unknown glTF extensions to an object's userData.

  for (const name in objectDef.extensions) {
    if (knownExtensions[name] === undefined) {
      object.userData.gltfExtensions = object.userData.gltfExtensions || {};
      object.userData.gltfExtensions[name] = objectDef.extensions[name];
    }
  }
}

/**
 * @param {Object3D|Material|BufferGeometry} object
 * @param {GLTF.definition} gltfDef
 */
function assignExtrasToUserData(object, gltfDef) {
  if (gltfDef.extras !== undefined) {
    if (typeof gltfDef.extras === 'object') {
      Object.assign(object.userData, gltfDef.extras);
    } else {
      console.warn('THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras);
    }
  }
}

/**
 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets
 *
 * @param {BufferGeometry} geometry
 * @param {Array<GLTF.Target>} targets
 * @param {GLTFParser} parser
 * @return {Promise<BufferGeometry>}
 */
function addMorphTargets(geometry, targets, parser) {
  let hasMorphPosition = false;
  let hasMorphNormal = false;
  let hasMorphColor = false;
  for (let i = 0, il = targets.length; i < il; i++) {
    const target = targets[i];
    if (target.POSITION !== undefined) hasMorphPosition = true;
    if (target.NORMAL !== undefined) hasMorphNormal = true;
    if (target.COLOR_0 !== undefined) hasMorphColor = true;
    if (hasMorphPosition && hasMorphNormal && hasMorphColor) break;
  }
  if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor) return Promise.resolve(geometry);
  const pendingPositionAccessors = [];
  const pendingNormalAccessors = [];
  const pendingColorAccessors = [];
  for (let i = 0, il = targets.length; i < il; i++) {
    const target = targets[i];
    if (hasMorphPosition) {
      const pendingAccessor = target.POSITION !== undefined ? parser.getDependency('accessor', target.POSITION) : geometry.attributes.position;
      pendingPositionAccessors.push(pendingAccessor);
    }
    if (hasMorphNormal) {
      const pendingAccessor = target.NORMAL !== undefined ? parser.getDependency('accessor', target.NORMAL) : geometry.attributes.normal;
      pendingNormalAccessors.push(pendingAccessor);
    }
    if (hasMorphColor) {
      const pendingAccessor = target.COLOR_0 !== undefined ? parser.getDependency('accessor', target.COLOR_0) : geometry.attributes.color;
      pendingColorAccessors.push(pendingAccessor);
    }
  }
  return Promise.all([Promise.all(pendingPositionAccessors), Promise.all(pendingNormalAccessors), Promise.all(pendingColorAccessors)]).then(function (accessors) {
    const morphPositions = accessors[0];
    const morphNormals = accessors[1];
    const morphColors = accessors[2];
    if (hasMorphPosition) geometry.morphAttributes.position = morphPositions;
    if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals;
    if (hasMorphColor) geometry.morphAttributes.color = morphColors;
    geometry.morphTargetsRelative = true;
    return geometry;
  });
}

/**
 * @param {Mesh} mesh
 * @param {GLTF.Mesh} meshDef
 */
function updateMorphTargets(mesh, meshDef) {
  mesh.updateMorphTargets();
  if (meshDef.weights !== undefined) {
    for (let i = 0, il = meshDef.weights.length; i < il; i++) {
      mesh.morphTargetInfluences[i] = meshDef.weights[i];
    }
  }

  // .extras has user-defined data, so check that .extras.targetNames is an array.
  if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) {
    const targetNames = meshDef.extras.targetNames;
    if (mesh.morphTargetInfluences.length === targetNames.length) {
      mesh.morphTargetDictionary = {};
      for (let i = 0, il = targetNames.length; i < il; i++) {
        mesh.morphTargetDictionary[targetNames[i]] = i;
      }
    } else {
      console.warn('THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.');
    }
  }
}
function createPrimitiveKey(primitiveDef) {
  let geometryKey;
  const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];
  if (dracoExtension) {
    geometryKey = 'draco:' + dracoExtension.bufferView + ':' + dracoExtension.indices + ':' + createAttributesKey(dracoExtension.attributes);
  } else {
    geometryKey = primitiveDef.indices + ':' + createAttributesKey(primitiveDef.attributes) + ':' + primitiveDef.mode;
  }
  if (primitiveDef.targets !== undefined) {
    for (let i = 0, il = primitiveDef.targets.length; i < il; i++) {
      geometryKey += ':' + createAttributesKey(primitiveDef.targets[i]);
    }
  }
  return geometryKey;
}
function createAttributesKey(attributes) {
  let attributesKey = '';
  const keys = Object.keys(attributes).sort();
  for (let i = 0, il = keys.length; i < il; i++) {
    attributesKey += keys[i] + ':' + attributes[keys[i]] + ';';
  }
  return attributesKey;
}
function getNormalizedComponentScale(constructor) {
  // Reference:
  // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data

  switch (constructor) {
    case Int8Array:
      return 1 / 127;
    case Uint8Array:
      return 1 / 255;
    case Int16Array:
      return 1 / 32767;
    case Uint16Array:
      return 1 / 65535;
    default:
      throw new Error('THREE.GLTFLoader: Unsupported normalized accessor component type.');
  }
}
function getImageURIMimeType(uri) {
  if (uri.search(/\.jpe?g($|\?)/i) > 0 || uri.search(/^data\:image\/jpeg/) === 0) return 'image/jpeg';
  if (uri.search(/\.webp($|\?)/i) > 0 || uri.search(/^data\:image\/webp/) === 0) return 'image/webp';
  return 'image/png';
}
const _identityMatrix = new Matrix4$1();

/* GLTF PARSER */

class GLTFParser {
  constructor(json = {}, options = {}) {
    this.json = json;
    this.extensions = {};
    this.plugins = {};
    this.options = options;

    // loader object cache
    this.cache = new GLTFRegistry();

    // associations between Three.js objects and glTF elements
    this.associations = new Map();

    // BufferGeometry caching
    this.primitiveCache = {};

    // Node cache
    this.nodeCache = {};

    // Object3D instance caches
    this.meshCache = {
      refs: {},
      uses: {}
    };
    this.cameraCache = {
      refs: {},
      uses: {}
    };
    this.lightCache = {
      refs: {},
      uses: {}
    };
    this.sourceCache = {};
    this.textureCache = {};

    // Track node names, to ensure no duplicates
    this.nodeNamesUsed = {};

    // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
    // expensive work of uploading a texture to the GPU off the main thread.

    let isSafari = false;
    let safariVersion = -1;
    let isFirefox = false;
    let firefoxVersion = -1;
    if (typeof navigator !== 'undefined') {
      const userAgent = navigator.userAgent;
      isSafari = /^((?!chrome|android).)*safari/i.test(userAgent) === true;
      const safariMatch = userAgent.match(/Version\/(\d+)/);
      safariVersion = isSafari && safariMatch ? parseInt(safariMatch[1], 10) : -1;
      isFirefox = userAgent.indexOf('Firefox') > -1;
      firefoxVersion = isFirefox ? userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1;
    }
    if (typeof createImageBitmap === 'undefined' || isSafari && safariVersion < 17 || isFirefox && firefoxVersion < 98) {
      this.textureLoader = new TextureLoader(this.options.manager);
    } else {
      this.textureLoader = new ImageBitmapLoader(this.options.manager);
    }
    this.textureLoader.setCrossOrigin(this.options.crossOrigin);
    this.textureLoader.setRequestHeader(this.options.requestHeader);
    this.fileLoader = new FileLoader(this.options.manager);
    this.fileLoader.setResponseType('arraybuffer');
    if (this.options.crossOrigin === 'use-credentials') {
      this.fileLoader.setWithCredentials(true);
    }
  }
  setExtensions(extensions) {
    this.extensions = extensions;
  }
  setPlugins(plugins) {
    this.plugins = plugins;
  }
  parse(onLoad, onError) {
    const parser = this;
    const json = this.json;
    const extensions = this.extensions;

    // Clear the loader cache
    this.cache.removeAll();
    this.nodeCache = {};

    // Mark the special nodes/meshes in json for efficient parse
    this._invokeAll(function (ext) {
      return ext._markDefs && ext._markDefs();
    });
    Promise.all(this._invokeAll(function (ext) {
      return ext.beforeRoot && ext.beforeRoot();
    })).then(function () {
      return Promise.all([parser.getDependencies('scene'), parser.getDependencies('animation'), parser.getDependencies('camera')]);
    }).then(function (dependencies) {
      const result = {
        scene: dependencies[0][json.scene || 0],
        scenes: dependencies[0],
        animations: dependencies[1],
        cameras: dependencies[2],
        asset: json.asset,
        parser: parser,
        userData: {}
      };
      addUnknownExtensionsToUserData(extensions, result, json);
      assignExtrasToUserData(result, json);
      return Promise.all(parser._invokeAll(function (ext) {
        return ext.afterRoot && ext.afterRoot(result);
      })).then(function () {
        for (const scene of result.scenes) {
          scene.updateMatrixWorld();
        }
        onLoad(result);
      });
    }).catch(onError);
  }

  /**
   * Marks the special nodes/meshes in json for efficient parse.
   */
  _markDefs() {
    const nodeDefs = this.json.nodes || [];
    const skinDefs = this.json.skins || [];
    const meshDefs = this.json.meshes || [];

    // Nothing in the node definition indicates whether it is a Bone or an
    // Object3D. Use the skins' joint references to mark bones.
    for (let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) {
      const joints = skinDefs[skinIndex].joints;
      for (let i = 0, il = joints.length; i < il; i++) {
        nodeDefs[joints[i]].isBone = true;
      }
    }

    // Iterate over all nodes, marking references to shared resources,
    // as well as skeleton joints.
    for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {
      const nodeDef = nodeDefs[nodeIndex];
      if (nodeDef.mesh !== undefined) {
        this._addNodeRef(this.meshCache, nodeDef.mesh);

        // Nothing in the mesh definition indicates whether it is
        // a SkinnedMesh or Mesh. Use the node's mesh reference
        // to mark SkinnedMesh if node has skin.
        if (nodeDef.skin !== undefined) {
          meshDefs[nodeDef.mesh].isSkinnedMesh = true;
        }
      }
      if (nodeDef.camera !== undefined) {
        this._addNodeRef(this.cameraCache, nodeDef.camera);
      }
    }
  }

  /**
   * Counts references to shared node / Object3D resources. These resources
   * can be reused, or "instantiated", at multiple nodes in the scene
   * hierarchy. Mesh, Camera, and Light instances are instantiated and must
   * be marked. Non-scenegraph resources (like Materials, Geometries, and
   * Textures) can be reused directly and are not marked here.
   *
   * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
   */
  _addNodeRef(cache, index) {
    if (index === undefined) return;
    if (cache.refs[index] === undefined) {
      cache.refs[index] = cache.uses[index] = 0;
    }
    cache.refs[index]++;
  }

  /** Returns a reference to a shared resource, cloning it if necessary. */
  _getNodeRef(cache, index, object) {
    if (cache.refs[index] <= 1) return object;
    const ref = object.clone();

    // Propagates mappings to the cloned object, prevents mappings on the
    // original object from being lost.
    const updateMappings = (original, clone) => {
      const mappings = this.associations.get(original);
      if (mappings != null) {
        this.associations.set(clone, mappings);
      }
      for (const [i, child] of original.children.entries()) {
        updateMappings(child, clone.children[i]);
      }
    };
    updateMappings(object, ref);
    ref.name += '_instance_' + cache.uses[index]++;
    return ref;
  }
  _invokeOne(func) {
    const extensions = Object.values(this.plugins);
    extensions.push(this);
    for (let i = 0; i < extensions.length; i++) {
      const result = func(extensions[i]);
      if (result) return result;
    }
    return null;
  }
  _invokeAll(func) {
    const extensions = Object.values(this.plugins);
    extensions.unshift(this);
    const pending = [];
    for (let i = 0; i < extensions.length; i++) {
      const result = func(extensions[i]);
      if (result) pending.push(result);
    }
    return pending;
  }

  /**
   * Requests the specified dependency asynchronously, with caching.
   * @param {string} type
   * @param {number} index
   * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
   */
  getDependency(type, index) {
    const cacheKey = type + ':' + index;
    let dependency = this.cache.get(cacheKey);
    if (!dependency) {
      switch (type) {
        case 'scene':
          dependency = this.loadScene(index);
          break;
        case 'node':
          dependency = this._invokeOne(function (ext) {
            return ext.loadNode && ext.loadNode(index);
          });
          break;
        case 'mesh':
          dependency = this._invokeOne(function (ext) {
            return ext.loadMesh && ext.loadMesh(index);
          });
          break;
        case 'accessor':
          dependency = this.loadAccessor(index);
          break;
        case 'bufferView':
          dependency = this._invokeOne(function (ext) {
            return ext.loadBufferView && ext.loadBufferView(index);
          });
          break;
        case 'buffer':
          dependency = this.loadBuffer(index);
          break;
        case 'material':
          dependency = this._invokeOne(function (ext) {
            return ext.loadMaterial && ext.loadMaterial(index);
          });
          break;
        case 'texture':
          dependency = this._invokeOne(function (ext) {
            return ext.loadTexture && ext.loadTexture(index);
          });
          break;
        case 'skin':
          dependency = this.loadSkin(index);
          break;
        case 'animation':
          dependency = this._invokeOne(function (ext) {
            return ext.loadAnimation && ext.loadAnimation(index);
          });
          break;
        case 'camera':
          dependency = this.loadCamera(index);
          break;
        default:
          dependency = this._invokeOne(function (ext) {
            return ext != this && ext.getDependency && ext.getDependency(type, index);
          });
          if (!dependency) {
            throw new Error('Unknown type: ' + type);
          }
          break;
      }
      this.cache.add(cacheKey, dependency);
    }
    return dependency;
  }

  /**
   * Requests all dependencies of the specified type asynchronously, with caching.
   * @param {string} type
   * @return {Promise<Array<Object>>}
   */
  getDependencies(type) {
    let dependencies = this.cache.get(type);
    if (!dependencies) {
      const parser = this;
      const defs = this.json[type + (type === 'mesh' ? 'es' : 's')] || [];
      dependencies = Promise.all(defs.map(function (def, index) {
        return parser.getDependency(type, index);
      }));
      this.cache.add(type, dependencies);
    }
    return dependencies;
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
   * @param {number} bufferIndex
   * @return {Promise<ArrayBuffer>}
   */
  loadBuffer(bufferIndex) {
    const bufferDef = this.json.buffers[bufferIndex];
    const loader = this.fileLoader;
    if (bufferDef.type && bufferDef.type !== 'arraybuffer') {
      throw new Error('THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.');
    }

    // If present, GLB container is required to be the first buffer.
    if (bufferDef.uri === undefined && bufferIndex === 0) {
      return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body);
    }
    const options = this.options;
    return new Promise(function (resolve, reject) {
      loader.load(LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, undefined, function () {
        reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".'));
      });
    });
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
   * @param {number} bufferViewIndex
   * @return {Promise<ArrayBuffer>}
   */
  loadBufferView(bufferViewIndex) {
    const bufferViewDef = this.json.bufferViews[bufferViewIndex];
    return this.getDependency('buffer', bufferViewDef.buffer).then(function (buffer) {
      const byteLength = bufferViewDef.byteLength || 0;
      const byteOffset = bufferViewDef.byteOffset || 0;
      return buffer.slice(byteOffset, byteOffset + byteLength);
    });
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
   * @param {number} accessorIndex
   * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
   */
  loadAccessor(accessorIndex) {
    const parser = this;
    const json = this.json;
    const accessorDef = this.json.accessors[accessorIndex];
    if (accessorDef.bufferView === undefined && accessorDef.sparse === undefined) {
      const itemSize = WEBGL_TYPE_SIZES[accessorDef.type];
      const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];
      const normalized = accessorDef.normalized === true;
      const array = new TypedArray(accessorDef.count * itemSize);
      return Promise.resolve(new BufferAttribute$1(array, itemSize, normalized));
    }
    const pendingBufferViews = [];
    if (accessorDef.bufferView !== undefined) {
      pendingBufferViews.push(this.getDependency('bufferView', accessorDef.bufferView));
    } else {
      pendingBufferViews.push(null);
    }
    if (accessorDef.sparse !== undefined) {
      pendingBufferViews.push(this.getDependency('bufferView', accessorDef.sparse.indices.bufferView));
      pendingBufferViews.push(this.getDependency('bufferView', accessorDef.sparse.values.bufferView));
    }
    return Promise.all(pendingBufferViews).then(function (bufferViews) {
      const bufferView = bufferViews[0];
      const itemSize = WEBGL_TYPE_SIZES[accessorDef.type];
      const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];

      // For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.
      const elementBytes = TypedArray.BYTES_PER_ELEMENT;
      const itemBytes = elementBytes * itemSize;
      const byteOffset = accessorDef.byteOffset || 0;
      const byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[accessorDef.bufferView].byteStride : undefined;
      const normalized = accessorDef.normalized === true;
      let array, bufferAttribute;

      // The buffer is not interleaved if the stride is the item size in bytes.
      if (byteStride && byteStride !== itemBytes) {
        // Each "slice" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer
        // This makes sure that IBA.count reflects accessor.count properly
        const ibSlice = Math.floor(byteOffset / byteStride);
        const ibCacheKey = 'InterleavedBuffer:' + accessorDef.bufferView + ':' + accessorDef.componentType + ':' + ibSlice + ':' + accessorDef.count;
        let ib = parser.cache.get(ibCacheKey);
        if (!ib) {
          array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes);

          // Integer parameters to IB/IBA are in array elements, not bytes.
          ib = new InterleavedBuffer$1(array, byteStride / elementBytes);
          parser.cache.add(ibCacheKey, ib);
        }
        bufferAttribute = new InterleavedBufferAttribute$1(ib, itemSize, byteOffset % byteStride / elementBytes, normalized);
      } else {
        if (bufferView === null) {
          array = new TypedArray(accessorDef.count * itemSize);
        } else {
          array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize);
        }
        bufferAttribute = new BufferAttribute$1(array, itemSize, normalized);
      }

      // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors
      if (accessorDef.sparse !== undefined) {
        const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;
        const TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType];
        const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;
        const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;
        const sparseIndices = new TypedArrayIndices(bufferViews[1], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices);
        const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize);
        if (bufferView !== null) {
          // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.
          bufferAttribute = new BufferAttribute$1(bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized);
        }
        for (let i = 0, il = sparseIndices.length; i < il; i++) {
          const index = sparseIndices[i];
          bufferAttribute.setX(index, sparseValues[i * itemSize]);
          if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]);
          if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]);
          if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);
          if (itemSize >= 5) throw new Error('THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.');
        }
      }
      return bufferAttribute;
    });
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
   * @param {number} textureIndex
   * @return {Promise<THREE.Texture|null>}
   */
  loadTexture(textureIndex) {
    const json = this.json;
    const options = this.options;
    const textureDef = json.textures[textureIndex];
    const sourceIndex = textureDef.source;
    const sourceDef = json.images[sourceIndex];
    let loader = this.textureLoader;
    if (sourceDef.uri) {
      const handler = options.manager.getHandler(sourceDef.uri);
      if (handler !== null) loader = handler;
    }
    return this.loadTextureImage(textureIndex, sourceIndex, loader);
  }
  loadTextureImage(textureIndex, sourceIndex, loader) {
    const parser = this;
    const json = this.json;
    const textureDef = json.textures[textureIndex];
    const sourceDef = json.images[sourceIndex];
    const cacheKey = (sourceDef.uri || sourceDef.bufferView) + ':' + textureDef.sampler;
    if (this.textureCache[cacheKey]) {
      // See https://github.com/mrdoob/three.js/issues/21559.
      return this.textureCache[cacheKey];
    }
    const promise = this.loadImageSource(sourceIndex, loader).then(function (texture) {
      texture.flipY = false;
      texture.name = textureDef.name || sourceDef.name || '';
      if (texture.name === '' && typeof sourceDef.uri === 'string' && sourceDef.uri.startsWith('data:image/') === false) {
        texture.name = sourceDef.uri;
      }
      const samplers = json.samplers || {};
      const sampler = samplers[textureDef.sampler] || {};
      texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || LinearFilter$1;
      texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || LinearMipmapLinearFilter$1;
      texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || RepeatWrapping$1;
      texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || RepeatWrapping$1;
      parser.associations.set(texture, {
        textures: textureIndex
      });
      return texture;
    }).catch(function () {
      return null;
    });
    this.textureCache[cacheKey] = promise;
    return promise;
  }
  loadImageSource(sourceIndex, loader) {
    const parser = this;
    const json = this.json;
    const options = this.options;
    if (this.sourceCache[sourceIndex] !== undefined) {
      return this.sourceCache[sourceIndex].then(texture => texture.clone());
    }
    const sourceDef = json.images[sourceIndex];
    const URL = self.URL || self.webkitURL;
    let sourceURI = sourceDef.uri || '';
    let isObjectURL = false;
    if (sourceDef.bufferView !== undefined) {
      // Load binary image data from bufferView, if provided.

      sourceURI = parser.getDependency('bufferView', sourceDef.bufferView).then(function (bufferView) {
        isObjectURL = true;
        const blob = new Blob([bufferView], {
          type: sourceDef.mimeType
        });
        sourceURI = URL.createObjectURL(blob);
        return sourceURI;
      });
    } else if (sourceDef.uri === undefined) {
      throw new Error('THREE.GLTFLoader: Image ' + sourceIndex + ' is missing URI and bufferView');
    }
    const promise = Promise.resolve(sourceURI).then(function (sourceURI) {
      return new Promise(function (resolve, reject) {
        let onLoad = resolve;
        if (loader.isImageBitmapLoader === true) {
          onLoad = function (imageBitmap) {
            const texture = new Texture$1(imageBitmap);
            texture.needsUpdate = true;
            resolve(texture);
          };
        }
        loader.load(LoaderUtils.resolveURL(sourceURI, options.path), onLoad, undefined, reject);
      });
    }).then(function (texture) {
      // Clean up resources and configure Texture.

      if (isObjectURL === true) {
        URL.revokeObjectURL(sourceURI);
      }
      assignExtrasToUserData(texture, sourceDef);
      texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri);
      return texture;
    }).catch(function (error) {
      console.error('THREE.GLTFLoader: Couldn\'t load texture', sourceURI);
      throw error;
    });
    this.sourceCache[sourceIndex] = promise;
    return promise;
  }

  /**
   * Asynchronously assigns a texture to the given material parameters.
   * @param {Object} materialParams
   * @param {string} mapName
   * @param {Object} mapDef
   * @return {Promise<Texture>}
   */
  assignTexture(materialParams, mapName, mapDef, colorSpace) {
    const parser = this;
    return this.getDependency('texture', mapDef.index).then(function (texture) {
      if (!texture) return null;
      if (mapDef.texCoord !== undefined && mapDef.texCoord > 0) {
        texture = texture.clone();
        texture.channel = mapDef.texCoord;
      }
      if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) {
        const transform = mapDef.extensions !== undefined ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : undefined;
        if (transform) {
          const gltfReference = parser.associations.get(texture);
          texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform);
          parser.associations.set(texture, gltfReference);
        }
      }
      if (colorSpace !== undefined) {
        texture.colorSpace = colorSpace;
      }
      materialParams[mapName] = texture;
      return texture;
    });
  }

  /**
   * Assigns final material to a Mesh, Line, or Points instance. The instance
   * already has a material (generated from the glTF material options alone)
   * but reuse of the same glTF material may require multiple threejs materials
   * to accommodate different primitive types, defines, etc. New materials will
   * be created if necessary, and reused from a cache.
   * @param  {Object3D} mesh Mesh, Line, or Points instance.
   */
  assignFinalMaterial(mesh) {
    const geometry = mesh.geometry;
    let material = mesh.material;
    const useDerivativeTangents = geometry.attributes.tangent === undefined;
    const useVertexColors = geometry.attributes.color !== undefined;
    const useFlatShading = geometry.attributes.normal === undefined;
    if (mesh.isPoints) {
      const cacheKey = 'PointsMaterial:' + material.uuid;
      let pointsMaterial = this.cache.get(cacheKey);
      if (!pointsMaterial) {
        pointsMaterial = new PointsMaterial();
        Material$1.prototype.copy.call(pointsMaterial, material);
        pointsMaterial.color.copy(material.color);
        pointsMaterial.map = material.map;
        pointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px

        this.cache.add(cacheKey, pointsMaterial);
      }
      material = pointsMaterial;
    } else if (mesh.isLine) {
      const cacheKey = 'LineBasicMaterial:' + material.uuid;
      let lineMaterial = this.cache.get(cacheKey);
      if (!lineMaterial) {
        lineMaterial = new LineBasicMaterial();
        Material$1.prototype.copy.call(lineMaterial, material);
        lineMaterial.color.copy(material.color);
        lineMaterial.map = material.map;
        this.cache.add(cacheKey, lineMaterial);
      }
      material = lineMaterial;
    }

    // Clone the material if it will be modified
    if (useDerivativeTangents || useVertexColors || useFlatShading) {
      let cacheKey = 'ClonedMaterial:' + material.uuid + ':';
      if (useDerivativeTangents) cacheKey += 'derivative-tangents:';
      if (useVertexColors) cacheKey += 'vertex-colors:';
      if (useFlatShading) cacheKey += 'flat-shading:';
      let cachedMaterial = this.cache.get(cacheKey);
      if (!cachedMaterial) {
        cachedMaterial = material.clone();
        if (useVertexColors) cachedMaterial.vertexColors = true;
        if (useFlatShading) cachedMaterial.flatShading = true;
        if (useDerivativeTangents) {
          // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
          if (cachedMaterial.normalScale) cachedMaterial.normalScale.y *= -1;
          if (cachedMaterial.clearcoatNormalScale) cachedMaterial.clearcoatNormalScale.y *= -1;
        }
        this.cache.add(cacheKey, cachedMaterial);
        this.associations.set(cachedMaterial, this.associations.get(material));
      }
      material = cachedMaterial;
    }
    mesh.material = material;
  }
  getMaterialType(/* materialIndex */
  ) {
    return MeshStandardMaterial;
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
   * @param {number} materialIndex
   * @return {Promise<Material>}
   */
  loadMaterial(materialIndex) {
    const parser = this;
    const json = this.json;
    const extensions = this.extensions;
    const materialDef = json.materials[materialIndex];
    let materialType;
    const materialParams = {};
    const materialExtensions = materialDef.extensions || {};
    const pending = [];
    if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) {
      const kmuExtension = extensions[EXTENSIONS.KHR_MATERIALS_UNLIT];
      materialType = kmuExtension.getMaterialType();
      pending.push(kmuExtension.extendParams(materialParams, materialDef, parser));
    } else {
      // Specification:
      // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material

      const metallicRoughness = materialDef.pbrMetallicRoughness || {};
      materialParams.color = new Color$1(1.0, 1.0, 1.0);
      materialParams.opacity = 1.0;
      if (Array.isArray(metallicRoughness.baseColorFactor)) {
        const array = metallicRoughness.baseColorFactor;
        materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace$1);
        materialParams.opacity = array[3];
      }
      if (metallicRoughness.baseColorTexture !== undefined) {
        pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace$1));
      }
      materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;
      materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;
      if (metallicRoughness.metallicRoughnessTexture !== undefined) {
        pending.push(parser.assignTexture(materialParams, 'metalnessMap', metallicRoughness.metallicRoughnessTexture));
        pending.push(parser.assignTexture(materialParams, 'roughnessMap', metallicRoughness.metallicRoughnessTexture));
      }
      materialType = this._invokeOne(function (ext) {
        return ext.getMaterialType && ext.getMaterialType(materialIndex);
      });
      pending.push(Promise.all(this._invokeAll(function (ext) {
        return ext.extendMaterialParams && ext.extendMaterialParams(materialIndex, materialParams);
      })));
    }
    if (materialDef.doubleSided === true) {
      materialParams.side = DoubleSide;
    }
    const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;
    if (alphaMode === ALPHA_MODES.BLEND) {
      materialParams.transparent = true;

      // See: https://github.com/mrdoob/three.js/issues/17706
      materialParams.depthWrite = false;
    } else {
      materialParams.transparent = false;
      if (alphaMode === ALPHA_MODES.MASK) {
        materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
      }
    }
    if (materialDef.normalTexture !== undefined && materialType !== MeshBasicMaterial$1) {
      pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture));
      materialParams.normalScale = new Vector2$1(1, 1);
      if (materialDef.normalTexture.scale !== undefined) {
        const scale = materialDef.normalTexture.scale;
        materialParams.normalScale.set(scale, scale);
      }
    }
    if (materialDef.occlusionTexture !== undefined && materialType !== MeshBasicMaterial$1) {
      pending.push(parser.assignTexture(materialParams, 'aoMap', materialDef.occlusionTexture));
      if (materialDef.occlusionTexture.strength !== undefined) {
        materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;
      }
    }
    if (materialDef.emissiveFactor !== undefined && materialType !== MeshBasicMaterial$1) {
      const emissiveFactor = materialDef.emissiveFactor;
      materialParams.emissive = new Color$1().setRGB(emissiveFactor[0], emissiveFactor[1], emissiveFactor[2], LinearSRGBColorSpace$1);
    }
    if (materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial$1) {
      pending.push(parser.assignTexture(materialParams, 'emissiveMap', materialDef.emissiveTexture, SRGBColorSpace$1));
    }
    return Promise.all(pending).then(function () {
      const material = new materialType(materialParams);
      if (materialDef.name) material.name = materialDef.name;
      assignExtrasToUserData(material, materialDef);
      parser.associations.set(material, {
        materials: materialIndex
      });
      if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef);
      return material;
    });
  }

  /** When Object3D instances are targeted by animation, they need unique names. */
  createUniqueName(originalName) {
    const sanitizedName = PropertyBinding.sanitizeNodeName(originalName || '');
    if (sanitizedName in this.nodeNamesUsed) {
      return sanitizedName + '_' + ++this.nodeNamesUsed[sanitizedName];
    } else {
      this.nodeNamesUsed[sanitizedName] = 0;
      return sanitizedName;
    }
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
   *
   * Creates BufferGeometries from primitives.
   *
   * @param {Array<GLTF.Primitive>} primitives
   * @return {Promise<Array<BufferGeometry>>}
   */
  loadGeometries(primitives) {
    const parser = this;
    const extensions = this.extensions;
    const cache = this.primitiveCache;
    function createDracoPrimitive(primitive) {
      return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function (geometry) {
        return addPrimitiveAttributes(geometry, primitive, parser);
      });
    }
    const pending = [];
    for (let i = 0, il = primitives.length; i < il; i++) {
      const primitive = primitives[i];
      const cacheKey = createPrimitiveKey(primitive);

      // See if we've already created this geometry
      const cached = cache[cacheKey];
      if (cached) {
        // Use the cached geometry if it exists
        pending.push(cached.promise);
      } else {
        let geometryPromise;
        if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) {
          // Use DRACO geometry if available
          geometryPromise = createDracoPrimitive(primitive);
        } else {
          // Otherwise create a new geometry
          geometryPromise = addPrimitiveAttributes(new BufferGeometry$1(), primitive, parser);
        }

        // Cache this geometry
        cache[cacheKey] = {
          primitive: primitive,
          promise: geometryPromise
        };
        pending.push(geometryPromise);
      }
    }
    return Promise.all(pending);
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
   * @param {number} meshIndex
   * @return {Promise<Group|Mesh|SkinnedMesh>}
   */
  loadMesh(meshIndex) {
    const parser = this;
    const json = this.json;
    const extensions = this.extensions;
    const meshDef = json.meshes[meshIndex];
    const primitives = meshDef.primitives;
    const pending = [];
    for (let i = 0, il = primitives.length; i < il; i++) {
      const material = primitives[i].material === undefined ? createDefaultMaterial(this.cache) : this.getDependency('material', primitives[i].material);
      pending.push(material);
    }
    pending.push(parser.loadGeometries(primitives));
    return Promise.all(pending).then(function (results) {
      const materials = results.slice(0, results.length - 1);
      const geometries = results[results.length - 1];
      const meshes = [];
      for (let i = 0, il = geometries.length; i < il; i++) {
        const geometry = geometries[i];
        const primitive = primitives[i];

        // 1. create Mesh

        let mesh;
        const material = materials[i];
        if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === undefined) {
          // .isSkinnedMesh isn't in glTF spec. See ._markDefs()
          mesh = meshDef.isSkinnedMesh === true ? new SkinnedMesh(geometry, material) : new Mesh$1(geometry, material);
          if (mesh.isSkinnedMesh === true) {
            // normalize skin weights to fix malformed assets (see #15319)
            mesh.normalizeSkinWeights();
          }
          if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) {
            mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleStripDrawMode);
          } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) {
            mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleFanDrawMode);
          }
        } else if (primitive.mode === WEBGL_CONSTANTS.LINES) {
          mesh = new LineSegments(geometry, material);
        } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) {
          mesh = new Line(geometry, material);
        } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) {
          mesh = new LineLoop(geometry, material);
        } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) {
          mesh = new Points(geometry, material);
        } else {
          throw new Error('THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode);
        }
        if (Object.keys(mesh.geometry.morphAttributes).length > 0) {
          updateMorphTargets(mesh, meshDef);
        }
        mesh.name = parser.createUniqueName(meshDef.name || 'mesh_' + meshIndex);
        assignExtrasToUserData(mesh, meshDef);
        if (primitive.extensions) addUnknownExtensionsToUserData(extensions, mesh, primitive);
        parser.assignFinalMaterial(mesh);
        meshes.push(mesh);
      }
      for (let i = 0, il = meshes.length; i < il; i++) {
        parser.associations.set(meshes[i], {
          meshes: meshIndex,
          primitives: i
        });
      }
      if (meshes.length === 1) {
        if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, meshes[0], meshDef);
        return meshes[0];
      }
      const group = new Group();
      if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, group, meshDef);
      parser.associations.set(group, {
        meshes: meshIndex
      });
      for (let i = 0, il = meshes.length; i < il; i++) {
        group.add(meshes[i]);
      }
      return group;
    });
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
   * @param {number} cameraIndex
   * @return {Promise<THREE.Camera>}
   */
  loadCamera(cameraIndex) {
    let camera;
    const cameraDef = this.json.cameras[cameraIndex];
    const params = cameraDef[cameraDef.type];
    if (!params) {
      console.warn('THREE.GLTFLoader: Missing camera parameters.');
      return;
    }
    if (cameraDef.type === 'perspective') {
      camera = new PerspectiveCamera$1(MathUtils$1.radToDeg(params.yfov), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6);
    } else if (cameraDef.type === 'orthographic') {
      camera = new OrthographicCamera$1(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar);
    }
    if (cameraDef.name) camera.name = this.createUniqueName(cameraDef.name);
    assignExtrasToUserData(camera, cameraDef);
    return Promise.resolve(camera);
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
   * @param {number} skinIndex
   * @return {Promise<Skeleton>}
   */
  loadSkin(skinIndex) {
    const skinDef = this.json.skins[skinIndex];
    const pending = [];
    for (let i = 0, il = skinDef.joints.length; i < il; i++) {
      pending.push(this._loadNodeShallow(skinDef.joints[i]));
    }
    if (skinDef.inverseBindMatrices !== undefined) {
      pending.push(this.getDependency('accessor', skinDef.inverseBindMatrices));
    } else {
      pending.push(null);
    }
    return Promise.all(pending).then(function (results) {
      const inverseBindMatrices = results.pop();
      const jointNodes = results;

      // Note that bones (joint nodes) may or may not be in the
      // scene graph at this time.

      const bones = [];
      const boneInverses = [];
      for (let i = 0, il = jointNodes.length; i < il; i++) {
        const jointNode = jointNodes[i];
        if (jointNode) {
          bones.push(jointNode);
          const mat = new Matrix4$1();
          if (inverseBindMatrices !== null) {
            mat.fromArray(inverseBindMatrices.array, i * 16);
          }
          boneInverses.push(mat);
        } else {
          console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', skinDef.joints[i]);
        }
      }
      return new Skeleton(bones, boneInverses);
    });
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
   * @param {number} animationIndex
   * @return {Promise<AnimationClip>}
   */
  loadAnimation(animationIndex) {
    const json = this.json;
    const parser = this;
    const animationDef = json.animations[animationIndex];
    const animationName = animationDef.name ? animationDef.name : 'animation_' + animationIndex;
    const pendingNodes = [];
    const pendingInputAccessors = [];
    const pendingOutputAccessors = [];
    const pendingSamplers = [];
    const pendingTargets = [];
    for (let i = 0, il = animationDef.channels.length; i < il; i++) {
      const channel = animationDef.channels[i];
      const sampler = animationDef.samplers[channel.sampler];
      const target = channel.target;
      const name = target.node;
      const input = animationDef.parameters !== undefined ? animationDef.parameters[sampler.input] : sampler.input;
      const output = animationDef.parameters !== undefined ? animationDef.parameters[sampler.output] : sampler.output;
      if (target.node === undefined) continue;
      pendingNodes.push(this.getDependency('node', name));
      pendingInputAccessors.push(this.getDependency('accessor', input));
      pendingOutputAccessors.push(this.getDependency('accessor', output));
      pendingSamplers.push(sampler);
      pendingTargets.push(target);
    }
    return Promise.all([Promise.all(pendingNodes), Promise.all(pendingInputAccessors), Promise.all(pendingOutputAccessors), Promise.all(pendingSamplers), Promise.all(pendingTargets)]).then(function (dependencies) {
      const nodes = dependencies[0];
      const inputAccessors = dependencies[1];
      const outputAccessors = dependencies[2];
      const samplers = dependencies[3];
      const targets = dependencies[4];
      const tracks = [];
      for (let i = 0, il = nodes.length; i < il; i++) {
        const node = nodes[i];
        const inputAccessor = inputAccessors[i];
        const outputAccessor = outputAccessors[i];
        const sampler = samplers[i];
        const target = targets[i];
        if (node === undefined) continue;
        if (node.updateMatrix) {
          node.updateMatrix();
        }
        const createdTracks = parser._createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target);
        if (createdTracks) {
          for (let k = 0; k < createdTracks.length; k++) {
            tracks.push(createdTracks[k]);
          }
        }
      }
      return new AnimationClip(animationName, undefined, tracks);
    });
  }
  createNodeMesh(nodeIndex) {
    const json = this.json;
    const parser = this;
    const nodeDef = json.nodes[nodeIndex];
    if (nodeDef.mesh === undefined) return null;
    return parser.getDependency('mesh', nodeDef.mesh).then(function (mesh) {
      const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh);

      // if weights are provided on the node, override weights on the mesh.
      if (nodeDef.weights !== undefined) {
        node.traverse(function (o) {
          if (!o.isMesh) return;
          for (let i = 0, il = nodeDef.weights.length; i < il; i++) {
            o.morphTargetInfluences[i] = nodeDef.weights[i];
          }
        });
      }
      return node;
    });
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
   * @param {number} nodeIndex
   * @return {Promise<Object3D>}
   */
  loadNode(nodeIndex) {
    const json = this.json;
    const parser = this;
    const nodeDef = json.nodes[nodeIndex];
    const nodePending = parser._loadNodeShallow(nodeIndex);
    const childPending = [];
    const childrenDef = nodeDef.children || [];
    for (let i = 0, il = childrenDef.length; i < il; i++) {
      childPending.push(parser.getDependency('node', childrenDef[i]));
    }
    const skeletonPending = nodeDef.skin === undefined ? Promise.resolve(null) : parser.getDependency('skin', nodeDef.skin);
    return Promise.all([nodePending, Promise.all(childPending), skeletonPending]).then(function (results) {
      const node = results[0];
      const children = results[1];
      const skeleton = results[2];
      if (skeleton !== null) {
        // This full traverse should be fine because
        // child glTF nodes have not been added to this node yet.
        node.traverse(function (mesh) {
          if (!mesh.isSkinnedMesh) return;
          mesh.bind(skeleton, _identityMatrix);
        });
      }
      for (let i = 0, il = children.length; i < il; i++) {
        node.add(children[i]);
      }
      return node;
    });
  }

  // ._loadNodeShallow() parses a single node.
  // skin and child nodes are created and added in .loadNode() (no '_' prefix).
  _loadNodeShallow(nodeIndex) {
    const json = this.json;
    const extensions = this.extensions;
    const parser = this;

    // This method is called from .loadNode() and .loadSkin().
    // Cache a node to avoid duplication.

    if (this.nodeCache[nodeIndex] !== undefined) {
      return this.nodeCache[nodeIndex];
    }
    const nodeDef = json.nodes[nodeIndex];

    // reserve node's name before its dependencies, so the root has the intended name.
    const nodeName = nodeDef.name ? parser.createUniqueName(nodeDef.name) : '';
    const pending = [];
    const meshPromise = parser._invokeOne(function (ext) {
      return ext.createNodeMesh && ext.createNodeMesh(nodeIndex);
    });
    if (meshPromise) {
      pending.push(meshPromise);
    }
    if (nodeDef.camera !== undefined) {
      pending.push(parser.getDependency('camera', nodeDef.camera).then(function (camera) {
        return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera);
      }));
    }
    parser._invokeAll(function (ext) {
      return ext.createNodeAttachment && ext.createNodeAttachment(nodeIndex);
    }).forEach(function (promise) {
      pending.push(promise);
    });
    this.nodeCache[nodeIndex] = Promise.all(pending).then(function (objects) {
      let node;

      // .isBone isn't in glTF spec. See ._markDefs
      if (nodeDef.isBone === true) {
        node = new Bone();
      } else if (objects.length > 1) {
        node = new Group();
      } else if (objects.length === 1) {
        node = objects[0];
      } else {
        node = new Object3D$1();
      }
      if (node !== objects[0]) {
        for (let i = 0, il = objects.length; i < il; i++) {
          node.add(objects[i]);
        }
      }
      if (nodeDef.name) {
        node.userData.name = nodeDef.name;
        node.name = nodeName;
      }
      assignExtrasToUserData(node, nodeDef);
      if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef);
      if (nodeDef.matrix !== undefined) {
        const matrix = new Matrix4$1();
        matrix.fromArray(nodeDef.matrix);
        node.applyMatrix4(matrix);
      } else {
        if (nodeDef.translation !== undefined) {
          node.position.fromArray(nodeDef.translation);
        }
        if (nodeDef.rotation !== undefined) {
          node.quaternion.fromArray(nodeDef.rotation);
        }
        if (nodeDef.scale !== undefined) {
          node.scale.fromArray(nodeDef.scale);
        }
      }
      if (!parser.associations.has(node)) {
        parser.associations.set(node, {});
      }
      parser.associations.get(node).nodes = nodeIndex;
      return node;
    });
    return this.nodeCache[nodeIndex];
  }

  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
   * @param {number} sceneIndex
   * @return {Promise<Group>}
   */
  loadScene(sceneIndex) {
    const extensions = this.extensions;
    const sceneDef = this.json.scenes[sceneIndex];
    const parser = this;

    // Loader returns Group, not Scene.
    // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172
    const scene = new Group();
    if (sceneDef.name) scene.name = parser.createUniqueName(sceneDef.name);
    assignExtrasToUserData(scene, sceneDef);
    if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef);
    const nodeIds = sceneDef.nodes || [];
    const pending = [];
    for (let i = 0, il = nodeIds.length; i < il; i++) {
      pending.push(parser.getDependency('node', nodeIds[i]));
    }
    return Promise.all(pending).then(function (nodes) {
      for (let i = 0, il = nodes.length; i < il; i++) {
        scene.add(nodes[i]);
      }

      // Removes dangling associations, associations that reference a node that
      // didn't make it into the scene.
      const reduceAssociations = node => {
        const reducedAssociations = new Map();
        for (const [key, value] of parser.associations) {
          if (key instanceof Material$1 || key instanceof Texture$1) {
            reducedAssociations.set(key, value);
          }
        }
        node.traverse(node => {
          const mappings = parser.associations.get(node);
          if (mappings != null) {
            reducedAssociations.set(node, mappings);
          }
        });
        return reducedAssociations;
      };
      parser.associations = reduceAssociations(scene);
      return scene;
    });
  }
  _createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target) {
    const tracks = [];
    const targetName = node.name ? node.name : node.uuid;
    const targetNames = [];
    if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {
      node.traverse(function (object) {
        if (object.morphTargetInfluences) {
          targetNames.push(object.name ? object.name : object.uuid);
        }
      });
    } else {
      targetNames.push(targetName);
    }
    let TypedKeyframeTrack;
    switch (PATH_PROPERTIES[target.path]) {
      case PATH_PROPERTIES.weights:
        TypedKeyframeTrack = NumberKeyframeTrack;
        break;
      case PATH_PROPERTIES.rotation:
        TypedKeyframeTrack = QuaternionKeyframeTrack;
        break;
      case PATH_PROPERTIES.position:
      case PATH_PROPERTIES.scale:
        TypedKeyframeTrack = VectorKeyframeTrack;
        break;
      default:
        switch (outputAccessor.itemSize) {
          case 1:
            TypedKeyframeTrack = NumberKeyframeTrack;
            break;
          case 2:
          case 3:
          default:
            TypedKeyframeTrack = VectorKeyframeTrack;
            break;
        }
        break;
    }
    const interpolation = sampler.interpolation !== undefined ? INTERPOLATION[sampler.interpolation] : InterpolateLinear;
    const outputArray = this._getArrayFromAccessor(outputAccessor);
    for (let j = 0, jl = targetNames.length; j < jl; j++) {
      const track = new TypedKeyframeTrack(targetNames[j] + '.' + PATH_PROPERTIES[target.path], inputAccessor.array, outputArray, interpolation);

      // Override interpolation with custom factory method.
      if (sampler.interpolation === 'CUBICSPLINE') {
        this._createCubicSplineTrackInterpolant(track);
      }
      tracks.push(track);
    }
    return tracks;
  }
  _getArrayFromAccessor(accessor) {
    let outputArray = accessor.array;
    if (accessor.normalized) {
      const scale = getNormalizedComponentScale(outputArray.constructor);
      const scaled = new Float32Array(outputArray.length);
      for (let j = 0, jl = outputArray.length; j < jl; j++) {
        scaled[j] = outputArray[j] * scale;
      }
      outputArray = scaled;
    }
    return outputArray;
  }
  _createCubicSplineTrackInterpolant(track) {
    track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) {
      // A CUBICSPLINE keyframe in glTF has three output values for each input value,
      // representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()
      // must be divided by three to get the interpolant's sampleSize argument.

      const interpolantType = this instanceof QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;
      return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);
    };

    // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.
    track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;
  }
}

/**
 * @param {BufferGeometry} geometry
 * @param {GLTF.Primitive} primitiveDef
 * @param {GLTFParser} parser
 */
function computeBounds(geometry, primitiveDef, parser) {
  const attributes = primitiveDef.attributes;
  const box = new Box3$1();
  if (attributes.POSITION !== undefined) {
    const accessor = parser.json.accessors[attributes.POSITION];
    const min = accessor.min;
    const max = accessor.max;

    // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.

    if (min !== undefined && max !== undefined) {
      box.set(new Vector3$1(min[0], min[1], min[2]), new Vector3$1(max[0], max[1], max[2]));
      if (accessor.normalized) {
        const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]);
        box.min.multiplyScalar(boxScale);
        box.max.multiplyScalar(boxScale);
      }
    } else {
      console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.');
      return;
    }
  } else {
    return;
  }
  const targets = primitiveDef.targets;
  if (targets !== undefined) {
    const maxDisplacement = new Vector3$1();
    const vector = new Vector3$1();
    for (let i = 0, il = targets.length; i < il; i++) {
      const target = targets[i];
      if (target.POSITION !== undefined) {
        const accessor = parser.json.accessors[target.POSITION];
        const min = accessor.min;
        const max = accessor.max;

        // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.

        if (min !== undefined && max !== undefined) {
          // we need to get max of absolute components because target weight is [-1,1]
          vector.setX(Math.max(Math.abs(min[0]), Math.abs(max[0])));
          vector.setY(Math.max(Math.abs(min[1]), Math.abs(max[1])));
          vector.setZ(Math.max(Math.abs(min[2]), Math.abs(max[2])));
          if (accessor.normalized) {
            const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]);
            vector.multiplyScalar(boxScale);
          }

          // Note: this assumes that the sum of all weights is at most 1. This isn't quite correct - it's more conservative
          // to assume that each target can have a max weight of 1. However, for some use cases - notably, when morph targets
          // are used to implement key-frame animations and as such only two are active at a time - this results in very large
          // boxes. So for now we make a box that's sometimes a touch too small but is hopefully mostly of reasonable size.
          maxDisplacement.max(vector);
        } else {
          console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.');
        }
      }
    }

    // As per comment above this box isn't conservative, but has a reasonable size for a very large number of morph targets.
    box.expandByVector(maxDisplacement);
  }
  geometry.boundingBox = box;
  const sphere = new Sphere$1();
  box.getCenter(sphere.center);
  sphere.radius = box.min.distanceTo(box.max) / 2;
  geometry.boundingSphere = sphere;
}

/**
 * @param {BufferGeometry} geometry
 * @param {GLTF.Primitive} primitiveDef
 * @param {GLTFParser} parser
 * @return {Promise<BufferGeometry>}
 */
function addPrimitiveAttributes(geometry, primitiveDef, parser) {
  const attributes = primitiveDef.attributes;
  const pending = [];
  function assignAttributeAccessor(accessorIndex, attributeName) {
    return parser.getDependency('accessor', accessorIndex).then(function (accessor) {
      geometry.setAttribute(attributeName, accessor);
    });
  }
  for (const gltfAttributeName in attributes) {
    const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase();

    // Skip attributes already provided by e.g. Draco extension.
    if (threeAttributeName in geometry.attributes) continue;
    pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName));
  }
  if (primitiveDef.indices !== undefined && !geometry.index) {
    const accessor = parser.getDependency('accessor', primitiveDef.indices).then(function (accessor) {
      geometry.setIndex(accessor);
    });
    pending.push(accessor);
  }
  if (ColorManagement$1.workingColorSpace !== LinearSRGBColorSpace$1 && 'COLOR_0' in attributes) {
    console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ColorManagement$1.workingColorSpace}" not supported.`);
  }
  assignExtrasToUserData(geometry, primitiveDef);
  computeBounds(geometry, primitiveDef, parser);
  return Promise.all(pending).then(function () {
    return primitiveDef.targets !== undefined ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry;
  });
}

// OrbitControls performs orbiting, dollying (zooming), and panning.
// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
//
//    Orbit - left mouse / touch: one-finger move
//    Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
//    Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move

const _changeEvent = {
  type: 'change'
};
const _startEvent = {
  type: 'start'
};
const _endEvent = {
  type: 'end'
};
const _ray$1 = new Ray$1();
const _plane = new Plane$1();
const _TILT_LIMIT = Math.cos(70 * MathUtils$1.DEG2RAD);
const _v = new Vector3$1();
const _twoPI = 2 * Math.PI;
const _STATE = {
  NONE: -1,
  ROTATE: 0,
  DOLLY: 1,
  PAN: 2,
  TOUCH_ROTATE: 3,
  TOUCH_PAN: 4,
  TOUCH_DOLLY_PAN: 5,
  TOUCH_DOLLY_ROTATE: 6
};
const _EPS = 0.000001;
class OrbitControls extends Controls {
  constructor(object, domElement = null) {
    super(object, domElement);
    this.state = _STATE.NONE;

    // Set to false to disable this control
    this.enabled = true;

    // "target" sets the location of focus, where the object orbits around
    this.target = new Vector3$1();

    // Sets the 3D cursor (similar to Blender), from which the maxTargetRadius takes effect
    this.cursor = new Vector3$1();

    // How far you can dolly in and out ( PerspectiveCamera only )
    this.minDistance = 0;
    this.maxDistance = Infinity;

    // How far you can zoom in and out ( OrthographicCamera only )
    this.minZoom = 0;
    this.maxZoom = Infinity;

    // Limit camera target within a spherical area around the cursor
    this.minTargetRadius = 0;
    this.maxTargetRadius = Infinity;

    // How far you can orbit vertically, upper and lower limits.
    // Range is 0 to Math.PI radians.
    this.minPolarAngle = 0; // radians
    this.maxPolarAngle = Math.PI; // radians

    // How far you can orbit horizontally, upper and lower limits.
    // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
    this.minAzimuthAngle = -Infinity; // radians
    this.maxAzimuthAngle = Infinity; // radians

    // Set to true to enable damping (inertia)
    // If damping is enabled, you must call controls.update() in your animation loop
    this.enableDamping = false;
    this.dampingFactor = 0.05;

    // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
    // Set to false to disable zooming
    this.enableZoom = true;
    this.zoomSpeed = 1.0;

    // Set to false to disable rotating
    this.enableRotate = true;
    this.rotateSpeed = 1.0;

    // Set to false to disable panning
    this.enablePan = true;
    this.panSpeed = 1.0;
    this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up
    this.keyPanSpeed = 7.0; // pixels moved per arrow key push
    this.zoomToCursor = false;

    // Set to true to automatically rotate around the target
    // If auto-rotate is enabled, you must call controls.update() in your animation loop
    this.autoRotate = false;
    this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60

    // The four arrow keys
    this.keys = {
      LEFT: 'ArrowLeft',
      UP: 'ArrowUp',
      RIGHT: 'ArrowRight',
      BOTTOM: 'ArrowDown'
    };

    // Mouse buttons
    this.mouseButtons = {
      LEFT: MOUSE.ROTATE,
      MIDDLE: MOUSE.DOLLY,
      RIGHT: MOUSE.PAN
    };

    // Touch fingers
    this.touches = {
      ONE: TOUCH.ROTATE,
      TWO: TOUCH.DOLLY_PAN
    };

    // for reset
    this.target0 = this.target.clone();
    this.position0 = this.object.position.clone();
    this.zoom0 = this.object.zoom;

    // the target DOM element for key events
    this._domElementKeyEvents = null;

    // internals

    this._lastPosition = new Vector3$1();
    this._lastQuaternion = new Quaternion$1();
    this._lastTargetPosition = new Vector3$1();

    // so camera.up is the orbit axis
    this._quat = new Quaternion$1().setFromUnitVectors(object.up, new Vector3$1(0, 1, 0));
    this._quatInverse = this._quat.clone().invert();

    // current position in spherical coordinates
    this._spherical = new Spherical();
    this._sphericalDelta = new Spherical();
    this._scale = 1;
    this._panOffset = new Vector3$1();
    this._rotateStart = new Vector2$1();
    this._rotateEnd = new Vector2$1();
    this._rotateDelta = new Vector2$1();
    this._panStart = new Vector2$1();
    this._panEnd = new Vector2$1();
    this._panDelta = new Vector2$1();
    this._dollyStart = new Vector2$1();
    this._dollyEnd = new Vector2$1();
    this._dollyDelta = new Vector2$1();
    this._dollyDirection = new Vector3$1();
    this._mouse = new Vector2$1();
    this._performCursorZoom = false;
    this._pointers = [];
    this._pointerPositions = {};
    this._controlActive = false;

    // event listeners

    this._onPointerMove = onPointerMove.bind(this);
    this._onPointerDown = onPointerDown.bind(this);
    this._onPointerUp = onPointerUp.bind(this);
    this._onContextMenu = onContextMenu.bind(this);
    this._onMouseWheel = onMouseWheel.bind(this);
    this._onKeyDown = onKeyDown.bind(this);
    this._onTouchStart = onTouchStart.bind(this);
    this._onTouchMove = onTouchMove.bind(this);
    this._onMouseDown = onMouseDown.bind(this);
    this._onMouseMove = onMouseMove.bind(this);
    this._interceptControlDown = interceptControlDown.bind(this);
    this._interceptControlUp = interceptControlUp.bind(this);

    //

    if (this.domElement !== null) {
      this.connect();
    }
    this.update();
  }
  connect() {
    this.domElement.addEventListener('pointerdown', this._onPointerDown);
    this.domElement.addEventListener('pointercancel', this._onPointerUp);
    this.domElement.addEventListener('contextmenu', this._onContextMenu);
    this.domElement.addEventListener('wheel', this._onMouseWheel, {
      passive: false
    });
    const document = this.domElement.getRootNode(); // offscreen canvas compatibility
    document.addEventListener('keydown', this._interceptControlDown, {
      passive: true,
      capture: true
    });
    this.domElement.style.touchAction = 'none'; // disable touch scroll
  }
  disconnect() {
    this.domElement.removeEventListener('pointerdown', this._onPointerDown);
    this.domElement.removeEventListener('pointermove', this._onPointerMove);
    this.domElement.removeEventListener('pointerup', this._onPointerUp);
    this.domElement.removeEventListener('pointercancel', this._onPointerUp);
    this.domElement.removeEventListener('wheel', this._onMouseWheel);
    this.domElement.removeEventListener('contextmenu', this._onContextMenu);
    this.stopListenToKeyEvents();
    const document = this.domElement.getRootNode(); // offscreen canvas compatibility
    document.removeEventListener('keydown', this._interceptControlDown, {
      capture: true
    });
    this.domElement.style.touchAction = 'auto';
  }
  dispose() {
    this.disconnect();
  }
  getPolarAngle() {
    return this._spherical.phi;
  }
  getAzimuthalAngle() {
    return this._spherical.theta;
  }
  getDistance() {
    return this.object.position.distanceTo(this.target);
  }
  listenToKeyEvents(domElement) {
    domElement.addEventListener('keydown', this._onKeyDown);
    this._domElementKeyEvents = domElement;
  }
  stopListenToKeyEvents() {
    if (this._domElementKeyEvents !== null) {
      this._domElementKeyEvents.removeEventListener('keydown', this._onKeyDown);
      this._domElementKeyEvents = null;
    }
  }
  saveState() {
    this.target0.copy(this.target);
    this.position0.copy(this.object.position);
    this.zoom0 = this.object.zoom;
  }
  reset() {
    this.target.copy(this.target0);
    this.object.position.copy(this.position0);
    this.object.zoom = this.zoom0;
    this.object.updateProjectionMatrix();
    this.dispatchEvent(_changeEvent);
    this.update();
    this.state = _STATE.NONE;
  }
  update(deltaTime = null) {
    const position = this.object.position;
    _v.copy(position).sub(this.target);

    // rotate offset to "y-axis-is-up" space
    _v.applyQuaternion(this._quat);

    // angle from z-axis around y-axis
    this._spherical.setFromVector3(_v);
    if (this.autoRotate && this.state === _STATE.NONE) {
      this._rotateLeft(this._getAutoRotationAngle(deltaTime));
    }
    if (this.enableDamping) {
      this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor;
      this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor;
    } else {
      this._spherical.theta += this._sphericalDelta.theta;
      this._spherical.phi += this._sphericalDelta.phi;
    }

    // restrict theta to be between desired limits

    let min = this.minAzimuthAngle;
    let max = this.maxAzimuthAngle;
    if (isFinite(min) && isFinite(max)) {
      if (min < -Math.PI) min += _twoPI;else if (min > Math.PI) min -= _twoPI;
      if (max < -Math.PI) max += _twoPI;else if (max > Math.PI) max -= _twoPI;
      if (min <= max) {
        this._spherical.theta = Math.max(min, Math.min(max, this._spherical.theta));
      } else {
        this._spherical.theta = this._spherical.theta > (min + max) / 2 ? Math.max(min, this._spherical.theta) : Math.min(max, this._spherical.theta);
      }
    }

    // restrict phi to be between desired limits
    this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi));
    this._spherical.makeSafe();

    // move target to panned location

    if (this.enableDamping === true) {
      this.target.addScaledVector(this._panOffset, this.dampingFactor);
    } else {
      this.target.add(this._panOffset);
    }

    // Limit the target distance from the cursor to create a sphere around the center of interest
    this.target.sub(this.cursor);
    this.target.clampLength(this.minTargetRadius, this.maxTargetRadius);
    this.target.add(this.cursor);
    let zoomChanged = false;
    // adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera
    // we adjust zoom later in these cases
    if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera) {
      this._spherical.radius = this._clampDistance(this._spherical.radius);
    } else {
      const prevRadius = this._spherical.radius;
      this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale);
      zoomChanged = prevRadius != this._spherical.radius;
    }
    _v.setFromSpherical(this._spherical);

    // rotate offset back to "camera-up-vector-is-up" space
    _v.applyQuaternion(this._quatInverse);
    position.copy(this.target).add(_v);
    this.object.lookAt(this.target);
    if (this.enableDamping === true) {
      this._sphericalDelta.theta *= 1 - this.dampingFactor;
      this._sphericalDelta.phi *= 1 - this.dampingFactor;
      this._panOffset.multiplyScalar(1 - this.dampingFactor);
    } else {
      this._sphericalDelta.set(0, 0, 0);
      this._panOffset.set(0, 0, 0);
    }

    // adjust camera position
    if (this.zoomToCursor && this._performCursorZoom) {
      let newRadius = null;
      if (this.object.isPerspectiveCamera) {
        // move the camera down the pointer ray
        // this method avoids floating point error
        const prevRadius = _v.length();
        newRadius = this._clampDistance(prevRadius * this._scale);
        const radiusDelta = prevRadius - newRadius;
        this.object.position.addScaledVector(this._dollyDirection, radiusDelta);
        this.object.updateMatrixWorld();
        zoomChanged = !!radiusDelta;
      } else if (this.object.isOrthographicCamera) {
        // adjust the ortho camera position based on zoom changes
        const mouseBefore = new Vector3$1(this._mouse.x, this._mouse.y, 0);
        mouseBefore.unproject(this.object);
        const prevZoom = this.object.zoom;
        this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale));
        this.object.updateProjectionMatrix();
        zoomChanged = prevZoom !== this.object.zoom;
        const mouseAfter = new Vector3$1(this._mouse.x, this._mouse.y, 0);
        mouseAfter.unproject(this.object);
        this.object.position.sub(mouseAfter).add(mouseBefore);
        this.object.updateMatrixWorld();
        newRadius = _v.length();
      } else {
        console.warn('WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.');
        this.zoomToCursor = false;
      }

      // handle the placement of the target
      if (newRadius !== null) {
        if (this.screenSpacePanning) {
          // position the orbit target in front of the new camera position
          this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(newRadius).add(this.object.position);
        } else {
          // get the ray and translation plane to compute target
          _ray$1.origin.copy(this.object.position);
          _ray$1.direction.set(0, 0, -1).transformDirection(this.object.matrix);

          // if the camera is 20 degrees above the horizon then don't adjust the focus target to avoid
          // extremely large values
          if (Math.abs(this.object.up.dot(_ray$1.direction)) < _TILT_LIMIT) {
            this.object.lookAt(this.target);
          } else {
            _plane.setFromNormalAndCoplanarPoint(this.object.up, this.target);
            _ray$1.intersectPlane(_plane, this.target);
          }
        }
      }
    } else if (this.object.isOrthographicCamera) {
      const prevZoom = this.object.zoom;
      this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale));
      if (prevZoom !== this.object.zoom) {
        this.object.updateProjectionMatrix();
        zoomChanged = true;
      }
    }
    this._scale = 1;
    this._performCursorZoom = false;

    // update condition is:
    // min(camera displacement, camera rotation in radians)^2 > EPS
    // using small-angle approximation cos(x/2) = 1 - x^2 / 8

    if (zoomChanged || this._lastPosition.distanceToSquared(this.object.position) > _EPS || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > _EPS || this._lastTargetPosition.distanceToSquared(this.target) > _EPS) {
      this.dispatchEvent(_changeEvent);
      this._lastPosition.copy(this.object.position);
      this._lastQuaternion.copy(this.object.quaternion);
      this._lastTargetPosition.copy(this.target);
      return true;
    }
    return false;
  }
  _getAutoRotationAngle(deltaTime) {
    if (deltaTime !== null) {
      return _twoPI / 60 * this.autoRotateSpeed * deltaTime;
    } else {
      return _twoPI / 60 / 60 * this.autoRotateSpeed;
    }
  }
  _getZoomScale(delta) {
    const normalizedDelta = Math.abs(delta * 0.01);
    return Math.pow(0.95, this.zoomSpeed * normalizedDelta);
  }
  _rotateLeft(angle) {
    this._sphericalDelta.theta -= angle;
  }
  _rotateUp(angle) {
    this._sphericalDelta.phi -= angle;
  }
  _panLeft(distance, objectMatrix) {
    _v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix
    _v.multiplyScalar(-distance);
    this._panOffset.add(_v);
  }
  _panUp(distance, objectMatrix) {
    if (this.screenSpacePanning === true) {
      _v.setFromMatrixColumn(objectMatrix, 1);
    } else {
      _v.setFromMatrixColumn(objectMatrix, 0);
      _v.crossVectors(this.object.up, _v);
    }
    _v.multiplyScalar(distance);
    this._panOffset.add(_v);
  }

  // deltaX and deltaY are in pixels; right and down are positive
  _pan(deltaX, deltaY) {
    const element = this.domElement;
    if (this.object.isPerspectiveCamera) {
      // perspective
      const position = this.object.position;
      _v.copy(position).sub(this.target);
      let targetDistance = _v.length();

      // half of the fov is center to top of screen
      targetDistance *= Math.tan(this.object.fov / 2 * Math.PI / 180.0);

      // we use only clientHeight here so aspect ratio does not distort speed
      this._panLeft(2 * deltaX * targetDistance / element.clientHeight, this.object.matrix);
      this._panUp(2 * deltaY * targetDistance / element.clientHeight, this.object.matrix);
    } else if (this.object.isOrthographicCamera) {
      // orthographic
      this._panLeft(deltaX * (this.object.right - this.object.left) / this.object.zoom / element.clientWidth, this.object.matrix);
      this._panUp(deltaY * (this.object.top - this.object.bottom) / this.object.zoom / element.clientHeight, this.object.matrix);
    } else {
      // camera neither orthographic nor perspective
      console.warn('WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.');
      this.enablePan = false;
    }
  }
  _dollyOut(dollyScale) {
    if (this.object.isPerspectiveCamera || this.object.isOrthographicCamera) {
      this._scale /= dollyScale;
    } else {
      console.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');
      this.enableZoom = false;
    }
  }
  _dollyIn(dollyScale) {
    if (this.object.isPerspectiveCamera || this.object.isOrthographicCamera) {
      this._scale *= dollyScale;
    } else {
      console.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');
      this.enableZoom = false;
    }
  }
  _updateZoomParameters(x, y) {
    if (!this.zoomToCursor) {
      return;
    }
    this._performCursorZoom = true;
    const rect = this.domElement.getBoundingClientRect();
    const dx = x - rect.left;
    const dy = y - rect.top;
    const w = rect.width;
    const h = rect.height;
    this._mouse.x = dx / w * 2 - 1;
    this._mouse.y = -(dy / h) * 2 + 1;
    this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
  }
  _clampDistance(dist) {
    return Math.max(this.minDistance, Math.min(this.maxDistance, dist));
  }

  //
  // event callbacks - update the object state
  //

  _handleMouseDownRotate(event) {
    this._rotateStart.set(event.clientX, event.clientY);
  }
  _handleMouseDownDolly(event) {
    this._updateZoomParameters(event.clientX, event.clientX);
    this._dollyStart.set(event.clientX, event.clientY);
  }
  _handleMouseDownPan(event) {
    this._panStart.set(event.clientX, event.clientY);
  }
  _handleMouseMoveRotate(event) {
    this._rotateEnd.set(event.clientX, event.clientY);
    this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
    const element = this.domElement;
    this._rotateLeft(_twoPI * this._rotateDelta.x / element.clientHeight); // yes, height

    this._rotateUp(_twoPI * this._rotateDelta.y / element.clientHeight);
    this._rotateStart.copy(this._rotateEnd);
    this.update();
  }
  _handleMouseMoveDolly(event) {
    this._dollyEnd.set(event.clientX, event.clientY);
    this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart);
    if (this._dollyDelta.y > 0) {
      this._dollyOut(this._getZoomScale(this._dollyDelta.y));
    } else if (this._dollyDelta.y < 0) {
      this._dollyIn(this._getZoomScale(this._dollyDelta.y));
    }
    this._dollyStart.copy(this._dollyEnd);
    this.update();
  }
  _handleMouseMovePan(event) {
    this._panEnd.set(event.clientX, event.clientY);
    this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed);
    this._pan(this._panDelta.x, this._panDelta.y);
    this._panStart.copy(this._panEnd);
    this.update();
  }
  _handleMouseWheel(event) {
    this._updateZoomParameters(event.clientX, event.clientY);
    if (event.deltaY < 0) {
      this._dollyIn(this._getZoomScale(event.deltaY));
    } else if (event.deltaY > 0) {
      this._dollyOut(this._getZoomScale(event.deltaY));
    }
    this.update();
  }
  _handleKeyDown(event) {
    let needsUpdate = false;
    switch (event.code) {
      case this.keys.UP:
        if (event.ctrlKey || event.metaKey || event.shiftKey) {
          this._rotateUp(_twoPI * this.rotateSpeed / this.domElement.clientHeight);
        } else {
          this._pan(0, this.keyPanSpeed);
        }
        needsUpdate = true;
        break;
      case this.keys.BOTTOM:
        if (event.ctrlKey || event.metaKey || event.shiftKey) {
          this._rotateUp(-_twoPI * this.rotateSpeed / this.domElement.clientHeight);
        } else {
          this._pan(0, -this.keyPanSpeed);
        }
        needsUpdate = true;
        break;
      case this.keys.LEFT:
        if (event.ctrlKey || event.metaKey || event.shiftKey) {
          this._rotateLeft(_twoPI * this.rotateSpeed / this.domElement.clientHeight);
        } else {
          this._pan(this.keyPanSpeed, 0);
        }
        needsUpdate = true;
        break;
      case this.keys.RIGHT:
        if (event.ctrlKey || event.metaKey || event.shiftKey) {
          this._rotateLeft(-_twoPI * this.rotateSpeed / this.domElement.clientHeight);
        } else {
          this._pan(-this.keyPanSpeed, 0);
        }
        needsUpdate = true;
        break;
    }
    if (needsUpdate) {
      // prevent the browser from scrolling on cursor keys
      event.preventDefault();
      this.update();
    }
  }
  _handleTouchStartRotate(event) {
    if (this._pointers.length === 1) {
      this._rotateStart.set(event.pageX, event.pageY);
    } else {
      const position = this._getSecondPointerPosition(event);
      const x = 0.5 * (event.pageX + position.x);
      const y = 0.5 * (event.pageY + position.y);
      this._rotateStart.set(x, y);
    }
  }
  _handleTouchStartPan(event) {
    if (this._pointers.length === 1) {
      this._panStart.set(event.pageX, event.pageY);
    } else {
      const position = this._getSecondPointerPosition(event);
      const x = 0.5 * (event.pageX + position.x);
      const y = 0.5 * (event.pageY + position.y);
      this._panStart.set(x, y);
    }
  }
  _handleTouchStartDolly(event) {
    const position = this._getSecondPointerPosition(event);
    const dx = event.pageX - position.x;
    const dy = event.pageY - position.y;
    const distance = Math.sqrt(dx * dx + dy * dy);
    this._dollyStart.set(0, distance);
  }
  _handleTouchStartDollyPan(event) {
    if (this.enableZoom) this._handleTouchStartDolly(event);
    if (this.enablePan) this._handleTouchStartPan(event);
  }
  _handleTouchStartDollyRotate(event) {
    if (this.enableZoom) this._handleTouchStartDolly(event);
    if (this.enableRotate) this._handleTouchStartRotate(event);
  }
  _handleTouchMoveRotate(event) {
    if (this._pointers.length == 1) {
      this._rotateEnd.set(event.pageX, event.pageY);
    } else {
      const position = this._getSecondPointerPosition(event);
      const x = 0.5 * (event.pageX + position.x);
      const y = 0.5 * (event.pageY + position.y);
      this._rotateEnd.set(x, y);
    }
    this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
    const element = this.domElement;
    this._rotateLeft(_twoPI * this._rotateDelta.x / element.clientHeight); // yes, height

    this._rotateUp(_twoPI * this._rotateDelta.y / element.clientHeight);
    this._rotateStart.copy(this._rotateEnd);
  }
  _handleTouchMovePan(event) {
    if (this._pointers.length === 1) {
      this._panEnd.set(event.pageX, event.pageY);
    } else {
      const position = this._getSecondPointerPosition(event);
      const x = 0.5 * (event.pageX + position.x);
      const y = 0.5 * (event.pageY + position.y);
      this._panEnd.set(x, y);
    }
    this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed);
    this._pan(this._panDelta.x, this._panDelta.y);
    this._panStart.copy(this._panEnd);
  }
  _handleTouchMoveDolly(event) {
    const position = this._getSecondPointerPosition(event);
    const dx = event.pageX - position.x;
    const dy = event.pageY - position.y;
    const distance = Math.sqrt(dx * dx + dy * dy);
    this._dollyEnd.set(0, distance);
    this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed));
    this._dollyOut(this._dollyDelta.y);
    this._dollyStart.copy(this._dollyEnd);
    const centerX = (event.pageX + position.x) * 0.5;
    const centerY = (event.pageY + position.y) * 0.5;
    this._updateZoomParameters(centerX, centerY);
  }
  _handleTouchMoveDollyPan(event) {
    if (this.enableZoom) this._handleTouchMoveDolly(event);
    if (this.enablePan) this._handleTouchMovePan(event);
  }
  _handleTouchMoveDollyRotate(event) {
    if (this.enableZoom) this._handleTouchMoveDolly(event);
    if (this.enableRotate) this._handleTouchMoveRotate(event);
  }

  // pointers

  _addPointer(event) {
    this._pointers.push(event.pointerId);
  }
  _removePointer(event) {
    delete this._pointerPositions[event.pointerId];
    for (let i = 0; i < this._pointers.length; i++) {
      if (this._pointers[i] == event.pointerId) {
        this._pointers.splice(i, 1);
        return;
      }
    }
  }
  _isTrackingPointer(event) {
    for (let i = 0; i < this._pointers.length; i++) {
      if (this._pointers[i] == event.pointerId) return true;
    }
    return false;
  }
  _trackPointer(event) {
    let position = this._pointerPositions[event.pointerId];
    if (position === undefined) {
      position = new Vector2$1();
      this._pointerPositions[event.pointerId] = position;
    }
    position.set(event.pageX, event.pageY);
  }
  _getSecondPointerPosition(event) {
    const pointerId = event.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
    return this._pointerPositions[pointerId];
  }

  //

  _customWheelEvent(event) {
    const mode = event.deltaMode;

    // minimal wheel event altered to meet delta-zoom demand
    const newEvent = {
      clientX: event.clientX,
      clientY: event.clientY,
      deltaY: event.deltaY
    };
    switch (mode) {
      case 1:
        // LINE_MODE
        newEvent.deltaY *= 16;
        break;
      case 2:
        // PAGE_MODE
        newEvent.deltaY *= 100;
        break;
    }

    // detect if event was triggered by pinching
    if (event.ctrlKey && !this._controlActive) {
      newEvent.deltaY *= 10;
    }
    return newEvent;
  }
}
function onPointerDown(event) {
  if (this.enabled === false) return;
  if (this._pointers.length === 0) {
    this.domElement.setPointerCapture(event.pointerId);
    this.domElement.addEventListener('pointermove', this._onPointerMove);
    this.domElement.addEventListener('pointerup', this._onPointerUp);
  }

  //

  if (this._isTrackingPointer(event)) return;

  //

  this._addPointer(event);
  if (event.pointerType === 'touch') {
    this._onTouchStart(event);
  } else {
    this._onMouseDown(event);
  }
}
function onPointerMove(event) {
  if (this.enabled === false) return;
  if (event.pointerType === 'touch') {
    this._onTouchMove(event);
  } else {
    this._onMouseMove(event);
  }
}
function onPointerUp(event) {
  this._removePointer(event);
  switch (this._pointers.length) {
    case 0:
      this.domElement.releasePointerCapture(event.pointerId);
      this.domElement.removeEventListener('pointermove', this._onPointerMove);
      this.domElement.removeEventListener('pointerup', this._onPointerUp);
      this.dispatchEvent(_endEvent);
      this.state = _STATE.NONE;
      break;
    case 1:
      const pointerId = this._pointers[0];
      const position = this._pointerPositions[pointerId];

      // minimal placeholder event - allows state correction on pointer-up
      this._onTouchStart({
        pointerId: pointerId,
        pageX: position.x,
        pageY: position.y
      });
      break;
  }
}
function onMouseDown(event) {
  let mouseAction;
  switch (event.button) {
    case 0:
      mouseAction = this.mouseButtons.LEFT;
      break;
    case 1:
      mouseAction = this.mouseButtons.MIDDLE;
      break;
    case 2:
      mouseAction = this.mouseButtons.RIGHT;
      break;
    default:
      mouseAction = -1;
  }
  switch (mouseAction) {
    case MOUSE.DOLLY:
      if (this.enableZoom === false) return;
      this._handleMouseDownDolly(event);
      this.state = _STATE.DOLLY;
      break;
    case MOUSE.ROTATE:
      if (event.ctrlKey || event.metaKey || event.shiftKey) {
        if (this.enablePan === false) return;
        this._handleMouseDownPan(event);
        this.state = _STATE.PAN;
      } else {
        if (this.enableRotate === false) return;
        this._handleMouseDownRotate(event);
        this.state = _STATE.ROTATE;
      }
      break;
    case MOUSE.PAN:
      if (event.ctrlKey || event.metaKey || event.shiftKey) {
        if (this.enableRotate === false) return;
        this._handleMouseDownRotate(event);
        this.state = _STATE.ROTATE;
      } else {
        if (this.enablePan === false) return;
        this._handleMouseDownPan(event);
        this.state = _STATE.PAN;
      }
      break;
    default:
      this.state = _STATE.NONE;
  }
  if (this.state !== _STATE.NONE) {
    this.dispatchEvent(_startEvent);
  }
}
function onMouseMove(event) {
  switch (this.state) {
    case _STATE.ROTATE:
      if (this.enableRotate === false) return;
      this._handleMouseMoveRotate(event);
      break;
    case _STATE.DOLLY:
      if (this.enableZoom === false) return;
      this._handleMouseMoveDolly(event);
      break;
    case _STATE.PAN:
      if (this.enablePan === false) return;
      this._handleMouseMovePan(event);
      break;
  }
}
function onMouseWheel(event) {
  if (this.enabled === false || this.enableZoom === false || this.state !== _STATE.NONE) return;
  event.preventDefault();
  this.dispatchEvent(_startEvent);
  this._handleMouseWheel(this._customWheelEvent(event));
  this.dispatchEvent(_endEvent);
}
function onKeyDown(event) {
  if (this.enabled === false || this.enablePan === false) return;
  this._handleKeyDown(event);
}
function onTouchStart(event) {
  this._trackPointer(event);
  switch (this._pointers.length) {
    case 1:
      switch (this.touches.ONE) {
        case TOUCH.ROTATE:
          if (this.enableRotate === false) return;
          this._handleTouchStartRotate(event);
          this.state = _STATE.TOUCH_ROTATE;
          break;
        case TOUCH.PAN:
          if (this.enablePan === false) return;
          this._handleTouchStartPan(event);
          this.state = _STATE.TOUCH_PAN;
          break;
        default:
          this.state = _STATE.NONE;
      }
      break;
    case 2:
      switch (this.touches.TWO) {
        case TOUCH.DOLLY_PAN:
          if (this.enableZoom === false && this.enablePan === false) return;
          this._handleTouchStartDollyPan(event);
          this.state = _STATE.TOUCH_DOLLY_PAN;
          break;
        case TOUCH.DOLLY_ROTATE:
          if (this.enableZoom === false && this.enableRotate === false) return;
          this._handleTouchStartDollyRotate(event);
          this.state = _STATE.TOUCH_DOLLY_ROTATE;
          break;
        default:
          this.state = _STATE.NONE;
      }
      break;
    default:
      this.state = _STATE.NONE;
  }
  if (this.state !== _STATE.NONE) {
    this.dispatchEvent(_startEvent);
  }
}
function onTouchMove(event) {
  this._trackPointer(event);
  switch (this.state) {
    case _STATE.TOUCH_ROTATE:
      if (this.enableRotate === false) return;
      this._handleTouchMoveRotate(event);
      this.update();
      break;
    case _STATE.TOUCH_PAN:
      if (this.enablePan === false) return;
      this._handleTouchMovePan(event);
      this.update();
      break;
    case _STATE.TOUCH_DOLLY_PAN:
      if (this.enableZoom === false && this.enablePan === false) return;
      this._handleTouchMoveDollyPan(event);
      this.update();
      break;
    case _STATE.TOUCH_DOLLY_ROTATE:
      if (this.enableZoom === false && this.enableRotate === false) return;
      this._handleTouchMoveDollyRotate(event);
      this.update();
      break;
    default:
      this.state = _STATE.NONE;
  }
}
function onContextMenu(event) {
  if (this.enabled === false) return;
  event.preventDefault();
}
function interceptControlDown(event) {
  if (event.key === 'Control') {
    this._controlActive = true;
    const document = this.domElement.getRootNode(); // offscreen canvas compatibility

    document.addEventListener('keyup', this._interceptControlUp, {
      passive: true,
      capture: true
    });
  }
}
function interceptControlUp(event) {
  if (event.key === 'Control') {
    this._controlActive = false;
    const document = this.domElement.getRootNode(); // offscreen canvas compatibility

    document.removeEventListener('keyup', this._interceptControlUp, {
      passive: true,
      capture: true
    });
  }
}

class DataMap {
  constructor() {
    this.data = new WeakMap();
  }
  get(object) {
    let map = this.data.get(object);
    if (map === undefined) {
      map = {};
      this.data.set(object, map);
    }
    return map;
  }
  delete(object) {
    let map;
    if (this.data.has(object)) {
      map = this.data.get(object);
      this.data.delete(object);
    }
    return map;
  }
  has(object) {
    return this.data.has(object);
  }
  dispose() {
    this.data = new WeakMap();
  }
}
var DataMap$1 = DataMap;

const _lut = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff'];
let _seed = 1234567;
const DEG2RAD = Math.PI / 180;
const RAD2DEG = 180 / Math.PI;

// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
function generateUUID() {
  const d0 = Math.random() * 0xffffffff | 0;
  const d1 = Math.random() * 0xffffffff | 0;
  const d2 = Math.random() * 0xffffffff | 0;
  const d3 = Math.random() * 0xffffffff | 0;
  const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + '-' + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + '-' + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + '-' + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff];

  // .toLowerCase() here flattens concatenated strings to save heap memory space.
  return uuid.toLowerCase();
}
function clamp$1(value, min, max) {
  return Math.max(min, Math.min(max, value));
}

// compute euclidean modulo of m % n
// https://en.wikipedia.org/wiki/Modulo_operation
function euclideanModulo(n, m) {
  return (n % m + m) % m;
}

// Linear mapping from range <a1, a2> to range <b1, b2>
function mapLinear(x, a1, a2, b1, b2) {
  return b1 + (x - a1) * (b2 - b1) / (a2 - a1);
}

// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
function inverseLerp(x, y, value) {
  if (x !== y) {
    return (value - x) / (y - x);
  } else {
    return 0;
  }
}

// https://en.wikipedia.org/wiki/Linear_interpolation
function lerp(x, y, t) {
  return (1 - t) * x + t * y;
}

// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
function damp(x, y, lambda, dt) {
  return lerp(x, y, 1 - Math.exp(-lambda * dt));
}

// https://www.desmos.com/calculator/vcsjnyz7x4
function pingpong(x, length = 1) {
  return length - Math.abs(euclideanModulo(x, length * 2) - length);
}

// http://en.wikipedia.org/wiki/Smoothstep
function smoothstep$1(x, min, max) {
  if (x <= min) return 0;
  if (x >= max) return 1;
  x = (x - min) / (max - min);
  return x * x * (3 - 2 * x);
}
function smootherstep(x, min, max) {
  if (x <= min) return 0;
  if (x >= max) return 1;
  x = (x - min) / (max - min);
  return x * x * x * (x * (x * 6 - 15) + 10);
}

// Random integer from <low, high> interval
function randInt(low, high) {
  return low + Math.floor(Math.random() * (high - low + 1));
}

// Random float from <low, high> interval
function randFloat(low, high) {
  return low + Math.random() * (high - low);
}

// Random float from <-range/2, range/2> interval
function randFloatSpread(range) {
  return range * (0.5 - Math.random());
}

// Deterministic pseudo-random float in the interval [ 0, 1 ]
function seededRandom(s) {
  if (s !== undefined) _seed = s;

  // Mulberry32 generator

  let t = _seed += 0x6D2B79F5;
  t = Math.imul(t ^ t >>> 15, t | 1);
  t ^= t + Math.imul(t ^ t >>> 7, t | 61);
  return ((t ^ t >>> 14) >>> 0) / 4294967296;
}
function degToRad(degrees) {
  return degrees * DEG2RAD;
}
function radToDeg(radians) {
  return radians * RAD2DEG;
}
function isPowerOfTwo(value) {
  return (value & value - 1) === 0 && value !== 0;
}
function ceilPowerOfTwo(value) {
  return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));
}
function floorPowerOfTwo(value) {
  return Math.pow(2, Math.floor(Math.log(value) / Math.LN2));
}
function setQuaternionFromProperEuler(q, a, b, c, order) {
  // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles

  // rotations are applied to the axes in the order specified by 'order'
  // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
  // angles are in radians

  const cos = Math.cos;
  const sin = Math.sin;
  const c2 = cos(b / 2);
  const s2 = sin(b / 2);
  const c13 = cos((a + c) / 2);
  const s13 = sin((a + c) / 2);
  const c1_3 = cos((a - c) / 2);
  const s1_3 = sin((a - c) / 2);
  const c3_1 = cos((c - a) / 2);
  const s3_1 = sin((c - a) / 2);
  switch (order) {
    case 'XYX':
      q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13);
      break;
    case 'YZY':
      q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13);
      break;
    case 'ZXZ':
      q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13);
      break;
    case 'XZX':
      q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13);
      break;
    case 'YXY':
      q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13);
      break;
    case 'ZYZ':
      q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13);
      break;
    default:
      console.warn('THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order);
  }
}
function denormalize(value, array) {
  switch (array.constructor) {
    case Float32Array:
      return value;
    case Uint32Array:
      return value / 4294967295.0;
    case Uint16Array:
      return value / 65535.0;
    case Uint8Array:
      return value / 255.0;
    case Int32Array:
      return Math.max(value / 2147483647.0, -1.0);
    case Int16Array:
      return Math.max(value / 32767.0, -1.0);
    case Int8Array:
      return Math.max(value / 127.0, -1.0);
    default:
      throw new Error('Invalid component type.');
  }
}
function normalize$1(value, array) {
  switch (array.constructor) {
    case Float32Array:
      return value;
    case Uint32Array:
      return Math.round(value * 4294967295.0);
    case Uint16Array:
      return Math.round(value * 65535.0);
    case Uint8Array:
      return Math.round(value * 255.0);
    case Int32Array:
      return Math.round(value * 2147483647.0);
    case Int16Array:
      return Math.round(value * 32767.0);
    case Int8Array:
      return Math.round(value * 127.0);
    default:
      throw new Error('Invalid component type.');
  }
}
const MathUtils = {
  DEG2RAD: DEG2RAD,
  RAD2DEG: RAD2DEG,
  generateUUID: generateUUID,
  clamp: clamp$1,
  euclideanModulo: euclideanModulo,
  mapLinear: mapLinear,
  inverseLerp: inverseLerp,
  lerp: lerp,
  damp: damp,
  pingpong: pingpong,
  smoothstep: smoothstep$1,
  smootherstep: smootherstep,
  randInt: randInt,
  randFloat: randFloat,
  randFloatSpread: randFloatSpread,
  seededRandom: seededRandom,
  degToRad: degToRad,
  radToDeg: radToDeg,
  isPowerOfTwo: isPowerOfTwo,
  ceilPowerOfTwo: ceilPowerOfTwo,
  floorPowerOfTwo: floorPowerOfTwo,
  setQuaternionFromProperEuler: setQuaternionFromProperEuler,
  normalize: normalize$1,
  denormalize: denormalize
};

const FrontSide = 0;
const BackSide = 1;
const NormalBlending = 1;
const AdditiveBlending = 2;
const AddEquation = 100;
const SrcAlphaFactor = 204;
const OneMinusSrcAlphaFactor = 205;
const LessEqualDepth = 3;
const MultiplyOperation = 0;
const NoToneMapping = 0;
const UVMapping = 300;
const CubeReflectionMapping = 301;
const CubeRefractionMapping = 302;
const RepeatWrapping = 1000;
const ClampToEdgeWrapping = 1001;
const MirroredRepeatWrapping = 1002;
const NearestFilter = 1003;
const LinearFilter = 1006;
const LinearMipmapLinearFilter = 1008;
const LinearMipMapLinearFilter = 1008;
const UnsignedByteType = 1009;
const IntType = 1013;
const UnsignedIntType = 1014;
const FloatType = 1015;
const HalfFloatType = 1016;
const UnsignedInt248Type = 1020;
const RGBAFormat = 1023;
const DepthFormat = 1026;
const DepthStencilFormat = 1027;
const TangentSpaceNormalMap = 0;
const ObjectSpaceNormalMap = 1;

// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.
const NoColorSpace = '';
const SRGBColorSpace = 'srgb';
const LinearSRGBColorSpace = 'srgb-linear';
const DisplayP3ColorSpace = 'display-p3';
const LinearDisplayP3ColorSpace = 'display-p3-linear';
const LinearTransfer = 'linear';
const SRGBTransfer = 'srgb';
const Rec709Primaries = 'rec709';
const P3Primaries = 'p3';
const KeepStencilOp = 7680;
const AlwaysStencilFunc = 519;
const StaticDrawUsage = 35044;
const DynamicDrawUsage = 35048;
const WebGLCoordinateSystem = 2000;
const WebGPUCoordinateSystem = 2001;

class Matrix3 {
  constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
    Matrix3.prototype.isMatrix3 = true;
    this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1];
    if (n11 !== undefined) {
      this.set(n11, n12, n13, n21, n22, n23, n31, n32, n33);
    }
  }
  set(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
    const te = this.elements;
    te[0] = n11;
    te[1] = n21;
    te[2] = n31;
    te[3] = n12;
    te[4] = n22;
    te[5] = n32;
    te[6] = n13;
    te[7] = n23;
    te[8] = n33;
    return this;
  }
  identity() {
    this.set(1, 0, 0, 0, 1, 0, 0, 0, 1);
    return this;
  }
  copy(m) {
    const te = this.elements;
    const me = m.elements;
    te[0] = me[0];
    te[1] = me[1];
    te[2] = me[2];
    te[3] = me[3];
    te[4] = me[4];
    te[5] = me[5];
    te[6] = me[6];
    te[7] = me[7];
    te[8] = me[8];
    return this;
  }
  extractBasis(xAxis, yAxis, zAxis) {
    xAxis.setFromMatrix3Column(this, 0);
    yAxis.setFromMatrix3Column(this, 1);
    zAxis.setFromMatrix3Column(this, 2);
    return this;
  }
  setFromMatrix4(m) {
    const me = m.elements;
    this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]);
    return this;
  }
  multiply(m) {
    return this.multiplyMatrices(this, m);
  }
  premultiply(m) {
    return this.multiplyMatrices(m, this);
  }
  multiplyMatrices(a, b) {
    const ae = a.elements;
    const be = b.elements;
    const te = this.elements;
    const a11 = ae[0],
      a12 = ae[3],
      a13 = ae[6];
    const a21 = ae[1],
      a22 = ae[4],
      a23 = ae[7];
    const a31 = ae[2],
      a32 = ae[5],
      a33 = ae[8];
    const b11 = be[0],
      b12 = be[3],
      b13 = be[6];
    const b21 = be[1],
      b22 = be[4],
      b23 = be[7];
    const b31 = be[2],
      b32 = be[5],
      b33 = be[8];
    te[0] = a11 * b11 + a12 * b21 + a13 * b31;
    te[3] = a11 * b12 + a12 * b22 + a13 * b32;
    te[6] = a11 * b13 + a12 * b23 + a13 * b33;
    te[1] = a21 * b11 + a22 * b21 + a23 * b31;
    te[4] = a21 * b12 + a22 * b22 + a23 * b32;
    te[7] = a21 * b13 + a22 * b23 + a23 * b33;
    te[2] = a31 * b11 + a32 * b21 + a33 * b31;
    te[5] = a31 * b12 + a32 * b22 + a33 * b32;
    te[8] = a31 * b13 + a32 * b23 + a33 * b33;
    return this;
  }
  multiplyScalar(s) {
    const te = this.elements;
    te[0] *= s;
    te[3] *= s;
    te[6] *= s;
    te[1] *= s;
    te[4] *= s;
    te[7] *= s;
    te[2] *= s;
    te[5] *= s;
    te[8] *= s;
    return this;
  }
  determinant() {
    const te = this.elements;
    const a = te[0],
      b = te[1],
      c = te[2],
      d = te[3],
      e = te[4],
      f = te[5],
      g = te[6],
      h = te[7],
      i = te[8];
    return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;
  }
  invert() {
    const te = this.elements,
      n11 = te[0],
      n21 = te[1],
      n31 = te[2],
      n12 = te[3],
      n22 = te[4],
      n32 = te[5],
      n13 = te[6],
      n23 = te[7],
      n33 = te[8],
      t11 = n33 * n22 - n32 * n23,
      t12 = n32 * n13 - n33 * n12,
      t13 = n23 * n12 - n22 * n13,
      det = n11 * t11 + n21 * t12 + n31 * t13;
    if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
    const detInv = 1 / det;
    te[0] = t11 * detInv;
    te[1] = (n31 * n23 - n33 * n21) * detInv;
    te[2] = (n32 * n21 - n31 * n22) * detInv;
    te[3] = t12 * detInv;
    te[4] = (n33 * n11 - n31 * n13) * detInv;
    te[5] = (n31 * n12 - n32 * n11) * detInv;
    te[6] = t13 * detInv;
    te[7] = (n21 * n13 - n23 * n11) * detInv;
    te[8] = (n22 * n11 - n21 * n12) * detInv;
    return this;
  }
  transpose() {
    let tmp;
    const m = this.elements;
    tmp = m[1];
    m[1] = m[3];
    m[3] = tmp;
    tmp = m[2];
    m[2] = m[6];
    m[6] = tmp;
    tmp = m[5];
    m[5] = m[7];
    m[7] = tmp;
    return this;
  }
  getNormalMatrix(matrix4) {
    return this.setFromMatrix4(matrix4).invert().transpose();
  }
  transposeIntoArray(r) {
    const m = this.elements;
    r[0] = m[0];
    r[1] = m[3];
    r[2] = m[6];
    r[3] = m[1];
    r[4] = m[4];
    r[5] = m[7];
    r[6] = m[2];
    r[7] = m[5];
    r[8] = m[8];
    return this;
  }
  setUvTransform(tx, ty, sx, sy, rotation, cx, cy) {
    const c = Math.cos(rotation);
    const s = Math.sin(rotation);
    this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);
    return this;
  }

  //

  scale(sx, sy) {
    this.premultiply(_m3.makeScale(sx, sy));
    return this;
  }
  rotate(theta) {
    this.premultiply(_m3.makeRotation(-theta));
    return this;
  }
  translate(tx, ty) {
    this.premultiply(_m3.makeTranslation(tx, ty));
    return this;
  }

  // for 2D Transforms

  makeTranslation(x, y) {
    if (x.isVector2) {
      this.set(1, 0, x.x, 0, 1, x.y, 0, 0, 1);
    } else {
      this.set(1, 0, x, 0, 1, y, 0, 0, 1);
    }
    return this;
  }
  makeRotation(theta) {
    // counterclockwise

    const c = Math.cos(theta);
    const s = Math.sin(theta);
    this.set(c, -s, 0, s, c, 0, 0, 0, 1);
    return this;
  }
  makeScale(x, y) {
    this.set(x, 0, 0, 0, y, 0, 0, 0, 1);
    return this;
  }

  //

  equals(matrix) {
    const te = this.elements;
    const me = matrix.elements;
    for (let i = 0; i < 9; i++) {
      if (te[i] !== me[i]) return false;
    }
    return true;
  }
  fromArray(array, offset = 0) {
    for (let i = 0; i < 9; i++) {
      this.elements[i] = array[i + offset];
    }
    return this;
  }
  toArray(array = [], offset = 0) {
    const te = this.elements;
    array[offset] = te[0];
    array[offset + 1] = te[1];
    array[offset + 2] = te[2];
    array[offset + 3] = te[3];
    array[offset + 4] = te[4];
    array[offset + 5] = te[5];
    array[offset + 6] = te[6];
    array[offset + 7] = te[7];
    array[offset + 8] = te[8];
    return array;
  }
  clone() {
    return new this.constructor().fromArray(this.elements);
  }
}
const _m3 = /*@__PURE__*/new Matrix3();

/**
 * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
 * or clipping. Based on W3C specifications for sRGB and Display P3,
 * and ICC specifications for the D50 connection space. Values in/out
 * are _linear_ sRGB and _linear_ Display P3.
 *
 * Note that both sRGB and Display P3 use the sRGB transfer functions.
 *
 * Reference:
 * - http://www.russellcottrell.com/photo/matrixCalculator.htm
 */

const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/new Matrix3().set(0.8224621, 0.177538, 0.0, 0.0331941, 0.9668058, 0.0, 0.0170827, 0.0723974, 0.9105199);
const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/new Matrix3().set(1.2249401, -0.2249404, 0.0, -0.0420569, 1.0420571, 0.0, -0.0196376, -0.0786361, 1.0982735);

/**
 * Defines supported color spaces by transfer function and primaries,
 * and provides conversions to/from the Linear-sRGB reference space.
 */
const COLOR_SPACES = {
  [LinearSRGBColorSpace]: {
    transfer: LinearTransfer,
    primaries: Rec709Primaries,
    luminanceCoefficients: [0.2126, 0.7152, 0.0722],
    toReference: color => color,
    fromReference: color => color
  },
  [SRGBColorSpace]: {
    transfer: SRGBTransfer,
    primaries: Rec709Primaries,
    luminanceCoefficients: [0.2126, 0.7152, 0.0722],
    toReference: color => color.convertSRGBToLinear(),
    fromReference: color => color.convertLinearToSRGB()
  },
  [LinearDisplayP3ColorSpace]: {
    transfer: LinearTransfer,
    primaries: P3Primaries,
    luminanceCoefficients: [0.2289, 0.6917, 0.0793],
    toReference: color => color.applyMatrix3(LINEAR_DISPLAY_P3_TO_LINEAR_SRGB),
    fromReference: color => color.applyMatrix3(LINEAR_SRGB_TO_LINEAR_DISPLAY_P3)
  },
  [DisplayP3ColorSpace]: {
    transfer: SRGBTransfer,
    primaries: P3Primaries,
    luminanceCoefficients: [0.2289, 0.6917, 0.0793],
    toReference: color => color.convertSRGBToLinear().applyMatrix3(LINEAR_DISPLAY_P3_TO_LINEAR_SRGB),
    fromReference: color => color.applyMatrix3(LINEAR_SRGB_TO_LINEAR_DISPLAY_P3).convertLinearToSRGB()
  }
};
const SUPPORTED_WORKING_COLOR_SPACES = new Set([LinearSRGBColorSpace, LinearDisplayP3ColorSpace]);
const ColorManagement = {
  enabled: true,
  _workingColorSpace: LinearSRGBColorSpace,
  get workingColorSpace() {
    return this._workingColorSpace;
  },
  set workingColorSpace(colorSpace) {
    if (!SUPPORTED_WORKING_COLOR_SPACES.has(colorSpace)) {
      throw new Error(`Unsupported working color space, "${colorSpace}".`);
    }
    this._workingColorSpace = colorSpace;
  },
  convert: function (color, sourceColorSpace, targetColorSpace) {
    if (this.enabled === false || sourceColorSpace === targetColorSpace || !sourceColorSpace || !targetColorSpace) {
      return color;
    }
    const sourceToReference = COLOR_SPACES[sourceColorSpace].toReference;
    const targetFromReference = COLOR_SPACES[targetColorSpace].fromReference;
    return targetFromReference(sourceToReference(color));
  },
  fromWorkingColorSpace: function (color, targetColorSpace) {
    return this.convert(color, this._workingColorSpace, targetColorSpace);
  },
  toWorkingColorSpace: function (color, sourceColorSpace) {
    return this.convert(color, sourceColorSpace, this._workingColorSpace);
  },
  getPrimaries: function (colorSpace) {
    return COLOR_SPACES[colorSpace].primaries;
  },
  getTransfer: function (colorSpace) {
    if (colorSpace === NoColorSpace) return LinearTransfer;
    return COLOR_SPACES[colorSpace].transfer;
  },
  getLuminanceCoefficients: function (target, colorSpace = this._workingColorSpace) {
    return target.fromArray(COLOR_SPACES[colorSpace].luminanceCoefficients);
  }
};
function SRGBToLinear(c) {
  return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
}
function LinearToSRGB(c) {
  return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055;
}

const _colorKeywords = {
  'aliceblue': 0xF0F8FF,
  'antiquewhite': 0xFAEBD7,
  'aqua': 0x00FFFF,
  'aquamarine': 0x7FFFD4,
  'azure': 0xF0FFFF,
  'beige': 0xF5F5DC,
  'bisque': 0xFFE4C4,
  'black': 0x000000,
  'blanchedalmond': 0xFFEBCD,
  'blue': 0x0000FF,
  'blueviolet': 0x8A2BE2,
  'brown': 0xA52A2A,
  'burlywood': 0xDEB887,
  'cadetblue': 0x5F9EA0,
  'chartreuse': 0x7FFF00,
  'chocolate': 0xD2691E,
  'coral': 0xFF7F50,
  'cornflowerblue': 0x6495ED,
  'cornsilk': 0xFFF8DC,
  'crimson': 0xDC143C,
  'cyan': 0x00FFFF,
  'darkblue': 0x00008B,
  'darkcyan': 0x008B8B,
  'darkgoldenrod': 0xB8860B,
  'darkgray': 0xA9A9A9,
  'darkgreen': 0x006400,
  'darkgrey': 0xA9A9A9,
  'darkkhaki': 0xBDB76B,
  'darkmagenta': 0x8B008B,
  'darkolivegreen': 0x556B2F,
  'darkorange': 0xFF8C00,
  'darkorchid': 0x9932CC,
  'darkred': 0x8B0000,
  'darksalmon': 0xE9967A,
  'darkseagreen': 0x8FBC8F,
  'darkslateblue': 0x483D8B,
  'darkslategray': 0x2F4F4F,
  'darkslategrey': 0x2F4F4F,
  'darkturquoise': 0x00CED1,
  'darkviolet': 0x9400D3,
  'deeppink': 0xFF1493,
  'deepskyblue': 0x00BFFF,
  'dimgray': 0x696969,
  'dimgrey': 0x696969,
  'dodgerblue': 0x1E90FF,
  'firebrick': 0xB22222,
  'floralwhite': 0xFFFAF0,
  'forestgreen': 0x228B22,
  'fuchsia': 0xFF00FF,
  'gainsboro': 0xDCDCDC,
  'ghostwhite': 0xF8F8FF,
  'gold': 0xFFD700,
  'goldenrod': 0xDAA520,
  'gray': 0x808080,
  'green': 0x008000,
  'greenyellow': 0xADFF2F,
  'grey': 0x808080,
  'honeydew': 0xF0FFF0,
  'hotpink': 0xFF69B4,
  'indianred': 0xCD5C5C,
  'indigo': 0x4B0082,
  'ivory': 0xFFFFF0,
  'khaki': 0xF0E68C,
  'lavender': 0xE6E6FA,
  'lavenderblush': 0xFFF0F5,
  'lawngreen': 0x7CFC00,
  'lemonchiffon': 0xFFFACD,
  'lightblue': 0xADD8E6,
  'lightcoral': 0xF08080,
  'lightcyan': 0xE0FFFF,
  'lightgoldenrodyellow': 0xFAFAD2,
  'lightgray': 0xD3D3D3,
  'lightgreen': 0x90EE90,
  'lightgrey': 0xD3D3D3,
  'lightpink': 0xFFB6C1,
  'lightsalmon': 0xFFA07A,
  'lightseagreen': 0x20B2AA,
  'lightskyblue': 0x87CEFA,
  'lightslategray': 0x778899,
  'lightslategrey': 0x778899,
  'lightsteelblue': 0xB0C4DE,
  'lightyellow': 0xFFFFE0,
  'lime': 0x00FF00,
  'limegreen': 0x32CD32,
  'linen': 0xFAF0E6,
  'magenta': 0xFF00FF,
  'maroon': 0x800000,
  'mediumaquamarine': 0x66CDAA,
  'mediumblue': 0x0000CD,
  'mediumorchid': 0xBA55D3,
  'mediumpurple': 0x9370DB,
  'mediumseagreen': 0x3CB371,
  'mediumslateblue': 0x7B68EE,
  'mediumspringgreen': 0x00FA9A,
  'mediumturquoise': 0x48D1CC,
  'mediumvioletred': 0xC71585,
  'midnightblue': 0x191970,
  'mintcream': 0xF5FFFA,
  'mistyrose': 0xFFE4E1,
  'moccasin': 0xFFE4B5,
  'navajowhite': 0xFFDEAD,
  'navy': 0x000080,
  'oldlace': 0xFDF5E6,
  'olive': 0x808000,
  'olivedrab': 0x6B8E23,
  'orange': 0xFFA500,
  'orangered': 0xFF4500,
  'orchid': 0xDA70D6,
  'palegoldenrod': 0xEEE8AA,
  'palegreen': 0x98FB98,
  'paleturquoise': 0xAFEEEE,
  'palevioletred': 0xDB7093,
  'papayawhip': 0xFFEFD5,
  'peachpuff': 0xFFDAB9,
  'peru': 0xCD853F,
  'pink': 0xFFC0CB,
  'plum': 0xDDA0DD,
  'powderblue': 0xB0E0E6,
  'purple': 0x800080,
  'rebeccapurple': 0x663399,
  'red': 0xFF0000,
  'rosybrown': 0xBC8F8F,
  'royalblue': 0x4169E1,
  'saddlebrown': 0x8B4513,
  'salmon': 0xFA8072,
  'sandybrown': 0xF4A460,
  'seagreen': 0x2E8B57,
  'seashell': 0xFFF5EE,
  'sienna': 0xA0522D,
  'silver': 0xC0C0C0,
  'skyblue': 0x87CEEB,
  'slateblue': 0x6A5ACD,
  'slategray': 0x708090,
  'slategrey': 0x708090,
  'snow': 0xFFFAFA,
  'springgreen': 0x00FF7F,
  'steelblue': 0x4682B4,
  'tan': 0xD2B48C,
  'teal': 0x008080,
  'thistle': 0xD8BFD8,
  'tomato': 0xFF6347,
  'turquoise': 0x40E0D0,
  'violet': 0xEE82EE,
  'wheat': 0xF5DEB3,
  'white': 0xFFFFFF,
  'whitesmoke': 0xF5F5F5,
  'yellow': 0xFFFF00,
  'yellowgreen': 0x9ACD32
};
const _hslA = {
  h: 0,
  s: 0,
  l: 0
};
const _hslB = {
  h: 0,
  s: 0,
  l: 0
};
function hue2rgb(p, q, t) {
  if (t < 0) t += 1;
  if (t > 1) t -= 1;
  if (t < 1 / 6) return p + (q - p) * 6 * t;
  if (t < 1 / 2) return q;
  if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t);
  return p;
}
class Color {
  constructor(r, g, b) {
    this.isColor = true;
    this.r = 1;
    this.g = 1;
    this.b = 1;
    return this.set(r, g, b);
  }
  set(r, g, b) {
    if (g === undefined && b === undefined) {
      // r is THREE.Color, hex or string

      const value = r;
      if (value && value.isColor) {
        this.copy(value);
      } else if (typeof value === 'number') {
        this.setHex(value);
      } else if (typeof value === 'string') {
        this.setStyle(value);
      }
    } else {
      this.setRGB(r, g, b);
    }
    return this;
  }
  setScalar(scalar) {
    this.r = scalar;
    this.g = scalar;
    this.b = scalar;
    return this;
  }
  setHex(hex, colorSpace = SRGBColorSpace) {
    hex = Math.floor(hex);
    this.r = (hex >> 16 & 255) / 255;
    this.g = (hex >> 8 & 255) / 255;
    this.b = (hex & 255) / 255;
    ColorManagement.toWorkingColorSpace(this, colorSpace);
    return this;
  }
  setRGB(r, g, b, colorSpace = ColorManagement.workingColorSpace) {
    this.r = r;
    this.g = g;
    this.b = b;
    ColorManagement.toWorkingColorSpace(this, colorSpace);
    return this;
  }
  setHSL(h, s, l, colorSpace = ColorManagement.workingColorSpace) {
    // h,s,l ranges are in 0.0 - 1.0
    h = euclideanModulo(h, 1);
    s = clamp$1(s, 0, 1);
    l = clamp$1(l, 0, 1);
    if (s === 0) {
      this.r = this.g = this.b = l;
    } else {
      const p = l <= 0.5 ? l * (1 + s) : l + s - l * s;
      const q = 2 * l - p;
      this.r = hue2rgb(q, p, h + 1 / 3);
      this.g = hue2rgb(q, p, h);
      this.b = hue2rgb(q, p, h - 1 / 3);
    }
    ColorManagement.toWorkingColorSpace(this, colorSpace);
    return this;
  }
  setStyle(style, colorSpace = SRGBColorSpace) {
    function handleAlpha(string) {
      if (string === undefined) return;
      if (parseFloat(string) < 1) {
        console.warn('THREE.Color: Alpha component of ' + style + ' will be ignored.');
      }
    }
    let m;
    if (m = /^(\w+)\(([^\)]*)\)/.exec(style)) {
      // rgb / hsl

      let color;
      const name = m[1];
      const components = m[2];
      switch (name) {
        case 'rgb':
        case 'rgba':
          if (color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
            // rgb(255,0,0) rgba(255,0,0,0.5)

            handleAlpha(color[4]);
            return this.setRGB(Math.min(255, parseInt(color[1], 10)) / 255, Math.min(255, parseInt(color[2], 10)) / 255, Math.min(255, parseInt(color[3], 10)) / 255, colorSpace);
          }
          if (color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
            // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)

            handleAlpha(color[4]);
            return this.setRGB(Math.min(100, parseInt(color[1], 10)) / 100, Math.min(100, parseInt(color[2], 10)) / 100, Math.min(100, parseInt(color[3], 10)) / 100, colorSpace);
          }
          break;
        case 'hsl':
        case 'hsla':
          if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
            // hsl(120,50%,50%) hsla(120,50%,50%,0.5)

            handleAlpha(color[4]);
            return this.setHSL(parseFloat(color[1]) / 360, parseFloat(color[2]) / 100, parseFloat(color[3]) / 100, colorSpace);
          }
          break;
        default:
          console.warn('THREE.Color: Unknown color model ' + style);
      }
    } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) {
      // hex color

      const hex = m[1];
      const size = hex.length;
      if (size === 3) {
        // #ff0
        return this.setRGB(parseInt(hex.charAt(0), 16) / 15, parseInt(hex.charAt(1), 16) / 15, parseInt(hex.charAt(2), 16) / 15, colorSpace);
      } else if (size === 6) {
        // #ff0000
        return this.setHex(parseInt(hex, 16), colorSpace);
      } else {
        console.warn('THREE.Color: Invalid hex color ' + style);
      }
    } else if (style && style.length > 0) {
      return this.setColorName(style, colorSpace);
    }
    return this;
  }
  setColorName(style, colorSpace = SRGBColorSpace) {
    // color keywords
    const hex = _colorKeywords[style.toLowerCase()];
    if (hex !== undefined) {
      // red
      this.setHex(hex, colorSpace);
    } else {
      // unknown color
      console.warn('THREE.Color: Unknown color ' + style);
    }
    return this;
  }
  clone() {
    return new this.constructor(this.r, this.g, this.b);
  }
  copy(color) {
    this.r = color.r;
    this.g = color.g;
    this.b = color.b;
    return this;
  }
  copySRGBToLinear(color) {
    this.r = SRGBToLinear(color.r);
    this.g = SRGBToLinear(color.g);
    this.b = SRGBToLinear(color.b);
    return this;
  }
  copyLinearToSRGB(color) {
    this.r = LinearToSRGB(color.r);
    this.g = LinearToSRGB(color.g);
    this.b = LinearToSRGB(color.b);
    return this;
  }
  convertSRGBToLinear() {
    this.copySRGBToLinear(this);
    return this;
  }
  convertLinearToSRGB() {
    this.copyLinearToSRGB(this);
    return this;
  }
  getHex(colorSpace = SRGBColorSpace) {
    ColorManagement.fromWorkingColorSpace(_color$1.copy(this), colorSpace);
    return Math.round(clamp$1(_color$1.r * 255, 0, 255)) * 65536 + Math.round(clamp$1(_color$1.g * 255, 0, 255)) * 256 + Math.round(clamp$1(_color$1.b * 255, 0, 255));
  }
  getHexString(colorSpace = SRGBColorSpace) {
    return ('000000' + this.getHex(colorSpace).toString(16)).slice(-6);
  }
  getHSL(target, colorSpace = ColorManagement.workingColorSpace) {
    // h,s,l ranges are in 0.0 - 1.0

    ColorManagement.fromWorkingColorSpace(_color$1.copy(this), colorSpace);
    const r = _color$1.r,
      g = _color$1.g,
      b = _color$1.b;
    const max = Math.max(r, g, b);
    const min = Math.min(r, g, b);
    let hue, saturation;
    const lightness = (min + max) / 2.0;
    if (min === max) {
      hue = 0;
      saturation = 0;
    } else {
      const delta = max - min;
      saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);
      switch (max) {
        case r:
          hue = (g - b) / delta + (g < b ? 6 : 0);
          break;
        case g:
          hue = (b - r) / delta + 2;
          break;
        case b:
          hue = (r - g) / delta + 4;
          break;
      }
      hue /= 6;
    }
    target.h = hue;
    target.s = saturation;
    target.l = lightness;
    return target;
  }
  getRGB(target, colorSpace = ColorManagement.workingColorSpace) {
    ColorManagement.fromWorkingColorSpace(_color$1.copy(this), colorSpace);
    target.r = _color$1.r;
    target.g = _color$1.g;
    target.b = _color$1.b;
    return target;
  }
  getStyle(colorSpace = SRGBColorSpace) {
    ColorManagement.fromWorkingColorSpace(_color$1.copy(this), colorSpace);
    const r = _color$1.r,
      g = _color$1.g,
      b = _color$1.b;
    if (colorSpace !== SRGBColorSpace) {
      // Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).
      return `color(${colorSpace} ${r.toFixed(3)} ${g.toFixed(3)} ${b.toFixed(3)})`;
    }
    return `rgb(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(b * 255)})`;
  }
  offsetHSL(h, s, l) {
    this.getHSL(_hslA);
    return this.setHSL(_hslA.h + h, _hslA.s + s, _hslA.l + l);
  }
  add(color) {
    this.r += color.r;
    this.g += color.g;
    this.b += color.b;
    return this;
  }
  addColors(color1, color2) {
    this.r = color1.r + color2.r;
    this.g = color1.g + color2.g;
    this.b = color1.b + color2.b;
    return this;
  }
  addScalar(s) {
    this.r += s;
    this.g += s;
    this.b += s;
    return this;
  }
  sub(color) {
    this.r = Math.max(0, this.r - color.r);
    this.g = Math.max(0, this.g - color.g);
    this.b = Math.max(0, this.b - color.b);
    return this;
  }
  multiply(color) {
    this.r *= color.r;
    this.g *= color.g;
    this.b *= color.b;
    return this;
  }
  multiplyScalar(s) {
    this.r *= s;
    this.g *= s;
    this.b *= s;
    return this;
  }
  lerp(color, alpha) {
    this.r += (color.r - this.r) * alpha;
    this.g += (color.g - this.g) * alpha;
    this.b += (color.b - this.b) * alpha;
    return this;
  }
  lerpColors(color1, color2, alpha) {
    this.r = color1.r + (color2.r - color1.r) * alpha;
    this.g = color1.g + (color2.g - color1.g) * alpha;
    this.b = color1.b + (color2.b - color1.b) * alpha;
    return this;
  }
  lerpHSL(color, alpha) {
    this.getHSL(_hslA);
    color.getHSL(_hslB);
    const h = lerp(_hslA.h, _hslB.h, alpha);
    const s = lerp(_hslA.s, _hslB.s, alpha);
    const l = lerp(_hslA.l, _hslB.l, alpha);
    this.setHSL(h, s, l);
    return this;
  }
  setFromVector3(v) {
    this.r = v.x;
    this.g = v.y;
    this.b = v.z;
    return this;
  }
  applyMatrix3(m) {
    const r = this.r,
      g = this.g,
      b = this.b;
    const e = m.elements;
    this.r = e[0] * r + e[3] * g + e[6] * b;
    this.g = e[1] * r + e[4] * g + e[7] * b;
    this.b = e[2] * r + e[5] * g + e[8] * b;
    return this;
  }
  equals(c) {
    return c.r === this.r && c.g === this.g && c.b === this.b;
  }
  fromArray(array, offset = 0) {
    this.r = array[offset];
    this.g = array[offset + 1];
    this.b = array[offset + 2];
    return this;
  }
  toArray(array = [], offset = 0) {
    array[offset] = this.r;
    array[offset + 1] = this.g;
    array[offset + 2] = this.b;
    return array;
  }
  fromBufferAttribute(attribute, index) {
    this.r = attribute.getX(index);
    this.g = attribute.getY(index);
    this.b = attribute.getZ(index);
    return this;
  }
  toJSON() {
    return this.getHex();
  }
  *[Symbol.iterator]() {
    yield this.r;
    yield this.g;
    yield this.b;
  }
}
const _color$1 = /*@__PURE__*/new Color();
Color.NAMES = _colorKeywords;

class Color4 extends Color {
  constructor(r, g, b, a = 1) {
    super(r, g, b);
    this.a = a;
  }
  set(r, g, b, a = 1) {
    this.a = a;
    return super.set(r, g, b);
  }
  copy(color) {
    if (color.a !== undefined) this.a = color.a;
    return super.copy(color);
  }
  clone() {
    return new this.constructor(this.r, this.g, this.b, this.a);
  }
}
var Color4$1 = Color4;

const NodeShaderStage = {
  VERTEX: 'vertex',
  FRAGMENT: 'fragment'
};
const NodeUpdateType = {
  NONE: 'none',
  FRAME: 'frame',
  RENDER: 'render',
  OBJECT: 'object'
};
const vectorComponents = ['x', 'y', 'z', 'w'];

class Quaternion {
  constructor(x = 0, y = 0, z = 0, w = 1) {
    this.isQuaternion = true;
    this._x = x;
    this._y = y;
    this._z = z;
    this._w = w;
  }
  static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {
    // fuzz-free, array-based Quaternion SLERP operation

    let x0 = src0[srcOffset0 + 0],
      y0 = src0[srcOffset0 + 1],
      z0 = src0[srcOffset0 + 2],
      w0 = src0[srcOffset0 + 3];
    const x1 = src1[srcOffset1 + 0],
      y1 = src1[srcOffset1 + 1],
      z1 = src1[srcOffset1 + 2],
      w1 = src1[srcOffset1 + 3];
    if (t === 0) {
      dst[dstOffset + 0] = x0;
      dst[dstOffset + 1] = y0;
      dst[dstOffset + 2] = z0;
      dst[dstOffset + 3] = w0;
      return;
    }
    if (t === 1) {
      dst[dstOffset + 0] = x1;
      dst[dstOffset + 1] = y1;
      dst[dstOffset + 2] = z1;
      dst[dstOffset + 3] = w1;
      return;
    }
    if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) {
      let s = 1 - t;
      const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,
        dir = cos >= 0 ? 1 : -1,
        sqrSin = 1 - cos * cos;

      // Skip the Slerp for tiny steps to avoid numeric problems:
      if (sqrSin > Number.EPSILON) {
        const sin = Math.sqrt(sqrSin),
          len = Math.atan2(sin, cos * dir);
        s = Math.sin(s * len) / sin;
        t = Math.sin(t * len) / sin;
      }
      const tDir = t * dir;
      x0 = x0 * s + x1 * tDir;
      y0 = y0 * s + y1 * tDir;
      z0 = z0 * s + z1 * tDir;
      w0 = w0 * s + w1 * tDir;

      // Normalize in case we just did a lerp:
      if (s === 1 - t) {
        const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0);
        x0 *= f;
        y0 *= f;
        z0 *= f;
        w0 *= f;
      }
    }
    dst[dstOffset] = x0;
    dst[dstOffset + 1] = y0;
    dst[dstOffset + 2] = z0;
    dst[dstOffset + 3] = w0;
  }
  static multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) {
    const x0 = src0[srcOffset0];
    const y0 = src0[srcOffset0 + 1];
    const z0 = src0[srcOffset0 + 2];
    const w0 = src0[srcOffset0 + 3];
    const x1 = src1[srcOffset1];
    const y1 = src1[srcOffset1 + 1];
    const z1 = src1[srcOffset1 + 2];
    const w1 = src1[srcOffset1 + 3];
    dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;
    dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;
    dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;
    dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;
    return dst;
  }
  get x() {
    return this._x;
  }
  set x(value) {
    this._x = value;
    this._onChangeCallback();
  }
  get y() {
    return this._y;
  }
  set y(value) {
    this._y = value;
    this._onChangeCallback();
  }
  get z() {
    return this._z;
  }
  set z(value) {
    this._z = value;
    this._onChangeCallback();
  }
  get w() {
    return this._w;
  }
  set w(value) {
    this._w = value;
    this._onChangeCallback();
  }
  set(x, y, z, w) {
    this._x = x;
    this._y = y;
    this._z = z;
    this._w = w;
    this._onChangeCallback();
    return this;
  }
  clone() {
    return new this.constructor(this._x, this._y, this._z, this._w);
  }
  copy(quaternion) {
    this._x = quaternion.x;
    this._y = quaternion.y;
    this._z = quaternion.z;
    this._w = quaternion.w;
    this._onChangeCallback();
    return this;
  }
  setFromEuler(euler, update = true) {
    const x = euler._x,
      y = euler._y,
      z = euler._z,
      order = euler._order;

    // http://www.mathworks.com/matlabcentral/fileexchange/
    // 	20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
    //	content/SpinCalc.m

    const cos = Math.cos;
    const sin = Math.sin;
    const c1 = cos(x / 2);
    const c2 = cos(y / 2);
    const c3 = cos(z / 2);
    const s1 = sin(x / 2);
    const s2 = sin(y / 2);
    const s3 = sin(z / 2);
    switch (order) {
      case 'XYZ':
        this._x = s1 * c2 * c3 + c1 * s2 * s3;
        this._y = c1 * s2 * c3 - s1 * c2 * s3;
        this._z = c1 * c2 * s3 + s1 * s2 * c3;
        this._w = c1 * c2 * c3 - s1 * s2 * s3;
        break;
      case 'YXZ':
        this._x = s1 * c2 * c3 + c1 * s2 * s3;
        this._y = c1 * s2 * c3 - s1 * c2 * s3;
        this._z = c1 * c2 * s3 - s1 * s2 * c3;
        this._w = c1 * c2 * c3 + s1 * s2 * s3;
        break;
      case 'ZXY':
        this._x = s1 * c2 * c3 - c1 * s2 * s3;
        this._y = c1 * s2 * c3 + s1 * c2 * s3;
        this._z = c1 * c2 * s3 + s1 * s2 * c3;
        this._w = c1 * c2 * c3 - s1 * s2 * s3;
        break;
      case 'ZYX':
        this._x = s1 * c2 * c3 - c1 * s2 * s3;
        this._y = c1 * s2 * c3 + s1 * c2 * s3;
        this._z = c1 * c2 * s3 - s1 * s2 * c3;
        this._w = c1 * c2 * c3 + s1 * s2 * s3;
        break;
      case 'YZX':
        this._x = s1 * c2 * c3 + c1 * s2 * s3;
        this._y = c1 * s2 * c3 + s1 * c2 * s3;
        this._z = c1 * c2 * s3 - s1 * s2 * c3;
        this._w = c1 * c2 * c3 - s1 * s2 * s3;
        break;
      case 'XZY':
        this._x = s1 * c2 * c3 - c1 * s2 * s3;
        this._y = c1 * s2 * c3 - s1 * c2 * s3;
        this._z = c1 * c2 * s3 + s1 * s2 * c3;
        this._w = c1 * c2 * c3 + s1 * s2 * s3;
        break;
      default:
        console.warn('THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order);
    }
    if (update === true) this._onChangeCallback();
    return this;
  }
  setFromAxisAngle(axis, angle) {
    // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm

    // assumes axis is normalized

    const halfAngle = angle / 2,
      s = Math.sin(halfAngle);
    this._x = axis.x * s;
    this._y = axis.y * s;
    this._z = axis.z * s;
    this._w = Math.cos(halfAngle);
    this._onChangeCallback();
    return this;
  }
  setFromRotationMatrix(m) {
    // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm

    // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)

    const te = m.elements,
      m11 = te[0],
      m12 = te[4],
      m13 = te[8],
      m21 = te[1],
      m22 = te[5],
      m23 = te[9],
      m31 = te[2],
      m32 = te[6],
      m33 = te[10],
      trace = m11 + m22 + m33;
    if (trace > 0) {
      const s = 0.5 / Math.sqrt(trace + 1.0);
      this._w = 0.25 / s;
      this._x = (m32 - m23) * s;
      this._y = (m13 - m31) * s;
      this._z = (m21 - m12) * s;
    } else if (m11 > m22 && m11 > m33) {
      const s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);
      this._w = (m32 - m23) / s;
      this._x = 0.25 * s;
      this._y = (m12 + m21) / s;
      this._z = (m13 + m31) / s;
    } else if (m22 > m33) {
      const s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);
      this._w = (m13 - m31) / s;
      this._x = (m12 + m21) / s;
      this._y = 0.25 * s;
      this._z = (m23 + m32) / s;
    } else {
      const s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);
      this._w = (m21 - m12) / s;
      this._x = (m13 + m31) / s;
      this._y = (m23 + m32) / s;
      this._z = 0.25 * s;
    }
    this._onChangeCallback();
    return this;
  }
  setFromUnitVectors(vFrom, vTo) {
    // assumes direction vectors vFrom and vTo are normalized

    let r = vFrom.dot(vTo) + 1;
    if (r < Number.EPSILON) {
      // vFrom and vTo point in opposite directions

      r = 0;
      if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) {
        this._x = -vFrom.y;
        this._y = vFrom.x;
        this._z = 0;
        this._w = r;
      } else {
        this._x = 0;
        this._y = -vFrom.z;
        this._z = vFrom.y;
        this._w = r;
      }
    } else {
      // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3

      this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;
      this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;
      this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;
      this._w = r;
    }
    return this.normalize();
  }
  angleTo(q) {
    return 2 * Math.acos(Math.abs(clamp$1(this.dot(q), -1, 1)));
  }
  rotateTowards(q, step) {
    const angle = this.angleTo(q);
    if (angle === 0) return this;
    const t = Math.min(1, step / angle);
    this.slerp(q, t);
    return this;
  }
  identity() {
    return this.set(0, 0, 0, 1);
  }
  invert() {
    // quaternion is assumed to have unit length

    return this.conjugate();
  }
  conjugate() {
    this._x *= -1;
    this._y *= -1;
    this._z *= -1;
    this._onChangeCallback();
    return this;
  }
  dot(v) {
    return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;
  }
  lengthSq() {
    return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
  }
  length() {
    return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);
  }
  normalize() {
    let l = this.length();
    if (l === 0) {
      this._x = 0;
      this._y = 0;
      this._z = 0;
      this._w = 1;
    } else {
      l = 1 / l;
      this._x = this._x * l;
      this._y = this._y * l;
      this._z = this._z * l;
      this._w = this._w * l;
    }
    this._onChangeCallback();
    return this;
  }
  multiply(q) {
    return this.multiplyQuaternions(this, q);
  }
  premultiply(q) {
    return this.multiplyQuaternions(q, this);
  }
  multiplyQuaternions(a, b) {
    // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm

    const qax = a._x,
      qay = a._y,
      qaz = a._z,
      qaw = a._w;
    const qbx = b._x,
      qby = b._y,
      qbz = b._z,
      qbw = b._w;
    this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
    this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
    this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
    this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
    this._onChangeCallback();
    return this;
  }
  slerp(qb, t) {
    if (t === 0) return this;
    if (t === 1) return this.copy(qb);
    const x = this._x,
      y = this._y,
      z = this._z,
      w = this._w;

    // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/

    let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;
    if (cosHalfTheta < 0) {
      this._w = -qb._w;
      this._x = -qb._x;
      this._y = -qb._y;
      this._z = -qb._z;
      cosHalfTheta = -cosHalfTheta;
    } else {
      this.copy(qb);
    }
    if (cosHalfTheta >= 1.0) {
      this._w = w;
      this._x = x;
      this._y = y;
      this._z = z;
      return this;
    }
    const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;
    if (sqrSinHalfTheta <= Number.EPSILON) {
      const s = 1 - t;
      this._w = s * w + t * this._w;
      this._x = s * x + t * this._x;
      this._y = s * y + t * this._y;
      this._z = s * z + t * this._z;
      this.normalize(); // normalize calls _onChangeCallback()

      return this;
    }
    const sinHalfTheta = Math.sqrt(sqrSinHalfTheta);
    const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta);
    const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta,
      ratioB = Math.sin(t * halfTheta) / sinHalfTheta;
    this._w = w * ratioA + this._w * ratioB;
    this._x = x * ratioA + this._x * ratioB;
    this._y = y * ratioA + this._y * ratioB;
    this._z = z * ratioA + this._z * ratioB;
    this._onChangeCallback();
    return this;
  }
  slerpQuaternions(qa, qb, t) {
    return this.copy(qa).slerp(qb, t);
  }
  random() {
    // sets this quaternion to a uniform random unit quaternnion

    // Ken Shoemake
    // Uniform random rotations
    // D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.

    const theta1 = 2 * Math.PI * Math.random();
    const theta2 = 2 * Math.PI * Math.random();
    const x0 = Math.random();
    const r1 = Math.sqrt(1 - x0);
    const r2 = Math.sqrt(x0);
    return this.set(r1 * Math.sin(theta1), r1 * Math.cos(theta1), r2 * Math.sin(theta2), r2 * Math.cos(theta2));
  }
  equals(quaternion) {
    return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w;
  }
  fromArray(array, offset = 0) {
    this._x = array[offset];
    this._y = array[offset + 1];
    this._z = array[offset + 2];
    this._w = array[offset + 3];
    this._onChangeCallback();
    return this;
  }
  toArray(array = [], offset = 0) {
    array[offset] = this._x;
    array[offset + 1] = this._y;
    array[offset + 2] = this._z;
    array[offset + 3] = this._w;
    return array;
  }
  fromBufferAttribute(attribute, index) {
    this._x = attribute.getX(index);
    this._y = attribute.getY(index);
    this._z = attribute.getZ(index);
    this._w = attribute.getW(index);
    this._onChangeCallback();
    return this;
  }
  toJSON() {
    return this.toArray();
  }
  _onChange(callback) {
    this._onChangeCallback = callback;
    return this;
  }
  _onChangeCallback() {}
  *[Symbol.iterator]() {
    yield this._x;
    yield this._y;
    yield this._z;
    yield this._w;
  }
}

class Vector3 {
  constructor(x = 0, y = 0, z = 0) {
    Vector3.prototype.isVector3 = true;
    this.x = x;
    this.y = y;
    this.z = z;
  }
  set(x, y, z) {
    if (z === undefined) z = this.z; // sprite.scale.set(x,y)

    this.x = x;
    this.y = y;
    this.z = z;
    return this;
  }
  setScalar(scalar) {
    this.x = scalar;
    this.y = scalar;
    this.z = scalar;
    return this;
  }
  setX(x) {
    this.x = x;
    return this;
  }
  setY(y) {
    this.y = y;
    return this;
  }
  setZ(z) {
    this.z = z;
    return this;
  }
  setComponent(index, value) {
    switch (index) {
      case 0:
        this.x = value;
        break;
      case 1:
        this.y = value;
        break;
      case 2:
        this.z = value;
        break;
      default:
        throw new Error('index is out of range: ' + index);
    }
    return this;
  }
  getComponent(index) {
    switch (index) {
      case 0:
        return this.x;
      case 1:
        return this.y;
      case 2:
        return this.z;
      default:
        throw new Error('index is out of range: ' + index);
    }
  }
  clone() {
    return new this.constructor(this.x, this.y, this.z);
  }
  copy(v) {
    this.x = v.x;
    this.y = v.y;
    this.z = v.z;
    return this;
  }
  add(v) {
    this.x += v.x;
    this.y += v.y;
    this.z += v.z;
    return this;
  }
  addScalar(s) {
    this.x += s;
    this.y += s;
    this.z += s;
    return this;
  }
  addVectors(a, b) {
    this.x = a.x + b.x;
    this.y = a.y + b.y;
    this.z = a.z + b.z;
    return this;
  }
  addScaledVector(v, s) {
    this.x += v.x * s;
    this.y += v.y * s;
    this.z += v.z * s;
    return this;
  }
  sub(v) {
    this.x -= v.x;
    this.y -= v.y;
    this.z -= v.z;
    return this;
  }
  subScalar(s) {
    this.x -= s;
    this.y -= s;
    this.z -= s;
    return this;
  }
  subVectors(a, b) {
    this.x = a.x - b.x;
    this.y = a.y - b.y;
    this.z = a.z - b.z;
    return this;
  }
  multiply(v) {
    this.x *= v.x;
    this.y *= v.y;
    this.z *= v.z;
    return this;
  }
  multiplyScalar(scalar) {
    this.x *= scalar;
    this.y *= scalar;
    this.z *= scalar;
    return this;
  }
  multiplyVectors(a, b) {
    this.x = a.x * b.x;
    this.y = a.y * b.y;
    this.z = a.z * b.z;
    return this;
  }
  applyEuler(euler) {
    return this.applyQuaternion(_quaternion$2.setFromEuler(euler));
  }
  applyAxisAngle(axis, angle) {
    return this.applyQuaternion(_quaternion$2.setFromAxisAngle(axis, angle));
  }
  applyMatrix3(m) {
    const x = this.x,
      y = this.y,
      z = this.z;
    const e = m.elements;
    this.x = e[0] * x + e[3] * y + e[6] * z;
    this.y = e[1] * x + e[4] * y + e[7] * z;
    this.z = e[2] * x + e[5] * y + e[8] * z;
    return this;
  }
  applyNormalMatrix(m) {
    return this.applyMatrix3(m).normalize();
  }
  applyMatrix4(m) {
    const x = this.x,
      y = this.y,
      z = this.z;
    const e = m.elements;
    const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);
    this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;
    this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;
    this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;
    return this;
  }
  applyQuaternion(q) {
    // quaternion q is assumed to have unit length

    const vx = this.x,
      vy = this.y,
      vz = this.z;
    const qx = q.x,
      qy = q.y,
      qz = q.z,
      qw = q.w;

    // t = 2 * cross( q.xyz, v );
    const tx = 2 * (qy * vz - qz * vy);
    const ty = 2 * (qz * vx - qx * vz);
    const tz = 2 * (qx * vy - qy * vx);

    // v + q.w * t + cross( q.xyz, t );
    this.x = vx + qw * tx + qy * tz - qz * ty;
    this.y = vy + qw * ty + qz * tx - qx * tz;
    this.z = vz + qw * tz + qx * ty - qy * tx;
    return this;
  }
  project(camera) {
    return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix);
  }
  unproject(camera) {
    return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld);
  }
  transformDirection(m) {
    // input: THREE.Matrix4 affine matrix
    // vector interpreted as a direction

    const x = this.x,
      y = this.y,
      z = this.z;
    const e = m.elements;
    this.x = e[0] * x + e[4] * y + e[8] * z;
    this.y = e[1] * x + e[5] * y + e[9] * z;
    this.z = e[2] * x + e[6] * y + e[10] * z;
    return this.normalize();
  }
  divide(v) {
    this.x /= v.x;
    this.y /= v.y;
    this.z /= v.z;
    return this;
  }
  divideScalar(scalar) {
    return this.multiplyScalar(1 / scalar);
  }
  min(v) {
    this.x = Math.min(this.x, v.x);
    this.y = Math.min(this.y, v.y);
    this.z = Math.min(this.z, v.z);
    return this;
  }
  max(v) {
    this.x = Math.max(this.x, v.x);
    this.y = Math.max(this.y, v.y);
    this.z = Math.max(this.z, v.z);
    return this;
  }
  clamp(min, max) {
    // assumes min < max, componentwise

    this.x = Math.max(min.x, Math.min(max.x, this.x));
    this.y = Math.max(min.y, Math.min(max.y, this.y));
    this.z = Math.max(min.z, Math.min(max.z, this.z));
    return this;
  }
  clampScalar(minVal, maxVal) {
    this.x = Math.max(minVal, Math.min(maxVal, this.x));
    this.y = Math.max(minVal, Math.min(maxVal, this.y));
    this.z = Math.max(minVal, Math.min(maxVal, this.z));
    return this;
  }
  clampLength(min, max) {
    const length = this.length();
    return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
  }
  floor() {
    this.x = Math.floor(this.x);
    this.y = Math.floor(this.y);
    this.z = Math.floor(this.z);
    return this;
  }
  ceil() {
    this.x = Math.ceil(this.x);
    this.y = Math.ceil(this.y);
    this.z = Math.ceil(this.z);
    return this;
  }
  round() {
    this.x = Math.round(this.x);
    this.y = Math.round(this.y);
    this.z = Math.round(this.z);
    return this;
  }
  roundToZero() {
    this.x = Math.trunc(this.x);
    this.y = Math.trunc(this.y);
    this.z = Math.trunc(this.z);
    return this;
  }
  negate() {
    this.x = -this.x;
    this.y = -this.y;
    this.z = -this.z;
    return this;
  }
  dot(v) {
    return this.x * v.x + this.y * v.y + this.z * v.z;
  }

  // TODO lengthSquared?

  lengthSq() {
    return this.x * this.x + this.y * this.y + this.z * this.z;
  }
  length() {
    return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
  }
  manhattanLength() {
    return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);
  }
  normalize() {
    return this.divideScalar(this.length() || 1);
  }
  setLength(length) {
    return this.normalize().multiplyScalar(length);
  }
  lerp(v, alpha) {
    this.x += (v.x - this.x) * alpha;
    this.y += (v.y - this.y) * alpha;
    this.z += (v.z - this.z) * alpha;
    return this;
  }
  lerpVectors(v1, v2, alpha) {
    this.x = v1.x + (v2.x - v1.x) * alpha;
    this.y = v1.y + (v2.y - v1.y) * alpha;
    this.z = v1.z + (v2.z - v1.z) * alpha;
    return this;
  }
  cross(v) {
    return this.crossVectors(this, v);
  }
  crossVectors(a, b) {
    const ax = a.x,
      ay = a.y,
      az = a.z;
    const bx = b.x,
      by = b.y,
      bz = b.z;
    this.x = ay * bz - az * by;
    this.y = az * bx - ax * bz;
    this.z = ax * by - ay * bx;
    return this;
  }
  projectOnVector(v) {
    const denominator = v.lengthSq();
    if (denominator === 0) return this.set(0, 0, 0);
    const scalar = v.dot(this) / denominator;
    return this.copy(v).multiplyScalar(scalar);
  }
  projectOnPlane(planeNormal) {
    _vector$5.copy(this).projectOnVector(planeNormal);
    return this.sub(_vector$5);
  }
  reflect(normal) {
    // reflect incident vector off plane orthogonal to normal
    // normal is assumed to have unit length

    return this.sub(_vector$5.copy(normal).multiplyScalar(2 * this.dot(normal)));
  }
  angleTo(v) {
    const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());
    if (denominator === 0) return Math.PI / 2;
    const theta = this.dot(v) / denominator;

    // clamp, to handle numerical problems

    return Math.acos(clamp$1(theta, -1, 1));
  }
  distanceTo(v) {
    return Math.sqrt(this.distanceToSquared(v));
  }
  distanceToSquared(v) {
    const dx = this.x - v.x,
      dy = this.y - v.y,
      dz = this.z - v.z;
    return dx * dx + dy * dy + dz * dz;
  }
  manhattanDistanceTo(v) {
    return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z);
  }
  setFromSpherical(s) {
    return this.setFromSphericalCoords(s.radius, s.phi, s.theta);
  }
  setFromSphericalCoords(radius, phi, theta) {
    const sinPhiRadius = Math.sin(phi) * radius;
    this.x = sinPhiRadius * Math.sin(theta);
    this.y = Math.cos(phi) * radius;
    this.z = sinPhiRadius * Math.cos(theta);
    return this;
  }
  setFromCylindrical(c) {
    return this.setFromCylindricalCoords(c.radius, c.theta, c.y);
  }
  setFromCylindricalCoords(radius, theta, y) {
    this.x = radius * Math.sin(theta);
    this.y = y;
    this.z = radius * Math.cos(theta);
    return this;
  }
  setFromMatrixPosition(m) {
    const e = m.elements;
    this.x = e[12];
    this.y = e[13];
    this.z = e[14];
    return this;
  }
  setFromMatrixScale(m) {
    const sx = this.setFromMatrixColumn(m, 0).length();
    const sy = this.setFromMatrixColumn(m, 1).length();
    const sz = this.setFromMatrixColumn(m, 2).length();
    this.x = sx;
    this.y = sy;
    this.z = sz;
    return this;
  }
  setFromMatrixColumn(m, index) {
    return this.fromArray(m.elements, index * 4);
  }
  setFromMatrix3Column(m, index) {
    return this.fromArray(m.elements, index * 3);
  }
  setFromEuler(e) {
    this.x = e._x;
    this.y = e._y;
    this.z = e._z;
    return this;
  }
  setFromColor(c) {
    this.x = c.r;
    this.y = c.g;
    this.z = c.b;
    return this;
  }
  equals(v) {
    return v.x === this.x && v.y === this.y && v.z === this.z;
  }
  fromArray(array, offset = 0) {
    this.x = array[offset];
    this.y = array[offset + 1];
    this.z = array[offset + 2];
    return this;
  }
  toArray(array = [], offset = 0) {
    array[offset] = this.x;
    array[offset + 1] = this.y;
    array[offset + 2] = this.z;
    return array;
  }
  fromBufferAttribute(attribute, index) {
    this.x = attribute.getX(index);
    this.y = attribute.getY(index);
    this.z = attribute.getZ(index);
    return this;
  }
  random() {
    this.x = Math.random();
    this.y = Math.random();
    this.z = Math.random();
    return this;
  }
  randomDirection() {
    // https://mathworld.wolfram.com/SpherePointPicking.html

    const theta = Math.random() * Math.PI * 2;
    const u = Math.random() * 2 - 1;
    const c = Math.sqrt(1 - u * u);
    this.x = c * Math.cos(theta);
    this.y = u;
    this.z = c * Math.sin(theta);
    return this;
  }
  *[Symbol.iterator]() {
    yield this.x;
    yield this.y;
    yield this.z;
  }
}
const _vector$5 = /*@__PURE__*/new Vector3();
const _quaternion$2 = /*@__PURE__*/new Quaternion();

class Matrix4 {
  constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
    Matrix4.prototype.isMatrix4 = true;
    this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
    if (n11 !== undefined) {
      this.set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44);
    }
  }
  set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
    const te = this.elements;
    te[0] = n11;
    te[4] = n12;
    te[8] = n13;
    te[12] = n14;
    te[1] = n21;
    te[5] = n22;
    te[9] = n23;
    te[13] = n24;
    te[2] = n31;
    te[6] = n32;
    te[10] = n33;
    te[14] = n34;
    te[3] = n41;
    te[7] = n42;
    te[11] = n43;
    te[15] = n44;
    return this;
  }
  identity() {
    this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
    return this;
  }
  clone() {
    return new Matrix4().fromArray(this.elements);
  }
  copy(m) {
    const te = this.elements;
    const me = m.elements;
    te[0] = me[0];
    te[1] = me[1];
    te[2] = me[2];
    te[3] = me[3];
    te[4] = me[4];
    te[5] = me[5];
    te[6] = me[6];
    te[7] = me[7];
    te[8] = me[8];
    te[9] = me[9];
    te[10] = me[10];
    te[11] = me[11];
    te[12] = me[12];
    te[13] = me[13];
    te[14] = me[14];
    te[15] = me[15];
    return this;
  }
  copyPosition(m) {
    const te = this.elements,
      me = m.elements;
    te[12] = me[12];
    te[13] = me[13];
    te[14] = me[14];
    return this;
  }
  setFromMatrix3(m) {
    const me = m.elements;
    this.set(me[0], me[3], me[6], 0, me[1], me[4], me[7], 0, me[2], me[5], me[8], 0, 0, 0, 0, 1);
    return this;
  }
  extractBasis(xAxis, yAxis, zAxis) {
    xAxis.setFromMatrixColumn(this, 0);
    yAxis.setFromMatrixColumn(this, 1);
    zAxis.setFromMatrixColumn(this, 2);
    return this;
  }
  makeBasis(xAxis, yAxis, zAxis) {
    this.set(xAxis.x, yAxis.x, zAxis.x, 0, xAxis.y, yAxis.y, zAxis.y, 0, xAxis.z, yAxis.z, zAxis.z, 0, 0, 0, 0, 1);
    return this;
  }
  extractRotation(m) {
    // this method does not support reflection matrices

    const te = this.elements;
    const me = m.elements;
    const scaleX = 1 / _v1$4.setFromMatrixColumn(m, 0).length();
    const scaleY = 1 / _v1$4.setFromMatrixColumn(m, 1).length();
    const scaleZ = 1 / _v1$4.setFromMatrixColumn(m, 2).length();
    te[0] = me[0] * scaleX;
    te[1] = me[1] * scaleX;
    te[2] = me[2] * scaleX;
    te[3] = 0;
    te[4] = me[4] * scaleY;
    te[5] = me[5] * scaleY;
    te[6] = me[6] * scaleY;
    te[7] = 0;
    te[8] = me[8] * scaleZ;
    te[9] = me[9] * scaleZ;
    te[10] = me[10] * scaleZ;
    te[11] = 0;
    te[12] = 0;
    te[13] = 0;
    te[14] = 0;
    te[15] = 1;
    return this;
  }
  makeRotationFromEuler(euler) {
    const te = this.elements;
    const x = euler.x,
      y = euler.y,
      z = euler.z;
    const a = Math.cos(x),
      b = Math.sin(x);
    const c = Math.cos(y),
      d = Math.sin(y);
    const e = Math.cos(z),
      f = Math.sin(z);
    if (euler.order === 'XYZ') {
      const ae = a * e,
        af = a * f,
        be = b * e,
        bf = b * f;
      te[0] = c * e;
      te[4] = -c * f;
      te[8] = d;
      te[1] = af + be * d;
      te[5] = ae - bf * d;
      te[9] = -b * c;
      te[2] = bf - ae * d;
      te[6] = be + af * d;
      te[10] = a * c;
    } else if (euler.order === 'YXZ') {
      const ce = c * e,
        cf = c * f,
        de = d * e,
        df = d * f;
      te[0] = ce + df * b;
      te[4] = de * b - cf;
      te[8] = a * d;
      te[1] = a * f;
      te[5] = a * e;
      te[9] = -b;
      te[2] = cf * b - de;
      te[6] = df + ce * b;
      te[10] = a * c;
    } else if (euler.order === 'ZXY') {
      const ce = c * e,
        cf = c * f,
        de = d * e,
        df = d * f;
      te[0] = ce - df * b;
      te[4] = -a * f;
      te[8] = de + cf * b;
      te[1] = cf + de * b;
      te[5] = a * e;
      te[9] = df - ce * b;
      te[2] = -a * d;
      te[6] = b;
      te[10] = a * c;
    } else if (euler.order === 'ZYX') {
      const ae = a * e,
        af = a * f,
        be = b * e,
        bf = b * f;
      te[0] = c * e;
      te[4] = be * d - af;
      te[8] = ae * d + bf;
      te[1] = c * f;
      te[5] = bf * d + ae;
      te[9] = af * d - be;
      te[2] = -d;
      te[6] = b * c;
      te[10] = a * c;
    } else if (euler.order === 'YZX') {
      const ac = a * c,
        ad = a * d,
        bc = b * c,
        bd = b * d;
      te[0] = c * e;
      te[4] = bd - ac * f;
      te[8] = bc * f + ad;
      te[1] = f;
      te[5] = a * e;
      te[9] = -b * e;
      te[2] = -d * e;
      te[6] = ad * f + bc;
      te[10] = ac - bd * f;
    } else if (euler.order === 'XZY') {
      const ac = a * c,
        ad = a * d,
        bc = b * c,
        bd = b * d;
      te[0] = c * e;
      te[4] = -f;
      te[8] = d * e;
      te[1] = ac * f + bd;
      te[5] = a * e;
      te[9] = ad * f - bc;
      te[2] = bc * f - ad;
      te[6] = b * e;
      te[10] = bd * f + ac;
    }

    // bottom row
    te[3] = 0;
    te[7] = 0;
    te[11] = 0;

    // last column
    te[12] = 0;
    te[13] = 0;
    te[14] = 0;
    te[15] = 1;
    return this;
  }
  makeRotationFromQuaternion(q) {
    return this.compose(_zero, q, _one);
  }
  lookAt(eye, target, up) {
    const te = this.elements;
    _z.subVectors(eye, target);
    if (_z.lengthSq() === 0) {
      // eye and target are in the same position

      _z.z = 1;
    }
    _z.normalize();
    _x.crossVectors(up, _z);
    if (_x.lengthSq() === 0) {
      // up and z are parallel

      if (Math.abs(up.z) === 1) {
        _z.x += 0.0001;
      } else {
        _z.z += 0.0001;
      }
      _z.normalize();
      _x.crossVectors(up, _z);
    }
    _x.normalize();
    _y.crossVectors(_z, _x);
    te[0] = _x.x;
    te[4] = _y.x;
    te[8] = _z.x;
    te[1] = _x.y;
    te[5] = _y.y;
    te[9] = _z.y;
    te[2] = _x.z;
    te[6] = _y.z;
    te[10] = _z.z;
    return this;
  }
  multiply(m) {
    return this.multiplyMatrices(this, m);
  }
  premultiply(m) {
    return this.multiplyMatrices(m, this);
  }
  multiplyMatrices(a, b) {
    const ae = a.elements;
    const be = b.elements;
    const te = this.elements;
    const a11 = ae[0],
      a12 = ae[4],
      a13 = ae[8],
      a14 = ae[12];
    const a21 = ae[1],
      a22 = ae[5],
      a23 = ae[9],
      a24 = ae[13];
    const a31 = ae[2],
      a32 = ae[6],
      a33 = ae[10],
      a34 = ae[14];
    const a41 = ae[3],
      a42 = ae[7],
      a43 = ae[11],
      a44 = ae[15];
    const b11 = be[0],
      b12 = be[4],
      b13 = be[8],
      b14 = be[12];
    const b21 = be[1],
      b22 = be[5],
      b23 = be[9],
      b24 = be[13];
    const b31 = be[2],
      b32 = be[6],
      b33 = be[10],
      b34 = be[14];
    const b41 = be[3],
      b42 = be[7],
      b43 = be[11],
      b44 = be[15];
    te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
    te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
    te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
    te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
    te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
    te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
    te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
    te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
    te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
    te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
    te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
    te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
    te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
    te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
    te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
    te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
    return this;
  }
  multiplyScalar(s) {
    const te = this.elements;
    te[0] *= s;
    te[4] *= s;
    te[8] *= s;
    te[12] *= s;
    te[1] *= s;
    te[5] *= s;
    te[9] *= s;
    te[13] *= s;
    te[2] *= s;
    te[6] *= s;
    te[10] *= s;
    te[14] *= s;
    te[3] *= s;
    te[7] *= s;
    te[11] *= s;
    te[15] *= s;
    return this;
  }
  determinant() {
    const te = this.elements;
    const n11 = te[0],
      n12 = te[4],
      n13 = te[8],
      n14 = te[12];
    const n21 = te[1],
      n22 = te[5],
      n23 = te[9],
      n24 = te[13];
    const n31 = te[2],
      n32 = te[6],
      n33 = te[10],
      n34 = te[14];
    const n41 = te[3],
      n42 = te[7],
      n43 = te[11],
      n44 = te[15];

    //TODO: make this more efficient
    //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )

    return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31);
  }
  transpose() {
    const te = this.elements;
    let tmp;
    tmp = te[1];
    te[1] = te[4];
    te[4] = tmp;
    tmp = te[2];
    te[2] = te[8];
    te[8] = tmp;
    tmp = te[6];
    te[6] = te[9];
    te[9] = tmp;
    tmp = te[3];
    te[3] = te[12];
    te[12] = tmp;
    tmp = te[7];
    te[7] = te[13];
    te[13] = tmp;
    tmp = te[11];
    te[11] = te[14];
    te[14] = tmp;
    return this;
  }
  setPosition(x, y, z) {
    const te = this.elements;
    if (x.isVector3) {
      te[12] = x.x;
      te[13] = x.y;
      te[14] = x.z;
    } else {
      te[12] = x;
      te[13] = y;
      te[14] = z;
    }
    return this;
  }
  invert() {
    // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
    const te = this.elements,
      n11 = te[0],
      n21 = te[1],
      n31 = te[2],
      n41 = te[3],
      n12 = te[4],
      n22 = te[5],
      n32 = te[6],
      n42 = te[7],
      n13 = te[8],
      n23 = te[9],
      n33 = te[10],
      n43 = te[11],
      n14 = te[12],
      n24 = te[13],
      n34 = te[14],
      n44 = te[15],
      t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,
      t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,
      t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,
      t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;
    const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;
    if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    const detInv = 1 / det;
    te[0] = t11 * detInv;
    te[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv;
    te[2] = (n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44) * detInv;
    te[3] = (n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43) * detInv;
    te[4] = t12 * detInv;
    te[5] = (n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44) * detInv;
    te[6] = (n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44) * detInv;
    te[7] = (n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43) * detInv;
    te[8] = t13 * detInv;
    te[9] = (n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44) * detInv;
    te[10] = (n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44) * detInv;
    te[11] = (n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43) * detInv;
    te[12] = t14 * detInv;
    te[13] = (n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34) * detInv;
    te[14] = (n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34) * detInv;
    te[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv;
    return this;
  }
  scale(v) {
    const te = this.elements;
    const x = v.x,
      y = v.y,
      z = v.z;
    te[0] *= x;
    te[4] *= y;
    te[8] *= z;
    te[1] *= x;
    te[5] *= y;
    te[9] *= z;
    te[2] *= x;
    te[6] *= y;
    te[10] *= z;
    te[3] *= x;
    te[7] *= y;
    te[11] *= z;
    return this;
  }
  getMaxScaleOnAxis() {
    const te = this.elements;
    const scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2];
    const scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6];
    const scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10];
    return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq));
  }
  makeTranslation(x, y, z) {
    if (x.isVector3) {
      this.set(1, 0, 0, x.x, 0, 1, 0, x.y, 0, 0, 1, x.z, 0, 0, 0, 1);
    } else {
      this.set(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1);
    }
    return this;
  }
  makeRotationX(theta) {
    const c = Math.cos(theta),
      s = Math.sin(theta);
    this.set(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);
    return this;
  }
  makeRotationY(theta) {
    const c = Math.cos(theta),
      s = Math.sin(theta);
    this.set(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);
    return this;
  }
  makeRotationZ(theta) {
    const c = Math.cos(theta),
      s = Math.sin(theta);
    this.set(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
    return this;
  }
  makeRotationAxis(axis, angle) {
    // Based on http://www.gamedev.net/reference/articles/article1199.asp

    const c = Math.cos(angle);
    const s = Math.sin(angle);
    const t = 1 - c;
    const x = axis.x,
      y = axis.y,
      z = axis.z;
    const tx = t * x,
      ty = t * y;
    this.set(tx * x + c, tx * y - s * z, tx * z + s * y, 0, tx * y + s * z, ty * y + c, ty * z - s * x, 0, tx * z - s * y, ty * z + s * x, t * z * z + c, 0, 0, 0, 0, 1);
    return this;
  }
  makeScale(x, y, z) {
    this.set(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1);
    return this;
  }
  makeShear(xy, xz, yx, yz, zx, zy) {
    this.set(1, yx, zx, 0, xy, 1, zy, 0, xz, yz, 1, 0, 0, 0, 0, 1);
    return this;
  }
  compose(position, quaternion, scale) {
    const te = this.elements;
    const x = quaternion._x,
      y = quaternion._y,
      z = quaternion._z,
      w = quaternion._w;
    const x2 = x + x,
      y2 = y + y,
      z2 = z + z;
    const xx = x * x2,
      xy = x * y2,
      xz = x * z2;
    const yy = y * y2,
      yz = y * z2,
      zz = z * z2;
    const wx = w * x2,
      wy = w * y2,
      wz = w * z2;
    const sx = scale.x,
      sy = scale.y,
      sz = scale.z;
    te[0] = (1 - (yy + zz)) * sx;
    te[1] = (xy + wz) * sx;
    te[2] = (xz - wy) * sx;
    te[3] = 0;
    te[4] = (xy - wz) * sy;
    te[5] = (1 - (xx + zz)) * sy;
    te[6] = (yz + wx) * sy;
    te[7] = 0;
    te[8] = (xz + wy) * sz;
    te[9] = (yz - wx) * sz;
    te[10] = (1 - (xx + yy)) * sz;
    te[11] = 0;
    te[12] = position.x;
    te[13] = position.y;
    te[14] = position.z;
    te[15] = 1;
    return this;
  }
  decompose(position, quaternion, scale) {
    const te = this.elements;
    let sx = _v1$4.set(te[0], te[1], te[2]).length();
    const sy = _v1$4.set(te[4], te[5], te[6]).length();
    const sz = _v1$4.set(te[8], te[9], te[10]).length();

    // if determine is negative, we need to invert one scale
    const det = this.determinant();
    if (det < 0) sx = -sx;
    position.x = te[12];
    position.y = te[13];
    position.z = te[14];

    // scale the rotation part
    _m1$2.copy(this);
    const invSX = 1 / sx;
    const invSY = 1 / sy;
    const invSZ = 1 / sz;
    _m1$2.elements[0] *= invSX;
    _m1$2.elements[1] *= invSX;
    _m1$2.elements[2] *= invSX;
    _m1$2.elements[4] *= invSY;
    _m1$2.elements[5] *= invSY;
    _m1$2.elements[6] *= invSY;
    _m1$2.elements[8] *= invSZ;
    _m1$2.elements[9] *= invSZ;
    _m1$2.elements[10] *= invSZ;
    quaternion.setFromRotationMatrix(_m1$2);
    scale.x = sx;
    scale.y = sy;
    scale.z = sz;
    return this;
  }
  makePerspective(left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem) {
    const te = this.elements;
    const x = 2 * near / (right - left);
    const y = 2 * near / (top - bottom);
    const a = (right + left) / (right - left);
    const b = (top + bottom) / (top - bottom);
    let c, d;
    if (coordinateSystem === WebGLCoordinateSystem) {
      c = -(far + near) / (far - near);
      d = -2 * far * near / (far - near);
    } else if (coordinateSystem === WebGPUCoordinateSystem) {
      c = -far / (far - near);
      d = -far * near / (far - near);
    } else {
      throw new Error('THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem);
    }
    te[0] = x;
    te[4] = 0;
    te[8] = a;
    te[12] = 0;
    te[1] = 0;
    te[5] = y;
    te[9] = b;
    te[13] = 0;
    te[2] = 0;
    te[6] = 0;
    te[10] = c;
    te[14] = d;
    te[3] = 0;
    te[7] = 0;
    te[11] = -1;
    te[15] = 0;
    return this;
  }
  makeOrthographic(left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem) {
    const te = this.elements;
    const w = 1.0 / (right - left);
    const h = 1.0 / (top - bottom);
    const p = 1.0 / (far - near);
    const x = (right + left) * w;
    const y = (top + bottom) * h;
    let z, zInv;
    if (coordinateSystem === WebGLCoordinateSystem) {
      z = (far + near) * p;
      zInv = -2 * p;
    } else if (coordinateSystem === WebGPUCoordinateSystem) {
      z = near * p;
      zInv = -1 * p;
    } else {
      throw new Error('THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem);
    }
    te[0] = 2 * w;
    te[4] = 0;
    te[8] = 0;
    te[12] = -x;
    te[1] = 0;
    te[5] = 2 * h;
    te[9] = 0;
    te[13] = -y;
    te[2] = 0;
    te[6] = 0;
    te[10] = zInv;
    te[14] = -z;
    te[3] = 0;
    te[7] = 0;
    te[11] = 0;
    te[15] = 1;
    return this;
  }
  equals(matrix) {
    const te = this.elements;
    const me = matrix.elements;
    for (let i = 0; i < 16; i++) {
      if (te[i] !== me[i]) return false;
    }
    return true;
  }
  fromArray(array, offset = 0) {
    for (let i = 0; i < 16; i++) {
      this.elements[i] = array[i + offset];
    }
    return this;
  }
  toArray(array = [], offset = 0) {
    const te = this.elements;
    array[offset] = te[0];
    array[offset + 1] = te[1];
    array[offset + 2] = te[2];
    array[offset + 3] = te[3];
    array[offset + 4] = te[4];
    array[offset + 5] = te[5];
    array[offset + 6] = te[6];
    array[offset + 7] = te[7];
    array[offset + 8] = te[8];
    array[offset + 9] = te[9];
    array[offset + 10] = te[10];
    array[offset + 11] = te[11];
    array[offset + 12] = te[12];
    array[offset + 13] = te[13];
    array[offset + 14] = te[14];
    array[offset + 15] = te[15];
    return array;
  }
}
const _v1$4 = /*@__PURE__*/new Vector3();
const _m1$2 = /*@__PURE__*/new Matrix4();
const _zero = /*@__PURE__*/new Vector3(0, 0, 0);
const _one = /*@__PURE__*/new Vector3(1, 1, 1);
const _x = /*@__PURE__*/new Vector3();
const _y = /*@__PURE__*/new Vector3();
const _z = /*@__PURE__*/new Vector3();

class Vector2 {
  constructor(x = 0, y = 0) {
    Vector2.prototype.isVector2 = true;
    this.x = x;
    this.y = y;
  }
  get width() {
    return this.x;
  }
  set width(value) {
    this.x = value;
  }
  get height() {
    return this.y;
  }
  set height(value) {
    this.y = value;
  }
  set(x, y) {
    this.x = x;
    this.y = y;
    return this;
  }
  setScalar(scalar) {
    this.x = scalar;
    this.y = scalar;
    return this;
  }
  setX(x) {
    this.x = x;
    return this;
  }
  setY(y) {
    this.y = y;
    return this;
  }
  setComponent(index, value) {
    switch (index) {
      case 0:
        this.x = value;
        break;
      case 1:
        this.y = value;
        break;
      default:
        throw new Error('index is out of range: ' + index);
    }
    return this;
  }
  getComponent(index) {
    switch (index) {
      case 0:
        return this.x;
      case 1:
        return this.y;
      default:
        throw new Error('index is out of range: ' + index);
    }
  }
  clone() {
    return new this.constructor(this.x, this.y);
  }
  copy(v) {
    this.x = v.x;
    this.y = v.y;
    return this;
  }
  add(v) {
    this.x += v.x;
    this.y += v.y;
    return this;
  }
  addScalar(s) {
    this.x += s;
    this.y += s;
    return this;
  }
  addVectors(a, b) {
    this.x = a.x + b.x;
    this.y = a.y + b.y;
    return this;
  }
  addScaledVector(v, s) {
    this.x += v.x * s;
    this.y += v.y * s;
    return this;
  }
  sub(v) {
    this.x -= v.x;
    this.y -= v.y;
    return this;
  }
  subScalar(s) {
    this.x -= s;
    this.y -= s;
    return this;
  }
  subVectors(a, b) {
    this.x = a.x - b.x;
    this.y = a.y - b.y;
    return this;
  }
  multiply(v) {
    this.x *= v.x;
    this.y *= v.y;
    return this;
  }
  multiplyScalar(scalar) {
    this.x *= scalar;
    this.y *= scalar;
    return this;
  }
  divide(v) {
    this.x /= v.x;
    this.y /= v.y;
    return this;
  }
  divideScalar(scalar) {
    return this.multiplyScalar(1 / scalar);
  }
  applyMatrix3(m) {
    const x = this.x,
      y = this.y;
    const e = m.elements;
    this.x = e[0] * x + e[3] * y + e[6];
    this.y = e[1] * x + e[4] * y + e[7];
    return this;
  }
  min(v) {
    this.x = Math.min(this.x, v.x);
    this.y = Math.min(this.y, v.y);
    return this;
  }
  max(v) {
    this.x = Math.max(this.x, v.x);
    this.y = Math.max(this.y, v.y);
    return this;
  }
  clamp(min, max) {
    // assumes min < max, componentwise

    this.x = Math.max(min.x, Math.min(max.x, this.x));
    this.y = Math.max(min.y, Math.min(max.y, this.y));
    return this;
  }
  clampScalar(minVal, maxVal) {
    this.x = Math.max(minVal, Math.min(maxVal, this.x));
    this.y = Math.max(minVal, Math.min(maxVal, this.y));
    return this;
  }
  clampLength(min, max) {
    const length = this.length();
    return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
  }
  floor() {
    this.x = Math.floor(this.x);
    this.y = Math.floor(this.y);
    return this;
  }
  ceil() {
    this.x = Math.ceil(this.x);
    this.y = Math.ceil(this.y);
    return this;
  }
  round() {
    this.x = Math.round(this.x);
    this.y = Math.round(this.y);
    return this;
  }
  roundToZero() {
    this.x = Math.trunc(this.x);
    this.y = Math.trunc(this.y);
    return this;
  }
  negate() {
    this.x = -this.x;
    this.y = -this.y;
    return this;
  }
  dot(v) {
    return this.x * v.x + this.y * v.y;
  }
  cross(v) {
    return this.x * v.y - this.y * v.x;
  }
  lengthSq() {
    return this.x * this.x + this.y * this.y;
  }
  length() {
    return Math.sqrt(this.x * this.x + this.y * this.y);
  }
  manhattanLength() {
    return Math.abs(this.x) + Math.abs(this.y);
  }
  normalize() {
    return this.divideScalar(this.length() || 1);
  }
  angle() {
    // computes the angle in radians with respect to the positive x-axis

    const angle = Math.atan2(-this.y, -this.x) + Math.PI;
    return angle;
  }
  angleTo(v) {
    const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());
    if (denominator === 0) return Math.PI / 2;
    const theta = this.dot(v) / denominator;

    // clamp, to handle numerical problems

    return Math.acos(clamp$1(theta, -1, 1));
  }
  distanceTo(v) {
    return Math.sqrt(this.distanceToSquared(v));
  }
  distanceToSquared(v) {
    const dx = this.x - v.x,
      dy = this.y - v.y;
    return dx * dx + dy * dy;
  }
  manhattanDistanceTo(v) {
    return Math.abs(this.x - v.x) + Math.abs(this.y - v.y);
  }
  setLength(length) {
    return this.normalize().multiplyScalar(length);
  }
  lerp(v, alpha) {
    this.x += (v.x - this.x) * alpha;
    this.y += (v.y - this.y) * alpha;
    return this;
  }
  lerpVectors(v1, v2, alpha) {
    this.x = v1.x + (v2.x - v1.x) * alpha;
    this.y = v1.y + (v2.y - v1.y) * alpha;
    return this;
  }
  equals(v) {
    return v.x === this.x && v.y === this.y;
  }
  fromArray(array, offset = 0) {
    this.x = array[offset];
    this.y = array[offset + 1];
    return this;
  }
  toArray(array = [], offset = 0) {
    array[offset] = this.x;
    array[offset + 1] = this.y;
    return array;
  }
  fromBufferAttribute(attribute, index) {
    this.x = attribute.getX(index);
    this.y = attribute.getY(index);
    return this;
  }
  rotateAround(center, angle) {
    const c = Math.cos(angle),
      s = Math.sin(angle);
    const x = this.x - center.x;
    const y = this.y - center.y;
    this.x = x * c - y * s + center.x;
    this.y = x * s + y * c + center.y;
    return this;
  }
  random() {
    this.x = Math.random();
    this.y = Math.random();
    return this;
  }
  *[Symbol.iterator]() {
    yield this.x;
    yield this.y;
  }
}

class Vector4 {
  constructor(x = 0, y = 0, z = 0, w = 1) {
    Vector4.prototype.isVector4 = true;
    this.x = x;
    this.y = y;
    this.z = z;
    this.w = w;
  }
  get width() {
    return this.z;
  }
  set width(value) {
    this.z = value;
  }
  get height() {
    return this.w;
  }
  set height(value) {
    this.w = value;
  }
  set(x, y, z, w) {
    this.x = x;
    this.y = y;
    this.z = z;
    this.w = w;
    return this;
  }
  setScalar(scalar) {
    this.x = scalar;
    this.y = scalar;
    this.z = scalar;
    this.w = scalar;
    return this;
  }
  setX(x) {
    this.x = x;
    return this;
  }
  setY(y) {
    this.y = y;
    return this;
  }
  setZ(z) {
    this.z = z;
    return this;
  }
  setW(w) {
    this.w = w;
    return this;
  }
  setComponent(index, value) {
    switch (index) {
      case 0:
        this.x = value;
        break;
      case 1:
        this.y = value;
        break;
      case 2:
        this.z = value;
        break;
      case 3:
        this.w = value;
        break;
      default:
        throw new Error('index is out of range: ' + index);
    }
    return this;
  }
  getComponent(index) {
    switch (index) {
      case 0:
        return this.x;
      case 1:
        return this.y;
      case 2:
        return this.z;
      case 3:
        return this.w;
      default:
        throw new Error('index is out of range: ' + index);
    }
  }
  clone() {
    return new this.constructor(this.x, this.y, this.z, this.w);
  }
  copy(v) {
    this.x = v.x;
    this.y = v.y;
    this.z = v.z;
    this.w = v.w !== undefined ? v.w : 1;
    return this;
  }
  add(v) {
    this.x += v.x;
    this.y += v.y;
    this.z += v.z;
    this.w += v.w;
    return this;
  }
  addScalar(s) {
    this.x += s;
    this.y += s;
    this.z += s;
    this.w += s;
    return this;
  }
  addVectors(a, b) {
    this.x = a.x + b.x;
    this.y = a.y + b.y;
    this.z = a.z + b.z;
    this.w = a.w + b.w;
    return this;
  }
  addScaledVector(v, s) {
    this.x += v.x * s;
    this.y += v.y * s;
    this.z += v.z * s;
    this.w += v.w * s;
    return this;
  }
  sub(v) {
    this.x -= v.x;
    this.y -= v.y;
    this.z -= v.z;
    this.w -= v.w;
    return this;
  }
  subScalar(s) {
    this.x -= s;
    this.y -= s;
    this.z -= s;
    this.w -= s;
    return this;
  }
  subVectors(a, b) {
    this.x = a.x - b.x;
    this.y = a.y - b.y;
    this.z = a.z - b.z;
    this.w = a.w - b.w;
    return this;
  }
  multiply(v) {
    this.x *= v.x;
    this.y *= v.y;
    this.z *= v.z;
    this.w *= v.w;
    return this;
  }
  multiplyScalar(scalar) {
    this.x *= scalar;
    this.y *= scalar;
    this.z *= scalar;
    this.w *= scalar;
    return this;
  }
  applyMatrix4(m) {
    const x = this.x,
      y = this.y,
      z = this.z,
      w = this.w;
    const e = m.elements;
    this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w;
    this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w;
    this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w;
    this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w;
    return this;
  }
  divideScalar(scalar) {
    return this.multiplyScalar(1 / scalar);
  }
  setAxisAngleFromQuaternion(q) {
    // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm

    // q is assumed to be normalized

    this.w = 2 * Math.acos(q.w);
    const s = Math.sqrt(1 - q.w * q.w);
    if (s < 0.0001) {
      this.x = 1;
      this.y = 0;
      this.z = 0;
    } else {
      this.x = q.x / s;
      this.y = q.y / s;
      this.z = q.z / s;
    }
    return this;
  }
  setAxisAngleFromRotationMatrix(m) {
    // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm

    // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)

    let angle, x, y, z; // variables for result
    const epsilon = 0.01,
      // margin to allow for rounding errors
      epsilon2 = 0.1,
      // margin to distinguish between 0 and 180 degrees

      te = m.elements,
      m11 = te[0],
      m12 = te[4],
      m13 = te[8],
      m21 = te[1],
      m22 = te[5],
      m23 = te[9],
      m31 = te[2],
      m32 = te[6],
      m33 = te[10];
    if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) {
      // singularity found
      // first check for identity matrix which must have +1 for all terms
      // in leading diagonal and zero in other terms

      if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) {
        // this singularity is identity matrix so angle = 0

        this.set(1, 0, 0, 0);
        return this; // zero angle, arbitrary axis
      }

      // otherwise this singularity is angle = 180

      angle = Math.PI;
      const xx = (m11 + 1) / 2;
      const yy = (m22 + 1) / 2;
      const zz = (m33 + 1) / 2;
      const xy = (m12 + m21) / 4;
      const xz = (m13 + m31) / 4;
      const yz = (m23 + m32) / 4;
      if (xx > yy && xx > zz) {
        // m11 is the largest diagonal term

        if (xx < epsilon) {
          x = 0;
          y = 0.707106781;
          z = 0.707106781;
        } else {
          x = Math.sqrt(xx);
          y = xy / x;
          z = xz / x;
        }
      } else if (yy > zz) {
        // m22 is the largest diagonal term

        if (yy < epsilon) {
          x = 0.707106781;
          y = 0;
          z = 0.707106781;
        } else {
          y = Math.sqrt(yy);
          x = xy / y;
          z = yz / y;
        }
      } else {
        // m33 is the largest diagonal term so base result on this

        if (zz < epsilon) {
          x = 0.707106781;
          y = 0.707106781;
          z = 0;
        } else {
          z = Math.sqrt(zz);
          x = xz / z;
          y = yz / z;
        }
      }
      this.set(x, y, z, angle);
      return this; // return 180 deg rotation
    }

    // as we have reached here there are no singularities so we can handle normally

    let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize

    if (Math.abs(s) < 0.001) s = 1;

    // prevent divide by zero, should not happen if matrix is orthogonal and should be
    // caught by singularity test above, but I've left it in just in case

    this.x = (m32 - m23) / s;
    this.y = (m13 - m31) / s;
    this.z = (m21 - m12) / s;
    this.w = Math.acos((m11 + m22 + m33 - 1) / 2);
    return this;
  }
  setFromMatrixPosition(m) {
    const e = m.elements;
    this.x = e[12];
    this.y = e[13];
    this.z = e[14];
    this.w = e[15];
    return this;
  }
  min(v) {
    this.x = Math.min(this.x, v.x);
    this.y = Math.min(this.y, v.y);
    this.z = Math.min(this.z, v.z);
    this.w = Math.min(this.w, v.w);
    return this;
  }
  max(v) {
    this.x = Math.max(this.x, v.x);
    this.y = Math.max(this.y, v.y);
    this.z = Math.max(this.z, v.z);
    this.w = Math.max(this.w, v.w);
    return this;
  }
  clamp(min, max) {
    // assumes min < max, componentwise

    this.x = Math.max(min.x, Math.min(max.x, this.x));
    this.y = Math.max(min.y, Math.min(max.y, this.y));
    this.z = Math.max(min.z, Math.min(max.z, this.z));
    this.w = Math.max(min.w, Math.min(max.w, this.w));
    return this;
  }
  clampScalar(minVal, maxVal) {
    this.x = Math.max(minVal, Math.min(maxVal, this.x));
    this.y = Math.max(minVal, Math.min(maxVal, this.y));
    this.z = Math.max(minVal, Math.min(maxVal, this.z));
    this.w = Math.max(minVal, Math.min(maxVal, this.w));
    return this;
  }
  clampLength(min, max) {
    const length = this.length();
    return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
  }
  floor() {
    this.x = Math.floor(this.x);
    this.y = Math.floor(this.y);
    this.z = Math.floor(this.z);
    this.w = Math.floor(this.w);
    return this;
  }
  ceil() {
    this.x = Math.ceil(this.x);
    this.y = Math.ceil(this.y);
    this.z = Math.ceil(this.z);
    this.w = Math.ceil(this.w);
    return this;
  }
  round() {
    this.x = Math.round(this.x);
    this.y = Math.round(this.y);
    this.z = Math.round(this.z);
    this.w = Math.round(this.w);
    return this;
  }
  roundToZero() {
    this.x = Math.trunc(this.x);
    this.y = Math.trunc(this.y);
    this.z = Math.trunc(this.z);
    this.w = Math.trunc(this.w);
    return this;
  }
  negate() {
    this.x = -this.x;
    this.y = -this.y;
    this.z = -this.z;
    this.w = -this.w;
    return this;
  }
  dot(v) {
    return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;
  }
  lengthSq() {
    return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
  }
  length() {
    return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
  }
  manhattanLength() {
    return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w);
  }
  normalize() {
    return this.divideScalar(this.length() || 1);
  }
  setLength(length) {
    return this.normalize().multiplyScalar(length);
  }
  lerp(v, alpha) {
    this.x += (v.x - this.x) * alpha;
    this.y += (v.y - this.y) * alpha;
    this.z += (v.z - this.z) * alpha;
    this.w += (v.w - this.w) * alpha;
    return this;
  }
  lerpVectors(v1, v2, alpha) {
    this.x = v1.x + (v2.x - v1.x) * alpha;
    this.y = v1.y + (v2.y - v1.y) * alpha;
    this.z = v1.z + (v2.z - v1.z) * alpha;
    this.w = v1.w + (v2.w - v1.w) * alpha;
    return this;
  }
  equals(v) {
    return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w;
  }
  fromArray(array, offset = 0) {
    this.x = array[offset];
    this.y = array[offset + 1];
    this.z = array[offset + 2];
    this.w = array[offset + 3];
    return this;
  }
  toArray(array = [], offset = 0) {
    array[offset] = this.x;
    array[offset + 1] = this.y;
    array[offset + 2] = this.z;
    array[offset + 3] = this.w;
    return array;
  }
  fromBufferAttribute(attribute, index) {
    this.x = attribute.getX(index);
    this.y = attribute.getY(index);
    this.z = attribute.getZ(index);
    this.w = attribute.getW(index);
    return this;
  }
  random() {
    this.x = Math.random();
    this.y = Math.random();
    this.z = Math.random();
    this.w = Math.random();
    return this;
  }
  *[Symbol.iterator]() {
    yield this.x;
    yield this.y;
    yield this.z;
    yield this.w;
  }
}

function getCacheKey(object, force = false) {
  let cacheKey = '{';
  if (object.isNode === true) {
    cacheKey += object.id;
    object = object.getSelf();
  }
  for (const {
    property,
    childNode
  } of getNodeChildren(object)) {
    cacheKey += ',' + property.slice(0, -4) + ':' + childNode.getCacheKey(force);
  }
  cacheKey += '}';
  return cacheKey;
}
function* getNodeChildren(node, toJSON = false) {
  for (const property in node) {
    // Ignore private properties.
    if (property.startsWith('_') === true) continue;
    const object = node[property];
    if (Array.isArray(object) === true) {
      for (let i = 0; i < object.length; i++) {
        const child = object[i];
        if (child && (child.isNode === true || toJSON && typeof child.toJSON === 'function')) {
          yield {
            property,
            index: i,
            childNode: child
          };
        }
      }
    } else if (object && object.isNode === true) {
      yield {
        property,
        childNode: object
      };
    } else if (typeof object === 'object') {
      for (const subProperty in object) {
        const child = object[subProperty];
        if (child && (child.isNode === true || toJSON && typeof child.toJSON === 'function')) {
          yield {
            property,
            index: subProperty,
            childNode: child
          };
        }
      }
    }
  }
}
function getValueType(value) {
  if (value === undefined || value === null) return null;
  const typeOf = typeof value;
  if (value.isNode === true) {
    return 'node';
  } else if (typeOf === 'number') {
    return 'float';
  } else if (typeOf === 'boolean') {
    return 'bool';
  } else if (typeOf === 'string') {
    return 'string';
  } else if (typeOf === 'function') {
    return 'shader';
  } else if (value.isVector2 === true) {
    return 'vec2';
  } else if (value.isVector3 === true) {
    return 'vec3';
  } else if (value.isVector4 === true) {
    return 'vec4';
  } else if (value.isMatrix3 === true) {
    return 'mat3';
  } else if (value.isMatrix4 === true) {
    return 'mat4';
  } else if (value.isColor === true) {
    return 'color';
  } else if (value instanceof ArrayBuffer) {
    return 'ArrayBuffer';
  }
  return null;
}
function getValueFromType(type, ...params) {
  const last4 = type ? type.slice(-4) : undefined;
  if (params.length === 1) {
    // ensure same behaviour as in NodeBuilder.format()

    if (last4 === 'vec2') params = [params[0], params[0]];else if (last4 === 'vec3') params = [params[0], params[0], params[0]];else if (last4 === 'vec4') params = [params[0], params[0], params[0], params[0]];
  }
  if (type === 'color') {
    return new Color(...params);
  } else if (last4 === 'vec2') {
    return new Vector2(...params);
  } else if (last4 === 'vec3') {
    return new Vector3(...params);
  } else if (last4 === 'vec4') {
    return new Vector4(...params);
  } else if (last4 === 'mat3') {
    return new Matrix3(...params);
  } else if (last4 === 'mat4') {
    return new Matrix4(...params);
  } else if (type === 'bool') {
    return params[0] || false;
  } else if (type === 'float' || type === 'int' || type === 'uint') {
    return params[0] || 0;
  } else if (type === 'string') {
    return params[0] || '';
  } else if (type === 'ArrayBuffer') {
    return base64ToArrayBuffer(params[0]);
  }
  return null;
}
function arrayBufferToBase64(arrayBuffer) {
  let chars = '';
  const array = new Uint8Array(arrayBuffer);
  for (let i = 0; i < array.length; i++) {
    chars += String.fromCharCode(array[i]);
  }
  return btoa(chars);
}
function base64ToArrayBuffer(base64) {
  return Uint8Array.from(atob(base64), c => c.charCodeAt(0)).buffer;
}

/**
 * https://github.com/mrdoob/eventdispatcher.js/
 */

class EventDispatcher {
  addEventListener(type, listener) {
    if (this._listeners === undefined) this._listeners = {};
    const listeners = this._listeners;
    if (listeners[type] === undefined) {
      listeners[type] = [];
    }
    if (listeners[type].indexOf(listener) === -1) {
      listeners[type].push(listener);
    }
  }
  hasEventListener(type, listener) {
    if (this._listeners === undefined) return false;
    const listeners = this._listeners;
    return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1;
  }
  removeEventListener(type, listener) {
    if (this._listeners === undefined) return;
    const listeners = this._listeners;
    const listenerArray = listeners[type];
    if (listenerArray !== undefined) {
      const index = listenerArray.indexOf(listener);
      if (index !== -1) {
        listenerArray.splice(index, 1);
      }
    }
  }
  dispatchEvent(event) {
    if (this._listeners === undefined) return;
    const listeners = this._listeners;
    const listenerArray = listeners[event.type];
    if (listenerArray !== undefined) {
      event.target = this;

      // Make a copy, in case listeners are removed while iterating.
      const array = listenerArray.slice(0);
      for (let i = 0, l = array.length; i < l; i++) {
        array[i].call(this, event);
      }
      event.target = null;
    }
  }
}

const Nodes = new Map();
let _nodeId = 0;
class Node$1 extends EventDispatcher {
  constructor(nodeType = null) {
    super();
    this.nodeType = nodeType;
    this.updateType = NodeUpdateType.NONE;
    this.updateBeforeType = NodeUpdateType.NONE;
    this.updateAfterType = NodeUpdateType.NONE;
    this.uuid = MathUtils.generateUUID();
    this.version = 0;
    this._cacheKey = null;
    this._cacheKeyVersion = 0;
    this.global = false;
    this.isNode = true;
    Object.defineProperty(this, 'id', {
      value: _nodeId++
    });
  }
  set needsUpdate(value) {
    if (value === true) {
      this.version++;
    }
  }
  get type() {
    return this.constructor.type;
  }
  onUpdate(callback, updateType) {
    this.updateType = updateType;
    this.update = callback.bind(this.getSelf());
    return this;
  }
  onFrameUpdate(callback) {
    return this.onUpdate(callback, NodeUpdateType.FRAME);
  }
  onRenderUpdate(callback) {
    return this.onUpdate(callback, NodeUpdateType.RENDER);
  }
  onObjectUpdate(callback) {
    return this.onUpdate(callback, NodeUpdateType.OBJECT);
  }
  onReference(callback) {
    this.updateReference = callback.bind(this.getSelf());
    return this;
  }
  getSelf() {
    // Returns non-node object.

    return this.self || this;
  }
  updateReference(/*state*/
  ) {
    return this;
  }
  isGlobal(/*builder*/
  ) {
    return this.global;
  }
  *getChildren() {
    for (const {
      childNode
    } of getNodeChildren(this)) {
      yield childNode;
    }
  }
  dispose() {
    this.dispatchEvent({
      type: 'dispose'
    });
  }
  traverse(callback) {
    callback(this);
    for (const childNode of this.getChildren()) {
      childNode.traverse(callback);
    }
  }
  getCacheKey(force = false) {
    force = force || this.version !== this._cacheKeyVersion;
    if (force === true || this._cacheKey === null) {
      this._cacheKey = getCacheKey(this, force);
      this._cacheKeyVersion = this.version;
    }
    return this._cacheKey;
  }
  getScope() {
    return this;
  }
  getHash(/*builder*/
  ) {
    return this.uuid;
  }
  getUpdateType() {
    return this.updateType;
  }
  getUpdateBeforeType() {
    return this.updateBeforeType;
  }
  getUpdateAfterType() {
    return this.updateAfterType;
  }
  getElementType(builder) {
    const type = this.getNodeType(builder);
    const elementType = builder.getElementType(type);
    return elementType;
  }
  getNodeType(builder) {
    const nodeProperties = builder.getNodeProperties(this);
    if (nodeProperties.outputNode) {
      return nodeProperties.outputNode.getNodeType(builder);
    }
    return this.nodeType;
  }
  getShared(builder) {
    const hash = this.getHash(builder);
    const nodeFromHash = builder.getNodeFromHash(hash);
    return nodeFromHash || this;
  }
  setup(builder) {
    const nodeProperties = builder.getNodeProperties(this);
    let index = 0;
    for (const childNode of this.getChildren()) {
      nodeProperties['node' + index++] = childNode;
    }

    // return a outputNode if exists
    return null;
  }
  analyze(builder) {
    const usageCount = builder.increaseUsage(this);
    if (usageCount === 1) {
      // node flow children

      const nodeProperties = builder.getNodeProperties(this);
      for (const childNode of Object.values(nodeProperties)) {
        if (childNode && childNode.isNode === true) {
          childNode.build(builder);
        }
      }
    }
  }
  generate(builder, output) {
    const {
      outputNode
    } = builder.getNodeProperties(this);
    if (outputNode && outputNode.isNode === true) {
      return outputNode.build(builder, output);
    }
  }
  updateBefore(/*frame*/
  ) {
    console.warn('Abstract function.');
  }
  updateAfter(/*frame*/
  ) {
    console.warn('Abstract function.');
  }
  update(/*frame*/
  ) {
    console.warn('Abstract function.');
  }
  build(builder, output = null) {
    const refNode = this.getShared(builder);
    if (this !== refNode) {
      return refNode.build(builder, output);
    }
    builder.addNode(this);
    builder.addChain(this);

    /* Build stages expected results:
    	- "setup"		-> Node
    	- "analyze"		-> null
    	- "generate"	-> String
    */
    let result = null;
    const buildStage = builder.getBuildStage();
    if (buildStage === 'setup') {
      this.updateReference(builder);
      const properties = builder.getNodeProperties(this);
      if (properties.initialized !== true) {
        const stackNodesBeforeSetup = builder.stack.nodes.length;
        properties.initialized = true;
        properties.outputNode = this.setup(builder);
        if (properties.outputNode !== null && builder.stack.nodes.length !== stackNodesBeforeSetup) ;
        for (const childNode of Object.values(properties)) {
          if (childNode && childNode.isNode === true) {
            childNode.build(builder);
          }
        }
      }
    } else if (buildStage === 'analyze') {
      this.analyze(builder);
    } else if (buildStage === 'generate') {
      const isGenerateOnce = this.generate.length === 1;
      if (isGenerateOnce) {
        const type = this.getNodeType(builder);
        const nodeData = builder.getDataFromNode(this);
        result = nodeData.snippet;
        if (result === undefined) {
          result = this.generate(builder) || '';
          nodeData.snippet = result;
        }
        result = builder.format(result, type, output);
      } else {
        result = this.generate(builder, output) || '';
      }
    }
    builder.removeChain(this);
    return result;
  }
  getSerializeChildren() {
    return getNodeChildren(this);
  }
  serialize(json) {
    const nodeChildren = this.getSerializeChildren();
    const inputNodes = {};
    for (const {
      property,
      index,
      childNode
    } of nodeChildren) {
      if (index !== undefined) {
        if (inputNodes[property] === undefined) {
          inputNodes[property] = Number.isInteger(index) ? [] : {};
        }
        inputNodes[property][index] = childNode.toJSON(json.meta).uuid;
      } else {
        inputNodes[property] = childNode.toJSON(json.meta).uuid;
      }
    }
    if (Object.keys(inputNodes).length > 0) {
      json.inputNodes = inputNodes;
    }
  }
  deserialize(json) {
    if (json.inputNodes !== undefined) {
      const nodes = json.meta.nodes;
      for (const property in json.inputNodes) {
        if (Array.isArray(json.inputNodes[property])) {
          const inputArray = [];
          for (const uuid of json.inputNodes[property]) {
            inputArray.push(nodes[uuid]);
          }
          this[property] = inputArray;
        } else if (typeof json.inputNodes[property] === 'object') {
          const inputObject = {};
          for (const subProperty in json.inputNodes[property]) {
            const uuid = json.inputNodes[property][subProperty];
            inputObject[subProperty] = nodes[uuid];
          }
          this[property] = inputObject;
        } else {
          const uuid = json.inputNodes[property];
          this[property] = nodes[uuid];
        }
      }
    }
  }
  toJSON(meta) {
    const {
      uuid,
      type
    } = this;
    const isRoot = meta === undefined || typeof meta === 'string';
    if (isRoot) {
      meta = {
        textures: {},
        images: {},
        nodes: {}
      };
    }

    // serialize

    let data = meta.nodes[uuid];
    if (data === undefined) {
      data = {
        uuid,
        type,
        meta,
        metadata: {
          version: 4.6,
          type: 'Node',
          generator: 'Node.toJSON'
        }
      };
      if (isRoot !== true) meta.nodes[data.uuid] = data;
      this.serialize(data);
      delete data.meta;
    }

    // TODO: Copied from Object3D.toJSON

    function extractFromCache(cache) {
      const values = [];
      for (const key in cache) {
        const data = cache[key];
        delete data.metadata;
        values.push(data);
      }
      return values;
    }
    if (isRoot) {
      const textures = extractFromCache(meta.textures);
      const images = extractFromCache(meta.images);
      const nodes = extractFromCache(meta.nodes);
      if (textures.length > 0) data.textures = textures;
      if (images.length > 0) data.images = images;
      if (nodes.length > 0) data.nodes = nodes;
    }
    return data;
  }
}
Node$1.type = /*@__PURE__*/registerNode('', Node$1);
function registerNode(type, nodeClass) {
  const suffix = 'Node';
  const nodeType = type + suffix;
  if (typeof nodeClass !== 'function') throw new Error(`TSL.Node: Node class ${type} is not a class`);
  if (Nodes.has(nodeType)) {
    console.warn(`TSL.Node: Redefinition of node class ${nodeType}`);
    return;
  }
  if (type.slice(-suffix.length) === suffix) {
    console.warn(`TSL.Node: Node class ${nodeType} should not have '${suffix}' suffix.`);
    return;
  }
  Nodes.set(nodeType, nodeClass);
  nodeClass.type = nodeType;
  return nodeType;
}

class TempNode extends Node$1 {
  constructor(type) {
    super(type);
    this.isTempNode = true;
  }
  hasDependencies(builder) {
    return builder.getDataFromNode(this).usageCount > 1;
  }
  build(builder, output) {
    const buildStage = builder.getBuildStage();
    if (buildStage === 'generate') {
      const type = builder.getVectorType(this.getNodeType(builder, output));
      const nodeData = builder.getDataFromNode(this);
      if (nodeData.propertyName !== undefined) {
        return builder.format(nodeData.propertyName, type, output);
      } else if (type !== 'void' && output !== 'void' && this.hasDependencies(builder)) {
        const snippet = super.build(builder, type);
        const nodeVar = builder.getVarFromNode(this, null, type);
        const propertyName = builder.getPropertyName(nodeVar);
        builder.addLineFlowCode(`${propertyName} = ${snippet}`);
        nodeData.snippet = snippet;
        nodeData.propertyName = propertyName;
        return builder.format(nodeData.propertyName, type, output);
      }
    }
    return super.build(builder, output);
  }
}
TempNode.type = /*@__PURE__*/registerNode('Temp', TempNode);

class ArrayElementNode extends Node$1 {
  // @TODO: If extending from TempNode it breaks webgpu_compute

  constructor(node, indexNode) {
    super();
    this.node = node;
    this.indexNode = indexNode;
    this.isArrayElementNode = true;
  }
  getNodeType(builder) {
    return this.node.getElementType(builder);
  }
  generate(builder) {
    const nodeSnippet = this.node.build(builder);
    const indexSnippet = this.indexNode.build(builder, 'uint');
    return `${nodeSnippet}[ ${indexSnippet} ]`;
  }
}
ArrayElementNode.type = /*@__PURE__*/registerNode('ArrayElement', ArrayElementNode);

class ConvertNode extends Node$1 {
  constructor(node, convertTo) {
    super();
    this.node = node;
    this.convertTo = convertTo;
  }
  getNodeType(builder) {
    const requestType = this.node.getNodeType(builder);
    let convertTo = null;
    for (const overloadingType of this.convertTo.split('|')) {
      if (convertTo === null || builder.getTypeLength(requestType) === builder.getTypeLength(overloadingType)) {
        convertTo = overloadingType;
      }
    }
    return convertTo;
  }
  serialize(data) {
    super.serialize(data);
    data.convertTo = this.convertTo;
  }
  deserialize(data) {
    super.deserialize(data);
    this.convertTo = data.convertTo;
  }
  generate(builder, output) {
    const node = this.node;
    const type = this.getNodeType(builder);
    const snippet = node.build(builder, type);
    return builder.format(snippet, type, output);
  }
}
ConvertNode.type = /*@__PURE__*/registerNode('Convert', ConvertNode);

class JoinNode extends TempNode {
  constructor(nodes = [], nodeType = null) {
    super(nodeType);
    this.nodes = nodes;
  }
  getNodeType(builder) {
    if (this.nodeType !== null) {
      return builder.getVectorType(this.nodeType);
    }
    return builder.getTypeFromLength(this.nodes.reduce((count, cur) => count + builder.getTypeLength(cur.getNodeType(builder)), 0));
  }
  generate(builder, output) {
    const type = this.getNodeType(builder);
    const nodes = this.nodes;
    const primitiveType = builder.getComponentType(type);
    const snippetValues = [];
    for (const input of nodes) {
      let inputSnippet = input.build(builder);
      const inputPrimitiveType = builder.getComponentType(input.getNodeType(builder));
      if (inputPrimitiveType !== primitiveType) {
        inputSnippet = builder.format(inputSnippet, inputPrimitiveType, primitiveType);
      }
      snippetValues.push(inputSnippet);
    }
    const snippet = `${builder.getType(type)}( ${snippetValues.join(', ')} )`;
    return builder.format(snippet, type, output);
  }
}
JoinNode.type = /*@__PURE__*/registerNode('Join', JoinNode);

const stringVectorComponents = vectorComponents.join('');
class SplitNode extends Node$1 {
  constructor(node, components = 'x') {
    super();
    this.node = node;
    this.components = components;
    this.isSplitNode = true;
  }
  getVectorLength() {
    let vectorLength = this.components.length;
    for (const c of this.components) {
      vectorLength = Math.max(vectorComponents.indexOf(c) + 1, vectorLength);
    }
    return vectorLength;
  }
  getComponentType(builder) {
    return builder.getComponentType(this.node.getNodeType(builder));
  }
  getNodeType(builder) {
    return builder.getTypeFromLength(this.components.length, this.getComponentType(builder));
  }
  generate(builder, output) {
    const node = this.node;
    const nodeTypeLength = builder.getTypeLength(node.getNodeType(builder));
    let snippet = null;
    if (nodeTypeLength > 1) {
      let type = null;
      const componentsLength = this.getVectorLength();
      if (componentsLength >= nodeTypeLength) {
        // needed expand the input node

        type = builder.getTypeFromLength(this.getVectorLength(), this.getComponentType(builder));
      }
      const nodeSnippet = node.build(builder, type);
      if (this.components.length === nodeTypeLength && this.components === stringVectorComponents.slice(0, this.components.length)) {
        // unnecessary swizzle

        snippet = builder.format(nodeSnippet, type, output);
      } else {
        snippet = builder.format(`${nodeSnippet}.${this.components}`, this.getNodeType(builder), output);
      }
    } else {
      // ignore .components if .node returns float/integer

      snippet = node.build(builder, output);
    }
    return snippet;
  }
  serialize(data) {
    super.serialize(data);
    data.components = this.components;
  }
  deserialize(data) {
    super.deserialize(data);
    this.components = data.components;
  }
}
SplitNode.type = /*@__PURE__*/registerNode('Split', SplitNode);

class SetNode extends TempNode {
  constructor(sourceNode, components, targetNode) {
    super();
    this.sourceNode = sourceNode;
    this.components = components;
    this.targetNode = targetNode;
  }
  getNodeType(builder) {
    return this.sourceNode.getNodeType(builder);
  }
  generate(builder) {
    const {
      sourceNode,
      components,
      targetNode
    } = this;
    const sourceType = this.getNodeType(builder);
    const targetType = builder.getTypeFromLength(components.length);
    const targetSnippet = targetNode.build(builder, targetType);
    const sourceSnippet = sourceNode.build(builder, sourceType);
    const length = builder.getTypeLength(sourceType);
    const snippetValues = [];
    for (let i = 0; i < length; i++) {
      const component = vectorComponents[i];
      if (component === components[0]) {
        snippetValues.push(targetSnippet);
        i += components.length - 1;
      } else {
        snippetValues.push(sourceSnippet + '.' + component);
      }
    }
    return `${builder.getType(sourceType)}( ${snippetValues.join(', ')} )`;
  }
}
SetNode.type = /*@__PURE__*/registerNode('Set', SetNode);

class FlipNode extends TempNode {
  constructor(sourceNode, components) {
    super();
    this.sourceNode = sourceNode;
    this.components = components;
  }
  getNodeType(builder) {
    return this.sourceNode.getNodeType(builder);
  }
  generate(builder) {
    const {
      components,
      sourceNode
    } = this;
    const sourceType = this.getNodeType(builder);
    const sourceSnippet = sourceNode.build(builder);
    const sourceCache = builder.getVarFromNode(this);
    const sourceProperty = builder.getPropertyName(sourceCache);
    builder.addLineFlowCode(sourceProperty + ' = ' + sourceSnippet);
    const length = builder.getTypeLength(sourceType);
    const snippetValues = [];
    let componentIndex = 0;
    for (let i = 0; i < length; i++) {
      const component = vectorComponents[i];
      if (component === components[componentIndex]) {
        snippetValues.push('1.0 - ' + (sourceProperty + '.' + component));
        componentIndex++;
      } else {
        snippetValues.push(sourceProperty + '.' + component);
      }
    }
    return `${builder.getType(sourceType)}( ${snippetValues.join(', ')} )`;
  }
}
FlipNode.type = /*@__PURE__*/registerNode('Flip', FlipNode);

class InputNode extends Node$1 {
  constructor(value, nodeType = null) {
    super(nodeType);
    this.isInputNode = true;
    this.value = value;
    this.precision = null;
  }
  getNodeType(/*builder*/
  ) {
    if (this.nodeType === null) {
      return getValueType(this.value);
    }
    return this.nodeType;
  }
  getInputType(builder) {
    return this.getNodeType(builder);
  }
  setPrecision(precision) {
    this.precision = precision;
    return this;
  }
  serialize(data) {
    super.serialize(data);
    data.value = this.value;
    if (this.value && this.value.toArray) data.value = this.value.toArray();
    data.valueType = getValueType(this.value);
    data.nodeType = this.nodeType;
    if (data.valueType === 'ArrayBuffer') data.value = arrayBufferToBase64(data.value);
    data.precision = this.precision;
  }
  deserialize(data) {
    super.deserialize(data);
    this.nodeType = data.nodeType;
    this.value = Array.isArray(data.value) ? getValueFromType(data.valueType, ...data.value) : data.value;
    this.precision = data.precision || null;
    if (this.value && this.value.fromArray) this.value = this.value.fromArray(data.value);
  }
  generate(/*builder, output*/
  ) {
    console.warn('Abstract function.');
  }
}
InputNode.type = /*@__PURE__*/registerNode('Input', InputNode);

class ConstNode extends InputNode {
  constructor(value, nodeType = null) {
    super(value, nodeType);
    this.isConstNode = true;
  }
  generateConst(builder) {
    return builder.generateConst(this.getNodeType(builder), this.value);
  }
  generate(builder, output) {
    const type = this.getNodeType(builder);
    return builder.format(this.generateConst(builder), type, output);
  }
}
ConstNode.type = /*@__PURE__*/registerNode('Const', ConstNode);

//

let currentStack = null;
const NodeElements = new Map();
function addMethodChaining(name, nodeElement) {
  if (NodeElements.has(name)) {
    console.warn(`Redefinition of method chaining ${name}`);
    return;
  }
  if (typeof nodeElement !== 'function') throw new Error(`Node element ${name} is not a function`);
  NodeElements.set(name, nodeElement);
}
const parseSwizzle = props => props.replace(/r|s/g, 'x').replace(/g|t/g, 'y').replace(/b|p/g, 'z').replace(/a|q/g, 'w');
const parseSwizzleAndSort = props => parseSwizzle(props).split('').sort().join('');
const shaderNodeHandler = {
  setup(NodeClosure, params) {
    const inputs = params.shift();
    return NodeClosure(nodeObjects(inputs), ...params);
  },
  get(node, prop, nodeObj) {
    if (typeof prop === 'string' && node[prop] === undefined) {
      if (node.isStackNode !== true && prop === 'assign') {
        return (...params) => {
          currentStack.assign(nodeObj, ...params);
          return nodeObj;
        };
      } else if (NodeElements.has(prop)) {
        const nodeElement = NodeElements.get(prop);
        return node.isStackNode ? (...params) => nodeObj.add(nodeElement(...params)) : (...params) => nodeElement(nodeObj, ...params);
      } else if (prop === 'self') {
        return node;
      } else if (prop.endsWith('Assign') && NodeElements.has(prop.slice(0, prop.length - 'Assign'.length))) {
        const nodeElement = NodeElements.get(prop.slice(0, prop.length - 'Assign'.length));
        return node.isStackNode ? (...params) => nodeObj.assign(params[0], nodeElement(...params)) : (...params) => nodeObj.assign(nodeElement(nodeObj, ...params));
      } else if (/^[xyzwrgbastpq]{1,4}$/.test(prop) === true) {
        // accessing properties ( swizzle )

        prop = parseSwizzle(prop);
        return nodeObject(new SplitNode(nodeObj, prop));
      } else if (/^set[XYZWRGBASTPQ]{1,4}$/.test(prop) === true) {
        // set properties ( swizzle ) and sort to xyzw sequence

        prop = parseSwizzleAndSort(prop.slice(3).toLowerCase());
        return value => nodeObject(new SetNode(node, prop, value));
      } else if (/^flip[XYZWRGBASTPQ]{1,4}$/.test(prop) === true) {
        // set properties ( swizzle ) and sort to xyzw sequence

        prop = parseSwizzleAndSort(prop.slice(4).toLowerCase());
        return () => nodeObject(new FlipNode(nodeObject(node), prop));
      } else if (prop === 'width' || prop === 'height' || prop === 'depth') {
        // accessing property

        if (prop === 'width') prop = 'x';else if (prop === 'height') prop = 'y';else if (prop === 'depth') prop = 'z';
        return nodeObject(new SplitNode(node, prop));
      } else if (/^\d+$/.test(prop) === true) {
        // accessing array

        return nodeObject(new ArrayElementNode(nodeObj, new ConstNode(Number(prop), 'uint')));
      }
    }
    return Reflect.get(node, prop, nodeObj);
  },
  set(node, prop, value, nodeObj) {
    if (typeof prop === 'string' && node[prop] === undefined) {
      // setting properties

      if (/^[xyzwrgbastpq]{1,4}$/.test(prop) === true || prop === 'width' || prop === 'height' || prop === 'depth' || /^\d+$/.test(prop) === true) {
        nodeObj[prop].assign(value);
        return true;
      }
    }
    return Reflect.set(node, prop, value, nodeObj);
  }
};
const nodeObjectsCacheMap = new WeakMap();
const nodeBuilderFunctionsCacheMap = new WeakMap();
const ShaderNodeObject = function (obj, altType = null) {
  const type = getValueType(obj);
  if (type === 'node') {
    let nodeObject = nodeObjectsCacheMap.get(obj);
    if (nodeObject === undefined) {
      nodeObject = new Proxy(obj, shaderNodeHandler);
      nodeObjectsCacheMap.set(obj, nodeObject);
      nodeObjectsCacheMap.set(nodeObject, nodeObject);
    }
    return nodeObject;
  } else if (altType === null && (type === 'float' || type === 'boolean') || type && type !== 'shader' && type !== 'string') {
    return nodeObject(getConstNode(obj, altType));
  } else if (type === 'shader') {
    return Fn(obj);
  }
  return obj;
};
const ShaderNodeObjects = function (objects, altType = null) {
  for (const name in objects) {
    objects[name] = nodeObject(objects[name], altType);
  }
  return objects;
};
const ShaderNodeArray = function (array, altType = null) {
  const len = array.length;
  for (let i = 0; i < len; i++) {
    array[i] = nodeObject(array[i], altType);
  }
  return array;
};
const ShaderNodeProxy = function (NodeClass, scope = null, factor = null, settings = null) {
  const assignNode = node => nodeObject(settings !== null ? Object.assign(node, settings) : node);
  if (scope === null) {
    return (...params) => {
      return assignNode(new NodeClass(...nodeArray(params)));
    };
  } else if (factor !== null) {
    factor = nodeObject(factor);
    return (...params) => {
      return assignNode(new NodeClass(scope, ...nodeArray(params), factor));
    };
  } else {
    return (...params) => {
      return assignNode(new NodeClass(scope, ...nodeArray(params)));
    };
  }
};
const ShaderNodeImmutable = function (NodeClass, ...params) {
  return nodeObject(new NodeClass(...nodeArray(params)));
};
class ShaderCallNodeInternal extends Node$1 {
  constructor(shaderNode, inputNodes) {
    super();
    this.shaderNode = shaderNode;
    this.inputNodes = inputNodes;
  }
  getNodeType(builder) {
    return this.shaderNode.nodeType || this.getOutputNode(builder).getNodeType(builder);
  }
  call(builder) {
    const {
      shaderNode,
      inputNodes
    } = this;
    const properties = builder.getNodeProperties(shaderNode);
    if (properties.onceOutput) return properties.onceOutput;

    //

    let result = null;
    if (shaderNode.layout) {
      let functionNodesCacheMap = nodeBuilderFunctionsCacheMap.get(builder.constructor);
      if (functionNodesCacheMap === undefined) {
        functionNodesCacheMap = new WeakMap();
        nodeBuilderFunctionsCacheMap.set(builder.constructor, functionNodesCacheMap);
      }
      let functionNode = functionNodesCacheMap.get(shaderNode);
      if (functionNode === undefined) {
        functionNode = nodeObject(builder.buildFunctionNode(shaderNode));
        functionNodesCacheMap.set(shaderNode, functionNode);
      }
      if (builder.currentFunctionNode !== null) {
        builder.currentFunctionNode.includes.push(functionNode);
      }
      result = nodeObject(functionNode.call(inputNodes));
    } else {
      const jsFunc = shaderNode.jsFunc;
      const outputNode = inputNodes !== null ? jsFunc(inputNodes, builder) : jsFunc(builder);
      result = nodeObject(outputNode);
    }
    if (shaderNode.once) {
      properties.onceOutput = result;
    }
    return result;
  }
  getOutputNode(builder) {
    const properties = builder.getNodeProperties(this);
    if (properties.outputNode === null) {
      properties.outputNode = this.setupOutput(builder);
    }
    return properties.outputNode;
  }
  setup(builder) {
    return this.getOutputNode(builder);
  }
  setupOutput(builder) {
    builder.addStack();
    builder.stack.outputNode = this.call(builder);
    return builder.removeStack();
  }
  generate(builder, output) {
    const outputNode = this.getOutputNode(builder);
    return outputNode.build(builder, output);
  }
}
class ShaderNodeInternal extends Node$1 {
  constructor(jsFunc, nodeType) {
    super(nodeType);
    this.jsFunc = jsFunc;
    this.layout = null;
    this.global = true;
    this.once = false;
  }
  setLayout(layout) {
    this.layout = layout;
    return this;
  }
  call(inputs = null) {
    nodeObjects(inputs);
    return nodeObject(new ShaderCallNodeInternal(this, inputs));
  }
  setup() {
    return this.call();
  }
}
const bools = [false, true];
const uints = [0, 1, 2, 3];
const ints = [-1, -2];
const floats = [0.5, 1.5, 1 / 3, 1e-6, 1e6, Math.PI, Math.PI * 2, 1 / Math.PI, 2 / Math.PI, 1 / (Math.PI * 2), Math.PI / 2];
const boolsCacheMap = new Map();
for (const bool of bools) boolsCacheMap.set(bool, new ConstNode(bool));
const uintsCacheMap = new Map();
for (const uint of uints) uintsCacheMap.set(uint, new ConstNode(uint, 'uint'));
const intsCacheMap = new Map([...uintsCacheMap].map(el => new ConstNode(el.value, 'int')));
for (const int of ints) intsCacheMap.set(int, new ConstNode(int, 'int'));
const floatsCacheMap = new Map([...intsCacheMap].map(el => new ConstNode(el.value)));
for (const float of floats) floatsCacheMap.set(float, new ConstNode(float));
for (const float of floats) floatsCacheMap.set(-float, new ConstNode(-float));
const cacheMaps = {
  bool: boolsCacheMap,
  uint: uintsCacheMap,
  ints: intsCacheMap,
  float: floatsCacheMap
};
const constNodesCacheMap = new Map([...boolsCacheMap, ...floatsCacheMap]);
const getConstNode = (value, type) => {
  if (constNodesCacheMap.has(value)) {
    return constNodesCacheMap.get(value);
  } else if (value.isNode === true) {
    return value;
  } else {
    return new ConstNode(value, type);
  }
};
const safeGetNodeType = node => {
  try {
    return node.getNodeType();
  } catch (_) {
    return undefined;
  }
};
const ConvertType = function (type, cacheMap = null) {
  return (...params) => {
    if (params.length === 0 || !['bool', 'float', 'int', 'uint'].includes(type) && params.every(param => typeof param !== 'object')) {
      params = [getValueFromType(type, ...params)];
    }
    if (params.length === 1 && cacheMap !== null && cacheMap.has(params[0])) {
      return nodeObject(cacheMap.get(params[0]));
    }
    if (params.length === 1) {
      const node = getConstNode(params[0], type);
      if (safeGetNodeType(node) === type) return nodeObject(node);
      return nodeObject(new ConvertNode(node, type));
    }
    const nodes = params.map(param => getConstNode(param));
    return nodeObject(new JoinNode(nodes, type));
  };
};

// utils

const getConstNodeType = value => value !== undefined && value !== null ? value.nodeType || value.convertTo || (typeof value === 'string' ? value : null) : null;

// shader node base

function ShaderNode(jsFunc, nodeType) {
  return new Proxy(new ShaderNodeInternal(jsFunc, nodeType), shaderNodeHandler);
}
const nodeObject = (val, altType = null) => /* new */ShaderNodeObject(val, altType);
const nodeObjects = (val, altType = null) => new ShaderNodeObjects(val, altType);
const nodeArray = (val, altType = null) => new ShaderNodeArray(val, altType);
const nodeProxy = (...params) => new ShaderNodeProxy(...params);
const nodeImmutable = (...params) => new ShaderNodeImmutable(...params);
const Fn = (jsFunc, nodeType) => {
  const shaderNode = new ShaderNode(jsFunc, nodeType);
  const fn = (...params) => {
    let inputs;
    nodeObjects(params);
    if (params[0] && params[0].isNode) {
      inputs = [...params];
    } else {
      inputs = params[0];
    }
    return shaderNode.call(inputs);
  };
  fn.shaderNode = shaderNode;
  fn.setLayout = layout => {
    shaderNode.setLayout(layout);
    return fn;
  };
  fn.once = () => {
    shaderNode.once = true;
    return fn;
  };
  return fn;
};

//

addMethodChaining('toGlobal', node => {
  node.global = true;
  return node;
});

//

const setCurrentStack = stack => {
  currentStack = stack;
};
const getCurrentStack = () => currentStack;
const If = (...params) => currentStack.If(...params);
function append$1(node) {
  if (currentStack) currentStack.add(node);
  return node;
}
addMethodChaining('append', append$1);

// types

const color = new ConvertType('color');
const float = new ConvertType('float', cacheMaps.float);
const int$1 = new ConvertType('int', cacheMaps.ints);
const uint = new ConvertType('uint', cacheMaps.uint);
const bool = new ConvertType('bool', cacheMaps.bool);
const vec2 = new ConvertType('vec2');
const ivec2 = new ConvertType('ivec2');
const uvec2 = new ConvertType('uvec2');
const bvec2 = new ConvertType('bvec2');
const vec3 = new ConvertType('vec3');
const ivec3 = new ConvertType('ivec3');
const uvec3 = new ConvertType('uvec3');
const bvec3 = new ConvertType('bvec3');
const vec4 = new ConvertType('vec4');
const ivec4 = new ConvertType('ivec4');
const uvec4 = new ConvertType('uvec4');
const bvec4 = new ConvertType('bvec4');
const mat2 = new ConvertType('mat2');
const mat3 = new ConvertType('mat3');
const mat4 = new ConvertType('mat4');
addMethodChaining('toColor', color);
addMethodChaining('toFloat', float);
addMethodChaining('toInt', int$1);
addMethodChaining('toUint', uint);
addMethodChaining('toBool', bool);
addMethodChaining('toVec2', vec2);
addMethodChaining('toIVec2', ivec2);
addMethodChaining('toUVec2', uvec2);
addMethodChaining('toBVec2', bvec2);
addMethodChaining('toVec3', vec3);
addMethodChaining('toIVec3', ivec3);
addMethodChaining('toUVec3', uvec3);
addMethodChaining('toBVec3', bvec3);
addMethodChaining('toVec4', vec4);
addMethodChaining('toIVec4', ivec4);
addMethodChaining('toUVec4', uvec4);
addMethodChaining('toBVec4', bvec4);
addMethodChaining('toMat2', mat2);
addMethodChaining('toMat3', mat3);
addMethodChaining('toMat4', mat4);

// basic nodes

const element = /*@__PURE__*/nodeProxy(ArrayElementNode);
const convert = (node, types) => nodeObject(new ConvertNode(nodeObject(node), types));
addMethodChaining('element', element);
addMethodChaining('convert', convert);

class AssignNode extends TempNode {
  constructor(targetNode, sourceNode) {
    super();
    this.targetNode = targetNode;
    this.sourceNode = sourceNode;
  }
  hasDependencies() {
    return false;
  }
  getNodeType(builder, output) {
    return output !== 'void' ? this.targetNode.getNodeType(builder) : 'void';
  }
  needsSplitAssign(builder) {
    const {
      targetNode
    } = this;
    if (builder.isAvailable('swizzleAssign') === false && targetNode.isSplitNode && targetNode.components.length > 1) {
      const targetLength = builder.getTypeLength(targetNode.node.getNodeType(builder));
      const assignDiferentVector = vectorComponents.join('').slice(0, targetLength) !== targetNode.components;
      return assignDiferentVector;
    }
    return false;
  }
  generate(builder, output) {
    const {
      targetNode,
      sourceNode
    } = this;
    const needsSplitAssign = this.needsSplitAssign(builder);
    const targetType = targetNode.getNodeType(builder);
    const target = targetNode.context({
      assign: true
    }).build(builder);
    const source = sourceNode.build(builder, targetType);
    const sourceType = sourceNode.getNodeType(builder);
    const nodeData = builder.getDataFromNode(this);

    //

    let snippet;
    if (nodeData.initialized === true) {
      if (output !== 'void') {
        snippet = target;
      }
    } else if (needsSplitAssign) {
      const sourceVar = builder.getVarFromNode(this, null, targetType);
      const sourceProperty = builder.getPropertyName(sourceVar);
      builder.addLineFlowCode(`${sourceProperty} = ${source}`);
      const targetRoot = targetNode.node.context({
        assign: true
      }).build(builder);
      for (let i = 0; i < targetNode.components.length; i++) {
        const component = targetNode.components[i];
        builder.addLineFlowCode(`${targetRoot}.${component} = ${sourceProperty}[ ${i} ]`);
      }
      if (output !== 'void') {
        snippet = target;
      }
    } else {
      snippet = `${target} = ${source}`;
      if (output === 'void' || sourceType === 'void') {
        builder.addLineFlowCode(snippet);
        if (output !== 'void') {
          snippet = target;
        }
      }
    }
    nodeData.initialized = true;
    return builder.format(snippet, targetType, output);
  }
}
AssignNode.type = /*@__PURE__*/registerNode('Assign', AssignNode);
const assign = /*@__PURE__*/nodeProxy(AssignNode);
addMethodChaining('assign', assign);

class UniformGroupNode extends Node$1 {
  constructor(name, shared = false) {
    super('string');
    this.name = name;
    this.version = 0;
    this.shared = shared;
    this.isUniformGroup = true;
  }
  set needsUpdate(value) {
    if (value === true) this.version++;
  }
  serialize(data) {
    super.serialize(data);
    data.name = this.name;
    data.version = this.version;
    data.shared = this.shared;
  }
  deserialize(data) {
    super.deserialize(data);
    this.name = data.name;
    this.version = data.version;
    this.shared = data.shared;
  }
}
UniformGroupNode.type = /*@__PURE__*/registerNode('UniformGroup', UniformGroupNode);
const uniformGroup = name => new UniformGroupNode(name);
const sharedUniformGroup = name => new UniformGroupNode(name, true);
const objectGroup = /*@__PURE__*/uniformGroup('object');

class UniformNode extends InputNode {
  constructor(value, nodeType = null) {
    super(value, nodeType);
    this.isUniformNode = true;
    this.name = '';
    this.groupNode = objectGroup;
  }
  label(name) {
    this.name = name;
    return this;
  }
  setGroup(group) {
    this.groupNode = group;
    return this;
  }
  getGroup() {
    return this.groupNode;
  }
  getUniformHash(builder) {
    return this.getHash(builder);
  }
  onUpdate(callback, updateType) {
    const self = this.getSelf();
    callback = callback.bind(self);
    return super.onUpdate(frame => {
      const value = callback(frame, self);
      if (value !== undefined) {
        this.value = value;
      }
    }, updateType);
  }
  generate(builder, output) {
    const type = this.getNodeType(builder);
    const hash = this.getUniformHash(builder);
    let sharedNode = builder.getNodeFromHash(hash);
    if (sharedNode === undefined) {
      builder.setHashNode(this, hash);
      sharedNode = this;
    }
    const sharedNodeType = sharedNode.getInputType(builder);
    const nodeUniform = builder.getUniformFromNode(sharedNode, sharedNodeType, builder.shaderStage, this.name || builder.context.label);
    const propertyName = builder.getPropertyName(nodeUniform);
    if (builder.context.label !== undefined) delete builder.context.label;
    return builder.format(propertyName, type, output);
  }
}
UniformNode.type = /*@__PURE__*/registerNode('Uniform', UniformNode);
const uniform = (arg1, arg2) => {
  const nodeType = getConstNodeType(arg2 || arg1);

  // @TODO: get ConstNode from .traverse() in the future
  const value = arg1 && arg1.isNode === true ? arg1.node && arg1.node.value || arg1.value : arg1;
  return nodeObject(new UniformNode(value, nodeType));
};

class PropertyNode extends Node$1 {
  constructor(nodeType, name = null, varying = false) {
    super(nodeType);
    this.name = name;
    this.varying = varying;
    this.isPropertyNode = true;
  }
  getHash(builder) {
    return this.name || super.getHash(builder);
  }
  isGlobal(/*builder*/
  ) {
    return true;
  }
  generate(builder) {
    let nodeVar;
    if (this.varying === true) {
      nodeVar = builder.getVaryingFromNode(this, this.name);
      nodeVar.needsInterpolation = true;
    } else {
      nodeVar = builder.getVarFromNode(this, this.name);
    }
    return builder.getPropertyName(nodeVar);
  }
}
PropertyNode.type = /*@__PURE__*/registerNode('Property', PropertyNode);
const property = (type, name) => nodeObject(new PropertyNode(type, name));
const varyingProperty = (type, name) => nodeObject(new PropertyNode(type, name, true));
const diffuseColor = /*@__PURE__*/nodeImmutable(PropertyNode, 'vec4', 'DiffuseColor');
const emissive = /*@__PURE__*/nodeImmutable(PropertyNode, 'vec3', 'EmissiveColor');
const output = /*@__PURE__*/nodeImmutable(PropertyNode, 'vec4', 'Output');

class FunctionCallNode extends TempNode {
  constructor(functionNode = null, parameters = {}) {
    super();
    this.functionNode = functionNode;
    this.parameters = parameters;
  }
  setParameters(parameters) {
    this.parameters = parameters;
    return this;
  }
  getParameters() {
    return this.parameters;
  }
  getNodeType(builder) {
    return this.functionNode.getNodeType(builder);
  }
  generate(builder) {
    const params = [];
    const functionNode = this.functionNode;
    const inputs = functionNode.getInputs(builder);
    const parameters = this.parameters;
    if (Array.isArray(parameters)) {
      for (let i = 0; i < parameters.length; i++) {
        const inputNode = inputs[i];
        const node = parameters[i];
        params.push(node.build(builder, inputNode.type));
      }
    } else {
      for (const inputNode of inputs) {
        const node = parameters[inputNode.name];
        if (node !== undefined) {
          params.push(node.build(builder, inputNode.type));
        } else {
          throw new Error(`FunctionCallNode: Input '${inputNode.name}' not found in FunctionNode.`);
        }
      }
    }
    const functionName = functionNode.build(builder, 'property');
    return `${functionName}( ${params.join(', ')} )`;
  }
}
FunctionCallNode.type = /*@__PURE__*/registerNode('FunctionCall', FunctionCallNode);
const call = (func, ...params) => {
  params = params.length > 1 || params[0] && params[0].isNode === true ? nodeArray(params) : nodeObjects(params[0]);
  return nodeObject(new FunctionCallNode(nodeObject(func), params));
};
addMethodChaining('call', call);

class OperatorNode extends TempNode {
  constructor(op, aNode, bNode, ...params) {
    super();
    if (params.length > 0) {
      let finalOp = new OperatorNode(op, aNode, bNode);
      for (let i = 0; i < params.length - 1; i++) {
        finalOp = new OperatorNode(op, finalOp, params[i]);
      }
      aNode = finalOp;
      bNode = params[params.length - 1];
    }
    this.op = op;
    this.aNode = aNode;
    this.bNode = bNode;
  }
  getNodeType(builder, output) {
    const op = this.op;
    const aNode = this.aNode;
    const bNode = this.bNode;
    const typeA = aNode.getNodeType(builder);
    const typeB = typeof bNode !== 'undefined' ? bNode.getNodeType(builder) : null;
    if (typeA === 'void' || typeB === 'void') {
      return 'void';
    } else if (op === '%') {
      return typeA;
    } else if (op === '~' || op === '&' || op === '|' || op === '^' || op === '>>' || op === '<<') {
      return builder.getIntegerType(typeA);
    } else if (op === '!' || op === '==' || op === '&&' || op === '||' || op === '^^') {
      return 'bool';
    } else if (op === '<' || op === '>' || op === '<=' || op === '>=') {
      const typeLength = output ? builder.getTypeLength(output) : Math.max(builder.getTypeLength(typeA), builder.getTypeLength(typeB));
      return typeLength > 1 ? `bvec${typeLength}` : 'bool';
    } else {
      if (typeA === 'float' && builder.isMatrix(typeB)) {
        return typeB;
      } else if (builder.isMatrix(typeA) && builder.isVector(typeB)) {
        // matrix x vector

        return builder.getVectorFromMatrix(typeA);
      } else if (builder.isVector(typeA) && builder.isMatrix(typeB)) {
        // vector x matrix

        return builder.getVectorFromMatrix(typeB);
      } else if (builder.getTypeLength(typeB) > builder.getTypeLength(typeA)) {
        // anytype x anytype: use the greater length vector

        return typeB;
      }
      return typeA;
    }
  }
  generate(builder, output) {
    const op = this.op;
    const aNode = this.aNode;
    const bNode = this.bNode;
    const type = this.getNodeType(builder, output);
    let typeA = null;
    let typeB = null;
    if (type !== 'void') {
      typeA = aNode.getNodeType(builder);
      typeB = typeof bNode !== 'undefined' ? bNode.getNodeType(builder) : null;
      if (op === '<' || op === '>' || op === '<=' || op === '>=' || op === '==') {
        if (builder.isVector(typeA)) {
          typeB = typeA;
        } else if (typeA !== typeB) {
          typeA = typeB = 'float';
        }
      } else if (op === '>>' || op === '<<') {
        typeA = type;
        typeB = builder.changeComponentType(typeB, 'uint');
      } else if (builder.isMatrix(typeA) && builder.isVector(typeB)) {
        // matrix x vector

        typeB = builder.getVectorFromMatrix(typeA);
      } else if (builder.isVector(typeA) && builder.isMatrix(typeB)) {
        // vector x matrix

        typeA = builder.getVectorFromMatrix(typeB);
      } else {
        // anytype x anytype

        typeA = typeB = type;
      }
    } else {
      typeA = typeB = type;
    }
    const a = aNode.build(builder, typeA);
    const b = typeof bNode !== 'undefined' ? bNode.build(builder, typeB) : null;
    const outputLength = builder.getTypeLength(output);
    const fnOpSnippet = builder.getFunctionOperator(op);
    if (output !== 'void') {
      if (op === '<' && outputLength > 1) {
        if (builder.useComparisonMethod) {
          return builder.format(`${builder.getMethod('lessThan', output)}( ${a}, ${b} )`, type, output);
        } else {
          return builder.format(`( ${a} < ${b} )`, type, output);
        }
      } else if (op === '<=' && outputLength > 1) {
        if (builder.useComparisonMethod) {
          return builder.format(`${builder.getMethod('lessThanEqual', output)}( ${a}, ${b} )`, type, output);
        } else {
          return builder.format(`( ${a} <= ${b} )`, type, output);
        }
      } else if (op === '>' && outputLength > 1) {
        if (builder.useComparisonMethod) {
          return builder.format(`${builder.getMethod('greaterThan', output)}( ${a}, ${b} )`, type, output);
        } else {
          return builder.format(`( ${a} > ${b} )`, type, output);
        }
      } else if (op === '>=' && outputLength > 1) {
        if (builder.useComparisonMethod) {
          return builder.format(`${builder.getMethod('greaterThanEqual', output)}( ${a}, ${b} )`, type, output);
        } else {
          return builder.format(`( ${a} >= ${b} )`, type, output);
        }
      } else if (op === '!' || op === '~') {
        return builder.format(`(${op}${a})`, typeA, output);
      } else if (fnOpSnippet) {
        return builder.format(`${fnOpSnippet}( ${a}, ${b} )`, type, output);
      } else {
        return builder.format(`( ${a} ${op} ${b} )`, type, output);
      }
    } else if (typeA !== 'void') {
      if (fnOpSnippet) {
        return builder.format(`${fnOpSnippet}( ${a}, ${b} )`, type, output);
      } else {
        return builder.format(`${a} ${op} ${b}`, type, output);
      }
    }
  }
  serialize(data) {
    super.serialize(data);
    data.op = this.op;
  }
  deserialize(data) {
    super.deserialize(data);
    this.op = data.op;
  }
}
OperatorNode.type = /*@__PURE__*/registerNode('Operator', OperatorNode);
const add = /*@__PURE__*/nodeProxy(OperatorNode, '+');
const sub = /*@__PURE__*/nodeProxy(OperatorNode, '-');
const mul = /*@__PURE__*/nodeProxy(OperatorNode, '*');
const div = /*@__PURE__*/nodeProxy(OperatorNode, '/');
const modInt = /*@__PURE__*/nodeProxy(OperatorNode, '%');
const equal = /*@__PURE__*/nodeProxy(OperatorNode, '==');
const notEqual = /*@__PURE__*/nodeProxy(OperatorNode, '!=');
const lessThan = /*@__PURE__*/nodeProxy(OperatorNode, '<');
const greaterThan = /*@__PURE__*/nodeProxy(OperatorNode, '>');
const lessThanEqual = /*@__PURE__*/nodeProxy(OperatorNode, '<=');
const greaterThanEqual = /*@__PURE__*/nodeProxy(OperatorNode, '>=');
const and = /*@__PURE__*/nodeProxy(OperatorNode, '&&');
const or = /*@__PURE__*/nodeProxy(OperatorNode, '||');
const not = /*@__PURE__*/nodeProxy(OperatorNode, '!');
const xor = /*@__PURE__*/nodeProxy(OperatorNode, '^^');
const bitAnd = /*@__PURE__*/nodeProxy(OperatorNode, '&');
const bitNot = /*@__PURE__*/nodeProxy(OperatorNode, '~');
const bitOr = /*@__PURE__*/nodeProxy(OperatorNode, '|');
const bitXor = /*@__PURE__*/nodeProxy(OperatorNode, '^');
const shiftLeft = /*@__PURE__*/nodeProxy(OperatorNode, '<<');
const shiftRight = /*@__PURE__*/nodeProxy(OperatorNode, '>>');
addMethodChaining('add', add);
addMethodChaining('sub', sub);
addMethodChaining('mul', mul);
addMethodChaining('div', div);
addMethodChaining('modInt', modInt);
addMethodChaining('equal', equal);
addMethodChaining('notEqual', notEqual);
addMethodChaining('lessThan', lessThan);
addMethodChaining('greaterThan', greaterThan);
addMethodChaining('lessThanEqual', lessThanEqual);
addMethodChaining('greaterThanEqual', greaterThanEqual);
addMethodChaining('and', and);
addMethodChaining('or', or);
addMethodChaining('not', not);
addMethodChaining('xor', xor);
addMethodChaining('bitAnd', bitAnd);
addMethodChaining('bitNot', bitNot);
addMethodChaining('bitOr', bitOr);
addMethodChaining('bitXor', bitXor);
addMethodChaining('shiftLeft', shiftLeft);
addMethodChaining('shiftRight', shiftRight);
const remainder = (...params) => {
  // @deprecated, r168

  console.warn('TSL.OperatorNode: .remainder() has been renamed to .modInt().');
  return modInt(...params);
};
addMethodChaining('remainder', remainder);

class MathNode extends TempNode {
  constructor(method, aNode, bNode = null, cNode = null) {
    super();
    this.method = method;
    this.aNode = aNode;
    this.bNode = bNode;
    this.cNode = cNode;
  }
  getInputType(builder) {
    const aType = this.aNode.getNodeType(builder);
    const bType = this.bNode ? this.bNode.getNodeType(builder) : null;
    const cType = this.cNode ? this.cNode.getNodeType(builder) : null;
    const aLen = builder.isMatrix(aType) ? 0 : builder.getTypeLength(aType);
    const bLen = builder.isMatrix(bType) ? 0 : builder.getTypeLength(bType);
    const cLen = builder.isMatrix(cType) ? 0 : builder.getTypeLength(cType);
    if (aLen > bLen && aLen > cLen) {
      return aType;
    } else if (bLen > cLen) {
      return bType;
    } else if (cLen > aLen) {
      return cType;
    }
    return aType;
  }
  getNodeType(builder) {
    const method = this.method;
    if (method === MathNode.LENGTH || method === MathNode.DISTANCE || method === MathNode.DOT) {
      return 'float';
    } else if (method === MathNode.CROSS) {
      return 'vec3';
    } else if (method === MathNode.ALL) {
      return 'bool';
    } else if (method === MathNode.EQUALS) {
      return builder.changeComponentType(this.aNode.getNodeType(builder), 'bool');
    } else if (method === MathNode.MOD) {
      return this.aNode.getNodeType(builder);
    } else {
      return this.getInputType(builder);
    }
  }
  generate(builder, output) {
    const method = this.method;
    const type = this.getNodeType(builder);
    const inputType = this.getInputType(builder);
    const a = this.aNode;
    const b = this.bNode;
    const c = this.cNode;
    const isWebGL = builder.renderer.isWebGLRenderer === true;
    if (method === MathNode.TRANSFORM_DIRECTION) {
      // dir can be either a direction vector or a normal vector
      // upper-left 3x3 of matrix is assumed to be orthogonal

      let tA = a;
      let tB = b;
      if (builder.isMatrix(tA.getNodeType(builder))) {
        tB = vec4(vec3(tB), 0.0);
      } else {
        tA = vec4(vec3(tA), 0.0);
      }
      const mulNode = mul(tA, tB).xyz;
      return normalize(mulNode).build(builder, output);
    } else if (method === MathNode.NEGATE) {
      return builder.format('( - ' + a.build(builder, inputType) + ' )', type, output);
    } else if (method === MathNode.ONE_MINUS) {
      return sub(1.0, a).build(builder, output);
    } else if (method === MathNode.RECIPROCAL) {
      return div(1.0, a).build(builder, output);
    } else if (method === MathNode.DIFFERENCE) {
      return abs(sub(a, b)).build(builder, output);
    } else {
      const params = [];
      if (method === MathNode.CROSS || method === MathNode.MOD) {
        params.push(a.build(builder, type), b.build(builder, type));
      } else if (isWebGL && method === MathNode.STEP) {
        params.push(a.build(builder, builder.getTypeLength(a.getNodeType(builder)) === 1 ? 'float' : inputType), b.build(builder, inputType));
      } else if (isWebGL && (method === MathNode.MIN || method === MathNode.MAX) || method === MathNode.MOD) {
        params.push(a.build(builder, inputType), b.build(builder, builder.getTypeLength(b.getNodeType(builder)) === 1 ? 'float' : inputType));
      } else if (method === MathNode.REFRACT) {
        params.push(a.build(builder, inputType), b.build(builder, inputType), c.build(builder, 'float'));
      } else if (method === MathNode.MIX) {
        params.push(a.build(builder, inputType), b.build(builder, inputType), c.build(builder, builder.getTypeLength(c.getNodeType(builder)) === 1 ? 'float' : inputType));
      } else {
        params.push(a.build(builder, inputType));
        if (b !== null) params.push(b.build(builder, inputType));
        if (c !== null) params.push(c.build(builder, inputType));
      }
      return builder.format(`${builder.getMethod(method, type)}( ${params.join(', ')} )`, type, output);
    }
  }
  serialize(data) {
    super.serialize(data);
    data.method = this.method;
  }
  deserialize(data) {
    super.deserialize(data);
    this.method = data.method;
  }
}

// 1 input

MathNode.ALL = 'all';
MathNode.ANY = 'any';
MathNode.EQUALS = 'equals';
MathNode.RADIANS = 'radians';
MathNode.DEGREES = 'degrees';
MathNode.EXP = 'exp';
MathNode.EXP2 = 'exp2';
MathNode.LOG = 'log';
MathNode.LOG2 = 'log2';
MathNode.SQRT = 'sqrt';
MathNode.INVERSE_SQRT = 'inversesqrt';
MathNode.FLOOR = 'floor';
MathNode.CEIL = 'ceil';
MathNode.NORMALIZE = 'normalize';
MathNode.FRACT = 'fract';
MathNode.SIN = 'sin';
MathNode.COS = 'cos';
MathNode.TAN = 'tan';
MathNode.ASIN = 'asin';
MathNode.ACOS = 'acos';
MathNode.ATAN = 'atan';
MathNode.ABS = 'abs';
MathNode.SIGN = 'sign';
MathNode.LENGTH = 'length';
MathNode.NEGATE = 'negate';
MathNode.ONE_MINUS = 'oneMinus';
MathNode.DFDX = 'dFdx';
MathNode.DFDY = 'dFdy';
MathNode.ROUND = 'round';
MathNode.RECIPROCAL = 'reciprocal';
MathNode.TRUNC = 'trunc';
MathNode.FWIDTH = 'fwidth';
MathNode.BITCAST = 'bitcast';
MathNode.TRANSPOSE = 'transpose';

// 2 inputs

MathNode.ATAN2 = 'atan2';
MathNode.MIN = 'min';
MathNode.MAX = 'max';
MathNode.MOD = 'mod';
MathNode.STEP = 'step';
MathNode.REFLECT = 'reflect';
MathNode.DISTANCE = 'distance';
MathNode.DIFFERENCE = 'difference';
MathNode.DOT = 'dot';
MathNode.CROSS = 'cross';
MathNode.POW = 'pow';
MathNode.TRANSFORM_DIRECTION = 'transformDirection';

// 3 inputs

MathNode.MIX = 'mix';
MathNode.CLAMP = 'clamp';
MathNode.REFRACT = 'refract';
MathNode.SMOOTHSTEP = 'smoothstep';
MathNode.FACEFORWARD = 'faceforward';
MathNode.type = /*@__PURE__*/registerNode('Math', MathNode);
const PI = /*@__PURE__*/float(Math.PI);
const all = /*@__PURE__*/nodeProxy(MathNode, MathNode.ALL);
const any = /*@__PURE__*/nodeProxy(MathNode, MathNode.ANY);
const equals = /*@__PURE__*/nodeProxy(MathNode, MathNode.EQUALS);
const radians = /*@__PURE__*/nodeProxy(MathNode, MathNode.RADIANS);
const degrees = /*@__PURE__*/nodeProxy(MathNode, MathNode.DEGREES);
const exp = /*@__PURE__*/nodeProxy(MathNode, MathNode.EXP);
const exp2 = /*@__PURE__*/nodeProxy(MathNode, MathNode.EXP2);
const log = /*@__PURE__*/nodeProxy(MathNode, MathNode.LOG);
const log2 = /*@__PURE__*/nodeProxy(MathNode, MathNode.LOG2);
const sqrt = /*@__PURE__*/nodeProxy(MathNode, MathNode.SQRT);
const inverseSqrt = /*@__PURE__*/nodeProxy(MathNode, MathNode.INVERSE_SQRT);
const floor = /*@__PURE__*/nodeProxy(MathNode, MathNode.FLOOR);
const ceil = /*@__PURE__*/nodeProxy(MathNode, MathNode.CEIL);
const normalize = /*@__PURE__*/nodeProxy(MathNode, MathNode.NORMALIZE);
const fract = /*@__PURE__*/nodeProxy(MathNode, MathNode.FRACT);
const sin = /*@__PURE__*/nodeProxy(MathNode, MathNode.SIN);
const cos = /*@__PURE__*/nodeProxy(MathNode, MathNode.COS);
const tan = /*@__PURE__*/nodeProxy(MathNode, MathNode.TAN);
const asin = /*@__PURE__*/nodeProxy(MathNode, MathNode.ASIN);
const acos = /*@__PURE__*/nodeProxy(MathNode, MathNode.ACOS);
const atan = /*@__PURE__*/nodeProxy(MathNode, MathNode.ATAN);
const abs = /*@__PURE__*/nodeProxy(MathNode, MathNode.ABS);
const sign = /*@__PURE__*/nodeProxy(MathNode, MathNode.SIGN);
const length = /*@__PURE__*/nodeProxy(MathNode, MathNode.LENGTH);
const negate = /*@__PURE__*/nodeProxy(MathNode, MathNode.NEGATE);
const oneMinus = /*@__PURE__*/nodeProxy(MathNode, MathNode.ONE_MINUS);
const dFdx = /*@__PURE__*/nodeProxy(MathNode, MathNode.DFDX);
const dFdy = /*@__PURE__*/nodeProxy(MathNode, MathNode.DFDY);
const round = /*@__PURE__*/nodeProxy(MathNode, MathNode.ROUND);
const reciprocal = /*@__PURE__*/nodeProxy(MathNode, MathNode.RECIPROCAL);
const trunc = /*@__PURE__*/nodeProxy(MathNode, MathNode.TRUNC);
const fwidth = /*@__PURE__*/nodeProxy(MathNode, MathNode.FWIDTH);
/*@__PURE__*/nodeProxy(MathNode, MathNode.BITCAST);
const transpose = /*@__PURE__*/nodeProxy(MathNode, MathNode.TRANSPOSE);
const atan2 = /*@__PURE__*/nodeProxy(MathNode, MathNode.ATAN2);
const min$1 = /*@__PURE__*/nodeProxy(MathNode, MathNode.MIN);
const max$2 = /*@__PURE__*/nodeProxy(MathNode, MathNode.MAX);
const mod = /*@__PURE__*/nodeProxy(MathNode, MathNode.MOD);
const step = /*@__PURE__*/nodeProxy(MathNode, MathNode.STEP);
const reflect = /*@__PURE__*/nodeProxy(MathNode, MathNode.REFLECT);
const distance = /*@__PURE__*/nodeProxy(MathNode, MathNode.DISTANCE);
const difference = /*@__PURE__*/nodeProxy(MathNode, MathNode.DIFFERENCE);
const dot = /*@__PURE__*/nodeProxy(MathNode, MathNode.DOT);
const cross = /*@__PURE__*/nodeProxy(MathNode, MathNode.CROSS);
const pow = /*@__PURE__*/nodeProxy(MathNode, MathNode.POW);
const pow2 = /*@__PURE__*/nodeProxy(MathNode, MathNode.POW, 2);
const pow3 = /*@__PURE__*/nodeProxy(MathNode, MathNode.POW, 3);
const pow4 = /*@__PURE__*/nodeProxy(MathNode, MathNode.POW, 4);
const transformDirection = /*@__PURE__*/nodeProxy(MathNode, MathNode.TRANSFORM_DIRECTION);
const cbrt = a => mul(sign(a), pow(abs(a), 1.0 / 3.0));
const lengthSq = a => dot(a, a);
const mix = /*@__PURE__*/nodeProxy(MathNode, MathNode.MIX);
const clamp = (value, low = 0, high = 1) => nodeObject(new MathNode(MathNode.CLAMP, nodeObject(value), nodeObject(low), nodeObject(high)));
const saturate = value => clamp(value);
const refract = /*@__PURE__*/nodeProxy(MathNode, MathNode.REFRACT);
const smoothstep = /*@__PURE__*/nodeProxy(MathNode, MathNode.SMOOTHSTEP);
const faceForward = /*@__PURE__*/nodeProxy(MathNode, MathNode.FACEFORWARD);
const rand = /*@__PURE__*/Fn(([uv]) => {
  const a = 12.9898,
    b = 78.233,
    c = 43758.5453;
  const dt = dot(uv.xy, vec2(a, b)),
    sn = mod(dt, PI);
  return fract(sin(sn).mul(c));
});
const mixElement = (t, e1, e2) => mix(e1, e2, t);
const smoothstepElement = (x, low, high) => smoothstep(low, high, x);
addMethodChaining('all', all);
addMethodChaining('any', any);
addMethodChaining('equals', equals);
addMethodChaining('radians', radians);
addMethodChaining('degrees', degrees);
addMethodChaining('exp', exp);
addMethodChaining('exp2', exp2);
addMethodChaining('log', log);
addMethodChaining('log2', log2);
addMethodChaining('sqrt', sqrt);
addMethodChaining('inverseSqrt', inverseSqrt);
addMethodChaining('floor', floor);
addMethodChaining('ceil', ceil);
addMethodChaining('normalize', normalize);
addMethodChaining('fract', fract);
addMethodChaining('sin', sin);
addMethodChaining('cos', cos);
addMethodChaining('tan', tan);
addMethodChaining('asin', asin);
addMethodChaining('acos', acos);
addMethodChaining('atan', atan);
addMethodChaining('abs', abs);
addMethodChaining('sign', sign);
addMethodChaining('length', length);
addMethodChaining('lengthSq', lengthSq);
addMethodChaining('negate', negate);
addMethodChaining('oneMinus', oneMinus);
addMethodChaining('dFdx', dFdx);
addMethodChaining('dFdy', dFdy);
addMethodChaining('round', round);
addMethodChaining('reciprocal', reciprocal);
addMethodChaining('trunc', trunc);
addMethodChaining('fwidth', fwidth);
addMethodChaining('atan2', atan2);
addMethodChaining('min', min$1);
addMethodChaining('max', max$2);
addMethodChaining('mod', mod);
addMethodChaining('step', step);
addMethodChaining('reflect', reflect);
addMethodChaining('distance', distance);
addMethodChaining('dot', dot);
addMethodChaining('cross', cross);
addMethodChaining('pow', pow);
addMethodChaining('pow2', pow2);
addMethodChaining('pow3', pow3);
addMethodChaining('pow4', pow4);
addMethodChaining('transformDirection', transformDirection);
addMethodChaining('mix', mixElement);
addMethodChaining('clamp', clamp);
addMethodChaining('refract', refract);
addMethodChaining('smoothstep', smoothstepElement);
addMethodChaining('faceForward', faceForward);
addMethodChaining('difference', difference);
addMethodChaining('saturate', saturate);
addMethodChaining('cbrt', cbrt);
addMethodChaining('transpose', transpose);
addMethodChaining('rand', rand);

class ConditionalNode extends Node$1 {
  constructor(condNode, ifNode, elseNode = null) {
    super();
    this.condNode = condNode;
    this.ifNode = ifNode;
    this.elseNode = elseNode;
  }
  getNodeType(builder) {
    const ifType = this.ifNode.getNodeType(builder);
    if (this.elseNode !== null) {
      const elseType = this.elseNode.getNodeType(builder);
      if (builder.getTypeLength(elseType) > builder.getTypeLength(ifType)) {
        return elseType;
      }
    }
    return ifType;
  }
  setup(builder) {
    const properties = builder.getNodeProperties(this);
    properties.condNode = this.condNode.cache();
    properties.ifNode = this.ifNode.cache();
    properties.elseNode = this.elseNode ? this.elseNode.cache() : null;
  }
  generate(builder, output) {
    const type = this.getNodeType(builder);
    const nodeData = builder.getDataFromNode(this);
    if (nodeData.nodeProperty !== undefined) {
      return nodeData.nodeProperty;
    }
    const {
      condNode,
      ifNode,
      elseNode
    } = builder.getNodeProperties(this);
    const needsOutput = output !== 'void';
    const nodeProperty = needsOutput ? property(type).build(builder) : '';
    nodeData.nodeProperty = nodeProperty;
    const nodeSnippet = condNode.build(builder, 'bool');
    builder.addFlowCode(`\n${builder.tab}if ( ${nodeSnippet} ) {\n\n`).addFlowTab();
    let ifSnippet = ifNode.build(builder, type);
    if (ifSnippet) {
      if (needsOutput) {
        ifSnippet = nodeProperty + ' = ' + ifSnippet + ';';
      } else {
        ifSnippet = 'return ' + ifSnippet + ';';
      }
    }
    builder.removeFlowTab().addFlowCode(builder.tab + '\t' + ifSnippet + '\n\n' + builder.tab + '}');
    if (elseNode !== null) {
      builder.addFlowCode(' else {\n\n').addFlowTab();
      let elseSnippet = elseNode.build(builder, type);
      if (elseSnippet) {
        if (needsOutput) {
          elseSnippet = nodeProperty + ' = ' + elseSnippet + ';';
        } else {
          elseSnippet = 'return ' + elseSnippet + ';';
        }
      }
      builder.removeFlowTab().addFlowCode(builder.tab + '\t' + elseSnippet + '\n\n' + builder.tab + '}\n\n');
    } else {
      builder.addFlowCode('\n\n');
    }
    return builder.format(nodeProperty, type, output);
  }
}
ConditionalNode.type = /*@__PURE__*/registerNode('Conditional', ConditionalNode);
const select = /*@__PURE__*/nodeProxy(ConditionalNode);
addMethodChaining('select', select);

//

const cond = (...params) => {
  // @deprecated, r168

  console.warn('TSL.ConditionalNode: cond() has been renamed to select().');
  return select(...params);
};
addMethodChaining('cond', cond);

class ContextNode extends Node$1 {
  constructor(node, value = {}) {
    super();
    this.isContextNode = true;
    this.node = node;
    this.value = value;
  }
  getScope() {
    return this.node.getScope();
  }
  getNodeType(builder) {
    return this.node.getNodeType(builder);
  }
  analyze(builder) {
    this.node.build(builder);
  }
  setup(builder) {
    const previousContext = builder.getContext();
    builder.setContext({
      ...builder.context,
      ...this.value
    });
    const node = this.node.build(builder);
    builder.setContext(previousContext);
    return node;
  }
  generate(builder, output) {
    const previousContext = builder.getContext();
    builder.setContext({
      ...builder.context,
      ...this.value
    });
    const snippet = this.node.build(builder, output);
    builder.setContext(previousContext);
    return snippet;
  }
}
ContextNode.type = /*@__PURE__*/registerNode('Context', ContextNode);
const context = /*@__PURE__*/nodeProxy(ContextNode);
const label = (node, name) => context(node, {
  label: name
});
addMethodChaining('context', context);
addMethodChaining('label', label);

class VarNode extends Node$1 {
  constructor(node, name = null) {
    super();
    this.node = node;
    this.name = name;
    this.global = true;
    this.isVarNode = true;
  }
  getHash(builder) {
    return this.name || super.getHash(builder);
  }
  getNodeType(builder) {
    return this.node.getNodeType(builder);
  }
  generate(builder) {
    const {
      node,
      name
    } = this;
    const nodeVar = builder.getVarFromNode(this, name, builder.getVectorType(this.getNodeType(builder)));
    const propertyName = builder.getPropertyName(nodeVar);
    const snippet = node.build(builder, nodeVar.type);
    builder.addLineFlowCode(`${propertyName} = ${snippet}`);
    return propertyName;
  }
}
VarNode.type = /*@__PURE__*/registerNode('Var', VarNode);
const temp = /*@__PURE__*/nodeProxy(VarNode);
addMethodChaining('temp', temp); // @TODO: Will be removed in the future
addMethodChaining('toVar', (...params) => temp(...params).append());

class VaryingNode extends Node$1 {
  constructor(node, name = null) {
    super();
    this.node = node;
    this.name = name;
    this.isVaryingNode = true;
  }
  isGlobal() {
    return true;
  }
  getHash(builder) {
    return this.name || super.getHash(builder);
  }
  getNodeType(builder) {
    // VaryingNode is auto type

    return this.node.getNodeType(builder);
  }
  setupVarying(builder) {
    const properties = builder.getNodeProperties(this);
    let varying = properties.varying;
    if (varying === undefined) {
      const name = this.name;
      const type = this.getNodeType(builder);
      properties.varying = varying = builder.getVaryingFromNode(this, name, type);
      properties.node = this.node;
    }

    // this property can be used to check if the varying can be optimized for a variable
    varying.needsInterpolation || (varying.needsInterpolation = builder.shaderStage === 'fragment');
    return varying;
  }
  setup(builder) {
    this.setupVarying(builder);
  }
  analyze(builder) {
    this.setupVarying(builder);
    return this.node.analyze(builder);
  }
  generate(builder) {
    const properties = builder.getNodeProperties(this);
    const varying = this.setupVarying(builder);
    if (properties.propertyName === undefined) {
      const type = this.getNodeType(builder);
      const propertyName = builder.getPropertyName(varying, NodeShaderStage.VERTEX);

      // force node run in vertex stage
      builder.flowNodeFromShaderStage(NodeShaderStage.VERTEX, this.node, type, propertyName);
      properties.propertyName = propertyName;
    }
    return builder.getPropertyName(varying);
  }
}
VaryingNode.type = /*@__PURE__*/registerNode('Varying', VaryingNode);
const varying = /*@__PURE__*/nodeProxy(VaryingNode);
addMethodChaining('varying', varying);

const getColorSpaceName = colorSpace => {
  let method = null;
  if (colorSpace === LinearSRGBColorSpace) {
    method = 'Linear';
  } else if (colorSpace === SRGBColorSpace) {
    method = 'sRGB';
  }
  return method;
};
const getColorSpaceMethod = (source, target) => {
  return getColorSpaceName(source) + 'To' + getColorSpaceName(target);
};
class ColorSpaceNode extends TempNode {
  constructor(colorNode, target = null, source = null) {
    super('vec4');
    this.colorNode = colorNode;
    this.target = target;
    this.source = source;
  }
  setup(builder) {
    const {
      renderer,
      context
    } = builder;
    const source = this.source || context.outputColorSpace || renderer.outputColorSpace;
    const target = this.target || context.outputColorSpace || renderer.outputColorSpace;
    const colorNode = this.colorNode;
    if (source === target) return colorNode;
    const colorSpace = getColorSpaceMethod(source, target);
    let outputNode = null;
    const colorSpaceFn = renderer.nodes.library.getColorSpaceFunction(colorSpace);
    if (colorSpaceFn !== null) {
      outputNode = vec4(colorSpaceFn(colorNode.rgb), colorNode.a);
    } else {
      console.error('ColorSpaceNode: Unsupported Color Space configuration.', colorSpace);
      outputNode = colorNode;
    }
    return outputNode;
  }
}
ColorSpaceNode.type = /*@__PURE__*/registerNode('ColorSpace', ColorSpaceNode);
const toOutputColorSpace = (node, colorSpace = null) => nodeObject(new ColorSpaceNode(nodeObject(node), colorSpace, LinearSRGBColorSpace));
const toWorkingColorSpace = (node, colorSpace = null) => nodeObject(new ColorSpaceNode(nodeObject(node), LinearSRGBColorSpace, colorSpace));
addMethodChaining('toOutputColorSpace', toOutputColorSpace);
addMethodChaining('toWorkingColorSpace', toWorkingColorSpace);

class ReferenceElementNode$1 extends ArrayElementNode {
  constructor(referenceNode, indexNode) {
    super(referenceNode, indexNode);
    this.referenceNode = referenceNode;
    this.isReferenceElementNode = true;
  }
  getNodeType() {
    return this.referenceNode.uniformType;
  }
  generate(builder) {
    const snippet = super.generate(builder);
    const arrayType = this.referenceNode.getNodeType();
    const elementType = this.getNodeType();
    return builder.format(snippet, arrayType, elementType);
  }
}
class ReferenceBaseNode extends Node$1 {
  constructor(property, uniformType, object = null, count = null) {
    super();
    this.property = property;
    this.uniformType = uniformType;
    this.object = object;
    this.count = count;
    this.properties = property.split('.');
    this.reference = object;
    this.node = null;
    this.updateType = NodeUpdateType.OBJECT;
  }
  element(indexNode) {
    return nodeObject(new ReferenceElementNode$1(this, nodeObject(indexNode)));
  }
  setNodeType(uniformType) {
    this.node = uniform(null, uniformType).getSelf();
  }
  getNodeType(builder) {
    if (this.node === null) {
      this.updateValue();
    }
    return this.node.getNodeType(builder);
  }
  getValueFromReference(object = this.reference) {
    const {
      properties
    } = this;
    let value = object[properties[0]];
    for (let i = 1; i < properties.length; i++) {
      value = value[properties[i]];
    }
    return value;
  }
  updateReference(state) {
    this.reference = this.object !== null ? this.object : state.object;
    return this.reference;
  }
  setup() {
    this.updateValue();
    return this.node;
  }
  update(/*frame*/
  ) {
    this.updateValue();
  }
  updateValue() {
    if (this.node === null) this.setNodeType(this.uniformType);
    const value = this.getValueFromReference();
    if (Array.isArray(value)) {
      this.node.array = value;
    } else {
      this.node.value = value;
    }
  }
}
ReferenceBaseNode.type = /*@__PURE__*/registerNode('ReferenceBase', ReferenceBaseNode);

class RendererReferenceNode extends ReferenceBaseNode {
  constructor(property, inputType, renderer = null) {
    super(property, inputType, renderer);
    this.renderer = renderer;
  }
  updateReference(state) {
    this.reference = this.renderer !== null ? this.renderer : state.renderer;
    return this.reference;
  }
}
RendererReferenceNode.type = /*@__PURE__*/registerNode('RendererReference', RendererReferenceNode);
const rendererReference = (name, type, renderer) => nodeObject(new RendererReferenceNode(name, type, renderer));

class ToneMappingNode extends TempNode {
  constructor(toneMapping, exposureNode = toneMappingExposure, colorNode = null) {
    super('vec3');
    this.toneMapping = toneMapping;
    this.exposureNode = exposureNode;
    this.colorNode = colorNode;
  }
  getCacheKey() {
    let cacheKey = super.getCacheKey();
    cacheKey = '{toneMapping:' + this.toneMapping + ',nodes:' + cacheKey + '}';
    return cacheKey;
  }
  setup(builder) {
    const colorNode = this.colorNode || builder.context.color;
    const toneMapping = this.toneMapping;
    if (toneMapping === NoToneMapping) return colorNode;
    let outputNode = null;
    const toneMappingFn = builder.renderer.nodes.library.getToneMappingFunction(toneMapping);
    if (toneMappingFn !== null) {
      outputNode = vec4(toneMappingFn(colorNode.rgb, this.exposureNode), colorNode.a);
    } else {
      console.error('ToneMappingNode: Unsupported Tone Mapping configuration.', toneMapping);
      outputNode = colorNode;
    }
    return outputNode;
  }
}
ToneMappingNode.type = /*@__PURE__*/registerNode('ToneMapping', ToneMappingNode);
const toneMapping = (mapping, exposure, color) => nodeObject(new ToneMappingNode(mapping, nodeObject(exposure), nodeObject(color)));
const toneMappingExposure = /*@__PURE__*/rendererReference('toneMappingExposure', 'float');
addMethodChaining('toneMapping', (color, mapping, exposure) => toneMapping(mapping, exposure, color));

function arrayNeedsUint32(array) {
  // assumes larger values usually on last

  for (let i = array.length - 1; i >= 0; --i) {
    if (array[i] >= 65535) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
  }
  return false;
}
function createElementNS(name) {
  return document.createElementNS('http://www.w3.org/1999/xhtml', name);
}
const _cache$1 = {};
function warnOnce(message) {
  if (message in _cache$1) return;
  _cache$1[message] = true;
  console.warn(message);
}

const _vector$4 = /*@__PURE__*/new Vector3();
const _vector2$1 = /*@__PURE__*/new Vector2();
class BufferAttribute {
  constructor(array, itemSize, normalized = false) {
    if (Array.isArray(array)) {
      throw new TypeError('THREE.BufferAttribute: array should be a Typed Array.');
    }
    this.isBufferAttribute = true;
    this.name = '';
    this.array = array;
    this.itemSize = itemSize;
    this.count = array !== undefined ? array.length / itemSize : 0;
    this.normalized = normalized;
    this.usage = StaticDrawUsage;
    this._updateRange = {
      offset: 0,
      count: -1
    };
    this.updateRanges = [];
    this.gpuType = FloatType;
    this.version = 0;
  }
  onUploadCallback() {}
  set needsUpdate(value) {
    if (value === true) this.version++;
  }
  get updateRange() {
    warnOnce('THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.'); // @deprecated, r159
    return this._updateRange;
  }
  setUsage(value) {
    this.usage = value;
    return this;
  }
  addUpdateRange(start, count) {
    this.updateRanges.push({
      start,
      count
    });
  }
  clearUpdateRanges() {
    this.updateRanges.length = 0;
  }
  copy(source) {
    this.name = source.name;
    this.array = new source.array.constructor(source.array);
    this.itemSize = source.itemSize;
    this.count = source.count;
    this.normalized = source.normalized;
    this.usage = source.usage;
    this.gpuType = source.gpuType;
    return this;
  }
  copyAt(index1, attribute, index2) {
    index1 *= this.itemSize;
    index2 *= attribute.itemSize;
    for (let i = 0, l = this.itemSize; i < l; i++) {
      this.array[index1 + i] = attribute.array[index2 + i];
    }
    return this;
  }
  copyArray(array) {
    this.array.set(array);
    return this;
  }
  applyMatrix3(m) {
    if (this.itemSize === 2) {
      for (let i = 0, l = this.count; i < l; i++) {
        _vector2$1.fromBufferAttribute(this, i);
        _vector2$1.applyMatrix3(m);
        this.setXY(i, _vector2$1.x, _vector2$1.y);
      }
    } else if (this.itemSize === 3) {
      for (let i = 0, l = this.count; i < l; i++) {
        _vector$4.fromBufferAttribute(this, i);
        _vector$4.applyMatrix3(m);
        this.setXYZ(i, _vector$4.x, _vector$4.y, _vector$4.z);
      }
    }
    return this;
  }
  applyMatrix4(m) {
    for (let i = 0, l = this.count; i < l; i++) {
      _vector$4.fromBufferAttribute(this, i);
      _vector$4.applyMatrix4(m);
      this.setXYZ(i, _vector$4.x, _vector$4.y, _vector$4.z);
    }
    return this;
  }
  applyNormalMatrix(m) {
    for (let i = 0, l = this.count; i < l; i++) {
      _vector$4.fromBufferAttribute(this, i);
      _vector$4.applyNormalMatrix(m);
      this.setXYZ(i, _vector$4.x, _vector$4.y, _vector$4.z);
    }
    return this;
  }
  transformDirection(m) {
    for (let i = 0, l = this.count; i < l; i++) {
      _vector$4.fromBufferAttribute(this, i);
      _vector$4.transformDirection(m);
      this.setXYZ(i, _vector$4.x, _vector$4.y, _vector$4.z);
    }
    return this;
  }
  set(value, offset = 0) {
    // Matching BufferAttribute constructor, do not normalize the array.
    this.array.set(value, offset);
    return this;
  }
  getComponent(index, component) {
    let value = this.array[index * this.itemSize + component];
    if (this.normalized) value = denormalize(value, this.array);
    return value;
  }
  setComponent(index, component, value) {
    if (this.normalized) value = normalize$1(value, this.array);
    this.array[index * this.itemSize + component] = value;
    return this;
  }
  getX(index) {
    let x = this.array[index * this.itemSize];
    if (this.normalized) x = denormalize(x, this.array);
    return x;
  }
  setX(index, x) {
    if (this.normalized) x = normalize$1(x, this.array);
    this.array[index * this.itemSize] = x;
    return this;
  }
  getY(index) {
    let y = this.array[index * this.itemSize + 1];
    if (this.normalized) y = denormalize(y, this.array);
    return y;
  }
  setY(index, y) {
    if (this.normalized) y = normalize$1(y, this.array);
    this.array[index * this.itemSize + 1] = y;
    return this;
  }
  getZ(index) {
    let z = this.array[index * this.itemSize + 2];
    if (this.normalized) z = denormalize(z, this.array);
    return z;
  }
  setZ(index, z) {
    if (this.normalized) z = normalize$1(z, this.array);
    this.array[index * this.itemSize + 2] = z;
    return this;
  }
  getW(index) {
    let w = this.array[index * this.itemSize + 3];
    if (this.normalized) w = denormalize(w, this.array);
    return w;
  }
  setW(index, w) {
    if (this.normalized) w = normalize$1(w, this.array);
    this.array[index * this.itemSize + 3] = w;
    return this;
  }
  setXY(index, x, y) {
    index *= this.itemSize;
    if (this.normalized) {
      x = normalize$1(x, this.array);
      y = normalize$1(y, this.array);
    }
    this.array[index + 0] = x;
    this.array[index + 1] = y;
    return this;
  }
  setXYZ(index, x, y, z) {
    index *= this.itemSize;
    if (this.normalized) {
      x = normalize$1(x, this.array);
      y = normalize$1(y, this.array);
      z = normalize$1(z, this.array);
    }
    this.array[index + 0] = x;
    this.array[index + 1] = y;
    this.array[index + 2] = z;
    return this;
  }
  setXYZW(index, x, y, z, w) {
    index *= this.itemSize;
    if (this.normalized) {
      x = normalize$1(x, this.array);
      y = normalize$1(y, this.array);
      z = normalize$1(z, this.array);
      w = normalize$1(w, this.array);
    }
    this.array[index + 0] = x;
    this.array[index + 1] = y;
    this.array[index + 2] = z;
    this.array[index + 3] = w;
    return this;
  }
  onUpload(callback) {
    this.onUploadCallback = callback;
    return this;
  }
  clone() {
    return new this.constructor(this.array, this.itemSize).copy(this);
  }
  toJSON() {
    const data = {
      itemSize: this.itemSize,
      type: this.array.constructor.name,
      array: Array.from(this.array),
      normalized: this.normalized
    };
    if (this.name !== '') data.name = this.name;
    if (this.usage !== StaticDrawUsage) data.usage = this.usage;
    return data;
  }
}
class Uint16BufferAttribute extends BufferAttribute {
  constructor(array, itemSize, normalized) {
    super(new Uint16Array(array), itemSize, normalized);
  }
}
class Uint32BufferAttribute extends BufferAttribute {
  constructor(array, itemSize, normalized) {
    super(new Uint32Array(array), itemSize, normalized);
  }
}
class Float32BufferAttribute extends BufferAttribute {
  constructor(array, itemSize, normalized) {
    super(new Float32Array(array), itemSize, normalized);
  }
}

const _vector$3 = /*@__PURE__*/new Vector3();
class InterleavedBufferAttribute {
  constructor(interleavedBuffer, itemSize, offset, normalized = false) {
    this.isInterleavedBufferAttribute = true;
    this.name = '';
    this.data = interleavedBuffer;
    this.itemSize = itemSize;
    this.offset = offset;
    this.normalized = normalized;
  }
  get count() {
    return this.data.count;
  }
  get array() {
    return this.data.array;
  }
  set needsUpdate(value) {
    this.data.needsUpdate = value;
  }
  applyMatrix4(m) {
    for (let i = 0, l = this.data.count; i < l; i++) {
      _vector$3.fromBufferAttribute(this, i);
      _vector$3.applyMatrix4(m);
      this.setXYZ(i, _vector$3.x, _vector$3.y, _vector$3.z);
    }
    return this;
  }
  applyNormalMatrix(m) {
    for (let i = 0, l = this.count; i < l; i++) {
      _vector$3.fromBufferAttribute(this, i);
      _vector$3.applyNormalMatrix(m);
      this.setXYZ(i, _vector$3.x, _vector$3.y, _vector$3.z);
    }
    return this;
  }
  transformDirection(m) {
    for (let i = 0, l = this.count; i < l; i++) {
      _vector$3.fromBufferAttribute(this, i);
      _vector$3.transformDirection(m);
      this.setXYZ(i, _vector$3.x, _vector$3.y, _vector$3.z);
    }
    return this;
  }
  getComponent(index, component) {
    let value = this.array[index * this.data.stride + this.offset + component];
    if (this.normalized) value = denormalize(value, this.array);
    return value;
  }
  setComponent(index, component, value) {
    if (this.normalized) value = normalize$1(value, this.array);
    this.data.array[index * this.data.stride + this.offset + component] = value;
    return this;
  }
  setX(index, x) {
    if (this.normalized) x = normalize$1(x, this.array);
    this.data.array[index * this.data.stride + this.offset] = x;
    return this;
  }
  setY(index, y) {
    if (this.normalized) y = normalize$1(y, this.array);
    this.data.array[index * this.data.stride + this.offset + 1] = y;
    return this;
  }
  setZ(index, z) {
    if (this.normalized) z = normalize$1(z, this.array);
    this.data.array[index * this.data.stride + this.offset + 2] = z;
    return this;
  }
  setW(index, w) {
    if (this.normalized) w = normalize$1(w, this.array);
    this.data.array[index * this.data.stride + this.offset + 3] = w;
    return this;
  }
  getX(index) {
    let x = this.data.array[index * this.data.stride + this.offset];
    if (this.normalized) x = denormalize(x, this.array);
    return x;
  }
  getY(index) {
    let y = this.data.array[index * this.data.stride + this.offset + 1];
    if (this.normalized) y = denormalize(y, this.array);
    return y;
  }
  getZ(index) {
    let z = this.data.array[index * this.data.stride + this.offset + 2];
    if (this.normalized) z = denormalize(z, this.array);
    return z;
  }
  getW(index) {
    let w = this.data.array[index * this.data.stride + this.offset + 3];
    if (this.normalized) w = denormalize(w, this.array);
    return w;
  }
  setXY(index, x, y) {
    index = index * this.data.stride + this.offset;
    if (this.normalized) {
      x = normalize$1(x, this.array);
      y = normalize$1(y, this.array);
    }
    this.data.array[index + 0] = x;
    this.data.array[index + 1] = y;
    return this;
  }
  setXYZ(index, x, y, z) {
    index = index * this.data.stride + this.offset;
    if (this.normalized) {
      x = normalize$1(x, this.array);
      y = normalize$1(y, this.array);
      z = normalize$1(z, this.array);
    }
    this.data.array[index + 0] = x;
    this.data.array[index + 1] = y;
    this.data.array[index + 2] = z;
    return this;
  }
  setXYZW(index, x, y, z, w) {
    index = index * this.data.stride + this.offset;
    if (this.normalized) {
      x = normalize$1(x, this.array);
      y = normalize$1(y, this.array);
      z = normalize$1(z, this.array);
      w = normalize$1(w, this.array);
    }
    this.data.array[index + 0] = x;
    this.data.array[index + 1] = y;
    this.data.array[index + 2] = z;
    this.data.array[index + 3] = w;
    return this;
  }
  clone(data) {
    if (data === undefined) {
      console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.');
      const array = [];
      for (let i = 0; i < this.count; i++) {
        const index = i * this.data.stride + this.offset;
        for (let j = 0; j < this.itemSize; j++) {
          array.push(this.data.array[index + j]);
        }
      }
      return new BufferAttribute(new this.array.constructor(array), this.itemSize, this.normalized);
    } else {
      if (data.interleavedBuffers === undefined) {
        data.interleavedBuffers = {};
      }
      if (data.interleavedBuffers[this.data.uuid] === undefined) {
        data.interleavedBuffers[this.data.uuid] = this.data.clone(data);
      }
      return new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);
    }
  }
  toJSON(data) {
    if (data === undefined) {
      console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.');
      const array = [];
      for (let i = 0; i < this.count; i++) {
        const index = i * this.data.stride + this.offset;
        for (let j = 0; j < this.itemSize; j++) {
          array.push(this.data.array[index + j]);
        }
      }

      // de-interleave data and save it as an ordinary buffer attribute for now

      return {
        itemSize: this.itemSize,
        type: this.array.constructor.name,
        array: array,
        normalized: this.normalized
      };
    } else {
      // save as true interleaved attribute

      if (data.interleavedBuffers === undefined) {
        data.interleavedBuffers = {};
      }
      if (data.interleavedBuffers[this.data.uuid] === undefined) {
        data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data);
      }
      return {
        isInterleavedBufferAttribute: true,
        itemSize: this.itemSize,
        data: this.data.uuid,
        offset: this.offset,
        normalized: this.normalized
      };
    }
  }
}

class InterleavedBuffer {
  constructor(array, stride) {
    this.isInterleavedBuffer = true;
    this.array = array;
    this.stride = stride;
    this.count = array !== undefined ? array.length / stride : 0;
    this.usage = StaticDrawUsage;
    this._updateRange = {
      offset: 0,
      count: -1
    };
    this.updateRanges = [];
    this.version = 0;
    this.uuid = generateUUID();
  }
  onUploadCallback() {}
  set needsUpdate(value) {
    if (value === true) this.version++;
  }
  get updateRange() {
    warnOnce('THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.'); // @deprecated, r159
    return this._updateRange;
  }
  setUsage(value) {
    this.usage = value;
    return this;
  }
  addUpdateRange(start, count) {
    this.updateRanges.push({
      start,
      count
    });
  }
  clearUpdateRanges() {
    this.updateRanges.length = 0;
  }
  copy(source) {
    this.array = new source.array.constructor(source.array);
    this.count = source.count;
    this.stride = source.stride;
    this.usage = source.usage;
    return this;
  }
  copyAt(index1, attribute, index2) {
    index1 *= this.stride;
    index2 *= attribute.stride;
    for (let i = 0, l = this.stride; i < l; i++) {
      this.array[index1 + i] = attribute.array[index2 + i];
    }
    return this;
  }
  set(value, offset = 0) {
    this.array.set(value, offset);
    return this;
  }
  clone(data) {
    if (data.arrayBuffers === undefined) {
      data.arrayBuffers = {};
    }
    if (this.array.buffer._uuid === undefined) {
      this.array.buffer._uuid = generateUUID();
    }
    if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {
      data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer;
    }
    const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]);
    const ib = new this.constructor(array, this.stride);
    ib.setUsage(this.usage);
    return ib;
  }
  onUpload(callback) {
    this.onUploadCallback = callback;
    return this;
  }
  toJSON(data) {
    if (data.arrayBuffers === undefined) {
      data.arrayBuffers = {};
    }

    // generate UUID for array buffer if necessary

    if (this.array.buffer._uuid === undefined) {
      this.array.buffer._uuid = generateUUID();
    }
    if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {
      data.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer));
    }

    //

    return {
      uuid: this.uuid,
      buffer: this.array.buffer._uuid,
      type: this.array.constructor.name,
      stride: this.stride
    };
  }
}

class BufferAttributeNode extends InputNode {
  constructor(value, bufferType = null, bufferStride = 0, bufferOffset = 0) {
    super(value, bufferType);
    this.isBufferNode = true;
    this.bufferType = bufferType;
    this.bufferStride = bufferStride;
    this.bufferOffset = bufferOffset;
    this.usage = StaticDrawUsage;
    this.instanced = false;
    this.attribute = null;
    this.global = true;
    if (value && value.isBufferAttribute === true) {
      this.attribute = value;
      this.usage = value.usage;
      this.instanced = value.isInstancedBufferAttribute;
    }
  }
  getHash(builder) {
    if (this.bufferStride === 0 && this.bufferOffset === 0) {
      let bufferData = builder.globalCache.getData(this.value);
      if (bufferData === undefined) {
        bufferData = {
          node: this
        };
        builder.globalCache.setData(this.value, bufferData);
      }
      return bufferData.node.uuid;
    }
    return this.uuid;
  }
  getNodeType(builder) {
    if (this.bufferType === null) {
      this.bufferType = builder.getTypeFromAttribute(this.attribute);
    }
    return this.bufferType;
  }
  setup(builder) {
    if (this.attribute !== null) return;
    const type = this.getNodeType(builder);
    const array = this.value;
    const itemSize = builder.getTypeLength(type);
    const stride = this.bufferStride || itemSize;
    const offset = this.bufferOffset;
    const buffer = array.isInterleavedBuffer === true ? array : new InterleavedBuffer(array, stride);
    const bufferAttribute = new InterleavedBufferAttribute(buffer, itemSize, offset);
    buffer.setUsage(this.usage);
    this.attribute = bufferAttribute;
    this.attribute.isInstancedBufferAttribute = this.instanced; // @TODO: Add a possible: InstancedInterleavedBufferAttribute
  }
  generate(builder) {
    const nodeType = this.getNodeType(builder);
    const nodeAttribute = builder.getBufferAttributeFromNode(this, nodeType);
    const propertyName = builder.getPropertyName(nodeAttribute);
    let output = null;
    if (builder.shaderStage === 'vertex' || builder.shaderStage === 'compute') {
      this.name = propertyName;
      output = propertyName;
    } else {
      const nodeVarying = varying(this);
      output = nodeVarying.build(builder, nodeType);
    }
    return output;
  }
  getInputType(/*builder*/
  ) {
    return 'bufferAttribute';
  }
  setUsage(value) {
    this.usage = value;
    if (this.attribute && this.attribute.isBufferAttribute === true) {
      this.attribute.usage = value;
    }
    return this;
  }
  setInstanced(value) {
    this.instanced = value;
    return this;
  }
}
BufferAttributeNode.type = /*@__PURE__*/registerNode('BufferAttribute', BufferAttributeNode);
const bufferAttribute = (array, type, stride, offset) => nodeObject(new BufferAttributeNode(array, type, stride, offset));
const dynamicBufferAttribute = (array, type, stride, offset) => bufferAttribute(array, type, stride, offset).setUsage(DynamicDrawUsage);
const instancedBufferAttribute = (array, type, stride, offset) => bufferAttribute(array, type, stride, offset).setInstanced(true);
const instancedDynamicBufferAttribute = (array, type, stride, offset) => dynamicBufferAttribute(array, type, stride, offset).setInstanced(true);
addMethodChaining('toAttribute', bufferNode => bufferAttribute(bufferNode.value));

class ComputeNode extends Node$1 {
  constructor(computeNode, count, workgroupSize = [64]) {
    super('void');
    this.isComputeNode = true;
    this.computeNode = computeNode;
    this.count = count;
    this.workgroupSize = workgroupSize;
    this.dispatchCount = 0;
    this.version = 1;
    this.updateBeforeType = NodeUpdateType.OBJECT;
    this.updateDispatchCount();
  }
  dispose() {
    this.dispatchEvent({
      type: 'dispose'
    });
  }
  set needsUpdate(value) {
    if (value === true) this.version++;
  }
  updateDispatchCount() {
    const {
      count,
      workgroupSize
    } = this;
    let size = workgroupSize[0];
    for (let i = 1; i < workgroupSize.length; i++) size *= workgroupSize[i];
    this.dispatchCount = Math.ceil(count / size);
  }
  onInit() {}
  updateBefore({
    renderer
  }) {
    renderer.compute(this);
  }
  generate(builder) {
    const {
      shaderStage
    } = builder;
    if (shaderStage === 'compute') {
      const snippet = this.computeNode.build(builder, 'void');
      if (snippet !== '') {
        builder.addLineFlowCode(snippet);
      }
    }
  }
}
ComputeNode.type = /*@__PURE__*/registerNode('Compute', ComputeNode);
const compute = (node, count, workgroupSize) => nodeObject(new ComputeNode(nodeObject(node), count, workgroupSize));
addMethodChaining('compute', compute);

class CacheNode extends Node$1 {
  constructor(node, parent = true) {
    super();
    this.node = node;
    this.parent = parent;
    this.isCacheNode = true;
  }
  getNodeType(builder) {
    return this.node.getNodeType(builder);
  }
  build(builder, ...params) {
    const previousCache = builder.getCache();
    const cache = builder.getCacheFromNode(this, parent);
    builder.setCache(cache);
    const data = this.node.build(builder, ...params);
    builder.setCache(previousCache);
    return data;
  }
}
CacheNode.type = /*@__PURE__*/registerNode('Cache', CacheNode);
const cache = (node, ...params) => nodeObject(new CacheNode(nodeObject(node), ...params));
addMethodChaining('cache', cache);

class BypassNode extends Node$1 {
  constructor(returnNode, callNode) {
    super();
    this.isBypassNode = true;
    this.outputNode = returnNode;
    this.callNode = callNode;
  }
  getNodeType(builder) {
    return this.outputNode.getNodeType(builder);
  }
  generate(builder) {
    const snippet = this.callNode.build(builder, 'void');
    if (snippet !== '') {
      builder.addLineFlowCode(snippet);
    }
    return this.outputNode.build(builder);
  }
}
BypassNode.type = /*@__PURE__*/registerNode('Bypass', BypassNode);
const bypass = /*@__PURE__*/nodeProxy(BypassNode);
addMethodChaining('bypass', bypass);

class RemapNode extends Node$1 {
  constructor(node, inLowNode, inHighNode, outLowNode = float(0), outHighNode = float(1)) {
    super();
    this.node = node;
    this.inLowNode = inLowNode;
    this.inHighNode = inHighNode;
    this.outLowNode = outLowNode;
    this.outHighNode = outHighNode;
    this.doClamp = true;
  }
  setup() {
    const {
      node,
      inLowNode,
      inHighNode,
      outLowNode,
      outHighNode,
      doClamp
    } = this;
    let t = node.sub(inLowNode).div(inHighNode.sub(inLowNode));
    if (doClamp === true) t = t.clamp();
    return t.mul(outHighNode.sub(outLowNode)).add(outLowNode);
  }
}
RemapNode.type = /*@__PURE__*/registerNode('Remap', RemapNode);
const remap = /*@__PURE__*/nodeProxy(RemapNode, null, null, {
  doClamp: false
});
const remapClamp = /*@__PURE__*/nodeProxy(RemapNode);
addMethodChaining('remap', remap);
addMethodChaining('remapClamp', remapClamp);

class ExpressionNode extends Node$1 {
  constructor(snippet = '', nodeType = 'void') {
    super(nodeType);
    this.snippet = snippet;
  }
  generate(builder, output) {
    const type = this.getNodeType(builder);
    const snippet = this.snippet;
    if (type === 'void') {
      builder.addLineFlowCode(snippet);
    } else {
      return builder.format(`( ${snippet} )`, type, output);
    }
  }
}
ExpressionNode.type = /*@__PURE__*/registerNode('Expression', ExpressionNode);
const expression = /*@__PURE__*/nodeProxy(ExpressionNode);

const Discard = conditional => (conditional ? select(conditional, expression('discard')) : expression('discard')).append();
addMethodChaining('discard', Discard);

class RenderOutputNode extends TempNode {
  constructor(colorNode, toneMapping, outputColorSpace) {
    super('vec4');
    this.colorNode = colorNode;
    this.toneMapping = toneMapping;
    this.outputColorSpace = outputColorSpace;
    this.isRenderOutput = true;
  }
  setup({
    context
  }) {
    let outputNode = this.colorNode || context.color;

    // tone mapping

    const toneMapping = (this.toneMapping !== null ? this.toneMapping : context.toneMapping) || NoToneMapping;
    const outputColorSpace = (this.outputColorSpace !== null ? this.outputColorSpace : context.outputColorSpace) || LinearSRGBColorSpace;
    if (toneMapping !== NoToneMapping) {
      outputNode = outputNode.toneMapping(toneMapping);
    }

    // output color space

    if (outputColorSpace === SRGBColorSpace) {
      outputNode = outputNode.toOutputColorSpace(outputColorSpace);
    }
    return outputNode;
  }
}
RenderOutputNode.type = /*@__PURE__*/registerNode('RenderOutput', RenderOutputNode);
const renderOutput = (color, toneMapping = null, outputColorSpace = null) => nodeObject(new RenderOutputNode(nodeObject(color), toneMapping, outputColorSpace));
addMethodChaining('renderOutput', renderOutput);

class AttributeNode extends Node$1 {
  constructor(attributeName, nodeType = null) {
    super(nodeType);
    this.global = true;
    this._attributeName = attributeName;
  }
  getHash(builder) {
    return this.getAttributeName(builder);
  }
  getNodeType(builder) {
    let nodeType = this.nodeType;
    if (nodeType === null) {
      const attributeName = this.getAttributeName(builder);
      if (builder.hasGeometryAttribute(attributeName)) {
        const attribute = builder.geometry.getAttribute(attributeName);
        nodeType = builder.getTypeFromAttribute(attribute);
      } else {
        nodeType = 'float';
      }
    }
    return nodeType;
  }
  setAttributeName(attributeName) {
    this._attributeName = attributeName;
    return this;
  }
  getAttributeName(/*builder*/
  ) {
    return this._attributeName;
  }
  generate(builder) {
    const attributeName = this.getAttributeName(builder);
    const nodeType = this.getNodeType(builder);
    const geometryAttribute = builder.hasGeometryAttribute(attributeName);
    if (geometryAttribute === true) {
      const attribute = builder.geometry.getAttribute(attributeName);
      const attributeType = builder.getTypeFromAttribute(attribute);
      const nodeAttribute = builder.getAttribute(attributeName, attributeType);
      if (builder.shaderStage === 'vertex') {
        return builder.format(nodeAttribute.name, attributeType, nodeType);
      } else {
        const nodeVarying = varying(this);
        return nodeVarying.build(builder, nodeType);
      }
    } else {
      console.warn(`AttributeNode: Vertex attribute "${attributeName}" not found on geometry.`);
      return builder.generateConst(nodeType);
    }
  }
  serialize(data) {
    super.serialize(data);
    data.global = this.global;
    data._attributeName = this._attributeName;
  }
  deserialize(data) {
    super.deserialize(data);
    this.global = data.global;
    this._attributeName = data._attributeName;
  }
}
AttributeNode.type = /*@__PURE__*/registerNode('Attribute', AttributeNode);
const attribute = (name, nodeType) => nodeObject(new AttributeNode(name, nodeType));

class IndexNode extends Node$1 {
  constructor(scope) {
    super('uint');
    this.scope = scope;
    this.isInstanceIndexNode = true;
  }
  generate(builder) {
    const nodeType = this.getNodeType(builder);
    const scope = this.scope;
    let propertyName;
    if (scope === IndexNode.VERTEX) {
      propertyName = builder.getVertexIndex();
    } else if (scope === IndexNode.INSTANCE) {
      propertyName = builder.getInstanceIndex();
    } else if (scope === IndexNode.DRAW) {
      propertyName = builder.getDrawIndex();
    } else if (scope === IndexNode.INVOCATION_LOCAL) {
      propertyName = builder.getInvocationLocalIndex();
    } else {
      throw new Error('THREE.IndexNode: Unknown scope: ' + scope);
    }
    let output;
    if (builder.shaderStage === 'vertex' || builder.shaderStage === 'compute') {
      output = propertyName;
    } else {
      const nodeVarying = varying(this);
      output = nodeVarying.build(builder, nodeType);
    }
    return output;
  }
}
IndexNode.VERTEX = 'vertex';
IndexNode.INSTANCE = 'instance';
IndexNode.INVOCATION_LOCAL = 'invocationLocal';
IndexNode.DRAW = 'draw';
IndexNode.type = /*@__PURE__*/registerNode('Index', IndexNode);
const vertexIndex = /*@__PURE__*/nodeImmutable(IndexNode, IndexNode.VERTEX);
const instanceIndex = /*@__PURE__*/nodeImmutable(IndexNode, IndexNode.INSTANCE);
/*@__PURE__*/nodeImmutable(IndexNode, IndexNode.INVOCATION_LOCAL);
const drawIndex = /*@__PURE__*/nodeImmutable(IndexNode, IndexNode.DRAW);

class ParameterNode extends PropertyNode {
  constructor(nodeType, name = null) {
    super(nodeType, name);
    this.isParameterNode = true;
  }
  getHash() {
    return this.uuid;
  }
  generate() {
    return this.name;
  }
}
ParameterNode.type = /*@__PURE__*/registerNode('Parameter', ParameterNode);

class StackNode extends Node$1 {
  constructor(parent = null) {
    super();
    this.nodes = [];
    this.outputNode = null;
    this.parent = parent;
    this._currentCond = null;
    this.isStackNode = true;
  }
  getNodeType(builder) {
    return this.outputNode ? this.outputNode.getNodeType(builder) : 'void';
  }
  add(node) {
    this.nodes.push(node);
    return this;
  }
  If(boolNode, method) {
    const methodNode = new ShaderNode(method);
    this._currentCond = select(boolNode, methodNode);
    return this.add(this._currentCond);
  }
  ElseIf(boolNode, method) {
    const methodNode = new ShaderNode(method);
    const ifNode = select(boolNode, methodNode);
    this._currentCond.elseNode = ifNode;
    this._currentCond = ifNode;
    return this;
  }
  Else(method) {
    this._currentCond.elseNode = new ShaderNode(method);
    return this;
  }
  build(builder, ...params) {
    const previousStack = getCurrentStack();
    setCurrentStack(this);
    for (const node of this.nodes) {
      node.build(builder, 'void');
    }
    setCurrentStack(previousStack);
    return this.outputNode ? this.outputNode.build(builder, ...params) : super.build(builder, ...params);
  }

  //

  else(...params) {
    // @deprecated, r168

    console.warn('TSL.StackNode: .else() has been renamed to .Else().');
    return this.Else(...params);
  }
  elseif(...params) {
    // @deprecated, r168

    console.warn('TSL.StackNode: .elseif() has been renamed to .ElseIf().');
    return this.ElseIf(...params);
  }
}
StackNode.type = /*@__PURE__*/registerNode('Stack', StackNode);

class StructTypeNode extends Node$1 {
  constructor(types) {
    super();
    this.types = types;
    this.isStructTypeNode = true;
  }
  getMemberTypes() {
    return this.types;
  }
}
StructTypeNode.type = /*@__PURE__*/registerNode('StructType', StructTypeNode);

class OutputStructNode extends Node$1 {
  constructor(...members) {
    super();
    this.members = members;
    this.isOutputStructNode = true;
  }
  setup(builder) {
    super.setup(builder);
    const members = this.members;
    const types = [];
    for (let i = 0; i < members.length; i++) {
      types.push(members[i].getNodeType(builder));
    }
    this.nodeType = builder.getStructTypeFromNode(new StructTypeNode(types)).name;
  }
  generate(builder, output) {
    const propertyName = builder.getOutputStructName();
    const members = this.members;
    const structPrefix = propertyName !== '' ? propertyName + '.' : '';
    for (let i = 0; i < members.length; i++) {
      const snippet = members[i].build(builder, output);
      builder.addLineFlowCode(`${structPrefix}m${i} = ${snippet}`);
    }
    return propertyName;
  }
}
OutputStructNode.type = /*@__PURE__*/registerNode('OutputStruct', OutputStructNode);

function getTextureIndex(textures, name) {
  for (let i = 0; i < textures.length; i++) {
    if (textures[i].name === name) {
      return i;
    }
  }
  return -1;
}
class MRTNode extends OutputStructNode {
  constructor(outputNodes) {
    super();
    this.outputNodes = outputNodes;
    this.isMRTNode = true;
  }
  has(name) {
    return this.outputNodes[name] !== undefined;
  }
  get(name) {
    return this.outputNodes[name];
  }
  merge(mrtNode) {
    const outputs = {
      ...this.outputNodes,
      ...mrtNode.outputNodes
    };
    return mrt(outputs);
  }
  setup(builder) {
    const outputNodes = this.outputNodes;
    const mrt = builder.renderer.getRenderTarget();
    const members = [];
    const textures = mrt.textures;
    for (const name in outputNodes) {
      const index = getTextureIndex(textures, name);
      members[index] = vec4(outputNodes[name]);
    }
    this.members = members;
    return super.setup(builder);
  }
}
MRTNode.type = /*@__PURE__*/registerNode('MRT', MRTNode);
const mrt = /*@__PURE__*/nodeProxy(MRTNode);

class LoopNode extends Node$1 {
  constructor(params = []) {
    super();
    this.params = params;
  }
  getVarName(index) {
    return String.fromCharCode('i'.charCodeAt() + index);
  }
  getProperties(builder) {
    const properties = builder.getNodeProperties(this);
    if (properties.stackNode !== undefined) return properties;

    //

    const inputs = {};
    for (let i = 0, l = this.params.length - 1; i < l; i++) {
      const param = this.params[i];
      const name = param.isNode !== true && param.name || this.getVarName(i);
      const type = param.isNode !== true && param.type || 'int';
      inputs[name] = expression(name, type);
    }
    const stack = builder.addStack(); // TODO: cache() it

    properties.returnsNode = this.params[this.params.length - 1](inputs, stack, builder);
    properties.stackNode = stack;
    builder.removeStack();
    return properties;
  }
  getNodeType(builder) {
    const {
      returnsNode
    } = this.getProperties(builder);
    return returnsNode ? returnsNode.getNodeType(builder) : 'void';
  }
  setup(builder) {
    // setup properties

    this.getProperties(builder);
  }
  generate(builder) {
    const properties = this.getProperties(builder);
    const params = this.params;
    const stackNode = properties.stackNode;
    for (let i = 0, l = params.length - 1; i < l; i++) {
      const param = params[i];
      let start = null,
        end = null,
        name = null,
        type = null,
        condition = null,
        update = null;
      if (param.isNode) {
        type = 'int';
        name = this.getVarName(i);
        start = '0';
        end = param.build(builder, type);
        condition = '<';
      } else {
        type = param.type || 'int';
        name = param.name || this.getVarName(i);
        start = param.start;
        end = param.end;
        condition = param.condition;
        update = param.update;
        if (typeof start === 'number') start = start.toString();else if (start && start.isNode) start = start.build(builder, type);
        if (typeof end === 'number') end = end.toString();else if (end && end.isNode) end = end.build(builder, type);
        if (start !== undefined && end === undefined) {
          start = start + ' - 1';
          end = '0';
          condition = '>=';
        } else if (end !== undefined && start === undefined) {
          start = '0';
          condition = '<';
        }
        if (condition === undefined) {
          if (Number(start) > Number(end)) {
            condition = '>=';
          } else {
            condition = '<';
          }
        }
      }
      const internalParam = {
        start,
        end,
        condition
      };

      //

      const startSnippet = internalParam.start;
      const endSnippet = internalParam.end;
      let declarationSnippet = '';
      let conditionalSnippet = '';
      let updateSnippet = '';
      if (!update) {
        if (type === 'int' || type === 'uint') {
          if (condition.includes('<')) update = '++';else update = '--';
        } else {
          if (condition.includes('<')) update = '+= 1.';else update = '-= 1.';
        }
      }
      declarationSnippet += builder.getVar(type, name) + ' = ' + startSnippet;
      conditionalSnippet += name + ' ' + condition + ' ' + endSnippet;
      updateSnippet += name + ' ' + update;
      const forSnippet = `for ( ${declarationSnippet}; ${conditionalSnippet}; ${updateSnippet} )`;
      builder.addFlowCode((i === 0 ? '\n' : '') + builder.tab + forSnippet + ' {\n\n').addFlowTab();
    }
    const stackSnippet = stackNode.build(builder, 'void');
    const returnsSnippet = properties.returnsNode ? properties.returnsNode.build(builder) : '';
    builder.removeFlowTab().addFlowCode('\n' + builder.tab + stackSnippet);
    for (let i = 0, l = this.params.length - 1; i < l; i++) {
      builder.addFlowCode((i === 0 ? '' : builder.tab) + '}\n\n').removeFlowTab();
    }
    builder.addFlowTab();
    return returnsSnippet;
  }
}
LoopNode.type = /*@__PURE__*/registerNode('Loop', LoopNode);
const Loop = (...params) => nodeObject(new LoopNode(nodeArray(params, 'int'))).append();
const Break = () => expression('break').append();

class Object3DNode extends Node$1 {
  constructor(scope = Object3DNode.VIEW_MATRIX, object3d = null) {
    super();
    this.scope = scope;
    this.object3d = object3d;
    this.updateType = NodeUpdateType.OBJECT;
    this._uniformNode = new UniformNode(null);
  }
  getNodeType() {
    const scope = this.scope;
    if (scope === Object3DNode.WORLD_MATRIX || scope === Object3DNode.VIEW_MATRIX) {
      return 'mat4';
    } else if (scope === Object3DNode.NORMAL_MATRIX) {
      return 'mat3';
    } else if (scope === Object3DNode.POSITION || scope === Object3DNode.VIEW_POSITION || scope === Object3DNode.DIRECTION || scope === Object3DNode.SCALE) {
      return 'vec3';
    }
  }
  update(frame) {
    const object = this.object3d;
    const uniformNode = this._uniformNode;
    const scope = this.scope;
    if (scope === Object3DNode.VIEW_MATRIX) {
      uniformNode.value = object.modelViewMatrix;
    } else if (scope === Object3DNode.NORMAL_MATRIX) {
      uniformNode.value = object.normalMatrix;
    } else if (scope === Object3DNode.WORLD_MATRIX) {
      uniformNode.value = object.matrixWorld;
    } else if (scope === Object3DNode.POSITION) {
      uniformNode.value = uniformNode.value || new Vector3();
      uniformNode.value.setFromMatrixPosition(object.matrixWorld);
    } else if (scope === Object3DNode.SCALE) {
      uniformNode.value = uniformNode.value || new Vector3();
      uniformNode.value.setFromMatrixScale(object.matrixWorld);
    } else if (scope === Object3DNode.DIRECTION) {
      uniformNode.value = uniformNode.value || new Vector3();
      object.getWorldDirection(uniformNode.value);
    } else if (scope === Object3DNode.VIEW_POSITION) {
      const camera = frame.camera;
      uniformNode.value = uniformNode.value || new Vector3();
      uniformNode.value.setFromMatrixPosition(object.matrixWorld);
      uniformNode.value.applyMatrix4(camera.matrixWorldInverse);
    }
  }
  generate(builder) {
    const scope = this.scope;
    if (scope === Object3DNode.WORLD_MATRIX || scope === Object3DNode.VIEW_MATRIX) {
      this._uniformNode.nodeType = 'mat4';
    } else if (scope === Object3DNode.NORMAL_MATRIX) {
      this._uniformNode.nodeType = 'mat3';
    } else if (scope === Object3DNode.POSITION || scope === Object3DNode.VIEW_POSITION || scope === Object3DNode.DIRECTION || scope === Object3DNode.SCALE) {
      this._uniformNode.nodeType = 'vec3';
    }
    return this._uniformNode.build(builder);
  }
  serialize(data) {
    super.serialize(data);
    data.scope = this.scope;
  }
  deserialize(data) {
    super.deserialize(data);
    this.scope = data.scope;
  }
}
Object3DNode.VIEW_MATRIX = 'viewMatrix';
Object3DNode.NORMAL_MATRIX = 'normalMatrix';
Object3DNode.WORLD_MATRIX = 'worldMatrix';
Object3DNode.POSITION = 'position';
Object3DNode.SCALE = 'scale';
Object3DNode.VIEW_POSITION = 'viewPosition';
Object3DNode.DIRECTION = 'direction';
Object3DNode.type = /*@__PURE__*/registerNode('Object3D', Object3DNode);
/*@__PURE__*/nodeProxy(Object3DNode, Object3DNode.DIRECTION);
/*@__PURE__*/nodeProxy(Object3DNode, Object3DNode.VIEW_MATRIX);
/*@__PURE__*/nodeProxy(Object3DNode, Object3DNode.NORMAL_MATRIX);
/*@__PURE__*/nodeProxy(Object3DNode, Object3DNode.WORLD_MATRIX);
const objectPosition = /*@__PURE__*/nodeProxy(Object3DNode, Object3DNode.POSITION);
/*@__PURE__*/nodeProxy(Object3DNode, Object3DNode.SCALE);
/*@__PURE__*/nodeProxy(Object3DNode, Object3DNode.VIEW_POSITION);

class ModelNode extends Object3DNode {
  constructor(scope = ModelNode.VIEW_MATRIX) {
    super(scope);
  }
  update(frame) {
    this.object3d = frame.object;
    super.update(frame);
  }
}
ModelNode.type = /*@__PURE__*/registerNode('Model', ModelNode);
/*@__PURE__*/nodeImmutable(ModelNode, ModelNode.DIRECTION);
const modelViewMatrix = /*@__PURE__*/nodeImmutable(ModelNode, ModelNode.VIEW_MATRIX).label('modelViewMatrix').toVar('ModelViewMatrix');
const modelNormalMatrix = /*@__PURE__*/nodeImmutable(ModelNode, ModelNode.NORMAL_MATRIX);
const modelWorldMatrix = /*@__PURE__*/nodeImmutable(ModelNode, ModelNode.WORLD_MATRIX);
/*@__PURE__*/nodeImmutable(ModelNode, ModelNode.POSITION);
/*@__PURE__*/nodeImmutable(ModelNode, ModelNode.SCALE);
/*@__PURE__*/nodeImmutable(ModelNode, ModelNode.VIEW_POSITION);

const positionGeometry = /*@__PURE__*/attribute('position', 'vec3');
const positionLocal = /*@__PURE__*/positionGeometry.varying('positionLocal');
const positionPrevious = /*@__PURE__*/positionGeometry.varying('positionPrevious');
const positionWorldDirection = /*@__PURE__*/positionLocal.transformDirection(modelWorldMatrix).varying('v_positionWorldDirection').normalize().toVar('positionWorldDirection');
const positionView = /*@__PURE__*/modelViewMatrix.mul(positionLocal).xyz.varying('v_positionView');
const positionViewDirection = /*@__PURE__*/positionView.negate().varying('v_positionViewDirection').normalize().toVar('positionViewDirection');

class EquirectUVNode extends TempNode {
  constructor(dirNode = positionWorldDirection) {
    super('vec2');
    this.dirNode = dirNode;
  }
  setup() {
    const dir = this.dirNode;
    const u = dir.z.atan2(dir.x).mul(1 / (Math.PI * 2)).add(0.5);
    const v = dir.y.clamp(-1.0, 1.0).asin().mul(1 / Math.PI).add(0.5);
    return vec2(u, v);
  }
}
EquirectUVNode.type = /*@__PURE__*/registerNode('EquirectUV', EquirectUVNode);

class FunctionOverloadingNode extends Node$1 {
  constructor(functionNodes = [], ...parametersNodes) {
    super();
    this.functionNodes = functionNodes;
    this.parametersNodes = parametersNodes;
    this._candidateFnCall = null;
    this.global = true;
  }
  getNodeType() {
    return this.functionNodes[0].shaderNode.layout.type;
  }
  setup(builder) {
    const params = this.parametersNodes;
    let candidateFnCall = this._candidateFnCall;
    if (candidateFnCall === null) {
      let candidateFn = null;
      let candidateScore = -1;
      for (const functionNode of this.functionNodes) {
        const shaderNode = functionNode.shaderNode;
        const layout = shaderNode.layout;
        if (layout === null) {
          throw new Error('FunctionOverloadingNode: FunctionNode must be a layout.');
        }
        const inputs = layout.inputs;
        if (params.length === inputs.length) {
          let score = 0;
          for (let i = 0; i < params.length; i++) {
            const param = params[i];
            const input = inputs[i];
            if (param.getNodeType(builder) === input.type) {
              score++;
            } else {
              score = 0;
            }
          }
          if (score > candidateScore) {
            candidateFn = functionNode;
            candidateScore = score;
          }
        }
      }
      this._candidateFnCall = candidateFnCall = candidateFn(...params);
    }
    return candidateFnCall;
  }
}
FunctionOverloadingNode.type = /*@__PURE__*/registerNode('FunctionOverloading', FunctionOverloadingNode);

const cameraGroup = /*@__PURE__*/sharedUniformGroup('camera').onRenderUpdate(() => {
  cameraGroup.needsUpdate = true;
});
const cameraNear = /*@__PURE__*/uniform('float').label('cameraNear').setGroup(cameraGroup).onRenderUpdate(({
  camera
}) => camera.near);
const cameraFar = /*@__PURE__*/uniform('float').label('cameraFar').setGroup(cameraGroup).onRenderUpdate(({
  camera
}) => camera.far);
const cameraLogDepth = /*@__PURE__*/uniform('float').label('cameraLogDepth').setGroup(cameraGroup).onRenderUpdate(({
  camera
}) => 2.0 / (Math.log(camera.far + 1.0) / Math.LN2));
const cameraProjectionMatrix = /*@__PURE__*/uniform('mat4').label('cameraProjectionMatrix').setGroup(cameraGroup).onRenderUpdate(({
  camera
}) => camera.projectionMatrix);
const cameraViewMatrix = /*@__PURE__*/uniform('mat4').label('cameraViewMatrix').setGroup(cameraGroup).onRenderUpdate(({
  camera
}) => camera.matrixWorldInverse);

class FrontFacingNode extends Node$1 {
  constructor() {
    super('bool');
    this.isFrontFacingNode = true;
  }
  generate(builder) {
    const {
      renderer,
      material
    } = builder;
    if (renderer.coordinateSystem === WebGLCoordinateSystem) {
      if (material.side === BackSide) {
        return 'false';
      }
    }
    return builder.getFrontFacing();
  }
}
FrontFacingNode.type = /*@__PURE__*/registerNode('FrontFacing', FrontFacingNode);
const frontFacing = /*@__PURE__*/nodeImmutable(FrontFacingNode);
const faceDirection = /*@__PURE__*/float(frontFacing).mul(2.0).sub(1.0);

const normalGeometry = /*@__PURE__*/attribute('normal', 'vec3');
const normalLocal = /*@__PURE__*/Fn(builder => {
  if (builder.geometry.hasAttribute('normal') === false) {
    console.warn('TSL.NormalNode: Vertex attribute "normal" not found on geometry.');
    return vec3(0, 1, 0);
  }
  return normalGeometry;
}, 'vec3').once()().toVar('normalLocal');
const normalFlat = /*@__PURE__*/positionView.dFdx().cross(positionView.dFdy()).normalize().toVar('normalFlat');
let normalViewVarying = null;
const normalView = /*@__PURE__*/Fn(builder => {
  let node;
  if (builder.material.flatShading === true) {
    node = normalFlat;
  } else {
    node = normalViewVarying || (normalViewVarying = varying(modelNormalMatrix.mul(normalLocal), 'v_normalView').normalize());
  }
  return node;
}, 'vec3').once()().toVar('normalView');
const normalWorld = /*@__PURE__*/varying(normalView.transformDirection(cameraViewMatrix), 'v_normalWorld').normalize().toVar('normalWorld');
const transformedNormalView = /*@__PURE__*/Fn(builder => {
  return builder.context.setupNormal();
}, 'vec3').once()().mul(faceDirection).toVar('transformedNormalView');

class MatcapUVNode extends TempNode {
  constructor() {
    super('vec2');
  }
  setup() {
    const x = vec3(positionViewDirection.z, 0, positionViewDirection.x.negate()).normalize();
    const y = positionViewDirection.cross(x);
    return vec2(x.dot(transformedNormalView), y.dot(transformedNormalView)).mul(0.495).add(0.5); // 0.495 to remove artifacts caused by undersized matcap disks
  }
}
MatcapUVNode.type = /*@__PURE__*/registerNode('MatcapUV', MatcapUVNode);

class MaxMipLevelNode extends UniformNode {
  constructor(textureNode) {
    super(0);
    this._textureNode = textureNode;
    this.updateType = NodeUpdateType.FRAME;
  }
  get textureNode() {
    return this._textureNode;
  }
  get texture() {
    return this._textureNode.value;
  }
  update() {
    const texture = this.texture;
    const images = texture.images;
    const image = images && images.length > 0 ? images[0] && images[0].image || images[0] : texture.image;
    if (image && image.width !== undefined) {
      const {
        width,
        height
      } = image;
      this.value = Math.log2(Math.max(width, height));
    }
  }
}
MaxMipLevelNode.type = /*@__PURE__*/registerNode('MaxMipLevel', MaxMipLevelNode);
const maxMipLevel = /*@__PURE__*/nodeProxy(MaxMipLevelNode);

class TimerNode extends UniformNode {
  constructor(scope = TimerNode.LOCAL, scale = 1, value = 0) {
    super(value);
    this.scope = scope;
    this.scale = scale;
    this.updateType = NodeUpdateType.FRAME;
  }
  /*
  @TODO:
  getNodeType( builder ) {
  		const scope = this.scope;
  		if ( scope === TimerNode.FRAME ) {
  			return 'uint';
  		}
  		return 'float';
  	}
  */
  update(frame) {
    const scope = this.scope;
    const scale = this.scale;
    if (scope === TimerNode.LOCAL) {
      this.value += frame.deltaTime * scale;
    } else if (scope === TimerNode.DELTA) {
      this.value = frame.deltaTime * scale;
    } else if (scope === TimerNode.FRAME) {
      this.value = frame.frameId;
    } else {
      // global

      this.value = frame.time * scale;
    }
  }
  serialize(data) {
    super.serialize(data);
    data.scope = this.scope;
    data.scale = this.scale;
  }
  deserialize(data) {
    super.deserialize(data);
    this.scope = data.scope;
    this.scale = data.scale;
  }
}
TimerNode.LOCAL = 'local';
TimerNode.GLOBAL = 'global';
TimerNode.DELTA = 'delta';
TimerNode.FRAME = 'frame';
TimerNode.type = /*@__PURE__*/registerNode('Timer', TimerNode);

// @TODO: add support to use node in timeScale
const timerLocal = (timeScale, value = 0) => nodeObject(new TimerNode(TimerNode.LOCAL, timeScale, value));

class OscNode extends Node$1 {
  constructor(method = OscNode.SINE, timeNode = timerLocal()) {
    super();
    this.method = method;
    this.timeNode = timeNode;
  }
  getNodeType(builder) {
    return this.timeNode.getNodeType(builder);
  }
  setup() {
    const method = this.method;
    const timeNode = nodeObject(this.timeNode);
    let outputNode = null;
    if (method === OscNode.SINE) {
      outputNode = timeNode.add(0.75).mul(Math.PI * 2).sin().mul(0.5).add(0.5);
    } else if (method === OscNode.SQUARE) {
      outputNode = timeNode.fract().round();
    } else if (method === OscNode.TRIANGLE) {
      outputNode = timeNode.add(0.5).fract().mul(2).sub(1).abs();
    } else if (method === OscNode.SAWTOOTH) {
      outputNode = timeNode.fract();
    }
    return outputNode;
  }
  serialize(data) {
    super.serialize(data);
    data.method = this.method;
  }
  deserialize(data) {
    super.deserialize(data);
    this.method = data.method;
  }
}
OscNode.SINE = 'sine';
OscNode.SQUARE = 'square';
OscNode.TRIANGLE = 'triangle';
OscNode.SAWTOOTH = 'sawtooth';
OscNode.type = /*@__PURE__*/registerNode('Osc', OscNode);
/*@__PURE__*/nodeProxy(OscNode, OscNode.SINE);
/*@__PURE__*/nodeProxy(OscNode, OscNode.SQUARE);
/*@__PURE__*/nodeProxy(OscNode, OscNode.TRIANGLE);
/*@__PURE__*/nodeProxy(OscNode, OscNode.SAWTOOTH);

class RotateNode extends TempNode {
  constructor(positionNode, rotationNode) {
    super();
    this.positionNode = positionNode;
    this.rotationNode = rotationNode;
  }
  getNodeType(builder) {
    return this.positionNode.getNodeType(builder);
  }
  setup(builder) {
    const {
      rotationNode,
      positionNode
    } = this;
    const nodeType = this.getNodeType(builder);
    if (nodeType === 'vec2') {
      const cosAngle = rotationNode.cos();
      const sinAngle = rotationNode.sin();
      const rotationMatrix = mat2(cosAngle, sinAngle, sinAngle.negate(), cosAngle);
      return rotationMatrix.mul(positionNode);
    } else {
      const rotation = rotationNode;
      const rotationXMatrix = mat4(vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, cos(rotation.x), sin(rotation.x).negate(), 0.0), vec4(0.0, sin(rotation.x), cos(rotation.x), 0.0), vec4(0.0, 0.0, 0.0, 1.0));
      const rotationYMatrix = mat4(vec4(cos(rotation.y), 0.0, sin(rotation.y), 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(sin(rotation.y).negate(), 0.0, cos(rotation.y), 0.0), vec4(0.0, 0.0, 0.0, 1.0));
      const rotationZMatrix = mat4(vec4(cos(rotation.z), sin(rotation.z).negate(), 0.0, 0.0), vec4(sin(rotation.z), cos(rotation.z), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0));
      return rotationXMatrix.mul(rotationYMatrix).mul(rotationZMatrix).mul(vec4(positionNode, 1.0)).xyz;
    }
  }
}
RotateNode.type = /*@__PURE__*/registerNode('Rotate', RotateNode);

let resolution, viewportResult;
class ViewportNode extends Node$1 {
  constructor(scope) {
    super();
    this.scope = scope;
    this.isViewportNode = true;
  }
  getNodeType() {
    if (this.scope === ViewportNode.VIEWPORT) return 'vec4';else return 'vec2';
  }
  getUpdateType() {
    let updateType = NodeUpdateType.NONE;
    if (this.scope === ViewportNode.RESOLUTION || this.scope === ViewportNode.VIEWPORT) {
      updateType = NodeUpdateType.RENDER;
    }
    this.updateType = updateType;
    return updateType;
  }
  update({
    renderer
  }) {
    if (this.scope === ViewportNode.VIEWPORT) {
      renderer.getViewport(viewportResult);
    } else {
      renderer.getDrawingBufferSize(resolution);
    }
  }
  setup(/*builder*/
  ) {
    const scope = this.scope;
    let output = null;
    if (scope === ViewportNode.RESOLUTION) {
      output = uniform(resolution || (resolution = new Vector2()));
    } else if (scope === ViewportNode.VIEWPORT) {
      output = uniform(viewportResult || (viewportResult = new Vector4()));
    } else {
      output = vec2(viewportCoordinate.div(viewportResolution));
    }
    return output;
  }
  generate(builder) {
    if (this.scope === ViewportNode.COORDINATE) {
      let coord = builder.getFragCoord();
      if (builder.isFlipY()) {
        // follow webgpu standards

        const resolution = builder.getNodeProperties(viewportResolution).outputNode.build(builder);
        coord = `${builder.getType('vec2')}( ${coord}.x, ${resolution}.y - ${coord}.y )`;
      }
      return coord;
    }
    return super.generate(builder);
  }
}
ViewportNode.COORDINATE = 'coordinate';
ViewportNode.RESOLUTION = 'resolution';
ViewportNode.VIEWPORT = 'viewport';
ViewportNode.UV = 'uv';
ViewportNode.type = /*@__PURE__*/registerNode('Viewport', ViewportNode);
const viewportCoordinate = /*@__PURE__*/nodeImmutable(ViewportNode, ViewportNode.COORDINATE);
const viewportResolution = /*@__PURE__*/nodeImmutable(ViewportNode, ViewportNode.RESOLUTION);
/*@__PURE__*/nodeImmutable(ViewportNode, ViewportNode.VIEWPORT);
const viewportUV = /*@__PURE__*/nodeImmutable(ViewportNode, ViewportNode.UV);

const uv = index => attribute('uv' + (index > 0 ? index : ''), 'vec2');

class TextureSizeNode extends Node$1 {
  constructor(textureNode, levelNode = null) {
    super('uvec2');
    this.isTextureSizeNode = true;
    this.textureNode = textureNode;
    this.levelNode = levelNode;
  }
  generate(builder, output) {
    const textureProperty = this.textureNode.build(builder, 'property');
    const levelNode = this.levelNode.build(builder, 'int');
    return builder.format(`${builder.getMethod('textureDimensions')}( ${textureProperty}, ${levelNode} )`, this.getNodeType(builder), output);
  }
}
TextureSizeNode.type = /*@__PURE__*/registerNode('TextureSize', TextureSizeNode);
const textureSize = /*@__PURE__*/nodeProxy(TextureSizeNode);

class TextureNode extends UniformNode {
  constructor(value, uvNode = null, levelNode = null, biasNode = null) {
    super(value);
    this.isTextureNode = true;
    this.uvNode = uvNode;
    this.levelNode = levelNode;
    this.biasNode = biasNode;
    this.compareNode = null;
    this.depthNode = null;
    this.gradNode = null;
    this.sampler = true;
    this.updateMatrix = false;
    this.updateType = NodeUpdateType.NONE;
    this.referenceNode = null;
    this._value = value;
    this._matrixUniform = null;
    this.setUpdateMatrix(uvNode === null);
  }
  set value(value) {
    if (this.referenceNode) {
      this.referenceNode.value = value;
    } else {
      this._value = value;
    }
  }
  get value() {
    return this.referenceNode ? this.referenceNode.value : this._value;
  }
  getUniformHash(/*builder*/
  ) {
    return this.value.uuid;
  }
  getNodeType(/*builder*/
  ) {
    if (this.value.isDepthTexture === true) return 'float';
    if (this.value.type === UnsignedIntType) {
      return 'uvec4';
    } else if (this.value.type === IntType) {
      return 'ivec4';
    }
    return 'vec4';
  }
  getInputType(/*builder*/
  ) {
    return 'texture';
  }
  getDefaultUV() {
    return uv(this.value.channel);
  }
  updateReference(/*state*/
  ) {
    return this.value;
  }
  getTransformedUV(uvNode) {
    if (this._matrixUniform === null) this._matrixUniform = uniform(this.value.matrix);
    return this._matrixUniform.mul(vec3(uvNode, 1)).xy;
  }
  setUpdateMatrix(value) {
    this.updateMatrix = value;
    this.updateType = value ? NodeUpdateType.FRAME : NodeUpdateType.NONE;
    return this;
  }
  setupUV(builder, uvNode) {
    const texture = this.value;
    if (builder.isFlipY() && (texture.isRenderTargetTexture === true || texture.isFramebufferTexture === true || texture.isDepthTexture === true)) {
      uvNode = uvNode.setY(uvNode.y.oneMinus());
    }
    return uvNode;
  }
  setup(builder) {
    const properties = builder.getNodeProperties(this);
    properties.referenceNode = this.referenceNode;

    //

    let uvNode = this.uvNode;
    if ((uvNode === null || builder.context.forceUVContext === true) && builder.context.getUV) {
      uvNode = builder.context.getUV(this);
    }
    if (!uvNode) uvNode = this.getDefaultUV();
    if (this.updateMatrix === true) {
      uvNode = this.getTransformedUV(uvNode);
    }
    uvNode = this.setupUV(builder, uvNode);

    //

    let levelNode = this.levelNode;
    if (levelNode === null && builder.context.getTextureLevel) {
      levelNode = builder.context.getTextureLevel(this);
    }

    //

    properties.uvNode = uvNode;
    properties.levelNode = levelNode;
    properties.biasNode = this.biasNode;
    properties.compareNode = this.compareNode;
    properties.gradNode = this.gradNode;
    properties.depthNode = this.depthNode;
  }
  generateUV(builder, uvNode) {
    return uvNode.build(builder, this.sampler === true ? 'vec2' : 'ivec2');
  }
  generateSnippet(builder, textureProperty, uvSnippet, levelSnippet, biasSnippet, depthSnippet, compareSnippet, gradSnippet) {
    const texture = this.value;
    let snippet;
    if (levelSnippet) {
      snippet = builder.generateTextureLevel(texture, textureProperty, uvSnippet, levelSnippet, depthSnippet);
    } else if (biasSnippet) {
      snippet = builder.generateTextureBias(texture, textureProperty, uvSnippet, biasSnippet, depthSnippet);
    } else if (gradSnippet) {
      snippet = builder.generateTextureGrad(texture, textureProperty, uvSnippet, gradSnippet, depthSnippet);
    } else if (compareSnippet) {
      snippet = builder.generateTextureCompare(texture, textureProperty, uvSnippet, compareSnippet, depthSnippet);
    } else if (this.sampler === false) {
      snippet = builder.generateTextureLoad(texture, textureProperty, uvSnippet, depthSnippet);
    } else {
      snippet = builder.generateTexture(texture, textureProperty, uvSnippet, depthSnippet);
    }
    return snippet;
  }
  generate(builder, output) {
    const properties = builder.getNodeProperties(this);
    const texture = this.value;
    if (!texture || texture.isTexture !== true) {
      throw new Error('TextureNode: Need a three.js texture.');
    }
    const textureProperty = super.generate(builder, 'property');
    if (output === 'sampler') {
      return textureProperty + '_sampler';
    } else if (builder.isReference(output)) {
      return textureProperty;
    } else {
      const nodeData = builder.getDataFromNode(this);
      let propertyName = nodeData.propertyName;
      if (propertyName === undefined) {
        const {
          uvNode,
          levelNode,
          biasNode,
          compareNode,
          depthNode,
          gradNode
        } = properties;
        const uvSnippet = this.generateUV(builder, uvNode);
        const levelSnippet = levelNode ? levelNode.build(builder, 'float') : null;
        const biasSnippet = biasNode ? biasNode.build(builder, 'float') : null;
        const depthSnippet = depthNode ? depthNode.build(builder, 'int') : null;
        const compareSnippet = compareNode ? compareNode.build(builder, 'float') : null;
        const gradSnippet = gradNode ? [gradNode[0].build(builder, 'vec2'), gradNode[1].build(builder, 'vec2')] : null;
        const nodeVar = builder.getVarFromNode(this);
        propertyName = builder.getPropertyName(nodeVar);
        const snippet = this.generateSnippet(builder, textureProperty, uvSnippet, levelSnippet, biasSnippet, depthSnippet, compareSnippet, gradSnippet);
        builder.addLineFlowCode(`${propertyName} = ${snippet}`);
        nodeData.snippet = snippet;
        nodeData.propertyName = propertyName;
      }
      let snippet = propertyName;
      const nodeType = this.getNodeType(builder);
      if (builder.needsToWorkingColorSpace(texture)) {
        snippet = toWorkingColorSpace(expression(snippet, nodeType), texture.colorSpace).setup(builder).build(builder, nodeType);
      }
      return builder.format(snippet, nodeType, output);
    }
  }
  setSampler(value) {
    this.sampler = value;
    return this;
  }
  getSampler() {
    return this.sampler;
  }

  // @TODO: Move to TSL

  uv(uvNode) {
    const textureNode = this.clone();
    textureNode.uvNode = nodeObject(uvNode);
    textureNode.referenceNode = this.getSelf();
    return nodeObject(textureNode);
  }
  blur(amountNode) {
    const textureNode = this.clone();
    textureNode.biasNode = nodeObject(amountNode).mul(maxMipLevel(textureNode));
    textureNode.referenceNode = this.getSelf();
    return nodeObject(textureNode);
  }
  level(levelNode) {
    const textureNode = this.clone();
    textureNode.levelNode = nodeObject(levelNode);
    textureNode.referenceNode = this.getSelf();
    return nodeObject(textureNode);
  }
  size(levelNode) {
    return textureSize(this, levelNode);
  }
  bias(biasNode) {
    const textureNode = this.clone();
    textureNode.biasNode = nodeObject(biasNode);
    textureNode.referenceNode = this.getSelf();
    return nodeObject(textureNode);
  }
  compare(compareNode) {
    const textureNode = this.clone();
    textureNode.compareNode = nodeObject(compareNode);
    textureNode.referenceNode = this.getSelf();
    return nodeObject(textureNode);
  }
  grad(gradNodeX, gradNodeY) {
    const textureNode = this.clone();
    textureNode.gradNode = [nodeObject(gradNodeX), nodeObject(gradNodeY)];
    textureNode.referenceNode = this.getSelf();
    return nodeObject(textureNode);
  }
  depth(depthNode) {
    const textureNode = this.clone();
    textureNode.depthNode = nodeObject(depthNode);
    textureNode.referenceNode = this.getSelf();
    return nodeObject(textureNode);
  }

  // --

  serialize(data) {
    super.serialize(data);
    data.value = this.value.toJSON(data.meta).uuid;
    data.sampler = this.sampler;
    data.updateMatrix = this.updateMatrix;
    data.updateType = this.updateType;
  }
  deserialize(data) {
    super.deserialize(data);
    this.value = data.meta.textures[data.value];
    this.sampler = data.sampler;
    this.updateMatrix = data.updateMatrix;
    this.updateType = data.updateType;
  }
  update() {
    const texture = this.value;
    const matrixUniform = this._matrixUniform;
    if (matrixUniform !== null) matrixUniform.value = texture.matrix;
    if (texture.matrixAutoUpdate === true) {
      texture.updateMatrix();
    }
  }
  clone() {
    const newNode = new this.constructor(this.value, this.uvNode, this.levelNode, this.biasNode);
    newNode.sampler = this.sampler;
    return newNode;
  }
}
TextureNode.type = /*@__PURE__*/registerNode('Texture', TextureNode);
const texture = /*@__PURE__*/nodeProxy(TextureNode);
const textureLoad = (...params) => texture(...params).setSampler(false);

let _canvas;
class ImageUtils {
  static getDataURL(image) {
    if (/^data:/i.test(image.src)) {
      return image.src;
    }
    if (typeof HTMLCanvasElement === 'undefined') {
      return image.src;
    }
    let canvas;
    if (image instanceof HTMLCanvasElement) {
      canvas = image;
    } else {
      if (_canvas === undefined) _canvas = createElementNS('canvas');
      _canvas.width = image.width;
      _canvas.height = image.height;
      const context = _canvas.getContext('2d');
      if (image instanceof ImageData) {
        context.putImageData(image, 0, 0);
      } else {
        context.drawImage(image, 0, 0, image.width, image.height);
      }
      canvas = _canvas;
    }
    if (canvas.width > 2048 || canvas.height > 2048) {
      console.warn('THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image);
      return canvas.toDataURL('image/jpeg', 0.6);
    } else {
      return canvas.toDataURL('image/png');
    }
  }
  static sRGBToLinear(image) {
    if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {
      const canvas = createElementNS('canvas');
      canvas.width = image.width;
      canvas.height = image.height;
      const context = canvas.getContext('2d');
      context.drawImage(image, 0, 0, image.width, image.height);
      const imageData = context.getImageData(0, 0, image.width, image.height);
      const data = imageData.data;
      for (let i = 0; i < data.length; i++) {
        data[i] = SRGBToLinear(data[i] / 255) * 255;
      }
      context.putImageData(imageData, 0, 0);
      return canvas;
    } else if (image.data) {
      const data = image.data.slice(0);
      for (let i = 0; i < data.length; i++) {
        if (data instanceof Uint8Array || data instanceof Uint8ClampedArray) {
          data[i] = Math.floor(SRGBToLinear(data[i] / 255) * 255);
        } else {
          // assuming float

          data[i] = SRGBToLinear(data[i]);
        }
      }
      return {
        data: data,
        width: image.width,
        height: image.height
      };
    } else {
      console.warn('THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.');
      return image;
    }
  }
}

let _sourceId = 0;
class Source {
  constructor(data = null) {
    this.isSource = true;
    Object.defineProperty(this, 'id', {
      value: _sourceId++
    });
    this.uuid = generateUUID();
    this.data = data;
    this.dataReady = true;
    this.version = 0;
  }
  set needsUpdate(value) {
    if (value === true) this.version++;
  }
  toJSON(meta) {
    const isRootObject = meta === undefined || typeof meta === 'string';
    if (!isRootObject && meta.images[this.uuid] !== undefined) {
      return meta.images[this.uuid];
    }
    const output = {
      uuid: this.uuid,
      url: ''
    };
    const data = this.data;
    if (data !== null) {
      let url;
      if (Array.isArray(data)) {
        // cube texture

        url = [];
        for (let i = 0, l = data.length; i < l; i++) {
          if (data[i].isDataTexture) {
            url.push(serializeImage(data[i].image));
          } else {
            url.push(serializeImage(data[i]));
          }
        }
      } else {
        // texture

        url = serializeImage(data);
      }
      output.url = url;
    }
    if (!isRootObject) {
      meta.images[this.uuid] = output;
    }
    return output;
  }
}
function serializeImage(image) {
  if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {
    // default images

    return ImageUtils.getDataURL(image);
  } else {
    if (image.data) {
      // images of DataTexture

      return {
        data: Array.from(image.data),
        width: image.width,
        height: image.height,
        type: image.data.constructor.name
      };
    } else {
      console.warn('THREE.Texture: Unable to serialize Texture.');
      return {};
    }
  }
}

let _textureId = 0;
class Texture extends EventDispatcher {
  constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace) {
    super();
    this.isTexture = true;
    Object.defineProperty(this, 'id', {
      value: _textureId++
    });
    this.uuid = generateUUID();
    this.name = '';
    this.source = new Source(image);
    this.mipmaps = [];
    this.mapping = mapping;
    this.channel = 0;
    this.wrapS = wrapS;
    this.wrapT = wrapT;
    this.magFilter = magFilter;
    this.minFilter = minFilter;
    this.anisotropy = anisotropy;
    this.format = format;
    this.internalFormat = null;
    this.type = type;
    this.offset = new Vector2(0, 0);
    this.repeat = new Vector2(1, 1);
    this.center = new Vector2(0, 0);
    this.rotation = 0;
    this.matrixAutoUpdate = true;
    this.matrix = new Matrix3();
    this.generateMipmaps = true;
    this.premultiplyAlpha = false;
    this.flipY = true;
    this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)

    this.colorSpace = colorSpace;
    this.userData = {};
    this.version = 0;
    this.onUpdate = null;
    this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
    this.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
  }
  get image() {
    return this.source.data;
  }
  set image(value = null) {
    this.source.data = value;
  }
  updateMatrix() {
    this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y);
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(source) {
    this.name = source.name;
    this.source = source.source;
    this.mipmaps = source.mipmaps.slice(0);
    this.mapping = source.mapping;
    this.channel = source.channel;
    this.wrapS = source.wrapS;
    this.wrapT = source.wrapT;
    this.magFilter = source.magFilter;
    this.minFilter = source.minFilter;
    this.anisotropy = source.anisotropy;
    this.format = source.format;
    this.internalFormat = source.internalFormat;
    this.type = source.type;
    this.offset.copy(source.offset);
    this.repeat.copy(source.repeat);
    this.center.copy(source.center);
    this.rotation = source.rotation;
    this.matrixAutoUpdate = source.matrixAutoUpdate;
    this.matrix.copy(source.matrix);
    this.generateMipmaps = source.generateMipmaps;
    this.premultiplyAlpha = source.premultiplyAlpha;
    this.flipY = source.flipY;
    this.unpackAlignment = source.unpackAlignment;
    this.colorSpace = source.colorSpace;
    this.userData = JSON.parse(JSON.stringify(source.userData));
    this.needsUpdate = true;
    return this;
  }
  toJSON(meta) {
    const isRootObject = meta === undefined || typeof meta === 'string';
    if (!isRootObject && meta.textures[this.uuid] !== undefined) {
      return meta.textures[this.uuid];
    }
    const output = {
      metadata: {
        version: 4.6,
        type: 'Texture',
        generator: 'Texture.toJSON'
      },
      uuid: this.uuid,
      name: this.name,
      image: this.source.toJSON(meta).uuid,
      mapping: this.mapping,
      channel: this.channel,
      repeat: [this.repeat.x, this.repeat.y],
      offset: [this.offset.x, this.offset.y],
      center: [this.center.x, this.center.y],
      rotation: this.rotation,
      wrap: [this.wrapS, this.wrapT],
      format: this.format,
      internalFormat: this.internalFormat,
      type: this.type,
      colorSpace: this.colorSpace,
      minFilter: this.minFilter,
      magFilter: this.magFilter,
      anisotropy: this.anisotropy,
      flipY: this.flipY,
      generateMipmaps: this.generateMipmaps,
      premultiplyAlpha: this.premultiplyAlpha,
      unpackAlignment: this.unpackAlignment
    };
    if (Object.keys(this.userData).length > 0) output.userData = this.userData;
    if (!isRootObject) {
      meta.textures[this.uuid] = output;
    }
    return output;
  }
  dispose() {
    this.dispatchEvent({
      type: 'dispose'
    });
  }
  transformUv(uv) {
    if (this.mapping !== UVMapping) return uv;
    uv.applyMatrix3(this.matrix);
    if (uv.x < 0 || uv.x > 1) {
      switch (this.wrapS) {
        case RepeatWrapping:
          uv.x = uv.x - Math.floor(uv.x);
          break;
        case ClampToEdgeWrapping:
          uv.x = uv.x < 0 ? 0 : 1;
          break;
        case MirroredRepeatWrapping:
          if (Math.abs(Math.floor(uv.x) % 2) === 1) {
            uv.x = Math.ceil(uv.x) - uv.x;
          } else {
            uv.x = uv.x - Math.floor(uv.x);
          }
          break;
      }
    }
    if (uv.y < 0 || uv.y > 1) {
      switch (this.wrapT) {
        case RepeatWrapping:
          uv.y = uv.y - Math.floor(uv.y);
          break;
        case ClampToEdgeWrapping:
          uv.y = uv.y < 0 ? 0 : 1;
          break;
        case MirroredRepeatWrapping:
          if (Math.abs(Math.floor(uv.y) % 2) === 1) {
            uv.y = Math.ceil(uv.y) - uv.y;
          } else {
            uv.y = uv.y - Math.floor(uv.y);
          }
          break;
      }
    }
    if (this.flipY) {
      uv.y = 1 - uv.y;
    }
    return uv;
  }
  set needsUpdate(value) {
    if (value === true) {
      this.version++;
      this.source.needsUpdate = true;
    }
  }
  set needsPMREMUpdate(value) {
    if (value === true) {
      this.pmremVersion++;
    }
  }
}
Texture.DEFAULT_IMAGE = null;
Texture.DEFAULT_MAPPING = UVMapping;
Texture.DEFAULT_ANISOTROPY = 1;

class FramebufferTexture extends Texture {
  constructor(width, height) {
    super({
      width,
      height
    });
    this.isFramebufferTexture = true;
    this.magFilter = NearestFilter;
    this.minFilter = NearestFilter;
    this.generateMipmaps = false;
    this.needsUpdate = true;
  }
}

const _size$7 = /*@__PURE__*/new Vector2();
class ViewportTextureNode extends TextureNode {
  constructor(uvNode = viewportUV, levelNode = null, framebufferTexture = null) {
    if (framebufferTexture === null) {
      framebufferTexture = new FramebufferTexture();
      framebufferTexture.minFilter = LinearMipmapLinearFilter;
    }
    super(framebufferTexture, uvNode, levelNode);
    this.generateMipmaps = false;
    this.isOutputTextureNode = true;
    this.updateBeforeType = NodeUpdateType.FRAME;
  }
  updateBefore(frame) {
    const renderer = frame.renderer;
    renderer.getDrawingBufferSize(_size$7);

    //

    const framebufferTexture = this.value;
    if (framebufferTexture.image.width !== _size$7.width || framebufferTexture.image.height !== _size$7.height) {
      framebufferTexture.image.width = _size$7.width;
      framebufferTexture.image.height = _size$7.height;
      framebufferTexture.needsUpdate = true;
    }

    //

    const currentGenerateMipmaps = framebufferTexture.generateMipmaps;
    framebufferTexture.generateMipmaps = this.generateMipmaps;
    renderer.copyFramebufferToTexture(framebufferTexture);
    framebufferTexture.generateMipmaps = currentGenerateMipmaps;
  }
  clone() {
    const viewportTextureNode = new this.constructor(this.uvNode, this.levelNode, this.value);
    viewportTextureNode.generateMipmaps = this.generateMipmaps;
    return viewportTextureNode;
  }
}
ViewportTextureNode.type = /*@__PURE__*/registerNode('ViewportTexture', ViewportTextureNode);

class DepthTexture extends Texture {
  constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format = DepthFormat) {
    if (format !== DepthFormat && format !== DepthStencilFormat) {
      throw new Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');
    }
    if (type === undefined && format === DepthFormat) type = UnsignedIntType;
    if (type === undefined && format === DepthStencilFormat) type = UnsignedInt248Type;
    super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
    this.isDepthTexture = true;
    this.image = {
      width: width,
      height: height
    };
    this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
    this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
    this.flipY = false;
    this.generateMipmaps = false;
    this.compareFunction = null;
  }
  copy(source) {
    super.copy(source);
    this.compareFunction = source.compareFunction;
    return this;
  }
  toJSON(meta) {
    const data = super.toJSON(meta);
    if (this.compareFunction !== null) data.compareFunction = this.compareFunction;
    return data;
  }
}

let sharedDepthbuffer = null;
class ViewportDepthTextureNode extends ViewportTextureNode {
  constructor(uvNode = viewportUV, levelNode = null) {
    if (sharedDepthbuffer === null) {
      sharedDepthbuffer = new DepthTexture();
    }
    super(uvNode, levelNode, sharedDepthbuffer);
  }
}
ViewportDepthTextureNode.type = /*@__PURE__*/registerNode('ViewportDepthTexture', ViewportDepthTextureNode);
const viewportDepthTexture = /*@__PURE__*/nodeProxy(ViewportDepthTextureNode);

class ViewportDepthNode extends Node$1 {
  constructor(scope, valueNode = null) {
    super('float');
    this.scope = scope;
    this.valueNode = valueNode;
    this.isViewportDepthNode = true;
  }
  generate(builder) {
    const {
      scope
    } = this;
    if (scope === ViewportDepthNode.DEPTH_BASE) {
      return builder.getFragDepth();
    }
    return super.generate(builder);
  }
  setup({
    camera
  }) {
    const {
      scope
    } = this;
    const value = this.valueNode;
    let node = null;
    if (scope === ViewportDepthNode.DEPTH_BASE) {
      if (value !== null) {
        node = depthBase().assign(value);
      }
    } else if (scope === ViewportDepthNode.DEPTH) {
      if (camera.isPerspectiveCamera) {
        node = viewZToPerspectiveDepth(positionView.z, cameraNear, cameraFar);
      } else {
        node = viewZToOrthographicDepth(positionView.z, cameraNear, cameraFar);
      }
    } else if (scope === ViewportDepthNode.LINEAR_DEPTH) {
      if (value !== null) {
        if (camera.isPerspectiveCamera) {
          const viewZ = perspectiveDepthToViewZ(value, cameraNear, cameraFar);
          node = viewZToOrthographicDepth(viewZ, cameraNear, cameraFar);
        } else {
          node = value;
        }
      } else {
        node = viewZToOrthographicDepth(positionView.z, cameraNear, cameraFar);
      }
    }
    return node;
  }
}
ViewportDepthNode.DEPTH_BASE = 'depthBase';
ViewportDepthNode.DEPTH = 'depth';
ViewportDepthNode.LINEAR_DEPTH = 'linearDepth';
ViewportDepthNode.type = /*@__PURE__*/registerNode('ViewportDepth', ViewportDepthNode);

// NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera

// -near maps to 0; -far maps to 1
const viewZToOrthographicDepth = (viewZ, near, far) => viewZ.add(near).div(near.sub(far));

// NOTE: https://twitter.com/gonnavis/status/1377183786949959682

// -near maps to 0; -far maps to 1
const viewZToPerspectiveDepth = (viewZ, near, far) => near.add(viewZ).mul(far).div(far.sub(near).mul(viewZ));

// maps perspective depth in [ 0, 1 ] to viewZ
const perspectiveDepthToViewZ = (depth, near, far) => near.mul(far).div(far.sub(near).mul(depth).sub(far));
const depthBase = /*@__PURE__*/nodeProxy(ViewportDepthNode, ViewportDepthNode.DEPTH_BASE);
const depth = /*@__PURE__*/nodeImmutable(ViewportDepthNode, ViewportDepthNode.DEPTH);
const linearDepth = /*@__PURE__*/nodeProxy(ViewportDepthNode, ViewportDepthNode.LINEAR_DEPTH);
/*@__PURE__*/linearDepth(viewportDepthTexture());
depth.assign = value => depthBase(value);

class SpriteSheetUVNode extends Node$1 {
  constructor(countNode, uvNode = uv(), frameNode = float(0)) {
    super('vec2');
    this.countNode = countNode;
    this.uvNode = uvNode;
    this.frameNode = frameNode;
  }
  setup() {
    const {
      frameNode,
      uvNode,
      countNode
    } = this;
    const {
      width,
      height
    } = countNode;
    const frameNum = frameNode.mod(width.mul(height)).floor();
    const column = frameNum.mod(width);
    const row = height.sub(frameNum.add(1).div(width).ceil());
    const scale = countNode.reciprocal();
    const uvFrameOffset = vec2(column, row);
    return uvNode.add(uvFrameOffset).mul(scale);
  }
}
SpriteSheetUVNode.type = /*@__PURE__*/registerNode('SpriteSheetUV', SpriteSheetUVNode);

class TriplanarTexturesNode extends Node$1 {
  constructor(textureXNode, textureYNode = null, textureZNode = null, scaleNode = float(1), positionNode = positionLocal, normalNode = normalLocal) {
    super('vec4');
    this.textureXNode = textureXNode;
    this.textureYNode = textureYNode;
    this.textureZNode = textureZNode;
    this.scaleNode = scaleNode;
    this.positionNode = positionNode;
    this.normalNode = normalNode;
  }
  setup() {
    const {
      textureXNode,
      textureYNode,
      textureZNode,
      scaleNode,
      positionNode,
      normalNode
    } = this;

    // Ref: https://github.com/keijiro/StandardTriplanar

    // Blending factor of triplanar mapping
    let bf = normalNode.abs().normalize();
    bf = bf.div(bf.dot(vec3(1.0)));

    // Triplanar mapping
    const tx = positionNode.yz.mul(scaleNode);
    const ty = positionNode.zx.mul(scaleNode);
    const tz = positionNode.xy.mul(scaleNode);

    // Base color
    const textureX = textureXNode.value;
    const textureY = textureYNode !== null ? textureYNode.value : textureX;
    const textureZ = textureZNode !== null ? textureZNode.value : textureX;
    const cx = texture(textureX, tx).mul(bf.x);
    const cy = texture(textureY, ty).mul(bf.y);
    const cz = texture(textureZ, tz).mul(bf.z);
    return add(cx, cy, cz);
  }
}
TriplanarTexturesNode.type = /*@__PURE__*/registerNode('TriplanarTextures', TriplanarTexturesNode);

const _vector1 = /*@__PURE__*/new Vector3();
const _vector2 = /*@__PURE__*/new Vector3();
const _normalMatrix = /*@__PURE__*/new Matrix3();
class Plane {
  constructor(normal = new Vector3(1, 0, 0), constant = 0) {
    this.isPlane = true;

    // normal is assumed to be normalized

    this.normal = normal;
    this.constant = constant;
  }
  set(normal, constant) {
    this.normal.copy(normal);
    this.constant = constant;
    return this;
  }
  setComponents(x, y, z, w) {
    this.normal.set(x, y, z);
    this.constant = w;
    return this;
  }
  setFromNormalAndCoplanarPoint(normal, point) {
    this.normal.copy(normal);
    this.constant = -point.dot(this.normal);
    return this;
  }
  setFromCoplanarPoints(a, b, c) {
    const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize();

    // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?

    this.setFromNormalAndCoplanarPoint(normal, a);
    return this;
  }
  copy(plane) {
    this.normal.copy(plane.normal);
    this.constant = plane.constant;
    return this;
  }
  normalize() {
    // Note: will lead to a divide by zero if the plane is invalid.

    const inverseNormalLength = 1.0 / this.normal.length();
    this.normal.multiplyScalar(inverseNormalLength);
    this.constant *= inverseNormalLength;
    return this;
  }
  negate() {
    this.constant *= -1;
    this.normal.negate();
    return this;
  }
  distanceToPoint(point) {
    return this.normal.dot(point) + this.constant;
  }
  distanceToSphere(sphere) {
    return this.distanceToPoint(sphere.center) - sphere.radius;
  }
  projectPoint(point, target) {
    return target.copy(point).addScaledVector(this.normal, -this.distanceToPoint(point));
  }
  intersectLine(line, target) {
    const direction = line.delta(_vector1);
    const denominator = this.normal.dot(direction);
    if (denominator === 0) {
      // line is coplanar, return origin
      if (this.distanceToPoint(line.start) === 0) {
        return target.copy(line.start);
      }

      // Unsure if this is the correct method to handle this case.
      return null;
    }
    const t = -(line.start.dot(this.normal) + this.constant) / denominator;
    if (t < 0 || t > 1) {
      return null;
    }
    return target.copy(line.start).addScaledVector(direction, t);
  }
  intersectsLine(line) {
    // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.

    const startSign = this.distanceToPoint(line.start);
    const endSign = this.distanceToPoint(line.end);
    return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0;
  }
  intersectsBox(box) {
    return box.intersectsPlane(this);
  }
  intersectsSphere(sphere) {
    return sphere.intersectsPlane(this);
  }
  coplanarPoint(target) {
    return target.copy(this.normal).multiplyScalar(-this.constant);
  }
  applyMatrix4(matrix, optionalNormalMatrix) {
    const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix);
    const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix);
    const normal = this.normal.applyMatrix3(normalMatrix).normalize();
    this.constant = -referencePoint.dot(normal);
    return this;
  }
  translate(offset) {
    this.constant -= offset.dot(this.normal);
    return this;
  }
  equals(plane) {
    return plane.normal.equals(this.normal) && plane.constant === this.constant;
  }
  clone() {
    return new this.constructor().copy(this);
  }
}

const _matrix = /*@__PURE__*/new Matrix4();
const _quaternion$1 = /*@__PURE__*/new Quaternion();
class Euler {
  constructor(x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER) {
    this.isEuler = true;
    this._x = x;
    this._y = y;
    this._z = z;
    this._order = order;
  }
  get x() {
    return this._x;
  }
  set x(value) {
    this._x = value;
    this._onChangeCallback();
  }
  get y() {
    return this._y;
  }
  set y(value) {
    this._y = value;
    this._onChangeCallback();
  }
  get z() {
    return this._z;
  }
  set z(value) {
    this._z = value;
    this._onChangeCallback();
  }
  get order() {
    return this._order;
  }
  set order(value) {
    this._order = value;
    this._onChangeCallback();
  }
  set(x, y, z, order = this._order) {
    this._x = x;
    this._y = y;
    this._z = z;
    this._order = order;
    this._onChangeCallback();
    return this;
  }
  clone() {
    return new this.constructor(this._x, this._y, this._z, this._order);
  }
  copy(euler) {
    this._x = euler._x;
    this._y = euler._y;
    this._z = euler._z;
    this._order = euler._order;
    this._onChangeCallback();
    return this;
  }
  setFromRotationMatrix(m, order = this._order, update = true) {
    // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)

    const te = m.elements;
    const m11 = te[0],
      m12 = te[4],
      m13 = te[8];
    const m21 = te[1],
      m22 = te[5],
      m23 = te[9];
    const m31 = te[2],
      m32 = te[6],
      m33 = te[10];
    switch (order) {
      case 'XYZ':
        this._y = Math.asin(clamp$1(m13, -1, 1));
        if (Math.abs(m13) < 0.9999999) {
          this._x = Math.atan2(-m23, m33);
          this._z = Math.atan2(-m12, m11);
        } else {
          this._x = Math.atan2(m32, m22);
          this._z = 0;
        }
        break;
      case 'YXZ':
        this._x = Math.asin(-clamp$1(m23, -1, 1));
        if (Math.abs(m23) < 0.9999999) {
          this._y = Math.atan2(m13, m33);
          this._z = Math.atan2(m21, m22);
        } else {
          this._y = Math.atan2(-m31, m11);
          this._z = 0;
        }
        break;
      case 'ZXY':
        this._x = Math.asin(clamp$1(m32, -1, 1));
        if (Math.abs(m32) < 0.9999999) {
          this._y = Math.atan2(-m31, m33);
          this._z = Math.atan2(-m12, m22);
        } else {
          this._y = 0;
          this._z = Math.atan2(m21, m11);
        }
        break;
      case 'ZYX':
        this._y = Math.asin(-clamp$1(m31, -1, 1));
        if (Math.abs(m31) < 0.9999999) {
          this._x = Math.atan2(m32, m33);
          this._z = Math.atan2(m21, m11);
        } else {
          this._x = 0;
          this._z = Math.atan2(-m12, m22);
        }
        break;
      case 'YZX':
        this._z = Math.asin(clamp$1(m21, -1, 1));
        if (Math.abs(m21) < 0.9999999) {
          this._x = Math.atan2(-m23, m22);
          this._y = Math.atan2(-m31, m11);
        } else {
          this._x = 0;
          this._y = Math.atan2(m13, m33);
        }
        break;
      case 'XZY':
        this._z = Math.asin(-clamp$1(m12, -1, 1));
        if (Math.abs(m12) < 0.9999999) {
          this._x = Math.atan2(m32, m22);
          this._y = Math.atan2(m13, m11);
        } else {
          this._x = Math.atan2(-m23, m33);
          this._y = 0;
        }
        break;
      default:
        console.warn('THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order);
    }
    this._order = order;
    if (update === true) this._onChangeCallback();
    return this;
  }
  setFromQuaternion(q, order, update) {
    _matrix.makeRotationFromQuaternion(q);
    return this.setFromRotationMatrix(_matrix, order, update);
  }
  setFromVector3(v, order = this._order) {
    return this.set(v.x, v.y, v.z, order);
  }
  reorder(newOrder) {
    // WARNING: this discards revolution information -bhouston

    _quaternion$1.setFromEuler(this);
    return this.setFromQuaternion(_quaternion$1, newOrder);
  }
  equals(euler) {
    return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order;
  }
  fromArray(array) {
    this._x = array[0];
    this._y = array[1];
    this._z = array[2];
    if (array[3] !== undefined) this._order = array[3];
    this._onChangeCallback();
    return this;
  }
  toArray(array = [], offset = 0) {
    array[offset] = this._x;
    array[offset + 1] = this._y;
    array[offset + 2] = this._z;
    array[offset + 3] = this._order;
    return array;
  }
  _onChange(callback) {
    this._onChangeCallback = callback;
    return this;
  }
  _onChangeCallback() {}
  *[Symbol.iterator]() {
    yield this._x;
    yield this._y;
    yield this._z;
    yield this._order;
  }
}
Euler.DEFAULT_ORDER = 'XYZ';

class Layers {
  constructor() {
    this.mask = 1 | 0;
  }
  set(channel) {
    this.mask = (1 << channel | 0) >>> 0;
  }
  enable(channel) {
    this.mask |= 1 << channel | 0;
  }
  enableAll() {
    this.mask = 0xffffffff | 0;
  }
  toggle(channel) {
    this.mask ^= 1 << channel | 0;
  }
  disable(channel) {
    this.mask &= ~(1 << channel | 0);
  }
  disableAll() {
    this.mask = 0;
  }
  test(layers) {
    return (this.mask & layers.mask) !== 0;
  }
  isEnabled(channel) {
    return (this.mask & (1 << channel | 0)) !== 0;
  }
}

let _object3DId = 0;
const _v1$3 = /*@__PURE__*/new Vector3();
const _q1 = /*@__PURE__*/new Quaternion();
const _m1$1 = /*@__PURE__*/new Matrix4();
const _target$1 = /*@__PURE__*/new Vector3();
const _position = /*@__PURE__*/new Vector3();
const _scale = /*@__PURE__*/new Vector3();
const _quaternion = /*@__PURE__*/new Quaternion();
const _xAxis = /*@__PURE__*/new Vector3(1, 0, 0);
const _yAxis = /*@__PURE__*/new Vector3(0, 1, 0);
const _zAxis = /*@__PURE__*/new Vector3(0, 0, 1);
const _addedEvent = {
  type: 'added'
};
const _removedEvent = {
  type: 'removed'
};
const _childaddedEvent = {
  type: 'childadded',
  child: null
};
const _childremovedEvent = {
  type: 'childremoved',
  child: null
};
class Object3D extends EventDispatcher {
  constructor() {
    super();
    this.isObject3D = true;
    Object.defineProperty(this, 'id', {
      value: _object3DId++
    });
    this.uuid = generateUUID();
    this.name = '';
    this.type = 'Object3D';
    this.parent = null;
    this.children = [];
    this.up = Object3D.DEFAULT_UP.clone();
    const position = new Vector3();
    const rotation = new Euler();
    const quaternion = new Quaternion();
    const scale = new Vector3(1, 1, 1);
    function onRotationChange() {
      quaternion.setFromEuler(rotation, false);
    }
    function onQuaternionChange() {
      rotation.setFromQuaternion(quaternion, undefined, false);
    }
    rotation._onChange(onRotationChange);
    quaternion._onChange(onQuaternionChange);
    Object.defineProperties(this, {
      position: {
        configurable: true,
        enumerable: true,
        value: position
      },
      rotation: {
        configurable: true,
        enumerable: true,
        value: rotation
      },
      quaternion: {
        configurable: true,
        enumerable: true,
        value: quaternion
      },
      scale: {
        configurable: true,
        enumerable: true,
        value: scale
      },
      modelViewMatrix: {
        value: new Matrix4()
      },
      normalMatrix: {
        value: new Matrix3()
      }
    });
    this.matrix = new Matrix4();
    this.matrixWorld = new Matrix4();
    this.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;
    this.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer
    this.matrixWorldNeedsUpdate = false;
    this.layers = new Layers();
    this.visible = true;
    this.castShadow = false;
    this.receiveShadow = false;
    this.frustumCulled = true;
    this.renderOrder = 0;
    this.animations = [];
    this.userData = {};
  }
  onBeforeShadow(/* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */) {}
  onAfterShadow(/* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */) {}
  onBeforeRender(/* renderer, scene, camera, geometry, material, group */) {}
  onAfterRender(/* renderer, scene, camera, geometry, material, group */) {}
  applyMatrix4(matrix) {
    if (this.matrixAutoUpdate) this.updateMatrix();
    this.matrix.premultiply(matrix);
    this.matrix.decompose(this.position, this.quaternion, this.scale);
  }
  applyQuaternion(q) {
    this.quaternion.premultiply(q);
    return this;
  }
  setRotationFromAxisAngle(axis, angle) {
    // assumes axis is normalized

    this.quaternion.setFromAxisAngle(axis, angle);
  }
  setRotationFromEuler(euler) {
    this.quaternion.setFromEuler(euler, true);
  }
  setRotationFromMatrix(m) {
    // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)

    this.quaternion.setFromRotationMatrix(m);
  }
  setRotationFromQuaternion(q) {
    // assumes q is normalized

    this.quaternion.copy(q);
  }
  rotateOnAxis(axis, angle) {
    // rotate object on axis in object space
    // axis is assumed to be normalized

    _q1.setFromAxisAngle(axis, angle);
    this.quaternion.multiply(_q1);
    return this;
  }
  rotateOnWorldAxis(axis, angle) {
    // rotate object on axis in world space
    // axis is assumed to be normalized
    // method assumes no rotated parent

    _q1.setFromAxisAngle(axis, angle);
    this.quaternion.premultiply(_q1);
    return this;
  }
  rotateX(angle) {
    return this.rotateOnAxis(_xAxis, angle);
  }
  rotateY(angle) {
    return this.rotateOnAxis(_yAxis, angle);
  }
  rotateZ(angle) {
    return this.rotateOnAxis(_zAxis, angle);
  }
  translateOnAxis(axis, distance) {
    // translate object by distance along axis in object space
    // axis is assumed to be normalized

    _v1$3.copy(axis).applyQuaternion(this.quaternion);
    this.position.add(_v1$3.multiplyScalar(distance));
    return this;
  }
  translateX(distance) {
    return this.translateOnAxis(_xAxis, distance);
  }
  translateY(distance) {
    return this.translateOnAxis(_yAxis, distance);
  }
  translateZ(distance) {
    return this.translateOnAxis(_zAxis, distance);
  }
  localToWorld(vector) {
    this.updateWorldMatrix(true, false);
    return vector.applyMatrix4(this.matrixWorld);
  }
  worldToLocal(vector) {
    this.updateWorldMatrix(true, false);
    return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert());
  }
  lookAt(x, y, z) {
    // This method does not support objects having non-uniformly-scaled parent(s)

    if (x.isVector3) {
      _target$1.copy(x);
    } else {
      _target$1.set(x, y, z);
    }
    const parent = this.parent;
    this.updateWorldMatrix(true, false);
    _position.setFromMatrixPosition(this.matrixWorld);
    if (this.isCamera || this.isLight) {
      _m1$1.lookAt(_position, _target$1, this.up);
    } else {
      _m1$1.lookAt(_target$1, _position, this.up);
    }
    this.quaternion.setFromRotationMatrix(_m1$1);
    if (parent) {
      _m1$1.extractRotation(parent.matrixWorld);
      _q1.setFromRotationMatrix(_m1$1);
      this.quaternion.premultiply(_q1.invert());
    }
  }
  add(object) {
    if (arguments.length > 1) {
      for (let i = 0; i < arguments.length; i++) {
        this.add(arguments[i]);
      }
      return this;
    }
    if (object === this) {
      console.error('THREE.Object3D.add: object can\'t be added as a child of itself.', object);
      return this;
    }
    if (object && object.isObject3D) {
      object.removeFromParent();
      object.parent = this;
      this.children.push(object);
      object.dispatchEvent(_addedEvent);
      _childaddedEvent.child = object;
      this.dispatchEvent(_childaddedEvent);
      _childaddedEvent.child = null;
    } else {
      console.error('THREE.Object3D.add: object not an instance of THREE.Object3D.', object);
    }
    return this;
  }
  remove(object) {
    if (arguments.length > 1) {
      for (let i = 0; i < arguments.length; i++) {
        this.remove(arguments[i]);
      }
      return this;
    }
    const index = this.children.indexOf(object);
    if (index !== -1) {
      object.parent = null;
      this.children.splice(index, 1);
      object.dispatchEvent(_removedEvent);
      _childremovedEvent.child = object;
      this.dispatchEvent(_childremovedEvent);
      _childremovedEvent.child = null;
    }
    return this;
  }
  removeFromParent() {
    const parent = this.parent;
    if (parent !== null) {
      parent.remove(this);
    }
    return this;
  }
  clear() {
    return this.remove(...this.children);
  }
  attach(object) {
    // adds object as a child of this, while maintaining the object's world transform

    // Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)

    this.updateWorldMatrix(true, false);
    _m1$1.copy(this.matrixWorld).invert();
    if (object.parent !== null) {
      object.parent.updateWorldMatrix(true, false);
      _m1$1.multiply(object.parent.matrixWorld);
    }
    object.applyMatrix4(_m1$1);
    object.removeFromParent();
    object.parent = this;
    this.children.push(object);
    object.updateWorldMatrix(false, true);
    object.dispatchEvent(_addedEvent);
    _childaddedEvent.child = object;
    this.dispatchEvent(_childaddedEvent);
    _childaddedEvent.child = null;
    return this;
  }
  getObjectById(id) {
    return this.getObjectByProperty('id', id);
  }
  getObjectByName(name) {
    return this.getObjectByProperty('name', name);
  }
  getObjectByProperty(name, value) {
    if (this[name] === value) return this;
    for (let i = 0, l = this.children.length; i < l; i++) {
      const child = this.children[i];
      const object = child.getObjectByProperty(name, value);
      if (object !== undefined) {
        return object;
      }
    }
    return undefined;
  }
  getObjectsByProperty(name, value, result = []) {
    if (this[name] === value) result.push(this);
    const children = this.children;
    for (let i = 0, l = children.length; i < l; i++) {
      children[i].getObjectsByProperty(name, value, result);
    }
    return result;
  }
  getWorldPosition(target) {
    this.updateWorldMatrix(true, false);
    return target.setFromMatrixPosition(this.matrixWorld);
  }
  getWorldQuaternion(target) {
    this.updateWorldMatrix(true, false);
    this.matrixWorld.decompose(_position, target, _scale);
    return target;
  }
  getWorldScale(target) {
    this.updateWorldMatrix(true, false);
    this.matrixWorld.decompose(_position, _quaternion, target);
    return target;
  }
  getWorldDirection(target) {
    this.updateWorldMatrix(true, false);
    const e = this.matrixWorld.elements;
    return target.set(e[8], e[9], e[10]).normalize();
  }
  raycast(/* raycaster, intersects */) {}
  traverse(callback) {
    callback(this);
    const children = this.children;
    for (let i = 0, l = children.length; i < l; i++) {
      children[i].traverse(callback);
    }
  }
  traverseVisible(callback) {
    if (this.visible === false) return;
    callback(this);
    const children = this.children;
    for (let i = 0, l = children.length; i < l; i++) {
      children[i].traverseVisible(callback);
    }
  }
  traverseAncestors(callback) {
    const parent = this.parent;
    if (parent !== null) {
      callback(parent);
      parent.traverseAncestors(callback);
    }
  }
  updateMatrix() {
    this.matrix.compose(this.position, this.quaternion, this.scale);
    this.matrixWorldNeedsUpdate = true;
  }
  updateMatrixWorld(force) {
    if (this.matrixAutoUpdate) this.updateMatrix();
    if (this.matrixWorldNeedsUpdate || force) {
      if (this.matrixWorldAutoUpdate === true) {
        if (this.parent === null) {
          this.matrixWorld.copy(this.matrix);
        } else {
          this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);
        }
      }
      this.matrixWorldNeedsUpdate = false;
      force = true;
    }

    // make sure descendants are updated if required

    const children = this.children;
    for (let i = 0, l = children.length; i < l; i++) {
      const child = children[i];
      child.updateMatrixWorld(force);
    }
  }
  updateWorldMatrix(updateParents, updateChildren) {
    const parent = this.parent;
    if (updateParents === true && parent !== null) {
      parent.updateWorldMatrix(true, false);
    }
    if (this.matrixAutoUpdate) this.updateMatrix();
    if (this.matrixWorldAutoUpdate === true) {
      if (this.parent === null) {
        this.matrixWorld.copy(this.matrix);
      } else {
        this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);
      }
    }

    // make sure descendants are updated

    if (updateChildren === true) {
      const children = this.children;
      for (let i = 0, l = children.length; i < l; i++) {
        const child = children[i];
        child.updateWorldMatrix(false, true);
      }
    }
  }
  toJSON(meta) {
    // meta is a string when called from JSON.stringify
    const isRootObject = meta === undefined || typeof meta === 'string';
    const output = {};

    // meta is a hash used to collect geometries, materials.
    // not providing it implies that this is the root object
    // being serialized.
    if (isRootObject) {
      // initialize meta obj
      meta = {
        geometries: {},
        materials: {},
        textures: {},
        images: {},
        shapes: {},
        skeletons: {},
        animations: {},
        nodes: {}
      };
      output.metadata = {
        version: 4.6,
        type: 'Object',
        generator: 'Object3D.toJSON'
      };
    }

    // standard Object3D serialization

    const object = {};
    object.uuid = this.uuid;
    object.type = this.type;
    if (this.name !== '') object.name = this.name;
    if (this.castShadow === true) object.castShadow = true;
    if (this.receiveShadow === true) object.receiveShadow = true;
    if (this.visible === false) object.visible = false;
    if (this.frustumCulled === false) object.frustumCulled = false;
    if (this.renderOrder !== 0) object.renderOrder = this.renderOrder;
    if (Object.keys(this.userData).length > 0) object.userData = this.userData;
    object.layers = this.layers.mask;
    object.matrix = this.matrix.toArray();
    object.up = this.up.toArray();
    if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false;

    // object specific properties

    if (this.isInstancedMesh) {
      object.type = 'InstancedMesh';
      object.count = this.count;
      object.instanceMatrix = this.instanceMatrix.toJSON();
      if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON();
    }
    if (this.isBatchedMesh) {
      object.type = 'BatchedMesh';
      object.perObjectFrustumCulled = this.perObjectFrustumCulled;
      object.sortObjects = this.sortObjects;
      object.drawRanges = this._drawRanges;
      object.reservedRanges = this._reservedRanges;
      object.visibility = this._visibility;
      object.active = this._active;
      object.bounds = this._bounds.map(bound => ({
        boxInitialized: bound.boxInitialized,
        boxMin: bound.box.min.toArray(),
        boxMax: bound.box.max.toArray(),
        sphereInitialized: bound.sphereInitialized,
        sphereRadius: bound.sphere.radius,
        sphereCenter: bound.sphere.center.toArray()
      }));
      object.maxInstanceCount = this._maxInstanceCount;
      object.maxVertexCount = this._maxVertexCount;
      object.maxIndexCount = this._maxIndexCount;
      object.geometryInitialized = this._geometryInitialized;
      object.geometryCount = this._geometryCount;
      object.matricesTexture = this._matricesTexture.toJSON(meta);
      if (this._colorsTexture !== null) object.colorsTexture = this._colorsTexture.toJSON(meta);
      if (this.boundingSphere !== null) {
        object.boundingSphere = {
          center: object.boundingSphere.center.toArray(),
          radius: object.boundingSphere.radius
        };
      }
      if (this.boundingBox !== null) {
        object.boundingBox = {
          min: object.boundingBox.min.toArray(),
          max: object.boundingBox.max.toArray()
        };
      }
    }

    //

    function serialize(library, element) {
      if (library[element.uuid] === undefined) {
        library[element.uuid] = element.toJSON(meta);
      }
      return element.uuid;
    }
    if (this.isScene) {
      if (this.background) {
        if (this.background.isColor) {
          object.background = this.background.toJSON();
        } else if (this.background.isTexture) {
          object.background = this.background.toJSON(meta).uuid;
        }
      }
      if (this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true) {
        object.environment = this.environment.toJSON(meta).uuid;
      }
    } else if (this.isMesh || this.isLine || this.isPoints) {
      object.geometry = serialize(meta.geometries, this.geometry);
      const parameters = this.geometry.parameters;
      if (parameters !== undefined && parameters.shapes !== undefined) {
        const shapes = parameters.shapes;
        if (Array.isArray(shapes)) {
          for (let i = 0, l = shapes.length; i < l; i++) {
            const shape = shapes[i];
            serialize(meta.shapes, shape);
          }
        } else {
          serialize(meta.shapes, shapes);
        }
      }
    }
    if (this.isSkinnedMesh) {
      object.bindMode = this.bindMode;
      object.bindMatrix = this.bindMatrix.toArray();
      if (this.skeleton !== undefined) {
        serialize(meta.skeletons, this.skeleton);
        object.skeleton = this.skeleton.uuid;
      }
    }
    if (this.material !== undefined) {
      if (Array.isArray(this.material)) {
        const uuids = [];
        for (let i = 0, l = this.material.length; i < l; i++) {
          uuids.push(serialize(meta.materials, this.material[i]));
        }
        object.material = uuids;
      } else {
        object.material = serialize(meta.materials, this.material);
      }
    }

    //

    if (this.children.length > 0) {
      object.children = [];
      for (let i = 0; i < this.children.length; i++) {
        object.children.push(this.children[i].toJSON(meta).object);
      }
    }

    //

    if (this.animations.length > 0) {
      object.animations = [];
      for (let i = 0; i < this.animations.length; i++) {
        const animation = this.animations[i];
        object.animations.push(serialize(meta.animations, animation));
      }
    }
    if (isRootObject) {
      const geometries = extractFromCache(meta.geometries);
      const materials = extractFromCache(meta.materials);
      const textures = extractFromCache(meta.textures);
      const images = extractFromCache(meta.images);
      const shapes = extractFromCache(meta.shapes);
      const skeletons = extractFromCache(meta.skeletons);
      const animations = extractFromCache(meta.animations);
      const nodes = extractFromCache(meta.nodes);
      if (geometries.length > 0) output.geometries = geometries;
      if (materials.length > 0) output.materials = materials;
      if (textures.length > 0) output.textures = textures;
      if (images.length > 0) output.images = images;
      if (shapes.length > 0) output.shapes = shapes;
      if (skeletons.length > 0) output.skeletons = skeletons;
      if (animations.length > 0) output.animations = animations;
      if (nodes.length > 0) output.nodes = nodes;
    }
    output.object = object;
    return output;

    // extract data from the cache hash
    // remove metadata on each item
    // and return as array
    function extractFromCache(cache) {
      const values = [];
      for (const key in cache) {
        const data = cache[key];
        delete data.metadata;
        values.push(data);
      }
      return values;
    }
  }
  clone(recursive) {
    return new this.constructor().copy(this, recursive);
  }
  copy(source, recursive = true) {
    this.name = source.name;
    this.up.copy(source.up);
    this.position.copy(source.position);
    this.rotation.order = source.rotation.order;
    this.quaternion.copy(source.quaternion);
    this.scale.copy(source.scale);
    this.matrix.copy(source.matrix);
    this.matrixWorld.copy(source.matrixWorld);
    this.matrixAutoUpdate = source.matrixAutoUpdate;
    this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;
    this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
    this.layers.mask = source.layers.mask;
    this.visible = source.visible;
    this.castShadow = source.castShadow;
    this.receiveShadow = source.receiveShadow;
    this.frustumCulled = source.frustumCulled;
    this.renderOrder = source.renderOrder;
    this.animations = source.animations.slice();
    this.userData = JSON.parse(JSON.stringify(source.userData));
    if (recursive === true) {
      for (let i = 0; i < source.children.length; i++) {
        const child = source.children[i];
        this.add(child.clone());
      }
    }
    return this;
  }
}
Object3D.DEFAULT_UP = /*@__PURE__*/new Vector3(0, 1, 0);
Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true;
Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;

/*
 In options, we can specify:
 * Texture parameters for an auto-generated target texture
 * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
*/
class RenderTarget extends EventDispatcher {
  constructor(width = 1, height = 1, options = {}) {
    super();
    this.isRenderTarget = true;
    this.width = width;
    this.height = height;
    this.depth = 1;
    this.scissor = new Vector4(0, 0, width, height);
    this.scissorTest = false;
    this.viewport = new Vector4(0, 0, width, height);
    const image = {
      width: width,
      height: height,
      depth: 1
    };
    options = Object.assign({
      generateMipmaps: false,
      internalFormat: null,
      minFilter: LinearFilter,
      depthBuffer: true,
      stencilBuffer: false,
      resolveDepthBuffer: true,
      resolveStencilBuffer: true,
      depthTexture: null,
      samples: 0,
      count: 1
    }, options);
    const texture = new Texture(image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace);
    texture.flipY = false;
    texture.generateMipmaps = options.generateMipmaps;
    texture.internalFormat = options.internalFormat;
    this.textures = [];
    const count = options.count;
    for (let i = 0; i < count; i++) {
      this.textures[i] = texture.clone();
      this.textures[i].isRenderTargetTexture = true;
    }
    this.depthBuffer = options.depthBuffer;
    this.stencilBuffer = options.stencilBuffer;
    this.resolveDepthBuffer = options.resolveDepthBuffer;
    this.resolveStencilBuffer = options.resolveStencilBuffer;
    this.depthTexture = options.depthTexture;
    this.samples = options.samples;
  }
  get texture() {
    return this.textures[0];
  }
  set texture(value) {
    this.textures[0] = value;
  }
  setSize(width, height, depth = 1) {
    if (this.width !== width || this.height !== height || this.depth !== depth) {
      this.width = width;
      this.height = height;
      this.depth = depth;
      for (let i = 0, il = this.textures.length; i < il; i++) {
        this.textures[i].image.width = width;
        this.textures[i].image.height = height;
        this.textures[i].image.depth = depth;
      }
      this.dispose();
    }
    this.viewport.set(0, 0, width, height);
    this.scissor.set(0, 0, width, height);
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(source) {
    this.width = source.width;
    this.height = source.height;
    this.depth = source.depth;
    this.scissor.copy(source.scissor);
    this.scissorTest = source.scissorTest;
    this.viewport.copy(source.viewport);
    this.textures.length = 0;
    for (let i = 0, il = source.textures.length; i < il; i++) {
      this.textures[i] = source.textures[i].clone();
      this.textures[i].isRenderTargetTexture = true;
    }

    // ensure image object is not shared, see #20328

    const image = Object.assign({}, source.texture.image);
    this.texture.source = new Source(image);
    this.depthBuffer = source.depthBuffer;
    this.stencilBuffer = source.stencilBuffer;
    this.resolveDepthBuffer = source.resolveDepthBuffer;
    this.resolveStencilBuffer = source.resolveStencilBuffer;
    if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();
    this.samples = source.samples;
    return this;
  }
  dispose() {
    this.dispatchEvent({
      type: 'dispose'
    });
  }
}

const _reflectorPlane = new Plane();
const _normal$1 = new Vector3();
const _reflectorWorldPosition = new Vector3();
const _cameraWorldPosition = new Vector3();
const _rotationMatrix = new Matrix4();
const _lookAtPosition = new Vector3(0, 0, -1);
const clipPlane = new Vector4();
const _view = new Vector3();
const _target = new Vector3();
const _q = new Vector4();
const _size$6 = new Vector2();
const _defaultRT = new RenderTarget();
const _defaultUV = viewportUV.flipX();
let _inReflector = false;
class ReflectorNode extends TextureNode {
  constructor(parameters = {}) {
    super(_defaultRT.texture, _defaultUV);
    const {
      target = new Object3D(),
      resolution = 1,
      generateMipmaps = false,
      bounces = true
    } = parameters;

    //

    this.target = target;
    this.resolution = resolution;
    this.generateMipmaps = generateMipmaps;
    this.bounces = bounces;
    this.updateBeforeType = bounces ? NodeUpdateType.RENDER : NodeUpdateType.FRAME;
    this.virtualCameras = new WeakMap();
    this.renderTargets = new WeakMap();
  }
  _updateResolution(renderTarget, renderer) {
    const resolution = this.resolution;
    renderer.getDrawingBufferSize(_size$6);
    renderTarget.setSize(Math.round(_size$6.width * resolution), Math.round(_size$6.height * resolution));
  }
  setup(builder) {
    this._updateResolution(_defaultRT, builder.renderer);
    return super.setup(builder);
  }
  getTextureNode() {
    return this.textureNode;
  }
  getVirtualCamera(camera) {
    let virtualCamera = this.virtualCameras.get(camera);
    if (virtualCamera === undefined) {
      virtualCamera = camera.clone();
      this.virtualCameras.set(camera, virtualCamera);
    }
    return virtualCamera;
  }
  getRenderTarget(camera) {
    let renderTarget = this.renderTargets.get(camera);
    if (renderTarget === undefined) {
      renderTarget = new RenderTarget(0, 0, {
        type: HalfFloatType
      });
      if (this.generateMipmaps === true) {
        renderTarget.texture.minFilter = LinearMipMapLinearFilter;
        renderTarget.texture.generateMipmaps = true;
      }
      this.renderTargets.set(camera, renderTarget);
    }
    return renderTarget;
  }
  updateBefore(frame) {
    if (this.bounces === false && _inReflector) return false;
    _inReflector = true;
    const {
      scene,
      camera,
      renderer,
      material
    } = frame;
    const {
      target
    } = this;
    const virtualCamera = this.getVirtualCamera(camera);
    const renderTarget = this.getRenderTarget(virtualCamera);
    renderer.getDrawingBufferSize(_size$6);
    this._updateResolution(renderTarget, renderer);

    //

    _reflectorWorldPosition.setFromMatrixPosition(target.matrixWorld);
    _cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
    _rotationMatrix.extractRotation(target.matrixWorld);
    _normal$1.set(0, 0, 1);
    _normal$1.applyMatrix4(_rotationMatrix);
    _view.subVectors(_reflectorWorldPosition, _cameraWorldPosition);

    // Avoid rendering when reflector is facing away

    if (_view.dot(_normal$1) > 0) return;
    _view.reflect(_normal$1).negate();
    _view.add(_reflectorWorldPosition);
    _rotationMatrix.extractRotation(camera.matrixWorld);
    _lookAtPosition.set(0, 0, -1);
    _lookAtPosition.applyMatrix4(_rotationMatrix);
    _lookAtPosition.add(_cameraWorldPosition);
    _target.subVectors(_reflectorWorldPosition, _lookAtPosition);
    _target.reflect(_normal$1).negate();
    _target.add(_reflectorWorldPosition);

    //

    virtualCamera.coordinateSystem = camera.coordinateSystem;
    virtualCamera.position.copy(_view);
    virtualCamera.up.set(0, 1, 0);
    virtualCamera.up.applyMatrix4(_rotationMatrix);
    virtualCamera.up.reflect(_normal$1);
    virtualCamera.lookAt(_target);
    virtualCamera.near = camera.near;
    virtualCamera.far = camera.far;
    virtualCamera.updateMatrixWorld();
    virtualCamera.projectionMatrix.copy(camera.projectionMatrix);

    // Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
    // Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
    _reflectorPlane.setFromNormalAndCoplanarPoint(_normal$1, _reflectorWorldPosition);
    _reflectorPlane.applyMatrix4(virtualCamera.matrixWorldInverse);
    clipPlane.set(_reflectorPlane.normal.x, _reflectorPlane.normal.y, _reflectorPlane.normal.z, _reflectorPlane.constant);
    const projectionMatrix = virtualCamera.projectionMatrix;
    _q.x = (Math.sign(clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];
    _q.y = (Math.sign(clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];
    _q.z = -1.0;
    _q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];

    // Calculate the scaled plane vector
    clipPlane.multiplyScalar(1.0 / clipPlane.dot(_q));
    const clipBias = 0;

    // Replacing the third row of the projection matrix
    projectionMatrix.elements[2] = clipPlane.x;
    projectionMatrix.elements[6] = clipPlane.y;
    projectionMatrix.elements[10] = clipPlane.z - clipBias;
    projectionMatrix.elements[14] = clipPlane.w;

    //

    this.value = renderTarget.texture;
    material.visible = false;
    const currentRenderTarget = renderer.getRenderTarget();
    const currentMRT = renderer.getMRT();
    renderer.setMRT(null);
    renderer.setRenderTarget(renderTarget);
    renderer.render(scene, virtualCamera);
    renderer.setMRT(currentMRT);
    renderer.setRenderTarget(currentRenderTarget);
    material.visible = true;
    _inReflector = false;
  }
}
ReflectorNode.type = /*@__PURE__*/registerNode('Reflector', ReflectorNode);

let _materialId = 0;
class Material extends EventDispatcher {
  constructor() {
    super();
    this.isMaterial = true;
    Object.defineProperty(this, 'id', {
      value: _materialId++
    });
    this.uuid = generateUUID();
    this.name = '';
    this.type = 'Material';
    this.blending = NormalBlending;
    this.side = FrontSide;
    this.vertexColors = false;
    this.opacity = 1;
    this.transparent = false;
    this.alphaHash = false;
    this.blendSrc = SrcAlphaFactor;
    this.blendDst = OneMinusSrcAlphaFactor;
    this.blendEquation = AddEquation;
    this.blendSrcAlpha = null;
    this.blendDstAlpha = null;
    this.blendEquationAlpha = null;
    this.blendColor = new Color(0, 0, 0);
    this.blendAlpha = 0;
    this.depthFunc = LessEqualDepth;
    this.depthTest = true;
    this.depthWrite = true;
    this.stencilWriteMask = 0xff;
    this.stencilFunc = AlwaysStencilFunc;
    this.stencilRef = 0;
    this.stencilFuncMask = 0xff;
    this.stencilFail = KeepStencilOp;
    this.stencilZFail = KeepStencilOp;
    this.stencilZPass = KeepStencilOp;
    this.stencilWrite = false;
    this.clippingPlanes = null;
    this.clipIntersection = false;
    this.clipShadows = false;
    this.shadowSide = null;
    this.colorWrite = true;
    this.precision = null; // override the renderer's default precision for this material

    this.polygonOffset = false;
    this.polygonOffsetFactor = 0;
    this.polygonOffsetUnits = 0;
    this.dithering = false;
    this.alphaToCoverage = false;
    this.premultipliedAlpha = false;
    this.forceSinglePass = false;
    this.visible = true;
    this.toneMapped = true;
    this.userData = {};
    this.version = 0;
    this._alphaTest = 0;
  }
  get alphaTest() {
    return this._alphaTest;
  }
  set alphaTest(value) {
    if (this._alphaTest > 0 !== value > 0) {
      this.version++;
    }
    this._alphaTest = value;
  }

  // onBeforeRender and onBeforeCompile only supported in WebGLRenderer

  onBeforeRender(/* renderer, scene, camera, geometry, object, group */) {}
  onBeforeCompile(/* shaderobject, renderer */) {}
  customProgramCacheKey() {
    return this.onBeforeCompile.toString();
  }
  setValues(values) {
    if (values === undefined) return;
    for (const key in values) {
      const newValue = values[key];
      if (newValue === undefined) {
        console.warn(`THREE.Material: parameter '${key}' has value of undefined.`);
        continue;
      }
      const currentValue = this[key];
      if (currentValue === undefined) {
        console.warn(`THREE.Material: '${key}' is not a property of THREE.${this.type}.`);
        continue;
      }
      if (currentValue && currentValue.isColor) {
        currentValue.set(newValue);
      } else if (currentValue && currentValue.isVector3 && newValue && newValue.isVector3) {
        currentValue.copy(newValue);
      } else {
        this[key] = newValue;
      }
    }
  }
  toJSON(meta) {
    const isRootObject = meta === undefined || typeof meta === 'string';
    if (isRootObject) {
      meta = {
        textures: {},
        images: {}
      };
    }
    const data = {
      metadata: {
        version: 4.6,
        type: 'Material',
        generator: 'Material.toJSON'
      }
    };

    // standard Material serialization
    data.uuid = this.uuid;
    data.type = this.type;
    if (this.name !== '') data.name = this.name;
    if (this.color && this.color.isColor) data.color = this.color.getHex();
    if (this.roughness !== undefined) data.roughness = this.roughness;
    if (this.metalness !== undefined) data.metalness = this.metalness;
    if (this.sheen !== undefined) data.sheen = this.sheen;
    if (this.sheenColor && this.sheenColor.isColor) data.sheenColor = this.sheenColor.getHex();
    if (this.sheenRoughness !== undefined) data.sheenRoughness = this.sheenRoughness;
    if (this.emissive && this.emissive.isColor) data.emissive = this.emissive.getHex();
    if (this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1) data.emissiveIntensity = this.emissiveIntensity;
    if (this.specular && this.specular.isColor) data.specular = this.specular.getHex();
    if (this.specularIntensity !== undefined) data.specularIntensity = this.specularIntensity;
    if (this.specularColor && this.specularColor.isColor) data.specularColor = this.specularColor.getHex();
    if (this.shininess !== undefined) data.shininess = this.shininess;
    if (this.clearcoat !== undefined) data.clearcoat = this.clearcoat;
    if (this.clearcoatRoughness !== undefined) data.clearcoatRoughness = this.clearcoatRoughness;
    if (this.clearcoatMap && this.clearcoatMap.isTexture) {
      data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid;
    }
    if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) {
      data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid;
    }
    if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) {
      data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid;
      data.clearcoatNormalScale = this.clearcoatNormalScale.toArray();
    }
    if (this.dispersion !== undefined) data.dispersion = this.dispersion;
    if (this.iridescence !== undefined) data.iridescence = this.iridescence;
    if (this.iridescenceIOR !== undefined) data.iridescenceIOR = this.iridescenceIOR;
    if (this.iridescenceThicknessRange !== undefined) data.iridescenceThicknessRange = this.iridescenceThicknessRange;
    if (this.iridescenceMap && this.iridescenceMap.isTexture) {
      data.iridescenceMap = this.iridescenceMap.toJSON(meta).uuid;
    }
    if (this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture) {
      data.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(meta).uuid;
    }
    if (this.anisotropy !== undefined) data.anisotropy = this.anisotropy;
    if (this.anisotropyRotation !== undefined) data.anisotropyRotation = this.anisotropyRotation;
    if (this.anisotropyMap && this.anisotropyMap.isTexture) {
      data.anisotropyMap = this.anisotropyMap.toJSON(meta).uuid;
    }
    if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid;
    if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid;
    if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid;
    if (this.lightMap && this.lightMap.isTexture) {
      data.lightMap = this.lightMap.toJSON(meta).uuid;
      data.lightMapIntensity = this.lightMapIntensity;
    }
    if (this.aoMap && this.aoMap.isTexture) {
      data.aoMap = this.aoMap.toJSON(meta).uuid;
      data.aoMapIntensity = this.aoMapIntensity;
    }
    if (this.bumpMap && this.bumpMap.isTexture) {
      data.bumpMap = this.bumpMap.toJSON(meta).uuid;
      data.bumpScale = this.bumpScale;
    }
    if (this.normalMap && this.normalMap.isTexture) {
      data.normalMap = this.normalMap.toJSON(meta).uuid;
      data.normalMapType = this.normalMapType;
      data.normalScale = this.normalScale.toArray();
    }
    if (this.displacementMap && this.displacementMap.isTexture) {
      data.displacementMap = this.displacementMap.toJSON(meta).uuid;
      data.displacementScale = this.displacementScale;
      data.displacementBias = this.displacementBias;
    }
    if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid;
    if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid;
    if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid;
    if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid;
    if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid;
    if (this.specularColorMap && this.specularColorMap.isTexture) data.specularColorMap = this.specularColorMap.toJSON(meta).uuid;
    if (this.envMap && this.envMap.isTexture) {
      data.envMap = this.envMap.toJSON(meta).uuid;
      if (this.combine !== undefined) data.combine = this.combine;
    }
    if (this.envMapRotation !== undefined) data.envMapRotation = this.envMapRotation.toArray();
    if (this.envMapIntensity !== undefined) data.envMapIntensity = this.envMapIntensity;
    if (this.reflectivity !== undefined) data.reflectivity = this.reflectivity;
    if (this.refractionRatio !== undefined) data.refractionRatio = this.refractionRatio;
    if (this.gradientMap && this.gradientMap.isTexture) {
      data.gradientMap = this.gradientMap.toJSON(meta).uuid;
    }
    if (this.transmission !== undefined) data.transmission = this.transmission;
    if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;
    if (this.thickness !== undefined) data.thickness = this.thickness;
    if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;
    if (this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;
    if (this.attenuationColor !== undefined) data.attenuationColor = this.attenuationColor.getHex();
    if (this.size !== undefined) data.size = this.size;
    if (this.shadowSide !== null) data.shadowSide = this.shadowSide;
    if (this.sizeAttenuation !== undefined) data.sizeAttenuation = this.sizeAttenuation;
    if (this.blending !== NormalBlending) data.blending = this.blending;
    if (this.side !== FrontSide) data.side = this.side;
    if (this.vertexColors === true) data.vertexColors = true;
    if (this.opacity < 1) data.opacity = this.opacity;
    if (this.transparent === true) data.transparent = true;
    if (this.blendSrc !== SrcAlphaFactor) data.blendSrc = this.blendSrc;
    if (this.blendDst !== OneMinusSrcAlphaFactor) data.blendDst = this.blendDst;
    if (this.blendEquation !== AddEquation) data.blendEquation = this.blendEquation;
    if (this.blendSrcAlpha !== null) data.blendSrcAlpha = this.blendSrcAlpha;
    if (this.blendDstAlpha !== null) data.blendDstAlpha = this.blendDstAlpha;
    if (this.blendEquationAlpha !== null) data.blendEquationAlpha = this.blendEquationAlpha;
    if (this.blendColor && this.blendColor.isColor) data.blendColor = this.blendColor.getHex();
    if (this.blendAlpha !== 0) data.blendAlpha = this.blendAlpha;
    if (this.depthFunc !== LessEqualDepth) data.depthFunc = this.depthFunc;
    if (this.depthTest === false) data.depthTest = this.depthTest;
    if (this.depthWrite === false) data.depthWrite = this.depthWrite;
    if (this.colorWrite === false) data.colorWrite = this.colorWrite;
    if (this.stencilWriteMask !== 0xff) data.stencilWriteMask = this.stencilWriteMask;
    if (this.stencilFunc !== AlwaysStencilFunc) data.stencilFunc = this.stencilFunc;
    if (this.stencilRef !== 0) data.stencilRef = this.stencilRef;
    if (this.stencilFuncMask !== 0xff) data.stencilFuncMask = this.stencilFuncMask;
    if (this.stencilFail !== KeepStencilOp) data.stencilFail = this.stencilFail;
    if (this.stencilZFail !== KeepStencilOp) data.stencilZFail = this.stencilZFail;
    if (this.stencilZPass !== KeepStencilOp) data.stencilZPass = this.stencilZPass;
    if (this.stencilWrite === true) data.stencilWrite = this.stencilWrite;

    // rotation (SpriteMaterial)
    if (this.rotation !== undefined && this.rotation !== 0) data.rotation = this.rotation;
    if (this.polygonOffset === true) data.polygonOffset = true;
    if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor;
    if (this.polygonOffsetUnits !== 0) data.polygonOffsetUnits = this.polygonOffsetUnits;
    if (this.linewidth !== undefined && this.linewidth !== 1) data.linewidth = this.linewidth;
    if (this.dashSize !== undefined) data.dashSize = this.dashSize;
    if (this.gapSize !== undefined) data.gapSize = this.gapSize;
    if (this.scale !== undefined) data.scale = this.scale;
    if (this.dithering === true) data.dithering = true;
    if (this.alphaTest > 0) data.alphaTest = this.alphaTest;
    if (this.alphaHash === true) data.alphaHash = true;
    if (this.alphaToCoverage === true) data.alphaToCoverage = true;
    if (this.premultipliedAlpha === true) data.premultipliedAlpha = true;
    if (this.forceSinglePass === true) data.forceSinglePass = true;
    if (this.wireframe === true) data.wireframe = true;
    if (this.wireframeLinewidth > 1) data.wireframeLinewidth = this.wireframeLinewidth;
    if (this.wireframeLinecap !== 'round') data.wireframeLinecap = this.wireframeLinecap;
    if (this.wireframeLinejoin !== 'round') data.wireframeLinejoin = this.wireframeLinejoin;
    if (this.flatShading === true) data.flatShading = true;
    if (this.visible === false) data.visible = false;
    if (this.toneMapped === false) data.toneMapped = false;
    if (this.fog === false) data.fog = false;
    if (Object.keys(this.userData).length > 0) data.userData = this.userData;

    // TODO: Copied from Object3D.toJSON

    function extractFromCache(cache) {
      const values = [];
      for (const key in cache) {
        const data = cache[key];
        delete data.metadata;
        values.push(data);
      }
      return values;
    }
    if (isRootObject) {
      const textures = extractFromCache(meta.textures);
      const images = extractFromCache(meta.images);
      if (textures.length > 0) data.textures = textures;
      if (images.length > 0) data.images = images;
    }
    return data;
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(source) {
    this.name = source.name;
    this.blending = source.blending;
    this.side = source.side;
    this.vertexColors = source.vertexColors;
    this.opacity = source.opacity;
    this.transparent = source.transparent;
    this.blendSrc = source.blendSrc;
    this.blendDst = source.blendDst;
    this.blendEquation = source.blendEquation;
    this.blendSrcAlpha = source.blendSrcAlpha;
    this.blendDstAlpha = source.blendDstAlpha;
    this.blendEquationAlpha = source.blendEquationAlpha;
    this.blendColor.copy(source.blendColor);
    this.blendAlpha = source.blendAlpha;
    this.depthFunc = source.depthFunc;
    this.depthTest = source.depthTest;
    this.depthWrite = source.depthWrite;
    this.stencilWriteMask = source.stencilWriteMask;
    this.stencilFunc = source.stencilFunc;
    this.stencilRef = source.stencilRef;
    this.stencilFuncMask = source.stencilFuncMask;
    this.stencilFail = source.stencilFail;
    this.stencilZFail = source.stencilZFail;
    this.stencilZPass = source.stencilZPass;
    this.stencilWrite = source.stencilWrite;
    const srcPlanes = source.clippingPlanes;
    let dstPlanes = null;
    if (srcPlanes !== null) {
      const n = srcPlanes.length;
      dstPlanes = new Array(n);
      for (let i = 0; i !== n; ++i) {
        dstPlanes[i] = srcPlanes[i].clone();
      }
    }
    this.clippingPlanes = dstPlanes;
    this.clipIntersection = source.clipIntersection;
    this.clipShadows = source.clipShadows;
    this.shadowSide = source.shadowSide;
    this.colorWrite = source.colorWrite;
    this.precision = source.precision;
    this.polygonOffset = source.polygonOffset;
    this.polygonOffsetFactor = source.polygonOffsetFactor;
    this.polygonOffsetUnits = source.polygonOffsetUnits;
    this.dithering = source.dithering;
    this.alphaTest = source.alphaTest;
    this.alphaHash = source.alphaHash;
    this.alphaToCoverage = source.alphaToCoverage;
    this.premultipliedAlpha = source.premultipliedAlpha;
    this.forceSinglePass = source.forceSinglePass;
    this.visible = source.visible;
    this.toneMapped = source.toneMapped;
    this.userData = JSON.parse(JSON.stringify(source.userData));
    return this;
  }
  dispose() {
    this.dispatchEvent({
      type: 'dispose'
    });
  }
  set needsUpdate(value) {
    if (value === true) this.version++;
  }
  onBuild(/* shaderobject, renderer */
  ) {
    console.warn('Material: onBuild() has been removed.'); // @deprecated, r166
  }
}

const materialRefractionRatio = /*@__PURE__*/uniform(0).onReference(({
  material
}) => material).onRenderUpdate(({
  material
}) => material.refractionRatio);

const reflectView = /*@__PURE__*/positionViewDirection.negate().reflect(transformedNormalView);
const refractView = /*@__PURE__*/positionViewDirection.negate().refract(transformedNormalView, materialRefractionRatio);
const reflectVector = /*@__PURE__*/reflectView.transformDirection(cameraViewMatrix).toVar('reflectVector');
const refractVector = /*@__PURE__*/refractView.transformDirection(cameraViewMatrix).toVar('reflectVector');

class CubeTextureNode extends TextureNode {
  constructor(value, uvNode = null, levelNode = null, biasNode = null) {
    super(value, uvNode, levelNode, biasNode);
    this.isCubeTextureNode = true;
  }
  getInputType(/*builder*/
  ) {
    return 'cubeTexture';
  }
  getDefaultUV() {
    const texture = this.value;
    if (texture.mapping === CubeReflectionMapping) {
      return reflectVector;
    } else if (texture.mapping === CubeRefractionMapping) {
      return refractVector;
    } else {
      console.error('THREE.CubeTextureNode: Mapping "%s" not supported.', texture.mapping);
      return vec3(0, 0, 0);
    }
  }
  setUpdateMatrix(/*updateMatrix*/) {} // Ignore .updateMatrix for CubeTextureNode

  setupUV(builder, uvNode) {
    const texture = this.value;
    if (builder.renderer.coordinateSystem === WebGPUCoordinateSystem || !texture.isRenderTargetTexture) {
      return vec3(uvNode.x.negate(), uvNode.yz);
    } else {
      return uvNode;
    }
  }
  generateUV(builder, cubeUV) {
    return cubeUV.build(builder, 'vec3');
  }
}
CubeTextureNode.type = /*@__PURE__*/registerNode('CubeTexture', CubeTextureNode);
const cubeTexture = /*@__PURE__*/nodeProxy(CubeTextureNode);

class BufferNode extends UniformNode {
  constructor(value, bufferType, bufferCount = 0) {
    super(value, bufferType);
    this.isBufferNode = true;
    this.bufferType = bufferType;
    this.bufferCount = bufferCount;
  }
  getElementType(builder) {
    return this.getNodeType(builder);
  }
  getInputType(/*builder*/
  ) {
    return 'buffer';
  }
}
BufferNode.type = /*@__PURE__*/registerNode('Buffer', BufferNode);
const buffer = (value, type, count) => nodeObject(new BufferNode(value, type, count));

class UniformArrayElementNode extends ArrayElementNode {
  constructor(arrayBuffer, indexNode) {
    super(arrayBuffer, indexNode);
    this.isArrayBufferElementNode = true;
  }
  getNodeType(builder) {
    return this.node.getElementType(builder);
  }
  generate(builder) {
    const snippet = super.generate(builder);
    const type = this.getNodeType();
    return builder.format(snippet, 'vec4', type);
  }
}
class UniformArrayNode extends BufferNode {
  constructor(value, elementType = null) {
    super(null, 'vec4');
    this.array = value;
    this.elementType = elementType;
    this._elementType = null;
    this._elementLength = 0;
    this.updateType = NodeUpdateType.RENDER;
    this.isArrayBufferNode = true;
  }
  getElementType() {
    return this.elementType || this._elementType;
  }
  getElementLength() {
    return this._elementLength;
  }
  update(/*frame*/
  ) {
    const {
      array,
      value
    } = this;
    const elementLength = this.getElementLength();
    const elementType = this.getElementType();
    if (elementLength === 1) {
      for (let i = 0; i < array.length; i++) {
        const index = i * 4;
        value[index] = array[i];
      }
    } else if (elementType === 'color') {
      for (let i = 0; i < array.length; i++) {
        const index = i * 4;
        const vector = array[i];
        value[index] = vector.r;
        value[index + 1] = vector.g;
        value[index + 2] = vector.b || 0;
        //value[ index + 3 ] = vector.a || 0;
      }
    } else {
      for (let i = 0; i < array.length; i++) {
        const index = i * 4;
        const vector = array[i];
        value[index] = vector.x;
        value[index + 1] = vector.y;
        value[index + 2] = vector.z || 0;
        value[index + 3] = vector.w || 0;
      }
    }
  }
  setup(builder) {
    const length = this.array.length;
    this._elementType = this.elementType === null ? getValueType(this.array[0]) : this.elementType;
    this._elementLength = builder.getTypeLength(this._elementType);
    let arrayType = Float32Array;
    if (this._elementType.charAt(0) === 'i') arrayType = Int32Array;else if (this._elementType.charAt(0) === 'u') arrayType = Uint32Array;
    this.value = new arrayType(length * 4);
    this.bufferCount = length;
    this.bufferType = builder.changeComponentType('vec4', builder.getComponentType(this._elementType));
    return super.setup(builder);
  }
  element(indexNode) {
    return nodeObject(new UniformArrayElementNode(this, nodeObject(indexNode)));
  }
}
UniformArrayNode.type = /*@__PURE__*/registerNode('UniformArray', UniformArrayNode);
const uniformArray = (values, nodeType) => nodeObject(new UniformArrayNode(values, nodeType));

class ReferenceElementNode extends ArrayElementNode {
  constructor(referenceNode, indexNode) {
    super(referenceNode, indexNode);
    this.referenceNode = referenceNode;
    this.isReferenceElementNode = true;
  }
  getNodeType() {
    return this.referenceNode.uniformType;
  }
  generate(builder) {
    const snippet = super.generate(builder);
    const arrayType = this.referenceNode.getNodeType();
    const elementType = this.getNodeType();
    return builder.format(snippet, arrayType, elementType);
  }
}

// TODO: Extends this from ReferenceBaseNode
class ReferenceNode extends Node$1 {
  constructor(property, uniformType, object = null, count = null) {
    super();
    this.property = property;
    this.uniformType = uniformType;
    this.object = object;
    this.count = count;
    this.properties = property.split('.');
    this.reference = object;
    this.node = null;
    this.updateType = NodeUpdateType.OBJECT;
  }
  element(indexNode) {
    return nodeObject(new ReferenceElementNode(this, nodeObject(indexNode)));
  }
  setNodeType(uniformType) {
    let node = null;
    if (this.count !== null) {
      node = buffer(null, uniformType, this.count);
    } else if (Array.isArray(this.getValueFromReference())) {
      node = uniformArray(null, uniformType);
    } else if (uniformType === 'texture') {
      node = texture(null);
    } else if (uniformType === 'cubeTexture') {
      node = cubeTexture(null);
    } else {
      node = uniform(null, uniformType);
    }
    this.node = node.getSelf();
  }
  getNodeType(builder) {
    if (this.node === null) {
      this.updateValue();
    }
    return this.node.getNodeType(builder);
  }
  getValueFromReference(object = this.reference) {
    const {
      properties
    } = this;
    let value = object[properties[0]];
    for (let i = 1; i < properties.length; i++) {
      value = value[properties[i]];
    }
    return value;
  }
  updateReference(state) {
    this.reference = this.object !== null ? this.object : state.object;
    return this.reference;
  }
  setup() {
    this.updateValue();
    return this.node;
  }
  update(/*frame*/
  ) {
    this.updateValue();
  }
  updateValue() {
    if (this.node === null) this.setNodeType(this.uniformType);
    const value = this.getValueFromReference();
    if (Array.isArray(value)) {
      this.node.array = value;
    } else {
      this.node.value = value;
    }
  }
}
ReferenceNode.type = /*@__PURE__*/registerNode('Reference', ReferenceNode);
const reference = (name, type, object) => nodeObject(new ReferenceNode(name, type, object));
const referenceBuffer = (name, type, count, object) => nodeObject(new ReferenceNode(name, type, object, count));

class MaterialReferenceNode extends ReferenceNode {
  constructor(property, inputType, material = null) {
    super(property, inputType, material);
    this.material = material;

    //this.updateType = NodeUpdateType.RENDER;

    this.isMaterialReferenceNode = true;
  }

  /*setNodeType( node ) {
  		super.setNodeType( node );
  		this.node.groupNode = renderGroup;
  	}*/

  updateReference(state) {
    this.reference = this.material !== null ? this.material : state.material;
    return this.reference;
  }
}
MaterialReferenceNode.type = /*@__PURE__*/registerNode('MaterialReference', MaterialReferenceNode);
const materialReference = (name, type, material) => nodeObject(new MaterialReferenceNode(name, type, material));

const tangentGeometry = /*@__PURE__*/Fn(builder => {
  if (builder.geometry.hasAttribute('tangent') === false) {
    builder.geometry.computeTangents();
  }
  return attribute('tangent', 'vec4');
})();
const tangentLocal = /*@__PURE__*/tangentGeometry.xyz.toVar('tangentLocal');
const tangentView = /*@__PURE__*/modelViewMatrix.mul(vec4(tangentLocal, 0)).xyz.varying('v_tangentView').normalize().toVar('tangentView');

const getBitangent = crossNormalTangent => crossNormalTangent.mul(tangentGeometry.w).xyz;
const bitangentView = /*@__PURE__*/varying(getBitangent(normalView.cross(tangentView)), 'v_bitangentView').normalize().toVar('bitangentView');

const TBNViewMatrix = /*@__PURE__*/mat3(tangentView, bitangentView, normalView);

// Normal Mapping Without Precomputed Tangents
// http://www.thetenthplanet.de/archives/1180

const perturbNormal2Arb = /*@__PURE__*/Fn(inputs => {
  const {
    eye_pos,
    surf_norm,
    mapN,
    uv
  } = inputs;
  const q0 = eye_pos.dFdx();
  const q1 = eye_pos.dFdy();
  const st0 = uv.dFdx();
  const st1 = uv.dFdy();
  const N = surf_norm; // normalized

  const q1perp = q1.cross(N);
  const q0perp = N.cross(q0);
  const T = q1perp.mul(st0.x).add(q0perp.mul(st1.x));
  const B = q1perp.mul(st0.y).add(q0perp.mul(st1.y));
  const det = T.dot(T).max(B.dot(B));
  const scale = faceDirection.mul(det.inverseSqrt());
  return add(T.mul(mapN.x, scale), B.mul(mapN.y, scale), N.mul(mapN.z)).normalize();
});
class NormalMapNode extends TempNode {
  constructor(node, scaleNode = null) {
    super('vec3');
    this.node = node;
    this.scaleNode = scaleNode;
    this.normalMapType = TangentSpaceNormalMap;
  }
  setup(builder) {
    const {
      normalMapType,
      scaleNode
    } = this;
    let normalMap = this.node.mul(2.0).sub(1.0);
    if (scaleNode !== null) {
      normalMap = vec3(normalMap.xy.mul(scaleNode), normalMap.z);
    }
    let outputNode = null;
    if (normalMapType === ObjectSpaceNormalMap) {
      outputNode = modelNormalMatrix.mul(normalMap).normalize();
    } else if (normalMapType === TangentSpaceNormalMap) {
      const tangent = builder.hasGeometryAttribute('tangent');
      if (tangent === true) {
        outputNode = TBNViewMatrix.mul(normalMap).normalize();
      } else {
        outputNode = perturbNormal2Arb({
          eye_pos: positionView,
          surf_norm: normalView,
          mapN: normalMap,
          uv: uv()
        });
      }
    }
    return outputNode;
  }
}
NormalMapNode.type = /*@__PURE__*/registerNode('NormalMap', NormalMapNode);
const normalMap = /*@__PURE__*/nodeProxy(NormalMapNode);

// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen
// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf

const dHdxy_fwd = Fn(({
  textureNode,
  bumpScale
}) => {
  // It's used to preserve the same TextureNode instance
  const sampleTexture = callback => textureNode.cache().context({
    getUV: texNode => callback(texNode.uvNode || uv()),
    forceUVContext: true
  });
  const Hll = float(sampleTexture(uvNode => uvNode));
  return vec2(float(sampleTexture(uvNode => uvNode.add(uvNode.dFdx()))).sub(Hll), float(sampleTexture(uvNode => uvNode.add(uvNode.dFdy()))).sub(Hll)).mul(bumpScale);
});

// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)

const perturbNormalArb = Fn(inputs => {
  const {
    surf_pos,
    surf_norm,
    dHdxy
  } = inputs;

  // normalize is done to ensure that the bump map looks the same regardless of the texture's scale
  const vSigmaX = surf_pos.dFdx().normalize();
  const vSigmaY = surf_pos.dFdy().normalize();
  const vN = surf_norm; // normalized

  const R1 = vSigmaY.cross(vN);
  const R2 = vN.cross(vSigmaX);
  const fDet = vSigmaX.dot(R1).mul(faceDirection);
  const vGrad = fDet.sign().mul(dHdxy.x.mul(R1).add(dHdxy.y.mul(R2)));
  return fDet.abs().mul(surf_norm).sub(vGrad).normalize();
});
class BumpMapNode extends TempNode {
  constructor(textureNode, scaleNode = null) {
    super('vec3');
    this.textureNode = textureNode;
    this.scaleNode = scaleNode;
  }
  setup() {
    const bumpScale = this.scaleNode !== null ? this.scaleNode : 1;
    const dHdxy = dHdxy_fwd({
      textureNode: this.textureNode,
      bumpScale
    });
    return perturbNormalArb({
      surf_pos: positionView,
      surf_norm: normalView,
      dHdxy
    });
  }
}
const bumpMap = /*@__PURE__*/nodeProxy(BumpMapNode);

const _propertyCache = new Map();
class MaterialNode extends Node$1 {
  constructor(scope) {
    super();
    this.scope = scope;
  }
  getCache(property, type) {
    let node = _propertyCache.get(property);
    if (node === undefined) {
      node = materialReference(property, type);
      _propertyCache.set(property, node);
    }
    return node;
  }
  getFloat(property) {
    return this.getCache(property, 'float');
  }
  getColor(property) {
    return this.getCache(property, 'color');
  }
  getTexture(property) {
    return this.getCache(property === 'map' ? 'map' : property + 'Map', 'texture');
  }
  setup(builder) {
    const material = builder.context.material;
    const scope = this.scope;
    let node = null;
    if (scope === MaterialNode.COLOR) {
      const colorNode = material.color !== undefined ? this.getColor(scope) : vec3();
      if (material.map && material.map.isTexture === true) {
        node = colorNode.mul(this.getTexture('map'));
      } else {
        node = colorNode;
      }
    } else if (scope === MaterialNode.OPACITY) {
      const opacityNode = this.getFloat(scope);
      if (material.alphaMap && material.alphaMap.isTexture === true) {
        node = opacityNode.mul(this.getTexture('alpha'));
      } else {
        node = opacityNode;
      }
    } else if (scope === MaterialNode.SPECULAR_STRENGTH) {
      if (material.specularMap && material.specularMap.isTexture === true) {
        node = this.getTexture('specular').r;
      } else {
        node = float(1);
      }
    } else if (scope === MaterialNode.SPECULAR_INTENSITY) {
      const specularIntensity = this.getFloat(scope);
      if (material.specularMap) {
        node = specularIntensity.mul(this.getTexture(scope).a);
      } else {
        node = specularIntensity;
      }
    } else if (scope === MaterialNode.SPECULAR_COLOR) {
      const specularColorNode = this.getColor(scope);
      if (material.specularColorMap && material.specularColorMap.isTexture === true) {
        node = specularColorNode.mul(this.getTexture(scope).rgb);
      } else {
        node = specularColorNode;
      }
    } else if (scope === MaterialNode.ROUGHNESS) {
      // TODO: cleanup similar branches

      const roughnessNode = this.getFloat(scope);
      if (material.roughnessMap && material.roughnessMap.isTexture === true) {
        node = roughnessNode.mul(this.getTexture(scope).g);
      } else {
        node = roughnessNode;
      }
    } else if (scope === MaterialNode.METALNESS) {
      const metalnessNode = this.getFloat(scope);
      if (material.metalnessMap && material.metalnessMap.isTexture === true) {
        node = metalnessNode.mul(this.getTexture(scope).b);
      } else {
        node = metalnessNode;
      }
    } else if (scope === MaterialNode.EMISSIVE) {
      const emissiveIntensityNode = this.getFloat('emissiveIntensity');
      const emissiveNode = this.getColor(scope).mul(emissiveIntensityNode);
      if (material.emissiveMap && material.emissiveMap.isTexture === true) {
        node = emissiveNode.mul(this.getTexture(scope));
      } else {
        node = emissiveNode;
      }
    } else if (scope === MaterialNode.NORMAL) {
      if (material.normalMap) {
        node = normalMap(this.getTexture('normal'), this.getCache('normalScale', 'vec2'));
      } else if (material.bumpMap) {
        node = bumpMap(this.getTexture('bump').r, this.getFloat('bumpScale'));
      } else {
        node = normalView;
      }
    } else if (scope === MaterialNode.CLEARCOAT) {
      const clearcoatNode = this.getFloat(scope);
      if (material.clearcoatMap && material.clearcoatMap.isTexture === true) {
        node = clearcoatNode.mul(this.getTexture(scope).r);
      } else {
        node = clearcoatNode;
      }
    } else if (scope === MaterialNode.CLEARCOAT_ROUGHNESS) {
      const clearcoatRoughnessNode = this.getFloat(scope);
      if (material.clearcoatRoughnessMap && material.clearcoatRoughnessMap.isTexture === true) {
        node = clearcoatRoughnessNode.mul(this.getTexture(scope).r);
      } else {
        node = clearcoatRoughnessNode;
      }
    } else if (scope === MaterialNode.CLEARCOAT_NORMAL) {
      if (material.clearcoatNormalMap) {
        node = normalMap(this.getTexture(scope), this.getCache(scope + 'Scale', 'vec2'));
      } else {
        node = normalView;
      }
    } else if (scope === MaterialNode.SHEEN) {
      const sheenNode = this.getColor('sheenColor').mul(this.getFloat('sheen')); // Move this mul() to CPU

      if (material.sheenColorMap && material.sheenColorMap.isTexture === true) {
        node = sheenNode.mul(this.getTexture('sheenColor').rgb);
      } else {
        node = sheenNode;
      }
    } else if (scope === MaterialNode.SHEEN_ROUGHNESS) {
      const sheenRoughnessNode = this.getFloat(scope);
      if (material.sheenRoughnessMap && material.sheenRoughnessMap.isTexture === true) {
        node = sheenRoughnessNode.mul(this.getTexture(scope).a);
      } else {
        node = sheenRoughnessNode;
      }
      node = node.clamp(0.07, 1.0);
    } else if (scope === MaterialNode.ANISOTROPY) {
      if (material.anisotropyMap && material.anisotropyMap.isTexture === true) {
        const anisotropyPolar = this.getTexture(scope);
        const anisotropyMat = mat2(materialAnisotropyVector.x, materialAnisotropyVector.y, materialAnisotropyVector.y.negate(), materialAnisotropyVector.x);
        node = anisotropyMat.mul(anisotropyPolar.rg.mul(2.0).sub(vec2(1.0)).normalize().mul(anisotropyPolar.b));
      } else {
        node = materialAnisotropyVector;
      }
    } else if (scope === MaterialNode.IRIDESCENCE_THICKNESS) {
      const iridescenceThicknessMaximum = reference('1', 'float', material.iridescenceThicknessRange);
      if (material.iridescenceThicknessMap) {
        const iridescenceThicknessMinimum = reference('0', 'float', material.iridescenceThicknessRange);
        node = iridescenceThicknessMaximum.sub(iridescenceThicknessMinimum).mul(this.getTexture(scope).g).add(iridescenceThicknessMinimum);
      } else {
        node = iridescenceThicknessMaximum;
      }
    } else if (scope === MaterialNode.TRANSMISSION) {
      const transmissionNode = this.getFloat(scope);
      if (material.transmissionMap) {
        node = transmissionNode.mul(this.getTexture(scope).r);
      } else {
        node = transmissionNode;
      }
    } else if (scope === MaterialNode.THICKNESS) {
      const thicknessNode = this.getFloat(scope);
      if (material.thicknessMap) {
        node = thicknessNode.mul(this.getTexture(scope).g);
      } else {
        node = thicknessNode;
      }
    } else if (scope === MaterialNode.IOR) {
      node = this.getFloat(scope);
    } else if (scope === MaterialNode.LIGHT_MAP) {
      node = this.getTexture(scope).rgb.mul(this.getFloat('lightMapIntensity'));
    } else if (scope === MaterialNode.AO_MAP) {
      node = this.getTexture(scope).r.sub(1.0).mul(this.getFloat('aoMapIntensity')).add(1.0);
    } else {
      const outputType = this.getNodeType(builder);
      node = this.getCache(scope, outputType);
    }
    return node;
  }
}
MaterialNode.ALPHA_TEST = 'alphaTest';
MaterialNode.COLOR = 'color';
MaterialNode.OPACITY = 'opacity';
MaterialNode.SHININESS = 'shininess';
MaterialNode.SPECULAR = 'specular';
MaterialNode.SPECULAR_STRENGTH = 'specularStrength';
MaterialNode.SPECULAR_INTENSITY = 'specularIntensity';
MaterialNode.SPECULAR_COLOR = 'specularColor';
MaterialNode.REFLECTIVITY = 'reflectivity';
MaterialNode.ROUGHNESS = 'roughness';
MaterialNode.METALNESS = 'metalness';
MaterialNode.NORMAL = 'normal';
MaterialNode.CLEARCOAT = 'clearcoat';
MaterialNode.CLEARCOAT_ROUGHNESS = 'clearcoatRoughness';
MaterialNode.CLEARCOAT_NORMAL = 'clearcoatNormal';
MaterialNode.EMISSIVE = 'emissive';
MaterialNode.ROTATION = 'rotation';
MaterialNode.SHEEN = 'sheen';
MaterialNode.SHEEN_ROUGHNESS = 'sheenRoughness';
MaterialNode.ANISOTROPY = 'anisotropy';
MaterialNode.IRIDESCENCE = 'iridescence';
MaterialNode.IRIDESCENCE_IOR = 'iridescenceIOR';
MaterialNode.IRIDESCENCE_THICKNESS = 'iridescenceThickness';
MaterialNode.IOR = 'ior';
MaterialNode.TRANSMISSION = 'transmission';
MaterialNode.THICKNESS = 'thickness';
MaterialNode.ATTENUATION_DISTANCE = 'attenuationDistance';
MaterialNode.ATTENUATION_COLOR = 'attenuationColor';
MaterialNode.LINE_SCALE = 'scale';
MaterialNode.LINE_DASH_SIZE = 'dashSize';
MaterialNode.LINE_GAP_SIZE = 'gapSize';
MaterialNode.LINE_WIDTH = 'linewidth';
MaterialNode.LINE_DASH_OFFSET = 'dashOffset';
MaterialNode.POINT_WIDTH = 'pointWidth';
MaterialNode.DISPERSION = 'dispersion';
MaterialNode.LIGHT_MAP = 'light';
MaterialNode.AO_MAP = 'ao';
MaterialNode.type = /*@__PURE__*/registerNode('Material', MaterialNode);
const materialAlphaTest = /*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.ALPHA_TEST);
const materialColor = /*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.COLOR);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.SHININESS);
const materialEmissive = /*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.EMISSIVE);
const materialOpacity = /*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.OPACITY);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.SPECULAR);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.SPECULAR_INTENSITY);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.SPECULAR_COLOR);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.SPECULAR_STRENGTH);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.REFLECTIVITY);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.ROUGHNESS);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.METALNESS);
const materialNormal = /*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.NORMAL).context({
  getUV: null
});
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.CLEARCOAT);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.CLEARCOAT_ROUGHNESS);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.ROTATION);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.SHEEN);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.SHEEN_ROUGHNESS);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.ANISOTROPY);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.IRIDESCENCE);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.IRIDESCENCE_IOR);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.IRIDESCENCE_THICKNESS);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.TRANSMISSION);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.THICKNESS);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.IOR);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.ATTENUATION_DISTANCE);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.ATTENUATION_COLOR);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.LINE_SCALE);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.LINE_DASH_SIZE);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.LINE_GAP_SIZE);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.LINE_WIDTH);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.LINE_DASH_OFFSET);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.POINT_WIDTH);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.DISPERSION);
const materialLightMap = /*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.LIGHT_MAP);
const materialAOMap = /*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.AO_MAP);
/*@__PURE__*/nodeImmutable(MaterialNode, MaterialNode.REFRACTION_RATIO);
const materialAnisotropyVector = /*@__PURE__*/uniform(new Vector2()).onReference(function (frame) {
  return frame.material;
}).onRenderUpdate(function ({
  material
}) {
  this.value.set(material.anisotropy * Math.cos(material.anisotropyRotation), material.anisotropy * Math.sin(material.anisotropyRotation));
});

class ModelViewProjectionNode extends TempNode {
  constructor(positionNode = null) {
    super('vec4');
    this.positionNode = positionNode;
  }
  setup(builder) {
    if (builder.shaderStage === 'fragment') {
      return varying(builder.context.mvp);
    }
    const position = this.positionNode || positionLocal;
    return cameraProjectionMatrix.mul(modelViewMatrix).mul(position);
  }
}
ModelViewProjectionNode.type = /*@__PURE__*/registerNode('ModelViewProjection', ModelViewProjectionNode);
const modelViewProjection = /*@__PURE__*/nodeProxy(ModelViewProjectionNode);

class InstancedInterleavedBuffer extends InterleavedBuffer {
  constructor(array, stride, meshPerAttribute = 1) {
    super(array, stride);
    this.isInstancedInterleavedBuffer = true;
    this.meshPerAttribute = meshPerAttribute;
  }
  copy(source) {
    super.copy(source);
    this.meshPerAttribute = source.meshPerAttribute;
    return this;
  }
  clone(data) {
    const ib = super.clone(data);
    ib.meshPerAttribute = this.meshPerAttribute;
    return ib;
  }
  toJSON(data) {
    const json = super.toJSON(data);
    json.isInstancedInterleavedBuffer = true;
    json.meshPerAttribute = this.meshPerAttribute;
    return json;
  }
}

class InstancedBufferAttribute extends BufferAttribute {
  constructor(array, itemSize, normalized, meshPerAttribute = 1) {
    super(array, itemSize, normalized);
    this.isInstancedBufferAttribute = true;
    this.meshPerAttribute = meshPerAttribute;
  }
  copy(source) {
    super.copy(source);
    this.meshPerAttribute = source.meshPerAttribute;
    return this;
  }
  toJSON() {
    const data = super.toJSON();
    data.meshPerAttribute = this.meshPerAttribute;
    data.isInstancedBufferAttribute = true;
    return data;
  }
}

class InstanceNode extends Node$1 {
  constructor(instanceMesh) {
    super('void');
    this.instanceMesh = instanceMesh;
    this.instanceMatrixNode = null;
    this.instanceColorNode = null;
    this.updateType = NodeUpdateType.FRAME;
    this.buffer = null;
    this.bufferColor = null;
  }
  setup(builder) {
    let instanceMatrixNode = this.instanceMatrixNode;
    let instanceColorNode = this.instanceColorNode;
    const instanceMesh = this.instanceMesh;
    if (instanceMatrixNode === null) {
      const instanceAttribute = instanceMesh.instanceMatrix;

      // Both WebGPU and WebGL backends have UBO max limited to 64kb. Matrix count number bigger than 1000 ( 16 * 4 * 1000 = 64kb ) will fallback to attribute.

      if (instanceMesh.count <= 1000) {
        instanceMatrixNode = buffer(instanceAttribute.array, 'mat4', instanceMesh.count).element(instanceIndex);
      } else {
        const buffer = new InstancedInterleavedBuffer(instanceAttribute.array, 16, 1);
        this.buffer = buffer;
        const bufferFn = instanceAttribute.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
        const instanceBuffers = [
        // F.Signature -> bufferAttribute( array, type, stride, offset )
        bufferFn(buffer, 'vec4', 16, 0), bufferFn(buffer, 'vec4', 16, 4), bufferFn(buffer, 'vec4', 16, 8), bufferFn(buffer, 'vec4', 16, 12)];
        instanceMatrixNode = mat4(...instanceBuffers);
      }
      this.instanceMatrixNode = instanceMatrixNode;
    }
    const instanceColorAttribute = instanceMesh.instanceColor;
    if (instanceColorAttribute && instanceColorNode === null) {
      const buffer = new InstancedBufferAttribute(instanceColorAttribute.array, 3);
      const bufferFn = instanceColorAttribute.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
      this.bufferColor = buffer;
      instanceColorNode = vec3(bufferFn(buffer, 'vec3', 3, 0));
      this.instanceColorNode = instanceColorNode;
    }

    // POSITION

    const instancePosition = instanceMatrixNode.mul(positionLocal).xyz;
    positionLocal.assign(instancePosition);

    // NORMAL

    if (builder.hasGeometryAttribute('normal')) {
      const m = mat3(instanceMatrixNode);
      const transformedNormal = normalLocal.div(vec3(m[0].dot(m[0]), m[1].dot(m[1]), m[2].dot(m[2])));
      const instanceNormal = m.mul(transformedNormal).xyz;

      // ASSIGNS

      normalLocal.assign(instanceNormal);
    }

    // COLOR

    if (this.instanceColorNode !== null) {
      varyingProperty('vec3', 'vInstanceColor').assign(this.instanceColorNode);
    }
  }
  update(/*frame*/
  ) {
    if (this.instanceMesh.instanceMatrix.usage !== DynamicDrawUsage && this.buffer != null && this.instanceMesh.instanceMatrix.version !== this.buffer.version) {
      this.buffer.version = this.instanceMesh.instanceMatrix.version;
    }
    if (this.instanceMesh.instanceColor && this.instanceMesh.instanceColor.usage !== DynamicDrawUsage && this.bufferColor != null && this.instanceMesh.instanceColor.version !== this.bufferColor.version) {
      this.bufferColor.version = this.instanceMesh.instanceColor.version;
    }
  }
}
InstanceNode.type = /*@__PURE__*/registerNode('Instance', InstanceNode);
const instance$1 = /*@__PURE__*/nodeProxy(InstanceNode);

class BatchNode extends Node$1 {
  constructor(batchMesh) {
    super('void');
    this.batchMesh = batchMesh;
    this.batchingIdNode = null;
  }
  setup(builder) {
    // POSITION

    if (this.batchingIdNode === null) {
      if (builder.getDrawIndex() === null) {
        this.batchingIdNode = instanceIndex;
      } else {
        this.batchingIdNode = drawIndex;
      }
    }
    const getIndirectIndex = Fn(([id]) => {
      const size = textureSize(textureLoad(this.batchMesh._indirectTexture), 0);
      const x = int$1(id).modInt(int$1(size));
      const y = int$1(id).div(int$1(size));
      return textureLoad(this.batchMesh._indirectTexture, ivec2(x, y)).x;
    }).setLayout({
      name: 'getIndirectIndex',
      type: 'uint',
      inputs: [{
        name: 'id',
        type: 'int'
      }]
    });
    const indirectId = getIndirectIndex(int$1(this.batchingIdNode));
    const matricesTexture = this.batchMesh._matricesTexture;
    const size = textureSize(textureLoad(matricesTexture), 0);
    const j = float(indirectId).mul(4).toInt().toVar();
    const x = j.modInt(size);
    const y = j.div(int$1(size));
    const batchingMatrix = mat4(textureLoad(matricesTexture, ivec2(x, y)), textureLoad(matricesTexture, ivec2(x.add(1), y)), textureLoad(matricesTexture, ivec2(x.add(2), y)), textureLoad(matricesTexture, ivec2(x.add(3), y)));
    const colorsTexture = this.batchMesh._colorsTexture;
    if (colorsTexture !== null) {
      const getBatchingColor = Fn(([id]) => {
        const size = textureSize(textureLoad(colorsTexture), 0).x;
        const j = id;
        const x = j.modInt(size);
        const y = j.div(size);
        return textureLoad(colorsTexture, ivec2(x, y)).rgb;
      }).setLayout({
        name: 'getBatchingColor',
        type: 'vec3',
        inputs: [{
          name: 'id',
          type: 'int'
        }]
      });
      const color = getBatchingColor(indirectId);
      varyingProperty('vec3', 'vBatchColor').assign(color);
    }
    const bm = mat3(batchingMatrix);
    positionLocal.assign(batchingMatrix.mul(positionLocal));
    const transformedNormal = normalLocal.div(vec3(bm[0].dot(bm[0]), bm[1].dot(bm[1]), bm[2].dot(bm[2])));
    const batchingNormal = bm.mul(transformedNormal).xyz;
    normalLocal.assign(batchingNormal);
    if (builder.hasGeometryAttribute('tangent')) {
      tangentLocal.mulAssign(bm);
    }
  }
}
BatchNode.type = /*@__PURE__*/registerNode('Batch', BatchNode);
const batch = /*@__PURE__*/nodeProxy(BatchNode);

const _frameId = new WeakMap();
class SkinningNode extends Node$1 {
  constructor(skinnedMesh, useReference = false) {
    super('void');
    this.skinnedMesh = skinnedMesh;
    this.useReference = useReference;
    this.updateType = NodeUpdateType.OBJECT;

    //

    this.skinIndexNode = attribute('skinIndex', 'uvec4');
    this.skinWeightNode = attribute('skinWeight', 'vec4');
    let bindMatrixNode, bindMatrixInverseNode, boneMatricesNode;
    if (useReference) {
      bindMatrixNode = reference('bindMatrix', 'mat4');
      bindMatrixInverseNode = reference('bindMatrixInverse', 'mat4');
      boneMatricesNode = referenceBuffer('skeleton.boneMatrices', 'mat4', skinnedMesh.skeleton.bones.length);
    } else {
      bindMatrixNode = uniform(skinnedMesh.bindMatrix, 'mat4');
      bindMatrixInverseNode = uniform(skinnedMesh.bindMatrixInverse, 'mat4');
      boneMatricesNode = buffer(skinnedMesh.skeleton.boneMatrices, 'mat4', skinnedMesh.skeleton.bones.length);
    }
    this.bindMatrixNode = bindMatrixNode;
    this.bindMatrixInverseNode = bindMatrixInverseNode;
    this.boneMatricesNode = boneMatricesNode;
    this.previousBoneMatricesNode = null;
  }
  getSkinnedPosition(boneMatrices = this.boneMatricesNode, position = positionLocal) {
    const {
      skinIndexNode,
      skinWeightNode,
      bindMatrixNode,
      bindMatrixInverseNode
    } = this;
    const boneMatX = boneMatrices.element(skinIndexNode.x);
    const boneMatY = boneMatrices.element(skinIndexNode.y);
    const boneMatZ = boneMatrices.element(skinIndexNode.z);
    const boneMatW = boneMatrices.element(skinIndexNode.w);

    // POSITION

    const skinVertex = bindMatrixNode.mul(position);
    const skinned = add(boneMatX.mul(skinWeightNode.x).mul(skinVertex), boneMatY.mul(skinWeightNode.y).mul(skinVertex), boneMatZ.mul(skinWeightNode.z).mul(skinVertex), boneMatW.mul(skinWeightNode.w).mul(skinVertex));
    return bindMatrixInverseNode.mul(skinned).xyz;
  }
  getSkinnedNormal(boneMatrices = this.boneMatricesNode, normal = normalLocal) {
    const {
      skinIndexNode,
      skinWeightNode,
      bindMatrixNode,
      bindMatrixInverseNode
    } = this;
    const boneMatX = boneMatrices.element(skinIndexNode.x);
    const boneMatY = boneMatrices.element(skinIndexNode.y);
    const boneMatZ = boneMatrices.element(skinIndexNode.z);
    const boneMatW = boneMatrices.element(skinIndexNode.w);

    // NORMAL

    let skinMatrix = add(skinWeightNode.x.mul(boneMatX), skinWeightNode.y.mul(boneMatY), skinWeightNode.z.mul(boneMatZ), skinWeightNode.w.mul(boneMatW));
    skinMatrix = bindMatrixInverseNode.mul(skinMatrix).mul(bindMatrixNode);
    return skinMatrix.transformDirection(normal).xyz;
  }
  getPreviousSkinnedPosition(builder) {
    const skinnedMesh = builder.object;
    if (this.previousBoneMatricesNode === null) {
      skinnedMesh.skeleton.previousBoneMatrices = new Float32Array(skinnedMesh.skeleton.boneMatrices);
      this.previousBoneMatricesNode = referenceBuffer('skeleton.previousBoneMatrices', 'mat4', skinnedMesh.skeleton.bones.length);
    }
    return this.getSkinnedPosition(this.previousBoneMatricesNode, positionPrevious);
  }
  needsPreviousBoneMatrices(builder) {
    const mrt = builder.renderer.getMRT();
    return mrt && mrt.has('velocity');
  }
  setup(builder) {
    if (this.needsPreviousBoneMatrices(builder)) {
      positionPrevious.assign(this.getPreviousSkinnedPosition(builder));
    }
    const skinPosition = this.getSkinnedPosition();
    positionLocal.assign(skinPosition);
    if (builder.hasGeometryAttribute('normal')) {
      const skinNormal = this.getSkinnedNormal();
      normalLocal.assign(skinNormal);
      if (builder.hasGeometryAttribute('tangent')) {
        tangentLocal.assign(skinNormal);
      }
    }
  }
  generate(builder, output) {
    if (output !== 'void') {
      return positionLocal.build(builder, output);
    }
  }
  update(frame) {
    const object = this.useReference ? frame.object : this.skinnedMesh;
    const skeleton = object.skeleton;
    if (_frameId.get(skeleton) === frame.frameId) return;
    _frameId.set(skeleton, frame.frameId);
    if (this.previousBoneMatricesNode !== null) skeleton.previousBoneMatrices.set(skeleton.boneMatrices);
    skeleton.update();
  }
}
SkinningNode.type = /*@__PURE__*/registerNode('Skinning', SkinningNode);
const skinningReference = skinnedMesh => nodeObject(new SkinningNode(skinnedMesh, true));

class DataArrayTexture extends Texture {
  constructor(data = null, width = 1, height = 1, depth = 1) {
    super(null);
    this.isDataArrayTexture = true;
    this.image = {
      data,
      width,
      height,
      depth
    };
    this.magFilter = NearestFilter;
    this.minFilter = NearestFilter;
    this.wrapR = ClampToEdgeWrapping;
    this.generateMipmaps = false;
    this.flipY = false;
    this.unpackAlignment = 1;
    this.layerUpdates = new Set();
  }
  addLayerUpdate(layerIndex) {
    this.layerUpdates.add(layerIndex);
  }
  clearLayerUpdates() {
    this.layerUpdates.clear();
  }
}

const _morphTextures = /*@__PURE__*/new WeakMap();
const _morphVec4 = /*@__PURE__*/new Vector4();
const getMorph = /*@__PURE__*/Fn(({
  bufferMap,
  influence,
  stride,
  width,
  depth,
  offset
}) => {
  const texelIndex = int$1(vertexIndex).mul(stride).add(offset);
  const y = texelIndex.div(width);
  const x = texelIndex.sub(y.mul(width));
  const bufferAttrib = textureLoad(bufferMap, ivec2(x, y)).depth(depth);
  return bufferAttrib.mul(influence);
});
function getEntry(geometry) {
  const hasMorphPosition = geometry.morphAttributes.position !== undefined;
  const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
  const hasMorphColors = geometry.morphAttributes.color !== undefined;

  // instead of using attributes, the WebGL 2 code path encodes morph targets
  // into an array of data textures. Each layer represents a single morph target.

  const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
  const morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;
  let entry = _morphTextures.get(geometry);
  if (entry === undefined || entry.count !== morphTargetsCount) {
    if (entry !== undefined) entry.texture.dispose();
    const morphTargets = geometry.morphAttributes.position || [];
    const morphNormals = geometry.morphAttributes.normal || [];
    const morphColors = geometry.morphAttributes.color || [];
    let vertexDataCount = 0;
    if (hasMorphPosition === true) vertexDataCount = 1;
    if (hasMorphNormals === true) vertexDataCount = 2;
    if (hasMorphColors === true) vertexDataCount = 3;
    let width = geometry.attributes.position.count * vertexDataCount;
    let height = 1;
    const maxTextureSize = 4096; // @TODO: Use 'capabilities.maxTextureSize'

    if (width > maxTextureSize) {
      height = Math.ceil(width / maxTextureSize);
      width = maxTextureSize;
    }
    const buffer = new Float32Array(width * height * 4 * morphTargetsCount);
    const bufferTexture = new DataArrayTexture(buffer, width, height, morphTargetsCount);
    bufferTexture.type = FloatType;
    bufferTexture.needsUpdate = true;

    // fill buffer

    const vertexDataStride = vertexDataCount * 4;
    for (let i = 0; i < morphTargetsCount; i++) {
      const morphTarget = morphTargets[i];
      const morphNormal = morphNormals[i];
      const morphColor = morphColors[i];
      const offset = width * height * 4 * i;
      for (let j = 0; j < morphTarget.count; j++) {
        const stride = j * vertexDataStride;
        if (hasMorphPosition === true) {
          _morphVec4.fromBufferAttribute(morphTarget, j);
          buffer[offset + stride + 0] = _morphVec4.x;
          buffer[offset + stride + 1] = _morphVec4.y;
          buffer[offset + stride + 2] = _morphVec4.z;
          buffer[offset + stride + 3] = 0;
        }
        if (hasMorphNormals === true) {
          _morphVec4.fromBufferAttribute(morphNormal, j);
          buffer[offset + stride + 4] = _morphVec4.x;
          buffer[offset + stride + 5] = _morphVec4.y;
          buffer[offset + stride + 6] = _morphVec4.z;
          buffer[offset + stride + 7] = 0;
        }
        if (hasMorphColors === true) {
          _morphVec4.fromBufferAttribute(morphColor, j);
          buffer[offset + stride + 8] = _morphVec4.x;
          buffer[offset + stride + 9] = _morphVec4.y;
          buffer[offset + stride + 10] = _morphVec4.z;
          buffer[offset + stride + 11] = morphColor.itemSize === 4 ? _morphVec4.w : 1;
        }
      }
    }
    entry = {
      count: morphTargetsCount,
      texture: bufferTexture,
      stride: vertexDataCount,
      size: new Vector2(width, height)
    };
    _morphTextures.set(geometry, entry);
    function disposeTexture() {
      bufferTexture.dispose();
      _morphTextures.delete(geometry);
      geometry.removeEventListener('dispose', disposeTexture);
    }
    geometry.addEventListener('dispose', disposeTexture);
  }
  return entry;
}
class MorphNode extends Node$1 {
  constructor(mesh) {
    super('void');
    this.mesh = mesh;
    this.morphBaseInfluence = uniform(1);
    this.updateType = NodeUpdateType.OBJECT;
  }
  setup(builder) {
    const {
      geometry
    } = builder;
    const hasMorphPosition = geometry.morphAttributes.position !== undefined;
    const hasMorphNormals = geometry.hasAttribute('normal') && geometry.morphAttributes.normal !== undefined;
    const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
    const morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;

    // nodes

    const {
      texture: bufferMap,
      stride,
      size
    } = getEntry(geometry);
    if (hasMorphPosition === true) positionLocal.mulAssign(this.morphBaseInfluence);
    if (hasMorphNormals === true) normalLocal.mulAssign(this.morphBaseInfluence);
    const width = int$1(size.width);
    Loop(morphTargetsCount, ({
      i
    }) => {
      const influence = float(0).toVar();
      if (this.mesh.count > 1 && this.mesh.morphTexture !== null && this.mesh.morphTexture !== undefined) {
        influence.assign(textureLoad(this.mesh.morphTexture, ivec2(int$1(i).add(1), int$1(instanceIndex))).r);
      } else {
        influence.assign(reference('morphTargetInfluences', 'float').element(i).toVar());
      }
      if (hasMorphPosition === true) {
        positionLocal.addAssign(getMorph({
          bufferMap,
          influence,
          stride,
          width,
          depth: i,
          offset: int$1(0)
        }));
      }
      if (hasMorphNormals === true) {
        normalLocal.addAssign(getMorph({
          bufferMap,
          influence,
          stride,
          width,
          depth: i,
          offset: int$1(1)
        }));
      }
    });
  }
  update() {
    const morphBaseInfluence = this.morphBaseInfluence;
    if (this.mesh.geometry.morphTargetsRelative) {
      morphBaseInfluence.value = 1;
    } else {
      morphBaseInfluence.value = 1 - this.mesh.morphTargetInfluences.reduce((a, b) => a + b, 0);
    }
  }
}
MorphNode.type = /*@__PURE__*/registerNode('Morph', MorphNode);
const morphReference = /*@__PURE__*/nodeProxy(MorphNode);

const sortLights = lights => {
  return lights.sort((a, b) => a.id - b.id);
};
const getLightNodeById = (id, lightNodes) => {
  for (const lightNode of lightNodes) {
    if (lightNode.isAnalyticLightNode && lightNode.light.id === id) {
      return lightNode;
    }
  }
  return null;
};
class LightsNode extends Node$1 {
  constructor(lights = []) {
    super('vec3');
    this.totalDiffuseNode = vec3().toVar('totalDiffuse');
    this.totalSpecularNode = vec3().toVar('totalSpecular');
    this.outgoingLightNode = vec3().toVar('outgoingLight');
    this._lights = lights;
    this._lightNodes = null;
    this._lightNodesHash = null;
    this.global = true;
  }
  getHash(builder) {
    if (this._lightNodesHash === null) {
      if (this._lightNodes === null) this.setupLightsNode(builder);
      const hash = [];
      for (const lightNode of this._lightNodes) {
        hash.push(lightNode.getHash());
      }
      this._lightNodesHash = 'lights-' + hash.join(',');
    }
    return this._lightNodesHash;
  }
  analyze(builder) {
    const properties = builder.getDataFromNode(this);
    for (const node of properties.nodes) {
      node.build(builder);
    }
  }
  setupLightsNode(builder) {
    const lightNodes = [];
    const previousLightNodes = this._lightNodes;
    const lights = sortLights(this._lights);
    const nodeLibrary = builder.renderer.nodes.library;
    for (const light of lights) {
      if (light.isNode) {
        lightNodes.push(nodeObject(light));
      } else {
        let lightNode = null;
        if (previousLightNodes !== null) {
          lightNode = getLightNodeById(light.id, previousLightNodes); // resuse existing light node
        }
        if (lightNode === null) {
          const lightNodeClass = nodeLibrary.getLightNodeClass(light.constructor);
          if (lightNodeClass === undefined) {
            console.warn(`LightsNode.setupNodeLights: Light node not found for ${light.constructor.name}`);
            continue;
          }
          lightNodes.push(nodeObject(new lightNodeClass(light)));
        }
      }
    }
    this._lightNodes = lightNodes;
  }
  setup(builder) {
    if (this._lightNodes === null) this.setupLightsNode(builder);
    const context = builder.context;
    const lightingModel = context.lightingModel;
    let outgoingLightNode = this.outgoingLightNode;
    if (lightingModel) {
      const {
        _lightNodes,
        totalDiffuseNode,
        totalSpecularNode
      } = this;
      context.outgoingLight = outgoingLightNode;
      const stack = builder.addStack();

      //

      const properties = builder.getDataFromNode(this);
      properties.nodes = stack.nodes;

      //

      lightingModel.start(context, stack, builder);

      // lights

      for (const lightNode of _lightNodes) {
        lightNode.build(builder);
      }

      //

      lightingModel.indirect(context, stack, builder);

      //

      const {
        backdrop,
        backdropAlpha
      } = context;
      const {
        directDiffuse,
        directSpecular,
        indirectDiffuse,
        indirectSpecular
      } = context.reflectedLight;
      let totalDiffuse = directDiffuse.add(indirectDiffuse);
      if (backdrop !== null) {
        if (backdropAlpha !== null) {
          totalDiffuse = vec3(backdropAlpha.mix(totalDiffuse, backdrop));
        } else {
          totalDiffuse = vec3(backdrop);
        }
        context.material.transparent = true;
      }
      totalDiffuseNode.assign(totalDiffuse);
      totalSpecularNode.assign(directSpecular.add(indirectSpecular));
      outgoingLightNode.assign(totalDiffuseNode.add(totalSpecularNode));

      //

      lightingModel.finish(context, stack, builder);

      //

      outgoingLightNode = outgoingLightNode.bypass(builder.removeStack());
    }
    return outgoingLightNode;
  }
  setLights(lights) {
    this._lights = lights;
    this._lightNodes = null;
    this._lightNodesHash = null;
    return this;
  }
  getLights() {
    return this._lights;
  }
}
LightsNode.type = /*@__PURE__*/registerNode('Lights', LightsNode);
const lights = /*@__PURE__*/nodeProxy(LightsNode);

class LightingNode extends Node$1 {
  constructor() {
    super('vec3');
    this.isLightingNode = true;
  }
  generate(/*builder*/
  ) {
    console.warn('Abstract function.');
  }
}
LightingNode.type = /*@__PURE__*/registerNode('Lighting', LightingNode);

class AONode extends LightingNode {
  constructor(aoNode = null) {
    super();
    this.aoNode = aoNode;
  }
  setup(builder) {
    builder.context.ambientOcclusion.mulAssign(this.aoNode);
  }
}
AONode.type = /*@__PURE__*/registerNode('AO', AONode);

class LightingContextNode extends ContextNode {
  constructor(node, lightingModel = null, backdropNode = null, backdropAlphaNode = null) {
    super(node);
    this.lightingModel = lightingModel;
    this.backdropNode = backdropNode;
    this.backdropAlphaNode = backdropAlphaNode;
    this._value = null;
  }
  getContext() {
    const {
      backdropNode,
      backdropAlphaNode
    } = this;
    const directDiffuse = vec3().toVar('directDiffuse'),
      directSpecular = vec3().toVar('directSpecular'),
      indirectDiffuse = vec3().toVar('indirectDiffuse'),
      indirectSpecular = vec3().toVar('indirectSpecular');
    const reflectedLight = {
      directDiffuse,
      directSpecular,
      indirectDiffuse,
      indirectSpecular
    };
    const context = {
      radiance: vec3().toVar('radiance'),
      irradiance: vec3().toVar('irradiance'),
      iblIrradiance: vec3().toVar('iblIrradiance'),
      ambientOcclusion: float(1).toVar('ambientOcclusion'),
      reflectedLight,
      backdrop: backdropNode,
      backdropAlpha: backdropAlphaNode
    };
    return context;
  }
  setup(builder) {
    this.value = this._value || (this._value = this.getContext());
    this.value.lightingModel = this.lightingModel || builder.context.lightingModel;
    return super.setup(builder);
  }
}
LightingContextNode.type = /*@__PURE__*/registerNode('LightingContext', LightingContextNode);
const lightingContext = /*@__PURE__*/nodeProxy(LightingContextNode);

class IrradianceNode extends LightingNode {
  constructor(node) {
    super();
    this.node = node;
  }
  setup(builder) {
    builder.context.irradiance.addAssign(this.node);
  }
}
IrradianceNode.type = /*@__PURE__*/registerNode('Irradiance', IrradianceNode);

class ClippingNode extends Node$1 {
  constructor(scope = ClippingNode.DEFAULT) {
    super();
    this.scope = scope;
  }
  setup(builder) {
    super.setup(builder);
    const clippingContext = builder.clippingContext;
    const {
      localClipIntersection,
      localClippingCount,
      globalClippingCount
    } = clippingContext;
    const numClippingPlanes = globalClippingCount + localClippingCount;
    const numUnionClippingPlanes = localClipIntersection ? numClippingPlanes - localClippingCount : numClippingPlanes;
    if (this.scope === ClippingNode.ALPHA_TO_COVERAGE) {
      return this.setupAlphaToCoverage(clippingContext.planes, numClippingPlanes, numUnionClippingPlanes);
    } else {
      return this.setupDefault(clippingContext.planes, numClippingPlanes, numUnionClippingPlanes);
    }
  }
  setupAlphaToCoverage(planes, numClippingPlanes, numUnionClippingPlanes) {
    return Fn(() => {
      const clippingPlanes = uniformArray(planes);
      const distanceToPlane = property('float', 'distanceToPlane');
      const distanceGradient = property('float', 'distanceToGradient');
      const clipOpacity = property('float', 'clipOpacity');
      clipOpacity.assign(1);
      let plane;
      Loop(numUnionClippingPlanes, ({
        i
      }) => {
        plane = clippingPlanes.element(i);
        distanceToPlane.assign(positionView.dot(plane.xyz).negate().add(plane.w));
        distanceGradient.assign(distanceToPlane.fwidth().div(2.0));
        clipOpacity.mulAssign(smoothstep(distanceGradient.negate(), distanceGradient, distanceToPlane));
        clipOpacity.equal(0.0).discard();
      });
      if (numUnionClippingPlanes < numClippingPlanes) {
        const unionClipOpacity = property('float', 'unionclipOpacity');
        unionClipOpacity.assign(1);
        Loop({
          start: numUnionClippingPlanes,
          end: numClippingPlanes
        }, ({
          i
        }) => {
          plane = clippingPlanes.element(i);
          distanceToPlane.assign(positionView.dot(plane.xyz).negate().add(plane.w));
          distanceGradient.assign(distanceToPlane.fwidth().div(2.0));
          unionClipOpacity.mulAssign(smoothstep(distanceGradient.negate(), distanceGradient, distanceToPlane).oneMinus());
        });
        clipOpacity.mulAssign(unionClipOpacity.oneMinus());
      }
      diffuseColor.a.mulAssign(clipOpacity);
      diffuseColor.a.equal(0.0).discard();
    })();
  }
  setupDefault(planes, numClippingPlanes, numUnionClippingPlanes) {
    return Fn(() => {
      const clippingPlanes = uniformArray(planes);
      let plane;
      Loop(numUnionClippingPlanes, ({
        i
      }) => {
        plane = clippingPlanes.element(i);
        positionView.dot(plane.xyz).greaterThan(plane.w).discard();
      });
      if (numUnionClippingPlanes < numClippingPlanes) {
        const clipped = property('bool', 'clipped');
        clipped.assign(true);
        Loop({
          start: numUnionClippingPlanes,
          end: numClippingPlanes
        }, ({
          i
        }) => {
          plane = clippingPlanes.element(i);
          clipped.assign(positionView.dot(plane.xyz).greaterThan(plane.w).and(clipped));
        });
        clipped.discard();
      }
    })();
  }
}
ClippingNode.ALPHA_TO_COVERAGE = 'alphaToCoverage';
ClippingNode.DEFAULT = 'default';
ClippingNode.type = /*@__PURE__*/registerNode('Clipping', ClippingNode);
const clipping = () => nodeObject(new ClippingNode());
const clippingAlpha = () => nodeObject(new ClippingNode(ClippingNode.ALPHA_TO_COVERAGE));

const NodeMaterials = new Map();
class NodeMaterial extends Material {
  constructor() {
    super();
    this.isNodeMaterial = true;
    this.type = this.constructor.type;
    this.forceSinglePass = false;
    this.fog = true;
    this.lights = false;
    this.lightsNode = null;
    this.envNode = null;
    this.aoNode = null;
    this.colorNode = null;
    this.normalNode = null;
    this.opacityNode = null;
    this.backdropNode = null;
    this.backdropAlphaNode = null;
    this.alphaTestNode = null;
    this.positionNode = null;
    this.depthNode = null;
    this.shadowNode = null;
    this.shadowPositionNode = null;
    this.outputNode = null;
    this.mrtNode = null;
    this.fragmentNode = null;
    this.vertexNode = null;
  }
  customProgramCacheKey() {
    return this.type + getCacheKey(this);
  }
  build(builder) {
    this.setup(builder);
  }
  setup(builder) {
    builder.context.setupNormal = () => this.setupNormal(builder);

    // < VERTEX STAGE >

    builder.addStack();
    builder.stack.outputNode = this.vertexNode || this.setupPosition(builder);
    builder.addFlow('vertex', builder.removeStack());

    // < FRAGMENT STAGE >

    builder.addStack();
    let resultNode;
    const clippingNode = this.setupClipping(builder);
    if (this.depthWrite === true) this.setupDepth(builder);
    if (this.fragmentNode === null) {
      this.setupDiffuseColor(builder);
      this.setupVariants(builder);
      const outgoingLightNode = this.setupLighting(builder);
      if (clippingNode !== null) builder.stack.add(clippingNode);

      // force unsigned floats - useful for RenderTargets

      const basicOutput = vec4(outgoingLightNode, diffuseColor.a).max(0);
      resultNode = this.setupOutput(builder, basicOutput);

      // OUTPUT NODE

      output.assign(resultNode);

      //

      if (this.outputNode !== null) resultNode = this.outputNode;

      // MRT

      const renderTarget = builder.renderer.getRenderTarget();
      if (renderTarget !== null) {
        const mrt = builder.renderer.getMRT();
        const materialMRT = this.mrtNode;
        if (mrt !== null) {
          resultNode = mrt;
          if (materialMRT !== null) {
            resultNode = mrt.merge(materialMRT);
          }
        } else if (materialMRT !== null) {
          resultNode = materialMRT;
        }
      }
    } else {
      let fragmentNode = this.fragmentNode;
      if (fragmentNode.isOutputStructNode !== true) {
        fragmentNode = vec4(fragmentNode);
      }
      resultNode = this.setupOutput(builder, fragmentNode);
    }
    builder.stack.outputNode = resultNode;
    builder.addFlow('fragment', builder.removeStack());
  }
  setupClipping(builder) {
    if (builder.clippingContext === null) return null;
    const {
      globalClippingCount,
      localClippingCount
    } = builder.clippingContext;
    let result = null;
    if (globalClippingCount || localClippingCount) {
      if (this.alphaToCoverage) {
        // to be added to flow when the color/alpha value has been determined
        result = clippingAlpha();
      } else {
        builder.stack.add(clipping());
      }
    }
    return result;
  }
  setupDepth(builder) {
    const {
      renderer
    } = builder;

    // Depth

    let depthNode = this.depthNode;
    if (depthNode === null) {
      const mrt = renderer.getMRT();
      if (mrt && mrt.has('depth')) {
        depthNode = mrt.get('depth');
      } else if (renderer.logarithmicDepthBuffer === true) {
        const fragDepth = modelViewProjection().w.add(1);
        depthNode = fragDepth.log2().mul(cameraLogDepth).mul(0.5);
      }
    }
    if (depthNode !== null) {
      depth.assign(depthNode).append();
    }
  }
  setupPosition(builder) {
    const {
      object
    } = builder;
    const geometry = object.geometry;
    builder.addStack();

    // Vertex

    if (geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color) {
      morphReference(object).append();
    }
    if (object.isSkinnedMesh === true) {
      skinningReference(object).append();
    }
    if (this.displacementMap) {
      const displacementMap = materialReference('displacementMap', 'texture');
      const displacementScale = materialReference('displacementScale', 'float');
      const displacementBias = materialReference('displacementBias', 'float');
      positionLocal.addAssign(normalLocal.normalize().mul(displacementMap.x.mul(displacementScale).add(displacementBias)));
    }
    if (object.isBatchedMesh) {
      batch(object).append();
    }
    if (object.instanceMatrix && object.instanceMatrix.isInstancedBufferAttribute === true) {
      instance$1(object).append();
    }
    if (this.positionNode !== null) {
      positionLocal.assign(this.positionNode);
    }
    const mvp = modelViewProjection();
    builder.context.vertex = builder.removeStack();
    builder.context.mvp = mvp;
    return mvp;
  }
  setupDiffuseColor({
    object,
    geometry
  }) {
    let colorNode = this.colorNode ? vec4(this.colorNode) : materialColor;

    // VERTEX COLORS

    if (this.vertexColors === true && geometry.hasAttribute('color')) {
      colorNode = vec4(colorNode.xyz.mul(attribute('color', 'vec3')), colorNode.a);
    }

    // Instanced colors

    if (object.instanceColor) {
      const instanceColor = varyingProperty('vec3', 'vInstanceColor');
      colorNode = instanceColor.mul(colorNode);
    }
    if (object.isBatchedMesh && object._colorsTexture) {
      const batchColor = varyingProperty('vec3', 'vBatchColor');
      colorNode = batchColor.mul(colorNode);
    }

    // COLOR

    diffuseColor.assign(colorNode);

    // OPACITY

    const opacityNode = this.opacityNode ? float(this.opacityNode) : materialOpacity;
    diffuseColor.a.assign(diffuseColor.a.mul(opacityNode));

    // ALPHA TEST

    if (this.alphaTestNode !== null || this.alphaTest > 0) {
      const alphaTestNode = this.alphaTestNode !== null ? float(this.alphaTestNode) : materialAlphaTest;
      diffuseColor.a.lessThanEqual(alphaTestNode).discard();
    }
    if (this.transparent === false && this.blending === NormalBlending && this.alphaToCoverage === false) {
      diffuseColor.a.assign(1.0);
    }
  }
  setupVariants(/*builder*/
  ) {

    // Interface function.
  }
  setupOutgoingLight() {
    return this.lights === true ? vec3(0) : diffuseColor.rgb;
  }
  setupNormal() {
    return this.normalNode ? vec3(this.normalNode) : materialNormal;
  }
  setupEnvironment(/*builder*/
  ) {
    let node = null;
    if (this.envNode) {
      node = this.envNode;
    } else if (this.envMap) {
      node = this.envMap.isCubeTexture ? materialReference('envMap', 'cubeTexture') : materialReference('envMap', 'texture');
    }
    return node;
  }
  setupLightMap(builder) {
    let node = null;
    if (builder.material.lightMap) {
      node = new IrradianceNode(materialLightMap);
    }
    return node;
  }
  setupLights(builder) {
    const materialLightsNode = [];

    //

    const envNode = this.setupEnvironment(builder);
    if (envNode && envNode.isLightingNode) {
      materialLightsNode.push(envNode);
    }
    const lightMapNode = this.setupLightMap(builder);
    if (lightMapNode && lightMapNode.isLightingNode) {
      materialLightsNode.push(lightMapNode);
    }
    if (this.aoNode !== null || builder.material.aoMap) {
      const aoNode = this.aoNode !== null ? this.aoNode : materialAOMap;
      materialLightsNode.push(new AONode(aoNode));
    }
    let lightsN = this.lightsNode || builder.lightsNode;
    if (materialLightsNode.length > 0) {
      lightsN = lights([...lightsN.getLights(), ...materialLightsNode]);
    }
    return lightsN;
  }
  setupLightingModel(/*builder*/
  ) {

    // Interface function.
  }
  setupLighting(builder) {
    const {
      material
    } = builder;
    const {
      backdropNode,
      backdropAlphaNode,
      emissiveNode
    } = this;

    // OUTGOING LIGHT

    const lights = this.lights === true || this.lightsNode !== null;
    const lightsNode = lights ? this.setupLights(builder) : null;
    let outgoingLightNode = this.setupOutgoingLight(builder);
    if (lightsNode && lightsNode.getScope().getLights().length > 0) {
      const lightingModel = this.setupLightingModel(builder);
      outgoingLightNode = lightingContext(lightsNode, lightingModel, backdropNode, backdropAlphaNode);
    } else if (backdropNode !== null) {
      outgoingLightNode = vec3(backdropAlphaNode !== null ? mix(outgoingLightNode, backdropNode, backdropAlphaNode) : backdropNode);
    }

    // EMISSIVE

    if (emissiveNode && emissiveNode.isNode === true || material.emissive && material.emissive.isColor === true) {
      emissive.assign(vec3(emissiveNode ? emissiveNode : materialEmissive));
      outgoingLightNode = outgoingLightNode.add(emissive);
    }
    return outgoingLightNode;
  }
  setupOutput(builder, outputNode) {
    // FOG

    if (this.fog === true) {
      const fogNode = builder.fogNode;
      if (fogNode) outputNode = vec4(fogNode.mix(outputNode.rgb, fogNode.colorNode), outputNode.a);
    }
    return outputNode;
  }
  setDefaultValues(material) {
    // This approach is to reuse the native refreshUniforms*
    // and turn available the use of features like transmission and environment in core

    for (const property in material) {
      const value = material[property];
      if (this[property] === undefined) {
        this[property] = value;
        if (value && value.clone) this[property] = value.clone();
      }
    }
    const descriptors = Object.getOwnPropertyDescriptors(material.constructor.prototype);
    for (const key in descriptors) {
      if (Object.getOwnPropertyDescriptor(this.constructor.prototype, key) === undefined && descriptors[key].get !== undefined) {
        Object.defineProperty(this.constructor.prototype, key, descriptors[key]);
      }
    }
  }
  toJSON(meta) {
    const isRoot = meta === undefined || typeof meta === 'string';
    if (isRoot) {
      meta = {
        textures: {},
        images: {},
        nodes: {}
      };
    }
    const data = Material.prototype.toJSON.call(this, meta);
    const nodeChildren = getNodeChildren(this);
    data.inputNodes = {};
    for (const {
      property,
      childNode
    } of nodeChildren) {
      data.inputNodes[property] = childNode.toJSON(meta).uuid;
    }

    // TODO: Copied from Object3D.toJSON

    function extractFromCache(cache) {
      const values = [];
      for (const key in cache) {
        const data = cache[key];
        delete data.metadata;
        values.push(data);
      }
      return values;
    }
    if (isRoot) {
      const textures = extractFromCache(meta.textures);
      const images = extractFromCache(meta.images);
      const nodes = extractFromCache(meta.nodes);
      if (textures.length > 0) data.textures = textures;
      if (images.length > 0) data.images = images;
      if (nodes.length > 0) data.nodes = nodes;
    }
    return data;
  }
  copy(source) {
    this.lightsNode = source.lightsNode;
    this.envNode = source.envNode;
    this.colorNode = source.colorNode;
    this.normalNode = source.normalNode;
    this.opacityNode = source.opacityNode;
    this.backdropNode = source.backdropNode;
    this.backdropAlphaNode = source.backdropAlphaNode;
    this.alphaTestNode = source.alphaTestNode;
    this.positionNode = source.positionNode;
    this.depthNode = source.depthNode;
    this.shadowNode = source.shadowNode;
    this.shadowPositionNode = source.shadowPositionNode;
    this.outputNode = source.outputNode;
    this.mrtNode = source.mrtNode;
    this.fragmentNode = source.fragmentNode;
    this.vertexNode = source.vertexNode;
    return super.copy(source);
  }
}
var NodeMaterial$1 = NodeMaterial;
NodeMaterial.type = /*@__PURE__*/registerNodeMaterial('', NodeMaterial);
function registerNodeMaterial(type, nodeMaterialClass) {
  const suffix = 'NodeMaterial';
  const nodeMaterialType = type + suffix;
  if (typeof nodeMaterialClass !== 'function') throw new Error(`THREE.Node: NodeMaterial class "${type}" is not a class.`);
  if (NodeMaterials.has(nodeMaterialType)) {
    console.warn(`THREE.Node: Redefinition of NodeMaterial class "${nodeMaterialType}".`);
    return;
  }
  if (type.slice(-suffix.length) === suffix) {
    console.warn(`THREE.NodeMaterial: NodeMaterial class ${nodeMaterialType} should not have '${suffix}' suffix.`);
    return;
  }
  NodeMaterials.set(nodeMaterialType, nodeMaterialClass);
  nodeMaterialClass.type = nodeMaterialType;
  return nodeMaterialType;
}

class Box3 {
  constructor(min = new Vector3(+Infinity, +Infinity, +Infinity), max = new Vector3(-Infinity, -Infinity, -Infinity)) {
    this.isBox3 = true;
    this.min = min;
    this.max = max;
  }
  set(min, max) {
    this.min.copy(min);
    this.max.copy(max);
    return this;
  }
  setFromArray(array) {
    this.makeEmpty();
    for (let i = 0, il = array.length; i < il; i += 3) {
      this.expandByPoint(_vector$2.fromArray(array, i));
    }
    return this;
  }
  setFromBufferAttribute(attribute) {
    this.makeEmpty();
    for (let i = 0, il = attribute.count; i < il; i++) {
      this.expandByPoint(_vector$2.fromBufferAttribute(attribute, i));
    }
    return this;
  }
  setFromPoints(points) {
    this.makeEmpty();
    for (let i = 0, il = points.length; i < il; i++) {
      this.expandByPoint(points[i]);
    }
    return this;
  }
  setFromCenterAndSize(center, size) {
    const halfSize = _vector$2.copy(size).multiplyScalar(0.5);
    this.min.copy(center).sub(halfSize);
    this.max.copy(center).add(halfSize);
    return this;
  }
  setFromObject(object, precise = false) {
    this.makeEmpty();
    return this.expandByObject(object, precise);
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(box) {
    this.min.copy(box.min);
    this.max.copy(box.max);
    return this;
  }
  makeEmpty() {
    this.min.x = this.min.y = this.min.z = +Infinity;
    this.max.x = this.max.y = this.max.z = -Infinity;
    return this;
  }
  isEmpty() {
    // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes

    return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z;
  }
  getCenter(target) {
    return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);
  }
  getSize(target) {
    return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min);
  }
  expandByPoint(point) {
    this.min.min(point);
    this.max.max(point);
    return this;
  }
  expandByVector(vector) {
    this.min.sub(vector);
    this.max.add(vector);
    return this;
  }
  expandByScalar(scalar) {
    this.min.addScalar(-scalar);
    this.max.addScalar(scalar);
    return this;
  }
  expandByObject(object, precise = false) {
    // Computes the world-axis-aligned bounding box of an object (including its children),
    // accounting for both the object's, and children's, world transforms

    object.updateWorldMatrix(false, false);
    const geometry = object.geometry;
    if (geometry !== undefined) {
      const positionAttribute = geometry.getAttribute('position');

      // precise AABB computation based on vertex data requires at least a position attribute.
      // instancing isn't supported so far and uses the normal (conservative) code path.

      if (precise === true && positionAttribute !== undefined && object.isInstancedMesh !== true) {
        for (let i = 0, l = positionAttribute.count; i < l; i++) {
          if (object.isMesh === true) {
            object.getVertexPosition(i, _vector$2);
          } else {
            _vector$2.fromBufferAttribute(positionAttribute, i);
          }
          _vector$2.applyMatrix4(object.matrixWorld);
          this.expandByPoint(_vector$2);
        }
      } else {
        if (object.boundingBox !== undefined) {
          // object-level bounding box

          if (object.boundingBox === null) {
            object.computeBoundingBox();
          }
          _box$2.copy(object.boundingBox);
        } else {
          // geometry-level bounding box

          if (geometry.boundingBox === null) {
            geometry.computeBoundingBox();
          }
          _box$2.copy(geometry.boundingBox);
        }
        _box$2.applyMatrix4(object.matrixWorld);
        this.union(_box$2);
      }
    }
    const children = object.children;
    for (let i = 0, l = children.length; i < l; i++) {
      this.expandByObject(children[i], precise);
    }
    return this;
  }
  containsPoint(point) {
    return point.x >= this.min.x && point.x <= this.max.x && point.y >= this.min.y && point.y <= this.max.y && point.z >= this.min.z && point.z <= this.max.z;
  }
  containsBox(box) {
    return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z;
  }
  getParameter(point, target) {
    // This can potentially have a divide by zero if the box
    // has a size dimension of 0.

    return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y), (point.z - this.min.z) / (this.max.z - this.min.z));
  }
  intersectsBox(box) {
    // using 6 splitting planes to rule out intersections.
    return box.max.x >= this.min.x && box.min.x <= this.max.x && box.max.y >= this.min.y && box.min.y <= this.max.y && box.max.z >= this.min.z && box.min.z <= this.max.z;
  }
  intersectsSphere(sphere) {
    // Find the point on the AABB closest to the sphere center.
    this.clampPoint(sphere.center, _vector$2);

    // If that point is inside the sphere, the AABB and sphere intersect.
    return _vector$2.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius;
  }
  intersectsPlane(plane) {
    // We compute the minimum and maximum dot product values. If those values
    // are on the same side (back or front) of the plane, then there is no intersection.

    let min, max;
    if (plane.normal.x > 0) {
      min = plane.normal.x * this.min.x;
      max = plane.normal.x * this.max.x;
    } else {
      min = plane.normal.x * this.max.x;
      max = plane.normal.x * this.min.x;
    }
    if (plane.normal.y > 0) {
      min += plane.normal.y * this.min.y;
      max += plane.normal.y * this.max.y;
    } else {
      min += plane.normal.y * this.max.y;
      max += plane.normal.y * this.min.y;
    }
    if (plane.normal.z > 0) {
      min += plane.normal.z * this.min.z;
      max += plane.normal.z * this.max.z;
    } else {
      min += plane.normal.z * this.max.z;
      max += plane.normal.z * this.min.z;
    }
    return min <= -plane.constant && max >= -plane.constant;
  }
  intersectsTriangle(triangle) {
    if (this.isEmpty()) {
      return false;
    }

    // compute box center and extents
    this.getCenter(_center);
    _extents.subVectors(this.max, _center);

    // translate triangle to aabb origin
    _v0$1.subVectors(triangle.a, _center);
    _v1$2.subVectors(triangle.b, _center);
    _v2$2.subVectors(triangle.c, _center);

    // compute edge vectors for triangle
    _f0.subVectors(_v1$2, _v0$1);
    _f1.subVectors(_v2$2, _v1$2);
    _f2.subVectors(_v0$1, _v2$2);

    // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
    // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
    // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
    let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0];
    if (!satForAxes(axes, _v0$1, _v1$2, _v2$2, _extents)) {
      return false;
    }

    // test 3 face normals from the aabb
    axes = [1, 0, 0, 0, 1, 0, 0, 0, 1];
    if (!satForAxes(axes, _v0$1, _v1$2, _v2$2, _extents)) {
      return false;
    }

    // finally testing the face normal of the triangle
    // use already existing triangle edge vectors here
    _triangleNormal.crossVectors(_f0, _f1);
    axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z];
    return satForAxes(axes, _v0$1, _v1$2, _v2$2, _extents);
  }
  clampPoint(point, target) {
    return target.copy(point).clamp(this.min, this.max);
  }
  distanceToPoint(point) {
    return this.clampPoint(point, _vector$2).distanceTo(point);
  }
  getBoundingSphere(target) {
    if (this.isEmpty()) {
      target.makeEmpty();
    } else {
      this.getCenter(target.center);
      target.radius = this.getSize(_vector$2).length() * 0.5;
    }
    return target;
  }
  intersect(box) {
    this.min.max(box.min);
    this.max.min(box.max);

    // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.
    if (this.isEmpty()) this.makeEmpty();
    return this;
  }
  union(box) {
    this.min.min(box.min);
    this.max.max(box.max);
    return this;
  }
  applyMatrix4(matrix) {
    // transform of empty box is an empty box.
    if (this.isEmpty()) return this;

    // NOTE: I am using a binary pattern to specify all 2^3 combinations below
    _points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); // 000
    _points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); // 001
    _points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); // 010
    _points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); // 011
    _points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); // 100
    _points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); // 101
    _points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); // 110
    _points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); // 111

    this.setFromPoints(_points);
    return this;
  }
  translate(offset) {
    this.min.add(offset);
    this.max.add(offset);
    return this;
  }
  equals(box) {
    return box.min.equals(this.min) && box.max.equals(this.max);
  }
}
const _points = [/*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3()];
const _vector$2 = /*@__PURE__*/new Vector3();
const _box$2 = /*@__PURE__*/new Box3();

// triangle centered vertices

const _v0$1 = /*@__PURE__*/new Vector3();
const _v1$2 = /*@__PURE__*/new Vector3();
const _v2$2 = /*@__PURE__*/new Vector3();

// triangle edge vectors

const _f0 = /*@__PURE__*/new Vector3();
const _f1 = /*@__PURE__*/new Vector3();
const _f2 = /*@__PURE__*/new Vector3();
const _center = /*@__PURE__*/new Vector3();
const _extents = /*@__PURE__*/new Vector3();
const _triangleNormal = /*@__PURE__*/new Vector3();
const _testAxis = /*@__PURE__*/new Vector3();
function satForAxes(axes, v0, v1, v2, extents) {
  for (let i = 0, j = axes.length - 3; i <= j; i += 3) {
    _testAxis.fromArray(axes, i);
    // project the aabb onto the separating axis
    const r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z);
    // project all 3 vertices of the triangle onto the separating axis
    const p0 = v0.dot(_testAxis);
    const p1 = v1.dot(_testAxis);
    const p2 = v2.dot(_testAxis);
    // actual test, basically see if either of the most extreme of the triangle points intersects r
    if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) {
      // points of the projected triangle are outside the projected half-length of the aabb
      // the axis is separating and we can exit
      return false;
    }
  }
  return true;
}

const _box$1 = /*@__PURE__*/new Box3();
const _v1$1 = /*@__PURE__*/new Vector3();
const _v2$1 = /*@__PURE__*/new Vector3();
class Sphere {
  constructor(center = new Vector3(), radius = -1) {
    this.isSphere = true;
    this.center = center;
    this.radius = radius;
  }
  set(center, radius) {
    this.center.copy(center);
    this.radius = radius;
    return this;
  }
  setFromPoints(points, optionalCenter) {
    const center = this.center;
    if (optionalCenter !== undefined) {
      center.copy(optionalCenter);
    } else {
      _box$1.setFromPoints(points).getCenter(center);
    }
    let maxRadiusSq = 0;
    for (let i = 0, il = points.length; i < il; i++) {
      maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i]));
    }
    this.radius = Math.sqrt(maxRadiusSq);
    return this;
  }
  copy(sphere) {
    this.center.copy(sphere.center);
    this.radius = sphere.radius;
    return this;
  }
  isEmpty() {
    return this.radius < 0;
  }
  makeEmpty() {
    this.center.set(0, 0, 0);
    this.radius = -1;
    return this;
  }
  containsPoint(point) {
    return point.distanceToSquared(this.center) <= this.radius * this.radius;
  }
  distanceToPoint(point) {
    return point.distanceTo(this.center) - this.radius;
  }
  intersectsSphere(sphere) {
    const radiusSum = this.radius + sphere.radius;
    return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum;
  }
  intersectsBox(box) {
    return box.intersectsSphere(this);
  }
  intersectsPlane(plane) {
    return Math.abs(plane.distanceToPoint(this.center)) <= this.radius;
  }
  clampPoint(point, target) {
    const deltaLengthSq = this.center.distanceToSquared(point);
    target.copy(point);
    if (deltaLengthSq > this.radius * this.radius) {
      target.sub(this.center).normalize();
      target.multiplyScalar(this.radius).add(this.center);
    }
    return target;
  }
  getBoundingBox(target) {
    if (this.isEmpty()) {
      // Empty sphere produces empty bounding box
      target.makeEmpty();
      return target;
    }
    target.set(this.center, this.center);
    target.expandByScalar(this.radius);
    return target;
  }
  applyMatrix4(matrix) {
    this.center.applyMatrix4(matrix);
    this.radius = this.radius * matrix.getMaxScaleOnAxis();
    return this;
  }
  translate(offset) {
    this.center.add(offset);
    return this;
  }
  expandByPoint(point) {
    if (this.isEmpty()) {
      this.center.copy(point);
      this.radius = 0;
      return this;
    }
    _v1$1.subVectors(point, this.center);
    const lengthSq = _v1$1.lengthSq();
    if (lengthSq > this.radius * this.radius) {
      // calculate the minimal sphere

      const length = Math.sqrt(lengthSq);
      const delta = (length - this.radius) * 0.5;
      this.center.addScaledVector(_v1$1, delta / length);
      this.radius += delta;
    }
    return this;
  }
  union(sphere) {
    if (sphere.isEmpty()) {
      return this;
    }
    if (this.isEmpty()) {
      this.copy(sphere);
      return this;
    }
    if (this.center.equals(sphere.center) === true) {
      this.radius = Math.max(this.radius, sphere.radius);
    } else {
      _v2$1.subVectors(sphere.center, this.center).setLength(sphere.radius);
      this.expandByPoint(_v1$1.copy(sphere.center).add(_v2$1));
      this.expandByPoint(_v1$1.copy(sphere.center).sub(_v2$1));
    }
    return this;
  }
  equals(sphere) {
    return sphere.center.equals(this.center) && sphere.radius === this.radius;
  }
  clone() {
    return new this.constructor().copy(this);
  }
}

let _id = 0;
const _m1 = /*@__PURE__*/new Matrix4();
const _obj = /*@__PURE__*/new Object3D();
const _offset = /*@__PURE__*/new Vector3();
const _box = /*@__PURE__*/new Box3();
const _boxMorphTargets = /*@__PURE__*/new Box3();
const _vector$1 = /*@__PURE__*/new Vector3();
class BufferGeometry extends EventDispatcher {
  constructor() {
    super();
    this.isBufferGeometry = true;
    Object.defineProperty(this, 'id', {
      value: _id++
    });
    this.uuid = generateUUID();
    this.name = '';
    this.type = 'BufferGeometry';
    this.index = null;
    this.attributes = {};
    this.morphAttributes = {};
    this.morphTargetsRelative = false;
    this.groups = [];
    this.boundingBox = null;
    this.boundingSphere = null;
    this.drawRange = {
      start: 0,
      count: Infinity
    };
    this.userData = {};
  }
  getIndex() {
    return this.index;
  }
  setIndex(index) {
    if (Array.isArray(index)) {
      this.index = new (arrayNeedsUint32(index) ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1);
    } else {
      this.index = index;
    }
    return this;
  }
  getAttribute(name) {
    return this.attributes[name];
  }
  setAttribute(name, attribute) {
    this.attributes[name] = attribute;
    return this;
  }
  deleteAttribute(name) {
    delete this.attributes[name];
    return this;
  }
  hasAttribute(name) {
    return this.attributes[name] !== undefined;
  }
  addGroup(start, count, materialIndex = 0) {
    this.groups.push({
      start: start,
      count: count,
      materialIndex: materialIndex
    });
  }
  clearGroups() {
    this.groups = [];
  }
  setDrawRange(start, count) {
    this.drawRange.start = start;
    this.drawRange.count = count;
  }
  applyMatrix4(matrix) {
    const position = this.attributes.position;
    if (position !== undefined) {
      position.applyMatrix4(matrix);
      position.needsUpdate = true;
    }
    const normal = this.attributes.normal;
    if (normal !== undefined) {
      const normalMatrix = new Matrix3().getNormalMatrix(matrix);
      normal.applyNormalMatrix(normalMatrix);
      normal.needsUpdate = true;
    }
    const tangent = this.attributes.tangent;
    if (tangent !== undefined) {
      tangent.transformDirection(matrix);
      tangent.needsUpdate = true;
    }
    if (this.boundingBox !== null) {
      this.computeBoundingBox();
    }
    if (this.boundingSphere !== null) {
      this.computeBoundingSphere();
    }
    return this;
  }
  applyQuaternion(q) {
    _m1.makeRotationFromQuaternion(q);
    this.applyMatrix4(_m1);
    return this;
  }
  rotateX(angle) {
    // rotate geometry around world x-axis

    _m1.makeRotationX(angle);
    this.applyMatrix4(_m1);
    return this;
  }
  rotateY(angle) {
    // rotate geometry around world y-axis

    _m1.makeRotationY(angle);
    this.applyMatrix4(_m1);
    return this;
  }
  rotateZ(angle) {
    // rotate geometry around world z-axis

    _m1.makeRotationZ(angle);
    this.applyMatrix4(_m1);
    return this;
  }
  translate(x, y, z) {
    // translate geometry

    _m1.makeTranslation(x, y, z);
    this.applyMatrix4(_m1);
    return this;
  }
  scale(x, y, z) {
    // scale geometry

    _m1.makeScale(x, y, z);
    this.applyMatrix4(_m1);
    return this;
  }
  lookAt(vector) {
    _obj.lookAt(vector);
    _obj.updateMatrix();
    this.applyMatrix4(_obj.matrix);
    return this;
  }
  center() {
    this.computeBoundingBox();
    this.boundingBox.getCenter(_offset).negate();
    this.translate(_offset.x, _offset.y, _offset.z);
    return this;
  }
  setFromPoints(points) {
    const position = [];
    for (let i = 0, l = points.length; i < l; i++) {
      const point = points[i];
      position.push(point.x, point.y, point.z || 0);
    }
    this.setAttribute('position', new Float32BufferAttribute(position, 3));
    return this;
  }
  computeBoundingBox() {
    if (this.boundingBox === null) {
      this.boundingBox = new Box3();
    }
    const position = this.attributes.position;
    const morphAttributesPosition = this.morphAttributes.position;
    if (position && position.isGLBufferAttribute) {
      console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this);
      this.boundingBox.set(new Vector3(-Infinity, -Infinity, -Infinity), new Vector3(+Infinity, +Infinity, +Infinity));
      return;
    }
    if (position !== undefined) {
      this.boundingBox.setFromBufferAttribute(position);

      // process morph attributes if present

      if (morphAttributesPosition) {
        for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
          const morphAttribute = morphAttributesPosition[i];
          _box.setFromBufferAttribute(morphAttribute);
          if (this.morphTargetsRelative) {
            _vector$1.addVectors(this.boundingBox.min, _box.min);
            this.boundingBox.expandByPoint(_vector$1);
            _vector$1.addVectors(this.boundingBox.max, _box.max);
            this.boundingBox.expandByPoint(_vector$1);
          } else {
            this.boundingBox.expandByPoint(_box.min);
            this.boundingBox.expandByPoint(_box.max);
          }
        }
      }
    } else {
      this.boundingBox.makeEmpty();
    }
    if (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) {
      console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this);
    }
  }
  computeBoundingSphere() {
    if (this.boundingSphere === null) {
      this.boundingSphere = new Sphere();
    }
    const position = this.attributes.position;
    const morphAttributesPosition = this.morphAttributes.position;
    if (position && position.isGLBufferAttribute) {
      console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this);
      this.boundingSphere.set(new Vector3(), Infinity);
      return;
    }
    if (position) {
      // first, find the center of the bounding sphere

      const center = this.boundingSphere.center;
      _box.setFromBufferAttribute(position);

      // process morph attributes if present

      if (morphAttributesPosition) {
        for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
          const morphAttribute = morphAttributesPosition[i];
          _boxMorphTargets.setFromBufferAttribute(morphAttribute);
          if (this.morphTargetsRelative) {
            _vector$1.addVectors(_box.min, _boxMorphTargets.min);
            _box.expandByPoint(_vector$1);
            _vector$1.addVectors(_box.max, _boxMorphTargets.max);
            _box.expandByPoint(_vector$1);
          } else {
            _box.expandByPoint(_boxMorphTargets.min);
            _box.expandByPoint(_boxMorphTargets.max);
          }
        }
      }
      _box.getCenter(center);

      // second, try to find a boundingSphere with a radius smaller than the
      // boundingSphere of the boundingBox: sqrt(3) smaller in the best case

      let maxRadiusSq = 0;
      for (let i = 0, il = position.count; i < il; i++) {
        _vector$1.fromBufferAttribute(position, i);
        maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$1));
      }

      // process morph attributes if present

      if (morphAttributesPosition) {
        for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
          const morphAttribute = morphAttributesPosition[i];
          const morphTargetsRelative = this.morphTargetsRelative;
          for (let j = 0, jl = morphAttribute.count; j < jl; j++) {
            _vector$1.fromBufferAttribute(morphAttribute, j);
            if (morphTargetsRelative) {
              _offset.fromBufferAttribute(position, j);
              _vector$1.add(_offset);
            }
            maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$1));
          }
        }
      }
      this.boundingSphere.radius = Math.sqrt(maxRadiusSq);
      if (isNaN(this.boundingSphere.radius)) {
        console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this);
      }
    }
  }
  computeTangents() {
    const index = this.index;
    const attributes = this.attributes;

    // based on http://www.terathon.com/code/tangent.html
    // (per vertex tangents)

    if (index === null || attributes.position === undefined || attributes.normal === undefined || attributes.uv === undefined) {
      console.error('THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)');
      return;
    }
    const positionAttribute = attributes.position;
    const normalAttribute = attributes.normal;
    const uvAttribute = attributes.uv;
    if (this.hasAttribute('tangent') === false) {
      this.setAttribute('tangent', new BufferAttribute(new Float32Array(4 * positionAttribute.count), 4));
    }
    const tangentAttribute = this.getAttribute('tangent');
    const tan1 = [],
      tan2 = [];
    for (let i = 0; i < positionAttribute.count; i++) {
      tan1[i] = new Vector3();
      tan2[i] = new Vector3();
    }
    const vA = new Vector3(),
      vB = new Vector3(),
      vC = new Vector3(),
      uvA = new Vector2(),
      uvB = new Vector2(),
      uvC = new Vector2(),
      sdir = new Vector3(),
      tdir = new Vector3();
    function handleTriangle(a, b, c) {
      vA.fromBufferAttribute(positionAttribute, a);
      vB.fromBufferAttribute(positionAttribute, b);
      vC.fromBufferAttribute(positionAttribute, c);
      uvA.fromBufferAttribute(uvAttribute, a);
      uvB.fromBufferAttribute(uvAttribute, b);
      uvC.fromBufferAttribute(uvAttribute, c);
      vB.sub(vA);
      vC.sub(vA);
      uvB.sub(uvA);
      uvC.sub(uvA);
      const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y);

      // silently ignore degenerate uv triangles having coincident or colinear vertices

      if (!isFinite(r)) return;
      sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r);
      tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r);
      tan1[a].add(sdir);
      tan1[b].add(sdir);
      tan1[c].add(sdir);
      tan2[a].add(tdir);
      tan2[b].add(tdir);
      tan2[c].add(tdir);
    }
    let groups = this.groups;
    if (groups.length === 0) {
      groups = [{
        start: 0,
        count: index.count
      }];
    }
    for (let i = 0, il = groups.length; i < il; ++i) {
      const group = groups[i];
      const start = group.start;
      const count = group.count;
      for (let j = start, jl = start + count; j < jl; j += 3) {
        handleTriangle(index.getX(j + 0), index.getX(j + 1), index.getX(j + 2));
      }
    }
    const tmp = new Vector3(),
      tmp2 = new Vector3();
    const n = new Vector3(),
      n2 = new Vector3();
    function handleVertex(v) {
      n.fromBufferAttribute(normalAttribute, v);
      n2.copy(n);
      const t = tan1[v];

      // Gram-Schmidt orthogonalize

      tmp.copy(t);
      tmp.sub(n.multiplyScalar(n.dot(t))).normalize();

      // Calculate handedness

      tmp2.crossVectors(n2, t);
      const test = tmp2.dot(tan2[v]);
      const w = test < 0.0 ? -1.0 : 1.0;
      tangentAttribute.setXYZW(v, tmp.x, tmp.y, tmp.z, w);
    }
    for (let i = 0, il = groups.length; i < il; ++i) {
      const group = groups[i];
      const start = group.start;
      const count = group.count;
      for (let j = start, jl = start + count; j < jl; j += 3) {
        handleVertex(index.getX(j + 0));
        handleVertex(index.getX(j + 1));
        handleVertex(index.getX(j + 2));
      }
    }
  }
  computeVertexNormals() {
    const index = this.index;
    const positionAttribute = this.getAttribute('position');
    if (positionAttribute !== undefined) {
      let normalAttribute = this.getAttribute('normal');
      if (normalAttribute === undefined) {
        normalAttribute = new BufferAttribute(new Float32Array(positionAttribute.count * 3), 3);
        this.setAttribute('normal', normalAttribute);
      } else {
        // reset existing normals to zero

        for (let i = 0, il = normalAttribute.count; i < il; i++) {
          normalAttribute.setXYZ(i, 0, 0, 0);
        }
      }
      const pA = new Vector3(),
        pB = new Vector3(),
        pC = new Vector3();
      const nA = new Vector3(),
        nB = new Vector3(),
        nC = new Vector3();
      const cb = new Vector3(),
        ab = new Vector3();

      // indexed elements

      if (index) {
        for (let i = 0, il = index.count; i < il; i += 3) {
          const vA = index.getX(i + 0);
          const vB = index.getX(i + 1);
          const vC = index.getX(i + 2);
          pA.fromBufferAttribute(positionAttribute, vA);
          pB.fromBufferAttribute(positionAttribute, vB);
          pC.fromBufferAttribute(positionAttribute, vC);
          cb.subVectors(pC, pB);
          ab.subVectors(pA, pB);
          cb.cross(ab);
          nA.fromBufferAttribute(normalAttribute, vA);
          nB.fromBufferAttribute(normalAttribute, vB);
          nC.fromBufferAttribute(normalAttribute, vC);
          nA.add(cb);
          nB.add(cb);
          nC.add(cb);
          normalAttribute.setXYZ(vA, nA.x, nA.y, nA.z);
          normalAttribute.setXYZ(vB, nB.x, nB.y, nB.z);
          normalAttribute.setXYZ(vC, nC.x, nC.y, nC.z);
        }
      } else {
        // non-indexed elements (unconnected triangle soup)

        for (let i = 0, il = positionAttribute.count; i < il; i += 3) {
          pA.fromBufferAttribute(positionAttribute, i + 0);
          pB.fromBufferAttribute(positionAttribute, i + 1);
          pC.fromBufferAttribute(positionAttribute, i + 2);
          cb.subVectors(pC, pB);
          ab.subVectors(pA, pB);
          cb.cross(ab);
          normalAttribute.setXYZ(i + 0, cb.x, cb.y, cb.z);
          normalAttribute.setXYZ(i + 1, cb.x, cb.y, cb.z);
          normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z);
        }
      }
      this.normalizeNormals();
      normalAttribute.needsUpdate = true;
    }
  }
  normalizeNormals() {
    const normals = this.attributes.normal;
    for (let i = 0, il = normals.count; i < il; i++) {
      _vector$1.fromBufferAttribute(normals, i);
      _vector$1.normalize();
      normals.setXYZ(i, _vector$1.x, _vector$1.y, _vector$1.z);
    }
  }
  toNonIndexed() {
    function convertBufferAttribute(attribute, indices) {
      const array = attribute.array;
      const itemSize = attribute.itemSize;
      const normalized = attribute.normalized;
      const array2 = new array.constructor(indices.length * itemSize);
      let index = 0,
        index2 = 0;
      for (let i = 0, l = indices.length; i < l; i++) {
        if (attribute.isInterleavedBufferAttribute) {
          index = indices[i] * attribute.data.stride + attribute.offset;
        } else {
          index = indices[i] * itemSize;
        }
        for (let j = 0; j < itemSize; j++) {
          array2[index2++] = array[index++];
        }
      }
      return new BufferAttribute(array2, itemSize, normalized);
    }

    //

    if (this.index === null) {
      console.warn('THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.');
      return this;
    }
    const geometry2 = new BufferGeometry();
    const indices = this.index.array;
    const attributes = this.attributes;

    // attributes

    for (const name in attributes) {
      const attribute = attributes[name];
      const newAttribute = convertBufferAttribute(attribute, indices);
      geometry2.setAttribute(name, newAttribute);
    }

    // morph attributes

    const morphAttributes = this.morphAttributes;
    for (const name in morphAttributes) {
      const morphArray = [];
      const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes

      for (let i = 0, il = morphAttribute.length; i < il; i++) {
        const attribute = morphAttribute[i];
        const newAttribute = convertBufferAttribute(attribute, indices);
        morphArray.push(newAttribute);
      }
      geometry2.morphAttributes[name] = morphArray;
    }
    geometry2.morphTargetsRelative = this.morphTargetsRelative;

    // groups

    const groups = this.groups;
    for (let i = 0, l = groups.length; i < l; i++) {
      const group = groups[i];
      geometry2.addGroup(group.start, group.count, group.materialIndex);
    }
    return geometry2;
  }
  toJSON() {
    const data = {
      metadata: {
        version: 4.6,
        type: 'BufferGeometry',
        generator: 'BufferGeometry.toJSON'
      }
    };

    // standard BufferGeometry serialization

    data.uuid = this.uuid;
    data.type = this.type;
    if (this.name !== '') data.name = this.name;
    if (Object.keys(this.userData).length > 0) data.userData = this.userData;
    if (this.parameters !== undefined) {
      const parameters = this.parameters;
      for (const key in parameters) {
        if (parameters[key] !== undefined) data[key] = parameters[key];
      }
      return data;
    }

    // for simplicity the code assumes attributes are not shared across geometries, see #15811

    data.data = {
      attributes: {}
    };
    const index = this.index;
    if (index !== null) {
      data.data.index = {
        type: index.array.constructor.name,
        array: Array.prototype.slice.call(index.array)
      };
    }
    const attributes = this.attributes;
    for (const key in attributes) {
      const attribute = attributes[key];
      data.data.attributes[key] = attribute.toJSON(data.data);
    }
    const morphAttributes = {};
    let hasMorphAttributes = false;
    for (const key in this.morphAttributes) {
      const attributeArray = this.morphAttributes[key];
      const array = [];
      for (let i = 0, il = attributeArray.length; i < il; i++) {
        const attribute = attributeArray[i];
        array.push(attribute.toJSON(data.data));
      }
      if (array.length > 0) {
        morphAttributes[key] = array;
        hasMorphAttributes = true;
      }
    }
    if (hasMorphAttributes) {
      data.data.morphAttributes = morphAttributes;
      data.data.morphTargetsRelative = this.morphTargetsRelative;
    }
    const groups = this.groups;
    if (groups.length > 0) {
      data.data.groups = JSON.parse(JSON.stringify(groups));
    }
    const boundingSphere = this.boundingSphere;
    if (boundingSphere !== null) {
      data.data.boundingSphere = {
        center: boundingSphere.center.toArray(),
        radius: boundingSphere.radius
      };
    }
    return data;
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(source) {
    // reset

    this.index = null;
    this.attributes = {};
    this.morphAttributes = {};
    this.groups = [];
    this.boundingBox = null;
    this.boundingSphere = null;

    // used for storing cloned, shared data

    const data = {};

    // name

    this.name = source.name;

    // index

    const index = source.index;
    if (index !== null) {
      this.setIndex(index.clone(data));
    }

    // attributes

    const attributes = source.attributes;
    for (const name in attributes) {
      const attribute = attributes[name];
      this.setAttribute(name, attribute.clone(data));
    }

    // morph attributes

    const morphAttributes = source.morphAttributes;
    for (const name in morphAttributes) {
      const array = [];
      const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes

      for (let i = 0, l = morphAttribute.length; i < l; i++) {
        array.push(morphAttribute[i].clone(data));
      }
      this.morphAttributes[name] = array;
    }
    this.morphTargetsRelative = source.morphTargetsRelative;

    // groups

    const groups = source.groups;
    for (let i = 0, l = groups.length; i < l; i++) {
      const group = groups[i];
      this.addGroup(group.start, group.count, group.materialIndex);
    }

    // bounding box

    const boundingBox = source.boundingBox;
    if (boundingBox !== null) {
      this.boundingBox = boundingBox.clone();
    }

    // bounding sphere

    const boundingSphere = source.boundingSphere;
    if (boundingSphere !== null) {
      this.boundingSphere = boundingSphere.clone();
    }

    // draw range

    this.drawRange.start = source.drawRange.start;
    this.drawRange.count = source.drawRange.count;

    // user data

    this.userData = source.userData;
    return this;
  }
  dispose() {
    this.dispatchEvent({
      type: 'dispose'
    });
  }
}

const _vector = /*@__PURE__*/new Vector3();
const _segCenter = /*@__PURE__*/new Vector3();
const _segDir = /*@__PURE__*/new Vector3();
const _diff = /*@__PURE__*/new Vector3();
const _edge1 = /*@__PURE__*/new Vector3();
const _edge2 = /*@__PURE__*/new Vector3();
const _normal = /*@__PURE__*/new Vector3();
class Ray {
  constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) {
    this.origin = origin;
    this.direction = direction;
  }
  set(origin, direction) {
    this.origin.copy(origin);
    this.direction.copy(direction);
    return this;
  }
  copy(ray) {
    this.origin.copy(ray.origin);
    this.direction.copy(ray.direction);
    return this;
  }
  at(t, target) {
    return target.copy(this.origin).addScaledVector(this.direction, t);
  }
  lookAt(v) {
    this.direction.copy(v).sub(this.origin).normalize();
    return this;
  }
  recast(t) {
    this.origin.copy(this.at(t, _vector));
    return this;
  }
  closestPointToPoint(point, target) {
    target.subVectors(point, this.origin);
    const directionDistance = target.dot(this.direction);
    if (directionDistance < 0) {
      return target.copy(this.origin);
    }
    return target.copy(this.origin).addScaledVector(this.direction, directionDistance);
  }
  distanceToPoint(point) {
    return Math.sqrt(this.distanceSqToPoint(point));
  }
  distanceSqToPoint(point) {
    const directionDistance = _vector.subVectors(point, this.origin).dot(this.direction);

    // point behind the ray

    if (directionDistance < 0) {
      return this.origin.distanceToSquared(point);
    }
    _vector.copy(this.origin).addScaledVector(this.direction, directionDistance);
    return _vector.distanceToSquared(point);
  }
  distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) {
    // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h
    // It returns the min distance between the ray and the segment
    // defined by v0 and v1
    // It can also set two optional targets :
    // - The closest point on the ray
    // - The closest point on the segment

    _segCenter.copy(v0).add(v1).multiplyScalar(0.5);
    _segDir.copy(v1).sub(v0).normalize();
    _diff.copy(this.origin).sub(_segCenter);
    const segExtent = v0.distanceTo(v1) * 0.5;
    const a01 = -this.direction.dot(_segDir);
    const b0 = _diff.dot(this.direction);
    const b1 = -_diff.dot(_segDir);
    const c = _diff.lengthSq();
    const det = Math.abs(1 - a01 * a01);
    let s0, s1, sqrDist, extDet;
    if (det > 0) {
      // The ray and segment are not parallel.

      s0 = a01 * b1 - b0;
      s1 = a01 * b0 - b1;
      extDet = segExtent * det;
      if (s0 >= 0) {
        if (s1 >= -extDet) {
          if (s1 <= extDet) {
            // region 0
            // Minimum at interior points of ray and segment.

            const invDet = 1 / det;
            s0 *= invDet;
            s1 *= invDet;
            sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c;
          } else {
            // region 1

            s1 = segExtent;
            s0 = Math.max(0, -(a01 * s1 + b0));
            sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
          }
        } else {
          // region 5

          s1 = -segExtent;
          s0 = Math.max(0, -(a01 * s1 + b0));
          sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
        }
      } else {
        if (s1 <= -extDet) {
          // region 4

          s0 = Math.max(0, -(-a01 * segExtent + b0));
          s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);
          sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
        } else if (s1 <= extDet) {
          // region 3

          s0 = 0;
          s1 = Math.min(Math.max(-segExtent, -b1), segExtent);
          sqrDist = s1 * (s1 + 2 * b1) + c;
        } else {
          // region 2

          s0 = Math.max(0, -(a01 * segExtent + b0));
          s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);
          sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
        }
      }
    } else {
      // Ray and segment are parallel.

      s1 = a01 > 0 ? -segExtent : segExtent;
      s0 = Math.max(0, -(a01 * s1 + b0));
      sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
    }
    if (optionalPointOnRay) {
      optionalPointOnRay.copy(this.origin).addScaledVector(this.direction, s0);
    }
    if (optionalPointOnSegment) {
      optionalPointOnSegment.copy(_segCenter).addScaledVector(_segDir, s1);
    }
    return sqrDist;
  }
  intersectSphere(sphere, target) {
    _vector.subVectors(sphere.center, this.origin);
    const tca = _vector.dot(this.direction);
    const d2 = _vector.dot(_vector) - tca * tca;
    const radius2 = sphere.radius * sphere.radius;
    if (d2 > radius2) return null;
    const thc = Math.sqrt(radius2 - d2);

    // t0 = first intersect point - entrance on front of sphere
    const t0 = tca - thc;

    // t1 = second intersect point - exit point on back of sphere
    const t1 = tca + thc;

    // test to see if t1 is behind the ray - if so, return null
    if (t1 < 0) return null;

    // test to see if t0 is behind the ray:
    // if it is, the ray is inside the sphere, so return the second exit point scaled by t1,
    // in order to always return an intersect point that is in front of the ray.
    if (t0 < 0) return this.at(t1, target);

    // else t0 is in front of the ray, so return the first collision point scaled by t0
    return this.at(t0, target);
  }
  intersectsSphere(sphere) {
    return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius;
  }
  distanceToPlane(plane) {
    const denominator = plane.normal.dot(this.direction);
    if (denominator === 0) {
      // line is coplanar, return origin
      if (plane.distanceToPoint(this.origin) === 0) {
        return 0;
      }

      // Null is preferable to undefined since undefined means.... it is undefined

      return null;
    }
    const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator;

    // Return if the ray never intersects the plane

    return t >= 0 ? t : null;
  }
  intersectPlane(plane, target) {
    const t = this.distanceToPlane(plane);
    if (t === null) {
      return null;
    }
    return this.at(t, target);
  }
  intersectsPlane(plane) {
    // check if the ray lies on the plane first

    const distToPoint = plane.distanceToPoint(this.origin);
    if (distToPoint === 0) {
      return true;
    }
    const denominator = plane.normal.dot(this.direction);
    if (denominator * distToPoint < 0) {
      return true;
    }

    // ray origin is behind the plane (and is pointing behind it)

    return false;
  }
  intersectBox(box, target) {
    let tmin, tmax, tymin, tymax, tzmin, tzmax;
    const invdirx = 1 / this.direction.x,
      invdiry = 1 / this.direction.y,
      invdirz = 1 / this.direction.z;
    const origin = this.origin;
    if (invdirx >= 0) {
      tmin = (box.min.x - origin.x) * invdirx;
      tmax = (box.max.x - origin.x) * invdirx;
    } else {
      tmin = (box.max.x - origin.x) * invdirx;
      tmax = (box.min.x - origin.x) * invdirx;
    }
    if (invdiry >= 0) {
      tymin = (box.min.y - origin.y) * invdiry;
      tymax = (box.max.y - origin.y) * invdiry;
    } else {
      tymin = (box.max.y - origin.y) * invdiry;
      tymax = (box.min.y - origin.y) * invdiry;
    }
    if (tmin > tymax || tymin > tmax) return null;
    if (tymin > tmin || isNaN(tmin)) tmin = tymin;
    if (tymax < tmax || isNaN(tmax)) tmax = tymax;
    if (invdirz >= 0) {
      tzmin = (box.min.z - origin.z) * invdirz;
      tzmax = (box.max.z - origin.z) * invdirz;
    } else {
      tzmin = (box.max.z - origin.z) * invdirz;
      tzmax = (box.min.z - origin.z) * invdirz;
    }
    if (tmin > tzmax || tzmin > tmax) return null;
    if (tzmin > tmin || tmin !== tmin) tmin = tzmin;
    if (tzmax < tmax || tmax !== tmax) tmax = tzmax;

    //return point closest to the ray (positive side)

    if (tmax < 0) return null;
    return this.at(tmin >= 0 ? tmin : tmax, target);
  }
  intersectsBox(box) {
    return this.intersectBox(box, _vector) !== null;
  }
  intersectTriangle(a, b, c, backfaceCulling, target) {
    // Compute the offset origin, edges, and normal.

    // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h

    _edge1.subVectors(b, a);
    _edge2.subVectors(c, a);
    _normal.crossVectors(_edge1, _edge2);

    // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,
    // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
    //   |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
    //   |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
    //   |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
    let DdN = this.direction.dot(_normal);
    let sign;
    if (DdN > 0) {
      if (backfaceCulling) return null;
      sign = 1;
    } else if (DdN < 0) {
      sign = -1;
      DdN = -DdN;
    } else {
      return null;
    }
    _diff.subVectors(this.origin, a);
    const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2));

    // b1 < 0, no intersection
    if (DdQxE2 < 0) {
      return null;
    }
    const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff));

    // b2 < 0, no intersection
    if (DdE1xQ < 0) {
      return null;
    }

    // b1+b2 > 1, no intersection
    if (DdQxE2 + DdE1xQ > DdN) {
      return null;
    }

    // Line intersects triangle, check if ray does.
    const QdN = -sign * _diff.dot(_normal);

    // t < 0, no intersection
    if (QdN < 0) {
      return null;
    }

    // Ray intersects triangle.
    return this.at(QdN / DdN, target);
  }
  applyMatrix4(matrix4) {
    this.origin.applyMatrix4(matrix4);
    this.direction.transformDirection(matrix4);
    return this;
  }
  equals(ray) {
    return ray.origin.equals(this.origin) && ray.direction.equals(this.direction);
  }
  clone() {
    return new this.constructor().copy(this);
  }
}

const _v0 = /*@__PURE__*/new Vector3();
const _v1 = /*@__PURE__*/new Vector3();
const _v2 = /*@__PURE__*/new Vector3();
const _v3$1 = /*@__PURE__*/new Vector3();
const _vab = /*@__PURE__*/new Vector3();
const _vac = /*@__PURE__*/new Vector3();
const _vbc = /*@__PURE__*/new Vector3();
const _vap = /*@__PURE__*/new Vector3();
const _vbp = /*@__PURE__*/new Vector3();
const _vcp = /*@__PURE__*/new Vector3();
class Triangle {
  constructor(a = new Vector3(), b = new Vector3(), c = new Vector3()) {
    this.a = a;
    this.b = b;
    this.c = c;
  }
  static getNormal(a, b, c, target) {
    target.subVectors(c, b);
    _v0.subVectors(a, b);
    target.cross(_v0);
    const targetLengthSq = target.lengthSq();
    if (targetLengthSq > 0) {
      return target.multiplyScalar(1 / Math.sqrt(targetLengthSq));
    }
    return target.set(0, 0, 0);
  }

  // static/instance method to calculate barycentric coordinates
  // based on: http://www.blackpawn.com/texts/pointinpoly/default.html
  static getBarycoord(point, a, b, c, target) {
    _v0.subVectors(c, a);
    _v1.subVectors(b, a);
    _v2.subVectors(point, a);
    const dot00 = _v0.dot(_v0);
    const dot01 = _v0.dot(_v1);
    const dot02 = _v0.dot(_v2);
    const dot11 = _v1.dot(_v1);
    const dot12 = _v1.dot(_v2);
    const denom = dot00 * dot11 - dot01 * dot01;

    // collinear or singular triangle
    if (denom === 0) {
      target.set(0, 0, 0);
      return null;
    }
    const invDenom = 1 / denom;
    const u = (dot11 * dot02 - dot01 * dot12) * invDenom;
    const v = (dot00 * dot12 - dot01 * dot02) * invDenom;

    // barycentric coordinates must always sum to 1
    return target.set(1 - u - v, v, u);
  }
  static containsPoint(point, a, b, c) {
    // if the triangle is degenerate then we can't contain a point
    if (this.getBarycoord(point, a, b, c, _v3$1) === null) {
      return false;
    }
    return _v3$1.x >= 0 && _v3$1.y >= 0 && _v3$1.x + _v3$1.y <= 1;
  }
  static getInterpolation(point, p1, p2, p3, v1, v2, v3, target) {
    if (this.getBarycoord(point, p1, p2, p3, _v3$1) === null) {
      target.x = 0;
      target.y = 0;
      if ('z' in target) target.z = 0;
      if ('w' in target) target.w = 0;
      return null;
    }
    target.setScalar(0);
    target.addScaledVector(v1, _v3$1.x);
    target.addScaledVector(v2, _v3$1.y);
    target.addScaledVector(v3, _v3$1.z);
    return target;
  }
  static isFrontFacing(a, b, c, direction) {
    _v0.subVectors(c, b);
    _v1.subVectors(a, b);

    // strictly front facing
    return _v0.cross(_v1).dot(direction) < 0 ? true : false;
  }
  set(a, b, c) {
    this.a.copy(a);
    this.b.copy(b);
    this.c.copy(c);
    return this;
  }
  setFromPointsAndIndices(points, i0, i1, i2) {
    this.a.copy(points[i0]);
    this.b.copy(points[i1]);
    this.c.copy(points[i2]);
    return this;
  }
  setFromAttributeAndIndices(attribute, i0, i1, i2) {
    this.a.fromBufferAttribute(attribute, i0);
    this.b.fromBufferAttribute(attribute, i1);
    this.c.fromBufferAttribute(attribute, i2);
    return this;
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(triangle) {
    this.a.copy(triangle.a);
    this.b.copy(triangle.b);
    this.c.copy(triangle.c);
    return this;
  }
  getArea() {
    _v0.subVectors(this.c, this.b);
    _v1.subVectors(this.a, this.b);
    return _v0.cross(_v1).length() * 0.5;
  }
  getMidpoint(target) {
    return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);
  }
  getNormal(target) {
    return Triangle.getNormal(this.a, this.b, this.c, target);
  }
  getPlane(target) {
    return target.setFromCoplanarPoints(this.a, this.b, this.c);
  }
  getBarycoord(point, target) {
    return Triangle.getBarycoord(point, this.a, this.b, this.c, target);
  }
  getInterpolation(point, v1, v2, v3, target) {
    return Triangle.getInterpolation(point, this.a, this.b, this.c, v1, v2, v3, target);
  }
  containsPoint(point) {
    return Triangle.containsPoint(point, this.a, this.b, this.c);
  }
  isFrontFacing(direction) {
    return Triangle.isFrontFacing(this.a, this.b, this.c, direction);
  }
  intersectsBox(box) {
    return box.intersectsTriangle(this);
  }
  closestPointToPoint(p, target) {
    const a = this.a,
      b = this.b,
      c = this.c;
    let v, w;

    // algorithm thanks to Real-Time Collision Detection by Christer Ericson,
    // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,
    // under the accompanying license; see chapter 5.1.5 for detailed explanation.
    // basically, we're distinguishing which of the voronoi regions of the triangle
    // the point lies in with the minimum amount of redundant computation.

    _vab.subVectors(b, a);
    _vac.subVectors(c, a);
    _vap.subVectors(p, a);
    const d1 = _vab.dot(_vap);
    const d2 = _vac.dot(_vap);
    if (d1 <= 0 && d2 <= 0) {
      // vertex region of A; barycentric coords (1, 0, 0)
      return target.copy(a);
    }
    _vbp.subVectors(p, b);
    const d3 = _vab.dot(_vbp);
    const d4 = _vac.dot(_vbp);
    if (d3 >= 0 && d4 <= d3) {
      // vertex region of B; barycentric coords (0, 1, 0)
      return target.copy(b);
    }
    const vc = d1 * d4 - d3 * d2;
    if (vc <= 0 && d1 >= 0 && d3 <= 0) {
      v = d1 / (d1 - d3);
      // edge region of AB; barycentric coords (1-v, v, 0)
      return target.copy(a).addScaledVector(_vab, v);
    }
    _vcp.subVectors(p, c);
    const d5 = _vab.dot(_vcp);
    const d6 = _vac.dot(_vcp);
    if (d6 >= 0 && d5 <= d6) {
      // vertex region of C; barycentric coords (0, 0, 1)
      return target.copy(c);
    }
    const vb = d5 * d2 - d1 * d6;
    if (vb <= 0 && d2 >= 0 && d6 <= 0) {
      w = d2 / (d2 - d6);
      // edge region of AC; barycentric coords (1-w, 0, w)
      return target.copy(a).addScaledVector(_vac, w);
    }
    const va = d3 * d6 - d5 * d4;
    if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) {
      _vbc.subVectors(c, b);
      w = (d4 - d3) / (d4 - d3 + (d5 - d6));
      // edge region of BC; barycentric coords (0, 1-w, w)
      return target.copy(b).addScaledVector(_vbc, w); // edge region of BC
    }

    // face region
    const denom = 1 / (va + vb + vc);
    // u = va * denom
    v = vb * denom;
    w = vc * denom;
    return target.copy(a).addScaledVector(_vab, v).addScaledVector(_vac, w);
  }
  equals(triangle) {
    return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c);
  }
}

class MeshBasicMaterial extends Material {
  constructor(parameters) {
    super();
    this.isMeshBasicMaterial = true;
    this.type = 'MeshBasicMaterial';
    this.color = new Color(0xffffff); // emissive

    this.map = null;
    this.lightMap = null;
    this.lightMapIntensity = 1.0;
    this.aoMap = null;
    this.aoMapIntensity = 1.0;
    this.specularMap = null;
    this.alphaMap = null;
    this.envMap = null;
    this.envMapRotation = new Euler();
    this.combine = MultiplyOperation;
    this.reflectivity = 1;
    this.refractionRatio = 0.98;
    this.wireframe = false;
    this.wireframeLinewidth = 1;
    this.wireframeLinecap = 'round';
    this.wireframeLinejoin = 'round';
    this.fog = true;
    this.setValues(parameters);
  }
  copy(source) {
    super.copy(source);
    this.color.copy(source.color);
    this.map = source.map;
    this.lightMap = source.lightMap;
    this.lightMapIntensity = source.lightMapIntensity;
    this.aoMap = source.aoMap;
    this.aoMapIntensity = source.aoMapIntensity;
    this.specularMap = source.specularMap;
    this.alphaMap = source.alphaMap;
    this.envMap = source.envMap;
    this.envMapRotation.copy(source.envMapRotation);
    this.combine = source.combine;
    this.reflectivity = source.reflectivity;
    this.refractionRatio = source.refractionRatio;
    this.wireframe = source.wireframe;
    this.wireframeLinewidth = source.wireframeLinewidth;
    this.wireframeLinecap = source.wireframeLinecap;
    this.wireframeLinejoin = source.wireframeLinejoin;
    this.fog = source.fog;
    return this;
  }
}

const _inverseMatrix = /*@__PURE__*/new Matrix4();
const _ray = /*@__PURE__*/new Ray();
const _sphere = /*@__PURE__*/new Sphere();
const _sphereHitAt = /*@__PURE__*/new Vector3();
const _vA$1 = /*@__PURE__*/new Vector3();
const _vB$1 = /*@__PURE__*/new Vector3();
const _vC$1 = /*@__PURE__*/new Vector3();
const _tempA = /*@__PURE__*/new Vector3();
const _morphA = /*@__PURE__*/new Vector3();
const _uvA = /*@__PURE__*/new Vector2();
const _uvB = /*@__PURE__*/new Vector2();
const _uvC = /*@__PURE__*/new Vector2();
const _normalA = /*@__PURE__*/new Vector3();
const _normalB = /*@__PURE__*/new Vector3();
const _normalC = /*@__PURE__*/new Vector3();
const _intersectionPoint = /*@__PURE__*/new Vector3();
const _intersectionPointWorld = /*@__PURE__*/new Vector3();
class Mesh extends Object3D {
  constructor(geometry = new BufferGeometry(), material = new MeshBasicMaterial()) {
    super();
    this.isMesh = true;
    this.type = 'Mesh';
    this.geometry = geometry;
    this.material = material;
    this.updateMorphTargets();
  }
  copy(source, recursive) {
    super.copy(source, recursive);
    if (source.morphTargetInfluences !== undefined) {
      this.morphTargetInfluences = source.morphTargetInfluences.slice();
    }
    if (source.morphTargetDictionary !== undefined) {
      this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary);
    }
    this.material = Array.isArray(source.material) ? source.material.slice() : source.material;
    this.geometry = source.geometry;
    return this;
  }
  updateMorphTargets() {
    const geometry = this.geometry;
    const morphAttributes = geometry.morphAttributes;
    const keys = Object.keys(morphAttributes);
    if (keys.length > 0) {
      const morphAttribute = morphAttributes[keys[0]];
      if (morphAttribute !== undefined) {
        this.morphTargetInfluences = [];
        this.morphTargetDictionary = {};
        for (let m = 0, ml = morphAttribute.length; m < ml; m++) {
          const name = morphAttribute[m].name || String(m);
          this.morphTargetInfluences.push(0);
          this.morphTargetDictionary[name] = m;
        }
      }
    }
  }
  getVertexPosition(index, target) {
    const geometry = this.geometry;
    const position = geometry.attributes.position;
    const morphPosition = geometry.morphAttributes.position;
    const morphTargetsRelative = geometry.morphTargetsRelative;
    target.fromBufferAttribute(position, index);
    const morphInfluences = this.morphTargetInfluences;
    if (morphPosition && morphInfluences) {
      _morphA.set(0, 0, 0);
      for (let i = 0, il = morphPosition.length; i < il; i++) {
        const influence = morphInfluences[i];
        const morphAttribute = morphPosition[i];
        if (influence === 0) continue;
        _tempA.fromBufferAttribute(morphAttribute, index);
        if (morphTargetsRelative) {
          _morphA.addScaledVector(_tempA, influence);
        } else {
          _morphA.addScaledVector(_tempA.sub(target), influence);
        }
      }
      target.add(_morphA);
    }
    return target;
  }
  raycast(raycaster, intersects) {
    const geometry = this.geometry;
    const material = this.material;
    const matrixWorld = this.matrixWorld;
    if (material === undefined) return;

    // test with bounding sphere in world space

    if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
    _sphere.copy(geometry.boundingSphere);
    _sphere.applyMatrix4(matrixWorld);

    // check distance from ray origin to bounding sphere

    _ray.copy(raycaster.ray).recast(raycaster.near);
    if (_sphere.containsPoint(_ray.origin) === false) {
      if (_ray.intersectSphere(_sphere, _sphereHitAt) === null) return;
      if (_ray.origin.distanceToSquared(_sphereHitAt) > (raycaster.far - raycaster.near) ** 2) return;
    }

    // convert ray to local space of mesh

    _inverseMatrix.copy(matrixWorld).invert();
    _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);

    // test with bounding box in local space

    if (geometry.boundingBox !== null) {
      if (_ray.intersectsBox(geometry.boundingBox) === false) return;
    }

    // test for intersections with geometry

    this._computeIntersections(raycaster, intersects, _ray);
  }
  _computeIntersections(raycaster, intersects, rayLocalSpace) {
    let intersection;
    const geometry = this.geometry;
    const material = this.material;
    const index = geometry.index;
    const position = geometry.attributes.position;
    const uv = geometry.attributes.uv;
    const uv1 = geometry.attributes.uv1;
    const normal = geometry.attributes.normal;
    const groups = geometry.groups;
    const drawRange = geometry.drawRange;
    if (index !== null) {
      // indexed buffer geometry

      if (Array.isArray(material)) {
        for (let i = 0, il = groups.length; i < il; i++) {
          const group = groups[i];
          const groupMaterial = material[group.materialIndex];
          const start = Math.max(group.start, drawRange.start);
          const end = Math.min(index.count, Math.min(group.start + group.count, drawRange.start + drawRange.count));
          for (let j = start, jl = end; j < jl; j += 3) {
            const a = index.getX(j);
            const b = index.getX(j + 1);
            const c = index.getX(j + 2);
            intersection = checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);
            if (intersection) {
              intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics
              intersection.face.materialIndex = group.materialIndex;
              intersects.push(intersection);
            }
          }
        }
      } else {
        const start = Math.max(0, drawRange.start);
        const end = Math.min(index.count, drawRange.start + drawRange.count);
        for (let i = start, il = end; i < il; i += 3) {
          const a = index.getX(i);
          const b = index.getX(i + 1);
          const c = index.getX(i + 2);
          intersection = checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);
          if (intersection) {
            intersection.faceIndex = Math.floor(i / 3); // triangle number in indexed buffer semantics
            intersects.push(intersection);
          }
        }
      }
    } else if (position !== undefined) {
      // non-indexed buffer geometry

      if (Array.isArray(material)) {
        for (let i = 0, il = groups.length; i < il; i++) {
          const group = groups[i];
          const groupMaterial = material[group.materialIndex];
          const start = Math.max(group.start, drawRange.start);
          const end = Math.min(position.count, Math.min(group.start + group.count, drawRange.start + drawRange.count));
          for (let j = start, jl = end; j < jl; j += 3) {
            const a = j;
            const b = j + 1;
            const c = j + 2;
            intersection = checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);
            if (intersection) {
              intersection.faceIndex = Math.floor(j / 3); // triangle number in non-indexed buffer semantics
              intersection.face.materialIndex = group.materialIndex;
              intersects.push(intersection);
            }
          }
        }
      } else {
        const start = Math.max(0, drawRange.start);
        const end = Math.min(position.count, drawRange.start + drawRange.count);
        for (let i = start, il = end; i < il; i += 3) {
          const a = i;
          const b = i + 1;
          const c = i + 2;
          intersection = checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);
          if (intersection) {
            intersection.faceIndex = Math.floor(i / 3); // triangle number in non-indexed buffer semantics
            intersects.push(intersection);
          }
        }
      }
    }
  }
}
function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) {
  let intersect;
  if (material.side === BackSide) {
    intersect = ray.intersectTriangle(pC, pB, pA, true, point);
  } else {
    intersect = ray.intersectTriangle(pA, pB, pC, material.side === FrontSide, point);
  }
  if (intersect === null) return null;
  _intersectionPointWorld.copy(point);
  _intersectionPointWorld.applyMatrix4(object.matrixWorld);
  const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld);
  if (distance < raycaster.near || distance > raycaster.far) return null;
  return {
    distance: distance,
    point: _intersectionPointWorld.clone(),
    object: object
  };
}
function checkGeometryIntersection(object, material, raycaster, ray, uv, uv1, normal, a, b, c) {
  object.getVertexPosition(a, _vA$1);
  object.getVertexPosition(b, _vB$1);
  object.getVertexPosition(c, _vC$1);
  const intersection = checkIntersection(object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint);
  if (intersection) {
    if (uv) {
      _uvA.fromBufferAttribute(uv, a);
      _uvB.fromBufferAttribute(uv, b);
      _uvC.fromBufferAttribute(uv, c);
      intersection.uv = Triangle.getInterpolation(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA, _uvB, _uvC, new Vector2());
    }
    if (uv1) {
      _uvA.fromBufferAttribute(uv1, a);
      _uvB.fromBufferAttribute(uv1, b);
      _uvC.fromBufferAttribute(uv1, c);
      intersection.uv1 = Triangle.getInterpolation(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA, _uvB, _uvC, new Vector2());
    }
    if (normal) {
      _normalA.fromBufferAttribute(normal, a);
      _normalB.fromBufferAttribute(normal, b);
      _normalC.fromBufferAttribute(normal, c);
      intersection.normal = Triangle.getInterpolation(_intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3());
      if (intersection.normal.dot(ray.direction) > 0) {
        intersection.normal.multiplyScalar(-1);
      }
    }
    const face = {
      a: a,
      b: b,
      c: c,
      normal: new Vector3(),
      materialIndex: 0
    };
    Triangle.getNormal(_vA$1, _vB$1, _vC$1, face.normal);
    intersection.face = face;
  }
  return intersection;
}

class Camera extends Object3D {
  constructor() {
    super();
    this.isCamera = true;
    this.type = 'Camera';
    this.matrixWorldInverse = new Matrix4();
    this.projectionMatrix = new Matrix4();
    this.projectionMatrixInverse = new Matrix4();
    this.coordinateSystem = WebGLCoordinateSystem;
  }
  copy(source, recursive) {
    super.copy(source, recursive);
    this.matrixWorldInverse.copy(source.matrixWorldInverse);
    this.projectionMatrix.copy(source.projectionMatrix);
    this.projectionMatrixInverse.copy(source.projectionMatrixInverse);
    this.coordinateSystem = source.coordinateSystem;
    return this;
  }
  getWorldDirection(target) {
    return super.getWorldDirection(target).negate();
  }
  updateMatrixWorld(force) {
    super.updateMatrixWorld(force);
    this.matrixWorldInverse.copy(this.matrixWorld).invert();
  }
  updateWorldMatrix(updateParents, updateChildren) {
    super.updateWorldMatrix(updateParents, updateChildren);
    this.matrixWorldInverse.copy(this.matrixWorld).invert();
  }
  clone() {
    return new this.constructor().copy(this);
  }
}

class OrthographicCamera extends Camera {
  constructor(left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2000) {
    super();
    this.isOrthographicCamera = true;
    this.type = 'OrthographicCamera';
    this.zoom = 1;
    this.view = null;
    this.left = left;
    this.right = right;
    this.top = top;
    this.bottom = bottom;
    this.near = near;
    this.far = far;
    this.updateProjectionMatrix();
  }
  copy(source, recursive) {
    super.copy(source, recursive);
    this.left = source.left;
    this.right = source.right;
    this.top = source.top;
    this.bottom = source.bottom;
    this.near = source.near;
    this.far = source.far;
    this.zoom = source.zoom;
    this.view = source.view === null ? null : Object.assign({}, source.view);
    return this;
  }
  setViewOffset(fullWidth, fullHeight, x, y, width, height) {
    if (this.view === null) {
      this.view = {
        enabled: true,
        fullWidth: 1,
        fullHeight: 1,
        offsetX: 0,
        offsetY: 0,
        width: 1,
        height: 1
      };
    }
    this.view.enabled = true;
    this.view.fullWidth = fullWidth;
    this.view.fullHeight = fullHeight;
    this.view.offsetX = x;
    this.view.offsetY = y;
    this.view.width = width;
    this.view.height = height;
    this.updateProjectionMatrix();
  }
  clearViewOffset() {
    if (this.view !== null) {
      this.view.enabled = false;
    }
    this.updateProjectionMatrix();
  }
  updateProjectionMatrix() {
    const dx = (this.right - this.left) / (2 * this.zoom);
    const dy = (this.top - this.bottom) / (2 * this.zoom);
    const cx = (this.right + this.left) / 2;
    const cy = (this.top + this.bottom) / 2;
    let left = cx - dx;
    let right = cx + dx;
    let top = cy + dy;
    let bottom = cy - dy;
    if (this.view !== null && this.view.enabled) {
      const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom;
      const scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom;
      left += scaleW * this.view.offsetX;
      right = left + scaleW * this.view.width;
      top -= scaleH * this.view.offsetY;
      bottom = top - scaleH * this.view.height;
    }
    this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far, this.coordinateSystem);
    this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
  }
  toJSON(meta) {
    const data = super.toJSON(meta);
    data.object.zoom = this.zoom;
    data.object.left = this.left;
    data.object.right = this.right;
    data.object.top = this.top;
    data.object.bottom = this.bottom;
    data.object.near = this.near;
    data.object.far = this.far;
    if (this.view !== null) data.object.view = Object.assign({}, this.view);
    return data;
  }
}

// Helper for passes that need to fill the viewport with a single quad.

const _camera = /*@__PURE__*/new OrthographicCamera(-1, 1, 1, -1, 0, 1);

// https://github.com/mrdoob/three.js/pull/21358

class QuadGeometry extends BufferGeometry {
  constructor(flipY = false) {
    super();
    const uv = flipY === false ? [0, -1, 0, 1, 2, 1] : [0, 2, 0, 0, 2, 0];
    this.setAttribute('position', new Float32BufferAttribute([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3));
    this.setAttribute('uv', new Float32BufferAttribute(uv, 2));
  }
}
const _geometry = /*@__PURE__*/new QuadGeometry();
class QuadMesh extends Mesh {
  constructor(material = null) {
    super(_geometry, material);
    this.camera = _camera;
    this.isQuadMesh = true;
  }
  renderAsync(renderer) {
    return renderer.renderAsync(this, _camera);
  }
  render(renderer) {
    renderer.render(this, _camera);
  }
}
var QuadMesh$1 = QuadMesh;

const _size$5 = /*@__PURE__*/new Vector2();
class RTTNode extends TextureNode {
  constructor(node, width = null, height = null, options = {
    type: HalfFloatType
  }) {
    const renderTarget = new RenderTarget(width, height, options);
    super(renderTarget.texture, uv());
    this.node = node;
    this.width = width;
    this.height = height;
    this.renderTarget = renderTarget;
    this.textureNeedsUpdate = true;
    this.autoUpdate = true;
    this.updateMap = new WeakMap();
    this._rttNode = null;
    this._quadMesh = new QuadMesh$1(new NodeMaterial$1());
    this.updateBeforeType = NodeUpdateType.RENDER;
  }
  get autoSize() {
    return this.width === null;
  }
  setup(builder) {
    this._rttNode = this.node.context(builder.getSharedContext());
    this._quadMesh.material.name = 'RTT';
    this._quadMesh.material.needsUpdate = true;
    return super.setup(builder);
  }
  setSize(width, height) {
    this.width = width;
    this.height = height;
    const effectiveWidth = width * this.pixelRatio;
    const effectiveHeight = height * this.pixelRatio;
    this.renderTarget.setSize(effectiveWidth, effectiveHeight);
    this.textureNeedsUpdate = true;
  }
  setPixelRatio(pixelRatio) {
    this.pixelRatio = pixelRatio;
    this.setSize(this.width, this.height);
  }
  updateBefore({
    renderer
  }) {
    if (this.textureNeedsUpdate === false && this.autoUpdate === false) return;
    this.textureNeedsUpdate = false;

    //

    if (this.autoSize === true) {
      this.pixelRatio = renderer.getPixelRatio();
      const size = renderer.getSize(_size$5);
      this.setSize(size.width, size.height);
    }

    //

    this._quadMesh.material.fragmentNode = this._rttNode;

    //

    const currentRenderTarget = renderer.getRenderTarget();
    renderer.setRenderTarget(this.renderTarget);
    this._quadMesh.render(renderer);
    renderer.setRenderTarget(currentRenderTarget);
  }
  clone() {
    const newNode = new TextureNode(this.value, this.uvNode, this.levelNode);
    newNode.sampler = this.sampler;
    newNode.referenceNode = this;
    return newNode;
  }
}
RTTNode.type = /*@__PURE__*/registerNode('RTT', RTTNode);
const rtt = (node, ...params) => nodeObject(new RTTNode(nodeObject(node), ...params));
const convertToTexture = (node, ...params) => node.isTextureNode ? node : rtt(node, ...params);

class VertexColorNode extends AttributeNode {
  constructor(index = 0) {
    super(null, 'vec4');
    this.isVertexColorNode = true;
    this.index = index;
  }
  getAttributeName(/*builder*/
  ) {
    const index = this.index;
    return 'color' + (index > 0 ? index : '');
  }
  generate(builder) {
    const attributeName = this.getAttributeName(builder);
    const geometryAttribute = builder.hasGeometryAttribute(attributeName);
    let result;
    if (geometryAttribute === true) {
      result = super.generate(builder);
    } else {
      // Vertex color fallback should be white
      result = builder.generateConst(this.nodeType, new Vector4(1, 1, 1, 1));
    }
    return result;
  }
  serialize(data) {
    super.serialize(data);
    data.index = this.index;
  }
  deserialize(data) {
    super.deserialize(data);
    this.index = data.index;
  }
}
VertexColorNode.type = /*@__PURE__*/registerNode('VertexColor', VertexColorNode);

class PointUVNode extends Node$1 {
  constructor() {
    super('vec2');
    this.isPointUVNode = true;
  }
  generate(/*builder*/
  ) {
    return 'vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )';
  }
}
PointUVNode.type = /*@__PURE__*/registerNode('PointUV', PointUVNode);

class SceneNode extends Node$1 {
  constructor(scope = SceneNode.BACKGROUND_BLURRINESS, scene = null) {
    super();
    this.scope = scope;
    this.scene = scene;
  }
  setup(builder) {
    const scope = this.scope;
    const scene = this.scene !== null ? this.scene : builder.scene;
    let output;
    if (scope === SceneNode.BACKGROUND_BLURRINESS) {
      output = reference('backgroundBlurriness', 'float', scene);
    } else if (scope === SceneNode.BACKGROUND_INTENSITY) {
      output = reference('backgroundIntensity', 'float', scene);
    } else {
      console.error('THREE.SceneNode: Unknown scope:', scope);
    }
    return output;
  }
}
SceneNode.BACKGROUND_BLURRINESS = 'backgroundBlurriness';
SceneNode.BACKGROUND_INTENSITY = 'backgroundIntensity';
SceneNode.type = /*@__PURE__*/registerNode('Scene', SceneNode);
const backgroundBlurriness = /*@__PURE__*/nodeImmutable(SceneNode, SceneNode.BACKGROUND_BLURRINESS);
const backgroundIntensity = /*@__PURE__*/nodeImmutable(SceneNode, SceneNode.BACKGROUND_INTENSITY);

class StorageArrayElementNode extends ArrayElementNode {
  constructor(storageBufferNode, indexNode) {
    super(storageBufferNode, indexNode);
    this.isStorageArrayElementNode = true;
  }
  set storageBufferNode(value) {
    this.node = value;
  }
  get storageBufferNode() {
    return this.node;
  }
  setup(builder) {
    if (builder.isAvailable('storageBuffer') === false) {
      if (!this.node.instanceIndex && this.node.bufferObject === true) {
        builder.setupPBO(this.node);
      }
    }
    return super.setup(builder);
  }
  generate(builder, output) {
    let snippet;
    const isAssignContext = builder.context.assign;

    //

    if (builder.isAvailable('storageBuffer') === false) {
      const {
        node
      } = this;
      if (!node.instanceIndex && this.node.bufferObject === true && isAssignContext !== true) {
        snippet = builder.generatePBO(this);
      } else {
        snippet = node.build(builder);
      }
    } else {
      snippet = super.generate(builder);
    }
    if (isAssignContext !== true) {
      const type = this.getNodeType(builder);
      snippet = builder.format(snippet, type, output);
    }
    return snippet;
  }
}
StorageArrayElementNode.type = /*@__PURE__*/registerNode('StorageArrayElement', StorageArrayElementNode);
const storageElement = /*@__PURE__*/nodeProxy(StorageArrayElementNode);

const GPUBufferBindingType = {
  Uniform: 'uniform',
  Storage: 'storage',
  ReadOnlyStorage: 'read-only-storage'
};
const GPUStorageTextureAccess = {
  WriteOnly: 'write-only',
  ReadOnly: 'read-only',
  ReadWrite: 'read-write'
};

class StorageBufferNode extends BufferNode {
  constructor(value, bufferType, bufferCount = 0) {
    super(value, bufferType, bufferCount);
    this.isStorageBufferNode = true;
    this.access = GPUBufferBindingType.Storage;
    this.bufferObject = false;
    this.bufferCount = bufferCount;
    this._attribute = null;
    this._varying = null;
    this.global = true;
    if (value.isStorageBufferAttribute !== true && value.isStorageInstancedBufferAttribute !== true) {
      // TOOD: Improve it, possibly adding a new property to the BufferAttribute to identify it as a storage buffer read-only attribute in Renderer

      if (value.isInstancedBufferAttribute) value.isStorageInstancedBufferAttribute = true;else value.isStorageBufferAttribute = true;
    }
  }
  getHash(builder) {
    if (this.bufferCount === 0) {
      let bufferData = builder.globalCache.getData(this.value);
      if (bufferData === undefined) {
        bufferData = {
          node: this
        };
        builder.globalCache.setData(this.value, bufferData);
      }
      return bufferData.node.uuid;
    }
    return this.uuid;
  }
  getInputType(/*builder*/
  ) {
    return 'storageBuffer';
  }
  element(indexNode) {
    return storageElement(this, indexNode);
  }
  setBufferObject(value) {
    this.bufferObject = value;
    return this;
  }
  setAccess(value) {
    this.access = value;
    return this;
  }
  toReadOnly() {
    return this.setAccess(GPUBufferBindingType.ReadOnlyStorage);
  }
  generate(builder) {
    if (builder.isAvailable('storageBuffer')) {
      return super.generate(builder);
    }
    const nodeType = this.getNodeType(builder);
    if (this._attribute === null) {
      this._attribute = bufferAttribute(this.value);
      this._varying = varying(this._attribute);
    }
    const output = this._varying.build(builder, nodeType);
    builder.registerTransform(output, this._attribute);
    return output;
  }
}
StorageBufferNode.type = /*@__PURE__*/registerNode('StorageBuffer', StorageBufferNode);

class StorageTextureNode extends TextureNode {
  constructor(value, uvNode, storeNode = null) {
    super(value, uvNode);
    this.storeNode = storeNode;
    this.isStorageTextureNode = true;
    this.access = GPUStorageTextureAccess.WriteOnly;
  }
  getInputType(/*builder*/
  ) {
    return 'storageTexture';
  }
  setup(builder) {
    super.setup(builder);
    const properties = builder.getNodeProperties(this);
    properties.storeNode = this.storeNode;
  }
  setAccess(value) {
    this.access = value;
    return this;
  }
  generate(builder, output) {
    let snippet;
    if (this.storeNode !== null) {
      snippet = this.generateStore(builder);
    } else {
      snippet = super.generate(builder, output);
    }
    return snippet;
  }
  toReadOnly() {
    return this.setAccess(GPUStorageTextureAccess.ReadOnly);
  }
  toWriteOnly() {
    return this.setAccess(GPUStorageTextureAccess.WriteOnly);
  }
  generateStore(builder) {
    const properties = builder.getNodeProperties(this);
    const {
      uvNode,
      storeNode
    } = properties;
    const textureProperty = super.generate(builder, 'property');
    const uvSnippet = uvNode.build(builder, 'uvec2');
    const storeSnippet = storeNode.build(builder, 'vec4');
    const snippet = builder.generateTextureStore(builder, textureProperty, uvSnippet, storeSnippet);
    builder.addLineFlowCode(snippet);
  }
}
StorageTextureNode.type = /*@__PURE__*/registerNode('StorageTexture', StorageTextureNode);

const normal = Fn(({
  texture,
  uv
}) => {
  const epsilon = 0.0001;
  const ret = vec3().temp();
  If(uv.x.lessThan(epsilon), () => {
    ret.assign(vec3(1, 0, 0));
  }).ElseIf(uv.y.lessThan(epsilon), () => {
    ret.assign(vec3(0, 1, 0));
  }).ElseIf(uv.z.lessThan(epsilon), () => {
    ret.assign(vec3(0, 0, 1));
  }).ElseIf(uv.x.greaterThan(1 - epsilon), () => {
    ret.assign(vec3(-1, 0, 0));
  }).ElseIf(uv.y.greaterThan(1 - epsilon), () => {
    ret.assign(vec3(0, -1, 0));
  }).ElseIf(uv.z.greaterThan(1 - epsilon), () => {
    ret.assign(vec3(0, 0, -1));
  }).Else(() => {
    const step = 0.01;
    const x = texture.uv(uv.add(vec3(-step, 0.0, 0.0))).r.sub(texture.uv(uv.add(vec3(step, 0.0, 0.0))).r);
    const y = texture.uv(uv.add(vec3(0.0, -step, 0.0))).r.sub(texture.uv(uv.add(vec3(0.0, step, 0.0))).r);
    const z = texture.uv(uv.add(vec3(0.0, 0.0, -step))).r.sub(texture.uv(uv.add(vec3(0.0, 0.0, step))).r);
    ret.assign(vec3(x, y, z));
  });
  return ret.normalize();
});
class Texture3DNode extends TextureNode {
  constructor(value, uvNode = null, levelNode = null) {
    super(value, uvNode, levelNode);
    this.isTexture3DNode = true;
  }
  getInputType(/*builder*/
  ) {
    return 'texture3D';
  }
  getDefaultUV() {
    return vec3(0.5, 0.5, 0.5);
  }
  setUpdateMatrix(/*updateMatrix*/) {} // Ignore .updateMatrix for 3d TextureNode

  setupUV(builder, uvNode) {
    return uvNode;
  }
  generateUV(builder, uvNode) {
    return uvNode.build(builder, 'vec3');
  }
  normal(uvNode) {
    return normal({
      texture: this,
      uv: uvNode
    });
  }
}
Texture3DNode.type = /*@__PURE__*/registerNode('Texture3D', Texture3DNode);

class UserDataNode extends ReferenceNode {
  constructor(property, inputType, userData = null) {
    super(property, inputType, userData);
    this.userData = userData;
  }
  update(frame) {
    this.reference = this.userData !== null ? this.userData : frame.object.userData;
    super.update(frame);
  }
}
UserDataNode.type = /*@__PURE__*/registerNode('UserData', UserDataNode);

const _matrixCache = new WeakMap();
class VelocityNode extends TempNode {
  constructor() {
    super('vec2');
    this.updateType = NodeUpdateType.OBJECT;
    this.updateAfterType = NodeUpdateType.OBJECT;
    this.previousProjectionMatrix = uniform(new Matrix4());
    this.previousModelViewMatrix = uniform(new Matrix4());
  }
  update({
    camera,
    object
  }) {
    const previousModelMatrix = getPreviousMatrix(object);
    const previousCameraMatrix = getPreviousMatrix(camera);
    this.previousModelViewMatrix.value.copy(previousModelMatrix);
    this.previousProjectionMatrix.value.copy(previousCameraMatrix);
  }
  updateAfter({
    camera,
    object
  }) {
    const previousModelMatrix = getPreviousMatrix(object);
    const previousCameraMatrix = getPreviousMatrix(camera);
    previousModelMatrix.copy(object.modelViewMatrix);
    previousCameraMatrix.copy(camera.projectionMatrix);
  }
  setup(/*builder*/
  ) {
    const clipPositionCurrent = cameraProjectionMatrix.mul(modelViewMatrix).mul(positionLocal);
    const clipPositionPrevious = this.previousProjectionMatrix.mul(this.previousModelViewMatrix).mul(positionPrevious);
    const ndcPositionCurrent = clipPositionCurrent.xy.div(clipPositionCurrent.w);
    const ndcPositionPrevious = clipPositionPrevious.xy.div(clipPositionPrevious.w);
    const velocity = sub(ndcPositionCurrent, ndcPositionPrevious);
    return velocity;
  }
}
function getPreviousMatrix(object) {
  let previousMatrix = _matrixCache.get(object);
  if (previousMatrix === undefined) {
    previousMatrix = new Matrix4();
    _matrixCache.set(object, previousMatrix);
  }
  return previousMatrix;
}
VelocityNode.type = /*@__PURE__*/registerNode('Velocity', VelocityNode);

const _luminanceCoefficients = /*@__PURE__*/new Vector3();
const luminance = (color, luminanceCoefficients = vec3(...ColorManagement.getLuminanceCoefficients(_luminanceCoefficients))) => dot(color, luminanceCoefficients);

class PosterizeNode extends TempNode {
  constructor(sourceNode, stepsNode) {
    super();
    this.sourceNode = sourceNode;
    this.stepsNode = stepsNode;
  }
  setup() {
    const {
      sourceNode,
      stepsNode
    } = this;
    return sourceNode.mul(stepsNode).floor().div(stepsNode);
  }
}
PosterizeNode.type = /*@__PURE__*/registerNode('Posterize', PosterizeNode);

let _sharedFramebuffer = null;
class ViewportSharedTextureNode extends ViewportTextureNode {
  constructor(uvNode = viewportUV, levelNode = null) {
    if (_sharedFramebuffer === null) {
      _sharedFramebuffer = new FramebufferTexture();
    }
    super(uvNode, levelNode, _sharedFramebuffer);
  }
  updateReference() {
    return this;
  }
}
ViewportSharedTextureNode.type = /*@__PURE__*/registerNode('ViewportSharedTexture', ViewportSharedTextureNode);

const _size$4 = /*@__PURE__*/new Vector2();
class PassTextureNode extends TextureNode {
  constructor(passNode, texture) {
    super(texture);
    this.passNode = passNode;
    this.setUpdateMatrix(false);
  }
  setup(builder) {
    if (builder.object.isQuadMesh) this.passNode.build(builder);
    return super.setup(builder);
  }
  clone() {
    return new this.constructor(this.passNode, this.value);
  }
}
PassTextureNode.type = /*@__PURE__*/registerNode('PassTexture', PassTextureNode);
class PassMultipleTextureNode extends PassTextureNode {
  constructor(passNode, textureName, previousTexture = false) {
    super(passNode, null);
    this.textureName = textureName;
    this.previousTexture = previousTexture;
  }
  updateTexture() {
    this.value = this.previousTexture ? this.passNode.getPreviousTexture(this.textureName) : this.passNode.getTexture(this.textureName);
  }
  setup(builder) {
    this.updateTexture();
    return super.setup(builder);
  }
  clone() {
    return new this.constructor(this.passNode, this.textureName, this.previousTexture);
  }
}
PassMultipleTextureNode.type = /*@__PURE__*/registerNode('PassMultipleTexture', PassMultipleTextureNode);
class PassNode extends TempNode {
  constructor(scope, scene, camera, options = {}) {
    super('vec4');
    this.scope = scope;
    this.scene = scene;
    this.camera = camera;
    this.options = options;
    this._pixelRatio = 1;
    this._width = 1;
    this._height = 1;
    const depthTexture = new DepthTexture();
    depthTexture.isRenderTargetTexture = true;
    //depthTexture.type = FloatType;
    depthTexture.name = 'depth';
    const renderTarget = new RenderTarget(this._width * this._pixelRatio, this._height * this._pixelRatio, {
      type: HalfFloatType,
      ...options
    });
    renderTarget.texture.name = 'output';
    renderTarget.depthTexture = depthTexture;
    this.renderTarget = renderTarget;
    this.updateBeforeType = NodeUpdateType.FRAME;
    this._textures = {
      output: renderTarget.texture,
      depth: depthTexture
    };
    this._textureNodes = {};
    this._linearDepthNodes = {};
    this._viewZNodes = {};
    this._previousTextures = {};
    this._previousTextureNodes = {};
    this._cameraNear = uniform(0);
    this._cameraFar = uniform(0);
    this._mrt = null;
    this.isPassNode = true;
  }
  setMRT(mrt) {
    this._mrt = mrt;
    return this;
  }
  getMRT() {
    return this._mrt;
  }
  isGlobal() {
    return true;
  }
  getTexture(name) {
    let texture = this._textures[name];
    if (texture === undefined) {
      const refTexture = this.renderTarget.texture;
      texture = refTexture.clone();
      texture.isRenderTargetTexture = true;
      texture.name = name;
      this._textures[name] = texture;
      this.renderTarget.textures.push(texture);
    }
    return texture;
  }
  getPreviousTexture(name) {
    let texture = this._previousTextures[name];
    if (texture === undefined) {
      texture = this.getTexture(name).clone();
      texture.isRenderTargetTexture = true;
      this._previousTextures[name] = texture;
    }
    return texture;
  }
  toggleTexture(name) {
    const prevTexture = this._previousTextures[name];
    if (prevTexture !== undefined) {
      const texture = this._textures[name];
      const index = this.renderTarget.textures.indexOf(texture);
      this.renderTarget.textures[index] = prevTexture;
      this._textures[name] = prevTexture;
      this._previousTextures[name] = texture;
      this._textureNodes[name].updateTexture();
      this._previousTextureNodes[name].updateTexture();
    }
  }
  getTextureNode(name = 'output') {
    let textureNode = this._textureNodes[name];
    if (textureNode === undefined) {
      this._textureNodes[name] = textureNode = nodeObject(new PassMultipleTextureNode(this, name));
      this._textureNodes[name].updateTexture();
    }
    return textureNode;
  }
  getPreviousTextureNode(name = 'output') {
    let textureNode = this._previousTextureNodes[name];
    if (textureNode === undefined) {
      if (this._textureNodes[name] === undefined) this.getTextureNode(name);
      this._previousTextureNodes[name] = textureNode = nodeObject(new PassMultipleTextureNode(this, name, true));
      this._previousTextureNodes[name].updateTexture();
    }
    return textureNode;
  }
  getViewZNode(name = 'depth') {
    let viewZNode = this._viewZNodes[name];
    if (viewZNode === undefined) {
      const cameraNear = this._cameraNear;
      const cameraFar = this._cameraFar;
      this._viewZNodes[name] = viewZNode = perspectiveDepthToViewZ(this.getTextureNode(name), cameraNear, cameraFar);
    }
    return viewZNode;
  }
  getLinearDepthNode(name = 'depth') {
    let linearDepthNode = this._linearDepthNodes[name];
    if (linearDepthNode === undefined) {
      const cameraNear = this._cameraNear;
      const cameraFar = this._cameraFar;
      const viewZNode = this.getViewZNode(name);

      // TODO: just if ( builder.camera.isPerspectiveCamera )

      this._linearDepthNodes[name] = linearDepthNode = viewZToOrthographicDepth(viewZNode, cameraNear, cameraFar);
    }
    return linearDepthNode;
  }
  setup({
    renderer
  }) {
    this.renderTarget.samples = this.options.samples === undefined ? renderer.samples : this.options.samples;

    // Disable MSAA for WebGL backend for now
    if (renderer.backend.isWebGLBackend === true) {
      this.renderTarget.samples = 0;
    }
    this.renderTarget.depthTexture.isMultisampleRenderTargetTexture = this.renderTarget.samples > 1;
    return this.scope === PassNode.COLOR ? this.getTextureNode() : this.getLinearDepthNode();
  }
  updateBefore(frame) {
    const {
      renderer
    } = frame;
    const {
      scene,
      camera
    } = this;
    this._pixelRatio = renderer.getPixelRatio();
    const size = renderer.getSize(_size$4);
    this.setSize(size.width, size.height);
    const currentRenderTarget = renderer.getRenderTarget();
    const currentMRT = renderer.getMRT();
    this._cameraNear.value = camera.near;
    this._cameraFar.value = camera.far;
    for (const name in this._previousTextures) {
      this.toggleTexture(name);
    }
    renderer.setRenderTarget(this.renderTarget);
    renderer.setMRT(this._mrt);
    renderer.render(scene, camera);
    renderer.setRenderTarget(currentRenderTarget);
    renderer.setMRT(currentMRT);
  }
  setSize(width, height) {
    this._width = width;
    this._height = height;
    const effectiveWidth = this._width * this._pixelRatio;
    const effectiveHeight = this._height * this._pixelRatio;
    this.renderTarget.setSize(effectiveWidth, effectiveHeight);
  }
  setPixelRatio(pixelRatio) {
    this._pixelRatio = pixelRatio;
    this.setSize(this._width, this._height);
  }
  dispose() {
    this.renderTarget.dispose();
  }
}
PassNode.COLOR = 'color';
PassNode.DEPTH = 'depth';
PassNode.type = /*@__PURE__*/registerNode('Pass', PassNode);
const passTexture = (pass, texture) => nodeObject(new PassTextureNode(pass, texture));

// WebGPU: The use of a single QuadMesh for both gaussian blur passes results in a single RenderObject with a SampledTexture binding that
// alternates between source textures and triggers creation of new BindGroups and BindGroupLayouts every frame.

const _quadMesh1 = /*@__PURE__*/new QuadMesh$1();
const _quadMesh2 = /*@__PURE__*/new QuadMesh$1();
class GaussianBlurNode extends TempNode {
  constructor(textureNode, directionNode = null, sigma = 2) {
    super('vec4');
    this.textureNode = textureNode;
    this.directionNode = directionNode;
    this.sigma = sigma;
    this._invSize = uniform(new Vector2());
    this._passDirection = uniform(new Vector2());
    this._horizontalRT = new RenderTarget();
    this._horizontalRT.texture.name = 'GaussianBlurNode.horizontal';
    this._verticalRT = new RenderTarget();
    this._verticalRT.texture.name = 'GaussianBlurNode.vertical';
    this._textureNode = passTexture(this, this._verticalRT.texture);
    this.updateBeforeType = NodeUpdateType.RENDER;
    this.resolution = new Vector2(1, 1);
  }
  setSize(width, height) {
    width = Math.max(Math.round(width * this.resolution.x), 1);
    height = Math.max(Math.round(height * this.resolution.y), 1);
    this._invSize.value.set(1 / width, 1 / height);
    this._horizontalRT.setSize(width, height);
    this._verticalRT.setSize(width, height);
  }
  updateBefore(frame) {
    const {
      renderer
    } = frame;
    const textureNode = this.textureNode;
    const map = textureNode.value;
    const currentRenderTarget = renderer.getRenderTarget();
    const currentMRT = renderer.getMRT();
    const currentTexture = textureNode.value;
    _quadMesh1.material = this._material;
    _quadMesh2.material = this._material;
    this.setSize(map.image.width, map.image.height);
    const textureType = map.type;
    this._horizontalRT.texture.type = textureType;
    this._verticalRT.texture.type = textureType;

    // clear

    renderer.setMRT(null);

    // horizontal

    renderer.setRenderTarget(this._horizontalRT);
    this._passDirection.value.set(1, 0);
    _quadMesh1.render(renderer);

    // vertical

    textureNode.value = this._horizontalRT.texture;
    renderer.setRenderTarget(this._verticalRT);
    this._passDirection.value.set(0, 1);
    _quadMesh2.render(renderer);

    // restore

    renderer.setRenderTarget(currentRenderTarget);
    renderer.setMRT(currentMRT);
    textureNode.value = currentTexture;
  }
  getTextureNode() {
    return this._textureNode;
  }
  setup(builder) {
    const textureNode = this.textureNode;
    if (textureNode.isTextureNode !== true) {
      console.error('GaussianBlurNode requires a TextureNode.');
      return vec4();
    }

    //

    const uvNode = textureNode.uvNode || uv();
    const directionNode = vec2(this.directionNode || 1);
    const sampleTexture = uv => textureNode.uv(uv);
    const blur = Fn(() => {
      const kernelSize = 3 + 2 * this.sigma;
      const gaussianCoefficients = this._getCoefficients(kernelSize);
      const invSize = this._invSize;
      const direction = directionNode.mul(this._passDirection);
      const weightSum = float(gaussianCoefficients[0]).toVar();
      const diffuseSum = vec4(sampleTexture(uvNode).mul(weightSum)).toVar();
      for (let i = 1; i < kernelSize; i++) {
        const x = float(i);
        const w = float(gaussianCoefficients[i]);
        const uvOffset = vec2(direction.mul(invSize.mul(x))).toVar();
        const sample1 = vec4(sampleTexture(uvNode.add(uvOffset)));
        const sample2 = vec4(sampleTexture(uvNode.sub(uvOffset)));
        diffuseSum.addAssign(sample1.add(sample2).mul(w));
        weightSum.addAssign(mul(2.0, w));
      }
      return diffuseSum.div(weightSum);
    });

    //

    const material = this._material || (this._material = new NodeMaterial$1());
    material.fragmentNode = blur().context(builder.getSharedContext());
    material.name = 'Gaussian_blur';
    material.needsUpdate = true;

    //

    const properties = builder.getNodeProperties(this);
    properties.textureNode = textureNode;

    //

    return this._textureNode;
  }
  dispose() {
    this._horizontalRT.dispose();
    this._verticalRT.dispose();
  }
  _getCoefficients(kernelRadius) {
    const coefficients = [];
    for (let i = 0; i < kernelRadius; i++) {
      coefficients.push(0.39894 * Math.exp(-0.5 * i * i / (kernelRadius * kernelRadius)) / kernelRadius);
    }
    return coefficients;
  }
}
GaussianBlurNode.type = /*@__PURE__*/registerNode('GaussianBlur', GaussianBlurNode);

class SobelOperatorNode extends TempNode {
  constructor(textureNode) {
    super();
    this.textureNode = textureNode;
    this.updateBeforeType = NodeUpdateType.RENDER;
    this._invSize = uniform(new Vector2());
  }
  updateBefore() {
    const map = this.textureNode.value;
    this._invSize.value.set(1 / map.image.width, 1 / map.image.height);
  }
  setup() {
    const {
      textureNode
    } = this;
    const uvNode = textureNode.uvNode || uv();
    const sampleTexture = uv => textureNode.uv(uv);
    const sobel = Fn(() => {
      // Sobel Edge Detection (see https://youtu.be/uihBwtPIBxM)

      const texel = this._invSize;

      // kernel definition (in glsl matrices are filled in column-major order)

      const Gx = mat3(-1, -2, -1, 0, 0, 0, 1, 2, 1); // x direction kernel
      const Gy = mat3(-1, 0, 1, -2, 0, 2, -1, 0, 1); // y direction kernel

      // fetch the 3x3 neighbourhood of a fragment

      // first column

      const tx0y0 = luminance(sampleTexture(uvNode.add(texel.mul(vec2(-1, -1)))).xyz);
      const tx0y1 = luminance(sampleTexture(uvNode.add(texel.mul(vec2(-1, 0)))).xyz);
      const tx0y2 = luminance(sampleTexture(uvNode.add(texel.mul(vec2(-1, 1)))).xyz);

      // second column

      const tx1y0 = luminance(sampleTexture(uvNode.add(texel.mul(vec2(0, -1)))).xyz);
      const tx1y1 = luminance(sampleTexture(uvNode.add(texel.mul(vec2(0, 0)))).xyz);
      const tx1y2 = luminance(sampleTexture(uvNode.add(texel.mul(vec2(0, 1)))).xyz);

      // third column

      const tx2y0 = luminance(sampleTexture(uvNode.add(texel.mul(vec2(1, -1)))).xyz);
      const tx2y1 = luminance(sampleTexture(uvNode.add(texel.mul(vec2(1, 0)))).xyz);
      const tx2y2 = luminance(sampleTexture(uvNode.add(texel.mul(vec2(1, 1)))).xyz);

      // gradient value in x direction

      const valueGx = add(Gx[0][0].mul(tx0y0), Gx[1][0].mul(tx1y0), Gx[2][0].mul(tx2y0), Gx[0][1].mul(tx0y1), Gx[1][1].mul(tx1y1), Gx[2][1].mul(tx2y1), Gx[0][2].mul(tx0y2), Gx[1][2].mul(tx1y2), Gx[2][2].mul(tx2y2));

      // gradient value in y direction

      const valueGy = add(Gy[0][0].mul(tx0y0), Gy[1][0].mul(tx1y0), Gy[2][0].mul(tx2y0), Gy[0][1].mul(tx0y1), Gy[1][1].mul(tx1y1), Gy[2][1].mul(tx2y1), Gy[0][2].mul(tx0y2), Gy[1][2].mul(tx1y2), Gy[2][2].mul(tx2y2));

      // magnitute of the total gradient

      const G = valueGx.mul(valueGx).add(valueGy.mul(valueGy)).sqrt();
      return vec4(vec3(G), 1);
    });
    const outputNode = sobel();
    return outputNode;
  }
}
SobelOperatorNode.type = /*@__PURE__*/registerNode('SobelOperator', SobelOperatorNode);

class DepthOfFieldNode extends TempNode {
  constructor(textureNode, viewZNode, focusNode, apertureNode, maxblurNode) {
    super();
    this.textureNode = textureNode;
    this.viewZNode = viewZNode;
    this.focusNode = focusNode;
    this.apertureNode = apertureNode;
    this.maxblurNode = maxblurNode;
    this._aspect = uniform(0);
    this.updateBeforeType = NodeUpdateType.RENDER;
  }
  updateBefore() {
    const map = this.textureNode.value;
    this._aspect.value = map.image.width / map.image.height;
  }
  setup() {
    const textureNode = this.textureNode;
    const uvNode = textureNode.uvNode || uv();
    const sampleTexture = uv => textureNode.uv(uv);
    const dof = Fn(() => {
      const aspectcorrect = vec2(1.0, this._aspect);
      const factor = this.focusNode.add(this.viewZNode);
      const dofblur = vec2(clamp(factor.mul(this.apertureNode), this.maxblurNode.negate(), this.maxblurNode));
      const dofblur9 = dofblur.mul(0.9);
      const dofblur7 = dofblur.mul(0.7);
      const dofblur4 = dofblur.mul(0.4);
      let col = vec4(0.0);
      col = col.add(sampleTexture(uvNode));
      col = col.add(sampleTexture(uvNode.add(vec2(0.0, 0.4).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.15, 0.37).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.29, 0.29).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.37, 0.15).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.40, 0.0).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.37, -0.15).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.29, -0.29).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.15, -0.37).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.0, -0.4).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.15, 0.37).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.29, 0.29).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.37, 0.15).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.4, 0.0).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.37, -0.15).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.29, -0.29).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.15, -0.37).mul(aspectcorrect).mul(dofblur))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.15, 0.37).mul(aspectcorrect).mul(dofblur9))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.37, 0.15).mul(aspectcorrect).mul(dofblur9))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.37, -0.15).mul(aspectcorrect).mul(dofblur9))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.15, -0.37).mul(aspectcorrect).mul(dofblur9))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.15, 0.37).mul(aspectcorrect).mul(dofblur9))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.37, 0.15).mul(aspectcorrect).mul(dofblur9))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.37, -0.15).mul(aspectcorrect).mul(dofblur9))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.15, -0.37).mul(aspectcorrect).mul(dofblur9))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.29, 0.29).mul(aspectcorrect).mul(dofblur7))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.40, 0.0).mul(aspectcorrect).mul(dofblur7))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.29, -0.29).mul(aspectcorrect).mul(dofblur7))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.0, -0.4).mul(aspectcorrect).mul(dofblur7))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.29, 0.29).mul(aspectcorrect).mul(dofblur7))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.4, 0.0).mul(aspectcorrect).mul(dofblur7))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.29, -0.29).mul(aspectcorrect).mul(dofblur7))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.0, 0.4).mul(aspectcorrect).mul(dofblur7))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.29, 0.29).mul(aspectcorrect).mul(dofblur4))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.4, 0.0).mul(aspectcorrect).mul(dofblur4))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.29, -0.29).mul(aspectcorrect).mul(dofblur4))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.0, -0.4).mul(aspectcorrect).mul(dofblur4))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.29, 0.29).mul(aspectcorrect).mul(dofblur4))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.4, 0.0).mul(aspectcorrect).mul(dofblur4))));
      col = col.add(sampleTexture(uvNode.add(vec2(-0.29, -0.29).mul(aspectcorrect).mul(dofblur4))));
      col = col.add(sampleTexture(uvNode.add(vec2(0.0, 0.4).mul(aspectcorrect).mul(dofblur4))));
      col = col.div(41);
      col.a = 1;
      return vec4(col);
    });
    const outputNode = dof();
    return outputNode;
  }
}
DepthOfFieldNode.type = /*@__PURE__*/registerNode('DepthOfField', DepthOfFieldNode);

class DotScreenNode extends TempNode {
  constructor(inputNode, center = new Vector2(0.5, 0.5), angle = 1.57, scale = 1) {
    super('vec4');
    this.inputNode = inputNode;
    this.center = uniform(center);
    this.angle = uniform(angle);
    this.scale = uniform(scale);
  }
  setup() {
    const inputNode = this.inputNode;
    const pattern = Fn(() => {
      const s = sin(this.angle);
      const c = cos(this.angle);
      const tex = uv().mul(viewportResolution).sub(this.center);
      const point = vec2(c.mul(tex.x).sub(s.mul(tex.y)), s.mul(tex.x).add(c.mul(tex.y))).mul(this.scale);
      return sin(point.x).mul(sin(point.y)).mul(4);
    });
    const dotScreen = Fn(() => {
      const color = inputNode;
      const average = add(color.r, color.g, color.b).div(3);
      return vec4(vec3(average.mul(10).sub(5).add(pattern())), color.a);
    });
    const outputNode = dotScreen();
    return outputNode;
  }
}
DotScreenNode.type = /*@__PURE__*/registerNode('DotScreen', DotScreenNode);

class RGBShiftNode extends TempNode {
  constructor(textureNode, amount = 0.005, angle = 0) {
    super('vec4');
    this.textureNode = textureNode;
    this.amount = uniform(amount);
    this.angle = uniform(angle);
  }
  setup() {
    const {
      textureNode
    } = this;
    const uvNode = textureNode.uvNode || uv();
    const sampleTexture = uv => textureNode.uv(uv);
    const rgbShift = Fn(() => {
      const offset = vec2(cos(this.angle), sin(this.angle)).mul(this.amount);
      const cr = sampleTexture(uvNode.add(offset));
      const cga = sampleTexture(uvNode);
      const cb = sampleTexture(uvNode.sub(offset));
      return vec4(cr.r, cga.g, cb.b, cga.a);
    });
    return rgbShift();
  }
}
RGBShiftNode.type = /*@__PURE__*/registerNode('RGBShift', RGBShiftNode);

class FilmNode extends TempNode {
  constructor(inputNode, intensityNode = null, uvNode = null) {
    super();
    this.inputNode = inputNode;
    this.intensityNode = intensityNode;
    this.uvNode = uvNode;
  }
  setup() {
    const uvNode = this.uvNode || uv();
    const film = Fn(() => {
      const base = this.inputNode.rgb;
      const noise = rand(fract(uvNode.add(timerLocal())));
      let color = base.add(base.mul(clamp(noise.add(0.1), 0, 1)));
      if (this.intensityNode !== null) {
        color = mix(base, color, this.intensityNode);
      }
      return vec4(color, this.inputNode.a);
    });
    const outputNode = film();
    return outputNode;
  }
}
FilmNode.type = /*@__PURE__*/registerNode('Film', FilmNode);

class Lut3DNode extends TempNode {
  constructor(inputNode, lutNode, size, intensityNode) {
    super();
    this.inputNode = inputNode;
    this.lutNode = lutNode;
    this.size = uniform(size);
    this.intensityNode = intensityNode;
  }
  setup() {
    const {
      inputNode,
      lutNode
    } = this;
    const sampleLut = uv => lutNode.uv(uv);
    const lut3D = Fn(() => {
      const base = inputNode;

      // pull the sample in by half a pixel so the sample begins at the center of the edge pixels.

      const pixelWidth = float(1.0).div(this.size);
      const halfPixelWidth = float(0.5).div(this.size);
      const uvw = vec3(halfPixelWidth).add(base.rgb.mul(float(1.0).sub(pixelWidth)));
      const lutValue = vec4(sampleLut(uvw).rgb, base.a);
      return vec4(mix(base, lutValue, this.intensityNode));
    });
    const outputNode = lut3D();
    return outputNode;
  }
}
Lut3DNode.type = /*@__PURE__*/registerNode('Lut3D', Lut3DNode);

class DataTexture extends Texture {
  constructor(data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace) {
    super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace);
    this.isDataTexture = true;
    this.image = {
      data: data,
      width: width,
      height: height
    };
    this.generateMipmaps = false;
    this.flipY = false;
    this.unpackAlignment = 1;
  }
}

const _quadMesh$1 = /*@__PURE__*/new QuadMesh$1();
const _currentClearColor = /*@__PURE__*/new Color();
const _size$3 = /*@__PURE__*/new Vector2();
class GTAONode extends TempNode {
  constructor(depthNode, normalNode, camera) {
    super();
    this.depthNode = depthNode;
    this.normalNode = normalNode;
    this.radius = uniform(0.25);
    this.resolution = uniform(new Vector2());
    this.thickness = uniform(1);
    this.distanceExponent = uniform(1);
    this.distanceFallOff = uniform(1);
    this.scale = uniform(1);
    this.noiseNode = texture(generateMagicSquareNoise());
    this.cameraProjectionMatrix = uniform(camera.projectionMatrix);
    this.cameraProjectionMatrixInverse = uniform(camera.projectionMatrixInverse);
    this.SAMPLES = uniform(16);
    this._aoRenderTarget = new RenderTarget();
    this._aoRenderTarget.texture.name = 'GTAONode.AO';
    this._material = null;
    this._textureNode = passTexture(this, this._aoRenderTarget.texture);
    this.updateBeforeType = NodeUpdateType.FRAME;
  }
  getTextureNode() {
    return this._textureNode;
  }
  setSize(width, height) {
    this.resolution.value.set(width, height);
    this._aoRenderTarget.setSize(width, height);
  }
  updateBefore(frame) {
    const {
      renderer
    } = frame;
    const size = renderer.getDrawingBufferSize(_size$3);
    const currentRenderTarget = renderer.getRenderTarget();
    const currentMRT = renderer.getMRT();
    renderer.getClearColor(_currentClearColor);
    const currentClearAlpha = renderer.getClearAlpha();
    _quadMesh$1.material = this._material;
    this.setSize(size.width, size.height);

    // clear

    renderer.setMRT(null);
    renderer.setClearColor(0xffffff, 1);

    // ao

    renderer.setRenderTarget(this._aoRenderTarget);
    _quadMesh$1.render(renderer);

    // restore

    renderer.setRenderTarget(currentRenderTarget);
    renderer.setMRT(currentMRT);
    renderer.setClearColor(_currentClearColor, currentClearAlpha);
  }
  setup(builder) {
    const uvNode = uv();
    const sampleDepth = uv => this.depthNode.uv(uv).x;
    const sampleNoise = uv => this.noiseNode.uv(uv);
    const getSceneUvAndDepth = Fn(([sampleViewPos]) => {
      const sampleClipPos = this.cameraProjectionMatrix.mul(vec4(sampleViewPos, 1.0));
      let sampleUv = sampleClipPos.xy.div(sampleClipPos.w).mul(0.5).add(0.5).toVar();
      sampleUv = vec2(sampleUv.x, sampleUv.y.oneMinus());
      const sampleSceneDepth = sampleDepth(sampleUv);
      return vec3(sampleUv, sampleSceneDepth);
    });
    const getViewPosition = Fn(([screenPosition, depth]) => {
      screenPosition = vec2(screenPosition.x, screenPosition.y.oneMinus()).mul(2.0).sub(1.0);
      const clipSpacePosition = vec4(vec3(screenPosition, depth), 1.0);
      const viewSpacePosition = vec4(this.cameraProjectionMatrixInverse.mul(clipSpacePosition));
      return viewSpacePosition.xyz.div(viewSpacePosition.w);
    });
    const ao = Fn(() => {
      const depth = sampleDepth(uvNode);
      depth.greaterThanEqual(1.0).discard();
      const viewPosition = getViewPosition(uvNode, depth);
      const viewNormal = this.normalNode.rgb.normalize();
      const radiusToUse = this.radius;
      const noiseResolution = textureSize(this.noiseNode, 0);
      let noiseUv = vec2(uvNode.x, uvNode.y.oneMinus());
      noiseUv = noiseUv.mul(this.resolution.div(noiseResolution));
      const noiseTexel = sampleNoise(noiseUv);
      const randomVec = noiseTexel.xyz.mul(2.0).sub(1.0);
      const tangent = vec3(randomVec.xy, 0.0).normalize();
      const bitangent = vec3(tangent.y.mul(-1.0), tangent.x, 0.0);
      const kernelMatrix = mat3(tangent, bitangent, vec3(0.0, 0.0, 1.0));
      const DIRECTIONS = this.SAMPLES.lessThan(30).select(3, 5);
      const STEPS = add(this.SAMPLES, DIRECTIONS.sub(1)).div(DIRECTIONS);
      const ao = float(0).toVar();
      Loop({
        start: int$1(0),
        end: DIRECTIONS,
        type: 'int',
        condition: '<'
      }, ({
        i
      }) => {
        const angle = float(i).div(float(DIRECTIONS)).mul(PI);
        const sampleDir = vec4(cos(angle), sin(angle), 0., add(0.5, mul(0.5, noiseTexel.w)));
        sampleDir.xyz = normalize(kernelMatrix.mul(sampleDir.xyz));
        const viewDir = normalize(viewPosition.xyz.negate());
        const sliceBitangent = normalize(cross(sampleDir.xyz, viewDir));
        const sliceTangent = cross(sliceBitangent, viewDir);
        const normalInSlice = normalize(viewNormal.sub(sliceBitangent.mul(dot(viewNormal, sliceBitangent))));
        const tangentToNormalInSlice = cross(normalInSlice, sliceBitangent);
        const cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice), dot(viewDir, tangentToNormalInSlice.negate())).toVar();
        Loop({
          end: STEPS,
          type: 'int',
          name: 'j',
          condition: '<'
        }, ({
          j
        }) => {
          const sampleViewOffset = sampleDir.xyz.mul(radiusToUse).mul(sampleDir.w).mul(pow(div(float(j).add(1.0), float(STEPS)), this.distanceExponent));

          // x

          const sampleSceneUvDepthX = getSceneUvAndDepth(viewPosition.add(sampleViewOffset));
          const sampleSceneViewPositionX = getViewPosition(sampleSceneUvDepthX.xy, sampleSceneUvDepthX.z);
          const viewDeltaX = sampleSceneViewPositionX.sub(viewPosition);
          If(abs(viewDeltaX.z).lessThan(this.thickness), () => {
            const sampleCosHorizon = dot(viewDir, normalize(viewDeltaX));
            cosHorizons.x.addAssign(max$2(0, mul(sampleCosHorizon.sub(cosHorizons.x), mix(1.0, float(2.0).div(float(j).add(2)), this.distanceFallOff))));
          });

          // y

          const sampleSceneUvDepthY = getSceneUvAndDepth(viewPosition.sub(sampleViewOffset));
          const sampleSceneViewPositionY = getViewPosition(sampleSceneUvDepthY.xy, sampleSceneUvDepthY.z);
          const viewDeltaY = sampleSceneViewPositionY.sub(viewPosition);
          If(abs(viewDeltaY.z).lessThan(this.thickness), () => {
            const sampleCosHorizon = dot(viewDir, normalize(viewDeltaY));
            cosHorizons.y.addAssign(max$2(0, mul(sampleCosHorizon.sub(cosHorizons.y), mix(1.0, float(2.0).div(float(j).add(2)), this.distanceFallOff))));
          });
        });
        const sinHorizons = sqrt(sub(1.0, cosHorizons.mul(cosHorizons)));
        const nx = dot(normalInSlice, sliceTangent);
        const ny = dot(normalInSlice, viewDir);
        const nxb = mul(0.5, acos(cosHorizons.y).sub(acos(cosHorizons.x)).add(sinHorizons.x.mul(cosHorizons.x).sub(sinHorizons.y.mul(cosHorizons.y))));
        const nyb = mul(0.5, sub(2.0, cosHorizons.x.mul(cosHorizons.x)).sub(cosHorizons.y.mul(cosHorizons.y)));
        const occlusion = nx.mul(nxb).add(ny.mul(nyb));
        ao.addAssign(occlusion);
      });
      ao.assign(clamp(ao.div(DIRECTIONS), 0, 1));
      ao.assign(pow(ao, this.scale));
      return vec4(vec3(ao), 1.0);
    });
    const material = this._material || (this._material = new NodeMaterial$1());
    material.fragmentNode = ao().context(builder.getSharedContext());
    material.name = 'GTAO';
    material.needsUpdate = true;

    //

    return this._textureNode;
  }
  dispose() {
    this._aoRenderTarget.dispose();
  }
}
GTAONode.type = /*@__PURE__*/registerNode('GTAO', GTAONode);
function generateMagicSquareNoise(size = 5) {
  const noiseSize = Math.floor(size) % 2 === 0 ? Math.floor(size) + 1 : Math.floor(size);
  const magicSquare = generateMagicSquare(noiseSize);
  const noiseSquareSize = magicSquare.length;
  const data = new Uint8Array(noiseSquareSize * 4);
  for (let inx = 0; inx < noiseSquareSize; ++inx) {
    const iAng = magicSquare[inx];
    const angle = 2 * Math.PI * iAng / noiseSquareSize;
    const randomVec = new Vector3(Math.cos(angle), Math.sin(angle), 0).normalize();
    data[inx * 4] = (randomVec.x * 0.5 + 0.5) * 255;
    data[inx * 4 + 1] = (randomVec.y * 0.5 + 0.5) * 255;
    data[inx * 4 + 2] = 127;
    data[inx * 4 + 3] = 255;
  }
  const noiseTexture = new DataTexture(data, noiseSize, noiseSize);
  noiseTexture.wrapS = RepeatWrapping;
  noiseTexture.wrapT = RepeatWrapping;
  noiseTexture.needsUpdate = true;
  return noiseTexture;
}
function generateMagicSquare(size) {
  const noiseSize = Math.floor(size) % 2 === 0 ? Math.floor(size) + 1 : Math.floor(size);
  const noiseSquareSize = noiseSize * noiseSize;
  const magicSquare = Array(noiseSquareSize).fill(0);
  let i = Math.floor(noiseSize / 2);
  let j = noiseSize - 1;
  for (let num = 1; num <= noiseSquareSize;) {
    if (i === -1 && j === noiseSize) {
      j = noiseSize - 2;
      i = 0;
    } else {
      if (j === noiseSize) {
        j = 0;
      }
      if (i < 0) {
        i = noiseSize - 1;
      }
    }
    if (magicSquare[i * noiseSize + j] !== 0) {
      j -= 2;
      i++;
      continue;
    } else {
      magicSquare[i * noiseSize + j] = num++;
    }
    j++;
    i--;
  }
  return magicSquare;
}

class DenoiseNode extends TempNode {
  constructor(textureNode, depthNode, normalNode, noiseNode, camera) {
    super();
    this.textureNode = textureNode;
    this.depthNode = depthNode;
    this.normalNode = normalNode;
    this.noiseNode = noiseNode;
    this.cameraProjectionMatrixInverse = uniform(camera.projectionMatrixInverse);
    this.lumaPhi = uniform(5);
    this.depthPhi = uniform(5);
    this.normalPhi = uniform(5);
    this.radius = uniform(5);
    this.index = uniform(0);
    this._resolution = uniform(new Vector2());
    this._sampleVectors = uniformArray(generatePdSamplePointInitializer(16, 2, 1));
    this.updateBeforeType = NodeUpdateType.RENDER;
  }
  updateBefore() {
    const map = this.textureNode.value;
    this._resolution.value.set(map.image.width, map.image.height);
  }
  setup() {
    const uvNode = uv();
    const sampleTexture = uv => this.textureNode.uv(uv);
    const sampleDepth = uv => this.depthNode.uv(uv).x;
    const sampleNormal = uv => this.normalNode.uv(uv);
    const sampleNoise = uv => this.noiseNode.uv(uv);
    const getViewPosition = Fn(([screenPosition, depth]) => {
      screenPosition = vec2(screenPosition.x, screenPosition.y.oneMinus()).mul(2.0).sub(1.0);
      const clipSpacePosition = vec4(vec3(screenPosition, depth), 1.0);
      const viewSpacePosition = vec4(this.cameraProjectionMatrixInverse.mul(clipSpacePosition));
      return viewSpacePosition.xyz.div(viewSpacePosition.w);
    });
    const denoiseSample = Fn(([center, viewNormal, viewPosition, sampleUv]) => {
      const texel = sampleTexture(sampleUv);
      const depth = sampleDepth(sampleUv);
      const normal = sampleNormal(sampleUv).rgb.normalize();
      const neighborColor = texel.rgb;
      const viewPos = getViewPosition(sampleUv, depth);
      const normalDiff = dot(viewNormal, normal).toVar();
      const normalSimilarity = pow(max$2(normalDiff, 0), this.normalPhi).toVar();
      const lumaDiff = abs(luminance(neighborColor).sub(luminance(center))).toVar();
      const lumaSimilarity = max$2(float(1.0).sub(lumaDiff.div(this.lumaPhi)), 0).toVar();
      const depthDiff = abs(dot(viewPosition.sub(viewPos), viewNormal)).toVar();
      const depthSimilarity = max$2(float(1.0).sub(depthDiff.div(this.depthPhi)), 0);
      const w = lumaSimilarity.mul(depthSimilarity).mul(normalSimilarity);
      return vec4(neighborColor.mul(w), w);
    });
    const denoise = Fn(([uvNode]) => {
      const depth = sampleDepth(uvNode);
      const viewNormal = sampleNormal(uvNode).rgb.normalize();
      const texel = sampleTexture(uvNode);
      If(depth.greaterThanEqual(1.0).or(dot(viewNormal, viewNormal).equal(0.0)), () => {
        return texel;
      });
      const center = vec3(texel.rgb);
      const viewPosition = getViewPosition(uvNode, depth);
      const noiseResolution = textureSize(this.noiseNode, 0);
      let noiseUv = vec2(uvNode.x, uvNode.y.oneMinus());
      noiseUv = noiseUv.mul(this._resolution.div(noiseResolution));
      const noiseTexel = sampleNoise(noiseUv);
      const x = sin(noiseTexel.element(this.index.mod(4).mul(2).mul(PI)));
      const y = cos(noiseTexel.element(this.index.mod(4).mul(2).mul(PI)));
      const noiseVec = vec2(x, y);
      const rotationMatrix = mat2(noiseVec.x, noiseVec.y.negate(), noiseVec.x, noiseVec.y);
      const totalWeight = float(1.0).toVar();
      const denoised = vec3(texel.rgb).toVar();
      Loop({
        start: int$1(0),
        end: int$1(16),
        type: 'int',
        condition: '<'
      }, ({
        i
      }) => {
        const sampleDir = this._sampleVectors.element(i).toVar();
        const offset = rotationMatrix.mul(sampleDir.xy.mul(float(1.0).add(sampleDir.z.mul(this.radius.sub(1))))).div(this._resolution).toVar();
        const sampleUv = uvNode.add(offset).toVar();
        const result = denoiseSample(center, viewNormal, viewPosition, sampleUv);
        denoised.addAssign(result.xyz);
        totalWeight.addAssign(result.w);
      });
      If(totalWeight.greaterThan(float(0)), () => {
        denoised.divAssign(totalWeight);
      });
      return vec4(denoised, texel.a);
    }).setLayout({
      name: 'denoise',
      type: 'vec4',
      inputs: [{
        name: 'uv',
        type: 'vec2'
      }]
    });
    const output = Fn(() => {
      return denoise(uvNode);
    });
    const outputNode = output();
    return outputNode;
  }
}
DenoiseNode.type = /*@__PURE__*/registerNode('Denoise', DenoiseNode);
function generatePdSamplePointInitializer(samples, rings, radiusExponent) {
  const poissonDisk = generateDenoiseSamples(samples, rings, radiusExponent);
  const array = [];
  for (let i = 0; i < samples; i++) {
    const sample = poissonDisk[i];
    array.push(sample);
  }
  return array;
}
function generateDenoiseSamples(numSamples, numRings, radiusExponent) {
  const samples = [];
  for (let i = 0; i < numSamples; i++) {
    const angle = 2 * Math.PI * numRings * i / numSamples;
    const radius = Math.pow(i / (numSamples - 1), radiusExponent);
    samples.push(new Vector3(Math.cos(angle), Math.sin(angle), radius));
  }
  return samples;
}

class FXAANode extends TempNode {
  constructor(textureNode) {
    super();
    this.textureNode = textureNode;
    this.updateBeforeType = NodeUpdateType.RENDER;
    this._invSize = uniform(new Vector2());
  }
  updateBefore() {
    const map = this.textureNode.value;
    this._invSize.value.set(1 / map.image.width, 1 / map.image.height);
  }
  setup() {
    const textureNode = this.textureNode.bias(-100);
    const uvNode = textureNode.uvNode || uv();

    // FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)

    //----------------------------------------------------------------------------------
    // File:        es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag
    // SDK Version: v3.00
    // Email:       gameworks@nvidia.com
    // Site:        http://developer.nvidia.com/
    //
    // Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
    //
    // Redistribution and use in source and binary forms, with or without
    // modification, are permitted provided that the following conditions
    // are met:
    //  * Redistributions of source code must retain the above copyright
    //    notice, this list of conditions and the following disclaimer.
    //  * Redistributions in binary form must reproduce the above copyright
    //    notice, this list of conditions and the following disclaimer in the
    //    documentation and/or other materials provided with the distribution.
    //  * Neither the name of NVIDIA CORPORATION nor the names of its
    //    contributors may be used to endorse or promote products derived
    //    from this software without specific prior written permission.
    //
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
    // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    //
    //----------------------------------------------------------------------------------

    const FxaaTexTop = p => textureNode.uv(p);
    const FxaaTexOff = (p, o, r) => textureNode.uv(p.add(o.mul(r)));
    const NUM_SAMPLES = int$1(5);
    const contrast = Fn(([a_immutable, b_immutable]) => {
      // assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha

      const b = vec4(b_immutable).toVar();
      const a = vec4(a_immutable).toVar();
      const diff = vec4(abs(a.sub(b))).toVar();
      return max$2(max$2(max$2(diff.r, diff.g), diff.b), diff.a);
    });

    // FXAA3 QUALITY - PC

    const FxaaPixelShader = Fn(([uv, fxaaQualityRcpFrame, fxaaQualityEdgeThreshold, fxaaQualityinvEdgeThreshold]) => {
      const rgbaM = FxaaTexTop(uv).toVar();
      const rgbaS = FxaaTexOff(uv, vec2(0.0, -1.0), fxaaQualityRcpFrame.xy).toVar();
      const rgbaE = FxaaTexOff(uv, vec2(1.0, 0.0), fxaaQualityRcpFrame.xy).toVar();
      const rgbaN = FxaaTexOff(uv, vec2(0.0, 1.0), fxaaQualityRcpFrame.xy).toVar();
      const rgbaW = FxaaTexOff(uv, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy).toVar();
      // . S .
      // W M E
      // . N .

      const contrastN = contrast(rgbaM, rgbaN).toVar();
      const contrastS = contrast(rgbaM, rgbaS).toVar();
      const contrastE = contrast(rgbaM, rgbaE).toVar();
      const contrastW = contrast(rgbaM, rgbaW).toVar();
      const maxValue = max$2(contrastN, max$2(contrastS, max$2(contrastE, contrastW))).toVar();

      // . 0 .
      // 0 0 0
      // . 0 .

      If(maxValue.lessThan(fxaaQualityEdgeThreshold), () => {
        return rgbaM; // assuming define FXAA_DISCARD is always 0
      });

      //

      const relativeVContrast = sub(contrastN.add(contrastS), contrastE.add(contrastW)).toVar();
      relativeVContrast.mulAssign(fxaaQualityinvEdgeThreshold);

      // 45 deg edge detection and corners of objects, aka V/H contrast is too similar

      If(abs(relativeVContrast).lessThan(0.3), () => {
        // locate the edge

        const x = contrastE.greaterThan(contrastW).select(1, -1).toVar();
        const y = contrastS.greaterThan(contrastN).select(1, -1).toVar();
        const dirToEdge = vec2(x, y).toVar();
        // . 2 .      . 1 .
        // 1 0 2  ~=  0 0 1
        // . 1 .      . 0 .

        // tap 2 pixels and see which ones are "outside" the edge, to
        // determine if the edge is vertical or horizontal

        const rgbaAlongH = FxaaTexOff(uv, vec2(dirToEdge.x, dirToEdge.y), fxaaQualityRcpFrame.xy);
        const matchAlongH = contrast(rgbaM, rgbaAlongH).toVar();
        // . 1 .
        // 0 0 1
        // . 0 H

        const rgbaAlongV = FxaaTexOff(uv, vec2(dirToEdge.x.negate(), dirToEdge.y.negate()), fxaaQualityRcpFrame.xy);
        const matchAlongV = contrast(rgbaM, rgbaAlongV).toVar();
        // V 1 .
        // 0 0 1
        // . 0 .

        relativeVContrast.assign(matchAlongV.sub(matchAlongH));
        relativeVContrast.mulAssign(fxaaQualityinvEdgeThreshold);
        If(abs(relativeVContrast).lessThan(0.3), () => {
          // 45 deg edge

          // 1 1 .
          // 0 0 1
          // . 0 1

          // do a simple blur
          const sum = rgbaN.add(rgbaS).add(rgbaE).add(rgbaW);
          return mix(rgbaM, sum.mul(0.25), 0.4);
        });
      });
      const offNP = vec2().toVar();
      If(relativeVContrast.lessThanEqual(0), () => {
        rgbaN.assign(rgbaW);
        rgbaS.assign(rgbaE);

        // . 0 .      1
        // 1 0 1  ->  0
        // . 0 .      1

        offNP.x.assign(0);
        offNP.y.assign(fxaaQualityRcpFrame.y);
      }).Else(() => {
        offNP.x.assign(fxaaQualityRcpFrame.x);
        offNP.y.assign(0);
      });
      const mn = contrast(rgbaM, rgbaN).toVar();
      const ms = contrast(rgbaM, rgbaS).toVar();
      If(mn.lessThanEqual(ms), () => {
        rgbaN.assign(rgbaS);
      });
      const doneN = int$1(0).toVar();
      const doneP = int$1(0).toVar();
      const nDist = float(0).toVar();
      const pDist = float(0).toVar();
      const posN = vec2(uv).toVar();
      const posP = vec2(uv).toVar();
      const iterationsUsedN = int$1(0).toVar();
      const iterationsUsedP = int$1(0).toVar();
      Loop(NUM_SAMPLES, ({
        i
      }) => {
        const increment = i.add(1).toVar();
        If(doneN.equal(0), () => {
          nDist.addAssign(increment);
          posN.assign(uv.add(offNP.mul(nDist)));
          const rgbaEndN = FxaaTexTop(posN.xy);
          const nm = contrast(rgbaEndN, rgbaM).toVar();
          const nn = contrast(rgbaEndN, rgbaN).toVar();
          If(nm.greaterThan(nn), () => {
            doneN.assign(1);
          });
          iterationsUsedN.assign(i);
        });
        If(doneP.equal(0), () => {
          pDist.addAssign(increment);
          posP.assign(uv.sub(offNP.mul(pDist)));
          const rgbaEndP = FxaaTexTop(posP.xy);
          const pm = contrast(rgbaEndP, rgbaM).toVar();
          const pn = contrast(rgbaEndP, rgbaN).toVar();
          If(pm.greaterThan(pn), () => {
            doneP.assign(1);
          });
          iterationsUsedP.assign(i);
        });
        If(doneN.equal(1).or(doneP.equal(1)), () => {
          Break();
        });
      });
      If(doneN.equal(0).and(doneP.equal(0)), () => {
        return rgbaM; // failed to find end of edge
      });
      const distN = float(1).toVar();
      const distP = float(1).toVar();
      If(doneN.equal(1), () => {
        distN.assign(float(iterationsUsedN).div(float(NUM_SAMPLES.sub(1))));
      });
      If(doneP.equal(1), () => {
        distP.assign(float(iterationsUsedP).div(float(NUM_SAMPLES.sub(1))));
      });
      const dist = min$1(distN, distP);

      // hacky way of reduces blurriness of mostly diagonal edges
      // but reduces AA quality
      dist.assign(pow(dist, 0.5));
      dist.assign(float(1).sub(dist));
      return mix(rgbaM, rgbaN, dist.mul(0.5));
    }).setLayout({
      name: 'FxaaPixelShader',
      type: 'vec4',
      inputs: [{
        name: 'uv',
        type: 'vec2'
      }, {
        name: 'fxaaQualityRcpFrame',
        type: 'vec2'
      }, {
        name: 'fxaaQualityEdgeThreshold',
        type: 'float'
      }, {
        name: 'fxaaQualityinvEdgeThreshold',
        type: 'float'
      }]
    });
    const fxaa = Fn(() => {
      const edgeDetectionQuality = float(0.2);
      const invEdgeDetectionQuality = float(1).div(edgeDetectionQuality);
      return FxaaPixelShader(uvNode, this._invSize, edgeDetectionQuality, invEdgeDetectionQuality);
    });
    const outputNode = fxaa();
    return outputNode;
  }
}
FXAANode.type = /*@__PURE__*/registerNode('FXAA', FXAANode);

class TransitionNode extends TempNode {
  constructor(textureNodeA, textureNodeB, mixTextureNode, mixRatioNode, thresholdNode, useTextureNode) {
    super();

    // Input textures

    this.textureNodeA = textureNodeA;
    this.textureNodeB = textureNodeB;
    this.mixTextureNode = mixTextureNode;

    // Uniforms

    this.mixRatioNode = mixRatioNode;
    this.thresholdNode = thresholdNode;
    this.useTextureNode = useTextureNode;
  }
  setup() {
    const {
      textureNodeA,
      textureNodeB,
      mixTextureNode,
      mixRatioNode,
      thresholdNode,
      useTextureNode
    } = this;
    const sampleTexture = textureNode => {
      const uvNodeTexture = textureNode.uvNode || uv();
      return textureNode.uv(uvNodeTexture);
    };
    const transition = Fn(() => {
      const texelOne = sampleTexture(textureNodeA);
      const texelTwo = sampleTexture(textureNodeB);
      const color = vec4().toVar();
      If(useTextureNode.equal(int$1(1)), () => {
        const transitionTexel = sampleTexture(mixTextureNode);
        const r = mixRatioNode.mul(thresholdNode.mul(2.0).add(1.0)).sub(thresholdNode);
        const mixf = clamp(sub(transitionTexel.r, r).mul(float(1.0).div(thresholdNode)), 0.0, 1.0);
        color.assign(mix(texelOne, texelTwo, mixf));
      }).Else(() => {
        color.assign(mix(texelTwo, texelOne, mixRatioNode));
      });
      return color;
    });
    const outputNode = transition();
    return outputNode;
  }
}
TransitionNode.type = /*@__PURE__*/registerNode('Transition', TransitionNode);

class PixelationNode extends TempNode {
  constructor(textureNode, depthNode, normalNode, pixelSize, normalEdgeStrength, depthEdgeStrength) {
    super();

    // Input textures

    this.textureNode = textureNode;
    this.depthNode = depthNode;
    this.normalNode = normalNode;

    // Input uniforms

    this.pixelSize = pixelSize;
    this.normalEdgeStrength = normalEdgeStrength;
    this.depthEdgeStrength = depthEdgeStrength;

    // Private uniforms

    this._resolution = uniform(new Vector4());
    this.updateBeforeType = NodeUpdateType.RENDER;
  }
  updateBefore() {
    const map = this.textureNode.value;
    const width = map.image.width;
    const height = map.image.height;
    this._resolution.value.set(width, height, 1 / width, 1 / height);
  }
  setup() {
    const {
      textureNode,
      depthNode,
      normalNode
    } = this;
    const uvNodeTexture = textureNode.uvNode || uv();
    const uvNodeDepth = depthNode.uvNode || uv();
    const uvNodeNormal = normalNode.uvNode || uv();
    const sampleTexture = () => textureNode.uv(uvNodeTexture);
    const sampleDepth = (x, y) => depthNode.uv(uvNodeDepth.add(vec2(x, y).mul(this._resolution.zw))).r;
    const sampleNormal = (x, y) => normalNode.uv(uvNodeNormal.add(vec2(x, y).mul(this._resolution.zw))).rgb.normalize();
    const depthEdgeIndicator = depth => {
      const diff = property('float', 'diff');
      diff.addAssign(clamp(sampleDepth(1, 0).sub(depth)));
      diff.addAssign(clamp(sampleDepth(-1, 0).sub(depth)));
      diff.addAssign(clamp(sampleDepth(0, 1).sub(depth)));
      diff.addAssign(clamp(sampleDepth(0, -1).sub(depth)));
      return floor(smoothstep(0.01, 0.02, diff).mul(2)).div(2);
    };
    const neighborNormalEdgeIndicator = (x, y, depth, normal) => {
      const depthDiff = sampleDepth(x, y).sub(depth);
      const neighborNormal = sampleNormal(x, y);

      // Edge pixels should yield to faces who's normals are closer to the bias normal.

      const normalEdgeBias = vec3(1, 1, 1); // This should probably be a parameter.
      const normalDiff = dot(normal.sub(neighborNormal), normalEdgeBias);
      const normalIndicator = clamp(smoothstep(-0.01, 0.01, normalDiff), 0.0, 1.0);

      // Only the shallower pixel should detect the normal edge.

      const depthIndicator = clamp(sign(depthDiff.mul(.25).add(.0025)), 0.0, 1.0);
      return float(1.0).sub(dot(normal, neighborNormal)).mul(depthIndicator).mul(normalIndicator);
    };
    const normalEdgeIndicator = (depth, normal) => {
      const indicator = property('float', 'indicator');
      indicator.addAssign(neighborNormalEdgeIndicator(0, -1, depth, normal));
      indicator.addAssign(neighborNormalEdgeIndicator(0, 1, depth, normal));
      indicator.addAssign(neighborNormalEdgeIndicator(-1, 0, depth, normal));
      indicator.addAssign(neighborNormalEdgeIndicator(1, 0, depth, normal));
      return step(0.1, indicator);
    };
    const pixelation = Fn(() => {
      const texel = sampleTexture();
      const depth = property('float', 'depth');
      const normal = property('vec3', 'normal');
      If(this.depthEdgeStrength.greaterThan(0.0).or(this.normalEdgeStrength.greaterThan(0.0)), () => {
        depth.assign(sampleDepth(0, 0));
        normal.assign(sampleNormal(0, 0));
      });
      const dei = property('float', 'dei');
      If(this.depthEdgeStrength.greaterThan(0.0), () => {
        dei.assign(depthEdgeIndicator(depth));
      });
      const nei = property('float', 'nei');
      If(this.normalEdgeStrength.greaterThan(0.0), () => {
        nei.assign(normalEdgeIndicator(depth, normal));
      });
      const strength = dei.greaterThan(0).select(float(1.0).sub(dei.mul(this.depthEdgeStrength)), nei.mul(this.normalEdgeStrength).add(1));
      return texel.mul(strength);
    });
    const outputNode = pixelation();
    return outputNode;
  }
}
PixelationNode.type = /*@__PURE__*/registerNode('Pixelation', PixelationNode);
const pixelation = (node, depthNode, normalNode, pixelSize = 6, normalEdgeStrength = 0.3, depthEdgeStrength = 0.4) => nodeObject(new PixelationNode(convertToTexture(node), convertToTexture(depthNode), convertToTexture(normalNode), nodeObject(pixelSize), nodeObject(normalEdgeStrength), nodeObject(depthEdgeStrength)));
class PixelationPassNode extends PassNode {
  constructor(scene, camera, pixelSize = 6, normalEdgeStrength = 0.3, depthEdgeStrength = 0.4) {
    super('color', scene, camera, {
      minFilter: NearestFilter,
      magFilter: NearestFilter
    });
    this.pixelSize = pixelSize;
    this.normalEdgeStrength = normalEdgeStrength;
    this.depthEdgeStrength = depthEdgeStrength;
    this.isPixelationPassNode = true;
    this._mrt = mrt({
      output: output,
      normal: normalView
    });
  }
  setSize(width, height) {
    const pixelSize = this.pixelSize.value ? this.pixelSize.value : this.pixelSize;
    const adjustedWidth = Math.floor(width / pixelSize);
    const adjustedHeight = Math.floor(height / pixelSize);
    super.setSize(adjustedWidth, adjustedHeight);
  }
  setup() {
    const color = super.getTextureNode('output');
    const depth = super.getTextureNode('depth');
    const normal = super.getTextureNode('normal');
    return pixelation(color, depth, normal, this.pixelSize, this.normalEdgeStrength, this.depthEdgeStrength);
  }
}
PixelationPassNode.type = /*@__PURE__*/registerNode('PixelationPass', PixelationPassNode);

const _size$2 = /*@__PURE__*/new Vector2();

/**
*
* Supersample Anti-Aliasing Render Pass
*
* This manual approach to SSAA re-renders the scene ones for each sample with camera jitter and accumulates the results.
*
* References: https://en.wikipedia.org/wiki/Supersampling
*
*/

class SSAAPassNode extends PassNode {
  constructor(scene, camera) {
    super(PassNode.COLOR, scene, camera);
    this.isSSAAPassNode = true;
    this.sampleLevel = 4; // specified as n, where the number of samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16.
    this.unbiased = true;
    this.clearColor = new Color(0x000000);
    this.clearAlpha = 0;
    this._currentClearColor = new Color();
    this.sampleWeight = uniform(1);
    this.sampleRenderTarget = null;
    this._quadMesh = new QuadMesh$1();
  }
  updateBefore(frame) {
    const {
      renderer
    } = frame;
    const {
      scene,
      camera
    } = this;
    this._pixelRatio = renderer.getPixelRatio();
    const size = renderer.getSize(_size$2);
    this.setSize(size.width, size.height);
    this.sampleRenderTarget.setSize(this.renderTarget.width, this.renderTarget.height);

    // save current renderer settings

    renderer.getClearColor(this._currentClearColor);
    const currentClearAlpha = renderer.getClearAlpha();
    const currentRenderTarget = renderer.getRenderTarget();
    const currentMRT = renderer.getMRT();
    const currentAutoClear = renderer.autoClear;

    //

    this._cameraNear.value = camera.near;
    this._cameraFar.value = camera.far;
    renderer.setMRT(this.getMRT());
    renderer.autoClear = false;
    const jitterOffsets = _JitterVectors[Math.max(0, Math.min(this.sampleLevel, 5))];
    const baseSampleWeight = 1.0 / jitterOffsets.length;
    const roundingRange = 1 / 32;
    const viewOffset = {
      fullWidth: this.renderTarget.width,
      fullHeight: this.renderTarget.height,
      offsetX: 0,
      offsetY: 0,
      width: this.renderTarget.width,
      height: this.renderTarget.height
    };
    const originalViewOffset = Object.assign({}, camera.view);
    if (originalViewOffset.enabled) Object.assign(viewOffset, originalViewOffset);

    // render the scene multiple times, each slightly jitter offset from the last and accumulate the results.

    for (let i = 0; i < jitterOffsets.length; i++) {
      const jitterOffset = jitterOffsets[i];
      if (camera.setViewOffset) {
        camera.setViewOffset(viewOffset.fullWidth, viewOffset.fullHeight, viewOffset.offsetX + jitterOffset[0] * 0.0625, viewOffset.offsetY + jitterOffset[1] * 0.0625,
        // 0.0625 = 1 / 16

        viewOffset.width, viewOffset.height);
      }
      this.sampleWeight.value = baseSampleWeight;
      if (this.unbiased) {
        // the theory is that equal weights for each sample lead to an accumulation of rounding errors.
        // The following equation varies the sampleWeight per sample so that it is uniformly distributed
        // across a range of values whose rounding errors cancel each other out.

        const uniformCenteredDistribution = -0.5 + (i + 0.5) / jitterOffsets.length;
        this.sampleWeight.value += roundingRange * uniformCenteredDistribution;
      }
      renderer.setClearColor(this.clearColor, this.clearAlpha);
      renderer.setRenderTarget(this.sampleRenderTarget);
      renderer.clear();
      renderer.render(scene, camera);

      // accumulation

      renderer.setRenderTarget(this.renderTarget);
      if (i === 0) {
        renderer.setClearColor(0x000000, 0.0);
        renderer.clear();
      }
      this._quadMesh.render(renderer);
    }
    renderer.copyTextureToTexture(this.sampleRenderTarget.depthTexture, this.renderTarget.depthTexture);

    // restore

    if (camera.setViewOffset && originalViewOffset.enabled) {
      camera.setViewOffset(originalViewOffset.fullWidth, originalViewOffset.fullHeight, originalViewOffset.offsetX, originalViewOffset.offsetY, originalViewOffset.width, originalViewOffset.height);
    } else if (camera.clearViewOffset) {
      camera.clearViewOffset();
    }
    renderer.setRenderTarget(currentRenderTarget);
    renderer.setMRT(currentMRT);
    renderer.autoClear = currentAutoClear;
    renderer.setClearColor(this._currentClearColor, currentClearAlpha);
  }
  setup(builder) {
    if (this.sampleRenderTarget === null) {
      this.sampleRenderTarget = this.renderTarget.clone();
    }
    let sampleTexture;
    const passMRT = this.getMRT();
    if (passMRT !== null) {
      const outputs = {};
      for (const name in passMRT.outputNodes) {
        const index = getTextureIndex(this.sampleRenderTarget.textures, name);
        if (index >= 0) {
          outputs[name] = texture(this.sampleRenderTarget.textures[index]).mul(this.sampleWeight);
        }
      }
      sampleTexture = mrt(outputs);
    } else {
      sampleTexture = texture(this.sampleRenderTarget.texture).mul(this.sampleWeight);
    }
    this._quadMesh.material = new NodeMaterial$1();
    this._quadMesh.material.fragmentNode = sampleTexture;
    this._quadMesh.material.transparent = true;
    this._quadMesh.material.depthTest = false;
    this._quadMesh.material.depthWrite = false;
    this._quadMesh.material.premultipliedAlpha = true;
    this._quadMesh.material.blending = AdditiveBlending;
    this._quadMesh.material.normals = false;
    this._quadMesh.material.name = 'SSAA';
    return super.setup(builder);
  }
  dispose() {
    super.dispose();
    if (this.sampleRenderTarget !== null) {
      this.sampleRenderTarget.dispose();
    }
  }
}
SSAAPassNode.type = /*@__PURE__*/registerNode('SSAAPass', SSAAPassNode);

// These jitter vectors are specified in integers because it is easier.
// I am assuming a [-8,8) integer grid, but it needs to be mapped onto [-0.5,0.5)
// before being used, thus these integers need to be scaled by 1/16.
//
// Sample patterns reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
const _JitterVectors = [[[0, 0]], [[4, 4], [-4, -4]], [[-2, -6], [6, -2], [-6, 2], [2, 6]], [[1, -3], [-1, 3], [5, 1], [-3, -5], [-5, 5], [-7, -1], [3, 7], [7, -7]], [[1, 1], [-1, -3], [-3, 2], [4, -1], [-5, -2], [2, 5], [5, 3], [3, -5], [-2, 6], [0, -7], [-4, -6], [-6, 4], [-8, 0], [7, -4], [6, 7], [-7, -8]], [[-4, -7], [-7, -5], [-3, -5], [-5, -4], [-1, -4], [-2, -2], [-6, -1], [-4, 0], [-7, 1], [-1, 2], [-6, 3], [-3, 3], [-7, 6], [-3, 6], [-5, 7], [-1, 7], [5, -7], [1, -6], [6, -5], [4, -4], [2, -3], [7, -2], [1, -1], [4, -1], [2, 1], [6, 2], [0, 4], [4, 4], [2, 5], [7, 5], [5, 6], [3, 7]]];

const _v3 = /*@__PURE__*/new Vector3();
const _minTarget = /*@__PURE__*/new Vector2();
const _maxTarget = /*@__PURE__*/new Vector2();
class PerspectiveCamera extends Camera {
  constructor(fov = 50, aspect = 1, near = 0.1, far = 2000) {
    super();
    this.isPerspectiveCamera = true;
    this.type = 'PerspectiveCamera';
    this.fov = fov;
    this.zoom = 1;
    this.near = near;
    this.far = far;
    this.focus = 10;
    this.aspect = aspect;
    this.view = null;
    this.filmGauge = 35; // width of the film (default in millimeters)
    this.filmOffset = 0; // horizontal film offset (same unit as gauge)

    this.updateProjectionMatrix();
  }
  copy(source, recursive) {
    super.copy(source, recursive);
    this.fov = source.fov;
    this.zoom = source.zoom;
    this.near = source.near;
    this.far = source.far;
    this.focus = source.focus;
    this.aspect = source.aspect;
    this.view = source.view === null ? null : Object.assign({}, source.view);
    this.filmGauge = source.filmGauge;
    this.filmOffset = source.filmOffset;
    return this;
  }

  /**
   * Sets the FOV by focal length in respect to the current .filmGauge.
   *
   * The default film gauge is 35, so that the focal length can be specified for
   * a 35mm (full frame) camera.
   *
   * Values for focal length and film gauge must have the same unit.
   */
  setFocalLength(focalLength) {
    /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */
    const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;
    this.fov = RAD2DEG * 2 * Math.atan(vExtentSlope);
    this.updateProjectionMatrix();
  }

  /**
   * Calculates the focal length from the current .fov and .filmGauge.
   */
  getFocalLength() {
    const vExtentSlope = Math.tan(DEG2RAD * 0.5 * this.fov);
    return 0.5 * this.getFilmHeight() / vExtentSlope;
  }
  getEffectiveFOV() {
    return RAD2DEG * 2 * Math.atan(Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom);
  }
  getFilmWidth() {
    // film not completely covered in portrait format (aspect < 1)
    return this.filmGauge * Math.min(this.aspect, 1);
  }
  getFilmHeight() {
    // film not completely covered in landscape format (aspect > 1)
    return this.filmGauge / Math.max(this.aspect, 1);
  }

  /**
   * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
   * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
   */
  getViewBounds(distance, minTarget, maxTarget) {
    _v3.set(-1, -1, 0.5).applyMatrix4(this.projectionMatrixInverse);
    minTarget.set(_v3.x, _v3.y).multiplyScalar(-distance / _v3.z);
    _v3.set(1, 1, 0.5).applyMatrix4(this.projectionMatrixInverse);
    maxTarget.set(_v3.x, _v3.y).multiplyScalar(-distance / _v3.z);
  }

  /**
   * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
   * Copies the result into the target Vector2, where x is width and y is height.
   */
  getViewSize(distance, target) {
    this.getViewBounds(distance, _minTarget, _maxTarget);
    return target.subVectors(_maxTarget, _minTarget);
  }

  /**
   * Sets an offset in a larger frustum. This is useful for multi-window or
   * multi-monitor/multi-machine setups.
   *
   * For example, if you have 3x2 monitors and each monitor is 1920x1080 and
   * the monitors are in grid like this
   *
   *   +---+---+---+
   *   | A | B | C |
   *   +---+---+---+
   *   | D | E | F |
   *   +---+---+---+
   *
   * then for each monitor you would call it like this
   *
   *   const w = 1920;
   *   const h = 1080;
   *   const fullWidth = w * 3;
   *   const fullHeight = h * 2;
   *
   *   --A--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
   *   --B--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
   *   --C--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
   *   --D--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
   *   --E--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
   *   --F--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
   *
   *   Note there is no reason monitors have to be the same size or in a grid.
   */
  setViewOffset(fullWidth, fullHeight, x, y, width, height) {
    this.aspect = fullWidth / fullHeight;
    if (this.view === null) {
      this.view = {
        enabled: true,
        fullWidth: 1,
        fullHeight: 1,
        offsetX: 0,
        offsetY: 0,
        width: 1,
        height: 1
      };
    }
    this.view.enabled = true;
    this.view.fullWidth = fullWidth;
    this.view.fullHeight = fullHeight;
    this.view.offsetX = x;
    this.view.offsetY = y;
    this.view.width = width;
    this.view.height = height;
    this.updateProjectionMatrix();
  }
  clearViewOffset() {
    if (this.view !== null) {
      this.view.enabled = false;
    }
    this.updateProjectionMatrix();
  }
  updateProjectionMatrix() {
    const near = this.near;
    let top = near * Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom;
    let height = 2 * top;
    let width = this.aspect * height;
    let left = -0.5 * width;
    const view = this.view;
    if (this.view !== null && this.view.enabled) {
      const fullWidth = view.fullWidth,
        fullHeight = view.fullHeight;
      left += view.offsetX * width / fullWidth;
      top -= view.offsetY * height / fullHeight;
      width *= view.width / fullWidth;
      height *= view.height / fullHeight;
    }
    const skew = this.filmOffset;
    if (skew !== 0) left += near * skew / this.getFilmWidth();
    this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far, this.coordinateSystem);
    this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
  }
  toJSON(meta) {
    const data = super.toJSON(meta);
    data.object.fov = this.fov;
    data.object.zoom = this.zoom;
    data.object.near = this.near;
    data.object.far = this.far;
    data.object.focus = this.focus;
    data.object.aspect = this.aspect;
    if (this.view !== null) data.object.view = Object.assign({}, this.view);
    data.object.filmGauge = this.filmGauge;
    data.object.filmOffset = this.filmOffset;
    return data;
  }
}

const _eyeRight = /*@__PURE__*/new Matrix4();
const _eyeLeft = /*@__PURE__*/new Matrix4();
const _projectionMatrix = /*@__PURE__*/new Matrix4();
class StereoCamera {
  constructor() {
    this.type = 'StereoCamera';
    this.aspect = 1;
    this.eyeSep = 0.064;
    this.cameraL = new PerspectiveCamera();
    this.cameraL.layers.enable(1);
    this.cameraL.matrixAutoUpdate = false;
    this.cameraR = new PerspectiveCamera();
    this.cameraR.layers.enable(2);
    this.cameraR.matrixAutoUpdate = false;
    this._cache = {
      focus: null,
      fov: null,
      aspect: null,
      near: null,
      far: null,
      zoom: null,
      eyeSep: null
    };
  }
  update(camera) {
    const cache = this._cache;
    const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;
    if (needsUpdate) {
      cache.focus = camera.focus;
      cache.fov = camera.fov;
      cache.aspect = camera.aspect * this.aspect;
      cache.near = camera.near;
      cache.far = camera.far;
      cache.zoom = camera.zoom;
      cache.eyeSep = this.eyeSep;

      // Off-axis stereoscopic effect based on
      // http://paulbourke.net/stereographics/stereorender/

      _projectionMatrix.copy(camera.projectionMatrix);
      const eyeSepHalf = cache.eyeSep / 2;
      const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;
      const ymax = cache.near * Math.tan(DEG2RAD * cache.fov * 0.5) / cache.zoom;
      let xmin, xmax;

      // translate xOffset

      _eyeLeft.elements[12] = -eyeSepHalf;
      _eyeRight.elements[12] = eyeSepHalf;

      // for left eye

      xmin = -ymax * cache.aspect + eyeSepOnProjection;
      xmax = ymax * cache.aspect + eyeSepOnProjection;
      _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);
      _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);
      this.cameraL.projectionMatrix.copy(_projectionMatrix);

      // for right eye

      xmin = -ymax * cache.aspect - eyeSepOnProjection;
      xmax = ymax * cache.aspect - eyeSepOnProjection;
      _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);
      _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);
      this.cameraR.projectionMatrix.copy(_projectionMatrix);
    }
    this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft);
    this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight);
  }
}

const _size$1 = /*@__PURE__*/new Vector2();
class StereoPassNode extends PassNode {
  constructor(scene, camera) {
    super(PassNode.COLOR, scene, camera);
    this.isStereoPassNode = true;
    this.stereo = new StereoCamera();
    this.stereo.aspect = 0.5;
  }
  updateBefore(frame) {
    const {
      renderer
    } = frame;
    const {
      scene,
      camera,
      stereo,
      renderTarget
    } = this;
    this._pixelRatio = renderer.getPixelRatio();
    stereo.cameraL.coordinateSystem = renderer.coordinateSystem;
    stereo.cameraR.coordinateSystem = renderer.coordinateSystem;
    stereo.update(camera);
    const size = renderer.getSize(_size$1);
    this.setSize(size.width, size.height);
    const currentAutoClear = renderer.autoClear;
    renderer.autoClear = false;
    const currentRenderTarget = renderer.getRenderTarget();
    const currentMRT = renderer.getMRT();
    this._cameraNear.value = camera.near;
    this._cameraFar.value = camera.far;
    for (const name in this._previousTextures) {
      this.toggleTexture(name);
    }
    renderer.setRenderTarget(renderTarget);
    renderer.setMRT(this._mrt);
    renderer.clear();
    renderTarget.scissorTest = true;
    renderTarget.scissor.set(0, 0, renderTarget.width / 2, renderTarget.height);
    renderTarget.viewport.set(0, 0, renderTarget.width / 2, renderTarget.height);
    renderer.render(scene, stereo.cameraL);
    renderTarget.scissor.set(renderTarget.width / 2, 0, renderTarget.width / 2, renderTarget.height);
    renderTarget.viewport.set(renderTarget.width / 2, 0, renderTarget.width / 2, renderTarget.height);
    renderer.render(scene, stereo.cameraR);
    renderTarget.scissorTest = false;
    renderer.setRenderTarget(currentRenderTarget);
    renderer.setMRT(currentMRT);
    renderer.autoClear = currentAutoClear;
  }
}
StereoPassNode.type = /*@__PURE__*/registerNode('StereoPass', StereoPassNode);

const _size = /*@__PURE__*/new Vector2();
const _quadMesh = /*@__PURE__*/new QuadMesh$1();
class StereoCompositePassNode extends PassNode {
  constructor(scene, camera) {
    super(PassNode.COLOR, scene, camera);
    this.isStereoCompositePassNode = true;
    this.stereo = new StereoCamera();
    const _params = {
      minFilter: LinearFilter,
      magFilter: NearestFilter,
      type: HalfFloatType
    };
    this._renderTargetL = new RenderTarget(1, 1, _params);
    this._renderTargetR = new RenderTarget(1, 1, _params);
    this._mapLeft = texture(this._renderTargetL.texture);
    this._mapRight = texture(this._renderTargetR.texture);
    this._material = null;
  }
  updateStereoCamera(coordinateSystem) {
    this.stereo.cameraL.coordinateSystem = coordinateSystem;
    this.stereo.cameraR.coordinateSystem = coordinateSystem;
    this.stereo.update(this.camera);
  }
  setSize(width, height) {
    super.setSize(width, height);
    this._renderTargetL.setSize(this.renderTarget.width, this.renderTarget.height);
    this._renderTargetR.setSize(this.renderTarget.width, this.renderTarget.height);
  }
  updateBefore(frame) {
    const {
      renderer
    } = frame;
    const {
      scene,
      stereo,
      renderTarget
    } = this;
    this._pixelRatio = renderer.getPixelRatio();
    this.updateStereoCamera(renderer.coordinateSystem);
    const size = renderer.getSize(_size);
    this.setSize(size.width, size.height);
    const currentRenderTarget = renderer.getRenderTarget();

    // left

    renderer.setRenderTarget(this._renderTargetL);
    renderer.render(scene, stereo.cameraL);

    // right

    renderer.setRenderTarget(this._renderTargetR);
    renderer.render(scene, stereo.cameraR);

    // composite

    renderer.setRenderTarget(renderTarget);
    _quadMesh.material = this._material;
    _quadMesh.render(renderer);

    // restore

    renderer.setRenderTarget(currentRenderTarget);
  }
  dispose() {
    super.dispose();
    this._renderTargetL.dispose();
    this._renderTargetR.dispose();
    if (this._material !== null) {
      this._material.dispose();
    }
  }
}
StereoCompositePassNode.type = /*@__PURE__*/registerNode('StereoCompositePass', StereoCompositePassNode);

class ParallaxBarrierPassNode extends StereoCompositePassNode {
  constructor(scene, camera) {
    super(scene, camera);
    this.isParallaxBarrierPassNode = true;
  }
  setup(builder) {
    const uvNode = uv();
    const parallaxBarrier = Fn(() => {
      const color = vec4().toVar();
      If(mod(viewportCoordinate.y, 2).greaterThan(1), () => {
        color.assign(this._mapLeft.uv(uvNode));
      }).Else(() => {
        color.assign(this._mapRight.uv(uvNode));
      });
      return color;
    });
    const material = this._material || (this._material = new NodeMaterial$1());
    material.fragmentNode = parallaxBarrier().context(builder.getSharedContext());
    material.needsUpdate = true;
    return super.setup(builder);
  }
}
ParallaxBarrierPassNode.type = /*@__PURE__*/registerNode('ParallaxBarrierPass', ParallaxBarrierPassNode);

/*@__PURE__*/mat3(vec3(1.6605, -0.1246, -0.0182), vec3(-0.5876, 1.1329, -0.1006), vec3(-0.0728, -0.0083, 1.1187));
/*@__PURE__*/mat3(vec3(0.6274, 0.0691, 0.0164), vec3(0.3293, 0.9195, 0.0880), vec3(0.0433, 0.0113, 0.8956));

class CodeNode extends Node$1 {
  constructor(code = '', includes = [], language = '') {
    super('code');
    this.isCodeNode = true;
    this.code = code;
    this.language = language;
    this.includes = includes;
  }
  isGlobal() {
    return true;
  }
  setIncludes(includes) {
    this.includes = includes;
    return this;
  }
  getIncludes(/*builder*/
  ) {
    return this.includes;
  }
  generate(builder) {
    const includes = this.getIncludes(builder);
    for (const include of includes) {
      include.build(builder);
    }
    const nodeCode = builder.getCodeFromNode(this, this.getNodeType(builder));
    nodeCode.code = this.code;
    return nodeCode.code;
  }
  serialize(data) {
    super.serialize(data);
    data.code = this.code;
    data.language = this.language;
  }
  deserialize(data) {
    super.deserialize(data);
    this.code = data.code;
    this.language = data.language;
  }
}
CodeNode.type = /*@__PURE__*/registerNode('Code', CodeNode);

class FunctionNode extends CodeNode {
  constructor(code = '', includes = [], language = '') {
    super(code, includes, language);
  }
  getNodeType(builder) {
    return this.getNodeFunction(builder).type;
  }
  getInputs(builder) {
    return this.getNodeFunction(builder).inputs;
  }
  getNodeFunction(builder) {
    const nodeData = builder.getDataFromNode(this);
    let nodeFunction = nodeData.nodeFunction;
    if (nodeFunction === undefined) {
      nodeFunction = builder.parser.parseFunction(this.code);
      nodeData.nodeFunction = nodeFunction;
    }
    return nodeFunction;
  }
  generate(builder, output) {
    super.generate(builder);
    const nodeFunction = this.getNodeFunction(builder);
    const name = nodeFunction.name;
    const type = nodeFunction.type;
    const nodeCode = builder.getCodeFromNode(this, type);
    if (name !== '') {
      // use a custom property name

      nodeCode.name = name;
    }
    const propertyName = builder.getPropertyName(nodeCode);
    const code = this.getNodeFunction(builder).getCode(propertyName);
    nodeCode.code = code + '\n';
    if (output === 'property') {
      return propertyName;
    } else {
      return builder.format(`${propertyName}()`, type, output);
    }
  }
}
FunctionNode.type = /*@__PURE__*/registerNode('Function', FunctionNode);

class ScriptableValueNode extends Node$1 {
  constructor(value = null) {
    super();
    this._value = value;
    this._cache = null;
    this.inputType = null;
    this.outpuType = null;
    this.events = new EventDispatcher();
    this.isScriptableValueNode = true;
  }
  get isScriptableOutputNode() {
    return this.outputType !== null;
  }
  set value(val) {
    if (this._value === val) return;
    if (this._cache && this.inputType === 'URL' && this.value.value instanceof ArrayBuffer) {
      URL.revokeObjectURL(this._cache);
      this._cache = null;
    }
    this._value = val;
    this.events.dispatchEvent({
      type: 'change'
    });
    this.refresh();
  }
  get value() {
    return this._value;
  }
  refresh() {
    this.events.dispatchEvent({
      type: 'refresh'
    });
  }
  getValue() {
    const value = this.value;
    if (value && this._cache === null && this.inputType === 'URL' && value.value instanceof ArrayBuffer) {
      this._cache = URL.createObjectURL(new Blob([value.value]));
    } else if (value && value.value !== null && value.value !== undefined && ((this.inputType === 'URL' || this.inputType === 'String') && typeof value.value === 'string' || this.inputType === 'Number' && typeof value.value === 'number' || this.inputType === 'Vector2' && value.value.isVector2 || this.inputType === 'Vector3' && value.value.isVector3 || this.inputType === 'Vector4' && value.value.isVector4 || this.inputType === 'Color' && value.value.isColor || this.inputType === 'Matrix3' && value.value.isMatrix3 || this.inputType === 'Matrix4' && value.value.isMatrix4)) {
      return value.value;
    }
    return this._cache || value;
  }
  getNodeType(builder) {
    return this.value && this.value.isNode ? this.value.getNodeType(builder) : 'float';
  }
  setup() {
    return this.value && this.value.isNode ? this.value : float();
  }
  serialize(data) {
    super.serialize(data);
    if (this.value !== null) {
      if (this.inputType === 'ArrayBuffer') {
        data.value = arrayBufferToBase64(this.value);
      } else {
        data.value = this.value ? this.value.toJSON(data.meta).uuid : null;
      }
    } else {
      data.value = null;
    }
    data.inputType = this.inputType;
    data.outputType = this.outputType;
  }
  deserialize(data) {
    super.deserialize(data);
    let value = null;
    if (data.value !== null) {
      if (data.inputType === 'ArrayBuffer') {
        value = base64ToArrayBuffer(data.value);
      } else if (data.inputType === 'Texture') {
        value = data.meta.textures[data.value];
      } else {
        value = data.meta.nodes[data.value] || null;
      }
    }
    this.value = value;
    this.inputType = data.inputType;
    this.outputType = data.outputType;
  }
}
ScriptableValueNode.type = /*@__PURE__*/registerNode('ScriptableValue', ScriptableValueNode);
const scriptableValue = /*@__PURE__*/nodeProxy(ScriptableValueNode);

class Resources extends Map {
  get(key, callback = null, ...params) {
    if (this.has(key)) return super.get(key);
    if (callback !== null) {
      const value = callback(...params);
      this.set(key, value);
      return value;
    }
  }
}
class Parameters {
  constructor(scriptableNode) {
    this.scriptableNode = scriptableNode;
  }
  get parameters() {
    return this.scriptableNode.parameters;
  }
  get layout() {
    return this.scriptableNode.getLayout();
  }
  getInputLayout(id) {
    return this.scriptableNode.getInputLayout(id);
  }
  get(name) {
    const param = this.parameters[name];
    const value = param ? param.getValue() : null;
    return value;
  }
}
const global$1 = new Resources();
class ScriptableNode extends Node$1 {
  constructor(codeNode = null, parameters = {}) {
    super();
    this.codeNode = codeNode;
    this.parameters = parameters;
    this._local = new Resources();
    this._output = scriptableValue();
    this._outputs = {};
    this._source = this.source;
    this._method = null;
    this._object = null;
    this._value = null;
    this._needsOutputUpdate = true;
    this.onRefresh = this.onRefresh.bind(this);
    this.isScriptableNode = true;
  }
  get source() {
    return this.codeNode ? this.codeNode.code : '';
  }
  setLocal(name, value) {
    return this._local.set(name, value);
  }
  getLocal(name) {
    return this._local.get(name);
  }
  onRefresh() {
    this._refresh();
  }
  getInputLayout(id) {
    for (const element of this.getLayout()) {
      if (element.inputType && (element.id === id || element.name === id)) {
        return element;
      }
    }
  }
  getOutputLayout(id) {
    for (const element of this.getLayout()) {
      if (element.outputType && (element.id === id || element.name === id)) {
        return element;
      }
    }
  }
  setOutput(name, value) {
    const outputs = this._outputs;
    if (outputs[name] === undefined) {
      outputs[name] = scriptableValue(value);
    } else {
      outputs[name].value = value;
    }
    return this;
  }
  getOutput(name) {
    return this._outputs[name];
  }
  getParameter(name) {
    return this.parameters[name];
  }
  setParameter(name, value) {
    const parameters = this.parameters;
    if (value && value.isScriptableNode) {
      this.deleteParameter(name);
      parameters[name] = value;
      parameters[name].getDefaultOutput().events.addEventListener('refresh', this.onRefresh);
    } else if (value && value.isScriptableValueNode) {
      this.deleteParameter(name);
      parameters[name] = value;
      parameters[name].events.addEventListener('refresh', this.onRefresh);
    } else if (parameters[name] === undefined) {
      parameters[name] = scriptableValue(value);
      parameters[name].events.addEventListener('refresh', this.onRefresh);
    } else {
      parameters[name].value = value;
    }
    return this;
  }
  getValue() {
    return this.getDefaultOutput().getValue();
  }
  deleteParameter(name) {
    let valueNode = this.parameters[name];
    if (valueNode) {
      if (valueNode.isScriptableNode) valueNode = valueNode.getDefaultOutput();
      valueNode.events.removeEventListener('refresh', this.onRefresh);
    }
    return this;
  }
  clearParameters() {
    for (const name of Object.keys(this.parameters)) {
      this.deleteParameter(name);
    }
    this.needsUpdate = true;
    return this;
  }
  call(name, ...params) {
    const object = this.getObject();
    const method = object[name];
    if (typeof method === 'function') {
      return method(...params);
    }
  }
  async callAsync(name, ...params) {
    const object = this.getObject();
    const method = object[name];
    if (typeof method === 'function') {
      return method.constructor.name === 'AsyncFunction' ? await method(...params) : method(...params);
    }
  }
  getNodeType(builder) {
    return this.getDefaultOutputNode().getNodeType(builder);
  }
  refresh(output = null) {
    if (output !== null) {
      this.getOutput(output).refresh();
    } else {
      this._refresh();
    }
  }
  getObject() {
    if (this.needsUpdate) this.dispose();
    if (this._object !== null) return this._object;

    //

    const refresh = () => this.refresh();
    const setOutput = (id, value) => this.setOutput(id, value);
    const parameters = new Parameters(this);
    const THREE = global$1.get('THREE');
    const TSL = global$1.get('TSL');
    const method = this.getMethod(this.codeNode);
    const params = [parameters, this._local, global$1, refresh, setOutput, THREE, TSL];
    this._object = method(...params);
    const layout = this._object.layout;
    if (layout) {
      if (layout.cache === false) {
        this._local.clear();
      }

      // default output
      this._output.outputType = layout.outputType || null;
      if (Array.isArray(layout.elements)) {
        for (const element of layout.elements) {
          const id = element.id || element.name;
          if (element.inputType) {
            if (this.getParameter(id) === undefined) this.setParameter(id, null);
            this.getParameter(id).inputType = element.inputType;
          }
          if (element.outputType) {
            if (this.getOutput(id) === undefined) this.setOutput(id, null);
            this.getOutput(id).outputType = element.outputType;
          }
        }
      }
    }
    return this._object;
  }
  deserialize(data) {
    super.deserialize(data);
    for (const name in this.parameters) {
      let valueNode = this.parameters[name];
      if (valueNode.isScriptableNode) valueNode = valueNode.getDefaultOutput();
      valueNode.events.addEventListener('refresh', this.onRefresh);
    }
  }
  getLayout() {
    return this.getObject().layout;
  }
  getDefaultOutputNode() {
    const output = this.getDefaultOutput().value;
    if (output && output.isNode) {
      return output;
    }
    return float();
  }
  getDefaultOutput() {
    return this._exec()._output;
  }
  getMethod() {
    if (this.needsUpdate) this.dispose();
    if (this._method !== null) return this._method;

    //

    const parametersProps = ['parameters', 'local', 'global', 'refresh', 'setOutput', 'THREE', 'TSL'];
    const interfaceProps = ['layout', 'init', 'main', 'dispose'];
    const properties = interfaceProps.join(', ');
    const declarations = 'var ' + properties + '; var output = {};\n';
    const returns = '\nreturn { ...output, ' + properties + ' };';
    const code = declarations + this.codeNode.code + returns;

    //

    this._method = new Function(...parametersProps, code);
    return this._method;
  }
  dispose() {
    if (this._method === null) return;
    if (this._object && typeof this._object.dispose === 'function') {
      this._object.dispose();
    }
    this._method = null;
    this._object = null;
    this._source = null;
    this._value = null;
    this._needsOutputUpdate = true;
    this._output.value = null;
    this._outputs = {};
  }
  setup() {
    return this.getDefaultOutputNode();
  }
  getCacheKey(force) {
    const cacheKey = [this.source, this.getDefaultOutputNode().getCacheKey(force)];
    for (const param in this.parameters) {
      cacheKey.push(this.parameters[param].getCacheKey(force));
    }
    return cacheKey.join(',');
  }
  set needsUpdate(value) {
    if (value === true) this.dispose();
  }
  get needsUpdate() {
    return this.source !== this._source;
  }
  _exec() {
    if (this.codeNode === null) return this;
    if (this._needsOutputUpdate === true) {
      this._value = this.call('main');
      this._needsOutputUpdate = false;
    }
    this._output.value = this._value;
    return this;
  }
  _refresh() {
    this.needsUpdate = true;
    this._exec();
    this._output.refresh();
  }
}
ScriptableNode.type = /*@__PURE__*/registerNode('Scriptable', ScriptableNode);

class FogNode extends Node$1 {
  constructor(colorNode, factorNode) {
    super('float');
    this.isFogNode = true;
    this.colorNode = colorNode;
    this.factorNode = factorNode;
  }
  getViewZNode(builder) {
    let viewZ;
    const getViewZ = builder.context.getViewZ;
    if (getViewZ !== undefined) {
      viewZ = getViewZ(this);
    }
    return (viewZ || positionView.z).negate();
  }
  setup() {
    return this.factorNode;
  }
}
FogNode.type = /*@__PURE__*/registerNode('Fog', FogNode);

class FogRangeNode extends FogNode {
  constructor(colorNode, nearNode, farNode) {
    super(colorNode);
    this.isFogRangeNode = true;
    this.nearNode = nearNode;
    this.farNode = farNode;
  }
  setup(builder) {
    const viewZ = this.getViewZNode(builder);
    return smoothstep(this.nearNode, this.farNode, viewZ);
  }
}
FogRangeNode.type = /*@__PURE__*/registerNode('FogRange', FogRangeNode);

class FogExp2Node extends FogNode {
  constructor(colorNode, densityNode) {
    super(colorNode);
    this.isFogExp2Node = true;
    this.densityNode = densityNode;
  }
  setup(builder) {
    const viewZ = this.getViewZNode(builder);
    const density = this.densityNode;
    return density.mul(density, viewZ, viewZ).negate().exp().oneMinus();
  }
}
FogExp2Node.type = /*@__PURE__*/registerNode('FogExp2', FogExp2Node);

let min = null;
let max$1 = null;
class RangeNode extends Node$1 {
  constructor(minNode = float(), maxNode = float()) {
    super();
    this.minNode = minNode;
    this.maxNode = maxNode;
  }
  getVectorLength(builder) {
    const minLength = builder.getTypeLength(getValueType(this.minNode.value));
    const maxLength = builder.getTypeLength(getValueType(this.maxNode.value));
    return minLength > maxLength ? minLength : maxLength;
  }
  getNodeType(builder) {
    return builder.object.count > 1 ? builder.getTypeFromLength(this.getVectorLength(builder)) : 'float';
  }
  setup(builder) {
    const object = builder.object;
    let output = null;
    if (object.count > 1) {
      const minValue = this.minNode.value;
      const maxValue = this.maxNode.value;
      const minLength = builder.getTypeLength(getValueType(minValue));
      const maxLength = builder.getTypeLength(getValueType(maxValue));
      min = min || new Vector4();
      max$1 = max$1 || new Vector4();
      min.setScalar(0);
      max$1.setScalar(0);
      if (minLength === 1) min.setScalar(minValue);else if (minValue.isColor) min.set(minValue.r, minValue.g, minValue.b);else min.set(minValue.x, minValue.y, minValue.z || 0, minValue.w || 0);
      if (maxLength === 1) max$1.setScalar(maxValue);else if (maxValue.isColor) max$1.set(maxValue.r, maxValue.g, maxValue.b);else max$1.set(maxValue.x, maxValue.y, maxValue.z || 0, maxValue.w || 0);
      const stride = 4;
      const length = stride * object.count;
      const array = new Float32Array(length);
      for (let i = 0; i < length; i++) {
        const index = i % stride;
        const minElementValue = min.getComponent(index);
        const maxElementValue = max$1.getComponent(index);
        array[i] = MathUtils.lerp(minElementValue, maxElementValue, Math.random());
      }
      const nodeType = this.getNodeType(builder);
      if (object.count <= 4096) {
        output = buffer(array, 'vec4', object.count).element(instanceIndex).convert(nodeType);
      } else {
        // TODO: Improve anonymous buffer attribute creation removing this part
        const bufferAttribute = new InstancedBufferAttribute(array, 4);
        builder.geometry.setAttribute('__range' + this.id, bufferAttribute);
        output = instancedBufferAttribute(bufferAttribute).convert(nodeType);
      }
    } else {
      output = float(0);
    }
    return output;
  }
}
RangeNode.type = /*@__PURE__*/registerNode('Range', RangeNode);

class LightNode extends Node$1 {
  constructor(scope = LightNode.TARGET_DIRECTION, light = null) {
    super();
    this.scope = scope;
    this.light = light;
  }
  setup() {
    const {
      scope,
      light
    } = this;
    let output = null;
    if (scope === LightNode.TARGET_DIRECTION) {
      output = cameraViewMatrix.transformDirection(objectPosition(light).sub(objectPosition(light.target)));
    }
    return output;
  }
  serialize(data) {
    super.serialize(data);
    data.scope = this.scope;
  }
  deserialize(data) {
    super.deserialize(data);
    this.scope = data.scope;
  }
}
LightNode.TARGET_DIRECTION = 'targetDirection';
LightNode.type = /*@__PURE__*/registerNode('Light', LightNode);
/*@__PURE__*/nodeProxy(LightNode, LightNode.TARGET_DIRECTION);

// These defines must match with PMREMGenerator

const cubeUV_r0 = /*@__PURE__*/float(1.0);
const cubeUV_m0 = /*@__PURE__*/float(-2.0);
const cubeUV_r1 = /*@__PURE__*/float(0.8);
const cubeUV_m1 = /*@__PURE__*/float(-1.0);
const cubeUV_r4 = /*@__PURE__*/float(0.4);
const cubeUV_m4 = /*@__PURE__*/float(2.0);
const cubeUV_r5 = /*@__PURE__*/float(0.305);
const cubeUV_m5 = /*@__PURE__*/float(3.0);
const cubeUV_r6 = /*@__PURE__*/float(0.21);
const cubeUV_m6 = /*@__PURE__*/float(4.0);
const cubeUV_minMipLevel = /*@__PURE__*/float(4.0);
const cubeUV_minTileSize = /*@__PURE__*/float(16.0);

// These shader functions convert between the UV coordinates of a single face of
// a cubemap, the 0-5 integer index of a cube face, and the direction vector for
// sampling a textureCube (not generally normalized ).

const getFace = /*@__PURE__*/Fn(([direction]) => {
  const absDirection = vec3(abs(direction)).toVar();
  const face = float(-1.0).toVar();
  If(absDirection.x.greaterThan(absDirection.z), () => {
    If(absDirection.x.greaterThan(absDirection.y), () => {
      face.assign(select(direction.x.greaterThan(0.0), 0.0, 3.0));
    }).Else(() => {
      face.assign(select(direction.y.greaterThan(0.0), 1.0, 4.0));
    });
  }).Else(() => {
    If(absDirection.z.greaterThan(absDirection.y), () => {
      face.assign(select(direction.z.greaterThan(0.0), 2.0, 5.0));
    }).Else(() => {
      face.assign(select(direction.y.greaterThan(0.0), 1.0, 4.0));
    });
  });
  return face;
}).setLayout({
  name: 'getFace',
  type: 'float',
  inputs: [{
    name: 'direction',
    type: 'vec3'
  }]
});

// RH coordinate system; PMREM face-indexing convention
const getUV = /*@__PURE__*/Fn(([direction, face]) => {
  const uv = vec2().toVar();
  If(face.equal(0.0), () => {
    uv.assign(vec2(direction.z, direction.y).div(abs(direction.x))); // pos x
  }).ElseIf(face.equal(1.0), () => {
    uv.assign(vec2(direction.x.negate(), direction.z.negate()).div(abs(direction.y))); // pos y
  }).ElseIf(face.equal(2.0), () => {
    uv.assign(vec2(direction.x.negate(), direction.y).div(abs(direction.z))); // pos z
  }).ElseIf(face.equal(3.0), () => {
    uv.assign(vec2(direction.z.negate(), direction.y).div(abs(direction.x))); // neg x
  }).ElseIf(face.equal(4.0), () => {
    uv.assign(vec2(direction.x.negate(), direction.z).div(abs(direction.y))); // neg y
  }).Else(() => {
    uv.assign(vec2(direction.x, direction.y).div(abs(direction.z))); // neg z
  });
  return mul(0.5, uv.add(1.0));
}).setLayout({
  name: 'getUV',
  type: 'vec2',
  inputs: [{
    name: 'direction',
    type: 'vec3'
  }, {
    name: 'face',
    type: 'float'
  }]
});
const roughnessToMip = /*@__PURE__*/Fn(([roughness]) => {
  const mip = float(0.0).toVar();
  If(roughness.greaterThanEqual(cubeUV_r1), () => {
    mip.assign(cubeUV_r0.sub(roughness).mul(cubeUV_m1.sub(cubeUV_m0)).div(cubeUV_r0.sub(cubeUV_r1)).add(cubeUV_m0));
  }).ElseIf(roughness.greaterThanEqual(cubeUV_r4), () => {
    mip.assign(cubeUV_r1.sub(roughness).mul(cubeUV_m4.sub(cubeUV_m1)).div(cubeUV_r1.sub(cubeUV_r4)).add(cubeUV_m1));
  }).ElseIf(roughness.greaterThanEqual(cubeUV_r5), () => {
    mip.assign(cubeUV_r4.sub(roughness).mul(cubeUV_m5.sub(cubeUV_m4)).div(cubeUV_r4.sub(cubeUV_r5)).add(cubeUV_m4));
  }).ElseIf(roughness.greaterThanEqual(cubeUV_r6), () => {
    mip.assign(cubeUV_r5.sub(roughness).mul(cubeUV_m6.sub(cubeUV_m5)).div(cubeUV_r5.sub(cubeUV_r6)).add(cubeUV_m5));
  }).Else(() => {
    mip.assign(float(-2.0).mul(log2(mul(1.16, roughness)))); // 1.16 = 1.79^0.25
  });
  return mip;
}).setLayout({
  name: 'roughnessToMip',
  type: 'float',
  inputs: [{
    name: 'roughness',
    type: 'float'
  }]
});

//

const textureCubeUV = /*@__PURE__*/Fn(([envMap, sampleDir_immutable, roughness_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP]) => {
  const roughness = float(roughness_immutable);
  const sampleDir = vec3(sampleDir_immutable);
  const mip = clamp(roughnessToMip(roughness), cubeUV_m0, CUBEUV_MAX_MIP);
  const mipF = fract(mip);
  const mipInt = floor(mip);
  const color0 = vec3(bilinearCubeUV(envMap, sampleDir, mipInt, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP)).toVar();
  If(mipF.notEqual(0.0), () => {
    const color1 = vec3(bilinearCubeUV(envMap, sampleDir, mipInt.add(1.0), CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP)).toVar();
    color0.assign(mix(color0, color1, mipF));
  });
  return color0;
});
const bilinearCubeUV = /*@__PURE__*/Fn(([envMap, direction_immutable, mipInt_immutable, CUBEUV_TEXEL_WIDTH, CUBEUV_TEXEL_HEIGHT, CUBEUV_MAX_MIP]) => {
  const mipInt = float(mipInt_immutable).toVar();
  const direction = vec3(direction_immutable);
  const face = float(getFace(direction)).toVar();
  const filterInt = float(max$2(cubeUV_minMipLevel.sub(mipInt), 0.0)).toVar();
  mipInt.assign(max$2(mipInt, cubeUV_minMipLevel));
  const faceSize = float(exp2(mipInt)).toVar();
  const uv = vec2(getUV(direction, face).mul(faceSize.sub(2.0)).add(1.0)).toVar();
  If(face.greaterThan(2.0), () => {
    uv.y.addAssign(faceSize);
    face.subAssign(3.0);
  });
  uv.x.addAssign(face.mul(faceSize));
  uv.x.addAssign(filterInt.mul(mul(3.0, cubeUV_minTileSize)));
  uv.y.addAssign(mul(4.0, exp2(CUBEUV_MAX_MIP).sub(faceSize)));
  uv.x.mulAssign(CUBEUV_TEXEL_WIDTH);
  uv.y.mulAssign(CUBEUV_TEXEL_HEIGHT);
  return envMap.uv(uv).grad(vec2(), vec2()); // disable anisotropic filtering
});

let _generator = null;
const _cache = new WeakMap();
function _generateCubeUVSize(imageHeight) {
  const maxMip = Math.log2(imageHeight) - 2;
  const texelHeight = 1.0 / imageHeight;
  const texelWidth = 1.0 / (3 * Math.max(Math.pow(2, maxMip), 7 * 16));
  return {
    texelWidth,
    texelHeight,
    maxMip
  };
}
function _getPMREMFromTexture(texture) {
  let cacheTexture = _cache.get(texture);
  const pmremVersion = cacheTexture !== undefined ? cacheTexture.pmremVersion : -1;
  if (pmremVersion !== texture.pmremVersion) {
    const image = texture.image;
    if (texture.isCubeTexture) {
      if (isCubeMapReady(image)) {
        cacheTexture = _generator.fromCubemap(texture, cacheTexture);
      } else {
        return null;
      }
    } else {
      if (isEquirectangularMapReady(image)) {
        cacheTexture = _generator.fromEquirectangular(texture, cacheTexture);
      } else {
        return null;
      }
    }
    cacheTexture.pmremVersion = texture.pmremVersion;
    _cache.set(texture, cacheTexture);
  }
  return cacheTexture.texture;
}
class PMREMNode extends TempNode {
  constructor(value, uvNode = null, levelNode = null) {
    super('vec3');
    this._value = value;
    this._pmrem = null;
    this.uvNode = uvNode;
    this.levelNode = levelNode;
    this._generator = null;
    const defaultTexture = new Texture();
    defaultTexture.isRenderTargetTexture = true;
    this._texture = texture(defaultTexture);
    this._width = uniform(0);
    this._height = uniform(0);
    this._maxMip = uniform(0);
    this.updateBeforeType = NodeUpdateType.RENDER;
  }
  set value(value) {
    this._value = value;
    this._pmrem = null;
  }
  get value() {
    return this._value;
  }
  updateFromTexture(texture) {
    const cubeUVSize = _generateCubeUVSize(texture.image.height);
    this._texture.value = texture;
    this._width.value = cubeUVSize.texelWidth;
    this._height.value = cubeUVSize.texelHeight;
    this._maxMip.value = cubeUVSize.maxMip;
  }
  updateBefore() {
    let pmrem = this._pmrem;
    const pmremVersion = pmrem ? pmrem.pmremVersion : -1;
    const texture = this._value;
    if (pmremVersion !== texture.pmremVersion) {
      if (texture.isPMREMTexture === true) {
        pmrem = texture;
      } else {
        pmrem = _getPMREMFromTexture(texture);
      }
      if (pmrem !== null) {
        this._pmrem = pmrem;
        this.updateFromTexture(pmrem);
      }
    }
  }
  setup(builder) {
    if (_generator === null) {
      _generator = builder.createPMREMGenerator();
    }

    //

    this.updateBefore(builder);

    //

    let uvNode = this.uvNode;
    if (uvNode === null && builder.context.getUV) {
      uvNode = builder.context.getUV(this);
    }

    //

    const texture = this.value;
    if (builder.renderer.coordinateSystem === WebGLCoordinateSystem && texture.isPMREMTexture !== true && texture.isRenderTargetTexture === true) {
      uvNode = vec3(uvNode.x.negate(), uvNode.yz);
    }

    //

    let levelNode = this.levelNode;
    if (levelNode === null && builder.context.getTextureLevel) {
      levelNode = builder.context.getTextureLevel(this);
    }

    //

    return textureCubeUV(this._texture, uvNode, levelNode, this._width, this._height, this._maxMip);
  }
}
PMREMNode.type = /*@__PURE__*/registerNode('PMREM', PMREMNode);
function isCubeMapReady(image) {
  if (image === null || image === undefined) return false;
  let count = 0;
  const length = 6;
  for (let i = 0; i < length; i++) {
    if (image[i] !== undefined) count++;
  }
  return count === length;
}
function isEquirectangularMapReady(image) {
  if (image === null || image === undefined) return false;
  return image.height > 0;
}

class SphereGeometry extends BufferGeometry {
  constructor(radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI) {
    super();
    this.type = 'SphereGeometry';
    this.parameters = {
      radius: radius,
      widthSegments: widthSegments,
      heightSegments: heightSegments,
      phiStart: phiStart,
      phiLength: phiLength,
      thetaStart: thetaStart,
      thetaLength: thetaLength
    };
    widthSegments = Math.max(3, Math.floor(widthSegments));
    heightSegments = Math.max(2, Math.floor(heightSegments));
    const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI);
    let index = 0;
    const grid = [];
    const vertex = new Vector3();
    const normal = new Vector3();

    // buffers

    const indices = [];
    const vertices = [];
    const normals = [];
    const uvs = [];

    // generate vertices, normals and uvs

    for (let iy = 0; iy <= heightSegments; iy++) {
      const verticesRow = [];
      const v = iy / heightSegments;

      // special case for the poles

      let uOffset = 0;
      if (iy === 0 && thetaStart === 0) {
        uOffset = 0.5 / widthSegments;
      } else if (iy === heightSegments && thetaEnd === Math.PI) {
        uOffset = -0.5 / widthSegments;
      }
      for (let ix = 0; ix <= widthSegments; ix++) {
        const u = ix / widthSegments;

        // vertex

        vertex.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);
        vertex.y = radius * Math.cos(thetaStart + v * thetaLength);
        vertex.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);
        vertices.push(vertex.x, vertex.y, vertex.z);

        // normal

        normal.copy(vertex).normalize();
        normals.push(normal.x, normal.y, normal.z);

        // uv

        uvs.push(u + uOffset, 1 - v);
        verticesRow.push(index++);
      }
      grid.push(verticesRow);
    }

    // indices

    for (let iy = 0; iy < heightSegments; iy++) {
      for (let ix = 0; ix < widthSegments; ix++) {
        const a = grid[iy][ix + 1];
        const b = grid[iy][ix];
        const c = grid[iy + 1][ix];
        const d = grid[iy + 1][ix + 1];
        if (iy !== 0 || thetaStart > 0) indices.push(a, b, d);
        if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d);
      }
    }

    // build geometry

    this.setIndex(indices);
    this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
    this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
    this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
  }
  copy(source) {
    super.copy(source);
    this.parameters = Object.assign({}, source.parameters);
    return this;
  }
  static fromJSON(data) {
    return new SphereGeometry(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength);
  }
}

const _clearColor = /*@__PURE__*/new Color4$1();
class Background extends DataMap$1 {
  constructor(renderer, nodes) {
    super();
    this.renderer = renderer;
    this.nodes = nodes;
  }
  update(scene, renderList, renderContext) {
    const renderer = this.renderer;
    const background = this.nodes.getBackgroundNode(scene) || scene.background;
    let forceClear = false;
    if (background === null) {
      // no background settings, use clear color configuration from the renderer

      renderer._clearColor.getRGB(_clearColor, LinearSRGBColorSpace);
      _clearColor.a = renderer._clearColor.a;
    } else if (background.isColor === true) {
      // background is an opaque color

      background.getRGB(_clearColor, LinearSRGBColorSpace);
      _clearColor.a = 1;
      forceClear = true;
    } else if (background.isNode === true) {
      const sceneData = this.get(scene);
      const backgroundNode = background;
      _clearColor.copy(renderer._clearColor);
      let backgroundMesh = sceneData.backgroundMesh;
      if (backgroundMesh === undefined) {
        const backgroundMeshNode = context(vec4(backgroundNode).mul(backgroundIntensity), {
          // @TODO: Add Texture2D support using node context
          getUV: () => normalWorld,
          getTextureLevel: () => backgroundBlurriness
        });
        let viewProj = modelViewProjection();
        viewProj = viewProj.setZ(viewProj.w);
        const nodeMaterial = new NodeMaterial$1();
        nodeMaterial.name = 'Background.material';
        nodeMaterial.side = BackSide;
        nodeMaterial.depthTest = false;
        nodeMaterial.depthWrite = false;
        nodeMaterial.fog = false;
        nodeMaterial.lights = false;
        nodeMaterial.vertexNode = viewProj;
        nodeMaterial.colorNode = backgroundMeshNode;
        sceneData.backgroundMeshNode = backgroundMeshNode;
        sceneData.backgroundMesh = backgroundMesh = new Mesh(new SphereGeometry(1, 32, 32), nodeMaterial);
        backgroundMesh.frustumCulled = false;
        backgroundMesh.name = 'Background.mesh';
        backgroundMesh.onBeforeRender = function (renderer, scene, camera) {
          this.matrixWorld.copyPosition(camera.matrixWorld);
        };
      }
      const backgroundCacheKey = backgroundNode.getCacheKey();
      if (sceneData.backgroundCacheKey !== backgroundCacheKey) {
        sceneData.backgroundMeshNode.node = vec4(backgroundNode).mul(backgroundIntensity);
        sceneData.backgroundMeshNode.needsUpdate = true;
        backgroundMesh.material.needsUpdate = true;
        sceneData.backgroundCacheKey = backgroundCacheKey;
      }
      renderList.unshift(backgroundMesh, backgroundMesh.geometry, backgroundMesh.material, 0, 0, null);
    } else {
      console.error('THREE.Renderer: Unsupported background configuration.', background);
    }

    //

    if (renderer.autoClear === true || forceClear === true) {
      _clearColor.multiplyScalar(_clearColor.a);
      const clearColorValue = renderContext.clearColorValue;
      clearColorValue.r = _clearColor.r;
      clearColorValue.g = _clearColor.g;
      clearColorValue.b = _clearColor.b;
      clearColorValue.a = _clearColor.a;
      renderContext.depthClearValue = renderer._clearDepth;
      renderContext.stencilClearValue = renderer._clearStencil;
      renderContext.clearColor = renderer.autoClearColor === true;
      renderContext.clearDepth = renderer.autoClearDepth === true;
      renderContext.clearStencil = renderer.autoClearStencil === true;
    } else {
      renderContext.clearColor = false;
      renderContext.clearDepth = false;
      renderContext.clearStencil = false;
    }
  }
}
var background = Background;

/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.8.2
*/

// aliases for shorter compressed code (most minifers don't do this)
var u8 = Uint8Array,
  u16 = Uint16Array,
  i32 = Int32Array;
// fixed length extra bits
var fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */0, 0, /* impossible */0]);
// fixed distance extra bits
var fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */0, 0]);
// code length index map
var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
// get base, reverse index map from extra bits
var freb = function (eb, start) {
  var b = new u16(31);
  for (var i = 0; i < 31; ++i) {
    b[i] = start += 1 << eb[i - 1];
  }
  // numbers here are at max 18 bits
  var r = new i32(b[30]);
  for (var i = 1; i < 30; ++i) {
    for (var j = b[i]; j < b[i + 1]; ++j) {
      r[j] = j - b[i] << 5 | i;
    }
  }
  return {
    b: b,
    r: r
  };
};
var _a = freb(fleb, 2),
  fl = _a.b,
  revfl = _a.r;
// we can ignore the fact that the other numbers are wrong; they never happen anyway
fl[28] = 258, revfl[258] = 28;
var _b = freb(fdeb, 0),
  fd = _b.b;
// map of value to reverse (assuming 16 bits)
var rev = new u16(32768);
for (var i = 0; i < 32768; ++i) {
  // reverse table algorithm from SO
  var x = (i & 0xAAAA) >> 1 | (i & 0x5555) << 1;
  x = (x & 0xCCCC) >> 2 | (x & 0x3333) << 2;
  x = (x & 0xF0F0) >> 4 | (x & 0x0F0F) << 4;
  rev[i] = ((x & 0xFF00) >> 8 | (x & 0x00FF) << 8) >> 1;
}
// create huffman tree from u8 "map": index -> code length for code index
// mb (max bits) must be at most 15
// TODO: optimize/split up?
var hMap = function (cd, mb, r) {
  var s = cd.length;
  // index
  var i = 0;
  // u16 "map": index -> # of codes with bit length = index
  var l = new u16(mb);
  // length of cd must be 288 (total # of codes)
  for (; i < s; ++i) {
    if (cd[i]) ++l[cd[i] - 1];
  }
  // u16 "map": index -> minimum code for bit length = index
  var le = new u16(mb);
  for (i = 1; i < mb; ++i) {
    le[i] = le[i - 1] + l[i - 1] << 1;
  }
  var co;
  if (r) {
    // u16 "map": index -> number of actual bits, symbol for code
    co = new u16(1 << mb);
    // bits to remove for reverser
    var rvb = 15 - mb;
    for (i = 0; i < s; ++i) {
      // ignore 0 lengths
      if (cd[i]) {
        // num encoding both symbol and bits read
        var sv = i << 4 | cd[i];
        // free bits
        var r_1 = mb - cd[i];
        // start value
        var v = le[cd[i] - 1]++ << r_1;
        // m is end value
        for (var m = v | (1 << r_1) - 1; v <= m; ++v) {
          // every 16 bit value starting with the code yields the same result
          co[rev[v] >> rvb] = sv;
        }
      }
    }
  } else {
    co = new u16(s);
    for (i = 0; i < s; ++i) {
      if (cd[i]) {
        co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
      }
    }
  }
  return co;
};
// fixed length tree
var flt = new u8(288);
for (var i = 0; i < 144; ++i) flt[i] = 8;
for (var i = 144; i < 256; ++i) flt[i] = 9;
for (var i = 256; i < 280; ++i) flt[i] = 7;
for (var i = 280; i < 288; ++i) flt[i] = 8;
// fixed distance tree
var fdt = new u8(32);
for (var i = 0; i < 32; ++i) fdt[i] = 5;
// fixed length map
var flrm = /*#__PURE__*/hMap(flt, 9, 1);
// fixed distance map
var fdrm = /*#__PURE__*/hMap(fdt, 5, 1);
// find max of array
var max = function (a) {
  var m = a[0];
  for (var i = 1; i < a.length; ++i) {
    if (a[i] > m) m = a[i];
  }
  return m;
};
// read d, starting at bit p and mask with m
var bits = function (d, p, m) {
  var o = p / 8 | 0;
  return (d[o] | d[o + 1] << 8) >> (p & 7) & m;
};
// read d, starting at bit p continuing for at least 16 bits
var bits16 = function (d, p) {
  var o = p / 8 | 0;
  return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7);
};
// get end of byte
var shft = function (p) {
  return (p + 7) / 8 | 0;
};
// typed array slice - allows garbage collector to free original reference,
// while being more compatible than .slice
var slc = function (v, s, e) {
  if (s == null || s < 0) s = 0;
  if (e == null || e > v.length) e = v.length;
  // can't use .constructor in case user-supplied
  return new u8(v.subarray(s, e));
};
// error codes
var ec = ['unexpected EOF', 'invalid block type', 'invalid length/literal', 'invalid distance', 'stream finished', 'no stream handler',, 'no callback', 'invalid UTF-8 data', 'extra field too long', 'date not in range 1980-2099', 'filename too long', 'stream finishing', 'invalid zip data'
// determined by unknown compression method
];
var err = function (ind, msg, nt) {
  var e = new Error(msg || ec[ind]);
  e.code = ind;
  if (Error.captureStackTrace) Error.captureStackTrace(e, err);
  if (!nt) throw e;
  return e;
};
// expands raw DEFLATE data
var inflt = function (dat, st, buf, dict) {
  // source length       dict length
  var sl = dat.length,
    dl = dict ? dict.length : 0;
  if (!sl || st.f && !st.l) return buf || new u8(0);
  var noBuf = !buf;
  // have to estimate size
  var resize = noBuf || st.i != 2;
  // no state
  var noSt = st.i;
  // Assumes roughly 33% compression ratio average
  if (noBuf) buf = new u8(sl * 3);
  // ensure buffer can fit at least l elements
  var cbuf = function (l) {
    var bl = buf.length;
    // need to increase size to fit
    if (l > bl) {
      // Double or set to necessary, whichever is greater
      var nbuf = new u8(Math.max(bl * 2, l));
      nbuf.set(buf);
      buf = nbuf;
    }
  };
  //  last chunk         bitpos           bytes
  var final = st.f || 0,
    pos = st.p || 0,
    bt = st.b || 0,
    lm = st.l,
    dm = st.d,
    lbt = st.m,
    dbt = st.n;
  // total bits
  var tbts = sl * 8;
  do {
    if (!lm) {
      // BFINAL - this is only 1 when last chunk is next
      final = bits(dat, pos, 1);
      // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman
      var type = bits(dat, pos + 1, 3);
      pos += 3;
      if (!type) {
        // go to end of byte boundary
        var s = shft(pos) + 4,
          l = dat[s - 4] | dat[s - 3] << 8,
          t = s + l;
        if (t > sl) {
          if (noSt) err(0);
          break;
        }
        // ensure size
        if (resize) cbuf(bt + l);
        // Copy over uncompressed data
        buf.set(dat.subarray(s, t), bt);
        // Get new bitpos, update byte count
        st.b = bt += l, st.p = pos = t * 8, st.f = final;
        continue;
      } else if (type == 1) lm = flrm, dm = fdrm, lbt = 9, dbt = 5;else if (type == 2) {
        //  literal                            lengths
        var hLit = bits(dat, pos, 31) + 257,
          hcLen = bits(dat, pos + 10, 15) + 4;
        var tl = hLit + bits(dat, pos + 5, 31) + 1;
        pos += 14;
        // length+distance tree
        var ldt = new u8(tl);
        // code length tree
        var clt = new u8(19);
        for (var i = 0; i < hcLen; ++i) {
          // use index map to get real code
          clt[clim[i]] = bits(dat, pos + i * 3, 7);
        }
        pos += hcLen * 3;
        // code lengths bits
        var clb = max(clt),
          clbmsk = (1 << clb) - 1;
        // code lengths map
        var clm = hMap(clt, clb, 1);
        for (var i = 0; i < tl;) {
          var r = clm[bits(dat, pos, clbmsk)];
          // bits read
          pos += r & 15;
          // symbol
          var s = r >> 4;
          // code length to copy
          if (s < 16) {
            ldt[i++] = s;
          } else {
            //  copy   count
            var c = 0,
              n = 0;
            if (s == 16) n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];else if (s == 17) n = 3 + bits(dat, pos, 7), pos += 3;else if (s == 18) n = 11 + bits(dat, pos, 127), pos += 7;
            while (n--) ldt[i++] = c;
          }
        }
        //    length tree                 distance tree
        var lt = ldt.subarray(0, hLit),
          dt = ldt.subarray(hLit);
        // max length bits
        lbt = max(lt);
        // max dist bits
        dbt = max(dt);
        lm = hMap(lt, lbt, 1);
        dm = hMap(dt, dbt, 1);
      } else err(1);
      if (pos > tbts) {
        if (noSt) err(0);
        break;
      }
    }
    // Make sure the buffer can hold this + the largest possible addition
    // Maximum chunk size (practically, theoretically infinite) is 2^17
    if (resize) cbuf(bt + 131072);
    var lms = (1 << lbt) - 1,
      dms = (1 << dbt) - 1;
    var lpos = pos;
    for (;; lpos = pos) {
      // bits read, code
      var c = lm[bits16(dat, pos) & lms],
        sym = c >> 4;
      pos += c & 15;
      if (pos > tbts) {
        if (noSt) err(0);
        break;
      }
      if (!c) err(2);
      if (sym < 256) buf[bt++] = sym;else if (sym == 256) {
        lpos = pos, lm = null;
        break;
      } else {
        var add = sym - 254;
        // no extra bits needed if less
        if (sym > 264) {
          // index
          var i = sym - 257,
            b = fleb[i];
          add = bits(dat, pos, (1 << b) - 1) + fl[i];
          pos += b;
        }
        // dist
        var d = dm[bits16(dat, pos) & dms],
          dsym = d >> 4;
        if (!d) err(3);
        pos += d & 15;
        var dt = fd[dsym];
        if (dsym > 3) {
          var b = fdeb[dsym];
          dt += bits16(dat, pos) & (1 << b) - 1, pos += b;
        }
        if (pos > tbts) {
          if (noSt) err(0);
          break;
        }
        if (resize) cbuf(bt + 131072);
        var end = bt + add;
        if (bt < dt) {
          var shift = dl - dt,
            dend = Math.min(dt, end);
          if (shift + bt < 0) err(3);
          for (; bt < dend; ++bt) buf[bt] = dict[shift + bt];
        }
        for (; bt < end; ++bt) buf[bt] = buf[bt - dt];
      }
    }
    st.l = lm, st.p = lpos, st.b = bt, st.f = final;
    if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;
  } while (!final);
  // don't reallocate for streams or user buffers
  return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
};
// empty
var et = /*#__PURE__*/new u8(0);
// read 2 bytes
var b2 = function (d, b) {
  return d[b] | d[b + 1] << 8;
};
// read 4 bytes
var b4 = function (d, b) {
  return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0;
};
var b8 = function (d, b) {
  return b4(d, b) + b4(d, b + 4) * 4294967296;
};
// zlib start
var zls = function (d, dict) {
  if ((d[0] & 15) != 8 || d[0] >> 4 > 7 || (d[0] << 8 | d[1]) % 31) err(6, 'invalid zlib data');
  if ((d[1] >> 5 & 1) == +!dict) err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary');
  return (d[1] >> 3 & 4) + 2;
};
/**
 * Expands DEFLATE data with no wrapper
 * @param data The data to decompress
 * @param opts The decompression options
 * @returns The decompressed version of the data
 */
function inflateSync(data, opts) {
  return inflt(data, {
    i: 2
  }, opts && opts.out, opts && opts.dictionary);
}
/**
 * Expands Zlib data
 * @param data The data to decompress
 * @param opts The decompression options
 * @returns The decompressed version of the data
 */
function unzlibSync(data, opts) {
  return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), {
    i: 2
  }, opts && opts.out, opts && opts.dictionary);
}
// text decoder
var td = typeof TextDecoder != 'undefined' && /*#__PURE__*/new TextDecoder();
// text decoder stream
var tds = 0;
try {
  td.decode(et, {
    stream: true
  });
  tds = 1;
} catch (e) {}
// decode UTF8
var dutf8 = function (d) {
  for (var r = '', i = 0;;) {
    var c = d[i++];
    var eb = (c > 127) + (c > 223) + (c > 239);
    if (i + eb > d.length) return {
      s: r,
      r: slc(d, i - 1)
    };
    if (!eb) r += String.fromCharCode(c);else if (eb == 3) {
      c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | d[i++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
    } else if (eb & 1) r += String.fromCharCode((c & 31) << 6 | d[i++] & 63);else r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | d[i++] & 63);
  }
};
/**
 * Converts a Uint8Array to a string
 * @param dat The data to decode to string
 * @param latin1 Whether or not to interpret the data as Latin-1. This should
 *               not need to be true unless encoding to binary string.
 * @returns The original UTF-8/Latin-1 string
 */
function strFromU8(dat, latin1) {
  if (latin1) {
    var r = '';
    for (var i = 0; i < dat.length; i += 16384) r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));
    return r;
  } else if (td) {
    return td.decode(dat);
  } else {
    var _a = dutf8(dat),
      s = _a.s,
      r = _a.r;
    if (r.length) err(8);
    return s;
  }
}
// skip local zip header
var slzh = function (d, b) {
  return b + 30 + b2(d, b + 26) + b2(d, b + 28);
};
// read zip header
var zh = function (d, b, z) {
  var fnl = b2(d, b + 28),
    fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)),
    es = b + 46 + fnl,
    bs = b4(d, b + 20);
  var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)],
    sc = _a[0],
    su = _a[1],
    off = _a[2];
  return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];
};
// read zip64 extra field
var z64e = function (d, b) {
  for (; b2(d, b) != 1; b += 4 + b2(d, b + 2));
  return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];
};
/**
 * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better
 * performance with more than one file.
 * @param data The raw compressed ZIP file
 * @param opts The ZIP extraction options
 * @returns The decompressed files
 */
function unzipSync(data, opts) {
  var files = {};
  var e = data.length - 22;
  for (; b4(data, e) != 0x6054B50; --e) {
    if (!e || data.length - e > 65558) err(13);
  }
  var c = b2(data, e + 8);
  if (!c) return {};
  var o = b4(data, e + 16);
  var z = o == 4294967295 || c == 65535;
  if (z) {
    var ze = b4(data, e - 12);
    z = b4(data, ze) == 0x6064B50;
    if (z) {
      c = b4(data, ze + 32);
      o = b4(data, ze + 48);
    }
  }
  var fltr = opts && opts.filter;
  for (var i = 0; i < c; ++i) {
    var _a = zh(data, o, z),
      c_2 = _a[0],
      sc = _a[1],
      su = _a[2],
      fn = _a[3],
      no = _a[4],
      off = _a[5],
      b = slzh(data, off);
    o = no;
    if (!fltr || fltr({
      name: fn,
      size: sc,
      originalSize: su,
      compression: c_2
    })) {
      if (!c_2) files[fn] = slc(data, b, b + sc);else if (c_2 == 8) files[fn] = inflateSync(data.subarray(b, b + sc), {
        out: new u8(su)
      });else err(14, 'unknown compression type ' + c_2);
    }
  }
  return files;
}

/**
 * NURBS utils
 *
 * See NURBSCurve and NURBSSurface.
 **/

/**************************************************************
 *	NURBS Utils
 **************************************************************/

/*
Finds knot vector span.

p : degree
u : parametric value
U : knot vector

returns the span
*/
function findSpan(p, u, U) {
  const n = U.length - p - 1;
  if (u >= U[n]) {
    return n - 1;
  }
  if (u <= U[p]) {
    return p;
  }
  let low = p;
  let high = n;
  let mid = Math.floor((low + high) / 2);
  while (u < U[mid] || u >= U[mid + 1]) {
    if (u < U[mid]) {
      high = mid;
    } else {
      low = mid;
    }
    mid = Math.floor((low + high) / 2);
  }
  return mid;
}

/*
Calculate basis functions. See The NURBS Book, page 70, algorithm A2.2

span : span in which u lies
u    : parametric point
p    : degree
U    : knot vector

returns array[p+1] with basis functions values.
*/
function calcBasisFunctions(span, u, p, U) {
  const N = [];
  const left = [];
  const right = [];
  N[0] = 1.0;
  for (let j = 1; j <= p; ++j) {
    left[j] = u - U[span + 1 - j];
    right[j] = U[span + j] - u;
    let saved = 0.0;
    for (let r = 0; r < j; ++r) {
      const rv = right[r + 1];
      const lv = left[j - r];
      const temp = N[r] / (rv + lv);
      N[r] = saved + rv * temp;
      saved = lv * temp;
    }
    N[j] = saved;
  }
  return N;
}

/*
Calculate B-Spline curve points. See The NURBS Book, page 82, algorithm A3.1.

p : degree of B-Spline
U : knot vector
P : control points (x, y, z, w)
u : parametric point

returns point for given u
*/
function calcBSplinePoint(p, U, P, u) {
  const span = findSpan(p, u, U);
  const N = calcBasisFunctions(span, u, p, U);
  const C = new Vector4$1(0, 0, 0, 0);
  for (let j = 0; j <= p; ++j) {
    const point = P[span - p + j];
    const Nj = N[j];
    const wNj = point.w * Nj;
    C.x += point.x * wNj;
    C.y += point.y * wNj;
    C.z += point.z * wNj;
    C.w += point.w * Nj;
  }
  return C;
}

/*
Calculate basis functions derivatives. See The NURBS Book, page 72, algorithm A2.3.

span : span in which u lies
u    : parametric point
p    : degree
n    : number of derivatives to calculate
U    : knot vector

returns array[n+1][p+1] with basis functions derivatives
*/
function calcBasisFunctionDerivatives(span, u, p, n, U) {
  const zeroArr = [];
  for (let i = 0; i <= p; ++i) zeroArr[i] = 0.0;
  const ders = [];
  for (let i = 0; i <= n; ++i) ders[i] = zeroArr.slice(0);
  const ndu = [];
  for (let i = 0; i <= p; ++i) ndu[i] = zeroArr.slice(0);
  ndu[0][0] = 1.0;
  const left = zeroArr.slice(0);
  const right = zeroArr.slice(0);
  for (let j = 1; j <= p; ++j) {
    left[j] = u - U[span + 1 - j];
    right[j] = U[span + j] - u;
    let saved = 0.0;
    for (let r = 0; r < j; ++r) {
      const rv = right[r + 1];
      const lv = left[j - r];
      ndu[j][r] = rv + lv;
      const temp = ndu[r][j - 1] / ndu[j][r];
      ndu[r][j] = saved + rv * temp;
      saved = lv * temp;
    }
    ndu[j][j] = saved;
  }
  for (let j = 0; j <= p; ++j) {
    ders[0][j] = ndu[j][p];
  }
  for (let r = 0; r <= p; ++r) {
    let s1 = 0;
    let s2 = 1;
    const a = [];
    for (let i = 0; i <= p; ++i) {
      a[i] = zeroArr.slice(0);
    }
    a[0][0] = 1.0;
    for (let k = 1; k <= n; ++k) {
      let d = 0.0;
      const rk = r - k;
      const pk = p - k;
      if (r >= k) {
        a[s2][0] = a[s1][0] / ndu[pk + 1][rk];
        d = a[s2][0] * ndu[rk][pk];
      }
      const j1 = rk >= -1 ? 1 : -rk;
      const j2 = r - 1 <= pk ? k - 1 : p - r;
      for (let j = j1; j <= j2; ++j) {
        a[s2][j] = (a[s1][j] - a[s1][j - 1]) / ndu[pk + 1][rk + j];
        d += a[s2][j] * ndu[rk + j][pk];
      }
      if (r <= pk) {
        a[s2][k] = -a[s1][k - 1] / ndu[pk + 1][r];
        d += a[s2][k] * ndu[r][pk];
      }
      ders[k][r] = d;
      const j = s1;
      s1 = s2;
      s2 = j;
    }
  }
  let r = p;
  for (let k = 1; k <= n; ++k) {
    for (let j = 0; j <= p; ++j) {
      ders[k][j] *= r;
    }
    r *= p - k;
  }
  return ders;
}

/*
	Calculate derivatives of a B-Spline. See The NURBS Book, page 93, algorithm A3.2.

	p  : degree
	U  : knot vector
	P  : control points
	u  : Parametric points
	nd : number of derivatives

	returns array[d+1] with derivatives
	*/
function calcBSplineDerivatives(p, U, P, u, nd) {
  const du = nd < p ? nd : p;
  const CK = [];
  const span = findSpan(p, u, U);
  const nders = calcBasisFunctionDerivatives(span, u, p, du, U);
  const Pw = [];
  for (let i = 0; i < P.length; ++i) {
    const point = P[i].clone();
    const w = point.w;
    point.x *= w;
    point.y *= w;
    point.z *= w;
    Pw[i] = point;
  }
  for (let k = 0; k <= du; ++k) {
    const point = Pw[span - p].clone().multiplyScalar(nders[k][0]);
    for (let j = 1; j <= p; ++j) {
      point.add(Pw[span - p + j].clone().multiplyScalar(nders[k][j]));
    }
    CK[k] = point;
  }
  for (let k = du + 1; k <= nd + 1; ++k) {
    CK[k] = new Vector4$1(0, 0, 0);
  }
  return CK;
}

/*
Calculate "K over I"

returns k!/(i!(k-i)!)
*/
function calcKoverI(k, i) {
  let nom = 1;
  for (let j = 2; j <= k; ++j) {
    nom *= j;
  }
  let denom = 1;
  for (let j = 2; j <= i; ++j) {
    denom *= j;
  }
  for (let j = 2; j <= k - i; ++j) {
    denom *= j;
  }
  return nom / denom;
}

/*
Calculate derivatives (0-nd) of rational curve. See The NURBS Book, page 127, algorithm A4.2.

Pders : result of function calcBSplineDerivatives

returns array with derivatives for rational curve.
*/
function calcRationalCurveDerivatives(Pders) {
  const nd = Pders.length;
  const Aders = [];
  const wders = [];
  for (let i = 0; i < nd; ++i) {
    const point = Pders[i];
    Aders[i] = new Vector3$1(point.x, point.y, point.z);
    wders[i] = point.w;
  }
  const CK = [];
  for (let k = 0; k < nd; ++k) {
    const v = Aders[k].clone();
    for (let i = 1; i <= k; ++i) {
      v.sub(CK[k - i].clone().multiplyScalar(calcKoverI(k, i) * wders[i]));
    }
    CK[k] = v.divideScalar(wders[0]);
  }
  return CK;
}

/*
Calculate NURBS curve derivatives. See The NURBS Book, page 127, algorithm A4.2.

p  : degree
U  : knot vector
P  : control points in homogeneous space
u  : parametric points
nd : number of derivatives

returns array with derivatives.
*/
function calcNURBSDerivatives(p, U, P, u, nd) {
  const Pders = calcBSplineDerivatives(p, U, P, u, nd);
  return calcRationalCurveDerivatives(Pders);
}

/**
 * NURBS curve object
 *
 * Derives from Curve, overriding getPoint and getTangent.
 *
 * Implementation is based on (x, y [, z=0 [, w=1]]) control points with w=weight.
 *
 **/

class NURBSCurve extends Curve {
  constructor(degree, knots /* array of reals */, controlPoints /* array of Vector(2|3|4) */, startKnot /* index in knots */, endKnot /* index in knots */) {
    super();
    this.degree = degree;
    this.knots = knots;
    this.controlPoints = [];
    // Used by periodic NURBS to remove hidden spans
    this.startKnot = startKnot || 0;
    this.endKnot = endKnot || this.knots.length - 1;
    for (let i = 0; i < controlPoints.length; ++i) {
      // ensure Vector4 for control points
      const point = controlPoints[i];
      this.controlPoints[i] = new Vector4$1(point.x, point.y, point.z, point.w);
    }
  }
  getPoint(t, optionalTarget = new Vector3$1()) {
    const point = optionalTarget;
    const u = this.knots[this.startKnot] + t * (this.knots[this.endKnot] - this.knots[this.startKnot]); // linear mapping t->u

    // following results in (wx, wy, wz, w) homogeneous point
    const hpoint = calcBSplinePoint(this.degree, this.knots, this.controlPoints, u);
    if (hpoint.w !== 1.0) {
      // project to 3D space: (wx, wy, wz, w) -> (x, y, z, 1)
      hpoint.divideScalar(hpoint.w);
    }
    return point.set(hpoint.x, hpoint.y, hpoint.z);
  }
  getTangent(t, optionalTarget = new Vector3$1()) {
    const tangent = optionalTarget;
    const u = this.knots[0] + t * (this.knots[this.knots.length - 1] - this.knots[0]);
    const ders = calcNURBSDerivatives(this.degree, this.knots, this.controlPoints, u, 1);
    tangent.copy(ders[1]).normalize();
    return tangent;
  }
}

/**
 * Loader loads FBX file and generates Group representing FBX scene.
 * Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format
 * Versions lower than this may load but will probably have errors
 *
 * Needs Support:
 *  Morph normals / blend shape normals
 *
 * FBX format references:
 * 	https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html (C++ SDK reference)
 *
 * Binary format specification:
 *	https://code.blender.org/2013/08/fbx-binary-file-format-specification/
 */

let fbxTree;
let connections;
let sceneGraph;
class FBXLoader extends Loader {
  constructor(manager) {
    super(manager);
  }
  load(url, onLoad, onProgress, onError) {
    const scope = this;
    const path = scope.path === '' ? LoaderUtils.extractUrlBase(url) : scope.path;
    const loader = new FileLoader(this.manager);
    loader.setPath(scope.path);
    loader.setResponseType('arraybuffer');
    loader.setRequestHeader(scope.requestHeader);
    loader.setWithCredentials(scope.withCredentials);
    loader.load(url, function (buffer) {
      try {
        onLoad(scope.parse(buffer, path));
      } catch (e) {
        if (onError) {
          onError(e);
        } else {
          console.error(e);
        }
        scope.manager.itemError(url);
      }
    }, onProgress, onError);
  }
  parse(FBXBuffer, path) {
    if (isFbxFormatBinary(FBXBuffer)) {
      fbxTree = new BinaryParser().parse(FBXBuffer);
    } else {
      const FBXText = convertArrayBufferToString(FBXBuffer);
      if (!isFbxFormatASCII(FBXText)) {
        throw new Error('THREE.FBXLoader: Unknown format.');
      }
      if (getFbxVersion(FBXText) < 7000) {
        throw new Error('THREE.FBXLoader: FBX version not supported, FileVersion: ' + getFbxVersion(FBXText));
      }
      fbxTree = new TextParser().parse(FBXText);
    }

    // console.log( fbxTree );

    const textureLoader = new TextureLoader(this.manager).setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin);
    return new FBXTreeParser(textureLoader, this.manager).parse(fbxTree);
  }
}

// Parse the FBXTree object returned by the BinaryParser or TextParser and return a Group
class FBXTreeParser {
  constructor(textureLoader, manager) {
    this.textureLoader = textureLoader;
    this.manager = manager;
  }
  parse() {
    connections = this.parseConnections();
    const images = this.parseImages();
    const textures = this.parseTextures(images);
    const materials = this.parseMaterials(textures);
    const deformers = this.parseDeformers();
    const geometryMap = new GeometryParser().parse(deformers);
    this.parseScene(deformers, geometryMap, materials);
    return sceneGraph;
  }

  // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
  // and details the connection type
  parseConnections() {
    const connectionMap = new Map();
    if ('Connections' in fbxTree) {
      const rawConnections = fbxTree.Connections.connections;
      rawConnections.forEach(function (rawConnection) {
        const fromID = rawConnection[0];
        const toID = rawConnection[1];
        const relationship = rawConnection[2];
        if (!connectionMap.has(fromID)) {
          connectionMap.set(fromID, {
            parents: [],
            children: []
          });
        }
        const parentRelationship = {
          ID: toID,
          relationship: relationship
        };
        connectionMap.get(fromID).parents.push(parentRelationship);
        if (!connectionMap.has(toID)) {
          connectionMap.set(toID, {
            parents: [],
            children: []
          });
        }
        const childRelationship = {
          ID: fromID,
          relationship: relationship
        };
        connectionMap.get(toID).children.push(childRelationship);
      });
    }
    return connectionMap;
  }

  // Parse FBXTree.Objects.Video for embedded image data
  // These images are connected to textures in FBXTree.Objects.Textures
  // via FBXTree.Connections.
  parseImages() {
    const images = {};
    const blobs = {};
    if ('Video' in fbxTree.Objects) {
      const videoNodes = fbxTree.Objects.Video;
      for (const nodeID in videoNodes) {
        const videoNode = videoNodes[nodeID];
        const id = parseInt(nodeID);
        images[id] = videoNode.RelativeFilename || videoNode.Filename;

        // raw image data is in videoNode.Content
        if ('Content' in videoNode) {
          const arrayBufferContent = videoNode.Content instanceof ArrayBuffer && videoNode.Content.byteLength > 0;
          const base64Content = typeof videoNode.Content === 'string' && videoNode.Content !== '';
          if (arrayBufferContent || base64Content) {
            const image = this.parseImage(videoNodes[nodeID]);
            blobs[videoNode.RelativeFilename || videoNode.Filename] = image;
          }
        }
      }
    }
    for (const id in images) {
      const filename = images[id];
      if (blobs[filename] !== undefined) images[id] = blobs[filename];else images[id] = images[id].split('\\').pop();
    }
    return images;
  }

  // Parse embedded image data in FBXTree.Video.Content
  parseImage(videoNode) {
    const content = videoNode.Content;
    const fileName = videoNode.RelativeFilename || videoNode.Filename;
    const extension = fileName.slice(fileName.lastIndexOf('.') + 1).toLowerCase();
    let type;
    switch (extension) {
      case 'bmp':
        type = 'image/bmp';
        break;
      case 'jpg':
      case 'jpeg':
        type = 'image/jpeg';
        break;
      case 'png':
        type = 'image/png';
        break;
      case 'tif':
        type = 'image/tiff';
        break;
      case 'tga':
        if (this.manager.getHandler('.tga') === null) {
          console.warn('FBXLoader: TGA loader not found, skipping ', fileName);
        }
        type = 'image/tga';
        break;
      default:
        console.warn('FBXLoader: Image type "' + extension + '" is not supported.');
        return;
    }
    if (typeof content === 'string') {
      // ASCII format

      return 'data:' + type + ';base64,' + content;
    } else {
      // Binary Format

      const array = new Uint8Array(content);
      return window.URL.createObjectURL(new Blob([array], {
        type: type
      }));
    }
  }

  // Parse nodes in FBXTree.Objects.Texture
  // These contain details such as UV scaling, cropping, rotation etc and are connected
  // to images in FBXTree.Objects.Video
  parseTextures(images) {
    const textureMap = new Map();
    if ('Texture' in fbxTree.Objects) {
      const textureNodes = fbxTree.Objects.Texture;
      for (const nodeID in textureNodes) {
        const texture = this.parseTexture(textureNodes[nodeID], images);
        textureMap.set(parseInt(nodeID), texture);
      }
    }
    return textureMap;
  }

  // Parse individual node in FBXTree.Objects.Texture
  parseTexture(textureNode, images) {
    const texture = this.loadTexture(textureNode, images);
    texture.ID = textureNode.id;
    texture.name = textureNode.attrName;
    const wrapModeU = textureNode.WrapModeU;
    const wrapModeV = textureNode.WrapModeV;
    const valueU = wrapModeU !== undefined ? wrapModeU.value : 0;
    const valueV = wrapModeV !== undefined ? wrapModeV.value : 0;

    // http://download.autodesk.com/us/fbx/SDKdocs/FBX_SDK_Help/files/fbxsdkref/class_k_fbx_texture.html#889640e63e2e681259ea81061b85143a
    // 0: repeat(default), 1: clamp

    texture.wrapS = valueU === 0 ? RepeatWrapping$1 : ClampToEdgeWrapping$1;
    texture.wrapT = valueV === 0 ? RepeatWrapping$1 : ClampToEdgeWrapping$1;
    if ('Scaling' in textureNode) {
      const values = textureNode.Scaling.value;
      texture.repeat.x = values[0];
      texture.repeat.y = values[1];
    }
    if ('Translation' in textureNode) {
      const values = textureNode.Translation.value;
      texture.offset.x = values[0];
      texture.offset.y = values[1];
    }
    return texture;
  }

  // load a texture specified as a blob or data URI, or via an external URL using TextureLoader
  loadTexture(textureNode, images) {
    const nonNativeExtensions = new Set(['tga', 'tif', 'tiff', 'exr', 'dds', 'hdr', 'ktx2']);
    const extension = textureNode.FileName.split('.').pop().toLowerCase();
    const loader = nonNativeExtensions.has(extension) ? this.manager.getHandler(`.${extension}`) : this.textureLoader;
    if (!loader) {
      console.warn(`FBXLoader: ${extension.toUpperCase()} loader not found, creating placeholder texture for`, textureNode.RelativeFilename);
      return new Texture$1();
    }
    const loaderPath = loader.path;
    if (!loaderPath) {
      loader.setPath(this.textureLoader.path);
    }
    const children = connections.get(textureNode.id).children;
    let fileName;
    if (children !== undefined && children.length > 0 && images[children[0].ID] !== undefined) {
      fileName = images[children[0].ID];
      if (fileName.indexOf('blob:') === 0 || fileName.indexOf('data:') === 0) {
        loader.setPath(undefined);
      }
    }
    const texture = loader.load(fileName);

    // revert to initial path
    loader.setPath(loaderPath);
    return texture;
  }

  // Parse nodes in FBXTree.Objects.Material
  parseMaterials(textureMap) {
    const materialMap = new Map();
    if ('Material' in fbxTree.Objects) {
      const materialNodes = fbxTree.Objects.Material;
      for (const nodeID in materialNodes) {
        const material = this.parseMaterial(materialNodes[nodeID], textureMap);
        if (material !== null) materialMap.set(parseInt(nodeID), material);
      }
    }
    return materialMap;
  }

  // Parse single node in FBXTree.Objects.Material
  // Materials are connected to texture maps in FBXTree.Objects.Textures
  // FBX format currently only supports Lambert and Phong shading models
  parseMaterial(materialNode, textureMap) {
    const ID = materialNode.id;
    const name = materialNode.attrName;
    let type = materialNode.ShadingModel;

    // Case where FBX wraps shading model in property object.
    if (typeof type === 'object') {
      type = type.value;
    }

    // Ignore unused materials which don't have any connections.
    if (!connections.has(ID)) return null;
    const parameters = this.parseParameters(materialNode, textureMap, ID);
    let material;
    switch (type.toLowerCase()) {
      case 'phong':
        material = new MeshPhongMaterial();
        break;
      case 'lambert':
        material = new MeshLambertMaterial();
        break;
      default:
        console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', type);
        material = new MeshPhongMaterial();
        break;
    }
    material.setValues(parameters);
    material.name = name;
    return material;
  }

  // Parse FBX material and return parameters suitable for a three.js material
  // Also parse the texture map and return any textures associated with the material
  parseParameters(materialNode, textureMap, ID) {
    const parameters = {};
    if (materialNode.BumpFactor) {
      parameters.bumpScale = materialNode.BumpFactor.value;
    }
    if (materialNode.Diffuse) {
      parameters.color = new Color$1().fromArray(materialNode.Diffuse.value).convertSRGBToLinear();
    } else if (materialNode.DiffuseColor && (materialNode.DiffuseColor.type === 'Color' || materialNode.DiffuseColor.type === 'ColorRGB')) {
      // The blender exporter exports diffuse here instead of in materialNode.Diffuse
      parameters.color = new Color$1().fromArray(materialNode.DiffuseColor.value).convertSRGBToLinear();
    }
    if (materialNode.DisplacementFactor) {
      parameters.displacementScale = materialNode.DisplacementFactor.value;
    }
    if (materialNode.Emissive) {
      parameters.emissive = new Color$1().fromArray(materialNode.Emissive.value).convertSRGBToLinear();
    } else if (materialNode.EmissiveColor && (materialNode.EmissiveColor.type === 'Color' || materialNode.EmissiveColor.type === 'ColorRGB')) {
      // The blender exporter exports emissive color here instead of in materialNode.Emissive
      parameters.emissive = new Color$1().fromArray(materialNode.EmissiveColor.value).convertSRGBToLinear();
    }
    if (materialNode.EmissiveFactor) {
      parameters.emissiveIntensity = parseFloat(materialNode.EmissiveFactor.value);
    }
    if (materialNode.Opacity) {
      parameters.opacity = parseFloat(materialNode.Opacity.value);
    }
    if (parameters.opacity < 1.0) {
      parameters.transparent = true;
    }
    if (materialNode.ReflectionFactor) {
      parameters.reflectivity = materialNode.ReflectionFactor.value;
    }
    if (materialNode.Shininess) {
      parameters.shininess = materialNode.Shininess.value;
    }
    if (materialNode.Specular) {
      parameters.specular = new Color$1().fromArray(materialNode.Specular.value).convertSRGBToLinear();
    } else if (materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color') {
      // The blender exporter exports specular color here instead of in materialNode.Specular
      parameters.specular = new Color$1().fromArray(materialNode.SpecularColor.value).convertSRGBToLinear();
    }
    const scope = this;
    connections.get(ID).children.forEach(function (child) {
      const type = child.relationship;
      switch (type) {
        case 'Bump':
          parameters.bumpMap = scope.getTexture(textureMap, child.ID);
          break;
        case 'Maya|TEX_ao_map':
          parameters.aoMap = scope.getTexture(textureMap, child.ID);
          break;
        case 'DiffuseColor':
        case 'Maya|TEX_color_map':
          parameters.map = scope.getTexture(textureMap, child.ID);
          if (parameters.map !== undefined) {
            parameters.map.colorSpace = SRGBColorSpace$1;
          }
          break;
        case 'DisplacementColor':
          parameters.displacementMap = scope.getTexture(textureMap, child.ID);
          break;
        case 'EmissiveColor':
          parameters.emissiveMap = scope.getTexture(textureMap, child.ID);
          if (parameters.emissiveMap !== undefined) {
            parameters.emissiveMap.colorSpace = SRGBColorSpace$1;
          }
          break;
        case 'NormalMap':
        case 'Maya|TEX_normal_map':
          parameters.normalMap = scope.getTexture(textureMap, child.ID);
          break;
        case 'ReflectionColor':
          parameters.envMap = scope.getTexture(textureMap, child.ID);
          if (parameters.envMap !== undefined) {
            parameters.envMap.mapping = EquirectangularReflectionMapping;
            parameters.envMap.colorSpace = SRGBColorSpace$1;
          }
          break;
        case 'SpecularColor':
          parameters.specularMap = scope.getTexture(textureMap, child.ID);
          if (parameters.specularMap !== undefined) {
            parameters.specularMap.colorSpace = SRGBColorSpace$1;
          }
          break;
        case 'TransparentColor':
        case 'TransparencyFactor':
          parameters.alphaMap = scope.getTexture(textureMap, child.ID);
          parameters.transparent = true;
          break;
        case 'AmbientColor':
        case 'ShininessExponent': // AKA glossiness map
        case 'SpecularFactor': // AKA specularLevel
        case 'VectorDisplacementColor': // NOTE: Seems to be a copy of DisplacementColor
        default:
          console.warn('THREE.FBXLoader: %s map is not supported in three.js, skipping texture.', type);
          break;
      }
    });
    return parameters;
  }

  // get a texture from the textureMap for use by a material.
  getTexture(textureMap, id) {
    // if the texture is a layered texture, just use the first layer and issue a warning
    if ('LayeredTexture' in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture) {
      console.warn('THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.');
      id = connections.get(id).children[0].ID;
    }
    return textureMap.get(id);
  }

  // Parse nodes in FBXTree.Objects.Deformer
  // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
  // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
  parseDeformers() {
    const skeletons = {};
    const morphTargets = {};
    if ('Deformer' in fbxTree.Objects) {
      const DeformerNodes = fbxTree.Objects.Deformer;
      for (const nodeID in DeformerNodes) {
        const deformerNode = DeformerNodes[nodeID];
        const relationships = connections.get(parseInt(nodeID));
        if (deformerNode.attrType === 'Skin') {
          const skeleton = this.parseSkeleton(relationships, DeformerNodes);
          skeleton.ID = nodeID;
          if (relationships.parents.length > 1) console.warn('THREE.FBXLoader: skeleton attached to more than one geometry is not supported.');
          skeleton.geometryID = relationships.parents[0].ID;
          skeletons[nodeID] = skeleton;
        } else if (deformerNode.attrType === 'BlendShape') {
          const morphTarget = {
            id: nodeID
          };
          morphTarget.rawTargets = this.parseMorphTargets(relationships, DeformerNodes);
          morphTarget.id = nodeID;
          if (relationships.parents.length > 1) console.warn('THREE.FBXLoader: morph target attached to more than one geometry is not supported.');
          morphTargets[nodeID] = morphTarget;
        }
      }
    }
    return {
      skeletons: skeletons,
      morphTargets: morphTargets
    };
  }

  // Parse single nodes in FBXTree.Objects.Deformer
  // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'
  // Each skin node represents a skeleton and each cluster node represents a bone
  parseSkeleton(relationships, deformerNodes) {
    const rawBones = [];
    relationships.children.forEach(function (child) {
      const boneNode = deformerNodes[child.ID];
      if (boneNode.attrType !== 'Cluster') return;
      const rawBone = {
        ID: child.ID,
        indices: [],
        weights: [],
        transformLink: new Matrix4$1().fromArray(boneNode.TransformLink.a)
        // transform: new Matrix4().fromArray( boneNode.Transform.a ),
        // linkMode: boneNode.Mode,
      };
      if ('Indexes' in boneNode) {
        rawBone.indices = boneNode.Indexes.a;
        rawBone.weights = boneNode.Weights.a;
      }
      rawBones.push(rawBone);
    });
    return {
      rawBones: rawBones,
      bones: []
    };
  }

  // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
  parseMorphTargets(relationships, deformerNodes) {
    const rawMorphTargets = [];
    for (let i = 0; i < relationships.children.length; i++) {
      const child = relationships.children[i];
      const morphTargetNode = deformerNodes[child.ID];
      const rawMorphTarget = {
        name: morphTargetNode.attrName,
        initialWeight: morphTargetNode.DeformPercent,
        id: morphTargetNode.id,
        fullWeights: morphTargetNode.FullWeights.a
      };
      if (morphTargetNode.attrType !== 'BlendShapeChannel') return;
      rawMorphTarget.geoID = connections.get(parseInt(child.ID)).children.filter(function (child) {
        return child.relationship === undefined;
      })[0].ID;
      rawMorphTargets.push(rawMorphTarget);
    }
    return rawMorphTargets;
  }

  // create the main Group() to be returned by the loader
  parseScene(deformers, geometryMap, materialMap) {
    sceneGraph = new Group();
    const modelMap = this.parseModels(deformers.skeletons, geometryMap, materialMap);
    const modelNodes = fbxTree.Objects.Model;
    const scope = this;
    modelMap.forEach(function (model) {
      const modelNode = modelNodes[model.ID];
      scope.setLookAtProperties(model, modelNode);
      const parentConnections = connections.get(model.ID).parents;
      parentConnections.forEach(function (connection) {
        const parent = modelMap.get(connection.ID);
        if (parent !== undefined) parent.add(model);
      });
      if (model.parent === null) {
        sceneGraph.add(model);
      }
    });
    this.bindSkeleton(deformers.skeletons, geometryMap, modelMap);
    this.addGlobalSceneSettings();
    sceneGraph.traverse(function (node) {
      if (node.userData.transformData) {
        if (node.parent) {
          node.userData.transformData.parentMatrix = node.parent.matrix;
          node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld;
        }
        const transform = generateTransform(node.userData.transformData);
        node.applyMatrix4(transform);
        node.updateWorldMatrix();
      }
    });
    const animations = new AnimationParser().parse();

    // if all the models where already combined in a single group, just return that
    if (sceneGraph.children.length === 1 && sceneGraph.children[0].isGroup) {
      sceneGraph.children[0].animations = animations;
      sceneGraph = sceneGraph.children[0];
    }
    sceneGraph.animations = animations;
  }

  // parse nodes in FBXTree.Objects.Model
  parseModels(skeletons, geometryMap, materialMap) {
    const modelMap = new Map();
    const modelNodes = fbxTree.Objects.Model;
    for (const nodeID in modelNodes) {
      const id = parseInt(nodeID);
      const node = modelNodes[nodeID];
      const relationships = connections.get(id);
      let model = this.buildSkeleton(relationships, skeletons, id, node.attrName);
      if (!model) {
        switch (node.attrType) {
          case 'Camera':
            model = this.createCamera(relationships);
            break;
          case 'Light':
            model = this.createLight(relationships);
            break;
          case 'Mesh':
            model = this.createMesh(relationships, geometryMap, materialMap);
            break;
          case 'NurbsCurve':
            model = this.createCurve(relationships, geometryMap);
            break;
          case 'LimbNode':
          case 'Root':
            model = new Bone();
            break;
          case 'Null':
          default:
            model = new Group();
            break;
        }
        model.name = node.attrName ? PropertyBinding.sanitizeNodeName(node.attrName) : '';
        model.userData.originalName = node.attrName;
        model.ID = id;
      }
      this.getTransformData(model, node);
      modelMap.set(id, model);
    }
    return modelMap;
  }
  buildSkeleton(relationships, skeletons, id, name) {
    let bone = null;
    relationships.parents.forEach(function (parent) {
      for (const ID in skeletons) {
        const skeleton = skeletons[ID];
        skeleton.rawBones.forEach(function (rawBone, i) {
          if (rawBone.ID === parent.ID) {
            const subBone = bone;
            bone = new Bone();
            bone.matrixWorld.copy(rawBone.transformLink);

            // set name and id here - otherwise in cases where "subBone" is created it will not have a name / id

            bone.name = name ? PropertyBinding.sanitizeNodeName(name) : '';
            bone.userData.originalName = name;
            bone.ID = id;
            skeleton.bones[i] = bone;

            // In cases where a bone is shared between multiple meshes
            // duplicate the bone here and and it as a child of the first bone
            if (subBone !== null) {
              bone.add(subBone);
            }
          }
        });
      }
    });
    return bone;
  }

  // create a PerspectiveCamera or OrthographicCamera
  createCamera(relationships) {
    let model;
    let cameraAttribute;
    relationships.children.forEach(function (child) {
      const attr = fbxTree.Objects.NodeAttribute[child.ID];
      if (attr !== undefined) {
        cameraAttribute = attr;
      }
    });
    if (cameraAttribute === undefined) {
      model = new Object3D$1();
    } else {
      let type = 0;
      if (cameraAttribute.CameraProjectionType !== undefined && cameraAttribute.CameraProjectionType.value === 1) {
        type = 1;
      }
      let nearClippingPlane = 1;
      if (cameraAttribute.NearPlane !== undefined) {
        nearClippingPlane = cameraAttribute.NearPlane.value / 1000;
      }
      let farClippingPlane = 1000;
      if (cameraAttribute.FarPlane !== undefined) {
        farClippingPlane = cameraAttribute.FarPlane.value / 1000;
      }
      let width = window.innerWidth;
      let height = window.innerHeight;
      if (cameraAttribute.AspectWidth !== undefined && cameraAttribute.AspectHeight !== undefined) {
        width = cameraAttribute.AspectWidth.value;
        height = cameraAttribute.AspectHeight.value;
      }
      const aspect = width / height;
      let fov = 45;
      if (cameraAttribute.FieldOfView !== undefined) {
        fov = cameraAttribute.FieldOfView.value;
      }
      const focalLength = cameraAttribute.FocalLength ? cameraAttribute.FocalLength.value : null;
      switch (type) {
        case 0:
          // Perspective
          model = new PerspectiveCamera$1(fov, aspect, nearClippingPlane, farClippingPlane);
          if (focalLength !== null) model.setFocalLength(focalLength);
          break;
        case 1:
          // Orthographic
          model = new OrthographicCamera$1(-width / 2, width / 2, height / 2, -height / 2, nearClippingPlane, farClippingPlane);
          break;
        default:
          console.warn('THREE.FBXLoader: Unknown camera type ' + type + '.');
          model = new Object3D$1();
          break;
      }
    }
    return model;
  }

  // Create a DirectionalLight, PointLight or SpotLight
  createLight(relationships) {
    let model;
    let lightAttribute;
    relationships.children.forEach(function (child) {
      const attr = fbxTree.Objects.NodeAttribute[child.ID];
      if (attr !== undefined) {
        lightAttribute = attr;
      }
    });
    if (lightAttribute === undefined) {
      model = new Object3D$1();
    } else {
      let type;

      // LightType can be undefined for Point lights
      if (lightAttribute.LightType === undefined) {
        type = 0;
      } else {
        type = lightAttribute.LightType.value;
      }
      let color = 0xffffff;
      if (lightAttribute.Color !== undefined) {
        color = new Color$1().fromArray(lightAttribute.Color.value).convertSRGBToLinear();
      }
      let intensity = lightAttribute.Intensity === undefined ? 1 : lightAttribute.Intensity.value / 100;

      // light disabled
      if (lightAttribute.CastLightOnObject !== undefined && lightAttribute.CastLightOnObject.value === 0) {
        intensity = 0;
      }
      let distance = 0;
      if (lightAttribute.FarAttenuationEnd !== undefined) {
        if (lightAttribute.EnableFarAttenuation !== undefined && lightAttribute.EnableFarAttenuation.value === 0) {
          distance = 0;
        } else {
          distance = lightAttribute.FarAttenuationEnd.value;
        }
      }

      // TODO: could this be calculated linearly from FarAttenuationStart to FarAttenuationEnd?
      const decay = 1;
      switch (type) {
        case 0:
          // Point
          model = new PointLight(color, intensity, distance, decay);
          break;
        case 1:
          // Directional
          model = new DirectionalLight(color, intensity);
          break;
        case 2:
          // Spot
          let angle = Math.PI / 3;
          if (lightAttribute.InnerAngle !== undefined) {
            angle = MathUtils$1.degToRad(lightAttribute.InnerAngle.value);
          }
          let penumbra = 0;
          if (lightAttribute.OuterAngle !== undefined) {
            // TODO: this is not correct - FBX calculates outer and inner angle in degrees
            // with OuterAngle > InnerAngle && OuterAngle <= Math.PI
            // while three.js uses a penumbra between (0, 1) to attenuate the inner angle
            penumbra = MathUtils$1.degToRad(lightAttribute.OuterAngle.value);
            penumbra = Math.max(penumbra, 1);
          }
          model = new SpotLight(color, intensity, distance, angle, penumbra, decay);
          break;
        default:
          console.warn('THREE.FBXLoader: Unknown light type ' + lightAttribute.LightType.value + ', defaulting to a PointLight.');
          model = new PointLight(color, intensity);
          break;
      }
      if (lightAttribute.CastShadows !== undefined && lightAttribute.CastShadows.value === 1) {
        model.castShadow = true;
      }
    }
    return model;
  }
  createMesh(relationships, geometryMap, materialMap) {
    let model;
    let geometry = null;
    let material = null;
    const materials = [];

    // get geometry and materials(s) from connections
    relationships.children.forEach(function (child) {
      if (geometryMap.has(child.ID)) {
        geometry = geometryMap.get(child.ID);
      }
      if (materialMap.has(child.ID)) {
        materials.push(materialMap.get(child.ID));
      }
    });
    if (materials.length > 1) {
      material = materials;
    } else if (materials.length > 0) {
      material = materials[0];
    } else {
      material = new MeshPhongMaterial({
        name: Loader.DEFAULT_MATERIAL_NAME,
        color: 0xcccccc
      });
      materials.push(material);
    }
    if ('color' in geometry.attributes) {
      materials.forEach(function (material) {
        material.vertexColors = true;
      });
    }
    if (geometry.FBX_Deformer) {
      model = new SkinnedMesh(geometry, material);
      model.normalizeSkinWeights();
    } else {
      model = new Mesh$1(geometry, material);
    }
    return model;
  }
  createCurve(relationships, geometryMap) {
    const geometry = relationships.children.reduce(function (geo, child) {
      if (geometryMap.has(child.ID)) geo = geometryMap.get(child.ID);
      return geo;
    }, null);

    // FBX does not list materials for Nurbs lines, so we'll just put our own in here.
    const material = new LineBasicMaterial({
      name: Loader.DEFAULT_MATERIAL_NAME,
      color: 0x3300ff,
      linewidth: 1
    });
    return new Line(geometry, material);
  }

  // parse the model node for transform data
  getTransformData(model, modelNode) {
    const transformData = {};
    if ('InheritType' in modelNode) transformData.inheritType = parseInt(modelNode.InheritType.value);
    if ('RotationOrder' in modelNode) transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value);else transformData.eulerOrder = 'ZYX';
    if ('Lcl_Translation' in modelNode) transformData.translation = modelNode.Lcl_Translation.value;
    if ('PreRotation' in modelNode) transformData.preRotation = modelNode.PreRotation.value;
    if ('Lcl_Rotation' in modelNode) transformData.rotation = modelNode.Lcl_Rotation.value;
    if ('PostRotation' in modelNode) transformData.postRotation = modelNode.PostRotation.value;
    if ('Lcl_Scaling' in modelNode) transformData.scale = modelNode.Lcl_Scaling.value;
    if ('ScalingOffset' in modelNode) transformData.scalingOffset = modelNode.ScalingOffset.value;
    if ('ScalingPivot' in modelNode) transformData.scalingPivot = modelNode.ScalingPivot.value;
    if ('RotationOffset' in modelNode) transformData.rotationOffset = modelNode.RotationOffset.value;
    if ('RotationPivot' in modelNode) transformData.rotationPivot = modelNode.RotationPivot.value;
    model.userData.transformData = transformData;
  }
  setLookAtProperties(model, modelNode) {
    if ('LookAtProperty' in modelNode) {
      const children = connections.get(model.ID).children;
      children.forEach(function (child) {
        if (child.relationship === 'LookAtProperty') {
          const lookAtTarget = fbxTree.Objects.Model[child.ID];
          if ('Lcl_Translation' in lookAtTarget) {
            const pos = lookAtTarget.Lcl_Translation.value;

            // DirectionalLight, SpotLight
            if (model.target !== undefined) {
              model.target.position.fromArray(pos);
              sceneGraph.add(model.target);
            } else {
              // Cameras and other Object3Ds

              model.lookAt(new Vector3$1().fromArray(pos));
            }
          }
        }
      });
    }
  }
  bindSkeleton(skeletons, geometryMap, modelMap) {
    const bindMatrices = this.parsePoseNodes();
    for (const ID in skeletons) {
      const skeleton = skeletons[ID];
      const parents = connections.get(parseInt(skeleton.ID)).parents;
      parents.forEach(function (parent) {
        if (geometryMap.has(parent.ID)) {
          const geoID = parent.ID;
          const geoRelationships = connections.get(geoID);
          geoRelationships.parents.forEach(function (geoConnParent) {
            if (modelMap.has(geoConnParent.ID)) {
              const model = modelMap.get(geoConnParent.ID);
              model.bind(new Skeleton(skeleton.bones), bindMatrices[geoConnParent.ID]);
            }
          });
        }
      });
    }
  }
  parsePoseNodes() {
    const bindMatrices = {};
    if ('Pose' in fbxTree.Objects) {
      const BindPoseNode = fbxTree.Objects.Pose;
      for (const nodeID in BindPoseNode) {
        if (BindPoseNode[nodeID].attrType === 'BindPose' && BindPoseNode[nodeID].NbPoseNodes > 0) {
          const poseNodes = BindPoseNode[nodeID].PoseNode;
          if (Array.isArray(poseNodes)) {
            poseNodes.forEach(function (poseNode) {
              bindMatrices[poseNode.Node] = new Matrix4$1().fromArray(poseNode.Matrix.a);
            });
          } else {
            bindMatrices[poseNodes.Node] = new Matrix4$1().fromArray(poseNodes.Matrix.a);
          }
        }
      }
    }
    return bindMatrices;
  }
  addGlobalSceneSettings() {
    if ('GlobalSettings' in fbxTree) {
      if ('AmbientColor' in fbxTree.GlobalSettings) {
        // Parse ambient color - if it's not set to black (default), create an ambient light

        const ambientColor = fbxTree.GlobalSettings.AmbientColor.value;
        const r = ambientColor[0];
        const g = ambientColor[1];
        const b = ambientColor[2];
        if (r !== 0 || g !== 0 || b !== 0) {
          const color = new Color$1(r, g, b).convertSRGBToLinear();
          sceneGraph.add(new AmbientLight(color, 1));
        }
      }
      if ('UnitScaleFactor' in fbxTree.GlobalSettings) {
        sceneGraph.userData.unitScaleFactor = fbxTree.GlobalSettings.UnitScaleFactor.value;
      }
    }
  }
}

// parse Geometry data from FBXTree and return map of BufferGeometries
class GeometryParser {
  constructor() {
    this.negativeMaterialIndices = false;
  }

  // Parse nodes in FBXTree.Objects.Geometry
  parse(deformers) {
    const geometryMap = new Map();
    if ('Geometry' in fbxTree.Objects) {
      const geoNodes = fbxTree.Objects.Geometry;
      for (const nodeID in geoNodes) {
        const relationships = connections.get(parseInt(nodeID));
        const geo = this.parseGeometry(relationships, geoNodes[nodeID], deformers);
        geometryMap.set(parseInt(nodeID), geo);
      }
    }

    // report warnings

    if (this.negativeMaterialIndices === true) {
      console.warn('THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.');
    }
    return geometryMap;
  }

  // Parse single node in FBXTree.Objects.Geometry
  parseGeometry(relationships, geoNode, deformers) {
    switch (geoNode.attrType) {
      case 'Mesh':
        return this.parseMeshGeometry(relationships, geoNode, deformers);
      case 'NurbsCurve':
        return this.parseNurbsGeometry(geoNode);
    }
  }

  // Parse single node mesh geometry in FBXTree.Objects.Geometry
  parseMeshGeometry(relationships, geoNode, deformers) {
    const skeletons = deformers.skeletons;
    const morphTargets = [];
    const modelNodes = relationships.parents.map(function (parent) {
      return fbxTree.Objects.Model[parent.ID];
    });

    // don't create geometry if it is not associated with any models
    if (modelNodes.length === 0) return;
    const skeleton = relationships.children.reduce(function (skeleton, child) {
      if (skeletons[child.ID] !== undefined) skeleton = skeletons[child.ID];
      return skeleton;
    }, null);
    relationships.children.forEach(function (child) {
      if (deformers.morphTargets[child.ID] !== undefined) {
        morphTargets.push(deformers.morphTargets[child.ID]);
      }
    });

    // Assume one model and get the preRotation from that
    // if there is more than one model associated with the geometry this may cause problems
    const modelNode = modelNodes[0];
    const transformData = {};
    if ('RotationOrder' in modelNode) transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value);
    if ('InheritType' in modelNode) transformData.inheritType = parseInt(modelNode.InheritType.value);
    if ('GeometricTranslation' in modelNode) transformData.translation = modelNode.GeometricTranslation.value;
    if ('GeometricRotation' in modelNode) transformData.rotation = modelNode.GeometricRotation.value;
    if ('GeometricScaling' in modelNode) transformData.scale = modelNode.GeometricScaling.value;
    const transform = generateTransform(transformData);
    return this.genGeometry(geoNode, skeleton, morphTargets, transform);
  }

  // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
  genGeometry(geoNode, skeleton, morphTargets, preTransform) {
    const geo = new BufferGeometry$1();
    if (geoNode.attrName) geo.name = geoNode.attrName;
    const geoInfo = this.parseGeoNode(geoNode, skeleton);
    const buffers = this.genBuffers(geoInfo);
    const positionAttribute = new Float32BufferAttribute$1(buffers.vertex, 3);
    positionAttribute.applyMatrix4(preTransform);
    geo.setAttribute('position', positionAttribute);
    if (buffers.colors.length > 0) {
      geo.setAttribute('color', new Float32BufferAttribute$1(buffers.colors, 3));
    }
    if (skeleton) {
      geo.setAttribute('skinIndex', new Uint16BufferAttribute$1(buffers.weightsIndices, 4));
      geo.setAttribute('skinWeight', new Float32BufferAttribute$1(buffers.vertexWeights, 4));

      // used later to bind the skeleton to the model
      geo.FBX_Deformer = skeleton;
    }
    if (buffers.normal.length > 0) {
      const normalMatrix = new Matrix3$1().getNormalMatrix(preTransform);
      const normalAttribute = new Float32BufferAttribute$1(buffers.normal, 3);
      normalAttribute.applyNormalMatrix(normalMatrix);
      geo.setAttribute('normal', normalAttribute);
    }
    buffers.uvs.forEach(function (uvBuffer, i) {
      const name = i === 0 ? 'uv' : `uv${i}`;
      geo.setAttribute(name, new Float32BufferAttribute$1(buffers.uvs[i], 2));
    });
    if (geoInfo.material && geoInfo.material.mappingType !== 'AllSame') {
      // Convert the material indices of each vertex into rendering groups on the geometry.
      let prevMaterialIndex = buffers.materialIndex[0];
      let startIndex = 0;
      buffers.materialIndex.forEach(function (currentIndex, i) {
        if (currentIndex !== prevMaterialIndex) {
          geo.addGroup(startIndex, i - startIndex, prevMaterialIndex);
          prevMaterialIndex = currentIndex;
          startIndex = i;
        }
      });

      // the loop above doesn't add the last group, do that here.
      if (geo.groups.length > 0) {
        const lastGroup = geo.groups[geo.groups.length - 1];
        const lastIndex = lastGroup.start + lastGroup.count;
        if (lastIndex !== buffers.materialIndex.length) {
          geo.addGroup(lastIndex, buffers.materialIndex.length - lastIndex, prevMaterialIndex);
        }
      }

      // case where there are multiple materials but the whole geometry is only
      // using one of them
      if (geo.groups.length === 0) {
        geo.addGroup(0, buffers.materialIndex.length, buffers.materialIndex[0]);
      }
    }
    this.addMorphTargets(geo, geoNode, morphTargets, preTransform);
    return geo;
  }
  parseGeoNode(geoNode, skeleton) {
    const geoInfo = {};
    geoInfo.vertexPositions = geoNode.Vertices !== undefined ? geoNode.Vertices.a : [];
    geoInfo.vertexIndices = geoNode.PolygonVertexIndex !== undefined ? geoNode.PolygonVertexIndex.a : [];
    if (geoNode.LayerElementColor) {
      geoInfo.color = this.parseVertexColors(geoNode.LayerElementColor[0]);
    }
    if (geoNode.LayerElementMaterial) {
      geoInfo.material = this.parseMaterialIndices(geoNode.LayerElementMaterial[0]);
    }
    if (geoNode.LayerElementNormal) {
      geoInfo.normal = this.parseNormals(geoNode.LayerElementNormal[0]);
    }
    if (geoNode.LayerElementUV) {
      geoInfo.uv = [];
      let i = 0;
      while (geoNode.LayerElementUV[i]) {
        if (geoNode.LayerElementUV[i].UV) {
          geoInfo.uv.push(this.parseUVs(geoNode.LayerElementUV[i]));
        }
        i++;
      }
    }
    geoInfo.weightTable = {};
    if (skeleton !== null) {
      geoInfo.skeleton = skeleton;
      skeleton.rawBones.forEach(function (rawBone, i) {
        // loop over the bone's vertex indices and weights
        rawBone.indices.forEach(function (index, j) {
          if (geoInfo.weightTable[index] === undefined) geoInfo.weightTable[index] = [];
          geoInfo.weightTable[index].push({
            id: i,
            weight: rawBone.weights[j]
          });
        });
      });
    }
    return geoInfo;
  }
  genBuffers(geoInfo) {
    const buffers = {
      vertex: [],
      normal: [],
      colors: [],
      uvs: [],
      materialIndex: [],
      vertexWeights: [],
      weightsIndices: []
    };
    let polygonIndex = 0;
    let faceLength = 0;
    let displayedWeightsWarning = false;

    // these will hold data for a single face
    let facePositionIndexes = [];
    let faceNormals = [];
    let faceColors = [];
    let faceUVs = [];
    let faceWeights = [];
    let faceWeightIndices = [];
    const scope = this;
    geoInfo.vertexIndices.forEach(function (vertexIndex, polygonVertexIndex) {
      let materialIndex;
      let endOfFace = false;

      // Face index and vertex index arrays are combined in a single array
      // A cube with quad faces looks like this:
      // PolygonVertexIndex: *24 {
      //  a: 0, 1, 3, -3, 2, 3, 5, -5, 4, 5, 7, -7, 6, 7, 1, -1, 1, 7, 5, -4, 6, 0, 2, -5
      //  }
      // Negative numbers mark the end of a face - first face here is 0, 1, 3, -3
      // to find index of last vertex bit shift the index: ^ - 1
      if (vertexIndex < 0) {
        vertexIndex = vertexIndex ^ -1; // equivalent to ( x * -1 ) - 1
        endOfFace = true;
      }
      let weightIndices = [];
      let weights = [];
      facePositionIndexes.push(vertexIndex * 3, vertexIndex * 3 + 1, vertexIndex * 3 + 2);
      if (geoInfo.color) {
        const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.color);
        faceColors.push(data[0], data[1], data[2]);
      }
      if (geoInfo.skeleton) {
        if (geoInfo.weightTable[vertexIndex] !== undefined) {
          geoInfo.weightTable[vertexIndex].forEach(function (wt) {
            weights.push(wt.weight);
            weightIndices.push(wt.id);
          });
        }
        if (weights.length > 4) {
          if (!displayedWeightsWarning) {
            console.warn('THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.');
            displayedWeightsWarning = true;
          }
          const wIndex = [0, 0, 0, 0];
          const Weight = [0, 0, 0, 0];
          weights.forEach(function (weight, weightIndex) {
            let currentWeight = weight;
            let currentIndex = weightIndices[weightIndex];
            Weight.forEach(function (comparedWeight, comparedWeightIndex, comparedWeightArray) {
              if (currentWeight > comparedWeight) {
                comparedWeightArray[comparedWeightIndex] = currentWeight;
                currentWeight = comparedWeight;
                const tmp = wIndex[comparedWeightIndex];
                wIndex[comparedWeightIndex] = currentIndex;
                currentIndex = tmp;
              }
            });
          });
          weightIndices = wIndex;
          weights = Weight;
        }

        // if the weight array is shorter than 4 pad with 0s
        while (weights.length < 4) {
          weights.push(0);
          weightIndices.push(0);
        }
        for (let i = 0; i < 4; ++i) {
          faceWeights.push(weights[i]);
          faceWeightIndices.push(weightIndices[i]);
        }
      }
      if (geoInfo.normal) {
        const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.normal);
        faceNormals.push(data[0], data[1], data[2]);
      }
      if (geoInfo.material && geoInfo.material.mappingType !== 'AllSame') {
        materialIndex = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material)[0];
        if (materialIndex < 0) {
          scope.negativeMaterialIndices = true;
          materialIndex = 0; // fallback
        }
      }
      if (geoInfo.uv) {
        geoInfo.uv.forEach(function (uv, i) {
          const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, uv);
          if (faceUVs[i] === undefined) {
            faceUVs[i] = [];
          }
          faceUVs[i].push(data[0]);
          faceUVs[i].push(data[1]);
        });
      }
      faceLength++;
      if (endOfFace) {
        scope.genFace(buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength);
        polygonIndex++;
        faceLength = 0;

        // reset arrays for the next face
        facePositionIndexes = [];
        faceNormals = [];
        faceColors = [];
        faceUVs = [];
        faceWeights = [];
        faceWeightIndices = [];
      }
    });
    return buffers;
  }

  // See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
  getNormalNewell(vertices) {
    const normal = new Vector3$1(0.0, 0.0, 0.0);
    for (let i = 0; i < vertices.length; i++) {
      const current = vertices[i];
      const next = vertices[(i + 1) % vertices.length];
      normal.x += (current.y - next.y) * (current.z + next.z);
      normal.y += (current.z - next.z) * (current.x + next.x);
      normal.z += (current.x - next.x) * (current.y + next.y);
    }
    normal.normalize();
    return normal;
  }
  getNormalTangentAndBitangent(vertices) {
    const normalVector = this.getNormalNewell(vertices);
    // Avoid up being equal or almost equal to normalVector
    const up = Math.abs(normalVector.z) > 0.5 ? new Vector3$1(0.0, 1.0, 0.0) : new Vector3$1(0.0, 0.0, 1.0);
    const tangent = up.cross(normalVector).normalize();
    const bitangent = normalVector.clone().cross(tangent).normalize();
    return {
      normal: normalVector,
      tangent: tangent,
      bitangent: bitangent
    };
  }
  flattenVertex(vertex, normalTangent, normalBitangent) {
    return new Vector2$1(vertex.dot(normalTangent), vertex.dot(normalBitangent));
  }

  // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
  genFace(buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength) {
    let triangles;
    if (faceLength > 3) {
      // Triangulate n-gon using earcut

      const vertices = [];
      // in morphing scenario vertexPositions represent morphPositions
      // while baseVertexPositions represent the original geometry's positions
      const positions = geoInfo.baseVertexPositions || geoInfo.vertexPositions;
      for (let i = 0; i < facePositionIndexes.length; i += 3) {
        vertices.push(new Vector3$1(positions[facePositionIndexes[i]], positions[facePositionIndexes[i + 1]], positions[facePositionIndexes[i + 2]]));
      }
      const {
        tangent,
        bitangent
      } = this.getNormalTangentAndBitangent(vertices);
      const triangulationInput = [];
      for (const vertex of vertices) {
        triangulationInput.push(this.flattenVertex(vertex, tangent, bitangent));
      }

      // When vertices is an array of [0,0,0] elements (which is the case for vertices not participating in morph)
      // the triangulationInput will be an array of [0,0] elements
      // resulting in an array of 0 triangles being returned from ShapeUtils.triangulateShape
      // leading to not pushing into buffers.vertex the redundant vertices (the vertices that are not morphed).
      // That's why, in order to support morphing scenario, "positions" is looking first for baseVertexPositions,
      // so that we don't end up with an array of 0 triangles for the faces not participating in morph.
      triangles = ShapeUtils.triangulateShape(triangulationInput, []);
    } else {
      // Regular triangle, skip earcut triangulation step
      triangles = [[0, 1, 2]];
    }
    for (const [i0, i1, i2] of triangles) {
      buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i0 * 3]]);
      buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i0 * 3 + 1]]);
      buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i0 * 3 + 2]]);
      buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i1 * 3]]);
      buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i1 * 3 + 1]]);
      buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i1 * 3 + 2]]);
      buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i2 * 3]]);
      buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i2 * 3 + 1]]);
      buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i2 * 3 + 2]]);
      if (geoInfo.skeleton) {
        buffers.vertexWeights.push(faceWeights[i0 * 4]);
        buffers.vertexWeights.push(faceWeights[i0 * 4 + 1]);
        buffers.vertexWeights.push(faceWeights[i0 * 4 + 2]);
        buffers.vertexWeights.push(faceWeights[i0 * 4 + 3]);
        buffers.vertexWeights.push(faceWeights[i1 * 4]);
        buffers.vertexWeights.push(faceWeights[i1 * 4 + 1]);
        buffers.vertexWeights.push(faceWeights[i1 * 4 + 2]);
        buffers.vertexWeights.push(faceWeights[i1 * 4 + 3]);
        buffers.vertexWeights.push(faceWeights[i2 * 4]);
        buffers.vertexWeights.push(faceWeights[i2 * 4 + 1]);
        buffers.vertexWeights.push(faceWeights[i2 * 4 + 2]);
        buffers.vertexWeights.push(faceWeights[i2 * 4 + 3]);
        buffers.weightsIndices.push(faceWeightIndices[i0 * 4]);
        buffers.weightsIndices.push(faceWeightIndices[i0 * 4 + 1]);
        buffers.weightsIndices.push(faceWeightIndices[i0 * 4 + 2]);
        buffers.weightsIndices.push(faceWeightIndices[i0 * 4 + 3]);
        buffers.weightsIndices.push(faceWeightIndices[i1 * 4]);
        buffers.weightsIndices.push(faceWeightIndices[i1 * 4 + 1]);
        buffers.weightsIndices.push(faceWeightIndices[i1 * 4 + 2]);
        buffers.weightsIndices.push(faceWeightIndices[i1 * 4 + 3]);
        buffers.weightsIndices.push(faceWeightIndices[i2 * 4]);
        buffers.weightsIndices.push(faceWeightIndices[i2 * 4 + 1]);
        buffers.weightsIndices.push(faceWeightIndices[i2 * 4 + 2]);
        buffers.weightsIndices.push(faceWeightIndices[i2 * 4 + 3]);
      }
      if (geoInfo.color) {
        buffers.colors.push(faceColors[i0 * 3]);
        buffers.colors.push(faceColors[i0 * 3 + 1]);
        buffers.colors.push(faceColors[i0 * 3 + 2]);
        buffers.colors.push(faceColors[i1 * 3]);
        buffers.colors.push(faceColors[i1 * 3 + 1]);
        buffers.colors.push(faceColors[i1 * 3 + 2]);
        buffers.colors.push(faceColors[i2 * 3]);
        buffers.colors.push(faceColors[i2 * 3 + 1]);
        buffers.colors.push(faceColors[i2 * 3 + 2]);
      }
      if (geoInfo.material && geoInfo.material.mappingType !== 'AllSame') {
        buffers.materialIndex.push(materialIndex);
        buffers.materialIndex.push(materialIndex);
        buffers.materialIndex.push(materialIndex);
      }
      if (geoInfo.normal) {
        buffers.normal.push(faceNormals[i0 * 3]);
        buffers.normal.push(faceNormals[i0 * 3 + 1]);
        buffers.normal.push(faceNormals[i0 * 3 + 2]);
        buffers.normal.push(faceNormals[i1 * 3]);
        buffers.normal.push(faceNormals[i1 * 3 + 1]);
        buffers.normal.push(faceNormals[i1 * 3 + 2]);
        buffers.normal.push(faceNormals[i2 * 3]);
        buffers.normal.push(faceNormals[i2 * 3 + 1]);
        buffers.normal.push(faceNormals[i2 * 3 + 2]);
      }
      if (geoInfo.uv) {
        geoInfo.uv.forEach(function (uv, j) {
          if (buffers.uvs[j] === undefined) buffers.uvs[j] = [];
          buffers.uvs[j].push(faceUVs[j][i0 * 2]);
          buffers.uvs[j].push(faceUVs[j][i0 * 2 + 1]);
          buffers.uvs[j].push(faceUVs[j][i1 * 2]);
          buffers.uvs[j].push(faceUVs[j][i1 * 2 + 1]);
          buffers.uvs[j].push(faceUVs[j][i2 * 2]);
          buffers.uvs[j].push(faceUVs[j][i2 * 2 + 1]);
        });
      }
    }
  }
  addMorphTargets(parentGeo, parentGeoNode, morphTargets, preTransform) {
    if (morphTargets.length === 0) return;
    parentGeo.morphTargetsRelative = true;
    parentGeo.morphAttributes.position = [];
    // parentGeo.morphAttributes.normal = []; // not implemented

    const scope = this;
    morphTargets.forEach(function (morphTarget) {
      morphTarget.rawTargets.forEach(function (rawTarget) {
        const morphGeoNode = fbxTree.Objects.Geometry[rawTarget.geoID];
        if (morphGeoNode !== undefined) {
          scope.genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name);
        }
      });
    });
  }

  // a morph geometry node is similar to a standard  node, and the node is also contained
  // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
  // and a special attribute Index defining which vertices of the original geometry are affected
  // Normal and position attributes only have data for the vertices that are affected by the morph
  genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, name) {
    const basePositions = parentGeoNode.Vertices !== undefined ? parentGeoNode.Vertices.a : [];
    const baseIndices = parentGeoNode.PolygonVertexIndex !== undefined ? parentGeoNode.PolygonVertexIndex.a : [];
    const morphPositionsSparse = morphGeoNode.Vertices !== undefined ? morphGeoNode.Vertices.a : [];
    const morphIndices = morphGeoNode.Indexes !== undefined ? morphGeoNode.Indexes.a : [];
    const length = parentGeo.attributes.position.count * 3;
    const morphPositions = new Float32Array(length);
    for (let i = 0; i < morphIndices.length; i++) {
      const morphIndex = morphIndices[i] * 3;
      morphPositions[morphIndex] = morphPositionsSparse[i * 3];
      morphPositions[morphIndex + 1] = morphPositionsSparse[i * 3 + 1];
      morphPositions[morphIndex + 2] = morphPositionsSparse[i * 3 + 2];
    }

    // TODO: add morph normal support
    const morphGeoInfo = {
      vertexIndices: baseIndices,
      vertexPositions: morphPositions,
      baseVertexPositions: basePositions
    };
    const morphBuffers = this.genBuffers(morphGeoInfo);
    const positionAttribute = new Float32BufferAttribute$1(morphBuffers.vertex, 3);
    positionAttribute.name = name || morphGeoNode.attrName;
    positionAttribute.applyMatrix4(preTransform);
    parentGeo.morphAttributes.position.push(positionAttribute);
  }

  // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
  parseNormals(NormalNode) {
    const mappingType = NormalNode.MappingInformationType;
    const referenceType = NormalNode.ReferenceInformationType;
    const buffer = NormalNode.Normals.a;
    let indexBuffer = [];
    if (referenceType === 'IndexToDirect') {
      if ('NormalIndex' in NormalNode) {
        indexBuffer = NormalNode.NormalIndex.a;
      } else if ('NormalsIndex' in NormalNode) {
        indexBuffer = NormalNode.NormalsIndex.a;
      }
    }
    return {
      dataSize: 3,
      buffer: buffer,
      indices: indexBuffer,
      mappingType: mappingType,
      referenceType: referenceType
    };
  }

  // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
  parseUVs(UVNode) {
    const mappingType = UVNode.MappingInformationType;
    const referenceType = UVNode.ReferenceInformationType;
    const buffer = UVNode.UV.a;
    let indexBuffer = [];
    if (referenceType === 'IndexToDirect') {
      indexBuffer = UVNode.UVIndex.a;
    }
    return {
      dataSize: 2,
      buffer: buffer,
      indices: indexBuffer,
      mappingType: mappingType,
      referenceType: referenceType
    };
  }

  // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
  parseVertexColors(ColorNode) {
    const mappingType = ColorNode.MappingInformationType;
    const referenceType = ColorNode.ReferenceInformationType;
    const buffer = ColorNode.Colors.a;
    let indexBuffer = [];
    if (referenceType === 'IndexToDirect') {
      indexBuffer = ColorNode.ColorIndex.a;
    }
    for (let i = 0, c = new Color$1(); i < buffer.length; i += 4) {
      c.fromArray(buffer, i).convertSRGBToLinear().toArray(buffer, i);
    }
    return {
      dataSize: 4,
      buffer: buffer,
      indices: indexBuffer,
      mappingType: mappingType,
      referenceType: referenceType
    };
  }

  // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
  parseMaterialIndices(MaterialNode) {
    const mappingType = MaterialNode.MappingInformationType;
    const referenceType = MaterialNode.ReferenceInformationType;
    if (mappingType === 'NoMappingInformation') {
      return {
        dataSize: 1,
        buffer: [0],
        indices: [0],
        mappingType: 'AllSame',
        referenceType: referenceType
      };
    }
    const materialIndexBuffer = MaterialNode.Materials.a;

    // Since materials are stored as indices, there's a bit of a mismatch between FBX and what
    // we expect.So we create an intermediate buffer that points to the index in the buffer,
    // for conforming with the other functions we've written for other data.
    const materialIndices = [];
    for (let i = 0; i < materialIndexBuffer.length; ++i) {
      materialIndices.push(i);
    }
    return {
      dataSize: 1,
      buffer: materialIndexBuffer,
      indices: materialIndices,
      mappingType: mappingType,
      referenceType: referenceType
    };
  }

  // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
  parseNurbsGeometry(geoNode) {
    const order = parseInt(geoNode.Order);
    if (isNaN(order)) {
      console.error('THREE.FBXLoader: Invalid Order %s given for geometry ID: %s', geoNode.Order, geoNode.id);
      return new BufferGeometry$1();
    }
    const degree = order - 1;
    const knots = geoNode.KnotVector.a;
    const controlPoints = [];
    const pointsValues = geoNode.Points.a;
    for (let i = 0, l = pointsValues.length; i < l; i += 4) {
      controlPoints.push(new Vector4$1().fromArray(pointsValues, i));
    }
    let startKnot, endKnot;
    if (geoNode.Form === 'Closed') {
      controlPoints.push(controlPoints[0]);
    } else if (geoNode.Form === 'Periodic') {
      startKnot = degree;
      endKnot = knots.length - 1 - startKnot;
      for (let i = 0; i < degree; ++i) {
        controlPoints.push(controlPoints[i]);
      }
    }
    const curve = new NURBSCurve(degree, knots, controlPoints, startKnot, endKnot);
    const points = curve.getPoints(controlPoints.length * 12);
    return new BufferGeometry$1().setFromPoints(points);
  }
}

// parse animation data from FBXTree
class AnimationParser {
  // take raw animation clips and turn them into three.js animation clips
  parse() {
    const animationClips = [];
    const rawClips = this.parseClips();
    if (rawClips !== undefined) {
      for (const key in rawClips) {
        const rawClip = rawClips[key];
        const clip = this.addClip(rawClip);
        animationClips.push(clip);
      }
    }
    return animationClips;
  }
  parseClips() {
    // since the actual transformation data is stored in FBXTree.Objects.AnimationCurve,
    // if this is undefined we can safely assume there are no animations
    if (fbxTree.Objects.AnimationCurve === undefined) return undefined;
    const curveNodesMap = this.parseAnimationCurveNodes();
    this.parseAnimationCurves(curveNodesMap);
    const layersMap = this.parseAnimationLayers(curveNodesMap);
    const rawClips = this.parseAnimStacks(layersMap);
    return rawClips;
  }

  // parse nodes in FBXTree.Objects.AnimationCurveNode
  // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
  // and is referenced by an AnimationLayer
  parseAnimationCurveNodes() {
    const rawCurveNodes = fbxTree.Objects.AnimationCurveNode;
    const curveNodesMap = new Map();
    for (const nodeID in rawCurveNodes) {
      const rawCurveNode = rawCurveNodes[nodeID];
      if (rawCurveNode.attrName.match(/S|R|T|DeformPercent/) !== null) {
        const curveNode = {
          id: rawCurveNode.id,
          attr: rawCurveNode.attrName,
          curves: {}
        };
        curveNodesMap.set(curveNode.id, curveNode);
      }
    }
    return curveNodesMap;
  }

  // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to
  // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
  // axis ( e.g. times and values of x rotation)
  parseAnimationCurves(curveNodesMap) {
    const rawCurves = fbxTree.Objects.AnimationCurve;

    // TODO: Many values are identical up to roundoff error, but won't be optimised
    // e.g. position times: [0, 0.4, 0. 8]
    // position values: [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.235384487103147e-7, 93.67520904541016, -0.9982695579528809]
    // clearly, this should be optimised to
    // times: [0], positions [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809]
    // this shows up in nearly every FBX file, and generally time array is length > 100

    for (const nodeID in rawCurves) {
      const animationCurve = {
        id: rawCurves[nodeID].id,
        times: rawCurves[nodeID].KeyTime.a.map(convertFBXTimeToSeconds),
        values: rawCurves[nodeID].KeyValueFloat.a
      };
      const relationships = connections.get(animationCurve.id);
      if (relationships !== undefined) {
        const animationCurveID = relationships.parents[0].ID;
        const animationCurveRelationship = relationships.parents[0].relationship;
        if (animationCurveRelationship.match(/X/)) {
          curveNodesMap.get(animationCurveID).curves['x'] = animationCurve;
        } else if (animationCurveRelationship.match(/Y/)) {
          curveNodesMap.get(animationCurveID).curves['y'] = animationCurve;
        } else if (animationCurveRelationship.match(/Z/)) {
          curveNodesMap.get(animationCurveID).curves['z'] = animationCurve;
        } else if (animationCurveRelationship.match(/DeformPercent/) && curveNodesMap.has(animationCurveID)) {
          curveNodesMap.get(animationCurveID).curves['morph'] = animationCurve;
        }
      }
    }
  }

  // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references
  // to various AnimationCurveNodes and is referenced by an AnimationStack node
  // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
  parseAnimationLayers(curveNodesMap) {
    const rawLayers = fbxTree.Objects.AnimationLayer;
    const layersMap = new Map();
    for (const nodeID in rawLayers) {
      const layerCurveNodes = [];
      const connection = connections.get(parseInt(nodeID));
      if (connection !== undefined) {
        // all the animationCurveNodes used in the layer
        const children = connection.children;
        children.forEach(function (child, i) {
          if (curveNodesMap.has(child.ID)) {
            const curveNode = curveNodesMap.get(child.ID);

            // check that the curves are defined for at least one axis, otherwise ignore the curveNode
            if (curveNode.curves.x !== undefined || curveNode.curves.y !== undefined || curveNode.curves.z !== undefined) {
              if (layerCurveNodes[i] === undefined) {
                const modelID = connections.get(child.ID).parents.filter(function (parent) {
                  return parent.relationship !== undefined;
                })[0].ID;
                if (modelID !== undefined) {
                  const rawModel = fbxTree.Objects.Model[modelID.toString()];
                  if (rawModel === undefined) {
                    console.warn('THREE.FBXLoader: Encountered a unused curve.', child);
                    return;
                  }
                  const node = {
                    modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName(rawModel.attrName) : '',
                    ID: rawModel.id,
                    initialPosition: [0, 0, 0],
                    initialRotation: [0, 0, 0],
                    initialScale: [1, 1, 1]
                  };
                  sceneGraph.traverse(function (child) {
                    if (child.ID === rawModel.id) {
                      node.transform = child.matrix;
                      if (child.userData.transformData) node.eulerOrder = child.userData.transformData.eulerOrder;
                    }
                  });
                  if (!node.transform) node.transform = new Matrix4$1();

                  // if the animated model is pre rotated, we'll have to apply the pre rotations to every
                  // animation value as well
                  if ('PreRotation' in rawModel) node.preRotation = rawModel.PreRotation.value;
                  if ('PostRotation' in rawModel) node.postRotation = rawModel.PostRotation.value;
                  layerCurveNodes[i] = node;
                }
              }
              if (layerCurveNodes[i]) layerCurveNodes[i][curveNode.attr] = curveNode;
            } else if (curveNode.curves.morph !== undefined) {
              if (layerCurveNodes[i] === undefined) {
                const deformerID = connections.get(child.ID).parents.filter(function (parent) {
                  return parent.relationship !== undefined;
                })[0].ID;
                const morpherID = connections.get(deformerID).parents[0].ID;
                const geoID = connections.get(morpherID).parents[0].ID;

                // assuming geometry is not used in more than one model
                const modelID = connections.get(geoID).parents[0].ID;
                const rawModel = fbxTree.Objects.Model[modelID];
                const node = {
                  modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName(rawModel.attrName) : '',
                  morphName: fbxTree.Objects.Deformer[deformerID].attrName
                };
                layerCurveNodes[i] = node;
              }
              layerCurveNodes[i][curveNode.attr] = curveNode;
            }
          }
        });
        layersMap.set(parseInt(nodeID), layerCurveNodes);
      }
    }
    return layersMap;
  }

  // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
  // hierarchy. Each Stack node will be used to create a AnimationClip
  parseAnimStacks(layersMap) {
    const rawStacks = fbxTree.Objects.AnimationStack;

    // connect the stacks (clips) up to the layers
    const rawClips = {};
    for (const nodeID in rawStacks) {
      const children = connections.get(parseInt(nodeID)).children;
      if (children.length > 1) {
        // it seems like stacks will always be associated with a single layer. But just in case there are files
        // where there are multiple layers per stack, we'll display a warning
        console.warn('THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.');
      }
      const layer = layersMap.get(children[0].ID);
      rawClips[nodeID] = {
        name: rawStacks[nodeID].attrName,
        layer: layer
      };
    }
    return rawClips;
  }
  addClip(rawClip) {
    let tracks = [];
    const scope = this;
    rawClip.layer.forEach(function (rawTracks) {
      tracks = tracks.concat(scope.generateTracks(rawTracks));
    });
    return new AnimationClip(rawClip.name, -1, tracks);
  }
  generateTracks(rawTracks) {
    const tracks = [];
    let initialPosition = new Vector3$1();
    let initialScale = new Vector3$1();
    if (rawTracks.transform) rawTracks.transform.decompose(initialPosition, new Quaternion$1(), initialScale);
    initialPosition = initialPosition.toArray();
    initialScale = initialScale.toArray();
    if (rawTracks.T !== undefined && Object.keys(rawTracks.T.curves).length > 0) {
      const positionTrack = this.generateVectorTrack(rawTracks.modelName, rawTracks.T.curves, initialPosition, 'position');
      if (positionTrack !== undefined) tracks.push(positionTrack);
    }
    if (rawTracks.R !== undefined && Object.keys(rawTracks.R.curves).length > 0) {
      const rotationTrack = this.generateRotationTrack(rawTracks.modelName, rawTracks.R.curves, rawTracks.preRotation, rawTracks.postRotation, rawTracks.eulerOrder);
      if (rotationTrack !== undefined) tracks.push(rotationTrack);
    }
    if (rawTracks.S !== undefined && Object.keys(rawTracks.S.curves).length > 0) {
      const scaleTrack = this.generateVectorTrack(rawTracks.modelName, rawTracks.S.curves, initialScale, 'scale');
      if (scaleTrack !== undefined) tracks.push(scaleTrack);
    }
    if (rawTracks.DeformPercent !== undefined) {
      const morphTrack = this.generateMorphTrack(rawTracks);
      if (morphTrack !== undefined) tracks.push(morphTrack);
    }
    return tracks;
  }
  generateVectorTrack(modelName, curves, initialValue, type) {
    const times = this.getTimesForAllAxes(curves);
    const values = this.getKeyframeTrackValues(times, curves, initialValue);
    return new VectorKeyframeTrack(modelName + '.' + type, times, values);
  }
  generateRotationTrack(modelName, curves, preRotation, postRotation, eulerOrder) {
    let times;
    let values;
    if (curves.x !== undefined && curves.y !== undefined && curves.z !== undefined) {
      const result = this.interpolateRotations(curves.x, curves.y, curves.z, eulerOrder);
      times = result[0];
      values = result[1];
    }
    if (preRotation !== undefined) {
      preRotation = preRotation.map(MathUtils$1.degToRad);
      preRotation.push(eulerOrder);
      preRotation = new Euler$1().fromArray(preRotation);
      preRotation = new Quaternion$1().setFromEuler(preRotation);
    }
    if (postRotation !== undefined) {
      postRotation = postRotation.map(MathUtils$1.degToRad);
      postRotation.push(eulerOrder);
      postRotation = new Euler$1().fromArray(postRotation);
      postRotation = new Quaternion$1().setFromEuler(postRotation).invert();
    }
    const quaternion = new Quaternion$1();
    const euler = new Euler$1();
    const quaternionValues = [];
    if (!values || !times) return new QuaternionKeyframeTrack(modelName + '.quaternion', [0], [0]);
    for (let i = 0; i < values.length; i += 3) {
      euler.set(values[i], values[i + 1], values[i + 2], eulerOrder);
      quaternion.setFromEuler(euler);
      if (preRotation !== undefined) quaternion.premultiply(preRotation);
      if (postRotation !== undefined) quaternion.multiply(postRotation);

      // Check unroll
      if (i > 2) {
        const prevQuat = new Quaternion$1().fromArray(quaternionValues, (i - 3) / 3 * 4);
        if (prevQuat.dot(quaternion) < 0) {
          quaternion.set(-quaternion.x, -quaternion.y, -quaternion.z, -quaternion.w);
        }
      }
      quaternion.toArray(quaternionValues, i / 3 * 4);
    }
    return new QuaternionKeyframeTrack(modelName + '.quaternion', times, quaternionValues);
  }
  generateMorphTrack(rawTracks) {
    const curves = rawTracks.DeformPercent.curves.morph;
    const values = curves.values.map(function (val) {
      return val / 100;
    });
    const morphNum = sceneGraph.getObjectByName(rawTracks.modelName).morphTargetDictionary[rawTracks.morphName];
    return new NumberKeyframeTrack(rawTracks.modelName + '.morphTargetInfluences[' + morphNum + ']', curves.times, values);
  }

  // For all animated objects, times are defined separately for each axis
  // Here we'll combine the times into one sorted array without duplicates
  getTimesForAllAxes(curves) {
    let times = [];

    // first join together the times for each axis, if defined
    if (curves.x !== undefined) times = times.concat(curves.x.times);
    if (curves.y !== undefined) times = times.concat(curves.y.times);
    if (curves.z !== undefined) times = times.concat(curves.z.times);

    // then sort them
    times = times.sort(function (a, b) {
      return a - b;
    });

    // and remove duplicates
    if (times.length > 1) {
      let targetIndex = 1;
      let lastValue = times[0];
      for (let i = 1; i < times.length; i++) {
        const currentValue = times[i];
        if (currentValue !== lastValue) {
          times[targetIndex] = currentValue;
          lastValue = currentValue;
          targetIndex++;
        }
      }
      times = times.slice(0, targetIndex);
    }
    return times;
  }
  getKeyframeTrackValues(times, curves, initialValue) {
    const prevValue = initialValue;
    const values = [];
    let xIndex = -1;
    let yIndex = -1;
    let zIndex = -1;
    times.forEach(function (time) {
      if (curves.x) xIndex = curves.x.times.indexOf(time);
      if (curves.y) yIndex = curves.y.times.indexOf(time);
      if (curves.z) zIndex = curves.z.times.indexOf(time);

      // if there is an x value defined for this frame, use that
      if (xIndex !== -1) {
        const xValue = curves.x.values[xIndex];
        values.push(xValue);
        prevValue[0] = xValue;
      } else {
        // otherwise use the x value from the previous frame
        values.push(prevValue[0]);
      }
      if (yIndex !== -1) {
        const yValue = curves.y.values[yIndex];
        values.push(yValue);
        prevValue[1] = yValue;
      } else {
        values.push(prevValue[1]);
      }
      if (zIndex !== -1) {
        const zValue = curves.z.values[zIndex];
        values.push(zValue);
        prevValue[2] = zValue;
      } else {
        values.push(prevValue[2]);
      }
    });
    return values;
  }

  // Rotations are defined as Euler angles which can have values  of any size
  // These will be converted to quaternions which don't support values greater than
  // PI, so we'll interpolate large rotations
  interpolateRotations(curvex, curvey, curvez, eulerOrder) {
    const times = [];
    const values = [];

    // Add first frame
    times.push(curvex.times[0]);
    values.push(MathUtils$1.degToRad(curvex.values[0]));
    values.push(MathUtils$1.degToRad(curvey.values[0]));
    values.push(MathUtils$1.degToRad(curvez.values[0]));
    for (let i = 1; i < curvex.values.length; i++) {
      const initialValue = [curvex.values[i - 1], curvey.values[i - 1], curvez.values[i - 1]];
      if (isNaN(initialValue[0]) || isNaN(initialValue[1]) || isNaN(initialValue[2])) {
        continue;
      }
      const initialValueRad = initialValue.map(MathUtils$1.degToRad);
      const currentValue = [curvex.values[i], curvey.values[i], curvez.values[i]];
      if (isNaN(currentValue[0]) || isNaN(currentValue[1]) || isNaN(currentValue[2])) {
        continue;
      }
      const currentValueRad = currentValue.map(MathUtils$1.degToRad);
      const valuesSpan = [currentValue[0] - initialValue[0], currentValue[1] - initialValue[1], currentValue[2] - initialValue[2]];
      const absoluteSpan = [Math.abs(valuesSpan[0]), Math.abs(valuesSpan[1]), Math.abs(valuesSpan[2])];
      if (absoluteSpan[0] >= 180 || absoluteSpan[1] >= 180 || absoluteSpan[2] >= 180) {
        const maxAbsSpan = Math.max(...absoluteSpan);
        const numSubIntervals = maxAbsSpan / 180;
        const E1 = new Euler$1(...initialValueRad, eulerOrder);
        const E2 = new Euler$1(...currentValueRad, eulerOrder);
        const Q1 = new Quaternion$1().setFromEuler(E1);
        const Q2 = new Quaternion$1().setFromEuler(E2);

        // Check unroll
        if (Q1.dot(Q2)) {
          Q2.set(-Q2.x, -Q2.y, -Q2.z, -Q2.w);
        }

        // Interpolate
        const initialTime = curvex.times[i - 1];
        const timeSpan = curvex.times[i] - initialTime;
        const Q = new Quaternion$1();
        const E = new Euler$1();
        for (let t = 0; t < 1; t += 1 / numSubIntervals) {
          Q.copy(Q1.clone().slerp(Q2.clone(), t));
          times.push(initialTime + t * timeSpan);
          E.setFromQuaternion(Q, eulerOrder);
          values.push(E.x);
          values.push(E.y);
          values.push(E.z);
        }
      } else {
        times.push(curvex.times[i]);
        values.push(MathUtils$1.degToRad(curvex.values[i]));
        values.push(MathUtils$1.degToRad(curvey.values[i]));
        values.push(MathUtils$1.degToRad(curvez.values[i]));
      }
    }
    return [times, values];
  }
}

// parse an FBX file in ASCII format
class TextParser {
  getPrevNode() {
    return this.nodeStack[this.currentIndent - 2];
  }
  getCurrentNode() {
    return this.nodeStack[this.currentIndent - 1];
  }
  getCurrentProp() {
    return this.currentProp;
  }
  pushStack(node) {
    this.nodeStack.push(node);
    this.currentIndent += 1;
  }
  popStack() {
    this.nodeStack.pop();
    this.currentIndent -= 1;
  }
  setCurrentProp(val, name) {
    this.currentProp = val;
    this.currentPropName = name;
  }
  parse(text) {
    this.currentIndent = 0;
    this.allNodes = new FBXTree();
    this.nodeStack = [];
    this.currentProp = [];
    this.currentPropName = '';
    const scope = this;
    const split = text.split(/[\r\n]+/);
    split.forEach(function (line, i) {
      const matchComment = line.match(/^[\s\t]*;/);
      const matchEmpty = line.match(/^[\s\t]*$/);
      if (matchComment || matchEmpty) return;
      const matchBeginning = line.match('^\\t{' + scope.currentIndent + '}(\\w+):(.*){', '');
      const matchProperty = line.match('^\\t{' + scope.currentIndent + '}(\\w+):[\\s\\t\\r\\n](.*)');
      const matchEnd = line.match('^\\t{' + (scope.currentIndent - 1) + '}}');
      if (matchBeginning) {
        scope.parseNodeBegin(line, matchBeginning);
      } else if (matchProperty) {
        scope.parseNodeProperty(line, matchProperty, split[++i]);
      } else if (matchEnd) {
        scope.popStack();
      } else if (line.match(/^[^\s\t}]/)) {
        // large arrays are split over multiple lines terminated with a ',' character
        // if this is encountered the line needs to be joined to the previous line
        scope.parseNodePropertyContinued(line);
      }
    });
    return this.allNodes;
  }
  parseNodeBegin(line, property) {
    const nodeName = property[1].trim().replace(/^"/, '').replace(/"$/, '');
    const nodeAttrs = property[2].split(',').map(function (attr) {
      return attr.trim().replace(/^"/, '').replace(/"$/, '');
    });
    const node = {
      name: nodeName
    };
    const attrs = this.parseNodeAttr(nodeAttrs);
    const currentNode = this.getCurrentNode();

    // a top node
    if (this.currentIndent === 0) {
      this.allNodes.add(nodeName, node);
    } else {
      // a subnode

      // if the subnode already exists, append it
      if (nodeName in currentNode) {
        // special case Pose needs PoseNodes as an array
        if (nodeName === 'PoseNode') {
          currentNode.PoseNode.push(node);
        } else if (currentNode[nodeName].id !== undefined) {
          currentNode[nodeName] = {};
          currentNode[nodeName][currentNode[nodeName].id] = currentNode[nodeName];
        }
        if (attrs.id !== '') currentNode[nodeName][attrs.id] = node;
      } else if (typeof attrs.id === 'number') {
        currentNode[nodeName] = {};
        currentNode[nodeName][attrs.id] = node;
      } else if (nodeName !== 'Properties70') {
        if (nodeName === 'PoseNode') currentNode[nodeName] = [node];else currentNode[nodeName] = node;
      }
    }
    if (typeof attrs.id === 'number') node.id = attrs.id;
    if (attrs.name !== '') node.attrName = attrs.name;
    if (attrs.type !== '') node.attrType = attrs.type;
    this.pushStack(node);
  }
  parseNodeAttr(attrs) {
    let id = attrs[0];
    if (attrs[0] !== '') {
      id = parseInt(attrs[0]);
      if (isNaN(id)) {
        id = attrs[0];
      }
    }
    let name = '',
      type = '';
    if (attrs.length > 1) {
      name = attrs[1].replace(/^(\w+)::/, '');
      type = attrs[2];
    }
    return {
      id: id,
      name: name,
      type: type
    };
  }
  parseNodeProperty(line, property, contentLine) {
    let propName = property[1].replace(/^"/, '').replace(/"$/, '').trim();
    let propValue = property[2].replace(/^"/, '').replace(/"$/, '').trim();

    // for special case: base64 image data follows "Content: ," line
    //	Content: ,
    //	 "/9j/4RDaRXhpZgAATU0A..."
    if (propName === 'Content' && propValue === ',') {
      propValue = contentLine.replace(/"/g, '').replace(/,$/, '').trim();
    }
    const currentNode = this.getCurrentNode();
    const parentName = currentNode.name;
    if (parentName === 'Properties70') {
      this.parseNodeSpecialProperty(line, propName, propValue);
      return;
    }

    // Connections
    if (propName === 'C') {
      const connProps = propValue.split(',').slice(1);
      const from = parseInt(connProps[0]);
      const to = parseInt(connProps[1]);
      let rest = propValue.split(',').slice(3);
      rest = rest.map(function (elem) {
        return elem.trim().replace(/^"/, '');
      });
      propName = 'connections';
      propValue = [from, to];
      append(propValue, rest);
      if (currentNode[propName] === undefined) {
        currentNode[propName] = [];
      }
    }

    // Node
    if (propName === 'Node') currentNode.id = propValue;

    // connections
    if (propName in currentNode && Array.isArray(currentNode[propName])) {
      currentNode[propName].push(propValue);
    } else {
      if (propName !== 'a') currentNode[propName] = propValue;else currentNode.a = propValue;
    }
    this.setCurrentProp(currentNode, propName);

    // convert string to array, unless it ends in ',' in which case more will be added to it
    if (propName === 'a' && propValue.slice(-1) !== ',') {
      currentNode.a = parseNumberArray(propValue);
    }
  }
  parseNodePropertyContinued(line) {
    const currentNode = this.getCurrentNode();
    currentNode.a += line;

    // if the line doesn't end in ',' we have reached the end of the property value
    // so convert the string to an array
    if (line.slice(-1) !== ',') {
      currentNode.a = parseNumberArray(currentNode.a);
    }
  }

  // parse "Property70"
  parseNodeSpecialProperty(line, propName, propValue) {
    // split this
    // P: "Lcl Scaling", "Lcl Scaling", "", "A",1,1,1
    // into array like below
    // ["Lcl Scaling", "Lcl Scaling", "", "A", "1,1,1" ]
    const props = propValue.split('",').map(function (prop) {
      return prop.trim().replace(/^\"/, '').replace(/\s/, '_');
    });
    const innerPropName = props[0];
    const innerPropType1 = props[1];
    const innerPropType2 = props[2];
    const innerPropFlag = props[3];
    let innerPropValue = props[4];

    // cast values where needed, otherwise leave as strings
    switch (innerPropType1) {
      case 'int':
      case 'enum':
      case 'bool':
      case 'ULongLong':
      case 'double':
      case 'Number':
      case 'FieldOfView':
        innerPropValue = parseFloat(innerPropValue);
        break;
      case 'Color':
      case 'ColorRGB':
      case 'Vector3D':
      case 'Lcl_Translation':
      case 'Lcl_Rotation':
      case 'Lcl_Scaling':
        innerPropValue = parseNumberArray(innerPropValue);
        break;
    }

    // CAUTION: these props must append to parent's parent
    this.getPrevNode()[innerPropName] = {
      'type': innerPropType1,
      'type2': innerPropType2,
      'flag': innerPropFlag,
      'value': innerPropValue
    };
    this.setCurrentProp(this.getPrevNode(), innerPropName);
  }
}

// Parse an FBX file in Binary format
class BinaryParser {
  parse(buffer) {
    const reader = new BinaryReader(buffer);
    reader.skip(23); // skip magic 23 bytes

    const version = reader.getUint32();
    if (version < 6400) {
      throw new Error('THREE.FBXLoader: FBX version not supported, FileVersion: ' + version);
    }
    const allNodes = new FBXTree();
    while (!this.endOfContent(reader)) {
      const node = this.parseNode(reader, version);
      if (node !== null) allNodes.add(node.name, node);
    }
    return allNodes;
  }

  // Check if reader has reached the end of content.
  endOfContent(reader) {
    // footer size: 160bytes + 16-byte alignment padding
    // - 16bytes: magic
    // - padding til 16-byte alignment (at least 1byte?)
    //	(seems like some exporters embed fixed 15 or 16bytes?)
    // - 4bytes: magic
    // - 4bytes: version
    // - 120bytes: zero
    // - 16bytes: magic
    if (reader.size() % 16 === 0) {
      return (reader.getOffset() + 160 + 16 & ~0xf) >= reader.size();
    } else {
      return reader.getOffset() + 160 + 16 >= reader.size();
    }
  }

  // recursively parse nodes until the end of the file is reached
  parseNode(reader, version) {
    const node = {};

    // The first three data sizes depends on version.
    const endOffset = version >= 7500 ? reader.getUint64() : reader.getUint32();
    const numProperties = version >= 7500 ? reader.getUint64() : reader.getUint32();
    version >= 7500 ? reader.getUint64() : reader.getUint32(); // the returned propertyListLen is not used

    const nameLen = reader.getUint8();
    const name = reader.getString(nameLen);

    // Regards this node as NULL-record if endOffset is zero
    if (endOffset === 0) return null;
    const propertyList = [];
    for (let i = 0; i < numProperties; i++) {
      propertyList.push(this.parseProperty(reader));
    }

    // Regards the first three elements in propertyList as id, attrName, and attrType
    const id = propertyList.length > 0 ? propertyList[0] : '';
    const attrName = propertyList.length > 1 ? propertyList[1] : '';
    const attrType = propertyList.length > 2 ? propertyList[2] : '';

    // check if this node represents just a single property
    // like (name, 0) set or (name2, [0, 1, 2]) set of {name: 0, name2: [0, 1, 2]}
    node.singleProperty = numProperties === 1 && reader.getOffset() === endOffset ? true : false;
    while (endOffset > reader.getOffset()) {
      const subNode = this.parseNode(reader, version);
      if (subNode !== null) this.parseSubNode(name, node, subNode);
    }
    node.propertyList = propertyList; // raw property list used by parent

    if (typeof id === 'number') node.id = id;
    if (attrName !== '') node.attrName = attrName;
    if (attrType !== '') node.attrType = attrType;
    if (name !== '') node.name = name;
    return node;
  }
  parseSubNode(name, node, subNode) {
    // special case: child node is single property
    if (subNode.singleProperty === true) {
      const value = subNode.propertyList[0];
      if (Array.isArray(value)) {
        node[subNode.name] = subNode;
        subNode.a = value;
      } else {
        node[subNode.name] = value;
      }
    } else if (name === 'Connections' && subNode.name === 'C') {
      const array = [];
      subNode.propertyList.forEach(function (property, i) {
        // first Connection is FBX type (OO, OP, etc.). We'll discard these
        if (i !== 0) array.push(property);
      });
      if (node.connections === undefined) {
        node.connections = [];
      }
      node.connections.push(array);
    } else if (subNode.name === 'Properties70') {
      const keys = Object.keys(subNode);
      keys.forEach(function (key) {
        node[key] = subNode[key];
      });
    } else if (name === 'Properties70' && subNode.name === 'P') {
      let innerPropName = subNode.propertyList[0];
      let innerPropType1 = subNode.propertyList[1];
      const innerPropType2 = subNode.propertyList[2];
      const innerPropFlag = subNode.propertyList[3];
      let innerPropValue;
      if (innerPropName.indexOf('Lcl ') === 0) innerPropName = innerPropName.replace('Lcl ', 'Lcl_');
      if (innerPropType1.indexOf('Lcl ') === 0) innerPropType1 = innerPropType1.replace('Lcl ', 'Lcl_');
      if (innerPropType1 === 'Color' || innerPropType1 === 'ColorRGB' || innerPropType1 === 'Vector' || innerPropType1 === 'Vector3D' || innerPropType1.indexOf('Lcl_') === 0) {
        innerPropValue = [subNode.propertyList[4], subNode.propertyList[5], subNode.propertyList[6]];
      } else {
        innerPropValue = subNode.propertyList[4];
      }

      // this will be copied to parent, see above
      node[innerPropName] = {
        'type': innerPropType1,
        'type2': innerPropType2,
        'flag': innerPropFlag,
        'value': innerPropValue
      };
    } else if (node[subNode.name] === undefined) {
      if (typeof subNode.id === 'number') {
        node[subNode.name] = {};
        node[subNode.name][subNode.id] = subNode;
      } else {
        node[subNode.name] = subNode;
      }
    } else {
      if (subNode.name === 'PoseNode') {
        if (!Array.isArray(node[subNode.name])) {
          node[subNode.name] = [node[subNode.name]];
        }
        node[subNode.name].push(subNode);
      } else if (node[subNode.name][subNode.id] === undefined) {
        node[subNode.name][subNode.id] = subNode;
      }
    }
  }
  parseProperty(reader) {
    const type = reader.getString(1);
    let length;
    switch (type) {
      case 'C':
        return reader.getBoolean();
      case 'D':
        return reader.getFloat64();
      case 'F':
        return reader.getFloat32();
      case 'I':
        return reader.getInt32();
      case 'L':
        return reader.getInt64();
      case 'R':
        length = reader.getUint32();
        return reader.getArrayBuffer(length);
      case 'S':
        length = reader.getUint32();
        return reader.getString(length);
      case 'Y':
        return reader.getInt16();
      case 'b':
      case 'c':
      case 'd':
      case 'f':
      case 'i':
      case 'l':
        const arrayLength = reader.getUint32();
        const encoding = reader.getUint32(); // 0: non-compressed, 1: compressed
        const compressedLength = reader.getUint32();
        if (encoding === 0) {
          switch (type) {
            case 'b':
            case 'c':
              return reader.getBooleanArray(arrayLength);
            case 'd':
              return reader.getFloat64Array(arrayLength);
            case 'f':
              return reader.getFloat32Array(arrayLength);
            case 'i':
              return reader.getInt32Array(arrayLength);
            case 'l':
              return reader.getInt64Array(arrayLength);
          }
        }
        const data = unzlibSync(new Uint8Array(reader.getArrayBuffer(compressedLength)));
        const reader2 = new BinaryReader(data.buffer);
        switch (type) {
          case 'b':
          case 'c':
            return reader2.getBooleanArray(arrayLength);
          case 'd':
            return reader2.getFloat64Array(arrayLength);
          case 'f':
            return reader2.getFloat32Array(arrayLength);
          case 'i':
            return reader2.getInt32Array(arrayLength);
          case 'l':
            return reader2.getInt64Array(arrayLength);
        }
        break;
      // cannot happen but is required by the DeepScan

      default:
        throw new Error('THREE.FBXLoader: Unknown property type ' + type);
    }
  }
}
class BinaryReader {
  constructor(buffer, littleEndian) {
    this.dv = new DataView(buffer);
    this.offset = 0;
    this.littleEndian = littleEndian !== undefined ? littleEndian : true;
    this._textDecoder = new TextDecoder();
  }
  getOffset() {
    return this.offset;
  }
  size() {
    return this.dv.buffer.byteLength;
  }
  skip(length) {
    this.offset += length;
  }

  // seems like true/false representation depends on exporter.
  // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)
  // then sees LSB.
  getBoolean() {
    return (this.getUint8() & 1) === 1;
  }
  getBooleanArray(size) {
    const a = [];
    for (let i = 0; i < size; i++) {
      a.push(this.getBoolean());
    }
    return a;
  }
  getUint8() {
    const value = this.dv.getUint8(this.offset);
    this.offset += 1;
    return value;
  }
  getInt16() {
    const value = this.dv.getInt16(this.offset, this.littleEndian);
    this.offset += 2;
    return value;
  }
  getInt32() {
    const value = this.dv.getInt32(this.offset, this.littleEndian);
    this.offset += 4;
    return value;
  }
  getInt32Array(size) {
    const a = [];
    for (let i = 0; i < size; i++) {
      a.push(this.getInt32());
    }
    return a;
  }
  getUint32() {
    const value = this.dv.getUint32(this.offset, this.littleEndian);
    this.offset += 4;
    return value;
  }

  // JavaScript doesn't support 64-bit integer so calculate this here
  // 1 << 32 will return 1 so using multiply operation instead here.
  // There's a possibility that this method returns wrong value if the value
  // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.
  // TODO: safely handle 64-bit integer
  getInt64() {
    let low, high;
    if (this.littleEndian) {
      low = this.getUint32();
      high = this.getUint32();
    } else {
      high = this.getUint32();
      low = this.getUint32();
    }

    // calculate negative value
    if (high & 0x80000000) {
      high = ~high & 0xFFFFFFFF;
      low = ~low & 0xFFFFFFFF;
      if (low === 0xFFFFFFFF) high = high + 1 & 0xFFFFFFFF;
      low = low + 1 & 0xFFFFFFFF;
      return -(high * 0x100000000 + low);
    }
    return high * 0x100000000 + low;
  }
  getInt64Array(size) {
    const a = [];
    for (let i = 0; i < size; i++) {
      a.push(this.getInt64());
    }
    return a;
  }

  // Note: see getInt64() comment
  getUint64() {
    let low, high;
    if (this.littleEndian) {
      low = this.getUint32();
      high = this.getUint32();
    } else {
      high = this.getUint32();
      low = this.getUint32();
    }
    return high * 0x100000000 + low;
  }
  getFloat32() {
    const value = this.dv.getFloat32(this.offset, this.littleEndian);
    this.offset += 4;
    return value;
  }
  getFloat32Array(size) {
    const a = [];
    for (let i = 0; i < size; i++) {
      a.push(this.getFloat32());
    }
    return a;
  }
  getFloat64() {
    const value = this.dv.getFloat64(this.offset, this.littleEndian);
    this.offset += 8;
    return value;
  }
  getFloat64Array(size) {
    const a = [];
    for (let i = 0; i < size; i++) {
      a.push(this.getFloat64());
    }
    return a;
  }
  getArrayBuffer(size) {
    const value = this.dv.buffer.slice(this.offset, this.offset + size);
    this.offset += size;
    return value;
  }
  getString(size) {
    const start = this.offset;
    let a = new Uint8Array(this.dv.buffer, start, size);
    this.skip(size);
    const nullByte = a.indexOf(0);
    if (nullByte >= 0) a = new Uint8Array(this.dv.buffer, start, nullByte);
    return this._textDecoder.decode(a);
  }
}

// FBXTree holds a representation of the FBX data, returned by the TextParser ( FBX ASCII format)
// and BinaryParser( FBX Binary format)
class FBXTree {
  add(key, val) {
    this[key] = val;
  }
}

// ************** UTILITY FUNCTIONS **************

function isFbxFormatBinary(buffer) {
  const CORRECT = 'Kaydara\u0020FBX\u0020Binary\u0020\u0020\0';
  return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString(buffer, 0, CORRECT.length);
}
function isFbxFormatASCII(text) {
  const CORRECT = ['K', 'a', 'y', 'd', 'a', 'r', 'a', '\\', 'F', 'B', 'X', '\\', 'B', 'i', 'n', 'a', 'r', 'y', '\\', '\\'];
  let cursor = 0;
  function read(offset) {
    const result = text[offset - 1];
    text = text.slice(cursor + offset);
    cursor++;
    return result;
  }
  for (let i = 0; i < CORRECT.length; ++i) {
    const num = read(1);
    if (num === CORRECT[i]) {
      return false;
    }
  }
  return true;
}
function getFbxVersion(text) {
  const versionRegExp = /FBXVersion: (\d+)/;
  const match = text.match(versionRegExp);
  if (match) {
    const version = parseInt(match[1]);
    return version;
  }
  throw new Error('THREE.FBXLoader: Cannot find the version number for the file given.');
}

// Converts FBX ticks into real time seconds.
function convertFBXTimeToSeconds(time) {
  return time / 46186158000;
}
const dataArray = [];

// extracts the data from the correct position in the FBX array based on indexing type
function getData(polygonVertexIndex, polygonIndex, vertexIndex, infoObject) {
  let index;
  switch (infoObject.mappingType) {
    case 'ByPolygonVertex':
      index = polygonVertexIndex;
      break;
    case 'ByPolygon':
      index = polygonIndex;
      break;
    case 'ByVertice':
      index = vertexIndex;
      break;
    case 'AllSame':
      index = infoObject.indices[0];
      break;
    default:
      console.warn('THREE.FBXLoader: unknown attribute mapping type ' + infoObject.mappingType);
  }
  if (infoObject.referenceType === 'IndexToDirect') index = infoObject.indices[index];
  const from = index * infoObject.dataSize;
  const to = from + infoObject.dataSize;
  return slice(dataArray, infoObject.buffer, from, to);
}
const tempEuler = new Euler$1();
const tempVec = new Vector3$1();

// generate transformation from FBX transform data
// ref: https://help.autodesk.com/view/FBX/2017/ENU/?guid=__files_GUID_10CDD63C_79C1_4F2D_BB28_AD2BE65A02ED_htm
// ref: http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=cpp_ref/_transformations_2main_8cxx-example.html,topicNumber=cpp_ref__transformations_2main_8cxx_example_htmlfc10a1e1-b18d-4e72-9dc0-70d0f1959f5e
function generateTransform(transformData) {
  const lTranslationM = new Matrix4$1();
  const lPreRotationM = new Matrix4$1();
  const lRotationM = new Matrix4$1();
  const lPostRotationM = new Matrix4$1();
  const lScalingM = new Matrix4$1();
  const lScalingPivotM = new Matrix4$1();
  const lScalingOffsetM = new Matrix4$1();
  const lRotationOffsetM = new Matrix4$1();
  const lRotationPivotM = new Matrix4$1();
  const lParentGX = new Matrix4$1();
  const lParentLX = new Matrix4$1();
  const lGlobalT = new Matrix4$1();
  const inheritType = transformData.inheritType ? transformData.inheritType : 0;
  if (transformData.translation) lTranslationM.setPosition(tempVec.fromArray(transformData.translation));
  if (transformData.preRotation) {
    const array = transformData.preRotation.map(MathUtils$1.degToRad);
    array.push(transformData.eulerOrder || Euler$1.DEFAULT_ORDER);
    lPreRotationM.makeRotationFromEuler(tempEuler.fromArray(array));
  }
  if (transformData.rotation) {
    const array = transformData.rotation.map(MathUtils$1.degToRad);
    array.push(transformData.eulerOrder || Euler$1.DEFAULT_ORDER);
    lRotationM.makeRotationFromEuler(tempEuler.fromArray(array));
  }
  if (transformData.postRotation) {
    const array = transformData.postRotation.map(MathUtils$1.degToRad);
    array.push(transformData.eulerOrder || Euler$1.DEFAULT_ORDER);
    lPostRotationM.makeRotationFromEuler(tempEuler.fromArray(array));
    lPostRotationM.invert();
  }
  if (transformData.scale) lScalingM.scale(tempVec.fromArray(transformData.scale));

  // Pivots and offsets
  if (transformData.scalingOffset) lScalingOffsetM.setPosition(tempVec.fromArray(transformData.scalingOffset));
  if (transformData.scalingPivot) lScalingPivotM.setPosition(tempVec.fromArray(transformData.scalingPivot));
  if (transformData.rotationOffset) lRotationOffsetM.setPosition(tempVec.fromArray(transformData.rotationOffset));
  if (transformData.rotationPivot) lRotationPivotM.setPosition(tempVec.fromArray(transformData.rotationPivot));

  // parent transform
  if (transformData.parentMatrixWorld) {
    lParentLX.copy(transformData.parentMatrix);
    lParentGX.copy(transformData.parentMatrixWorld);
  }
  const lLRM = lPreRotationM.clone().multiply(lRotationM).multiply(lPostRotationM);
  // Global Rotation
  const lParentGRM = new Matrix4$1();
  lParentGRM.extractRotation(lParentGX);

  // Global Shear*Scaling
  const lParentTM = new Matrix4$1();
  lParentTM.copyPosition(lParentGX);
  const lParentGRSM = lParentTM.clone().invert().multiply(lParentGX);
  const lParentGSM = lParentGRM.clone().invert().multiply(lParentGRSM);
  const lLSM = lScalingM;
  const lGlobalRS = new Matrix4$1();
  if (inheritType === 0) {
    lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM).multiply(lLSM);
  } else if (inheritType === 1) {
    lGlobalRS.copy(lParentGRM).multiply(lParentGSM).multiply(lLRM).multiply(lLSM);
  } else {
    const lParentLSM = new Matrix4$1().scale(new Vector3$1().setFromMatrixScale(lParentLX));
    const lParentLSM_inv = lParentLSM.clone().invert();
    const lParentGSM_noLocal = lParentGSM.clone().multiply(lParentLSM_inv);
    lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM_noLocal).multiply(lLSM);
  }
  const lRotationPivotM_inv = lRotationPivotM.clone().invert();
  const lScalingPivotM_inv = lScalingPivotM.clone().invert();
  // Calculate the local transform matrix
  let lTransform = lTranslationM.clone().multiply(lRotationOffsetM).multiply(lRotationPivotM).multiply(lPreRotationM).multiply(lRotationM).multiply(lPostRotationM).multiply(lRotationPivotM_inv).multiply(lScalingOffsetM).multiply(lScalingPivotM).multiply(lScalingM).multiply(lScalingPivotM_inv);
  const lLocalTWithAllPivotAndOffsetInfo = new Matrix4$1().copyPosition(lTransform);
  const lGlobalTranslation = lParentGX.clone().multiply(lLocalTWithAllPivotAndOffsetInfo);
  lGlobalT.copyPosition(lGlobalTranslation);
  lTransform = lGlobalT.clone().multiply(lGlobalRS);

  // from global to local
  lTransform.premultiply(lParentGX.invert());
  return lTransform;
}

// Returns the three.js intrinsic Euler order corresponding to FBX extrinsic Euler order
// ref: http://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_class_fbx_euler_html
function getEulerOrder(order) {
  order = order || 0;
  const enums = ['ZYX',
  // -> XYZ extrinsic
  'YZX',
  // -> XZY extrinsic
  'XZY',
  // -> YZX extrinsic
  'ZXY',
  // -> YXZ extrinsic
  'YXZ',
  // -> ZXY extrinsic
  'XYZ' // -> ZYX extrinsic
  //'SphericXYZ', // not possible to support
  ];
  if (order === 6) {
    console.warn('THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.');
    return enums[0];
  }
  return enums[order];
}

// Parses comma separated list of numbers and returns them an array.
// Used internally by the TextParser
function parseNumberArray(value) {
  const array = value.split(',').map(function (val) {
    return parseFloat(val);
  });
  return array;
}
function convertArrayBufferToString(buffer, from, to) {
  if (from === undefined) from = 0;
  if (to === undefined) to = buffer.byteLength;
  return new TextDecoder().decode(new Uint8Array(buffer, from, to));
}
function append(a, b) {
  for (let i = 0, j = a.length, l = b.length; i < l; i++, j++) {
    a[j] = b[i];
  }
}
function slice(a, b, from, to) {
  for (let i = from, j = 0; i < to; i++, j++) {
    a[j] = b[i];
  }
  return a;
}

// o object_name | g group_name
const _object_pattern = /^[og]\s*(.+)?/;
// mtllib file_reference
const _material_library_pattern = /^mtllib /;
// usemtl material_name
const _material_use_pattern = /^usemtl /;
// usemap map_name
const _map_use_pattern = /^usemap /;
const _face_vertex_data_separator_pattern = /\s+/;
const _vA = new Vector3$1();
const _vB = new Vector3$1();
const _vC = new Vector3$1();
const _ab = new Vector3$1();
const _cb = new Vector3$1();
const _color = new Color$1();
function ParserState() {
  const state = {
    objects: [],
    object: {},
    vertices: [],
    normals: [],
    colors: [],
    uvs: [],
    materials: {},
    materialLibraries: [],
    startObject: function (name, fromDeclaration) {
      // If the current object (initial from reset) is not from a g/o declaration in the parsed
      // file. We need to use it for the first parsed g/o to keep things in sync.
      if (this.object && this.object.fromDeclaration === false) {
        this.object.name = name;
        this.object.fromDeclaration = fromDeclaration !== false;
        return;
      }
      const previousMaterial = this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined;
      if (this.object && typeof this.object._finalize === 'function') {
        this.object._finalize(true);
      }
      this.object = {
        name: name || '',
        fromDeclaration: fromDeclaration !== false,
        geometry: {
          vertices: [],
          normals: [],
          colors: [],
          uvs: [],
          hasUVIndices: false
        },
        materials: [],
        smooth: true,
        startMaterial: function (name, libraries) {
          const previous = this._finalize(false);

          // New usemtl declaration overwrites an inherited material, except if faces were declared
          // after the material, then it must be preserved for proper MultiMaterial continuation.
          if (previous && (previous.inherited || previous.groupCount <= 0)) {
            this.materials.splice(previous.index, 1);
          }
          const material = {
            index: this.materials.length,
            name: name || '',
            mtllib: Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : '',
            smooth: previous !== undefined ? previous.smooth : this.smooth,
            groupStart: previous !== undefined ? previous.groupEnd : 0,
            groupEnd: -1,
            groupCount: -1,
            inherited: false,
            clone: function (index) {
              const cloned = {
                index: typeof index === 'number' ? index : this.index,
                name: this.name,
                mtllib: this.mtllib,
                smooth: this.smooth,
                groupStart: 0,
                groupEnd: -1,
                groupCount: -1,
                inherited: false
              };
              cloned.clone = this.clone.bind(cloned);
              return cloned;
            }
          };
          this.materials.push(material);
          return material;
        },
        currentMaterial: function () {
          if (this.materials.length > 0) {
            return this.materials[this.materials.length - 1];
          }
          return undefined;
        },
        _finalize: function (end) {
          const lastMultiMaterial = this.currentMaterial();
          if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) {
            lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3;
            lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart;
            lastMultiMaterial.inherited = false;
          }

          // Ignore objects tail materials if no face declarations followed them before a new o/g started.
          if (end && this.materials.length > 1) {
            for (let mi = this.materials.length - 1; mi >= 0; mi--) {
              if (this.materials[mi].groupCount <= 0) {
                this.materials.splice(mi, 1);
              }
            }
          }

          // Guarantee at least one empty material, this makes the creation later more straight forward.
          if (end && this.materials.length === 0) {
            this.materials.push({
              name: '',
              smooth: this.smooth
            });
          }
          return lastMultiMaterial;
        }
      };

      // Inherit previous objects material.
      // Spec tells us that a declared material must be set to all objects until a new material is declared.
      // If a usemtl declaration is encountered while this new object is being parsed, it will
      // overwrite the inherited material. Exception being that there was already face declarations
      // to the inherited material, then it will be preserved for proper MultiMaterial continuation.

      if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function') {
        const declared = previousMaterial.clone(0);
        declared.inherited = true;
        this.object.materials.push(declared);
      }
      this.objects.push(this.object);
    },
    finalize: function () {
      if (this.object && typeof this.object._finalize === 'function') {
        this.object._finalize(true);
      }
    },
    parseVertexIndex: function (value, len) {
      const index = parseInt(value, 10);
      return (index >= 0 ? index - 1 : index + len / 3) * 3;
    },
    parseNormalIndex: function (value, len) {
      const index = parseInt(value, 10);
      return (index >= 0 ? index - 1 : index + len / 3) * 3;
    },
    parseUVIndex: function (value, len) {
      const index = parseInt(value, 10);
      return (index >= 0 ? index - 1 : index + len / 2) * 2;
    },
    addVertex: function (a, b, c) {
      const src = this.vertices;
      const dst = this.object.geometry.vertices;
      dst.push(src[a + 0], src[a + 1], src[a + 2]);
      dst.push(src[b + 0], src[b + 1], src[b + 2]);
      dst.push(src[c + 0], src[c + 1], src[c + 2]);
    },
    addVertexPoint: function (a) {
      const src = this.vertices;
      const dst = this.object.geometry.vertices;
      dst.push(src[a + 0], src[a + 1], src[a + 2]);
    },
    addVertexLine: function (a) {
      const src = this.vertices;
      const dst = this.object.geometry.vertices;
      dst.push(src[a + 0], src[a + 1], src[a + 2]);
    },
    addNormal: function (a, b, c) {
      const src = this.normals;
      const dst = this.object.geometry.normals;
      dst.push(src[a + 0], src[a + 1], src[a + 2]);
      dst.push(src[b + 0], src[b + 1], src[b + 2]);
      dst.push(src[c + 0], src[c + 1], src[c + 2]);
    },
    addFaceNormal: function (a, b, c) {
      const src = this.vertices;
      const dst = this.object.geometry.normals;
      _vA.fromArray(src, a);
      _vB.fromArray(src, b);
      _vC.fromArray(src, c);
      _cb.subVectors(_vC, _vB);
      _ab.subVectors(_vA, _vB);
      _cb.cross(_ab);
      _cb.normalize();
      dst.push(_cb.x, _cb.y, _cb.z);
      dst.push(_cb.x, _cb.y, _cb.z);
      dst.push(_cb.x, _cb.y, _cb.z);
    },
    addColor: function (a, b, c) {
      const src = this.colors;
      const dst = this.object.geometry.colors;
      if (src[a] !== undefined) dst.push(src[a + 0], src[a + 1], src[a + 2]);
      if (src[b] !== undefined) dst.push(src[b + 0], src[b + 1], src[b + 2]);
      if (src[c] !== undefined) dst.push(src[c + 0], src[c + 1], src[c + 2]);
    },
    addUV: function (a, b, c) {
      const src = this.uvs;
      const dst = this.object.geometry.uvs;
      dst.push(src[a + 0], src[a + 1]);
      dst.push(src[b + 0], src[b + 1]);
      dst.push(src[c + 0], src[c + 1]);
    },
    addDefaultUV: function () {
      const dst = this.object.geometry.uvs;
      dst.push(0, 0);
      dst.push(0, 0);
      dst.push(0, 0);
    },
    addUVLine: function (a) {
      const src = this.uvs;
      const dst = this.object.geometry.uvs;
      dst.push(src[a + 0], src[a + 1]);
    },
    addFace: function (a, b, c, ua, ub, uc, na, nb, nc) {
      const vLen = this.vertices.length;
      let ia = this.parseVertexIndex(a, vLen);
      let ib = this.parseVertexIndex(b, vLen);
      let ic = this.parseVertexIndex(c, vLen);
      this.addVertex(ia, ib, ic);
      this.addColor(ia, ib, ic);

      // normals

      if (na !== undefined && na !== '') {
        const nLen = this.normals.length;
        ia = this.parseNormalIndex(na, nLen);
        ib = this.parseNormalIndex(nb, nLen);
        ic = this.parseNormalIndex(nc, nLen);
        this.addNormal(ia, ib, ic);
      } else {
        this.addFaceNormal(ia, ib, ic);
      }

      // uvs

      if (ua !== undefined && ua !== '') {
        const uvLen = this.uvs.length;
        ia = this.parseUVIndex(ua, uvLen);
        ib = this.parseUVIndex(ub, uvLen);
        ic = this.parseUVIndex(uc, uvLen);
        this.addUV(ia, ib, ic);
        this.object.geometry.hasUVIndices = true;
      } else {
        // add placeholder values (for inconsistent face definitions)

        this.addDefaultUV();
      }
    },
    addPointGeometry: function (vertices) {
      this.object.geometry.type = 'Points';
      const vLen = this.vertices.length;
      for (let vi = 0, l = vertices.length; vi < l; vi++) {
        const index = this.parseVertexIndex(vertices[vi], vLen);
        this.addVertexPoint(index);
        this.addColor(index);
      }
    },
    addLineGeometry: function (vertices, uvs) {
      this.object.geometry.type = 'Line';
      const vLen = this.vertices.length;
      const uvLen = this.uvs.length;
      for (let vi = 0, l = vertices.length; vi < l; vi++) {
        this.addVertexLine(this.parseVertexIndex(vertices[vi], vLen));
      }
      for (let uvi = 0, l = uvs.length; uvi < l; uvi++) {
        this.addUVLine(this.parseUVIndex(uvs[uvi], uvLen));
      }
    }
  };
  state.startObject('', false);
  return state;
}

//

class OBJLoader extends Loader {
  constructor(manager) {
    super(manager);
    this.materials = null;
  }
  load(url, onLoad, onProgress, onError) {
    const scope = this;
    const loader = new FileLoader(this.manager);
    loader.setPath(this.path);
    loader.setRequestHeader(this.requestHeader);
    loader.setWithCredentials(this.withCredentials);
    loader.load(url, function (text) {
      try {
        onLoad(scope.parse(text));
      } catch (e) {
        if (onError) {
          onError(e);
        } else {
          console.error(e);
        }
        scope.manager.itemError(url);
      }
    }, onProgress, onError);
  }
  setMaterials(materials) {
    this.materials = materials;
    return this;
  }
  parse(text) {
    const state = new ParserState();
    if (text.indexOf('\r\n') !== -1) {
      // This is faster than String.split with regex that splits on both
      text = text.replace(/\r\n/g, '\n');
    }
    if (text.indexOf('\\\n') !== -1) {
      // join lines separated by a line continuation character (\)
      text = text.replace(/\\\n/g, '');
    }
    const lines = text.split('\n');
    let result = [];
    for (let i = 0, l = lines.length; i < l; i++) {
      const line = lines[i].trimStart();
      if (line.length === 0) continue;
      const lineFirstChar = line.charAt(0);

      // @todo invoke passed in handler if any
      if (lineFirstChar === '#') continue; // skip comments

      if (lineFirstChar === 'v') {
        const data = line.split(_face_vertex_data_separator_pattern);
        switch (data[0]) {
          case 'v':
            state.vertices.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]));
            if (data.length >= 7) {
              _color.setRGB(parseFloat(data[4]), parseFloat(data[5]), parseFloat(data[6])).convertSRGBToLinear();
              state.colors.push(_color.r, _color.g, _color.b);
            } else {
              // if no colors are defined, add placeholders so color and vertex indices match

              state.colors.push(undefined, undefined, undefined);
            }
            break;
          case 'vn':
            state.normals.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]));
            break;
          case 'vt':
            state.uvs.push(parseFloat(data[1]), parseFloat(data[2]));
            break;
        }
      } else if (lineFirstChar === 'f') {
        const lineData = line.slice(1).trim();
        const vertexData = lineData.split(_face_vertex_data_separator_pattern);
        const faceVertices = [];

        // Parse the face vertex data into an easy to work with format

        for (let j = 0, jl = vertexData.length; j < jl; j++) {
          const vertex = vertexData[j];
          if (vertex.length > 0) {
            const vertexParts = vertex.split('/');
            faceVertices.push(vertexParts);
          }
        }

        // Draw an edge between the first vertex and all subsequent vertices to form an n-gon

        const v1 = faceVertices[0];
        for (let j = 1, jl = faceVertices.length - 1; j < jl; j++) {
          const v2 = faceVertices[j];
          const v3 = faceVertices[j + 1];
          state.addFace(v1[0], v2[0], v3[0], v1[1], v2[1], v3[1], v1[2], v2[2], v3[2]);
        }
      } else if (lineFirstChar === 'l') {
        const lineParts = line.substring(1).trim().split(' ');
        let lineVertices = [];
        const lineUVs = [];
        if (line.indexOf('/') === -1) {
          lineVertices = lineParts;
        } else {
          for (let li = 0, llen = lineParts.length; li < llen; li++) {
            const parts = lineParts[li].split('/');
            if (parts[0] !== '') lineVertices.push(parts[0]);
            if (parts[1] !== '') lineUVs.push(parts[1]);
          }
        }
        state.addLineGeometry(lineVertices, lineUVs);
      } else if (lineFirstChar === 'p') {
        const lineData = line.slice(1).trim();
        const pointData = lineData.split(' ');
        state.addPointGeometry(pointData);
      } else if ((result = _object_pattern.exec(line)) !== null) {
        // o object_name
        // or
        // g group_name

        // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869
        // let name = result[ 0 ].slice( 1 ).trim();
        const name = (' ' + result[0].slice(1).trim()).slice(1);
        state.startObject(name);
      } else if (_material_use_pattern.test(line)) {
        // material

        state.object.startMaterial(line.substring(7).trim(), state.materialLibraries);
      } else if (_material_library_pattern.test(line)) {
        // mtl file

        state.materialLibraries.push(line.substring(7).trim());
      } else if (_map_use_pattern.test(line)) {
        // the line is parsed but ignored since the loader assumes textures are defined MTL files
        // (according to https://www.okino.com/conv/imp_wave.htm, 'usemap' is the old-style Wavefront texture reference method)

        console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
      } else if (lineFirstChar === 's') {
        result = line.split(' ');

        // smooth shading

        // @todo Handle files that have varying smooth values for a set of faces inside one geometry,
        // but does not define a usemtl for each face set.
        // This should be detected and a dummy material created (later MultiMaterial and geometry groups).
        // This requires some care to not create extra material on each smooth value for "normal" obj files.
        // where explicit usemtl defines geometry groups.
        // Example asset: examples/models/obj/cerberus/Cerberus.obj

        /*
        	 * http://paulbourke.net/dataformats/obj/
        	 *
        	 * From chapter "Grouping" Syntax explanation "s group_number":
        	 * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.
        	 * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form
        	 * surfaces, smoothing groups are either turned on or off; there is no difference between values greater
        	 * than 0."
        	 */
        if (result.length > 1) {
          const value = result[1].trim().toLowerCase();
          state.object.smooth = value !== '0' && value !== 'off';
        } else {
          // ZBrush can produce "s" lines #11707
          state.object.smooth = true;
        }
        const material = state.object.currentMaterial();
        if (material) material.smooth = state.object.smooth;
      } else {
        // Handle null terminated files without exception
        if (line === '\0') continue;
        console.warn('THREE.OBJLoader: Unexpected line: "' + line + '"');
      }
    }
    state.finalize();
    const container = new Group();
    container.materialLibraries = [].concat(state.materialLibraries);
    const hasPrimitives = !(state.objects.length === 1 && state.objects[0].geometry.vertices.length === 0);
    if (hasPrimitives === true) {
      for (let i = 0, l = state.objects.length; i < l; i++) {
        const object = state.objects[i];
        const geometry = object.geometry;
        const materials = object.materials;
        const isLine = geometry.type === 'Line';
        const isPoints = geometry.type === 'Points';
        let hasVertexColors = false;

        // Skip o/g line declarations that did not follow with any faces
        if (geometry.vertices.length === 0) continue;
        const buffergeometry = new BufferGeometry$1();
        buffergeometry.setAttribute('position', new Float32BufferAttribute$1(geometry.vertices, 3));
        if (geometry.normals.length > 0) {
          buffergeometry.setAttribute('normal', new Float32BufferAttribute$1(geometry.normals, 3));
        }
        if (geometry.colors.length > 0) {
          hasVertexColors = true;
          buffergeometry.setAttribute('color', new Float32BufferAttribute$1(geometry.colors, 3));
        }
        if (geometry.hasUVIndices === true) {
          buffergeometry.setAttribute('uv', new Float32BufferAttribute$1(geometry.uvs, 2));
        }

        // Create materials

        const createdMaterials = [];
        for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {
          const sourceMaterial = materials[mi];
          const materialHash = sourceMaterial.name + '_' + sourceMaterial.smooth + '_' + hasVertexColors;
          let material = state.materials[materialHash];
          if (this.materials !== null) {
            material = this.materials.create(sourceMaterial.name);

            // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material.
            if (isLine && material && !(material instanceof LineBasicMaterial)) {
              const materialLine = new LineBasicMaterial();
              Material$1.prototype.copy.call(materialLine, material);
              materialLine.color.copy(material.color);
              material = materialLine;
            } else if (isPoints && material && !(material instanceof PointsMaterial)) {
              const materialPoints = new PointsMaterial({
                size: 10,
                sizeAttenuation: false
              });
              Material$1.prototype.copy.call(materialPoints, material);
              materialPoints.color.copy(material.color);
              materialPoints.map = material.map;
              material = materialPoints;
            }
          }
          if (material === undefined) {
            if (isLine) {
              material = new LineBasicMaterial();
            } else if (isPoints) {
              material = new PointsMaterial({
                size: 1,
                sizeAttenuation: false
              });
            } else {
              material = new MeshPhongMaterial();
            }
            material.name = sourceMaterial.name;
            material.flatShading = sourceMaterial.smooth ? false : true;
            material.vertexColors = hasVertexColors;
            state.materials[materialHash] = material;
          }
          createdMaterials.push(material);
        }

        // Create mesh

        let mesh;
        if (createdMaterials.length > 1) {
          for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {
            const sourceMaterial = materials[mi];
            buffergeometry.addGroup(sourceMaterial.groupStart, sourceMaterial.groupCount, mi);
          }
          if (isLine) {
            mesh = new LineSegments(buffergeometry, createdMaterials);
          } else if (isPoints) {
            mesh = new Points(buffergeometry, createdMaterials);
          } else {
            mesh = new Mesh$1(buffergeometry, createdMaterials);
          }
        } else {
          if (isLine) {
            mesh = new LineSegments(buffergeometry, createdMaterials[0]);
          } else if (isPoints) {
            mesh = new Points(buffergeometry, createdMaterials[0]);
          } else {
            mesh = new Mesh$1(buffergeometry, createdMaterials[0]);
          }
        }
        mesh.name = object.name;
        container.add(mesh);
      }
    } else {
      // if there is only the default parser state object with no geometry data, interpret data as point cloud

      if (state.vertices.length > 0) {
        const material = new PointsMaterial({
          size: 1,
          sizeAttenuation: false
        });
        const buffergeometry = new BufferGeometry$1();
        buffergeometry.setAttribute('position', new Float32BufferAttribute$1(state.vertices, 3));
        if (state.colors.length > 0 && state.colors[0] !== undefined) {
          buffergeometry.setAttribute('color', new Float32BufferAttribute$1(state.colors, 3));
          material.vertexColors = true;
        }
        const points = new Points(buffergeometry, material);
        container.add(points);
      }
    }
    return container;
  }
}

class TGALoader extends DataTextureLoader {
  constructor(manager) {
    super(manager);
  }
  parse(buffer) {
    // reference from vthibault, https://github.com/vthibault/roBrowser/blob/master/src/Loaders/Targa.js

    function tgaCheckHeader(header) {
      switch (header.image_type) {
        // check indexed type

        case TGA_TYPE_INDEXED:
        case TGA_TYPE_RLE_INDEXED:
          if (header.colormap_length > 256 || header.colormap_size !== 24 || header.colormap_type !== 1) {
            throw new Error('THREE.TGALoader: Invalid type colormap data for indexed type.');
          }
          break;

        // check colormap type

        case TGA_TYPE_RGB:
        case TGA_TYPE_GREY:
        case TGA_TYPE_RLE_RGB:
        case TGA_TYPE_RLE_GREY:
          if (header.colormap_type) {
            throw new Error('THREE.TGALoader: Invalid type colormap data for colormap type.');
          }
          break;

        // What the need of a file without data ?

        case TGA_TYPE_NO_DATA:
          throw new Error('THREE.TGALoader: No data.');

        // Invalid type ?

        default:
          throw new Error('THREE.TGALoader: Invalid type ' + header.image_type);
      }

      // check image width and height

      if (header.width <= 0 || header.height <= 0) {
        throw new Error('THREE.TGALoader: Invalid image size.');
      }

      // check image pixel size

      if (header.pixel_size !== 8 && header.pixel_size !== 16 && header.pixel_size !== 24 && header.pixel_size !== 32) {
        throw new Error('THREE.TGALoader: Invalid pixel size ' + header.pixel_size);
      }
    }

    // parse tga image buffer

    function tgaParse(use_rle, use_pal, header, offset, data) {
      let pixel_data, palettes;
      const pixel_size = header.pixel_size >> 3;
      const pixel_total = header.width * header.height * pixel_size;

      // read palettes

      if (use_pal) {
        palettes = data.subarray(offset, offset += header.colormap_length * (header.colormap_size >> 3));
      }

      // read RLE

      if (use_rle) {
        pixel_data = new Uint8Array(pixel_total);
        let c, count, i;
        let shift = 0;
        const pixels = new Uint8Array(pixel_size);
        while (shift < pixel_total) {
          c = data[offset++];
          count = (c & 0x7f) + 1;

          // RLE pixels

          if (c & 0x80) {
            // bind pixel tmp array

            for (i = 0; i < pixel_size; ++i) {
              pixels[i] = data[offset++];
            }

            // copy pixel array

            for (i = 0; i < count; ++i) {
              pixel_data.set(pixels, shift + i * pixel_size);
            }
            shift += pixel_size * count;
          } else {
            // raw pixels

            count *= pixel_size;
            for (i = 0; i < count; ++i) {
              pixel_data[shift + i] = data[offset++];
            }
            shift += count;
          }
        }
      } else {
        // raw pixels

        pixel_data = data.subarray(offset, offset += use_pal ? header.width * header.height : pixel_total);
      }
      return {
        pixel_data: pixel_data,
        palettes: palettes
      };
    }
    function tgaGetImageData8bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image, palettes) {
      const colormap = palettes;
      let color,
        i = 0,
        x,
        y;
      const width = header.width;
      for (y = y_start; y !== y_end; y += y_step) {
        for (x = x_start; x !== x_end; x += x_step, i++) {
          color = image[i];
          imageData[(x + width * y) * 4 + 3] = 255;
          imageData[(x + width * y) * 4 + 2] = colormap[color * 3 + 0];
          imageData[(x + width * y) * 4 + 1] = colormap[color * 3 + 1];
          imageData[(x + width * y) * 4 + 0] = colormap[color * 3 + 2];
        }
      }
      return imageData;
    }
    function tgaGetImageData16bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) {
      let color,
        i = 0,
        x,
        y;
      const width = header.width;
      for (y = y_start; y !== y_end; y += y_step) {
        for (x = x_start; x !== x_end; x += x_step, i += 2) {
          color = image[i + 0] + (image[i + 1] << 8);
          imageData[(x + width * y) * 4 + 0] = (color & 0x7C00) >> 7;
          imageData[(x + width * y) * 4 + 1] = (color & 0x03E0) >> 2;
          imageData[(x + width * y) * 4 + 2] = (color & 0x001F) << 3;
          imageData[(x + width * y) * 4 + 3] = color & 0x8000 ? 0 : 255;
        }
      }
      return imageData;
    }
    function tgaGetImageData24bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) {
      let i = 0,
        x,
        y;
      const width = header.width;
      for (y = y_start; y !== y_end; y += y_step) {
        for (x = x_start; x !== x_end; x += x_step, i += 3) {
          imageData[(x + width * y) * 4 + 3] = 255;
          imageData[(x + width * y) * 4 + 2] = image[i + 0];
          imageData[(x + width * y) * 4 + 1] = image[i + 1];
          imageData[(x + width * y) * 4 + 0] = image[i + 2];
        }
      }
      return imageData;
    }
    function tgaGetImageData32bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) {
      let i = 0,
        x,
        y;
      const width = header.width;
      for (y = y_start; y !== y_end; y += y_step) {
        for (x = x_start; x !== x_end; x += x_step, i += 4) {
          imageData[(x + width * y) * 4 + 2] = image[i + 0];
          imageData[(x + width * y) * 4 + 1] = image[i + 1];
          imageData[(x + width * y) * 4 + 0] = image[i + 2];
          imageData[(x + width * y) * 4 + 3] = image[i + 3];
        }
      }
      return imageData;
    }
    function tgaGetImageDataGrey8bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) {
      let color,
        i = 0,
        x,
        y;
      const width = header.width;
      for (y = y_start; y !== y_end; y += y_step) {
        for (x = x_start; x !== x_end; x += x_step, i++) {
          color = image[i];
          imageData[(x + width * y) * 4 + 0] = color;
          imageData[(x + width * y) * 4 + 1] = color;
          imageData[(x + width * y) * 4 + 2] = color;
          imageData[(x + width * y) * 4 + 3] = 255;
        }
      }
      return imageData;
    }
    function tgaGetImageDataGrey16bits(imageData, y_start, y_step, y_end, x_start, x_step, x_end, image) {
      let i = 0,
        x,
        y;
      const width = header.width;
      for (y = y_start; y !== y_end; y += y_step) {
        for (x = x_start; x !== x_end; x += x_step, i += 2) {
          imageData[(x + width * y) * 4 + 0] = image[i + 0];
          imageData[(x + width * y) * 4 + 1] = image[i + 0];
          imageData[(x + width * y) * 4 + 2] = image[i + 0];
          imageData[(x + width * y) * 4 + 3] = image[i + 1];
        }
      }
      return imageData;
    }
    function getTgaRGBA(data, width, height, image, palette) {
      let x_start, y_start, x_step, y_step, x_end, y_end;
      switch ((header.flags & TGA_ORIGIN_MASK) >> TGA_ORIGIN_SHIFT) {
        default:
        case TGA_ORIGIN_UL:
          x_start = 0;
          x_step = 1;
          x_end = width;
          y_start = 0;
          y_step = 1;
          y_end = height;
          break;
        case TGA_ORIGIN_BL:
          x_start = 0;
          x_step = 1;
          x_end = width;
          y_start = height - 1;
          y_step = -1;
          y_end = -1;
          break;
        case TGA_ORIGIN_UR:
          x_start = width - 1;
          x_step = -1;
          x_end = -1;
          y_start = 0;
          y_step = 1;
          y_end = height;
          break;
        case TGA_ORIGIN_BR:
          x_start = width - 1;
          x_step = -1;
          x_end = -1;
          y_start = height - 1;
          y_step = -1;
          y_end = -1;
          break;
      }
      if (use_grey) {
        switch (header.pixel_size) {
          case 8:
            tgaGetImageDataGrey8bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);
            break;
          case 16:
            tgaGetImageDataGrey16bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);
            break;
          default:
            throw new Error('THREE.TGALoader: Format not supported.');
        }
      } else {
        switch (header.pixel_size) {
          case 8:
            tgaGetImageData8bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image, palette);
            break;
          case 16:
            tgaGetImageData16bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);
            break;
          case 24:
            tgaGetImageData24bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);
            break;
          case 32:
            tgaGetImageData32bits(data, y_start, y_step, y_end, x_start, x_step, x_end, image);
            break;
          default:
            throw new Error('THREE.TGALoader: Format not supported.');
        }
      }

      // Load image data according to specific method
      // let func = 'tgaGetImageData' + (use_grey ? 'Grey' : '') + (header.pixel_size) + 'bits';
      // func(data, y_start, y_step, y_end, x_start, x_step, x_end, width, image, palette );
      return data;
    }

    // TGA constants

    const TGA_TYPE_NO_DATA = 0,
      TGA_TYPE_INDEXED = 1,
      TGA_TYPE_RGB = 2,
      TGA_TYPE_GREY = 3,
      TGA_TYPE_RLE_INDEXED = 9,
      TGA_TYPE_RLE_RGB = 10,
      TGA_TYPE_RLE_GREY = 11,
      TGA_ORIGIN_MASK = 0x30,
      TGA_ORIGIN_SHIFT = 0x04,
      TGA_ORIGIN_BL = 0x00,
      TGA_ORIGIN_BR = 0x01,
      TGA_ORIGIN_UL = 0x02,
      TGA_ORIGIN_UR = 0x03;
    if (buffer.length < 19) throw new Error('THREE.TGALoader: Not enough data to contain header.');
    let offset = 0;
    const content = new Uint8Array(buffer),
      header = {
        id_length: content[offset++],
        colormap_type: content[offset++],
        image_type: content[offset++],
        colormap_index: content[offset++] | content[offset++] << 8,
        colormap_length: content[offset++] | content[offset++] << 8,
        colormap_size: content[offset++],
        origin: [content[offset++] | content[offset++] << 8, content[offset++] | content[offset++] << 8],
        width: content[offset++] | content[offset++] << 8,
        height: content[offset++] | content[offset++] << 8,
        pixel_size: content[offset++],
        flags: content[offset++]
      };

    // check tga if it is valid format

    tgaCheckHeader(header);
    if (header.id_length + offset > buffer.length) {
      throw new Error('THREE.TGALoader: No data.');
    }

    // skip the needn't data

    offset += header.id_length;

    // get targa information about RLE compression and palette

    let use_rle = false,
      use_pal = false,
      use_grey = false;
    switch (header.image_type) {
      case TGA_TYPE_RLE_INDEXED:
        use_rle = true;
        use_pal = true;
        break;
      case TGA_TYPE_INDEXED:
        use_pal = true;
        break;
      case TGA_TYPE_RLE_RGB:
        use_rle = true;
        break;
      case TGA_TYPE_RGB:
        break;
      case TGA_TYPE_RLE_GREY:
        use_rle = true;
        use_grey = true;
        break;
      case TGA_TYPE_GREY:
        use_grey = true;
        break;
    }

    //

    const imageData = new Uint8Array(header.width * header.height * 4);
    const result = tgaParse(use_rle, use_pal, header, offset, content);
    getTgaRGBA(imageData, header.width, header.height, result.pixel_data, result.palettes);
    return {
      data: imageData,
      width: header.width,
      height: header.height,
      flipY: true,
      generateMipmaps: true,
      minFilter: LinearMipmapLinearFilter$1
    };
  }
}

class ColladaLoader extends Loader {
  load(url, onLoad, onProgress, onError) {
    const scope = this;
    const path = scope.path === '' ? LoaderUtils.extractUrlBase(url) : scope.path;
    const loader = new FileLoader(scope.manager);
    loader.setPath(scope.path);
    loader.setRequestHeader(scope.requestHeader);
    loader.setWithCredentials(scope.withCredentials);
    loader.load(url, function (text) {
      try {
        onLoad(scope.parse(text, path));
      } catch (e) {
        if (onError) {
          onError(e);
        } else {
          console.error(e);
        }
        scope.manager.itemError(url);
      }
    }, onProgress, onError);
  }
  parse(text, path) {
    function getElementsByTagName(xml, name) {
      // Non recursive xml.getElementsByTagName() ...

      const array = [];
      const childNodes = xml.childNodes;
      for (let i = 0, l = childNodes.length; i < l; i++) {
        const child = childNodes[i];
        if (child.nodeName === name) {
          array.push(child);
        }
      }
      return array;
    }
    function parseStrings(text) {
      if (text.length === 0) return [];
      const parts = text.trim().split(/\s+/);
      const array = new Array(parts.length);
      for (let i = 0, l = parts.length; i < l; i++) {
        array[i] = parts[i];
      }
      return array;
    }
    function parseFloats(text) {
      if (text.length === 0) return [];
      const parts = text.trim().split(/\s+/);
      const array = new Array(parts.length);
      for (let i = 0, l = parts.length; i < l; i++) {
        array[i] = parseFloat(parts[i]);
      }
      return array;
    }
    function parseInts(text) {
      if (text.length === 0) return [];
      const parts = text.trim().split(/\s+/);
      const array = new Array(parts.length);
      for (let i = 0, l = parts.length; i < l; i++) {
        array[i] = parseInt(parts[i]);
      }
      return array;
    }
    function parseId(text) {
      return text.substring(1);
    }
    function generateId() {
      return 'three_default_' + count++;
    }
    function isEmpty(object) {
      return Object.keys(object).length === 0;
    }

    // asset

    function parseAsset(xml) {
      return {
        unit: parseAssetUnit(getElementsByTagName(xml, 'unit')[0]),
        upAxis: parseAssetUpAxis(getElementsByTagName(xml, 'up_axis')[0])
      };
    }
    function parseAssetUnit(xml) {
      if (xml !== undefined && xml.hasAttribute('meter') === true) {
        return parseFloat(xml.getAttribute('meter'));
      } else {
        return 1; // default 1 meter
      }
    }
    function parseAssetUpAxis(xml) {
      return xml !== undefined ? xml.textContent : 'Y_UP';
    }

    // library

    function parseLibrary(xml, libraryName, nodeName, parser) {
      const library = getElementsByTagName(xml, libraryName)[0];
      if (library !== undefined) {
        const elements = getElementsByTagName(library, nodeName);
        for (let i = 0; i < elements.length; i++) {
          parser(elements[i]);
        }
      }
    }
    function buildLibrary(data, builder) {
      for (const name in data) {
        const object = data[name];
        object.build = builder(data[name]);
      }
    }

    // get

    function getBuild(data, builder) {
      if (data.build !== undefined) return data.build;
      data.build = builder(data);
      return data.build;
    }

    // animation

    function parseAnimation(xml) {
      const data = {
        sources: {},
        samplers: {},
        channels: {}
      };
      let hasChildren = false;
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        let id;
        switch (child.nodeName) {
          case 'source':
            id = child.getAttribute('id');
            data.sources[id] = parseSource(child);
            break;
          case 'sampler':
            id = child.getAttribute('id');
            data.samplers[id] = parseAnimationSampler(child);
            break;
          case 'channel':
            id = child.getAttribute('target');
            data.channels[id] = parseAnimationChannel(child);
            break;
          case 'animation':
            // hierarchy of related animations
            parseAnimation(child);
            hasChildren = true;
            break;
          default:
            console.log(child);
        }
      }
      if (hasChildren === false) {
        // since 'id' attributes can be optional, it's necessary to generate a UUID for unqiue assignment

        library.animations[xml.getAttribute('id') || MathUtils$1.generateUUID()] = data;
      }
    }
    function parseAnimationSampler(xml) {
      const data = {
        inputs: {}
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'input':
            const id = parseId(child.getAttribute('source'));
            const semantic = child.getAttribute('semantic');
            data.inputs[semantic] = id;
            break;
        }
      }
      return data;
    }
    function parseAnimationChannel(xml) {
      const data = {};
      const target = xml.getAttribute('target');

      // parsing SID Addressing Syntax

      let parts = target.split('/');
      const id = parts.shift();
      let sid = parts.shift();

      // check selection syntax

      const arraySyntax = sid.indexOf('(') !== -1;
      const memberSyntax = sid.indexOf('.') !== -1;
      if (memberSyntax) {
        //  member selection access

        parts = sid.split('.');
        sid = parts.shift();
        data.member = parts.shift();
      } else if (arraySyntax) {
        // array-access syntax. can be used to express fields in one-dimensional vectors or two-dimensional matrices.

        const indices = sid.split('(');
        sid = indices.shift();
        for (let i = 0; i < indices.length; i++) {
          indices[i] = parseInt(indices[i].replace(/\)/, ''));
        }
        data.indices = indices;
      }
      data.id = id;
      data.sid = sid;
      data.arraySyntax = arraySyntax;
      data.memberSyntax = memberSyntax;
      data.sampler = parseId(xml.getAttribute('source'));
      return data;
    }
    function buildAnimation(data) {
      const tracks = [];
      const channels = data.channels;
      const samplers = data.samplers;
      const sources = data.sources;
      for (const target in channels) {
        if (channels.hasOwnProperty(target)) {
          const channel = channels[target];
          const sampler = samplers[channel.sampler];
          const inputId = sampler.inputs.INPUT;
          const outputId = sampler.inputs.OUTPUT;
          const inputSource = sources[inputId];
          const outputSource = sources[outputId];
          const animation = buildAnimationChannel(channel, inputSource, outputSource);
          createKeyframeTracks(animation, tracks);
        }
      }
      return tracks;
    }
    function getAnimation(id) {
      return getBuild(library.animations[id], buildAnimation);
    }
    function buildAnimationChannel(channel, inputSource, outputSource) {
      const node = library.nodes[channel.id];
      const object3D = getNode(node.id);
      const transform = node.transforms[channel.sid];
      const defaultMatrix = node.matrix.clone().transpose();
      let time, stride;
      let i, il, j, jl;
      const data = {};

      // the collada spec allows the animation of data in various ways.
      // depending on the transform type (matrix, translate, rotate, scale), we execute different logic

      switch (transform) {
        case 'matrix':
          for (i = 0, il = inputSource.array.length; i < il; i++) {
            time = inputSource.array[i];
            stride = i * outputSource.stride;
            if (data[time] === undefined) data[time] = {};
            if (channel.arraySyntax === true) {
              const value = outputSource.array[stride];
              const index = channel.indices[0] + 4 * channel.indices[1];
              data[time][index] = value;
            } else {
              for (j = 0, jl = outputSource.stride; j < jl; j++) {
                data[time][j] = outputSource.array[stride + j];
              }
            }
          }
          break;
        case 'translate':
          console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.', transform);
          break;
        case 'rotate':
          console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.', transform);
          break;
        case 'scale':
          console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.', transform);
          break;
      }
      const keyframes = prepareAnimationData(data, defaultMatrix);
      const animation = {
        name: object3D.uuid,
        keyframes: keyframes
      };
      return animation;
    }
    function prepareAnimationData(data, defaultMatrix) {
      const keyframes = [];

      // transfer data into a sortable array

      for (const time in data) {
        keyframes.push({
          time: parseFloat(time),
          value: data[time]
        });
      }

      // ensure keyframes are sorted by time

      keyframes.sort(ascending);

      // now we clean up all animation data, so we can use them for keyframe tracks

      for (let i = 0; i < 16; i++) {
        transformAnimationData(keyframes, i, defaultMatrix.elements[i]);
      }
      return keyframes;

      // array sort function

      function ascending(a, b) {
        return a.time - b.time;
      }
    }
    const position = new Vector3$1();
    const scale = new Vector3$1();
    const quaternion = new Quaternion$1();
    function createKeyframeTracks(animation, tracks) {
      const keyframes = animation.keyframes;
      const name = animation.name;
      const times = [];
      const positionData = [];
      const quaternionData = [];
      const scaleData = [];
      for (let i = 0, l = keyframes.length; i < l; i++) {
        const keyframe = keyframes[i];
        const time = keyframe.time;
        const value = keyframe.value;
        matrix.fromArray(value).transpose();
        matrix.decompose(position, quaternion, scale);
        times.push(time);
        positionData.push(position.x, position.y, position.z);
        quaternionData.push(quaternion.x, quaternion.y, quaternion.z, quaternion.w);
        scaleData.push(scale.x, scale.y, scale.z);
      }
      if (positionData.length > 0) tracks.push(new VectorKeyframeTrack(name + '.position', times, positionData));
      if (quaternionData.length > 0) tracks.push(new QuaternionKeyframeTrack(name + '.quaternion', times, quaternionData));
      if (scaleData.length > 0) tracks.push(new VectorKeyframeTrack(name + '.scale', times, scaleData));
      return tracks;
    }
    function transformAnimationData(keyframes, property, defaultValue) {
      let keyframe;
      let empty = true;
      let i, l;

      // check, if values of a property are missing in our keyframes

      for (i = 0, l = keyframes.length; i < l; i++) {
        keyframe = keyframes[i];
        if (keyframe.value[property] === undefined) {
          keyframe.value[property] = null; // mark as missing
        } else {
          empty = false;
        }
      }
      if (empty === true) {
        // no values at all, so we set a default value

        for (i = 0, l = keyframes.length; i < l; i++) {
          keyframe = keyframes[i];
          keyframe.value[property] = defaultValue;
        }
      } else {
        // filling gaps

        createMissingKeyframes(keyframes, property);
      }
    }
    function createMissingKeyframes(keyframes, property) {
      let prev, next;
      for (let i = 0, l = keyframes.length; i < l; i++) {
        const keyframe = keyframes[i];
        if (keyframe.value[property] === null) {
          prev = getPrev(keyframes, i, property);
          next = getNext(keyframes, i, property);
          if (prev === null) {
            keyframe.value[property] = next.value[property];
            continue;
          }
          if (next === null) {
            keyframe.value[property] = prev.value[property];
            continue;
          }
          interpolate(keyframe, prev, next, property);
        }
      }
    }
    function getPrev(keyframes, i, property) {
      while (i >= 0) {
        const keyframe = keyframes[i];
        if (keyframe.value[property] !== null) return keyframe;
        i--;
      }
      return null;
    }
    function getNext(keyframes, i, property) {
      while (i < keyframes.length) {
        const keyframe = keyframes[i];
        if (keyframe.value[property] !== null) return keyframe;
        i++;
      }
      return null;
    }
    function interpolate(key, prev, next, property) {
      if (next.time - prev.time === 0) {
        key.value[property] = prev.value[property];
        return;
      }
      key.value[property] = (key.time - prev.time) * (next.value[property] - prev.value[property]) / (next.time - prev.time) + prev.value[property];
    }

    // animation clips

    function parseAnimationClip(xml) {
      const data = {
        name: xml.getAttribute('id') || 'default',
        start: parseFloat(xml.getAttribute('start') || 0),
        end: parseFloat(xml.getAttribute('end') || 0),
        animations: []
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'instance_animation':
            data.animations.push(parseId(child.getAttribute('url')));
            break;
        }
      }
      library.clips[xml.getAttribute('id')] = data;
    }
    function buildAnimationClip(data) {
      const tracks = [];
      const name = data.name;
      const duration = data.end - data.start || -1;
      const animations = data.animations;
      for (let i = 0, il = animations.length; i < il; i++) {
        const animationTracks = getAnimation(animations[i]);
        for (let j = 0, jl = animationTracks.length; j < jl; j++) {
          tracks.push(animationTracks[j]);
        }
      }
      return new AnimationClip(name, duration, tracks);
    }
    function getAnimationClip(id) {
      return getBuild(library.clips[id], buildAnimationClip);
    }

    // controller

    function parseController(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'skin':
            // there is exactly one skin per controller
            data.id = parseId(child.getAttribute('source'));
            data.skin = parseSkin(child);
            break;
          case 'morph':
            data.id = parseId(child.getAttribute('source'));
            console.warn('THREE.ColladaLoader: Morph target animation not supported yet.');
            break;
        }
      }
      library.controllers[xml.getAttribute('id')] = data;
    }
    function parseSkin(xml) {
      const data = {
        sources: {}
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'bind_shape_matrix':
            data.bindShapeMatrix = parseFloats(child.textContent);
            break;
          case 'source':
            const id = child.getAttribute('id');
            data.sources[id] = parseSource(child);
            break;
          case 'joints':
            data.joints = parseJoints(child);
            break;
          case 'vertex_weights':
            data.vertexWeights = parseVertexWeights(child);
            break;
        }
      }
      return data;
    }
    function parseJoints(xml) {
      const data = {
        inputs: {}
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'input':
            const semantic = child.getAttribute('semantic');
            const id = parseId(child.getAttribute('source'));
            data.inputs[semantic] = id;
            break;
        }
      }
      return data;
    }
    function parseVertexWeights(xml) {
      const data = {
        inputs: {}
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'input':
            const semantic = child.getAttribute('semantic');
            const id = parseId(child.getAttribute('source'));
            const offset = parseInt(child.getAttribute('offset'));
            data.inputs[semantic] = {
              id: id,
              offset: offset
            };
            break;
          case 'vcount':
            data.vcount = parseInts(child.textContent);
            break;
          case 'v':
            data.v = parseInts(child.textContent);
            break;
        }
      }
      return data;
    }
    function buildController(data) {
      const build = {
        id: data.id
      };
      const geometry = library.geometries[build.id];
      if (data.skin !== undefined) {
        build.skin = buildSkin(data.skin);

        // we enhance the 'sources' property of the corresponding geometry with our skin data

        geometry.sources.skinIndices = build.skin.indices;
        geometry.sources.skinWeights = build.skin.weights;
      }
      return build;
    }
    function buildSkin(data) {
      const BONE_LIMIT = 4;
      const build = {
        joints: [],
        // this must be an array to preserve the joint order
        indices: {
          array: [],
          stride: BONE_LIMIT
        },
        weights: {
          array: [],
          stride: BONE_LIMIT
        }
      };
      const sources = data.sources;
      const vertexWeights = data.vertexWeights;
      const vcount = vertexWeights.vcount;
      const v = vertexWeights.v;
      const jointOffset = vertexWeights.inputs.JOINT.offset;
      const weightOffset = vertexWeights.inputs.WEIGHT.offset;
      const jointSource = data.sources[data.joints.inputs.JOINT];
      const inverseSource = data.sources[data.joints.inputs.INV_BIND_MATRIX];
      const weights = sources[vertexWeights.inputs.WEIGHT.id].array;
      let stride = 0;
      let i, j, l;

      // process skin data for each vertex

      for (i = 0, l = vcount.length; i < l; i++) {
        const jointCount = vcount[i]; // this is the amount of joints that affect a single vertex
        const vertexSkinData = [];
        for (j = 0; j < jointCount; j++) {
          const skinIndex = v[stride + jointOffset];
          const weightId = v[stride + weightOffset];
          const skinWeight = weights[weightId];
          vertexSkinData.push({
            index: skinIndex,
            weight: skinWeight
          });
          stride += 2;
        }

        // we sort the joints in descending order based on the weights.
        // this ensures, we only procced the most important joints of the vertex

        vertexSkinData.sort(descending);

        // now we provide for each vertex a set of four index and weight values.
        // the order of the skin data matches the order of vertices

        for (j = 0; j < BONE_LIMIT; j++) {
          const d = vertexSkinData[j];
          if (d !== undefined) {
            build.indices.array.push(d.index);
            build.weights.array.push(d.weight);
          } else {
            build.indices.array.push(0);
            build.weights.array.push(0);
          }
        }
      }

      // setup bind matrix

      if (data.bindShapeMatrix) {
        build.bindMatrix = new Matrix4$1().fromArray(data.bindShapeMatrix).transpose();
      } else {
        build.bindMatrix = new Matrix4$1().identity();
      }

      // process bones and inverse bind matrix data

      for (i = 0, l = jointSource.array.length; i < l; i++) {
        const name = jointSource.array[i];
        const boneInverse = new Matrix4$1().fromArray(inverseSource.array, i * inverseSource.stride).transpose();
        build.joints.push({
          name: name,
          boneInverse: boneInverse
        });
      }
      return build;

      // array sort function

      function descending(a, b) {
        return b.weight - a.weight;
      }
    }
    function getController(id) {
      return getBuild(library.controllers[id], buildController);
    }

    // image

    function parseImage(xml) {
      const data = {
        init_from: getElementsByTagName(xml, 'init_from')[0].textContent
      };
      library.images[xml.getAttribute('id')] = data;
    }
    function buildImage(data) {
      if (data.build !== undefined) return data.build;
      return data.init_from;
    }
    function getImage(id) {
      const data = library.images[id];
      if (data !== undefined) {
        return getBuild(data, buildImage);
      }
      console.warn('THREE.ColladaLoader: Couldn\'t find image with ID:', id);
      return null;
    }

    // effect

    function parseEffect(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'profile_COMMON':
            data.profile = parseEffectProfileCOMMON(child);
            break;
        }
      }
      library.effects[xml.getAttribute('id')] = data;
    }
    function parseEffectProfileCOMMON(xml) {
      const data = {
        surfaces: {},
        samplers: {}
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'newparam':
            parseEffectNewparam(child, data);
            break;
          case 'technique':
            data.technique = parseEffectTechnique(child);
            break;
          case 'extra':
            data.extra = parseEffectExtra(child);
            break;
        }
      }
      return data;
    }
    function parseEffectNewparam(xml, data) {
      const sid = xml.getAttribute('sid');
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'surface':
            data.surfaces[sid] = parseEffectSurface(child);
            break;
          case 'sampler2D':
            data.samplers[sid] = parseEffectSampler(child);
            break;
        }
      }
    }
    function parseEffectSurface(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'init_from':
            data.init_from = child.textContent;
            break;
        }
      }
      return data;
    }
    function parseEffectSampler(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'source':
            data.source = child.textContent;
            break;
        }
      }
      return data;
    }
    function parseEffectTechnique(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'constant':
          case 'lambert':
          case 'blinn':
          case 'phong':
            data.type = child.nodeName;
            data.parameters = parseEffectParameters(child);
            break;
          case 'extra':
            data.extra = parseEffectExtra(child);
            break;
        }
      }
      return data;
    }
    function parseEffectParameters(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'emission':
          case 'diffuse':
          case 'specular':
          case 'bump':
          case 'ambient':
          case 'shininess':
          case 'transparency':
            data[child.nodeName] = parseEffectParameter(child);
            break;
          case 'transparent':
            data[child.nodeName] = {
              opaque: child.hasAttribute('opaque') ? child.getAttribute('opaque') : 'A_ONE',
              data: parseEffectParameter(child)
            };
            break;
        }
      }
      return data;
    }
    function parseEffectParameter(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'color':
            data[child.nodeName] = parseFloats(child.textContent);
            break;
          case 'float':
            data[child.nodeName] = parseFloat(child.textContent);
            break;
          case 'texture':
            data[child.nodeName] = {
              id: child.getAttribute('texture'),
              extra: parseEffectParameterTexture(child)
            };
            break;
        }
      }
      return data;
    }
    function parseEffectParameterTexture(xml) {
      const data = {
        technique: {}
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'extra':
            parseEffectParameterTextureExtra(child, data);
            break;
        }
      }
      return data;
    }
    function parseEffectParameterTextureExtra(xml, data) {
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'technique':
            parseEffectParameterTextureExtraTechnique(child, data);
            break;
        }
      }
    }
    function parseEffectParameterTextureExtraTechnique(xml, data) {
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'repeatU':
          case 'repeatV':
          case 'offsetU':
          case 'offsetV':
            data.technique[child.nodeName] = parseFloat(child.textContent);
            break;
          case 'wrapU':
          case 'wrapV':
            // some files have values for wrapU/wrapV which become NaN via parseInt

            if (child.textContent.toUpperCase() === 'TRUE') {
              data.technique[child.nodeName] = 1;
            } else if (child.textContent.toUpperCase() === 'FALSE') {
              data.technique[child.nodeName] = 0;
            } else {
              data.technique[child.nodeName] = parseInt(child.textContent);
            }
            break;
          case 'bump':
            data[child.nodeName] = parseEffectExtraTechniqueBump(child);
            break;
        }
      }
    }
    function parseEffectExtra(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'technique':
            data.technique = parseEffectExtraTechnique(child);
            break;
        }
      }
      return data;
    }
    function parseEffectExtraTechnique(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'double_sided':
            data[child.nodeName] = parseInt(child.textContent);
            break;
          case 'bump':
            data[child.nodeName] = parseEffectExtraTechniqueBump(child);
            break;
        }
      }
      return data;
    }
    function parseEffectExtraTechniqueBump(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'texture':
            data[child.nodeName] = {
              id: child.getAttribute('texture'),
              texcoord: child.getAttribute('texcoord'),
              extra: parseEffectParameterTexture(child)
            };
            break;
        }
      }
      return data;
    }
    function buildEffect(data) {
      return data;
    }
    function getEffect(id) {
      return getBuild(library.effects[id], buildEffect);
    }

    // material

    function parseMaterial(xml) {
      const data = {
        name: xml.getAttribute('name')
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'instance_effect':
            data.url = parseId(child.getAttribute('url'));
            break;
        }
      }
      library.materials[xml.getAttribute('id')] = data;
    }
    function getTextureLoader(image) {
      let loader;
      let extension = image.slice((image.lastIndexOf('.') - 1 >>> 0) + 2); // http://www.jstips.co/en/javascript/get-file-extension/
      extension = extension.toLowerCase();
      switch (extension) {
        case 'tga':
          loader = tgaLoader;
          break;
        default:
          loader = textureLoader;
      }
      return loader;
    }
    function buildMaterial(data) {
      const effect = getEffect(data.url);
      const technique = effect.profile.technique;
      let material;
      switch (technique.type) {
        case 'phong':
        case 'blinn':
          material = new MeshPhongMaterial();
          break;
        case 'lambert':
          material = new MeshLambertMaterial();
          break;
        default:
          material = new MeshBasicMaterial$1();
          break;
      }
      material.name = data.name || '';
      function getTexture(textureObject, colorSpace = null) {
        const sampler = effect.profile.samplers[textureObject.id];
        let image = null;

        // get image

        if (sampler !== undefined) {
          const surface = effect.profile.surfaces[sampler.source];
          image = getImage(surface.init_from);
        } else {
          console.warn('THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530).');
          image = getImage(textureObject.id);
        }

        // create texture if image is avaiable

        if (image !== null) {
          const loader = getTextureLoader(image);
          if (loader !== undefined) {
            const texture = loader.load(image);
            const extra = textureObject.extra;
            if (extra !== undefined && extra.technique !== undefined && isEmpty(extra.technique) === false) {
              const technique = extra.technique;
              texture.wrapS = technique.wrapU ? RepeatWrapping$1 : ClampToEdgeWrapping$1;
              texture.wrapT = technique.wrapV ? RepeatWrapping$1 : ClampToEdgeWrapping$1;
              texture.offset.set(technique.offsetU || 0, technique.offsetV || 0);
              texture.repeat.set(technique.repeatU || 1, technique.repeatV || 1);
            } else {
              texture.wrapS = RepeatWrapping$1;
              texture.wrapT = RepeatWrapping$1;
            }
            if (colorSpace !== null) {
              texture.colorSpace = colorSpace;
            }
            return texture;
          } else {
            console.warn('THREE.ColladaLoader: Loader for texture %s not found.', image);
            return null;
          }
        } else {
          console.warn('THREE.ColladaLoader: Couldn\'t create texture with ID:', textureObject.id);
          return null;
        }
      }
      const parameters = technique.parameters;
      for (const key in parameters) {
        const parameter = parameters[key];
        switch (key) {
          case 'diffuse':
            if (parameter.color) material.color.fromArray(parameter.color);
            if (parameter.texture) material.map = getTexture(parameter.texture, SRGBColorSpace$1);
            break;
          case 'specular':
            if (parameter.color && material.specular) material.specular.fromArray(parameter.color);
            if (parameter.texture) material.specularMap = getTexture(parameter.texture);
            break;
          case 'bump':
            if (parameter.texture) material.normalMap = getTexture(parameter.texture);
            break;
          case 'ambient':
            if (parameter.texture) material.lightMap = getTexture(parameter.texture, SRGBColorSpace$1);
            break;
          case 'shininess':
            if (parameter.float && material.shininess) material.shininess = parameter.float;
            break;
          case 'emission':
            if (parameter.color && material.emissive) material.emissive.fromArray(parameter.color);
            if (parameter.texture) material.emissiveMap = getTexture(parameter.texture, SRGBColorSpace$1);
            break;
        }
      }
      material.color.convertSRGBToLinear();
      if (material.specular) material.specular.convertSRGBToLinear();
      if (material.emissive) material.emissive.convertSRGBToLinear();

      //

      let transparent = parameters['transparent'];
      let transparency = parameters['transparency'];

      // <transparency> does not exist but <transparent>

      if (transparency === undefined && transparent) {
        transparency = {
          float: 1
        };
      }

      // <transparent> does not exist but <transparency>

      if (transparent === undefined && transparency) {
        transparent = {
          opaque: 'A_ONE',
          data: {
            color: [1, 1, 1, 1]
          }
        };
      }
      if (transparent && transparency) {
        // handle case if a texture exists but no color

        if (transparent.data.texture) {
          // we do not set an alpha map (see #13792)

          material.transparent = true;
        } else {
          const color = transparent.data.color;
          switch (transparent.opaque) {
            case 'A_ONE':
              material.opacity = color[3] * transparency.float;
              break;
            case 'RGB_ZERO':
              material.opacity = 1 - color[0] * transparency.float;
              break;
            case 'A_ZERO':
              material.opacity = 1 - color[3] * transparency.float;
              break;
            case 'RGB_ONE':
              material.opacity = color[0] * transparency.float;
              break;
            default:
              console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.', transparent.opaque);
          }
          if (material.opacity < 1) material.transparent = true;
        }
      }

      //

      if (technique.extra !== undefined && technique.extra.technique !== undefined) {
        const techniques = technique.extra.technique;
        for (const k in techniques) {
          const v = techniques[k];
          switch (k) {
            case 'double_sided':
              material.side = v === 1 ? DoubleSide : FrontSide$1;
              break;
            case 'bump':
              material.normalMap = getTexture(v.texture);
              material.normalScale = new Vector2$1(1, 1);
              break;
          }
        }
      }
      return material;
    }
    function getMaterial(id) {
      return getBuild(library.materials[id], buildMaterial);
    }

    // camera

    function parseCamera(xml) {
      const data = {
        name: xml.getAttribute('name')
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'optics':
            data.optics = parseCameraOptics(child);
            break;
        }
      }
      library.cameras[xml.getAttribute('id')] = data;
    }
    function parseCameraOptics(xml) {
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        switch (child.nodeName) {
          case 'technique_common':
            return parseCameraTechnique(child);
        }
      }
      return {};
    }
    function parseCameraTechnique(xml) {
      const data = {};
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        switch (child.nodeName) {
          case 'perspective':
          case 'orthographic':
            data.technique = child.nodeName;
            data.parameters = parseCameraParameters(child);
            break;
        }
      }
      return data;
    }
    function parseCameraParameters(xml) {
      const data = {};
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        switch (child.nodeName) {
          case 'xfov':
          case 'yfov':
          case 'xmag':
          case 'ymag':
          case 'znear':
          case 'zfar':
          case 'aspect_ratio':
            data[child.nodeName] = parseFloat(child.textContent);
            break;
        }
      }
      return data;
    }
    function buildCamera(data) {
      let camera;
      switch (data.optics.technique) {
        case 'perspective':
          camera = new PerspectiveCamera$1(data.optics.parameters.yfov, data.optics.parameters.aspect_ratio, data.optics.parameters.znear, data.optics.parameters.zfar);
          break;
        case 'orthographic':
          let ymag = data.optics.parameters.ymag;
          let xmag = data.optics.parameters.xmag;
          const aspectRatio = data.optics.parameters.aspect_ratio;
          xmag = xmag === undefined ? ymag * aspectRatio : xmag;
          ymag = ymag === undefined ? xmag / aspectRatio : ymag;
          xmag *= 0.5;
          ymag *= 0.5;
          camera = new OrthographicCamera$1(-xmag, xmag, ymag, -ymag,
          // left, right, top, bottom
          data.optics.parameters.znear, data.optics.parameters.zfar);
          break;
        default:
          camera = new PerspectiveCamera$1();
          break;
      }
      camera.name = data.name || '';
      return camera;
    }
    function getCamera(id) {
      const data = library.cameras[id];
      if (data !== undefined) {
        return getBuild(data, buildCamera);
      }
      console.warn('THREE.ColladaLoader: Couldn\'t find camera with ID:', id);
      return null;
    }

    // light

    function parseLight(xml) {
      let data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'technique_common':
            data = parseLightTechnique(child);
            break;
        }
      }
      library.lights[xml.getAttribute('id')] = data;
    }
    function parseLightTechnique(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'directional':
          case 'point':
          case 'spot':
          case 'ambient':
            data.technique = child.nodeName;
            data.parameters = parseLightParameters(child);
        }
      }
      return data;
    }
    function parseLightParameters(xml) {
      const data = {};
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'color':
            const array = parseFloats(child.textContent);
            data.color = new Color$1().fromArray(array).convertSRGBToLinear();
            break;
          case 'falloff_angle':
            data.falloffAngle = parseFloat(child.textContent);
            break;
          case 'quadratic_attenuation':
            const f = parseFloat(child.textContent);
            data.distance = f ? Math.sqrt(1 / f) : 0;
            break;
        }
      }
      return data;
    }
    function buildLight(data) {
      let light;
      switch (data.technique) {
        case 'directional':
          light = new DirectionalLight();
          break;
        case 'point':
          light = new PointLight();
          break;
        case 'spot':
          light = new SpotLight();
          break;
        case 'ambient':
          light = new AmbientLight();
          break;
      }
      if (data.parameters.color) light.color.copy(data.parameters.color);
      if (data.parameters.distance) light.distance = data.parameters.distance;
      return light;
    }
    function getLight(id) {
      const data = library.lights[id];
      if (data !== undefined) {
        return getBuild(data, buildLight);
      }
      console.warn('THREE.ColladaLoader: Couldn\'t find light with ID:', id);
      return null;
    }

    // geometry

    function parseGeometry(xml) {
      const data = {
        name: xml.getAttribute('name'),
        sources: {},
        vertices: {},
        primitives: []
      };
      const mesh = getElementsByTagName(xml, 'mesh')[0];

      // the following tags inside geometry are not supported yet (see https://github.com/mrdoob/three.js/pull/12606): convex_mesh, spline, brep
      if (mesh === undefined) return;
      for (let i = 0; i < mesh.childNodes.length; i++) {
        const child = mesh.childNodes[i];
        if (child.nodeType !== 1) continue;
        const id = child.getAttribute('id');
        switch (child.nodeName) {
          case 'source':
            data.sources[id] = parseSource(child);
            break;
          case 'vertices':
            // data.sources[ id ] = data.sources[ parseId( getElementsByTagName( child, 'input' )[ 0 ].getAttribute( 'source' ) ) ];
            data.vertices = parseGeometryVertices(child);
            break;
          case 'polygons':
            console.warn('THREE.ColladaLoader: Unsupported primitive type: ', child.nodeName);
            break;
          case 'lines':
          case 'linestrips':
          case 'polylist':
          case 'triangles':
            data.primitives.push(parseGeometryPrimitive(child));
            break;
          default:
            console.log(child);
        }
      }
      library.geometries[xml.getAttribute('id')] = data;
    }
    function parseSource(xml) {
      const data = {
        array: [],
        stride: 3
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'float_array':
            data.array = parseFloats(child.textContent);
            break;
          case 'Name_array':
            data.array = parseStrings(child.textContent);
            break;
          case 'technique_common':
            const accessor = getElementsByTagName(child, 'accessor')[0];
            if (accessor !== undefined) {
              data.stride = parseInt(accessor.getAttribute('stride'));
            }
            break;
        }
      }
      return data;
    }
    function parseGeometryVertices(xml) {
      const data = {};
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        data[child.getAttribute('semantic')] = parseId(child.getAttribute('source'));
      }
      return data;
    }
    function parseGeometryPrimitive(xml) {
      const primitive = {
        type: xml.nodeName,
        material: xml.getAttribute('material'),
        count: parseInt(xml.getAttribute('count')),
        inputs: {},
        stride: 0,
        hasUV: false
      };
      for (let i = 0, l = xml.childNodes.length; i < l; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'input':
            const id = parseId(child.getAttribute('source'));
            const semantic = child.getAttribute('semantic');
            const offset = parseInt(child.getAttribute('offset'));
            const set = parseInt(child.getAttribute('set'));
            const inputname = set > 0 ? semantic + set : semantic;
            primitive.inputs[inputname] = {
              id: id,
              offset: offset
            };
            primitive.stride = Math.max(primitive.stride, offset + 1);
            if (semantic === 'TEXCOORD') primitive.hasUV = true;
            break;
          case 'vcount':
            primitive.vcount = parseInts(child.textContent);
            break;
          case 'p':
            primitive.p = parseInts(child.textContent);
            break;
        }
      }
      return primitive;
    }
    function groupPrimitives(primitives) {
      const build = {};
      for (let i = 0; i < primitives.length; i++) {
        const primitive = primitives[i];
        if (build[primitive.type] === undefined) build[primitive.type] = [];
        build[primitive.type].push(primitive);
      }
      return build;
    }
    function checkUVCoordinates(primitives) {
      let count = 0;
      for (let i = 0, l = primitives.length; i < l; i++) {
        const primitive = primitives[i];
        if (primitive.hasUV === true) {
          count++;
        }
      }
      if (count > 0 && count < primitives.length) {
        primitives.uvsNeedsFix = true;
      }
    }
    function buildGeometry(data) {
      const build = {};
      const sources = data.sources;
      const vertices = data.vertices;
      const primitives = data.primitives;
      if (primitives.length === 0) return {};

      // our goal is to create one buffer geometry for a single type of primitives
      // first, we group all primitives by their type

      const groupedPrimitives = groupPrimitives(primitives);
      for (const type in groupedPrimitives) {
        const primitiveType = groupedPrimitives[type];

        // second, ensure consistent uv coordinates for each type of primitives (polylist,triangles or lines)

        checkUVCoordinates(primitiveType);

        // third, create a buffer geometry for each type of primitives

        build[type] = buildGeometryType(primitiveType, sources, vertices);
      }
      return build;
    }
    function buildGeometryType(primitives, sources, vertices) {
      const build = {};
      const position = {
        array: [],
        stride: 0
      };
      const normal = {
        array: [],
        stride: 0
      };
      const uv = {
        array: [],
        stride: 0
      };
      const uv1 = {
        array: [],
        stride: 0
      };
      const color = {
        array: [],
        stride: 0
      };
      const skinIndex = {
        array: [],
        stride: 4
      };
      const skinWeight = {
        array: [],
        stride: 4
      };
      const geometry = new BufferGeometry$1();
      const materialKeys = [];
      let start = 0;
      for (let p = 0; p < primitives.length; p++) {
        const primitive = primitives[p];
        const inputs = primitive.inputs;

        // groups

        let count = 0;
        switch (primitive.type) {
          case 'lines':
          case 'linestrips':
            count = primitive.count * 2;
            break;
          case 'triangles':
            count = primitive.count * 3;
            break;
          case 'polylist':
            for (let g = 0; g < primitive.count; g++) {
              const vc = primitive.vcount[g];
              switch (vc) {
                case 3:
                  count += 3; // single triangle
                  break;
                case 4:
                  count += 6; // quad, subdivided into two triangles
                  break;
                default:
                  count += (vc - 2) * 3; // polylist with more than four vertices
                  break;
              }
            }
            break;
          default:
            console.warn('THREE.ColladaLoader: Unknow primitive type:', primitive.type);
        }
        geometry.addGroup(start, count, p);
        start += count;

        // material

        if (primitive.material) {
          materialKeys.push(primitive.material);
        }

        // geometry data

        for (const name in inputs) {
          const input = inputs[name];
          switch (name) {
            case 'VERTEX':
              for (const key in vertices) {
                const id = vertices[key];
                switch (key) {
                  case 'POSITION':
                    const prevLength = position.array.length;
                    buildGeometryData(primitive, sources[id], input.offset, position.array);
                    position.stride = sources[id].stride;
                    if (sources.skinWeights && sources.skinIndices) {
                      buildGeometryData(primitive, sources.skinIndices, input.offset, skinIndex.array);
                      buildGeometryData(primitive, sources.skinWeights, input.offset, skinWeight.array);
                    }

                    // see #3803

                    if (primitive.hasUV === false && primitives.uvsNeedsFix === true) {
                      const count = (position.array.length - prevLength) / position.stride;
                      for (let i = 0; i < count; i++) {
                        // fill missing uv coordinates

                        uv.array.push(0, 0);
                      }
                    }
                    break;
                  case 'NORMAL':
                    buildGeometryData(primitive, sources[id], input.offset, normal.array);
                    normal.stride = sources[id].stride;
                    break;
                  case 'COLOR':
                    buildGeometryData(primitive, sources[id], input.offset, color.array);
                    color.stride = sources[id].stride;
                    break;
                  case 'TEXCOORD':
                    buildGeometryData(primitive, sources[id], input.offset, uv.array);
                    uv.stride = sources[id].stride;
                    break;
                  case 'TEXCOORD1':
                    buildGeometryData(primitive, sources[id], input.offset, uv1.array);
                    uv.stride = sources[id].stride;
                    break;
                  default:
                    console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.', key);
                }
              }
              break;
            case 'NORMAL':
              buildGeometryData(primitive, sources[input.id], input.offset, normal.array);
              normal.stride = sources[input.id].stride;
              break;
            case 'COLOR':
              buildGeometryData(primitive, sources[input.id], input.offset, color.array, true);
              color.stride = sources[input.id].stride;
              break;
            case 'TEXCOORD':
              buildGeometryData(primitive, sources[input.id], input.offset, uv.array);
              uv.stride = sources[input.id].stride;
              break;
            case 'TEXCOORD1':
              buildGeometryData(primitive, sources[input.id], input.offset, uv1.array);
              uv1.stride = sources[input.id].stride;
              break;
          }
        }
      }

      // build geometry

      if (position.array.length > 0) geometry.setAttribute('position', new Float32BufferAttribute$1(position.array, position.stride));
      if (normal.array.length > 0) geometry.setAttribute('normal', new Float32BufferAttribute$1(normal.array, normal.stride));
      if (color.array.length > 0) geometry.setAttribute('color', new Float32BufferAttribute$1(color.array, color.stride));
      if (uv.array.length > 0) geometry.setAttribute('uv', new Float32BufferAttribute$1(uv.array, uv.stride));
      if (uv1.array.length > 0) geometry.setAttribute('uv1', new Float32BufferAttribute$1(uv1.array, uv1.stride));
      if (skinIndex.array.length > 0) geometry.setAttribute('skinIndex', new Float32BufferAttribute$1(skinIndex.array, skinIndex.stride));
      if (skinWeight.array.length > 0) geometry.setAttribute('skinWeight', new Float32BufferAttribute$1(skinWeight.array, skinWeight.stride));
      build.data = geometry;
      build.type = primitives[0].type;
      build.materialKeys = materialKeys;
      return build;
    }
    function buildGeometryData(primitive, source, offset, array, isColor = false) {
      const indices = primitive.p;
      const stride = primitive.stride;
      const vcount = primitive.vcount;
      function pushVector(i) {
        let index = indices[i + offset] * sourceStride;
        const length = index + sourceStride;
        for (; index < length; index++) {
          array.push(sourceArray[index]);
        }
        if (isColor) {
          // convert the vertex colors from srgb to linear if present
          const startIndex = array.length - sourceStride - 1;
          tempColor.setRGB(array[startIndex + 0], array[startIndex + 1], array[startIndex + 2]).convertSRGBToLinear();
          array[startIndex + 0] = tempColor.r;
          array[startIndex + 1] = tempColor.g;
          array[startIndex + 2] = tempColor.b;
        }
      }
      const sourceArray = source.array;
      const sourceStride = source.stride;
      if (primitive.vcount !== undefined) {
        let index = 0;
        for (let i = 0, l = vcount.length; i < l; i++) {
          const count = vcount[i];
          if (count === 4) {
            const a = index + stride * 0;
            const b = index + stride * 1;
            const c = index + stride * 2;
            const d = index + stride * 3;
            pushVector(a);
            pushVector(b);
            pushVector(d);
            pushVector(b);
            pushVector(c);
            pushVector(d);
          } else if (count === 3) {
            const a = index + stride * 0;
            const b = index + stride * 1;
            const c = index + stride * 2;
            pushVector(a);
            pushVector(b);
            pushVector(c);
          } else if (count > 4) {
            for (let k = 1, kl = count - 2; k <= kl; k++) {
              const a = index + stride * 0;
              const b = index + stride * k;
              const c = index + stride * (k + 1);
              pushVector(a);
              pushVector(b);
              pushVector(c);
            }
          }
          index += stride * count;
        }
      } else {
        for (let i = 0, l = indices.length; i < l; i += stride) {
          pushVector(i);
        }
      }
    }
    function getGeometry(id) {
      return getBuild(library.geometries[id], buildGeometry);
    }

    // kinematics

    function parseKinematicsModel(xml) {
      const data = {
        name: xml.getAttribute('name') || '',
        joints: {},
        links: []
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'technique_common':
            parseKinematicsTechniqueCommon(child, data);
            break;
        }
      }
      library.kinematicsModels[xml.getAttribute('id')] = data;
    }
    function buildKinematicsModel(data) {
      if (data.build !== undefined) return data.build;
      return data;
    }
    function getKinematicsModel(id) {
      return getBuild(library.kinematicsModels[id], buildKinematicsModel);
    }
    function parseKinematicsTechniqueCommon(xml, data) {
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'joint':
            data.joints[child.getAttribute('sid')] = parseKinematicsJoint(child);
            break;
          case 'link':
            data.links.push(parseKinematicsLink(child));
            break;
        }
      }
    }
    function parseKinematicsJoint(xml) {
      let data;
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'prismatic':
          case 'revolute':
            data = parseKinematicsJointParameter(child);
            break;
        }
      }
      return data;
    }
    function parseKinematicsJointParameter(xml) {
      const data = {
        sid: xml.getAttribute('sid'),
        name: xml.getAttribute('name') || '',
        axis: new Vector3$1(),
        limits: {
          min: 0,
          max: 0
        },
        type: xml.nodeName,
        static: false,
        zeroPosition: 0,
        middlePosition: 0
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'axis':
            const array = parseFloats(child.textContent);
            data.axis.fromArray(array);
            break;
          case 'limits':
            const max = child.getElementsByTagName('max')[0];
            const min = child.getElementsByTagName('min')[0];
            data.limits.max = parseFloat(max.textContent);
            data.limits.min = parseFloat(min.textContent);
            break;
        }
      }

      // if min is equal to or greater than max, consider the joint static

      if (data.limits.min >= data.limits.max) {
        data.static = true;
      }

      // calculate middle position

      data.middlePosition = (data.limits.min + data.limits.max) / 2.0;
      return data;
    }
    function parseKinematicsLink(xml) {
      const data = {
        sid: xml.getAttribute('sid'),
        name: xml.getAttribute('name') || '',
        attachments: [],
        transforms: []
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'attachment_full':
            data.attachments.push(parseKinematicsAttachment(child));
            break;
          case 'matrix':
          case 'translate':
          case 'rotate':
            data.transforms.push(parseKinematicsTransform(child));
            break;
        }
      }
      return data;
    }
    function parseKinematicsAttachment(xml) {
      const data = {
        joint: xml.getAttribute('joint').split('/').pop(),
        transforms: [],
        links: []
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'link':
            data.links.push(parseKinematicsLink(child));
            break;
          case 'matrix':
          case 'translate':
          case 'rotate':
            data.transforms.push(parseKinematicsTransform(child));
            break;
        }
      }
      return data;
    }
    function parseKinematicsTransform(xml) {
      const data = {
        type: xml.nodeName
      };
      const array = parseFloats(xml.textContent);
      switch (data.type) {
        case 'matrix':
          data.obj = new Matrix4$1();
          data.obj.fromArray(array).transpose();
          break;
        case 'translate':
          data.obj = new Vector3$1();
          data.obj.fromArray(array);
          break;
        case 'rotate':
          data.obj = new Vector3$1();
          data.obj.fromArray(array);
          data.angle = MathUtils$1.degToRad(array[3]);
          break;
      }
      return data;
    }

    // physics

    function parsePhysicsModel(xml) {
      const data = {
        name: xml.getAttribute('name') || '',
        rigidBodies: {}
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'rigid_body':
            data.rigidBodies[child.getAttribute('name')] = {};
            parsePhysicsRigidBody(child, data.rigidBodies[child.getAttribute('name')]);
            break;
        }
      }
      library.physicsModels[xml.getAttribute('id')] = data;
    }
    function parsePhysicsRigidBody(xml, data) {
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'technique_common':
            parsePhysicsTechniqueCommon(child, data);
            break;
        }
      }
    }
    function parsePhysicsTechniqueCommon(xml, data) {
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'inertia':
            data.inertia = parseFloats(child.textContent);
            break;
          case 'mass':
            data.mass = parseFloats(child.textContent)[0];
            break;
        }
      }
    }

    // scene

    function parseKinematicsScene(xml) {
      const data = {
        bindJointAxis: []
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'bind_joint_axis':
            data.bindJointAxis.push(parseKinematicsBindJointAxis(child));
            break;
        }
      }
      library.kinematicsScenes[parseId(xml.getAttribute('url'))] = data;
    }
    function parseKinematicsBindJointAxis(xml) {
      const data = {
        target: xml.getAttribute('target').split('/').pop()
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        switch (child.nodeName) {
          case 'axis':
            const param = child.getElementsByTagName('param')[0];
            data.axis = param.textContent;
            const tmpJointIndex = data.axis.split('inst_').pop().split('axis')[0];
            data.jointIndex = tmpJointIndex.substring(0, tmpJointIndex.length - 1);
            break;
        }
      }
      return data;
    }
    function buildKinematicsScene(data) {
      if (data.build !== undefined) return data.build;
      return data;
    }
    function getKinematicsScene(id) {
      return getBuild(library.kinematicsScenes[id], buildKinematicsScene);
    }
    function setupKinematics() {
      const kinematicsModelId = Object.keys(library.kinematicsModels)[0];
      const kinematicsSceneId = Object.keys(library.kinematicsScenes)[0];
      const visualSceneId = Object.keys(library.visualScenes)[0];
      if (kinematicsModelId === undefined || kinematicsSceneId === undefined) return;
      const kinematicsModel = getKinematicsModel(kinematicsModelId);
      const kinematicsScene = getKinematicsScene(kinematicsSceneId);
      const visualScene = getVisualScene(visualSceneId);
      const bindJointAxis = kinematicsScene.bindJointAxis;
      const jointMap = {};
      for (let i = 0, l = bindJointAxis.length; i < l; i++) {
        const axis = bindJointAxis[i];

        // the result of the following query is an element of type 'translate', 'rotate','scale' or 'matrix'

        const targetElement = collada.querySelector('[sid="' + axis.target + '"]');
        if (targetElement) {
          // get the parent of the transform element

          const parentVisualElement = targetElement.parentElement;

          // connect the joint of the kinematics model with the element in the visual scene

          connect(axis.jointIndex, parentVisualElement);
        }
      }
      function connect(jointIndex, visualElement) {
        const visualElementName = visualElement.getAttribute('name');
        const joint = kinematicsModel.joints[jointIndex];
        visualScene.traverse(function (object) {
          if (object.name === visualElementName) {
            jointMap[jointIndex] = {
              object: object,
              transforms: buildTransformList(visualElement),
              joint: joint,
              position: joint.zeroPosition
            };
          }
        });
      }
      const m0 = new Matrix4$1();
      kinematics = {
        joints: kinematicsModel && kinematicsModel.joints,
        getJointValue: function (jointIndex) {
          const jointData = jointMap[jointIndex];
          if (jointData) {
            return jointData.position;
          } else {
            console.warn('THREE.ColladaLoader: Joint ' + jointIndex + ' doesn\'t exist.');
          }
        },
        setJointValue: function (jointIndex, value) {
          const jointData = jointMap[jointIndex];
          if (jointData) {
            const joint = jointData.joint;
            if (value > joint.limits.max || value < joint.limits.min) {
              console.warn('THREE.ColladaLoader: Joint ' + jointIndex + ' value ' + value + ' outside of limits (min: ' + joint.limits.min + ', max: ' + joint.limits.max + ').');
            } else if (joint.static) {
              console.warn('THREE.ColladaLoader: Joint ' + jointIndex + ' is static.');
            } else {
              const object = jointData.object;
              const axis = joint.axis;
              const transforms = jointData.transforms;
              matrix.identity();

              // each update, we have to apply all transforms in the correct order

              for (let i = 0; i < transforms.length; i++) {
                const transform = transforms[i];

                // if there is a connection of the transform node with a joint, apply the joint value

                if (transform.sid && transform.sid.indexOf(jointIndex) !== -1) {
                  switch (joint.type) {
                    case 'revolute':
                      matrix.multiply(m0.makeRotationAxis(axis, MathUtils$1.degToRad(value)));
                      break;
                    case 'prismatic':
                      matrix.multiply(m0.makeTranslation(axis.x * value, axis.y * value, axis.z * value));
                      break;
                    default:
                      console.warn('THREE.ColladaLoader: Unknown joint type: ' + joint.type);
                      break;
                  }
                } else {
                  switch (transform.type) {
                    case 'matrix':
                      matrix.multiply(transform.obj);
                      break;
                    case 'translate':
                      matrix.multiply(m0.makeTranslation(transform.obj.x, transform.obj.y, transform.obj.z));
                      break;
                    case 'scale':
                      matrix.scale(transform.obj);
                      break;
                    case 'rotate':
                      matrix.multiply(m0.makeRotationAxis(transform.obj, transform.angle));
                      break;
                  }
                }
              }
              object.matrix.copy(matrix);
              object.matrix.decompose(object.position, object.quaternion, object.scale);
              jointMap[jointIndex].position = value;
            }
          } else {
            console.log('THREE.ColladaLoader: ' + jointIndex + ' does not exist.');
          }
        }
      };
    }
    function buildTransformList(node) {
      const transforms = [];
      const xml = collada.querySelector('[id="' + node.id + '"]');
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        let array, vector;
        switch (child.nodeName) {
          case 'matrix':
            array = parseFloats(child.textContent);
            const matrix = new Matrix4$1().fromArray(array).transpose();
            transforms.push({
              sid: child.getAttribute('sid'),
              type: child.nodeName,
              obj: matrix
            });
            break;
          case 'translate':
          case 'scale':
            array = parseFloats(child.textContent);
            vector = new Vector3$1().fromArray(array);
            transforms.push({
              sid: child.getAttribute('sid'),
              type: child.nodeName,
              obj: vector
            });
            break;
          case 'rotate':
            array = parseFloats(child.textContent);
            vector = new Vector3$1().fromArray(array);
            const angle = MathUtils$1.degToRad(array[3]);
            transforms.push({
              sid: child.getAttribute('sid'),
              type: child.nodeName,
              obj: vector,
              angle: angle
            });
            break;
        }
      }
      return transforms;
    }

    // nodes

    function prepareNodes(xml) {
      const elements = xml.getElementsByTagName('node');

      // ensure all node elements have id attributes

      for (let i = 0; i < elements.length; i++) {
        const element = elements[i];
        if (element.hasAttribute('id') === false) {
          element.setAttribute('id', generateId());
        }
      }
    }
    const matrix = new Matrix4$1();
    const vector = new Vector3$1();
    function parseNode(xml) {
      const data = {
        name: xml.getAttribute('name') || '',
        type: xml.getAttribute('type'),
        id: xml.getAttribute('id'),
        sid: xml.getAttribute('sid'),
        matrix: new Matrix4$1(),
        nodes: [],
        instanceCameras: [],
        instanceControllers: [],
        instanceLights: [],
        instanceGeometries: [],
        instanceNodes: [],
        transforms: {}
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        if (child.nodeType !== 1) continue;
        let array;
        switch (child.nodeName) {
          case 'node':
            data.nodes.push(child.getAttribute('id'));
            parseNode(child);
            break;
          case 'instance_camera':
            data.instanceCameras.push(parseId(child.getAttribute('url')));
            break;
          case 'instance_controller':
            data.instanceControllers.push(parseNodeInstance(child));
            break;
          case 'instance_light':
            data.instanceLights.push(parseId(child.getAttribute('url')));
            break;
          case 'instance_geometry':
            data.instanceGeometries.push(parseNodeInstance(child));
            break;
          case 'instance_node':
            data.instanceNodes.push(parseId(child.getAttribute('url')));
            break;
          case 'matrix':
            array = parseFloats(child.textContent);
            data.matrix.multiply(matrix.fromArray(array).transpose());
            data.transforms[child.getAttribute('sid')] = child.nodeName;
            break;
          case 'translate':
            array = parseFloats(child.textContent);
            vector.fromArray(array);
            data.matrix.multiply(matrix.makeTranslation(vector.x, vector.y, vector.z));
            data.transforms[child.getAttribute('sid')] = child.nodeName;
            break;
          case 'rotate':
            array = parseFloats(child.textContent);
            const angle = MathUtils$1.degToRad(array[3]);
            data.matrix.multiply(matrix.makeRotationAxis(vector.fromArray(array), angle));
            data.transforms[child.getAttribute('sid')] = child.nodeName;
            break;
          case 'scale':
            array = parseFloats(child.textContent);
            data.matrix.scale(vector.fromArray(array));
            data.transforms[child.getAttribute('sid')] = child.nodeName;
            break;
          case 'extra':
            break;
          default:
            console.log(child);
        }
      }
      if (hasNode(data.id)) {
        console.warn('THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.', data.id);
      } else {
        library.nodes[data.id] = data;
      }
      return data;
    }
    function parseNodeInstance(xml) {
      const data = {
        id: parseId(xml.getAttribute('url')),
        materials: {},
        skeletons: []
      };
      for (let i = 0; i < xml.childNodes.length; i++) {
        const child = xml.childNodes[i];
        switch (child.nodeName) {
          case 'bind_material':
            const instances = child.getElementsByTagName('instance_material');
            for (let j = 0; j < instances.length; j++) {
              const instance = instances[j];
              const symbol = instance.getAttribute('symbol');
              const target = instance.getAttribute('target');
              data.materials[symbol] = parseId(target);
            }
            break;
          case 'skeleton':
            data.skeletons.push(parseId(child.textContent));
            break;
        }
      }
      return data;
    }
    function buildSkeleton(skeletons, joints) {
      const boneData = [];
      const sortedBoneData = [];
      let i, j, data;

      // a skeleton can have multiple root bones. collada expresses this
      // situtation with multiple "skeleton" tags per controller instance

      for (i = 0; i < skeletons.length; i++) {
        const skeleton = skeletons[i];
        let root;
        if (hasNode(skeleton)) {
          root = getNode(skeleton);
          buildBoneHierarchy(root, joints, boneData);
        } else if (hasVisualScene(skeleton)) {
          // handle case where the skeleton refers to the visual scene (#13335)

          const visualScene = library.visualScenes[skeleton];
          const children = visualScene.children;
          for (let j = 0; j < children.length; j++) {
            const child = children[j];
            if (child.type === 'JOINT') {
              const root = getNode(child.id);
              buildBoneHierarchy(root, joints, boneData);
            }
          }
        } else {
          console.error('THREE.ColladaLoader: Unable to find root bone of skeleton with ID:', skeleton);
        }
      }

      // sort bone data (the order is defined in the corresponding controller)

      for (i = 0; i < joints.length; i++) {
        for (j = 0; j < boneData.length; j++) {
          data = boneData[j];
          if (data.bone.name === joints[i].name) {
            sortedBoneData[i] = data;
            data.processed = true;
            break;
          }
        }
      }

      // add unprocessed bone data at the end of the list

      for (i = 0; i < boneData.length; i++) {
        data = boneData[i];
        if (data.processed === false) {
          sortedBoneData.push(data);
          data.processed = true;
        }
      }

      // setup arrays for skeleton creation

      const bones = [];
      const boneInverses = [];
      for (i = 0; i < sortedBoneData.length; i++) {
        data = sortedBoneData[i];
        bones.push(data.bone);
        boneInverses.push(data.boneInverse);
      }
      return new Skeleton(bones, boneInverses);
    }
    function buildBoneHierarchy(root, joints, boneData) {
      // setup bone data from visual scene

      root.traverse(function (object) {
        if (object.isBone === true) {
          let boneInverse;

          // retrieve the boneInverse from the controller data

          for (let i = 0; i < joints.length; i++) {
            const joint = joints[i];
            if (joint.name === object.name) {
              boneInverse = joint.boneInverse;
              break;
            }
          }
          if (boneInverse === undefined) {
            // Unfortunately, there can be joints in the visual scene that are not part of the
            // corresponding controller. In this case, we have to create a dummy boneInverse matrix
            // for the respective bone. This bone won't affect any vertices, because there are no skin indices
            // and weights defined for it. But we still have to add the bone to the sorted bone list in order to
            // ensure a correct animation of the model.

            boneInverse = new Matrix4$1();
          }
          boneData.push({
            bone: object,
            boneInverse: boneInverse,
            processed: false
          });
        }
      });
    }
    function buildNode(data) {
      const objects = [];
      const matrix = data.matrix;
      const nodes = data.nodes;
      const type = data.type;
      const instanceCameras = data.instanceCameras;
      const instanceControllers = data.instanceControllers;
      const instanceLights = data.instanceLights;
      const instanceGeometries = data.instanceGeometries;
      const instanceNodes = data.instanceNodes;

      // nodes

      for (let i = 0, l = nodes.length; i < l; i++) {
        objects.push(getNode(nodes[i]));
      }

      // instance cameras

      for (let i = 0, l = instanceCameras.length; i < l; i++) {
        const instanceCamera = getCamera(instanceCameras[i]);
        if (instanceCamera !== null) {
          objects.push(instanceCamera.clone());
        }
      }

      // instance controllers

      for (let i = 0, l = instanceControllers.length; i < l; i++) {
        const instance = instanceControllers[i];
        const controller = getController(instance.id);
        const geometries = getGeometry(controller.id);
        const newObjects = buildObjects(geometries, instance.materials);
        const skeletons = instance.skeletons;
        const joints = controller.skin.joints;
        const skeleton = buildSkeleton(skeletons, joints);
        for (let j = 0, jl = newObjects.length; j < jl; j++) {
          const object = newObjects[j];
          if (object.isSkinnedMesh) {
            object.bind(skeleton, controller.skin.bindMatrix);
            object.normalizeSkinWeights();
          }
          objects.push(object);
        }
      }

      // instance lights

      for (let i = 0, l = instanceLights.length; i < l; i++) {
        const instanceLight = getLight(instanceLights[i]);
        if (instanceLight !== null) {
          objects.push(instanceLight.clone());
        }
      }

      // instance geometries

      for (let i = 0, l = instanceGeometries.length; i < l; i++) {
        const instance = instanceGeometries[i];

        // a single geometry instance in collada can lead to multiple object3Ds.
        // this is the case when primitives are combined like triangles and lines

        const geometries = getGeometry(instance.id);
        const newObjects = buildObjects(geometries, instance.materials);
        for (let j = 0, jl = newObjects.length; j < jl; j++) {
          objects.push(newObjects[j]);
        }
      }

      // instance nodes

      for (let i = 0, l = instanceNodes.length; i < l; i++) {
        objects.push(getNode(instanceNodes[i]).clone());
      }
      let object;
      if (nodes.length === 0 && objects.length === 1) {
        object = objects[0];
      } else {
        object = type === 'JOINT' ? new Bone() : new Group();
        for (let i = 0; i < objects.length; i++) {
          object.add(objects[i]);
        }
      }
      object.name = type === 'JOINT' ? data.sid : data.name;
      object.matrix.copy(matrix);
      object.matrix.decompose(object.position, object.quaternion, object.scale);
      return object;
    }
    const fallbackMaterial = new MeshBasicMaterial$1({
      name: Loader.DEFAULT_MATERIAL_NAME,
      color: 0xff00ff
    });
    function resolveMaterialBinding(keys, instanceMaterials) {
      const materials = [];
      for (let i = 0, l = keys.length; i < l; i++) {
        const id = instanceMaterials[keys[i]];
        if (id === undefined) {
          console.warn('THREE.ColladaLoader: Material with key %s not found. Apply fallback material.', keys[i]);
          materials.push(fallbackMaterial);
        } else {
          materials.push(getMaterial(id));
        }
      }
      return materials;
    }
    function buildObjects(geometries, instanceMaterials) {
      const objects = [];
      for (const type in geometries) {
        const geometry = geometries[type];
        const materials = resolveMaterialBinding(geometry.materialKeys, instanceMaterials);

        // handle case if no materials are defined

        if (materials.length === 0) {
          if (type === 'lines' || type === 'linestrips') {
            materials.push(new LineBasicMaterial());
          } else {
            materials.push(new MeshPhongMaterial());
          }
        }

        // Collada allows to use phong and lambert materials with lines. Replacing these cases with LineBasicMaterial.

        if (type === 'lines' || type === 'linestrips') {
          for (let i = 0, l = materials.length; i < l; i++) {
            const material = materials[i];
            if (material.isMeshPhongMaterial === true || material.isMeshLambertMaterial === true) {
              const lineMaterial = new LineBasicMaterial();

              // copy compatible properties

              lineMaterial.color.copy(material.color);
              lineMaterial.opacity = material.opacity;
              lineMaterial.transparent = material.transparent;

              // replace material

              materials[i] = lineMaterial;
            }
          }
        }

        // regard skinning

        const skinning = geometry.data.attributes.skinIndex !== undefined;

        // choose between a single or multi materials (material array)

        const material = materials.length === 1 ? materials[0] : materials;

        // now create a specific 3D object

        let object;
        switch (type) {
          case 'lines':
            object = new LineSegments(geometry.data, material);
            break;
          case 'linestrips':
            object = new Line(geometry.data, material);
            break;
          case 'triangles':
          case 'polylist':
            if (skinning) {
              object = new SkinnedMesh(geometry.data, material);
            } else {
              object = new Mesh$1(geometry.data, material);
            }
            break;
        }
        objects.push(object);
      }
      return objects;
    }
    function hasNode(id) {
      return library.nodes[id] !== undefined;
    }
    function getNode(id) {
      return getBuild(library.nodes[id], buildNode);
    }

    // visual scenes

    function parseVisualScene(xml) {
      const data = {
        name: xml.getAttribute('name'),
        children: []
      };
      prepareNodes(xml);
      const elements = getElementsByTagName(xml, 'node');
      for (let i = 0; i < elements.length; i++) {
        data.children.push(parseNode(elements[i]));
      }
      library.visualScenes[xml.getAttribute('id')] = data;
    }
    function buildVisualScene(data) {
      const group = new Group();
      group.name = data.name;
      const children = data.children;
      for (let i = 0; i < children.length; i++) {
        const child = children[i];
        group.add(getNode(child.id));
      }
      return group;
    }
    function hasVisualScene(id) {
      return library.visualScenes[id] !== undefined;
    }
    function getVisualScene(id) {
      return getBuild(library.visualScenes[id], buildVisualScene);
    }

    // scenes

    function parseScene(xml) {
      const instance = getElementsByTagName(xml, 'instance_visual_scene')[0];
      return getVisualScene(parseId(instance.getAttribute('url')));
    }
    function setupAnimations() {
      const clips = library.clips;
      if (isEmpty(clips) === true) {
        if (isEmpty(library.animations) === false) {
          // if there are animations but no clips, we create a default clip for playback

          const tracks = [];
          for (const id in library.animations) {
            const animationTracks = getAnimation(id);
            for (let i = 0, l = animationTracks.length; i < l; i++) {
              tracks.push(animationTracks[i]);
            }
          }
          animations.push(new AnimationClip('default', -1, tracks));
        }
      } else {
        for (const id in clips) {
          animations.push(getAnimationClip(id));
        }
      }
    }

    // convert the parser error element into text with each child elements text
    // separated by new lines.

    function parserErrorToText(parserError) {
      let result = '';
      const stack = [parserError];
      while (stack.length) {
        const node = stack.shift();
        if (node.nodeType === Node.TEXT_NODE) {
          result += node.textContent;
        } else {
          result += '\n';
          stack.push.apply(stack, node.childNodes);
        }
      }
      return result.trim();
    }
    if (text.length === 0) {
      return {
        scene: new Scene()
      };
    }
    const xml = new DOMParser().parseFromString(text, 'application/xml');
    const collada = getElementsByTagName(xml, 'COLLADA')[0];
    const parserError = xml.getElementsByTagName('parsererror')[0];
    if (parserError !== undefined) {
      // Chrome will return parser error with a div in it

      const errorElement = getElementsByTagName(parserError, 'div')[0];
      let errorText;
      if (errorElement) {
        errorText = errorElement.textContent;
      } else {
        errorText = parserErrorToText(parserError);
      }
      console.error('THREE.ColladaLoader: Failed to parse collada file.\n', errorText);
      return null;
    }

    // metadata

    const version = collada.getAttribute('version');
    console.debug('THREE.ColladaLoader: File version', version);
    const asset = parseAsset(getElementsByTagName(collada, 'asset')[0]);
    const textureLoader = new TextureLoader(this.manager);
    textureLoader.setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin);
    let tgaLoader;
    if (TGALoader) {
      tgaLoader = new TGALoader(this.manager);
      tgaLoader.setPath(this.resourcePath || path);
    }

    //

    const tempColor = new Color$1();
    const animations = [];
    let kinematics = {};
    let count = 0;

    //

    const library = {
      animations: {},
      clips: {},
      controllers: {},
      images: {},
      effects: {},
      materials: {},
      cameras: {},
      lights: {},
      geometries: {},
      nodes: {},
      visualScenes: {},
      kinematicsModels: {},
      physicsModels: {},
      kinematicsScenes: {}
    };
    parseLibrary(collada, 'library_animations', 'animation', parseAnimation);
    parseLibrary(collada, 'library_animation_clips', 'animation_clip', parseAnimationClip);
    parseLibrary(collada, 'library_controllers', 'controller', parseController);
    parseLibrary(collada, 'library_images', 'image', parseImage);
    parseLibrary(collada, 'library_effects', 'effect', parseEffect);
    parseLibrary(collada, 'library_materials', 'material', parseMaterial);
    parseLibrary(collada, 'library_cameras', 'camera', parseCamera);
    parseLibrary(collada, 'library_lights', 'light', parseLight);
    parseLibrary(collada, 'library_geometries', 'geometry', parseGeometry);
    parseLibrary(collada, 'library_nodes', 'node', parseNode);
    parseLibrary(collada, 'library_visual_scenes', 'visual_scene', parseVisualScene);
    parseLibrary(collada, 'library_kinematics_models', 'kinematics_model', parseKinematicsModel);
    parseLibrary(collada, 'library_physics_models', 'physics_model', parsePhysicsModel);
    parseLibrary(collada, 'scene', 'instance_kinematics_scene', parseKinematicsScene);
    buildLibrary(library.animations, buildAnimation);
    buildLibrary(library.clips, buildAnimationClip);
    buildLibrary(library.controllers, buildController);
    buildLibrary(library.images, buildImage);
    buildLibrary(library.effects, buildEffect);
    buildLibrary(library.materials, buildMaterial);
    buildLibrary(library.cameras, buildCamera);
    buildLibrary(library.lights, buildLight);
    buildLibrary(library.geometries, buildGeometry);
    buildLibrary(library.visualScenes, buildVisualScene);
    setupAnimations();
    setupKinematics();
    const scene = parseScene(getElementsByTagName(collada, 'scene')[0]);
    scene.animations = animations;
    if (asset.upAxis === 'Z_UP') {
      console.warn('THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289.');
      scene.rotation.set(-Math.PI / 2, 0, 0);
    }
    scene.scale.multiplyScalar(asset.unit);
    return {
      get animations() {
        console.warn('THREE.ColladaLoader: Please access animations over scene.animations now.');
        return animations;
      },
      kinematics: kinematics,
      library: library,
      scene: scene
    };
  }
}

/**
 * Description: A THREE loader for STL ASCII files, as created by Solidworks and other CAD programs.
 *
 * Supports both binary and ASCII encoded files, with automatic detection of type.
 *
 * The loader returns a non-indexed buffer geometry.
 *
 * Limitations:
 *  Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL_(file_format)#Color_in_binary_STL).
 *  There is perhaps some question as to how valid it is to always assume little-endian-ness.
 *  ASCII decoding assumes file is UTF-8.
 *
 * Usage:
 *  const loader = new STLLoader();
 *  loader.load( './models/stl/slotted_disk.stl', function ( geometry ) {
 *    scene.add( new THREE.Mesh( geometry ) );
 *  });
 *
 * For binary STLs geometry might contain colors for vertices. To use it:
 *  // use the same code to load STL as above
 *  if (geometry.hasColors) {
 *    material = new THREE.MeshPhongMaterial({ opacity: geometry.alpha, vertexColors: true });
 *  } else { .... }
 *  const mesh = new THREE.Mesh( geometry, material );
 *
 * For ASCII STLs containing multiple solids, each solid is assigned to a different group.
 * Groups can be used to assign a different color by defining an array of materials with the same length of
 * geometry.groups and passing it to the Mesh constructor:
 *
 * const mesh = new THREE.Mesh( geometry, material );
 *
 * For example:
 *
 *  const materials = [];
 *  const nGeometryGroups = geometry.groups.length;
 *
 *  const colorMap = ...; // Some logic to index colors.
 *
 *  for (let i = 0; i < nGeometryGroups; i++) {
 *
 *		const material = new THREE.MeshPhongMaterial({
 *			color: colorMap[i],
 *			wireframe: false
 *		});
 *
 *  }
 *
 *  materials.push(material);
 *  const mesh = new THREE.Mesh(geometry, materials);
 */

class STLLoader extends Loader {
  constructor(manager) {
    super(manager);
  }
  load(url, onLoad, onProgress, onError) {
    const scope = this;
    const loader = new FileLoader(this.manager);
    loader.setPath(this.path);
    loader.setResponseType('arraybuffer');
    loader.setRequestHeader(this.requestHeader);
    loader.setWithCredentials(this.withCredentials);
    loader.load(url, function (text) {
      try {
        onLoad(scope.parse(text));
      } catch (e) {
        if (onError) {
          onError(e);
        } else {
          console.error(e);
        }
        scope.manager.itemError(url);
      }
    }, onProgress, onError);
  }
  parse(data) {
    function isBinary(data) {
      const reader = new DataView(data);
      const face_size = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8;
      const n_faces = reader.getUint32(80, true);
      const expect = 80 + 32 / 8 + n_faces * face_size;
      if (expect === reader.byteLength) {
        return true;
      }

      // An ASCII STL data must begin with 'solid ' as the first six bytes.
      // However, ASCII STLs lacking the SPACE after the 'd' are known to be
      // plentiful.  So, check the first 5 bytes for 'solid'.

      // Several encodings, such as UTF-8, precede the text with up to 5 bytes:
      // https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding
      // Search for "solid" to start anywhere after those prefixes.

      // US-ASCII ordinal values for 's', 'o', 'l', 'i', 'd'

      const solid = [115, 111, 108, 105, 100];
      for (let off = 0; off < 5; off++) {
        // If "solid" text is matched to the current offset, declare it to be an ASCII STL.

        if (matchDataViewAt(solid, reader, off)) return false;
      }

      // Couldn't find "solid" text at the beginning; it is binary STL.

      return true;
    }
    function matchDataViewAt(query, reader, offset) {
      // Check if each byte in query matches the corresponding byte from the current offset

      for (let i = 0, il = query.length; i < il; i++) {
        if (query[i] !== reader.getUint8(offset + i)) return false;
      }
      return true;
    }
    function parseBinary(data) {
      const reader = new DataView(data);
      const faces = reader.getUint32(80, true);
      let r,
        g,
        b,
        hasColors = false,
        colors;
      let defaultR, defaultG, defaultB, alpha;

      // process STL header
      // check for default color in header ("COLOR=rgba" sequence).

      for (let index = 0; index < 80 - 10; index++) {
        if (reader.getUint32(index, false) == 0x434F4C4F /*COLO*/ && reader.getUint8(index + 4) == 0x52 /*'R'*/ && reader.getUint8(index + 5) == 0x3D /*'='*/) {
          hasColors = true;
          colors = new Float32Array(faces * 3 * 3);
          defaultR = reader.getUint8(index + 6) / 255;
          defaultG = reader.getUint8(index + 7) / 255;
          defaultB = reader.getUint8(index + 8) / 255;
          alpha = reader.getUint8(index + 9) / 255;
        }
      }
      const dataOffset = 84;
      const faceLength = 12 * 4 + 2;
      const geometry = new BufferGeometry$1();
      const vertices = new Float32Array(faces * 3 * 3);
      const normals = new Float32Array(faces * 3 * 3);
      const color = new Color$1();
      for (let face = 0; face < faces; face++) {
        const start = dataOffset + face * faceLength;
        const normalX = reader.getFloat32(start, true);
        const normalY = reader.getFloat32(start + 4, true);
        const normalZ = reader.getFloat32(start + 8, true);
        if (hasColors) {
          const packedColor = reader.getUint16(start + 48, true);
          if ((packedColor & 0x8000) === 0) {
            // facet has its own unique color

            r = (packedColor & 0x1F) / 31;
            g = (packedColor >> 5 & 0x1F) / 31;
            b = (packedColor >> 10 & 0x1F) / 31;
          } else {
            r = defaultR;
            g = defaultG;
            b = defaultB;
          }
        }
        for (let i = 1; i <= 3; i++) {
          const vertexstart = start + i * 12;
          const componentIdx = face * 3 * 3 + (i - 1) * 3;
          vertices[componentIdx] = reader.getFloat32(vertexstart, true);
          vertices[componentIdx + 1] = reader.getFloat32(vertexstart + 4, true);
          vertices[componentIdx + 2] = reader.getFloat32(vertexstart + 8, true);
          normals[componentIdx] = normalX;
          normals[componentIdx + 1] = normalY;
          normals[componentIdx + 2] = normalZ;
          if (hasColors) {
            color.set(r, g, b).convertSRGBToLinear();
            colors[componentIdx] = color.r;
            colors[componentIdx + 1] = color.g;
            colors[componentIdx + 2] = color.b;
          }
        }
      }
      geometry.setAttribute('position', new BufferAttribute$1(vertices, 3));
      geometry.setAttribute('normal', new BufferAttribute$1(normals, 3));
      if (hasColors) {
        geometry.setAttribute('color', new BufferAttribute$1(colors, 3));
        geometry.hasColors = true;
        geometry.alpha = alpha;
      }
      return geometry;
    }
    function parseASCII(data) {
      const geometry = new BufferGeometry$1();
      const patternSolid = /solid([\s\S]*?)endsolid/g;
      const patternFace = /facet([\s\S]*?)endfacet/g;
      const patternName = /solid\s(.+)/;
      let faceCounter = 0;
      const patternFloat = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source;
      const patternVertex = new RegExp('vertex' + patternFloat + patternFloat + patternFloat, 'g');
      const patternNormal = new RegExp('normal' + patternFloat + patternFloat + patternFloat, 'g');
      const vertices = [];
      const normals = [];
      const groupNames = [];
      const normal = new Vector3$1();
      let result;
      let groupCount = 0;
      let startVertex = 0;
      let endVertex = 0;
      while ((result = patternSolid.exec(data)) !== null) {
        startVertex = endVertex;
        const solid = result[0];
        const name = (result = patternName.exec(solid)) !== null ? result[1] : '';
        groupNames.push(name);
        while ((result = patternFace.exec(solid)) !== null) {
          let vertexCountPerFace = 0;
          let normalCountPerFace = 0;
          const text = result[0];
          while ((result = patternNormal.exec(text)) !== null) {
            normal.x = parseFloat(result[1]);
            normal.y = parseFloat(result[2]);
            normal.z = parseFloat(result[3]);
            normalCountPerFace++;
          }
          while ((result = patternVertex.exec(text)) !== null) {
            vertices.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3]));
            normals.push(normal.x, normal.y, normal.z);
            vertexCountPerFace++;
            endVertex++;
          }

          // every face have to own ONE valid normal

          if (normalCountPerFace !== 1) {
            console.error('THREE.STLLoader: Something isn\'t right with the normal of face number ' + faceCounter);
          }

          // each face have to own THREE valid vertices

          if (vertexCountPerFace !== 3) {
            console.error('THREE.STLLoader: Something isn\'t right with the vertices of face number ' + faceCounter);
          }
          faceCounter++;
        }
        const start = startVertex;
        const count = endVertex - startVertex;
        geometry.userData.groupNames = groupNames;
        geometry.addGroup(start, count, groupCount);
        groupCount++;
      }
      geometry.setAttribute('position', new Float32BufferAttribute$1(vertices, 3));
      geometry.setAttribute('normal', new Float32BufferAttribute$1(normals, 3));
      return geometry;
    }
    function ensureString(buffer) {
      if (typeof buffer !== 'string') {
        return new TextDecoder().decode(buffer);
      }
      return buffer;
    }
    function ensureBinary(buffer) {
      if (typeof buffer === 'string') {
        const array_buffer = new Uint8Array(buffer.length);
        for (let i = 0; i < buffer.length; i++) {
          array_buffer[i] = buffer.charCodeAt(i) & 0xff; // implicitly assumes little-endian
        }
        return array_buffer.buffer || array_buffer;
      } else {
        return buffer;
      }
    }

    // start

    const binData = ensureBinary(data);
    return isBinary(binData) ? parseBinary(binData) : parseASCII(ensureString(data));
  }
}

const COLOR_SPACE_3MF = SRGBColorSpace$1;

/**
 *
 * 3D Manufacturing Format (3MF) specification: https://3mf.io/specification/
 *
 * The following features from the core specification are supported:
 *
 * - 3D Models
 * - Object Resources (Meshes and Components)
 * - Material Resources (Base Materials)
 *
 * 3MF Materials and Properties Extension are only partially supported.
 *
 * - Texture 2D
 * - Texture 2D Groups
 * - Color Groups (Vertex Colors)
 * - Metallic Display Properties (PBR)
 */

class ThreeMFLoader extends Loader {
  constructor(manager) {
    super(manager);
    this.availableExtensions = [];
  }
  load(url, onLoad, onProgress, onError) {
    const scope = this;
    const loader = new FileLoader(scope.manager);
    loader.setPath(scope.path);
    loader.setResponseType('arraybuffer');
    loader.setRequestHeader(scope.requestHeader);
    loader.setWithCredentials(scope.withCredentials);
    loader.load(url, function (buffer) {
      try {
        onLoad(scope.parse(buffer));
      } catch (e) {
        if (onError) {
          onError(e);
        } else {
          console.error(e);
        }
        scope.manager.itemError(url);
      }
    }, onProgress, onError);
  }
  parse(data) {
    const scope = this;
    const textureLoader = new TextureLoader(this.manager);
    function loadDocument(data) {
      let zip = null;
      let file = null;
      let relsName;
      let modelRelsName;
      const modelPartNames = [];
      const texturesPartNames = [];
      let modelRels;
      const modelParts = {};
      const printTicketParts = {};
      const texturesParts = {};
      const textDecoder = new TextDecoder();
      try {
        zip = unzipSync(new Uint8Array(data));
      } catch (e) {
        if (e instanceof ReferenceError) {
          console.error('THREE.3MFLoader: fflate missing and file is compressed.');
          return null;
        }
      }
      for (file in zip) {
        if (file.match(/\_rels\/.rels$/)) {
          relsName = file;
        } else if (file.match(/3D\/_rels\/.*\.model\.rels$/)) {
          modelRelsName = file;
        } else if (file.match(/^3D\/.*\.model$/)) {
          modelPartNames.push(file);
        } else if (file.match(/^3D\/Textures?\/.*/)) {
          texturesPartNames.push(file);
        }
      }
      if (relsName === undefined) throw new Error('THREE.ThreeMFLoader: Cannot find relationship file `rels` in 3MF archive.');

      //

      const relsView = zip[relsName];
      const relsFileText = textDecoder.decode(relsView);
      const rels = parseRelsXml(relsFileText);

      //

      if (modelRelsName) {
        const relsView = zip[modelRelsName];
        const relsFileText = textDecoder.decode(relsView);
        modelRels = parseRelsXml(relsFileText);
      }

      //

      for (let i = 0; i < modelPartNames.length; i++) {
        const modelPart = modelPartNames[i];
        const view = zip[modelPart];
        const fileText = textDecoder.decode(view);
        const xmlData = new DOMParser().parseFromString(fileText, 'application/xml');
        if (xmlData.documentElement.nodeName.toLowerCase() !== 'model') {
          console.error('THREE.3MFLoader: Error loading 3MF - no 3MF document found: ', modelPart);
        }
        const modelNode = xmlData.querySelector('model');
        const extensions = {};
        for (let i = 0; i < modelNode.attributes.length; i++) {
          const attr = modelNode.attributes[i];
          if (attr.name.match(/^xmlns:(.+)$/)) {
            extensions[attr.value] = RegExp.$1;
          }
        }
        const modelData = parseModelNode(modelNode);
        modelData['xml'] = modelNode;
        if (0 < Object.keys(extensions).length) {
          modelData['extensions'] = extensions;
        }
        modelParts[modelPart] = modelData;
      }

      //

      for (let i = 0; i < texturesPartNames.length; i++) {
        const texturesPartName = texturesPartNames[i];
        texturesParts[texturesPartName] = zip[texturesPartName].buffer;
      }
      return {
        rels: rels,
        modelRels: modelRels,
        model: modelParts,
        printTicket: printTicketParts,
        texture: texturesParts
      };
    }
    function parseRelsXml(relsFileText) {
      const relationships = [];
      const relsXmlData = new DOMParser().parseFromString(relsFileText, 'application/xml');
      const relsNodes = relsXmlData.querySelectorAll('Relationship');
      for (let i = 0; i < relsNodes.length; i++) {
        const relsNode = relsNodes[i];
        const relationship = {
          target: relsNode.getAttribute('Target'),
          //required
          id: relsNode.getAttribute('Id'),
          //required
          type: relsNode.getAttribute('Type') //required
        };
        relationships.push(relationship);
      }
      return relationships;
    }
    function parseMetadataNodes(metadataNodes) {
      const metadataData = {};
      for (let i = 0; i < metadataNodes.length; i++) {
        const metadataNode = metadataNodes[i];
        const name = metadataNode.getAttribute('name');
        const validNames = ['Title', 'Designer', 'Description', 'Copyright', 'LicenseTerms', 'Rating', 'CreationDate', 'ModificationDate'];
        if (0 <= validNames.indexOf(name)) {
          metadataData[name] = metadataNode.textContent;
        }
      }
      return metadataData;
    }
    function parseBasematerialsNode(basematerialsNode) {
      const basematerialsData = {
        id: basematerialsNode.getAttribute('id'),
        // required
        basematerials: []
      };
      const basematerialNodes = basematerialsNode.querySelectorAll('base');
      for (let i = 0; i < basematerialNodes.length; i++) {
        const basematerialNode = basematerialNodes[i];
        const basematerialData = parseBasematerialNode(basematerialNode);
        basematerialData.index = i; // the order and count of the material nodes form an implicit 0-based index
        basematerialsData.basematerials.push(basematerialData);
      }
      return basematerialsData;
    }
    function parseTexture2DNode(texture2DNode) {
      const texture2dData = {
        id: texture2DNode.getAttribute('id'),
        // required
        path: texture2DNode.getAttribute('path'),
        // required
        contenttype: texture2DNode.getAttribute('contenttype'),
        // required
        tilestyleu: texture2DNode.getAttribute('tilestyleu'),
        tilestylev: texture2DNode.getAttribute('tilestylev'),
        filter: texture2DNode.getAttribute('filter')
      };
      return texture2dData;
    }
    function parseTextures2DGroupNode(texture2DGroupNode) {
      const texture2DGroupData = {
        id: texture2DGroupNode.getAttribute('id'),
        // required
        texid: texture2DGroupNode.getAttribute('texid'),
        // required
        displaypropertiesid: texture2DGroupNode.getAttribute('displaypropertiesid')
      };
      const tex2coordNodes = texture2DGroupNode.querySelectorAll('tex2coord');
      const uvs = [];
      for (let i = 0; i < tex2coordNodes.length; i++) {
        const tex2coordNode = tex2coordNodes[i];
        const u = tex2coordNode.getAttribute('u');
        const v = tex2coordNode.getAttribute('v');
        uvs.push(parseFloat(u), parseFloat(v));
      }
      texture2DGroupData['uvs'] = new Float32Array(uvs);
      return texture2DGroupData;
    }
    function parseColorGroupNode(colorGroupNode) {
      const colorGroupData = {
        id: colorGroupNode.getAttribute('id'),
        // required
        displaypropertiesid: colorGroupNode.getAttribute('displaypropertiesid')
      };
      const colorNodes = colorGroupNode.querySelectorAll('color');
      const colors = [];
      const colorObject = new Color$1();
      for (let i = 0; i < colorNodes.length; i++) {
        const colorNode = colorNodes[i];
        const color = colorNode.getAttribute('color');
        colorObject.setStyle(color.substring(0, 7), COLOR_SPACE_3MF);
        colors.push(colorObject.r, colorObject.g, colorObject.b);
      }
      colorGroupData['colors'] = new Float32Array(colors);
      return colorGroupData;
    }
    function parseMetallicDisplaypropertiesNode(metallicDisplaypropetiesNode) {
      const metallicDisplaypropertiesData = {
        id: metallicDisplaypropetiesNode.getAttribute('id') // required
      };
      const metallicNodes = metallicDisplaypropetiesNode.querySelectorAll('pbmetallic');
      const metallicData = [];
      for (let i = 0; i < metallicNodes.length; i++) {
        const metallicNode = metallicNodes[i];
        metallicData.push({
          name: metallicNode.getAttribute('name'),
          // required
          metallicness: parseFloat(metallicNode.getAttribute('metallicness')),
          // required
          roughness: parseFloat(metallicNode.getAttribute('roughness')) // required
        });
      }
      metallicDisplaypropertiesData.data = metallicData;
      return metallicDisplaypropertiesData;
    }
    function parseBasematerialNode(basematerialNode) {
      const basematerialData = {};
      basematerialData['name'] = basematerialNode.getAttribute('name'); // required
      basematerialData['displaycolor'] = basematerialNode.getAttribute('displaycolor'); // required
      basematerialData['displaypropertiesid'] = basematerialNode.getAttribute('displaypropertiesid');
      return basematerialData;
    }
    function parseMeshNode(meshNode) {
      const meshData = {};
      const vertices = [];
      const vertexNodes = meshNode.querySelectorAll('vertices vertex');
      for (let i = 0; i < vertexNodes.length; i++) {
        const vertexNode = vertexNodes[i];
        const x = vertexNode.getAttribute('x');
        const y = vertexNode.getAttribute('y');
        const z = vertexNode.getAttribute('z');
        vertices.push(parseFloat(x), parseFloat(y), parseFloat(z));
      }
      meshData['vertices'] = new Float32Array(vertices);
      const triangleProperties = [];
      const triangles = [];
      const triangleNodes = meshNode.querySelectorAll('triangles triangle');
      for (let i = 0; i < triangleNodes.length; i++) {
        const triangleNode = triangleNodes[i];
        const v1 = triangleNode.getAttribute('v1');
        const v2 = triangleNode.getAttribute('v2');
        const v3 = triangleNode.getAttribute('v3');
        const p1 = triangleNode.getAttribute('p1');
        const p2 = triangleNode.getAttribute('p2');
        const p3 = triangleNode.getAttribute('p3');
        const pid = triangleNode.getAttribute('pid');
        const triangleProperty = {};
        triangleProperty['v1'] = parseInt(v1, 10);
        triangleProperty['v2'] = parseInt(v2, 10);
        triangleProperty['v3'] = parseInt(v3, 10);
        triangles.push(triangleProperty['v1'], triangleProperty['v2'], triangleProperty['v3']);

        // optional

        if (p1) {
          triangleProperty['p1'] = parseInt(p1, 10);
        }
        if (p2) {
          triangleProperty['p2'] = parseInt(p2, 10);
        }
        if (p3) {
          triangleProperty['p3'] = parseInt(p3, 10);
        }
        if (pid) {
          triangleProperty['pid'] = pid;
        }
        if (0 < Object.keys(triangleProperty).length) {
          triangleProperties.push(triangleProperty);
        }
      }
      meshData['triangleProperties'] = triangleProperties;
      meshData['triangles'] = new Uint32Array(triangles);
      return meshData;
    }
    function parseComponentsNode(componentsNode) {
      const components = [];
      const componentNodes = componentsNode.querySelectorAll('component');
      for (let i = 0; i < componentNodes.length; i++) {
        const componentNode = componentNodes[i];
        const componentData = parseComponentNode(componentNode);
        components.push(componentData);
      }
      return components;
    }
    function parseComponentNode(componentNode) {
      const componentData = {};
      componentData['objectId'] = componentNode.getAttribute('objectid'); // required

      const transform = componentNode.getAttribute('transform');
      if (transform) {
        componentData['transform'] = parseTransform(transform);
      }
      return componentData;
    }
    function parseTransform(transform) {
      const t = [];
      transform.split(' ').forEach(function (s) {
        t.push(parseFloat(s));
      });
      const matrix = new Matrix4$1();
      matrix.set(t[0], t[3], t[6], t[9], t[1], t[4], t[7], t[10], t[2], t[5], t[8], t[11], 0.0, 0.0, 0.0, 1.0);
      return matrix;
    }
    function parseObjectNode(objectNode) {
      const objectData = {
        type: objectNode.getAttribute('type')
      };
      const id = objectNode.getAttribute('id');
      if (id) {
        objectData['id'] = id;
      }
      const pid = objectNode.getAttribute('pid');
      if (pid) {
        objectData['pid'] = pid;
      }
      const pindex = objectNode.getAttribute('pindex');
      if (pindex) {
        objectData['pindex'] = pindex;
      }
      const thumbnail = objectNode.getAttribute('thumbnail');
      if (thumbnail) {
        objectData['thumbnail'] = thumbnail;
      }
      const partnumber = objectNode.getAttribute('partnumber');
      if (partnumber) {
        objectData['partnumber'] = partnumber;
      }
      const name = objectNode.getAttribute('name');
      if (name) {
        objectData['name'] = name;
      }
      const meshNode = objectNode.querySelector('mesh');
      if (meshNode) {
        objectData['mesh'] = parseMeshNode(meshNode);
      }
      const componentsNode = objectNode.querySelector('components');
      if (componentsNode) {
        objectData['components'] = parseComponentsNode(componentsNode);
      }
      return objectData;
    }
    function parseResourcesNode(resourcesNode) {
      const resourcesData = {};
      resourcesData['basematerials'] = {};
      const basematerialsNodes = resourcesNode.querySelectorAll('basematerials');
      for (let i = 0; i < basematerialsNodes.length; i++) {
        const basematerialsNode = basematerialsNodes[i];
        const basematerialsData = parseBasematerialsNode(basematerialsNode);
        resourcesData['basematerials'][basematerialsData['id']] = basematerialsData;
      }

      //

      resourcesData['texture2d'] = {};
      const textures2DNodes = resourcesNode.querySelectorAll('texture2d');
      for (let i = 0; i < textures2DNodes.length; i++) {
        const textures2DNode = textures2DNodes[i];
        const texture2DData = parseTexture2DNode(textures2DNode);
        resourcesData['texture2d'][texture2DData['id']] = texture2DData;
      }

      //

      resourcesData['colorgroup'] = {};
      const colorGroupNodes = resourcesNode.querySelectorAll('colorgroup');
      for (let i = 0; i < colorGroupNodes.length; i++) {
        const colorGroupNode = colorGroupNodes[i];
        const colorGroupData = parseColorGroupNode(colorGroupNode);
        resourcesData['colorgroup'][colorGroupData['id']] = colorGroupData;
      }

      //

      resourcesData['pbmetallicdisplayproperties'] = {};
      const pbmetallicdisplaypropertiesNodes = resourcesNode.querySelectorAll('pbmetallicdisplayproperties');
      for (let i = 0; i < pbmetallicdisplaypropertiesNodes.length; i++) {
        const pbmetallicdisplaypropertiesNode = pbmetallicdisplaypropertiesNodes[i];
        const pbmetallicdisplaypropertiesData = parseMetallicDisplaypropertiesNode(pbmetallicdisplaypropertiesNode);
        resourcesData['pbmetallicdisplayproperties'][pbmetallicdisplaypropertiesData['id']] = pbmetallicdisplaypropertiesData;
      }

      //

      resourcesData['texture2dgroup'] = {};
      const textures2DGroupNodes = resourcesNode.querySelectorAll('texture2dgroup');
      for (let i = 0; i < textures2DGroupNodes.length; i++) {
        const textures2DGroupNode = textures2DGroupNodes[i];
        const textures2DGroupData = parseTextures2DGroupNode(textures2DGroupNode);
        resourcesData['texture2dgroup'][textures2DGroupData['id']] = textures2DGroupData;
      }

      //

      resourcesData['object'] = {};
      const objectNodes = resourcesNode.querySelectorAll('object');
      for (let i = 0; i < objectNodes.length; i++) {
        const objectNode = objectNodes[i];
        const objectData = parseObjectNode(objectNode);
        resourcesData['object'][objectData['id']] = objectData;
      }
      return resourcesData;
    }
    function parseBuildNode(buildNode) {
      const buildData = [];
      const itemNodes = buildNode.querySelectorAll('item');
      for (let i = 0; i < itemNodes.length; i++) {
        const itemNode = itemNodes[i];
        const buildItem = {
          objectId: itemNode.getAttribute('objectid')
        };
        const transform = itemNode.getAttribute('transform');
        if (transform) {
          buildItem['transform'] = parseTransform(transform);
        }
        buildData.push(buildItem);
      }
      return buildData;
    }
    function parseModelNode(modelNode) {
      const modelData = {
        unit: modelNode.getAttribute('unit') || 'millimeter'
      };
      const metadataNodes = modelNode.querySelectorAll('metadata');
      if (metadataNodes) {
        modelData['metadata'] = parseMetadataNodes(metadataNodes);
      }
      const resourcesNode = modelNode.querySelector('resources');
      if (resourcesNode) {
        modelData['resources'] = parseResourcesNode(resourcesNode);
      }
      const buildNode = modelNode.querySelector('build');
      if (buildNode) {
        modelData['build'] = parseBuildNode(buildNode);
      }
      return modelData;
    }
    function buildTexture(texture2dgroup, objects, modelData, textureData) {
      const texid = texture2dgroup.texid;
      const texture2ds = modelData.resources.texture2d;
      const texture2d = texture2ds[texid];
      if (texture2d) {
        const data = textureData[texture2d.path];
        const type = texture2d.contenttype;
        const blob = new Blob([data], {
          type: type
        });
        const sourceURI = URL.createObjectURL(blob);
        const texture = textureLoader.load(sourceURI, function () {
          URL.revokeObjectURL(sourceURI);
        });
        texture.colorSpace = COLOR_SPACE_3MF;

        // texture parameters

        switch (texture2d.tilestyleu) {
          case 'wrap':
            texture.wrapS = RepeatWrapping$1;
            break;
          case 'mirror':
            texture.wrapS = MirroredRepeatWrapping$1;
            break;
          case 'none':
          case 'clamp':
            texture.wrapS = ClampToEdgeWrapping$1;
            break;
          default:
            texture.wrapS = RepeatWrapping$1;
        }
        switch (texture2d.tilestylev) {
          case 'wrap':
            texture.wrapT = RepeatWrapping$1;
            break;
          case 'mirror':
            texture.wrapT = MirroredRepeatWrapping$1;
            break;
          case 'none':
          case 'clamp':
            texture.wrapT = ClampToEdgeWrapping$1;
            break;
          default:
            texture.wrapT = RepeatWrapping$1;
        }
        switch (texture2d.filter) {
          case 'auto':
            texture.magFilter = LinearFilter$1;
            texture.minFilter = LinearMipmapLinearFilter$1;
            break;
          case 'linear':
            texture.magFilter = LinearFilter$1;
            texture.minFilter = LinearFilter$1;
            break;
          case 'nearest':
            texture.magFilter = NearestFilter$1;
            texture.minFilter = NearestFilter$1;
            break;
          default:
            texture.magFilter = LinearFilter$1;
            texture.minFilter = LinearMipmapLinearFilter$1;
        }
        return texture;
      } else {
        return null;
      }
    }
    function buildBasematerialsMeshes(basematerials, triangleProperties, meshData, objects, modelData, textureData, objectData) {
      const objectPindex = objectData.pindex;
      const materialMap = {};
      for (let i = 0, l = triangleProperties.length; i < l; i++) {
        const triangleProperty = triangleProperties[i];
        const pindex = triangleProperty.p1 !== undefined ? triangleProperty.p1 : objectPindex;
        if (materialMap[pindex] === undefined) materialMap[pindex] = [];
        materialMap[pindex].push(triangleProperty);
      }

      //

      const keys = Object.keys(materialMap);
      const meshes = [];
      for (let i = 0, l = keys.length; i < l; i++) {
        const materialIndex = keys[i];
        const trianglePropertiesProps = materialMap[materialIndex];
        const basematerialData = basematerials.basematerials[materialIndex];
        const material = getBuild(basematerialData, objects, modelData, textureData, objectData, buildBasematerial);

        //

        const geometry = new BufferGeometry$1();
        const positionData = [];
        const vertices = meshData.vertices;
        for (let j = 0, jl = trianglePropertiesProps.length; j < jl; j++) {
          const triangleProperty = trianglePropertiesProps[j];
          positionData.push(vertices[triangleProperty.v1 * 3 + 0]);
          positionData.push(vertices[triangleProperty.v1 * 3 + 1]);
          positionData.push(vertices[triangleProperty.v1 * 3 + 2]);
          positionData.push(vertices[triangleProperty.v2 * 3 + 0]);
          positionData.push(vertices[triangleProperty.v2 * 3 + 1]);
          positionData.push(vertices[triangleProperty.v2 * 3 + 2]);
          positionData.push(vertices[triangleProperty.v3 * 3 + 0]);
          positionData.push(vertices[triangleProperty.v3 * 3 + 1]);
          positionData.push(vertices[triangleProperty.v3 * 3 + 2]);
        }
        geometry.setAttribute('position', new Float32BufferAttribute$1(positionData, 3));

        //

        const mesh = new Mesh$1(geometry, material);
        meshes.push(mesh);
      }
      return meshes;
    }
    function buildTexturedMesh(texture2dgroup, triangleProperties, meshData, objects, modelData, textureData, objectData) {
      // geometry

      const geometry = new BufferGeometry$1();
      const positionData = [];
      const uvData = [];
      const vertices = meshData.vertices;
      const uvs = texture2dgroup.uvs;
      for (let i = 0, l = triangleProperties.length; i < l; i++) {
        const triangleProperty = triangleProperties[i];
        positionData.push(vertices[triangleProperty.v1 * 3 + 0]);
        positionData.push(vertices[triangleProperty.v1 * 3 + 1]);
        positionData.push(vertices[triangleProperty.v1 * 3 + 2]);
        positionData.push(vertices[triangleProperty.v2 * 3 + 0]);
        positionData.push(vertices[triangleProperty.v2 * 3 + 1]);
        positionData.push(vertices[triangleProperty.v2 * 3 + 2]);
        positionData.push(vertices[triangleProperty.v3 * 3 + 0]);
        positionData.push(vertices[triangleProperty.v3 * 3 + 1]);
        positionData.push(vertices[triangleProperty.v3 * 3 + 2]);

        //

        uvData.push(uvs[triangleProperty.p1 * 2 + 0]);
        uvData.push(uvs[triangleProperty.p1 * 2 + 1]);
        uvData.push(uvs[triangleProperty.p2 * 2 + 0]);
        uvData.push(uvs[triangleProperty.p2 * 2 + 1]);
        uvData.push(uvs[triangleProperty.p3 * 2 + 0]);
        uvData.push(uvs[triangleProperty.p3 * 2 + 1]);
      }
      geometry.setAttribute('position', new Float32BufferAttribute$1(positionData, 3));
      geometry.setAttribute('uv', new Float32BufferAttribute$1(uvData, 2));

      // material

      const texture = getBuild(texture2dgroup, objects, modelData, textureData, objectData, buildTexture);
      const material = new MeshPhongMaterial({
        map: texture,
        flatShading: true
      });

      // mesh

      const mesh = new Mesh$1(geometry, material);
      return mesh;
    }
    function buildVertexColorMesh(colorgroup, triangleProperties, meshData, objectData) {
      // geometry

      const geometry = new BufferGeometry$1();
      const positionData = [];
      const colorData = [];
      const vertices = meshData.vertices;
      const colors = colorgroup.colors;
      for (let i = 0, l = triangleProperties.length; i < l; i++) {
        const triangleProperty = triangleProperties[i];
        const v1 = triangleProperty.v1;
        const v2 = triangleProperty.v2;
        const v3 = triangleProperty.v3;
        positionData.push(vertices[v1 * 3 + 0]);
        positionData.push(vertices[v1 * 3 + 1]);
        positionData.push(vertices[v1 * 3 + 2]);
        positionData.push(vertices[v2 * 3 + 0]);
        positionData.push(vertices[v2 * 3 + 1]);
        positionData.push(vertices[v2 * 3 + 2]);
        positionData.push(vertices[v3 * 3 + 0]);
        positionData.push(vertices[v3 * 3 + 1]);
        positionData.push(vertices[v3 * 3 + 2]);

        //

        const p1 = triangleProperty.p1 !== undefined ? triangleProperty.p1 : objectData.pindex;
        const p2 = triangleProperty.p2 !== undefined ? triangleProperty.p2 : p1;
        const p3 = triangleProperty.p3 !== undefined ? triangleProperty.p3 : p1;
        colorData.push(colors[p1 * 3 + 0]);
        colorData.push(colors[p1 * 3 + 1]);
        colorData.push(colors[p1 * 3 + 2]);
        colorData.push(colors[p2 * 3 + 0]);
        colorData.push(colors[p2 * 3 + 1]);
        colorData.push(colors[p2 * 3 + 2]);
        colorData.push(colors[p3 * 3 + 0]);
        colorData.push(colors[p3 * 3 + 1]);
        colorData.push(colors[p3 * 3 + 2]);
      }
      geometry.setAttribute('position', new Float32BufferAttribute$1(positionData, 3));
      geometry.setAttribute('color', new Float32BufferAttribute$1(colorData, 3));

      // material

      const material = new MeshPhongMaterial({
        vertexColors: true,
        flatShading: true
      });

      // mesh

      const mesh = new Mesh$1(geometry, material);
      return mesh;
    }
    function buildDefaultMesh(meshData) {
      const geometry = new BufferGeometry$1();
      geometry.setIndex(new BufferAttribute$1(meshData['triangles'], 1));
      geometry.setAttribute('position', new BufferAttribute$1(meshData['vertices'], 3));
      const material = new MeshPhongMaterial({
        name: Loader.DEFAULT_MATERIAL_NAME,
        color: 0xffffff,
        flatShading: true
      });
      const mesh = new Mesh$1(geometry, material);
      return mesh;
    }
    function buildMeshes(resourceMap, meshData, objects, modelData, textureData, objectData) {
      const keys = Object.keys(resourceMap);
      const meshes = [];
      for (let i = 0, il = keys.length; i < il; i++) {
        const resourceId = keys[i];
        const triangleProperties = resourceMap[resourceId];
        const resourceType = getResourceType(resourceId, modelData);
        switch (resourceType) {
          case 'material':
            const basematerials = modelData.resources.basematerials[resourceId];
            const newMeshes = buildBasematerialsMeshes(basematerials, triangleProperties, meshData, objects, modelData, textureData, objectData);
            for (let j = 0, jl = newMeshes.length; j < jl; j++) {
              meshes.push(newMeshes[j]);
            }
            break;
          case 'texture':
            const texture2dgroup = modelData.resources.texture2dgroup[resourceId];
            meshes.push(buildTexturedMesh(texture2dgroup, triangleProperties, meshData, objects, modelData, textureData, objectData));
            break;
          case 'vertexColors':
            const colorgroup = modelData.resources.colorgroup[resourceId];
            meshes.push(buildVertexColorMesh(colorgroup, triangleProperties, meshData, objectData));
            break;
          case 'default':
            meshes.push(buildDefaultMesh(meshData));
            break;
          default:
            console.error('THREE.3MFLoader: Unsupported resource type.');
        }
      }
      if (objectData.name) {
        for (let i = 0; i < meshes.length; i++) {
          meshes[i].name = objectData.name;
        }
      }
      return meshes;
    }
    function getResourceType(pid, modelData) {
      if (modelData.resources.texture2dgroup[pid] !== undefined) {
        return 'texture';
      } else if (modelData.resources.basematerials[pid] !== undefined) {
        return 'material';
      } else if (modelData.resources.colorgroup[pid] !== undefined) {
        return 'vertexColors';
      } else if (pid === 'default') {
        return 'default';
      } else {
        return undefined;
      }
    }
    function analyzeObject(meshData, objectData) {
      const resourceMap = {};
      const triangleProperties = meshData['triangleProperties'];
      const objectPid = objectData.pid;
      for (let i = 0, l = triangleProperties.length; i < l; i++) {
        const triangleProperty = triangleProperties[i];
        let pid = triangleProperty.pid !== undefined ? triangleProperty.pid : objectPid;
        if (pid === undefined) pid = 'default';
        if (resourceMap[pid] === undefined) resourceMap[pid] = [];
        resourceMap[pid].push(triangleProperty);
      }
      return resourceMap;
    }
    function buildGroup(meshData, objects, modelData, textureData, objectData) {
      const group = new Group();
      const resourceMap = analyzeObject(meshData, objectData);
      const meshes = buildMeshes(resourceMap, meshData, objects, modelData, textureData, objectData);
      for (let i = 0, l = meshes.length; i < l; i++) {
        group.add(meshes[i]);
      }
      return group;
    }
    function applyExtensions(extensions, meshData, modelXml) {
      if (!extensions) {
        return;
      }
      const availableExtensions = [];
      const keys = Object.keys(extensions);
      for (let i = 0; i < keys.length; i++) {
        const ns = keys[i];
        for (let j = 0; j < scope.availableExtensions.length; j++) {
          const extension = scope.availableExtensions[j];
          if (extension.ns === ns) {
            availableExtensions.push(extension);
          }
        }
      }
      for (let i = 0; i < availableExtensions.length; i++) {
        const extension = availableExtensions[i];
        extension.apply(modelXml, extensions[extension['ns']], meshData);
      }
    }
    function getBuild(data, objects, modelData, textureData, objectData, builder) {
      if (data.build !== undefined) return data.build;
      data.build = builder(data, objects, modelData, textureData, objectData);
      return data.build;
    }
    function buildBasematerial(materialData, objects, modelData) {
      let material;
      const displaypropertiesid = materialData.displaypropertiesid;
      const pbmetallicdisplayproperties = modelData.resources.pbmetallicdisplayproperties;
      if (displaypropertiesid !== null && pbmetallicdisplayproperties[displaypropertiesid] !== undefined) {
        // metallic display property, use StandardMaterial

        const pbmetallicdisplayproperty = pbmetallicdisplayproperties[displaypropertiesid];
        const metallicData = pbmetallicdisplayproperty.data[materialData.index];
        material = new MeshStandardMaterial({
          flatShading: true,
          roughness: metallicData.roughness,
          metalness: metallicData.metallicness
        });
      } else {
        // otherwise use PhongMaterial

        material = new MeshPhongMaterial({
          flatShading: true
        });
      }
      material.name = materialData.name;

      // displaycolor MUST be specified with a value of a 6 or 8 digit hexadecimal number, e.g. "#RRGGBB" or "#RRGGBBAA"

      const displaycolor = materialData.displaycolor;
      const color = displaycolor.substring(0, 7);
      material.color.setStyle(color, COLOR_SPACE_3MF);

      // process alpha if set

      if (displaycolor.length === 9) {
        material.opacity = parseInt(displaycolor.charAt(7) + displaycolor.charAt(8), 16) / 255;
      }
      return material;
    }
    function buildComposite(compositeData, objects, modelData, textureData) {
      const composite = new Group();
      for (let j = 0; j < compositeData.length; j++) {
        const component = compositeData[j];
        let build = objects[component.objectId];
        if (build === undefined) {
          buildObject(component.objectId, objects, modelData, textureData);
          build = objects[component.objectId];
        }
        const object3D = build.clone();

        // apply component transform

        const transform = component.transform;
        if (transform) {
          object3D.applyMatrix4(transform);
        }
        composite.add(object3D);
      }
      return composite;
    }
    function buildObject(objectId, objects, modelData, textureData) {
      const objectData = modelData['resources']['object'][objectId];
      if (objectData['mesh']) {
        const meshData = objectData['mesh'];
        const extensions = modelData['extensions'];
        const modelXml = modelData['xml'];
        applyExtensions(extensions, meshData, modelXml);
        objects[objectData.id] = getBuild(meshData, objects, modelData, textureData, objectData, buildGroup);
      } else {
        const compositeData = objectData['components'];
        objects[objectData.id] = getBuild(compositeData, objects, modelData, textureData, objectData, buildComposite);
      }
      if (objectData.name) {
        objects[objectData.id].name = objectData.name;
      }
    }
    function buildObjects(data3mf) {
      const modelsData = data3mf.model;
      const modelRels = data3mf.modelRels;
      const objects = {};
      const modelsKeys = Object.keys(modelsData);
      const textureData = {};

      // evaluate model relationships to textures

      if (modelRels) {
        for (let i = 0, l = modelRels.length; i < l; i++) {
          const modelRel = modelRels[i];
          const textureKey = modelRel.target.substring(1);
          if (data3mf.texture[textureKey]) {
            textureData[modelRel.target] = data3mf.texture[textureKey];
          }
        }
      }

      // start build

      for (let i = 0; i < modelsKeys.length; i++) {
        const modelsKey = modelsKeys[i];
        const modelData = modelsData[modelsKey];
        const objectIds = Object.keys(modelData['resources']['object']);
        for (let j = 0; j < objectIds.length; j++) {
          const objectId = objectIds[j];
          buildObject(objectId, objects, modelData, textureData);
        }
      }
      return objects;
    }
    function fetch3DModelPart(rels) {
      for (let i = 0; i < rels.length; i++) {
        const rel = rels[i];
        const extension = rel.target.split('.').pop();
        if (extension.toLowerCase() === 'model') return rel;
      }
    }
    function build(objects, data3mf) {
      const group = new Group();
      const relationship = fetch3DModelPart(data3mf['rels']);
      const buildData = data3mf.model[relationship['target'].substring(1)]['build'];
      for (let i = 0; i < buildData.length; i++) {
        const buildItem = buildData[i];
        const object3D = objects[buildItem['objectId']].clone();

        // apply transform

        const transform = buildItem['transform'];
        if (transform) {
          object3D.applyMatrix4(transform);
        }
        group.add(object3D);
      }
      return group;
    }
    const data3mf = loadDocument(data);
    const objects = buildObjects(data3mf);
    return build(objects, data3mf);
  }
  addExtension(extension) {
    this.availableExtensions.push(extension);
  }
}

//
var script$m = {
  name: 'XmlObjectModal',
  components: {},
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      //属性组件名
      propertyComponentsName: 'xml-object-modal-property',
      dialogShow: false,
      curVideoUrl: '',
      curVideoTitle: '',
      curVideoContent: '',
      curVideoPoster: '',
      currentPlayer: {},
      initialTime: 0,
      modalPlayerKey: 'mpk' + new Date().getTime(),
      isLoad: false
    };
  },
  computed: {
    background() {
      return background;
    },
    isEmpty() {
      return !this.pBlockData.title;
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    },
    'blockData.loadingType': {
      handler(newValue) {
        if (this.renderer) {
          this.renderer.dispose();
          this.renderer.forceContextLoss();
          this.renderer.context = null;
          this.renderer.domElement = null;
        }
        if (newValue == 'click') {
          let div = this.$refs.threejsContainer;
          div.innerHTML = '';
          this.isLoad = false;
        } else {
          this.isLoad = true;
          this.$nextTick(() => {
            let div = this.$refs.threejsContainer;
            div.innerHTML = '';
            this.initThree();
          });
        }
      },
      deep: true,
      immediate: true
    }
  },
  mounted() {
    this.blockData = this.pBlockData;
    if (this.blockData.loadingType == 'default') {
      this.isLoad = true;
      if (this.renderer) {
        this.renderer.dispose();
        this.renderer.forceContextLoss();
        this.renderer.context = null;
        this.renderer.domElement = null;
      }
      this.$nextTick(() => {
        this.initThree();
      });
    }
  },
  methods: {
    load3D() {
      console.log(123);
      this.isLoad = true;
      this.$nextTick(() => {
        this.initThree();
      });
    },
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    initThree() {
      this.scene = new Scene();
      this.scene.background = new Color$1(0xffffff); //场景背景色
      // this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
      this.camera = new PerspectiveCamera$1(75, this.$refs.threejsContainer.clientWidth / this.$refs.threejsContainer.clientHeight, 0.1, 1000);
      this.camera.position.set(0, 0, 5);
      this.renderer = new WebGLRenderer({
        antialias: false
      });
      this.renderer.setSize(this.$refs.threejsContainer.clientWidth, this.$refs.threejsContainer.clientHeight);
      // this.renderer.setPixelRatio(window.devicePixelRatio / 1.1);
      this.$refs.threejsContainer.appendChild(this.renderer.domElement);
      // 添加光源
      const ambientLight = new AmbientLight(0xcccccc, 0.4);
      this.scene.add(ambientLight);
      const directionalLight = new DirectionalLight(0xffffff, 0.8);
      directionalLight.position.set(1, 1, 0).normalize();
      this.scene.add(directionalLight);
      this.controls = new OrbitControls(this.camera, this.$refs.threejsContainer);
      this.controls.zoomSpeed = 5;
      this.controls.rotateSpeed = 1;
      // this.controls.addEventListener('change', this.animate); // 监听控制器变化事件
      this.controls.enablePan = true; // 启用平移
      this.controls.enableRotate = true; // 启用旋转
      this.controls.enableZoom = true; // 启用缩放
      this.controls.target.set(0, 0, 0); // 设置控制器的目标点
      // this.camera.add(this.controls); // 将控制器添加到相机实例上
      this.loadModel();
    },
    loadModel() {
      const fileExtension = this.blockData.Modal3DUrl.split('.').pop().toLowerCase();
      const loaderConfig = {
        'fbx': {
          loader: FBXLoader,
          processResult: model => model
        },
        'gltf': {
          loader: GLTFLoader,
          processResult: model => model.scene
        },
        'glb': {
          loader: GLTFLoader,
          processResult: model => model.scene
        },
        'obj': {
          loader: OBJLoader,
          processResult: model => model
        },
        'dae': {
          loader: ColladaLoader,
          processResult: model => model.scene
        },
        'stl': {
          loader: STLLoader,
          processResult: geometry => {
            const material = new MeshStandardMaterial({
              color: 0xaaaaaa
            });
            return new Mesh$1(geometry, material);
          }
        },
        '3mf': {
          loader: ThreeMFLoader,
          processResult: model => model.scene
        }
      };
      const config = loaderConfig[fileExtension];
      if (!config) {
        console.error(`Unsupported file format: ${fileExtension}`);
        return;
      }
      const loader = new config.loader();
      loader.load(this.blockData.Modal3DUrl, result => {
        const model = config.processResult(result);
        this.handleLoadedModel(model);
      }, progress => {
        const percentComplete = progress.loaded / progress.total * 100;
        console.log(`Loading: ${Math.round(percentComplete)}%`);
      }, error => {
        console.error(`Error loading ${fileExtension.toUpperCase()} model:`, error);
      });
    },
    handleLoadedModel(model) {
      const box = new Box3$1().setFromObject(model);
      const size = box.getSize(new Vector3$1());
      const maxDimension = 4;
      const maxModelSize = Math.max(size.x, size.y, size.z);
      const scale = maxDimension / maxModelSize;
      const center = box.getCenter(new Vector3$1());
      model.position.sub(center);
      model.scale.set(scale, scale, scale);
      this.loadedModel = model;
      this.scene.background = new Color$1(0xe6f0ff);
      this.scene.add(model);
      this.animate();
    },
    animate() {
      requestAnimationFrame(this.animate);
      this.renderer.render(this.scene, this.camera);
    }
  }
};

/* script */
const __vue_script__$m = script$m;
/* template */
var __vue_render__$m = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      class: [
        "xml-object-modal-container",
        "object-model-content",
        "xml-object-modal-container-" + _vm.pageType,
      ],
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _c(
        "div",
        {
          style: {
            width: _vm.blockData.width ? _vm.blockData.width + "%" : "100%",
          },
        },
        [
          _vm.blockData.loadingType == "click" && _vm.isLoad == false
            ? _c(
                "div",
                {
                  staticClass: "object3d-btn",
                  style: {
                    background:
                      "url(" +
                      _vm.blockData.imgUrl +
                      ") no-repeat center center",
                    backgroundSize: "contain",
                  },
                },
                [
                  _c("span", { on: { click: _vm.load3D } }, [
                    _vm._v("加载模型"),
                  ]),
                ]
              )
            : _c("div", {
                ref: "threejsContainer",
                staticClass: "threejs-container",
              }),
          _vm._v(" "),
          _vm.blockData.showTitle == "1" && _vm.blockData.title
            ? _c(
                "p",
                {
                  staticClass: "object3d-title",
                  style: {
                    marginTop:
                      _vm.blockData.titlePosition == "below" ? "0" : "-32px",
                    textAlign: _vm.blockData.alignment,
                  },
                },
                [_vm._v(_vm._s(_vm.blockData.title))]
              )
            : _vm._e(),
        ]
      ),
    ]
  )
};
var __vue_staticRenderFns__$m = [];
__vue_render__$m._withStripped = true;

  /* style */
  const __vue_inject_styles__$m = undefined;
  /* scoped */
  const __vue_scope_id__$m = "data-v-1f63d552";
  /* module identifier */
  const __vue_module_identifier__$m = undefined;
  /* functional template */
  const __vue_is_functional_template__$m = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$m = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$m, staticRenderFns: __vue_staticRenderFns__$m },
    __vue_inject_styles__$m,
    __vue_script__$m,
    __vue_scope_id__$m,
    __vue_is_functional_template__$m,
    __vue_module_identifier__$m,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$m.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1(__vue_component__$m.name, {
    prefix: options.prefix
  }), __vue_component__$m);
};

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$l = {
  name: 'XmlTextareaRender',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    officePreviewPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isReader: {
      // 是否阅读器
      type: Boolean,
      default: false
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      ouchnOss: null,
      propertyComponentsName: 'xml-textarea-property',
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      innerText: '',
      textareaWidth: 0,
      pageWidth: 0,
      placeholder: 0,
      fontWidth: 0,
      rows: 5
    };
  },
  computed: {},
  methods: {
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    handleInput(e) {
      this.innerText = e.target.innerText;
    },
    textareaClick(index) {
      setTimeout(() => {
        this.$refs['xmlTextarea' + index][0].focus();
      }, 200);
    }
  },
  created() {},
  mounted() {}
};

/* script */
const __vue_script__$l = script$l;
/* template */
var __vue_render__$l = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-textarea",
      class: "xml-textarea-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    _vm._l(_vm.blockData.textareaList, function (item, index) {
      return _c(
        "div",
        {
          key: index,
          staticClass: "wrapper",
          style: {
            minHeight: item.rows * 30 + "px",
            "--xml-textarea-typeface": item.typeface,
          },
        },
        [
          _c(
            "div",
            {
              staticClass: "textarea-box",
              class: [
                item.border != 1 ? "horizontal-line" : "",
                item.border != 2 ? "textarea-border" : "",
              ],
              on: {
                click: function ($event) {
                  return _vm.textareaClick(index)
                },
              },
            },
            [
              _c(
                "div",
                {
                  directives: [
                    {
                      name: "show",
                      rawName: "v-show",
                      value: item.isShowImg == "2",
                      expression: "item.isShowImg == '2'",
                    },
                  ],
                  staticClass: "float",
                },
                [
                  _c("img", {
                    staticClass: "img",
                    attrs: { src: item.imageUrl },
                  }),
                ]
              ),
              _vm._v(" "),
              _c("span", { staticClass: "title" }, [
                _vm._v(_vm._s(item.title)),
              ]),
              _vm._v(" "),
              _c("span", {
                ref: "xmlTextarea" + index,
                refInFor: true,
                staticClass: "content textarea",
                attrs: { contenteditable: "true" },
                on: { input: _vm.handleInput },
              }),
            ]
          ),
        ]
      )
    }),
    0
  )
};
var __vue_staticRenderFns__$l = [];
__vue_render__$l._withStripped = true;

  /* style */
  const __vue_inject_styles__$l = undefined;
  /* scoped */
  const __vue_scope_id__$l = "data-v-ebdf8e18";
  /* module identifier */
  const __vue_module_identifier__$l = undefined;
  /* functional template */
  const __vue_is_functional_template__$l = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$l = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$l, staticRenderFns: __vue_staticRenderFns__$l },
    __vue_inject_styles__$l,
    __vue_script__$l,
    __vue_scope_id__$l,
    __vue_is_functional_template__$l,
    __vue_module_identifier__$l,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$l.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('resource-render', {
    prefix: options.prefix
  }), __vue_component__$l);
};

var jsmind = createCommonjsModule(function (module, exports) {
(function ($w) {

  console.warn("The version is outdated. see details: https://hizzgdev.github.io/jsmind/es6/");
  // set 'jsMind' as the library name.
  // __name__ should be a const value, Never try to change it easily.
  var __name__ = 'jsMind';
  // library version
  var __version__ = '0.5.7';
  // author
  var __author__ = 'hizzgdev@163.com';

  // an noop function define
  var _noop = function () {};
  var logger = typeof console === 'undefined' ? {
    log: _noop,
    debug: _noop,
    error: _noop,
    warn: _noop,
    info: _noop
  } : console;

  // check global variables
  if (!module.exports) {
    if (typeof $w[__name__] != 'undefined') {
      logger.log(__name__ + ' has been already exist.');
      return;
    }
  }

  // shortcut of methods in dom
  var $d = $w.document;
  var $g = function (id) {
    return $d.getElementById(id);
  };
  var $c = function (tag) {
    return $d.createElement(tag);
  };
  var $t = function (n, t) {
    if (n.hasChildNodes()) {
      n.firstChild.nodeValue = t;
    } else {
      n.appendChild($d.createTextNode(t));
    }
  };
  var $h = function (n, t) {
    if (t instanceof HTMLElement) {
      n.innerHTML = '';
      n.appendChild(t);
    } else {
      n.innerHTML = t;
    }
  };
  // detect isElement
  var $i = function (el) {
    return !!el && typeof el === 'object' && el.nodeType === 1 && typeof el.style === 'object' && typeof el.ownerDocument === 'object';
  };
  if (typeof String.prototype.startsWith != 'function') {
    String.prototype.startsWith = function (p) {
      return this.slice(0, p.length) === p;
    };
  }
  var DEFAULT_OPTIONS = {
    container: '',
    // id of the container
    editable: false,
    // you can change it in your options
    theme: null,
    mode: 'full',
    // full or side
    support_html: true,
    view: {
      engine: 'canvas',
      hmargin: 100,
      vmargin: 50,
      line_width: 2,
      line_color: '#555',
      draggable: false,
      // drag the mind map with your mouse, when it's larger that the container
      hide_scrollbars_when_draggable: false,
      // hide container scrollbars, when mind map is larger than container and draggable option is true.
      node_overflow: 'hidden' // hidden or wrap
    },
    layout: {
      hspace: 30,
      vspace: 20,
      pspace: 13,
      cousin_space: 0
    },
    default_event_handle: {
      enable_mousedown_handle: true,
      enable_click_handle: true,
      enable_dblclick_handle: true,
      enable_mousewheel_handle: true
    },
    shortcut: {
      enable: true,
      handles: {},
      mapping: {
        addchild: [45, 4096 + 13],
        // Insert, Ctrl+Enter
        addbrother: 13,
        // Enter
        editnode: 113,
        // F2
        delnode: 46,
        // Delete
        toggle: 32,
        // Space
        left: 37,
        // Left
        up: 38,
        // Up
        right: 39,
        // Right
        down: 40 // Down
      }
    }
  };

  // core object
  var jm = function (options) {
    jm.current = this;
    this.version = __version__;
    var opts = {};
    jm.util.json.merge(opts, DEFAULT_OPTIONS);
    jm.util.json.merge(opts, options);
    if (!opts.container) {
      logger.error('the options.container should not be null or empty.');
      return;
    }
    this.options = opts;
    this.initialized = false;
    this.mind = null;
    this.event_handles = [];
    this.init();
  };

  // ============= static object =============================================
  jm.direction = {
    left: -1,
    center: 0,
    right: 1,
    of: function (dir) {
      if (!dir || dir === -1 || dir === 0 || dir === 1) {
        return dir;
      }
      if (dir === '-1' || dir === '0' || dir === '1') {
        return parseInt(dir);
      }
      if (dir.toLowerCase() === 'left') {
        return this.left;
      }
      if (dir.toLowerCase() === 'right') {
        return this.right;
      }
      if (dir.toLowerCase() === 'center') {
        return this.center;
      }
    }
  };
  jm.event_type = {
    show: 1,
    resize: 2,
    edit: 3,
    select: 4
  };
  jm.key = {
    meta: 1 << 13,
    ctrl: 1 << 12,
    alt: 1 << 11,
    shift: 1 << 10
  };
  jm.node = function (sId, iIndex, sTopic, oData, bIsRoot, oParent, eDirection, bExpanded) {
    if (!sId) {
      logger.error('invalid node id');
      return;
    }
    if (typeof iIndex != 'number') {
      logger.error('invalid node index');
      return;
    }
    if (typeof bExpanded === 'undefined') {
      bExpanded = true;
    }
    this.id = sId;
    this.index = iIndex;
    this.topic = sTopic;
    this.data = oData || {};
    this.isroot = bIsRoot;
    this.parent = oParent;
    this.direction = eDirection;
    this.expanded = !!bExpanded;
    this.children = [];
    this._data = {};
  };
  jm.node.compare = function (node1, node2) {
    // '-1' is alwary the last
    var r = 0;
    var i1 = node1.index;
    var i2 = node2.index;
    if (i1 >= 0 && i2 >= 0) {
      r = i1 - i2;
    } else if (i1 == -1 && i2 == -1) {
      r = 0;
    } else if (i1 == -1) {
      r = 1;
    } else if (i2 == -1) {
      r = -1;
    } else {
      r = 0;
    }
    //logger.debug(i1+' <> '+i2+'  =  '+r);
    return r;
  };
  jm.node.inherited = function (pnode, node) {
    if (!!pnode && !!node) {
      if (pnode.id === node.id) {
        return true;
      }
      if (pnode.isroot) {
        return true;
      }
      var pid = pnode.id;
      var p = node;
      while (!p.isroot) {
        p = p.parent;
        if (p.id === pid) {
          return true;
        }
      }
    }
    return false;
  };
  jm.node.is_node = function (n) {
    return !!n && n instanceof jm.node;
  };
  jm.node.prototype = {
    get_location: function () {
      var vd = this._data.view;
      return {
        x: vd.abs_x,
        y: vd.abs_y
      };
    },
    get_size: function () {
      var vd = this._data.view;
      return {
        w: vd.width,
        h: vd.height
      };
    }
  };
  jm.mind = function () {
    this.name = null;
    this.author = null;
    this.version = null;
    this.root = null;
    this.selected = null;
    this.nodes = {};
  };
  jm.mind.prototype = {
    get_node: function (nodeid) {
      if (nodeid in this.nodes) {
        return this.nodes[nodeid];
      } else {
        logger.warn('the node[id=' + nodeid + '] can not be found');
        return null;
      }
    },
    set_root: function (nodeid, topic, data) {
      if (this.root == null) {
        this.root = new jm.node(nodeid, 0, topic, data, true);
        this._put_node(this.root);
        return this.root;
      } else {
        logger.error('root node is already exist');
        return null;
      }
    },
    add_node: function (parent_node, nodeid, topic, data, direction, expanded, idx) {
      if (!jm.util.is_node(parent_node)) {
        logger.error('the parent_node ' + parent_node + ' is not a node.');
        return null;
      }
      var node_index = idx || -1;
      var node = new jm.node(nodeid, node_index, topic, data, false, parent_node, parent_node.direction, expanded);
      if (parent_node.isroot) {
        node.direction = direction || jm.direction.right;
      }
      if (this._put_node(node)) {
        parent_node.children.push(node);
        this._reindex(parent_node);
      } else {
        logger.error('fail, the nodeid \'' + node.id + '\' has been already exist.');
        node = null;
      }
      return node;
    },
    insert_node_before: function (node_before, nodeid, topic, data, direction) {
      if (!jm.util.is_node(node_before)) {
        logger.error('the node_before ' + node_before + ' is not a node.');
        return null;
      }
      var node_index = node_before.index - 0.5;
      return this.add_node(node_before.parent, nodeid, topic, data, direction, true, node_index);
    },
    get_node_before: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return null;
        } else {
          return this.get_node_before(the_node);
        }
      }
      if (node.isroot) {
        return null;
      }
      var idx = node.index - 2;
      if (idx >= 0) {
        return node.parent.children[idx];
      } else {
        return null;
      }
    },
    insert_node_after: function (node_after, nodeid, topic, data, direction) {
      if (!jm.util.is_node(node_after)) {
        logger.error('the node_after ' + node_after + ' is not a node.');
        return null;
      }
      var node_index = node_after.index + 0.5;
      return this.add_node(node_after.parent, nodeid, topic, data, direction, true, node_index);
    },
    get_node_after: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return null;
        } else {
          return this.get_node_after(the_node);
        }
      }
      if (node.isroot) {
        return null;
      }
      var idx = node.index;
      var brothers = node.parent.children;
      if (brothers.length > idx) {
        return node.parent.children[idx];
      } else {
        return null;
      }
    },
    move_node: function (node, before_id, parent_id, direction) {
      if (!jm.util.is_node(node)) {
        logger.error('the parameter node ' + node + ' is not a node.');
        return null;
      }
      if (!parent_id) {
        parent_id = node.parent.id;
      }
      return this._move_node(node, before_id, parent_id, direction);
    },
    _flow_node_direction: function (node, direction) {
      if (typeof direction === 'undefined') {
        direction = node.direction;
      } else {
        node.direction = direction;
      }
      var len = node.children.length;
      while (len--) {
        this._flow_node_direction(node.children[len], direction);
      }
    },
    _move_node_internal: function (node, beforeid) {
      if (!!node && !!beforeid) {
        if (beforeid == '_last_') {
          node.index = -1;
          this._reindex(node.parent);
        } else if (beforeid == '_first_') {
          node.index = 0;
          this._reindex(node.parent);
        } else {
          var node_before = !!beforeid ? this.get_node(beforeid) : null;
          if (node_before != null && node_before.parent != null && node_before.parent.id == node.parent.id) {
            node.index = node_before.index - 0.5;
            this._reindex(node.parent);
          }
        }
      }
      return node;
    },
    _move_node: function (node, beforeid, parentid, direction) {
      if (!!node && !!parentid) {
        var parent_node = this.get_node(parentid);
        if (jm.node.inherited(node, parent_node)) {
          logger.error('can not move a node to its children');
          return null;
        }
        if (node.parent.id != parentid) {
          // remove from parent's children
          var sibling = node.parent.children;
          var si = sibling.length;
          while (si--) {
            if (sibling[si].id == node.id) {
              sibling.splice(si, 1);
              break;
            }
          }
          node.parent = parent_node;
          parent_node.children.push(node);
        }
        if (node.parent.isroot) {
          if (direction == jm.direction.left) {
            node.direction = direction;
          } else {
            node.direction = jm.direction.right;
          }
        } else {
          node.direction = node.parent.direction;
        }
        this._move_node_internal(node, beforeid);
        this._flow_node_direction(node);
      }
      return node;
    },
    remove_node: function (node) {
      if (!jm.util.is_node(node)) {
        logger.error('the parameter node ' + node + ' is not a node.');
        return false;
      }
      if (node.isroot) {
        logger.error('fail, can not remove root node');
        return false;
      }
      if (this.selected != null && this.selected.id == node.id) {
        this.selected = null;
      }
      // clean all subordinate nodes
      var children = node.children;
      var ci = children.length;
      while (ci--) {
        this.remove_node(children[ci]);
      }
      // clean all children
      children.length = 0;
      // remove from parent's children
      var sibling = node.parent.children;
      var si = sibling.length;
      while (si--) {
        if (sibling[si].id == node.id) {
          sibling.splice(si, 1);
          break;
        }
      }
      // remove from global nodes
      delete this.nodes[node.id];
      // clean all properties
      for (var k in node) {
        delete node[k];
      }
      // remove it's self
      node = null;
      //delete node;
      return true;
    },
    _put_node: function (node) {
      if (node.id in this.nodes) {
        logger.warn('the nodeid \'' + node.id + '\' has been already exist.');
        return false;
      } else {
        this.nodes[node.id] = node;
        return true;
      }
    },
    _reindex: function (node) {
      if (node instanceof jm.node) {
        node.children.sort(jm.node.compare);
        for (var i = 0; i < node.children.length; i++) {
          node.children[i].index = i + 1;
        }
      }
    }
  };
  jm.format = {
    node_tree: {
      example: {
        "meta": {
          "name": __name__,
          "author": __author__,
          "version": __version__
        },
        "format": "node_tree",
        "data": {
          "id": "root",
          "topic": "jsMind Example"
        }
      },
      get_mind: function (source) {
        var df = jm.format.node_tree;
        var mind = new jm.mind();
        mind.name = source.meta.name;
        mind.author = source.meta.author;
        mind.version = source.meta.version;
        df._parse(mind, source.data);
        return mind;
      },
      get_data: function (mind) {
        var df = jm.format.node_tree;
        var json = {};
        json.meta = {
          name: mind.name,
          author: mind.author,
          version: mind.version
        };
        json.format = 'node_tree';
        json.data = df._buildnode(mind.root);
        return json;
      },
      _parse: function (mind, node_root) {
        var df = jm.format.node_tree;
        var data = df._extract_data(node_root);
        mind.set_root(node_root.id, node_root.topic, data);
        if ('children' in node_root) {
          var children = node_root.children;
          for (var i = 0; i < children.length; i++) {
            df._extract_subnode(mind, mind.root, children[i]);
          }
        }
      },
      _extract_data: function (node_json) {
        var data = {};
        for (var k in node_json) {
          if (k == 'id' || k == 'topic' || k == 'children' || k == 'direction' || k == 'expanded') {
            continue;
          }
          data[k] = node_json[k];
        }
        return data;
      },
      _extract_subnode: function (mind, node_parent, node_json) {
        var df = jm.format.node_tree;
        var data = df._extract_data(node_json);
        var d = null;
        if (node_parent.isroot) {
          d = node_json.direction == 'left' ? jm.direction.left : jm.direction.right;
        }
        var node = mind.add_node(node_parent, node_json.id, node_json.topic, data, d, node_json.expanded);
        if (!!node_json['children']) {
          var children = node_json.children;
          for (var i = 0; i < children.length; i++) {
            df._extract_subnode(mind, node, children[i]);
          }
        }
      },
      _buildnode: function (node) {
        var df = jm.format.node_tree;
        if (!(node instanceof jm.node)) {
          return;
        }
        var o = {
          id: node.id,
          topic: node.topic,
          expanded: node.expanded
        };
        if (!!node.parent && node.parent.isroot) {
          o.direction = node.direction == jm.direction.left ? 'left' : 'right';
        }
        if (node.data != null) {
          var node_data = node.data;
          for (var k in node_data) {
            o[k] = node_data[k];
          }
        }
        var children = node.children;
        if (children.length > 0) {
          o.children = [];
          for (var i = 0; i < children.length; i++) {
            o.children.push(df._buildnode(children[i]));
          }
        }
        return o;
      }
    },
    node_array: {
      example: {
        "meta": {
          "name": __name__,
          "author": __author__,
          "version": __version__
        },
        "format": "node_array",
        "data": [{
          "id": "root",
          "topic": "jsMind Example",
          "isroot": true
        }]
      },
      get_mind: function (source) {
        var df = jm.format.node_array;
        var mind = new jm.mind();
        mind.name = source.meta.name;
        mind.author = source.meta.author;
        mind.version = source.meta.version;
        df._parse(mind, source.data);
        return mind;
      },
      get_data: function (mind) {
        var df = jm.format.node_array;
        var json = {};
        json.meta = {
          name: mind.name,
          author: mind.author,
          version: mind.version
        };
        json.format = 'node_array';
        json.data = [];
        df._array(mind, json.data);
        return json;
      },
      _parse: function (mind, node_array) {
        var df = jm.format.node_array;
        var narray = node_array.slice(0);
        // reverse array for improving looping performance
        narray.reverse();
        var root_node = df._extract_root(mind, narray);
        if (!!root_node) {
          df._extract_subnode(mind, root_node, narray);
        } else {
          logger.error('root node can not be found');
        }
      },
      _extract_root: function (mind, node_array) {
        var df = jm.format.node_array;
        var i = node_array.length;
        while (i--) {
          if ('isroot' in node_array[i] && node_array[i].isroot) {
            var root_json = node_array[i];
            var data = df._extract_data(root_json);
            var node = mind.set_root(root_json.id, root_json.topic, data);
            node_array.splice(i, 1);
            return node;
          }
        }
        return null;
      },
      _extract_subnode: function (mind, parent_node, node_array) {
        var df = jm.format.node_array;
        var i = node_array.length;
        var node_json = null;
        var data = null;
        var extract_count = 0;
        while (i--) {
          node_json = node_array[i];
          if (node_json.parentid == parent_node.id) {
            data = df._extract_data(node_json);
            var d = null;
            var node_direction = node_json.direction;
            if (!!node_direction) {
              d = node_direction == 'left' ? jm.direction.left : jm.direction.right;
            }
            var node = mind.add_node(parent_node, node_json.id, node_json.topic, data, d, node_json.expanded);
            node_array.splice(i, 1);
            extract_count++;
            var sub_extract_count = df._extract_subnode(mind, node, node_array);
            if (sub_extract_count > 0) {
              // reset loop index after extract subordinate node
              i = node_array.length;
              extract_count += sub_extract_count;
            }
          }
        }
        return extract_count;
      },
      _extract_data: function (node_json) {
        var data = {};
        for (var k in node_json) {
          if (k == 'id' || k == 'topic' || k == 'parentid' || k == 'isroot' || k == 'direction' || k == 'expanded') {
            continue;
          }
          data[k] = node_json[k];
        }
        return data;
      },
      _array: function (mind, node_array) {
        var df = jm.format.node_array;
        df._array_node(mind.root, node_array);
      },
      _array_node: function (node, node_array) {
        var df = jm.format.node_array;
        if (!(node instanceof jm.node)) {
          return;
        }
        var o = {
          id: node.id,
          topic: node.topic,
          expanded: node.expanded
        };
        if (!!node.parent) {
          o.parentid = node.parent.id;
        }
        if (node.isroot) {
          o.isroot = true;
        }
        if (!!node.parent && node.parent.isroot) {
          o.direction = node.direction == jm.direction.left ? 'left' : 'right';
        }
        if (node.data != null) {
          var node_data = node.data;
          for (var k in node_data) {
            o[k] = node_data[k];
          }
        }
        node_array.push(o);
        var ci = node.children.length;
        for (var i = 0; i < ci; i++) {
          df._array_node(node.children[i], node_array);
        }
      }
    },
    freemind: {
      example: {
        "meta": {
          "name": __name__,
          "author": __author__,
          "version": __version__
        },
        "format": "freemind",
        "data": "<map version=\"1.0.1\"><node ID=\"root\" TEXT=\"freemind Example\"/></map>"
      },
      get_mind: function (source) {
        var df = jm.format.freemind;
        var mind = new jm.mind();
        mind.name = source.meta.name;
        mind.author = source.meta.author;
        mind.version = source.meta.version;
        var xml = source.data;
        var xml_doc = df._parse_xml(xml);
        var xml_root = df._find_root(xml_doc);
        df._load_node(mind, null, xml_root);
        return mind;
      },
      get_data: function (mind) {
        var df = jm.format.freemind;
        var json = {};
        json.meta = {
          name: mind.name,
          author: mind.author,
          version: mind.version
        };
        json.format = 'freemind';
        var xmllines = [];
        xmllines.push('<map version=\"1.0.1\">');
        df._buildmap(mind.root, xmllines);
        xmllines.push('</map>');
        json.data = xmllines.join(' ');
        return json;
      },
      _parse_xml: function (xml) {
        var xml_doc = null;
        if (window.DOMParser) {
          var parser = new DOMParser();
          xml_doc = parser.parseFromString(xml, 'text/xml');
        } else {
          // Internet Explorer
          xml_doc = new ActiveXObject('Microsoft.XMLDOM');
          xml_doc.async = false;
          xml_doc.loadXML(xml);
        }
        return xml_doc;
      },
      _find_root: function (xml_doc) {
        var nodes = xml_doc.childNodes;
        var node = null;
        var n = null;
        for (var i = 0; i < nodes.length; i++) {
          n = nodes[i];
          if (n.nodeType == 1 && n.tagName == 'map') {
            node = n;
            break;
          }
        }
        if (!!node) {
          var ns = node.childNodes;
          node = null;
          for (var i = 0; i < ns.length; i++) {
            n = ns[i];
            if (n.nodeType == 1 && n.tagName == 'node') {
              node = n;
              break;
            }
          }
        }
        return node;
      },
      _load_node: function (mind, parent_node, xml_node) {
        var df = jm.format.freemind;
        var node_id = xml_node.getAttribute('ID');
        var node_topic = xml_node.getAttribute('TEXT');
        // look for richcontent
        if (node_topic == null) {
          var topic_children = xml_node.childNodes;
          var topic_child = null;
          for (var i = 0; i < topic_children.length; i++) {
            topic_child = topic_children[i];
            //logger.debug(topic_child.tagName);
            if (topic_child.nodeType == 1 && topic_child.tagName === 'richcontent') {
              node_topic = topic_child.textContent;
              break;
            }
          }
        }
        var node_data = df._load_attributes(xml_node);
        var node_expanded = 'expanded' in node_data ? node_data.expanded == 'true' : true;
        delete node_data.expanded;
        var node_position = xml_node.getAttribute('POSITION');
        var node_direction = null;
        if (!!node_position) {
          node_direction = node_position == 'left' ? jm.direction.left : jm.direction.right;
        }
        //logger.debug(node_position +':'+ node_direction);
        var node = null;
        if (!!parent_node) {
          node = mind.add_node(parent_node, node_id, node_topic, node_data, node_direction, node_expanded);
        } else {
          node = mind.set_root(node_id, node_topic, node_data);
        }
        var children = xml_node.childNodes;
        var child = null;
        for (var i = 0; i < children.length; i++) {
          child = children[i];
          if (child.nodeType == 1 && child.tagName == 'node') {
            df._load_node(mind, node, child);
          }
        }
      },
      _load_attributes: function (xml_node) {
        var children = xml_node.childNodes;
        var attr = null;
        var attr_data = {};
        for (var i = 0; i < children.length; i++) {
          attr = children[i];
          if (attr.nodeType == 1 && attr.tagName === 'attribute') {
            attr_data[attr.getAttribute('NAME')] = attr.getAttribute('VALUE');
          }
        }
        return attr_data;
      },
      _buildmap: function (node, xmllines) {
        var df = jm.format.freemind;
        var pos = null;
        if (!!node.parent && node.parent.isroot) {
          pos = node.direction === jm.direction.left ? 'left' : 'right';
        }
        xmllines.push('<node');
        xmllines.push('ID=\"' + node.id + '\"');
        if (!!pos) {
          xmllines.push('POSITION=\"' + pos + '\"');
        }
        xmllines.push('TEXT=\"' + node.topic + '\">');

        // store expanded status as an attribute
        xmllines.push('<attribute NAME=\"expanded\" VALUE=\"' + node.expanded + '\"/>');

        // for attributes
        var node_data = node.data;
        if (node_data != null) {
          for (var k in node_data) {
            xmllines.push('<attribute NAME=\"' + k + '\" VALUE=\"' + node_data[k] + '\"/>');
          }
        }

        // for children
        var children = node.children;
        for (var i = 0; i < children.length; i++) {
          df._buildmap(children[i], xmllines);
        }
        xmllines.push('</node>');
      }
    }
  };

  // ============= utility object =============================================

  jm.util = {
    is_node: function (node) {
      return !!node && node instanceof jm.node;
    },
    ajax: {
      request: function (url, param, method, callback, fail_callback) {
        jm.util.ajax;
        var p = null;
        var tmp_param = [];
        for (var k in param) {
          tmp_param.push(encodeURIComponent(k) + '=' + encodeURIComponent(param[k]));
        }
        if (tmp_param.length > 0) {
          p = tmp_param.join('&');
        }
        var xhr = new XMLHttpRequest();
        if (!xhr) {
          return;
        }
        xhr.onreadystatechange = function () {
          if (xhr.readyState == 4) {
            if (xhr.status == 200 || xhr.status == 0) {
              if (typeof callback === 'function') {
                var data = jm.util.json.string2json(xhr.responseText);
                if (data != null) {
                  callback(data);
                } else {
                  callback(xhr.responseText);
                }
              }
            } else {
              if (typeof fail_callback === 'function') {
                fail_callback(xhr);
              } else {
                logger.error('xhr request failed.', xhr);
              }
            }
          }
        };
        method = method || 'GET';
        xhr.open(method, url, true);
        xhr.setRequestHeader('If-Modified-Since', '0');
        if (method == 'POST') {
          xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=utf-8');
          xhr.send(p);
        } else {
          xhr.send();
        }
      },
      get: function (url, callback) {
        return jm.util.ajax.request(url, {}, 'GET', callback);
      },
      post: function (url, param, callback) {
        return jm.util.ajax.request(url, param, 'POST', callback);
      }
    },
    dom: {
      //target,eventType,handler
      add_event: function (t, e, h) {
        if (!!t.addEventListener) {
          t.addEventListener(e, h, false);
        } else {
          t.attachEvent('on' + e, h);
        }
      }
    },
    file: {
      read: function (file_data, fn_callback) {
        var reader = new FileReader();
        reader.onload = function () {
          if (typeof fn_callback === 'function') {
            fn_callback(this.result, file_data.name);
          }
        };
        reader.readAsText(file_data);
      },
      save: function (file_data, type, name) {
        var blob;
        if (typeof $w.Blob === 'function') {
          blob = new Blob([file_data], {
            type: type
          });
        } else {
          var BlobBuilder = $w.BlobBuilder || $w.MozBlobBuilder || $w.WebKitBlobBuilder || $w.MSBlobBuilder;
          var bb = new BlobBuilder();
          bb.append(file_data);
          blob = bb.getBlob(type);
        }
        if (navigator.msSaveBlob) {
          navigator.msSaveBlob(blob, name);
        } else {
          var URL = $w.URL || $w.webkitURL;
          var bloburl = URL.createObjectURL(blob);
          var anchor = $c('a');
          if ('download' in anchor) {
            anchor.style.visibility = 'hidden';
            anchor.href = bloburl;
            anchor.download = name;
            $d.body.appendChild(anchor);
            var evt = $d.createEvent('MouseEvents');
            evt.initEvent('click', true, true);
            anchor.dispatchEvent(evt);
            $d.body.removeChild(anchor);
          } else {
            location.href = bloburl;
          }
        }
      }
    },
    json: {
      json2string: function (json) {
        return JSON.stringify(json);
      },
      string2json: function (json_str) {
        return JSON.parse(json_str);
      },
      merge: function (b, a) {
        for (var o in a) {
          if (o in b) {
            if (typeof b[o] === 'object' && Object.prototype.toString.call(b[o]).toLowerCase() == '[object object]' && !b[o].length) {
              jm.util.json.merge(b[o], a[o]);
            } else {
              b[o] = a[o];
            }
          } else {
            b[o] = a[o];
          }
        }
        return b;
      }
    },
    uuid: {
      newid: function () {
        return (new Date().getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
      }
    },
    text: {
      is_empty: function (s) {
        if (!s) {
          return true;
        }
        return s.replace(/\s*/, '').length == 0;
      }
    }
  };
  jm.prototype = {
    init: function () {
      if (this.initialized) {
        return;
      }
      this.initialized = true;
      var opts = this.options;
      var opts_layout = {
        mode: opts.mode,
        hspace: opts.layout.hspace,
        vspace: opts.layout.vspace,
        pspace: opts.layout.pspace,
        cousin_space: opts.layout.cousin_space
      };
      var opts_view = {
        container: opts.container,
        support_html: opts.support_html,
        engine: opts.view.engine,
        hmargin: opts.view.hmargin,
        vmargin: opts.view.vmargin,
        line_width: opts.view.line_width,
        line_color: opts.view.line_color,
        draggable: opts.view.draggable,
        hide_scrollbars_when_draggable: opts.view.hide_scrollbars_when_draggable,
        node_overflow: opts.view.node_overflow
      };
      // create instance of function provider
      this.data = new jm.data_provider(this);
      this.layout = new jm.layout_provider(this, opts_layout);
      this.view = new jm.view_provider(this, opts_view);
      this.shortcut = new jm.shortcut_provider(this, opts.shortcut);
      this.data.init();
      this.layout.init();
      this.view.init();
      this.shortcut.init();
      this._event_bind();
      jm.init_plugins(this);
    },
    enable_edit: function () {
      this.options.editable = true;
    },
    disable_edit: function () {
      this.options.editable = false;
    },
    // call enable_event_handle('dblclick')
    // options are 'mousedown', 'click', 'dblclick'
    enable_event_handle: function (event_handle) {
      this.options.default_event_handle['enable_' + event_handle + '_handle'] = true;
    },
    // call disable_event_handle('dblclick')
    // options are 'mousedown', 'click', 'dblclick'
    disable_event_handle: function (event_handle) {
      this.options.default_event_handle['enable_' + event_handle + '_handle'] = false;
    },
    get_editable: function () {
      return this.options.editable;
    },
    set_theme: function (theme) {
      var theme_old = this.options.theme;
      this.options.theme = !!theme ? theme : null;
      if (theme_old != this.options.theme) {
        this.view.reset_theme();
        this.view.reset_custom_style();
      }
    },
    _event_bind: function () {
      this.view.add_event(this, 'mousedown', this.mousedown_handle);
      this.view.add_event(this, 'click', this.click_handle);
      this.view.add_event(this, 'dblclick', this.dblclick_handle);
      this.view.add_event(this, "mousewheel", this.mousewheel_handle);
    },
    mousedown_handle: function (e) {
      if (!this.options.default_event_handle['enable_mousedown_handle']) {
        return;
      }
      var element = e.target || event.srcElement;
      var nodeid = this.view.get_binded_nodeid(element);
      if (!!nodeid) {
        if (this.view.is_node(element)) {
          this.select_node(nodeid);
        }
      } else {
        this.select_clear();
      }
    },
    click_handle: function (e) {
      if (!this.options.default_event_handle['enable_click_handle']) {
        return;
      }
      var element = e.target || event.srcElement;
      var is_expander = this.view.is_expander(element);
      if (is_expander) {
        var nodeid = this.view.get_binded_nodeid(element);
        if (!!nodeid) {
          this.toggle_node(nodeid);
        }
      }
    },
    dblclick_handle: function (e) {
      if (!this.options.default_event_handle['enable_dblclick_handle']) {
        return;
      }
      if (this.get_editable()) {
        var element = e.target || event.srcElement;
        var is_node = this.view.is_node(element);
        if (is_node) {
          var nodeid = this.view.get_binded_nodeid(element);
          if (!!nodeid) {
            this.begin_edit(nodeid);
          }
        }
      }
    },
    // Use [Ctrl] + Mousewheel, to zoom in/out.
    mousewheel_handle: function (event) {
      // Test if mousewheel option is enabled and Ctrl key is pressed.
      if (!this.options.default_event_handle["enable_mousewheel_handle"] || !window.event.ctrlKey) {
        return;
      }
      // Avoid default page scrolling behavior.
      event.preventDefault();
      if (event.deltaY < 0) {
        this.view.zoomIn();
      } else {
        this.view.zoomOut();
      }
    },
    begin_edit: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return false;
        } else {
          return this.begin_edit(the_node);
        }
      }
      if (this.get_editable()) {
        this.view.edit_node_begin(node);
      } else {
        logger.error('fail, this mind map is not editable.');
        return;
      }
    },
    end_edit: function () {
      this.view.edit_node_end();
    },
    toggle_node: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return;
        } else {
          return this.toggle_node(the_node);
        }
      }
      if (node.isroot) {
        return;
      }
      this.view.save_location(node);
      this.layout.toggle_node(node);
      this.view.relayout();
      this.view.restore_location(node);
    },
    expand_node: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return;
        } else {
          return this.expand_node(the_node);
        }
      }
      if (node.isroot) {
        return;
      }
      this.view.save_location(node);
      this.layout.expand_node(node);
      this.view.relayout();
      this.view.restore_location(node);
    },
    collapse_node: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return;
        } else {
          return this.collapse_node(the_node);
        }
      }
      if (node.isroot) {
        return;
      }
      this.view.save_location(node);
      this.layout.collapse_node(node);
      this.view.relayout();
      this.view.restore_location(node);
    },
    expand_all: function () {
      this.layout.expand_all();
      this.view.relayout();
    },
    collapse_all: function () {
      this.layout.collapse_all();
      this.view.relayout();
    },
    expand_to_depth: function (depth) {
      this.layout.expand_to_depth(depth);
      this.view.relayout();
    },
    _reset: function () {
      this.view.reset();
      this.layout.reset();
      this.data.reset();
    },
    _show: function (mind) {
      var m = mind || jm.format.node_array.example;
      this.mind = this.data.load(m);
      if (!this.mind) {
        logger.error('data.load error');
        return;
      } else {
        logger.debug('data.load ok');
      }
      this.view.load();
      logger.debug('view.load ok');
      this.layout.layout();
      logger.debug('layout.layout ok');
      this.view.show(true);
      logger.debug('view.show ok');
      this.invoke_event_handle(jm.event_type.show, {
        data: [mind]
      });
    },
    show: function (mind) {
      this._reset();
      this._show(mind);
    },
    get_meta: function () {
      return {
        name: this.mind.name,
        author: this.mind.author,
        version: this.mind.version
      };
    },
    get_data: function (data_format) {
      var df = data_format || 'node_tree';
      return this.data.get_data(df);
    },
    get_root: function () {
      return this.mind.root;
    },
    get_node: function (node) {
      if (jm.util.is_node(node)) {
        return node;
      }
      return this.mind.get_node(node);
    },
    add_node: function (parent_node, nodeid, topic, data, direction) {
      if (this.get_editable()) {
        var the_parent_node = this.get_node(parent_node);
        var dir = jm.direction.of(direction);
        if (dir === undefined) {
          dir = this.layout.calculate_next_child_direction(the_parent_node);
        }
        var node = this.mind.add_node(the_parent_node, nodeid, topic, data, dir);
        if (!!node) {
          this.view.add_node(node);
          this.layout.layout();
          this.view.show(false);
          this.view.reset_node_custom_style(node);
          this.expand_node(the_parent_node);
          this.invoke_event_handle(jm.event_type.edit, {
            evt: 'add_node',
            data: [the_parent_node.id, nodeid, topic, data, dir],
            node: nodeid
          });
        }
        return node;
      } else {
        logger.error('fail, this mind map is not editable');
        return null;
      }
    },
    insert_node_before: function (node_before, nodeid, topic, data, direction) {
      if (this.get_editable()) {
        var the_node_before = this.get_node(node_before);
        var dir = jm.direction.of(direction);
        if (dir === undefined) {
          dir = this.layout.calculate_next_child_direction(the_node_before.parent);
        }
        var node = this.mind.insert_node_before(the_node_before, nodeid, topic, data, dir);
        if (!!node) {
          this.view.add_node(node);
          this.layout.layout();
          this.view.show(false);
          this.invoke_event_handle(jm.event_type.edit, {
            evt: 'insert_node_before',
            data: [the_node_before.id, nodeid, topic, data, dir],
            node: nodeid
          });
        }
        return node;
      } else {
        logger.error('fail, this mind map is not editable');
        return null;
      }
    },
    insert_node_after: function (node_after, nodeid, topic, data, direction) {
      if (this.get_editable()) {
        var the_node_after = this.get_node(node_after);
        var dir = jm.direction.of(direction);
        if (dir === undefined) {
          dir = this.layout.calculate_next_child_direction(the_node_after.parent);
        }
        var node = this.mind.insert_node_after(the_node_after, nodeid, topic, data, dir);
        if (!!node) {
          this.view.add_node(node);
          this.layout.layout();
          this.view.show(false);
          this.invoke_event_handle(jm.event_type.edit, {
            evt: 'insert_node_after',
            data: [the_node_after.id, nodeid, topic, data, dir],
            node: nodeid
          });
        }
        return node;
      } else {
        logger.error('fail, this mind map is not editable');
        return null;
      }
    },
    remove_node: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return false;
        } else {
          return this.remove_node(the_node);
        }
      }
      if (this.get_editable()) {
        if (node.isroot) {
          logger.error('fail, can not remove root node');
          return false;
        }
        var nodeid = node.id;
        var parentid = node.parent.id;
        var parent_node = this.get_node(parentid);
        this.view.save_location(parent_node);
        this.view.remove_node(node);
        this.mind.remove_node(node);
        this.layout.layout();
        this.view.show(false);
        this.view.restore_location(parent_node);
        this.invoke_event_handle(jm.event_type.edit, {
          evt: 'remove_node',
          data: [nodeid],
          node: parentid
        });
        return true;
      } else {
        logger.error('fail, this mind map is not editable');
        return false;
      }
    },
    update_node: function (nodeid, topic) {
      if (this.get_editable()) {
        if (jm.util.text.is_empty(topic)) {
          logger.warn('fail, topic can not be empty');
          return;
        }
        var node = this.get_node(nodeid);
        if (!!node) {
          if (node.topic === topic) {
            logger.info('nothing changed');
            this.view.update_node(node);
            return;
          }
          node.topic = topic;
          this.view.update_node(node);
          this.layout.layout();
          this.view.show(false);
          this.invoke_event_handle(jm.event_type.edit, {
            evt: 'update_node',
            data: [nodeid, topic],
            node: nodeid
          });
        }
      } else {
        logger.error('fail, this mind map is not editable');
        return;
      }
    },
    move_node: function (nodeid, beforeid, parentid, direction) {
      if (this.get_editable()) {
        var node = this.get_node(nodeid);
        var updated_node = this.mind.move_node(node, beforeid, parentid, direction);
        if (!!updated_node) {
          this.view.update_node(updated_node);
          this.layout.layout();
          this.view.show(false);
          this.invoke_event_handle(jm.event_type.edit, {
            evt: 'move_node',
            data: [nodeid, beforeid, parentid, direction],
            node: nodeid
          });
        }
      } else {
        logger.error('fail, this mind map is not editable');
        return;
      }
    },
    select_node: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return;
        } else {
          return this.select_node(the_node);
        }
      }
      if (!this.layout.is_visible(node)) {
        return;
      }
      this.mind.selected = node;
      this.view.select_node(node);
      this.invoke_event_handle(jm.event_type.select, {
        evt: 'select_node',
        data: [],
        node: node.id
      });
    },
    get_selected_node: function () {
      if (!!this.mind) {
        return this.mind.selected;
      } else {
        return null;
      }
    },
    select_clear: function () {
      if (!!this.mind) {
        this.mind.selected = null;
        this.view.select_clear();
      }
    },
    is_node_visible: function (node) {
      return this.layout.is_visible(node);
    },
    find_node_before: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return;
        } else {
          return this.find_node_before(the_node);
        }
      }
      if (node.isroot) {
        return null;
      }
      var n = null;
      if (node.parent.isroot) {
        var c = node.parent.children;
        var prev = null;
        var ni = null;
        for (var i = 0; i < c.length; i++) {
          ni = c[i];
          if (node.direction === ni.direction) {
            if (node.id === ni.id) {
              n = prev;
            }
            prev = ni;
          }
        }
      } else {
        n = this.mind.get_node_before(node);
      }
      return n;
    },
    find_node_after: function (node) {
      if (!jm.util.is_node(node)) {
        var the_node = this.get_node(node);
        if (!the_node) {
          logger.error('the node[id=' + node + '] can not be found.');
          return;
        } else {
          return this.find_node_after(the_node);
        }
      }
      if (node.isroot) {
        return null;
      }
      var n = null;
      if (node.parent.isroot) {
        var c = node.parent.children;
        var getthis = false;
        var ni = null;
        for (var i = 0; i < c.length; i++) {
          ni = c[i];
          if (node.direction === ni.direction) {
            if (getthis) {
              n = ni;
              break;
            }
            if (node.id === ni.id) {
              getthis = true;
            }
          }
        }
      } else {
        n = this.mind.get_node_after(node);
      }
      return n;
    },
    set_node_color: function (nodeid, bgcolor, fgcolor) {
      if (this.get_editable()) {
        var node = this.mind.get_node(nodeid);
        if (!!node) {
          if (!!bgcolor) {
            node.data['background-color'] = bgcolor;
          }
          if (!!fgcolor) {
            node.data['foreground-color'] = fgcolor;
          }
          this.view.reset_node_custom_style(node);
        }
      } else {
        logger.error('fail, this mind map is not editable');
        return null;
      }
    },
    set_node_font_style: function (nodeid, size, weight, style) {
      if (this.get_editable()) {
        var node = this.mind.get_node(nodeid);
        if (!!node) {
          if (!!size) {
            node.data['font-size'] = size;
          }
          if (!!weight) {
            node.data['font-weight'] = weight;
          }
          if (!!style) {
            node.data['font-style'] = style;
          }
          this.view.reset_node_custom_style(node);
          this.view.update_node(node);
          this.layout.layout();
          this.view.show(false);
        }
      } else {
        logger.error('fail, this mind map is not editable');
        return null;
      }
    },
    set_node_background_image: function (nodeid, image, width, height, rotation) {
      if (this.get_editable()) {
        var node = this.mind.get_node(nodeid);
        if (!!node) {
          if (!!image) {
            node.data['background-image'] = image;
          }
          if (!!width) {
            node.data['width'] = width;
          }
          if (!!height) {
            node.data['height'] = height;
          }
          if (!!rotation) {
            node.data['background-rotation'] = rotation;
          }
          this.view.reset_node_custom_style(node);
          this.view.update_node(node);
          this.layout.layout();
          this.view.show(false);
        }
      } else {
        logger.error('fail, this mind map is not editable');
        return null;
      }
    },
    set_node_background_rotation: function (nodeid, rotation) {
      if (this.get_editable()) {
        var node = this.mind.get_node(nodeid);
        if (!!node) {
          if (!node.data['background-image']) {
            logger.error('fail, only can change rotation angle of node with background image');
            return null;
          }
          node.data['background-rotation'] = rotation;
          this.view.reset_node_custom_style(node);
          this.view.update_node(node);
          this.layout.layout();
          this.view.show(false);
        }
      } else {
        logger.error('fail, this mind map is not editable');
        return null;
      }
    },
    resize: function () {
      this.view.resize();
    },
    // callback(type ,data)
    add_event_listener: function (callback) {
      if (typeof callback === 'function') {
        this.event_handles.push(callback);
      }
    },
    clear_event_listener: function () {
      this.event_handles = [];
    },
    invoke_event_handle: function (type, data) {
      var j = this;
      $w.setTimeout(function () {
        j._invoke_event_handle(type, data);
      }, 0);
    },
    _invoke_event_handle: function (type, data) {
      var l = this.event_handles.length;
      for (var i = 0; i < l; i++) {
        this.event_handles[i](type, data);
      }
    }
  };

  // ============= data provider =============================================

  jm.data_provider = function (jm) {
    this.jm = jm;
  };
  jm.data_provider.prototype = {
    init: function () {
      logger.debug('data.init');
    },
    reset: function () {
      logger.debug('data.reset');
    },
    load: function (mind_data) {
      var df = null;
      var mind = null;
      if (typeof mind_data === 'object') {
        if (!!mind_data.format) {
          df = mind_data.format;
        } else {
          df = 'node_tree';
        }
      } else {
        df = 'freemind';
      }
      if (df == 'node_array') {
        mind = jm.format.node_array.get_mind(mind_data);
      } else if (df == 'node_tree') {
        mind = jm.format.node_tree.get_mind(mind_data);
      } else if (df == 'freemind') {
        mind = jm.format.freemind.get_mind(mind_data);
      } else {
        logger.warn('unsupported format');
      }
      return mind;
    },
    get_data: function (data_format) {
      var data = null;
      if (data_format == 'node_array') {
        data = jm.format.node_array.get_data(this.jm.mind);
      } else if (data_format == 'node_tree') {
        data = jm.format.node_tree.get_data(this.jm.mind);
      } else if (data_format == 'freemind') {
        data = jm.format.freemind.get_data(this.jm.mind);
      } else {
        logger.error('unsupported ' + data_format + ' format');
      }
      return data;
    }
  };

  // ============= layout provider ===========================================

  jm.layout_provider = function (jm, options) {
    this.opts = options;
    this.jm = jm;
    this.isside = this.opts.mode == 'side';
    this.bounds = null;
    this.cache_valid = false;
  };
  jm.layout_provider.prototype = {
    init: function () {
      logger.debug('layout.init');
    },
    reset: function () {
      logger.debug('layout.reset');
      this.bounds = {
        n: 0,
        s: 0,
        w: 0,
        e: 0
      };
    },
    calculate_next_child_direction: function (node) {
      if (this.isside) {
        return jm.direction.right;
      }
      var children = node.children || [];
      var children_len = children.length;
      var r = 0;
      for (var i = 0; i < children_len; i++) {
        if (children[i].direction === jm.direction.left) {
          r--;
        } else {
          r++;
        }
      }
      return children_len > 1 && r > 0 ? jm.direction.left : jm.direction.right;
    },
    layout: function () {
      logger.debug('layout.layout');
      this.layout_direction();
      this.layout_offset();
    },
    layout_direction: function () {
      this._layout_direction_root();
    },
    _layout_direction_root: function () {
      var node = this.jm.mind.root;
      // logger.debug(node);
      var layout_data = null;
      if ('layout' in node._data) {
        layout_data = node._data.layout;
      } else {
        layout_data = {};
        node._data.layout = layout_data;
      }
      var children = node.children;
      var children_count = children.length;
      layout_data.direction = jm.direction.center;
      layout_data.side_index = 0;
      if (this.isside) {
        var i = children_count;
        while (i--) {
          this._layout_direction_side(children[i], jm.direction.right, i);
        }
      } else {
        var i = children_count;
        var subnode = null;
        while (i--) {
          subnode = children[i];
          if (subnode.direction == jm.direction.left) {
            this._layout_direction_side(subnode, jm.direction.left, i);
          } else {
            this._layout_direction_side(subnode, jm.direction.right, i);
          }
        }
        /*
        var boundary = Math.ceil(children_count/2);
        var i = children_count;
        while(i--){
            if(i>=boundary){
                this._layout_direction_side(children[i],jm.direction.left, children_count-i-1);
            }else{
                this._layout_direction_side(children[i],jm.direction.right, i);
            }
        }*/
      }
    },
    _layout_direction_side: function (node, direction, side_index) {
      var layout_data = null;
      if ('layout' in node._data) {
        layout_data = node._data.layout;
      } else {
        layout_data = {};
        node._data.layout = layout_data;
      }
      var children = node.children;
      var children_count = children.length;
      layout_data.direction = direction;
      layout_data.side_index = side_index;
      var i = children_count;
      while (i--) {
        this._layout_direction_side(children[i], direction, i);
      }
    },
    layout_offset: function () {
      var node = this.jm.mind.root;
      var layout_data = node._data.layout;
      layout_data.offset_x = 0;
      layout_data.offset_y = 0;
      layout_data.outer_height = 0;
      var children = node.children;
      var i = children.length;
      var left_nodes = [];
      var right_nodes = [];
      var subnode = null;
      while (i--) {
        subnode = children[i];
        if (subnode._data.layout.direction == jm.direction.right) {
          right_nodes.unshift(subnode);
        } else {
          left_nodes.unshift(subnode);
        }
      }
      layout_data.left_nodes = left_nodes;
      layout_data.right_nodes = right_nodes;
      layout_data.outer_height_left = this._layout_offset_subnodes(left_nodes);
      layout_data.outer_height_right = this._layout_offset_subnodes(right_nodes);
      this.bounds.e = node._data.view.width / 2;
      this.bounds.w = 0 - this.bounds.e;
      //logger.debug(this.bounds.w);
      this.bounds.n = 0;
      this.bounds.s = Math.max(layout_data.outer_height_left, layout_data.outer_height_right);
    },
    // layout both the x and y axis
    _layout_offset_subnodes: function (nodes) {
      var total_height = 0;
      var nodes_count = nodes.length;
      var i = nodes_count;
      var node = null;
      var node_outer_height = 0;
      var layout_data = null;
      var base_y = 0;
      var pd = null; // parent._data
      while (i--) {
        node = nodes[i];
        layout_data = node._data.layout;
        if (pd == null) {
          pd = node.parent._data;
        }
        node_outer_height = this._layout_offset_subnodes(node.children);
        if (!node.expanded) {
          node_outer_height = 0;
          this.set_visible(node.children, false);
        }
        node_outer_height = Math.max(node._data.view.height, node_outer_height);
        if (node.children.length > 1) {
          node_outer_height += this.opts.cousin_space;
        }
        layout_data.outer_height = node_outer_height;
        layout_data.offset_y = base_y - node_outer_height / 2;
        layout_data.offset_x = this.opts.hspace * layout_data.direction + pd.view.width * (pd.layout.direction + layout_data.direction) / 2;
        if (!node.parent.isroot) {
          layout_data.offset_x += this.opts.pspace * layout_data.direction;
        }
        base_y = base_y - node_outer_height - this.opts.vspace;
        total_height += node_outer_height;
      }
      if (nodes_count > 1) {
        total_height += this.opts.vspace * (nodes_count - 1);
      }
      i = nodes_count;
      var middle_height = total_height / 2;
      while (i--) {
        node = nodes[i];
        node._data.layout.offset_y += middle_height;
      }
      return total_height;
    },
    // layout the y axis only, for collapse/expand a node
    _layout_offset_subnodes_height: function (nodes) {
      var total_height = 0;
      var nodes_count = nodes.length;
      var i = nodes_count;
      var node = null;
      var node_outer_height = 0;
      var layout_data = null;
      var base_y = 0;
      var pd = null; // parent._data
      while (i--) {
        node = nodes[i];
        layout_data = node._data.layout;
        if (pd == null) {
          pd = node.parent._data;
        }
        node_outer_height = this._layout_offset_subnodes_height(node.children);
        if (!node.expanded) {
          node_outer_height = 0;
        }
        node_outer_height = Math.max(node._data.view.height, node_outer_height);
        if (node.children.length > 1) {
          node_outer_height += this.opts.cousin_space;
        }
        layout_data.outer_height = node_outer_height;
        layout_data.offset_y = base_y - node_outer_height / 2;
        base_y = base_y - node_outer_height - this.opts.vspace;
        total_height += node_outer_height;
      }
      if (nodes_count > 1) {
        total_height += this.opts.vspace * (nodes_count - 1);
      }
      i = nodes_count;
      var middle_height = total_height / 2;
      while (i--) {
        node = nodes[i];
        node._data.layout.offset_y += middle_height;
        //logger.debug(node.topic);
        //logger.debug(node._data.layout.offset_y);
      }
      return total_height;
    },
    get_node_offset: function (node) {
      var layout_data = node._data.layout;
      var offset_cache = null;
      if ('_offset_' in layout_data && this.cache_valid) {
        offset_cache = layout_data._offset_;
      } else {
        offset_cache = {
          x: -1,
          y: -1
        };
        layout_data._offset_ = offset_cache;
      }
      if (offset_cache.x == -1 || offset_cache.y == -1) {
        var x = layout_data.offset_x;
        var y = layout_data.offset_y;
        if (!node.isroot) {
          var offset_p = this.get_node_offset(node.parent);
          x += offset_p.x;
          y += offset_p.y;
        }
        offset_cache.x = x;
        offset_cache.y = y;
      }
      return offset_cache;
    },
    get_node_point: function (node) {
      var view_data = node._data.view;
      var offset_p = this.get_node_offset(node);
      //logger.debug(offset_p);
      var p = {};
      p.x = offset_p.x + view_data.width * (node._data.layout.direction - 1) / 2;
      p.y = offset_p.y - view_data.height / 2;
      //logger.debug(p);
      return p;
    },
    get_node_point_in: function (node) {
      var p = this.get_node_offset(node);
      return p;
    },
    get_node_point_out: function (node) {
      var layout_data = node._data.layout;
      var pout_cache = null;
      if ('_pout_' in layout_data && this.cache_valid) {
        pout_cache = layout_data._pout_;
      } else {
        pout_cache = {
          x: -1,
          y: -1
        };
        layout_data._pout_ = pout_cache;
      }
      if (pout_cache.x == -1 || pout_cache.y == -1) {
        if (node.isroot) {
          pout_cache.x = 0;
          pout_cache.y = 0;
        } else {
          var view_data = node._data.view;
          var offset_p = this.get_node_offset(node);
          pout_cache.x = offset_p.x + (view_data.width + this.opts.pspace) * node._data.layout.direction;
          pout_cache.y = offset_p.y;
          //logger.debug('pout');
          //logger.debug(pout_cache);
        }
      }
      return pout_cache;
    },
    get_expander_point: function (node) {
      var p = this.get_node_point_out(node);
      var ex_p = {};
      if (node._data.layout.direction == jm.direction.right) {
        ex_p.x = p.x - this.opts.pspace;
      } else {
        ex_p.x = p.x;
      }
      ex_p.y = p.y - Math.ceil(this.opts.pspace / 2);
      return ex_p;
    },
    get_min_size: function () {
      var nodes = this.jm.mind.nodes;
      var node = null;
      var pout = null;
      for (var nodeid in nodes) {
        node = nodes[nodeid];
        pout = this.get_node_point_out(node);
        if (pout.x > this.bounds.e) {
          this.bounds.e = pout.x;
        }
        if (pout.x < this.bounds.w) {
          this.bounds.w = pout.x;
        }
      }
      return {
        w: this.bounds.e - this.bounds.w,
        h: this.bounds.s - this.bounds.n
      };
    },
    toggle_node: function (node) {
      if (node.isroot) {
        return;
      }
      if (node.expanded) {
        this.collapse_node(node);
      } else {
        this.expand_node(node);
      }
    },
    expand_node: function (node) {
      node.expanded = true;
      this.part_layout(node);
      this.set_visible(node.children, true);
      this.jm.invoke_event_handle(jm.event_type.show, {
        evt: 'expand_node',
        data: [],
        node: node.id
      });
    },
    collapse_node: function (node) {
      node.expanded = false;
      this.part_layout(node);
      this.set_visible(node.children, false);
      this.jm.invoke_event_handle(jm.event_type.show, {
        evt: 'collapse_node',
        data: [],
        node: node.id
      });
    },
    expand_all: function () {
      var nodes = this.jm.mind.nodes;
      var c = 0;
      var node;
      for (var nodeid in nodes) {
        node = nodes[nodeid];
        if (!node.expanded) {
          node.expanded = true;
          c++;
        }
      }
      if (c > 0) {
        var root = this.jm.mind.root;
        this.part_layout(root);
        this.set_visible(root.children, true);
      }
    },
    collapse_all: function () {
      var nodes = this.jm.mind.nodes;
      var c = 0;
      var node;
      for (var nodeid in nodes) {
        node = nodes[nodeid];
        if (node.expanded && !node.isroot) {
          node.expanded = false;
          c++;
        }
      }
      if (c > 0) {
        var root = this.jm.mind.root;
        this.part_layout(root);
        this.set_visible(root.children, true);
      }
    },
    expand_to_depth: function (target_depth, curr_nodes, curr_depth) {
      if (target_depth < 1) {
        return;
      }
      var nodes = curr_nodes || this.jm.mind.root.children;
      var depth = curr_depth || 1;
      var i = nodes.length;
      var node = null;
      while (i--) {
        node = nodes[i];
        if (depth < target_depth) {
          if (!node.expanded) {
            this.expand_node(node);
          }
          this.expand_to_depth(target_depth, node.children, depth + 1);
        }
        if (depth == target_depth) {
          if (node.expanded) {
            this.collapse_node(node);
          }
        }
      }
    },
    part_layout: function (node) {
      var root = this.jm.mind.root;
      if (!!root) {
        var root_layout_data = root._data.layout;
        if (node.isroot) {
          root_layout_data.outer_height_right = this._layout_offset_subnodes_height(root_layout_data.right_nodes);
          root_layout_data.outer_height_left = this._layout_offset_subnodes_height(root_layout_data.left_nodes);
        } else {
          if (node._data.layout.direction == jm.direction.right) {
            root_layout_data.outer_height_right = this._layout_offset_subnodes_height(root_layout_data.right_nodes);
          } else {
            root_layout_data.outer_height_left = this._layout_offset_subnodes_height(root_layout_data.left_nodes);
          }
        }
        this.bounds.s = Math.max(root_layout_data.outer_height_left, root_layout_data.outer_height_right);
        this.cache_valid = false;
      } else {
        logger.warn('can not found root node');
      }
    },
    set_visible: function (nodes, visible) {
      var i = nodes.length;
      var node = null;
      while (i--) {
        node = nodes[i];
        node._data.layout;
        if (node.expanded) {
          this.set_visible(node.children, visible);
        } else {
          this.set_visible(node.children, false);
        }
        if (!node.isroot) {
          node._data.layout.visible = visible;
        }
      }
    },
    is_expand: function (node) {
      return node.expanded;
    },
    is_visible: function (node) {
      var layout_data = node._data.layout;
      if ('visible' in layout_data && !layout_data.visible) {
        return false;
      } else {
        return true;
      }
    }
  };
  jm.graph_canvas = function (view) {
    this.opts = view.opts;
    this.e_canvas = $c('canvas');
    this.e_canvas.className = 'jsmind';
    this.canvas_ctx = this.e_canvas.getContext('2d');
    this.size = {
      w: 0,
      h: 0
    };
  };
  jm.graph_canvas.prototype = {
    element: function () {
      return this.e_canvas;
    },
    set_size: function (w, h) {
      this.size.w = w;
      this.size.h = h;
      this.e_canvas.width = w;
      this.e_canvas.height = h;
    },
    clear: function () {
      this.canvas_ctx.clearRect(0, 0, this.size.w, this.size.h);
    },
    draw_line: function (pout, pin, offset) {
      var ctx = this.canvas_ctx;
      ctx.strokeStyle = this.opts.line_color;
      ctx.lineWidth = this.opts.line_width;
      ctx.lineCap = 'round';
      this._bezier_to(ctx, pin.x + offset.x, pin.y + offset.y, pout.x + offset.x, pout.y + offset.y);
    },
    copy_to: function (dest_canvas_ctx, callback) {
      dest_canvas_ctx.drawImage(this.e_canvas, 0, 0);
      !!callback && callback();
    },
    _bezier_to: function (ctx, x1, y1, x2, y2) {
      ctx.beginPath();
      ctx.moveTo(x1, y1);
      ctx.bezierCurveTo(x1 + (x2 - x1) * 2 / 3, y1, x1, y2, x2, y2);
      ctx.stroke();
    },
    _line_to: function (ctx, x1, y1, x2, y2) {
      ctx.beginPath();
      ctx.moveTo(x1, y1);
      ctx.lineTo(x2, y2);
      ctx.stroke();
    }
  };
  jm.graph_svg = function (view) {
    this.view = view;
    this.opts = view.opts;
    this.e_svg = jm.graph_svg.c('svg');
    this.e_svg.setAttribute('class', 'jsmind');
    this.size = {
      w: 0,
      h: 0
    };
    this.lines = [];
  };
  jm.graph_svg.c = function (tag) {
    return $d.createElementNS('http://www.w3.org/2000/svg', tag);
  };
  jm.graph_svg.prototype = {
    element: function () {
      return this.e_svg;
    },
    set_size: function (w, h) {
      this.size.w = w;
      this.size.h = h;
      this.e_svg.setAttribute('width', w);
      this.e_svg.setAttribute('height', h);
    },
    clear: function () {
      var len = this.lines.length;
      while (len--) {
        this.e_svg.removeChild(this.lines[len]);
      }
      this.lines.length = 0;
    },
    draw_line: function (pout, pin, offset) {
      var line = jm.graph_svg.c('path');
      line.setAttribute('stroke', this.opts.line_color);
      line.setAttribute('stroke-width', this.opts.line_width);
      line.setAttribute('fill', 'transparent');
      this.lines.push(line);
      this.e_svg.appendChild(line);
      this._bezier_to(line, pin.x + offset.x, pin.y + offset.y, pout.x + offset.x, pout.y + offset.y);
    },
    copy_to: function (dest_canvas_ctx, callback) {
      var img = new Image();
      img.onload = function () {
        dest_canvas_ctx.drawImage(img, 0, 0);
        !!callback && callback();
      };
      img.src = 'data:image/svg+xml;base64,' + btoa(new XMLSerializer().serializeToString(this.e_svg));
    },
    _bezier_to: function (path, x1, y1, x2, y2) {
      path.setAttribute('d', 'M' + x1 + ' ' + y1 + ' C ' + (x1 + (x2 - x1) * 2 / 3) + ' ' + y1 + ', ' + x1 + ' ' + y2 + ', ' + x2 + ' ' + y2);
    },
    _line_to: function (path, x1, y1, x2, y2) {
      path.setAttribute('d', 'M ' + x1 + ' ' + y1 + ' L ' + x2 + ' ' + y2);
    }
  };

  // view provider
  jm.view_provider = function (jm, options) {
    this.opts = options;
    this.jm = jm;
    this.layout = jm.layout;
    this.container = null;
    this.e_panel = null;
    this.e_nodes = null;
    this.size = {
      w: 0,
      h: 0
    };
    this.selected_node = null;
    this.editing_node = null;
    this.graph = null;
  };
  jm.view_provider.prototype = {
    init: function () {
      logger.debug('view.init');
      this.container = $i(this.opts.container) ? this.opts.container : $g(this.opts.container);
      if (!this.container) {
        logger.error('the options.view.container was not be found in dom');
        return;
      }
      this.e_panel = $c('div');
      this.e_nodes = $c('jmnodes');
      this.e_editor = $c('input');
      this.graph = this.opts.engine.toLowerCase() === 'svg' ? new jm.graph_svg(this) : new jm.graph_canvas(this);
      this.e_panel.className = 'jsmind-inner jmnode-overflow-' + this.opts.node_overflow;
      this.e_panel.tabIndex = 1;
      this.e_panel.appendChild(this.graph.element());
      this.e_panel.appendChild(this.e_nodes);
      this.e_editor.className = 'jsmind-editor';
      this.e_editor.type = 'text';
      this.actualZoom = 1;
      this.zoomStep = 0.1;
      this.minZoom = 0.5;
      this.maxZoom = 2;
      var v = this;
      jm.util.dom.add_event(this.e_editor, 'keydown', function (e) {
        var evt = e || event;
        if (evt.keyCode == 13) {
          v.edit_node_end();
          evt.stopPropagation();
        }
      });
      jm.util.dom.add_event(this.e_editor, 'blur', function (e) {
        v.edit_node_end();
      });
      this.container.appendChild(this.e_panel);

      // Used to avoid dragging, while editing node.
      this.dragging_enabled = true;
      this.draggable_canvas();
    },
    add_event: function (obj, event_name, event_handle) {
      jm.util.dom.add_event(this.e_nodes, event_name, function (e) {
        var evt = e || event;
        event_handle.call(obj, evt);
      });
    },
    get_binded_nodeid: function (element) {
      if (element == null) {
        return null;
      }
      var tagName = element.tagName.toLowerCase();
      if (tagName == 'jmnode' || tagName == 'jmexpander') {
        return element.getAttribute('nodeid');
      } else if (tagName == 'jmnodes' || tagName == 'body' || tagName == 'html') {
        return null;
      } else {
        return this.get_binded_nodeid(element.parentElement);
      }
    },
    is_node: function (element) {
      if (element == null) {
        return false;
      }
      var tagName = element.tagName.toLowerCase();
      if (tagName == 'jmnode') {
        return true;
      } else if (tagName == 'jmnodes' || tagName == 'body' || tagName == 'html') {
        return false;
      } else {
        return this.is_node(element.parentElement);
      }
    },
    is_expander: function (element) {
      return element.tagName.toLowerCase() == 'jmexpander';
    },
    reset: function () {
      logger.debug('view.reset');
      this.selected_node = null;
      this.clear_lines();
      this.clear_nodes();
      this.reset_theme();
    },
    reset_theme: function () {
      var theme_name = this.jm.options.theme;
      if (!!theme_name) {
        this.e_nodes.className = 'theme-' + theme_name;
      } else {
        this.e_nodes.className = '';
      }
    },
    reset_custom_style: function () {
      var nodes = this.jm.mind.nodes;
      for (var nodeid in nodes) {
        this.reset_node_custom_style(nodes[nodeid]);
      }
    },
    load: function () {
      logger.debug('view.load');
      this.init_nodes();
    },
    expand_size: function () {
      var min_size = this.layout.get_min_size();
      var min_width = min_size.w + this.opts.hmargin * 2;
      var min_height = min_size.h + this.opts.vmargin * 2;
      var client_w = this.e_panel.clientWidth;
      var client_h = this.e_panel.clientHeight;
      if (client_w < min_width) {
        client_w = min_width;
      }
      if (client_h < min_height) {
        client_h = min_height;
      }
      this.size.w = client_w;
      this.size.h = client_h;
    },
    init_nodes_size: function (node) {
      var view_data = node._data.view;
      view_data.width = view_data.element.clientWidth;
      view_data.height = view_data.element.clientHeight;
    },
    init_nodes: function () {
      var nodes = this.jm.mind.nodes;
      var doc_frag = $d.createDocumentFragment();
      for (var nodeid in nodes) {
        this.create_node_element(nodes[nodeid], doc_frag);
      }
      this.e_nodes.appendChild(doc_frag);
      for (var nodeid in nodes) {
        this.init_nodes_size(nodes[nodeid]);
      }
    },
    add_node: function (node) {
      this.create_node_element(node, this.e_nodes);
      this.init_nodes_size(node);
    },
    create_node_element: function (node, parent_node) {
      var view_data = null;
      if ('view' in node._data) {
        view_data = node._data.view;
      } else {
        view_data = {};
        node._data.view = view_data;
      }
      var d = $c('jmnode');
      if (node.isroot) {
        d.className = 'root';
      } else {
        var d_e = $c('jmexpander');
        $t(d_e, '-');
        d_e.setAttribute('nodeid', node.id);
        d_e.style.visibility = 'hidden';
        parent_node.appendChild(d_e);
        view_data.expander = d_e;
      }
      if (!!node.topic) {
        if (this.opts.support_html) {
          $h(d, node.topic);
        } else {
          $t(d, node.topic);
        }
      }
      d.setAttribute('nodeid', node.id);
      d.style.visibility = 'hidden';
      this._reset_node_custom_style(d, node.data);
      parent_node.appendChild(d);
      view_data.element = d;
    },
    remove_node: function (node) {
      if (this.selected_node != null && this.selected_node.id == node.id) {
        this.selected_node = null;
      }
      if (this.editing_node != null && this.editing_node.id == node.id) {
        node._data.view.element.removeChild(this.e_editor);
        this.editing_node = null;
      }
      var children = node.children;
      var i = children.length;
      while (i--) {
        this.remove_node(children[i]);
      }
      if (node._data.view) {
        var element = node._data.view.element;
        var expander = node._data.view.expander;
        this.e_nodes.removeChild(element);
        this.e_nodes.removeChild(expander);
        node._data.view.element = null;
        node._data.view.expander = null;
      }
    },
    update_node: function (node) {
      var view_data = node._data.view;
      var element = view_data.element;
      if (!!node.topic) {
        if (this.opts.support_html) {
          $h(element, node.topic);
        } else {
          $t(element, node.topic);
        }
      }
      if (this.layout.is_visible(node)) {
        view_data.width = element.clientWidth;
        view_data.height = element.clientHeight;
      } else {
        let origin_style = element.getAttribute('style');
        element.style = 'visibility: visible; left:0; top:0;';
        view_data.width = element.clientWidth;
        view_data.height = element.clientHeight;
        element.style = origin_style;
      }
    },
    select_node: function (node) {
      if (!!this.selected_node) {
        this.selected_node._data.view.element.className = this.selected_node._data.view.element.className.replace(/\s*selected\b/i, '');
        this.reset_node_custom_style(this.selected_node);
      }
      if (!!node) {
        this.selected_node = node;
        node._data.view.element.className += ' selected';
        this.clear_node_custom_style(node);
      }
    },
    select_clear: function () {
      this.select_node(null);
    },
    get_editing_node: function () {
      return this.editing_node;
    },
    is_editing: function () {
      return !!this.editing_node;
    },
    edit_node_begin: function (node) {
      if (!node.topic) {
        logger.warn("don't edit image nodes");
        return;
      }
      if (this.editing_node != null) {
        this.edit_node_end();
      }
      this.editing_node = node;
      var view_data = node._data.view;
      var element = view_data.element;
      var topic = node.topic;
      var ncs = getComputedStyle(element);
      this.e_editor.value = topic;
      this.e_editor.style.width = element.clientWidth - parseInt(ncs.getPropertyValue('padding-left')) - parseInt(ncs.getPropertyValue('padding-right')) + 'px';
      element.innerHTML = '';
      element.appendChild(this.e_editor);
      element.style.zIndex = 5;
      this.e_editor.focus();
      this.e_editor.select();
    },
    edit_node_end: function () {
      if (this.editing_node != null) {
        var node = this.editing_node;
        this.editing_node = null;
        var view_data = node._data.view;
        var element = view_data.element;
        var topic = this.e_editor.value;
        element.style.zIndex = 'auto';
        element.removeChild(this.e_editor);
        if (jm.util.text.is_empty(topic) || node.topic === topic) {
          if (this.opts.support_html) {
            $h(element, node.topic);
          } else {
            $t(element, node.topic);
          }
        } else {
          this.jm.update_node(node.id, topic);
        }
      }
      this.e_panel.focus();
    },
    get_view_offset: function () {
      var bounds = this.layout.bounds;
      var _x = (this.size.w - bounds.e - bounds.w) / 2;
      var _y = this.size.h / 2;
      return {
        x: _x,
        y: _y
      };
    },
    resize: function () {
      this.graph.set_size(1, 1);
      this.e_nodes.style.width = '1px';
      this.e_nodes.style.height = '1px';
      this.expand_size();
      this._show();
    },
    _show: function () {
      this.graph.set_size(this.size.w, this.size.h);
      this.e_nodes.style.width = this.size.w + 'px';
      this.e_nodes.style.height = this.size.h + 'px';
      this.show_nodes();
      this.show_lines();
      //this.layout.cache_valid = true;
      this.jm.invoke_event_handle(jm.event_type.resize, {
        data: []
      });
    },
    zoomIn: function () {
      return this.setZoom(this.actualZoom + this.zoomStep);
    },
    zoomOut: function () {
      return this.setZoom(this.actualZoom - this.zoomStep);
    },
    setZoom: function (zoom) {
      if (zoom < this.minZoom || zoom > this.maxZoom) {
        return false;
      }
      this.actualZoom = zoom;
      for (var i = 0; i < this.e_panel.children.length; i++) {
        this.e_panel.children[i].style.zoom = zoom;
      }
      this.show(true);
      return true;
    },
    _center_root: function () {
      // center root node
      var outer_w = this.e_panel.clientWidth;
      var outer_h = this.e_panel.clientHeight;
      if (this.size.w > outer_w) {
        var _offset = this.get_view_offset();
        this.e_panel.scrollLeft = _offset.x * this.actualZoom - outer_w / 2;
      }
      if (this.size.h > outer_h) {
        this.e_panel.scrollTop = (this.size.h * this.actualZoom - outer_h) / 2;
      }
    },
    show: function (keep_center) {
      logger.debug('view.show');
      this.expand_size();
      this._show();
      if (!!keep_center) {
        this._center_root();
      }
    },
    relayout: function () {
      this.expand_size();
      this._show();
    },
    save_location: function (node) {
      var vd = node._data.view;
      vd._saved_location = {
        x: parseInt(vd.element.style.left) - this.e_panel.scrollLeft,
        y: parseInt(vd.element.style.top) - this.e_panel.scrollTop
      };
    },
    restore_location: function (node) {
      var vd = node._data.view;
      this.e_panel.scrollLeft = parseInt(vd.element.style.left) - vd._saved_location.x;
      this.e_panel.scrollTop = parseInt(vd.element.style.top) - vd._saved_location.y;
    },
    clear_nodes: function () {
      var mind = this.jm.mind;
      if (mind == null) {
        return;
      }
      var nodes = mind.nodes;
      var node = null;
      for (var nodeid in nodes) {
        node = nodes[nodeid];
        node._data.view.element = null;
        node._data.view.expander = null;
      }
      this.e_nodes.innerHTML = '';
    },
    show_nodes: function () {
      var nodes = this.jm.mind.nodes;
      var node = null;
      var node_element = null;
      var expander = null;
      var p = null;
      var p_expander = null;
      var expander_text = '-';
      var view_data = null;
      var _offset = this.get_view_offset();
      for (var nodeid in nodes) {
        node = nodes[nodeid];
        view_data = node._data.view;
        node_element = view_data.element;
        expander = view_data.expander;
        if (!this.layout.is_visible(node)) {
          node_element.style.display = 'none';
          expander.style.display = 'none';
          continue;
        }
        this.reset_node_custom_style(node);
        p = this.layout.get_node_point(node);
        view_data.abs_x = _offset.x + p.x;
        view_data.abs_y = _offset.y + p.y;
        node_element.style.left = _offset.x + p.x + 'px';
        node_element.style.top = _offset.y + p.y + 'px';
        node_element.style.display = '';
        node_element.style.visibility = 'visible';
        if (!node.isroot && node.children.length > 0) {
          expander_text = node.expanded ? '-' : '+';
          p_expander = this.layout.get_expander_point(node);
          expander.style.left = _offset.x + p_expander.x + 'px';
          expander.style.top = _offset.y + p_expander.y + 'px';
          expander.style.display = '';
          expander.style.visibility = 'visible';
          $t(expander, expander_text);
        }
        // hide expander while all children have been removed
        if (!node.isroot && node.children.length == 0) {
          expander.style.display = 'none';
          expander.style.visibility = 'hidden';
        }
      }
    },
    reset_node_custom_style: function (node) {
      this._reset_node_custom_style(node._data.view.element, node.data);
    },
    _reset_node_custom_style: function (node_element, node_data) {
      if ('background-color' in node_data) {
        node_element.style.backgroundColor = node_data['background-color'];
      }
      if ('foreground-color' in node_data) {
        node_element.style.color = node_data['foreground-color'];
      }
      if ('width' in node_data) {
        node_element.style.width = node_data['width'] + 'px';
      }
      if ('height' in node_data) {
        node_element.style.height = node_data['height'] + 'px';
      }
      if ('font-size' in node_data) {
        node_element.style.fontSize = node_data['font-size'] + 'px';
      }
      if ('font-weight' in node_data) {
        node_element.style.fontWeight = node_data['font-weight'];
      }
      if ('font-style' in node_data) {
        node_element.style.fontStyle = node_data['font-style'];
      }
      if ('background-image' in node_data) {
        var backgroundImage = node_data['background-image'];
        if (backgroundImage.startsWith('data') && node_data['width'] && node_data['height']) {
          var img = new Image();
          img.onload = function () {
            var c = $c('canvas');
            c.width = node_element.clientWidth;
            c.height = node_element.clientHeight;
            var img = this;
            if (c.getContext) {
              var ctx = c.getContext('2d');
              ctx.drawImage(img, 2, 2, node_element.clientWidth, node_element.clientHeight);
              var scaledImageData = c.toDataURL();
              node_element.style.backgroundImage = 'url(' + scaledImageData + ')';
            }
          };
          img.src = backgroundImage;
        } else {
          node_element.style.backgroundImage = 'url(' + backgroundImage + ')';
        }
        node_element.style.backgroundSize = '99%';
        if ('background-rotation' in node_data) {
          node_element.style.transform = 'rotate(' + node_data['background-rotation'] + 'deg)';
        }
      }
    },
    clear_node_custom_style: function (node) {
      var node_element = node._data.view.element;
      node_element.style.backgroundColor = "";
      node_element.style.color = "";
    },
    clear_lines: function () {
      this.graph.clear();
    },
    show_lines: function () {
      this.clear_lines();
      var nodes = this.jm.mind.nodes;
      var node = null;
      var pin = null;
      var pout = null;
      var _offset = this.get_view_offset();
      for (var nodeid in nodes) {
        node = nodes[nodeid];
        if (!!node.isroot) {
          continue;
        }
        if ('visible' in node._data.layout && !node._data.layout.visible) {
          continue;
        }
        pin = this.layout.get_node_point_in(node);
        pout = this.layout.get_node_point_out(node.parent);
        this.graph.draw_line(pout, pin, _offset);
      }
    },
    // Drag the whole mind map with your mouse (usefull when it's larger that the container).
    draggable_canvas: function () {
      // If draggable option is true.
      if (this.opts.draggable) {
        // Dragging disabled by default.
        let dragging = false;
        let x, y;
        if (this.opts.hide_scrollbars_when_draggable) {
          // Avoid scrollbars when mind map is larger than the container (e_panel = id jsmind-inner)
          this.e_panel.style = 'overflow: hidden';
        }
        // Move the whole mind map with mouse moves, while button is down.
        jm.util.dom.add_event(this.container, 'mousedown', eventDown => {
          dragging = true;
          // Record current mouse position.
          x = eventDown.clientX;
          y = eventDown.clientY;
        });
        // Stop moving mind map once mouse button is released.
        jm.util.dom.add_event(this.container, 'mouseup', () => {
          dragging = false;
        });
        // Follow current mouse position and move mind map accordingly.
        jm.util.dom.add_event(this.container, 'mousemove', eventMove => {
          if (this.dragging_enabled && dragging) {
            this.e_panel.scrollBy(x - eventMove.clientX, y - eventMove.clientY);
            // Record new current position.
            x = eventMove.clientX;
            y = eventMove.clientY;
          }
        });
      }
    },
    get_draggable_canvas: function () {
      return this.opts.draggable;
    },
    enable_draggable_canvas: function () {
      this.dragging_enabled = true;
    },
    disable_draggable_canvas: function () {
      this.dragging_enabled = false;
    }
  };

  // shortcut provider
  jm.shortcut_provider = function (jm, options) {
    this.jm = jm;
    this.opts = options;
    this.mapping = options.mapping;
    this.handles = options.handles;
    this._newid = null;
    this._mapping = {};
  };
  jm.shortcut_provider.prototype = {
    init: function () {
      jm.util.dom.add_event(this.jm.view.e_panel, 'keydown', this.handler.bind(this));
      this.handles['addchild'] = this.handle_addchild;
      this.handles['addbrother'] = this.handle_addbrother;
      this.handles['editnode'] = this.handle_editnode;
      this.handles['delnode'] = this.handle_delnode;
      this.handles['toggle'] = this.handle_toggle;
      this.handles['up'] = this.handle_up;
      this.handles['down'] = this.handle_down;
      this.handles['left'] = this.handle_left;
      this.handles['right'] = this.handle_right;
      for (var handle in this.mapping) {
        if (!!this.mapping[handle] && handle in this.handles) {
          var keys = this.mapping[handle];
          if (!Array.isArray(keys)) {
            keys = [keys];
          }
          for (let key of keys) {
            this._mapping[key] = this.handles[handle];
          }
        }
      }
      if (typeof this.opts.id_generator === 'function') {
        this._newid = this.opts.id_generator;
      } else {
        this._newid = jm.util.uuid.newid;
      }
    },
    enable_shortcut: function () {
      this.opts.enable = true;
    },
    disable_shortcut: function () {
      this.opts.enable = false;
    },
    handler: function (e) {
      if (e.which == 9) {
        e.preventDefault();
      } //prevent tab to change focus in browser
      if (this.jm.view.is_editing()) {
        return;
      }
      var evt = e || event;
      if (!this.opts.enable) {
        return true;
      }
      var kc = evt.keyCode + (evt.metaKey << 13) + (evt.ctrlKey << 12) + (evt.altKey << 11) + (evt.shiftKey << 10);
      if (kc in this._mapping) {
        this._mapping[kc].call(this, this.jm, e);
      }
    },
    handle_addchild: function (_jm, e) {
      var selected_node = _jm.get_selected_node();
      if (!!selected_node) {
        var nodeid = this._newid();
        var node = _jm.add_node(selected_node, nodeid, '新节点');
        if (!!node) {
          _jm.select_node(nodeid);
          _jm.begin_edit(nodeid);
        }
      }
    },
    handle_addbrother: function (_jm, e) {
      var selected_node = _jm.get_selected_node();
      if (!!selected_node && !selected_node.isroot) {
        var nodeid = this._newid();
        var node = _jm.insert_node_after(selected_node, nodeid, '新节点');
        if (!!node) {
          _jm.select_node(nodeid);
          _jm.begin_edit(nodeid);
        }
      }
    },
    handle_editnode: function (_jm, e) {
      var selected_node = _jm.get_selected_node();
      if (!!selected_node) {
        _jm.begin_edit(selected_node);
      }
    },
    handle_delnode: function (_jm, e) {
      var selected_node = _jm.get_selected_node();
      if (!!selected_node && !selected_node.isroot) {
        _jm.select_node(selected_node.parent);
        _jm.remove_node(selected_node);
      }
    },
    handle_toggle: function (_jm, e) {
      var evt = e || event;
      var selected_node = _jm.get_selected_node();
      if (!!selected_node) {
        _jm.toggle_node(selected_node.id);
        evt.stopPropagation();
        evt.preventDefault();
      }
    },
    handle_up: function (_jm, e) {
      var evt = e || event;
      var selected_node = _jm.get_selected_node();
      if (!!selected_node) {
        var up_node = _jm.find_node_before(selected_node);
        if (!up_node) {
          var np = _jm.find_node_before(selected_node.parent);
          if (!!np && np.children.length > 0) {
            up_node = np.children[np.children.length - 1];
          }
        }
        if (!!up_node) {
          _jm.select_node(up_node);
        }
        evt.stopPropagation();
        evt.preventDefault();
      }
    },
    handle_down: function (_jm, e) {
      var evt = e || event;
      var selected_node = _jm.get_selected_node();
      if (!!selected_node) {
        var down_node = _jm.find_node_after(selected_node);
        if (!down_node) {
          var np = _jm.find_node_after(selected_node.parent);
          if (!!np && np.children.length > 0) {
            down_node = np.children[0];
          }
        }
        if (!!down_node) {
          _jm.select_node(down_node);
        }
        evt.stopPropagation();
        evt.preventDefault();
      }
    },
    handle_left: function (_jm, e) {
      this._handle_direction(_jm, e, jm.direction.left);
    },
    handle_right: function (_jm, e) {
      this._handle_direction(_jm, e, jm.direction.right);
    },
    _handle_direction: function (_jm, e, d) {
      var evt = e || event;
      var selected_node = _jm.get_selected_node();
      var node = null;
      if (!!selected_node) {
        if (selected_node.isroot) {
          var c = selected_node.children;
          var children = [];
          for (var i = 0; i < c.length; i++) {
            if (c[i].direction === d) {
              children.push(i);
            }
          }
          node = c[children[Math.floor((children.length - 1) / 2)]];
        } else if (selected_node.direction === d) {
          var children = selected_node.children;
          var childrencount = children.length;
          if (childrencount > 0) {
            node = children[Math.floor((childrencount - 1) / 2)];
          }
        } else {
          node = selected_node.parent;
        }
        if (!!node) {
          _jm.select_node(node);
        }
        evt.stopPropagation();
        evt.preventDefault();
      }
    }
  };

  // plugin
  jm.plugin = function (name, init) {
    this.name = name;
    this.init = init;
  };
  jm.plugins = [];
  jm.register_plugin = function (plugin) {
    if (plugin instanceof jm.plugin) {
      jm.plugins.push(plugin);
    }
  };
  jm.init_plugins = function (sender) {
    $w.setTimeout(function () {
      jm._init_plugins(sender);
    }, 0);
  };
  jm._init_plugins = function (sender) {
    var l = jm.plugins.length;
    var fn_init = null;
    for (var i = 0; i < l; i++) {
      fn_init = jm.plugins[i].init;
      if (typeof fn_init === 'function') {
        fn_init(sender);
      }
    }
  };
  jm.show = function (options, mind) {
    logger.warn('`jsMind.show(options, mind)` is deprecated, please use `jm = new jsMind(options); jm.show(mind);` instead');
    var _jm = new jm(options);
    _jm.show(mind);
    return _jm;
  };

  // export jsmind
  {
    module.exports = jm;
  }
})(typeof window !== 'undefined' ? window : commonjsGlobal);
});

/*
 * Released under BSD License
 * Copyright (c) 2019-2020 Allen_sun_js@hotmail.com
 *
 * Project Home:
 *  https://github.com/allensunjian
 */
(function ($w, temp) {
  var Jm = $w[temp];
  var name = 'menu';
  var $d = $w['document'];
  var menuEvent = 'oncontextmenu';
  var clickEvent = 'onclick';
  var $c = function (tag) {
    return $d.createElement(tag);
  };
  var _noop = function () {};
  var logger = typeof console === 'undefined' ? {
    log: _noop,
    debug: _noop,
    error: _noop,
    warn: _noop,
    info: _noop
  } : console;
  var $t = function (n, t) {
    if (n.hasChildNodes()) {
      n.firstChild.nodeValue = t;
    } else {
      n.appendChild($d.createTextNode(t));
    }
  };
  var $h = function (n, t) {
    if (t instanceof HTMLElement) {
      t.innerHTML = '';
      n.appendChild(t);
    } else {
      n.innerHTML = t;
    }
  };
  if (!Jm || Jm[name]) return;
  Jm.menu = function (_jm) {
    this._get_menu_options(_jm, function () {
      this.init(_jm);
      this._mount_events();
    });
  };
  Jm.menu.prototype = {
    defaultDataMap: {
      funcMap: {
        edit: {
          isDepNode: true,
          // defaultFn不受到中台变量的控制，始终会先于fn去执行
          defaultFn: function (node) {
            var f = this._menu_default_mind_methods._menu_begin_edit.call(this.jm);
            f && this._menu_default_mind_methods._menu_edit_node_begin(this.jm.view, node);
          },
          fn: _noop,
          text: 'edit node'
        },
        addChild: {
          isDepNode: true,
          fn: function (nodeid, text) {
            var selected_node = this.get_selected_node();
            if (selected_node) {
              var node = this.add_node(selected_node, nodeid, text);
              if (node) {
                this.select_node(nodeid);
                this.begin_edit(nodeid);
              }
            }
          },
          text: 'append child'
        },
        addBrother: {
          isDepNode: true,
          fn: function (nodeid, text) {
            var selected_node = this.get_selected_node();
            if (!!selected_node && !selected_node.isroot) {
              var node = this.insert_node_after(selected_node, nodeid, text);
              if (node) {
                this.select_node(nodeid);
                this.begin_edit(nodeid);
              }
            }
          },
          text: 'append brother'
        },
        delete: {
          isDepNode: true,
          fn: function () {
            this.shortcut.handle_delnode.call(this.shortcut, this);
          },
          text: 'delete node'
        },
        showAll: {
          sDepNode: false,
          fn: function () {
            this.expand_all(this);
          },
          text: 'show all'
        },
        hideAll: {
          isDepNode: false,
          fn: function () {
            this.collapse_all(this);
          },
          text: 'hide all'
        },
        screenshot: {
          isDepNode: false,
          fn: function () {
            if (!this.screenshot) {
              logger.error('[jsmind] screenshot dependent on jsmind.screenshot.js !');
              return;
            }
            this.screenshot.shootDownload();
          },
          text: 'load mind picture'
        },
        showNode: {
          isDepNode: true,
          fn: function (node) {
            this.expand_node(node);
          },
          text: 'show target node'
        },
        hideNode: {
          isDepNode: true,
          fn: function (node) {
            this.collapse_node(node);
          },
          text: 'hide target node'
        }
      },
      menuStl: {
        'width': '150px',
        'padding': '12px 0',
        'position': 'fixed',
        'z-index': '10',
        'background': '#fff',
        'box-shadow': '0 2px 12px 0 rgba(0,0,0,0.1)',
        'border-radius': '5px',
        'font-size': '12px',
        'display': 'none'
      },
      menuItemStl: {
        padding: '5px 15px',
        cursor: 'pointer',
        display: 'block',
        'text-align': 'center',
        'transition': 'all .2s'
      },
      injectionList: ['edit', 'addChild', 'delete']
    },
    init: function (_jm) {
      this._create_menu(_jm);
      this._get_injectionList(_jm);
      this.menuOpts.switchMidStage && Jm.util.dom.add_event(_jm.view.e_editor, 'blur', function (e) {
        this._menu_default_mind_methods._menu_edit_node_end.call(_jm.view);
        if (typeof this.menuOpts.editCaller === 'function') {
          this.menuOpts.editCaller($w.menu._update_node_info, this._menu_default_mind_methods._menu_update_edit_node);
          return;
        }
        this._menu_default_mind_methods._menu_update_edit_node();
      }.bind(this));
    },
    _event_contextMenu(e) {
      e.preventDefault();
      this.menu.style.left = e.clientX + 'px';
      this.menu.style.top = e.clientY + 'px';
      this.menu.style.display = 'block';
      this.selected_node = this.jm.get_selected_node();
    },
    _event_hideMenu() {
      this.menu.style.display = 'none';
    },
    _mount_events() {
      $w[menuEvent] = this._event_contextMenu.bind(this);
      $w[clickEvent] = this._event_hideMenu.bind(this);
    },
    _create_menu(_jm) {
      var d = $c('menu');
      this._set_menu_wrap_syl(d);
      this.menu = d;
      this.e_panel = _jm.view.e_panel;
      this.e_panel.appendChild(d);
    },
    _create_menu_item(j, text, fn, isDepNode, cb, defaultFn) {
      var d = $c('menu-item');
      var _this = this;
      this._set_menu_item_syl(d);
      d.innerText = text;
      d.addEventListener('click', function () {
        if (this.selected_node || !isDepNode) {
          defaultFn.call(_this, this.selected_node);
          if (!_this._get_mid_opts()) {
            cb(this.selected_node, _noop);
            fn.call(j, Jm.util.uuid.newid(), this.menuOpts.newNodeText || '请输入节点名称');
            return;
          }
          cb(this.selected_node, _this._mid_stage_next(function () {
            var retArgs = [this.selected_node];
            var argus = Array.prototype.slice.call(arguments[0], 0);
            argus[1] = this.menuOpts.newNodeText || '请输入节点名称';
            if (argus[0]) {
              retArgs = argus;
            }
            fn.apply(j, retArgs);
          }.bind(this)));
          return;
        }
        alert(this.menuOpts.tipContent || 'Continue with node selected！');
      }.bind(this));
      d.addEventListener('mouseover', function () {
        d.style.background = 'rgb(179, 216, 255)';
      });
      d.addEventListener('mouseleave', function () {
        d.style.background = '#fff';
      });
      return d;
    },
    _set_menu_wrap_syl(d) {
      var os = this._get_option_sty('menu', this._get_mixin_sty);
      d.style.cssText = this._format_cssText(os);
    },
    _set_menu_item_syl(d) {
      var os = this._get_option_sty('menuItem', this._get_mixin_sty);
      d.style.cssText = this._format_cssText(os);
    },
    _format_cssText(o) {
      var text = '';
      Object.keys(o).forEach(function (k) {
        text += k + ':' + o[k] + ';';
      });
      return text;
    },
    _empty_object(o) {
      return Object.keys(o).length == 0;
    },
    _get_option_sty(type, fn) {
      var sty = this.menuOpts.style;
      var menu = this.defaultDataMap.menuStl;
      var menuItem = this.defaultDataMap.menuItemStl;
      var o = {
        menu,
        menuItem
      };
      if (!sty) return o[type];
      if (!sty[type]) return o[type];
      if (!sty[type] || this._empty_object(sty[type])) return o[type];
      return fn(o[type], sty[type]);
    },
    _get_mixin_sty(dSty, oSty) {
      var o = {};
      Object.keys(oSty).forEach(function (k) {
        o[k] = oSty[k];
      });
      Object.keys(dSty).forEach(function (k) {
        if (!o[k]) o[k] = dSty[k];
      });
      return o;
    },
    _get_menu_options(j, fn) {
      var options = j.options;
      if (!options.menuOpts) return;
      if (!options.menuOpts.showMenu) return;
      this.menuOpts = j.options.menuOpts;
      fn.call(this);
    },
    _get_injectionDetail() {
      var iLs = this.menuOpts.injectionList;
      var dLs = this.defaultDataMap.injectionList;
      if (!iLs) return dLs;
      if (!Array.isArray(iLs)) {
        logger.error('[jsmind] injectionList must be a Array');
        return;
      }
      if (iLs.length == 0) return dLs;
      return iLs;
    },
    _get_injectionList(j) {
      var list = this._get_injectionDetail();
      var _this = this;
      list.forEach(function (k) {
        var o = null;
        var text = '';
        var callback = _noop;
        var defaultFn = _noop;
        if (typeof k === 'object') {
          o = _this.defaultDataMap.funcMap[k.target];
          text = k.text;
          k.callback && (callback = k.callback);
        } else {
          o = _this.defaultDataMap.funcMap[k];
          text = o.text;
        }
        if (o.defaultFn) defaultFn = o.defaultFn;
        _this.menu.appendChild(_this._create_menu_item(j, text, o.fn, o.isDepNode, callback, defaultFn));
      });
    },
    _get_mid_opts() {
      var b = this.menuOpts.switchMidStage;
      if (!b) return false;
      if (typeof b !== 'boolean') {
        logger.error('[jsmind] switchMidStage must be Boolean');
        return false;
      }
      return b;
    },
    _switch_view_db_event(b, jm) {
      Jm.prototype.dblclick_handle = _noop;
      Jm.shortcut_provider.prototype.handler = _noop;
      Jm.view_provider.prototype.edit_node_end = _noop;
    },
    _mid_stage_next(fn) {
      return function () {
        fn(arguments);
      };
    },
    _reset_mind_event_edit() {},
    _menu_default_mind_methods: {
      _menu_begin_edit: function () {
        var f = this.get_editable();
        if (!f) {
          logger.error('fail, this mind map is not editable.');
        }
        return f;
      },
      _menu_edit_node_begin(scope, node) {
        if (!node.topic) {
          logger.warn("don't edit image nodes");
          return;
        }
        if (scope.editing_node != null) {
          this._menu_default_mind_methods._menu_edit_node_end.call(scope);
        }
        scope.editing_node = node;
        var view_data = node._data.view;
        var element = view_data.element;
        var topic = node.topic;
        var ncs = getComputedStyle(element);
        scope.e_editor.value = topic;
        scope.e_editor.style.width = element.clientWidth - parseInt(ncs.getPropertyValue('padding-left')) - parseInt(ncs.getPropertyValue('padding-right')) + 'px';
        element.innerHTML = '';
        element.appendChild(scope.e_editor);
        element.style.zIndex = 5;
        scope.e_editor.focus();
        scope.e_editor.select();
      },
      _menu_edit_node_end: function () {
        if (this.editing_node != null) {
          var node = this.editing_node;
          this.editing_node = null;
          var view_data = node._data.view;
          var element = view_data.element;
          var topic = this.e_editor.value;
          element.style.zIndex = 'auto';
          element.removeChild(this.e_editor);
          $w.menu._update_node_info = {
            id: node.id,
            topic: topic
          };
          if (Jm.util.text.is_empty(topic) || node.topic === topic) {
            if (this.opts.support_html) {
              $h(element, node.topic);
            } else {
              $t(element, node.topic);
            }
          }
        }
      },
      _menu_update_edit_node: function () {
        var info = $w.menu._update_node_info;
        $w.menu.jm.update_node(info.id, info.topic);
      }
    }
  };
  var plugin = new Jm.plugin('menu', function (_jm) {
    $w.menu = new Jm.menu(_jm);
    menu.jm = _jm;
    if (menu.menuOpts) _jm.menu = menu;
  });
  Jm.register_plugin(plugin);
  function preventMindEventDefault() {
    Jm.menu.prototype._switch_view_db_event();
  }
  Jm.preventMindEventDefault = preventMindEventDefault;
})(window, 'jsMind');

//
// import { getLeaf } from '@/api/business/loose-leaf/leaf'

var script$k = {
  name: 'XmlMindRender',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    officePreviewPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isReader: {
      // 是否阅读器
      type: Boolean,
      default: false
    },
    catalogList: {
      type: Array,
      default: () => []
    },
    looseLeafId: {
      type: String,
      default: ''
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          this.blockData = Object.assign({}, this.blockData, newValue);
          // console.log('pBlockData-XmlMind', newValue, this.blockData.jsMindData, this.catalogList)
        });
      },
      deep: true,
      immediate: true
    },
    mindData: {
      handler(newVal) {
        console.log('思维导图数据变化:watch', newVal);
      },
      deep: true
    }
  },
  data() {
    return {
      ouchnOss: null,
      propertyComponentsName: 'xml-mind-property',
      blockId: 'blockId' + Math.random(),
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      innerText: '',
      mindWidth: 0,
      pageWidth: 0,
      placeholder: 0,
      fontWidth: 0,
      rows: 5,
      // 脑图
      jm: null,
      lastX: 0,
      lastY: 0,
      selectedNode: {},
      isDragging: false,
      isClick: false,
      showNodeActions: false,
      actionButtonX: 0,
      actionButtonY: 0,
      showExpandButton: false,
      expandButtonX: 0,
      expandButtonY: 0,
      mindData: '',
      markdown: '',
      token: '',
      messages: [{
        role: 'assistant',
        content: '你好！我是AI智能助理，请问有什么我可以帮你的吗？'
      }],
      inputMessage: '',
      isFullscreen: false,
      dialogVisible01: false,
      jsmindContainer: null,
      actionButtonX: 0,
      actionButtonY: 0,
      lastX: 0,
      lastY: 0,
      mindText: '',
      //导入的思维导图数据
      mindCopy: '',
      //开始导入的思维导图数据
      mindDataSave: '',
      //需要保存的思维导图数据
      openChapter: false,
      aiMessage: '',
      aiToken: '',
      componentList: [],
      tempEvent: null,
      showControll: false,
      //展示控制弹窗
      mouseMarkDown: `- 键鼠操作\n  - 鼠标操作\n    - 单击：选择节点\n    - 双击：进入编辑模式，回车保存\n    - 拖动：摆放节点\n    - 点小圆圈：展开/收缩子节点\n  - 键盘操作\n    - Enter: 添加同级节点\n    - Ctrl+Enter: 添加下级节点\n    - F2: 进入编辑模式，回车保存\n    - Delete: 删除节点\n    - Space：展开/收缩子节点`,
      Jsmouse: null,
      mindLoading: false
    };
  },
  computed: {},
  methods: {
    // handleClose() {},
    // 为当前选中节点添加同级
    // addSiblingToSelectedNode() {
    //   if (!this.jm) return

    //   // 获取当前选中节点
    //   console.log(this.jm.get_selected_node(), '卡佛的')
    //   const selectedNode = this.jm.get_selected_node()
    //   if (!selectedNode) {
    //     console.log('请先选中一个节点')
    //     return
    //   }

    //   // 根节点不能有同级
    //   if (!selectedNode.parent) {
    //     console.log('根节点不能添加同级节点')
    //     return
    //   }

    //   // 创建新节点
    //   const newNode = {
    //     id: 'node_' + Date.now(),
    //     topic: '新同级节点',
    //     direction: selectedNode.direction,
    //     data: selectedNode.data, // 自定义数据（可选）
    //     parent: selectedNode.parent,
    //     children: [],
    //     expanded: false,
    //     isroot: false
    //   }
    //   console.log('新节点', newNode)

    //   // 添加到父节点下（即成为同级）
    //   this.jm.add_node(selectedNode.parent.id, newNode)

    //   // 选中新节点（可选）
    //   this.$nextTick(() => {
    //     this.jm.select_node(newNode.id)

    //   })

    //   // 触发更新（如果需要）
    //   // this.$emit('node-added', newNode)
    // },

    // handleKeyDown(event) {
    //   console.log('秒灭奥')

    //   if (event.key === 'Enter') {
    //     event.preventDefault()
    //     this.dialogVisible01 = true
    //   }
    // },
    // 此方法必须要，用户注册块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
      this.saveAll();
    },
    updateNode(node_id, data) {
      let jsMindList = [this.blockData.jsMindData];
      const getNode = (list, node_id) => {
        for (let i = 0; i < list.length; i++) {
          if (list[i].id === node_id) {
            console.log('aaaaaaaaaaaaaaaaa', list[i]);

            // list[i] = 
            for (let key in data) {
              console.log('bbbbbbbbbbbbbb', key, data[key]);
              list[i][key] = data[key];
            }
            console.log(this.blockData.jsMindData, 'cccccccccccccccccc');
            this.blockData.jsMindData = jsMindList[0];
            return;
          }
          if (list[i].children && list[i].children.length > 0) {
            getNode(list[i].children, node_id);
          }
        }
      };
      getNode(jsMindList, node_id);
    },
    createXmlConversation(inputMessage) {
      var mind = {
        meta: {
          name: 'demo',
          author: '你',
          version: '1.0'
        },
        format: 'node_tree',
        data: this.blockData.jsMindData
      };
      console.log(this.blockData.jsMindData, '话回复数据');
      var mindCopy = JSON.parse(JSON.stringify(mind));
      this.mindCopy = JSON.parse(JSON.stringify(mind));
      // 随机连线颜色
      var randomLineColor = '#46b342';
      var options = {
        container: this.$refs.jsmindContainer,
        // editable: true,
        mode: 'full',
        // 必须为'full'模式才能拖拽
        // 开启编辑模式
        editable: this.mode == 'editor',
        theme: 'primary',
        view: {
          enable_drag: true,
          // 关键：启用节点拖拽
          // hide_right_menu: true, // 禁用默认右键菜单
          hmargin: 100,
          vmargin: 50,
          line_width: 2,
          line_color: randomLineColor,
          direction: 'left',
          // 'left', 'right', 'side'
          node_width: 130,
          // 确保节点宽度足够
          expand_level: 1,
          // enable_zoom: false,
          // 启用右键菜单
          enable_contextmenu: true,
          // 自定义菜单项
          contextmenu: [{
            id: 'add_child',
            name: '添加子节点'
          }, {
            id: 'edit',
            name: '编辑节点'
          }, {
            id: 'delete',
            name: '删除节点'
          }, {
            id: 'separator'
          },
          // 分隔线
          {
            id: 'copy',
            name: '复制'
          }, {
            id: 'paste',
            name: '粘贴'
          }]
        },
        shortcut: {
          enable: true,
          // 是否启用快捷键
          handles: {},
          // 命名的快捷键事件处理器
          mapping: {
            // 快捷键映射
            addchild: [45, 4096 + 13],
            // <Insert>, <Ctrl> + <Enter>
            addbrother: 13,
            // <Enter>
            editnode: 113,
            // <F2>
            delnode: 46,
            // <Delete>
            toggle: 32,
            // <Space>
            left: 37,
            // <Left>
            up: 38,
            // <Up>
            right: 39,
            // <Right>
            down: 40 // <Down>
          }
        }
      };
      this.jm = new jsmind(options);
      // 启用编辑
      this.jm.enable_edit();

      // 显式启用拖拽
      // this.jm.enable_draggable();
      // this.jm.enable_drag(true);

      console.log(mindCopy, '话回复数据1');
      this.jm.show(mindCopy);
      this.mindData = this.jm.get_data();
      this.jm.add_event_listener(event => {
        console.log('事件类型:', event);
        if (['add_node', 'remove_node', 'update_node', 'move_node'].includes(event.type)) {
          this.mindData = this.jm.get_data();
          console.log('思维导图数据变化:', this.currentMindData);
        }
      });

      // 覆盖缩放相关方法
      this.jm.view.zoomIn = function () {
        console.log('缩放功能已禁用1');
        zoomMindMap(true);
      };
      this.jm.view.zoomOut = function () {
        zoomMindMap(false);
        console.log('缩放功能已禁用2');
      };
      this.jm.view.setZoom = function () {
        console.log('缩放功能已禁用3');
      };
      let that = this;
      // this.$refs.jsmindContainer.addEventListener('click', this.handleClick)

      // 获取所有节点元素并添加点击事件
      this.$refs.jsmindContainer.querySelectorAll('jmnode').forEach(node => {
        if (that.mode !== 'editor') {
          node.addEventListener('dblclick', function (e) {
            e.stopPropagation(); // 阻止事件冒泡
            that.handleClick(e);

            // 获取节点ID
            const nodeId = this.getAttribute('nodeid');
            // 通过JsMind API获取节点数据
            const nodeData = that.jm.get_node(nodeId);
            if (nodeData.children.length > 0) {
              if (nodeData.expanded) {
                that.jm.collapse_node(nodeData.id);
              } else {
                that.jm.expand_node(nodeData.id);
              }
            }
          });
        }
        node.addEventListener('click', function (e) {
          e.stopPropagation(); // 阻止事件冒泡
          that.handleClick(e);
          // 获取节点ID
          const nodeId = this.getAttribute('nodeid');
          if (that.mode == 'editor') {
            // console.log('编辑模式及', that.jm.get_selected_node())
            that.$EventBus.$emit('xmlSelectedMindNode', {
              nodeId: nodeId,
              data: that.jm.get_data('node_tree')
            });
          } else {
            const nodeData = that.jm.get_node(nodeId);
            if (e.target.className == 'xml-custom-button') {
              console.log('点击事件触发11', nodeData);
              if (nodeData.data.linkType == '2') {
                // 教材内跳转
                that.$EventBus.$emit('jumpWithinTheTextbook', {
                  location: nodeData.data.link
                });
              }
            }
          }
          // 通过JsMind API获取节点数据
          // const nodeData = that.jm.get_node(nodeId)
          // let list=[that.blockData.jsMindData]
          // that.selectedNode = that.findItemById(list,nodeId)
          // console.log('点击事件触发',that.selectedNode)
        });
      });
      this.expandToDepth(this.blockData.expandLevel || 1);

      // ===================================

      let scale = this.blockData.defaultScale || 1;
      let scaleS = this.blockData.defaultScale || 1;

      // 添加拖拽功能
      let isDragging = false;
      let startX, startY;
      let translateX = 0;
      let translateY = 0;
      let clientX = 0;
      let innerWidth = this.$refs.markmapContainer.offsetWidth || 0;
      let innerHight = this.$refs.markmapContainer.offsetHeight || 0;

      // container.style.transform='translate(-50%,-50%)'

      startX = 5000 - innerWidth / 2 * (1 / scale) - this.blockData.left;
      startY = 5000 - innerHight / 2 * (1 / scale) - this.blockData.top; //画布高度一半，减去可视窗口高度一半

      translateX = (0 - startX) * scale;
      translateY = (0 - startY) * scale;
      this.$refs.jsmindContainer.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`;
      this.$refs.jsmindContainer.addEventListener('mousedown', e => {
        if (e.button === 0) {
          // 左键点击
          isDragging = true;
          startX = e.clientX - translateX;
          startY = e.clientY - translateY;
          this.$refs.jsmindContainer?.classList?.add('dragging');
        }
      });
      this.$refs.jsmindContainer.addEventListener('mousemove', e => {
        if (isDragging) {
          e.preventDefault();
          translateX = e.clientX - startX;
          translateY = e.clientY - startY;
          this.$refs.jsmindContainer.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`;
        } else {
          // console.log(e.offsetX);
          let mouse = this.getMousePositionRelativeToElement(e, this.$refs.markmapContainer);
          clientX = mouse.x;
          mouse.y;
        }
      });
      this.$refs.jsmindContainer.addEventListener('mouseup', e => {
        isDragging = false;
        this.$refs.jsmindContainer.classList.remove('dragging');
      });

      // 缩放思维导图
      const zoomMindMap = isZoomIn => {
        const delta = !isZoomIn ? 0.99 : 1.01;
        let width1 = 10000 * scale;
        scale = Math.min(Math.max(0.4, scale * delta), 3);
        let width2 = 10000 * scale;
        let beishu = width2 / width1;
        if (!isZoomIn && scale != scaleS) {
          translateX = translateX * beishu - 50 + clientX / innerWidth * 10;
          translateY = translateY * beishu - 50 + clientX / innerHight * 4;
        } else if (isZoomIn && scale != scaleS) {
          translateX = translateX * beishu + 50 - clientX / innerWidth * 10;
          translateY = translateY * beishu + 50 - clientX / innerHight * 4;
        }
        this.$refs.jsmindContainer.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`;
        scaleS = scale;
      };
    },
    // 匹配
    findItemById(arr, id) {
      for (const item of arr) {
        if (item.id === id) return item;
        if (item.children && item.children.length) {
          const found = this.findItemById(item.children, id);
          if (found) return found;
        }
      }
    },
    getMousePositionRelativeToElement(event, element) {
      // 获取元素的边界矩形
      const rect = element.getBoundingClientRect();

      // 计算鼠标相对于元素的位置
      const x = event.clientX - rect.left;
      const y = event.clientY - rect.top;
      return {
        x,
        y
      };
    },
    // 全部展开
    expandAll() {
      if (this.jm) {
        this.jm.expand_all();
      }
    },
    // 全部收起
    collapseAll() {
      if (this.jm) {
        this.jm.collapse_all();
      }
    },
    // 展开指定层级
    expandToDepth(num) {
      if (this.jm) {
        this.jm.expand_to_depth(num);
      }
    },
    // 切换全屏
    toggleFullscreen() {
      if (!document.fullscreenElement) {
        this.$refs.markmapContainer.requestFullscreen();
        this.isFullscreen = true;
      } else {
        document.exitFullscreen();
        this.isFullscreen = false;
      }
    },
    // 保存
    saveAll() {
      console.log('保存所有数据', this.jm.get_data('node_tree').data);
      this.$EventBus.$emit('updateBlockData', this.jm.get_data('node_tree').data);
    },
    // 处理全屏状态变化
    handleFullscreenChange() {
      this.isFullscreen = !!document.fullscreenElement;
    },
    // 点击编辑并写入节点
    handleClick(event) {
      console.log('点击事件触发', event.target);
      const target = event.target;
      this.tempEvent = event.target;
      const nodeId = target.getAttribute('nodeid');
      let left = Number(target.style.left.slice(0, -2));
      let top = Number(target.style.top.slice(0, -2));
      // this.$EventBus.$emit('sendSelectNode', this.jm.get_node(event.target.getAttribute('nodeid')))
      // console.log('handleClick', event, target.getBoundingClientRect(), left, top, target.style)

      if (nodeId && target.getBoundingClientRect().width > 15) {
        const node = this.jm.get_node(nodeId);
        node.topic = node.topic.replace(/<[^>]*>/g, '');
        this.selectedNode = node;
        const rect = target.getBoundingClientRect();
        // console.log('handleClickrect', rect);
        if (!this.isClick) {
          this.actionButtonX = left;
          this.actionButtonY = top - 25;
          this.expandButtonX = rect.right + 5;
          this.expandButtonY = rect.top + rect.height / 2 - 10;
        } else {
          this.actionButtonX = left;
          this.actionButtonY = top - 25;
          // this.actionButtonX = rect.left
          // this.actionButtonY = rect.top + 25
          this.expandButtonX = rect.right + 5;
          this.expandButtonY = rect.top + rect.height / 2 - 10;
        }
        this.showNodeActions = true;
        this.showExpandButton = node.children && node.children.length > 0;

        // 为当前选中节点添加 keydown 事件监听器
        const handleKeyDown = e => {
          if (e.key === 'Enter') {
            console.log('回车键按下');
            // 执行相应的操作
          }
        };
        // 添加事件监听器
        target.addEventListener('keydown', handleKeyDown);
      } else {
        this.selectedNode = null;
        this.showNodeActions = false;
        this.showExpandButton = false;
      }
      console.log('选中的节点XmlMind', this.selectedNode);
      if (this.selectedNode.data.link?.type == 'chapter' && this.mode != 'editor') {
        let {
          type,
          value,
          label,
          desc,
          cover
        } = this.selectedNode.data.link || {};
        console.log('this.selectedNode.data.link', type, value, label, desc, cover);
        this.$EventBus.$emit('hotzoneClick', {
          type,
          value,
          label,
          desc,
          cover
        });
      }
    },
    // 新增节点
    addNode() {
      if (this.selectedNode) {
        const newNodeId = `node${v4()}`;
        const newNode = this.jm.add_node(this.selectedNode, newNodeId, '新节点');
        this.jm.move_node(newNode, 0, 0);
        this.showNodeActions = false;
        this.mindCopy.data = this.jm.get_data('node_tree').data;
        console.log('addNode', newNodeId, this.jm.get_data('node_tree').data);

        // 获取所有节点元素并添加点击事件
        let that = this;
        this.$refs.jsmindContainer.querySelectorAll('jmnode').forEach(node => {
          if (that.mode !== 'editor') {
            node.addEventListener('dblclick', function (e) {
              e.stopPropagation(); // 阻止事件冒泡
              that.handleClick(e);

              // 获取节点ID
              const nodeId = this.getAttribute('nodeid');
              // 通过JsMind API获取节点数据
              const nodeData = that.jm.get_node(nodeId);
              if (nodeData.children.length > 0) {
                if (nodeData.expanded) {
                  that.jm.collapse_node(nodeData.id);
                } else {
                  that.jm.expand_node(nodeData.id);
                }
              }
            });
          }
          node.addEventListener('click', function (e) {
            e.stopPropagation(); // 阻止事件冒泡
            that.handleClick(e);
            // 获取节点ID
            const nodeId = this.getAttribute('nodeid');
            if (that.mode == 'editor') {
              // console.log('编辑模式及', that.jm.get_selected_node())
              that.$EventBus.$emit('xmlSelectedMindNode', {
                nodeId: nodeId,
                data: that.jm.get_data('node_tree')
              });
            } else {
              const nodeData = that.jm.get_node(nodeId);
              if (e.target.className == 'xml-custom-button') {
                console.log('点击事件触发11', nodeData);
                if (nodeData.data.linkType == '2') {
                  // 教材内跳转
                  that.$EventBus.$emit('jumpWithinTheTextbook', {
                    location: nodeData.data.link
                  });
                }
              }
            }
            // 通过JsMind API获取节点数据
            // const nodeData = that.jm.get_node(nodeId)
            // let list=[that.blockData.jsMindData]
            // that.selectedNode = that.findItemById(list,nodeId)
            // console.log('点击事件触发',that.selectedNode)
          });
        });
        // this.jm.show(this.mindCopy)
        this.saveAll();
        // this.jm.render()
      } else {
        this.$message({
          message: '请选择节点',
          type: 'warning'
        });
      }
    },
    // 删除节点
    deleteNode() {
      if (this.selectedNode) {
        console.log('删除节点', this.selectedNode);
        this.$confirm('确定要删除这个节点吗？', {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '删除成功'
          });
          this.jm.remove_node(this.selectedNode);
          this.selectedNode = null;
          this.showNodeActions = false;
          this.saveAll();

          // this.jm.render()
        }).catch(() => {});
      } else {
        this.$message({
          message: '请选择节点',
          type: 'warning'
        });
      }
    },
    // 章节名字
    montageHtml(e, isLabel) {
      let label = ``;
      if (isLabel) {
        label = `<span title='跳转' class="xml-custom-button"></span>`;
      }
      if (e) {
        return `<span title='${e}'>${e}${label}</span>`;
      } else {
        return `<span title='${e}'>${暂无数据}${label}</span>`;
      }
    },
    // 导入maddown
    handleFileChange(e) {
      const file = e.raw;
      if (file) {
        const reader = new FileReader();
        reader.onload = e => {
          const content = e.target.result;
          // const jsonData = this.parseMarkdownToTree(content)
          const lines = content.split('\n');
          const tree = [];
          const stack = [{
            level: 0,
            node: tree
          }];

          lines.forEach(line => {
            const match = line.match(/^(#{1,6})\s+(.+)$/);
            if (match) {
              const level = match[1].length;
              const topic = match[2];

              // 创建新节点
              const newNode = {
                topic: this.montageHtml(topic),
                level: level,
                expanded: false,
                id: v4(),
                linkType: "1",
                link: "",
                children: []
              };

              // 找到合适的父节点
              while (stack[stack.length - 1].level >= level) {
                stack.pop();
              }

              // 将新节点添加到父节点的children中
              stack[stack.length - 1].node.push(newNode);
              // 将新节点压入栈中
              stack.push({
                level: level,
                node: newNode.children
              });
            }
          });
          console.log('tree', tree);
          this.mindCopy.data = tree[0];
          this.mindText = tree[0];
          this.jm.show(this.mindCopy);
          // this.blockData.jsMindData=tree[0]
          this.$EventBus.$emit('updateBlockData', tree[0]);
          // console.log('jsonData', tree)
        };
        reader.readAsText(file);
      }
    },
    // 打开章节列表
    openChapterList() {
      this.openChapter = true;
    },
    // 获取本章文字
    async searchClick() {
      this.componentList = [];
      if (sysEnv.isBSD) {
        await fetch(process.env.VUE_APP_BASE_API + '/business/looseLeaf/getById?id=' + this.looseLeafId, {
          method: 'get',
          headers: {
            'Accept': 'application/json'
          },
          params: {
            id: this.looseLeafId
          }
        }).then(response => response.json()).then(res => {
          if (res.data) {
            let data = {};
            data[this.looseLeafId] = res.data;
            this.formattedData(data, this.looseLeafId, 'chapter');
          }
        });
        // getLeaf(this.looseLeafId).then(res => {
        //   if (res.data) {
        //     let data = {}
        //     data[this.looseLeafId] = res.data
        //     this.formattedData(data, this.looseLeafId, 'chapter')
        //   }
        // })
      }
    },
    // 
    // 处理活页json数据信息
    formattedData(looseLeafData, chapterId, searchType) {
      let list = [];
      let searchList = [];
      list = JSON.parse(looseLeafData[chapterId].looseLeafInfo) || [];
      list.map((element, index) => {
        let groupIndex = index;
        // 向数据里添加位置信息，第一位：章节Id 、第二位：模块Id
        this.$set(element, 'location', `xml-digital-teaching/${chapterId}/${element.xmlCompRef}`);

        // 向数据里添加章节Id
        this.$set(element, 'chapterId', chapterId);
        this.$set(element, 'label', looseLeafData[chapterId].looseLeafName); //章节名字
        this.$set(element, 'groupIndex', groupIndex); //块的索引
        // if (item.componentsName.indexOf('xml-single-text-group') !== -1) {
        //   this.$set(item, 'Text', item.data.pGroupData.textData?.html) //文本内容
        // } else if (item.componentsName.indexOf('paragrap') !== -1) {
        //   this.$set(item, 'Text', item.data.pGroupData.bodyTextData?.html) //文本内容
        // }
        if (element.componentsName == 'xml-single-text-group' || element.componentsName == 'xml-single-agent-group') {
          // 文本
          let textList = [];
          if (element.data.pGroupData.textData?.html.indexOf(this.searchText) !== -1) {
            textList.push({
              componentType: 'textGroup',
              Text: element.data.pGroupData.textData?.html,
              modulIndex: 0
            });
          }
          this.$set(element, 'componentType', 'textGroup');
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-image-group') {
          // 图片
          let textList = [];
          element.data.pGroupData.imageData.imageList.map((item, index) => {
            textList.push({
              title: item.title,
              titleClass: 'xml-image-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-music-group') {
          // 音频
          let textList = [];
          element.data.pGroupData.musicData.musicSetList.map((item, index) => {
            textList.push({
              title: item.title,
              titleClass: 'xml-audio-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-video-group') {
          // 视频
          let textList = [];
          element.data.pGroupData.videoData.videoSetList.map((item, index) => {
            textList.push({
              title: item.title,
              titleClass: 'xml-video-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-resource-group') {
          // 资源
          let textList = [];
          element.data.pGroupData.resourceData.resourceSetList.map((item, index) => {
            let title = item.title || item.fileFormat;
            textList.push({
              title: title,
              titleClass: 'xml-resource-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-book-group') {
          // 电子书
          let textList = [];
          element.data.pGroupData.ebookData.ebookSetList.map((item, index) => {
            let title = item.title || item.name;
            textList.push({
              title: title,
              titleClass: 'xml-ebook-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-question-group') {
          // 试题
          let textList = [];
          element.data.pGroupData.questionData.questionSetList.map((item, index) => {
            textList.push({
              title: item.stem.content,
              titleClass: 'xml-question-title',
              index: index,
              chapterId,
              groupIndex
            });
            // item.stem.content = item.stem.content?.replace(new RegExp(this.searchText, 'g'), this.replaceText)
            // item.analysis.content = item.analysis.content?.replace(new RegExp(this.searchText, 'g'), this.replaceText)
            // item.questionOption?.map(items => {
            //   items.content = items.content?.replace(new RegExp(this.searchText, 'g'), this.replaceText)
            // })
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-test-paper-group') {
          // 试卷
          let textList = [];
          element.data.pGroupData.testPaperData.testPaperSetList.map((item, index) => {
            textList.push({
              title: item.paperName,
              titleClass: 'xml-paper-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName == 'xml-single-hotzone-group') {
          //热区
          let textList = [];
          element.data.pGroupData.xmlBlockData.imageList.map((item, index) => {
            textList.push({
              title: item.title,
              titleClass: 'xml-hot-zone-title',
              index: index,
              chapterId,
              groupIndex
            });
          });
          this.$set(element, 'textList', textList); //文本内容
        }
        // else if (element.componentsName == 'xml-single-voice-group') {
        //   //科大讯飞录音测评
        //   let textList = []
        //   if (element.data.pGroupData.content) {
        //     textList.push(element.data.pGroupData.content)
        //     this.$set(element, 'textList', textList) //文本内容
        //   }
        // }
        else if (element.componentsName == 'xml-single-html-group') {
          if (element.data.pGroupData.htmlData.code) ;
        } else if (element.componentsName.indexOf('title') !== -1) {
          //标题
          let modulIndex = 0;
          let textList = [];
          for (let item in element.data.pGroupData) {
            if (element.data.pGroupData[item].html && element.data.pGroupData[item].html.indexOf(this.searchText) !== -1) {
              textList.push({
                componentType: 'textGroup',
                Text: element.data.pGroupData[item].html,
                textKey: item,
                modulIndex
              });
            }
            modulIndex++;
          }
          this.$set(element, 'componentType', 'textGroup');
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName.indexOf('paragraph') !== -1) {
          //段落
          let modulIndex = 0;
          let textList = [];
          for (let item in element.data.pGroupData) {
            if (Array.isArray(element.data.pGroupData[item])) {
              for (let index in element.data.pGroupData[item]) {
                if (element.data.pGroupData[item][index].html && element.data.pGroupData[item][index].html.indexOf(this.searchText) !== -1) {
                  textList.push({
                    componentType: 'textGroup',
                    Text: element.data.pGroupData[item][index].html,
                    textKey: item,
                    modulIndex
                  });
                }
                modulIndex++;
              }
            } else if (element.data.pGroupData[item].html && element.data.pGroupData[item].html.indexOf(this.searchText) !== -1) {
              textList.push({
                componentType: 'textGroup',
                Text: element.data.pGroupData[item].html,
                textKey: item,
                modulIndex
              });
            }
            modulIndex++;
          }
          this.$set(element, 'componentType', 'textGroup');
          this.$set(element, 'textList', textList); //文本内容
        } else if (element.componentsName.indexOf('imageText') !== -1) {
          //图文
          let modulIndex = 0;
          let textList = [];
          for (let item in element.data.pGroupData) {
            if (element.data.pGroupData[item].html && element.data.pGroupData[item].html.indexOf(this.searchText) !== -1) {
              textList.push({
                componentType: 'textGroup',
                Text: element.data.pGroupData[item].html,
                textKey: item,
                modulIndex
              });
            }
            modulIndex++;
          }
          this.$set(element, 'componentType', 'textGroup');
          this.$set(element, 'textList', textList); //文本内容
        }
      });
      this.componentList = this.componentList.concat(list);
      this.componentList.map(item => {
        if (item.componentType == 'textGroup') {
          if (item.data.pGroupData.textData) {
            searchList.push(item.data.pGroupData.textData.html.replace(/<[^>]*>/g, ''));
          } else if (item.data.pGroupData.titleTextData) {
            searchList.push(item.data.pGroupData.titleTextData.html.replace(/<[^>]*>/g, ''));
          }
        } else if (item.textList) {
          for (let i = 0; i < item.textList.length; i++) {
            searchList.push(item.textList[i].title);
          }
        }
      });
      searchList = JSON.parse(JSON.stringify(searchList));
      for (let i = 0; i < searchList.length; i++) {
        this.aiMessage += searchList[i] + ',';
      }
      this.getAiToken();
      console.log('获取的本章文字', this.aiMessage, searchList);
    },
    // 关闭ai窗口
    closeMindDia() {
      this.openChapter = false;
      this.mindLoading = false;
      this.$refs.tree.setCheckedKeys([]);
    },
    // 使用ai
    getMindAi() {
      // this.openChapter = false
      this.mindLoading = true;
      this.aiMessage = '';
      if (this.$refs.tree.getCheckedNodes().length == 0) {
        this.$message.error('请选择章节');
      } else if (this.$refs.tree.getCheckedNodes().length == 1) {
        this.searchClick();
      } else {
        for (let i = 0; i < this.$refs.tree.getCheckedNodes().length; i++) {
          const item = this.$refs.tree.getCheckedNodes()[i];
          this.aiMessage += `${item.label},`;
        }
        this.getAiToken();
      }
      console.log(this.$refs.tree.getCheckedNodes(), 'getMindAi');
    },
    // 获取ai的token
    getAiToken() {
      fetch('https://services.isbn.ink/api/auth/oauth/token', {
        method: 'post',
        headers: {
          'Content-Type': 'application/json',
          Authorization: 'Bearer ' + 'UmlKLUwBXuFvKaIpsSNa7oUY041sQlklUvVlUxcm'
        },
        body: JSON.stringify({
          app_id: '123',
          client_id: 1,
          client_secret: 'UmlKLUwBXuFvKaIpsSNa7oUY041sQlklUvVlUxcm',
          user_id: '2132'
        })
      }).then(response => response.json()).then(json => {
        // this.conversationId = json.conversation_id
        // this.conversationId = json.data.token.split('|')[0]
        this.aiToken = json.data.token;
        this.useAi();
        // console.log(json,this.conversationId, 'conversationIdconversationIdconversationId')
      });
    },
    // 使用ai
    useAi() {
      fetch('https://services.isbn.ink/api/admin/articles', {
        method: 'post',
        headers: {
          'Content-Type': 'application/json',
          Authorization: 'Bearer ' + this.aiToken
        },
        body: JSON.stringify({
          title: '出版学',
          outside_uid: '8899',
          content_text: this.aiMessage

          // content_text: markdown.value,
          // kb_id:113,
          // kb_type:'book',
          // message:'你知道什么资料'
        })
      }).then(response => response.json()).then(json => {
        let str = this.transformString(json.data.article.content_markmap);
        let jsMindData = this.convertToJsMindData(str);
        this.jm.show(jsMindData);
        let that = this;
        // this.$refs.jsmindContainer.addEventListener('click', this.handleClick)

        // 获取所有节点元素并添加点击事件
        this.$refs.jsmindContainer.querySelectorAll('jmnode').forEach(node => {
          if (that.mode !== 'editor') {
            node.addEventListener('dblclick', function (e) {
              e.stopPropagation(); // 阻止事件冒泡
              that.handleClick(e);

              // 获取节点ID
              const nodeId = this.getAttribute('nodeid');
              // 通过JsMind API获取节点数据
              const nodeData = that.jm.get_node(nodeId);
              if (nodeData.children.length > 0) {
                if (nodeData.expanded) {
                  that.jm.collapse_node(nodeData.id);
                } else {
                  that.jm.expand_node(nodeData.id);
                }
              }
            });
          }
          node.addEventListener('click', function (e) {
            e.stopPropagation(); // 阻止事件冒泡
            that.handleClick(e);
            // 获取节点ID
            const nodeId = this.getAttribute('nodeid');
            if (that.mode == 'editor') {
              // console.log('编辑模式及', that.jm.get_selected_node())
              that.$EventBus.$emit('xmlSelectedMindNode', {
                nodeId: nodeId,
                data: that.jm.get_data('node_tree')
              });
            } else {
              const nodeData = that.jm.get_node(nodeId);
              if (e.target.className == 'xml-custom-button') {
                console.log('点击事件触发11', nodeData);
                if (nodeData.data.linkType == '2') {
                  // 教材内跳转
                  that.$EventBus.$emit('jumpWithinTheTextbook', {
                    location: nodeData.data.link
                  });
                }
              }
            }
          });
        });
        this.saveAll();
        this.closeMindDia();
      });
    },
    // ai获取到的字符串转化
    transformString(inputString) {
      // console.log(inputString, 'inputString')

      let result = '';
      const lines = inputString.split('\n');
      for (const line of lines) {
        let depth = 0;
        let content = '';
        for (let i = 0; i < line.length; i++) {
          if (line[i] === ' ') {
            depth++;
          } else if (line[i] === '-') {
            // 跳过 '-' 和后面的空格
            i++;
            while (i < line.length && line[i] === ' ') {
              i++;
            }
            content = line.slice(i);
            break;
          }
        }
        // 如果没有空格，至少添加一个 #
        const hashCount = depth === 0 ? 1 : Math.ceil(depth / 2) + 1;
        const hashes = '#'.repeat(hashCount);
        result += `${hashes} ${content}\n`;
      }
      // console.log(result.trim(), 'result')

      return result.trim();
    },
    convertToJsMindData(str) {
      const lines = str.split('\n');
      ({
        id: 'root',
        topic: lines[0].replace(/#+\s*/, ''),
        children: [],
        leval: 1
      });
      // stack[0].children=[]
      // console.log(stack, 'root', lines)

      let tempList = [];
      for (let i = 0; i < lines.length; i++) {
        const match = lines[i].match(/^(#+)\s*(.*)/);
        if (match) {
          const level = match[1].length;
          const topic = match[2];
          const node = {
            id: `node${i}`,
            topic: topic,
            children: [],
            leval: level
          };
          tempList.push(node);
        }
      }
      let datas = this.arrayToTree(tempList);
      // console.log(tempList, 'tempList', datas)

      return {
        meta: {
          name: '项目规划思维导图',
          author: '作者',
          version: '0.1'
        },
        format: 'node_tree',
        data: datas[0]
      };
    },
    // 转换格式化
    arrayToTree(data) {
      const tree = [];
      const map = {};

      // 先将所有节点存入 map 中
      data.forEach(item => {
        map[item.id] = {
          ...item,
          children: []
        };
      });
      data.forEach((item, index) => {
        const current = map[item.id];
        if (item.leval === 1) {
          tree.push(current);
        } else {
          // 找到父节点
          const parentLeval = item.leval - 1;
          let parent = null;
          // 从当前元素往前找合适的父节点
          for (let i = index - 1; i >= 0; i--) {
            if (data[i].leval === parentLeval) {
              parent = map[data[i].id];
              break;
            }
          }
          if (parent) {
            parent.children.push(current);
          }
        }
      });
      return tree;
    },
    // 底栏操作
    editNode(i) {
      // this.updateNode('c3232e40-91d2-4098-9b9b-22854a09fec2',{linkType:'3',link:'xxxxxxxxxxxksjdfklwjeklfjwk'})
      console.log(this.selectedNode);
      if (!this.selectedNode) {
        this.$message.error('请选择节点');
      } else if (i == 0) {
        this.jm.enable_edit();
        const event = new KeyboardEvent('keydown', {
          key: 'Enter',
          code: 'Enter',
          keyCode: 113,
          which: 113,
          bubbles: true
        });
        console.log(event, 'event', this.tempEvent);
        this.tempEvent.dispatchEvent(event);
      } else if (i == 1) {
        //添加同级节点
        if (this.selectedNode.parent) {
          this.selectedNode.parent.id;
          const newNodeId = `node${v4()}`;
          const newNode = this.jm.add_node(this.selectedNode.parent, newNodeId, '新节点');
          this.jm.move_node(newNode, 0, 0);
          this.showNodeActions = false;
          this.mindCopy.data = this.jm.get_data('node_tree').data;
          console.log('addNode', newNodeId, this.jm.get_data('node_tree').data);

          // 获取所有节点元素并添加点击事件
          let that = this;
          this.$refs.jsmindContainer.querySelectorAll('jmnode').forEach(node => {
            if (that.mode !== 'editor') {
              node.addEventListener('dblclick', function (e) {
                e.stopPropagation(); // 阻止事件冒泡
                that.handleClick(e);

                // 获取节点ID
                const nodeId = this.getAttribute('nodeid');
                // 通过JsMind API获取节点数据
                const nodeData = that.jm.get_node(nodeId);
                if (nodeData.children.length > 0) {
                  if (nodeData.expanded) {
                    that.jm.collapse_node(nodeData.id);
                  } else {
                    that.jm.expand_node(nodeData.id);
                  }
                }
              });
            }
            node.addEventListener('click', function (e) {
              e.stopPropagation(); // 阻止事件冒泡
              that.handleClick(e);
              // 获取节点ID
              const nodeId = this.getAttribute('nodeid');
              if (that.mode == 'editor') {
                // console.log('编辑模式及', that.jm.get_selected_node())
                that.$EventBus.$emit('xmlSelectedMindNode', {
                  nodeId: nodeId,
                  data: that.jm.get_data('node_tree')
                });
              } else {
                const nodeData = that.jm.get_node(nodeId);
                if (e.target.className == 'xml-custom-button') {
                  console.log('点击事件触发11', nodeData);
                  if (nodeData.data.linkType == '2') {
                    // 教材内跳转
                    that.$EventBus.$emit('jumpWithinTheTextbook', {
                      location: nodeData.data.link
                    });
                  }
                }
              }
            });
          });
        } else {
          this.$message.error('无法添加同级节点');
        }
      } else if (i == 2) {
        //添加子节点
        if (this.selectedNode) {
          this.addNode();
        } else {
          this.$message.error('请选择节点');
        }
      } else if (i == 3) {
        //添加父节点
        if (this.selectedNode) {
          this.selectedNode.parent.id;
          const newNodeId = `node${v4()}`;
          const newNode = this.jm.add_node(this.selectedNode.parent, newNodeId, '新节点');
          this.jm.move_node(newNode, 0, 0);
          this.showNodeActions = false;
          this.mindCopy.data = this.jm.get_data('node_tree').data;
          console.log('addNode', newNodeId, this.jm.get_data('node_tree').data);
          this.jm.move_node(this.selectedNode, '_first_', newNodeId);
          // 获取所有节点元素并添加点击事件
          let that = this;
          this.$refs.jsmindContainer.querySelectorAll('jmnode').forEach(node => {
            if (that.mode !== 'editor') {
              node.addEventListener('dblclick', function (e) {
                e.stopPropagation(); // 阻止事件冒泡
                that.handleClick(e);

                // 获取节点ID
                const nodeId = this.getAttribute('nodeid');
                // 通过JsMind API获取节点数据
                const nodeData = that.jm.get_node(nodeId);
                if (nodeData.children.length > 0) {
                  if (nodeData.expanded) {
                    that.jm.collapse_node(nodeData.id);
                  } else {
                    that.jm.expand_node(nodeData.id);
                  }
                }
              });
            }
            node.addEventListener('click', function (e) {
              e.stopPropagation(); // 阻止事件冒泡
              that.handleClick(e);
              // 获取节点ID
              const nodeId = this.getAttribute('nodeid');
              if (that.mode == 'editor') {
                // console.log('编辑模式及', that.jm.get_selected_node())
                that.$EventBus.$emit('xmlSelectedMindNode', {
                  nodeId: nodeId,
                  data: that.jm.get_data('node_tree')
                });
              } else {
                const nodeData = that.jm.get_node(nodeId);
                if (e.target.className == 'xml-custom-button') {
                  console.log('点击事件触发11', nodeData);
                  if (nodeData.data.linkType == '2') {
                    // 教材内跳转
                    that.$EventBus.$emit('jumpWithinTheTextbook', {
                      location: nodeData.data.link
                    });
                  }
                }
              }
            });
          });
        } else {
          this.$message.error('请选择节点');
        }
      } else if (i == 4) {
        //前移
        let beforeNode = this.jm.find_node_before(this.selectedNode);
        // console.log(beforeNode, '前一个节点');
        if (beforeNode) {
          if (this.selectedNode.parent.id == beforeNode.parent.id) {
            this.jm.move_node(this.selectedNode, beforeNode.id);
          } else {
            this.$message.error('不能移动到其他块');
          }
        } else {
          this.$message.error('无前一节点');
        }
      } else if (i == 5) {
        //后移
        let beforeNode = this.jm.find_node_after(this.selectedNode);
        // console.log(beforeNode, '后一个节点');
        if (beforeNode) {
          if (this.selectedNode.parent.id == beforeNode.parent.id) {
            this.jm.move_node(beforeNode, this.selectedNode.id);
          } else {
            this.$message.error('不能移动到其他块');
          }
        } else {
          this.$message.error('无后一节点');
        }
      } else if (i == 6) {
        if (this.selectedNode.index == 0) {
          this.$message.error('不能删除根节点');
        } else {
          this.deleteNode();
        }
      }
      this.saveAll();
    },
    openControll() {
      //打开按键控制
      this.showControll = true;
      let str = this.transformString(this.mouseMarkDown);
      let jsMindData = this.convertToJsMindData(str);
      var randomLineColor = '#46b342';
      this.$nextTick(() => {
        this.Jsmouse = new jsmind({
          container: this.$refs.mouseContainer,
          // editable: true,
          mode: 'full',
          // 必须为'full'模式才能拖拽
          // 开启编辑模式
          editable: false,
          theme: 'primary',
          view: {
            enable_drag: true,
            // 关键：启用节点拖拽
            // hide_right_menu: true, // 禁用默认右键菜单
            hmargin: 100,
            vmargin: 50,
            line_width: 2,
            line_color: randomLineColor,
            direction: 'left',
            // 'left', 'right', 'side'
            node_width: 130,
            // 确保节点宽度足够
            expand_level: 1,
            // enable_zoom: false,
            // 启用右键菜单
            enable_contextmenu: true
          },
          shortcut: {
            enable: true,
            // 是否启用快捷键
            handles: {},
            // 命名的快捷键事件处理器
            mapping: {
              // 快捷键映射
              addchild: [45, 4096 + 13],
              // <Insert>, <Ctrl> + <Enter>
              // addbrother: 13,    // <Enter>
              editnode: 13,
              // <F2>
              delnode: 46,
              // <Delete>
              toggle: 32,
              // <Space>
              left: 37,
              // <Left>
              up: 38,
              // <Up>
              right: 39,
              // <Right>
              down: 40 // <Down>
            }
          }
        });
        this.Jsmouse.show(jsMindData);
      });
    },
    closeShowControll() {
      this.showControll = false;
      this.Jsmouse.destroy();
    }
  },
  created() {},
  mounted() {
    // 阻止浏览器默认右键事件
    document.oncontextmenu = function () {
      return false;
    };
    // // 监听回车
    document.addEventListener('keydown', e => {
      if (e.key === 'Enter') {
        console.log('回车事件触发');
        this.saveAll();
        // 执行保存操作
      }
    });
    setTimeout(() => {
      this.createXmlConversation();
    }, 1000);

    // 添加全屏变化事件监听
    document.addEventListener('fullscreenchange', this.handleFullscreenChange);
    // this.$refs.jsmindContainer.addEventListener('keydown', (e) => this.handleKeyDown(e))
    this.$EventBus.$on('setMindTarget', data => {
      console.log(data, 'xmlMind接受的跳转数据', this.selectedNode.id);
      this.updateNode(this.selectedNode.id, data);
      setTimeout(() => {
        var mind = {
          meta: {
            name: 'demo',
            author: '你',
            version: '1.0'
          },
          format: 'node_tree',
          data: this.blockData.jsMindData
        };
        var mindCopy = JSON.parse(JSON.stringify(mind));
        this.mindCopy = JSON.parse(JSON.stringify(mind));
        this.jm.show(mindCopy);
        // 获取所有节点元素并添加点击事件
        let that = this;
        this.$refs.jsmindContainer.querySelectorAll('jmnode').forEach(node => {
          if (that.mode !== 'editor') {
            node.addEventListener('dblclick', function (e) {
              e.stopPropagation(); // 阻止事件冒泡
              that.handleClick(e);

              // 获取节点ID
              const nodeId = this.getAttribute('nodeid');
              // 通过JsMind API获取节点数据
              const nodeData = that.jm.get_node(nodeId);
              if (nodeData.children.length > 0) {
                if (nodeData.expanded) {
                  that.jm.collapse_node(nodeData.id);
                } else {
                  that.jm.expand_node(nodeData.id);
                }
              }
            });
          }
          node.addEventListener('click', function (e) {
            e.stopPropagation(); // 阻止事件冒泡
            that.handleClick(e);
            // 获取节点ID
            const nodeId = this.getAttribute('nodeid');
            if (that.mode == 'editor') {
              // console.log('编辑模式及', that.jm.get_selected_node())
              that.$EventBus.$emit('xmlSelectedMindNode', {
                nodeId: nodeId,
                data: that.jm.get_data('node_tree')
              });
            } else {
              const nodeData = that.jm.get_node(nodeId);
              if (e.target.className == 'xml-custom-button') {
                console.log('点击事件触发11', nodeData);
                if (nodeData.data.linkType == '2') {
                  // 教材内跳转
                  that.$EventBus.$emit('jumpWithinTheTextbook', {
                    location: nodeData.data.link
                  });
                }
              }
            }
          });
        });
        this.saveAll();
      }, 1000);
    });
  },
  beforeDestroy() {
    // 组件销毁前移除事件监听
    document.removeEventListener('fullscreenchange', this.handleFullscreenChange);
    // 移除节点的 keydown 事件监听器
    if (this.tempEvent) {
      this.tempEvent.removeEventListener('keydown', this.currentKeyDownListener);
    }
    this.$EventBus.$off('setMindTarget');
  }
};

var __$_require_preview_page_assets_images_icons_icon_mind_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGrSURBVFiF7VddeoMgEBzW3qvmMOHjFsZb8OlhQg6m9IW1K6JCStKHdp7MF2GGZX9G4K9DlbxsjGnneW69958AoJRqAcB778LvBxE5a62rKsAY007T1DFhJvphGG4/EhAT80mbpukBgE/KkQnLuhIRuwLCpncmbpqmzw2t1vomhRDRZW9tUkBMPo7jJYf4SMieCEotZHIA/bPkABDC3/Oexpj2VEBQDWTcn9baa639mQjOnWmauvj/lQAZspwMzsU4jhfvvVNKtXEU4giwwr4WOYMrJ47CIkAqq3l6hrXWpaKwCBB1XP30MQTXtwBur68EX4Pk2lQBEblXC1nx8QO325JBUgreW86UZCN6J2QOOGBdDbXBezPXSsA7ILN/I0Ap9QDS7bI2mAsAPhYlRG6e5yLyYRiKHBW+J6NbePlhr1PVghhyq0pb5cBevz7Y9HQaCiTnzEqAjML1er2jEo5G/OYOpRtKLXiSnEf8hm9ThtZaR0Tsgjp5d6UIUVwsWeqdLFMakB2N2E0Xm1KJ2OEiJJH8AOGq4eSVNv7MTWfVcULEIUps/K9/mv3jC0PUKk7hamkhAAAAAElFTkSuQmCC";

var __$_require_preview_page_assets_images_icons_save_mind_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAD3SURBVEiJ7ZZtDoIwDIbfTm+0A4CX6TVg1+hl0ANwJeoPhy7aDYyTGMObkJB+7ElKaUfM3APo8LmCiPSlgIP3fqgAAoDWe0/jOJ5zAW5+ERESEQIQoinMtvSx/Imti5Uqwz5RLN8isApsLfCYS1bVxkpQ1YaIskBmBm4N1zEz0qbJwoioBdAa9lzKIpCYWWPQ/ZTSR04PLfmffqkgIr0Jq6UU6Jw7VWsQS2nTTNM0fBWWAAFUbP012mE77Hdg5mxcM66WZI2zF1ita8LzxDdhs1T1TESXdyFxBbWWr7RiLkuT3VKsjAn7327cFHZfnlvI4XEj+rbCFaLEeHsvYAbhAAAAAElFTkSuQmCC";

var __$_require_preview_page_assets_images_icons_close_mind_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAIWSURBVFiF7VdBdqMwDJXsuRGPdZ2bZBbwuEXCLQhezNwkzh7u0Isk6qKWKwwEO2XX/hX4Gf3vb1sSAD8dmDO5aRpzv99P4WNEw89E5BDxppRyXde5XQUwsSRMQNv3/flbAmJiInIAAFrrFgCAV9o0jXk8HizuJEK0W46sCvBBr/yulDqkWlvX9TkWsubGogAZgIictfaQQvwsztoCdDzQNI0hon/+tbXW/n2FHABgHEdXFAUCgCGiY1mWt2EY3uUcFX8k9jLpEG2h7/sznx15gxiTLZCW9X2fdUW3UNc1Acy3InaAFbZ7kjMxwNyFsEp56vdePaOqqisiGulCcEDufWrAuq7PVVVdt2dOIV0IAojoLSeIJz4hokkVwQlMIgjgbKeUcinkiGiIyPkakCxiVQBjK9tJcmvtwVp7SBXBsWVNmQnIIefxHBEx5BlwAJ+3IYc8R8RS7CQHtsiXRPikNgHfNF7sooDFdIl4g8+6sFmUWMSzOT4eAAD84QetdStywQS5NeGJUK6MQWBwoOu6cKXWzsF3ILdktRZwopCNyI5YrDMTAewCQMh0u0CsflbiZ4eQXVg7yS+Sz/Y+8MUDwzC8l2V5I6IjAJiiKHAcx9mHKfDX9+hf28vl8j+es1p2cxrLGDkN7WZb7q/mRIgP6mRbDvCVQ2Qbr7VuX2rLJRbceIoU4iwBDHaEiN7i3zJ+TiX+BeMDeBp51QwVev0AAAAASUVORK5CYII=";

var __$_require_preview_page_assets_images_icons_open_mind_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAIVSURBVFiF7VdBlpswDJXsuRGP9Tg3SRf4+RaBWxBYdG4SZw93mIsk6qKIKsaATbNr/8r42dLXty0JgH8dmLPYOWcej8dl3oxoeExEHhHvSinftq1/KwF2LB0moOm6rv4rAqFjIvIAAFrrBgCAI3XOmefzyeQuwkSzp8gqgcnojb+VUqdUaa21dUhkTY0oAWmAiHzf96cUx1t21gLQ4YRzzhDRz+mz6fv+xxHnAADjOPqiKBAADBGdy7K8D8PwLdeocJM4y6RLtIeu62q+O/IFMV6OQErWdV3WE92DtZYAlkcRKsAMm3c6Z8cASxXmKOWtf3f0jKqqbohopAqzAvLsw43W2rqqqls4vwZrbT0dZxRShZkAEX1uGUVEk0JiWnOJ2eMEJjET4GynlPLhIr7JeyRY4pzcsXiGa9mu7/vTFokU52xb1pQFgS2skTgS+YIAJwvnnFlbHCOR4zxmO0uBGImcyPmlcbBRArF0uUUCfteLLNkR8c7jDx5orRuRC5JwoEpyZfQ8MSvQtq1nWffuwRHIxLRaCzhRyEbkjYjWmRcCrALAnNHeAhH9osQvLiGrgIhmK59nOl+c/ewvnBiG4bssyzsRnQHAFEWB4zguNqZgyhHn6bO5Xq9f4ZrVspvTWIbIaWh32/Lpab4QmYx62ZYD/Mkhso3XWjeH2nKJiBqbSHGcRYDBihDRZ/hbxuNUx//B+AWQG34jJgF0tQAAAABJRU5ErkJggg==";

var __$_require_preview_page_assets_images_icons_score_mind_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAExSURBVEiJ7ZbNjcUgDIQHV0aKAdFFNl2gpJikMrOXJbL4F1zeSm9OCXLmwxCMlbX2B8COhoho894/rRgAMMbcSindCDmoBxuVc053YACwK2ttyGZB9MiBkewiVL4zs0aSUAk4vIQ9ODPfmbd4PsTM7nS2i7DX+wUS0UNE2yo0hRHRJrdIZgjv/RK0BEu3htKPZqEjMACgEEI2OAMdgQEAXde1lQIK0Crwr3hUYdFL+jUlDVsxK3/2V1/9Iznn9OixGPEj55yunR9RrvaWYewarLWh5QUAxMx3qXSltfE8zypQ3gYtL2PMnRXvEqxXkkZrr1JKZ8DRqj8NjS1GDJ6B9SYsfd8MmXkqs1SlTOVNI5f07a5Wm6gUKr0/o01MNZJxrS3MvCBauJJCCM9qjyp0/ALdlhw1Y8Z1MQAAAABJRU5ErkJggg==";

var __$_require_preview_page_assets_images_icons_load_mind_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAE0SURBVEiJ5dZPboQgFAbw76kH6RmGxG3pTaYLCbdQb6G4aU9S5gAeogeRN4tCM5lp8B81TfrtROIPnggSfLTWcpqmmogkHtMaY5of2lenAAClVOOcq4koxTOjIaVUA6D2122WZbbrOpsKqKrqg4guoUIFMz/7mSUr2x0mAVxCWxHe2VLMV2S2f8CY2Q7D8N03Wzlo4Kv8dazDHfZye28LGE0MSw7OYUnBJVgycCmWBFyD7QbXYrvALdgucAsG+M17D6qU4kiXh+0y+Yc/l9UzNMbsOsP+/gy3Jpwyh4HwJ8zhJf1HoNZaHgIyswUA59yvgWGFMrPNy7L8ZOYzACmEoHEcbSpIay1Pp9MZfoUS0TvdjCD6Y5QgrTGmyQFgHEcrhCBmBhE9pVSY2eZ5/tr3/RsAXAEXzK1ascZtGwAAAABJRU5ErkJggg==";

var __$_require_preview_page_assets_images_icons_ai_mind_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAHpSURBVEiJtVZRsoMwCFxi79X0MGa8hXoLJx5G38GU99HgUExs+t50v9oILGwAJXyAEMIAAMx8JyKffq8A0DTNCADTNK1XMegDor7GlpnXpmnGEvElYYmImVci+mHmOwBItQZjjHGoJsyQjc65tZR513V+33evfZh5nef58ZYwOS/vsv2L74nQOjjnHu8aIYe2bRcl9UHqrOG2bYckfyUDACNlLx3+Qth1ndftfnVfufMQwmCejdbmhVBXJ3OVC7rv+yIZmyT6fd8XIU0ySpz+RCi4qk5GAZVz6Zw74oQQhoNQy0lEPzlnbSMB3hHqxJn5nq1QZ6WhJU+o3j7Ac0FkCYtryexPoK5KrdhBKNnrYBq6+0oNVYK69ydhCGGQ7EvBtJxmk1TJmohXJ+2czrJb3jaLRY2sgtu2bT0RyaLNOooN8Nw+cm4qzUItdTRNM97UKPi2bRd5kKvUzmcIYcRTnR7Ayd4mO03T6qDWDxF5IvJ2k0iX2fuVhXzVaLazSR6obHyyr34lCSRJ8dNvjBgjAcBNSk0+awiBPyHR0Akmcp/+HspkB/+/MF8LL0p9hVAN+ulavkI4z/PDOffI9cBXCIGLfWwPVNNkV9zVl1sNbpkzPcwnbNt2R2HIa3CSNMY4lAYZKL+ca/ELA/lHoxt3gYcAAAAASUVORK5CYII=";

var __$_require_preview_page_assets_images_icons_mind_edit_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEJSURBVFiF7ZbBEYIwEEX/qk0wKYMtIHZiJ2IllmK4hx48bRvxojMRIa6QxAv/RHYyeW/IMiywpUCY2Wr37jODu6ZpbgBOxhgSEVdNgJm7EMI5KlmNRBaBCbhaYrXAGE5EFyLqAViNxCoBZrYhhGsM9953IuKMMaSRWCzwhN/G8Nd6RqIXkXt8zq4EfC7eezeu/SyghU/1xtR5VAs+94bUAiXgaoFScJVASfhXgdLwpEANOJD4DGvAkwJRXCm4VuAjueCLBHLCgUQTtm0boqWLnm0uOAAclPvsuJADDiSuYO7nAcAR0TEHfAsw0YS/zPRLEw8mbwKJ6TZ33DAMR+CzCV0F+Fv+fgVbHg8MBW7X83TdAAAAAElFTkSuQmCC";

var __$_require_preview_page_assets_images_icons_mind_add_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFOSURBVFiF7VdbcsMgDFx1ciPxX3wyOyczB7DOpP7glhAwz0lnMtkvGyO0SGKFgQ/eDcYYa4zZaufTTMequj8sTrQcx+Gu7G7RIpuqfvcQUNXU2AqgnoCH7SGQQXGtmIAj+suK3wGI6F5ayEcuduhKdtkaCHMqIsVamVIDI/COyJ8AF4xdYhqBgMjWMv9rNoFW/DuBqSkwxlj/aAG4l9WAF7A1EqOVmUFE96u6GE4BM++nXqSgqisz70F0HjAUAWbeUaec1kfHxR+6I+DP+5NzEaGMcCW7ZDeBq7C32FxKLDMr8NsLXPDJ5gicuz9tnxxG8lyqARc4y+44FfJwLEcGKKRARJaaTtgIG7503YhSne9Eawq6irBG4Wptu09BT2pSNkOX0gYhAgAnIks8OCTFDVFwublTruVnM0o6KDSjaf8FnoiFb8XAWLF+8DL8AIf1rORvn1vbAAAAAElFTkSuQmCC";

var __$_require_preview_page_assets_images_icons_mind_addchild_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFHSURBVFiF7VZBcoQgEOxO9hde9g9wD74s+JLNTzLe8Q85+Y3JIWohAdddzCl2lSUCQzfQAwInTvx38MjBrLUeAFT1DYADIABAsgshyJ8JsNZ6VX2/149kmwqpFrCXPIIMw9DOH6+V5E5Vbw+GXZum4TiOUiVgIv/c6CIAvgBcM21uFvHyrICtZSfZDcPQkuzuxV/iymQ/Zcu9R2ERkDGTU1VYa3NxTlVdpl6Sd1pexVhr/ZIFxhjdo7iEabV8qT3nGZLd0x44CssKFPJZCkZyub7LoGQfQvDTrFfbuiIn28UDUwB2mlCMMamAePC+RBojhCCXpMID8KWAGCS7B0/AFAJUHsUbxpWo7HId5nuh6ihumoYFgmv05Mi7EMIHUHkXjOMoGyKySNO1SkAkosfGjEvkwPE/JHHaOfxkUg8sBj9x4sSJX/gG/ZGo5DkfKcUAAAAASUVORK5CYII=";

var __$_require_preview_page_assets_images_icons_mind_addparent_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAFdSURBVFiF7ZZBdoIwFEXvV1YhE/ZA5o07sSsBVmacwx46yjZ+B00wWoIWbCflnsNByU/eC3nJATY2/juSazDGtACq+gZYwAGISNf3vfs1A8aYVlWbB/3cq4zsF4gDVMCpLEvx3q8yMRr4gXiKXWtCgrhV1XOmJh3cThUMw5DN0iN2AHMzF5FuGIajiFxyNTGwSyjC3S4dAMYJTJoIb7eJGiG8Y20RCu77uYxW+tzeCbVT/VLx+N8YQzQhU+ETkePcFlsY2BtibnZrBlmBiz+KqVZVbeq6buB68iVriara+z4i0vHEEoTaMdBF3/dtFEtIO3TJs2/CAZcGK8UYQ8iYTSY01k6+gVcSsuRy7XuAsiyF/Oyqw+FwAk65QUTk3Xv/scTgHsB772ZMVOHKic/umEfcHKF1XZ8zJnLiXW7tn+VmG4Yj9/hX4jD/QWKTw8by9Q1wAXiF8MbGxkbkE3dZrae/aTblAAAAAElFTkSuQmCC";

var __$_require_preview_page_assets_images_icons_mind_before_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADcSURBVFiF7ZaxEcIwDEW/IFtojGgAMwmjkGwSJiH0HoJKa4iGcD5DQnII0/h1VuH/TrJ9BiqVykZEJHju12wI7szsZGYAQF4Cuy3hyToUE8jDiaiPMY5eAoutnAnvvMIXBUqEzwqUCn8rUDL8RaBt2wHAMSmdiWjwDMwP8FNARIKZXTzD5iCiwySy6h3wJu1CkxZFpE/njx+MIOfvh3CfF1R1ZGYCEB6lwMykqmMRgdISbwVKSswKlJL4eA1jjB0R9dM6uyVfs9iBibwTzHxV1ZunyCq8v2OVSgUA7j3KiPpa9i7ZAAAAAElFTkSuQmCC";

var __$_require_preview_page_assets_images_icons_mind_after_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAADcSURBVFiF7ZTBDcIwDEW/YYoqY9QDhEnoJpRRmIQMkM7ALWuYCxRagbCRI4SUd0uU5L8ksoFGo+EMM0fL+q1ncNd1FwBDCIFKKUmzj7wEAKDve5kPJjrmnMdPe9xeAABCCAQg3oZR8xKuAqWUZJVwFfhGwl3AKlFFwCKxqAJrDWsQkQHAfg5cVcdC4LmMakJEu5xzAoDNfbLG7VUy6wlvkfUXADhN0zS8FfCEmUcROcxhL7pjNQFNeDUBbXgVAUu4u4A13FWAmaOInC3hrgLAo5Fpw935VTNrNP6bK3c/fJSMq8HCAAAAAElFTkSuQmCC";

var __$_require_preview_page_assets_images_icons_mind_delete_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAEgSURBVFiF7ZcxcgMhDEW/Milc5gi5A+q9e7KQky3u4Q45gouUmVEKww5mdm3AYDeoFNqvhwTDCnixUekHzKxF5LgpRnSy1upuAD75150w45ybczXfSgAykgPAxMxTruZ7bqDfPQCAiL7TUjPzJCJLBGpydNcWKKWWyP8B4HMNIjqIyCFa/9vRizf0m8SdAfx4vfWskKfP6W1TC1UMZ8A8M/kVSOqIe0lEs7XWPJLgnl7RLehhA6AYgJm1UkqYWUe+KfV1A9i6rsFXc5WrW7D3ID0NoJUNgAEwAGoADHB5z4ODiE7xWlcA59ycPqvWWk1Ec8nPaDWAT2hyfN0AWtoAuDkXiMiilHooQZgl9uzlFdicDW8NoNWJLnOAaanZxP4BOkaEOjM13UUAAAAASUVORK5CYII=";

/* script */
const __vue_script__$k = script$k;
var __vue_render__$k = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-mind",
      class: "xml-mind-container-" + _vm.pageType,
      attrs: { id: _vm.blockId },
      on: { click: _vm.blockClick },
    },
    [
      _c(
        "div",
        { staticClass: "mind-toolbar" },
        [
          _c(
            "el-button-group",
            [
              _vm.mode == "editor"
                ? _c(
                    "el-button",
                    {
                      attrs: { size: "mini" },
                      on: { click: _vm.openControll },
                    },
                    [
                      _c(
                        "el-tooltip",
                        {
                          staticClass: "item",
                          attrs: {
                            effect: "dark",
                            content: "键鼠操作",
                            placement: "bottom",
                          },
                        },
                        [
                          _c("img", {
                            attrs: {
                              src: __$_require_preview_page_assets_images_icons_icon_mind_png__,
                              alt: "",
                            },
                          }),
                        ]
                      ),
                    ],
                    1
                  )
                : _vm._e(),
              _vm._v(" "),
              _vm.mode == "editor"
                ? _c(
                    "el-button",
                    { attrs: { size: "mini" }, on: { click: _vm.saveAll } },
                    [
                      _c(
                        "el-tooltip",
                        {
                          staticClass: "item",
                          attrs: {
                            effect: "dark",
                            content: "保存",
                            placement: "bottom",
                          },
                        },
                        [
                          _c("img", {
                            attrs: {
                              src: __$_require_preview_page_assets_images_icons_save_mind_png__,
                              alt: "",
                            },
                          }),
                        ]
                      ),
                    ],
                    1
                  )
                : _vm._e(),
              _vm._v(" "),
              _c(
                "el-button",
                { attrs: { size: "mini" }, on: { click: _vm.expandAll } },
                [
                  _c(
                    "el-tooltip",
                    {
                      staticClass: "item",
                      attrs: {
                        effect: "dark",
                        content: "全部展开",
                        placement: "bottom",
                      },
                    },
                    [
                      _c("img", {
                        attrs: {
                          src: __$_require_preview_page_assets_images_icons_close_mind_png__,
                          alt: "",
                        },
                      }),
                      _vm._v("\n          全部展开\n        "),
                    ]
                  ),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "el-button",
                { attrs: { size: "mini" }, on: { click: _vm.collapseAll } },
                [
                  _c(
                    "el-tooltip",
                    {
                      staticClass: "item",
                      attrs: {
                        effect: "dark",
                        content: "全部收起",
                        placement: "bottom",
                      },
                    },
                    [
                      _c("img", {
                        attrs: {
                          src: __$_require_preview_page_assets_images_icons_open_mind_png__,
                          alt: "",
                        },
                      }),
                      _vm._v("\n          全部收起\n        "),
                    ]
                  ),
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "el-button",
                {
                  attrs: { size: "mini" },
                  on: { click: _vm.toggleFullscreen },
                },
                [
                  _c(
                    "el-tooltip",
                    {
                      staticClass: "item",
                      attrs: {
                        effect: "dark",
                        content: _vm.isFullscreen ? "退出全屏" : "全屏",
                        placement: "bottom",
                      },
                    },
                    [
                      _c("img", {
                        attrs: {
                          src: __$_require_preview_page_assets_images_icons_score_mind_png__,
                          alt: "",
                        },
                      }),
                    ]
                  ),
                ],
                1
              ),
              _vm._v(" "),
              _vm.mode == "editor"
                ? _c(
                    "el-button",
                    { staticClass: "mind-upload", attrs: { size: "mini" } },
                    [
                      _c(
                        "el-upload",
                        {
                          attrs: {
                            drag: "",
                            action: "#",
                            "auto-upload": false,
                            "show-file-list": false,
                            "on-change": _vm.handleFileChange,
                          },
                        },
                        [
                          _c(
                            "el-tooltip",
                            {
                              staticClass: "item",
                              attrs: {
                                effect: "dark",
                                content: "导入.md文件",
                                placement: "bottom",
                              },
                            },
                            [
                              _c("img", {
                                attrs: {
                                  src: __$_require_preview_page_assets_images_icons_load_mind_png__,
                                  alt: "",
                                },
                              }),
                            ]
                          ),
                        ],
                        1
                      ),
                    ],
                    1
                  )
                : _vm._e(),
              _vm._v(" "),
              _vm.mode == "editor"
                ? _c(
                    "el-button",
                    {
                      attrs: { size: "mini" },
                      on: { click: _vm.openChapterList },
                    },
                    [
                      _c(
                        "el-tooltip",
                        {
                          staticClass: "item",
                          attrs: {
                            effect: "dark",
                            content: "ai生成",
                            placement: "bottom",
                          },
                        },
                        [
                          _c("img", {
                            attrs: {
                              src: __$_require_preview_page_assets_images_icons_ai_mind_png__,
                              alt: "ai生成",
                            },
                          }),
                        ]
                      ),
                    ],
                    1
                  )
                : _vm._e(),
            ],
            1
          ),
        ],
        1
      ),
      _vm._v(" "),
      _c(
        "div",
        {
          ref: "markmapContainer",
          staticClass: "wrapper",
          style: {
            height:
              (_vm.blockData.mindHeight ? _vm.blockData.mindHeight : 300) +
              "px",
          },
        },
        [
          _c("div", {
            ref: "jsmindContainer",
            staticClass: "jsmindContainer",
            staticStyle: {
              width: "10000px",
              height: "10000px",
              position: "relative",
            },
          }),
        ]
      ),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: _vm.mode == "editor",
              expression: "mode == 'editor'",
            },
          ],
          staticClass: "mind-toolbar bottom_bar",
        },
        [
          _c(
            "div",
            {
              staticClass: "item",
              on: {
                click: function ($event) {
                  return _vm.editNode(0)
                },
              },
            },
            [
              _c(
                "el-tooltip",
                {
                  staticClass: "item",
                  attrs: { effect: "dark", content: "编辑", placement: "top" },
                },
                [
                  _c("img", {
                    attrs: {
                      src: __$_require_preview_page_assets_images_icons_mind_edit_png__,
                      alt: "",
                    },
                  }),
                ]
              ),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "line" }),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "item",
              on: {
                click: function ($event) {
                  return _vm.editNode(1)
                },
              },
            },
            [
              _c(
                "el-tooltip",
                {
                  staticClass: "item",
                  attrs: {
                    effect: "dark",
                    content: "添加同级节点",
                    placement: "top",
                  },
                },
                [
                  _c("img", {
                    attrs: {
                      src: __$_require_preview_page_assets_images_icons_mind_add_png__,
                      alt: "",
                    },
                  }),
                ]
              ),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "item",
              on: {
                click: function ($event) {
                  return _vm.editNode(2)
                },
              },
            },
            [
              _c(
                "el-tooltip",
                {
                  staticClass: "item",
                  attrs: {
                    effect: "dark",
                    content: "添加子节点",
                    placement: "top",
                  },
                },
                [
                  _c("img", {
                    attrs: {
                      src: __$_require_preview_page_assets_images_icons_mind_addchild_png__,
                      alt: "",
                    },
                  }),
                ]
              ),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "item",
              on: {
                click: function ($event) {
                  return _vm.editNode(3)
                },
              },
            },
            [
              _c(
                "el-tooltip",
                {
                  staticClass: "item",
                  attrs: {
                    effect: "dark",
                    content: "添加父节点",
                    placement: "top",
                  },
                },
                [
                  _c("img", {
                    attrs: {
                      src: __$_require_preview_page_assets_images_icons_mind_addparent_png__,
                      alt: "",
                    },
                  }),
                ]
              ),
            ],
            1
          ),
          _vm._v(" "),
          _c("div", { staticClass: "line" }),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "item",
              on: {
                click: function ($event) {
                  return _vm.editNode(4)
                },
              },
            },
            [
              _c(
                "el-tooltip",
                {
                  staticClass: "item",
                  attrs: { effect: "dark", content: "前移", placement: "top" },
                },
                [
                  _c("img", {
                    attrs: {
                      src: __$_require_preview_page_assets_images_icons_mind_before_png__,
                      alt: "",
                    },
                  }),
                ]
              ),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "item",
              on: {
                click: function ($event) {
                  return _vm.editNode(5)
                },
              },
            },
            [
              _c(
                "el-tooltip",
                {
                  staticClass: "item",
                  attrs: { effect: "dark", content: "后移", placement: "top" },
                },
                [
                  _c("img", {
                    attrs: {
                      src: __$_require_preview_page_assets_images_icons_mind_after_png__,
                      alt: "",
                    },
                  }),
                ]
              ),
            ],
            1
          ),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "item",
              on: {
                click: function ($event) {
                  return _vm.editNode(6)
                },
              },
            },
            [
              _c(
                "el-tooltip",
                {
                  staticClass: "item",
                  attrs: { effect: "dark", content: "删除", placement: "top" },
                },
                [
                  _c("img", {
                    attrs: {
                      src: __$_require_preview_page_assets_images_icons_mind_delete_png__,
                      alt: "",
                    },
                  }),
                ]
              ),
            ],
            1
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          directives: [
            {
              name: "loading",
              rawName: "v-loading",
              value: _vm.mindLoading,
              expression: "mindLoading",
            },
          ],
          attrs: {
            title: "AI生成思维导图",
            visible: _vm.openChapter,
            width: "500px",
            modal: false,
          },
          on: {
            "update:visible": function ($event) {
              _vm.openChapter = $event;
            },
            close: _vm.closeMindDia,
          },
        },
        [
          _c("el-tree", {
            ref: "tree",
            attrs: {
              data: _vm.catalogList,
              "show-checkbox": "",
              "default-expand-all": "",
              "node-key": "id",
              "highlight-current": "",
              "check-strictly": true,
              "check-on-click-node": true,
            },
          }),
          _vm._v(" "),
          _c(
            "span",
            {
              staticClass: "dialog-footer",
              attrs: { slot: "footer" },
              slot: "footer",
            },
            [
              _c(
                "el-button",
                {
                  on: {
                    click: function ($event) {
                      _vm.openChapter = false;
                    },
                  },
                },
                [_vm._v("取 消")]
              ),
              _vm._v(" "),
              _c(
                "el-button",
                { attrs: { type: "primary" }, on: { click: _vm.getMindAi } },
                [_vm._v("确 定")]
              ),
            ],
            1
          ),
        ],
        1
      ),
      _vm._v(" "),
      _c(
        "el-dialog",
        {
          attrs: {
            title: "键鼠操作",
            visible: _vm.showControll,
            width: "800px",
            modal: false,
            "append-to-body": true,
          },
          on: {
            "update:visible": function ($event) {
              _vm.showControll = $event;
            },
            close: _vm.closeShowControll,
          },
        },
        [
          _c("div", {
            ref: "mouseContainer",
            staticClass: "mouseContainer",
            staticStyle: { width: "100%", height: "500px", overflow: "hidden" },
          }),
          _vm._v(" "),
          _c(
            "span",
            {
              staticClass: "dialog-footer",
              attrs: { slot: "footer" },
              slot: "footer",
            },
            [
              _c(
                "el-button",
                {
                  on: {
                    click: function ($event) {
                      _vm.showControll = false;
                    },
                  },
                },
                [_vm._v("取 消")]
              ),
              _vm._v(" "),
              _c(
                "el-button",
                {
                  attrs: { type: "primary" },
                  on: {
                    click: function ($event) {
                      _vm.showControll = false;
                    },
                  },
                },
                [_vm._v("确 定")]
              ),
            ],
            1
          ),
        ]
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$k = [];
__vue_render__$k._withStripped = true;

  /* style */
  const __vue_inject_styles__$k = undefined;
  /* scoped */
  const __vue_scope_id__$k = undefined;
  /* module identifier */
  const __vue_module_identifier__$k = undefined;
  /* functional template */
  const __vue_is_functional_template__$k = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$k = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$k, staticRenderFns: __vue_staticRenderFns__$k },
    __vue_inject_styles__$k,
    __vue_script__$k,
    __vue_scope_id__$k,
    __vue_is_functional_template__$k,
    __vue_module_identifier__$k,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$k.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('resource-render', {
    prefix: options.prefix
  }), __vue_component__$k);
};

//

/**
 * 单图片组合
 */
var script$j = {
  name: 'XmlSingleMindGroupRender',
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    catalogList: {
      type: Array,
      default: () => []
    },
    looseLeafId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      typeText: '脑图',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      mindBlockDataName: 'mindData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {
    console.log(this.groupData, 'groupDatagroupDatagroupDatagroupData');
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    clickImg() {
      this.$emit('clickImg');
    }
  }
};

/* script */
const __vue_script__$j = script$j;

/* template */
var __vue_render__$j = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-mind-group",
        "xml-single-mind-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            pageType: _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-mind-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.mindBlockDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.mindBlockDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              "show-title": true,
              pageType: _vm.pageType,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
              "catalog-list": _vm.catalogList,
              looseLeafId: _vm.looseLeafId,
            },
            on: { blockclick: _vm.handleBlockClick, clickImg: _vm.clickImg },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$j = [];
__vue_render__$j._withStripped = true;

  /* style */
  const __vue_inject_styles__$j = undefined;
  /* scoped */
  const __vue_scope_id__$j = undefined;
  /* module identifier */
  const __vue_module_identifier__$j = undefined;
  /* functional template */
  const __vue_is_functional_template__$j = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$j = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$j, staticRenderFns: __vue_staticRenderFns__$j },
    __vue_inject_styles__$j,
    __vue_script__$j,
    __vue_scope_id__$j,
    __vue_is_functional_template__$j,
    __vue_module_identifier__$j,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$j.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-textarea-group-render', {
    prefix: options.prefix
  }), __vue_component__$j);
};

// // 表格单元格element类型
// export const cellTypeData={
//   select: {
//     renderBodyCell: ({ row, column, rowIndex }, h) => {
//       // 下拉选择单元格类型
//       return <Tableselect row={row} column={column} rowIndex={rowIndex} />
//     }
//   },
//   radio: {
//     renderBodyCell: ({ row, column, rowIndex }, h) => {
//       // 单选单元格类型
//       return <Tableradio row={row} column={column} rowIndex={rowIndex} />
//     }
//   },
//   checkbox: {
//     renderBodyCell: ({ row, column, rowIndex }, h) => {
//       // 多选单元格类型
//       return <Tablecheckbox row={row} column={column} rowIndex={rowIndex} />
//     }
//   },
//   input: {
//     renderBodyCell: ({ row, column, rowIndex }, h) => {
//       // 文本输入单元格类型
//       return <TableInput row={row} column={column} rowIndex={rowIndex} />
//     }
//   }
// }

const foods = ['apple', 'banana', 'orange', 'grape', 'strawberry', 'watermelon', 'pineapple', 'mango', 'peach', 'pear', 'kiwi', 'lemon', 'lime', 'cherry', 'blueberry', 'raspberry', 'blackberry', 'coconut', 'pomegranate', 'carrot', 'potato', 'tomato', 'cucumber', 'broccoli', 'spinach', 'lettuce', 'cabbage', 'onion', 'garlic', 'pepper', 'corn', 'pea', 'celery', 'mushroom', 'eggplant', 'pumpkin', 'sweetpotato', 'radish', 'beef', 'pork', 'chicken', 'lamb', 'turkey', 'duck', 'fish', 'salmon', 'tuna', 'shrimp', 'crab', 'lobster', 'bacon', 'ham', 'rice', 'wheat', 'oats', 'barley', 'quinoa', 'millet', 'buckwheat', 'rye', 'sorghum'];
// 生成不重复key的方法
const getUniqueFoodKey = (existingKeys = []) => {
  // 获取已存在的key值数组
  const existingKeyValues = existingKeys.map(item => item.key);

  // 1. 先找未被用过的单词
  const unusedFoods = foods.filter(food => !existingKeyValues.includes(food));
  if (unusedFoods.length > 0) {
    // 随机选一个未用过的单词
    return unusedFoods[Math.floor(Math.random() * unusedFoods.length)];
  }

  // 2. 所有单词都被用过，开始拼接数字
  for (let i = 1;; i++) {
    for (let food of foods) {
      const key = `${food}${i}`;
      if (!existingKeyValues.includes(key)) {
        return key;
      }
    }
  }
};
const contextmenuConfig = {
  tableTitleData: [{
    label: '单元格设置',
    type: 'cellSettings'
  }, {
    label: '表格',
    type: '',
    children: [{
      label: '删除选中行',
      type: 'deleteRow'
    }, {
      label: '删除选中列',
      type: 'deleteColumn'
    }, {
      label: '上方添加行',
      type: 'upAddRow'
    }, {
      label: '下方添加行',
      type: 'downAddRow'
    }, {
      label: '左侧添加列',
      type: 'letAddColumn'
    }, {
      label: '右侧添加列',
      type: 'rightAddColumn'
    }]
  }, {
    label: '合并单元格',
    type: 'mergeCell'
  }, {
    label: '单元格类型',
    type: '',
    children: [{
      label: '阅读端可输入',
      type: 'canBeInputted'
    }, {
      label: '阅读端禁止输入',
      type: 'inhibitInput'
    }
    // {
    //   label: '斜线分隔',
    //   type: 'diagonalSeparation'
    // }
    ]
  }],
  tableData: [{
    label: '单元格设置',
    type: 'cellSettings'
  }, {
    label: '表格',
    type: '',
    children: [{
      label: '删除选中行',
      type: 'deleteRow'
    }, {
      label: '删除选中列',
      type: 'deleteColumn'
    }, {
      label: '上方添加行',
      type: 'upAddRow'
    }, {
      label: '下方添加行',
      type: 'downAddRow'
    }, {
      label: '左侧添加列',
      type: 'letAddColumn'
    }, {
      label: '右侧添加列',
      type: 'rightAddColumn'
    }]
  }, {
    label: '边框',
    type: '',
    children: [{
      label: '表格边框',
      type: 'borderAround',
      className: 'active'
    }, {
      label: 'X轴边框',
      type: 'borderX'
    }, {
      label: 'Y轴边框',
      type: 'borderY'
    }]
  }, {
    label: '表注',
    type: 'addTableNote'
  }, {
    label: '合并单元格',
    type: 'mergeCell'
  }, {
    label: '单元格类型',
    type: '',
    children: [{
      label: '下拉选择',
      type: 'select'
    }, {
      label: '单选',
      type: 'radio'
    }, {
      label: '多选',
      type: 'checkbox'
    }, {
      label: '数字',
      type: 'inputNumber'
    }, {
      label: '阅读端可输入',
      type: 'canBeInputted'
    }, {
      label: '阅读端禁止输入',
      type: 'inhibitInput'
    }]
  }]
};

//
//
//
//
//
//
//
//
//
//
//
//
//

var script$i = {
  name: 'TableCellSelect',
  props: {
    row: {
      type: Object,
      required: true
    },
    column: {
      type: Object,
      required: true
    },
    rowIndex: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      value: '',
      placeholder: '请选择'
    };
  },
  computed: {
    options() {
      return this.column.eleData || [];
    }
  },
  watch: {
    value: {
      handler(val) {
        this.$emit('change', {
          row: this.row,
          column: this.column,
          value: val
        });
      }
    }
  },
  created() {
    this.value = this.row[this.column.key + 'EleValue'];
  }
};

/* script */
const __vue_script__$i = script$i;
/* template */
var __vue_render__$i = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "table-cell-select" },
    [
      _c(
        "el-select",
        {
          attrs: { placeholder: _vm.placeholder },
          model: {
            value: _vm.value,
            callback: function ($$v) {
              _vm.value = $$v;
            },
            expression: "value",
          },
        },
        _vm._l(_vm.options, function (item) {
          return _c("el-option", {
            key: item.value,
            attrs: { label: item.label, value: item.value },
          })
        }),
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$i = [];
__vue_render__$i._withStripped = true;

  /* style */
  const __vue_inject_styles__$i = undefined;
  /* scoped */
  const __vue_scope_id__$i = "data-v-5daf3f11";
  /* module identifier */
  const __vue_module_identifier__$i = undefined;
  /* functional template */
  const __vue_is_functional_template__$i = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$i = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$i, staticRenderFns: __vue_staticRenderFns__$i },
    __vue_inject_styles__$i,
    __vue_script__$i,
    __vue_scope_id__$i,
    __vue_is_functional_template__$i,
    __vue_module_identifier__$i,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//

var script$h = {
  name: 'TableCellRadio',
  props: {
    row: {
      type: Object,
      required: true
    },
    column: {
      type: Object,
      required: true
    },
    rowIndex: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      value: ''
    };
  },
  computed: {
    options() {
      return this.column.eleData || [];
    }
  },
  watch: {
    value: {
      handler(val) {
        this.$emit('change', {
          row: this.row,
          column: this.column,
          value: val
        });
      }
    }
  },
  created() {
    this.value = this.row[this.column.key + 'EleValue'];
  }
};

/* script */
const __vue_script__$h = script$h;
/* template */
var __vue_render__$h = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "table-cell-radio" },
    [
      _c(
        "el-radio-group",
        {
          model: {
            value: _vm.value,
            callback: function ($$v) {
              _vm.value = $$v;
            },
            expression: "value",
          },
        },
        _vm._l(_vm.options, function (item) {
          return _c(
            "el-radio",
            { key: item.value, attrs: { label: item.value } },
            [_vm._v("\n      " + _vm._s(item.label) + "\n    ")]
          )
        }),
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$h = [];
__vue_render__$h._withStripped = true;

  /* style */
  const __vue_inject_styles__$h = undefined;
  /* scoped */
  const __vue_scope_id__$h = "data-v-53aba01d";
  /* module identifier */
  const __vue_module_identifier__$h = undefined;
  /* functional template */
  const __vue_is_functional_template__$h = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$h = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$h, staticRenderFns: __vue_staticRenderFns__$h },
    __vue_inject_styles__$h,
    __vue_script__$h,
    __vue_scope_id__$h,
    __vue_is_functional_template__$h,
    __vue_module_identifier__$h,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//

var script$g = {
  name: 'TableCellCheckbox',
  props: {
    row: {
      type: Object,
      required: true
    },
    column: {
      type: Object,
      required: true
    },
    rowIndex: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      value: []
    };
  },
  computed: {
    options() {
      return this.column.eleData || [];
    }
  },
  watch: {
    value: {
      handler(val) {
        this.$emit('change', {
          row: this.row,
          column: this.column,
          value: val
        });
      }
    }
  },
  created() {
    this.value = this.row[this.column.key + 'EleValue'].split(',');
  }
};

/* script */
const __vue_script__$g = script$g;
/* template */
var __vue_render__$g = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "table-cell-checkbox" },
    [
      _c(
        "el-checkbox-group",
        {
          model: {
            value: _vm.value,
            callback: function ($$v) {
              _vm.value = $$v;
            },
            expression: "value",
          },
        },
        _vm._l(_vm.options, function (item) {
          return _c(
            "el-checkbox",
            { key: item.value, attrs: { label: item.value } },
            [_vm._v("\n      " + _vm._s(item.label) + "\n    ")]
          )
        }),
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$g = [];
__vue_render__$g._withStripped = true;

  /* style */
  const __vue_inject_styles__$g = undefined;
  /* scoped */
  const __vue_scope_id__$g = "data-v-25c49070";
  /* module identifier */
  const __vue_module_identifier__$g = undefined;
  /* functional template */
  const __vue_is_functional_template__$g = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$g = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$g, staticRenderFns: __vue_staticRenderFns__$g },
    __vue_inject_styles__$g,
    __vue_script__$g,
    __vue_scope_id__$g,
    __vue_is_functional_template__$g,
    __vue_module_identifier__$g,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//

var script$f = {
  name: 'TableCellInput',
  props: {
    row: {
      type: Object,
      required: true
    },
    column: {
      type: Object,
      required: true
    },
    rowIndex: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      value: '',
      placeholder: '请输入',
      inputType: 'text'
    };
  },
  watch: {
    value: {
      handler(val) {
        this.$emit('change', {
          row: this.row,
          column: this.column,
          value: val
        });
      }
    }
  },
  created() {
    this.value = this.row[this.column.field];
    // 根据单元格类型设置输入框类型
    if (this.column.cellType === 'inputNumber') {
      this.inputType = 'number';
    }
  },
  methods: {
    handleInput(val) {
      // 数字类型输入框处理
      if (this.inputType === 'number') {
        this.value = Number(val);
      }
    }
  }
};

/* script */
const __vue_script__$f = script$f;
/* template */
var __vue_render__$f = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    { staticClass: "table-cell-input" },
    [
      _c("el-input", {
        attrs: { type: _vm.inputType, placeholder: _vm.placeholder },
        on: { input: _vm.handleInput },
        model: {
          value: _vm.value,
          callback: function ($$v) {
            _vm.value = $$v;
          },
          expression: "value",
        },
      }),
    ],
    1
  )
};
var __vue_staticRenderFns__$f = [];
__vue_render__$f._withStripped = true;

  /* style */
  const __vue_inject_styles__$f = undefined;
  /* scoped */
  const __vue_scope_id__$f = "data-v-6c828a0c";
  /* module identifier */
  const __vue_module_identifier__$f = undefined;
  /* functional template */
  const __vue_is_functional_template__$f = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$f = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$f, staticRenderFns: __vue_staticRenderFns__$f },
    __vue_inject_styles__$f,
    __vue_script__$f,
    __vue_scope_id__$f,
    __vue_is_functional_template__$f,
    __vue_module_identifier__$f,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//

var script$e = {
  name: 'DiagonalSeparation',
  props: {
    row: {
      type: Object,
      required: true
    },
    column: {
      type: Object,
      required: true
    },
    rowIndex: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      value: ''
    };
  },
  watch: {
    row(val) {
      this.value = this.row[this.column.field];
    }
  },
  created() {
    this.value = this.row[this.column.field];
  },
  methods: {}
};

/* script */
const __vue_script__$e = script$e;
/* template */
var __vue_render__$e = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  _vm._self._c || _h;
  return _vm._m(0)
};
var __vue_staticRenderFns__$e = [
  function () {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "svg-diagonal-cell" }, [
      _c("div", { staticClass: "svg-top-text-box" }, [
        _c("div", { staticClass: "svg-top-text" }, [_vm._v("左上角长文左")]),
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "svg-bottom-text" }, [_vm._v("右下角长左上")]),
    ])
  },
];
__vue_render__$e._withStripped = true;

  /* style */
  const __vue_inject_styles__$e = undefined;
  /* scoped */
  const __vue_scope_id__$e = undefined;
  /* module identifier */
  const __vue_module_identifier__$e = undefined;
  /* functional template */
  const __vue_is_functional_template__$e = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$e = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$e, staticRenderFns: __vue_staticRenderFns__$e },
    __vue_inject_styles__$e,
    __vue_script__$e,
    __vue_scope_id__$e,
    __vue_is_functional_template__$e,
    __vue_module_identifier__$e,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$d = {
  name: 'DefaultCell',
  components: {
    DiagonalSeparation: __vue_component__$e
  },
  props: {
    row: {
      type: Object,
      required: true
    },
    column: {
      type: Object,
      required: true
    },
    rowIndex: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      value: ''
    };
  },
  watch: {
    row(val) {
      this.value = this.row[this.column.field];
    }
  },
  created() {
    this.value = this.row[this.column.field];
  },
  methods: {
    getClassName() {
      return this.row[this.column.key + 'Data'].className + ' ' + this.row[this.column.key + 'Data'].justification;
    },
    getStyle() {
      return this.row[this.column.key + 'Data'].style;
    },
    getCellType() {
      return this.row[this.column.key + 'Data'].cellType;
    }
  }
};

/* script */
const __vue_script__$d = script$d;

/* template */
var __vue_render__$d = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "xml-cell-view",
      class: _vm.getClassName(),
      style: _vm.getStyle(),
    },
    [
      _vm.getCellType() === "diagonalSeparation"
        ? [_c("DiagonalSeparation")]
        : [_vm._v("\n    " + _vm._s(_vm.row[_vm.column.field]) + "\n  ")],
    ],
    2
  )
};
var __vue_staticRenderFns__$d = [];
__vue_render__$d._withStripped = true;

  /* style */
  const __vue_inject_styles__$d = undefined;
  /* scoped */
  const __vue_scope_id__$d = undefined;
  /* module identifier */
  const __vue_module_identifier__$d = undefined;
  /* functional template */
  const __vue_is_functional_template__$d = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$d = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$d, staticRenderFns: __vue_staticRenderFns__$d },
    __vue_inject_styles__$d,
    __vue_script__$d,
    __vue_scope_id__$d,
    __vue_is_functional_template__$d,
    __vue_module_identifier__$d,
    false,
    undefined,
    undefined,
    undefined
  );

var vueUeditorWrap_min = createCommonjsModule(function (module, exports) {
!function (t, e) {
  module.exports = e() ;
}("undefined" != typeof self ? self : commonjsGlobal, function () {
  return function (t) {
    var e = {};
    function n(r) {
      if (e[r]) return e[r].exports;
      var o = e[r] = {
        i: r,
        l: !1,
        exports: {}
      };
      return t[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports;
    }
    return n.m = t, n.c = e, n.d = function (t, e, r) {
      n.o(t, e) || Object.defineProperty(t, e, {
        configurable: !1,
        enumerable: !0,
        get: r
      });
    }, n.n = function (t) {
      var e = t && t.__esModule ? function () {
        return t.default;
      } : function () {
        return t;
      };
      return n.d(e, "a", e), e;
    }, n.o = function (t, e) {
      return Object.prototype.hasOwnProperty.call(t, e);
    }, n.p = "", n(n.s = 40);
  }([function (t, e) {
    var n = t.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();
    "number" == typeof __g && (__g = n);
  }, function (t, e, n) {
    var r = n(28)("wks"),
      o = n(29),
      i = n(0).Symbol,
      u = "function" == typeof i;
    (t.exports = function (t) {
      return r[t] || (r[t] = u && i[t] || (u ? i : o)("Symbol." + t));
    }).store = r;
  }, function (t, e) {
    var n = t.exports = {
      version: "2.6.12"
    };
    "number" == typeof __e && (__e = n);
  }, function (t, e, n) {
    var r = n(7);
    t.exports = function (t) {
      if (!r(t)) throw TypeError(t + " is not an object!");
      return t;
    };
  }, function (t, e, n) {
    var r = n(0),
      o = n(2),
      i = n(11),
      u = n(5),
      s = n(9),
      c = function (t, e, n) {
        var a,
          f,
          l,
          d = t & c.F,
          p = t & c.G,
          h = t & c.S,
          v = t & c.P,
          y = t & c.B,
          m = t & c.W,
          _ = p ? o : o[e] || (o[e] = {}),
          g = _.prototype,
          b = p ? r : h ? r[e] : (r[e] || {}).prototype;
        for (a in p && (n = e), n) (f = !d && b && void 0 !== b[a]) && s(_, a) || (l = f ? b[a] : n[a], _[a] = p && "function" != typeof b[a] ? n[a] : y && f ? i(l, r) : m && b[a] == l ? function (t) {
          var e = function (e, n, r) {
            if (this instanceof t) {
              switch (arguments.length) {
                case 0:
                  return new t();
                case 1:
                  return new t(e);
                case 2:
                  return new t(e, n);
              }
              return new t(e, n, r);
            }
            return t.apply(this, arguments);
          };
          return e.prototype = t.prototype, e;
        }(l) : v && "function" == typeof l ? i(Function.call, l) : l, v && ((_.virtual || (_.virtual = {}))[a] = l, t & c.R && g && !g[a] && u(g, a, l)));
      };
    c.F = 1, c.G = 2, c.S = 4, c.P = 8, c.B = 16, c.W = 32, c.U = 64, c.R = 128, t.exports = c;
  }, function (t, e, n) {
    var r = n(13),
      o = n(31);
    t.exports = n(6) ? function (t, e, n) {
      return r.f(t, e, o(1, n));
    } : function (t, e, n) {
      return t[e] = n, t;
    };
  }, function (t, e, n) {
    t.exports = !n(14)(function () {
      return 7 != Object.defineProperty({}, "a", {
        get: function () {
          return 7;
        }
      }).a;
    });
  }, function (t, e) {
    t.exports = function (t) {
      return "object" == typeof t ? null !== t : "function" == typeof t;
    };
  }, function (t, e) {
    t.exports = {};
  }, function (t, e) {
    var n = {}.hasOwnProperty;
    t.exports = function (t, e) {
      return n.call(t, e);
    };
  }, function (t, e) {
    var n = {}.toString;
    t.exports = function (t) {
      return n.call(t).slice(8, -1);
    };
  }, function (t, e, n) {
    var r = n(12);
    t.exports = function (t, e, n) {
      if (r(t), void 0 === e) return t;
      switch (n) {
        case 1:
          return function (n) {
            return t.call(e, n);
          };
        case 2:
          return function (n, r) {
            return t.call(e, n, r);
          };
        case 3:
          return function (n, r, o) {
            return t.call(e, n, r, o);
          };
      }
      return function () {
        return t.apply(e, arguments);
      };
    };
  }, function (t, e) {
    t.exports = function (t) {
      if ("function" != typeof t) throw TypeError(t + " is not a function!");
      return t;
    };
  }, function (t, e, n) {
    var r = n(3),
      o = n(50),
      i = n(51),
      u = Object.defineProperty;
    e.f = n(6) ? Object.defineProperty : function (t, e, n) {
      if (r(t), e = i(e, !0), r(n), o) try {
        return u(t, e, n);
      } catch (t) {}
      if ("get" in n || "set" in n) throw TypeError("Accessors not supported!");
      return "value" in n && (t[e] = n.value), t;
    };
  }, function (t, e) {
    t.exports = function (t) {
      try {
        return !!t();
      } catch (t) {
        return !0;
      }
    };
  }, function (t, e, n) {
    var r = n(16);
    t.exports = function (t) {
      return Object(r(t));
    };
  }, function (t, e) {
    t.exports = function (t) {
      if (void 0 == t) throw TypeError("Can't call method on  " + t);
      return t;
    };
  }, function (t, e, n) {
    var r = n(46),
      o = n(30);
    t.exports = Object.keys || function (t) {
      return r(t, o);
    };
  }, function (t, e, n) {
    var r = n(26),
      o = n(16);
    t.exports = function (t) {
      return r(o(t));
    };
  }, function (t, e) {
    var n = Math.ceil,
      r = Math.floor;
    t.exports = function (t) {
      return isNaN(t = +t) ? 0 : (t > 0 ? r : n)(t);
    };
  }, function (t, e, n) {
    var r = n(28)("keys"),
      o = n(29);
    t.exports = function (t) {
      return r[t] || (r[t] = o(t));
    };
  }, function (t, e) {
    t.exports = !0;
  }, function (t, e, n) {
    var r = n(7),
      o = n(0).document,
      i = r(o) && r(o.createElement);
    t.exports = function (t) {
      return i ? o.createElement(t) : {};
    };
  }, function (t, e, n) {
    var r = n(13).f,
      o = n(9),
      i = n(1)("toStringTag");
    t.exports = function (t, e, n) {
      t && !o(t = n ? t : t.prototype, i) && r(t, i, {
        configurable: !0,
        value: e
      });
    };
  }, function (t, e, n) {

    var r = n(12);
    t.exports.f = function (t) {
      return new function (t) {
        var e, n;
        this.promise = new t(function (t, r) {
          if (void 0 !== e || void 0 !== n) throw TypeError("Bad Promise constructor");
          e = t, n = r;
        }), this.resolve = r(e), this.reject = r(n);
      }(t);
    };
  }, function (t, e, n) {

    (function (t) {
      Object.defineProperty(e, "__esModule", {
        value: !0
      });
      var r = f(n(43)),
        o = f(n(32)),
        i = f(n(79)),
        u = f(n(86)),
        s = f(n(87)),
        c = f(n(88)),
        a = f(n(89));
      function f(t) {
        return t && t.__esModule ? t : {
          default: t
        };
      }
      var l = "UN_READY",
        d = "PENDING",
        p = "READY";
      e.default = {
        name: "VueUeditorWrap",
        data: function () {
          return {
            status: l,
            defaultConfig: {
              UEDITOR_HOME_URL: void 0 !== t && t.env.BASE_URL ? t.env.BASE_URL + "UEditor/" : "/static/UEditor/"
            }
          };
        },
        props: {
          mode: {
            type: String,
            default: "observer",
            validator: function (t) {
              return -1 !== ["observer", "listener"].indexOf(t);
            }
          },
          value: {
            type: String,
            default: ""
          },
          config: {
            type: Object,
            default: function () {
              return {};
            }
          },
          init: {
            type: Function,
            default: function () {}
          },
          destroy: {
            type: Boolean,
            default: !0
          },
          name: {
            type: String,
            default: ""
          },
          observerDebounceTime: {
            type: Number,
            default: 50,
            validator: function (t) {
              return t >= 20;
            }
          },
          observerOptions: {
            type: Object,
            default: function () {
              return {
                attributes: !0,
                attributeFilter: ["src", "style", "type", "name"],
                characterData: !0,
                childList: !0,
                subtree: !0
              };
            }
          },
          forceInit: {
            type: Boolean,
            default: !1
          },
          editorId: {
            type: String
          },
          editorDependencies: Array,
          editorDependenciesChecker: Function
        },
        computed: {
          mixedConfig: function () {
            return (0, i.default)({}, this.defaultConfig, this.config);
          }
        },
        methods: {
          registerButton: function (t) {
            var e = t.name,
              n = t.icon,
              r = t.tip,
              o = t.handler,
              i = t.index,
              u = t.UE,
              s = void 0 === u ? window.UE : u;
            s.registerUI(e, function (t, e) {
              t.registerCommand(e, {
                execCommand: function () {
                  o(t, e);
                }
              });
              var i = new s.ui.Button({
                name: e,
                title: r,
                cssRules: "background-image: url(" + n + ") !important;background-size: cover;",
                onclick: function () {
                  t.execCommand(e);
                }
              });
              return t.addListener("selectionchange", function () {
                var n = t.queryCommandState(e);
                -1 === n ? (i.setDisabled(!0), i.setChecked(!1)) : (i.setDisabled(!1), i.setChecked(n));
              }), i;
            }, i, this.id);
          },
          _initEditor: function () {
            var t = this;
            this.$refs.container.id = this.id = this.editorId || "editor_" + (0, a.default)(8), this.init(), this.$emit("before-init", this.id, this.mixedConfig), this.$emit("beforeInit", this.id, this.mixedConfig), this.editor = window.UE.getEditor(this.id, this.mixedConfig), this.editor.addListener("ready", function () {
              t.status === p ? t.editor.setContent(t.value) : (t.status = p, t.$emit("ready", t.editor), t.value && t.editor.setContent(t.value)), "observer" === t.mode && window.MutationObserver ? t._observerChangeListener() : t._normalChangeListener();
            });
          },
          _loadScript: function (t) {
            return new o.default(function (e, n) {
              if (window.$loadEventBus.on(t, e), !1 === window.$loadEventBus.listeners[t].requested) {
                window.$loadEventBus.listeners[t].requested = !0;
                var r = document.createElement("script");
                r.src = t, r.onload = function () {
                  window.$loadEventBus.emit(t);
                }, r.onerror = n, document.getElementsByTagName("head")[0].appendChild(r);
              }
            });
          },
          _loadCss: function (t) {
            return new o.default(function (e, n) {
              if (window.$loadEventBus.on(t, e), !1 === window.$loadEventBus.listeners[t].requested) {
                window.$loadEventBus.listeners[t].requested = !0;
                var r = document.createElement("link");
                r.type = "text/css", r.rel = "stylesheet", r.href = t, r.onload = function () {
                  window.$loadEventBus.emit(t);
                }, r.onerror = n, document.getElementsByTagName("head")[0].appendChild(r);
              }
            });
          },
          _loadEditorDependencies: function () {
            var t = this;
            window.$loadEventBus || (window.$loadEventBus = new u.default());
            var e = ["ueditor.config.js", "ueditor.all.min.js"];
            return new o.default(function (n, i) {
              if (t.editorDependencies && t.editorDependenciesChecker && t.editorDependenciesChecker()) n();else if (!t.editorDependencies && window.UE && window.UE.getEditor && window.UEDITOR_CONFIG && 0 !== (0, r.default)(window.UEDITOR_CONFIG).length) n();else {
                var u = (t.editorDependencies || e).reduce(function (e, n) {
                    return /^((https?:)?\/\/)?[-a-zA-Z0-9]+(\.[-a-zA-Z0-9]+)+\//.test(n) || (n = (t.mixedConfig.UEDITOR_HOME_URL || "") + n), ".js" === n.slice(-3) ? e.jsLinks.push(n) : ".css" === n.slice(-4) && e.cssLinks.push(n), e;
                  }, {
                    jsLinks: [],
                    cssLinks: []
                  }),
                  s = u.jsLinks,
                  a = u.cssLinks;
                o.default.all([o.default.all(a.map(function (e) {
                  return t._loadCss(e);
                })), (0, c.default)(s.map(function (e) {
                  return function () {
                    return t._loadScript(e);
                  };
                }))]).then(function () {
                  return n();
                }).catch(i);
              }
            });
          },
          _contentChangeHandler: function () {
            this.innerValue = this.editor.getContent(), this.$emit("input", this.innerValue);
          },
          _normalChangeListener: function () {
            this.editor.addListener("contentChange", this._contentChangeHandler);
          },
          _observerChangeListener: function () {
            var t = this;
            this.observer = new MutationObserver((0, s.default)(function () {
              t.editor.document.getElementById("baidu_pastebin") || (t.innerValue = t.editor.getContent(), t.$emit("input", t.innerValue));
            }, this.observerDebounceTime)), this.observer.observe(this.editor.body, this.observerOptions);
          }
        },
        deactivated: function () {
          this.editor && this.editor.removeListener("contentChange", this._contentChangeHandler), this.observer && this.observer.disconnect();
        },
        beforeDestroy: function () {
          this.destroy && this.editor && this.editor.destroy && this.editor.destroy(), this.observer && this.observer.disconnect && this.observer.disconnect();
        },
        watch: {
          value: {
            handler: function (t) {
              var e = this;
              this.status === l ? (this.status = d, (this.forceInit || "undefined" != typeof window) && this._loadEditorDependencies().then(function () {
                e.$refs.container ? e._initEditor() : e.$nextTick(function () {
                  return e._initEditor();
                });
              }).catch(function () {
                throw new Error("[vue-ueditor-wrap] UEditor 资源加载失败！请检查资源是否存在，UEDITOR_HOME_URL 是否配置正确！");
              })) : this.status === p && (t === this.innerValue || this.editor.setContent(t || ""));
            },
            immediate: !0
          }
        }
      };
    }).call(e, n(42));
  }, function (t, e, n) {
    var r = n(10);
    t.exports = Object("z").propertyIsEnumerable(0) ? Object : function (t) {
      return "String" == r(t) ? t.split("") : Object(t);
    };
  }, function (t, e, n) {
    var r = n(19),
      o = Math.min;
    t.exports = function (t) {
      return t > 0 ? o(r(t), 9007199254740991) : 0;
    };
  }, function (t, e, n) {
    var r = n(2),
      o = n(0),
      i = o["__core-js_shared__"] || (o["__core-js_shared__"] = {});
    (t.exports = function (t, e) {
      return i[t] || (i[t] = void 0 !== e ? e : {});
    })("versions", []).push({
      version: r.version,
      mode: n(21) ? "pure" : "global",
      copyright: "© 2020 Denis Pushkarev (zloirock.ru)"
    });
  }, function (t, e) {
    var n = 0,
      r = Math.random();
    t.exports = function (t) {
      return "Symbol(".concat(void 0 === t ? "" : t, ")_", (++n + r).toString(36));
    };
  }, function (t, e) {
    t.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
  }, function (t, e) {
    t.exports = function (t, e) {
      return {
        enumerable: !(1 & t),
        configurable: !(2 & t),
        writable: !(4 & t),
        value: e
      };
    };
  }, function (t, e, n) {
    t.exports = {
      default: n(52),
      __esModule: !0
    };
  }, function (t, e, n) {

    var r = n(21),
      o = n(4),
      i = n(56),
      u = n(5),
      s = n(8),
      c = n(57),
      a = n(23),
      f = n(60),
      l = n(1)("iterator"),
      d = !([].keys && "next" in [].keys()),
      p = function () {
        return this;
      };
    t.exports = function (t, e, n, h, v, y, m) {
      c(n, e, h);
      var _,
        g,
        b,
        x = function (t) {
          if (!d && t in j) return j[t];
          switch (t) {
            case "keys":
            case "values":
              return function () {
                return new n(this, t);
              };
          }
          return function () {
            return new n(this, t);
          };
        },
        w = e + " Iterator",
        E = "values" == v,
        O = !1,
        j = t.prototype,
        T = j[l] || j["@@iterator"] || v && j[v],
        S = T || x(v),
        C = v ? E ? x("entries") : S : void 0,
        L = "Array" == e && j.entries || T;
      if (L && (b = f(L.call(new t()))) !== Object.prototype && b.next && (a(b, w, !0), r || "function" == typeof b[l] || u(b, l, p)), E && T && "values" !== T.name && (O = !0, S = function () {
        return T.call(this);
      }), r && !m || !d && !O && j[l] || u(j, l, S), s[e] = S, s[w] = p, v) if (_ = {
        values: E ? S : x("values"),
        keys: y ? S : x("keys"),
        entries: C
      }, m) for (g in _) g in j || i(j, g, _[g]);else o(o.P + o.F * (d || O), e, _);
      return _;
    };
  }, function (t, e, n) {
    var r = n(0).document;
    t.exports = r && r.documentElement;
  }, function (t, e, n) {
    var r = n(10),
      o = n(1)("toStringTag"),
      i = "Arguments" == r(function () {
        return arguments;
      }());
    t.exports = function (t) {
      var e, n, u;
      return void 0 === t ? "Undefined" : null === t ? "Null" : "string" == typeof (n = function (t, e) {
        try {
          return t[e];
        } catch (t) {}
      }(e = Object(t), o)) ? n : i ? r(e) : "Object" == (u = r(e)) && "function" == typeof e.callee ? "Arguments" : u;
    };
  }, function (t, e, n) {
    var r = n(3),
      o = n(12),
      i = n(1)("species");
    t.exports = function (t, e) {
      var n,
        u = r(t).constructor;
      return void 0 === u || void 0 == (n = r(u)[i]) ? e : o(n);
    };
  }, function (t, e, n) {
    var r,
      o,
      i,
      u = n(11),
      s = n(71),
      c = n(34),
      a = n(22),
      f = n(0),
      l = f.process,
      d = f.setImmediate,
      p = f.clearImmediate,
      h = f.MessageChannel,
      v = f.Dispatch,
      y = 0,
      m = {},
      _ = function () {
        var t = +this;
        if (m.hasOwnProperty(t)) {
          var e = m[t];
          delete m[t], e();
        }
      },
      g = function (t) {
        _.call(t.data);
      };
    d && p || (d = function (t) {
      for (var e = [], n = 1; arguments.length > n;) e.push(arguments[n++]);
      return m[++y] = function () {
        s("function" == typeof t ? t : Function(t), e);
      }, r(y), y;
    }, p = function (t) {
      delete m[t];
    }, "process" == n(10)(l) ? r = function (t) {
      l.nextTick(u(_, t, 1));
    } : v && v.now ? r = function (t) {
      v.now(u(_, t, 1));
    } : h ? (i = (o = new h()).port2, o.port1.onmessage = g, r = u(i.postMessage, i, 1)) : f.addEventListener && "function" == typeof postMessage && !f.importScripts ? (r = function (t) {
      f.postMessage(t + "", "*");
    }, f.addEventListener("message", g, !1)) : r = "onreadystatechange" in a("script") ? function (t) {
      c.appendChild(a("script")).onreadystatechange = function () {
        c.removeChild(this), _.call(t);
      };
    } : function (t) {
      setTimeout(u(_, t, 1), 0);
    }), t.exports = {
      set: d,
      clear: p
    };
  }, function (t, e) {
    t.exports = function (t) {
      try {
        return {
          e: !1,
          v: t()
        };
      } catch (t) {
        return {
          e: !0,
          v: t
        };
      }
    };
  }, function (t, e, n) {
    var r = n(3),
      o = n(7),
      i = n(24);
    t.exports = function (t, e) {
      if (r(t), o(e) && e.constructor === t) return e;
      var n = i.f(t);
      return (0, n.resolve)(e), n.promise;
    };
  }, function (t, e, n) {

    Object.defineProperty(e, "__esModule", {
      value: !0
    });
    var r = n(25),
      o = n.n(r);
    for (var i in r) "default" !== i && function (t) {
      n.d(e, t, function () {
        return r[t];
      });
    }(i);
    var u = n(90),
      s = n(41)(o.a, u.a, !1, null, null, null);
    s.options.__file = "src/components/vue-ueditor-wrap.vue", e.default = s.exports;
  }, function (t, e) {
    t.exports = function (t, e, n, r, o, i) {
      var u,
        s = t = t || {},
        c = typeof t.default;
      "object" !== c && "function" !== c || (u = t, s = t.default);
      var a,
        f = "function" == typeof s ? s.options : s;
      if (e && (f.render = e.render, f.staticRenderFns = e.staticRenderFns, f._compiled = !0), n && (f.functional = !0), o && (f._scopeId = o), i ? (a = function (t) {
        (t = t || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) || "undefined" == typeof __VUE_SSR_CONTEXT__ || (t = __VUE_SSR_CONTEXT__), r && r.call(this, t), t && t._registeredComponents && t._registeredComponents.add(i);
      }, f._ssrRegister = a) : r && (a = r), a) {
        var l = f.functional,
          d = l ? f.render : f.beforeCreate;
        l ? (f._injectStyles = a, f.render = function (t, e) {
          return a.call(e), d(t, e);
        }) : f.beforeCreate = d ? [].concat(d, a) : [a];
      }
      return {
        esModule: u,
        exports: s,
        options: f
      };
    };
  }, function (t, e) {
    var n,
      r,
      o = t.exports = {};
    function i() {
      throw new Error("setTimeout has not been defined");
    }
    function u() {
      throw new Error("clearTimeout has not been defined");
    }
    function s(t) {
      if (n === setTimeout) return setTimeout(t, 0);
      if ((n === i || !n) && setTimeout) return n = setTimeout, setTimeout(t, 0);
      try {
        return n(t, 0);
      } catch (e) {
        try {
          return n.call(null, t, 0);
        } catch (e) {
          return n.call(this, t, 0);
        }
      }
    }
    !function () {
      try {
        n = "function" == typeof setTimeout ? setTimeout : i;
      } catch (t) {
        n = i;
      }
      try {
        r = "function" == typeof clearTimeout ? clearTimeout : u;
      } catch (t) {
        r = u;
      }
    }();
    var c,
      a = [],
      f = !1,
      l = -1;
    function d() {
      f && c && (f = !1, c.length ? a = c.concat(a) : l = -1, a.length && p());
    }
    function p() {
      if (!f) {
        var t = s(d);
        f = !0;
        for (var e = a.length; e;) {
          for (c = a, a = []; ++l < e;) c && c[l].run();
          l = -1, e = a.length;
        }
        c = null, f = !1, function (t) {
          if (r === clearTimeout) return clearTimeout(t);
          if ((r === u || !r) && clearTimeout) return r = clearTimeout, clearTimeout(t);
          try {
            r(t);
          } catch (e) {
            try {
              return r.call(null, t);
            } catch (e) {
              return r.call(this, t);
            }
          }
        }(t);
      }
    }
    function h(t, e) {
      this.fun = t, this.array = e;
    }
    function v() {}
    o.nextTick = function (t) {
      var e = new Array(arguments.length - 1);
      if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
      a.push(new h(t, e)), 1 !== a.length || f || s(p);
    }, h.prototype.run = function () {
      this.fun.apply(null, this.array);
    }, o.title = "browser", o.browser = !0, o.env = {}, o.argv = [], o.version = "", o.versions = {}, o.on = v, o.addListener = v, o.once = v, o.off = v, o.removeListener = v, o.removeAllListeners = v, o.emit = v, o.prependListener = v, o.prependOnceListener = v, o.listeners = function (t) {
      return [];
    }, o.binding = function (t) {
      throw new Error("process.binding is not supported");
    }, o.cwd = function () {
      return "/";
    }, o.chdir = function (t) {
      throw new Error("process.chdir is not supported");
    }, o.umask = function () {
      return 0;
    };
  }, function (t, e, n) {
    t.exports = {
      default: n(44),
      __esModule: !0
    };
  }, function (t, e, n) {
    n(45), t.exports = n(2).Object.keys;
  }, function (t, e, n) {
    var r = n(15),
      o = n(17);
    n(49)("keys", function () {
      return function (t) {
        return o(r(t));
      };
    });
  }, function (t, e, n) {
    var r = n(9),
      o = n(18),
      i = n(47)(!1),
      u = n(20)("IE_PROTO");
    t.exports = function (t, e) {
      var n,
        s = o(t),
        c = 0,
        a = [];
      for (n in s) n != u && r(s, n) && a.push(n);
      for (; e.length > c;) r(s, n = e[c++]) && (~i(a, n) || a.push(n));
      return a;
    };
  }, function (t, e, n) {
    var r = n(18),
      o = n(27),
      i = n(48);
    t.exports = function (t) {
      return function (e, n, u) {
        var s,
          c = r(e),
          a = o(c.length),
          f = i(u, a);
        if (t && n != n) {
          for (; a > f;) if ((s = c[f++]) != s) return !0;
        } else for (; a > f; f++) if ((t || f in c) && c[f] === n) return t || f || 0;
        return !t && -1;
      };
    };
  }, function (t, e, n) {
    var r = n(19),
      o = Math.max,
      i = Math.min;
    t.exports = function (t, e) {
      return (t = r(t)) < 0 ? o(t + e, 0) : i(t, e);
    };
  }, function (t, e, n) {
    var r = n(4),
      o = n(2),
      i = n(14);
    t.exports = function (t, e) {
      var n = (o.Object || {})[t] || Object[t],
        u = {};
      u[t] = e(n), r(r.S + r.F * i(function () {
        n(1);
      }), "Object", u);
    };
  }, function (t, e, n) {
    t.exports = !n(6) && !n(14)(function () {
      return 7 != Object.defineProperty(n(22)("div"), "a", {
        get: function () {
          return 7;
        }
      }).a;
    });
  }, function (t, e, n) {
    var r = n(7);
    t.exports = function (t, e) {
      if (!r(t)) return t;
      var n, o;
      if (e && "function" == typeof (n = t.toString) && !r(o = n.call(t))) return o;
      if ("function" == typeof (n = t.valueOf) && !r(o = n.call(t))) return o;
      if (!e && "function" == typeof (n = t.toString) && !r(o = n.call(t))) return o;
      throw TypeError("Can't convert object to primitive value");
    };
  }, function (t, e, n) {
    n(53), n(54), n(61), n(65), n(77), n(78), t.exports = n(2).Promise;
  }, function (t, e) {}, function (t, e, n) {

    var r = n(55)(!0);
    n(33)(String, "String", function (t) {
      this._t = String(t), this._i = 0;
    }, function () {
      var t,
        e = this._t,
        n = this._i;
      return n >= e.length ? {
        value: void 0,
        done: !0
      } : (t = r(e, n), this._i += t.length, {
        value: t,
        done: !1
      });
    });
  }, function (t, e, n) {
    var r = n(19),
      o = n(16);
    t.exports = function (t) {
      return function (e, n) {
        var i,
          u,
          s = String(o(e)),
          c = r(n),
          a = s.length;
        return c < 0 || c >= a ? t ? "" : void 0 : (i = s.charCodeAt(c)) < 55296 || i > 56319 || c + 1 === a || (u = s.charCodeAt(c + 1)) < 56320 || u > 57343 ? t ? s.charAt(c) : i : t ? s.slice(c, c + 2) : u - 56320 + (i - 55296 << 10) + 65536;
      };
    };
  }, function (t, e, n) {
    t.exports = n(5);
  }, function (t, e, n) {

    var r = n(58),
      o = n(31),
      i = n(23),
      u = {};
    n(5)(u, n(1)("iterator"), function () {
      return this;
    }), t.exports = function (t, e, n) {
      t.prototype = r(u, {
        next: o(1, n)
      }), i(t, e + " Iterator");
    };
  }, function (t, e, n) {
    var r = n(3),
      o = n(59),
      i = n(30),
      u = n(20)("IE_PROTO"),
      s = function () {},
      c = function () {
        var t,
          e = n(22)("iframe"),
          r = i.length;
        for (e.style.display = "none", n(34).appendChild(e), e.src = "javascript:", (t = e.contentWindow.document).open(), t.write("<script>document.F=Object<\/script>"), t.close(), c = t.F; r--;) delete c.prototype[i[r]];
        return c();
      };
    t.exports = Object.create || function (t, e) {
      var n;
      return null !== t ? (s.prototype = r(t), n = new s(), s.prototype = null, n[u] = t) : n = c(), void 0 === e ? n : o(n, e);
    };
  }, function (t, e, n) {
    var r = n(13),
      o = n(3),
      i = n(17);
    t.exports = n(6) ? Object.defineProperties : function (t, e) {
      o(t);
      for (var n, u = i(e), s = u.length, c = 0; s > c;) r.f(t, n = u[c++], e[n]);
      return t;
    };
  }, function (t, e, n) {
    var r = n(9),
      o = n(15),
      i = n(20)("IE_PROTO"),
      u = Object.prototype;
    t.exports = Object.getPrototypeOf || function (t) {
      return t = o(t), r(t, i) ? t[i] : "function" == typeof t.constructor && t instanceof t.constructor ? t.constructor.prototype : t instanceof Object ? u : null;
    };
  }, function (t, e, n) {
    n(62);
    for (var r = n(0), o = n(5), i = n(8), u = n(1)("toStringTag"), s = "CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","), c = 0; c < s.length; c++) {
      var a = s[c],
        f = r[a],
        l = f && f.prototype;
      l && !l[u] && o(l, u, a), i[a] = i.Array;
    }
  }, function (t, e, n) {

    var r = n(63),
      o = n(64),
      i = n(8),
      u = n(18);
    t.exports = n(33)(Array, "Array", function (t, e) {
      this._t = u(t), this._i = 0, this._k = e;
    }, function () {
      var t = this._t,
        e = this._k,
        n = this._i++;
      return !t || n >= t.length ? (this._t = void 0, o(1)) : o(0, "keys" == e ? n : "values" == e ? t[n] : [n, t[n]]);
    }, "values"), i.Arguments = i.Array, r("keys"), r("values"), r("entries");
  }, function (t, e) {
    t.exports = function () {};
  }, function (t, e) {
    t.exports = function (t, e) {
      return {
        value: e,
        done: !!t
      };
    };
  }, function (t, e, n) {

    var r,
      o,
      i,
      u,
      s = n(21),
      c = n(0),
      a = n(11),
      f = n(35),
      l = n(4),
      d = n(7),
      p = n(12),
      h = n(66),
      v = n(67),
      y = n(36),
      m = n(37).set,
      _ = n(72)(),
      g = n(24),
      b = n(38),
      x = n(73),
      w = n(39),
      E = c.TypeError,
      O = c.process,
      j = O && O.versions,
      T = j && j.v8 || "",
      S = c.Promise,
      C = "process" == f(O),
      L = function () {},
      P = o = g.f,
      M = !!function () {
        try {
          var t = S.resolve(1),
            e = (t.constructor = {})[n(1)("species")] = function (t) {
              t(L, L);
            };
          return (C || "function" == typeof PromiseRejectionEvent) && t.then(L) instanceof e && 0 !== T.indexOf("6.6") && -1 === x.indexOf("Chrome/66");
        } catch (t) {}
      }(),
      k = function (t) {
        var e;
        return !(!d(t) || "function" != typeof (e = t.then)) && e;
      },
      R = function (t, e) {
        if (!t._n) {
          t._n = !0;
          var n = t._c;
          _(function () {
            for (var r = t._v, o = 1 == t._s, i = 0, u = function (e) {
                var n,
                  i,
                  u,
                  s = o ? e.ok : e.fail,
                  c = e.resolve,
                  a = e.reject,
                  f = e.domain;
                try {
                  s ? (o || (2 == t._h && U(t), t._h = 1), !0 === s ? n = r : (f && f.enter(), n = s(r), f && (f.exit(), u = !0)), n === e.promise ? a(E("Promise-chain cycle")) : (i = k(n)) ? i.call(n, c, a) : c(n)) : a(r);
                } catch (t) {
                  f && !u && f.exit(), a(t);
                }
              }; n.length > i;) u(n[i++]);
            t._c = [], t._n = !1, e && !t._h && D(t);
          });
        }
      },
      D = function (t) {
        m.call(c, function () {
          var e,
            n,
            r,
            o = t._v,
            i = A(t);
          if (i && (e = b(function () {
            C ? O.emit("unhandledRejection", o, t) : (n = c.onunhandledrejection) ? n({
              promise: t,
              reason: o
            }) : (r = c.console) && r.error && r.error("Unhandled promise rejection", o);
          }), t._h = C || A(t) ? 2 : 1), t._a = void 0, i && e.e) throw e.v;
        });
      },
      A = function (t) {
        return 1 !== t._h && 0 === (t._a || t._c).length;
      },
      U = function (t) {
        m.call(c, function () {
          var e;
          C ? O.emit("rejectionHandled", t) : (e = c.onrejectionhandled) && e({
            promise: t,
            reason: t._v
          });
        });
      },
      I = function (t) {
        var e = this;
        e._d || (e._d = !0, (e = e._w || e)._v = t, e._s = 2, e._a || (e._a = e._c.slice()), R(e, !0));
      },
      B = function (t) {
        var e,
          n = this;
        if (!n._d) {
          n._d = !0, n = n._w || n;
          try {
            if (n === t) throw E("Promise can't be resolved itself");
            (e = k(t)) ? _(function () {
              var r = {
                _w: n,
                _d: !1
              };
              try {
                e.call(t, a(B, r, 1), a(I, r, 1));
              } catch (t) {
                I.call(r, t);
              }
            }) : (n._v = t, n._s = 1, R(n, !1));
          } catch (t) {
            I.call({
              _w: n,
              _d: !1
            }, t);
          }
        }
      };
    M || (S = function (t) {
      h(this, S, "Promise", "_h"), p(t), r.call(this);
      try {
        t(a(B, this, 1), a(I, this, 1));
      } catch (t) {
        I.call(this, t);
      }
    }, (r = function (t) {
      this._c = [], this._a = void 0, this._s = 0, this._d = !1, this._v = void 0, this._h = 0, this._n = !1;
    }).prototype = n(74)(S.prototype, {
      then: function (t, e) {
        var n = P(y(this, S));
        return n.ok = "function" != typeof t || t, n.fail = "function" == typeof e && e, n.domain = C ? O.domain : void 0, this._c.push(n), this._a && this._a.push(n), this._s && R(this, !1), n.promise;
      },
      catch: function (t) {
        return this.then(void 0, t);
      }
    }), i = function () {
      var t = new r();
      this.promise = t, this.resolve = a(B, t, 1), this.reject = a(I, t, 1);
    }, g.f = P = function (t) {
      return t === S || t === u ? new i(t) : o(t);
    }), l(l.G + l.W + l.F * !M, {
      Promise: S
    }), n(23)(S, "Promise"), n(75)("Promise"), u = n(2).Promise, l(l.S + l.F * !M, "Promise", {
      reject: function (t) {
        var e = P(this);
        return (0, e.reject)(t), e.promise;
      }
    }), l(l.S + l.F * (s || !M), "Promise", {
      resolve: function (t) {
        return w(s && this === u ? S : this, t);
      }
    }), l(l.S + l.F * !(M && n(76)(function (t) {
      S.all(t).catch(L);
    })), "Promise", {
      all: function (t) {
        var e = this,
          n = P(e),
          r = n.resolve,
          o = n.reject,
          i = b(function () {
            var n = [],
              i = 0,
              u = 1;
            v(t, !1, function (t) {
              var s = i++,
                c = !1;
              n.push(void 0), u++, e.resolve(t).then(function (t) {
                c || (c = !0, n[s] = t, --u || r(n));
              }, o);
            }), --u || r(n);
          });
        return i.e && o(i.v), n.promise;
      },
      race: function (t) {
        var e = this,
          n = P(e),
          r = n.reject,
          o = b(function () {
            v(t, !1, function (t) {
              e.resolve(t).then(n.resolve, r);
            });
          });
        return o.e && r(o.v), n.promise;
      }
    });
  }, function (t, e) {
    t.exports = function (t, e, n, r) {
      if (!(t instanceof e) || void 0 !== r && r in t) throw TypeError(n + ": incorrect invocation!");
      return t;
    };
  }, function (t, e, n) {
    var r = n(11),
      o = n(68),
      i = n(69),
      u = n(3),
      s = n(27),
      c = n(70),
      a = {},
      f = {};
    (e = t.exports = function (t, e, n, l, d) {
      var p,
        h,
        v,
        y,
        m = d ? function () {
          return t;
        } : c(t),
        _ = r(n, l, e ? 2 : 1),
        g = 0;
      if ("function" != typeof m) throw TypeError(t + " is not iterable!");
      if (i(m)) {
        for (p = s(t.length); p > g; g++) if ((y = e ? _(u(h = t[g])[0], h[1]) : _(t[g])) === a || y === f) return y;
      } else for (v = m.call(t); !(h = v.next()).done;) if ((y = o(v, _, h.value, e)) === a || y === f) return y;
    }).BREAK = a, e.RETURN = f;
  }, function (t, e, n) {
    var r = n(3);
    t.exports = function (t, e, n, o) {
      try {
        return o ? e(r(n)[0], n[1]) : e(n);
      } catch (e) {
        var i = t.return;
        throw void 0 !== i && r(i.call(t)), e;
      }
    };
  }, function (t, e, n) {
    var r = n(8),
      o = n(1)("iterator"),
      i = Array.prototype;
    t.exports = function (t) {
      return void 0 !== t && (r.Array === t || i[o] === t);
    };
  }, function (t, e, n) {
    var r = n(35),
      o = n(1)("iterator"),
      i = n(8);
    t.exports = n(2).getIteratorMethod = function (t) {
      if (void 0 != t) return t[o] || t["@@iterator"] || i[r(t)];
    };
  }, function (t, e) {
    t.exports = function (t, e, n) {
      var r = void 0 === n;
      switch (e.length) {
        case 0:
          return r ? t() : t.call(n);
        case 1:
          return r ? t(e[0]) : t.call(n, e[0]);
        case 2:
          return r ? t(e[0], e[1]) : t.call(n, e[0], e[1]);
        case 3:
          return r ? t(e[0], e[1], e[2]) : t.call(n, e[0], e[1], e[2]);
        case 4:
          return r ? t(e[0], e[1], e[2], e[3]) : t.call(n, e[0], e[1], e[2], e[3]);
      }
      return t.apply(n, e);
    };
  }, function (t, e, n) {
    var r = n(0),
      o = n(37).set,
      i = r.MutationObserver || r.WebKitMutationObserver,
      u = r.process,
      s = r.Promise,
      c = "process" == n(10)(u);
    t.exports = function () {
      var t,
        e,
        n,
        a = function () {
          var r, o;
          for (c && (r = u.domain) && r.exit(); t;) {
            o = t.fn, t = t.next;
            try {
              o();
            } catch (r) {
              throw t ? n() : e = void 0, r;
            }
          }
          e = void 0, r && r.enter();
        };
      if (c) n = function () {
        u.nextTick(a);
      };else if (!i || r.navigator && r.navigator.standalone) {
        if (s && s.resolve) {
          var f = s.resolve(void 0);
          n = function () {
            f.then(a);
          };
        } else n = function () {
          o.call(r, a);
        };
      } else {
        var l = !0,
          d = document.createTextNode("");
        new i(a).observe(d, {
          characterData: !0
        }), n = function () {
          d.data = l = !l;
        };
      }
      return function (r) {
        var o = {
          fn: r,
          next: void 0
        };
        e && (e.next = o), t || (t = o, n()), e = o;
      };
    };
  }, function (t, e, n) {
    var r = n(0).navigator;
    t.exports = r && r.userAgent || "";
  }, function (t, e, n) {
    var r = n(5);
    t.exports = function (t, e, n) {
      for (var o in e) n && t[o] ? t[o] = e[o] : r(t, o, e[o]);
      return t;
    };
  }, function (t, e, n) {

    var r = n(0),
      o = n(2),
      i = n(13),
      u = n(6),
      s = n(1)("species");
    t.exports = function (t) {
      var e = "function" == typeof o[t] ? o[t] : r[t];
      u && e && !e[s] && i.f(e, s, {
        configurable: !0,
        get: function () {
          return this;
        }
      });
    };
  }, function (t, e, n) {
    var r = n(1)("iterator"),
      o = !1;
    try {
      var i = [7][r]();
      i.return = function () {
        o = !0;
      }, Array.from(i, function () {
        throw 2;
      });
    } catch (t) {}
    t.exports = function (t, e) {
      if (!e && !o) return !1;
      var n = !1;
      try {
        var i = [7],
          u = i[r]();
        u.next = function () {
          return {
            done: n = !0
          };
        }, i[r] = function () {
          return u;
        }, t(i);
      } catch (t) {}
      return n;
    };
  }, function (t, e, n) {

    var r = n(4),
      o = n(2),
      i = n(0),
      u = n(36),
      s = n(39);
    r(r.P + r.R, "Promise", {
      finally: function (t) {
        var e = u(this, o.Promise || i.Promise),
          n = "function" == typeof t;
        return this.then(n ? function (n) {
          return s(e, t()).then(function () {
            return n;
          });
        } : t, n ? function (n) {
          return s(e, t()).then(function () {
            throw n;
          });
        } : t);
      }
    });
  }, function (t, e, n) {

    var r = n(4),
      o = n(24),
      i = n(38);
    r(r.S, "Promise", {
      try: function (t) {
        var e = o.f(this),
          n = i(t);
        return (n.e ? e.reject : e.resolve)(n.v), e.promise;
      }
    });
  }, function (t, e, n) {

    e.__esModule = !0;
    var r,
      o = n(80),
      i = (r = o) && r.__esModule ? r : {
        default: r
      };
    e.default = i.default || function (t) {
      for (var e = 1; e < arguments.length; e++) {
        var n = arguments[e];
        for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
      }
      return t;
    };
  }, function (t, e, n) {
    t.exports = {
      default: n(81),
      __esModule: !0
    };
  }, function (t, e, n) {
    n(82), t.exports = n(2).Object.assign;
  }, function (t, e, n) {
    var r = n(4);
    r(r.S + r.F, "Object", {
      assign: n(83)
    });
  }, function (t, e, n) {

    var r = n(6),
      o = n(17),
      i = n(84),
      u = n(85),
      s = n(15),
      c = n(26),
      a = Object.assign;
    t.exports = !a || n(14)(function () {
      var t = {},
        e = {},
        n = Symbol(),
        r = "abcdefghijklmnopqrst";
      return t[n] = 7, r.split("").forEach(function (t) {
        e[t] = t;
      }), 7 != a({}, t)[n] || Object.keys(a({}, e)).join("") != r;
    }) ? function (t, e) {
      for (var n = s(t), a = arguments.length, f = 1, l = i.f, d = u.f; a > f;) for (var p, h = c(arguments[f++]), v = l ? o(h).concat(l(h)) : o(h), y = v.length, m = 0; y > m;) p = v[m++], r && !d.call(h, p) || (n[p] = h[p]);
      return n;
    } : a;
  }, function (t, e) {
    e.f = Object.getOwnPropertySymbols;
  }, function (t, e) {
    e.f = {}.propertyIsEnumerable;
  }, function (t, e, n) {

    Object.defineProperty(e, "__esModule", {
      value: !0
    }), e.default = function () {
      this.listeners = {}, this.on = function (t, e) {
        void 0 === this.listeners[t] && (this.listeners[t] = {
          triggered: !1,
          requested: !1,
          cbs: []
        }), this.listeners[t].triggered && e(), this.listeners[t].cbs.push(e);
      }, this.emit = function (t) {
        this.listeners[t] && (this.listeners[t].triggered = !0, this.listeners[t].cbs.forEach(function (t) {
          return t();
        }));
      };
    };
  }, function (t, e, n) {

    Object.defineProperty(e, "__esModule", {
      value: !0
    }), e.default = function (t, e) {
      var n = null;
      return function () {
        var r = this,
          o = arguments;
        n && clearTimeout(n), n = setTimeout(function () {
          t.apply(r, o);
        }, e);
      };
    };
  }, function (t, e, n) {

    Object.defineProperty(e, "__esModule", {
      value: !0
    });
    var r,
      o = n(32),
      i = (r = o) && r.__esModule ? r : {
        default: r
      };
    e.default = function (t) {
      return t.reduce(function (t, e) {
        return t.then(e);
      }, i.default.resolve());
    };
  }, function (t, e, n) {

    Object.defineProperty(e, "__esModule", {
      value: !0
    }), e.default = function (t) {
      for (var e = "abcdefghijklmnopqrstuvwxyz", n = "", r = 0; r < t; r++) n += e.charAt(Math.floor(Math.random() * e.length));
      return n;
    };
  }, function (t, e, n) {

    var r = function () {
      var t = this.$createElement,
        e = this._self._c || t;
      return e("div", [e("div", {
        ref: "container",
        attrs: {
          name: this.name
        }
      })]);
    };
    r._withStripped = !0;
    var o = {
      render: r,
      staticRenderFns: []
    };
    e.a = o;
  }]).default;
});
});

var VueUeditorWrap = unwrapExports(vueUeditorWrap_min);
vueUeditorWrap_min.VueUeditorWrap;

const baseToolbars = [["undo",
// 撤销
"redo",
// 重做
"|", "removeformat",
// 清除格式
"cleardoc",
// 清空文档
"selectall",
// 全选
"|", "fontfamily",
// 字体
"fontsize",
// 字号
"|", "forecolor",
// 字体颜色
"backcolor",
// 背景色
"bold",
// 加粗
"italic",
// 斜体
"underline",
// 下划线
"strikethrough" // 删除线
]];

let ENV_VAR = {
  VUE_APP_BASE_API: '',
  // 数字教材系统接口地址
  VUE_APP_OUCHN_API: '',
  // 试卷系统接口地址
  VUE_APP_TESTPAPER_WEB: '',
  // 试卷系统前台访问地址
  VUE_APP_UPLOAD_API: '',
  // 文件上传地址
  VUE_APP_DEFAULT_COVER_PATH: '',
  // 数字教材系统默认封面地址
  VUE_APP_TEXTBOOK_WEB: '',
  // 数字教材前台访问地址
  VUE_APP_ENV: process.env.VUE_APP_ENV,
  // 当前环境
  VUE_APP_GENERATE_PDF: '',
  //PDF生成 node服务地址
  VUE_APP_API_JIURUI: '' //九瑞API地址
};
if (process.env.VUE_APP_ENV === "trends") {
  // 使用打包后可动态修改配置的接口信息
  ENV_VAR.VUE_APP_BASE_API = window.global.VUE_APP_BASE_API;
  ENV_VAR.VUE_APP_OUCHN_API = window.global.VUE_APP_OUCHN_API;
  ENV_VAR.VUE_APP_TESTPAPER_WEB = window.global.VUE_APP_TESTPAPER_WEB;
  ENV_VAR.VUE_APP_UPLOAD_API = window.global.VUE_APP_UPLOAD_API;
  ENV_VAR.VUE_APP_DEFAULT_COVER_PATH = window.global.VUE_APP_DEFAULT_COVER_PATH;
  ENV_VAR.VUE_APP_TEXTBOOK_WEB = window.global.VUE_APP_TEXTBOOK_WEB;
  ENV_VAR.VUE_APP_GENERATE_PDF = window.global.VUE_APP_GENERATE_PDF;
  ENV_VAR.VUE_APP_API_JIURUI = window.global.VUE_APP_API_JIURUI;
} else {
  // 直接使用环境变量中配置的信息
  ENV_VAR.VUE_APP_BASE_API = process.env.VUE_APP_BASE_API;
  ENV_VAR.VUE_APP_OUCHN_API = process.env.VUE_APP_OUCHN_API;
  ENV_VAR.VUE_APP_TESTPAPER_WEB = process.env.VUE_APP_TESTPAPER_WEB;
  ENV_VAR.VUE_APP_UPLOAD_API = process.env.VUE_APP_UPLOAD_API;
  ENV_VAR.VUE_APP_DEFAULT_COVER_PATH = process.env.VUE_APP_DEFAULT_COVER_PATH;
  ENV_VAR.VUE_APP_TEXTBOOK_WEB = process.env.VUE_APP_TEXTBOOK_WEB;
  ENV_VAR.VUE_APP_GENERATE_PDF = process.env.VUE_APP_GENERATE_PDF;
  ENV_VAR.VUE_APP_API_JIURUI = process.env.VUE_APP_API_JIURUI;
}

//
var script$c = {
  name: 'SimpleRichTextEditor',
  components: {
    VueUeditorWrap
  },
  props: {
    content: {
      type: String,
      default: ''
    },
    mountTrigger: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      editorId: v4(),
      simpleEditorInstance: null,
      simpleEditorConfig: {
        UEDITOR_HOME_URL: '/UEditor/',
        UEDITOR_CORS_URL: ENV_VAR.VUE_APP_TEXTBOOK_WEB + 'UEditor/',
        initialFrameHeight: 60,
        autoHeightEnabled: false,
        toolbars: baseToolbars,
        elementPathEnabled: false,
        // 开启元素路径
        wordCount: false,
        // 开启字数统计
        maximumWords: 300,
        // 最大字符数10000
        shortcutMenu: [],
        // 禁用快捷菜单(因为存在bug)
        serverUrl: ENV_VAR.VUE_APP_UPLOAD_API + '/localFile/uploadV2'
      }
    };
  },
  computed: {
    richContent: {
      get() {
        return this.content;
      },
      set(val) {
        this.$emit('update:content', val);
      }
    }
  },
  watch: {},
  mounted() {},
  methods: {
    resizeHandler(elem) {
      if (elem) {
        const resizeOb = new ResizeObserver(entries => {
          for (const entry of entries) {
            if (entry.contentBoxSize) {
              $(elem).children('.edui-editor').width(entry.contentRect.width);
              $(elem).children('.edui-editor').children('.edui-editor-iframeholder').width(entry.contentRect.width);
            }
          }
        });
        resizeOb.observe(elem.get(0));
        this.$once('hook:beforeDestory', () => {
          elem.get(0) && resizeOb.unobserve(elem.get(0));
        });
      }
    },
    simpleEditorReady(editorInstance) {
      this.simpleEditorInstance = editorInstance;
      const simpleEditorContainer = $('#simple-' + this.editorId);
      this.resizeHandler(simpleEditorContainer);
    }
  }
};

/* script */
const __vue_script__$c = script$c;
/* template */
var __vue_render__$c = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "section",
    { staticClass: "simple-richtext-editor" },
    [
      _vm.mountTrigger
        ? _c("vue-ueditor-wrap", {
            attrs: {
              config: _vm.simpleEditorConfig,
              "editor-id": "simple-" + _vm.editorId,
            },
            on: { ready: _vm.simpleEditorReady },
            model: {
              value: _vm.richContent,
              callback: function ($$v) {
                _vm.richContent = typeof $$v === "string" ? $$v.trim() : $$v;
              },
              expression: "richContent",
            },
          })
        : _vm._e(),
    ],
    1
  )
};
var __vue_staticRenderFns__$c = [];
__vue_render__$c._withStripped = true;

  /* style */
  const __vue_inject_styles__$c = undefined;
  /* scoped */
  const __vue_scope_id__$c = "data-v-0ed0578c";
  /* module identifier */
  const __vue_module_identifier__$c = undefined;
  /* functional template */
  const __vue_is_functional_template__$c = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$c = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$c, staticRenderFns: __vue_staticRenderFns__$c },
    __vue_inject_styles__$c,
    __vue_script__$c,
    __vue_scope_id__$c,
    __vue_is_functional_template__$c,
    __vue_module_identifier__$c,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$b = {
  name: 'EditNote',
  components: {
    BaseRichTextEditor: __vue_component__$c
  },
  data() {
    return {
      titleEditDialogVisible: false,
      tableNote: ''
    };
  },
  methods: {
    afterTitleEditDialogClose() {
      this.titleEditDialogVisible = false;
      this.tableNote = '';
    },
    saveEditedTitle() {
      this.$emit('submit', this.tableNote);
      this.titleEditDialogVisible = false;
    },
    open(e) {
      this.tableNote = e.tableNote || '';
      this.titleEditDialogVisible = true;
    }
  }
};

var __$_require_image_white_left_bg_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAsCAYAAAAEuLqPAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAD4SURBVFiFzZXLFYMwDAQHGos7o7SU5lwMMeAPOGiVeY9DTprsCjHxEDHGALzSz5Aee2KMS/wBt8Er08DgALyHzQ/cEnh6+IjAeGcV5hvDH/3nK5cSSMODhUA3gdS7yfBLAsBiNRwuVGCxeDnNBFL8pvQqMI0fOhVYxw+NBBTxNwX4flrdBIJCoLoDiv6hkoCq/6qAkpqA+fvfE5BxErD++nUF1JQEZP3XBKScDpHqAK3sElAeoKIAog9QSyCoBXY7oO4fsgQ8+t8JeJELSA9QScCFbQk9FhBSAl4LuAngcICOAsFLYAK//gFmz/7hD17DGacDlAu48gEVvtxp4dC2iAAAAABJRU5ErkJggg==";

var __$_require_image_white_right_bg_png__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAsCAYAAAAEuLqPAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAD2SURBVFiF5ZVLDoMwEEPf9GKkJ6t6svZm7qLQL58gyHiBNyBlpFj20yQkiTrd++8VICLuk5NrpG26uA1sN7KTAUm6SSpr7w+pmoFandfw0cIAERG1s6e9LweQdLMaAEotmE0q+NAiD60SGNQtDbROYBHI1gmwxEJzA0CZO2xeAczXkJHAbA0pBuaUZaBMHaQwANMcpFUw9VRnMjC6Fe0QpjEA4xzYE0g1MLaQjpUAIwspFUL4BzG9gt+F5GDgayHZIUxnAL45sCTwyYGrghcHdgZcBsrwY4EQ3iDaKhgepsMyAD0HNgbgyYG1AknFzUDnNuBlAOABqbIyUUqXNcoAAAAASUVORK5CYII=";

/* script */
const __vue_script__$b = script$b;
var __vue_render__$b = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      attrs: {
        "append-to-body": true,
        title: _vm.tableNote ? "修改表注" : "添加表注",
        visible: _vm.titleEditDialogVisible,
        "close-on-click-modal": false,
        "destroy-on-close": "",
        width: "660px",
      },
      on: {
        "update:visible": function ($event) {
          _vm.titleEditDialogVisible = $event;
        },
        close: _vm.afterTitleEditDialogClose,
      },
    },
    [
      _c(
        "div",
        { staticClass: "mate-title", attrs: { slot: "title" }, slot: "title" },
        [
          _c("img", {
            attrs: { src: __$_require_image_white_left_bg_png__, alt: "" },
          }),
          _vm._v(" "),
          _c("div", { staticClass: "mate-text" }, [
            _vm._v(_vm._s(_vm.tableNote ? "修改表注" : "添加表注")),
          ]),
          _vm._v(" "),
          _c("img", {
            attrs: { src: __$_require_image_white_right_bg_png__, alt: "" },
          }),
        ]
      ),
      _vm._v(" "),
      _c("BaseRichTextEditor", {
        attrs: {
          mountTrigger: _vm.titleEditDialogVisible,
          content: _vm.tableNote,
        },
        on: {
          "update:content": function ($event) {
            _vm.tableNote = $event;
          },
        },
      }),
      _vm._v(" "),
      _c(
        "span",
        {
          staticClass: "dialog-footer",
          attrs: { slot: "footer" },
          slot: "footer",
        },
        [
          _c(
            "el-button",
            {
              on: {
                click: function ($event) {
                  _vm.titleEditDialogVisible = false;
                },
              },
            },
            [_vm._v("取消")]
          ),
          _vm._v(" "),
          _c(
            "el-button",
            { attrs: { type: "primary" }, on: { click: _vm.saveEditedTitle } },
            [_vm._v("保存")]
          ),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$b = [];
__vue_render__$b._withStripped = true;

  /* style */
  const __vue_inject_styles__$b = undefined;
  /* scoped */
  const __vue_scope_id__$b = "data-v-621f2f2a";
  /* module identifier */
  const __vue_module_identifier__$b = undefined;
  /* functional template */
  const __vue_is_functional_template__$b = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$b = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$b, staticRenderFns: __vue_staticRenderFns__$b },
    __vue_inject_styles__$b,
    __vue_script__$b,
    __vue_scope_id__$b,
    __vue_is_functional_template__$b,
    __vue_module_identifier__$b,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$a = {
  name: 'EditCell',
  props: {},
  data() {
    return {
      dialogVisible: false,
      checkList: [],
      options: [],
      type: '',
      title: ''
    };
  },
  watch: {},
  methods: {
    // 获取标题
    getTitle(type) {
      const titles = {
        select: '编辑下拉列表',
        radio: '编辑单选',
        checkbox: '编辑多选'
      };
      this.title = titles[type] || '';
    },
    // 初始化选项
    initOptions(type) {
      const defaultOptions = {
        select: [{
          value: '0',
          label: '下拉选项1'
        }, {
          value: '1',
          label: '下拉选项2'
        }, {
          value: '2',
          label: '下拉选项3'
        }],
        radio: [{
          value: '0',
          label: '单选1'
        }, {
          value: '1',
          label: '单选2'
        }],
        checkbox: [{
          value: '0',
          label: '多选1'
        }, {
          value: '1',
          label: '多选2'
        }, {
          value: '2',
          label: '多选3'
        }]
      };
      this.options = defaultOptions[type] || [];
    },
    // 打开弹窗
    open(type) {
      this.type = type;
      this.dialogVisible = true;
      this.getTitle(type);
      this.initOptions(type);
    },
    // 添加选项
    handleAdd() {
      const length = this.options.length;
      this.options.push({
        value: String(length),
        label: `${this.title}${length + 1}`
      });
    },
    // 上移
    handleUp(index) {
      if (index > 0) {
        const temp = this.options[index];
        this.$set(this.options, index, this.options[index - 1]);
        this.$set(this.options, index - 1, temp);
      }
    },
    // 下移
    handleDown(index) {
      if (index < this.options.length - 1) {
        const temp = this.options[index];
        this.$set(this.options, index, this.options[index + 1]);
        this.$set(this.options, index + 1, temp);
      }
    },
    // 删除
    handleDelete(index) {
      this.options.splice(index, 1);
    },
    // 选择变化
    handleCheckChange(val) {
      if (val.length > 1) {
        // this.$message.warning('只能选择一项作为默认选项')
        this.checkList = [val[val.length - 1]];
      }
    },
    // 提交
    handleSubmit() {
      let flag = false;
      for (let i = 0; i < this.options.length; i++) {
        if (!this.options[i].label) {
          flag = true;
        }
      }
      if (!flag) {
        this.$emit('submit', {
          options: this.options,
          defaultValue: this.checkList[0] || this.options[0]?.value,
          type: this.type
        });
        this.dialogVisible = false;
      } else {
        this.$message.warning('选项内容不可为空');
      }
      console.log(this.options, 'this.options');
    },
    // 关闭
    handleClose() {
      this.checkList = [];
      this.initOptions(this.type);
    }
  }
};

/* script */
const __vue_script__$a = script$a;
var __vue_render__$a = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      attrs: {
        title: _vm.title,
        visible: _vm.dialogVisible,
        width: "660px",
        "close-on-click-modal": false,
        "append-to-body": "",
        "destroy-on-close": "",
      },
      on: {
        "update:visible": function ($event) {
          _vm.dialogVisible = $event;
        },
        close: _vm.handleClose,
      },
    },
    [
      _c(
        "div",
        { staticClass: "mate-title", attrs: { slot: "title" }, slot: "title" },
        [
          _c("img", {
            attrs: { src: __$_require_image_white_left_bg_png__, alt: "" },
          }),
          _vm._v(" "),
          _c("div", { staticClass: "mate-text" }, [_vm._v(_vm._s(_vm.title))]),
          _vm._v(" "),
          _c("img", {
            attrs: { src: __$_require_image_white_right_bg_png__, alt: "" },
          }),
        ]
      ),
      _vm._v(" "),
      _c(
        "div",
        { staticClass: "edit-cell-content" },
        [
          _c("div", { staticClass: "tip" }, [
            _vm._v("* 勾选一项为默认项，未勾选择默认第一项"),
          ]),
          _vm._v(" "),
          _c(
            "el-checkbox-group",
            {
              on: { change: _vm.handleCheckChange },
              model: {
                value: _vm.checkList,
                callback: function ($$v) {
                  _vm.checkList = $$v;
                },
                expression: "checkList",
              },
            },
            [
              _vm._l(_vm.options, function (item, index) {
                return _c(
                  "div",
                  { key: index, staticClass: "select-item" },
                  [
                    _c("el-checkbox", { attrs: { label: item.value } }),
                    _vm._v(" "),
                    _c("el-input", {
                      attrs: { placeholder: "请输入内容" },
                      model: {
                        value: item.label,
                        callback: function ($$v) {
                          _vm.$set(item, "label", $$v);
                        },
                        expression: "item.label",
                      },
                    }),
                    _vm._v(" "),
                    _c(
                      "el-button",
                      {
                        attrs: { type: "text", disabled: index === 0 },
                        on: {
                          click: function ($event) {
                            return _vm.handleUp(index)
                          },
                        },
                      },
                      [_vm._v("上移")]
                    ),
                    _vm._v(" "),
                    _c(
                      "el-button",
                      {
                        attrs: {
                          type: "text",
                          disabled: index === _vm.options.length - 1,
                        },
                        on: {
                          click: function ($event) {
                            return _vm.handleDown(index)
                          },
                        },
                      },
                      [_vm._v("下移")]
                    ),
                    _vm._v(" "),
                    _c(
                      "el-button",
                      {
                        attrs: { type: "text" },
                        on: {
                          click: function ($event) {
                            return _vm.handleDelete(index)
                          },
                        },
                      },
                      [_vm._v("删除")]
                    ),
                  ],
                  1
                )
              }),
              _vm._v(" "),
              _c(
                "el-button",
                {
                  attrs: { type: "text", icon: "el-icon-plus" },
                  on: { click: _vm.handleAdd },
                },
                [_vm._v("添加")]
              ),
            ],
            2
          ),
        ],
        1
      ),
      _vm._v(" "),
      _c(
        "span",
        {
          staticClass: "dialog-footer",
          attrs: { slot: "footer" },
          slot: "footer",
        },
        [
          _c(
            "el-button",
            {
              on: {
                click: function ($event) {
                  _vm.dialogVisible = false;
                },
              },
            },
            [_vm._v("取 消")]
          ),
          _vm._v(" "),
          _c(
            "el-button",
            { attrs: { type: "primary" }, on: { click: _vm.handleSubmit } },
            [_vm._v("确 定")]
          ),
        ],
        1
      ),
    ]
  )
};
var __vue_staticRenderFns__$a = [];
__vue_render__$a._withStripped = true;

  /* style */
  const __vue_inject_styles__$a = undefined;
  /* scoped */
  const __vue_scope_id__$a = "data-v-950823c2";
  /* module identifier */
  const __vue_module_identifier__$a = undefined;
  /* functional template */
  const __vue_is_functional_template__$a = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$a = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$a, staticRenderFns: __vue_staticRenderFns__$a },
    __vue_inject_styles__$a,
    __vue_script__$a,
    __vue_scope_id__$a,
    __vue_is_functional_template__$a,
    __vue_module_identifier__$a,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$9 = {
  name: 'EditHeader',
  data() {
    return {
      dialogVisible: false,
      form: {
        title: '',
        align: 'center'
      },
      column: null
    };
  },
  methods: {
    open(column) {
      this.column = column;
      this.form.title = column.title;
      this.form.align = column.align;
      this.dialogVisible = true;
    },
    handleClose() {
      this.dialogVisible = false;
    },
    handleSubmit() {
      this.$emit('submit', {
        ...this.column,
        title: this.form.title
      });
      this.handleClose();
    }
  }
};

/* script */
const __vue_script__$9 = script$9;
/* template */
var __vue_render__$9 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "el-dialog",
    {
      attrs: {
        title: "编辑表头",
        "append-to-body": true,
        visible: _vm.dialogVisible,
        width: "30%",
        "close-on-click-modal": false,
        "destroy-on-close": "",
        "before-close": _vm.handleClose,
      },
      on: {
        "update:visible": function ($event) {
          _vm.dialogVisible = $event;
        },
      },
    },
    [
      _c(
        "el-form",
        { attrs: { model: _vm.form, "label-width": "80px" } },
        [
          _c(
            "el-form-item",
            { attrs: { label: "表头名称" } },
            [
              _c("el-input", {
                attrs: { placeholder: "请输入表头名称" },
                model: {
                  value: _vm.form.title,
                  callback: function ($$v) {
                    _vm.$set(_vm.form, "title", $$v);
                  },
                  expression: "form.title",
                },
              }),
            ],
            1
          ),
        ],
        1
      ),
      _vm._v(" "),
      _c(
        "span",
        {
          staticClass: "dialog-footer",
          attrs: { slot: "footer" },
          slot: "footer",
        },
        [
          _c("el-button", { on: { click: _vm.handleClose } }, [
            _vm._v("取 消"),
          ]),
          _vm._v(" "),
          _c(
            "el-button",
            { attrs: { type: "primary" }, on: { click: _vm.handleSubmit } },
            [_vm._v("确 定")]
          ),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$9 = [];
__vue_render__$9._withStripped = true;

  /* style */
  const __vue_inject_styles__$9 = undefined;
  /* scoped */
  const __vue_scope_id__$9 = "data-v-52bebb92";
  /* module identifier */
  const __vue_module_identifier__$9 = undefined;
  /* functional template */
  const __vue_is_functional_template__$9 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$9 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$9, staticRenderFns: __vue_staticRenderFns__$9 },
    __vue_inject_styles__$9,
    __vue_script__$9,
    __vue_scope_id__$9,
    __vue_is_functional_template__$9,
    __vue_module_identifier__$9,
    false,
    undefined,
    undefined,
    undefined
  );

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

var script$8 = {
  name: 'CellStyleMenu',
  data() {
    return {
      menuStyle: {},
      classList: [{
        type: 'bold',
        icon: 'edui-for-bold',
        className: 'xml-cell-bold'
      }, {
        type: 'italic',
        icon: 'edui-for-italic',
        className: 'xml-cell-italic'
      }, {
        type: 'underline',
        icon: 'edui-for-underline',
        className: 'xml-cell-underline'
      }],
      cellAlignment: [{
        type: 'top-left',
        className: 'xml-cell-top-left'
      }, {
        type: 'top-center',
        className: 'xml-cell-top-center'
      }, {
        type: 'top-right',
        className: 'xml-cell-top-right'
      }, {
        type: 'center-left',
        className: 'xml-cell-center-left'
      }, {
        type: 'center-center',
        className: 'xml-cell-center-center'
      }, {
        type: 'center-right',
        className: 'xml-cell-center-right'
      }, {
        type: 'bottom-left',
        className: 'xml-cell-bottom-left'
      }, {
        type: 'bottom-center',
        className: 'xml-cell-bottom-center'
      }, {
        type: 'bottom-right',
        className: 'xml-cell-bottom-right'
      }],
      currentList: [],
      visible: false,
      style: {
        fontColor: '',
        bgColor: ''
      },
      justification: '',
      fontColorList: ['#222222', '#888888', '#f5222d', '#fa8c16', '#faad14', '#52c41a', '#1890ff', '#722ed1'],
      bgColorList: ['', '#f5f5f5', '#fdeaea', '#fff2e8', '#fffbe6', '#f6ffed', '#e6fffb', '#e6f7ff', '#f9f0ff', '#d9d9d9', '#ffccc7', '#ffd8bf', '#ffe7ba'],
      customFontColor: '#222222',
      customBgColor: '#f5f5f5'
    };
  },
  methods: {
    open(e) {
      this.menuStyle = e.menuStyle;
      this.visible = true;
      this.currentList = e.classList;
      this.style = {
        ...this.style,
        ...e.style
      };
      this.justification = e.justification;
    },
    close() {
      this.visible = false;
    },
    alignmentClick(e) {
      if (e.className !== this.justification) {
        this.justification = e.className;
        this.$emit('alignmentClick', {
          className: e.className
        });
      }
    },
    handleClick(item) {
      let type = this.currentList.includes(item.className) ? 'remove' : 'add';
      this.$emit('handleClick', {
        type,
        className: item.className,
        eventType: 'className'
      });
      if (type === 'add') {
        this.currentList.push(item.className);
      } else {
        this.currentList.splice(this.currentList.indexOf(item.className), 1);
      }
    },
    onCancel() {
      this.$emit('update:visible', false);
    },
    onConfirm() {
      this.$emit('set-style', {
        ...this.style
      });
      this.$emit('update:visible', false);
    },
    setFontColor(color) {
      this.style.fontColor = color;
      this.$emit('handleClick', {
        color,
        eventType: 'color'
      });
    },
    setBgColor(color) {
      this.style.bgColor = color;
      this.$emit('handleClick', {
        color,
        eventType: 'bgColor'
      });
    }
  }
};

/* script */
const __vue_script__$8 = script$8;
/* template */
var __vue_render__$8 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      directives: [
        {
          name: "show",
          rawName: "v-show",
          value: _vm.visible,
          expression: "visible",
        },
      ],
      staticClass: "cell-style-menu-mask",
      style: _vm.menuStyle,
      on: {
        click: function ($event) {
          if ($event.target !== $event.currentTarget) {
            return null
          }
          _vm.visible = false;
        },
      },
    },
    [
      _c(
        "div",
        {
          staticClass: "cell-style-menu edui-default",
          on: {
            click: function ($event) {
              $event.stopPropagation();
            },
          },
        },
        [
          _vm._l(_vm.classList, function (item, index) {
            return _c(
              "div",
              {
                key: index,
                staticClass: "edui-icon-box",
                class: [
                  item.icon,
                  _vm.currentList.includes(item.className) ? "active" : "",
                ],
                on: {
                  click: function ($event) {
                    return _vm.handleClick(item)
                  },
                },
              },
              [_c("i", { staticClass: "edui-icon" })]
            )
          }),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "edui-icon-box grid-popup-icon edui-for-justifyleft",
              staticStyle: { position: "relative" },
            },
            [
              _c("i", { staticClass: "edui-icon" }),
              _vm._v(" "),
              _c("div", { staticClass: "grid-popup" }, [
                _c(
                  "div",
                  { staticClass: "grid-container" },
                  _vm._l(_vm.cellAlignment, function (item, index) {
                    return _c("div", {
                      key: index,
                      staticClass: "grid-item",
                      class: [
                        item.className,
                        _vm.justification == item.className ? "active" : "",
                      ],
                      on: {
                        click: function ($event) {
                          return _vm.alignmentClick(item)
                        },
                      },
                    })
                  }),
                  0
                ),
              ]),
            ]
          ),
          _vm._v(" "),
          _c(
            "div",
            {
              staticClass: "edui-icon-box color-popup-v2-icon",
              staticStyle: { position: "relative" },
              style: {
                color: _vm.style.fontColor,
                backgroundColor: _vm.style.bgColor,
              },
            },
            [
              _c("span", { staticClass: "text-box" }, [_vm._v("A")]),
              _vm._v(" "),
              _c("div", { staticClass: "color-popup-v2" }, [
                _c("div", { staticClass: "color-row" }, [
                  _c("div", { staticClass: "color-label" }, [_vm._v("文字色")]),
                  _vm._v(" "),
                  _c(
                    "div",
                    { staticClass: "color-blocks" },
                    [
                      _vm._l(_vm.fontColorList, function (color, idx) {
                        return _c(
                          "div",
                          {
                            key: "font" + idx,
                            staticClass: "color-block",
                            class: { selected: _vm.style.fontColor === color },
                            style: {
                              color: color,
                              borderColor:
                                _vm.style.fontColor === color
                                  ? "#1890ff"
                                  : "#fff",
                            },
                            on: {
                              click: function ($event) {
                                return _vm.setFontColor(color)
                              },
                            },
                          },
                          [_vm._v("A")]
                        )
                      }),
                      _vm._v(" "),
                      _c("label", { staticClass: "color-picker-wrap" }, [
                        _c("input", {
                          directives: [
                            {
                              name: "model",
                              rawName: "v-model",
                              value: _vm.customFontColor,
                              expression: "customFontColor",
                            },
                          ],
                          staticClass: "color-picker-input",
                          attrs: { type: "color" },
                          domProps: { value: _vm.customFontColor },
                          on: {
                            change: function ($event) {
                              return _vm.setFontColor(_vm.customFontColor)
                            },
                            input: function ($event) {
                              if ($event.target.composing) {
                                return
                              }
                              _vm.customFontColor = $event.target.value;
                            },
                          },
                        }),
                        _vm._v(" "),
                        _c("span", { staticClass: "color-picker-icon" }, [
                          _vm._v("+"),
                        ]),
                      ]),
                    ],
                    2
                  ),
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "color-row" }, [
                  _c("div", { staticClass: "color-label" }, [_vm._v("背景色")]),
                  _vm._v(" "),
                  _c("div", { staticClass: "color-blocks-vertical" }, [
                    _c(
                      "div",
                      { staticClass: "color-blocks" },
                      [
                        _vm._l(_vm.bgColorList, function (color, idx) {
                          return _c(
                            "div",
                            {
                              key: "bg" + "-" + idx,
                              staticClass: "color-block",
                              class: { selected: _vm.style.bgColor === color },
                              style: {
                                background:
                                  color ||
                                  "linear-gradient(45deg,#fff 60%,#eee 100%)",
                                borderColor:
                                  _vm.style.bgColor === color
                                    ? "#1890ff"
                                    : "#fff",
                              },
                              on: {
                                click: function ($event) {
                                  return _vm.setBgColor(color)
                                },
                              },
                            },
                            [
                              color === ""
                                ? _c("span", { staticClass: "no-bg" })
                                : _vm._e(),
                            ]
                          )
                        }),
                        _vm._v(" "),
                        _c("label", { staticClass: "color-picker-wrap" }, [
                          _c("input", {
                            directives: [
                              {
                                name: "model",
                                rawName: "v-model",
                                value: _vm.customBgColor,
                                expression: "customBgColor",
                              },
                            ],
                            staticClass: "color-picker-input",
                            attrs: { type: "color" },
                            domProps: { value: _vm.customBgColor },
                            on: {
                              change: function ($event) {
                                return _vm.setBgColor(_vm.customBgColor)
                              },
                              input: function ($event) {
                                if ($event.target.composing) {
                                  return
                                }
                                _vm.customBgColor = $event.target.value;
                              },
                            },
                          }),
                          _vm._v(" "),
                          _c("span", { staticClass: "color-picker-icon" }, [
                            _vm._v("+"),
                          ]),
                        ]),
                      ],
                      2
                    ),
                  ]),
                ]),
              ]),
            ]
          ),
        ],
        2
      ),
    ]
  )
};
var __vue_staticRenderFns__$8 = [];
__vue_render__$8._withStripped = true;

  /* style */
  const __vue_inject_styles__$8 = undefined;
  /* scoped */
  const __vue_scope_id__$8 = "data-v-c0f57f76";
  /* module identifier */
  const __vue_module_identifier__$8 = undefined;
  /* functional template */
  const __vue_is_functional_template__$8 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$8 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$8, staticRenderFns: __vue_staticRenderFns__$8 },
    __vue_inject_styles__$8,
    __vue_script__$8,
    __vue_scope_id__$8,
    __vue_is_functional_template__$8,
    __vue_module_identifier__$8,
    false,
    undefined,
    undefined,
    undefined
  );

//

// 表格单元格类型配置
const cellTypeData = {
  select: {
    renderBodyCell: ({
      row,
      column,
      rowIndex
    }, h) => {
      return h(__vue_component__$i, {
        "attrs": {
          "row": row,
          "column": column,
          "rowIndex": rowIndex
        }
      });
    }
  },
  radio: {
    renderBodyCell: ({
      row,
      column,
      rowIndex
    }, h) => {
      return h(__vue_component__$h, {
        "attrs": {
          "row": row,
          "column": column,
          "rowIndex": rowIndex
        }
      });
    }
  },
  checkbox: {
    renderBodyCell: ({
      row,
      column,
      rowIndex
    }, h) => {
      return h(__vue_component__$g, {
        "attrs": {
          "row": row,
          "column": column,
          "rowIndex": rowIndex
        }
      });
    }
  },
  input: {
    renderBodyCell: ({
      row,
      column,
      rowIndex
    }, h) => {
      return h(__vue_component__$f, {
        "attrs": {
          "row": row,
          "column": column,
          "rowIndex": rowIndex
        }
      });
    }
  }
};
var script$7 = {
  name: 'XmlVeTable',
  components: {
    TableSelect: __vue_component__$i,
    TableRadio: __vue_component__$h,
    TableCheckbox: __vue_component__$g,
    TableInput: __vue_component__$f,
    EditNote: __vue_component__$b,
    EditCell: __vue_component__$a,
    EditHeader: __vue_component__$9,
    CellStyleMenu: __vue_component__$8
  },
  props: {
    // 模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    // 属性中传递过来的块儿数据
    pBlockData: {
      type: Object,
      required: true
    },
    // 块儿数据名
    blockDataName: String,
    // 页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    officePreviewPath: {
      type: String,
      default: ''
    },
    // 当前所处组的规则
    currentRule: {
      type: Object,
      default: () => ({})
    },
    tableDataKey: {
      type: String,
      default: 'tableData'
    }
  },
  data() {
    return {
      // 当前块儿数据
      blockData: {},
      // 表格key,用于强制刷新
      tableKey: 'key_' + v4(),
      // 当前选中的单元格选项
      currentCellOptions: [],
      // 选中单元格范围
      selectionRangeKeys: {},
      selectionRangeIndexes: {},
      menuStyle: {},
      // 列宽调整配置
      columnWidthResizeOption: {
        enable: this.mode == 'editor',
        minWidth: 40,
        sizeChange: ({
          column,
          differWidth,
          columnWidth
        }) => {
          let i = this.blockData.columns.findIndex(item => item.key === column.key);
          this.blockData.columns[i].width = columnWidth;
          this.saveTableContents();
          this.refreshTable();
          // console.log('columnWidthResizeOption', column, differWidth, columnWidth);

          // this.columnResizeInfo = {
          //   column,
          //   differWidth,
          //   columnWidth
          // }
        }
      },
      cellSelectionOption: {
        enable: true
      },
      // 列宽调整信息
      columnResizeInfo: {
        column: '',
        differWidth: '',
        columnWidth: ''
      },
      // 单元格合并配置
      cellSpanOption: {
        bodyCellSpan: this.bodyCellSpan
      },
      // 单元格编辑配置
      editOption: {
        beforeStartCellEditing: ({
          row,
          column,
          cellValue
        }) => {
          let isElement = cellTypeData[column.cellType]; //element组件的单元格
          let isEdit = row[column.key + 'Data'].isEdit;
          if (isElement || this.mode !== 'editor' && !isEdit) {
            return false;
          }
        },
        beforeCellValueChange: ({
          row,
          column,
          changeValue
        }) => {
          // 可以在这里添加单元格值验证逻辑
        },
        afterCellValueChange: ({
          row,
          column,
          changeValue
        }) => {
          this.saveTableContents();
        }
      },
      // 右键菜单配置
      contextmenuBodyOption: {
        beforeShow: ({
          isWholeRowSelection,
          selectionRangeKeys,
          selectionRangeIndexes
        }) => {
          // 右键菜单显示前的处理
        },
        afterMenuClick: ({
          type,
          selectionRangeKeys,
          selectionRangeIndexes
        }) => {
          this.selectionRangeIndexes = selectionRangeIndexes;
          this.handleContextMenu(type, selectionRangeKeys, selectionRangeIndexes);
        },
        contextmenus: contextmenuConfig[this.tableDataKey]
      },
      // 表头点击事件配置
      eventCustomOption: {
        headerCellEvents: ({
          column,
          rowIndex
        }) => {
          return {
            dblclick: event => {
              if (this.mode === 'editor') {
                this.$refs.editHeader.open(column);
              }
            }
          };
        },
        bodyRowEvents: ({
          row,
          rowIndex
        }) => {
          return {
            mouseup: event => {
              this.handleMouseUp(event);
            }
          };
        }
      },
      showCellStyleMenu: false
    };
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          if (this.mode === 'editor') {
            this.blockData = Object.assign({}, this.blockData, newValue);
          } else {
            this.blockData = JSON.parse(JSON.stringify(newValue));
          }
          this.getTableElement();
        });
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    // 获取表格元素
    getTableElement() {
      this.$createElement;
      if (this.blockData.columns) {
        this.blockData.columns.forEach(column => {
          if (cellTypeData[column.cellType]) {
            column.renderBodyCell = cellTypeData[column.cellType].renderBodyCell;
          } else {
            column.renderBodyCell = ({
              row,
              column,
              rowIndex
            }, h) => {
              return h(__vue_component__$d, {
                "attrs": {
                  "row": row,
                  "column": column,
                  "rowIndex": rowIndex
                }
              });
            };
          }
        });
      }
    },
    // 处理右键菜单点击
    handleContextMenu(type, selectionRangeKeys, selectionRangeIndexes) {
      this.selectionRangeKeys = selectionRangeKeys;
      this.selectionRangeIndexes = selectionRangeIndexes;
      switch (type) {
        case 'deleteRow':
          this.handleDeleteRow(selectionRangeIndexes);
          break;
        case 'deleteColumn':
          this.handleDeleteColumn(selectionRangeIndexes);
          break;
        case 'upAddRow':
        case 'downAddRow':
          this.handleAddRow(type, selectionRangeIndexes);
          break;
        case 'letAddColumn':
        case 'rightAddColumn':
          this.handleAddColumn(type, selectionRangeIndexes);
          break;
        case 'addTableNote':
          this.$refs.editNote.open({
            tableNote: this.blockData.tableInfo.tableNote
          });
          break;
        case 'mergeCell':
          this.handleMergeCell(selectionRangeKeys, selectionRangeIndexes);
          break;
        case 'select':
        case 'radio':
        case 'checkbox':
          this.currentCellOptions = this.blockData.columns[selectionRangeIndexes.startColIndex].eleData || [];
          this.$refs.editCell.open(type);
          break;
        case 'inputNumber':
          this.handleInputNumber(selectionRangeIndexes);
          break;
        case 'canBeInputted':
          this.handleTextarea(selectionRangeKeys, selectionRangeIndexes, true);
          break;
        case 'inhibitInput':
          this.handleTextarea(selectionRangeKeys, selectionRangeIndexes, false);
          break;
        case 'left':
        case 'center':
        case 'right':
          this.handleAlign(type);
          break;
        case 'borderX':
        case 'borderY':
        case 'borderAround':
          this.handleBorder(type);
          break;
        case 'cellSettings':
          this.handleCellSettings(selectionRangeKeys, selectionRangeIndexes, true);
          break;
        case 'diagonalSeparation':
          this.diagonalSeparation(selectionRangeKeys, selectionRangeIndexes);
          break;
      }
    },
    getCellData({
      rowIndex,
      field,
      startRowIndex,
      startColIndex
    }) {
      if (rowIndex && field) {
        return this.blockData[this.tableDataKey][rowIndex][field + 'Data'];
      } else if (startRowIndex && startColIndex) {
        return this.blockData[this.tableDataKey][startRowIndex][this.blockData.columns[startColIndex].field + 'Data'];
      }
    },
    // 处理添加行
    handleAddRow(type, data) {
      let rowIndex = -1;
      let AddRow = 0;
      if (data.startRowIndex == data.endRowIndex && data.startColIndex == data.endColIndex) {
        //选择的是一个单元格
        let item = this.blockData[this.tableDataKey][data.startRowIndex][this.blockData.columns[data.startColIndex].field + 'Data'];
        if (type == 'upAddRow') {
          rowIndex = data.startRowIndex - 1;
          AddRow = data.startRowIndex;
        } else if (type == 'downAddRow') {
          //当前单元格可能合并了其他行，向下插入行时需要加上该单元格占的行数
          rowIndex = data.startRowIndex + item.rowspan - 1;
          AddRow = data.startRowIndex + item.rowspan;
        }
      } else {
        if (type == 'upAddRow') {
          rowIndex = data.startRowIndex - 1;
          AddRow = data.startRowIndex - 1;
        } else if (type == 'downAddRow') {
          rowIndex = data.endRowIndex;
          AddRow = data.endRowIndex + 1;
        }
      }
      let item = {
        key: v4()
      };
      let fatherId = '';
      for (let i = 0; i < this.blockData.columns.length; i++) {
        let key = this.blockData.columns[i].key;
        let isFinally = rowIndex == -1 || rowIndex == this.blockData[this.tableDataKey].length - 1 || this.blockData[this.tableDataKey][rowIndex][key + 'Data'].fatherId != this.blockData[this.tableDataKey][rowIndex + 1][key + 'Data'].fatherId;
        item[key] = '';
        item[key + 'Data'] = {
          rowspan: isFinally ? 1 : this.blockData[this.tableDataKey][rowIndex][key + 'Data'].rowspan > 1 ? 0 : this.blockData[this.tableDataKey][rowIndex][key + 'Data'].rowspan,
          colspan: isFinally ? 1 : this.blockData[this.tableDataKey][rowIndex][key + 'Data'].colspan > 1 ? 0 : this.blockData[this.tableDataKey][rowIndex][key + 'Data'].colspan,
          fatherId: rowIndex == -1 ? '' : this.blockData[this.tableDataKey][rowIndex][key + 'Data'].fatherId,
          id: rowIndex == -1 ? '' : item.key + '_' + key,
          isEdit: false,
          className: this.tableDataKey == 'tableTitleData' ? 'xml-cell-bold' : '',
          style: {},
          cellType: '',
          cellData: {},
          justification: 'xml-cell-center-center'
        };
        if (item[key + 'Data'].rowspan < 1) {
          fatherId = item[key + 'Data'].fatherId;
        }
      }
      if (fatherId) {
        let list = fatherId.split('_');
        let i = this.blockData[this.tableDataKey].findIndex(item => item.key == list[0]);
        this.blockData[this.tableDataKey][i][list[1] + 'Data'].rowspan++;
      }
      this.blockData[this.tableDataKey].splice(AddRow, 0, item);
      this.refreshTable();
      this.saveTableContents();
    },
    // 处理添加列
    handleAddColumn(type, data) {
      let rowIndex = -1;
      let AddCol = 0;
      if (data.startRowIndex == data.endRowIndex && data.startColIndex == data.endColIndex) {
        let item = this.blockData[this.tableDataKey][data.startRowIndex][this.blockData.columns[data.startColIndex].key + 'Data'];
        if (type == 'letAddColumn') {
          rowIndex = data.startColIndex - 1;
          AddCol = data.startColIndex;
        } else if (type == 'rightAddColumn') {
          rowIndex = data.startColIndex + item.colspan - 1;
          AddCol = data.startColIndex + item.colspan;
        }
      } else {
        if (type == 'letAddColumn') {
          rowIndex = data.startColIndex - 1;
          AddCol = data.startColIndex - 1;
        } else if (type == 'rightAddColumn') {
          rowIndex = data.endColIndex;
          AddCol = data.endColIndex + 1;
        }
      }
      let key = getUniqueFoodKey(this.blockData.columns);
      let fatherId = '';
      let fatherId2 = '';

      // for (let i = 0; i < this.blockData[this.tableDataKey].length; i++) {
      //   this.blockData[this.tableDataKey][i][key] = ''
      //   let isFinally=rowIndex == -1||rowIndex==this.blockData.columns.length-1||this.blockData[this.tableDataKey][i][this.blockData.columns[rowIndex].field + 'Data'].fatherId!=this.blockData[this.tableDataKey][i][this.blockData.columns[rowIndex+1].field + 'Data'].fatherId
      //   this.blockData[this.tableDataKey][i][key + 'Data'] = {
      //     rowspan: isFinally ? 1 : this.blockData[this.tableDataKey][i][this.blockData.columns[rowIndex].field + 'Data'].rowspan>1?  0 : this.blockData[this.tableDataKey][i][this.blockData.columns[rowIndex].field + 'Data'].rowspan,
      //     colspan: isFinally ? 1 : this.blockData[this.tableDataKey][i][this.blockData.columns[rowIndex].field + 'Data'].colspan > 1 ? 0 : this.blockData[this.tableDataKey][i][this.blockData.columns[rowIndex].field + 'Data'].colspan,
      //     fatherId: rowIndex == -1 ? '' : this.blockData[this.tableDataKey][i][this.blockData.columns[rowIndex].field + 'Data'].fatherId,
      //     id:
      //       rowIndex == -1 ? '' : this.blockData[this.tableDataKey][i].key + '_' + this.blockData.columns[rowIndex].key,
      //     isEdit: false,
      //     className: 'xml-cell-center-center',
      //     style: {}
      //   }
      //   if (this.blockData[this.tableDataKey][i][key + 'Data'].colspan < 1) {
      //     fatherId = this.blockData[this.tableDataKey][i][key + 'Data'].fatherId
      //   }
      // }

      // if (fatherId) {
      //   let list = fatherId.split('_')
      //   let i = this.blockData[this.tableDataKey].findIndex((item) => item.key == list[0])
      //   this.blockData[this.tableDataKey][i][list[1] + 'Data'].colspan++
      // }

      for (let i = 0; i < this.blockData['tableData'].length; i++) {
        this.blockData['tableData'][i][key] = '';
        let isFinally = rowIndex == -1 || rowIndex == this.blockData.columns.length - 1 || this.blockData['tableData'][i][this.blockData.columns[rowIndex].field + 'Data'].fatherId != this.blockData['tableData'][i][this.blockData.columns[rowIndex + 1].field + 'Data'].fatherId;
        this.blockData['tableData'][i][key + 'Data'] = {
          rowspan: isFinally ? 1 : this.blockData['tableData'][i][this.blockData.columns[rowIndex].field + 'Data'].rowspan > 1 ? 0 : this.blockData['tableData'][i][this.blockData.columns[rowIndex].field + 'Data'].rowspan,
          colspan: isFinally ? 1 : this.blockData['tableData'][i][this.blockData.columns[rowIndex].field + 'Data'].colspan > 1 ? 0 : this.blockData['tableData'][i][this.blockData.columns[rowIndex].field + 'Data'].colspan,
          fatherId: rowIndex == -1 ? '' : this.blockData['tableData'][i][this.blockData.columns[rowIndex].field + 'Data'].fatherId,
          id: rowIndex == -1 ? '' : this.blockData['tableData'][i].key + '_' + this.blockData.columns[rowIndex].key,
          isEdit: false,
          className: '',
          style: {},
          cellType: '',
          cellData: {},
          justification: 'xml-cell-center-center'
        };
        if (this.blockData['tableData'][i][key + 'Data'].colspan < 1) {
          fatherId = this.blockData['tableData'][i][key + 'Data'].fatherId;
        }
      }
      if (fatherId) {
        let list = fatherId.split('_');
        let i = this.blockData['tableData'].findIndex(item => item.key == list[0]);
        this.blockData['tableData'][i][list[1] + 'Data'].colspan++;
      }

      // ===============================================================================

      for (let i = 0; i < this.blockData['tableTitleData'].length; i++) {
        this.blockData['tableTitleData'][i][key] = '';
        let isFinally = rowIndex == -1 || rowIndex == this.blockData.columns.length - 1 || this.blockData['tableTitleData'][i][this.blockData.columns[rowIndex].field + 'Data'].fatherId != this.blockData['tableTitleData'][i][this.blockData.columns[rowIndex + 1].field + 'Data'].fatherId;
        this.blockData['tableTitleData'][i][key + 'Data'] = {
          rowspan: isFinally ? 1 : this.blockData['tableTitleData'][i][this.blockData.columns[rowIndex].field + 'Data'].rowspan > 1 ? 0 : this.blockData['tableTitleData'][i][this.blockData.columns[rowIndex].field + 'Data'].rowspan,
          colspan: isFinally ? 1 : this.blockData['tableTitleData'][i][this.blockData.columns[rowIndex].field + 'Data'].colspan > 1 ? 0 : this.blockData['tableTitleData'][i][this.blockData.columns[rowIndex].field + 'Data'].colspan,
          fatherId: rowIndex == -1 ? '' : this.blockData['tableTitleData'][i][this.blockData.columns[rowIndex].field + 'Data'].fatherId,
          id: rowIndex == -1 ? '' : this.blockData['tableTitleData'][i].key + '_' + this.blockData.columns[rowIndex].key,
          isEdit: false,
          className: 'xml-cell-bold',
          style: {},
          cellType: '',
          cellData: {},
          justification: 'xml-cell-center-center'
        };
        if (this.blockData['tableTitleData'][i][key + 'Data'].colspan < 1) {
          fatherId2 = this.blockData['tableTitleData'][i][key + 'Data'].fatherId;
        }
      }
      if (fatherId2) {
        let list = fatherId.split('_');
        let i = this.blockData['tableTitleData'].findIndex(item => item.key == list[0]);
        this.blockData['tableTitleData'][i][list[1] + 'Data'].colspan++;
      }
      let item = {
        field: key,
        key: key,
        width: 200,
        title: 'A',
        align: 'center',
        edit: true,
        cellType: '',
        eleData: {}
      };
      this.blockData.columns.splice(AddCol, 0, item);
      this.refreshTable();
      this.saveTableContents();
    },
    // 处理删除行
    handleDeleteRow(selectionRangeIndexes) {
      const {
        startRowIndex,
        endRowIndex
      } = selectionRangeIndexes;
      const rowsList1 = [];
      const rowsList2 = [];

      // 获取需要处理的单元格
      for (let j = startRowIndex; j <= endRowIndex; j++) {
        let isRows = 0;
        for (let i = 0; i < this.blockData.columns.length; i++) {
          let _key = this.blockData.columns[i].field + 'Data';
          if (this.blockData[this.tableDataKey][j][_key].rowspan < 1 && isRows < 1) {
            isRows++;
            rowsList1.push(this.blockData[this.tableDataKey][j][_key].fatherId);
          } else if (this.blockData[this.tableDataKey][j][_key].rowspan > 1 && !rowsList2.includes(this.blockData[this.tableDataKey][j][_key].fatherId)) {
            rowsList2.push(this.blockData[this.tableDataKey][j][_key].fatherId);
          }
        }
      }

      // 更新单元格合并信息
      for (let i = 0; i < this.blockData.columns.length; i++) {
        let _key = this.blockData.columns[i].field + 'Data';
        for (let j = 0; j < this.blockData[this.tableDataKey].length; j++) {
          let id = this.blockData[this.tableDataKey][j][_key].id;
          let fatherId = this.blockData[this.tableDataKey][j][_key].fatherId;
          if (rowsList1.includes(id)) {
            this.blockData[this.tableDataKey][j][_key].rowspan -= rowsList1.length;
          } else if (rowsList2.includes(fatherId)) {
            this.blockData[this.tableDataKey][j][_key].rowspan = 1;
            this.blockData[this.tableDataKey][j][_key].colspan = 1;
          }
        }
      }

      // 删除行
      this.blockData[this.tableDataKey].splice(startRowIndex, endRowIndex - startRowIndex + 1);
      this.refreshTable();
      this.saveTableContents();
    },
    // 处理删除列
    handleDeleteColumn(selectionRangeIndexes, key) {
      let tableDataKey = key || this.tableDataKey;
      const {
        startColIndex,
        endColIndex
      } = selectionRangeIndexes;
      const rowsList1 = [];
      const rowsList2 = [];

      // 获取需要处理的单元格
      for (let i = startColIndex; i <= endColIndex; i++) {
        let isCol = 0;
        let _key = this.blockData.columns[i].field + 'Data';
        for (let j = 0; j < this.blockData[tableDataKey].length; j++) {
          if (this.blockData[tableDataKey][j][_key].colspan < 1 && isCol < 1) {
            isCol++;
            rowsList1.push(this.blockData[tableDataKey][j][_key].fatherId);
          } else if (this.blockData[tableDataKey][j][_key].colspan > 1 && !rowsList2.includes(this.blockData[tableDataKey][j][_key].fatherId)) {
            rowsList2.push(this.blockData[tableDataKey][j][_key].fatherId);
          }
          delete this.blockData[tableDataKey][j][this.blockData.columns[i].key];
          delete this.blockData[tableDataKey][j][this.blockData.columns[i].key + 'Data'];
        }
      }

      // 更新单元格合并信息
      for (let i = 0; i < this.blockData.columns.length; i++) {
        let _key = this.blockData.columns[i].field + 'Data';
        for (let j = 0; j < this.blockData[tableDataKey].length; j++) {
          let id = this.blockData[tableDataKey][j][_key]?.id || '';
          let fatherId = this.blockData[tableDataKey][j][_key]?.fatherId || '';
          if (rowsList1.includes(id)) {
            this.blockData[tableDataKey][j][_key].colspan -= rowsList1.length;
          } else if (rowsList2.includes(fatherId)) {
            this.blockData[tableDataKey][j][_key].rowspan = 1;
            this.blockData[tableDataKey][j][_key].colspan = 1;
          }
        }
      }
      if (key) {
        // 删除列
        this.blockData.columns.splice(startColIndex, endColIndex - startColIndex + 1);
        this.refreshTable();
        this.saveTableContents();
      } else {
        let data = {
          tableTitleData: 'tableData',
          tableData: 'tableTitleData'
        };
        this.handleDeleteColumn(selectionRangeIndexes, data[this.tableDataKey]);
      }
    },
    // 获取选择的单元格
    getSelectRange(selectionRangeKeys, selectionRangeIndexes) {
      return new Promise(resolve => {
        let rowI = this.blockData[this.tableDataKey].findIndex(item => item.key == selectionRangeKeys.startRowKey);
        let colI = this.blockData.columns.findIndex(item => item.key == selectionRangeKeys.startColKey);
        let endR = this.blockData[this.tableDataKey].findIndex(item => item.key == selectionRangeKeys.endRowKey);
        let endC = this.blockData.columns.findIndex(item => item.key == selectionRangeKeys.endColKey);
        let rowspan = endR + this.blockData[this.tableDataKey][endR][this.blockData.columns[endC].key + 'Data'].rowspan - rowI - 1;
        let colspan = endC + this.blockData[this.tableDataKey][endR][this.blockData.columns[endC].key + 'Data'].colspan - colI - 1;
        resolve({
          rowI,
          colI,
          rowspan,
          colspan
        });
      });
    },
    // 处理合并单元格
    handleMergeCell(selectionRangeKeys, selectionRangeIndexes) {
      this.getSelectRange(selectionRangeKeys, selectionRangeIndexes).then(res => {
        let {
          rowI,
          colI,
          rowspan,
          colspan
        } = res;
        let field = '';
        const fatherId = this.blockData[this.tableDataKey][rowI].key + '_' + this.blockData.columns[colI].key;
        const getList = (r, c) => {
          for (let i = 0; i < colspan + 1; i++) {
            let isExist = this.blockData[this.tableDataKey][r].key + '_' + this.blockData.columns[c + i].key == fatherId;
            this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].id = this.blockData[this.tableDataKey][r].key + '_' + this.blockData.columns[c + i].key;
            this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].fatherId = fatherId;
            this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].rowspan = isExist ? 1 + rowspan : 0;
            this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].colspan = isExist ? 1 + colspan : 0;
            field += this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].field];
            this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].field] = '';
          }
          if (r < rowI + rowspan) {
            getList(r + 1, colI);
          } else {
            this.blockData[this.tableDataKey][selectionRangeIndexes.startRowIndex][this.blockData.columns[selectionRangeIndexes.startColIndex].field] = field;
            this.saveTableContents();
            this.refreshTable();
          }
        };
        getList(rowI, colI);
      });
    },
    // 处理数字输入框
    handleInputNumber(selectionRangeIndexes) {
      const index = selectionRangeIndexes.startColIndex;
      this.blockData.columns[index].cellType = 'input';
      for (let i = 0; i < this.blockData[this.tableDataKey].length; i++) {
        this.blockData[this.tableDataKey][i].eleValue = 0;
      }
      this.saveTableContents();
      this.refreshTable();
    },
    // 保存阅读端可输入的单元格
    handleTextarea(selectionRangeKeys, selectionRangeIndexes, isEdit) {
      this.getSelectRange(selectionRangeKeys, selectionRangeIndexes).then(res => {
        let {
          rowI,
          colI,
          rowspan,
          colspan
        } = res;
        const getList = (r, c) => {
          for (let i = 0; i < colspan + 1; i++) {
            this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].isEdit = isEdit;
          }
          if (r < rowI + rowspan) {
            getList(r + 1, colI);
          } else {
            this.saveTableContents();
            this.refreshTable();
          }
        };
        getList(rowI, colI);
      });
    },
    // 保存阅读端可输入的单元格
    diagonalSeparation(selectionRangeKeys, selectionRangeIndexes) {
      this.getSelectRange(selectionRangeKeys, selectionRangeIndexes).then(res => {
        let {
          rowI,
          colI,
          rowspan,
          colspan
        } = res;
        const getList = (r, c) => {
          for (let i = 0; i < colspan + 1; i++) {
            this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].cellType = 'diagonalSeparation';
          }
          if (r < rowI + rowspan) {
            getList(r + 1, colI);
          } else {
            this.saveTableContents();
            this.refreshTable();
          }
        };
        getList(rowI, colI);
      });
    },
    // 处理对齐方式
    handleAlign(type) {
      this.blockData.tableProperties.tableAlign = type;
    },
    handleBorder(type) {
      this.blockData.tableProperties[type] = !this.blockData.tableProperties[type];
    },
    // 处理表注提交
    handleNoteSubmit(note) {
      this.blockData.tableInfo.tableNote = note;
      this.saveTableContents();
    },
    // 处理单元格编辑提交
    handleCellSubmit({
      options,
      defaultValue,
      type
    }) {
      const index = this.selectionRangeIndexes.startColIndex;
      this.blockData.columns[index].cellType = type;
      this.blockData.columns[index].eleData = options;
      let key = this.blockData.columns[index].key;
      for (let i = 0; i < this.blockData[this.tableDataKey].length; i++) {
        this.blockData[this.tableDataKey][i][key + 'EleValue'] = defaultValue;
      }
      this.saveTableContents();
      this.refreshTable();
    },
    // 处理表头编辑提交
    handleHeaderSubmit(column) {
      const index = this.blockData.columns.findIndex(col => col.key === column.key);
      if (index > -1) {
        this.blockData.columns[index] = column;
        this.saveTableContents();
        this.refreshTable();
      }
    },
    // 单元格合并
    bodyCellSpan({
      row,
      column,
      rowIndex
    }) {
      return {
        rowspan: row[column.key + 'Data'].rowspan,
        colspan: row[column.key + 'Data'].colspan
      };
    },
    refreshTable() {
      setTimeout(() => {
        this.tableKey = 'key_' + v4();
      }, 100);
    },
    saveTableContents() {
      this.$EventBus.$emit('saveTableContents', this.blockData);
    },
    handleCellStyleConfirm() {
      this.showCellStyleMenu = false;
      this.saveTableContents();
      this.refreshTable();
    },
    handleMouseUp(e) {
      this.menuStyle = {
        left: e.layerX - 60 + 'px',
        top: e.layerY + 'px'
      };
      if (this.mode == 'editor' && e.button == 0) {
        let {
          selectionRangeKeys,
          selectionRangeIndexes
        } = this.$refs.veTable.getRangeCellSelection();
        this.selectionRangeKeys = selectionRangeKeys;
        this.selectionRangeIndexes = selectionRangeIndexes;
        setTimeout(() => {
          this.handleCellSettings(selectionRangeKeys, selectionRangeIndexes);
        }, 200);
      }
    },
    handleCellSettings(selectionRangeKeys, selectionRangeIndexes, activeTriggering) {
      console.log(selectionRangeKeys, selectionRangeIndexes);
      let {
        endColIndex,
        endRowIndex,
        startColIndex,
        startRowIndex
      } = selectionRangeIndexes;
      this.getSelectRange(selectionRangeKeys, selectionRangeIndexes).then(res => {
        let {
          rowI,
          colI,
          rowspan,
          colspan
        } = res;
        let isSingle = startColIndex == endColIndex && startRowIndex == endRowIndex;
        if (!activeTriggering && isSingle) {
          return;
        }
        let list = this.blockData[this.tableDataKey][rowI][this.blockData.columns[colI].key + 'Data'].className.split(' ');
        let justification = this.blockData[this.tableDataKey][rowI][this.blockData.columns[colI].key + 'Data'].justification;
        let style = {
          fontColor: this.blockData[this.tableDataKey][rowI][this.blockData.columns[colI].key + 'Data'].style.color || '',
          bgColor: this.blockData[this.tableDataKey][rowI][this.blockData.columns[colI].key + 'Data'].style.backgroundColor || ''
        };
        const getList = (r, c) => {
          for (let i = 0; i < colspan + 1; i++) {
            let classList = this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].className.split(' ');
            list = classList.filter(item => list.includes(item));
            let fontColor = this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].style.color || '';
            let bgColor = this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].style.backgroundColor || '';
            if (style.fontColor != fontColor) {
              style.fontColor = '';
            }
            if (style.bgColor != bgColor) {
              style.bgColor = '';
            }
            if (justification != this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].justification) {
              justification = '';
            }
          }
          if (r < rowI + rowspan) {
            getList(r + 1, colI);
          } else {
            this.$refs.CellStyleMenu.open({
              classList: list,
              justification,
              style,
              menuStyle: this.menuStyle
            });
          }
        };
        getList(rowI, colI);
      });
    },
    handleClick(item) {
      this.getSelectRange(this.selectionRangeKeys, this.selectionRangeIndexes).then(res => {
        let {
          rowI,
          colI,
          rowspan,
          colspan
        } = res;
        const getList = (r, c) => {
          for (let i = 0; i < colspan + 1; i++) {
            if (item.eventType == 'className') {
              this.handleCellClassName(item, r, c, i);
            } else if (item.eventType == 'color') {
              this.handleCellColor(item, r, c, i);
            } else if (item.eventType == 'bgColor') {
              this.handleCellBgColor(item, r, c, i);
            }
          }
          if (r < rowI + rowspan) {
            getList(r + 1, colI);
          }
        };
        getList(rowI, colI);
        this.saveTableContents();
        this.refreshTable();
      });
    },
    alignmentClick(item) {
      this.getSelectRange(this.selectionRangeKeys, this.selectionRangeIndexes).then(res => {
        let {
          rowI,
          colI,
          rowspan,
          colspan
        } = res;
        const getList = (r, c) => {
          for (let i = 0; i < colspan + 1; i++) {
            this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].justification = item.className;
          }
          if (r < rowI + rowspan) {
            getList(r + 1, colI);
          }
        };
        getList(rowI, colI);
        this.saveTableContents();
        this.refreshTable();
      });
    },
    // 处理表格单元格绑定className
    handleCellClassName(item, r, c, i) {
      if (item.type == 'add') {
        // 判断当前是否存在改className,不存在则添加
        if (!this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].className.includes(item.className)) {
          this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].className += ' ' + item.className;
        }
      } else {
        // 存在则删除
        this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].className = this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].className.replace(' ' + item.className, '').replace(item.className, '');
      }
    },
    handleCellColor(item, r, c, i) {
      // 修改单元格颜色
      this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].style.color = item.color;
    },
    handleCellBgColor(item, r, c, i) {
      this.blockData[this.tableDataKey][r][this.blockData.columns[c + i].key + 'Data'].style.backgroundColor = item.color;
    },
    closeMenu() {
      if (this.mode == 'editor') {
        this.$refs.CellStyleMenu.close();
      }
    }
  }
};

/* script */
const __vue_script__$7 = script$7;

/* template */
var __vue_render__$7 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _vm.blockData.tableInfo
    ? _c(
        "div",
        {
          class:
            _vm.tableDataKey == "tableTitleData" ? "border-bottom-none" : "",
        },
        [
          _c("ve-table", {
            key: _vm.tableKey,
            ref: "veTable",
            style: _vm.blockData.tableStyle,
            attrs: {
              rowKeyFieldName: "key",
              "max-height": _vm.blockData.tableProperties.maxHeight,
              "border-around": _vm.blockData.tableProperties.borderAround,
              "border-x": _vm.blockData.tableProperties.borderX,
              "border-y": _vm.blockData.tableProperties.borderY,
              columns: _vm.blockData.columns,
              "table-data": _vm.blockData[_vm.tableDataKey],
              "fixed-header": _vm.blockData.tableProperties.fixedHeader,
              "show-header": false,
              align: _vm.blockData.tableProperties.align,
              enable: _vm.blockData.tableProperties.enable,
              editOption: _vm.editOption,
              "cell-selection-option": _vm.cellSelectionOption,
              "contextmenu-body-option":
                _vm.mode == "editor" ? _vm.contextmenuBodyOption : {},
              "cell-span-option": _vm.cellSpanOption,
              "row-style-option": { stripe: true },
              "event-custom-option": _vm.eventCustomOption,
              "column-width-resize-option": _vm.columnWidthResizeOption,
            },
          }),
          _vm._v(" "),
          _c("edit-note", {
            ref: "editNote",
            on: { submit: _vm.handleNoteSubmit },
          }),
          _vm._v(" "),
          _c("edit-cell", {
            ref: "editCell",
            attrs: { value: _vm.currentCellOptions },
            on: { submit: _vm.handleCellSubmit },
          }),
          _vm._v(" "),
          _c("edit-header", {
            ref: "editHeader",
            on: { submit: _vm.handleHeaderSubmit },
          }),
          _vm._v(" "),
          _vm.mode == "editor"
            ? _c("cell-style-menu", {
                ref: "CellStyleMenu",
                on: {
                  handleClick: _vm.handleClick,
                  alignmentClick: _vm.alignmentClick,
                },
              })
            : _vm._e(),
        ],
        1
      )
    : _vm._e()
};
var __vue_staticRenderFns__$7 = [];
__vue_render__$7._withStripped = true;

  /* style */
  const __vue_inject_styles__$7 = undefined;
  /* scoped */
  const __vue_scope_id__$7 = undefined;
  /* module identifier */
  const __vue_module_identifier__$7 = undefined;
  /* functional template */
  const __vue_is_functional_template__$7 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$7 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$7, staticRenderFns: __vue_staticRenderFns__$7 },
    __vue_inject_styles__$7,
    __vue_script__$7,
    __vue_scope_id__$7,
    __vue_is_functional_template__$7,
    __vue_module_identifier__$7,
    false,
    undefined,
    undefined,
    undefined
  );

//
var script$6 = {
  name: 'XmlTableRender',
  components: {
    XmlVeTable: __vue_component__$7
  },
  props: {
    // 模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: 'editor'
    },
    // 属性中传递过来的块儿数据
    pBlockData: {
      type: Object,
      required: true
    },
    // 块儿数据名
    blockDataName: String,
    // 页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    officePreviewPath: {
      type: String,
      default: ''
    },
    // 当前所处组的规则
    currentRule: {
      type: Object,
      default: () => ({})
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: () => ({})
    },
    isReader: {
      type: Boolean,
      default: false
    },
    isShowFooter: {
      type: Boolean,
      default: true
    },
    isCanSubmit: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      // 表格唯一标识
      blockId: 'blockId' + Math.random(),
      propertyComponentsName: 'xml-table-property',
      // 当前块儿数据
      blockData: {}
    };
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        this.$nextTick(() => {
          if (this.mode === 'editor') {
            this.blockData = Object.assign({}, this.blockData, newValue);
          } else {
            this.blockData = JSON.parse(JSON.stringify(newValue));
          }
        });
      },
      deep: true,
      immediate: true
    }
  },
  computed: {
    xmlTableStyle() {
      return {
        '--xml-table-width': this.blockData.tableStyle.width || '#000000',
        '--xml-table-title-bg-color': this.blockData.tableProperties.backColor || '#000000',
        '--xml-table-border-color': this.blockData.tableProperties.borderColor || '#000000',
        '--xml-table-align': this.blockData.tableProperties.align || '1px',
        '--xml-table-font-family': this.blockData.tableProperties.fontFamily || 'solid',
        '--xml-table-color': this.blockData.tableProperties.fontColor || 'center',
        '--xml-table-size': this.blockData.tableProperties.fontSize || 'center'
      };
    },
    getTableWidthStyle() {
      if (this.blockData.tableProperties.widthType == '1') {
        return {
          width: this.blockData.tableStyle.width
        };
      }
    }
  },
  mounted() {
    // this.$nextTick(() => {
    //   setTimeout(() => {
    //     this.tableKey = 'key_' + uuidv4()
    //   }, 800)
    // })
  },
  methods: {
    // 块儿点击事件
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    },
    // 重置表格
    reset() {
      this.blockData = JSON.parse(JSON.stringify(this.pBlockData));
    },
    // 提交表格
    submit(item) {
      this.$emit('submitTable', item);
    },
    // 下载表格
    download(item) {
      const elink = document.createElement('a');
      elink.href = item.tableInfo?.uploadFileUrl;
      elink.download = item.tableInfo?.tableTitle;
      elink.style.display = 'none';
      document.body.appendChild(elink);
      setTimeout(() => {
        elink.click();
        document.body.removeChild(elink);
      }, 66);
    },
    // 查看表格
    viewTable(e) {
      this.$EventBus.$emit('openStudentResourceList', {
        activeName: 'record',
        firstLevelId: e.firstLevelId
      });
    },
    handleSetCellStyle(type) {
      // 根据type修改this.blockData.tableData[this.currentCell.row][列key]的样式字段
      // 例如：this.blockData.tableData[row][col].style = { bold: true }
    },
    tableClick() {
      this.$refs.xmlVeTableTitle.closeMenu();
      this.$refs.xmlVeTable.closeMenu();
    },
    blockContextmenu(e) {
      this.tableClick();
    }
  }
};

/* script */
const __vue_script__$6 = script$6;

/* template */
var __vue_render__$6 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _vm.blockData.tableInfo
    ? _c(
        "div",
        {
          staticClass: "xml-table",
          class: "xml-table-container-" + _vm.pageType,
          style: _vm.xmlTableStyle,
          attrs: { id: _vm.blockId },
          on: { click: _vm.blockClick, contextmenu: _vm.blockContextmenu },
        },
        [
          _c(
            "div",
            {
              staticClass: "xml-table-container",
              on: { click: _vm.tableClick },
            },
            [
              _vm.blockData.tableInfo &&
              _vm.blockData.tableInfo.showTitle != "0"
                ? _c("div", { staticClass: "xml-table-title" }, [
                    _vm._v(
                      "\n      " +
                        _vm._s(_vm.blockData.tableInfo.tableTitle) +
                        "\n    "
                    ),
                  ])
                : _vm._e(),
              _vm._v(" "),
              _c(
                "div",
                {
                  staticClass: "xml-table-content",
                  style: _vm.getTableWidthStyle,
                },
                [
                  _c("xml-ve-table", {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value:
                          _vm.blockData.tableProperties.showHeader == "true",
                        expression:
                          "blockData.tableProperties.showHeader=='true'",
                      },
                    ],
                    ref: "xmlVeTableTitle",
                    attrs: {
                      mode: _vm.mode,
                      pBlockData: _vm.pBlockData,
                      currentRule: _vm.currentRule,
                      tableDataKey: "tableTitleData",
                    },
                  }),
                  _vm._v(" "),
                  _c("xml-ve-table", {
                    ref: "xmlVeTable",
                    attrs: {
                      mode: _vm.mode,
                      pBlockData: _vm.pBlockData,
                      currentRule: _vm.currentRule,
                      tableDataKey: "tableData",
                    },
                  }),
                ],
                1
              ),
              _vm._v(" "),
              _vm.blockData.tableInfo.tableNote
                ? _c("div", {
                    staticClass: "xml-table-note",
                    domProps: {
                      innerHTML: _vm._s(_vm.blockData.tableInfo.tableNote),
                    },
                  })
                : _vm._e(),
              _vm._v(" "),
              _vm.blockData.tableInfo.isCanSubmit != "false" && _vm.isShowFooter
                ? _c("div", { staticClass: "xml-table-footer" }, [
                    _c(
                      "div",
                      { staticClass: "left" },
                      [
                        _vm.isCanSubmit
                          ? [
                              _vm._v("\n          已填写"),
                              _c("span", [
                                _vm._v(
                                  _vm._s(_vm.blockData.fillInTheNumber || 0)
                                ),
                              ]),
                              _vm._v("次， 去"),
                              _c(
                                "span",
                                {
                                  staticClass: "view-records",
                                  on: {
                                    click: function ($event) {
                                      return _vm.viewTable(_vm.blockData)
                                    },
                                  },
                                },
                                [_vm._v("查看>")]
                              ),
                            ]
                          : _vm._e(),
                      ],
                      2
                    ),
                    _vm._v(" "),
                    _c("div", { staticClass: "right" }, [
                      _vm.isCanSubmit
                        ? _c(
                            "div",
                            {
                              staticClass: "xml-table-footer-btn icon_1",
                              on: {
                                click: function ($event) {
                                  return _vm.reset(_vm.blockData)
                                },
                              },
                            },
                            [_vm._v("重置")]
                          )
                        : _vm._e(),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value:
                                _vm.blockData.tableProperties.isCanDownload ==
                                "1",
                              expression:
                                "blockData.tableProperties.isCanDownload == '1'",
                            },
                          ],
                          staticClass: "xml-table-footer-btn icon_2",
                          on: {
                            click: function ($event) {
                              return _vm.download(_vm.blockData)
                            },
                          },
                        },
                        [_vm._v("\n          下载\n        ")]
                      ),
                      _vm._v(" "),
                      _vm.isCanSubmit
                        ? _c(
                            "div",
                            {
                              staticClass: "xml-table-footer-btn icon_3",
                              on: {
                                click: function ($event) {
                                  return _vm.submit(_vm.blockData)
                                },
                              },
                            },
                            [_vm._v("提交")]
                          )
                        : _vm._e(),
                    ]),
                  ])
                : _vm._e(),
            ]
          ),
        ]
      )
    : _vm._e()
};
var __vue_staticRenderFns__$6 = [];
__vue_render__$6._withStripped = true;

  /* style */
  const __vue_inject_styles__$6 = undefined;
  /* scoped */
  const __vue_scope_id__$6 = undefined;
  /* module identifier */
  const __vue_module_identifier__$6 = undefined;
  /* functional template */
  const __vue_is_functional_template__$6 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$6 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$6, staticRenderFns: __vue_staticRenderFns__$6 },
    __vue_inject_styles__$6,
    __vue_script__$6,
    __vue_scope_id__$6,
    __vue_is_functional_template__$6,
    __vue_module_identifier__$6,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$6.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('resource-render', {
    prefix: options.prefix
  }), __vue_component__$6);
};

//
var script$5 = {
  name: 'XmlEchartsRender',
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //属性中传递过来的块儿数据
    pBlockData: {},
    //块儿数据名
    blockDataName: String,
    //页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    officePreviewPath: {
      type: String,
      default: ''
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  watch: {
    pBlockData: {
      handler(newValue) {
        // console.log(newValue, 'xmlEcharts页')
        this.$nextTick(() => {
          if (this.mode === 'editor') {
            this.blockData = Object.assign({}, this.blockData, newValue);
          } else {
            this.blockData = JSON.parse(JSON.stringify(newValue));
          }
          this.echartsWidth = this.blockData.width;
          this.echartsHeight = this.blockData.height;
          // this.styleModel = this.blockData.styleModel
          this.blockData.code = this.replaceTextInJson(newValue.code, this.blockData.title);
          if (this.blockData.showTitle == '1') {
            this.blockData.code = this.blockData.code.replace(/\s*"text":\s*"[^"]*"/, '"text": ""');
          }
          // console.log(this.blockData.code, 'xmlEcharts页')
          // this.chart = null
          setTimeout(() => {
            this.tableKey = 'key_' + v4();
            this.initChart();
          }, 500);
          // console.log(newValue, 'blockData', this.blockData)
        });
      },
      deep: true,
      immediate: true
    }
  },
  data() {
    return {
      blockId: 'blockId' + Math.random(),
      propertyComponentsName: 'xml-echarts-property',
      //当前块儿数据，一般用不到，因为一般的块儿中不会在块儿内更改数据
      blockData: {},
      code: `{
    "title": {
      "text": "示例图表",
    "left": "center"
    },
    "xAxis": {
      "type": "category",
      "data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
    },
    "yAxis": {
      "type": "value"
    },
    "series": [{
      "data": [150, 230, 224, 218, 135, 147, 260],
      "type": "line"
    }]
  }`,
      cmOptions: {
        tabSize: 2,
        mode: 'text/javascript',
        theme: 'monokai',
        lineNumbers: true,
        line: true
      },
      showTitle: '0',
      styleModel: 'light',
      title: '示例图表',
      chart: null,
      tableKey: 'key_' + v4(),
      echartsWidth: '',
      echartsHeight: ''
    };
  },
  mounted() {
    // this.initChart()
  },
  methods: {
    initChart() {
      // console.log('initChart', this.styleModel);
      this.chart = null;
      this.chart = init$1(this.$refs.chart, this.styleModel);
      this.chart.setTheme(this.styleModel);
      //  echarts.registerTheme('myTheme', themeName);
      this.chart.resize();
      this.updateChart();
    },
    // 更新图表
    updateChart() {
      try {
        // console.log(this.blockData.code);
        if (this.chart) {
          const option = JSON.parse(this.blockData.code);
          this.chart.setOption(option);
          // this.changeTheme(this.styleModel)
          if (this.styleModel != this.blockData.styleModel) {
            this.styleModel = this.blockData.styleModel;
            this.changeTheme(this.styleModel);
          }
        }
      } catch (error) {
        console.error('配置解析错误:', error);
      }
    },
    // 替换主题色
    changeTheme(newTheme) {
      // console.log('替换主题方法');
      if (this.chart) {
        // console.log('进入替换主题');
        this.styleModel = newTheme; // 更新主题数据属性
        this.chart.dispose(); // 销毁实例以重新初始化并应用新主题
        this.initChart(); // 重新初始化图表以应用新主题
      }
    },
    // 替换标题名字
    replaceTextInJson(jsonStr, newValue, global = false) {
      // 转义newValue中的特殊字符，避免正则问题
      const escapedValue = newValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
      let regex;
      if (global) {
        // 全局替换所有"text": "value"模式
        regex = new RegExp(/"text":\s*"[^"]*"/g);
        return jsonStr.replace(regex, `"text": "${escapedValue}"`);
      } else {
        // 仅替换第一层title下的text字段
        regex = /s*"text":\s*"[^"]*"/;
        return jsonStr.replace(regex, `"text": "${escapedValue}"`);
      }
    },
    blockClick() {
      this.$emit('blockclick', {
        blockData: this.blockData,
        dataName: this.blockDataName,
        propertyComponentsName: this.propertyComponentsName,
        blockId: this.blockId,
        ruleIndex: this.ruleIndex
      });
    }
  }
};

/* script */
const __vue_script__$5 = script$5;
/* template */
var __vue_render__$5 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _vm.blockData
    ? _c(
        "div",
        {
          staticClass: "xml-echarts",
          class: "xml-echarts-container-" + _vm.pageType,
          style: { textAlign: _vm.blockData.align },
          attrs: { id: _vm.blockId },
          on: { click: _vm.blockClick },
        },
        [
          _c(
            "div",
            {
              staticClass: "xml-echarts-container",
              style: {
                width: _vm.blockData.width,
                maxHeight: "500px",
                height: _vm.blockData.height,
              },
            },
            [
              _c("div", {
                ref: "chart",
                staticClass: "chart",
                attrs: { id: _vm.tableKey },
              }),
            ]
          ),
        ]
      )
    : _vm._e()
};
var __vue_staticRenderFns__$5 = [];
__vue_render__$5._withStripped = true;

  /* style */
  const __vue_inject_styles__$5 = undefined;
  /* scoped */
  const __vue_scope_id__$5 = "data-v-1305eba8";
  /* module identifier */
  const __vue_module_identifier__$5 = undefined;
  /* functional template */
  const __vue_is_functional_template__$5 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$5 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$5, staticRenderFns: __vue_staticRenderFns__$5 },
    __vue_inject_styles__$5,
    __vue_script__$5,
    __vue_scope_id__$5,
    __vue_is_functional_template__$5,
    __vue_module_identifier__$5,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$5.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('resource-render', {
    prefix: options.prefix
  }), __vue_component__$5);
};

//
var script$4 = {
  name: "XmlSingleObjectModalGroupRender",
  components: {
    XmlObjectModal: __vue_component__$m
  },
  mixins: [singleGroupMixin],
  // components: {  },
  data() {
    return {
      typeText: "三维模型",
      object3DDataName: "Object3DData",
      groupData: {}
    };
  },
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return "editor";
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: "h5"
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  created() {
    this.groupData = this.pGroupData;
  },
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit("blockclick", {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    }
  }
};

/* script */
const __vue_script__$4 = script$4;
/* template */
var __vue_render__$4 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-object-modal-group",
        "xml-single-object-modal-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            "page-type": _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-object-modal", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.object3DDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.object3DDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              mode: _vm.mode,
            },
            on: { blockclick: _vm.handleBlockClick },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$4 = [];
__vue_render__$4._withStripped = true;

  /* style */
  const __vue_inject_styles__$4 = undefined;
  /* scoped */
  const __vue_scope_id__$4 = "data-v-3fc8725d";
  /* module identifier */
  const __vue_module_identifier__$4 = undefined;
  /* functional template */
  const __vue_is_functional_template__$4 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$4 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 },
    __vue_inject_styles__$4,
    __vue_script__$4,
    __vue_scope_id__$4,
    __vue_is_functional_template__$4,
    __vue_module_identifier__$4,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$4.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1(__vue_component__$4.name, {
    prefix: options.prefix
  }), __vue_component__$4);
};

//

/**
 * 单图片组合
 */
var script$3 = {
  name: 'XmlSingleTextareaGroupRender',
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图片',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      textareaBlockDataName: 'textareaData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    clickImg() {
      this.$emit('clickImg');
    }
  }
};

/* script */
const __vue_script__$3 = script$3;

/* template */
var __vue_render__$3 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-textarea-group",
        "xml-single-textarea-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            pageType: _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-textarea-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.textareaBlockDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.textareaBlockDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              "show-title": true,
              pageType: _vm.pageType,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: { blockclick: _vm.handleBlockClick, clickImg: _vm.clickImg },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$3 = [];
__vue_render__$3._withStripped = true;

  /* style */
  const __vue_inject_styles__$3 = undefined;
  /* scoped */
  const __vue_scope_id__$3 = undefined;
  /* module identifier */
  const __vue_module_identifier__$3 = undefined;
  /* functional template */
  const __vue_is_functional_template__$3 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$3 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 },
    __vue_inject_styles__$3,
    __vue_script__$3,
    __vue_scope_id__$3,
    __vue_is_functional_template__$3,
    __vue_module_identifier__$3,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$3.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-textarea-group-render', {
    prefix: options.prefix
  }), __vue_component__$3);
};

//

/**
 * 单图片组合
 */
var script$2 = {
  name: 'XmlSingleTableGroupRender',
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    },
    isShowFooter: {
      type: Boolean,
      default: true
    },
    isCanSubmit: {
      // 是否允许提交表格
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      typeText: '表格',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      tableBlockDataName: 'tableData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
    console.log(this.groupData, 'groupData页');
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    submitTable(e) {
      this.$emit('submitTable', e);
    }
  }
};

/* script */
const __vue_script__$2 = script$2;

/* template */
var __vue_render__$2 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-table-group",
        "xml-single-table-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            pageType: _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-table-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.tableBlockDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.tableBlockDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              "show-title": true,
              pageType: _vm.pageType,
              isShowFooter: _vm.isShowFooter,
              isCanSubmit: _vm.isCanSubmit,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: {
              blockclick: _vm.handleBlockClick,
              submitTable: _vm.submitTable,
            },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__$2 = [];
__vue_render__$2._withStripped = true;

  /* style */
  const __vue_inject_styles__$2 = undefined;
  /* scoped */
  const __vue_scope_id__$2 = undefined;
  /* module identifier */
  const __vue_module_identifier__$2 = undefined;
  /* functional template */
  const __vue_is_functional_template__$2 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$2 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
    __vue_inject_styles__$2,
    __vue_script__$2,
    __vue_scope_id__$2,
    __vue_is_functional_template__$2,
    __vue_module_identifier__$2,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$2.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-textarea-group-render', {
    prefix: options.prefix
  }), __vue_component__$2);
};

//

/**
 * 单图片组合
 */
var script$1 = {
  name: 'XmlSinglePlaceholderGroupRender',
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '图片',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      textareaBlockDataName: 'textareaData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    clickImg() {
      this.$emit('clickImg');
    }
  }
};

/* script */
const __vue_script__$1 = script$1;

/* template */
var __vue_render__$1 = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", {
    staticClass: "parent-group-mark",
    class: ["xml-single-placeholder-group"],
    on: { click: _vm.emitClick },
  })
};
var __vue_staticRenderFns__$1 = [];
__vue_render__$1._withStripped = true;

  /* style */
  const __vue_inject_styles__$1 = undefined;
  /* scoped */
  const __vue_scope_id__$1 = undefined;
  /* module identifier */
  const __vue_module_identifier__$1 = undefined;
  /* functional template */
  const __vue_is_functional_template__$1 = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
    __vue_inject_styles__$1,
    __vue_script__$1,
    __vue_scope_id__$1,
    __vue_is_functional_template__$1,
    __vue_module_identifier__$1,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__$1.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-placeholder-group-render', {
    prefix: options.prefix
  }), __vue_component__$1);
};

//

/**
 * 单图片组合
 */
var script = {
  name: 'XmlSingleEchartsGroupRender',
  mixins: [singleGroupMixin],
  props: {
    //模式：preview 预览 (默认)，editor 编辑
    mode: {
      type: String,
      default: function () {
        return 'editor';
      }
    },
    //必须有此属性，接收初始化值
    pGroupData: {
      type: Object,
      default: function () {
        return {};
      }
    },
    //当前所处组的规则
    currentRule: {
      type: Object,
      default: function () {
        return {};
      }
    },
    ruleIndex: Number,
    //必须有此属性，页面类型，取值h5、pc、pad
    pageType: {
      type: String,
      default: 'h5'
    },
    resourceBasisPath: {
      type: String,
      default: ''
    },
    extendParams: {
      type: Object,
      default: function () {
        return {};
      }
    }
  },
  data() {
    return {
      typeText: '可视图',
      //定义此变量，是为了解决页面中有多个块儿的情况。
      echartsBlockDataName: 'echartsData',
      groupData: {}
    };
  },
  created() {
    this.groupData = this.pGroupData;
    console.log(this.groupData, 'groupData页');
  },
  mounted() {},
  methods: {
    //
    /***
     * 固定方法。接收固定参数
     * 此方法接收块儿点击事件，事件传递块相关参数
     * @param blockData 块中的data属性数据
     * @param dataName 块data数据在组中时，属性key
     * @param propertyComponentsName 块儿对应的属性组件名
     */
    handleBlockClick({
      blockData,
      dataName,
      propertyComponentsName,
      blockId,
      ruleIndex
    }) {
      this.$emit('blockclick', {
        groupData: this.groupData,
        blockData,
        dataName,
        propertyComponentsName,
        currentRule: this.currentRule,
        blockId,
        ruleIndex
      });
    },
    clickImg() {
      this.$emit('clickImg');
    }
  }
};

/* script */
const __vue_script__ = script;

/* template */
var __vue_render__ = function () {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(
    "div",
    {
      staticClass: "parent-group parent-group-mark",
      class: [
        "xml-single-mind-group",
        "xml-single-mind-group-" + _vm.pageType,
        _vm.groupIsActive ? "active" : "",
      ],
      on: { click: _vm.emitClick },
    },
    [
      _c(
        "xml-group-render",
        {
          ref: "xmlGroup",
          attrs: {
            pageType: _vm.pageType,
            mode: _vm.mode,
            "type-text": _vm.typeText,
            "rule-index": _vm.ruleIndex,
          },
          scopedSlots: _vm._u(
            [
              {
                key: "action-buttons",
                fn: function () {
                  return [_vm._t("default")]
                },
                proxy: true,
              },
            ],
            null,
            true
          ),
        },
        [
          _vm._v(" "),
          _c("xml-echarts-render", {
            attrs: {
              "p-block-data": _vm.groupData[_vm.echartsBlockDataName],
              "current-rule": _vm.currentRule,
              "block-data-name": _vm.echartsBlockDataName,
              "extend-params": _vm.extendParams,
              "rule-index": _vm.ruleIndex,
              "show-title": true,
              pageType: _vm.pageType,
              mode: _vm.mode,
              resourceBasisPath: _vm.resourceBasisPath,
            },
            on: { blockclick: _vm.handleBlockClick, clickImg: _vm.clickImg },
          }),
        ],
        1
      ),
    ],
    1
  )
};
var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;

  /* style */
  const __vue_inject_styles__ = undefined;
  /* scoped */
  const __vue_scope_id__ = undefined;
  /* module identifier */
  const __vue_module_identifier__ = undefined;
  /* functional template */
  const __vue_is_functional_template__ = false;
  /* style inject */
  
  /* style inject SSR */
  
  /* style inject shadow dom */
  

  
  const __vue_component__ = /*#__PURE__*/normalizeComponent(
    { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
    __vue_inject_styles__,
    __vue_script__,
    __vue_scope_id__,
    __vue_is_functional_template__,
    __vue_module_identifier__,
    false,
    undefined,
    undefined,
    undefined
  );

__vue_component__.install = (Vue, options = {}) => {
  Vue.component(createNamespace$1('single-textarea-group-render', {
    prefix: options.prefix
  }), __vue_component__);
};

vhCheck();
const publicLibComponents = [Popup, Icon$3, Tab, Tabs, NavBar, VeTable];
const components = [__vue_component__$64, __vue_component__$62, __vue_component__$61, __vue_component__$60, __vue_component__$5$, __vue_component__$5G, __vue_component__$5F, __vue_component__$5x, __vue_component__$5D,
// XmlVideo,
__vue_component__$5w,
// XmlHotzone,
// XmlLayout,
__vue_component__$3r, __vue_component__$3q, __vue_component__$3p, __vue_component__$3o, __vue_component__$3n, __vue_component__$3m, __vue_component__$3l, __vue_component__$3k, __vue_component__$3j, __vue_component__$3i, __vue_component__$3h, __vue_component__$3g, __vue_component__$3f, __vue_component__$3e, __vue_component__$3d, __vue_component__$3c, __vue_component__$3b, __vue_component__$v, __vue_component__$u, __vue_component__$68, __vue_component__$5u, __vue_component__$n, __vue_component__$m, __vue_component__$4, __vue_component__$l, __vue_component__$3, __vue_component__$1, __vue_component__$j, __vue_component__$k, __vue_component__$6, __vue_component__$2, __vue_component__$5, __vue_component__];
const styledComponents = [];
// 多个导出的组件使用AddComponent方法将全部导出添加到components
AddComponent(XmlMusic);
AddComponent(XmlTitle, true);
AddComponent(ImageText, true);
AddComponent(paragraph, true);
AddComponent(splitline, true);
AddComponent(XmlReader);
AddComponent(XmlTitleLibrary, true);
AddComponent(xmlParagraphLibrary, true);
AddComponent(xmlImageTextLibrary, true);
AddComponent(xmlSplitlineLibrary, true);
AddComponent(XmlText, true);
AddComponent(XmlHotzone);
AddComponent(XmlLayout);
AddComponent(XmlVideo, true);
AddComponent(xmlView$1);
const EventBus = new Vue();
let imgApp;
let instance;
let hevueImgPreviewConfig;
const install = async (Vue, options = {}) => {
  // 判断是否安装
  if (install.installed) return;
  install.installed = true;
  components.forEach(component => {
    Vue.component(createNamespace$1(component.name, {
      prefix: options.prefix,
      isUnPrefix: component.isUnPrefix
    }), component);
    // console.log('xml普通组件注册',component, options, createNamespace(component.name, { prefix: options.prefix,isUnPrefix:component.isUnPrefix }))
  });
  styledComponents.forEach(component => {
    Vue.component(createNamespace$1(component.name, {
      prefix: options.prefix,
      isUnPrefix: true
    }), component);
    // console.log(
    //   'xml样式库组件注册',
    //   component,
    //   options,
    //   createNamespace(component.name, { prefix: options.prefix, isUnPrefix: true })
    // )
  });
  publicLibComponents.forEach(component => {
    Vue.use(component);
  });

  // console.log({ instance: Vue })

  Vue.prototype.$EventBus = EventBus;
  Vue.prototype.$iconfont = options.iconfont || 'iconfont';
  Vue.prototype.$useNamespace = useNamespace;
  hevueImgPreviewConfig = options;
  let _vue = await (await import('vue')).default;
  imgApp = _vue.extend(__vue_component__$n);
  _vue.prototype.$hevueImgPreview = ImgPreview;
};

// 判断调用vue加载器，实现全局加载
if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue);
}

// 将组件添加到components进行注册
function AddComponent(data, isStyled) {
  Object.keys(data).forEach(key => {
    isStyled ? styledComponents.push(data[key]) : components.push(data[key]);
  });
}
const ImgPreview = (options = {}) => {
  if (typeof options === 'string') {
    options = {
      url: options
    };
  }

  // 优先采取局部配置，其次采取全局配置
  Object.keys(hevueImgPreviewConfig).map(name => {
    if (options[name] == undefined) {
      options[name] = hevueImgPreviewConfig[name];
    }
  });
  instance = new imgApp({
    data: options
  });
  instance.$mount();
  let dom = instance.$el;
  document.body.appendChild(dom);
  instance.show();
  return instance;
};
const GraphHelper = {
  findNodeTree,
  findParent,
  replaceKeywordsInHTML
};

// Vue.use 和按需加载都可以
var index = {
  install,
  updateElementTheme,
  updateUITheme,
  formatTextBook,
  ...components
};

export { GraphHelper, MagicLinkPopover, index as default };
